@xopcai/xopc 0.0.357 → 0.0.358

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 (422) hide show
  1. package/dist/browser-ext/manifest.json +1 -1
  2. package/dist/extensions/feishu/src/adapters/cli-login.js +3 -3
  3. package/dist/extensions/feishu/src/outbound/media-load.js +1 -1
  4. package/dist/extensions/telegram/src/inbound-processor.js +2 -2
  5. package/dist/extensions/telegram/src/outbound-sender.js +1 -1
  6. package/dist/extensions/telegram/src/plugin.js +2 -2
  7. package/dist/extensions/telegram/xopc.extension.json +1 -1
  8. package/dist/extensions/weixin/src/api/api.js +2 -2
  9. package/dist/extensions/weixin/src/auth/accounts.js +12 -12
  10. package/dist/extensions/weixin/src/messaging/debug-mode.js +5 -5
  11. package/dist/extensions/weixin/src/messaging/inbound.js +11 -11
  12. package/dist/gateway/static/root/assets/{activity-store-Bj0GuUUk.js → activity-store-CnmHVy1D.js} +1 -1
  13. package/dist/gateway/static/root/assets/{agent-avatar-dicebear-5q-LyRB2.js → agent-avatar-dicebear-DEs_xwQi.js} +1 -1
  14. package/dist/gateway/static/root/assets/{agent-defaults-settings-panel-BOojrPNq.js → agent-defaults-settings-panel-B23VK3UU.js} +1 -1
  15. package/dist/gateway/static/root/assets/{agent-plugin-dialog-3fkKAT0r.js → agent-plugin-dialog-BuKJ-Ybo.js} +1 -1
  16. package/dist/gateway/static/root/assets/{agents-DJyRK5vN.js → agents-DxH-UFs7.js} +3 -3
  17. package/dist/gateway/static/root/assets/{agents-admin-api-CYqmO7gb.js → agents-admin-api-BtnYiq7O.js} +1 -1
  18. package/dist/gateway/static/root/assets/{app-management-settings-panel-8ODazg-Y.js → app-management-settings-panel-BqyvMQXO.js} +1 -1
  19. package/dist/gateway/static/root/assets/{appearance-settings-0G9nGAsa.js → appearance-settings-Cn9qgXLw.js} +1 -1
  20. package/dist/gateway/static/root/assets/{apps-page-CJyfU05v.js → apps-page-ChPOmrPa.js} +1 -1
  21. package/dist/gateway/static/root/assets/{archive-plugin-BZHSbFiu.js → archive-plugin-DZCN9m71.js} +1 -1
  22. package/dist/gateway/static/root/assets/{automations-page-egZn4y94.js → automations-page-OUapkL2D.js} +1 -1
  23. package/dist/gateway/static/root/assets/{automations-workspace-CI1EK1eb.js → automations-workspace-DMqpfefB.js} +1 -1
  24. package/dist/gateway/static/root/assets/{binary-plugins-x2-RmzUs.js → binary-plugins-U63xxRgh.js} +1 -1
  25. package/dist/gateway/static/root/assets/{block-editor-Bi-NBvGE.js → block-editor-_-QK0EnY.js} +1 -1
  26. package/dist/gateway/static/root/assets/{browser-automation-inputs-uQ2AGFFU.js → browser-automation-inputs-CnLQ649y.js} +1 -1
  27. package/dist/gateway/static/root/assets/{browser-automations-page-D2AYNyC2.js → browser-automations-page-DZlWdikj.js} +1 -1
  28. package/dist/gateway/static/root/assets/{browser-settings-page-DVMJRsch.js → browser-settings-page-CEF_LSjz.js} +1 -1
  29. package/dist/gateway/static/root/assets/{capabilities-Btku0cS3.js → capabilities-BXG_5wIg.js} +1 -1
  30. package/dist/gateway/static/root/assets/{capabilities-Cl1RErL_.js → capabilities-Bigu28Z6.js} +1 -1
  31. package/dist/gateway/static/root/assets/{capabilities-page-CBdEzKy1.js → capabilities-page-KUggKcIq.js} +2 -2
  32. package/dist/gateway/static/root/assets/{capabilities-settings-panel-B7f1WLgL.js → capabilities-settings-panel-CD5K7e1B.js} +1 -1
  33. package/dist/gateway/static/root/assets/{capability-header-actions-BuYo4ONV.js → capability-header-actions-CA_XNTSW.js} +1 -1
  34. package/dist/gateway/static/root/assets/{channels-COGpGGqA.js → channels-CG_xCUnf.js} +1 -1
  35. package/dist/gateway/static/root/assets/{chat-terminal-dock-DJnrcf3F.js → chat-terminal-dock-DRV-4qeP.js} +1 -1
  36. package/dist/gateway/static/root/assets/{computer-settings-page-CbKp1tj0.js → computer-settings-page-CqY40STw.js} +1 -1
  37. package/dist/gateway/static/root/assets/{connector-service-page-BxJquXDl.js → connector-service-page-BKAt0jvO.js} +1 -1
  38. package/dist/gateway/static/root/assets/{connectors-page-DJocZ_mY.js → connectors-page-Cn14oruE.js} +1 -1
  39. package/dist/gateway/static/root/assets/{date-picker-CYQyKepm.js → date-picker-B4jSGi8k.js} +1 -1
  40. package/dist/gateway/static/root/assets/{dependency-picker-dc-q0G_j.js → dependency-picker-D0RWVtBt.js} +1 -1
  41. package/dist/gateway/static/root/assets/{desktop-pet-gvvvaJ51.js → desktop-pet-9B1PIjsV.js} +1 -1
  42. package/dist/gateway/static/root/assets/{desktop-pet-settings-w8qYvD9r.js → desktop-pet-settings-cq5n59Pr.js} +1 -1
  43. package/dist/gateway/static/root/assets/{device-pairing-wizard-CAQ2qJIZ.js → device-pairing-wizard-DKO8iqDJ.js} +1 -1
  44. package/dist/gateway/static/root/assets/{directory-picker-path-field-BfJOJnPB.js → directory-picker-path-field-C40-GlX1.js} +1 -1
  45. package/dist/gateway/static/root/assets/{extension-debug-page-DPc3vTw0.js → extension-debug-page-BodxNAys.js} +1 -1
  46. package/dist/gateway/static/root/assets/{extension-page-BpyU7d5e.js → extension-page-BshgQ_pO.js} +1 -1
  47. package/dist/gateway/static/root/assets/{extension-provider-D-0AeFhE.js → extension-provider-aigS3RJu.js} +1 -1
  48. package/dist/gateway/static/root/assets/{extension-settings-page-BlzNJ6hK.js → extension-settings-page-DAJZVzIQ.js} +1 -1
  49. package/dist/gateway/static/root/assets/{gateway-config-swr-Da3Oob_s.js → gateway-config-swr-EZxaKXdC.js} +1 -1
  50. package/dist/gateway/static/root/assets/{gateway-realtime-BDh3i8n7.js → gateway-realtime-DBRa17u3.js} +1 -1
  51. package/dist/gateway/static/root/assets/gateway-realtime-store-7glMlD2l.js +1 -0
  52. package/dist/gateway/static/root/assets/{gateway-settings-DyreTpro.js → gateway-settings-DAQu7q_Q.js} +1 -1
  53. package/dist/gateway/static/root/assets/{gateway-startup-retry-BEj_bcbm.js → gateway-startup-retry-Wtxq_y2f.js} +1 -1
  54. package/dist/gateway/static/root/assets/{home-page-rKyHpQpb.js → home-page-BHS2713D.js} +1 -1
  55. package/dist/gateway/static/root/assets/{image-generation-api-8jfU8AlD.js → image-generation-api-Bnl0CH4n.js} +1 -1
  56. package/dist/gateway/static/root/assets/{imports-page-BHUlyE3u.js → imports-page-Bsn8Qted.js} +1 -1
  57. package/dist/gateway/static/root/assets/{index-DOFuObNM.js → index-BcTY7RBG.js} +6 -6
  58. package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-Pb-3Ryr9.js → keyboard-shortcuts-settings-DjuXyBbC.js} +1 -1
  59. package/dist/gateway/static/root/assets/{local-app-workbench-page-yWS0QdRe.js → local-app-workbench-page-D77r2CKa.js} +1 -1
  60. package/dist/gateway/static/root/assets/{local-apps-page-DgQHDdZh.js → local-apps-page-GsohMT3J.js} +1 -1
  61. package/dist/gateway/static/root/assets/{local-session-drafts-jOqfUlwj.js → local-session-drafts-CeHhcudO.js} +1 -1
  62. package/dist/gateway/static/root/assets/{locale-store-DodizOrj.js → locale-store-ChN_vjs2.js} +1 -1
  63. package/dist/gateway/static/root/assets/{logs-page-CwTIW0J0.js → logs-page-DeBeNPb4.js} +1 -1
  64. package/dist/gateway/static/root/assets/{management-settings-Dm2Fa1QY.js → management-settings-Di9r7yBX.js} +1 -1
  65. package/dist/gateway/static/root/assets/{markdown-view-Bb6ohqHz.js → markdown-view-DKlJx4eo.js} +1 -1
  66. package/dist/gateway/static/root/assets/{media-plugins-DIhqKSK5.js → media-plugins-JWzrPQwt.js} +1 -1
  67. package/dist/gateway/static/root/assets/messages-CnM6Qfr7.js +3 -0
  68. package/dist/gateway/static/root/assets/models-hub-cache-DnIOzcvn.js +1 -0
  69. package/dist/gateway/static/root/assets/{note-detail-panel-D9iPUCQq.js → note-detail-panel-CLq8afeQ.js} +3 -3
  70. package/dist/gateway/static/root/assets/{notes-api-DYfvIxWh.js → notes-api-D8nvWMMC.js} +1 -1
  71. package/dist/gateway/static/root/assets/{notes-page-CbzhN_on.js → notes-page-FORwlFnt.js} +1 -1
  72. package/dist/gateway/static/root/assets/{oauth-api-gSu-iTk5.js → oauth-api-BXn1a9qx.js} +1 -1
  73. package/dist/gateway/static/root/assets/{page-context-capture-button-B6i0R1qQ.js → page-context-capture-button-C9H1dHg2.js} +1 -1
  74. package/dist/gateway/static/root/assets/personal-page-BpTFGG44.js +1 -0
  75. package/dist/gateway/static/root/assets/{product-open-page-CMmB1iyB.js → product-open-page-pW662VEC.js} +1 -1
  76. package/dist/gateway/static/root/assets/project-detail-page-3_Bqq0OV.js +1 -0
  77. package/dist/gateway/static/root/assets/{projects-page-CmjHjX8D.js → projects-page-D85PDbCM.js} +1 -1
  78. package/dist/gateway/static/root/assets/{registry-api-D0eYNizR.js → registry-api-BM_81rLe.js} +1 -1
  79. package/dist/gateway/static/root/assets/{remote-access-hub-WKPLG5V4.js → remote-access-hub-CzzTxbhr.js} +1 -1
  80. package/dist/gateway/static/root/assets/{runtime-tools-settings-panel-D1IEye-5.js → runtime-tools-settings-panel-BUgsyhm_.js} +1 -1
  81. package/dist/gateway/static/root/assets/{scenes-page-CDxjO8IH.js → scenes-page-Bds4V34P.js} +1 -1
  82. package/dist/gateway/static/root/assets/{schema-form-DrSp5o9r.js → schema-form-BQz6ezGe.js} +1 -1
  83. package/dist/gateway/static/root/assets/{send-session-input-DstpmO44.js → send-session-input-OaBPDJ9E.js} +1 -1
  84. package/dist/gateway/static/root/assets/{session-api-qy4gMa5t.js → session-api-UkGomZfv.js} +1 -1
  85. package/dist/gateway/static/root/assets/{session-manager-CFqOuGy-.js → session-manager-BK5IvdGz.js} +1 -1
  86. package/dist/gateway/static/root/assets/{sessions-page-tL7mZG6X.js → sessions-page-DkXKhSWK.js} +1 -1
  87. package/dist/gateway/static/root/assets/settings-advanced-gate-C7ww6VRj.js +1 -0
  88. package/dist/gateway/static/root/assets/{settings-page-CLx4gCfD.js → settings-page-CKmMkdPu.js} +1 -1
  89. package/dist/gateway/static/root/assets/{setup-status-panel-TBkyBEiM.js → setup-status-panel-Cjv6CDgq.js} +1 -1
  90. package/dist/gateway/static/root/assets/{share-link-dialog-B3Io5mOY.js → share-link-dialog-QAjExHAL.js} +1 -1
  91. package/dist/gateway/static/root/assets/{share-preview-page-BpZqXsgR.js → share-preview-page-M_rAQR60.js} +1 -1
  92. package/dist/gateway/static/root/assets/{shares-api-BNNaREyB.js → shares-api-DwqLga5H.js} +1 -1
  93. package/dist/gateway/static/root/assets/{shares-settings-Bz0BI8lL.js → shares-settings-DXpj-oOC.js} +1 -1
  94. package/dist/gateway/static/root/assets/{skill-api-Bom72qsC.js → skill-api-BO1b2oYj.js} +1 -1
  95. package/dist/gateway/static/root/assets/{skill-reload-api-Dm6GgUYK.js → skill-reload-api-C1hzIawD.js} +1 -1
  96. package/dist/gateway/static/root/assets/{skills-page-BIQrMkmI.js → skills-page-cwXzLyU0.js} +1 -1
  97. package/dist/gateway/static/root/assets/{system-settings-panel-CzAezoel.js → system-settings-panel-CIDRPUj4.js} +1 -1
  98. package/dist/gateway/static/root/assets/task-detail-page-ZmkA0E9f.js +1 -0
  99. package/dist/gateway/static/root/assets/tasks-CH6KoBeY.js +1 -0
  100. package/dist/gateway/static/root/assets/{theme-store-AXut7b8R.js → theme-store-DTYk7Gll.js} +1 -1
  101. package/dist/gateway/static/root/assets/{tunnel-api-DtkDWId1.js → tunnel-api-BkgD61qc.js} +1 -1
  102. package/dist/gateway/static/root/assets/{usage-page-ZKtrJ73f.js → usage-page-BjgYDab4.js} +1 -1
  103. package/dist/gateway/static/root/assets/{use-autosave-BT3l-ETP.js → use-autosave-R3hEHQQq.js} +1 -1
  104. package/dist/gateway/static/root/assets/{use-composer-attachments-zfL8zvRu.js → use-composer-attachments-qK3z-EGz.js} +1 -1
  105. package/dist/gateway/static/root/assets/{use-file-preview-expanded-C4bBXf4j.js → use-file-preview-expanded-D809I8ur.js} +2 -2
  106. package/dist/gateway/static/root/assets/{user-model-page-B6E9ihaw.js → user-model-page-DpPGpkkg.js} +1 -1
  107. package/dist/gateway/static/root/assets/{voice-api-key-field-BF9hOZ_1.js → voice-api-key-field-C-AF-IcO.js} +1 -1
  108. package/dist/gateway/static/root/assets/{voice-config-api-D8G4fALX.js → voice-config-api-CxGsCDoW.js} +1 -1
  109. package/dist/gateway/static/root/assets/{work-discovery-overlay-cD0OrAiy.js → work-discovery-overlay-Ce3PKQvh.js} +1 -1
  110. package/dist/gateway/static/root/assets/{workflow-run-setup-panel-4yISOYK9.js → workflow-run-setup-panel-Dv6xUycS.js} +1 -1
  111. package/dist/gateway/static/root/assets/{workflows-page-B2_1T6js.js → workflows-page-CgJlVdec.js} +1 -1
  112. package/dist/gateway/static/root/assets/{workspace-api-C4q2GwGV.js → workspace-api-BtXzxf_w.js} +2 -2
  113. package/dist/gateway/static/root/index.html +28 -28
  114. package/dist/package.js +1 -1
  115. package/dist/packages/gateway-contract/src/task-lifecycle.js +3 -1
  116. package/dist/src/agent/agent-manager.js +15 -15
  117. package/dist/src/agent/agent-scope.js +2 -2
  118. package/dist/src/agent/background-review/prompts.js +1 -1
  119. package/dist/src/agent/background-review/run-background-review.js +4 -4
  120. package/dist/src/agent/coding/repository-instructions.js +1 -1
  121. package/dist/src/agent/context/coordinator.js +2 -2
  122. package/dist/src/agent/context/execution-context.js +4 -4
  123. package/dist/src/agent/context/execution-scope.js +2 -2
  124. package/dist/src/agent/context/project-context.js +3 -3
  125. package/dist/src/agent/data-acquisition/service.js +1 -1
  126. package/dist/src/agent/embedded/index.js +2 -2
  127. package/dist/src/agent/embedded/model-runtime.js +1 -1
  128. package/dist/src/agent/embedded/run-for-session.js +4 -4
  129. package/dist/src/agent/embedded/run-turn.js +5 -5
  130. package/dist/src/agent/embedded/session-tool-result-guard.js +3 -3
  131. package/dist/src/agent/embedded/tool-result-truncation.js +1 -1
  132. package/dist/src/agent/external-tools/cliProvider.js +3 -3
  133. package/dist/src/agent/external-tools/composio-provider.js +3 -3
  134. package/dist/src/agent/external-tools/endpoint-provider.js +2 -2
  135. package/dist/src/agent/external-tools/gateway-tools.js +1 -1
  136. package/dist/src/agent/external-tools/mcp-provider.js +3 -3
  137. package/dist/src/agent/image/generation/openai-images-provider.js +1 -1
  138. package/dist/src/agent/image/generation/providers/dashscope.js +1 -1
  139. package/dist/src/agent/image/generation/providers/fal.js +1 -1
  140. package/dist/src/agent/image/generation/providers/google.js +1 -1
  141. package/dist/src/agent/image/generation/runtime.js +1 -1
  142. package/dist/src/agent/image/index.js +1 -1
  143. package/dist/src/agent/image/load-image-media.js +1 -1
  144. package/dist/src/agent/image/tool-model-config.js +2 -2
  145. package/dist/src/agent/inbound/attachment-pipeline.js +1 -1
  146. package/dist/src/agent/inbound/inbound-loop.js +2 -2
  147. package/dist/src/agent/index.js +1 -1
  148. package/dist/src/agent/mcp/bundle-mcp-config.js +1 -1
  149. package/dist/src/agent/mcp/bundle-mcp-gateway.js +1 -1
  150. package/dist/src/agent/mcp/bundle-mcp-runtime.js +2 -2
  151. package/dist/src/agent/mcp/index.js +2 -2
  152. package/dist/src/agent/mcp/mcp-stdio-transport.js +1 -1
  153. package/dist/src/agent/mcp/mcp-transport.js +1 -1
  154. package/dist/src/agent/mcp/oauth/mcp-oauth-manager.js +1 -1
  155. package/dist/src/agent/mcp/oauth/mcp-oauth-store.js +1 -1
  156. package/dist/src/agent/mcp/plugin-http-fetch.js +1 -1
  157. package/dist/src/agent/memory/context-recovery.js +1 -1
  158. package/dist/src/agent/memory/index.js +1 -1
  159. package/dist/src/agent/orchestration/agent-orchestrator.js +1 -1
  160. package/dist/src/agent/prompt/service-prompt-builder.js +2 -2
  161. package/dist/src/agent/sandbox/exec-policy.js +1 -1
  162. package/dist/src/agent/service/direct-turn-helpers.js +4 -4
  163. package/dist/src/agent/service/process-direct-one-shot.js +1 -1
  164. package/dist/src/agent/service/process-direct-streaming.js +5 -5
  165. package/dist/src/agent/service/webchat-tts.js +2 -2
  166. package/dist/src/agent/service.js +22 -22
  167. package/dist/src/agent/session/session-config-service.js +1 -1
  168. package/dist/src/agent/session/session-hydrator.js +1 -1
  169. package/dist/src/agent/session/session-inspector.js +1 -1
  170. package/dist/src/agent/skills/hub-lock.js +1 -1
  171. package/dist/src/agent/skills/index.js +1 -1
  172. package/dist/src/agent/skills/managed-store.js +1 -1
  173. package/dist/src/agent/skills/skill-manage-ops.js +1 -1
  174. package/dist/src/agent/source-context/index.js +2 -2
  175. package/dist/src/agent/tasks/task-judge-service.js +4 -4
  176. package/dist/src/agent/tools/create-share-tool.js +3 -3
  177. package/dist/src/agent/tools/dataBatch.js +1 -1
  178. package/dist/src/agent/tools/delegate-tool.js +3 -3
  179. package/dist/src/agent/tools/delegation-parent-policy.js +1 -1
  180. package/dist/src/agent/tools/executor.js +1 -1
  181. package/dist/src/agent/tools/factory.js +16 -16
  182. package/dist/src/agent/tools/fetch-text.js +1 -1
  183. package/dist/src/agent/tools/image-generate-tool.js +3 -3
  184. package/dist/src/agent/tools/index.js +6 -6
  185. package/dist/src/agent/tools/list-dir.js +1 -1
  186. package/dist/src/agent/tools/personal-task-tool.js +2 -2
  187. package/dist/src/agent/tools/publish-artifacts.js +2 -2
  188. package/dist/src/agent/tools/read.js +2 -2
  189. package/dist/src/agent/tools/review-workspace.js +1 -1
  190. package/dist/src/agent/tools/send-media.js +2 -2
  191. package/dist/src/agent/tools/skills-tools.js +1 -1
  192. package/dist/src/agent/tools/tts-tool.js +1 -1
  193. package/dist/src/agent/tools/user-context-tool.js +1 -1
  194. package/dist/src/agent/tools/write.js +2 -2
  195. package/dist/src/agent/tools/xopc-use-tool.js +5 -5
  196. package/dist/src/agent/workflow/subagent-runner.js +1 -1
  197. package/dist/src/agent-catalog/capabilities.js +2 -2
  198. package/dist/src/ai-assist/text-assist.js +1 -1
  199. package/dist/src/auth/credentials.js +2 -2
  200. package/dist/src/auth/oauth-provider-lock.js +1 -1
  201. package/dist/src/auth/profiles/store.js +1 -1
  202. package/dist/src/auth/sync-provider-auth.js +1 -1
  203. package/dist/src/automations/capabilities/drafts.js +1 -1
  204. package/dist/src/automations/domain/index.js +2 -2
  205. package/dist/src/automations/index.js +4 -4
  206. package/dist/src/automations/service/automation-service.js +2 -2
  207. package/dist/src/backup/archive.js +1 -1
  208. package/dist/src/bootstrap/application-state.js +1 -1
  209. package/dist/src/browser/native-messaging-host.js +1 -1
  210. package/dist/src/browser/providers/browser-ext-install.js +1 -1
  211. package/dist/src/capabilities/runtime/dispatcher.js +1 -1
  212. package/dist/src/capabilities/runtime/product.js +1 -1
  213. package/dist/src/channels/attachments/voice-stt-webchat.js +2 -2
  214. package/dist/src/channels/index.js +2 -2
  215. package/dist/src/channels/outbound-sender.js +1 -1
  216. package/dist/src/channels/pairing/allow-from-file.js +9 -9
  217. package/dist/src/channels/pairing/pairing-store.js +6 -6
  218. package/dist/src/chat-commands/agent-edit.js +1 -1
  219. package/dist/src/chat-commands/builtins/config.js +3 -3
  220. package/dist/src/chat-commands/builtins/review.js +1 -1
  221. package/dist/src/chat-commands/builtins/session.js +1 -1
  222. package/dist/src/chat-commands/builtins/thinking.js +1 -1
  223. package/dist/src/chat-commands/builtins/tts.js +1 -1
  224. package/dist/src/chat-commands/builtins/understanding.js +1 -1
  225. package/dist/src/chat-commands/builtins/workflow.js +2 -2
  226. package/dist/src/chat-commands/context.js +3 -3
  227. package/dist/src/chat-commands/index.js +3 -3
  228. package/dist/src/cli/commands/agent.js +7 -7
  229. package/dist/src/cli/commands/agents.js +1 -1
  230. package/dist/src/cli/commands/config.js +1 -1
  231. package/dist/src/cli/commands/connectors.js +1 -1
  232. package/dist/src/cli/commands/doctor/checks/channel-plugins.js +1 -1
  233. package/dist/src/cli/commands/doctor/checks/gateway-health.js +1 -1
  234. package/dist/src/cli/commands/doctor/checks/provider-auth.js +2 -2
  235. package/dist/src/cli/commands/doctor/checks/tool-runtimes.js +1 -1
  236. package/dist/src/cli/commands/extension-agent-plugin.js +2 -2
  237. package/dist/src/cli/commands/extension-dev.js +1 -1
  238. package/dist/src/cli/commands/extension-marketplace.js +2 -2
  239. package/dist/src/cli/commands/extension.js +4 -4
  240. package/dist/src/cli/commands/gateway/shared.js +1 -1
  241. package/dist/src/cli/commands/gateway/token.js +1 -1
  242. package/dist/src/cli/commands/image.js +1 -1
  243. package/dist/src/cli/commands/init.js +1 -1
  244. package/dist/src/cli/commands/models.js +1 -1
  245. package/dist/src/cli/commands/onboard/channels/registry.js +1 -1
  246. package/dist/src/cli/commands/onboard/model.js +1 -1
  247. package/dist/src/cli/commands/onboard.js +1 -1
  248. package/dist/src/cli/commands/project.js +2 -2
  249. package/dist/src/cli/commands/runtime.js +1 -1
  250. package/dist/src/cli/commands/skills.js +2 -2
  251. package/dist/src/cli/commands/tunnel.js +4 -4
  252. package/dist/src/cli/extension-cli-register.js +5 -5
  253. package/dist/src/cli/utils/gateway-client.js +1 -1
  254. package/dist/src/cli/utils/init-workspace-core.js +2 -2
  255. package/dist/src/cli/utils/session.js +1 -1
  256. package/dist/src/computer/runtime.js +2 -2
  257. package/dist/src/config/index.js +8 -8
  258. package/dist/src/config/loader.js +2 -2
  259. package/dist/src/config/models-json.js +2 -2
  260. package/dist/src/config/schema.js +1 -1
  261. package/dist/src/connectors/cli/authorization.js +1 -1
  262. package/dist/src/connectors/cli/runtime.js +1 -1
  263. package/dist/src/connectors/composio-sessions.js +1 -1
  264. package/dist/src/connectors/composio.js +1 -1
  265. package/dist/src/connectors/connected-source-understanding.js +3 -3
  266. package/dist/src/connectors/connection-recovery-service.js +5 -5
  267. package/dist/src/connectors/health.js +1 -1
  268. package/dist/src/connectors/plugin-mcp-recovery.js +1 -1
  269. package/dist/src/discussions/live-worker.js +1 -1
  270. package/dist/src/discussions/recording.js +1 -1
  271. package/dist/src/discussions/sealer.js +1 -1
  272. package/dist/src/extensions/activation-context.js +3 -3
  273. package/dist/src/extensions/agent-plugins/validation.js +1 -1
  274. package/dist/src/extensions/api.js +4 -4
  275. package/dist/src/extensions/bundled-extension-activation.js +1 -1
  276. package/dist/src/extensions/index.js +3 -3
  277. package/dist/src/extensions/install.js +1 -1
  278. package/dist/src/extensions/loader.js +2 -2
  279. package/dist/src/extensions/lockfile.js +1 -1
  280. package/dist/src/extensions/sdk/index.js +1 -1
  281. package/dist/src/extensions/sdk/media.js +1 -1
  282. package/dist/src/extensions/update.js +1 -1
  283. package/dist/src/gateway/agents-admin.js +2 -2
  284. package/dist/src/gateway/device-routes.js +2 -2
  285. package/dist/src/gateway/file-path-classifier.js +2 -2
  286. package/dist/src/gateway/global-defaults-admin.js +1 -1
  287. package/dist/src/gateway/hono/app.js +3 -3
  288. package/dist/src/gateway/hono/lib/config-payload.js +4 -4
  289. package/dist/src/gateway/hono/routes/agents.js +1 -1
  290. package/dist/src/gateway/hono/routes/auth-registry-extensions.js +1 -1
  291. package/dist/src/gateway/hono/routes/browser.js +1 -1
  292. package/dist/src/gateway/hono/routes/commands-skills.js +4 -4
  293. package/dist/src/gateway/hono/routes/config-patch/gateway.js +1 -1
  294. package/dist/src/gateway/hono/routes/config-patch/misc.js +2 -2
  295. package/dist/src/gateway/hono/routes/home.js +1 -1
  296. package/dist/src/gateway/hono/routes/mcp.js +2 -2
  297. package/dist/src/gateway/hono/routes/media.js +1 -1
  298. package/dist/src/gateway/hono/routes/models.js +6 -6
  299. package/dist/src/gateway/hono/routes/notes.js +3 -3
  300. package/dist/src/gateway/hono/routes/personal-agent.js +1 -1
  301. package/dist/src/gateway/hono/routes/projects.js +4 -4
  302. package/dist/src/gateway/hono/routes/session-command-handler.js +1 -1
  303. package/dist/src/gateway/hono/routes/session-input-handler.js +4 -4
  304. package/dist/src/gateway/hono/routes/sessions.js +2 -2
  305. package/dist/src/gateway/hono/routes/shares.js +3 -3
  306. package/dist/src/gateway/hono/routes/side-chats.js +1 -1
  307. package/dist/src/gateway/hono/routes/site-shares.js +1 -1
  308. package/dist/src/gateway/hono/routes/tasks.js +2 -2
  309. package/dist/src/gateway/hono/routes/user-model-refresh.js +1 -1
  310. package/dist/src/gateway/hono/routes/user-model.js +5 -5
  311. package/dist/src/gateway/hono/routes/voice.js +7 -7
  312. package/dist/src/gateway/hono/routes/workflows.js +2 -2
  313. package/dist/src/gateway/image-generation-setup.js +3 -3
  314. package/dist/src/gateway/index.js +1 -1
  315. package/dist/src/gateway/lock.js +11 -11
  316. package/dist/src/gateway/media-access.js +1 -1
  317. package/dist/src/gateway/mobile-privacy.js +2 -2
  318. package/dist/src/gateway/ports.js +6 -6
  319. package/dist/src/gateway/run-loop.js +1 -1
  320. package/dist/src/gateway/scenes/mailContext.js +1 -1
  321. package/dist/src/gateway/scenes/slackThreadSource.js +1 -1
  322. package/dist/src/gateway/server.js +1 -1
  323. package/dist/src/gateway/service/agent-runner.js +1 -1
  324. package/dist/src/gateway/service/config-coordinator.js +3 -3
  325. package/dist/src/gateway/service/run-gateway-agent.js +3 -3
  326. package/dist/src/gateway/service/session-command-service.js +2 -2
  327. package/dist/src/gateway/service/sessions-api.js +1 -1
  328. package/dist/src/gateway/service.js +37 -37
  329. package/dist/src/gateway/session-context-summary.js +2 -2
  330. package/dist/src/gateway/session-reset-service.js +1 -1
  331. package/dist/src/gateway/workspace-editor-path.js +2 -2
  332. package/dist/src/gateway/xopc-cloud-capability-setup.js +1 -1
  333. package/dist/src/home-intelligence/generator.js +1 -1
  334. package/dist/src/infra/gateway-processes.js +2 -2
  335. package/dist/src/infra/path-env.js +3 -3
  336. package/dist/src/infra/update-global.js +10 -10
  337. package/dist/src/local-apps/service.js +2 -2
  338. package/dist/src/mcp/gateway-http-client.js +1 -1
  339. package/dist/src/media-understanding/openai-compatible-audio.js +1 -1
  340. package/dist/src/notes/agent-context.js +4 -4
  341. package/dist/src/notes/index.js +1 -1
  342. package/dist/src/notes/service.js +1 -1
  343. package/dist/src/notes/store.js +1 -1
  344. package/dist/src/personal-agent/service.js +2 -2
  345. package/dist/src/projects/project-loop.d.ts +2 -1
  346. package/dist/src/projects/project-loop.js +1 -1
  347. package/dist/src/providers/auth-runtime/resolve-auth.js +1 -1
  348. package/dist/src/providers/index.js +2 -2
  349. package/dist/src/providers/model-catalog-persistence.js +1 -1
  350. package/dist/src/providers/model-reference-auditor.js +1 -1
  351. package/dist/src/providers/model-registry.js +1 -1
  352. package/dist/src/providers/register-runtime-providers.js +1 -1
  353. package/dist/src/remote-access/exposure-manager.js +1 -1
  354. package/dist/src/scenes/taskFollowUp/agentExecutor.js +4 -4
  355. package/dist/src/scenes/taskFollowUp/resources.js +1 -1
  356. package/dist/src/scenes/taskFollowUp/service.js +4 -4
  357. package/dist/src/session/client-history.js +2 -0
  358. package/dist/src/session/index.js +2 -2
  359. package/dist/src/session/resolve-session.js +1 -1
  360. package/dist/src/session/session-title.js +1 -1
  361. package/dist/src/session/store.js +4 -4
  362. package/dist/src/session/thinking-resolve.js +1 -1
  363. package/dist/src/share/share-store.js +1 -1
  364. package/dist/src/share/share-thumbnail.js +1 -1
  365. package/dist/src/share/share-zip.js +1 -1
  366. package/dist/src/share/site-proxy.js +1 -1
  367. package/dist/src/share/site-share-store.js +1 -1
  368. package/dist/src/storage/sqlite/connection.js +9 -9
  369. package/dist/src/tasks/capabilities/read.js +2 -2
  370. package/dist/src/tasks/capabilities/relations.d.ts +4 -0
  371. package/dist/src/tasks/capabilities/write.d.ts +4 -0
  372. package/dist/src/tasks/capabilities/write.js +1 -1
  373. package/dist/src/tasks/execution-context.js +1 -1
  374. package/dist/src/tasks/home-query-service.js +3 -3
  375. package/dist/src/tasks/index.js +4 -4
  376. package/dist/src/tasks/task-application-service.js +3 -3
  377. package/dist/src/tasks/task-collaboration-delivery.js +1 -1
  378. package/dist/src/tasks/task-context-assembler.js +1 -1
  379. package/dist/src/tasks/task-handoff-service.js +1 -1
  380. package/dist/src/tasks/task-main-update-decision-service.js +1 -1
  381. package/dist/src/tasks/task-origin-repository.d.ts +2 -0
  382. package/dist/src/tasks/task-origin-repository.js +13 -6
  383. package/dist/src/tasks/task-read-model-projector.js +3 -1
  384. package/dist/src/tui/backends/embedded-backend.js +12 -12
  385. package/dist/src/tui/backends/gateway-realtime-backend.js +1 -1
  386. package/dist/src/tui/extension-host/load-extensions.js +1 -1
  387. package/dist/src/tui/tui-command-formatters.js +1 -1
  388. package/dist/src/tui/tui-commands.js +6 -6
  389. package/dist/src/tui/tui-picker-overlay.js +1 -1
  390. package/dist/src/tui/tui-skills-autocomplete.js +1 -1
  391. package/dist/src/tui/tui-startup-resources.js +4 -4
  392. package/dist/src/tui/tui.js +7 -7
  393. package/dist/src/tunnel/frpc-binary.js +1 -1
  394. package/dist/src/tunnel/gateway-lifecycle.js +1 -1
  395. package/dist/src/voice/realtime/memory-context.js +3 -3
  396. package/dist/src/voice/realtime/persona-context.js +1 -1
  397. package/dist/src/voice/realtime/runtime.js +4 -4
  398. package/dist/src/voice/stt/index.js +2 -2
  399. package/dist/src/voice/stt/preflight.js +1 -1
  400. package/dist/src/voice/stt/providers/alibaba-transcription.js +1 -1
  401. package/dist/src/voice/stt/providers/xopc-cloud-transcription.js +1 -1
  402. package/dist/src/voice/stt/transcribe-core.js +1 -1
  403. package/dist/src/voice/tts/index.js +3 -3
  404. package/dist/src/voice/tts/merge-config.js +1 -1
  405. package/dist/src/voice/tts/payload.js +1 -1
  406. package/dist/src/voice/tts/providers/xopc-cloud-speech.js +1 -1
  407. package/dist/src/voice/tts/speak-core.js +1 -1
  408. package/dist/src/work-discovery/incremental-repository.js +1 -1
  409. package/dist/src/work-discovery/index.js +1 -1
  410. package/dist/src/work-discovery/service.js +5 -5
  411. package/dist/src/workflows/engine/workflow-engine.js +1 -1
  412. package/dist/src/workflows/service/workflow-run-service.js +8 -8
  413. package/dist/src/workflows/service/workflow-session-bridge.js +1 -1
  414. package/package.json +2 -2
  415. package/dist/gateway/static/root/assets/gateway-realtime-store-B5Oq6VCQ.js +0 -1
  416. package/dist/gateway/static/root/assets/messages-D8PmAUB-.js +0 -3
  417. package/dist/gateway/static/root/assets/models-hub-cache-CaYi043g.js +0 -1
  418. package/dist/gateway/static/root/assets/personal-page-DopSoSDc.js +0 -1
  419. package/dist/gateway/static/root/assets/project-detail-page-BrGdrlhx.js +0 -1
  420. package/dist/gateway/static/root/assets/settings-advanced-gate-Dq5CfiKV.js +0 -1
  421. package/dist/gateway/static/root/assets/task-detail-page-GOqAjMLD.js +0 -1
  422. package/dist/gateway/static/root/assets/tasks-Buv1mgPF.js +0 -1
@@ -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-BMYIfy9x.js";import{t as a}from"./popover-select-BNZZDJpO.js";import{t as o}from"./circle-check-C23XjkUj.js";import{t as s}from"./mic-CuUb7zc-.js";import{t as c}from"./search-DA7gz22f.js";import{t as l}from"./sparkles-DHlfQFAF.js";import{t as u}from"./x-B_N4OPjy.js";import{t as d}from"./cn-JdwAhgNB.js";import{c as f,n as p}from"./locale-store-DodizOrj.js";import{i as m}from"./vendor-swr-BIWyz7Rc.js";import{t as h}from"./button-CS04eWY9.js";import{r as g}from"./gateway-config-swr-Da3Oob_s.js";import{n as _,t as v}from"./registry-api-D0eYNizR.js";import{t as y}from"./skeleton-BwbyijEw.js";import{t as b}from"./electron-env-Dit0bHgy.js";import{Do as x,Hr as S,Wr as C,_s as w,cn as T,jc as E,kc as D,ln as O,v as ee,wo as te,zo as ne,zs as k}from"./index-DOFuObNM.js";import{n as A,r as j}from"./settings-page-layout-X1x-2Cp9.js";import{n as M,t as N}from"./use-autosave-BT3l-ETP.js";import{s as P}from"./voice-config-api-D8G4fALX.js";import{r as F}from"./image-generation-api-8jfU8AlD.js";var I=e(t(),1),re=n(),L=r(),R={"xopc-cloud":`XOPC Cloud`,alibaba:`Alibaba Cloud`,edge:`Microsoft Edge`,groq:`Groq`,minimax:`MiniMax`,openai:`OpenAI`};function z(e,t,n){let r=e?.[t]?.[n];return typeof r==`string`&&r.trim()?r.trim():void 0}function ie(e){return R[e]??e}function B(e){let t=(0,re.c)(17),{icon:n,label:r,enabled:i,details:a,zh:o}=e,s;t[0]===n?s=t[1]:(s=(0,L.jsx)(`div`,{className:`rounded-lg bg-accent/10 p-2 text-accent`,children:(0,L.jsx)(n,{className:`size-4`,"aria-hidden":!0})}),t[0]=n,t[1]=s);let c;t[2]===r?c=t[3]:(c=(0,L.jsx)(`h3`,{className:`text-sm font-medium text-fg`,children:r}),t[2]=r,t[3]=c);let l=i?o?`已启用`:`On`:o?`已关闭`:`Off`,u;t[4]===l?u=t[5]:(u=(0,L.jsx)(`span`,{className:`rounded-full bg-surface-hover px-2 py-0.5 text-[10px] font-medium text-fg-muted`,children:l}),t[4]=l,t[5]=u);let d;t[6]!==c||t[7]!==u?(d=(0,L.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[c,u]}),t[6]=c,t[7]=u,t[8]=d):d=t[8];let f=i?a:o?`不处理语音`:`Voice processing is disabled`,p;t[9]===f?p=t[10]:(p=(0,L.jsx)(`p`,{className:`mt-1 truncate text-xs text-fg-muted`,children:f}),t[9]=f,t[10]=p);let m;t[11]!==d||t[12]!==p?(m=(0,L.jsxs)(`div`,{className:`min-w-0`,children:[d,p]}),t[11]=d,t[12]=p,t[13]=m):m=t[13];let h;return t[14]!==s||t[15]!==m?(h=(0,L.jsxs)(`div`,{className:`flex items-start gap-3 rounded-xl bg-surface-base/55 p-4`,children:[s,m]}),t[14]=s,t[15]=m,t[16]=h):h=t[16],h}function V(e){let t=(0,re.c)(27),{zh:n}=e,{data:r,error:a,isLoading:o}=g(!0),c=r?.payload?.config,l,u,d;if(t[0]!==c){d=c===void 0?void 0:P(c);let e=d?z(d.stt.providers,d.stt.provider,`model`):void 0,n=d?z(d.tts.providers,d.tts.provider,`model`):void 0,r=d?z(d.tts.providers,d.tts.provider,`voice`):void 0;l=d?[ie(d.stt.provider),e].filter(Boolean).join(` · `):void 0,u=d?[ie(d.tts.provider),n,r].filter(Boolean).join(` · `):void 0,t[0]=c,t[1]=l,t[2]=u,t[3]=d}else l=t[1],u=t[2],d=t[3];let f=u,p=n?`语音能力`:`Voice capabilities`,m;t[4]===p?m=t[5]:(m=(0,L.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:p}),t[4]=p,t[5]=m);let _=n?`语音识别和朗读由所有智能体共用,在语音设置中统一管理。`:`STT and TTS are shared by every agent and managed in global voice settings.`,v;t[6]===_?v=t[7]:(v=(0,L.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:_}),t[6]=_,t[7]=v);let b;t[8]!==m||t[9]!==v?(b=(0,L.jsxs)(`div`,{children:[m,v]}),t[8]=m,t[9]=v,t[10]=b):b=t[10];let x=n?`管理语音设置`:`Manage voice settings`,S;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,L.jsx)(E,{className:`size-4`,"aria-hidden":!0}),t[11]=S):S=t[11];let C;t[12]===x?C=t[13]:(C=(0,L.jsx)(h,{asChild:!0,variant:`secondary`,className:`shrink-0`,children:(0,L.jsxs)(i,{to:`/settings/capabilities/voice`,children:[x,S]})}),t[12]=x,t[13]=C);let w;t[14]!==b||t[15]!==C?(w=(0,L.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[b,C]}),t[14]=b,t[15]=C,t[16]=w):w=t[16];let T;t[17]!==a||t[18]!==o||t[19]!==l||t[20]!==f||t[21]!==d||t[22]!==n?(T=o||!d?a?(0,L.jsx)(`p`,{className:`mt-4 rounded-xl bg-red-500/10 px-3 py-2 text-sm text-red-600`,children:n?`暂时无法读取语音配置。`:`Voice settings could not be loaded.`}):(0,L.jsxs)(`div`,{className:`mt-4 grid gap-3 sm:grid-cols-2`,children:[(0,L.jsx)(y,{className:`h-20 rounded-xl`}),(0,L.jsx)(y,{className:`h-20 rounded-xl`})]}):(0,L.jsxs)(`div`,{className:`mt-4 grid gap-3 sm:grid-cols-2`,children:[(0,L.jsx)(B,{icon:s,label:n?`语音转文字(STT)`:`Speech to text (STT)`,enabled:d.stt.enabled,details:l,zh:n}),(0,L.jsx)(B,{icon:D,label:n?`文字转语音(TTS)`:`Text to speech (TTS)`,enabled:d.tts.enabled,details:f,zh:n})]}),t[17]=a,t[18]=o,t[19]=l,t[20]=f,t[21]=d,t[22]=n,t[23]=T):T=t[23];let O;return t[24]!==w||t[25]!==T?(O=(0,L.jsxs)(`section`,{className:`rounded-xl bg-surface-hover/20 p-5`,children:[w,T]}),t[24]=w,t[25]=T,t[26]=O):O=t[26],O}var H=[`fast`,`reasoning`,`coding`,`review`,`vision`,`understanding`],U=`w-full rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg outline-none focus:border-accent focus:ring-2 focus:ring-accent/15`,W={en:{fast:[`Fast tasks`,`Short, low-latency work`],reasoning:[`Complex reasoning`,`Planning and multi-step analysis`],coding:[`Coding`,`Implementation and debugging`],review:[`Review`,`Critique and verification`],vision:[`Vision`,`Image and visual analysis`],understanding:[`Understanding`,`Long-form content comprehension`]},zh:{fast:[`快速任务`,`简短、低延迟的工作`],reasoning:[`复杂推理`,`规划和多步骤分析`],coding:[`编程`,`实现、调试和代码修改`],review:[`审查`,`检查、批评和验证`],vision:[`视觉任务`,`图片和视觉内容分析`],understanding:[`内容理解`,`长内容阅读和理解`]}};function ae(e,t){return{primary:t,fallbacks:e?.fallbacks??[]}}function G(e){let t=(0,re.c)(35),{primary:n,value:r,models:i,loading:a,error:o,zh:s,onChange:c}=e,l;if(t[0]!==i||t[1]!==n||t[2]!==r){let e;t[4]!==n||t[5]!==r?(e=e=>e.id!==n&&!r.includes(e.id),t[4]=n,t[5]=r,t[6]=e):e=t[6],l=i.filter(e),t[0]=i,t[1]=n,t[2]=r,t[3]=l}else l=t[3];let d=l,f=s?`回退顺序`:`Fallback order`,p;t[7]===f?p=t[8]:(p=(0,L.jsx)(`h4`,{className:`text-sm font-medium text-fg`,children:f}),t[7]=f,t[8]=p);let m=s?`主模型不可用时,按从左到右的顺序尝试。`:`Tried from left to right when the primary model is unavailable.`,h;t[9]===m?h=t[10]:(h=(0,L.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:m}),t[9]=m,t[10]=h);let g;t[11]!==p||t[12]!==h?(g=(0,L.jsx)(`div`,{className:`flex items-center justify-between gap-3`,children:(0,L.jsxs)(`div`,{children:[p,h]})}),t[11]=p,t[12]=h,t[13]=g):g=t[13];let _;t[14]!==i||t[15]!==c||t[16]!==r||t[17]!==s?(_=r.length>0?(0,L.jsx)(`div`,{className:`mt-3 flex flex-wrap gap-2`,children:r.map((e,t)=>(0,L.jsxs)(`span`,{className:`inline-flex items-center gap-2 rounded-full bg-surface-base/70 py-1 pl-2.5 pr-1 text-xs text-fg`,children:[(0,L.jsx)(`span`,{className:`text-fg-subtle`,children:t+1}),(0,L.jsx)(`span`,{children:i.find(t=>t.id===e)?.name??e}),(0,L.jsx)(`button`,{type:`button`,"aria-label":s?`移除 ${e}`:`Remove ${e}`,className:`rounded-full p-1 text-fg-muted hover:bg-surface-hover hover:text-fg`,onClick:()=>c(r.filter(t=>t!==e)),children:(0,L.jsx)(u,{className:`size-3`})})]},e))}):(0,L.jsx)(`p`,{className:`mt-3 text-xs text-fg-subtle`,children:s?`未设置回退模型。`:`No fallback models configured.`}),t[14]=i,t[15]=c,t[16]=r,t[17]=s,t[18]=_):_=t[18];let v=s?`添加回退模型`:`Add fallback model`,y=s?`搜索模型或服务商`:`Search models or providers`,b=s?`没有可添加的模型`:`No models available to add`,x=s?`添加回退模型`:`Add fallback model`,C;t[19]!==c||t[20]!==r?(C=e=>{e&&c([...r,e])},t[19]=c,t[20]=r,t[21]=C):C=t[21];let w;t[22]!==d||t[23]!==o||t[24]!==a||t[25]!==b||t[26]!==x||t[27]!==C||t[28]!==v||t[29]!==y?(w=(0,L.jsx)(S,{value:``,models:d,modelsLoading:a,modelsError:o,placeholder:v,searchPlaceholder:y,noMatches:b,showProviderInTrigger:!1,contentAlign:`start`,className:`mt-3 w-full max-w-md`,ariaLabel:x,onChange:C}),t[22]=d,t[23]=o,t[24]=a,t[25]=b,t[26]=x,t[27]=C,t[28]=v,t[29]=y,t[30]=w):w=t[30];let T;return t[31]!==w||t[32]!==g||t[33]!==_?(T=(0,L.jsxs)(`div`,{children:[g,_,w]}),t[31]=w,t[32]=g,t[33]=_,t[34]=T):T=t[34],T}function oe(e){let t=(0,re.c)(121),{draft:n,setDraft:r,zh:i}=e,a;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(a={revalidateOnFocus:!1},t[0]=a):a=t[0];let o=m(v,_,a),s;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(s={revalidateOnFocus:!1},t[1]=s):s=t[1];let c=m(`agent-defaults-image-models`,F,s),l;t[2]===o.data?l=t[3]:(l=o.data??[],t[2]=o.data,t[3]=l);let u=l,d;t[4]===c.data?d=t[5]:(d=c.data??[],t[4]=c.data,t[5]=d);let f;t[6]===d?f=t[7]:(f=d.flatMap(K),t[6]=d,t[7]=f);let p=f,g=i?W.zh:W.en,y;t[8]!==n||t[9]!==r?(y=(e,t)=>{let i={...n.models.intents};t?i[e]=ae(i[e],t):delete i[e],r({...n,models:{...n.models,intents:i}})},t[8]=n,t[9]=r,t[10]=y):y=t[10];let b=y,x=i?`默认对话模型`:`Default conversation model`,C;t[11]===x?C=t[12]:(C=(0,L.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:x}),t[11]=x,t[12]=C);let w=i?`大多数对话和没有专用路由的任务都会使用它。`:`Used for most conversations and every task without a dedicated route.`,T;t[13]===w?T=t[14]:(T=(0,L.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:w}),t[13]=w,t[14]=T);let E;t[15]!==T||t[16]!==C?(E=(0,L.jsxs)(`div`,{children:[C,T]}),t[15]=T,t[16]=C,t[17]=E):E=t[17];let D=i?`主模型`:`Primary model`,O;t[18]===D?O=t[19]:(O=(0,L.jsx)(`label`,{className:`block text-xs font-medium text-fg-muted`,children:D}),t[18]=D,t[19]=O);let ee=i?`选择模型`:`Select a model`,te=i?`搜索模型或服务商`:`Search models or providers`,ne=i?`没有匹配的模型`:`No matching models`,k=i?`默认对话模型`:`Default conversation model`,A;t[20]!==n||t[21]!==r?(A=e=>r({...n,models:{...n.models,chat:{...n.models.chat,primary:e}}}),t[20]=n,t[21]=r,t[22]=A):A=t[22];let j;t[23]!==n.models.chat.primary||t[24]!==ee||t[25]!==te||t[26]!==ne||t[27]!==k||t[28]!==A?(j=(0,L.jsx)(S,{value:n.models.chat.primary,placeholder:ee,searchPlaceholder:te,noMatches:ne,showProviderSettingsFooter:!0,contentAlign:`start`,className:`mt-2 w-full`,ariaLabel:k,onChange:A}),t[23]=n.models.chat.primary,t[24]=ee,t[25]=te,t[26]=ne,t[27]=k,t[28]=A,t[29]=j):j=t[29];let M;t[30]!==O||t[31]!==j?(M=(0,L.jsxs)(`div`,{className:`mt-5 max-w-xl`,children:[O,j]}),t[30]=O,t[31]=j,t[32]=M):M=t[32];let N;t[33]!==n||t[34]!==r?(N=e=>r({...n,models:{...n.models,chat:{...n.models.chat,fallbacks:e}}}),t[33]=n,t[34]=r,t[35]=N):N=t[35];let P;t[36]!==n.models.chat.fallbacks||t[37]!==n.models.chat.primary||t[38]!==u||t[39]!==o.error||t[40]!==o.isLoading||t[41]!==N||t[42]!==i?(P=(0,L.jsx)(`div`,{className:`mt-6 rounded-xl bg-surface-base/45 p-4`,children:(0,L.jsx)(G,{primary:n.models.chat.primary,value:n.models.chat.fallbacks,models:u,loading:o.isLoading,error:o.error,zh:i,onChange:N})}),t[36]=n.models.chat.fallbacks,t[37]=n.models.chat.primary,t[38]=u,t[39]=o.error,t[40]=o.isLoading,t[41]=N,t[42]=i,t[43]=P):P=t[43];let I;t[44]!==E||t[45]!==M||t[46]!==P?(I=(0,L.jsxs)(`section`,{className:`rounded-xl bg-surface-hover/20 p-5`,children:[E,M,P]}),t[44]=E,t[45]=M,t[46]=P,t[47]=I):I=t[47];let R=i?`图片能力`:`Image capabilities`,z;t[48]===R?z=t[49]:(z=(0,L.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:R}),t[48]=R,t[49]=z);let ie=i?`没有图片任务时可以保持关闭。`:`Leave these off when the agents do not work with images.`,B;t[50]===ie?B=t[51]:(B=(0,L.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:ie}),t[50]=ie,t[51]=B);let oe=i?`图片理解模型`:`Image understanding model`,q;t[52]===oe?q=t[53]:(q=(0,L.jsx)(`label`,{className:`block text-xs font-medium text-fg-muted`,children:oe}),t[52]=oe,t[53]=q);let J=n.models.imageUnderstanding?.primary??``,Y=i?`关闭图片理解`:`Image understanding off`,X=i?`搜索视觉模型`:`Search vision models`,Z=i?`没有可用的视觉模型`:`No vision models available`,se=i?`关闭图片理解`:`Image understanding off`,Q=i?`图片理解模型`:`Image understanding model`,ce;t[54]!==n||t[55]!==r?(ce=e=>{let t={...n.models};e?t.imageUnderstanding=ae(t.imageUnderstanding,e):delete t.imageUnderstanding,r({...n,models:t})},t[54]=n,t[55]=r,t[56]=ce):ce=t[56];let le;t[57]!==J||t[58]!==Y||t[59]!==X||t[60]!==Z||t[61]!==se||t[62]!==Q||t[63]!==ce?(le=(0,L.jsx)(S,{value:J,placeholder:Y,searchPlaceholder:X,noMatches:Z,capabilitiesFilter:`vision`,allowEmpty:!0,emptyLabel:se,contentAlign:`start`,className:`mt-2 w-full`,ariaLabel:Q,onChange:ce}),t[57]=J,t[58]=Y,t[59]=X,t[60]=Z,t[61]=se,t[62]=Q,t[63]=ce,t[64]=le):le=t[64];let ue;t[65]!==q||t[66]!==le?(ue=(0,L.jsxs)(`div`,{children:[q,le]}),t[65]=q,t[66]=le,t[67]=ue):ue=t[67];let de=i?`图片生成模型`:`Image generation model`,fe;t[68]===de?fe=t[69]:(fe=(0,L.jsx)(`label`,{className:`block text-xs font-medium text-fg-muted`,children:de}),t[68]=de,t[69]=fe);let pe=n.models.imageGeneration?.primary??``,me=i?`关闭图片生成`:`Image generation off`,he=i?`搜索图片模型或服务商`:`Search image models or providers`,ge=i?`没有可用的图片生成模型`:`No image generation models available`,_e=i?`关闭图片生成`:`Image generation off`,ve=i?`图片生成模型`:`Image generation model`,ye;t[70]!==n||t[71]!==r?(ye=e=>{let t={...n.models};e?t.imageGeneration={primary:e,fallbacks:t.imageGeneration?.fallbacks??[],timeoutMs:t.imageGeneration?.timeoutMs,autoProviderFallback:t.imageGeneration?.autoProviderFallback??!0}:delete t.imageGeneration,r({...n,models:t})},t[70]=n,t[71]=r,t[72]=ye):ye=t[72];let be;t[73]!==p||t[74]!==c.error||t[75]!==c.isLoading||t[76]!==pe||t[77]!==me||t[78]!==he||t[79]!==ge||t[80]!==_e||t[81]!==ve||t[82]!==ye?(be=(0,L.jsx)(S,{value:pe,models:p,modelsLoading:c.isLoading,modelsError:c.error,placeholder:me,searchPlaceholder:he,noMatches:ge,allowEmpty:!0,emptyLabel:_e,contentAlign:`start`,className:`mt-2 w-full`,ariaLabel:ve,onChange:ye}),t[73]=p,t[74]=c.error,t[75]=c.isLoading,t[76]=pe,t[77]=me,t[78]=he,t[79]=ge,t[80]=_e,t[81]=ve,t[82]=ye,t[83]=be):be=t[83];let $;t[84]!==fe||t[85]!==be?($=(0,L.jsxs)(`div`,{children:[fe,be]}),t[84]=fe,t[85]=be,t[86]=$):$=t[86];let xe;t[87]!==ue||t[88]!==$?(xe=(0,L.jsxs)(`div`,{className:`mt-5 grid gap-5 lg:grid-cols-2`,children:[ue,$]}),t[87]=ue,t[88]=$,t[89]=xe):xe=t[89];let Se;t[90]!==n||t[91]!==r||t[92]!==i?(Se=n.models.imageGeneration?(0,L.jsxs)(`div`,{className:`mt-5 grid gap-4 rounded-xl bg-surface-base/45 p-4 sm:grid-cols-2`,children:[(0,L.jsxs)(`label`,{className:`block text-xs font-medium text-fg-muted`,children:[i?`生成超时(毫秒)`:`Generation timeout (ms)`,(0,L.jsx)(`input`,{type:`number`,min:1,className:`${U} mt-2`,value:n.models.imageGeneration.timeoutMs??``,onChange:e=>r({...n,models:{...n.models,imageGeneration:{...n.models.imageGeneration,timeoutMs:e.target.value?Number(e.target.value):void 0}}})})]}),(0,L.jsxs)(`div`,{className:`text-xs font-medium text-fg-muted`,children:[(0,L.jsx)(`span`,{children:i?`服务商自动回退`:`Automatic provider fallback`}),(0,L.jsx)(`div`,{className:`mt-1.5 flex rounded-lg bg-surface-panel p-1`,children:[!0,!1].map(e=>(0,L.jsx)(h,{variant:n.models.imageGeneration?.autoProviderFallback===e?`secondary`:`ghost`,className:`flex-1 py-1.5 text-xs`,onClick:()=>r({...n,models:{...n.models,imageGeneration:{...n.models.imageGeneration,autoProviderFallback:e}}}),children:e?i?`开启`:`On`:i?`关闭`:`Off`},String(e)))})]})]}):null,t[90]=n,t[91]=r,t[92]=i,t[93]=Se):Se=t[93];let Ce;t[94]!==z||t[95]!==B||t[96]!==xe||t[97]!==Se?(Ce=(0,L.jsxs)(`section`,{className:`rounded-xl bg-surface-hover/20 p-5`,children:[z,B,xe,Se]}),t[94]=z,t[95]=B,t[96]=xe,t[97]=Se,t[98]=Ce):Ce=t[98];let we;t[99]===i?we=t[100]:(we=(0,L.jsx)(V,{zh:i}),t[99]=i,t[100]=we);let Te=i?`按任务选择模型`:`Route by task`,Ee;t[101]===Te?Ee=t[102]:(Ee=(0,L.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:Te}),t[101]=Te,t[102]=Ee);let De=i?`仅在确实需要不同模型时设置;否则保持“使用默认对话模型”。`:`Set a route only when a task genuinely needs another model; otherwise keep the default.`,Oe;t[103]===De?Oe=t[104]:(Oe=(0,L.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:De}),t[103]=De,t[104]=Oe);let ke;t[105]!==g||t[106]!==n.models.intents||t[107]!==b||t[108]!==i?(ke=H.map(e=>(0,L.jsxs)(`div`,{className:`rounded-xl bg-surface-base/55 p-4`,children:[(0,L.jsxs)(`div`,{className:`mb-3`,children:[(0,L.jsx)(`h3`,{className:`text-sm font-medium text-fg`,children:g[e][0]}),(0,L.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-muted`,children:g[e][1]})]}),(0,L.jsx)(S,{value:n.models.intents[e]?.primary??``,placeholder:i?`使用默认对话模型`:`Use default conversation model`,searchPlaceholder:i?`搜索模型或服务商`:`Search models or providers`,noMatches:i?`没有匹配的模型`:`No matching models`,allowEmpty:!0,emptyLabel:i?`使用默认对话模型`:`Use default conversation model`,showProviderInTrigger:!1,contentAlign:`start`,className:`w-full`,ariaLabel:i?`${g[e][0]}模型`:`${g[e][0]} model`,onChange:t=>b(e,t)})]},e)),t[105]=g,t[106]=n.models.intents,t[107]=b,t[108]=i,t[109]=ke):ke=t[109];let Ae;t[110]===ke?Ae=t[111]:(Ae=(0,L.jsx)(`div`,{className:`mt-5 grid gap-3 lg:grid-cols-2`,children:ke}),t[110]=ke,t[111]=Ae);let je;t[112]!==Ee||t[113]!==Oe||t[114]!==Ae?(je=(0,L.jsxs)(`section`,{className:`rounded-xl bg-surface-hover/20 p-5`,children:[Ee,Oe,Ae]}),t[112]=Ee,t[113]=Oe,t[114]=Ae,t[115]=je):je=t[115];let Me;return t[116]!==I||t[117]!==Ce||t[118]!==we||t[119]!==je?(Me=(0,L.jsxs)(`div`,{className:`space-y-5`,children:[I,Ce,we,je]}),t[116]=I,t[117]=Ce,t[118]=we,t[119]=je,t[120]=Me):Me=t[120],Me}function K(e){return e.models.map(t=>({id:`${e.id}/${t}`,name:t,provider:e.label}))}var q=`w-full rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg outline-none focus:border-accent focus:ring-2 focus:ring-accent/15`;function J(e){let t=Number.parseInt(e,10);return Number.isFinite(t)&&t>0?t:void 0}function Y(e){let t=(0,re.c)(151),{draft:n,setDraft:r,zh:i}=e,o;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(o={revalidateOnFocus:!1},t[0]=o):o=t[0];let s=m(`agent-defaults-workflows`,ee,o),c;t[1]===s.data?c=t[2]:(c=s.data??[],t[1]=s.data,t[2]=c);let l;t[3]===c?l=t[4]:(l=c.map(X),t[3]=c,t[4]=l);let u=l,f=n.workflows.allowed===void 0,p;t[5]!==n||t[6]!==r?(p=(e,t)=>{let i=n.workflows.allowed??[],a=t?[...new Set([...i,e])]:i.filter(t=>t!==e);r({...n,workflows:{...n.workflows,allowed:a}})},t[5]=n,t[6]=r,t[7]=p):p=t[7];let g=p,_=i?`执行限制`:`Execution limits`,v;t[8]===_?v=t[9]:(v=(0,L.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:_}),t[8]=_,t[9]=v);let y=i?`为所有智能体设置安全上限;留空时使用系统默认值。`:`Set safe upper bounds for every agent. Empty fields use system defaults.`,b;t[10]===y?b=t[11]:(b=(0,L.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:y}),t[10]=y,t[11]=b);let x=i?`每次运行最多轮数`:`Maximum turns per run`,S=n.runtime.maxTurns??``,C=i?`系统默认`:`System default`,w;t[12]!==n||t[13]!==r?(w=e=>r({...n,runtime:{...n.runtime,maxTurns:J(e.target.value)}}),t[12]=n,t[13]=r,t[14]=w):w=t[14];let T;t[15]!==S||t[16]!==C||t[17]!==w?(T=(0,L.jsx)(`input`,{type:`number`,min:1,value:S,placeholder:C,onChange:w,className:`${q} mt-2`}),t[15]=S,t[16]=C,t[17]=w,t[18]=T):T=t[18];let E;t[19]!==T||t[20]!==x?(E=(0,L.jsxs)(`label`,{className:`block text-xs font-medium text-fg-muted`,children:[x,T]}),t[19]=T,t[20]=x,t[21]=E):E=t[21];let D=i?`单轮超时(毫秒)`:`Turn timeout (ms)`,O=n.runtime.timeoutMs??``,te=i?`系统默认`:`System default`,ne;t[22]!==n||t[23]!==r?(ne=e=>r({...n,runtime:{...n.runtime,timeoutMs:J(e.target.value)}}),t[22]=n,t[23]=r,t[24]=ne):ne=t[24];let k;t[25]!==O||t[26]!==te||t[27]!==ne?(k=(0,L.jsx)(`input`,{type:`number`,min:1,value:O,placeholder:te,onChange:ne,className:`${q} mt-2`}),t[25]=O,t[26]=te,t[27]=ne,t[28]=k):k=t[28];let A;t[29]!==D||t[30]!==k?(A=(0,L.jsxs)(`label`,{className:`block text-xs font-medium text-fg-muted`,children:[D,k]}),t[29]=D,t[30]=k,t[31]=A):A=t[31];let j=i?`每轮最多工具失败次数`:`Maximum tool failures per turn`,M=n.runtime.maxToolFailuresPerTurn??``,N=i?`系统默认`:`System default`,P;t[32]!==n||t[33]!==r?(P=e=>r({...n,runtime:{...n.runtime,maxToolFailuresPerTurn:J(e.target.value)}}),t[32]=n,t[33]=r,t[34]=P):P=t[34];let F;t[35]!==M||t[36]!==N||t[37]!==P?(F=(0,L.jsx)(`input`,{type:`number`,min:1,value:M,placeholder:N,onChange:P,className:`${q} mt-2`}),t[35]=M,t[36]=N,t[37]=P,t[38]=F):F=t[38];let I;t[39]!==j||t[40]!==F?(I=(0,L.jsxs)(`label`,{className:`block text-xs font-medium text-fg-muted`,children:[j,F]}),t[39]=j,t[40]=F,t[41]=I):I=t[41];let R;t[42]!==E||t[43]!==A||t[44]!==I?(R=(0,L.jsxs)(`div`,{className:`mt-5 grid gap-4 md:grid-cols-3`,children:[E,A,I]}),t[42]=E,t[43]=A,t[44]=I,t[45]=R):R=t[45];let z;t[46]!==R||t[47]!==v||t[48]!==b?(z=(0,L.jsxs)(`section`,{className:`rounded-xl bg-surface-hover/20 p-5`,children:[v,b,R]}),t[46]=R,t[47]=v,t[48]=b,t[49]=z):z=t[49];let ie=i?`提示词缓存`:`Prompt cache`,B;t[50]===ie?B=t[51]:(B=(0,L.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:ie}),t[50]=ie,t[51]=B);let V=i?`复用稳定的上下文以降低响应延迟和模型费用。`:`Reuse stable context to reduce latency and model cost.`,H;t[52]===V?H=t[53]:(H=(0,L.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:V}),t[52]=V,t[53]=H);let U=i?`缓存模式`:`Cache mode`,W;t[54]===U?W=t[55]:(W=(0,L.jsx)(`span`,{children:U}),t[54]=U,t[55]=W);let ae;t[56]===Symbol.for(`react.memo_cache_sentinel`)?(ae=[`auto`,`off`],t[56]=ae):ae=t[56];let G;t[57]!==n||t[58]!==r||t[59]!==i?(G=(0,L.jsx)(`div`,{className:`mt-1.5 flex rounded-lg bg-surface-panel p-1`,children:ae.map(e=>(0,L.jsx)(h,{variant:n.runtime.promptCache?.mode===e?`secondary`:`ghost`,className:`flex-1 py-1.5 text-xs`,onClick:()=>r({...n,runtime:{...n.runtime,promptCache:{mode:e,lifetime:n.runtime.promptCache?.lifetime??`short`}}}),children:e===`auto`?i?`自动`:`Automatic`:i?`关闭`:`Off`},e))}),t[57]=n,t[58]=r,t[59]=i,t[60]=G):G=t[60];let oe;t[61]!==W||t[62]!==G?(oe=(0,L.jsxs)(`div`,{className:`text-xs font-medium text-fg-muted`,children:[W,G]}),t[61]=W,t[62]=G,t[63]=oe):oe=t[63];let K;t[64]!==n||t[65]!==r||t[66]!==i?(K=n.runtime.promptCache?.mode===`auto`?(0,L.jsxs)(`div`,{className:`text-xs font-medium text-fg-muted`,children:[(0,L.jsx)(`span`,{children:i?`缓存周期`:`Cache lifetime`}),(0,L.jsx)(`div`,{className:`mt-1.5 flex rounded-lg bg-surface-panel p-1`,children:[`short`,`long`].map(e=>(0,L.jsx)(h,{variant:n.runtime.promptCache?.lifetime===e?`secondary`:`ghost`,className:`flex-1 py-1.5 text-xs`,onClick:()=>r({...n,runtime:{...n.runtime,promptCache:{mode:`auto`,lifetime:e}}}),children:e===`short`?i?`短期`:`Short`:i?`长期`:`Long`},e))})]}):null,t[64]=n,t[65]=r,t[66]=i,t[67]=K):K=t[67];let Y;t[68]!==oe||t[69]!==K?(Y=(0,L.jsxs)(`div`,{className:`mt-5 grid gap-4 sm:grid-cols-2`,children:[oe,K]}),t[68]=oe,t[69]=K,t[70]=Y):Y=t[70];let Z;t[71]!==B||t[72]!==H||t[73]!==Y?(Z=(0,L.jsxs)(`section`,{className:`rounded-xl bg-surface-hover/20 p-5`,children:[B,H,Y]}),t[71]=B,t[72]=H,t[73]=Y,t[74]=Z):Z=t[74];let se=i?`工作流`:`Workflows`,Q;t[75]===se?Q=t[76]:(Q=(0,L.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:se}),t[75]=se,t[76]=Q);let ce=i?`设置默认工作流,并决定智能体可以调用哪些工作流。`:`Set a default workflow and control which workflows agents may invoke.`,le;t[77]===ce?le=t[78]:(le=(0,L.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:ce}),t[77]=ce,t[78]=le);let ue=i?`默认工作流`:`Default workflow`,de;t[79]===ue?de=t[80]:(de=(0,L.jsx)(`label`,{className:`block text-xs font-medium text-fg-muted`,children:ue}),t[79]=ue,t[80]=de);let fe=n.workflows.default??``,pe=s.isLoading?i?`正在加载…`:`Loading…`:i?`不设置默认工作流`:`No default workflow`,me=i?`不设置默认工作流`:`No default workflow`,he=i?`默认工作流`:`Default workflow`,ge;t[81]!==n||t[82]!==r?(ge=e=>r({...n,workflows:{...n.workflows,default:e||void 0}}),t[81]=n,t[82]=r,t[83]=ge):ge=t[83];let _e;t[84]!==fe||t[85]!==pe||t[86]!==me||t[87]!==he||t[88]!==ge||t[89]!==u||t[90]!==s.isLoading?(_e=(0,L.jsx)(a,{value:fe,options:u,placeholder:pe,emptyLabel:me,disabled:s.isLoading,ariaLabel:he,onChange:ge,triggerClassName:`mt-2`}),t[84]=fe,t[85]=pe,t[86]=me,t[87]=he,t[88]=ge,t[89]=u,t[90]=s.isLoading,t[91]=_e):_e=t[91];let ve;t[92]!==de||t[93]!==_e?(ve=(0,L.jsxs)(`div`,{className:`mt-5 max-w-xl`,children:[de,_e]}),t[92]=de,t[93]=_e,t[94]=ve):ve=t[94];let ye;t[95]===s.error?ye=t[96]:(ye=s.error?(0,L.jsx)(`p`,{className:`mt-3 text-sm text-red-600`,children:s.error instanceof Error?s.error.message:String(s.error)}):null,t[95]=s.error,t[96]=ye);let be=i?`允许调用的工作流`:`Allowed workflows`,$;t[97]===be?$=t[98]:($=(0,L.jsx)(`h3`,{className:`text-sm font-medium text-fg`,children:be}),t[97]=be,t[98]=$);let xe;t[99]!==n||t[100]!==r?(xe=()=>r({...n,workflows:{...n.workflows,allowed:void 0}}),t[99]=n,t[100]=r,t[101]=xe):xe=t[101];let Se=f?`bg-accent-soft shadow-surface`:`hover:bg-surface-hover`,Ce;t[102]===Se?Ce=t[103]:(Ce=d(`rounded-xl bg-surface-base/55 p-4 text-left focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,Se),t[102]=Se,t[103]=Ce);let we=i?`允许全部工作流`:`Allow every workflow`,Te;t[104]===we?Te=t[105]:(Te=(0,L.jsx)(`span`,{className:`block text-sm font-medium text-fg`,children:we}),t[104]=we,t[105]=Te);let Ee=i?`新增工作流也会自动可用。`:`New workflows become available automatically.`,De;t[106]===Ee?De=t[107]:(De=(0,L.jsx)(`span`,{className:`mt-1 block text-xs text-fg-muted`,children:Ee}),t[106]=Ee,t[107]=De);let Oe;t[108]!==xe||t[109]!==Ce||t[110]!==Te||t[111]!==De?(Oe=(0,L.jsxs)(`button`,{type:`button`,onClick:xe,className:Ce,children:[Te,De]}),t[108]=xe,t[109]=Ce,t[110]=Te,t[111]=De,t[112]=Oe):Oe=t[112];let ke;t[113]!==n||t[114]!==r?(ke=()=>r({...n,workflows:{...n.workflows,allowed:[]}}),t[113]=n,t[114]=r,t[115]=ke):ke=t[115];let Ae=f?`hover:bg-surface-hover`:`bg-accent-soft shadow-surface`,je;t[116]===Ae?je=t[117]:(je=d(`rounded-xl bg-surface-base/55 p-4 text-left focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,Ae),t[116]=Ae,t[117]=je);let Me=i?`只允许选中的工作流`:`Allow selected workflows only`,Ne;t[118]===Me?Ne=t[119]:(Ne=(0,L.jsx)(`span`,{className:`block text-sm font-medium text-fg`,children:Me}),t[118]=Me,t[119]=Ne);let Pe=i?`未选中的工作流不能被调用。`:`Unselected workflows cannot be invoked.`,Fe;t[120]===Pe?Fe=t[121]:(Fe=(0,L.jsx)(`span`,{className:`mt-1 block text-xs text-fg-muted`,children:Pe}),t[120]=Pe,t[121]=Fe);let Ie;t[122]!==ke||t[123]!==je||t[124]!==Ne||t[125]!==Fe?(Ie=(0,L.jsxs)(`button`,{type:`button`,onClick:ke,className:je,children:[Ne,Fe]}),t[122]=ke,t[123]=je,t[124]=Ne,t[125]=Fe,t[126]=Ie):Ie=t[126];let Le;t[127]!==Oe||t[128]!==Ie?(Le=(0,L.jsxs)(`div`,{className:`mt-3 grid gap-3 sm:grid-cols-2`,children:[Oe,Ie]}),t[127]=Oe,t[128]=Ie,t[129]=Le):Le=t[129];let Re;t[130]!==f||t[131]!==n.workflows.allowed||t[132]!==g||t[133]!==s.data||t[134]!==s.isLoading||t[135]!==i?(Re=f?null:(0,L.jsxs)(`div`,{className:`mt-3 flex flex-col gap-1 rounded-xl bg-surface-base/45 p-1 [&>label]:rounded-lg [&>label]:bg-surface-panel/55`,children:[(s.data??[]).map(e=>(0,L.jsxs)(`label`,{className:`flex cursor-pointer items-start gap-3 px-4 py-3 hover:bg-surface-hover/60`,children:[(0,L.jsx)(`input`,{type:`checkbox`,checked:n.workflows.allowed?.includes(e.id)??!1,onChange:t=>g(e.id,t.target.checked),className:`mt-0.5 size-4 accent-[var(--color-accent)]`}),(0,L.jsxs)(`span`,{children:[(0,L.jsx)(`span`,{className:`block text-sm font-medium text-fg`,children:e.title||e.name}),e.description?(0,L.jsx)(`span`,{className:`mt-1 block text-xs text-fg-muted`,children:e.description}):null]})]},e.id)),(s.data??[]).length===0&&!s.isLoading?(0,L.jsx)(`p`,{className:`px-4 py-8 text-center text-sm text-fg-muted`,children:i?`还没有工作流。`:`No workflows yet.`}):null]}),t[130]=f,t[131]=n.workflows.allowed,t[132]=g,t[133]=s.data,t[134]=s.isLoading,t[135]=i,t[136]=Re):Re=t[136];let ze;t[137]!==$||t[138]!==Le||t[139]!==Re?(ze=(0,L.jsxs)(`div`,{className:`mt-6 rounded-xl bg-surface-base/45 p-4`,children:[$,Le,Re]}),t[137]=$,t[138]=Le,t[139]=Re,t[140]=ze):ze=t[140];let Be;t[141]!==Q||t[142]!==le||t[143]!==ve||t[144]!==ye||t[145]!==ze?(Be=(0,L.jsxs)(`section`,{className:`rounded-xl bg-surface-hover/20 p-5`,children:[Q,le,ve,ye,ze]}),t[141]=Q,t[142]=le,t[143]=ve,t[144]=ye,t[145]=ze,t[146]=Be):Be=t[146];let Ve;return t[147]!==z||t[148]!==Z||t[149]!==Be?(Ve=(0,L.jsxs)(`div`,{className:`space-y-5`,children:[z,Z,Be]}),t[147]=z,t[148]=Z,t[149]=Be,t[150]=Ve):Ve=t[150],Ve}function X(e){return{value:e.id,label:e.title||e.name}}function Z(e){return[...new Set(e)].sort()}var se=[{id:`core`,names:[`doc-coauthoring`,`define-task`,`find-skills`,`summarize`],en:`Core`,zh:`核心`},{id:`office`,names:[`doc-coauthoring`,`define-task`,`find-skills`,`summarize`,`docx`,`pdf`,`pptx`,`xlsx`],en:`Office`,zh:`办公成果`},{id:`local-app`,names:[`doc-coauthoring`,`define-task`,`find-skills`,`summarize`,`build-xopc-local-app`,`frontend-design`,`theme-factory`],en:`Local App`,zh:`本地应用`},{id:`developer`,names:[`doc-coauthoring`,`define-task`,`find-skills`,`summarize`,`diagnose`,`github`,`tdd`,`webapp-testing`],en:`Developer`,zh:`开发者`},{id:`desktop-pet`,names:[`doc-coauthoring`,`define-task`,`find-skills`,`summarize`,`hatch-pet`],en:`Desktop Pet`,zh:`桌面宠物`}];function Q(e){let t=(0,re.c)(115),{draft:n,setDraft:r,zh:i}=e,a;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(a={revalidateOnFocus:!1},t[0]=a):a=t[0];let{data:s,error:l,isLoading:u}=m(`agent-defaults-skills-catalog`,C,a),[f,p]=(0,I.useState)(``),h=n.skills.mode===`selected`?n.skills.include:n.skills.exclude;s?.catalog;let g;if(t[1]!==h||t[2]!==s?.catalog||t[3]!==f){let e=[...s?.catalog??[]],n=new Set(e.map(fe));for(let t of h)n.has(t)||e.push({name:t,description:``,enabled:!0});let r=f.trim().toLowerCase();g=e.filter(e=>!r||`${e.name} ${e.description}`.toLowerCase().includes(r)).sort(de),t[1]=h,t[2]=s?.catalog,t[3]=f,t[4]=g}else g=t[4];let _=g,v;t[5]!==n.skills.exclude||t[6]!==n.skills.include||t[7]!==n.skills.mode?(v=e=>n.skills.mode===`selected`?n.skills.include.includes(e):!n.skills.exclude.includes(e),t[5]=n.skills.exclude,t[6]=n.skills.include,t[7]=n.skills.mode,t[8]=v):v=t[8];let y=v,b;t[9]!==n||t[10]!==r?(b=e=>{if(n.skills.mode===`selected`){let t=n.skills.include.includes(e)?n.skills.include.filter(t=>t!==e):Z([...n.skills.include,e]);r({...n,skills:{mode:`selected`,include:t}});return}let t=n.skills.exclude.includes(e)?n.skills.exclude.filter(t=>t!==e):Z([...n.skills.exclude,e]);r({...n,skills:{mode:`all-enabled`,exclude:t}})},t[9]=n,t[10]=r,t[11]=b):b=t[11];let x=b,S;t[12]===s?.catalog?S=t[13]:(S=s?.catalog??[],t[12]=s?.catalog,t[13]=S);let T;if(t[14]!==y||t[15]!==S){let e;t[17]===y?e=t[18]:(e=e=>e.enabled&&y(e.name),t[17]=y,t[18]=e),T=S.filter(e),t[14]=y,t[15]=S,t[16]=T}else T=t[16];let E=T.length,D;t[19]!==s?.catalog||t[20]!==n||t[21]!==r?(D=e=>{let t=new Set((s?.catalog??[]).filter(ue).map(le));r({...n,skills:{mode:`selected`,include:Z(e.filter(e=>t.has(e)))}})},t[19]=s?.catalog,t[20]=n,t[21]=r,t[22]=D):D=t[22];let O=D,ee=i?`技能策略`:`Skill policy`,te;t[23]===ee?te=t[24]:(te=(0,L.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:ee}),t[23]=ee,t[24]=te);let ne=i?`决定所有智能体默认可以使用哪些技能。`:`Choose which skills every agent can discover and use by default.`,k;t[25]===ne?k=t[26]:(k=(0,L.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:ne}),t[25]=ne,t[26]=k);let A;t[27]!==n||t[28]!==r?(A=()=>r({...n,skills:{mode:`all-enabled`,exclude:[]}}),t[27]=n,t[28]=r,t[29]=A):A=t[29];let j=n.skills.mode===`all-enabled`?`bg-accent-soft shadow-surface`:`hover:bg-surface-hover`,M;t[30]===j?M=t[31]:(M=d(`flex items-start gap-3 rounded-xl bg-surface-base/55 p-4 text-left focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,j),t[30]=j,t[31]=M);let N;t[32]===Symbol.for(`react.memo_cache_sentinel`)?(N=(0,L.jsx)(o,{className:`mt-0.5 size-5 shrink-0 text-accent`}),t[32]=N):N=t[32];let P=i?`使用所有已启用技能`:`Use every enabled skill`,F;t[33]===P?F=t[34]:(F=(0,L.jsx)(`span`,{className:`block text-sm font-medium text-fg`,children:P}),t[33]=P,t[34]=F);let R=i?`适合需要完整目录的高级智能体;新增技能会自动加入。`:`For advanced agents that need the full catalog; newly enabled skills are added automatically.`,z;t[35]===R?z=t[36]:(z=(0,L.jsx)(`span`,{className:`mt-1 block text-xs leading-5 text-fg-muted`,children:R}),t[35]=R,t[36]=z);let ie;t[37]!==F||t[38]!==z?(ie=(0,L.jsxs)(`span`,{children:[F,z]}),t[37]=F,t[38]=z,t[39]=ie):ie=t[39];let B;t[40]!==A||t[41]!==M||t[42]!==ie?(B=(0,L.jsxs)(`button`,{type:`button`,onClick:A,className:M,children:[N,ie]}),t[40]=A,t[41]=M,t[42]=ie,t[43]=B):B=t[43];let V;t[44]!==n||t[45]!==r?(V=()=>r({...n,skills:{mode:`selected`,include:[]}}),t[44]=n,t[45]=r,t[46]=V):V=t[46];let H=n.skills.mode===`selected`?`bg-accent-soft shadow-surface`:`hover:bg-surface-hover`,U;t[47]===H?U=t[48]:(U=d(`flex items-start gap-3 rounded-xl bg-surface-base/55 p-4 text-left focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,H),t[47]=H,t[48]=U);let W;t[49]===Symbol.for(`react.memo_cache_sentinel`)?(W=(0,L.jsx)(w,{className:`mt-0.5 size-5 shrink-0 text-accent`}),t[49]=W):W=t[49];let ae=i?`只使用选中的技能`:`Use selected skills only`,G;t[50]===ae?G=t[51]:(G=(0,L.jsx)(`span`,{className:`block text-sm font-medium text-fg`,children:ae}),t[50]=ae,t[51]=G);let oe=i?`适合严格受控的环境;新增技能不会自动加入。`:`For tightly controlled environments; new skills are not added automatically.`,K;t[52]===oe?K=t[53]:(K=(0,L.jsx)(`span`,{className:`mt-1 block text-xs leading-5 text-fg-muted`,children:oe}),t[52]=oe,t[53]=K);let q;t[54]!==G||t[55]!==K?(q=(0,L.jsxs)(`span`,{children:[G,K]}),t[54]=G,t[55]=K,t[56]=q):q=t[56];let J;t[57]!==V||t[58]!==U||t[59]!==q?(J=(0,L.jsxs)(`button`,{type:`button`,onClick:V,className:U,children:[W,q]}),t[57]=V,t[58]=U,t[59]=q,t[60]=J):J=t[60];let Y;t[61]!==B||t[62]!==J?(Y=(0,L.jsxs)(`div`,{className:`mt-5 grid gap-3 sm:grid-cols-2`,children:[B,J]}),t[61]=B,t[62]=J,t[63]=Y):Y=t[63];let X=i?`能力组合(会替换当前选择)`:`Capability packs (replaces the current selection)`,Q;t[64]===X?Q=t[65]:(Q=(0,L.jsx)(`p`,{className:`text-xs font-medium text-fg-muted`,children:X}),t[64]=X,t[65]=Q);let pe;t[66]!==O||t[67]!==s||t[68]!==i?(pe=se.map(e=>(0,L.jsx)(`button`,{type:`button`,onClick:()=>O(e.names),disabled:!s,className:`rounded-lg border border-edge bg-surface-panel px-3 py-1.5 text-xs font-medium text-fg transition-colors hover:bg-surface-hover disabled:cursor-not-allowed disabled:opacity-50`,children:i?e.zh:e.en},e.id)),t[66]=O,t[67]=s,t[68]=i,t[69]=pe):pe=t[69];let me;t[70]===pe?me=t[71]:(me=(0,L.jsx)(`div`,{className:`mt-2 flex flex-wrap gap-2`,children:pe}),t[70]=pe,t[71]=me);let he;t[72]!==Q||t[73]!==me?(he=(0,L.jsxs)(`div`,{className:`mt-4`,children:[Q,me]}),t[72]=Q,t[73]=me,t[74]=he):he=t[74];let ge;t[75]!==k||t[76]!==Y||t[77]!==he||t[78]!==te?(ge=(0,L.jsxs)(`section`,{className:`rounded-xl bg-surface-hover/20 p-5`,children:[te,k,Y,he]}),t[75]=k,t[76]=Y,t[77]=he,t[78]=te,t[79]=ge):ge=t[79];let _e=n.skills.mode===`selected`?i?`选择可用技能`:`Select available skills`:i?`管理例外`:`Manage exceptions`,ve;t[80]===_e?ve=t[81]:(ve=(0,L.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:_e}),t[80]=_e,t[81]=ve);let ye=i?`当前默认可用 ${E} 个技能。`:`${E} skills are available by default.`,be;t[82]===ye?be=t[83]:(be=(0,L.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:ye}),t[82]=ye,t[83]=be);let $;t[84]!==ve||t[85]!==be?($=(0,L.jsxs)(`div`,{children:[ve,be]}),t[84]=ve,t[85]=be,t[86]=$):$=t[86];let xe=i?`搜索技能`:`Search skills`,Se;t[87]===xe?Se=t[88]:(Se=(0,L.jsx)(`span`,{className:`sr-only`,children:xe}),t[87]=xe,t[88]=Se);let Ce;t[89]===Symbol.for(`react.memo_cache_sentinel`)?(Ce=(0,L.jsx)(c,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-fg-subtle`}),t[89]=Ce):Ce=t[89];let we;t[90]===Symbol.for(`react.memo_cache_sentinel`)?(we=e=>p(e.target.value),t[90]=we):we=t[90];let Te=i?`搜索技能`:`Search skills`,Ee;t[91]!==f||t[92]!==Te?(Ee=(0,L.jsx)(`input`,{type:`search`,value:f,onChange:we,placeholder:Te,className:`w-full rounded-lg border border-edge bg-surface-panel py-2 pl-9 pr-3 text-sm text-fg outline-none focus:border-accent`}),t[91]=f,t[92]=Te,t[93]=Ee):Ee=t[93];let De;t[94]!==Se||t[95]!==Ee?(De=(0,L.jsxs)(`label`,{className:`relative block w-full sm:w-72`,children:[Se,Ce,Ee]}),t[94]=Se,t[95]=Ee,t[96]=De):De=t[96];let Oe;t[97]!==$||t[98]!==De?(Oe=(0,L.jsxs)(`div`,{className:`flex flex-wrap items-end justify-between gap-3`,children:[$,De]}),t[97]=$,t[98]=De,t[99]=Oe):Oe=t[99];let ke;t[100]===l?ke=t[101]:(ke=l?(0,L.jsx)(`p`,{className:`mt-4 rounded-lg bg-red-500/10 px-3 py-2 text-sm text-red-600`,children:l instanceof Error?l.message:String(l)}):null,t[100]=l,t[101]=ke);let Ae;t[102]!==y||t[103]!==u||t[104]!==_||t[105]!==x||t[106]!==i?(Ae=u?(0,L.jsx)(`div`,{className:`mt-4 space-y-2`,children:[0,1,2,3].map(ce)}):(0,L.jsxs)(`div`,{className:`mt-4 flex max-h-[32rem] flex-col gap-1 overflow-y-auto rounded-xl bg-surface-base/45 p-1 [&>label]:rounded-lg [&>label]:bg-surface-panel/55`,children:[_.map(e=>{let t=y(e.name);return(0,L.jsxs)(`label`,{className:d(`flex cursor-pointer items-start gap-3 px-4 py-3 hover:bg-surface-hover/60`,!e.enabled&&`cursor-not-allowed opacity-55`),children:[(0,L.jsx)(`input`,{type:`checkbox`,checked:t,disabled:!e.enabled,onChange:()=>x(e.name),className:`mt-0.5 size-4 rounded border-edge accent-[var(--color-accent)]`}),(0,L.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,L.jsxs)(`span`,{className:`flex flex-wrap items-center gap-2`,children:[(0,L.jsx)(`span`,{className:`text-sm font-medium text-fg`,children:e.name}),e.enabled?null:(0,L.jsx)(`span`,{className:`rounded-full bg-surface-hover px-2 py-0.5 text-[10px] text-fg-muted`,children:i?`全局未启用`:`Disabled globally`})]}),e.description?(0,L.jsx)(`span`,{className:`mt-1 block line-clamp-2 text-xs leading-5 text-fg-muted`,children:e.description}):null]})]},e.name)}),_.length===0?(0,L.jsx)(`p`,{className:`px-4 py-8 text-center text-sm text-fg-muted`,children:i?`没有匹配的技能。`:`No matching skills.`}):null]}),t[102]=y,t[103]=u,t[104]=_,t[105]=x,t[106]=i,t[107]=Ae):Ae=t[107];let je;t[108]!==Oe||t[109]!==ke||t[110]!==Ae?(je=(0,L.jsxs)(`section`,{className:`rounded-xl bg-surface-hover/20 p-5`,children:[Oe,ke,Ae]}),t[108]=Oe,t[109]=ke,t[110]=Ae,t[111]=je):je=t[111];let Me;return t[112]!==ge||t[113]!==je?(Me=(0,L.jsxs)(`div`,{className:`space-y-5`,children:[ge,je]}),t[112]=ge,t[113]=je,t[114]=Me):Me=t[114],Me}function ce(e){return(0,L.jsx)(y,{className:`h-14 rounded-xl`},e)}function le(e){return e.name}function ue(e){return e.enabled}function de(e,t){return e.name.localeCompare(t.name)}function fe(e){return e.name}function pe(e){let t=Number.parseInt(e,10);return Number.isFinite(t)&&t>0?t:void 0}function me(e){let t=(0,re.c)(92),{draft:n,setDraft:r,builtinTools:i,zh:a}=e,[o,s]=(0,I.useState)(``),[l,u]=(0,I.useState)(`all`),[f,p]=(0,I.useState)(),m;t[0]===i?m=t[1]:(m=new Map(i.map(_e)),t[0]=i,t[1]=m);let g=m,_;t[2]!==i||t[3]!==n.tools?(_=[...new Set([...i.map(ge),...Object.keys(n.tools)])].filter(he).sort(),t[2]=i,t[3]=n.tools,t[4]=_):_=t[4];let v=_,y;if(t[5]!==v||t[6]!==n.tools){let e;t[8]===n.tools?e=t[9]:(e=e=>(n.tools[e]?.mode??`allow`)===`allow`,t[8]=n.tools,t[9]=e),y=v.filter(e),t[5]=v,t[6]=n.tools,t[7]=y}else y=t[7];let b=y.length,x;if(t[10]!==v||t[11]!==n.tools){let e;t[13]===n.tools?e=t[14]:(e=e=>n.tools[e]?.mode===`ask`,t[13]=n.tools,t[14]=e),x=v.filter(e),t[10]=v,t[11]=n.tools,t[12]=x}else x=t[12];let S=x.length,C;if(t[15]!==v||t[16]!==n.tools){let e;t[18]===n.tools?e=t[19]:(e=e=>n.tools[e]?.mode===`deny`,t[18]=n.tools,t[19]=e),C=v.filter(e),t[15]=v,t[16]=n.tools,t[17]=C}else C=t[17];let w;t[20]!==y.length||t[21]!==x.length||t[22]!==C.length?(w={allow:b,ask:S,deny:C.length},t[20]=y.length,t[21]=x.length,t[22]=C.length,t[23]=w):w=t[23];let T=w,E;if(t[24]!==v||t[25]!==g||t[26]!==n.tools||t[27]!==l||t[28]!==o){let e=o.trim().toLowerCase();E=v.filter(t=>{let r=n.tools[t]?.mode??`allow`,i=g.get(t),a=`${t} ${i?.en??``} ${i?.zh??``}`.toLowerCase();return(!e||a.includes(e))&&(l===`all`||r===l)}),t[24]=v,t[25]=g,t[26]=n.tools,t[27]=l,t[28]=o,t[29]=E}else E=t[29];let D=E,O;t[30]!==n||t[31]!==r?(O=(e,t)=>{let i=n.tools[e]??{mode:`allow`};r({...n,tools:{...n.tools,[e]:{...i,...t}}})},t[30]=n,t[31]=r,t[32]=O):O=t[32];let ee=O,ne=a?`全部 ${v.length}`:`All ${v.length}`,k;t[33]===ne?k=t[34]:(k={id:`all`,label:ne},t[33]=ne,t[34]=k);let A=a?`允许 ${T.allow}`:`Allow ${T.allow}`,j;t[35]===A?j=t[36]:(j={id:`allow`,label:A},t[35]=A,t[36]=j);let M=a?`询问 ${T.ask}`:`Ask ${T.ask}`,N;t[37]===M?N=t[38]:(N={id:`ask`,label:M},t[37]=M,t[38]=N);let P=a?`禁用 ${T.deny}`:`Deny ${T.deny}`,F;t[39]===P?F=t[40]:(F={id:`deny`,label:P},t[39]=P,t[40]=F);let R;t[41]!==k||t[42]!==j||t[43]!==N||t[44]!==F?(R=[k,j,N,F],t[41]=k,t[42]=j,t[43]=N,t[44]=F,t[45]=R):R=t[45];let z=R,ie=a?`默认工具权限`:`Default tool permissions`,B;t[46]===ie?B=t[47]:(B=(0,L.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:ie}),t[46]=ie,t[47]=B);let V=a?`允许:直接执行;询问:执行前确认;禁用:智能体无法使用。`:`Allow runs directly, Ask requires confirmation, and Deny makes the tool unavailable.`,H;t[48]===V?H=t[49]:(H=(0,L.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:V}),t[48]=V,t[49]=H);let U;t[50]!==B||t[51]!==H?(U=(0,L.jsxs)(`div`,{children:[B,H]}),t[50]=B,t[51]=H,t[52]=U):U=t[52];let W;t[53]!==l||t[54]!==z?(W=(0,L.jsx)(`div`,{className:`flex flex-wrap gap-1 rounded-xl bg-surface-panel p-1`,children:z.map(e=>(0,L.jsx)(`button`,{type:`button`,onClick:()=>u(e.id),className:d(`rounded-lg px-3 py-1.5 text-xs font-medium`,l===e.id?`bg-surface-base text-fg shadow-surface`:`text-fg-muted hover:text-fg`),children:e.label},e.id))}),t[53]=l,t[54]=z,t[55]=W):W=t[55];let ae=a?`搜索工具`:`Search tools`,G;t[56]===ae?G=t[57]:(G=(0,L.jsx)(`span`,{className:`sr-only`,children:ae}),t[56]=ae,t[57]=G);let oe;t[58]===Symbol.for(`react.memo_cache_sentinel`)?(oe=(0,L.jsx)(c,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-fg-subtle`}),t[58]=oe):oe=t[58];let K;t[59]===Symbol.for(`react.memo_cache_sentinel`)?(K=e=>s(e.target.value),t[59]=K):K=t[59];let q=a?`搜索工具`:`Search tools`,J;t[60]!==o||t[61]!==q?(J=(0,L.jsx)(`input`,{type:`search`,value:o,onChange:K,placeholder:q,className:`w-full rounded-lg border border-edge bg-surface-panel py-2 pl-9 pr-3 text-sm text-fg outline-none focus:border-accent`}),t[60]=o,t[61]=q,t[62]=J):J=t[62];let Y;t[63]!==G||t[64]!==J?(Y=(0,L.jsxs)(`label`,{className:`relative block w-full sm:w-72`,children:[G,oe,J]}),t[63]=G,t[64]=J,t[65]=Y):Y=t[65];let X;t[66]!==W||t[67]!==Y?(X=(0,L.jsxs)(`div`,{className:`mt-5 flex flex-wrap items-center justify-between gap-3`,children:[W,Y]}),t[66]=W,t[67]=Y,t[68]=X):X=t[68];let Z;if(t[69]!==g||t[70]!==n.tools||t[71]!==f||t[72]!==ee||t[73]!==D||t[74]!==a){let e;t[76]!==g||t[77]!==n.tools||t[78]!==f||t[79]!==ee||t[80]!==a?(e=e=>{let t=n.tools[e]??{mode:`allow`},r=g.get(e),i=f===e;return(0,L.jsxs)(`div`,{className:`px-4 py-3`,children:[(0,L.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[(0,L.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,L.jsx)(`code`,{className:`text-xs font-medium text-fg`,children:e}),r?(0,L.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:a?r.zh:r.en}):null]}),(0,L.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,L.jsx)(`div`,{className:`flex rounded-lg bg-surface-base p-1`,children:[`allow`,`ask`,`deny`].map(n=>(0,L.jsx)(`button`,{type:`button`,onClick:()=>ee(e,{mode:n}),className:d(`rounded-md px-2.5 py-1 text-xs font-medium capitalize`,t.mode===n?`bg-accent text-on-accent`:`text-fg-muted hover:text-fg`),children:n===`allow`?a?`允许`:`Allow`:n===`ask`?a?`询问`:`Ask`:a?`禁用`:`Deny`},n))}),(0,L.jsx)(h,{variant:`ghost`,className:`px-2 py-1`,"aria-label":a?`${e} 调用限制`:`${e} call limits`,onClick:()=>p(i?void 0:e),children:(0,L.jsx)(te,{className:`size-4`})})]})]}),i?(0,L.jsxs)(`div`,{className:`mt-3 grid gap-3 rounded-lg bg-surface-base p-3 sm:grid-cols-2`,children:[(0,L.jsxs)(`label`,{className:`block text-xs font-medium text-fg-muted`,children:[a?`每轮最多调用次数`:`Maximum calls per turn`,(0,L.jsx)(`input`,{type:`number`,min:1,value:t.maxCallsPerTurn??``,placeholder:a?`不限制`:`Unlimited`,onChange:t=>ee(e,{maxCallsPerTurn:pe(t.target.value)}),className:`mt-2 w-full rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg outline-none focus:border-accent`})]}),(0,L.jsxs)(`label`,{className:`block text-xs font-medium text-fg-muted`,children:[a?`单次超时(毫秒)`:`Call timeout (ms)`,(0,L.jsx)(`input`,{type:`number`,min:1,value:t.timeoutMs??``,placeholder:a?`使用系统默认值`:`Use system default`,onChange:t=>ee(e,{timeoutMs:pe(t.target.value)}),className:`mt-2 w-full rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg outline-none focus:border-accent`})]})]}):null]},e)},t[76]=g,t[77]=n.tools,t[78]=f,t[79]=ee,t[80]=a,t[81]=e):e=t[81],Z=D.map(e),t[69]=g,t[70]=n.tools,t[71]=f,t[72]=ee,t[73]=D,t[74]=a,t[75]=Z}else Z=t[75];let se;t[82]!==D.length||t[83]!==a?(se=D.length===0?(0,L.jsx)(`p`,{className:`px-4 py-10 text-center text-sm text-fg-muted`,children:a?`没有匹配的工具。`:`No matching tools.`}):null,t[82]=D.length,t[83]=a,t[84]=se):se=t[84];let Q;t[85]!==Z||t[86]!==se?(Q=(0,L.jsxs)(`div`,{className:`mt-4 flex max-h-[38rem] flex-col gap-1 overflow-y-auto rounded-xl bg-surface-base/45 p-1 [&>*]:rounded-lg [&>*]:bg-surface-panel/55`,children:[Z,se]}),t[85]=Z,t[86]=se,t[87]=Q):Q=t[87];let ce;return t[88]!==U||t[89]!==X||t[90]!==Q?(ce=(0,L.jsxs)(`section`,{className:`rounded-xl bg-surface-hover/20 p-5`,children:[U,X,Q]}),t[88]=U,t[89]=X,t[90]=Q,t[91]=ce):ce=t[91],ce}function he(e){return e!==`computer_use`||b()}function ge(e){return e.id}function _e(e){return[e.id,e.description]}function ve(){let e=(0,re.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,L.jsxs)(j,{gap:`gap-5`,children:[(0,L.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,L.jsxs)(`div`,{className:`space-y-2`,children:[(0,L.jsx)(y,{className:`h-7 w-56`}),(0,L.jsx)(y,{className:`h-4 w-96 max-w-full`})]}),(0,L.jsx)(y,{className:`h-9 w-28`})]}),(0,L.jsx)(y,{className:`h-20 rounded-2xl`}),(0,L.jsx)(y,{className:`h-12 rounded-xl`}),(0,L.jsx)(y,{className:`h-72 rounded-2xl`})]}),e[0]=t):t=e[0],t}function ye(e){let t=(0,re.c)(67),{initial:n,builtinTools:r,zh:i}=e,[a,o]=(0,I.useState)(`models`),s;t[0]===n?s=t[1]:(s=()=>structuredClone(n),t[0]=n,t[1]=s);let[c,u]=(0,I.useState)(s),f;t[2]===n?f=t[3]:(f=()=>structuredClone(n),t[2]=n,t[3]=f);let[p,m]=(0,I.useState)(f),g;t[4]===c?g=t[5]:(g=JSON.stringify(c),t[4]=c,t[5]=g);let _;t[6]===p?_=t[7]:(_=JSON.stringify(p),t[6]=p,t[7]=_);let v=g!==_,y=i?`模型`:`Models`,b;t[8]===y?b=t[9]:(b={id:`models`,label:y,icon:l},t[8]=y,t[9]=b);let S=i?`技能`:`Skills`,C;t[10]===S?C=t[11]:(C={id:`skills`,label:S,icon:ne},t[10]=S,t[11]=C);let w=i?`工具`:`Tools`,T;t[12]===w?T=t[13]:(T={id:`tools`,label:w,icon:x},t[12]=w,t[13]=T);let E=i?`运行`:`Runtime`,D;t[14]===E?D=t[15]:(D={id:`runtime`,label:E,icon:k},t[14]=E,t[15]=D);let ee;t[16]!==T||t[17]!==D||t[18]!==b||t[19]!==C?(ee=[b,C,T,D],t[16]=T,t[17]=D,t[18]=b,t[19]=C,t[20]=ee):ee=t[20];let te=ee,P;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(P=async e=>{let t=structuredClone(e),n=await O(t),r=structuredClone(n.defaults);u(e=>JSON.stringify(e)===JSON.stringify(t)?r:e),m(structuredClone(r))},t[21]=P):P=t[21];let F=P,R;t[22]!==v||t[23]!==c?(R={value:c,dirty:v,onSave:F,delayMs:0},t[22]=v,t[23]=c,t[24]=R):R=t[24];let z=N(R),ie=z.onBlurCapture,B=i?`智能体设置`:`Agent settings`,V;t[25]!==z.error||t[26]!==z.status?(V=(0,L.jsx)(M,{status:z.status,error:z.error}),t[25]=z.error,t[26]=z.status,t[27]=V):V=t[27];let H;t[28]!==B||t[29]!==V?(H=(0,L.jsx)(A,{title:B,actions:V}),t[28]=B,t[29]=V,t[30]=H):H=t[30];let U;t[31]!==z.error||t[32]!==z.retry||t[33]!==i?(U=z.error?(0,L.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2 rounded-xl bg-red-500/10 px-3 py-2 text-sm text-red-600`,children:[(0,L.jsx)(`span`,{children:z.error}),(0,L.jsx)(h,{type:`button`,variant:`ghost`,className:`h-8 text-red-600`,onClick:z.retry,children:i?`重试`:`Retry`})]}):null,t[31]=z.error,t[32]=z.retry,t[33]=i,t[34]=U):U=t[34];let W=i?`默认配置分区`:`Default configuration sections`,ae;t[35]!==a||t[36]!==te?(ae=te.map(e=>{let{id:t,label:n,icon:r}=e;return(0,L.jsxs)(`button`,{type:`button`,"aria-pressed":a===t,onClick:()=>o(t),className:d(`flex min-w-0 items-center justify-center gap-2 rounded-lg px-3 py-2.5 text-left transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,a===t?`bg-surface-base text-fg shadow-surface`:`text-fg-muted hover:bg-surface-hover hover:text-fg`),children:[(0,L.jsx)(r,{className:d(`size-4 shrink-0`,a===t?`text-accent`:`text-fg-subtle`)}),(0,L.jsx)(`span`,{className:`text-sm font-medium`,children:n})]},t)}),t[35]=a,t[36]=te,t[37]=ae):ae=t[37];let G;t[38]!==W||t[39]!==ae?(G=(0,L.jsx)(`nav`,{className:`grid grid-cols-2 gap-1 rounded-xl bg-surface-hover/20 p-1 lg:grid-cols-4`,"aria-label":W,children:ae}),t[38]=W,t[39]=ae,t[40]=G):G=t[40];let K;t[41]!==a||t[42]!==c||t[43]!==i?(K=a===`models`?(0,L.jsx)(oe,{draft:c,setDraft:u,zh:i}):null,t[41]=a,t[42]=c,t[43]=i,t[44]=K):K=t[44];let q;t[45]!==a||t[46]!==c||t[47]!==i?(q=a===`skills`?(0,L.jsx)(Q,{draft:c,setDraft:u,zh:i}):null,t[45]=a,t[46]=c,t[47]=i,t[48]=q):q=t[48];let J;t[49]!==a||t[50]!==r||t[51]!==c||t[52]!==i?(J=a===`tools`?(0,L.jsx)(me,{draft:c,setDraft:u,builtinTools:r,zh:i}):null,t[49]=a,t[50]=r,t[51]=c,t[52]=i,t[53]=J):J=t[53];let X;t[54]!==a||t[55]!==c||t[56]!==i?(X=a===`runtime`?(0,L.jsx)(Y,{draft:c,setDraft:u,zh:i}):null,t[54]=a,t[55]=c,t[56]=i,t[57]=X):X=t[57];let Z;return t[58]!==z.onBlurCapture||t[59]!==H||t[60]!==U||t[61]!==G||t[62]!==K||t[63]!==q||t[64]!==J||t[65]!==X?(Z=(0,L.jsxs)(j,{gap:`gap-5`,onBlurCapture:ie,children:[H,U,G,K,q,J,X]}),t[58]=z.onBlurCapture,t[59]=H,t[60]=U,t[61]=G,t[62]=K,t[63]=q,t[64]=J,t[65]=X,t[66]=Z):Z=t[66],Z}function be(){let e=(0,re.c)(17),t=f(xe),n=p($)===`zh`,{data:r,error:i,isLoading:a,mutate:o}=m(t?`settings-agent-defaults`:null,T);if(!t){let t=n?`需要本机服务令牌。`:`Local service token required.`,r;return e[0]===t?r=e[1]:(r=(0,L.jsx)(j,{children:(0,L.jsx)(`p`,{className:`text-sm text-fg-muted`,children:t})}),e[0]=t,e[1]=r),r}if(i&&!r){let t=String(i),r;e[2]===t?r=e[3]:(r=(0,L.jsx)(`p`,{className:`rounded-xl bg-red-500/10 px-3 py-2 text-sm text-red-600`,children:t}),e[2]=t,e[3]=r);let a;e[4]===o?a=e[5]:(a=()=>void o(),e[4]=o,e[5]=a);let s=n?`重试`:`Retry`,c;e[6]!==a||e[7]!==s?(c=(0,L.jsx)(h,{onClick:a,children:s}),e[6]=a,e[7]=s,e[8]=c):c=e[8];let l;return e[9]!==r||e[10]!==c?(l=(0,L.jsxs)(j,{children:[r,c]}),e[9]=r,e[10]=c,e[11]=l):l=e[11],l}if(a||!r){let t;return e[12]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,L.jsx)(ve,{}),e[12]=t):t=e[12],t}let s;return e[13]!==r.builtinTools||e[14]!==r.defaults||e[15]!==n?(s=(0,L.jsx)(ye,{initial:r.defaults,builtinTools:r.builtinTools,zh:n}),e[13]=r.builtinTools,e[14]=r.defaults,e[15]=n,e[16]=s):s=e[16],s}function $(e){return e.language}function xe(e){return e.conversationId}export{be as AgentDefaultsSettingsPanel};
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-BMYIfy9x.js";import{t as a}from"./popover-select-BNZZDJpO.js";import{t as o}from"./circle-check-C23XjkUj.js";import{t as s}from"./mic-CuUb7zc-.js";import{t as c}from"./search-DA7gz22f.js";import{t as l}from"./sparkles-DHlfQFAF.js";import{t as u}from"./x-B_N4OPjy.js";import{t as d}from"./cn-JdwAhgNB.js";import{c as f,n as p}from"./locale-store-ChN_vjs2.js";import{i as m}from"./vendor-swr-BIWyz7Rc.js";import{t as h}from"./button-CS04eWY9.js";import{r as g}from"./gateway-config-swr-EZxaKXdC.js";import{n as _,t as v}from"./registry-api-BM_81rLe.js";import{t as y}from"./skeleton-BwbyijEw.js";import{t as b}from"./electron-env-Dit0bHgy.js";import{Do as x,Hr as S,Wr as C,_s as w,cn as T,jc as E,kc as D,ln as O,v as ee,wo as te,zo as ne,zs as k}from"./index-BcTY7RBG.js";import{n as A,r as j}from"./settings-page-layout-X1x-2Cp9.js";import{n as M,t as N}from"./use-autosave-R3hEHQQq.js";import{s as P}from"./voice-config-api-CxGsCDoW.js";import{r as F}from"./image-generation-api-Bnl0CH4n.js";var I=e(t(),1),re=n(),L=r(),R={"xopc-cloud":`XOPC Cloud`,alibaba:`Alibaba Cloud`,edge:`Microsoft Edge`,groq:`Groq`,minimax:`MiniMax`,openai:`OpenAI`};function z(e,t,n){let r=e?.[t]?.[n];return typeof r==`string`&&r.trim()?r.trim():void 0}function ie(e){return R[e]??e}function B(e){let t=(0,re.c)(17),{icon:n,label:r,enabled:i,details:a,zh:o}=e,s;t[0]===n?s=t[1]:(s=(0,L.jsx)(`div`,{className:`rounded-lg bg-accent/10 p-2 text-accent`,children:(0,L.jsx)(n,{className:`size-4`,"aria-hidden":!0})}),t[0]=n,t[1]=s);let c;t[2]===r?c=t[3]:(c=(0,L.jsx)(`h3`,{className:`text-sm font-medium text-fg`,children:r}),t[2]=r,t[3]=c);let l=i?o?`已启用`:`On`:o?`已关闭`:`Off`,u;t[4]===l?u=t[5]:(u=(0,L.jsx)(`span`,{className:`rounded-full bg-surface-hover px-2 py-0.5 text-[10px] font-medium text-fg-muted`,children:l}),t[4]=l,t[5]=u);let d;t[6]!==c||t[7]!==u?(d=(0,L.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[c,u]}),t[6]=c,t[7]=u,t[8]=d):d=t[8];let f=i?a:o?`不处理语音`:`Voice processing is disabled`,p;t[9]===f?p=t[10]:(p=(0,L.jsx)(`p`,{className:`mt-1 truncate text-xs text-fg-muted`,children:f}),t[9]=f,t[10]=p);let m;t[11]!==d||t[12]!==p?(m=(0,L.jsxs)(`div`,{className:`min-w-0`,children:[d,p]}),t[11]=d,t[12]=p,t[13]=m):m=t[13];let h;return t[14]!==s||t[15]!==m?(h=(0,L.jsxs)(`div`,{className:`flex items-start gap-3 rounded-xl bg-surface-base/55 p-4`,children:[s,m]}),t[14]=s,t[15]=m,t[16]=h):h=t[16],h}function V(e){let t=(0,re.c)(27),{zh:n}=e,{data:r,error:a,isLoading:o}=g(!0),c=r?.payload?.config,l,u,d;if(t[0]!==c){d=c===void 0?void 0:P(c);let e=d?z(d.stt.providers,d.stt.provider,`model`):void 0,n=d?z(d.tts.providers,d.tts.provider,`model`):void 0,r=d?z(d.tts.providers,d.tts.provider,`voice`):void 0;l=d?[ie(d.stt.provider),e].filter(Boolean).join(` · `):void 0,u=d?[ie(d.tts.provider),n,r].filter(Boolean).join(` · `):void 0,t[0]=c,t[1]=l,t[2]=u,t[3]=d}else l=t[1],u=t[2],d=t[3];let f=u,p=n?`语音能力`:`Voice capabilities`,m;t[4]===p?m=t[5]:(m=(0,L.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:p}),t[4]=p,t[5]=m);let _=n?`语音识别和朗读由所有智能体共用,在语音设置中统一管理。`:`STT and TTS are shared by every agent and managed in global voice settings.`,v;t[6]===_?v=t[7]:(v=(0,L.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:_}),t[6]=_,t[7]=v);let b;t[8]!==m||t[9]!==v?(b=(0,L.jsxs)(`div`,{children:[m,v]}),t[8]=m,t[9]=v,t[10]=b):b=t[10];let x=n?`管理语音设置`:`Manage voice settings`,S;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,L.jsx)(E,{className:`size-4`,"aria-hidden":!0}),t[11]=S):S=t[11];let C;t[12]===x?C=t[13]:(C=(0,L.jsx)(h,{asChild:!0,variant:`secondary`,className:`shrink-0`,children:(0,L.jsxs)(i,{to:`/settings/capabilities/voice`,children:[x,S]})}),t[12]=x,t[13]=C);let w;t[14]!==b||t[15]!==C?(w=(0,L.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[b,C]}),t[14]=b,t[15]=C,t[16]=w):w=t[16];let T;t[17]!==a||t[18]!==o||t[19]!==l||t[20]!==f||t[21]!==d||t[22]!==n?(T=o||!d?a?(0,L.jsx)(`p`,{className:`mt-4 rounded-xl bg-red-500/10 px-3 py-2 text-sm text-red-600`,children:n?`暂时无法读取语音配置。`:`Voice settings could not be loaded.`}):(0,L.jsxs)(`div`,{className:`mt-4 grid gap-3 sm:grid-cols-2`,children:[(0,L.jsx)(y,{className:`h-20 rounded-xl`}),(0,L.jsx)(y,{className:`h-20 rounded-xl`})]}):(0,L.jsxs)(`div`,{className:`mt-4 grid gap-3 sm:grid-cols-2`,children:[(0,L.jsx)(B,{icon:s,label:n?`语音转文字(STT)`:`Speech to text (STT)`,enabled:d.stt.enabled,details:l,zh:n}),(0,L.jsx)(B,{icon:D,label:n?`文字转语音(TTS)`:`Text to speech (TTS)`,enabled:d.tts.enabled,details:f,zh:n})]}),t[17]=a,t[18]=o,t[19]=l,t[20]=f,t[21]=d,t[22]=n,t[23]=T):T=t[23];let O;return t[24]!==w||t[25]!==T?(O=(0,L.jsxs)(`section`,{className:`rounded-xl bg-surface-hover/20 p-5`,children:[w,T]}),t[24]=w,t[25]=T,t[26]=O):O=t[26],O}var H=[`fast`,`reasoning`,`coding`,`review`,`vision`,`understanding`],U=`w-full rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg outline-none focus:border-accent focus:ring-2 focus:ring-accent/15`,W={en:{fast:[`Fast tasks`,`Short, low-latency work`],reasoning:[`Complex reasoning`,`Planning and multi-step analysis`],coding:[`Coding`,`Implementation and debugging`],review:[`Review`,`Critique and verification`],vision:[`Vision`,`Image and visual analysis`],understanding:[`Understanding`,`Long-form content comprehension`]},zh:{fast:[`快速任务`,`简短、低延迟的工作`],reasoning:[`复杂推理`,`规划和多步骤分析`],coding:[`编程`,`实现、调试和代码修改`],review:[`审查`,`检查、批评和验证`],vision:[`视觉任务`,`图片和视觉内容分析`],understanding:[`内容理解`,`长内容阅读和理解`]}};function ae(e,t){return{primary:t,fallbacks:e?.fallbacks??[]}}function G(e){let t=(0,re.c)(35),{primary:n,value:r,models:i,loading:a,error:o,zh:s,onChange:c}=e,l;if(t[0]!==i||t[1]!==n||t[2]!==r){let e;t[4]!==n||t[5]!==r?(e=e=>e.id!==n&&!r.includes(e.id),t[4]=n,t[5]=r,t[6]=e):e=t[6],l=i.filter(e),t[0]=i,t[1]=n,t[2]=r,t[3]=l}else l=t[3];let d=l,f=s?`回退顺序`:`Fallback order`,p;t[7]===f?p=t[8]:(p=(0,L.jsx)(`h4`,{className:`text-sm font-medium text-fg`,children:f}),t[7]=f,t[8]=p);let m=s?`主模型不可用时,按从左到右的顺序尝试。`:`Tried from left to right when the primary model is unavailable.`,h;t[9]===m?h=t[10]:(h=(0,L.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:m}),t[9]=m,t[10]=h);let g;t[11]!==p||t[12]!==h?(g=(0,L.jsx)(`div`,{className:`flex items-center justify-between gap-3`,children:(0,L.jsxs)(`div`,{children:[p,h]})}),t[11]=p,t[12]=h,t[13]=g):g=t[13];let _;t[14]!==i||t[15]!==c||t[16]!==r||t[17]!==s?(_=r.length>0?(0,L.jsx)(`div`,{className:`mt-3 flex flex-wrap gap-2`,children:r.map((e,t)=>(0,L.jsxs)(`span`,{className:`inline-flex items-center gap-2 rounded-full bg-surface-base/70 py-1 pl-2.5 pr-1 text-xs text-fg`,children:[(0,L.jsx)(`span`,{className:`text-fg-subtle`,children:t+1}),(0,L.jsx)(`span`,{children:i.find(t=>t.id===e)?.name??e}),(0,L.jsx)(`button`,{type:`button`,"aria-label":s?`移除 ${e}`:`Remove ${e}`,className:`rounded-full p-1 text-fg-muted hover:bg-surface-hover hover:text-fg`,onClick:()=>c(r.filter(t=>t!==e)),children:(0,L.jsx)(u,{className:`size-3`})})]},e))}):(0,L.jsx)(`p`,{className:`mt-3 text-xs text-fg-subtle`,children:s?`未设置回退模型。`:`No fallback models configured.`}),t[14]=i,t[15]=c,t[16]=r,t[17]=s,t[18]=_):_=t[18];let v=s?`添加回退模型`:`Add fallback model`,y=s?`搜索模型或服务商`:`Search models or providers`,b=s?`没有可添加的模型`:`No models available to add`,x=s?`添加回退模型`:`Add fallback model`,C;t[19]!==c||t[20]!==r?(C=e=>{e&&c([...r,e])},t[19]=c,t[20]=r,t[21]=C):C=t[21];let w;t[22]!==d||t[23]!==o||t[24]!==a||t[25]!==b||t[26]!==x||t[27]!==C||t[28]!==v||t[29]!==y?(w=(0,L.jsx)(S,{value:``,models:d,modelsLoading:a,modelsError:o,placeholder:v,searchPlaceholder:y,noMatches:b,showProviderInTrigger:!1,contentAlign:`start`,className:`mt-3 w-full max-w-md`,ariaLabel:x,onChange:C}),t[22]=d,t[23]=o,t[24]=a,t[25]=b,t[26]=x,t[27]=C,t[28]=v,t[29]=y,t[30]=w):w=t[30];let T;return t[31]!==w||t[32]!==g||t[33]!==_?(T=(0,L.jsxs)(`div`,{children:[g,_,w]}),t[31]=w,t[32]=g,t[33]=_,t[34]=T):T=t[34],T}function oe(e){let t=(0,re.c)(121),{draft:n,setDraft:r,zh:i}=e,a;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(a={revalidateOnFocus:!1},t[0]=a):a=t[0];let o=m(v,_,a),s;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(s={revalidateOnFocus:!1},t[1]=s):s=t[1];let c=m(`agent-defaults-image-models`,F,s),l;t[2]===o.data?l=t[3]:(l=o.data??[],t[2]=o.data,t[3]=l);let u=l,d;t[4]===c.data?d=t[5]:(d=c.data??[],t[4]=c.data,t[5]=d);let f;t[6]===d?f=t[7]:(f=d.flatMap(K),t[6]=d,t[7]=f);let p=f,g=i?W.zh:W.en,y;t[8]!==n||t[9]!==r?(y=(e,t)=>{let i={...n.models.intents};t?i[e]=ae(i[e],t):delete i[e],r({...n,models:{...n.models,intents:i}})},t[8]=n,t[9]=r,t[10]=y):y=t[10];let b=y,x=i?`默认对话模型`:`Default conversation model`,C;t[11]===x?C=t[12]:(C=(0,L.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:x}),t[11]=x,t[12]=C);let w=i?`大多数对话和没有专用路由的任务都会使用它。`:`Used for most conversations and every task without a dedicated route.`,T;t[13]===w?T=t[14]:(T=(0,L.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:w}),t[13]=w,t[14]=T);let E;t[15]!==T||t[16]!==C?(E=(0,L.jsxs)(`div`,{children:[C,T]}),t[15]=T,t[16]=C,t[17]=E):E=t[17];let D=i?`主模型`:`Primary model`,O;t[18]===D?O=t[19]:(O=(0,L.jsx)(`label`,{className:`block text-xs font-medium text-fg-muted`,children:D}),t[18]=D,t[19]=O);let ee=i?`选择模型`:`Select a model`,te=i?`搜索模型或服务商`:`Search models or providers`,ne=i?`没有匹配的模型`:`No matching models`,k=i?`默认对话模型`:`Default conversation model`,A;t[20]!==n||t[21]!==r?(A=e=>r({...n,models:{...n.models,chat:{...n.models.chat,primary:e}}}),t[20]=n,t[21]=r,t[22]=A):A=t[22];let j;t[23]!==n.models.chat.primary||t[24]!==ee||t[25]!==te||t[26]!==ne||t[27]!==k||t[28]!==A?(j=(0,L.jsx)(S,{value:n.models.chat.primary,placeholder:ee,searchPlaceholder:te,noMatches:ne,showProviderSettingsFooter:!0,contentAlign:`start`,className:`mt-2 w-full`,ariaLabel:k,onChange:A}),t[23]=n.models.chat.primary,t[24]=ee,t[25]=te,t[26]=ne,t[27]=k,t[28]=A,t[29]=j):j=t[29];let M;t[30]!==O||t[31]!==j?(M=(0,L.jsxs)(`div`,{className:`mt-5 max-w-xl`,children:[O,j]}),t[30]=O,t[31]=j,t[32]=M):M=t[32];let N;t[33]!==n||t[34]!==r?(N=e=>r({...n,models:{...n.models,chat:{...n.models.chat,fallbacks:e}}}),t[33]=n,t[34]=r,t[35]=N):N=t[35];let P;t[36]!==n.models.chat.fallbacks||t[37]!==n.models.chat.primary||t[38]!==u||t[39]!==o.error||t[40]!==o.isLoading||t[41]!==N||t[42]!==i?(P=(0,L.jsx)(`div`,{className:`mt-6 rounded-xl bg-surface-base/45 p-4`,children:(0,L.jsx)(G,{primary:n.models.chat.primary,value:n.models.chat.fallbacks,models:u,loading:o.isLoading,error:o.error,zh:i,onChange:N})}),t[36]=n.models.chat.fallbacks,t[37]=n.models.chat.primary,t[38]=u,t[39]=o.error,t[40]=o.isLoading,t[41]=N,t[42]=i,t[43]=P):P=t[43];let I;t[44]!==E||t[45]!==M||t[46]!==P?(I=(0,L.jsxs)(`section`,{className:`rounded-xl bg-surface-hover/20 p-5`,children:[E,M,P]}),t[44]=E,t[45]=M,t[46]=P,t[47]=I):I=t[47];let R=i?`图片能力`:`Image capabilities`,z;t[48]===R?z=t[49]:(z=(0,L.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:R}),t[48]=R,t[49]=z);let ie=i?`没有图片任务时可以保持关闭。`:`Leave these off when the agents do not work with images.`,B;t[50]===ie?B=t[51]:(B=(0,L.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:ie}),t[50]=ie,t[51]=B);let oe=i?`图片理解模型`:`Image understanding model`,q;t[52]===oe?q=t[53]:(q=(0,L.jsx)(`label`,{className:`block text-xs font-medium text-fg-muted`,children:oe}),t[52]=oe,t[53]=q);let J=n.models.imageUnderstanding?.primary??``,Y=i?`关闭图片理解`:`Image understanding off`,X=i?`搜索视觉模型`:`Search vision models`,Z=i?`没有可用的视觉模型`:`No vision models available`,se=i?`关闭图片理解`:`Image understanding off`,Q=i?`图片理解模型`:`Image understanding model`,ce;t[54]!==n||t[55]!==r?(ce=e=>{let t={...n.models};e?t.imageUnderstanding=ae(t.imageUnderstanding,e):delete t.imageUnderstanding,r({...n,models:t})},t[54]=n,t[55]=r,t[56]=ce):ce=t[56];let le;t[57]!==J||t[58]!==Y||t[59]!==X||t[60]!==Z||t[61]!==se||t[62]!==Q||t[63]!==ce?(le=(0,L.jsx)(S,{value:J,placeholder:Y,searchPlaceholder:X,noMatches:Z,capabilitiesFilter:`vision`,allowEmpty:!0,emptyLabel:se,contentAlign:`start`,className:`mt-2 w-full`,ariaLabel:Q,onChange:ce}),t[57]=J,t[58]=Y,t[59]=X,t[60]=Z,t[61]=se,t[62]=Q,t[63]=ce,t[64]=le):le=t[64];let ue;t[65]!==q||t[66]!==le?(ue=(0,L.jsxs)(`div`,{children:[q,le]}),t[65]=q,t[66]=le,t[67]=ue):ue=t[67];let de=i?`图片生成模型`:`Image generation model`,fe;t[68]===de?fe=t[69]:(fe=(0,L.jsx)(`label`,{className:`block text-xs font-medium text-fg-muted`,children:de}),t[68]=de,t[69]=fe);let pe=n.models.imageGeneration?.primary??``,me=i?`关闭图片生成`:`Image generation off`,he=i?`搜索图片模型或服务商`:`Search image models or providers`,ge=i?`没有可用的图片生成模型`:`No image generation models available`,_e=i?`关闭图片生成`:`Image generation off`,ve=i?`图片生成模型`:`Image generation model`,ye;t[70]!==n||t[71]!==r?(ye=e=>{let t={...n.models};e?t.imageGeneration={primary:e,fallbacks:t.imageGeneration?.fallbacks??[],timeoutMs:t.imageGeneration?.timeoutMs,autoProviderFallback:t.imageGeneration?.autoProviderFallback??!0}:delete t.imageGeneration,r({...n,models:t})},t[70]=n,t[71]=r,t[72]=ye):ye=t[72];let be;t[73]!==p||t[74]!==c.error||t[75]!==c.isLoading||t[76]!==pe||t[77]!==me||t[78]!==he||t[79]!==ge||t[80]!==_e||t[81]!==ve||t[82]!==ye?(be=(0,L.jsx)(S,{value:pe,models:p,modelsLoading:c.isLoading,modelsError:c.error,placeholder:me,searchPlaceholder:he,noMatches:ge,allowEmpty:!0,emptyLabel:_e,contentAlign:`start`,className:`mt-2 w-full`,ariaLabel:ve,onChange:ye}),t[73]=p,t[74]=c.error,t[75]=c.isLoading,t[76]=pe,t[77]=me,t[78]=he,t[79]=ge,t[80]=_e,t[81]=ve,t[82]=ye,t[83]=be):be=t[83];let $;t[84]!==fe||t[85]!==be?($=(0,L.jsxs)(`div`,{children:[fe,be]}),t[84]=fe,t[85]=be,t[86]=$):$=t[86];let xe;t[87]!==ue||t[88]!==$?(xe=(0,L.jsxs)(`div`,{className:`mt-5 grid gap-5 lg:grid-cols-2`,children:[ue,$]}),t[87]=ue,t[88]=$,t[89]=xe):xe=t[89];let Se;t[90]!==n||t[91]!==r||t[92]!==i?(Se=n.models.imageGeneration?(0,L.jsxs)(`div`,{className:`mt-5 grid gap-4 rounded-xl bg-surface-base/45 p-4 sm:grid-cols-2`,children:[(0,L.jsxs)(`label`,{className:`block text-xs font-medium text-fg-muted`,children:[i?`生成超时(毫秒)`:`Generation timeout (ms)`,(0,L.jsx)(`input`,{type:`number`,min:1,className:`${U} mt-2`,value:n.models.imageGeneration.timeoutMs??``,onChange:e=>r({...n,models:{...n.models,imageGeneration:{...n.models.imageGeneration,timeoutMs:e.target.value?Number(e.target.value):void 0}}})})]}),(0,L.jsxs)(`div`,{className:`text-xs font-medium text-fg-muted`,children:[(0,L.jsx)(`span`,{children:i?`服务商自动回退`:`Automatic provider fallback`}),(0,L.jsx)(`div`,{className:`mt-1.5 flex rounded-lg bg-surface-panel p-1`,children:[!0,!1].map(e=>(0,L.jsx)(h,{variant:n.models.imageGeneration?.autoProviderFallback===e?`secondary`:`ghost`,className:`flex-1 py-1.5 text-xs`,onClick:()=>r({...n,models:{...n.models,imageGeneration:{...n.models.imageGeneration,autoProviderFallback:e}}}),children:e?i?`开启`:`On`:i?`关闭`:`Off`},String(e)))})]})]}):null,t[90]=n,t[91]=r,t[92]=i,t[93]=Se):Se=t[93];let Ce;t[94]!==z||t[95]!==B||t[96]!==xe||t[97]!==Se?(Ce=(0,L.jsxs)(`section`,{className:`rounded-xl bg-surface-hover/20 p-5`,children:[z,B,xe,Se]}),t[94]=z,t[95]=B,t[96]=xe,t[97]=Se,t[98]=Ce):Ce=t[98];let we;t[99]===i?we=t[100]:(we=(0,L.jsx)(V,{zh:i}),t[99]=i,t[100]=we);let Te=i?`按任务选择模型`:`Route by task`,Ee;t[101]===Te?Ee=t[102]:(Ee=(0,L.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:Te}),t[101]=Te,t[102]=Ee);let De=i?`仅在确实需要不同模型时设置;否则保持“使用默认对话模型”。`:`Set a route only when a task genuinely needs another model; otherwise keep the default.`,Oe;t[103]===De?Oe=t[104]:(Oe=(0,L.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:De}),t[103]=De,t[104]=Oe);let ke;t[105]!==g||t[106]!==n.models.intents||t[107]!==b||t[108]!==i?(ke=H.map(e=>(0,L.jsxs)(`div`,{className:`rounded-xl bg-surface-base/55 p-4`,children:[(0,L.jsxs)(`div`,{className:`mb-3`,children:[(0,L.jsx)(`h3`,{className:`text-sm font-medium text-fg`,children:g[e][0]}),(0,L.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-muted`,children:g[e][1]})]}),(0,L.jsx)(S,{value:n.models.intents[e]?.primary??``,placeholder:i?`使用默认对话模型`:`Use default conversation model`,searchPlaceholder:i?`搜索模型或服务商`:`Search models or providers`,noMatches:i?`没有匹配的模型`:`No matching models`,allowEmpty:!0,emptyLabel:i?`使用默认对话模型`:`Use default conversation model`,showProviderInTrigger:!1,contentAlign:`start`,className:`w-full`,ariaLabel:i?`${g[e][0]}模型`:`${g[e][0]} model`,onChange:t=>b(e,t)})]},e)),t[105]=g,t[106]=n.models.intents,t[107]=b,t[108]=i,t[109]=ke):ke=t[109];let Ae;t[110]===ke?Ae=t[111]:(Ae=(0,L.jsx)(`div`,{className:`mt-5 grid gap-3 lg:grid-cols-2`,children:ke}),t[110]=ke,t[111]=Ae);let je;t[112]!==Ee||t[113]!==Oe||t[114]!==Ae?(je=(0,L.jsxs)(`section`,{className:`rounded-xl bg-surface-hover/20 p-5`,children:[Ee,Oe,Ae]}),t[112]=Ee,t[113]=Oe,t[114]=Ae,t[115]=je):je=t[115];let Me;return t[116]!==I||t[117]!==Ce||t[118]!==we||t[119]!==je?(Me=(0,L.jsxs)(`div`,{className:`space-y-5`,children:[I,Ce,we,je]}),t[116]=I,t[117]=Ce,t[118]=we,t[119]=je,t[120]=Me):Me=t[120],Me}function K(e){return e.models.map(t=>({id:`${e.id}/${t}`,name:t,provider:e.label}))}var q=`w-full rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg outline-none focus:border-accent focus:ring-2 focus:ring-accent/15`;function J(e){let t=Number.parseInt(e,10);return Number.isFinite(t)&&t>0?t:void 0}function Y(e){let t=(0,re.c)(151),{draft:n,setDraft:r,zh:i}=e,o;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(o={revalidateOnFocus:!1},t[0]=o):o=t[0];let s=m(`agent-defaults-workflows`,ee,o),c;t[1]===s.data?c=t[2]:(c=s.data??[],t[1]=s.data,t[2]=c);let l;t[3]===c?l=t[4]:(l=c.map(X),t[3]=c,t[4]=l);let u=l,f=n.workflows.allowed===void 0,p;t[5]!==n||t[6]!==r?(p=(e,t)=>{let i=n.workflows.allowed??[],a=t?[...new Set([...i,e])]:i.filter(t=>t!==e);r({...n,workflows:{...n.workflows,allowed:a}})},t[5]=n,t[6]=r,t[7]=p):p=t[7];let g=p,_=i?`执行限制`:`Execution limits`,v;t[8]===_?v=t[9]:(v=(0,L.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:_}),t[8]=_,t[9]=v);let y=i?`为所有智能体设置安全上限;留空时使用系统默认值。`:`Set safe upper bounds for every agent. Empty fields use system defaults.`,b;t[10]===y?b=t[11]:(b=(0,L.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:y}),t[10]=y,t[11]=b);let x=i?`每次运行最多轮数`:`Maximum turns per run`,S=n.runtime.maxTurns??``,C=i?`系统默认`:`System default`,w;t[12]!==n||t[13]!==r?(w=e=>r({...n,runtime:{...n.runtime,maxTurns:J(e.target.value)}}),t[12]=n,t[13]=r,t[14]=w):w=t[14];let T;t[15]!==S||t[16]!==C||t[17]!==w?(T=(0,L.jsx)(`input`,{type:`number`,min:1,value:S,placeholder:C,onChange:w,className:`${q} mt-2`}),t[15]=S,t[16]=C,t[17]=w,t[18]=T):T=t[18];let E;t[19]!==T||t[20]!==x?(E=(0,L.jsxs)(`label`,{className:`block text-xs font-medium text-fg-muted`,children:[x,T]}),t[19]=T,t[20]=x,t[21]=E):E=t[21];let D=i?`单轮超时(毫秒)`:`Turn timeout (ms)`,O=n.runtime.timeoutMs??``,te=i?`系统默认`:`System default`,ne;t[22]!==n||t[23]!==r?(ne=e=>r({...n,runtime:{...n.runtime,timeoutMs:J(e.target.value)}}),t[22]=n,t[23]=r,t[24]=ne):ne=t[24];let k;t[25]!==O||t[26]!==te||t[27]!==ne?(k=(0,L.jsx)(`input`,{type:`number`,min:1,value:O,placeholder:te,onChange:ne,className:`${q} mt-2`}),t[25]=O,t[26]=te,t[27]=ne,t[28]=k):k=t[28];let A;t[29]!==D||t[30]!==k?(A=(0,L.jsxs)(`label`,{className:`block text-xs font-medium text-fg-muted`,children:[D,k]}),t[29]=D,t[30]=k,t[31]=A):A=t[31];let j=i?`每轮最多工具失败次数`:`Maximum tool failures per turn`,M=n.runtime.maxToolFailuresPerTurn??``,N=i?`系统默认`:`System default`,P;t[32]!==n||t[33]!==r?(P=e=>r({...n,runtime:{...n.runtime,maxToolFailuresPerTurn:J(e.target.value)}}),t[32]=n,t[33]=r,t[34]=P):P=t[34];let F;t[35]!==M||t[36]!==N||t[37]!==P?(F=(0,L.jsx)(`input`,{type:`number`,min:1,value:M,placeholder:N,onChange:P,className:`${q} mt-2`}),t[35]=M,t[36]=N,t[37]=P,t[38]=F):F=t[38];let I;t[39]!==j||t[40]!==F?(I=(0,L.jsxs)(`label`,{className:`block text-xs font-medium text-fg-muted`,children:[j,F]}),t[39]=j,t[40]=F,t[41]=I):I=t[41];let R;t[42]!==E||t[43]!==A||t[44]!==I?(R=(0,L.jsxs)(`div`,{className:`mt-5 grid gap-4 md:grid-cols-3`,children:[E,A,I]}),t[42]=E,t[43]=A,t[44]=I,t[45]=R):R=t[45];let z;t[46]!==R||t[47]!==v||t[48]!==b?(z=(0,L.jsxs)(`section`,{className:`rounded-xl bg-surface-hover/20 p-5`,children:[v,b,R]}),t[46]=R,t[47]=v,t[48]=b,t[49]=z):z=t[49];let ie=i?`提示词缓存`:`Prompt cache`,B;t[50]===ie?B=t[51]:(B=(0,L.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:ie}),t[50]=ie,t[51]=B);let V=i?`复用稳定的上下文以降低响应延迟和模型费用。`:`Reuse stable context to reduce latency and model cost.`,H;t[52]===V?H=t[53]:(H=(0,L.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:V}),t[52]=V,t[53]=H);let U=i?`缓存模式`:`Cache mode`,W;t[54]===U?W=t[55]:(W=(0,L.jsx)(`span`,{children:U}),t[54]=U,t[55]=W);let ae;t[56]===Symbol.for(`react.memo_cache_sentinel`)?(ae=[`auto`,`off`],t[56]=ae):ae=t[56];let G;t[57]!==n||t[58]!==r||t[59]!==i?(G=(0,L.jsx)(`div`,{className:`mt-1.5 flex rounded-lg bg-surface-panel p-1`,children:ae.map(e=>(0,L.jsx)(h,{variant:n.runtime.promptCache?.mode===e?`secondary`:`ghost`,className:`flex-1 py-1.5 text-xs`,onClick:()=>r({...n,runtime:{...n.runtime,promptCache:{mode:e,lifetime:n.runtime.promptCache?.lifetime??`short`}}}),children:e===`auto`?i?`自动`:`Automatic`:i?`关闭`:`Off`},e))}),t[57]=n,t[58]=r,t[59]=i,t[60]=G):G=t[60];let oe;t[61]!==W||t[62]!==G?(oe=(0,L.jsxs)(`div`,{className:`text-xs font-medium text-fg-muted`,children:[W,G]}),t[61]=W,t[62]=G,t[63]=oe):oe=t[63];let K;t[64]!==n||t[65]!==r||t[66]!==i?(K=n.runtime.promptCache?.mode===`auto`?(0,L.jsxs)(`div`,{className:`text-xs font-medium text-fg-muted`,children:[(0,L.jsx)(`span`,{children:i?`缓存周期`:`Cache lifetime`}),(0,L.jsx)(`div`,{className:`mt-1.5 flex rounded-lg bg-surface-panel p-1`,children:[`short`,`long`].map(e=>(0,L.jsx)(h,{variant:n.runtime.promptCache?.lifetime===e?`secondary`:`ghost`,className:`flex-1 py-1.5 text-xs`,onClick:()=>r({...n,runtime:{...n.runtime,promptCache:{mode:`auto`,lifetime:e}}}),children:e===`short`?i?`短期`:`Short`:i?`长期`:`Long`},e))})]}):null,t[64]=n,t[65]=r,t[66]=i,t[67]=K):K=t[67];let Y;t[68]!==oe||t[69]!==K?(Y=(0,L.jsxs)(`div`,{className:`mt-5 grid gap-4 sm:grid-cols-2`,children:[oe,K]}),t[68]=oe,t[69]=K,t[70]=Y):Y=t[70];let Z;t[71]!==B||t[72]!==H||t[73]!==Y?(Z=(0,L.jsxs)(`section`,{className:`rounded-xl bg-surface-hover/20 p-5`,children:[B,H,Y]}),t[71]=B,t[72]=H,t[73]=Y,t[74]=Z):Z=t[74];let se=i?`工作流`:`Workflows`,Q;t[75]===se?Q=t[76]:(Q=(0,L.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:se}),t[75]=se,t[76]=Q);let ce=i?`设置默认工作流,并决定智能体可以调用哪些工作流。`:`Set a default workflow and control which workflows agents may invoke.`,le;t[77]===ce?le=t[78]:(le=(0,L.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:ce}),t[77]=ce,t[78]=le);let ue=i?`默认工作流`:`Default workflow`,de;t[79]===ue?de=t[80]:(de=(0,L.jsx)(`label`,{className:`block text-xs font-medium text-fg-muted`,children:ue}),t[79]=ue,t[80]=de);let fe=n.workflows.default??``,pe=s.isLoading?i?`正在加载…`:`Loading…`:i?`不设置默认工作流`:`No default workflow`,me=i?`不设置默认工作流`:`No default workflow`,he=i?`默认工作流`:`Default workflow`,ge;t[81]!==n||t[82]!==r?(ge=e=>r({...n,workflows:{...n.workflows,default:e||void 0}}),t[81]=n,t[82]=r,t[83]=ge):ge=t[83];let _e;t[84]!==fe||t[85]!==pe||t[86]!==me||t[87]!==he||t[88]!==ge||t[89]!==u||t[90]!==s.isLoading?(_e=(0,L.jsx)(a,{value:fe,options:u,placeholder:pe,emptyLabel:me,disabled:s.isLoading,ariaLabel:he,onChange:ge,triggerClassName:`mt-2`}),t[84]=fe,t[85]=pe,t[86]=me,t[87]=he,t[88]=ge,t[89]=u,t[90]=s.isLoading,t[91]=_e):_e=t[91];let ve;t[92]!==de||t[93]!==_e?(ve=(0,L.jsxs)(`div`,{className:`mt-5 max-w-xl`,children:[de,_e]}),t[92]=de,t[93]=_e,t[94]=ve):ve=t[94];let ye;t[95]===s.error?ye=t[96]:(ye=s.error?(0,L.jsx)(`p`,{className:`mt-3 text-sm text-red-600`,children:s.error instanceof Error?s.error.message:String(s.error)}):null,t[95]=s.error,t[96]=ye);let be=i?`允许调用的工作流`:`Allowed workflows`,$;t[97]===be?$=t[98]:($=(0,L.jsx)(`h3`,{className:`text-sm font-medium text-fg`,children:be}),t[97]=be,t[98]=$);let xe;t[99]!==n||t[100]!==r?(xe=()=>r({...n,workflows:{...n.workflows,allowed:void 0}}),t[99]=n,t[100]=r,t[101]=xe):xe=t[101];let Se=f?`bg-accent-soft shadow-surface`:`hover:bg-surface-hover`,Ce;t[102]===Se?Ce=t[103]:(Ce=d(`rounded-xl bg-surface-base/55 p-4 text-left focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,Se),t[102]=Se,t[103]=Ce);let we=i?`允许全部工作流`:`Allow every workflow`,Te;t[104]===we?Te=t[105]:(Te=(0,L.jsx)(`span`,{className:`block text-sm font-medium text-fg`,children:we}),t[104]=we,t[105]=Te);let Ee=i?`新增工作流也会自动可用。`:`New workflows become available automatically.`,De;t[106]===Ee?De=t[107]:(De=(0,L.jsx)(`span`,{className:`mt-1 block text-xs text-fg-muted`,children:Ee}),t[106]=Ee,t[107]=De);let Oe;t[108]!==xe||t[109]!==Ce||t[110]!==Te||t[111]!==De?(Oe=(0,L.jsxs)(`button`,{type:`button`,onClick:xe,className:Ce,children:[Te,De]}),t[108]=xe,t[109]=Ce,t[110]=Te,t[111]=De,t[112]=Oe):Oe=t[112];let ke;t[113]!==n||t[114]!==r?(ke=()=>r({...n,workflows:{...n.workflows,allowed:[]}}),t[113]=n,t[114]=r,t[115]=ke):ke=t[115];let Ae=f?`hover:bg-surface-hover`:`bg-accent-soft shadow-surface`,je;t[116]===Ae?je=t[117]:(je=d(`rounded-xl bg-surface-base/55 p-4 text-left focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,Ae),t[116]=Ae,t[117]=je);let Me=i?`只允许选中的工作流`:`Allow selected workflows only`,Ne;t[118]===Me?Ne=t[119]:(Ne=(0,L.jsx)(`span`,{className:`block text-sm font-medium text-fg`,children:Me}),t[118]=Me,t[119]=Ne);let Pe=i?`未选中的工作流不能被调用。`:`Unselected workflows cannot be invoked.`,Fe;t[120]===Pe?Fe=t[121]:(Fe=(0,L.jsx)(`span`,{className:`mt-1 block text-xs text-fg-muted`,children:Pe}),t[120]=Pe,t[121]=Fe);let Ie;t[122]!==ke||t[123]!==je||t[124]!==Ne||t[125]!==Fe?(Ie=(0,L.jsxs)(`button`,{type:`button`,onClick:ke,className:je,children:[Ne,Fe]}),t[122]=ke,t[123]=je,t[124]=Ne,t[125]=Fe,t[126]=Ie):Ie=t[126];let Le;t[127]!==Oe||t[128]!==Ie?(Le=(0,L.jsxs)(`div`,{className:`mt-3 grid gap-3 sm:grid-cols-2`,children:[Oe,Ie]}),t[127]=Oe,t[128]=Ie,t[129]=Le):Le=t[129];let Re;t[130]!==f||t[131]!==n.workflows.allowed||t[132]!==g||t[133]!==s.data||t[134]!==s.isLoading||t[135]!==i?(Re=f?null:(0,L.jsxs)(`div`,{className:`mt-3 flex flex-col gap-1 rounded-xl bg-surface-base/45 p-1 [&>label]:rounded-lg [&>label]:bg-surface-panel/55`,children:[(s.data??[]).map(e=>(0,L.jsxs)(`label`,{className:`flex cursor-pointer items-start gap-3 px-4 py-3 hover:bg-surface-hover/60`,children:[(0,L.jsx)(`input`,{type:`checkbox`,checked:n.workflows.allowed?.includes(e.id)??!1,onChange:t=>g(e.id,t.target.checked),className:`mt-0.5 size-4 accent-[var(--color-accent)]`}),(0,L.jsxs)(`span`,{children:[(0,L.jsx)(`span`,{className:`block text-sm font-medium text-fg`,children:e.title||e.name}),e.description?(0,L.jsx)(`span`,{className:`mt-1 block text-xs text-fg-muted`,children:e.description}):null]})]},e.id)),(s.data??[]).length===0&&!s.isLoading?(0,L.jsx)(`p`,{className:`px-4 py-8 text-center text-sm text-fg-muted`,children:i?`还没有工作流。`:`No workflows yet.`}):null]}),t[130]=f,t[131]=n.workflows.allowed,t[132]=g,t[133]=s.data,t[134]=s.isLoading,t[135]=i,t[136]=Re):Re=t[136];let ze;t[137]!==$||t[138]!==Le||t[139]!==Re?(ze=(0,L.jsxs)(`div`,{className:`mt-6 rounded-xl bg-surface-base/45 p-4`,children:[$,Le,Re]}),t[137]=$,t[138]=Le,t[139]=Re,t[140]=ze):ze=t[140];let Be;t[141]!==Q||t[142]!==le||t[143]!==ve||t[144]!==ye||t[145]!==ze?(Be=(0,L.jsxs)(`section`,{className:`rounded-xl bg-surface-hover/20 p-5`,children:[Q,le,ve,ye,ze]}),t[141]=Q,t[142]=le,t[143]=ve,t[144]=ye,t[145]=ze,t[146]=Be):Be=t[146];let Ve;return t[147]!==z||t[148]!==Z||t[149]!==Be?(Ve=(0,L.jsxs)(`div`,{className:`space-y-5`,children:[z,Z,Be]}),t[147]=z,t[148]=Z,t[149]=Be,t[150]=Ve):Ve=t[150],Ve}function X(e){return{value:e.id,label:e.title||e.name}}function Z(e){return[...new Set(e)].sort()}var se=[{id:`core`,names:[`doc-coauthoring`,`define-task`,`find-skills`,`summarize`],en:`Core`,zh:`核心`},{id:`office`,names:[`doc-coauthoring`,`define-task`,`find-skills`,`summarize`,`docx`,`pdf`,`pptx`,`xlsx`],en:`Office`,zh:`办公成果`},{id:`local-app`,names:[`doc-coauthoring`,`define-task`,`find-skills`,`summarize`,`build-xopc-local-app`,`frontend-design`,`theme-factory`],en:`Local App`,zh:`本地应用`},{id:`developer`,names:[`doc-coauthoring`,`define-task`,`find-skills`,`summarize`,`diagnose`,`github`,`tdd`,`webapp-testing`],en:`Developer`,zh:`开发者`},{id:`desktop-pet`,names:[`doc-coauthoring`,`define-task`,`find-skills`,`summarize`,`hatch-pet`],en:`Desktop Pet`,zh:`桌面宠物`}];function Q(e){let t=(0,re.c)(115),{draft:n,setDraft:r,zh:i}=e,a;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(a={revalidateOnFocus:!1},t[0]=a):a=t[0];let{data:s,error:l,isLoading:u}=m(`agent-defaults-skills-catalog`,C,a),[f,p]=(0,I.useState)(``),h=n.skills.mode===`selected`?n.skills.include:n.skills.exclude;s?.catalog;let g;if(t[1]!==h||t[2]!==s?.catalog||t[3]!==f){let e=[...s?.catalog??[]],n=new Set(e.map(fe));for(let t of h)n.has(t)||e.push({name:t,description:``,enabled:!0});let r=f.trim().toLowerCase();g=e.filter(e=>!r||`${e.name} ${e.description}`.toLowerCase().includes(r)).sort(de),t[1]=h,t[2]=s?.catalog,t[3]=f,t[4]=g}else g=t[4];let _=g,v;t[5]!==n.skills.exclude||t[6]!==n.skills.include||t[7]!==n.skills.mode?(v=e=>n.skills.mode===`selected`?n.skills.include.includes(e):!n.skills.exclude.includes(e),t[5]=n.skills.exclude,t[6]=n.skills.include,t[7]=n.skills.mode,t[8]=v):v=t[8];let y=v,b;t[9]!==n||t[10]!==r?(b=e=>{if(n.skills.mode===`selected`){let t=n.skills.include.includes(e)?n.skills.include.filter(t=>t!==e):Z([...n.skills.include,e]);r({...n,skills:{mode:`selected`,include:t}});return}let t=n.skills.exclude.includes(e)?n.skills.exclude.filter(t=>t!==e):Z([...n.skills.exclude,e]);r({...n,skills:{mode:`all-enabled`,exclude:t}})},t[9]=n,t[10]=r,t[11]=b):b=t[11];let x=b,S;t[12]===s?.catalog?S=t[13]:(S=s?.catalog??[],t[12]=s?.catalog,t[13]=S);let T;if(t[14]!==y||t[15]!==S){let e;t[17]===y?e=t[18]:(e=e=>e.enabled&&y(e.name),t[17]=y,t[18]=e),T=S.filter(e),t[14]=y,t[15]=S,t[16]=T}else T=t[16];let E=T.length,D;t[19]!==s?.catalog||t[20]!==n||t[21]!==r?(D=e=>{let t=new Set((s?.catalog??[]).filter(ue).map(le));r({...n,skills:{mode:`selected`,include:Z(e.filter(e=>t.has(e)))}})},t[19]=s?.catalog,t[20]=n,t[21]=r,t[22]=D):D=t[22];let O=D,ee=i?`技能策略`:`Skill policy`,te;t[23]===ee?te=t[24]:(te=(0,L.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:ee}),t[23]=ee,t[24]=te);let ne=i?`决定所有智能体默认可以使用哪些技能。`:`Choose which skills every agent can discover and use by default.`,k;t[25]===ne?k=t[26]:(k=(0,L.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:ne}),t[25]=ne,t[26]=k);let A;t[27]!==n||t[28]!==r?(A=()=>r({...n,skills:{mode:`all-enabled`,exclude:[]}}),t[27]=n,t[28]=r,t[29]=A):A=t[29];let j=n.skills.mode===`all-enabled`?`bg-accent-soft shadow-surface`:`hover:bg-surface-hover`,M;t[30]===j?M=t[31]:(M=d(`flex items-start gap-3 rounded-xl bg-surface-base/55 p-4 text-left focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,j),t[30]=j,t[31]=M);let N;t[32]===Symbol.for(`react.memo_cache_sentinel`)?(N=(0,L.jsx)(o,{className:`mt-0.5 size-5 shrink-0 text-accent`}),t[32]=N):N=t[32];let P=i?`使用所有已启用技能`:`Use every enabled skill`,F;t[33]===P?F=t[34]:(F=(0,L.jsx)(`span`,{className:`block text-sm font-medium text-fg`,children:P}),t[33]=P,t[34]=F);let R=i?`适合需要完整目录的高级智能体;新增技能会自动加入。`:`For advanced agents that need the full catalog; newly enabled skills are added automatically.`,z;t[35]===R?z=t[36]:(z=(0,L.jsx)(`span`,{className:`mt-1 block text-xs leading-5 text-fg-muted`,children:R}),t[35]=R,t[36]=z);let ie;t[37]!==F||t[38]!==z?(ie=(0,L.jsxs)(`span`,{children:[F,z]}),t[37]=F,t[38]=z,t[39]=ie):ie=t[39];let B;t[40]!==A||t[41]!==M||t[42]!==ie?(B=(0,L.jsxs)(`button`,{type:`button`,onClick:A,className:M,children:[N,ie]}),t[40]=A,t[41]=M,t[42]=ie,t[43]=B):B=t[43];let V;t[44]!==n||t[45]!==r?(V=()=>r({...n,skills:{mode:`selected`,include:[]}}),t[44]=n,t[45]=r,t[46]=V):V=t[46];let H=n.skills.mode===`selected`?`bg-accent-soft shadow-surface`:`hover:bg-surface-hover`,U;t[47]===H?U=t[48]:(U=d(`flex items-start gap-3 rounded-xl bg-surface-base/55 p-4 text-left focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,H),t[47]=H,t[48]=U);let W;t[49]===Symbol.for(`react.memo_cache_sentinel`)?(W=(0,L.jsx)(w,{className:`mt-0.5 size-5 shrink-0 text-accent`}),t[49]=W):W=t[49];let ae=i?`只使用选中的技能`:`Use selected skills only`,G;t[50]===ae?G=t[51]:(G=(0,L.jsx)(`span`,{className:`block text-sm font-medium text-fg`,children:ae}),t[50]=ae,t[51]=G);let oe=i?`适合严格受控的环境;新增技能不会自动加入。`:`For tightly controlled environments; new skills are not added automatically.`,K;t[52]===oe?K=t[53]:(K=(0,L.jsx)(`span`,{className:`mt-1 block text-xs leading-5 text-fg-muted`,children:oe}),t[52]=oe,t[53]=K);let q;t[54]!==G||t[55]!==K?(q=(0,L.jsxs)(`span`,{children:[G,K]}),t[54]=G,t[55]=K,t[56]=q):q=t[56];let J;t[57]!==V||t[58]!==U||t[59]!==q?(J=(0,L.jsxs)(`button`,{type:`button`,onClick:V,className:U,children:[W,q]}),t[57]=V,t[58]=U,t[59]=q,t[60]=J):J=t[60];let Y;t[61]!==B||t[62]!==J?(Y=(0,L.jsxs)(`div`,{className:`mt-5 grid gap-3 sm:grid-cols-2`,children:[B,J]}),t[61]=B,t[62]=J,t[63]=Y):Y=t[63];let X=i?`能力组合(会替换当前选择)`:`Capability packs (replaces the current selection)`,Q;t[64]===X?Q=t[65]:(Q=(0,L.jsx)(`p`,{className:`text-xs font-medium text-fg-muted`,children:X}),t[64]=X,t[65]=Q);let pe;t[66]!==O||t[67]!==s||t[68]!==i?(pe=se.map(e=>(0,L.jsx)(`button`,{type:`button`,onClick:()=>O(e.names),disabled:!s,className:`rounded-lg border border-edge bg-surface-panel px-3 py-1.5 text-xs font-medium text-fg transition-colors hover:bg-surface-hover disabled:cursor-not-allowed disabled:opacity-50`,children:i?e.zh:e.en},e.id)),t[66]=O,t[67]=s,t[68]=i,t[69]=pe):pe=t[69];let me;t[70]===pe?me=t[71]:(me=(0,L.jsx)(`div`,{className:`mt-2 flex flex-wrap gap-2`,children:pe}),t[70]=pe,t[71]=me);let he;t[72]!==Q||t[73]!==me?(he=(0,L.jsxs)(`div`,{className:`mt-4`,children:[Q,me]}),t[72]=Q,t[73]=me,t[74]=he):he=t[74];let ge;t[75]!==k||t[76]!==Y||t[77]!==he||t[78]!==te?(ge=(0,L.jsxs)(`section`,{className:`rounded-xl bg-surface-hover/20 p-5`,children:[te,k,Y,he]}),t[75]=k,t[76]=Y,t[77]=he,t[78]=te,t[79]=ge):ge=t[79];let _e=n.skills.mode===`selected`?i?`选择可用技能`:`Select available skills`:i?`管理例外`:`Manage exceptions`,ve;t[80]===_e?ve=t[81]:(ve=(0,L.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:_e}),t[80]=_e,t[81]=ve);let ye=i?`当前默认可用 ${E} 个技能。`:`${E} skills are available by default.`,be;t[82]===ye?be=t[83]:(be=(0,L.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:ye}),t[82]=ye,t[83]=be);let $;t[84]!==ve||t[85]!==be?($=(0,L.jsxs)(`div`,{children:[ve,be]}),t[84]=ve,t[85]=be,t[86]=$):$=t[86];let xe=i?`搜索技能`:`Search skills`,Se;t[87]===xe?Se=t[88]:(Se=(0,L.jsx)(`span`,{className:`sr-only`,children:xe}),t[87]=xe,t[88]=Se);let Ce;t[89]===Symbol.for(`react.memo_cache_sentinel`)?(Ce=(0,L.jsx)(c,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-fg-subtle`}),t[89]=Ce):Ce=t[89];let we;t[90]===Symbol.for(`react.memo_cache_sentinel`)?(we=e=>p(e.target.value),t[90]=we):we=t[90];let Te=i?`搜索技能`:`Search skills`,Ee;t[91]!==f||t[92]!==Te?(Ee=(0,L.jsx)(`input`,{type:`search`,value:f,onChange:we,placeholder:Te,className:`w-full rounded-lg border border-edge bg-surface-panel py-2 pl-9 pr-3 text-sm text-fg outline-none focus:border-accent`}),t[91]=f,t[92]=Te,t[93]=Ee):Ee=t[93];let De;t[94]!==Se||t[95]!==Ee?(De=(0,L.jsxs)(`label`,{className:`relative block w-full sm:w-72`,children:[Se,Ce,Ee]}),t[94]=Se,t[95]=Ee,t[96]=De):De=t[96];let Oe;t[97]!==$||t[98]!==De?(Oe=(0,L.jsxs)(`div`,{className:`flex flex-wrap items-end justify-between gap-3`,children:[$,De]}),t[97]=$,t[98]=De,t[99]=Oe):Oe=t[99];let ke;t[100]===l?ke=t[101]:(ke=l?(0,L.jsx)(`p`,{className:`mt-4 rounded-lg bg-red-500/10 px-3 py-2 text-sm text-red-600`,children:l instanceof Error?l.message:String(l)}):null,t[100]=l,t[101]=ke);let Ae;t[102]!==y||t[103]!==u||t[104]!==_||t[105]!==x||t[106]!==i?(Ae=u?(0,L.jsx)(`div`,{className:`mt-4 space-y-2`,children:[0,1,2,3].map(ce)}):(0,L.jsxs)(`div`,{className:`mt-4 flex max-h-[32rem] flex-col gap-1 overflow-y-auto rounded-xl bg-surface-base/45 p-1 [&>label]:rounded-lg [&>label]:bg-surface-panel/55`,children:[_.map(e=>{let t=y(e.name);return(0,L.jsxs)(`label`,{className:d(`flex cursor-pointer items-start gap-3 px-4 py-3 hover:bg-surface-hover/60`,!e.enabled&&`cursor-not-allowed opacity-55`),children:[(0,L.jsx)(`input`,{type:`checkbox`,checked:t,disabled:!e.enabled,onChange:()=>x(e.name),className:`mt-0.5 size-4 rounded border-edge accent-[var(--color-accent)]`}),(0,L.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,L.jsxs)(`span`,{className:`flex flex-wrap items-center gap-2`,children:[(0,L.jsx)(`span`,{className:`text-sm font-medium text-fg`,children:e.name}),e.enabled?null:(0,L.jsx)(`span`,{className:`rounded-full bg-surface-hover px-2 py-0.5 text-[10px] text-fg-muted`,children:i?`全局未启用`:`Disabled globally`})]}),e.description?(0,L.jsx)(`span`,{className:`mt-1 block line-clamp-2 text-xs leading-5 text-fg-muted`,children:e.description}):null]})]},e.name)}),_.length===0?(0,L.jsx)(`p`,{className:`px-4 py-8 text-center text-sm text-fg-muted`,children:i?`没有匹配的技能。`:`No matching skills.`}):null]}),t[102]=y,t[103]=u,t[104]=_,t[105]=x,t[106]=i,t[107]=Ae):Ae=t[107];let je;t[108]!==Oe||t[109]!==ke||t[110]!==Ae?(je=(0,L.jsxs)(`section`,{className:`rounded-xl bg-surface-hover/20 p-5`,children:[Oe,ke,Ae]}),t[108]=Oe,t[109]=ke,t[110]=Ae,t[111]=je):je=t[111];let Me;return t[112]!==ge||t[113]!==je?(Me=(0,L.jsxs)(`div`,{className:`space-y-5`,children:[ge,je]}),t[112]=ge,t[113]=je,t[114]=Me):Me=t[114],Me}function ce(e){return(0,L.jsx)(y,{className:`h-14 rounded-xl`},e)}function le(e){return e.name}function ue(e){return e.enabled}function de(e,t){return e.name.localeCompare(t.name)}function fe(e){return e.name}function pe(e){let t=Number.parseInt(e,10);return Number.isFinite(t)&&t>0?t:void 0}function me(e){let t=(0,re.c)(92),{draft:n,setDraft:r,builtinTools:i,zh:a}=e,[o,s]=(0,I.useState)(``),[l,u]=(0,I.useState)(`all`),[f,p]=(0,I.useState)(),m;t[0]===i?m=t[1]:(m=new Map(i.map(_e)),t[0]=i,t[1]=m);let g=m,_;t[2]!==i||t[3]!==n.tools?(_=[...new Set([...i.map(ge),...Object.keys(n.tools)])].filter(he).sort(),t[2]=i,t[3]=n.tools,t[4]=_):_=t[4];let v=_,y;if(t[5]!==v||t[6]!==n.tools){let e;t[8]===n.tools?e=t[9]:(e=e=>(n.tools[e]?.mode??`allow`)===`allow`,t[8]=n.tools,t[9]=e),y=v.filter(e),t[5]=v,t[6]=n.tools,t[7]=y}else y=t[7];let b=y.length,x;if(t[10]!==v||t[11]!==n.tools){let e;t[13]===n.tools?e=t[14]:(e=e=>n.tools[e]?.mode===`ask`,t[13]=n.tools,t[14]=e),x=v.filter(e),t[10]=v,t[11]=n.tools,t[12]=x}else x=t[12];let S=x.length,C;if(t[15]!==v||t[16]!==n.tools){let e;t[18]===n.tools?e=t[19]:(e=e=>n.tools[e]?.mode===`deny`,t[18]=n.tools,t[19]=e),C=v.filter(e),t[15]=v,t[16]=n.tools,t[17]=C}else C=t[17];let w;t[20]!==y.length||t[21]!==x.length||t[22]!==C.length?(w={allow:b,ask:S,deny:C.length},t[20]=y.length,t[21]=x.length,t[22]=C.length,t[23]=w):w=t[23];let T=w,E;if(t[24]!==v||t[25]!==g||t[26]!==n.tools||t[27]!==l||t[28]!==o){let e=o.trim().toLowerCase();E=v.filter(t=>{let r=n.tools[t]?.mode??`allow`,i=g.get(t),a=`${t} ${i?.en??``} ${i?.zh??``}`.toLowerCase();return(!e||a.includes(e))&&(l===`all`||r===l)}),t[24]=v,t[25]=g,t[26]=n.tools,t[27]=l,t[28]=o,t[29]=E}else E=t[29];let D=E,O;t[30]!==n||t[31]!==r?(O=(e,t)=>{let i=n.tools[e]??{mode:`allow`};r({...n,tools:{...n.tools,[e]:{...i,...t}}})},t[30]=n,t[31]=r,t[32]=O):O=t[32];let ee=O,ne=a?`全部 ${v.length}`:`All ${v.length}`,k;t[33]===ne?k=t[34]:(k={id:`all`,label:ne},t[33]=ne,t[34]=k);let A=a?`允许 ${T.allow}`:`Allow ${T.allow}`,j;t[35]===A?j=t[36]:(j={id:`allow`,label:A},t[35]=A,t[36]=j);let M=a?`询问 ${T.ask}`:`Ask ${T.ask}`,N;t[37]===M?N=t[38]:(N={id:`ask`,label:M},t[37]=M,t[38]=N);let P=a?`禁用 ${T.deny}`:`Deny ${T.deny}`,F;t[39]===P?F=t[40]:(F={id:`deny`,label:P},t[39]=P,t[40]=F);let R;t[41]!==k||t[42]!==j||t[43]!==N||t[44]!==F?(R=[k,j,N,F],t[41]=k,t[42]=j,t[43]=N,t[44]=F,t[45]=R):R=t[45];let z=R,ie=a?`默认工具权限`:`Default tool permissions`,B;t[46]===ie?B=t[47]:(B=(0,L.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:ie}),t[46]=ie,t[47]=B);let V=a?`允许:直接执行;询问:执行前确认;禁用:智能体无法使用。`:`Allow runs directly, Ask requires confirmation, and Deny makes the tool unavailable.`,H;t[48]===V?H=t[49]:(H=(0,L.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:V}),t[48]=V,t[49]=H);let U;t[50]!==B||t[51]!==H?(U=(0,L.jsxs)(`div`,{children:[B,H]}),t[50]=B,t[51]=H,t[52]=U):U=t[52];let W;t[53]!==l||t[54]!==z?(W=(0,L.jsx)(`div`,{className:`flex flex-wrap gap-1 rounded-xl bg-surface-panel p-1`,children:z.map(e=>(0,L.jsx)(`button`,{type:`button`,onClick:()=>u(e.id),className:d(`rounded-lg px-3 py-1.5 text-xs font-medium`,l===e.id?`bg-surface-base text-fg shadow-surface`:`text-fg-muted hover:text-fg`),children:e.label},e.id))}),t[53]=l,t[54]=z,t[55]=W):W=t[55];let ae=a?`搜索工具`:`Search tools`,G;t[56]===ae?G=t[57]:(G=(0,L.jsx)(`span`,{className:`sr-only`,children:ae}),t[56]=ae,t[57]=G);let oe;t[58]===Symbol.for(`react.memo_cache_sentinel`)?(oe=(0,L.jsx)(c,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-fg-subtle`}),t[58]=oe):oe=t[58];let K;t[59]===Symbol.for(`react.memo_cache_sentinel`)?(K=e=>s(e.target.value),t[59]=K):K=t[59];let q=a?`搜索工具`:`Search tools`,J;t[60]!==o||t[61]!==q?(J=(0,L.jsx)(`input`,{type:`search`,value:o,onChange:K,placeholder:q,className:`w-full rounded-lg border border-edge bg-surface-panel py-2 pl-9 pr-3 text-sm text-fg outline-none focus:border-accent`}),t[60]=o,t[61]=q,t[62]=J):J=t[62];let Y;t[63]!==G||t[64]!==J?(Y=(0,L.jsxs)(`label`,{className:`relative block w-full sm:w-72`,children:[G,oe,J]}),t[63]=G,t[64]=J,t[65]=Y):Y=t[65];let X;t[66]!==W||t[67]!==Y?(X=(0,L.jsxs)(`div`,{className:`mt-5 flex flex-wrap items-center justify-between gap-3`,children:[W,Y]}),t[66]=W,t[67]=Y,t[68]=X):X=t[68];let Z;if(t[69]!==g||t[70]!==n.tools||t[71]!==f||t[72]!==ee||t[73]!==D||t[74]!==a){let e;t[76]!==g||t[77]!==n.tools||t[78]!==f||t[79]!==ee||t[80]!==a?(e=e=>{let t=n.tools[e]??{mode:`allow`},r=g.get(e),i=f===e;return(0,L.jsxs)(`div`,{className:`px-4 py-3`,children:[(0,L.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[(0,L.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,L.jsx)(`code`,{className:`text-xs font-medium text-fg`,children:e}),r?(0,L.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:a?r.zh:r.en}):null]}),(0,L.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,L.jsx)(`div`,{className:`flex rounded-lg bg-surface-base p-1`,children:[`allow`,`ask`,`deny`].map(n=>(0,L.jsx)(`button`,{type:`button`,onClick:()=>ee(e,{mode:n}),className:d(`rounded-md px-2.5 py-1 text-xs font-medium capitalize`,t.mode===n?`bg-accent text-on-accent`:`text-fg-muted hover:text-fg`),children:n===`allow`?a?`允许`:`Allow`:n===`ask`?a?`询问`:`Ask`:a?`禁用`:`Deny`},n))}),(0,L.jsx)(h,{variant:`ghost`,className:`px-2 py-1`,"aria-label":a?`${e} 调用限制`:`${e} call limits`,onClick:()=>p(i?void 0:e),children:(0,L.jsx)(te,{className:`size-4`})})]})]}),i?(0,L.jsxs)(`div`,{className:`mt-3 grid gap-3 rounded-lg bg-surface-base p-3 sm:grid-cols-2`,children:[(0,L.jsxs)(`label`,{className:`block text-xs font-medium text-fg-muted`,children:[a?`每轮最多调用次数`:`Maximum calls per turn`,(0,L.jsx)(`input`,{type:`number`,min:1,value:t.maxCallsPerTurn??``,placeholder:a?`不限制`:`Unlimited`,onChange:t=>ee(e,{maxCallsPerTurn:pe(t.target.value)}),className:`mt-2 w-full rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg outline-none focus:border-accent`})]}),(0,L.jsxs)(`label`,{className:`block text-xs font-medium text-fg-muted`,children:[a?`单次超时(毫秒)`:`Call timeout (ms)`,(0,L.jsx)(`input`,{type:`number`,min:1,value:t.timeoutMs??``,placeholder:a?`使用系统默认值`:`Use system default`,onChange:t=>ee(e,{timeoutMs:pe(t.target.value)}),className:`mt-2 w-full rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg outline-none focus:border-accent`})]})]}):null]},e)},t[76]=g,t[77]=n.tools,t[78]=f,t[79]=ee,t[80]=a,t[81]=e):e=t[81],Z=D.map(e),t[69]=g,t[70]=n.tools,t[71]=f,t[72]=ee,t[73]=D,t[74]=a,t[75]=Z}else Z=t[75];let se;t[82]!==D.length||t[83]!==a?(se=D.length===0?(0,L.jsx)(`p`,{className:`px-4 py-10 text-center text-sm text-fg-muted`,children:a?`没有匹配的工具。`:`No matching tools.`}):null,t[82]=D.length,t[83]=a,t[84]=se):se=t[84];let Q;t[85]!==Z||t[86]!==se?(Q=(0,L.jsxs)(`div`,{className:`mt-4 flex max-h-[38rem] flex-col gap-1 overflow-y-auto rounded-xl bg-surface-base/45 p-1 [&>*]:rounded-lg [&>*]:bg-surface-panel/55`,children:[Z,se]}),t[85]=Z,t[86]=se,t[87]=Q):Q=t[87];let ce;return t[88]!==U||t[89]!==X||t[90]!==Q?(ce=(0,L.jsxs)(`section`,{className:`rounded-xl bg-surface-hover/20 p-5`,children:[U,X,Q]}),t[88]=U,t[89]=X,t[90]=Q,t[91]=ce):ce=t[91],ce}function he(e){return e!==`computer_use`||b()}function ge(e){return e.id}function _e(e){return[e.id,e.description]}function ve(){let e=(0,re.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,L.jsxs)(j,{gap:`gap-5`,children:[(0,L.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,L.jsxs)(`div`,{className:`space-y-2`,children:[(0,L.jsx)(y,{className:`h-7 w-56`}),(0,L.jsx)(y,{className:`h-4 w-96 max-w-full`})]}),(0,L.jsx)(y,{className:`h-9 w-28`})]}),(0,L.jsx)(y,{className:`h-20 rounded-2xl`}),(0,L.jsx)(y,{className:`h-12 rounded-xl`}),(0,L.jsx)(y,{className:`h-72 rounded-2xl`})]}),e[0]=t):t=e[0],t}function ye(e){let t=(0,re.c)(67),{initial:n,builtinTools:r,zh:i}=e,[a,o]=(0,I.useState)(`models`),s;t[0]===n?s=t[1]:(s=()=>structuredClone(n),t[0]=n,t[1]=s);let[c,u]=(0,I.useState)(s),f;t[2]===n?f=t[3]:(f=()=>structuredClone(n),t[2]=n,t[3]=f);let[p,m]=(0,I.useState)(f),g;t[4]===c?g=t[5]:(g=JSON.stringify(c),t[4]=c,t[5]=g);let _;t[6]===p?_=t[7]:(_=JSON.stringify(p),t[6]=p,t[7]=_);let v=g!==_,y=i?`模型`:`Models`,b;t[8]===y?b=t[9]:(b={id:`models`,label:y,icon:l},t[8]=y,t[9]=b);let S=i?`技能`:`Skills`,C;t[10]===S?C=t[11]:(C={id:`skills`,label:S,icon:ne},t[10]=S,t[11]=C);let w=i?`工具`:`Tools`,T;t[12]===w?T=t[13]:(T={id:`tools`,label:w,icon:x},t[12]=w,t[13]=T);let E=i?`运行`:`Runtime`,D;t[14]===E?D=t[15]:(D={id:`runtime`,label:E,icon:k},t[14]=E,t[15]=D);let ee;t[16]!==T||t[17]!==D||t[18]!==b||t[19]!==C?(ee=[b,C,T,D],t[16]=T,t[17]=D,t[18]=b,t[19]=C,t[20]=ee):ee=t[20];let te=ee,P;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(P=async e=>{let t=structuredClone(e),n=await O(t),r=structuredClone(n.defaults);u(e=>JSON.stringify(e)===JSON.stringify(t)?r:e),m(structuredClone(r))},t[21]=P):P=t[21];let F=P,R;t[22]!==v||t[23]!==c?(R={value:c,dirty:v,onSave:F,delayMs:0},t[22]=v,t[23]=c,t[24]=R):R=t[24];let z=N(R),ie=z.onBlurCapture,B=i?`智能体设置`:`Agent settings`,V;t[25]!==z.error||t[26]!==z.status?(V=(0,L.jsx)(M,{status:z.status,error:z.error}),t[25]=z.error,t[26]=z.status,t[27]=V):V=t[27];let H;t[28]!==B||t[29]!==V?(H=(0,L.jsx)(A,{title:B,actions:V}),t[28]=B,t[29]=V,t[30]=H):H=t[30];let U;t[31]!==z.error||t[32]!==z.retry||t[33]!==i?(U=z.error?(0,L.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2 rounded-xl bg-red-500/10 px-3 py-2 text-sm text-red-600`,children:[(0,L.jsx)(`span`,{children:z.error}),(0,L.jsx)(h,{type:`button`,variant:`ghost`,className:`h-8 text-red-600`,onClick:z.retry,children:i?`重试`:`Retry`})]}):null,t[31]=z.error,t[32]=z.retry,t[33]=i,t[34]=U):U=t[34];let W=i?`默认配置分区`:`Default configuration sections`,ae;t[35]!==a||t[36]!==te?(ae=te.map(e=>{let{id:t,label:n,icon:r}=e;return(0,L.jsxs)(`button`,{type:`button`,"aria-pressed":a===t,onClick:()=>o(t),className:d(`flex min-w-0 items-center justify-center gap-2 rounded-lg px-3 py-2.5 text-left transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,a===t?`bg-surface-base text-fg shadow-surface`:`text-fg-muted hover:bg-surface-hover hover:text-fg`),children:[(0,L.jsx)(r,{className:d(`size-4 shrink-0`,a===t?`text-accent`:`text-fg-subtle`)}),(0,L.jsx)(`span`,{className:`text-sm font-medium`,children:n})]},t)}),t[35]=a,t[36]=te,t[37]=ae):ae=t[37];let G;t[38]!==W||t[39]!==ae?(G=(0,L.jsx)(`nav`,{className:`grid grid-cols-2 gap-1 rounded-xl bg-surface-hover/20 p-1 lg:grid-cols-4`,"aria-label":W,children:ae}),t[38]=W,t[39]=ae,t[40]=G):G=t[40];let K;t[41]!==a||t[42]!==c||t[43]!==i?(K=a===`models`?(0,L.jsx)(oe,{draft:c,setDraft:u,zh:i}):null,t[41]=a,t[42]=c,t[43]=i,t[44]=K):K=t[44];let q;t[45]!==a||t[46]!==c||t[47]!==i?(q=a===`skills`?(0,L.jsx)(Q,{draft:c,setDraft:u,zh:i}):null,t[45]=a,t[46]=c,t[47]=i,t[48]=q):q=t[48];let J;t[49]!==a||t[50]!==r||t[51]!==c||t[52]!==i?(J=a===`tools`?(0,L.jsx)(me,{draft:c,setDraft:u,builtinTools:r,zh:i}):null,t[49]=a,t[50]=r,t[51]=c,t[52]=i,t[53]=J):J=t[53];let X;t[54]!==a||t[55]!==c||t[56]!==i?(X=a===`runtime`?(0,L.jsx)(Y,{draft:c,setDraft:u,zh:i}):null,t[54]=a,t[55]=c,t[56]=i,t[57]=X):X=t[57];let Z;return t[58]!==z.onBlurCapture||t[59]!==H||t[60]!==U||t[61]!==G||t[62]!==K||t[63]!==q||t[64]!==J||t[65]!==X?(Z=(0,L.jsxs)(j,{gap:`gap-5`,onBlurCapture:ie,children:[H,U,G,K,q,J,X]}),t[58]=z.onBlurCapture,t[59]=H,t[60]=U,t[61]=G,t[62]=K,t[63]=q,t[64]=J,t[65]=X,t[66]=Z):Z=t[66],Z}function be(){let e=(0,re.c)(17),t=f(xe),n=p($)===`zh`,{data:r,error:i,isLoading:a,mutate:o}=m(t?`settings-agent-defaults`:null,T);if(!t){let t=n?`需要本机服务令牌。`:`Local service token required.`,r;return e[0]===t?r=e[1]:(r=(0,L.jsx)(j,{children:(0,L.jsx)(`p`,{className:`text-sm text-fg-muted`,children:t})}),e[0]=t,e[1]=r),r}if(i&&!r){let t=String(i),r;e[2]===t?r=e[3]:(r=(0,L.jsx)(`p`,{className:`rounded-xl bg-red-500/10 px-3 py-2 text-sm text-red-600`,children:t}),e[2]=t,e[3]=r);let a;e[4]===o?a=e[5]:(a=()=>void o(),e[4]=o,e[5]=a);let s=n?`重试`:`Retry`,c;e[6]!==a||e[7]!==s?(c=(0,L.jsx)(h,{onClick:a,children:s}),e[6]=a,e[7]=s,e[8]=c):c=e[8];let l;return e[9]!==r||e[10]!==c?(l=(0,L.jsxs)(j,{children:[r,c]}),e[9]=r,e[10]=c,e[11]=l):l=e[11],l}if(a||!r){let t;return e[12]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,L.jsx)(ve,{}),e[12]=t):t=e[12],t}let s;return e[13]!==r.builtinTools||e[14]!==r.defaults||e[15]!==n?(s=(0,L.jsx)(ye,{initial:r.defaults,builtinTools:r.builtinTools,zh:n}),e[13]=r.builtinTools,e[14]=r.defaults,e[15]=n,e[16]=s):s=e[16],s}function $(e){return e.language}function xe(e){return e.conversationId}export{be as AgentDefaultsSettingsPanel};
@@ -1 +1 @@
1
- import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,t as n}from"./vendor-react-BOUWij0V.js";import{t as r}from"./chunk-KS7C4IRE-BMYIfy9x.js";import{t as i}from"./circle-check-C23XjkUj.js";import{t as a}from"./folder-open-CyzJ19I9.js";import{t as o}from"./loader-circle-CifKLtgG.js";import{t as s}from"./messages-D8PmAUB-.js";import{t as c}from"./cn-JdwAhgNB.js";import{a as l,i as u,n as ee,r as d}from"./locale-store-DodizOrj.js";import{a as f,i as te,o as p,r as ne,s as re,t as m}from"./dist-BGTk37IG.js";import{a as ie}from"./vendor-swr-BIWyz7Rc.js";import{t as h}from"./button-CS04eWY9.js";import{n as g}from"./gateway-config-swr-Da3Oob_s.js";import{t as _}from"./skeleton-BwbyijEw.js";import{At as v,Do as y,Ot as b,Xs as ae,_c as x,io as oe,kt as S,ni as se}from"./index-DOFuObNM.js";var C=e(t(),1),w=/^([^:=]+)[:=](.*)$/;function T(e){let t=e.trim();if(!t)return null;try{let e=JSON.parse(t);if(e&&typeof e==`object`&&!Array.isArray(e))return Object.entries(e).map(([e,t])=>({key:e,value:t==null?``:String(t)}))}catch{}let n=[];for(let e of t.split(/\r?\n/)){let t=e.trim();if(!t)continue;let r=w.exec(t);r&&n.push({key:r[1].trim(),value:r[2].trim()})}return n.length>0?n:null}function E(e){let t={};for(let n of e){let e=n.key.trim();e&&(t[e]=n.value)}return Object.keys(t).length>0?t:void 0}function D(e){if(!e||typeof e!=`object`)return[{key:``,value:``}];let t=Object.entries(e).map(([e,t])=>({key:e,value:t==null?``:String(t)}));return t.length>0?t:[{key:``,value:``}]}function O(e){if(!e||typeof e!=`object`||Array.isArray(e))return!1;let t=e.xopcConnector;return!!(t&&typeof t==`object`&&!Array.isArray(t)&&t.managed===!0)}function k(e){let t=e&&typeof e==`object`&&`mcp`in e?e.mcp:void 0,n=(t&&typeof t==`object`?t:{}).servers,r={};if(!n||typeof n!=`object`||Array.isArray(n))return r;for(let[e,t]of Object.entries(n))!t||typeof t!=`object`||Array.isArray(t)||O(t)&&(r[e]=t);return r}function A(e){let t=e.trim();if(t)return t.split(/\s+/).filter(Boolean)}function j(e){let t=e.trim();if(!t)return;let n=JSON.parse(t);if(!n||typeof n!=`object`||Array.isArray(n))throw Error(`Expected a JSON object`);return n}function M(e){if(e.transport===`stdio`){let t={command:e.command.trim()},n=A(e.argsText);return n?.length&&(t.args=n),e.cwd.trim()&&(t.cwd=e.cwd.trim()),e.envJson.trim()&&(t.env=j(e.envJson)),e.connectionTimeoutMs!=null&&Number.isFinite(e.connectionTimeoutMs)&&(t.connectionTimeoutMs=e.connectionTimeoutMs),e.requestTimeoutMs!=null&&Number.isFinite(e.requestTimeoutMs)&&(t.requestTimeoutMs=e.requestTimeoutMs),t}let t={url:e.url.trim(),transport:e.transport},n=E(e.headers);return n&&(t.headers=n),e.transport===`streamable-http`&&e.auth===`oauth`&&(t.auth={type:`oauth`,...e.oauthClientId.trim()?{clientId:e.oauthClientId.trim()}:{}}),e.connectionTimeoutMs!=null&&Number.isFinite(e.connectionTimeoutMs)&&(t.connectionTimeoutMs=e.connectionTimeoutMs),e.requestTimeoutMs!=null&&Number.isFinite(e.requestTimeoutMs)&&(t.requestTimeoutMs=e.requestTimeoutMs),t}function ce(e,t){let n=typeof t.url==`string`&&t.url.trim().length>0,r=typeof t.transport==`string`?t.transport.trim().toLowerCase():``,i=n?r===`sse`?`sse`:`streamable-http`:`stdio`,a=t.headers&&typeof t.headers==`object`&&!Array.isArray(t.headers)?t.headers:void 0,o=t.auth&&typeof t.auth==`object`&&!Array.isArray(t.auth)?t.auth:void 0,s=o?.type===`oauth`?`oauth`:`none`;return{clientKey:e,id:e,transport:i,command:typeof t.command==`string`?t.command:``,argsText:Array.isArray(t.args)?t.args.map(String).join(` `):``,envJson:t.env&&typeof t.env==`object`?JSON.stringify(t.env,null,2):``,cwd:typeof t.cwd==`string`?t.cwd:typeof t.workingDirectory==`string`?t.workingDirectory:``,url:typeof t.url==`string`?t.url:``,headers:D(a),auth:s,oauthClientId:typeof o?.clientId==`string`?o.clientId:``,connectionTimeoutMs:typeof t.connectionTimeoutMs==`number`&&Number.isFinite(t.connectionTimeoutMs)?t.connectionTimeoutMs:void 0,requestTimeoutMs:typeof t.requestTimeoutMs==`number`&&Number.isFinite(t.requestTimeoutMs)?t.requestTimeoutMs:void 0}}function N(e=``){return{clientKey:crypto.randomUUID(),id:e,transport:`stdio`,command:``,argsText:``,envJson:``,cwd:``,url:``,headers:[{key:`Authorization`,value:``}],auth:`none`,oauthClientId:``,connectionTimeoutMs:void 0,requestTimeoutMs:void 0}}function P(e){let t=e&&typeof e==`object`&&`mcp`in e?e.mcp:void 0,n=t&&typeof t==`object`?t:{},r=n.servers,i=r&&typeof r==`object`&&!Array.isArray(r)?Object.entries(r).flatMap(([e,t])=>!t||typeof t!=`object`||Array.isArray(t)||O(t)?[]:[ce(e,t)]).sort((e,t)=>e.id.localeCompare(t.id)):[],a=typeof n.sessionIdleTtlMs==`number`?n.sessionIdleTtlMs:void 0;return{sessionIdleTtlMinutes:a==null?void 0:a===0?0:Math.round(a/6e4),servers:i}}function le(e){return M(e)}async function F(e,t={}){let n={};for(let r of e.servers){let e=r.id.trim();if(e){if(t[e])throw Error(`Server id "${e}" is reserved by an installed connector.`);n[e]=M(r)}}let r={servers:{...t,...n}};e.sessionIdleTtlMinutes!=null&&Number.isFinite(e.sessionIdleTtlMinutes)&&(r.sessionIdleTtlMs=e.sessionIdleTtlMinutes===0?0:Math.round(e.sessionIdleTtlMinutes*6e4)),await l(d(`/api/config`),{method:`PATCH`,body:JSON.stringify({mcp:r})}),g()}async function I(e,t,n=``){let r=await l(d(`/api/mcp/servers/${encodeURIComponent(e)}/oauth${n}`),{method:t});if(!r.payload)throw Error(r.error??`MCP OAuth request failed`);return r.payload}function L(e){return I(e,`GET`)}function ue(e){return I(e,`POST`,`/start`)}function R(e){return I(e,`DELETE`)}function z(e){if(!Array.isArray(e))return[];let t=[];for(let n of e){if(!n||typeof n!=`object`)continue;let e=n;if(typeof e.name!=`string`)continue;let r=e.name.trim();if(!r)continue;let i=typeof e.shortName==`string`&&e.shortName.trim()?e.shortName.trim():void 0,a=typeof e.description==`string`&&e.description.trim()?e.description.trim():void 0;t.push({name:r,shortName:i,description:a})}return t}function de(e){if(!Array.isArray(e))return[];let t=[];for(let n of e){if(!n||typeof n!=`object`)continue;let e=n;if(typeof e.uri!=`string`||typeof e.name!=`string`)continue;let r=e.uri.trim(),i=e.name.trim();!r||!i||t.push({uri:r,name:i,title:typeof e.title==`string`&&e.title.trim()?e.title.trim():void 0,description:typeof e.description==`string`&&e.description.trim()?e.description.trim():void 0,mimeType:typeof e.mimeType==`string`&&e.mimeType.trim()?e.mimeType.trim():void 0})}return t}function B(e){if(!Array.isArray(e))return[];let t=[];for(let n of e){if(!n||typeof n!=`object`)continue;let e=n;if(typeof e.name!=`string`)continue;let r=e.name.trim();r&&t.push({name:r,title:typeof e.title==`string`&&e.title.trim()?e.title.trim():void 0,description:typeof e.description==`string`&&e.description.trim()?e.description.trim():void 0,argumentCount:typeof e.argumentCount==`number`?e.argumentCount:0})}return t}async function V(e,t){let n=await l(d(`/api/mcp/servers/${encodeURIComponent(e)}/test`),{method:`POST`,body:t?JSON.stringify({server:t}):void 0});if(!n.payload)throw Error(n.error??`MCP test failed`);let r=z(n.payload.tools),i=de(n.payload.resources),a=B(n.payload.prompts);return{serverId:n.payload.serverId??e,toolCount:typeof n.payload.toolCount==`number`?n.payload.toolCount:r.length,resourceCount:typeof n.payload.resourceCount==`number`?n.payload.resourceCount:i.length,promptCount:typeof n.payload.promptCount==`number`?n.payload.promptCount:a.length,tools:r,resources:i,prompts:a}}function fe(e){return e.connectionTimeoutMs==null||!Number.isFinite(e.connectionTimeoutMs)?``:String(Math.round(e.connectionTimeoutMs/1e3))}function pe(e){let t=e.trim();if(!t)return;let n=Number.parseInt(t,10);if(!(!Number.isFinite(n)||n<1||n>600))return n*1e3}function me(e){return e.requestTimeoutMs==null||!Number.isFinite(e.requestTimeoutMs)?``:String(Math.round(e.requestTimeoutMs/1e3))}function H(e){let t=e.trim();if(!t)return;let n=Number.parseInt(t,10);if(!(!Number.isFinite(n)||n<1||n>14400))return n*1e3}var U=n(),W=`w-full rounded-lg border border-edge bg-surface-inset px-3 py-2 text-sm text-fg`;function he(e,t){if(e.startsWith(`content.skills:`)){let n=e.slice(15);return t?`提供技能:${n}`:`Add skill: ${n}`}if(e.startsWith(`runtime.mcp.stdio:`)){let n=e.slice(18).split(`:`,1)[0];return t?`在本机运行工具服务:${n}`:`Run a local tool service: ${n}`}if(e.startsWith(`network.mcp:`)){let n=e.slice(12).split(`:`,1)[0];return t?`连接外部工具服务:${n}`:`Connect to an external tool service: ${n}`}return e}function ge(e,t){return t?.publisher?.verification!==`verified`||t.latestVersion.riskTier&&t.latestVersion.riskTier!==`content`?!0:e.addedCapabilities.some(e=>!e.startsWith(`content.skills:`))}async function G(e,t,n){let r=await l(d(e),{method:t,...n===void 0?{}:{body:JSON.stringify(n)}});if(!r.ok)throw Error(r.error??`Request failed`);return r.payload}function _e({pluginId:e,server:t,enabled:n}){let{mutate:r}=ie(),i=ee(e=>e.language).startsWith(`zh`),[a,o]=(0,C.useState)(!1),[s,c]=(0,C.useState)(null),[l,f]=(0,C.useState)(``),[te,p]=(0,C.useState)(!1),[ne,re]=(0,C.useState)(!1),[m,g]=(0,C.useState)(``),[y,ae]=(0,C.useState)(t.type===`stdio`?`API_KEY`:`Authorization`),[x,oe]=(0,C.useState)(t.type===`stdio`?``:`Bearer `),[se,w]=(0,C.useState)(!1),[T,E]=(0,C.useState)(``),D=`/api/mcp/servers/${encodeURIComponent(t.id)}`;async function O(){let e=await u(d(`${D}/test`),{method:`POST`,body:`{}`}),t=await e.json();if(r(`gateway-extensions-list`),p(t.code===`MCP_AUTHORIZATION_REQUIRED`),!e.ok||!t.ok)throw Error(t.error??`Connection failed`);f(i?`连接成功 · ${t.payload.toolCount} 个工具`:`Connected · ${t.payload.toolCount} tools`)}(0,C.useEffect)(()=>{if(!n||t.type!==`streamable-http`)return;let e=!1;return L(t.id).then(t=>{e||(c(t),w(!0))}).catch(t=>{e||(f(String(t)),w(!0))}),()=>{e=!0}},[n,t.id,t.type]),(0,C.useEffect)(()=>{if(s?.status!==`authorizing`)return;let e=!1,n=window.setInterval(()=>{L(t.id).then(t=>{e||(c(t),t.status===`connected`&&(p(!1),f(i?`已连接,可以重试原任务`:`Connected. Retry your task.`),r(`gateway-extensions-list`)),t.status===`error`&&f(t.session?.error??`Authorization failed`))}).catch(t=>{e||f(String(t))})},1500);return()=>{e=!0,window.clearInterval(n)}},[s?.status,t.id,i,r]);async function k(e){o(!0),f(``);try{await e()}catch(e){f(e instanceof Error?e.message:String(e))}finally{o(!1)}}return(0,U.jsxs)(`div`,{className:`rounded-lg border border-edge p-3 text-sm`,children:[(0,U.jsxs)(`div`,{className:`mb-2 flex flex-wrap items-center gap-2`,children:[(0,U.jsx)(`span`,{className:`font-medium`,children:t.name}),(0,U.jsxs)(`span`,{className:`text-xs text-fg-muted`,children:[e,` · `,t.type]})]}),n?(0,U.jsxs)(U.Fragment,{children:[t.type===`streamable-http`&&!se?(0,U.jsx)(_,{className:`mb-2 h-4 w-24`}):null,(0,U.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,U.jsx)(h,{variant:`secondary`,disabled:a,onClick:()=>void k(O),children:i?`测试连接`:`Test connection`}),t.type===`streamable-http`&&s?.status!==`connected`?(0,U.jsx)(h,{variant:te?`primary`:`secondary`,disabled:a,onClick:()=>{let e=v();k(async()=>{try{let n=await ue(t.id);if(c(n),n.session?.authorizationUrl){if(!await S(n.session.authorizationUrl,e))throw Error(i?`无法打开授权页面`:`Could not open authorization page`)}else if(b(e),n.session?.error)throw Error(n.session.error)}catch(t){throw b(e),t}})},children:i?`连接账号`:`Connect account`}):null,s?.status===`connected`?(0,U.jsx)(h,{variant:`secondary`,disabled:a,onClick:()=>void k(async()=>{c(await R(t.id)),r(`gateway-extensions-list`)}),children:i?`断开连接`:`Disconnect`}):null,(0,U.jsx)(h,{variant:`ghost`,disabled:a,onClick:()=>re(!ne),children:i?`设置密钥`:`Set API key`})]}),ne?(0,U.jsxs)(`form`,{className:`mt-3 space-y-2`,onSubmit:n=>{n.preventDefault(),k(async()=>{await G(`/api/extensions/agent-plugins/${encodeURIComponent(e)}/mcp/${encodeURIComponent(t.name)}/auth`,`PUT`,{mode:`api-key`,secrets:[{target:t.type===`stdio`?`env`:`headers`,key:y,value:m,prefix:x}]}),g(``),re(!1),c(null),p(!1),await O()})},children:[(0,U.jsxs)(`label`,{className:`block`,children:[i?`字段名`:`Field name`,(0,U.jsx)(`input`,{className:W,value:y,onChange:e=>ae(e.target.value),required:!0})]}),(0,U.jsxs)(`label`,{className:`block`,children:[i?`前缀(可选)`:`Prefix (optional)`,(0,U.jsx)(`input`,{className:W,value:x,onChange:e=>oe(e.target.value)})]}),(0,U.jsxs)(`label`,{className:`block`,children:[i?`密钥`:`Secret`,(0,U.jsx)(`input`,{className:W,type:`password`,autoComplete:`off`,value:m,onChange:e=>g(e.target.value),required:!0})]}),(0,U.jsx)(h,{type:`submit`,disabled:a||!m,children:i?`保存并测试`:`Save and test`})]}):null]}):(0,U.jsx)(`p`,{className:`text-fg-muted`,children:i?`启用插件后连接服务`:`Enable the plugin to connect`}),s?.status===`authorizing`?(0,U.jsxs)(`div`,{className:`mt-2 space-y-2 text-fg-muted`,children:[(0,U.jsx)(`p`,{children:i?`请在浏览器完成授权`:`Complete authorization in your browser`}),(0,U.jsxs)(`details`,{children:[(0,U.jsx)(`summary`,{children:i?`使用远程 Gateway?`:`Using a remote Gateway?`}),(0,U.jsxs)(`form`,{className:`mt-2 space-y-2`,onSubmit:e=>{e.preventDefault(),k(async()=>{c(await G(`${D}/oauth/callback`,`POST`,{callbackUrl:T})),E(``)})},children:[(0,U.jsxs)(`label`,{children:[i?`如果浏览器跳转后无法连接,请粘贴地址栏中的完整回调 URL`:`If the browser cannot reach the callback, paste its full address-bar URL`,(0,U.jsx)(`input`,{type:`password`,autoComplete:`off`,className:W,value:T,onChange:e=>E(e.target.value)})]}),(0,U.jsx)(h,{type:`submit`,disabled:a||!T,children:i?`完成连接`:`Complete connection`})]})]})]}):null,l?(0,U.jsx)(`p`,{role:`status`,className:`mt-2 break-words text-fg-muted`,children:l}):null]})}function K({extension:e,onClose:t,initialSource:n=``,marketplace:l,autoInstall:u=!1}){let d=ee(e=>e.language),g=d.startsWith(`zh`),_=l?.localizations?.[g?`zh-CN`:`en`],v=_?.displayName??l?.name,b=_?.description??l?.description,S=(0,C.useId)(),{mutate:w}=ie(),[T,E]=(0,C.useState)(e),[D,O]=(0,C.useState)(n),[k,A]=(0,C.useState)(null),[j,M]=(0,C.useState)(!1),[ce,N]=(0,C.useState)(``),[P,le]=(0,C.useState)(!1),[F,I]=(0,C.useState)(!1),[L,ue]=(0,C.useState)(!1),[R,z]=(0,C.useState)(!1),[de,B]=(0,C.useState)(!1),[V,fe]=(0,C.useState)(!1),[pe,me]=(0,C.useState)(!1),H=(0,C.useRef)(!1),K=`/api/extensions/agent-plugins/${encodeURIComponent(T?.pluginId??``)}`,q=D.trim().startsWith(`store:`),J=()=>w(`gateway-extensions-list`);async function Y(e){M(!0),N(``);try{await e()}catch(e){N(e instanceof Error?e.message:String(e))}finally{M(!1)}}function X(e){O(e),A(null),N(``)}let Z=typeof window<`u`?window.electronAPI?.file:void 0,Q=/^(?:\/|[A-Za-z]:[\\/])/.test(D.trim())?D.trim():void 0;async function ve(){if(!Z?.openDirectory){B(!0);return}let e=await Z.openDirectory(Q?{defaultPath:Q}:void 0);e&&X(e)}async function ye(){if(!Z?.openFile){B(!0);return}let e=await Z.openFile({...Q?{defaultPath:Q}:{},extensions:[`zip`]});e&&X(e)}function be(e){return[...e.dataTransfer.types].some(e=>e===`Files`||e===`text/plain`||e===`text/uri-list`)}function xe(e){if(!be(e))return;e.preventDefault(),z(!1);let t=Array.from(e.dataTransfer.files);if(t.length){if(t.length>1){N(g?`一次只能选择一个插件目录或 ZIP。`:`Choose one plugin directory or ZIP at a time.`);return}let e=Z?.getPathForFile?.(t[0]);e?X(e):N(g?`浏览器无法读取本机文件路径,请使用“选择文件或目录”选择安装包。`:`The browser cannot read local file paths. Use Choose file or folder to select the package.`);return}let n=e.dataTransfer.getData(`text/uri-list`)||e.dataTransfer.getData(`text/plain`);n.trim()&&X(n.trim().split(/\r?\n/)[0])}async function Se(e){E(await G(`${K}/activation`,`POST`,{enabled:e})),await J()}async function Ce(e){let t=!T,n=await G(t?`/api/extensions/install`:`${K}/update`,`POST`,{source:D,reviewHash:e.reviewHash});E(n),await J(),t&&!n.activationEligible&&n.readiness!==`blocked`&&n.pluginId&&(n=await G(`/api/extensions/agent-plugins/${encodeURIComponent(n.pluginId)}/activation`,`POST`,{enabled:!0}),E(n),await J()),A(null),me(t&&n.activationEligible===!0)}async function we(){let e=await G(`/api/extensions/inspect`,`POST`,{source:D});if(ge(e,l)){A(e);return}await Ce(e)}(0,C.useEffect)(()=>{e&&E(e)},[e]),(0,C.useEffect)(()=>{!u||T||!q||H.current||(H.current=!0,Y(we))},[u,T,q]);let Te=u&&!T&&q&&!H.current,$=T?.components;return(0,U.jsx)(m,{defaultOpen:!0,onOpenChange:e=>!e&&t(),children:(0,U.jsxs)(p,{children:[(0,U.jsx)(f,{className:`fixed inset-0 z-[130] bg-scrim`}),(0,U.jsxs)(ne,{className:`fixed left-1/2 top-1/2 z-[131] flex h-[min(76vh,30rem)] w-[min(34rem,calc(100vw-1.5rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-overlay shadow-popover`,children:[(0,U.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between border-b border-edge p-4`,children:[(0,U.jsx)(re,{className:`font-semibold`,children:T?.name??v??(g?`安装 Agent Plugin`:`Install Agent Plugin`)}),(0,U.jsx)(h,{variant:`ghost`,onClick:t,children:g?`关闭`:`Close`})]}),(0,U.jsx)(te,{className:`sr-only`,children:g?`安装、组件、账号连接和权限`:`Installation, components, connections and permissions`}),(0,U.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-4 overflow-y-auto p-4`,children:[!T&&q?(0,U.jsxs)(`section`,{className:`space-y-4`,children:[(0,U.jsxs)(`div`,{className:`flex items-start gap-3 rounded-xl border border-edge bg-surface-base p-4`,children:[(0,U.jsx)(y,{className:`mt-0.5 size-5 shrink-0 text-emerald-600 dark:text-emerald-400`,"aria-hidden":!0}),(0,U.jsxs)(`div`,{className:`min-w-0`,children:[(0,U.jsx)(`p`,{className:`font-medium text-fg`,children:v??k?.manifest.name??D.slice(6)}),b?(0,U.jsx)(`p`,{className:`mt-1 text-sm leading-relaxed text-fg-muted`,children:b}):null,(0,U.jsx)(`p`,{className:`mt-2 text-xs text-fg-muted`,children:l?.publisher?.verification===`verified`?g?`已认证发布者 · 安装后自动启用`:`Verified publisher · enabled automatically after installation`:g?`安装前会检查来源和所需权限`:`Source and required permissions are checked before installation`})]})]}),k?null:(0,U.jsxs)(h,{className:`w-full`,disabled:j||Te,onClick:()=>void Y(we),children:[j||Te?(0,U.jsx)(o,{className:`size-4 animate-spin`,"aria-hidden":!0}):null,j||Te?g?`正在安全检查并安装…`:`Checking and installing…`:g?`一键安装`:`Install`]})]}):null,T?(0,U.jsxs)(U.Fragment,{children:[pe?(0,U.jsxs)(`div`,{role:`status`,className:`flex items-start gap-3 rounded-lg border border-emerald-500/25 bg-emerald-500/10 p-4`,children:[(0,U.jsx)(i,{className:`mt-0.5 size-5 shrink-0 text-emerald-600 dark:text-emerald-400`,"aria-hidden":!0}),(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`p`,{className:`font-medium text-fg`,children:g?`插件已安装并启用`:`Plugin installed and enabled`}),(0,U.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:g?`现在可以直接在对话中使用它。`:`It is ready to use in your conversations.`})]})]}):null,T.activationEligible?null:(0,U.jsxs)(`div`,{role:`status`,className:`space-y-3 rounded-lg border border-accent/25 bg-accent-soft p-4`,children:[(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`p`,{className:`font-medium text-accent-fg`,children:g?`插件已安装,当前尚未启用`:`Plugin installed. It is not enabled yet.`}),(0,U.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:g?`启用后,Skills 和 MCP 才会加入 Agent 运行时。`:`Enable it to make its skills and MCP servers available to the Agent runtime.`})]}),(0,U.jsx)(h,{disabled:j||T.readiness===`blocked`,onClick:()=>void Y(()=>Se(!0)),children:g?`启用插件`:`Enable plugin`})]}),(0,U.jsxs)(`p`,{className:`text-sm text-fg-muted`,children:[`Agent Plugin · `,T.version,` · `,T.readiness&&{ready:g?`已就绪`:`Ready`,setup_required:g?`待连接`:`Setup required`,degraded:g?`部分不可用`:`Partially available`,blocked:g?`已阻止`:`Blocked`}[T.readiness]]}),T.provenance?(0,U.jsxs)(`p`,{className:`break-words text-xs text-fg-muted`,children:[T.provenance.publisherVerification===`verified`?g?`已认证发布者`:`Verified publisher`:g?`社区发布者`:`Community publisher`,` · `,T.provenance.packageName,`@`,T.provenance.version,` · SHA-256 `,T.provenance.sha256.slice(0,12),`…`,T.provenance.riskTier?` · ${T.provenance.riskTier}`:``]}):null,(0,U.jsx)(`p`,{className:`text-sm`,children:T.description}),T.activationEligible?(0,U.jsx)(h,{disabled:j,variant:`secondary`,onClick:()=>void Y(()=>Se(!1)),children:g?`停用`:`Disable`}):null,T.canRollback?(0,U.jsx)(h,{disabled:j,variant:`secondary`,onClick:()=>void Y(async()=>{E(await G(`${K}/rollback`,`POST`)),await J()}),children:g?`回滚上一版本`:`Roll back`}):null,$?.skills.length||$?.mcp.length?(0,U.jsxs)(`div`,{className:`space-y-3 rounded-lg border border-edge p-3`,children:[(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`p`,{className:`text-sm font-medium`,children:g?`此插件提供的能力`:`Capabilities from this plugin`}),$.skills.length?(0,U.jsxs)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:[`Skills: `,$.skills.map(e=>e.name).join(`, `)]}):null,$.mcp.length?(0,U.jsxs)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:[`MCP: `,$.mcp.map(e=>e.name).join(`, `)]}):null]}),(0,U.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[$.skills.length?(0,U.jsx)(h,{asChild:!0,variant:`secondary`,children:(0,U.jsx)(r,{to:`/capabilities/skills?source=plugin`,children:g?`管理技能`:`Manage skills`})}):null,$.mcp.length?(0,U.jsx)(h,{asChild:!0,variant:`secondary`,children:(0,U.jsx)(r,{to:`/capabilities/connectors?tab=connected`,children:g?`管理连接`:`Manage connections`})}):null]})]}):null,T.components?.mcp.length?(0,U.jsxs)(`details`,{className:`group rounded-lg border border-edge p-3`,children:[(0,U.jsxs)(`summary`,{className:`flex cursor-pointer list-none items-center justify-between gap-3 text-sm font-medium text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:[(0,U.jsx)(`span`,{children:g?`连接与密钥(按需)`:`Connections and API keys (as needed)`}),(0,U.jsx)(x,{className:`size-4 text-fg-muted transition-transform group-open:rotate-180 motion-reduce:transition-none`,"aria-hidden":!0})]}),(0,U.jsx)(`p`,{className:`mt-2 text-xs text-fg-muted`,children:g?`仅当工具服务提示登录或缺少密钥时设置。`:`Only configure this when a tool service asks you to sign in or provide a key.`}),(0,U.jsx)(`div`,{className:`mt-3 space-y-3`,children:T.components.mcp.map(e=>(0,U.jsx)(_e,{pluginId:T.pluginId,server:e,enabled:T.active},e.id))})]}):null,T.diagnostics?.map((e,t)=>(0,U.jsxs)(`p`,{className:`text-sm text-fg-muted`,children:[e.component,`: `,e.message]},t))]}):null,q&&T?(0,U.jsxs)(h,{variant:`ghost`,className:`px-0`,"aria-expanded":V,onClick:()=>fe(e=>!e),children:[(0,U.jsx)(x,{className:c(`size-4 transition-transform motion-reduce:transition-none`,V&&`rotate-180`),"aria-hidden":!0}),g?`高级操作`:`Advanced actions`]}):null,!q||V?(0,U.jsxs)(`form`,{className:c(`space-y-3`,T&&`border-t border-edge pt-4`),onSubmit:e=>{e.preventDefault(),Y(async()=>{A(await G(`/api/extensions/inspect`,`POST`,{source:D}))})},children:[(0,U.jsxs)(`div`,{"data-testid":`plugin-source-dropzone`,className:c(`rounded-xl border border-dashed p-3 transition-colors`,R?`border-accent bg-accent-soft`:`border-edge bg-surface-inset/40`),onDragEnter:e=>{be(e)&&(e.preventDefault(),z(!0))},onDragOver:e=>{be(e)&&(e.preventDefault(),e.dataTransfer.dropEffect=`copy`,z(!0))},onDragLeave:e=>{e.currentTarget.contains(e.relatedTarget)||z(!1)},onDrop:xe,children:[(0,U.jsxs)(`div`,{className:`mb-2 flex items-start gap-2`,children:[(0,U.jsx)(oe,{className:`mt-0.5 size-4 shrink-0 text-fg-muted`,"aria-hidden":!0}),(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`label`,{htmlFor:S,className:`block text-sm font-medium`,children:T?g?`更新包来源`:`Update package source`:g?`安装包来源`:`Package source`}),(0,U.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-muted`,children:g?`拖入插件目录或 ZIP,也可输入 HTTPS ZIP 或 store:包名`:`Drop a plugin directory or ZIP, or enter an HTTPS ZIP or store:package`})]})]}),(0,U.jsx)(`input`,{id:S,className:W,value:D,onChange:e=>X(e.target.value),placeholder:g?`/插件目录/或/插件.zip`:`/plugin/folder/or/plugin.zip`,autoComplete:`off`,spellCheck:!1,required:!0}),(0,U.jsx)(`div`,{className:`mt-2 flex flex-wrap gap-2`,children:Z?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(h,{type:`button`,variant:`secondary`,disabled:j,onClick:()=>void Y(ve),children:[(0,U.jsx)(a,{className:`size-4`,"aria-hidden":!0}),g?`选择目录`:`Choose directory`]}),(0,U.jsxs)(h,{type:`button`,variant:`secondary`,disabled:j,onClick:()=>void Y(ye),children:[(0,U.jsx)(ae,{className:`size-4`,"aria-hidden":!0}),g?`选择 ZIP`:`Choose ZIP`]})]}):(0,U.jsxs)(h,{type:`button`,variant:`secondary`,disabled:j,onClick:()=>B(!0),children:[(0,U.jsx)(a,{className:`size-4`,"aria-hidden":!0}),g?`选择文件或目录`:`Choose file or folder`]})})]}),(0,U.jsx)(h,{type:`submit`,variant:`secondary`,disabled:j||!D,children:g?`检查安装包`:`Inspect package`})]}):null,k?(0,U.jsxs)(`div`,{role:`region`,"aria-labelledby":`plugin-authorization-title`,className:`space-y-3 rounded-xl border border-amber-500/30 bg-amber-500/10 p-4 text-sm`,children:[(0,U.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,U.jsx)(y,{className:`mt-0.5 size-5 shrink-0 text-amber-700 dark:text-amber-300`,"aria-hidden":!0}),(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`p`,{id:`plugin-authorization-title`,className:`font-medium text-fg`,children:g?`需要你的授权`:`Your authorization is required`}),(0,U.jsx)(`p`,{className:`mt-1 text-fg-muted`,children:g?`此插件需要以下新增能力。确认后会自动完成安装并启用。`:`This plugin requests the capabilities below. After approval, installation and activation continue automatically.`})]})]}),(0,U.jsx)(`ul`,{className:`space-y-2 rounded-lg border border-edge bg-surface-panel p-3 break-words`,children:k.addedCapabilities.map(e=>(0,U.jsxs)(`li`,{className:`flex gap-2`,children:[(0,U.jsx)(`span`,{"aria-hidden":!0,children:`•`}),(0,U.jsx)(`span`,{children:he(e,g)})]},e))}),k.diagnostics.map((e,t)=>(0,U.jsxs)(`p`,{children:[e.component,`: `,e.message]},t)),(0,U.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,U.jsxs)(h,{disabled:j||!!T&&k.manifest.name!==T.pluginId,onClick:()=>void Y(()=>Ce(k)),children:[j?(0,U.jsx)(o,{className:`size-4 animate-spin`,"aria-hidden":!0}):null,g?`授权并安装`:`Authorize and install`]}),(0,U.jsx)(h,{variant:`ghost`,disabled:j,onClick:()=>A(null),children:g?`取消`:`Cancel`})]})]}):null,T&&(!q||V)?(0,U.jsx)(`div`,{className:`border-t border-edge pt-4`,children:L?(0,U.jsxs)(`div`,{className:`space-y-3 text-sm`,children:[(0,U.jsx)(`p`,{children:g?`卸载保留账号凭据;服务端授权需到相应服务撤销。`:`Credentials are retained. Revoke provider authorization in the service itself.`}),(0,U.jsxs)(`label`,{className:`flex gap-2`,children:[(0,U.jsx)(`input`,{type:`checkbox`,checked:P,onChange:e=>le(e.target.checked)}),g?`同时删除插件数据`:`Also delete plugin data`]}),(0,U.jsxs)(`label`,{className:`flex gap-2`,children:[(0,U.jsx)(`input`,{type:`checkbox`,checked:F,onChange:e=>I(e.target.checked)}),g?`同时删除本地凭据`:`Also delete local credentials`]}),(0,U.jsx)(h,{disabled:j,onClick:()=>void Y(async()=>{await G(K,`DELETE`,{removeData:P,removeCredentials:F}),await J(),t()}),children:g?`确认卸载`:`Confirm uninstall`})]}):(0,U.jsx)(h,{variant:`ghost`,disabled:j,onClick:()=>ue(!0),children:g?`卸载插件`:`Uninstall`})}):null,ce?(0,U.jsx)(`p`,{role:`alert`,className:`break-words text-sm text-fg-muted`,children:ce}):null]})]}),Z?null:(0,U.jsx)(se,{open:de,onOpenChange:B,initialAbsolutePath:Q,onConfirm:async e=>X(e),wd:s(d).chat.workingDirectory,selectKind:`file-or-directory`,fileExtensions:[`zip`],title:g?`选择插件安装包`:`Choose plugin package`,description:g?`选择插件目录或 ZIP 文件。`:`Choose a plugin directory or ZIP file.`,confirmLabel:g?`使用此来源`:`Use this source`,nested:!0})]})})}export{R as a,L as c,H as d,F as f,T as g,V as h,fe as i,P as l,ue as m,_e as n,N as o,me as p,le as r,k as s,K as t,pe as u};
1
+ import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,t as n}from"./vendor-react-BOUWij0V.js";import{t as r}from"./chunk-KS7C4IRE-BMYIfy9x.js";import{t as i}from"./circle-check-C23XjkUj.js";import{t as a}from"./folder-open-CyzJ19I9.js";import{t as o}from"./loader-circle-CifKLtgG.js";import{t as s}from"./messages-CnM6Qfr7.js";import{t as c}from"./cn-JdwAhgNB.js";import{a as l,i as u,n as ee,r as d}from"./locale-store-ChN_vjs2.js";import{a as f,i as te,o as p,r as ne,s as re,t as m}from"./dist-BGTk37IG.js";import{a as ie}from"./vendor-swr-BIWyz7Rc.js";import{t as h}from"./button-CS04eWY9.js";import{n as g}from"./gateway-config-swr-EZxaKXdC.js";import{t as _}from"./skeleton-BwbyijEw.js";import{At as v,Do as y,Ot as b,Xs as ae,_c as x,io as oe,kt as S,ni as se}from"./index-BcTY7RBG.js";var C=e(t(),1),w=/^([^:=]+)[:=](.*)$/;function T(e){let t=e.trim();if(!t)return null;try{let e=JSON.parse(t);if(e&&typeof e==`object`&&!Array.isArray(e))return Object.entries(e).map(([e,t])=>({key:e,value:t==null?``:String(t)}))}catch{}let n=[];for(let e of t.split(/\r?\n/)){let t=e.trim();if(!t)continue;let r=w.exec(t);r&&n.push({key:r[1].trim(),value:r[2].trim()})}return n.length>0?n:null}function E(e){let t={};for(let n of e){let e=n.key.trim();e&&(t[e]=n.value)}return Object.keys(t).length>0?t:void 0}function D(e){if(!e||typeof e!=`object`)return[{key:``,value:``}];let t=Object.entries(e).map(([e,t])=>({key:e,value:t==null?``:String(t)}));return t.length>0?t:[{key:``,value:``}]}function O(e){if(!e||typeof e!=`object`||Array.isArray(e))return!1;let t=e.xopcConnector;return!!(t&&typeof t==`object`&&!Array.isArray(t)&&t.managed===!0)}function k(e){let t=e&&typeof e==`object`&&`mcp`in e?e.mcp:void 0,n=(t&&typeof t==`object`?t:{}).servers,r={};if(!n||typeof n!=`object`||Array.isArray(n))return r;for(let[e,t]of Object.entries(n))!t||typeof t!=`object`||Array.isArray(t)||O(t)&&(r[e]=t);return r}function A(e){let t=e.trim();if(t)return t.split(/\s+/).filter(Boolean)}function j(e){let t=e.trim();if(!t)return;let n=JSON.parse(t);if(!n||typeof n!=`object`||Array.isArray(n))throw Error(`Expected a JSON object`);return n}function M(e){if(e.transport===`stdio`){let t={command:e.command.trim()},n=A(e.argsText);return n?.length&&(t.args=n),e.cwd.trim()&&(t.cwd=e.cwd.trim()),e.envJson.trim()&&(t.env=j(e.envJson)),e.connectionTimeoutMs!=null&&Number.isFinite(e.connectionTimeoutMs)&&(t.connectionTimeoutMs=e.connectionTimeoutMs),e.requestTimeoutMs!=null&&Number.isFinite(e.requestTimeoutMs)&&(t.requestTimeoutMs=e.requestTimeoutMs),t}let t={url:e.url.trim(),transport:e.transport},n=E(e.headers);return n&&(t.headers=n),e.transport===`streamable-http`&&e.auth===`oauth`&&(t.auth={type:`oauth`,...e.oauthClientId.trim()?{clientId:e.oauthClientId.trim()}:{}}),e.connectionTimeoutMs!=null&&Number.isFinite(e.connectionTimeoutMs)&&(t.connectionTimeoutMs=e.connectionTimeoutMs),e.requestTimeoutMs!=null&&Number.isFinite(e.requestTimeoutMs)&&(t.requestTimeoutMs=e.requestTimeoutMs),t}function ce(e,t){let n=typeof t.url==`string`&&t.url.trim().length>0,r=typeof t.transport==`string`?t.transport.trim().toLowerCase():``,i=n?r===`sse`?`sse`:`streamable-http`:`stdio`,a=t.headers&&typeof t.headers==`object`&&!Array.isArray(t.headers)?t.headers:void 0,o=t.auth&&typeof t.auth==`object`&&!Array.isArray(t.auth)?t.auth:void 0,s=o?.type===`oauth`?`oauth`:`none`;return{clientKey:e,id:e,transport:i,command:typeof t.command==`string`?t.command:``,argsText:Array.isArray(t.args)?t.args.map(String).join(` `):``,envJson:t.env&&typeof t.env==`object`?JSON.stringify(t.env,null,2):``,cwd:typeof t.cwd==`string`?t.cwd:typeof t.workingDirectory==`string`?t.workingDirectory:``,url:typeof t.url==`string`?t.url:``,headers:D(a),auth:s,oauthClientId:typeof o?.clientId==`string`?o.clientId:``,connectionTimeoutMs:typeof t.connectionTimeoutMs==`number`&&Number.isFinite(t.connectionTimeoutMs)?t.connectionTimeoutMs:void 0,requestTimeoutMs:typeof t.requestTimeoutMs==`number`&&Number.isFinite(t.requestTimeoutMs)?t.requestTimeoutMs:void 0}}function N(e=``){return{clientKey:crypto.randomUUID(),id:e,transport:`stdio`,command:``,argsText:``,envJson:``,cwd:``,url:``,headers:[{key:`Authorization`,value:``}],auth:`none`,oauthClientId:``,connectionTimeoutMs:void 0,requestTimeoutMs:void 0}}function P(e){let t=e&&typeof e==`object`&&`mcp`in e?e.mcp:void 0,n=t&&typeof t==`object`?t:{},r=n.servers,i=r&&typeof r==`object`&&!Array.isArray(r)?Object.entries(r).flatMap(([e,t])=>!t||typeof t!=`object`||Array.isArray(t)||O(t)?[]:[ce(e,t)]).sort((e,t)=>e.id.localeCompare(t.id)):[],a=typeof n.sessionIdleTtlMs==`number`?n.sessionIdleTtlMs:void 0;return{sessionIdleTtlMinutes:a==null?void 0:a===0?0:Math.round(a/6e4),servers:i}}function le(e){return M(e)}async function F(e,t={}){let n={};for(let r of e.servers){let e=r.id.trim();if(e){if(t[e])throw Error(`Server id "${e}" is reserved by an installed connector.`);n[e]=M(r)}}let r={servers:{...t,...n}};e.sessionIdleTtlMinutes!=null&&Number.isFinite(e.sessionIdleTtlMinutes)&&(r.sessionIdleTtlMs=e.sessionIdleTtlMinutes===0?0:Math.round(e.sessionIdleTtlMinutes*6e4)),await l(d(`/api/config`),{method:`PATCH`,body:JSON.stringify({mcp:r})}),g()}async function I(e,t,n=``){let r=await l(d(`/api/mcp/servers/${encodeURIComponent(e)}/oauth${n}`),{method:t});if(!r.payload)throw Error(r.error??`MCP OAuth request failed`);return r.payload}function L(e){return I(e,`GET`)}function ue(e){return I(e,`POST`,`/start`)}function R(e){return I(e,`DELETE`)}function z(e){if(!Array.isArray(e))return[];let t=[];for(let n of e){if(!n||typeof n!=`object`)continue;let e=n;if(typeof e.name!=`string`)continue;let r=e.name.trim();if(!r)continue;let i=typeof e.shortName==`string`&&e.shortName.trim()?e.shortName.trim():void 0,a=typeof e.description==`string`&&e.description.trim()?e.description.trim():void 0;t.push({name:r,shortName:i,description:a})}return t}function de(e){if(!Array.isArray(e))return[];let t=[];for(let n of e){if(!n||typeof n!=`object`)continue;let e=n;if(typeof e.uri!=`string`||typeof e.name!=`string`)continue;let r=e.uri.trim(),i=e.name.trim();!r||!i||t.push({uri:r,name:i,title:typeof e.title==`string`&&e.title.trim()?e.title.trim():void 0,description:typeof e.description==`string`&&e.description.trim()?e.description.trim():void 0,mimeType:typeof e.mimeType==`string`&&e.mimeType.trim()?e.mimeType.trim():void 0})}return t}function B(e){if(!Array.isArray(e))return[];let t=[];for(let n of e){if(!n||typeof n!=`object`)continue;let e=n;if(typeof e.name!=`string`)continue;let r=e.name.trim();r&&t.push({name:r,title:typeof e.title==`string`&&e.title.trim()?e.title.trim():void 0,description:typeof e.description==`string`&&e.description.trim()?e.description.trim():void 0,argumentCount:typeof e.argumentCount==`number`?e.argumentCount:0})}return t}async function V(e,t){let n=await l(d(`/api/mcp/servers/${encodeURIComponent(e)}/test`),{method:`POST`,body:t?JSON.stringify({server:t}):void 0});if(!n.payload)throw Error(n.error??`MCP test failed`);let r=z(n.payload.tools),i=de(n.payload.resources),a=B(n.payload.prompts);return{serverId:n.payload.serverId??e,toolCount:typeof n.payload.toolCount==`number`?n.payload.toolCount:r.length,resourceCount:typeof n.payload.resourceCount==`number`?n.payload.resourceCount:i.length,promptCount:typeof n.payload.promptCount==`number`?n.payload.promptCount:a.length,tools:r,resources:i,prompts:a}}function fe(e){return e.connectionTimeoutMs==null||!Number.isFinite(e.connectionTimeoutMs)?``:String(Math.round(e.connectionTimeoutMs/1e3))}function pe(e){let t=e.trim();if(!t)return;let n=Number.parseInt(t,10);if(!(!Number.isFinite(n)||n<1||n>600))return n*1e3}function me(e){return e.requestTimeoutMs==null||!Number.isFinite(e.requestTimeoutMs)?``:String(Math.round(e.requestTimeoutMs/1e3))}function H(e){let t=e.trim();if(!t)return;let n=Number.parseInt(t,10);if(!(!Number.isFinite(n)||n<1||n>14400))return n*1e3}var U=n(),W=`w-full rounded-lg border border-edge bg-surface-inset px-3 py-2 text-sm text-fg`;function he(e,t){if(e.startsWith(`content.skills:`)){let n=e.slice(15);return t?`提供技能:${n}`:`Add skill: ${n}`}if(e.startsWith(`runtime.mcp.stdio:`)){let n=e.slice(18).split(`:`,1)[0];return t?`在本机运行工具服务:${n}`:`Run a local tool service: ${n}`}if(e.startsWith(`network.mcp:`)){let n=e.slice(12).split(`:`,1)[0];return t?`连接外部工具服务:${n}`:`Connect to an external tool service: ${n}`}return e}function ge(e,t){return t?.publisher?.verification!==`verified`||t.latestVersion.riskTier&&t.latestVersion.riskTier!==`content`?!0:e.addedCapabilities.some(e=>!e.startsWith(`content.skills:`))}async function G(e,t,n){let r=await l(d(e),{method:t,...n===void 0?{}:{body:JSON.stringify(n)}});if(!r.ok)throw Error(r.error??`Request failed`);return r.payload}function _e({pluginId:e,server:t,enabled:n}){let{mutate:r}=ie(),i=ee(e=>e.language).startsWith(`zh`),[a,o]=(0,C.useState)(!1),[s,c]=(0,C.useState)(null),[l,f]=(0,C.useState)(``),[te,p]=(0,C.useState)(!1),[ne,re]=(0,C.useState)(!1),[m,g]=(0,C.useState)(``),[y,ae]=(0,C.useState)(t.type===`stdio`?`API_KEY`:`Authorization`),[x,oe]=(0,C.useState)(t.type===`stdio`?``:`Bearer `),[se,w]=(0,C.useState)(!1),[T,E]=(0,C.useState)(``),D=`/api/mcp/servers/${encodeURIComponent(t.id)}`;async function O(){let e=await u(d(`${D}/test`),{method:`POST`,body:`{}`}),t=await e.json();if(r(`gateway-extensions-list`),p(t.code===`MCP_AUTHORIZATION_REQUIRED`),!e.ok||!t.ok)throw Error(t.error??`Connection failed`);f(i?`连接成功 · ${t.payload.toolCount} 个工具`:`Connected · ${t.payload.toolCount} tools`)}(0,C.useEffect)(()=>{if(!n||t.type!==`streamable-http`)return;let e=!1;return L(t.id).then(t=>{e||(c(t),w(!0))}).catch(t=>{e||(f(String(t)),w(!0))}),()=>{e=!0}},[n,t.id,t.type]),(0,C.useEffect)(()=>{if(s?.status!==`authorizing`)return;let e=!1,n=window.setInterval(()=>{L(t.id).then(t=>{e||(c(t),t.status===`connected`&&(p(!1),f(i?`已连接,可以重试原任务`:`Connected. Retry your task.`),r(`gateway-extensions-list`)),t.status===`error`&&f(t.session?.error??`Authorization failed`))}).catch(t=>{e||f(String(t))})},1500);return()=>{e=!0,window.clearInterval(n)}},[s?.status,t.id,i,r]);async function k(e){o(!0),f(``);try{await e()}catch(e){f(e instanceof Error?e.message:String(e))}finally{o(!1)}}return(0,U.jsxs)(`div`,{className:`rounded-lg border border-edge p-3 text-sm`,children:[(0,U.jsxs)(`div`,{className:`mb-2 flex flex-wrap items-center gap-2`,children:[(0,U.jsx)(`span`,{className:`font-medium`,children:t.name}),(0,U.jsxs)(`span`,{className:`text-xs text-fg-muted`,children:[e,` · `,t.type]})]}),n?(0,U.jsxs)(U.Fragment,{children:[t.type===`streamable-http`&&!se?(0,U.jsx)(_,{className:`mb-2 h-4 w-24`}):null,(0,U.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,U.jsx)(h,{variant:`secondary`,disabled:a,onClick:()=>void k(O),children:i?`测试连接`:`Test connection`}),t.type===`streamable-http`&&s?.status!==`connected`?(0,U.jsx)(h,{variant:te?`primary`:`secondary`,disabled:a,onClick:()=>{let e=v();k(async()=>{try{let n=await ue(t.id);if(c(n),n.session?.authorizationUrl){if(!await S(n.session.authorizationUrl,e))throw Error(i?`无法打开授权页面`:`Could not open authorization page`)}else if(b(e),n.session?.error)throw Error(n.session.error)}catch(t){throw b(e),t}})},children:i?`连接账号`:`Connect account`}):null,s?.status===`connected`?(0,U.jsx)(h,{variant:`secondary`,disabled:a,onClick:()=>void k(async()=>{c(await R(t.id)),r(`gateway-extensions-list`)}),children:i?`断开连接`:`Disconnect`}):null,(0,U.jsx)(h,{variant:`ghost`,disabled:a,onClick:()=>re(!ne),children:i?`设置密钥`:`Set API key`})]}),ne?(0,U.jsxs)(`form`,{className:`mt-3 space-y-2`,onSubmit:n=>{n.preventDefault(),k(async()=>{await G(`/api/extensions/agent-plugins/${encodeURIComponent(e)}/mcp/${encodeURIComponent(t.name)}/auth`,`PUT`,{mode:`api-key`,secrets:[{target:t.type===`stdio`?`env`:`headers`,key:y,value:m,prefix:x}]}),g(``),re(!1),c(null),p(!1),await O()})},children:[(0,U.jsxs)(`label`,{className:`block`,children:[i?`字段名`:`Field name`,(0,U.jsx)(`input`,{className:W,value:y,onChange:e=>ae(e.target.value),required:!0})]}),(0,U.jsxs)(`label`,{className:`block`,children:[i?`前缀(可选)`:`Prefix (optional)`,(0,U.jsx)(`input`,{className:W,value:x,onChange:e=>oe(e.target.value)})]}),(0,U.jsxs)(`label`,{className:`block`,children:[i?`密钥`:`Secret`,(0,U.jsx)(`input`,{className:W,type:`password`,autoComplete:`off`,value:m,onChange:e=>g(e.target.value),required:!0})]}),(0,U.jsx)(h,{type:`submit`,disabled:a||!m,children:i?`保存并测试`:`Save and test`})]}):null]}):(0,U.jsx)(`p`,{className:`text-fg-muted`,children:i?`启用插件后连接服务`:`Enable the plugin to connect`}),s?.status===`authorizing`?(0,U.jsxs)(`div`,{className:`mt-2 space-y-2 text-fg-muted`,children:[(0,U.jsx)(`p`,{children:i?`请在浏览器完成授权`:`Complete authorization in your browser`}),(0,U.jsxs)(`details`,{children:[(0,U.jsx)(`summary`,{children:i?`使用远程 Gateway?`:`Using a remote Gateway?`}),(0,U.jsxs)(`form`,{className:`mt-2 space-y-2`,onSubmit:e=>{e.preventDefault(),k(async()=>{c(await G(`${D}/oauth/callback`,`POST`,{callbackUrl:T})),E(``)})},children:[(0,U.jsxs)(`label`,{children:[i?`如果浏览器跳转后无法连接,请粘贴地址栏中的完整回调 URL`:`If the browser cannot reach the callback, paste its full address-bar URL`,(0,U.jsx)(`input`,{type:`password`,autoComplete:`off`,className:W,value:T,onChange:e=>E(e.target.value)})]}),(0,U.jsx)(h,{type:`submit`,disabled:a||!T,children:i?`完成连接`:`Complete connection`})]})]})]}):null,l?(0,U.jsx)(`p`,{role:`status`,className:`mt-2 break-words text-fg-muted`,children:l}):null]})}function K({extension:e,onClose:t,initialSource:n=``,marketplace:l,autoInstall:u=!1}){let d=ee(e=>e.language),g=d.startsWith(`zh`),_=l?.localizations?.[g?`zh-CN`:`en`],v=_?.displayName??l?.name,b=_?.description??l?.description,S=(0,C.useId)(),{mutate:w}=ie(),[T,E]=(0,C.useState)(e),[D,O]=(0,C.useState)(n),[k,A]=(0,C.useState)(null),[j,M]=(0,C.useState)(!1),[ce,N]=(0,C.useState)(``),[P,le]=(0,C.useState)(!1),[F,I]=(0,C.useState)(!1),[L,ue]=(0,C.useState)(!1),[R,z]=(0,C.useState)(!1),[de,B]=(0,C.useState)(!1),[V,fe]=(0,C.useState)(!1),[pe,me]=(0,C.useState)(!1),H=(0,C.useRef)(!1),K=`/api/extensions/agent-plugins/${encodeURIComponent(T?.pluginId??``)}`,q=D.trim().startsWith(`store:`),J=()=>w(`gateway-extensions-list`);async function Y(e){M(!0),N(``);try{await e()}catch(e){N(e instanceof Error?e.message:String(e))}finally{M(!1)}}function X(e){O(e),A(null),N(``)}let Z=typeof window<`u`?window.electronAPI?.file:void 0,Q=/^(?:\/|[A-Za-z]:[\\/])/.test(D.trim())?D.trim():void 0;async function ve(){if(!Z?.openDirectory){B(!0);return}let e=await Z.openDirectory(Q?{defaultPath:Q}:void 0);e&&X(e)}async function ye(){if(!Z?.openFile){B(!0);return}let e=await Z.openFile({...Q?{defaultPath:Q}:{},extensions:[`zip`]});e&&X(e)}function be(e){return[...e.dataTransfer.types].some(e=>e===`Files`||e===`text/plain`||e===`text/uri-list`)}function xe(e){if(!be(e))return;e.preventDefault(),z(!1);let t=Array.from(e.dataTransfer.files);if(t.length){if(t.length>1){N(g?`一次只能选择一个插件目录或 ZIP。`:`Choose one plugin directory or ZIP at a time.`);return}let e=Z?.getPathForFile?.(t[0]);e?X(e):N(g?`浏览器无法读取本机文件路径,请使用“选择文件或目录”选择安装包。`:`The browser cannot read local file paths. Use Choose file or folder to select the package.`);return}let n=e.dataTransfer.getData(`text/uri-list`)||e.dataTransfer.getData(`text/plain`);n.trim()&&X(n.trim().split(/\r?\n/)[0])}async function Se(e){E(await G(`${K}/activation`,`POST`,{enabled:e})),await J()}async function Ce(e){let t=!T,n=await G(t?`/api/extensions/install`:`${K}/update`,`POST`,{source:D,reviewHash:e.reviewHash});E(n),await J(),t&&!n.activationEligible&&n.readiness!==`blocked`&&n.pluginId&&(n=await G(`/api/extensions/agent-plugins/${encodeURIComponent(n.pluginId)}/activation`,`POST`,{enabled:!0}),E(n),await J()),A(null),me(t&&n.activationEligible===!0)}async function we(){let e=await G(`/api/extensions/inspect`,`POST`,{source:D});if(ge(e,l)){A(e);return}await Ce(e)}(0,C.useEffect)(()=>{e&&E(e)},[e]),(0,C.useEffect)(()=>{!u||T||!q||H.current||(H.current=!0,Y(we))},[u,T,q]);let Te=u&&!T&&q&&!H.current,$=T?.components;return(0,U.jsx)(m,{defaultOpen:!0,onOpenChange:e=>!e&&t(),children:(0,U.jsxs)(p,{children:[(0,U.jsx)(f,{className:`fixed inset-0 z-[130] bg-scrim`}),(0,U.jsxs)(ne,{className:`fixed left-1/2 top-1/2 z-[131] flex h-[min(76vh,30rem)] w-[min(34rem,calc(100vw-1.5rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-overlay shadow-popover`,children:[(0,U.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between border-b border-edge p-4`,children:[(0,U.jsx)(re,{className:`font-semibold`,children:T?.name??v??(g?`安装 Agent Plugin`:`Install Agent Plugin`)}),(0,U.jsx)(h,{variant:`ghost`,onClick:t,children:g?`关闭`:`Close`})]}),(0,U.jsx)(te,{className:`sr-only`,children:g?`安装、组件、账号连接和权限`:`Installation, components, connections and permissions`}),(0,U.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-4 overflow-y-auto p-4`,children:[!T&&q?(0,U.jsxs)(`section`,{className:`space-y-4`,children:[(0,U.jsxs)(`div`,{className:`flex items-start gap-3 rounded-xl border border-edge bg-surface-base p-4`,children:[(0,U.jsx)(y,{className:`mt-0.5 size-5 shrink-0 text-emerald-600 dark:text-emerald-400`,"aria-hidden":!0}),(0,U.jsxs)(`div`,{className:`min-w-0`,children:[(0,U.jsx)(`p`,{className:`font-medium text-fg`,children:v??k?.manifest.name??D.slice(6)}),b?(0,U.jsx)(`p`,{className:`mt-1 text-sm leading-relaxed text-fg-muted`,children:b}):null,(0,U.jsx)(`p`,{className:`mt-2 text-xs text-fg-muted`,children:l?.publisher?.verification===`verified`?g?`已认证发布者 · 安装后自动启用`:`Verified publisher · enabled automatically after installation`:g?`安装前会检查来源和所需权限`:`Source and required permissions are checked before installation`})]})]}),k?null:(0,U.jsxs)(h,{className:`w-full`,disabled:j||Te,onClick:()=>void Y(we),children:[j||Te?(0,U.jsx)(o,{className:`size-4 animate-spin`,"aria-hidden":!0}):null,j||Te?g?`正在安全检查并安装…`:`Checking and installing…`:g?`一键安装`:`Install`]})]}):null,T?(0,U.jsxs)(U.Fragment,{children:[pe?(0,U.jsxs)(`div`,{role:`status`,className:`flex items-start gap-3 rounded-lg border border-emerald-500/25 bg-emerald-500/10 p-4`,children:[(0,U.jsx)(i,{className:`mt-0.5 size-5 shrink-0 text-emerald-600 dark:text-emerald-400`,"aria-hidden":!0}),(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`p`,{className:`font-medium text-fg`,children:g?`插件已安装并启用`:`Plugin installed and enabled`}),(0,U.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:g?`现在可以直接在对话中使用它。`:`It is ready to use in your conversations.`})]})]}):null,T.activationEligible?null:(0,U.jsxs)(`div`,{role:`status`,className:`space-y-3 rounded-lg border border-accent/25 bg-accent-soft p-4`,children:[(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`p`,{className:`font-medium text-accent-fg`,children:g?`插件已安装,当前尚未启用`:`Plugin installed. It is not enabled yet.`}),(0,U.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:g?`启用后,Skills 和 MCP 才会加入 Agent 运行时。`:`Enable it to make its skills and MCP servers available to the Agent runtime.`})]}),(0,U.jsx)(h,{disabled:j||T.readiness===`blocked`,onClick:()=>void Y(()=>Se(!0)),children:g?`启用插件`:`Enable plugin`})]}),(0,U.jsxs)(`p`,{className:`text-sm text-fg-muted`,children:[`Agent Plugin · `,T.version,` · `,T.readiness&&{ready:g?`已就绪`:`Ready`,setup_required:g?`待连接`:`Setup required`,degraded:g?`部分不可用`:`Partially available`,blocked:g?`已阻止`:`Blocked`}[T.readiness]]}),T.provenance?(0,U.jsxs)(`p`,{className:`break-words text-xs text-fg-muted`,children:[T.provenance.publisherVerification===`verified`?g?`已认证发布者`:`Verified publisher`:g?`社区发布者`:`Community publisher`,` · `,T.provenance.packageName,`@`,T.provenance.version,` · SHA-256 `,T.provenance.sha256.slice(0,12),`…`,T.provenance.riskTier?` · ${T.provenance.riskTier}`:``]}):null,(0,U.jsx)(`p`,{className:`text-sm`,children:T.description}),T.activationEligible?(0,U.jsx)(h,{disabled:j,variant:`secondary`,onClick:()=>void Y(()=>Se(!1)),children:g?`停用`:`Disable`}):null,T.canRollback?(0,U.jsx)(h,{disabled:j,variant:`secondary`,onClick:()=>void Y(async()=>{E(await G(`${K}/rollback`,`POST`)),await J()}),children:g?`回滚上一版本`:`Roll back`}):null,$?.skills.length||$?.mcp.length?(0,U.jsxs)(`div`,{className:`space-y-3 rounded-lg border border-edge p-3`,children:[(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`p`,{className:`text-sm font-medium`,children:g?`此插件提供的能力`:`Capabilities from this plugin`}),$.skills.length?(0,U.jsxs)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:[`Skills: `,$.skills.map(e=>e.name).join(`, `)]}):null,$.mcp.length?(0,U.jsxs)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:[`MCP: `,$.mcp.map(e=>e.name).join(`, `)]}):null]}),(0,U.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[$.skills.length?(0,U.jsx)(h,{asChild:!0,variant:`secondary`,children:(0,U.jsx)(r,{to:`/capabilities/skills?source=plugin`,children:g?`管理技能`:`Manage skills`})}):null,$.mcp.length?(0,U.jsx)(h,{asChild:!0,variant:`secondary`,children:(0,U.jsx)(r,{to:`/capabilities/connectors?tab=connected`,children:g?`管理连接`:`Manage connections`})}):null]})]}):null,T.components?.mcp.length?(0,U.jsxs)(`details`,{className:`group rounded-lg border border-edge p-3`,children:[(0,U.jsxs)(`summary`,{className:`flex cursor-pointer list-none items-center justify-between gap-3 text-sm font-medium text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:[(0,U.jsx)(`span`,{children:g?`连接与密钥(按需)`:`Connections and API keys (as needed)`}),(0,U.jsx)(x,{className:`size-4 text-fg-muted transition-transform group-open:rotate-180 motion-reduce:transition-none`,"aria-hidden":!0})]}),(0,U.jsx)(`p`,{className:`mt-2 text-xs text-fg-muted`,children:g?`仅当工具服务提示登录或缺少密钥时设置。`:`Only configure this when a tool service asks you to sign in or provide a key.`}),(0,U.jsx)(`div`,{className:`mt-3 space-y-3`,children:T.components.mcp.map(e=>(0,U.jsx)(_e,{pluginId:T.pluginId,server:e,enabled:T.active},e.id))})]}):null,T.diagnostics?.map((e,t)=>(0,U.jsxs)(`p`,{className:`text-sm text-fg-muted`,children:[e.component,`: `,e.message]},t))]}):null,q&&T?(0,U.jsxs)(h,{variant:`ghost`,className:`px-0`,"aria-expanded":V,onClick:()=>fe(e=>!e),children:[(0,U.jsx)(x,{className:c(`size-4 transition-transform motion-reduce:transition-none`,V&&`rotate-180`),"aria-hidden":!0}),g?`高级操作`:`Advanced actions`]}):null,!q||V?(0,U.jsxs)(`form`,{className:c(`space-y-3`,T&&`border-t border-edge pt-4`),onSubmit:e=>{e.preventDefault(),Y(async()=>{A(await G(`/api/extensions/inspect`,`POST`,{source:D}))})},children:[(0,U.jsxs)(`div`,{"data-testid":`plugin-source-dropzone`,className:c(`rounded-xl border border-dashed p-3 transition-colors`,R?`border-accent bg-accent-soft`:`border-edge bg-surface-inset/40`),onDragEnter:e=>{be(e)&&(e.preventDefault(),z(!0))},onDragOver:e=>{be(e)&&(e.preventDefault(),e.dataTransfer.dropEffect=`copy`,z(!0))},onDragLeave:e=>{e.currentTarget.contains(e.relatedTarget)||z(!1)},onDrop:xe,children:[(0,U.jsxs)(`div`,{className:`mb-2 flex items-start gap-2`,children:[(0,U.jsx)(oe,{className:`mt-0.5 size-4 shrink-0 text-fg-muted`,"aria-hidden":!0}),(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`label`,{htmlFor:S,className:`block text-sm font-medium`,children:T?g?`更新包来源`:`Update package source`:g?`安装包来源`:`Package source`}),(0,U.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-muted`,children:g?`拖入插件目录或 ZIP,也可输入 HTTPS ZIP 或 store:包名`:`Drop a plugin directory or ZIP, or enter an HTTPS ZIP or store:package`})]})]}),(0,U.jsx)(`input`,{id:S,className:W,value:D,onChange:e=>X(e.target.value),placeholder:g?`/插件目录/或/插件.zip`:`/plugin/folder/or/plugin.zip`,autoComplete:`off`,spellCheck:!1,required:!0}),(0,U.jsx)(`div`,{className:`mt-2 flex flex-wrap gap-2`,children:Z?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(h,{type:`button`,variant:`secondary`,disabled:j,onClick:()=>void Y(ve),children:[(0,U.jsx)(a,{className:`size-4`,"aria-hidden":!0}),g?`选择目录`:`Choose directory`]}),(0,U.jsxs)(h,{type:`button`,variant:`secondary`,disabled:j,onClick:()=>void Y(ye),children:[(0,U.jsx)(ae,{className:`size-4`,"aria-hidden":!0}),g?`选择 ZIP`:`Choose ZIP`]})]}):(0,U.jsxs)(h,{type:`button`,variant:`secondary`,disabled:j,onClick:()=>B(!0),children:[(0,U.jsx)(a,{className:`size-4`,"aria-hidden":!0}),g?`选择文件或目录`:`Choose file or folder`]})})]}),(0,U.jsx)(h,{type:`submit`,variant:`secondary`,disabled:j||!D,children:g?`检查安装包`:`Inspect package`})]}):null,k?(0,U.jsxs)(`div`,{role:`region`,"aria-labelledby":`plugin-authorization-title`,className:`space-y-3 rounded-xl border border-amber-500/30 bg-amber-500/10 p-4 text-sm`,children:[(0,U.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,U.jsx)(y,{className:`mt-0.5 size-5 shrink-0 text-amber-700 dark:text-amber-300`,"aria-hidden":!0}),(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`p`,{id:`plugin-authorization-title`,className:`font-medium text-fg`,children:g?`需要你的授权`:`Your authorization is required`}),(0,U.jsx)(`p`,{className:`mt-1 text-fg-muted`,children:g?`此插件需要以下新增能力。确认后会自动完成安装并启用。`:`This plugin requests the capabilities below. After approval, installation and activation continue automatically.`})]})]}),(0,U.jsx)(`ul`,{className:`space-y-2 rounded-lg border border-edge bg-surface-panel p-3 break-words`,children:k.addedCapabilities.map(e=>(0,U.jsxs)(`li`,{className:`flex gap-2`,children:[(0,U.jsx)(`span`,{"aria-hidden":!0,children:`•`}),(0,U.jsx)(`span`,{children:he(e,g)})]},e))}),k.diagnostics.map((e,t)=>(0,U.jsxs)(`p`,{children:[e.component,`: `,e.message]},t)),(0,U.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,U.jsxs)(h,{disabled:j||!!T&&k.manifest.name!==T.pluginId,onClick:()=>void Y(()=>Ce(k)),children:[j?(0,U.jsx)(o,{className:`size-4 animate-spin`,"aria-hidden":!0}):null,g?`授权并安装`:`Authorize and install`]}),(0,U.jsx)(h,{variant:`ghost`,disabled:j,onClick:()=>A(null),children:g?`取消`:`Cancel`})]})]}):null,T&&(!q||V)?(0,U.jsx)(`div`,{className:`border-t border-edge pt-4`,children:L?(0,U.jsxs)(`div`,{className:`space-y-3 text-sm`,children:[(0,U.jsx)(`p`,{children:g?`卸载保留账号凭据;服务端授权需到相应服务撤销。`:`Credentials are retained. Revoke provider authorization in the service itself.`}),(0,U.jsxs)(`label`,{className:`flex gap-2`,children:[(0,U.jsx)(`input`,{type:`checkbox`,checked:P,onChange:e=>le(e.target.checked)}),g?`同时删除插件数据`:`Also delete plugin data`]}),(0,U.jsxs)(`label`,{className:`flex gap-2`,children:[(0,U.jsx)(`input`,{type:`checkbox`,checked:F,onChange:e=>I(e.target.checked)}),g?`同时删除本地凭据`:`Also delete local credentials`]}),(0,U.jsx)(h,{disabled:j,onClick:()=>void Y(async()=>{await G(K,`DELETE`,{removeData:P,removeCredentials:F}),await J(),t()}),children:g?`确认卸载`:`Confirm uninstall`})]}):(0,U.jsx)(h,{variant:`ghost`,disabled:j,onClick:()=>ue(!0),children:g?`卸载插件`:`Uninstall`})}):null,ce?(0,U.jsx)(`p`,{role:`alert`,className:`break-words text-sm text-fg-muted`,children:ce}):null]})]}),Z?null:(0,U.jsx)(se,{open:de,onOpenChange:B,initialAbsolutePath:Q,onConfirm:async e=>X(e),wd:s(d).chat.workingDirectory,selectKind:`file-or-directory`,fileExtensions:[`zip`],title:g?`选择插件安装包`:`Choose plugin package`,description:g?`选择插件目录或 ZIP 文件。`:`Choose a plugin directory or ZIP file.`,confirmLabel:g?`使用此来源`:`Use this source`,nested:!0})]})})}export{R as a,L as c,H as d,F as f,T as g,V as h,fe as i,P as l,ue as m,_e as n,N as o,me as p,le as r,k as s,K as t,pe as u};