@xopcai/xopc 0.0.420 → 0.0.422

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 (414) hide show
  1. package/dist/browser-ext/dist/background.js +184 -2
  2. package/dist/browser-ext/dist/sidepanel.js +9 -0
  3. package/dist/browser-ext/manifest.json +1 -1
  4. package/dist/extensions/telegram/xopc.extension.json +1 -1
  5. package/dist/gateway/static/root/assets/{activity-store-DnqOM8GN.js → activity-store-CvJ9rdwP.js} +1 -1
  6. package/dist/gateway/static/root/assets/{agent-avatar-dicebear-1UABT2KS.js → agent-avatar-dicebear-CFP6g4w7.js} +1 -1
  7. package/dist/gateway/static/root/assets/agent-avatar-display-BHBe88Gu.js +2 -0
  8. package/dist/gateway/static/root/assets/agent-defaults-settings-panel-DlGRuKMv.js +1 -0
  9. package/dist/gateway/static/root/assets/agent-plugin-dialog-C_Dm-u6_.js +1 -0
  10. package/dist/gateway/static/root/assets/{agents-O7mago-m.js → agents-BdVJHOiK.js} +5 -5
  11. package/dist/gateway/static/root/assets/{agents-admin-api-CyjykMEh.js → agents-admin-api-Do1Pza0R.js} +1 -1
  12. package/dist/gateway/static/root/assets/{api-Ddrs70xV.js → api-BQv5dLcH.js} +1 -1
  13. package/dist/gateway/static/root/assets/{api-C1dxxDZx.js → api-ONg37_fH.js} +1 -1
  14. package/dist/gateway/static/root/assets/app-link-1j40sJ-z.js +1 -0
  15. package/dist/gateway/static/root/assets/app-management-settings-panel-B4Wqhf4J.js +1 -0
  16. package/dist/gateway/static/root/assets/appearance-settings-Dm1kRzKL.js +1 -0
  17. package/dist/gateway/static/root/assets/apps-page-D1MMk1P7.js +1 -0
  18. package/dist/gateway/static/root/assets/{archive-plugin-n5lPr79c.js → archive-plugin-p_yLkyaC.js} +1 -1
  19. package/dist/gateway/static/root/assets/automation-api-DQaWBR03.js +1 -0
  20. package/dist/gateway/static/root/assets/automation-result-state-CO_243JM.js +1 -0
  21. package/dist/gateway/static/root/assets/automation-task-card-D2p9qlYE.js +3 -0
  22. package/dist/gateway/static/root/assets/{automations-page-oLsNzu_6.js → automations-page-Ba64H37d.js} +1 -1
  23. package/dist/gateway/static/root/assets/automations-workspace-BkzC3oIM.js +9 -0
  24. package/dist/gateway/static/root/assets/{binary-plugins-D9VW7dWP.js → binary-plugins-B-6kyqtt.js} +1 -1
  25. package/dist/gateway/static/root/assets/{block-editor-C477bTtO.js → block-editor-B5ysJ96n.js} +4 -4
  26. package/dist/gateway/static/root/assets/{browser-automation-inputs-CCiYXxmh.js → browser-automation-inputs-C2A3NIt3.js} +1 -1
  27. package/dist/gateway/static/root/assets/browser-automations-page-CnbXFw1_.js +3 -0
  28. package/dist/gateway/static/root/assets/{browser-control-api-Y3fvmeBk.js → browser-control-api-Aj_seKE9.js} +1 -1
  29. package/dist/gateway/static/root/assets/{browser-settings-page-DjkGahlz.js → browser-settings-page-C7fxPq_z.js} +2 -2
  30. package/dist/gateway/static/root/assets/{capabilities-DAyA681v.js → capabilities-BgtCwC_E.js} +1 -1
  31. package/dist/gateway/static/root/assets/{capabilities-DRVXLssH.js → capabilities-DOTgaSgA.js} +1 -1
  32. package/dist/gateway/static/root/assets/capabilities-page-m3b9sLFG.js +2 -0
  33. package/dist/gateway/static/root/assets/capabilities-settings-panel-pYWZtPeU.js +8 -0
  34. package/dist/gateway/static/root/assets/channels-DGpRM6pj.js +1 -0
  35. package/dist/gateway/static/root/assets/{chat-agents-api-D5nR_JVe.js → chat-agents-api-EvJ_Wvuc.js} +1 -1
  36. package/dist/gateway/static/root/assets/{chat-chart-block-K2t333qv.js → chat-chart-block-BQDbHLcw.js} +1 -1
  37. package/dist/gateway/static/root/assets/chat-page-GF9NIuZN.js +72 -0
  38. package/dist/gateway/static/root/assets/{chat-terminal-dock-CkFG6mA3.js → chat-terminal-dock-DHFTGoEp.js} +2 -2
  39. package/dist/gateway/static/root/assets/{list-filter-COkzTdOz.js → clipboard-copy-DuJk5WD6.js} +1 -1
  40. package/dist/gateway/static/root/assets/{command-palette-api-Do_66X1B.js → command-palette-api-DPA_yEuy.js} +1 -1
  41. package/dist/gateway/static/root/assets/composer-payload-handoff-BTjauSNp.js +1 -0
  42. package/dist/gateway/static/root/assets/{computer-settings-page-DBxOcMko.js → computer-settings-page-BFSSQfcx.js} +1 -1
  43. package/dist/gateway/static/root/assets/connected-providers-grid-DM2glQN3.js +1 -0
  44. package/dist/gateway/static/root/assets/{connector-service-page-rWpnchb3.js → connector-service-page-CFvg58qa.js} +1 -1
  45. package/dist/gateway/static/root/assets/{connectors-api-DIBG72k4.js → connectors-api-CbC6Yht5.js} +1 -1
  46. package/dist/gateway/static/root/assets/connectors-page-D7pipFHA.js +1 -0
  47. package/dist/gateway/static/root/assets/date-picker-Dd3MbG0x.js +1 -0
  48. package/dist/gateway/static/root/assets/{dependency-picker-7SpSfDSg.js → dependency-picker-DcsHg2ml.js} +1 -1
  49. package/dist/gateway/static/root/assets/desktop-pet-DldzQT2h.js +1 -0
  50. package/dist/gateway/static/root/assets/desktop-pet-settings-CYdI4KxB.js +1 -0
  51. package/dist/gateway/static/root/assets/{dev-view-store-57HgVuZ6.js → dev-view-store-JiJv585f.js} +1 -1
  52. package/dist/gateway/static/root/assets/device-pairing-wizard-D8cLc41G.js +1 -0
  53. package/dist/gateway/static/root/assets/{directory-picker-path-field-D4jMhpka.js → directory-picker-path-field-8WOXv8zw.js} +1 -1
  54. package/dist/gateway/static/root/assets/discussion-annotation-sync-B-grSe0w.js +1 -0
  55. package/dist/gateway/static/root/assets/{dist-DNCdG_qB.js → dist-D3lWNSe7.js} +1 -1
  56. package/dist/gateway/static/root/assets/{extension-debug-page-BsK2LMXQ.js → extension-debug-page-EEQkTNEu.js} +1 -1
  57. package/dist/gateway/static/root/assets/extension-iframe-host-vlZVeMCY.js +1 -0
  58. package/dist/gateway/static/root/assets/{extension-marketplace-api-CVJPqJOB.js → extension-marketplace-api-_o2In_al.js} +1 -1
  59. package/dist/gateway/static/root/assets/extension-page-CPrT111s.js +1 -0
  60. package/dist/gateway/static/root/assets/{extension-provider-Byrd8Sor.js → extension-provider-B2Mf3FBu.js} +1 -1
  61. package/dist/gateway/static/root/assets/extension-settings-page-CznJEgWV.js +1 -0
  62. package/dist/gateway/static/root/assets/{file-preview-surface-BlprUrIs.js → file-preview-surface-7h8_fZul.js} +1 -1
  63. package/dist/gateway/static/root/assets/{gateway-config-swr-BAmUhiP1.js → gateway-config-swr-DbbNEOKj.js} +1 -1
  64. package/dist/gateway/static/root/assets/{gateway-realtime-CsykKL4l.js → gateway-realtime-D20ZrAuM.js} +1 -1
  65. package/dist/gateway/static/root/assets/gateway-realtime-store-C6sMzYDT.js +1 -0
  66. package/dist/gateway/static/root/assets/gateway-restart-5ut-lhJm.js +1 -0
  67. package/dist/gateway/static/root/assets/{gateway-settings-BA5-Uuwx.js → gateway-settings-BCf_cibp.js} +1 -1
  68. package/dist/gateway/static/root/assets/{gateway-startup-retry-CtUB3g6N.js → gateway-startup-retry-DlHL0DpH.js} +1 -1
  69. package/dist/gateway/static/root/assets/{global-defaults-api-CINf-C6a.js → global-defaults-api-CmODomcV.js} +1 -1
  70. package/dist/gateway/static/root/assets/home-page-uz22TRB-.js +2 -0
  71. package/dist/gateway/static/root/assets/image-generation-api-dzPnpUFu.js +1 -0
  72. package/dist/gateway/static/root/assets/{imports-page-BWShtGRQ.js → imports-page-ChBoNMyE.js} +1 -1
  73. package/dist/gateway/static/root/assets/index-CSIg7V1A.js +11 -0
  74. package/dist/gateway/static/root/assets/index-Dv8mUlNN.css +1 -0
  75. package/dist/gateway/static/root/assets/install-connector-dialog-CNcdQDX0.js +1 -0
  76. package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-CdM4BQwp.js → keyboard-shortcuts-settings-CRbYq2_g.js} +1 -1
  77. package/dist/gateway/static/root/assets/list-filter-CIPvpfLA.js +1 -0
  78. package/dist/gateway/static/root/assets/local-app-workbench-page-04cX5TJu.js +1 -0
  79. package/dist/gateway/static/root/assets/{local-apps-page-CxyRVfjD.js → local-apps-page-fWM0FEhN.js} +1 -1
  80. package/dist/gateway/static/root/assets/{local-session-drafts-B9ZPwotC.js → local-session-drafts-ClrSe5mH.js} +1 -1
  81. package/dist/gateway/static/root/assets/{locale-store-lIXD1FMw.js → locale-store-VNjH18Dj.js} +1 -1
  82. package/dist/gateway/static/root/assets/logs-page-6GanGLrm.js +2 -0
  83. package/dist/gateway/static/root/assets/management-settings-BxD_lc4E.js +1 -0
  84. package/dist/gateway/static/root/assets/{markdown-view-CJt-i2Dp.js → markdown-view-DLCBYWtx.js} +4 -4
  85. package/dist/gateway/static/root/assets/{media-plugins-D_bR23mA.js → media-plugins-BvtNwKFb.js} +1 -1
  86. package/dist/gateway/static/root/assets/messages-Btr7C0hF.js +3 -0
  87. package/dist/gateway/static/root/assets/model-selector-DYUnp917.js +1 -0
  88. package/dist/gateway/static/root/assets/{models-hub-cache-za2fWJLg.js → models-hub-cache-_qE7L-_H.js} +1 -1
  89. package/dist/gateway/static/root/assets/navigation-D62kPsA9.js +1 -0
  90. package/dist/gateway/static/root/assets/note-detail-panel-bjRZesmS.js +5 -0
  91. package/dist/gateway/static/root/assets/note-image-lightbox-D7Jqb75C.js +1 -0
  92. package/dist/gateway/static/root/assets/{notes-api-C_458rv5.js → notes-api-Bxa11X3a.js} +1 -1
  93. package/dist/gateway/static/root/assets/notes-page-D2QpJ3WZ.js +8 -0
  94. package/dist/gateway/static/root/assets/{oauth-api-C3X9FLYw.js → oauth-api-DIE4UpP7.js} +1 -1
  95. package/dist/gateway/static/root/assets/{oauth-provider-connect-H81se_3n.js → oauth-provider-connect-B95tiddN.js} +1 -1
  96. package/dist/gateway/static/root/assets/open-capability-settings-Cvb65hQB.js +1 -0
  97. package/dist/gateway/static/root/assets/{page-context-capture-button-BkAlQ7cB.js → page-context-capture-button-C-QbbwmN.js} +1 -1
  98. package/dist/gateway/static/root/assets/{page-context-draft-ClLgaOaD.js → page-context-draft-BHmOfksL.js} +1 -1
  99. package/dist/gateway/static/root/assets/page-header-store-bPV8_tKL.js +1 -0
  100. package/dist/gateway/static/root/assets/{personal-avatar-BLtHt8fV.js → personal-avatar-nXrmMfrV.js} +1 -1
  101. package/dist/gateway/static/root/assets/personal-page-BCwlYT3F.js +1 -0
  102. package/dist/gateway/static/root/assets/personal-settings-panel-vkYmXK8h.js +1 -0
  103. package/dist/gateway/static/root/assets/{phone-dependencies-card-DISHarj8.js → phone-dependencies-card-CZDAxTWv.js} +1 -1
  104. package/dist/gateway/static/root/assets/phone-model-picker-4Snfs8Hq.js +1 -0
  105. package/dist/gateway/static/root/assets/phone-settings-page-D8HperfA.js +1 -0
  106. package/dist/gateway/static/root/assets/{phone-workspace-store-fhnZrgy_.js → phone-workspace-store-Di9R9Ux5.js} +1 -1
  107. package/dist/gateway/static/root/assets/plugin-details-dialog-DJsDu-_8.js +1 -0
  108. package/dist/gateway/static/root/assets/popover-select-DD8fmrxH.js +1 -0
  109. package/dist/gateway/static/root/assets/preference-select-fields-C6abaM3k.js +1 -0
  110. package/dist/gateway/static/root/assets/product-automation-feedback-C74s9Mjz.js +7 -0
  111. package/dist/gateway/static/root/assets/product-delivery-DRyD9_Xq.js +1 -0
  112. package/dist/gateway/static/root/assets/{product-open-page-xn9G4hSI.js → product-open-page-AbDP5w1c.js} +1 -1
  113. package/dist/gateway/static/root/assets/product-preview-content-CktjvFbc.js +1 -0
  114. package/dist/gateway/static/root/assets/product-preview-modal-CzsqLwB4.js +2 -0
  115. package/dist/gateway/static/root/assets/project-detail-page-Cf3tggGP.js +7 -0
  116. package/dist/gateway/static/root/assets/project-understanding-jmhFbHch.js +1 -0
  117. package/dist/gateway/static/root/assets/projects-page-jMgZiFnO.js +1 -0
  118. package/dist/gateway/static/root/assets/{providers-api-CzVkFKFg.js → providers-api-CJBYFKAK.js} +1 -1
  119. package/dist/gateway/static/root/assets/{recording-upload-0jxahBMo.js → recording-upload-Dl9a5yOV.js} +1 -1
  120. package/dist/gateway/static/root/assets/{registry-api-n8TwtJ_j.js → registry-api-BwkbPUYu.js} +1 -1
  121. package/dist/gateway/static/root/assets/{remote-access-hub-cZpBi4Rk.js → remote-access-hub-CBQ_bOy9.js} +1 -1
  122. package/dist/gateway/static/root/assets/resource-unavailable-35wBZxmz.js +1 -0
  123. package/dist/gateway/static/root/assets/route-preload-BcA6SPeC.js +2 -0
  124. package/dist/gateway/static/root/assets/runtime-impact-DbySfhdp.js +1 -0
  125. package/dist/gateway/static/root/assets/{runtime-tools-api-D-8KjYK6.js → runtime-tools-api-BF28JDAO.js} +1 -1
  126. package/dist/gateway/static/root/assets/runtime-tools-settings-panel-Bq2xQ2qd.js +1 -0
  127. package/dist/gateway/static/root/assets/schema-form-BKeP5G7b.js +1 -0
  128. package/dist/gateway/static/root/assets/service-recommendation-list-CdaS4MPF.js +1 -0
  129. package/dist/gateway/static/root/assets/{session-api-CsCoI2im.js → session-api-zJXYlRPt.js} +1 -1
  130. package/dist/gateway/static/root/assets/session-manager-wWxpzSo0.js +23 -0
  131. package/dist/gateway/static/root/assets/sessions-page-BkjD_dUD.js +1 -0
  132. package/dist/gateway/static/root/assets/settings-advanced-gate-BUMCEtA_.js +1 -0
  133. package/dist/gateway/static/root/assets/{settings-advanced-section-BqoVSko2.js → settings-advanced-section-C84IghdL.js} +1 -1
  134. package/dist/gateway/static/root/assets/{settings-mode-store-CBsJ-Qg2.js → settings-mode-store-CtQBJvbO.js} +1 -1
  135. package/dist/gateway/static/root/assets/{settings-page-DROUGyJl.js → settings-page-eEIz9InP.js} +1 -1
  136. package/dist/gateway/static/root/assets/{settings-page-header-Bv-kQFTm.js → settings-page-header-CsPAYlqV.js} +1 -1
  137. package/dist/gateway/static/root/assets/{settings-page-layout-DHP6MrrL.js → settings-page-layout-lPLeJQoV.js} +1 -1
  138. package/dist/gateway/static/root/assets/setup-status-panel-BSU5WpaE.js +1 -0
  139. package/dist/gateway/static/root/assets/{share-link-dialog-BJHRQVKC.js → share-link-dialog-NaM6jvIz.js} +1 -1
  140. package/dist/gateway/static/root/assets/share-preview-page-CHjZn27s.js +2 -0
  141. package/dist/gateway/static/root/assets/{shares-api-rtWVHA_d.js → shares-api-B9rVcV1y.js} +1 -1
  142. package/dist/gateway/static/root/assets/shares-settings-5sB15V5v.js +1 -0
  143. package/dist/gateway/static/root/assets/skill-api-D6zVfEuK.js +1 -0
  144. package/dist/gateway/static/root/assets/{skill-list-api-BzlKXPsE.js → skill-list-api-SLmTBYF5.js} +1 -1
  145. package/dist/gateway/static/root/assets/{skill-reload-api-Cff2GgZb.js → skill-reload-api-UQkq2orI.js} +1 -1
  146. package/dist/gateway/static/root/assets/skills-page-Ca0pYZ4i.js +2 -0
  147. package/dist/gateway/static/root/assets/{system-settings-panel-BeQeUUMH.js → system-settings-panel-BARWbjRN.js} +1 -1
  148. package/dist/gateway/static/root/assets/task-detail-page-roqAsGue.js +2 -0
  149. package/dist/gateway/static/root/assets/task-result-evidence-Bb1F7nAM.js +1 -0
  150. package/dist/gateway/static/root/assets/{terminal-panel-store-5Fzctajw.js → terminal-panel-store-DYDeXXAg.js} +1 -1
  151. package/dist/gateway/static/root/assets/{theme-store-DW45fWYQ.js → theme-store-DbStcH89.js} +1 -1
  152. package/dist/gateway/static/root/assets/tracing-settings-page-YfkNCxbP.js +1 -0
  153. package/dist/gateway/static/root/assets/tunnel-api-BK_ivyIb.js +1 -0
  154. package/dist/gateway/static/root/assets/{understanding-activity-store-CTe6TFB0.js → understanding-activity-store-p7Z7oq8z.js} +1 -1
  155. package/dist/gateway/static/root/assets/{understanding-refresh-store-mE9OKG6q.js → understanding-refresh-store-D-U6rcwZ.js} +1 -1
  156. package/dist/gateway/static/root/assets/usage-page-URFSiswS.js +1 -0
  157. package/dist/gateway/static/root/assets/{use-autosave-Cs2Ga_Y_.js → use-autosave-B7cbumro.js} +1 -1
  158. package/dist/gateway/static/root/assets/use-composer-attachments-DAtiwLsE.js +2 -0
  159. package/dist/gateway/static/root/assets/use-file-preview-expanded-B8erpWsX.js +2 -0
  160. package/dist/gateway/static/root/assets/{use-personal-profile-BHL2AxWU.js → use-personal-profile-DDW29nm-.js} +1 -1
  161. package/dist/gateway/static/root/assets/{use-workspace-tree-CnmPZrpx.js → use-workspace-tree-DCoTf22f.js} +1 -1
  162. package/dist/gateway/static/root/assets/user-model-page-DSV5NkNj.js +2 -0
  163. package/dist/gateway/static/root/assets/{voice-api-key-field-3gyc2UV3.js → voice-api-key-field-DzYdJZN4.js} +1 -1
  164. package/dist/gateway/static/root/assets/{voice-config-api-Cda2uBIC.js → voice-config-api-wotvT6Hw.js} +1 -1
  165. package/dist/gateway/static/root/assets/{voice-input-shortcut-events-DtYHsPLF.js → voice-input-shortcut-events-BI6PuiIB.js} +1 -1
  166. package/dist/gateway/static/root/assets/voice-transcribe-api-DAK9eLRr.js +1 -0
  167. package/dist/gateway/static/root/assets/{work-discovery-overlay-Dqu5CQCS.js → work-discovery-overlay-BzmB9Rub.js} +1 -1
  168. package/dist/gateway/static/root/assets/work-discovery-page-CmGjxUIT.js +1 -0
  169. package/dist/gateway/static/root/assets/{working-directory-picker-modal-DHl2cZY1.js → working-directory-picker-modal-B-EHm52-.js} +1 -1
  170. package/dist/gateway/static/root/assets/{workspace-api-CtDbI6T7.js → workspace-api-uhiEMPpK.js} +2 -2
  171. package/dist/gateway/static/root/assets/workspace-editor-agent-store-DrPVyikA.js +1 -0
  172. package/dist/gateway/static/root/assets/{workspace-file-preview-dialog-CTIbUfKb.js → workspace-file-preview-dialog-BDm06MZm.js} +1 -1
  173. package/dist/gateway/static/root/assets/{workspace-open-location-menu-BwxouqdZ.js → workspace-open-location-menu-Bv83uoqu.js} +1 -1
  174. package/dist/gateway/static/root/assets/{xopc-cloud-account-card-CFb-23rS.js → xopc-cloud-account-card-Cd5GdpGL.js} +1 -1
  175. package/dist/gateway/static/root/index.html +91 -86
  176. package/dist/gateway/static/root/notification-sw.js +21 -7
  177. package/dist/package.js +1 -1
  178. package/dist/packages/endpoint-tools-protocol/src/context.js +115 -0
  179. package/dist/packages/endpoint-tools-protocol/src/index.js +4 -0
  180. package/dist/packages/endpoint-tools-protocol/src/location-sharing.js +51 -0
  181. package/dist/packages/gateway-contract/src/gateway-scopes.js +5 -1
  182. package/dist/packages/gateway-contract/src/index.js +4 -0
  183. package/dist/packages/gateway-contract/src/phone-workspace.js +6 -0
  184. package/dist/packages/gateway-contract/src/product-delivery.js +9 -3
  185. package/dist/packages/gateway-contract/src/task-display.js +14 -0
  186. package/dist/src/agent/agent-manager.js +1 -1
  187. package/dist/src/agent/background-review/run-background-review.js +1 -1
  188. package/dist/src/agent/context/execution-scope.js +10 -5
  189. package/dist/src/agent/embedded/external-tool-discovery.js +1 -1
  190. package/dist/src/agent/embedded/run-for-session.js +2 -2
  191. package/dist/src/agent/embedded/run-turn.js +72 -9
  192. package/dist/src/agent/embedded/session-runner.js +2 -1
  193. package/dist/src/agent/embedded/types.d.ts +1 -1
  194. package/dist/src/agent/external-tools/cliProvider.js +2 -2
  195. package/dist/src/agent/external-tools/composio-provider.js +2 -2
  196. package/dist/src/agent/external-tools/endpoint-provider.js +2 -2
  197. package/dist/src/agent/prompt/system-prompt.js +1 -0
  198. package/dist/src/agent/service/direct-turn-helpers.d.ts +0 -7
  199. package/dist/src/agent/service/direct-turn-helpers.js +3 -2
  200. package/dist/src/agent/service/process-direct-streaming.js +2 -1
  201. package/dist/src/agent/service.js +1 -1
  202. package/dist/src/agent/skills/index.js +1 -1
  203. package/dist/src/agent/skills/managed-store.js +1 -1
  204. package/dist/src/agent/skills/skill-manage-ops.js +1 -1
  205. package/dist/src/agent/source-context/device-environment.d.ts +3 -0
  206. package/dist/src/agent/source-context/device-environment.js +38 -0
  207. package/dist/src/agent/source-context/injector.js +2 -1
  208. package/dist/src/agent/tool-manuals/phone.d.ts +1 -1
  209. package/dist/src/agent/tool-manuals/phone.js +1 -1
  210. package/dist/src/agent/tools/automation-tool.d.ts +2 -1
  211. package/dist/src/agent/tools/automation-tool.js +13 -5
  212. package/dist/src/agent/tools/factory.js +2 -1
  213. package/dist/src/agent/tools/personal-read-tool.js +2 -2
  214. package/dist/src/agent/tools/personal-task-tool.js +2 -1
  215. package/dist/src/agent/tools/phone-use-tool.js +46 -2
  216. package/dist/src/agent/tools/xopc-use-tool.js +8 -5
  217. package/dist/src/agent-catalog/capabilities.js +2 -2
  218. package/dist/src/agent-catalog/repository.js +1 -1
  219. package/dist/src/automations/api/routes.js +38 -0
  220. package/dist/src/automations/capabilities/drafts.js +1 -1
  221. package/dist/src/automations/capabilities/write.js +25 -9
  222. package/dist/src/automations/configuration-conversation.d.ts +16 -0
  223. package/dist/src/automations/configuration-conversation.js +120 -0
  224. package/dist/src/automations/delivery/delivery-router.d.ts +2 -0
  225. package/dist/src/automations/delivery/delivery-router.js +30 -9
  226. package/dist/src/automations/domain/types.d.ts +1 -0
  227. package/dist/src/automations/index.js +5 -5
  228. package/dist/src/automations/service/action-executor.js +41 -12
  229. package/dist/src/automations/service/automation-service.d.ts +6 -0
  230. package/dist/src/automations/service/automation-service.js +47 -12
  231. package/dist/src/automations/service/index.js +2 -2
  232. package/dist/src/browser/providers/browser-ext-install.js +1 -1
  233. package/dist/src/capabilities/runtime/dispatcher.js +1 -1
  234. package/dist/src/capabilities/runtime/product.js +1 -1
  235. package/dist/src/cli/commands/agents.js +1 -1
  236. package/dist/src/cli/commands/models.js +1 -1
  237. package/dist/src/cli/commands/onboard/model.js +1 -1
  238. package/dist/src/cli/utils/init-workspace-core.js +1 -1
  239. package/dist/src/computer/broker.js +16 -3
  240. package/dist/src/computer/diagnostics.js +1 -1
  241. package/dist/src/computer/errors.js +4 -0
  242. package/dist/src/computer/runtime.d.ts +1 -1
  243. package/dist/src/config/agent-profile.js +1 -1
  244. package/dist/src/config/schema.d.ts +1 -0
  245. package/dist/src/endpoint-tools/context-store.d.ts +29 -0
  246. package/dist/src/endpoint-tools/context-store.js +138 -0
  247. package/dist/src/endpoint-tools/location-sharing.d.ts +42 -0
  248. package/dist/src/endpoint-tools/location-sharing.js +203 -0
  249. package/dist/src/endpoint-tools/runtime.d.ts +4 -0
  250. package/dist/src/endpoint-tools/runtime.js +8 -0
  251. package/dist/src/endpoint-tools/turn-context.d.ts +2 -1
  252. package/dist/src/endpoint-tools/turn-context.js +4 -2
  253. package/dist/src/execution-environments/local-worktree-manager.js +1 -1
  254. package/dist/src/extensions/agent-plugins/skill-catalog.js +1 -1
  255. package/dist/src/extensions/agent-plugins/validation.js +1 -1
  256. package/dist/src/gateway/agents-admin.js +2 -2
  257. package/dist/src/gateway/automation-completion-delivery.d.ts +4 -0
  258. package/dist/src/gateway/automation-completion-delivery.js +14 -0
  259. package/dist/src/gateway/global-defaults-admin.js +1 -1
  260. package/dist/src/gateway/hono/middleware/auth.js +1 -1
  261. package/dist/src/gateway/hono/routes/agents.js +1 -1
  262. package/dist/src/gateway/hono/routes/config-patch/misc.js +1 -1
  263. package/dist/src/gateway/hono/routes/devices.js +1 -0
  264. package/dist/src/gateway/hono/routes/endpoint-compatibility.js +4 -0
  265. package/dist/src/gateway/hono/routes/endpoint-environment.d.ts +3 -0
  266. package/dist/src/gateway/hono/routes/endpoint-environment.js +98 -0
  267. package/dist/src/gateway/hono/routes/endpoint-tools.js +1 -0
  268. package/dist/src/gateway/hono/routes/lazy-bundles.js +16 -0
  269. package/dist/src/gateway/hono/routes/location-sharing.d.ts +3 -0
  270. package/dist/src/gateway/hono/routes/location-sharing.js +164 -0
  271. package/dist/src/gateway/hono/routes/notes.js +2 -2
  272. package/dist/src/gateway/hono/routes/phone-setup.js +1 -1
  273. package/dist/src/gateway/hono/routes/phone.js +246 -34
  274. package/dist/src/gateway/hono/routes/projects.js +2 -2
  275. package/dist/src/gateway/hono/routes/session-command-handler.js +1 -1
  276. package/dist/src/gateway/hono/routes/session-input-handler.js +3 -2
  277. package/dist/src/gateway/hono/routes/tasks.js +1 -1
  278. package/dist/src/gateway/hono/routes/tunnel.js +10 -0
  279. package/dist/src/gateway/image-generation-setup.js +1 -1
  280. package/dist/src/gateway/respawn.js +2 -1
  281. package/dist/src/gateway/security/gateway-scopes.js +6 -0
  282. package/dist/src/gateway/security/phone-access.d.ts +4 -0
  283. package/dist/src/gateway/security/phone-access.js +20 -0
  284. package/dist/src/gateway/service/agent-runner.js +3 -1
  285. package/dist/src/gateway/service/config-coordinator.d.ts +1 -0
  286. package/dist/src/gateway/service/run-gateway-agent.js +2 -1
  287. package/dist/src/gateway/service/session-input-coordinator.d.ts +3 -0
  288. package/dist/src/gateway/service/session-input-coordinator.js +50 -2
  289. package/dist/src/gateway/service.d.ts +1 -0
  290. package/dist/src/gateway/service.js +12 -4
  291. package/dist/src/gateway/session-reset-service.js +4 -0
  292. package/dist/src/gateway/xopc-cloud-capability-setup.js +1 -1
  293. package/dist/src/imports/importService.js +1 -1
  294. package/dist/src/local-apps/service.js +1 -1
  295. package/dist/src/notifications/planner.js +6 -6
  296. package/dist/src/observability/store.d.ts +9 -0
  297. package/dist/src/observability/store.js +77 -32
  298. package/dist/src/personal-agent/communication.d.ts +1 -1
  299. package/dist/src/personal-agent/communication.js +3 -6
  300. package/dist/src/personal-agent/request-service.js +2 -1
  301. package/dist/src/personal-agent/service.js +1 -1
  302. package/dist/src/phone/assistance-service.d.ts +6 -0
  303. package/dist/src/phone/assistance-service.js +32 -0
  304. package/dist/src/phone/assistance.d.ts +40 -0
  305. package/dist/src/phone/assistance.js +273 -0
  306. package/dist/src/phone/cloud-phones.d.ts +5 -0
  307. package/dist/src/phone/cloud-phones.js +14 -0
  308. package/dist/src/phone/contracts.d.ts +7 -1
  309. package/dist/src/phone/contracts.js +5 -0
  310. package/dist/src/phone/environment-adapter.d.ts +3 -0
  311. package/dist/src/phone/environment-adapter.js +11 -0
  312. package/dist/src/phone/location-baseline-store.d.ts +9 -0
  313. package/dist/src/phone/location-baseline-store.js +61 -0
  314. package/dist/src/phone/location-environment.d.ts +61 -0
  315. package/dist/src/phone/location-environment.js +157 -0
  316. package/dist/src/phone/model-adapter.js +16 -5
  317. package/dist/src/phone/runtime.d.ts +17 -2
  318. package/dist/src/phone/runtime.js +203 -20
  319. package/dist/src/phone/stream-gateway.d.ts +5 -0
  320. package/dist/src/phone/stream-gateway.js +85 -51
  321. package/dist/src/phone/wuying-location.d.ts +18 -0
  322. package/dist/src/phone/wuying-location.js +86 -0
  323. package/dist/src/runtime-tools/archive.js +1 -1
  324. package/dist/src/storage/sqlite/device-access-repository.d.ts +4 -0
  325. package/dist/src/storage/sqlite/device-access-repository.js +18 -1
  326. package/dist/src/tasks/capabilities/read.js +2 -2
  327. package/dist/src/tasks/capabilities/write.js +1 -1
  328. package/dist/src/tasks/task-contract-planner.js +2 -1
  329. package/dist/src/tui/backends/embedded-backend.js +1 -1
  330. package/dist/src/tunnel/broker-client.d.ts +8 -0
  331. package/dist/src/tunnel/broker-client.js +18 -1
  332. package/dist/src/voice/realtime/persona-context.js +1 -1
  333. package/dist/src/voice/realtime/runtime.js +1 -1
  334. package/package.json +4 -3
  335. package/dist/gateway/static/root/assets/agent-avatar-display-Cy50vjbq.js +0 -2
  336. package/dist/gateway/static/root/assets/agent-defaults-settings-panel-V4NX_cWz.js +0 -1
  337. package/dist/gateway/static/root/assets/agent-plugin-dialog-CQ5LLDMO.js +0 -1
  338. package/dist/gateway/static/root/assets/app-link-CytZ5zkp.js +0 -1
  339. package/dist/gateway/static/root/assets/app-management-settings-panel-C1Zs-eha.js +0 -1
  340. package/dist/gateway/static/root/assets/appearance-settings-lIfGokbz.js +0 -1
  341. package/dist/gateway/static/root/assets/apps-page-CUvtsRYD.js +0 -1
  342. package/dist/gateway/static/root/assets/automation-api-Bld8blNl.js +0 -1
  343. package/dist/gateway/static/root/assets/automation-display-BcfZOQTC.js +0 -2
  344. package/dist/gateway/static/root/assets/automations-workspace-BgtYY2Mm.js +0 -8
  345. package/dist/gateway/static/root/assets/browser-automations-page-DIUNY94X.js +0 -3
  346. package/dist/gateway/static/root/assets/capabilities-page-DFW4Y0x8.js +0 -2
  347. package/dist/gateway/static/root/assets/capabilities-settings-panel-uOHSMQPZ.js +0 -8
  348. package/dist/gateway/static/root/assets/channels-D2a69dSt.js +0 -1
  349. package/dist/gateway/static/root/assets/chat-page-CG38tCHE.js +0 -71
  350. package/dist/gateway/static/root/assets/composer-payload-handoff-BU3B-C26.js +0 -1
  351. package/dist/gateway/static/root/assets/connected-providers-grid-Dmnu2zle.js +0 -1
  352. package/dist/gateway/static/root/assets/connectors-page-DT_WrC1y.js +0 -1
  353. package/dist/gateway/static/root/assets/date-picker-CE-cZFCU.js +0 -1
  354. package/dist/gateway/static/root/assets/desktop-pet-lorocS9j.js +0 -1
  355. package/dist/gateway/static/root/assets/desktop-pet-settings-CEcohlZq.js +0 -1
  356. package/dist/gateway/static/root/assets/device-pairing-wizard-CLCPuf4R.js +0 -1
  357. package/dist/gateway/static/root/assets/discussion-annotation-sync-BKjf9gWe.js +0 -1
  358. package/dist/gateway/static/root/assets/extension-iframe-host-Dhkk5JV2.js +0 -1
  359. package/dist/gateway/static/root/assets/extension-page-Brps2XDP.js +0 -1
  360. package/dist/gateway/static/root/assets/extension-settings-page-CHY68DpG.js +0 -1
  361. package/dist/gateway/static/root/assets/gateway-realtime-store-DQqMBruB.js +0 -1
  362. package/dist/gateway/static/root/assets/gateway-restart-Ch128Lrr.js +0 -1
  363. package/dist/gateway/static/root/assets/home-page-DaMFBYo1.js +0 -2
  364. package/dist/gateway/static/root/assets/image-generation-api-I_JgLL_m.js +0 -1
  365. package/dist/gateway/static/root/assets/index-DY2Y83b9.css +0 -1
  366. package/dist/gateway/static/root/assets/index-UCOlAnf-.js +0 -11
  367. package/dist/gateway/static/root/assets/install-connector-dialog-DU1Tz7B3.js +0 -1
  368. package/dist/gateway/static/root/assets/local-app-workbench-page-qPflPuQD.js +0 -1
  369. package/dist/gateway/static/root/assets/logs-page-CbY1N-zi.js +0 -2
  370. package/dist/gateway/static/root/assets/management-settings-Diy12JfQ.js +0 -1
  371. package/dist/gateway/static/root/assets/messages-DRR9N3HC.js +0 -3
  372. package/dist/gateway/static/root/assets/model-selector-DCYA_ntf.js +0 -1
  373. package/dist/gateway/static/root/assets/navigation-BkjnOw30.js +0 -1
  374. package/dist/gateway/static/root/assets/note-detail-panel-DBs1yHLy.js +0 -5
  375. package/dist/gateway/static/root/assets/note-image-lightbox-CivkB6LB.js +0 -1
  376. package/dist/gateway/static/root/assets/notes-page-DL3c-41a.js +0 -8
  377. package/dist/gateway/static/root/assets/page-header-store-DH8K0xii.js +0 -1
  378. package/dist/gateway/static/root/assets/personal-page-B5DP3lO-.js +0 -1
  379. package/dist/gateway/static/root/assets/personal-settings-panel-DjDc5Kaz.js +0 -1
  380. package/dist/gateway/static/root/assets/phone-model-picker-u8YIQCgo.js +0 -1
  381. package/dist/gateway/static/root/assets/phone-settings-page-el3pT0PD.js +0 -1
  382. package/dist/gateway/static/root/assets/plugin-details-dialog-CTBs1Jde.js +0 -1
  383. package/dist/gateway/static/root/assets/popover-select-DniHw2dy.js +0 -1
  384. package/dist/gateway/static/root/assets/preference-select-fields-D7oluyHN.js +0 -1
  385. package/dist/gateway/static/root/assets/product-automation-feedback-DsUSqCOX.js +0 -7
  386. package/dist/gateway/static/root/assets/product-delivery-BU_H84jL.js +0 -1
  387. package/dist/gateway/static/root/assets/product-preview-content-DcoK-iZe.js +0 -1
  388. package/dist/gateway/static/root/assets/product-preview-modal-Ruw9WSKK.js +0 -2
  389. package/dist/gateway/static/root/assets/project-detail-page-BKvWLiMw.js +0 -7
  390. package/dist/gateway/static/root/assets/project-understanding-BCQr0AZ_.js +0 -1
  391. package/dist/gateway/static/root/assets/projects-page-D4g7bB7X.js +0 -1
  392. package/dist/gateway/static/root/assets/route-preload-B5UiReO7.js +0 -2
  393. package/dist/gateway/static/root/assets/runtime-tools-settings-panel-MKlLFuow.js +0 -1
  394. package/dist/gateway/static/root/assets/schema-form-v4N4lawq.js +0 -1
  395. package/dist/gateway/static/root/assets/service-recommendation-list-B1xuVT3N.js +0 -1
  396. package/dist/gateway/static/root/assets/session-manager-5l9q0cd5.js +0 -16
  397. package/dist/gateway/static/root/assets/sessions-page-DsLw2aMD.js +0 -1
  398. package/dist/gateway/static/root/assets/settings-advanced-gate-B5lQeVNi.js +0 -1
  399. package/dist/gateway/static/root/assets/setup-status-panel-MJE3B_LX.js +0 -1
  400. package/dist/gateway/static/root/assets/share-preview-page-Bsrv_zOQ.js +0 -2
  401. package/dist/gateway/static/root/assets/shares-settings-CfIRv4uX.js +0 -1
  402. package/dist/gateway/static/root/assets/skill-api-B_W1K3sv.js +0 -1
  403. package/dist/gateway/static/root/assets/skills-page-DtBloYeU.js +0 -2
  404. package/dist/gateway/static/root/assets/task-detail-page-Drrv-Hp0.js +0 -2
  405. package/dist/gateway/static/root/assets/task-result-evidence-D1Kyskm_.js +0 -1
  406. package/dist/gateway/static/root/assets/tracing-settings-page-B12u5D9A.js +0 -1
  407. package/dist/gateway/static/root/assets/tunnel-api-DGO56LQU.js +0 -1
  408. package/dist/gateway/static/root/assets/usage-page-Ud2U9UG1.js +0 -1
  409. package/dist/gateway/static/root/assets/use-composer-attachments-BCbMj-MN.js +0 -2
  410. package/dist/gateway/static/root/assets/use-file-preview-expanded-DSpCRXUW.js +0 -2
  411. package/dist/gateway/static/root/assets/user-model-page-p5iPfnwl.js +0 -2
  412. package/dist/gateway/static/root/assets/voice-transcribe-api-TInEfIYo.js +0 -1
  413. package/dist/gateway/static/root/assets/work-discovery-page-p-8ciZ0i.js +0 -1
  414. package/dist/gateway/static/root/assets/workspace-editor-agent-store-B94Q2nN8.js +0 -1
@@ -0,0 +1,18 @@
1
+ import type { LocationSample } from '@xopcai/endpoint-tools-protocol';
2
+ export type LocationCommand = (args: string[], signal: AbortSignal) => Promise<string>;
3
+ export interface WuyingLocationBaseline {
4
+ property: string;
5
+ fingerprint: string;
6
+ order: 'latitude-first' | 'longitude-first';
7
+ }
8
+ /** Detect the installed image's property layout from an actual GPS fix; never guess tuple order. */
9
+ export declare class WuyingLocationAdapter {
10
+ private readonly command;
11
+ constructor(command: LocationCommand);
12
+ private read;
13
+ private fingerprint;
14
+ prepare(signal: AbortSignal): Promise<WuyingLocationBaseline>;
15
+ private verify;
16
+ apply(sample: LocationSample, baseline: WuyingLocationBaseline, assertCurrent: () => void, signal: AbortSignal): Promise<void>;
17
+ restore(baseline: WuyingLocationBaseline, signal: AbortSignal): Promise<void>;
18
+ }
@@ -0,0 +1,86 @@
1
+ import { PhoneError, init_contracts } from "./contracts.js";
2
+ import { createHash } from "node:crypto";
3
+ import { setTimeout } from "node:timers/promises";
4
+ //#region src/phone/wuying-location.ts
5
+ init_contracts();
6
+ const propertyName = "persist.location.data";
7
+ const numeric = "-?\\d+(?:\\.\\d+)?";
8
+ function tuple(raw) {
9
+ if (!new RegExp(`^${numeric},${numeric},${numeric},wgs$`).test(raw) || raw.length > 160) throw new PhoneError("PHONE_ENV_UNSUPPORTED", "Cloud phone location format is unsupported", 409);
10
+ const values = raw.split(",").slice(0, 3).map(Number);
11
+ if (values.some((value) => !Number.isFinite(value))) throw new PhoneError("PHONE_ENV_UNSUPPORTED", "Cloud phone location format is unsupported", 409);
12
+ return values;
13
+ }
14
+ function fixes(dump) {
15
+ return [...dump.matchAll(/^\s*last location=Location\[gps\s+(-?\d+(?:\.\d+)?),\s*(-?\d+(?:\.\d+)?)/gm)].map((match) => ({
16
+ latitude: Number(match[1]),
17
+ longitude: Number(match[2])
18
+ }));
19
+ }
20
+ const matches = (fix, latitude, longitude) => Math.hypot(fix.latitude - latitude, (fix.longitude - longitude) * Math.cos(latitude * Math.PI / 180)) * 111320 <= 15;
21
+ /** Detect the installed image's property layout from an actual GPS fix; never guess tuple order. */
22
+ var WuyingLocationAdapter = class {
23
+ constructor(command) {
24
+ this.command = command;
25
+ }
26
+ async read(args, signal) {
27
+ const output = await this.command(args, signal);
28
+ if (/Exception|Permission denied|Error:|Failed to set/i.test(output)) throw new PhoneError("PHONE_ENV_OPERATION_FAILED", "Cloud phone location command failed", 502);
29
+ return output.trim();
30
+ }
31
+ async fingerprint(signal) {
32
+ return createHash("sha256").update(await this.read(["getprop", "ro.build.fingerprint"], signal)).digest("hex");
33
+ }
34
+ async prepare(signal) {
35
+ if (Number(await this.read(["getprop", "ro.build.version.sdk"], signal)) < 31) throw new PhoneError("PHONE_ENV_UNSUPPORTED", "This cloud phone image is unsupported", 409);
36
+ const property = await this.read(["getprop", propertyName], signal);
37
+ const [first, second] = tuple(property);
38
+ const current = fixes(await this.read(["dumpsys", "location"], signal));
39
+ const latitudeFirst = Math.abs(first) <= 90 && Math.abs(second) <= 180 && current.some((fix) => matches(fix, first, second));
40
+ if (latitudeFirst === (Math.abs(first) <= 180 && Math.abs(second) <= 90 && current.some((fix) => matches(fix, second, first)))) throw new PhoneError("PHONE_ENV_UNSUPPORTED", "A current GPS fix is required to verify cloud phone coordinate order", 409);
41
+ return {
42
+ property,
43
+ fingerprint: await this.fingerprint(signal),
44
+ order: latitudeFirst ? "latitude-first" : "longitude-first"
45
+ };
46
+ }
47
+ async verify(raw, baseline, signal) {
48
+ const [first, second] = tuple(raw);
49
+ const latitude = baseline.order === "latitude-first" ? first : second;
50
+ const longitude = baseline.order === "latitude-first" ? second : first;
51
+ for (let attempt = 0; attempt < 12; attempt++) {
52
+ signal.throwIfAborted();
53
+ const property = await this.read(["getprop", propertyName], signal);
54
+ const current = fixes(await this.read(["dumpsys", "location"], signal));
55
+ if (property === raw && current.length && current.every((fix) => matches(fix, latitude, longitude))) return;
56
+ await setTimeout(500, void 0, { signal });
57
+ }
58
+ throw new PhoneError("PHONE_ENV_UNVERIFIED", "Cloud phone GPS has not confirmed the requested location", 409);
59
+ }
60
+ async apply(sample, baseline, assertCurrent, signal) {
61
+ const [, , altitude] = tuple(baseline.property);
62
+ const [first, second] = baseline.order === "latitude-first" ? [sample.latitude, sample.longitude] : [sample.longitude, sample.latitude];
63
+ const raw = `${first.toFixed(7)},${second.toFixed(7)},${altitude},wgs`;
64
+ if (await this.fingerprint(signal) !== baseline.fingerprint) throw new PhoneError("PHONE_ENV_UNSUPPORTED", "Cloud phone image changed", 409);
65
+ assertCurrent();
66
+ await this.read([
67
+ "setprop",
68
+ propertyName,
69
+ raw
70
+ ], signal);
71
+ await this.verify(raw, baseline, signal);
72
+ assertCurrent();
73
+ }
74
+ async restore(baseline, signal) {
75
+ tuple(baseline.property);
76
+ if (await this.fingerprint(signal) !== baseline.fingerprint) throw new PhoneError("PHONE_ENV_CLEANUP_PENDING", "Cloud phone image changed; location cleanup needs inspection", 409);
77
+ await this.read([
78
+ "setprop",
79
+ propertyName,
80
+ baseline.property
81
+ ], signal);
82
+ await this.verify(baseline.property, baseline, signal);
83
+ }
84
+ };
85
+ //#endregion
86
+ export { WuyingLocationAdapter };
@@ -1,8 +1,8 @@
1
1
  import { RuntimeError } from "./errors.js";
2
2
  import { isAbsolute, join, posix, relative, resolve } from "node:path";
3
3
  import { spawn } from "node:child_process";
4
- import { lstat, mkdir, readdir, readlink, rename, rm, stat } from "node:fs/promises";
5
4
  import AdmZip from "adm-zip";
5
+ import { lstat, mkdir, readdir, readlink, rename, rm, stat } from "node:fs/promises";
6
6
  //#region src/runtime-tools/archive.ts
7
7
  const MAX_ARCHIVE_ENTRIES = 5e4;
8
8
  const MAX_TAR_OUTPUT_BYTES = 16 * 1024 * 1024;
@@ -63,3 +63,7 @@ export declare function rotateDeviceRefreshToken(input: {
63
63
  now?: number;
64
64
  }): DeviceTokenPair;
65
65
  export declare function revokeDevice(deviceId: string, now?: number): boolean;
66
+ /** Checks a live transport without retaining its bearer token. */
67
+ export declare function isDeviceAccessSessionActive(deviceId: string, sessionId: string, now?: number): boolean;
68
+ /** Changes only phone permissions, preserving all other grants. */
69
+ export declare function setDevicePhoneAccess(deviceId: string, access: 'none' | 'view' | 'control'): DeviceRecord | undefined;
@@ -217,5 +217,22 @@ function revokeDevice(deviceId, now = Date.now()) {
217
217
  return changed;
218
218
  });
219
219
  }
220
+ /** Checks a live transport without retaining its bearer token. */
221
+ function isDeviceAccessSessionActive(deviceId, sessionId, now = Date.now()) {
222
+ return Boolean(getSqliteDatabase().prepare(`SELECT 1 FROM device_access_sessions a JOIN devices d ON d.device_id = a.device_id
223
+ WHERE a.device_id = ? AND a.session_id = ? AND a.revoked_at IS NULL AND d.revoked_at IS NULL AND a.expires_at > ?`).get(deviceId, sessionId, now));
224
+ }
225
+ /** Changes only phone permissions, preserving all other grants. */
226
+ function setDevicePhoneAccess(deviceId, access) {
227
+ return runSqliteWriteTransaction((db) => {
228
+ const device = getDevice(deviceId);
229
+ if (!device || device.revokedAt !== void 0 || device.platform === "chrome") return void 0;
230
+ const scopes = device.scopes.filter((scope) => scope !== "phone.view" && scope !== "phone.control");
231
+ if (access !== "none") scopes.push("phone.view");
232
+ if (access === "control") scopes.push("phone.control");
233
+ db.prepare("UPDATE devices SET scopes_json = ? WHERE device_id = ?").run(JSON.stringify(scopes), deviceId);
234
+ return getDevice(deviceId);
235
+ });
236
+ }
220
237
  //#endregion
221
- export { DeviceRefreshRateLimitError, authenticateDeviceAccessToken, buildRefreshProofMessage, createDevice, getDevice, issueDeviceTokenPair, listDevices, registerInitialDeviceRefreshToken, revokeDevice, rotateDeviceRefreshToken };
238
+ export { DeviceRefreshRateLimitError, authenticateDeviceAccessToken, buildRefreshProofMessage, createDevice, getDevice, isDeviceAccessSessionActive, issueDeviceTokenPair, listDevices, registerInitialDeviceRefreshToken, revokeDevice, rotateDeviceRefreshToken, setDevicePhoneAccess };
@@ -2,10 +2,10 @@ import { ProductReadContracts } from "../../../packages/gateway-contract/src/cap
2
2
  import { init_src } from "../../../packages/gateway-contract/src/index.js";
3
3
  import { TaskRepository, init_task_repository } from "../task-repository.js";
4
4
  import { TaskRunRepository, init_task_run_repository } from "../task-run-repository.js";
5
- import { CapabilityError } from "../../capabilities/runtime/errors.js";
6
- import { defineReadCapability } from "../../capabilities/runtime/dispatcher.js";
7
5
  import { TaskReadModelProjector } from "../task-read-model-projector.js";
8
6
  import { TaskConversationRepository } from "../task-conversation-repository.js";
7
+ import { CapabilityError } from "../../capabilities/runtime/errors.js";
8
+ import { defineReadCapability } from "../../capabilities/runtime/dispatcher.js";
9
9
  import { TaskContextRepository } from "../task-context-repository.js";
10
10
  import { TaskDependencyService } from "../task-dependency-service.js";
11
11
  import { TaskCriterionReviewRepository } from "../task-criterion-review-repository.js";
@@ -2,9 +2,9 @@ import { TaskCommandRequestSchema, TaskCreateRequestSchema, TaskDetailResponseSc
2
2
  import { init_src } from "../../../packages/gateway-contract/src/index.js";
3
3
  import { TaskRepository, init_task_repository } from "../task-repository.js";
4
4
  import { TaskRunRepository, init_task_run_repository } from "../task-run-repository.js";
5
+ import { resolveTaskLocale } from "../task-language.js";
5
6
  import { CapabilityError } from "../../capabilities/runtime/errors.js";
6
7
  import { defineAtomicCapability } from "../../capabilities/runtime/dispatcher.js";
7
- import { resolveTaskLocale } from "../task-language.js";
8
8
  import { resolveProjectAgentId } from "../../projects/project-agent.js";
9
9
  import { resolveResponseLanguageForSession } from "../../agent/prompt/response-language.js";
10
10
  import { TaskApplicationService } from "../task-application-service.js";
@@ -1,10 +1,11 @@
1
1
  import { createLogger } from "../utils/logger/index.js";
2
2
  import { init_logger } from "../utils/logger.js";
3
+ import { PERSONAL_WORKER_RESULT_GUIDANCE } from "../../packages/gateway-contract/src/task-display.js";
3
4
  import { getAgentDefaultChatModelConfig, init_schema } from "../config/schema.js";
4
5
  import { hasUnlocalizedTaskText, resolveTaskLocale } from "./task-language.js";
5
6
  import { completeTaskModelCall } from "./task-model-call.js";
6
7
  import { defineTaskContract } from "./task-contract-definition.js";
7
- import { PERSONAL_WORKER_RESULT_GUIDANCE } from "../personal-agent/communication.js";
8
+ import "../personal-agent/communication.js";
8
9
  import { EXECUTION_CAPABILITIES } from "./task-execution-capabilities.js";
9
10
  //#region src/tasks/task-contract-planner.ts
10
11
  init_schema();
@@ -10,7 +10,6 @@ import { getSessionMetadata } from "../../storage/sqlite/session-read-repository
10
10
  import "../../storage/sqlite/index.js";
11
11
  import { normalizeAgentId } from "../../agent-catalog/id.js";
12
12
  import { init_agent_scope, listAgentEntries } from "../../agent/agent-scope.js";
13
- import { AgentCatalogService } from "../../agent-catalog/service.js";
14
13
  import { init_paths } from "../../config/paths.js";
15
14
  import { getAgentDefaultModelRef, init_schema } from "../../config/schema.js";
16
15
  import { resolveEffectiveAgentProfile } from "../../config/agent-profile.js";
@@ -23,6 +22,7 @@ import { buildSessionTimeline } from "../../session/transcript-outline.js";
23
22
  import { transcriptRowsToClientHistory } from "../../session/client-history.js";
24
23
  import { createCreateShareTool, isShareToolAvailable } from "../../agent/tools/create-share-tool.js";
25
24
  import { evictEmbeddedSessionRunner } from "../../agent/embedded/session-runner.js";
25
+ import { AgentCatalogService } from "../../agent-catalog/service.js";
26
26
  import { SessionIndex } from "../../session/manager.js";
27
27
  import "../../session/index.js";
28
28
  import { parseModelRef } from "../../agent/models/selection.js";
@@ -11,6 +11,14 @@ export declare class TunnelBrokerError extends Error {
11
11
  readonly status: number;
12
12
  constructor(status: number, message: string);
13
13
  }
14
+ export declare class TunnelRegistrationKeyRejectedError extends TunnelBrokerError {
15
+ readonly code = "TUNNEL_REGISTRATION_KEY_REJECTED";
16
+ constructor();
17
+ }
18
+ export declare class TunnelRecoveryProofRejectedError extends TunnelBrokerError {
19
+ readonly code = "TUNNEL_RECOVERY_PROOF_REJECTED";
20
+ constructor();
21
+ }
14
22
  export declare class TunnelBrokerClient {
15
23
  private readonly baseUrl;
16
24
  constructor(baseUrl: string);
@@ -11,6 +11,20 @@ var TunnelBrokerError = class extends Error {
11
11
  this.status = status;
12
12
  }
13
13
  };
14
+ var TunnelRegistrationKeyRejectedError = class extends TunnelBrokerError {
15
+ code = "TUNNEL_REGISTRATION_KEY_REJECTED";
16
+ constructor() {
17
+ super(401, "Tunnel register failed: 401");
18
+ this.name = "TunnelRegistrationKeyRejectedError";
19
+ }
20
+ };
21
+ var TunnelRecoveryProofRejectedError = class extends TunnelBrokerError {
22
+ code = "TUNNEL_RECOVERY_PROOF_REJECTED";
23
+ constructor() {
24
+ super(403, "Active lease ownership proof required");
25
+ this.name = "TunnelRecoveryProofRejectedError";
26
+ }
27
+ };
14
28
  const registrationResponseSchema = z.object({
15
29
  tunnelId: z.string().regex(/^[a-zA-Z0-9_-]{1,128}$/),
16
30
  tunnelToken: z.string().min(1).max(256),
@@ -52,6 +66,9 @@ var TunnelBrokerClient = class {
52
66
  status: res.status,
53
67
  url
54
68
  }, "Tunnel register failed");
69
+ const body = await res.json().catch(() => null);
70
+ if (res.status === 403 && body?.code === "REGISTRATION_DENIED" && body.error === "Active lease ownership proof required") throw new TunnelRecoveryProofRejectedError();
71
+ if (res.status === 401) throw new TunnelRegistrationKeyRejectedError();
55
72
  throw new TunnelBrokerError(res.status, `Tunnel register failed: ${res.status}`);
56
73
  }
57
74
  const registration = registrationResponseSchema.parse(await res.json());
@@ -87,4 +104,4 @@ function resolveBrokerApiBase(brokerUrl) {
87
104
  return `${trimmed}/api`;
88
105
  }
89
106
  //#endregion
90
- export { TunnelBrokerClient, TunnelBrokerError, resolveBrokerApiBase };
107
+ export { TunnelBrokerClient, TunnelBrokerError, TunnelRecoveryProofRejectedError, TunnelRegistrationKeyRejectedError, resolveBrokerApiBase };
@@ -1,6 +1,6 @@
1
1
  import { init_agent_scope, resolveAgentProfileDir } from "../../agent/agent-scope.js";
2
- import { DEFAULT_SOUL_FILENAME } from "../../agent/context/workspace.js";
3
2
  import { resolveEffectiveAgentProfileForSession } from "../../config/agent-profile.js";
3
+ import { DEFAULT_SOUL_FILENAME } from "../../agent/context/workspace.js";
4
4
  import { loadProfileBootstrapFiles } from "../../agent/bootstrap/load-bootstrap-files.js";
5
5
  import { join } from "node:path";
6
6
  import { statSync } from "node:fs";
@@ -12,8 +12,8 @@ import { mergeSttConfigFromAppConfig } from "../stt/config.js";
12
12
  import { ALIBABA_REALTIME_TTS_MODEL } from "../tts/providers/alibaba-speech.js";
13
13
  import { resolveSpeechProviderChain } from "../tts/factory.js";
14
14
  import { mergeTtsConfigFromAppConfig } from "../tts/merge-config.js";
15
- import { voiceConversationInstructions } from "./conversation-context.js";
16
15
  import { verifyDeviceConnectionProof } from "../../gateway/security/device-request-proof.js";
16
+ import { voiceConversationInstructions } from "./conversation-context.js";
17
17
  import { createPreauthConnectionBudget } from "../../gateway/security/preauth-connection-budget.js";
18
18
  import { claimOpeningGreeting, finishOpeningGreeting, openingGreetingText } from "./opening-greeting.js";
19
19
  import { createAgentVoiceEngine } from "./agentEngine.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xopcai/xopc",
3
- "version": "0.0.420",
3
+ "version": "0.0.422",
4
4
  "description": "Local-first personal AI with Ada, task delegation, files, projects and automations. Use cloud or local models.",
5
5
  "type": "module",
6
6
  "main": "dist/src/index.js",
@@ -96,7 +96,7 @@
96
96
  "chokidar": "^5.0.0",
97
97
  "cli-table3": "^0.6.5",
98
98
  "commander": "^14.0.3",
99
- "cron-parser": "^5.5.0",
99
+ "cron-parser": "^5.10.2",
100
100
  "dotenv": "^17.4.2",
101
101
  "glob": "^13.0.6",
102
102
  "grammy": "^1.43.0",
@@ -192,7 +192,8 @@
192
192
  "docker:run": "docker run --rm -it -p 18790:18790 -v ${HOME}/.xopc:/home/node/.xopc xopc:local",
193
193
  "docker:compose:up": "sh -c 'if docker compose version >/dev/null 2>&1; then DOCKER_BUILDKIT=1 docker compose up --build xopc-gateway; else COMPOSE_DOCKER_CLI_BUILD=1 DOCKER_BUILDKIT=1 docker-compose up --build xopc-gateway; fi'",
194
194
  "docker:compose:down": "sh -c 'if docker compose version >/dev/null 2>&1; then docker compose down; else docker-compose down; fi'",
195
- "typecheck": "tsc --noEmit -p tsconfig.json",
195
+ "typecheck": "tsc --noEmit -p tsconfig.json && pnpm run typecheck:electron",
196
+ "typecheck:electron": "tsc -p tsconfig.electron.json",
196
197
  "test:codemode:gateway": "node --import tsx/esm scripts/verify-codemode-gateway.mjs",
197
198
  "test:tool-discovery:gateway": "cross-env XOPC_TOOL_DISCOVERY_SMOKE=1 node --import tsx/esm scripts/verify-codemode-gateway.mjs",
198
199
  "test:native-tools:gateway": "cross-env XOPC_NATIVE_TOOLS_SMOKE=1 node --import tsx/esm scripts/verify-codemode-gateway.mjs",
@@ -1,2 +0,0 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/agent-avatar-dicebear-1UABT2KS.js","assets/rolldown-runtime-aKtaBQYM.js"])))=>i.map(i=>d[i]);
2
- import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,t as n}from"./vendor-react-BOUWij0V.js";import{t as r}from"./preload-helper-Czpn1I53.js";import{t as i}from"./cn-0WouolD0.js";import{i as a,l as o}from"./locale-store-lIXD1FMw.js";import{t as s}from"./loopi-CNtmi9FU.js";var c=e(t(),1),l=new Map,u=`xopc-agent-avatar-updated`;function d(e){let t=(l.get(e)??0)+1;return l.set(e,t),typeof window<`u`&&window.dispatchEvent(new CustomEvent(u,{detail:{agentId:e}})),t}function f(e){return l.get(e)??0}var p=`xopc:custom`,m=`xopc:dicebear:`,h=[`adventurer`,`bottts`,`lorelei`,`thumbs`,`fun-emoji`];function g(e){return h.includes(e)}function _(e,t){return`${m}${e}:${t}`}function v(e){if(!e.startsWith(m))return null;let t=e.slice(14),n=t.indexOf(`:`);if(n<=0)return null;let r=t.slice(0,n),i=t.slice(n+1);return!g(r)||!i.trim()?null:{styleId:r,seed:i}}var y=n();function b(e){let t=0;for(let n=0;n<e.length;n+=1)t=t*31+e.charCodeAt(n)>>>0;return t}function x(e,t=128){let n=b(e)%360,r=(e.trim().charAt(0)||`A`).toUpperCase(),i=`<svg xmlns="http://www.w3.org/2000/svg" width="${t}" height="${t}" viewBox="0 0 ${t} ${t}"><rect width="100%" height="100%" rx="${t/2}" fill="hsl(${n} 58% 42%)"/><text x="50%" y="54%" text-anchor="middle" dominant-baseline="middle" font-family="Inter, system-ui, sans-serif" font-size="${Math.round(t*.42)}" font-weight="700" fill="white">${r}</text></svg>`;return`data:image/svg+xml,${encodeURIComponent(i)}`}function S(e,t,n,r){let i=t?.trim()??``,o=x(e,n);if(i.startsWith(`xopc:loopi:`)){let e=i.slice(11);if(e===`idle`||e===`listen`||e===`curious`||e===`care`)return{kind:`loopi`,mood:e}}if(!i)return{kind:`dicebear`,styleId:`adventurer`,seed:e,fallbackSrc:o};if(i===`xopc:custom`){let t=a(`/api/agents/${encodeURIComponent(e)}/avatar`),n=new URLSearchParams;r>0&&n.set(`v`,String(r));let i=n.toString();return{kind:`authenticated`,url:i?`${t}?${i}`:t,fallbackSrc:o}}if(/^https?:\/\//i.test(i))return{kind:`sync`,src:i};let s=v(i);return s?{kind:`dicebear`,styleId:s.styleId,seed:s.seed,fallbackSrc:o}:{kind:`dicebear`,styleId:`adventurer`,seed:e,fallbackSrc:o}}function C(e){let t=o(e=>e.conversationId),n=e.token===void 0?t:e.token,{agentId:a,avatar:l,size:d=44}=e,[,p]=(0,c.useState)(0);(0,c.useEffect)(()=>{let e=e=>{e.detail?.agentId===a&&p(e=>e+1)};return window.addEventListener(u,e),()=>window.removeEventListener(u,e)},[a]);let m=f(a),h=(0,c.useMemo)(()=>S(a,l,d,m),[a,l,n,d,m]),g=h.kind===`sync`?h.src:h.kind===`loopi`?x(a,d):h.fallbackSrc,[_,v]=(0,c.useState)(g);return(0,c.useEffect)(()=>{v(g)},[g]),(0,c.useEffect)(()=>{if(h.kind!==`authenticated`||(v(h.fallbackSrc),!n))return;let e=new AbortController,t;return fetch(h.url,{credentials:`same-origin`,signal:e.signal,redirect:`error`}).then(async n=>{if(!n.ok)return;let r=await n.blob();e.signal.aborted||(t=URL.createObjectURL(r),v(t))}).catch(()=>{}),()=>{e.abort(),t&&URL.revokeObjectURL(t)}},[h,n]),(0,c.useEffect)(()=>{if(h.kind!==`dicebear`)return;let e=!1;return r(async()=>{let{dicebearToDataUri:e}=await import(`./agent-avatar-dicebear-1UABT2KS.js`);return{dicebearToDataUri:e}},__vite__mapDeps([0,1])).then(({dicebearToDataUri:t})=>{e||v(t(h.styleId,h.seed,d))}).catch(()=>{e||v(h.fallbackSrc)}),()=>{e=!0}},[h,d]),h.kind===`loopi`?(0,y.jsx)(`span`,{className:i(`inline-flex items-center justify-center rounded-full bg-surface-hover`,e.className),style:{width:d,height:d},children:(0,y.jsx)(s,{variant:`avatar`,mood:h.mood,className:`size-full`})}):(0,y.jsx)(`img`,{src:_,alt:``,width:d,height:d,className:i(`rounded-full object-cover bg-surface-hover`,e.className),draggable:!1,onError:()=>{v(x(a,d))}})}export{g as a,_ as i,h as n,v as o,p as r,d as s,C as t};
@@ -1 +0,0 @@
1
- import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{m as i}from"./chunk-KS7C4IRE-CiwuuyV8.js";import{t as a}from"./circle-check-C23XjkUj.js";import{t as o}from"./gauge-C78eD2BA.js";import{t as s}from"./list-checks-BbsExAoq.js";import{t as c}from"./puzzle-BptcPjKI.js";import{t as ee}from"./search-DA7gz22f.js";import{t as l}from"./shield-check-BU58siTV.js";import{t as te}from"./sliders-horizontal-DqsYor6I.js";import{t as u}from"./cn-0WouolD0.js";import{l as d,n as f}from"./locale-store-lIXD1FMw.js";import{i as p}from"./vendor-swr-CdRzEUwF.js";import{t as ne}from"./button-CnRSIP6m.js";import{t as m}from"./skeleton-BI5TyibZ.js";import{n as h,r as g}from"./cloud-credits-B-nbtkqv.js";import{t as _}from"./electron-env-DHOGevH3.js";import{t as re}from"./sliding-tab-list-DuQyViqe.js";import{t as v}from"./skill-list-api-BzlKXPsE.js";import{n as y}from"./settings-mode-store-CBsJ-Qg2.js";import{n as ie,t as b}from"./global-defaults-api-CINf-C6a.js";import{t as ae}from"./settings-advanced-section-BqoVSko2.js";import{t as x}from"./number-input-El7Szeln.js";import{n as oe,t as se}from"./settings-page-header-Bv-kQFTm.js";import"./settings-page-layout-DHP6MrrL.js";import{n as S,t as C}from"./use-autosave-Cs2Ga_Y_.js";var ce=n(),w=e(t(),1),T=r(),E=`w-full rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg outline-none focus:border-accent focus:ring-2 focus:ring-accent/15`;function D(e){let t=Number.parseInt(e,10);return Number.isFinite(t)&&t>0?t:void 0}function le({draft:e,setDraft:t,zh:n}){let[r,i]=(0,w.useState)(()=>e.runtime.cloudCreditLimitPerRunMicro?h(e.runtime.cloudCreditLimitPerRunMicro):``),[a,o]=(0,w.useState)(!1);return(0,T.jsxs)(`label`,{className:`block text-xs font-medium text-fg-muted`,children:[n?`每次运行的 Cloud 消费上限(Credits)`:`Cloud spend limit per run (Credits)`,(0,T.jsx)(`input`,{type:`text`,inputMode:`decimal`,value:r,"aria-invalid":a,placeholder:n?`不设置额外上限`:`No additional limit`,className:`${E} mt-2`,onChange:n=>{let r=n.target.value;i(r);try{let n=r===``?void 0:g(r);if(n===`0`||n&&n.length>15)throw Error(`Invalid limit`);o(!1),t({...e,runtime:{...e.runtime,cloudCreditLimitPerRunMicro:n}})}catch{o(!0)}},onBlur:()=>{a&&i(e.runtime.cloudCreditLimitPerRunMicro?h(e.runtime.cloudCreditLimitPerRunMicro):``),o(!1)}}),(0,T.jsx)(`span`,{className:`mt-2 block font-normal ${a?`text-danger`:`text-fg-subtle`}`,children:a?n?`请输入大于零、最多四位小数的 Credits。无效输入不会保存。`:`Enter positive Credits with up to four decimals. Invalid input is not saved.`:n?`模型、图片和文件语音调用共享上限;不支持实时语音或 Cloud 电脑控制,不包含运行前后的后台调用。达到上限后停止,调整后需手动继续。`:`Shared by model, image and file audio calls during a run. Does not support realtime voice or Cloud computer use; excludes background calls outside the run. Stops at the limit; continue manually after adjusting it.`})]})}function O(e){let t=(0,ce.c)(104),{draft:n,setDraft:r,zh:i}=e,a=i?`费用控制`:`Spending control`,o;t[0]===a?o=t[1]:(o=(0,T.jsx)(`h2`,{className:`mb-4 text-base font-semibold text-fg`,children:a}),t[0]=a,t[1]=o);let s;t[2]!==n||t[3]!==r||t[4]!==i?(s=(0,T.jsx)(le,{draft:n,setDraft:r,zh:i}),t[2]=n,t[3]=r,t[4]=i,t[5]=s):s=t[5];let c;t[6]!==o||t[7]!==s?(c=(0,T.jsxs)(`section`,{className:`rounded-xl bg-surface-hover/20 p-5`,children:[o,s]}),t[6]=o,t[7]=s,t[8]=c):c=t[8];let ee=i?`执行与缓存策略`:`Execution and cache policy`,l=i?`轮数:${n.runtime.maxTurns??`默认`} · 超时:${n.runtime.timeoutMs??`默认`} · 缓存:${n.runtime.promptCache?.mode??`默认`} · Codemode:${n.runtime.codemode?.enabled?`开启`:`关闭`}`:`Turns: ${n.runtime.maxTurns??`default`} · Timeout: ${n.runtime.timeoutMs??`default`} · Cache: ${n.runtime.promptCache?.mode??`default`} · Codemode: ${n.runtime.codemode?.enabled?`on`:`off`}`,te=n.runtime.codemode?.enabled??!1,u;t[9]!==n||t[10]!==r?(u=e=>r({...n,runtime:{...n.runtime,codemode:{...n.runtime.codemode,enabled:e.target.checked}}}),t[9]=n,t[10]=r,t[11]=u):u=t[11];let d;t[12]!==te||t[13]!==u?(d=(0,T.jsx)(`input`,{type:`checkbox`,checked:te,onChange:u,className:`mt-1 size-4 accent-[var(--color-accent)]`}),t[12]=te,t[13]=u,t[14]=d):d=t[14];let f=i?`Codemode 读取试点`:`Codemode read pilot`,p;t[15]===f?p=t[16]:(p=(0,T.jsx)(`span`,{className:`block text-base font-semibold text-fg`,children:f}),t[15]=f,t[16]=p);let m=i?`允许智能体用脚本组合已授权的读取工具。默认关闭,保留普通工具调用。`:`Let agents combine authorized reads in scripts. Off by default; ordinary tool calls stay available.`,h;t[17]===m?h=t[18]:(h=(0,T.jsx)(`span`,{className:`mt-1 block text-sm text-fg-muted`,children:m}),t[17]=m,t[18]=h);let g;t[19]!==p||t[20]!==h?(g=(0,T.jsxs)(`span`,{children:[p,h]}),t[19]=p,t[20]=h,t[21]=g):g=t[21];let _;t[22]!==g||t[23]!==d?(_=(0,T.jsx)(`section`,{className:`rounded-xl bg-surface-hover/20 p-5`,children:(0,T.jsxs)(`label`,{className:`flex cursor-pointer items-start gap-3`,children:[d,g]})}),t[22]=g,t[23]=d,t[24]=_):_=t[24];let v=i?`执行限制`:`Execution limits`,y;t[25]===v?y=t[26]:(y=(0,T.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:v}),t[25]=v,t[26]=y);let ie=i?`为所有智能体设置安全上限;留空时使用系统默认值。`:`Set safe upper bounds for every agent. Empty fields use system defaults.`,b;t[27]===ie?b=t[28]:(b=(0,T.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:ie}),t[27]=ie,t[28]=b);let oe=i?`每次运行最多轮数`:`Maximum turns per run`,se=n.runtime.maxTurns??``,S=i?`系统默认`:`System default`,C;t[29]!==n||t[30]!==r?(C=e=>r({...n,runtime:{...n.runtime,maxTurns:D(e.target.value)}}),t[29]=n,t[30]=r,t[31]=C):C=t[31];let w;t[32]!==se||t[33]!==S||t[34]!==C?(w=(0,T.jsx)(x,{allowEmpty:!0,type:`number`,min:1,value:se,placeholder:S,onChange:C,className:`${E} mt-2`}),t[32]=se,t[33]=S,t[34]=C,t[35]=w):w=t[35];let O;t[36]!==oe||t[37]!==w?(O=(0,T.jsxs)(`label`,{className:`block text-xs font-medium text-fg-muted`,children:[oe,w]}),t[36]=oe,t[37]=w,t[38]=O):O=t[38];let k=i?`单轮超时(毫秒)`:`Turn timeout (ms)`,A=n.runtime.timeoutMs??``,ue=i?`系统默认`:`System default`,j;t[39]!==n||t[40]!==r?(j=e=>r({...n,runtime:{...n.runtime,timeoutMs:D(e.target.value)}}),t[39]=n,t[40]=r,t[41]=j):j=t[41];let M;t[42]!==A||t[43]!==ue||t[44]!==j?(M=(0,T.jsx)(x,{allowEmpty:!0,type:`number`,min:1,value:A,placeholder:ue,onChange:j,className:`${E} mt-2`}),t[42]=A,t[43]=ue,t[44]=j,t[45]=M):M=t[45];let N;t[46]!==k||t[47]!==M?(N=(0,T.jsxs)(`label`,{className:`block text-xs font-medium text-fg-muted`,children:[k,M]}),t[46]=k,t[47]=M,t[48]=N):N=t[48];let de=i?`每轮最多工具失败次数`:`Maximum tool failures per turn`,P=n.runtime.maxToolFailuresPerTurn??``,fe=i?`系统默认`:`System default`,F;t[49]!==n||t[50]!==r?(F=e=>r({...n,runtime:{...n.runtime,maxToolFailuresPerTurn:D(e.target.value)}}),t[49]=n,t[50]=r,t[51]=F):F=t[51];let pe;t[52]!==P||t[53]!==fe||t[54]!==F?(pe=(0,T.jsx)(x,{allowEmpty:!0,type:`number`,min:1,value:P,placeholder:fe,onChange:F,className:`${E} mt-2`}),t[52]=P,t[53]=fe,t[54]=F,t[55]=pe):pe=t[55];let I;t[56]!==de||t[57]!==pe?(I=(0,T.jsxs)(`label`,{className:`block text-xs font-medium text-fg-muted`,children:[de,pe]}),t[56]=de,t[57]=pe,t[58]=I):I=t[58];let L;t[59]!==O||t[60]!==N||t[61]!==I?(L=(0,T.jsxs)(`div`,{className:`mt-5 grid gap-4 md:grid-cols-3`,children:[O,N,I]}),t[59]=O,t[60]=N,t[61]=I,t[62]=L):L=t[62];let R;t[63]!==y||t[64]!==b||t[65]!==L?(R=(0,T.jsxs)(`section`,{className:`rounded-xl bg-surface-hover/20 p-5`,children:[y,b,L]}),t[63]=y,t[64]=b,t[65]=L,t[66]=R):R=t[66];let z=i?`提示词缓存`:`Prompt cache`,B;t[67]===z?B=t[68]:(B=(0,T.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:z}),t[67]=z,t[68]=B);let V=i?`复用稳定的上下文以降低响应延迟和模型费用。`:`Reuse stable context to reduce latency and model cost.`,H;t[69]===V?H=t[70]:(H=(0,T.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:V}),t[69]=V,t[70]=H);let U=i?`缓存模式`:`Cache mode`,W;t[71]===U?W=t[72]:(W=(0,T.jsx)(`span`,{children:U}),t[71]=U,t[72]=W);let G=i?`缓存模式`:`Cache mode`,K;t[73]===Symbol.for(`react.memo_cache_sentinel`)?(K=[`auto`,`off`],t[73]=K):K=t[73];let q;t[74]!==n||t[75]!==r||t[76]!==i?(q=K.map(e=>(0,T.jsx)(ne,{"aria-pressed":n.runtime.promptCache?.mode===e,variant:n.runtime.promptCache?.mode===e?`secondary`:`ghost`,className:`flex-1 py-1.5 text-xs`,onClick:()=>r({...n,runtime:{...n.runtime,promptCache:{mode:e,lifetime:n.runtime.promptCache?.lifetime??`short`}}}),children:e===`auto`?i?`自动`:`Automatic`:i?`关闭`:`Off`},e)),t[74]=n,t[75]=r,t[76]=i,t[77]=q):q=t[77];let J;t[78]!==G||t[79]!==q?(J=(0,T.jsx)(re,{className:`mt-1.5 flex rounded-lg bg-surface-panel p-1`,role:`group`,"aria-label":G,children:q}),t[78]=G,t[79]=q,t[80]=J):J=t[80];let Y;t[81]!==W||t[82]!==J?(Y=(0,T.jsxs)(`div`,{className:`text-xs font-medium text-fg-muted`,children:[W,J]}),t[81]=W,t[82]=J,t[83]=Y):Y=t[83];let me;t[84]!==n||t[85]!==r||t[86]!==i?(me=n.runtime.promptCache?.mode===`auto`?(0,T.jsxs)(`div`,{className:`text-xs font-medium text-fg-muted`,children:[(0,T.jsx)(`span`,{children:i?`缓存周期`:`Cache lifetime`}),(0,T.jsx)(re,{className:`mt-1.5 flex rounded-lg bg-surface-panel p-1`,role:`group`,"aria-label":i?`缓存周期`:`Cache lifetime`,children:[`short`,`long`].map(e=>(0,T.jsx)(ne,{"aria-pressed":n.runtime.promptCache?.lifetime===e,variant:n.runtime.promptCache?.lifetime===e?`secondary`:`ghost`,className:`flex-1 py-1.5 text-xs`,onClick:()=>r({...n,runtime:{...n.runtime,promptCache:{mode:`auto`,lifetime:e}}}),children:e===`short`?i?`短期`:`Short`:i?`长期`:`Long`},e))})]}):null,t[84]=n,t[85]=r,t[86]=i,t[87]=me):me=t[87];let X;t[88]!==Y||t[89]!==me?(X=(0,T.jsxs)(`div`,{className:`mt-5 grid gap-4 sm:grid-cols-2`,children:[Y,me]}),t[88]=Y,t[89]=me,t[90]=X):X=t[90];let Z;t[91]!==B||t[92]!==H||t[93]!==X?(Z=(0,T.jsxs)(`section`,{className:`rounded-xl bg-surface-hover/20 p-5`,children:[B,H,X]}),t[91]=B,t[92]=H,t[93]=X,t[94]=Z):Z=t[94];let Q;t[95]!==_||t[96]!==R||t[97]!==ee||t[98]!==Z||t[99]!==l?(Q=(0,T.jsxs)(ae,{title:ee,summary:l,children:[_,R,Z]}),t[95]=_,t[96]=R,t[97]=ee,t[98]=Z,t[99]=l,t[100]=Q):Q=t[100];let $;return t[101]!==c||t[102]!==Q?($=(0,T.jsxs)(`div`,{className:`space-y-5`,children:[c,Q]}),t[101]=c,t[102]=Q,t[103]=$):$=t[103],$}function k(e){return[...new Set(e)].sort()}var A=[{id:`core`,names:[`doc-coauthoring`,`define-task`,`find-skills`,`summarize`],en:`Core`,zh:`核心`},{id:`office`,names:[`doc-coauthoring`,`define-task`,`find-skills`,`summarize`,`docx`,`pdf`,`pptx`,`xlsx`],en:`Office`,zh:`办公成果`},{id:`local-app`,names:[`doc-coauthoring`,`define-task`,`find-skills`,`summarize`,`build-xopc-local-app`,`frontend-design`,`theme-factory`],en:`Local App`,zh:`本地应用`},{id:`developer`,names:[`doc-coauthoring`,`define-task`,`find-skills`,`summarize`,`diagnose`,`github`,`tdd`,`webapp-testing`],en:`Developer`,zh:`开发者`},{id:`desktop-pet`,names:[`doc-coauthoring`,`define-task`,`find-skills`,`summarize`,`hatch-pet`],en:`Desktop Pet`,zh:`桌面宠物`}];function ue(e){let t=(0,ce.c)(115),{draft:n,setDraft:r,zh:i}=e,o;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(o={revalidateOnFocus:!1},t[0]=o):o=t[0];let{data:c,error:l,isLoading:te}=p(`agent-defaults-skills-catalog`,v,o),[d,f]=(0,w.useState)(``),ne=n.skills.mode===`selected`?n.skills.include:n.skills.exclude;c?.catalog;let m;if(t[1]!==ne||t[2]!==c?.catalog||t[3]!==d){let e=[...c?.catalog??[]],n=new Set(e.map(P));for(let t of ne)n.has(t)||e.push({name:t,description:``,enabled:!0});let r=d.trim().toLowerCase();m=e.filter(e=>!r||`${e.name} ${e.description}`.toLowerCase().includes(r)).sort(de),t[1]=ne,t[2]=c?.catalog,t[3]=d,t[4]=m}else m=t[4];let h=m,g;t[5]!==n.skills.exclude||t[6]!==n.skills.include||t[7]!==n.skills.mode?(g=e=>n.skills.mode===`selected`?n.skills.include.includes(e):!n.skills.exclude.includes(e),t[5]=n.skills.exclude,t[6]=n.skills.include,t[7]=n.skills.mode,t[8]=g):g=t[8];let _=g,re;t[9]!==n||t[10]!==r?(re=e=>{if(n.skills.mode===`selected`){let t=n.skills.include.includes(e)?n.skills.include.filter(t=>t!==e):k([...n.skills.include,e]);r({...n,skills:{mode:`selected`,include:t}});return}let t=n.skills.exclude.includes(e)?n.skills.exclude.filter(t=>t!==e):k([...n.skills.exclude,e]);r({...n,skills:{mode:`all-enabled`,exclude:t}})},t[9]=n,t[10]=r,t[11]=re):re=t[11];let y=re,ie;t[12]===c?.catalog?ie=t[13]:(ie=c?.catalog??[],t[12]=c?.catalog,t[13]=ie);let b;if(t[14]!==_||t[15]!==ie){let e;t[17]===_?e=t[18]:(e=e=>e.enabled&&_(e.name),t[17]=_,t[18]=e),b=ie.filter(e),t[14]=_,t[15]=ie,t[16]=b}else b=t[16];let ae=b.length,x;t[19]!==c?.catalog||t[20]!==n||t[21]!==r?(x=e=>{let t=new Set((c?.catalog??[]).filter(N).map(M));r({...n,skills:{mode:`selected`,include:k(e.filter(e=>t.has(e)))}})},t[19]=c?.catalog,t[20]=n,t[21]=r,t[22]=x):x=t[22];let oe=x,se=i?`技能策略`:`Skill policy`,S;t[23]===se?S=t[24]:(S=(0,T.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:se}),t[23]=se,t[24]=S);let C=i?`决定所有智能体默认可以使用哪些技能。`:`Choose which skills every agent can discover and use by default.`,E;t[25]===C?E=t[26]:(E=(0,T.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:C}),t[25]=C,t[26]=E);let D;t[27]!==n||t[28]!==r?(D=()=>r({...n,skills:{mode:`all-enabled`,exclude:[]}}),t[27]=n,t[28]=r,t[29]=D):D=t[29];let le=n.skills.mode===`all-enabled`?`bg-accent-soft shadow-surface`:`hover:bg-surface-hover`,O;t[30]===le?O=t[31]:(O=u(`flex items-start gap-3 rounded-xl bg-surface-base/55 p-4 text-left focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,le),t[30]=le,t[31]=O);let ue;t[32]===Symbol.for(`react.memo_cache_sentinel`)?(ue=(0,T.jsx)(a,{className:`mt-0.5 size-5 shrink-0 text-accent`}),t[32]=ue):ue=t[32];let fe=i?`使用所有已启用技能`:`Use every enabled skill`,F;t[33]===fe?F=t[34]:(F=(0,T.jsx)(`span`,{className:`block text-sm font-medium text-fg`,children:fe}),t[33]=fe,t[34]=F);let pe=i?`适合需要完整目录的高级智能体;新增技能会自动加入。`:`For advanced agents that need the full catalog; newly enabled skills are added automatically.`,I;t[35]===pe?I=t[36]:(I=(0,T.jsx)(`span`,{className:`mt-1 block text-xs leading-5 text-fg-muted`,children:pe}),t[35]=pe,t[36]=I);let L;t[37]!==F||t[38]!==I?(L=(0,T.jsxs)(`span`,{children:[F,I]}),t[37]=F,t[38]=I,t[39]=L):L=t[39];let R;t[40]!==D||t[41]!==O||t[42]!==L?(R=(0,T.jsxs)(`button`,{type:`button`,onClick:D,className:O,children:[ue,L]}),t[40]=D,t[41]=O,t[42]=L,t[43]=R):R=t[43];let z;t[44]!==n||t[45]!==r?(z=()=>r({...n,skills:{mode:`selected`,include:[]}}),t[44]=n,t[45]=r,t[46]=z):z=t[46];let B=n.skills.mode===`selected`?`bg-accent-soft shadow-surface`:`hover:bg-surface-hover`,V;t[47]===B?V=t[48]:(V=u(`flex items-start gap-3 rounded-xl bg-surface-base/55 p-4 text-left focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,B),t[47]=B,t[48]=V);let H;t[49]===Symbol.for(`react.memo_cache_sentinel`)?(H=(0,T.jsx)(s,{className:`mt-0.5 size-5 shrink-0 text-accent`}),t[49]=H):H=t[49];let U=i?`只使用选中的技能`:`Use selected skills only`,W;t[50]===U?W=t[51]:(W=(0,T.jsx)(`span`,{className:`block text-sm font-medium text-fg`,children:U}),t[50]=U,t[51]=W);let G=i?`适合严格受控的环境;新增技能不会自动加入。`:`For tightly controlled environments; new skills are not added automatically.`,K;t[52]===G?K=t[53]:(K=(0,T.jsx)(`span`,{className:`mt-1 block text-xs leading-5 text-fg-muted`,children:G}),t[52]=G,t[53]=K);let q;t[54]!==W||t[55]!==K?(q=(0,T.jsxs)(`span`,{children:[W,K]}),t[54]=W,t[55]=K,t[56]=q):q=t[56];let J;t[57]!==z||t[58]!==V||t[59]!==q?(J=(0,T.jsxs)(`button`,{type:`button`,onClick:z,className:V,children:[H,q]}),t[57]=z,t[58]=V,t[59]=q,t[60]=J):J=t[60];let Y;t[61]!==R||t[62]!==J?(Y=(0,T.jsxs)(`div`,{className:`mt-5 grid gap-3 sm:grid-cols-2`,children:[R,J]}),t[61]=R,t[62]=J,t[63]=Y):Y=t[63];let me=i?`能力组合(会替换当前选择)`:`Capability packs (replaces the current selection)`,X;t[64]===me?X=t[65]:(X=(0,T.jsx)(`p`,{className:`text-xs font-medium text-fg-muted`,children:me}),t[64]=me,t[65]=X);let Z;t[66]!==oe||t[67]!==c||t[68]!==i?(Z=A.map(e=>(0,T.jsx)(`button`,{type:`button`,onClick:()=>oe(e.names),disabled:!c,className:`rounded-lg border border-edge bg-surface-panel px-3 py-1.5 text-xs font-medium text-fg transition-colors hover:bg-surface-hover disabled:cursor-not-allowed disabled:opacity-50`,children:i?e.zh:e.en},e.id)),t[66]=oe,t[67]=c,t[68]=i,t[69]=Z):Z=t[69];let Q;t[70]===Z?Q=t[71]:(Q=(0,T.jsx)(`div`,{className:`mt-2 flex flex-wrap gap-2`,children:Z}),t[70]=Z,t[71]=Q);let $;t[72]!==X||t[73]!==Q?($=(0,T.jsxs)(`div`,{className:`mt-4`,children:[X,Q]}),t[72]=X,t[73]=Q,t[74]=$):$=t[74];let he;t[75]!==E||t[76]!==Y||t[77]!==$||t[78]!==S?(he=(0,T.jsxs)(`section`,{className:`rounded-xl bg-surface-hover/20 p-5`,children:[S,E,Y,$]}),t[75]=E,t[76]=Y,t[77]=$,t[78]=S,t[79]=he):he=t[79];let ge=n.skills.mode===`selected`?i?`选择可用技能`:`Select available skills`:i?`管理例外`:`Manage exceptions`,_e;t[80]===ge?_e=t[81]:(_e=(0,T.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:ge}),t[80]=ge,t[81]=_e);let ve=i?`当前默认可用 ${ae} 个技能。`:`${ae} skills are available by default.`,ye;t[82]===ve?ye=t[83]:(ye=(0,T.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:ve}),t[82]=ve,t[83]=ye);let be;t[84]!==_e||t[85]!==ye?(be=(0,T.jsxs)(`div`,{children:[_e,ye]}),t[84]=_e,t[85]=ye,t[86]=be):be=t[86];let xe=i?`搜索技能`:`Search skills`,Se;t[87]===xe?Se=t[88]:(Se=(0,T.jsx)(`span`,{className:`sr-only`,children:xe}),t[87]=xe,t[88]=Se);let Ce;t[89]===Symbol.for(`react.memo_cache_sentinel`)?(Ce=(0,T.jsx)(ee,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-fg-subtle`}),t[89]=Ce):Ce=t[89];let we;t[90]===Symbol.for(`react.memo_cache_sentinel`)?(we=e=>f(e.target.value),t[90]=we):we=t[90];let Te=i?`搜索技能`:`Search skills`,Ee;t[91]!==d||t[92]!==Te?(Ee=(0,T.jsx)(`input`,{type:`search`,value:d,onChange:we,placeholder:Te,className:`w-full rounded-lg border border-edge bg-surface-panel py-2 pl-9 pr-3 text-sm text-fg outline-none focus:border-accent`}),t[91]=d,t[92]=Te,t[93]=Ee):Ee=t[93];let De;t[94]!==Se||t[95]!==Ee?(De=(0,T.jsxs)(`label`,{className:`relative block w-full sm:w-72`,children:[Se,Ce,Ee]}),t[94]=Se,t[95]=Ee,t[96]=De):De=t[96];let Oe;t[97]!==be||t[98]!==De?(Oe=(0,T.jsxs)(`div`,{className:`flex flex-wrap items-end justify-between gap-3`,children:[be,De]}),t[97]=be,t[98]=De,t[99]=Oe):Oe=t[99];let ke;t[100]===l?ke=t[101]:(ke=l?(0,T.jsx)(`p`,{className:`mt-4 rounded-lg bg-red-500/10 px-3 py-2 text-sm text-red-600`,children:l instanceof Error?l.message:String(l)}):null,t[100]=l,t[101]=ke);let Ae;t[102]!==_||t[103]!==te||t[104]!==h||t[105]!==y||t[106]!==i?(Ae=te?(0,T.jsx)(`div`,{className:`mt-4 space-y-2`,children:[0,1,2,3].map(j)}):(0,T.jsxs)(`div`,{className:`mt-4 flex max-h-[32rem] flex-col gap-1 overflow-y-auto rounded-xl bg-surface-base/45 p-1 [&>label]:rounded-lg [&>label]:bg-surface-panel/55`,children:[h.map(e=>{let t=_(e.name);return(0,T.jsxs)(`label`,{className:u(`flex cursor-pointer items-start gap-3 px-4 py-3 hover:bg-surface-hover/60`,!e.enabled&&`cursor-not-allowed opacity-55`),children:[(0,T.jsx)(`input`,{type:`checkbox`,checked:t,disabled:!e.enabled,onChange:()=>y(e.name),className:`mt-0.5 size-4 rounded border-edge accent-[var(--color-accent)]`}),(0,T.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,T.jsxs)(`span`,{className:`flex flex-wrap items-center gap-2`,children:[(0,T.jsx)(`span`,{className:`text-sm font-medium text-fg`,children:e.name}),e.enabled?null:(0,T.jsx)(`span`,{className:`rounded-full bg-surface-hover px-2 py-0.5 text-[10px] text-fg-muted`,children:i?`全局未启用`:`Disabled globally`})]}),e.description?(0,T.jsx)(`span`,{className:`mt-1 block line-clamp-2 text-xs leading-5 text-fg-muted`,children:e.description}):null]})]},e.name)}),h.length===0?(0,T.jsx)(`p`,{className:`px-4 py-8 text-center text-sm text-fg-muted`,children:i?`没有匹配的技能。`:`No matching skills.`}):null]}),t[102]=_,t[103]=te,t[104]=h,t[105]=y,t[106]=i,t[107]=Ae):Ae=t[107];let je;t[108]!==Oe||t[109]!==ke||t[110]!==Ae?(je=(0,T.jsxs)(`section`,{className:`rounded-xl bg-surface-hover/20 p-5`,children:[Oe,ke,Ae]}),t[108]=Oe,t[109]=ke,t[110]=Ae,t[111]=je):je=t[111];let Me;return t[112]!==he||t[113]!==je?(Me=(0,T.jsxs)(`div`,{className:`space-y-5`,children:[he,je]}),t[112]=he,t[113]=je,t[114]=Me):Me=t[114],Me}function j(e){return(0,T.jsx)(m,{className:`h-14 rounded-xl`},e)}function M(e){return e.name}function N(e){return e.enabled}function de(e,t){return e.name.localeCompare(t.name)}function P(e){return e.name}function fe(e){let t=Number.parseInt(e,10);return Number.isFinite(t)&&t>0?t:void 0}function F(e){let t=(0,ce.c)(101),{draft:n,setDraft:r,builtinTools:i,zh:a}=e,o=y(),[s,c]=(0,w.useState)(``),[l,d]=(0,w.useState)(`all`),[f,p]=(0,w.useState)(),m;t[0]===i?m=t[1]:(m=new Map(i.map(L)),t[0]=i,t[1]=m);let h=m,g;t[2]!==i||t[3]!==n.tools?(g=[...new Set([...i.map(I),...Object.keys(n.tools)])].filter(pe).sort(),t[2]=i,t[3]=n.tools,t[4]=g):g=t[4];let _=g,v;if(t[5]!==_||t[6]!==n.tools){let e;t[8]===n.tools?e=t[9]:(e=e=>(n.tools[e]?.mode??`allow`)===`allow`,t[8]=n.tools,t[9]=e),v=_.filter(e),t[5]=_,t[6]=n.tools,t[7]=v}else v=t[7];let ie=v.length,b;if(t[10]!==_||t[11]!==n.tools){let e;t[13]===n.tools?e=t[14]:(e=e=>n.tools[e]?.mode===`ask`,t[13]=n.tools,t[14]=e),b=_.filter(e),t[10]=_,t[11]=n.tools,t[12]=b}else b=t[12];let oe=b.length,se;if(t[15]!==_||t[16]!==n.tools){let e;t[18]===n.tools?e=t[19]:(e=e=>n.tools[e]?.mode===`deny`,t[18]=n.tools,t[19]=e),se=_.filter(e),t[15]=_,t[16]=n.tools,t[17]=se}else se=t[17];let S;t[20]!==v.length||t[21]!==b.length||t[22]!==se.length?(S={allow:ie,ask:oe,deny:se.length},t[20]=v.length,t[21]=b.length,t[22]=se.length,t[23]=S):S=t[23];let C=S,E;if(t[24]!==_||t[25]!==h||t[26]!==n.tools||t[27]!==l||t[28]!==s){let e=s.trim().toLowerCase();E=_.filter(t=>{let r=n.tools[t]?.mode??`allow`,i=h.get(t),a=`${t} ${i?.en??``} ${i?.zh??``}`.toLowerCase();return(!e||a.includes(e))&&(l===`all`||r===l)}),t[24]=_,t[25]=h,t[26]=n.tools,t[27]=l,t[28]=s,t[29]=E}else E=t[29];let D=E,le;t[30]!==n||t[31]!==r?(le=(e,t)=>{let i=n.tools[e]??{mode:`allow`};r({...n,tools:{...n.tools,[e]:{...i,...t}}})},t[30]=n,t[31]=r,t[32]=le):le=t[32];let O=le,k=a?`全部 ${_.length}`:`All ${_.length}`,A;t[33]===k?A=t[34]:(A={id:`all`,label:k},t[33]=k,t[34]=A);let ue=a?`允许 ${C.allow}`:`Allow ${C.allow}`,j;t[35]===ue?j=t[36]:(j={id:`allow`,label:ue},t[35]=ue,t[36]=j);let M=a?`询问 ${C.ask}`:`Ask ${C.ask}`,N;t[37]===M?N=t[38]:(N={id:`ask`,label:M},t[37]=M,t[38]=N);let de=a?`禁用 ${C.deny}`:`Deny ${C.deny}`,P;t[39]===de?P=t[40]:(P={id:`deny`,label:de},t[39]=de,t[40]=P);let F;t[41]!==A||t[42]!==j||t[43]!==N||t[44]!==P?(F=[A,j,N,P],t[41]=A,t[42]=j,t[43]=N,t[44]=P,t[45]=F):F=t[45];let R=F,z=a?`默认工具权限`:`Default tool permissions`,B;t[46]===z?B=t[47]:(B=(0,T.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:z}),t[46]=z,t[47]=B);let V=a?`允许:直接执行;询问:执行前确认;禁用:智能体无法使用。`:`Allow runs directly, Ask requires confirmation, and Deny makes the tool unavailable.`,H;t[48]===V?H=t[49]:(H=(0,T.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:V}),t[48]=V,t[49]=H);let U;t[50]!==B||t[51]!==H?(U=(0,T.jsxs)(`div`,{children:[B,H]}),t[50]=B,t[51]=H,t[52]=U):U=t[52];let W=a?`工具筛选`:`Tool filter`,G;t[53]!==l||t[54]!==R?(G=R.map(e=>(0,T.jsx)(`button`,{"aria-pressed":l===e.id,type:`button`,onClick:()=>d(e.id),className:u(`rounded-lg px-3 py-1.5 text-xs font-medium`,l===e.id?`bg-surface-base text-fg shadow-surface`:`text-fg-muted hover:text-fg`),children:e.label},e.id)),t[53]=l,t[54]=R,t[55]=G):G=t[55];let K;t[56]!==W||t[57]!==G?(K=(0,T.jsx)(re,{className:`flex flex-wrap gap-1 rounded-xl bg-surface-panel p-1`,role:`group`,"aria-label":W,indicatorClassName:`rounded-lg bg-surface-base shadow-surface`,children:G}),t[56]=W,t[57]=G,t[58]=K):K=t[58];let q=a?`搜索工具`:`Search tools`,J;t[59]===q?J=t[60]:(J=(0,T.jsx)(`span`,{className:`sr-only`,children:q}),t[59]=q,t[60]=J);let Y;t[61]===Symbol.for(`react.memo_cache_sentinel`)?(Y=(0,T.jsx)(ee,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-fg-subtle`}),t[61]=Y):Y=t[61];let me;t[62]===Symbol.for(`react.memo_cache_sentinel`)?(me=e=>c(e.target.value),t[62]=me):me=t[62];let X=a?`搜索工具`:`Search tools`,Z;t[63]!==s||t[64]!==X?(Z=(0,T.jsx)(`input`,{type:`search`,value:s,onChange:me,placeholder:X,className:`w-full rounded-lg border border-edge bg-surface-panel py-2 pl-9 pr-3 text-sm text-fg outline-none focus:border-accent`}),t[63]=s,t[64]=X,t[65]=Z):Z=t[65];let Q;t[66]!==J||t[67]!==Z?(Q=(0,T.jsxs)(`label`,{className:`relative block w-full sm:w-72`,children:[J,Y,Z]}),t[66]=J,t[67]=Z,t[68]=Q):Q=t[68];let $;t[69]!==K||t[70]!==Q?($=(0,T.jsxs)(`div`,{className:`mt-5 flex flex-wrap items-center justify-between gap-3`,children:[K,Q]}),t[69]=K,t[70]=Q,t[71]=$):$=t[71];let he=a?`工具调用限制`:`Tool call limits`,ge=a?`每个工具的调用次数和超时限制继续生效;授权可在下方直接修改。`:`Call and timeout limits remain active; edit permissions below.`,_e;t[72]!==he||t[73]!==ge?(_e=(0,T.jsx)(ae,{title:he,summary:ge,children:null}),t[72]=he,t[73]=ge,t[74]=_e):_e=t[74];let ve;if(t[75]!==h||t[76]!==n.tools||t[77]!==f||t[78]!==o||t[79]!==O||t[80]!==D||t[81]!==a){let e;t[83]!==h||t[84]!==n.tools||t[85]!==f||t[86]!==o||t[87]!==O||t[88]!==a?(e=e=>{let t=n.tools[e]??{mode:`allow`},r=h.get(e),i=f===e;return(0,T.jsxs)(`div`,{className:`px-4 py-3`,children:[(0,T.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[(0,T.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,T.jsx)(`code`,{className:`text-xs font-medium text-fg`,children:e}),r?(0,T.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:a?r.zh:r.en}):null]}),(0,T.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,T.jsx)(re,{className:`flex rounded-lg bg-surface-base p-1`,role:`group`,"aria-label":e,indicatorClassName:`rounded-md bg-accent`,children:[`allow`,`ask`,`deny`].map(n=>(0,T.jsx)(`button`,{"aria-pressed":t.mode===n,type:`button`,onClick:()=>O(e,{mode:n}),className:u(`rounded-md px-2.5 py-1 text-xs font-medium capitalize`,t.mode===n?`bg-accent text-on-accent`:`text-fg-muted hover:text-fg`),children:n===`allow`?a?`允许`:`Allow`:n===`ask`?a?`询问`:`Ask`:a?`禁用`:`Deny`},n))}),o?(0,T.jsx)(ne,{variant:`ghost`,className:`px-2 py-1`,"aria-label":a?`${e} 调用限制`:`${e} call limits`,onClick:()=>p(i?void 0:e),children:(0,T.jsx)(te,{className:`size-4`})}):null]})]}),i&&o?(0,T.jsxs)(`div`,{className:`mt-3 grid gap-3 rounded-lg bg-surface-base p-3 sm:grid-cols-2`,children:[(0,T.jsxs)(`label`,{className:`block text-xs font-medium text-fg-muted`,children:[a?`每轮最多调用次数`:`Maximum calls per turn`,(0,T.jsx)(x,{allowEmpty:!0,type:`number`,min:1,value:t.maxCallsPerTurn??``,placeholder:a?`不限制`:`Unlimited`,onChange:t=>O(e,{maxCallsPerTurn:fe(t.target.value)}),className:`mt-2 w-full rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg outline-none focus:border-accent`})]}),(0,T.jsxs)(`label`,{className:`block text-xs font-medium text-fg-muted`,children:[a?`单次超时(毫秒)`:`Call timeout (ms)`,(0,T.jsx)(x,{allowEmpty:!0,type:`number`,min:1,value:t.timeoutMs??``,placeholder:a?`使用系统默认值`:`Use system default`,onChange:t=>O(e,{timeoutMs:fe(t.target.value)}),className:`mt-2 w-full rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg outline-none focus:border-accent`})]})]}):null]},e)},t[83]=h,t[84]=n.tools,t[85]=f,t[86]=o,t[87]=O,t[88]=a,t[89]=e):e=t[89],ve=D.map(e),t[75]=h,t[76]=n.tools,t[77]=f,t[78]=o,t[79]=O,t[80]=D,t[81]=a,t[82]=ve}else ve=t[82];let ye;t[90]!==D.length||t[91]!==a?(ye=D.length===0?(0,T.jsx)(`p`,{className:`px-4 py-10 text-center text-sm text-fg-muted`,children:a?`没有匹配的工具。`:`No matching tools.`}):null,t[90]=D.length,t[91]=a,t[92]=ye):ye=t[92];let be;t[93]!==ve||t[94]!==ye?(be=(0,T.jsxs)(`div`,{className:`mt-4 flex max-h-[38rem] flex-col gap-1 overflow-y-auto rounded-xl bg-surface-base/45 p-1 [&>*]:rounded-lg [&>*]:bg-surface-panel/55`,children:[ve,ye]}),t[93]=ve,t[94]=ye,t[95]=be):be=t[95];let xe;return t[96]!==U||t[97]!==$||t[98]!==_e||t[99]!==be?(xe=(0,T.jsxs)(`section`,{className:`rounded-xl bg-surface-hover/20 p-5`,children:[U,$,_e,be]}),t[96]=U,t[97]=$,t[98]=_e,t[99]=be,t[100]=xe):xe=t[100],xe}function pe(e){return e!==`computer_use`||_()}function I(e){return e.id}function L(e){return[e.id,e.description]}function R(){let e=(0,ce.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,T.jsxs)(oe,{gap:`gap-5`,children:[(0,T.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,T.jsxs)(`div`,{className:`space-y-2`,children:[(0,T.jsx)(m,{className:`h-7 w-56`}),(0,T.jsx)(m,{className:`h-4 w-96 max-w-full`})]}),(0,T.jsx)(m,{className:`h-9 w-28`})]}),(0,T.jsx)(m,{className:`h-20 rounded-2xl`}),(0,T.jsx)(m,{className:`h-12 rounded-xl`}),(0,T.jsx)(m,{className:`h-72 rounded-2xl`})]}),e[0]=t):t=e[0],t}function z(e){let t=(0,ce.c)(65),{initial:n,builtinTools:r,zh:a}=e,[s,ee]=i(),te;t[0]===s?te=t[1]:(te=s.get(`panel`),t[0]=s,t[1]=te);let d=te,f=d===`skills`||d===`tools`||d===`runtime`?d:`skills`,p;t[2]!==s||t[3]!==ee?(p=e=>{let t=new URLSearchParams(s);t.set(`panel`,e),ee(t,{replace:!0})},t[2]=s,t[3]=ee,t[4]=p):p=t[4];let m=p,h;t[5]===n?h=t[6]:(h=()=>structuredClone(n),t[5]=n,t[6]=h);let[g,_]=(0,w.useState)(h),v;t[7]===n?v=t[8]:(v=()=>structuredClone(n),t[7]=n,t[8]=v);let[y,ae]=(0,w.useState)(v),x;t[9]===g?x=t[10]:(x=JSON.stringify(g),t[9]=g,t[10]=x);let E;t[11]===y?E=t[12]:(E=JSON.stringify(y),t[11]=y,t[12]=E);let D=x!==E,le=a?`技能`:`Skills`,k;t[13]===le?k=t[14]:(k={id:`skills`,label:le,icon:c},t[13]=le,t[14]=k);let A=a?`工具`:`Tools`,j;t[15]===A?j=t[16]:(j={id:`tools`,label:A,icon:l},t[15]=A,t[16]=j);let M=a?`运行`:`Runtime`,N;t[17]===M?N=t[18]:(N={id:`runtime`,label:M,icon:o},t[17]=M,t[18]=N);let de;t[19]!==j||t[20]!==N||t[21]!==k?(de=[k,j,N],t[19]=j,t[20]=N,t[21]=k,t[22]=de):de=t[22];let P=de,fe;t[23]===Symbol.for(`react.memo_cache_sentinel`)?(fe=async e=>{let t=structuredClone(e),n=await b(),r=await ie({...t,models:n.defaults.models},{scope:`agent`}),i=structuredClone(r.defaults);_(e=>JSON.stringify(e)===JSON.stringify(t)?i:e),ae(structuredClone(i))},t[23]=fe):fe=t[23];let pe=fe,I;t[24]!==D||t[25]!==g?(I={value:g,dirty:D,onSave:pe,delayMs:0},t[24]=D,t[25]=g,t[26]=I):I=t[26];let L=C(I),R=L.onBlurCapture,z=a?`智能体设置`:`Agent settings`,B;t[27]!==L.error||t[28]!==L.status?(B=(0,T.jsx)(S,{status:L.status,error:L.error}),t[27]=L.error,t[28]=L.status,t[29]=B):B=t[29];let V;t[30]!==z||t[31]!==B?(V=(0,T.jsx)(se,{title:z,actions:B}),t[30]=z,t[31]=B,t[32]=V):V=t[32];let H;t[33]!==L.error||t[34]!==L.retry||t[35]!==a?(H=L.error?(0,T.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2 rounded-xl bg-red-500/10 px-3 py-2 text-sm text-red-600`,children:[(0,T.jsx)(`span`,{children:L.error}),(0,T.jsx)(ne,{type:`button`,variant:`ghost`,className:`h-8 text-red-600`,onClick:L.retry,children:a?`重试`:`Retry`})]}):null,t[33]=L.error,t[34]=L.retry,t[35]=a,t[36]=H):H=t[36];let U=a?`默认配置分区`:`Default configuration sections`,W;t[37]!==f||t[38]!==m||t[39]!==P?(W=P.map(e=>{let{id:t,label:n,icon:r}=e;return(0,T.jsxs)(`button`,{type:`button`,"aria-pressed":f===t,onClick:()=>m(t),className:u(`flex min-w-0 items-center justify-center gap-2 rounded-lg px-3 py-2.5 text-left transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,f===t?`bg-surface-base text-fg shadow-surface`:`text-fg-muted hover:bg-surface-hover hover:text-fg`),children:[(0,T.jsx)(r,{className:u(`size-4 shrink-0`,f===t?`text-accent`:`text-fg-subtle`)}),(0,T.jsx)(`span`,{className:`text-sm font-medium`,children:n})]},t)}),t[37]=f,t[38]=m,t[39]=P,t[40]=W):W=t[40];let G;t[41]!==U||t[42]!==W?(G=(0,T.jsx)(re,{as:`nav`,className:`grid grid-cols-3 gap-1 rounded-xl bg-surface-hover/20 p-1`,"aria-label":U,indicatorClassName:`rounded-lg bg-surface-base shadow-surface`,children:W}),t[41]=U,t[42]=W,t[43]=G):G=t[43];let K;t[44]!==f||t[45]!==g||t[46]!==a?(K=f===`skills`?(0,T.jsx)(ue,{draft:g,setDraft:_,zh:a}):null,t[44]=f,t[45]=g,t[46]=a,t[47]=K):K=t[47];let q;t[48]!==f||t[49]!==r||t[50]!==g||t[51]!==a?(q=f===`tools`?(0,T.jsx)(F,{draft:g,setDraft:_,builtinTools:r,zh:a}):null,t[48]=f,t[49]=r,t[50]=g,t[51]=a,t[52]=q):q=t[52];let J;t[53]!==f||t[54]!==g||t[55]!==a?(J=f===`runtime`?(0,T.jsx)(O,{draft:g,setDraft:_,zh:a}):null,t[53]=f,t[54]=g,t[55]=a,t[56]=J):J=t[56];let Y;return t[57]!==L.onBlurCapture||t[58]!==V||t[59]!==H||t[60]!==G||t[61]!==K||t[62]!==q||t[63]!==J?(Y=(0,T.jsxs)(oe,{gap:`gap-5`,onBlurCapture:R,children:[V,H,G,K,q,J]}),t[57]=L.onBlurCapture,t[58]=V,t[59]=H,t[60]=G,t[61]=K,t[62]=q,t[63]=J,t[64]=Y):Y=t[64],Y}function B(){let e=(0,ce.c)(17),t=d(H),n=f(V)===`zh`,{data:r,error:i,isLoading:a,mutate:o}=p(t?`settings-agent-defaults`:null,b);if(!t){let t=n?`需要本机服务令牌。`:`Local service token required.`,r;return e[0]===t?r=e[1]:(r=(0,T.jsx)(oe,{children:(0,T.jsx)(`p`,{className:`text-sm text-fg-muted`,children:t})}),e[0]=t,e[1]=r),r}if(i&&!r){let t=String(i),r;e[2]===t?r=e[3]:(r=(0,T.jsx)(`p`,{className:`rounded-xl bg-red-500/10 px-3 py-2 text-sm text-red-600`,children:t}),e[2]=t,e[3]=r);let a;e[4]===o?a=e[5]:(a=()=>void o(),e[4]=o,e[5]=a);let s=n?`重试`:`Retry`,c;e[6]!==a||e[7]!==s?(c=(0,T.jsx)(ne,{onClick:a,children:s}),e[6]=a,e[7]=s,e[8]=c):c=e[8];let ee;return e[9]!==r||e[10]!==c?(ee=(0,T.jsxs)(oe,{children:[r,c]}),e[9]=r,e[10]=c,e[11]=ee):ee=e[11],ee}if(a||!r){let t;return e[12]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,T.jsx)(R,{}),e[12]=t):t=e[12],t}let s;return e[13]!==r.builtinTools||e[14]!==r.defaults||e[15]!==n?(s=(0,T.jsx)(z,{initial:r.defaults,builtinTools:r.builtinTools,zh:n}),e[13]=r.builtinTools,e[14]=r.defaults,e[15]=n,e[16]=s):s=e[16],s}function V(e){return e.language}function H(e){return e.conversationId}export{B as AgentDefaultsSettingsPanel};
@@ -1 +0,0 @@
1
- import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{l as i,t as a,u as o}from"./chunk-KS7C4IRE-CiwuuyV8.js";import{t as s}from"./arrow-left-D880xG-P.js";import{t as c}from"./chevron-down-ccbiQQz_.js";import{t as l}from"./working-directory-picker-modal-DHl2cZY1.js";import{t as ee}from"./circle-alert-BEjgurr2.js";import{t as te}from"./circle-check-C23XjkUj.js";import{t as u}from"./circle-BoO4YvTx.js";import{t as ne}from"./file-archive-DanfQJNe.js";import{t as d}from"./folder-open-CyzJ19I9.js";import{t as re}from"./loader-circle-CifKLtgG.js";import{t as ie}from"./package-wATCyihJ.js";import{t as f}from"./shield-check-BU58siTV.js";import{t as p}from"./upload-rrb46c3c.js";import{t as m}from"./messages-DRR9N3HC.js";import{t as h}from"./cn-0WouolD0.js";import{i as ae,n as g,o as _}from"./locale-store-lIXD1FMw.js";import{a as v}from"./vendor-swr-CdRzEUwF.js";import{t as y}from"./button-CnRSIP6m.js";import{t as oe}from"./skeleton-BI5TyibZ.js";import{a as b,i as x,o as S,r as C,s as w,t as T}from"./dist-DfWfZ9iu.js";import{t as se}from"./capability-links-DzQWK1Fh.js";import{t as E}from"./browser-BLJWD7WI.js";import{t as D}from"./capability-icon-DVoZxEgW.js";var ce=n(),O=e(E(),1),k=e(t(),1),A=r();function j(e){let t=(0,ce.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,A.jsx)(A.Fragment,{children:a.map(e=>{let[t,n]=e;return(0,A.jsxs)(`label`,{className:`block space-y-1.5 text-sm`,children:[(0,A.jsxs)(`span`,{children:[n.title,n.required?` *`:``]}),n.type===`boolean`?(0,A.jsx)(`input`,{type:`checkbox`,checked:r[t]===!0,onChange:e=>i({...r,[t]:e.target.checked})}):(0,A.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 M(e){let t=(0,ce.c)(62),{account:n,fields:r,zh:i,busy:a,attempt:o,initialMethod:c,onBack:l,onConnect:ee,onSave:te,onRedirect:u,onSkip:ne}=e,[d,ie]=(0,k.useState)(c&&n.methods.some(e=>e.id===c)?c:n.methods[0]?.id??``),f;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(f={},t[0]=f):f=t[0];let[p,m]=(0,k.useState)(f),[h,ae]=(0,k.useState)(``),[g,_]=(0,k.useState)(),v;t[1]===d?v=t[2]:(v=e=>e.id===d,t[1]=d,t[2]=v);let b=n.methods.find(v),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 _(void 0),C&&O.toDataURL(C,{width:240,margin:2}).then(t=>{e||_(t)}).catch(P),()=>{e=!0}},T=[C],t[5]=C,t[6]=w,t[7]=T),(0,k.useEffect)(w,T);let se;t[8]===o?se=t[9]:(se=o&&![`cancelled`,`error`,`connected`].includes(o.state),t[8]=o,t[9]=se);let E=se,D=o?.authorizationUrl??o?.challenge?.url,M=`连接 ${n.title}`,F=`Connect ${n.title}`,I;t[10]!==S||t[11]!==M||t[12]!==F?(I=S(M,F),t[10]=S,t[11]=M,t[12]=F,t[13]=I):I=t[13];let L;t[14]===S?L=t[15]:(L=S(`返回插件详情`,`Back to plugin details`),t[14]=S,t[15]=L);let R;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(R=(0,A.jsx)(s,{className:`size-4`}),t[16]=R):R=t[16];let z;t[17]!==l||t[18]!==L?(z=(0,A.jsx)(y,{variant:`ghost`,className:`shrink-0`,onClick:l,"aria-label":L,children:R}),t[17]=l,t[18]=L,t[19]=z):z=t[19];let B;t[20]===S?B=t[21]:(B=S(`连接 `,`Connect `),t[20]=S,t[21]=B);let V;t[22]!==n.title||t[23]!==B?(V=(0,A.jsxs)(`h3`,{className:`text-base font-semibold`,children:[B,n.title]}),t[22]=n.title,t[23]=B,t[24]=V):V=t[24];let H;t[25]!==n.description||t[26]!==S?(H=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]=H):H=t[27];let U;t[28]===H?U=t[29]:(U=(0,A.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:H}),t[28]=H,t[29]=U);let W;t[30]!==V||t[31]!==U?(W=(0,A.jsxs)(`div`,{children:[V,U]}),t[30]=V,t[31]=U,t[32]=W):W=t[32];let G;t[33]!==z||t[34]!==W?(G=(0,A.jsxs)(`div`,{className:`flex items-start gap-3`,children:[z,W]}),t[33]=z,t[34]=W,t[35]=G):G=t[35];let K;t[36]!==n.methods||t[37]!==E||t[38]!==a||t[39]!==d||t[40]!==S?(K=n.methods.length>1?(0,A.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,A.jsx)(`button`,{role:`tab`,type:`button`,"aria-selected":d===e.id,className:`min-h-10 rounded-md px-3 text-sm ${d===e.id?`bg-surface-panel font-medium text-fg`:`text-fg-muted`}`,disabled:a||!!E,onClick:()=>{ie(e.id),m({})},children:e.title},e.id))}):null,t[36]=n.methods,t[37]=E,t[38]=a,t[39]=d,t[40]=S,t[41]=K):K=t[41];let q=b?.instructions?.length||b?.helpUrl?(0,A.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,A.jsx)(`ol`,{className:`list-decimal space-y-2 pl-5`,children:b.instructions.map(N)}):null,b.helpUrl?(0,A.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)&&!E?(0,A.jsxs)(`form`,{className:`space-y-4`,onSubmit:e=>{e.preventDefault(),te(b.id,p)},children:[(0,A.jsx)(j,{fields:Object.fromEntries((b.fields??[]).filter(e=>r[e]).map(e=>[e,{...r[e],required:!0}])),values:p,onChange:m}),(0,A.jsxs)(y,{type:`submit`,disabled:a||!b.fields?.every(e=>p[e]!==void 0&&p[e]!==``),children:[a?(0,A.jsx)(re,{className:`size-4 animate-spin`,"aria-hidden":!0}):null,S(`保存并连接`,`Save and connect`)]})]}):(0,A.jsxs)(`div`,{className:`space-y-4`,children:[E?null:(0,A.jsx)(y,{disabled:a,onClick:()=>ee(d),children:S(`连接账号`,`Connect account`)}),E?(0,A.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&&E?g?(0,A.jsx)(`img`,{src:g,alt:S(`使用 ${n.title} 扫码授权`,`Scan to authorize ${n.title}`),className:`mx-auto size-60 max-w-full rounded-lg`}):(0,A.jsx)(oe,{className:`mx-auto size-60`}):null,D&&E?(0,A.jsx)(`a`,{href:D,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&&E?(0,A.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,A.jsx)(`p`,{role:`alert`,className:`text-sm text-fg-muted`,children:o.error}):null,o?.acceptsRedirect&&E?(0,A.jsxs)(`details`,{className:`text-sm`,children:[(0,A.jsx)(`summary`,{className:`cursor-pointer text-fg-muted`,children:S(`登录后没有自动返回?`,`Did sign-in not return automatically?`)}),(0,A.jsxs)(`form`,{className:`mt-3 space-y-3`,onSubmit:e=>{e.preventDefault(),u(h)},children:[(0,A.jsxs)(`label`,{children:[S(`登录回调地址`,`Sign-in callback URL`),(0,A.jsx)(`input`,{value:h,onChange:e=>ae(e.target.value),className:`mt-1 w-full rounded-lg border border-edge bg-surface-inset p-2`})]}),(0,A.jsx)(y,{type:`submit`,disabled:a||!h,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]!==ne||t[46]!==Y?(X=(0,A.jsx)(y,{variant:`secondary`,disabled:a,onClick:ne,children:Y}),t[44]=a,t[45]=ne,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,A.jsx)(`p`,{className:`mt-2 text-xs text-fg-muted`,children:Z}),t[50]=Z,t[51]=le);let ue;t[52]!==X||t[53]!==le?(ue=(0,A.jsxs)(`div`,{className:`border-t border-edge pt-4`,children:[X,le]}),t[52]=X,t[53]=le,t[54]=ue):ue=t[54];let Q;return t[55]!==I||t[56]!==G||t[57]!==K||t[58]!==q||t[59]!==J||t[60]!==ue?(Q=(0,A.jsxs)(`section`,{className:`space-y-5`,"aria-label":I,children:[G,K,q,J,ue]}),t[55]=I,t[56]=G,t[57]=K,t[58]=q,t[59]=J,t[60]=ue,t[61]=Q):Q=t[61],Q}function N(e,t){return(0,A.jsx)(`li`,{children:e},t)}function P(){}async function F(e,t=`GET`,n){let r=await _(ae(e),{method:t,...n===void 0?{}:{body:JSON.stringify(n)}});if(!r.ok)throw Error(r.error??`Request failed`);return r.payload}function I({extension:e,zh:t,onChanged:n,onStart:r,onInstalled:i,initialConnect:o=!1}){let s=`/api/extensions/agent-plugins/${encodeURIComponent(e.pluginId)}`,[c,l]=(0,k.useState)(),[ne,d]=(0,k.useState)({}),[ie,f]=(0,k.useState)(!1),[p,m]=(0,k.useState)(``),[h,ae]=(0,k.useState)({}),[g,_]=(0,k.useState)(null),[v,b]=(0,k.useState)(``),[x,S]=(0,k.useState)(null),[C,w]=(0,k.useState)(!1),T=(0,k.useRef)(new Set),se=(0,k.useRef)(new Set),E=(0,k.useRef)(void 0),D=(0,k.useRef)(null),ce=(0,k.useRef)(new Set),O=(e,n)=>t?e:n,N=e.setup?.authorizations??[],P=new Set(N.flatMap(e=>e.servers)),I=[...N,...(c?.connections??[]).filter(t=>!P.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`||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?O(`访问令牌`,`Access token`):O(`浏览器登录`,`Browser sign-in`),type:n?`form`:`oauth`,...n?{fields:[`__apiKey`]}:{server:t.name}}]}})],L=e=>e.servers.every(e=>c?.connections.find(t=>t.name===e)?.state===`connected`)&&(!N.some(t=>t.id===e.id)||c?.authorizations?.find(t=>t.id===e.id)?.state===`connected`),R=(c?.authorizations??[]).flatMap(e=>(e.issues??[]).map(t=>({...t,account:I.find(t=>t.id===e.id)}))),z=I.filter(e=>!L(e)),B=c?.installed||c?.state===`completed`,V=e.setup?.userConfig??{},H=new Set(N.flatMap(e=>e.methods.flatMap(e=>e.fields??[]))),U=Object.fromEntries(Object.entries(V).filter(([e])=>!H.has(e))),W=c?.error===`Connection verification failed. Check the credentials or login status and try again.`?O(`连接验证未通过,请检查凭据或登录状态后重试。`,c.error):c?.error,G=Object.fromEntries(Object.entries(V).filter(([e])=>c?.missingConfig?.includes(e))),K=ie||c?.state===`running`,q=I.find(e=>e.id===x);(0,k.useEffect)(()=>{let e=!1;return F(`${s}/setup`).then(t=>{e||l(t)}).catch(t=>{e||(l(null),m(String(t)))}),()=>{e=!0}},[s]),(0,k.useEffect)(()=>{if(c?.state!==`running`)return;let e=!1,t=!1,r=setInterval(()=>{t||(t=!0,F(`${s}/setup`).then(t=>{e||(l(t),t?.state!==`running`&&n())}).catch(t=>{e||m(String(t))}).finally(()=>{t=!1}))},750);return()=>{e=!0,clearInterval(r)}},[s,c?.state]),(0,k.useEffect)(()=>{if(!c||!c.connections.some(e=>[`oauth_required`,`error`].includes(e.state)))return;let e=!1;return F(`${s}/setup/reusable`).then(t=>{e||ae(t)}).catch(()=>{e||ae({})}),()=>{e=!0}},[s,c?.revision]),(0,k.useEffect)(()=>{if(!v||c?.state===`completed`)return;let e=!1,t=!1,n=async()=>{if(!t){t=!0;try{let t=await F(`${s}/setup/auth/${encodeURIComponent(v)}`);e||_(t)}catch(t){e||m(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)}},[s,v,c?.state]),(0,k.useEffect)(()=>{let e=g?.authorizationUrl??(g?.challenge?.type===`url`?g.challenge.url:void 0);if(!g)return;if(g.error||[`cancelled`,`error`,`connected`].includes(g.state)){D.current?.close(),D.current=null;return}if(!e){g.challenge?.type===`qr`&&(D.current?.close(),D.current=null);return}let t=`${g.id}:${e}`;if(ce.current.has(t))return;ce.current.add(t);let n=D.current;D.current=null,n&&!n.closed?n.location.replace(e):window.open(e,`_blank`,`noopener,noreferrer`)},[g]);async function J(e,t={},r=c?.revision){f(!0),m(``);try{let a=await F(`${s}/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)&&(d({}),w(!1),a=await F(`${s}/setup`,`POST`,{action:`prepare`,expectedRevision:a.revision,idempotencyKey:crypto.randomUUID()})),l(a),await n(),[`complete`,`defer`].includes(e)&&(S(null),_(null),b(``),D.current?.close(),D.current=null,i?.()),a}catch(e){m(e instanceof Error?e.message:String(e));try{l(await F(`${s}/setup`))}catch{}return null}finally{f(!1)}}(0,k.useEffect)(()=>{if(!c||K||p||[`cancelled`,`running`,`failed`].includes(c.state)||c.state===`completed`)return;let e,t=``;if(c.state===`pending`?(e=`prepare`,t=`prepare:${s}:${c.revision}`):g?.state===`connected`&&(e=`prepare`,t=`auth:${s}:${g.id}`),e&&!T.current.has(t)){T.current.add(t),J(e);return}c.resources===`ready`&&!c.missingConfig?.length&&!c.partial&&c.connections.every(e=>e.state===`connected`)&&(c.authorizations??[]).every(e=>e.state===`connected`)&&(t=`complete:${s}:${c.revision}`,T.current.has(t)||(T.current.add(t),J(`complete`)))},[c,g,K,p,s]),(0,k.useEffect)(()=>{K||!c||c.state===`cancelled`||(q&&c.revision!==E.current&&L(q)?(S(null),_(null),b(``)):(!B||o)&&c.resources===`ready`&&(!c.missingConfig?.length||o&&!c.missingConfig.some(e=>e in U))&&!x&&z[0]&&!se.current.has(z[0].id)&&(se.current.add(z[0].id),E.current=c.revision,S(z[0].id)))},[c,K,B,x,o]);function Y(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),D.current=r,_(null),J(`authorize`,{server:e.id,...N.some(t=>t.id===e.id)?{method:t}:{}}).then(t=>{t?b(e.id):(r?.close(),D.current=null)})}async function X(t,n,r){if(n===`api-key`&&!N.some(e=>e.id===t.id)){f(!0),m(``);try{let n=e.components?.mcp.find(e=>e.name===t.id);await F(`${s}/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 F(`${s}/setup`);l(i),f(!1),await J(`prepare`,{},i.revision);return}catch(e){m(String(e)),f(!1);return}f(!1)}else if(t.methods.find(e=>e.id===n)?.type===`cli`){let e=window.open(`about:blank`,`_blank`);e&&(e.opener=null),D.current=e,_(null);let i=await J(`configure`,{authorization:t.id,method:n,values:r},c?.revision);i&&await J(`authorize`,{server:t.id,method:n},i.revision)?b(t.id):(e?.close(),D.current=null)}else await J(`configure`,{authorization:t.id,method:n,values:r})}if(c===void 0)return(0,A.jsx)(oe,{className:`h-40 w-full`});let Z=()=>{J(`defer`)};return q?(0,A.jsxs)(`div`,{className:`space-y-3`,children:[(0,A.jsx)(M,{initialMethod:c?.authorizations?.find(e=>e.id===q.id)?.method,account:q,fields:{...V,__apiKey:{type:`string`,title:O(`访问令牌`,`Access token`),required:!0,sensitive:!0}},zh:t,busy:K,attempt:g,onBack:()=>S(null),onConnect:e=>Y(q,e),onSave:(e,t)=>void X(q,e,t),onRedirect:e=>{f(!0),F(`${s}/setup/auth/${encodeURIComponent(v)}/redirect`,`POST`,{url:e}).catch(e=>m(String(e))).finally(()=>f(!1))},onSkip:Z},`${q.id}:${c?.authorizations?.find(e=>e.id===q.id)?.method??``}`),h[q.id]?.map(e=>(0,A.jsxs)(y,{disabled:K,variant:`secondary`,onClick:()=>void J(`reuse`,{server:q.id,sourceServerId:e.id}),children:[O(`使用已登录账号:`,`Use signed-in account: `),e.name]},e.id)),p||W&&q.servers.some(e=>c?.connections.find(t=>t.name===e)?.state===`error`)?(0,A.jsx)(`p`,{role:`alert`,className:`text-sm text-fg-muted`,children:p||W}):null]}):(0,A.jsxs)(`section`,{className:`space-y-5`,"aria-label":O(`插件安装与授权`,`Plugin setup`),children:[B?(0,A.jsxs)(`div`,{children:[(0,A.jsx)(`h3`,{className:`font-medium`,children:O(`安装完成`,`Installation complete`)}),(0,A.jsx)(`p`,{role:`status`,className:`mt-1 text-sm text-fg-muted`,children:e.activationEligible===!1?O(`插件已停用。`,`Plugin is disabled.`):c?.partial||z.length||R.length||c?.missingConfig?.length?O(`插件已安装,部分功能仍需要授权。`,`Plugin installed. Some features still need authorization.`):O(`所有 Agent 均可使用。可在 Agent 设置中单独调整。`,`Available to all agents. Customize individual agents in Agent settings.`)})]}):(0,A.jsxs)(`div`,{className:`rounded-xl border border-edge p-4`,children:[(0,A.jsx)(`h3`,{className:`font-medium`,children:O(`安装准备`,`Installation setup`)}),(0,A.jsx)(`ol`,{className:`mt-4 space-y-4 text-sm`,"aria-live":`polite`,children:[{name:O(`准备资源`,`Prepare resources`),done:c?.resources===`ready`,running:K&&c?.resources!==`ready`},{name:O(`授权账号`,`Authorize accounts`),done:c?.resources===`ready`&&!c?.missingConfig?.length&&z.length===0,running:!1},{name:O(`加载可用工具`,`Load available tools`),done:!1,running:K&&c?.resources===`ready`}].map(e=>(0,A.jsxs)(`li`,{className:`flex items-center gap-3`,children:[e.done?(0,A.jsx)(te,{className:`size-5 text-accent`,"aria-hidden":!0}):e.running?(0,A.jsx)(re,{className:`size-5 animate-spin text-accent`,"aria-hidden":!0}):(0,A.jsx)(u,{className:`size-5 text-fg-muted`,"aria-hidden":!0}),e.name]},e.name))}),(0,A.jsx)(`p`,{className:`mt-4 text-xs text-fg-muted`,children:O(`安装后所有 Agent 均可使用,可在各自的设置中调整。`,`Available to all agents after installation. Customize individual agents in Agent settings.`)})]}),!c||c.state===`cancelled`?(0,A.jsx)(y,{disabled:ie||e.readiness===`blocked`,onClick:()=>void J(`start`),children:O(`继续安装`,`Continue installation`)}):(0,A.jsxs)(A.Fragment,{children:[c.missingConfig?.length||C?(0,A.jsxs)(`form`,{className:`space-y-4 rounded-xl border border-edge p-4`,onSubmit:e=>{e.preventDefault(),J(`configure`,{values:ne})},children:[(0,A.jsx)(`h4`,{className:`font-medium`,children:O(`补充配置`,`Required configuration`)}),(0,A.jsx)(j,{fields:C?U:G,values:ne,onChange:d}),(0,A.jsx)(y,{type:`submit`,disabled:K||!Object.keys(ne).length,children:O(`继续`,`Continue`)})]}):null,B&&(z.length||c.missingConfig?.length)?(0,A.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,A.jsx)(ee,{className:`mt-0.5 size-5 shrink-0`,"aria-hidden":!0}),(0,A.jsxs)(`div`,{children:[(0,A.jsx)(`p`,{className:`font-medium`,children:O(`需要授权`,`Authorization required`)}),(0,A.jsx)(`p`,{className:`mt-1 text-fg-muted`,children:O(`授权后即可使用相关功能。已就绪的功能可继续使用。`,`Connect these accounts to use their features. Ready features remain available.`)})]})]}):null,R.length?(0,A.jsx)(`div`,{className:`space-y-3`,"aria-label":O(`需要补充权限`,`Additional permissions required`),children:R.map(e=>(0,A.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,A.jsx)(`p`,{className:`font-medium`,children:e.title}),(0,A.jsx)(`p`,{className:`text-fg-muted`,children:O(`账号已连接,以下权限尚未就绪;其他已授权功能可继续使用。`,`Account connected. These permissions are not ready; other authorized features remain available.`)}),e.scopes.length?(0,A.jsx)(`p`,{className:`break-all font-mono text-xs`,children:e.scopes.join(`, `)}):null,(0,A.jsx)(`ol`,{className:`list-inside list-decimal space-y-1 text-fg-muted`,children:e.instructions.map(e=>(0,A.jsx)(`li`,{children:e},e))}),(0,A.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[e.helpUrl?(0,A.jsx)(y,{variant:`secondary`,asChild:!0,children:(0,A.jsx)(`a`,{href:e.helpUrl,target:`_blank`,rel:`noopener noreferrer`,children:O(`前往开通应用权限`,`Open application permissions`)})}):null,e.method&&e.account?(0,A.jsx)(y,{disabled:K,onClick:()=>{E.current=c.revision,S(e.account.id),Y(e.account,e.method)},children:O(`补充授权`,`Grant missing permissions`)}):null,(0,A.jsx)(y,{variant:`secondary`,disabled:K,onClick:()=>void J(`prepare`),children:O(`重新检查权限`,`Check permissions again`)})]})]},`${e.account?.id}:${e.id}`))}):null,I.length?(0,A.jsxs)(`div`,{className:`space-y-2`,children:[(0,A.jsx)(`h4`,{className:`text-sm font-medium`,children:O(`账号与连接`,`Accounts and connections`)}),I.map(e=>(0,A.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,A.jsxs)(`div`,{className:`min-w-0`,children:[(0,A.jsx)(`p`,{className:`text-sm font-medium`,children:e.title}),(0,A.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:L(e)?O(`已连接`,`Connected`):O(`需要授权`,`Authorization required`)})]}),(0,A.jsx)(y,{variant:L(e)?`secondary`:`primary`,disabled:K||c.resources!==`ready`,onClick:()=>{_(null),b(``),E.current=c.revision,S(e.id)},children:L(e)?O(`重新授权`,`Reconnect`):O(`连接账号`,`Connect account`)})]},e.id))]}):null,!B&&c.resources===`ready`?(0,A.jsxs)(`div`,{children:[(0,A.jsx)(y,{variant:`secondary`,disabled:K,onClick:Z,children:O(`暂时跳过`,`Skip for now`)}),(0,A.jsx)(`p`,{className:`mt-2 text-xs text-fg-muted`,children:O(`先完成安装,稍后在详情页授权。未授权的功能暂不可用。`,`Finish installation and connect later in plugin details. Unauthenticated features remain unavailable.`)})]}):null,B&&Object.keys(U).length&&!C?(0,A.jsx)(y,{variant:`ghost`,disabled:K,onClick:()=>w(!0),children:O(`修改插件配置`,`Edit plugin configuration`)}):null,B&&!R.length&&N.some(e=>e.methods.some(e=>e.type===`cli`))?(0,A.jsx)(y,{variant:`secondary`,disabled:K,onClick:()=>void J(`prepare`),children:O(`检查连接与权限`,`Check connection and permissions`)}):null,!K&&(p||[`failed`,`interrupted`].includes(c.state)||c.connections.some(e=>e.state===`error`))?(0,A.jsx)(y,{variant:`secondary`,onClick:()=>void J(`prepare`),children:O(`重试检查`,`Retry checks`)}):null,B?null:(0,A.jsx)(y,{variant:`ghost`,disabled:ie,onClick:()=>void J(`cancel`),children:O(`取消安装`,`Cancel installation`)}),B&&!z.length&&!c.missingConfig?.length?e.setup?.tasks?.map(t=>(0,A.jsxs)(`div`,{className:`space-y-3 rounded-lg bg-surface-inset p-4 text-sm`,children:[(0,A.jsx)(`p`,{children:t}),(0,A.jsx)(y,{asChild:!0,disabled:!e.active,children:(0,A.jsx)(a,{to:`/chat/new?${new URLSearchParams({draft:t,projectScope:`none`})}`,state:{forceNewChat:!0},onClick:t=>{e.active?r?.():t.preventDefault()},children:O(`开始这个任务`,`Start this task`)})})]},t)):null]}),K?(0,A.jsx)(`p`,{role:`status`,className:`text-sm text-fg-muted`,children:O(`正在准备,可关闭后继续。`,`Preparing. You can close this window and resume.`)}):null,c?.error&&!c.deferred&&!c.missingConfig?.length?(0,A.jsx)(`p`,{className:`text-sm text-fg-muted`,children:W}):null,p?(0,A.jsx)(`p`,{role:`alert`,className:`text-sm text-fg-muted`,children:p}):null]})}var L=`w-full rounded-lg border border-edge bg-surface-inset px-3 py-2 text-sm text-fg`;function R(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 z(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 B(e,t,n){let r=await _(ae(e),{method:t,...n===void 0?{}:{body:JSON.stringify(n)}});if(!r.ok)throw Error(r.error??`Request failed`);return r.payload}function V({extension:e,onClose:t,onUninstalled:n,initialSource:r=``,marketplace:a,autoInstall:s=!1}){let ee=g(e=>e.language),u=ee.startsWith(`zh`),ae=a?.localizations?.[u?`zh-CN`:`en`],_=ae?.displayName??a?.name,oe=ae?.description??a?.description,E=(0,k.useId)(),{mutate:ce}=v(),[O,j]=(0,k.useState)(e),[M,N]=(0,k.useState)(r||e?.installationSource||``),[P,F]=(0,k.useState)(null),[V,H]=(0,k.useState)([]),[U,W]=(0,k.useState)(!1),[G,K]=(0,k.useState)(``),[q,J]=(0,k.useState)(!1),[Y,X]=(0,k.useState)(!1),[Z,le]=(0,k.useState)(!1),[ue,Q]=(0,k.useState)(!1),[de,fe]=(0,k.useState)(!1),[pe,me]=(0,k.useState)(!1),he=o(),ge=i(),[_e,ve]=(0,k.useState)(!1),ye=(0,k.useRef)(!1),be=`/api/extensions/agent-plugins/${encodeURIComponent(O?.pluginId??``)}`,xe=M.trim().startsWith(`store:`),Se=()=>ce(`gateway-extensions-list`);async function $(e){W(!0),K(``);try{await e()}catch(e){K(e instanceof Error?e.message:String(e))}finally{W(!1)}}function Ce(e){N(e),F(null),H([]),K(``)}let we=typeof window<`u`?window.electronAPI?.file:void 0,Te=/^(?:\/|[A-Za-z]:[\\/])/.test(M.trim())?M.trim():void 0;async function Ee(){if(!we?.openDirectory){fe(!0);return}let e=await we.openDirectory(Te?{defaultPath:Te}:void 0);e&&Ce(e)}async function De(){if(!we?.openFile){fe(!0);return}let e=await we.openFile({...Te?{defaultPath:Te}:{},extensions:[`zip`]});e&&Ce(e)}function Oe(e){return[...e.dataTransfer.types].some(e=>e===`Files`||e===`text/plain`||e===`text/uri-list`)}function ke(e){if(!Oe(e))return;e.preventDefault(),Q(!1);let t=Array.from(e.dataTransfer.files);if(t.length){if(t.length>1){K(u?`一次只能选择一个插件目录或 ZIP。`:`Choose one plugin directory or ZIP at a time.`);return}let e=we?.getPathForFile?.(t[0]);e?Ce(e):K(u?`浏览器无法读取本机文件路径,请使用“选择文件或目录”选择安装包。`:`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()&&Ce(n.trim().split(/\r?\n/)[0])}async function Ae(e){let t=await B(`${be}/activation`,`POST`,{enabled:e});j(t),await Se()}async function je(e){let t=!O,n=await B(t?`/api/extensions/install`:`${be}/update`,`POST`,{source:M,reviewHash:e.reviewHash,...e.layout?{setup:!0}:{}});j(n),await Se(),!e.layout&&t&&!n.activationEligible&&n.readiness!==`blocked`&&n.pluginId&&(n=await B(`/api/extensions/agent-plugins/${encodeURIComponent(n.pluginId)}/activation`,`POST`,{enabled:!0}),j(n),await Se()),F(null),ve(!e.layout&&t&&n.activationEligible===!0)}async function Me(){let e=await B(`/api/extensions/inspect`,`POST`,{source:M});if(z(e,a)){F(e);return}await je(e)}(0,k.useEffect)(()=>{e&&!e.setup&&j(e)},[e]),(0,k.useEffect)(()=>{if(!e?.setup||!e.pluginId)return;let t=!1;return B(`/api/extensions/agent-plugins/${encodeURIComponent(e.pluginId)}`,`GET`).then(e=>{t||j(e)}).catch(()=>{}),()=>{t=!0}},[e?.pluginId]),(0,k.useEffect)(()=>{!s||O||!xe||ye.current||(ye.current=!0,$(Me))},[s,O,xe]);let Ne=s&&!O&&xe&&!ye.current;return(0,A.jsx)(T,{defaultOpen:!0,onOpenChange:e=>!e&&t(),children:(0,A.jsxs)(S,{children:[(0,A.jsx)(b,{className:`fixed inset-0 z-[130] bg-scrim`}),(0,A.jsxs)(C,{className:`fixed left-1/2 top-1/2 z-[131] flex max-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,A.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between border-b border-edge p-4`,children:[(0,A.jsxs)(`div`,{className:`flex min-w-0 items-center gap-3`,children:[(0,A.jsx)(D,{iconUrl:O?.branding?.iconUrl??a?.branding?.iconUrl,fallback:ie}),(0,A.jsx)(w,{className:`font-semibold`,children:O?.name??_??(u?`安装插件`:`Install plugin`)})]}),(0,A.jsx)(y,{variant:`ghost`,onClick:t,children:u?`关闭`:`Close`})]}),(0,A.jsx)(x,{className:`sr-only`,children:u?`安装、组件、账号连接和权限`:`Installation, components, connections and permissions`}),(0,A.jsxs)(`div`,{className:`min-h-0 flex-auto space-y-4 overflow-y-auto overscroll-contain p-4`,children:[!O&&xe?(0,A.jsxs)(`section`,{className:`space-y-4`,children:[(0,A.jsxs)(`div`,{className:`flex items-start gap-3 rounded-xl border border-edge bg-surface-base p-4`,children:[(0,A.jsx)(f,{className:`mt-0.5 size-5 shrink-0 text-emerald-600 dark:text-emerald-400`,"aria-hidden":!0}),(0,A.jsxs)(`div`,{className:`min-w-0`,children:[(0,A.jsx)(`p`,{className:`font-medium text-fg`,children:_??P?.manifest.name??M.slice(6)}),oe?(0,A.jsx)(`p`,{className:`mt-1 text-sm leading-relaxed text-fg-muted`,children:oe}):null,(0,A.jsx)(`p`,{className:`mt-2 text-xs text-fg-muted`,children:a?.publisher?.verification===`verified`?u?`已认证发布者 · 安装后所有 Agent 均可使用`:`Verified publisher · available to all agents after installation`:u?`安装前会检查来源和所需权限`:`Source and required permissions are checked before installation`})]})]}),P?null:(0,A.jsxs)(y,{className:`w-full`,disabled:U||Ne,onClick:()=>void $(Me),children:[U||Ne?(0,A.jsx)(re,{className:`size-4 animate-spin`,"aria-hidden":!0}):null,U||Ne?u?`正在安全检查并安装…`:`Checking and installing…`:u?`一键安装`:`Install`]})]}):null,O?(0,A.jsxs)(A.Fragment,{children:[_e?(0,A.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,A.jsx)(te,{className:`mt-0.5 size-5 shrink-0 text-emerald-600 dark:text-emerald-400`,"aria-hidden":!0}),(0,A.jsxs)(`div`,{children:[(0,A.jsx)(`p`,{className:`font-medium text-fg`,children:u?`插件已安装并启用`:`Plugin installed and enabled`}),(0,A.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:u?`现在可以直接在对话中使用它。`:`It is ready to use in your conversations.`})]})]}):null,(!O.setup||O.readiness!==`setup_required`)&&!O.activationEligible?(0,A.jsxs)(`div`,{role:`status`,className:`space-y-3 rounded-lg border border-accent/25 bg-accent-soft p-4`,children:[(0,A.jsxs)(`div`,{children:[(0,A.jsx)(`p`,{className:`font-medium text-accent-fg`,children:u?`插件已安装,当前尚未启用`:`Plugin installed. It is not enabled yet.`}),(0,A.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:u?`启用后,Skills 和 MCP 才会加入 Agent 运行时。`:`Enable it to make its skills and MCP servers available to the Agent runtime.`})]}),(0,A.jsx)(y,{disabled:U||O.readiness===`blocked`,onClick:()=>void $(()=>Ae(!0)),children:u?`启用插件`:`Enable plugin`})]}):null,O.setup?(0,A.jsx)(I,{extension:O,zh:u,onStart:t,onInstalled:()=>{t(),he(se(O.pluginId,`installed`,!1,ge.pathname+ge.search))},onChanged:async()=>{let e=await B(`${be}`,`GET`);j(e),await Se()}}):null,(0,A.jsxs)(`details`,{className:`rounded-lg border border-edge p-3`,children:[(0,A.jsx)(`summary`,{className:`cursor-pointer text-sm font-medium`,children:u?`插件详情`:`Plugin details`}),(0,A.jsxs)(`div`,{className:`mt-3 space-y-3`,children:[(0,A.jsxs)(`p`,{className:`text-sm text-fg-muted`,children:[u?`插件`:`Plugin`,` · `,O.version,` · `,O.readiness&&{ready:u?`已就绪`:`Ready`,setup_required:u?`待连接`:`Setup required`,degraded:u?`部分不可用`:`Partially available`,blocked:u?`已阻止`:`Blocked`}[O.readiness]]}),O.provenance?(0,A.jsxs)(`p`,{className:`break-words text-xs text-fg-muted`,children:[O.provenance.publisherVerification===`verified`?u?`已认证发布者`:`Verified publisher`:u?`社区发布者`:`Community publisher`,` · `,O.provenance.packageName,`@`,O.provenance.version,` · SHA-256 `,O.provenance.sha256.slice(0,12),`…`,O.provenance.riskTier?` · ${O.provenance.riskTier}`:``]}):null,(0,A.jsx)(`p`,{className:`text-sm`,children:O.description}),O.installationSource?(0,A.jsxs)(`p`,{className:`break-all text-xs text-fg-muted`,children:[u?`来源:`:`Source: `,O.installationSource,O.resolvedCommit?` · ${O.resolvedCommit.slice(0,12)}`:``]}):null,O.activationEligible?(0,A.jsx)(y,{disabled:U,variant:`secondary`,onClick:()=>void $(()=>Ae(!1)),children:u?`停用`:`Disable`}):null,O.canRollback?(0,A.jsx)(y,{disabled:U,variant:`secondary`,onClick:()=>void $(async()=>{j(await B(`${be}/rollback`,`POST`)),await Se()}),children:u?`回滚上一版本`:`Roll back`}):null]})]}),O.diagnostics?.map((e,t)=>(0,A.jsxs)(`p`,{className:`text-sm text-fg-muted`,children:[e.component,`: `,e.message]},t))]}):null,O?(0,A.jsxs)(y,{variant:`ghost`,className:`px-0`,"aria-expanded":pe,onClick:()=>me(e=>!e),children:[(0,A.jsx)(c,{className:h(`size-4 transition-transform motion-reduce:transition-none`,pe&&`rotate-180`),"aria-hidden":!0}),u?`高级操作`:`Advanced actions`]}):null,!O&&!xe||pe?(0,A.jsxs)(`form`,{className:h(`space-y-3`,O&&`border-t border-edge pt-4`),onSubmit:e=>{e.preventDefault(),$(async()=>{let e=await B(`/api/extensions/inspect`,`POST`,{source:M});e.candidates?(H(e.candidates),F(null)):(H([]),F(e))})},children:[(0,A.jsxs)(`div`,{"data-testid":`plugin-source-dropzone`,className:h(`rounded-xl border border-dashed p-3 transition-colors`,ue?`border-accent bg-accent-soft`:`border-edge bg-surface-inset/40`),onDragEnter:e=>{Oe(e)&&(e.preventDefault(),Q(!0))},onDragOver:e=>{Oe(e)&&(e.preventDefault(),e.dataTransfer.dropEffect=`copy`,Q(!0))},onDragLeave:e=>{e.currentTarget.contains(e.relatedTarget)||Q(!1)},onDrop:ke,children:[(0,A.jsxs)(`div`,{className:`mb-2 flex items-start gap-2`,children:[(0,A.jsx)(p,{className:`mt-0.5 size-4 shrink-0 text-fg-muted`,"aria-hidden":!0}),(0,A.jsxs)(`div`,{children:[(0,A.jsx)(`label`,{htmlFor:E,className:`block text-sm font-medium`,children:O?u?`更新包来源`:`Update package source`:u?`安装包来源`:`Package source`}),(0,A.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-muted`,children:u?`输入 github:组织/仓库、Git / ZIP 地址或宿主目录;marketplace 可选择插件。`:`Enter github:owner/repo, a Git / ZIP URL or a Gateway directory. Marketplaces let you choose a plugin.`})]})]}),(0,A.jsx)(`input`,{id:E,className:L,value:M,onChange:e=>Ce(e.target.value),placeholder:u?`/插件目录/或/插件.zip`:`/plugin/folder/or/plugin.zip`,autoComplete:`off`,spellCheck:!1,required:!0}),(0,A.jsx)(`div`,{className:`mt-2 flex flex-wrap gap-2`,children:we?(0,A.jsxs)(A.Fragment,{children:[(0,A.jsxs)(y,{type:`button`,variant:`secondary`,disabled:U,onClick:()=>void $(Ee),children:[(0,A.jsx)(d,{className:`size-4`,"aria-hidden":!0}),u?`选择目录`:`Choose directory`]}),(0,A.jsxs)(y,{type:`button`,variant:`secondary`,disabled:U,onClick:()=>void $(De),children:[(0,A.jsx)(ne,{className:`size-4`,"aria-hidden":!0}),u?`选择 ZIP`:`Choose ZIP`]})]}):(0,A.jsxs)(y,{type:`button`,variant:`secondary`,disabled:U,onClick:()=>fe(!0),children:[(0,A.jsx)(d,{className:`size-4`,"aria-hidden":!0}),u?`选择文件或目录`:`Choose file or folder`]})})]}),(0,A.jsx)(y,{type:`submit`,variant:`secondary`,disabled:U||!M,children:u?`检查安装包`:`Inspect package`})]}):null,V.length?(0,A.jsx)(`div`,{className:`space-y-2`,"aria-label":u?`选择插件`:`Choose a plugin`,children:V.map(e=>(0,A.jsx)(y,{variant:`secondary`,className:`w-full justify-start`,onClick:()=>{Ce(e.source),$(async()=>F(await B(`/api/extensions/inspect`,`POST`,{source:e.source})))},children:e.name},e.source))}):null,P?(0,A.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,A.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,A.jsx)(f,{className:`mt-0.5 size-5 shrink-0 text-amber-700 dark:text-amber-300`,"aria-hidden":!0}),(0,A.jsxs)(`div`,{children:[(0,A.jsx)(`p`,{id:`plugin-authorization-title`,className:`font-medium text-fg`,children:u?`需要你的授权`:`Your authorization is required`}),(0,A.jsx)(`p`,{className:`mt-1 text-fg-muted`,children:u?`此插件需要以下新增能力。确认后自动准备资源,按需登录账号,所有 Agent 均可使用。`:`Review these capabilities. Resources are prepared automatically; sign in if needed. Available to all agents.`})]})]}),(0,A.jsx)(`ul`,{tabIndex:0,"aria-label":u?`插件新增能力`:`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:P.addedCapabilities.map(e=>(0,A.jsxs)(`li`,{className:`flex gap-2`,children:[(0,A.jsx)(`span`,{"aria-hidden":!0,children:`•`}),(0,A.jsx)(`span`,{children:R(e,u)})]},e))}),P.diagnostics.map((e,t)=>(0,A.jsxs)(`p`,{children:[e.component,`: `,e.message]},t))]}):null,O&&pe?(0,A.jsx)(`div`,{className:`border-t border-edge pt-4`,children:Z?(0,A.jsxs)(`div`,{className:`space-y-3 text-sm`,children:[(0,A.jsx)(`p`,{children:u?`卸载保留账号凭据;服务端授权需到相应服务撤销。`:`Credentials are retained. Revoke provider authorization in the service itself.`}),(0,A.jsxs)(`label`,{className:`flex gap-2`,children:[(0,A.jsx)(`input`,{type:`checkbox`,checked:q,onChange:e=>J(e.target.checked)}),u?`同时删除插件数据`:`Also delete plugin data`]}),(0,A.jsxs)(`label`,{className:`flex gap-2`,children:[(0,A.jsx)(`input`,{type:`checkbox`,checked:Y,onChange:e=>X(e.target.checked)}),u?`同时删除本地凭据`:`Also delete local credentials`]}),(0,A.jsx)(y,{disabled:U,onClick:()=>void $(async()=>{await B(be,`DELETE`,{removeData:q,removeCredentials:Y}),await Se(),(n??t)()}),children:u?`确认卸载`:`Confirm uninstall`})]}):(0,A.jsx)(y,{variant:`ghost`,disabled:U,onClick:()=>le(!0),children:u?`卸载插件`:`Uninstall`})}):null,G?(0,A.jsx)(`p`,{role:`alert`,className:`break-words text-sm text-fg-muted`,children:G}):null]}),P?(0,A.jsxs)(`div`,{className:`flex shrink-0 flex-wrap justify-end gap-2 border-t border-edge p-4`,children:[(0,A.jsx)(y,{variant:`ghost`,disabled:U,onClick:()=>F(null),children:u?`取消`:`Cancel`}),(0,A.jsxs)(y,{disabled:U||!!O&&P.manifest.name!==O.name,onClick:()=>void $(()=>je(P)),children:[U?(0,A.jsx)(re,{className:`size-4 animate-spin`,"aria-hidden":!0}):null,u?`授权并安装`:`Authorize and install`]})]}):null]}),we?null:(0,A.jsx)(l,{open:de,onOpenChange:fe,initialAbsolutePath:Te,onConfirm:async e=>Ce(e),wd:m(ee).chat.workingDirectory,selectKind:`file-or-directory`,fileExtensions:[`zip`],title:u?`选择插件安装包`:`Choose plugin package`,description:u?`选择插件目录或 ZIP 文件。`:`Choose a plugin directory or ZIP file.`,confirmLabel:u?`使用此来源`:`Use this source`,nested:!0})]})})}export{I as n,V as t};
@@ -1 +0,0 @@
1
- import{i as e,r as t}from"./product-delivery-BU_H84jL.js";var n=new Set([`agents`,`capabilities`,`personal`,`user-model`,`automations`,`browser-automations`,`channels`,`chat`,`connectors`,`extensions`,`local-apps`,`notes`,`onboarding`,`open`,`projects`,`settings`,`skills`,`tasks`,`you`]);function r(e){if(!e.startsWith(`/`)||e.startsWith(`//`)||e.includes(`\\`))return null;let t=e.slice(1).split(/[/?#]/,1)[0]??``;return t&&n.has(t)?e:null}function i(e){try{let t=new URL(e);return t.protocol!==`xopc:`||t.hostname!==`settings`?null:r(`/settings${t.pathname===`/`?``:t.pathname}${t.search}${t.hash}`)}catch{return null}}function a(n,a=window.location.href){let o=n.trim();if(!o)return{kind:`blocked`};let s=t(o);if(s){let t=e({...s,title:s.id,capabilities:[`open`]});return t?{kind:`internal-route`,route:t}:{kind:`blocked`}}let c=i(o);if(c)return{kind:`internal-route`,route:c};if(o.startsWith(`#/`)){let e=r(o.slice(1));return e?{kind:`internal-route`,route:e}:{kind:`blocked`}}if(o.startsWith(`/`)){let e=r(o);return e?{kind:`internal-route`,route:e}:{kind:`blocked`}}try{let e=new URL(o,a);if(e.protocol!==`http:`&&e.protocol!==`https:`||e.username||e.password)return{kind:`blocked`};let t=new URL(a);if(e.origin===t.origin&&e.hash.startsWith(`#/`)){let t=r(e.hash.slice(1));if(t)return{kind:`internal-route`,route:t}}return{kind:`external-http`,url:e.toString()}}catch{return{kind:`blocked`}}}function o(e,t,n){for(let r of e.querySelectorAll(`a`)){if(n?.(r))continue;let e=a(r.getAttribute(`href`)??``);if(r.dataset.xopcLinkKind=e.kind,e.kind===`blocked`){r.replaceWith(...Array.from(r.childNodes));continue}if(e.kind===`internal-route`){if(r.setAttribute(`href`,`#${e.route}`),r.removeAttribute(`target`),t){let n=e.route.slice(1).split(/[/?#]/,1)[0]??``,i=t.destinations[n]??t.open,a=r.dataset.xopcLinkLabel??r.textContent?.trim()??``;r.dataset.xopcLinkLabel=a,(/^(?:xopc:\/\/|#\/)/i.test(a)||/^(?:Open(?: in xopc)?|打开)$/i.test(a))&&(r.textContent=i),r.title||=i}continue}r.target=`_blank`;let i=new Set(r.rel.split(/\s+/).filter(Boolean));i.add(`noopener`),i.add(`noreferrer`),r.rel=[...i].join(` `)}}async function s(e){let t=a(e);if(t.kind!==`external-http`)return{ok:!1,error:`Only external HTTP(S) links can be opened`};let n=window.electronAPI?.shell?.openExternalUrl;return n?n(t.url):(window.open(t.url,`_blank`,`noopener,noreferrer`),{ok:!0})}export{s as n,a as r,o as t};
@@ -1 +0,0 @@
1
- import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{t as i}from"./copy-Dv6d4Dvw.js";import{t as a}from"./loader-circle-CifKLtgG.js";import{t as o}from"./package-wATCyihJ.js";import{t as s}from"./messages-DRR9N3HC.js";import{t as c}from"./cn-0WouolD0.js";import{i as l,n as u,o as d}from"./locale-store-lIXD1FMw.js";import{i as f}from"./vendor-swr-CdRzEUwF.js";import{t as p}from"./button-CnRSIP6m.js";import{t as m}from"./skeleton-BI5TyibZ.js";import{a as h,i as g,o as _,r as v,s as y,t as b}from"./dist-DfWfZ9iu.js";import{i as x,o as S}from"./settings-shell-dialog-layer-BU3UuiJr.js";import{t as C}from"./copy-to-clipboard-HOJ79TWv.js";import{n as w}from"./interaction-BdhHBbYa.js";import{n as T}from"./electron-env-DHOGevH3.js";import{r as E}from"./settings-form-draft-Dy10ldo8.js";import{t as D}from"./settings-loading-skeleton-BTqvr_Fw.js";import{n as O,t as k}from"./settings-page-header-Bv-kQFTm.js";import"./settings-page-layout-DHP6MrrL.js";import{r as A,t as j}from"./settings-form-section-num14vSv.js";var M=n(),N=e(t(),1),P=r();function F(e,t){return e==null?t:e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}function I(e,t){return e===`PENDING_UPDATE`?t.pendingUpdate??t.generic:e===`UNINSTALLER_NOT_FOUND`?t.uninstallerNotFound??t.generic:e===`NOT_PACKAGED`?t.notPackaged??t.generic:t.generic}function L(e,t){if(e.platform===`darwin`)return t.uninstallDescDarwin;if(e.platform===`win32`)return t.uninstallDescWin;if(e.platform===`linux`){if(e.linuxPackageKind===`appimage`)return t.uninstallDescLinuxAppImage;if(e.linuxPackageKind===`deb`){let n=e.linuxDebPackageName??`xopc`;return t.uninstallDescLinuxDeb.replace(/\{\{package\}\}/g,n)}return t.uninstallDescLinuxUnknown}return t.uninstallDescLinuxUnknown}var R={info:null,loadError:null,actionError:null,copiedField:null,clearDialogOpen:!1,clearConfirmChecked:!1,clearConfirmText:``,uninstallDialogOpen:!1,removeUserDataOnUninstall:!1,busy:!1};function z({api:e,messages:t,embedded:n=!0}){let[r,s]=(0,N.useReducer)(E,R),{info:l,loadError:u,actionError:d,copiedField:f,clearDialogOpen:m,clearConfirmChecked:T,clearConfirmText:O,uninstallDialogOpen:k,removeUserDataOnUninstall:A,busy:M}=r,z=(0,N.useCallback)(async()=>{if(e?.getUninstallInfo){s({type:`patch`,patch:{loadError:null}});try{let t=await e.getUninstallInfo();s({type:`patch`,patch:{info:t}})}catch(e){s({type:`patch`,patch:{loadError:e instanceof Error?e.message:String(e)}})}}},[e]);(0,N.useEffect)(()=>{z()},[z]);let B=async(e,n)=>{if(await C(e)){s({type:`patch`,patch:{actionError:null,copiedField:n}}),window.setTimeout(()=>s({type:`patch`,patch:{copiedField:null}}),2e3);return}s({type:`patch`,patch:{actionError:t.copyFailed}})},V=async()=>{if(!(!e?.clearUserData||M)){s({type:`patch`,patch:{busy:!0,actionError:null}});try{let n=await e.clearUserData();n.ok||s({type:`patch`,patch:{actionError:I(n.error,t.errors)}})}catch(e){s({type:`patch`,patch:{actionError:e instanceof Error?e.message:t.errors.generic}})}finally{s({type:`patch`,patch:{busy:!1,clearDialogOpen:!1,clearConfirmChecked:!1,clearConfirmText:``}})}}},H=async()=>{if(e?.uninstallApp){s({type:`patch`,patch:{busy:!0,actionError:null}});try{let n=await e.uninstallApp({removeUserData:A});n.ok||s({type:`patch`,patch:{actionError:I(n.error,t.errors)}})}catch(e){s({type:`patch`,patch:{actionError:e instanceof Error?e.message:t.errors.generic}})}finally{s({type:`patch`,patch:{busy:!1,uninstallDialogOpen:!1}})}}};if(u)return(0,P.jsx)(`p`,{className:`text-sm text-amber-600 dark:text-amber-400`,role:`alert`,children:u});if(!l)return(0,P.jsx)(D,{rows:2});let U=!l.packaged,W=M||l.pendingUpdate||U,G=!U&&l.uninstallMode!==`unsupported`,K=L(l,t),q=T&&O.trim()===t.clearDataConfirmPhrase;return(0,P.jsxs)(P.Fragment,{children:[(0,P.jsxs)(j,{children:[n?(0,P.jsxs)(`div`,{className:`mb-4 flex items-center gap-2 text-sm font-semibold text-fg`,children:[(0,P.jsx)(o,{className:`size-4 text-accent`,strokeWidth:1.75}),t.title]}):null,d?(0,P.jsx)(`p`,{className:`mb-3 text-sm text-amber-600 dark:text-amber-400`,role:`alert`,children:d}):null,U?(0,P.jsxs)(`div`,{className:`mb-4 rounded-xl bg-surface-panel/70 px-3 py-2.5 shadow-surface`,children:[(0,P.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:t.devOnlyTitle}),(0,P.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:t.devOnlyBody})]}):null,l.pendingUpdate?(0,P.jsx)(`p`,{className:`mb-3 rounded-xl bg-amber-500/10 px-3 py-2 text-xs text-amber-800 dark:text-amber-200`,children:t.pendingUpdateBlocked}):null,(0,P.jsxs)(`dl`,{className:`space-y-3 text-sm`,children:[(0,P.jsxs)(`div`,{className:`rounded-xl bg-surface-panel/70 p-3 shadow-surface`,children:[(0,P.jsx)(`dt`,{className:`text-xs font-medium text-fg-muted`,children:t.appPath}),(0,P.jsxs)(`dd`,{className:`mt-1 flex items-start justify-between gap-2`,children:[(0,P.jsx)(`code`,{className:`break-all text-xs text-fg`,children:l.appPath}),(0,P.jsxs)(`button`,{type:`button`,className:c(`inline-flex shrink-0 items-center gap-1 rounded-lg border border-edge px-2 py-1 text-xs text-fg hover:bg-surface-hover`,w.press),onClick:()=>void B(l.appPath,`app`),children:[(0,P.jsx)(i,{className:`size-3`,"aria-hidden":!0}),f===`app`?t.copied:t.copyPath]})]})]}),(0,P.jsxs)(`div`,{className:`rounded-xl bg-surface-panel/70 p-3 shadow-surface`,children:[(0,P.jsx)(`dt`,{className:`text-xs font-medium text-fg-muted`,children:t.dataPath}),(0,P.jsxs)(`dd`,{className:`mt-1 flex items-start justify-between gap-2`,children:[(0,P.jsx)(`code`,{className:`break-all text-xs text-fg`,children:l.dataPath}),(0,P.jsxs)(`button`,{type:`button`,className:c(`inline-flex shrink-0 items-center gap-1 rounded-lg border border-edge px-2 py-1 text-xs text-fg hover:bg-surface-hover`,w.press),onClick:()=>void B(l.dataPath,`data`),children:[(0,P.jsx)(i,{className:`size-3`,"aria-hidden":!0}),f===`data`?t.copied:t.copyPath]})]}),(0,P.jsxs)(`p`,{className:`mt-2 text-xs text-fg-muted`,children:[t.dataSize,`: `,F(l.dataSizeBytes,t.dataSizeUnknown)]}),(0,P.jsx)(`p`,{className:`mt-2 text-xs leading-relaxed text-amber-800 dark:text-amber-200`,children:t.sharedDataWarning})]})]}),(0,P.jsxs)(`div`,{className:`mt-4 space-y-3`,children:[(0,P.jsxs)(`div`,{className:`flex flex-col gap-2 rounded-xl bg-surface-panel/70 p-3 shadow-surface sm:flex-row sm:items-center sm:justify-between`,children:[(0,P.jsxs)(`div`,{children:[(0,P.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:t.clearData}),(0,P.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-muted`,children:t.clearDataDesc})]}),(0,P.jsx)(`button`,{type:`button`,disabled:W,className:c(`inline-flex shrink-0 items-center justify-center rounded-lg border border-danger/40 bg-danger px-3 py-1.5 text-sm font-medium text-white hover:bg-danger/90 disabled:opacity-50`,w.press),onClick:()=>{s({type:`patch`,patch:{clearConfirmChecked:!1,clearConfirmText:``,clearDialogOpen:!0}})},children:t.clearData})]}),G?(0,P.jsxs)(`div`,{className:`flex flex-col gap-2 rounded-xl bg-surface-panel/70 p-3 shadow-surface sm:flex-row sm:items-center sm:justify-between`,children:[(0,P.jsxs)(`div`,{children:[(0,P.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:t.uninstall}),(0,P.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-muted`,children:K})]}),(0,P.jsx)(`button`,{type:`button`,disabled:W,className:c(`inline-flex shrink-0 items-center justify-center rounded-lg border border-edge bg-surface-base px-3 py-1.5 text-sm font-medium text-fg hover:bg-surface-hover disabled:opacity-50`,w.press),onClick:()=>{s({type:`patch`,patch:{removeUserDataOnUninstall:!1,uninstallDialogOpen:!0}})},children:t.uninstall})]}):null]})]}),(0,P.jsx)(b,{open:m,onOpenChange:e=>{!e&&!M&&s({type:`patch`,patch:{clearDialogOpen:!1,clearConfirmChecked:!1,clearConfirmText:``}})},children:(0,P.jsxs)(_,{children:[(0,P.jsx)(h,{className:c(`xopc-dialog-overlay fixed inset-0 bg-scrim backdrop-blur-[1px]`,S)}),(0,P.jsxs)(v,{className:c(`xopc-dialog-content fixed left-1/2 top-1/2 flex h-[min(30rem,calc(100dvh-2rem))] w-[min(100%-2rem,28rem)] flex-col overflow-hidden -translate-x-1/2 -translate-y-1/2`,x,`rounded-2xl border border-edge bg-surface-overlay p-6 shadow-popover outline-none dark:border-edge`),onOpenAutoFocus:e=>e.preventDefault(),onEscapeKeyDown:e=>{M&&e.preventDefault()},onInteractOutside:e=>{M&&e.preventDefault()},"aria-busy":M,children:[(0,P.jsx)(y,{className:`text-base font-semibold text-fg`,children:t.clearDataConfirmTitle}),(0,P.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto overscroll-contain`,children:[(0,P.jsx)(g,{className:`mt-2 text-sm text-fg-muted`,children:t.clearDataConfirmDesc}),(0,P.jsxs)(`label`,{className:`mt-4 flex cursor-pointer items-start gap-2 text-sm text-fg`,children:[(0,P.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox mt-0.5`,disabled:M,checked:T,onChange:e=>s({type:`patch`,patch:{clearConfirmChecked:e.target.checked}})}),(0,P.jsx)(`span`,{children:t.clearDataConfirmCheckbox})]}),(0,P.jsxs)(`div`,{className:`mt-4 space-y-2`,children:[(0,P.jsx)(`label`,{className:`block text-sm font-medium text-fg`,htmlFor:`clear-data-confirm`,children:t.clearDataConfirmLabel}),(0,P.jsx)(`input`,{id:`clear-data-confirm`,disabled:M,type:`text`,autoComplete:`off`,spellCheck:!1,className:c(`w-full rounded-md border border-edge bg-surface-panel px-3 py-1.5 font-mono text-xs text-fg`,`placeholder:text-fg-subtle`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 focus-visible:ring-offset-surface-panel`,`dark:border-edge`),placeholder:t.clearDataConfirmPhrase,value:O,onChange:e=>s({type:`patch`,patch:{clearConfirmText:e.target.value}})}),M?(0,P.jsxs)(`div`,{className:`space-y-2`,role:`status`,"aria-live":`polite`,children:[(0,P.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:t.clearDataProgress}),(0,P.jsx)(`div`,{role:`progressbar`,"aria-label":t.clearDataProgress,className:`h-1.5 overflow-hidden rounded-full bg-surface-active`,children:(0,P.jsx)(`div`,{className:`xopc-clear-data-progress h-full w-1/3 rounded-full bg-accent`})}),(0,P.jsx)(`p`,{className:`text-xs text-fg-muted`,children:t.clearDataProgressHint})]}):(0,P.jsx)(`p`,{className:`text-xs text-fg-muted`,children:t.clearDataConfirmHint})]})]}),(0,P.jsxs)(`div`,{className:`mt-6 flex shrink-0 justify-end gap-2`,children:[(0,P.jsx)(p,{type:`button`,variant:`secondary`,disabled:M,onClick:()=>{s({type:`patch`,patch:{clearDialogOpen:!1,clearConfirmChecked:!1,clearConfirmText:``}})},children:t.cancel}),(0,P.jsxs)(p,{type:`button`,variant:`secondary`,className:`border-danger/40 bg-danger text-white hover:bg-danger/90 dark:border-danger/40`,disabled:M||!q,onClick:()=>void V(),children:[M?(0,P.jsx)(a,{className:`size-4 animate-spin motion-reduce:animate-none`,"aria-hidden":!0}):null,M?t.clearDataProgress:t.confirmClear]})]})]})]})}),G?(0,P.jsx)(b,{open:k,onOpenChange:e=>{e||s({type:`patch`,patch:{uninstallDialogOpen:!1}})},children:(0,P.jsxs)(_,{children:[(0,P.jsx)(h,{className:c(`xopc-dialog-overlay fixed inset-0 bg-scrim backdrop-blur-[1px]`,S)}),(0,P.jsxs)(v,{className:c(`xopc-dialog-content fixed left-1/2 top-1/2 w-[min(100%-2rem,28rem)] -translate-x-1/2 -translate-y-1/2`,x,`rounded-2xl border border-edge bg-surface-overlay p-6 shadow-popover outline-none dark:border-edge`),onOpenAutoFocus:e=>e.preventDefault(),children:[(0,P.jsx)(y,{className:`text-base font-semibold text-fg`,children:t.uninstallConfirmTitle}),(0,P.jsx)(g,{className:`mt-2 text-sm text-fg-muted`,children:K}),(0,P.jsxs)(`label`,{className:`mt-4 flex cursor-pointer items-start gap-2 text-sm text-fg`,children:[(0,P.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox mt-0.5`,checked:A,onChange:e=>s({type:`patch`,patch:{removeUserDataOnUninstall:e.target.checked}})}),(0,P.jsx)(`span`,{children:t.removeUserDataCheckbox})]}),A?(0,P.jsx)(`p`,{className:`mt-2 text-xs text-fg-muted`,children:t.clearDataConfirmDesc}):null,(0,P.jsxs)(`div`,{className:`mt-6 flex justify-end gap-2`,children:[(0,P.jsx)(p,{type:`button`,variant:`secondary`,disabled:M,onClick:()=>s({type:`patch`,patch:{uninstallDialogOpen:!1}}),children:t.cancel}),(0,P.jsx)(p,{type:`button`,variant:`secondary`,className:`border-danger/40 bg-danger text-white hover:bg-danger/90 dark:border-danger/40`,disabled:M,onClick:()=>void H(),children:t.confirmUninstall})]})]})]})}):null]})}async function B(){return(await d(l(`/api/migrations/status`))).payload}async function V(){await d(l(`/api/migrations/apply`),{method:`POST`,body:`{}`})}function H({messages:e}){let{data:t,error:n,isLoading:r,mutate:i}=f(`settings-migration-status`,B,{refreshInterval:0,revalidateOnFocus:!1}),[a,o]=(0,N.useState)(!1),[s,c]=(0,N.useState)(null);async function l(){o(!0),c(null);try{await V(),await i(),window.dispatchEvent(new CustomEvent(`config-reload`))}catch(e){c(e instanceof Error?e.message:String(e))}finally{o(!1)}}if(r)return(0,P.jsxs)(`section`,{className:`rounded-xl bg-surface-hover/20 p-4`,"aria-busy":`true`,children:[(0,P.jsx)(m,{className:`h-5 w-40 max-w-full`}),(0,P.jsx)(m,{className:`mt-2 h-4 w-64 max-w-full`})]});if(n)return(0,P.jsxs)(`section`,{className:`rounded-xl bg-surface-hover/20 p-4`,children:[(0,P.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:e.title}),(0,P.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:e.checkFailed})]});let u=t?.items??[],d=u.filter(e=>e.status===`conflict`||e.status===`error`),h=u.filter(e=>e.safety===`auto`&&e.status===`planned`),g=d.length>0||u.some(e=>e.safety!==`auto`);return(0,P.jsxs)(`section`,{className:`rounded-xl bg-surface-hover/20 p-4`,children:[(0,P.jsxs)(`div`,{className:`flex flex-col gap-3 sm:flex-row sm:items-start sm:justify-between`,children:[(0,P.jsxs)(`div`,{children:[(0,P.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:e.title}),(0,P.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:u.length===0?e.upToDate:g?e.manualAttention:e.safeRepairs.replace(`{{count}}`,String(h.length))})]}),h.length>0&&!g?(0,P.jsx)(p,{type:`button`,variant:`primary`,className:`px-3 py-1.5 text-xs`,onClick:()=>void l(),disabled:a,children:a?e.applying:e.apply}):null]}),u.length>0?(0,P.jsx)(`div`,{className:`mt-3 space-y-2`,children:u.map(e=>(0,P.jsxs)(`div`,{className:`rounded-xl bg-surface-base/55 px-3 py-2`,children:[(0,P.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,P.jsx)(`div`,{className:`truncate text-sm font-medium text-fg`,children:e.title}),(0,P.jsx)(`span`,{className:`rounded-full bg-surface-hover px-2 py-0.5 text-[11px] uppercase tracking-wide text-fg-muted`,children:e.status})]}),(0,P.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:e.message})]},e.id))}):null,s?(0,P.jsx)(`p`,{className:`mt-3 text-sm text-red-500`,children:s}):null]})}function U(){let e=(0,M.c)(28),t=u(W),n;e[0]===t?n=e[1]:(n=s(t),e[0]=t,e[1]=n);let r=n.systemSettings,i=r.desktopApp,a=typeof window<`u`?window.electronAPI?.system:void 0;if(!T()||!a){let t;e[2]===i.title?t=e[3]:(t=(0,P.jsx)(k,{title:i.title}),e[2]=i.title,e[3]=t);let n;e[4]===i.migrations?n=e[5]:(n=(0,P.jsx)(H,{messages:i.migrations}),e[4]=i.migrations,e[5]=n);let a;e[6]===Symbol.for(`react.memo_cache_sentinel`)?(a=A(),e[6]=a):a=e[6];let o;e[7]===r.desktopOnlyTitle?o=e[8]:(o=(0,P.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:r.desktopOnlyTitle}),e[7]=r.desktopOnlyTitle,e[8]=o);let s;e[9]===r.desktopOnlyBody?s=e[10]:(s=(0,P.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:r.desktopOnlyBody}),e[9]=r.desktopOnlyBody,e[10]=s);let c;e[11]!==o||e[12]!==s?(c=(0,P.jsxs)(`div`,{className:a,children:[o,s]}),e[11]=o,e[12]=s,e[13]=c):c=e[13];let l;return e[14]!==t||e[15]!==n||e[16]!==c?(l=(0,P.jsxs)(O,{gap:`gap-3`,children:[t,n,c]}),e[14]=t,e[15]=n,e[16]=c,e[17]=l):l=e[17],l}let o;e[18]===i.title?o=e[19]:(o=(0,P.jsx)(k,{title:i.title}),e[18]=i.title,e[19]=o);let c;e[20]===i.migrations?c=e[21]:(c=(0,P.jsx)(H,{messages:i.migrations}),e[20]=i.migrations,e[21]=c);let l;e[22]===i?l=e[23]:(l=(0,P.jsx)(z,{api:a,messages:i,embedded:!1}),e[22]=i,e[23]=l);let d;return e[24]!==o||e[25]!==c||e[26]!==l?(d=(0,P.jsxs)(O,{gap:`gap-6`,children:[o,c,l]}),e[24]=o,e[25]=c,e[26]=l,e[27]=d):d=e[27],d}function W(e){return e.language}export{U as AppManagementSettingsPanel};
@@ -1 +0,0 @@
1
- import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{n as i,r as a}from"./popover-select-DniHw2dy.js";import{t as o}from"./messages-DRR9N3HC.js";import{t as s}from"./cn-0WouolD0.js";import{i as c,n as l,o as u}from"./locale-store-lIXD1FMw.js";import{t as d}from"./skeleton-BI5TyibZ.js";import{n as f}from"./interaction-BdhHBbYa.js";import{n as p,r as m}from"./gateway-config-swr-BAmUhiP1.js";import{t as h}from"./preference-select-fields-D7oluyHN.js";import{i as g}from"./theme-store-DW45fWYQ.js";import{t as _}from"./dev-view-store-57HgVuZ6.js";import{n as v,t as y}from"./settings-page-header-Bv-kQFTm.js";import"./settings-page-layout-DHP6MrrL.js";import{t as b}from"./settings-advanced-gate-B5lQeVNi.js";var x=e(t(),1),S=n();function C(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function w(e){let t=C(e)?e:{},n=C(t.gateway)?t.gateway:{},r=(C(n.webchat)?n.webchat:{}).activityDetailDefault;return r===`off`||r===`stream`||r===`on`?r:`on`}async function T(e){await u(c(`/api/config`),{method:`PATCH`,body:JSON.stringify({gateway:{webchat:{activityDetailDefault:e}}})}),await p()}var E=r();function D(e){let t=(0,S.c)(13),{title:n,footer:r,children:i,className:a}=e,o;t[0]===a?o=t[1]:(o=s(`min-w-0`,a),t[0]=a,t[1]=o);let c;t[2]===n?c=t[3]:(c=n?(0,E.jsx)(`h2`,{className:`mb-2 px-1 text-xs font-medium text-fg-muted`,children:n}):null,t[2]=n,t[3]=c);let l;t[4]===i?l=t[5]:(l=(0,E.jsx)(`div`,{className:`flex flex-col gap-1 overflow-hidden rounded-xl bg-surface-hover/20 p-1 [&>*]:rounded-lg [&>*]:bg-surface-base/45`,children:i}),t[4]=i,t[5]=l);let u;t[6]===r?u=t[7]:(u=r?(0,E.jsx)(`p`,{className:`mt-2 px-1 text-xs leading-5 text-fg-subtle`,children:r}):null,t[6]=r,t[7]=u);let d;return t[8]!==o||t[9]!==c||t[10]!==l||t[11]!==u?(d=(0,E.jsxs)(`section`,{className:o,children:[c,l,u]}),t[8]=o,t[9]=c,t[10]=l,t[11]=u,t[12]=d):d=t[12],d}var O={default:{light:{canvas:`#ffffff`,panel:`#fafafa`,accent:`#3a6bff`,fg:`#111111`,muted:`#ececec`},dark:{canvas:`#0a0a0a`,panel:`#121212`,accent:`#3a6bff`,fg:`#f5f5f5`,muted:`#222222`}},emerald:{light:{canvas:`#f0fdf4`,panel:`#ffffff`,accent:`#059669`,fg:`#052e16`,muted:`#86efac`},dark:{canvas:`#000000`,panel:`#0a0a0a`,accent:`#10b981`,fg:`#d1fae5`,muted:`#134e2a`}},clay:{light:{canvas:`#fffaf0`,panel:`#ffffff`,accent:`#1a3a3a`,fg:`#0a0a0a`,muted:`#e5e5e5`},dark:{canvas:`#0a1a1a`,panel:`#1a2a2a`,accent:`#ffb084`,fg:`#fffaf0`,muted:`#2a3a3a`}},porcelain:{light:{canvas:`#f6f0e7`,panel:`#fffcf7`,accent:`#985d4d`,fg:`#352e2a`,muted:`#e8d9cf`},dark:{canvas:`#211c19`,panel:`#2b2420`,accent:`#d4a08c`,fg:`#f3eae1`,muted:`#493a32`}},dawn:{light:{canvas:`#accdec`,panel:`#f8fbff`,accent:`#34363a`,fg:`#262626`,muted:`#e7ebf4`},dark:{canvas:`#172433`,panel:`#253342`,accent:`#d9dde2`,fg:`#f3f6fa`,muted:`#415264`}}};function k(e){let t=(0,S.c)(23),{canvas:n,panel:r,accent:i,fg:a,muted:o}=e,s;t[0]===n?s=t[1]:(s={backgroundColor:n},t[0]=n,t[1]=s);let c;t[2]===r?c=t[3]:(c={backgroundColor:r},t[2]=r,t[3]=c);let l;t[4]===i?l=t[5]:(l=(0,E.jsx)(`div`,{className:`size-1 shrink-0 rounded-full`,style:{backgroundColor:i}}),t[4]=i,t[5]=l);let u;t[6]===a?u=t[7]:(u=(0,E.jsx)(`div`,{className:`h-1 min-w-0 flex-1 rounded-full`,style:{backgroundColor:a,opacity:.85}}),t[6]=a,t[7]=u);let d;t[8]!==l||t[9]!==u?(d=(0,E.jsxs)(`div`,{className:`flex items-center gap-1`,children:[l,u]}),t[8]=l,t[9]=u,t[10]=d):d=t[10];let f;t[11]===o?f=t[12]:(f=(0,E.jsx)(`div`,{className:`h-1 w-2/3 max-w-[70%] rounded-full`,style:{backgroundColor:o}}),t[11]=o,t[12]=f);let p;t[13]===o?p=t[14]:(p=(0,E.jsx)(`div`,{className:`size-1/2 max-w-[55%] rounded-full`,style:{backgroundColor:o}}),t[13]=o,t[14]=p);let m;t[15]!==c||t[16]!==d||t[17]!==f||t[18]!==p?(m=(0,E.jsxs)(`div`,{className:`flex flex-col gap-0.5 rounded-sm p-1`,style:c,children:[d,f,p]}),t[15]=c,t[16]=d,t[17]=f,t[18]=p,t[19]=m):m=t[19];let h;return t[20]!==s||t[21]!==m?(h=(0,E.jsx)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col justify-center gap-1 p-1.5`,style:s,children:m}),t[20]=s,t[21]=m,t[22]=h):h=t[22],h}function A(e){let t=(0,S.c)(8),{scheme:n}=e,{light:r,dark:i}=O[n],a;t[0]===r?a=t[1]:(a=(0,E.jsx)(k,{...r}),t[0]=r,t[1]=a);let o;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,E.jsx)(`div`,{className:`w-px shrink-0 bg-black/12 dark:bg-white/12`,"aria-hidden":!0}),t[2]=o):o=t[2];let s;t[3]===i?s=t[4]:(s=(0,E.jsx)(k,{...i}),t[3]=i,t[4]=s);let c;return t[5]!==a||t[6]!==s?(c=(0,E.jsxs)(`div`,{className:`flex h-11 w-full overflow-hidden rounded-md`,children:[a,o,s]}),t[5]=a,t[6]=s,t[7]=c):c=t[7],c}var j=[{value:`default`,labelKey:`colorSchemeDefault`},{value:`porcelain`,labelKey:`colorSchemePorcelain`},{value:`dawn`,labelKey:`colorSchemeDawn`},{value:`emerald`,labelKey:`colorSchemeLightGreen`},{value:`clay`,labelKey:`colorSchemeClay`}];function M(){let e=(0,S.c)(13),t=l(F),n;e[0]===t?n=e[1]:(n=o(t),e[0]=t,e[1]=n);let r=n.appearanceSettings,i=g(P),a=g(N),c;e[2]===r.colorSchemeTitle?c=e[3]:(c=(0,E.jsx)(`div`,{className:`min-w-0`,children:(0,E.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:r.colorSchemeTitle})}),e[2]=r.colorSchemeTitle,e[3]=c);let u;e[4]!==r||e[5]!==i||e[6]!==a?(u=j.map(e=>{let{value:t,labelKey:n}=e,o=i===t;return(0,E.jsxs)(`button`,{type:`button`,"aria-pressed":o,onClick:()=>a(t),className:s(`flex flex-col gap-2 rounded-xl bg-surface-hover/25 p-2.5 text-left transition-[background-color,box-shadow,transform] duration-150 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,f.pressCard,o?`bg-surface-active shadow-surface`:`hover:bg-surface-hover/60`),children:[(0,E.jsx)(A,{scheme:t}),(0,E.jsx)(`span`,{className:s(`text-xs font-medium leading-none`,o?`text-accent-fg`:`text-fg-muted`),children:r[n]})]},t)}),e[4]=r,e[5]=i,e[6]=a,e[7]=u):u=e[7];let d;e[8]===u?d=e[9]:(d=(0,E.jsx)(`div`,{className:`grid grid-cols-2 gap-3 sm:grid-cols-3 xl:grid-cols-5`,children:u}),e[8]=u,e[9]=d);let p;return e[10]!==c||e[11]!==d?(p=(0,E.jsxs)(`div`,{className:`flex flex-col gap-3 px-4 py-3.5 sm:px-5 sm:py-4`,children:[c,d]}),e[10]=c,e[11]=d,e[12]=p):p=e[12],p}function N(e){return e.setColorScheme}function P(e){return e.colorScheme}function F(e){return e.language}function I(){let e=(0,S.c)(28),t=l(L),n;e[0]===t?n=e[1]:(n=o(t),e[0]=t,e[1]=n);let r=n.appearanceSettings,{data:c,isLoading:u}=m(!0),f=c?.payload?.config,p;e[2]===f?p=e[3]:(p=w(f),e[2]=f,e[3]=p);let h=p,[g,_]=(0,x.useState)(h),[v,y]=(0,x.useState)(!1),[b,C]=(0,x.useState)(!1),D,O;e[4]===h?(D=e[5],O=e[6]):(D=()=>_(h),O=[h],e[4]=h,e[5]=D,e[6]=O),(0,x.useEffect)(D,O);let k;e[7]===g?k=e[8]:(k=e=>{let t=g;_(e),y(!0),C(!1),T(e).catch(()=>{_(t),C(!0)}).finally(()=>y(!1))},e[7]=g,e[8]=k);let A=k,j;e[9]===r.activityDetailDefaultTitle?j=e[10]:(j=(0,E.jsx)(`div`,{className:`min-w-0 text-sm font-medium text-fg`,children:r.activityDetailDefaultTitle}),e[9]=r.activityDetailDefaultTitle,e[10]=j);let M;e[11]!==r.activityDetailLevels||e[12]!==A||e[13]!==u||e[14]!==g||e[15]!==v?(M=u?(0,E.jsx)(d,{className:`h-10 w-full rounded-lg sm:max-w-[11rem]`}):(0,E.jsxs)(i,{value:g,disabled:v,onChange:e=>A(e.target.value),triggerClassName:`w-full sm:max-w-[11rem]`,children:[(0,E.jsx)(a,{value:`off`,children:r.activityDetailLevels.off}),(0,E.jsx)(a,{value:`on`,children:r.activityDetailLevels.on}),(0,E.jsx)(a,{value:`stream`,children:r.activityDetailLevels.stream})]}),e[11]=r.activityDetailLevels,e[12]=A,e[13]=u,e[14]=g,e[15]=v,e[16]=M):M=e[16];let N;e[17]!==j||e[18]!==M?(N=(0,E.jsxs)(`div`,{className:`flex flex-col gap-2 sm:flex-row sm:items-center sm:justify-between sm:gap-6`,children:[j,M]}),e[17]=j,e[18]=M,e[19]=N):N=e[19];let P;e[20]!==r.activityDetailSaveError||e[21]!==r.activityDetailSaving||e[22]!==b||e[23]!==v?(P=b||v?(0,E.jsx)(`p`,{className:s(`text-xs`,b?`text-red-600 dark:text-red-400`:`text-fg-subtle`),children:b?r.activityDetailSaveError:r.activityDetailSaving}):null,e[20]=r.activityDetailSaveError,e[21]=r.activityDetailSaving,e[22]=b,e[23]=v,e[24]=P):P=e[24];let F;return e[25]!==N||e[26]!==P?(F=(0,E.jsxs)(`div`,{className:`flex flex-col gap-2 px-4 py-3.5 sm:px-5 sm:py-4`,children:[N,P]}),e[25]=N,e[26]=P,e[27]=F):F=e[27],F}function L(e){return e.language}function R(){let e=(0,S.c)(17),t=l(V),n;e[0]===t?n=e[1]:(n=o(t),e[0]=t,e[1]=n);let r=n.appearanceSettings,i=_(B),a=_(z),s;e[2]===r.showRawToolDataTitle?s=e[3]:(s=(0,E.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:r.showRawToolDataTitle}),e[2]=r.showRawToolDataTitle,e[3]=s);let c;e[4]===r.showRawToolDataDescription?c=e[5]:(c=(0,E.jsx)(`p`,{className:`text-xs text-fg-muted`,children:r.showRawToolDataDescription}),e[4]=r.showRawToolDataDescription,e[5]=c);let u;e[6]!==s||e[7]!==c?(u=(0,E.jsxs)(`div`,{className:`min-w-0`,children:[s,c]}),e[6]=s,e[7]=c,e[8]=u):u=e[8];let d;e[9]===a?d=e[10]:(d=e=>a(e.target.checked),e[9]=a,e[10]=d);let f;e[11]!==i||e[12]!==d?(f=(0,E.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox`,checked:i,onChange:d}),e[11]=i,e[12]=d,e[13]=f):f=e[13];let p;return e[14]!==u||e[15]!==f?(p=(0,E.jsx)(`div`,{className:`px-4 py-3.5 sm:px-5 sm:py-4`,children:(0,E.jsxs)(`label`,{className:`flex items-center justify-between gap-3`,children:[u,f]})}),e[14]=u,e[15]=f,e[16]=p):p=e[16],p}function z(e){return e.setShowRawToolData}function B(e){return e.showRawToolData}function V(e){return e.language}function H(){let e=(0,S.c)(12),t=l(U),n;e[0]===t?n=e[1]:(n=o(t),e[0]=t,e[1]=n);let r=n.appearanceSettings,i;e[2]===r.pageTitle?i=e[3]:(i=(0,E.jsx)(y,{title:r.pageTitle}),e[2]=r.pageTitle,e[3]=i);let a;e[4]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,E.jsx)(D,{children:(0,E.jsx)(h,{variant:`page`,sections:[`language`]})}),e[4]=a):a=e[4];let s;e[5]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,E.jsxs)(D,{children:[(0,E.jsx)(h,{variant:`page`,sections:[`theme`,`font`]}),(0,E.jsx)(M,{}),(0,E.jsx)(I,{})]}),e[5]=s):s=e[5];let c;e[6]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,E.jsx)(R,{}),e[6]=c):c=e[6];let u;e[7]===r.developerGroupTitle?u=e[8]:(u=(0,E.jsx)(b,{children:(0,E.jsx)(D,{title:r.developerGroupTitle,children:c})}),e[7]=r.developerGroupTitle,e[8]=u);let d;return e[9]!==i||e[10]!==u?(d=(0,E.jsxs)(v,{gap:`gap-6`,children:[i,a,s,u]}),e[9]=i,e[10]=u,e[11]=d):d=e[11],d}function U(e){return e.language}export{H as AppearanceSettingsPanel};