@xopcai/xopc 0.0.454 → 0.0.455

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 (379) hide show
  1. package/dist/.pnpm/node-pty@1.1.0/node_modules/node-pty/lib/eventEmitter2.js +40 -0
  2. package/dist/.pnpm/node-pty@1.1.0/node_modules/node-pty/lib/index.js +56 -0
  3. package/dist/.pnpm/node-pty@1.1.0/node_modules/node-pty/lib/shared/conout.js +16 -0
  4. package/dist/.pnpm/node-pty@1.1.0/node_modules/node-pty/lib/terminal.js +190 -0
  5. package/dist/.pnpm/node-pty@1.1.0/node_modules/node-pty/lib/unixTerminal.js +287 -0
  6. package/dist/.pnpm/node-pty@1.1.0/node_modules/node-pty/lib/utils.js +49 -0
  7. package/dist/.pnpm/node-pty@1.1.0/node_modules/node-pty/lib/windowsConoutConnection.js +190 -0
  8. package/dist/.pnpm/node-pty@1.1.0/node_modules/node-pty/lib/windowsPtyAgent.js +265 -0
  9. package/dist/.pnpm/node-pty@1.1.0/node_modules/node-pty/lib/windowsTerminal.js +178 -0
  10. package/dist/_virtual/_rolldown/runtime.js +10 -2
  11. package/dist/browser-ext/manifest.json +1 -1
  12. package/dist/extensions/telegram/xopc.extension.json +1 -1
  13. package/dist/gateway/static/root/assets/{activity-store-BKH-qNPt.js → activity-store-DYwR1u3f.js} +1 -1
  14. package/dist/gateway/static/root/assets/{agent-avatar-dicebear-DY6IWy0_.js → agent-avatar-dicebear-CsRBprL-.js} +1 -1
  15. package/dist/gateway/static/root/assets/{agent-avatar-display-tnAtQOAZ.js → agent-avatar-display-DqFYHXCS.js} +2 -2
  16. package/dist/gateway/static/root/assets/{agent-defaults-settings-panel-BLQ2N_dY.js → agent-defaults-settings-panel-DOAJrMLe.js} +1 -1
  17. package/dist/gateway/static/root/assets/{agent-plugin-dialog-Bfsm4GOs.js → agent-plugin-dialog-vqlN3ORH.js} +1 -1
  18. package/dist/gateway/static/root/assets/{agents-CDNiLv0W.js → agents-BgHlOVRV.js} +3 -3
  19. package/dist/gateway/static/root/assets/{agents-admin-api-DGZsm8U4.js → agents-admin-api-CKscfdvA.js} +1 -1
  20. package/dist/gateway/static/root/assets/{api-BhipC15e.js → api-CHM2c_Ah.js} +1 -1
  21. package/dist/gateway/static/root/assets/{api-Bbj5k-7e.js → api-DPNeNCmR.js} +1 -1
  22. package/dist/gateway/static/root/assets/{app-link-CCZ-LmVT.js → app-link-DImAfVs5.js} +1 -1
  23. package/dist/gateway/static/root/assets/{app-management-settings-panel-fwhXHKxt.js → app-management-settings-panel-Bhz6bj1C.js} +1 -1
  24. package/dist/gateway/static/root/assets/{appearance-settings-BHkl-vFO.js → appearance-settings-BX32aogA.js} +1 -1
  25. package/dist/gateway/static/root/assets/{apps-page-DtCWwdsK.js → apps-page-0Yo3jBsQ.js} +1 -1
  26. package/dist/gateway/static/root/assets/{archive-plugin-B9xaxa7V.js → archive-plugin-Bha8obMe.js} +1 -1
  27. package/dist/gateway/static/root/assets/{automation-api-BHMjSwcy.js → automation-api-mn8ihWJ_.js} +1 -1
  28. package/dist/gateway/static/root/assets/{automation-result-state-BgAjEoNV.js → automation-result-state-COzakzak.js} +1 -1
  29. package/dist/gateway/static/root/assets/{automation-run-list-D3Eon5C0.js → automation-run-list-BhtaMpTb.js} +1 -1
  30. package/dist/gateway/static/root/assets/{automation-task-card-DJRg72t-.js → automation-task-card-BY_k6iWp.js} +1 -1
  31. package/dist/gateway/static/root/assets/{automations-page-DdAzXb7s.js → automations-page-Dt_Z1UTT.js} +1 -1
  32. package/dist/gateway/static/root/assets/{automations-workspace-D0nNat6N.js → automations-workspace-BhHgruhH.js} +2 -2
  33. package/dist/gateway/static/root/assets/{binary-plugins-CgsjdprR.js → binary-plugins-DUbrJFLU.js} +1 -1
  34. package/dist/gateway/static/root/assets/{block-editor-r6vj6dZO.js → block-editor-DW--pXAc.js} +1 -1
  35. package/dist/gateway/static/root/assets/{browser-settings-page-APCGT8Yr.js → browser-settings-page-CDh6nxs9.js} +1 -1
  36. package/dist/gateway/static/root/assets/{capabilities-0gYkjdax.js → capabilities-DKbXv8Ck.js} +1 -1
  37. package/dist/gateway/static/root/assets/{capabilities-BgBwcqvY.js → capabilities-kG175Q-7.js} +1 -1
  38. package/dist/gateway/static/root/assets/{capabilities-page-B1x3TwdV.js → capabilities-page-D1wQ2sPI.js} +2 -2
  39. package/dist/gateway/static/root/assets/capabilities-settings-panel-BW5jQz5R.js +8 -0
  40. package/dist/gateway/static/root/assets/{channels-8Y08v4Q2.js → channels-BzZp42yO.js} +1 -1
  41. package/dist/gateway/static/root/assets/{chat-agents-api-BRQDNNI5.js → chat-agents-api-UOdNWZ0_.js} +1 -1
  42. package/dist/gateway/static/root/assets/{chat-chart-block-qMGhfeQZ.js → chat-chart-block-NSy-B0NS.js} +1 -1
  43. package/dist/gateway/static/root/assets/{chat-page-CSTyfO9c.js → chat-page-dY6aCCRx.js} +4 -4
  44. package/dist/gateway/static/root/assets/{chat-terminal-dock-0PJ9dURQ.js → chat-terminal-dock-CAaHWS7F.js} +1 -1
  45. package/dist/gateway/static/root/assets/{command-palette-api-C4U_-rDo.js → command-palette-api-Dkn9bbYd.js} +1 -1
  46. package/dist/gateway/static/root/assets/{composer-model-config-control-B9Q40ptH.js → composer-model-config-control-BrK8-SNz.js} +1 -1
  47. package/dist/gateway/static/root/assets/{composer-notifications-ByuA8h5Z.js → composer-notifications-B-kL3qAA.js} +1 -1
  48. package/dist/gateway/static/root/assets/{composer-payload-handoff-zr1JDn3p.js → composer-payload-handoff-DBE1mvOS.js} +1 -1
  49. package/dist/gateway/static/root/assets/{computer-settings-page-D2F1quZR.js → computer-settings-page-C9KdEecx.js} +1 -1
  50. package/dist/gateway/static/root/assets/connected-providers-grid-D_8v6Qex.js +1 -0
  51. package/dist/gateway/static/root/assets/{connection-usage-guide-DkDsHm_l.js → connection-usage-guide-CiVpcbds.js} +1 -1
  52. package/dist/gateway/static/root/assets/{connector-service-page-1AcvESmp.js → connector-service-page-B919cKSm.js} +1 -1
  53. package/dist/gateway/static/root/assets/{connectors-api-C1OML7OO.js → connectors-api-CgsSm-Av.js} +1 -1
  54. package/dist/gateway/static/root/assets/{connectors-page-CMIY0Zj_.js → connectors-page-CEpfDCLA.js} +1 -1
  55. package/dist/gateway/static/root/assets/{date-picker-D1eFhoMI.js → date-picker-dx284jQI.js} +1 -1
  56. package/dist/gateway/static/root/assets/{date-time-picker-CqplKVk6.js → date-time-picker-Dj-bhLNP.js} +1 -1
  57. package/dist/gateway/static/root/assets/{desktop-pet-UmrjWSq-.js → desktop-pet-DlTuGzZ2.js} +1 -1
  58. package/dist/gateway/static/root/assets/{desktop-pet-narrative-B7I1II0Z.js → desktop-pet-narrative-cBFIPXzR.js} +1 -1
  59. package/dist/gateway/static/root/assets/{desktop-pet-settings-DRRDJMu6.js → desktop-pet-settings-CsmrvoxU.js} +1 -1
  60. package/dist/gateway/static/root/assets/{dev-view-store-CtKJMK52.js → dev-view-store-BOxbj1ie.js} +1 -1
  61. package/dist/gateway/static/root/assets/{device-pairing-wizard-C4aSCbqo.js → device-pairing-wizard-CAqFIFRC.js} +1 -1
  62. package/dist/gateway/static/root/assets/{directory-picker-path-field-D9U9yfnb.js → directory-picker-path-field-BxEw5OrT.js} +1 -1
  63. package/dist/gateway/static/root/assets/{discussion-annotation-sync-D-eGt1_L.js → discussion-annotation-sync-CyntTwIa.js} +1 -1
  64. package/dist/gateway/static/root/assets/extension-authoritative-grants-C0ReZguU.js +1 -0
  65. package/dist/gateway/static/root/assets/{extension-debug-page-BTLcC8-r.js → extension-debug-page-Cd3HMUbi.js} +1 -1
  66. package/dist/gateway/static/root/assets/extension-iframe-host-DiIqM2JO.js +1 -0
  67. package/dist/gateway/static/root/assets/{extension-marketplace-api-DLRCNlej.js → extension-marketplace-api-CK5CMKTs.js} +1 -1
  68. package/dist/gateway/static/root/assets/extension-message-router-Dn8JzOdR.js +8 -0
  69. package/dist/gateway/static/root/assets/{extension-page-CdpI-Plq.js → extension-page-CLZtAtqm.js} +1 -1
  70. package/dist/gateway/static/root/assets/{extension-provider-DUDaMvQg.js → extension-provider-CbVokTvd.js} +1 -1
  71. package/dist/gateway/static/root/assets/{extension-settings-page-biWCnMGr.js → extension-settings-page-BM79cwUy.js} +1 -1
  72. package/dist/gateway/static/root/assets/{file-preview-surface-CnBRiQo8.js → file-preview-surface-z7_HV0WN.js} +1 -1
  73. package/dist/gateway/static/root/assets/{gateway-config-swr-BV5fpBSK.js → gateway-config-swr-OGhON-s6.js} +1 -1
  74. package/dist/gateway/static/root/assets/{gateway-realtime-CIqLQXlm.js → gateway-realtime-B9u4uSXW.js} +1 -1
  75. package/dist/gateway/static/root/assets/gateway-realtime-store-xB7Bq4Zs.js +1 -0
  76. package/dist/gateway/static/root/assets/{gateway-restart-DBkfCzT5.js → gateway-restart-DKAweWmg.js} +1 -1
  77. package/dist/gateway/static/root/assets/{gateway-settings-DTzXUm9f.js → gateway-settings-Dc7qUbG-.js} +1 -1
  78. package/dist/gateway/static/root/assets/{gateway-startup-retry-B49N_Ngm.js → gateway-startup-retry-BaaoKBoB.js} +1 -1
  79. package/dist/gateway/static/root/assets/{global-defaults-api-DVpxe45P.js → global-defaults-api-BIr3ApRj.js} +1 -1
  80. package/dist/gateway/static/root/assets/{home-page-DvaxBrjG.js → home-page-i_PIrDCU.js} +2 -2
  81. package/dist/gateway/static/root/assets/{image-generation-api-CAKYslID.js → image-generation-api-C7D2IetZ.js} +1 -1
  82. package/dist/gateway/static/root/assets/{imports-page-C2KmQJ2H.js → imports-page-BjEdZJxZ.js} +1 -1
  83. package/dist/gateway/static/root/assets/index-Bj5exyow.css +1 -0
  84. package/dist/gateway/static/root/assets/{index-BpzvsoS1.js → index-CZI3VGGW.js} +5 -5
  85. package/dist/gateway/static/root/assets/{install-connector-dialog-CmNvZt8M.js → install-connector-dialog-BsiyYQhx.js} +1 -1
  86. package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-syG2KRr2.js → keyboard-shortcuts-settings-CIthQ1lp.js} +1 -1
  87. package/dist/gateway/static/root/assets/{local-app-workbench-page-DGA4EHGm.js → local-app-workbench-page-CSCIHvZV.js} +1 -1
  88. package/dist/gateway/static/root/assets/local-apps-DeqzkJiF.js +1 -0
  89. package/dist/gateway/static/root/assets/{local-apps-page-I0O2ybpp.js → local-apps-page-EntiM0tz.js} +1 -1
  90. package/dist/gateway/static/root/assets/{local-session-drafts-DsPDloiq.js → local-session-drafts-XurtjR58.js} +1 -1
  91. package/dist/gateway/static/root/assets/{locale-store-D3c8DIm-.js → locale-store-cg9cm2EL.js} +1 -1
  92. package/dist/gateway/static/root/assets/{logs-page-u9FTZaTh.js → logs-page-rmS9VSem.js} +1 -1
  93. package/dist/gateway/static/root/assets/{management-api-uxRxRX-6.js → management-api-B6jVuJ6W.js} +1 -1
  94. package/dist/gateway/static/root/assets/{management-settings-BCbDfM7f.js → management-settings-DdI9gs51.js} +1 -1
  95. package/dist/gateway/static/root/assets/{markdown-view-ohhExTMC.js → markdown-view-D1zBWkfB.js} +1 -1
  96. package/dist/gateway/static/root/assets/{mcp-conversation-setup-page-382BGqQC.js → mcp-conversation-setup-page-Bn49Ph1n.js} +1 -1
  97. package/dist/gateway/static/root/assets/{media-plugins-B5wtLz3Z.js → media-plugins-Cd6hAGDp.js} +1 -1
  98. package/dist/gateway/static/root/assets/messages-eQ2CYlpG.js +3 -0
  99. package/dist/gateway/static/root/assets/{model-selector-CoKcq0AZ.js → model-selector-CL6WT-jw.js} +1 -1
  100. package/dist/gateway/static/root/assets/{models-hub-cache-CtooMAQW.js → models-hub-cache-s0FMNhq9.js} +1 -1
  101. package/dist/gateway/static/root/assets/{note-detail-panel-DiGQtSD0.js → note-detail-panel-anM38aV6.js} +3 -3
  102. package/dist/gateway/static/root/assets/note-image-lightbox-DfK2KSgu.js +1 -0
  103. package/dist/gateway/static/root/assets/{notes-api-Cvet94d8.js → notes-api-CR75RHd0.js} +1 -1
  104. package/dist/gateway/static/root/assets/{notes-page-DwlmKweX.js → notes-page-BsZmT7Zw.js} +1 -1
  105. package/dist/gateway/static/root/assets/{oauth-api-BHp5dVNh.js → oauth-api-CvPnQTlH.js} +1 -1
  106. package/dist/gateway/static/root/assets/oauth-provider-connect-Dk1NeeqD.js +1 -0
  107. package/dist/gateway/static/root/assets/{page-context-capture-button-BwsK2uDe.js → page-context-capture-button-BPtX67hZ.js} +1 -1
  108. package/dist/gateway/static/root/assets/{page-context-draft-ieK9IN3R.js → page-context-draft-Ckb8baxj.js} +1 -1
  109. package/dist/gateway/static/root/assets/page-header-store-DU4NnGap.js +1 -0
  110. package/dist/gateway/static/root/assets/{personal-avatar-BZSC0BLP.js → personal-avatar-CZSnrSfc.js} +1 -1
  111. package/dist/gateway/static/root/assets/{personal-page-CbiD8Wn7.js → personal-page-BSCNuRMT.js} +1 -1
  112. package/dist/gateway/static/root/assets/personal-profile-settings-DJRDcK2c.js +1 -0
  113. package/dist/gateway/static/root/assets/{personal-settings-panel-_cxSzWsN.js → personal-settings-panel-C6p25Noq.js} +1 -1
  114. package/dist/gateway/static/root/assets/{phone-dependencies-card-C2OWtG2B.js → phone-dependencies-card-DKkFFpqi.js} +1 -1
  115. package/dist/gateway/static/root/assets/{phone-model-connection-CqmafRhr.js → phone-model-connection-CRRHq4PQ.js} +1 -1
  116. package/dist/gateway/static/root/assets/{phone-model-picker-BwYQtl_5.js → phone-model-picker-CN_I0-46.js} +1 -1
  117. package/dist/gateway/static/root/assets/{phone-settings-page-CPteZZWu.js → phone-settings-page-CkdSOA7D.js} +1 -1
  118. package/dist/gateway/static/root/assets/{phone-workspace-store-ReUEjG9m.js → phone-workspace-store-CC61pIuJ.js} +1 -1
  119. package/dist/gateway/static/root/assets/{plugin-details-dialog-BlNVtbEU.js → plugin-details-dialog-Bqz4jT53.js} +1 -1
  120. package/dist/gateway/static/root/assets/{preference-select-fields-BbA-g7Zq.js → preference-select-fields-DHeNbAvn.js} +1 -1
  121. package/dist/gateway/static/root/assets/{product-automation-feedback-DcPY76PG.js → product-automation-feedback-BN2HTA9T.js} +1 -1
  122. package/dist/gateway/static/root/assets/{product-delivery-2Ks17_OH.js → product-delivery-BFfqdKLe.js} +1 -1
  123. package/dist/gateway/static/root/assets/{product-open-page-BBJ7glAm.js → product-open-page-B-j4gpLD.js} +1 -1
  124. package/dist/gateway/static/root/assets/{product-preview-content-UTOSc_ii.js → product-preview-content-EqrTk7kU.js} +1 -1
  125. package/dist/gateway/static/root/assets/{product-preview-modal-Q1RZqeMo.js → product-preview-modal-aurFBFq4.js} +2 -2
  126. package/dist/gateway/static/root/assets/{project-detail-page-BlrtsEZK.js → project-detail-page-ibZZ_w51.js} +1 -1
  127. package/dist/gateway/static/root/assets/{project-understanding-B35f5MkG.js → project-understanding-HNK9lFVy.js} +1 -1
  128. package/dist/gateway/static/root/assets/{projects-page-CBH-sHOU.js → projects-page-CugSyKl5.js} +1 -1
  129. package/dist/gateway/static/root/assets/providers-api-DUntOOqr.js +1 -0
  130. package/dist/gateway/static/root/assets/{recording-upload-P1WcsdEY.js → recording-upload-DIwP541B.js} +1 -1
  131. package/dist/gateway/static/root/assets/{registry-api-DnVlwJ6M.js → registry-api-BTd_OgbD.js} +1 -1
  132. package/dist/gateway/static/root/assets/{remote-access-hub-CVEj3p0J.js → remote-access-hub-f5mIfsBF.js} +1 -1
  133. package/dist/gateway/static/root/assets/{resource-unavailable-B_S1dFze.js → resource-unavailable-DtQ2rfu_.js} +1 -1
  134. package/dist/gateway/static/root/assets/{route-preload-DGmrxJSb.js → route-preload-anuckzRl.js} +2 -2
  135. package/dist/gateway/static/root/assets/{runtime-tools-api-970sp5zI.js → runtime-tools-api-C1iI8EPo.js} +1 -1
  136. package/dist/gateway/static/root/assets/{runtime-tools-settings-panel-au6vZ0sL.js → runtime-tools-settings-panel-0tdI1z0g.js} +1 -1
  137. package/dist/gateway/static/root/assets/{service-recommendation-list-XeRFtJ-Z.js → service-recommendation-list-DSIe-NRe.js} +1 -1
  138. package/dist/gateway/static/root/assets/{session-api-CuT7EPI0.js → session-api-CQlEq0MB.js} +1 -1
  139. package/dist/gateway/static/root/assets/{session-manager-CyZHiuWY.js → session-manager-C7RfUfqI.js} +1 -1
  140. package/dist/gateway/static/root/assets/{sessions-page-BIxDwAIX.js → sessions-page-DdS8U0RV.js} +1 -1
  141. package/dist/gateway/static/root/assets/settings-advanced-gate-DnfH22f_.js +1 -0
  142. package/dist/gateway/static/root/assets/{settings-advanced-section-nbkGHQ_4.js → settings-advanced-section-C6dPu5i1.js} +1 -1
  143. package/dist/gateway/static/root/assets/{settings-mode-store-EQHfksdV.js → settings-mode-store-BSiiowQa.js} +1 -1
  144. package/dist/gateway/static/root/assets/{settings-page-D6RNHRHq.js → settings-page-DAc5n-mM.js} +1 -1
  145. package/dist/gateway/static/root/assets/{settings-page-header-19GJ_a45.js → settings-page-header-BSMu5Zq3.js} +1 -1
  146. package/dist/gateway/static/root/assets/{settings-page-layout-B2WCzSel.js → settings-page-layout-B_vMffB1.js} +1 -1
  147. package/dist/gateway/static/root/assets/{setup-interaction-page-C5i7y_pM.js → setup-interaction-page-DKXfFdNt.js} +1 -1
  148. package/dist/gateway/static/root/assets/{setup-status-panel-Cwp8YKdT.js → setup-status-panel-BbAZ9w77.js} +1 -1
  149. package/dist/gateway/static/root/assets/{share-link-dialog-DDsVTMZ-.js → share-link-dialog-ztX1WPXG.js} +1 -1
  150. package/dist/gateway/static/root/assets/{share-preview-page-C1S_gWGf.js → share-preview-page-Ds2Ydfg6.js} +1 -1
  151. package/dist/gateway/static/root/assets/{shares-api-CepTFl1f.js → shares-api-CSZqeNL4.js} +1 -1
  152. package/dist/gateway/static/root/assets/{shares-settings-Cv-tdcAN.js → shares-settings-CX3TNAmI.js} +1 -1
  153. package/dist/gateway/static/root/assets/{skill-api-CsT-iHnl.js → skill-api-CGzAQ-MX.js} +1 -1
  154. package/dist/gateway/static/root/assets/{skill-list-api-CMJTjvSo.js → skill-list-api-DfUsku-x.js} +1 -1
  155. package/dist/gateway/static/root/assets/{skill-reload-api-S6B7P9ur.js → skill-reload-api-Y9qSMnBd.js} +1 -1
  156. package/dist/gateway/static/root/assets/{skills-page-BKcsJtYx.js → skills-page-DnMN50Ot.js} +1 -1
  157. package/dist/gateway/static/root/assets/{system-settings-panel-DhHPM5qU.js → system-settings-panel-DWNkQmme.js} +1 -1
  158. package/dist/gateway/static/root/assets/{task-detail-page-BHH2_Z9_.js → task-detail-page-BJok6V1K.js} +1 -1
  159. package/dist/gateway/static/root/assets/{task-input-card-D_2rNF31.js → task-input-card-lCMSy6YY.js} +1 -1
  160. package/dist/gateway/static/root/assets/{terminal-panel-store-CcUWpqvC.js → terminal-panel-store-D8eZPvql.js} +1 -1
  161. package/dist/gateway/static/root/assets/{theme-store-D9pquJiM.js → theme-store-GZQ3pTgy.js} +1 -1
  162. package/dist/gateway/static/root/assets/tool-friendly-title-DC8_9-Lo.js +2 -0
  163. package/dist/gateway/static/root/assets/{tracing-settings-page-CjNrKILr.js → tracing-settings-page-DM3-7Hlw.js} +1 -1
  164. package/dist/gateway/static/root/assets/{tunnel-api-GtLO40pc.js → tunnel-api-DOGAIXRR.js} +1 -1
  165. package/dist/gateway/static/root/assets/{understanding-activity-store-BhB5wAbq.js → understanding-activity-store-CuPfe0eQ.js} +1 -1
  166. package/dist/gateway/static/root/assets/{understanding-refresh-store-BxtpXRfV.js → understanding-refresh-store-Ihz2p9Vg.js} +1 -1
  167. package/dist/gateway/static/root/assets/{usage-page-CZa_a6_7.js → usage-page-BA9Yrvqu.js} +1 -1
  168. package/dist/gateway/static/root/assets/{use-autosave-BtOp6W9H.js → use-autosave-CO0IPCVg.js} +1 -1
  169. package/dist/gateway/static/root/assets/{use-composer-attachments-BTQZx8Nj.js → use-composer-attachments-CLIrD0mm.js} +1 -1
  170. package/dist/gateway/static/root/assets/{use-file-preview-expanded-B7nscYS4.js → use-file-preview-expanded-dhNMHf5b.js} +3 -3
  171. package/dist/gateway/static/root/assets/{use-personal-profile-Cj7WGOfv.js → use-personal-profile-CVqDWBDS.js} +1 -1
  172. package/dist/gateway/static/root/assets/{use-realtime-voice-BS1rygyV.js → use-realtime-voice-DDVVlX1R.js} +1 -1
  173. package/dist/gateway/static/root/assets/{use-workspace-tree-DYosm4Gz.js → use-workspace-tree-CZej8mhf.js} +1 -1
  174. package/dist/gateway/static/root/assets/{user-model-page-DmmJODQ4.js → user-model-page-1eYattnk.js} +1 -1
  175. package/dist/gateway/static/root/assets/{voice-api-key-field-8voN8dQG.js → voice-api-key-field-DpwUDAvu.js} +1 -1
  176. package/dist/gateway/static/root/assets/{voice-config-api-CrZd2aqw.js → voice-config-api-GIuXoHXw.js} +1 -1
  177. package/dist/gateway/static/root/assets/{voice-input-shortcut-events-DcFp_fy4.js → voice-input-shortcut-events-Cc30ZcFy.js} +1 -1
  178. package/dist/gateway/static/root/assets/{voice-settings-AckvhNnP.js → voice-settings-DA3m5MT0.js} +1 -1
  179. package/dist/gateway/static/root/assets/{work-discovery-overlay-DAIk5csp.js → work-discovery-overlay-yGUkk1NV.js} +1 -1
  180. package/dist/gateway/static/root/assets/{work-discovery-page-CJeixeWQ.js → work-discovery-page-RN6iuY-0.js} +1 -1
  181. package/dist/gateway/static/root/assets/{working-directory-picker-modal-BW76VaD5.js → working-directory-picker-modal-CeXl9w6z.js} +1 -1
  182. package/dist/gateway/static/root/assets/{workspace-api-Cu2gzmVn.js → workspace-api-B1Uirhxf.js} +2 -2
  183. package/dist/gateway/static/root/assets/workspace-editor-agent-store-Nos5ebMv.js +1 -0
  184. package/dist/gateway/static/root/assets/{workspace-file-preview-dialog-DyqI793w.js → workspace-file-preview-dialog-D0h2yJ3v.js} +1 -1
  185. package/dist/gateway/static/root/assets/{workspace-open-location-menu-DTYkApy8.js → workspace-open-location-menu-DWGNOIE2.js} +1 -1
  186. package/dist/gateway/static/root/assets/{xopc-cloud-account-card-Rytp_NWV.js → xopc-cloud-account-card-x-XT4bKF.js} +1 -1
  187. package/dist/gateway/static/root/index.html +91 -91
  188. package/dist/package.js +1 -1
  189. package/dist/packages/gateway-contract/src/extension-capabilities.js +69 -4
  190. package/dist/packages/gateway-contract/src/local-app-delegation.js +4 -1
  191. package/dist/src/agent/agent-manager.js +1 -1
  192. package/dist/src/agent/child-agent-factory.js +24 -1
  193. package/dist/src/agent/commands/command-registry.d.ts +10 -0
  194. package/dist/src/agent/commands/command-registry.js +37 -16
  195. package/dist/src/agent/commands/command-transport.d.ts +19 -0
  196. package/dist/src/agent/commands/command-transport.js +92 -0
  197. package/dist/src/agent/context/project-context.js +1 -1
  198. package/dist/src/agent/embedded/execution-tool-policy.d.ts +1 -0
  199. package/dist/src/agent/embedded/execution-tool-policy.js +16 -5
  200. package/dist/src/agent/embedded/index.js +1 -1
  201. package/dist/src/agent/embedded/run-turn.js +74 -14
  202. package/dist/src/agent/embedded/runs.d.ts +2 -0
  203. package/dist/src/agent/embedded/runs.js +8 -1
  204. package/dist/src/agent/embedded/session-runner.js +2 -2
  205. package/dist/src/agent/external-tools/endpoint-provider.js +1 -1
  206. package/dist/src/agent/inbound/attachment-pipeline.js +1 -1
  207. package/dist/src/agent/orchestration/agent-orchestrator.js +1 -1
  208. package/dist/src/agent/orchestration/child-run-monitor.d.ts +35 -0
  209. package/dist/src/agent/orchestration/child-run-monitor.js +104 -0
  210. package/dist/src/agent/orchestration/child-run-resume.d.ts +3 -0
  211. package/dist/src/agent/orchestration/child-run-resume.js +67 -0
  212. package/dist/src/agent/sandbox/native-command.d.ts +15 -0
  213. package/dist/src/agent/sandbox/native-command.js +65 -0
  214. package/dist/src/agent/service/btw-query.d.ts +1 -0
  215. package/dist/src/agent/service/btw-query.js +1 -1
  216. package/dist/src/agent/service/direct-turn-helpers.js +2 -2
  217. package/dist/src/agent/service/process-direct-streaming.js +2 -2
  218. package/dist/src/agent/service.js +2 -2
  219. package/dist/src/agent/session/interaction-policy.d.ts +21 -0
  220. package/dist/src/agent/session/interaction-policy.js +58 -0
  221. package/dist/src/agent/session/session-inspector.js +3 -2
  222. package/dist/src/agent/tools/create-share-tool.js +1 -1
  223. package/dist/src/agent/tools/exec-command.js +5 -0
  224. package/dist/src/agent/tools/factory.js +1 -1
  225. package/dist/src/agent/tools/index.js +1 -1
  226. package/dist/src/agent/tools/list-dir.js +1 -1
  227. package/dist/src/agent/tools/managed-job-tool.js +16 -1
  228. package/dist/src/agent/tools/personal-read-tool.js +1 -1
  229. package/dist/src/agent/tools/publish-artifacts.js +1 -1
  230. package/dist/src/agent/tools/read.js +1 -1
  231. package/dist/src/agent/tools/send-media.js +1 -1
  232. package/dist/src/agent/tools/write.js +1 -1
  233. package/dist/src/agent/tools/xopc-use-tool.js +4 -4
  234. package/dist/src/automations/capabilities/drafts.js +5 -1
  235. package/dist/src/automations/capabilities/read.js +58 -8
  236. package/dist/src/automations/capabilities/write.js +53 -0
  237. package/dist/src/automations/delivery/delivery-router.js +3 -1
  238. package/dist/src/automations/run-changes.d.ts +2 -0
  239. package/dist/src/automations/run-changes.js +18 -0
  240. package/dist/src/automations/service/automation-service.d.ts +2 -9
  241. package/dist/src/automations/service/automation-service.js +3 -2
  242. package/dist/src/automations/storage/automation-run-repository.d.ts +5 -0
  243. package/dist/src/automations/storage/automation-run-repository.js +15 -1
  244. package/dist/src/capabilities/runtime/dispatcher.d.ts +1 -0
  245. package/dist/src/capabilities/runtime/product.d.ts +2 -0
  246. package/dist/src/capabilities/runtime/product.js +26 -6
  247. package/dist/src/channels/attachments/voice-stt-webchat.js +1 -1
  248. package/dist/src/chat-commands/types.d.ts +2 -0
  249. package/dist/src/cli/commands/tui-runner.d.ts +1 -1
  250. package/dist/src/cli/commands/tui-runner.js +1 -0
  251. package/dist/src/cli/commands/tui.js +1 -1
  252. package/dist/src/config/schema.d.ts +1 -1
  253. package/dist/src/gateway/agent-builtin-tools.d.ts +1 -1
  254. package/dist/src/gateway/agents-admin.js +1 -1
  255. package/dist/src/gateway/file-path-classifier.js +1 -1
  256. package/dist/src/gateway/hono/routes/auth-registry-extensions.js +107 -10
  257. package/dist/src/gateway/hono/routes/imports.js +1 -1
  258. package/dist/src/gateway/hono/routes/lazy-bundles.js +2 -2
  259. package/dist/src/gateway/hono/routes/local-app-capabilities.js +12 -2
  260. package/dist/src/gateway/hono/routes/local-app-run-streams.d.ts +4 -0
  261. package/dist/src/gateway/hono/routes/local-app-run-streams.js +105 -0
  262. package/dist/src/gateway/hono/routes/sessions.js +2 -2
  263. package/dist/src/gateway/hono/routes/shares.js +1 -1
  264. package/dist/src/gateway/hono/routes/tasks.js +2 -2
  265. package/dist/src/gateway/hono/routes/tui.js +308 -0
  266. package/dist/src/gateway/media-access.js +1 -1
  267. package/dist/src/gateway/security/gateway-scopes.js +1 -1
  268. package/dist/src/gateway/service/agent-runner.js +1 -1
  269. package/dist/src/gateway/service/config-coordinator.d.ts +1 -1
  270. package/dist/src/gateway/service/sessions-api.d.ts +1 -1
  271. package/dist/src/gateway/service/sessions-api.js +3 -3
  272. package/dist/src/gateway/service.js +8 -8
  273. package/dist/src/gateway/session-reset-service.js +1 -1
  274. package/dist/src/gateway/xopc-cloud-capability-setup.js +1 -1
  275. package/dist/src/home-intelligence/host.js +2 -2
  276. package/dist/src/infra/execution-authority.d.ts +12 -0
  277. package/dist/src/infra/execution-authority.js +27 -0
  278. package/dist/src/local-apps/automation-proposals.d.ts +754 -0
  279. package/dist/src/local-apps/automation-proposals.js +185 -0
  280. package/dist/src/local-apps/capabilities/automation-policy.d.ts +7 -0
  281. package/dist/src/local-apps/capabilities/automation-policy.js +46 -0
  282. package/dist/src/local-apps/capabilities/contracts.js +23 -0
  283. package/dist/src/local-apps/capabilities/delegate.js +21 -4
  284. package/dist/src/local-apps/capabilities/projections.d.ts +588 -0
  285. package/dist/src/local-apps/capabilities/projections.js +135 -2
  286. package/dist/src/local-apps/capabilities/resource-policy.js +76 -0
  287. package/dist/src/local-apps/capabilities/runtime.js +2 -1
  288. package/dist/src/local-apps/execution-authority.d.ts +13 -0
  289. package/dist/src/local-apps/execution-authority.js +104 -0
  290. package/dist/src/local-apps/p1-services.d.ts +189 -0
  291. package/dist/src/local-apps/p1-services.js +620 -0
  292. package/dist/src/local-apps/preview-sessions.d.ts +1 -1
  293. package/dist/src/local-apps/preview-sessions.js +2 -2
  294. package/dist/src/local-apps/preview-worker.js +11 -2
  295. package/dist/src/local-apps/service.d.ts +81 -1
  296. package/dist/src/local-apps/service.js +18 -1
  297. package/dist/src/local-apps/store.js +1 -1
  298. package/dist/src/notes/agent-context.js +1 -1
  299. package/dist/src/personal-agent/request-service.js +1 -1
  300. package/dist/src/personal-agent/task-cancel.js +1 -1
  301. package/dist/src/platform/contracts.d.ts +3 -3
  302. package/dist/src/projects/capabilities/read.js +43 -2
  303. package/dist/src/projects/capabilities/write.js +25 -0
  304. package/dist/src/projects/project-store.js +12 -1
  305. package/dist/src/projects/types.d.ts +1 -0
  306. package/dist/src/review/review-git.js +14 -1
  307. package/dist/src/share/share-store.js +1 -1
  308. package/dist/src/share/site-share-store.js +1 -1
  309. package/dist/src/storage/sqlite/resource-scope.js +2 -2
  310. package/dist/src/tasks/capabilities/management.js +3 -0
  311. package/dist/src/tasks/capabilities/write.js +11 -2
  312. package/dist/src/tasks/index.js +1 -1
  313. package/dist/src/tui/backend-services.d.ts +14 -0
  314. package/dist/src/tui/backend-services.js +67 -0
  315. package/dist/src/tui/backends/embedded-backend.d.ts +48 -4
  316. package/dist/src/tui/backends/embedded-backend.js +248 -42
  317. package/dist/src/tui/backends/gateway-realtime-backend.d.ts +46 -2
  318. package/dist/src/tui/backends/gateway-realtime-backend.js +205 -62
  319. package/dist/src/tui/components/chat-log.d.ts +1 -0
  320. package/dist/src/tui/components/chat-log.js +11 -5
  321. package/dist/src/tui/components/scoped-models-selector.js +1 -1
  322. package/dist/src/tui/components/session-selector.js +1 -1
  323. package/dist/src/tui/components/text-viewer.d.ts +32 -0
  324. package/dist/src/tui/components/text-viewer.js +132 -0
  325. package/dist/src/tui/components/tui-bottom-bar.js +3 -0
  326. package/dist/src/tui/extension-host/autocomplete.js +9 -1
  327. package/dist/src/tui/extension-host/runtime.d.ts +1 -0
  328. package/dist/src/tui/extension-host/runtime.js +1 -0
  329. package/dist/src/tui/tui-backend.d.ts +36 -3
  330. package/dist/src/tui/tui-capabilities.d.ts +15 -0
  331. package/dist/src/tui/tui-capabilities.js +46 -0
  332. package/dist/src/tui/tui-capability-controls.d.ts +9 -0
  333. package/dist/src/tui/tui-capability-controls.js +250 -0
  334. package/dist/src/tui/tui-clarification.d.ts +15 -0
  335. package/dist/src/tui/tui-clarification.js +91 -0
  336. package/dist/src/tui/tui-command-formatters.d.ts +0 -4
  337. package/dist/src/tui/tui-command-formatters.js +3 -43
  338. package/dist/src/tui/tui-commands.d.ts +4 -4
  339. package/dist/src/tui/tui-commands.js +219 -127
  340. package/dist/src/tui/tui-control-commands.d.ts +12 -0
  341. package/dist/src/tui/tui-control-commands.js +127 -0
  342. package/dist/src/tui/tui-image-files.d.ts +2 -0
  343. package/dist/src/tui/tui-image-files.js +47 -0
  344. package/dist/src/tui/tui-local-shell.d.ts +6 -0
  345. package/dist/src/tui/tui-local-shell.js +36 -2
  346. package/dist/src/tui/tui-management.d.ts +114 -0
  347. package/dist/src/tui/tui-management.js +233 -0
  348. package/dist/src/tui/tui-picker-overlay.d.ts +1 -6
  349. package/dist/src/tui/tui-picker-overlay.js +1 -62
  350. package/dist/src/tui/tui-session-actions.d.ts +1 -0
  351. package/dist/src/tui/tui-session-actions.js +97 -29
  352. package/dist/src/tui/tui-settings.js +1 -1
  353. package/dist/src/tui/tui-side-chat.d.ts +10 -0
  354. package/dist/src/tui/tui-side-chat.js +56 -0
  355. package/dist/src/tui/tui-terminal.d.ts +3 -0
  356. package/dist/src/tui/tui-terminal.js +52 -0
  357. package/dist/src/tui/tui-types.d.ts +4 -1
  358. package/dist/src/tui/tui.js +422 -211
  359. package/dist/src/tui/xopc-tui-keybindings.d.ts +29 -9
  360. package/dist/src/tui/xopc-tui-keybindings.js +27 -7
  361. package/dist/src/usage/recorder.js +2 -0
  362. package/package.json +2 -1
  363. package/dist/gateway/static/root/assets/capabilities-settings-panel-CZ78ckHR.js +0 -8
  364. package/dist/gateway/static/root/assets/connected-providers-grid-CgULhOBZ.js +0 -1
  365. package/dist/gateway/static/root/assets/extension-authoritative-grants-8ONVOjPW.js +0 -1
  366. package/dist/gateway/static/root/assets/extension-iframe-host-D0-OvFV2.js +0 -1
  367. package/dist/gateway/static/root/assets/extension-message-router-DboLTCVp.js +0 -1
  368. package/dist/gateway/static/root/assets/gateway-realtime-store-B6T1Xzag.js +0 -1
  369. package/dist/gateway/static/root/assets/index-B49yIcMR.css +0 -1
  370. package/dist/gateway/static/root/assets/local-apps-CB-MZAaL.js +0 -1
  371. package/dist/gateway/static/root/assets/messages-DPLud9GK.js +0 -3
  372. package/dist/gateway/static/root/assets/note-image-lightbox-Ds4M9fJJ.js +0 -1
  373. package/dist/gateway/static/root/assets/oauth-provider-connect-cvxtmf3C.js +0 -1
  374. package/dist/gateway/static/root/assets/page-header-store-Xe8CP_4a.js +0 -1
  375. package/dist/gateway/static/root/assets/personal-profile-settings-KvdNnaNv.js +0 -1
  376. package/dist/gateway/static/root/assets/providers-api-BSmKlQ8K.js +0 -1
  377. package/dist/gateway/static/root/assets/settings-advanced-gate-Cy7xeKmH.js +0 -1
  378. package/dist/gateway/static/root/assets/tool-friendly-title-YQmN1S2k.js +0 -2
  379. package/dist/gateway/static/root/assets/workspace-editor-agent-store-pVOYuH7u.js +0 -1
@@ -1,7 +1,11 @@
1
- /** App-level bindings wired by xopc TUI (subset of pi coding-agent). */
2
- export type XopcTuiAppKeybinding = 'app.interrupt' | 'app.clear' | 'app.exit' | 'app.suspend' | 'app.thinking.cycle' | 'app.model.cycleForward' | 'app.model.cycleBackward' | 'app.model.select' | 'app.tools.expand' | 'app.thinking.toggle' | 'app.transcript.open' | 'app.transcript.raw' | 'app.session.resume' | 'app.session.tree' | 'app.session.fork' | 'app.session.togglePath' | 'app.session.toggleSort' | 'app.session.toggleNamedFilter' | 'app.session.rename' | 'app.session.delete' | 'app.session.deleteNoninvasive' | 'app.tree.foldOrUp' | 'app.tree.unfoldOrDown' | 'app.tree.filter.default' | 'app.tree.filter.noTools' | 'app.tree.filter.userOnly' | 'app.tree.filter.labeledOnly' | 'app.tree.filter.all' | 'app.tree.filter.cycleForward' | 'app.tree.filter.cycleBackward' | 'app.tree.editLabel' | 'app.tree.toggleLabelTimestamp' | 'app.editor.external' | 'app.clipboard.pasteImage' | 'app.message.followUp' | 'app.message.editQueued' | 'app.message.deleteQueued' | 'app.models.save' | 'app.models.enableAll' | 'app.models.clearAll' | 'app.models.toggleProvider' | 'app.models.reorderUp' | 'app.models.reorderDown';
1
+ /** Application bindings for the terminal work loop. */
2
+ export type XopcTuiAppKeybinding = 'app.mode.cycle' | 'app.response.copy' | 'app.history.search' | 'app.view.clear' | 'app.interrupt' | 'app.clear' | 'app.exit' | 'app.suspend' | 'app.thinking.cycle' | 'app.model.cycleForward' | 'app.model.cycleBackward' | 'app.model.select' | 'app.tools.expand' | 'app.thinking.toggle' | 'app.transcript.open' | 'app.transcript.raw' | 'app.session.resume' | 'app.session.tree' | 'app.session.fork' | 'app.session.togglePath' | 'app.session.toggleSort' | 'app.session.toggleNamedFilter' | 'app.session.rename' | 'app.session.delete' | 'app.session.deleteNoninvasive' | 'app.tree.foldOrUp' | 'app.tree.unfoldOrDown' | 'app.tree.filter.default' | 'app.tree.filter.noTools' | 'app.tree.filter.userOnly' | 'app.tree.filter.labeledOnly' | 'app.tree.filter.all' | 'app.tree.filter.cycleForward' | 'app.tree.filter.cycleBackward' | 'app.tree.editLabel' | 'app.tree.toggleLabelTimestamp' | 'app.editor.external' | 'app.clipboard.pasteImage' | 'app.message.followUp' | 'app.message.editQueued' | 'app.message.deleteQueued' | 'app.models.save' | 'app.models.enableAll' | 'app.models.clearAll' | 'app.models.toggleProvider' | 'app.models.reorderUp' | 'app.models.reorderDown';
3
3
  declare module '@earendil-works/pi-tui' {
4
4
  interface Keybindings {
5
+ 'app.mode.cycle': true;
6
+ 'app.response.copy': true;
7
+ 'app.history.search': true;
8
+ 'app.view.clear': true;
5
9
  'app.interrupt': true;
6
10
  'app.clear': true;
7
11
  'app.exit': true;
@@ -48,6 +52,22 @@ declare module '@earendil-works/pi-tui' {
48
52
  }
49
53
  }
50
54
  export declare const XOPC_TUI_KEYBINDINGS: {
55
+ readonly 'app.mode.cycle': {
56
+ readonly defaultKeys: "shift+tab";
57
+ readonly description: "Toggle Default / Plan mode";
58
+ };
59
+ readonly 'app.response.copy': {
60
+ readonly defaultKeys: "ctrl+o";
61
+ readonly description: "Copy the last assistant response";
62
+ };
63
+ readonly 'app.history.search': {
64
+ readonly defaultKeys: "ctrl+r";
65
+ readonly description: "Search submitted prompt history";
66
+ };
67
+ readonly 'app.view.clear': {
68
+ readonly defaultKeys: "ctrl+l";
69
+ readonly description: "Clear the view, preserving conversation context";
70
+ };
51
71
  readonly 'app.interrupt': {
52
72
  readonly defaultKeys: "escape";
53
73
  readonly description: "Abort run (or cancel overlay)";
@@ -65,23 +85,23 @@ export declare const XOPC_TUI_KEYBINDINGS: {
65
85
  readonly description: "Suspend to shell (SIGTSTP)";
66
86
  };
67
87
  readonly 'app.thinking.cycle': {
68
- readonly defaultKeys: "shift+tab";
69
- readonly description: "Cycle /think level";
88
+ readonly defaultKeys: [];
89
+ readonly description: "Cycle thinking level";
70
90
  };
71
91
  readonly 'app.model.cycleForward': {
72
- readonly defaultKeys: "ctrl+p";
92
+ readonly defaultKeys: [];
73
93
  readonly description: "Next model (/switch)";
74
94
  };
75
95
  readonly 'app.model.cycleBackward': {
76
- readonly defaultKeys: "shift+ctrl+p";
96
+ readonly defaultKeys: [];
77
97
  readonly description: "Previous model (/switch)";
78
98
  };
79
99
  readonly 'app.model.select': {
80
- readonly defaultKeys: "ctrl+l";
100
+ readonly defaultKeys: [];
81
101
  readonly description: "Model picker";
82
102
  };
83
103
  readonly 'app.tools.expand': {
84
- readonly defaultKeys: "ctrl+o";
104
+ readonly defaultKeys: [];
85
105
  readonly description: "Toggle tool output";
86
106
  };
87
107
  readonly 'app.thinking.toggle': {
@@ -409,5 +429,5 @@ export declare const XOPC_TUI_KEYBINDINGS: {
409
429
  readonly description: "Scroll viewport to bottom";
410
430
  };
411
431
  };
412
- /** Order for `/hotkeys` and docs (pi-style UX). */
432
+ /** Order for `/hotkeys` and documentation. */
413
433
  export declare const XOPC_TUI_HOTKEY_ORDER: XopcTuiAppKeybinding[];
@@ -2,6 +2,22 @@ import { TUI_KEYBINDINGS } from "@earendil-works/pi-tui";
2
2
  //#region src/tui/xopc-tui-keybindings.ts
3
3
  const XOPC_TUI_KEYBINDINGS = {
4
4
  ...TUI_KEYBINDINGS,
5
+ "app.mode.cycle": {
6
+ defaultKeys: "shift+tab",
7
+ description: "Toggle Default / Plan mode"
8
+ },
9
+ "app.response.copy": {
10
+ defaultKeys: "ctrl+o",
11
+ description: "Copy the last assistant response"
12
+ },
13
+ "app.history.search": {
14
+ defaultKeys: "ctrl+r",
15
+ description: "Search submitted prompt history"
16
+ },
17
+ "app.view.clear": {
18
+ defaultKeys: "ctrl+l",
19
+ description: "Clear the view, preserving conversation context"
20
+ },
5
21
  "app.interrupt": {
6
22
  defaultKeys: "escape",
7
23
  description: "Abort run (or cancel overlay)"
@@ -19,23 +35,23 @@ const XOPC_TUI_KEYBINDINGS = {
19
35
  description: "Suspend to shell (SIGTSTP)"
20
36
  },
21
37
  "app.thinking.cycle": {
22
- defaultKeys: "shift+tab",
23
- description: "Cycle /think level"
38
+ defaultKeys: [],
39
+ description: "Cycle thinking level"
24
40
  },
25
41
  "app.model.cycleForward": {
26
- defaultKeys: "ctrl+p",
42
+ defaultKeys: [],
27
43
  description: "Next model (/switch)"
28
44
  },
29
45
  "app.model.cycleBackward": {
30
- defaultKeys: "shift+ctrl+p",
46
+ defaultKeys: [],
31
47
  description: "Previous model (/switch)"
32
48
  },
33
49
  "app.model.select": {
34
- defaultKeys: "ctrl+l",
50
+ defaultKeys: [],
35
51
  description: "Model picker"
36
52
  },
37
53
  "app.tools.expand": {
38
- defaultKeys: "ctrl+o",
54
+ defaultKeys: [],
39
55
  description: "Toggle tool output"
40
56
  },
41
57
  "app.thinking.toggle": {
@@ -175,8 +191,12 @@ const XOPC_TUI_KEYBINDINGS = {
175
191
  description: "Move scoped model down"
176
192
  }
177
193
  };
178
- /** Order for `/hotkeys` and docs (pi-style UX). */
194
+ /** Order for `/hotkeys` and documentation. */
179
195
  const XOPC_TUI_HOTKEY_ORDER = [
196
+ "app.mode.cycle",
197
+ "app.response.copy",
198
+ "app.history.search",
199
+ "app.view.clear",
180
200
  "app.interrupt",
181
201
  "app.clear",
182
202
  "app.exit",
@@ -5,6 +5,7 @@ import { init_scenario_registry, resolveAiUsageScenario } from "./scenario-regis
5
5
  import { finishAiUsageEvent, insertAiUsageEvent } from "../storage/sqlite/ai-usage-repository.js";
6
6
  import { reconcileCloudUsageReceipt, withUsageReceiptContext } from "./cloud-receipts.js";
7
7
  import { hasAuthoritativeCloudUsage } from "./cloud-wire.js";
8
+ import { getExecutionAuthority } from "../infra/execution-authority.js";
8
9
  import { startObservation } from "../observability/runtime.js";
9
10
  import { classifyCostSource, dollarsToMicrousd, pricingSnapshot } from "./cost.js";
10
11
  import { randomUUID } from "node:crypto";
@@ -22,6 +23,7 @@ function continuesAfterTool(messages) {
22
23
  return false;
23
24
  }
24
25
  function startAiUsageCall(model, context, input) {
26
+ getExecutionAuthority()?.reserveModel(model);
25
27
  const observation = startObservation(context.operation, "generation", context);
26
28
  observation.update({
27
29
  "gen_ai.request.model": model.id,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xopcai/xopc",
3
- "version": "0.0.454",
3
+ "version": "0.0.455",
4
4
  "description": "An open-source AI assistant for work and everyday life. Remembers context and helps you get things done. Local-first, on a computer you choose.",
5
5
  "type": "module",
6
6
  "main": "dist/src/index.js",
@@ -231,6 +231,7 @@
231
231
  "test:plugins:browser": "cross-env XOPC_LOG_LEVEL=fatal tsx scripts/verify-plugin-setup-browser.mts",
232
232
  "test:web:activity:e2e": "pnpm run build:node && pnpm run build:web && tsx scripts/verify-assistant-activity-browser.mts",
233
233
  "test:web:clarification:e2e": "pnpm run build:node && pnpm run build:web && tsx scripts/verify-clarification-browser.mts",
234
+ "test:web:tool-approval:e2e": "pnpm run build:web && tsx scripts/verify-tool-approval-browser.mts",
234
235
  "test:web:onboarding-visual": "node scripts/test-onboarding-visual.mjs",
235
236
  "test:web:onboarding-visual:update": "node scripts/test-onboarding-visual.mjs --update",
236
237
  "test:quick-understanding": "XOPC_LOG_LEVEL=fatal vitest run src/work-discovery/__tests__/evaluation.test.ts src/user-context/sources/__tests__/activity-clustering.test.ts src/knowledge/__tests__/quick-understanding.e2e.test.ts src/connectors/__tests__/content-enrichment.test.ts src/connectors/__tests__/connected-source-ingestion.test.ts",
@@ -1,8 +0,0 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/vendor-swr-CdRzEUwF.js","assets/rolldown-runtime-aKtaBQYM.js","assets/vendor-react-BOUWij0V.js"])))=>i.map(i=>d[i]);
2
- import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{t as i}from"./preload-helper-Czpn1I53.js";import{f as a,l as o,m as s,r as c,t as l}from"./chunk-KS7C4IRE-CiwuuyV8.js";import{a as u,i as d,l as f,n as p,o as m}from"./locale-store-D3c8DIm-.js";import{t as h}from"./messages-DPLud9GK.js";import{a as g,i as _,n as v,o as y,r as b,s as x,t as S}from"./dist-CY7CS_D3.js";import{t as C}from"./arrow-right-DSSvoX71.js";import{t as w}from"./arrow-up-right-T72JbQ1Q.js";import{t as T}from"./chevron-right-BweFrslA.js";import{n as E,r as D,t as O}from"./popover-select-CLsphyzA.js";import{t as k}from"./circle-check-C23XjkUj.js";import{C as A,S as j,_ as M,a as ee,b as N,c as P,d as F,f as I,g as L,h as R,i as z,l as B,m as te,n as ne,o as V,p as re,r as H,s as U,t as ie,u as W,v as ae,x as G,y as oe}from"./connected-providers-grid-CgULhOBZ.js";import{t as K}from"./cloud-C4-yfnnk.js";import{t as se}from"./external-link-DjqjBmc3.js";import{t as q}from"./secret-input-DsjfQmDn.js";import{t as ce}from"./eye-CABVeTq0.js";import{t as le}from"./image-Cwyalflz.js";import{t as ue}from"./key-round-DWbpyU2U.js";import{t as de}from"./loader-circle-CifKLtgG.js";import{t as J}from"./pencil-DmIY3Oa-.js";import{t as fe}from"./plug-DKYPEgkR.js";import{t as pe}from"./plus-Q2yW6OE7.js";import{t as me}from"./refresh-cw-BRlGaq2w.js";import{t as he}from"./settings-2-D-csvaET.js";import{t as ge}from"./shield-check-BU58siTV.js";import{t as _e}from"./sliders-horizontal-DqsYor6I.js";import{t as ve}from"./trash-2-DusmjVPV.js";import{t as ye}from"./triangle-alert-2JXFNNKU.js";import{t as be}from"./wrench-DFb4r8bH.js";import{t as xe}from"./x-B_N4OPjy.js";import{t as Y}from"./cn-0WouolD0.js";import{t as Se}from"./skeleton-DzdOeGYz.js";import{t as Ce}from"./voice-CDlC6XMH.js";import{i as X}from"./vendor-swr-CdRzEUwF.js";import{n as we,r as Te}from"./gateway-config-swr-BV5fpBSK.js";import{n as Ee,t as De}from"./registry-api-DnVlwJ6M.js";import{t as Z}from"./button-Cc4hUNTt.js";import{i as Oe,o as ke}from"./settings-shell-dialog-layer-BU3UuiJr.js";import{n as Ae}from"./open-capability-settings-DQsmJxI7.js";import{n as je,t as Me}from"./interaction-BdhHBbYa.js";import{n as Ne,t as Pe}from"./voice-settings-AckvhNnP.js";import{a as Fe,o as Ie,s as Le}from"./form-field-width-DJw_jULe.js";import{n as Re}from"./is-masked-secret-DOkL5b_X.js";import{n as ze,t as Be}from"./secret-input-labels-B5Jl5HqK.js";import{a as Ve}from"./navigation-ByOzYT0t.js";import{t as He}from"./electron-env-DHOGevH3.js";import{n as Ue,t as We}from"./settings-form-draft-Dy10ldo8.js";import{t as Ge}from"./sliding-tab-list-CmcrqRzN.js";import{t as Ke}from"./confirm-dialog-DrA5mTQp.js";import{n as qe,t as Je}from"./model-sort-_Tz8s_4N.js";import{n as Ye,r as Xe}from"./model-selector-CoKcq0AZ.js";import{n as Ze}from"./agents-app-path-ciChvpCS.js";import{n as Qe,t as $e}from"./global-defaults-api-DVpxe45P.js";import{t as et}from"./settings-loading-skeleton-CAoOV17i.js";import{i as tt,n as nt,r as rt,t as it}from"./capability-navigation-QtHJxxW2.js";import{i as at,r as ot,t as st}from"./models-hub-cache-CtooMAQW.js";import{a as ct,r as lt,s as ut,t as dt}from"./providers-api-BSmKlQ8K.js";import{a as ft,i as pt,n as mt,o as ht,r as gt,t as _t}from"./oauth-api-BHp5dVNh.js";import{t as vt}from"./settings-advanced-section-nbkGHQ_4.js";import{n as yt,r as bt,t as xt}from"./oauth-authorization-window-o6URRos4.js";import{t as St}from"./number-input-El7Szeln.js";import{n as Ct,t as wt}from"./settings-page-header-19GJ_a45.js";import"./settings-page-layout-B2WCzSel.js";import{n as Tt,t as Et}from"./settings-form-section-num14vSv.js";import{n as Dt,t as Ot}from"./use-autosave-BtOp6W9H.js";import{c as kt,h as At,l as jt,n as Mt,o as Nt,t as Pt}from"./voice-config-api-CrZd2aqw.js";import{a as Ft,i as It,n as Lt,o as Rt,r as zt,s as Bt,t as Vt}from"./image-generation-api-CAKYslID.js";import{t as Ht}from"./xopc-cloud-account-card-Rytp_NWV.js";var Ut=n(),Q=e(t(),1),$=r(),Wt={en:{addTitle:`Add image service`,editTitle:`Manage image service`,intro:`Connect an endpoint that implements the OpenAI Images protocol.`,connection:`Connection`,providerId:`Provider ID`,providerIdHint:`Lowercase letters, numbers, hyphens, or underscores.`,name:`Display name`,baseUrl:`Base URL`,auth:`Authentication`,bearer:`Bearer token`,header:`Custom API key header`,none:`No authentication`,headerName:`Header name`,apiKey:`API key`,apiKeyHint:`Stored in the local credential store, separate from models.json.`,apiKeyUrl:`API key page (optional)`,docsUrl:`Documentation page (optional)`,openKeyPage:`Create API key`,paths:`Protocol and network`,generationsPath:`Generations path`,editsPath:`Edits path`,allowedHosts:`Allowed private hosts (optional)`,allowedHostsHint:`One exact hostname or IP per line. Private endpoints stay blocked unless listed here.`,staticHeaders:`Static headers (optional)`,staticHeadersHint:`One per line: X-Tenant: value. Credential headers are rejected.`,models:`Image models`,addModel:`Add model`,modelId:`Model ID`,modelName:`Name (optional)`,defaultModel:`Default model`,maxCount:`Max images`,defaultCount:`Default count`,defaultSize:`Default size`,format:`Output format`,supportsSize:`Supports size`,edit:`Supports edits`,remove:`Remove`,cancel:`Cancel`,save:`Save service`,saving:`Saving…`,test:`Test generation`,testing:`Generating…`,delete:`Delete service`,confirmDelete:`Delete permanently`,saved:`Image service saved.`,deleted:`Image service deleted.`,testReady:`Test image generated.`,show:`Show key`,hide:`Hide key`,copy:`Copy key`,copied:`Copied`,revealFailed:`Unable to reveal the saved key.`,notRevealable:`No revealable key is stored locally.`,required:`Complete the required connection and model fields.`,duplicateModels:`Model IDs must be unique.`,invalidHeaders:`Static headers must use “Name: value”, one per line.`},zh:{addTitle:`添加图片服务`,editTitle:`管理图片服务`,intro:`连接一个严格实现 OpenAI Images 协议的服务端点。`,connection:`连接信息`,providerId:`Provider ID`,providerIdHint:`仅支持小写字母、数字、连字符和下划线。`,name:`显示名称`,baseUrl:`Base URL`,auth:`认证方式`,bearer:`Bearer Token`,header:`自定义 API Key Header`,none:`无需认证`,headerName:`Header 名称`,apiKey:`API Key`,apiKeyHint:`密钥单独保存在本机凭据存储,不写入 models.json。`,apiKeyUrl:`API Key 创建页面(可选)`,docsUrl:`协议文档页面(可选)`,openKeyPage:`去创建 API Key`,paths:`协议与网络`,generationsPath:`生成路径`,editsPath:`编辑路径`,allowedHosts:`允许访问的私有主机(可选)`,allowedHostsHint:`每行一个精确主机名或 IP;未列出的私网端点保持阻止。`,staticHeaders:`静态 Headers(可选)`,staticHeadersHint:`每行一个:X-Tenant: value。认证 Header 会被拒绝。`,models:`图片模型`,addModel:`添加模型`,modelId:`模型 ID`,modelName:`名称(可选)`,defaultModel:`默认模型`,maxCount:`单次最大张数`,defaultCount:`默认张数`,defaultSize:`默认尺寸`,format:`输出格式`,supportsSize:`支持尺寸参数`,edit:`支持图片编辑`,remove:`移除`,cancel:`取消`,save:`保存服务`,saving:`保存中…`,test:`测试生成`,testing:`生成中…`,delete:`删除服务`,confirmDelete:`确认永久删除`,saved:`图片服务已保存。`,deleted:`图片服务已删除。`,testReady:`测试图片生成成功。`,show:`显示密钥`,hide:`隐藏密钥`,copy:`复制密钥`,copied:`已复制`,revealFailed:`无法查看已保存的密钥。`,notRevealable:`本机没有可查看的密钥。`,required:`请补全必填的连接和模型信息。`,duplicateModels:`模型 ID 不能重复。`,invalidHeaders:`静态 Header 必须使用“名称: 值”格式,每行一个。`}},Gt=`mt-1.5 h-10 w-full rounded-lg border border-edge bg-surface-panel px-3 text-sm text-fg outline-none focus:border-accent focus:ring-2 focus:ring-accent/20`;function Kt(e){let t=e??{id:``,capabilities:{generate:{maxCount:1,supportsSize:!0},edit:{enabled:!1}}};return{original:t,id:t.id,name:t.name??``,maxCount:String(t.capabilities.generate?.maxCount??1),defaultCount:t.defaults?.count?String(t.defaults.count):``,defaultSize:t.defaults?.size??``,outputFormat:t.defaults?.outputFormat??``,supportsSize:t.capabilities.generate?.supportsSize??!1,editEnabled:t.capabilities.edit?.enabled??!1}}function qt(e){let t=e.split(`
3
- `).map(e=>e.trim()).filter(Boolean);if(t.length===0)return;let n=t.map(e=>{let t=e.indexOf(`:`);if(t<=0||!e.slice(t+1).trim())throw Error(`invalid_headers`);return[e.slice(0,t).trim(),e.slice(t+1).trim()]});return Object.fromEntries(n)}function Jt({open:e,onOpenChange:t,provider:n,configured:r,language:i,onSaved:a,portalContainer:o,onPendingChange:s}){let c=Wt[i],[l,u]=(0,Q.useState)(``),[d,f]=(0,Q.useState)(``),[p,m]=(0,Q.useState)(``),[h,C]=(0,Q.useState)(`bearer`),[T,E]=(0,Q.useState)(`x-api-key`),[D,k]=(0,Q.useState)(``),[A,j]=(0,Q.useState)(``),[M,ee]=(0,Q.useState)(``),[N,P]=(0,Q.useState)(`/images/generations`),[F,I]=(0,Q.useState)(`/images/edits`),[L,R]=(0,Q.useState)(``),[z,B]=(0,Q.useState)(``),[te,ne]=(0,Q.useState)([Kt()]),[V,re]=(0,Q.useState)(``),[H,U]=(0,Q.useState)(),[ie,W]=(0,Q.useState)(!1),[ae,G]=(0,Q.useState)(),[oe,K]=(0,Q.useState)(),[se,le]=(0,Q.useState)();(0,Q.useEffect)(()=>(s?.(!!H),()=>s?.(!1)),[H,s]),(0,Q.useEffect)(()=>{if(!e)return;let t=n?.imageGeneration;u(n?.providerId??``),f(t?.name??``),m(n?.baseUrl??``),C(t?.auth.type??`bearer`),E(t?.auth.type===`header`?t.auth.headerName:`x-api-key`),k(r?`••••••••••••`:``),j(t?.apiKeyUrl??``),ee(t?.documentationUrl??``),P(t?.paths?.generations??`/images/generations`),I(t?.paths?.edits??`/images/edits`),R(t?.network?.allowedHosts.join(`
4
- `)??``),B(Object.entries(n?.headers??{}).map(([e,t])=>`${e}: ${t}`).join(`
5
- `)),ne(t?.models.map(Kt)??[Kt()]),re(t?.defaultModel??``),K(void 0),U(void 0),W(!1),G(void 0),le(void 0)},[r,e,n]);let ue=(0,Q.useMemo)(()=>te.filter(e=>e.id.trim()).sort(qe).map(e=>({value:e.id.trim(),label:e.name.trim()||e.id.trim()})),[te]),J=(e,t)=>{ne(n=>n.map((n,r)=>r===e?{...n,...t}:n))},fe=()=>{let e=l.trim(),t=te.map(e=>({...e,id:e.id.trim(),name:e.name.trim()}));if(!e||!d.trim()||!p.trim()||t.some(e=>!e.id))throw Error(c.required);if(new Set(t.map(e=>e.id)).size!==t.length)throw Error(c.duplicateModels);let n=V||t[0]?.id;if(!n||!t.some(e=>e.id===n))throw Error(c.required);let r;try{r=qt(z)}catch{throw Error(c.invalidHeaders)}return{providerId:e,input:{baseUrl:p.trim(),...r?{headers:r}:{},imageGeneration:{api:`openai-images`,name:d.trim(),...M.trim()?{documentationUrl:M.trim()}:{},...A.trim()?{apiKeyUrl:A.trim()}:{},defaultModel:n,auth:h===`header`?{type:`header`,headerName:T.trim()}:{type:h},paths:{...N.trim()?{generations:N.trim()}:{},...F.trim()?{edits:F.trim()}:{}},...L.trim()?{network:{allowedHosts:L.split(`
6
- `).map(e=>e.trim()).filter(Boolean)}}:{},models:t.map(e=>({...e.original,id:e.id,...e.name?{name:e.name}:{name:void 0},capabilities:{...e.original.capabilities,generate:{...e.original.capabilities.generate,maxCount:Math.max(1,Number.parseInt(e.maxCount,10)||1),supportsSize:e.supportsSize},edit:{...e.original.capabilities.edit,enabled:e.editEnabled}},defaults:{...e.original.defaults,...e.defaultCount?{count:Math.max(1,Number.parseInt(e.defaultCount,10)||1)}:{count:void 0},...e.defaultSize.trim()?{size:e.defaultSize.trim()}:{size:void 0},...e.outputFormat?{outputFormat:e.outputFormat}:{outputFormat:void 0}}}))}}}},me=async()=>{let e=fe();return await It(e.providerId,e.input),h!==`none`&&D.trim()&&!Re(D)&&await Ft(e.providerId,D.trim()),await a(e.providerId),e},he=async()=>{U(`save`),G(void 0),K(void 0);try{await me(),k(h===`none`?``:`••••••••••••`),K(c.saved)}catch(e){G(e instanceof Error?e.message:String(e))}finally{U(void 0)}},ge=async()=>{U(`test`),G(void 0),K(void 0),le(void 0);try{let e=await me(),t=await Rt(e.providerId,e.input.imageGeneration.defaultModel);le(t.images[0]?.dataUrl),K(c.testReady)}catch(e){G(e instanceof Error?e.message:String(e))}finally{U(void 0)}},_e=async()=>{if(n){if(!ie){W(!0);return}U(`delete`),G(void 0);try{await Vt(n.providerId),await a(),t(!1)}catch(e){G(e instanceof Error?e.message:String(e))}finally{U(void 0)}}};return(0,$.jsx)(S,{open:e,onOpenChange:e=>{H||t(e)},children:(0,$.jsxs)(y,{container:o,children:[(0,$.jsx)(g,{className:Y(`xopc-dialog-overlay fixed inset-0 bg-scrim`,ke)}),(0,$.jsxs)(b,{className:Y(`xopc-dialog-content fixed left-1/2 top-1/2 flex h-[min(88vh,760px)] w-[min(calc(100%-2rem),52rem)] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-overlay shadow-popover`,Oe),onOpenAutoFocus:e=>e.preventDefault(),children:[(0,$.jsxs)(`header`,{className:`flex shrink-0 items-start justify-between gap-4 border-b border-edge px-5 py-4`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(x,{className:`font-semibold text-fg`,children:n?c.editTitle:c.addTitle}),(0,$.jsx)(_,{className:`mt-1 text-sm text-fg-muted`,children:c.intro})]}),(0,$.jsx)(v,{asChild:!0,children:(0,$.jsx)(`button`,{type:`button`,disabled:!!H,className:`rounded-md p-1 text-fg-muted hover:bg-surface-inset hover:text-fg`,"aria-label":c.cancel,children:(0,$.jsx)(xe,{className:`size-5`})})})]}),(0,$.jsxs)(`fieldset`,{disabled:!!H,className:`min-h-0 min-w-0 flex-1 space-y-6 overflow-y-auto px-5 py-4`,children:[(0,$.jsxs)(`section`,{className:`space-y-4`,children:[(0,$.jsx)(`h3`,{className:`text-xs font-semibold uppercase tracking-wide text-fg-subtle`,children:c.connection}),(0,$.jsxs)(`div`,{className:`grid gap-4 md:grid-cols-2`,children:[(0,$.jsxs)(`label`,{className:`text-xs font-medium text-fg-muted`,children:[c.providerId,(0,$.jsx)(`input`,{value:l,disabled:!!n,onChange:e=>u(e.target.value),placeholder:`my-image-service`,className:Gt}),(0,$.jsx)(`span`,{className:`mt-1 block font-normal text-fg-subtle`,children:c.providerIdHint})]}),(0,$.jsxs)(`label`,{className:`text-xs font-medium text-fg-muted`,children:[c.name,(0,$.jsx)(`input`,{value:d,onChange:e=>f(e.target.value),placeholder:`My Image Service`,className:Gt})]})]}),(0,$.jsxs)(`label`,{className:`block text-xs font-medium text-fg-muted`,children:[c.baseUrl,(0,$.jsx)(`input`,{value:p,onChange:e=>m(e.target.value),placeholder:`https://api.example.com/v1`,className:Gt})]}),(0,$.jsxs)(`div`,{className:`grid gap-4 md:grid-cols-2`,children:[(0,$.jsxs)(`label`,{className:`text-xs font-medium text-fg-muted`,children:[c.auth,(0,$.jsx)(O,{value:h,options:[{value:`bearer`,label:c.bearer},{value:`header`,label:c.header},{value:`none`,label:c.none}],placeholder:c.auth,allowEmpty:!1,onChange:e=>C(e),triggerClassName:`mt-1.5`})]}),h===`header`?(0,$.jsxs)(`label`,{className:`text-xs font-medium text-fg-muted`,children:[c.headerName,(0,$.jsx)(`input`,{value:T,onChange:e=>E(e.target.value),className:Gt})]}):null]}),h===`none`?null:(0,$.jsxs)(`div`,{children:[(0,$.jsxs)(`div`,{className:`mb-1.5 flex items-center justify-between`,children:[(0,$.jsx)(`label`,{htmlFor:`custom-image-api-key`,className:`text-xs font-medium text-fg-muted`,children:c.apiKey}),A.trim()?(0,$.jsxs)(`a`,{href:A.trim(),target:`_blank`,rel:`noreferrer`,className:`inline-flex items-center gap-1 text-xs text-accent hover:underline`,children:[c.openKeyPage,(0,$.jsx)(w,{className:`size-3.5`})]}):null]}),(0,$.jsx)(q,{id:`custom-image-api-key`,value:D,onChange:e=>k(Re(D)?e.replace(/^•+/,``):e),labels:{show:c.show,hide:c.hide,copy:c.copy,copied:c.copied},reveal:()=>ut(l).then(e=>e.apiKey),loadFailedLabel:c.revealFailed,notInConfigFile:c.notRevealable}),(0,$.jsx)(`p`,{className:`mt-1 text-xs text-fg-subtle`,children:c.apiKeyHint})]}),(0,$.jsxs)(`div`,{className:`grid gap-4 md:grid-cols-2`,children:[(0,$.jsxs)(`label`,{className:`text-xs font-medium text-fg-muted`,children:[c.apiKeyUrl,(0,$.jsx)(`input`,{value:A,onChange:e=>j(e.target.value),placeholder:`https://…`,className:Gt})]}),(0,$.jsxs)(`label`,{className:`text-xs font-medium text-fg-muted`,children:[c.docsUrl,(0,$.jsx)(`input`,{value:M,onChange:e=>ee(e.target.value),placeholder:`https://…`,className:Gt})]})]}),(0,$.jsxs)(`details`,{className:`rounded-lg border border-edge bg-surface-inset px-3 py-2.5`,children:[(0,$.jsx)(`summary`,{className:`cursor-pointer text-sm font-medium text-fg-muted`,children:c.paths}),(0,$.jsxs)(`div`,{className:`mt-3 grid gap-4 md:grid-cols-2`,children:[(0,$.jsxs)(`label`,{className:`text-xs font-medium text-fg-muted`,children:[c.generationsPath,(0,$.jsx)(`input`,{value:N,onChange:e=>P(e.target.value),className:Gt})]}),(0,$.jsxs)(`label`,{className:`text-xs font-medium text-fg-muted`,children:[c.editsPath,(0,$.jsx)(`input`,{value:F,onChange:e=>I(e.target.value),className:Gt})]})]}),(0,$.jsxs)(`label`,{className:`mt-4 block text-xs font-medium text-fg-muted`,children:[c.allowedHosts,(0,$.jsx)(`textarea`,{value:L,onChange:e=>R(e.target.value),rows:2,placeholder:`127.0.0.1
7
- image-server.lan`,className:`mt-1.5 w-full rounded-lg border border-edge bg-surface-panel px-3 py-2 font-mono text-xs text-fg outline-none focus:border-accent focus:ring-2 focus:ring-accent/20`}),(0,$.jsx)(`span`,{className:`mt-1 block font-normal text-fg-subtle`,children:c.allowedHostsHint})]}),(0,$.jsxs)(`label`,{className:`mt-4 block text-xs font-medium text-fg-muted`,children:[c.staticHeaders,(0,$.jsx)(`textarea`,{value:z,onChange:e=>B(e.target.value),rows:3,className:`mt-1.5 w-full rounded-lg border border-edge bg-surface-panel px-3 py-2 font-mono text-xs text-fg outline-none focus:border-accent focus:ring-2 focus:ring-accent/20`}),(0,$.jsx)(`span`,{className:`mt-1 block font-normal text-fg-subtle`,children:c.staticHeadersHint})]})]})]}),(0,$.jsxs)(`section`,{className:`space-y-3`,children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,$.jsx)(`h3`,{className:`text-xs font-semibold uppercase tracking-wide text-fg-subtle`,children:c.models}),(0,$.jsxs)(Z,{variant:`secondary`,className:`px-2.5 py-1.5 text-xs`,onClick:()=>ne(e=>[...e,Kt()]),children:[(0,$.jsx)(pe,{className:`size-4`}),c.addModel]})]}),(0,$.jsxs)(`label`,{className:`block text-xs font-medium text-fg-muted`,children:[c.defaultModel,(0,$.jsx)(O,{value:V||te.find(e=>e.id.trim())?.id.trim()||``,options:ue,placeholder:c.defaultModel,allowEmpty:!1,onChange:re,triggerClassName:`mt-1.5 max-w-sm`})]}),te.map((e,t)=>(0,$.jsxs)(`div`,{className:`rounded-lg border border-edge bg-surface-base p-3`,children:[(0,$.jsxs)(`div`,{className:`grid gap-3 md:grid-cols-2`,children:[(0,$.jsxs)(`label`,{className:`text-xs font-medium text-fg-muted`,children:[c.modelId,(0,$.jsx)(`input`,{value:e.id,onChange:e=>J(t,{id:e.target.value}),placeholder:`image-1`,className:Gt})]}),(0,$.jsxs)(`label`,{className:`text-xs font-medium text-fg-muted`,children:[c.modelName,(0,$.jsx)(`input`,{value:e.name,onChange:e=>J(t,{name:e.target.value}),className:Gt})]})]}),(0,$.jsxs)(`div`,{className:`mt-3 grid gap-3 sm:grid-cols-2 lg:grid-cols-4`,children:[(0,$.jsxs)(`label`,{className:`text-xs font-medium text-fg-muted`,children:[c.maxCount,(0,$.jsx)(`input`,{type:`number`,min:1,value:e.maxCount,onChange:e=>J(t,{maxCount:e.target.value}),className:Gt})]}),(0,$.jsxs)(`label`,{className:`text-xs font-medium text-fg-muted`,children:[c.defaultCount,(0,$.jsx)(`input`,{type:`number`,min:1,value:e.defaultCount,onChange:e=>J(t,{defaultCount:e.target.value}),className:Gt})]}),(0,$.jsxs)(`label`,{className:`text-xs font-medium text-fg-muted`,children:[c.defaultSize,(0,$.jsx)(`input`,{value:e.defaultSize,onChange:e=>J(t,{defaultSize:e.target.value}),placeholder:`1024x1024`,className:Gt})]}),(0,$.jsxs)(`label`,{className:`text-xs font-medium text-fg-muted`,children:[c.format,(0,$.jsx)(O,{value:e.outputFormat,options:[{value:`png`,label:`PNG`},{value:`jpeg`,label:`JPEG`},{value:`webp`,label:`WebP`}],placeholder:c.format,allowEmpty:!0,onChange:e=>J(t,{outputFormat:e}),triggerClassName:`mt-1.5`})]})]}),(0,$.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center gap-4`,children:[(0,$.jsxs)(`label`,{className:`flex items-center gap-2 text-sm text-fg-muted`,children:[(0,$.jsx)(`input`,{type:`checkbox`,checked:e.supportsSize,onChange:e=>J(t,{supportsSize:e.target.checked})}),c.supportsSize]}),(0,$.jsxs)(`label`,{className:`flex items-center gap-2 text-sm text-fg-muted`,children:[(0,$.jsx)(`input`,{type:`checkbox`,checked:e.editEnabled,onChange:e=>J(t,{editEnabled:e.target.checked})}),c.edit]}),(0,$.jsxs)(`button`,{type:`button`,disabled:te.length===1,onClick:()=>ne(e=>e.filter((e,n)=>n!==t)),className:`ml-auto inline-flex items-center gap-1 text-xs text-red-600 disabled:opacity-40 dark:text-red-400`,children:[(0,$.jsx)(ve,{className:`size-3.5`}),c.remove]})]})]},t))]}),se?(0,$.jsxs)(`section`,{className:`rounded-lg border border-edge bg-surface-base p-3`,children:[(0,$.jsxs)(`div`,{className:`mb-2 flex items-center gap-2 text-sm font-medium text-fg`,children:[(0,$.jsx)(ce,{className:`size-4`}),c.testReady]}),(0,$.jsx)(`img`,{src:se,alt:`Generated provider test`,className:`max-h-72 rounded-lg object-contain`})]}):null,oe?(0,$.jsx)(`p`,{className:`rounded-lg bg-emerald-500/10 px-3 py-2 text-sm text-emerald-700 dark:text-emerald-300`,role:`status`,children:oe}):null,ae?(0,$.jsx)(`p`,{className:`rounded-lg bg-red-500/10 px-3 py-2 text-sm text-red-600 dark:text-red-400`,children:ae}):null]}),(0,$.jsxs)(`footer`,{className:`flex shrink-0 flex-wrap items-center gap-2 border-t border-edge px-5 py-3`,children:[n?(0,$.jsxs)(Z,{variant:`secondary`,className:`border-red-500/30 text-red-600 hover:bg-red-500/10 dark:text-red-400`,disabled:!!H,onClick:()=>void _e(),children:[H===`delete`?(0,$.jsx)(de,{className:`size-4 animate-spin`}):(0,$.jsx)(ve,{className:`size-4`}),ie?c.confirmDelete:c.delete]}):null,(0,$.jsxs)(`div`,{className:`ml-auto flex gap-2`,children:[(0,$.jsx)(v,{asChild:!0,children:(0,$.jsx)(Z,{variant:`secondary`,disabled:!!H,children:c.cancel})}),(0,$.jsxs)(Z,{variant:`secondary`,disabled:!!H,onClick:()=>void ge(),children:[H===`test`?(0,$.jsx)(de,{className:`size-4 animate-spin`}):null,H===`test`?c.testing:c.test]}),(0,$.jsxs)(Z,{variant:`primary`,disabled:!!H,onClick:()=>void he(),children:[H===`save`?(0,$.jsx)(de,{className:`size-4 animate-spin`}):null,H===`save`?c.saving:c.save]})]})]})]})]})})}var Yt=`••••••••••••`,Xt={en:{title:`Image generation`,intro:`Configure the default image model and service. Agents inherit this setting unless overridden in Agent settings.`,provider:`Provider`,model:`Model`,apiKey:`API key`,getApiKey:`Get API key`,apiKeyHint:`Stored in the local credential store, never in xopc.json.`,existingKey:`A credential or environment variable is already available. Leave this blank to reuse it.`,savedKey:`A credential is saved. Use the eye button to view it, or type a new key to replace it.`,revealFailed:`Unable to load the saved API key.`,keyNotRevealable:`This credential comes from an environment variable or another non-revealable source.`,advanced:`Provider settings`,enable:`Enable image generation`,enabling:`Verifying and enabling…`,enabled:`Image generation is ready.`,addService:`Add image service`,manageService:`Manage service`,custom:`Custom`,current:`Current`,configured:`Credential ready`,needsKey:`API key required`,connect:`Connect to a gateway to continue.`,loadError:`Unable to load image generation settings.`,selectModel:`Select a model`,show:`Show key`,hide:`Hide key`,copy:`Copy key`,copied:`Copied`},zh:{title:`图片生成`,intro:`配置全局图片生成模型和服务。各智能体默认继承此设置,也可在智能体详情中单独覆盖。`,provider:`Provider`,model:`模型`,apiKey:`API Key`,getApiKey:`获取 API Key`,apiKeyHint:`密钥只保存在本机凭据存储中,不会写入 xopc.json。`,existingKey:`已有凭据或环境变量;留空即可继续使用。`,savedKey:`凭据已保存。点击眼睛可查看,直接输入新密钥可替换。`,revealFailed:`无法读取已保存的 API Key。`,keyNotRevealable:`当前凭据来自环境变量或其他不可查看的来源。`,advanced:`服务商设置`,enable:`启用图片生成`,enabling:`正在验证并启用…`,enabled:`图片生成已可用。`,addService:`添加图片服务`,manageService:`管理服务`,custom:`自定义`,current:`当前使用`,configured:`凭据已就绪`,needsKey:`需要 API Key`,connect:`请先连接网关。`,loadError:`无法加载图片生成设置。`,selectModel:`选择模型`,show:`显示密钥`,hide:`隐藏密钥`,copy:`复制密钥`,copied:`已复制`}};async function Zt(){let e=await m(d(`/api/image-generation/default`));if(!e.payload)throw Error(`Invalid default image generation response`);return e.payload}function Qt(e){let t=e?.indexOf(`/`)??-1;return t>0?e.slice(0,t):void 0}function $t(e){let t=e?.indexOf(`/`)??-1;return t>0?e.slice(t+1):void 0}function en(e){return Object.fromEntries(e.configFields.map(t=>[t.key,e.config[t.key]??(t.required?t.options?.[0]?.value??``:``)]))}function tn(e){let t=(0,Ut.c)(11),{field:n,value:r,onChange:i}=e,a;t[0]!==n.label||t[1]!==n.options||t[2]!==n.placeholder||t[3]!==n.required||t[4]!==n.type||t[5]!==i||t[6]!==r?(a=n.type===`select`?(0,$.jsx)(O,{value:r,options:(n.options??[]).map(nn),placeholder:n.placeholder??n.label,allowEmpty:!n.required,onChange:i,triggerClassName:`mt-1.5`}):(0,$.jsx)(`input`,{type:`url`,value:r,required:n.required,onChange:e=>i(e.target.value),placeholder:n.placeholder,className:`mt-1.5 h-10 w-full rounded-lg border border-edge bg-surface-panel px-3 text-sm text-fg outline-none focus:border-accent focus:ring-2 focus:ring-accent/20`}),t[0]=n.label,t[1]=n.options,t[2]=n.placeholder,t[3]=n.required,t[4]=n.type,t[5]=i,t[6]=r,t[7]=a):a=t[7];let o;return t[8]!==n.label||t[9]!==a?(o=(0,$.jsxs)(`label`,{className:`block text-xs font-medium text-fg-muted`,children:[n.label,a]}),t[8]=n.label,t[9]=a,t[10]=o):o=t[10],o}function nn(e){return{value:e.value,label:e.label}}function rn(){let e=(0,Ut.c)(2),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,$.jsx)(Se,{className:`h-24 rounded-xl`}),e[0]=t):t=e[0];let n;return e[1]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,$.jsxs)(`div`,{className:`grid gap-4`,"aria-hidden":`true`,children:[t,(0,$.jsx)(`div`,{className:`grid gap-3 sm:grid-cols-2 xl:grid-cols-3`,children:Array.from({length:5}).map(an)}),(0,$.jsx)(Se,{className:`h-64 rounded-xl`})]}),e[1]=n):n=e[1],n}function an(e,t){return(0,$.jsx)(Se,{className:`h-24 rounded-xl`},t)}function on({connectOnly:e=!1,onConnected:t,onPendingChange:n}={}){let r=p(e=>e.language),a=Xt[r],o=!!f(e=>e.conversationId),[s,c]=(0,Q.useState)(``),[l,u]=(0,Q.useState)(``),[h,g]=(0,Q.useState)(``),[_,v]=(0,Q.useState)({}),[y,b]=(0,Q.useState)(!1),[x,S]=(0,Q.useState)(!1),[C,T]=(0,Q.useState)(null);(0,Q.useEffect)(()=>(n?.(y||x),()=>n?.(!1)),[y,x,n]);let[E,D]=(0,Q.useState)(),[A,j]=(0,Q.useState)(!1),[ee,N]=(0,Q.useState)(!1),[P,F]=(0,Q.useState)(),{data:I,isLoading:L,error:R,mutate:z}=X(o?d(`/api/image-generation/catalog`):null,zt,{revalidateOnFocus:!1}),{data:B,isLoading:te,error:ne,mutate:V}=X(o?d(`/api/image-generation/custom-providers`):null,Lt,{revalidateOnFocus:!1}),{data:re,isLoading:H,error:U,mutate:ie}=X(o?`default-image-generation`:null,Zt,{revalidateOnFocus:!1});(0,Q.useEffect)(()=>{if(!I||!re)return;let e=Qt(re.model?.primary),t=I.find(t=>t.id===e)??I.find(e=>e.configured)??I[0];t&&(c(t.id),u(t.id===e&&$t(re.model?.primary)||t.defaultModel),g(t.configured?Yt:``),v(en(t)))},[re,I]);let W=I?.find(e=>e.id===s),ae=W?W.apiKeyUrl??M(W.id,r)[0]?.href:void 0,G=(0,Q.useMemo)(()=>[...W?.models??[]].sort(Je).map(e=>({value:e,label:e})),[W?.models]),oe=re?.model?.primary,K=!!(W&&l&&(W.credentialMode!==`api-key`||W.configured||h.trim())&&W.configFields.every(e=>!e.required||_[e.key]?.trim()));if(!o)return(0,$.jsx)(`p`,{className:`text-sm text-fg-muted`,children:a.connect});if(L||te||H)return(0,$.jsx)(rn,{});if(R||ne||U||!I||!B)return(0,$.jsx)(`p`,{className:`text-sm text-red-600 dark:text-red-400`,children:a.loadError});let se=e=>{c(e.id),u(e.defaultModel),g(e.configured?Yt:``),v(en(e)),D(void 0)},ce=()=>{F(void 0),N(!0)},J=()=>{let e=B.find(e=>e.providerId===W?.id);e&&(F(e),N(!0))},fe=async n=>{let[r,i]=await Promise.all([V(),z()]);if(n&&i?.some(e=>e.id===n)){let a=i.find(e=>e.id===n);c(a.id),u(a.defaultModel),g(a.configured?Yt:``),v(en(a)),F(r?.find(e=>e.providerId===n)),e&&a.configured&&t?.()}},me=async()=>{if(!(!W||!K)){b(!0),D(void 0),j(!1);try{if(e){h.trim()&&!Re(h)&&await Ft(W.id,h.trim()),Object.keys(_).length&&await m(d(`/api/config`),{method:`PATCH`,body:JSON.stringify({providersConfig:{[W.id]:_}})});let[e]=await Promise.all([z(),we()]);if(!e?.find(e=>e.id===W.id)?.configured)throw Error(r===`zh`?`连接尚未就绪,请先完成对应服务的授权或凭据设置。`:`Connection is not ready. Complete authorization or credentials first.`);j(!0),t?.();return}let n=await m(d(`/api/image-generation/default/setup`),{method:`POST`,body:JSON.stringify({providerId:W.id,modelId:l,...h.trim()&&!Re(h)?{apiKey:h.trim()}:{},providerConfig:Object.fromEntries(Object.entries(_).filter(([,e])=>e.trim()))})});if(!n.payload)throw Error(`Invalid setup response`);await Promise.all([ie(n.payload.default,{revalidate:!1}),z(n.payload.providers,{revalidate:!1}),i(async()=>{let{mutate:e}=await import(`./vendor-swr-CdRzEUwF.js`).then(e=>e.r);return{mutate:e}},__vite__mapDeps([0,1,2])).then(({mutate:e})=>Promise.all([e(`settings-agent-defaults`),e(`settings-gateway-agents`)])),we()]),g(Yt),j(!0)}catch(e){D(e instanceof Error?e.message:String(e))}finally{b(!1)}}};return(0,$.jsxs)(`div`,{ref:T,className:`flex flex-col gap-4`,children:[(0,$.jsx)(`section`,{className:`rounded-xl bg-surface-hover/20 p-4`,children:(0,$.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,$.jsx)(`div`,{className:`rounded-lg bg-accent/10 p-2 text-accent`,children:(0,$.jsx)(le,{className:`size-5`})}),(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,$.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:a.title}),(0,$.jsx)(`p`,{className:`mt-1 text-sm leading-relaxed text-fg-muted`,children:e?r===`zh`?`连接图片来源,不修改默认模型,也不发送生成测试请求。`:`Connect image sources without changing defaults or sending generation tests.`:a.intro})]})]})}),(0,$.jsxs)(`section`,{children:[(0,$.jsxs)(`div`,{className:`mb-2 flex items-center justify-between gap-3`,children:[(0,$.jsx)(`h3`,{className:`text-xs font-semibold uppercase tracking-wide text-fg-subtle`,children:a.provider}),(0,$.jsxs)(Z,{variant:`secondary`,className:`px-2.5 py-1.5 text-xs`,onClick:ce,children:[(0,$.jsx)(pe,{className:`size-4`}),a.addService]})]}),(0,$.jsx)(`div`,{className:`grid gap-3 sm:grid-cols-2 xl:grid-cols-3`,children:I.map(e=>{let t=e.id===s,n=e.id===Qt(oe);return(0,$.jsxs)(`button`,{type:`button`,onClick:()=>se(e),className:`min-h-24 rounded-xl p-4 text-left transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent ${t?`bg-accent-soft shadow-surface`:`bg-surface-base/55 hover:bg-surface-hover`}`,children:[(0,$.jsxs)(`span`,{className:`flex items-center justify-between gap-2`,children:[(0,$.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,$.jsx)(`span`,{className:`truncate font-medium text-fg`,children:e.label}),e.source===`custom`?(0,$.jsx)(`span`,{className:`rounded-full bg-surface-inset px-2 py-0.5 text-[10px] text-fg-subtle`,children:a.custom}):null]}),(0,$.jsx)(`span`,{"aria-hidden":!n,className:`shrink-0 rounded-full bg-accent/10 px-2 py-0.5 text-[11px] font-medium text-accent ${n?``:`invisible`}`,children:a.current})]}),(0,$.jsxs)(`span`,{className:`mt-2 flex items-center gap-1.5 text-xs ${e.configured?`text-emerald-600 dark:text-emerald-400`:`text-fg-muted`}`,children:[e.configured||e.credentialMode!==`api-key`?(0,$.jsx)(k,{className:`size-3.5`}):(0,$.jsx)(ue,{className:`size-3.5`}),e.configured||e.credentialMode!==`api-key`?a.configured:a.needsKey]})]},e.id)})})]}),W?(0,$.jsxs)(`section`,{className:`rounded-xl bg-surface-hover/20 p-4`,children:[(0,$.jsxs)(`div`,{className:`grid gap-4 md:grid-cols-2`,children:[e?null:(0,$.jsxs)(`label`,{className:`block text-xs font-medium text-fg-muted`,children:[a.model,(0,$.jsx)(O,{value:l,options:G,placeholder:a.selectModel,allowEmpty:!1,onChange:u,triggerClassName:`mt-1.5`})]}),W.configFields.filter(e=>e.required).map(e=>(0,$.jsx)(tn,{field:e,value:_[e.key]??``,onChange:t=>v(n=>({...n,[e.key]:t}))},e.key))]}),W.source===`custom`?(0,$.jsx)(`div`,{className:`mt-4 flex justify-end`,children:(0,$.jsxs)(Z,{variant:`secondary`,onClick:J,children:[(0,$.jsx)(he,{className:`size-4`}),a.manageService]})}):null,W.credentialMode===`api-key`?(0,$.jsxs)(`div`,{className:`mt-4`,children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,$.jsx)(`label`,{htmlFor:`image-generation-api-key`,className:`text-xs font-medium text-fg-muted`,children:a.apiKey}),ae?(0,$.jsxs)(`a`,{href:ae,target:`_blank`,rel:`noreferrer`,className:`inline-flex items-center gap-1 text-xs font-medium text-accent hover:underline`,children:[a.getApiKey,(0,$.jsx)(w,{className:`size-3.5`,"aria-hidden":`true`})]}):null]}),(0,$.jsx)(q,{id:`image-generation-api-key`,value:h,onChange:e=>g(Re(h)?e.replace(/^•+/,``):e),placeholder:W.configured?a.existingKey:a.needsKey,labels:{show:a.show,hide:a.hide,copy:a.copy,copied:a.copied},reveal:()=>ut(W.id).then(e=>e.apiKey),loadFailedLabel:a.revealFailed,notInConfigFile:a.keyNotRevealable,className:`mt-1.5`,autoComplete:`new-password`},W.id),(0,$.jsx)(`span`,{className:`mt-1.5 block font-normal leading-relaxed text-fg-subtle`,children:W.configured?a.savedKey:a.apiKeyHint})]}):null,W.configFields.some(e=>!e.required)?(0,$.jsxs)(`details`,{className:`mt-4 rounded-lg bg-surface-base/55 px-3 py-2.5`,children:[(0,$.jsxs)(`summary`,{className:`flex cursor-pointer list-none items-center gap-2 text-sm font-medium text-fg-muted`,children:[(0,$.jsx)(_e,{className:`size-4`}),a.advanced]}),(0,$.jsx)(`div`,{className:`mt-3 grid gap-3 md:grid-cols-2`,children:W.configFields.filter(e=>!e.required).map(e=>(0,$.jsx)(tn,{field:e,value:_[e.key]??``,onChange:t=>v(n=>({...n,[e.key]:t}))},e.key))})]}):null,A?(0,$.jsx)(`p`,{className:`mt-4 rounded-lg bg-emerald-500/10 px-3 py-2 text-sm text-emerald-700 dark:text-emerald-300`,role:`status`,children:e?r===`zh`?`连接已保存`:`Connection saved`:a.enabled}):null,E?(0,$.jsx)(`p`,{className:`mt-4 rounded-lg bg-red-500/10 px-3 py-2 text-sm text-red-600 dark:text-red-400`,children:E}):null,(0,$.jsx)(`div`,{className:`mt-4 flex justify-end`,children:(0,$.jsxs)(Z,{variant:`primary`,disabled:!K||y,onClick:()=>void me(),children:[y?(0,$.jsx)(de,{className:`size-4 animate-spin`}):(0,$.jsx)(k,{className:`size-4`}),(0,$.jsxs)(`span`,{className:`grid`,children:[(0,$.jsx)(`span`,{"aria-hidden":!0,className:`invisible col-start-1 row-start-1`,children:a.enable}),(0,$.jsx)(`span`,{"aria-hidden":!0,className:`invisible col-start-1 row-start-1`,children:a.enabling}),(0,$.jsx)(`span`,{className:`col-start-1 row-start-1`,children:e?y?r===`zh`?`保存中…`:`Saving…`:r===`zh`?`保存图片连接`:`Save image connection`:y?a.enabling:a.enable})]})]})})]}):null,(0,$.jsx)(Jt,{portalContainer:C?.closest(`[role="dialog"]`),onPendingChange:S,open:ee,onOpenChange:N,provider:P,configured:!!(P&&I.find(e=>e.id===P.providerId)?.configured),language:r,onSaved:fe})]})}function sn(e){return e.some(e=>e.disabled?!1:e.type===`searxng`?e.url.trim().length>0:e.apiKey.trim().length>0)}function cn(e){let t=e&&typeof e==`object`&&`tools`in e?e.tools:void 0,n=t&&typeof t==`object`&&`web`in t?t.web:void 0,r=n&&typeof n==`object`&&`region`in n?n.region:void 0,i=r===`cn`||r===`global`?r:`auto`,a=n&&typeof n==`object`&&`search`in n?n.search:void 0,o=a&&typeof a==`object`?a:{},s=typeof o.maxResults==`number`&&Number.isFinite(o.maxResults)?Math.floor(o.maxResults):5,c=n&&typeof n==`object`&&`blocklist`in n?n.blocklist:void 0,l=c&&typeof c==`object`?c:{},u=Array.isArray(l.domains)?l.domains.filter(e=>typeof e==`string`&&e.trim().length>0):[],d=o.providers;return{regionMode:i,maxResults:s,providers:Array.isArray(d)?d.map((e,t)=>{let n=e&&typeof e==`object`?e:{},r=n.type,i=r===`brave`||r===`tavily`||r===`bing`||r===`searxng`||r===`deepseek`?r:`brave`;return{clientKey:`search-provider-${t}`,type:i,apiKey:typeof n.apiKey==`string`?n.apiKey:``,url:typeof n.url==`string`?n.url:``,disabled:n.disabled===!0}}):[],blocklistEnabled:l.enabled===!0,blocklistDomains:u}}async function ln(e){let t=e.regionMode===`auto`?`auto`:e.regionMode===`cn`?`cn`:`global`,n={maxResults:e.maxResults,providers:e.providers.map(e=>{let t={type:e.type,apiKey:e.apiKey};return(e.type===`searxng`||e.type===`deepseek`)&&e.url.trim()&&(t.url=e.url.trim().replace(/\/+$/,``)),e.disabled&&(t.disabled=!0),t})};await m(d(`/api/config`),{method:`PATCH`,body:JSON.stringify({tools:{web:{region:t,search:n,blocklist:{enabled:e.blocklistEnabled,domains:e.blocklistDomains}}}})}),we()}async function un(e){let t=await m(d(`/api/tools/web/reveal-search-api-key`),{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({index:e})});if(!t.ok||!t.payload)throw Error(t.error?.message??`Reveal failed`);return t.payload}function dn(e){let t=(0,Ut.c)(8),{label:n,description:r,children:i}=e,a;t[0]===n?a=t[1]:(a=(0,$.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:n}),t[0]=n,t[1]=a);let o;t[2]===r?o=t[3]:(o=(0,$.jsx)(`p`,{className:`text-xs leading-relaxed text-fg-subtle`,children:r}),t[2]=r,t[3]=o);let s;return t[4]!==i||t[5]!==a||t[6]!==o?(s=(0,$.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[a,i,o]}),t[4]=i,t[5]=a,t[6]=o,t[7]=s):s=t[7],s}function fn(){return Y(`w-full rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg`,`placeholder:text-fg-subtle`,Le,`dark:border-edge`)}function pn(){return Y(Ie,Fe)}var mn=[`brave`,`tavily`,`bing`,`searxng`,`deepseek`];function hn(){return{clientKey:crypto.randomUUID(),type:`brave`,apiKey:``,url:``,disabled:!1}}var gn=We();function _n(){let e=h(p(e=>e.language)),t=e.webSearchSettings,n=e.logs,r=!!f(e=>e.conversationId),[i,a]=(0,Q.useReducer)(gn,{form:null,baseline:null}),o=i.form,s=i.baseline,c=(0,Q.useRef)(!1),l=(0,Q.useRef)(o);l.current=o;let u=(0,Q.useRef)(null),{data:d,error:m,isLoading:g,mutate:_}=Te(r);Ue({enabled:r,parsed:(0,Q.useMemo)(()=>d?.payload?.config===void 0?null:cn(d.payload.config),[d]),dirty:c.current,trackedParsedRef:u,dispatch:a,onResetDirty:()=>{c.current=!1}});let v=!!(r&&g&&d===void 0&&!m),y=m instanceof Error?m.message:m?String(m):null,b=(0,Q.useMemo)(()=>!o||!s?!1:JSON.stringify(o)!==JSON.stringify(s),[o,s]),x=(0,Q.useCallback)(e=>{c.current=!0,a({type:`patch`,patch:e})},[]),S=Ot({value:o,dirty:b,onSave:(0,Q.useCallback)(async e=>{try{await ln(e),a({type:`saved`,value:e}),c.current=!!(l.current&&JSON.stringify(l.current)!==JSON.stringify(e))}catch(e){throw Error(e instanceof Error?e.message:t.saveError)}},[t.saveError])});if(!r)return(0,$.jsx)(`div`,{className:`flex flex-col gap-3`,children:(0,$.jsx)(`p`,{className:`text-sm text-fg-muted`,children:t.needToken})});if(v)return(0,$.jsx)(et,{rows:3});if(!o)return(0,$.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,$.jsx)(`p`,{className:`text-sm text-fg-muted`,children:y??t.loadError}),(0,$.jsx)(Z,{type:`button`,variant:`secondary`,onClick:()=>void _(),children:n.refresh})]});let C=sn(o.providers);return(0,$.jsxs)(`div`,{className:`flex flex-col gap-5`,onBlurCapture:S.onBlurCapture,children:[S.error?(0,$.jsx)(`p`,{className:`text-sm text-red-600 dark:text-red-400`,children:S.error}):null,(0,$.jsxs)(Et,{children:[(0,$.jsx)(Tt,{icon:fe,title:t.sectionSearch,subtitle:t.sectionSearchHint,trailing:(0,$.jsx)(Dt,{status:S.status,error:S.error})}),(0,$.jsxs)(`div`,{className:`flex max-w-2xl flex-col gap-3`,children:[(0,$.jsxs)(`div`,{className:`flex items-start gap-3 rounded-lg border border-edge bg-surface-base/55 px-4 py-3`,children:[(0,$.jsx)(K,{className:`mt-0.5 size-5 shrink-0 text-accent`}),(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,$.jsx)(`span`,{className:`text-sm font-medium text-fg`,children:t.cloudProvider}),(0,$.jsx)(`span`,{className:Y(`rounded-full px-2 py-0.5 text-[11px] font-medium`,C?`bg-surface-panel text-fg-muted`:`bg-accent-soft text-accent`),children:C?t.cloudOverridden:t.cloudAutomatic})]}),(0,$.jsx)(`p`,{className:`mt-1 text-xs leading-relaxed text-fg-subtle`,children:C?t.cloudOverriddenHint:t.cloudAutomaticHint})]})]}),(0,$.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:t.providersTitle}),o.providers.map((n,r)=>(0,$.jsx)(vn,{row:n,providerIndex:r,labels:t,secretLabels:ze(e.providersSettings),onChange:e=>{let t=[...o.providers];t[r]=e,x({providers:t})},onRemove:()=>{x({providers:o.providers.filter((e,t)=>t!==r)})}},n.clientKey??r)),(0,$.jsxs)(Z,{type:`button`,variant:`secondary`,className:`w-fit gap-1.5 text-sm`,onClick:()=>x({providers:[...o.providers,hn()]}),children:[(0,$.jsx)(pe,{className:`size-4`}),t.addProvider]})]})]}),(0,$.jsxs)(Et,{children:[(0,$.jsx)(Tt,{icon:_e,title:t.sectionPreferences}),(0,$.jsxs)(`div`,{className:`grid max-w-2xl gap-4 sm:grid-cols-2`,children:[(0,$.jsx)(dn,{label:t.regionLabel,description:t.regionDesc,children:(0,$.jsxs)(E,{className:pn(),value:o.regionMode,onChange:e=>x({regionMode:e.target.value}),children:[(0,$.jsx)(D,{value:`auto`,children:t.regionAuto}),(0,$.jsx)(D,{value:`cn`,children:t.regionCn}),(0,$.jsx)(D,{value:`global`,children:t.regionGlobal})]})}),(0,$.jsx)(vt,{title:t.maxResultsLabel,summary:o.maxResults,children:(0,$.jsx)(dn,{label:t.maxResultsLabel,description:t.maxResultsDesc,children:(0,$.jsx)(St,{type:`number`,min:1,max:50,className:fn(),value:o.maxResults,onChange:e=>x({maxResults:Math.max(1,Math.min(50,Number(e.target.value)||5))})})})})]})]}),(0,$.jsxs)(`details`,{className:`rounded-xl bg-surface-hover/20 p-4`,children:[(0,$.jsxs)(`summary`,{className:`cursor-pointer text-sm font-medium text-fg`,children:[t.sectionBlocklist,` · `,o.blocklistEnabled?o.blocklistDomains.length:0]}),(0,$.jsxs)(Et,{children:[(0,$.jsx)(Tt,{icon:ge,title:t.sectionBlocklist,subtitle:t.sectionBlocklistHint}),(0,$.jsxs)(`div`,{className:`flex max-w-2xl flex-col gap-4`,children:[(0,$.jsxs)(`label`,{className:`flex cursor-pointer items-start gap-2 text-sm text-fg`,children:[(0,$.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox mt-0.5`,checked:o.blocklistEnabled,onChange:e=>x({blocklistEnabled:e.target.checked})}),(0,$.jsxs)(`span`,{children:[(0,$.jsx)(`span`,{className:`font-medium`,children:t.blocklistEnabled}),(0,$.jsx)(`span`,{className:`mt-0.5 block text-xs text-fg-subtle`,children:t.blocklistEnabledDesc})]})]}),o.blocklistEnabled?(0,$.jsx)(dn,{label:t.blocklistDomains,description:t.blocklistDomainsDesc,children:(0,$.jsx)(`textarea`,{className:Y(fn(),`min-h-[6rem] font-mono text-xs`),value:o.blocklistDomains.join(`
8
- `),placeholder:t.blocklistDomainsPlaceholder,onChange:e=>{let t=e.target.value.split(/\r?\n/).flatMap(e=>{let t=e.trim().toLowerCase();return t?[t]:[]});x({blocklistDomains:t})}})}):null]})]})]})]})}function vn(e){let t=(0,Ut.c)(56),{row:n,providerIndex:r,labels:i,secretLabels:a,onChange:o,onRemove:s}=e,c;t[0]===r?c=t[1]:(c=()=>un(r).then(yn),t[0]=r,t[1]=c);let l=c,u;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(u=Y(pn(),`min-w-[8rem]`),t[2]=u):u=t[2];let d=n.type,f;t[3]!==o||t[4]!==n?(f=e=>o({...n,type:e.target.value,url:``,apiKey:``}),t[3]=o,t[4]=n,t[5]=f):f=t[5];let p;t[6]===i.providerTypes?p=t[7]:(p=mn.map(e=>(0,$.jsx)(D,{value:e,children:i.providerTypes[e]},e)),t[6]=i.providerTypes,t[7]=p);let m;t[8]!==n.type||t[9]!==f||t[10]!==p?(m=(0,$.jsx)(E,{className:u,value:d,onChange:f,children:p}),t[8]=n.type,t[9]=f,t[10]=p,t[11]=m):m=t[11];let h;t[12]!==o||t[13]!==n?(h=e=>o({...n,disabled:e.target.checked}),t[12]=o,t[13]=n,t[14]=h):h=t[14];let g;t[15]!==n.disabled||t[16]!==h?(g=(0,$.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox`,checked:n.disabled,onChange:h}),t[15]=n.disabled,t[16]=h,t[17]=g):g=t[17];let _;t[18]!==i.disabled||t[19]!==g?(_=(0,$.jsxs)(`label`,{className:`flex cursor-pointer items-center gap-1.5 text-xs text-fg-muted`,children:[g,i.disabled]}),t[18]=i.disabled,t[19]=g,t[20]=_):_=t[20];let v;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,$.jsx)(ve,{className:`size-4`}),t[21]=v):v=t[21];let y;t[22]===s?y=t[23]:(y=(0,$.jsx)(Z,{type:`button`,variant:`ghost`,className:`h-8 px-2 text-fg-muted`,onClick:s,children:v}),t[22]=s,t[23]=y);let b;t[24]!==y||t[25]!==_?(b=(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[_,y]}),t[24]=y,t[25]=_,t[26]=b):b=t[26];let x;t[27]!==b||t[28]!==m?(x=(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[m,b]}),t[27]=b,t[28]=m,t[29]=x):x=t[29];let S;t[30]!==i.deepseekUrlDesc||t[31]!==i.deepseekUrlLabel||t[32]!==i.urlDesc||t[33]!==i.urlLabel||t[34]!==o||t[35]!==n?(S=n.type===`searxng`||n.type===`deepseek`?(0,$.jsx)(dn,{label:n.type===`deepseek`?i.deepseekUrlLabel:i.urlLabel,description:n.type===`deepseek`?i.deepseekUrlDesc:i.urlDesc,children:(0,$.jsx)(`input`,{type:`url`,className:fn(),value:n.url,placeholder:n.type===`deepseek`?`https://api.deepseek.com`:`http://localhost:8080`,onChange:e=>o({...n,url:e.target.value})})}):null,t[30]=i.deepseekUrlDesc,t[31]=i.deepseekUrlLabel,t[32]=i.urlDesc,t[33]=i.urlLabel,t[34]=o,t[35]=n,t[36]=S):S=t[36];let C;t[37]!==o||t[38]!==n?(C=e=>o({...n,apiKey:e}),t[37]=o,t[38]=n,t[39]=C):C=t[39];let w;t[40]!==i.keyPlaceholder||t[41]!==i.keyPlaceholderMasked||t[42]!==i.saveError||t[43]!==l||t[44]!==n.apiKey||t[45]!==a||t[46]!==C?(w=(0,$.jsx)(q,{value:n.apiKey,onChange:C,placeholder:i.keyPlaceholder,labels:a,reveal:l,loadFailedLabel:i.saveError,notInConfigFile:i.keyPlaceholderMasked}),t[40]=i.keyPlaceholder,t[41]=i.keyPlaceholderMasked,t[42]=i.saveError,t[43]=l,t[44]=n.apiKey,t[45]=a,t[46]=C,t[47]=w):w=t[47];let T;t[48]!==i.apiKeyDesc||t[49]!==i.apiKeyLabel||t[50]!==w?(T=(0,$.jsx)(dn,{label:i.apiKeyLabel,description:i.apiKeyDesc,children:w}),t[48]=i.apiKeyDesc,t[49]=i.apiKeyLabel,t[50]=w,t[51]=T):T=t[51];let O;return t[52]!==x||t[53]!==S||t[54]!==T?(O=(0,$.jsxs)(`div`,{className:`flex flex-col gap-3 rounded-xl bg-surface-panel/60 p-4`,children:[x,S,T]}),t[52]=x,t[53]=S,t[54]=T,t[55]=O):O=t[55],O}function yn(e){return e.apiKey??null}function bn(e,t,n=[]){return e.filter(e=>!n.includes(e.providerId)&&e.uses.some(e=>e.id===t&&e.choices.length>0))}function xn(e){let t=(0,Ut.c)(75),{use:n,data:r,language:i,labels:a,onSaved:o,inline:s,onPendingChange:c,onEditingChange:l}=e,u=s!==void 0&&s,d=i===`zh`,[f,p]=(0,Q.useState)(),[m,h]=(0,Q.useState)(!1),g;t[0]===c?g=t[1]:(g=e=>{h(e),c?.(e)},t[0]=c,t[1]=g);let _=g,v=n===`transcription`?`stt`:n===`speech`?`tts`:void 0,y,b,x;if(t[2]!==r.builtinRows||t[3]!==r.cards||t[4]!==r.customConfig?.providers||t[5]!==r.loading||t[6]!==n){let e=new Set(r.cards.filter(e=>!F(e.id)||!!r.customConfig?.providers?.[e.id]).map(An));y=[...new Set([...r.builtinRows.map(kn),...e])].filter(t=>!F(t)||e.has(t)).sort(),b=X,x=r.loading?null:[`capability-service-connections`,n,y.join(`,`)],t[2]=r.builtinRows,t[3]=r.cards,t[4]=r.customConfig?.providers,t[5]=r.loading,t[6]=n,t[7]=y,t[8]=b,t[9]=x}else y=t[7],b=t[8],x=t[9];let S;t[10]!==y||t[11]!==n||t[12]!==v?(S=async()=>{let e=v===`stt`?await kt():v===`tts`?await Nt():void 0,t=e?.providers.filter(On).map(Dn),r=e?.providers.filter(En).map(Tn)??[],i=t?y.filter(e=>t.includes(e)):y,a=await Promise.allSettled(i.map(N));return{services:bn(a.flatMap(wn),n,r),failed:a.some(Cn)}},t[10]=y,t[11]=n,t[12]=v,t[13]=S):S=t[13];let C;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(C={revalidateOnFocus:!1},t[14]=C):C=t[14];let{data:w,error:T,isLoading:E,mutate:D}=b(x,S,C),O;t[15]===w?.services?O=t[16]:(O=new Set(w?.services.map(Sn)),t[15]=w?.services,t[16]=O);let k=O,A,j;if(t[17]!==l||t[18]!==f?(A=()=>(l?.(!!f),()=>l?.(!1)),j=[f,l],t[17]=l,t[18]=f,t[19]=A,t[20]=j):(A=t[19],j=t[20]),(0,Q.useEffect)(A,j),f&&u){let e;if(t[21]!==r.builtinRows||t[22]!==f){let n;t[24]===f?n=t[25]:(n=e=>e.id===f,t[24]=f,t[25]=n),e=r.builtinRows.find(n),t[21]=r.builtinRows,t[22]=f,t[23]=e}else e=t[23];let a;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(a=()=>p(void 0),t[26]=a):a=t[26];let s;t[27]!==D||t[28]!==o?(s=()=>{D(),p(void 0),o()},t[27]=D,t[28]=o,t[29]=s):s=t[29];let c;return t[30]!==i||t[31]!==f||t[32]!==_||t[33]!==e||t[34]!==s||t[35]!==n?(c=(0,$.jsx)(`section`,{className:`overflow-hidden rounded-xl border border-edge`,children:(0,$.jsx)(ee,{inline:!0,providerId:f,row:e,targetUse:n,language:i,onPendingChange:_,onDone:a,onApplied:s},f)}),t[30]=i,t[31]=f,t[32]=_,t[33]=e,t[34]=s,t[35]=n,t[36]=c):c=t[36],c}let M=d?`选择服务`:`Choose a service`,P;t[37]===M?P=t[38]:(P=(0,$.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:M}),t[37]=M,t[38]=P);let I;t[39]!==r.loading||t[40]!==E?(I=r.loading||E?(0,$.jsx)(Se,{className:`h-24 w-full`}):null,t[39]=r.loading,t[40]=E,t[41]=I):I=t[41];let L;t[42]!==w?.failed||t[43]!==T||t[44]!==D||t[45]!==d?(L=T||w?.failed?(0,$.jsxs)(`p`,{role:`alert`,className:`text-sm text-fg-muted`,children:[d?`部分服务目录暂时不可用。`:`Some service catalogs are unavailable.`,(0,$.jsx)(Z,{variant:`ghost`,onClick:()=>void D(),children:d?`重试`:`Retry`})]}):null,t[42]=w?.failed,t[43]=T,t[44]=D,t[45]=d,t[46]=L):L=t[46];let R;t[47]===Symbol.for(`react.memo_cache_sentinel`)?(R=[!0,!1],t[47]=R):R=t[47];let z;t[48]!==m||t[49]!==w?.services||t[50]!==d?(z=R.map(e=>{let t=w?.services.filter(t=>t.configured===e)??[];return t.length?(0,$.jsxs)(`div`,{className:`space-y-2`,children:[(0,$.jsx)(`h3`,{className:`text-xs font-medium text-fg-muted`,children:e?d?`已连接`:`Connected`:d?`添加服务`:`Add a service`}),t.map(t=>(0,$.jsxs)(`button`,{type:`button`,disabled:m,onClick:()=>p(t.providerId),className:`flex min-h-14 w-full items-center justify-between gap-3 rounded-lg px-3 py-3 text-left transition-colors hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent disabled:opacity-50`,children:[(0,$.jsx)(`span`,{className:`min-w-0 text-sm font-medium text-fg`,children:U(t.providerId,t.profile.name,d)}),(0,$.jsx)(`span`,{className:`shrink-0 text-sm text-accent-fg`,children:e?d?`选择`:`Choose`:d?`连接`:`Connect`})]},t.providerId))]},String(e)):null}),t[48]=m,t[49]=w?.services,t[50]=d,t[51]=z):z=t[51];let B;t[52]!==w||t[53]!==d?(B=w&&!w.services.length&&!w.failed?(0,$.jsx)(`p`,{className:`text-sm text-fg-muted`,children:d?`暂无支持此能力的模型服务。`:`No model services currently support this capability.`}):null,t[52]=w,t[53]=d,t[54]=B):B=t[54];let te=d?`仅列出支持${nt[n][0]}的服务。`:`Only compatible services are shown. Reuse saved credentials, then return to select a model.`,ne;t[55]===te?ne=t[56]:(ne=(0,$.jsx)(`p`,{className:`text-xs text-fg-muted`,children:te}),t[55]=te,t[56]=ne);let V;t[57]!==r.builtinRows||t[58]!==r.customConfig||t[59]!==k||t[60]!==a||t[61]!==i||t[62]!==D||t[63]!==o||t[64]!==f||t[65]!==n?(V=f?(0,$.jsx)(H,{open:!0,initialProviderId:f,initialUse:n,connectOnly:!0,onOpenChange:e=>{e||p(void 0)},builtinRows:r.builtinRows.filter(e=>k.has(e.id)),customConfig:r.customConfig,labels:a,language:i,onSaved:()=>{D(),p(void 0),o()}},f):null,t[57]=r.builtinRows,t[58]=r.customConfig,t[59]=k,t[60]=a,t[61]=i,t[62]=D,t[63]=o,t[64]=f,t[65]=n,t[66]=V):V=t[66];let re;return t[67]!==P||t[68]!==I||t[69]!==L||t[70]!==z||t[71]!==B||t[72]!==ne||t[73]!==V?(re=(0,$.jsxs)(`section`,{className:`space-y-3 rounded-xl border border-edge p-4`,children:[P,I,L,z,B,ne,V]}),t[67]=P,t[68]=I,t[69]=L,t[70]=z,t[71]=B,t[72]=ne,t[73]=V,t[74]=re):re=t[74],re}function Sn(e){return e.providerId}function Cn(e){return e.status===`rejected`}function wn(e){return e.status===`fulfilled`?[e.value]:[]}function Tn(e){return e.id}function En(e){return e.diagnostics.requiresApiKey}function Dn(e){return e.id}function On(e){return!e.diagnostics.requiresApiKey}function kn(e){return e.id}function An(e){return e.id}function jn({zh:e,kind:t,modelServiceIds:n,onSaved:r,onPendingChange:i}){let{data:a,error:o,mutate:s}=X([`native-voice-connections`,t??`all`,n.join(`,`)],async()=>{let[e,r]=await Promise.all([t===`tts`?Promise.resolve({providers:[]}):kt(),t===`stt`?Promise.resolve({providers:[]}):Nt()]);return[...e.providers.map(e=>({...e,kind:`stt`})),...r.providers.map(e=>({...e,kind:`tts`}))].filter(e=>e.diagnostics.requiresApiKey||!n.includes(e.id))}),[c,l]=(0,Q.useState)(``),[u,f]=(0,Q.useState)({}),[p,h]=(0,Q.useState)(!1),g=(0,Q.useRef)(!1),[_,v]=(0,Q.useState)(``);(0,Q.useEffect)(()=>(i?.(p),()=>i?.(!1)),[p,i]);let y=a?.find(e=>`${e.kind}:${e.id}`===c),b=y?.fields.filter(e=>e.secret||e.type===`password`||[`baseUrl`,`region`,`groupId`].includes(e.key))??[],x=async()=>{if(!(!y||g.current)){g.current=!0,h(!0),v(``);try{let t=Object.fromEntries(Object.entries(u).filter(([,e])=>e.trim()).map(([e,t])=>[e,t.trim()]));Object.keys(t).length&&await m(d(`/api/config`),{method:`PATCH`,body:JSON.stringify({[y.kind]:{providers:{[y.id]:t}}})});let[n]=await Promise.all([s(),at()]);if(!n?.find(e=>e.kind===y.kind&&e.id===y.id)?.configured)throw Error(e?`连接尚未就绪,请补齐所需凭据。`:`Connection is not ready. Complete the required credentials.`);f({}),r()}catch(e){v(e instanceof Error?e.message:String(e))}finally{g.current=!1,h(!1)}}};return a&&!a.length?null:(0,$.jsxs)(`details`,{className:`rounded-xl border border-edge p-4`,children:[(0,$.jsx)(`summary`,{className:`cursor-pointer text-sm font-medium text-fg`,children:e?`其他语音服务与本地语音`:`Other voice services and local speech`}),(0,$.jsxs)(`section`,{className:`mt-4 space-y-4`,children:[(0,$.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:t===`stt`?e?`其他识别服务`:`Other recognition services`:t===`tts`?e?`其他合成服务与本地语音`:`Other synthesis services and local speech`:e?`语音 API 与本地语音`:`Voice APIs and local speech`}),!a&&!o?(0,$.jsx)(Se,{className:`h-20 w-full`}):null,o?(0,$.jsxs)(`p`,{role:`alert`,children:[e?`语音服务加载失败`:`Could not load voice services`,(0,$.jsx)(Z,{variant:`ghost`,onClick:()=>void s(),children:e?`重试`:`Retry`})]}):null,(0,$.jsxs)(E,{value:c,disabled:p,"aria-label":e?`语音服务接入`:`Connect voice service`,onChange:e=>{l(e.target.value),f({}),v(``)},children:[(0,$.jsx)(D,{value:``,children:e?`选择语音来源`:`Choose a voice source`}),a?.map(n=>(0,$.jsxs)(D,{value:`${n.kind}:${n.id}`,children:[n.displayName,t?``:` · ${n.kind.toUpperCase()}`,n.configured?e?` · 已连接`:` · Connected`:``]},`${n.kind}:${n.id}`))]}),y?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`p`,{className:`text-xs text-fg-muted`,children:y.diagnostics.requiresApiKey?e?`此服务使用独立的 API Key。保存连接后,可在“模型与参数”中选用。`:`This service uses its own API key. Save the connection, then choose it in Model and parameters.`:e?`此来源无需 API Key,可返回能力设置选择。`:`No API key needed. Choose this source in capability settings.`}),b.map(t=>(0,$.jsxs)(`label`,{className:`block space-y-1 text-sm text-fg`,children:[(0,$.jsx)(`span`,{children:t.label}),t.secret||t.type===`password`?(0,$.jsx)(q,{labels:Be,value:u[t.key]??``,onChange:e=>f(n=>({...n,[t.key]:e})),disabled:p}):t.options?.length?(0,$.jsxs)(E,{value:u[t.key]??``,disabled:p,onChange:e=>f(n=>({...n,[t.key]:e.target.value})),children:[(0,$.jsx)(D,{value:``,children:e?`保留现有值`:`Keep existing`}),(t.key===`model`?[...t.options].sort(qe):t.options).map(e=>(0,$.jsx)(D,{value:e.id,children:e.name},e.id))]}):(0,$.jsx)(`input`,{className:`w-full rounded-lg border border-edge bg-surface-panel p-2`,value:u[t.key]??``,disabled:p,placeholder:t.placeholder,onChange:e=>f(n=>({...n,[t.key]:e.target.value}))})]},t.key)),_?(0,$.jsx)(`p`,{role:`alert`,className:`text-sm text-danger`,children:_}):null,(0,$.jsx)(Z,{disabled:p||!y.configured&&y.diagnostics.requiresApiKey&&!Object.values(u).some(e=>e.trim()),onClick:()=>void x(),children:p?e?`保存中…`:`Saving…`:e?`保存连接`:`Save connection`})]}):null]})]})}var Mn=`clear-natural-model`;function Nn({label:e,value:t,currentLabel:n,options:r,loading:i,disabled:a,zh:o,onConnect:s,onSelect:c}){let[l,u]=(0,Q.useState)(``),d=l.trim().toLowerCase().split(/\s+/).filter(Boolean),f=[...r].sort((e,t)=>(e.group??``).localeCompare(t.group??``,`en`,{numeric:!0,sensitivity:`base`})||Je(e.label,t.label)||Je(e.value,t.value)).filter(e=>{let t=`${e.label} ${e.group} ${e.value} ${e.searchText??``}`.toLowerCase();return d.every(e=>t.includes(e))}),p=r.find(e=>e.value===t),m=p?.group??r.find(e=>e.value.split(`/`)[0]===t?.split(`/`)[0])?.group,h=p?.label??(t?.endsWith(`/default`)?o?`默认模型`:`Default model`:n??t),g=m?`${h} · ${m}`:h;return!i&&!r.length?(0,$.jsx)(Z,{variant:`secondary`,className:`min-h-11 w-full sm:justify-start`,"aria-label":`${o?`连接`:`Connect`} ${e}`,disabled:a,onClick:s,children:o?`连接服务以启用`:`Connect a service to enable`}):(0,$.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,$.jsx)(O,{value:t??``,options:f,selectedLabel:h,title:g,placeholder:o?`选择模型`:`Choose a model`,ariaLabel:`${o?`选择`:`Select`} ${e}`,allowEmpty:!1,disabled:a,loading:i,onChange:c,searchPlaceholder:o?`搜索模型或服务`:`Search models or services`,searchValue:l,onSearchChange:u,statusMessage:f.length?void 0:o?`没有可用模型`:`No available models`,triggerClassName:`min-h-11`}),m?(0,$.jsx)(`p`,{className:`px-1 text-xs text-fg-muted`,children:m}):null]})}function Pn({data:e,zh:t,onChange:n,onSettings:r,onlyUse:i,disabled:a=!1,onPendingChange:o}){let{data:s,error:c,mutate:l}=X(`settings-agent-defaults`,$e),{data:u}=Te(!0),{data:f,mutate:p}=X(!i||i===`conversation`?d(Pt):null,Mt),{data:m,isLoading:h,error:g,mutate:_}=X(`model-capability-media-sources`,async()=>{let e=await Promise.allSettled([Nt(),kt(),zt()]);return{ids:[...new Set(e.flatMap(e=>e.status===`fulfilled`?(Array.isArray(e.value)?e.value:e.value.providers).filter(e=>e.configured).map(e=>e.id):[]))],failed:e.some(e=>e.status===`rejected`)}}),v=[...new Set([...e.cards.filter(t=>t.configured&&(!F(t.id)||!!e.customConfig?.providers?.[t.id])).map(e=>e.id),...m?.ids??[]])].sort(),{data:y,isLoading:b,mutate:x}=X(e.loading?null:[`model-use-choices`,...v],async()=>{let e=await Promise.allSettled(v.map(N));return{previews:e.flatMap(e=>e.status===`fulfilled`&&e.value.configured?[e.value]:[]),failed:e.some(e=>e.status===`rejected`)}},{revalidateOnFocus:!1}),[S,C]=(0,Q.useState)(null),[w,T]=(0,Q.useState)(null),E=(0,Q.useRef)(!1),D=(0,Q.useRef)(null);(0,Q.useEffect)(()=>()=>o?.(!1),[o]);let O=async(e,t)=>{if(E.current||a)return;let n=y?.previews.find(n=>n.uses.some(n=>n.id===e&&n.choices.some(e=>e.id===t))),r=e===`conversation`&&(t===`boson/higgs-realtime`||t===Mn);if(!n&&!r)return;E.current=!0,o?.(!0),C(e),T(null);let i={mode:`replace`,selected:[e],overrides:{[e]:t}};try{if(r)await p(await At({defaultForNatural:t===Ce}),{revalidate:!1}),await we();else if(n){let t=await G(n.providerId,i);await oe(n.providerId,i,t.revision),await Promise.all([l(),x(),...e===`conversation`?[p(),we()]:[]])}T({use:e})}catch(t){T({use:e,error:t instanceof Error?t.message:String(t)}),Promise.allSettled([l(),x()])}finally{E.current=!1,C(null),o?.(!1),requestAnimationFrame(()=>D.current?.querySelector(`[data-capability="${e}"] button[aria-label]`)?.focus())}},k=u?.payload?.config?jt(u.payload.config):void 0;if(!s&&!c)return(0,$.jsx)(Se,{className:`h-48 w-full rounded-xl`});if(c)return(0,$.jsxs)(`div`,{role:`alert`,className:`text-sm text-danger`,children:[t?`模型用途加载失败`:`Could not load model uses`,(0,$.jsx)(Z,{variant:`ghost`,onClick:()=>void l(),children:t?`重试`:`Retry`})]});let A=s.defaults.models,j=k?.voice.realtime,M=j?.enabled&&j.omni?`${j.omni.provider}/${j.omni.model}`:void 0,ee=f?.defaultForNatural??j?.boson?.defaultForNatural?Ce:M,P=A.background?.primary??A.chat.primary,I=e.builtinRows.find(e=>e.id===P.split(`/`)[0])?.setupProfile?.interactiveOnly!==!0,L=y?.previews[0]?.uses.find(e=>e.id===`background`),R=L?L.current:I?P:void 0,z=[{id:`chat`,label:t?`对话与任务`:`Chat and tasks`,ref:A.chat.primary},{id:`vision`,label:t?`看图`:`Image understanding`,ref:A.imageUnderstanding?.primary},{id:`image`,label:t?`画图`:`Image generation`,ref:A.imageGeneration?.primary},{id:`background`,label:t?`后台任务`:`Background tasks`,ref:R,inherited:!A.background&&!!R},{id:`transcription`,label:t?`录音与听写`:`Recording and dictation`,ref:k?.stt.enabled?`${k.stt.provider}/${k.stt.providers?.[k.stt.provider]?.model??`default`}`:void 0},{id:`speech`,label:t?`语音合成`:`Speech synthesis`,ref:k?.tts.enabled?`${k.tts.provider}/${k.tts.providers?.[k.tts.provider]?.model??`default`}`:void 0},{id:`conversation`,label:t?`自然语音模型`:`Natural voice model`,ref:ee}];return(0,$.jsxs)(`section`,{ref:D,className:`@container min-w-0`,children:[(0,$.jsx)(`h2`,{className:i?`mb-2 text-sm font-semibold text-fg`:`sr-only`,children:i?t?`当前模型`:`Current model`:t?`能力总览`:`Capabilities`}),(0,$.jsx)(`div`,{className:i?`space-y-4`:`overflow-hidden rounded-2xl border border-edge bg-surface-panel`,children:it.filter(e=>!i||e.uses.includes(i)).map(o=>(0,$.jsxs)(`section`,{className:i?`min-w-0`:`min-w-0 border-t border-edge first:border-t-0`,children:[i?null:(0,$.jsxs)(`div`,{className:`flex items-center justify-between bg-surface-inset/55 px-4 py-2`,children:[(0,$.jsx)(`h3`,{className:`text-xs font-medium text-fg-muted`,children:o.label[+!t]}),(0,$.jsx)(`span`,{className:`text-xs text-fg-subtle`,children:o.uses[0]===`chat`?t?`基础能力`:`Core capability`:t?`按需启用`:`Optional`})]}),(0,$.jsx)(`div`,{className:i?`divide-y divide-edge-subtle`:`divide-y divide-edge-subtle px-4`,children:o.uses.filter(e=>!i||e===i).map(o=>{let s=z.find(e=>e.id===o),c=Fn(y?.previews??[],s.id,t);s.id===`conversation`&&((f?.credentialSource||s.ref===`boson/higgs-realtime`)&&c.push({value:Ce,label:`Higgs Realtime`,group:`Boson AI`,disabled:!f?.credentialSource}),s.ref===`boson/higgs-realtime`&&!c.some(e=>e.value!==`boson/higgs-realtime`)&&c.push({value:Mn,label:t?`取消默认模型`:`Clear default model`}));let l=s.ref?e.allModels.find(e=>e.id===s.ref):void 0,u=l?Xe(l,t?`zh`:`en`):s.ref;return(0,$.jsx)(`div`,{"data-capability":s.id,children:(0,$.jsxs)(`div`,{className:i?`py-2`:`grid grid-cols-1 items-center gap-x-3 gap-y-2 py-3 @min-[40rem]:gap-x-4 ${r?`@min-[40rem]:grid-cols-[minmax(0,1fr)_minmax(0,1.35fr)_auto]`:`@min-[40rem]:grid-cols-[minmax(0,1fr)_minmax(0,1.35fr)]`}`,children:[(0,$.jsxs)(`div`,{className:i?`hidden`:`col-start-1 row-start-1 min-w-0`,children:[(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-2 gap-y-1`,children:[(0,$.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:nt[s.id][+!t]}),(0,$.jsx)(`span`,{className:`text-xs text-fg-subtle`,children:s.ref?c.some(e=>e.value===s.ref||s.ref?.endsWith(`/default`)&&e.value.split(`/`)[0]===s.ref.split(`/`)[0])?null:t?`待连接`:`Connection needed`:t?`未配置`:`Not set up`})]}),(0,$.jsx)(`p`,{className:`mt-1 text-xs leading-relaxed text-fg-muted`,children:V[s.id][+!t]}),s.inherited?(0,$.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:t?`继承默认对话`:`Inherits chat default`}):null]}),(0,$.jsxs)(`div`,{className:i?`w-full min-w-0 space-y-1`:`row-start-2 w-full min-w-0 space-y-1 @min-[40rem]:col-span-1 @min-[40rem]:col-start-2 @min-[40rem]:row-start-1`,children:[(0,$.jsx)(Nn,{label:s.id===`conversation`?s.label:nt[s.id][+!t],value:s.ref,currentLabel:u,options:c,loading:e.loading||b||h,disabled:S!==null||a,zh:t,onConnect:()=>n(s.id),onSelect:e=>{e!==s.ref&&O(s.id,e)}}),S===s.id?(0,$.jsx)(`p`,{role:`status`,className:`text-xs text-fg-muted`,children:t?`正在切换…`:`Switching…`}):null,w?.use===s.id?(0,$.jsx)(`div`,{role:w.error?`alert`:`status`,className:`text-xs text-fg-muted`,children:w.error?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`p`,{className:`text-danger`,children:t?`未能切换模型,请重试。`:`Could not switch models. Please retry.`}),(0,$.jsxs)(`details`,{className:`mt-1`,children:[(0,$.jsx)(`summary`,{className:`cursor-pointer`,children:t?`查看详情`:`Show details`}),(0,$.jsx)(`p`,{className:`mt-1 break-words`,children:w.error})]})]}):t?`已切换`:`Model changed`}):null]}),r&&(s.id===`conversation`||c.length>0||b||h)?(0,$.jsxs)(`div`,{className:`row-start-3 flex flex-wrap items-center justify-end gap-1 @min-[40rem]:col-start-3 @min-[40rem]:row-start-1`,children:[(0,$.jsx)(Z,{variant:`ghost`,disabled:S!==null||a,onClick:()=>r(s.id),children:t?`设置`:`Settings`}),(0,$.jsx)(Z,{variant:`ghost`,disabled:S!==null||a,onClick:()=>n(s.id),children:t?`管理服务`:`Manage services`})]}):null]})},s.id)})})]},o.uses[0]))}),(!r||i)&&(y?.failed||m?.failed||g)?(0,$.jsxs)(`p`,{role:`alert`,className:`mt-2 text-xs text-danger`,children:[t?`部分服务的模型加载失败`:`Some model services could not be loaded`,(0,$.jsx)(Z,{variant:`ghost`,onClick:()=>void Promise.all([_(),x()]),children:t?`重试`:`Retry`})]}):null,i||r?null:(0,$.jsx)(`p`,{className:`mt-2 text-xs text-fg-muted`,children:t?`快速与复杂任务模型随对话配置;音色、流式听写及电脑操作可在详细设置中调整。`:`Fast and complex task models follow chat setup. Voices, streaming dictation and Computer Use have detailed settings.`})]})}function Fn(e,t,n=!1){return e.flatMap(e=>e.uses.find(e=>e.id===t)?.choices.map(t=>({value:t.id,label:t.name,group:U(e.providerId,e.profile.name,n),searchText:e.profile.name}))??[])}function In(e){let t=(0,Ut.c)(208),{model:n,isNew:r,providerId:i,onSave:a,onClose:o,m:s}=e,c=p(Rn)===`zh`,l;t[0]===n?l=t[1]:(l=()=>n?{...n}:te(``),t[0]=n,t[1]=l);let[u,d]=(0,Q.useState)(l),[f,m]=(0,Q.useState)(Ln),h;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(h=(e,t)=>{d(n=>({...n,[e]:t})),m(t=>{let n=new Map(t);return n.delete(e),n})},t[2]=h):h=t[2];let g=h,_;t[3]!==u.computerUse||t[4]!==u.contextWindow||t[5]!==u.id||t[6]!==u.input||t[7]!==u.maxTokens||t[8]!==s.modelIdRequired||t[9]!==s.mustBePositive||t[10]!==c?(_=()=>{let e=new Map;return(u.id||``).trim()||e.set(`id`,s.modelIdRequired),u.contextWindow!==void 0&&u.contextWindow<=0&&e.set(`contextWindow`,s.mustBePositive),u.maxTokens!==void 0&&u.maxTokens<=0&&e.set(`maxTokens`,s.mustBePositive),u.computerUse&&!u.input?.includes(`image`)&&e.set(`computerUse`,c?`电脑控制模型必须支持图片输入`:`Computer Use requires image input`),m(e),e.size===0},t[3]=u.computerUse,t[4]=u.contextWindow,t[5]=u.id,t[6]=u.input,t[7]=u.maxTokens,t[8]=s.modelIdRequired,t[9]=s.mustBePositive,t[10]=c,t[11]=_):_=t[11];let y=_,b;t[12]!==u||t[13]!==o||t[14]!==a||t[15]!==y?(b=()=>{if(!y())return;let e=(u.id||``).trim(),t={...u,id:e,name:u.name?.trim()||e,reasoning:u.reasoning||!1,input:u.input||[`text`],contextWindow:u.contextWindow??128e3,maxTokens:u.maxTokens??16384,cost:{input:u.cost?.input??0,output:u.cost?.output??0,cacheRead:u.cost?.cacheRead??0,cacheWrite:u.cost?.cacheWrite??0}};a(t),o()},t[12]=u,t[13]=o,t[14]=a,t[15]=y,t[16]=b):b=t[16];let S=b,C=u,w;t[17]===C?w=t[18]:(w=I(C),t[17]=C,t[18]=w);let T=w,O=r?s.addModelTitle:s.editModelTitle,k;t[19]===O?k=t[20]:(k=(0,$.jsx)(x,{className:`text-base font-semibold text-fg`,children:O}),t[19]=O,t[20]=k);let A;t[21]!==s.modelProviderLabel||t[22]!==i?(A=i?(0,$.jsxs)(`p`,{className:`mt-0.5 text-xs text-fg-muted`,children:[s.modelProviderLabel,`: `,i]}):null,t[21]=s.modelProviderLabel,t[22]=i,t[23]=A):A=t[23];let j;t[24]!==k||t[25]!==A?(j=(0,$.jsxs)(`div`,{children:[k,A]}),t[24]=k,t[25]=A,t[26]=j):j=t[26];let M;t[27]===Symbol.for(`react.memo_cache_sentinel`)?(M=Y(Me,`p-1.5 hover:bg-surface-base`),t[27]=M):M=t[27];let ee;t[28]===Symbol.for(`react.memo_cache_sentinel`)?(ee=(0,$.jsx)(xe,{className:`size-4`}),t[28]=ee):ee=t[28];let N;t[29]===s.close?N=t[30]:(N=(0,$.jsx)(v,{asChild:!0,children:(0,$.jsx)(`button`,{type:`button`,className:M,"aria-label":s.close,children:ee})}),t[29]=s.close,t[30]=N);let F;t[31]!==j||t[32]!==N?(F=(0,$.jsxs)(`div`,{className:`mb-3 flex shrink-0 items-start justify-between gap-2`,children:[j,N]}),t[31]=j,t[32]=N,t[33]=F):F=t[33];let L;t[34]===Symbol.for(`react.memo_cache_sentinel`)?(L=(0,$.jsx)(`span`,{className:`text-red-600 dark:text-red-400`,children:` *`}),t[34]=L):L=t[34];let R;t[35]===s.modelId?R=t[36]:(R=(0,$.jsxs)(`label`,{className:`mb-1 block text-xs font-medium text-fg`,children:[s.modelId,L]}),t[35]=s.modelId,t[36]=R);let z;t[37]===f?z=t[38]:(z=Y(B(),f.has(`id`)&&`border-red-500`),t[37]=f,t[38]=z);let ne=u.id||``,V;t[39]===Symbol.for(`react.memo_cache_sentinel`)?(V=e=>g(`id`,e.target.value),t[39]=V):V=t[39];let H=!r,U;t[40]!==z||t[41]!==ne||t[42]!==H?(U=(0,$.jsx)(`input`,{className:z,value:ne,onChange:V,placeholder:`e.g. llama3.1:8b`,disabled:H}),t[40]=z,t[41]=ne,t[42]=H,t[43]=U):U=t[43];let ie;t[44]===f?ie=t[45]:(ie=f.has(`id`)?(0,$.jsx)(`p`,{className:`mt-1 text-xs text-red-600 dark:text-red-400`,children:f.get(`id`)}):null,t[44]=f,t[45]=ie);let ae;t[46]!==R||t[47]!==U||t[48]!==ie?(ae=(0,$.jsxs)(`div`,{children:[R,U,ie]}),t[46]=R,t[47]=U,t[48]=ie,t[49]=ae):ae=t[49];let G;t[50]===s.displayName?G=t[51]:(G=(0,$.jsx)(`label`,{className:`mb-1 block text-xs font-medium text-fg-muted`,children:s.displayName}),t[50]=s.displayName,t[51]=G);let oe;t[52]===Symbol.for(`react.memo_cache_sentinel`)?(oe=B(),t[52]=oe):oe=t[52];let K=u.name||``,se;t[53]===Symbol.for(`react.memo_cache_sentinel`)?(se=e=>g(`name`,e.target.value),t[53]=se):se=t[53];let q;t[54]===K?q=t[55]:(q=(0,$.jsx)(`input`,{className:oe,value:K,onChange:se}),t[54]=K,t[55]=q);let ce;t[56]!==G||t[57]!==q?(ce=(0,$.jsxs)(`div`,{children:[G,q]}),t[56]=G,t[57]=q,t[58]=ce):ce=t[58];let le;t[59]===s.inputTypes?le=t[60]:(le=(0,$.jsx)(`label`,{className:`mb-1 block text-xs font-medium text-fg-muted`,children:s.inputTypes}),t[59]=s.inputTypes,t[60]=le);let ue;t[61]===Symbol.for(`react.memo_cache_sentinel`)?(ue=re(),t[61]=ue):ue=t[61];let de;t[62]===Symbol.for(`react.memo_cache_sentinel`)?(de=e=>g(`input`,W(e.target.value)),t[62]=de):de=t[62];let J;t[63]===s?J=t[64]:(J=P.map(e=>(0,$.jsx)(D,{value:e.value,children:s[e.labelKey]},e.value)),t[63]=s,t[64]=J);let fe;t[65]!==T||t[66]!==J?(fe=(0,$.jsx)(E,{className:ue,value:T,onChange:de,children:J}),t[65]=T,t[66]=J,t[67]=fe):fe=t[67];let pe;t[68]!==le||t[69]!==fe?(pe=(0,$.jsxs)(`div`,{children:[le,fe]}),t[68]=le,t[69]=fe,t[70]=pe):pe=t[70];let me=u.reasoning||!1,he;t[71]===Symbol.for(`react.memo_cache_sentinel`)?(he=e=>g(`reasoning`,e.target.checked),t[71]=he):he=t[71];let ge;t[72]===me?ge=t[73]:(ge=(0,$.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox`,checked:me,onChange:he}),t[72]=me,t[73]=ge);let _e;t[74]!==s.reasoning||t[75]!==ge?(_e=(0,$.jsxs)(`label`,{className:`mt-6 flex cursor-pointer items-center gap-2 text-sm text-fg`,children:[ge,s.reasoning]}),t[74]=s.reasoning,t[75]=ge,t[76]=_e):_e=t[76];let ve;t[77]!==pe||t[78]!==_e?(ve=(0,$.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[pe,_e]}),t[77]=pe,t[78]=_e,t[79]=ve):ve=t[79];let ye;t[80]===s.contextWindow?ye=t[81]:(ye=(0,$.jsx)(`label`,{className:`mb-1 block text-xs font-medium text-fg-muted`,children:s.contextWindow}),t[80]=s.contextWindow,t[81]=ye);let be;t[82]===f?be=t[83]:(be=Y(B(),f.has(`contextWindow`)&&`border-red-500`),t[82]=f,t[83]=be);let Se=u.contextWindow??128e3,Ce;t[84]===Symbol.for(`react.memo_cache_sentinel`)?(Ce=e=>g(`contextWindow`,parseInt(e.target.value,10)||0),t[84]=Ce):Ce=t[84];let X;t[85]!==be||t[86]!==Se?(X=(0,$.jsx)(St,{type:`number`,min:1,className:be,value:Se,onChange:Ce}),t[85]=be,t[86]=Se,t[87]=X):X=t[87];let we;t[88]===f?we=t[89]:(we=f.has(`contextWindow`)?(0,$.jsx)(`p`,{className:`mt-1 text-xs text-red-600 dark:text-red-400`,children:f.get(`contextWindow`)}):null,t[88]=f,t[89]=we);let Te;t[90]!==ye||t[91]!==X||t[92]!==we?(Te=(0,$.jsxs)(`div`,{children:[ye,X,we]}),t[90]=ye,t[91]=X,t[92]=we,t[93]=Te):Te=t[93];let Ee;t[94]===s.maxOutputTokens?Ee=t[95]:(Ee=(0,$.jsx)(`label`,{className:`mb-1 block text-xs font-medium text-fg-muted`,children:s.maxOutputTokens}),t[94]=s.maxOutputTokens,t[95]=Ee);let De;t[96]===f?De=t[97]:(De=Y(B(),f.has(`maxTokens`)&&`border-red-500`),t[96]=f,t[97]=De);let Oe=u.maxTokens??16384,ke;t[98]===Symbol.for(`react.memo_cache_sentinel`)?(ke=e=>g(`maxTokens`,parseInt(e.target.value,10)||0),t[98]=ke):ke=t[98];let Ae;t[99]!==De||t[100]!==Oe?(Ae=(0,$.jsx)(St,{type:`number`,min:1,className:De,value:Oe,onChange:ke}),t[99]=De,t[100]=Oe,t[101]=Ae):Ae=t[101];let je;t[102]===f?je=t[103]:(je=f.has(`maxTokens`)?(0,$.jsx)(`p`,{className:`mt-1 text-xs text-red-600 dark:text-red-400`,children:f.get(`maxTokens`)}):null,t[102]=f,t[103]=je);let Ne;t[104]!==Ee||t[105]!==Ae||t[106]!==je?(Ne=(0,$.jsxs)(`div`,{children:[Ee,Ae,je]}),t[104]=Ee,t[105]=Ae,t[106]=je,t[107]=Ne):Ne=t[107];let Pe;t[108]!==Te||t[109]!==Ne?(Pe=(0,$.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[Te,Ne]}),t[108]=Te,t[109]=Ne,t[110]=Pe):Pe=t[110];let Fe;t[111]===s.costSection?Fe=t[112]:(Fe=(0,$.jsx)(`p`,{className:`mb-2 text-xs font-semibold text-fg`,children:s.costSection}),t[111]=s.costSection,t[112]=Fe);let Ie;t[113]===s.costInput?Ie=t[114]:(Ie=(0,$.jsx)(`label`,{className:`mb-1 block text-xs text-fg-muted`,children:s.costInput}),t[113]=s.costInput,t[114]=Ie);let Le;t[115]===Symbol.for(`react.memo_cache_sentinel`)?(Le=B(),t[115]=Le):Le=t[115];let Re=u.cost?.input??0,ze;t[116]===u.cost?ze=t[117]:(ze=e=>g(`cost`,{...u.cost,input:parseFloat(e.target.value)||0,output:u.cost?.output??0,cacheRead:u.cost?.cacheRead??0,cacheWrite:u.cost?.cacheWrite??0}),t[116]=u.cost,t[117]=ze);let Be;t[118]!==Re||t[119]!==ze?(Be=(0,$.jsx)(St,{type:`number`,step:`any`,min:0,className:Le,value:Re,onChange:ze}),t[118]=Re,t[119]=ze,t[120]=Be):Be=t[120];let Ve;t[121]!==Ie||t[122]!==Be?(Ve=(0,$.jsxs)(`div`,{children:[Ie,Be]}),t[121]=Ie,t[122]=Be,t[123]=Ve):Ve=t[123];let He;t[124]===s.costOutput?He=t[125]:(He=(0,$.jsx)(`label`,{className:`mb-1 block text-xs text-fg-muted`,children:s.costOutput}),t[124]=s.costOutput,t[125]=He);let Ue;t[126]===Symbol.for(`react.memo_cache_sentinel`)?(Ue=B(),t[126]=Ue):Ue=t[126];let We=u.cost?.output??0,Ge;t[127]===u.cost?Ge=t[128]:(Ge=e=>g(`cost`,{...u.cost,input:u.cost?.input??0,output:parseFloat(e.target.value)||0,cacheRead:u.cost?.cacheRead??0,cacheWrite:u.cost?.cacheWrite??0}),t[127]=u.cost,t[128]=Ge);let Ke;t[129]!==We||t[130]!==Ge?(Ke=(0,$.jsx)(St,{type:`number`,step:`any`,min:0,className:Ue,value:We,onChange:Ge}),t[129]=We,t[130]=Ge,t[131]=Ke):Ke=t[131];let qe;t[132]!==He||t[133]!==Ke?(qe=(0,$.jsxs)(`div`,{children:[He,Ke]}),t[132]=He,t[133]=Ke,t[134]=qe):qe=t[134];let Je;t[135]!==Ve||t[136]!==qe?(Je=(0,$.jsxs)(`div`,{className:`grid grid-cols-2 gap-3`,children:[Ve,qe]}),t[135]=Ve,t[136]=qe,t[137]=Je):Je=t[137];let Ye;t[138]!==Fe||t[139]!==Je?(Ye=(0,$.jsxs)(`div`,{className:`border-t border-edge-subtle pt-2 dark:border-edge`,children:[Fe,Je]}),t[138]=Fe,t[139]=Je,t[140]=Ye):Ye=t[140];let Xe;t[141]!==ae||t[142]!==ce||t[143]!==ve||t[144]!==Pe||t[145]!==Ye?(Xe=(0,$.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[ae,ce,ve,Pe,Ye]}),t[141]=ae,t[142]=ce,t[143]=ve,t[144]=Pe,t[145]=Ye,t[146]=Xe):Xe=t[146];let Ze=c?`高级:手机操作协议`:`Advanced: Phone Use protocol`,Qe;t[147]===Ze?Qe=t[148]:(Qe=(0,$.jsx)(`summary`,{className:`cursor-pointer`,children:Ze}),t[147]=Ze,t[148]=Qe);let $e=c?`手机操作协议`:`Phone Use protocol`,et=u.phoneUse?.profile??``,tt;t[149]===Symbol.for(`react.memo_cache_sentinel`)?(tt=e=>g(`phoneUse`,e.target.value?{profile:e.target.value}:void 0),t[149]=tt):tt=t[149];let nt=c?`自动识别`:`Automatic`,rt;t[150]===nt?rt=t[151]:(rt=(0,$.jsx)(D,{value:``,children:nt}),t[150]=nt,t[151]=rt);let it,at,ot,st,ct;t[152]===Symbol.for(`react.memo_cache_sentinel`)?(it=(0,$.jsx)(D,{value:`autoglm-phone-v1`,children:`AutoGLM Phone`}),at=(0,$.jsx)(D,{value:`structured-phone-v1`,children:`Structured Phone`}),ot=(0,$.jsx)(D,{value:`structured-tools-phone-v1`,children:`Visual function tools`}),st=(0,$.jsx)(D,{value:`doubao-seed-phone-v1`,children:`Doubao Seed GUI`}),ct=(0,$.jsx)(D,{value:`gui-owl-phone-v1`,children:`GUI-Owl 1.5`}),t[152]=it,t[153]=at,t[154]=ot,t[155]=st,t[156]=ct):(it=t[152],at=t[153],ot=t[154],st=t[155],ct=t[156]);let lt;t[157]!==$e||t[158]!==et||t[159]!==rt?(lt=(0,$.jsxs)(E,{"aria-label":$e,value:et,onChange:tt,children:[rt,it,at,ot,st,ct]}),t[157]=$e,t[158]=et,t[159]=rt,t[160]=lt):lt=t[160];let ut=c?`通用视觉模型支持图片输入和工具调用时会自动显示;也可指定专用手机协议。`:`Visual models with image input and function tools appear automatically. Dedicated phone protocols can also be selected.`,dt;t[161]===ut?dt=t[162]:(dt=(0,$.jsx)(`p`,{className:`text-xs text-fg-muted`,children:ut}),t[161]=ut,t[162]=dt);let ft;t[163]!==lt||t[164]!==dt?(ft=(0,$.jsxs)(`div`,{className:`mt-3 space-y-2`,children:[lt,dt]}),t[163]=lt,t[164]=dt,t[165]=ft):ft=t[165];let pt;t[166]!==Qe||t[167]!==ft?(pt=(0,$.jsxs)(`details`,{className:`mt-4 rounded-lg border border-edge p-3 text-sm text-fg`,children:[Qe,ft]}),t[166]=Qe,t[167]=ft,t[168]=pt):pt=t[168];let mt=c?`高级:电脑控制协议`:`Advanced: Computer Use protocol`,ht;t[169]===mt?ht=t[170]:(ht=(0,$.jsx)(`summary`,{className:`cursor-pointer`,children:mt}),t[169]=mt,t[170]=ht);let gt=c?`电脑控制协议`:`Computer Use protocol`,_t=u.computerUse?.profile??``,vt;t[171]===Symbol.for(`react.memo_cache_sentinel`)?(vt=e=>g(`computerUse`,e.target.value?{profile:e.target.value}:void 0),t[171]=vt):vt=t[171];let yt=c?`自动识别`:`Automatic`,bt;t[172]===yt?bt=t[173]:(bt=(0,$.jsx)(D,{value:``,children:yt}),t[172]=yt,t[173]=bt);let xt,Ct,wt;t[174]===Symbol.for(`react.memo_cache_sentinel`)?(xt=(0,$.jsx)(D,{value:`gui-plus-2026-02-26`,children:`GUI-Plus (2026-02-26)`}),Ct=(0,$.jsx)(D,{value:`structured-tools-v1`,children:`structured-tools-v1`}),wt=(0,$.jsx)(D,{value:`openai-responses-computer-v1`,children:`OpenAI Responses Computer`}),t[174]=xt,t[175]=Ct,t[176]=wt):(xt=t[174],Ct=t[175],wt=t[176]);let Tt;t[177]!==gt||t[178]!==_t||t[179]!==bt?(Tt=(0,$.jsxs)(E,{"aria-label":gt,value:_t,onChange:vt,children:[bt,xt,Ct,wt]}),t[177]=gt,t[178]=_t,t[179]=bt,t[180]=Tt):Tt=t[180];let Et=c?`协议必须与模型 API 匹配。声明协议不代表模型已通过效果验证。`:`The protocol must match the model API. Declaring a protocol does not certify model quality.`,Dt;t[181]===Et?Dt=t[182]:(Dt=(0,$.jsx)(`p`,{className:`text-xs leading-relaxed text-fg-muted`,children:Et}),t[181]=Et,t[182]=Dt);let Ot;t[183]===f?Ot=t[184]:(Ot=f.has(`computerUse`)&&(0,$.jsx)(`p`,{role:`alert`,className:`text-xs text-danger`,children:f.get(`computerUse`)}),t[183]=f,t[184]=Ot);let kt;t[185]!==Dt||t[186]!==Ot||t[187]!==Tt?(kt=(0,$.jsxs)(`div`,{className:`mt-3 space-y-2`,children:[Tt,Dt,Ot]}),t[185]=Dt,t[186]=Ot,t[187]=Tt,t[188]=kt):kt=t[188];let At;t[189]!==kt||t[190]!==ht?(At=(0,$.jsxs)(`details`,{className:`mt-4 rounded-lg border border-edge p-3 text-sm text-fg`,children:[ht,kt]}),t[189]=kt,t[190]=ht,t[191]=At):At=t[191];let jt;t[192]!==At||t[193]!==Xe||t[194]!==pt?(jt=(0,$.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto pr-1`,children:[Xe,pt,At]}),t[192]=At,t[193]=Xe,t[194]=pt,t[195]=jt):jt=t[195];let Mt;t[196]===s.cancel?Mt=t[197]:(Mt=(0,$.jsx)(v,{asChild:!0,children:(0,$.jsx)(Z,{type:`button`,variant:`secondary`,children:s.cancel})}),t[196]=s.cancel,t[197]=Mt);let Nt=r?s.addModelConfirm:s.saveModelConfirm,Pt;t[198]!==S||t[199]!==Nt?(Pt=(0,$.jsx)(Z,{type:`button`,variant:`primary`,className:`hover:bg-accent/90`,onClick:S,children:Nt}),t[198]=S,t[199]=Nt,t[200]=Pt):Pt=t[200];let Ft;t[201]!==Mt||t[202]!==Pt?(Ft=(0,$.jsxs)(`div`,{className:`mt-4 flex shrink-0 justify-end gap-2 border-t border-edge-subtle pt-3 dark:border-edge`,children:[Mt,Pt]}),t[201]=Mt,t[202]=Pt,t[203]=Ft):Ft=t[203];let It;return t[204]!==jt||t[205]!==Ft||t[206]!==F?(It=(0,$.jsxs)($.Fragment,{children:[F,jt,Ft]}),t[204]=jt,t[205]=Ft,t[206]=F,t[207]=It):It=t[207],It}function Ln(){return new Map}function Rn(e){return e.language}function zn(e){let t=(0,Ut.c)(16),{open:n,onOpenChange:r,providerId:i,model:a,isNew:o,onSave:s,m:c}=e,l;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,$.jsx)(g,{className:Y(`xopc-dialog-overlay fixed inset-0 bg-scrim`,ke)}),t[0]=l):l=t[0];let u;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(u=Y(`xopc-dialog-content fixed left-1/2 top-1/2 flex h-[min(90vh,720px)] w-[min(100%-2rem,28rem)] -translate-x-1/2 -translate-y-1/2 flex-col`,Oe,`overflow-hidden rounded-xl border border-edge bg-surface-overlay p-4 shadow-popover dark:border-edge`),t[1]=u):u=t[1];let d;t[2]!==o||t[3]!==c||t[4]!==a||t[5]!==r||t[6]!==s||t[7]!==n||t[8]!==i?(d=n?(0,$.jsx)(In,{model:a,isNew:o,providerId:i,onSave:s,onClose:()=>r(!1),m:c},`${i??`none`}-${a?.id??`new`}`):null,t[2]=o,t[3]=c,t[4]=a,t[5]=r,t[6]=s,t[7]=n,t[8]=i,t[9]=d):d=t[9];let f;t[10]===d?f=t[11]:(f=(0,$.jsxs)(y,{children:[l,(0,$.jsx)(b,{className:u,onOpenAutoFocus:Bn,children:d})]}),t[10]=d,t[11]=f);let p;return t[12]!==r||t[13]!==n||t[14]!==f?(p=(0,$.jsx)(S,{open:n,onOpenChange:r,children:f}),t[12]=r,t[13]=n,t[14]=f,t[15]=p):p=t[15],p}function Bn(e){return e.preventDefault()}function Vn(e){let t=(0,Ut.c)(14),{providerId:n,inputId:r,value:i,onChange:a,labels:o}=e,s;t[0]===n?s=t[1]:(s=()=>ut(n).then(Hn),t[0]=n,t[1]=s);let c=s,l;t[2]!==r||t[3]!==o.apiKeyLabel?(l=(0,$.jsx)(`label`,{htmlFor:r,className:`text-sm font-medium text-fg`,children:o.apiKeyLabel}),t[2]=r,t[3]=o.apiKeyLabel,t[4]=l):l=t[4];let u;t[5]!==r||t[6]!==o||t[7]!==a||t[8]!==c||t[9]!==i?(u=(0,$.jsx)(q,{id:r,value:i,onChange:a,placeholder:o.apiKeyPlaceholder,labels:o,reveal:c,loadFailedLabel:o.loadFailed,maskedHelp:o.maskedHelp,notInConfigFile:o.notInConfigFile}),t[5]=r,t[6]=o,t[7]=a,t[8]=c,t[9]=i,t[10]=u):u=t[10];let d;return t[11]!==l||t[12]!==u?(d=(0,$.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[l,u]}),t[11]=l,t[12]=u,t[13]=d):d=t[13],d}function Hn(e){return e.apiKey??null}function Un(e){let t=(0,Ut.c)(23),{open:n,onOpenChange:r,providerId:i,isCustom:a,builtinRows:o,customConfig:s,allModels:c,labels:l,language:u,onSaved:d}=e,f=(0,Q.useRef)(null),[p,m]=(0,Q.useState)(!1),[h,_]=(0,Q.useState)(null),v;t[0]===r?v=t[1]:(v=e=>{e||(_(null),m(!1)),r(e)},t[0]=r,t[1]=v);let x=v,C;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(C=(0,$.jsx)(g,{className:Y(`xopc-dialog-overlay fixed inset-0 bg-scrim backdrop-blur-[1px]`,ke)}),t[2]=C):C=t[2];let w,T,E;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(w=()=>{f.current=document.activeElement instanceof HTMLElement?document.activeElement:null},T=e=>{f.current?.isConnected&&(e.preventDefault(),f.current.focus({preventScroll:!0}))},E=Y(`xopc-dialog-content fixed left-1/2 top-1/2 flex h-[min(85vh,720px)] w-[calc(100%-2rem)] max-w-lg -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-2xl border border-edge bg-surface-overlay`,Oe),t[3]=w,t[4]=T,t[5]=E):(w=t[3],T=t[4],E=t[5]);let D;t[6]!==c||t[7]!==o||t[8]!==s||t[9]!==x||t[10]!==a||t[11]!==l||t[12]!==u||t[13]!==r||t[14]!==d||t[15]!==i||t[16]!==p||t[17]!==h?(D=(0,$.jsxs)(y,{children:[C,(0,$.jsx)(b,{onOpenAutoFocus:w,onCloseAutoFocus:T,className:E,children:h?(0,$.jsx)(z,{target:h,zh:u===`zh`,onDone:()=>x(!1)}):!a&&p?(0,$.jsx)(ee,{providerId:i,existingConnection:!0,row:o.find(e=>e.id===i),language:u,onApplied:d,onBack:()=>m(!1),onDone:()=>x(!1)}):a?(0,$.jsx)(Gn,{providerId:i,customConfig:s,labels:l,language:u,onClose:()=>r(!1),onSaved:d,onModelAdded:e=>_({providerId:i,modelIds:[e]})}):(0,$.jsx)(Wn,{providerId:i,builtinRows:o,allModels:c,labels:l,language:u,onClose:()=>r(!1),onSaved:d,onQuickSetup:()=>m(!0)})})]}),t[6]=c,t[7]=o,t[8]=s,t[9]=x,t[10]=a,t[11]=l,t[12]=u,t[13]=r,t[14]=d,t[15]=i,t[16]=p,t[17]=h,t[18]=D):D=t[18];let O;return t[19]!==x||t[20]!==n||t[21]!==D?(O=(0,$.jsx)(S,{open:n,onOpenChange:x,children:D}),t[19]=x,t[20]=n,t[21]=D,t[22]=O):O=t[22],O}function Wn({providerId:e,builtinRows:t,allModels:n,labels:r,language:i,onClose:a,onSaved:o,onQuickSetup:s}){let c=t.find(t=>t.id===e),u=L[e],d=n.filter(t=>t.provider===e),[f,p]=(0,Q.useState)(!1),[m,g]=(0,Q.useState)(c?.apiKey??``),[_,y]=(0,Q.useState)(!1),[b,S]=(0,Q.useState)(!1),[C,w]=(0,Q.useState)(null),[T,E]=(0,Q.useState)(!1),D=h(i).providersSettings,O=c?.supportsApiKey!==!1,A=c?.supportsOAuth===!0,ee=c?.authMode===`oauth`&&c.authStatus===`connected`,N=c?.configured===!0&&c.activeKeySource!==`env`&&c.activeKeySource!==`extension`&&c.activeKeySource!==`models_json`,[P,F]=(0,Q.useState)(null),[I,R]=(0,Q.useState)(null),[z,B]=(0,Q.useState)(`idle`),[te,ne]=(0,Q.useState)(null),[V,re]=(0,Q.useState)(null),[H,U]=(0,Q.useState)(null),[ie,W]=(0,Q.useState)(``),G=(0,Q.useRef)(null),oe=(0,Q.useRef)(null),K=z===`waiting`||z===`waiting_code`,q=(0,Q.useMemo)(()=>M(e,i),[e,i]),ce=m!==(c?.apiKey??``),le=async()=>{let t=m.trim();if(!(!t||!O||lt(t))){y(!0),w(null);try{await ct({[e]:t}),S(!0),window.setTimeout(()=>{o(),a()},600)}catch(e){w(e instanceof Error?e.message:r.saveError)}finally{y(!1)}}};(0,Q.useEffect)(()=>{if(!P||!K)return;let e=window.setInterval(()=>{(async()=>{try{let t=await gt(P);t.status===`waiting_auth`||t.status===`waiting_code`?(B(t.status===`waiting_code`?`waiting_code`:`waiting`),R(t.message??null),ne(t.authUrl??null),re(t.instructions??null),U(t.deviceCode??null),t.authUrl&&t.authUrl!==oe.current&&(oe.current=t.authUrl,yt(t.authUrl,G.current).catch(()=>{}))):t.status===`completed`?(window.clearInterval(e),xt(G.current),G.current=null,B(`success`),R(t.message??D.saved),window.setTimeout(()=>{o(),a()},600)):(t.status===`failed`||t.status===`cancelled`)&&(window.clearInterval(e),xt(G.current),G.current=null,B(`error`),R(t.error??t.message??D.revokeFailed))}catch{}})()},1e3);return()=>window.clearInterval(e)},[P,K,a,o,D.revokeFailed,D.saved]),(0,Q.useEffect)(()=>()=>{P&&mt(P).catch(()=>{})},[P]),(0,Q.useEffect)(()=>()=>{xt(G.current),G.current=null},[]);let ue=async()=>{try{await dt(e),o(),a()}catch{}},J=async()=>{xt(G.current),G.current=bt(),oe.current=null,B(`waiting`),R(D.oauthStarting),ne(null),re(null),U(null),w(null);try{let t=await ft(e);F(t.sessionId)}catch(e){xt(G.current),G.current=null,B(`error`),R(e instanceof Error?e.message:D.revokeFailed)}},fe=async()=>{if(P){try{await _t(P)}catch{}xt(G.current),G.current=null,oe.current=null,B(`idle`),R(null),F(null),ne(null),re(null),U(null)}},pe=async()=>{if(!(!P||!ie.trim()))try{await ht(P,ie.trim()),W(``),R(D.oauthProcessingCode)}catch(e){B(`error`),R(e instanceof Error?e.message:D.revokeFailed)}},me=async()=>{try{await pt(e),o(),a()}catch(e){w(e instanceof Error?e.message:D.revokeFailed)}};return(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between border-b border-edge-subtle px-5 py-4`,children:[(0,$.jsx)(x,{className:`text-base font-semibold text-fg`,children:c?.name??e}),(0,$.jsx)(v,{asChild:!0,children:(0,$.jsx)(`button`,{type:`button`,className:Y(`rounded-lg p-1.5 text-fg-muted hover:bg-surface-hover hover:text-fg`,je.press),children:(0,$.jsx)(xe,{className:`size-4`,"aria-hidden":!0})})})]}),(0,$.jsxs)(`div`,{className:`flex flex-col gap-4 overflow-y-auto px-5 py-4`,children:[s?(0,$.jsx)(Z,{variant:`secondary`,onClick:s,children:i===`zh`?`配置模型用途`:`Configure model uses`}):null,u?.description?(0,$.jsx)(`p`,{className:`text-sm text-fg-muted`,children:u.description}):null,c?.baseUrl?(0,$.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,$.jsx)(`span`,{className:`text-sm font-medium text-fg`,children:r.apiUrlLabel}),(0,$.jsx)(`code`,{className:`break-all rounded-lg border border-edge-subtle bg-surface-panel/60 px-3 py-2 font-mono text-xs text-fg-muted`,children:c.baseUrl})]}):c?.category===`extension`?(0,$.jsx)(`p`,{className:`text-sm text-fg-muted`,children:r.apiUrlExtensionHint}):null,O?(0,$.jsx)(Vn,{providerId:e,inputId:`manage-api-key`,value:m,onChange:e=>{g(e),S(!1)},labels:{apiKeyLabel:r.apiKeyLabel,apiKeyPlaceholder:r.apiKeyPlaceholder,maskedHelp:r.maskedHelp,copy:r.copy,copied:r.copied,show:r.showKey,hide:r.hideKey,notInConfigFile:r.notInConfigFile,loadFailed:r.loadFailed}}):c?.category===`extension`?(0,$.jsxs)(`div`,{className:`flex flex-col gap-2 rounded-lg border border-edge-subtle bg-surface-panel/60 px-3 py-2 text-sm text-fg-muted`,children:[(0,$.jsx)(`p`,{children:r.extensionKeyHint}),c?.extensionId?(0,$.jsxs)(l,{to:`/settings/ext/${encodeURIComponent(c.extensionId)}`,className:`inline-flex w-fit items-center gap-1 font-medium text-accent hover:underline`,title:r.extensionSettingsLinkTitle,onClick:a,children:[r.openExtensionSettings,(0,$.jsx)(se,{className:`size-3`,"aria-hidden":!0})]}):null]}):null,A?(0,$.jsxs)(`div`,{className:`flex flex-col gap-2 rounded-lg border border-edge-subtle bg-surface-panel/60 p-3`,children:[(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,$.jsxs)(`div`,{className:`min-w-0`,children:[(0,$.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:D.oauth}),(0,$.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-muted`,children:ee?D.sourceOauth:D.oauthHint})]}),ee?(0,$.jsx)(Z,{type:`button`,variant:`secondary`,className:`gap-1.5 text-red-600 dark:text-red-400`,onClick:()=>void me(),children:D.revoke}):(0,$.jsxs)(Z,{type:`button`,variant:`primary`,className:`gap-1.5`,disabled:K,onClick:()=>void J(),children:[K?(0,$.jsx)(de,{className:`size-3.5 animate-spin`,"aria-hidden":!0}):(0,$.jsx)(j,{className:`size-3.5`,"aria-hidden":!0}),D.oauth]})]}),I?(0,$.jsx)(`p`,{className:Y(`text-xs`,z===`error`?`text-red-600 dark:text-red-400`:`text-fg-muted`),children:I}):null,z===`waiting`||z===`waiting_code`?(0,$.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[te?(0,$.jsxs)(`a`,{href:te,target:`_blank`,rel:`noreferrer`,className:`inline-flex items-center gap-1.5 rounded-md bg-accent px-3 py-2 text-sm font-medium text-on-accent hover:bg-accent-hover`,children:[(0,$.jsx)(se,{className:`size-4`,"aria-hidden":!0}),D.openAuthPage]}):null,(0,$.jsx)(Z,{type:`button`,variant:`secondary`,onClick:()=>void fe(),children:D.cancelOAuth})]}):null,V?(0,$.jsx)(`p`,{className:`text-xs text-fg-muted`,children:V}):null,H?(0,$.jsxs)(`div`,{className:`rounded-lg border border-edge-subtle bg-surface-panel px-3 py-2`,children:[(0,$.jsx)(`p`,{className:`text-xs text-fg-muted`,children:D.deviceCodeLabel}),(0,$.jsx)(`code`,{className:`mt-1 block select-all font-mono text-lg font-semibold tracking-widest text-fg`,children:H}),(0,$.jsx)(`p`,{className:`mt-1 text-xs text-fg-subtle`,children:D.deviceCodeHint})]}):null,z===`waiting_code`?(0,$.jsxs)(`div`,{className:`flex flex-col gap-2 sm:flex-row`,children:[(0,$.jsx)(`input`,{type:`text`,value:ie,onChange:e=>W(e.target.value),onKeyDown:e=>e.key===`Enter`&&void pe(),placeholder:D.pasteRedirectUrl,className:Y(`min-w-0 flex-1 rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg placeholder:text-fg-subtle`,Le)}),(0,$.jsx)(Z,{type:`button`,variant:`primary`,onClick:()=>void pe(),children:D.submitCode})]}):null]}):null,q.length>0&&O?(0,$.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:q.map(({kind:e,href:t})=>(0,$.jsxs)(`a`,{href:t,target:`_blank`,rel:`noreferrer`,className:`inline-flex items-center gap-1 text-xs text-accent hover:underline`,children:[ae(e,r),(0,$.jsx)(se,{className:`size-3`,"aria-hidden":!0})]},e))}):null,d.length>0?(0,$.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,$.jsxs)(`span`,{className:`text-sm font-medium text-fg`,children:[r.modelsLabel,` (`,d.length,`)`]}),(0,$.jsxs)(`label`,{className:`mb-2 flex items-center gap-2 text-xs text-fg-muted`,children:[(0,$.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox`,checked:f,onChange:e=>p(e.target.checked)}),i===`zh`?`仅电脑控制模型`:`Computer Use only`]}),(0,$.jsx)(`div`,{className:`max-h-40 overflow-y-auto rounded-lg border border-edge-subtle bg-surface-panel/40 p-2`,children:(0,$.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:d.filter(e=>!f||e.computerUse).map(e=>(0,$.jsxs)(`span`,{className:`inline-block rounded-md bg-surface-hover px-2 py-1 text-xs text-fg-muted`,children:[Xe(e,i),e.computerUse?` · Computer Use`:``]},e.id))})})]}):(0,$.jsx)(`p`,{className:`text-xs text-fg-subtle`,children:r.noModels}),C?(0,$.jsx)(`p`,{className:`text-sm text-red-600 dark:text-red-400`,children:C}):null]}),(0,$.jsxs)(`div`,{className:`flex items-center justify-between border-t border-edge-subtle px-5 py-3`,children:[N?(0,$.jsxs)(Z,{type:`button`,variant:`ghost`,className:`gap-1.5 text-red-600 hover:text-red-700 dark:text-red-400 dark:hover:text-red-300`,onClick:()=>E(!0),children:[(0,$.jsx)(ve,{className:`size-3.5`,"aria-hidden":!0}),r.remove]}):(0,$.jsx)(`span`,{}),(0,$.jsx)(`div`,{className:`flex items-center gap-2`,children:O&&ce&&!lt(m.trim())?(0,$.jsx)(Z,{type:`button`,variant:`primary`,disabled:!m.trim()||_||b,onClick:()=>void le(),children:b?(0,$.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,$.jsx)(k,{className:`size-3.5`,"aria-hidden":!0}),r.saved]}):_?(0,$.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,$.jsx)(de,{className:`size-3.5 animate-spin`,"aria-hidden":!0}),r.saving]}):r.save}):null})]}),(0,$.jsx)(Ke,{open:T,title:r.removeConfirmTitle,description:r.removeConfirmDescription.replace(`{{provider}}`,c?.name??e),confirmLabel:r.removeConfirmAction,cancelLabel:r.cancel,destructive:!0,onConfirm:()=>void ue(),onCancel:()=>E(!1)})]})}function Gn({providerId:e,customConfig:t,labels:n,language:r,onClose:i,onSaved:a,onModelAdded:o}){let s=h(r).modelsSettings,c=t?.providers[e],[l,u]=(0,Q.useState)(c?.baseUrl??``),[d,f]=(0,Q.useState)(c?.apiKey??``),[p,m]=(0,Q.useState)(c?.models??[]),[g,_]=(0,Q.useState)(!1),[y,b]=(0,Q.useState)(c?.modelDiscovery?.enabled===!0),[S,C]=(0,Q.useState)(!1),[w,T]=(0,Q.useState)(null),[E,D]=(0,Q.useState)(!1),[O,k]=(0,Q.useState)(null),[A,j]=(0,Q.useState)(!1),[M,ee]=(0,Q.useState)(null),N=n=>{if(!t)return null;let r=d.trim(),i={...c,baseUrl:l.trim()||void 0,apiKey:lt(r)?c?.apiKey:r||void 0,...n};return{providers:{...t.providers,[e]:i}}},P=async()=>{let e=N({models:p,modelDiscovery:{enabled:y}});if(e){C(!0),T(null);try{await R(e),a(),i()}catch(e){T(e instanceof Error?e.message:n.saveError)}finally{C(!1)}}},F=async()=>{if(t)try{let{[e]:n,...r}=t.providers;await R({providers:r}),a(),i()}catch{}},I=(e,t)=>{ee({model:e,isNew:t}),j(!0)},L=async e=>{if(!M)return;let t=M.isNew&&!p.some(t=>t.id===e.id),r=M.isNew?[...p,e]:p.map(t=>t.id===e.id?e:t);m(r);let i=N({models:r});if(i)try{await R(i),a(),t&&!e.computerUse&&o(e.id)}catch(e){T(e instanceof Error?e.message:n.saveError)}},z=async e=>{let t=p.filter(t=>t.id!==e);m(t),k(null);let r=N({models:t});if(r)try{await R(r),a()}catch(e){T(e instanceof Error?e.message:n.saveError)}};return(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between border-b border-edge-subtle px-5 py-4`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(x,{className:`text-base font-semibold text-fg`,children:e}),(0,$.jsx)(`span`,{className:`rounded bg-surface-hover px-1.5 py-0.5 text-[10px] font-medium text-fg-subtle`,children:n.custom})]}),(0,$.jsx)(v,{asChild:!0,children:(0,$.jsx)(`button`,{type:`button`,className:Y(`rounded-lg p-1.5 text-fg-muted hover:bg-surface-hover hover:text-fg`,je.press),children:(0,$.jsx)(xe,{className:`size-4`,"aria-hidden":!0})})})]}),(0,$.jsxs)(`div`,{className:`flex flex-col gap-4 overflow-y-auto px-5 py-4`,children:[(0,$.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,$.jsx)(`label`,{htmlFor:`manage-base-url`,className:`text-sm font-medium text-fg`,children:n.baseUrlLabel}),(0,$.jsx)(`input`,{id:`manage-base-url`,type:`url`,autoComplete:`off`,value:l,onChange:e=>u(e.target.value),className:Y(`rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg placeholder:text-fg-subtle`,Le)})]}),(0,$.jsx)(Vn,{providerId:e,inputId:`manage-custom-api-key`,value:d,onChange:f,labels:{apiKeyLabel:n.apiKeyLabel,apiKeyPlaceholder:n.apiKeyPlaceholder,maskedHelp:n.maskedHelp,copy:n.copy,copied:n.copied,show:n.showKey,hide:n.hideKey,notInConfigFile:n.notInConfigFile,loadFailed:n.loadFailed}}),(0,$.jsxs)(`label`,{className:`flex items-start gap-3 rounded-xl border border-edge-subtle bg-surface-panel/40 p-3`,children:[(0,$.jsx)(`input`,{type:`checkbox`,checked:y,onChange:e=>b(e.target.checked),className:`mt-0.5 size-4 rounded border-edge accent-accent`}),(0,$.jsxs)(`span`,{className:`min-w-0`,children:[(0,$.jsx)(`span`,{className:`block text-sm font-medium text-fg`,children:r===`zh`?`自动同步模型目录`:`Automatically sync model catalog`}),(0,$.jsx)(`span`,{className:`mt-0.5 block text-xs text-fg-muted`,children:r===`zh`?`启动时及定时从此服务的 /models 接口更新模型。`:`Update models from this service’s /models endpoint at startup and on schedule.`})]})]}),(0,$.jsxs)(`div`,{className:`border-t border-edge-subtle pt-3`,children:[(0,$.jsxs)(`div`,{className:`mb-2 flex items-center justify-between gap-2`,children:[(0,$.jsxs)(`span`,{className:`text-sm font-semibold text-fg`,children:[s.modelsSection,p.length>0?` (${p.length})`:``]}),(0,$.jsxs)(Z,{type:`button`,variant:`primary`,className:`gap-1.5 px-2 py-1 text-xs`,onClick:()=>I(null,!0),children:[(0,$.jsx)(pe,{className:`size-3.5`,"aria-hidden":!0}),s.addModel]})]}),(0,$.jsxs)(`label`,{className:`mb-2 flex items-center gap-2 text-xs text-fg-muted`,children:[(0,$.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox`,checked:g,onChange:e=>_(e.target.checked)}),r===`zh`?`仅电脑控制模型`:`Computer Use only`]}),p.filter(e=>!g||e.computerUse).length===0?(0,$.jsx)(`p`,{className:`text-xs text-fg-muted`,children:s.modelsEmpty}):(0,$.jsx)(`ul`,{className:`space-y-2`,children:p.filter(e=>!g||e.computerUse).map(e=>(0,$.jsxs)(`li`,{className:`flex items-center justify-between gap-2 rounded-lg border border-edge-subtle bg-surface-panel/40 px-3 py-2`,children:[(0,$.jsxs)(`div`,{className:`min-w-0`,children:[(0,$.jsx)(`div`,{className:`truncate text-sm font-medium text-fg`,children:e.id}),e.computerUse&&(0,$.jsx)(`span`,{className:`text-xs text-fg-muted`,children:`Computer Use`}),e.name&&e.name!==e.id?(0,$.jsx)(`div`,{className:`truncate text-xs text-fg-muted`,children:e.name}):null]}),(0,$.jsxs)(`div`,{className:`flex shrink-0 gap-1`,children:[(0,$.jsx)(`button`,{type:`button`,className:Y(`rounded-lg p-1.5 text-fg-muted hover:bg-surface-hover hover:text-fg`,je.press),onClick:()=>I(e,!1),"aria-label":s.editModel,children:(0,$.jsx)(J,{className:`size-3.5`,"aria-hidden":!0})}),(0,$.jsx)(`button`,{type:`button`,className:Y(`rounded-lg p-1.5 text-fg-muted hover:bg-surface-hover hover:text-red-600 dark:hover:text-red-400`,je.press),onClick:()=>k(e.id),"aria-label":s.removeModel,children:(0,$.jsx)(ve,{className:`size-3.5`,"aria-hidden":!0})})]})]},e.id))})]}),w?(0,$.jsx)(`p`,{className:`text-sm text-red-600 dark:text-red-400`,children:w}):null]}),(0,$.jsxs)(`div`,{className:`flex items-center justify-between border-t border-edge-subtle px-5 py-3`,children:[(0,$.jsxs)(Z,{type:`button`,variant:`ghost`,className:`gap-1.5 text-red-600 hover:text-red-700 dark:text-red-400 dark:hover:text-red-300`,onClick:()=>D(!0),children:[(0,$.jsx)(ve,{className:`size-3.5`,"aria-hidden":!0}),n.remove]}),(0,$.jsx)(`div`,{className:`flex items-center gap-2`,children:(0,$.jsx)(Z,{type:`button`,variant:`primary`,disabled:S,onClick:()=>void P(),children:S?(0,$.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,$.jsx)(de,{className:`size-3.5 animate-spin`,"aria-hidden":!0}),n.saving]}):n.save})})]}),(0,$.jsx)(Ke,{open:E,title:n.removeConfirmTitle,description:n.removeConfirmDescription.replace(`{{provider}}`,e),confirmLabel:n.removeConfirmAction,cancelLabel:n.cancel,destructive:!0,onConfirm:()=>void F(),onCancel:()=>D(!1)}),(0,$.jsx)(Ke,{open:O!==null,title:s.removeModel,description:s.removeModelConfirm.replace(`{{id}}`,O??``),confirmLabel:n.removeConfirmAction,cancelLabel:n.cancel,destructive:!0,onConfirm:()=>{O&&z(O)},onCancel:()=>k(null)}),(0,$.jsx)(zn,{open:A,onOpenChange:e=>{j(e),e||ee(null)},providerId:e,model:M?.model??null,isNew:M?.isNew??!1,onSave:e=>void L(e),m:s})]})}var Kn=[`fast`,`reasoning`,`coding`,`review`,`vision`,`understanding`],qn=`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`,Jn={en:{fast:[`Fast tasks`,`Short, low-latency work`],reasoning:[`Complex reasoning`,`Planning and multi-step analysis`],coding:[`Coding`,`Implementation and debugging`],review:[`Review`,`Critique and verification`],vision:[`Vision`,`Image and visual analysis`],understanding:[`Understanding`,`Long-form content comprehension`]},zh:{fast:[`快速任务`,`简短、低延迟的工作`],reasoning:[`复杂推理`,`规划和多步骤分析`],coding:[`编程`,`实现、调试和代码修改`],review:[`审查`,`检查、批评和验证`],vision:[`视觉任务`,`图片和视觉内容分析`],understanding:[`内容理解`,`长内容阅读和理解`]}};function Yn(e,t){return{primary:t,fallbacks:e?.fallbacks??[]}}function Xn(e){let t=(0,Ut.c)(38),{draft:n,setDraft:r,zh:i,capability:a}=e,o;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(o={revalidateOnFocus:!1},t[0]=o):o=t[0];let s=X(De,Ee,o),c;t[1]===s.data?c=t[2]:(c=s.data??[],t[1]=s.data,t[2]=c);let l=c,u=i?Jn.zh:Jn.en,d;t[3]!==n||t[4]!==r?(d=(e,t)=>{let i={...n.models.intents};t?i[e]=Yn(i[e],t):delete i[e],r({...n,models:{...n.models,intents:i}})},t[3]=n,t[4]=r,t[5]=d):d=t[5];let f=d,p;t[6]!==a||t[7]!==n||t[8]!==l||t[9]!==s.error||t[10]!==s.isLoading||t[11]!==r||t[12]!==i?(p=a===`chat`?(0,$.jsx)(`section`,{className:`rounded-xl bg-surface-hover/20 p-5`,children:(0,$.jsx)(vt,{title:i?`模型回退`:`Model fallbacks`,summary:i?`已配置 ${n.models.chat.fallbacks.length} 个备用模型。`:`${n.models.chat.fallbacks.length} fallback models configured.`,children:(0,$.jsx)(`div`,{className:`mt-6 rounded-xl bg-surface-base/45 p-4`,children:(0,$.jsx)(Bt,{primary:n.models.chat.primary,value:n.models.chat.fallbacks,models:l,loading:s.isLoading,error:s.error,zh:i,onChange:e=>r({...n,models:{...n.models,chat:{...n.models.chat,fallbacks:e}}})})})})}):null,t[6]=a,t[7]=n,t[8]=l,t[9]=s.error,t[10]=s.isLoading,t[11]=r,t[12]=i,t[13]=p):p=t[13];let m;t[14]!==a||t[15]!==n||t[16]!==r||t[17]!==i?(m=a===`image`?(0,$.jsx)(`section`,{className:`rounded-xl bg-surface-hover/20 p-5`,children:n.models.imageGeneration?(0,$.jsx)(vt,{title:i?`图片执行策略`:`Image execution policy`,summary:i?`当前超时与回退策略继续生效。`:`The current timeout and fallback policy remains active.`,children:(0,$.jsxs)(`div`,{className:`mt-5 grid gap-4 rounded-xl bg-surface-base/45 p-4 sm:grid-cols-2`,children:[(0,$.jsxs)(`label`,{className:`block text-xs font-medium text-fg-muted`,children:[i?`生成超时(毫秒)`:`Generation timeout (ms)`,(0,$.jsx)(St,{allowEmpty:!0,type:`number`,min:1,className:`${qn} mt-2`,value:n.models.imageGeneration.timeoutMs??``,onChange:e=>r({...n,models:{...n.models,imageGeneration:{...n.models.imageGeneration,timeoutMs:e.target.value?Number(e.target.value):void 0}}})})]}),(0,$.jsxs)(`div`,{className:`text-xs font-medium text-fg-muted`,children:[(0,$.jsx)(`span`,{children:i?`服务商自动回退`:`Automatic provider fallback`}),(0,$.jsx)(Ge,{className:`mt-1.5 flex rounded-lg bg-surface-panel p-1`,role:`group`,"aria-label":i?`服务商自动回退`:`Automatic provider fallback`,children:[!0,!1].map(e=>(0,$.jsx)(Z,{"aria-pressed":n.models.imageGeneration?.autoProviderFallback===e,variant:n.models.imageGeneration?.autoProviderFallback===e?`secondary`:`ghost`,className:`flex-1 py-1.5 text-xs`,onClick:()=>r({...n,models:{...n.models,imageGeneration:{...n.models.imageGeneration,autoProviderFallback:e}}}),children:e?i?`开启`:`On`:i?`关闭`:`Off`},String(e)))})]})]})}):null}):null,t[14]=a,t[15]=n,t[16]=r,t[17]=i,t[18]=m):m=t[18];let h;t[19]!==a||t[20]!==n||t[21]!==l||t[22]!==s.error||t[23]!==s.isLoading||t[24]!==r||t[25]!==i?(h=a===`vision`&&n.models.imageUnderstanding?(0,$.jsx)(vt,{title:i?`模型回退`:`Model fallbacks`,summary:i?`主模型不可用时使用已配置的备用模型。`:`Use configured fallback models when the primary is unavailable.`,children:(0,$.jsx)(Bt,{primary:n.models.imageUnderstanding.primary,value:n.models.imageUnderstanding.fallbacks,models:l.filter(Zn),loading:s.isLoading,error:s.error,zh:i,onChange:e=>r({...n,models:{...n.models,imageUnderstanding:{...n.models.imageUnderstanding,fallbacks:e}}})})}):null,t[19]=a,t[20]=n,t[21]=l,t[22]=s.error,t[23]=s.isLoading,t[24]=r,t[25]=i,t[26]=h):h=t[26];let g;t[27]!==a||t[28]!==u||t[29]!==n||t[30]!==f||t[31]!==i?(g=a===`chat`?(0,$.jsx)(vt,{title:i?`任务模型路由`:`Task model routing`,summary:i?`已配置 ${Object.keys(n.models.intents).length} 类任务路由;其他任务使用默认模型。`:`${Object.keys(n.models.intents).length} task routes configured; other tasks use the default model.`,children:(0,$.jsxs)(`section`,{className:`rounded-xl bg-surface-hover/20 p-5`,children:[(0,$.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:i?`按任务选择模型`:`Route by task`}),(0,$.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:i?`仅在确实需要不同模型时设置;否则保持“使用默认对话模型”。`:`Set a route only when a task genuinely needs another model; otherwise keep the default.`}),(0,$.jsx)(`div`,{className:`mt-5 grid gap-3 lg:grid-cols-2`,children:Kn.map(e=>(0,$.jsxs)(`div`,{className:`rounded-xl bg-surface-base/55 p-4`,children:[(0,$.jsxs)(`div`,{className:`mb-3`,children:[(0,$.jsx)(`h3`,{className:`text-sm font-medium text-fg`,children:u[e][0]}),(0,$.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-muted`,children:u[e][1]})]}),(0,$.jsx)(Ye,{value:n.models.intents[e]?.primary??``,placeholder:i?`使用默认对话模型`:`Use default conversation model`,searchPlaceholder:i?`搜索模型或服务商`:`Search models or providers`,noMatches:i?`没有匹配的模型`:`No matching models`,allowEmpty:!0,emptyLabel:i?`使用默认对话模型`:`Use default conversation model`,showProviderInTrigger:!1,contentAlign:`start`,className:`w-full`,ariaLabel:i?`${u[e][0]}模型`:`${u[e][0]} model`,onChange:t=>f(e,t)})]},e))})]})}):null,t[27]=a,t[28]=u,t[29]=n,t[30]=f,t[31]=i,t[32]=g):g=t[32];let _;return t[33]!==p||t[34]!==m||t[35]!==h||t[36]!==g?(_=(0,$.jsxs)(`div`,{className:`space-y-5`,children:[p,m,h,g]}),t[33]=p,t[34]=m,t[35]=h,t[36]=g,t[37]=_):_=t[37],_}function Zn(e){return e.vision}function Qn(e){let t=(0,Ut.c)(9),{data:n,error:r}=X(`settings-agent-defaults`,$e);if(r&&!n){let e=String(r),n;return t[0]===e?n=t[1]:(n=(0,$.jsx)(`p`,{role:`alert`,className:`text-sm text-danger`,children:e}),t[0]=e,t[1]=n),n}if(!n){let e;return t[2]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(Se,{className:`h-32 rounded-xl`}),t[2]=e):e=t[2],e}let i;t[3]===n.defaults.models?i=t[4]:(i=JSON.stringify(n.defaults.models),t[3]=n.defaults.models,t[4]=i);let a;return t[5]!==n.defaults||t[6]!==e||t[7]!==i?(a=(0,$.jsx)($n,{...e,initial:n.defaults},i),t[5]=n.defaults,t[6]=e,t[7]=i,t[8]=a):a=t[8],a}function $n(e){let t=(0,Ut.c)(36),{initial:n,capability:r,zh:i,disabled:a,onPendingChange:o}=e,s;t[0]===n?s=t[1]:(s=()=>structuredClone(n),t[0]=n,t[1]=s);let[c,l]=(0,Q.useState)(s),u;t[2]===n?u=t[3]:(u=()=>structuredClone(n),t[2]=n,t[3]=u);let[d,f]=(0,Q.useState)(u),p;t[4]===c.models?p=t[5]:(p=JSON.stringify(c.models),t[4]=c.models,t[5]=p);let m;t[6]===d.models?m=t[7]:(m=JSON.stringify(d.models),t[6]=d.models,t[7]=m);let h=p!==m,g;t[8]!==n.models||t[9]!==i?(g=async e=>{let t=await $e();if(JSON.stringify(t.defaults.models)!==JSON.stringify(n.models))throw Error(i?`模型设置已变化,请刷新后重试。`:`Model settings changed. Refresh before retrying.`);let r=await Qe({...t.defaults,models:e.models},{scope:`models`,expectedModels:n.models});f(r.defaults),await at()},t[8]=n.models,t[9]=i,t[10]=g):g=t[10];let _=g,v;t[11]!==h||t[12]!==c||t[13]!==_?(v={value:c,dirty:h,onSave:_,delayMs:0},t[11]=h,t[12]=c,t[13]=_,t[14]=v):v=t[14];let y=Ot(v),b=h||y.status===`saving`||!!y.error,x,S;t[15]!==o||t[16]!==b?(x=()=>(o(b),()=>o(!1)),S=[b,o],t[15]=o,t[16]=b,t[17]=x,t[18]=S):(x=t[17],S=t[18]),(0,Q.useEffect)(x,S);let C=a||y.status===`saving`,w;t[19]!==y.error||t[20]!==y.status?(w=(0,$.jsx)(Dt,{status:y.status,error:y.error}),t[19]=y.error,t[20]=y.status,t[21]=w):w=t[21];let T;t[22]!==y.error||t[23]!==y.retry||t[24]!==i?(T=y.error?(0,$.jsx)(Z,{variant:`secondary`,onClick:y.retry,children:i?`重试保存`:`Retry saving`}):null,t[22]=y.error,t[23]=y.retry,t[24]=i,t[25]=T):T=t[25];let E;t[26]!==r||t[27]!==c||t[28]!==i?(E=(0,$.jsx)(Xn,{capability:r,draft:c,setDraft:l,zh:i}),t[26]=r,t[27]=c,t[28]=i,t[29]=E):E=t[29];let D;return t[30]!==y.onBlurCapture||t[31]!==w||t[32]!==T||t[33]!==E||t[34]!==C?(D=(0,$.jsxs)(`fieldset`,{disabled:C,onBlurCapture:y.onBlurCapture,className:`min-w-0 space-y-3`,children:[w,T,E]}),t[30]=y.onBlurCapture,t[31]=w,t[32]=T,t[33]=E,t[34]=C,t[35]=D):D=t[35],D}function er(e){return e.status===`ready`?`ready`:e.status===`disabled`?`off`:e.status===`degraded`?`degraded`:e.rejected?.length?`misconfigured`:`not-configured`}function tr(e,t){if(e.startsWith(`agentCatalog.defaults.models`))return{label:t?`模型与能力`:`Models and capabilities`,href:`/settings/capabilities/models`};let n=e.match(/^agentCatalog\.agents\.([^.]+)\.models/);return n?.[1]?{label:t?`智能体 ${n[1]}`:`Agent ${n[1]}`,href:Ze(n[1])}:e.startsWith(`sessions.`)?{label:t?`会话模型覆盖`:`Session model override`,href:`/settings/sessions`}:{label:e,href:`/settings/agent-defaults`}}function nr(e,t){switch(e){case`computer-use`:return{guidance:t?`选择兼容的电脑控制模型;本机权限需单独授权`:`Select a compatible computer model; local access requires separate approval`,action:t?`配置电脑控制`:`Configure computer use`};case`vision`:return{guidance:t?`接入支持图片理解的模型服务`:`Connect a model service that supports vision`,action:t?`去接入模型`:`Connect model`};case`image-generation`:return{guidance:t?`选择图片模型并配置所需凭据`:`Choose an image model and configure its credentials`,action:t?`去配置图片生成`:`Configure image generation`};case`stt`:return{guidance:t?`选择语音识别服务,或安装自管 STT 插件`:`Choose a speech-to-text service or install a self-managed STT plugin`,action:t?`去配置语音识别`:`Configure speech-to-text`};case`tts`:return{guidance:t?`选择语音合成服务并完成凭据配置`:`Choose a text-to-speech service and configure its credentials`,action:t?`去配置语音合成`:`Configure text-to-speech`}}}async function rr(){let e=await u(d(`/api/models/catalog`)),t=await e.json().catch(()=>null);if(!e.ok||!t?.ok||!t.payload)throw Error(t?.error?.message??`HTTP ${e.status}`);return t.payload}async function ir(){let e=await u(d(`/api/capabilities/readiness`)),t=await e.json().catch(()=>null);if(!e.ok||!t?.ok||!t.payload)throw Error(t?.error?.message??`HTTP ${e.status}`);return t.payload}function ar({showCapabilities:e=!0,embedded:t=!1}={}){let n=p(e=>e.language)===`zh`,{data:r,error:i,isLoading:a}=X(ot,rr,{revalidateOnFocus:!0,refreshInterval:6e4}),{data:o}=X(st,ir,{revalidateOnFocus:!1}),[s,c]=(0,Q.useState)(!1),[f,m]=(0,Q.useState)(null),h=Object.values(r?.sources??{}),g=h.reduce((e,t)=>e+t.models.filter(e=>e.availability===`available`).length,0),_=(r?.references??[]).filter(e=>e.availability===`unavailable`),v=r?.sync.lastSuccessAt??Math.max(0,...h.map(e=>e.lastSuccessAt)),y=!!i,b=r?.sync.sourceErrors??{},x=[...r?.sync.lastError?[[`catalog`,r.sync.lastError]]:[],...Object.entries(b),...f?[[`refresh`,f]]:[],...i instanceof Error?[[`load`,i.message]]:[]],S=r?.sync.lastAttemptAt??v,w=Object.entries(o?.capabilities??{}).filter(([e])=>e!==`computer-use`||He()),E=w.some(([,e])=>{let t=er(e);return t===`degraded`||t===`misconfigured`}),D=w.filter(([,e])=>er(e)===`ready`).length,O=(0,Q.useRef)(null);if((0,Q.useEffect)(()=>{E&&!a&&O.current?.setAttribute(`open`,``)},[E,a]),a)return(0,$.jsx)(Se,{className:`h-24 w-full rounded-2xl`});let j=async()=>{c(!0),m(null);try{let e=await u(d(`/api/models/catalog/refresh`),{method:`POST`});if(!e.ok)throw Error(`HTTP ${e.status}`);await at()}catch(e){m(e instanceof Error?e.message:String(e))}finally{c(!1)}},M=(0,$.jsx)(`div`,{className:`mt-2 space-y-1 rounded-lg bg-surface-base/45 p-2 font-mono text-[11px] leading-5`,"aria-label":n?`同步错误详情`:`Sync error details`,children:x.map(([e,t],n)=>(0,$.jsxs)(`p`,{className:`break-words`,children:[e,`: `,t]},`${e}-${n}`))}),ee=(0,$.jsxs)(`div`,{className:`mt-3 flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between`,children:[(0,$.jsxs)(`div`,{className:`min-w-0 text-xs text-fg-muted`,children:[(0,$.jsx)(`p`,{children:n?`${h.length} 个来源,${g} 个可用模型${v?` · 最近同步 ${new Date(v).toLocaleString()}`:``}`:`${h.length} sources, ${g} available models${v?` · Last synced ${new Date(v).toLocaleString()}`:``}`}),x.length>0?t?(0,$.jsxs)(`details`,{className:`mt-2 rounded-lg bg-surface-base/45 p-2`,children:[(0,$.jsx)(`summary`,{className:`cursor-pointer rounded text-xs font-medium focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:n?`高级诊断`:`Advanced diagnostics`}),M]}):M:null]}),(0,$.jsxs)(Z,{className:`shrink-0`,type:`button`,variant:`secondary`,disabled:s,onClick:()=>void j(),children:[s?(0,$.jsx)(de,{className:`size-4 animate-spin`,"aria-hidden":!0}):(0,$.jsx)(me,{className:`size-4`,"aria-hidden":!0}),s?n?`刷新中…`:`Refreshing…`:n?`刷新目录`:`Refresh catalog`]})]});return(0,$.jsxs)(`section`,{className:t?`mt-4 border-t border-edge-subtle pt-1`:`rounded-xl bg-surface-hover/25 p-4 sm:p-5`,children:[e?(0,$.jsxs)(`details`,{ref:O,className:`group`,children:[(0,$.jsx)(`summary`,{className:`cursor-pointer list-none rounded-lg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:(0,$.jsxs)(`div`,{className:`flex min-h-10 items-center gap-2`,children:[E?(0,$.jsx)(ye,{className:`size-4 text-amber-500`,"aria-hidden":!0}):D===w.length&&w.length>0?(0,$.jsx)(k,{className:`size-4 text-emerald-500`,"aria-hidden":!0}):(0,$.jsx)(A,{className:`size-4 text-fg-muted`,"aria-hidden":!0}),(0,$.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,$.jsx)(`span`,{className:`block text-sm font-semibold text-fg`,children:n?`可选能力`:`Optional capabilities`}),(0,$.jsx)(`span`,{className:`mt-0.5 block text-xs font-normal text-fg-muted`,children:n?`${D}/${w.length} 项已配置,不影响基础聊天功能`:`${D} of ${w.length} configured · Not required for chat`})]}),(0,$.jsx)(T,{className:`size-4 shrink-0 text-fg-subtle transition-transform group-open:rotate-90 motion-reduce:transition-none`,"aria-hidden":!0})]})}),o?(0,$.jsx)(`div`,{className:`mt-3 grid gap-1 sm:grid-cols-2`,children:Object.entries(o.capabilities).map(([e,t])=>{if(e===`computer-use`&&!He())return null;let r=e===`vision`?n?`图片理解`:`Vision`:e===`image-generation`?n?`图片生成`:`Image generation`:e===`computer-use`?n?`电脑控制模型`:`Computer use model`:e.toUpperCase(),i=t.selectionSource!==`explicit-config`,a=er(t),o=a===`degraded`||a===`misconfigured`,s=nr(e,n),c=(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[(0,$.jsx)(`span`,{className:`min-w-0 text-xs font-medium text-fg`,children:r}),(0,$.jsx)(`span`,{className:a===`ready`?`shrink-0 text-xs text-emerald-600 dark:text-emerald-400`:a===`off`||a===`not-configured`?`shrink-0 text-xs text-fg-muted`:`shrink-0 text-xs text-amber-600 dark:text-amber-400`,children:a===`ready`?e===`computer-use`?n?`已配置`:`Configured`:n?`可用`:`Ready`:a===`off`?n?`已关闭`:`Off`:a===`not-configured`?n?`未配置`:`Not configured`:a===`degraded`?n?`正在使用备用方案`:`Using fallback`:n?`需处理`:`Needs attention`})]}),(0,$.jsx)(`p`,{className:`mt-1 truncate text-xs text-fg-muted`,title:t.primary?`${t.primary.provider}/${t.primary.model}`:void 0,children:t.primary?`${i?n?`自动`:`Auto`:n?`显式`:`Explicit`} · ${t.primary.provider}/${t.primary.model}`:a===`not-configured`?n?`可稍后按需配置`:`Set up later if needed`:n?`已配置的模型不可用`:`The configured model is unavailable`}),o?(0,$.jsxs)(`div`,{className:`mt-2 rounded-lg bg-amber-500/10 p-2`,children:[(0,$.jsx)(`p`,{className:`text-xs leading-5 text-amber-700 dark:text-amber-300`,children:t.status===`degraded`?n?`当前配置不可用,正在使用备用方案。${s.guidance}`:`The current configuration is unavailable, so a fallback is in use. ${s.guidance}.`:s.guidance}),(0,$.jsxs)(`span`,{className:`mt-1 inline-flex items-center gap-1 text-xs font-medium text-accent`,children:[s.action,(0,$.jsx)(C,{className:`size-3.5`,"aria-hidden":!0})]})]}):null]}),u={"aria-label":o?`${r}:${s.action}`:`${n?`配置`:`Configure`} ${r}`,className:Y(`rounded-lg bg-surface-base/45 px-3 py-3 text-left transition-colors`,o?`bg-amber-500/5 hover:bg-amber-500/10`:`hover:bg-surface-hover/30`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`)};if(e===`computer-use`)return(0,$.jsx)(l,{to:`/settings/computer-use`,...u,children:c},e);let d={vision:`vision`,"image-generation":`image`,stt:`transcription`,tts:`speech`}[e];return(0,$.jsx)(`button`,{type:`button`,"aria-haspopup":`dialog`,...u,onClick:()=>Ae(d,o?`services`:`settings`),children:c},e)})}):null]}):null,_.length>0?(0,$.jsx)(`div`,{className:`mt-3 space-y-2`,"aria-live":`polite`,children:_.map(e=>(0,$.jsx)(`div`,{className:`rounded-lg border border-amber-500/25 bg-amber-500/5 p-3`,children:(()=>{let t=e.ref.split(`/`)[0]??``,r=!!b[t],i=tr(e.locations[0]??``,n);return(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,$.jsx)(ye,{className:`mt-0.5 size-4 shrink-0 text-amber-500`,"aria-hidden":!0}),(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,$.jsxs)(`p`,{className:`break-words text-sm font-medium text-fg`,children:[e.ref,(0,$.jsx)(`span`,{className:`ml-2 font-normal text-amber-700 dark:text-amber-300`,children:r?n?`暂时无法验证`:`Temporarily unverified`:n?`不可用`:`Unavailable`})]}),(0,$.jsxs)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:[r?n?`模型目录同步暂时失败,当前状态可能已过期;不会影响其他可用模型。`:`Catalog sync temporarily failed, so this status may be stale. Other available models are unaffected.`:n?`此模型已无法从当前配置中解析,使用它的功能可能失败。`:`This model no longer resolves from the current configuration. Features using it may fail.`,S?` · ${n?`最近检测`:`Last checked`} ${new Date(S).toLocaleString()}`:``]}),e.suggestedRef?(0,$.jsxs)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:[n?`可替换为`:`Suggested replacement`,`:`,(0,$.jsx)(`span`,{className:`font-medium text-fg`,children:e.suggestedRef})]}):null]})]}),(0,$.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-1`,children:[(0,$.jsxs)(Z,{className:`px-2.5 py-1.5 text-xs`,variant:`ghost`,disabled:s,onClick:()=>void j(),children:[s?(0,$.jsx)(de,{className:`size-3.5 animate-spin`,"aria-hidden":!0}):(0,$.jsx)(me,{className:`size-3.5`,"aria-hidden":!0}),s?n?`检测中…`:`Checking…`:n?`重新检测`:`Check again`]}),(0,$.jsx)(Z,{asChild:!0,className:`px-2.5 py-1.5 text-xs`,variant:`ghost`,children:(0,$.jsxs)(l,{to:i.href,children:[(0,$.jsx)(be,{className:`size-3.5`,"aria-hidden":!0}),e.suggestedRef?n?`更换模型`:`Replace model`:n?`调整配置`:`Adjust configuration`]})}),(0,$.jsxs)(`details`,{className:`group/references`,children:[(0,$.jsxs)(`summary`,{className:`touch-target inline-flex cursor-pointer list-none items-center gap-1 rounded-xl px-2.5 py-1.5 text-xs font-medium text-fg-muted hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:[n?`查看 ${e.locations.length} 处引用`:`View ${e.locations.length} ${e.locations.length===1?`reference`:`references`}`,(0,$.jsx)(T,{className:`size-3.5 transition-transform group-open/references:rotate-90 motion-reduce:transition-none`,"aria-hidden":!0})]}),(0,$.jsx)(`ul`,{className:`mt-1 space-y-1 pl-2 text-xs text-fg-muted`,children:e.locations.map(e=>{let t=tr(e,n);return(0,$.jsx)(`li`,{children:(0,$.jsx)(l,{className:`inline-flex rounded px-1.5 py-1 text-accent hover:underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,to:t.href,title:e,children:t.label})},e)})})]})]})]})})()},e.ref))}):null,y||f?(0,$.jsx)(`p`,{className:`mt-3 text-sm text-danger`,role:`alert`,children:y?n?`暂时无法读取模型状态,请重新检测;详细信息可在高级诊断中查看。`:`Model status is temporarily unavailable. Check again; details are available in Advanced diagnostics.`:n?`重新检测失败,请稍后重试;详细信息可在高级诊断中查看。`:`The check failed. Try again later; details are available in Advanced diagnostics.`}):null,t?ee:(0,$.jsxs)(`details`,{className:`mt-4 border-t border-edge-subtle pt-3`,children:[(0,$.jsx)(`summary`,{className:`min-h-8 cursor-pointer rounded-md py-1.5 text-xs font-medium text-fg-muted hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:n?`高级诊断`:`Advanced diagnostics`}),ee]})]})}function or(e){let t=(0,Ut.c)(177),n;t[0]===e?n=t[1]:(n=e===void 0?{}:e,t[0]=e,t[1]=n);let{inlineUse:r,inlineView:i,onViewChange:u,onPendingChange:d}=n,f=i===void 0?`settings`:i,m=p(ur),g=m===`zh`,_;t[2]===m?_=t[3]:(_=h(m),t[2]=m,t[3]=_);let v=_.capabilitiesSettings,{capability:y}=a(),[b,x]=s(),{state:S}=o(),C;t[4]===b?C=t[5]:(C=rt(b.get(`returnTo`)),t[4]=b,t[5]=C);let w=C,[T,E]=(0,Q.useState)(),[D,O]=(0,Q.useState)(!1),[k,A]=(0,Q.useState)(!1),[j,M]=(0,Q.useState)(!1),[ee,N]=(0,Q.useState)(!1),P=j||ee||k,[F,I]=(0,Q.useState)(!1),[L,R]=(0,Q.useState)(null),z=(0,Q.useRef)(null),B=ne(),te;t[6]===B.cards?te=t[7]:(te=B.cards.some(lr),t[6]=B.cards,t[7]=te);let V=te,re=cr,U,W;t[8]!==d||t[9]!==P?(U=()=>(d?.(P),()=>d?.(!1)),W=[P,d],t[8]=d,t[9]=P,t[10]=U,t[11]=W):(U=t[10],W=t[11]),(0,Q.useEffect)(U,W);let ae,G;t[12]!==y||t[13]!==r||t[14]!==S||t[15]!==b||t[16]!==x?(ae=()=>{if(r||y!==`models`)return;let e=tt(b.get(`configure`));if(!e&&b.get(`add`)!==`1`)return;let t=window.setTimeout(()=>{e?Ae(e,b.get(`tab`)===`services`?`services`:`settings`):I(!0);let t=new URLSearchParams(b);t.delete(`configure`),t.delete(`tab`),t.delete(`add`),x(t,{replace:!0,state:S})},0);return()=>window.clearTimeout(t)},G=[y,r,b,x,S],t[12]=y,t[13]=r,t[14]=S,t[15]=b,t[16]=x,t[17]=ae,t[18]=G):(ae=t[17],G=t[18]),(0,Q.useEffect)(ae,G);let oe;t[19]!==r||t[20]!==u||t[21]!==P?(oe=e=>{if(!P){if(!r){Ae(e,`services`);return}u?.(`services`),E(void 0)}},t[19]=r,t[20]=u,t[21]=P,t[22]=oe):oe=t[22];let K=oe,se;t[23]===u?se=t[24]:(se=e=>{re(),u?.(`settings`),E(e)},t[23]=u,t[24]=se);let q=se;if(r){let e=f===`services`,n=ee||k,i;t[25]!==r||t[26]!==K||t[27]!==B||t[28]!==n||t[29]!==g?(i=(0,$.jsx)(Pn,{data:B,zh:g,onlyUse:r,disabled:n,onPendingChange:M,onChange:K}),t[25]=r,t[26]=K,t[27]=B,t[28]=n,t[29]=g,t[30]=i):i=t[30];let a;t[31]!==e||t[32]!==i?(a=(0,$.jsx)(`div`,{hidden:e,children:i}),t[31]=e,t[32]=i,t[33]=a):a=t[33];let o;t[34]!==T||t[35]!==r||t[36]!==f||t[37]!==g?(o=T===r&&f===`settings`?(0,$.jsx)(`p`,{role:`status`,className:`text-sm text-fg-muted`,children:g?`服务设置已保存`:`Service settings saved`}):null,t[34]=T,t[35]=r,t[36]=f,t[37]=g,t[38]=o):o=t[38];let s=f!==`services`,c;t[39]!==q||t[40]!==r?(c=()=>q(r),t[39]=q,t[40]=r,t[41]=c):c=t[41];let l;t[42]!==v.addProviderDialog||t[43]!==r||t[44]!==m||t[45]!==B||t[46]!==c?(l=(0,$.jsx)(xn,{inline:!0,onEditingChange:O,use:r,data:B,language:m,labels:v.addProviderDialog,onPendingChange:A,onSaved:c},r),t[42]=v.addProviderDialog,t[43]=r,t[44]=m,t[45]=B,t[46]=c,t[47]=l):l=t[47];let d;t[48]!==q||t[49]!==D||t[50]!==r||t[51]!==B.builtinRows||t[52]!==g?(d=r===`transcription`||r===`speech`?(0,$.jsx)(`div`,{hidden:D,children:(0,$.jsx)(jn,{kind:r===`transcription`?`stt`:`tts`,modelServiceIds:B.builtinRows.map(sr),zh:g,onPendingChange:A,onSaved:()=>q(r)},r)}):null,t[48]=q,t[49]=D,t[50]=r,t[51]=B.builtinRows,t[52]=g,t[53]=d):d=t[53];let p;t[54]!==D||t[55]!==r||t[56]!==u||t[57]!==g?(p=r===`conversation`&&!D&&(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2 rounded-lg border border-edge p-3`,children:[(0,$.jsx)(`span`,{className:`text-sm text-fg`,children:`Boson AI · Higgs Realtime`}),(0,$.jsx)(Z,{variant:`secondary`,onClick:()=>u?.(`settings`),children:g?`配置 Boson`:`Configure Boson`})]}),t[54]=D,t[55]=r,t[56]=u,t[57]=g,t[58]=p):p=t[58];let h;t[59]!==q||t[60]!==r?(h=r===`image`?(0,$.jsx)(on,{connectOnly:!0,onPendingChange:A,onConnected:()=>q(r)}):null,t[59]=q,t[60]=r,t[61]=h):h=t[61];let _;t[62]!==k||t[63]!==s||t[64]!==l||t[65]!==d||t[66]!==p||t[67]!==h?(_=(0,$.jsxs)(`fieldset`,{hidden:s,disabled:k,className:`min-w-0 space-y-3`,children:[l,d,p,h]}),t[62]=k,t[63]=s,t[64]=l,t[65]=d,t[66]=p,t[67]=h,t[68]=_):_=t[68];let y=f===`services`,b;t[69]!==k||t[70]!==r||t[71]!==j?(b=r===`transcription`||r===`speech`||r===`conversation`?(0,$.jsx)(Pe,{capability:r,onPendingChange:N,disabled:j||k},r):null,t[69]=k,t[70]=r,t[71]=j,t[72]=b):b=t[72];let x;t[73]!==k||t[74]!==r||t[75]!==j||t[76]!==g?(x=r===`chat`||r===`vision`||r===`image`?(0,$.jsx)(Qn,{capability:r,zh:g,disabled:j||k,onPendingChange:N}):null,t[73]=k,t[74]=r,t[75]=j,t[76]=g,t[77]=x):x=t[77];let S;t[78]!==r||t[79]!==g?(S=r===`background`?(0,$.jsx)(`p`,{className:`text-sm text-fg-muted`,children:g?`使用所选模型执行自动化、定时和无人值守任务。此设置不会启用任务,也不会自动改用其他计费服务。`:`Use the selected model for automations, schedules and unattended tasks. This does not enable tasks or automatically switch billing services.`}):null,t[78]=r,t[79]=g,t[80]=S):S=t[80];let C;t[81]!==y||t[82]!==b||t[83]!==x||t[84]!==S?(C=(0,$.jsxs)(`div`,{hidden:y,className:`space-y-4`,children:[b,x,S]}),t[81]=y,t[82]=b,t[83]=x,t[84]=S,t[85]=C):C=t[85];let w;t[86]!==K||t[87]!==o||t[88]!==_||t[89]!==C?(w=(0,$.jsxs)(Ne.Provider,{value:K,children:[o,_,C]}),t[86]=K,t[87]=o,t[88]=_,t[89]=C,t[90]=w):w=t[90];let E;return t[91]!==a||t[92]!==w?(E=(0,$.jsxs)(`div`,{className:`min-w-0 space-y-4`,children:[a,w]}),t[91]=a,t[92]=w,t[93]=E):E=t[93],E}if(y===`search`){let e;t[94]===m?e=t[95]:(e=h(m),t[94]=m,t[95]=e);let n;t[96]===e.nav.settingsSearch?n=t[97]:(n=(0,$.jsx)(wt,{title:e.nav.settingsSearch}),t[96]=e.nav.settingsSearch,t[97]=n);let r;t[98]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,$.jsx)(_n,{}),t[98]=r):r=t[98];let i;return t[99]===n?i=t[100]:(i=(0,$.jsxs)(Ct,{children:[n,r]}),t[99]=n,t[100]=i),i}if(y!==`models`){let e;return t[101]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(c,{to:`/settings/capabilities/models`,replace:!0}),t[101]=e):e=t[101],e}let ce=g?`模型与能力`:`Models and capabilities`,le=g?`按用途选择模型,在设置中调整参数与服务连接。`:`Choose models by purpose. Adjust parameters and connections in settings.`,ue;t[102]===m?ue=t[103]:(ue=Ve(m,`configuration`),t[102]=m,t[103]=ue);let de;t[104]!==v.docsLink||t[105]!==ue?(de=(0,$.jsx)(`a`,{href:ue,target:`_blank`,rel:`noreferrer`,className:`inline-flex min-h-11 items-center rounded-lg px-2 text-xs text-fg-muted hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:v.docsLink}),t[104]=v.docsLink,t[105]=ue,t[106]=de):de=t[106];let J;t[107]===Symbol.for(`react.memo_cache_sentinel`)?(J=()=>{z.current?.scrollIntoView?.({block:`start`}),z.current?.focus({preventScroll:!0})},t[107]=J):J=t[107];let fe=g?`服务账户`:`Service accounts`,pe;t[108]!==P||t[109]!==fe?(pe=(0,$.jsx)(Z,{variant:`secondary`,disabled:P,onClick:J,children:fe}),t[108]=P,t[109]=fe,t[110]=pe):pe=t[110];let me;t[111]!==de||t[112]!==pe?(me=(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[de,pe]}),t[111]=de,t[112]=pe,t[113]=me):me=t[113];let he;t[114]!==ce||t[115]!==le||t[116]!==me?(he=(0,$.jsx)(wt,{title:ce,subtitle:le,actions:me}),t[114]=ce,t[115]=le,t[116]=me,t[117]=he):he=t[117];let ge;t[118]!==w||t[119]!==g?(ge=w?(0,$.jsx)(l,{to:w,className:`text-sm text-accent-fg hover:underline`,children:w===`/settings/phone-use`?g?`返回手机控制并测试模型`:`Return to phone control and test the model`:g?`返回原来的工作`:`Return to your work`}):null,t[118]=w,t[119]=g,t[120]=ge):ge=t[120];let _e;t[121]!==w||t[122]!==g?(_e=w?(0,$.jsx)(`p`,{className:`text-sm text-fg-muted`,children:w===`/settings/phone-use`?g?`正在为手机控制连接模型服务;此处保存服务设置后,还需返回选择并测试手机模型。`:`Connect a model service for phone control, then return to select and test the phone model.`:g?`正在为原来的工作配置模型。服务保存、模型选择和实际运行验证分别生效。`:`Configure models for your work. Saving a service, choosing a model and verifying a run are separate steps.`}):null,t[121]=w,t[122]=g,t[123]=_e):_e=t[123];let ve;t[124]===P?ve=t[125]:(ve=e=>{P||Ae(e)},t[124]=P,t[125]=ve);let ye;t[126]!==K||t[127]!==B||t[128]!==P||t[129]!==ve||t[130]!==g?(ye=(0,$.jsx)(Pn,{data:B,zh:g,disabled:P,onPendingChange:M,onChange:K,onSettings:ve}),t[126]=K,t[127]=B,t[128]=P,t[129]=ve,t[130]=g,t[131]=ye):ye=t[131];let be=g?`连接的服务`:`Connected services`,xe;t[132]===be?xe=t[133]:(xe=(0,$.jsx)(`h2`,{id:`model-services-heading`,className:`text-base font-semibold text-fg`,children:be}),t[132]=be,t[133]=xe);let Y=g?`在这里管理账户和密钥;各项能力的模型与参数在上方调整。`:`Manage accounts and keys here. Choose models and adjust capability settings above.`,Se;t[134]===Y?Se=t[135]:(Se=(0,$.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:Y}),t[134]=Y,t[135]=Se);let Ce;t[136]!==xe||t[137]!==Se?(Ce=(0,$.jsxs)(`div`,{children:[xe,Se]}),t[136]=xe,t[137]=Se,t[138]=Ce):Ce=t[138];let X;t[139]!==v.xopcCloudAccount||t[140]!==V?(X=V?(0,$.jsx)(Ht,{labels:v.xopcCloudAccount,children:(0,$.jsx)(ar,{showCapabilities:!1,embedded:!0})}):null,t[139]=v.xopcCloudAccount,t[140]=V,t[141]=X):X=t[141];let we,Te;t[142]===Symbol.for(`react.memo_cache_sentinel`)?(we=()=>I(!0),Te=(e,t)=>R({providerId:e,isCustom:t}),t[142]=we,t[143]=Te):(we=t[142],Te=t[143]);let Ee;t[144]!==v.connectedProviders||t[145]!==B?(Ee=(0,$.jsx)(ie,{labels:v.connectedProviders,data:B,onAdd:we,onManage:Te}),t[144]=v.connectedProviders,t[145]=B,t[146]=Ee):Ee=t[146];let De;t[147]!==V||t[148]!==B.cards.length?(De=!V&&B.cards.length>0?(0,$.jsx)(ar,{showCapabilities:!1}):null,t[147]=V,t[148]=B.cards.length,t[149]=De):De=t[149];let Oe;t[150]!==Ce||t[151]!==X||t[152]!==Ee||t[153]!==De?(Oe=(0,$.jsxs)(`section`,{ref:z,tabIndex:-1,"aria-labelledby":`model-services-heading`,className:`space-y-4 scroll-mt-4 rounded-xl focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:[Ce,X,Ee,De]}),t[150]=Ce,t[151]=X,t[152]=Ee,t[153]=De,t[154]=Oe):Oe=t[154];let ke;t[155]===Symbol.for(`react.memo_cache_sentinel`)?(ke=()=>{re(),I(!1)},t[155]=ke):ke=t[155];let je;t[156]!==F||t[157]!==v.addProviderDialog||t[158]!==m||t[159]!==B.builtinRows||t[160]!==B.customConfig?(je=(0,$.jsx)(H,{open:F,connectOnly:!0,onOpenChange:I,builtinRows:B.builtinRows,customConfig:B.customConfig,labels:v.addProviderDialog,language:m,onSaved:ke}),t[156]=F,t[157]=v.addProviderDialog,t[158]=m,t[159]=B.builtinRows,t[160]=B.customConfig,t[161]=je):je=t[161];let Me;t[162]!==v.manageProviderDialog||t[163]!==m||t[164]!==L||t[165]!==B.allModels||t[166]!==B.builtinRows||t[167]!==B.customConfig?(Me=L?(0,$.jsx)(Un,{open:!0,onOpenChange:e=>{e||R(null)},providerId:L.providerId,isCustom:L.isCustom,builtinRows:B.builtinRows,customConfig:B.customConfig,allModels:B.allModels,labels:v.manageProviderDialog,language:m,onSaved:re}):null,t[162]=v.manageProviderDialog,t[163]=m,t[164]=L,t[165]=B.allModels,t[166]=B.builtinRows,t[167]=B.customConfig,t[168]=Me):Me=t[168];let Fe;return t[169]!==he||t[170]!==ge||t[171]!==_e||t[172]!==ye||t[173]!==Oe||t[174]!==je||t[175]!==Me?(Fe=(0,$.jsxs)(Ct,{children:[he,ge,_e,ye,Oe,je,Me]}),t[169]=he,t[170]=ge,t[171]=_e,t[172]=ye,t[173]=Oe,t[174]=je,t[175]=Me,t[176]=Fe):Fe=t[176],Fe}function sr(e){return e.id}function cr(){at()}function lr(e){return e.id===`xopc-cloud`&&!e.isCustom}function ur(e){return e.language}export{or as CapabilitiesSettingsPanel};