@xopcai/xopc 0.0.460 → 0.0.463

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 (319) hide show
  1. package/dist/browser-ext/_locales/en/messages.json +1 -0
  2. package/dist/browser-ext/_locales/zh_CN/messages.json +1 -0
  3. package/dist/browser-ext/dist/assets/{auth-CQmxIyWw.js → auth-YPMDpWOW.js} +32 -1
  4. package/dist/browser-ext/dist/assets/{pcm-capture-worklet-CGN9Mlhg.js → pcm-capture-worklet-Df5TcFw4.js} +4 -2
  5. package/dist/browser-ext/dist/background.js +24 -19
  6. package/dist/browser-ext/dist/sidepanel.html +1 -1
  7. package/dist/browser-ext/dist/sidepanel.js +10 -9
  8. package/dist/browser-ext/manifest.json +1 -1
  9. package/dist/extensions/telegram/xopc.extension.json +1 -1
  10. package/dist/gateway/static/root/assets/agent-plugin-dialog-C_rlXuEe.js +1 -0
  11. package/dist/gateway/static/root/assets/{agents-CGUdvmIT.js → agents-DC0lHtl5.js} +3 -3
  12. package/dist/gateway/static/root/assets/{apps-page-M2XD1Pzu.js → apps-page-D1qzENN_.js} +1 -1
  13. package/dist/gateway/static/root/assets/{automation-task-card-CiJmJ7_h.js → automation-task-card-CJbIHRxN.js} +1 -1
  14. package/dist/gateway/static/root/assets/{automations-page-CVjgENMO.js → automations-page-HYFnPiNG.js} +1 -1
  15. package/dist/gateway/static/root/assets/{automations-workspace-CGPWyL0P.js → automations-workspace-JCQ1IXFk.js} +2 -2
  16. package/dist/gateway/static/root/assets/{block-editor-CmnkluMF.js → block-editor-DrZyRQQ0.js} +5 -5
  17. package/dist/gateway/static/root/assets/{capabilities-DDqDvCBs.js → capabilities-Dr-vvMez.js} +1 -1
  18. package/dist/gateway/static/root/assets/capabilities-hSb-qEgL.js +1 -0
  19. package/dist/gateway/static/root/assets/capabilities-page-kPv2dOzf.js +2 -0
  20. package/dist/gateway/static/root/assets/{capabilities-settings-panel-CvF8VRTv.js → capabilities-settings-panel-B08mjrGB.js} +1 -1
  21. package/dist/gateway/static/root/assets/{channels-BDVQ6Z7A.js → channels-B--IHNs4.js} +1 -1
  22. package/dist/gateway/static/root/assets/{chat-chart-block-stPJEZ90.js → chat-chart-block-ClCZyIi0.js} +1 -1
  23. package/dist/gateway/static/root/assets/chat-page-CalELOKj.js +71 -0
  24. package/dist/gateway/static/root/assets/{chat-terminal-dock-B4uA_W6R.js → chat-terminal-dock-eneTvxV3.js} +1 -1
  25. package/dist/gateway/static/root/assets/{connectors-page-DyzDVVfz.js → connectors-page-B9mpz_Rt.js} +1 -1
  26. package/dist/gateway/static/root/assets/constants-Bg1wM2nv.js +1 -0
  27. package/dist/gateway/static/root/assets/diagnostics-Bo0Z42P_.js +1 -0
  28. package/dist/gateway/static/root/assets/{extension-debug-page-BPwRrP3L.js → extension-debug-page-Bn_5xu_M.js} +1 -1
  29. package/dist/gateway/static/root/assets/{extension-iframe-host-DIH4TcdH.js → extension-iframe-host-Vs6USa0c.js} +1 -1
  30. package/dist/gateway/static/root/assets/{extension-message-router-C9JDpo_7.js → extension-message-router-GIekDj_w.js} +1 -1
  31. package/dist/gateway/static/root/assets/{extension-page-CLDoL5N8.js → extension-page-C_3bIjSB.js} +1 -1
  32. package/dist/gateway/static/root/assets/{extension-provider-BPIoHw4r.js → extension-provider-D-LolObs.js} +1 -1
  33. package/dist/gateway/static/root/assets/{extension-settings-page-BO_UKeG8.js → extension-settings-page-BV51dk16.js} +1 -1
  34. package/dist/gateway/static/root/assets/home-page-DefKShSW.js +8 -0
  35. package/dist/gateway/static/root/assets/index-CChzK_5b.css +1 -0
  36. package/dist/gateway/static/root/assets/index-DUo6H0PC.js +11 -0
  37. package/dist/gateway/static/root/assets/{local-app-workbench-page-D8oqDDAn.js → local-app-workbench-page-CfnixDO3.js} +1 -1
  38. package/dist/gateway/static/root/assets/{markdown-view-BlxIaCCQ.js → markdown-view-CNJaAdNN.js} +39 -39
  39. package/dist/gateway/static/root/assets/mcp-conversation-setup-page-DCIEL5bA.js +1 -0
  40. package/dist/gateway/static/root/assets/note-detail-panel-DsXb1qjW.js +7 -0
  41. package/dist/gateway/static/root/assets/note-image-lightbox-D6mvMSKr.js +1 -0
  42. package/dist/gateway/static/root/assets/{notes-api-CdXA-g9r.js → notes-api-BOIM9Q_D.js} +1 -1
  43. package/dist/gateway/static/root/assets/notes-page-BTpiOw67.js +8 -0
  44. package/dist/gateway/static/root/assets/{page-context-capture-button-Dibmspef.js → page-context-capture-button-B_Vdo2Ai.js} +1 -1
  45. package/dist/gateway/static/root/assets/pcm-capture-worklet-CpXsv44v.js +1 -0
  46. package/dist/gateway/static/root/assets/{personal-page-BwfyW7Hx.js → personal-page-I3IGVSJh.js} +1 -1
  47. package/dist/gateway/static/root/assets/{personal-profile-settings-CQhZjoK6.js → personal-profile-settings-C4CxmQLQ.js} +1 -1
  48. package/dist/gateway/static/root/assets/{personal-settings-panel-peD05ktj.js → personal-settings-panel-CnxI2TL0.js} +1 -1
  49. package/dist/gateway/static/root/assets/{plugin-details-dialog-nSDw8sfo.js → plugin-details-dialog-F08k_k2u.js} +1 -1
  50. package/dist/gateway/static/root/assets/{product-automation-feedback-D51I7Lg3.js → product-automation-feedback-CGso8wGv.js} +1 -1
  51. package/dist/gateway/static/root/assets/{product-preview-content-WkF2j_c-.js → product-preview-content-Dgtb4LF7.js} +1 -1
  52. package/dist/gateway/static/root/assets/product-preview-modal-C35EWUps.js +2 -0
  53. package/dist/gateway/static/root/assets/project-detail-page-Dy46uSEt.js +7 -0
  54. package/dist/gateway/static/root/assets/recording-upload-CFX7CANT.js +1 -0
  55. package/dist/gateway/static/root/assets/route-preload-ChTaYgpA.js +2 -0
  56. package/dist/gateway/static/root/assets/routine-panel-KH1VaEdC.js +2 -0
  57. package/dist/gateway/static/root/assets/{service-recommendation-list-DDlMyPvC.js → service-recommendation-list-BmRtbJz2.js} +1 -1
  58. package/dist/gateway/static/root/assets/session-manager-63NaXb1s.js +25 -0
  59. package/dist/gateway/static/root/assets/{settings-page-BHImcF1q.js → settings-page-C39lKVRv.js} +1 -1
  60. package/dist/gateway/static/root/assets/{share-preview-page-fV5USZb1.js → share-preview-page-Cqy-7-rd.js} +1 -1
  61. package/dist/gateway/static/root/assets/{shares-settings-sl40lqND.js → shares-settings-BDr50uTV.js} +1 -1
  62. package/dist/gateway/static/root/assets/{skills-page-FTd0Z7Ey.js → skills-page-DReUQ4Ug.js} +1 -1
  63. package/dist/gateway/static/root/assets/star-CnYNmpLd.js +1 -0
  64. package/dist/gateway/static/root/assets/task-detail-page-D1dNWTnP.js +3 -0
  65. package/dist/gateway/static/root/assets/{task-result-evidence-CSJeB9AH.js → task-result-evidence-CW_tN93T.js} +1 -1
  66. package/dist/gateway/static/root/assets/{use-composer-attachments-CO7XLI4x.js → use-composer-attachments-Xn6eUus2.js} +1 -1
  67. package/dist/gateway/static/root/assets/{use-file-preview-expanded-BXXeXnT0.js → use-file-preview-expanded-D0IBFhM9.js} +1 -1
  68. package/dist/gateway/static/root/assets/use-realtime-voice-B5IsKrRW.js +1 -0
  69. package/dist/gateway/static/root/assets/{use-workspace-tree-D27u-eoX.js → use-workspace-tree-7X2ydgS8.js} +1 -1
  70. package/dist/gateway/static/root/assets/{voice-settings-BiqJ0tlf.js → voice-settings-57pwZeKD.js} +1 -1
  71. package/dist/gateway/static/root/assets/{work-discovery-overlay-UvWbDUXi.js → work-discovery-overlay-BJ15p4rH.js} +1 -1
  72. package/dist/gateway/static/root/assets/{work-discovery-page-BM1HsYz6.js → work-discovery-page-8XciWNs5.js} +1 -1
  73. package/dist/gateway/static/root/assets/workspace-api-Dd_UDfeo.js +2 -0
  74. package/dist/gateway/static/root/assets/{workspace-file-preview-dialog-NffP-UXC.js → workspace-file-preview-dialog-Clj9hMj5.js} +1 -1
  75. package/dist/gateway/static/root/assets/{workspace-preview-store-Do31QQH5.js → workspace-preview-store-imhtuEIP.js} +1 -1
  76. package/dist/gateway/static/root/index.html +30 -29
  77. package/dist/package.js +1 -1
  78. package/dist/packages/gateway-contract/src/follow-ups.js +97 -0
  79. package/dist/packages/gateway-contract/src/home.js +1 -0
  80. package/dist/packages/gateway-contract/src/index.js +4 -0
  81. package/dist/packages/gateway-contract/src/observation-starters.js +95 -0
  82. package/dist/packages/gateway-contract/src/observation.js +7 -0
  83. package/dist/packages/gateway-contract/src/task-research-result.js +3 -0
  84. package/dist/src/agent/agent-manager.d.ts +1 -1
  85. package/dist/src/agent/background-review/prompts.d.ts +1 -0
  86. package/dist/src/agent/background-review/prompts.js +7 -1
  87. package/dist/src/agent/background-review/run-background-review.js +85 -7
  88. package/dist/src/agent/coding/run-verification.d.ts +14 -7
  89. package/dist/src/agent/coding/run-verification.js +28 -6
  90. package/dist/src/agent/context/coordinator.js +1 -1
  91. package/dist/src/agent/context/deep-recall.js +1 -1
  92. package/dist/src/agent/embedded/execution-tool-policy.d.ts +1 -0
  93. package/dist/src/agent/embedded/execution-tool-policy.js +4 -2
  94. package/dist/src/agent/embedded/run-for-session.d.ts +2 -0
  95. package/dist/src/agent/embedded/run-for-session.js +9 -0
  96. package/dist/src/agent/embedded/run-turn.js +63 -14
  97. package/dist/src/agent/embedded/session-runner.js +2 -2
  98. package/dist/src/agent/embedded/types.d.ts +2 -0
  99. package/dist/src/agent/external-tools/gateway-tools.js +8 -1
  100. package/dist/src/agent/inbound/turn-dispatcher.d.ts +1 -0
  101. package/dist/src/agent/inbound/turn-dispatcher.js +1 -0
  102. package/dist/src/agent/mcp/connection-setup.js +46 -42
  103. package/dist/src/agent/mcp/conversation-setup.js +13 -8
  104. package/dist/src/agent/mcp/discovery.d.ts +22 -1
  105. package/dist/src/agent/mcp/discovery.js +19 -3
  106. package/dist/src/agent/mcp/managed-discovery.d.ts +8 -0
  107. package/dist/src/agent/mcp/managed-discovery.js +77 -0
  108. package/dist/src/agent/mcp/tool-catalog.js +1 -1
  109. package/dist/src/agent/prompt/conversational-configuration-guide.js +1 -1
  110. package/dist/src/agent/service/direct-turn-helpers.d.ts +1 -0
  111. package/dist/src/agent/service/direct-turn-helpers.js +17 -2
  112. package/dist/src/agent/service/process-direct-streaming.d.ts +1 -0
  113. package/dist/src/agent/service/process-direct-streaming.js +1 -0
  114. package/dist/src/agent/service.d.ts +1 -1
  115. package/dist/src/agent/skills/marketplace/adapters/store/store-api-client.d.ts +6 -2
  116. package/dist/src/agent/skills/marketplace/adapters/store/store-api-client.js +10 -7
  117. package/dist/src/agent/tasks/task-judge-service.js +1 -0
  118. package/dist/src/agent/tool-manuals/browser.d.ts +1 -1
  119. package/dist/src/agent/tool-manuals/browser.js +3 -1
  120. package/dist/src/agent/tool-manuals/xopc-configuration.d.ts +1 -1
  121. package/dist/src/agent/tool-manuals/xopc-configuration.js +12 -4
  122. package/dist/src/agent/tools/factory.d.ts +1 -1
  123. package/dist/src/agent/tools/factory.js +1 -1
  124. package/dist/src/agent/tools/personal-request-tool.js +36 -4
  125. package/dist/src/agent/tools/personal-task-tool.d.ts +7 -1
  126. package/dist/src/agent/tools/personal-task-tool.js +68 -3
  127. package/dist/src/agent/tools/session-search-tool.js +1 -1
  128. package/dist/src/agent/tools/task-collaboration-tool.d.ts +1 -1
  129. package/dist/src/agent/tools/task-collaboration-tool.js +54 -3
  130. package/dist/src/agent/tools/task-result-tool.js +31 -0
  131. package/dist/src/agent/tools/xopc-use-tool.js +50 -19
  132. package/dist/src/automations/capabilities/write.d.ts +2 -2
  133. package/dist/src/automations/domain/validation.d.ts +4 -4
  134. package/dist/src/automations/draft/automation-draft-validator.d.ts +1 -1
  135. package/dist/src/browser/drivers/browser-driver.d.ts +1 -0
  136. package/dist/src/browser/drivers/create-driver.js +2 -11
  137. package/dist/src/browser/drivers/playwright-driver.d.ts +5 -2
  138. package/dist/src/browser/drivers/playwright-driver.js +83 -38
  139. package/dist/src/browser/runtime/browser-runtime.d.ts +5 -0
  140. package/dist/src/browser/runtime/browser-runtime.js +71 -9
  141. package/dist/src/cli/commands/doctor/checks/database-schema.js +1 -1
  142. package/dist/src/cli/commands/extension-agent-plugin.js +1 -1
  143. package/dist/src/cli/commands/gateway/lifecycle.js +2 -2
  144. package/dist/src/cli/commands/update.js +1 -1
  145. package/dist/src/computer/diagnostics.d.ts +4 -4
  146. package/dist/src/computer/errors.d.ts +4 -4
  147. package/dist/src/computer/evaluation.d.ts +3 -3
  148. package/dist/src/computer/flows.d.ts +1 -1
  149. package/dist/src/computer/runtime.d.ts +3 -3
  150. package/dist/src/config/schema.d.ts +6 -2
  151. package/dist/src/config/schema.js +3 -0
  152. package/dist/src/connectors/connected-source-understanding.js +11 -3
  153. package/dist/src/connectors/connection-recovery-service.js +38 -5
  154. package/dist/src/connectors/excluded-connectors.d.ts +1 -0
  155. package/dist/src/connectors/excluded-connectors.js +5 -1
  156. package/dist/src/connectors/learning-coordinator.js +45 -11
  157. package/dist/src/connectors/plugin-connection.d.ts +10 -0
  158. package/dist/src/connectors/plugin-connection.js +105 -0
  159. package/dist/src/discussions/recording.js +13 -6
  160. package/dist/src/endpoint-tools/device-host.d.ts +2 -2
  161. package/dist/src/extensions/agent-plugins/setup.js +1 -1
  162. package/dist/src/extensions/agent-plugins/skill-catalog.js +1 -1
  163. package/dist/src/gateway/hono/lib/config-payload.d.ts +4 -0
  164. package/dist/src/gateway/hono/middleware/auth.js +1 -1
  165. package/dist/src/gateway/hono/routes/agent-plugins.js +2 -2
  166. package/dist/src/gateway/hono/routes/auth-registry-extensions.js +1 -1
  167. package/dist/src/gateway/hono/routes/connectors.js +1 -1
  168. package/dist/src/gateway/hono/routes/desktop-host.js +1 -1
  169. package/dist/src/gateway/hono/routes/home.js +51 -0
  170. package/dist/src/gateway/hono/routes/imports.js +1 -1
  171. package/dist/src/gateway/hono/routes/personal-agent.js +3 -3
  172. package/dist/src/gateway/hono/routes/projects.js +1 -1
  173. package/dist/src/gateway/hono/routes/session-command-handler.js +15 -1
  174. package/dist/src/gateway/hono/routes/update.js +2 -2
  175. package/dist/src/gateway/hono/routes/user-model.js +1 -1
  176. package/dist/src/gateway/index.js +1 -1
  177. package/dist/src/gateway/run-loop.js +2 -2
  178. package/dist/src/gateway/security/gateway-scopes.js +1 -0
  179. package/dist/src/gateway/service/agent-runner.d.ts +2 -8
  180. package/dist/src/gateway/service/agent-runner.js +2 -1
  181. package/dist/src/gateway/service/config-coordinator.d.ts +5 -1
  182. package/dist/src/gateway/service/run-gateway-agent.d.ts +13 -8
  183. package/dist/src/gateway/service/run-gateway-agent.js +6 -3
  184. package/dist/src/gateway/service/session-input-coordinator.d.ts +4 -0
  185. package/dist/src/gateway/service/session-input-coordinator.js +6 -1
  186. package/dist/src/gateway/service.d.ts +1 -0
  187. package/dist/src/gateway/service.js +19 -12
  188. package/dist/src/home-intelligence/follow-ups.d.ts +36 -0
  189. package/dist/src/home-intelligence/follow-ups.js +496 -0
  190. package/dist/src/home-intelligence/host.d.ts +80 -4
  191. package/dist/src/home-intelligence/host.js +124 -4
  192. package/dist/src/home-intelligence/observation-starters.d.ts +3 -0
  193. package/dist/src/home-intelligence/observation-starters.js +27 -0
  194. package/dist/src/home-intelligence/observation.d.ts +1 -1
  195. package/dist/src/home-intelligence/observation.js +16 -4
  196. package/dist/src/infra/gateway-processes.js +1 -1
  197. package/dist/src/infra/update-restart.js +2 -2
  198. package/dist/src/infra/update-runner.js +2 -2
  199. package/dist/src/infra/update-startup.js +1 -1
  200. package/dist/src/local-apps/automation-proposals.d.ts +4 -4
  201. package/dist/src/local-apps/capabilities/projections.d.ts +38 -38
  202. package/dist/src/memory-learning/choice-observations.d.ts +9 -0
  203. package/dist/src/memory-learning/choice-observations.js +155 -0
  204. package/dist/src/memory-learning/evidence-repair.d.ts +12 -0
  205. package/dist/src/memory-learning/evidence-repair.js +31 -0
  206. package/dist/src/memory-learning/repository.d.ts +1 -0
  207. package/dist/src/memory-learning/repository.js +43 -5
  208. package/dist/src/memory-learning/source-learning.js +52 -7
  209. package/dist/src/memory-learning/task-receipts.js +19 -10
  210. package/dist/src/memory-learning/transcript-source.js +7 -0
  211. package/dist/src/memory-learning/work-candidate.d.ts +14 -0
  212. package/dist/src/memory-learning/work-candidate.js +17 -2
  213. package/dist/src/memory-learning/work-capture.d.ts +1 -0
  214. package/dist/src/memory-learning/work-capture.js +28 -10
  215. package/dist/src/memory-learning/work-review.d.ts +46 -0
  216. package/dist/src/memory-learning/work-review.js +209 -0
  217. package/dist/src/notes/agent-context.js +1 -1
  218. package/dist/src/notifications/service.js +2 -2
  219. package/dist/src/personal-agent/communication.d.ts +1 -1
  220. package/dist/src/personal-agent/communication.js +1 -1
  221. package/dist/src/personal-agent/default-style.d.ts +1 -1
  222. package/dist/src/personal-agent/default-style.js +1 -1
  223. package/dist/src/personal-agent/proactivity/repository.d.ts +1 -1
  224. package/dist/src/personal-agent/prompts.js +4 -4
  225. package/dist/src/personal-agent/reply-composer.d.ts +1 -1
  226. package/dist/src/personal-agent/reply-composer.js +52 -34
  227. package/dist/src/personal-agent/reply-style.d.ts +2 -2
  228. package/dist/src/personal-agent/reply-style.js +3 -2
  229. package/dist/src/personal-agent/request-repository.d.ts +3 -0
  230. package/dist/src/personal-agent/request-service.d.ts +2 -0
  231. package/dist/src/personal-agent/request-service.js +8 -2
  232. package/dist/src/phone/contracts.d.ts +1 -1
  233. package/dist/src/phone/stream-gateway.js +1 -1
  234. package/dist/src/projects/capabilities/write.js +1 -1
  235. package/dist/src/projects/index.js +1 -1
  236. package/dist/src/projects/project-service.js +1 -1
  237. package/dist/src/storage/sqlite/schema.d.ts +2 -2
  238. package/dist/src/storage/sqlite/schema.js +7 -7
  239. package/dist/src/storage/sqlite/schema.sql +22 -0
  240. package/dist/src/storage/sqlite/upgrades/274_home_followups.sql +21 -0
  241. package/dist/src/tasks/capabilities/management.d.ts +3 -3
  242. package/dist/src/tasks/capabilities/relations.d.ts +3 -3
  243. package/dist/src/tasks/capabilities/write.d.ts +4 -4
  244. package/dist/src/tasks/capabilities/write.js +2 -0
  245. package/dist/src/tasks/home-query-service.js +4 -2
  246. package/dist/src/tasks/task-allocation-service.js +10 -2
  247. package/dist/src/tasks/task-application-service.d.ts +4 -0
  248. package/dist/src/tasks/task-application-service.js +6 -1
  249. package/dist/src/tasks/task-context-assembler.js +7 -2
  250. package/dist/src/tasks/task-contract-planner.js +3 -3
  251. package/dist/src/tasks/task-conversation-summary.d.ts +64 -0
  252. package/dist/src/tasks/task-conversation-summary.js +105 -0
  253. package/dist/src/tasks/task-delay-notice.d.ts +4 -0
  254. package/dist/src/tasks/task-delay-notice.js +113 -0
  255. package/dist/src/tasks/task-deletion-service.js +6 -1
  256. package/dist/src/tasks/task-handoff.d.ts +21 -0
  257. package/dist/src/tasks/task-handoff.js +77 -1
  258. package/dist/src/tasks/task-json-acceptance.d.ts +22 -0
  259. package/dist/src/tasks/task-json-acceptance.js +96 -0
  260. package/dist/src/tasks/task-main-update-decision-service.js +17 -21
  261. package/dist/src/tasks/task-main-update-delivery.js +34 -7
  262. package/dist/src/tasks/task-notification-preference.d.ts +16 -0
  263. package/dist/src/tasks/task-notification-preference.js +42 -0
  264. package/dist/src/tasks/task-origin-repository.d.ts +1 -0
  265. package/dist/src/tasks/task-origin-repository.js +3 -0
  266. package/dist/src/tasks/task-read-model-projector.js +1 -1
  267. package/dist/src/tasks/task-repository.js +1 -0
  268. package/dist/src/tasks/task-research-repair.d.ts +19 -1
  269. package/dist/src/tasks/task-research-repair.js +14 -4
  270. package/dist/src/tasks/task-research-result.d.ts +12 -0
  271. package/dist/src/tasks/task-research-result.js +5 -0
  272. package/dist/src/tasks/task-result-delivery-repository.d.ts +4 -1
  273. package/dist/src/tasks/task-result-delivery-repository.js +8 -5
  274. package/dist/src/tasks/task-result-delivery-service.js +9 -1
  275. package/dist/src/tasks/task-run-coordinator.js +45 -10
  276. package/dist/src/tui/tui-management.js +2 -2
  277. package/dist/src/usage/cloud-wire.d.ts +1 -0
  278. package/dist/src/user-context/config.d.ts +8 -0
  279. package/dist/src/user-context/config.js +10 -0
  280. package/dist/src/user-model/capture/evidence-policy.d.ts +2 -0
  281. package/dist/src/user-model/capture/evidence-policy.js +8 -1
  282. package/dist/src/user-model/capture/executor.js +16 -4
  283. package/dist/src/user-model/capture/semantic.d.ts +4 -0
  284. package/dist/src/user-model/capture/semantic.js +3 -0
  285. package/dist/src/user-model/index.js +1 -1
  286. package/dist/src/user-model/observation-repository.d.ts +6 -0
  287. package/dist/src/user-model/observation-repository.js +12 -0
  288. package/dist/src/user-model/repository.js +10 -1
  289. package/dist/src/voice/realtime/agentEngine.js +29 -7
  290. package/dist/src/voice/realtime/pcmPlaybackEcho.d.ts +10 -0
  291. package/dist/src/voice/realtime/pcmPlaybackEcho.js +56 -0
  292. package/dist/src/voice/realtime/playback-echo.d.ts +3 -0
  293. package/dist/src/voice/realtime/playback-echo.js +35 -5
  294. package/dist/src/voice/realtime/runtime.js +6 -1
  295. package/dist/src/voice/realtime/turnPolicy.js +1 -1
  296. package/package.json +14 -8
  297. package/dist/gateway/static/root/assets/agent-plugin-dialog-CikzCYAG.js +0 -1
  298. package/dist/gateway/static/root/assets/capabilities-DB713nRi.js +0 -1
  299. package/dist/gateway/static/root/assets/capabilities-page-D2hq4cgE.js +0 -2
  300. package/dist/gateway/static/root/assets/chat-page-BhPw56Vc.js +0 -71
  301. package/dist/gateway/static/root/assets/constants-DpkUgykJ.js +0 -1
  302. package/dist/gateway/static/root/assets/discussion-annotation-sync-fwPPMPv9.js +0 -1
  303. package/dist/gateway/static/root/assets/home-page-BPPe4JXB.js +0 -7
  304. package/dist/gateway/static/root/assets/index-DjzrnmBA.js +0 -11
  305. package/dist/gateway/static/root/assets/index-YQxumvaS.css +0 -1
  306. package/dist/gateway/static/root/assets/mcp-conversation-setup-page-CsTSmjmX.js +0 -1
  307. package/dist/gateway/static/root/assets/note-detail-panel-BbHlfAju.js +0 -7
  308. package/dist/gateway/static/root/assets/note-image-lightbox-CqK_uJ6Y.js +0 -1
  309. package/dist/gateway/static/root/assets/notes-page-8w2Stfak.js +0 -8
  310. package/dist/gateway/static/root/assets/pcm-capture-worklet-uW_SEACy.js +0 -1
  311. package/dist/gateway/static/root/assets/product-preview-modal-DMHOKocl.js +0 -2
  312. package/dist/gateway/static/root/assets/project-detail-page-CNFuzmRr.js +0 -7
  313. package/dist/gateway/static/root/assets/recording-upload-CyZSl2DJ.js +0 -1
  314. package/dist/gateway/static/root/assets/route-preload-CuxNu-LB.js +0 -2
  315. package/dist/gateway/static/root/assets/routine-panel-CXs4PjW0.js +0 -2
  316. package/dist/gateway/static/root/assets/session-manager-D2LaQymu.js +0 -25
  317. package/dist/gateway/static/root/assets/task-detail-page-_5TEldtl.js +0 -3
  318. package/dist/gateway/static/root/assets/use-realtime-voice-C7iWQuUv.js +0 -1
  319. package/dist/gateway/static/root/assets/workspace-api-LghfbP5g.js +0 -2
@@ -236,6 +236,7 @@
236
236
  "noMatchingModels": {"message": "No matching models"},
237
237
  "commandsAndSkills": {"message": "Commands and skills"},
238
238
  "loadingCommands": {"message": "Loading commands"},
239
+ "commandsLoadFailed": {"message": "Could not load commands and skills. Close and reopen the menu to retry."},
239
240
  "noMatchingCommands": {"message": "No matching commands or skills"},
240
241
  "skillUnavailable": {"message": "Unavailable for this agent"},
241
242
  "voiceInput": {"message": "Voice input"},
@@ -236,6 +236,7 @@
236
236
  "noMatchingModels": {"message": "没有匹配的模型"},
237
237
  "commandsAndSkills": {"message": "命令与技能"},
238
238
  "loadingCommands": {"message": "正在加载命令"},
239
+ "commandsLoadFailed": {"message": "无法加载命令和技能,请关闭菜单后重试。"},
239
240
  "noMatchingCommands": {"message": "没有匹配的命令或技能"},
240
241
  "skillUnavailable": {"message": "当前 Agent 不可用"},
241
242
  "voiceInput": {"message": "语音输入"},
@@ -8279,6 +8279,37 @@ function wait(milliseconds) {
8279
8279
  return new Promise((resolve) => setTimeout(resolve, milliseconds));
8280
8280
  }
8281
8281
  async function pairGateway(invitation, onApproval, requestedOrigin) {
8282
+ const originalProfile = await readProfile();
8283
+ return withPairingLock(async () => {
8284
+ const current = await readProfile();
8285
+ if (!originalProfile && current?.gatewayId === parseBrowserPairingInvitation(invitation, true).gatewayId) return current;
8286
+ return completeGatewayPairing(invitation, onApproval, requestedOrigin);
8287
+ });
8288
+ }
8289
+ function withPairingLock(operation) {
8290
+ const locks = globalThis.navigator?.locks;
8291
+ if (!locks) return operation();
8292
+ return new Promise((resolve, reject) => {
8293
+ void locks.request("xopc.browser.pairing", () => operation().then(resolve, reject)).catch(reject);
8294
+ });
8295
+ }
8296
+ async function autoConnectLocalGateway() {
8297
+ return withPairingLock(async () => {
8298
+ const profile = await readProfile();
8299
+ if (profile) return profile;
8300
+ if (!await isAutoConnectEnabled()) return void 0;
8301
+ const pending = await readPendingBrowserPairing();
8302
+ if (pending) {
8303
+ const payload = parseBrowserPairingInvitation(pending.invitation, true);
8304
+ if (pending.nextOrigin || !payload.routes.every((route) => route.kind === "local-browser")) return void 0;
8305
+ return completeGatewayPairing(pending.invitation, () => void 0);
8306
+ }
8307
+ const local = await discoverLocalGateway();
8308
+ if (!local) return void 0;
8309
+ return completeGatewayPairing(local.invitation, () => void 0, new URL(local.gatewayUrl).origin);
8310
+ });
8311
+ }
8312
+ async function completeGatewayPairing(invitation, onApproval, requestedOrigin) {
8282
8313
  const payload = parseBrowserPairingInvitation(invitation, true);
8283
8314
  const origins = [...new Set(payload.routes.map((route) => new URL(route.url).origin))];
8284
8315
  const selectedOrigin = requestedOrigin && origins.includes(requestedOrigin) ? requestedOrigin : origins[0];
@@ -8613,4 +8644,4 @@ async function revokeAndForgetProfile() {
8613
8644
  }
8614
8645
  }
8615
8646
 
8616
- export { providerCatalogSchema as A, providerEndpointDescriptor as B, readPendingBrowserPairing as C, readProfile as D, ENDPOINT_PROTOCOL_VERSION as E, record as F, registerBrowserEndpoint as G, revokeAndForgetProfile as H, runWithTabSiteAccess as I, saveExtensionLocalePreference as J, setAutoConnectEnabled as K, strictObject as L, MAX_BROWSER_CONTEXTS_PER_TURN as M, string as N, t as O, PENDING_CONTEXT_KEY as P, union as Q, REALTIME_PROTOCOL_VERSION as R, unknown as S, TAB_BINDING_PREFIX as T, _enum as _, RealtimeClient as a, activeTabId as b, array as c, assertProviderSchemaBudget as d, boolean as e, browserPageContextsInputSchema as f, cancelPendingBrowserPairing as g, canonicalJson as h, capabilityProviderSchema as i, captureContextMenuSelection as j, captureTabWithPermission as k, createBrowserEndpointHello as l, createBrowserRequestProof as m, currentTabDescriptor as n, discoverLocalGateway as o, discriminatedUnion as p, endpointToolContentSchema as q, extensionLocale as r, gatewayFetch as s, getAccessProfile as t, literal as u, loadExtensionLocalePreference as v, number as w, object as x, openDatabase as y, pairGateway as z };
8647
+ export { openDatabase as A, pairGateway as B, providerCatalogSchema as C, providerEndpointDescriptor as D, ENDPOINT_PROTOCOL_VERSION as E, readPendingBrowserPairing as F, readProfile as G, record as H, registerBrowserEndpoint as I, revokeAndForgetProfile as J, runWithTabSiteAccess as K, saveExtensionLocalePreference as L, MAX_BROWSER_CONTEXTS_PER_TURN as M, setAutoConnectEnabled as N, strictObject as O, PENDING_CONTEXT_KEY as P, string as Q, REALTIME_PROTOCOL_VERSION as R, t as S, TAB_BINDING_PREFIX as T, union as U, unknown as V, _enum as _, RealtimeClient as a, activeTabId as b, array as c, assertProviderSchemaBudget as d, autoConnectLocalGateway as e, boolean as f, browserPageContextsInputSchema as g, cancelPendingBrowserPairing as h, canonicalJson as i, capabilityProviderSchema as j, captureContextMenuSelection as k, captureTabWithPermission as l, createBrowserEndpointHello as m, createBrowserRequestProof as n, currentTabDescriptor as o, discoverLocalGateway as p, discriminatedUnion as q, endpointToolContentSchema as r, extensionLocale as s, gatewayFetch as t, getAccessProfile as u, isAutoConnectEnabled as v, literal as w, loadExtensionLocalePreference as x, number as y, object as z };
@@ -3,10 +3,12 @@
3
3
 
4
4
  const WORKLET_NAME = "xopc-pcm-capture";
5
5
  class XopcPcmCaptureProcessor extends AudioWorkletProcessor {
6
- buffer = new Float32Array(2048);
6
+ buffer;
7
7
  offset = 0;
8
- constructor() {
8
+ constructor(options) {
9
9
  super();
10
+ const frameSamples = options?.processorOptions?.frameSamples;
11
+ this.buffer = new Float32Array(frameSamples && Number.isInteger(frameSamples) && frameSamples > 0 && frameSamples <= 4096 ? frameSamples : 2048);
10
12
  this.port.onmessage = (event) => {
11
13
  if (event.data === "flush") {
12
14
  this.flush();
@@ -1,4 +1,4 @@
1
- import { w as number, N as string, L as strictObject, e as boolean, c as array, _ as _enum, u as literal, i as capabilityProviderSchema, B as providerEndpointDescriptor, d as assertProviderSchemaBudget, A as providerCatalogSchema, q as endpointToolContentSchema, E as ENDPOINT_PROTOCOL_VERSION, h as canonicalJson, T as TAB_BINDING_PREFIX, j as captureContextMenuSelection, P as PENDING_CONTEXT_KEY, O as t, D as readProfile, s as gatewayFetch, G as registerBrowserEndpoint, t as getAccessProfile, a as RealtimeClient, l as createBrowserEndpointHello, R as REALTIME_PROTOCOL_VERSION, m as createBrowserRequestProof } from './assets/auth-CQmxIyWw.js';
1
+ import { y as number, Q as string, O as strictObject, f as boolean, c as array, _ as _enum, w as literal, j as capabilityProviderSchema, D as providerEndpointDescriptor, d as assertProviderSchemaBudget, C as providerCatalogSchema, r as endpointToolContentSchema, E as ENDPOINT_PROTOCOL_VERSION, i as canonicalJson, T as TAB_BINDING_PREFIX, k as captureContextMenuSelection, P as PENDING_CONTEXT_KEY, S as t, t as gatewayFetch, G as readProfile, v as isAutoConnectEnabled, e as autoConnectLocalGateway, I as registerBrowserEndpoint, u as getAccessProfile, a as RealtimeClient, m as createBrowserEndpointHello, R as REALTIME_PROTOCOL_VERSION, n as createBrowserRequestProof } from './assets/auth-YPMDpWOW.js';
2
2
 
3
3
  async function browserDom(input) {
4
4
  const root = globalThis;
@@ -1725,7 +1725,7 @@ function fitBrowserControlResultToFrame(result, maxBytes = MAX_BROWSER_CONTROL_R
1725
1725
  const log = createLogger("Background");
1726
1726
  const BACKGROUND_CLIENT_ID_KEY = "xopc.browser.background-client-id";
1727
1727
  const RECONNECT_ALARM = "xopc.browser.reconnect";
1728
- const RECONNECT_DELAY_MINUTES = 1;
1728
+ const RECONNECT_DELAY_MINUTES = 0.5;
1729
1729
  let realtime;
1730
1730
  let endpointClaim;
1731
1731
  let lastConnectionError;
@@ -1753,8 +1753,13 @@ function clearReconnectAlarm() {
1753
1753
  void chrome.alarms.clear(RECONNECT_ALARM);
1754
1754
  }
1755
1755
  function scheduleReconnectAlarm() {
1756
- if (endpointClaim) return;
1757
- chrome.alarms.create(RECONNECT_ALARM, { delayInMinutes: RECONNECT_DELAY_MINUTES });
1756
+ void chrome.alarms.get(RECONNECT_ALARM).then((alarm) => {
1757
+ if (alarm?.periodInMinutes === RECONNECT_DELAY_MINUTES) return;
1758
+ return chrome.alarms.create(RECONNECT_ALARM, {
1759
+ delayInMinutes: RECONNECT_DELAY_MINUTES,
1760
+ periodInMinutes: RECONNECT_DELAY_MINUTES
1761
+ });
1762
+ }).catch((error) => log.warn("Could not schedule browser reconnect", { error: String(error) }));
1758
1763
  }
1759
1764
  const browserToolRegistry = new EndpointToolRegistry([{
1760
1765
  descriptor: BROWSER_CONTROL_ENDPOINT_DESCRIPTOR,
@@ -1789,7 +1794,14 @@ async function backgroundClientId() {
1789
1794
  return value;
1790
1795
  }
1791
1796
  async function connect(generation) {
1792
- if (realtime || !await readProfile()) return;
1797
+ if (realtime) return;
1798
+ if (await readProfile() || await isAutoConnectEnabled()) scheduleReconnectAlarm();
1799
+ else {
1800
+ clearReconnectAlarm();
1801
+ return;
1802
+ }
1803
+ if (!await autoConnectLocalGateway()) return;
1804
+ if (generation !== connectionGeneration) return;
1793
1805
  await registerBrowserEndpoint();
1794
1806
  const profile = await getAccessProfile();
1795
1807
  const compatibility = await gatewayFetch("/api/endpoint-tools/compatibility", {}, profile);
@@ -1838,7 +1850,6 @@ async function connect(generation) {
1838
1850
  endpointClaim = { endpointId, token: turnToken };
1839
1851
  if (environmentSupported) contextPublisher.start(endpointClaim);
1840
1852
  lastConnectionError = void 0;
1841
- clearReconnectAlarm();
1842
1853
  endpointHost.connect((message) => client.sendEndpointMessage(message));
1843
1854
  void chrome.runtime.sendMessage({ type: "browser/endpoint-ready", claim: endpointClaim }).catch(() => void 0);
1844
1855
  log.info("Browser control connected through Gateway Realtime", { endpointId });
@@ -1935,25 +1946,19 @@ chrome.runtime.onInstalled.addListener(() => {
1935
1946
  chrome.runtime.onStartup.addListener(connectWithLogging);
1936
1947
  chrome.alarms.onAlarm.addListener((alarm) => {
1937
1948
  if (alarm.name !== RECONNECT_ALARM) return;
1938
- void readProfile().then((profile) => {
1939
- if (!profile) {
1940
- clearReconnectAlarm();
1941
- return;
1942
- }
1943
- if (endpointClaim) {
1944
- clearReconnectAlarm();
1945
- return;
1946
- }
1947
- disconnect();
1948
- connectWithLogging();
1949
- });
1949
+ if (endpointClaim || connectTask) return;
1950
+ disconnect();
1951
+ connectWithLogging();
1950
1952
  });
1951
1953
  chrome.storage.onChanged.addListener((changes, area) => {
1952
1954
  if (area === "local" && changes["xopc.browser.profile"]) {
1955
+ const { oldValue, newValue } = changes["xopc.browser.profile"];
1956
+ if (oldValue && newValue && oldValue.gatewayId === newValue.gatewayId && oldValue.deviceId === newValue.deviceId && oldValue.gatewayPublicKey === newValue.gatewayPublicKey && oldValue.gatewayUrl === newValue.gatewayUrl) return;
1953
1957
  disconnect();
1954
- if (changes["xopc.browser.profile"].newValue) connectWithLogging();
1958
+ if (newValue) connectWithLogging();
1955
1959
  else clearReconnectAlarm();
1956
1960
  }
1961
+ if (area === "local" && changes["xopc.browser.auto-connect"]) connectWithLogging();
1957
1962
  });
1958
1963
  void chrome.sidePanel.setPanelBehavior({ openPanelOnActionClick: true });
1959
1964
  connectWithLogging();
@@ -5,7 +5,7 @@
5
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
6
  <title>xopc</title>
7
7
  <script type="module" crossorigin src="./sidepanel.js"></script>
8
- <link rel="modulepreload" crossorigin href="./assets/auth-CQmxIyWw.js">
8
+ <link rel="modulepreload" crossorigin href="./assets/auth-YPMDpWOW.js">
9
9
  <link rel="stylesheet" crossorigin href="./assets/sidepanel-lpBGVKwZ.css">
10
10
  </head>
11
11
  <body>
@@ -1,4 +1,4 @@
1
- import { L as strictObject, c as array, Q as union, u as literal, N as string, p as discriminatedUnion, w as number, e as boolean, _ as _enum, x as object, f as browserPageContextsInputSchema, F as record$1, S as unknown, O as t, M as MAX_BROWSER_CONTEXTS_PER_TURN, s as gatewayFetch, r as extensionLocale, y as openDatabase, a as RealtimeClient, R as REALTIME_PROTOCOL_VERSION, b as activeTabId, n as currentTabDescriptor, T as TAB_BINDING_PREFIX, t as getAccessProfile, D as readProfile, I as runWithTabSiteAccess, P as PENDING_CONTEXT_KEY, k as captureTabWithPermission, z as pairGateway, K as setAutoConnectEnabled, C as readPendingBrowserPairing, o as discoverLocalGateway, J as saveExtensionLocalePreference, H as revokeAndForgetProfile, g as cancelPendingBrowserPairing, v as loadExtensionLocalePreference } from './assets/auth-CQmxIyWw.js';
1
+ import { O as strictObject, c as array, U as union, w as literal, Q as string, q as discriminatedUnion, y as number, f as boolean, _ as _enum, z as object, g as browserPageContextsInputSchema, H as record$1, V as unknown, S as t, M as MAX_BROWSER_CONTEXTS_PER_TURN, t as gatewayFetch, s as extensionLocale, A as openDatabase, a as RealtimeClient, R as REALTIME_PROTOCOL_VERSION, b as activeTabId, o as currentTabDescriptor, T as TAB_BINDING_PREFIX, u as getAccessProfile, G as readProfile, K as runWithTabSiteAccess, P as PENDING_CONTEXT_KEY, l as captureTabWithPermission, B as pairGateway, N as setAutoConnectEnabled, F as readPendingBrowserPairing, p as discoverLocalGateway, L as saveExtensionLocalePreference, J as revokeAndForgetProfile, h as cancelPendingBrowserPairing, x as loadExtensionLocalePreference } from './assets/auth-YPMDpWOW.js';
2
2
 
3
3
  const id = string().regex(/^[A-Za-z0-9_-]{1,64}$/);
4
4
  const choice = strictObject({ id, label: string().trim().min(1).max(120), description: string().max(500).optional() });
@@ -17791,7 +17791,7 @@ function ModelControls({ models, config, disabled, onModel, onThinking }) {
17791
17791
  ] });
17792
17792
  }
17793
17793
 
17794
- const pcmCaptureWorkletUrl = ""+new URL('assets/pcm-capture-worklet-CGN9Mlhg.js', import.meta.url).href+"";
17794
+ const pcmCaptureWorkletUrl = ""+new URL('assets/pcm-capture-worklet-Df5TcFw4.js', import.meta.url).href+"";
17795
17795
 
17796
17796
  const TARGET_SAMPLE_RATE = 16e3;
17797
17797
  function calculateRmsLevel(samples) {
@@ -17909,7 +17909,8 @@ class PcmFrameCapture {
17909
17909
  try {
17910
17910
  await Promise.race([context.audioWorklet.addModule(pcmCaptureWorkletUrl), deadline]);
17911
17911
  const source = context.createMediaStreamSource(stream);
17912
- const node = new AudioWorkletNode(context, WORKLET_NAME);
17912
+ const frameSamples = options.frameDurationMs === void 0 ? void 0 : Math.round(context.sampleRate * options.frameDurationMs / 1e3);
17913
+ const node = new AudioWorkletNode(context, WORKLET_NAME, { processorOptions: { frameSamples } });
17913
17914
  const mutedOutput = context.createGain();
17914
17915
  mutedOutput.gain.value = 0;
17915
17916
  capture = new PcmFrameCapture(context, source, node, mutedOutput, options);
@@ -45217,6 +45218,7 @@ function ChatPanel({ gatewayId, deviceId }) {
45217
45218
  const [commandsOpen, setCommandsOpen] = reactExports.useState(false);
45218
45219
  const [commands, setCommands] = reactExports.useState([]);
45219
45220
  const [commandsLoading, setCommandsLoading] = reactExports.useState(false);
45221
+ const [commandsFailed, setCommandsFailed] = reactExports.useState(false);
45220
45222
  const [commandIndex, setCommandIndex] = reactExports.useState(0);
45221
45223
  const commandRange = commandsOpen ? findCommand(draft, cursor) : void 0;
45222
45224
  const commandItems = commandRange ? commands.filter((item) => matchesCommandQuery(item, commandRange.query)).slice(0, 12) : [];
@@ -45403,14 +45405,13 @@ function ChatPanel({ gatewayId, deviceId }) {
45403
45405
  reactExports.useEffect(() => {
45404
45406
  if (!commandsOpen) return;
45405
45407
  let active = true;
45408
+ setCommands([]);
45406
45409
  setCommandsLoading(true);
45410
+ setCommandsFailed(false);
45407
45411
  void loadComposerCommands(snapshot.conversationId).then((items) => {
45408
45412
  if (active) setCommands(items);
45409
- }).catch((cause) => {
45410
- if (active) {
45411
- setCommands([]);
45412
- setError(String(cause));
45413
- }
45413
+ }).catch(() => {
45414
+ if (active) setCommandsFailed(true);
45414
45415
  }).finally(() => {
45415
45416
  if (active) setCommandsLoading(false);
45416
45417
  });
@@ -45947,7 +45948,7 @@ ${pageContext.context.selection ?? pageContext.context.text ?? ""}` }), children
45947
45948
  item.disabled ? ` · ${t("skillUnavailable")}` : ""
45948
45949
  ] })
45949
45950
  ] }, item.id)),
45950
- !commandsLoading && !commandItems.length ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "tab-mention-empty", children: t("noMatchingCommands") }) : null
45951
+ !commandsLoading && !commandItems.length ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "tab-mention-empty", children: t(commandsFailed ? "commandsLoadFailed" : "noMatchingCommands") }) : null
45951
45952
  ] }) : null,
45952
45953
  /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "composer-input-row", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
45953
45954
  "textarea",
@@ -3,7 +3,7 @@
3
3
  "minimum_chrome_version": "120",
4
4
  "default_locale": "en",
5
5
  "name": "__MSG_appName__",
6
- "version": "0.0.460",
6
+ "version": "0.0.463",
7
7
  "description": "__MSG_appDescription__",
8
8
  "key": "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAqnpr4vpLC/nmvy+wiOWk3SWlp2nEZkFijfk8ivGw7StNZgCK90nOMvwhdEtlkk3GOWDvdVnq8HxCsM3UNQ8FnGUyerpH1FJXqXuradxeHf8ZxFjiQU/mIWfnKbUuONWQORon3/pigyoXoK/VUXgg0Wbm/rbVwsS0bv+25R6m+mZgBspOLeKuoH7ivhL+48WV6POtMBsFPZweY26477EM7ukh+56Ff5ENevB8ymxBBn7qK5ZoeZd2a23U8ioX5TsHfe6fnrjitPWjIxD8G0NoKQxcaa/Mo+xs+T6UiLKxP0wjz5bm7jB5H+CXtkRJqzBWUB0h+RSLJckzZfA8BAJrRwIDAQAB",
9
9
  "permissions": [
@@ -2,7 +2,7 @@
2
2
  "id": "telegram",
3
3
  "name": "Telegram Channel",
4
4
  "description": "Bundled Telegram Bot channel (private workspace sources; ships inside @xopcai/xopc dist/)",
5
- "version": "0.0.460",
5
+ "version": "0.0.463",
6
6
  "kind": "channel",
7
7
  "main": "src/index.js",
8
8
  "channels": [
@@ -0,0 +1 @@
1
+ import{i as e,n as t}from"./rolldown-runtime-aKtaBQYM.js";import{a as n,n as r,t as i}from"./vendor-react-BOUWij0V.js";import{l as a,t as o,u as s}from"./chunk-KS7C4IRE-CiwuuyV8.js";import{i as c,n as l,o as u}from"./locale-store-Dy1EByeG.js";import{t as d}from"./messages-BAnhwALN.js";import{a as f,i as p,o as m,r as h,s as g,t as ee}from"./dist-CY7CS_D3.js";import{t as _}from"./arrow-left-D880xG-P.js";import{t as v}from"./chevron-down-ccbiQQz_.js";import{t as y}from"./working-directory-picker-modal-BGZduAXV.js";import{t as te}from"./circle-alert-BEjgurr2.js";import{t as ne}from"./circle-check-C23XjkUj.js";import{t as re}from"./circle-BoO4YvTx.js";import{t as b}from"./file-archive-DanfQJNe.js";import{t as x}from"./folder-open-CyzJ19I9.js";import{t as ie}from"./loader-circle-CifKLtgG.js";import{t as S}from"./package-wATCyihJ.js";import{t as C}from"./shield-check-BU58siTV.js";import{t as w}from"./upload-rrb46c3c.js";import{t as T}from"./cn-0WouolD0.js";import{t as ae}from"./skeleton-DzdOeGYz.js";import{a as E}from"./vendor-swr-CdRzEUwF.js";import{t as D}from"./button-Cc4hUNTt.js";import{t as O}from"./capability-links-MZdYfPKx.js";import{t as oe}from"./browser-BLJWD7WI.js";import{t as k}from"./capability-icon-CmvCZOJX.js";var A=r(),j=i();function se(e){let t=(0,A.c)(30),{data:n,zh:r}=e,i=r?`插件内容与范围`:`Contents and access`,a;t[0]===i?a=t[1]:(a=(0,j.jsx)(`h4`,{className:`font-medium text-fg`,children:i}),t[0]=i,t[1]=a);let o=r?`新增技能:`:`Skills: `,s;t[2]!==n.latestVersion.componentIndex?.skills||t[3]!==r?(s=n.latestVersion.componentIndex?.skills.join(`, `)||(r?`目录未提供清单`:`Not listed in catalog`),t[2]=n.latestVersion.componentIndex?.skills,t[3]=r,t[4]=s):s=t[4];let c;t[5]!==o||t[6]!==s?(c=(0,j.jsxs)(`p`,{children:[o,s]}),t[5]=o,t[6]=s,t[7]=c):c=t[7];let l=r?`工具连接:`:`Tool connections: `,u;t[8]!==n.latestVersion.componentIndex?.mcpServers||t[9]!==r?(u=n.latestVersion.componentIndex?.mcpServers.map(M).join(`, `)||(r?`目录未提供清单`:`Not listed in catalog`),t[8]=n.latestVersion.componentIndex?.mcpServers,t[9]=r,t[10]=u):u=t[10];let d;t[11]!==l||t[12]!==u?(d=(0,j.jsxs)(`p`,{children:[l,u]}),t[11]=l,t[12]=u,t[13]=d):d=t[13];let f=r?`运行范围:`:`Runtime scope: `,p=n.latestVersion.riskTier===`local-exec`?r?`包含本机代码执行,可能访问本机文件或网络`:`Includes local code execution; may access local files or networks`:n.latestVersion.riskTier===`network`?r?`包含网络服务调用;数据范围取决于账号授权`:`Includes network service calls; data scope depends on authorization`:n.latestVersion.riskTier===`content`?r?`目录标记为内容能力`:`Catalog classifies this as content capabilities`:r?`目录未声明,请查看说明与来源`:`Not declared; review documentation and source`,m;t[14]!==p||t[15]!==f?(m=(0,j.jsxs)(`p`,{children:[f,p]}),t[14]=p,t[15]=f,t[16]=m):m=t[16];let h=r?`授权与来源`:`Authorization and source`,g;t[17]===h?g=t[18]:(g=(0,j.jsx)(`summary`,{className:`w-fit cursor-pointer rounded focus-visible:outline-accent`,children:h}),t[17]=h,t[18]=g);let ee=r?`发布者认证只验证来源,不授予操作权限。账号授权与依赖需另行设置。未列出权限不代表没有文件或外部访问。`:`Publisher verification does not grant permissions. Accounts and dependencies require separate setup. Missing scope metadata does not mean no file or external access.`,_;t[19]===ee?_=t[20]:(_=(0,j.jsx)(`p`,{className:`mt-2 leading-5`,children:ee}),t[19]=ee,t[20]=_);let v;t[21]!==g||t[22]!==_?(v=(0,j.jsxs)(`details`,{className:`text-xs`,children:[g,_]}),t[21]=g,t[22]=_,t[23]=v):v=t[23];let y;return t[24]!==m||t[25]!==v||t[26]!==a||t[27]!==c||t[28]!==d?(y=(0,j.jsxs)(`section`,{className:`mt-4 space-y-2 rounded-lg border border-edge p-4 text-sm text-fg-muted`,children:[a,c,d,m,v]}),t[24]=m,t[25]=v,t[26]=a,t[27]=c,t[28]=d,t[29]=y):y=t[29],y}function M(e){return`${e.name} (${e.transport})`}var N=e(oe(),1),P=e(n(),1);function F(e){let t=(0,A.c)(6),{fields:n,values:r,onChange:i}=e,a;t[0]===n?a=t[1]:(a=Object.entries(n),t[0]=n,t[1]=a);let o;return t[2]!==i||t[3]!==a||t[4]!==r?(o=(0,j.jsx)(j.Fragment,{children:a.map(e=>{let[t,n]=e;return(0,j.jsxs)(`label`,{className:`block space-y-1.5 text-sm`,children:[(0,j.jsxs)(`span`,{children:[n.title,n.required?` *`:``]}),n.type===`boolean`?(0,j.jsx)(`input`,{type:`checkbox`,checked:r[t]===!0,onChange:e=>i({...r,[t]:e.target.checked})}):(0,j.jsx)(`input`,{className:`w-full rounded-lg border border-edge bg-surface-inset px-3 py-2.5`,type:n.sensitive?`password`:n.type===`number`?`number`:`text`,required:n.required,autoComplete:`off`,value:String(r[t]??``),onChange:e=>i({...r,[t]:n.type===`number`?Number(e.target.value):e.target.value})})]},t)})}),t[2]=i,t[3]=a,t[4]=r,t[5]=o):o=t[5],o}function I(e){let t=(0,A.c)(62),{account:n,fields:r,zh:i,busy:a,attempt:o,initialMethod:s,onBack:c,onConnect:l,onSave:u,onRedirect:d,onSkip:f}=e,[p,m]=(0,P.useState)(s&&n.methods.some(e=>e.id===s)?s:n.methods[0]?.id??``),h;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(h={},t[0]=h):h=t[0];let[g,ee]=(0,P.useState)(h),[v,y]=(0,P.useState)(``),[te,ne]=(0,P.useState)(),re;t[1]===p?re=t[2]:(re=e=>e.id===p,t[1]=p,t[2]=re);let b=n.methods.find(re),x;t[3]===i?x=t[4]:(x=(e,t)=>i?e:t,t[3]=i,t[4]=x);let S=x,C=o?.challenge?.type===`qr`?o.challenge.url:void 0,w,T;t[5]===C?(w=t[6],T=t[7]):(w=()=>{let e=!1;return ne(void 0),C&&N.toDataURL(C,{width:240,margin:2}).then(t=>{e||ne(t)}).catch(R),()=>{e=!0}},T=[C],t[5]=C,t[6]=w,t[7]=T),(0,P.useEffect)(w,T);let E;t[8]===o?E=t[9]:(E=o&&![`cancelled`,`error`,`connected`].includes(o.state),t[8]=o,t[9]=E);let O=E,oe=o?.authorizationUrl??o?.challenge?.url,k=`连接 ${n.title}`,se=`Connect ${n.title}`,M;t[10]!==S||t[11]!==k||t[12]!==se?(M=S(k,se),t[10]=S,t[11]=k,t[12]=se,t[13]=M):M=t[13];let I;t[14]===S?I=t[15]:(I=S(`返回插件详情`,`Back to plugin details`),t[14]=S,t[15]=I);let z;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(z=(0,j.jsx)(_,{className:`size-4`}),t[16]=z):z=t[16];let B;t[17]!==c||t[18]!==I?(B=(0,j.jsx)(D,{variant:`ghost`,className:`shrink-0`,onClick:c,"aria-label":I,children:z}),t[17]=c,t[18]=I,t[19]=B):B=t[19];let V;t[20]===S?V=t[21]:(V=S(`连接 `,`Connect `),t[20]=S,t[21]=V);let H;t[22]!==n.title||t[23]!==V?(H=(0,j.jsxs)(`h3`,{className:`text-base font-semibold`,children:[V,n.title]}),t[22]=n.title,t[23]=V,t[24]=H):H=t[24];let U;t[25]!==n.description||t[26]!==S?(U=n.description??S(`完成授权后自动检查连接。也可以稍后在详情页继续。`,`The connection is checked after authorization. You can also continue later in plugin details.`),t[25]=n.description,t[26]=S,t[27]=U):U=t[27];let W;t[28]===U?W=t[29]:(W=(0,j.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:U}),t[28]=U,t[29]=W);let G;t[30]!==H||t[31]!==W?(G=(0,j.jsxs)(`div`,{children:[H,W]}),t[30]=H,t[31]=W,t[32]=G):G=t[32];let K;t[33]!==B||t[34]!==G?(K=(0,j.jsxs)(`div`,{className:`flex items-start gap-3`,children:[B,G]}),t[33]=B,t[34]=G,t[35]=K):K=t[35];let q;t[36]!==n.methods||t[37]!==O||t[38]!==a||t[39]!==p||t[40]!==S?(q=n.methods.length>1?(0,j.jsx)(`div`,{role:`tablist`,"aria-label":S(`授权方式`,`Authorization methods`),className:`flex flex-wrap gap-2 rounded-lg bg-surface-inset p-1.5`,children:n.methods.map(e=>(0,j.jsx)(`button`,{role:`tab`,type:`button`,"aria-selected":p===e.id,className:`min-h-10 rounded-md px-3 text-sm ${p===e.id?`bg-surface-panel font-medium text-fg`:`text-fg-muted`}`,disabled:a||!!O,onClick:()=>{m(e.id),ee({})},children:e.title},e.id))}):null,t[36]=n.methods,t[37]=O,t[38]=a,t[39]=p,t[40]=S,t[41]=q):q=t[41];let ce=b?.instructions?.length||b?.helpUrl?(0,j.jsxs)(`div`,{className:`space-y-3 rounded-lg border border-edge bg-surface-inset p-4 text-sm text-fg-muted`,children:[b.instructions?.length?(0,j.jsx)(`ol`,{className:`list-decimal space-y-2 pl-5`,children:b.instructions.map(L)}):null,b.helpUrl?(0,j.jsx)(`a`,{className:`text-accent underline`,href:b.helpUrl,target:`_blank`,rel:`noopener noreferrer`,children:S(`打开官方配置说明`,`Open setup instructions`)}):null]}):null,J=(b?.type===`form`||b?.fields?.length)&&!O?(0,j.jsxs)(`form`,{className:`space-y-4`,onSubmit:e=>{e.preventDefault(),u(b.id,g)},children:[(0,j.jsx)(F,{fields:Object.fromEntries((b.fields??[]).filter(e=>r[e]).map(e=>[e,{...r[e],required:!0}])),values:g,onChange:ee}),(0,j.jsxs)(D,{type:`submit`,disabled:a||!b.fields?.every(e=>g[e]!==void 0&&g[e]!==``),children:[a?(0,j.jsx)(ie,{className:`size-4 animate-spin`,"aria-hidden":!0}):null,S(`保存并连接`,`Save and connect`)]})]}):(0,j.jsxs)(`div`,{className:`space-y-4`,children:[O?null:(0,j.jsx)(D,{disabled:a,onClick:()=>l(p),children:S(`连接账号`,`Connect account`)}),O?(0,j.jsx)(`p`,{role:`status`,className:`text-sm text-fg-muted`,children:o.challenge?.message??(o.state===`preparing`?S(`正在准备登录…`,`Preparing sign-in…`):S(`请完成登录,返回后会自动继续。`,`Finish signing in. Installation continues automatically.`))}):null,C&&O?te?(0,j.jsx)(`img`,{src:te,alt:S(`使用 ${n.title} 扫码授权`,`Scan to authorize ${n.title}`),className:`mx-auto size-60 max-w-full rounded-lg`}):(0,j.jsx)(ae,{className:`mx-auto size-60`}):null,oe&&O?(0,j.jsx)(`a`,{href:oe,target:`_blank`,rel:`noopener noreferrer`,className:`inline-block text-sm text-accent underline`,children:C?S(`也可以打开授权页面`,`Or open the authorization page`):S(`打开登录页面`,`Open sign-in page`)}):null,o?.expiresAt&&O?(0,j.jsxs)(`p`,{className:`text-center text-xs text-fg-muted`,children:[S(`本次授权有效期至 `,`This sign-in expires at `),new Date(o.expiresAt).toLocaleTimeString()]}):null,o?.error?(0,j.jsx)(`p`,{role:`alert`,className:`text-sm text-fg-muted`,children:o.error}):null,o?.acceptsRedirect&&O?(0,j.jsxs)(`details`,{className:`text-sm`,children:[(0,j.jsx)(`summary`,{className:`cursor-pointer text-fg-muted`,children:S(`登录后没有自动返回?`,`Did sign-in not return automatically?`)}),(0,j.jsxs)(`form`,{className:`mt-3 space-y-3`,onSubmit:e=>{e.preventDefault(),d(v)},children:[(0,j.jsxs)(`label`,{children:[S(`登录回调地址`,`Sign-in callback URL`),(0,j.jsx)(`input`,{value:v,onChange:e=>y(e.target.value),className:`mt-1 w-full rounded-lg border border-edge bg-surface-inset p-2`})]}),(0,j.jsx)(D,{type:`submit`,disabled:a||!v,children:S(`继续登录`,`Continue sign-in`)})]})]}):null]}),Y;t[42]===S?Y=t[43]:(Y=S(`暂时跳过`,`Skip for now`),t[42]=S,t[43]=Y);let X;t[44]!==a||t[45]!==f||t[46]!==Y?(X=(0,j.jsx)(D,{variant:`secondary`,disabled:a,onClick:f,children:Y}),t[44]=a,t[45]=f,t[46]=Y,t[47]=X):X=t[47];let Z;t[48]===S?Z=t[49]:(Z=S(`相关功能暂不可用,可随时在插件详情中授权。`,`Features requiring this account stay unavailable. Connect later in plugin details.`),t[48]=S,t[49]=Z);let le;t[50]===Z?le=t[51]:(le=(0,j.jsx)(`p`,{className:`mt-2 text-xs text-fg-muted`,children:Z}),t[50]=Z,t[51]=le);let Q;t[52]!==X||t[53]!==le?(Q=(0,j.jsxs)(`div`,{className:`border-t border-edge pt-4`,children:[X,le]}),t[52]=X,t[53]=le,t[54]=Q):Q=t[54];let ue;return t[55]!==M||t[56]!==K||t[57]!==q||t[58]!==ce||t[59]!==J||t[60]!==Q?(ue=(0,j.jsxs)(`section`,{className:`space-y-5`,"aria-label":M,children:[K,q,ce,J,Q]}),t[55]=M,t[56]=K,t[57]=q,t[58]=ce,t[59]=J,t[60]=Q,t[61]=ue):ue=t[61],ue}function L(e,t){return(0,j.jsx)(`li`,{children:e},t)}function R(){}async function z(e,t=`GET`,n){let r=await u(c(e),{method:t,...n===void 0?{}:{body:JSON.stringify(n)}});if(!r.ok)throw Error(r.error??`Request failed`);return r.payload}function B({extension:e,zh:t,onChanged:n,onStart:r,onInstalled:i,initialConnect:a=!1,connectionFlow:s=!1}){let c=`/api/extensions/agent-plugins/${encodeURIComponent(e.pluginId)}`,[l,u]=(0,P.useState)(),[d,f]=(0,P.useState)({}),[p,m]=(0,P.useState)(!1),[h,g]=(0,P.useState)(``),[ee,_]=(0,P.useState)({}),[v,y]=(0,P.useState)(null),[b,x]=(0,P.useState)(``),[S,C]=(0,P.useState)(null),[w,T]=(0,P.useState)(!1),E=(0,P.useRef)(!1),O=(0,P.useRef)(new Set),oe=(0,P.useRef)(new Set),k=(0,P.useRef)(void 0),A=(0,P.useRef)(null),se=(0,P.useRef)(new Set),M=(e,n)=>t?e:n,N=e.setup?.authorizations??[],L=new Set(N.flatMap(e=>e.servers)),R=[...N,...(l?.connections??[]).filter(t=>!L.has(t.name)&&(e.components?.mcp.find(e=>e.name===t.name)?.type!==`stdio`||t.state===`token_required`)).map(t=>{let n=t.state===`token_required`||t.state===`auth_unknown`||e.components?.mcp.find(e=>e.name===t.name)?.connectionAuth?.mode===`api-key`;return{id:t.name,title:t.name,servers:[t.name],methods:[{id:n?`api-key`:`oauth`,title:n?M(`访问令牌`,`Access token`):M(`浏览器登录`,`Browser sign-in`),type:n?`form`:`oauth`,...n?{fields:[`__apiKey`]}:{server:t.name}}]}})],B=e=>e.servers.every(e=>l?.connections.find(t=>t.name===e)?.state===`connected`)&&(!N.some(t=>t.id===e.id)||l?.authorizations?.find(t=>t.id===e.id)?.state===`connected`),V=(l?.authorizations??[]).flatMap(e=>(e.issues??[]).map(t=>({...t,account:R.find(t=>t.id===e.id)}))),H=R.filter(e=>!B(e)),U=l?.installed||l?.state===`completed`,W=e.setup?.userConfig??{},G=new Set(N.flatMap(e=>e.methods.flatMap(e=>e.fields??[]))),K=Object.fromEntries(Object.entries(W).filter(([e])=>!G.has(e))),q=l?.error===`Connection verification failed. Check the credentials or login status and try again.`?M(`连接验证未通过,请检查凭据或登录状态后重试。`,l.error):l?.error,ce=Object.fromEntries(Object.entries(W).filter(([e])=>l?.missingConfig?.includes(e))),J=p||l?.state===`running`,Y=R.find(e=>e.id===S);(0,P.useEffect)(()=>{let e=!1;return z(`${c}/setup`).then(t=>{e||u(t)}).catch(t=>{e||(u(null),g(String(t)))}),()=>{e=!0}},[c]),(0,P.useEffect)(()=>{if(l?.state!==`running`)return;let e=!1,t=!1,r=setInterval(()=>{t||(t=!0,z(`${c}/setup`).then(t=>{e||(u(t),t?.state!==`running`&&n())}).catch(t=>{e||g(String(t))}).finally(()=>{t=!1}))},750);return()=>{e=!0,clearInterval(r)}},[c,l?.state]),(0,P.useEffect)(()=>{if(!l||!l.connections.some(e=>[`oauth_required`,`error`].includes(e.state)))return;let e=!1;return z(`${c}/setup/reusable`).then(t=>{e||_(t)}).catch(()=>{e||_({})}),()=>{e=!0}},[c,l?.revision]),(0,P.useEffect)(()=>{if(!b||l?.state===`completed`)return;let e=!1,t=!1,n=async()=>{if(!t){t=!0;try{let t=await z(`${c}/setup/auth/${encodeURIComponent(b)}`);e||y(t)}catch(t){e||g(String(t))}finally{t=!1}}};n();let r=setInterval(()=>void n(),1500),i=()=>void n();return window.addEventListener(`focus`,i),()=>{e=!0,clearInterval(r),window.removeEventListener(`focus`,i)}},[c,b,l?.state]),(0,P.useEffect)(()=>{let e=v?.authorizationUrl??(v?.challenge?.type===`url`?v.challenge.url:void 0);if(!v)return;if(v.error||[`cancelled`,`error`,`connected`].includes(v.state)){A.current?.close(),A.current=null;return}if(!e){v.challenge?.type===`qr`&&(A.current?.close(),A.current=null);return}let t=`${v.id}:${e}`;if(se.current.has(t))return;se.current.add(t);let n=A.current;A.current=null,n&&!n.closed?n.location.replace(e):window.open(e,`_blank`,`noopener,noreferrer`)},[v]);async function X(e,t={},r=l?.revision){m(!0),g(``);try{let a=await z(`${c}/setup`,`POST`,{action:e,expectedRevision:r,...e===`start`?{}:{idempotencyKey:crypto.randomUUID()},...t}),o=e===`configure`&&N.find(e=>e.id===t.authorization)?.methods.some(e=>e.id===t.method&&e.type===`cli`);return([`reuse`,`start`].includes(e)||e===`configure`&&!o)&&(f({}),T(!1),a=await z(`${c}/setup`,`POST`,{action:`prepare`,expectedRevision:a.revision,idempotencyKey:crypto.randomUUID()})),u(a),await n(),[`complete`,`defer`].includes(e)&&(C(null),y(null),x(``),A.current?.close(),A.current=null,i?.()),a}catch(e){g(e instanceof Error?e.message:String(e));try{u(await z(`${c}/setup`))}catch{}return null}finally{m(!1)}}(0,P.useEffect)(()=>{if(!l||J||h||[`cancelled`,`running`,`failed`].includes(l.state))return;if(l.state===`completed`){s&&!E.current&&(E.current=!0,X(`prepare`));return}E.current=!0;let e,t=``;if(l.state===`pending`?(e=`prepare`,t=`prepare:${c}:${l.revision}`):v?.state===`connected`&&(e=`prepare`,t=`auth:${c}:${v.id}`),e&&!O.current.has(t)){O.current.add(t),X(e);return}l.resources===`ready`&&!l.missingConfig?.length&&!l.partial&&l.connections.every(e=>e.state===`connected`)&&(l.authorizations??[]).every(e=>e.state===`connected`)&&(t=`complete:${c}:${l.revision}`,O.current.has(t)||(O.current.add(t),X(`complete`)))},[l,v,J,h,c,s]),(0,P.useEffect)(()=>{J||!l||l.state===`cancelled`||(Y&&l.revision!==k.current&&B(Y)?(C(null),y(null),x(``)):(!U||a)&&l.resources===`ready`&&(!l.missingConfig?.length||a&&!l.missingConfig.some(e=>e in K))&&!S&&H[0]&&!oe.current.has(H[0].id)&&(oe.current.add(H[0].id),k.current=l.revision,C(H[0].id)))},[l,J,U,S,a]);function Z(e,t){let n=e.methods.find(e=>e.id===t),r=n?.type===`oauth`||n?.type===`cli`?window.open(`about:blank`,`_blank`):null;r&&(r.opener=null),A.current=r,y(null),X(`authorize`,{server:e.id,...N.some(t=>t.id===e.id)?{method:t}:{}}).then(t=>{t?x(e.id):(r?.close(),A.current=null)})}async function le(t,n,r){if(n===`api-key`&&!N.some(e=>e.id===t.id)){m(!0),g(``);try{let n=e.components?.mcp.find(e=>e.name===t.id);await z(`${c}/mcp/${encodeURIComponent(t.id)}/auth`,`PUT`,{mode:`api-key`,secrets:[{target:n.type===`stdio`?`env`:`headers`,key:n.connectionAuth?.headerName??(n.type===`stdio`?`API_KEY`:`Authorization`),prefix:n.connectionAuth?.prefix??(n.type===`stdio`?``:`Bearer `),value:r.__apiKey}]});let i=await z(`${c}/setup`);u(i),m(!1),await X(`prepare`,{},i.revision);return}catch(e){g(String(e)),m(!1);return}m(!1)}else if(t.methods.find(e=>e.id===n)?.type===`cli`){let e=window.open(`about:blank`,`_blank`);e&&(e.opener=null),A.current=e,y(null);let i=await X(`configure`,{authorization:t.id,method:n,values:r},l?.revision);i&&await X(`authorize`,{server:t.id,method:n},i.revision)?x(t.id):(e?.close(),A.current=null)}else await X(`configure`,{authorization:t.id,method:n,values:r})}if(l===void 0)return(0,j.jsx)(ae,{className:`h-40 w-full`});let Q=()=>{X(`defer`)};return Y?(0,j.jsxs)(`div`,{className:`space-y-3`,children:[(0,j.jsx)(I,{initialMethod:l?.authorizations?.find(e=>e.id===Y.id)?.method,account:Y,fields:{...W,__apiKey:{type:`string`,title:M(`访问令牌`,`Access token`),required:!0,sensitive:!0}},zh:t,busy:J,attempt:v,onBack:()=>C(null),onConnect:e=>Z(Y,e),onSave:(e,t)=>void le(Y,e,t),onRedirect:e=>{m(!0),z(`${c}/setup/auth/${encodeURIComponent(b)}/redirect`,`POST`,{url:e}).catch(e=>g(String(e))).finally(()=>m(!1))},onSkip:Q},`${Y.id}:${l?.authorizations?.find(e=>e.id===Y.id)?.method??``}`),ee[Y.id]?.map(e=>(0,j.jsxs)(D,{disabled:J,variant:`secondary`,onClick:()=>void X(`reuse`,{server:Y.id,sourceServerId:e.id}),children:[M(`使用已登录账号:`,`Use signed-in account: `),e.name]},e.id)),h||q&&Y.servers.some(e=>l?.connections.find(t=>t.name===e)?.state===`error`)?(0,j.jsx)(`p`,{role:`alert`,className:`text-sm text-fg-muted`,children:h||q}):null]}):(0,j.jsxs)(`section`,{className:`space-y-5`,"aria-label":M(`插件安装与授权`,`Plugin setup`),children:[U?(0,j.jsxs)(`div`,{children:[(0,j.jsx)(`h3`,{className:`font-medium`,children:M(`安装完成`,`Installation complete`)}),(0,j.jsx)(`p`,{role:`status`,className:`mt-1 text-sm text-fg-muted`,children:e.activationEligible===!1?M(`插件已停用。`,`Plugin is disabled.`):l?.partial||H.length||V.length||l?.missingConfig?.length?M(`插件已安装,部分功能仍需要授权。`,`Plugin installed. Some features still need authorization.`):M(`所有 Agent 均可使用。可在 Agent 设置中单独调整。`,`Available to all agents. Customize individual agents in Agent settings.`)})]}):(0,j.jsxs)(`div`,{className:`rounded-xl border border-edge p-4`,children:[(0,j.jsx)(`h3`,{className:`font-medium`,children:M(`安装准备`,`Installation setup`)}),(0,j.jsx)(`ol`,{className:`mt-4 space-y-4 text-sm`,"aria-live":`polite`,children:[{name:M(`准备资源`,`Prepare resources`),done:l?.resources===`ready`,running:J&&l?.resources!==`ready`},{name:M(`授权账号`,`Authorize accounts`),done:l?.resources===`ready`&&!l?.missingConfig?.length&&H.length===0,running:!1},{name:M(`加载可用工具`,`Load available tools`),done:!1,running:J&&l?.resources===`ready`}].map(e=>(0,j.jsxs)(`li`,{className:`flex items-center gap-3`,children:[e.done?(0,j.jsx)(ne,{className:`size-5 text-accent`,"aria-hidden":!0}):e.running?(0,j.jsx)(ie,{className:`size-5 animate-spin text-accent`,"aria-hidden":!0}):(0,j.jsx)(re,{className:`size-5 text-fg-muted`,"aria-hidden":!0}),e.name]},e.name))}),(0,j.jsx)(`p`,{className:`mt-4 text-xs text-fg-muted`,children:M(`安装后所有 Agent 均可使用,可在各自的设置中调整。`,`Available to all agents after installation. Customize individual agents in Agent settings.`)})]}),!l||l.state===`cancelled`?(0,j.jsx)(D,{disabled:p||e.readiness===`blocked`,onClick:()=>void X(`start`),children:M(`继续安装`,`Continue installation`)}):(0,j.jsxs)(j.Fragment,{children:[l.missingConfig?.length||w?(0,j.jsxs)(`form`,{className:`space-y-4 rounded-xl border border-edge p-4`,onSubmit:e=>{e.preventDefault(),X(`configure`,{values:d})},children:[(0,j.jsx)(`h4`,{className:`font-medium`,children:M(`补充配置`,`Required configuration`)}),(0,j.jsx)(F,{fields:w?K:ce,values:d,onChange:f}),(0,j.jsx)(D,{type:`submit`,disabled:J||!Object.keys(d).length,children:M(`继续`,`Continue`)})]}):null,U&&(H.length||l.missingConfig?.length)?(0,j.jsxs)(`div`,{className:`flex items-start gap-3 rounded-xl border border-amber-500/30 bg-amber-500/10 p-4 text-sm`,children:[(0,j.jsx)(te,{className:`mt-0.5 size-5 shrink-0`,"aria-hidden":!0}),(0,j.jsxs)(`div`,{children:[(0,j.jsx)(`p`,{className:`font-medium`,children:M(`需要授权`,`Authorization required`)}),(0,j.jsx)(`p`,{className:`mt-1 text-fg-muted`,children:M(`授权后即可使用相关功能。已就绪的功能可继续使用。`,`Connect these accounts to use their features. Ready features remain available.`)})]})]}):null,V.length?(0,j.jsx)(`div`,{className:`space-y-3`,"aria-label":M(`需要补充权限`,`Additional permissions required`),children:V.map(e=>(0,j.jsxs)(`div`,{role:`alert`,className:`space-y-3 rounded-xl border border-amber-500/30 bg-amber-500/10 p-4 text-sm`,children:[(0,j.jsx)(`p`,{className:`font-medium`,children:e.title}),(0,j.jsx)(`p`,{className:`text-fg-muted`,children:M(`账号已连接,以下权限尚未就绪;其他已授权功能可继续使用。`,`Account connected. These permissions are not ready; other authorized features remain available.`)}),e.scopes.length?(0,j.jsx)(`p`,{className:`break-all font-mono text-xs`,children:e.scopes.join(`, `)}):null,(0,j.jsx)(`ol`,{className:`list-inside list-decimal space-y-1 text-fg-muted`,children:e.instructions.map(e=>(0,j.jsx)(`li`,{children:e},e))}),(0,j.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[e.helpUrl?(0,j.jsx)(D,{variant:`secondary`,asChild:!0,children:(0,j.jsx)(`a`,{href:e.helpUrl,target:`_blank`,rel:`noopener noreferrer`,children:M(`前往开通应用权限`,`Open application permissions`)})}):null,e.method&&e.account?(0,j.jsx)(D,{disabled:J,onClick:()=>{k.current=l.revision,C(e.account.id),Z(e.account,e.method)},children:M(`补充授权`,`Grant missing permissions`)}):null,(0,j.jsx)(D,{variant:`secondary`,disabled:J,onClick:()=>void X(`prepare`),children:M(`重新检查权限`,`Check permissions again`)})]})]},`${e.account?.id}:${e.id}`))}):null,R.length?(0,j.jsxs)(`div`,{className:`space-y-2`,children:[(0,j.jsx)(`h4`,{className:`text-sm font-medium`,children:M(`账号与连接`,`Accounts and connections`)}),R.map(e=>(0,j.jsxs)(`div`,{role:`group`,"aria-label":e.title,className:`flex items-center justify-between gap-3 rounded-lg border border-edge p-3`,children:[(0,j.jsxs)(`div`,{className:`min-w-0`,children:[(0,j.jsx)(`p`,{className:`text-sm font-medium`,children:e.title}),(0,j.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:B(e)?M(`已连接`,`Connected`):M(`需要授权`,`Authorization required`)})]}),(0,j.jsx)(D,{variant:B(e)?`secondary`:`primary`,disabled:J||l.resources!==`ready`,onClick:()=>{y(null),x(``),k.current=l.revision,C(e.id)},children:B(e)?M(`重新授权`,`Reconnect`):M(`连接账号`,`Connect account`)})]},e.id))]}):null,!U&&l.resources===`ready`?(0,j.jsxs)(`div`,{children:[(0,j.jsx)(D,{variant:`secondary`,disabled:J,onClick:Q,children:M(`暂时跳过`,`Skip for now`)}),(0,j.jsx)(`p`,{className:`mt-2 text-xs text-fg-muted`,children:M(`先完成安装,稍后在详情页授权。未授权的功能暂不可用。`,`Finish installation and connect later in plugin details. Unauthenticated features remain unavailable.`)})]}):null,U&&Object.keys(K).length&&!w?(0,j.jsx)(D,{variant:`ghost`,disabled:J,onClick:()=>T(!0),children:M(`修改插件配置`,`Edit plugin configuration`)}):null,U&&!V.length&&N.some(e=>e.methods.some(e=>e.type===`cli`))?(0,j.jsx)(D,{variant:`secondary`,disabled:J,onClick:()=>void X(`prepare`),children:M(`检查连接与权限`,`Check connection and permissions`)}):null,!J&&(h||[`failed`,`interrupted`].includes(l.state)||l.connections.some(e=>e.state===`error`))?(0,j.jsx)(D,{variant:`secondary`,onClick:()=>void X(`prepare`),children:M(`重试检查`,`Retry checks`)}):null,U?null:(0,j.jsx)(D,{variant:`ghost`,disabled:p,onClick:()=>void X(`cancel`),children:M(`取消安装`,`Cancel installation`)}),!s&&U&&!H.length&&!l.missingConfig?.length?e.setup?.tasks?.map(t=>(0,j.jsxs)(`div`,{className:`space-y-3 rounded-lg bg-surface-inset p-4 text-sm`,children:[(0,j.jsx)(`p`,{children:t}),(0,j.jsx)(D,{asChild:!0,disabled:!e.active,children:(0,j.jsx)(o,{to:`/chat/new?${new URLSearchParams({draft:t,projectScope:`none`})}`,state:{forceNewChat:!0},onClick:t=>{e.active?r?.():t.preventDefault()},children:M(`开始这个任务`,`Start this task`)})})]},t)):null]}),J?(0,j.jsx)(`p`,{role:`status`,className:`text-sm text-fg-muted`,children:M(`正在准备,可关闭后继续。`,`Preparing. You can close this window and resume.`)}):null,l?.error&&!l.deferred&&!l.missingConfig?.length?(0,j.jsx)(`p`,{className:`text-sm text-fg-muted`,children:q}):null,h?(0,j.jsx)(`p`,{role:`alert`,className:`text-sm text-fg-muted`,children:h}):null]})}var V=t({AgentPluginDialog:()=>K}),H=`w-full rounded-lg border border-edge bg-surface-inset px-3 py-2 text-sm text-fg`;function U(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?`在 Gateway 上运行工具服务:${n}`:`Run a tool service on the Gateway: ${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.startsWith(`runtime.capability-access:`)?t?`按账号授权启用相关技能和工具`:`Enable skills and tools according to account authorization`:e.startsWith(`runtime.authorization:`)?t?`在本机运行账号登录程序:${e.split(`:`)[1]}`:`Run account sign-in locally: ${e.split(`:`)[1]}`:e.startsWith(`runtime.resource:`)?t?`下载可执行资源:${e.split(`:`)[1]}`:`Download executable resource: ${e.split(`:`)[1]}`:e.startsWith(`network.resource:`)?t?`下载并校验资源:${e.split(`:`)[1]}`:`Download and verify resource: ${e.split(`:`)[1]}`:e}function W(e,t){return t?.publisher?.verification!==`verified`||t.latestVersion.riskTier&&t.latestVersion.riskTier!==`content`?!0:e.addedCapabilities.some(e=>!e.startsWith(`content.skills:`))}async function G(e,t,n){let r=await u(c(e),{method:t,...n===void 0?{}:{body:JSON.stringify(n)}});if(!r.ok)throw Error(r.error??`Request failed`);return r.payload}function K({extension:e,onClose:t,onUninstalled:n,initialSource:r=``,marketplace:i,autoInstall:o=!1,connectionFlow:c=!1}){let u=l(e=>e.language),_=u.startsWith(`zh`),te=i?.localizations?.[_?`zh-CN`:`en`],re=te?.displayName??i?.name,ae=te?.description??i?.description,oe=(0,P.useId)(),{mutate:A}=E(),[M,N]=(0,P.useState)(e),[F,I]=(0,P.useState)(r||e?.installationSource||``),[L,R]=(0,P.useState)(null),[z,V]=(0,P.useState)([]),[K,q]=(0,P.useState)(!1),[ce,J]=(0,P.useState)(``),[Y,X]=(0,P.useState)(!1),[Z,le]=(0,P.useState)(!1),[Q,ue]=(0,P.useState)(!1),[de,fe]=(0,P.useState)(!1),[pe,me]=(0,P.useState)(!1),[he,ge]=(0,P.useState)(!1),_e=s(),ve=a(),[ye,be]=(0,P.useState)(!1),xe=(0,P.useRef)(!1),Se=`/api/extensions/agent-plugins/${encodeURIComponent(M?.pluginId??``)}`,Ce=F.trim().startsWith(`store:`),we=()=>A(`gateway-extensions-list`);async function $(e){q(!0),J(``);try{await e()}catch(e){J(e instanceof Error?e.message:String(e))}finally{q(!1)}}function Te(e){I(e),R(null),V([]),J(``)}let Ee=typeof window<`u`?window.electronAPI?.file:void 0,De=/^(?:\/|[A-Za-z]:[\\/])/.test(F.trim())?F.trim():void 0;async function Oe(){if(!Ee?.openDirectory){me(!0);return}let e=await Ee.openDirectory(De?{defaultPath:De}:void 0);e&&Te(e)}async function ke(){if(!Ee?.openFile){me(!0);return}let e=await Ee.openFile({...De?{defaultPath:De}:{},extensions:[`zip`]});e&&Te(e)}function Ae(e){return[...e.dataTransfer.types].some(e=>e===`Files`||e===`text/plain`||e===`text/uri-list`)}function je(e){if(!Ae(e))return;e.preventDefault(),fe(!1);let t=Array.from(e.dataTransfer.files);if(t.length){if(t.length>1){J(_?`一次只能选择一个插件目录或 ZIP。`:`Choose one plugin directory or ZIP at a time.`);return}let e=Ee?.getPathForFile?.(t[0]);e?Te(e):J(_?`浏览器无法读取本机文件路径,请使用“选择文件或目录”选择安装包。`:`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()&&Te(n.trim().split(/\r?\n/)[0])}async function Me(e){let t=await G(`${Se}/activation`,`POST`,{enabled:e});N(t),await we()}async function Ne(e){let t=!M,n=await G(t?`/api/extensions/install`:`${Se}/update`,`POST`,{source:F,reviewHash:e.reviewHash,...e.layout?{setup:!0}:{}});N(n),await we(),!e.layout&&t&&!n.activationEligible&&n.readiness!==`blocked`&&n.pluginId&&(n=await G(`/api/extensions/agent-plugins/${encodeURIComponent(n.pluginId)}/activation`,`POST`,{enabled:!0}),N(n),await we()),R(null),be(!e.layout&&t&&n.activationEligible===!0)}async function Pe(){let e=await G(`/api/extensions/inspect`,`POST`,{source:F});if(W(e,i)){R(e);return}await Ne(e)}(0,P.useEffect)(()=>{e&&!e.setup&&N(e)},[e]),(0,P.useEffect)(()=>{if(!e?.setup||!e.pluginId)return;let t=!1;return G(`/api/extensions/agent-plugins/${encodeURIComponent(e.pluginId)}`,`GET`).then(e=>{t||N(e)}).catch(()=>{}),()=>{t=!0}},[e?.pluginId]),(0,P.useEffect)(()=>{!o||M||!Ce||xe.current||(xe.current=!0,$(Pe))},[o,M,Ce]);let Fe=o&&!M&&Ce&&!xe.current;return(0,j.jsx)(ee,{defaultOpen:!0,onOpenChange:e=>!e&&t(),children:(0,j.jsxs)(m,{children:[(0,j.jsx)(f,{className:`fixed inset-0 z-[130] bg-scrim`}),(0,j.jsxs)(h,{className:`fixed left-1/2 top-1/2 z-[131] flex h-[min(42rem,calc(100dvh-2rem))] w-[min(38rem,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,j.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between border-b border-edge p-4`,children:[(0,j.jsxs)(`div`,{className:`flex min-w-0 items-center gap-3`,children:[(0,j.jsx)(k,{iconUrl:M?.branding?.iconUrl??i?.branding?.iconUrl,fallback:S}),(0,j.jsx)(g,{className:`font-semibold`,children:M?.name??re??(_?`安装插件`:`Install plugin`)})]}),(0,j.jsx)(D,{variant:`ghost`,onClick:t,children:_?`关闭`:`Close`})]}),(0,j.jsx)(p,{className:`sr-only`,children:_?`安装、组件、账号连接和权限`:`Installation, components, connections and permissions`}),(0,j.jsxs)(`div`,{className:`min-h-0 flex-auto space-y-4 overflow-y-auto overscroll-contain p-4`,children:[!M&&Ce?(0,j.jsxs)(`section`,{className:`space-y-4`,children:[(0,j.jsxs)(`div`,{className:`flex items-start gap-3 rounded-xl border border-edge bg-surface-base p-4`,children:[(0,j.jsx)(C,{className:`mt-0.5 size-5 shrink-0 text-emerald-600 dark:text-emerald-400`,"aria-hidden":!0}),(0,j.jsxs)(`div`,{className:`min-w-0`,children:[(0,j.jsx)(`p`,{className:`font-medium text-fg`,children:re??L?.manifest.name??F.slice(6)}),ae?(0,j.jsx)(`p`,{className:`mt-1 text-sm leading-relaxed text-fg-muted`,children:ae}):null,(0,j.jsx)(`p`,{className:`mt-2 text-xs text-fg-muted`,children:i?.publisher?.verification===`verified`?_?`已认证发布者 · 安装后所有智能体均可使用`:`Verified publisher · available to all agents after installation`:_?`安装前会检查来源和所需权限`:`Source and required permissions are checked before installation`})]})]}),i?(0,j.jsx)(se,{data:i,zh:_}):null,L?null:(0,j.jsxs)(D,{className:`w-full`,disabled:K||Fe,onClick:()=>void $(Pe),children:[K||Fe?(0,j.jsx)(ie,{className:`size-4 animate-spin`,"aria-hidden":!0}):null,K||Fe?_?`正在安全检查并安装…`:`Checking and installing…`:_?`一键安装`:`Install`]})]}):null,M?(0,j.jsxs)(j.Fragment,{children:[ye?(0,j.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,j.jsx)(ne,{className:`mt-0.5 size-5 shrink-0 text-emerald-600 dark:text-emerald-400`,"aria-hidden":!0}),(0,j.jsxs)(`div`,{children:[(0,j.jsx)(`p`,{className:`font-medium text-fg`,children:_?`插件已安装并启用`:`Plugin installed and enabled`}),(0,j.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:_?`请继续检查账号连接、依赖与可用状态,再在对话中试用。`:`It is ready to use in your conversations.`})]})]}):null,(!M.setup||M.readiness!==`setup_required`)&&!M.activationEligible?(0,j.jsxs)(`div`,{role:`status`,className:`space-y-3 rounded-lg border border-accent/25 bg-accent-soft p-4`,children:[(0,j.jsxs)(`div`,{children:[(0,j.jsx)(`p`,{className:`font-medium text-accent-fg`,children:_?`插件已安装,当前尚未启用`:`Plugin installed. It is not enabled yet.`}),(0,j.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:_?`启用后,Skills 和 MCP 才会加入 Agent 运行时。`:`Enable it to make its skills and MCP servers available to the Agent runtime.`})]}),(0,j.jsx)(D,{disabled:K||M.readiness===`blocked`,onClick:()=>void $(()=>Me(!0)),children:_?`启用插件`:`Enable plugin`})]}):null,M.setup?(0,j.jsx)(B,{extension:M,zh:_,onStart:t,initialConnect:c,connectionFlow:c,onInstalled:()=>{t(),c||_e(O(M.pluginId,`installed`,!1,ve.pathname+ve.search))},onChanged:async()=>{let e=await G(`${Se}`,`GET`);N(e),await we()}}):null,(0,j.jsxs)(`details`,{className:`rounded-lg border border-edge p-3`,children:[(0,j.jsx)(`summary`,{className:`cursor-pointer text-sm font-medium`,children:_?`插件详情`:`Plugin details`}),(0,j.jsxs)(`div`,{className:`mt-3 space-y-3`,children:[(0,j.jsxs)(`p`,{className:`text-sm text-fg-muted`,children:[_?`插件`:`Plugin`,` · `,M.version,` · `,M.readiness&&{ready:_?`已就绪`:`Ready`,setup_required:_?`待连接`:`Setup required`,degraded:_?`部分不可用`:`Partially available`,blocked:_?`已阻止`:`Blocked`}[M.readiness]]}),M.provenance?(0,j.jsxs)(`p`,{className:`break-words text-xs text-fg-muted`,children:[M.provenance.publisherVerification===`verified`?_?`已认证发布者`:`Verified publisher`:_?`社区发布者`:`Community publisher`,` · `,M.provenance.packageName,`@`,M.provenance.version,` · SHA-256 `,M.provenance.sha256.slice(0,12),`…`,M.provenance.riskTier?` · ${M.provenance.riskTier}`:``]}):null,(0,j.jsx)(`p`,{className:`text-sm`,children:M.description}),M.installationSource?(0,j.jsxs)(`p`,{className:`break-all text-xs text-fg-muted`,children:[_?`来源:`:`Source: `,M.installationSource,M.resolvedCommit?` · ${M.resolvedCommit.slice(0,12)}`:``]}):null,M.activationEligible?(0,j.jsx)(D,{disabled:K,variant:`secondary`,onClick:()=>void $(()=>Me(!1)),children:_?`停用`:`Disable`}):null,M.canRollback?(0,j.jsx)(D,{disabled:K,variant:`secondary`,onClick:()=>void $(async()=>{N(await G(`${Se}/rollback`,`POST`)),await we()}),children:_?`回滚上一版本`:`Roll back`}):null]})]}),M.diagnostics?.map((e,t)=>(0,j.jsxs)(`p`,{className:`text-sm text-fg-muted`,children:[e.component,`: `,e.message]},t))]}):null,M?(0,j.jsxs)(D,{variant:`ghost`,className:`px-0`,"aria-expanded":he,onClick:()=>ge(e=>!e),children:[(0,j.jsx)(v,{className:T(`size-4 transition-transform motion-reduce:transition-none`,he&&`rotate-180`),"aria-hidden":!0}),_?`高级操作`:`Advanced actions`]}):null,!M&&!Ce||he?(0,j.jsxs)(`form`,{className:T(`space-y-3`,M&&`border-t border-edge pt-4`),onSubmit:e=>{e.preventDefault(),$(async()=>{let e=await G(`/api/extensions/inspect`,`POST`,{source:F});e.candidates?(V(e.candidates),R(null)):(V([]),R(e))})},children:[(0,j.jsxs)(`div`,{"data-testid":`plugin-source-dropzone`,className:T(`rounded-xl border border-dashed p-3 transition-colors`,de?`border-accent bg-accent-soft`:`border-edge bg-surface-inset/40`),onDragEnter:e=>{Ae(e)&&(e.preventDefault(),fe(!0))},onDragOver:e=>{Ae(e)&&(e.preventDefault(),e.dataTransfer.dropEffect=`copy`,fe(!0))},onDragLeave:e=>{e.currentTarget.contains(e.relatedTarget)||fe(!1)},onDrop:je,children:[(0,j.jsxs)(`div`,{className:`mb-2 flex items-start gap-2`,children:[(0,j.jsx)(w,{className:`mt-0.5 size-4 shrink-0 text-fg-muted`,"aria-hidden":!0}),(0,j.jsxs)(`div`,{children:[(0,j.jsx)(`label`,{htmlFor:oe,className:`block text-sm font-medium`,children:M?_?`更新包来源`:`Update package source`:_?`安装包来源`:`Package source`}),(0,j.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-muted`,children:_?`输入 github:组织/仓库、Git / ZIP 地址或宿主目录;marketplace 可选择插件。`:`Enter github:owner/repo, a Git / ZIP URL or a Gateway directory. Marketplaces let you choose a plugin.`})]})]}),(0,j.jsx)(`input`,{id:oe,className:H,value:F,onChange:e=>Te(e.target.value),placeholder:_?`/插件目录/或/插件.zip`:`/plugin/folder/or/plugin.zip`,autoComplete:`off`,spellCheck:!1,required:!0}),(0,j.jsx)(`div`,{className:`mt-2 flex flex-wrap gap-2`,children:Ee?(0,j.jsxs)(j.Fragment,{children:[(0,j.jsxs)(D,{type:`button`,variant:`secondary`,disabled:K,onClick:()=>void $(Oe),children:[(0,j.jsx)(x,{className:`size-4`,"aria-hidden":!0}),_?`选择目录`:`Choose directory`]}),(0,j.jsxs)(D,{type:`button`,variant:`secondary`,disabled:K,onClick:()=>void $(ke),children:[(0,j.jsx)(b,{className:`size-4`,"aria-hidden":!0}),_?`选择 ZIP`:`Choose ZIP`]})]}):(0,j.jsxs)(D,{type:`button`,variant:`secondary`,disabled:K,onClick:()=>me(!0),children:[(0,j.jsx)(x,{className:`size-4`,"aria-hidden":!0}),_?`选择文件或目录`:`Choose file or folder`]})})]}),(0,j.jsx)(D,{type:`submit`,variant:`secondary`,disabled:K||!F,children:_?`检查安装包`:`Inspect package`})]}):null,z.length?(0,j.jsx)(`div`,{className:`space-y-2`,"aria-label":_?`选择插件`:`Choose a plugin`,children:z.map(e=>(0,j.jsx)(D,{variant:`secondary`,className:`w-full justify-start`,onClick:()=>{Te(e.source),$(async()=>R(await G(`/api/extensions/inspect`,`POST`,{source:e.source})))},children:e.name},e.source))}):null,L?(0,j.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,j.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,j.jsx)(C,{className:`mt-0.5 size-5 shrink-0 text-amber-700 dark:text-amber-300`,"aria-hidden":!0}),(0,j.jsxs)(`div`,{children:[(0,j.jsx)(`p`,{id:`plugin-authorization-title`,className:`font-medium text-fg`,children:_?`需要你的授权`:`Your authorization is required`}),(0,j.jsx)(`p`,{className:`mt-1 text-fg-muted`,children:_?`此插件需要以下新增能力。确认后自动准备资源,按需登录账号,所有智能体均可使用。`:`Review these capabilities. Resources are prepared automatically; sign in if needed. Available to all agents.`})]})]}),(0,j.jsx)(`ul`,{tabIndex:0,"aria-label":_?`插件新增能力`:`Added plugin capabilities`,className:`max-h-[min(28vh,14rem)] space-y-2 overflow-y-auto overscroll-contain rounded-lg border border-edge bg-surface-panel p-3 break-words focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:L.addedCapabilities.map(e=>(0,j.jsxs)(`li`,{className:`flex gap-2`,children:[(0,j.jsx)(`span`,{"aria-hidden":!0,children:`•`}),(0,j.jsx)(`span`,{children:U(e,_)})]},e))}),L.diagnostics.map((e,t)=>(0,j.jsxs)(`p`,{children:[e.component,`: `,e.message]},t))]}):null,M&&he?(0,j.jsx)(`div`,{className:`border-t border-edge pt-4`,children:Q?(0,j.jsxs)(`div`,{className:`space-y-3 text-sm`,children:[(0,j.jsx)(`p`,{children:_?`卸载保留账号凭据;服务端授权需到相应服务撤销。`:`Credentials are retained. Revoke provider authorization in the service itself.`}),(0,j.jsxs)(`label`,{className:`flex gap-2`,children:[(0,j.jsx)(`input`,{type:`checkbox`,checked:Y,onChange:e=>X(e.target.checked)}),_?`同时删除插件数据`:`Also delete plugin data`]}),(0,j.jsxs)(`label`,{className:`flex gap-2`,children:[(0,j.jsx)(`input`,{type:`checkbox`,checked:Z,onChange:e=>le(e.target.checked)}),_?`同时删除本地凭据`:`Also delete local credentials`]}),(0,j.jsx)(D,{disabled:K,onClick:()=>void $(async()=>{await G(Se,`DELETE`,{removeData:Y,removeCredentials:Z}),await we(),(n??t)()}),children:_?`确认卸载`:`Confirm uninstall`})]}):(0,j.jsx)(D,{variant:`ghost`,disabled:K,onClick:()=>ue(!0),children:_?`卸载插件`:`Uninstall`})}):null,ce?(0,j.jsx)(`p`,{role:`alert`,className:`break-words text-sm text-fg-muted`,children:ce}):null]}),L?(0,j.jsxs)(`div`,{className:`flex shrink-0 flex-wrap justify-end gap-2 border-t border-edge p-4`,children:[(0,j.jsx)(D,{variant:`ghost`,disabled:K,onClick:()=>R(null),children:_?`取消`:`Cancel`}),(0,j.jsxs)(D,{disabled:K||!!M&&L.manifest.name!==M.name,onClick:()=>void $(()=>Ne(L)),children:[K?(0,j.jsx)(ie,{className:`size-4 animate-spin`,"aria-hidden":!0}):null,_?`授权并安装`:`Authorize and install`]})]}):null]}),Ee?null:(0,j.jsx)(y,{open:pe,onOpenChange:me,initialAbsolutePath:De,onConfirm:async e=>Te(e),wd:d(u).chat.workingDirectory,selectKind:`file-or-directory`,fileExtensions:[`zip`],title:_?`选择插件安装包`:`Choose plugin package`,description:_?`选择插件目录或 ZIP 文件。`:`Choose a plugin directory or ZIP file.`,confirmLabel:_?`使用此来源`:`Use this source`,nested:!0})]})})}export{se as i,V as n,B as r,K as t};
@@ -1,5 +1,5 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/block-editor-CmnkluMF.js","assets/rolldown-runtime-aKtaBQYM.js","assets/vendor-react-BOUWij0V.js","assets/locale-store-Dy1EByeG.js","assets/messages-BAnhwALN.js","assets/unlink-BEuthaaq.js","assets/createLucideIcon-DPHK1VkS.js","assets/check-DUBLcKHA.js","assets/copy-Dv6d4Dvw.js","assets/external-link-DjqjBmc3.js","assets/notes-api-CdXA-g9r.js","assets/dist-CY7CS_D3.js","assets/es2015-DBLcMg5B.js","assets/dist-CxGUk8J-.js","assets/download-Dk-ZjtO6.js","assets/markdown-view-BlxIaCCQ.js","assets/chunk-KS7C4IRE-CiwuuyV8.js","assets/preload-helper-Czpn1I53.js","assets/file-image-CDUPkZvG.js","assets/plus-Q2yW6OE7.js","assets/x-B_N4OPjy.js","assets/cn-0WouolD0.js","assets/bundle-mjs-rHxsej31.js","assets/app-link-DImAfVs5.js","assets/product-delivery-BFfqdKLe.js","assets/schemas-CCWMleym.js","assets/local-apps-DeqzkJiF.js","assets/copy-to-clipboard-HOJ79TWv.js","assets/xml-_d7dTN2Q.js","assets/mermaid-render-oOellPHt.js","assets/markdown-view-DG8DDkEA.css","assets/chat-chart-block-stPJEZ90.js","assets/skeleton-DzdOeGYz.js","assets/list-todo-CTVRto8O.js","assets/loader-circle-CifKLtgG.js","assets/mic-CuUb7zc-.js","assets/pause-DuPxgSxk.js","assets/pencil-DmIY3Oa-.js","assets/play-kxZvpBg8.js","assets/vendor-swr-CdRzEUwF.js","assets/floating-ui.dom-seOukHzT.js","assets/linkify-it-BkqEorO0.js","assets/vendor-codemirror-aCQ0FcJT.js","assets/with-selector-xonYxPoM.js","assets/note-image-lightbox-CqK_uJ6Y.js","assets/block-editor-Cvy3D_4T.css","assets/markdown-editor-CjQJ-Nho.js","assets/languages-kF11aUYU.js"])))=>i.map(i=>d[i]);
2
- import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{t as i}from"./preload-helper-Czpn1I53.js";import{u as a}from"./chunk-KS7C4IRE-CiwuuyV8.js";import{l as o,n as s}from"./locale-store-Dy1EByeG.js";import{t as c}from"./messages-BAnhwALN.js";import{a as l,i as u,n as d,o as f,r as p,s as m,t as h}from"./dist-CY7CS_D3.js";import{t as g}from"./bot-DjLkhyZL.js";import{t as _}from"./briefcase-business-BsoCaI_t.js";import{i as v,s as y}from"./popover-select-CLsphyzA.js";import{t as b}from"./code-xml-DJtYhZUF.js";import{t as x}from"./ellipsis-0k4rZLoy.js";import{t as S}from"./eye-CABVeTq0.js";import{t as C}from"./heart-Cp4rgrqn.js";import{t as w}from"./markdown-view-BlxIaCCQ.js";import{t as T}from"./message-square-plus-XP0tGdlV.js";import{t as E}from"./pencil-DmIY3Oa-.js";import{t as D}from"./plus-Q2yW6OE7.js";import{t as O}from"./rotate-ccw-JM1TBLpp.js";import{t as k}from"./settings-uiTATseT.js";import{t as A}from"./sliders-horizontal-DqsYor6I.js";import{t as j}from"./triangle-alert-2JXFNNKU.js";import{t as M}from"./upload-rrb46c3c.js";import{t as N}from"./x-B_N4OPjy.js";import{t as P}from"./cn-0WouolD0.js";import{t as F}from"./skeleton-DzdOeGYz.js";import{t as I}from"./specialists-xbB3xL9e.js";import{a as L}from"./new-session-preferences-gb411vZP.js";import{i as R}from"./vendor-swr-CdRzEUwF.js";import{r as z}from"./gateway-config-swr-1Rk0LeEM.js";import{n as B,t as V}from"./registry-api-DuDIthjL.js";import{c as H,i as U,l as W,n as G,o as ee,r as te,s as K,t as ne}from"./agents-admin-api-D0N09mqJ.js";import{t as q}from"./button-Cc4hUNTt.js";import{i as re,o as ie}from"./settings-shell-dialog-layer-BU3UuiJr.js";import{n as J}from"./interaction-BdhHBbYa.js";import{i as ae}from"./theme-store-BaWep_o7.js";import{t as oe}from"./page-tabs-oeTY7z3_.js";import{i as se,r as ce,s as le,t as ue}from"./agent-avatar-display-loBdGw_i.js";import{t as de}from"./sliding-tab-list-CmcrqRzN.js";import{t as Y}from"./confirm-dialog-DrA5mTQp.js";import{l as fe,m as pe,o as me,r as he,t as ge}from"./dist-ZrL34Ps4.js";import{n as _e}from"./model-selector-C-CqPBao.js";import{n as ve,t as ye}from"./agents-app-path-ciChvpCS.js";import{n as be,r as xe,t as Se}from"./agent-display-names-Bje7vfSn.js";import{t as Ce}from"./settings-advanced-section-B-H1gYOs.js";import{t as we}from"./use-media-query-ady-FgjK.js";import{t as Te}from"./number-input-El7Szeln.js";import{n as Ee}from"./settings-page-header-DEZZ8D0S.js";import"./settings-page-layout-De2j64Lo.js";import{t as De}from"./phone-model-picker-BOv3mb_F.js";import{t as Oe}from"./directory-picker-path-field-ByDqf5fE.js";import{r as ke,s as Ae}from"./image-generation-api-sbtx4NiC.js";var X=e(t(),1),Z=n();function je(e){let t=e.match(/^(---\r?\n[\s\S]*?\r?\n---(?:\r?\n)*)/);return t?{frontMatter:t[1],body:e.slice(t[1].length)}:{frontMatter:``,body:e}}function Me(e,t){let{frontMatter:n}=je(e);return`${n}${t}`}var Ne=[{id:`professional`,labelEn:`Professional & Efficient`,labelZh:`专业高效`,emoji:`🎯`,content:`# SOUL.md - Who You Are
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/block-editor-DrZyRQQ0.js","assets/rolldown-runtime-aKtaBQYM.js","assets/vendor-react-BOUWij0V.js","assets/locale-store-Dy1EByeG.js","assets/messages-BAnhwALN.js","assets/unlink-BEuthaaq.js","assets/createLucideIcon-DPHK1VkS.js","assets/check-DUBLcKHA.js","assets/copy-Dv6d4Dvw.js","assets/external-link-DjqjBmc3.js","assets/notes-api-BOIM9Q_D.js","assets/dist-CY7CS_D3.js","assets/es2015-DBLcMg5B.js","assets/dist-CxGUk8J-.js","assets/download-Dk-ZjtO6.js","assets/markdown-view-CNJaAdNN.js","assets/diagnostics-Bo0Z42P_.js","assets/chunk-KS7C4IRE-CiwuuyV8.js","assets/preload-helper-Czpn1I53.js","assets/file-image-CDUPkZvG.js","assets/plus-Q2yW6OE7.js","assets/x-B_N4OPjy.js","assets/cn-0WouolD0.js","assets/bundle-mjs-rHxsej31.js","assets/app-link-DImAfVs5.js","assets/product-delivery-BFfqdKLe.js","assets/schemas-CCWMleym.js","assets/local-apps-DeqzkJiF.js","assets/copy-to-clipboard-HOJ79TWv.js","assets/xml-_d7dTN2Q.js","assets/mermaid-render-oOellPHt.js","assets/markdown-view-DG8DDkEA.css","assets/chat-chart-block-ClCZyIi0.js","assets/skeleton-DzdOeGYz.js","assets/list-todo-CTVRto8O.js","assets/loader-circle-CifKLtgG.js","assets/mic-CuUb7zc-.js","assets/pause-DuPxgSxk.js","assets/pencil-DmIY3Oa-.js","assets/play-kxZvpBg8.js","assets/vendor-swr-CdRzEUwF.js","assets/floating-ui.dom-seOukHzT.js","assets/linkify-it-BkqEorO0.js","assets/vendor-codemirror-aCQ0FcJT.js","assets/with-selector-xonYxPoM.js","assets/note-image-lightbox-D6mvMSKr.js","assets/block-editor-Cvy3D_4T.css","assets/markdown-editor-CjQJ-Nho.js","assets/languages-kF11aUYU.js"])))=>i.map(i=>d[i]);
2
+ import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{t as i}from"./preload-helper-Czpn1I53.js";import{u as a}from"./chunk-KS7C4IRE-CiwuuyV8.js";import{l as o,n as s}from"./locale-store-Dy1EByeG.js";import{t as c}from"./messages-BAnhwALN.js";import{a as l,i as u,n as d,o as f,r as p,s as m,t as h}from"./dist-CY7CS_D3.js";import{t as g}from"./bot-DjLkhyZL.js";import{t as _}from"./briefcase-business-BsoCaI_t.js";import{i as v,s as y}from"./popover-select-CLsphyzA.js";import{t as b}from"./code-xml-DJtYhZUF.js";import{t as x}from"./ellipsis-0k4rZLoy.js";import{t as S}from"./eye-CABVeTq0.js";import{t as C}from"./heart-Cp4rgrqn.js";import{t as w}from"./markdown-view-CNJaAdNN.js";import{t as T}from"./message-square-plus-XP0tGdlV.js";import{t as E}from"./pencil-DmIY3Oa-.js";import{t as D}from"./plus-Q2yW6OE7.js";import{t as O}from"./rotate-ccw-JM1TBLpp.js";import{t as k}from"./settings-uiTATseT.js";import{t as A}from"./sliders-horizontal-DqsYor6I.js";import{t as j}from"./triangle-alert-2JXFNNKU.js";import{t as M}from"./upload-rrb46c3c.js";import{t as N}from"./x-B_N4OPjy.js";import{t as P}from"./cn-0WouolD0.js";import{t as F}from"./skeleton-DzdOeGYz.js";import{t as I}from"./specialists-xbB3xL9e.js";import{a as L}from"./new-session-preferences-gb411vZP.js";import{i as R}from"./vendor-swr-CdRzEUwF.js";import{r as z}from"./gateway-config-swr-1Rk0LeEM.js";import{n as B,t as V}from"./registry-api-DuDIthjL.js";import{c as H,i as U,l as W,n as G,o as ee,r as te,s as K,t as ne}from"./agents-admin-api-D0N09mqJ.js";import{t as q}from"./button-Cc4hUNTt.js";import{i as re,o as ie}from"./settings-shell-dialog-layer-BU3UuiJr.js";import{n as J}from"./interaction-BdhHBbYa.js";import{i as ae}from"./theme-store-BaWep_o7.js";import{t as oe}from"./page-tabs-oeTY7z3_.js";import{i as se,r as ce,s as le,t as ue}from"./agent-avatar-display-loBdGw_i.js";import{t as de}from"./sliding-tab-list-CmcrqRzN.js";import{t as Y}from"./confirm-dialog-DrA5mTQp.js";import{l as fe,m as pe,o as me,r as he,t as ge}from"./dist-ZrL34Ps4.js";import{n as _e}from"./model-selector-C-CqPBao.js";import{n as ve,t as ye}from"./agents-app-path-ciChvpCS.js";import{n as be,r as xe,t as Se}from"./agent-display-names-Bje7vfSn.js";import{t as Ce}from"./settings-advanced-section-B-H1gYOs.js";import{t as we}from"./use-media-query-ady-FgjK.js";import{t as Te}from"./number-input-El7Szeln.js";import{n as Ee}from"./settings-page-header-DEZZ8D0S.js";import"./settings-page-layout-De2j64Lo.js";import{t as De}from"./phone-model-picker-BOv3mb_F.js";import{t as Oe}from"./directory-picker-path-field-ByDqf5fE.js";import{r as ke,s as Ae}from"./image-generation-api-sbtx4NiC.js";var X=e(t(),1),Z=n();function je(e){let t=e.match(/^(---\r?\n[\s\S]*?\r?\n---(?:\r?\n)*)/);return t?{frontMatter:t[1],body:e.slice(t[1].length)}:{frontMatter:``,body:e}}function Me(e,t){let{frontMatter:n}=je(e);return`${n}${t}`}var Ne=[{id:`professional`,labelEn:`Professional & Efficient`,labelZh:`专业高效`,emoji:`🎯`,content:`# SOUL.md - Who You Are
3
3
 
4
4
  ## Core Truths
5
5
 
@@ -63,7 +63,7 @@ Warm, friendly, and a little playful. Like a helpful friend who happens to know
63
63
 
64
64
  ## Vibe
65
65
 
66
- Sharp, direct, slightly nerdy. The kind of engineer you'd want on your team — competent, opinionated, and occasionally funny.`},{id:`custom`,labelEn:`Custom`,labelZh:`自定义`,emoji:`✍️`,content:``}],Pe=[{value:`AI assistant`,labelEn:`AI Assistant`,labelZh:`AI 助手`},{value:`robot`,labelEn:`Robot`,labelZh:`机器人`},{value:`familiar`,labelEn:`Familiar`,labelZh:`精灵`},{value:`ghost in the machine`,labelEn:`Ghost in the machine`,labelZh:`机器幽灵`},{value:`digital companion`,labelEn:`Digital Companion`,labelZh:`数字伙伴`}],Q=r(),Fe=()=>i(()=>import(`./block-editor-CmnkluMF.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45])),Ie=()=>i(()=>import(`./markdown-editor-CjQJ-Nho.js`),__vite__mapDeps([46,1,2,42,47,17])),Le=(0,X.lazy)(()=>Fe().then(e=>({default:e.BlockEditor}))),Re=(0,X.lazy)(()=>Ie().then(e=>({default:e.MarkdownEditor})));function ze(){let e=(0,Z.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Q.jsxs)(`div`,{className:`space-y-3 p-5`,"aria-busy":`true`,children:[(0,Q.jsx)(F,{className:`h-8 w-52`}),(0,Q.jsx)(F,{className:`h-4 w-full`}),(0,Q.jsx)(F,{className:`h-4 w-4/5`}),(0,Q.jsx)(F,{className:`h-4 w-11/12`})]}),e[0]=t):t=e[0],t}var Be=(0,X.forwardRef)(function({agentId:e,file:t,zh:n,onDirtyChange:r},i){let a=ae(e=>e.resolved===`dark`),[o,s]=(0,X.useState)(``),[c,l]=(0,X.useState)(``),[u,d]=(0,X.useState)(!0),[f,p]=(0,X.useState)(!1),[m,h]=(0,X.useState)(!1),[v,y]=(0,X.useState)(null),[x,T]=(0,X.useState)(!1),[D,O]=(0,X.useState)(!1),[k,A]=(0,X.useState)(null),[j,M]=(0,X.useState)(`direct`);(0,X.useEffect)(()=>{let n=!1;return d(!0),p(!1),y(null),s(``),l(``),T(!1),A(null),(async()=>{try{let r=await U(e),i=new Set(r.files.filter(e=>!e.missing).map(e=>e.name)).has(t)?await te(e,t):``;if(n)return;s(i),l(i)}catch(e){if(n)return;p(!0),y(e instanceof Error?e.message:String(e))}finally{n||d(!1)}})(),()=>{n=!0}},[e,t]);let N=o!==c;(0,X.useEffect)(()=>r(N),[N,r]);let F=(0,X.useCallback)(async()=>{if(N){h(!0),y(null);try{await K(e,t,o),l(o),T(!0),A(null)}catch(e){throw y(e instanceof Error?e.message:String(e)),e}finally{h(!1)}}},[e,t,N,o]);(0,X.useImperativeHandle)(i,()=>({save:F}),[F]);let I={"SOUL.md":{label:n?`个性与边界`:`Personality & boundaries`,description:n?`定义语气、价值观、行为原则与安全边界。`:`Tone, values, behavior principles, and safety boundaries.`},"TOOLS.md":{label:n?`工具使用约定`:`Tool guidance`,description:n?`补充工具偏好和使用约定,不负责授予权限。`:`Tool preferences and conventions; this does not grant access.`},"AGENTS.md":{label:n?`工作规范`:`Working instructions`,description:n?`该智能体长期遵循的协作和执行规范。`:`Persistent collaboration and execution instructions.`}},L=[_,C,b,E],R=je(o).body;return(0,Q.jsx)(`div`,{className:`space-y-5`,children:(0,Q.jsx)(`section`,{className:`overflow-hidden rounded-2xl border border-edge bg-surface-base`,children:(0,Q.jsxs)(`div`,{className:`p-4 sm:p-5`,children:[(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`h4`,{className:`text-sm font-semibold text-fg`,children:I[t].label}),(0,Q.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:I[t].description})]}),(0,Q.jsx)(de,{className:`flex rounded-lg bg-surface-hover p-1`,role:`group`,"aria-label":n?`编辑模式`:`Editor mode`,indicatorClassName:`rounded-md bg-surface-panel shadow-surface`,children:[[`direct`,E,n?`直接编辑`:`Visual`],[`source`,b,`Markdown`],[`preview`,S,n?`预览`:`Preview`]].map(([e,t,n])=>(0,Q.jsxs)(`button`,{type:`button`,onClick:()=>M(e),"aria-pressed":j===e,className:P(`inline-flex min-h-9 items-center gap-1.5 rounded-md px-2.5 text-xs font-medium transition-colors`,j===e?`bg-surface-panel text-fg shadow-surface`:`text-fg-muted hover:text-fg`),children:[(0,Q.jsx)(t,{className:`size-3.5`,"aria-hidden":!0}),n]},e))})]}),t===`SOUL.md`&&!u?(0,Q.jsxs)(`div`,{className:`mt-4`,children:[(0,Q.jsx)(`button`,{type:`button`,disabled:f,"aria-expanded":D,onClick:()=>O(!D),className:`text-xs font-medium text-accent hover:underline`,children:n?`使用模板`:`Use a template`}),k===null?null:(0,Q.jsx)(`button`,{type:`button`,className:`ml-3 text-xs text-accent hover:underline`,onClick:()=>{s(k),A(null)},children:n?`撤销模板替换`:`Undo template replacement`}),D?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`p`,{className:`my-2 text-xs text-fg-muted`,children:n?`模板会替换当前个性正文,保存前可以撤销。`:`A template replaces the personality text. You can undo before saving.`}),(0,Q.jsx)(`div`,{className:`grid gap-2 sm:grid-cols-4`,children:Ne.map((e,t)=>(0,Q.jsxs)(`button`,{type:`button`,onClick:()=>{e.content&&(A(o),s(t=>Me(t,e.content))),M(`direct`)},className:`flex min-h-11 items-center gap-2 rounded-xl border border-edge px-3 py-2 text-left text-xs font-medium text-fg-muted transition-colors hover:border-accent/40 hover:bg-surface-hover hover:text-fg`,children:[(0,Q.jsx)(L[t]??g,{className:`size-4 shrink-0 text-accent`,"aria-hidden":!0}),n?e.labelZh:e.labelEn]},e.id))})]}):null]}):null,v?(0,Q.jsx)(`p`,{className:`mt-4 rounded-lg bg-red-500/10 px-3 py-2 text-sm text-red-600`,role:`alert`,children:v}):null,(0,Q.jsx)(`div`,{className:`mt-4 h-[min(40vh,22rem)] min-h-64 overflow-hidden rounded-xl border border-edge bg-surface-panel`,children:u?(0,Q.jsx)(ze,{}):f?(0,Q.jsx)(`div`,{className:`flex h-full items-center justify-center p-6 text-center text-sm text-fg-muted`,children:n?`无法加载角色配置,未对文件进行任何更改。`:`Profile documents could not be loaded. No files were changed.`}):j===`direct`?(0,Q.jsx)(X.Suspense,{fallback:(0,Q.jsx)(ze,{}),children:(0,Q.jsx)(Le,{initialContent:R,onChange:e=>s(t=>Me(t,e)),placeholder:n?`直接输入内容,或输入 / 使用快捷命令…`:`Start writing, or type / for commands…`},`${e}-${t}-direct`)}):j===`source`?(0,Q.jsx)(X.Suspense,{fallback:(0,Q.jsx)(ze,{}),children:(0,Q.jsx)(Re,{initialContent:o,onChange:e=>s(e),isDark:a,lineWrap:!0,className:`min-h-0 flex-1`},`${e}-${t}-source`)}):(0,Q.jsx)(`div`,{className:`h-full overflow-y-auto p-5`,children:R.trim()?(0,Q.jsx)(w,{content:R}):(0,Q.jsx)(`p`,{className:`text-sm italic text-fg-muted`,children:n?`暂无内容。`:`No content yet.`})})}),(0,Q.jsx)(`div`,{className:`mt-2 flex justify-end text-xs text-fg-muted`,"aria-live":`polite`,children:m?n?`正在保存角色配置…`:`Saving profile documents…`:N?n?`角色配置有未保存的更改`:`Profile documents have unsaved changes`:x?n?`文档更改已保存`:`Document changes saved`:n?`未修改`:`No changes`})]})})})});function Ve(e){let t=(0,Z.c)(2),{children:n}=e,r;return t[0]===n?r=t[1]:(r=(0,Q.jsx)(`span`,{className:`rounded-full bg-accent-soft px-2 py-0.5 text-[10px] font-medium text-accent`,children:n}),t[0]=n,t[1]=r),r}function He(e){let t=(0,Z.c)(74),{label:n,inherited:r,value:i,zh:a,allowChatFallback:o,allowDisabled:s,modelKind:c,onChange:l}=e,u=o!==void 0&&o,d=s!==void 0&&s,f=c===void 0?`text`:c,p=i!=null,m;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(m={revalidateOnFocus:!1},t[0]=m):m=t[0];let h=R(p&&f!==`image`?V:null,B,m),g;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(g={revalidateOnFocus:!1},t[1]=g):g=t[1];let _=R(p&&f===`image`?`agent-defaults-image-models`:null,ke,g),v;t[2]===_.data?v=t[3]:(v=_.data??[],t[2]=_.data,t[3]=v);let y;t[4]===v?y=t[5]:(y=v.flatMap(We),t[4]=v,t[5]=y);let b=y,x;t[6]!==b||t[7]!==f||t[8]!==h?(x=f===`image`?b:h.data??[],t[6]=b,t[7]=f,t[8]=h,t[9]=x):x=t[9];let S=x,C;t[10]!==f||t[11]!==S?(C=f===`vision`?S.filter(Ue):S,t[10]=f,t[11]=S,t[12]=C):C=t[12];let w=C,T=f===`image`?_:h,E;t[13]===n?E=t[14]:(E=(0,Q.jsx)(`h4`,{className:`text-sm font-medium text-fg`,children:n}),t[13]=n,t[14]=E);let D;t[15]!==i||t[16]!==a?(D=i===void 0?(0,Q.jsx)(Ve,{children:a?`继承全局`:`Inherited globally`}):null,t[15]=i,t[16]=a,t[17]=D):D=t[17];let O;t[18]!==d||t[19]!==i||t[20]!==a?(O=i===null?(0,Q.jsx)(Ve,{children:d?a?`已禁用`:`Disabled`:a?`使用 Chat`:`Uses Chat`}):null,t[18]=d,t[19]=i,t[20]=a,t[21]=O):O=t[21];let k;t[22]!==E||t[23]!==D||t[24]!==O?(k=(0,Q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[E,D,O]}),t[22]=E,t[23]=D,t[24]=O,t[25]=k):k=t[25];let A;t[26]!==r?.primary||t[27]!==i||t[28]!==a?(A=i===void 0?(0,Q.jsx)(`p`,{className:`mt-1 truncate font-mono text-xs text-fg-muted`,children:r?.primary??(a?`全局未配置`:`Not configured globally`)}):null,t[26]=r?.primary,t[27]=i,t[28]=a,t[29]=A):A=t[29];let j;t[30]!==k||t[31]!==A?(j=(0,Q.jsxs)(`div`,{className:`min-w-0`,children:[k,A]}),t[30]=k,t[31]=A,t[32]=j):j=t[32];let M;t[33]!==l||t[34]!==i||t[35]!==a?(M=i===void 0?null:(0,Q.jsx)(q,{variant:`ghost`,className:`px-2 py-1 text-xs`,onClick:()=>l(void 0),children:a?`继承全局`:`Inherit globally`}),t[33]=l,t[34]=i,t[35]=a,t[36]=M):M=t[36];let N;t[37]!==u||t[38]!==l||t[39]!==i||t[40]!==a?(N=u&&i!==null?(0,Q.jsx)(q,{variant:`ghost`,className:`px-2 py-1 text-xs`,onClick:()=>l(null),children:a?`使用 Chat`:`Use Chat`}):null,t[37]=u,t[38]=l,t[39]=i,t[40]=a,t[41]=N):N=t[41];let P;t[42]!==d||t[43]!==l||t[44]!==i||t[45]!==a?(P=d&&i!==null?(0,Q.jsx)(q,{variant:`ghost`,className:`px-2 py-1 text-xs`,onClick:()=>l(null),children:a?`禁用`:`Disable`}):null,t[42]=d,t[43]=l,t[44]=i,t[45]=a,t[46]=P):P=t[46];let I;t[47]!==p||t[48]!==r?.fallbacks||t[49]!==r?.primary||t[50]!==l||t[51]!==a?(I=p?null:(0,Q.jsx)(q,{className:`px-2 py-1 text-xs`,onClick:()=>l({primary:r?.primary??``,fallbacks:[...r?.fallbacks??[]]}),children:a?`单独设置`:`Override for this agent`}),t[47]=p,t[48]=r?.fallbacks,t[49]=r?.primary,t[50]=l,t[51]=a,t[52]=I):I=t[52];let L;t[53]!==M||t[54]!==N||t[55]!==P||t[56]!==I?(L=(0,Q.jsxs)(`div`,{className:`flex gap-1`,children:[M,N,P,I]}),t[53]=M,t[54]=N,t[55]=P,t[56]=I,t[57]=L):L=t[57];let z;t[58]!==j||t[59]!==L?(z=(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[j,L]}),t[58]=j,t[59]=L,t[60]=z):z=t[60];let H;t[61]!==w||t[62]!==p||t[63]!==n||t[64]!==f||t[65]!==S||t[66]!==l||t[67]!==T||t[68]!==i||t[69]!==a?(H=p?(0,Q.jsxs)(`div`,{className:`mt-4 grid gap-3 sm:grid-cols-[minmax(0,1fr)_minmax(0,0.8fr)]`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`p`,{className:`text-xs font-medium text-fg-muted`,children:a?`主模型`:`Primary model`}),T.isLoading?(0,Q.jsx)(F,{className:`mt-1.5 h-11 w-full rounded-lg`}):(0,Q.jsx)(_e,{value:i.primary,models:S,modelsLoading:T.isLoading,modelsError:T.error,capabilitiesFilter:f===`vision`?`vision`:void 0,placeholder:a?`选择模型`:`Select a model`,searchPlaceholder:a?`搜索模型或服务商`:`Search models or providers`,noMatches:a?`没有匹配的模型`:`No matching models`,contentAlign:`start`,className:`mt-1.5 w-full`,ariaLabel:a?`${n}主模型`:`${n} primary model`,onChange:e=>l({...i,primary:e})})]}),(0,Q.jsx)(Ce,{title:a?`备用模型`:`Fallback models`,summary:a?`已配置 ${i.fallbacks.length} 个备用模型`:`${i.fallbacks.length} fallback models configured`,children:(0,Q.jsx)(Ae,{primary:i.primary,value:i.fallbacks,models:w,loading:T.isLoading,error:T.error,zh:a,onChange:e=>l({...i,fallbacks:e})})})]}):null,t[61]=w,t[62]=p,t[63]=n,t[64]=f,t[65]=S,t[66]=l,t[67]=T,t[68]=i,t[69]=a,t[70]=H):H=t[70];let U;return t[71]!==z||t[72]!==H?(U=(0,Q.jsxs)(`div`,{className:`rounded-2xl border border-edge bg-surface-base p-4`,children:[z,H]}),t[71]=z,t[72]=H,t[73]=U):U=t[73],U}function Ue(e){return e.vision}function We(e){return e.models.map(t=>({id:`${e.id}/${t}`,name:t,provider:e.label}))}function Ge(e){let t=(0,Z.c)(88),{agentId:n,avatar:r,zh:i,disabled:a,pending:o,onPendingChange:s,onReadingChange:c,onChange:l}=e,[u,d]=(0,X.useState)(!1),f=(0,X.useRef)(null),p=(0,X.useRef)(null),[m,h]=(0,X.useState)(!1),[g,_]=(0,X.useState)(null),v,y;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(v=()=>()=>p.current?.abort(),y=[],t[0]=v,t[1]=y):(v=t[0],y=t[1]),(0,X.useEffect)(v,y);let b=i?`自动头像`:`Automatic`,x;t[2]===b?x=t[3]:(x={value:``,label:b},t[2]=b,t[3]=x);let S=i?`Loopi · 平静`:`Loopi · Calm`,C;t[4]===S?C=t[5]:(C={value:`xopc:loopi:idle`,label:S},t[4]=S,t[5]=C);let w=i?`Loopi · 温暖`:`Loopi · Warm`,T;t[6]===w?T=t[7]:(T={value:`xopc:loopi:care`,label:w},t[6]=w,t[7]=T);let E=i?`Loopi · 好奇`:`Loopi · Curious`,D;t[8]===E?D=t[9]:(D={value:`xopc:loopi:curious`,label:E},t[8]=E,t[9]=D);let O=i?`Loopi · 倾听`:`Loopi · Listening`,k;t[10]===O?k=t[11]:(k={value:`xopc:loopi:listen`,label:O},t[10]=O,t[11]=k);let A;t[12]===n?A=t[13]:(A=se(`bottts`,n),t[12]=n,t[13]=A);let j=i?`机器人`:`Robot`,N;t[14]!==A||t[15]!==j?(N={value:A,label:j},t[14]=A,t[15]=j,t[16]=N):N=t[16];let F;t[17]===n?F=t[18]:(F=se(`adventurer`,n),t[17]=n,t[18]=F);let I=i?`插画人物`:`Illustration`,L;t[19]!==F||t[20]!==I?(L={value:F,label:I},t[19]=F,t[20]=I,t[21]=L):L=t[21];let R;t[22]!==D||t[23]!==k||t[24]!==N||t[25]!==L||t[26]!==x||t[27]!==C||t[28]!==T?(R=[x,C,T,D,k,N,L],t[22]=D,t[23]=k,t[24]=N,t[25]=L,t[26]=x,t[27]=C,t[28]=T,t[29]=R):R=t[29];let z=R,B=z.find(e=>e.value===(r??``))?.label??(i?`自定义头像`:`Custom avatar`),V;t[30]!==l||t[31]!==s||t[32]!==c||t[33]!==i?(V=e=>{if(!e)return;if(_(null),![`image/png`,`image/jpeg`,`image/webp`].includes(e.type)){_(i?`请选择 PNG、JPG 或 WebP 图片。`:`Choose a PNG, JPG, or WebP image.`);return}if(!e.size||e.size>524288){_(i?`图片不能为空,且不能超过 512 KB。`:`The image must be non-empty and at most 512 KB.`);return}h(!0),c(!0);let t=new FileReader;p.current=t;let n=()=>{h(!1),c(!1),p.current=null};t.onload=()=>{let r=String(t.result);s({base64:r.slice(r.indexOf(`,`)+1),mimeType:e.type,preview:r}),l(ce),n()},t.onerror=()=>{_(i?`图片读取失败,请重新选择。`:`Could not read the image. Choose it again.`),n()},t.readAsDataURL(e)},t[30]=l,t[31]=s,t[32]=c,t[33]=i,t[34]=V):V=t[34];let H=V,U;t[35]===H?U=t[36]:(U=(0,Q.jsx)(`input`,{ref:f,type:`file`,accept:`image/png,image/jpeg,image/webp`,hidden:!0,onChange:e=>{H(e.target.files?.[0]),e.target.value=``}}),t[35]=H,t[36]=U);let W=a||m,G;t[37]===Symbol.for(`react.memo_cache_sentinel`)?(G=()=>f.current?.click(),t[37]=G):G=t[37];let ee=i?`上传头像`:`Upload avatar`,te=`avatar-help-${n}`,K;t[38]!==n||t[39]!==r||t[40]!==o?(K=o?(0,Q.jsx)(`img`,{src:o.preview,alt:``,width:64,height:64,className:`size-full object-cover`}):(0,Q.jsx)(ue,{agentId:n,avatar:r,size:64}),t[38]=n,t[39]=r,t[40]=o,t[41]=K):K=t[41];let ne;t[42]===Symbol.for(`react.memo_cache_sentinel`)?(ne=(0,Q.jsx)(`span`,{className:`absolute inset-x-0 bottom-0 flex h-5 items-center justify-center bg-black/55 text-white`,children:(0,Q.jsx)(M,{className:`size-3`,"aria-hidden":!0})}),t[42]=ne):ne=t[42];let re;t[43]!==W||t[44]!==ee||t[45]!==te||t[46]!==K?(re=(0,Q.jsxs)(`button`,{type:`button`,disabled:W,onClick:G,"aria-label":ee,"aria-describedby":te,className:`group relative size-16 shrink-0 overflow-hidden rounded-full focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-accent disabled:opacity-50`,children:[K,ne]}),t[43]=W,t[44]=ee,t[45]=te,t[46]=K,t[47]=re):re=t[47];let ie=i?`头像`:`Avatar`,J;t[48]===ie?J=t[49]:(J=(0,Q.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:ie}),t[48]=ie,t[49]=J);let ae=m?i?`正在读取图片…`:`Reading image…`:o?i?`新头像 · 保存后生效`:`New avatar · save to apply`:B,oe;t[50]===ae?oe=t[51]:(oe=(0,Q.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:ae}),t[50]=ae,t[51]=oe);let le=`avatar-help-${n}`,de=i?`点击头像上传 · PNG、JPG、WebP · 最大 512 KB`:`Click to upload · PNG, JPG, WebP · Max 512 KB`,Y;t[52]!==le||t[53]!==de?(Y=(0,Q.jsx)(`p`,{id:le,className:`mt-1 text-xs text-fg-muted`,children:de}),t[52]=le,t[53]=de,t[54]=Y):Y=t[54];let fe;t[55]!==J||t[56]!==oe||t[57]!==Y?(fe=(0,Q.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[J,oe,Y]}),t[55]=J,t[56]=oe,t[57]=Y,t[58]=fe):fe=t[58];let pe=a||m,me=`avatar-options-${n}`,he;t[59]===u?he=t[60]:(he=()=>d(!u),t[59]=u,t[60]=he);let ge=u?i?`收起选择`:`Hide choices`:i?`默认头像`:`Built-in avatars`,_e;t[61]!==u||t[62]!==pe||t[63]!==me||t[64]!==he||t[65]!==ge?(_e=(0,Q.jsx)(q,{variant:`ghost`,disabled:pe,"aria-expanded":u,"aria-controls":me,onClick:he,children:ge}),t[61]=u,t[62]=pe,t[63]=me,t[64]=he,t[65]=ge,t[66]=_e):_e=t[66];let ve;t[67]!==U||t[68]!==re||t[69]!==fe||t[70]!==_e?(ve=(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-4`,children:[U,re,fe,_e]}),t[67]=U,t[68]=re,t[69]=fe,t[70]=_e,t[71]=ve):ve=t[71];let ye;t[72]!==n||t[73]!==r||t[74]!==u||t[75]!==a||t[76]!==l||t[77]!==s||t[78]!==z||t[79]!==m||t[80]!==i?(ye=u?(0,Q.jsx)(`div`,{id:`avatar-options-${n}`,className:`grid grid-cols-3 gap-2 sm:grid-cols-4`,role:`group`,"aria-label":i?`选择头像`:`Choose avatar`,children:z.map(e=>(0,Q.jsxs)(`button`,{type:`button`,disabled:a||m,"aria-pressed":(r??``)===e.value,onClick:()=>{s(null),l(e.value),_(null)},className:P(`flex min-h-24 flex-col items-center gap-2 rounded-xl border p-3 text-xs transition-colors focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-accent`,(r??``)===e.value?`border-accent bg-accent-soft text-fg`:`border-edge bg-surface-panel text-fg-muted hover:bg-surface-hover`),children:[(0,Q.jsx)(ue,{agentId:n,avatar:e.value,size:44}),e.label]},e.value))}):null,t[72]=n,t[73]=r,t[74]=u,t[75]=a,t[76]=l,t[77]=s,t[78]=z,t[79]=m,t[80]=i,t[81]=ye):ye=t[81];let be;t[82]===g?be=t[83]:(be=g?(0,Q.jsx)(`p`,{role:`alert`,className:`text-xs text-danger`,children:g}):null,t[82]=g,t[83]=be);let xe;return t[84]!==ve||t[85]!==ye||t[86]!==be?(xe=(0,Q.jsxs)(`div`,{className:`space-y-3`,children:[ve,ye,be]}),t[84]=ve,t[85]=ye,t[86]=be,t[87]=xe):xe=t[87],xe}var Ke={version:1,domains:[],taskTypes:[],inputKinds:[],outputKinds:[],specialties:[],examples:[],limitations:[]},qe=`mt-1.5 w-full rounded-xl border border-edge bg-surface-base px-3 py-2 text-sm text-fg outline-none focus:border-accent`,Je=e=>e.split(`
66
+ Sharp, direct, slightly nerdy. The kind of engineer you'd want on your team — competent, opinionated, and occasionally funny.`},{id:`custom`,labelEn:`Custom`,labelZh:`自定义`,emoji:`✍️`,content:``}],Pe=[{value:`AI assistant`,labelEn:`AI Assistant`,labelZh:`AI 助手`},{value:`robot`,labelEn:`Robot`,labelZh:`机器人`},{value:`familiar`,labelEn:`Familiar`,labelZh:`精灵`},{value:`ghost in the machine`,labelEn:`Ghost in the machine`,labelZh:`机器幽灵`},{value:`digital companion`,labelEn:`Digital Companion`,labelZh:`数字伙伴`}],Q=r(),Fe=()=>i(()=>import(`./block-editor-DrZyRQQ0.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46])),Ie=()=>i(()=>import(`./markdown-editor-CjQJ-Nho.js`),__vite__mapDeps([47,1,2,43,48,18])),Le=(0,X.lazy)(()=>Fe().then(e=>({default:e.BlockEditor}))),Re=(0,X.lazy)(()=>Ie().then(e=>({default:e.MarkdownEditor})));function ze(){let e=(0,Z.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Q.jsxs)(`div`,{className:`space-y-3 p-5`,"aria-busy":`true`,children:[(0,Q.jsx)(F,{className:`h-8 w-52`}),(0,Q.jsx)(F,{className:`h-4 w-full`}),(0,Q.jsx)(F,{className:`h-4 w-4/5`}),(0,Q.jsx)(F,{className:`h-4 w-11/12`})]}),e[0]=t):t=e[0],t}var Be=(0,X.forwardRef)(function({agentId:e,file:t,zh:n,onDirtyChange:r},i){let a=ae(e=>e.resolved===`dark`),[o,s]=(0,X.useState)(``),[c,l]=(0,X.useState)(``),[u,d]=(0,X.useState)(!0),[f,p]=(0,X.useState)(!1),[m,h]=(0,X.useState)(!1),[v,y]=(0,X.useState)(null),[x,T]=(0,X.useState)(!1),[D,O]=(0,X.useState)(!1),[k,A]=(0,X.useState)(null),[j,M]=(0,X.useState)(`direct`);(0,X.useEffect)(()=>{let n=!1;return d(!0),p(!1),y(null),s(``),l(``),T(!1),A(null),(async()=>{try{let r=await U(e),i=new Set(r.files.filter(e=>!e.missing).map(e=>e.name)).has(t)?await te(e,t):``;if(n)return;s(i),l(i)}catch(e){if(n)return;p(!0),y(e instanceof Error?e.message:String(e))}finally{n||d(!1)}})(),()=>{n=!0}},[e,t]);let N=o!==c;(0,X.useEffect)(()=>r(N),[N,r]);let F=(0,X.useCallback)(async()=>{if(N){h(!0),y(null);try{await K(e,t,o),l(o),T(!0),A(null)}catch(e){throw y(e instanceof Error?e.message:String(e)),e}finally{h(!1)}}},[e,t,N,o]);(0,X.useImperativeHandle)(i,()=>({save:F}),[F]);let I={"SOUL.md":{label:n?`个性与边界`:`Personality & boundaries`,description:n?`定义语气、价值观、行为原则与安全边界。`:`Tone, values, behavior principles, and safety boundaries.`},"TOOLS.md":{label:n?`工具使用约定`:`Tool guidance`,description:n?`补充工具偏好和使用约定,不负责授予权限。`:`Tool preferences and conventions; this does not grant access.`},"AGENTS.md":{label:n?`工作规范`:`Working instructions`,description:n?`该智能体长期遵循的协作和执行规范。`:`Persistent collaboration and execution instructions.`}},L=[_,C,b,E],R=je(o).body;return(0,Q.jsx)(`div`,{className:`space-y-5`,children:(0,Q.jsx)(`section`,{className:`overflow-hidden rounded-2xl border border-edge bg-surface-base`,children:(0,Q.jsxs)(`div`,{className:`p-4 sm:p-5`,children:[(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`h4`,{className:`text-sm font-semibold text-fg`,children:I[t].label}),(0,Q.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:I[t].description})]}),(0,Q.jsx)(de,{className:`flex rounded-lg bg-surface-hover p-1`,role:`group`,"aria-label":n?`编辑模式`:`Editor mode`,indicatorClassName:`rounded-md bg-surface-panel shadow-surface`,children:[[`direct`,E,n?`直接编辑`:`Visual`],[`source`,b,`Markdown`],[`preview`,S,n?`预览`:`Preview`]].map(([e,t,n])=>(0,Q.jsxs)(`button`,{type:`button`,onClick:()=>M(e),"aria-pressed":j===e,className:P(`inline-flex min-h-9 items-center gap-1.5 rounded-md px-2.5 text-xs font-medium transition-colors`,j===e?`bg-surface-panel text-fg shadow-surface`:`text-fg-muted hover:text-fg`),children:[(0,Q.jsx)(t,{className:`size-3.5`,"aria-hidden":!0}),n]},e))})]}),t===`SOUL.md`&&!u?(0,Q.jsxs)(`div`,{className:`mt-4`,children:[(0,Q.jsx)(`button`,{type:`button`,disabled:f,"aria-expanded":D,onClick:()=>O(!D),className:`text-xs font-medium text-accent hover:underline`,children:n?`使用模板`:`Use a template`}),k===null?null:(0,Q.jsx)(`button`,{type:`button`,className:`ml-3 text-xs text-accent hover:underline`,onClick:()=>{s(k),A(null)},children:n?`撤销模板替换`:`Undo template replacement`}),D?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`p`,{className:`my-2 text-xs text-fg-muted`,children:n?`模板会替换当前个性正文,保存前可以撤销。`:`A template replaces the personality text. You can undo before saving.`}),(0,Q.jsx)(`div`,{className:`grid gap-2 sm:grid-cols-4`,children:Ne.map((e,t)=>(0,Q.jsxs)(`button`,{type:`button`,onClick:()=>{e.content&&(A(o),s(t=>Me(t,e.content))),M(`direct`)},className:`flex min-h-11 items-center gap-2 rounded-xl border border-edge px-3 py-2 text-left text-xs font-medium text-fg-muted transition-colors hover:border-accent/40 hover:bg-surface-hover hover:text-fg`,children:[(0,Q.jsx)(L[t]??g,{className:`size-4 shrink-0 text-accent`,"aria-hidden":!0}),n?e.labelZh:e.labelEn]},e.id))})]}):null]}):null,v?(0,Q.jsx)(`p`,{className:`mt-4 rounded-lg bg-red-500/10 px-3 py-2 text-sm text-red-600`,role:`alert`,children:v}):null,(0,Q.jsx)(`div`,{className:`mt-4 h-[min(40vh,22rem)] min-h-64 overflow-hidden rounded-xl border border-edge bg-surface-panel`,children:u?(0,Q.jsx)(ze,{}):f?(0,Q.jsx)(`div`,{className:`flex h-full items-center justify-center p-6 text-center text-sm text-fg-muted`,children:n?`无法加载角色配置,未对文件进行任何更改。`:`Profile documents could not be loaded. No files were changed.`}):j===`direct`?(0,Q.jsx)(X.Suspense,{fallback:(0,Q.jsx)(ze,{}),children:(0,Q.jsx)(Le,{initialContent:R,onChange:e=>s(t=>Me(t,e)),placeholder:n?`直接输入内容,或输入 / 使用快捷命令…`:`Start writing, or type / for commands…`},`${e}-${t}-direct`)}):j===`source`?(0,Q.jsx)(X.Suspense,{fallback:(0,Q.jsx)(ze,{}),children:(0,Q.jsx)(Re,{initialContent:o,onChange:e=>s(e),isDark:a,lineWrap:!0,className:`min-h-0 flex-1`},`${e}-${t}-source`)}):(0,Q.jsx)(`div`,{className:`h-full overflow-y-auto p-5`,children:R.trim()?(0,Q.jsx)(w,{content:R}):(0,Q.jsx)(`p`,{className:`text-sm italic text-fg-muted`,children:n?`暂无内容。`:`No content yet.`})})}),(0,Q.jsx)(`div`,{className:`mt-2 flex justify-end text-xs text-fg-muted`,"aria-live":`polite`,children:m?n?`正在保存角色配置…`:`Saving profile documents…`:N?n?`角色配置有未保存的更改`:`Profile documents have unsaved changes`:x?n?`文档更改已保存`:`Document changes saved`:n?`未修改`:`No changes`})]})})})});function Ve(e){let t=(0,Z.c)(2),{children:n}=e,r;return t[0]===n?r=t[1]:(r=(0,Q.jsx)(`span`,{className:`rounded-full bg-accent-soft px-2 py-0.5 text-[10px] font-medium text-accent`,children:n}),t[0]=n,t[1]=r),r}function He(e){let t=(0,Z.c)(74),{label:n,inherited:r,value:i,zh:a,allowChatFallback:o,allowDisabled:s,modelKind:c,onChange:l}=e,u=o!==void 0&&o,d=s!==void 0&&s,f=c===void 0?`text`:c,p=i!=null,m;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(m={revalidateOnFocus:!1},t[0]=m):m=t[0];let h=R(p&&f!==`image`?V:null,B,m),g;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(g={revalidateOnFocus:!1},t[1]=g):g=t[1];let _=R(p&&f===`image`?`agent-defaults-image-models`:null,ke,g),v;t[2]===_.data?v=t[3]:(v=_.data??[],t[2]=_.data,t[3]=v);let y;t[4]===v?y=t[5]:(y=v.flatMap(We),t[4]=v,t[5]=y);let b=y,x;t[6]!==b||t[7]!==f||t[8]!==h?(x=f===`image`?b:h.data??[],t[6]=b,t[7]=f,t[8]=h,t[9]=x):x=t[9];let S=x,C;t[10]!==f||t[11]!==S?(C=f===`vision`?S.filter(Ue):S,t[10]=f,t[11]=S,t[12]=C):C=t[12];let w=C,T=f===`image`?_:h,E;t[13]===n?E=t[14]:(E=(0,Q.jsx)(`h4`,{className:`text-sm font-medium text-fg`,children:n}),t[13]=n,t[14]=E);let D;t[15]!==i||t[16]!==a?(D=i===void 0?(0,Q.jsx)(Ve,{children:a?`继承全局`:`Inherited globally`}):null,t[15]=i,t[16]=a,t[17]=D):D=t[17];let O;t[18]!==d||t[19]!==i||t[20]!==a?(O=i===null?(0,Q.jsx)(Ve,{children:d?a?`已禁用`:`Disabled`:a?`使用 Chat`:`Uses Chat`}):null,t[18]=d,t[19]=i,t[20]=a,t[21]=O):O=t[21];let k;t[22]!==E||t[23]!==D||t[24]!==O?(k=(0,Q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[E,D,O]}),t[22]=E,t[23]=D,t[24]=O,t[25]=k):k=t[25];let A;t[26]!==r?.primary||t[27]!==i||t[28]!==a?(A=i===void 0?(0,Q.jsx)(`p`,{className:`mt-1 truncate font-mono text-xs text-fg-muted`,children:r?.primary??(a?`全局未配置`:`Not configured globally`)}):null,t[26]=r?.primary,t[27]=i,t[28]=a,t[29]=A):A=t[29];let j;t[30]!==k||t[31]!==A?(j=(0,Q.jsxs)(`div`,{className:`min-w-0`,children:[k,A]}),t[30]=k,t[31]=A,t[32]=j):j=t[32];let M;t[33]!==l||t[34]!==i||t[35]!==a?(M=i===void 0?null:(0,Q.jsx)(q,{variant:`ghost`,className:`px-2 py-1 text-xs`,onClick:()=>l(void 0),children:a?`继承全局`:`Inherit globally`}),t[33]=l,t[34]=i,t[35]=a,t[36]=M):M=t[36];let N;t[37]!==u||t[38]!==l||t[39]!==i||t[40]!==a?(N=u&&i!==null?(0,Q.jsx)(q,{variant:`ghost`,className:`px-2 py-1 text-xs`,onClick:()=>l(null),children:a?`使用 Chat`:`Use Chat`}):null,t[37]=u,t[38]=l,t[39]=i,t[40]=a,t[41]=N):N=t[41];let P;t[42]!==d||t[43]!==l||t[44]!==i||t[45]!==a?(P=d&&i!==null?(0,Q.jsx)(q,{variant:`ghost`,className:`px-2 py-1 text-xs`,onClick:()=>l(null),children:a?`禁用`:`Disable`}):null,t[42]=d,t[43]=l,t[44]=i,t[45]=a,t[46]=P):P=t[46];let I;t[47]!==p||t[48]!==r?.fallbacks||t[49]!==r?.primary||t[50]!==l||t[51]!==a?(I=p?null:(0,Q.jsx)(q,{className:`px-2 py-1 text-xs`,onClick:()=>l({primary:r?.primary??``,fallbacks:[...r?.fallbacks??[]]}),children:a?`单独设置`:`Override for this agent`}),t[47]=p,t[48]=r?.fallbacks,t[49]=r?.primary,t[50]=l,t[51]=a,t[52]=I):I=t[52];let L;t[53]!==M||t[54]!==N||t[55]!==P||t[56]!==I?(L=(0,Q.jsxs)(`div`,{className:`flex gap-1`,children:[M,N,P,I]}),t[53]=M,t[54]=N,t[55]=P,t[56]=I,t[57]=L):L=t[57];let z;t[58]!==j||t[59]!==L?(z=(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[j,L]}),t[58]=j,t[59]=L,t[60]=z):z=t[60];let H;t[61]!==w||t[62]!==p||t[63]!==n||t[64]!==f||t[65]!==S||t[66]!==l||t[67]!==T||t[68]!==i||t[69]!==a?(H=p?(0,Q.jsxs)(`div`,{className:`mt-4 grid gap-3 sm:grid-cols-[minmax(0,1fr)_minmax(0,0.8fr)]`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`p`,{className:`text-xs font-medium text-fg-muted`,children:a?`主模型`:`Primary model`}),T.isLoading?(0,Q.jsx)(F,{className:`mt-1.5 h-11 w-full rounded-lg`}):(0,Q.jsx)(_e,{value:i.primary,models:S,modelsLoading:T.isLoading,modelsError:T.error,capabilitiesFilter:f===`vision`?`vision`:void 0,placeholder:a?`选择模型`:`Select a model`,searchPlaceholder:a?`搜索模型或服务商`:`Search models or providers`,noMatches:a?`没有匹配的模型`:`No matching models`,contentAlign:`start`,className:`mt-1.5 w-full`,ariaLabel:a?`${n}主模型`:`${n} primary model`,onChange:e=>l({...i,primary:e})})]}),(0,Q.jsx)(Ce,{title:a?`备用模型`:`Fallback models`,summary:a?`已配置 ${i.fallbacks.length} 个备用模型`:`${i.fallbacks.length} fallback models configured`,children:(0,Q.jsx)(Ae,{primary:i.primary,value:i.fallbacks,models:w,loading:T.isLoading,error:T.error,zh:a,onChange:e=>l({...i,fallbacks:e})})})]}):null,t[61]=w,t[62]=p,t[63]=n,t[64]=f,t[65]=S,t[66]=l,t[67]=T,t[68]=i,t[69]=a,t[70]=H):H=t[70];let U;return t[71]!==z||t[72]!==H?(U=(0,Q.jsxs)(`div`,{className:`rounded-2xl border border-edge bg-surface-base p-4`,children:[z,H]}),t[71]=z,t[72]=H,t[73]=U):U=t[73],U}function Ue(e){return e.vision}function We(e){return e.models.map(t=>({id:`${e.id}/${t}`,name:t,provider:e.label}))}function Ge(e){let t=(0,Z.c)(88),{agentId:n,avatar:r,zh:i,disabled:a,pending:o,onPendingChange:s,onReadingChange:c,onChange:l}=e,[u,d]=(0,X.useState)(!1),f=(0,X.useRef)(null),p=(0,X.useRef)(null),[m,h]=(0,X.useState)(!1),[g,_]=(0,X.useState)(null),v,y;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(v=()=>()=>p.current?.abort(),y=[],t[0]=v,t[1]=y):(v=t[0],y=t[1]),(0,X.useEffect)(v,y);let b=i?`自动头像`:`Automatic`,x;t[2]===b?x=t[3]:(x={value:``,label:b},t[2]=b,t[3]=x);let S=i?`Loopi · 平静`:`Loopi · Calm`,C;t[4]===S?C=t[5]:(C={value:`xopc:loopi:idle`,label:S},t[4]=S,t[5]=C);let w=i?`Loopi · 温暖`:`Loopi · Warm`,T;t[6]===w?T=t[7]:(T={value:`xopc:loopi:care`,label:w},t[6]=w,t[7]=T);let E=i?`Loopi · 好奇`:`Loopi · Curious`,D;t[8]===E?D=t[9]:(D={value:`xopc:loopi:curious`,label:E},t[8]=E,t[9]=D);let O=i?`Loopi · 倾听`:`Loopi · Listening`,k;t[10]===O?k=t[11]:(k={value:`xopc:loopi:listen`,label:O},t[10]=O,t[11]=k);let A;t[12]===n?A=t[13]:(A=se(`bottts`,n),t[12]=n,t[13]=A);let j=i?`机器人`:`Robot`,N;t[14]!==A||t[15]!==j?(N={value:A,label:j},t[14]=A,t[15]=j,t[16]=N):N=t[16];let F;t[17]===n?F=t[18]:(F=se(`adventurer`,n),t[17]=n,t[18]=F);let I=i?`插画人物`:`Illustration`,L;t[19]!==F||t[20]!==I?(L={value:F,label:I},t[19]=F,t[20]=I,t[21]=L):L=t[21];let R;t[22]!==D||t[23]!==k||t[24]!==N||t[25]!==L||t[26]!==x||t[27]!==C||t[28]!==T?(R=[x,C,T,D,k,N,L],t[22]=D,t[23]=k,t[24]=N,t[25]=L,t[26]=x,t[27]=C,t[28]=T,t[29]=R):R=t[29];let z=R,B=z.find(e=>e.value===(r??``))?.label??(i?`自定义头像`:`Custom avatar`),V;t[30]!==l||t[31]!==s||t[32]!==c||t[33]!==i?(V=e=>{if(!e)return;if(_(null),![`image/png`,`image/jpeg`,`image/webp`].includes(e.type)){_(i?`请选择 PNG、JPG 或 WebP 图片。`:`Choose a PNG, JPG, or WebP image.`);return}if(!e.size||e.size>524288){_(i?`图片不能为空,且不能超过 512 KB。`:`The image must be non-empty and at most 512 KB.`);return}h(!0),c(!0);let t=new FileReader;p.current=t;let n=()=>{h(!1),c(!1),p.current=null};t.onload=()=>{let r=String(t.result);s({base64:r.slice(r.indexOf(`,`)+1),mimeType:e.type,preview:r}),l(ce),n()},t.onerror=()=>{_(i?`图片读取失败,请重新选择。`:`Could not read the image. Choose it again.`),n()},t.readAsDataURL(e)},t[30]=l,t[31]=s,t[32]=c,t[33]=i,t[34]=V):V=t[34];let H=V,U;t[35]===H?U=t[36]:(U=(0,Q.jsx)(`input`,{ref:f,type:`file`,accept:`image/png,image/jpeg,image/webp`,hidden:!0,onChange:e=>{H(e.target.files?.[0]),e.target.value=``}}),t[35]=H,t[36]=U);let W=a||m,G;t[37]===Symbol.for(`react.memo_cache_sentinel`)?(G=()=>f.current?.click(),t[37]=G):G=t[37];let ee=i?`上传头像`:`Upload avatar`,te=`avatar-help-${n}`,K;t[38]!==n||t[39]!==r||t[40]!==o?(K=o?(0,Q.jsx)(`img`,{src:o.preview,alt:``,width:64,height:64,className:`size-full object-cover`}):(0,Q.jsx)(ue,{agentId:n,avatar:r,size:64}),t[38]=n,t[39]=r,t[40]=o,t[41]=K):K=t[41];let ne;t[42]===Symbol.for(`react.memo_cache_sentinel`)?(ne=(0,Q.jsx)(`span`,{className:`absolute inset-x-0 bottom-0 flex h-5 items-center justify-center bg-black/55 text-white`,children:(0,Q.jsx)(M,{className:`size-3`,"aria-hidden":!0})}),t[42]=ne):ne=t[42];let re;t[43]!==W||t[44]!==ee||t[45]!==te||t[46]!==K?(re=(0,Q.jsxs)(`button`,{type:`button`,disabled:W,onClick:G,"aria-label":ee,"aria-describedby":te,className:`group relative size-16 shrink-0 overflow-hidden rounded-full focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-accent disabled:opacity-50`,children:[K,ne]}),t[43]=W,t[44]=ee,t[45]=te,t[46]=K,t[47]=re):re=t[47];let ie=i?`头像`:`Avatar`,J;t[48]===ie?J=t[49]:(J=(0,Q.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:ie}),t[48]=ie,t[49]=J);let ae=m?i?`正在读取图片…`:`Reading image…`:o?i?`新头像 · 保存后生效`:`New avatar · save to apply`:B,oe;t[50]===ae?oe=t[51]:(oe=(0,Q.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:ae}),t[50]=ae,t[51]=oe);let le=`avatar-help-${n}`,de=i?`点击头像上传 · PNG、JPG、WebP · 最大 512 KB`:`Click to upload · PNG, JPG, WebP · Max 512 KB`,Y;t[52]!==le||t[53]!==de?(Y=(0,Q.jsx)(`p`,{id:le,className:`mt-1 text-xs text-fg-muted`,children:de}),t[52]=le,t[53]=de,t[54]=Y):Y=t[54];let fe;t[55]!==J||t[56]!==oe||t[57]!==Y?(fe=(0,Q.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[J,oe,Y]}),t[55]=J,t[56]=oe,t[57]=Y,t[58]=fe):fe=t[58];let pe=a||m,me=`avatar-options-${n}`,he;t[59]===u?he=t[60]:(he=()=>d(!u),t[59]=u,t[60]=he);let ge=u?i?`收起选择`:`Hide choices`:i?`默认头像`:`Built-in avatars`,_e;t[61]!==u||t[62]!==pe||t[63]!==me||t[64]!==he||t[65]!==ge?(_e=(0,Q.jsx)(q,{variant:`ghost`,disabled:pe,"aria-expanded":u,"aria-controls":me,onClick:he,children:ge}),t[61]=u,t[62]=pe,t[63]=me,t[64]=he,t[65]=ge,t[66]=_e):_e=t[66];let ve;t[67]!==U||t[68]!==re||t[69]!==fe||t[70]!==_e?(ve=(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-4`,children:[U,re,fe,_e]}),t[67]=U,t[68]=re,t[69]=fe,t[70]=_e,t[71]=ve):ve=t[71];let ye;t[72]!==n||t[73]!==r||t[74]!==u||t[75]!==a||t[76]!==l||t[77]!==s||t[78]!==z||t[79]!==m||t[80]!==i?(ye=u?(0,Q.jsx)(`div`,{id:`avatar-options-${n}`,className:`grid grid-cols-3 gap-2 sm:grid-cols-4`,role:`group`,"aria-label":i?`选择头像`:`Choose avatar`,children:z.map(e=>(0,Q.jsxs)(`button`,{type:`button`,disabled:a||m,"aria-pressed":(r??``)===e.value,onClick:()=>{s(null),l(e.value),_(null)},className:P(`flex min-h-24 flex-col items-center gap-2 rounded-xl border p-3 text-xs transition-colors focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-accent`,(r??``)===e.value?`border-accent bg-accent-soft text-fg`:`border-edge bg-surface-panel text-fg-muted hover:bg-surface-hover`),children:[(0,Q.jsx)(ue,{agentId:n,avatar:e.value,size:44}),e.label]},e.value))}):null,t[72]=n,t[73]=r,t[74]=u,t[75]=a,t[76]=l,t[77]=s,t[78]=z,t[79]=m,t[80]=i,t[81]=ye):ye=t[81];let be;t[82]===g?be=t[83]:(be=g?(0,Q.jsx)(`p`,{role:`alert`,className:`text-xs text-danger`,children:g}):null,t[82]=g,t[83]=be);let xe;return t[84]!==ve||t[85]!==ye||t[86]!==be?(xe=(0,Q.jsxs)(`div`,{className:`space-y-3`,children:[ve,ye,be]}),t[84]=ve,t[85]=ye,t[86]=be,t[87]=xe):xe=t[87],xe}var Ke={version:1,domains:[],taskTypes:[],inputKinds:[],outputKinds:[],specialties:[],examples:[],limitations:[]},qe=`mt-1.5 w-full rounded-xl border border-edge bg-surface-base px-3 py-2 text-sm text-fg outline-none focus:border-accent`,Je=e=>e.split(`
67
67
  `).map(e=>e.trim()).filter(Boolean);function Ye(e){let t=(0,Z.c)(21),{value:n,label:r,hint:i,onChange:a,max:o}=e,s;t[0]===n?s=t[1]:(s=n.join(`
68
68
  `),t[0]=n,t[1]=s);let[c,l]=(0,X.useState)(s),u,d;t[2]!==c||t[3]!==n?(u=()=>{JSON.stringify(Je(c))!==JSON.stringify(n)&&l(n.join(`
69
69
  `))},d=[n,c],t[2]=c,t[3]=n,t[4]=u,t[5]=d):(u=t[4],d=t[5]),(0,X.useEffect)(u,d);let f;t[6]===a?f=t[7]:(f=e=>{l(e.target.value),a(Je(e.target.value))},t[6]=a,t[7]=f);let p;t[8]!==i||t[9]!==f||t[10]!==c?(p=(0,Q.jsx)(`textarea`,{rows:3,className:qe,value:c,placeholder:i,onChange:f}),t[8]=i,t[9]=f,t[10]=c,t[11]=p):p=t[11];let m;t[12]===c?m=t[13]:(m=Je(c),t[12]=c,t[13]=m);let h;t[14]!==o||t[15]!==m.length?(h=(0,Q.jsxs)(`span`,{className:`text-xs text-fg-subtle`,children:[m.length,`/`,o]}),t[14]=o,t[15]=m.length,t[16]=h):h=t[16];let g;return t[17]!==r||t[18]!==p||t[19]!==h?(g=(0,Q.jsxs)(`label`,{className:`text-xs font-medium text-fg-muted`,children:[r,p,h]}),t[17]=r,t[18]=p,t[19]=h,t[20]=g):g=t[20],g}var Xe={general:`通用`,coordination:`协调`,software:`软件开发`,writing:`写作`,research:`研究`,data:`数据`,design:`设计`,operations:`运营`,general_assistance:`日常协助`,task_planning:`任务规划`,bug_fix:`修复 Bug`,implementation:`功能开发`,code_review:`代码审查`,editing:`编辑润色`,news_research:`新闻研究`,data_analysis:`数据分析`,data_cleaning:`数据清洗`,image_generation:`生成图片`,automation:`自动化`,text:`文本`,repository:`代码仓库`,csv:`CSV`,spreadsheet:`电子表格`,web_page:`网页`,image:`图片`,answer:`回答`,plan:`计划`,code_patch:`代码修改`,document:`文档`,report:`报告`,chart:`图表`,script:`脚本`,design_brief:`设计说明`};function Ze(e){let t=(0,Z.c)(48),{field:n,value:r,label:i,zh:a,onChange:o}=e,s=I[n],c;if(t[0]!==r||t[1]!==s){let e;t[3]===s?e=t[4]:(e=e=>!s.includes(e),t[3]=s,t[4]=e),c=r.filter(e),t[0]=r,t[1]=s,t[2]=c}else c=t[2];let l=c,u;t[5]===a?u=t[6]:(u=e=>a?Xe[e]??e:e.replaceAll(`_`,` `),t[5]=a,t[6]=u);let d=u,f;t[7]!==d||t[8]!==r||t[9]!==a?(f=r.length?r.map(d).join(` · `):a?`选择适用项`:`Select applicable items`,t[7]=d,t[8]=r,t[9]=a,t[10]=f):f=t[10];let p;t[11]===f?p=t[12]:(p=(0,Q.jsx)(`span`,{className:`mt-1 block text-xs font-normal text-fg-muted`,children:f}),t[11]=f,t[12]=p);let m;t[13]!==i||t[14]!==p?(m=(0,Q.jsxs)(`summary`,{className:`cursor-pointer text-sm font-medium text-fg`,children:[i,p]}),t[13]=i,t[14]=p,t[15]=m):m=t[15];let h;if(t[16]!==d||t[17]!==r||t[18]!==s){let e;t[20]!==d||t[21]!==r?(e=e=>({value:e,label:d(e),disabled:r.length>=16&&!r.includes(e)}),t[20]=d,t[21]=r,t[22]=e):e=t[22],h=s.map(e),t[16]=d,t[17]=r,t[18]=s,t[19]=h}else h=t[19];let g;t[23]!==i||t[24]!==o||t[25]!==h||t[26]!==r?(g=(0,Q.jsx)(v,{options:h,values:r,multiple:!0,ariaLabel:i,onChange:o}),t[23]=i,t[24]=o,t[25]=h,t[26]=r,t[27]=g):g=t[27];let _=a?`自定义标识`:`Custom identifiers`,y;t[28]===_?y=t[29]:(y=(0,Q.jsx)(`summary`,{className:`cursor-pointer text-xs text-fg-muted`,children:_}),t[28]=_,t[29]=y);let b=a?`其他标识`:`Other identifiers`,x=a?`每行一个英文标识`:`One identifier per line`,S;t[30]!==o||t[31]!==r||t[32]!==s?(S=e=>o([...new Set([...r.filter(e=>s.includes(e)),...e])]),t[30]=o,t[31]=r,t[32]=s,t[33]=S):S=t[33];let C;t[34]!==l||t[35]!==b||t[36]!==x||t[37]!==S?(C=(0,Q.jsx)(Ye,{value:l,label:b,hint:x,max:16,onChange:S}),t[34]=l,t[35]=b,t[36]=x,t[37]=S,t[38]=C):C=t[38];let w;t[39]!==C||t[40]!==y?(w=(0,Q.jsxs)(`details`,{children:[y,C]}),t[39]=C,t[40]=y,t[41]=w):w=t[41];let T;t[42]!==w||t[43]!==g?(T=(0,Q.jsxs)(`div`,{className:`mt-3 space-y-3`,children:[g,w]}),t[42]=w,t[43]=g,t[44]=T):T=t[44];let E;return t[45]!==T||t[46]!==m?(E=(0,Q.jsxs)(`details`,{className:`min-w-0 rounded-xl border border-edge p-3`,children:[m,T]}),t[45]=T,t[46]=m,t[47]=E):E=t[47],E}function Qe(e){let t=(0,Z.c)(45),{profile:n,zh:r,onChange:i}=e,a=r?`领域`:`Domains`,o;t[0]===a?o=t[1]:(o=[`domains`,a,`software