@xopcai/xopc 0.0.432 → 0.0.433
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.
- package/dist/browser-ext/manifest.json +1 -1
- package/dist/extensions/feishu/src/adapters/cli-login.js +3 -3
- package/dist/extensions/feishu/src/outbound/media-load.js +1 -1
- package/dist/extensions/telegram/src/inbound-processor.js +2 -2
- package/dist/extensions/telegram/src/outbound-sender.js +1 -1
- package/dist/extensions/telegram/src/plugin.js +2 -2
- package/dist/extensions/telegram/xopc.extension.json +1 -1
- package/dist/extensions/weixin/src/api/api.js +2 -2
- package/dist/extensions/weixin/src/auth/accounts.js +12 -12
- package/dist/extensions/weixin/src/messaging/debug-mode.js +5 -5
- package/dist/extensions/weixin/src/messaging/inbound.js +11 -11
- package/dist/gateway/static/root/assets/{activity-store-iTw0JzOx.js → activity-store-BpYGrRXw.js} +1 -1
- package/dist/gateway/static/root/assets/{agent-avatar-dicebear-CXuMwQ4y.js → agent-avatar-dicebear-DTgOSv6G.js} +1 -1
- package/dist/gateway/static/root/assets/{agent-avatar-display-hRyDKdPJ.js → agent-avatar-display-BUH7ljEo.js} +2 -2
- package/dist/gateway/static/root/assets/{agent-defaults-settings-panel-BBRKBHLB.js → agent-defaults-settings-panel-B_FAikHA.js} +1 -1
- package/dist/gateway/static/root/assets/{agent-plugin-dialog-PoKk6j20.js → agent-plugin-dialog-DPabZaSE.js} +1 -1
- package/dist/gateway/static/root/assets/{agents--P5-QEHR.js → agents-BAPYP1Ka.js} +3 -3
- package/dist/gateway/static/root/assets/{agents-admin-api-DuYzWKP8.js → agents-admin-api-CXCAHNPj.js} +1 -1
- package/dist/gateway/static/root/assets/{api-BeNB3MkI.js → api-DMbimMEi.js} +1 -1
- package/dist/gateway/static/root/assets/{api-DT_Aly4B.js → api-oIK4hYkJ.js} +1 -1
- package/dist/gateway/static/root/assets/{app-management-settings-panel-C4JhA-Kz.js → app-management-settings-panel-BZ3Fy8ZR.js} +1 -1
- package/dist/gateway/static/root/assets/{appearance-settings-YM311zxY.js → appearance-settings-DsRTj1by.js} +1 -1
- package/dist/gateway/static/root/assets/{apps-page-BrnAMjXr.js → apps-page-D-n71lO1.js} +1 -1
- package/dist/gateway/static/root/assets/{archive-plugin-DoYjGZv1.js → archive-plugin-Bg1VTieK.js} +1 -1
- package/dist/gateway/static/root/assets/{automation-api-ZD1VY9jO.js → automation-api-CLPsgcQN.js} +1 -1
- package/dist/gateway/static/root/assets/{automation-result-state-BO5N3gMt.js → automation-result-state-CKVnR4KG.js} +1 -1
- package/dist/gateway/static/root/assets/{automation-task-card--K7uiKHL.js → automation-task-card-D27Mw66U.js} +1 -1
- package/dist/gateway/static/root/assets/{automations-page-Clcl5MI7.js → automations-page-DGNTJ8lN.js} +1 -1
- package/dist/gateway/static/root/assets/{automations-workspace-DM67xMcR.js → automations-workspace-DWDWy-SG.js} +2 -2
- package/dist/gateway/static/root/assets/{binary-plugins-B-dkI6-B.js → binary-plugins-CuwSdCG5.js} +1 -1
- package/dist/gateway/static/root/assets/{block-editor-CB6KruU-.js → block-editor-Dtl2BG3t.js} +1 -1
- package/dist/gateway/static/root/assets/{browser-automation-inputs-Bk_QFbzb.js → browser-automation-inputs-uGK086ag.js} +1 -1
- package/dist/gateway/static/root/assets/{browser-automations-page-54eckhYq.js → browser-automations-page-Da_edNNS.js} +1 -1
- package/dist/gateway/static/root/assets/{browser-control-api-B4T1KPPz.js → browser-control-api-k3OOX3bS.js} +1 -1
- package/dist/gateway/static/root/assets/{browser-settings-page-rOmS1-T8.js → browser-settings-page-C1bSw-Jq.js} +1 -1
- package/dist/gateway/static/root/assets/{capabilities-DBDeifNA.js → capabilities-CoeuLRt6.js} +1 -1
- package/dist/gateway/static/root/assets/{capabilities-D_Uqx5il.js → capabilities-DlHPLld_.js} +1 -1
- package/dist/gateway/static/root/assets/{capabilities-page-DOMoAom0.js → capabilities-page-IcwojmJK.js} +2 -2
- package/dist/gateway/static/root/assets/{capabilities-settings-panel-iQPbNO4A.js → capabilities-settings-panel-CtY-bGIi.js} +1 -1
- package/dist/gateway/static/root/assets/{channels-DsEP_hFB.js → channels-Cn1MWBL_.js} +1 -1
- package/dist/gateway/static/root/assets/{chat-agents-api-D5-xZdAt.js → chat-agents-api-BB0biwc7.js} +1 -1
- package/dist/gateway/static/root/assets/{chat-chart-block-B-ri4wfk.js → chat-chart-block-QSvjx4w6.js} +1 -1
- package/dist/gateway/static/root/assets/{chat-page-DQNLsOad.js → chat-page-CwP4OMdW.js} +11 -11
- package/dist/gateway/static/root/assets/{chat-terminal-dock-RcrdmYe8.js → chat-terminal-dock-Cd51G9eG.js} +1 -1
- package/dist/gateway/static/root/assets/{command-palette-api-DFd-zOz_.js → command-palette-api-CEG10uE-.js} +1 -1
- package/dist/gateway/static/root/assets/{composer-payload-handoff-hccuv1Lk.js → composer-payload-handoff-Bogdq9Hy.js} +1 -1
- package/dist/gateway/static/root/assets/{computer-settings-page-C-7YLU9l.js → computer-settings-page-DyAlOzqY.js} +1 -1
- package/dist/gateway/static/root/assets/{connected-providers-grid-DziNfbFz.js → connected-providers-grid-D0lXg22c.js} +1 -1
- package/dist/gateway/static/root/assets/{connector-service-page-C3ZhlR8V.js → connector-service-page-k2rjyjrp.js} +1 -1
- package/dist/gateway/static/root/assets/{connectors-api-D6CPY0Nu.js → connectors-api-DtvB9Cjm.js} +1 -1
- package/dist/gateway/static/root/assets/{connectors-page-CcG3V3OB.js → connectors-page-DI_Q0CKz.js} +1 -1
- package/dist/gateway/static/root/assets/{date-picker-D3bxeryy.js → date-picker-CAankdQw.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-B7kSoCSo.js → desktop-pet-DjM73fir.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-settings-3dEeKSHA.js → desktop-pet-settings-Rmh-GxHl.js} +1 -1
- package/dist/gateway/static/root/assets/{dev-view-store-Dk7ylv5S.js → dev-view-store-BgW2Riyk.js} +1 -1
- package/dist/gateway/static/root/assets/{device-pairing-wizard-CstPAnnj.js → device-pairing-wizard-UdzSpNa5.js} +1 -1
- package/dist/gateway/static/root/assets/{directory-picker-path-field-BUGqS-lm.js → directory-picker-path-field-Rkw3f7lG.js} +1 -1
- package/dist/gateway/static/root/assets/{discussion-annotation-sync-D9-wFJDS.js → discussion-annotation-sync-Dudoj_Fz.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-debug-page-BDTA9XDE.js → extension-debug-page-DxIGAO23.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-iframe-host-CPEaw2ZG.js → extension-iframe-host-63KpX6IP.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-marketplace-api-edmEFM6F.js → extension-marketplace-api-yXNUkQDA.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-page-Biz-65E8.js → extension-page-C811A_Ww.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-provider-DCur0Xcb.js → extension-provider-C4jLFIgh.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-settings-page-CvPK63oz.js → extension-settings-page-WJSw5MT0.js} +1 -1
- package/dist/gateway/static/root/assets/{file-preview-surface-BFs1sAID.js → file-preview-surface-zE9AcaHM.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-config-swr-C-fPl1hP.js → gateway-config-swr-D6cc6W6E.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-realtime-xZpX_HCq.js → gateway-realtime-BSRNLciy.js} +1 -1
- package/dist/gateway/static/root/assets/gateway-realtime-store-BFeFfApQ.js +1 -0
- package/dist/gateway/static/root/assets/{gateway-restart-BfozBI8f.js → gateway-restart-Unun5hRL.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-settings-A8BUKcfx.js → gateway-settings-DP-DV-e5.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-startup-retry-BRrkiv67.js → gateway-startup-retry-C8g666Ja.js} +1 -1
- package/dist/gateway/static/root/assets/{global-defaults-api-C9O_X0pj.js → global-defaults-api-BObi-1ww.js} +1 -1
- package/dist/gateway/static/root/assets/{home-page-CzS-ROXe.js → home-page-CIcs7Mzy.js} +2 -2
- package/dist/gateway/static/root/assets/{image-generation-api-ohquPPls.js → image-generation-api-C2SqYNyD.js} +1 -1
- package/dist/gateway/static/root/assets/{imports-page-DAebChWv.js → imports-page-C8ezUkOJ.js} +1 -1
- package/dist/gateway/static/root/assets/{index-BinHjymm.js → index-D1_PUrJf.js} +5 -5
- package/dist/gateway/static/root/assets/{install-connector-dialog-xHNBuSj0.js → install-connector-dialog-Cn4nRSyt.js} +1 -1
- package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-Bv4YJpTl.js → keyboard-shortcuts-settings-BRaY4-wA.js} +1 -1
- package/dist/gateway/static/root/assets/{local-app-workbench-page-OhV8UnzK.js → local-app-workbench-page-BZtVcjF3.js} +1 -1
- package/dist/gateway/static/root/assets/{local-apps-page-ADzWmh3T.js → local-apps-page-MqP4EnJm.js} +1 -1
- package/dist/gateway/static/root/assets/{local-session-drafts-DgtYzPiy.js → local-session-drafts-DTq9776a.js} +1 -1
- package/dist/gateway/static/root/assets/{locale-store-fGFrr4_4.js → locale-store-B6OrWgY1.js} +1 -1
- package/dist/gateway/static/root/assets/{logs-page-i0eD_bSC.js → logs-page-hkHBjblX.js} +1 -1
- package/dist/gateway/static/root/assets/{management-settings-C-JTxRjw.js → management-settings-DoX4eTM3.js} +1 -1
- package/dist/gateway/static/root/assets/{markdown-view-Cnt8oxNg.js → markdown-view-DrhYZSmg.js} +1 -1
- package/dist/gateway/static/root/assets/{mcp-conversation-setup-page-BQ_US_jP.js → mcp-conversation-setup-page-BEp5E6TD.js} +1 -1
- package/dist/gateway/static/root/assets/{media-plugins-cphVSfva.js → media-plugins-D987i9Gc.js} +1 -1
- package/dist/gateway/static/root/assets/messages-jwdBhfL9.js +3 -0
- package/dist/gateway/static/root/assets/{model-selector-Bv-anQ6O.js → model-selector-DXm4NS1_.js} +1 -1
- package/dist/gateway/static/root/assets/{models-hub-cache-BLYpN4bJ.js → models-hub-cache-BLcha5rx.js} +1 -1
- package/dist/gateway/static/root/assets/{note-detail-panel-B-pk3LYN.js → note-detail-panel-Cl851ivY.js} +3 -3
- package/dist/gateway/static/root/assets/note-image-lightbox-DGYRJS03.js +1 -0
- package/dist/gateway/static/root/assets/{notes-api-IIQgxlMj.js → notes-api-Ddsf7FVg.js} +1 -1
- package/dist/gateway/static/root/assets/{notes-page-C6l9zI17.js → notes-page-DSwA1MU1.js} +1 -1
- package/dist/gateway/static/root/assets/{oauth-api-BojfhqmL.js → oauth-api-CMmu4DzH.js} +1 -1
- package/dist/gateway/static/root/assets/{oauth-provider-connect-D_p1ez-o.js → oauth-provider-connect-BkhnftBq.js} +1 -1
- package/dist/gateway/static/root/assets/{page-context-capture-button-CiEaCz7v.js → page-context-capture-button-urhQBRaN.js} +1 -1
- package/dist/gateway/static/root/assets/{page-context-draft-BbGvUKjF.js → page-context-draft-BuNUerth.js} +1 -1
- package/dist/gateway/static/root/assets/page-header-store-CEn_kPsn.js +1 -0
- package/dist/gateway/static/root/assets/{personal-avatar-Cq0y6LEK.js → personal-avatar-B49ueeZO.js} +1 -1
- package/dist/gateway/static/root/assets/{personal-page-CDad-FDO.js → personal-page-f05ceuFn.js} +1 -1
- package/dist/gateway/static/root/assets/{personal-settings-panel-yVUzcKoo.js → personal-settings-panel-DLQxzPYr.js} +1 -1
- package/dist/gateway/static/root/assets/{phone-dependencies-card-CM2Mj4rH.js → phone-dependencies-card-DjmC1Z5j.js} +1 -1
- package/dist/gateway/static/root/assets/{phone-model-connection-kJYAiCgI.js → phone-model-connection-BRjHSgYn.js} +1 -1
- package/dist/gateway/static/root/assets/{phone-model-picker-sXs8PpFk.js → phone-model-picker-DgIiWLhR.js} +1 -1
- package/dist/gateway/static/root/assets/{phone-settings-page-ayCImqUb.js → phone-settings-page-DCZGCL_z.js} +1 -1
- package/dist/gateway/static/root/assets/{phone-workspace-store-DoTZvoDh.js → phone-workspace-store-DbqktZbO.js} +1 -1
- package/dist/gateway/static/root/assets/{plugin-details-dialog-B4qZ0obG.js → plugin-details-dialog-D4tGKip4.js} +1 -1
- package/dist/gateway/static/root/assets/{preference-select-fields-oZm_6PvN.js → preference-select-fields-BZWqG7pu.js} +1 -1
- package/dist/gateway/static/root/assets/{product-automation-feedback-Ddj5cmmF.js → product-automation-feedback-DDQUsag7.js} +1 -1
- package/dist/gateway/static/root/assets/{product-open-page-CTuqeUDh.js → product-open-page-BkRP_HmA.js} +1 -1
- package/dist/gateway/static/root/assets/{product-preview-content-Ci8eDZ2h.js → product-preview-content-o2Y3VNE7.js} +1 -1
- package/dist/gateway/static/root/assets/{product-preview-modal-J-9O-eQ2.js → product-preview-modal-7Ohx-7OR.js} +2 -2
- package/dist/gateway/static/root/assets/{project-detail-page-D8QlmMQp.js → project-detail-page-B2RsSHya.js} +1 -1
- package/dist/gateway/static/root/assets/{project-understanding-8DBS77KV.js → project-understanding-BIMouiYX.js} +1 -1
- package/dist/gateway/static/root/assets/{projects-page-CEyyFqca.js → projects-page-C9R5u3tF.js} +1 -1
- package/dist/gateway/static/root/assets/{providers-api-DyX07mht.js → providers-api-BOCkRZ7X.js} +1 -1
- package/dist/gateway/static/root/assets/{recording-upload-DOhMs_aU.js → recording-upload-C6muEHEO.js} +1 -1
- package/dist/gateway/static/root/assets/{registry-api-Bm7kut54.js → registry-api-Bl2guMRg.js} +1 -1
- package/dist/gateway/static/root/assets/{remote-access-hub-DfCkv8XR.js → remote-access-hub-BceSMbCs.js} +1 -1
- package/dist/gateway/static/root/assets/{resource-unavailable-jg8QV_tO.js → resource-unavailable-CUNbPkdj.js} +1 -1
- package/dist/gateway/static/root/assets/{route-preload-Uhpfz1Jz.js → route-preload-C1BKDjnu.js} +2 -2
- package/dist/gateway/static/root/assets/{runtime-tools-api-BpaZgv-a.js → runtime-tools-api-LopLjgvu.js} +1 -1
- package/dist/gateway/static/root/assets/{runtime-tools-settings-panel-CGnX0DY1.js → runtime-tools-settings-panel-9HIPerDP.js} +1 -1
- package/dist/gateway/static/root/assets/{service-recommendation-list-NdwoBa_O.js → service-recommendation-list-CoMI6MB1.js} +1 -1
- package/dist/gateway/static/root/assets/{session-api-BwcBcvzv.js → session-api-Bfmlmn9F.js} +1 -1
- package/dist/gateway/static/root/assets/session-manager-X4UHOjjO.js +25 -0
- package/dist/gateway/static/root/assets/{sessions-page-CAutHonI.js → sessions-page-BT0GdXdS.js} +1 -1
- package/dist/gateway/static/root/assets/settings-advanced-gate-Dk9c-Z5e.js +1 -0
- package/dist/gateway/static/root/assets/{settings-advanced-section-CICMnCwv.js → settings-advanced-section-CEorDLUp.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-mode-store-DCnYgG87.js → settings-mode-store-C2LZqBES.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-page-CZXi8Jro.js → settings-page-C_Np_6qZ.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-page-header-DH1qb4vP.js → settings-page-header-BAN34UQi.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-page-layout-B2G042F2.js → settings-page-layout-B5TVFBV2.js} +1 -1
- package/dist/gateway/static/root/assets/{setup-interaction-page-B-tpfd3l.js → setup-interaction-page-BYvTJW3_.js} +1 -1
- package/dist/gateway/static/root/assets/{setup-status-panel-DtA2Lb-A.js → setup-status-panel-UY2dH-sK.js} +1 -1
- package/dist/gateway/static/root/assets/{share-link-dialog-BjjkGRWn.js → share-link-dialog-BMcXyzr2.js} +1 -1
- package/dist/gateway/static/root/assets/{share-preview-page-BBaJCO3w.js → share-preview-page-UQ6eUM2_.js} +1 -1
- package/dist/gateway/static/root/assets/{shares-api-C1rliVTe.js → shares-api-DOeDN6Tm.js} +1 -1
- package/dist/gateway/static/root/assets/{shares-settings-BMctLz4y.js → shares-settings-W8XhuAoL.js} +1 -1
- package/dist/gateway/static/root/assets/{skill-api-fWp7oUet.js → skill-api-Do_c0d9n.js} +1 -1
- package/dist/gateway/static/root/assets/{skill-list-api-B-2Dod7G.js → skill-list-api-DpHaXI2l.js} +1 -1
- package/dist/gateway/static/root/assets/{skill-reload-api-Cejk-tbD.js → skill-reload-api-DDRd9IJ2.js} +1 -1
- package/dist/gateway/static/root/assets/{skills-page-D-dxO0Vc.js → skills-page-CaeJVKhO.js} +1 -1
- package/dist/gateway/static/root/assets/{system-settings-panel-D-gdBXlK.js → system-settings-panel-DYWlWPJL.js} +1 -1
- package/dist/gateway/static/root/assets/{task-detail-page-CIX4EckU.js → task-detail-page-De0qD7xw.js} +1 -1
- package/dist/gateway/static/root/assets/{task-result-evidence-Dp6gk3xn.js → task-result-evidence-CICR5K1t.js} +1 -1
- package/dist/gateway/static/root/assets/{terminal-panel-store-BDrza-7c.js → terminal-panel-store-BbWUcQe7.js} +1 -1
- package/dist/gateway/static/root/assets/{theme-store-De43hGnm.js → theme-store-TkG5mo0p.js} +1 -1
- package/dist/gateway/static/root/assets/{tracing-settings-page-DlQJAutq.js → tracing-settings-page-CYXEy4EG.js} +1 -1
- package/dist/gateway/static/root/assets/{tunnel-api-BSeDyRBI.js → tunnel-api-DquDm6U2.js} +1 -1
- package/dist/gateway/static/root/assets/{understanding-activity-store-CABSRtdN.js → understanding-activity-store-Ot3wZ3oQ.js} +1 -1
- package/dist/gateway/static/root/assets/{understanding-refresh-store-C5pXQtC9.js → understanding-refresh-store-C5KYFMaC.js} +1 -1
- package/dist/gateway/static/root/assets/{usage-page-Dd6gyHlm.js → usage-page-1xFO4smo.js} +1 -1
- package/dist/gateway/static/root/assets/{use-autosave-BhdMHxgz.js → use-autosave-HL8XRNR8.js} +1 -1
- package/dist/gateway/static/root/assets/{use-composer-attachments-Baw8AHhn.js → use-composer-attachments-XRlQBdNF.js} +1 -1
- package/dist/gateway/static/root/assets/{use-file-preview-expanded-B_cRX1Ih.js → use-file-preview-expanded-CW956CXS.js} +2 -2
- package/dist/gateway/static/root/assets/{use-personal-profile-DL5rDvwX.js → use-personal-profile-202s6tJt.js} +1 -1
- package/dist/gateway/static/root/assets/{use-workspace-tree-DONQqfmT.js → use-workspace-tree-CjydkmH1.js} +1 -1
- package/dist/gateway/static/root/assets/{user-model-page-u2vtyxcX.js → user-model-page-OGPXx3pe.js} +1 -1
- package/dist/gateway/static/root/assets/{voice-api-key-field-OChN73N1.js → voice-api-key-field-CxFu4MEA.js} +1 -1
- package/dist/gateway/static/root/assets/{voice-config-api-CziHHWRu.js → voice-config-api-MHe5Pn-A.js} +1 -1
- package/dist/gateway/static/root/assets/{voice-input-shortcut-events-CWSb-oJe.js → voice-input-shortcut-events-B9xc1oK8.js} +1 -1
- package/dist/gateway/static/root/assets/{voice-transcribe-api-CqEwxj11.js → voice-transcribe-api-CVEcB6Pe.js} +1 -1
- package/dist/gateway/static/root/assets/{work-discovery-overlay-BJT2mARb.js → work-discovery-overlay-C-JoAg2D.js} +1 -1
- package/dist/gateway/static/root/assets/{work-discovery-page-CkHMAnBc.js → work-discovery-page-B5Kx29Ru.js} +1 -1
- package/dist/gateway/static/root/assets/{working-directory-picker-modal-CpZEiO2a.js → working-directory-picker-modal-DGp9cNzH.js} +1 -1
- package/dist/gateway/static/root/assets/{workspace-api-Yi28Sl0C.js → workspace-api-HBXn8pL9.js} +2 -2
- package/dist/gateway/static/root/assets/workspace-editor-agent-store-msZa42fU.js +1 -0
- package/dist/gateway/static/root/assets/{workspace-file-preview-dialog-MLLldcHQ.js → workspace-file-preview-dialog-3cpwSG2w.js} +1 -1
- package/dist/gateway/static/root/assets/{workspace-open-location-menu-CjfDtW9T.js → workspace-open-location-menu-D0VOFvuP.js} +1 -1
- package/dist/gateway/static/root/assets/{xopc-cloud-account-card-FioKsLPf.js → xopc-cloud-account-card-BkdW2p3v.js} +1 -1
- package/dist/gateway/static/root/index.html +78 -78
- package/dist/package.js +1 -1
- package/dist/src/agent/agent-manager.js +18 -18
- package/dist/src/agent/agent-scope.js +2 -2
- package/dist/src/agent/background-review/prompts.js +1 -1
- package/dist/src/agent/background-review/run-background-review.js +12 -12
- package/dist/src/agent/child-agent-factory.js +2 -2
- package/dist/src/agent/context/coordinator.js +2 -2
- package/dist/src/agent/context/execution-context.js +4 -4
- package/dist/src/agent/context/project-context.js +3 -3
- package/dist/src/agent/data-acquisition/service.js +1 -1
- package/dist/src/agent/embedded/codemode-extension.js +1 -1
- package/dist/src/agent/embedded/execution-tool-policy.js +1 -1
- package/dist/src/agent/embedded/external-tool-discovery.js +1 -1
- package/dist/src/agent/embedded/run-for-session.js +6 -6
- package/dist/src/agent/embedded/run-turn.js +19 -19
- package/dist/src/agent/embedded/session-runner.js +4 -4
- package/dist/src/agent/embedded/session-tool-result-guard.js +1 -1
- package/dist/src/agent/embedded/xopc-tools-bridge.js +1 -1
- package/dist/src/agent/external-tools/cliProvider.js +4 -4
- package/dist/src/agent/external-tools/composio-provider.js +4 -4
- package/dist/src/agent/external-tools/endpoint-provider.js +6 -6
- package/dist/src/agent/external-tools/extension-provider.js +1 -1
- package/dist/src/agent/external-tools/gateway-tools.js +3 -3
- package/dist/src/agent/external-tools/memory-provider.js +1 -1
- package/dist/src/agent/image/generation/openai-images-provider.js +1 -1
- package/dist/src/agent/image/generation/runtime.js +1 -1
- package/dist/src/agent/image/index.js +1 -1
- package/dist/src/agent/inbound/attachment-pipeline.js +2 -2
- package/dist/src/agent/inbound/inbound-loop.js +2 -2
- package/dist/src/agent/independent-execution.js +2 -2
- package/dist/src/agent/index.js +3 -3
- package/dist/src/agent/mcp/connection-drafts.js +1 -1
- package/dist/src/agent/mcp/connection-setup.js +1 -1
- package/dist/src/agent/mcp/conversation-setup.js +1 -1
- package/dist/src/agent/mcp/discovery.js +2 -2
- package/dist/src/agent/mcp/transport.js +1 -1
- package/dist/src/agent/memory/index.js +1 -1
- package/dist/src/agent/orchestration/llm-turn-retry.js +1 -1
- package/dist/src/agent/prompt/response-language.js +1 -1
- package/dist/src/agent/prompt/service-prompt-builder.js +3 -3
- package/dist/src/agent/prompt/system-prompt-params.js +1 -1
- package/dist/src/agent/sandbox/exec-policy.js +1 -1
- package/dist/src/agent/service/direct-turn-helpers.js +6 -6
- package/dist/src/agent/service/process-direct-streaming.js +6 -6
- package/dist/src/agent/service/webchat-tts.js +2 -2
- package/dist/src/agent/service.js +22 -22
- package/dist/src/agent/session/session-config-service.js +2 -2
- package/dist/src/agent/session/session-hydrator.js +1 -1
- package/dist/src/agent/session/session-inspector.js +1 -1
- package/dist/src/agent/skills/filesystem-watcher.js +1 -1
- package/dist/src/agent/skills/hub-lock.js +1 -1
- package/dist/src/agent/skills/hub-pull.js +2 -2
- package/dist/src/agent/skills/index.js +1 -1
- package/dist/src/agent/skills/managed-store.js +1 -1
- package/dist/src/agent/skills/marketplace/adapters/store/adapter.js +1 -1
- package/dist/src/agent/skills/marketplace/adapters/store/store-api-client.js +1 -1
- package/dist/src/agent/skills/skill-manage-ops.js +1 -1
- package/dist/src/agent/skills/skill-manager.js +1 -1
- package/dist/src/agent/skills/skill-sources.js +1 -1
- package/dist/src/agent/source-context/index.js +1 -1
- package/dist/src/agent/tasks/task-judge-service.js +8 -8
- package/dist/src/agent/tools/create-share-tool.js +2 -2
- package/dist/src/agent/tools/delegate-tool.js +3 -3
- package/dist/src/agent/tools/exec-command.js +1 -1
- package/dist/src/agent/tools/executor.js +1 -1
- package/dist/src/agent/tools/factory.js +19 -19
- package/dist/src/agent/tools/fetch-text.js +1 -1
- package/dist/src/agent/tools/image-generate-tool.js +2 -2
- package/dist/src/agent/tools/index.js +4 -4
- package/dist/src/agent/tools/list-dir.js +1 -1
- package/dist/src/agent/tools/personal-attention-tool.js +2 -2
- package/dist/src/agent/tools/personal-read-tool.js +1 -1
- package/dist/src/agent/tools/personal-request-result-tool.js +1 -1
- package/dist/src/agent/tools/personal-request-tool.js +4 -4
- package/dist/src/agent/tools/personal-result-tool.js +1 -1
- package/dist/src/agent/tools/personal-task-tool.js +5 -5
- package/dist/src/agent/tools/phone-use-tool.js +1 -1
- package/dist/src/agent/tools/publish-artifacts.js +1 -1
- package/dist/src/agent/tools/read.js +1 -1
- package/dist/src/agent/tools/review-workspace.js +1 -1
- package/dist/src/agent/tools/send-media.js +1 -1
- package/dist/src/agent/tools/skill-manage-tool.js +1 -1
- package/dist/src/agent/tools/task-collaboration-tool.js +2 -2
- package/dist/src/agent/tools/tts-tool.js +1 -1
- package/dist/src/agent/tools/user-context-tool.js +2 -2
- package/dist/src/agent/tools/web.js +1 -1
- package/dist/src/agent/tools/write.js +1 -1
- package/dist/src/agent/tools/xopc-use-tool.js +12 -12
- package/dist/src/agent/transcript/index.js +2 -2
- package/dist/src/agent/transcript/transcript-hygiene.js +2 -2
- package/dist/src/agent-catalog/capabilities.js +2 -2
- package/dist/src/agent-catalog/repository.js +1 -1
- package/dist/src/agent-matching/delegation-service.js +1 -1
- package/dist/src/ai-assist/text-assist.js +1 -1
- package/dist/src/auth/credentials.js +1 -1
- package/dist/src/auth/oauth/openai.js +1 -1
- package/dist/src/auth/oauth/xopc-cloud.js +1 -1
- package/dist/src/auth/profiles/store.js +1 -1
- package/dist/src/automations/api/routes.js +2 -2
- package/dist/src/automations/capabilities/drafts.js +1 -1
- package/dist/src/automations/capabilities/write.js +1 -1
- package/dist/src/automations/configuration-conversation.js +1 -1
- package/dist/src/automations/delivery/delivery-router.js +1 -1
- package/dist/src/automations/domain/index.js +1 -1
- package/dist/src/automations/draft/automation-draft-service.js +1 -1
- package/dist/src/automations/index.js +2 -2
- package/dist/src/automations/service/action-executor.js +2 -2
- package/dist/src/automations/service/automation-service.js +2 -2
- package/dist/src/browser/native-messaging-host.js +1 -1
- package/dist/src/browser/providers/browser-ext-install.js +2 -2
- package/dist/src/capabilities/runtime/dispatcher.js +1 -1
- package/dist/src/capabilities/runtime/product.js +1 -1
- package/dist/src/capabilities/store-connector.js +2 -2
- package/dist/src/channels/attachments/voice-stt-webchat.js +1 -1
- package/dist/src/channels/index.js +1 -1
- package/dist/src/channels/outbound-sender.js +1 -1
- package/dist/src/channels/pairing/allow-from-file.js +9 -9
- package/dist/src/channels/pairing/pairing-store.js +6 -6
- package/dist/src/chat-commands/agent-edit.js +1 -1
- package/dist/src/chat-commands/builtins/config.js +2 -2
- package/dist/src/chat-commands/builtins/session.js +1 -1
- package/dist/src/chat-commands/builtins/thinking.js +1 -1
- package/dist/src/chat-commands/builtins/tts.js +1 -1
- package/dist/src/chat-commands/context.js +1 -1
- package/dist/src/chat-commands/index.js +3 -3
- package/dist/src/cli/commands/agent.js +7 -7
- package/dist/src/cli/commands/agents.js +1 -1
- package/dist/src/cli/commands/config.js +1 -1
- package/dist/src/cli/commands/connectors.js +1 -1
- package/dist/src/cli/commands/doctor/checks/channel-plugins.js +1 -1
- package/dist/src/cli/commands/doctor/checks/gateway-health.js +1 -1
- package/dist/src/cli/commands/extension-agent-plugin.js +1 -1
- package/dist/src/cli/commands/extension-dev.js +1 -1
- package/dist/src/cli/commands/extension.js +2 -2
- package/dist/src/cli/commands/image.js +1 -1
- package/dist/src/cli/commands/init.js +1 -1
- package/dist/src/cli/commands/models.js +3 -3
- package/dist/src/cli/commands/onboard/channels/registry.js +1 -1
- package/dist/src/cli/commands/onboard/model.js +1 -1
- package/dist/src/cli/commands/onboard.js +1 -1
- package/dist/src/cli/commands/project.js +1 -1
- package/dist/src/cli/commands/skills.js +2 -2
- package/dist/src/cli/commands/tunnel.js +4 -4
- package/dist/src/cli/extension-cli-register.js +5 -5
- package/dist/src/cli/utils/gateway-client.js +1 -1
- package/dist/src/cli/utils/init-workspace-core.js +3 -3
- package/dist/src/cli/utils/session.js +1 -1
- package/dist/src/computer/flows.js +1 -1
- package/dist/src/computer/model-adapter.js +1 -1
- package/dist/src/computer/runtime.js +4 -4
- package/dist/src/config/agent-profile.js +1 -1
- package/dist/src/config/index.js +3 -3
- package/dist/src/config/loader.js +1 -1
- package/dist/src/config/models-json.js +1 -1
- package/dist/src/connectors/cli/authorization.js +1 -1
- package/dist/src/connectors/composio-sessions.js +1 -1
- package/dist/src/connectors/composio.js +1 -1
- package/dist/src/connectors/connected-source-ingestion.js +2 -2
- package/dist/src/connectors/connected-source-understanding.js +5 -5
- package/dist/src/connectors/connection-recovery-service.js +4 -4
- package/dist/src/connectors/content-enrichment.js +1 -1
- package/dist/src/connectors/health.js +1 -1
- package/dist/src/connectors/instances.js +1 -1
- package/dist/src/connectors/runtime-adapter-registry.js +2 -2
- package/dist/src/discussions/live-worker.js +1 -1
- package/dist/src/discussions/sealer.js +1 -1
- package/dist/src/endpoint-tools/index.js +1 -1
- package/dist/src/endpoint-tools/runtime.js +2 -2
- package/dist/src/execution-environments/local-worktree-manager.js +1 -1
- package/dist/src/extensions/activation-context.js +3 -3
- package/dist/src/extensions/agent-plugins/auth.js +1 -1
- package/dist/src/extensions/agent-plugins/skill-catalog.js +3 -3
- package/dist/src/extensions/agent-plugins/source-http-fetch.js +1 -1
- package/dist/src/extensions/agent-plugins/validation.js +1 -1
- package/dist/src/extensions/api.js +3 -3
- package/dist/src/extensions/bundled-extension-activation.js +1 -1
- package/dist/src/extensions/index.js +3 -3
- package/dist/src/extensions/loader.js +2 -2
- package/dist/src/extensions/lockfile.js +1 -1
- package/dist/src/extensions/sdk/index.js +1 -1
- package/dist/src/extensions/sdk/media.js +1 -1
- package/dist/src/gateway/agents-admin.js +2 -2
- package/dist/src/gateway/device-routes.js +1 -1
- package/dist/src/gateway/file-path-classifier.js +1 -1
- package/dist/src/gateway/global-defaults-admin.js +1 -1
- package/dist/src/gateway/hono/app.js +2 -2
- package/dist/src/gateway/hono/lib/config-payload.js +2 -2
- package/dist/src/gateway/hono/oauth-async.js +1 -1
- package/dist/src/gateway/hono/routes/agent-plugins.js +1 -1
- package/dist/src/gateway/hono/routes/agents.js +1 -1
- package/dist/src/gateway/hono/routes/auth-registry-extensions.js +1 -1
- package/dist/src/gateway/hono/routes/commands-skills.js +4 -4
- package/dist/src/gateway/hono/routes/config-patch/gateway.js +1 -1
- package/dist/src/gateway/hono/routes/config-patch/misc.js +1 -1
- package/dist/src/gateway/hono/routes/connectors.js +1 -1
- package/dist/src/gateway/hono/routes/context-sources.js +1 -1
- package/dist/src/gateway/hono/routes/endpoint-tools.js +1 -1
- package/dist/src/gateway/hono/routes/home.js +1 -1
- package/dist/src/gateway/hono/routes/location-sharing.js +1 -1
- package/dist/src/gateway/hono/routes/mcp.js +1 -1
- package/dist/src/gateway/hono/routes/memory-learning.js +3 -3
- package/dist/src/gateway/hono/routes/models.js +4 -4
- package/dist/src/gateway/hono/routes/notes.js +3 -3
- package/dist/src/gateway/hono/routes/phone-dependencies.js +1 -1
- package/dist/src/gateway/hono/routes/phone-setup.js +2 -2
- package/dist/src/gateway/hono/routes/phone.js +2 -2
- package/dist/src/gateway/hono/routes/projects.js +5 -5
- package/dist/src/gateway/hono/routes/runtime-tools.js +1 -1
- package/dist/src/gateway/hono/routes/session-command-handler.js +2 -2
- package/dist/src/gateway/hono/routes/session-input-handler.js +5 -5
- package/dist/src/gateway/hono/routes/sessions.js +3 -3
- package/dist/src/gateway/hono/routes/shares.js +1 -1
- package/dist/src/gateway/hono/routes/side-chats.js +1 -1
- package/dist/src/gateway/hono/routes/tasks.js +2 -2
- package/dist/src/gateway/hono/routes/user-model.js +7 -7
- package/dist/src/gateway/hono/routes/voice.js +7 -7
- package/dist/src/gateway/image-generation-setup.js +1 -1
- package/dist/src/gateway/lock.js +11 -11
- package/dist/src/gateway/media-access.js +1 -1
- package/dist/src/gateway/mobile-privacy.js +2 -2
- package/dist/src/gateway/ports.js +6 -6
- package/dist/src/gateway/provider-model-setup.js +1 -1
- package/dist/src/gateway/server.js +1 -1
- package/dist/src/gateway/service/agent-runner.js +2 -2
- package/dist/src/gateway/service/config-coordinator.js +2 -2
- package/dist/src/gateway/service/marketplace-service.js +2 -2
- package/dist/src/gateway/service/run-gateway-agent.js +5 -5
- package/dist/src/gateway/service/session-command-service.js +2 -2
- package/dist/src/gateway/service/session-input-coordinator.js +1 -1
- package/dist/src/gateway/service.js +41 -41
- package/dist/src/gateway/session-context-summary.js +4 -4
- package/dist/src/gateway/session-reset-service.js +1 -1
- package/dist/src/gateway/workspace-editor-path.js +2 -2
- package/dist/src/gateway/xopc-cloud-capability-setup.js +2 -2
- package/dist/src/home-intelligence/generator.js +2 -2
- package/dist/src/imports/importService.js +1 -1
- package/dist/src/imports/inventory.js +2 -2
- package/dist/src/imports/productImport.js +1 -1
- package/dist/src/imports/runtime.js +1 -1
- package/dist/src/infra/gateway-processes.js +2 -2
- package/dist/src/infra/path-env.js +3 -3
- package/dist/src/infra/update-global.js +9 -9
- package/dist/src/knowledge/connected-knowledge-pipeline.js +1 -1
- package/dist/src/knowledge/index.js +1 -1
- package/dist/src/knowledge-memory/repository.js +1 -1
- package/dist/src/knowledge-memory/usage-policy.js +1 -1
- package/dist/src/local-apps/service.js +3 -3
- package/dist/src/mcp/gateway-http-client.js +1 -1
- package/dist/src/media-understanding/openai-compatible-audio.js +1 -1
- package/dist/src/memory-learning/source-learning.js +5 -5
- package/dist/src/memory-learning/task-receipts.js +1 -1
- package/dist/src/notes/agent-context.js +4 -4
- package/dist/src/notes/index.js +1 -1
- package/dist/src/notes/service.js +3 -3
- package/dist/src/personal-agent/capability-service.js +2 -2
- package/dist/src/personal-agent/proactivity/routes.js +1 -1
- package/dist/src/personal-agent/proactivity/service.js +7 -7
- package/dist/src/personal-agent/prompt-context.js +7 -7
- package/dist/src/personal-agent/prompts.js +2 -2
- package/dist/src/personal-agent/reply-composer.js +9 -9
- package/dist/src/personal-agent/request-delivery.js +2 -2
- package/dist/src/personal-agent/request-service.js +7 -7
- package/dist/src/personal-agent/result-reader.js +1 -1
- package/dist/src/personal-agent/service.js +2 -2
- package/dist/src/phone/model-adapter.js +1 -1
- package/dist/src/phone/repository.js +1 -1
- package/dist/src/phone/runtime.js +4 -4
- package/dist/src/projects/index.js +2 -2
- package/dist/src/projects/project-agent-suggestion.js +1 -1
- package/dist/src/projects/project-service.js +2 -2
- package/dist/src/projects/project-skill-service.js +2 -2
- package/dist/src/projects/workspace.js +1 -1
- package/dist/src/providers/model-reference-auditor.js +1 -1
- package/dist/src/realtime/runtime.js +1 -1
- package/dist/src/remote-access/exposure-manager.js +1 -1
- package/dist/src/runtime-tools/archive.js +1 -1
- package/dist/src/runtime-tools/phone-dependencies.js +2 -2
- package/dist/src/session/client-history.d.ts +2 -0
- package/dist/src/session/client-history.js +3 -0
- package/dist/src/session/compact-history.js +1 -0
- package/dist/src/session/index.js +2 -2
- package/dist/src/session/init-session-turn.js +1 -1
- package/dist/src/session/resolve-session.js +1 -1
- package/dist/src/session/store.js +5 -5
- package/dist/src/session/thinking-resolve.js +1 -1
- package/dist/src/share/hosted-session-share.js +2 -2
- package/dist/src/share/session-share-service.js +1 -1
- package/dist/src/share/share-store.js +1 -1
- package/dist/src/share/share-thumbnail.js +1 -1
- package/dist/src/share/site-proxy.js +1 -1
- package/dist/src/share/site-share-store.js +1 -1
- package/dist/src/storage/sqlite/connection.js +9 -9
- package/dist/src/tasks/capabilities/read.js +2 -2
- package/dist/src/tasks/capabilities/write.js +2 -2
- package/dist/src/tasks/home-query-service.js +1 -1
- package/dist/src/tasks/index.js +5 -5
- package/dist/src/tasks/task-allocation-service.js +5 -5
- package/dist/src/tasks/task-application-service.js +5 -5
- package/dist/src/tasks/task-collaboration-delivery.js +1 -1
- package/dist/src/tasks/task-context-assembler.js +2 -2
- package/dist/src/tasks/task-contract-planner.js +2 -2
- package/dist/src/tasks/task-handoff-service.js +1 -1
- package/dist/src/tasks/task-handoff.js +4 -4
- package/dist/src/tasks/task-main-update-decision-service.js +3 -3
- package/dist/src/tasks/task-model-call.js +1 -1
- package/dist/src/tasks/task-research-result.js +4 -4
- package/dist/src/tasks/task-result-delivery-repository.js +1 -1
- package/dist/src/tasks/task-result-delivery-service.js +2 -2
- package/dist/src/tasks/task-run-coordinator.js +3 -3
- package/dist/src/tasks/task-run-dispatcher.js +1 -1
- package/dist/src/tui/backends/embedded-backend.js +12 -12
- package/dist/src/tui/backends/gateway-realtime-backend.js +2 -2
- package/dist/src/tui/extension-host/load-extensions.js +1 -1
- package/dist/src/tui/tui-commands.js +5 -5
- package/dist/src/tui/tui-picker-overlay.js +1 -1
- package/dist/src/tui/tui-skills-autocomplete.js +1 -1
- package/dist/src/tui/tui-startup-resources.js +3 -3
- package/dist/src/tui/tui.js +4 -4
- package/dist/src/tunnel/gateway-lifecycle.js +1 -1
- package/dist/src/user-context/access-policy.js +2 -2
- package/dist/src/user-model/bootstrap.js +1 -1
- package/dist/src/user-model/capture/executor.js +1 -1
- package/dist/src/user-model/index.js +2 -2
- package/dist/src/user-model/usage-policy.js +1 -1
- package/dist/src/voice/realtime/memory-context.js +5 -5
- package/dist/src/voice/realtime/omniRoute.js +1 -1
- package/dist/src/voice/realtime/persona-context.js +1 -1
- package/dist/src/voice/realtime/runtime.js +4 -4
- package/dist/src/voice/stt/index.js +2 -2
- package/dist/src/voice/stt/preflight.js +1 -1
- package/dist/src/voice/stt/providers/alibaba-transcription.js +1 -1
- package/dist/src/voice/stt/providers/bailian-plan-transcription.js +1 -1
- package/dist/src/voice/stt/providers/xopc-cloud-transcription.js +1 -1
- package/dist/src/voice/stt/transcribe-core.js +1 -1
- package/dist/src/voice/tts/index.js +3 -3
- package/dist/src/voice/tts/merge-config.js +1 -1
- package/dist/src/voice/tts/payload.js +1 -1
- package/dist/src/voice/tts/providers/bailian-plan-speech.js +1 -1
- package/dist/src/voice/tts/providers/xopc-cloud-speech.js +1 -1
- package/dist/src/voice/tts/speak-core.js +1 -1
- package/dist/src/work-discovery/service.js +7 -7
- package/package.json +1 -1
- package/dist/gateway/static/root/assets/gateway-realtime-store-eEZgUEdH.js +0 -1
- package/dist/gateway/static/root/assets/messages-9OwWjlww.js +0 -3
- package/dist/gateway/static/root/assets/note-image-lightbox-DOG9mCzE.js +0 -1
- package/dist/gateway/static/root/assets/page-header-store-DBeD_mAA.js +0 -1
- package/dist/gateway/static/root/assets/session-manager-SASXxhrN.js +0 -23
- package/dist/gateway/static/root/assets/settings-advanced-gate-iUlbBMZI.js +0 -1
- package/dist/gateway/static/root/assets/workspace-editor-agent-store-Bz_M_rk3.js +0 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/agent-avatar-dicebear-
|
|
2
|
-
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,t as n}from"./vendor-react-BOUWij0V.js";import{t as r}from"./preload-helper-Czpn1I53.js";import{i,l as a}from"./locale-store-
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/agent-avatar-dicebear-DTgOSv6G.js","assets/rolldown-runtime-aKtaBQYM.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,t as n}from"./vendor-react-BOUWij0V.js";import{t as r}from"./preload-helper-Czpn1I53.js";import{i,l as a}from"./locale-store-B6OrWgY1.js";import{t as o}from"./cn-0WouolD0.js";import{t as s}from"./loopi-CNtmi9FU.js";var c=e(t(),1),l=new Map,u=`xopc-agent-avatar-updated`;function d(e){let t=(l.get(e)??0)+1;return l.set(e,t),typeof window<`u`&&window.dispatchEvent(new CustomEvent(u,{detail:{agentId:e}})),t}function f(e){return l.get(e)??0}var p=`xopc:custom`,m=`xopc:dicebear:`,h=[`adventurer`,`bottts`,`lorelei`,`thumbs`,`fun-emoji`];function g(e){return h.includes(e)}function _(e,t){return`${m}${e}:${t}`}function v(e){if(!e.startsWith(m))return null;let t=e.slice(14),n=t.indexOf(`:`);if(n<=0)return null;let r=t.slice(0,n),i=t.slice(n+1);return!g(r)||!i.trim()?null:{styleId:r,seed:i}}var y=n();function b(e){let t=0;for(let n=0;n<e.length;n+=1)t=t*31+e.charCodeAt(n)>>>0;return t}function x(e,t=128){let n=b(e)%360,r=(e.trim().charAt(0)||`A`).toUpperCase(),i=`<svg xmlns="http://www.w3.org/2000/svg" width="${t}" height="${t}" viewBox="0 0 ${t} ${t}"><rect width="100%" height="100%" rx="${t/2}" fill="hsl(${n} 58% 42%)"/><text x="50%" y="54%" text-anchor="middle" dominant-baseline="middle" font-family="Inter, system-ui, sans-serif" font-size="${Math.round(t*.42)}" font-weight="700" fill="white">${r}</text></svg>`;return`data:image/svg+xml,${encodeURIComponent(i)}`}function S(e,t,n,r){let a=t?.trim()??``,o=x(e,n);if(a.startsWith(`xopc:loopi:`)){let e=a.slice(11);if(e===`idle`||e===`listen`||e===`curious`||e===`care`)return{kind:`loopi`,mood:e}}if(!a)return{kind:`dicebear`,styleId:`adventurer`,seed:e,fallbackSrc:o};if(a===`xopc:custom`){let t=i(`/api/agents/${encodeURIComponent(e)}/avatar`),n=new URLSearchParams;r>0&&n.set(`v`,String(r));let a=n.toString();return{kind:`authenticated`,url:a?`${t}?${a}`:t,fallbackSrc:o}}if(/^https?:\/\//i.test(a))return{kind:`sync`,src:a};let s=v(a);return s?{kind:`dicebear`,styleId:s.styleId,seed:s.seed,fallbackSrc:o}:{kind:`dicebear`,styleId:`adventurer`,seed:e,fallbackSrc:o}}function C(e){let t=a(e=>e.conversationId),n=e.token===void 0?t:e.token,{agentId:i,avatar:l,size:d=44}=e,[,p]=(0,c.useState)(0);(0,c.useEffect)(()=>{let e=e=>{e.detail?.agentId===i&&p(e=>e+1)};return window.addEventListener(u,e),()=>window.removeEventListener(u,e)},[i]);let m=f(i),h=(0,c.useMemo)(()=>S(i,l,d,m),[i,l,n,d,m]),g=h.kind===`sync`?h.src:h.kind===`loopi`?x(i,d):h.fallbackSrc,[_,v]=(0,c.useState)(g);return(0,c.useEffect)(()=>{v(g)},[g]),(0,c.useEffect)(()=>{if(h.kind!==`authenticated`||(v(h.fallbackSrc),!n))return;let e=new AbortController,t;return fetch(h.url,{credentials:`same-origin`,signal:e.signal,redirect:`error`}).then(async n=>{if(!n.ok)return;let r=await n.blob();e.signal.aborted||(t=URL.createObjectURL(r),v(t))}).catch(()=>{}),()=>{e.abort(),t&&URL.revokeObjectURL(t)}},[h,n]),(0,c.useEffect)(()=>{if(h.kind!==`dicebear`)return;let e=!1;return r(async()=>{let{dicebearToDataUri:e}=await import(`./agent-avatar-dicebear-DTgOSv6G.js`);return{dicebearToDataUri:e}},__vite__mapDeps([0,1])).then(({dicebearToDataUri:t})=>{e||v(t(h.styleId,h.seed,d))}).catch(()=>{e||v(h.fallbackSrc)}),()=>{e=!0}},[h,d]),h.kind===`loopi`?(0,y.jsx)(`span`,{className:o(`inline-flex items-center justify-center rounded-full bg-surface-hover`,e.className),style:{width:d,height:d},children:(0,y.jsx)(s,{variant:`avatar`,mood:h.mood,className:`size-full`})}):(0,y.jsx)(`img`,{src:_,alt:``,width:d,height:d,className:o(`rounded-full object-cover bg-surface-hover`,e.className),draggable:!1,onError:()=>{v(x(i,d))}})}export{g as a,_ as i,h as n,v as o,p as r,d as s,C as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{m as i}from"./chunk-KS7C4IRE-CiwuuyV8.js";import{l as a,n as o}from"./locale-store-fGFrr4_4.js";import{t as s}from"./circle-check-C23XjkUj.js";import{t as c}from"./gauge-C78eD2BA.js";import{t as l}from"./list-checks-BbsExAoq.js";import{t as ee}from"./puzzle-BptcPjKI.js";import{t as te}from"./search-DA7gz22f.js";import{t as u}from"./shield-check-BU58siTV.js";import{t as d}from"./sliders-horizontal-DqsYor6I.js";import{t as ne}from"./cn-0WouolD0.js";import{t as f}from"./skeleton-BI5TyibZ.js";import{n as p,r as m}from"./cloud-credits-B-nbtkqv.js";import{i as h}from"./vendor-swr-CdRzEUwF.js";import{t as re}from"./button-Cc4hUNTt.js";import{t as g}from"./electron-env-DHOGevH3.js";import{t as ie}from"./sliding-tab-list-DuQyViqe.js";import{t as _}from"./skill-list-api-B-2Dod7G.js";import{n as v}from"./settings-mode-store-DCnYgG87.js";import{n as ae,t as y}from"./global-defaults-api-C9O_X0pj.js";import{t as oe}from"./settings-advanced-section-CICMnCwv.js";import{t as b}from"./number-input-El7Szeln.js";import{n as se,t as x}from"./settings-page-header-DH1qb4vP.js";import"./settings-page-layout-B2G042F2.js";import{n as S,t as C}from"./use-autosave-BhdMHxgz.js";var ce=n(),w=e(t(),1),T=r(),E=`w-full rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg outline-none focus:border-accent focus:ring-2 focus:ring-accent/15`;function D(e){let t=Number.parseInt(e,10);return Number.isFinite(t)&&t>0?t:void 0}function le({draft:e,setDraft:t,zh:n}){let[r,i]=(0,w.useState)(()=>e.runtime.cloudCreditLimitPerRunMicro?p(e.runtime.cloudCreditLimitPerRunMicro):``),[a,o]=(0,w.useState)(!1);return(0,T.jsxs)(`label`,{className:`block text-xs font-medium text-fg-muted`,children:[n?`每次运行的 Cloud 消费上限(Credits)`:`Cloud spend limit per run (Credits)`,(0,T.jsx)(`input`,{type:`text`,inputMode:`decimal`,value:r,"aria-invalid":a,placeholder:n?`不设置额外上限`:`No additional limit`,className:`${E} mt-2`,onChange:n=>{let r=n.target.value;i(r);try{let n=r===``?void 0:m(r);if(n===`0`||n&&n.length>15)throw Error(`Invalid limit`);o(!1),t({...e,runtime:{...e.runtime,cloudCreditLimitPerRunMicro:n}})}catch{o(!0)}},onBlur:()=>{a&&i(e.runtime.cloudCreditLimitPerRunMicro?p(e.runtime.cloudCreditLimitPerRunMicro):``),o(!1)}}),(0,T.jsx)(`span`,{className:`mt-2 block font-normal ${a?`text-danger`:`text-fg-subtle`}`,children:a?n?`请输入大于零、最多四位小数的 Credits。无效输入不会保存。`:`Enter positive Credits with up to four decimals. Invalid input is not saved.`:n?`模型、图片和文件语音调用共享上限;不支持实时语音或 Cloud 电脑控制,不包含运行前后的后台调用。达到上限后停止,调整后需手动继续。`:`Shared by model, image and file audio calls during a run. Does not support realtime voice or Cloud computer use; excludes background calls outside the run. Stops at the limit; continue manually after adjusting it.`})]})}function O(e){let t=(0,ce.c)(104),{draft:n,setDraft:r,zh:i}=e,a=i?`费用控制`:`Spending control`,o;t[0]===a?o=t[1]:(o=(0,T.jsx)(`h2`,{className:`mb-4 text-base font-semibold text-fg`,children:a}),t[0]=a,t[1]=o);let s;t[2]!==n||t[3]!==r||t[4]!==i?(s=(0,T.jsx)(le,{draft:n,setDraft:r,zh:i}),t[2]=n,t[3]=r,t[4]=i,t[5]=s):s=t[5];let c;t[6]!==o||t[7]!==s?(c=(0,T.jsxs)(`section`,{className:`rounded-xl bg-surface-hover/20 p-5`,children:[o,s]}),t[6]=o,t[7]=s,t[8]=c):c=t[8];let l=i?`执行与缓存策略`:`Execution and cache policy`,ee=i?`轮数:${n.runtime.maxTurns??`默认`} · 超时:${n.runtime.timeoutMs??`默认`} · 缓存:${n.runtime.promptCache?.mode??`默认`} · Codemode:${n.runtime.codemode?.enabled?`开启`:`关闭`}`:`Turns: ${n.runtime.maxTurns??`default`} · Timeout: ${n.runtime.timeoutMs??`default`} · Cache: ${n.runtime.promptCache?.mode??`default`} · Codemode: ${n.runtime.codemode?.enabled?`on`:`off`}`,te=n.runtime.codemode?.enabled??!1,u;t[9]!==n||t[10]!==r?(u=e=>r({...n,runtime:{...n.runtime,codemode:{...n.runtime.codemode,enabled:e.target.checked}}}),t[9]=n,t[10]=r,t[11]=u):u=t[11];let d;t[12]!==te||t[13]!==u?(d=(0,T.jsx)(`input`,{type:`checkbox`,checked:te,onChange:u,className:`mt-1 size-4 accent-[var(--color-accent)]`}),t[12]=te,t[13]=u,t[14]=d):d=t[14];let ne=i?`Codemode 读取试点`:`Codemode read pilot`,f;t[15]===ne?f=t[16]:(f=(0,T.jsx)(`span`,{className:`block text-base font-semibold text-fg`,children:ne}),t[15]=ne,t[16]=f);let p=i?`允许智能体用脚本组合已授权的读取工具。默认关闭,保留普通工具调用。`:`Let agents combine authorized reads in scripts. Off by default; ordinary tool calls stay available.`,m;t[17]===p?m=t[18]:(m=(0,T.jsx)(`span`,{className:`mt-1 block text-sm text-fg-muted`,children:p}),t[17]=p,t[18]=m);let h;t[19]!==f||t[20]!==m?(h=(0,T.jsxs)(`span`,{children:[f,m]}),t[19]=f,t[20]=m,t[21]=h):h=t[21];let g;t[22]!==h||t[23]!==d?(g=(0,T.jsx)(`section`,{className:`rounded-xl bg-surface-hover/20 p-5`,children:(0,T.jsxs)(`label`,{className:`flex cursor-pointer items-start gap-3`,children:[d,h]})}),t[22]=h,t[23]=d,t[24]=g):g=t[24];let _=i?`执行限制`:`Execution limits`,v;t[25]===_?v=t[26]:(v=(0,T.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:_}),t[25]=_,t[26]=v);let ae=i?`为所有智能体设置安全上限;留空时使用系统默认值。`:`Set safe upper bounds for every agent. Empty fields use system defaults.`,y;t[27]===ae?y=t[28]:(y=(0,T.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:ae}),t[27]=ae,t[28]=y);let se=i?`每次运行最多轮数`:`Maximum turns per run`,x=n.runtime.maxTurns??``,S=i?`系统默认`:`System default`,C;t[29]!==n||t[30]!==r?(C=e=>r({...n,runtime:{...n.runtime,maxTurns:D(e.target.value)}}),t[29]=n,t[30]=r,t[31]=C):C=t[31];let w;t[32]!==x||t[33]!==S||t[34]!==C?(w=(0,T.jsx)(b,{allowEmpty:!0,type:`number`,min:1,value:x,placeholder:S,onChange:C,className:`${E} mt-2`}),t[32]=x,t[33]=S,t[34]=C,t[35]=w):w=t[35];let O;t[36]!==se||t[37]!==w?(O=(0,T.jsxs)(`label`,{className:`block text-xs font-medium text-fg-muted`,children:[se,w]}),t[36]=se,t[37]=w,t[38]=O):O=t[38];let k=i?`单轮超时(毫秒)`:`Turn timeout (ms)`,ue=n.runtime.timeoutMs??``,de=i?`系统默认`:`System default`,A;t[39]!==n||t[40]!==r?(A=e=>r({...n,runtime:{...n.runtime,timeoutMs:D(e.target.value)}}),t[39]=n,t[40]=r,t[41]=A):A=t[41];let j;t[42]!==ue||t[43]!==de||t[44]!==A?(j=(0,T.jsx)(b,{allowEmpty:!0,type:`number`,min:1,value:ue,placeholder:de,onChange:A,className:`${E} mt-2`}),t[42]=ue,t[43]=de,t[44]=A,t[45]=j):j=t[45];let M;t[46]!==k||t[47]!==j?(M=(0,T.jsxs)(`label`,{className:`block text-xs font-medium text-fg-muted`,children:[k,j]}),t[46]=k,t[47]=j,t[48]=M):M=t[48];let fe=i?`每轮最多工具失败次数`:`Maximum tool failures per turn`,N=n.runtime.maxToolFailuresPerTurn??``,P=i?`系统默认`:`System default`,F;t[49]!==n||t[50]!==r?(F=e=>r({...n,runtime:{...n.runtime,maxToolFailuresPerTurn:D(e.target.value)}}),t[49]=n,t[50]=r,t[51]=F):F=t[51];let I;t[52]!==N||t[53]!==P||t[54]!==F?(I=(0,T.jsx)(b,{allowEmpty:!0,type:`number`,min:1,value:N,placeholder:P,onChange:F,className:`${E} mt-2`}),t[52]=N,t[53]=P,t[54]=F,t[55]=I):I=t[55];let L;t[56]!==fe||t[57]!==I?(L=(0,T.jsxs)(`label`,{className:`block text-xs font-medium text-fg-muted`,children:[fe,I]}),t[56]=fe,t[57]=I,t[58]=L):L=t[58];let R;t[59]!==O||t[60]!==M||t[61]!==L?(R=(0,T.jsxs)(`div`,{className:`mt-5 grid gap-4 md:grid-cols-3`,children:[O,M,L]}),t[59]=O,t[60]=M,t[61]=L,t[62]=R):R=t[62];let z;t[63]!==v||t[64]!==y||t[65]!==R?(z=(0,T.jsxs)(`section`,{className:`rounded-xl bg-surface-hover/20 p-5`,children:[v,y,R]}),t[63]=v,t[64]=y,t[65]=R,t[66]=z):z=t[66];let B=i?`提示词缓存`:`Prompt cache`,V;t[67]===B?V=t[68]:(V=(0,T.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:B}),t[67]=B,t[68]=V);let H=i?`复用稳定的上下文以降低响应延迟和模型费用。`:`Reuse stable context to reduce latency and model cost.`,U;t[69]===H?U=t[70]:(U=(0,T.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:H}),t[69]=H,t[70]=U);let W=i?`缓存模式`:`Cache mode`,G;t[71]===W?G=t[72]:(G=(0,T.jsx)(`span`,{children:W}),t[71]=W,t[72]=G);let K=i?`缓存模式`:`Cache mode`,q;t[73]===Symbol.for(`react.memo_cache_sentinel`)?(q=[`auto`,`off`],t[73]=q):q=t[73];let J;t[74]!==n||t[75]!==r||t[76]!==i?(J=q.map(e=>(0,T.jsx)(re,{"aria-pressed":n.runtime.promptCache?.mode===e,variant:n.runtime.promptCache?.mode===e?`secondary`:`ghost`,className:`flex-1 py-1.5 text-xs`,onClick:()=>r({...n,runtime:{...n.runtime,promptCache:{mode:e,lifetime:n.runtime.promptCache?.lifetime??`short`}}}),children:e===`auto`?i?`自动`:`Automatic`:i?`关闭`:`Off`},e)),t[74]=n,t[75]=r,t[76]=i,t[77]=J):J=t[77];let Y;t[78]!==K||t[79]!==J?(Y=(0,T.jsx)(ie,{className:`mt-1.5 flex rounded-lg bg-surface-panel p-1`,role:`group`,"aria-label":K,children:J}),t[78]=K,t[79]=J,t[80]=Y):Y=t[80];let X;t[81]!==G||t[82]!==Y?(X=(0,T.jsxs)(`div`,{className:`text-xs font-medium text-fg-muted`,children:[G,Y]}),t[81]=G,t[82]=Y,t[83]=X):X=t[83];let pe;t[84]!==n||t[85]!==r||t[86]!==i?(pe=n.runtime.promptCache?.mode===`auto`?(0,T.jsxs)(`div`,{className:`text-xs font-medium text-fg-muted`,children:[(0,T.jsx)(`span`,{children:i?`缓存周期`:`Cache lifetime`}),(0,T.jsx)(ie,{className:`mt-1.5 flex rounded-lg bg-surface-panel p-1`,role:`group`,"aria-label":i?`缓存周期`:`Cache lifetime`,children:[`short`,`long`].map(e=>(0,T.jsx)(re,{"aria-pressed":n.runtime.promptCache?.lifetime===e,variant:n.runtime.promptCache?.lifetime===e?`secondary`:`ghost`,className:`flex-1 py-1.5 text-xs`,onClick:()=>r({...n,runtime:{...n.runtime,promptCache:{mode:`auto`,lifetime:e}}}),children:e===`short`?i?`短期`:`Short`:i?`长期`:`Long`},e))})]}):null,t[84]=n,t[85]=r,t[86]=i,t[87]=pe):pe=t[87];let Z;t[88]!==X||t[89]!==pe?(Z=(0,T.jsxs)(`div`,{className:`mt-5 grid gap-4 sm:grid-cols-2`,children:[X,pe]}),t[88]=X,t[89]=pe,t[90]=Z):Z=t[90];let Q;t[91]!==V||t[92]!==U||t[93]!==Z?(Q=(0,T.jsxs)(`section`,{className:`rounded-xl bg-surface-hover/20 p-5`,children:[V,U,Z]}),t[91]=V,t[92]=U,t[93]=Z,t[94]=Q):Q=t[94];let $;t[95]!==g||t[96]!==z||t[97]!==l||t[98]!==Q||t[99]!==ee?($=(0,T.jsxs)(oe,{title:l,summary:ee,children:[g,z,Q]}),t[95]=g,t[96]=z,t[97]=l,t[98]=Q,t[99]=ee,t[100]=$):$=t[100];let me;return t[101]!==c||t[102]!==$?(me=(0,T.jsxs)(`div`,{className:`space-y-5`,children:[c,$]}),t[101]=c,t[102]=$,t[103]=me):me=t[103],me}function k(e){return[...new Set(e)].sort()}var ue=[{id:`core`,names:[`doc-coauthoring`,`define-task`,`find-skills`,`summarize`],en:`Core`,zh:`核心`},{id:`office`,names:[`doc-coauthoring`,`define-task`,`find-skills`,`summarize`,`docx`,`pdf`,`pptx`,`xlsx`],en:`Office`,zh:`办公成果`},{id:`local-app`,names:[`doc-coauthoring`,`define-task`,`find-skills`,`summarize`,`build-xopc-local-app`,`frontend-design`,`theme-factory`],en:`Local App`,zh:`本地应用`},{id:`developer`,names:[`doc-coauthoring`,`define-task`,`find-skills`,`summarize`,`diagnose`,`github`,`tdd`,`webapp-testing`],en:`Developer`,zh:`开发者`},{id:`desktop-pet`,names:[`doc-coauthoring`,`define-task`,`find-skills`,`summarize`,`hatch-pet`],en:`Desktop Pet`,zh:`桌面宠物`}];function de(e){let t=(0,ce.c)(115),{draft:n,setDraft:r,zh:i}=e,a;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(a={revalidateOnFocus:!1},t[0]=a):a=t[0];let{data:o,error:c,isLoading:ee}=h(`agent-defaults-skills-catalog`,_,a),[u,d]=(0,w.useState)(``),f=n.skills.mode===`selected`?n.skills.include:n.skills.exclude;o?.catalog;let p;if(t[1]!==f||t[2]!==o?.catalog||t[3]!==u){let e=[...o?.catalog??[]],n=new Set(e.map(N));for(let t of f)n.has(t)||e.push({name:t,description:``,enabled:!0});let r=u.trim().toLowerCase();p=e.filter(e=>!r||`${e.name} ${e.description}`.toLowerCase().includes(r)).sort(fe),t[1]=f,t[2]=o?.catalog,t[3]=u,t[4]=p}else p=t[4];let m=p,re;t[5]!==n.skills.exclude||t[6]!==n.skills.include||t[7]!==n.skills.mode?(re=e=>n.skills.mode===`selected`?n.skills.include.includes(e):!n.skills.exclude.includes(e),t[5]=n.skills.exclude,t[6]=n.skills.include,t[7]=n.skills.mode,t[8]=re):re=t[8];let g=re,ie;t[9]!==n||t[10]!==r?(ie=e=>{if(n.skills.mode===`selected`){let t=n.skills.include.includes(e)?n.skills.include.filter(t=>t!==e):k([...n.skills.include,e]);r({...n,skills:{mode:`selected`,include:t}});return}let t=n.skills.exclude.includes(e)?n.skills.exclude.filter(t=>t!==e):k([...n.skills.exclude,e]);r({...n,skills:{mode:`all-enabled`,exclude:t}})},t[9]=n,t[10]=r,t[11]=ie):ie=t[11];let v=ie,ae;t[12]===o?.catalog?ae=t[13]:(ae=o?.catalog??[],t[12]=o?.catalog,t[13]=ae);let y;if(t[14]!==g||t[15]!==ae){let e;t[17]===g?e=t[18]:(e=e=>e.enabled&&g(e.name),t[17]=g,t[18]=e),y=ae.filter(e),t[14]=g,t[15]=ae,t[16]=y}else y=t[16];let oe=y.length,b;t[19]!==o?.catalog||t[20]!==n||t[21]!==r?(b=e=>{let t=new Set((o?.catalog??[]).filter(M).map(j));r({...n,skills:{mode:`selected`,include:k(e.filter(e=>t.has(e)))}})},t[19]=o?.catalog,t[20]=n,t[21]=r,t[22]=b):b=t[22];let se=b,x=i?`技能策略`:`Skill policy`,S;t[23]===x?S=t[24]:(S=(0,T.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:x}),t[23]=x,t[24]=S);let C=i?`决定所有智能体默认可以使用哪些技能。`:`Choose which skills every agent can discover and use by default.`,E;t[25]===C?E=t[26]:(E=(0,T.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:C}),t[25]=C,t[26]=E);let D;t[27]!==n||t[28]!==r?(D=()=>r({...n,skills:{mode:`all-enabled`,exclude:[]}}),t[27]=n,t[28]=r,t[29]=D):D=t[29];let le=n.skills.mode===`all-enabled`?`bg-accent-soft shadow-surface`:`hover:bg-surface-hover`,O;t[30]===le?O=t[31]:(O=ne(`flex items-start gap-3 rounded-xl bg-surface-base/55 p-4 text-left focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,le),t[30]=le,t[31]=O);let de;t[32]===Symbol.for(`react.memo_cache_sentinel`)?(de=(0,T.jsx)(s,{className:`mt-0.5 size-5 shrink-0 text-accent`}),t[32]=de):de=t[32];let P=i?`使用所有已启用技能`:`Use every enabled skill`,F;t[33]===P?F=t[34]:(F=(0,T.jsx)(`span`,{className:`block text-sm font-medium text-fg`,children:P}),t[33]=P,t[34]=F);let I=i?`适合需要完整目录的高级智能体;新增技能会自动加入。`:`For advanced agents that need the full catalog; newly enabled skills are added automatically.`,L;t[35]===I?L=t[36]:(L=(0,T.jsx)(`span`,{className:`mt-1 block text-xs leading-5 text-fg-muted`,children:I}),t[35]=I,t[36]=L);let R;t[37]!==F||t[38]!==L?(R=(0,T.jsxs)(`span`,{children:[F,L]}),t[37]=F,t[38]=L,t[39]=R):R=t[39];let z;t[40]!==D||t[41]!==O||t[42]!==R?(z=(0,T.jsxs)(`button`,{type:`button`,onClick:D,className:O,children:[de,R]}),t[40]=D,t[41]=O,t[42]=R,t[43]=z):z=t[43];let B;t[44]!==n||t[45]!==r?(B=()=>r({...n,skills:{mode:`selected`,include:[]}}),t[44]=n,t[45]=r,t[46]=B):B=t[46];let V=n.skills.mode===`selected`?`bg-accent-soft shadow-surface`:`hover:bg-surface-hover`,H;t[47]===V?H=t[48]:(H=ne(`flex items-start gap-3 rounded-xl bg-surface-base/55 p-4 text-left focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,V),t[47]=V,t[48]=H);let U;t[49]===Symbol.for(`react.memo_cache_sentinel`)?(U=(0,T.jsx)(l,{className:`mt-0.5 size-5 shrink-0 text-accent`}),t[49]=U):U=t[49];let W=i?`只使用选中的技能`:`Use selected skills only`,G;t[50]===W?G=t[51]:(G=(0,T.jsx)(`span`,{className:`block text-sm font-medium text-fg`,children:W}),t[50]=W,t[51]=G);let K=i?`适合严格受控的环境;新增技能不会自动加入。`:`For tightly controlled environments; new skills are not added automatically.`,q;t[52]===K?q=t[53]:(q=(0,T.jsx)(`span`,{className:`mt-1 block text-xs leading-5 text-fg-muted`,children:K}),t[52]=K,t[53]=q);let J;t[54]!==G||t[55]!==q?(J=(0,T.jsxs)(`span`,{children:[G,q]}),t[54]=G,t[55]=q,t[56]=J):J=t[56];let Y;t[57]!==B||t[58]!==H||t[59]!==J?(Y=(0,T.jsxs)(`button`,{type:`button`,onClick:B,className:H,children:[U,J]}),t[57]=B,t[58]=H,t[59]=J,t[60]=Y):Y=t[60];let X;t[61]!==z||t[62]!==Y?(X=(0,T.jsxs)(`div`,{className:`mt-5 grid gap-3 sm:grid-cols-2`,children:[z,Y]}),t[61]=z,t[62]=Y,t[63]=X):X=t[63];let pe=i?`能力组合(会替换当前选择)`:`Capability packs (replaces the current selection)`,Z;t[64]===pe?Z=t[65]:(Z=(0,T.jsx)(`p`,{className:`text-xs font-medium text-fg-muted`,children:pe}),t[64]=pe,t[65]=Z);let Q;t[66]!==se||t[67]!==o||t[68]!==i?(Q=ue.map(e=>(0,T.jsx)(`button`,{type:`button`,onClick:()=>se(e.names),disabled:!o,className:`rounded-lg border border-edge bg-surface-panel px-3 py-1.5 text-xs font-medium text-fg transition-colors hover:bg-surface-hover disabled:cursor-not-allowed disabled:opacity-50`,children:i?e.zh:e.en},e.id)),t[66]=se,t[67]=o,t[68]=i,t[69]=Q):Q=t[69];let $;t[70]===Q?$=t[71]:($=(0,T.jsx)(`div`,{className:`mt-2 flex flex-wrap gap-2`,children:Q}),t[70]=Q,t[71]=$);let me;t[72]!==Z||t[73]!==$?(me=(0,T.jsxs)(`div`,{className:`mt-4`,children:[Z,$]}),t[72]=Z,t[73]=$,t[74]=me):me=t[74];let he;t[75]!==E||t[76]!==X||t[77]!==me||t[78]!==S?(he=(0,T.jsxs)(`section`,{className:`rounded-xl bg-surface-hover/20 p-5`,children:[S,E,X,me]}),t[75]=E,t[76]=X,t[77]=me,t[78]=S,t[79]=he):he=t[79];let ge=n.skills.mode===`selected`?i?`选择可用技能`:`Select available skills`:i?`管理例外`:`Manage exceptions`,_e;t[80]===ge?_e=t[81]:(_e=(0,T.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:ge}),t[80]=ge,t[81]=_e);let ve=i?`当前默认可用 ${oe} 个技能。`:`${oe} skills are available by default.`,ye;t[82]===ve?ye=t[83]:(ye=(0,T.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:ve}),t[82]=ve,t[83]=ye);let be;t[84]!==_e||t[85]!==ye?(be=(0,T.jsxs)(`div`,{children:[_e,ye]}),t[84]=_e,t[85]=ye,t[86]=be):be=t[86];let xe=i?`搜索技能`:`Search skills`,Se;t[87]===xe?Se=t[88]:(Se=(0,T.jsx)(`span`,{className:`sr-only`,children:xe}),t[87]=xe,t[88]=Se);let Ce;t[89]===Symbol.for(`react.memo_cache_sentinel`)?(Ce=(0,T.jsx)(te,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-fg-subtle`}),t[89]=Ce):Ce=t[89];let we;t[90]===Symbol.for(`react.memo_cache_sentinel`)?(we=e=>d(e.target.value),t[90]=we):we=t[90];let Te=i?`搜索技能`:`Search skills`,Ee;t[91]!==u||t[92]!==Te?(Ee=(0,T.jsx)(`input`,{type:`search`,value:u,onChange:we,placeholder:Te,className:`w-full rounded-lg border border-edge bg-surface-panel py-2 pl-9 pr-3 text-sm text-fg outline-none focus:border-accent`}),t[91]=u,t[92]=Te,t[93]=Ee):Ee=t[93];let De;t[94]!==Se||t[95]!==Ee?(De=(0,T.jsxs)(`label`,{className:`relative block w-full sm:w-72`,children:[Se,Ce,Ee]}),t[94]=Se,t[95]=Ee,t[96]=De):De=t[96];let Oe;t[97]!==be||t[98]!==De?(Oe=(0,T.jsxs)(`div`,{className:`flex flex-wrap items-end justify-between gap-3`,children:[be,De]}),t[97]=be,t[98]=De,t[99]=Oe):Oe=t[99];let ke;t[100]===c?ke=t[101]:(ke=c?(0,T.jsx)(`p`,{className:`mt-4 rounded-lg bg-red-500/10 px-3 py-2 text-sm text-red-600`,children:c instanceof Error?c.message:String(c)}):null,t[100]=c,t[101]=ke);let Ae;t[102]!==g||t[103]!==ee||t[104]!==m||t[105]!==v||t[106]!==i?(Ae=ee?(0,T.jsx)(`div`,{className:`mt-4 space-y-2`,children:[0,1,2,3].map(A)}):(0,T.jsxs)(`div`,{className:`mt-4 flex max-h-[32rem] flex-col gap-1 overflow-y-auto rounded-xl bg-surface-base/45 p-1 [&>label]:rounded-lg [&>label]:bg-surface-panel/55`,children:[m.map(e=>{let t=g(e.name);return(0,T.jsxs)(`label`,{className:ne(`flex cursor-pointer items-start gap-3 px-4 py-3 hover:bg-surface-hover/60`,!e.enabled&&`cursor-not-allowed opacity-55`),children:[(0,T.jsx)(`input`,{type:`checkbox`,checked:t,disabled:!e.enabled,onChange:()=>v(e.name),className:`mt-0.5 size-4 rounded border-edge accent-[var(--color-accent)]`}),(0,T.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,T.jsxs)(`span`,{className:`flex flex-wrap items-center gap-2`,children:[(0,T.jsx)(`span`,{className:`text-sm font-medium text-fg`,children:e.name}),e.enabled?null:(0,T.jsx)(`span`,{className:`rounded-full bg-surface-hover px-2 py-0.5 text-[10px] text-fg-muted`,children:i?`全局未启用`:`Disabled globally`})]}),e.description?(0,T.jsx)(`span`,{className:`mt-1 block line-clamp-2 text-xs leading-5 text-fg-muted`,children:e.description}):null]})]},e.name)}),m.length===0?(0,T.jsx)(`p`,{className:`px-4 py-8 text-center text-sm text-fg-muted`,children:i?`没有匹配的技能。`:`No matching skills.`}):null]}),t[102]=g,t[103]=ee,t[104]=m,t[105]=v,t[106]=i,t[107]=Ae):Ae=t[107];let je;t[108]!==Oe||t[109]!==ke||t[110]!==Ae?(je=(0,T.jsxs)(`section`,{className:`rounded-xl bg-surface-hover/20 p-5`,children:[Oe,ke,Ae]}),t[108]=Oe,t[109]=ke,t[110]=Ae,t[111]=je):je=t[111];let Me;return t[112]!==he||t[113]!==je?(Me=(0,T.jsxs)(`div`,{className:`space-y-5`,children:[he,je]}),t[112]=he,t[113]=je,t[114]=Me):Me=t[114],Me}function A(e){return(0,T.jsx)(f,{className:`h-14 rounded-xl`},e)}function j(e){return e.name}function M(e){return e.enabled}function fe(e,t){return e.name.localeCompare(t.name)}function N(e){return e.name}var P={read:[`read_file`,`read`,`list_directory`,`search_files`,`web_search`,`web_fetch`,`read_task`],files:[`apply_patch`,`write_file`,`edit_file`],execute:[`exec_command`,`execute_code`,`write_stdin`],devices:[`browser_use`,`computer_use`,`phone_use`],external:[`send_message`,`send_media`,`publish_artifact`,`publish_task_result`]};function F(e){return Object.entries(P).find(([,t])=>t.includes(e))?.[0]??`other`}function I(e,t){let n={read:[`读取与查找资料`,`Read and find information`],files:[`修改文件`,`Change files`],execute:[`运行命令与代码`,`Run commands and code`],devices:[`操作网页与设备`,`Control browsers and devices`],external:[`发送与发布内容`,`Send and publish content`],other:[`其他与组合工具`,`Other and compound tools`]};return(n[e]??n.other)[+!t]}function L(e){let t=Number.parseInt(e,10);return Number.isFinite(t)&&t>0?t:void 0}function R(e){let t=(0,ce.c)(94),{draft:n,setDraft:r,builtinTools:i,zh:a}=e,o=v(),[s,c]=(0,w.useState)(``),[l,ee]=(0,w.useState)(`all`),[u,f]=(0,w.useState)(),p;t[0]===i?p=t[1]:(p=new Map(i.map(H)),t[0]=i,t[1]=p);let m=p,h;t[2]!==i||t[3]!==n.tools?(h=[...new Set([...i.map(V),...Object.keys(n.tools)])].filter(B).sort(z),t[2]=i,t[3]=n.tools,t[4]=h):h=t[4];let g=h,_;if(t[5]!==g||t[6]!==n.tools){let e;t[8]===n.tools?e=t[9]:(e=e=>(n.tools[e]?.mode??`allow`)===`allow`,t[8]=n.tools,t[9]=e),_=g.filter(e),t[5]=g,t[6]=n.tools,t[7]=_}else _=t[7];let ae=_.length,y;if(t[10]!==g||t[11]!==n.tools){let e;t[13]===n.tools?e=t[14]:(e=e=>n.tools[e]?.mode===`ask`,t[13]=n.tools,t[14]=e),y=g.filter(e),t[10]=g,t[11]=n.tools,t[12]=y}else y=t[12];let se=y.length,x;if(t[15]!==g||t[16]!==n.tools){let e;t[18]===n.tools?e=t[19]:(e=e=>n.tools[e]?.mode===`deny`,t[18]=n.tools,t[19]=e),x=g.filter(e),t[15]=g,t[16]=n.tools,t[17]=x}else x=t[17];let S;t[20]!==_.length||t[21]!==y.length||t[22]!==x.length?(S={allow:ae,ask:se,deny:x.length},t[20]=_.length,t[21]=y.length,t[22]=x.length,t[23]=S):S=t[23];let C=S,E;if(t[24]!==g||t[25]!==m||t[26]!==n.tools||t[27]!==l||t[28]!==s){let e=s.trim().toLowerCase();E=g.filter(t=>{let r=n.tools[t]?.mode??`allow`,i=m.get(t),a=`${t} ${i?.en??``} ${i?.zh??``}`.toLowerCase();return(!e||a.includes(e))&&(l===`all`||r===l)}),t[24]=g,t[25]=m,t[26]=n.tools,t[27]=l,t[28]=s,t[29]=E}else E=t[29];let D=E,le;t[30]!==n||t[31]!==r?(le=(e,t)=>{let i=n.tools[e]??{mode:`allow`};r({...n,tools:{...n.tools,[e]:{...i,...t}}})},t[30]=n,t[31]=r,t[32]=le):le=t[32];let O=le,k=a?`全部 ${g.length}`:`All ${g.length}`,ue;t[33]===k?ue=t[34]:(ue={id:`all`,label:k},t[33]=k,t[34]=ue);let de=a?`允许 ${C.allow}`:`Allow ${C.allow}`,A;t[35]===de?A=t[36]:(A={id:`allow`,label:de},t[35]=de,t[36]=A);let j=a?`询问 ${C.ask}`:`Ask ${C.ask}`,M;t[37]===j?M=t[38]:(M={id:`ask`,label:j},t[37]=j,t[38]=M);let fe=a?`禁用 ${C.deny}`:`Deny ${C.deny}`,N;t[39]===fe?N=t[40]:(N={id:`deny`,label:fe},t[39]=fe,t[40]=N);let P;t[41]!==ue||t[42]!==A||t[43]!==M||t[44]!==N?(P=[ue,A,M,N],t[41]=ue,t[42]=A,t[43]=M,t[44]=N,t[45]=P):P=t[45];let R=P,U=a?`默认工具权限`:`Default tool permissions`,W;t[46]===U?W=t[47]:(W=(0,T.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:U}),t[46]=U,t[47]=W);let G=a?`允许:直接执行;询问:执行前确认;禁用:智能体无法使用。分组只解释用途;命令、组合工具的实际读写与外部影响取决于调用内容,请逐项核对。`:`Allow runs directly, Ask requires confirmation, and Deny makes the tool unavailable.`,K;t[48]===G?K=t[49]:(K=(0,T.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:G}),t[48]=G,t[49]=K);let q;t[50]!==W||t[51]!==K?(q=(0,T.jsxs)(`div`,{children:[W,K]}),t[50]=W,t[51]=K,t[52]=q):q=t[52];let J=a?`工具筛选`:`Tool filter`,Y;t[53]!==l||t[54]!==R?(Y=R.map(e=>(0,T.jsx)(`button`,{"aria-pressed":l===e.id,type:`button`,onClick:()=>ee(e.id),className:ne(`rounded-lg px-3 py-1.5 text-xs font-medium`,l===e.id?`bg-surface-base text-fg shadow-surface`:`text-fg-muted hover:text-fg`),children:e.label},e.id)),t[53]=l,t[54]=R,t[55]=Y):Y=t[55];let X;t[56]!==J||t[57]!==Y?(X=(0,T.jsx)(ie,{className:`flex flex-wrap gap-1 rounded-xl bg-surface-panel p-1`,role:`group`,"aria-label":J,indicatorClassName:`rounded-lg bg-surface-base shadow-surface`,children:Y}),t[56]=J,t[57]=Y,t[58]=X):X=t[58];let pe=a?`搜索工具`:`Search tools`,Z;t[59]===pe?Z=t[60]:(Z=(0,T.jsx)(`span`,{className:`sr-only`,children:pe}),t[59]=pe,t[60]=Z);let Q;t[61]===Symbol.for(`react.memo_cache_sentinel`)?(Q=(0,T.jsx)(te,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-fg-subtle`}),t[61]=Q):Q=t[61];let $;t[62]===Symbol.for(`react.memo_cache_sentinel`)?($=e=>c(e.target.value),t[62]=$):$=t[62];let me=a?`搜索工具`:`Search tools`,he;t[63]!==s||t[64]!==me?(he=(0,T.jsx)(`input`,{type:`search`,value:s,onChange:$,placeholder:me,className:`w-full rounded-lg border border-edge bg-surface-panel py-2 pl-9 pr-3 text-sm text-fg outline-none focus:border-accent`}),t[63]=s,t[64]=me,t[65]=he):he=t[65];let ge;t[66]!==Z||t[67]!==he?(ge=(0,T.jsxs)(`label`,{className:`relative block w-full sm:w-72`,children:[Z,Q,he]}),t[66]=Z,t[67]=he,t[68]=ge):ge=t[68];let _e;t[69]!==X||t[70]!==ge?(_e=(0,T.jsxs)(`div`,{className:`mt-5 flex flex-wrap items-center justify-between gap-3`,children:[X,ge]}),t[69]=X,t[70]=ge,t[71]=_e):_e=t[71];let ve=a?`工具调用限制`:`Tool call limits`,ye=a?`每个工具的调用次数和超时限制继续生效;授权可在下方直接修改。`:`Call and timeout limits remain active; edit permissions below.`,be;t[72]!==ve||t[73]!==ye?(be=(0,T.jsx)(oe,{title:ve,summary:ye,children:null}),t[72]=ve,t[73]=ye,t[74]=be):be=t[74];let xe;t[75]!==m||t[76]!==n.tools||t[77]!==u||t[78]!==o||t[79]!==O||t[80]!==D||t[81]!==a?(xe=D.map((e,t)=>{let r=n.tools[e]??{mode:`allow`},i=m.get(e),s=u===e;return(0,T.jsxs)(`div`,{className:`px-4 py-3`,children:[t===0||F(D[t-1])!==F(e)?(0,T.jsx)(`h3`,{className:`mb-3 border-b border-edge pb-2 text-sm font-semibold text-fg`,children:I(F(e),a)}):null,(0,T.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[(0,T.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,T.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:(a?i?.zh:i?.en)||e}),(0,T.jsx)(`code`,{className:`text-xs text-fg-muted`,children:e})]}),(0,T.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,T.jsx)(ie,{className:`flex rounded-lg bg-surface-base p-1`,role:`group`,"aria-label":e,indicatorClassName:`rounded-md bg-accent`,children:[`allow`,`ask`,`deny`].map(t=>(0,T.jsx)(`button`,{"aria-pressed":r.mode===t,type:`button`,onClick:()=>O(e,{mode:t}),className:ne(`rounded-md px-2.5 py-1 text-xs font-medium capitalize`,r.mode===t?`bg-accent text-on-accent`:`text-fg-muted hover:text-fg`),children:t===`allow`?a?`允许`:`Allow`:t===`ask`?a?`询问`:`Ask`:a?`禁用`:`Deny`},t))}),o?(0,T.jsx)(re,{variant:`ghost`,className:`px-2 py-1`,"aria-label":a?`${e} 调用限制`:`${e} call limits`,onClick:()=>f(s?void 0:e),children:(0,T.jsx)(d,{className:`size-4`})}):null]})]}),s&&o?(0,T.jsxs)(`div`,{className:`mt-3 grid gap-3 rounded-lg bg-surface-base p-3 sm:grid-cols-2`,children:[(0,T.jsxs)(`label`,{className:`block text-xs font-medium text-fg-muted`,children:[a?`每轮最多调用次数`:`Maximum calls per turn`,(0,T.jsx)(b,{allowEmpty:!0,type:`number`,min:1,value:r.maxCallsPerTurn??``,placeholder:a?`不限制`:`Unlimited`,onChange:t=>O(e,{maxCallsPerTurn:L(t.target.value)}),className:`mt-2 w-full rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg outline-none focus:border-accent`})]}),(0,T.jsxs)(`label`,{className:`block text-xs font-medium text-fg-muted`,children:[a?`单次超时(毫秒)`:`Call timeout (ms)`,(0,T.jsx)(b,{allowEmpty:!0,type:`number`,min:1,value:r.timeoutMs??``,placeholder:a?`使用系统默认值`:`Use system default`,onChange:t=>O(e,{timeoutMs:L(t.target.value)}),className:`mt-2 w-full rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg outline-none focus:border-accent`})]})]}):null]},e)}),t[75]=m,t[76]=n.tools,t[77]=u,t[78]=o,t[79]=O,t[80]=D,t[81]=a,t[82]=xe):xe=t[82];let Se;t[83]!==D.length||t[84]!==a?(Se=D.length===0?(0,T.jsx)(`p`,{className:`px-4 py-10 text-center text-sm text-fg-muted`,children:a?`没有匹配的工具。`:`No matching tools.`}):null,t[83]=D.length,t[84]=a,t[85]=Se):Se=t[85];let Ce;t[86]!==xe||t[87]!==Se?(Ce=(0,T.jsxs)(`div`,{className:`mt-4 flex max-h-[38rem] flex-col gap-1 overflow-y-auto rounded-xl bg-surface-base/45 p-1 [&>*]:rounded-lg [&>*]:bg-surface-panel/55`,children:[xe,Se]}),t[86]=xe,t[87]=Se,t[88]=Ce):Ce=t[88];let we;return t[89]!==q||t[90]!==_e||t[91]!==be||t[92]!==Ce?(we=(0,T.jsxs)(`section`,{className:`rounded-xl bg-surface-hover/20 p-5`,children:[q,_e,be,Ce]}),t[89]=q,t[90]=_e,t[91]=be,t[92]=Ce,t[93]=we):we=t[93],we}function z(e,t){return[`read`,`files`,`execute`,`external`,`devices`,`other`].indexOf(F(e))-[`read`,`files`,`execute`,`external`,`devices`,`other`].indexOf(F(t))||e.localeCompare(t)}function B(e){return e!==`computer_use`||g()}function V(e){return e.id}function H(e){return[e.id,e.description]}function U(){let e=(0,ce.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,T.jsxs)(se,{gap:`gap-5`,children:[(0,T.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,T.jsxs)(`div`,{className:`space-y-2`,children:[(0,T.jsx)(f,{className:`h-7 w-56`}),(0,T.jsx)(f,{className:`h-4 w-96 max-w-full`})]}),(0,T.jsx)(f,{className:`h-9 w-28`})]}),(0,T.jsx)(f,{className:`h-20 rounded-2xl`}),(0,T.jsx)(f,{className:`h-12 rounded-xl`}),(0,T.jsx)(f,{className:`h-72 rounded-2xl`})]}),e[0]=t):t=e[0],t}function W(e){let t=(0,ce.c)(65),{initial:n,builtinTools:r,zh:a}=e,[o,s]=i(),l;t[0]===o?l=t[1]:(l=o.get(`panel`),t[0]=o,t[1]=l);let te=l,d=te===`skills`||te===`tools`||te===`runtime`?te:`skills`,f;t[2]!==o||t[3]!==s?(f=e=>{let t=new URLSearchParams(o);t.set(`panel`,e),s(t,{replace:!0})},t[2]=o,t[3]=s,t[4]=f):f=t[4];let p=f,m;t[5]===n?m=t[6]:(m=()=>structuredClone(n),t[5]=n,t[6]=m);let[h,g]=(0,w.useState)(m),_;t[7]===n?_=t[8]:(_=()=>structuredClone(n),t[7]=n,t[8]=_);let[v,oe]=(0,w.useState)(_),b;t[9]===h?b=t[10]:(b=JSON.stringify(h),t[9]=h,t[10]=b);let E;t[11]===v?E=t[12]:(E=JSON.stringify(v),t[11]=v,t[12]=E);let D=b!==E,le=a?`技能`:`Skills`,k;t[13]===le?k=t[14]:(k={id:`skills`,label:le,icon:ee},t[13]=le,t[14]=k);let ue=a?`工具`:`Tools`,A;t[15]===ue?A=t[16]:(A={id:`tools`,label:ue,icon:u},t[15]=ue,t[16]=A);let j=a?`运行`:`Runtime`,M;t[17]===j?M=t[18]:(M={id:`runtime`,label:j,icon:c},t[17]=j,t[18]=M);let fe;t[19]!==A||t[20]!==M||t[21]!==k?(fe=[k,A,M],t[19]=A,t[20]=M,t[21]=k,t[22]=fe):fe=t[22];let N=fe,P;t[23]===Symbol.for(`react.memo_cache_sentinel`)?(P=async e=>{let t=structuredClone(e),n=await y(),r=await ae({...t,models:n.defaults.models},{scope:`agent`}),i=structuredClone(r.defaults);g(e=>JSON.stringify(e)===JSON.stringify(t)?i:e),oe(structuredClone(i))},t[23]=P):P=t[23];let F=P,I;t[24]!==D||t[25]!==h?(I={value:h,dirty:D,onSave:F,delayMs:0},t[24]=D,t[25]=h,t[26]=I):I=t[26];let L=C(I),z=L.onBlurCapture,B=a?`智能体设置`:`Agent settings`,V;t[27]!==L.error||t[28]!==L.status?(V=(0,T.jsx)(S,{status:L.status,error:L.error}),t[27]=L.error,t[28]=L.status,t[29]=V):V=t[29];let H;t[30]!==B||t[31]!==V?(H=(0,T.jsx)(x,{title:B,actions:V}),t[30]=B,t[31]=V,t[32]=H):H=t[32];let U;t[33]!==L.error||t[34]!==L.retry||t[35]!==a?(U=L.error?(0,T.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2 rounded-xl bg-red-500/10 px-3 py-2 text-sm text-red-600`,children:[(0,T.jsx)(`span`,{children:L.error}),(0,T.jsx)(re,{type:`button`,variant:`ghost`,className:`h-8 text-red-600`,onClick:L.retry,children:a?`重试`:`Retry`})]}):null,t[33]=L.error,t[34]=L.retry,t[35]=a,t[36]=U):U=t[36];let W=a?`默认配置分区`:`Default configuration sections`,G;t[37]!==d||t[38]!==p||t[39]!==N?(G=N.map(e=>{let{id:t,label:n,icon:r}=e;return(0,T.jsxs)(`button`,{type:`button`,"aria-pressed":d===t,onClick:()=>p(t),className:ne(`flex min-w-0 items-center justify-center gap-2 rounded-lg px-3 py-2.5 text-left transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,d===t?`bg-surface-base text-fg shadow-surface`:`text-fg-muted hover:bg-surface-hover hover:text-fg`),children:[(0,T.jsx)(r,{className:ne(`size-4 shrink-0`,d===t?`text-accent`:`text-fg-subtle`)}),(0,T.jsx)(`span`,{className:`text-sm font-medium`,children:n})]},t)}),t[37]=d,t[38]=p,t[39]=N,t[40]=G):G=t[40];let K;t[41]!==W||t[42]!==G?(K=(0,T.jsx)(ie,{as:`nav`,className:`grid grid-cols-3 gap-1 rounded-xl bg-surface-hover/20 p-1`,"aria-label":W,indicatorClassName:`rounded-lg bg-surface-base shadow-surface`,children:G}),t[41]=W,t[42]=G,t[43]=K):K=t[43];let q;t[44]!==d||t[45]!==h||t[46]!==a?(q=d===`skills`?(0,T.jsx)(de,{draft:h,setDraft:g,zh:a}):null,t[44]=d,t[45]=h,t[46]=a,t[47]=q):q=t[47];let J;t[48]!==d||t[49]!==r||t[50]!==h||t[51]!==a?(J=d===`tools`?(0,T.jsx)(R,{draft:h,setDraft:g,builtinTools:r,zh:a}):null,t[48]=d,t[49]=r,t[50]=h,t[51]=a,t[52]=J):J=t[52];let Y;t[53]!==d||t[54]!==h||t[55]!==a?(Y=d===`runtime`?(0,T.jsx)(O,{draft:h,setDraft:g,zh:a}):null,t[53]=d,t[54]=h,t[55]=a,t[56]=Y):Y=t[56];let X;return t[57]!==L.onBlurCapture||t[58]!==H||t[59]!==U||t[60]!==K||t[61]!==q||t[62]!==J||t[63]!==Y?(X=(0,T.jsxs)(se,{gap:`gap-5`,onBlurCapture:z,children:[H,U,K,q,J,Y]}),t[57]=L.onBlurCapture,t[58]=H,t[59]=U,t[60]=K,t[61]=q,t[62]=J,t[63]=Y,t[64]=X):X=t[64],X}function G(){let e=(0,ce.c)(17),t=a(q),n=o(K)===`zh`,{data:r,error:i,isLoading:s,mutate:c}=h(t?`settings-agent-defaults`:null,y);if(!t){let t=n?`需要本机服务令牌。`:`Local service token required.`,r;return e[0]===t?r=e[1]:(r=(0,T.jsx)(se,{children:(0,T.jsx)(`p`,{className:`text-sm text-fg-muted`,children:t})}),e[0]=t,e[1]=r),r}if(i&&!r){let t=String(i),r;e[2]===t?r=e[3]:(r=(0,T.jsx)(`p`,{className:`rounded-xl bg-red-500/10 px-3 py-2 text-sm text-red-600`,children:t}),e[2]=t,e[3]=r);let a;e[4]===c?a=e[5]:(a=()=>void c(),e[4]=c,e[5]=a);let o=n?`重试`:`Retry`,s;e[6]!==a||e[7]!==o?(s=(0,T.jsx)(re,{onClick:a,children:o}),e[6]=a,e[7]=o,e[8]=s):s=e[8];let l;return e[9]!==r||e[10]!==s?(l=(0,T.jsxs)(se,{children:[r,s]}),e[9]=r,e[10]=s,e[11]=l):l=e[11],l}if(s||!r){let t;return e[12]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,T.jsx)(U,{}),e[12]=t):t=e[12],t}let l;return e[13]!==r.builtinTools||e[14]!==r.defaults||e[15]!==n?(l=(0,T.jsx)(W,{initial:r.defaults,builtinTools:r.builtinTools,zh:n}),e[13]=r.builtinTools,e[14]=r.defaults,e[15]=n,e[16]=l):l=e[16],l}function K(e){return e.language}function q(e){return e.conversationId}export{G as AgentDefaultsSettingsPanel};
|
|
1
|
+
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{m as i}from"./chunk-KS7C4IRE-CiwuuyV8.js";import{l as a,n as o}from"./locale-store-B6OrWgY1.js";import{t as s}from"./circle-check-C23XjkUj.js";import{t as c}from"./gauge-C78eD2BA.js";import{t as l}from"./list-checks-BbsExAoq.js";import{t as ee}from"./puzzle-BptcPjKI.js";import{t as te}from"./search-DA7gz22f.js";import{t as u}from"./shield-check-BU58siTV.js";import{t as d}from"./sliders-horizontal-DqsYor6I.js";import{t as ne}from"./cn-0WouolD0.js";import{t as f}from"./skeleton-BI5TyibZ.js";import{n as p,r as m}from"./cloud-credits-B-nbtkqv.js";import{i as h}from"./vendor-swr-CdRzEUwF.js";import{t as re}from"./button-Cc4hUNTt.js";import{t as g}from"./electron-env-DHOGevH3.js";import{t as ie}from"./sliding-tab-list-DuQyViqe.js";import{t as _}from"./skill-list-api-DpHaXI2l.js";import{n as v}from"./settings-mode-store-C2LZqBES.js";import{n as ae,t as y}from"./global-defaults-api-BObi-1ww.js";import{t as oe}from"./settings-advanced-section-CEorDLUp.js";import{t as b}from"./number-input-El7Szeln.js";import{n as se,t as x}from"./settings-page-header-BAN34UQi.js";import"./settings-page-layout-B5TVFBV2.js";import{n as S,t as C}from"./use-autosave-HL8XRNR8.js";var ce=n(),w=e(t(),1),T=r(),E=`w-full rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg outline-none focus:border-accent focus:ring-2 focus:ring-accent/15`;function D(e){let t=Number.parseInt(e,10);return Number.isFinite(t)&&t>0?t:void 0}function le({draft:e,setDraft:t,zh:n}){let[r,i]=(0,w.useState)(()=>e.runtime.cloudCreditLimitPerRunMicro?p(e.runtime.cloudCreditLimitPerRunMicro):``),[a,o]=(0,w.useState)(!1);return(0,T.jsxs)(`label`,{className:`block text-xs font-medium text-fg-muted`,children:[n?`每次运行的 Cloud 消费上限(Credits)`:`Cloud spend limit per run (Credits)`,(0,T.jsx)(`input`,{type:`text`,inputMode:`decimal`,value:r,"aria-invalid":a,placeholder:n?`不设置额外上限`:`No additional limit`,className:`${E} mt-2`,onChange:n=>{let r=n.target.value;i(r);try{let n=r===``?void 0:m(r);if(n===`0`||n&&n.length>15)throw Error(`Invalid limit`);o(!1),t({...e,runtime:{...e.runtime,cloudCreditLimitPerRunMicro:n}})}catch{o(!0)}},onBlur:()=>{a&&i(e.runtime.cloudCreditLimitPerRunMicro?p(e.runtime.cloudCreditLimitPerRunMicro):``),o(!1)}}),(0,T.jsx)(`span`,{className:`mt-2 block font-normal ${a?`text-danger`:`text-fg-subtle`}`,children:a?n?`请输入大于零、最多四位小数的 Credits。无效输入不会保存。`:`Enter positive Credits with up to four decimals. Invalid input is not saved.`:n?`模型、图片和文件语音调用共享上限;不支持实时语音或 Cloud 电脑控制,不包含运行前后的后台调用。达到上限后停止,调整后需手动继续。`:`Shared by model, image and file audio calls during a run. Does not support realtime voice or Cloud computer use; excludes background calls outside the run. Stops at the limit; continue manually after adjusting it.`})]})}function O(e){let t=(0,ce.c)(104),{draft:n,setDraft:r,zh:i}=e,a=i?`费用控制`:`Spending control`,o;t[0]===a?o=t[1]:(o=(0,T.jsx)(`h2`,{className:`mb-4 text-base font-semibold text-fg`,children:a}),t[0]=a,t[1]=o);let s;t[2]!==n||t[3]!==r||t[4]!==i?(s=(0,T.jsx)(le,{draft:n,setDraft:r,zh:i}),t[2]=n,t[3]=r,t[4]=i,t[5]=s):s=t[5];let c;t[6]!==o||t[7]!==s?(c=(0,T.jsxs)(`section`,{className:`rounded-xl bg-surface-hover/20 p-5`,children:[o,s]}),t[6]=o,t[7]=s,t[8]=c):c=t[8];let l=i?`执行与缓存策略`:`Execution and cache policy`,ee=i?`轮数:${n.runtime.maxTurns??`默认`} · 超时:${n.runtime.timeoutMs??`默认`} · 缓存:${n.runtime.promptCache?.mode??`默认`} · Codemode:${n.runtime.codemode?.enabled?`开启`:`关闭`}`:`Turns: ${n.runtime.maxTurns??`default`} · Timeout: ${n.runtime.timeoutMs??`default`} · Cache: ${n.runtime.promptCache?.mode??`default`} · Codemode: ${n.runtime.codemode?.enabled?`on`:`off`}`,te=n.runtime.codemode?.enabled??!1,u;t[9]!==n||t[10]!==r?(u=e=>r({...n,runtime:{...n.runtime,codemode:{...n.runtime.codemode,enabled:e.target.checked}}}),t[9]=n,t[10]=r,t[11]=u):u=t[11];let d;t[12]!==te||t[13]!==u?(d=(0,T.jsx)(`input`,{type:`checkbox`,checked:te,onChange:u,className:`mt-1 size-4 accent-[var(--color-accent)]`}),t[12]=te,t[13]=u,t[14]=d):d=t[14];let ne=i?`Codemode 读取试点`:`Codemode read pilot`,f;t[15]===ne?f=t[16]:(f=(0,T.jsx)(`span`,{className:`block text-base font-semibold text-fg`,children:ne}),t[15]=ne,t[16]=f);let p=i?`允许智能体用脚本组合已授权的读取工具。默认关闭,保留普通工具调用。`:`Let agents combine authorized reads in scripts. Off by default; ordinary tool calls stay available.`,m;t[17]===p?m=t[18]:(m=(0,T.jsx)(`span`,{className:`mt-1 block text-sm text-fg-muted`,children:p}),t[17]=p,t[18]=m);let h;t[19]!==f||t[20]!==m?(h=(0,T.jsxs)(`span`,{children:[f,m]}),t[19]=f,t[20]=m,t[21]=h):h=t[21];let g;t[22]!==h||t[23]!==d?(g=(0,T.jsx)(`section`,{className:`rounded-xl bg-surface-hover/20 p-5`,children:(0,T.jsxs)(`label`,{className:`flex cursor-pointer items-start gap-3`,children:[d,h]})}),t[22]=h,t[23]=d,t[24]=g):g=t[24];let _=i?`执行限制`:`Execution limits`,v;t[25]===_?v=t[26]:(v=(0,T.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:_}),t[25]=_,t[26]=v);let ae=i?`为所有智能体设置安全上限;留空时使用系统默认值。`:`Set safe upper bounds for every agent. Empty fields use system defaults.`,y;t[27]===ae?y=t[28]:(y=(0,T.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:ae}),t[27]=ae,t[28]=y);let se=i?`每次运行最多轮数`:`Maximum turns per run`,x=n.runtime.maxTurns??``,S=i?`系统默认`:`System default`,C;t[29]!==n||t[30]!==r?(C=e=>r({...n,runtime:{...n.runtime,maxTurns:D(e.target.value)}}),t[29]=n,t[30]=r,t[31]=C):C=t[31];let w;t[32]!==x||t[33]!==S||t[34]!==C?(w=(0,T.jsx)(b,{allowEmpty:!0,type:`number`,min:1,value:x,placeholder:S,onChange:C,className:`${E} mt-2`}),t[32]=x,t[33]=S,t[34]=C,t[35]=w):w=t[35];let O;t[36]!==se||t[37]!==w?(O=(0,T.jsxs)(`label`,{className:`block text-xs font-medium text-fg-muted`,children:[se,w]}),t[36]=se,t[37]=w,t[38]=O):O=t[38];let k=i?`单轮超时(毫秒)`:`Turn timeout (ms)`,ue=n.runtime.timeoutMs??``,de=i?`系统默认`:`System default`,A;t[39]!==n||t[40]!==r?(A=e=>r({...n,runtime:{...n.runtime,timeoutMs:D(e.target.value)}}),t[39]=n,t[40]=r,t[41]=A):A=t[41];let j;t[42]!==ue||t[43]!==de||t[44]!==A?(j=(0,T.jsx)(b,{allowEmpty:!0,type:`number`,min:1,value:ue,placeholder:de,onChange:A,className:`${E} mt-2`}),t[42]=ue,t[43]=de,t[44]=A,t[45]=j):j=t[45];let M;t[46]!==k||t[47]!==j?(M=(0,T.jsxs)(`label`,{className:`block text-xs font-medium text-fg-muted`,children:[k,j]}),t[46]=k,t[47]=j,t[48]=M):M=t[48];let fe=i?`每轮最多工具失败次数`:`Maximum tool failures per turn`,N=n.runtime.maxToolFailuresPerTurn??``,P=i?`系统默认`:`System default`,F;t[49]!==n||t[50]!==r?(F=e=>r({...n,runtime:{...n.runtime,maxToolFailuresPerTurn:D(e.target.value)}}),t[49]=n,t[50]=r,t[51]=F):F=t[51];let I;t[52]!==N||t[53]!==P||t[54]!==F?(I=(0,T.jsx)(b,{allowEmpty:!0,type:`number`,min:1,value:N,placeholder:P,onChange:F,className:`${E} mt-2`}),t[52]=N,t[53]=P,t[54]=F,t[55]=I):I=t[55];let L;t[56]!==fe||t[57]!==I?(L=(0,T.jsxs)(`label`,{className:`block text-xs font-medium text-fg-muted`,children:[fe,I]}),t[56]=fe,t[57]=I,t[58]=L):L=t[58];let R;t[59]!==O||t[60]!==M||t[61]!==L?(R=(0,T.jsxs)(`div`,{className:`mt-5 grid gap-4 md:grid-cols-3`,children:[O,M,L]}),t[59]=O,t[60]=M,t[61]=L,t[62]=R):R=t[62];let z;t[63]!==v||t[64]!==y||t[65]!==R?(z=(0,T.jsxs)(`section`,{className:`rounded-xl bg-surface-hover/20 p-5`,children:[v,y,R]}),t[63]=v,t[64]=y,t[65]=R,t[66]=z):z=t[66];let B=i?`提示词缓存`:`Prompt cache`,V;t[67]===B?V=t[68]:(V=(0,T.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:B}),t[67]=B,t[68]=V);let H=i?`复用稳定的上下文以降低响应延迟和模型费用。`:`Reuse stable context to reduce latency and model cost.`,U;t[69]===H?U=t[70]:(U=(0,T.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:H}),t[69]=H,t[70]=U);let W=i?`缓存模式`:`Cache mode`,G;t[71]===W?G=t[72]:(G=(0,T.jsx)(`span`,{children:W}),t[71]=W,t[72]=G);let K=i?`缓存模式`:`Cache mode`,q;t[73]===Symbol.for(`react.memo_cache_sentinel`)?(q=[`auto`,`off`],t[73]=q):q=t[73];let J;t[74]!==n||t[75]!==r||t[76]!==i?(J=q.map(e=>(0,T.jsx)(re,{"aria-pressed":n.runtime.promptCache?.mode===e,variant:n.runtime.promptCache?.mode===e?`secondary`:`ghost`,className:`flex-1 py-1.5 text-xs`,onClick:()=>r({...n,runtime:{...n.runtime,promptCache:{mode:e,lifetime:n.runtime.promptCache?.lifetime??`short`}}}),children:e===`auto`?i?`自动`:`Automatic`:i?`关闭`:`Off`},e)),t[74]=n,t[75]=r,t[76]=i,t[77]=J):J=t[77];let Y;t[78]!==K||t[79]!==J?(Y=(0,T.jsx)(ie,{className:`mt-1.5 flex rounded-lg bg-surface-panel p-1`,role:`group`,"aria-label":K,children:J}),t[78]=K,t[79]=J,t[80]=Y):Y=t[80];let X;t[81]!==G||t[82]!==Y?(X=(0,T.jsxs)(`div`,{className:`text-xs font-medium text-fg-muted`,children:[G,Y]}),t[81]=G,t[82]=Y,t[83]=X):X=t[83];let pe;t[84]!==n||t[85]!==r||t[86]!==i?(pe=n.runtime.promptCache?.mode===`auto`?(0,T.jsxs)(`div`,{className:`text-xs font-medium text-fg-muted`,children:[(0,T.jsx)(`span`,{children:i?`缓存周期`:`Cache lifetime`}),(0,T.jsx)(ie,{className:`mt-1.5 flex rounded-lg bg-surface-panel p-1`,role:`group`,"aria-label":i?`缓存周期`:`Cache lifetime`,children:[`short`,`long`].map(e=>(0,T.jsx)(re,{"aria-pressed":n.runtime.promptCache?.lifetime===e,variant:n.runtime.promptCache?.lifetime===e?`secondary`:`ghost`,className:`flex-1 py-1.5 text-xs`,onClick:()=>r({...n,runtime:{...n.runtime,promptCache:{mode:`auto`,lifetime:e}}}),children:e===`short`?i?`短期`:`Short`:i?`长期`:`Long`},e))})]}):null,t[84]=n,t[85]=r,t[86]=i,t[87]=pe):pe=t[87];let Z;t[88]!==X||t[89]!==pe?(Z=(0,T.jsxs)(`div`,{className:`mt-5 grid gap-4 sm:grid-cols-2`,children:[X,pe]}),t[88]=X,t[89]=pe,t[90]=Z):Z=t[90];let Q;t[91]!==V||t[92]!==U||t[93]!==Z?(Q=(0,T.jsxs)(`section`,{className:`rounded-xl bg-surface-hover/20 p-5`,children:[V,U,Z]}),t[91]=V,t[92]=U,t[93]=Z,t[94]=Q):Q=t[94];let $;t[95]!==g||t[96]!==z||t[97]!==l||t[98]!==Q||t[99]!==ee?($=(0,T.jsxs)(oe,{title:l,summary:ee,children:[g,z,Q]}),t[95]=g,t[96]=z,t[97]=l,t[98]=Q,t[99]=ee,t[100]=$):$=t[100];let me;return t[101]!==c||t[102]!==$?(me=(0,T.jsxs)(`div`,{className:`space-y-5`,children:[c,$]}),t[101]=c,t[102]=$,t[103]=me):me=t[103],me}function k(e){return[...new Set(e)].sort()}var ue=[{id:`core`,names:[`doc-coauthoring`,`define-task`,`find-skills`,`summarize`],en:`Core`,zh:`核心`},{id:`office`,names:[`doc-coauthoring`,`define-task`,`find-skills`,`summarize`,`docx`,`pdf`,`pptx`,`xlsx`],en:`Office`,zh:`办公成果`},{id:`local-app`,names:[`doc-coauthoring`,`define-task`,`find-skills`,`summarize`,`build-xopc-local-app`,`frontend-design`,`theme-factory`],en:`Local App`,zh:`本地应用`},{id:`developer`,names:[`doc-coauthoring`,`define-task`,`find-skills`,`summarize`,`diagnose`,`github`,`tdd`,`webapp-testing`],en:`Developer`,zh:`开发者`},{id:`desktop-pet`,names:[`doc-coauthoring`,`define-task`,`find-skills`,`summarize`,`hatch-pet`],en:`Desktop Pet`,zh:`桌面宠物`}];function de(e){let t=(0,ce.c)(115),{draft:n,setDraft:r,zh:i}=e,a;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(a={revalidateOnFocus:!1},t[0]=a):a=t[0];let{data:o,error:c,isLoading:ee}=h(`agent-defaults-skills-catalog`,_,a),[u,d]=(0,w.useState)(``),f=n.skills.mode===`selected`?n.skills.include:n.skills.exclude;o?.catalog;let p;if(t[1]!==f||t[2]!==o?.catalog||t[3]!==u){let e=[...o?.catalog??[]],n=new Set(e.map(N));for(let t of f)n.has(t)||e.push({name:t,description:``,enabled:!0});let r=u.trim().toLowerCase();p=e.filter(e=>!r||`${e.name} ${e.description}`.toLowerCase().includes(r)).sort(fe),t[1]=f,t[2]=o?.catalog,t[3]=u,t[4]=p}else p=t[4];let m=p,re;t[5]!==n.skills.exclude||t[6]!==n.skills.include||t[7]!==n.skills.mode?(re=e=>n.skills.mode===`selected`?n.skills.include.includes(e):!n.skills.exclude.includes(e),t[5]=n.skills.exclude,t[6]=n.skills.include,t[7]=n.skills.mode,t[8]=re):re=t[8];let g=re,ie;t[9]!==n||t[10]!==r?(ie=e=>{if(n.skills.mode===`selected`){let t=n.skills.include.includes(e)?n.skills.include.filter(t=>t!==e):k([...n.skills.include,e]);r({...n,skills:{mode:`selected`,include:t}});return}let t=n.skills.exclude.includes(e)?n.skills.exclude.filter(t=>t!==e):k([...n.skills.exclude,e]);r({...n,skills:{mode:`all-enabled`,exclude:t}})},t[9]=n,t[10]=r,t[11]=ie):ie=t[11];let v=ie,ae;t[12]===o?.catalog?ae=t[13]:(ae=o?.catalog??[],t[12]=o?.catalog,t[13]=ae);let y;if(t[14]!==g||t[15]!==ae){let e;t[17]===g?e=t[18]:(e=e=>e.enabled&&g(e.name),t[17]=g,t[18]=e),y=ae.filter(e),t[14]=g,t[15]=ae,t[16]=y}else y=t[16];let oe=y.length,b;t[19]!==o?.catalog||t[20]!==n||t[21]!==r?(b=e=>{let t=new Set((o?.catalog??[]).filter(M).map(j));r({...n,skills:{mode:`selected`,include:k(e.filter(e=>t.has(e)))}})},t[19]=o?.catalog,t[20]=n,t[21]=r,t[22]=b):b=t[22];let se=b,x=i?`技能策略`:`Skill policy`,S;t[23]===x?S=t[24]:(S=(0,T.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:x}),t[23]=x,t[24]=S);let C=i?`决定所有智能体默认可以使用哪些技能。`:`Choose which skills every agent can discover and use by default.`,E;t[25]===C?E=t[26]:(E=(0,T.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:C}),t[25]=C,t[26]=E);let D;t[27]!==n||t[28]!==r?(D=()=>r({...n,skills:{mode:`all-enabled`,exclude:[]}}),t[27]=n,t[28]=r,t[29]=D):D=t[29];let le=n.skills.mode===`all-enabled`?`bg-accent-soft shadow-surface`:`hover:bg-surface-hover`,O;t[30]===le?O=t[31]:(O=ne(`flex items-start gap-3 rounded-xl bg-surface-base/55 p-4 text-left focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,le),t[30]=le,t[31]=O);let de;t[32]===Symbol.for(`react.memo_cache_sentinel`)?(de=(0,T.jsx)(s,{className:`mt-0.5 size-5 shrink-0 text-accent`}),t[32]=de):de=t[32];let P=i?`使用所有已启用技能`:`Use every enabled skill`,F;t[33]===P?F=t[34]:(F=(0,T.jsx)(`span`,{className:`block text-sm font-medium text-fg`,children:P}),t[33]=P,t[34]=F);let I=i?`适合需要完整目录的高级智能体;新增技能会自动加入。`:`For advanced agents that need the full catalog; newly enabled skills are added automatically.`,L;t[35]===I?L=t[36]:(L=(0,T.jsx)(`span`,{className:`mt-1 block text-xs leading-5 text-fg-muted`,children:I}),t[35]=I,t[36]=L);let R;t[37]!==F||t[38]!==L?(R=(0,T.jsxs)(`span`,{children:[F,L]}),t[37]=F,t[38]=L,t[39]=R):R=t[39];let z;t[40]!==D||t[41]!==O||t[42]!==R?(z=(0,T.jsxs)(`button`,{type:`button`,onClick:D,className:O,children:[de,R]}),t[40]=D,t[41]=O,t[42]=R,t[43]=z):z=t[43];let B;t[44]!==n||t[45]!==r?(B=()=>r({...n,skills:{mode:`selected`,include:[]}}),t[44]=n,t[45]=r,t[46]=B):B=t[46];let V=n.skills.mode===`selected`?`bg-accent-soft shadow-surface`:`hover:bg-surface-hover`,H;t[47]===V?H=t[48]:(H=ne(`flex items-start gap-3 rounded-xl bg-surface-base/55 p-4 text-left focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,V),t[47]=V,t[48]=H);let U;t[49]===Symbol.for(`react.memo_cache_sentinel`)?(U=(0,T.jsx)(l,{className:`mt-0.5 size-5 shrink-0 text-accent`}),t[49]=U):U=t[49];let W=i?`只使用选中的技能`:`Use selected skills only`,G;t[50]===W?G=t[51]:(G=(0,T.jsx)(`span`,{className:`block text-sm font-medium text-fg`,children:W}),t[50]=W,t[51]=G);let K=i?`适合严格受控的环境;新增技能不会自动加入。`:`For tightly controlled environments; new skills are not added automatically.`,q;t[52]===K?q=t[53]:(q=(0,T.jsx)(`span`,{className:`mt-1 block text-xs leading-5 text-fg-muted`,children:K}),t[52]=K,t[53]=q);let J;t[54]!==G||t[55]!==q?(J=(0,T.jsxs)(`span`,{children:[G,q]}),t[54]=G,t[55]=q,t[56]=J):J=t[56];let Y;t[57]!==B||t[58]!==H||t[59]!==J?(Y=(0,T.jsxs)(`button`,{type:`button`,onClick:B,className:H,children:[U,J]}),t[57]=B,t[58]=H,t[59]=J,t[60]=Y):Y=t[60];let X;t[61]!==z||t[62]!==Y?(X=(0,T.jsxs)(`div`,{className:`mt-5 grid gap-3 sm:grid-cols-2`,children:[z,Y]}),t[61]=z,t[62]=Y,t[63]=X):X=t[63];let pe=i?`能力组合(会替换当前选择)`:`Capability packs (replaces the current selection)`,Z;t[64]===pe?Z=t[65]:(Z=(0,T.jsx)(`p`,{className:`text-xs font-medium text-fg-muted`,children:pe}),t[64]=pe,t[65]=Z);let Q;t[66]!==se||t[67]!==o||t[68]!==i?(Q=ue.map(e=>(0,T.jsx)(`button`,{type:`button`,onClick:()=>se(e.names),disabled:!o,className:`rounded-lg border border-edge bg-surface-panel px-3 py-1.5 text-xs font-medium text-fg transition-colors hover:bg-surface-hover disabled:cursor-not-allowed disabled:opacity-50`,children:i?e.zh:e.en},e.id)),t[66]=se,t[67]=o,t[68]=i,t[69]=Q):Q=t[69];let $;t[70]===Q?$=t[71]:($=(0,T.jsx)(`div`,{className:`mt-2 flex flex-wrap gap-2`,children:Q}),t[70]=Q,t[71]=$);let me;t[72]!==Z||t[73]!==$?(me=(0,T.jsxs)(`div`,{className:`mt-4`,children:[Z,$]}),t[72]=Z,t[73]=$,t[74]=me):me=t[74];let he;t[75]!==E||t[76]!==X||t[77]!==me||t[78]!==S?(he=(0,T.jsxs)(`section`,{className:`rounded-xl bg-surface-hover/20 p-5`,children:[S,E,X,me]}),t[75]=E,t[76]=X,t[77]=me,t[78]=S,t[79]=he):he=t[79];let ge=n.skills.mode===`selected`?i?`选择可用技能`:`Select available skills`:i?`管理例外`:`Manage exceptions`,_e;t[80]===ge?_e=t[81]:(_e=(0,T.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:ge}),t[80]=ge,t[81]=_e);let ve=i?`当前默认可用 ${oe} 个技能。`:`${oe} skills are available by default.`,ye;t[82]===ve?ye=t[83]:(ye=(0,T.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:ve}),t[82]=ve,t[83]=ye);let be;t[84]!==_e||t[85]!==ye?(be=(0,T.jsxs)(`div`,{children:[_e,ye]}),t[84]=_e,t[85]=ye,t[86]=be):be=t[86];let xe=i?`搜索技能`:`Search skills`,Se;t[87]===xe?Se=t[88]:(Se=(0,T.jsx)(`span`,{className:`sr-only`,children:xe}),t[87]=xe,t[88]=Se);let Ce;t[89]===Symbol.for(`react.memo_cache_sentinel`)?(Ce=(0,T.jsx)(te,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-fg-subtle`}),t[89]=Ce):Ce=t[89];let we;t[90]===Symbol.for(`react.memo_cache_sentinel`)?(we=e=>d(e.target.value),t[90]=we):we=t[90];let Te=i?`搜索技能`:`Search skills`,Ee;t[91]!==u||t[92]!==Te?(Ee=(0,T.jsx)(`input`,{type:`search`,value:u,onChange:we,placeholder:Te,className:`w-full rounded-lg border border-edge bg-surface-panel py-2 pl-9 pr-3 text-sm text-fg outline-none focus:border-accent`}),t[91]=u,t[92]=Te,t[93]=Ee):Ee=t[93];let De;t[94]!==Se||t[95]!==Ee?(De=(0,T.jsxs)(`label`,{className:`relative block w-full sm:w-72`,children:[Se,Ce,Ee]}),t[94]=Se,t[95]=Ee,t[96]=De):De=t[96];let Oe;t[97]!==be||t[98]!==De?(Oe=(0,T.jsxs)(`div`,{className:`flex flex-wrap items-end justify-between gap-3`,children:[be,De]}),t[97]=be,t[98]=De,t[99]=Oe):Oe=t[99];let ke;t[100]===c?ke=t[101]:(ke=c?(0,T.jsx)(`p`,{className:`mt-4 rounded-lg bg-red-500/10 px-3 py-2 text-sm text-red-600`,children:c instanceof Error?c.message:String(c)}):null,t[100]=c,t[101]=ke);let Ae;t[102]!==g||t[103]!==ee||t[104]!==m||t[105]!==v||t[106]!==i?(Ae=ee?(0,T.jsx)(`div`,{className:`mt-4 space-y-2`,children:[0,1,2,3].map(A)}):(0,T.jsxs)(`div`,{className:`mt-4 flex max-h-[32rem] flex-col gap-1 overflow-y-auto rounded-xl bg-surface-base/45 p-1 [&>label]:rounded-lg [&>label]:bg-surface-panel/55`,children:[m.map(e=>{let t=g(e.name);return(0,T.jsxs)(`label`,{className:ne(`flex cursor-pointer items-start gap-3 px-4 py-3 hover:bg-surface-hover/60`,!e.enabled&&`cursor-not-allowed opacity-55`),children:[(0,T.jsx)(`input`,{type:`checkbox`,checked:t,disabled:!e.enabled,onChange:()=>v(e.name),className:`mt-0.5 size-4 rounded border-edge accent-[var(--color-accent)]`}),(0,T.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,T.jsxs)(`span`,{className:`flex flex-wrap items-center gap-2`,children:[(0,T.jsx)(`span`,{className:`text-sm font-medium text-fg`,children:e.name}),e.enabled?null:(0,T.jsx)(`span`,{className:`rounded-full bg-surface-hover px-2 py-0.5 text-[10px] text-fg-muted`,children:i?`全局未启用`:`Disabled globally`})]}),e.description?(0,T.jsx)(`span`,{className:`mt-1 block line-clamp-2 text-xs leading-5 text-fg-muted`,children:e.description}):null]})]},e.name)}),m.length===0?(0,T.jsx)(`p`,{className:`px-4 py-8 text-center text-sm text-fg-muted`,children:i?`没有匹配的技能。`:`No matching skills.`}):null]}),t[102]=g,t[103]=ee,t[104]=m,t[105]=v,t[106]=i,t[107]=Ae):Ae=t[107];let je;t[108]!==Oe||t[109]!==ke||t[110]!==Ae?(je=(0,T.jsxs)(`section`,{className:`rounded-xl bg-surface-hover/20 p-5`,children:[Oe,ke,Ae]}),t[108]=Oe,t[109]=ke,t[110]=Ae,t[111]=je):je=t[111];let Me;return t[112]!==he||t[113]!==je?(Me=(0,T.jsxs)(`div`,{className:`space-y-5`,children:[he,je]}),t[112]=he,t[113]=je,t[114]=Me):Me=t[114],Me}function A(e){return(0,T.jsx)(f,{className:`h-14 rounded-xl`},e)}function j(e){return e.name}function M(e){return e.enabled}function fe(e,t){return e.name.localeCompare(t.name)}function N(e){return e.name}var P={read:[`read_file`,`read`,`list_directory`,`search_files`,`web_search`,`web_fetch`,`read_task`],files:[`apply_patch`,`write_file`,`edit_file`],execute:[`exec_command`,`execute_code`,`write_stdin`],devices:[`browser_use`,`computer_use`,`phone_use`],external:[`send_message`,`send_media`,`publish_artifact`,`publish_task_result`]};function F(e){return Object.entries(P).find(([,t])=>t.includes(e))?.[0]??`other`}function I(e,t){let n={read:[`读取与查找资料`,`Read and find information`],files:[`修改文件`,`Change files`],execute:[`运行命令与代码`,`Run commands and code`],devices:[`操作网页与设备`,`Control browsers and devices`],external:[`发送与发布内容`,`Send and publish content`],other:[`其他与组合工具`,`Other and compound tools`]};return(n[e]??n.other)[+!t]}function L(e){let t=Number.parseInt(e,10);return Number.isFinite(t)&&t>0?t:void 0}function R(e){let t=(0,ce.c)(94),{draft:n,setDraft:r,builtinTools:i,zh:a}=e,o=v(),[s,c]=(0,w.useState)(``),[l,ee]=(0,w.useState)(`all`),[u,f]=(0,w.useState)(),p;t[0]===i?p=t[1]:(p=new Map(i.map(H)),t[0]=i,t[1]=p);let m=p,h;t[2]!==i||t[3]!==n.tools?(h=[...new Set([...i.map(V),...Object.keys(n.tools)])].filter(B).sort(z),t[2]=i,t[3]=n.tools,t[4]=h):h=t[4];let g=h,_;if(t[5]!==g||t[6]!==n.tools){let e;t[8]===n.tools?e=t[9]:(e=e=>(n.tools[e]?.mode??`allow`)===`allow`,t[8]=n.tools,t[9]=e),_=g.filter(e),t[5]=g,t[6]=n.tools,t[7]=_}else _=t[7];let ae=_.length,y;if(t[10]!==g||t[11]!==n.tools){let e;t[13]===n.tools?e=t[14]:(e=e=>n.tools[e]?.mode===`ask`,t[13]=n.tools,t[14]=e),y=g.filter(e),t[10]=g,t[11]=n.tools,t[12]=y}else y=t[12];let se=y.length,x;if(t[15]!==g||t[16]!==n.tools){let e;t[18]===n.tools?e=t[19]:(e=e=>n.tools[e]?.mode===`deny`,t[18]=n.tools,t[19]=e),x=g.filter(e),t[15]=g,t[16]=n.tools,t[17]=x}else x=t[17];let S;t[20]!==_.length||t[21]!==y.length||t[22]!==x.length?(S={allow:ae,ask:se,deny:x.length},t[20]=_.length,t[21]=y.length,t[22]=x.length,t[23]=S):S=t[23];let C=S,E;if(t[24]!==g||t[25]!==m||t[26]!==n.tools||t[27]!==l||t[28]!==s){let e=s.trim().toLowerCase();E=g.filter(t=>{let r=n.tools[t]?.mode??`allow`,i=m.get(t),a=`${t} ${i?.en??``} ${i?.zh??``}`.toLowerCase();return(!e||a.includes(e))&&(l===`all`||r===l)}),t[24]=g,t[25]=m,t[26]=n.tools,t[27]=l,t[28]=s,t[29]=E}else E=t[29];let D=E,le;t[30]!==n||t[31]!==r?(le=(e,t)=>{let i=n.tools[e]??{mode:`allow`};r({...n,tools:{...n.tools,[e]:{...i,...t}}})},t[30]=n,t[31]=r,t[32]=le):le=t[32];let O=le,k=a?`全部 ${g.length}`:`All ${g.length}`,ue;t[33]===k?ue=t[34]:(ue={id:`all`,label:k},t[33]=k,t[34]=ue);let de=a?`允许 ${C.allow}`:`Allow ${C.allow}`,A;t[35]===de?A=t[36]:(A={id:`allow`,label:de},t[35]=de,t[36]=A);let j=a?`询问 ${C.ask}`:`Ask ${C.ask}`,M;t[37]===j?M=t[38]:(M={id:`ask`,label:j},t[37]=j,t[38]=M);let fe=a?`禁用 ${C.deny}`:`Deny ${C.deny}`,N;t[39]===fe?N=t[40]:(N={id:`deny`,label:fe},t[39]=fe,t[40]=N);let P;t[41]!==ue||t[42]!==A||t[43]!==M||t[44]!==N?(P=[ue,A,M,N],t[41]=ue,t[42]=A,t[43]=M,t[44]=N,t[45]=P):P=t[45];let R=P,U=a?`默认工具权限`:`Default tool permissions`,W;t[46]===U?W=t[47]:(W=(0,T.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:U}),t[46]=U,t[47]=W);let G=a?`允许:直接执行;询问:执行前确认;禁用:智能体无法使用。分组只解释用途;命令、组合工具的实际读写与外部影响取决于调用内容,请逐项核对。`:`Allow runs directly, Ask requires confirmation, and Deny makes the tool unavailable.`,K;t[48]===G?K=t[49]:(K=(0,T.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:G}),t[48]=G,t[49]=K);let q;t[50]!==W||t[51]!==K?(q=(0,T.jsxs)(`div`,{children:[W,K]}),t[50]=W,t[51]=K,t[52]=q):q=t[52];let J=a?`工具筛选`:`Tool filter`,Y;t[53]!==l||t[54]!==R?(Y=R.map(e=>(0,T.jsx)(`button`,{"aria-pressed":l===e.id,type:`button`,onClick:()=>ee(e.id),className:ne(`rounded-lg px-3 py-1.5 text-xs font-medium`,l===e.id?`bg-surface-base text-fg shadow-surface`:`text-fg-muted hover:text-fg`),children:e.label},e.id)),t[53]=l,t[54]=R,t[55]=Y):Y=t[55];let X;t[56]!==J||t[57]!==Y?(X=(0,T.jsx)(ie,{className:`flex flex-wrap gap-1 rounded-xl bg-surface-panel p-1`,role:`group`,"aria-label":J,indicatorClassName:`rounded-lg bg-surface-base shadow-surface`,children:Y}),t[56]=J,t[57]=Y,t[58]=X):X=t[58];let pe=a?`搜索工具`:`Search tools`,Z;t[59]===pe?Z=t[60]:(Z=(0,T.jsx)(`span`,{className:`sr-only`,children:pe}),t[59]=pe,t[60]=Z);let Q;t[61]===Symbol.for(`react.memo_cache_sentinel`)?(Q=(0,T.jsx)(te,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-fg-subtle`}),t[61]=Q):Q=t[61];let $;t[62]===Symbol.for(`react.memo_cache_sentinel`)?($=e=>c(e.target.value),t[62]=$):$=t[62];let me=a?`搜索工具`:`Search tools`,he;t[63]!==s||t[64]!==me?(he=(0,T.jsx)(`input`,{type:`search`,value:s,onChange:$,placeholder:me,className:`w-full rounded-lg border border-edge bg-surface-panel py-2 pl-9 pr-3 text-sm text-fg outline-none focus:border-accent`}),t[63]=s,t[64]=me,t[65]=he):he=t[65];let ge;t[66]!==Z||t[67]!==he?(ge=(0,T.jsxs)(`label`,{className:`relative block w-full sm:w-72`,children:[Z,Q,he]}),t[66]=Z,t[67]=he,t[68]=ge):ge=t[68];let _e;t[69]!==X||t[70]!==ge?(_e=(0,T.jsxs)(`div`,{className:`mt-5 flex flex-wrap items-center justify-between gap-3`,children:[X,ge]}),t[69]=X,t[70]=ge,t[71]=_e):_e=t[71];let ve=a?`工具调用限制`:`Tool call limits`,ye=a?`每个工具的调用次数和超时限制继续生效;授权可在下方直接修改。`:`Call and timeout limits remain active; edit permissions below.`,be;t[72]!==ve||t[73]!==ye?(be=(0,T.jsx)(oe,{title:ve,summary:ye,children:null}),t[72]=ve,t[73]=ye,t[74]=be):be=t[74];let xe;t[75]!==m||t[76]!==n.tools||t[77]!==u||t[78]!==o||t[79]!==O||t[80]!==D||t[81]!==a?(xe=D.map((e,t)=>{let r=n.tools[e]??{mode:`allow`},i=m.get(e),s=u===e;return(0,T.jsxs)(`div`,{className:`px-4 py-3`,children:[t===0||F(D[t-1])!==F(e)?(0,T.jsx)(`h3`,{className:`mb-3 border-b border-edge pb-2 text-sm font-semibold text-fg`,children:I(F(e),a)}):null,(0,T.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[(0,T.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,T.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:(a?i?.zh:i?.en)||e}),(0,T.jsx)(`code`,{className:`text-xs text-fg-muted`,children:e})]}),(0,T.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,T.jsx)(ie,{className:`flex rounded-lg bg-surface-base p-1`,role:`group`,"aria-label":e,indicatorClassName:`rounded-md bg-accent`,children:[`allow`,`ask`,`deny`].map(t=>(0,T.jsx)(`button`,{"aria-pressed":r.mode===t,type:`button`,onClick:()=>O(e,{mode:t}),className:ne(`rounded-md px-2.5 py-1 text-xs font-medium capitalize`,r.mode===t?`bg-accent text-on-accent`:`text-fg-muted hover:text-fg`),children:t===`allow`?a?`允许`:`Allow`:t===`ask`?a?`询问`:`Ask`:a?`禁用`:`Deny`},t))}),o?(0,T.jsx)(re,{variant:`ghost`,className:`px-2 py-1`,"aria-label":a?`${e} 调用限制`:`${e} call limits`,onClick:()=>f(s?void 0:e),children:(0,T.jsx)(d,{className:`size-4`})}):null]})]}),s&&o?(0,T.jsxs)(`div`,{className:`mt-3 grid gap-3 rounded-lg bg-surface-base p-3 sm:grid-cols-2`,children:[(0,T.jsxs)(`label`,{className:`block text-xs font-medium text-fg-muted`,children:[a?`每轮最多调用次数`:`Maximum calls per turn`,(0,T.jsx)(b,{allowEmpty:!0,type:`number`,min:1,value:r.maxCallsPerTurn??``,placeholder:a?`不限制`:`Unlimited`,onChange:t=>O(e,{maxCallsPerTurn:L(t.target.value)}),className:`mt-2 w-full rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg outline-none focus:border-accent`})]}),(0,T.jsxs)(`label`,{className:`block text-xs font-medium text-fg-muted`,children:[a?`单次超时(毫秒)`:`Call timeout (ms)`,(0,T.jsx)(b,{allowEmpty:!0,type:`number`,min:1,value:r.timeoutMs??``,placeholder:a?`使用系统默认值`:`Use system default`,onChange:t=>O(e,{timeoutMs:L(t.target.value)}),className:`mt-2 w-full rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg outline-none focus:border-accent`})]})]}):null]},e)}),t[75]=m,t[76]=n.tools,t[77]=u,t[78]=o,t[79]=O,t[80]=D,t[81]=a,t[82]=xe):xe=t[82];let Se;t[83]!==D.length||t[84]!==a?(Se=D.length===0?(0,T.jsx)(`p`,{className:`px-4 py-10 text-center text-sm text-fg-muted`,children:a?`没有匹配的工具。`:`No matching tools.`}):null,t[83]=D.length,t[84]=a,t[85]=Se):Se=t[85];let Ce;t[86]!==xe||t[87]!==Se?(Ce=(0,T.jsxs)(`div`,{className:`mt-4 flex max-h-[38rem] flex-col gap-1 overflow-y-auto rounded-xl bg-surface-base/45 p-1 [&>*]:rounded-lg [&>*]:bg-surface-panel/55`,children:[xe,Se]}),t[86]=xe,t[87]=Se,t[88]=Ce):Ce=t[88];let we;return t[89]!==q||t[90]!==_e||t[91]!==be||t[92]!==Ce?(we=(0,T.jsxs)(`section`,{className:`rounded-xl bg-surface-hover/20 p-5`,children:[q,_e,be,Ce]}),t[89]=q,t[90]=_e,t[91]=be,t[92]=Ce,t[93]=we):we=t[93],we}function z(e,t){return[`read`,`files`,`execute`,`external`,`devices`,`other`].indexOf(F(e))-[`read`,`files`,`execute`,`external`,`devices`,`other`].indexOf(F(t))||e.localeCompare(t)}function B(e){return e!==`computer_use`||g()}function V(e){return e.id}function H(e){return[e.id,e.description]}function U(){let e=(0,ce.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,T.jsxs)(se,{gap:`gap-5`,children:[(0,T.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,T.jsxs)(`div`,{className:`space-y-2`,children:[(0,T.jsx)(f,{className:`h-7 w-56`}),(0,T.jsx)(f,{className:`h-4 w-96 max-w-full`})]}),(0,T.jsx)(f,{className:`h-9 w-28`})]}),(0,T.jsx)(f,{className:`h-20 rounded-2xl`}),(0,T.jsx)(f,{className:`h-12 rounded-xl`}),(0,T.jsx)(f,{className:`h-72 rounded-2xl`})]}),e[0]=t):t=e[0],t}function W(e){let t=(0,ce.c)(65),{initial:n,builtinTools:r,zh:a}=e,[o,s]=i(),l;t[0]===o?l=t[1]:(l=o.get(`panel`),t[0]=o,t[1]=l);let te=l,d=te===`skills`||te===`tools`||te===`runtime`?te:`skills`,f;t[2]!==o||t[3]!==s?(f=e=>{let t=new URLSearchParams(o);t.set(`panel`,e),s(t,{replace:!0})},t[2]=o,t[3]=s,t[4]=f):f=t[4];let p=f,m;t[5]===n?m=t[6]:(m=()=>structuredClone(n),t[5]=n,t[6]=m);let[h,g]=(0,w.useState)(m),_;t[7]===n?_=t[8]:(_=()=>structuredClone(n),t[7]=n,t[8]=_);let[v,oe]=(0,w.useState)(_),b;t[9]===h?b=t[10]:(b=JSON.stringify(h),t[9]=h,t[10]=b);let E;t[11]===v?E=t[12]:(E=JSON.stringify(v),t[11]=v,t[12]=E);let D=b!==E,le=a?`技能`:`Skills`,k;t[13]===le?k=t[14]:(k={id:`skills`,label:le,icon:ee},t[13]=le,t[14]=k);let ue=a?`工具`:`Tools`,A;t[15]===ue?A=t[16]:(A={id:`tools`,label:ue,icon:u},t[15]=ue,t[16]=A);let j=a?`运行`:`Runtime`,M;t[17]===j?M=t[18]:(M={id:`runtime`,label:j,icon:c},t[17]=j,t[18]=M);let fe;t[19]!==A||t[20]!==M||t[21]!==k?(fe=[k,A,M],t[19]=A,t[20]=M,t[21]=k,t[22]=fe):fe=t[22];let N=fe,P;t[23]===Symbol.for(`react.memo_cache_sentinel`)?(P=async e=>{let t=structuredClone(e),n=await y(),r=await ae({...t,models:n.defaults.models},{scope:`agent`}),i=structuredClone(r.defaults);g(e=>JSON.stringify(e)===JSON.stringify(t)?i:e),oe(structuredClone(i))},t[23]=P):P=t[23];let F=P,I;t[24]!==D||t[25]!==h?(I={value:h,dirty:D,onSave:F,delayMs:0},t[24]=D,t[25]=h,t[26]=I):I=t[26];let L=C(I),z=L.onBlurCapture,B=a?`智能体设置`:`Agent settings`,V;t[27]!==L.error||t[28]!==L.status?(V=(0,T.jsx)(S,{status:L.status,error:L.error}),t[27]=L.error,t[28]=L.status,t[29]=V):V=t[29];let H;t[30]!==B||t[31]!==V?(H=(0,T.jsx)(x,{title:B,actions:V}),t[30]=B,t[31]=V,t[32]=H):H=t[32];let U;t[33]!==L.error||t[34]!==L.retry||t[35]!==a?(U=L.error?(0,T.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2 rounded-xl bg-red-500/10 px-3 py-2 text-sm text-red-600`,children:[(0,T.jsx)(`span`,{children:L.error}),(0,T.jsx)(re,{type:`button`,variant:`ghost`,className:`h-8 text-red-600`,onClick:L.retry,children:a?`重试`:`Retry`})]}):null,t[33]=L.error,t[34]=L.retry,t[35]=a,t[36]=U):U=t[36];let W=a?`默认配置分区`:`Default configuration sections`,G;t[37]!==d||t[38]!==p||t[39]!==N?(G=N.map(e=>{let{id:t,label:n,icon:r}=e;return(0,T.jsxs)(`button`,{type:`button`,"aria-pressed":d===t,onClick:()=>p(t),className:ne(`flex min-w-0 items-center justify-center gap-2 rounded-lg px-3 py-2.5 text-left transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,d===t?`bg-surface-base text-fg shadow-surface`:`text-fg-muted hover:bg-surface-hover hover:text-fg`),children:[(0,T.jsx)(r,{className:ne(`size-4 shrink-0`,d===t?`text-accent`:`text-fg-subtle`)}),(0,T.jsx)(`span`,{className:`text-sm font-medium`,children:n})]},t)}),t[37]=d,t[38]=p,t[39]=N,t[40]=G):G=t[40];let K;t[41]!==W||t[42]!==G?(K=(0,T.jsx)(ie,{as:`nav`,className:`grid grid-cols-3 gap-1 rounded-xl bg-surface-hover/20 p-1`,"aria-label":W,indicatorClassName:`rounded-lg bg-surface-base shadow-surface`,children:G}),t[41]=W,t[42]=G,t[43]=K):K=t[43];let q;t[44]!==d||t[45]!==h||t[46]!==a?(q=d===`skills`?(0,T.jsx)(de,{draft:h,setDraft:g,zh:a}):null,t[44]=d,t[45]=h,t[46]=a,t[47]=q):q=t[47];let J;t[48]!==d||t[49]!==r||t[50]!==h||t[51]!==a?(J=d===`tools`?(0,T.jsx)(R,{draft:h,setDraft:g,builtinTools:r,zh:a}):null,t[48]=d,t[49]=r,t[50]=h,t[51]=a,t[52]=J):J=t[52];let Y;t[53]!==d||t[54]!==h||t[55]!==a?(Y=d===`runtime`?(0,T.jsx)(O,{draft:h,setDraft:g,zh:a}):null,t[53]=d,t[54]=h,t[55]=a,t[56]=Y):Y=t[56];let X;return t[57]!==L.onBlurCapture||t[58]!==H||t[59]!==U||t[60]!==K||t[61]!==q||t[62]!==J||t[63]!==Y?(X=(0,T.jsxs)(se,{gap:`gap-5`,onBlurCapture:z,children:[H,U,K,q,J,Y]}),t[57]=L.onBlurCapture,t[58]=H,t[59]=U,t[60]=K,t[61]=q,t[62]=J,t[63]=Y,t[64]=X):X=t[64],X}function G(){let e=(0,ce.c)(17),t=a(q),n=o(K)===`zh`,{data:r,error:i,isLoading:s,mutate:c}=h(t?`settings-agent-defaults`:null,y);if(!t){let t=n?`需要本机服务令牌。`:`Local service token required.`,r;return e[0]===t?r=e[1]:(r=(0,T.jsx)(se,{children:(0,T.jsx)(`p`,{className:`text-sm text-fg-muted`,children:t})}),e[0]=t,e[1]=r),r}if(i&&!r){let t=String(i),r;e[2]===t?r=e[3]:(r=(0,T.jsx)(`p`,{className:`rounded-xl bg-red-500/10 px-3 py-2 text-sm text-red-600`,children:t}),e[2]=t,e[3]=r);let a;e[4]===c?a=e[5]:(a=()=>void c(),e[4]=c,e[5]=a);let o=n?`重试`:`Retry`,s;e[6]!==a||e[7]!==o?(s=(0,T.jsx)(re,{onClick:a,children:o}),e[6]=a,e[7]=o,e[8]=s):s=e[8];let l;return e[9]!==r||e[10]!==s?(l=(0,T.jsxs)(se,{children:[r,s]}),e[9]=r,e[10]=s,e[11]=l):l=e[11],l}if(s||!r){let t;return e[12]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,T.jsx)(U,{}),e[12]=t):t=e[12],t}let l;return e[13]!==r.builtinTools||e[14]!==r.defaults||e[15]!==n?(l=(0,T.jsx)(W,{initial:r.defaults,builtinTools:r.builtinTools,zh:n}),e[13]=r.builtinTools,e[14]=r.defaults,e[15]=n,e[16]=l):l=e[16],l}function K(e){return e.language}function q(e){return e.conversationId}export{G as AgentDefaultsSettingsPanel};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{l as i,t as a,u as o}from"./chunk-KS7C4IRE-CiwuuyV8.js";import{i as s,n as c,o as l}from"./locale-store-fGFrr4_4.js";import{t as u}from"./messages-9OwWjlww.js";import{a as d,i as f,o as p,r as m,s as h,t as g}from"./dist-BGTk37IG.js";import{t as _}from"./arrow-left-D880xG-P.js";import{t as v}from"./chevron-down-ccbiQQz_.js";import{t as y}from"./working-directory-picker-modal-CpZEiO2a.js";import{t as b}from"./circle-alert-BEjgurr2.js";import{t as ee}from"./circle-check-C23XjkUj.js";import{t as te}from"./circle-BoO4YvTx.js";import{t as x}from"./file-archive-DanfQJNe.js";import{t as S}from"./folder-open-CyzJ19I9.js";import{t as ne}from"./loader-circle-CifKLtgG.js";import{t as re}from"./package-wATCyihJ.js";import{t as C}from"./shield-check-BU58siTV.js";import{t as w}from"./upload-rrb46c3c.js";import{t as T}from"./cn-0WouolD0.js";import{t as ie}from"./skeleton-BI5TyibZ.js";import{a as E}from"./vendor-swr-CdRzEUwF.js";import{t as D}from"./button-Cc4hUNTt.js";import{t as ae}from"./capability-links-DzQWK1Fh.js";import{t as O}from"./browser-BLJWD7WI.js";import{t as k}from"./capability-icon-DVoZxEgW.js";var oe=n(),A=r();function j(e){let t=(0,oe.c)(30),{data:n,zh:r}=e,i=r?`插件内容与范围`:`Contents and access`,a;t[0]===i?a=t[1]:(a=(0,A.jsx)(`h4`,{className:`font-medium text-fg`,children:i}),t[0]=i,t[1]=a);let o=r?`新增技能:`:`Skills: `,s;t[2]!==n.latestVersion.componentIndex?.skills||t[3]!==r?(s=n.latestVersion.componentIndex?.skills.join(`, `)||(r?`目录未提供清单`:`Not listed in catalog`),t[2]=n.latestVersion.componentIndex?.skills,t[3]=r,t[4]=s):s=t[4];let c;t[5]!==o||t[6]!==s?(c=(0,A.jsxs)(`p`,{children:[o,s]}),t[5]=o,t[6]=s,t[7]=c):c=t[7];let l=r?`工具连接:`:`Tool connections: `,u;t[8]!==n.latestVersion.componentIndex?.mcpServers||t[9]!==r?(u=n.latestVersion.componentIndex?.mcpServers.map(M).join(`, `)||(r?`目录未提供清单`:`Not listed in catalog`),t[8]=n.latestVersion.componentIndex?.mcpServers,t[9]=r,t[10]=u):u=t[10];let d;t[11]!==l||t[12]!==u?(d=(0,A.jsxs)(`p`,{children:[l,u]}),t[11]=l,t[12]=u,t[13]=d):d=t[13];let f=r?`运行范围:`:`Runtime scope: `,p=n.latestVersion.riskTier===`local-exec`?r?`包含本机代码执行,可能访问本机文件或网络`:`Includes local code execution; may access local files or networks`:n.latestVersion.riskTier===`network`?r?`包含网络服务调用;数据范围取决于账号授权`:`Includes network service calls; data scope depends on authorization`:n.latestVersion.riskTier===`content`?r?`目录标记为内容能力`:`Catalog classifies this as content capabilities`:r?`目录未声明,请查看说明与来源`:`Not declared; review documentation and source`,m;t[14]!==p||t[15]!==f?(m=(0,A.jsxs)(`p`,{children:[f,p]}),t[14]=p,t[15]=f,t[16]=m):m=t[16];let h=r?`授权与来源`:`Authorization and source`,g;t[17]===h?g=t[18]:(g=(0,A.jsx)(`summary`,{className:`w-fit cursor-pointer rounded focus-visible:outline-accent`,children:h}),t[17]=h,t[18]=g);let _=r?`发布者认证只验证来源,不授予操作权限。账号授权与依赖需另行设置。未列出权限不代表没有文件或外部访问。`:`Publisher verification does not grant permissions. Accounts and dependencies require separate setup. Missing scope metadata does not mean no file or external access.`,v;t[19]===_?v=t[20]:(v=(0,A.jsx)(`p`,{className:`mt-2 leading-5`,children:_}),t[19]=_,t[20]=v);let y;t[21]!==g||t[22]!==v?(y=(0,A.jsxs)(`details`,{className:`text-xs`,children:[g,v]}),t[21]=g,t[22]=v,t[23]=y):y=t[23];let b;return t[24]!==m||t[25]!==y||t[26]!==a||t[27]!==c||t[28]!==d?(b=(0,A.jsxs)(`section`,{className:`mt-4 space-y-2 rounded-lg border border-edge p-4 text-sm text-fg-muted`,children:[a,c,d,m,y]}),t[24]=m,t[25]=y,t[26]=a,t[27]=c,t[28]=d,t[29]=b):b=t[29],b}function M(e){return`${e.name} (${e.transport})`}var N=e(O(),1),P=e(t(),1);function F(e){let t=(0,oe.c)(6),{fields:n,values:r,onChange:i}=e,a;t[0]===n?a=t[1]:(a=Object.entries(n),t[0]=n,t[1]=a);let o;return t[2]!==i||t[3]!==a||t[4]!==r?(o=(0,A.jsx)(A.Fragment,{children:a.map(e=>{let[t,n]=e;return(0,A.jsxs)(`label`,{className:`block space-y-1.5 text-sm`,children:[(0,A.jsxs)(`span`,{children:[n.title,n.required?` *`:``]}),n.type===`boolean`?(0,A.jsx)(`input`,{type:`checkbox`,checked:r[t]===!0,onChange:e=>i({...r,[t]:e.target.checked})}):(0,A.jsx)(`input`,{className:`w-full rounded-lg border border-edge bg-surface-inset px-3 py-2.5`,type:n.sensitive?`password`:n.type===`number`?`number`:`text`,required:n.required,autoComplete:`off`,value:String(r[t]??``),onChange:e=>i({...r,[t]:n.type===`number`?Number(e.target.value):e.target.value})})]},t)})}),t[2]=i,t[3]=a,t[4]=r,t[5]=o):o=t[5],o}function se(e){let t=(0,oe.c)(62),{account:n,fields:r,zh:i,busy:a,attempt:o,initialMethod:s,onBack:c,onConnect:l,onSave:u,onRedirect:d,onSkip:f}=e,[p,m]=(0,P.useState)(s&&n.methods.some(e=>e.id===s)?s:n.methods[0]?.id??``),h;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(h={},t[0]=h):h=t[0];let[g,v]=(0,P.useState)(h),[y,b]=(0,P.useState)(``),[ee,te]=(0,P.useState)(),x;t[1]===p?x=t[2]:(x=e=>e.id===p,t[1]=p,t[2]=x);let S=n.methods.find(x),re;t[3]===i?re=t[4]:(re=(e,t)=>i?e:t,t[3]=i,t[4]=re);let C=re,w=o?.challenge?.type===`qr`?o.challenge.url:void 0,T,E;t[5]===w?(T=t[6],E=t[7]):(T=()=>{let e=!1;return te(void 0),w&&N.toDataURL(w,{width:240,margin:2}).then(t=>{e||te(t)}).catch(L),()=>{e=!0}},E=[w],t[5]=w,t[6]=T,t[7]=E),(0,P.useEffect)(T,E);let ae;t[8]===o?ae=t[9]:(ae=o&&![`cancelled`,`error`,`connected`].includes(o.state),t[8]=o,t[9]=ae);let O=ae,k=o?.authorizationUrl??o?.challenge?.url,j=`连接 ${n.title}`,M=`Connect ${n.title}`,se;t[10]!==C||t[11]!==j||t[12]!==M?(se=C(j,M),t[10]=C,t[11]=j,t[12]=M,t[13]=se):se=t[13];let R;t[14]===C?R=t[15]:(R=C(`返回插件详情`,`Back to plugin details`),t[14]=C,t[15]=R);let z;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(z=(0,A.jsx)(_,{className:`size-4`}),t[16]=z):z=t[16];let B;t[17]!==c||t[18]!==R?(B=(0,A.jsx)(D,{variant:`ghost`,className:`shrink-0`,onClick:c,"aria-label":R,children:z}),t[17]=c,t[18]=R,t[19]=B):B=t[19];let V;t[20]===C?V=t[21]:(V=C(`连接 `,`Connect `),t[20]=C,t[21]=V);let H;t[22]!==n.title||t[23]!==V?(H=(0,A.jsxs)(`h3`,{className:`text-base font-semibold`,children:[V,n.title]}),t[22]=n.title,t[23]=V,t[24]=H):H=t[24];let U;t[25]!==n.description||t[26]!==C?(U=n.description??C(`完成授权后自动检查连接。也可以稍后在详情页继续。`,`The connection is checked after authorization. You can also continue later in plugin details.`),t[25]=n.description,t[26]=C,t[27]=U):U=t[27];let W;t[28]===U?W=t[29]:(W=(0,A.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:U}),t[28]=U,t[29]=W);let G;t[30]!==H||t[31]!==W?(G=(0,A.jsxs)(`div`,{children:[H,W]}),t[30]=H,t[31]=W,t[32]=G):G=t[32];let K;t[33]!==B||t[34]!==G?(K=(0,A.jsxs)(`div`,{className:`flex items-start gap-3`,children:[B,G]}),t[33]=B,t[34]=G,t[35]=K):K=t[35];let q;t[36]!==n.methods||t[37]!==O||t[38]!==a||t[39]!==p||t[40]!==C?(q=n.methods.length>1?(0,A.jsx)(`div`,{role:`tablist`,"aria-label":C(`授权方式`,`Authorization methods`),className:`flex flex-wrap gap-2 rounded-lg bg-surface-inset p-1.5`,children:n.methods.map(e=>(0,A.jsx)(`button`,{role:`tab`,type:`button`,"aria-selected":p===e.id,className:`min-h-10 rounded-md px-3 text-sm ${p===e.id?`bg-surface-panel font-medium text-fg`:`text-fg-muted`}`,disabled:a||!!O,onClick:()=>{m(e.id),v({})},children:e.title},e.id))}):null,t[36]=n.methods,t[37]=O,t[38]=a,t[39]=p,t[40]=C,t[41]=q):q=t[41];let J=S?.instructions?.length||S?.helpUrl?(0,A.jsxs)(`div`,{className:`space-y-3 rounded-lg border border-edge bg-surface-inset p-4 text-sm text-fg-muted`,children:[S.instructions?.length?(0,A.jsx)(`ol`,{className:`list-decimal space-y-2 pl-5`,children:S.instructions.map(I)}):null,S.helpUrl?(0,A.jsx)(`a`,{className:`text-accent underline`,href:S.helpUrl,target:`_blank`,rel:`noopener noreferrer`,children:C(`打开官方配置说明`,`Open setup instructions`)}):null]}):null,Y=(S?.type===`form`||S?.fields?.length)&&!O?(0,A.jsxs)(`form`,{className:`space-y-4`,onSubmit:e=>{e.preventDefault(),u(S.id,g)},children:[(0,A.jsx)(F,{fields:Object.fromEntries((S.fields??[]).filter(e=>r[e]).map(e=>[e,{...r[e],required:!0}])),values:g,onChange:v}),(0,A.jsxs)(D,{type:`submit`,disabled:a||!S.fields?.every(e=>g[e]!==void 0&&g[e]!==``),children:[a?(0,A.jsx)(ne,{className:`size-4 animate-spin`,"aria-hidden":!0}):null,C(`保存并连接`,`Save and connect`)]})]}):(0,A.jsxs)(`div`,{className:`space-y-4`,children:[O?null:(0,A.jsx)(D,{disabled:a,onClick:()=>l(p),children:C(`连接账号`,`Connect account`)}),O?(0,A.jsx)(`p`,{role:`status`,className:`text-sm text-fg-muted`,children:o.challenge?.message??(o.state===`preparing`?C(`正在准备登录…`,`Preparing sign-in…`):C(`请完成登录,返回后会自动继续。`,`Finish signing in. Installation continues automatically.`))}):null,w&&O?ee?(0,A.jsx)(`img`,{src:ee,alt:C(`使用 ${n.title} 扫码授权`,`Scan to authorize ${n.title}`),className:`mx-auto size-60 max-w-full rounded-lg`}):(0,A.jsx)(ie,{className:`mx-auto size-60`}):null,k&&O?(0,A.jsx)(`a`,{href:k,target:`_blank`,rel:`noopener noreferrer`,className:`inline-block text-sm text-accent underline`,children:w?C(`也可以打开授权页面`,`Or open the authorization page`):C(`打开登录页面`,`Open sign-in page`)}):null,o?.expiresAt&&O?(0,A.jsxs)(`p`,{className:`text-center text-xs text-fg-muted`,children:[C(`本次授权有效期至 `,`This sign-in expires at `),new Date(o.expiresAt).toLocaleTimeString()]}):null,o?.error?(0,A.jsx)(`p`,{role:`alert`,className:`text-sm text-fg-muted`,children:o.error}):null,o?.acceptsRedirect&&O?(0,A.jsxs)(`details`,{className:`text-sm`,children:[(0,A.jsx)(`summary`,{className:`cursor-pointer text-fg-muted`,children:C(`登录后没有自动返回?`,`Did sign-in not return automatically?`)}),(0,A.jsxs)(`form`,{className:`mt-3 space-y-3`,onSubmit:e=>{e.preventDefault(),d(y)},children:[(0,A.jsxs)(`label`,{children:[C(`登录回调地址`,`Sign-in callback URL`),(0,A.jsx)(`input`,{value:y,onChange:e=>b(e.target.value),className:`mt-1 w-full rounded-lg border border-edge bg-surface-inset p-2`})]}),(0,A.jsx)(D,{type:`submit`,disabled:a||!y,children:C(`继续登录`,`Continue sign-in`)})]})]}):null]}),X;t[42]===C?X=t[43]:(X=C(`暂时跳过`,`Skip for now`),t[42]=C,t[43]=X);let Z;t[44]!==a||t[45]!==f||t[46]!==X?(Z=(0,A.jsx)(D,{variant:`secondary`,disabled:a,onClick:f,children:X}),t[44]=a,t[45]=f,t[46]=X,t[47]=Z):Z=t[47];let Q;t[48]===C?Q=t[49]:(Q=C(`相关功能暂不可用,可随时在插件详情中授权。`,`Features requiring this account stay unavailable. Connect later in plugin details.`),t[48]=C,t[49]=Q);let ce;t[50]===Q?ce=t[51]:(ce=(0,A.jsx)(`p`,{className:`mt-2 text-xs text-fg-muted`,children:Q}),t[50]=Q,t[51]=ce);let le;t[52]!==Z||t[53]!==ce?(le=(0,A.jsxs)(`div`,{className:`border-t border-edge pt-4`,children:[Z,ce]}),t[52]=Z,t[53]=ce,t[54]=le):le=t[54];let ue;return t[55]!==se||t[56]!==K||t[57]!==q||t[58]!==J||t[59]!==Y||t[60]!==le?(ue=(0,A.jsxs)(`section`,{className:`space-y-5`,"aria-label":se,children:[K,q,J,Y,le]}),t[55]=se,t[56]=K,t[57]=q,t[58]=J,t[59]=Y,t[60]=le,t[61]=ue):ue=t[61],ue}function I(e,t){return(0,A.jsx)(`li`,{children:e},t)}function L(){}async function R(e,t=`GET`,n){let r=await l(s(e),{method:t,...n===void 0?{}:{body:JSON.stringify(n)}});if(!r.ok)throw Error(r.error??`Request failed`);return r.payload}function z({extension:e,zh:t,onChanged:n,onStart:r,onInstalled:i,initialConnect:o=!1}){let s=`/api/extensions/agent-plugins/${encodeURIComponent(e.pluginId)}`,[c,l]=(0,P.useState)(),[u,d]=(0,P.useState)({}),[f,p]=(0,P.useState)(!1),[m,h]=(0,P.useState)(``),[g,_]=(0,P.useState)({}),[v,y]=(0,P.useState)(null),[x,S]=(0,P.useState)(``),[re,C]=(0,P.useState)(null),[w,T]=(0,P.useState)(!1),E=(0,P.useRef)(new Set),ae=(0,P.useRef)(new Set),O=(0,P.useRef)(void 0),k=(0,P.useRef)(null),oe=(0,P.useRef)(new Set),j=(e,n)=>t?e:n,M=e.setup?.authorizations??[],N=new Set(M.flatMap(e=>e.servers)),I=[...M,...(c?.connections??[]).filter(t=>!N.has(t.name)&&(e.components?.mcp.find(e=>e.name===t.name)?.type!==`stdio`||t.state===`token_required`)).map(t=>{let n=t.state===`token_required`||t.state===`auth_unknown`||e.components?.mcp.find(e=>e.name===t.name)?.connectionAuth?.mode===`api-key`;return{id:t.name,title:t.name,servers:[t.name],methods:[{id:n?`api-key`:`oauth`,title:n?j(`访问令牌`,`Access token`):j(`浏览器登录`,`Browser sign-in`),type:n?`form`:`oauth`,...n?{fields:[`__apiKey`]}:{server:t.name}}]}})],L=e=>e.servers.every(e=>c?.connections.find(t=>t.name===e)?.state===`connected`)&&(!M.some(t=>t.id===e.id)||c?.authorizations?.find(t=>t.id===e.id)?.state===`connected`),z=(c?.authorizations??[]).flatMap(e=>(e.issues??[]).map(t=>({...t,account:I.find(t=>t.id===e.id)}))),B=I.filter(e=>!L(e)),V=c?.installed||c?.state===`completed`,H=e.setup?.userConfig??{},U=new Set(M.flatMap(e=>e.methods.flatMap(e=>e.fields??[]))),W=Object.fromEntries(Object.entries(H).filter(([e])=>!U.has(e))),G=c?.error===`Connection verification failed. Check the credentials or login status and try again.`?j(`连接验证未通过,请检查凭据或登录状态后重试。`,c.error):c?.error,K=Object.fromEntries(Object.entries(H).filter(([e])=>c?.missingConfig?.includes(e))),q=f||c?.state===`running`,J=I.find(e=>e.id===re);(0,P.useEffect)(()=>{let e=!1;return R(`${s}/setup`).then(t=>{e||l(t)}).catch(t=>{e||(l(null),h(String(t)))}),()=>{e=!0}},[s]),(0,P.useEffect)(()=>{if(c?.state!==`running`)return;let e=!1,t=!1,r=setInterval(()=>{t||(t=!0,R(`${s}/setup`).then(t=>{e||(l(t),t?.state!==`running`&&n())}).catch(t=>{e||h(String(t))}).finally(()=>{t=!1}))},750);return()=>{e=!0,clearInterval(r)}},[s,c?.state]),(0,P.useEffect)(()=>{if(!c||!c.connections.some(e=>[`oauth_required`,`error`].includes(e.state)))return;let e=!1;return R(`${s}/setup/reusable`).then(t=>{e||_(t)}).catch(()=>{e||_({})}),()=>{e=!0}},[s,c?.revision]),(0,P.useEffect)(()=>{if(!x||c?.state===`completed`)return;let e=!1,t=!1,n=async()=>{if(!t){t=!0;try{let t=await R(`${s}/setup/auth/${encodeURIComponent(x)}`);e||y(t)}catch(t){e||h(String(t))}finally{t=!1}}};n();let r=setInterval(()=>void n(),1500),i=()=>void n();return window.addEventListener(`focus`,i),()=>{e=!0,clearInterval(r),window.removeEventListener(`focus`,i)}},[s,x,c?.state]),(0,P.useEffect)(()=>{let e=v?.authorizationUrl??(v?.challenge?.type===`url`?v.challenge.url:void 0);if(!v)return;if(v.error||[`cancelled`,`error`,`connected`].includes(v.state)){k.current?.close(),k.current=null;return}if(!e){v.challenge?.type===`qr`&&(k.current?.close(),k.current=null);return}let t=`${v.id}:${e}`;if(oe.current.has(t))return;oe.current.add(t);let n=k.current;k.current=null,n&&!n.closed?n.location.replace(e):window.open(e,`_blank`,`noopener,noreferrer`)},[v]);async function Y(e,t={},r=c?.revision){p(!0),h(``);try{let a=await R(`${s}/setup`,`POST`,{action:e,expectedRevision:r,...e===`start`?{}:{idempotencyKey:crypto.randomUUID()},...t}),o=e===`configure`&&M.find(e=>e.id===t.authorization)?.methods.some(e=>e.id===t.method&&e.type===`cli`);return([`reuse`,`start`].includes(e)||e===`configure`&&!o)&&(d({}),T(!1),a=await R(`${s}/setup`,`POST`,{action:`prepare`,expectedRevision:a.revision,idempotencyKey:crypto.randomUUID()})),l(a),await n(),[`complete`,`defer`].includes(e)&&(C(null),y(null),S(``),k.current?.close(),k.current=null,i?.()),a}catch(e){h(e instanceof Error?e.message:String(e));try{l(await R(`${s}/setup`))}catch{}return null}finally{p(!1)}}(0,P.useEffect)(()=>{if(!c||q||m||[`cancelled`,`running`,`failed`].includes(c.state)||c.state===`completed`)return;let e,t=``;if(c.state===`pending`?(e=`prepare`,t=`prepare:${s}:${c.revision}`):v?.state===`connected`&&(e=`prepare`,t=`auth:${s}:${v.id}`),e&&!E.current.has(t)){E.current.add(t),Y(e);return}c.resources===`ready`&&!c.missingConfig?.length&&!c.partial&&c.connections.every(e=>e.state===`connected`)&&(c.authorizations??[]).every(e=>e.state===`connected`)&&(t=`complete:${s}:${c.revision}`,E.current.has(t)||(E.current.add(t),Y(`complete`)))},[c,v,q,m,s]),(0,P.useEffect)(()=>{q||!c||c.state===`cancelled`||(J&&c.revision!==O.current&&L(J)?(C(null),y(null),S(``)):(!V||o)&&c.resources===`ready`&&(!c.missingConfig?.length||o&&!c.missingConfig.some(e=>e in W))&&!re&&B[0]&&!ae.current.has(B[0].id)&&(ae.current.add(B[0].id),O.current=c.revision,C(B[0].id)))},[c,q,V,re,o]);function X(e,t){let n=e.methods.find(e=>e.id===t),r=n?.type===`oauth`||n?.type===`cli`?window.open(`about:blank`,`_blank`):null;r&&(r.opener=null),k.current=r,y(null),Y(`authorize`,{server:e.id,...M.some(t=>t.id===e.id)?{method:t}:{}}).then(t=>{t?S(e.id):(r?.close(),k.current=null)})}async function Z(t,n,r){if(n===`api-key`&&!M.some(e=>e.id===t.id)){p(!0),h(``);try{let n=e.components?.mcp.find(e=>e.name===t.id);await R(`${s}/mcp/${encodeURIComponent(t.id)}/auth`,`PUT`,{mode:`api-key`,secrets:[{target:n.type===`stdio`?`env`:`headers`,key:n.connectionAuth?.headerName??(n.type===`stdio`?`API_KEY`:`Authorization`),prefix:n.connectionAuth?.prefix??(n.type===`stdio`?``:`Bearer `),value:r.__apiKey}]});let i=await R(`${s}/setup`);l(i),p(!1),await Y(`prepare`,{},i.revision);return}catch(e){h(String(e)),p(!1);return}p(!1)}else if(t.methods.find(e=>e.id===n)?.type===`cli`){let e=window.open(`about:blank`,`_blank`);e&&(e.opener=null),k.current=e,y(null);let i=await Y(`configure`,{authorization:t.id,method:n,values:r},c?.revision);i&&await Y(`authorize`,{server:t.id,method:n},i.revision)?S(t.id):(e?.close(),k.current=null)}else await Y(`configure`,{authorization:t.id,method:n,values:r})}if(c===void 0)return(0,A.jsx)(ie,{className:`h-40 w-full`});let Q=()=>{Y(`defer`)};return J?(0,A.jsxs)(`div`,{className:`space-y-3`,children:[(0,A.jsx)(se,{initialMethod:c?.authorizations?.find(e=>e.id===J.id)?.method,account:J,fields:{...H,__apiKey:{type:`string`,title:j(`访问令牌`,`Access token`),required:!0,sensitive:!0}},zh:t,busy:q,attempt:v,onBack:()=>C(null),onConnect:e=>X(J,e),onSave:(e,t)=>void Z(J,e,t),onRedirect:e=>{p(!0),R(`${s}/setup/auth/${encodeURIComponent(x)}/redirect`,`POST`,{url:e}).catch(e=>h(String(e))).finally(()=>p(!1))},onSkip:Q},`${J.id}:${c?.authorizations?.find(e=>e.id===J.id)?.method??``}`),g[J.id]?.map(e=>(0,A.jsxs)(D,{disabled:q,variant:`secondary`,onClick:()=>void Y(`reuse`,{server:J.id,sourceServerId:e.id}),children:[j(`使用已登录账号:`,`Use signed-in account: `),e.name]},e.id)),m||G&&J.servers.some(e=>c?.connections.find(t=>t.name===e)?.state===`error`)?(0,A.jsx)(`p`,{role:`alert`,className:`text-sm text-fg-muted`,children:m||G}):null]}):(0,A.jsxs)(`section`,{className:`space-y-5`,"aria-label":j(`插件安装与授权`,`Plugin setup`),children:[V?(0,A.jsxs)(`div`,{children:[(0,A.jsx)(`h3`,{className:`font-medium`,children:j(`安装完成`,`Installation complete`)}),(0,A.jsx)(`p`,{role:`status`,className:`mt-1 text-sm text-fg-muted`,children:e.activationEligible===!1?j(`插件已停用。`,`Plugin is disabled.`):c?.partial||B.length||z.length||c?.missingConfig?.length?j(`插件已安装,部分功能仍需要授权。`,`Plugin installed. Some features still need authorization.`):j(`所有 Agent 均可使用。可在 Agent 设置中单独调整。`,`Available to all agents. Customize individual agents in Agent settings.`)})]}):(0,A.jsxs)(`div`,{className:`rounded-xl border border-edge p-4`,children:[(0,A.jsx)(`h3`,{className:`font-medium`,children:j(`安装准备`,`Installation setup`)}),(0,A.jsx)(`ol`,{className:`mt-4 space-y-4 text-sm`,"aria-live":`polite`,children:[{name:j(`准备资源`,`Prepare resources`),done:c?.resources===`ready`,running:q&&c?.resources!==`ready`},{name:j(`授权账号`,`Authorize accounts`),done:c?.resources===`ready`&&!c?.missingConfig?.length&&B.length===0,running:!1},{name:j(`加载可用工具`,`Load available tools`),done:!1,running:q&&c?.resources===`ready`}].map(e=>(0,A.jsxs)(`li`,{className:`flex items-center gap-3`,children:[e.done?(0,A.jsx)(ee,{className:`size-5 text-accent`,"aria-hidden":!0}):e.running?(0,A.jsx)(ne,{className:`size-5 animate-spin text-accent`,"aria-hidden":!0}):(0,A.jsx)(te,{className:`size-5 text-fg-muted`,"aria-hidden":!0}),e.name]},e.name))}),(0,A.jsx)(`p`,{className:`mt-4 text-xs text-fg-muted`,children:j(`安装后所有 Agent 均可使用,可在各自的设置中调整。`,`Available to all agents after installation. Customize individual agents in Agent settings.`)})]}),!c||c.state===`cancelled`?(0,A.jsx)(D,{disabled:f||e.readiness===`blocked`,onClick:()=>void Y(`start`),children:j(`继续安装`,`Continue installation`)}):(0,A.jsxs)(A.Fragment,{children:[c.missingConfig?.length||w?(0,A.jsxs)(`form`,{className:`space-y-4 rounded-xl border border-edge p-4`,onSubmit:e=>{e.preventDefault(),Y(`configure`,{values:u})},children:[(0,A.jsx)(`h4`,{className:`font-medium`,children:j(`补充配置`,`Required configuration`)}),(0,A.jsx)(F,{fields:w?W:K,values:u,onChange:d}),(0,A.jsx)(D,{type:`submit`,disabled:q||!Object.keys(u).length,children:j(`继续`,`Continue`)})]}):null,V&&(B.length||c.missingConfig?.length)?(0,A.jsxs)(`div`,{className:`flex items-start gap-3 rounded-xl border border-amber-500/30 bg-amber-500/10 p-4 text-sm`,children:[(0,A.jsx)(b,{className:`mt-0.5 size-5 shrink-0`,"aria-hidden":!0}),(0,A.jsxs)(`div`,{children:[(0,A.jsx)(`p`,{className:`font-medium`,children:j(`需要授权`,`Authorization required`)}),(0,A.jsx)(`p`,{className:`mt-1 text-fg-muted`,children:j(`授权后即可使用相关功能。已就绪的功能可继续使用。`,`Connect these accounts to use their features. Ready features remain available.`)})]})]}):null,z.length?(0,A.jsx)(`div`,{className:`space-y-3`,"aria-label":j(`需要补充权限`,`Additional permissions required`),children:z.map(e=>(0,A.jsxs)(`div`,{role:`alert`,className:`space-y-3 rounded-xl border border-amber-500/30 bg-amber-500/10 p-4 text-sm`,children:[(0,A.jsx)(`p`,{className:`font-medium`,children:e.title}),(0,A.jsx)(`p`,{className:`text-fg-muted`,children:j(`账号已连接,以下权限尚未就绪;其他已授权功能可继续使用。`,`Account connected. These permissions are not ready; other authorized features remain available.`)}),e.scopes.length?(0,A.jsx)(`p`,{className:`break-all font-mono text-xs`,children:e.scopes.join(`, `)}):null,(0,A.jsx)(`ol`,{className:`list-inside list-decimal space-y-1 text-fg-muted`,children:e.instructions.map(e=>(0,A.jsx)(`li`,{children:e},e))}),(0,A.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[e.helpUrl?(0,A.jsx)(D,{variant:`secondary`,asChild:!0,children:(0,A.jsx)(`a`,{href:e.helpUrl,target:`_blank`,rel:`noopener noreferrer`,children:j(`前往开通应用权限`,`Open application permissions`)})}):null,e.method&&e.account?(0,A.jsx)(D,{disabled:q,onClick:()=>{O.current=c.revision,C(e.account.id),X(e.account,e.method)},children:j(`补充授权`,`Grant missing permissions`)}):null,(0,A.jsx)(D,{variant:`secondary`,disabled:q,onClick:()=>void Y(`prepare`),children:j(`重新检查权限`,`Check permissions again`)})]})]},`${e.account?.id}:${e.id}`))}):null,I.length?(0,A.jsxs)(`div`,{className:`space-y-2`,children:[(0,A.jsx)(`h4`,{className:`text-sm font-medium`,children:j(`账号与连接`,`Accounts and connections`)}),I.map(e=>(0,A.jsxs)(`div`,{role:`group`,"aria-label":e.title,className:`flex items-center justify-between gap-3 rounded-lg border border-edge p-3`,children:[(0,A.jsxs)(`div`,{className:`min-w-0`,children:[(0,A.jsx)(`p`,{className:`text-sm font-medium`,children:e.title}),(0,A.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:L(e)?j(`已连接`,`Connected`):j(`需要授权`,`Authorization required`)})]}),(0,A.jsx)(D,{variant:L(e)?`secondary`:`primary`,disabled:q||c.resources!==`ready`,onClick:()=>{y(null),S(``),O.current=c.revision,C(e.id)},children:L(e)?j(`重新授权`,`Reconnect`):j(`连接账号`,`Connect account`)})]},e.id))]}):null,!V&&c.resources===`ready`?(0,A.jsxs)(`div`,{children:[(0,A.jsx)(D,{variant:`secondary`,disabled:q,onClick:Q,children:j(`暂时跳过`,`Skip for now`)}),(0,A.jsx)(`p`,{className:`mt-2 text-xs text-fg-muted`,children:j(`先完成安装,稍后在详情页授权。未授权的功能暂不可用。`,`Finish installation and connect later in plugin details. Unauthenticated features remain unavailable.`)})]}):null,V&&Object.keys(W).length&&!w?(0,A.jsx)(D,{variant:`ghost`,disabled:q,onClick:()=>T(!0),children:j(`修改插件配置`,`Edit plugin configuration`)}):null,V&&!z.length&&M.some(e=>e.methods.some(e=>e.type===`cli`))?(0,A.jsx)(D,{variant:`secondary`,disabled:q,onClick:()=>void Y(`prepare`),children:j(`检查连接与权限`,`Check connection and permissions`)}):null,!q&&(m||[`failed`,`interrupted`].includes(c.state)||c.connections.some(e=>e.state===`error`))?(0,A.jsx)(D,{variant:`secondary`,onClick:()=>void Y(`prepare`),children:j(`重试检查`,`Retry checks`)}):null,V?null:(0,A.jsx)(D,{variant:`ghost`,disabled:f,onClick:()=>void Y(`cancel`),children:j(`取消安装`,`Cancel installation`)}),V&&!B.length&&!c.missingConfig?.length?e.setup?.tasks?.map(t=>(0,A.jsxs)(`div`,{className:`space-y-3 rounded-lg bg-surface-inset p-4 text-sm`,children:[(0,A.jsx)(`p`,{children:t}),(0,A.jsx)(D,{asChild:!0,disabled:!e.active,children:(0,A.jsx)(a,{to:`/chat/new?${new URLSearchParams({draft:t,projectScope:`none`})}`,state:{forceNewChat:!0},onClick:t=>{e.active?r?.():t.preventDefault()},children:j(`开始这个任务`,`Start this task`)})})]},t)):null]}),q?(0,A.jsx)(`p`,{role:`status`,className:`text-sm text-fg-muted`,children:j(`正在准备,可关闭后继续。`,`Preparing. You can close this window and resume.`)}):null,c?.error&&!c.deferred&&!c.missingConfig?.length?(0,A.jsx)(`p`,{className:`text-sm text-fg-muted`,children:G}):null,m?(0,A.jsx)(`p`,{role:`alert`,className:`text-sm text-fg-muted`,children:m}):null]})}var B=`w-full rounded-lg border border-edge bg-surface-inset px-3 py-2 text-sm text-fg`;function V(e,t){if(e.startsWith(`content.skills:`)){let n=e.slice(15);return t?`提供技能:${n}`:`Add skill: ${n}`}if(e.startsWith(`runtime.mcp.stdio:`)){let n=e.slice(18).split(`:`,1)[0];return t?`在 Gateway 上运行工具服务:${n}`:`Run a tool service on the Gateway: ${n}`}if(e.startsWith(`network.mcp:`)){let n=e.slice(12).split(`:`,1)[0];return t?`连接外部工具服务:${n}`:`Connect to an external tool service: ${n}`}return e.startsWith(`runtime.capability-access:`)?t?`按账号授权启用相关技能和工具`:`Enable skills and tools according to account authorization`:e.startsWith(`runtime.authorization:`)?t?`在本机运行账号登录程序:${e.split(`:`)[1]}`:`Run account sign-in locally: ${e.split(`:`)[1]}`:e.startsWith(`runtime.resource:`)?t?`下载可执行资源:${e.split(`:`)[1]}`:`Download executable resource: ${e.split(`:`)[1]}`:e.startsWith(`network.resource:`)?t?`下载并校验资源:${e.split(`:`)[1]}`:`Download and verify resource: ${e.split(`:`)[1]}`:e}function H(e,t){return t?.publisher?.verification!==`verified`||t.latestVersion.riskTier&&t.latestVersion.riskTier!==`content`?!0:e.addedCapabilities.some(e=>!e.startsWith(`content.skills:`))}async function U(e,t,n){let r=await l(s(e),{method:t,...n===void 0?{}:{body:JSON.stringify(n)}});if(!r.ok)throw Error(r.error??`Request failed`);return r.payload}function W({extension:e,onClose:t,onUninstalled:n,initialSource:r=``,marketplace:a,autoInstall:s=!1}){let l=c(e=>e.language),_=l.startsWith(`zh`),b=a?.localizations?.[_?`zh-CN`:`en`],te=b?.displayName??a?.name,ie=b?.description??a?.description,O=(0,P.useId)(),{mutate:oe}=E(),[M,N]=(0,P.useState)(e),[F,se]=(0,P.useState)(r||e?.installationSource||``),[I,L]=(0,P.useState)(null),[R,W]=(0,P.useState)([]),[G,K]=(0,P.useState)(!1),[q,J]=(0,P.useState)(``),[Y,X]=(0,P.useState)(!1),[Z,Q]=(0,P.useState)(!1),[ce,le]=(0,P.useState)(!1),[ue,de]=(0,P.useState)(!1),[fe,pe]=(0,P.useState)(!1),[me,he]=(0,P.useState)(!1),ge=o(),_e=i(),[ve,ye]=(0,P.useState)(!1),be=(0,P.useRef)(!1),xe=`/api/extensions/agent-plugins/${encodeURIComponent(M?.pluginId??``)}`,Se=F.trim().startsWith(`store:`),Ce=()=>oe(`gateway-extensions-list`);async function $(e){K(!0),J(``);try{await e()}catch(e){J(e instanceof Error?e.message:String(e))}finally{K(!1)}}function we(e){se(e),L(null),W([]),J(``)}let Te=typeof window<`u`?window.electronAPI?.file:void 0,Ee=/^(?:\/|[A-Za-z]:[\\/])/.test(F.trim())?F.trim():void 0;async function De(){if(!Te?.openDirectory){pe(!0);return}let e=await Te.openDirectory(Ee?{defaultPath:Ee}:void 0);e&&we(e)}async function Oe(){if(!Te?.openFile){pe(!0);return}let e=await Te.openFile({...Ee?{defaultPath:Ee}:{},extensions:[`zip`]});e&&we(e)}function ke(e){return[...e.dataTransfer.types].some(e=>e===`Files`||e===`text/plain`||e===`text/uri-list`)}function Ae(e){if(!ke(e))return;e.preventDefault(),de(!1);let t=Array.from(e.dataTransfer.files);if(t.length){if(t.length>1){J(_?`一次只能选择一个插件目录或 ZIP。`:`Choose one plugin directory or ZIP at a time.`);return}let e=Te?.getPathForFile?.(t[0]);e?we(e):J(_?`浏览器无法读取本机文件路径,请使用“选择文件或目录”选择安装包。`:`The browser cannot read local file paths. Use Choose file or folder to select the package.`);return}let n=e.dataTransfer.getData(`text/uri-list`)||e.dataTransfer.getData(`text/plain`);n.trim()&&we(n.trim().split(/\r?\n/)[0])}async function je(e){let t=await U(`${xe}/activation`,`POST`,{enabled:e});N(t),await Ce()}async function Me(e){let t=!M,n=await U(t?`/api/extensions/install`:`${xe}/update`,`POST`,{source:F,reviewHash:e.reviewHash,...e.layout?{setup:!0}:{}});N(n),await Ce(),!e.layout&&t&&!n.activationEligible&&n.readiness!==`blocked`&&n.pluginId&&(n=await U(`/api/extensions/agent-plugins/${encodeURIComponent(n.pluginId)}/activation`,`POST`,{enabled:!0}),N(n),await Ce()),L(null),ye(!e.layout&&t&&n.activationEligible===!0)}async function Ne(){let e=await U(`/api/extensions/inspect`,`POST`,{source:F});if(H(e,a)){L(e);return}await Me(e)}(0,P.useEffect)(()=>{e&&!e.setup&&N(e)},[e]),(0,P.useEffect)(()=>{if(!e?.setup||!e.pluginId)return;let t=!1;return U(`/api/extensions/agent-plugins/${encodeURIComponent(e.pluginId)}`,`GET`).then(e=>{t||N(e)}).catch(()=>{}),()=>{t=!0}},[e?.pluginId]),(0,P.useEffect)(()=>{!s||M||!Se||be.current||(be.current=!0,$(Ne))},[s,M,Se]);let Pe=s&&!M&&Se&&!be.current;return(0,A.jsx)(g,{defaultOpen:!0,onOpenChange:e=>!e&&t(),children:(0,A.jsxs)(p,{children:[(0,A.jsx)(d,{className:`fixed inset-0 z-[130] bg-scrim`}),(0,A.jsxs)(m,{className:`fixed left-1/2 top-1/2 z-[131] flex h-[min(42rem,calc(100dvh-2rem))] w-[min(38rem,calc(100vw-1.5rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-overlay shadow-popover`,children:[(0,A.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between border-b border-edge p-4`,children:[(0,A.jsxs)(`div`,{className:`flex min-w-0 items-center gap-3`,children:[(0,A.jsx)(k,{iconUrl:M?.branding?.iconUrl??a?.branding?.iconUrl,fallback:re}),(0,A.jsx)(h,{className:`font-semibold`,children:M?.name??te??(_?`安装插件`:`Install plugin`)})]}),(0,A.jsx)(D,{variant:`ghost`,onClick:t,children:_?`关闭`:`Close`})]}),(0,A.jsx)(f,{className:`sr-only`,children:_?`安装、组件、账号连接和权限`:`Installation, components, connections and permissions`}),(0,A.jsxs)(`div`,{className:`min-h-0 flex-auto space-y-4 overflow-y-auto overscroll-contain p-4`,children:[!M&&Se?(0,A.jsxs)(`section`,{className:`space-y-4`,children:[(0,A.jsxs)(`div`,{className:`flex items-start gap-3 rounded-xl border border-edge bg-surface-base p-4`,children:[(0,A.jsx)(C,{className:`mt-0.5 size-5 shrink-0 text-emerald-600 dark:text-emerald-400`,"aria-hidden":!0}),(0,A.jsxs)(`div`,{className:`min-w-0`,children:[(0,A.jsx)(`p`,{className:`font-medium text-fg`,children:te??I?.manifest.name??F.slice(6)}),ie?(0,A.jsx)(`p`,{className:`mt-1 text-sm leading-relaxed text-fg-muted`,children:ie}):null,(0,A.jsx)(`p`,{className:`mt-2 text-xs text-fg-muted`,children:a?.publisher?.verification===`verified`?_?`已认证发布者 · 安装后所有智能体均可使用`:`Verified publisher · available to all agents after installation`:_?`安装前会检查来源和所需权限`:`Source and required permissions are checked before installation`})]})]}),a?(0,A.jsx)(j,{data:a,zh:_}):null,I?null:(0,A.jsxs)(D,{className:`w-full`,disabled:G||Pe,onClick:()=>void $(Ne),children:[G||Pe?(0,A.jsx)(ne,{className:`size-4 animate-spin`,"aria-hidden":!0}):null,G||Pe?_?`正在安全检查并安装…`:`Checking and installing…`:_?`一键安装`:`Install`]})]}):null,M?(0,A.jsxs)(A.Fragment,{children:[ve?(0,A.jsxs)(`div`,{role:`status`,className:`flex items-start gap-3 rounded-lg border border-emerald-500/25 bg-emerald-500/10 p-4`,children:[(0,A.jsx)(ee,{className:`mt-0.5 size-5 shrink-0 text-emerald-600 dark:text-emerald-400`,"aria-hidden":!0}),(0,A.jsxs)(`div`,{children:[(0,A.jsx)(`p`,{className:`font-medium text-fg`,children:_?`插件已安装并启用`:`Plugin installed and enabled`}),(0,A.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:_?`请继续检查账号连接、依赖与可用状态,再在对话中试用。`:`It is ready to use in your conversations.`})]})]}):null,(!M.setup||M.readiness!==`setup_required`)&&!M.activationEligible?(0,A.jsxs)(`div`,{role:`status`,className:`space-y-3 rounded-lg border border-accent/25 bg-accent-soft p-4`,children:[(0,A.jsxs)(`div`,{children:[(0,A.jsx)(`p`,{className:`font-medium text-accent-fg`,children:_?`插件已安装,当前尚未启用`:`Plugin installed. It is not enabled yet.`}),(0,A.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:_?`启用后,Skills 和 MCP 才会加入 Agent 运行时。`:`Enable it to make its skills and MCP servers available to the Agent runtime.`})]}),(0,A.jsx)(D,{disabled:G||M.readiness===`blocked`,onClick:()=>void $(()=>je(!0)),children:_?`启用插件`:`Enable plugin`})]}):null,M.setup?(0,A.jsx)(z,{extension:M,zh:_,onStart:t,onInstalled:()=>{t(),ge(ae(M.pluginId,`installed`,!1,_e.pathname+_e.search))},onChanged:async()=>{let e=await U(`${xe}`,`GET`);N(e),await Ce()}}):null,(0,A.jsxs)(`details`,{className:`rounded-lg border border-edge p-3`,children:[(0,A.jsx)(`summary`,{className:`cursor-pointer text-sm font-medium`,children:_?`插件详情`:`Plugin details`}),(0,A.jsxs)(`div`,{className:`mt-3 space-y-3`,children:[(0,A.jsxs)(`p`,{className:`text-sm text-fg-muted`,children:[_?`插件`:`Plugin`,` · `,M.version,` · `,M.readiness&&{ready:_?`已就绪`:`Ready`,setup_required:_?`待连接`:`Setup required`,degraded:_?`部分不可用`:`Partially available`,blocked:_?`已阻止`:`Blocked`}[M.readiness]]}),M.provenance?(0,A.jsxs)(`p`,{className:`break-words text-xs text-fg-muted`,children:[M.provenance.publisherVerification===`verified`?_?`已认证发布者`:`Verified publisher`:_?`社区发布者`:`Community publisher`,` · `,M.provenance.packageName,`@`,M.provenance.version,` · SHA-256 `,M.provenance.sha256.slice(0,12),`…`,M.provenance.riskTier?` · ${M.provenance.riskTier}`:``]}):null,(0,A.jsx)(`p`,{className:`text-sm`,children:M.description}),M.installationSource?(0,A.jsxs)(`p`,{className:`break-all text-xs text-fg-muted`,children:[_?`来源:`:`Source: `,M.installationSource,M.resolvedCommit?` · ${M.resolvedCommit.slice(0,12)}`:``]}):null,M.activationEligible?(0,A.jsx)(D,{disabled:G,variant:`secondary`,onClick:()=>void $(()=>je(!1)),children:_?`停用`:`Disable`}):null,M.canRollback?(0,A.jsx)(D,{disabled:G,variant:`secondary`,onClick:()=>void $(async()=>{N(await U(`${xe}/rollback`,`POST`)),await Ce()}),children:_?`回滚上一版本`:`Roll back`}):null]})]}),M.diagnostics?.map((e,t)=>(0,A.jsxs)(`p`,{className:`text-sm text-fg-muted`,children:[e.component,`: `,e.message]},t))]}):null,M?(0,A.jsxs)(D,{variant:`ghost`,className:`px-0`,"aria-expanded":me,onClick:()=>he(e=>!e),children:[(0,A.jsx)(v,{className:T(`size-4 transition-transform motion-reduce:transition-none`,me&&`rotate-180`),"aria-hidden":!0}),_?`高级操作`:`Advanced actions`]}):null,!M&&!Se||me?(0,A.jsxs)(`form`,{className:T(`space-y-3`,M&&`border-t border-edge pt-4`),onSubmit:e=>{e.preventDefault(),$(async()=>{let e=await U(`/api/extensions/inspect`,`POST`,{source:F});e.candidates?(W(e.candidates),L(null)):(W([]),L(e))})},children:[(0,A.jsxs)(`div`,{"data-testid":`plugin-source-dropzone`,className:T(`rounded-xl border border-dashed p-3 transition-colors`,ue?`border-accent bg-accent-soft`:`border-edge bg-surface-inset/40`),onDragEnter:e=>{ke(e)&&(e.preventDefault(),de(!0))},onDragOver:e=>{ke(e)&&(e.preventDefault(),e.dataTransfer.dropEffect=`copy`,de(!0))},onDragLeave:e=>{e.currentTarget.contains(e.relatedTarget)||de(!1)},onDrop:Ae,children:[(0,A.jsxs)(`div`,{className:`mb-2 flex items-start gap-2`,children:[(0,A.jsx)(w,{className:`mt-0.5 size-4 shrink-0 text-fg-muted`,"aria-hidden":!0}),(0,A.jsxs)(`div`,{children:[(0,A.jsx)(`label`,{htmlFor:O,className:`block text-sm font-medium`,children:M?_?`更新包来源`:`Update package source`:_?`安装包来源`:`Package source`}),(0,A.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-muted`,children:_?`输入 github:组织/仓库、Git / ZIP 地址或宿主目录;marketplace 可选择插件。`:`Enter github:owner/repo, a Git / ZIP URL or a Gateway directory. Marketplaces let you choose a plugin.`})]})]}),(0,A.jsx)(`input`,{id:O,className:B,value:F,onChange:e=>we(e.target.value),placeholder:_?`/插件目录/或/插件.zip`:`/plugin/folder/or/plugin.zip`,autoComplete:`off`,spellCheck:!1,required:!0}),(0,A.jsx)(`div`,{className:`mt-2 flex flex-wrap gap-2`,children:Te?(0,A.jsxs)(A.Fragment,{children:[(0,A.jsxs)(D,{type:`button`,variant:`secondary`,disabled:G,onClick:()=>void $(De),children:[(0,A.jsx)(S,{className:`size-4`,"aria-hidden":!0}),_?`选择目录`:`Choose directory`]}),(0,A.jsxs)(D,{type:`button`,variant:`secondary`,disabled:G,onClick:()=>void $(Oe),children:[(0,A.jsx)(x,{className:`size-4`,"aria-hidden":!0}),_?`选择 ZIP`:`Choose ZIP`]})]}):(0,A.jsxs)(D,{type:`button`,variant:`secondary`,disabled:G,onClick:()=>pe(!0),children:[(0,A.jsx)(S,{className:`size-4`,"aria-hidden":!0}),_?`选择文件或目录`:`Choose file or folder`]})})]}),(0,A.jsx)(D,{type:`submit`,variant:`secondary`,disabled:G||!F,children:_?`检查安装包`:`Inspect package`})]}):null,R.length?(0,A.jsx)(`div`,{className:`space-y-2`,"aria-label":_?`选择插件`:`Choose a plugin`,children:R.map(e=>(0,A.jsx)(D,{variant:`secondary`,className:`w-full justify-start`,onClick:()=>{we(e.source),$(async()=>L(await U(`/api/extensions/inspect`,`POST`,{source:e.source})))},children:e.name},e.source))}):null,I?(0,A.jsxs)(`div`,{role:`region`,"aria-labelledby":`plugin-authorization-title`,className:`space-y-3 rounded-xl border border-amber-500/30 bg-amber-500/10 p-4 text-sm`,children:[(0,A.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,A.jsx)(C,{className:`mt-0.5 size-5 shrink-0 text-amber-700 dark:text-amber-300`,"aria-hidden":!0}),(0,A.jsxs)(`div`,{children:[(0,A.jsx)(`p`,{id:`plugin-authorization-title`,className:`font-medium text-fg`,children:_?`需要你的授权`:`Your authorization is required`}),(0,A.jsx)(`p`,{className:`mt-1 text-fg-muted`,children:_?`此插件需要以下新增能力。确认后自动准备资源,按需登录账号,所有智能体均可使用。`:`Review these capabilities. Resources are prepared automatically; sign in if needed. Available to all agents.`})]})]}),(0,A.jsx)(`ul`,{tabIndex:0,"aria-label":_?`插件新增能力`:`Added plugin capabilities`,className:`max-h-[min(28vh,14rem)] space-y-2 overflow-y-auto overscroll-contain rounded-lg border border-edge bg-surface-panel p-3 break-words focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:I.addedCapabilities.map(e=>(0,A.jsxs)(`li`,{className:`flex gap-2`,children:[(0,A.jsx)(`span`,{"aria-hidden":!0,children:`•`}),(0,A.jsx)(`span`,{children:V(e,_)})]},e))}),I.diagnostics.map((e,t)=>(0,A.jsxs)(`p`,{children:[e.component,`: `,e.message]},t))]}):null,M&&me?(0,A.jsx)(`div`,{className:`border-t border-edge pt-4`,children:ce?(0,A.jsxs)(`div`,{className:`space-y-3 text-sm`,children:[(0,A.jsx)(`p`,{children:_?`卸载保留账号凭据;服务端授权需到相应服务撤销。`:`Credentials are retained. Revoke provider authorization in the service itself.`}),(0,A.jsxs)(`label`,{className:`flex gap-2`,children:[(0,A.jsx)(`input`,{type:`checkbox`,checked:Y,onChange:e=>X(e.target.checked)}),_?`同时删除插件数据`:`Also delete plugin data`]}),(0,A.jsxs)(`label`,{className:`flex gap-2`,children:[(0,A.jsx)(`input`,{type:`checkbox`,checked:Z,onChange:e=>Q(e.target.checked)}),_?`同时删除本地凭据`:`Also delete local credentials`]}),(0,A.jsx)(D,{disabled:G,onClick:()=>void $(async()=>{await U(xe,`DELETE`,{removeData:Y,removeCredentials:Z}),await Ce(),(n??t)()}),children:_?`确认卸载`:`Confirm uninstall`})]}):(0,A.jsx)(D,{variant:`ghost`,disabled:G,onClick:()=>le(!0),children:_?`卸载插件`:`Uninstall`})}):null,q?(0,A.jsx)(`p`,{role:`alert`,className:`break-words text-sm text-fg-muted`,children:q}):null]}),I?(0,A.jsxs)(`div`,{className:`flex shrink-0 flex-wrap justify-end gap-2 border-t border-edge p-4`,children:[(0,A.jsx)(D,{variant:`ghost`,disabled:G,onClick:()=>L(null),children:_?`取消`:`Cancel`}),(0,A.jsxs)(D,{disabled:G||!!M&&I.manifest.name!==M.name,onClick:()=>void $(()=>Me(I)),children:[G?(0,A.jsx)(ne,{className:`size-4 animate-spin`,"aria-hidden":!0}):null,_?`授权并安装`:`Authorize and install`]})]}):null]}),Te?null:(0,A.jsx)(y,{open:fe,onOpenChange:pe,initialAbsolutePath:Ee,onConfirm:async e=>we(e),wd:u(l).chat.workingDirectory,selectKind:`file-or-directory`,fileExtensions:[`zip`],title:_?`选择插件安装包`:`Choose plugin package`,description:_?`选择插件目录或 ZIP 文件。`:`Choose a plugin directory or ZIP file.`,confirmLabel:_?`使用此来源`:`Use this source`,nested:!0})]})})}export{z as n,j as r,W as t};
|
|
1
|
+
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{l as i,t as a,u as o}from"./chunk-KS7C4IRE-CiwuuyV8.js";import{i as s,n as c,o as l}from"./locale-store-B6OrWgY1.js";import{t as u}from"./messages-jwdBhfL9.js";import{a as d,i as f,o as p,r as m,s as h,t as g}from"./dist-BGTk37IG.js";import{t as _}from"./arrow-left-D880xG-P.js";import{t as v}from"./chevron-down-ccbiQQz_.js";import{t as y}from"./working-directory-picker-modal-DGp9cNzH.js";import{t as b}from"./circle-alert-BEjgurr2.js";import{t as ee}from"./circle-check-C23XjkUj.js";import{t as te}from"./circle-BoO4YvTx.js";import{t as x}from"./file-archive-DanfQJNe.js";import{t as S}from"./folder-open-CyzJ19I9.js";import{t as ne}from"./loader-circle-CifKLtgG.js";import{t as re}from"./package-wATCyihJ.js";import{t as C}from"./shield-check-BU58siTV.js";import{t as w}from"./upload-rrb46c3c.js";import{t as T}from"./cn-0WouolD0.js";import{t as ie}from"./skeleton-BI5TyibZ.js";import{a as E}from"./vendor-swr-CdRzEUwF.js";import{t as D}from"./button-Cc4hUNTt.js";import{t as ae}from"./capability-links-DzQWK1Fh.js";import{t as O}from"./browser-BLJWD7WI.js";import{t as k}from"./capability-icon-DVoZxEgW.js";var oe=n(),A=r();function j(e){let t=(0,oe.c)(30),{data:n,zh:r}=e,i=r?`插件内容与范围`:`Contents and access`,a;t[0]===i?a=t[1]:(a=(0,A.jsx)(`h4`,{className:`font-medium text-fg`,children:i}),t[0]=i,t[1]=a);let o=r?`新增技能:`:`Skills: `,s;t[2]!==n.latestVersion.componentIndex?.skills||t[3]!==r?(s=n.latestVersion.componentIndex?.skills.join(`, `)||(r?`目录未提供清单`:`Not listed in catalog`),t[2]=n.latestVersion.componentIndex?.skills,t[3]=r,t[4]=s):s=t[4];let c;t[5]!==o||t[6]!==s?(c=(0,A.jsxs)(`p`,{children:[o,s]}),t[5]=o,t[6]=s,t[7]=c):c=t[7];let l=r?`工具连接:`:`Tool connections: `,u;t[8]!==n.latestVersion.componentIndex?.mcpServers||t[9]!==r?(u=n.latestVersion.componentIndex?.mcpServers.map(M).join(`, `)||(r?`目录未提供清单`:`Not listed in catalog`),t[8]=n.latestVersion.componentIndex?.mcpServers,t[9]=r,t[10]=u):u=t[10];let d;t[11]!==l||t[12]!==u?(d=(0,A.jsxs)(`p`,{children:[l,u]}),t[11]=l,t[12]=u,t[13]=d):d=t[13];let f=r?`运行范围:`:`Runtime scope: `,p=n.latestVersion.riskTier===`local-exec`?r?`包含本机代码执行,可能访问本机文件或网络`:`Includes local code execution; may access local files or networks`:n.latestVersion.riskTier===`network`?r?`包含网络服务调用;数据范围取决于账号授权`:`Includes network service calls; data scope depends on authorization`:n.latestVersion.riskTier===`content`?r?`目录标记为内容能力`:`Catalog classifies this as content capabilities`:r?`目录未声明,请查看说明与来源`:`Not declared; review documentation and source`,m;t[14]!==p||t[15]!==f?(m=(0,A.jsxs)(`p`,{children:[f,p]}),t[14]=p,t[15]=f,t[16]=m):m=t[16];let h=r?`授权与来源`:`Authorization and source`,g;t[17]===h?g=t[18]:(g=(0,A.jsx)(`summary`,{className:`w-fit cursor-pointer rounded focus-visible:outline-accent`,children:h}),t[17]=h,t[18]=g);let _=r?`发布者认证只验证来源,不授予操作权限。账号授权与依赖需另行设置。未列出权限不代表没有文件或外部访问。`:`Publisher verification does not grant permissions. Accounts and dependencies require separate setup. Missing scope metadata does not mean no file or external access.`,v;t[19]===_?v=t[20]:(v=(0,A.jsx)(`p`,{className:`mt-2 leading-5`,children:_}),t[19]=_,t[20]=v);let y;t[21]!==g||t[22]!==v?(y=(0,A.jsxs)(`details`,{className:`text-xs`,children:[g,v]}),t[21]=g,t[22]=v,t[23]=y):y=t[23];let b;return t[24]!==m||t[25]!==y||t[26]!==a||t[27]!==c||t[28]!==d?(b=(0,A.jsxs)(`section`,{className:`mt-4 space-y-2 rounded-lg border border-edge p-4 text-sm text-fg-muted`,children:[a,c,d,m,y]}),t[24]=m,t[25]=y,t[26]=a,t[27]=c,t[28]=d,t[29]=b):b=t[29],b}function M(e){return`${e.name} (${e.transport})`}var N=e(O(),1),P=e(t(),1);function F(e){let t=(0,oe.c)(6),{fields:n,values:r,onChange:i}=e,a;t[0]===n?a=t[1]:(a=Object.entries(n),t[0]=n,t[1]=a);let o;return t[2]!==i||t[3]!==a||t[4]!==r?(o=(0,A.jsx)(A.Fragment,{children:a.map(e=>{let[t,n]=e;return(0,A.jsxs)(`label`,{className:`block space-y-1.5 text-sm`,children:[(0,A.jsxs)(`span`,{children:[n.title,n.required?` *`:``]}),n.type===`boolean`?(0,A.jsx)(`input`,{type:`checkbox`,checked:r[t]===!0,onChange:e=>i({...r,[t]:e.target.checked})}):(0,A.jsx)(`input`,{className:`w-full rounded-lg border border-edge bg-surface-inset px-3 py-2.5`,type:n.sensitive?`password`:n.type===`number`?`number`:`text`,required:n.required,autoComplete:`off`,value:String(r[t]??``),onChange:e=>i({...r,[t]:n.type===`number`?Number(e.target.value):e.target.value})})]},t)})}),t[2]=i,t[3]=a,t[4]=r,t[5]=o):o=t[5],o}function se(e){let t=(0,oe.c)(62),{account:n,fields:r,zh:i,busy:a,attempt:o,initialMethod:s,onBack:c,onConnect:l,onSave:u,onRedirect:d,onSkip:f}=e,[p,m]=(0,P.useState)(s&&n.methods.some(e=>e.id===s)?s:n.methods[0]?.id??``),h;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(h={},t[0]=h):h=t[0];let[g,v]=(0,P.useState)(h),[y,b]=(0,P.useState)(``),[ee,te]=(0,P.useState)(),x;t[1]===p?x=t[2]:(x=e=>e.id===p,t[1]=p,t[2]=x);let S=n.methods.find(x),re;t[3]===i?re=t[4]:(re=(e,t)=>i?e:t,t[3]=i,t[4]=re);let C=re,w=o?.challenge?.type===`qr`?o.challenge.url:void 0,T,E;t[5]===w?(T=t[6],E=t[7]):(T=()=>{let e=!1;return te(void 0),w&&N.toDataURL(w,{width:240,margin:2}).then(t=>{e||te(t)}).catch(L),()=>{e=!0}},E=[w],t[5]=w,t[6]=T,t[7]=E),(0,P.useEffect)(T,E);let ae;t[8]===o?ae=t[9]:(ae=o&&![`cancelled`,`error`,`connected`].includes(o.state),t[8]=o,t[9]=ae);let O=ae,k=o?.authorizationUrl??o?.challenge?.url,j=`连接 ${n.title}`,M=`Connect ${n.title}`,se;t[10]!==C||t[11]!==j||t[12]!==M?(se=C(j,M),t[10]=C,t[11]=j,t[12]=M,t[13]=se):se=t[13];let R;t[14]===C?R=t[15]:(R=C(`返回插件详情`,`Back to plugin details`),t[14]=C,t[15]=R);let z;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(z=(0,A.jsx)(_,{className:`size-4`}),t[16]=z):z=t[16];let B;t[17]!==c||t[18]!==R?(B=(0,A.jsx)(D,{variant:`ghost`,className:`shrink-0`,onClick:c,"aria-label":R,children:z}),t[17]=c,t[18]=R,t[19]=B):B=t[19];let V;t[20]===C?V=t[21]:(V=C(`连接 `,`Connect `),t[20]=C,t[21]=V);let H;t[22]!==n.title||t[23]!==V?(H=(0,A.jsxs)(`h3`,{className:`text-base font-semibold`,children:[V,n.title]}),t[22]=n.title,t[23]=V,t[24]=H):H=t[24];let U;t[25]!==n.description||t[26]!==C?(U=n.description??C(`完成授权后自动检查连接。也可以稍后在详情页继续。`,`The connection is checked after authorization. You can also continue later in plugin details.`),t[25]=n.description,t[26]=C,t[27]=U):U=t[27];let W;t[28]===U?W=t[29]:(W=(0,A.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:U}),t[28]=U,t[29]=W);let G;t[30]!==H||t[31]!==W?(G=(0,A.jsxs)(`div`,{children:[H,W]}),t[30]=H,t[31]=W,t[32]=G):G=t[32];let K;t[33]!==B||t[34]!==G?(K=(0,A.jsxs)(`div`,{className:`flex items-start gap-3`,children:[B,G]}),t[33]=B,t[34]=G,t[35]=K):K=t[35];let q;t[36]!==n.methods||t[37]!==O||t[38]!==a||t[39]!==p||t[40]!==C?(q=n.methods.length>1?(0,A.jsx)(`div`,{role:`tablist`,"aria-label":C(`授权方式`,`Authorization methods`),className:`flex flex-wrap gap-2 rounded-lg bg-surface-inset p-1.5`,children:n.methods.map(e=>(0,A.jsx)(`button`,{role:`tab`,type:`button`,"aria-selected":p===e.id,className:`min-h-10 rounded-md px-3 text-sm ${p===e.id?`bg-surface-panel font-medium text-fg`:`text-fg-muted`}`,disabled:a||!!O,onClick:()=>{m(e.id),v({})},children:e.title},e.id))}):null,t[36]=n.methods,t[37]=O,t[38]=a,t[39]=p,t[40]=C,t[41]=q):q=t[41];let J=S?.instructions?.length||S?.helpUrl?(0,A.jsxs)(`div`,{className:`space-y-3 rounded-lg border border-edge bg-surface-inset p-4 text-sm text-fg-muted`,children:[S.instructions?.length?(0,A.jsx)(`ol`,{className:`list-decimal space-y-2 pl-5`,children:S.instructions.map(I)}):null,S.helpUrl?(0,A.jsx)(`a`,{className:`text-accent underline`,href:S.helpUrl,target:`_blank`,rel:`noopener noreferrer`,children:C(`打开官方配置说明`,`Open setup instructions`)}):null]}):null,Y=(S?.type===`form`||S?.fields?.length)&&!O?(0,A.jsxs)(`form`,{className:`space-y-4`,onSubmit:e=>{e.preventDefault(),u(S.id,g)},children:[(0,A.jsx)(F,{fields:Object.fromEntries((S.fields??[]).filter(e=>r[e]).map(e=>[e,{...r[e],required:!0}])),values:g,onChange:v}),(0,A.jsxs)(D,{type:`submit`,disabled:a||!S.fields?.every(e=>g[e]!==void 0&&g[e]!==``),children:[a?(0,A.jsx)(ne,{className:`size-4 animate-spin`,"aria-hidden":!0}):null,C(`保存并连接`,`Save and connect`)]})]}):(0,A.jsxs)(`div`,{className:`space-y-4`,children:[O?null:(0,A.jsx)(D,{disabled:a,onClick:()=>l(p),children:C(`连接账号`,`Connect account`)}),O?(0,A.jsx)(`p`,{role:`status`,className:`text-sm text-fg-muted`,children:o.challenge?.message??(o.state===`preparing`?C(`正在准备登录…`,`Preparing sign-in…`):C(`请完成登录,返回后会自动继续。`,`Finish signing in. Installation continues automatically.`))}):null,w&&O?ee?(0,A.jsx)(`img`,{src:ee,alt:C(`使用 ${n.title} 扫码授权`,`Scan to authorize ${n.title}`),className:`mx-auto size-60 max-w-full rounded-lg`}):(0,A.jsx)(ie,{className:`mx-auto size-60`}):null,k&&O?(0,A.jsx)(`a`,{href:k,target:`_blank`,rel:`noopener noreferrer`,className:`inline-block text-sm text-accent underline`,children:w?C(`也可以打开授权页面`,`Or open the authorization page`):C(`打开登录页面`,`Open sign-in page`)}):null,o?.expiresAt&&O?(0,A.jsxs)(`p`,{className:`text-center text-xs text-fg-muted`,children:[C(`本次授权有效期至 `,`This sign-in expires at `),new Date(o.expiresAt).toLocaleTimeString()]}):null,o?.error?(0,A.jsx)(`p`,{role:`alert`,className:`text-sm text-fg-muted`,children:o.error}):null,o?.acceptsRedirect&&O?(0,A.jsxs)(`details`,{className:`text-sm`,children:[(0,A.jsx)(`summary`,{className:`cursor-pointer text-fg-muted`,children:C(`登录后没有自动返回?`,`Did sign-in not return automatically?`)}),(0,A.jsxs)(`form`,{className:`mt-3 space-y-3`,onSubmit:e=>{e.preventDefault(),d(y)},children:[(0,A.jsxs)(`label`,{children:[C(`登录回调地址`,`Sign-in callback URL`),(0,A.jsx)(`input`,{value:y,onChange:e=>b(e.target.value),className:`mt-1 w-full rounded-lg border border-edge bg-surface-inset p-2`})]}),(0,A.jsx)(D,{type:`submit`,disabled:a||!y,children:C(`继续登录`,`Continue sign-in`)})]})]}):null]}),X;t[42]===C?X=t[43]:(X=C(`暂时跳过`,`Skip for now`),t[42]=C,t[43]=X);let Z;t[44]!==a||t[45]!==f||t[46]!==X?(Z=(0,A.jsx)(D,{variant:`secondary`,disabled:a,onClick:f,children:X}),t[44]=a,t[45]=f,t[46]=X,t[47]=Z):Z=t[47];let Q;t[48]===C?Q=t[49]:(Q=C(`相关功能暂不可用,可随时在插件详情中授权。`,`Features requiring this account stay unavailable. Connect later in plugin details.`),t[48]=C,t[49]=Q);let ce;t[50]===Q?ce=t[51]:(ce=(0,A.jsx)(`p`,{className:`mt-2 text-xs text-fg-muted`,children:Q}),t[50]=Q,t[51]=ce);let le;t[52]!==Z||t[53]!==ce?(le=(0,A.jsxs)(`div`,{className:`border-t border-edge pt-4`,children:[Z,ce]}),t[52]=Z,t[53]=ce,t[54]=le):le=t[54];let ue;return t[55]!==se||t[56]!==K||t[57]!==q||t[58]!==J||t[59]!==Y||t[60]!==le?(ue=(0,A.jsxs)(`section`,{className:`space-y-5`,"aria-label":se,children:[K,q,J,Y,le]}),t[55]=se,t[56]=K,t[57]=q,t[58]=J,t[59]=Y,t[60]=le,t[61]=ue):ue=t[61],ue}function I(e,t){return(0,A.jsx)(`li`,{children:e},t)}function L(){}async function R(e,t=`GET`,n){let r=await l(s(e),{method:t,...n===void 0?{}:{body:JSON.stringify(n)}});if(!r.ok)throw Error(r.error??`Request failed`);return r.payload}function z({extension:e,zh:t,onChanged:n,onStart:r,onInstalled:i,initialConnect:o=!1}){let s=`/api/extensions/agent-plugins/${encodeURIComponent(e.pluginId)}`,[c,l]=(0,P.useState)(),[u,d]=(0,P.useState)({}),[f,p]=(0,P.useState)(!1),[m,h]=(0,P.useState)(``),[g,_]=(0,P.useState)({}),[v,y]=(0,P.useState)(null),[x,S]=(0,P.useState)(``),[re,C]=(0,P.useState)(null),[w,T]=(0,P.useState)(!1),E=(0,P.useRef)(new Set),ae=(0,P.useRef)(new Set),O=(0,P.useRef)(void 0),k=(0,P.useRef)(null),oe=(0,P.useRef)(new Set),j=(e,n)=>t?e:n,M=e.setup?.authorizations??[],N=new Set(M.flatMap(e=>e.servers)),I=[...M,...(c?.connections??[]).filter(t=>!N.has(t.name)&&(e.components?.mcp.find(e=>e.name===t.name)?.type!==`stdio`||t.state===`token_required`)).map(t=>{let n=t.state===`token_required`||t.state===`auth_unknown`||e.components?.mcp.find(e=>e.name===t.name)?.connectionAuth?.mode===`api-key`;return{id:t.name,title:t.name,servers:[t.name],methods:[{id:n?`api-key`:`oauth`,title:n?j(`访问令牌`,`Access token`):j(`浏览器登录`,`Browser sign-in`),type:n?`form`:`oauth`,...n?{fields:[`__apiKey`]}:{server:t.name}}]}})],L=e=>e.servers.every(e=>c?.connections.find(t=>t.name===e)?.state===`connected`)&&(!M.some(t=>t.id===e.id)||c?.authorizations?.find(t=>t.id===e.id)?.state===`connected`),z=(c?.authorizations??[]).flatMap(e=>(e.issues??[]).map(t=>({...t,account:I.find(t=>t.id===e.id)}))),B=I.filter(e=>!L(e)),V=c?.installed||c?.state===`completed`,H=e.setup?.userConfig??{},U=new Set(M.flatMap(e=>e.methods.flatMap(e=>e.fields??[]))),W=Object.fromEntries(Object.entries(H).filter(([e])=>!U.has(e))),G=c?.error===`Connection verification failed. Check the credentials or login status and try again.`?j(`连接验证未通过,请检查凭据或登录状态后重试。`,c.error):c?.error,K=Object.fromEntries(Object.entries(H).filter(([e])=>c?.missingConfig?.includes(e))),q=f||c?.state===`running`,J=I.find(e=>e.id===re);(0,P.useEffect)(()=>{let e=!1;return R(`${s}/setup`).then(t=>{e||l(t)}).catch(t=>{e||(l(null),h(String(t)))}),()=>{e=!0}},[s]),(0,P.useEffect)(()=>{if(c?.state!==`running`)return;let e=!1,t=!1,r=setInterval(()=>{t||(t=!0,R(`${s}/setup`).then(t=>{e||(l(t),t?.state!==`running`&&n())}).catch(t=>{e||h(String(t))}).finally(()=>{t=!1}))},750);return()=>{e=!0,clearInterval(r)}},[s,c?.state]),(0,P.useEffect)(()=>{if(!c||!c.connections.some(e=>[`oauth_required`,`error`].includes(e.state)))return;let e=!1;return R(`${s}/setup/reusable`).then(t=>{e||_(t)}).catch(()=>{e||_({})}),()=>{e=!0}},[s,c?.revision]),(0,P.useEffect)(()=>{if(!x||c?.state===`completed`)return;let e=!1,t=!1,n=async()=>{if(!t){t=!0;try{let t=await R(`${s}/setup/auth/${encodeURIComponent(x)}`);e||y(t)}catch(t){e||h(String(t))}finally{t=!1}}};n();let r=setInterval(()=>void n(),1500),i=()=>void n();return window.addEventListener(`focus`,i),()=>{e=!0,clearInterval(r),window.removeEventListener(`focus`,i)}},[s,x,c?.state]),(0,P.useEffect)(()=>{let e=v?.authorizationUrl??(v?.challenge?.type===`url`?v.challenge.url:void 0);if(!v)return;if(v.error||[`cancelled`,`error`,`connected`].includes(v.state)){k.current?.close(),k.current=null;return}if(!e){v.challenge?.type===`qr`&&(k.current?.close(),k.current=null);return}let t=`${v.id}:${e}`;if(oe.current.has(t))return;oe.current.add(t);let n=k.current;k.current=null,n&&!n.closed?n.location.replace(e):window.open(e,`_blank`,`noopener,noreferrer`)},[v]);async function Y(e,t={},r=c?.revision){p(!0),h(``);try{let a=await R(`${s}/setup`,`POST`,{action:e,expectedRevision:r,...e===`start`?{}:{idempotencyKey:crypto.randomUUID()},...t}),o=e===`configure`&&M.find(e=>e.id===t.authorization)?.methods.some(e=>e.id===t.method&&e.type===`cli`);return([`reuse`,`start`].includes(e)||e===`configure`&&!o)&&(d({}),T(!1),a=await R(`${s}/setup`,`POST`,{action:`prepare`,expectedRevision:a.revision,idempotencyKey:crypto.randomUUID()})),l(a),await n(),[`complete`,`defer`].includes(e)&&(C(null),y(null),S(``),k.current?.close(),k.current=null,i?.()),a}catch(e){h(e instanceof Error?e.message:String(e));try{l(await R(`${s}/setup`))}catch{}return null}finally{p(!1)}}(0,P.useEffect)(()=>{if(!c||q||m||[`cancelled`,`running`,`failed`].includes(c.state)||c.state===`completed`)return;let e,t=``;if(c.state===`pending`?(e=`prepare`,t=`prepare:${s}:${c.revision}`):v?.state===`connected`&&(e=`prepare`,t=`auth:${s}:${v.id}`),e&&!E.current.has(t)){E.current.add(t),Y(e);return}c.resources===`ready`&&!c.missingConfig?.length&&!c.partial&&c.connections.every(e=>e.state===`connected`)&&(c.authorizations??[]).every(e=>e.state===`connected`)&&(t=`complete:${s}:${c.revision}`,E.current.has(t)||(E.current.add(t),Y(`complete`)))},[c,v,q,m,s]),(0,P.useEffect)(()=>{q||!c||c.state===`cancelled`||(J&&c.revision!==O.current&&L(J)?(C(null),y(null),S(``)):(!V||o)&&c.resources===`ready`&&(!c.missingConfig?.length||o&&!c.missingConfig.some(e=>e in W))&&!re&&B[0]&&!ae.current.has(B[0].id)&&(ae.current.add(B[0].id),O.current=c.revision,C(B[0].id)))},[c,q,V,re,o]);function X(e,t){let n=e.methods.find(e=>e.id===t),r=n?.type===`oauth`||n?.type===`cli`?window.open(`about:blank`,`_blank`):null;r&&(r.opener=null),k.current=r,y(null),Y(`authorize`,{server:e.id,...M.some(t=>t.id===e.id)?{method:t}:{}}).then(t=>{t?S(e.id):(r?.close(),k.current=null)})}async function Z(t,n,r){if(n===`api-key`&&!M.some(e=>e.id===t.id)){p(!0),h(``);try{let n=e.components?.mcp.find(e=>e.name===t.id);await R(`${s}/mcp/${encodeURIComponent(t.id)}/auth`,`PUT`,{mode:`api-key`,secrets:[{target:n.type===`stdio`?`env`:`headers`,key:n.connectionAuth?.headerName??(n.type===`stdio`?`API_KEY`:`Authorization`),prefix:n.connectionAuth?.prefix??(n.type===`stdio`?``:`Bearer `),value:r.__apiKey}]});let i=await R(`${s}/setup`);l(i),p(!1),await Y(`prepare`,{},i.revision);return}catch(e){h(String(e)),p(!1);return}p(!1)}else if(t.methods.find(e=>e.id===n)?.type===`cli`){let e=window.open(`about:blank`,`_blank`);e&&(e.opener=null),k.current=e,y(null);let i=await Y(`configure`,{authorization:t.id,method:n,values:r},c?.revision);i&&await Y(`authorize`,{server:t.id,method:n},i.revision)?S(t.id):(e?.close(),k.current=null)}else await Y(`configure`,{authorization:t.id,method:n,values:r})}if(c===void 0)return(0,A.jsx)(ie,{className:`h-40 w-full`});let Q=()=>{Y(`defer`)};return J?(0,A.jsxs)(`div`,{className:`space-y-3`,children:[(0,A.jsx)(se,{initialMethod:c?.authorizations?.find(e=>e.id===J.id)?.method,account:J,fields:{...H,__apiKey:{type:`string`,title:j(`访问令牌`,`Access token`),required:!0,sensitive:!0}},zh:t,busy:q,attempt:v,onBack:()=>C(null),onConnect:e=>X(J,e),onSave:(e,t)=>void Z(J,e,t),onRedirect:e=>{p(!0),R(`${s}/setup/auth/${encodeURIComponent(x)}/redirect`,`POST`,{url:e}).catch(e=>h(String(e))).finally(()=>p(!1))},onSkip:Q},`${J.id}:${c?.authorizations?.find(e=>e.id===J.id)?.method??``}`),g[J.id]?.map(e=>(0,A.jsxs)(D,{disabled:q,variant:`secondary`,onClick:()=>void Y(`reuse`,{server:J.id,sourceServerId:e.id}),children:[j(`使用已登录账号:`,`Use signed-in account: `),e.name]},e.id)),m||G&&J.servers.some(e=>c?.connections.find(t=>t.name===e)?.state===`error`)?(0,A.jsx)(`p`,{role:`alert`,className:`text-sm text-fg-muted`,children:m||G}):null]}):(0,A.jsxs)(`section`,{className:`space-y-5`,"aria-label":j(`插件安装与授权`,`Plugin setup`),children:[V?(0,A.jsxs)(`div`,{children:[(0,A.jsx)(`h3`,{className:`font-medium`,children:j(`安装完成`,`Installation complete`)}),(0,A.jsx)(`p`,{role:`status`,className:`mt-1 text-sm text-fg-muted`,children:e.activationEligible===!1?j(`插件已停用。`,`Plugin is disabled.`):c?.partial||B.length||z.length||c?.missingConfig?.length?j(`插件已安装,部分功能仍需要授权。`,`Plugin installed. Some features still need authorization.`):j(`所有 Agent 均可使用。可在 Agent 设置中单独调整。`,`Available to all agents. Customize individual agents in Agent settings.`)})]}):(0,A.jsxs)(`div`,{className:`rounded-xl border border-edge p-4`,children:[(0,A.jsx)(`h3`,{className:`font-medium`,children:j(`安装准备`,`Installation setup`)}),(0,A.jsx)(`ol`,{className:`mt-4 space-y-4 text-sm`,"aria-live":`polite`,children:[{name:j(`准备资源`,`Prepare resources`),done:c?.resources===`ready`,running:q&&c?.resources!==`ready`},{name:j(`授权账号`,`Authorize accounts`),done:c?.resources===`ready`&&!c?.missingConfig?.length&&B.length===0,running:!1},{name:j(`加载可用工具`,`Load available tools`),done:!1,running:q&&c?.resources===`ready`}].map(e=>(0,A.jsxs)(`li`,{className:`flex items-center gap-3`,children:[e.done?(0,A.jsx)(ee,{className:`size-5 text-accent`,"aria-hidden":!0}):e.running?(0,A.jsx)(ne,{className:`size-5 animate-spin text-accent`,"aria-hidden":!0}):(0,A.jsx)(te,{className:`size-5 text-fg-muted`,"aria-hidden":!0}),e.name]},e.name))}),(0,A.jsx)(`p`,{className:`mt-4 text-xs text-fg-muted`,children:j(`安装后所有 Agent 均可使用,可在各自的设置中调整。`,`Available to all agents after installation. Customize individual agents in Agent settings.`)})]}),!c||c.state===`cancelled`?(0,A.jsx)(D,{disabled:f||e.readiness===`blocked`,onClick:()=>void Y(`start`),children:j(`继续安装`,`Continue installation`)}):(0,A.jsxs)(A.Fragment,{children:[c.missingConfig?.length||w?(0,A.jsxs)(`form`,{className:`space-y-4 rounded-xl border border-edge p-4`,onSubmit:e=>{e.preventDefault(),Y(`configure`,{values:u})},children:[(0,A.jsx)(`h4`,{className:`font-medium`,children:j(`补充配置`,`Required configuration`)}),(0,A.jsx)(F,{fields:w?W:K,values:u,onChange:d}),(0,A.jsx)(D,{type:`submit`,disabled:q||!Object.keys(u).length,children:j(`继续`,`Continue`)})]}):null,V&&(B.length||c.missingConfig?.length)?(0,A.jsxs)(`div`,{className:`flex items-start gap-3 rounded-xl border border-amber-500/30 bg-amber-500/10 p-4 text-sm`,children:[(0,A.jsx)(b,{className:`mt-0.5 size-5 shrink-0`,"aria-hidden":!0}),(0,A.jsxs)(`div`,{children:[(0,A.jsx)(`p`,{className:`font-medium`,children:j(`需要授权`,`Authorization required`)}),(0,A.jsx)(`p`,{className:`mt-1 text-fg-muted`,children:j(`授权后即可使用相关功能。已就绪的功能可继续使用。`,`Connect these accounts to use their features. Ready features remain available.`)})]})]}):null,z.length?(0,A.jsx)(`div`,{className:`space-y-3`,"aria-label":j(`需要补充权限`,`Additional permissions required`),children:z.map(e=>(0,A.jsxs)(`div`,{role:`alert`,className:`space-y-3 rounded-xl border border-amber-500/30 bg-amber-500/10 p-4 text-sm`,children:[(0,A.jsx)(`p`,{className:`font-medium`,children:e.title}),(0,A.jsx)(`p`,{className:`text-fg-muted`,children:j(`账号已连接,以下权限尚未就绪;其他已授权功能可继续使用。`,`Account connected. These permissions are not ready; other authorized features remain available.`)}),e.scopes.length?(0,A.jsx)(`p`,{className:`break-all font-mono text-xs`,children:e.scopes.join(`, `)}):null,(0,A.jsx)(`ol`,{className:`list-inside list-decimal space-y-1 text-fg-muted`,children:e.instructions.map(e=>(0,A.jsx)(`li`,{children:e},e))}),(0,A.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[e.helpUrl?(0,A.jsx)(D,{variant:`secondary`,asChild:!0,children:(0,A.jsx)(`a`,{href:e.helpUrl,target:`_blank`,rel:`noopener noreferrer`,children:j(`前往开通应用权限`,`Open application permissions`)})}):null,e.method&&e.account?(0,A.jsx)(D,{disabled:q,onClick:()=>{O.current=c.revision,C(e.account.id),X(e.account,e.method)},children:j(`补充授权`,`Grant missing permissions`)}):null,(0,A.jsx)(D,{variant:`secondary`,disabled:q,onClick:()=>void Y(`prepare`),children:j(`重新检查权限`,`Check permissions again`)})]})]},`${e.account?.id}:${e.id}`))}):null,I.length?(0,A.jsxs)(`div`,{className:`space-y-2`,children:[(0,A.jsx)(`h4`,{className:`text-sm font-medium`,children:j(`账号与连接`,`Accounts and connections`)}),I.map(e=>(0,A.jsxs)(`div`,{role:`group`,"aria-label":e.title,className:`flex items-center justify-between gap-3 rounded-lg border border-edge p-3`,children:[(0,A.jsxs)(`div`,{className:`min-w-0`,children:[(0,A.jsx)(`p`,{className:`text-sm font-medium`,children:e.title}),(0,A.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:L(e)?j(`已连接`,`Connected`):j(`需要授权`,`Authorization required`)})]}),(0,A.jsx)(D,{variant:L(e)?`secondary`:`primary`,disabled:q||c.resources!==`ready`,onClick:()=>{y(null),S(``),O.current=c.revision,C(e.id)},children:L(e)?j(`重新授权`,`Reconnect`):j(`连接账号`,`Connect account`)})]},e.id))]}):null,!V&&c.resources===`ready`?(0,A.jsxs)(`div`,{children:[(0,A.jsx)(D,{variant:`secondary`,disabled:q,onClick:Q,children:j(`暂时跳过`,`Skip for now`)}),(0,A.jsx)(`p`,{className:`mt-2 text-xs text-fg-muted`,children:j(`先完成安装,稍后在详情页授权。未授权的功能暂不可用。`,`Finish installation and connect later in plugin details. Unauthenticated features remain unavailable.`)})]}):null,V&&Object.keys(W).length&&!w?(0,A.jsx)(D,{variant:`ghost`,disabled:q,onClick:()=>T(!0),children:j(`修改插件配置`,`Edit plugin configuration`)}):null,V&&!z.length&&M.some(e=>e.methods.some(e=>e.type===`cli`))?(0,A.jsx)(D,{variant:`secondary`,disabled:q,onClick:()=>void Y(`prepare`),children:j(`检查连接与权限`,`Check connection and permissions`)}):null,!q&&(m||[`failed`,`interrupted`].includes(c.state)||c.connections.some(e=>e.state===`error`))?(0,A.jsx)(D,{variant:`secondary`,onClick:()=>void Y(`prepare`),children:j(`重试检查`,`Retry checks`)}):null,V?null:(0,A.jsx)(D,{variant:`ghost`,disabled:f,onClick:()=>void Y(`cancel`),children:j(`取消安装`,`Cancel installation`)}),V&&!B.length&&!c.missingConfig?.length?e.setup?.tasks?.map(t=>(0,A.jsxs)(`div`,{className:`space-y-3 rounded-lg bg-surface-inset p-4 text-sm`,children:[(0,A.jsx)(`p`,{children:t}),(0,A.jsx)(D,{asChild:!0,disabled:!e.active,children:(0,A.jsx)(a,{to:`/chat/new?${new URLSearchParams({draft:t,projectScope:`none`})}`,state:{forceNewChat:!0},onClick:t=>{e.active?r?.():t.preventDefault()},children:j(`开始这个任务`,`Start this task`)})})]},t)):null]}),q?(0,A.jsx)(`p`,{role:`status`,className:`text-sm text-fg-muted`,children:j(`正在准备,可关闭后继续。`,`Preparing. You can close this window and resume.`)}):null,c?.error&&!c.deferred&&!c.missingConfig?.length?(0,A.jsx)(`p`,{className:`text-sm text-fg-muted`,children:G}):null,m?(0,A.jsx)(`p`,{role:`alert`,className:`text-sm text-fg-muted`,children:m}):null]})}var B=`w-full rounded-lg border border-edge bg-surface-inset px-3 py-2 text-sm text-fg`;function V(e,t){if(e.startsWith(`content.skills:`)){let n=e.slice(15);return t?`提供技能:${n}`:`Add skill: ${n}`}if(e.startsWith(`runtime.mcp.stdio:`)){let n=e.slice(18).split(`:`,1)[0];return t?`在 Gateway 上运行工具服务:${n}`:`Run a tool service on the Gateway: ${n}`}if(e.startsWith(`network.mcp:`)){let n=e.slice(12).split(`:`,1)[0];return t?`连接外部工具服务:${n}`:`Connect to an external tool service: ${n}`}return e.startsWith(`runtime.capability-access:`)?t?`按账号授权启用相关技能和工具`:`Enable skills and tools according to account authorization`:e.startsWith(`runtime.authorization:`)?t?`在本机运行账号登录程序:${e.split(`:`)[1]}`:`Run account sign-in locally: ${e.split(`:`)[1]}`:e.startsWith(`runtime.resource:`)?t?`下载可执行资源:${e.split(`:`)[1]}`:`Download executable resource: ${e.split(`:`)[1]}`:e.startsWith(`network.resource:`)?t?`下载并校验资源:${e.split(`:`)[1]}`:`Download and verify resource: ${e.split(`:`)[1]}`:e}function H(e,t){return t?.publisher?.verification!==`verified`||t.latestVersion.riskTier&&t.latestVersion.riskTier!==`content`?!0:e.addedCapabilities.some(e=>!e.startsWith(`content.skills:`))}async function U(e,t,n){let r=await l(s(e),{method:t,...n===void 0?{}:{body:JSON.stringify(n)}});if(!r.ok)throw Error(r.error??`Request failed`);return r.payload}function W({extension:e,onClose:t,onUninstalled:n,initialSource:r=``,marketplace:a,autoInstall:s=!1}){let l=c(e=>e.language),_=l.startsWith(`zh`),b=a?.localizations?.[_?`zh-CN`:`en`],te=b?.displayName??a?.name,ie=b?.description??a?.description,O=(0,P.useId)(),{mutate:oe}=E(),[M,N]=(0,P.useState)(e),[F,se]=(0,P.useState)(r||e?.installationSource||``),[I,L]=(0,P.useState)(null),[R,W]=(0,P.useState)([]),[G,K]=(0,P.useState)(!1),[q,J]=(0,P.useState)(``),[Y,X]=(0,P.useState)(!1),[Z,Q]=(0,P.useState)(!1),[ce,le]=(0,P.useState)(!1),[ue,de]=(0,P.useState)(!1),[fe,pe]=(0,P.useState)(!1),[me,he]=(0,P.useState)(!1),ge=o(),_e=i(),[ve,ye]=(0,P.useState)(!1),be=(0,P.useRef)(!1),xe=`/api/extensions/agent-plugins/${encodeURIComponent(M?.pluginId??``)}`,Se=F.trim().startsWith(`store:`),Ce=()=>oe(`gateway-extensions-list`);async function $(e){K(!0),J(``);try{await e()}catch(e){J(e instanceof Error?e.message:String(e))}finally{K(!1)}}function we(e){se(e),L(null),W([]),J(``)}let Te=typeof window<`u`?window.electronAPI?.file:void 0,Ee=/^(?:\/|[A-Za-z]:[\\/])/.test(F.trim())?F.trim():void 0;async function De(){if(!Te?.openDirectory){pe(!0);return}let e=await Te.openDirectory(Ee?{defaultPath:Ee}:void 0);e&&we(e)}async function Oe(){if(!Te?.openFile){pe(!0);return}let e=await Te.openFile({...Ee?{defaultPath:Ee}:{},extensions:[`zip`]});e&&we(e)}function ke(e){return[...e.dataTransfer.types].some(e=>e===`Files`||e===`text/plain`||e===`text/uri-list`)}function Ae(e){if(!ke(e))return;e.preventDefault(),de(!1);let t=Array.from(e.dataTransfer.files);if(t.length){if(t.length>1){J(_?`一次只能选择一个插件目录或 ZIP。`:`Choose one plugin directory or ZIP at a time.`);return}let e=Te?.getPathForFile?.(t[0]);e?we(e):J(_?`浏览器无法读取本机文件路径,请使用“选择文件或目录”选择安装包。`:`The browser cannot read local file paths. Use Choose file or folder to select the package.`);return}let n=e.dataTransfer.getData(`text/uri-list`)||e.dataTransfer.getData(`text/plain`);n.trim()&&we(n.trim().split(/\r?\n/)[0])}async function je(e){let t=await U(`${xe}/activation`,`POST`,{enabled:e});N(t),await Ce()}async function Me(e){let t=!M,n=await U(t?`/api/extensions/install`:`${xe}/update`,`POST`,{source:F,reviewHash:e.reviewHash,...e.layout?{setup:!0}:{}});N(n),await Ce(),!e.layout&&t&&!n.activationEligible&&n.readiness!==`blocked`&&n.pluginId&&(n=await U(`/api/extensions/agent-plugins/${encodeURIComponent(n.pluginId)}/activation`,`POST`,{enabled:!0}),N(n),await Ce()),L(null),ye(!e.layout&&t&&n.activationEligible===!0)}async function Ne(){let e=await U(`/api/extensions/inspect`,`POST`,{source:F});if(H(e,a)){L(e);return}await Me(e)}(0,P.useEffect)(()=>{e&&!e.setup&&N(e)},[e]),(0,P.useEffect)(()=>{if(!e?.setup||!e.pluginId)return;let t=!1;return U(`/api/extensions/agent-plugins/${encodeURIComponent(e.pluginId)}`,`GET`).then(e=>{t||N(e)}).catch(()=>{}),()=>{t=!0}},[e?.pluginId]),(0,P.useEffect)(()=>{!s||M||!Se||be.current||(be.current=!0,$(Ne))},[s,M,Se]);let Pe=s&&!M&&Se&&!be.current;return(0,A.jsx)(g,{defaultOpen:!0,onOpenChange:e=>!e&&t(),children:(0,A.jsxs)(p,{children:[(0,A.jsx)(d,{className:`fixed inset-0 z-[130] bg-scrim`}),(0,A.jsxs)(m,{className:`fixed left-1/2 top-1/2 z-[131] flex h-[min(42rem,calc(100dvh-2rem))] w-[min(38rem,calc(100vw-1.5rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-overlay shadow-popover`,children:[(0,A.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between border-b border-edge p-4`,children:[(0,A.jsxs)(`div`,{className:`flex min-w-0 items-center gap-3`,children:[(0,A.jsx)(k,{iconUrl:M?.branding?.iconUrl??a?.branding?.iconUrl,fallback:re}),(0,A.jsx)(h,{className:`font-semibold`,children:M?.name??te??(_?`安装插件`:`Install plugin`)})]}),(0,A.jsx)(D,{variant:`ghost`,onClick:t,children:_?`关闭`:`Close`})]}),(0,A.jsx)(f,{className:`sr-only`,children:_?`安装、组件、账号连接和权限`:`Installation, components, connections and permissions`}),(0,A.jsxs)(`div`,{className:`min-h-0 flex-auto space-y-4 overflow-y-auto overscroll-contain p-4`,children:[!M&&Se?(0,A.jsxs)(`section`,{className:`space-y-4`,children:[(0,A.jsxs)(`div`,{className:`flex items-start gap-3 rounded-xl border border-edge bg-surface-base p-4`,children:[(0,A.jsx)(C,{className:`mt-0.5 size-5 shrink-0 text-emerald-600 dark:text-emerald-400`,"aria-hidden":!0}),(0,A.jsxs)(`div`,{className:`min-w-0`,children:[(0,A.jsx)(`p`,{className:`font-medium text-fg`,children:te??I?.manifest.name??F.slice(6)}),ie?(0,A.jsx)(`p`,{className:`mt-1 text-sm leading-relaxed text-fg-muted`,children:ie}):null,(0,A.jsx)(`p`,{className:`mt-2 text-xs text-fg-muted`,children:a?.publisher?.verification===`verified`?_?`已认证发布者 · 安装后所有智能体均可使用`:`Verified publisher · available to all agents after installation`:_?`安装前会检查来源和所需权限`:`Source and required permissions are checked before installation`})]})]}),a?(0,A.jsx)(j,{data:a,zh:_}):null,I?null:(0,A.jsxs)(D,{className:`w-full`,disabled:G||Pe,onClick:()=>void $(Ne),children:[G||Pe?(0,A.jsx)(ne,{className:`size-4 animate-spin`,"aria-hidden":!0}):null,G||Pe?_?`正在安全检查并安装…`:`Checking and installing…`:_?`一键安装`:`Install`]})]}):null,M?(0,A.jsxs)(A.Fragment,{children:[ve?(0,A.jsxs)(`div`,{role:`status`,className:`flex items-start gap-3 rounded-lg border border-emerald-500/25 bg-emerald-500/10 p-4`,children:[(0,A.jsx)(ee,{className:`mt-0.5 size-5 shrink-0 text-emerald-600 dark:text-emerald-400`,"aria-hidden":!0}),(0,A.jsxs)(`div`,{children:[(0,A.jsx)(`p`,{className:`font-medium text-fg`,children:_?`插件已安装并启用`:`Plugin installed and enabled`}),(0,A.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:_?`请继续检查账号连接、依赖与可用状态,再在对话中试用。`:`It is ready to use in your conversations.`})]})]}):null,(!M.setup||M.readiness!==`setup_required`)&&!M.activationEligible?(0,A.jsxs)(`div`,{role:`status`,className:`space-y-3 rounded-lg border border-accent/25 bg-accent-soft p-4`,children:[(0,A.jsxs)(`div`,{children:[(0,A.jsx)(`p`,{className:`font-medium text-accent-fg`,children:_?`插件已安装,当前尚未启用`:`Plugin installed. It is not enabled yet.`}),(0,A.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:_?`启用后,Skills 和 MCP 才会加入 Agent 运行时。`:`Enable it to make its skills and MCP servers available to the Agent runtime.`})]}),(0,A.jsx)(D,{disabled:G||M.readiness===`blocked`,onClick:()=>void $(()=>je(!0)),children:_?`启用插件`:`Enable plugin`})]}):null,M.setup?(0,A.jsx)(z,{extension:M,zh:_,onStart:t,onInstalled:()=>{t(),ge(ae(M.pluginId,`installed`,!1,_e.pathname+_e.search))},onChanged:async()=>{let e=await U(`${xe}`,`GET`);N(e),await Ce()}}):null,(0,A.jsxs)(`details`,{className:`rounded-lg border border-edge p-3`,children:[(0,A.jsx)(`summary`,{className:`cursor-pointer text-sm font-medium`,children:_?`插件详情`:`Plugin details`}),(0,A.jsxs)(`div`,{className:`mt-3 space-y-3`,children:[(0,A.jsxs)(`p`,{className:`text-sm text-fg-muted`,children:[_?`插件`:`Plugin`,` · `,M.version,` · `,M.readiness&&{ready:_?`已就绪`:`Ready`,setup_required:_?`待连接`:`Setup required`,degraded:_?`部分不可用`:`Partially available`,blocked:_?`已阻止`:`Blocked`}[M.readiness]]}),M.provenance?(0,A.jsxs)(`p`,{className:`break-words text-xs text-fg-muted`,children:[M.provenance.publisherVerification===`verified`?_?`已认证发布者`:`Verified publisher`:_?`社区发布者`:`Community publisher`,` · `,M.provenance.packageName,`@`,M.provenance.version,` · SHA-256 `,M.provenance.sha256.slice(0,12),`…`,M.provenance.riskTier?` · ${M.provenance.riskTier}`:``]}):null,(0,A.jsx)(`p`,{className:`text-sm`,children:M.description}),M.installationSource?(0,A.jsxs)(`p`,{className:`break-all text-xs text-fg-muted`,children:[_?`来源:`:`Source: `,M.installationSource,M.resolvedCommit?` · ${M.resolvedCommit.slice(0,12)}`:``]}):null,M.activationEligible?(0,A.jsx)(D,{disabled:G,variant:`secondary`,onClick:()=>void $(()=>je(!1)),children:_?`停用`:`Disable`}):null,M.canRollback?(0,A.jsx)(D,{disabled:G,variant:`secondary`,onClick:()=>void $(async()=>{N(await U(`${xe}/rollback`,`POST`)),await Ce()}),children:_?`回滚上一版本`:`Roll back`}):null]})]}),M.diagnostics?.map((e,t)=>(0,A.jsxs)(`p`,{className:`text-sm text-fg-muted`,children:[e.component,`: `,e.message]},t))]}):null,M?(0,A.jsxs)(D,{variant:`ghost`,className:`px-0`,"aria-expanded":me,onClick:()=>he(e=>!e),children:[(0,A.jsx)(v,{className:T(`size-4 transition-transform motion-reduce:transition-none`,me&&`rotate-180`),"aria-hidden":!0}),_?`高级操作`:`Advanced actions`]}):null,!M&&!Se||me?(0,A.jsxs)(`form`,{className:T(`space-y-3`,M&&`border-t border-edge pt-4`),onSubmit:e=>{e.preventDefault(),$(async()=>{let e=await U(`/api/extensions/inspect`,`POST`,{source:F});e.candidates?(W(e.candidates),L(null)):(W([]),L(e))})},children:[(0,A.jsxs)(`div`,{"data-testid":`plugin-source-dropzone`,className:T(`rounded-xl border border-dashed p-3 transition-colors`,ue?`border-accent bg-accent-soft`:`border-edge bg-surface-inset/40`),onDragEnter:e=>{ke(e)&&(e.preventDefault(),de(!0))},onDragOver:e=>{ke(e)&&(e.preventDefault(),e.dataTransfer.dropEffect=`copy`,de(!0))},onDragLeave:e=>{e.currentTarget.contains(e.relatedTarget)||de(!1)},onDrop:Ae,children:[(0,A.jsxs)(`div`,{className:`mb-2 flex items-start gap-2`,children:[(0,A.jsx)(w,{className:`mt-0.5 size-4 shrink-0 text-fg-muted`,"aria-hidden":!0}),(0,A.jsxs)(`div`,{children:[(0,A.jsx)(`label`,{htmlFor:O,className:`block text-sm font-medium`,children:M?_?`更新包来源`:`Update package source`:_?`安装包来源`:`Package source`}),(0,A.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-muted`,children:_?`输入 github:组织/仓库、Git / ZIP 地址或宿主目录;marketplace 可选择插件。`:`Enter github:owner/repo, a Git / ZIP URL or a Gateway directory. Marketplaces let you choose a plugin.`})]})]}),(0,A.jsx)(`input`,{id:O,className:B,value:F,onChange:e=>we(e.target.value),placeholder:_?`/插件目录/或/插件.zip`:`/plugin/folder/or/plugin.zip`,autoComplete:`off`,spellCheck:!1,required:!0}),(0,A.jsx)(`div`,{className:`mt-2 flex flex-wrap gap-2`,children:Te?(0,A.jsxs)(A.Fragment,{children:[(0,A.jsxs)(D,{type:`button`,variant:`secondary`,disabled:G,onClick:()=>void $(De),children:[(0,A.jsx)(S,{className:`size-4`,"aria-hidden":!0}),_?`选择目录`:`Choose directory`]}),(0,A.jsxs)(D,{type:`button`,variant:`secondary`,disabled:G,onClick:()=>void $(Oe),children:[(0,A.jsx)(x,{className:`size-4`,"aria-hidden":!0}),_?`选择 ZIP`:`Choose ZIP`]})]}):(0,A.jsxs)(D,{type:`button`,variant:`secondary`,disabled:G,onClick:()=>pe(!0),children:[(0,A.jsx)(S,{className:`size-4`,"aria-hidden":!0}),_?`选择文件或目录`:`Choose file or folder`]})})]}),(0,A.jsx)(D,{type:`submit`,variant:`secondary`,disabled:G||!F,children:_?`检查安装包`:`Inspect package`})]}):null,R.length?(0,A.jsx)(`div`,{className:`space-y-2`,"aria-label":_?`选择插件`:`Choose a plugin`,children:R.map(e=>(0,A.jsx)(D,{variant:`secondary`,className:`w-full justify-start`,onClick:()=>{we(e.source),$(async()=>L(await U(`/api/extensions/inspect`,`POST`,{source:e.source})))},children:e.name},e.source))}):null,I?(0,A.jsxs)(`div`,{role:`region`,"aria-labelledby":`plugin-authorization-title`,className:`space-y-3 rounded-xl border border-amber-500/30 bg-amber-500/10 p-4 text-sm`,children:[(0,A.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,A.jsx)(C,{className:`mt-0.5 size-5 shrink-0 text-amber-700 dark:text-amber-300`,"aria-hidden":!0}),(0,A.jsxs)(`div`,{children:[(0,A.jsx)(`p`,{id:`plugin-authorization-title`,className:`font-medium text-fg`,children:_?`需要你的授权`:`Your authorization is required`}),(0,A.jsx)(`p`,{className:`mt-1 text-fg-muted`,children:_?`此插件需要以下新增能力。确认后自动准备资源,按需登录账号,所有智能体均可使用。`:`Review these capabilities. Resources are prepared automatically; sign in if needed. Available to all agents.`})]})]}),(0,A.jsx)(`ul`,{tabIndex:0,"aria-label":_?`插件新增能力`:`Added plugin capabilities`,className:`max-h-[min(28vh,14rem)] space-y-2 overflow-y-auto overscroll-contain rounded-lg border border-edge bg-surface-panel p-3 break-words focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:I.addedCapabilities.map(e=>(0,A.jsxs)(`li`,{className:`flex gap-2`,children:[(0,A.jsx)(`span`,{"aria-hidden":!0,children:`•`}),(0,A.jsx)(`span`,{children:V(e,_)})]},e))}),I.diagnostics.map((e,t)=>(0,A.jsxs)(`p`,{children:[e.component,`: `,e.message]},t))]}):null,M&&me?(0,A.jsx)(`div`,{className:`border-t border-edge pt-4`,children:ce?(0,A.jsxs)(`div`,{className:`space-y-3 text-sm`,children:[(0,A.jsx)(`p`,{children:_?`卸载保留账号凭据;服务端授权需到相应服务撤销。`:`Credentials are retained. Revoke provider authorization in the service itself.`}),(0,A.jsxs)(`label`,{className:`flex gap-2`,children:[(0,A.jsx)(`input`,{type:`checkbox`,checked:Y,onChange:e=>X(e.target.checked)}),_?`同时删除插件数据`:`Also delete plugin data`]}),(0,A.jsxs)(`label`,{className:`flex gap-2`,children:[(0,A.jsx)(`input`,{type:`checkbox`,checked:Z,onChange:e=>Q(e.target.checked)}),_?`同时删除本地凭据`:`Also delete local credentials`]}),(0,A.jsx)(D,{disabled:G,onClick:()=>void $(async()=>{await U(xe,`DELETE`,{removeData:Y,removeCredentials:Z}),await Ce(),(n??t)()}),children:_?`确认卸载`:`Confirm uninstall`})]}):(0,A.jsx)(D,{variant:`ghost`,disabled:G,onClick:()=>le(!0),children:_?`卸载插件`:`Uninstall`})}):null,q?(0,A.jsx)(`p`,{role:`alert`,className:`break-words text-sm text-fg-muted`,children:q}):null]}),I?(0,A.jsxs)(`div`,{className:`flex shrink-0 flex-wrap justify-end gap-2 border-t border-edge p-4`,children:[(0,A.jsx)(D,{variant:`ghost`,disabled:G,onClick:()=>L(null),children:_?`取消`:`Cancel`}),(0,A.jsxs)(D,{disabled:G||!!M&&I.manifest.name!==M.name,onClick:()=>void $(()=>Me(I)),children:[G?(0,A.jsx)(ne,{className:`size-4 animate-spin`,"aria-hidden":!0}):null,_?`授权并安装`:`Authorize and install`]})]}):null]}),Te?null:(0,A.jsx)(y,{open:fe,onOpenChange:pe,initialAbsolutePath:Ee,onConfirm:async e=>we(e),wd:u(l).chat.workingDirectory,selectKind:`file-or-directory`,fileExtensions:[`zip`],title:_?`选择插件安装包`:`Choose plugin package`,description:_?`选择插件目录或 ZIP 文件。`:`Choose a plugin directory or ZIP file.`,confirmLabel:_?`使用此来源`:`Use this source`,nested:!0})]})})}export{z as n,j as r,W as t};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/block-editor-
|
|
2
|
-
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{t as i}from"./preload-helper-Czpn1I53.js";import{u as a}from"./chunk-KS7C4IRE-CiwuuyV8.js";import{l as o,n as s}from"./locale-store-
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/block-editor-Dtl2BG3t.js","assets/rolldown-runtime-aKtaBQYM.js","assets/vendor-react-BOUWij0V.js","assets/locale-store-B6OrWgY1.js","assets/messages-jwdBhfL9.js","assets/unlink-BEuthaaq.js","assets/createLucideIcon-DPHK1VkS.js","assets/check-DUBLcKHA.js","assets/copy-Dv6d4Dvw.js","assets/external-link-DjqjBmc3.js","assets/notes-api-Ddsf7FVg.js","assets/dist-BGTk37IG.js","assets/es2015-DBLcMg5B.js","assets/dist-CxGUk8J-.js","assets/markdown-view-DrhYZSmg.js","assets/chunk-KS7C4IRE-CiwuuyV8.js","assets/preload-helper-Czpn1I53.js","assets/download-Dk-ZjtO6.js","assets/file-image-CDUPkZvG.js","assets/plus-Q2yW6OE7.js","assets/x-B_N4OPjy.js","assets/cn-0WouolD0.js","assets/bundle-mjs-rHxsej31.js","assets/app-link-DRy3-k7j.js","assets/product-delivery-DRyD9_Xq.js","assets/schemas-CCWMleym.js","assets/local-apps-Ck6kACsY.js","assets/copy-to-clipboard-HOJ79TWv.js","assets/xml-_d7dTN2Q.js","assets/mermaid-render-oOellPHt.js","assets/markdown-view-C-DHb3Io.css","assets/chat-chart-block-QSvjx4w6.js","assets/skeleton-BI5TyibZ.js","assets/list-todo-CTVRto8O.js","assets/loader-circle-CifKLtgG.js","assets/mic-CuUb7zc-.js","assets/pause-DuPxgSxk.js","assets/pencil-DmIY3Oa-.js","assets/play-kxZvpBg8.js","assets/vendor-swr-CdRzEUwF.js","assets/floating-ui.dom-seOukHzT.js","assets/vendor-codemirror-aCQ0FcJT.js","assets/with-selector-xonYxPoM.js","assets/note-image-lightbox-DGYRJS03.js","assets/block-editor-Cvy3D_4T.css","assets/markdown-editor-BuuGlcfG.js","assets/languages-zXtNocoy.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{t as i}from"./preload-helper-Czpn1I53.js";import{u as a}from"./chunk-KS7C4IRE-CiwuuyV8.js";import{l as o,n as s}from"./locale-store-B6OrWgY1.js";import{t as c}from"./messages-jwdBhfL9.js";import{a as l,i as u,n as d,o as f,r as p,s as m,t as h}from"./dist-BGTk37IG.js";import{t as g}from"./bot-DjLkhyZL.js";import{t as _}from"./briefcase-business-BsoCaI_t.js";import{i as v,s as y}from"./popover-select-CEMWIrtY.js";import{t as b}from"./code-xml-DJtYhZUF.js";import{t as x}from"./ellipsis-0k4rZLoy.js";import{t as S}from"./eye-CABVeTq0.js";import{t as C}from"./heart-Cp4rgrqn.js";import{t as w}from"./markdown-view-DrhYZSmg.js";import{t as T}from"./message-square-plus-XP0tGdlV.js";import{t as E}from"./pencil-DmIY3Oa-.js";import{t as D}from"./plus-Q2yW6OE7.js";import{t as O}from"./rotate-ccw-JM1TBLpp.js";import{t as k}from"./settings-uiTATseT.js";import{t as A}from"./sliders-horizontal-DqsYor6I.js";import{t as j}from"./triangle-alert-2JXFNNKU.js";import{t as M}from"./upload-rrb46c3c.js";import{t as N}from"./x-B_N4OPjy.js";import{t as P}from"./cn-0WouolD0.js";import{t as F}from"./skeleton-BI5TyibZ.js";import{t as I}from"./specialists-xbB3xL9e.js";import{a as L}from"./new-session-preferences-gb411vZP.js";import{i as R}from"./vendor-swr-CdRzEUwF.js";import{r as z}from"./gateway-config-swr-D6cc6W6E.js";import{n as B,t as V}from"./registry-api-Bl2guMRg.js";import{c as H,i as U,l as W,n as G,o as ee,r as te,s as K,t as ne}from"./agents-admin-api-CXCAHNPj.js";import{t as q}from"./button-Cc4hUNTt.js";import{i as re,o as ie}from"./settings-shell-dialog-layer-BU3UuiJr.js";import{n as J}from"./interaction-BdhHBbYa.js";import{i as ae}from"./theme-store-TkG5mo0p.js";import{t as oe}from"./page-tabs-oeTY7z3_.js";import{i as se,r as ce,s as le,t as ue}from"./agent-avatar-display-BUH7ljEo.js";import{t as de}from"./sliding-tab-list-DuQyViqe.js";import{t as Y}from"./confirm-dialog-D7dQJytv.js";import{l as fe,m as pe,o as me,r as he,t as ge}from"./dist-ZrL34Ps4.js";import{n as _e}from"./model-selector-DXm4NS1_.js";import{n as ve,t as ye}from"./agents-app-path-ciChvpCS.js";import{n as be,r as xe,t as Se}from"./agent-display-names-Bje7vfSn.js";import{t as Ce}from"./settings-advanced-section-CEorDLUp.js";import{t as we}from"./use-media-query-ady-FgjK.js";import{t as Te}from"./number-input-El7Szeln.js";import{n as Ee}from"./settings-page-header-BAN34UQi.js";import"./settings-page-layout-B5TVFBV2.js";import{t as De}from"./phone-model-picker-DgIiWLhR.js";import{t as Oe}from"./directory-picker-path-field-Rkw3f7lG.js";import{r as ke,s as Ae}from"./image-generation-api-C2SqYNyD.js";var X=e(t(),1),Z=n();function je(e){let t=e.match(/^(---\r?\n[\s\S]*?\r?\n---(?:\r?\n)*)/);return t?{frontMatter:t[1],body:e.slice(t[1].length)}:{frontMatter:``,body:e}}function Me(e,t){let{frontMatter:n}=je(e);return`${n}${t}`}var Ne=[{id:`professional`,labelEn:`Professional & Efficient`,labelZh:`专业高效`,emoji:`🎯`,content:`# SOUL.md - Who You Are
|
|
3
3
|
|
|
4
4
|
## Core Truths
|
|
5
5
|
|
|
@@ -63,7 +63,7 @@ Warm, friendly, and a little playful. Like a helpful friend who happens to know
|
|
|
63
63
|
|
|
64
64
|
## Vibe
|
|
65
65
|
|
|
66
|
-
Sharp, direct, slightly nerdy. The kind of engineer you'd want on your team — competent, opinionated, and occasionally funny.`},{id:`custom`,labelEn:`Custom`,labelZh:`自定义`,emoji:`✍️`,content:``}],Pe=[{value:`AI assistant`,labelEn:`AI Assistant`,labelZh:`AI 助手`},{value:`robot`,labelEn:`Robot`,labelZh:`机器人`},{value:`familiar`,labelEn:`Familiar`,labelZh:`精灵`},{value:`ghost in the machine`,labelEn:`Ghost in the machine`,labelZh:`机器幽灵`},{value:`digital companion`,labelEn:`Digital Companion`,labelZh:`数字伙伴`}],Q=r(),Fe=()=>i(()=>import(`./block-editor-CB6KruU-.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44])),Ie=()=>i(()=>import(`./markdown-editor-BuuGlcfG.js`),__vite__mapDeps([45,1,2,41,46,16])),Le=(0,X.lazy)(()=>Fe().then(e=>({default:e.BlockEditor}))),Re=(0,X.lazy)(()=>Ie().then(e=>({default:e.MarkdownEditor})));function ze(){let e=(0,Z.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Q.jsxs)(`div`,{className:`space-y-3 p-5`,"aria-busy":`true`,children:[(0,Q.jsx)(F,{className:`h-8 w-52`}),(0,Q.jsx)(F,{className:`h-4 w-full`}),(0,Q.jsx)(F,{className:`h-4 w-4/5`}),(0,Q.jsx)(F,{className:`h-4 w-11/12`})]}),e[0]=t):t=e[0],t}var Be=(0,X.forwardRef)(function({agentId:e,file:t,zh:n,onDirtyChange:r},i){let a=ae(e=>e.resolved===`dark`),[o,s]=(0,X.useState)(``),[c,l]=(0,X.useState)(``),[u,d]=(0,X.useState)(!0),[f,p]=(0,X.useState)(!1),[m,h]=(0,X.useState)(!1),[v,y]=(0,X.useState)(null),[x,T]=(0,X.useState)(!1),[D,O]=(0,X.useState)(!1),[k,A]=(0,X.useState)(null),[j,M]=(0,X.useState)(`direct`);(0,X.useEffect)(()=>{let n=!1;return d(!0),p(!1),y(null),s(``),l(``),T(!1),A(null),(async()=>{try{let r=await U(e),i=new Set(r.files.filter(e=>!e.missing).map(e=>e.name)).has(t)?await te(e,t):``;if(n)return;s(i),l(i)}catch(e){if(n)return;p(!0),y(e instanceof Error?e.message:String(e))}finally{n||d(!1)}})(),()=>{n=!0}},[e,t]);let N=o!==c;(0,X.useEffect)(()=>r(N),[N,r]);let F=(0,X.useCallback)(async()=>{if(N){h(!0),y(null);try{await K(e,t,o),l(o),T(!0),A(null)}catch(e){throw y(e instanceof Error?e.message:String(e)),e}finally{h(!1)}}},[e,t,N,o]);(0,X.useImperativeHandle)(i,()=>({save:F}),[F]);let I={"SOUL.md":{label:n?`个性与边界`:`Personality & boundaries`,description:n?`定义语气、价值观、行为原则与安全边界。`:`Tone, values, behavior principles, and safety boundaries.`},"TOOLS.md":{label:n?`工具使用约定`:`Tool guidance`,description:n?`补充工具偏好和使用约定,不负责授予权限。`:`Tool preferences and conventions; this does not grant access.`},"AGENTS.md":{label:n?`工作规范`:`Working instructions`,description:n?`该智能体长期遵循的协作和执行规范。`:`Persistent collaboration and execution instructions.`}},L=[_,C,b,E],R=je(o).body;return(0,Q.jsx)(`div`,{className:`space-y-5`,children:(0,Q.jsx)(`section`,{className:`overflow-hidden rounded-2xl border border-edge bg-surface-base`,children:(0,Q.jsxs)(`div`,{className:`p-4 sm:p-5`,children:[(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`h4`,{className:`text-sm font-semibold text-fg`,children:I[t].label}),(0,Q.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:I[t].description})]}),(0,Q.jsx)(de,{className:`flex rounded-lg bg-surface-hover p-1`,role:`group`,"aria-label":n?`编辑模式`:`Editor mode`,indicatorClassName:`rounded-md bg-surface-panel shadow-surface`,children:[[`direct`,E,n?`直接编辑`:`Visual`],[`source`,b,`Markdown`],[`preview`,S,n?`预览`:`Preview`]].map(([e,t,n])=>(0,Q.jsxs)(`button`,{type:`button`,onClick:()=>M(e),"aria-pressed":j===e,className:P(`inline-flex min-h-9 items-center gap-1.5 rounded-md px-2.5 text-xs font-medium transition-colors`,j===e?`bg-surface-panel text-fg shadow-surface`:`text-fg-muted hover:text-fg`),children:[(0,Q.jsx)(t,{className:`size-3.5`,"aria-hidden":!0}),n]},e))})]}),t===`SOUL.md`&&!u?(0,Q.jsxs)(`div`,{className:`mt-4`,children:[(0,Q.jsx)(`button`,{type:`button`,disabled:f,"aria-expanded":D,onClick:()=>O(!D),className:`text-xs font-medium text-accent hover:underline`,children:n?`使用模板`:`Use a template`}),k===null?null:(0,Q.jsx)(`button`,{type:`button`,className:`ml-3 text-xs text-accent hover:underline`,onClick:()=>{s(k),A(null)},children:n?`撤销模板替换`:`Undo template replacement`}),D?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`p`,{className:`my-2 text-xs text-fg-muted`,children:n?`模板会替换当前个性正文,保存前可以撤销。`:`A template replaces the personality text. You can undo before saving.`}),(0,Q.jsx)(`div`,{className:`grid gap-2 sm:grid-cols-4`,children:Ne.map((e,t)=>(0,Q.jsxs)(`button`,{type:`button`,onClick:()=>{e.content&&(A(o),s(t=>Me(t,e.content))),M(`direct`)},className:`flex min-h-11 items-center gap-2 rounded-xl border border-edge px-3 py-2 text-left text-xs font-medium text-fg-muted transition-colors hover:border-accent/40 hover:bg-surface-hover hover:text-fg`,children:[(0,Q.jsx)(L[t]??g,{className:`size-4 shrink-0 text-accent`,"aria-hidden":!0}),n?e.labelZh:e.labelEn]},e.id))})]}):null]}):null,v?(0,Q.jsx)(`p`,{className:`mt-4 rounded-lg bg-red-500/10 px-3 py-2 text-sm text-red-600`,role:`alert`,children:v}):null,(0,Q.jsx)(`div`,{className:`mt-4 h-[min(40vh,22rem)] min-h-64 overflow-hidden rounded-xl border border-edge bg-surface-panel`,children:u?(0,Q.jsx)(ze,{}):f?(0,Q.jsx)(`div`,{className:`flex h-full items-center justify-center p-6 text-center text-sm text-fg-muted`,children:n?`无法加载角色配置,未对文件进行任何更改。`:`Profile documents could not be loaded. No files were changed.`}):j===`direct`?(0,Q.jsx)(X.Suspense,{fallback:(0,Q.jsx)(ze,{}),children:(0,Q.jsx)(Le,{initialContent:R,onChange:e=>s(t=>Me(t,e)),placeholder:n?`直接输入内容,或输入 / 使用快捷命令…`:`Start writing, or type / for commands…`},`${e}-${t}-direct`)}):j===`source`?(0,Q.jsx)(X.Suspense,{fallback:(0,Q.jsx)(ze,{}),children:(0,Q.jsx)(Re,{initialContent:o,onChange:e=>s(e),isDark:a,lineWrap:!0,className:`min-h-0 flex-1`},`${e}-${t}-source`)}):(0,Q.jsx)(`div`,{className:`h-full overflow-y-auto p-5`,children:R.trim()?(0,Q.jsx)(w,{content:R}):(0,Q.jsx)(`p`,{className:`text-sm italic text-fg-muted`,children:n?`暂无内容。`:`No content yet.`})})}),(0,Q.jsx)(`div`,{className:`mt-2 flex justify-end text-xs text-fg-muted`,"aria-live":`polite`,children:m?n?`正在保存角色配置…`:`Saving profile documents…`:N?n?`角色配置有未保存的更改`:`Profile documents have unsaved changes`:x?n?`文档更改已保存`:`Document changes saved`:n?`未修改`:`No changes`})]})})})});function Ve(e){let t=(0,Z.c)(2),{children:n}=e,r;return t[0]===n?r=t[1]:(r=(0,Q.jsx)(`span`,{className:`rounded-full bg-accent-soft px-2 py-0.5 text-[10px] font-medium text-accent`,children:n}),t[0]=n,t[1]=r),r}function He(e){let t=(0,Z.c)(74),{label:n,inherited:r,value:i,zh:a,allowChatFallback:o,allowDisabled:s,modelKind:c,onChange:l}=e,u=o!==void 0&&o,d=s!==void 0&&s,f=c===void 0?`text`:c,p=i!=null,m;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(m={revalidateOnFocus:!1},t[0]=m):m=t[0];let h=R(p&&f!==`image`?V:null,B,m),g;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(g={revalidateOnFocus:!1},t[1]=g):g=t[1];let _=R(p&&f===`image`?`agent-defaults-image-models`:null,ke,g),v;t[2]===_.data?v=t[3]:(v=_.data??[],t[2]=_.data,t[3]=v);let y;t[4]===v?y=t[5]:(y=v.flatMap(We),t[4]=v,t[5]=y);let b=y,x;t[6]!==b||t[7]!==f||t[8]!==h?(x=f===`image`?b:h.data??[],t[6]=b,t[7]=f,t[8]=h,t[9]=x):x=t[9];let S=x,C;t[10]!==f||t[11]!==S?(C=f===`vision`?S.filter(Ue):S,t[10]=f,t[11]=S,t[12]=C):C=t[12];let w=C,T=f===`image`?_:h,E;t[13]===n?E=t[14]:(E=(0,Q.jsx)(`h4`,{className:`text-sm font-medium text-fg`,children:n}),t[13]=n,t[14]=E);let D;t[15]!==i||t[16]!==a?(D=i===void 0?(0,Q.jsx)(Ve,{children:a?`继承全局`:`Inherited globally`}):null,t[15]=i,t[16]=a,t[17]=D):D=t[17];let O;t[18]!==d||t[19]!==i||t[20]!==a?(O=i===null?(0,Q.jsx)(Ve,{children:d?a?`已禁用`:`Disabled`:a?`使用 Chat`:`Uses Chat`}):null,t[18]=d,t[19]=i,t[20]=a,t[21]=O):O=t[21];let k;t[22]!==E||t[23]!==D||t[24]!==O?(k=(0,Q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[E,D,O]}),t[22]=E,t[23]=D,t[24]=O,t[25]=k):k=t[25];let A;t[26]!==r?.primary||t[27]!==i||t[28]!==a?(A=i===void 0?(0,Q.jsx)(`p`,{className:`mt-1 truncate font-mono text-xs text-fg-muted`,children:r?.primary??(a?`全局未配置`:`Not configured globally`)}):null,t[26]=r?.primary,t[27]=i,t[28]=a,t[29]=A):A=t[29];let j;t[30]!==k||t[31]!==A?(j=(0,Q.jsxs)(`div`,{className:`min-w-0`,children:[k,A]}),t[30]=k,t[31]=A,t[32]=j):j=t[32];let M;t[33]!==l||t[34]!==i||t[35]!==a?(M=i===void 0?null:(0,Q.jsx)(q,{variant:`ghost`,className:`px-2 py-1 text-xs`,onClick:()=>l(void 0),children:a?`继承全局`:`Inherit globally`}),t[33]=l,t[34]=i,t[35]=a,t[36]=M):M=t[36];let N;t[37]!==u||t[38]!==l||t[39]!==i||t[40]!==a?(N=u&&i!==null?(0,Q.jsx)(q,{variant:`ghost`,className:`px-2 py-1 text-xs`,onClick:()=>l(null),children:a?`使用 Chat`:`Use Chat`}):null,t[37]=u,t[38]=l,t[39]=i,t[40]=a,t[41]=N):N=t[41];let P;t[42]!==d||t[43]!==l||t[44]!==i||t[45]!==a?(P=d&&i!==null?(0,Q.jsx)(q,{variant:`ghost`,className:`px-2 py-1 text-xs`,onClick:()=>l(null),children:a?`禁用`:`Disable`}):null,t[42]=d,t[43]=l,t[44]=i,t[45]=a,t[46]=P):P=t[46];let I;t[47]!==p||t[48]!==r?.fallbacks||t[49]!==r?.primary||t[50]!==l||t[51]!==a?(I=p?null:(0,Q.jsx)(q,{className:`px-2 py-1 text-xs`,onClick:()=>l({primary:r?.primary??``,fallbacks:[...r?.fallbacks??[]]}),children:a?`单独设置`:`Override for this agent`}),t[47]=p,t[48]=r?.fallbacks,t[49]=r?.primary,t[50]=l,t[51]=a,t[52]=I):I=t[52];let L;t[53]!==M||t[54]!==N||t[55]!==P||t[56]!==I?(L=(0,Q.jsxs)(`div`,{className:`flex gap-1`,children:[M,N,P,I]}),t[53]=M,t[54]=N,t[55]=P,t[56]=I,t[57]=L):L=t[57];let z;t[58]!==j||t[59]!==L?(z=(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[j,L]}),t[58]=j,t[59]=L,t[60]=z):z=t[60];let H;t[61]!==w||t[62]!==p||t[63]!==n||t[64]!==f||t[65]!==S||t[66]!==l||t[67]!==T||t[68]!==i||t[69]!==a?(H=p?(0,Q.jsxs)(`div`,{className:`mt-4 grid gap-3 sm:grid-cols-[minmax(0,1fr)_minmax(0,0.8fr)]`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`p`,{className:`text-xs font-medium text-fg-muted`,children:a?`主模型`:`Primary model`}),T.isLoading?(0,Q.jsx)(F,{className:`mt-1.5 h-11 w-full rounded-lg`}):(0,Q.jsx)(_e,{value:i.primary,models:S,modelsLoading:T.isLoading,modelsError:T.error,capabilitiesFilter:f===`vision`?`vision`:void 0,placeholder:a?`选择模型`:`Select a model`,searchPlaceholder:a?`搜索模型或服务商`:`Search models or providers`,noMatches:a?`没有匹配的模型`:`No matching models`,contentAlign:`start`,className:`mt-1.5 w-full`,ariaLabel:a?`${n}主模型`:`${n} primary model`,onChange:e=>l({...i,primary:e})})]}),(0,Q.jsx)(Ce,{title:a?`备用模型`:`Fallback models`,summary:a?`已配置 ${i.fallbacks.length} 个备用模型`:`${i.fallbacks.length} fallback models configured`,children:(0,Q.jsx)(Ae,{primary:i.primary,value:i.fallbacks,models:w,loading:T.isLoading,error:T.error,zh:a,onChange:e=>l({...i,fallbacks:e})})})]}):null,t[61]=w,t[62]=p,t[63]=n,t[64]=f,t[65]=S,t[66]=l,t[67]=T,t[68]=i,t[69]=a,t[70]=H):H=t[70];let U;return t[71]!==z||t[72]!==H?(U=(0,Q.jsxs)(`div`,{className:`rounded-2xl border border-edge bg-surface-base p-4`,children:[z,H]}),t[71]=z,t[72]=H,t[73]=U):U=t[73],U}function Ue(e){return e.vision}function We(e){return e.models.map(t=>({id:`${e.id}/${t}`,name:t,provider:e.label}))}function Ge(e){let t=(0,Z.c)(88),{agentId:n,avatar:r,zh:i,disabled:a,pending:o,onPendingChange:s,onReadingChange:c,onChange:l}=e,[u,d]=(0,X.useState)(!1),f=(0,X.useRef)(null),p=(0,X.useRef)(null),[m,h]=(0,X.useState)(!1),[g,_]=(0,X.useState)(null),v,y;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(v=()=>()=>p.current?.abort(),y=[],t[0]=v,t[1]=y):(v=t[0],y=t[1]),(0,X.useEffect)(v,y);let b=i?`自动头像`:`Automatic`,x;t[2]===b?x=t[3]:(x={value:``,label:b},t[2]=b,t[3]=x);let S=i?`Loopi · 平静`:`Loopi · Calm`,C;t[4]===S?C=t[5]:(C={value:`xopc:loopi:idle`,label:S},t[4]=S,t[5]=C);let w=i?`Loopi · 温暖`:`Loopi · Warm`,T;t[6]===w?T=t[7]:(T={value:`xopc:loopi:care`,label:w},t[6]=w,t[7]=T);let E=i?`Loopi · 好奇`:`Loopi · Curious`,D;t[8]===E?D=t[9]:(D={value:`xopc:loopi:curious`,label:E},t[8]=E,t[9]=D);let O=i?`Loopi · 倾听`:`Loopi · Listening`,k;t[10]===O?k=t[11]:(k={value:`xopc:loopi:listen`,label:O},t[10]=O,t[11]=k);let A;t[12]===n?A=t[13]:(A=se(`bottts`,n),t[12]=n,t[13]=A);let j=i?`机器人`:`Robot`,N;t[14]!==A||t[15]!==j?(N={value:A,label:j},t[14]=A,t[15]=j,t[16]=N):N=t[16];let F;t[17]===n?F=t[18]:(F=se(`adventurer`,n),t[17]=n,t[18]=F);let I=i?`插画人物`:`Illustration`,L;t[19]!==F||t[20]!==I?(L={value:F,label:I},t[19]=F,t[20]=I,t[21]=L):L=t[21];let R;t[22]!==D||t[23]!==k||t[24]!==N||t[25]!==L||t[26]!==x||t[27]!==C||t[28]!==T?(R=[x,C,T,D,k,N,L],t[22]=D,t[23]=k,t[24]=N,t[25]=L,t[26]=x,t[27]=C,t[28]=T,t[29]=R):R=t[29];let z=R,B=z.find(e=>e.value===(r??``))?.label??(i?`自定义头像`:`Custom avatar`),V;t[30]!==l||t[31]!==s||t[32]!==c||t[33]!==i?(V=e=>{if(!e)return;if(_(null),![`image/png`,`image/jpeg`,`image/webp`].includes(e.type)){_(i?`请选择 PNG、JPG 或 WebP 图片。`:`Choose a PNG, JPG, or WebP image.`);return}if(!e.size||e.size>524288){_(i?`图片不能为空,且不能超过 512 KB。`:`The image must be non-empty and at most 512 KB.`);return}h(!0),c(!0);let t=new FileReader;p.current=t;let n=()=>{h(!1),c(!1),p.current=null};t.onload=()=>{let r=String(t.result);s({base64:r.slice(r.indexOf(`,`)+1),mimeType:e.type,preview:r}),l(ce),n()},t.onerror=()=>{_(i?`图片读取失败,请重新选择。`:`Could not read the image. Choose it again.`),n()},t.readAsDataURL(e)},t[30]=l,t[31]=s,t[32]=c,t[33]=i,t[34]=V):V=t[34];let H=V,U;t[35]===H?U=t[36]:(U=(0,Q.jsx)(`input`,{ref:f,type:`file`,accept:`image/png,image/jpeg,image/webp`,hidden:!0,onChange:e=>{H(e.target.files?.[0]),e.target.value=``}}),t[35]=H,t[36]=U);let W=a||m,G;t[37]===Symbol.for(`react.memo_cache_sentinel`)?(G=()=>f.current?.click(),t[37]=G):G=t[37];let ee=i?`上传头像`:`Upload avatar`,te=`avatar-help-${n}`,K;t[38]!==n||t[39]!==r||t[40]!==o?(K=o?(0,Q.jsx)(`img`,{src:o.preview,alt:``,width:64,height:64,className:`size-full object-cover`}):(0,Q.jsx)(ue,{agentId:n,avatar:r,size:64}),t[38]=n,t[39]=r,t[40]=o,t[41]=K):K=t[41];let ne;t[42]===Symbol.for(`react.memo_cache_sentinel`)?(ne=(0,Q.jsx)(`span`,{className:`absolute inset-x-0 bottom-0 flex h-5 items-center justify-center bg-black/55 text-white`,children:(0,Q.jsx)(M,{className:`size-3`,"aria-hidden":!0})}),t[42]=ne):ne=t[42];let re;t[43]!==W||t[44]!==ee||t[45]!==te||t[46]!==K?(re=(0,Q.jsxs)(`button`,{type:`button`,disabled:W,onClick:G,"aria-label":ee,"aria-describedby":te,className:`group relative size-16 shrink-0 overflow-hidden rounded-full focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-accent disabled:opacity-50`,children:[K,ne]}),t[43]=W,t[44]=ee,t[45]=te,t[46]=K,t[47]=re):re=t[47];let ie=i?`头像`:`Avatar`,J;t[48]===ie?J=t[49]:(J=(0,Q.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:ie}),t[48]=ie,t[49]=J);let ae=m?i?`正在读取图片…`:`Reading image…`:o?i?`新头像 · 保存后生效`:`New avatar · save to apply`:B,oe;t[50]===ae?oe=t[51]:(oe=(0,Q.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:ae}),t[50]=ae,t[51]=oe);let le=`avatar-help-${n}`,de=i?`点击头像上传 · PNG、JPG、WebP · 最大 512 KB`:`Click to upload · PNG, JPG, WebP · Max 512 KB`,Y;t[52]!==le||t[53]!==de?(Y=(0,Q.jsx)(`p`,{id:le,className:`mt-1 text-xs text-fg-muted`,children:de}),t[52]=le,t[53]=de,t[54]=Y):Y=t[54];let fe;t[55]!==J||t[56]!==oe||t[57]!==Y?(fe=(0,Q.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[J,oe,Y]}),t[55]=J,t[56]=oe,t[57]=Y,t[58]=fe):fe=t[58];let pe=a||m,me=`avatar-options-${n}`,he;t[59]===u?he=t[60]:(he=()=>d(!u),t[59]=u,t[60]=he);let ge=u?i?`收起选择`:`Hide choices`:i?`默认头像`:`Built-in avatars`,_e;t[61]!==u||t[62]!==pe||t[63]!==me||t[64]!==he||t[65]!==ge?(_e=(0,Q.jsx)(q,{variant:`ghost`,disabled:pe,"aria-expanded":u,"aria-controls":me,onClick:he,children:ge}),t[61]=u,t[62]=pe,t[63]=me,t[64]=he,t[65]=ge,t[66]=_e):_e=t[66];let ve;t[67]!==U||t[68]!==re||t[69]!==fe||t[70]!==_e?(ve=(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-4`,children:[U,re,fe,_e]}),t[67]=U,t[68]=re,t[69]=fe,t[70]=_e,t[71]=ve):ve=t[71];let ye;t[72]!==n||t[73]!==r||t[74]!==u||t[75]!==a||t[76]!==l||t[77]!==s||t[78]!==z||t[79]!==m||t[80]!==i?(ye=u?(0,Q.jsx)(`div`,{id:`avatar-options-${n}`,className:`grid grid-cols-3 gap-2 sm:grid-cols-4`,role:`group`,"aria-label":i?`选择头像`:`Choose avatar`,children:z.map(e=>(0,Q.jsxs)(`button`,{type:`button`,disabled:a||m,"aria-pressed":(r??``)===e.value,onClick:()=>{s(null),l(e.value),_(null)},className:P(`flex min-h-24 flex-col items-center gap-2 rounded-xl border p-3 text-xs transition-colors focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-accent`,(r??``)===e.value?`border-accent bg-accent-soft text-fg`:`border-edge bg-surface-panel text-fg-muted hover:bg-surface-hover`),children:[(0,Q.jsx)(ue,{agentId:n,avatar:e.value,size:44}),e.label]},e.value))}):null,t[72]=n,t[73]=r,t[74]=u,t[75]=a,t[76]=l,t[77]=s,t[78]=z,t[79]=m,t[80]=i,t[81]=ye):ye=t[81];let be;t[82]===g?be=t[83]:(be=g?(0,Q.jsx)(`p`,{role:`alert`,className:`text-xs text-danger`,children:g}):null,t[82]=g,t[83]=be);let xe;return t[84]!==ve||t[85]!==ye||t[86]!==be?(xe=(0,Q.jsxs)(`div`,{className:`space-y-3`,children:[ve,ye,be]}),t[84]=ve,t[85]=ye,t[86]=be,t[87]=xe):xe=t[87],xe}var Ke={version:1,domains:[],taskTypes:[],inputKinds:[],outputKinds:[],specialties:[],examples:[],limitations:[]},qe=`mt-1.5 w-full rounded-xl border border-edge bg-surface-base px-3 py-2 text-sm text-fg outline-none focus:border-accent`,Je=e=>e.split(`
|
|
66
|
+
Sharp, direct, slightly nerdy. The kind of engineer you'd want on your team — competent, opinionated, and occasionally funny.`},{id:`custom`,labelEn:`Custom`,labelZh:`自定义`,emoji:`✍️`,content:``}],Pe=[{value:`AI assistant`,labelEn:`AI Assistant`,labelZh:`AI 助手`},{value:`robot`,labelEn:`Robot`,labelZh:`机器人`},{value:`familiar`,labelEn:`Familiar`,labelZh:`精灵`},{value:`ghost in the machine`,labelEn:`Ghost in the machine`,labelZh:`机器幽灵`},{value:`digital companion`,labelEn:`Digital Companion`,labelZh:`数字伙伴`}],Q=r(),Fe=()=>i(()=>import(`./block-editor-Dtl2BG3t.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44])),Ie=()=>i(()=>import(`./markdown-editor-BuuGlcfG.js`),__vite__mapDeps([45,1,2,41,46,16])),Le=(0,X.lazy)(()=>Fe().then(e=>({default:e.BlockEditor}))),Re=(0,X.lazy)(()=>Ie().then(e=>({default:e.MarkdownEditor})));function ze(){let e=(0,Z.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Q.jsxs)(`div`,{className:`space-y-3 p-5`,"aria-busy":`true`,children:[(0,Q.jsx)(F,{className:`h-8 w-52`}),(0,Q.jsx)(F,{className:`h-4 w-full`}),(0,Q.jsx)(F,{className:`h-4 w-4/5`}),(0,Q.jsx)(F,{className:`h-4 w-11/12`})]}),e[0]=t):t=e[0],t}var Be=(0,X.forwardRef)(function({agentId:e,file:t,zh:n,onDirtyChange:r},i){let a=ae(e=>e.resolved===`dark`),[o,s]=(0,X.useState)(``),[c,l]=(0,X.useState)(``),[u,d]=(0,X.useState)(!0),[f,p]=(0,X.useState)(!1),[m,h]=(0,X.useState)(!1),[v,y]=(0,X.useState)(null),[x,T]=(0,X.useState)(!1),[D,O]=(0,X.useState)(!1),[k,A]=(0,X.useState)(null),[j,M]=(0,X.useState)(`direct`);(0,X.useEffect)(()=>{let n=!1;return d(!0),p(!1),y(null),s(``),l(``),T(!1),A(null),(async()=>{try{let r=await U(e),i=new Set(r.files.filter(e=>!e.missing).map(e=>e.name)).has(t)?await te(e,t):``;if(n)return;s(i),l(i)}catch(e){if(n)return;p(!0),y(e instanceof Error?e.message:String(e))}finally{n||d(!1)}})(),()=>{n=!0}},[e,t]);let N=o!==c;(0,X.useEffect)(()=>r(N),[N,r]);let F=(0,X.useCallback)(async()=>{if(N){h(!0),y(null);try{await K(e,t,o),l(o),T(!0),A(null)}catch(e){throw y(e instanceof Error?e.message:String(e)),e}finally{h(!1)}}},[e,t,N,o]);(0,X.useImperativeHandle)(i,()=>({save:F}),[F]);let I={"SOUL.md":{label:n?`个性与边界`:`Personality & boundaries`,description:n?`定义语气、价值观、行为原则与安全边界。`:`Tone, values, behavior principles, and safety boundaries.`},"TOOLS.md":{label:n?`工具使用约定`:`Tool guidance`,description:n?`补充工具偏好和使用约定,不负责授予权限。`:`Tool preferences and conventions; this does not grant access.`},"AGENTS.md":{label:n?`工作规范`:`Working instructions`,description:n?`该智能体长期遵循的协作和执行规范。`:`Persistent collaboration and execution instructions.`}},L=[_,C,b,E],R=je(o).body;return(0,Q.jsx)(`div`,{className:`space-y-5`,children:(0,Q.jsx)(`section`,{className:`overflow-hidden rounded-2xl border border-edge bg-surface-base`,children:(0,Q.jsxs)(`div`,{className:`p-4 sm:p-5`,children:[(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`h4`,{className:`text-sm font-semibold text-fg`,children:I[t].label}),(0,Q.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:I[t].description})]}),(0,Q.jsx)(de,{className:`flex rounded-lg bg-surface-hover p-1`,role:`group`,"aria-label":n?`编辑模式`:`Editor mode`,indicatorClassName:`rounded-md bg-surface-panel shadow-surface`,children:[[`direct`,E,n?`直接编辑`:`Visual`],[`source`,b,`Markdown`],[`preview`,S,n?`预览`:`Preview`]].map(([e,t,n])=>(0,Q.jsxs)(`button`,{type:`button`,onClick:()=>M(e),"aria-pressed":j===e,className:P(`inline-flex min-h-9 items-center gap-1.5 rounded-md px-2.5 text-xs font-medium transition-colors`,j===e?`bg-surface-panel text-fg shadow-surface`:`text-fg-muted hover:text-fg`),children:[(0,Q.jsx)(t,{className:`size-3.5`,"aria-hidden":!0}),n]},e))})]}),t===`SOUL.md`&&!u?(0,Q.jsxs)(`div`,{className:`mt-4`,children:[(0,Q.jsx)(`button`,{type:`button`,disabled:f,"aria-expanded":D,onClick:()=>O(!D),className:`text-xs font-medium text-accent hover:underline`,children:n?`使用模板`:`Use a template`}),k===null?null:(0,Q.jsx)(`button`,{type:`button`,className:`ml-3 text-xs text-accent hover:underline`,onClick:()=>{s(k),A(null)},children:n?`撤销模板替换`:`Undo template replacement`}),D?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`p`,{className:`my-2 text-xs text-fg-muted`,children:n?`模板会替换当前个性正文,保存前可以撤销。`:`A template replaces the personality text. You can undo before saving.`}),(0,Q.jsx)(`div`,{className:`grid gap-2 sm:grid-cols-4`,children:Ne.map((e,t)=>(0,Q.jsxs)(`button`,{type:`button`,onClick:()=>{e.content&&(A(o),s(t=>Me(t,e.content))),M(`direct`)},className:`flex min-h-11 items-center gap-2 rounded-xl border border-edge px-3 py-2 text-left text-xs font-medium text-fg-muted transition-colors hover:border-accent/40 hover:bg-surface-hover hover:text-fg`,children:[(0,Q.jsx)(L[t]??g,{className:`size-4 shrink-0 text-accent`,"aria-hidden":!0}),n?e.labelZh:e.labelEn]},e.id))})]}):null]}):null,v?(0,Q.jsx)(`p`,{className:`mt-4 rounded-lg bg-red-500/10 px-3 py-2 text-sm text-red-600`,role:`alert`,children:v}):null,(0,Q.jsx)(`div`,{className:`mt-4 h-[min(40vh,22rem)] min-h-64 overflow-hidden rounded-xl border border-edge bg-surface-panel`,children:u?(0,Q.jsx)(ze,{}):f?(0,Q.jsx)(`div`,{className:`flex h-full items-center justify-center p-6 text-center text-sm text-fg-muted`,children:n?`无法加载角色配置,未对文件进行任何更改。`:`Profile documents could not be loaded. No files were changed.`}):j===`direct`?(0,Q.jsx)(X.Suspense,{fallback:(0,Q.jsx)(ze,{}),children:(0,Q.jsx)(Le,{initialContent:R,onChange:e=>s(t=>Me(t,e)),placeholder:n?`直接输入内容,或输入 / 使用快捷命令…`:`Start writing, or type / for commands…`},`${e}-${t}-direct`)}):j===`source`?(0,Q.jsx)(X.Suspense,{fallback:(0,Q.jsx)(ze,{}),children:(0,Q.jsx)(Re,{initialContent:o,onChange:e=>s(e),isDark:a,lineWrap:!0,className:`min-h-0 flex-1`},`${e}-${t}-source`)}):(0,Q.jsx)(`div`,{className:`h-full overflow-y-auto p-5`,children:R.trim()?(0,Q.jsx)(w,{content:R}):(0,Q.jsx)(`p`,{className:`text-sm italic text-fg-muted`,children:n?`暂无内容。`:`No content yet.`})})}),(0,Q.jsx)(`div`,{className:`mt-2 flex justify-end text-xs text-fg-muted`,"aria-live":`polite`,children:m?n?`正在保存角色配置…`:`Saving profile documents…`:N?n?`角色配置有未保存的更改`:`Profile documents have unsaved changes`:x?n?`文档更改已保存`:`Document changes saved`:n?`未修改`:`No changes`})]})})})});function Ve(e){let t=(0,Z.c)(2),{children:n}=e,r;return t[0]===n?r=t[1]:(r=(0,Q.jsx)(`span`,{className:`rounded-full bg-accent-soft px-2 py-0.5 text-[10px] font-medium text-accent`,children:n}),t[0]=n,t[1]=r),r}function He(e){let t=(0,Z.c)(74),{label:n,inherited:r,value:i,zh:a,allowChatFallback:o,allowDisabled:s,modelKind:c,onChange:l}=e,u=o!==void 0&&o,d=s!==void 0&&s,f=c===void 0?`text`:c,p=i!=null,m;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(m={revalidateOnFocus:!1},t[0]=m):m=t[0];let h=R(p&&f!==`image`?V:null,B,m),g;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(g={revalidateOnFocus:!1},t[1]=g):g=t[1];let _=R(p&&f===`image`?`agent-defaults-image-models`:null,ke,g),v;t[2]===_.data?v=t[3]:(v=_.data??[],t[2]=_.data,t[3]=v);let y;t[4]===v?y=t[5]:(y=v.flatMap(We),t[4]=v,t[5]=y);let b=y,x;t[6]!==b||t[7]!==f||t[8]!==h?(x=f===`image`?b:h.data??[],t[6]=b,t[7]=f,t[8]=h,t[9]=x):x=t[9];let S=x,C;t[10]!==f||t[11]!==S?(C=f===`vision`?S.filter(Ue):S,t[10]=f,t[11]=S,t[12]=C):C=t[12];let w=C,T=f===`image`?_:h,E;t[13]===n?E=t[14]:(E=(0,Q.jsx)(`h4`,{className:`text-sm font-medium text-fg`,children:n}),t[13]=n,t[14]=E);let D;t[15]!==i||t[16]!==a?(D=i===void 0?(0,Q.jsx)(Ve,{children:a?`继承全局`:`Inherited globally`}):null,t[15]=i,t[16]=a,t[17]=D):D=t[17];let O;t[18]!==d||t[19]!==i||t[20]!==a?(O=i===null?(0,Q.jsx)(Ve,{children:d?a?`已禁用`:`Disabled`:a?`使用 Chat`:`Uses Chat`}):null,t[18]=d,t[19]=i,t[20]=a,t[21]=O):O=t[21];let k;t[22]!==E||t[23]!==D||t[24]!==O?(k=(0,Q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[E,D,O]}),t[22]=E,t[23]=D,t[24]=O,t[25]=k):k=t[25];let A;t[26]!==r?.primary||t[27]!==i||t[28]!==a?(A=i===void 0?(0,Q.jsx)(`p`,{className:`mt-1 truncate font-mono text-xs text-fg-muted`,children:r?.primary??(a?`全局未配置`:`Not configured globally`)}):null,t[26]=r?.primary,t[27]=i,t[28]=a,t[29]=A):A=t[29];let j;t[30]!==k||t[31]!==A?(j=(0,Q.jsxs)(`div`,{className:`min-w-0`,children:[k,A]}),t[30]=k,t[31]=A,t[32]=j):j=t[32];let M;t[33]!==l||t[34]!==i||t[35]!==a?(M=i===void 0?null:(0,Q.jsx)(q,{variant:`ghost`,className:`px-2 py-1 text-xs`,onClick:()=>l(void 0),children:a?`继承全局`:`Inherit globally`}),t[33]=l,t[34]=i,t[35]=a,t[36]=M):M=t[36];let N;t[37]!==u||t[38]!==l||t[39]!==i||t[40]!==a?(N=u&&i!==null?(0,Q.jsx)(q,{variant:`ghost`,className:`px-2 py-1 text-xs`,onClick:()=>l(null),children:a?`使用 Chat`:`Use Chat`}):null,t[37]=u,t[38]=l,t[39]=i,t[40]=a,t[41]=N):N=t[41];let P;t[42]!==d||t[43]!==l||t[44]!==i||t[45]!==a?(P=d&&i!==null?(0,Q.jsx)(q,{variant:`ghost`,className:`px-2 py-1 text-xs`,onClick:()=>l(null),children:a?`禁用`:`Disable`}):null,t[42]=d,t[43]=l,t[44]=i,t[45]=a,t[46]=P):P=t[46];let I;t[47]!==p||t[48]!==r?.fallbacks||t[49]!==r?.primary||t[50]!==l||t[51]!==a?(I=p?null:(0,Q.jsx)(q,{className:`px-2 py-1 text-xs`,onClick:()=>l({primary:r?.primary??``,fallbacks:[...r?.fallbacks??[]]}),children:a?`单独设置`:`Override for this agent`}),t[47]=p,t[48]=r?.fallbacks,t[49]=r?.primary,t[50]=l,t[51]=a,t[52]=I):I=t[52];let L;t[53]!==M||t[54]!==N||t[55]!==P||t[56]!==I?(L=(0,Q.jsxs)(`div`,{className:`flex gap-1`,children:[M,N,P,I]}),t[53]=M,t[54]=N,t[55]=P,t[56]=I,t[57]=L):L=t[57];let z;t[58]!==j||t[59]!==L?(z=(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[j,L]}),t[58]=j,t[59]=L,t[60]=z):z=t[60];let H;t[61]!==w||t[62]!==p||t[63]!==n||t[64]!==f||t[65]!==S||t[66]!==l||t[67]!==T||t[68]!==i||t[69]!==a?(H=p?(0,Q.jsxs)(`div`,{className:`mt-4 grid gap-3 sm:grid-cols-[minmax(0,1fr)_minmax(0,0.8fr)]`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`p`,{className:`text-xs font-medium text-fg-muted`,children:a?`主模型`:`Primary model`}),T.isLoading?(0,Q.jsx)(F,{className:`mt-1.5 h-11 w-full rounded-lg`}):(0,Q.jsx)(_e,{value:i.primary,models:S,modelsLoading:T.isLoading,modelsError:T.error,capabilitiesFilter:f===`vision`?`vision`:void 0,placeholder:a?`选择模型`:`Select a model`,searchPlaceholder:a?`搜索模型或服务商`:`Search models or providers`,noMatches:a?`没有匹配的模型`:`No matching models`,contentAlign:`start`,className:`mt-1.5 w-full`,ariaLabel:a?`${n}主模型`:`${n} primary model`,onChange:e=>l({...i,primary:e})})]}),(0,Q.jsx)(Ce,{title:a?`备用模型`:`Fallback models`,summary:a?`已配置 ${i.fallbacks.length} 个备用模型`:`${i.fallbacks.length} fallback models configured`,children:(0,Q.jsx)(Ae,{primary:i.primary,value:i.fallbacks,models:w,loading:T.isLoading,error:T.error,zh:a,onChange:e=>l({...i,fallbacks:e})})})]}):null,t[61]=w,t[62]=p,t[63]=n,t[64]=f,t[65]=S,t[66]=l,t[67]=T,t[68]=i,t[69]=a,t[70]=H):H=t[70];let U;return t[71]!==z||t[72]!==H?(U=(0,Q.jsxs)(`div`,{className:`rounded-2xl border border-edge bg-surface-base p-4`,children:[z,H]}),t[71]=z,t[72]=H,t[73]=U):U=t[73],U}function Ue(e){return e.vision}function We(e){return e.models.map(t=>({id:`${e.id}/${t}`,name:t,provider:e.label}))}function Ge(e){let t=(0,Z.c)(88),{agentId:n,avatar:r,zh:i,disabled:a,pending:o,onPendingChange:s,onReadingChange:c,onChange:l}=e,[u,d]=(0,X.useState)(!1),f=(0,X.useRef)(null),p=(0,X.useRef)(null),[m,h]=(0,X.useState)(!1),[g,_]=(0,X.useState)(null),v,y;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(v=()=>()=>p.current?.abort(),y=[],t[0]=v,t[1]=y):(v=t[0],y=t[1]),(0,X.useEffect)(v,y);let b=i?`自动头像`:`Automatic`,x;t[2]===b?x=t[3]:(x={value:``,label:b},t[2]=b,t[3]=x);let S=i?`Loopi · 平静`:`Loopi · Calm`,C;t[4]===S?C=t[5]:(C={value:`xopc:loopi:idle`,label:S},t[4]=S,t[5]=C);let w=i?`Loopi · 温暖`:`Loopi · Warm`,T;t[6]===w?T=t[7]:(T={value:`xopc:loopi:care`,label:w},t[6]=w,t[7]=T);let E=i?`Loopi · 好奇`:`Loopi · Curious`,D;t[8]===E?D=t[9]:(D={value:`xopc:loopi:curious`,label:E},t[8]=E,t[9]=D);let O=i?`Loopi · 倾听`:`Loopi · Listening`,k;t[10]===O?k=t[11]:(k={value:`xopc:loopi:listen`,label:O},t[10]=O,t[11]=k);let A;t[12]===n?A=t[13]:(A=se(`bottts`,n),t[12]=n,t[13]=A);let j=i?`机器人`:`Robot`,N;t[14]!==A||t[15]!==j?(N={value:A,label:j},t[14]=A,t[15]=j,t[16]=N):N=t[16];let F;t[17]===n?F=t[18]:(F=se(`adventurer`,n),t[17]=n,t[18]=F);let I=i?`插画人物`:`Illustration`,L;t[19]!==F||t[20]!==I?(L={value:F,label:I},t[19]=F,t[20]=I,t[21]=L):L=t[21];let R;t[22]!==D||t[23]!==k||t[24]!==N||t[25]!==L||t[26]!==x||t[27]!==C||t[28]!==T?(R=[x,C,T,D,k,N,L],t[22]=D,t[23]=k,t[24]=N,t[25]=L,t[26]=x,t[27]=C,t[28]=T,t[29]=R):R=t[29];let z=R,B=z.find(e=>e.value===(r??``))?.label??(i?`自定义头像`:`Custom avatar`),V;t[30]!==l||t[31]!==s||t[32]!==c||t[33]!==i?(V=e=>{if(!e)return;if(_(null),![`image/png`,`image/jpeg`,`image/webp`].includes(e.type)){_(i?`请选择 PNG、JPG 或 WebP 图片。`:`Choose a PNG, JPG, or WebP image.`);return}if(!e.size||e.size>524288){_(i?`图片不能为空,且不能超过 512 KB。`:`The image must be non-empty and at most 512 KB.`);return}h(!0),c(!0);let t=new FileReader;p.current=t;let n=()=>{h(!1),c(!1),p.current=null};t.onload=()=>{let r=String(t.result);s({base64:r.slice(r.indexOf(`,`)+1),mimeType:e.type,preview:r}),l(ce),n()},t.onerror=()=>{_(i?`图片读取失败,请重新选择。`:`Could not read the image. Choose it again.`),n()},t.readAsDataURL(e)},t[30]=l,t[31]=s,t[32]=c,t[33]=i,t[34]=V):V=t[34];let H=V,U;t[35]===H?U=t[36]:(U=(0,Q.jsx)(`input`,{ref:f,type:`file`,accept:`image/png,image/jpeg,image/webp`,hidden:!0,onChange:e=>{H(e.target.files?.[0]),e.target.value=``}}),t[35]=H,t[36]=U);let W=a||m,G;t[37]===Symbol.for(`react.memo_cache_sentinel`)?(G=()=>f.current?.click(),t[37]=G):G=t[37];let ee=i?`上传头像`:`Upload avatar`,te=`avatar-help-${n}`,K;t[38]!==n||t[39]!==r||t[40]!==o?(K=o?(0,Q.jsx)(`img`,{src:o.preview,alt:``,width:64,height:64,className:`size-full object-cover`}):(0,Q.jsx)(ue,{agentId:n,avatar:r,size:64}),t[38]=n,t[39]=r,t[40]=o,t[41]=K):K=t[41];let ne;t[42]===Symbol.for(`react.memo_cache_sentinel`)?(ne=(0,Q.jsx)(`span`,{className:`absolute inset-x-0 bottom-0 flex h-5 items-center justify-center bg-black/55 text-white`,children:(0,Q.jsx)(M,{className:`size-3`,"aria-hidden":!0})}),t[42]=ne):ne=t[42];let re;t[43]!==W||t[44]!==ee||t[45]!==te||t[46]!==K?(re=(0,Q.jsxs)(`button`,{type:`button`,disabled:W,onClick:G,"aria-label":ee,"aria-describedby":te,className:`group relative size-16 shrink-0 overflow-hidden rounded-full focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-accent disabled:opacity-50`,children:[K,ne]}),t[43]=W,t[44]=ee,t[45]=te,t[46]=K,t[47]=re):re=t[47];let ie=i?`头像`:`Avatar`,J;t[48]===ie?J=t[49]:(J=(0,Q.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:ie}),t[48]=ie,t[49]=J);let ae=m?i?`正在读取图片…`:`Reading image…`:o?i?`新头像 · 保存后生效`:`New avatar · save to apply`:B,oe;t[50]===ae?oe=t[51]:(oe=(0,Q.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:ae}),t[50]=ae,t[51]=oe);let le=`avatar-help-${n}`,de=i?`点击头像上传 · PNG、JPG、WebP · 最大 512 KB`:`Click to upload · PNG, JPG, WebP · Max 512 KB`,Y;t[52]!==le||t[53]!==de?(Y=(0,Q.jsx)(`p`,{id:le,className:`mt-1 text-xs text-fg-muted`,children:de}),t[52]=le,t[53]=de,t[54]=Y):Y=t[54];let fe;t[55]!==J||t[56]!==oe||t[57]!==Y?(fe=(0,Q.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[J,oe,Y]}),t[55]=J,t[56]=oe,t[57]=Y,t[58]=fe):fe=t[58];let pe=a||m,me=`avatar-options-${n}`,he;t[59]===u?he=t[60]:(he=()=>d(!u),t[59]=u,t[60]=he);let ge=u?i?`收起选择`:`Hide choices`:i?`默认头像`:`Built-in avatars`,_e;t[61]!==u||t[62]!==pe||t[63]!==me||t[64]!==he||t[65]!==ge?(_e=(0,Q.jsx)(q,{variant:`ghost`,disabled:pe,"aria-expanded":u,"aria-controls":me,onClick:he,children:ge}),t[61]=u,t[62]=pe,t[63]=me,t[64]=he,t[65]=ge,t[66]=_e):_e=t[66];let ve;t[67]!==U||t[68]!==re||t[69]!==fe||t[70]!==_e?(ve=(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-4`,children:[U,re,fe,_e]}),t[67]=U,t[68]=re,t[69]=fe,t[70]=_e,t[71]=ve):ve=t[71];let ye;t[72]!==n||t[73]!==r||t[74]!==u||t[75]!==a||t[76]!==l||t[77]!==s||t[78]!==z||t[79]!==m||t[80]!==i?(ye=u?(0,Q.jsx)(`div`,{id:`avatar-options-${n}`,className:`grid grid-cols-3 gap-2 sm:grid-cols-4`,role:`group`,"aria-label":i?`选择头像`:`Choose avatar`,children:z.map(e=>(0,Q.jsxs)(`button`,{type:`button`,disabled:a||m,"aria-pressed":(r??``)===e.value,onClick:()=>{s(null),l(e.value),_(null)},className:P(`flex min-h-24 flex-col items-center gap-2 rounded-xl border p-3 text-xs transition-colors focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-accent`,(r??``)===e.value?`border-accent bg-accent-soft text-fg`:`border-edge bg-surface-panel text-fg-muted hover:bg-surface-hover`),children:[(0,Q.jsx)(ue,{agentId:n,avatar:e.value,size:44}),e.label]},e.value))}):null,t[72]=n,t[73]=r,t[74]=u,t[75]=a,t[76]=l,t[77]=s,t[78]=z,t[79]=m,t[80]=i,t[81]=ye):ye=t[81];let be;t[82]===g?be=t[83]:(be=g?(0,Q.jsx)(`p`,{role:`alert`,className:`text-xs text-danger`,children:g}):null,t[82]=g,t[83]=be);let xe;return t[84]!==ve||t[85]!==ye||t[86]!==be?(xe=(0,Q.jsxs)(`div`,{className:`space-y-3`,children:[ve,ye,be]}),t[84]=ve,t[85]=ye,t[86]=be,t[87]=xe):xe=t[87],xe}var Ke={version:1,domains:[],taskTypes:[],inputKinds:[],outputKinds:[],specialties:[],examples:[],limitations:[]},qe=`mt-1.5 w-full rounded-xl border border-edge bg-surface-base px-3 py-2 text-sm text-fg outline-none focus:border-accent`,Je=e=>e.split(`
|
|
67
67
|
`).map(e=>e.trim()).filter(Boolean);function Ye(e){let t=(0,Z.c)(21),{value:n,label:r,hint:i,onChange:a,max:o}=e,s;t[0]===n?s=t[1]:(s=n.join(`
|
|
68
68
|
`),t[0]=n,t[1]=s);let[c,l]=(0,X.useState)(s),u,d;t[2]!==c||t[3]!==n?(u=()=>{JSON.stringify(Je(c))!==JSON.stringify(n)&&l(n.join(`
|
|
69
69
|
`))},d=[n,c],t[2]=c,t[3]=n,t[4]=u,t[5]=d):(u=t[4],d=t[5]),(0,X.useEffect)(u,d);let f;t[6]===a?f=t[7]:(f=e=>{l(e.target.value),a(Je(e.target.value))},t[6]=a,t[7]=f);let p;t[8]!==i||t[9]!==f||t[10]!==c?(p=(0,Q.jsx)(`textarea`,{rows:3,className:qe,value:c,placeholder:i,onChange:f}),t[8]=i,t[9]=f,t[10]=c,t[11]=p):p=t[11];let m;t[12]===c?m=t[13]:(m=Je(c),t[12]=c,t[13]=m);let h;t[14]!==o||t[15]!==m.length?(h=(0,Q.jsxs)(`span`,{className:`text-xs text-fg-subtle`,children:[m.length,`/`,o]}),t[14]=o,t[15]=m.length,t[16]=h):h=t[16];let g;return t[17]!==r||t[18]!==p||t[19]!==h?(g=(0,Q.jsxs)(`label`,{className:`text-xs font-medium text-fg-muted`,children:[r,p,h]}),t[17]=r,t[18]=p,t[19]=h,t[20]=g):g=t[20],g}var Xe={general:`通用`,coordination:`协调`,software:`软件开发`,writing:`写作`,research:`研究`,data:`数据`,design:`设计`,operations:`运营`,general_assistance:`日常协助`,task_planning:`任务规划`,bug_fix:`修复 Bug`,implementation:`功能开发`,code_review:`代码审查`,editing:`编辑润色`,news_research:`新闻研究`,data_analysis:`数据分析`,data_cleaning:`数据清洗`,image_generation:`生成图片`,automation:`自动化`,text:`文本`,repository:`代码仓库`,csv:`CSV`,spreadsheet:`电子表格`,web_page:`网页`,image:`图片`,answer:`回答`,plan:`计划`,code_patch:`代码修改`,document:`文档`,report:`报告`,chart:`图表`,script:`脚本`,design_brief:`设计说明`};function Ze(e){let t=(0,Z.c)(48),{field:n,value:r,label:i,zh:a,onChange:o}=e,s=I[n],c;if(t[0]!==r||t[1]!==s){let e;t[3]===s?e=t[4]:(e=e=>!s.includes(e),t[3]=s,t[4]=e),c=r.filter(e),t[0]=r,t[1]=s,t[2]=c}else c=t[2];let l=c,u;t[5]===a?u=t[6]:(u=e=>a?Xe[e]??e:e.replaceAll(`_`,` `),t[5]=a,t[6]=u);let d=u,f;t[7]!==d||t[8]!==r||t[9]!==a?(f=r.length?r.map(d).join(` · `):a?`选择适用项`:`Select applicable items`,t[7]=d,t[8]=r,t[9]=a,t[10]=f):f=t[10];let p;t[11]===f?p=t[12]:(p=(0,Q.jsx)(`span`,{className:`mt-1 block text-xs font-normal text-fg-muted`,children:f}),t[11]=f,t[12]=p);let m;t[13]!==i||t[14]!==p?(m=(0,Q.jsxs)(`summary`,{className:`cursor-pointer text-sm font-medium text-fg`,children:[i,p]}),t[13]=i,t[14]=p,t[15]=m):m=t[15];let h;if(t[16]!==d||t[17]!==r||t[18]!==s){let e;t[20]!==d||t[21]!==r?(e=e=>({value:e,label:d(e),disabled:r.length>=16&&!r.includes(e)}),t[20]=d,t[21]=r,t[22]=e):e=t[22],h=s.map(e),t[16]=d,t[17]=r,t[18]=s,t[19]=h}else h=t[19];let g;t[23]!==i||t[24]!==o||t[25]!==h||t[26]!==r?(g=(0,Q.jsx)(v,{options:h,values:r,multiple:!0,ariaLabel:i,onChange:o}),t[23]=i,t[24]=o,t[25]=h,t[26]=r,t[27]=g):g=t[27];let _=a?`自定义标识`:`Custom identifiers`,y;t[28]===_?y=t[29]:(y=(0,Q.jsx)(`summary`,{className:`cursor-pointer text-xs text-fg-muted`,children:_}),t[28]=_,t[29]=y);let b=a?`其他标识`:`Other identifiers`,x=a?`每行一个英文标识`:`One identifier per line`,S;t[30]!==o||t[31]!==r||t[32]!==s?(S=e=>o([...new Set([...r.filter(e=>s.includes(e)),...e])]),t[30]=o,t[31]=r,t[32]=s,t[33]=S):S=t[33];let C;t[34]!==l||t[35]!==b||t[36]!==x||t[37]!==S?(C=(0,Q.jsx)(Ye,{value:l,label:b,hint:x,max:16,onChange:S}),t[34]=l,t[35]=b,t[36]=x,t[37]=S,t[38]=C):C=t[38];let w;t[39]!==C||t[40]!==y?(w=(0,Q.jsxs)(`details`,{children:[y,C]}),t[39]=C,t[40]=y,t[41]=w):w=t[41];let T;t[42]!==w||t[43]!==g?(T=(0,Q.jsxs)(`div`,{className:`mt-3 space-y-3`,children:[g,w]}),t[42]=w,t[43]=g,t[44]=T):T=t[44];let E;return t[45]!==T||t[46]!==m?(E=(0,Q.jsxs)(`details`,{className:`min-w-0 rounded-xl border border-edge p-3`,children:[m,T]}),t[45]=T,t[46]=m,t[47]=E):E=t[47],E}function Qe(e){let t=(0,Z.c)(45),{profile:n,zh:r,onChange:i}=e,a=r?`领域`:`Domains`,o;t[0]===a?o=t[1]:(o=[`domains`,a,`software
|
|
@@ -1,2 +1,2 @@
|
|
|
1
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{t as e}from"./preload-helper-Czpn1I53.js";import{i as t,o as n}from"./locale-store-
|
|
2
|
+
import{t as e}from"./preload-helper-Czpn1I53.js";import{i as t,o as n}from"./locale-store-B6OrWgY1.js";import{n as r}from"./gateway-config-swr-D6cc6W6E.js";async function i(){let e=await n(t(`/api/agents`));if(!e.payload?.defaultId||!Array.isArray(e.payload.agents))throw Error(`Invalid /api/agents response`);return e.payload}async function a(e){let r=await n(t(`/api/agents/${encodeURIComponent(e)}/effective-config`));if(!r.payload?.config||!r.payload.sources)throw Error(`Invalid effective agent config response`);return r.payload}async function o(t){let{mutate:n}=await e(async()=>{let{mutate:e}=await import(`./vendor-swr-CdRzEUwF.js`).then(e=>e.r);return{mutate:e}},__vite__mapDeps([0,1,2]));await Promise.all([n(`settings-gateway-agents`,t,{revalidate:!1}),n(`setup-checklist-agents`,t,{revalidate:!1}),r()])}async function s(e){let r=await n(t(`/api/agents`),{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)});if(!r.payload?.agentId||!r.payload.agents)throw Error(`Invalid create agent response`);return await o(r.payload.agents),{...r.payload.agents,createdAgentId:r.payload.agentId}}async function c(e,r){let i=await n(t(`/api/agents/${encodeURIComponent(e)}`),{method:`PATCH`,headers:{"Content-Type":`application/json`},body:JSON.stringify(r)});if(!i.payload)throw Error(`Invalid update agent response`);return await o(i.payload),i.payload}async function l(e,r){await n(t(`/api/agents/${encodeURIComponent(e)}/avatar`),{method:`PUT`,body:JSON.stringify({base64:r.base64,mimeType:r.mimeType})})}async function u(e,r=!1){let i=await n(t(`/api/agents/${encodeURIComponent(e)}${r?`?purge=1`:``}`),{method:`DELETE`});if(!i.payload?.agents)throw Error(`Invalid delete agent response`);return await o(i.payload.agents),i.payload.agents}async function d(e){let r=(await n(t(`/api/agents/${encodeURIComponent(e)}/files`))).payload,i=typeof r?.profileDir==`string`?r.profileDir.trim():``;if(!r?.files||!i)throw Error(`Invalid agent profile files response`);return{agentId:r.agentId,profileDir:i,files:r.files}}async function f(e,r){let i=(await n(t(`/api/agents/${encodeURIComponent(e)}/files/${encodeURIComponent(r)}`))).payload?.content;if(typeof i!=`string`)throw Error(`Invalid agent profile file response`);return i}async function p(e,r,i){await n(t(`/api/agents/${encodeURIComponent(e)}/files/${encodeURIComponent(r)}`),{method:`PUT`,headers:{"Content-Type":`application/json`},body:JSON.stringify({content:i})})}export{a,c,d as i,l,u as n,i as o,f as r,p as s,s as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{i as e,o as t}from"./locale-store-
|
|
1
|
+
import{i as e,o as t}from"./locale-store-B6OrWgY1.js";async function n(){return(await t(e(`/api/local-apps`))).apps}async function r(n){return(await t(e(`/api/local-apps/${encodeURIComponent(n)}`))).app}async function i(n){return(await t(e(`/api/local-apps/${encodeURIComponent(n)}/validate`),{method:`POST`})).validation}async function a(n,r){return(await t(e(`/api/local-apps/${encodeURIComponent(n)}/snapshots/${encodeURIComponent(r)}`))).snapshot}async function o(n,r){return(await t(e(`/api/local-apps/${encodeURIComponent(n)}/fix-guidance`),{method:`POST`,body:JSON.stringify(r)})).guidance}async function s(n,r,i){return(await t(e(`/api/local-apps/${encodeURIComponent(n)}/acceptance-runs`),{method:`POST`,body:JSON.stringify({sourceHash:r,...i})})).acceptance}async function c(n){return(await t(e(`/api/local-apps`),{method:`POST`,body:JSON.stringify(n)})).app}async function l(n){return(await t(e(`/api/local-apps/${encodeURIComponent(n)}/install`),{method:`POST`})).app}async function u(n,r){return(await t(e(`/api/local-apps/${encodeURIComponent(n)}/releases/${encodeURIComponent(r)}/rollback`),{method:`POST`})).app}async function d(n,r){return(await t(e(`/api/local-apps/${encodeURIComponent(n)}/${r?`enable`:`disable`}`),{method:`POST`})).app}async function f(n){return(await t(e(`/api/local-apps/${encodeURIComponent(n)}/install`),{method:`DELETE`})).app}export{l as a,u as c,i as d,a as i,d as l,r as n,n as o,o as r,s,c as t,f as u};
|