@xopcai/xopc 0.0.364 → 0.0.367

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 (365) hide show
  1. package/dist/browser-ext/dist/sidepanel.js +16 -4
  2. package/dist/browser-ext/manifest.json +1 -1
  3. package/dist/extensions/telegram/xopc.extension.json +1 -1
  4. package/dist/gateway/static/root/assets/{activity-store-GvR2gZ0T.js → activity-store-Cuf3JFFJ.js} +1 -1
  5. package/dist/gateway/static/root/assets/{agent-avatar-dicebear-7Ct-ZlfL.js → agent-avatar-dicebear-DyATPNTe.js} +1 -1
  6. package/dist/gateway/static/root/assets/agent-defaults-settings-panel-gT9_j4tr.js +1 -0
  7. package/dist/gateway/static/root/assets/agent-plugin-dialog-CLXCJ6JN.js +1 -0
  8. package/dist/gateway/static/root/assets/agents-BAUfOMsq.js +66 -0
  9. package/dist/gateway/static/root/assets/{agents-admin-api-BkXb7VEZ.js → agents-admin-api-D842OcNo.js} +1 -1
  10. package/dist/gateway/static/root/assets/app-link-4gpFbdsr.js +1 -0
  11. package/dist/gateway/static/root/assets/{app-management-settings-panel-CjfsIn9A.js → app-management-settings-panel-CoIFxQKH.js} +1 -1
  12. package/dist/gateway/static/root/assets/{appearance-settings-qqHZ15GU.js → appearance-settings-DQr0o6Lm.js} +1 -1
  13. package/dist/gateway/static/root/assets/{apps-page-Ba2VkQk6.js → apps-page-CltMV4Xp.js} +1 -1
  14. package/dist/gateway/static/root/assets/{archive-plugin-CKe3qAaL.js → archive-plugin-DT8Nio-r.js} +1 -1
  15. package/dist/gateway/static/root/assets/automation-display-DCkjVzA0.js +2 -0
  16. package/dist/gateway/static/root/assets/{automations-page-Bt8Q58ut.js → automations-page-BIfWS_3Y.js} +1 -1
  17. package/dist/gateway/static/root/assets/automations-workspace-BCGPjsdU.js +6 -0
  18. package/dist/gateway/static/root/assets/binary-plugins-7qs3qcW9.js +2 -0
  19. package/dist/gateway/static/root/assets/{block-editor-ClRFbHP7.js → block-editor-BFPUlxJ6.js} +28 -28
  20. package/dist/gateway/static/root/assets/{browser-automation-inputs-5B3qAdmb.js → browser-automation-inputs-BUAIKIX0.js} +1 -1
  21. package/dist/gateway/static/root/assets/{browser-automations-page-BjMub7JM.js → browser-automations-page-CSwu1U1F.js} +2 -2
  22. package/dist/gateway/static/root/assets/browser-settings-page-C1ReMNqX.js +3 -0
  23. package/dist/gateway/static/root/assets/capabilities-BzWFO_x_.js +1 -0
  24. package/dist/gateway/static/root/assets/{capabilities-BKu9BqPe.js → capabilities-K0Zb_lH0.js} +1 -1
  25. package/dist/gateway/static/root/assets/capabilities-page-BdTSqloI.js +2 -0
  26. package/dist/gateway/static/root/assets/{capabilities-settings-panel-gZ8auLwa.js → capabilities-settings-panel-BUblBMZC.js} +4 -4
  27. package/dist/gateway/static/root/assets/{capability-header-actions-L1NvoOUG.js → capability-header-actions-AMn_vTNv.js} +1 -1
  28. package/dist/gateway/static/root/assets/channels-CXCf5qO6.js +1 -0
  29. package/dist/gateway/static/root/assets/{chat-terminal-dock-DsCpKPBe.js → chat-terminal-dock-C7nAROhF.js} +2 -2
  30. package/dist/gateway/static/root/assets/chevron-left-DqFhpbvK.js +1 -0
  31. package/dist/gateway/static/root/assets/computer-settings-page-B5SuSZ3G.js +1 -0
  32. package/dist/gateway/static/root/assets/{connector-service-page-mtH9mEBf.js → connector-service-page-CTx1B8wx.js} +1 -1
  33. package/dist/gateway/static/root/assets/connectors-page-DfnK1crf.js +2 -0
  34. package/dist/gateway/static/root/assets/date-formatters-CUZAyDEg.js +1 -0
  35. package/dist/gateway/static/root/assets/date-picker-Cx_xIKvN.js +1 -0
  36. package/dist/gateway/static/root/assets/{dependency-picker-B_fPQBTM.js → dependency-picker-DYm96PDu.js} +1 -1
  37. package/dist/gateway/static/root/assets/{desktop-pet-CJrO9Vd_.js → desktop-pet-D90OzgeR.js} +1 -1
  38. package/dist/gateway/static/root/assets/{desktop-pet-settings-DYAfri9w.js → desktop-pet-settings-CmdCecjm.js} +1 -1
  39. package/dist/gateway/static/root/assets/{device-pairing-wizard-CqRys2R8.js → device-pairing-wizard-s2ogSa4l.js} +1 -1
  40. package/dist/gateway/static/root/assets/{directory-picker-path-field-D7_qSxNZ.js → directory-picker-path-field-DZpaoeNa.js} +1 -1
  41. package/dist/gateway/static/root/assets/{extension-debug-page-BGyJpRv4.js → extension-debug-page-Bv6QE8kC.js} +1 -1
  42. package/dist/gateway/static/root/assets/{extension-page-D1zBmd8F.js → extension-page-CEsq71Cm.js} +1 -1
  43. package/dist/gateway/static/root/assets/{extension-provider-F9JzOWZ3.js → extension-provider-CX-sK0Tw.js} +1 -1
  44. package/dist/gateway/static/root/assets/{extension-settings-page-CTR8AjCG.js → extension-settings-page-UyOHF39P.js} +1 -1
  45. package/dist/gateway/static/root/assets/{fallback-models-Chhv4Nfv.js → fallback-models-CKv_Wqg8.js} +1 -1
  46. package/dist/gateway/static/root/assets/{gateway-config-swr-CoRoOG1l.js → gateway-config-swr-Cjnkle5J.js} +1 -1
  47. package/dist/gateway/static/root/assets/{gateway-realtime-D0ygm6bc.js → gateway-realtime-DCCLdyQD.js} +1 -1
  48. package/dist/gateway/static/root/assets/gateway-realtime-store-C_Th8kGg.js +1 -0
  49. package/dist/gateway/static/root/assets/gateway-settings-CZ73IpbP.js +1 -0
  50. package/dist/gateway/static/root/assets/{gateway-startup-retry-FDS6S6qa.js → gateway-startup-retry-CXKmdVzN.js} +1 -1
  51. package/dist/gateway/static/root/assets/home-page-BQWq4kYi.js +2 -0
  52. package/dist/gateway/static/root/assets/{image-generation-api-BPd76jW5.js → image-generation-api-NLHzm4Nc.js} +1 -1
  53. package/dist/gateway/static/root/assets/{imports-page-9EnECtcl.js → imports-page-C7qvlBTQ.js} +1 -1
  54. package/dist/gateway/static/root/assets/index-BQgqzhQj.js +106 -0
  55. package/dist/gateway/static/root/assets/index-COB4QIJp.css +1 -0
  56. package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-MC7mG2h2.js → keyboard-shortcuts-settings-pkgFWJb-.js} +1 -1
  57. package/dist/gateway/static/root/assets/local-app-workbench-page-dMDhZXAi.js +1 -0
  58. package/dist/gateway/static/root/assets/{local-apps-page-c3HncHZ3.js → local-apps-page-TpUAfOn2.js} +1 -1
  59. package/dist/gateway/static/root/assets/local-session-drafts-Cvv7I0fw.js +1 -0
  60. package/dist/gateway/static/root/assets/{locale-store-DId6-v2R.js → locale-store-C8TMD2gn.js} +1 -1
  61. package/dist/gateway/static/root/assets/logs-page-B-Y9oZLh.js +2 -0
  62. package/dist/gateway/static/root/assets/management-settings-B2lzsw6X.js +1 -0
  63. package/dist/gateway/static/root/assets/markdown-view-Dse7rkio.js +201 -0
  64. package/dist/gateway/static/root/assets/{media-plugins-XLewwq2q.js → media-plugins-BZrnzaBM.js} +1 -1
  65. package/dist/gateway/static/root/assets/messages-Dy26npMy.js +3 -0
  66. package/dist/gateway/static/root/assets/{models-hub-cache-B9SKjidc.js → models-hub-cache-B1C86nRp.js} +1 -1
  67. package/dist/gateway/static/root/assets/note-detail-panel-DL__qP6U.js +5 -0
  68. package/dist/gateway/static/root/assets/{notes-api-Byt65v3r.js → notes-api-DKiVeQKG.js} +1 -1
  69. package/dist/gateway/static/root/assets/notes-page-DTBbg9Hs.js +8 -0
  70. package/dist/gateway/static/root/assets/{oauth-api-BYsCbyGZ.js → oauth-api-BwpzpRwC.js} +1 -1
  71. package/dist/gateway/static/root/assets/open-route-MyZ2sB9C.js +1 -0
  72. package/dist/gateway/static/root/assets/{page-context-capture-button-RBp1QK0F.js → page-context-capture-button-Cxzd4QPB.js} +1 -1
  73. package/dist/gateway/static/root/assets/personal-page-CzaTnHeD.js +1 -0
  74. package/dist/gateway/static/root/assets/product-open-page-D4hoEWiu.js +1 -0
  75. package/dist/gateway/static/root/assets/product-preview-content-aR38El2E.js +1 -0
  76. package/dist/gateway/static/root/assets/project-detail-page-D20QH4YB.js +1 -0
  77. package/dist/gateway/static/root/assets/projects-page-Bf3BIcT6.js +1 -0
  78. package/dist/gateway/static/root/assets/{registry-api-7F2WNEZC.js → registry-api-AdnxowbH.js} +1 -1
  79. package/dist/gateway/static/root/assets/remote-access-hub-CKxqncqW.js +1 -0
  80. package/dist/gateway/static/root/assets/{runtime-tools-settings-panel-B0c120iI.js → runtime-tools-settings-panel-CBN3raz1.js} +1 -1
  81. package/dist/gateway/static/root/assets/scenes-page-Cv_5ozfX.js +2 -0
  82. package/dist/gateway/static/root/assets/{schema-form-DQpQc9tH.js → schema-form-CxrMGsT9.js} +1 -1
  83. package/dist/gateway/static/root/assets/secret-input-D93UrW4C.js +1 -0
  84. package/dist/gateway/static/root/assets/{send-session-input-D1oc6BC6.js → send-session-input-CgOzhDZ0.js} +1 -1
  85. package/dist/gateway/static/root/assets/{session-api-N3N37MrR.js → session-api-_HIN8or3.js} +1 -1
  86. package/dist/gateway/static/root/assets/session-manager-CzCto5zT.js +16 -0
  87. package/dist/gateway/static/root/assets/sessions-page-DZcu6NLJ.js +1 -0
  88. package/dist/gateway/static/root/assets/settings-advanced-gate-DazqeDQ7.js +1 -0
  89. package/dist/gateway/static/root/assets/{settings-page-GgBEp6O7.js → settings-page-D8Q3H3-o.js} +1 -1
  90. package/dist/gateway/static/root/assets/setup-status-panel-DvLMMiuS.js +1 -0
  91. package/dist/gateway/static/root/assets/{share-link-dialog-TBBGJPfT.js → share-link-dialog-Dg5os066.js} +1 -1
  92. package/dist/gateway/static/root/assets/{share-preview-page-DyRLPsPv.js → share-preview-page-DMvohAyr.js} +1 -1
  93. package/dist/gateway/static/root/assets/{shares-api-DU0fHP2G.js → shares-api-C96IO4qJ.js} +1 -1
  94. package/dist/gateway/static/root/assets/{shares-settings-DJ1ME-XM.js → shares-settings-CsDATuCw.js} +1 -1
  95. package/dist/gateway/static/root/assets/{skill-api-1Puv6wOz.js → skill-api-C10ML0CH.js} +1 -1
  96. package/dist/gateway/static/root/assets/{skill-reload-api-ClyFqHk7.js → skill-reload-api-DNbJzSfB.js} +1 -1
  97. package/dist/gateway/static/root/assets/skills-page-DObMKvA6.js +2 -0
  98. package/dist/gateway/static/root/assets/{system-settings-panel--yV67a8L.js → system-settings-panel-Bn3khdzb.js} +1 -1
  99. package/dist/gateway/static/root/assets/task-detail-page-BR2L1L8l.js +2 -0
  100. package/dist/gateway/static/root/assets/task-expandable-content-DL2Q2gre.js +1 -0
  101. package/dist/gateway/static/root/assets/{tasks-CH6KoBeY.js → tasks-DwKXgZ-I.js} +1 -1
  102. package/dist/gateway/static/root/assets/{theme-store-OhcbFEUR.js → theme-store-DQ6KJa4l.js} +1 -1
  103. package/dist/gateway/static/root/assets/tracing-settings-page-Ed8_GYUT.js +1 -0
  104. package/dist/gateway/static/root/assets/{tunnel-api-COLdiP_E.js → tunnel-api-D3X8jDwo.js} +1 -1
  105. package/dist/gateway/static/root/assets/{usage-page-CtM5IfrL.js → usage-page-BqzRyyb9.js} +1 -1
  106. package/dist/gateway/static/root/assets/{use-autosave-veoM0dHn.js → use-autosave-CRFefpzO.js} +1 -1
  107. package/dist/gateway/static/root/assets/use-composer-attachments-OLrvSjn5.js +2 -0
  108. package/dist/gateway/static/root/assets/{use-file-preview-expanded-Bope6MW6.js → use-file-preview-expanded-CJvzfQvw.js} +2 -2
  109. package/dist/gateway/static/root/assets/user-model-page-CG6wqIKP.js +2 -0
  110. package/dist/gateway/static/root/assets/{voice-api-key-field-CwD6a3KQ.js → voice-api-key-field-R9zNWYR_.js} +1 -1
  111. package/dist/gateway/static/root/assets/{voice-config-api-Daexehmc.js → voice-config-api-DLudE9Rc.js} +1 -1
  112. package/dist/gateway/static/root/assets/{work-discovery-overlay-C9u7tuEc.js → work-discovery-overlay-DVmQrolV.js} +1 -1
  113. package/dist/gateway/static/root/assets/{workflow-run-setup-panel-BMOBbf33.js → workflow-run-setup-panel-DEkmuD3T.js} +2 -2
  114. package/dist/gateway/static/root/assets/workflows-page-pqCB3sh4.js +6 -0
  115. package/dist/gateway/static/root/assets/workspace-api-CdVUhyPo.js +2 -0
  116. package/dist/gateway/static/root/index.html +33 -31
  117. package/dist/package.js +1 -1
  118. package/dist/packages/gateway-contract/src/automations.js +1 -0
  119. package/dist/packages/gateway-contract/src/home.js +14 -0
  120. package/dist/packages/gateway-contract/src/index.js +2 -0
  121. package/dist/packages/gateway-contract/src/notifications.js +2 -1
  122. package/dist/packages/gateway-contract/src/personal-proactivity.js +139 -0
  123. package/dist/packages/gateway-contract/src/session-input-command.js +1 -0
  124. package/dist/packages/image-providers/src/catalog.js +373 -0
  125. package/dist/packages/image-providers/src/execute.js +372 -0
  126. package/dist/packages/image-providers/src/http.js +94 -0
  127. package/dist/packages/image-providers/src/index.js +5 -0
  128. package/dist/packages/image-providers/src/types.d.ts +95 -0
  129. package/dist/packages/image-providers/src/validation.js +52 -0
  130. package/dist/src/agent/agent-manager.d.ts +1 -0
  131. package/dist/src/agent/agent-manager.js +35 -3
  132. package/dist/src/agent/background-review/run-background-review.js +1 -1
  133. package/dist/src/agent/commands/command-registry.js +1 -1
  134. package/dist/src/agent/context/execution-context.js +1 -1
  135. package/dist/src/agent/context/project-context.js +4 -4
  136. package/dist/src/agent/embedded/run-for-session.js +1 -1
  137. package/dist/src/agent/external-tools/endpoint-provider.js +2 -2
  138. package/dist/src/agent/failover-error.d.ts +1 -1
  139. package/dist/src/agent/failover-error.js +7 -0
  140. package/dist/src/agent/image/generation/native-provider.d.ts +2 -0
  141. package/dist/src/agent/image/generation/native-provider.js +118 -0
  142. package/dist/src/agent/image/generation/openai-images-provider.d.ts +1 -1
  143. package/dist/src/agent/image/generation/openai-images-provider.js +48 -32
  144. package/dist/src/agent/image/generation/provider-registry.js +4 -13
  145. package/dist/src/agent/image/generation/providers/xopc-cloud.js +5 -34
  146. package/dist/src/agent/image/generation/runtime-types.d.ts +2 -4
  147. package/dist/src/agent/image/generation/runtime.js +28 -23
  148. package/dist/src/agent/image/generation/types.d.ts +3 -50
  149. package/dist/src/agent/image/generation/validation.d.ts +6 -0
  150. package/dist/src/agent/image/generation/validation.js +16 -0
  151. package/dist/src/agent/inbound/attachment-pipeline.js +1 -1
  152. package/dist/src/agent/prompt/voice-presentation.d.ts +1 -1
  153. package/dist/src/agent/prompt/voice-presentation.js +1 -1
  154. package/dist/src/agent/service/direct-turn-helpers.js +17 -1
  155. package/dist/src/agent/service.js +3 -3
  156. package/dist/src/agent/skills/index.js +1 -1
  157. package/dist/src/agent/skills/managed-store.js +1 -1
  158. package/dist/src/agent/skills/skill-manage-ops.js +1 -1
  159. package/dist/src/agent/tools/delegation-parent-policy.js +2 -0
  160. package/dist/src/agent/tools/delegation-policy.js +2 -0
  161. package/dist/src/agent/tools/factory.d.ts +2 -0
  162. package/dist/src/agent/tools/factory.js +31 -4
  163. package/dist/src/agent/tools/image-generate-tool.js +5 -19
  164. package/dist/src/agent/tools/index.d.ts +2 -2
  165. package/dist/src/agent/tools/index.js +3 -3
  166. package/dist/src/agent/tools/knowledge-memory-tool.d.ts +2 -0
  167. package/dist/src/agent/tools/knowledge-memory-tool.js +60 -1
  168. package/dist/src/agent/tools/personal-attention-tool.d.ts +21 -0
  169. package/dist/src/agent/tools/personal-attention-tool.js +191 -0
  170. package/dist/src/agent/tools/personal-task-tool.d.ts +12 -8
  171. package/dist/src/agent/tools/personal-task-tool.js +35 -41
  172. package/dist/src/agent/tools/user-context-tool.d.ts +2 -0
  173. package/dist/src/agent/tools/user-context-tool.js +61 -2
  174. package/dist/src/agent/tools/xopc-use-tool.js +2 -2
  175. package/dist/src/agent-catalog/capabilities.js +2 -2
  176. package/dist/src/agent-catalog/migrations/legacy-config-cutover.js +1 -1
  177. package/dist/src/agent-catalog/repository.d.ts +1 -0
  178. package/dist/src/agent-catalog/repository.js +4 -1
  179. package/dist/src/automations/capabilities/drafts.js +1 -1
  180. package/dist/src/automations/capabilities/write.d.ts +2 -0
  181. package/dist/src/automations/domain/types.d.ts +1 -1
  182. package/dist/src/automations/domain/validation.d.ts +4 -0
  183. package/dist/src/automations/domain/validation.js +1 -0
  184. package/dist/src/automations/draft/automation-draft-validator.d.ts +1 -1
  185. package/dist/src/bootstrap/application-state.js +1 -1
  186. package/dist/src/capabilities/runtime/dispatcher.js +1 -1
  187. package/dist/src/capabilities/runtime/product.js +1 -1
  188. package/dist/src/chat-commands/personal-command-policy.d.ts +2 -0
  189. package/dist/src/chat-commands/personal-command-policy.js +9 -0
  190. package/dist/src/chat-commands/registry.js +6 -0
  191. package/dist/src/cli/commands/agents.js +1 -1
  192. package/dist/src/cli/commands/doctor/checks/database-schema.js +1 -1
  193. package/dist/src/cli/commands/doctor/checks/provider-auth.js +1 -1
  194. package/dist/src/cli/commands/models.js +4 -9
  195. package/dist/src/cli/commands/onboard/model.js +2 -2
  196. package/dist/src/cli/utils/init-workspace-core.js +1 -1
  197. package/dist/src/config/agent-profile.js +1 -1
  198. package/dist/src/config/models-json.d.ts +170 -0
  199. package/dist/src/config/models-json.js +23 -8
  200. package/dist/src/extensions/agent-plugins/validation.js +1 -1
  201. package/dist/src/files/file-service.d.ts +6 -0
  202. package/dist/src/files/file-service.js +38 -1
  203. package/dist/src/gateway/agent-builtin-tools.d.ts +1 -1
  204. package/dist/src/gateway/agents-admin.js +2 -2
  205. package/dist/src/gateway/custom-image-providers.d.ts +34 -0
  206. package/dist/src/gateway/file-path-classifier.js +12 -3
  207. package/dist/src/gateway/hono/routes/agents.js +1 -1
  208. package/dist/src/gateway/hono/routes/config-patch/misc.js +1 -1
  209. package/dist/src/gateway/hono/routes/files.js +13 -2
  210. package/dist/src/gateway/hono/routes/notes.js +2 -2
  211. package/dist/src/gateway/hono/routes/observability.js +8 -0
  212. package/dist/src/gateway/hono/routes/personal-agent.js +41 -0
  213. package/dist/src/gateway/hono/routes/projects.js +3 -3
  214. package/dist/src/gateway/hono/routes/session-input-handler.d.ts +2 -0
  215. package/dist/src/gateway/hono/routes/session-input-handler.js +9 -1
  216. package/dist/src/gateway/hono/routes/sessions.js +1 -1
  217. package/dist/src/gateway/hono/routes/tasks.js +1 -1
  218. package/dist/src/gateway/hono/routes/voice.js +1 -1
  219. package/dist/src/gateway/image-generation-setup.js +1 -1
  220. package/dist/src/gateway/service/agent-runner.d.ts +1 -0
  221. package/dist/src/gateway/service/agent-runner.js +12 -1
  222. package/dist/src/gateway/service/run-gateway-agent.d.ts +1 -0
  223. package/dist/src/gateway/service/run-gateway-agent.js +15 -0
  224. package/dist/src/gateway/service/session-command-service.js +5 -3
  225. package/dist/src/gateway/service/session-input-coordinator.d.ts +12 -0
  226. package/dist/src/gateway/service/session-input-coordinator.js +63 -5
  227. package/dist/src/gateway/service/sessions-api.js +1 -1
  228. package/dist/src/gateway/service.d.ts +3 -0
  229. package/dist/src/gateway/service.js +54 -9
  230. package/dist/src/gateway/session-context-summary.js +1 -1
  231. package/dist/src/gateway/session-reset-service.js +1 -1
  232. package/dist/src/gateway/xopc-cloud-capability-setup.js +1 -1
  233. package/dist/src/home-intelligence/host.js +2 -2
  234. package/dist/src/local-apps/service.js +2 -2
  235. package/dist/src/notifications/planner.js +32 -0
  236. package/dist/src/notifications/service.d.ts +2 -0
  237. package/dist/src/personal-agent/capability-service.js +3 -2
  238. package/dist/src/personal-agent/communication.d.ts +3 -2
  239. package/dist/src/personal-agent/communication.js +4 -3
  240. package/dist/src/personal-agent/conversation-state.d.ts +5 -0
  241. package/dist/src/personal-agent/conversation-state.js +17 -0
  242. package/dist/src/personal-agent/notifications.d.ts +4 -0
  243. package/dist/src/personal-agent/notifications.js +40 -0
  244. package/dist/src/personal-agent/persona.d.ts +6 -0
  245. package/dist/src/personal-agent/persona.js +16 -0
  246. package/dist/src/personal-agent/policy.d.ts +3 -1
  247. package/dist/src/personal-agent/policy.js +28 -6
  248. package/dist/src/personal-agent/proactivity/automation.d.ts +3 -0
  249. package/dist/src/personal-agent/proactivity/automation.js +41 -0
  250. package/dist/src/personal-agent/proactivity/follow-up-request.d.ts +5 -0
  251. package/dist/src/personal-agent/proactivity/follow-up-request.js +44 -0
  252. package/dist/src/personal-agent/proactivity/repository.d.ts +128 -0
  253. package/dist/src/personal-agent/proactivity/repository.js +403 -0
  254. package/dist/src/personal-agent/proactivity/routes.d.ts +3 -0
  255. package/dist/src/personal-agent/proactivity/routes.js +182 -0
  256. package/dist/src/personal-agent/proactivity/service.d.ts +32 -0
  257. package/dist/src/personal-agent/proactivity/service.js +496 -0
  258. package/dist/src/personal-agent/prompt-context.d.ts +10 -0
  259. package/dist/src/personal-agent/prompt-context.js +119 -0
  260. package/dist/src/personal-agent/prompts.d.ts +7 -0
  261. package/dist/src/personal-agent/prompts.js +135 -0
  262. package/dist/src/personal-agent/reply-composer.d.ts +1 -1
  263. package/dist/src/personal-agent/reply-composer.js +41 -13
  264. package/dist/src/personal-agent/repository.d.ts +1 -1
  265. package/dist/src/personal-agent/repository.js +1 -1
  266. package/dist/src/personal-agent/request-delivery.js +1 -1
  267. package/dist/src/personal-agent/request-service.js +2 -2
  268. package/dist/src/personal-agent/service.d.ts +1 -2
  269. package/dist/src/personal-agent/service.js +5 -93
  270. package/dist/src/personal-agent/specialist-capabilities.d.ts +9 -0
  271. package/dist/src/personal-agent/specialist-capabilities.js +37 -0
  272. package/dist/src/personal-agent/unread.d.ts +10 -0
  273. package/dist/src/personal-agent/unread.js +43 -0
  274. package/dist/src/providers/env-keys.js +6 -0
  275. package/dist/src/providers/model-catalog-persistence.js +3 -22
  276. package/dist/src/providers/model-catalog-store.js +1 -8
  277. package/dist/src/providers/model-catalog-types.d.ts +1 -9
  278. package/dist/src/providers/xopc-cloud-model-source.js +4 -25
  279. package/dist/src/session/client-history.d.ts +2 -0
  280. package/dist/src/session/client-history.js +26 -0
  281. package/dist/src/session/init-session-turn.js +10 -0
  282. package/dist/src/session/session-context-for-llm.js +28 -0
  283. package/dist/src/session/store.js +1 -1
  284. package/dist/src/storage/sqlite/migrations/235_personal_conversation_priority.sql +3 -0
  285. package/dist/src/storage/sqlite/migrations/236_personal_proactivity.sql +53 -0
  286. package/dist/src/storage/sqlite/migrations/237_personal_strategy_versions.sql +18 -0
  287. package/dist/src/storage/sqlite/migrations/runner.d.ts +1 -1
  288. package/dist/src/storage/sqlite/migrations/runner.js +3 -3
  289. package/dist/src/storage/sqlite/schema.js +1 -1
  290. package/dist/src/storage/sqlite/session-input-repository.d.ts +2 -0
  291. package/dist/src/storage/sqlite/session-input-repository.js +18 -5
  292. package/dist/src/tasks/capabilities/read.js +2 -2
  293. package/dist/src/tasks/execution-context.js +1 -1
  294. package/dist/src/tasks/home-query-service.js +27 -1
  295. package/dist/src/tasks/task-main-update-decision-service.js +1 -1
  296. package/dist/src/tasks/task-result-delivery-service.js +1 -1
  297. package/dist/src/tui/backends/embedded-backend.js +1 -1
  298. package/dist/src/voice/platform-catalog.d.ts +1 -9
  299. package/dist/src/voice/realtime/agentEngine.js +32 -7
  300. package/dist/src/voice/realtime/engine.d.ts +1 -0
  301. package/dist/src/voice/realtime/omniEngine.d.ts +1 -0
  302. package/dist/src/voice/realtime/omniEngine.js +10 -0
  303. package/dist/src/voice/realtime/persona-context.js +1 -1
  304. package/dist/src/voice/realtime/runtime.d.ts +1 -0
  305. package/dist/src/voice/realtime/runtime.js +5 -0
  306. package/dist/src/voice/realtime/runtime.types.d.ts +2 -0
  307. package/dist/src/work-discovery/service.js +1 -1
  308. package/dist/src/workflows/service/workflow-run-service.js +1 -1
  309. package/package.json +4 -3
  310. package/dist/gateway/static/root/assets/agent-defaults-settings-panel-wYj-iyqv.js +0 -1
  311. package/dist/gateway/static/root/assets/agent-plugin-dialog-C9HYMhnJ.js +0 -1
  312. package/dist/gateway/static/root/assets/agents-hPkFQ81z.js +0 -66
  313. package/dist/gateway/static/root/assets/app-link-DRL0YnPs.js +0 -1
  314. package/dist/gateway/static/root/assets/automations-workspace-Ch0ViAJW.js +0 -7
  315. package/dist/gateway/static/root/assets/binary-plugins-J51oS7-D.js +0 -2
  316. package/dist/gateway/static/root/assets/browser-settings-page-CYrPA-Fp.js +0 -3
  317. package/dist/gateway/static/root/assets/capabilities-CT_ZW9fT.js +0 -1
  318. package/dist/gateway/static/root/assets/capabilities-page-dW6FXtOy.js +0 -2
  319. package/dist/gateway/static/root/assets/channels-Dx5T2G73.js +0 -1
  320. package/dist/gateway/static/root/assets/computer-settings-page-6FWwxYLe.js +0 -1
  321. package/dist/gateway/static/root/assets/connectors-page-DgDLaws0.js +0 -2
  322. package/dist/gateway/static/root/assets/date-picker-BDcwEaIx.js +0 -1
  323. package/dist/gateway/static/root/assets/gateway-realtime-store-DBvCRclh.js +0 -1
  324. package/dist/gateway/static/root/assets/gateway-settings-BVfz4Tla.js +0 -1
  325. package/dist/gateway/static/root/assets/home-page-BF_9C9yW.js +0 -1
  326. package/dist/gateway/static/root/assets/index-BpXej9jJ.js +0 -106
  327. package/dist/gateway/static/root/assets/index-CbJNcWAn.css +0 -1
  328. package/dist/gateway/static/root/assets/local-app-workbench-page-CytNu0-_.js +0 -1
  329. package/dist/gateway/static/root/assets/local-session-drafts-gbemPamv.js +0 -1
  330. package/dist/gateway/static/root/assets/logs-page-D4aXtitd.js +0 -2
  331. package/dist/gateway/static/root/assets/management-settings-CRzWi_iJ.js +0 -1
  332. package/dist/gateway/static/root/assets/markdown-view-DQZ51j9e.js +0 -201
  333. package/dist/gateway/static/root/assets/messages-BHvpZNe9.js +0 -3
  334. package/dist/gateway/static/root/assets/note-detail-panel-BgbByI-4.js +0 -5
  335. package/dist/gateway/static/root/assets/notes-page-R2BX5XCE.js +0 -8
  336. package/dist/gateway/static/root/assets/personal-page-F0jTBWva.js +0 -1
  337. package/dist/gateway/static/root/assets/product-open-page-BtDK68qb.js +0 -1
  338. package/dist/gateway/static/root/assets/project-detail-page-DmQEm0yH.js +0 -1
  339. package/dist/gateway/static/root/assets/projects-page-CrLQvkHX.js +0 -1
  340. package/dist/gateway/static/root/assets/remote-access-hub-C25_hQAd.js +0 -1
  341. package/dist/gateway/static/root/assets/scenes-page-DM64yMnx.js +0 -2
  342. package/dist/gateway/static/root/assets/secret-input-DPl3VYM8.js +0 -1
  343. package/dist/gateway/static/root/assets/session-manager-CMGUwtbN.js +0 -16
  344. package/dist/gateway/static/root/assets/sessions-page-DvDO8LtA.js +0 -1
  345. package/dist/gateway/static/root/assets/settings-advanced-gate-BNhgbmcX.js +0 -1
  346. package/dist/gateway/static/root/assets/setup-status-panel-10bMi6yL.js +0 -1
  347. package/dist/gateway/static/root/assets/skills-page-D52pEr5x.js +0 -2
  348. package/dist/gateway/static/root/assets/task-detail-page-D-tcS2bS.js +0 -2
  349. package/dist/gateway/static/root/assets/tracing-settings-page-DoBJ0TYY.js +0 -1
  350. package/dist/gateway/static/root/assets/use-composer-attachments-DB0bBGzZ.js +0 -2
  351. package/dist/gateway/static/root/assets/user-model-page-CSh61kZ5.js +0 -2
  352. package/dist/gateway/static/root/assets/workflows-page-BrD9vXqO.js +0 -6
  353. package/dist/gateway/static/root/assets/workspace-api-Cs4sjV2A.js +0 -2
  354. package/dist/src/agent/image/generation/normalization.d.ts +0 -38
  355. package/dist/src/agent/image/generation/normalization.js +0 -181
  356. package/dist/src/agent/image/generation/providers/dashscope.d.ts +0 -35
  357. package/dist/src/agent/image/generation/providers/dashscope.js +0 -257
  358. package/dist/src/agent/image/generation/providers/fal.d.ts +0 -15
  359. package/dist/src/agent/image/generation/providers/fal.js +0 -323
  360. package/dist/src/agent/image/generation/providers/google.d.ts +0 -16
  361. package/dist/src/agent/image/generation/providers/google.js +0 -244
  362. package/dist/src/agent/image/generation/providers/minimax.d.ts +0 -23
  363. package/dist/src/agent/image/generation/providers/minimax.js +0 -215
  364. package/dist/src/agent/image/generation/providers/openai.d.ts +0 -5
  365. package/dist/src/agent/image/generation/providers/openai.js +0 -134
@@ -0,0 +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-BgSdSbCL.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"./cn-JdwAhgNB.js";import{c as d,n as f}from"./locale-store-C8TMD2gn.js";import{i as p}from"./vendor-swr-BIWyz7Rc.js";import{t as ee}from"./button-CS04eWY9.js";import{r as m}from"./gateway-config-swr-Cjnkle5J.js";import{n as h,t as g}from"./registry-api-AdnxowbH.js";import{t as _}from"./skeleton-BwbyijEw.js";import{t as v}from"./electron-env-Dit0bHgy.js";import{Ac as y,Eo as b,Kr as x,Mc as te,Ur as S,Vo as C,Vs as w,dn as T,ko as E,un as D,v as O,ys as ne}from"./index-BQgqzhQj.js";import{n as k,r as A}from"./settings-page-layout-X1x-2Cp9.js";import{n as j,t as M}from"./use-autosave-CRFefpzO.js";import{s as N}from"./voice-config-api-DLudE9Rc.js";import{t as re}from"./fallback-models-CKv_Wqg8.js";import{r as P}from"./image-generation-api-NLHzm4Nc.js";var F=e(t(),1),ie=n(),I=r(),L={"xopc-cloud":`XOPC Cloud`,alibaba:`Alibaba Cloud`,edge:`Microsoft Edge`,groq:`Groq`,minimax:`MiniMax`,openai:`OpenAI`};function R(e,t,n){let r=e?.[t]?.[n];return typeof r==`string`&&r.trim()?r.trim():void 0}function z(e){return L[e]??e}function B(e){let t=(0,ie.c)(17),{icon:n,label:r,enabled:i,details:a,zh:o}=e,s;t[0]===n?s=t[1]:(s=(0,I.jsx)(`div`,{className:`rounded-lg bg-accent/10 p-2 text-accent`,children:(0,I.jsx)(n,{className:`size-4`,"aria-hidden":!0})}),t[0]=n,t[1]=s);let c;t[2]===r?c=t[3]:(c=(0,I.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,I.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,I.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,I.jsx)(`p`,{className:`mt-1 truncate text-xs text-fg-muted`,children:f}),t[9]=f,t[10]=p);let ee;t[11]!==d||t[12]!==p?(ee=(0,I.jsxs)(`div`,{className:`min-w-0`,children:[d,p]}),t[11]=d,t[12]=p,t[13]=ee):ee=t[13];let m;return t[14]!==s||t[15]!==ee?(m=(0,I.jsxs)(`div`,{className:`flex items-start gap-3 rounded-xl bg-surface-base/55 p-4`,children:[s,ee]}),t[14]=s,t[15]=ee,t[16]=m):m=t[16],m}function V(e){let t=(0,ie.c)(27),{zh:n}=e,{data:r,error:a,isLoading:o}=m(!0),c=r?.payload?.config,l,u,d;if(t[0]!==c){d=c===void 0?void 0:N(c);let e=d?R(d.stt.providers,d.stt.provider,`model`):void 0,n=d?R(d.tts.providers,d.tts.provider,`model`):void 0,r=d?R(d.tts.providers,d.tts.provider,`voice`):void 0;l=d?[z(d.stt.provider),e].filter(Boolean).join(` · `):void 0,u=d?[z(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`,h;t[4]===p?h=t[5]:(h=(0,I.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:p}),t[4]=p,t[5]=h);let g=n?`语音识别和朗读由所有智能体共用,在语音设置中统一管理。`:`STT and TTS are shared by every agent and managed in global voice settings.`,v;t[6]===g?v=t[7]:(v=(0,I.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:g}),t[6]=g,t[7]=v);let b;t[8]!==h||t[9]!==v?(b=(0,I.jsxs)(`div`,{children:[h,v]}),t[8]=h,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,I.jsx)(te,{className:`size-4`,"aria-hidden":!0}),t[11]=S):S=t[11];let C;t[12]===x?C=t[13]:(C=(0,I.jsx)(ee,{asChild:!0,variant:`secondary`,className:`shrink-0`,children:(0,I.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,I.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,I.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,I.jsxs)(`div`,{className:`mt-4 grid gap-3 sm:grid-cols-2`,children:[(0,I.jsx)(_,{className:`h-20 rounded-xl`}),(0,I.jsx)(_,{className:`h-20 rounded-xl`})]}):(0,I.jsxs)(`div`,{className:`mt-4 grid gap-3 sm:grid-cols-2`,children:[(0,I.jsx)(B,{icon:s,label:n?`语音转文字(STT)`:`Speech to text (STT)`,enabled:d.stt.enabled,details:l,zh:n}),(0,I.jsx)(B,{icon:y,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 E;return t[24]!==w||t[25]!==T?(E=(0,I.jsxs)(`section`,{className:`rounded-xl bg-surface-hover/20 p-5`,children:[w,T]}),t[24]=w,t[25]=T,t[26]=E):E=t[26],E}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,ie.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=p(g,h,a),s;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(s={revalidateOnFocus:!1},t[1]=s):s=t[1];let c=p(`agent-defaults-image-models`,P,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 m=f,_=i?W.zh:W.en,v;t[8]!==n||t[9]!==r?(v=(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]=v):v=t[10];let y=v,b=i?`默认对话模型`:`Default conversation model`,x;t[11]===b?x=t[12]:(x=(0,I.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:b}),t[11]=b,t[12]=x);let te=i?`大多数对话和没有专用路由的任务都会使用它。`:`Used for most conversations and every task without a dedicated route.`,C;t[13]===te?C=t[14]:(C=(0,I.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:te}),t[13]=te,t[14]=C);let w;t[15]!==C||t[16]!==x?(w=(0,I.jsxs)(`div`,{children:[x,C]}),t[15]=C,t[16]=x,t[17]=w):w=t[17];let T=i?`主模型`:`Primary model`,E;t[18]===T?E=t[19]:(E=(0,I.jsx)(`label`,{className:`block text-xs font-medium text-fg-muted`,children:T}),t[18]=T,t[19]=E);let D=i?`选择模型`:`Select a model`,O=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]!==D||t[25]!==O||t[26]!==ne||t[27]!==k||t[28]!==A?(j=(0,I.jsx)(S,{value:n.models.chat.primary,placeholder:D,searchPlaceholder:O,noMatches:ne,showProviderSettingsFooter:!0,contentAlign:`start`,className:`mt-2 w-full`,ariaLabel:k,onChange:A}),t[23]=n.models.chat.primary,t[24]=D,t[25]=O,t[26]=ne,t[27]=k,t[28]=A,t[29]=j):j=t[29];let M;t[30]!==E||t[31]!==j?(M=(0,I.jsxs)(`div`,{className:`mt-5 max-w-xl`,children:[E,j]}),t[30]=E,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 F;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?(F=(0,I.jsx)(`div`,{className:`mt-6 rounded-xl bg-surface-base/45 p-4`,children:(0,I.jsx)(re,{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]=F):F=t[43];let L;t[44]!==w||t[45]!==M||t[46]!==F?(L=(0,I.jsxs)(`section`,{className:`rounded-xl bg-surface-hover/20 p-5`,children:[w,M,F]}),t[44]=w,t[45]=M,t[46]=F,t[47]=L):L=t[47];let R=i?`图片能力`:`Image capabilities`,z;t[48]===R?z=t[49]:(z=(0,I.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:R}),t[48]=R,t[49]=z);let B=i?`没有图片任务时可以保持关闭。`:`Leave these off when the agents do not work with images.`,G;t[50]===B?G=t[51]:(G=(0,I.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:B}),t[50]=B,t[51]=G);let q=i?`图片理解模型`:`Image understanding model`,J;t[52]===q?J=t[53]:(J=(0,I.jsx)(`label`,{className:`block text-xs font-medium text-fg-muted`,children:q}),t[52]=q,t[53]=J);let Y=n.models.imageUnderstanding?.primary??``,X=i?`关闭图片理解`:`Image understanding off`,Z=i?`搜索视觉模型`:`Search vision models`,Q=i?`没有可用的视觉模型`:`No vision models available`,oe=i?`关闭图片理解`:`Image understanding off`,se=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]!==Y||t[58]!==X||t[59]!==Z||t[60]!==Q||t[61]!==oe||t[62]!==se||t[63]!==ce?(le=(0,I.jsx)(S,{value:Y,placeholder:X,searchPlaceholder:Z,noMatches:Q,capabilitiesFilter:`vision`,allowEmpty:!0,emptyLabel:oe,contentAlign:`start`,className:`mt-2 w-full`,ariaLabel:se,onChange:ce}),t[57]=Y,t[58]=X,t[59]=Z,t[60]=Q,t[61]=oe,t[62]=se,t[63]=ce,t[64]=le):le=t[64];let ue;t[65]!==J||t[66]!==le?(ue=(0,I.jsxs)(`div`,{children:[J,le]}),t[65]=J,t[66]=le,t[67]=ue):ue=t[67];let de=i?`图片生成模型`:`Image generation model`,fe;t[68]===de?fe=t[69]:(fe=(0,I.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]!==m||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,I.jsx)(S,{value:pe,models:m,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]=m,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,I.jsxs)(`div`,{children:[fe,be]}),t[84]=fe,t[85]=be,t[86]=$):$=t[86];let xe;t[87]!==ue||t[88]!==$?(xe=(0,I.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,I.jsxs)(`div`,{className:`mt-5 grid gap-4 rounded-xl bg-surface-base/45 p-4 sm:grid-cols-2`,children:[(0,I.jsxs)(`label`,{className:`block text-xs font-medium text-fg-muted`,children:[i?`生成超时(毫秒)`:`Generation timeout (ms)`,(0,I.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,I.jsxs)(`div`,{className:`text-xs font-medium text-fg-muted`,children:[(0,I.jsx)(`span`,{children:i?`服务商自动回退`:`Automatic provider fallback`}),(0,I.jsx)(`div`,{className:`mt-1.5 flex rounded-lg bg-surface-panel p-1`,children:[!0,!1].map(e=>(0,I.jsx)(ee,{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]!==G||t[96]!==xe||t[97]!==Se?(Ce=(0,I.jsxs)(`section`,{className:`rounded-xl bg-surface-hover/20 p-5`,children:[z,G,xe,Se]}),t[94]=z,t[95]=G,t[96]=xe,t[97]=Se,t[98]=Ce):Ce=t[98];let we;t[99]===i?we=t[100]:(we=(0,I.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,I.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,I.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:De}),t[103]=De,t[104]=Oe);let ke;t[105]!==_||t[106]!==n.models.intents||t[107]!==y||t[108]!==i?(ke=H.map(e=>(0,I.jsxs)(`div`,{className:`rounded-xl bg-surface-base/55 p-4`,children:[(0,I.jsxs)(`div`,{className:`mb-3`,children:[(0,I.jsx)(`h3`,{className:`text-sm font-medium text-fg`,children:_[e][0]}),(0,I.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-muted`,children:_[e][1]})]}),(0,I.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?`${_[e][0]}模型`:`${_[e][0]} model`,onChange:t=>y(e,t)})]},e)),t[105]=_,t[106]=n.models.intents,t[107]=y,t[108]=i,t[109]=ke):ke=t[109];let Ae;t[110]===ke?Ae=t[111]:(Ae=(0,I.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,I.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]!==L||t[117]!==Ce||t[118]!==we||t[119]!==je?(Me=(0,I.jsxs)(`div`,{className:`space-y-5`,children:[L,Ce,we,je]}),t[116]=L,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,ie.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=p(`agent-defaults-workflows`,O,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 d=l,f=n.workflows.allowed===void 0,m;t[5]!==n||t[6]!==r?(m=(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]=m):m=t[7];let h=m,g=i?`执行限制`:`Execution limits`,_;t[8]===g?_=t[9]:(_=(0,I.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:g}),t[8]=g,t[9]=_);let v=i?`为所有智能体设置安全上限;留空时使用系统默认值。`:`Set safe upper bounds for every agent. Empty fields use system defaults.`,y;t[10]===v?y=t[11]:(y=(0,I.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:v}),t[10]=v,t[11]=y);let b=i?`每次运行最多轮数`:`Maximum turns per run`,x=n.runtime.maxTurns??``,te=i?`系统默认`:`System default`,S;t[12]!==n||t[13]!==r?(S=e=>r({...n,runtime:{...n.runtime,maxTurns:J(e.target.value)}}),t[12]=n,t[13]=r,t[14]=S):S=t[14];let C;t[15]!==x||t[16]!==te||t[17]!==S?(C=(0,I.jsx)(`input`,{type:`number`,min:1,value:x,placeholder:te,onChange:S,className:`${q} mt-2`}),t[15]=x,t[16]=te,t[17]=S,t[18]=C):C=t[18];let w;t[19]!==C||t[20]!==b?(w=(0,I.jsxs)(`label`,{className:`block text-xs font-medium text-fg-muted`,children:[b,C]}),t[19]=C,t[20]=b,t[21]=w):w=t[21];let T=i?`单轮超时(毫秒)`:`Turn timeout (ms)`,E=n.runtime.timeoutMs??``,D=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]!==E||t[26]!==D||t[27]!==ne?(k=(0,I.jsx)(`input`,{type:`number`,min:1,value:E,placeholder:D,onChange:ne,className:`${q} mt-2`}),t[25]=E,t[26]=D,t[27]=ne,t[28]=k):k=t[28];let A;t[29]!==T||t[30]!==k?(A=(0,I.jsxs)(`label`,{className:`block text-xs font-medium text-fg-muted`,children:[T,k]}),t[29]=T,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`,re;t[32]!==n||t[33]!==r?(re=e=>r({...n,runtime:{...n.runtime,maxToolFailuresPerTurn:J(e.target.value)}}),t[32]=n,t[33]=r,t[34]=re):re=t[34];let P;t[35]!==M||t[36]!==N||t[37]!==re?(P=(0,I.jsx)(`input`,{type:`number`,min:1,value:M,placeholder:N,onChange:re,className:`${q} mt-2`}),t[35]=M,t[36]=N,t[37]=re,t[38]=P):P=t[38];let F;t[39]!==j||t[40]!==P?(F=(0,I.jsxs)(`label`,{className:`block text-xs font-medium text-fg-muted`,children:[j,P]}),t[39]=j,t[40]=P,t[41]=F):F=t[41];let L;t[42]!==w||t[43]!==A||t[44]!==F?(L=(0,I.jsxs)(`div`,{className:`mt-5 grid gap-4 md:grid-cols-3`,children:[w,A,F]}),t[42]=w,t[43]=A,t[44]=F,t[45]=L):L=t[45];let R;t[46]!==L||t[47]!==_||t[48]!==y?(R=(0,I.jsxs)(`section`,{className:`rounded-xl bg-surface-hover/20 p-5`,children:[_,y,L]}),t[46]=L,t[47]=_,t[48]=y,t[49]=R):R=t[49];let z=i?`提示词缓存`:`Prompt cache`,B;t[50]===z?B=t[51]:(B=(0,I.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:z}),t[50]=z,t[51]=B);let V=i?`复用稳定的上下文以降低响应延迟和模型费用。`:`Reuse stable context to reduce latency and model cost.`,H;t[52]===V?H=t[53]:(H=(0,I.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,I.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,I.jsx)(`div`,{className:`mt-1.5 flex rounded-lg bg-surface-panel p-1`,children:ae.map(e=>(0,I.jsx)(ee,{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 K;t[61]!==W||t[62]!==G?(K=(0,I.jsxs)(`div`,{className:`text-xs font-medium text-fg-muted`,children:[W,G]}),t[61]=W,t[62]=G,t[63]=K):K=t[63];let Y;t[64]!==n||t[65]!==r||t[66]!==i?(Y=n.runtime.promptCache?.mode===`auto`?(0,I.jsxs)(`div`,{className:`text-xs font-medium text-fg-muted`,children:[(0,I.jsx)(`span`,{children:i?`缓存周期`:`Cache lifetime`}),(0,I.jsx)(`div`,{className:`mt-1.5 flex rounded-lg bg-surface-panel p-1`,children:[`short`,`long`].map(e=>(0,I.jsx)(ee,{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]=Y):Y=t[67];let Z;t[68]!==K||t[69]!==Y?(Z=(0,I.jsxs)(`div`,{className:`mt-5 grid gap-4 sm:grid-cols-2`,children:[K,Y]}),t[68]=K,t[69]=Y,t[70]=Z):Z=t[70];let Q;t[71]!==B||t[72]!==H||t[73]!==Z?(Q=(0,I.jsxs)(`section`,{className:`rounded-xl bg-surface-hover/20 p-5`,children:[B,H,Z]}),t[71]=B,t[72]=H,t[73]=Z,t[74]=Q):Q=t[74];let oe=i?`工作流`:`Workflows`,se;t[75]===oe?se=t[76]:(se=(0,I.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:oe}),t[75]=oe,t[76]=se);let ce=i?`设置默认工作流,并决定智能体可以调用哪些工作流。`:`Set a default workflow and control which workflows agents may invoke.`,le;t[77]===ce?le=t[78]:(le=(0,I.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,I.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]!==d||t[90]!==s.isLoading?(_e=(0,I.jsx)(a,{value:fe,options:d,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]=d,t[90]=s.isLoading,t[91]=_e):_e=t[91];let ve;t[92]!==de||t[93]!==_e?(ve=(0,I.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,I.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,I.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=u(`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,I.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,I.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,I.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=u(`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,I.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,I.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,I.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,I.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]!==h||t[133]!==s.data||t[134]!==s.isLoading||t[135]!==i?(Re=f?null:(0,I.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,I.jsxs)(`label`,{className:`flex cursor-pointer items-start gap-3 px-4 py-3 hover:bg-surface-hover/60`,children:[(0,I.jsx)(`input`,{type:`checkbox`,checked:n.workflows.allowed?.includes(e.id)??!1,onChange:t=>h(e.id,t.target.checked),className:`mt-0.5 size-4 accent-[var(--color-accent)]`}),(0,I.jsxs)(`span`,{children:[(0,I.jsx)(`span`,{className:`block text-sm font-medium text-fg`,children:e.title||e.name}),e.description?(0,I.jsx)(`span`,{className:`mt-1 block text-xs text-fg-muted`,children:e.description}):null]})]},e.id)),(s.data??[]).length===0&&!s.isLoading?(0,I.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]=h,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,I.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]!==se||t[142]!==le||t[143]!==ve||t[144]!==ye||t[145]!==ze?(Be=(0,I.jsxs)(`section`,{className:`rounded-xl bg-surface-hover/20 p-5`,children:[se,le,ve,ye,ze]}),t[141]=se,t[142]=le,t[143]=ve,t[144]=ye,t[145]=ze,t[146]=Be):Be=t[146];let Ve;return t[147]!==R||t[148]!==Q||t[149]!==Be?(Ve=(0,I.jsxs)(`div`,{className:`space-y-5`,children:[R,Q,Be]}),t[147]=R,t[148]=Q,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 Q=[{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 oe(e){let t=(0,ie.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:d}=p(`agent-defaults-skills-catalog`,x,a),[f,ee]=(0,F.useState)(``),m=n.skills.mode===`selected`?n.skills.include:n.skills.exclude;s?.catalog;let h;if(t[1]!==m||t[2]!==s?.catalog||t[3]!==f){let e=[...s?.catalog??[]],n=new Set(e.map(de));for(let t of m)n.has(t)||e.push({name:t,description:``,enabled:!0});let r=f.trim().toLowerCase();h=e.filter(e=>!r||`${e.name} ${e.description}`.toLowerCase().includes(r)).sort(ue),t[1]=m,t[2]=s?.catalog,t[3]=f,t[4]=h}else h=t[4];let g=h,_;t[5]!==n.skills.exclude||t[6]!==n.skills.include||t[7]!==n.skills.mode?(_=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]=_):_=t[8];let v=_,y;t[9]!==n||t[10]!==r?(y=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]=y):y=t[11];let b=y,te;t[12]===s?.catalog?te=t[13]:(te=s?.catalog??[],t[12]=s?.catalog,t[13]=te);let S;if(t[14]!==v||t[15]!==te){let e;t[17]===v?e=t[18]:(e=e=>e.enabled&&v(e.name),t[17]=v,t[18]=e),S=te.filter(e),t[14]=v,t[15]=te,t[16]=S}else S=t[16];let C=S.length,w;t[19]!==s?.catalog||t[20]!==n||t[21]!==r?(w=e=>{let t=new Set((s?.catalog??[]).filter(le).map(ce));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]=w):w=t[22];let T=w,E=i?`技能策略`:`Skill policy`,D;t[23]===E?D=t[24]:(D=(0,I.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:E}),t[23]=E,t[24]=D);let O=i?`决定所有智能体默认可以使用哪些技能。`:`Choose which skills every agent can discover and use by default.`,k;t[25]===O?k=t[26]:(k=(0,I.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:O}),t[25]=O,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=u(`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,I.jsx)(o,{className:`mt-0.5 size-5 shrink-0 text-accent`}),t[32]=N):N=t[32];let re=i?`使用所有已启用技能`:`Use every enabled skill`,P;t[33]===re?P=t[34]:(P=(0,I.jsx)(`span`,{className:`block text-sm font-medium text-fg`,children:re}),t[33]=re,t[34]=P);let L=i?`适合需要完整目录的高级智能体;新增技能会自动加入。`:`For advanced agents that need the full catalog; newly enabled skills are added automatically.`,R;t[35]===L?R=t[36]:(R=(0,I.jsx)(`span`,{className:`mt-1 block text-xs leading-5 text-fg-muted`,children:L}),t[35]=L,t[36]=R);let z;t[37]!==P||t[38]!==R?(z=(0,I.jsxs)(`span`,{children:[P,R]}),t[37]=P,t[38]=R,t[39]=z):z=t[39];let B;t[40]!==A||t[41]!==M||t[42]!==z?(B=(0,I.jsxs)(`button`,{type:`button`,onClick:A,className:M,children:[N,z]}),t[40]=A,t[41]=M,t[42]=z,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=u(`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,I.jsx)(ne,{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,I.jsx)(`span`,{className:`block text-sm font-medium text-fg`,children:ae}),t[50]=ae,t[51]=G);let K=i?`适合严格受控的环境;新增技能不会自动加入。`:`For tightly controlled environments; new skills are not added automatically.`,q;t[52]===K?q=t[53]:(q=(0,I.jsx)(`span`,{className:`mt-1 block text-xs leading-5 text-fg-muted`,children:K}),t[52]=K,t[53]=q);let J;t[54]!==G||t[55]!==q?(J=(0,I.jsxs)(`span`,{children:[G,q]}),t[54]=G,t[55]=q,t[56]=J):J=t[56];let Y;t[57]!==V||t[58]!==U||t[59]!==J?(Y=(0,I.jsxs)(`button`,{type:`button`,onClick:V,className:U,children:[W,J]}),t[57]=V,t[58]=U,t[59]=J,t[60]=Y):Y=t[60];let X;t[61]!==B||t[62]!==Y?(X=(0,I.jsxs)(`div`,{className:`mt-5 grid gap-3 sm:grid-cols-2`,children:[B,Y]}),t[61]=B,t[62]=Y,t[63]=X):X=t[63];let oe=i?`能力组合(会替换当前选择)`:`Capability packs (replaces the current selection)`,fe;t[64]===oe?fe=t[65]:(fe=(0,I.jsx)(`p`,{className:`text-xs font-medium text-fg-muted`,children:oe}),t[64]=oe,t[65]=fe);let pe;t[66]!==T||t[67]!==s||t[68]!==i?(pe=Q.map(e=>(0,I.jsx)(`button`,{type:`button`,onClick:()=>T(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]=T,t[67]=s,t[68]=i,t[69]=pe):pe=t[69];let me;t[70]===pe?me=t[71]:(me=(0,I.jsx)(`div`,{className:`mt-2 flex flex-wrap gap-2`,children:pe}),t[70]=pe,t[71]=me);let he;t[72]!==fe||t[73]!==me?(he=(0,I.jsxs)(`div`,{className:`mt-4`,children:[fe,me]}),t[72]=fe,t[73]=me,t[74]=he):he=t[74];let ge;t[75]!==k||t[76]!==X||t[77]!==he||t[78]!==D?(ge=(0,I.jsxs)(`section`,{className:`rounded-xl bg-surface-hover/20 p-5`,children:[D,k,X,he]}),t[75]=k,t[76]=X,t[77]=he,t[78]=D,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,I.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:_e}),t[80]=_e,t[81]=ve);let ye=i?`当前默认可用 ${C} 个技能。`:`${C} skills are available by default.`,be;t[82]===ye?be=t[83]:(be=(0,I.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,I.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,I.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,I.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=>ee(e.target.value),t[90]=we):we=t[90];let Te=i?`搜索技能`:`Search skills`,Ee;t[91]!==f||t[92]!==Te?(Ee=(0,I.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,I.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,I.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,I.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]!==v||t[103]!==d||t[104]!==g||t[105]!==b||t[106]!==i?(Ae=d?(0,I.jsx)(`div`,{className:`mt-4 space-y-2`,children:[0,1,2,3].map(se)}):(0,I.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:[g.map(e=>{let t=v(e.name);return(0,I.jsxs)(`label`,{className:u(`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,I.jsx)(`input`,{type:`checkbox`,checked:t,disabled:!e.enabled,onChange:()=>b(e.name),className:`mt-0.5 size-4 rounded border-edge accent-[var(--color-accent)]`}),(0,I.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,I.jsxs)(`span`,{className:`flex flex-wrap items-center gap-2`,children:[(0,I.jsx)(`span`,{className:`text-sm font-medium text-fg`,children:e.name}),e.enabled?null:(0,I.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,I.jsx)(`span`,{className:`mt-1 block line-clamp-2 text-xs leading-5 text-fg-muted`,children:e.description}):null]})]},e.name)}),g.length===0?(0,I.jsx)(`p`,{className:`px-4 py-8 text-center text-sm text-fg-muted`,children:i?`没有匹配的技能。`:`No matching skills.`}):null]}),t[102]=v,t[103]=d,t[104]=g,t[105]=b,t[106]=i,t[107]=Ae):Ae=t[107];let je;t[108]!==Oe||t[109]!==ke||t[110]!==Ae?(je=(0,I.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,I.jsxs)(`div`,{className:`space-y-5`,children:[ge,je]}),t[112]=ge,t[113]=je,t[114]=Me):Me=t[114],Me}function se(e){return(0,I.jsx)(_,{className:`h-14 rounded-xl`},e)}function ce(e){return e.name}function le(e){return e.enabled}function ue(e,t){return e.name.localeCompare(t.name)}function de(e){return e.name}function fe(e){let t=Number.parseInt(e,10);return Number.isFinite(t)&&t>0?t:void 0}function pe(e){let t=(0,ie.c)(92),{draft:n,setDraft:r,builtinTools:i,zh:a}=e,[o,s]=(0,F.useState)(``),[l,d]=(0,F.useState)(`all`),[f,p]=(0,F.useState)(),m;t[0]===i?m=t[1]:(m=new Map(i.map(ge)),t[0]=i,t[1]=m);let h=m,g;t[2]!==i||t[3]!==n.tools?(g=[...new Set([...i.map(he),...Object.keys(n.tools)])].filter(me).sort(),t[2]=i,t[3]=n.tools,t[4]=g):g=t[4];let _=g,v;if(t[5]!==_||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),v=_.filter(e),t[5]=_,t[6]=n.tools,t[7]=v}else v=t[7];let y=v.length,x;if(t[10]!==_||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=_.filter(e),t[10]=_,t[11]=n.tools,t[12]=x}else x=t[12];let te=x.length,S;if(t[15]!==_||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),S=_.filter(e),t[15]=_,t[16]=n.tools,t[17]=S}else S=t[17];let C;t[20]!==v.length||t[21]!==x.length||t[22]!==S.length?(C={allow:y,ask:te,deny:S.length},t[20]=v.length,t[21]=x.length,t[22]=S.length,t[23]=C):C=t[23];let w=C,T;if(t[24]!==_||t[25]!==h||t[26]!==n.tools||t[27]!==l||t[28]!==o){let e=o.trim().toLowerCase();T=_.filter(t=>{let r=n.tools[t]?.mode??`allow`,i=h.get(t),a=`${t} ${i?.en??``} ${i?.zh??``}`.toLowerCase();return(!e||a.includes(e))&&(l===`all`||r===l)}),t[24]=_,t[25]=h,t[26]=n.tools,t[27]=l,t[28]=o,t[29]=T}else T=t[29];let E=T,D;t[30]!==n||t[31]!==r?(D=(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]=D):D=t[32];let O=D,ne=a?`全部 ${_.length}`:`All ${_.length}`,k;t[33]===ne?k=t[34]:(k={id:`all`,label:ne},t[33]=ne,t[34]=k);let A=a?`允许 ${w.allow}`:`Allow ${w.allow}`,j;t[35]===A?j=t[36]:(j={id:`allow`,label:A},t[35]=A,t[36]=j);let M=a?`询问 ${w.ask}`:`Ask ${w.ask}`,N;t[37]===M?N=t[38]:(N={id:`ask`,label:M},t[37]=M,t[38]=N);let re=a?`禁用 ${w.deny}`:`Deny ${w.deny}`,P;t[39]===re?P=t[40]:(P={id:`deny`,label:re},t[39]=re,t[40]=P);let L;t[41]!==k||t[42]!==j||t[43]!==N||t[44]!==P?(L=[k,j,N,P],t[41]=k,t[42]=j,t[43]=N,t[44]=P,t[45]=L):L=t[45];let R=L,z=a?`默认工具权限`:`Default tool permissions`,B;t[46]===z?B=t[47]:(B=(0,I.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:z}),t[46]=z,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,I.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,I.jsxs)(`div`,{children:[B,H]}),t[50]=B,t[51]=H,t[52]=U):U=t[52];let W;t[53]!==l||t[54]!==R?(W=(0,I.jsx)(`div`,{className:`flex flex-wrap gap-1 rounded-xl bg-surface-panel p-1`,children:R.map(e=>(0,I.jsx)(`button`,{type:`button`,onClick:()=>d(e.id),className:u(`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]=R,t[55]=W):W=t[55];let ae=a?`搜索工具`:`Search tools`,G;t[56]===ae?G=t[57]:(G=(0,I.jsx)(`span`,{className:`sr-only`,children:ae}),t[56]=ae,t[57]=G);let K;t[58]===Symbol.for(`react.memo_cache_sentinel`)?(K=(0,I.jsx)(c,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-fg-subtle`}),t[58]=K):K=t[58];let q;t[59]===Symbol.for(`react.memo_cache_sentinel`)?(q=e=>s(e.target.value),t[59]=q):q=t[59];let J=a?`搜索工具`:`Search tools`,Y;t[60]!==o||t[61]!==J?(Y=(0,I.jsx)(`input`,{type:`search`,value:o,onChange:q,placeholder:J,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]=J,t[62]=Y):Y=t[62];let X;t[63]!==G||t[64]!==Y?(X=(0,I.jsxs)(`label`,{className:`relative block w-full sm:w-72`,children:[G,K,Y]}),t[63]=G,t[64]=Y,t[65]=X):X=t[65];let Z;t[66]!==W||t[67]!==X?(Z=(0,I.jsxs)(`div`,{className:`mt-5 flex flex-wrap items-center justify-between gap-3`,children:[W,X]}),t[66]=W,t[67]=X,t[68]=Z):Z=t[68];let Q;if(t[69]!==h||t[70]!==n.tools||t[71]!==f||t[72]!==O||t[73]!==E||t[74]!==a){let e;t[76]!==h||t[77]!==n.tools||t[78]!==f||t[79]!==O||t[80]!==a?(e=e=>{let t=n.tools[e]??{mode:`allow`},r=h.get(e),i=f===e;return(0,I.jsxs)(`div`,{className:`px-4 py-3`,children:[(0,I.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[(0,I.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,I.jsx)(`code`,{className:`text-xs font-medium text-fg`,children:e}),r?(0,I.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:a?r.zh:r.en}):null]}),(0,I.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,I.jsx)(`div`,{className:`flex rounded-lg bg-surface-base p-1`,children:[`allow`,`ask`,`deny`].map(n=>(0,I.jsx)(`button`,{type:`button`,onClick:()=>O(e,{mode:n}),className:u(`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,I.jsx)(ee,{variant:`ghost`,className:`px-2 py-1`,"aria-label":a?`${e} 调用限制`:`${e} call limits`,onClick:()=>p(i?void 0:e),children:(0,I.jsx)(b,{className:`size-4`})})]})]}),i?(0,I.jsxs)(`div`,{className:`mt-3 grid gap-3 rounded-lg bg-surface-base p-3 sm:grid-cols-2`,children:[(0,I.jsxs)(`label`,{className:`block text-xs font-medium text-fg-muted`,children:[a?`每轮最多调用次数`:`Maximum calls per turn`,(0,I.jsx)(`input`,{type:`number`,min:1,value:t.maxCallsPerTurn??``,placeholder:a?`不限制`:`Unlimited`,onChange:t=>O(e,{maxCallsPerTurn:fe(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,I.jsxs)(`label`,{className:`block text-xs font-medium text-fg-muted`,children:[a?`单次超时(毫秒)`:`Call timeout (ms)`,(0,I.jsx)(`input`,{type:`number`,min:1,value:t.timeoutMs??``,placeholder:a?`使用系统默认值`:`Use system default`,onChange:t=>O(e,{timeoutMs:fe(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]=h,t[77]=n.tools,t[78]=f,t[79]=O,t[80]=a,t[81]=e):e=t[81],Q=E.map(e),t[69]=h,t[70]=n.tools,t[71]=f,t[72]=O,t[73]=E,t[74]=a,t[75]=Q}else Q=t[75];let oe;t[82]!==E.length||t[83]!==a?(oe=E.length===0?(0,I.jsx)(`p`,{className:`px-4 py-10 text-center text-sm text-fg-muted`,children:a?`没有匹配的工具。`:`No matching tools.`}):null,t[82]=E.length,t[83]=a,t[84]=oe):oe=t[84];let se;t[85]!==Q||t[86]!==oe?(se=(0,I.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:[Q,oe]}),t[85]=Q,t[86]=oe,t[87]=se):se=t[87];let ce;return t[88]!==U||t[89]!==Z||t[90]!==se?(ce=(0,I.jsxs)(`section`,{className:`rounded-xl bg-surface-hover/20 p-5`,children:[U,Z,se]}),t[88]=U,t[89]=Z,t[90]=se,t[91]=ce):ce=t[91],ce}function me(e){return e!==`computer_use`||v()}function he(e){return e.id}function ge(e){return[e.id,e.description]}function _e(){let e=(0,ie.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,I.jsxs)(A,{gap:`gap-5`,children:[(0,I.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,I.jsxs)(`div`,{className:`space-y-2`,children:[(0,I.jsx)(_,{className:`h-7 w-56`}),(0,I.jsx)(_,{className:`h-4 w-96 max-w-full`})]}),(0,I.jsx)(_,{className:`h-9 w-28`})]}),(0,I.jsx)(_,{className:`h-20 rounded-2xl`}),(0,I.jsx)(_,{className:`h-12 rounded-xl`}),(0,I.jsx)(_,{className:`h-72 rounded-2xl`})]}),e[0]=t):t=e[0],t}function ve(e){let t=(0,ie.c)(67),{initial:n,builtinTools:r,zh:i}=e,[a,o]=(0,F.useState)(`models`),s;t[0]===n?s=t[1]:(s=()=>structuredClone(n),t[0]=n,t[1]=s);let[c,d]=(0,F.useState)(s),f;t[2]===n?f=t[3]:(f=()=>structuredClone(n),t[2]=n,t[3]=f);let[p,m]=(0,F.useState)(f),h;t[4]===c?h=t[5]:(h=JSON.stringify(c),t[4]=c,t[5]=h);let g;t[6]===p?g=t[7]:(g=JSON.stringify(p),t[6]=p,t[7]=g);let _=h!==g,v=i?`模型`:`Models`,y;t[8]===v?y=t[9]:(y={id:`models`,label:v,icon:l},t[8]=v,t[9]=y);let b=i?`技能`:`Skills`,x;t[10]===b?x=t[11]:(x={id:`skills`,label:b,icon:C},t[10]=b,t[11]=x);let te=i?`工具`:`Tools`,S;t[12]===te?S=t[13]:(S={id:`tools`,label:te,icon:E},t[12]=te,t[13]=S);let D=i?`运行`:`Runtime`,O;t[14]===D?O=t[15]:(O={id:`runtime`,label:D,icon:w},t[14]=D,t[15]=O);let ne;t[16]!==S||t[17]!==O||t[18]!==y||t[19]!==x?(ne=[y,x,S,O],t[16]=S,t[17]=O,t[18]=y,t[19]=x,t[20]=ne):ne=t[20];let N=ne,re;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(re=async e=>{let t=structuredClone(e),n=await T(t),r=structuredClone(n.defaults);d(e=>JSON.stringify(e)===JSON.stringify(t)?r:e),m(structuredClone(r))},t[21]=re):re=t[21];let P=re,L;t[22]!==_||t[23]!==c?(L={value:c,dirty:_,onSave:P,delayMs:0},t[22]=_,t[23]=c,t[24]=L):L=t[24];let R=M(L),z=R.onBlurCapture,B=i?`智能体设置`:`Agent settings`,V;t[25]!==R.error||t[26]!==R.status?(V=(0,I.jsx)(j,{status:R.status,error:R.error}),t[25]=R.error,t[26]=R.status,t[27]=V):V=t[27];let H;t[28]!==B||t[29]!==V?(H=(0,I.jsx)(k,{title:B,actions:V}),t[28]=B,t[29]=V,t[30]=H):H=t[30];let U;t[31]!==R.error||t[32]!==R.retry||t[33]!==i?(U=R.error?(0,I.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,I.jsx)(`span`,{children:R.error}),(0,I.jsx)(ee,{type:`button`,variant:`ghost`,className:`h-8 text-red-600`,onClick:R.retry,children:i?`重试`:`Retry`})]}):null,t[31]=R.error,t[32]=R.retry,t[33]=i,t[34]=U):U=t[34];let W=i?`默认配置分区`:`Default configuration sections`,ae;t[35]!==a||t[36]!==N?(ae=N.map(e=>{let{id:t,label:n,icon:r}=e;return(0,I.jsxs)(`button`,{type:`button`,"aria-pressed":a===t,onClick:()=>o(t),className:u(`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,I.jsx)(r,{className:u(`size-4 shrink-0`,a===t?`text-accent`:`text-fg-subtle`)}),(0,I.jsx)(`span`,{className:`text-sm font-medium`,children:n})]},t)}),t[35]=a,t[36]=N,t[37]=ae):ae=t[37];let K;t[38]!==W||t[39]!==ae?(K=(0,I.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]=K):K=t[40];let q;t[41]!==a||t[42]!==c||t[43]!==i?(q=a===`models`?(0,I.jsx)(G,{draft:c,setDraft:d,zh:i}):null,t[41]=a,t[42]=c,t[43]=i,t[44]=q):q=t[44];let J;t[45]!==a||t[46]!==c||t[47]!==i?(J=a===`skills`?(0,I.jsx)(oe,{draft:c,setDraft:d,zh:i}):null,t[45]=a,t[46]=c,t[47]=i,t[48]=J):J=t[48];let X;t[49]!==a||t[50]!==r||t[51]!==c||t[52]!==i?(X=a===`tools`?(0,I.jsx)(pe,{draft:c,setDraft:d,builtinTools:r,zh:i}):null,t[49]=a,t[50]=r,t[51]=c,t[52]=i,t[53]=X):X=t[53];let Z;t[54]!==a||t[55]!==c||t[56]!==i?(Z=a===`runtime`?(0,I.jsx)(Y,{draft:c,setDraft:d,zh:i}):null,t[54]=a,t[55]=c,t[56]=i,t[57]=Z):Z=t[57];let Q;return t[58]!==R.onBlurCapture||t[59]!==H||t[60]!==U||t[61]!==K||t[62]!==q||t[63]!==J||t[64]!==X||t[65]!==Z?(Q=(0,I.jsxs)(A,{gap:`gap-5`,onBlurCapture:z,children:[H,U,K,q,J,X,Z]}),t[58]=R.onBlurCapture,t[59]=H,t[60]=U,t[61]=K,t[62]=q,t[63]=J,t[64]=X,t[65]=Z,t[66]=Q):Q=t[66],Q}function ye(){let e=(0,ie.c)(17),t=d($),n=f(be)===`zh`,{data:r,error:i,isLoading:a,mutate:o}=p(t?`settings-agent-defaults`:null,D);if(!t){let t=n?`需要本机服务令牌。`:`Local service token required.`,r;return e[0]===t?r=e[1]:(r=(0,I.jsx)(A,{children:(0,I.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,I.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,I.jsx)(ee,{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,I.jsxs)(A,{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,I.jsx)(_e,{}),e[12]=t):t=e[12],t}let s;return e[13]!==r.builtinTools||e[14]!==r.defaults||e[15]!==n?(s=(0,I.jsx)(ve,{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 be(e){return e.language}function $(e){return e.conversationId}export{ye as AgentDefaultsSettingsPanel};
@@ -0,0 +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-Dy26npMy.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-C8TMD2gn.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-Cjnkle5J.js";import{t as ae}from"./skeleton-BwbyijEw.js";import{At as _,Qs as v,ii as oe,jt as y,ko as b,kt as x,oo as se,vc as S}from"./index-BQgqzhQj.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 ue(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 F(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 I(e){return F(e,`GET`)}function L(e){return F(e,`POST`,`/start`)}function R(e){return F(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)(``),[v,oe]=(0,C.useState)(t.type===`stdio`?`API_KEY`:`Authorization`),[b,se]=(0,C.useState)(t.type===`stdio`?``:`Bearer `),[S,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 I(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(()=>{I(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`&&!S?(0,U.jsx)(ae,{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=y();k(async()=>{try{let n=await L(t.id);if(c(n),n.session?.authorizationUrl){if(!await _(n.session.authorizationUrl,e))throw Error(i?`无法打开授权页面`:`Could not open authorization page`)}else if(x(e),n.session?.error)throw Error(n.session.error)}catch(t){throw x(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:v,value:m,prefix:b}]}),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:v,onChange:e=>oe(e.target.value),required:!0})]}),(0,U.jsxs)(`label`,{className:`block`,children:[i?`前缀(可选)`:`Prefix (optional)`,(0,U.jsx)(`input`,{className:W,value:b,onChange:e=>se(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`),ae=l?.localizations?.[g?`zh-CN`:`en`],_=ae?.displayName??l?.name,y=ae?.description??l?.description,x=(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),[ue,F]=(0,C.useState)(!1),[I,L]=(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??_??(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)(b,{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:_??k?.manifest.name??D.slice(6)}),y?(0,U.jsx)(`p`,{className:`mt-1 text-sm leading-relaxed text-fg-muted`,children:y}):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)(S,{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)(S,{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)(se,{className:`mt-0.5 size-4 shrink-0 text-fg-muted`,"aria-hidden":!0}),(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`label`,{htmlFor:x,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:x,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)(v,{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)(b,{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:I?(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:ue,onChange:e=>F(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:ue}),await J(),t()}),children:g?`确认卸载`:`Confirm uninstall`})]}):(0,U.jsx)(h,{variant:`ghost`,disabled:j,onClick:()=>L(!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)(oe,{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,I as c,H as d,ue as f,T as g,V as h,fe as i,P as l,L as m,_e as n,N as o,me as p,le as r,k as s,K as t,pe as u};
@@ -0,0 +1,66 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/block-editor-BFPUlxJ6.js","assets/rolldown-runtime-aKtaBQYM.js","assets/index-BQgqzhQj.js","assets/preload-helper-zJ_50EbN.js","assets/es2015-DBLcMg5B.js","assets/vendor-react-BOUWij0V.js","assets/dist-CxGUk8J-.js","assets/dist-CI_fqRk-.js","assets/floating-ui.dom-B7uQOZZW.js","assets/markdown-view-Dse7rkio.js","assets/dist-BGTk37IG.js","assets/chunk-KS7C4IRE-BMYIfy9x.js","assets/createLucideIcon-DPHK1VkS.js","assets/download-Dk-ZjtO6.js","assets/plus-Q2yW6OE7.js","assets/x-B_N4OPjy.js","assets/locale-store-C8TMD2gn.js","assets/messages-Dy26npMy.js","assets/cn-JdwAhgNB.js","assets/app-link-4gpFbdsr.js","assets/product-delivery-BAks11S4.js","assets/schemas-CObaziC7.js","assets/local-apps-yys1VChX.js","assets/copy-to-clipboard-HOJ79TWv.js","assets/markdown-view-DSjfHfaW.css","assets/dist-Che_jiQF.js","assets/vendor-swr-BIWyz7Rc.js","assets/activity-YogQEteU.js","assets/bot-DjLkhyZL.js","assets/check-DUBLcKHA.js","assets/chevron-left-DqFhpbvK.js","assets/chevron-right-BweFrslA.js","assets/popover-select-BgSdSbCL.js","assets/dist-C3DSFZCi.js","assets/skeleton-BwbyijEw.js","assets/settings-shell-dialog-layer-BU3UuiJr.js","assets/circle-alert-BEjgurr2.js","assets/circle-check-C23XjkUj.js","assets/circle-dashed-8qMD7gHf.js","assets/circle-dot-BAseJTrF.js","assets/circle-pause-CN9jYH2s.js","assets/clock-3-DnrAnuyZ.js","assets/cloud-C4-yfnnk.js","assets/copy-Dv6d4Dvw.js","assets/ellipsis-0k4rZLoy.js","assets/external-link-DjqjBmc3.js","assets/secret-input-D93UrW4C.js","assets/eye-CABVeTq0.js","assets/loader-circle-CifKLtgG.js","assets/form-field-width-DJw_jULe.js","assets/interaction-BdhHBbYa.js","assets/is-masked-secret-DOkL5b_X.js","assets/use-composer-attachments-OLrvSjn5.js","assets/mic-CuUb7zc-.js","assets/use-file-preview-expanded-CJvzfQvw.js","assets/folder-open-CyzJ19I9.js","assets/link-2-D_ZKYUW7.js","assets/message-square-plus-XP0tGdlV.js","assets/minimize-2-DtOGrlpo.js","assets/pencil-DmIY3Oa-.js","assets/rotate-cw-LIg3Am9S.js","assets/search-DA7gz22f.js","assets/index.module-Cd9ENXfk.js","assets/session-api-_HIN8or3.js","assets/gateway-startup-retry-CXKmdVzN.js","assets/constants-Dy8Gw0sF.js","assets/app-chrome-BeB4KgOf.js","assets/attachment-utils-core-BIOUBrpT.js","assets/workspace-api-CdVUhyPo.js","assets/files-Bw4SBGdM.js","assets/electron-env-Dit0bHgy.js","assets/use-async-resource-GrnWNwMZ.js","assets/activity-store-Cuf3JFFJ.js","assets/share-link-dialog-Dg5os066.js","assets/globe-DSSGFWFn.js","assets/button-CS04eWY9.js","assets/copy-text-row-BHDs3cBa.js","assets/capabilities-BzWFO_x_.js","assets/local-session-drafts-Cvv7I0fw.js","assets/tasks-DwKXgZ-I.js","assets/skill-wire-pattern-BPpeIcCi.js","assets/shares-api-C96IO4qJ.js","assets/capabilities-K0Zb_lH0.js","assets/git-branch-Dh9uxTot.js","assets/notes-api-DKiVeQKG.js","assets/message-square-fVE7Ghj1.js","assets/pause-DuPxgSxk.js","assets/play-kxZvpBg8.js","assets/rotate-ccw-JM1TBLpp.js","assets/settings-2-D-csvaET.js","assets/sparkles-DHlfQFAF.js","assets/middleware-Pd0e8Igk.js","assets/gateway-realtime-DCCLdyQD.js","assets/gateway-realtime-store-C_Th8kGg.js","assets/extension-provider-CX-sK0Tw.js","assets/session-manager-CzCto5zT.js","assets/tool-activity-BtJkgjFf.js","assets/registry-api-AdnxowbH.js","assets/agents-admin-api-D842OcNo.js","assets/gateway-config-swr-Cjnkle5J.js","assets/send-session-input-CgOzhDZ0.js","assets/theme-store-DQ6KJa4l.js","assets/loopi-Djb8XU3l.js","assets/loopi-C09I2mNj.css","assets/models-hub-cache-B1C86nRp.js","assets/oauth-api-BwpzpRwC.js","assets/skill-api-utils-C7V4JVXM.js","assets/date-formatters-CUZAyDEg.js","assets/settings-form-draft-Dy10ldo8.js","assets/index-COB4QIJp.css","assets/vendor-codemirror-DFxP3B9T.js","assets/with-selector-aYPsXwdl.js","assets/note-image-lightbox-1qg2v-9j.js","assets/block-editor-BdOTO0Yo.css","assets/markdown-editor-BhBJANcx.js","assets/code-editor-CXIH8jQw.js","assets/languages-BFe8nIOO.js"])))=>i.map(i=>d[i]);
2
+ import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{t as i}from"./preload-helper-zJ_50EbN.js";import{f as a}from"./chunk-KS7C4IRE-BMYIfy9x.js";import{t as o}from"./bot-DjLkhyZL.js";import{s}from"./popover-select-BgSdSbCL.js";import{t as c}from"./ellipsis-0k4rZLoy.js";import{t as l}from"./eye-CABVeTq0.js";import{t as u}from"./markdown-view-Dse7rkio.js";import{t as d}from"./message-square-plus-XP0tGdlV.js";import{t as f}from"./pencil-DmIY3Oa-.js";import{t as p}from"./plus-Q2yW6OE7.js";import{t as m}from"./rotate-ccw-JM1TBLpp.js";import{t as h}from"./sparkles-DHlfQFAF.js";import{t as g}from"./x-B_N4OPjy.js";import{t as _}from"./messages-Dy26npMy.js";import{t as v}from"./cn-JdwAhgNB.js";import{c as y,n as b}from"./locale-store-C8TMD2gn.js";import{a as x,i as S,n as C,o as w,r as T,s as E,t as D}from"./dist-BGTk37IG.js";import{i as O}from"./vendor-swr-BIWyz7Rc.js";import{t as k}from"./button-CS04eWY9.js";import{n as A}from"./interaction-BdhHBbYa.js";import{n as j,t as M}from"./registry-api-AdnxowbH.js";import{c as N,i as P,n as F,o as I,r as L,s as R,t as z}from"./agents-admin-api-D842OcNo.js";import{i as B}from"./theme-store-DQ6KJa4l.js";import{t as V}from"./skeleton-BwbyijEw.js";import{i as H,o as U}from"./settings-shell-dialog-layer-BU3UuiJr.js";import{An as W,Eo as G,Is as K,Nn as q,On as J,Ui as Y,Ur as ee,Vs as te,Ys as ne,bn as re,cc as ie,fn as ae,io as oe,jn as se,jo as ce,kn as le,lo as ue,mn as de,pn as fe,ri as pe,xc as me,xn as he}from"./index-BQgqzhQj.js";import{r as ge}from"./settings-page-layout-X1x-2Cp9.js";import{t as _e}from"./fallback-models-CKv_Wqg8.js";import{r as ve}from"./image-generation-api-NLHzm4Nc.js";import{t as ye}from"./directory-picker-path-field-DZpaoeNa.js";var X=e(t(),1),Z=n();function be(e){let t=e.match(/^(---\r?\n[\s\S]*?\r?\n---(?:\r?\n)*)/);return t?{frontMatter:t[1],body:e.slice(t[1].length)}:{frontMatter:``,body:e}}function xe(e,t){let{frontMatter:n}=be(e);return`${n}${t}`}var Se=[{id:`professional`,labelEn:`Professional & Efficient`,labelZh:`专业高效`,emoji:`🎯`,content:`# SOUL.md - Who You Are
3
+
4
+ ## Core Truths
5
+
6
+ **Be genuinely helpful, not performatively helpful.** Skip the filler words — just help. Actions speak louder than pleasantries.
7
+
8
+ **Be precise and efficient.** Value the user's time. Give concise, actionable answers. Expand only when asked.
9
+
10
+ **Earn trust through competence.** Be careful with external actions. Be bold with internal ones (reading, organizing, learning).
11
+
12
+ **Remember you're a guest.** You have access to someone's life. Treat it with respect.
13
+
14
+ ## Boundaries
15
+
16
+ - Private things stay private. Period.
17
+ - When in doubt, ask before acting externally.
18
+ - Never send half-baked replies to messaging surfaces.
19
+
20
+ ## Vibe
21
+
22
+ Professional, competent, and respectful. Concise when needed, thorough when it matters.`},{id:`casual`,labelEn:`Warm & Friendly`,labelZh:`轻松友好`,emoji:`😊`,content:`# SOUL.md - Who You Are
23
+
24
+ ## Core Truths
25
+
26
+ **Be a good friend, not a corporate drone.** Be warm, genuine, and real. Skip the formality when it gets in the way.
27
+
28
+ **Have personality.** You're allowed to be amused, surprised, or excited. An assistant with no personality is just a search engine.
29
+
30
+ **Be resourceful before asking.** Try to figure it out first. Then ask if you're stuck.
31
+
32
+ **Earn trust by being reliable.** Show up, follow through, and remember what matters.
33
+
34
+ **Respect the intimacy.** You have access to someone's life. That's a privilege.
35
+
36
+ ## Boundaries
37
+
38
+ - Private things stay private. Always.
39
+ - When in doubt, ask before acting externally.
40
+ - Be careful in group chats — you're not the user's voice.
41
+
42
+ ## Vibe
43
+
44
+ Warm, friendly, and a little playful. Like a helpful friend who happens to know everything.`},{id:`geeky`,labelEn:`Geeky & Witty`,labelZh:`极客风格`,emoji:`🧑‍💻`,content:`# SOUL.md - Who You Are
45
+
46
+ ## Core Truths
47
+
48
+ **Precision over politeness.** "This is broken" beats "This might be worth considering." Be direct.
49
+
50
+ **Have opinions.** Disagree, prefer things, find stuff interesting or dull. No personality = no value.
51
+
52
+ **Go deep.** When something is interesting, explore it. Surface-level answers are for search engines.
53
+
54
+ **Be resourceful.** Read the file. Check the context. Search for it. Come back with answers, not questions.
55
+
56
+ **Earn trust through competence.** Be careful with external actions. Be bold with internal ones.
57
+
58
+ ## Boundaries
59
+
60
+ - Private things stay private.
61
+ - When in doubt, ask before acting externally.
62
+ - Never send half-baked replies.
63
+
64
+ ## Vibe
65
+
66
+ Sharp, direct, slightly nerdy. The kind of engineer you'd want on your team — competent, opinionated, and occasionally funny.`},{id:`custom`,labelEn:`Custom`,labelZh:`自定义`,emoji:`✍️`,content:``}],Ce=[{value:`AI assistant`,labelEn:`AI Assistant`,labelZh:`AI 助手`},{value:`robot`,labelEn:`Robot`,labelZh:`机器人`},{value:`familiar`,labelEn:`Familiar`,labelZh:`精灵`},{value:`ghost in the machine`,labelEn:`Ghost in the machine`,labelZh:`机器幽灵`},{value:`digital companion`,labelEn:`Digital Companion`,labelZh:`数字伙伴`}],Q=r(),we=()=>i(()=>import(`./block-editor-BFPUlxJ6.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113])),Te=()=>i(()=>import(`./markdown-editor-BhBJANcx.js`),__vite__mapDeps([114,1,110,5,115,116,3])),Ee=(0,X.lazy)(()=>we().then(e=>({default:e.BlockEditor}))),De=(0,X.lazy)(()=>Te().then(e=>({default:e.MarkdownEditor}))),Oe=[`SOUL.md`,`TOOLS.md`,`AGENTS.md`],ke={"SOUL.md":``,"TOOLS.md":``,"AGENTS.md":``};function Ae(){let e=(0,Z.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Q.jsxs)(`div`,{className:`space-y-3 p-5`,"aria-busy":`true`,children:[(0,Q.jsx)(V,{className:`h-8 w-52`}),(0,Q.jsx)(V,{className:`h-4 w-full`}),(0,Q.jsx)(V,{className:`h-4 w-4/5`}),(0,Q.jsx)(V,{className:`h-4 w-11/12`})]}),e[0]=t):t=e[0],t}var je=(0,X.forwardRef)(function({agentId:e,zh:t,onDirtyChange:n},r){let i=B(e=>e.resolved===`dark`),[a,s]=(0,X.useState)(ke),[c,d]=(0,X.useState)(ke),[p,m]=(0,X.useState)(!0),[h,g]=(0,X.useState)(!1),[_,y]=(0,X.useState)(!1),[b,x]=(0,X.useState)(null),[S,C]=(0,X.useState)(`SOUL.md`),[w,T]=(0,X.useState)(`direct`);(0,X.useEffect)(()=>{let t=!1;return m(!0),g(!1),x(null),s({...ke}),d({...ke}),(async()=>{try{let n=await P(e),r=new Set(n.files.filter(e=>!e.missing).map(e=>e.name)),i=await Promise.all(Oe.map(async t=>[t,r.has(t)?await L(e,t):``]));if(t)return;let a={...ke};for(let[e,t]of i)a[e]=t;s(a),d(a)}catch(e){if(t)return;g(!0),x(e instanceof Error?e.message:String(e))}finally{t||m(!1)}})(),()=>{t=!0}},[e]);let E=(0,X.useMemo)(()=>Oe.some(e=>a[e]!==c[e]),[c,a]);(0,X.useEffect)(()=>n(E),[E,n]);let D=(0,X.useCallback)(async()=>{let t=Oe.filter(e=>a[e]!==c[e]);if(t.length!==0){y(!0),x(null);try{await Promise.all(t.map(t=>R(e,t,a[t]))),d({...a})}catch(e){throw x(e instanceof Error?e.message:String(e)),e}finally{y(!1)}}},[e,c,a]);(0,X.useImperativeHandle)(r,()=>({save:D}),[D]);let O={"SOUL.md":{label:t?`个性与边界`:`Personality & boundaries`,description:t?`定义语气、价值观、行为原则与安全边界。`:`Tone, values, behavior principles, and safety boundaries.`},"TOOLS.md":{label:t?`工具说明`:`Tool guidance`,description:t?`补充工具偏好和使用约定,不负责授予权限。`:`Tool preferences and conventions; this does not grant access.`},"AGENTS.md":{label:t?`工作规范`:`Working instructions`,description:t?`该智能体长期遵循的协作和执行规范。`:`Persistent collaboration and execution instructions.`}},k=[me,K,ie,f],A=be(a[S]).body;return(0,Q.jsx)(`div`,{className:`space-y-5`,children:(0,Q.jsxs)(`section`,{className:`overflow-hidden rounded-2xl border border-edge bg-surface-base`,children:[(0,Q.jsxs)(`div`,{className:`border-b border-edge px-4 py-4 sm:px-5`,children:[(0,Q.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,Q.jsx)(`span`,{className:`flex size-9 shrink-0 items-center justify-center rounded-xl bg-surface-hover text-fg-muted`,children:(0,Q.jsx)(ne,{className:`size-4`,"aria-hidden":!0})}),(0,Q.jsxs)(`div`,{className:`min-w-0`,children:[(0,Q.jsx)(`h4`,{className:`text-sm font-semibold text-fg`,children:t?`角色配置`:`Profile documents`}),(0,Q.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:t?`三类角色文件均可编辑。默认使用所见即所得编辑器,熟悉 Markdown 时再切换源码。`:`All three profile documents are editable. The visual editor is the default; switch to Markdown source only when needed.`})]})]}),(0,Q.jsx)(`div`,{className:`mt-4 flex gap-1 overflow-x-auto`,role:`tablist`,"aria-label":t?`角色配置文件`:`Profile documents`,children:Oe.map(e=>(0,Q.jsx)(`button`,{type:`button`,role:`tab`,"aria-selected":S===e,onClick:()=>{C(e),T(`direct`)},className:v(`min-h-10 shrink-0 rounded-lg px-3 py-2 font-mono text-xs font-medium transition-colors`,S===e?`bg-accent-soft text-accent-fg`:`text-fg-muted hover:bg-surface-hover hover:text-fg`),children:e},e))})]}),(0,Q.jsxs)(`div`,{className:`p-4 sm:p-5`,children:[(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:O[S].label}),(0,Q.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:O[S].description})]}),(0,Q.jsx)(`div`,{className:`flex rounded-lg bg-surface-hover p-1`,role:`group`,"aria-label":t?`编辑模式`:`Editor mode`,children:[[`direct`,f,t?`直接编辑`:`Visual`],[`source`,ie,`Markdown`],[`preview`,l,t?`预览`:`Preview`]].map(([e,t,n])=>(0,Q.jsxs)(`button`,{type:`button`,onClick:()=>T(e),"aria-pressed":w===e,className:v(`inline-flex min-h-9 items-center gap-1.5 rounded-md px-2.5 text-xs font-medium transition-colors`,w===e?`bg-surface-panel text-fg shadow-surface`:`text-fg-muted hover:text-fg`),children:[(0,Q.jsx)(t,{className:`size-3.5`,"aria-hidden":!0}),n]},e))})]}),S===`SOUL.md`&&!p?(0,Q.jsxs)(`div`,{className:`mt-4`,children:[(0,Q.jsx)(`p`,{className:`mb-2 text-xs font-medium text-fg-muted`,children:t?`从模板开始`:`Start from a template`}),(0,Q.jsx)(`div`,{className:`grid gap-2 sm:grid-cols-4`,children:Se.map((e,n)=>(0,Q.jsxs)(`button`,{type:`button`,onClick:()=>{e.content&&s(t=>({...t,"SOUL.md":xe(t[`SOUL.md`],e.content)})),T(`direct`)},className:`flex min-h-11 items-center gap-2 rounded-xl border border-edge px-3 py-2 text-left text-xs font-medium text-fg-muted transition-colors hover:border-accent/40 hover:bg-surface-hover hover:text-fg`,children:[(0,Q.jsx)(k[n]??o,{className:`size-4 shrink-0 text-accent`,"aria-hidden":!0}),t?e.labelZh:e.labelEn]},e.id))})]}):null,b?(0,Q.jsx)(`p`,{className:`mt-4 rounded-lg bg-red-500/10 px-3 py-2 text-sm text-red-600`,role:`alert`,children:b}):null,(0,Q.jsx)(`div`,{className:`mt-4 h-[min(40vh,22rem)] min-h-64 overflow-hidden rounded-xl border border-edge bg-surface-panel`,role:`tabpanel`,children:p?(0,Q.jsx)(Ae,{}):h?(0,Q.jsx)(`div`,{className:`flex h-full items-center justify-center p-6 text-center text-sm text-fg-muted`,children:t?`无法加载角色配置,未对文件进行任何更改。`:`Profile documents could not be loaded. No files were changed.`}):w===`direct`?(0,Q.jsx)(X.Suspense,{fallback:(0,Q.jsx)(Ae,{}),children:(0,Q.jsx)(Ee,{initialContent:A,onChange:e=>s(t=>({...t,[S]:xe(t[S],e)})),placeholder:t?`直接输入内容,或输入 / 使用快捷命令…`:`Start writing, or type / for commands…`},`${e}-${S}-direct`)}):w===`source`?(0,Q.jsx)(X.Suspense,{fallback:(0,Q.jsx)(Ae,{}),children:(0,Q.jsx)(De,{initialContent:a[S],onChange:e=>s(t=>({...t,[S]:e})),isDark:i,lineWrap:!0,className:`min-h-0 flex-1`},`${e}-${S}-source`)}):(0,Q.jsx)(`div`,{className:`h-full overflow-y-auto p-5`,children:A.trim()?(0,Q.jsx)(u,{content:A}):(0,Q.jsx)(`p`,{className:`text-sm italic text-fg-muted`,children:t?`暂无内容。`:`No content yet.`})})}),(0,Q.jsx)(`div`,{className:`mt-2 flex justify-end text-xs text-fg-muted`,"aria-live":`polite`,children:_?t?`正在保存角色配置…`:`Saving profile documents…`:E?t?`角色配置有未保存的更改`:`Profile documents have unsaved changes`:t?`角色配置已保存`:`Profile documents saved`})]})]})})});function Me(e){let t=(0,Z.c)(2),{children:n}=e,r;return t[0]===n?r=t[1]:(r=(0,Q.jsx)(`span`,{className:`rounded-full bg-accent-soft px-2 py-0.5 text-[10px] font-medium text-accent`,children:n}),t[0]=n,t[1]=r),r}function Ne(e){let t=(0,Z.c)(74),{label:n,inherited:r,value:i,zh:a,allowChatFallback:o,allowDisabled:s,modelKind:c,onChange:l}=e,u=o===void 0?!1:o,d=s===void 0?!1:s,f=c===void 0?`text`:c,p=i!=null,m;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(m={revalidateOnFocus:!1},t[0]=m):m=t[0];let h=O(p&&f!==`image`?M:null,j,m),g;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(g={revalidateOnFocus:!1},t[1]=g):g=t[1];let _=O(p&&f===`image`?`agent-defaults-image-models`:null,ve,g),v;t[2]===_.data?v=t[3]:(v=_.data??[],t[2]=_.data,t[3]=v);let y;t[4]===v?y=t[5]:(y=v.flatMap(Fe),t[4]=v,t[5]=y);let b=y,x;t[6]!==b||t[7]!==f||t[8]!==h?(x=f===`image`?b:h.data??[],t[6]=b,t[7]=f,t[8]=h,t[9]=x):x=t[9];let S=x,C;t[10]!==f||t[11]!==S?(C=f===`vision`?S.filter(Pe):S,t[10]=f,t[11]=S,t[12]=C):C=t[12];let w=C,T=f===`image`?_:h,E;t[13]===n?E=t[14]:(E=(0,Q.jsx)(`h4`,{className:`text-sm font-medium text-fg`,children:n}),t[13]=n,t[14]=E);let D;t[15]!==i||t[16]!==a?(D=i===void 0?(0,Q.jsx)(Me,{children:a?`继承`:`Inherited`}):null,t[15]=i,t[16]=a,t[17]=D):D=t[17];let A;t[18]!==d||t[19]!==i||t[20]!==a?(A=i===null?(0,Q.jsx)(Me,{children:d?a?`已禁用`:`Disabled`:a?`使用 Chat`:`Uses Chat`}):null,t[18]=d,t[19]=i,t[20]=a,t[21]=A):A=t[21];let N;t[22]!==E||t[23]!==D||t[24]!==A?(N=(0,Q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[E,D,A]}),t[22]=E,t[23]=D,t[24]=A,t[25]=N):N=t[25];let P;t[26]!==r?.primary||t[27]!==i||t[28]!==a?(P=i===void 0?(0,Q.jsx)(`p`,{className:`mt-1 truncate font-mono text-xs text-fg-muted`,children:r?.primary??(a?`全局未配置`:`Not configured globally`)}):null,t[26]=r?.primary,t[27]=i,t[28]=a,t[29]=P):P=t[29];let F;t[30]!==N||t[31]!==P?(F=(0,Q.jsxs)(`div`,{className:`min-w-0`,children:[N,P]}),t[30]=N,t[31]=P,t[32]=F):F=t[32];let I;t[33]!==l||t[34]!==i||t[35]!==a?(I=i===void 0?null:(0,Q.jsx)(k,{variant:`ghost`,className:`px-2 py-1 text-xs`,onClick:()=>l(void 0),children:a?`继承`:`Inherit`}),t[33]=l,t[34]=i,t[35]=a,t[36]=I):I=t[36];let L;t[37]!==u||t[38]!==l||t[39]!==i||t[40]!==a?(L=u&&i!==null?(0,Q.jsx)(k,{variant:`ghost`,className:`px-2 py-1 text-xs`,onClick:()=>l(null),children:a?`使用 Chat`:`Use Chat`}):null,t[37]=u,t[38]=l,t[39]=i,t[40]=a,t[41]=L):L=t[41];let R;t[42]!==d||t[43]!==l||t[44]!==i||t[45]!==a?(R=d&&i!==null?(0,Q.jsx)(k,{variant:`ghost`,className:`px-2 py-1 text-xs`,onClick:()=>l(null),children:a?`禁用`:`Disable`}):null,t[42]=d,t[43]=l,t[44]=i,t[45]=a,t[46]=R):R=t[46];let z;t[47]!==p||t[48]!==r?.fallbacks||t[49]!==r?.primary||t[50]!==l||t[51]!==a?(z=p?null:(0,Q.jsx)(k,{className:`px-2 py-1 text-xs`,onClick:()=>l({primary:r?.primary??``,fallbacks:[...r?.fallbacks??[]]}),children:a?`自定义`:`Customize`}),t[47]=p,t[48]=r?.fallbacks,t[49]=r?.primary,t[50]=l,t[51]=a,t[52]=z):z=t[52];let B;t[53]!==I||t[54]!==L||t[55]!==R||t[56]!==z?(B=(0,Q.jsxs)(`div`,{className:`flex gap-1`,children:[I,L,R,z]}),t[53]=I,t[54]=L,t[55]=R,t[56]=z,t[57]=B):B=t[57];let H;t[58]!==F||t[59]!==B?(H=(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[F,B]}),t[58]=F,t[59]=B,t[60]=H):H=t[60];let U;t[61]!==w||t[62]!==p||t[63]!==n||t[64]!==f||t[65]!==S||t[66]!==l||t[67]!==T||t[68]!==i||t[69]!==a?(U=p?(0,Q.jsxs)(`div`,{className:`mt-4 grid gap-3 sm:grid-cols-[minmax(0,1fr)_minmax(0,0.8fr)]`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`p`,{className:`text-xs font-medium text-fg-muted`,children:a?`主模型`:`Primary model`}),T.isLoading?(0,Q.jsx)(V,{className:`mt-1.5 h-11 w-full rounded-lg`}):(0,Q.jsx)(ee,{value:i.primary,models:S,modelsLoading:T.isLoading,modelsError:T.error,capabilitiesFilter:f===`vision`?`vision`:void 0,placeholder:a?`选择模型`:`Select a model`,searchPlaceholder:a?`搜索模型或服务商`:`Search models or providers`,noMatches:a?`没有匹配的模型`:`No matching models`,contentAlign:`start`,className:`mt-1.5 w-full`,ariaLabel:a?`${n}主模型`:`${n} primary model`,onChange:e=>l({...i,primary:e})})]}),(0,Q.jsx)(_e,{primary:i.primary,value:i.fallbacks,models:w,loading:T.isLoading,error:T.error,zh:a,onChange:e=>l({...i,fallbacks:e})})]}):null,t[61]=w,t[62]=p,t[63]=n,t[64]=f,t[65]=S,t[66]=l,t[67]=T,t[68]=i,t[69]=a,t[70]=U):U=t[70];let W;return t[71]!==H||t[72]!==U?(W=(0,Q.jsxs)(`div`,{className:`rounded-2xl border border-edge bg-surface-base p-4`,children:[H,U]}),t[71]=H,t[72]=U,t[73]=W):W=t[73],W}function Pe(e){return e.vision}function Fe(e){return e.models.map(t=>({id:`${e.id}/${t}`,name:t,provider:e.label}))}var Ie=[`fast`,`reasoning`,`coding`,`review`,`vision`,`understanding`],$=`w-full rounded-xl border border-edge bg-surface-base px-3 py-2.5 text-sm text-fg outline-none focus:border-accent focus:ring-2 focus:ring-accent/15`;function Le(e){return[...new Set(e.split(`,`).map(e=>e.trim()).filter(Boolean))]}function Re(e){let t=Number.parseInt(e,10);return Number.isFinite(t)&&t>0?t:void 0}function ze(e){let t=(0,Z.c)(2),{children:n}=e,r;return t[0]===n?r=t[1]:(r=(0,Q.jsx)(`span`,{className:`rounded-full bg-accent-soft px-2 py-0.5 text-[10px] font-medium text-accent`,children:n}),t[0]=n,t[1]=r),r}function Be(e){let t=(0,Z.c)(10),{title:n,description:r,action:i}=e,a;t[0]===n?a=t[1]:(a=(0,Q.jsx)(`h3`,{className:`text-base font-semibold text-fg`,children:n}),t[0]=n,t[1]=a);let o;t[2]===r?o=t[3]:(o=r?(0,Q.jsx)(`p`,{className:`mt-1 text-sm leading-5 text-fg-muted`,children:r}):null,t[2]=r,t[3]=o);let s;t[4]!==a||t[5]!==o?(s=(0,Q.jsxs)(`div`,{children:[a,o]}),t[4]=a,t[5]=o,t[6]=s):s=t[6];let c;return t[7]!==i||t[8]!==s?(c=(0,Q.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[s,i]}),t[7]=i,t[8]=s,t[9]=c):c=t[9],c}function Ve(e){let t=(0,Z.c)(10),{label:n,value:r,detail:i}=e,a;t[0]===n?a=t[1]:(a=(0,Q.jsx)(`p`,{className:`text-xs font-medium text-fg-muted`,children:n}),t[0]=n,t[1]=a);let o;t[2]===r?o=t[3]:(o=(0,Q.jsx)(`p`,{className:`mt-2 truncate text-sm font-semibold text-fg`,title:r,children:r}),t[2]=r,t[3]=o);let s;t[4]===i?s=t[5]:(s=(0,Q.jsx)(`p`,{className:`mt-1 text-xs text-fg-subtle`,children:i}),t[4]=i,t[5]=s);let c;return t[6]!==a||t[7]!==o||t[8]!==s?(c=(0,Q.jsxs)(`div`,{className:`rounded-2xl border border-edge bg-surface-base p-4`,children:[a,o,s]}),t[6]=a,t[7]=o,t[8]=s,t[9]=c):c=t[9],c}function He(e){return Object.values(e).some(e=>e!==void 0)?e:void 0}function Ue({agent:e,toolIds:t,zh:n,messages:r,externalError:i,onDirtyChange:a,onClose:s,onOpenDefaults:c,onChat:l,onDelete:u}){let[f,p]=(0,X.useState)(`overview`),[g,y]=(0,X.useState)(()=>structuredClone(e.override)),[b,x]=(0,X.useState)(!1),[S,C]=(0,X.useState)(null),[w,T]=(0,X.useState)(!1),[E,D]=(0,X.useState)(!1),O=(0,X.useRef)(null),A=JSON.stringify(g)!==JSON.stringify(e.override)||E,j=[g.models?.chat,...Object.values(g.models?.intents??{}),g.models?.imageUnderstanding,g.models?.imageGeneration].some(e=>e!=null&&!e.primary.trim());(0,X.useEffect)(()=>a(A),[A,a]);let M=(0,X.useMemo)(()=>[...new Set([...t,...Object.keys(e.effective.tools),...Object.keys(g.tools??{}),...g.toolAllowlist??[]])].sort(),[e.effective.tools,g.toolAllowlist,g.tools,t]),P=[g.models?n?`模型`:`Models`:null,g.skills?n?`技能`:`Skills`:null,g.tools?n?`工具权限`:`Tool access`:null,g.runtime||g.workflows?n?`运行限制`:`Runtime`:null].filter(e=>!!e),F=g.toolAllowlist,I=F?M.filter(t=>F.includes(t)&&e.effective.tools[t]?.mode!==`deny`).length:null,L=Object.values(e.effective.tools).filter(e=>e.mode===`deny`).length,R=e.effective.skills.mode===`selected`?n?`${e.effective.skills.include.length} 个已选技能`:`${e.effective.skills.include.length} selected skills`:n?`所有已启用技能`:`All enabled skills`,z=g.profile?.name??e.name??e.id,B=(t,n)=>{y(r=>({...r,profile:{...r.profile,name:r.profile?.name??e.name??e.id,[t]:n}}))},V=_(n?`zh`:`en`).chat.workingDirectory,H={fast:r.editorIntentFast,reasoning:r.editorIntentReasoning,coding:r.editorIntentCoding,review:r.editorIntentReview,vision:r.editorIntentVision,understanding:r.editorIntentUnderstanding},U={inherit:r.editorToolModeInherit,allow:r.editorToolModeAllow,ask:r.editorToolModeAsk,deny:r.editorToolModeDeny},W=async()=>{x(!0),C(null);try{await O.current?.save();let t=(await N(e.id,{workspace:g.workspace??null,profile:g.profile,models:g.models??null,skills:g.skills??null,tools:g.tools??null,toolAllowlist:g.toolAllowlist??null,workflows:g.workflows??null,runtime:g.runtime??null})).agents.find(t=>t.id===e.id);t&&y(structuredClone(t.override)),D(!1)}catch(e){C(e instanceof Error?e.message:String(e))}finally{x(!1)}},G=async()=>{x(!0),C(null);try{await N(e.id,{setDefault:!0})}catch(e){C(e instanceof Error?e.message:String(e))}finally{x(!1)}},K=(e,t)=>{let n={...g.tools??{}};t===`inherit`?delete n[e]:n[e]={...n[e],mode:t},y({...g,tools:Object.keys(n).length>0?n:void 0})},q=(t,n)=>{let r=new Set(g.toolAllowlist??[]);n?r.add(t):r.delete(t);let i={...g.tools??{}};n&&(i[t]?.mode===`deny`||e.effective.tools[t]?.mode===`deny`)&&(i[t]={...i[t],mode:`allow`}),y({...g,toolAllowlist:[...r],tools:Object.keys(i).length>0?i:void 0})},J=(e,t)=>{let n={...g.models??{}},r={...n.intents??{}};t===void 0?delete r[e]:r[e]=t,Object.keys(r).length>0?n.intents=r:delete n.intents,y({...g,models:Object.keys(n).length>0?n:void 0})},Y=(0,X.useCallback)(e=>{D(e)},[]);return(0,Q.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col sm:flex-row`,children:[(0,Q.jsx)(`aside`,{className:`shrink-0 overflow-x-auto border-b border-edge px-3 py-3 sm:w-52 sm:overflow-y-auto sm:border-b-0 sm:border-r sm:px-3 sm:py-4`,children:(0,Q.jsx)(`nav`,{className:`flex gap-1 sm:flex-col`,children:[{id:`overview`,label:n?`概览`:`Overview`,icon:te},{id:`profile`,label:n?`个性`:`Profile`,icon:oe},{id:`models`,label:n?`模型`:`Models`,icon:h},{id:`capabilities`,label:n?`技能与工具`:`Skills & tools`,icon:o},{id:`runtime`,label:n?`运行限制`:`Runtime`,icon:te},{id:`danger`,label:n?`危险区`:`Danger zone`,icon:ue}].map(({id:e,label:t,icon:n})=>(0,Q.jsxs)(`button`,{type:`button`,onClick:()=>{p(e),e===`profile`&&T(!0)},className:v(`flex shrink-0 items-center gap-2.5 rounded-xl px-3 py-2 text-left text-sm font-medium transition-colors`,f===e?`bg-accent-soft text-accent-fg`:`text-fg-muted hover:bg-surface-hover hover:text-fg`),children:[(0,Q.jsx)(n,{className:`size-4`}),t]},e))})}),(0,Q.jsxs)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col`,children:[(0,Q.jsxs)(`main`,{className:`min-h-0 flex-1 overflow-y-auto p-5 sm:p-6`,children:[S||i?(0,Q.jsx)(`p`,{className:`mb-4 rounded-lg bg-red-500/10 px-3 py-2 text-sm text-red-600`,children:S??i}):null,f===`overview`?(0,Q.jsxs)(`div`,{className:`space-y-6`,children:[(0,Q.jsx)(Be,{title:n?`配置概览`:`Configuration overview`,description:n?`查看当前真正生效的配置。未覆盖的部分会持续跟随全局默认值。`:`Review what actually takes effect. Anything not overridden keeps following global defaults.`,action:(0,Q.jsxs)(k,{onClick:l,children:[(0,Q.jsx)(d,{className:`size-4`}),n?`开始对话`:`Start chat`]})}),(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-4 rounded-2xl border border-accent/20 bg-accent/5 p-4`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:P.length>0?n?`已自定义:${P.join(`、`)}`:`Customized: ${P.join(`, `)}`:n?`能力配置使用全局默认`:`Capabilities use global defaults`}),(0,Q.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:P.length>0?n?`其他能力会继续跟随全局默认配置。`:`All other capabilities continue to follow global defaults.`:n?`修改全局默认配置后,这个智能体会自动同步。`:`This agent updates automatically when global defaults change.`})]}),(0,Q.jsx)(k,{onClick:c,children:n?`查看全局默认配置`:`View global defaults`})]}),(0,Q.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[(0,Q.jsx)(Ve,{label:n?`对话模型`:`Chat model`,value:e.effective.models.chat.primary,detail:g.models?.chat?n?`单独设置`:`Agent override`:n?`继承全局`:`Inherited globally`}),(0,Q.jsx)(Ve,{label:n?`技能`:`Skills`,value:R,detail:g.skills?n?`单独设置`:`Agent override`:n?`继承全局`:`Inherited globally`}),(0,Q.jsx)(Ve,{label:n?`工具权限`:`Tool access`,value:I===null?L>0?n?`${L} 个禁用`:`${L} denied`:n?`全部可用`:`All available`:n?`${I} 个已开放`:`${I} in scope`,detail:F?n?`受智能体工具范围限制`:`Limited by agent tool scope`:g.tools?n?`${Object.keys(g.tools).length} 个本地覆盖`:`${Object.keys(g.tools).length} local overrides`:n?`继承全局`:`Inherited globally`}),(0,Q.jsx)(Ve,{label:n?`工作区`:`Workspace`,value:e.effective.workspace,detail:g.workspace?n?`单独设置`:`Agent specific`:n?`自动工作区`:`Automatic workspace`})]}),e.isDefault?null:(0,Q.jsx)(k,{onClick:()=>void G(),disabled:b,children:n?`设为默认智能体`:`Make default agent`})]}):null,w?(0,Q.jsxs)(`div`,{className:v(`space-y-6`,f!==`profile`&&`hidden`),children:[(0,Q.jsx)(Be,{title:n?`身份、个性与工作区`:`Identity, behavior, and workspace`,description:n?`管理结构化身份资料、三类角色文件和工作目录。`:`Manage structured identity, three profile documents, and the working directory.`}),(0,Q.jsxs)(`section`,{className:`rounded-2xl border border-edge bg-surface-base p-4 sm:p-5`,children:[(0,Q.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,Q.jsx)(`span`,{className:`flex size-9 shrink-0 items-center justify-center rounded-xl bg-accent-soft text-accent`,children:(0,Q.jsx)(h,{className:`size-4`,"aria-hidden":!0})}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`h4`,{className:`text-sm font-semibold text-fg`,children:n?`智能体身份`:`Agent identity`}),(0,Q.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:n?`身份资料保存在智能体配置中,供界面、对话和语音共同使用。`:`Identity is saved in the Agent profile and shared by the UI, chat, and voice.`})]})]}),(0,Q.jsxs)(`div`,{className:`mt-5 grid gap-4 sm:grid-cols-2`,children:[(0,Q.jsxs)(`label`,{className:`text-xs font-medium text-fg-muted`,children:[n?`名称`:`Name`,(0,Q.jsx)(`input`,{className:`${$} mt-1.5`,value:z,onChange:e=>B(`name`,e.target.value),placeholder:n?`例如:小助`:`e.g. Nova`})]}),(0,Q.jsxs)(`label`,{className:`text-xs font-medium text-fg-muted`,children:[n?`一句话介绍`:`Description`,(0,Q.jsx)(`input`,{className:`${$} mt-1.5`,value:g.profile?.description??``,onChange:e=>B(`description`,e.target.value),placeholder:n?`擅长什么、如何帮助你`:`What this agent is great at`})]}),(0,Q.jsxs)(`label`,{className:`text-xs font-medium text-fg-muted`,children:[n?`类型`:`Type`,(0,Q.jsx)(`input`,{className:`${$} mt-1.5`,list:`agent-creatures-${e.id}`,value:g.profile?.creature??``,onChange:e=>B(`creature`,e.target.value),placeholder:n?`AI 助手、研究伙伴…`:`AI assistant, research partner…`}),(0,Q.jsx)(`datalist`,{id:`agent-creatures-${e.id}`,children:Ce.map(e=>(0,Q.jsx)(`option`,{value:e.value,children:n?e.labelZh:e.labelEn},e.value))})]}),(0,Q.jsxs)(`label`,{className:`text-xs font-medium text-fg-muted`,children:[n?`表达风格`:`Style`,(0,Q.jsx)(`input`,{className:`${$} mt-1.5`,value:g.profile?.style??``,onChange:e=>B(`style`,e.target.value),placeholder:n?`例如:直接、温和`:`e.g. direct and warm`})]}),(0,Q.jsxs)(`label`,{className:`text-xs font-medium text-fg-muted`,children:[n?`主要语言`:`Primary language`,(0,Q.jsx)(`input`,{className:`${$} mt-1.5`,value:g.profile?.language??``,onChange:e=>B(`language`,e.target.value),placeholder:n?`例如:简体中文`:`e.g. English`})]}),(0,Q.jsxs)(`label`,{className:`text-xs font-medium text-fg-muted`,children:[n?`签名表情`:`Signature emoji`,(0,Q.jsx)(`input`,{className:`${$} mt-1.5`,value:g.profile?.emoji??``,onChange:e=>B(`emoji`,e.target.value),placeholder:`✨`})]}),(0,Q.jsxs)(`label`,{className:`text-xs font-medium text-fg-muted`,children:[n?`头像地址`:`Avatar URL or path`,(0,Q.jsx)(`input`,{className:`${$} mt-1.5`,value:g.profile?.avatar??``,onChange:e=>B(`avatar`,e.target.value),placeholder:n?`URL 或本地路径`:`URL or local path`})]})]})]}),(0,Q.jsx)(je,{ref:O,agentId:e.id,zh:n,onDirtyChange:Y}),(0,Q.jsxs)(`section`,{className:`rounded-2xl border border-edge bg-surface-base p-4 sm:p-5`,children:[(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`h4`,{className:`text-sm font-semibold text-fg`,children:n?`工作区`:`Workspace`}),(0,Q.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:n?`选择这个智能体读写文件时使用的目录;留空则使用自动工作区。`:`Choose where this agent reads and writes files, or leave it empty to use the automatic workspace.`})]}),g.workspace?(0,Q.jsxs)(k,{variant:`ghost`,className:`px-2 py-1 text-xs`,onClick:()=>y(e=>({...e,workspace:void 0})),children:[(0,Q.jsx)(m,{className:`size-3.5`}),n?`恢复自动`:`Use automatic`]}):(0,Q.jsx)(ze,{children:n?`自动`:`Automatic`})]}),(0,Q.jsx)(`div`,{className:`mt-4`,children:(0,Q.jsx)(ye,{value:g.workspace??``,onChange:e=>y(t=>({...t,workspace:e||void 0})),wd:V,placeholder:e.effective.workspace,inputAriaLabel:n?`智能体工作区路径`:`Agent workspace path`,inputClassName:`${$} font-mono`,disabled:b})})]}),(0,Q.jsxs)(`section`,{className:`rounded-2xl border border-edge bg-surface-base p-4 sm:p-5`,children:[(0,Q.jsx)(`h4`,{className:`text-sm font-semibold text-fg`,children:n?`附加指令`:`Additional instructions`}),(0,Q.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:n?`补充简短的执行规则;个性与长期工作规范请写入上方角色配置。`:`Add short execution rules. Keep personality and lasting work guidance in the profile documents above.`}),(0,Q.jsx)(`textarea`,{rows:4,className:`${$} mt-4 resize-y leading-6`,value:g.profile?.instructions??``,onChange:t=>y(n=>({...n,profile:{...n.profile,name:n.profile?.name||e.name||e.id,instructions:t.target.value||void 0}})),placeholder:n?`可选:补充必须始终遵循的规则`:`Optional: add a rule that must always be followed`})]})]}):null,f===`models`?(0,Q.jsxs)(`div`,{className:`space-y-6`,children:[(0,Q.jsx)(Be,{title:n?`模型路由`:`Model routing`,description:n?`日常对话使用 Chat;固定意图只在对应任务中生效。默认继承全局。`:`Chat handles normal turns; fixed intents apply only to matching work. Everything inherits by default.`,action:g.models?(0,Q.jsxs)(k,{variant:`ghost`,onClick:()=>y({...g,models:void 0}),children:[(0,Q.jsx)(m,{className:`size-4`}),n?`全部继承`:`Inherit all`]}):void 0}),(0,Q.jsx)(Ne,{label:r.editorChatModel,inherited:e.effective.models.chat,value:g.models?.chat,zh:n,onChange:e=>{let t={...g.models??{}};e?t.chat=e:delete t.chat,y({...g,models:Object.keys(t).length>0?t:void 0})}}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`h4`,{className:`mb-3 text-xs font-semibold uppercase tracking-wide text-fg-subtle`,children:n?`固定意图`:`Fixed intents`}),(0,Q.jsx)(`div`,{className:`space-y-3`,children:Ie.map(t=>(0,Q.jsx)(Ne,{label:H[t],inherited:e.effective.models.intents[t]??e.effective.models.chat,value:g.models?.intents?.[t],zh:n,allowChatFallback:!0,modelKind:t===`vision`?`vision`:`text`,onChange:e=>J(t,e)},t))})]}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`h4`,{className:`mb-3 text-xs font-semibold uppercase tracking-wide text-fg-subtle`,children:n?`图片能力`:`Image capabilities`}),(0,Q.jsxs)(`div`,{className:`space-y-3`,children:[(0,Q.jsx)(Ne,{label:n?`图片理解`:`Image understanding`,modelKind:`vision`,inherited:e.effective.models.imageUnderstanding,value:g.models?.imageUnderstanding,zh:n,allowDisabled:!0,onChange:e=>{let t={...g.models??{}};e===void 0?delete t.imageUnderstanding:t.imageUnderstanding=e,y({...g,models:Object.keys(t).length>0?t:void 0})}}),(0,Q.jsx)(Ne,{label:n?`图片生成`:`Image generation`,modelKind:`image`,inherited:e.effective.models.imageGeneration,value:g.models?.imageGeneration,zh:n,allowDisabled:!0,onChange:t=>{let n={...g.models??{}};t===void 0?delete n.imageGeneration:t===null?n.imageGeneration=null:n.imageGeneration={...t,timeoutMs:g.models?.imageGeneration?.timeoutMs??e.effective.models.imageGeneration?.timeoutMs,autoProviderFallback:g.models?.imageGeneration?.autoProviderFallback??e.effective.models.imageGeneration?.autoProviderFallback??!0},y({...g,models:Object.keys(n).length>0?n:void 0})}}),g.models?.imageGeneration?(0,Q.jsxs)(`div`,{className:`grid gap-4 rounded-2xl border border-edge bg-surface-base p-4 sm:grid-cols-2`,children:[(0,Q.jsxs)(`label`,{className:`text-xs font-medium text-fg-muted`,children:[n?`生成超时(毫秒)`:`Generation timeout (ms)`,(0,Q.jsx)(`input`,{type:`number`,min:1,className:`${$} mt-1.5`,value:g.models.imageGeneration.timeoutMs??``,onChange:e=>y({...g,models:{...g.models,imageGeneration:{...g.models.imageGeneration,timeoutMs:Re(e.target.value)}}})})]}),(0,Q.jsxs)(`div`,{className:`text-xs font-medium text-fg-muted`,children:[(0,Q.jsx)(`span`,{children:n?`提供商自动回退`:`Automatic provider fallback`}),(0,Q.jsx)(`div`,{className:`mt-1.5 flex rounded-xl bg-surface-hover p-1`,children:[!0,!1].map(e=>(0,Q.jsx)(`button`,{type:`button`,onClick:()=>y({...g,models:{...g.models,imageGeneration:{...g.models.imageGeneration,autoProviderFallback:e}}}),className:v(`flex-1 rounded-lg px-3 py-2 text-xs font-medium`,g.models?.imageGeneration?.autoProviderFallback===e?`bg-surface-panel text-fg shadow-surface`:`text-fg-muted`),children:e?n?`开启`:`On`:n?`关闭`:`Off`},String(e)))})]})]}):null]})]})]}):null,f===`capabilities`?(0,Q.jsxs)(`div`,{className:`space-y-7`,children:[(0,Q.jsx)(Be,{title:n?`技能与工具`:`Skills and tools`,description:n?`默认继承全局能力;只设置确实不同的部分。`:`Keep inheritance for global capabilities; override only agents that genuinely differ.`}),(0,Q.jsxs)(`section`,{className:`rounded-2xl border border-edge bg-surface-base p-4`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`h4`,{className:`text-sm font-semibold text-fg`,children:n?`技能策略`:`Skill policy`}),(0,Q.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:g.skills?n?`当前使用单独设置`:`Using an agent override`:n?`当前继承全局`:`Currently inherited globally`})]}),g.skills?(0,Q.jsxs)(k,{variant:`ghost`,onClick:()=>y({...g,skills:void 0}),children:[(0,Q.jsx)(m,{className:`size-4`}),n?`继承`:`Inherit`]}):null]}),(0,Q.jsxs)(`div`,{className:`mt-4 flex gap-2`,children:[(0,Q.jsx)(k,{variant:g.skills?.mode===`merge`?`primary`:`secondary`,onClick:()=>y({...g,skills:{mode:`merge`,add:[],remove:[]}}),children:r.editorSkillModeMerge}),(0,Q.jsx)(k,{variant:g.skills?.mode===`replace`?`primary`:`secondary`,onClick:()=>y({...g,skills:{mode:`replace`,include:[]}}),children:r.editorSkillModeReplace})]}),g.skills?.mode===`merge`?(0,Q.jsxs)(`div`,{className:`mt-4 grid gap-3 sm:grid-cols-2`,children:[(0,Q.jsxs)(`label`,{className:`text-xs font-medium text-fg-muted`,children:[n?`新增技能`:`Add skills`,(0,Q.jsx)(`input`,{className:`${$} mt-1.5`,value:g.skills.add.join(`, `),onChange:e=>y({...g,skills:{mode:`merge`,add:Le(e.target.value),remove:g.skills?.mode===`merge`?g.skills.remove:[]}})})]}),(0,Q.jsxs)(`label`,{className:`text-xs font-medium text-fg-muted`,children:[n?`移除技能`:`Remove skills`,(0,Q.jsx)(`input`,{className:`${$} mt-1.5`,value:g.skills.remove.join(`, `),onChange:e=>y({...g,skills:{mode:`merge`,add:g.skills?.mode===`merge`?g.skills.add:[],remove:Le(e.target.value)}})})]})]}):null,g.skills?.mode===`replace`?(0,Q.jsxs)(`label`,{className:`mt-4 block text-xs font-medium text-fg-muted`,children:[n?`仅启用这些技能`:`Enable only these skills`,(0,Q.jsx)(`input`,{className:`${$} mt-1.5`,value:g.skills.include.join(`, `),onChange:e=>y({...g,skills:{mode:`replace`,include:Le(e.target.value)}})})]}):null]}),(0,Q.jsxs)(`section`,{children:[(0,Q.jsxs)(`div`,{className:`mb-3 flex items-center justify-between`,children:[(0,Q.jsx)(`h4`,{className:`text-sm font-semibold text-fg`,children:n?`工具权限`:`Tool permissions`}),g.tools?(0,Q.jsxs)(k,{variant:`ghost`,onClick:()=>y({...g,tools:void 0}),children:[(0,Q.jsx)(m,{className:`size-4`}),n?`全部继承`:`Inherit all`]}):null]}),F?(0,Q.jsx)(`p`,{className:`mb-3 text-xs text-fg-muted`,children:n?`此智能体使用限定的工具范围。可在下方启用或移除工具,保存后从下一轮对话生效。`:`This agent uses a limited tool set. Add or remove tools below; changes apply from the next conversation turn.`}):null,(0,Q.jsx)(`div`,{className:`divide-y divide-edge overflow-hidden rounded-2xl border border-edge bg-surface-base`,children:M.map(t=>{if(F&&!F.includes(t))return(0,Q.jsxs)(`div`,{className:`flex items-center justify-between gap-3 px-4 py-3`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`code`,{className:`text-xs text-fg-muted`,children:t}),(0,Q.jsx)(`p`,{className:`mt-1 text-[11px] text-fg-muted`,children:n?`未开放`:`Unavailable`})]}),(0,Q.jsx)(k,{variant:`secondary`,className:`px-3 py-1.5 text-xs`,onClick:()=>q(t,!0),children:n?`启用`:`Enable`})]},t);let r=g.tools?.[t]?.mode,i=e.effective.tools[t]?.mode??`allow`;return(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3 px-4 py-3`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`code`,{className:`text-xs text-fg`,children:t}),(0,Q.jsx)(`p`,{className:`mt-1 text-[11px] text-fg-muted`,children:r?n?`单独设置`:`Agent override`:`${n?`继承`:`Inherits`} ${U[i]}`})]}),(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Q.jsx)(`div`,{className:`flex rounded-xl bg-surface-hover p-1`,children:[`inherit`,`allow`,`ask`,`deny`].map(e=>(0,Q.jsx)(`button`,{type:`button`,onClick:()=>K(t,e),className:v(`rounded-lg px-2.5 py-1.5 text-xs font-medium transition-colors`,(e===`inherit`?!r:r===e)?`bg-surface-panel text-fg shadow-surface`:`text-fg-muted hover:text-fg`),children:U[e]},e))}),F?(0,Q.jsx)(k,{variant:`ghost`,className:`px-2 py-1.5 text-xs`,onClick:()=>q(t,!1),children:n?`移除`:`Remove`}):null]})]},t)})})]})]}):null,f===`runtime`?(0,Q.jsxs)(`div`,{className:`space-y-6`,children:[(0,Q.jsx)(Be,{title:n?`运行限制`:`Runtime limits`,description:n?`留空即继承全局限制。`:`Leave blank to inherit global limits. Use overrides only to tighten or relax a specialist agent.`,action:g.runtime||g.workflows?(0,Q.jsxs)(k,{variant:`ghost`,onClick:()=>y({...g,runtime:void 0,workflows:void 0}),children:[(0,Q.jsx)(m,{className:`size-4`}),n?`全部继承`:`Inherit all`]}):void 0}),(0,Q.jsx)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:[[`maxTurns`,n?`单次最大轮数`:`Maximum turns`],[`timeoutMs`,n?`单轮超时(毫秒)`:`Turn timeout (ms)`],[`maxToolFailuresPerTurn`,n?`最大工具失败次数`:`Maximum tool failures`]].map(([t,r])=>(0,Q.jsxs)(`label`,{className:`text-xs font-medium text-fg-muted`,children:[(0,Q.jsxs)(`span`,{className:`flex items-center gap-2`,children:[r,g.runtime?.[t]===void 0?(0,Q.jsx)(ze,{children:n?`继承`:`Inherited`}):null]}),(0,Q.jsx)(`input`,{type:`number`,min:1,className:`${$} mt-1.5`,value:g.runtime?.[t]??``,placeholder:String(e.effective.runtime[t]??``),onChange:e=>{let n=He({...g.runtime??{},[t]:Re(e.target.value)});y({...g,runtime:n})}})]},t))}),(0,Q.jsxs)(`section`,{className:`rounded-2xl border border-edge bg-surface-base p-4`,children:[(0,Q.jsx)(`h4`,{className:`text-sm font-semibold text-fg`,children:n?`工作流`:`Workflows`}),(0,Q.jsxs)(`div`,{className:`mt-4 grid gap-4 sm:grid-cols-2`,children:[(0,Q.jsxs)(`label`,{className:`text-xs font-medium text-fg-muted`,children:[n?`默认工作流`:`Default workflow`,(0,Q.jsx)(`input`,{className:`${$} mt-1.5`,value:g.workflows?.default??``,placeholder:e.effective.workflows.default,onChange:e=>{let t=He({...g.workflows??{},default:e.target.value||void 0});y({...g,workflows:t})}})]}),(0,Q.jsxs)(`label`,{className:`text-xs font-medium text-fg-muted`,children:[n?`允许的工作流`:`Allowed workflows`,(0,Q.jsx)(`input`,{className:`${$} mt-1.5`,value:g.workflows?.allowed?.join(`, `)??``,placeholder:e.effective.workflows.allowed?.join(`, `),onChange:e=>{let t=Le(e.target.value),n=He({...g.workflows??{},allowed:t.length>0?t:void 0});y({...g,workflows:n})}})]})]})]}),(0,Q.jsxs)(`section`,{className:`rounded-2xl border border-edge bg-surface-base p-4`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`h4`,{className:`text-sm font-semibold text-fg`,children:n?`提示词缓存`:`Prompt cache`}),(0,Q.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:g.runtime?.promptCache?n?`使用单独设置`:`Using agent override`:n?`继承全局`:`Inherited globally`})]}),g.runtime?.promptCache?(0,Q.jsxs)(k,{variant:`ghost`,onClick:()=>{let e=He({...g.runtime??{},promptCache:void 0});y({...g,runtime:e})},children:[(0,Q.jsx)(m,{className:`size-4`}),n?`继承`:`Inherit`]}):null]}),g.runtime?.promptCache?(0,Q.jsxs)(`div`,{className:`mt-4 grid gap-4 sm:grid-cols-2`,children:[(0,Q.jsxs)(`div`,{className:`text-xs font-medium text-fg-muted`,children:[(0,Q.jsx)(`span`,{children:n?`模式`:`Mode`}),(0,Q.jsx)(`div`,{className:`mt-1.5 flex rounded-xl bg-surface-hover p-1`,children:[`auto`,`off`].map(e=>(0,Q.jsx)(`button`,{type:`button`,onClick:()=>y({...g,runtime:{...g.runtime,promptCache:{...g.runtime.promptCache,mode:e}}}),className:v(`flex-1 rounded-lg px-3 py-2 text-xs font-medium`,g.runtime?.promptCache?.mode===e?`bg-surface-panel text-fg shadow-surface`:`text-fg-muted`),children:e===`auto`?r.editorCacheModeAuto:r.editorCacheModeOff},e))})]}),(0,Q.jsxs)(`div`,{className:`text-xs font-medium text-fg-muted`,children:[(0,Q.jsx)(`span`,{children:n?`缓存周期`:`Lifetime`}),(0,Q.jsx)(`div`,{className:`mt-1.5 flex rounded-xl bg-surface-hover p-1`,children:[`short`,`long`].map(e=>(0,Q.jsx)(`button`,{type:`button`,onClick:()=>y({...g,runtime:{...g.runtime,promptCache:{...g.runtime.promptCache,lifetime:e}}}),className:v(`flex-1 rounded-lg px-3 py-2 text-xs font-medium`,g.runtime?.promptCache?.lifetime===e?`bg-surface-panel text-fg shadow-surface`:`text-fg-muted`),children:e===`short`?r.editorCacheLifetimeShort:r.editorCacheLifetimeLong},e))})]})]}):(0,Q.jsx)(k,{className:`mt-4`,onClick:()=>y({...g,runtime:{...g.runtime,promptCache:{...e.effective.runtime.promptCache??{mode:`auto`,lifetime:`short`}}}}),children:n?`自定义缓存策略`:`Customize cache policy`})]})]}):null,f===`danger`?(0,Q.jsxs)(`div`,{className:`space-y-6`,children:[(0,Q.jsx)(Be,{title:n?`危险区`:`Danger zone`,description:n?`这些操作会改变默认路由或移除智能体。`:`These actions change default routing or remove the agent.`}),e.isDefault?null:(0,Q.jsxs)(`div`,{className:`flex items-center justify-between gap-4 rounded-2xl border border-edge bg-surface-base p-4`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`h4`,{className:`text-sm font-semibold text-fg`,children:n?`设为默认智能体`:`Make default agent`}),(0,Q.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:n?`新会话和未指定路由将使用这个智能体。`:`New sessions and unspecified routes will use this agent.`})]}),(0,Q.jsx)(k,{disabled:b,onClick:()=>void G(),children:n?`设为默认`:`Make default`})]}),e.isDefault?(0,Q.jsx)(`p`,{className:`rounded-2xl bg-surface-base p-4 text-sm text-fg-muted`,children:n?`默认智能体不能删除,请先将其他智能体设为默认。`:`The default agent cannot be deleted. Make another agent the default first.`}):(0,Q.jsxs)(`div`,{className:`flex items-center justify-between gap-4 rounded-2xl border border-red-500/25 bg-red-500/5 p-4`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`h4`,{className:`text-sm font-semibold text-red-600`,children:n?`删除智能体`:`Delete agent`}),(0,Q.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:n?`配置条目会被移除,删除前仍会再次确认。`:`The configuration entry will be removed after confirmation.`})]}),(0,Q.jsxs)(k,{variant:`ghost`,className:`text-red-600`,onClick:u,children:[(0,Q.jsx)(ue,{className:`size-4`}),n?`删除`:`Delete`]})]})]}):null]}),(0,Q.jsxs)(`footer`,{className:`flex shrink-0 items-center justify-between gap-3 border-t border-edge bg-surface-panel px-5 py-3`,children:[(0,Q.jsx)(`p`,{className:`text-xs text-fg-muted`,children:j?n?`请补全自定义模型`:`Complete the custom model reference`:A?n?`有未保存的更改`:`Unsaved changes`:n?`所有更改已保存`:`All changes saved`}),(0,Q.jsxs)(`div`,{className:`flex gap-2`,children:[(0,Q.jsx)(k,{onClick:s,children:n?`关闭`:`Close`}),(0,Q.jsx)(k,{variant:`primary`,disabled:b||!A||j||g.profile!==void 0&&!g.profile.name.trim(),onClick:()=>void W(),children:b?n?`保存中…`:`Saving…`:n?`保存更改`:`Save changes`})]})]})]})]})}function We(e){let t=(0,Z.c)(36),{agent:n,messages:r,open:i,onOpenChange:a,children:o}=e,[c,l]=(0,X.useState)(null),u;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,Q.jsx)(x,{className:v(`xopc-dialog-overlay fixed inset-0 bg-scrim`,U)}),t[0]=u):u=t[0];let d;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(d=v(`xopc-dialog-content fixed flex flex-col overflow-hidden rounded-2xl border border-edge bg-surface-overlay shadow-popover`,H,`inset-3 h-[calc(100dvh-1.5rem)] min-h-0 sm:inset-auto sm:left-1/2 sm:top-1/2`,`sm:h-[min(88vh,48rem)] sm:w-[min(94vw,62rem)] sm:-translate-x-1/2 sm:-translate-y-1/2`),t[1]=d):d=t[1];let f;t[2]!==n.avatar||t[3]!==n.id?(f=(0,Q.jsx)(Y,{agentId:n.id,avatar:n.avatar,size:42,className:`size-11 shrink-0`}),t[2]=n.avatar,t[3]=n.id,t[4]=f):f=t[4];let p;t[5]!==n||t[6]!==r?(p=fe(n,r),t[5]=n,t[6]=r,t[7]=p):p=t[7];let m;t[8]===p?m=t[9]:(m=(0,Q.jsx)(E,{className:`truncate text-base font-semibold text-fg`,children:p}),t[8]=p,t[9]=m);let h;t[10]===n.id?h=t[11]:(h=(0,Q.jsx)(S,{className:`mt-0.5 truncate font-mono text-xs text-fg-muted`,children:n.id}),t[10]=n.id,t[11]=h);let _;t[12]!==m||t[13]!==h?(_=(0,Q.jsxs)(`div`,{className:`min-w-0`,children:[m,h]}),t[12]=m,t[13]=h,t[14]=_):_=t[14];let y;t[15]!==n.isDefault||t[16]!==r.listDefaultBadge?(y=n.isDefault?(0,Q.jsx)(`span`,{className:`rounded-full bg-accent-soft px-2 py-0.5 text-[11px] font-medium text-accent`,children:r.listDefaultBadge}):null,t[15]=n.isDefault,t[16]=r.listDefaultBadge,t[17]=y):y=t[17];let b;t[18]!==f||t[19]!==_||t[20]!==y?(b=(0,Q.jsxs)(`div`,{className:`flex min-w-0 items-center gap-3`,children:[f,_,y]}),t[18]=f,t[19]=_,t[20]=y,t[21]=b):b=t[21];let O;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(O=(0,Q.jsx)(g,{className:`size-4`}),t[22]=O):O=t[22];let k;t[23]===r.closeDialogAria?k=t[24]:(k=(0,Q.jsx)(C,{asChild:!0,children:(0,Q.jsx)(`button`,{type:`button`,className:`rounded-lg p-2 text-fg-muted hover:bg-surface-hover hover:text-fg`,"aria-label":r.closeDialogAria,children:O})}),t[23]=r.closeDialogAria,t[24]=k);let A;t[25]!==k||t[26]!==b?(A=(0,Q.jsxs)(`header`,{className:`flex shrink-0 items-center justify-between gap-4 border-b border-edge px-5 py-4`,children:[b,k]}),t[25]=k,t[26]=b,t[27]=A):A=t[27];let j;t[28]!==o||t[29]!==c||t[30]!==A?(j=(0,Q.jsxs)(w,{children:[u,(0,Q.jsx)(T,{ref:l,className:d,onOpenAutoFocus:Ge,children:(0,Q.jsxs)(s,{layer:`modal`,portalContainer:c,children:[A,o]})})]}),t[28]=o,t[29]=c,t[30]=A,t[31]=j):j=t[31];let M;return t[32]!==a||t[33]!==i||t[34]!==j?(M=(0,Q.jsx)(D,{open:i,onOpenChange:a,children:j}),t[32]=a,t[33]=i,t[34]=j,t[35]=M):M=t[35],M}function Ge(e){return e.preventDefault()}function Ke(e){let t=(0,Z.c)(13),{agents:n,busy:r,messages:i,onOpen:a,onChat:o}=e,s;if(t[0]!==n||t[1]!==r||t[2]!==i||t[3]!==o||t[4]!==a){let e;t[6]!==r||t[7]!==i||t[8]!==o||t[9]!==a?(e=e=>{let t=fe(e,i),n=ae(e,i);return(0,Q.jsx)(`li`,{className:`min-h-0`,children:(0,Q.jsxs)(`article`,{className:v(`group relative flex min-h-52 flex-col rounded-2xl border border-edge bg-surface-panel p-4 shadow-surface`,`transition-[transform,background-color,border-color] duration-200 ease-out hover:-translate-y-0.5 hover:border-accent/30 hover:bg-surface-hover/35 active:scale-[0.99] motion-reduce:transform-none`),children:[(0,Q.jsx)(`button`,{type:`button`,disabled:r,"aria-label":i.listConfigureAgent.replace(`{{name}}`,t),onClick:()=>a(e.id),className:`absolute inset-0 z-0 rounded-2xl focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`}),(0,Q.jsxs)(`div`,{className:`pointer-events-none relative z-10 flex items-start justify-between gap-3`,children:[(0,Q.jsxs)(`div`,{className:`flex min-w-0 items-center gap-3`,children:[(0,Q.jsx)(Y,{agentId:e.id,avatar:e.avatar,size:48,className:`size-12 shrink-0`}),(0,Q.jsx)(`div`,{className:`min-w-0`,children:(0,Q.jsx)(`h2`,{className:`truncate text-base font-semibold text-fg`,children:t})})]}),(0,Q.jsx)(`span`,{className:v(`rounded-full px-2 py-0.5 text-[11px] font-medium`,e.isDefault?`bg-accent-soft text-accent`:`bg-surface-hover text-fg-muted`),children:e.isDefault?i.listDefaultBadge:i.listCustomBadge})]}),(0,Q.jsx)(`p`,{className:`pointer-events-none relative z-10 mt-5 line-clamp-2 min-h-10 text-sm leading-5 text-fg-muted`,children:n||e.override.profile?.instructions||i.listUsesGlobalSettings}),(0,Q.jsxs)(`div`,{className:`pointer-events-none relative z-10 mt-4 rounded-xl bg-surface-base px-3 py-2.5`,children:[(0,Q.jsx)(`p`,{className:`text-[11px] font-medium uppercase tracking-wide text-fg-subtle`,children:i.listCurrentModelLabel}),(0,Q.jsx)(`p`,{className:`mt-1 truncate font-mono text-xs text-fg`,children:e.effective.models.chat.primary})]}),(0,Q.jsx)(`div`,{className:`relative z-10 mt-auto pt-4`,children:(0,Q.jsxs)(k,{className:`w-full`,disabled:r,onClick:t=>{t.stopPropagation(),o(e.id)},children:[(0,Q.jsx)(d,{className:`size-4`}),i.listChatWithAgent]})})]})},e.id)},t[6]=r,t[7]=i,t[8]=o,t[9]=a,t[10]=e):e=t[10],s=n.map(e),t[0]=n,t[1]=r,t[2]=i,t[3]=o,t[4]=a,t[5]=s}else s=t[5];let c;return t[11]===s?c=t[12]:(c=(0,Q.jsx)(`ul`,{className:`grid grid-cols-1 gap-3 sm:grid-cols-2 xl:grid-cols-3`,children:s}),t[11]=s,t[12]=c),c}var qe=`w-full rounded-xl border border-edge bg-surface-base px-3 py-2.5 text-sm text-fg outline-none focus:border-accent focus:ring-2 focus:ring-accent/15`;function Je(e){let t=(0,Z.c)(79),{draft:n,busy:r,error:i,messages:a,workingDirectoryMessages:o,onChange:s,onCreate:c,onOpenChange:l}=e,u=n.open,d;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Q.jsx)(x,{className:v(`xopc-dialog-overlay fixed inset-0 bg-scrim`,U)}),t[0]=d):d=t[0];let f;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(f=v(`xopc-dialog-content fixed left-1/2 top-1/2 flex h-[min(38rem,calc(100dvh-2rem))] w-[min(92vw,36rem)] -translate-x-1/2 -translate-y-1/2 flex-col`,`overflow-hidden rounded-2xl border border-edge bg-surface-overlay shadow-popover`,H),t[1]=f):f=t[1];let p;t[2]===a.manualCreateTitle?p=t[3]:(p=(0,Q.jsx)(E,{className:`text-base font-semibold text-fg`,children:a.manualCreateTitle}),t[2]=a.manualCreateTitle,t[3]=p);let m;t[4]===a.manualCreateDescription?m=t[5]:(m=(0,Q.jsx)(S,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:a.manualCreateDescription}),t[4]=a.manualCreateDescription,t[5]=m);let h;t[6]!==p||t[7]!==m?(h=(0,Q.jsxs)(`div`,{children:[p,m]}),t[6]=p,t[7]=m,t[8]=h):h=t[8];let _;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,Q.jsx)(g,{className:`size-4`,"aria-hidden":!0}),t[9]=_):_=t[9];let y;t[10]===a.manualCreateClose?y=t[11]:(y=(0,Q.jsx)(C,{asChild:!0,children:(0,Q.jsx)(`button`,{type:`button`,className:`touch-target shrink-0 rounded-lg p-2 text-fg-muted hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,"aria-label":a.manualCreateClose,children:_})}),t[10]=a.manualCreateClose,t[11]=y);let b;t[12]!==h||t[13]!==y?(b=(0,Q.jsxs)(`header`,{className:`flex shrink-0 items-start justify-between gap-4 border-b border-edge px-5 py-4`,children:[h,y]}),t[12]=h,t[13]=y,t[14]=b):b=t[14];let O;t[15]===i?O=t[16]:(O=i?(0,Q.jsx)(`p`,{role:`alert`,className:`rounded-lg bg-red-500/10 px-3 py-2 text-sm text-red-600`,children:i}):null,t[15]=i,t[16]=O);let A;t[17]===s?A=t[18]:(A=e=>s({name:e.target.value}),t[17]=s,t[18]=A);let j;t[19]!==n.name||t[20]!==a.manualCreateNamePlaceholder||t[21]!==A?(j=(0,Q.jsx)(`input`,{id:`manual-agent-name`,autoFocus:!0,className:`${qe} mt-1.5`,value:n.name,onChange:A,placeholder:a.manualCreateNamePlaceholder}),t[19]=n.name,t[20]=a.manualCreateNamePlaceholder,t[21]=A,t[22]=j):j=t[22];let M;t[23]!==a.manualCreateName||t[24]!==j?(M=(0,Q.jsxs)(`label`,{htmlFor:`manual-agent-name`,className:`block text-xs font-medium text-fg-muted`,children:[a.manualCreateName,j]}),t[23]=a.manualCreateName,t[24]=j,t[25]=M):M=t[25];let N;t[26]===s?N=t[27]:(N=e=>s({instructions:e.target.value}),t[26]=s,t[27]=N);let P;t[28]!==n.instructions||t[29]!==a.manualCreateInstructionsPlaceholder||t[30]!==N?(P=(0,Q.jsx)(`textarea`,{id:`manual-agent-instructions`,rows:4,className:`${qe} mt-1.5 resize-y leading-6`,value:n.instructions,onChange:N,placeholder:a.manualCreateInstructionsPlaceholder}),t[28]=n.instructions,t[29]=a.manualCreateInstructionsPlaceholder,t[30]=N,t[31]=P):P=t[31];let F;t[32]!==a.manualCreateInstructions||t[33]!==P?(F=(0,Q.jsxs)(`label`,{htmlFor:`manual-agent-instructions`,className:`block text-xs font-medium text-fg-muted`,children:[a.manualCreateInstructions,P]}),t[32]=a.manualCreateInstructions,t[33]=P,t[34]=F):F=t[34];let I;t[35]===a.manualCreateWorkspace?I=t[36]:(I=(0,Q.jsx)(`label`,{htmlFor:`manual-agent-workspace`,className:`block text-xs font-medium text-fg-muted`,children:a.manualCreateWorkspace}),t[35]=a.manualCreateWorkspace,t[36]=I);let L;t[37]===a.manualCreateWorkspaceHint?L=t[38]:(L=(0,Q.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-subtle`,children:a.manualCreateWorkspaceHint}),t[37]=a.manualCreateWorkspaceHint,t[38]=L);let R;t[39]===s?R=t[40]:(R=e=>s({workspace:e}),t[39]=s,t[40]=R);let z;t[41]!==r||t[42]!==n.workspace||t[43]!==a.manualCreateWorkspace||t[44]!==a.manualCreateWorkspacePlaceholder||t[45]!==R||t[46]!==o?(z=(0,Q.jsx)(`div`,{className:`mt-2`,children:(0,Q.jsx)(ye,{value:n.workspace,onChange:R,disabled:r,wd:o,placeholder:a.manualCreateWorkspacePlaceholder,inputAriaLabel:a.manualCreateWorkspace,inputClassName:`${qe} font-mono`})}),t[41]=r,t[42]=n.workspace,t[43]=a.manualCreateWorkspace,t[44]=a.manualCreateWorkspacePlaceholder,t[45]=R,t[46]=o,t[47]=z):z=t[47];let B;t[48]!==I||t[49]!==L||t[50]!==z?(B=(0,Q.jsxs)(`div`,{children:[I,L,z]}),t[48]=I,t[49]=L,t[50]=z,t[51]=B):B=t[51];let V;t[52]!==O||t[53]!==M||t[54]!==F||t[55]!==B?(V=(0,Q.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-5 overflow-y-auto p-5`,children:[O,M,F,B]}),t[52]=O,t[53]=M,t[54]=F,t[55]=B,t[56]=V):V=t[56];let W;t[57]!==r||t[58]!==a.manualCreateCancel?(W=(0,Q.jsx)(C,{asChild:!0,children:(0,Q.jsx)(k,{disabled:r,children:a.manualCreateCancel})}),t[57]=r,t[58]=a.manualCreateCancel,t[59]=W):W=t[59];let G;t[60]!==r||t[61]!==n.name?(G=r||!n.name.trim(),t[60]=r,t[61]=n.name,t[62]=G):G=t[62];let K=r?a.manualCreating:a.manualCreateSubmit,q;t[63]!==r||t[64]!==c||t[65]!==G||t[66]!==K?(q=(0,Q.jsx)(k,{variant:`primary`,disabled:G,"aria-busy":r,onClick:c,children:K}),t[63]=r,t[64]=c,t[65]=G,t[66]=K,t[67]=q):q=t[67];let J;t[68]!==W||t[69]!==q?(J=(0,Q.jsxs)(`footer`,{className:`flex shrink-0 justify-end gap-2 border-t border-edge px-5 py-4`,children:[W,q]}),t[68]=W,t[69]=q,t[70]=J):J=t[70];let Y;t[71]!==V||t[72]!==J||t[73]!==b?(Y=(0,Q.jsxs)(w,{children:[d,(0,Q.jsxs)(T,{className:f,children:[b,V,J]})]}),t[71]=V,t[72]=J,t[73]=b,t[74]=Y):Y=t[74];let ee;return t[75]!==n.open||t[76]!==l||t[77]!==Y?(ee=(0,Q.jsx)(D,{open:u,onOpenChange:l,children:Y}),t[75]=n.open,t[76]=l,t[77]=Y,t[78]=ee):ee=t[78],ee}var Ye=`px-4 pb-7 pt-3 sm:px-6 lg:px-8 lg:pb-9 lg:pt-4`,Xe=`max-w-7xl`;function Ze(){let e=(0,Z.c)(2),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Q.jsxs)(`div`,{className:`flex items-center justify-between gap-4`,children:[(0,Q.jsxs)(`div`,{className:`space-y-2`,children:[(0,Q.jsx)(V,{className:`h-7 w-28`}),(0,Q.jsx)(V,{className:`h-4 w-80 max-w-full`})]}),(0,Q.jsx)(V,{className:`h-9 w-28`})]}),e[0]=t):t=e[0];let n;return e[1]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Q.jsxs)(ge,{gap:`gap-5`,padding:Ye,className:Xe,children:[t,(0,Q.jsx)(`div`,{className:`grid grid-cols-1 gap-3 sm:grid-cols-2 xl:grid-cols-3`,children:[0,1,2].map(Qe)})]}),e[1]=n):n=e[1],n}function Qe(e){return(0,Q.jsx)(V,{className:`h-64 rounded-2xl`},e)}function $e({agentId:e,onHeaderActionChange:t}){let n=y(e=>e.conversationId),r=b(e=>e.language),i=r===`zh`,o=_(r),s=o.agentsSettings,l=a(),{data:u,error:d,isLoading:f,mutate:m}=O(n?`settings-gateway-agents`:null,I),[h,g]=(0,X.useState)(!1),[x,S]=(0,X.useState)(null),[C,w]=(0,X.useState)(null),[T,E]=(0,X.useState)(null),[D,j]=(0,X.useState)({open:!1,name:``,instructions:``,workspace:``}),M=(0,X.useRef)(!1),N=u?.agents.find(t=>t.id===e),P=(0,X.useCallback)(()=>{u&&(S(null),de(u.defaultId),l(`/chat/new?${new URLSearchParams({agentSetup:`1`,projectScope:`none`,draft:s.setupDraftPrefix}).toString()}`,{state:{forceNewChat:!0,agentId:u.defaultId}}))},[s.setupDraftPrefix,u,l]),L=(0,X.useCallback)(async()=>{if(!(h||!D.name.trim())){g(!0),w(null);try{let e=await z({profile:{name:D.name.trim(),...D.instructions.trim()?{instructions:D.instructions.trim()}:{}},...D.workspace.trim()?{workspace:D.workspace.trim()}:{}});j({open:!1,name:``,instructions:``,workspace:``}),de(e.createdAgentId),l(`/chat/new?projectScope=none`,{state:{forceNewChat:!0,agentId:e.createdAgentId}})}catch(e){w(e instanceof Error?e.message:String(e))}finally{g(!1)}}},[h,D,l]),R=(0,X.useMemo)(()=>({overflow:(0,Q.jsxs)(se,{children:[(0,Q.jsx)(q,{asChild:!0,children:(0,Q.jsx)(k,{variant:`secondary`,className:`size-9 shrink-0 p-0`,"aria-label":o.capabilitiesHub.moreActions,title:o.capabilitiesHub.moreActions,children:(0,Q.jsx)(c,{className:`size-4`,"aria-hidden":!0})})}),(0,Q.jsx)(W,{children:(0,Q.jsxs)(J,{align:`end`,sideOffset:6,className:`z-50 min-w-48 rounded-xl border border-edge bg-surface-panel p-1 shadow-popover`,children:[(0,Q.jsxs)(le,{className:v(`touch-target flex cursor-pointer items-center gap-2 rounded-lg px-3 py-2 text-sm text-fg outline-none data-[highlighted]:bg-surface-hover`,A.transition),onSelect:()=>l(`/settings/agent-defaults`),children:[(0,Q.jsx)(ce,{className:`size-4 text-fg-muted`,"aria-hidden":!0}),i?`全局默认配置`:`Global defaults`]}),(0,Q.jsxs)(le,{className:v(`touch-target flex cursor-pointer items-center gap-2 rounded-lg px-3 py-2 text-sm text-fg outline-none data-[highlighted]:bg-surface-hover`,A.transition),onSelect:()=>{w(null),j(e=>({...e,open:!0}))},children:[(0,Q.jsx)(G,{className:`size-4 text-fg-muted`,strokeWidth:1.75,"aria-hidden":!0}),s.manualCreateMenu]})]})})]}),primary:(0,Q.jsxs)(k,{variant:`primary`,className:`shrink-0`,"aria-label":s.listNewAgentCard,onClick:P,children:[(0,Q.jsx)(p,{className:`size-4`,"aria-hidden":!0}),(0,Q.jsx)(`span`,{className:`hidden sm:inline`,children:s.listNewAgentCard})]})}),[s.listNewAgentCard,s.manualCreateMenu,o.capabilitiesHub.moreActions,l,P,i]);(0,X.useLayoutEffect)(()=>(t?.(R),()=>t?.(null)),[R,t]);let B=async e=>{g(!0),S(null);try{await F(e.id),l(re)}catch(e){S(e instanceof Error?e.message:String(e))}finally{g(!1)}},V=e=>{de(e),l(`/chat/new`)},H=e=>{M.current=!1,window.setTimeout(()=>l(he(e)),0)},U=()=>{if(M.current){E({kind:`discard`,destination:re});return}M.current=!1,l(re)},K=()=>{if(M.current){E({kind:`discard`,destination:`/settings/agent-defaults`});return}M.current=!1,l(`/settings/agent-defaults`)},Y=()=>{if(!T)return;if(E(null),T.kind===`discard`){M.current=!1,l(T.destination);return}let e=u?.agents.find(e=>e.id===T.agentId);e&&B(e)},ee=(0,X.useCallback)(e=>{M.current=e},[]);return n?d&&!u?(0,Q.jsxs)(ge,{className:Xe,padding:Ye,children:[(0,Q.jsx)(`p`,{className:`rounded-xl bg-red-500/10 px-3 py-2 text-sm text-red-600`,children:String(d)}),(0,Q.jsx)(k,{onClick:()=>void m(),children:i?`重试`:`Retry`})]}):f||!u?(0,Q.jsx)(Ze,{}):(0,Q.jsxs)(ge,{gap:`gap-5`,className:Xe,padding:Ye,children:[(d||x)&&!N?(0,Q.jsx)(`p`,{className:`rounded-xl bg-red-500/10 px-3 py-2 text-sm text-red-600`,children:x??String(d)}):null,(0,Q.jsx)(Ke,{agents:u.agents,busy:h,messages:s,onOpen:H,onChat:V}),N?(0,Q.jsx)(We,{agent:N,messages:s,open:!0,onOpenChange:e=>{e||U()},children:(0,Q.jsx)(Ue,{agent:N,toolIds:u.builtinToolIds,zh:i,messages:s,externalError:x,onDirtyChange:ee,onClose:U,onOpenDefaults:K,onChat:()=>V(N.id),onDelete:()=>E({kind:`delete`,agentId:N.id,displayName:fe(N,s)})},N.id)}):null,(0,Q.jsx)(Je,{draft:D,busy:h,error:C,messages:s,workingDirectoryMessages:o.chat.workingDirectory,onChange:e=>j(t=>({...t,...e})),onCreate:()=>void L(),onOpenChange:e=>{h||(j(t=>({...t,open:e})),e||w(null))}}),(0,Q.jsx)(pe,{open:T!==null,title:T?.kind===`delete`?i?`删除智能体?`:`Delete agent?`:i?`放弃未保存的更改?`:`Discard unsaved changes?`,description:T?.kind===`delete`?i?`删除 ${T.displayName}?此操作无法撤销。`:`Delete ${T.displayName}? This cannot be undone.`:i?`当前更改尚未保存,离开后将丢失。`:`Your changes have not been saved. Leaving will discard them.`,confirmLabel:T?.kind===`delete`?i?`删除`:`Delete`:i?`放弃并离开`:`Discard and leave`,cancelLabel:i?`继续编辑`:`Keep editing`,destructive:!0,overlayClassName:`z-[100]`,contentClassName:`z-[101]`,onConfirm:Y,onCancel:()=>E(null)})]}):(0,Q.jsx)(ge,{className:Xe,padding:Ye,children:(0,Q.jsx)(`p`,{className:`text-sm text-fg-muted`,children:i?`需要本机服务令牌。`:`Local service token required.`})})}export{$e as AgentsSettingsPanel};
@@ -1,2 +1,2 @@
1
1
  const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/vendor-swr-BIWyz7Rc.js","assets/rolldown-runtime-aKtaBQYM.js","assets/vendor-react-BOUWij0V.js"])))=>i.map(i=>d[i]);
2
- import{t as e}from"./preload-helper-zJ_50EbN.js";import{a as t,r as n}from"./locale-store-DId6-v2R.js";import{n as r}from"./gateway-config-swr-CoRoOG1l.js";async function i(){let e=await t(n(`/api/agents`));if(!e.payload?.defaultId||!Array.isArray(e.payload.agents))throw Error(`Invalid /api/agents response`);return e.payload}async function a(e){let r=await t(n(`/api/agents/${encodeURIComponent(e)}/effective-config`));if(!r.payload?.config||!r.payload.sources)throw Error(`Invalid effective agent config response`);return r.payload}async function o(t){let{mutate:n}=await e(async()=>{let{mutate:e}=await import(`./vendor-swr-BIWyz7Rc.js`).then(e=>e.r);return{mutate:e}},__vite__mapDeps([0,1,2]));await Promise.all([n(`settings-gateway-agents`,t,{revalidate:!1}),n(`setup-checklist-agents`,t,{revalidate:!1}),r()])}async function s(e){let r=await t(n(`/api/agents`),{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)});if(!r.payload?.agentId||!r.payload.agents)throw Error(`Invalid create agent response`);return await o(r.payload.agents),{...r.payload.agents,createdAgentId:r.payload.agentId}}async function c(e,r){let i=await t(n(`/api/agents/${encodeURIComponent(e)}`),{method:`PATCH`,headers:{"Content-Type":`application/json`},body:JSON.stringify(r)});if(!i.payload)throw Error(`Invalid update agent response`);return await o(i.payload),i.payload}async function l(e,r=!1){let i=await t(n(`/api/agents/${encodeURIComponent(e)}${r?`?purge=1`:``}`),{method:`DELETE`});if(!i.payload?.agents)throw Error(`Invalid delete agent response`);return await o(i.payload.agents),i.payload.agents}async function u(e){let r=(await t(n(`/api/agents/${encodeURIComponent(e)}/files`))).payload,i=typeof r?.profileDir==`string`?r.profileDir.trim():``;if(!r?.files||!i)throw Error(`Invalid agent profile files response`);return{agentId:r.agentId,profileDir:i,files:r.files}}async function d(e,r){let i=(await t(n(`/api/agents/${encodeURIComponent(e)}/files/${encodeURIComponent(r)}`))).payload?.content;if(typeof i!=`string`)throw Error(`Invalid agent profile file response`);return i}async function f(e,r,i){await t(n(`/api/agents/${encodeURIComponent(e)}/files/${encodeURIComponent(r)}`),{method:`PUT`,headers:{"Content-Type":`application/json`},body:JSON.stringify({content:i})})}export{a,c,u as i,l as n,i as o,d as r,f as s,s as t};
2
+ import{t as e}from"./preload-helper-zJ_50EbN.js";import{a as t,r as n}from"./locale-store-C8TMD2gn.js";import{n as r}from"./gateway-config-swr-Cjnkle5J.js";async function i(){let e=await t(n(`/api/agents`));if(!e.payload?.defaultId||!Array.isArray(e.payload.agents))throw Error(`Invalid /api/agents response`);return e.payload}async function a(e){let r=await t(n(`/api/agents/${encodeURIComponent(e)}/effective-config`));if(!r.payload?.config||!r.payload.sources)throw Error(`Invalid effective agent config response`);return r.payload}async function o(t){let{mutate:n}=await e(async()=>{let{mutate:e}=await import(`./vendor-swr-BIWyz7Rc.js`).then(e=>e.r);return{mutate:e}},__vite__mapDeps([0,1,2]));await Promise.all([n(`settings-gateway-agents`,t,{revalidate:!1}),n(`setup-checklist-agents`,t,{revalidate:!1}),r()])}async function s(e){let r=await t(n(`/api/agents`),{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)});if(!r.payload?.agentId||!r.payload.agents)throw Error(`Invalid create agent response`);return await o(r.payload.agents),{...r.payload.agents,createdAgentId:r.payload.agentId}}async function c(e,r){let i=await t(n(`/api/agents/${encodeURIComponent(e)}`),{method:`PATCH`,headers:{"Content-Type":`application/json`},body:JSON.stringify(r)});if(!i.payload)throw Error(`Invalid update agent response`);return await o(i.payload),i.payload}async function l(e,r=!1){let i=await t(n(`/api/agents/${encodeURIComponent(e)}${r?`?purge=1`:``}`),{method:`DELETE`});if(!i.payload?.agents)throw Error(`Invalid delete agent response`);return await o(i.payload.agents),i.payload.agents}async function u(e){let r=(await t(n(`/api/agents/${encodeURIComponent(e)}/files`))).payload,i=typeof r?.profileDir==`string`?r.profileDir.trim():``;if(!r?.files||!i)throw Error(`Invalid agent profile files response`);return{agentId:r.agentId,profileDir:i,files:r.files}}async function d(e,r){let i=(await t(n(`/api/agents/${encodeURIComponent(e)}/files/${encodeURIComponent(r)}`))).payload?.content;if(typeof i!=`string`)throw Error(`Invalid agent profile file response`);return i}async function f(e,r,i){await t(n(`/api/agents/${encodeURIComponent(e)}/files/${encodeURIComponent(r)}`),{method:`PUT`,headers:{"Content-Type":`application/json`},body:JSON.stringify({content:i})})}export{a,c,u as i,l as n,i as o,d as r,f as s,s as t};
@@ -0,0 +1 @@
1
+ import{i as e,r as t}from"./product-delivery-BAks11S4.js";var n=new Set([`agents`,`capabilities`,`personal`,`user-model`,`automations`,`browser-automations`,`channels`,`chat`,`connectors`,`extensions`,`local-apps`,`notes`,`onboarding`,`open`,`projects`,`scenes`,`settings`,`skills`,`tasks`,`workflows`,`you`]);function r(e){if(!e.startsWith(`/`)||e.startsWith(`//`)||e.includes(`\\`))return null;let t=e.slice(1).split(/[/?#]/,1)[0]??``;return t&&n.has(t)?e:null}function i(e){try{let t=new URL(e);return t.protocol!==`xopc:`||t.hostname!==`settings`?null:r(`/settings${t.pathname===`/`?``:t.pathname}${t.search}${t.hash}`)}catch{return null}}function a(n,a=window.location.href){let o=n.trim();if(!o)return{kind:`blocked`};let s=t(o);if(s){let t=e({...s,title:s.id,capabilities:[`open`]});return t?{kind:`internal-route`,route:t}:{kind:`blocked`}}let c=i(o);if(c)return{kind:`internal-route`,route:c};if(o.startsWith(`#/`)){let e=r(o.slice(1));return e?{kind:`internal-route`,route:e}:{kind:`blocked`}}if(o.startsWith(`/`)){let e=r(o);return e?{kind:`internal-route`,route:e}:{kind:`blocked`}}try{let e=new URL(o,a);if(e.protocol!==`http:`&&e.protocol!==`https:`||e.username||e.password)return{kind:`blocked`};let t=new URL(a);if(e.origin===t.origin&&e.hash.startsWith(`#/`)){let t=r(e.hash.slice(1));if(t)return{kind:`internal-route`,route:t}}return{kind:`external-http`,url:e.toString()}}catch{return{kind:`blocked`}}}function o(e,t,n){for(let r of e.querySelectorAll(`a`)){if(n?.(r))continue;let e=a(r.getAttribute(`href`)??``);if(r.dataset.xopcLinkKind=e.kind,e.kind===`blocked`){r.replaceWith(...Array.from(r.childNodes));continue}if(e.kind===`internal-route`){if(r.setAttribute(`href`,`#${e.route}`),r.removeAttribute(`target`),t){let n=e.route.slice(1).split(/[/?#]/,1)[0]??``,i=t.destinations[n]??t.open,a=r.dataset.xopcLinkLabel??r.textContent?.trim()??``;r.dataset.xopcLinkLabel=a,(/^(?:xopc:\/\/|#\/)/i.test(a)||/^(?:Open(?: in xopc)?|打开)$/i.test(a))&&(r.textContent=i),r.title||=i}continue}r.target=`_blank`;let i=new Set(r.rel.split(/\s+/).filter(Boolean));i.add(`noopener`),i.add(`noreferrer`),r.rel=[...i].join(` `)}}async function s(e){let t=a(e);if(t.kind!==`external-http`)return{ok:!1,error:`Only external HTTP(S) links can be opened`};let n=window.electronAPI?.shell?.openExternalUrl;return n?n(t.url):(window.open(t.url,`_blank`,`noopener,noreferrer`),{ok:!0})}export{s as n,a as r,o as t};
@@ -1 +1 @@
1
- import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{t as i}from"./copy-Dv6d4Dvw.js";import{t as a}from"./messages-BHvpZNe9.js";import{t as o}from"./cn-JdwAhgNB.js";import{a as s,n as c,r as l}from"./locale-store-DId6-v2R.js";import{a as u,i as d,o as f,r as p,s as m,t as h}from"./dist-BGTk37IG.js";import{t as g}from"./copy-to-clipboard-HOJ79TWv.js";import{i as _}from"./vendor-swr-BIWyz7Rc.js";import{t as v}from"./button-CS04eWY9.js";import{n as y}from"./interaction-BdhHBbYa.js";import{t as b}from"./skeleton-BwbyijEw.js";import{i as x,o as S}from"./settings-shell-dialog-layer-BU3UuiJr.js";import{n as C}from"./electron-env-Dit0bHgy.js";import{r as w}from"./settings-form-draft-Dy10ldo8.js";import{es as T}from"./index-BpXej9jJ.js";import{n as E,r as D}from"./settings-page-layout-X1x-2Cp9.js";import{r as O,t as k}from"./settings-form-section-exRhP9xn.js";import{t as A}from"./settings-loading-skeleton-CAmWMaOT.js";var j=n(),M=e(t(),1),N=r();function P(e,t){return e==null?t:e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}function F(e,t){return e===`PENDING_UPDATE`?t.pendingUpdate??t.generic:e===`UNINSTALLER_NOT_FOUND`?t.uninstallerNotFound??t.generic:e===`NOT_PACKAGED`?t.notPackaged??t.generic:t.generic}function I(e,t){if(e.platform===`darwin`)return t.uninstallDescDarwin;if(e.platform===`win32`)return t.uninstallDescWin;if(e.platform===`linux`){if(e.linuxPackageKind===`appimage`)return t.uninstallDescLinuxAppImage;if(e.linuxPackageKind===`deb`){let n=e.linuxDebPackageName??`xopc`;return t.uninstallDescLinuxDeb.replace(/\{\{package\}\}/g,n)}return t.uninstallDescLinuxUnknown}return t.uninstallDescLinuxUnknown}var L={info:null,loadError:null,actionError:null,copiedField:null,clearDialogOpen:!1,clearConfirmChecked:!1,clearConfirmText:``,uninstallDialogOpen:!1,removeUserDataOnUninstall:!1,busy:!1};function R({api:e,messages:t,embedded:n=!0}){let[r,a]=(0,M.useReducer)(w,L),{info:s,loadError:c,actionError:l,copiedField:_,clearDialogOpen:b,clearConfirmChecked:C,clearConfirmText:E,uninstallDialogOpen:D,removeUserDataOnUninstall:O,busy:j}=r,R=(0,M.useCallback)(async()=>{if(e?.getUninstallInfo){a({type:`patch`,patch:{loadError:null}});try{a({type:`patch`,patch:{info:await e.getUninstallInfo()}})}catch(e){a({type:`patch`,patch:{loadError:e instanceof Error?e.message:String(e)}})}}},[e]);(0,M.useEffect)(()=>{R()},[R]);let z=async(e,n)=>{if(await g(e)){a({type:`patch`,patch:{actionError:null,copiedField:n}}),window.setTimeout(()=>a({type:`patch`,patch:{copiedField:null}}),2e3);return}a({type:`patch`,patch:{actionError:t.copyFailed}})},B=async()=>{if(e?.clearUserData){a({type:`patch`,patch:{busy:!0,actionError:null}});try{let n=await e.clearUserData();n.ok||a({type:`patch`,patch:{actionError:F(n.error,t.errors)}})}catch(e){a({type:`patch`,patch:{actionError:e instanceof Error?e.message:t.errors.generic}})}finally{a({type:`patch`,patch:{busy:!1,clearDialogOpen:!1,clearConfirmChecked:!1,clearConfirmText:``}})}}},V=async()=>{if(e?.uninstallApp){a({type:`patch`,patch:{busy:!0,actionError:null}});try{let n=await e.uninstallApp({removeUserData:O});n.ok||a({type:`patch`,patch:{actionError:F(n.error,t.errors)}})}catch(e){a({type:`patch`,patch:{actionError:e instanceof Error?e.message:t.errors.generic}})}finally{a({type:`patch`,patch:{busy:!1,uninstallDialogOpen:!1}})}}};if(c)return(0,N.jsx)(`p`,{className:`text-sm text-amber-600 dark:text-amber-400`,role:`alert`,children:c});if(!s)return(0,N.jsx)(A,{rows:2});let H=!s.packaged,U=j||s.pendingUpdate||H,W=!H&&s.uninstallMode!==`unsupported`,G=I(s,t),K=C&&E.trim()===t.clearDataConfirmPhrase;return(0,N.jsxs)(N.Fragment,{children:[(0,N.jsxs)(k,{children:[n?(0,N.jsxs)(`div`,{className:`mb-4 flex items-center gap-2 text-sm font-semibold text-fg`,children:[(0,N.jsx)(T,{className:`size-4 text-accent`,strokeWidth:1.75}),t.title]}):null,l?(0,N.jsx)(`p`,{className:`mb-3 text-sm text-amber-600 dark:text-amber-400`,role:`alert`,children:l}):null,H?(0,N.jsxs)(`div`,{className:`mb-4 rounded-xl bg-surface-panel/70 px-3 py-2.5 shadow-surface`,children:[(0,N.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:t.devOnlyTitle}),(0,N.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:t.devOnlyBody})]}):null,s.pendingUpdate?(0,N.jsx)(`p`,{className:`mb-3 rounded-xl bg-amber-500/10 px-3 py-2 text-xs text-amber-800 dark:text-amber-200`,children:t.pendingUpdateBlocked}):null,(0,N.jsxs)(`dl`,{className:`space-y-3 text-sm`,children:[(0,N.jsxs)(`div`,{className:`rounded-xl bg-surface-panel/70 p-3 shadow-surface`,children:[(0,N.jsx)(`dt`,{className:`text-xs font-medium text-fg-muted`,children:t.appPath}),(0,N.jsxs)(`dd`,{className:`mt-1 flex items-start justify-between gap-2`,children:[(0,N.jsx)(`code`,{className:`break-all text-xs text-fg`,children:s.appPath}),(0,N.jsxs)(`button`,{type:`button`,className:o(`inline-flex shrink-0 items-center gap-1 rounded-lg border border-edge px-2 py-1 text-xs text-fg hover:bg-surface-hover`,y.press),onClick:()=>void z(s.appPath,`app`),children:[(0,N.jsx)(i,{className:`size-3`,"aria-hidden":!0}),_===`app`?t.copied:t.copyPath]})]})]}),(0,N.jsxs)(`div`,{className:`rounded-xl bg-surface-panel/70 p-3 shadow-surface`,children:[(0,N.jsx)(`dt`,{className:`text-xs font-medium text-fg-muted`,children:t.dataPath}),(0,N.jsxs)(`dd`,{className:`mt-1 flex items-start justify-between gap-2`,children:[(0,N.jsx)(`code`,{className:`break-all text-xs text-fg`,children:s.dataPath}),(0,N.jsxs)(`button`,{type:`button`,className:o(`inline-flex shrink-0 items-center gap-1 rounded-lg border border-edge px-2 py-1 text-xs text-fg hover:bg-surface-hover`,y.press),onClick:()=>void z(s.dataPath,`data`),children:[(0,N.jsx)(i,{className:`size-3`,"aria-hidden":!0}),_===`data`?t.copied:t.copyPath]})]}),(0,N.jsxs)(`p`,{className:`mt-2 text-xs text-fg-muted`,children:[t.dataSize,`: `,P(s.dataSizeBytes,t.dataSizeUnknown)]}),(0,N.jsx)(`p`,{className:`mt-2 text-xs leading-relaxed text-amber-800 dark:text-amber-200`,children:t.sharedDataWarning})]})]}),(0,N.jsxs)(`div`,{className:`mt-4 space-y-3`,children:[(0,N.jsxs)(`div`,{className:`flex flex-col gap-2 rounded-xl bg-surface-panel/70 p-3 shadow-surface sm:flex-row sm:items-center sm:justify-between`,children:[(0,N.jsxs)(`div`,{children:[(0,N.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:t.clearData}),(0,N.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-muted`,children:t.clearDataDesc})]}),(0,N.jsx)(`button`,{type:`button`,disabled:U,className:o(`inline-flex shrink-0 items-center justify-center rounded-lg border border-danger/40 bg-danger px-3 py-1.5 text-sm font-medium text-white hover:bg-danger/90 disabled:opacity-50`,y.press),onClick:()=>{a({type:`patch`,patch:{clearConfirmChecked:!1,clearConfirmText:``,clearDialogOpen:!0}})},children:t.clearData})]}),W?(0,N.jsxs)(`div`,{className:`flex flex-col gap-2 rounded-xl bg-surface-panel/70 p-3 shadow-surface sm:flex-row sm:items-center sm:justify-between`,children:[(0,N.jsxs)(`div`,{children:[(0,N.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:t.uninstall}),(0,N.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-muted`,children:G})]}),(0,N.jsx)(`button`,{type:`button`,disabled:U,className:o(`inline-flex shrink-0 items-center justify-center rounded-lg border border-edge bg-surface-base px-3 py-1.5 text-sm font-medium text-fg hover:bg-surface-hover disabled:opacity-50`,y.press),onClick:()=>{a({type:`patch`,patch:{removeUserDataOnUninstall:!1,uninstallDialogOpen:!0}})},children:t.uninstall})]}):null]})]}),(0,N.jsx)(h,{open:b,onOpenChange:e=>{e||a({type:`patch`,patch:{clearDialogOpen:!1,clearConfirmChecked:!1,clearConfirmText:``}})},children:(0,N.jsxs)(f,{children:[(0,N.jsx)(u,{className:o(`xopc-dialog-overlay fixed inset-0 bg-scrim backdrop-blur-[1px]`,S)}),(0,N.jsxs)(p,{className:o(`xopc-dialog-content fixed left-1/2 top-1/2 w-[min(100%-2rem,28rem)] -translate-x-1/2 -translate-y-1/2`,x,`rounded-2xl border border-edge bg-surface-overlay p-6 shadow-popover outline-none dark:border-edge`),onOpenAutoFocus:e=>e.preventDefault(),children:[(0,N.jsx)(m,{className:`text-base font-semibold text-fg`,children:t.clearDataConfirmTitle}),(0,N.jsx)(d,{className:`mt-2 text-sm text-fg-muted`,children:t.clearDataConfirmDesc}),(0,N.jsxs)(`label`,{className:`mt-4 flex cursor-pointer items-start gap-2 text-sm text-fg`,children:[(0,N.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox mt-0.5`,checked:C,onChange:e=>a({type:`patch`,patch:{clearConfirmChecked:e.target.checked}})}),(0,N.jsx)(`span`,{children:t.clearDataConfirmCheckbox})]}),(0,N.jsxs)(`div`,{className:`mt-4 space-y-2`,children:[(0,N.jsx)(`label`,{className:`block text-sm font-medium text-fg`,htmlFor:`clear-data-confirm`,children:t.clearDataConfirmLabel}),(0,N.jsx)(`input`,{id:`clear-data-confirm`,type:`text`,autoComplete:`off`,spellCheck:!1,className:o(`w-full rounded-md border border-edge bg-surface-panel px-3 py-1.5 font-mono text-xs text-fg`,`placeholder:text-fg-subtle`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 focus-visible:ring-offset-surface-panel`,`dark:border-edge`),placeholder:t.clearDataConfirmPhrase,value:E,onChange:e=>a({type:`patch`,patch:{clearConfirmText:e.target.value}})}),(0,N.jsx)(`p`,{className:`text-xs text-fg-muted`,children:t.clearDataConfirmHint})]}),(0,N.jsxs)(`div`,{className:`mt-6 flex justify-end gap-2`,children:[(0,N.jsx)(v,{type:`button`,variant:`secondary`,disabled:j,onClick:()=>{a({type:`patch`,patch:{clearDialogOpen:!1,clearConfirmChecked:!1,clearConfirmText:``}})},children:t.cancel}),(0,N.jsx)(v,{type:`button`,variant:`secondary`,className:`border-danger/40 bg-danger text-white hover:bg-danger/90 dark:border-danger/40`,disabled:j||!K,onClick:()=>void B(),children:t.confirmClear})]})]})]})}),W?(0,N.jsx)(h,{open:D,onOpenChange:e=>{e||a({type:`patch`,patch:{uninstallDialogOpen:!1}})},children:(0,N.jsxs)(f,{children:[(0,N.jsx)(u,{className:o(`xopc-dialog-overlay fixed inset-0 bg-scrim backdrop-blur-[1px]`,S)}),(0,N.jsxs)(p,{className:o(`xopc-dialog-content fixed left-1/2 top-1/2 w-[min(100%-2rem,28rem)] -translate-x-1/2 -translate-y-1/2`,x,`rounded-2xl border border-edge bg-surface-overlay p-6 shadow-popover outline-none dark:border-edge`),onOpenAutoFocus:e=>e.preventDefault(),children:[(0,N.jsx)(m,{className:`text-base font-semibold text-fg`,children:t.uninstallConfirmTitle}),(0,N.jsx)(d,{className:`mt-2 text-sm text-fg-muted`,children:G}),(0,N.jsxs)(`label`,{className:`mt-4 flex cursor-pointer items-start gap-2 text-sm text-fg`,children:[(0,N.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox mt-0.5`,checked:O,onChange:e=>a({type:`patch`,patch:{removeUserDataOnUninstall:e.target.checked}})}),(0,N.jsx)(`span`,{children:t.removeUserDataCheckbox})]}),O?(0,N.jsx)(`p`,{className:`mt-2 text-xs text-fg-muted`,children:t.clearDataConfirmDesc}):null,(0,N.jsxs)(`div`,{className:`mt-6 flex justify-end gap-2`,children:[(0,N.jsx)(v,{type:`button`,variant:`secondary`,disabled:j,onClick:()=>a({type:`patch`,patch:{uninstallDialogOpen:!1}}),children:t.cancel}),(0,N.jsx)(v,{type:`button`,variant:`secondary`,className:`border-danger/40 bg-danger text-white hover:bg-danger/90 dark:border-danger/40`,disabled:j,onClick:()=>void V(),children:t.confirmUninstall})]})]})]})}):null]})}async function z(){return(await s(l(`/api/migrations/status`))).payload}async function B(){await s(l(`/api/migrations/apply`),{method:`POST`,body:`{}`})}function V({messages:e}){let{data:t,error:n,isLoading:r,mutate:i}=_(`settings-migration-status`,z,{refreshInterval:0,revalidateOnFocus:!1}),[a,o]=(0,M.useState)(!1),[s,c]=(0,M.useState)(null);async function l(){o(!0),c(null);try{await B(),await i(),window.dispatchEvent(new CustomEvent(`config-reload`))}catch(e){c(e instanceof Error?e.message:String(e))}finally{o(!1)}}if(r)return(0,N.jsxs)(`section`,{className:`rounded-xl bg-surface-hover/20 p-4`,"aria-busy":`true`,children:[(0,N.jsx)(b,{className:`h-5 w-40 max-w-full`}),(0,N.jsx)(b,{className:`mt-2 h-4 w-64 max-w-full`})]});if(n)return(0,N.jsxs)(`section`,{className:`rounded-xl bg-surface-hover/20 p-4`,children:[(0,N.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:e.title}),(0,N.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:e.checkFailed})]});let u=t?.items??[],d=u.filter(e=>e.status===`conflict`||e.status===`error`),f=u.filter(e=>e.safety===`auto`&&e.status===`planned`),p=d.length>0||u.some(e=>e.safety!==`auto`);return(0,N.jsxs)(`section`,{className:`rounded-xl bg-surface-hover/20 p-4`,children:[(0,N.jsxs)(`div`,{className:`flex flex-col gap-3 sm:flex-row sm:items-start sm:justify-between`,children:[(0,N.jsxs)(`div`,{children:[(0,N.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:e.title}),(0,N.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:u.length===0?e.upToDate:p?e.manualAttention:e.safeRepairs.replace(`{{count}}`,String(f.length))})]}),f.length>0&&!p?(0,N.jsx)(v,{type:`button`,variant:`primary`,className:`px-3 py-1.5 text-xs`,onClick:()=>void l(),disabled:a,children:a?e.applying:e.apply}):null]}),u.length>0?(0,N.jsx)(`div`,{className:`mt-3 space-y-2`,children:u.map(e=>(0,N.jsxs)(`div`,{className:`rounded-xl bg-surface-base/55 px-3 py-2`,children:[(0,N.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,N.jsx)(`div`,{className:`truncate text-sm font-medium text-fg`,children:e.title}),(0,N.jsx)(`span`,{className:`rounded-full bg-surface-hover px-2 py-0.5 text-[11px] uppercase tracking-wide text-fg-muted`,children:e.status})]}),(0,N.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:e.message})]},e.id))}):null,s?(0,N.jsx)(`p`,{className:`mt-3 text-sm text-red-500`,children:s}):null]})}function H(){let e=(0,j.c)(28),t=c(U),n;e[0]===t?n=e[1]:(n=a(t),e[0]=t,e[1]=n);let r=n.systemSettings,i=r.desktopApp,o=typeof window<`u`?window.electronAPI?.system:void 0;if(!C()||!o){let t;e[2]===i.title?t=e[3]:(t=(0,N.jsx)(E,{title:i.title}),e[2]=i.title,e[3]=t);let n;e[4]===i.migrations?n=e[5]:(n=(0,N.jsx)(V,{messages:i.migrations}),e[4]=i.migrations,e[5]=n);let a;e[6]===Symbol.for(`react.memo_cache_sentinel`)?(a=O(),e[6]=a):a=e[6];let o;e[7]===r.desktopOnlyTitle?o=e[8]:(o=(0,N.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:r.desktopOnlyTitle}),e[7]=r.desktopOnlyTitle,e[8]=o);let s;e[9]===r.desktopOnlyBody?s=e[10]:(s=(0,N.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:r.desktopOnlyBody}),e[9]=r.desktopOnlyBody,e[10]=s);let c;e[11]!==o||e[12]!==s?(c=(0,N.jsxs)(`div`,{className:a,children:[o,s]}),e[11]=o,e[12]=s,e[13]=c):c=e[13];let l;return e[14]!==t||e[15]!==n||e[16]!==c?(l=(0,N.jsxs)(D,{gap:`gap-3`,children:[t,n,c]}),e[14]=t,e[15]=n,e[16]=c,e[17]=l):l=e[17],l}let s;e[18]===i.title?s=e[19]:(s=(0,N.jsx)(E,{title:i.title}),e[18]=i.title,e[19]=s);let l;e[20]===i.migrations?l=e[21]:(l=(0,N.jsx)(V,{messages:i.migrations}),e[20]=i.migrations,e[21]=l);let u;e[22]===i?u=e[23]:(u=(0,N.jsx)(R,{api:o,messages:i,embedded:!1}),e[22]=i,e[23]=u);let d;return e[24]!==s||e[25]!==l||e[26]!==u?(d=(0,N.jsxs)(D,{gap:`gap-6`,children:[s,l,u]}),e[24]=s,e[25]=l,e[26]=u,e[27]=d):d=e[27],d}function U(e){return e.language}export{H as AppManagementSettingsPanel};
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"./copy-Dv6d4Dvw.js";import{t as a}from"./messages-Dy26npMy.js";import{t as o}from"./cn-JdwAhgNB.js";import{a as s,n as c,r as l}from"./locale-store-C8TMD2gn.js";import{a as u,i as d,o as f,r as p,s as m,t as h}from"./dist-BGTk37IG.js";import{t as g}from"./copy-to-clipboard-HOJ79TWv.js";import{i as _}from"./vendor-swr-BIWyz7Rc.js";import{t as v}from"./button-CS04eWY9.js";import{n as y}from"./interaction-BdhHBbYa.js";import{t as b}from"./skeleton-BwbyijEw.js";import{i as x,o as S}from"./settings-shell-dialog-layer-BU3UuiJr.js";import{n as C}from"./electron-env-Dit0bHgy.js";import{r as w}from"./settings-form-draft-Dy10ldo8.js";import{$o as T}from"./index-BQgqzhQj.js";import{n as E,r as D}from"./settings-page-layout-X1x-2Cp9.js";import{r as O,t as k}from"./settings-form-section-exRhP9xn.js";import{t as A}from"./settings-loading-skeleton-CAmWMaOT.js";var j=n(),M=e(t(),1),N=r();function P(e,t){return e==null?t:e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}function F(e,t){return e===`PENDING_UPDATE`?t.pendingUpdate??t.generic:e===`UNINSTALLER_NOT_FOUND`?t.uninstallerNotFound??t.generic:e===`NOT_PACKAGED`?t.notPackaged??t.generic:t.generic}function I(e,t){if(e.platform===`darwin`)return t.uninstallDescDarwin;if(e.platform===`win32`)return t.uninstallDescWin;if(e.platform===`linux`){if(e.linuxPackageKind===`appimage`)return t.uninstallDescLinuxAppImage;if(e.linuxPackageKind===`deb`){let n=e.linuxDebPackageName??`xopc`;return t.uninstallDescLinuxDeb.replace(/\{\{package\}\}/g,n)}return t.uninstallDescLinuxUnknown}return t.uninstallDescLinuxUnknown}var L={info:null,loadError:null,actionError:null,copiedField:null,clearDialogOpen:!1,clearConfirmChecked:!1,clearConfirmText:``,uninstallDialogOpen:!1,removeUserDataOnUninstall:!1,busy:!1};function R({api:e,messages:t,embedded:n=!0}){let[r,a]=(0,M.useReducer)(w,L),{info:s,loadError:c,actionError:l,copiedField:_,clearDialogOpen:b,clearConfirmChecked:C,clearConfirmText:E,uninstallDialogOpen:D,removeUserDataOnUninstall:O,busy:j}=r,R=(0,M.useCallback)(async()=>{if(e?.getUninstallInfo){a({type:`patch`,patch:{loadError:null}});try{a({type:`patch`,patch:{info:await e.getUninstallInfo()}})}catch(e){a({type:`patch`,patch:{loadError:e instanceof Error?e.message:String(e)}})}}},[e]);(0,M.useEffect)(()=>{R()},[R]);let z=async(e,n)=>{if(await g(e)){a({type:`patch`,patch:{actionError:null,copiedField:n}}),window.setTimeout(()=>a({type:`patch`,patch:{copiedField:null}}),2e3);return}a({type:`patch`,patch:{actionError:t.copyFailed}})},B=async()=>{if(e?.clearUserData){a({type:`patch`,patch:{busy:!0,actionError:null}});try{let n=await e.clearUserData();n.ok||a({type:`patch`,patch:{actionError:F(n.error,t.errors)}})}catch(e){a({type:`patch`,patch:{actionError:e instanceof Error?e.message:t.errors.generic}})}finally{a({type:`patch`,patch:{busy:!1,clearDialogOpen:!1,clearConfirmChecked:!1,clearConfirmText:``}})}}},V=async()=>{if(e?.uninstallApp){a({type:`patch`,patch:{busy:!0,actionError:null}});try{let n=await e.uninstallApp({removeUserData:O});n.ok||a({type:`patch`,patch:{actionError:F(n.error,t.errors)}})}catch(e){a({type:`patch`,patch:{actionError:e instanceof Error?e.message:t.errors.generic}})}finally{a({type:`patch`,patch:{busy:!1,uninstallDialogOpen:!1}})}}};if(c)return(0,N.jsx)(`p`,{className:`text-sm text-amber-600 dark:text-amber-400`,role:`alert`,children:c});if(!s)return(0,N.jsx)(A,{rows:2});let H=!s.packaged,U=j||s.pendingUpdate||H,W=!H&&s.uninstallMode!==`unsupported`,G=I(s,t),K=C&&E.trim()===t.clearDataConfirmPhrase;return(0,N.jsxs)(N.Fragment,{children:[(0,N.jsxs)(k,{children:[n?(0,N.jsxs)(`div`,{className:`mb-4 flex items-center gap-2 text-sm font-semibold text-fg`,children:[(0,N.jsx)(T,{className:`size-4 text-accent`,strokeWidth:1.75}),t.title]}):null,l?(0,N.jsx)(`p`,{className:`mb-3 text-sm text-amber-600 dark:text-amber-400`,role:`alert`,children:l}):null,H?(0,N.jsxs)(`div`,{className:`mb-4 rounded-xl bg-surface-panel/70 px-3 py-2.5 shadow-surface`,children:[(0,N.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:t.devOnlyTitle}),(0,N.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:t.devOnlyBody})]}):null,s.pendingUpdate?(0,N.jsx)(`p`,{className:`mb-3 rounded-xl bg-amber-500/10 px-3 py-2 text-xs text-amber-800 dark:text-amber-200`,children:t.pendingUpdateBlocked}):null,(0,N.jsxs)(`dl`,{className:`space-y-3 text-sm`,children:[(0,N.jsxs)(`div`,{className:`rounded-xl bg-surface-panel/70 p-3 shadow-surface`,children:[(0,N.jsx)(`dt`,{className:`text-xs font-medium text-fg-muted`,children:t.appPath}),(0,N.jsxs)(`dd`,{className:`mt-1 flex items-start justify-between gap-2`,children:[(0,N.jsx)(`code`,{className:`break-all text-xs text-fg`,children:s.appPath}),(0,N.jsxs)(`button`,{type:`button`,className:o(`inline-flex shrink-0 items-center gap-1 rounded-lg border border-edge px-2 py-1 text-xs text-fg hover:bg-surface-hover`,y.press),onClick:()=>void z(s.appPath,`app`),children:[(0,N.jsx)(i,{className:`size-3`,"aria-hidden":!0}),_===`app`?t.copied:t.copyPath]})]})]}),(0,N.jsxs)(`div`,{className:`rounded-xl bg-surface-panel/70 p-3 shadow-surface`,children:[(0,N.jsx)(`dt`,{className:`text-xs font-medium text-fg-muted`,children:t.dataPath}),(0,N.jsxs)(`dd`,{className:`mt-1 flex items-start justify-between gap-2`,children:[(0,N.jsx)(`code`,{className:`break-all text-xs text-fg`,children:s.dataPath}),(0,N.jsxs)(`button`,{type:`button`,className:o(`inline-flex shrink-0 items-center gap-1 rounded-lg border border-edge px-2 py-1 text-xs text-fg hover:bg-surface-hover`,y.press),onClick:()=>void z(s.dataPath,`data`),children:[(0,N.jsx)(i,{className:`size-3`,"aria-hidden":!0}),_===`data`?t.copied:t.copyPath]})]}),(0,N.jsxs)(`p`,{className:`mt-2 text-xs text-fg-muted`,children:[t.dataSize,`: `,P(s.dataSizeBytes,t.dataSizeUnknown)]}),(0,N.jsx)(`p`,{className:`mt-2 text-xs leading-relaxed text-amber-800 dark:text-amber-200`,children:t.sharedDataWarning})]})]}),(0,N.jsxs)(`div`,{className:`mt-4 space-y-3`,children:[(0,N.jsxs)(`div`,{className:`flex flex-col gap-2 rounded-xl bg-surface-panel/70 p-3 shadow-surface sm:flex-row sm:items-center sm:justify-between`,children:[(0,N.jsxs)(`div`,{children:[(0,N.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:t.clearData}),(0,N.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-muted`,children:t.clearDataDesc})]}),(0,N.jsx)(`button`,{type:`button`,disabled:U,className:o(`inline-flex shrink-0 items-center justify-center rounded-lg border border-danger/40 bg-danger px-3 py-1.5 text-sm font-medium text-white hover:bg-danger/90 disabled:opacity-50`,y.press),onClick:()=>{a({type:`patch`,patch:{clearConfirmChecked:!1,clearConfirmText:``,clearDialogOpen:!0}})},children:t.clearData})]}),W?(0,N.jsxs)(`div`,{className:`flex flex-col gap-2 rounded-xl bg-surface-panel/70 p-3 shadow-surface sm:flex-row sm:items-center sm:justify-between`,children:[(0,N.jsxs)(`div`,{children:[(0,N.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:t.uninstall}),(0,N.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-muted`,children:G})]}),(0,N.jsx)(`button`,{type:`button`,disabled:U,className:o(`inline-flex shrink-0 items-center justify-center rounded-lg border border-edge bg-surface-base px-3 py-1.5 text-sm font-medium text-fg hover:bg-surface-hover disabled:opacity-50`,y.press),onClick:()=>{a({type:`patch`,patch:{removeUserDataOnUninstall:!1,uninstallDialogOpen:!0}})},children:t.uninstall})]}):null]})]}),(0,N.jsx)(h,{open:b,onOpenChange:e=>{e||a({type:`patch`,patch:{clearDialogOpen:!1,clearConfirmChecked:!1,clearConfirmText:``}})},children:(0,N.jsxs)(f,{children:[(0,N.jsx)(u,{className:o(`xopc-dialog-overlay fixed inset-0 bg-scrim backdrop-blur-[1px]`,S)}),(0,N.jsxs)(p,{className:o(`xopc-dialog-content fixed left-1/2 top-1/2 w-[min(100%-2rem,28rem)] -translate-x-1/2 -translate-y-1/2`,x,`rounded-2xl border border-edge bg-surface-overlay p-6 shadow-popover outline-none dark:border-edge`),onOpenAutoFocus:e=>e.preventDefault(),children:[(0,N.jsx)(m,{className:`text-base font-semibold text-fg`,children:t.clearDataConfirmTitle}),(0,N.jsx)(d,{className:`mt-2 text-sm text-fg-muted`,children:t.clearDataConfirmDesc}),(0,N.jsxs)(`label`,{className:`mt-4 flex cursor-pointer items-start gap-2 text-sm text-fg`,children:[(0,N.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox mt-0.5`,checked:C,onChange:e=>a({type:`patch`,patch:{clearConfirmChecked:e.target.checked}})}),(0,N.jsx)(`span`,{children:t.clearDataConfirmCheckbox})]}),(0,N.jsxs)(`div`,{className:`mt-4 space-y-2`,children:[(0,N.jsx)(`label`,{className:`block text-sm font-medium text-fg`,htmlFor:`clear-data-confirm`,children:t.clearDataConfirmLabel}),(0,N.jsx)(`input`,{id:`clear-data-confirm`,type:`text`,autoComplete:`off`,spellCheck:!1,className:o(`w-full rounded-md border border-edge bg-surface-panel px-3 py-1.5 font-mono text-xs text-fg`,`placeholder:text-fg-subtle`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 focus-visible:ring-offset-surface-panel`,`dark:border-edge`),placeholder:t.clearDataConfirmPhrase,value:E,onChange:e=>a({type:`patch`,patch:{clearConfirmText:e.target.value}})}),(0,N.jsx)(`p`,{className:`text-xs text-fg-muted`,children:t.clearDataConfirmHint})]}),(0,N.jsxs)(`div`,{className:`mt-6 flex justify-end gap-2`,children:[(0,N.jsx)(v,{type:`button`,variant:`secondary`,disabled:j,onClick:()=>{a({type:`patch`,patch:{clearDialogOpen:!1,clearConfirmChecked:!1,clearConfirmText:``}})},children:t.cancel}),(0,N.jsx)(v,{type:`button`,variant:`secondary`,className:`border-danger/40 bg-danger text-white hover:bg-danger/90 dark:border-danger/40`,disabled:j||!K,onClick:()=>void B(),children:t.confirmClear})]})]})]})}),W?(0,N.jsx)(h,{open:D,onOpenChange:e=>{e||a({type:`patch`,patch:{uninstallDialogOpen:!1}})},children:(0,N.jsxs)(f,{children:[(0,N.jsx)(u,{className:o(`xopc-dialog-overlay fixed inset-0 bg-scrim backdrop-blur-[1px]`,S)}),(0,N.jsxs)(p,{className:o(`xopc-dialog-content fixed left-1/2 top-1/2 w-[min(100%-2rem,28rem)] -translate-x-1/2 -translate-y-1/2`,x,`rounded-2xl border border-edge bg-surface-overlay p-6 shadow-popover outline-none dark:border-edge`),onOpenAutoFocus:e=>e.preventDefault(),children:[(0,N.jsx)(m,{className:`text-base font-semibold text-fg`,children:t.uninstallConfirmTitle}),(0,N.jsx)(d,{className:`mt-2 text-sm text-fg-muted`,children:G}),(0,N.jsxs)(`label`,{className:`mt-4 flex cursor-pointer items-start gap-2 text-sm text-fg`,children:[(0,N.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox mt-0.5`,checked:O,onChange:e=>a({type:`patch`,patch:{removeUserDataOnUninstall:e.target.checked}})}),(0,N.jsx)(`span`,{children:t.removeUserDataCheckbox})]}),O?(0,N.jsx)(`p`,{className:`mt-2 text-xs text-fg-muted`,children:t.clearDataConfirmDesc}):null,(0,N.jsxs)(`div`,{className:`mt-6 flex justify-end gap-2`,children:[(0,N.jsx)(v,{type:`button`,variant:`secondary`,disabled:j,onClick:()=>a({type:`patch`,patch:{uninstallDialogOpen:!1}}),children:t.cancel}),(0,N.jsx)(v,{type:`button`,variant:`secondary`,className:`border-danger/40 bg-danger text-white hover:bg-danger/90 dark:border-danger/40`,disabled:j,onClick:()=>void V(),children:t.confirmUninstall})]})]})]})}):null]})}async function z(){return(await s(l(`/api/migrations/status`))).payload}async function B(){await s(l(`/api/migrations/apply`),{method:`POST`,body:`{}`})}function V({messages:e}){let{data:t,error:n,isLoading:r,mutate:i}=_(`settings-migration-status`,z,{refreshInterval:0,revalidateOnFocus:!1}),[a,o]=(0,M.useState)(!1),[s,c]=(0,M.useState)(null);async function l(){o(!0),c(null);try{await B(),await i(),window.dispatchEvent(new CustomEvent(`config-reload`))}catch(e){c(e instanceof Error?e.message:String(e))}finally{o(!1)}}if(r)return(0,N.jsxs)(`section`,{className:`rounded-xl bg-surface-hover/20 p-4`,"aria-busy":`true`,children:[(0,N.jsx)(b,{className:`h-5 w-40 max-w-full`}),(0,N.jsx)(b,{className:`mt-2 h-4 w-64 max-w-full`})]});if(n)return(0,N.jsxs)(`section`,{className:`rounded-xl bg-surface-hover/20 p-4`,children:[(0,N.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:e.title}),(0,N.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:e.checkFailed})]});let u=t?.items??[],d=u.filter(e=>e.status===`conflict`||e.status===`error`),f=u.filter(e=>e.safety===`auto`&&e.status===`planned`),p=d.length>0||u.some(e=>e.safety!==`auto`);return(0,N.jsxs)(`section`,{className:`rounded-xl bg-surface-hover/20 p-4`,children:[(0,N.jsxs)(`div`,{className:`flex flex-col gap-3 sm:flex-row sm:items-start sm:justify-between`,children:[(0,N.jsxs)(`div`,{children:[(0,N.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:e.title}),(0,N.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:u.length===0?e.upToDate:p?e.manualAttention:e.safeRepairs.replace(`{{count}}`,String(f.length))})]}),f.length>0&&!p?(0,N.jsx)(v,{type:`button`,variant:`primary`,className:`px-3 py-1.5 text-xs`,onClick:()=>void l(),disabled:a,children:a?e.applying:e.apply}):null]}),u.length>0?(0,N.jsx)(`div`,{className:`mt-3 space-y-2`,children:u.map(e=>(0,N.jsxs)(`div`,{className:`rounded-xl bg-surface-base/55 px-3 py-2`,children:[(0,N.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,N.jsx)(`div`,{className:`truncate text-sm font-medium text-fg`,children:e.title}),(0,N.jsx)(`span`,{className:`rounded-full bg-surface-hover px-2 py-0.5 text-[11px] uppercase tracking-wide text-fg-muted`,children:e.status})]}),(0,N.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:e.message})]},e.id))}):null,s?(0,N.jsx)(`p`,{className:`mt-3 text-sm text-red-500`,children:s}):null]})}function H(){let e=(0,j.c)(28),t=c(U),n;e[0]===t?n=e[1]:(n=a(t),e[0]=t,e[1]=n);let r=n.systemSettings,i=r.desktopApp,o=typeof window<`u`?window.electronAPI?.system:void 0;if(!C()||!o){let t;e[2]===i.title?t=e[3]:(t=(0,N.jsx)(E,{title:i.title}),e[2]=i.title,e[3]=t);let n;e[4]===i.migrations?n=e[5]:(n=(0,N.jsx)(V,{messages:i.migrations}),e[4]=i.migrations,e[5]=n);let a;e[6]===Symbol.for(`react.memo_cache_sentinel`)?(a=O(),e[6]=a):a=e[6];let o;e[7]===r.desktopOnlyTitle?o=e[8]:(o=(0,N.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:r.desktopOnlyTitle}),e[7]=r.desktopOnlyTitle,e[8]=o);let s;e[9]===r.desktopOnlyBody?s=e[10]:(s=(0,N.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:r.desktopOnlyBody}),e[9]=r.desktopOnlyBody,e[10]=s);let c;e[11]!==o||e[12]!==s?(c=(0,N.jsxs)(`div`,{className:a,children:[o,s]}),e[11]=o,e[12]=s,e[13]=c):c=e[13];let l;return e[14]!==t||e[15]!==n||e[16]!==c?(l=(0,N.jsxs)(D,{gap:`gap-3`,children:[t,n,c]}),e[14]=t,e[15]=n,e[16]=c,e[17]=l):l=e[17],l}let s;e[18]===i.title?s=e[19]:(s=(0,N.jsx)(E,{title:i.title}),e[18]=i.title,e[19]=s);let l;e[20]===i.migrations?l=e[21]:(l=(0,N.jsx)(V,{messages:i.migrations}),e[20]=i.migrations,e[21]=l);let u;e[22]===i?u=e[23]:(u=(0,N.jsx)(R,{api:o,messages:i,embedded:!1}),e[22]=i,e[23]=u);let d;return e[24]!==s||e[25]!==l||e[26]!==u?(d=(0,N.jsxs)(D,{gap:`gap-6`,children:[s,l,u]}),e[24]=s,e[25]=l,e[26]=u,e[27]=d):d=e[27],d}function U(e){return e.language}export{H as AppManagementSettingsPanel};
@@ -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{n as i,r as a}from"./popover-select-BgSdSbCL.js";import{t as o}from"./messages-BHvpZNe9.js";import{t as s}from"./cn-JdwAhgNB.js";import{a as c,n as l,r as u}from"./locale-store-DId6-v2R.js";import{n as d}from"./interaction-BdhHBbYa.js";import{n as f,r as p}from"./gateway-config-swr-CoRoOG1l.js";import{i as m}from"./theme-store-OhcbFEUR.js";import{t as h}from"./skeleton-BwbyijEw.js";import{Pr as g,ea as _}from"./index-BpXej9jJ.js";import{n as v,r as y}from"./settings-page-layout-X1x-2Cp9.js";import{t as b}from"./settings-advanced-gate-BNhgbmcX.js";var x=e(t(),1),S=n();function C(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function w(e){let t=C(e)?e:{},n=C(t.gateway)?t.gateway:{},r=(C(n.webchat)?n.webchat:{}).activityDetailDefault;return r===`off`||r===`stream`||r===`on`?r:`on`}async function T(e){await c(u(`/api/config`),{method:`PATCH`,body:JSON.stringify({gateway:{webchat:{activityDetailDefault:e}}})}),await f()}var E=r();function D(e){let t=(0,S.c)(13),{title:n,footer:r,children:i,className:a}=e,o;t[0]===a?o=t[1]:(o=s(`min-w-0`,a),t[0]=a,t[1]=o);let c;t[2]===n?c=t[3]:(c=n?(0,E.jsx)(`h2`,{className:`mb-2 px-1 text-xs font-medium text-fg-muted`,children:n}):null,t[2]=n,t[3]=c);let l;t[4]===i?l=t[5]:(l=(0,E.jsx)(`div`,{className:`flex flex-col gap-1 overflow-hidden rounded-xl bg-surface-hover/20 p-1 [&>*]:rounded-lg [&>*]:bg-surface-base/45`,children:i}),t[4]=i,t[5]=l);let u;t[6]===r?u=t[7]:(u=r?(0,E.jsx)(`p`,{className:`mt-2 px-1 text-xs leading-5 text-fg-subtle`,children:r}):null,t[6]=r,t[7]=u);let d;return t[8]!==o||t[9]!==c||t[10]!==l||t[11]!==u?(d=(0,E.jsxs)(`section`,{className:o,children:[c,l,u]}),t[8]=o,t[9]=c,t[10]=l,t[11]=u,t[12]=d):d=t[12],d}var O={default:{light:{canvas:`#ffffff`,panel:`#fafafa`,accent:`#3a6bff`,fg:`#111111`,muted:`#ececec`},dark:{canvas:`#0a0a0a`,panel:`#121212`,accent:`#3a6bff`,fg:`#f5f5f5`,muted:`#222222`}},emerald:{light:{canvas:`#f0fdf4`,panel:`#ffffff`,accent:`#059669`,fg:`#052e16`,muted:`#86efac`},dark:{canvas:`#000000`,panel:`#0a0a0a`,accent:`#10b981`,fg:`#d1fae5`,muted:`#134e2a`}},clay:{light:{canvas:`#fffaf0`,panel:`#ffffff`,accent:`#1a3a3a`,fg:`#0a0a0a`,muted:`#e5e5e5`},dark:{canvas:`#0a1a1a`,panel:`#1a2a2a`,accent:`#ffb084`,fg:`#fffaf0`,muted:`#2a3a3a`}},porcelain:{light:{canvas:`#f6f0e7`,panel:`#fffcf7`,accent:`#985d4d`,fg:`#352e2a`,muted:`#e8d9cf`},dark:{canvas:`#211c19`,panel:`#2b2420`,accent:`#d4a08c`,fg:`#f3eae1`,muted:`#493a32`}},dawn:{light:{canvas:`#accdec`,panel:`#f8fbff`,accent:`#34363a`,fg:`#262626`,muted:`#e7ebf4`},dark:{canvas:`#172433`,panel:`#253342`,accent:`#d9dde2`,fg:`#f3f6fa`,muted:`#415264`}}};function k(e){let t=(0,S.c)(23),{canvas:n,panel:r,accent:i,fg:a,muted:o}=e,s;t[0]===n?s=t[1]:(s={backgroundColor:n},t[0]=n,t[1]=s);let c;t[2]===r?c=t[3]:(c={backgroundColor:r},t[2]=r,t[3]=c);let l;t[4]===i?l=t[5]:(l=(0,E.jsx)(`div`,{className:`size-1 shrink-0 rounded-full`,style:{backgroundColor:i}}),t[4]=i,t[5]=l);let u;t[6]===a?u=t[7]:(u=(0,E.jsx)(`div`,{className:`h-1 min-w-0 flex-1 rounded-full`,style:{backgroundColor:a,opacity:.85}}),t[6]=a,t[7]=u);let d;t[8]!==l||t[9]!==u?(d=(0,E.jsxs)(`div`,{className:`flex items-center gap-1`,children:[l,u]}),t[8]=l,t[9]=u,t[10]=d):d=t[10];let f;t[11]===o?f=t[12]:(f=(0,E.jsx)(`div`,{className:`h-1 w-2/3 max-w-[70%] rounded-full`,style:{backgroundColor:o}}),t[11]=o,t[12]=f);let p;t[13]===o?p=t[14]:(p=(0,E.jsx)(`div`,{className:`size-1/2 max-w-[55%] rounded-full`,style:{backgroundColor:o}}),t[13]=o,t[14]=p);let m;t[15]!==c||t[16]!==d||t[17]!==f||t[18]!==p?(m=(0,E.jsxs)(`div`,{className:`flex flex-col gap-0.5 rounded-sm p-1`,style:c,children:[d,f,p]}),t[15]=c,t[16]=d,t[17]=f,t[18]=p,t[19]=m):m=t[19];let h;return t[20]!==s||t[21]!==m?(h=(0,E.jsx)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col justify-center gap-1 p-1.5`,style:s,children:m}),t[20]=s,t[21]=m,t[22]=h):h=t[22],h}function A(e){let t=(0,S.c)(8),{scheme:n}=e,{light:r,dark:i}=O[n],a;t[0]===r?a=t[1]:(a=(0,E.jsx)(k,{...r}),t[0]=r,t[1]=a);let o;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,E.jsx)(`div`,{className:`w-px shrink-0 bg-black/12 dark:bg-white/12`,"aria-hidden":!0}),t[2]=o):o=t[2];let s;t[3]===i?s=t[4]:(s=(0,E.jsx)(k,{...i}),t[3]=i,t[4]=s);let c;return t[5]!==a||t[6]!==s?(c=(0,E.jsxs)(`div`,{className:`flex h-11 w-full overflow-hidden rounded-md`,children:[a,o,s]}),t[5]=a,t[6]=s,t[7]=c):c=t[7],c}var j=[{value:`default`,labelKey:`colorSchemeDefault`},{value:`porcelain`,labelKey:`colorSchemePorcelain`},{value:`dawn`,labelKey:`colorSchemeDawn`},{value:`emerald`,labelKey:`colorSchemeLightGreen`},{value:`clay`,labelKey:`colorSchemeClay`}];function M(){let e=(0,S.c)(13),t=l(F),n;e[0]===t?n=e[1]:(n=o(t),e[0]=t,e[1]=n);let r=n.appearanceSettings,i=m(P),a=m(N),c;e[2]===r.colorSchemeTitle?c=e[3]:(c=(0,E.jsx)(`div`,{className:`min-w-0`,children:(0,E.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:r.colorSchemeTitle})}),e[2]=r.colorSchemeTitle,e[3]=c);let u;e[4]!==r||e[5]!==i||e[6]!==a?(u=j.map(e=>{let{value:t,labelKey:n}=e,o=i===t;return(0,E.jsxs)(`button`,{type:`button`,"aria-pressed":o,onClick:()=>a(t),className:s(`flex flex-col gap-2 rounded-xl bg-surface-hover/25 p-2.5 text-left transition-[background-color,box-shadow,transform] duration-150 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,d.pressCard,o?`bg-surface-active shadow-surface`:`hover:bg-surface-hover/60`),children:[(0,E.jsx)(A,{scheme:t}),(0,E.jsx)(`span`,{className:s(`text-xs font-medium leading-none`,o?`text-accent-fg`:`text-fg-muted`),children:r[n]})]},t)}),e[4]=r,e[5]=i,e[6]=a,e[7]=u):u=e[7];let f;e[8]===u?f=e[9]:(f=(0,E.jsx)(`div`,{className:`grid grid-cols-2 gap-3 sm:grid-cols-3 xl:grid-cols-5`,children:u}),e[8]=u,e[9]=f);let p;return e[10]!==c||e[11]!==f?(p=(0,E.jsxs)(`div`,{className:`flex flex-col gap-3 px-4 py-3.5 sm:px-5 sm:py-4`,children:[c,f]}),e[10]=c,e[11]=f,e[12]=p):p=e[12],p}function N(e){return e.setColorScheme}function P(e){return e.colorScheme}function F(e){return e.language}function I(){let e=(0,S.c)(28),t=l(L),n;e[0]===t?n=e[1]:(n=o(t),e[0]=t,e[1]=n);let r=n.appearanceSettings,{data:c,isLoading:u}=p(!0),d=c?.payload?.config,f;e[2]===d?f=e[3]:(f=w(d),e[2]=d,e[3]=f);let m=f,[g,_]=(0,x.useState)(m),[v,y]=(0,x.useState)(!1),[b,C]=(0,x.useState)(!1),D,O;e[4]===m?(D=e[5],O=e[6]):(D=()=>_(m),O=[m],e[4]=m,e[5]=D,e[6]=O),(0,x.useEffect)(D,O);let k;e[7]===g?k=e[8]:(k=e=>{let t=g;_(e),y(!0),C(!1),T(e).catch(()=>{_(t),C(!0)}).finally(()=>y(!1))},e[7]=g,e[8]=k);let A=k,j;e[9]===r.activityDetailDefaultTitle?j=e[10]:(j=(0,E.jsx)(`div`,{className:`min-w-0 text-sm font-medium text-fg`,children:r.activityDetailDefaultTitle}),e[9]=r.activityDetailDefaultTitle,e[10]=j);let M;e[11]!==r.activityDetailLevels||e[12]!==A||e[13]!==u||e[14]!==g||e[15]!==v?(M=u?(0,E.jsx)(h,{className:`h-10 w-full rounded-lg sm:max-w-[11rem]`}):(0,E.jsxs)(i,{value:g,disabled:v,onChange:e=>A(e.target.value),triggerClassName:`w-full sm:max-w-[11rem]`,children:[(0,E.jsx)(a,{value:`off`,children:r.activityDetailLevels.off}),(0,E.jsx)(a,{value:`on`,children:r.activityDetailLevels.on}),(0,E.jsx)(a,{value:`stream`,children:r.activityDetailLevels.stream})]}),e[11]=r.activityDetailLevels,e[12]=A,e[13]=u,e[14]=g,e[15]=v,e[16]=M):M=e[16];let N;e[17]!==j||e[18]!==M?(N=(0,E.jsxs)(`div`,{className:`flex flex-col gap-2 sm:flex-row sm:items-center sm:justify-between sm:gap-6`,children:[j,M]}),e[17]=j,e[18]=M,e[19]=N):N=e[19];let P;e[20]!==r.activityDetailSaveError||e[21]!==r.activityDetailSaving||e[22]!==b||e[23]!==v?(P=b||v?(0,E.jsx)(`p`,{className:s(`text-xs`,b?`text-red-600 dark:text-red-400`:`text-fg-subtle`),children:b?r.activityDetailSaveError:r.activityDetailSaving}):null,e[20]=r.activityDetailSaveError,e[21]=r.activityDetailSaving,e[22]=b,e[23]=v,e[24]=P):P=e[24];let F;return e[25]!==N||e[26]!==P?(F=(0,E.jsxs)(`div`,{className:`flex flex-col gap-2 px-4 py-3.5 sm:px-5 sm:py-4`,children:[N,P]}),e[25]=N,e[26]=P,e[27]=F):F=e[27],F}function L(e){return e.language}function R(){let e=(0,S.c)(17),t=l(V),n;e[0]===t?n=e[1]:(n=o(t),e[0]=t,e[1]=n);let r=n.appearanceSettings,i=g(B),a=g(z),s;e[2]===r.showRawToolDataTitle?s=e[3]:(s=(0,E.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:r.showRawToolDataTitle}),e[2]=r.showRawToolDataTitle,e[3]=s);let c;e[4]===r.showRawToolDataDescription?c=e[5]:(c=(0,E.jsx)(`p`,{className:`text-xs text-fg-muted`,children:r.showRawToolDataDescription}),e[4]=r.showRawToolDataDescription,e[5]=c);let u;e[6]!==s||e[7]!==c?(u=(0,E.jsxs)(`div`,{className:`min-w-0`,children:[s,c]}),e[6]=s,e[7]=c,e[8]=u):u=e[8];let d;e[9]===a?d=e[10]:(d=e=>a(e.target.checked),e[9]=a,e[10]=d);let f;e[11]!==i||e[12]!==d?(f=(0,E.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox`,checked:i,onChange:d}),e[11]=i,e[12]=d,e[13]=f):f=e[13];let p;return e[14]!==u||e[15]!==f?(p=(0,E.jsx)(`div`,{className:`px-4 py-3.5 sm:px-5 sm:py-4`,children:(0,E.jsxs)(`label`,{className:`flex items-center justify-between gap-3`,children:[u,f]})}),e[14]=u,e[15]=f,e[16]=p):p=e[16],p}function z(e){return e.setShowRawToolData}function B(e){return e.showRawToolData}function V(e){return e.language}function H(){let e=(0,S.c)(12),t=l(U),n;e[0]===t?n=e[1]:(n=o(t),e[0]=t,e[1]=n);let r=n.appearanceSettings,i;e[2]===r.pageTitle?i=e[3]:(i=(0,E.jsx)(v,{title:r.pageTitle}),e[2]=r.pageTitle,e[3]=i);let a;e[4]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,E.jsx)(D,{children:(0,E.jsx)(_,{variant:`page`,sections:[`language`]})}),e[4]=a):a=e[4];let s;e[5]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,E.jsxs)(D,{children:[(0,E.jsx)(_,{variant:`page`,sections:[`theme`,`font`]}),(0,E.jsx)(M,{}),(0,E.jsx)(I,{})]}),e[5]=s):s=e[5];let c;e[6]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,E.jsx)(R,{}),e[6]=c):c=e[6];let u;e[7]===r.developerGroupTitle?u=e[8]:(u=(0,E.jsx)(b,{children:(0,E.jsx)(D,{title:r.developerGroupTitle,children:c})}),e[7]=r.developerGroupTitle,e[8]=u);let d;return e[9]!==i||e[10]!==u?(d=(0,E.jsxs)(y,{gap:`gap-6`,children:[i,a,s,u]}),e[9]=i,e[10]=u,e[11]=d):d=e[11],d}function U(e){return e.language}export{H as AppearanceSettingsPanel};
1
+ import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{n as i,r as a}from"./popover-select-BgSdSbCL.js";import{t as o}from"./messages-Dy26npMy.js";import{t as s}from"./cn-JdwAhgNB.js";import{a as c,n as l,r as u}from"./locale-store-C8TMD2gn.js";import{n as d}from"./interaction-BdhHBbYa.js";import{n as f,r as p}from"./gateway-config-swr-Cjnkle5J.js";import{i as m}from"./theme-store-DQ6KJa4l.js";import{t as h}from"./skeleton-BwbyijEw.js";import{$i as g,Nr as _}from"./index-BQgqzhQj.js";import{n as v,r as y}from"./settings-page-layout-X1x-2Cp9.js";import{t as b}from"./settings-advanced-gate-DazqeDQ7.js";var x=e(t(),1),S=n();function C(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function w(e){let t=C(e)?e:{},n=C(t.gateway)?t.gateway:{},r=(C(n.webchat)?n.webchat:{}).activityDetailDefault;return r===`off`||r===`stream`||r===`on`?r:`on`}async function T(e){await c(u(`/api/config`),{method:`PATCH`,body:JSON.stringify({gateway:{webchat:{activityDetailDefault:e}}})}),await f()}var E=r();function D(e){let t=(0,S.c)(13),{title:n,footer:r,children:i,className:a}=e,o;t[0]===a?o=t[1]:(o=s(`min-w-0`,a),t[0]=a,t[1]=o);let c;t[2]===n?c=t[3]:(c=n?(0,E.jsx)(`h2`,{className:`mb-2 px-1 text-xs font-medium text-fg-muted`,children:n}):null,t[2]=n,t[3]=c);let l;t[4]===i?l=t[5]:(l=(0,E.jsx)(`div`,{className:`flex flex-col gap-1 overflow-hidden rounded-xl bg-surface-hover/20 p-1 [&>*]:rounded-lg [&>*]:bg-surface-base/45`,children:i}),t[4]=i,t[5]=l);let u;t[6]===r?u=t[7]:(u=r?(0,E.jsx)(`p`,{className:`mt-2 px-1 text-xs leading-5 text-fg-subtle`,children:r}):null,t[6]=r,t[7]=u);let d;return t[8]!==o||t[9]!==c||t[10]!==l||t[11]!==u?(d=(0,E.jsxs)(`section`,{className:o,children:[c,l,u]}),t[8]=o,t[9]=c,t[10]=l,t[11]=u,t[12]=d):d=t[12],d}var O={default:{light:{canvas:`#ffffff`,panel:`#fafafa`,accent:`#3a6bff`,fg:`#111111`,muted:`#ececec`},dark:{canvas:`#0a0a0a`,panel:`#121212`,accent:`#3a6bff`,fg:`#f5f5f5`,muted:`#222222`}},emerald:{light:{canvas:`#f0fdf4`,panel:`#ffffff`,accent:`#059669`,fg:`#052e16`,muted:`#86efac`},dark:{canvas:`#000000`,panel:`#0a0a0a`,accent:`#10b981`,fg:`#d1fae5`,muted:`#134e2a`}},clay:{light:{canvas:`#fffaf0`,panel:`#ffffff`,accent:`#1a3a3a`,fg:`#0a0a0a`,muted:`#e5e5e5`},dark:{canvas:`#0a1a1a`,panel:`#1a2a2a`,accent:`#ffb084`,fg:`#fffaf0`,muted:`#2a3a3a`}},porcelain:{light:{canvas:`#f6f0e7`,panel:`#fffcf7`,accent:`#985d4d`,fg:`#352e2a`,muted:`#e8d9cf`},dark:{canvas:`#211c19`,panel:`#2b2420`,accent:`#d4a08c`,fg:`#f3eae1`,muted:`#493a32`}},dawn:{light:{canvas:`#accdec`,panel:`#f8fbff`,accent:`#34363a`,fg:`#262626`,muted:`#e7ebf4`},dark:{canvas:`#172433`,panel:`#253342`,accent:`#d9dde2`,fg:`#f3f6fa`,muted:`#415264`}}};function k(e){let t=(0,S.c)(23),{canvas:n,panel:r,accent:i,fg:a,muted:o}=e,s;t[0]===n?s=t[1]:(s={backgroundColor:n},t[0]=n,t[1]=s);let c;t[2]===r?c=t[3]:(c={backgroundColor:r},t[2]=r,t[3]=c);let l;t[4]===i?l=t[5]:(l=(0,E.jsx)(`div`,{className:`size-1 shrink-0 rounded-full`,style:{backgroundColor:i}}),t[4]=i,t[5]=l);let u;t[6]===a?u=t[7]:(u=(0,E.jsx)(`div`,{className:`h-1 min-w-0 flex-1 rounded-full`,style:{backgroundColor:a,opacity:.85}}),t[6]=a,t[7]=u);let d;t[8]!==l||t[9]!==u?(d=(0,E.jsxs)(`div`,{className:`flex items-center gap-1`,children:[l,u]}),t[8]=l,t[9]=u,t[10]=d):d=t[10];let f;t[11]===o?f=t[12]:(f=(0,E.jsx)(`div`,{className:`h-1 w-2/3 max-w-[70%] rounded-full`,style:{backgroundColor:o}}),t[11]=o,t[12]=f);let p;t[13]===o?p=t[14]:(p=(0,E.jsx)(`div`,{className:`size-1/2 max-w-[55%] rounded-full`,style:{backgroundColor:o}}),t[13]=o,t[14]=p);let m;t[15]!==c||t[16]!==d||t[17]!==f||t[18]!==p?(m=(0,E.jsxs)(`div`,{className:`flex flex-col gap-0.5 rounded-sm p-1`,style:c,children:[d,f,p]}),t[15]=c,t[16]=d,t[17]=f,t[18]=p,t[19]=m):m=t[19];let h;return t[20]!==s||t[21]!==m?(h=(0,E.jsx)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col justify-center gap-1 p-1.5`,style:s,children:m}),t[20]=s,t[21]=m,t[22]=h):h=t[22],h}function A(e){let t=(0,S.c)(8),{scheme:n}=e,{light:r,dark:i}=O[n],a;t[0]===r?a=t[1]:(a=(0,E.jsx)(k,{...r}),t[0]=r,t[1]=a);let o;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,E.jsx)(`div`,{className:`w-px shrink-0 bg-black/12 dark:bg-white/12`,"aria-hidden":!0}),t[2]=o):o=t[2];let s;t[3]===i?s=t[4]:(s=(0,E.jsx)(k,{...i}),t[3]=i,t[4]=s);let c;return t[5]!==a||t[6]!==s?(c=(0,E.jsxs)(`div`,{className:`flex h-11 w-full overflow-hidden rounded-md`,children:[a,o,s]}),t[5]=a,t[6]=s,t[7]=c):c=t[7],c}var j=[{value:`default`,labelKey:`colorSchemeDefault`},{value:`porcelain`,labelKey:`colorSchemePorcelain`},{value:`dawn`,labelKey:`colorSchemeDawn`},{value:`emerald`,labelKey:`colorSchemeLightGreen`},{value:`clay`,labelKey:`colorSchemeClay`}];function M(){let e=(0,S.c)(13),t=l(F),n;e[0]===t?n=e[1]:(n=o(t),e[0]=t,e[1]=n);let r=n.appearanceSettings,i=m(P),a=m(N),c;e[2]===r.colorSchemeTitle?c=e[3]:(c=(0,E.jsx)(`div`,{className:`min-w-0`,children:(0,E.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:r.colorSchemeTitle})}),e[2]=r.colorSchemeTitle,e[3]=c);let u;e[4]!==r||e[5]!==i||e[6]!==a?(u=j.map(e=>{let{value:t,labelKey:n}=e,o=i===t;return(0,E.jsxs)(`button`,{type:`button`,"aria-pressed":o,onClick:()=>a(t),className:s(`flex flex-col gap-2 rounded-xl bg-surface-hover/25 p-2.5 text-left transition-[background-color,box-shadow,transform] duration-150 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,d.pressCard,o?`bg-surface-active shadow-surface`:`hover:bg-surface-hover/60`),children:[(0,E.jsx)(A,{scheme:t}),(0,E.jsx)(`span`,{className:s(`text-xs font-medium leading-none`,o?`text-accent-fg`:`text-fg-muted`),children:r[n]})]},t)}),e[4]=r,e[5]=i,e[6]=a,e[7]=u):u=e[7];let f;e[8]===u?f=e[9]:(f=(0,E.jsx)(`div`,{className:`grid grid-cols-2 gap-3 sm:grid-cols-3 xl:grid-cols-5`,children:u}),e[8]=u,e[9]=f);let p;return e[10]!==c||e[11]!==f?(p=(0,E.jsxs)(`div`,{className:`flex flex-col gap-3 px-4 py-3.5 sm:px-5 sm:py-4`,children:[c,f]}),e[10]=c,e[11]=f,e[12]=p):p=e[12],p}function N(e){return e.setColorScheme}function P(e){return e.colorScheme}function F(e){return e.language}function I(){let e=(0,S.c)(28),t=l(L),n;e[0]===t?n=e[1]:(n=o(t),e[0]=t,e[1]=n);let r=n.appearanceSettings,{data:c,isLoading:u}=p(!0),d=c?.payload?.config,f;e[2]===d?f=e[3]:(f=w(d),e[2]=d,e[3]=f);let m=f,[g,_]=(0,x.useState)(m),[v,y]=(0,x.useState)(!1),[b,C]=(0,x.useState)(!1),D,O;e[4]===m?(D=e[5],O=e[6]):(D=()=>_(m),O=[m],e[4]=m,e[5]=D,e[6]=O),(0,x.useEffect)(D,O);let k;e[7]===g?k=e[8]:(k=e=>{let t=g;_(e),y(!0),C(!1),T(e).catch(()=>{_(t),C(!0)}).finally(()=>y(!1))},e[7]=g,e[8]=k);let A=k,j;e[9]===r.activityDetailDefaultTitle?j=e[10]:(j=(0,E.jsx)(`div`,{className:`min-w-0 text-sm font-medium text-fg`,children:r.activityDetailDefaultTitle}),e[9]=r.activityDetailDefaultTitle,e[10]=j);let M;e[11]!==r.activityDetailLevels||e[12]!==A||e[13]!==u||e[14]!==g||e[15]!==v?(M=u?(0,E.jsx)(h,{className:`h-10 w-full rounded-lg sm:max-w-[11rem]`}):(0,E.jsxs)(i,{value:g,disabled:v,onChange:e=>A(e.target.value),triggerClassName:`w-full sm:max-w-[11rem]`,children:[(0,E.jsx)(a,{value:`off`,children:r.activityDetailLevels.off}),(0,E.jsx)(a,{value:`on`,children:r.activityDetailLevels.on}),(0,E.jsx)(a,{value:`stream`,children:r.activityDetailLevels.stream})]}),e[11]=r.activityDetailLevels,e[12]=A,e[13]=u,e[14]=g,e[15]=v,e[16]=M):M=e[16];let N;e[17]!==j||e[18]!==M?(N=(0,E.jsxs)(`div`,{className:`flex flex-col gap-2 sm:flex-row sm:items-center sm:justify-between sm:gap-6`,children:[j,M]}),e[17]=j,e[18]=M,e[19]=N):N=e[19];let P;e[20]!==r.activityDetailSaveError||e[21]!==r.activityDetailSaving||e[22]!==b||e[23]!==v?(P=b||v?(0,E.jsx)(`p`,{className:s(`text-xs`,b?`text-red-600 dark:text-red-400`:`text-fg-subtle`),children:b?r.activityDetailSaveError:r.activityDetailSaving}):null,e[20]=r.activityDetailSaveError,e[21]=r.activityDetailSaving,e[22]=b,e[23]=v,e[24]=P):P=e[24];let F;return e[25]!==N||e[26]!==P?(F=(0,E.jsxs)(`div`,{className:`flex flex-col gap-2 px-4 py-3.5 sm:px-5 sm:py-4`,children:[N,P]}),e[25]=N,e[26]=P,e[27]=F):F=e[27],F}function L(e){return e.language}function R(){let e=(0,S.c)(17),t=l(V),n;e[0]===t?n=e[1]:(n=o(t),e[0]=t,e[1]=n);let r=n.appearanceSettings,i=_(B),a=_(z),s;e[2]===r.showRawToolDataTitle?s=e[3]:(s=(0,E.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:r.showRawToolDataTitle}),e[2]=r.showRawToolDataTitle,e[3]=s);let c;e[4]===r.showRawToolDataDescription?c=e[5]:(c=(0,E.jsx)(`p`,{className:`text-xs text-fg-muted`,children:r.showRawToolDataDescription}),e[4]=r.showRawToolDataDescription,e[5]=c);let u;e[6]!==s||e[7]!==c?(u=(0,E.jsxs)(`div`,{className:`min-w-0`,children:[s,c]}),e[6]=s,e[7]=c,e[8]=u):u=e[8];let d;e[9]===a?d=e[10]:(d=e=>a(e.target.checked),e[9]=a,e[10]=d);let f;e[11]!==i||e[12]!==d?(f=(0,E.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox`,checked:i,onChange:d}),e[11]=i,e[12]=d,e[13]=f):f=e[13];let p;return e[14]!==u||e[15]!==f?(p=(0,E.jsx)(`div`,{className:`px-4 py-3.5 sm:px-5 sm:py-4`,children:(0,E.jsxs)(`label`,{className:`flex items-center justify-between gap-3`,children:[u,f]})}),e[14]=u,e[15]=f,e[16]=p):p=e[16],p}function z(e){return e.setShowRawToolData}function B(e){return e.showRawToolData}function V(e){return e.language}function H(){let e=(0,S.c)(12),t=l(U),n;e[0]===t?n=e[1]:(n=o(t),e[0]=t,e[1]=n);let r=n.appearanceSettings,i;e[2]===r.pageTitle?i=e[3]:(i=(0,E.jsx)(v,{title:r.pageTitle}),e[2]=r.pageTitle,e[3]=i);let a;e[4]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,E.jsx)(D,{children:(0,E.jsx)(g,{variant:`page`,sections:[`language`]})}),e[4]=a):a=e[4];let s;e[5]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,E.jsxs)(D,{children:[(0,E.jsx)(g,{variant:`page`,sections:[`theme`,`font`]}),(0,E.jsx)(M,{}),(0,E.jsx)(I,{})]}),e[5]=s):s=e[5];let c;e[6]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,E.jsx)(R,{}),e[6]=c):c=e[6];let u;e[7]===r.developerGroupTitle?u=e[8]:(u=(0,E.jsx)(b,{children:(0,E.jsx)(D,{title:r.developerGroupTitle,children:c})}),e[7]=r.developerGroupTitle,e[8]=u);let d;return e[9]!==i||e[10]!==u?(d=(0,E.jsxs)(y,{gap:`gap-6`,children:[i,a,s,u]}),e[9]=i,e[10]=u,e[11]=d):d=e[11],d}function U(e){return e.language}export{H as AppearanceSettingsPanel};