@xopcai/xopc 0.0.396 → 0.0.398

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 (276) hide show
  1. package/dist/browser-ext/manifest.json +1 -1
  2. package/dist/extensions/telegram/xopc.extension.json +1 -1
  3. package/dist/gateway/static/root/assets/{agent-avatar-dicebear-DwTaeL1e.js → agent-avatar-dicebear-Q-lKLSrc.js} +1 -1
  4. package/dist/gateway/static/root/assets/agent-defaults-settings-panel-CobxTBV_.js +1 -0
  5. package/dist/gateway/static/root/assets/agents-Bgmmue5K.js +77 -0
  6. package/dist/gateway/static/root/assets/{agents-admin-api-BjGOUrAf.js → agents-admin-api-DvSe10zu.js} +1 -1
  7. package/dist/gateway/static/root/assets/{app-management-settings-panel-B1ApwlFh.js → app-management-settings-panel-CB_W2ano.js} +1 -1
  8. package/dist/gateway/static/root/assets/{appearance-settings-Avd_jVji.js → appearance-settings-B-ppSGBm.js} +1 -1
  9. package/dist/gateway/static/root/assets/apps-page-3qUgsGui.js +1 -0
  10. package/dist/gateway/static/root/assets/{archive-plugin-C26WGbj9.js → archive-plugin-CeQrQ693.js} +1 -1
  11. package/dist/gateway/static/root/assets/{automations-page-T3FSuURJ.js → automations-page-Cc9vZanv.js} +1 -1
  12. package/dist/gateway/static/root/assets/automations-workspace-Bc4c_AEq.js +6 -0
  13. package/dist/gateway/static/root/assets/{binary-plugins-CLaLkM3M.js → binary-plugins-BqaVBv1R.js} +1 -1
  14. package/dist/gateway/static/root/assets/{block-editor-CB4oRyM5.js → block-editor-B4ij8nZi.js} +40 -40
  15. package/dist/gateway/static/root/assets/{browser-automation-inputs-0nkk3bLA.js → browser-automation-inputs-DngvcZH9.js} +1 -1
  16. package/dist/gateway/static/root/assets/browser-automations-page-CdqwXyYq.js +3 -0
  17. package/dist/gateway/static/root/assets/browser-settings-page-CJT0rB-I.js +3 -0
  18. package/dist/gateway/static/root/assets/{capabilities-CTfLd_UE.js → capabilities-glv1DeRI.js} +1 -1
  19. package/dist/gateway/static/root/assets/capabilities-page-C56VsP0Y.js +2 -0
  20. package/dist/gateway/static/root/assets/capabilities-settings-panel-DZiA8JIq.js +8 -0
  21. package/dist/gateway/static/root/assets/{capability-header-actions-Br5PchG2.js → capability-header-actions-Cu-ATcJq.js} +1 -1
  22. package/dist/gateway/static/root/assets/capability-links--dcwUjgv.js +1 -0
  23. package/dist/gateway/static/root/assets/channels-gIjZtYnV.js +1 -0
  24. package/dist/gateway/static/root/assets/{chat-terminal-dock-Cl0hAav9.js → chat-terminal-dock-COdvmTgN.js} +2 -2
  25. package/dist/gateway/static/root/assets/computer-settings-page-C1XHsuI8.js +1 -0
  26. package/dist/gateway/static/root/assets/{connector-service-page-AqsoqTnF.js → connector-service-page-Cv2bhnQ5.js} +1 -1
  27. package/dist/gateway/static/root/assets/connectors-page-SmKItq0N.js +1 -0
  28. package/dist/gateway/static/root/assets/{date-picker-CyFehuto.js → date-picker-CCnqYwy0.js} +1 -1
  29. package/dist/gateway/static/root/assets/{dependency-picker-Vu_5QGGJ.js → dependency-picker-nt5ruIio.js} +1 -1
  30. package/dist/gateway/static/root/assets/{desktop-pet-Dw9k0Z2p.js → desktop-pet-Bn8xj1v3.js} +1 -1
  31. package/dist/gateway/static/root/assets/{desktop-pet-settings-DKqkhvxu.js → desktop-pet-settings-Cbl1J_VE.js} +1 -1
  32. package/dist/gateway/static/root/assets/{device-pairing-wizard-4l4ESMon.js → device-pairing-wizard-Tadg9co1.js} +1 -1
  33. package/dist/gateway/static/root/assets/{directory-picker-path-field-7svbL2tR.js → directory-picker-path-field-DuE5ez1E.js} +1 -1
  34. package/dist/gateway/static/root/assets/{extension-debug-page-CFa6PCBV.js → extension-debug-page-jsNxwqNi.js} +1 -1
  35. package/dist/gateway/static/root/assets/extension-page-N_rBjYX8.js +1 -0
  36. package/dist/gateway/static/root/assets/extension-settings-page-7qAdvlRB.js +1 -0
  37. package/dist/gateway/static/root/assets/{gateway-config-swr-Di9g6pE8.js → gateway-config-swr-DAir1JsW.js} +1 -1
  38. package/dist/gateway/static/root/assets/{gateway-realtime-2-o7qk92.js → gateway-realtime-dE0XrVAT.js} +1 -1
  39. package/dist/gateway/static/root/assets/gateway-realtime-store-CPlVuu0d.js +1 -0
  40. package/dist/gateway/static/root/assets/gateway-settings-ViqOhx_m.js +1 -0
  41. package/dist/gateway/static/root/assets/{gateway-startup-retry-BCUswcVy.js → gateway-startup-retry-CqyGHM2M.js} +1 -1
  42. package/dist/gateway/static/root/assets/{highlighted-body-KQOG7T2V-DzEeyJpH.js → highlighted-body-KQOG7T2V-XrkWdmrk.js} +1 -1
  43. package/dist/gateway/static/root/assets/home-page-C_Xn_Kkz.js +2 -0
  44. package/dist/gateway/static/root/assets/{image-generation-api-Zo56ZmKs.js → image-generation-api-CmHdM2uL.js} +1 -1
  45. package/dist/gateway/static/root/assets/{imports-page-C_PPaOFv.js → imports-page-B-dnvHP_.js} +1 -1
  46. package/dist/gateway/static/root/assets/index-DWzv8ZoO.css +1 -0
  47. package/dist/gateway/static/root/assets/{index-XRbEWVyZ.js → index-DvKDT-RQ.js} +116 -116
  48. package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-BGtrzFT6.js → keyboard-shortcuts-settings-mCs9cDgv.js} +1 -1
  49. package/dist/gateway/static/root/assets/{local-app-workbench-page-Cu80fCA0.js → local-app-workbench-page-B7AtlfWQ.js} +1 -1
  50. package/dist/gateway/static/root/assets/{local-apps-page-Zsu8FnwP.js → local-apps-page-CIJE7jME.js} +1 -1
  51. package/dist/gateway/static/root/assets/{local-session-drafts-BjwlkAKA.js → local-session-drafts-fhip41-L.js} +1 -1
  52. package/dist/gateway/static/root/assets/{locale-store-Djl2FW6_.js → locale-store-Jnhw2WMv.js} +1 -1
  53. package/dist/gateway/static/root/assets/{logs-page-DlIhfEW_.js → logs-page-HawXUKF2.js} +2 -2
  54. package/dist/gateway/static/root/assets/management-settings-DByEh6rq.js +1 -0
  55. package/dist/gateway/static/root/assets/{markdown-view-DyO7Q0Ms.js → markdown-view-B58RypQ4.js} +1 -1
  56. package/dist/gateway/static/root/assets/{media-plugins-Ba1_QMmZ.js → media-plugins-B8BLxQgj.js} +1 -1
  57. package/dist/gateway/static/root/assets/mermaid-MCJ5UELQ-CZjPT7xE.js +1 -0
  58. package/dist/gateway/static/root/assets/messages-DBvKzlCl.js +3 -0
  59. package/dist/gateway/static/root/assets/note-detail-panel-hQHB5fCs.js +5 -0
  60. package/dist/gateway/static/root/assets/notes-page-BEusEk31.js +8 -0
  61. package/dist/gateway/static/root/assets/{page-context-capture-button-BqNWtf_f.js → page-context-capture-button-42bq8N6-.js} +1 -1
  62. package/dist/gateway/static/root/assets/personal-page-DPR5gzhf.js +1 -0
  63. package/dist/gateway/static/root/assets/plugin-details-dialog-D8dKKIY9.js +1 -0
  64. package/dist/gateway/static/root/assets/plugin-presentation-BrQpVvjC.js +1 -0
  65. package/dist/gateway/static/root/assets/{preview-open-alternatives-kkbrbiVd.js → preview-open-alternatives-DKyLVLpX.js} +1 -1
  66. package/dist/gateway/static/root/assets/{product-open-page-Dheqo_4J.js → product-open-page-DcGH0AXN.js} +1 -1
  67. package/dist/gateway/static/root/assets/{product-preview-content-B9Y6dIuh.js → product-preview-content-Ck6OzP09.js} +1 -1
  68. package/dist/gateway/static/root/assets/project-detail-page-BHoQ10Eo.js +1 -0
  69. package/dist/gateway/static/root/assets/projects-page-DYsq_OLJ.js +1 -0
  70. package/dist/gateway/static/root/assets/{registry-api-BwR2CiR5.js → registry-api-BbUEMGcj.js} +1 -1
  71. package/dist/gateway/static/root/assets/remote-access-hub-CU3EChY0.js +1 -0
  72. package/dist/gateway/static/root/assets/{runtime-tools-api-C_VOMhLI.js → runtime-tools-api-D0xtCTXr.js} +1 -1
  73. package/dist/gateway/static/root/assets/{runtime-tools-settings-panel-BjyZGNP3.js → runtime-tools-settings-panel-Bfs5zKDg.js} +1 -1
  74. package/dist/gateway/static/root/assets/{schema-form-DelMOLjg.js → schema-form-BbI2BuSU.js} +1 -1
  75. package/dist/gateway/static/root/assets/{session-api-DbNNQps9.js → session-api-CAKgrbgz.js} +1 -1
  76. package/dist/gateway/static/root/assets/{session-manager-DfVviLTK.js → session-manager-D_N7qha7.js} +1 -1
  77. package/dist/gateway/static/root/assets/sessions-page-CjB2GOTs.js +1 -0
  78. package/dist/gateway/static/root/assets/settings-advanced-gate-jbVx8gcF.js +1 -0
  79. package/dist/gateway/static/root/assets/{settings-form-section-DNWEDA71.js → settings-form-section-BfBBJlr-.js} +1 -1
  80. package/dist/gateway/static/root/assets/{settings-page-DJ27gC7J.js → settings-page-9yu4SN1j.js} +1 -1
  81. package/dist/gateway/static/root/assets/setup-status-panel-DhWB3feW.js +1 -0
  82. package/dist/gateway/static/root/assets/{share-preview-page-Du4mumVM.js → share-preview-page-B6lQl5xb.js} +1 -1
  83. package/dist/gateway/static/root/assets/shares-settings-UJGjdz3F.js +1 -0
  84. package/dist/gateway/static/root/assets/{skill-api-zOxHjU7m.js → skill-api-y2m3k_R4.js} +1 -1
  85. package/dist/gateway/static/root/assets/skill-reload-api-Bk9FqsVa.js +1 -0
  86. package/dist/gateway/static/root/assets/skills-page-DLd4O-Fo.js +2 -0
  87. package/dist/gateway/static/root/assets/{style-DsnKw5jo.js → style-C2ptQg95.js} +1 -1
  88. package/dist/gateway/static/root/assets/{system-settings-panel-mz9hWo_H.js → system-settings-panel-DYzcLnVk.js} +1 -1
  89. package/dist/gateway/static/root/assets/task-detail-page-DLGtmHAH.js +2 -0
  90. package/dist/gateway/static/root/assets/{task-expandable-content-D3i_51Oc.js → task-expandable-content-HdEeV_0-.js} +1 -1
  91. package/dist/gateway/static/root/assets/{tracing-settings-page-aC-ziRbY.js → tracing-settings-page-DKQYmzFn.js} +1 -1
  92. package/dist/gateway/static/root/assets/{tunnel-api-Ch2Veztk.js → tunnel-api-C2VY_HTy.js} +1 -1
  93. package/dist/gateway/static/root/assets/usage-page-CjzunQtj.js +1 -0
  94. package/dist/gateway/static/root/assets/{use-autosave-BLW3t_OK.js → use-autosave-BElgnGMt.js} +1 -1
  95. package/dist/gateway/static/root/assets/user-model-page-DsOGCDTR.js +2 -0
  96. package/dist/gateway/static/root/assets/{voice-api-key-field-DulF6Cm4.js → voice-api-key-field-FVjX0qhn.js} +1 -1
  97. package/dist/gateway/static/root/assets/{voice-config-api-Ceo_hqZC.js → voice-config-api-T3nM4buh.js} +1 -1
  98. package/dist/gateway/static/root/assets/{work-discovery-overlay-bBMZM8tN.js → work-discovery-overlay-B2S2NZuK.js} +1 -1
  99. package/dist/gateway/static/root/assets/{workflow-run-setup-panel-CsxXS1WI.js → workflow-run-setup-panel-2Gq34KQk.js} +2 -2
  100. package/dist/gateway/static/root/assets/workflows-page-CjeFD3mk.js +6 -0
  101. package/dist/gateway/static/root/assets/{xopc-cloud-account-card-wwIRBFCs.js → xopc-cloud-account-card-BZMIZxWg.js} +1 -1
  102. package/dist/gateway/static/root/index.html +15 -15
  103. package/dist/package.js +1 -1
  104. package/dist/src/agent/agent-manager.d.ts +8 -0
  105. package/dist/src/agent/agent-manager.js +3 -3
  106. package/dist/src/agent/background-review/run-background-review.js +1 -1
  107. package/dist/src/agent/embedded/codemode-extension.d.ts +1 -0
  108. package/dist/src/agent/embedded/codemode-extension.js +6 -1
  109. package/dist/src/agent/embedded/run-for-session.js +1 -1
  110. package/dist/src/agent/embedded/run-turn.js +34 -2
  111. package/dist/src/agent/embedded/session-runner.js +1 -1
  112. package/dist/src/agent/external-tools/cliProvider.js +2 -2
  113. package/dist/src/agent/external-tools/composio-provider.js +2 -2
  114. package/dist/src/agent/external-tools/endpoint-provider.js +2 -2
  115. package/dist/src/agent/mcp/config.d.ts +2 -0
  116. package/dist/src/agent/mcp/config.js +2 -2
  117. package/dist/src/agent/mcp/connection-setup.js +13 -1
  118. package/dist/src/agent/mcp/effective-server.d.ts +3 -0
  119. package/dist/src/agent/mcp/effective-server.js +27 -0
  120. package/dist/src/agent/mcp/native-mcp.d.ts +1 -1
  121. package/dist/src/agent/mcp/native-mcp.js +13 -4
  122. package/dist/src/agent/mcp/tool-catalog.js +2 -1
  123. package/dist/src/agent/service/process-direct-streaming.js +1 -1
  124. package/dist/src/agent/service.js +2 -2
  125. package/dist/src/agent/skills/index.d.ts +1 -0
  126. package/dist/src/agent/skills/index.js +7 -3
  127. package/dist/src/agent/skills/managed-store.js +1 -1
  128. package/dist/src/agent/skills/skill-manage-ops.js +1 -1
  129. package/dist/src/agent/skills/skill-manager.d.ts +1 -0
  130. package/dist/src/agent/skills/skill-manager.js +6 -1
  131. package/dist/src/agent/skills/skill-sources.d.ts +1 -0
  132. package/dist/src/agent/skills/skill-sources.js +4 -3
  133. package/dist/src/agent/skills/types.d.ts +1 -0
  134. package/dist/src/agent/tools/factory.js +1 -1
  135. package/dist/src/agent/tools/personal-read-tool.js +1 -1
  136. package/dist/src/agent/tools/xopc-use-tool.js +2 -2
  137. package/dist/src/agent/workspace-runtime/registry.js +7 -3
  138. package/dist/src/agent-catalog/capabilities.js +2 -2
  139. package/dist/src/automations/capabilities/drafts.js +1 -1
  140. package/dist/src/automations/service/action-executor.js +2 -2
  141. package/dist/src/bootstrap/application-state.js +1 -1
  142. package/dist/src/capabilities/runtime/dispatcher.js +1 -1
  143. package/dist/src/capabilities/runtime/product.js +1 -1
  144. package/dist/src/chat-commands/agent-edit.js +1 -1
  145. package/dist/src/cli/commands/agent.js +1 -1
  146. package/dist/src/cli/commands/agents.js +1 -1
  147. package/dist/src/cli/commands/doctor/checks/database-schema.js +1 -1
  148. package/dist/src/cli/commands/extension-agent-plugin.js +92 -7
  149. package/dist/src/cli/commands/extension-marketplace.js +1 -1
  150. package/dist/src/cli/commands/extension.js +1 -1
  151. package/dist/src/cli/commands/mcp.js +6 -4
  152. package/dist/src/cli/commands/models.js +1 -1
  153. package/dist/src/cli/commands/onboard/model.js +1 -1
  154. package/dist/src/cli/utils/init-workspace-core.js +1 -1
  155. package/dist/src/config/agent-model-intents.js +1 -1
  156. package/dist/src/config/agent-profile.js +2 -2
  157. package/dist/src/config/loader.js +1 -1
  158. package/dist/src/config/models-json.js +1 -1
  159. package/dist/src/config/schema.js +2 -2
  160. package/dist/src/extensions/agent-plugins/auth.d.ts +7 -1
  161. package/dist/src/extensions/agent-plugins/auth.js +53 -12
  162. package/dist/src/extensions/agent-plugins/branding.d.ts +12 -0
  163. package/dist/src/extensions/agent-plugins/branding.js +54 -0
  164. package/dist/src/extensions/agent-plugins/cli-authorization.d.ts +33 -0
  165. package/dist/src/extensions/agent-plugins/cli-authorization.js +203 -0
  166. package/dist/src/extensions/agent-plugins/connection-reuse.d.ts +10 -0
  167. package/dist/src/extensions/agent-plugins/connection-reuse.js +23 -0
  168. package/dist/src/extensions/agent-plugins/credentials.js +24 -1
  169. package/dist/src/extensions/agent-plugins/formats.d.ts +27 -0
  170. package/dist/src/extensions/agent-plugins/formats.js +208 -0
  171. package/dist/src/extensions/agent-plugins/inventory.d.ts +154 -2
  172. package/dist/src/extensions/agent-plugins/inventory.js +40 -5
  173. package/dist/src/extensions/agent-plugins/mcp-adapter.d.ts +2 -1
  174. package/dist/src/extensions/agent-plugins/mcp-adapter.js +42 -8
  175. package/dist/src/extensions/agent-plugins/mcp-format.d.ts +2 -0
  176. package/dist/src/extensions/agent-plugins/mcp-format.js +82 -0
  177. package/dist/src/extensions/agent-plugins/resources.d.ts +14 -0
  178. package/dist/src/extensions/agent-plugins/resources.js +112 -0
  179. package/dist/src/extensions/agent-plugins/setup-contract.d.ts +74 -0
  180. package/dist/src/extensions/agent-plugins/setup-contract.js +77 -0
  181. package/dist/src/extensions/agent-plugins/setup.d.ts +127 -0
  182. package/dist/src/extensions/agent-plugins/setup.js +496 -0
  183. package/dist/src/extensions/agent-plugins/skill-catalog.d.ts +14 -0
  184. package/dist/src/extensions/agent-plugins/skill-catalog.js +95 -0
  185. package/dist/src/extensions/agent-plugins/source-catalog.d.ts +21 -0
  186. package/dist/src/extensions/agent-plugins/source-catalog.js +175 -0
  187. package/dist/src/extensions/agent-plugins/sources.d.ts +1 -1
  188. package/dist/src/extensions/agent-plugins/sources.js +12 -3
  189. package/dist/src/extensions/agent-plugins/store.d.ts +33 -2
  190. package/dist/src/extensions/agent-plugins/store.js +175 -25
  191. package/dist/src/extensions/agent-plugins/user-config.d.ts +5 -0
  192. package/dist/src/extensions/agent-plugins/user-config.js +49 -0
  193. package/dist/src/extensions/agent-plugins/validation.d.ts +26 -1
  194. package/dist/src/extensions/agent-plugins/validation.js +143 -28
  195. package/dist/src/gateway/agents-admin.js +2 -2
  196. package/dist/src/gateway/hono/lib/config-payload.js +1 -1
  197. package/dist/src/gateway/hono/routes/agent-plugins.js +121 -10
  198. package/dist/src/gateway/hono/routes/auth-registry-extensions.js +1 -1
  199. package/dist/src/gateway/hono/routes/composer-history.js +22 -4
  200. package/dist/src/gateway/hono/routes/config-patch/misc.js +2 -2
  201. package/dist/src/gateway/hono/routes/connectors.js +1 -1
  202. package/dist/src/gateway/hono/routes/context-sources.js +1 -1
  203. package/dist/src/gateway/hono/routes/mcp.js +6 -4
  204. package/dist/src/gateway/hono/routes/notes.js +2 -2
  205. package/dist/src/gateway/hono/routes/projects.js +2 -2
  206. package/dist/src/gateway/hono/routes/session-input-handler.js +1 -1
  207. package/dist/src/gateway/hono/routes/tasks.js +1 -1
  208. package/dist/src/gateway/image-generation-setup.js +1 -1
  209. package/dist/src/gateway/lock.js +1 -1
  210. package/dist/src/gateway/service/marketplace-service.js +4 -2
  211. package/dist/src/gateway/service.js +8 -6
  212. package/dist/src/gateway/session-context-summary.js +1 -1
  213. package/dist/src/gateway/xopc-cloud-capability-setup.js +1 -1
  214. package/dist/src/home-intelligence/host.js +2 -2
  215. package/dist/src/local-apps/service.js +1 -1
  216. package/dist/src/personal-agent/proactivity/service.js +1 -1
  217. package/dist/src/personal-agent/service.js +2 -2
  218. package/dist/src/providers/model-catalog-persistence.js +1 -1
  219. package/dist/src/routing/resolve-route.js +1 -1
  220. package/dist/src/routing/resolve-tui-session-key.js +1 -1
  221. package/dist/src/storage/sqlite/composer-input-history-repository.d.ts +4 -3
  222. package/dist/src/storage/sqlite/composer-input-history-repository.js +10 -8
  223. package/dist/src/storage/sqlite/migrations/257_session_composer_history.sql +11 -0
  224. package/dist/src/storage/sqlite/migrations/runner.d.ts +1 -1
  225. package/dist/src/storage/sqlite/migrations/runner.js +3 -3
  226. package/dist/src/storage/sqlite/schema.js +1 -1
  227. package/dist/src/tasks/capabilities/read.js +2 -2
  228. package/dist/src/tasks/capabilities/write.js +1 -1
  229. package/dist/src/tasks/task-handoff-service.js +1 -1
  230. package/dist/src/tui/backends/embedded-backend.d.ts +2 -2
  231. package/dist/src/tui/backends/embedded-backend.js +6 -6
  232. package/dist/src/tui/backends/gateway-realtime-backend.d.ts +2 -2
  233. package/dist/src/tui/backends/gateway-realtime-backend.js +7 -4
  234. package/dist/src/tui/composer-history.d.ts +14 -0
  235. package/dist/src/tui/composer-history.js +85 -0
  236. package/dist/src/tui/tui-backend.d.ts +4 -3
  237. package/dist/src/tui/tui.js +19 -46
  238. package/dist/src/voice/realtime/persona-context.js +1 -1
  239. package/package.json +12 -4
  240. package/dist/gateway/static/root/assets/agent-defaults-settings-panel-D8Q9Cpge.js +0 -1
  241. package/dist/gateway/static/root/assets/agent-plugin-dialog-C-UKhDkS.js +0 -1
  242. package/dist/gateway/static/root/assets/agents-DOv68iBN.js +0 -77
  243. package/dist/gateway/static/root/assets/apps-page-Da6Ar2U3.js +0 -1
  244. package/dist/gateway/static/root/assets/automations-workspace-B9r27rPk.js +0 -6
  245. package/dist/gateway/static/root/assets/browser-automations-page-KLG8IXvl.js +0 -3
  246. package/dist/gateway/static/root/assets/browser-settings-page-Tcejw5fF.js +0 -3
  247. package/dist/gateway/static/root/assets/capabilities-page-BJlw9rhA.js +0 -2
  248. package/dist/gateway/static/root/assets/capabilities-settings-panel-kEvUR6Yu.js +0 -8
  249. package/dist/gateway/static/root/assets/channels-DRaE6_ub.js +0 -1
  250. package/dist/gateway/static/root/assets/computer-settings-page-B6JI2S1b.js +0 -1
  251. package/dist/gateway/static/root/assets/connectors-page-cDRZ8bqm.js +0 -1
  252. package/dist/gateway/static/root/assets/extension-page-BD4nZ9sf.js +0 -1
  253. package/dist/gateway/static/root/assets/extension-settings-page-CxPIMrmn.js +0 -1
  254. package/dist/gateway/static/root/assets/gateway-realtime-store-DQ6-whg-.js +0 -1
  255. package/dist/gateway/static/root/assets/gateway-settings-Da2CtQ7c.js +0 -1
  256. package/dist/gateway/static/root/assets/home-page-Cp4-sTfX.js +0 -2
  257. package/dist/gateway/static/root/assets/index-zIgp-ZTu.css +0 -1
  258. package/dist/gateway/static/root/assets/management-settings-CDV-xItG.js +0 -1
  259. package/dist/gateway/static/root/assets/mermaid-MCJ5UELQ-CpK57Kgp.js +0 -1
  260. package/dist/gateway/static/root/assets/messages-DPxcWxfD.js +0 -3
  261. package/dist/gateway/static/root/assets/note-detail-panel-BXi6BrXd.js +0 -5
  262. package/dist/gateway/static/root/assets/notes-page-ClR9R90o.js +0 -8
  263. package/dist/gateway/static/root/assets/personal-page-CSF-sn8w.js +0 -1
  264. package/dist/gateway/static/root/assets/project-detail-page-l5dXxnSq.js +0 -1
  265. package/dist/gateway/static/root/assets/projects-page-95Od8gLy.js +0 -1
  266. package/dist/gateway/static/root/assets/remote-access-hub-DPEpPFax.js +0 -1
  267. package/dist/gateway/static/root/assets/sessions-page-BN0nMm0w.js +0 -1
  268. package/dist/gateway/static/root/assets/settings-advanced-gate-BvfEKyfy.js +0 -1
  269. package/dist/gateway/static/root/assets/setup-status-panel-BWA_puDN.js +0 -1
  270. package/dist/gateway/static/root/assets/shares-settings-C0ixka9_.js +0 -1
  271. package/dist/gateway/static/root/assets/skill-reload-api-743oJIiS.js +0 -1
  272. package/dist/gateway/static/root/assets/skills-page-DBYhEjP9.js +0 -2
  273. package/dist/gateway/static/root/assets/task-detail-page-Brp2wrEc.js +0 -2
  274. package/dist/gateway/static/root/assets/usage-page-KfKZ2a3t.js +0 -1
  275. package/dist/gateway/static/root/assets/user-model-page-BSsT8WjA.js +0 -2
  276. package/dist/gateway/static/root/assets/workflows-page-a-mfjQ2h.js +0 -6
@@ -8,10 +8,9 @@ import { cancelQueuedSessionInput, claimNextSessionInput, finishSessionInputRun,
8
8
  import { appendComposerInputHistory, listComposerInputHistory } from "../../storage/sqlite/composer-input-history-repository.js";
9
9
  import { getSessionMetadata } from "../../storage/sqlite/session-read-repository.js";
10
10
  import { init_sqlite } from "../../storage/sqlite/index.js";
11
+ import { init_agent_session_key, resolveAgentIdFromConversationId } from "../../routing/agent-session-key.js";
11
12
  import { normalizeAgentId } from "../../agent-catalog/id.js";
12
13
  import { init_agent_scope, listAgentEntries } from "../../agent/agent-scope.js";
13
- import { AgentCatalogService } from "../../agent-catalog/service.js";
14
- import { init_agent_session_key, resolveAgentIdFromConversationId } from "../../routing/agent-session-key.js";
15
14
  import { resolveEffectiveAgentProfile } from "../../config/agent-profile.js";
16
15
  import { getAgentDefaultModelRef, init_schema } from "../../config/schema.js";
17
16
  import { init_paths } from "../../config/paths.js";
@@ -24,6 +23,7 @@ import { buildSessionTimeline } from "../../session/transcript-outline.js";
24
23
  import { transcriptRowsToClientHistory } from "../../session/client-history.js";
25
24
  import { createCreateShareTool, isShareToolAvailable } from "../../agent/tools/create-share-tool.js";
26
25
  import { evictEmbeddedSessionRunner } from "../../agent/embedded/session-runner.js";
26
+ import { AgentCatalogService } from "../../agent-catalog/service.js";
27
27
  import { SessionIndex } from "../../session/manager.js";
28
28
  import "../../session/index.js";
29
29
  import { parseModelRef } from "../../agent/models/selection.js";
@@ -104,14 +104,14 @@ var EmbeddedBackend = class {
104
104
  get connectionLabel() {
105
105
  return "local embedded";
106
106
  }
107
- async getComposerInputHistory() {
108
- return listComposerInputHistory();
107
+ async getComposerInputHistory(conversationId) {
108
+ return listComposerInputHistory(conversationId);
109
109
  }
110
110
  async getComposerDraftDirectory() {
111
111
  return join(resolveStateDir(), "client-drafts", "embedded", "composers");
112
112
  }
113
- async recordComposerInputHistory(text) {
114
- return appendComposerInputHistory(text).item;
113
+ async recordComposerInputHistory(conversationId, text) {
114
+ return appendComposerInputHistory(conversationId, text).item;
115
115
  }
116
116
  start() {
117
117
  if (this.running) return;
@@ -42,8 +42,8 @@ export declare class GatewayRealtimeBackend implements TuiBackend {
42
42
  start(): void;
43
43
  stop(): void;
44
44
  getActiveSignal(): AbortSignal | undefined;
45
- getComposerInputHistory(): Promise<TuiComposerHistoryItem[]>;
46
- recordComposerInputHistory(text: string): Promise<TuiComposerHistoryItem>;
45
+ getComposerInputHistory(conversationId: string): Promise<TuiComposerHistoryItem[]>;
46
+ recordComposerInputHistory(conversationId: string, text: string): Promise<TuiComposerHistoryItem>;
47
47
  private acceptReceipt;
48
48
  private reconcileInput;
49
49
  private prepareInput;
@@ -133,15 +133,18 @@ var GatewayRealtimeBackend = class {
133
133
  const signal = this.chatAbort?.signal;
134
134
  return signal && !signal.aborted ? signal : void 0;
135
135
  }
136
- async getComposerInputHistory() {
137
- const res = await gatewayFetch(this.baseUrl, "/api/composer-history", this.credential);
136
+ async getComposerInputHistory(conversationId) {
137
+ const res = await gatewayFetch(this.baseUrl, `/api/composer-history?conversationId=${encodeURIComponent(conversationId)}`, this.credential);
138
138
  if (!res.ok) throw new Error(`Failed to load composer history (${res.status})`);
139
139
  return (await res.json()).items ?? [];
140
140
  }
141
- async recordComposerInputHistory(text) {
141
+ async recordComposerInputHistory(conversationId, text) {
142
142
  const res = await gatewayFetch(this.baseUrl, "/api/composer-history", this.credential, {
143
143
  method: "POST",
144
- body: JSON.stringify({ text })
144
+ body: JSON.stringify({
145
+ conversationId,
146
+ text
147
+ })
145
148
  });
146
149
  if (!res.ok) throw new Error(`Failed to save composer history (${res.status})`);
147
150
  return (await res.json()).item;
@@ -0,0 +1,14 @@
1
+ import type { TuiComposerHistoryItem } from './tui-backend.js';
2
+ /** Session-scoped history; late responses never replace another session's editor history. */
3
+ export declare function createTuiComposerHistory(opts: {
4
+ currentConversationId: () => string;
5
+ load: (conversationId: string) => Promise<TuiComposerHistoryItem[]>;
6
+ persist: (conversationId: string, text: string) => Promise<TuiComposerHistoryItem>;
7
+ replace: (texts: string[]) => void;
8
+ }): {
9
+ append: (item: TuiComposerHistoryItem) => void;
10
+ refresh: (id?: string) => Promise<void>;
11
+ switchSession: () => void;
12
+ clear: (id: string) => void;
13
+ record: (text: string, id?: string) => void;
14
+ };
@@ -0,0 +1,85 @@
1
+ //#region src/tui/composer-history.ts
2
+ /** Session-scoped history; late responses never replace another session's editor history. */
3
+ function createTuiComposerHistory(opts) {
4
+ const sessions = /* @__PURE__ */ new Map();
5
+ const stateFor = (id) => {
6
+ let state = sessions.get(id);
7
+ if (!state) {
8
+ state = {
9
+ items: [],
10
+ revision: 0,
11
+ loadVersion: 0,
12
+ clearVersion: 0,
13
+ writeQueue: Promise.resolve()
14
+ };
15
+ sessions.set(id, state);
16
+ }
17
+ return state;
18
+ };
19
+ const publish = (id) => {
20
+ if (id === opts.currentConversationId()) opts.replace(stateFor(id).items.map((item) => item.text));
21
+ };
22
+ const append = (item) => {
23
+ if (typeof item.conversationId !== "string" || !item.conversationId || typeof item.text !== "string" || typeof item.id !== "number") return;
24
+ const state = stateFor(item.conversationId);
25
+ if (state.items.some((entry) => item.id > 0 && entry.id === item.id)) return;
26
+ state.revision += 1;
27
+ const optimisticIndex = state.items.findIndex((entry) => entry.id === 0 && entry.text === item.text);
28
+ if (optimisticIndex >= 0 && item.id > 0) {
29
+ state.items[optimisticIndex] = item;
30
+ return;
31
+ }
32
+ if (state.items[0]?.text === item.text) {
33
+ state.items[0] = item;
34
+ return;
35
+ }
36
+ state.items = [item, ...state.items].slice(0, 100);
37
+ publish(item.conversationId);
38
+ };
39
+ const refresh = async (id = opts.currentConversationId()) => {
40
+ const state = stateFor(id);
41
+ const loadVersion = ++state.loadVersion;
42
+ try {
43
+ await state.writeQueue;
44
+ const revision = state.revision;
45
+ const items = await opts.load(id);
46
+ if (state.revision !== revision || state.loadVersion !== loadVersion) return;
47
+ state.items = items.filter((item) => item.conversationId === id).slice(0, 100);
48
+ publish(id);
49
+ } catch {}
50
+ };
51
+ return {
52
+ append,
53
+ refresh,
54
+ switchSession: () => {
55
+ const id = opts.currentConversationId();
56
+ publish(id);
57
+ refresh(id);
58
+ },
59
+ clear: (id) => {
60
+ const state = stateFor(id);
61
+ state.revision += 1;
62
+ state.clearVersion += 1;
63
+ state.items = [];
64
+ publish(id);
65
+ },
66
+ record: (text, id = opts.currentConversationId()) => {
67
+ text = text.trim();
68
+ if (!text) return;
69
+ const state = stateFor(id);
70
+ const clearVersion = state.clearVersion;
71
+ append({
72
+ conversationId: id,
73
+ id: 0,
74
+ text,
75
+ createdAt: Date.now()
76
+ });
77
+ state.writeQueue = state.writeQueue.then(async () => {
78
+ const item = await opts.persist(id, text);
79
+ if (state.clearVersion === clearVersion && item.conversationId === id) append(item);
80
+ }).catch(() => {});
81
+ }
82
+ };
83
+ }
84
+ //#endregion
85
+ export { createTuiComposerHistory };
@@ -29,6 +29,7 @@ export interface TuiEvent {
29
29
  source?: TuiEventSource;
30
30
  }
31
31
  export interface TuiComposerHistoryItem {
32
+ conversationId: string;
32
33
  id: number;
33
34
  text: string;
34
35
  createdAt: number;
@@ -190,11 +191,11 @@ export interface TuiBackend {
190
191
  stop(): void;
191
192
  /** Current active chat abort signal, if a run is in progress. */
192
193
  getActiveSignal?(): AbortSignal | undefined;
193
- /** Global composer history, shared across sessions and clients. */
194
- getComposerInputHistory(): Promise<TuiComposerHistoryItem[]>;
194
+ /** Composer history for one conversation, shared across its clients. */
195
+ getComposerInputHistory(conversationId: string): Promise<TuiComposerHistoryItem[]>;
195
196
  getComposerDraftDirectory(): Promise<string>;
196
197
  /** Persist one submitted chat input. */
197
- recordComposerInputHistory(text: string): Promise<TuiComposerHistoryItem>;
198
+ recordComposerInputHistory(conversationId: string, text: string): Promise<TuiComposerHistoryItem>;
198
199
  /** Send a chat message, returns the run id. */
199
200
  sendChat(opts: ChatSendOptions): Promise<{
200
201
  runId: string;
@@ -18,6 +18,7 @@ import { applyThemeById, getBashExcludeBorderColor, getBashModeBorderColor, getC
18
18
  import { editorTheme, theme } from "./theme.js";
19
19
  import { extensionForImageMimeType, readClipboardImage } from "./clipboard-image.js";
20
20
  import { copyTextToClipboard } from "./clipboard-text.js";
21
+ import { createTuiComposerHistory } from "./composer-history.js";
21
22
  import { createXopcTuiKeybindingsManager } from "./tui-keybindings-file.js";
22
23
  import { isActiveRunStreamStale, markActiveRunStalled, markRunRecovering, markRunRecoveryComplete, markRunSending } from "./tui-run-state.js";
23
24
  import { clearSeenStreamEvents, clearSeenStreamEventsForRun, dispatchAgentEvent } from "./tui-agent-events.js";
@@ -1863,45 +1864,25 @@ async function runTui(opts) {
1863
1864
  updateFooter();
1864
1865
  tui.requestRender();
1865
1866
  };
1866
- let composerHistory = [];
1867
- let composerHistoryWriteQueue = Promise.resolve();
1868
- const applyComposerHistory = (next) => {
1869
- composerHistory = next.slice(0, 100);
1870
- composerHistoryTexts = composerHistory.map((item) => item.text);
1871
- if (editor === defaultEditor) {
1872
- defaultEditor.replaceHistory(composerHistory.map((item) => item.text));
1873
- return;
1867
+ const composerHistory = createTuiComposerHistory({
1868
+ currentConversationId: () => state.currentConversationId,
1869
+ load: (id) => client.getComposerInputHistory(id),
1870
+ persist: (id, text) => client.recordComposerInputHistory(id, text),
1871
+ replace: (texts) => {
1872
+ composerHistoryTexts = texts;
1873
+ defaultEditor.replaceHistory(texts);
1874
+ if (editor !== defaultEditor) setEditorComponent(editorComponentFactory);
1875
+ tui.requestRender();
1874
1876
  }
1875
- for (const item of composerHistory.slice().reverse()) editor.addToHistory?.(item.text);
1876
- };
1877
- const refreshComposerHistory = async () => {
1878
- try {
1879
- await composerHistoryWriteQueue;
1880
- applyComposerHistory(await client.getComposerInputHistory());
1881
- } catch {}
1882
- };
1877
+ });
1878
+ const refreshComposerHistory = () => composerHistory.refresh();
1883
1879
  const refreshChatInputState = async (conversationId = state.currentConversationId) => {
1884
1880
  try {
1885
1881
  applyChatInputState(await client.getChatInputState(conversationId));
1886
1882
  } catch {}
1887
1883
  };
1888
- const recordChatHistory = (value) => {
1889
- const text = value.trim();
1890
- if (!text) return;
1891
- editor.addToHistory?.(text);
1892
- if (composerHistory[0]?.text !== text) {
1893
- composerHistory = [{
1894
- id: 0,
1895
- text,
1896
- createdAt: Date.now()
1897
- }, ...composerHistory].slice(0, 100);
1898
- composerHistoryTexts = composerHistory.map((item) => item.text);
1899
- }
1900
- composerHistoryWriteQueue = composerHistoryWriteQueue.then(async () => {
1901
- const item = await client.recordComposerInputHistory(text);
1902
- const optimisticIndex = composerHistory.findIndex((entry) => entry.id === 0 && entry.text === item.text);
1903
- if (optimisticIndex >= 0) composerHistory[optimisticIndex] = item;
1904
- }).catch(() => {});
1884
+ const recordChatHistory = (value, conversationId = state.currentConversationId) => {
1885
+ composerHistory.record(value, conversationId);
1905
1886
  };
1906
1887
  const submitBurst = createSubmitBurstCoalescer({
1907
1888
  submit: createEditorSubmitHandler({
@@ -1939,7 +1920,7 @@ async function runTui(opts) {
1939
1920
  if (!ok) throw new Error("Queued input changed; refreshed latest state");
1940
1921
  editingQueuedInput = void 0;
1941
1922
  if (state.currentConversationId === conversationId && editor.getText().trim() === content) editor.setText("");
1942
- recordChatHistory(content);
1923
+ recordChatHistory(content, conversationId);
1943
1924
  tui.requestRender();
1944
1925
  }).catch((error) => {
1945
1926
  chatLog.addSystem(theme.dim(`Edit failed: ${error instanceof Error ? error.message : String(error)}`));
@@ -1967,7 +1948,7 @@ async function runTui(opts) {
1967
1948
  delivery: "next"
1968
1949
  }).then(({ ok, state: inputState }) => {
1969
1950
  if (!ok) throw new Error("Gateway did not accept the message");
1970
- recordChatHistory(text);
1951
+ recordChatHistory(text, conversationId);
1971
1952
  if (state.currentConversationId === conversationId && editor.getText().trim() === text) editor.setText("");
1972
1953
  if (inputState) applyChatInputState(inputState);
1973
1954
  else refreshChatInputState(conversationId);
@@ -1982,6 +1963,7 @@ async function runTui(opts) {
1982
1963
  };
1983
1964
  const setConversationId = (key) => {
1984
1965
  state.currentConversationId = resolveConversationId(key);
1966
+ composerHistory.switchSession();
1985
1967
  state.chatInputState = createEmptyChatInputState(state.currentConversationId);
1986
1968
  editingQueuedInput = void 0;
1987
1969
  refreshChatInputState(state.currentConversationId);
@@ -2280,20 +2262,11 @@ async function runTui(opts) {
2280
2262
  return;
2281
2263
  }
2282
2264
  if (evt.event === "composer-history.appended") {
2283
- const item = data;
2284
- if (typeof item.text === "string" && typeof item.id === "number") {
2285
- const optimisticIndex = composerHistory.findIndex((entry) => entry.id === 0 && entry.text === item.text);
2286
- if (optimisticIndex >= 0) composerHistory[optimisticIndex] = item;
2287
- else if (composerHistory[0]?.text !== item.text) {
2288
- composerHistory = [item, ...composerHistory].slice(0, 100);
2289
- composerHistoryTexts = composerHistory.map((entry) => entry.text);
2290
- editor.addToHistory?.(item.text);
2291
- } else composerHistory[0] = item;
2292
- }
2265
+ composerHistory.append(data);
2293
2266
  return;
2294
2267
  }
2295
2268
  if (evt.event === "composer-history.cleared") {
2296
- applyComposerHistory([]);
2269
+ if (typeof data.conversationId === "string") composerHistory.clear(data.conversationId);
2297
2270
  return;
2298
2271
  }
2299
2272
  if (evt.event === "workflow.run.updated" && handleWorkflowRunUpdated(data)) return;
@@ -1,6 +1,6 @@
1
1
  import { init_agent_scope, resolveAgentProfileDir } from "../../agent/agent-scope.js";
2
- import { DEFAULT_SOUL_FILENAME } from "../../agent/context/workspace.js";
3
2
  import { resolveEffectiveAgentProfileForSession } from "../../config/agent-profile.js";
3
+ import { DEFAULT_SOUL_FILENAME } from "../../agent/context/workspace.js";
4
4
  import { loadProfileBootstrapFiles } from "../../agent/bootstrap/load-bootstrap-files.js";
5
5
  import { join } from "node:path";
6
6
  import { statSync } from "node:fs";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xopcai/xopc",
3
- "version": "0.0.396",
3
+ "version": "0.0.398",
4
4
  "description": "Local-first personal AI with Ada, task delegation, files, projects, workflows, and automations. Use cloud or local models.",
5
5
  "type": "module",
6
6
  "main": "dist/src/index.js",
@@ -171,10 +171,10 @@
171
171
  "@xopcai/browser-control-contract": "0.1.0",
172
172
  "@xopcai/computer-control-contract": "0.1.0",
173
173
  "@xopcai/endpoint-tools-protocol": "0.0.0",
174
- "@xopcai/endpoint-tools-client": "0.0.0",
175
174
  "@xopcai/gateway-contract": "0.0.0",
176
- "@xopcai/image-providers": "0.1.0",
175
+ "@xopcai/endpoint-tools-client": "0.0.0",
177
176
  "@xopcai/realtime-client": "0.0.0",
177
+ "@xopcai/image-providers": "0.1.0",
178
178
  "@xopcai/realtime-protocol": "0.0.0"
179
179
  },
180
180
  "scripts": {
@@ -222,6 +222,11 @@
222
222
  "test:extensions": "cross-env XOPC_LOG_LEVEL=fatal vitest run --project=extensions",
223
223
  "test:web": "cross-env XOPC_LOG_LEVEL=fatal vitest run --project=web",
224
224
  "test:packages": "cross-env XOPC_LOG_LEVEL=fatal vitest run --project=packages",
225
+ "test:plugins:e2e": "pnpm run build:node && pnpm run build:web && pnpm run test:plugins:store:e2e && pnpm run test:plugins:app:e2e && pnpm run test:plugins:authorization:e2e && pnpm run test:plugins:browser",
226
+ "test:plugins:app:e2e": "cross-env XOPC_LOG_LEVEL=fatal tsx scripts/verify-plugin-app-e2e.mts",
227
+ "test:plugins:store:e2e": "cross-env XOPC_LOG_LEVEL=fatal tsx scripts/verify-store-plugin-e2e.mts",
228
+ "test:plugins:fixtures": "tsx scripts/build-store-plugin-lab.mts",
229
+ "test:plugins:browser": "cross-env XOPC_LOG_LEVEL=fatal tsx scripts/verify-plugin-setup-browser.mts",
225
230
  "test:web:onboarding-visual": "node scripts/test-onboarding-visual.mjs",
226
231
  "test:web:onboarding-visual:update": "node scripts/test-onboarding-visual.mjs --update",
227
232
  "test:quick-understanding": "XOPC_LOG_LEVEL=fatal vitest run src/work-discovery/__tests__/evaluation.test.ts src/user-context/sources/__tests__/activity-clustering.test.ts src/knowledge/__tests__/quick-understanding.e2e.test.ts src/connectors/__tests__/content-enrichment.test.ts src/connectors/__tests__/connected-source-ingestion.test.ts",
@@ -285,6 +290,9 @@
285
290
  "eval:benchmark": "tsx evals/coder/apps/cli/src/benchmark.ts",
286
291
  "eval:benchmark:check": "pnpm -C evals/coder run typecheck && pnpm -C evals/coder exec vitest run --configLoader native tests/benchmark-v1.test.ts tests/xopc-adapter.test.ts tests/suite-loader.test.ts",
287
292
  "eval:benchmark:live": "node --import tsx evals/coder/scripts/run-benchmark-live.mjs",
288
- "eval:benchmark:regrade": "tsx evals/coder/apps/cli/src/benchmark-regrade.ts"
293
+ "eval:benchmark:regrade": "tsx evals/coder/apps/cli/src/benchmark-regrade.ts",
294
+ "test:plugins:authorization:e2e": "cross-env XOPC_LOG_LEVEL=fatal tsx scripts/verify-plugin-authorization-e2e.mts",
295
+ "test:plugins:production:e2e": "cross-env XOPC_LOG_LEVEL=fatal tsx scripts/verify-production-plugin-catalog.mts && cross-env XOPC_LOG_LEVEL=fatal tsx scripts/verify-production-plugin-browser.mts",
296
+ "test:plugins:dingtalk:live": "tsx scripts/verify-dingtalk-live-e2e.mts"
289
297
  }
290
298
  }
@@ -1 +0,0 @@
1
- import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{g as i}from"./chunk-KS7C4IRE-B2HK1psj.js";import{t as a}from"./circle-check-C23XjkUj.js";import{t as o}from"./cn-0WouolD0.js";import{c as s,n as c}from"./locale-store-Djl2FW6_.js";import{n as l,r as u}from"./cloud-credits-BMYMiiNn.js";import{i as d}from"./vendor-swr-BIWyz7Rc.js";import{Ao as ee,Cd as te,Fn as ne,G as re,Hn as ie,In as ae,Rc as f,Wc as oe,Xl as p,Zu as m,as as h,du as se,nu as ce,ql as le,ra as g,us as ue,v as _}from"./index-XRbEWVyZ.js";import{t as de}from"./number-input-DDeqHK-G.js";import{n as v,r as y}from"./settings-page-layout-Dx5S-Msc.js";import{n as b,t as x}from"./use-autosave-BLW3t_OK.js";var fe=n(),S=e(t(),1),C=r(),w=`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 T(e){let t=Number.parseInt(e,10);return Number.isFinite(t)&&t>0?t:void 0}function pe({draft:e,setDraft:t,zh:n}){let[r,i]=(0,S.useState)(()=>e.runtime.cloudCreditLimitPerRunMicro?l(e.runtime.cloudCreditLimitPerRunMicro):``),[a,o]=(0,S.useState)(!1);return(0,C.jsxs)(`label`,{className:`block text-xs font-medium text-fg-muted`,children:[n?`每次运行的 Cloud 消费上限(Credits)`:`Cloud spend limit per run (Credits)`,(0,C.jsx)(`input`,{type:`text`,inputMode:`decimal`,value:r,"aria-invalid":a,placeholder:n?`不设置额外上限`:`No additional limit`,className:`${w} mt-2`,onChange:n=>{let r=n.target.value;i(r);try{let n=r===``?void 0:u(r);if(n===`0`||n&&n.length>15)throw Error(`Invalid limit`);o(!1),t({...e,runtime:{...e.runtime,cloudCreditLimitPerRunMicro:n}})}catch{o(!0)}},onBlur:()=>{a&&i(e.runtime.cloudCreditLimitPerRunMicro?l(e.runtime.cloudCreditLimitPerRunMicro):``),o(!1)}}),(0,C.jsx)(`span`,{className:`mt-2 block font-normal ${a?`text-danger`:`text-fg-subtle`}`,children:a?n?`请输入大于零、最多四位小数的 Credits。无效输入不会保存。`:`Enter positive Credits with up to four decimals. Invalid input is not saved.`:n?`模型、图片和文件语音调用共享上限;不支持实时语音或 Cloud 电脑控制,不包含运行前后的后台调用。达到上限后停止,调整后需手动继续。`:`Shared by model, image and file audio calls during a run. Does not support realtime voice or Cloud computer use; excludes background calls outside the run. Stops at the limit; continue manually after adjusting it.`})]})}function E(e){let t=(0,fe.c)(189),{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 s=d(`agent-defaults-workflows`,_,a),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(D),t[3]=c,t[4]=l);let u=l,te=n.workflows.allowed===void 0,ne;t[5]!==n||t[6]!==r?(ne=(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]=ne):ne=t[7];let ie=ne,ae=i?`费用控制`:`Spending control`,f;t[8]===ae?f=t[9]:(f=(0,C.jsx)(`h2`,{className:`mb-4 text-base font-semibold text-fg`,children:ae}),t[8]=ae,t[9]=f);let p;t[10]!==n||t[11]!==r||t[12]!==i?(p=(0,C.jsx)(pe,{draft:n,setDraft:r,zh:i}),t[10]=n,t[11]=r,t[12]=i,t[13]=p):p=t[13];let m;t[14]!==f||t[15]!==p?(m=(0,C.jsxs)(`section`,{className:`rounded-xl bg-surface-hover/20 p-5`,children:[f,p]}),t[14]=f,t[15]=p,t[16]=m):m=t[16];let h=i?`执行与缓存策略`:`Execution and cache policy`,se=i?`轮数:${n.runtime.maxTurns??`默认`} · 超时:${n.runtime.timeoutMs??`默认`} · 缓存:${n.runtime.promptCache?.mode??`默认`} · Codemode:${n.runtime.codemode?.enabled?`开启`:`关闭`}`:`Turns: ${n.runtime.maxTurns??`default`} · Timeout: ${n.runtime.timeoutMs??`default`} · Cache: ${n.runtime.promptCache?.mode??`default`} · Codemode: ${n.runtime.codemode?.enabled?`on`:`off`}`,ce=n.runtime.codemode?.enabled??!1,le;t[17]!==n||t[18]!==r?(le=e=>r({...n,runtime:{...n.runtime,codemode:{...n.runtime.codemode,enabled:e.target.checked}}}),t[17]=n,t[18]=r,t[19]=le):le=t[19];let g;t[20]!==ce||t[21]!==le?(g=(0,C.jsx)(`input`,{type:`checkbox`,checked:ce,onChange:le,className:`mt-1 size-4 accent-[var(--color-accent)]`}),t[20]=ce,t[21]=le,t[22]=g):g=t[22];let v=i?`Codemode 读取试点`:`Codemode read pilot`,y;t[23]===v?y=t[24]:(y=(0,C.jsx)(`span`,{className:`block text-base font-semibold text-fg`,children:v}),t[23]=v,t[24]=y);let b=i?`允许智能体用脚本组合已授权的读取工具。默认关闭,保留普通工具调用。`:`Let agents combine authorized reads in scripts. Off by default; ordinary tool calls stay available.`,x;t[25]===b?x=t[26]:(x=(0,C.jsx)(`span`,{className:`mt-1 block text-sm text-fg-muted`,children:b}),t[25]=b,t[26]=x);let S;t[27]!==y||t[28]!==x?(S=(0,C.jsxs)(`span`,{children:[y,x]}),t[27]=y,t[28]=x,t[29]=S):S=t[29];let E;t[30]!==g||t[31]!==S?(E=(0,C.jsx)(`section`,{className:`rounded-xl bg-surface-hover/20 p-5`,children:(0,C.jsxs)(`label`,{className:`flex cursor-pointer items-start gap-3`,children:[g,S]})}),t[30]=g,t[31]=S,t[32]=E):E=t[32];let O=i?`执行限制`:`Execution limits`,k;t[33]===O?k=t[34]:(k=(0,C.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:O}),t[33]=O,t[34]=k);let me=i?`为所有智能体设置安全上限;留空时使用系统默认值。`:`Set safe upper bounds for every agent. Empty fields use system defaults.`,A;t[35]===me?A=t[36]:(A=(0,C.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:me}),t[35]=me,t[36]=A);let he=i?`每次运行最多轮数`:`Maximum turns per run`,ge=n.runtime.maxTurns??``,_e=i?`系统默认`:`System default`,j;t[37]!==n||t[38]!==r?(j=e=>r({...n,runtime:{...n.runtime,maxTurns:T(e.target.value)}}),t[37]=n,t[38]=r,t[39]=j):j=t[39];let M;t[40]!==ge||t[41]!==_e||t[42]!==j?(M=(0,C.jsx)(de,{allowEmpty:!0,type:`number`,min:1,value:ge,placeholder:_e,onChange:j,className:`${w} mt-2`}),t[40]=ge,t[41]=_e,t[42]=j,t[43]=M):M=t[43];let N;t[44]!==he||t[45]!==M?(N=(0,C.jsxs)(`label`,{className:`block text-xs font-medium text-fg-muted`,children:[he,M]}),t[44]=he,t[45]=M,t[46]=N):N=t[46];let ve=i?`单轮超时(毫秒)`:`Turn timeout (ms)`,P=n.runtime.timeoutMs??``,F=i?`系统默认`:`System default`,I;t[47]!==n||t[48]!==r?(I=e=>r({...n,runtime:{...n.runtime,timeoutMs:T(e.target.value)}}),t[47]=n,t[48]=r,t[49]=I):I=t[49];let L;t[50]!==P||t[51]!==F||t[52]!==I?(L=(0,C.jsx)(de,{allowEmpty:!0,type:`number`,min:1,value:P,placeholder:F,onChange:I,className:`${w} mt-2`}),t[50]=P,t[51]=F,t[52]=I,t[53]=L):L=t[53];let R;t[54]!==ve||t[55]!==L?(R=(0,C.jsxs)(`label`,{className:`block text-xs font-medium text-fg-muted`,children:[ve,L]}),t[54]=ve,t[55]=L,t[56]=R):R=t[56];let z=i?`每轮最多工具失败次数`:`Maximum tool failures per turn`,B=n.runtime.maxToolFailuresPerTurn??``,V=i?`系统默认`:`System default`,H;t[57]!==n||t[58]!==r?(H=e=>r({...n,runtime:{...n.runtime,maxToolFailuresPerTurn:T(e.target.value)}}),t[57]=n,t[58]=r,t[59]=H):H=t[59];let U;t[60]!==B||t[61]!==V||t[62]!==H?(U=(0,C.jsx)(de,{allowEmpty:!0,type:`number`,min:1,value:B,placeholder:V,onChange:H,className:`${w} mt-2`}),t[60]=B,t[61]=V,t[62]=H,t[63]=U):U=t[63];let W;t[64]!==z||t[65]!==U?(W=(0,C.jsxs)(`label`,{className:`block text-xs font-medium text-fg-muted`,children:[z,U]}),t[64]=z,t[65]=U,t[66]=W):W=t[66];let G;t[67]!==N||t[68]!==R||t[69]!==W?(G=(0,C.jsxs)(`div`,{className:`mt-5 grid gap-4 md:grid-cols-3`,children:[N,R,W]}),t[67]=N,t[68]=R,t[69]=W,t[70]=G):G=t[70];let K;t[71]!==k||t[72]!==A||t[73]!==G?(K=(0,C.jsxs)(`section`,{className:`rounded-xl bg-surface-hover/20 p-5`,children:[k,A,G]}),t[71]=k,t[72]=A,t[73]=G,t[74]=K):K=t[74];let q=i?`提示词缓存`:`Prompt cache`,J;t[75]===q?J=t[76]:(J=(0,C.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:q}),t[75]=q,t[76]=J);let Y=i?`复用稳定的上下文以降低响应延迟和模型费用。`:`Reuse stable context to reduce latency and model cost.`,X;t[77]===Y?X=t[78]:(X=(0,C.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:Y}),t[77]=Y,t[78]=X);let ye=i?`缓存模式`:`Cache mode`,Z;t[79]===ye?Z=t[80]:(Z=(0,C.jsx)(`span`,{children:ye}),t[79]=ye,t[80]=Z);let be=i?`缓存模式`:`Cache mode`,Q;t[81]===Symbol.for(`react.memo_cache_sentinel`)?(Q=[`auto`,`off`],t[81]=Q):Q=t[81];let $;t[82]!==n||t[83]!==r||t[84]!==i?($=Q.map(e=>(0,C.jsx)(oe,{"aria-pressed":n.runtime.promptCache?.mode===e,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[82]=n,t[83]=r,t[84]=i,t[85]=$):$=t[85];let xe;t[86]!==be||t[87]!==$?(xe=(0,C.jsx)(ee,{className:`mt-1.5 flex rounded-lg bg-surface-panel p-1`,role:`group`,"aria-label":be,children:$}),t[86]=be,t[87]=$,t[88]=xe):xe=t[88];let Se;t[89]!==Z||t[90]!==xe?(Se=(0,C.jsxs)(`div`,{className:`text-xs font-medium text-fg-muted`,children:[Z,xe]}),t[89]=Z,t[90]=xe,t[91]=Se):Se=t[91];let Ce;t[92]!==n||t[93]!==r||t[94]!==i?(Ce=n.runtime.promptCache?.mode===`auto`?(0,C.jsxs)(`div`,{className:`text-xs font-medium text-fg-muted`,children:[(0,C.jsx)(`span`,{children:i?`缓存周期`:`Cache lifetime`}),(0,C.jsx)(ee,{className:`mt-1.5 flex rounded-lg bg-surface-panel p-1`,role:`group`,"aria-label":i?`缓存周期`:`Cache lifetime`,children:[`short`,`long`].map(e=>(0,C.jsx)(oe,{"aria-pressed":n.runtime.promptCache?.lifetime===e,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[92]=n,t[93]=r,t[94]=i,t[95]=Ce):Ce=t[95];let we;t[96]!==Se||t[97]!==Ce?(we=(0,C.jsxs)(`div`,{className:`mt-5 grid gap-4 sm:grid-cols-2`,children:[Se,Ce]}),t[96]=Se,t[97]=Ce,t[98]=we):we=t[98];let Te;t[99]!==J||t[100]!==X||t[101]!==we?(Te=(0,C.jsxs)(`section`,{className:`rounded-xl bg-surface-hover/20 p-5`,children:[J,X,we]}),t[99]=J,t[100]=X,t[101]=we,t[102]=Te):Te=t[102];let Ee;t[103]!==se||t[104]!==E||t[105]!==K||t[106]!==Te||t[107]!==h?(Ee=(0,C.jsxs)(re,{title:h,summary:se,children:[E,K,Te]}),t[103]=se,t[104]=E,t[105]=K,t[106]=Te,t[107]=h,t[108]=Ee):Ee=t[108];let De=i?`工作流`:`Workflows`,Oe;t[109]===De?Oe=t[110]:(Oe=(0,C.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:De}),t[109]=De,t[110]=Oe);let ke=i?`设置默认工作流,并决定智能体可以调用哪些工作流。`:`Set a default workflow and control which workflows agents may invoke.`,Ae;t[111]===ke?Ae=t[112]:(Ae=(0,C.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:ke}),t[111]=ke,t[112]=Ae);let je=i?`默认工作流`:`Default workflow`,Me=n.workflows.default||(i?`未自动绑定工作流`:`No workflow bound automatically`),Ne=i?`默认工作流`:`Default workflow`,Pe;t[113]===Ne?Pe=t[114]:(Pe=(0,C.jsx)(`label`,{className:`block text-xs font-medium text-fg-muted`,children:Ne}),t[113]=Ne,t[114]=Pe);let Fe=n.workflows.default??``,Ie=s.isLoading?i?`正在加载…`:`Loading…`:i?`不设置默认工作流`:`No default workflow`,Le=i?`不设置默认工作流`:`No default workflow`,Re=i?`默认工作流`:`Default workflow`,ze;t[115]!==n||t[116]!==r?(ze=e=>r({...n,workflows:{...n.workflows,default:e||void 0}}),t[115]=n,t[116]=r,t[117]=ze):ze=t[117];let Be;t[118]!==Fe||t[119]!==Ie||t[120]!==Le||t[121]!==Re||t[122]!==ze||t[123]!==u||t[124]!==s.isLoading?(Be=(0,C.jsx)(ue,{value:Fe,options:u,placeholder:Ie,emptyLabel:Le,disabled:s.isLoading,ariaLabel:Re,onChange:ze,triggerClassName:`mt-2`}),t[118]=Fe,t[119]=Ie,t[120]=Le,t[121]=Re,t[122]=ze,t[123]=u,t[124]=s.isLoading,t[125]=Be):Be=t[125];let Ve;t[126]!==Pe||t[127]!==Be?(Ve=(0,C.jsxs)(`div`,{className:`mt-5 max-w-xl`,children:[Pe,Be]}),t[126]=Pe,t[127]=Be,t[128]=Ve):Ve=t[128];let He;t[129]!==je||t[130]!==Me||t[131]!==Ve?(He=(0,C.jsx)(re,{title:je,summary:Me,children:Ve}),t[129]=je,t[130]=Me,t[131]=Ve,t[132]=He):He=t[132];let Ue;t[133]===s.error?Ue=t[134]:(Ue=s.error?(0,C.jsx)(`p`,{className:`mt-3 text-sm text-red-600`,children:s.error instanceof Error?s.error.message:String(s.error)}):null,t[133]=s.error,t[134]=Ue);let We=i?`允许调用的工作流`:`Allowed workflows`,Ge;t[135]===We?Ge=t[136]:(Ge=(0,C.jsx)(`h3`,{className:`text-sm font-medium text-fg`,children:We}),t[135]=We,t[136]=Ge);let Ke;t[137]!==n||t[138]!==r?(Ke=()=>r({...n,workflows:{...n.workflows,allowed:void 0}}),t[137]=n,t[138]=r,t[139]=Ke):Ke=t[139];let qe=te?`bg-accent-soft shadow-surface`:`hover:bg-surface-hover`,Je;t[140]===qe?Je=t[141]:(Je=o(`rounded-xl bg-surface-base/55 p-4 text-left focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,qe),t[140]=qe,t[141]=Je);let Ye=i?`允许全部工作流`:`Allow every workflow`,Xe;t[142]===Ye?Xe=t[143]:(Xe=(0,C.jsx)(`span`,{className:`block text-sm font-medium text-fg`,children:Ye}),t[142]=Ye,t[143]=Xe);let Ze=i?`新增工作流也会自动可用。`:`New workflows become available automatically.`,Qe;t[144]===Ze?Qe=t[145]:(Qe=(0,C.jsx)(`span`,{className:`mt-1 block text-xs text-fg-muted`,children:Ze}),t[144]=Ze,t[145]=Qe);let $e;t[146]!==Ke||t[147]!==Je||t[148]!==Xe||t[149]!==Qe?($e=(0,C.jsxs)(`button`,{type:`button`,onClick:Ke,className:Je,children:[Xe,Qe]}),t[146]=Ke,t[147]=Je,t[148]=Xe,t[149]=Qe,t[150]=$e):$e=t[150];let et;t[151]!==n||t[152]!==r?(et=()=>r({...n,workflows:{...n.workflows,allowed:[]}}),t[151]=n,t[152]=r,t[153]=et):et=t[153];let tt=te?`hover:bg-surface-hover`:`bg-accent-soft shadow-surface`,nt;t[154]===tt?nt=t[155]:(nt=o(`rounded-xl bg-surface-base/55 p-4 text-left focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,tt),t[154]=tt,t[155]=nt);let rt=i?`只允许选中的工作流`:`Allow selected workflows only`,it;t[156]===rt?it=t[157]:(it=(0,C.jsx)(`span`,{className:`block text-sm font-medium text-fg`,children:rt}),t[156]=rt,t[157]=it);let at=i?`未选中的工作流不能被调用。`:`Unselected workflows cannot be invoked.`,ot;t[158]===at?ot=t[159]:(ot=(0,C.jsx)(`span`,{className:`mt-1 block text-xs text-fg-muted`,children:at}),t[158]=at,t[159]=ot);let st;t[160]!==et||t[161]!==nt||t[162]!==it||t[163]!==ot?(st=(0,C.jsxs)(`button`,{type:`button`,onClick:et,className:nt,children:[it,ot]}),t[160]=et,t[161]=nt,t[162]=it,t[163]=ot,t[164]=st):st=t[164];let ct;t[165]!==$e||t[166]!==st?(ct=(0,C.jsxs)(`div`,{className:`mt-3 grid gap-3 sm:grid-cols-2`,children:[$e,st]}),t[165]=$e,t[166]=st,t[167]=ct):ct=t[167];let lt;t[168]!==te||t[169]!==n.workflows.allowed||t[170]!==ie||t[171]!==s.data||t[172]!==s.isLoading||t[173]!==i?(lt=te?null:(0,C.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,C.jsxs)(`label`,{className:`flex cursor-pointer items-start gap-3 px-4 py-3 hover:bg-surface-hover/60`,children:[(0,C.jsx)(`input`,{type:`checkbox`,checked:n.workflows.allowed?.includes(e.id)??!1,onChange:t=>ie(e.id,t.target.checked),className:`mt-0.5 size-4 accent-[var(--color-accent)]`}),(0,C.jsxs)(`span`,{children:[(0,C.jsx)(`span`,{className:`block text-sm font-medium text-fg`,children:e.title||e.name}),e.description?(0,C.jsx)(`span`,{className:`mt-1 block text-xs text-fg-muted`,children:e.description}):null]})]},e.id)),(s.data??[]).length===0&&!s.isLoading?(0,C.jsx)(`p`,{className:`px-4 py-8 text-center text-sm text-fg-muted`,children:i?`还没有工作流。`:`No workflows yet.`}):null]}),t[168]=te,t[169]=n.workflows.allowed,t[170]=ie,t[171]=s.data,t[172]=s.isLoading,t[173]=i,t[174]=lt):lt=t[174];let ut;t[175]!==Ge||t[176]!==ct||t[177]!==lt?(ut=(0,C.jsxs)(`div`,{className:`mt-6 rounded-xl bg-surface-base/45 p-4`,children:[Ge,ct,lt]}),t[175]=Ge,t[176]=ct,t[177]=lt,t[178]=ut):ut=t[178];let dt;t[179]!==Oe||t[180]!==Ae||t[181]!==He||t[182]!==Ue||t[183]!==ut?(dt=(0,C.jsxs)(`section`,{className:`rounded-xl bg-surface-hover/20 p-5`,children:[Oe,Ae,He,Ue,ut]}),t[179]=Oe,t[180]=Ae,t[181]=He,t[182]=Ue,t[183]=ut,t[184]=dt):dt=t[184];let ft;return t[185]!==Ee||t[186]!==m||t[187]!==dt?(ft=(0,C.jsxs)(`div`,{className:`space-y-5`,children:[m,Ee,dt]}),t[185]=Ee,t[186]=m,t[187]=dt,t[188]=ft):ft=t[188],ft}function D(e){return{value:e.id,label:e.title||e.name}}function O(e){return[...new Set(e)].sort()}var k=[{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 me(e){let t=(0,fe.c)(115),{draft:n,setDraft:r,zh:i}=e,s;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(s={revalidateOnFocus:!1},t[0]=s):s=t[0];let{data:c,error:l,isLoading:u}=d(`agent-defaults-skills-catalog`,g,s),[ee,te]=(0,S.useState)(``),ne=n.skills.mode===`selected`?n.skills.include:n.skills.exclude;c?.catalog;let re;if(t[1]!==ne||t[2]!==c?.catalog||t[3]!==ee){let e=[...c?.catalog??[]],n=new Set(e.map(j));for(let t of ne)n.has(t)||e.push({name:t,description:``,enabled:!0});let r=ee.trim().toLowerCase();re=e.filter(e=>!r||`${e.name} ${e.description}`.toLowerCase().includes(r)).sort(_e),t[1]=ne,t[2]=c?.catalog,t[3]=ee,t[4]=re}else re=t[4];let ie=re,ae;t[5]!==n.skills.exclude||t[6]!==n.skills.include||t[7]!==n.skills.mode?(ae=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]=ae):ae=t[8];let f=ae,oe;t[9]!==n||t[10]!==r?(oe=e=>{if(n.skills.mode===`selected`){let t=n.skills.include.includes(e)?n.skills.include.filter(t=>t!==e):O([...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):O([...n.skills.exclude,e]);r({...n,skills:{mode:`all-enabled`,exclude:t}})},t[9]=n,t[10]=r,t[11]=oe):oe=t[11];let p=oe,h;t[12]===c?.catalog?h=t[13]:(h=c?.catalog??[],t[12]=c?.catalog,t[13]=h);let se;if(t[14]!==f||t[15]!==h){let e;t[17]===f?e=t[18]:(e=e=>e.enabled&&f(e.name),t[17]=f,t[18]=e),se=h.filter(e),t[14]=f,t[15]=h,t[16]=se}else se=t[16];let le=se.length,ue;t[19]!==c?.catalog||t[20]!==n||t[21]!==r?(ue=e=>{let t=new Set((c?.catalog??[]).filter(ge).map(he));r({...n,skills:{mode:`selected`,include:O(e.filter(e=>t.has(e)))}})},t[19]=c?.catalog,t[20]=n,t[21]=r,t[22]=ue):ue=t[22];let _=ue,de=i?`技能策略`:`Skill policy`,v;t[23]===de?v=t[24]:(v=(0,C.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:de}),t[23]=de,t[24]=v);let y=i?`决定所有智能体默认可以使用哪些技能。`:`Choose which skills every agent can discover and use by default.`,b;t[25]===y?b=t[26]:(b=(0,C.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:y}),t[25]=y,t[26]=b);let x;t[27]!==n||t[28]!==r?(x=()=>r({...n,skills:{mode:`all-enabled`,exclude:[]}}),t[27]=n,t[28]=r,t[29]=x):x=t[29];let w=n.skills.mode===`all-enabled`?`bg-accent-soft shadow-surface`:`hover:bg-surface-hover`,T;t[30]===w?T=t[31]:(T=o(`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`,w),t[30]=w,t[31]=T);let pe;t[32]===Symbol.for(`react.memo_cache_sentinel`)?(pe=(0,C.jsx)(a,{className:`mt-0.5 size-5 shrink-0 text-accent`}),t[32]=pe):pe=t[32];let E=i?`使用所有已启用技能`:`Use every enabled skill`,D;t[33]===E?D=t[34]:(D=(0,C.jsx)(`span`,{className:`block text-sm font-medium text-fg`,children:E}),t[33]=E,t[34]=D);let me=i?`适合需要完整目录的高级智能体;新增技能会自动加入。`:`For advanced agents that need the full catalog; newly enabled skills are added automatically.`,M;t[35]===me?M=t[36]:(M=(0,C.jsx)(`span`,{className:`mt-1 block text-xs leading-5 text-fg-muted`,children:me}),t[35]=me,t[36]=M);let N;t[37]!==D||t[38]!==M?(N=(0,C.jsxs)(`span`,{children:[D,M]}),t[37]=D,t[38]=M,t[39]=N):N=t[39];let ve;t[40]!==x||t[41]!==T||t[42]!==N?(ve=(0,C.jsxs)(`button`,{type:`button`,onClick:x,className:T,children:[pe,N]}),t[40]=x,t[41]=T,t[42]=N,t[43]=ve):ve=t[43];let P;t[44]!==n||t[45]!==r?(P=()=>r({...n,skills:{mode:`selected`,include:[]}}),t[44]=n,t[45]=r,t[46]=P):P=t[46];let F=n.skills.mode===`selected`?`bg-accent-soft shadow-surface`:`hover:bg-surface-hover`,I;t[47]===F?I=t[48]:(I=o(`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`,F),t[47]=F,t[48]=I);let L;t[49]===Symbol.for(`react.memo_cache_sentinel`)?(L=(0,C.jsx)(m,{className:`mt-0.5 size-5 shrink-0 text-accent`}),t[49]=L):L=t[49];let R=i?`只使用选中的技能`:`Use selected skills only`,z;t[50]===R?z=t[51]:(z=(0,C.jsx)(`span`,{className:`block text-sm font-medium text-fg`,children:R}),t[50]=R,t[51]=z);let B=i?`适合严格受控的环境;新增技能不会自动加入。`:`For tightly controlled environments; new skills are not added automatically.`,V;t[52]===B?V=t[53]:(V=(0,C.jsx)(`span`,{className:`mt-1 block text-xs leading-5 text-fg-muted`,children:B}),t[52]=B,t[53]=V);let H;t[54]!==z||t[55]!==V?(H=(0,C.jsxs)(`span`,{children:[z,V]}),t[54]=z,t[55]=V,t[56]=H):H=t[56];let U;t[57]!==P||t[58]!==I||t[59]!==H?(U=(0,C.jsxs)(`button`,{type:`button`,onClick:P,className:I,children:[L,H]}),t[57]=P,t[58]=I,t[59]=H,t[60]=U):U=t[60];let W;t[61]!==ve||t[62]!==U?(W=(0,C.jsxs)(`div`,{className:`mt-5 grid gap-3 sm:grid-cols-2`,children:[ve,U]}),t[61]=ve,t[62]=U,t[63]=W):W=t[63];let G=i?`能力组合(会替换当前选择)`:`Capability packs (replaces the current selection)`,K;t[64]===G?K=t[65]:(K=(0,C.jsx)(`p`,{className:`text-xs font-medium text-fg-muted`,children:G}),t[64]=G,t[65]=K);let q;t[66]!==_||t[67]!==c||t[68]!==i?(q=k.map(e=>(0,C.jsx)(`button`,{type:`button`,onClick:()=>_(e.names),disabled:!c,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[67]=c,t[68]=i,t[69]=q):q=t[69];let J;t[70]===q?J=t[71]:(J=(0,C.jsx)(`div`,{className:`mt-2 flex flex-wrap gap-2`,children:q}),t[70]=q,t[71]=J);let Y;t[72]!==K||t[73]!==J?(Y=(0,C.jsxs)(`div`,{className:`mt-4`,children:[K,J]}),t[72]=K,t[73]=J,t[74]=Y):Y=t[74];let X;t[75]!==b||t[76]!==W||t[77]!==Y||t[78]!==v?(X=(0,C.jsxs)(`section`,{className:`rounded-xl bg-surface-hover/20 p-5`,children:[v,b,W,Y]}),t[75]=b,t[76]=W,t[77]=Y,t[78]=v,t[79]=X):X=t[79];let ye=n.skills.mode===`selected`?i?`选择可用技能`:`Select available skills`:i?`管理例外`:`Manage exceptions`,Z;t[80]===ye?Z=t[81]:(Z=(0,C.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:ye}),t[80]=ye,t[81]=Z);let be=i?`当前默认可用 ${le} 个技能。`:`${le} skills are available by default.`,Q;t[82]===be?Q=t[83]:(Q=(0,C.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:be}),t[82]=be,t[83]=Q);let $;t[84]!==Z||t[85]!==Q?($=(0,C.jsxs)(`div`,{children:[Z,Q]}),t[84]=Z,t[85]=Q,t[86]=$):$=t[86];let xe=i?`搜索技能`:`Search skills`,Se;t[87]===xe?Se=t[88]:(Se=(0,C.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,C.jsx)(ce,{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=>te(e.target.value),t[90]=we):we=t[90];let Te=i?`搜索技能`:`Search skills`,Ee;t[91]!==ee||t[92]!==Te?(Ee=(0,C.jsx)(`input`,{type:`search`,value:ee,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]=ee,t[92]=Te,t[93]=Ee):Ee=t[93];let De;t[94]!==Se||t[95]!==Ee?(De=(0,C.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,C.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,C.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]!==f||t[103]!==u||t[104]!==ie||t[105]!==p||t[106]!==i?(Ae=u?(0,C.jsx)(`div`,{className:`mt-4 space-y-2`,children:[0,1,2,3].map(A)}):(0,C.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:[ie.map(e=>{let t=f(e.name);return(0,C.jsxs)(`label`,{className:o(`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,C.jsx)(`input`,{type:`checkbox`,checked:t,disabled:!e.enabled,onChange:()=>p(e.name),className:`mt-0.5 size-4 rounded border-edge accent-[var(--color-accent)]`}),(0,C.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,C.jsxs)(`span`,{className:`flex flex-wrap items-center gap-2`,children:[(0,C.jsx)(`span`,{className:`text-sm font-medium text-fg`,children:e.name}),e.enabled?null:(0,C.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,C.jsx)(`span`,{className:`mt-1 block line-clamp-2 text-xs leading-5 text-fg-muted`,children:e.description}):null]})]},e.name)}),ie.length===0?(0,C.jsx)(`p`,{className:`px-4 py-8 text-center text-sm text-fg-muted`,children:i?`没有匹配的技能。`:`No matching skills.`}):null]}),t[102]=f,t[103]=u,t[104]=ie,t[105]=p,t[106]=i,t[107]=Ae):Ae=t[107];let je;t[108]!==Oe||t[109]!==ke||t[110]!==Ae?(je=(0,C.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]!==X||t[113]!==je?(Me=(0,C.jsxs)(`div`,{className:`space-y-5`,children:[X,je]}),t[112]=X,t[113]=je,t[114]=Me):Me=t[114],Me}function A(e){return(0,C.jsx)(f,{className:`h-14 rounded-xl`},e)}function he(e){return e.name}function ge(e){return e.enabled}function _e(e,t){return e.name.localeCompare(t.name)}function j(e){return e.name}function M(e){let t=Number.parseInt(e,10);return Number.isFinite(t)&&t>0?t:void 0}function N(e){let t=(0,fe.c)(101),{draft:n,setDraft:r,builtinTools:i,zh:a}=e,s=ie(),[c,l]=(0,S.useState)(``),[u,d]=(0,S.useState)(`all`),[te,ne]=(0,S.useState)(),ae;t[0]===i?ae=t[1]:(ae=new Map(i.map(F)),t[0]=i,t[1]=ae);let f=ae,p;t[2]!==i||t[3]!==n.tools?(p=[...new Set([...i.map(P),...Object.keys(n.tools)])].filter(ve).sort(),t[2]=i,t[3]=n.tools,t[4]=p):p=t[4];let m=p,h;if(t[5]!==m||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),h=m.filter(e),t[5]=m,t[6]=n.tools,t[7]=h}else h=t[7];let se=h.length,g;if(t[10]!==m||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),g=m.filter(e),t[10]=m,t[11]=n.tools,t[12]=g}else g=t[12];let ue=g.length,_;if(t[15]!==m||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),_=m.filter(e),t[15]=m,t[16]=n.tools,t[17]=_}else _=t[17];let v;t[20]!==h.length||t[21]!==g.length||t[22]!==_.length?(v={allow:se,ask:ue,deny:_.length},t[20]=h.length,t[21]=g.length,t[22]=_.length,t[23]=v):v=t[23];let y=v,b;if(t[24]!==m||t[25]!==f||t[26]!==n.tools||t[27]!==u||t[28]!==c){let e=c.trim().toLowerCase();b=m.filter(t=>{let r=n.tools[t]?.mode??`allow`,i=f.get(t),a=`${t} ${i?.en??``} ${i?.zh??``}`.toLowerCase();return(!e||a.includes(e))&&(u===`all`||r===u)}),t[24]=m,t[25]=f,t[26]=n.tools,t[27]=u,t[28]=c,t[29]=b}else b=t[29];let x=b,w;t[30]!==n||t[31]!==r?(w=(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]=w):w=t[32];let T=w,pe=a?`全部 ${m.length}`:`All ${m.length}`,E;t[33]===pe?E=t[34]:(E={id:`all`,label:pe},t[33]=pe,t[34]=E);let D=a?`允许 ${y.allow}`:`Allow ${y.allow}`,O;t[35]===D?O=t[36]:(O={id:`allow`,label:D},t[35]=D,t[36]=O);let k=a?`询问 ${y.ask}`:`Ask ${y.ask}`,me;t[37]===k?me=t[38]:(me={id:`ask`,label:k},t[37]=k,t[38]=me);let A=a?`禁用 ${y.deny}`:`Deny ${y.deny}`,he;t[39]===A?he=t[40]:(he={id:`deny`,label:A},t[39]=A,t[40]=he);let ge;t[41]!==E||t[42]!==O||t[43]!==me||t[44]!==he?(ge=[E,O,me,he],t[41]=E,t[42]=O,t[43]=me,t[44]=he,t[45]=ge):ge=t[45];let _e=ge,j=a?`默认工具权限`:`Default tool permissions`,N;t[46]===j?N=t[47]:(N=(0,C.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:j}),t[46]=j,t[47]=N);let I=a?`允许:直接执行;询问:执行前确认;禁用:智能体无法使用。`:`Allow runs directly, Ask requires confirmation, and Deny makes the tool unavailable.`,L;t[48]===I?L=t[49]:(L=(0,C.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:I}),t[48]=I,t[49]=L);let R;t[50]!==N||t[51]!==L?(R=(0,C.jsxs)(`div`,{children:[N,L]}),t[50]=N,t[51]=L,t[52]=R):R=t[52];let z=a?`工具筛选`:`Tool filter`,B;t[53]!==u||t[54]!==_e?(B=_e.map(e=>(0,C.jsx)(`button`,{"aria-pressed":u===e.id,type:`button`,onClick:()=>d(e.id),className:o(`rounded-lg px-3 py-1.5 text-xs font-medium`,u===e.id?`bg-surface-base text-fg shadow-surface`:`text-fg-muted hover:text-fg`),children:e.label},e.id)),t[53]=u,t[54]=_e,t[55]=B):B=t[55];let V;t[56]!==z||t[57]!==B?(V=(0,C.jsx)(ee,{className:`flex flex-wrap gap-1 rounded-xl bg-surface-panel p-1`,role:`group`,"aria-label":z,indicatorClassName:`rounded-lg bg-surface-base shadow-surface`,children:B}),t[56]=z,t[57]=B,t[58]=V):V=t[58];let H=a?`搜索工具`:`Search tools`,U;t[59]===H?U=t[60]:(U=(0,C.jsx)(`span`,{className:`sr-only`,children:H}),t[59]=H,t[60]=U);let W;t[61]===Symbol.for(`react.memo_cache_sentinel`)?(W=(0,C.jsx)(ce,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-fg-subtle`}),t[61]=W):W=t[61];let G;t[62]===Symbol.for(`react.memo_cache_sentinel`)?(G=e=>l(e.target.value),t[62]=G):G=t[62];let K=a?`搜索工具`:`Search tools`,q;t[63]!==c||t[64]!==K?(q=(0,C.jsx)(`input`,{type:`search`,value:c,onChange:G,placeholder:K,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[63]=c,t[64]=K,t[65]=q):q=t[65];let J;t[66]!==U||t[67]!==q?(J=(0,C.jsxs)(`label`,{className:`relative block w-full sm:w-72`,children:[U,W,q]}),t[66]=U,t[67]=q,t[68]=J):J=t[68];let Y;t[69]!==V||t[70]!==J?(Y=(0,C.jsxs)(`div`,{className:`mt-5 flex flex-wrap items-center justify-between gap-3`,children:[V,J]}),t[69]=V,t[70]=J,t[71]=Y):Y=t[71];let X=a?`工具调用限制`:`Tool call limits`,ye=a?`每个工具的调用次数和超时限制继续生效;授权可在下方直接修改。`:`Call and timeout limits remain active; edit permissions below.`,Z;t[72]!==X||t[73]!==ye?(Z=(0,C.jsx)(re,{title:X,summary:ye,children:null}),t[72]=X,t[73]=ye,t[74]=Z):Z=t[74];let be;if(t[75]!==f||t[76]!==n.tools||t[77]!==te||t[78]!==s||t[79]!==T||t[80]!==x||t[81]!==a){let e;t[83]!==f||t[84]!==n.tools||t[85]!==te||t[86]!==s||t[87]!==T||t[88]!==a?(e=e=>{let t=n.tools[e]??{mode:`allow`},r=f.get(e),i=te===e;return(0,C.jsxs)(`div`,{className:`px-4 py-3`,children:[(0,C.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[(0,C.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,C.jsx)(`code`,{className:`text-xs font-medium text-fg`,children:e}),r?(0,C.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:a?r.zh:r.en}):null]}),(0,C.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,C.jsx)(ee,{className:`flex rounded-lg bg-surface-base p-1`,role:`group`,"aria-label":e,indicatorClassName:`rounded-md bg-accent`,children:[`allow`,`ask`,`deny`].map(n=>(0,C.jsx)(`button`,{"aria-pressed":t.mode===n,type:`button`,onClick:()=>T(e,{mode:n}),className:o(`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))}),s?(0,C.jsx)(oe,{variant:`ghost`,className:`px-2 py-1`,"aria-label":a?`${e} 调用限制`:`${e} call limits`,onClick:()=>ne(i?void 0:e),children:(0,C.jsx)(le,{className:`size-4`})}):null]})]}),i&&s?(0,C.jsxs)(`div`,{className:`mt-3 grid gap-3 rounded-lg bg-surface-base p-3 sm:grid-cols-2`,children:[(0,C.jsxs)(`label`,{className:`block text-xs font-medium text-fg-muted`,children:[a?`每轮最多调用次数`:`Maximum calls per turn`,(0,C.jsx)(de,{allowEmpty:!0,type:`number`,min:1,value:t.maxCallsPerTurn??``,placeholder:a?`不限制`:`Unlimited`,onChange:t=>T(e,{maxCallsPerTurn:M(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,C.jsxs)(`label`,{className:`block text-xs font-medium text-fg-muted`,children:[a?`单次超时(毫秒)`:`Call timeout (ms)`,(0,C.jsx)(de,{allowEmpty:!0,type:`number`,min:1,value:t.timeoutMs??``,placeholder:a?`使用系统默认值`:`Use system default`,onChange:t=>T(e,{timeoutMs:M(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[83]=f,t[84]=n.tools,t[85]=te,t[86]=s,t[87]=T,t[88]=a,t[89]=e):e=t[89],be=x.map(e),t[75]=f,t[76]=n.tools,t[77]=te,t[78]=s,t[79]=T,t[80]=x,t[81]=a,t[82]=be}else be=t[82];let Q;t[90]!==x.length||t[91]!==a?(Q=x.length===0?(0,C.jsx)(`p`,{className:`px-4 py-10 text-center text-sm text-fg-muted`,children:a?`没有匹配的工具。`:`No matching tools.`}):null,t[90]=x.length,t[91]=a,t[92]=Q):Q=t[92];let $;t[93]!==be||t[94]!==Q?($=(0,C.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:[be,Q]}),t[93]=be,t[94]=Q,t[95]=$):$=t[95];let xe;return t[96]!==R||t[97]!==Y||t[98]!==Z||t[99]!==$?(xe=(0,C.jsxs)(`section`,{className:`rounded-xl bg-surface-hover/20 p-5`,children:[R,Y,Z,$]}),t[96]=R,t[97]=Y,t[98]=Z,t[99]=$,t[100]=xe):xe=t[100],xe}function ve(e){return e!==`computer_use`||h()}function P(e){return e.id}function F(e){return[e.id,e.description]}function I(){let e=(0,fe.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,C.jsxs)(y,{gap:`gap-5`,children:[(0,C.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,C.jsxs)(`div`,{className:`space-y-2`,children:[(0,C.jsx)(f,{className:`h-7 w-56`}),(0,C.jsx)(f,{className:`h-4 w-96 max-w-full`})]}),(0,C.jsx)(f,{className:`h-9 w-28`})]}),(0,C.jsx)(f,{className:`h-20 rounded-2xl`}),(0,C.jsx)(f,{className:`h-12 rounded-xl`}),(0,C.jsx)(f,{className:`h-72 rounded-2xl`})]}),e[0]=t):t=e[0],t}function L(e){let t=(0,fe.c)(65),{initial:n,builtinTools:r,zh:a}=e,[s,c]=i(),l;t[0]===s?l=t[1]:(l=s.get(`panel`),t[0]=s,t[1]=l);let u=l,d=u===`skills`||u===`tools`||u===`runtime`?u:`skills`,re;t[2]!==s||t[3]!==c?(re=e=>{let t=new URLSearchParams(s);t.set(`panel`,e),c(t,{replace:!0})},t[2]=s,t[3]=c,t[4]=re):re=t[4];let ie=re,f;t[5]===n?f=t[6]:(f=()=>structuredClone(n),t[5]=n,t[6]=f);let[m,h]=(0,S.useState)(f),ce;t[7]===n?ce=t[8]:(ce=()=>structuredClone(n),t[7]=n,t[8]=ce);let[le,g]=(0,S.useState)(ce),ue;t[9]===m?ue=t[10]:(ue=JSON.stringify(m),t[9]=m,t[10]=ue);let _;t[11]===le?_=t[12]:(_=JSON.stringify(le),t[11]=le,t[12]=_);let de=ue!==_,w=a?`技能`:`Skills`,T;t[13]===w?T=t[14]:(T={id:`skills`,label:w,icon:se},t[13]=w,t[14]=T);let pe=a?`工具`:`Tools`,D;t[15]===pe?D=t[16]:(D={id:`tools`,label:pe,icon:p},t[15]=pe,t[16]=D);let O=a?`运行`:`Runtime`,k;t[17]===O?k=t[18]:(k={id:`runtime`,label:O,icon:te},t[17]=O,t[18]=k);let A;t[19]!==D||t[20]!==k||t[21]!==T?(A=[T,D,k],t[19]=D,t[20]=k,t[21]=T,t[22]=A):A=t[22];let he=A,ge;t[23]===Symbol.for(`react.memo_cache_sentinel`)?(ge=async e=>{let t=structuredClone(e),n=await ne(),r=await ae({...t,models:n.defaults.models},{scope:`agent`}),i=structuredClone(r.defaults);h(e=>JSON.stringify(e)===JSON.stringify(t)?i:e),g(structuredClone(i))},t[23]=ge):ge=t[23];let _e=ge,j;t[24]!==de||t[25]!==m?(j={value:m,dirty:de,onSave:_e,delayMs:0},t[24]=de,t[25]=m,t[26]=j):j=t[26];let M=x(j),ve=M.onBlurCapture,P=a?`智能体设置`:`Agent settings`,F;t[27]!==M.error||t[28]!==M.status?(F=(0,C.jsx)(b,{status:M.status,error:M.error}),t[27]=M.error,t[28]=M.status,t[29]=F):F=t[29];let I;t[30]!==P||t[31]!==F?(I=(0,C.jsx)(v,{title:P,actions:F}),t[30]=P,t[31]=F,t[32]=I):I=t[32];let L;t[33]!==M.error||t[34]!==M.retry||t[35]!==a?(L=M.error?(0,C.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,C.jsx)(`span`,{children:M.error}),(0,C.jsx)(oe,{type:`button`,variant:`ghost`,className:`h-8 text-red-600`,onClick:M.retry,children:a?`重试`:`Retry`})]}):null,t[33]=M.error,t[34]=M.retry,t[35]=a,t[36]=L):L=t[36];let R=a?`默认配置分区`:`Default configuration sections`,z;t[37]!==d||t[38]!==ie||t[39]!==he?(z=he.map(e=>{let{id:t,label:n,icon:r}=e;return(0,C.jsxs)(`button`,{type:`button`,"aria-pressed":d===t,onClick:()=>ie(t),className:o(`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`,d===t?`bg-surface-base text-fg shadow-surface`:`text-fg-muted hover:bg-surface-hover hover:text-fg`),children:[(0,C.jsx)(r,{className:o(`size-4 shrink-0`,d===t?`text-accent`:`text-fg-subtle`)}),(0,C.jsx)(`span`,{className:`text-sm font-medium`,children:n})]},t)}),t[37]=d,t[38]=ie,t[39]=he,t[40]=z):z=t[40];let B;t[41]!==R||t[42]!==z?(B=(0,C.jsx)(ee,{as:`nav`,className:`grid grid-cols-3 gap-1 rounded-xl bg-surface-hover/20 p-1`,"aria-label":R,indicatorClassName:`rounded-lg bg-surface-base shadow-surface`,children:z}),t[41]=R,t[42]=z,t[43]=B):B=t[43];let V;t[44]!==d||t[45]!==m||t[46]!==a?(V=d===`skills`?(0,C.jsx)(me,{draft:m,setDraft:h,zh:a}):null,t[44]=d,t[45]=m,t[46]=a,t[47]=V):V=t[47];let H;t[48]!==d||t[49]!==r||t[50]!==m||t[51]!==a?(H=d===`tools`?(0,C.jsx)(N,{draft:m,setDraft:h,builtinTools:r,zh:a}):null,t[48]=d,t[49]=r,t[50]=m,t[51]=a,t[52]=H):H=t[52];let U;t[53]!==d||t[54]!==m||t[55]!==a?(U=d===`runtime`?(0,C.jsx)(E,{draft:m,setDraft:h,zh:a}):null,t[53]=d,t[54]=m,t[55]=a,t[56]=U):U=t[56];let W;return t[57]!==M.onBlurCapture||t[58]!==I||t[59]!==L||t[60]!==B||t[61]!==V||t[62]!==H||t[63]!==U?(W=(0,C.jsxs)(y,{gap:`gap-5`,onBlurCapture:ve,children:[I,L,B,V,H,U]}),t[57]=M.onBlurCapture,t[58]=I,t[59]=L,t[60]=B,t[61]=V,t[62]=H,t[63]=U,t[64]=W):W=t[64],W}function R(){let e=(0,fe.c)(17),t=s(B),n=c(z)===`zh`,{data:r,error:i,isLoading:a,mutate:o}=d(t?`settings-agent-defaults`:null,ne);if(!t){let t=n?`需要本机服务令牌。`:`Local service token required.`,r;return e[0]===t?r=e[1]:(r=(0,C.jsx)(y,{children:(0,C.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,C.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,C.jsx)(oe,{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,C.jsxs)(y,{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,C.jsx)(I,{}),e[12]=t):t=e[12],t}let l;return e[13]!==r.builtinTools||e[14]!==r.defaults||e[15]!==n?(l=(0,C.jsx)(L,{initial:r.defaults,builtinTools:r.builtinTools,zh:n}),e[13]=r.builtinTools,e[14]=r.defaults,e[15]=n,e[16]=l):l=e[16],l}function z(e){return e.language}function B(e){return e.conversationId}export{R as AgentDefaultsSettingsPanel};
@@ -1 +0,0 @@
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 ee}from"./chunk-KS7C4IRE-B2HK1psj.js";import{t as i}from"./circle-check-C23XjkUj.js";import{t as a}from"./folder-open-CyzJ19I9.js";import{t as o}from"./messages-DPxcWxfD.js";import{t as s}from"./cn-0WouolD0.js";import{a as c,n as te,r as l}from"./locale-store-Djl2FW6_.js";import{a as ne,i as u,o as d,r as f,s as re,t as p}from"./dist-BGTk37IG.js";import{a as ie}from"./vendor-swr-BIWyz7Rc.js";import{$a as m,El as h,Pd as g,Wc as _,Wu as v,Xl as y,lf as b}from"./index-XRbEWVyZ.js";var x=n(),S=e(t(),1),C=r(),w=`w-full rounded-lg border border-edge bg-surface-inset px-3 py-2 text-sm text-fg`;function T(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 E(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 D(e,t,n){let r=await c(l(e),{method:t,...n===void 0?{}:{body:JSON.stringify(n)}});if(!r.ok)throw Error(r.error??`Request failed`);return r.payload}function O(e){let t=(0,x.c)(49),{pluginId:n,server:r,enabled:ee}=e,i=te(ae),a;t[0]===i?a=t[1]:(a=i.startsWith(`zh`),t[0]=i,t[1]=a);let o=a,[s,c]=(0,S.useState)(``),[l,ne]=(0,S.useState)(!1),[u,d]=(0,S.useState)(``),[f,re]=(0,S.useState)(r.type===`stdio`?`API_KEY`:`Authorization`),[p,ie]=(0,S.useState)(r.type===`stdio`?``:`Bearer `),m;t[2]!==r.name||t[3]!==r.type?(m=(0,C.jsxs)(`p`,{className:`font-medium`,children:[r.name,` · `,r.type]}),t[2]=r.name,t[3]=r.type,t[4]=m):m=t[4];let h=r.type===`stdio`?`xopc mcp list`:`xopc mcp login ${r.id}`,g;t[5]===h?g=t[6]:(g=(0,C.jsx)(`p`,{className:`mt-2 break-all font-mono text-xs text-fg-muted`,children:h}),t[5]=h,t[6]=g);let v;t[7]!==f||t[8]!==n||t[9]!==p||t[10]!==s||t[11]!==r.name||t[12]!==r.type||t[13]!==o?(v=e=>{e.preventDefault(),ne(!0),d(``),D(`/api/extensions/agent-plugins/${encodeURIComponent(n)}/mcp/${encodeURIComponent(r.name)}/auth`,`PUT`,{mode:`api-key`,secrets:[{target:r.type===`stdio`?`env`:`headers`,key:f,value:s,prefix:p}]}).then(()=>{c(``),d(o?`已保存`:`Saved`)}).catch(e=>d(String(e))).finally(()=>ne(!1))},t[7]=f,t[8]=n,t[9]=p,t[10]=s,t[11]=r.name,t[12]=r.type,t[13]=o,t[14]=v):v=t[14];let y=o?`字段名`:`Field name`,b;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(b=e=>re(e.target.value),t[15]=b):b=t[15];let T;t[16]===f?T=t[17]:(T=(0,C.jsx)(`input`,{className:w,value:f,onChange:b,required:!0}),t[16]=f,t[17]=T);let E;t[18]!==y||t[19]!==T?(E=(0,C.jsxs)(`label`,{className:`block`,children:[y,T]}),t[18]=y,t[19]=T,t[20]=E):E=t[20];let O=o?`前缀`:`Prefix`,k;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(k=e=>ie(e.target.value),t[21]=k):k=t[21];let A;t[22]===p?A=t[23]:(A=(0,C.jsx)(`input`,{className:w,value:p,onChange:k}),t[22]=p,t[23]=A);let j;t[24]!==O||t[25]!==A?(j=(0,C.jsxs)(`label`,{className:`block`,children:[O,A]}),t[24]=O,t[25]=A,t[26]=j):j=t[26];let M=o?`密钥`:`Secret`,N;t[27]===Symbol.for(`react.memo_cache_sentinel`)?(N=e=>c(e.target.value),t[27]=N):N=t[27];let P;t[28]===s?P=t[29]:(P=(0,C.jsx)(`input`,{type:`password`,autoComplete:`off`,className:w,value:s,onChange:N,required:!0}),t[28]=s,t[29]=P);let F;t[30]!==M||t[31]!==P?(F=(0,C.jsxs)(`label`,{className:`block`,children:[M,P]}),t[30]=M,t[31]=P,t[32]=F):F=t[32];let I=!ee||l||!s,L=o?`保存密钥`:`Save API key`,R;t[33]!==I||t[34]!==L?(R=(0,C.jsx)(_,{type:`submit`,disabled:I,children:L}),t[33]=I,t[34]=L,t[35]=R):R=t[35];let z;t[36]!==E||t[37]!==j||t[38]!==F||t[39]!==R||t[40]!==v?(z=(0,C.jsxs)(`form`,{className:`mt-3 space-y-2`,onSubmit:v,children:[E,j,F,R]}),t[36]=E,t[37]=j,t[38]=F,t[39]=R,t[40]=v,t[41]=z):z=t[41];let B;t[42]===u?B=t[43]:(B=u?(0,C.jsx)(`p`,{className:`mt-2 text-fg-muted`,children:u}):null,t[42]=u,t[43]=B);let V;return t[44]!==z||t[45]!==B||t[46]!==m||t[47]!==g?(V=(0,C.jsxs)(`div`,{className:`rounded-lg border border-edge p-3 text-sm`,children:[m,g,z,B]}),t[44]=z,t[45]=B,t[46]=m,t[47]=g,t[48]=V):V=t[48],V}function ae(e){return e.language}function k({extension:e,onClose:t,initialSource:n=``,marketplace:r,autoInstall:c=!1}){let l=te(e=>e.language),x=l.startsWith(`zh`),ae=r?.localizations?.[x?`zh-CN`:`en`],k=ae?.displayName??r?.name,A=ae?.description??r?.description,j=(0,S.useId)(),{mutate:M}=ie(),[N,P]=(0,S.useState)(e),[F,I]=(0,S.useState)(n),[L,R]=(0,S.useState)(null),[z,B]=(0,S.useState)(!1),[V,H]=(0,S.useState)(``),[oe,se]=(0,S.useState)(!1),[ce,le]=(0,S.useState)(!1),[ue,de]=(0,S.useState)(!1),[fe,U]=(0,S.useState)(!1),[pe,W]=(0,S.useState)(!1),[G,me]=(0,S.useState)(!1),[he,ge]=(0,S.useState)(!1),_e=(0,S.useRef)(!1),K=`/api/extensions/agent-plugins/${encodeURIComponent(N?.pluginId??``)}`,q=F.trim().startsWith(`store:`),J=()=>M(`gateway-extensions-list`);async function Y(e){B(!0),H(``);try{await e()}catch(e){H(e instanceof Error?e.message:String(e))}finally{B(!1)}}function X(e){I(e),R(null),H(``)}let Z=typeof window<`u`?window.electronAPI?.file:void 0,Q=/^(?:\/|[A-Za-z]:[\\/])/.test(F.trim())?F.trim():void 0;async function ve(){if(!Z?.openDirectory){W(!0);return}let e=await Z.openDirectory(Q?{defaultPath:Q}:void 0);e&&X(e)}async function ye(){if(!Z?.openFile){W(!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(),U(!1);let t=Array.from(e.dataTransfer.files);if(t.length){if(t.length>1){H(x?`一次只能选择一个插件目录或 ZIP。`:`Choose one plugin directory or ZIP at a time.`);return}let e=Z?.getPathForFile?.(t[0]);e?X(e):H(x?`浏览器无法读取本机文件路径,请使用“选择文件或目录”选择安装包。`:`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){P(await D(`${K}/activation`,`POST`,{enabled:e})),await J()}async function Ce(e){let t=!N,n=await D(t?`/api/extensions/install`:`${K}/update`,`POST`,{source:F,reviewHash:e.reviewHash});P(n),await J(),t&&!n.activationEligible&&n.readiness!==`blocked`&&n.pluginId&&(n=await D(`/api/extensions/agent-plugins/${encodeURIComponent(n.pluginId)}/activation`,`POST`,{enabled:!0}),P(n),await J()),R(null),ge(t&&n.activationEligible===!0)}async function we(){let e=await D(`/api/extensions/inspect`,`POST`,{source:F});if(E(e,r)){R(e);return}await Ce(e)}(0,S.useEffect)(()=>{e&&P(e)},[e]),(0,S.useEffect)(()=>{!c||N||!q||_e.current||(_e.current=!0,Y(we))},[c,N,q]);let Te=c&&!N&&q&&!_e.current,$=N?.components;return(0,C.jsx)(p,{defaultOpen:!0,onOpenChange:e=>!e&&t(),children:(0,C.jsxs)(d,{children:[(0,C.jsx)(ne,{className:`fixed inset-0 z-[130] bg-scrim`}),(0,C.jsxs)(f,{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,C.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between border-b border-edge p-4`,children:[(0,C.jsx)(re,{className:`font-semibold`,children:N?.name??k??(x?`安装 Agent Plugin`:`Install Agent Plugin`)}),(0,C.jsx)(_,{variant:`ghost`,onClick:t,children:x?`关闭`:`Close`})]}),(0,C.jsx)(u,{className:`sr-only`,children:x?`安装、组件、账号连接和权限`:`Installation, components, connections and permissions`}),(0,C.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-4 overflow-y-auto p-4`,children:[!N&&q?(0,C.jsxs)(`section`,{className:`space-y-4`,children:[(0,C.jsxs)(`div`,{className:`flex items-start gap-3 rounded-xl border border-edge bg-surface-base p-4`,children:[(0,C.jsx)(y,{className:`mt-0.5 size-5 shrink-0 text-emerald-600 dark:text-emerald-400`,"aria-hidden":!0}),(0,C.jsxs)(`div`,{className:`min-w-0`,children:[(0,C.jsx)(`p`,{className:`font-medium text-fg`,children:k??L?.manifest.name??F.slice(6)}),A?(0,C.jsx)(`p`,{className:`mt-1 text-sm leading-relaxed text-fg-muted`,children:A}):null,(0,C.jsx)(`p`,{className:`mt-2 text-xs text-fg-muted`,children:r?.publisher?.verification===`verified`?x?`已认证发布者 · 安装后自动启用`:`Verified publisher · enabled automatically after installation`:x?`安装前会检查来源和所需权限`:`Source and required permissions are checked before installation`})]})]}),L?null:(0,C.jsxs)(_,{className:`w-full`,disabled:z||Te,onClick:()=>void Y(we),children:[z||Te?(0,C.jsx)(v,{className:`size-4 animate-spin`,"aria-hidden":!0}):null,z||Te?x?`正在安全检查并安装…`:`Checking and installing…`:x?`一键安装`:`Install`]})]}):null,N?(0,C.jsxs)(C.Fragment,{children:[he?(0,C.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,C.jsx)(i,{className:`mt-0.5 size-5 shrink-0 text-emerald-600 dark:text-emerald-400`,"aria-hidden":!0}),(0,C.jsxs)(`div`,{children:[(0,C.jsx)(`p`,{className:`font-medium text-fg`,children:x?`插件已安装并启用`:`Plugin installed and enabled`}),(0,C.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:x?`现在可以直接在对话中使用它。`:`It is ready to use in your conversations.`})]})]}):null,N.activationEligible?null:(0,C.jsxs)(`div`,{role:`status`,className:`space-y-3 rounded-lg border border-accent/25 bg-accent-soft p-4`,children:[(0,C.jsxs)(`div`,{children:[(0,C.jsx)(`p`,{className:`font-medium text-accent-fg`,children:x?`插件已安装,当前尚未启用`:`Plugin installed. It is not enabled yet.`}),(0,C.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:x?`启用后,Skills 和 MCP 才会加入 Agent 运行时。`:`Enable it to make its skills and MCP servers available to the Agent runtime.`})]}),(0,C.jsx)(_,{disabled:z||N.readiness===`blocked`,onClick:()=>void Y(()=>Se(!0)),children:x?`启用插件`:`Enable plugin`})]}),(0,C.jsxs)(`p`,{className:`text-sm text-fg-muted`,children:[`Agent Plugin · `,N.version,` · `,N.readiness&&{ready:x?`已就绪`:`Ready`,setup_required:x?`待连接`:`Setup required`,degraded:x?`部分不可用`:`Partially available`,blocked:x?`已阻止`:`Blocked`}[N.readiness]]}),N.provenance?(0,C.jsxs)(`p`,{className:`break-words text-xs text-fg-muted`,children:[N.provenance.publisherVerification===`verified`?x?`已认证发布者`:`Verified publisher`:x?`社区发布者`:`Community publisher`,` · `,N.provenance.packageName,`@`,N.provenance.version,` · SHA-256 `,N.provenance.sha256.slice(0,12),`…`,N.provenance.riskTier?` · ${N.provenance.riskTier}`:``]}):null,(0,C.jsx)(`p`,{className:`text-sm`,children:N.description}),N.activationEligible?(0,C.jsx)(_,{disabled:z,variant:`secondary`,onClick:()=>void Y(()=>Se(!1)),children:x?`停用`:`Disable`}):null,N.canRollback?(0,C.jsx)(_,{disabled:z,variant:`secondary`,onClick:()=>void Y(async()=>{P(await D(`${K}/rollback`,`POST`)),await J()}),children:x?`回滚上一版本`:`Roll back`}):null,$?.skills.length||$?.mcp.length?(0,C.jsxs)(`div`,{className:`space-y-3 rounded-lg border border-edge p-3`,children:[(0,C.jsxs)(`div`,{children:[(0,C.jsx)(`p`,{className:`text-sm font-medium`,children:x?`此插件提供的能力`:`Capabilities from this plugin`}),$.skills.length?(0,C.jsxs)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:[`Skills: `,$.skills.map(e=>e.name).join(`, `)]}):null,$.mcp.length?(0,C.jsxs)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:[`MCP: `,$.mcp.map(e=>e.name).join(`, `)]}):null]}),(0,C.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[$.skills.length?(0,C.jsx)(_,{asChild:!0,variant:`secondary`,children:(0,C.jsx)(ee,{to:`/capabilities/skills?source=plugin`,children:x?`管理技能`:`Manage skills`})}):null,$.mcp.length?(0,C.jsx)(_,{asChild:!0,variant:`secondary`,children:(0,C.jsx)(ee,{to:`/capabilities/connectors?tab=connected`,children:x?`管理连接`:`Manage connections`})}):null]})]}):null,N.components?.mcp.length?(0,C.jsxs)(`details`,{className:`group rounded-lg border border-edge p-3`,children:[(0,C.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,C.jsx)(`span`,{children:x?`连接与密钥(按需)`:`Connections and API keys (as needed)`}),(0,C.jsx)(b,{className:`size-4 text-fg-muted transition-transform group-open:rotate-180 motion-reduce:transition-none`,"aria-hidden":!0})]}),(0,C.jsx)(`p`,{className:`mt-2 text-xs text-fg-muted`,children:x?`仅当工具服务提示登录或缺少密钥时设置。`:`Only configure this when a tool service asks you to sign in or provide a key.`}),(0,C.jsx)(`div`,{className:`mt-3 space-y-3`,children:N.components.mcp.map(e=>(0,C.jsx)(O,{pluginId:N.pluginId,server:e,enabled:N.active},e.id))})]}):null,N.diagnostics?.map((e,t)=>(0,C.jsxs)(`p`,{className:`text-sm text-fg-muted`,children:[e.component,`: `,e.message]},t))]}):null,q&&N?(0,C.jsxs)(_,{variant:`ghost`,className:`px-0`,"aria-expanded":G,onClick:()=>me(e=>!e),children:[(0,C.jsx)(b,{className:s(`size-4 transition-transform motion-reduce:transition-none`,G&&`rotate-180`),"aria-hidden":!0}),x?`高级操作`:`Advanced actions`]}):null,!q||G?(0,C.jsxs)(`form`,{className:s(`space-y-3`,N&&`border-t border-edge pt-4`),onSubmit:e=>{e.preventDefault(),Y(async()=>{R(await D(`/api/extensions/inspect`,`POST`,{source:F}))})},children:[(0,C.jsxs)(`div`,{"data-testid":`plugin-source-dropzone`,className:s(`rounded-xl border border-dashed p-3 transition-colors`,fe?`border-accent bg-accent-soft`:`border-edge bg-surface-inset/40`),onDragEnter:e=>{be(e)&&(e.preventDefault(),U(!0))},onDragOver:e=>{be(e)&&(e.preventDefault(),e.dataTransfer.dropEffect=`copy`,U(!0))},onDragLeave:e=>{e.currentTarget.contains(e.relatedTarget)||U(!1)},onDrop:xe,children:[(0,C.jsxs)(`div`,{className:`mb-2 flex items-start gap-2`,children:[(0,C.jsx)(h,{className:`mt-0.5 size-4 shrink-0 text-fg-muted`,"aria-hidden":!0}),(0,C.jsxs)(`div`,{children:[(0,C.jsx)(`label`,{htmlFor:j,className:`block text-sm font-medium`,children:N?x?`更新包来源`:`Update package source`:x?`安装包来源`:`Package source`}),(0,C.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-muted`,children:x?`拖入插件目录或 ZIP,也可输入 HTTPS ZIP 或 store:包名`:`Drop a plugin directory or ZIP, or enter an HTTPS ZIP or store:package`})]})]}),(0,C.jsx)(`input`,{id:j,className:w,value:F,onChange:e=>X(e.target.value),placeholder:x?`/插件目录/或/插件.zip`:`/plugin/folder/or/plugin.zip`,autoComplete:`off`,spellCheck:!1,required:!0}),(0,C.jsx)(`div`,{className:`mt-2 flex flex-wrap gap-2`,children:Z?(0,C.jsxs)(C.Fragment,{children:[(0,C.jsxs)(_,{type:`button`,variant:`secondary`,disabled:z,onClick:()=>void Y(ve),children:[(0,C.jsx)(a,{className:`size-4`,"aria-hidden":!0}),x?`选择目录`:`Choose directory`]}),(0,C.jsxs)(_,{type:`button`,variant:`secondary`,disabled:z,onClick:()=>void Y(ye),children:[(0,C.jsx)(g,{className:`size-4`,"aria-hidden":!0}),x?`选择 ZIP`:`Choose ZIP`]})]}):(0,C.jsxs)(_,{type:`button`,variant:`secondary`,disabled:z,onClick:()=>W(!0),children:[(0,C.jsx)(a,{className:`size-4`,"aria-hidden":!0}),x?`选择文件或目录`:`Choose file or folder`]})})]}),(0,C.jsx)(_,{type:`submit`,variant:`secondary`,disabled:z||!F,children:x?`检查安装包`:`Inspect package`})]}):null,L?(0,C.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,C.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,C.jsx)(y,{className:`mt-0.5 size-5 shrink-0 text-amber-700 dark:text-amber-300`,"aria-hidden":!0}),(0,C.jsxs)(`div`,{children:[(0,C.jsx)(`p`,{id:`plugin-authorization-title`,className:`font-medium text-fg`,children:x?`需要你的授权`:`Your authorization is required`}),(0,C.jsx)(`p`,{className:`mt-1 text-fg-muted`,children:x?`此插件需要以下新增能力。确认后会自动完成安装并启用。`:`This plugin requests the capabilities below. After approval, installation and activation continue automatically.`})]})]}),(0,C.jsx)(`ul`,{className:`space-y-2 rounded-lg border border-edge bg-surface-panel p-3 break-words`,children:L.addedCapabilities.map(e=>(0,C.jsxs)(`li`,{className:`flex gap-2`,children:[(0,C.jsx)(`span`,{"aria-hidden":!0,children:`•`}),(0,C.jsx)(`span`,{children:T(e,x)})]},e))}),L.diagnostics.map((e,t)=>(0,C.jsxs)(`p`,{children:[e.component,`: `,e.message]},t)),(0,C.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,C.jsxs)(_,{disabled:z||!!N&&L.manifest.name!==N.pluginId,onClick:()=>void Y(()=>Ce(L)),children:[z?(0,C.jsx)(v,{className:`size-4 animate-spin`,"aria-hidden":!0}):null,x?`授权并安装`:`Authorize and install`]}),(0,C.jsx)(_,{variant:`ghost`,disabled:z,onClick:()=>R(null),children:x?`取消`:`Cancel`})]})]}):null,N&&(!q||G)?(0,C.jsx)(`div`,{className:`border-t border-edge pt-4`,children:ue?(0,C.jsxs)(`div`,{className:`space-y-3 text-sm`,children:[(0,C.jsx)(`p`,{children:x?`卸载保留账号凭据;服务端授权需到相应服务撤销。`:`Credentials are retained. Revoke provider authorization in the service itself.`}),(0,C.jsxs)(`label`,{className:`flex gap-2`,children:[(0,C.jsx)(`input`,{type:`checkbox`,checked:oe,onChange:e=>se(e.target.checked)}),x?`同时删除插件数据`:`Also delete plugin data`]}),(0,C.jsxs)(`label`,{className:`flex gap-2`,children:[(0,C.jsx)(`input`,{type:`checkbox`,checked:ce,onChange:e=>le(e.target.checked)}),x?`同时删除本地凭据`:`Also delete local credentials`]}),(0,C.jsx)(_,{disabled:z,onClick:()=>void Y(async()=>{await D(K,`DELETE`,{removeData:oe,removeCredentials:ce}),await J(),t()}),children:x?`确认卸载`:`Confirm uninstall`})]}):(0,C.jsx)(_,{variant:`ghost`,disabled:z,onClick:()=>de(!0),children:x?`卸载插件`:`Uninstall`})}):null,V?(0,C.jsx)(`p`,{role:`alert`,className:`break-words text-sm text-fg-muted`,children:V}):null]})]}),Z?null:(0,C.jsx)(m,{open:pe,onOpenChange:W,initialAbsolutePath:Q,onConfirm:async e=>X(e),wd:o(l).chat.workingDirectory,selectKind:`file-or-directory`,fileExtensions:[`zip`],title:x?`选择插件安装包`:`Choose plugin package`,description:x?`选择插件目录或 ZIP 文件。`:`Choose a plugin directory or ZIP file.`,confirmLabel:x?`使用此来源`:`Use this source`,nested:!0})]})})}export{O as n,k as t};