@vellumai/web 0.12.5-staging.2 → 0.12.5
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/assets/{a2a-invite-2n6gRbID.js → a2a-invite-2DFcr5cK.js} +1 -1
- package/dist/assets/{about-page-N1N2ME9b.js → about-page-CPNBbifd.js} +1 -1
- package/dist/assets/{account-page-DOnTpuZ-.js → account-page-CJ_VtU8O.js} +1 -1
- package/dist/assets/{account-shell-CDePfCVi.js → account-shell-DxLEvbei.js} +1 -1
- package/dist/assets/{acp-run-detail-panel-B3R4i5mk.js → acp-run-detail-panel-CB_kEsnS.js} +1 -1
- package/dist/assets/{activation-list-route-CHvtTpMz.js → activation-list-route-CGW4JxwN.js} +1 -1
- package/dist/assets/{activity-redirect-page-CTTRdkxc.js → activity-redirect-page-BIjoWTCA.js} +1 -1
- package/dist/assets/{activity-steps-panel-DR0Y2oZk.js → activity-steps-panel-DMQrQxtA.js} +1 -1
- package/dist/assets/add-credits-modal-Dv7XHwyy.js +1 -0
- package/dist/assets/{add-credits-modal-Bf3UIKWo.js → add-credits-modal-LuPOq4kF.js} +1 -1
- package/dist/assets/{ai-page-nn0k_IIb.js → ai-page-BYnMIWGK.js} +1 -1
- package/dist/assets/{all-chats-page-route-CPhckAtu.js → all-chats-page-route-nS138Vap.js} +1 -1
- package/dist/assets/{android-billing-handoff-Bdbyo5OG.js → android-billing-handoff-Q1a-ZHj3.js} +1 -1
- package/dist/assets/{animated-stat-square-C1mgqXq8.js → animated-stat-square--YG74D1T.js} +1 -1
- package/dist/assets/{api-key-screen-BRkuexDs.js → api-key-screen-CYEJaUQl.js} +1 -1
- package/dist/assets/app-Dy5YEvtr.css +2 -0
- package/dist/assets/{app-g1TvV-Dl.js → app-XG_RF2yi.js} +55 -55
- package/dist/assets/{app-info-R4Y_BPoT.js → app-info-zQFV6PZi.js} +1 -1
- package/dist/assets/{archive-redirect-page-Cb4LdH50.js → archive-redirect-page-DQbvA1Z-.js} +1 -1
- package/dist/assets/{assistant-handle-modal-BQBleuWg.js → assistant-handle-modal-CbatcZHT.js} +1 -1
- package/dist/assets/{assistant-inbox-page-route-CWQiF8gx.js → assistant-inbox-page-route-CxI0ViyX.js} +1 -1
- package/dist/assets/{assistant-inbox-upgrade-body-D3qYrXZU.js → assistant-inbox-upgrade-body-UUuOySwQ.js} +1 -1
- package/dist/assets/{assistant-status-panel-Dz8eNfbE.js → assistant-status-panel-Db_tR-He.js} +1 -1
- package/dist/assets/auth-store-CpGZaJMT.js +1 -0
- package/dist/assets/{auth-welcome-screen-CYoMdZVW.js → auth-welcome-screen-CCmw8K2q.js} +1 -1
- package/dist/assets/avatar-bundled-components-BOhrT2YY.js +1 -0
- package/dist/assets/{avatar-random-7_b8sN9c.js → avatar-random-ChM4pm8c.js} +2 -2
- package/dist/assets/{await-org-header-settled-BaNRynwI.js → await-org-header-settled-D7gXGNkp.js} +1 -1
- package/dist/assets/{background-task-detail-panel-DyQHMRcX.js → background-task-detail-panel-BfpAZAV7.js} +1 -1
- package/dist/assets/billing-page-D4Aw0uK5.js +3 -0
- package/dist/assets/{billing-redirect-page-DisLOg_5.js → billing-redirect-page-CPoe8Fxo.js} +1 -1
- package/dist/assets/{bookmarks-page-CaKBt1k4.js → bookmarks-page-DabizPXt.js} +1 -1
- package/dist/assets/{bundle-confirm-page-W2r6YW2S.js → bundle-confirm-page--s00f5SK.js} +1 -1
- package/dist/assets/{channel-transcript-panel-DjZfVDU6.js → channel-transcript-panel-kIskgOQO.js} +1 -1
- package/dist/assets/{channels-page-route-fjQyOftI.js → channels-page-route-DBYtimrU.js} +1 -1
- package/dist/assets/{chat-info-panel-CQwSB97L.js → chat-info-panel-C8-aLnsR.js} +1 -1
- package/dist/assets/{checkout-continuation-CGCnWbzu.js → checkout-continuation-DV6qqLmB.js} +1 -1
- package/dist/assets/{checkout-page-DoYMFyd4.js → checkout-page-CDszxDKy.js} +1 -1
- package/dist/assets/checkout-return-target-kOAtAdtD.js +1 -0
- package/dist/assets/{command-palette-D0KYxCnU.js → command-palette-CvSDYYKx.js} +1 -1
- package/dist/assets/{command-palette-window-page-BTVDAM95.js → command-palette-window-page-vfJ8M15E.js} +1 -1
- package/dist/assets/command-palette-xzqumNt2.js +1 -0
- package/dist/assets/{community-page--2IpZpKw.js → community-page-Dnrsh7JC.js} +1 -1
- package/dist/assets/{companion-accent-CBLb9Kpv.js → companion-accent-CbS8BVae.js} +1 -1
- package/dist/assets/{companion-dock-zones-page-DxuMrFf9.js → companion-dock-zones-page-CRsK4Pv9.js} +1 -1
- package/dist/assets/{companion-layout-C6tp_Wvl.js → companion-layout-DCGXuvsw.js} +1 -1
- package/dist/assets/{companion-popover-B7KpH4N8.js → companion-popover-BsoxqJOP.js} +1 -1
- package/dist/assets/{companion-popover-page-YQKBZlNX.js → companion-popover-page-B-tbPgw2.js} +1 -1
- package/dist/assets/{companion-surface-DM4lsh7V.js → companion-surface-Lu_Uj_QW.js} +1 -1
- package/dist/assets/{companion-surface-page-BvvOIZO_.js → companion-surface-page-Cu5KYGHm.js} +1 -1
- package/dist/assets/{companion-tour-entry-BBJtal5R.js → companion-tour-entry-C3txdrPi.js} +1 -1
- package/dist/assets/{companion-watch-frame-page-D_cml_5E.js → companion-watch-frame-page-CxWQHVyd.js} +1 -1
- package/dist/assets/{connect-page-De9qYGFr.js → connect-page-BnIPLsIl.js} +1 -1
- package/dist/assets/{consent-controls-gxLFaZqC.js → consent-controls-CzokWb_V.js} +1 -1
- package/dist/assets/{contacts-gateway-xRhaWZVq.js → contacts-gateway-CXKsci-d.js} +1 -1
- package/dist/assets/{contacts-page-route-DuAdAqXe.js → contacts-page-route-rxGvMBYc.js} +1 -1
- package/dist/assets/{copy-button-DUDzh1nb.js → copy-button-CDraE4Q7.js} +1 -1
- package/dist/assets/{credential-entry-page-DMfgwRck.js → credential-entry-page-CISniD8g.js} +1 -1
- package/dist/assets/{credentials-page-CMgmkOGd.js → credentials-page-CY8AWXDI.js} +1 -1
- package/dist/assets/{csv-preview-CQY-2Dx9.js → csv-preview-CIYuh6hO.js} +1 -1
- package/dist/assets/{danger-zone-redirect-page-yy5xW0mL.js → danger-zone-redirect-page-CvReBloK.js} +1 -1
- package/dist/assets/{debug-page-BU3-JUrT.js → debug-page-Bi_rgZ5l.js} +1 -1
- package/dist/assets/deploy-dialogs-C2piFvJp.js +1 -0
- package/dist/assets/{deploy-dialogs-Daud7Ibu.js → deploy-dialogs-HsxdyBbf.js} +1 -1
- package/dist/assets/{desktop-preview-content-Cg0mJFW9.js → desktop-preview-content-CV1cf7mU.js} +2 -2
- package/dist/assets/{desktop-status-DGbF0l_T.js → desktop-status-DEExfNSz.js} +1 -1
- package/dist/assets/{desktop-viewer-ClERTjPw.js → desktop-viewer-D7Wghl4J.js} +1 -1
- package/dist/assets/{detail-card-uV-Fvv0m.js → detail-card-C7tTQwmv.js} +1 -1
- package/dist/assets/{detail-panel-stop-button-CpIFrlAa.js → detail-panel-stop-button-DnqOX8hL.js} +1 -1
- package/dist/assets/{detail-primitives-BVAXXLTM.js → detail-primitives-wlzeidYY.js} +1 -1
- package/dist/assets/{developer-page-C2US1ngx.js → developer-page-BCRjXz1c.js} +1 -1
- package/dist/assets/{devices-redirect-page-C6LAvhsi.js → devices-redirect-page-7ye90eAr.js} +1 -1
- package/dist/assets/{dictation-overlay-page-4Ws_3jMt.js → dictation-overlay-page-DOBCTXi_.js} +1 -1
- package/dist/assets/{document-load-Bc7bzEgK.js → document-load-C2pkXMId.js} +1 -1
- package/dist/assets/document-load-D-wTWGym.js +1 -0
- package/dist/assets/{document-viewer-page-rYlc99qC.js → document-viewer-page-DOzOlaOx.js} +1 -1
- package/dist/assets/{emails-page-BoKSj0Bi.js → emails-page-BcGsKx08.js} +1 -1
- package/dist/assets/{file-diff-view-D4vpp28T.js → file-diff-view-Cl9aJla4.js} +1 -1
- package/dist/assets/{file-view-mode-CFTpeJXr.js → file-view-mode-B1UgDONH.js} +1 -1
- package/dist/assets/{general-page-CCuGQaED.js → general-page-D5BxF2Og.js} +1 -1
- package/dist/assets/{hatching-screen-DlG-aMJX.js → hatching-screen-6FiOHAnm.js} +1 -1
- package/dist/assets/{hosting-screen-COVzfBVx.js → hosting-screen-CYbWPSH7.js} +1 -1
- package/dist/assets/{identity-page-route-9SdenOmX.js → identity-page-route-B7hLB4vt.js} +1 -1
- package/dist/assets/{inspect-page-9FD0Y4Wu.js → inspect-page-Q3Uns0YC.js} +3 -3
- package/dist/assets/{integrations-page-CXrP8dj3.js → integrations-page-C--xdzQF.js} +1 -1
- package/dist/assets/{intelligence-layout-_R-R-8WX.js → intelligence-layout-5NiOjPJY.js} +1 -1
- package/dist/assets/{intelligence-layout-slots-store-DfpF-AiU.js → intelligence-layout-slots-store-DTzofJ6x.js} +1 -1
- package/dist/assets/{keyboard-shortcuts-redirect-page-CD21JSvn.js → keyboard-shortcuts-redirect-page-BXubnemT.js} +1 -1
- package/dist/assets/{latest-assistant-text-D5_fKeDo.js → latest-assistant-text-C5_QcZxG.js} +1 -1
- package/dist/assets/{library-detail-page-DG-7BXZ4.js → library-detail-page-lz31jiv2.js} +1 -1
- package/dist/assets/{library-page-DRUkvK5M.js → library-page-Cqt_PX2Z.js} +1 -1
- package/dist/assets/local-mode-BdKYdq-q.js +1 -0
- package/dist/assets/{login-page-BqaYnqWg.js → login-page-BcSmXRpH.js} +1 -1
- package/dist/assets/{logout-page-C6QRRvol.js → logout-page-BiLyA8KS.js} +1 -1
- package/dist/assets/{logs-layout-CgZTvfsn.js → logs-layout-DtEdDxuo.js} +1 -1
- package/dist/assets/{markdown-preview-CjIFQp7z.js → markdown-preview-BZ0peNgQ.js} +1 -1
- package/dist/assets/{media-preview-CQ5_mth7.js → media-preview-WLwNLylQ.js} +1 -1
- package/dist/assets/{memory-page-route-CMctq-2Y.js → memory-page-route-ULkaZxE1.js} +1 -1
- package/dist/assets/{memory-router-playground-page-dreB6wRu.js → memory-router-playground-page-BW7vZW_9.js} +1 -1
- package/dist/assets/{message-files-panel-CDRctrdn.js → message-files-panel-CjeAStji.js} +1 -1
- package/dist/assets/native-attachment-pickers-DyuoT-EL.js +1 -0
- package/dist/assets/native-file-xbQpY6mL.js +1 -0
- package/dist/assets/{notifications-page-u4JixJTc.js → notifications-page-CJRzep02.js} +1 -1
- package/dist/assets/{oauth-complete-page-C9Yh4aN1.js → oauth-complete-page-ocdI_rC8.js} +1 -1
- package/dist/assets/{oauth-popup-complete-page-T4U79Q12.js → oauth-popup-complete-page-HK8d4Spc.js} +1 -1
- package/dist/assets/paired-platform-identity-BPPyfzDM.js +1 -0
- package/dist/assets/{pairing-page-CmjjyJSK.js → pairing-page-DnBwkmV0.js} +1 -1
- package/dist/assets/password-reset-page-B6LfA1PC.js +1 -0
- package/dist/assets/{pdf-file-preview-BV59QVcL.js → pdf-file-preview-BICwIHq3.js} +1 -1
- package/dist/assets/{permission-guide-page-Zb7kuXV2.js → permission-guide-page-z6AAkvY2.js} +1 -1
- package/dist/assets/{permission-setup-D8C_-pLn.js → permission-setup-DQzKLhBn.js} +1 -1
- package/dist/assets/{personality-page-Bl2WDg64.js → personality-page-CKLYnk7H.js} +1 -1
- package/dist/assets/{personality-page-Cl6IWyFN.js → personality-page-CzJKC8lv.js} +1 -1
- package/dist/assets/{personality-sliders-CHGQlasL.js → personality-sliders-Dd3JGL5I.js} +1 -1
- package/dist/assets/{plans-page-CX_DS3pd.js → plans-page-DDs81rnq.js} +1 -1
- package/dist/assets/{platform-loopback-page-BbAZA0xo.js → platform-loopback-page-BC5gtTbI.js} +1 -1
- package/dist/assets/{plugin-detail-page-Y171rg5Z.js → plugin-detail-page-Dre4KSYH.js} +1 -1
- package/dist/assets/{plugins-page-7JFDRd3d.js → plugins-page-BJhR5JYi.js} +1 -1
- package/dist/assets/plugins-surface-B99o65kn.js +1 -0
- package/dist/assets/{preview-error-DRiLBVjC.js → preview-error-BSpmr-KH.js} +1 -1
- package/dist/assets/{privacy-page-BbzNYunu.js → privacy-page-BUf0Wrj1.js} +1 -1
- package/dist/assets/{privacy-screen-DRWTgt4o.js → privacy-screen-CRkWqj_4.js} +1 -1
- package/dist/assets/{profile-card-BUk3o7SO.js → profile-card-BDi2Aa7O.js} +1 -1
- package/dist/assets/{provider-callback-page-4eckbJpB.js → provider-callback-page-xSMG5fuv.js} +1 -1
- package/dist/assets/{provider-key-CJJJNyHJ.js → provider-key-CY2sGv7V.js} +1 -1
- package/dist/assets/{provider-signup-page-DEgiOj-f.js → provider-signup-page-CYvh6GNB.js} +1 -1
- package/dist/assets/{quick-input-page-DaqK2hi0.js → quick-input-page-Lfrb-P2b.js} +1 -1
- package/dist/assets/referral-modal--kTnJAWn.js +1 -0
- package/dist/assets/{referral-modal-IFQp20cn.js → referral-modal-Bk5N1oeX.js} +1 -1
- package/dist/assets/{research-mock-page-C9fb3mU6.js → research-mock-page-BdpSM2ZV.js} +1 -1
- package/dist/assets/{research-onboarding-route-Cm8d8gDB.js → research-onboarding-route-DLbIS8Fh.js} +1 -1
- package/dist/assets/{review-terms-screen-DMQInhYK.js → review-terms-screen-DXYmPnS3.js} +1 -1
- package/dist/assets/routes-CJexmSc5.js +1 -0
- package/dist/assets/{schedules--58e813j.js → schedules-B_xQSD0K.js} +1 -1
- package/dist/assets/{schedules-page-B6cSKNVA.js → schedules-page--mjVQq8F.js} +1 -1
- package/dist/assets/{security-redirect-page-BP_ofq6j.js → security-redirect-page-CJJqdMen.js} +1 -1
- package/dist/assets/{select-assistant-screen-BG3K7gmK.js → select-assistant-screen-CWrLBgEC.js} +1 -1
- package/dist/assets/{self-hosted-servers-BWwS6drJ.js → self-hosted-servers-ByTPcaPx.js} +1 -1
- package/dist/assets/{service-form-controls-DdqTR20W.js → service-form-controls-DtPD00wU.js} +1 -1
- package/dist/assets/{setting-row-DUPI2E5K.js → setting-row-CaZDTGD2.js} +1 -1
- package/dist/assets/settings-CF0G96O8.js +3 -0
- package/dist/assets/settings-D9aUsORh.js +3 -0
- package/dist/assets/{settings-Bxxp6jKc.js → settings-XqI4_biG.js} +1 -1
- package/dist/assets/{settings-layout-Bwhzzkgd.js → settings-layout-DNdADVFk.js} +1 -1
- package/dist/assets/{settings-B267Hpr6.js → settings-ooHvceam.js} +1 -1
- package/dist/assets/{share-feedback-modal-dOu0B-Md.js → share-feedback-modal-BcKnGtHL.js} +1 -1
- package/dist/assets/share-feedback-modal-DF6Y_Ddr.js +1 -0
- package/dist/assets/{sidebar-tree-EIcBry0H.js → sidebar-tree-BTeywUnh.js} +1 -1
- package/dist/assets/{signup-page-iMX6V56Q.js → signup-page-C3giBlX2.js} +1 -1
- package/dist/assets/{signup-shell-DE0anhe6.js → signup-shell-GSIPLhaj.js} +1 -1
- package/dist/assets/{skill-detail-page-DY4PImw4.js → skill-detail-page-Deqf_hR_.js} +1 -1
- package/dist/assets/{skill-detail-panel-C5ehfnq7.js → skill-detail-panel-Dxor1hrH.js} +1 -1
- package/dist/assets/{skill-removal-dialog-BUKv2Tas.js → skill-removal-dialog-BT--h1By.js} +1 -1
- package/dist/assets/{skills-page-D0nQMb4s.js → skills-page-KhBWpqn3.js} +1 -1
- package/dist/assets/{sounds-page-BHxwlTqF.js → sounds-page-DTRSATq6.js} +1 -1
- package/dist/assets/{start-screen-BNWpr3jU.js → start-screen-xL6YeEfA.js} +1 -1
- package/dist/assets/{step-detail-header-B4fNZIZg.js → step-detail-header-q2pswG-E.js} +1 -1
- package/dist/assets/{stt-language-picker-modal-DfBKJmLh.js → stt-language-picker-modal-oMpmGSKQ.js} +1 -1
- package/dist/assets/{subagent-detail-panel-ByW7jl3W.js → subagent-detail-panel-BbfzXdX1.js} +1 -1
- package/dist/assets/{superpowers-page-D_RuLpvG.js → superpowers-page-Bew1AAic.js} +1 -1
- package/dist/assets/{system-events-page-C7X57xA5.js → system-events-page-CyvA59Rb.js} +1 -1
- package/dist/assets/{system-events-redirect-page-CTGlRdMz.js → system-events-redirect-page-BlGZqWyR.js} +1 -1
- package/dist/assets/{teleport-gateway-client-B-Ymh7N4.js → teleport-gateway-client-ZoYt4yRw.js} +1 -1
- package/dist/assets/{text-preview-DXRIEUbr.js → text-preview-C4goqoCR.js} +1 -1
- package/dist/assets/{theme-stage-page-T1E0J2aJ.js → theme-stage-page-wBctgsW9.js} +1 -1
- package/dist/assets/{tiptap-document-editor-DqmlydKI.js → tiptap-document-editor-9k3KCMGt.js} +1 -1
- package/dist/assets/tool-detail-panel-BXJOMwEr.js +1 -0
- package/dist/assets/{tool-detail-panel-Cy_HQVT-.js → tool-detail-panel-D3kcmDuC.js} +1 -1
- package/dist/assets/{trait-cycle-row-BNqcZU0H.js → trait-cycle-row-Bj1z4vx9.js} +1 -1
- package/dist/assets/{upgrade-cancel-page-BH0iigJ_.js → upgrade-cancel-page-B8aHpJFd.js} +1 -1
- package/dist/assets/{upgrade-success-page-CQTTbbGB.js → upgrade-success-page-Dj6egC1G.js} +1 -1
- package/dist/assets/{usage-redirect-page-4wBYE6Hz.js → usage-redirect-page-Cc7zOqgH.js} +1 -1
- package/dist/assets/{use-app-delete-BqUAzWOi.js → use-app-delete-S-DdyUwn.js} +1 -1
- package/dist/assets/{use-assistant-identity-details-DsO3-hL9.js → use-assistant-identity-details-DT3Hy4pf.js} +1 -1
- package/dist/assets/{use-checkout-dismiss-refresh-DpbPh5Dv.js → use-checkout-dismiss-refresh-DV7QRuSY.js} +1 -1
- package/dist/assets/{use-edge-swipe-back-C_dV-uDl.js → use-edge-swipe-back-BCvtCYFp.js} +1 -1
- package/dist/assets/{use-hotkey-recorder-DSplqHTv.js → use-hotkey-recorder-BIhIsp-5.js} +1 -1
- package/dist/assets/{use-invite-link-dialog-BbFm0xLB.js → use-invite-link-dialog-DQEUmYHq.js} +1 -1
- package/dist/assets/{use-plugins-list-v7ZdJF5y.js → use-plugins-list-DPWrP6Mv.js} +1 -1
- package/dist/assets/{use-return-to-short-circuit-e_HCiNdS.js → use-return-to-short-circuit-BVGVwuLm.js} +1 -1
- package/dist/assets/{use-side-list-room-CJYjHQez.js → use-side-list-room-DH5gDKs9.js} +1 -1
- package/dist/assets/{use-skill-actions-U5IaZ-Z1.js → use-skill-actions-CMoU5oFT.js} +1 -1
- package/dist/assets/{use-skill-detail-files-B2ECj0iR.js → use-skill-detail-files-19-kefs2.js} +1 -1
- package/dist/assets/use-supports-credentials-settings-Bq2yot1y.js +1 -0
- package/dist/assets/{use-transcript-message-by-id-De7Rp17U.js → use-transcript-message-by-id-KYGOx3D6.js} +1 -1
- package/dist/assets/{voice-page-CUNQ2QJA.js → voice-page-Cuy1oc6q.js} +1 -1
- package/dist/assets/{wake-detail-panel-BouMf1FM.js → wake-detail-panel-B6BImUJo.js} +1 -1
- package/dist/assets/{weather-forecast-display-Ea8cYhbQ.js → weather-forecast-display-BvUd--wf.js} +1 -1
- package/dist/assets/{welcome-screen-Bh45FGdD.js → welcome-screen-CtVGX2aV.js} +1 -1
- package/dist/assets/{workflow-detail-panel-BfplcjXd.js → workflow-detail-panel-DMYrbO29.js} +1 -1
- package/dist/assets/{workspace-page-Cn3iFJgb.js → workspace-page-DPWYRJjr.js} +1 -1
- package/dist/index.html +2 -2
- package/package.json +1 -1
- package/dist/assets/add-credits-modal-CjhPCEo3.js +0 -1
- package/dist/assets/app-hw35VYTL.css +0 -2
- package/dist/assets/auth-store-B_1Y9Uid.js +0 -1
- package/dist/assets/avatar-bundled-components-5UFPY9JK.js +0 -1
- package/dist/assets/billing-page-JaprT6Vv.js +0 -3
- package/dist/assets/checkout-return-target-D5A2Rv1t.js +0 -1
- package/dist/assets/command-palette-Lr-NeDCr.js +0 -1
- package/dist/assets/deploy-dialogs-BaSfIbBO.js +0 -1
- package/dist/assets/document-load-CD-0uWA-.js +0 -1
- package/dist/assets/local-mode-CP6E3D3e.js +0 -1
- package/dist/assets/native-attachment-pickers-DGHZuGbD.js +0 -1
- package/dist/assets/native-file-DxOOIrLm.js +0 -1
- package/dist/assets/paired-platform-identity-X_FlXunr.js +0 -1
- package/dist/assets/password-reset-page-CDmQuW9S.js +0 -1
- package/dist/assets/plugins-surface-DAYezPv6.js +0 -1
- package/dist/assets/referral-modal-8IXUqxso.js +0 -1
- package/dist/assets/routes-CkL6GgBk.js +0 -1
- package/dist/assets/settings-Clb97agh.js +0 -3
- package/dist/assets/settings-o6cuYhH5.js +0 -3
- package/dist/assets/share-feedback-modal-fY8BlOwK.js +0 -1
- package/dist/assets/tool-detail-panel-Dqa39U7-.js +0 -1
- package/dist/assets/use-supports-credentials-settings-CMhSepvQ.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{mS as e}from"./app-
|
|
1
|
+
import{mS as e}from"./app-XG_RF2yi.js";function t(t){let n=typeof window<`u`?window.location.origin:``,r=new URLSearchParams({senderAssistantId:t.senderAssistantId,token:t.token});return`${n}${e.connect}?${r.toString()}`}function n(e){let t=e.get(`senderAssistantId`)?.trim(),n=e.get(`token`)?.trim();return!t||!n?null:{senderAssistantId:t,token:n}}export{n,t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{o as e}from"./rolldown-runtime-BM3Ffeng.js";import{WC as t,bC as n,hS as r,kg as i}from"./app-
|
|
1
|
+
import{o as e}from"./rolldown-runtime-BM3Ffeng.js";import{WC as t,bC as n,hS as r,kg as i}from"./app-XG_RF2yi.js";import{E as a}from"./vendor-DwMhK7fD.js";import{t as o,x as s}from"./react-B9IgSVeK.js";import{n as c,t as l}from"./app-info-zQFV6PZi.js";var u=e(s(),1),d=o();function f(){let{t:e}=a(),o=i(),[s,f]=(0,u.useState)(null);(0,u.useEffect)(()=>{l().then(f)},[]);let m=s??p;return(0,d.jsxs)(`div`,{className:`flex h-svh w-screen flex-col items-center justify-center bg-background px-8 pt-14 pb-8 text-center text-foreground select-none`,children:[(0,d.jsx)(`h1`,{className:`mt-4 text-2xl font-semibold`,children:m.appName}),(0,d.jsx)(`p`,{className:`text-muted-foreground mt-1 mb-7 text-xs`,children:e(o===`windows`?`aboutPage.taglineWindows`:`aboutPage.taglineMacOS`)}),(0,d.jsxs)(`dl`,{className:`mb-7 grid grid-cols-[auto_auto] gap-x-4 gap-y-1.5 text-sm`,children:[(0,d.jsx)(`dt`,{className:`text-muted-foreground text-right`,children:e(`aboutPage.version`)}),(0,d.jsx)(`dd`,{className:`text-left font-mono tabular-nums select-text`,children:m.version}),(0,d.jsx)(`dt`,{className:`text-muted-foreground text-right`,children:e(`aboutPage.build`)}),(0,d.jsx)(`dd`,{className:`text-left font-mono tabular-nums select-text`,children:m.commitSha})]}),(0,d.jsx)(`a`,{href:m.website,className:t(n(),`text-sm`),onClick:e=>{r()&&(e.preventDefault(),c())},children:new URL(m.website).host}),(0,d.jsx)(`div`,{className:`text-muted-foreground mt-auto pt-6 text-[11px]`,children:m.copyright})]})}var p={appName:`Vellum`,version:`—`,commitSha:`—`,copyright:`© ${new Date().getFullYear()} Vellum`,website:`https://vellum.ai`};export{f as AboutPage};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{o as e}from"./rolldown-runtime-BM3Ffeng.js";import{By as t,Qc as n,Zc as r,bh as i,hh as a,mS as o,ol as s,vh as c}from"./app-
|
|
1
|
+
import{o as e}from"./rolldown-runtime-BM3Ffeng.js";import{By as t,Qc as n,Zc as r,bh as i,hh as a,mS as o,ol as s,vh as c}from"./app-XG_RF2yi.js";import{E as l}from"./vendor-DwMhK7fD.js";import{n as u,t as d,x as f}from"./react-B9IgSVeK.js";import{r as p,t as m}from"./account-shell-DxLEvbei.js";var h=e(f(),1),g=d();function _(){let{t:e}=l(`account`),d=c(),f=i(),_=a.use.user(),v=a.use.logout(),[y,b]=(0,h.useState)(null),[x,S]=(0,h.useState)(!1),C=async()=>{b(null),S(!0);try{await t(n,r)}catch(t){console.error(`[account] auth flow failed:`,t),b(e(`authErrors.genericFailure`)),S(!1)}};return f?(0,g.jsx)(m,{children:(0,g.jsx)(p,{title:e(`accountPage.loading`)})}):d?(0,g.jsxs)(m,{children:[(0,g.jsx)(p,{title:_?.username?e(`accountPage.signedInTitleNamed`,{name:_.username}):e(`accountPage.signedInTitle`),subtitle:e(`accountPage.signedInSubtitle`)}),(0,g.jsxs)(`div`,{className:`flex flex-col items-center gap-4`,children:[(0,g.jsx)(u,{to:o.assistant,className:`inline-flex w-full items-center justify-center gap-2 rounded-lg bg-[var(--primary-base)] px-6 py-3 text-sm font-medium text-[var(--content-inset)] no-underline transition-colors hover:bg-[var(--primary-hover)]`,children:e(`accountPage.goToAssistant`)}),(0,g.jsx)(`button`,{type:`button`,onClick:async()=>{await v(),s(o.account.login)},className:`cursor-pointer bg-transparent text-sm font-normal text-[var(--content-secondary)] transition-colors hover:text-[var(--content-default)]`,children:e(`accountPage.signOut`)})]})]}):(0,g.jsxs)(m,{children:[(0,g.jsx)(p,{title:e(`accountPage.welcomeTitle`),subtitle:e(`accountPage.welcomeSubtitle`)}),y&&(0,g.jsx)(`p`,{className:`text-center text-sm text-[var(--system-negative-strong)]`,children:y}),(0,g.jsx)(`div`,{className:`flex flex-col items-center gap-4`,children:(0,g.jsx)(`button`,{type:`button`,onClick:()=>void C(),disabled:x,className:`inline-flex w-full cursor-pointer items-center justify-center gap-2 rounded-lg bg-[var(--primary-base)] px-6 py-3 text-sm font-medium text-[var(--content-inset)] transition-colors hover:bg-[var(--primary-hover)] disabled:opacity-50`,children:e(`accountPage.signIn`)})})]})}export{_ as AccountPage};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{DC as e}from"./app-
|
|
1
|
+
import{DC as e}from"./app-XG_RF2yi.js";import{t}from"./react-B9IgSVeK.js";var n=t(),r=(0,n.jsx)(`svg`,{width:`20`,height:`20`,viewBox:`0 0 20 20`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,children:(0,n.jsx)(`path`,{d:`M7.5 15L12.5 10L7.5 5`,stroke:`currentColor`,strokeWidth:`1.67`,strokeLinecap:`round`,strokeLinejoin:`round`})});function i({onSubmit:t,error:i,children:a,submitLabel:o,submittingLabel:s,isSubmitting:c,footer:l}){return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)(`form`,{onSubmit:t,className:`flex flex-col gap-4`,children:[i&&(0,n.jsx)(e,{tone:`error`,children:i}),(0,n.jsx)(`div`,{className:`flex flex-col gap-3`,children:a}),(0,n.jsxs)(`button`,{type:`submit`,disabled:c,className:`mt-2 inline-flex w-full cursor-pointer items-center justify-center gap-2 rounded-lg bg-[var(--primary-base)] px-6 py-3 text-sm font-medium text-[var(--content-inset)] transition-colors hover:bg-[var(--primary-hover)] disabled:cursor-wait disabled:opacity-50`,children:[c?s:o,r]})]}),l&&(0,n.jsx)(`div`,{className:`mt-8 text-center`,children:l})]})}function a(e){return(0,n.jsx)(`input`,{...e,className:`w-full rounded-lg border border-[var(--border-base)] bg-[var(--surface-overlay)] px-4 py-3 text-sm text-[var(--content-default)] outline-none placeholder:text-[var(--content-tertiary)] focus:border-[var(--primary-base)]/50`})}function o({title:e,subtitle:t}){return(0,n.jsxs)(`div`,{className:`mb-8 text-center`,children:[(0,n.jsx)(`h1`,{className:`mb-2 font-serif text-[2rem] font-bold italic text-[var(--content-default)]`,children:e}),t&&(0,n.jsx)(`p`,{className:`text-sm text-[var(--content-secondary)]`,children:t})]})}function s({children:e}){return(0,n.jsx)(`div`,{className:`flex min-h-screen items-center justify-center bg-[var(--surface-base)]`,children:(0,n.jsx)(`div`,{className:`w-full max-w-[480px] px-6`,children:(0,n.jsx)(`div`,{className:`flex flex-col items-center gap-10`,children:(0,n.jsx)(`div`,{className:`w-full`,children:e})})})})}export{a as i,i as n,o as r,s as t};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{o as e}from"./rolldown-runtime-BM3Ffeng.js";import{$n as t,AC as n,BC as r,CS as i,Cr as a,Gn as o,Pn as s,SC as c,Sr as l,WC as u,Xn as d,Yn as f,Zn as p,qS as m,wr as h,xr as g}from"./app-
|
|
1
|
+
import{o as e}from"./rolldown-runtime-BM3Ffeng.js";import{$n as t,AC as n,BC as r,CS as i,Cr as a,Gn as o,Pn as s,SC as c,Sr as l,WC as u,Xn as d,Yn as f,Zn as p,qS as m,wr as h,xr as g}from"./app-XG_RF2yi.js";import{E as _,j as v}from"./vendor-DwMhK7fD.js";import{t as y,x as b}from"./react-B9IgSVeK.js";import{$ as x,$n as S,A as C,Ai as w,Br as T,Cr as E,D,Gi as O,Ha as ee,Ii as te,Ki as ne,Nr as re,P as k,Va as ie,Ya as A,_t as ae,ha as j,kt as oe,mi as M,qi as N,vt as P,zi as F}from"./icons-C0wyat6T.js";import{n as I,r as se,t as L}from"./animated-stat-square--YG74D1T.js";import{o as ce,t as le}from"./detail-primitives-wlzeidYY.js";import{t as ue}from"./file-diff-view-Cl9aJla4.js";import{t as de}from"./detail-panel-stop-button-DnqOX8hL.js";import{t as fe}from"./status-badge-pill-qGQ5gRiz.js";var pe=A(`file-pen`,[[`path`,{d:`M12.659 22H18a2 2 0 0 0 2-2V8a2.4 2.4 0 0 0-.706-1.706l-3.588-3.588A2.4 2.4 0 0 0 14 2H6a2 2 0 0 0-2 2v9.34`,key:`o6klzx`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M10.378 12.622a1 1 0 0 1 3 3.003L8.36 20.637a2 2 0 0 1-.854.506l-2.867.837a.5.5 0 0 1-.62-.62l.836-2.869a2 2 0 0 1 .506-.853z`,key:`zhnas1`}]]),R=e(b(),1),z=``;function B(e,t){switch(e){case`complete`:case`completed`:return`completed`;case`failed`:case`error`:return`error`;case void 0:return t;default:return`running`}}function me(e){return(e.messageId?.startsWith(`local-marker-`)??!1)||(e.content?.startsWith(`↻ Steering: `)??!1)}function V(e){let t=e??``;return t.startsWith(`↻ Steering: `)?t.slice(g.length):t}function H(e){let t=e[e.length-1];t&&(t.kind===`agent`||t.kind===`thinking`)&&!t.isComplete&&(e[e.length-1]={...t,isComplete:!0})}function U(e,t){if(t.updateType===`agent_message_chunk`&&me(t)){H(e),e.push({kind:`user`,id:t.messageId??`steer-${e.length}`,content:V(t.content)});return}switch(t.updateType){case`user_message_chunk`:{let n=t.messageId??z,r=V(t.content),i=e[e.length-1];i&&i.kind===`user`&&i.id===n?e[e.length-1]={...i,content:i.content+r}:(H(e),e.push({kind:`user`,id:n,content:r}));let a=e[e.length-1].content;for(let t=0;t<e.length-1;t++){let n=e[t];if(n.kind===`user`&&n.id.startsWith(`local-marker-`)&&n.content===a){e.splice(t,1);break}}return}case`agent_message_chunk`:{let n=t.messageId??z,r=e[e.length-1];if(r&&r.kind===`agent`&&r.messageId===n){e[e.length-1]={...r,content:r.content+(t.content??``)};return}if(n!==z&&r&&r.kind===`agent`&&r.messageId===z&&!r.isComplete&&r.content===(t.content??``)){e[e.length-1]={...r,messageId:n};return}H(e),e.push({kind:`agent`,messageId:n,content:t.content??``,isComplete:!1});return}case`agent_thought_chunk`:{let n=t.messageId??z,r=e[e.length-1];if(r&&r.kind===`thinking`&&r.messageId===n){e[e.length-1]={...r,content:r.content+(t.content??``)};return}H(e),e.push({kind:`thinking`,messageId:n,content:t.content??``,isComplete:!1});return}case`tool_call`:{let n=t.toolCallId;if(n===void 0)return;H(e),e.push({kind:`tool`,toolCallId:n,title:t.toolTitle??``,toolKind:t.toolKind,status:B(t.toolStatus,`running`),content:t.content,locations:W(t),rawInput:t.rawInput,rawOutput:t.rawOutput});return}case`tool_call_update`:{let n=t.toolCallId;if(n===void 0)return;let r=e.findIndex(e=>e.kind===`tool`&&e.toolCallId===n);if(r===-1)return;let i=e[r],a=W(t);e[r]={...i,title:t.toolTitle??i.title,toolKind:t.toolKind??i.toolKind,status:B(t.toolStatus,i.status),content:t.content??i.content,locations:a??i.locations,rawInput:t.rawInput===void 0?i.rawInput:t.rawInput,rawOutput:t.rawOutput===void 0?i.rawOutput:t.rawOutput};return}case`plan`:{let n=he(t.content);if(n===null)return;let r=e.findIndex(e=>e.kind===`plan`),i={kind:`plan`,entries:n};r===-1?(H(e),e.push(i)):e[r]=i;return}}}function W(e){let t=e.locations;if(!Array.isArray(t))return;let n=[];for(let e of t){let t=e??{};typeof t.path==`string`&&n.push(typeof t.line==`number`?{path:t.path,line:t.line}:{path:t.path})}return n}function he(e){if(!e)return null;let t;try{t=JSON.parse(e)}catch{return null}let n=Array.isArray(t)?t:Array.isArray(t?.entries)?t.entries:null;return n===null?null:n.map(e=>{let t=e??{},n=t.content??t.label??``;return{label:typeof n==`string`?n:String(n),checked:t.checked===!0||t.status===`completed`}})}function ge(e){let t=[];for(let n of e)U(t,n);return t}function _e(e,t){if(e===t)return{kind:`identity`};if(e===null)return{kind:`first`};if(t.length<e.length)return{kind:`fallback`};for(let n=0;n<e.length;n++)if(e[n]!==t[n])return n===e.length-1&&t.length===e.length?{kind:`mutate-last`}:{kind:`fallback`};return t.length===e.length?{kind:`identity`}:{kind:`append`,from:e.length}}function ve(){let e=null,t=[];function n(n){return t=ge(n),e=n,t}function r(r){let i=_e(e,r);switch(i.kind){case`identity`:return t;case`first`:return n(r);case`append`:{let n=t.slice();for(let e=i.from;e<r.length;e++)U(n,r[e]);return e=r,t=n,t}case`mutate-last`:case`fallback`:return n(r)}}return{project:r}}function ye(e){let t=(0,R.useRef)(null);return t.current??=ve(),t.current.project(e)}function G(e){if(!e)return[];let t;try{t=JSON.parse(e)}catch{let t=e.trimStart();return t.startsWith(`{`)||t.startsWith(`[`)?[]:[{type:`content`,text:e}]}let n=Array.isArray(t)?t:[t],r=[];for(let e of n){let t=be(e);t&&r.push(t)}return r}function be(e){if(typeof e!=`object`||!e)return null;let t=e;switch(t.type){case`content`:return{type:`content`,text:xe(t.content)};case`diff`:return typeof t.path!=`string`||typeof t.newText!=`string`?null:{type:`diff`,path:t.path,newText:t.newText,...typeof t.oldText==`string`?{oldText:t.oldText}:{}};case`terminal`:{let e=Se(t);return e===void 0?{type:`terminal`}:{type:`terminal`,text:e}}default:return null}}function xe(e){if(typeof e==`string`)return e;if(typeof e==`object`&&e){let t=e.text;if(typeof t==`string`)return t}return``}function Se(e){if(typeof e.text==`string`)return e.text;if(typeof e.output==`string`)return e.output;if(typeof e.content==`string`)return e.content;if(typeof e.content==`object`&&e.content!==null){let t=e.content.text;if(typeof t==`string`)return t}}function K(e){if(typeof e!=`object`||!e)return;let t=e.command;return typeof t==`string`?t:void 0}function q(e){return G(e).filter(e=>e.type===`content`||e.type===`terminal`).map(e=>`text`in e?e.text??``:``).filter(e=>e.length>0).join(`
|
|
2
2
|
`)}function J(e){if(e!=null){if(typeof e==`string`)return e;if(typeof e==`object`)try{return JSON.stringify(e,null,2)}catch{return String(e)}return String(e)}}function Y(e,t){let n=new Map;for(let t of e)t.type===`diff`&&n.set(t.path,{path:t.path,newText:t.newText,...t.oldText===void 0?{}:{oldText:t.oldText}});for(let e of t??[])n.has(e.path)||n.set(e.path,{path:e.path});return Array.from(n.values())}var X=y();function Ce({content:e,isComplete:t,assistantId:n}){return(0,X.jsxs)(`div`,{"data-testid":`acp-chat-agent-message`,className:`flex w-full flex-col items-start text-chat text-[var(--content-default)]`,children:[(0,X.jsx)(s,{content:e,assistantId:n}),!t&&(0,X.jsx)(o,{className:`mt-1`,"data-testid":`acp-chat-agent-streaming`})]})}function Z({entries:e}){let{t}=_(`chat`);return e.length===0?null:(0,X.jsxs)(`div`,{"data-testid":`acp-chat-plan-block`,className:`w-full rounded-lg border border-[var(--border-base)] bg-[var(--surface-overlay)] p-3`,children:[(0,X.jsxs)(`div`,{className:`mb-2 flex items-center gap-1.5 text-[var(--content-tertiary)]`,children:[(0,X.jsx)(S,{"aria-hidden":!0,className:`h-3.5 w-3.5 shrink-0`}),(0,X.jsx)(n,{variant:`body-small-emphasised`,className:`text-inherit`,children:t(`acpChatPlanBlock.plan`)})]}),(0,X.jsx)(`ul`,{className:`flex flex-col gap-1.5`,children:e.map((e,t)=>(0,X.jsxs)(`li`,{"data-testid":`acp-chat-plan-entry`,"data-checked":e.checked,className:`flex items-start gap-2`,children:[e.checked?(0,X.jsx)(F,{"aria-hidden":!0,className:`mt-0.5 h-4 w-4 shrink-0 text-[var(--system-positive-strong)]`}):(0,X.jsx)(w,{"aria-hidden":!0,className:`mt-0.5 h-4 w-4 shrink-0 text-[var(--content-disabled)]`}),(0,X.jsx)(`span`,{className:e.checked?`text-body-small-default text-[var(--content-tertiary)] line-through`:`text-body-small-default text-[var(--content-default)]`,children:e.label})]},t))})]})}function we(e){switch(e){case`max_tokens`:case`max_turn_requests`:return v(`chat:acpChatTerminalBlock.stoppedLimitReached`);case`refusal`:return v(`chat:acpChatTerminalBlock.refused`);case`cancelled`:return v(`chat:acpChatTerminalBlock.cancelled`);default:return v(`chat:acpChatTerminalBlock.completed`)}}function Te(e){return new Date(e).toLocaleTimeString([],{hour:`numeric`,minute:`2-digit`})}function Q({completedAt:e}){let{t}=_(`chat`);return e===void 0?null:(0,X.jsx)(`span`,{"data-testid":`acp-chat-terminal-time`,children:t(`acpChatTerminalBlock.atTime`,{time:Te(e)})})}function Ee({status:e,stopReason:t,error:n,completedAt:r}){let{t:i}=_(`chat`);if(h(e))return null;if(e===`failed`)return(0,X.jsxs)(`div`,{"data-testid":`acp-chat-terminal-block`,"data-terminal-kind":`failed`,className:`flex items-start gap-2 rounded-md bg-[var(--system-negative-weak)] px-3 py-2 text-body-small-default text-[var(--system-negative-strong)]`,children:[(0,X.jsx)(`span`,{"aria-hidden":!0,"data-testid":`acp-chat-terminal-failed-icon`,className:`flex h-[12px] w-4 shrink-0 items-center justify-center`,children:(0,X.jsx)(D,{className:`h-4 w-4`})}),(0,X.jsx)(`span`,{children:n??i(`acpChatTerminalBlock.runFailed`)})]});if(e===`cancelled`)return(0,X.jsxs)(`div`,{"data-testid":`acp-chat-terminal-block`,"data-terminal-kind":`cancelled`,className:`flex items-center gap-2 text-body-small-default text-[var(--content-tertiary)]`,children:[(0,X.jsx)(te,{"aria-hidden":!0,className:`h-4 w-4 shrink-0`}),(0,X.jsx)(`span`,{children:i(`acpChatTerminalBlock.cancelled`)}),(0,X.jsx)(Q,{completedAt:r})]});let a=we(t);return(0,X.jsxs)(`div`,{"data-testid":`acp-chat-terminal-block`,"data-terminal-kind":`completed`,className:`flex items-center gap-2 text-body-small-default text-[var(--content-tertiary)]`,children:[(0,X.jsx)(F,{"aria-hidden":!0,className:`h-4 w-4 shrink-0 text-[var(--system-positive-strong)]`}),(0,X.jsx)(`span`,{children:a}),(0,X.jsx)(Q,{completedAt:r})]})}function De({showDot:e,isLast:t,children:n}){return(0,X.jsxs)(`div`,{className:`relative flex items-start gap-2${t?``:` pb-4`}`,children:[!t&&(0,X.jsx)(`div`,{"aria-hidden":!0,className:`absolute bottom-0 left-[6.5px] w-px bg-[var(--border-element)] ${e?`top-[16px]`:`top-0`}`}),e?(0,X.jsx)(`span`,{"aria-hidden":!0,"data-testid":`acp-chat-timeline-dot`,className:`flex h-[14px] w-[14px] shrink-0 items-center justify-center`,children:(0,X.jsx)(`span`,{className:`h-[5px] w-[5px] rounded-full bg-[var(--content-disabled)]`})}):(0,X.jsx)(`span`,{"aria-hidden":!0,className:`h-[14px] w-[14px] shrink-0`}),(0,X.jsx)(`div`,{className:`min-w-0 flex-1`,children:n})]})}function Oe({content:e,isComplete:t,assistantId:n}){let[r,i]=(0,R.useState)(null),a=r??!t,c=e.trim().length>0,l=t?`Thought process`:`Thinking`,u=t?(0,X.jsx)(j,{"aria-hidden":!0,className:`h-3.5 w-3.5 shrink-0`}):(0,X.jsx)(o,{dotSize:5,className:`shrink-0`,"data-testid":`acp-chat-thinking-streaming`});return c?(0,X.jsxs)(`div`,{"data-testid":`acp-chat-thinking-block`,className:`w-full`,children:[(0,X.jsxs)(`button`,{type:`button`,"aria-expanded":a,onClick:()=>i(!a),"data-testid":`acp-chat-thinking-toggle`,className:`flex w-full items-center gap-1.5 text-body-small-default text-[var(--content-tertiary)] transition-colors hover:text-[var(--content-secondary)]`,children:[a?(0,X.jsx)(N,{"aria-hidden":!0,className:`h-3.5 w-3.5 shrink-0`}):(0,X.jsx)(O,{"aria-hidden":!0,className:`h-3.5 w-3.5 shrink-0`}),u,(0,X.jsx)(`span`,{children:l})]}),a&&(0,X.jsx)(`div`,{"data-testid":`acp-chat-thinking-body`,className:`mt-1.5 border-l-2 border-[var(--border-base)] pl-3 text-body-small-default text-[var(--content-tertiary)]`,children:(0,X.jsx)(s,{content:e,assistantId:n})})]}):(0,X.jsx)(`div`,{"data-testid":`acp-chat-thinking-block`,className:`w-full`,children:(0,X.jsxs)(`div`,{className:`flex w-full items-center gap-1.5 text-body-small-default text-[var(--content-tertiary)]`,children:[u,(0,X.jsx)(`span`,{children:l})]})})}var ke={running:`neutral`,completed:`positive`,error:`negative`,ended:`neutral`},Ae={running:`Running`,completed:`Completed`,error:`Failed`,ended:`Ended`},je={read:`Read file`,edit:`Edit file`,delete:`Delete file`,move:`Move file`,search:`Search`,execute:`Run command`,think:`Thinking`,fetch:`Fetch`,switch_mode:`Switch mode`},Me=`Tool call`,Ne={read:T,edit:pe,delete:C,move:re,search:P,execute:k,think:j,fetch:E,switch_mode:oe},Pe=new Set([`read`,`edit`,`delete`,`move`]);function Fe({toolKind:e}){return(0,X.jsx)(e&&Ne[e]||M,{"aria-hidden":!0,className:`h-4 w-4 shrink-0 text-[var(--content-tertiary)]`})}function $({label:e,value:t,testId:n}){return(0,X.jsxs)(`div`,{"data-testid":n,children:[(0,X.jsx)(`div`,{className:`mb-1 text-body-small-default text-[var(--content-tertiary)]`,children:e}),(0,X.jsx)(`pre`,{className:`max-h-60 overflow-auto rounded-md border border-[var(--border-element)] bg-[var(--surface-base)] p-2.5 font-mono text-body-small-default text-[var(--content-secondary)]`,children:t})]})}function Ie({block:e,isTerminal:t=!1,onOpenDiff:r,onOpenOutput:i}){let{t:a}=_(`chat`),[s,l]=(0,R.useState)(!1),u=(0,R.useMemo)(()=>G(e.content),[e.content]),d=(0,R.useMemo)(()=>q(e.content),[e.content]),f=(0,R.useMemo)(()=>d.split(`
|
|
3
3
|
`).map(e=>e.trim()).find(e=>e.length>0&&!e.startsWith("```"))||`View output`,[d]),p=(0,R.useMemo)(()=>Y(u,e.locations),[u,e.locations]),m=t&&e.status===`running`?`ended`:e.status,h=m===`running`,g=e.toolKind&&je[e.toolKind]||Me,v=K(e.rawInput)??e.title,y=v&&v!==g&&(!Pe.has(e.toolKind??``)||p.length===0)?v:null,b=J(e.rawInput),x=J(e.rawOutput),S=b!==void 0||x!==void 0;return(0,X.jsxs)(`div`,{"data-testid":`acp-chat-tool-card`,"data-status":e.status,className:`w-full rounded-lg border border-[var(--border-base)] bg-[var(--surface-overlay)] p-3`,children:[(0,X.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,X.jsx)(Fe,{toolKind:e.toolKind}),(0,X.jsx)(n,{variant:`body-small-emphasised`,className:`min-w-0 flex-1 truncate text-[var(--content-default)]`,title:e.title,children:g}),(0,X.jsx)(c,{tone:ke[m],"data-testid":`acp-chat-tool-status`,children:Ae[m]}),h&&(0,X.jsx)(o,{className:`shrink-0`,"data-testid":`acp-chat-tool-running`})]}),y&&(0,X.jsx)(`div`,{"data-testid":`acp-chat-tool-detail`,className:`mt-1.5 font-mono text-body-small-default whitespace-pre-wrap break-words text-[var(--content-secondary)]`,children:y}),p.length>0&&(0,X.jsx)(`div`,{className:`mt-2 flex flex-wrap gap-1.5`,children:p.map(t=>{let n=t.oldText!==void 0||t.newText!==void 0,i=`flex max-w-full items-center gap-1.5 rounded-md border border-[var(--border-base)] bg-[var(--surface-base)] px-2 py-1 text-body-small-default text-[var(--content-secondary)]`;return n?(0,X.jsxs)(`button`,{type:`button`,"data-testid":`acp-chat-tool-file-chip`,onClick:()=>r(e.toolCallId,t),title:t.path,className:`${i} cursor-pointer transition-colors hover:bg-[var(--surface-hover)] focus-visible:outline focus-visible:outline-2 focus-visible:outline-[var(--ring)]`,children:[(0,X.jsx)(T,{"aria-hidden":!0,className:`h-3.5 w-3.5 shrink-0`}),(0,X.jsx)(`span`,{className:`truncate font-mono`,children:t.path})]},t.path):(0,X.jsxs)(`span`,{"data-testid":`acp-chat-tool-file-ref`,title:t.path,className:i,children:[(0,X.jsx)(T,{"aria-hidden":!0,className:`h-3.5 w-3.5 shrink-0`}),(0,X.jsx)(`span`,{className:`truncate font-mono`,children:t.path})]},t.path)})}),d.length>0&&(0,X.jsxs)(`button`,{type:`button`,"data-testid":`acp-chat-tool-output-open`,onClick:()=>i?.(e.toolCallId),className:`mt-2 flex w-full items-center gap-2 rounded-md border border-[var(--border-element)] bg-[var(--surface-base)] px-2.5 py-2 text-left transition-colors hover:bg-[var(--surface-hover)] focus-visible:outline focus-visible:outline-2 focus-visible:outline-[var(--ring)]`,children:[(0,X.jsx)(k,{"aria-hidden":!0,className:`h-3.5 w-3.5 shrink-0 text-[var(--content-tertiary)]`}),(0,X.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-mono text-body-small-default text-[var(--content-secondary)]`,children:f}),(0,X.jsx)(O,{"aria-hidden":!0,className:`h-3.5 w-3.5 shrink-0 text-[var(--content-tertiary)]`})]}),S&&(0,X.jsxs)(`div`,{className:`mt-2`,"data-testid":`acp-chat-tool-raw`,children:[(0,X.jsxs)(`button`,{type:`button`,"data-testid":`acp-chat-tool-raw-toggle`,"aria-expanded":s,onClick:()=>l(e=>!e),className:`flex items-center gap-1 text-body-small-default text-[var(--content-tertiary)] transition-colors hover:text-[var(--content-default)]`,children:[s?(0,X.jsx)(N,{"aria-hidden":!0,className:`h-3.5 w-3.5 shrink-0`}):(0,X.jsx)(O,{"aria-hidden":!0,className:`h-3.5 w-3.5 shrink-0`}),(0,X.jsx)(`span`,{children:a(s?`acpChatToolCard.hideRaw`:`acpChatToolCard.showRaw`)})]}),s&&(0,X.jsxs)(`div`,{className:`mt-1.5 flex flex-col gap-2`,children:[b!==void 0&&(0,X.jsx)($,{label:a(`acpChatToolCard.rawInput`),value:b,testId:`acp-chat-tool-raw-input`}),x!==void 0&&(0,X.jsx)($,{label:a(`acpChatToolCard.rawOutput`),value:x,testId:`acp-chat-tool-raw-output`})]})]})]})}function Le({content:e}){return(0,X.jsx)(`div`,{"data-testid":`acp-chat-user-turn`,className:`flex w-full justify-end`,children:(0,X.jsx)(`div`,{className:`max-w-[80%] rounded-lg bg-[var(--surface-lift)] px-4 py-3 whitespace-pre-wrap text-chat text-[var(--content-default)]`,children:e})})}function Re({model:e,options:t}){let{t:n}=_(`chat`),r=t?.find(t=>t.value===e)?.label??e;return(0,X.jsx)(m,{icon:(0,X.jsx)(x,{}),value:r,label:n(`acpRunChatView.modelLabel`)})}function ze({content:e,assistantId:t}){return(0,X.jsx)(`div`,{"data-testid":`acp-chat-command-output`,className:`rounded-lg border border-[var(--border-base)] bg-[var(--surface-overlay)] p-3 [&_pre]:!max-h-none`,children:(0,X.jsx)(s,{content:q(e),hardLineBreaks:!0,assistantId:t})})}var Be=80;function Ve(e){return e.scrollHeight-e.clientHeight-e.scrollTop<=Be}function He(e){let t=(0,R.useRef)(null),n=(0,R.useRef)(!0),[r,i]=(0,R.useState)(!1),a=(0,R.useCallback)(()=>{let e=t.current;e&&(e.scrollTop=e.scrollHeight)},[]),o=(0,R.useCallback)(()=>{let e=t.current;if(!e)return;let r=Ve(e);n.current=r,i(e=>e===!r?e:!r)},[]),s=(0,R.useCallback)(()=>{n.current=!0,a(),i(!1)},[a]),c=(0,R.useCallback)(e=>{let r=t.current;r&&r.removeEventListener(`scroll`,o),t.current=e,e&&(e.addEventListener(`scroll`,o,{passive:!0}),n.current?e.scrollTop=e.scrollHeight:o())},[o]);return(0,R.useLayoutEffect)(()=>{n.current?a():o()},[e,a,o]),{scrollRef:c,showScrollToLatest:r,scrollToLatest:s}}function Ue(e,t){switch(e.kind){case`user`:return`user-${e.id||t}`;case`agent`:return`agent-${e.messageId||t}`;case`thinking`:return`thinking-${e.messageId||t}`;case`tool`:return`tool-${e.toolCallId}`;case`plan`:return`plan`}}var We=[];function Ge({entry:e,onClose:t,assistantId:i}){let{t:a}=_(`chat`),o=h(e.status),{model:s}=e,c=e.inputTokens!==void 0||e.outputTokens!==void 0,d=ye(l(t=>t.byId[e.acpSessionId]?.events??We)),[f,p]=(0,R.useState)(null),[m,g]=(0,R.useState)(e.acpSessionId);m!==e.acpSessionId&&(g(e.acpSessionId),p(null));let v=(0,R.useCallback)((e,t)=>p({kind:`diff`,toolCallId:e,path:t.path}),[]),y=(0,R.useCallback)(e=>p({kind:`output`,toolCallId:e}),[]),b=(0,R.useCallback)(()=>p(null),[]),x=(0,R.useMemo)(()=>f?d.find(e=>e.kind===`tool`&&e.toolCallId===f.toolCallId)??null:null,[f,d]),S=(0,R.useMemo)(()=>f?.kind!==`diff`||!x?null:Y(G(x.content),x.locations).find(e=>e.path===f.path)??null,[f,x]),C=f?.kind===`diff`?f.path:x?K(x.rawInput)??x.title??`Output`:`Output`,{scrollRef:w,showScrollToLatest:T,scrollToLatest:E}=He((0,R.useMemo)(()=>({blocks:d,status:e.status,completedAt:e.completedAt}),[d,e.status,e.completedAt])),D=!o;return(0,X.jsxs)(`div`,{className:`flex h-full flex-col overflow-hidden rounded-xl bg-[var(--surface-lift)]`,children:[f&&(0,X.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2 border-b border-[var(--border-hover)] px-5 py-3`,children:[(0,X.jsx)(`button`,{type:`button`,onClick:b,title:e.agent,className:`min-w-0 shrink cursor-pointer truncate text-left text-[var(--content-default)] hover:underline`,children:(0,X.jsx)(n,{variant:`body-small-default`,as:`span`,children:e.agent})}),(0,X.jsx)(O,{className:`h-2.5 w-2.5 shrink-0 text-[var(--content-tertiary)]`,"aria-hidden":!0}),(0,X.jsx)(n,{variant:`body-small-default`,as:`span`,title:C,className:`min-w-0 shrink truncate font-mono text-[var(--content-secondary)]`,children:C})]}),(0,X.jsx)(Ke,{entry:e,isRunning:o,onClose:t,showBack:!!f,onBack:b},`header-${e.acpSessionId}`),f?(0,X.jsx)(`div`,{className:`flex-1 overflow-y-auto px-5 py-5`,children:f.kind===`diff`?(0,X.jsx)(ue,{path:f.path,oldText:S?.oldText,newText:S?.newText}):(0,X.jsx)(ze,{content:x?.content,assistantId:i})}):(0,X.jsxs)(`div`,{className:`relative min-h-0 flex-1`,children:[(0,X.jsxs)(`div`,{ref:w,"data-testid":`acp-chat-conversation`,className:`flex h-full flex-col gap-4 overflow-y-auto px-5 py-5`,children:[(c||s!==void 0)&&(0,X.jsxs)(`div`,{className:u(`grid gap-3`,c?`grid-cols-2`:`grid-cols-1`),"data-testid":`acp-run-metrics`,children:[c&&(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(L,{icon:(0,X.jsx)(ee,{}),target:e.inputTokens??0,format:e=>I(Math.round(e)),label:a(`acpRunChatView.inputLabel`)}),(0,X.jsx)(L,{icon:(0,X.jsx)(se,{}),target:e.outputTokens??0,format:e=>I(Math.round(e)),label:a(`acpRunChatView.outputLabel`)})]}),s!==void 0&&(0,X.jsx)(`div`,{className:c?`col-span-2`:void 0,children:(0,X.jsx)(Re,{model:s,options:e.availableModels})})]}),(0,X.jsx)(qe,{task:e.task},`objective-${e.acpSessionId}`),(0,X.jsx)(`div`,{className:`flex flex-col`,"data-testid":`acp-chat-timeline`,children:d.map((e,t)=>(0,X.jsx)(De,{showDot:t===0||t===d.length-1||e.kind===`tool`||e.kind===`plan`,isLast:t===d.length-1,children:(0,X.jsx)(Je,{block:e,isTerminal:D,onOpenDiff:v,onOpenOutput:y,assistantId:i})},Ue(e,t)))}),!o&&(0,X.jsx)(Ee,{status:e.status,stopReason:e.stopReason,error:e.error,completedAt:e.completedAt})]}),T&&(0,X.jsx)(r,{shape:`pill`,variant:`outlined`,size:`compact`,iconOnly:(0,X.jsx)(ie,{}),onClick:E,"aria-label":a(`acpRunChatView.goToNewest`),tooltip:a(`acpRunChatView.goToNewest`),"data-testid":`acp-chat-scroll-to-latest`,className:`absolute bottom-3 left-1/2 -translate-x-1/2 shadow-md`})]}),o&&!f&&(0,X.jsx)(Ye,{acpSessionId:e.acpSessionId},`steer-${e.acpSessionId}`)]})}function Ke({entry:e,isRunning:n,onClose:o,showBack:s=!1,onBack:c}){let{t:l}=_(`chat`),[u,f]=(0,R.useState)(!1),m=a(e.status,e.stopReason),h=(0,R.useCallback)(()=>{f(!0),d(e.acpSessionId).catch(e=>{f(!1),i(e,{context:`AcpRunChatView.stop`})})},[e.acpSessionId]);return(0,X.jsx)(t,{icon:(0,X.jsxs)(X.Fragment,{children:[s&&(0,X.jsx)(r,{variant:`outlined`,iconOnly:(0,X.jsx)(ne,{}),onClick:c,"aria-label":l(`acpRunChatView.backToConversationAria`),tooltip:l(`acpRunChatView.backTooltip`),"data-testid":`acp-chat-diff-back`,className:`shrink-0`}),(0,X.jsx)(p,{agent:e.agent,className:`h-5 w-5 shrink-0`})]}),title:e.agent,headerTrailing:(0,X.jsx)(fe,{color:m.color,label:m.label}),headerActions:n?(0,X.jsx)(de,{onStop:h,ariaLabel:l(`acpRunChatView.stopRunAria`),disabled:u}):void 0,closeLabel:l(`acpRunChatView.closeRunDetail`),onClose:o})}function qe({task:e}){let{t}=_(`chat`);return e?(0,X.jsxs)(`div`,{"data-testid":`acp-chat-objective`,children:[(0,X.jsx)(ce,{as:`h3`,children:t(`acpRunChatView.objective`)}),(0,X.jsx)(le,{label:t(`acpRunChatView.objective`),children:(0,X.jsx)(n,{variant:`body-medium-lighter`,as:`p`,className:`whitespace-pre-wrap break-words leading-relaxed text-[var(--content-default)]`,children:e})}),(0,X.jsx)(`div`,{className:`mt-4 h-px w-full bg-[var(--border-hover)]`})]}):null}function Je({block:e,isTerminal:t,onOpenDiff:n,onOpenOutput:r,assistantId:i}){switch(e.kind){case`user`:return(0,X.jsx)(Le,{content:e.content});case`agent`:return(0,X.jsx)(Ce,{content:e.content,isComplete:e.isComplete||t,assistantId:i});case`thinking`:return(0,X.jsx)(Oe,{content:e.content,isComplete:e.isComplete||t,assistantId:i});case`tool`:return(0,X.jsx)(Ie,{block:e,isTerminal:t,onOpenDiff:n,onOpenOutput:r});case`plan`:return(0,X.jsx)(Z,{entries:e.entries})}}function Ye({acpSessionId:e}){let{t}=_(`chat`),[n,a]=(0,R.useState)(``),[o,s]=(0,R.useState)(!1);return(0,X.jsx)(`form`,{onSubmit:(0,R.useCallback)(t=>{t.preventDefault();let r=n.trim();if(!r||o)return;s(!0);let c=l.getState().appendLocalMarker({acpSessionId:e,content:`${g}${r}`});f(e,r).then(()=>a(``)).catch(t=>{c&&l.getState().removeLocalMarker({acpSessionId:e,markerId:c}),i(t,{context:`AcpRunChatView.steer`})}).finally(()=>s(!1))},[n,o,e]),"data-testid":`acp-chat-steer-form`,className:`sticky bottom-0 z-10 shrink-0 border-t border-[var(--border-hover)] bg-[var(--surface-lift)] px-5 py-3`,children:(0,X.jsxs)(`div`,{className:`flex items-center gap-2 rounded-md bg-[var(--surface-base)] px-3 py-2`,children:[(0,X.jsx)(`input`,{type:`text`,value:n,onChange:e=>a(e.target.value),placeholder:t(`acpRunChatView.steerPlaceholder`),disabled:o,"aria-label":t(`acpRunChatView.steerAria`),className:`text-body-medium-default min-w-0 flex-1 bg-transparent text-[color:var(--content-default)] placeholder:text-[color:var(--content-tertiary)] focus:outline-none disabled:opacity-50`}),(0,X.jsx)(r,{type:`submit`,variant:`primary`,size:`compact`,iconOnly:(0,X.jsx)(ae,{}),disabled:o||n.trim()===``,"aria-label":t(`acpRunChatView.sendSteerAria`),className:`shrink-0`})]})})}function Xe({entry:e,onClose:t,assistantId:n}){return(0,X.jsx)(Ge,{entry:e,onClose:t,assistantId:n})}export{Xe as AcpRunDetailPanel};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{o as e}from"./rolldown-runtime-BM3Ffeng.js";import{Fi as t,Ii as n,Li as r,Yb as i,a,c as o,d as s,mS as c,ql as l,s as u}from"./app-
|
|
1
|
+
import{o as e}from"./rolldown-runtime-BM3Ffeng.js";import{Fi as t,Ii as n,Li as r,Yb as i,a,c as o,d as s,mS as c,ql as l,s as u}from"./app-XG_RF2yi.js";import{E as d}from"./vendor-DwMhK7fD.js";import{f,r as p,t as m,x as h}from"./react-B9IgSVeK.js";var g=e(h(),1),_=m();function v(){let e=f(),{t:m}=d(`activation`),h=i.use.activeAssistantId(),v=t(),y=r(),{data:b}=n(),{starters:x,items:S}=s(v??``),{launch:C,pendingTaskIds:w}=o(v??``),T=(0,g.useMemo)(()=>[...x,...S],[x,S]),E=(0,g.useCallback)(async t=>{u(await C(t),m,t=>{l(e,t)})},[C,e,m]);return v===null?y?(0,_.jsx)(p,{to:c.assistant,replace:!0}):null:(0,_.jsx)(a,{tasks:T,progress:b?.tasks,pendingTaskIds:w,onLaunch:e=>{E(e)},onOpenConversation:t=>{l(e,t)},assistantId:h??void 0})}export{v as ActivationListRoute};
|
package/dist/assets/{activity-redirect-page-CTTRdkxc.js → activity-redirect-page-BIjoWTCA.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{o as e}from"./rolldown-runtime-BM3Ffeng.js";import{mS as t}from"./app-
|
|
1
|
+
import{o as e}from"./rolldown-runtime-BM3Ffeng.js";import{mS as t}from"./app-XG_RF2yi.js";import{d as n,f as r,x as i}from"./react-B9IgSVeK.js";var a=e(i(),1);function o(){let e=r(),{search:i,hash:o}=n();return(0,a.useEffect)(()=>{e(`${t.assistant}${i}${o}`,{replace:!0})},[e,i,o]),null}export{o as ActivityRedirectPage};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{o as e}from"./rolldown-runtime-BM3Ffeng.js";import{$h as t,$t as n,BC as r,Ct as i,Dh as a,Dr as o,Dt as s,En as c,It as l,Jr as u,Kr as d,Ln as f,Lt as p,Or as m,Qh as h,Qn as g,Qt as _,Rt as ee,Sr as v,St as y,Tt as b,Un as x,Xt as S,Yr as C,Ys as w,Yt as T,Zr as E,_t as D,au as O,bt as k,dv as A,hi as te,jt as j,nr as M,qr as N,qt as P,vt as F,wt as I,yt as ne,zt as L}from"./app-
|
|
1
|
+
import{o as e}from"./rolldown-runtime-BM3Ffeng.js";import{$h as t,$t as n,BC as r,Ct as i,Dh as a,Dr as o,Dt as s,En as c,It as l,Jr as u,Kr as d,Ln as f,Lt as p,Or as m,Qh as h,Qn as g,Qt as _,Rt as ee,Sr as v,St as y,Tt as b,Un as x,Xt as S,Yr as C,Ys as w,Yt as T,Zr as E,_t as D,au as O,bt as k,dv as A,hi as te,jt as j,nr as M,qr as N,qt as P,vt as F,wt as I,yt as ne,zt as L}from"./app-XG_RF2yi.js";import{E as R}from"./vendor-DwMhK7fD.js";import{t as z,x as B}from"./react-B9IgSVeK.js";import{Ki as V,Yn as H}from"./icons-C0wyat6T.js";import{t as U}from"./use-transcript-message-by-id-KYGOx3D6.js";import{l as W,n as G,o as K,t as q}from"./tool-detail-panel-D3kcmDuC.js";import{n as J,t as Y}from"./step-detail-header-q2pswG-E.js";var X=e(B(),1),Z=z();function re({assistantId:e,image:t,title:n,ariaLabel:r,onPreview:i}){let a=(0,X.useRef)(null),{url:o,isError:s,isPending:c}=x(e,t,p(a)||typeof IntersectionObserver>`u`),[l,u]=(0,X.useState)(null);(0,X.useEffect)(()=>{u(null)},[t.id,t.previewUrl]);let d=o===l?null:o,f=c?null:{...t,previewUrl:d??null};return(0,Z.jsx)(`div`,{ref:a,"data-testid":`activity-screenshot-tile`,"data-tool-call-id":t.toolCallId,children:(0,Z.jsx)(P,{attachment:f,placeholder:s?null:(0,Z.jsx)(H,{className:`h-6 w-6 animate-spin`,"aria-hidden":`true`}),labels:{title:n,ariaLabel:r,secondary:null},hideCaptions:!0,onPreview:()=>i(a.current?.firstElementChild instanceof HTMLElement?a.current.firstElementChild:null),onPreviewError:()=>u(o)})})}function ie(e,t){return e[t]?.type===`activity`&&t===e.length-1}function ae(e,t){let n=t.at(-1);if(!n)return!1;let r=new Set(a(n));return a(e).some(e=>r.has(e))}function oe(e,t,n){if(!n)return e[t]?.type===`activity`?t:null;let r=t=>{let r=e[t];return!r||r.type!==`activity`?!1:N(r.items).toolCalls.some(e=>e.id===n)};if(r(t))return t;let i=e.findIndex((e,t)=>r(t));return i===-1?null:i}function se(e,t,r){let i=S(t,r.workflow),a=e=>{let t=n(e,r.workflow.byToolUseId);if(t!==null&&i.has(t))return!0;let a=T(e,r.acpByToolUseId);if(a!==null&&r.acpById[a]!==void 0)return!0;let o=_(e);return o!==void 0&&r.backgroundTaskById[o]!==void 0},o=t.filter(e=>!a(e));if(o.length===t.length)return{items:e,toolCalls:t};let s=new Set(o.map(e=>e.id));return{items:e.filter(e=>e.kind!==`toolCall`||s.has(e.toolCall.id)),toolCalls:o}}function Q(e,t,n){let r=U(e),i=o(),a=c(),s=O.use.byId(),l=O.use.byToolUseId(),d=O.use.notFoundRunIds(),f=O.use.hydrationFailedRunIds(),p=v.use.byId(),h=v.use.byToolUseId(),g=m.use.byId();return(0,X.useMemo)(()=>{if(!r||t==null)return null;let e=u(r.contentBlocks??[],C(r,a)),o=oe(e,t,n);if(o==null)return null;let c=e[o];if(!c||c.type!==`activity`)return null;let{cardItems:m,toolCalls:_}=N(c.items);return{...se(m,_,{workflow:{byId:s,byToolUseId:l,notFoundRunIds:d,hydrationFailedRunIds:f},acpById:p,acpByToolUseId:h,backgroundTaskById:g}),isLastGroup:ie(e,o),isLatestMessage:ae(r,i),groupIndex:o}},[r,i,t,n,a,s,l,d,f,p,h,g])}var ce=60;function le(e,t){return $(e,t.flatMap(e=>e.kind===`tool`?[e.toolCallId]:[]))}function $(e,t,n=L){let r=new Set(t),i=new Set(e.filter(e=>r.has(e.id)&&A(e.name,e.input)).map(e=>e.id)),a=new Map;for(let t of n(e,(e,t,n)=>i.has(e.id)&&t===n))a.set(t.toolCallId,t);let o=[],s=new Set;for(let e of t){if(s.has(e))continue;let t=a.get(e);t&&(s.add(e),o.push({image:t,occurrenceKey:e}))}return o}function ue({payload:e,onClose:t,assistantId:n}){return(0,Z.jsx)(fe,{payload:e,onClose:t,assistantId:n},de(e))}function de(e){if(e.messageId!=null){let t=e.groupToolCallIds?.[0];return JSON.stringify(t==null?[`message`,e.messageId,`index`,e.groupIndex??null]:[`message`,e.messageId,`tool`,t])}let t=e.toolCalls[0]?.id;return JSON.stringify(t==null?[`snapshot`,`index`,e.groupIndex??null]:[`snapshot`,`tool`,t])}function fe({payload:e,onClose:n,assistantId:i}){let{t:a}=R(`chat`),[o,c]=(0,X.useState)(null),l=J(o),u=e.groupToolCallIds?.[0]??e.toolCalls[0]?.id,d=Q(e.messageId,e.groupIndex,u),p=d?.items??e.items,m=d?.toolCalls??e.toolCalls,_=t.use.phase(),v=d?d.isLastGroup&&d.isLatestMessage:e.messageId==null,y=k(p,{active:e.active===!0&&v&&h(_)}),b=(0,X.useMemo)(()=>p.flatMap(e=>e.kind===`toolCall`?[e.toolCall.id]:[]),[p]),x=(0,X.useMemo)(()=>ee(),[]),S=(0,X.useMemo)(()=>$(m,b,x),[m,b,x]),C=(0,X.useMemo)(()=>S.map(e=>e.occurrenceKey),[S]),w=(0,X.useMemo)(()=>new Map(S.map((e,t)=>[e.occurrenceKey,t])),[S]),T=(0,X.useMemo)(()=>S.map(e=>e.image),[S]),E=(0,X.useRef)(null),{openPreview:O,previewModal:A}=f(i,T,C,{scopeKey:`${i??``}:${e.messageId??``}:${u??e.groupIndex??``}`,getFallbackFocus:()=>E.current?.querySelector(`button, [role="button"][tabindex="0"]`)??null}),j=F(y.steps),N=ne(y.state,y.steps),P=N===`loading`,I=D(N,y.totalDurationLabel??``,j.failed),L=P&&y.currentStepTitle||I,z=(0,X.useMemo)(()=>new Map(m.map(e=>[e.id,e])),[m]);return(0,Z.jsx)(`div`,{ref:E,className:`contents`,children:(0,Z.jsxs)(g,{icon:o?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(r,{variant:`outlined`,iconOnly:(0,Z.jsx)(V,{}),"aria-label":a(`activityStepsPanel.backAria`),tooltip:a(`activityStepsPanel.backTooltip`),onClick:()=>c(null),className:`shrink-0`}),(0,Z.jsx)(Y,{detail:o,source:K})]}):void 0,title:l,titleNode:o?o.kind===`thinking`?void 0:(0,Z.jsx)(G,{detail:o,source:K}):(0,Z.jsx)(M,{title:P?(0,Z.jsx)(te,{children:L}):L,count:y.stepCount}),closeLabel:a(`activityStepsPanel.closeSteps`),onClose:n,children:[o?(0,Z.jsx)(he,{detail:o,assistantId:i}):(0,Z.jsx)(s,{steps:y.steps,timeline:!0,renderStep:t=>(0,Z.jsx)(me,{step:t,activeDetail:o,onOpenDetail:c,lookupToolCall:e=>z.get(e),messageId:e.messageId,groupIndex:d?.groupIndex??e.groupIndex}),renderPhaseFooter:e=>{let t=pe(e,S,w);if(!t)return null;let{entry:n,step:r,index:o}=t,s=r.activity?.trim(),c=s?a(`activityStepsPanel.screenshotTitle`,{activity:s}):a(`activityStepsPanel.screenshotFallbackTitle`),l=s?a(`activityStepsPanel.screenshotAria`,{activity:s}):a(`activityStepsPanel.screenshotFallbackAria`);return(0,Z.jsx)(re,{assistantId:i,image:n.image,title:c,ariaLabel:l,onPreview:e=>O(n.image,o,e)})}}),A]})})}function pe(e,t,n){if(!j(e.label))return null;for(let r=e.steps.length-1;r>=0;--r){let i=e.steps[r];if(i?.kind!==`tool`)continue;let a=n.get(i.toolCallId);if(a!==void 0)return{entry:t[a],step:i,index:a}}return null}function me({step:e,activeDetail:t,onOpenDetail:n,lookupToolCall:r,messageId:a,groupIndex:o}){let{t:s}=R(`chat`),c=l();if(e.kind===`thinking`){let t=a!=null&&e.thinkingItemIndex!=null?{messageId:a,thinkingGroupIndex:o,thinkingItemIndex:e.thinkingItemIndex}:{};return(0,Z.jsx)(I,{iconName:`brain`,label:w(E(e.text),ce),ariaLabel:s(`activityStepsPanel.viewThinkingAria`),active:!1,onClick:()=>n({kind:`thinking`,toolCallId:``,toolName:``,title:s(`thinkingDetail.title`),activity:``,input:{},status:`completed`,thinkingText:e.text,...t})})}if(e.kind===`web_search`)return(0,Z.jsx)(i,{step:e});if(e.kind===`web_search_error`)return(0,Z.jsx)(y,{step:e});if(e.kind!==`tool`)return(0,Z.jsx)(b,{step:e});let u=r(e.toolCallId);return(0,Z.jsx)(I,{iconName:e.iconName,label:c({activity:e.activity,actionDisplayKey:e.actionDisplayKey,fallback:e.activity||e.info||e.title}),active:t?.toolCallId===e.toolCallId,onClick:()=>{u&&n(d(u))}})}function he({detail:e,assistantId:t}){return e.kind===`thinking`?(0,Z.jsx)(W,{detail:e,assistantId:t}):(0,Z.jsx)(q,{detail:e,source:K,assistantId:t})}export{ue as ActivityStepsPanel,le as buildActivityScreenshotGallery};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{t as e}from"./add-credits-modal-LuPOq4kF.js";export{e as AddCreditsModal};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{o as e}from"./rolldown-runtime-BM3Ffeng.js";import{Ad as t,BC as n,Iy as r,Ly as i,Md as a,WC as o,bC as s,cC as c,iC as l,lf as u,mS as d}from"./app-
|
|
1
|
+
import{o as e}from"./rolldown-runtime-BM3Ffeng.js";import{Ad as t,BC as n,Iy as r,Ly as i,Md as a,WC as o,bC as s,cC as c,iC as l,lf as u,mS as d}from"./app-XG_RF2yi.js";import{$n as f,E as p,Xn as m}from"./vendor-DwMhK7fD.js";import{_ as h,d as g,n as _,t as v,x as y}from"./react-B9IgSVeK.js";import{Gi as b,Ui as x}from"./icons-C0wyat6T.js";import{n as S}from"./android-billing-handoff-Q1a-ZHj3.js";import{t as C}from"./checkout-return-target-kOAtAdtD.js";var w=e(y(),1),T=v(),E=[`10.00`,`20.00`,`30.00`,`40.00`,`50.00`,`60.00`,`70.00`,`80.00`,`90.00`,`100.00`];function D(e){let t=parseFloat(e);if(Number.isNaN(t))return`0 credits`;let n=t.toLocaleString(`en-US`,{minimumFractionDigits:2,maximumFractionDigits:2});return`${n.endsWith(`.00`)?n.slice(0,-3):n} credits`}function O(e){if(e&&typeof e==`object`){let t=e.amount;if(Array.isArray(t)&&typeof t[0]==`string`)return t[0]}return`Failed to create checkout session. Please try again.`}function k({open:e,onOpenChange:v}){let{t:y}=p(),{pathname:S}=g(),[k]=h(),A=k.toString()?`${S}?${k.toString()}`:S,{data:j,isLoading:M}=f(t()),N=j?.allowed_top_up_amounts?.length?j.allowed_top_up_amounts:E,[P,F]=(0,w.useState)(null),I=P&&N.includes(P)?P:N[0]??E[0],L=m(a());return(0,w.useEffect)(()=>i(()=>{v(!1)}),[v]),u(`deeplink.billingCheckoutComplete`,({flow:e})=>{e===`top_up`&&v(!1)}),(0,T.jsx)(c.Root,{open:e,onOpenChange:v,children:(0,T.jsxs)(c.Content,{size:`sm`,children:[(0,T.jsxs)(c.Header,{children:[(0,T.jsx)(c.Title,{children:y(`addCreditsModal.title`)}),(0,T.jsx)(c.Description,{children:y(`addCreditsModal.description`)})]}),(0,T.jsx)(c.Body,{children:(0,T.jsxs)(`div`,{className:`space-y-4`,children:[(0,T.jsxs)(`div`,{children:[(0,T.jsx)(`label`,{htmlFor:`add-credits-amount`,className:`block text-body-small-default text-[var(--content-tertiary)]`,children:y(`addCreditsModal.amount`)}),(0,T.jsx)(l,{id:`add-credits-amount`,value:I,onChange:e=>{F(e),L.isError&&L.reset()},disabled:M||!j,options:N.map(e=>({value:e,label:D(e)}))})]}),L.isError&&(0,T.jsxs)(`div`,{className:`flex items-center gap-2 text-body-small-default text-[var(--system-negative-strong)]`,children:[(0,T.jsx)(x,{className:`h-3.5 w-3.5 shrink-0`}),O(L.error)]}),(0,T.jsxs)(_,{to:d.settings.usageBillingConfigureTopUps,className:o(s({tone:`quiet`}),`flex items-center gap-1 text-body-small-default text-[var(--content-tertiary)]`),onClick:()=>v(!1),children:[y(`addCreditsModal.configureAutoReload`),(0,T.jsx)(b,{className:`size-4`})]}),(0,T.jsx)(`div`,{className:`h-px w-full bg-[var(--border-subtle)]`})]})}),(0,T.jsxs)(c.Footer,{children:[(0,T.jsx)(c.Close,{asChild:!0,children:(0,T.jsx)(n,{variant:`outlined`,children:y(`addCreditsModal.cancel`)})}),(0,T.jsx)(n,{variant:`primary`,loading:L.isPending,onClick:()=>{L.isPending||L.mutate({body:{amount:I,return_path:A,return_target:C()}},{onSuccess:e=>{r(e.checkout_url)}})},disabled:L.isPending||M||!j,children:y(`addCreditsModal.continue`)})]})]})})}function A(e){return S({open:e.open,path:d.settings.usageBilling,onClose:()=>e.onOpenChange(!1)})?null:(0,T.jsx)(k,{...e})}export{A as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{o as e}from"./rolldown-runtime-BM3Ffeng.js";import{$ as t,$S as n,$f as r,$m as i,AC as a,Ab as o,Ag as s,As as c,BC as l,Bb as u,Bf as d,CS as f,Cb as p,Cm as m,Cs as h,DC as g,Db as _,Do as v,Ds as y,Eb as b,Es as x,FC as S,Fb as C,Fm as w,Fp as T,Fs as E,Gb as D,HC as O,Hb as k,Hf as A,Hi as j,IS as M,Ib as N,If as P,Ip as F,Is as I,J as ee,Jm as L,KS as te,Kb as R,Lb as ne,Lf as re,Lp as ie,Ls as ae,Lv as oe,Mb as z,Ms as B,My as se,NC as ce,NS as V,Nb as H,Nv as le,Ob as ue,Om as de,Oo as fe,Os as pe,PS as U,Pb as me,Pg as he,Pp as ge,Ps as _e,Q as ve,Qf as ye,Qn as be,Rb as xe,Rf as Se,Rs as Ce,Rv as we,SC as Te,Sb as Ee,Sm as De,Ss as Oe,Tb as ke,Ts as Ae,Ub as je,Uf as Me,Ui as Ne,Vb as Pe,Vf as Fe,Wb as Ie,X as Le,Y as Re,Yl as ze,Z as Be,Zf as Ve,Zm as He,Zx as Ue,_y as We,ah as Ge,bb as Ke,bs as qe,cC as W,ch as Je,dm as Ye,dp as Xe,eh as Ze,ep as Qe,er as $e,fp as et,gC as G,hC as tt,hg as nt,hp as rt,iC as K,ih as it,it as at,jb as ot,jg as st,js as ct,kS as lt,kb as ut,ko as dt,lm as ft,lp as pt,mC as mt,mn as ht,mp as gt,nh as _t,np as vt,nt as yt,oC as bt,oh as xt,ot as St,pp as Ct,pv as wt,q as Tt,qb as Et,qm as Dt,rh as Ot,sC as q,sh as kt,st as At,th as jt,tn as Mt,tp as Nt,ty as Pt,um as Ft,up as It,vC as Lt,wb as Rt,ws as zt,wv as Bt,xb as Vt,xs as Ht,yb as Ut,ys as Wt,zb as Gt,zf as Kt}from"./app-g1TvV-Dl.js";import{$n as J,E as Y,O as qt,Xn as Jt,j as X,nr as Z}from"./vendor-DwMhK7fD.js";import{b as Yt,t as Xt,x as Zt}from"./react-B9IgSVeK.js";import{A as Qt,D as $t,Lt as en,Ui as tn,Xn as nn,Yn as rn,Zr as an,fr as on,vt as sn}from"./icons-C0wyat6T.js";import{t as cn}from"./ellipsis-vertical-Bg7ccW1x.js";import{i as ln,n as un,r as dn,t as fn}from"./service-form-controls-DdqTR20W.js";import{o as pn}from"./detail-primitives-BVAXXLTM.js";import{d as mn,o as hn,u as gn}from"./schedules--58e813j.js";import{t as _n}from"./stt-language-picker-modal-DfBKJmLh.js";var Q=e(Zt(),1);function vn(){let e=yt();return(0,Q.useCallback)(async(t,n)=>{try{let{data:r}=await We({path:{assistant_id:e},body:{value:n,type:`api_key`,name:t},throwOnError:!0});Ke(r)}catch(e){throw e instanceof Error&&e.message===`No assistant found`?q.error(X(`settings:useDaemonConfig.assistantNotReadyToast`)):q.error(X(`settings:useDaemonConfig.saveApiKeyFailedToast`,{providerName:t})),f(e,{context:`provision_provider_key`}),e}},[e])}function yn(e){let[t,n]=(0,Q.useState)(void 0);return(0,Q.useEffect)(()=>{t!==void 0&&e===t.value&&n(void 0)},[e,t]),[t===void 0?e:t.value,(0,Q.useCallback)(e=>n(e===void 0?void 0:{value:e}),[])]}var bn=`0.11.0`;function xn(){return s(bn)}var $=Xt(),Sn=`gemini-3.1-flash-image-preview`;function Cn(e,t){return e===`openrouter`?`openrouter`:I(t)}function wn(){let{t:e}=Y(`settings`),t=yt(),n=Z(),i=He(),{data:a}=J({...pt({path:{assistant_id:t}}),enabled:i,staleTime:3e4}),o=de({onSuccess:e=>{Xe(n,{path:{assistant_id:t}},e)}}),s=vn(),l=a?.services?.[`image-generation`],u=(0,Q.useMemo)(()=>a?l?.mode===`managed`?`vellum`:l?.provider||V(`vellum:ai:imageGenProvider`,`gemini`):V(qe,`gemini`),[a,l?.mode,l?.provider]),[d,p]=yn(u),[m,h]=(0,Q.useState)(()=>V(Wt,Sn)),[g,_]=(0,Q.useState)(null),v=u===`openrouter`&&typeof l?.model==`string`?l.model:void 0,y=g??v??V(`vellum:ai:imageGenModel`,`google/gemini-3.1-flash-image-preview`),b=d===`openrouter`,x=E(d),S=b?y.trim()||`google/gemini-3.1-flash-image-preview`:x.includes(m)?m:x[0]??Sn,[C,w]=(0,Q.useState)(``),[T,D]=(0,Q.useState)(!1),O=ct.map(e=>({value:e,label:B[e]??e})),k=(0,Q.useMemo)(()=>E(d).map(e=>({value:e,label:c[e]??e})),[d]),A=d===`gemini`||d===`openai`||d===`openrouter`,{hasStoredCredential:j}=L({assistantId:t,credentialKind:`api_key`,credentialName:d,enabled:A}),N=(0,Q.useCallback)(e=>{p(e),e===`openrouter`&&g===null&&_(v??`google/gemini-3.1-flash-image-preview`)},[g,v,p]),P=(0,Q.useCallback)(async()=>{D(!0);let r=C.trim(),i=A&&r.length>0;try{await he(),i&&await s(Cn(d,S),r);let a=d===`vellum`&&!xn()?{mode:`managed`}:{provider:d,mode:d===`vellum`?`managed`:`your-own`};await o.mutateAsync({path:{assistant_id:t},body:{services:{"image-generation":a}}}).catch(t=>{throw q.error(e(`imageGenerationCard.configUpdateFailedToast`)),f(t,{context:`patch_daemon_config`}),t});try{await Pt({path:{assistant_id:t},body:{modelId:S},throwOnError:!0})}catch(t){throw q.error(e(`imageGenerationCard.modelUpdateFailedToast`)),f(t,{context:`set_image_gen_model`}),t}finally{n.invalidateQueries({queryKey:It({path:{assistant_id:t}})})}}catch{D(!1);return}D(!1);try{if(M(qe,d),M(Wt,S),i){let e=Dt(t,`api_key`,d);n.setQueryData(e,!0),n.invalidateQueries({queryKey:e}),w(``)}q.success(e(`imageGenerationCard.savedToast`))}catch(t){f(t,{context:`settings-ai-image-gen-persist-local`}),q.error(e(`imageGenerationCard.localPreferencesFailedToast`))}},[C,d,A,S,t,o,s,n,e]),F=(0,Q.useCallback)(()=>{if(w(``),d===`openrouter`){_(pe),M(Wt,pe);return}h(Sn),M(Wt,Sn)},[d]),I=e(d===`openai`?`imageGenerationCard.openaiApiKeyPlaceholder`:d===`openrouter`?`imageGenerationCard.openrouterApiKeyPlaceholder`:`imageGenerationCard.geminiApiKeyPlaceholder`);return(0,$.jsx)(ln,{title:e(`imageGenerationCard.title`),subtitle:e(`imageGenerationCard.subtitle`),children:(0,$.jsxs)(`div`,{className:`space-y-4`,children:[(0,$.jsxs)(`div`,{className:`space-y-1`,children:[(0,$.jsx)(`label`,{className:`block text-body-small-default text-[var(--content-tertiary)]`,children:e(`imageGenerationCard.providerLabel`)}),(0,$.jsx)(K,{"aria-label":e(`imageGenerationCard.providerAriaLabel`),value:d,onChange:N,options:O})]}),d===`vellum`&&(0,$.jsx)(`p`,{className:`text-body-medium-lighter text-[var(--content-tertiary)]`,children:e(`imageGenerationCard.vellumNote`)}),A&&(0,$.jsx)(G,{label:e(`imageGenerationCard.apiKeyLabel`),type:`password`,value:C,onChange:e=>w(e.target.value),placeholder:r(I,j),fullWidth:!0}),(0,$.jsxs)(`div`,{className:`space-y-1`,children:[(0,$.jsx)(`label`,{className:`block text-body-small-default text-[var(--content-tertiary)]`,children:e(`imageGenerationCard.activeModelLabel`)}),b?(0,$.jsx)(G,{"aria-label":e(`imageGenerationCard.modelAriaLabel`),value:y,onChange:e=>_(e.target.value),placeholder:e(`imageGenerationCard.openrouterModelPlaceholder`),fullWidth:!0}):(0,$.jsx)(K,{"aria-label":e(`imageGenerationCard.modelAriaLabel`),value:S,onChange:h,options:k})]}),(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(dn,{onClick:P,disabled:T}),T&&(0,$.jsx)(rn,{className:`h-4 w-4 animate-spin text-[var(--content-disabled)]`}),A&&(0,$.jsx)(un,{onClick:F})]})]})})}function Tn({title:e,count:t,action:n,children:r}){return(0,$.jsxs)(`section`,{className:`rounded-xl border border-[var(--border-hover)] bg-[var(--surface-overlay)] px-3 py-4`,children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,$.jsxs)(`div`,{className:`flex items-baseline gap-2`,children:[(0,$.jsx)(a,{variant:`body-large-default`,as:`h3`,className:`text-[var(--content-secondary)]`,children:e}),t==null?null:(0,$.jsxs)(a,{variant:`body-large-default`,as:`span`,"aria-label":`${t} ${e.toLowerCase()}`,className:`text-[var(--content-disabled)]`,children:[`·`,` `,t]})]}),n]}),r==null?null:(0,$.jsx)(`div`,{className:`mt-4 border-t border-[var(--border-base)]`,children:r})]})}function En(e){return e.scheduleNames.length>0||e.deferredReminderCount>0||e.scheduleLookupFailed}var Dn=5;function On({title:e,items:t,mono:n}){return(0,$.jsxs)(`div`,{className:`space-y-1`,children:[(0,$.jsx)(a,{variant:`body-small-default`,as:`p`,className:`text-(--content-tertiary)`,children:e}),(0,$.jsx)(`ul`,{className:`space-y-1 pl-1`,children:t.map(e=>(0,$.jsxs)(`li`,{className:`text-body-small-default text-(--content-secondary)`,children:[`• `,n?(0,$.jsx)(`code`,{children:e}):e]},e))})]})}function kn(e){let t=e.label||e.name,n=[];e.isActive&&n.push(X(`settings:manageProfilesBlockedDeleteModal.clauseDefaultProfile`)),e.callSiteIds.length>0&&n.push(X(`settings:manageProfilesBlockedDeleteModal.clauseActionOverrides`,{count:e.callSiteIds.length}));let r=e.scheduleNames.length,i=e.deferredReminderCount;return r>0&&i>0?n.push(X(`settings:manageProfilesBlockedDeleteModal.clauseRunsBoth`,{schedules:r,reminders:i})):r>0?n.push(X(`settings:manageProfilesBlockedDeleteModal.clauseRunsSchedules`,{count:r})):i>0&&n.push(X(`settings:manageProfilesBlockedDeleteModal.clauseRunsReminders`,{count:i})),n.length===0?X(`settings:manageProfilesBlockedDeleteModal.summaryNoReferences`,{display:t}):n.length===1?X(`settings:manageProfilesBlockedDeleteModal.summaryOneClause`,{display:t,clause1:n[0]}):n.length===2?X(`settings:manageProfilesBlockedDeleteModal.summaryTwoClauses`,{display:t,clause1:n[0],clause2:n[1]}):X(`settings:manageProfilesBlockedDeleteModal.summaryThreeClauses`,{display:t,clause1:n[0],clause2:n[1],clause3:n[2]})}function An({blocked:e,availableReplacements:t,replacement:n,onReplacementChange:r,error:i,saving:o,onClose:s,onConfirm:c}){let{t:u}=Y(`settings`),d=e?.scheduleNames??[],f=d.slice(0,Dn),p=d.length-f.length,m=e!=null&&En(e);return(0,$.jsx)(W.Root,{open:e!==null,onOpenChange:e=>{e||s()},children:(0,$.jsxs)(W.Content,{size:`sm`,children:[(0,$.jsx)(W.Header,{children:(0,$.jsx)(W.Title,{children:u(`manageProfilesBlockedDeleteModal.title`)})}),(0,$.jsxs)(W.Body,{className:`space-y-4`,children:[e&&(0,$.jsx)(a,{variant:`body-medium-default`,as:`p`,children:kn(e)}),e&&e.callSiteIds.length>0&&(0,$.jsx)(On,{title:u(`manageProfilesBlockedDeleteModal.actionOverridesTitle`),items:e.callSiteIds,mono:!0}),f.length>0&&(0,$.jsxs)(`div`,{className:`space-y-1`,children:[(0,$.jsx)(On,{title:u(`manageProfilesBlockedDeleteModal.schedulesTitle`),items:f}),p>0&&(0,$.jsx)(a,{variant:`body-small-default`,as:`p`,className:`pl-1 text-(--content-tertiary)`,children:u(`manageProfilesBlockedDeleteModal.moreSchedules`,{count:p})})]}),e?.scheduleLookupFailed&&(0,$.jsx)(a,{variant:`body-small-default`,as:`p`,className:`text-(--system-mid-strong)`,children:u(`manageProfilesBlockedDeleteModal.scheduleLookupFailed`)}),(0,$.jsxs)(`div`,{className:`space-y-1`,children:[(0,$.jsx)(`label`,{className:`block text-body-small-default text-(--content-tertiary)`,children:u(`manageProfilesBlockedDeleteModal.replacementLabel`)}),(0,$.jsx)(K,{"aria-label":u(`manageProfilesBlockedDeleteModal.replacementLabel`),value:n,onChange:r,placeholder:u(`manageProfilesBlockedDeleteModal.replacementPlaceholder`),options:t.map(e=>{let t=m&&e.status===`disabled`;return{value:e.name,label:Re(e),disabled:t,tooltip:t?u(`manageProfilesBlockedDeleteModal.disabledTargetTooltip`):void 0}})})]}),i&&(0,$.jsx)(a,{variant:`body-small-default`,as:`p`,className:`text-(--system-negative-strong)`,children:i})]}),(0,$.jsxs)(W.Footer,{children:[(0,$.jsx)(l,{variant:`ghost`,size:`compact`,onClick:s,children:u(`manageProfilesBlockedDeleteModal.cancel`)}),(0,$.jsx)(l,{variant:`primary`,size:`compact`,disabled:!n||o,onClick:c,children:u(o?`manageProfilesBlockedDeleteModal.saving`:`manageProfilesBlockedDeleteModal.reassignAndDelete`)})]})]})})}function jn({profile:e,isActiveProfile:t,selected:n,connections:r,deletePending:i=!1,onOpen:a,onMakeActive:o,onSetStatus:s,onDelete:c}){let{t:u}=Y(`settings`),d=e.source===`managed`,f=e.status===`disabled`,p=e.label??e.name,m=[];e.name===`auto`&&d?m.push(u(`profileRow.autoRouting`)):e.model&&m.push(Kt(e.provider??void 0,e.model,r)),d&&m.push(u(`profileRow.managedByVellum`));let h=e.availability,g=e.config_issue,_=g!=null||h?.status===`incomplete`,v=h?.message??u(`profileRow.providerUnavailableDefault`),y=g==null?h!=null&&h.status!==`ok`?_?u(`profileRow.providerUnavailableFixable`,{message:v}):v:null:u(`profileRow.providerUnavailableFixable`,{message:u(g.code===`over_output_cap`?`profileRow.configIssueOverOutputCap`:g.code===`no_input_room`?`profileRow.configIssueNoInputRoom`:`profileRow.configIssueModelUnknown`)});return(0,$.jsx)(te,{title:(0,$.jsx)(`span`,{className:f?`opacity-55`:void 0,children:p}),subtitle:m.length>0?m.join(` • `):void 0,onClick:a,showChevron:!1,selected:n,disabled:i,contentAriaLabel:u(`profileRow.openProfileAriaLabel`,{displayName:p}),trailingInteractive:!0,trailing:(0,$.jsxs)($.Fragment,{children:[y==null?null:(0,$.jsx)(O,{content:y,children:_?(0,$.jsx)(`button`,{type:`button`,onClick:a,"aria-label":y,className:`inline-flex cursor-pointer rounded-sm p-0.5 keyboard-focus:ring-2 keyboard-focus:ring-[var(--ring)]`,children:(0,$.jsx)(tn,{className:`h-4 w-4 text-[var(--system-mid-strong)]`,"aria-hidden":`true`})}):(0,$.jsx)(`span`,{className:`inline-flex p-0.5`,tabIndex:0,children:(0,$.jsx)(tn,{className:`h-4 w-4 text-[var(--system-mid-strong)]`,"aria-label":y,role:`img`})})}),f?(0,$.jsx)(Te,{tone:`neutral`,children:u(`profileRow.disabledTag`)}):null,t?(0,$.jsx)(Te,{tone:`positive`,children:u(`profileRow.defaultTag`)}):null,(0,$.jsxs)(S.Root,{children:[(0,$.jsx)(S.Trigger,{asChild:!0,children:(0,$.jsx)(l,{variant:`ghost`,size:`compact`,iconOnly:(0,$.jsx)(cn,{}),"aria-label":u(`profileRow.actionsAriaLabel`,{displayName:p}),disabled:i})}),(0,$.jsxs)(S.Content,{align:`end`,sideOffset:4,children:[(0,$.jsx)(S.Item,{onSelect:a,children:u(d?`profileRow.view`:`profileRow.edit`)}),!t&&!f&&Ie(e.provider,e.model)?(0,$.jsx)(S.Item,{onSelect:o,children:u(`profileRow.makeDefault`)}):null,f?(0,$.jsx)(S.Item,{onSelect:()=>s(!0),children:u(`profileRow.enable`)}):d?null:(0,$.jsx)(S.Item,{onSelect:()=>s(!1),children:u(`profileRow.disable`)}),d?null:(0,$.jsx)(S.Item,{onSelect:c,className:ce.anchored,children:u(`profileRow.delete`)})]})]})]})})}function Mn(e,t){let n=j(),{data:r}=J({...ge({path:{assistant_id:e}}),enabled:n,staleTime:3e4}),{profiles:i,profileOrder:a}=ht(t?.llm,e);return(0,Q.useMemo)(()=>r==null?{entries:Vt(i,a).map(e=>({name:e.name,label:e.label??null,provider:e.provider??null,model:e.model??null,status:e.status===`disabled`?`disabled`:`active`,source:e.source===`managed`?`managed`:`user`,provider_connection:e.provider_connection,availability:null})),isEffectiveCatalog:!1}:{entries:r.profiles,isEffectiveCatalog:!0},[r,i,a])}var Nn=`0.10.8`;function Pn(e){return st(Nn,e)}var Fn=`settings-ai-profile-make-active`,In=`Failed to set the active profile. Please try again.`;function Ln(e){let t=re(),n=Z(),r=Pn(e),i=w({onSuccess:()=>{n.invalidateQueries({queryKey:It({path:{assistant_id:e}})}),n.invalidateQueries({queryKey:T({path:{assistant_id:e}})})}});async function a(n,r,i){try{await t.mutateAsync({path:{assistant_id:e},body:{llm:n}})}catch(e){throw f(e,{context:r}),q.error(i),e}}async function o(t){if(!r){await a({activeProfile:t},Fn,In);return}try{await i.mutateAsync({path:{assistant_id:e},body:{name:t}})}catch(e){let t=lt(e);throw q.error(t??In),t||f(e,{context:Fn}),e}}return{makeActive:o,setStatus:(e,t)=>a({profiles:{[e]:{status:t?`active`:`disabled`}}},`settings-ai-profile-toggle`,`Failed to update the profile. Please try again.`),deleteProfile:(e,t,n)=>a({profiles:{[e]:null},profileOrder:t.filter(t=>t!==e),...n?.isAdvisor?{advisorProfile:null}:{}},`settings-ai-profile-delete`,`Failed to delete the profile. Please try again.`),patchLlm:a,isPending:t.isPending||i.isPending}}var Rn=`The profile was not deleted.`,zn=`Failed to move the schedules. ${Rn}`;function Bn(e){let t=lt(e);return t?`${/[.!?]$/.test(t)?t:`${t}.`} ${Rn}`:zn}function Vn(e,n,r){let i=Ln(e),a=Z(),o=t(),s=n?.llm?.activeProfile??null,c=n?.llm?.advisorProfile??null,l=n?.llm?.callSites??{},u=(0,Q.useMemo)(()=>n?.llm?.profiles??{},[n?.llm?.profiles]),d=(0,Q.useMemo)(()=>n?.llm?.profileOrder??[],[n?.llm?.profileOrder]),p=(0,Q.useMemo)(()=>Vt(u,d),[u,d]),[m,h]=(0,Q.useState)(null),[g,_]=(0,Q.useState)(null),[v,y]=(0,Q.useState)(``),[b,x]=(0,Q.useState)(!1),[S,C]=(0,Q.useState)(null),w=(0,Q.useRef)(!1);function T(e){return p.filter(t=>t.name===e?!1:t.status===`disabled`?!0:Tt(t,p,{requireOwnProviderAndModel:o}))}function E(e,t){let n=T(e).filter(e=>!t||e.status!==`disabled`),r=n.find(e=>e.name===s),i=n.find(e=>e.source!==`managed`);return(r??i??n[0])?.name??``}async function D(e){try{await i.deleteProfile(e,d,{isAdvisor:e===c}),r?.onDeleted?.(e)}catch{}}async function O(t){let n=u[t]?.label??t,r=t===s,i=Object.entries(l).filter(([e,n])=>e!==`mainAgent`&&n?.profile===t).map(([e])=>e),o=[],c=0,d=!1;try{let n=(await a.fetchQuery({...ft({path:{assistant_id:e},query:{inference_profile:t,include_all:`true`}}),retry:!1,staleTime:0})).schedules??[];o=n.filter(e=>!e.isDeferred).map(e=>e.name),c=n.filter(e=>e.isDeferred).length}catch(e){f(e,{context:`settings-ai-profile-delete-schedule-scan`}),d=!0}if(!(r||i.length>0||o.length>0||c>0)&&!d){await D(t);return}let p={name:t,label:n,isActive:r,callSiteIds:i,scheduleNames:o,deferredReminderCount:c,scheduleLookupFailed:d};h(p),y(E(t,En(p))),_(null)}function k(e){n==null||w.current||(w.current=!0,C(e),O(e).finally(()=>{w.current=!1,C(null)}))}async function A(){if(!m||!v)return;if(x(!0),_(null),En(m))try{await hn(e,m.name,v),await a.invalidateQueries({queryKey:Ft({path:{assistant_id:e}})})}catch(e){f(e,{context:`settings-ai-profile-reassign-schedules`}),_(Bn(e)),x(!1);return}let t={};if(m.isActive&&(t.activeProfile=v),m.callSiteIds.length>0){let e={};for(let t of m.callSiteIds)e[t]={profile:v};t.callSites=e}if(Object.keys(t).length>0)try{await i.patchLlm(t,`settings-ai-profile-reassign-delete`,`Failed to reassign references. Please try again.`)}catch{_(`Failed to reassign references. Please try again.`),x(!1);return}let n=m.name;h(null),x(!1),D(n)}return{requestDelete:k,pendingDeleteName:S,blockedDeleteModalProps:{blocked:m,availableReplacements:T(m?.name??null),replacement:v,onReplacementChange:y,error:g,saving:b,onClose:()=>{h(null),_(null)},onConfirm:()=>void A()}}}function Hn(){}function Un({assistantId:e,config:t,connections:n,selectedProfileName:r,onOpenProfile:i,onCreateProfile:o,onProfileDeleted:s}){let{t:c}=Y(`settings`),{entries:u}=Mn(e,t),d=Ln(e),f=Vn(e,t,{onDeleted:s}),p=t?.llm?.activeProfile??null;return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(Tn,{title:c(`profilesSection.title`),action:(0,$.jsx)(l,{variant:`primary`,onClick:o,leftIcon:(0,$.jsx)(en,{}),disabled:t==null,children:c(`profilesSection.createProfile`)}),children:t==null?(0,$.jsx)(a,{variant:`body-medium-lighter`,as:`p`,className:`py-4 text-center text-(--content-tertiary)`,children:c(`profilesSection.loading`)}):u.length===0?(0,$.jsx)(a,{variant:`body-medium-lighter`,as:`p`,className:`py-4 text-center text-(--content-tertiary)`,children:c(`profilesSection.emptyState`)}):u.map(e=>(0,$.jsx)(jn,{profile:e,isActiveProfile:e.name===p,selected:e.name===r,connections:n,deletePending:f.pendingDeleteName===e.name,onOpen:()=>i(e.name),onMakeActive:()=>void d.makeActive(e.name).catch(Hn),onSetStatus:t=>void d.setStatus(e.name,t).catch(Hn),onDelete:()=>f.requestDelete(e.name)},e.name))}),(0,$.jsx)(An,{...f.blockedDeleteModalProps})]})}var Wn={anthropic:!0,openai:!0,gemini:!0,fireworks:!0,openrouter:!0,chatgpt:!0,vellum:!0,together:!0,"vercel-ai-gateway":!0,minimax:!0,atlascloud:!0,baseten:!0,poolside:!0};function Gn(e){return e in Wn}function Kn(e){if(!e.baseUrl)return null;try{return new URL(e.baseUrl).host}catch{return e.baseUrl}}function qn(e){let t=Kn(e)??``,n=[];t&&n.push(t);let r=e.models?.length??0;return r>0&&n.push(`${r} ${r===1?`model`:`models`}`),e.auth.type===`none`&&n.push(`keyless`),n.join(` · `)}function Jn(e){switch(e.auth.type){case`api_key`:return`Own API key`;case`oauth_subscription`:return`ChatGPT subscription`;case`none`:return`No API key needed`;default:return null}}function Yn(e){if(e.provider===`vellum`)return`Included with your plan`;if(e.provider===`openai-compatible`)return qn(e);let t=[];if(e.provider===`ollama`||e.provider===`opencode`){let n=Kn(e);n&&t.push(n)}let n=e.provider===`chatgpt`?`openai`:e.provider,r=e.auth.type===`oauth_subscription`?Fe(n):R(n),i=e.models?.length??r.length;i>0&&t.push(`${i} ${i===1?`model`:`models`}`);let a=Jn(e);return a&&t.push(a),t.join(` • `)}function Xn({connection:e,isDefault:t,supportsDefaultProvider:n,selected:r,isSettingDefault:i,onOpen:a,onSetDefault:o,onDelete:s}){let{t:c}=Y(`settings`),u=e.isManaged??!1,d=Ge(e),f=Gn(e.provider),p=Yn(e),m=n&&!t&&f,h=!u&&a!=null,g=!u&&!t,_=m||h||g;return(0,$.jsx)(te,{title:d,subtitle:p.length>0?p:void 0,onClick:a,showChevron:!1,selected:r,contentAriaLabel:a?c(`providerRow.openProviderAriaLabel`,{displayName:d}):void 0,trailingInteractive:!0,trailing:(0,$.jsxs)($.Fragment,{children:[u?(0,$.jsx)(Te,{tone:`neutral`,title:c(`providerRow.managedTagTitle`),children:c(`providerRow.managedTag`)}):null,t?(0,$.jsx)(Te,{tone:`info`,title:c(`providerRow.defaultTagTitle`),children:c(`providerRow.defaultTag`)}):null,e.provider===`ollama`?(0,$.jsx)(Te,{tone:`neutral`,title:c(`providerRow.localTagTitle`),children:c(`providerRow.localTag`)}):null,e.provider===`openai-compatible`?(0,$.jsx)(Te,{tone:`neutral`,title:c(`providerRow.customTagTitle`),children:c(`providerRow.customTag`)}):null,_?(0,$.jsxs)(S.Root,{children:[(0,$.jsx)(S.Trigger,{asChild:!0,children:(0,$.jsx)(l,{variant:`ghost`,size:`compact`,iconOnly:(0,$.jsx)(cn,{}),"aria-label":c(`providerRow.actionsAriaLabel`,{displayName:d})})}),(0,$.jsxs)(S.Content,{align:`end`,sideOffset:4,children:[h?(0,$.jsx)(S.Item,{onSelect:a,children:c(`providerRow.edit`)}):null,m?(0,$.jsx)(S.Item,{disabled:i,onSelect:o,children:c(`providerRow.setAsDefault`)}):null,g?(0,$.jsx)(S.Item,{onSelect:s,className:ce.anchored,children:c(`providerRow.delete`)}):null]})]}):(0,$.jsx)(`span`,{className:`inline-block w-8`,"aria-hidden":!0})]})})}function Zn(e,t){let n=Z(),r={path:{assistant_id:e}},i=Jt({...rt(),onSuccess:()=>{n.invalidateQueries({queryKey:gt(r)}),n.invalidateQueries({queryKey:It(r)}),n.invalidateQueries({queryKey:T(r)})},onError:e=>{f(e,{context:`settings-ai-set-default-provider`}),q.error(X(`settings:useProviderActions.setDefaultFailedToast`))}});function a(t){Gn(t.provider)&&i.mutate({path:{assistant_id:e},body:{provider:t.provider,connectionName:t.name}})}function o(e){return i.isPending&&i.variables?.body?.connectionName===e}async function s(i){try{let{response:a}=await oe({path:{assistant_id:e,name:i}});a?.ok||a?.status===404?(n.invalidateQueries({queryKey:ie(r)}),t?.onDeleted?.(i)):a?.status===409?q.error(X(`settings:useProviderActions.deleteInUseToast`)):q.error(X(`settings:useProviderActions.deleteFailedToast`))}catch(e){f(e,{context:`settings-ai-provider-delete`}),q.error(X(`settings:useProviderActions.deleteFailedToast`))}}return{setDefault:a,isSettingDefault:o,deleteConnection:s}}function Qn({assistantId:e,selectedConnectionName:t,onOpenConnection:r,onAddProvider:i,onConnectionDeleted:o}){let{t:s}=Y(`settings`),{data:c,isLoading:d,isError:f}=J(F({path:{assistant_id:e}})),p=Ne(),{data:m}=J({...Ct({path:{assistant_id:e}}),enabled:p}),h=p?m?.resolvedConnectionName??null:null,g=Zn(e,{onDeleted:o}),_=(0,Q.useMemo)(()=>{let e=c?.connections??[];return[...e.filter(e=>e.provider===u),...e.filter(e=>e.provider!==u)]},[c]);return(0,$.jsx)(Tn,{title:s(`providersSection.title`),action:(0,$.jsx)(l,{variant:`outlined`,onClick:i,leftIcon:(0,$.jsx)(en,{}),children:s(`providersSection.addProvider`)}),children:d?(0,$.jsx)(`div`,{className:`space-y-2 py-2`,children:[1,2,3].map(e=>(0,$.jsx)(n,{className:`h-10 rounded-lg`},e))}):f?(0,$.jsx)(a,{variant:`body-medium-default`,as:`p`,className:`py-4 text-center text-(--system-negative-strong)`,children:s(`providersSection.loadError`)}):_.length===0?(0,$.jsx)(a,{variant:`body-medium-lighter`,as:`p`,className:`py-4 text-center text-(--content-tertiary)`,children:s(`providersSection.empty`)}):_.map(e=>(0,$.jsx)(Xn,{connection:e,isDefault:e.name===h,supportsDefaultProvider:p,selected:e.name===t,isSettingDefault:g.isSettingDefault(e.name),onOpen:e.isManaged??!1?void 0:()=>r(e.name),onSetDefault:()=>g.setDefault(e),onDelete:()=>void g.deleteConnection(e.name)},e.name))})}function $n({panel:e,onOpenPanel:t,onClosePanel:n}){let{t:r}=Y(`settings`),i=yt(),{data:a}=J({...pt({path:{assistant_id:i}}),staleTime:3e4}),o=Ne(),{data:s}=J({...Ct({path:{assistant_id:i}}),enabled:o}),c=s?.availability,{data:u}=J({...F({path:{assistant_id:i}})}),d=u?.connections,f=a?.llm?.callSites??{},p=Object.entries(f).filter(([e,t])=>e!==`mainAgent`&&(t?.profile!=null||t?.provider!=null||t?.model!=null)).length;return(0,$.jsx)(ln,{title:r(`languageModelCard.title`),subtitle:r(`languageModelCard.subtitle`),children:(0,$.jsxs)(`div`,{className:`space-y-2`,children:[c&&c.status!==`ok`&&(0,$.jsx)(g,{tone:c.status===`unknown`?`warning`:`error`,children:c.message??r(`languageModelCard.defaultProviderUnavailable`)}),i&&(0,$.jsx)(Un,{assistantId:i,config:a,connections:d,selectedProfileName:e?.kind===`profile`?e.name:null,onOpenProfile:e=>t({kind:`profile`,name:e}),onCreateProfile:()=>t({kind:`create-profile`}),onProfileDeleted:t=>{e?.kind===`profile`&&e.name===t&&n()}}),i&&(0,$.jsx)(Qn,{assistantId:i,selectedConnectionName:e?.kind===`provider`?e.name:null,onOpenConnection:e=>t({kind:`provider`,name:e}),onAddProvider:()=>t({kind:`add-provider`}),onConnectionDeleted:t=>{e?.kind===`provider`&&e.name===t&&n()}}),(0,$.jsx)(Tn,{title:r(`languageModelCard.overridesTitle`),count:p,action:(0,$.jsx)(l,{variant:`outlined`,onClick:()=>t({kind:`overrides`}),children:r(`languageModelCard.manage`)})})]})})}function er({children:e}){return(0,$.jsxs)(se,{href:`https://www.vellum.ai/docs/pricing`,tone:`default`,className:`inline-flex items-center gap-1`,glyph:!1,children:[e,(0,$.jsx)(an,{className:`h-3.5 w-3.5`})]})}function tr(){return(0,$.jsxs)(`div`,{className:`flex items-start gap-2 rounded-lg border border-[var(--border-base)] bg-[var(--surface-base)] px-4 py-2.5`,children:[(0,$.jsx)(on,{className:`mt-0.5 h-4 w-4 shrink-0 text-[var(--content-tertiary)]`}),(0,$.jsx)(`p`,{className:`text-body-medium-lighter text-[var(--content-secondary)]`,children:(0,$.jsx)(qt,{i18nKey:`managedServicesBanner.body`,ns:`common`,components:{link:(0,$.jsx)(er,{})}})})]})}function nr({assistantId:e,profileName:t,onClose:n}){let{t:r}=Y(`settings`),{data:i}=J({...pt({path:{assistant_id:e}}),staleTime:3e4}),{data:a}=J({...F({path:{assistant_id:e}})}),o=a?.connections,s=(0,Q.useMemo)(()=>i?.llm?.profiles??{},[i?.llm?.profiles]),c=Object.keys(s),u=(0,Q.useMemo)(()=>{if(t==null)return;let e=s[t];return e?{name:t,...e}:void 0},[t,s]),f=t==null?`create`:u?.source===`managed`||u?.invariant===!0?`view`:`edit`,{saveProfile:p,isPending:m}=P(e,{onSaved:n}),h=Se({mode:f,profileName:t??void 0,initialValues:u,existingNames:c,connections:o,assistantId:e,onSave:p}),g=Vn(e,i,{onDeleted:()=>n()}),_=t!=null&&g.pendingDeleteName===t,v=t!=null&&i!=null&&!(t in s);(0,Q.useEffect)(()=>{v&&!h.saving&&!m&&n()},[v,h.saving,m,n]);let y=f===`view`;return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(be,{title:h.effectiveMode===`create`?r(`profileDetailPanel.createTitle`):u?.label??t??r(`profileDetailPanel.defaultTitle`),closeVariant:`outlined`,onClose:n,headerTrailing:y&&h.effectiveMode!==`create`?(0,$.jsx)(Te,{tone:`neutral`,children:r(`profileDetailPanel.managedTag`)}):null,headerActions:h.effectiveMode!==`create`&&!h.isReadOnly?(0,$.jsx)(l,{variant:`dangerOutline`,loading:_,iconOnly:(0,$.jsx)(Qt,{}),"aria-label":r(_?`profileDetailPanel.deleting`:`profileDetailPanel.delete`),tooltip:r(`profileDetailPanel.delete`),onClick:()=>{t!=null&&g.requestDelete(t)},disabled:h.saving||_}):null,footer:h.isReadOnly?(0,$.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,$.jsx)(l,{variant:`outlined`,onClick:h.switchToSaveAsNew,disabled:h.saving,children:r(`profileDetailPanel.saveAsNew`)}),h.hasViewModeChanges?(0,$.jsx)(l,{variant:`primary`,onClick:()=>void h.handleSave(),disabled:h.saving,children:h.saving?r(`profileDetailPanel.saving`):r(`profileDetailPanel.save`)}):null]}):(0,$.jsx)(`div`,{className:`flex justify-end`,children:(0,$.jsx)(l,{variant:`primary`,onClick:()=>void h.handleSave(),disabled:h.isInvalid||h.saving,children:h.saving?r(`profileDetailPanel.saving`):h.effectiveMode===`create`?r(`profileDetailPanel.create`):r(`profileDetailPanel.saveChanges`)})}),children:(0,$.jsx)(d,{editor:h,assistantId:e,connections:o,variant:`panel`})}),(0,$.jsx)(An,{...g.blockedDeleteModalProps})]})}function rr({value:e,profileOptions:t,disabled:n,onChange:r}){let{t:i}=Y(`settings`);return(0,$.jsx)(`div`,{className:`rounded-lg border border-[var(--border-base)] bg-[var(--surface-overlay)] p-3`,children:(0,$.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,$.jsxs)(`div`,{className:`min-w-0`,children:[(0,$.jsx)(`p`,{className:`text-body-medium-default font-medium text-[var(--content-default)]`,children:i(`advisorProfileRow.title`)}),(0,$.jsx)(`p`,{className:`mt-0.5 text-body-small-lighter text-[var(--content-tertiary)]`,children:i(`advisorProfileRow.description`)})]}),(0,$.jsx)(K,{value:e,onChange:r,options:t,placeholder:i(`advisorProfileRow.chooseProfilePlaceholder`),className:`w-44`,menuMinWidth:280,menuAlign:`start`,disabled:n})]})})}var ir=`__custom__`;function ar(e){return e?!!(e.profile||e.provider||e.model):!1}function or(e,t){if(t?.provider||t?.model)return null;let n=e.defaultProfile??e.shippedDefaultProfile;return n?{profile:n,via:t?.profile===n?`override`:`default`}:null}function sr(e,t){let n=ar(e);return n===ar(t)?n?(e?.profile??null)===(t?.profile??null)&&(e?.provider??null)===(t?.provider??null)&&(e?.model??null)===(t?.model??null):!0:!1}function cr({assistantId:e,callSites:n,domains:r,persistedOverrides:i,orderedProfiles:o,onClose:s,onApplied:c}){let{t:u}=Y(`settings`),d=re(),p=t(),m=(0,Q.useMemo)(()=>({requireOwnProviderAndModel:p,requireTextGeneration:!1}),[p]),h=(0,Q.useMemo)(()=>{let e=new Map;for(let t of n){let n=or(t,i[t.id]);n&&e.set(t.id,n)}return e},[n,i]),_=(0,Q.useMemo)(()=>{let e=new Set(Array.from(h.values(),e=>e.profile));return o.filter(t=>e.has(t.name))},[o,h]),[v,y]=(0,Q.useState)(()=>_[0]?.name??``),[b,x]=(0,Q.useState)(``),[S,C]=(0,Q.useState)(new Set),[w,T]=(0,Q.useState)(!1),E=(0,Q.useMemo)(()=>{let e=new Map(r.map(e=>[e.id,e.displayName]));return t=>e.get(t)??t},[r]),D=(0,Q.useMemo)(()=>n.filter(e=>h.get(e.id)?.profile===v),[n,h,v]),O=(0,Q.useMemo)(()=>D.map(e=>e.id).filter(e=>!S.has(e)),[D,S]),k=(0,Q.useMemo)(()=>_.map(e=>({value:e.name,label:Re(e)})),[_]),A=(0,Q.useMemo)(()=>ve(o,[],m).filter(e=>e.name!==v).map(e=>({value:e.name,label:Re(e)})),[o,v,m]),j=Rt(o,v),M=Rt(o,b),N=S.size===0;function P(e){y(e),C(new Set),e===b&&x(``)}function F(e,t){C(n=>{let r=new Set(n);return t?r.delete(e):r.add(e),r})}async function I(){if(!(!v||!b||O.length===0)){T(!0);try{let t={};for(let e of O)t[e]={profile:b};await d.mutateAsync({path:{assistant_id:e},body:{llm:{callSites:t}}}),q.success(u(`bulkOverrideSwapModal.successToast`,{count:O.length,targetLabel:M})),c(),s()}catch(e){let t=lt(e);q.error(t??u(`bulkOverrideSwapModal.updateFailedToast`)),t||f(e,{context:`settings-ai-bulk-override-swap`})}finally{T(!1)}}}return(0,$.jsx)(W.Root,{open:!0,onOpenChange:e=>{e||s()},children:(0,$.jsxs)(W.Content,{size:`md`,children:[(0,$.jsx)(W.Header,{children:(0,$.jsx)(W.Title,{children:u(`bulkOverrideSwapModal.title`)})}),(0,$.jsxs)(W.Body,{className:`space-y-4`,children:[(0,$.jsx)(a,{variant:`body-medium-default`,as:`p`,children:u(`bulkOverrideSwapModal.intro`)}),(0,$.jsxs)(`div`,{className:`grid grid-cols-2 gap-3`,children:[(0,$.jsx)(K,{id:`bulk-swap-source`,label:u(`bulkOverrideSwapModal.currentlyUsingLabel`),value:v,onChange:P,options:k}),(0,$.jsx)(K,{id:`bulk-swap-target`,label:u(`bulkOverrideSwapModal.changeToLabel`),value:b,onChange:x,options:A,placeholder:u(`bulkOverrideSwapModal.targetPlaceholder`)})]}),(0,$.jsx)(g,{tone:`info`,title:u(`bulkOverrideSwapModal.noticeTitle`),children:u(`bulkOverrideSwapModal.noticeBody`,{sourceLabel:j})}),(0,$.jsxs)(`div`,{children:[(0,$.jsxs)(`div`,{className:`mb-2 flex items-baseline justify-between gap-2`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(a,{variant:`body-medium-default`,as:`p`,children:u(`bulkOverrideSwapModal.affectedSummary`,{count:D.length,profile:j})}),(0,$.jsx)(a,{variant:`body-small-default`,as:`p`,className:`text-[color:var(--content-secondary)]`,children:u(`bulkOverrideSwapModal.chooseActions`)})]}),(0,$.jsx)(l,{variant:`ghost`,onClick:()=>C(N?new Set(D.map(e=>e.id)):new Set),children:u(N?`bulkOverrideSwapModal.clearAll`:`bulkOverrideSwapModal.selectAll`)})]}),(0,$.jsx)(`div`,{className:`max-h-72 space-y-1 overflow-y-auto`,children:D.map(e=>(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-3 rounded-md border border-[var(--border-base)] px-3 py-2`,children:[(0,$.jsx)(mt,{checked:!S.has(e.id),onCheckedChange:t=>F(e.id,t===!0),disabled:w,label:e.displayName,helperText:E(e.domain)}),(0,$.jsx)(`span`,{className:`shrink-0 text-body-small-default text-[color:var(--content-tertiary)]`,children:h.get(e.id)?.via===`override`?u(`bulkOverrideSwapModal.viaOverride`):u(`bulkOverrideSwapModal.viaDefault`)})]},e.id))})]})]}),(0,$.jsxs)(W.Footer,{children:[(0,$.jsx)(a,{variant:`body-small-default`,as:`p`,className:`mr-auto self-center text-[color:var(--content-secondary)]`,children:u(`bulkOverrideSwapModal.willChange`,{count:O.length})}),(0,$.jsx)(l,{variant:`ghost`,onClick:s,disabled:w,children:u(`bulkOverrideSwapModal.cancel`)}),(0,$.jsx)(l,{variant:`primary`,loading:w,disabled:!v||!b||O.length===0||w,onClick:()=>void I(),children:u(`bulkOverrideSwapModal.applyTo`,{count:O.length})})]})]})})}function lr({id:e,displayName:t,description:n,defaultProfileLabel:r,draft:a,profileOptions:o,connections:s,onDraftChange:c,onToggle:l}){let{t:u}=Y(`settings`),d=je({hostedInference:Me.use.vellumHostedInference()}),f=ar(a),p=!a||!f?``:a.provider||a.model?ir:a.profile??``,m=p===ir,h=jt(),g=i(),_=(s??[]).some(e=>e.provider===xe),v=[...Gt,..._?[xe]:[]],y=h[0]??Gt[0],b=a?.provider,x=Pe(b)?b:b===`chatgpt`?xe:void 0,S=x!==void 0&&v.some(e=>e===x),C=x??y,w=A(C,``,(s??[]).filter(e=>Ze(e.provider,C)))?Fe(C):Et(C,d),T=w.map(e=>({value:e.id,label:e.displayName})),E=typeof a?.model==`string`?a.model:``;if(E&&!w.some(e=>e.id===E)){let e=R(C).find(e=>e.id===E)?.displayName??E;T.push({value:E,label:u(`callSiteOverridesRow.unavailableOption`,{name:e})})}let O=!!a?.provider&&!a?.model,j=[...v.map(e=>({value:e,label:k[e]??e,...g(e)})),...x&&!S?[{value:x,label:u(`callSiteOverridesRow.unavailableOption`,{name:k[x]??x})}]:[]];function M(t){t===`__custom__`?c(e,{profile:null,provider:y,model:D(y)??``}):t===``?c(e,null):c(e,{profile:t,provider:null,model:null})}function N(t){let n=D(t)??``;c(e,{...a??{},profile:null,provider:t,model:n})}function P(t){c(e,{...a??{},model:t})}return(0,$.jsxs)(`div`,{className:`rounded-lg border border-[var(--border-base)] bg-[var(--surface-overlay)] p-3`,children:[(0,$.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,$.jsx)(`p`,{className:`text-body-medium-default font-medium text-[var(--content-default)]`,children:t}),n&&(0,$.jsxs)(`p`,{className:`mt-0.5 text-body-small-default text-[var(--content-tertiary)]`,children:[n,r&&(0,$.jsx)(`span`,{className:`ml-1.5 text-body-small-default text-[var(--content-tertiary)] opacity-60`,children:u(`callSiteOverridesRow.defaultProfileSuffix`,{label:r})})]})]}),(0,$.jsx)(tt,{checked:f,onChange:t=>l(e,t),"aria-label":u(`callSiteOverridesRow.overrideAriaLabel`,{displayName:t}),className:`shrink-0`})]}),f&&(0,$.jsx)(`div`,{className:`mt-3`,children:(0,$.jsx)(K,{value:p,onChange:M,options:o,className:`w-44`,menuMinWidth:280,menuAlign:`start`})}),f&&m&&(0,$.jsxs)(`div`,{className:`mt-3 space-y-2 border-t border-[var(--border-base)] pt-3`,children:[(0,$.jsxs)(`div`,{className:`flex gap-2`,children:[(0,$.jsxs)(`div`,{className:`flex-1`,children:[(0,$.jsx)(`label`,{className:`mb-1 block text-body-small-default text-[var(--content-tertiary)]`,children:u(`callSiteOverridesRow.providerLabel`)}),(0,$.jsx)(K,{value:C??``,onChange:N,options:j})]}),(0,$.jsxs)(`div`,{className:`flex-1`,children:[(0,$.jsx)(`label`,{className:`mb-1 block text-body-small-default text-[var(--content-tertiary)]`,children:u(`callSiteOverridesRow.modelLabel`)}),(0,$.jsx)(K,{value:a?.model??``,onChange:P,options:T})]})]}),O&&(0,$.jsx)(`p`,{className:`text-body-small-default text-[var(--system-negative-strong)]`,children:u(`callSiteOverridesRow.pickModelError`)})]})]})}function ur({groups:e,drafts:t,buildProfileOptionsForRow:n,profileLabelFor:r,advisorMatchesSearch:i,connections:a,onDraftChange:o,onToggle:s}){let{t:c}=Y(`settings`);return(0,$.jsx)(`div`,{className:`space-y-4`,children:e.length===0?i?null:(0,$.jsx)(`p`,{className:`py-8 text-center text-body-medium-lighter text-[var(--content-tertiary)]`,children:c(`overridesCallSiteList.emptySearch`)}):e.map(({domain:e,sites:i})=>(0,$.jsxs)(`div`,{children:[(0,$.jsx)(pn,{children:e.displayName}),(0,$.jsx)(`div`,{className:`space-y-1`,children:i.map(e=>{let i=(()=>{let n=t[e.id]??null;return!n||!ar(n)?``:n.provider||n.model?ir:n.profile??``})(),c=e.shippedDefaultProfile??e.defaultProfile,l=c?r(c):null;return(0,$.jsx)(lr,{id:e.id,displayName:e.displayName,description:e.description,defaultProfileLabel:l,draft:t[e.id]??null,profileOptions:n(i===``||i===`__custom__`?null:i),connections:a,onDraftChange:o,onToggle:s},e.id)})})]},e.id))})}function dr(e,t){let n={};for(let r of Object.keys(e)){let i=e[r]??null;ar(i)?n[r]={profile:i?.profile??null,provider:i?.provider??null,model:i?.model??null}:r in t&&t[r]===null&&(n[r]=null)}return n}function fr(e){let t={};for(let n of Object.keys(e))t[n]=null;return t}function pr({catalogCallSiteIds:e,persistedOverrides:t,persistedAdvisor:n,isSeeded:r}){let[i,a]=(0,Q.useState)({}),[o,s]=(0,Q.useState)(void 0),c=(0,Q.useMemo)(()=>{if(!r)return{};let n={};for(let r of e)if(r in i)n[r]=i[r];else{let e=t[r];n[r]=e?{...e}:{}}return n},[r,e,t,i]),l=o??n,u=l!==n,d=(0,Q.useMemo)(()=>{if(!r)return!1;for(let e of Object.keys(c))if(!sr(c[e],t[e]))return!0;return!1},[r,c,t]);return{drafts:c,advisorProfile:l,advisorDirty:u,callSiteDraftsDirty:d,hasUnsavedDrafts:u||d,hasValidationError:(0,Q.useMemo)(()=>Object.values(c).some(e=>ar(e)&&!!e?.provider&&!e?.model),[c]),setDraft:(0,Q.useCallback)((e,t)=>{a(n=>({...n,[e]:t}))},[]),setAdvisor:(0,Q.useCallback)(e=>{s(e)},[]),clearEdits:(0,Q.useCallback)(()=>{a({}),s(void 0)},[]),buildSavePatch:(0,Q.useCallback)(()=>dr(c,i),[c,i]),buildResetPatch:(0,Q.useCallback)(()=>fr(c),[c])}}function mr({assistantId:e,onClose:n}){let{t:r}=Y(`settings`),{data:i}=J({...pt({path:{assistant_id:e}}),staleTime:3e4}),a=(0,Q.useMemo)(()=>i?.llm?.profiles??{},[i?.llm?.profiles]),o=(0,Q.useMemo)(()=>i?.llm?.profileOrder??[],[i?.llm?.profileOrder]),s=(0,Q.useMemo)(()=>i?.llm?.callSites??{},[i?.llm?.callSites]),c=(0,Q.useMemo)(()=>Vt(a,o),[a,o]),u=jt(),d=t(),p=(0,Q.useMemo)(()=>({requireOwnProviderAndModel:d}),[d]),m=(0,Q.useMemo)(()=>({requireOwnProviderAndModel:d,requireTextGeneration:!1}),[d]),h=re(),[_,v]=(0,Q.useState)(``),[y,b]=(0,Q.useState)(!1),[x,S]=(0,Q.useState)(!1),[C,w]=(0,Q.useState)(!1),{data:T,isLoading:E,isError:O,refetch:k}=J({...et({path:{assistant_id:e}}),enabled:!!e,staleTime:6e4,refetchOnWindowFocus:!1}),{data:A}=J({...F({path:{assistant_id:e}}),enabled:!!e}),j=(0,Q.useMemo)(()=>(T?.callSites??[]).filter(e=>e.id!==`mainAgent`),[T]),M=!E&&!O&&!!T,N=!!i,P=M&&N,I=(0,Q.useMemo)(()=>j.map(e=>e.id),[j]),L=i?.llm?.advisorProfile??``,{drafts:te,advisorProfile:R,advisorDirty:ne,callSiteDraftsDirty:ie,hasUnsavedDrafts:ae,hasValidationError:oe,setDraft:z,setAdvisor:B,clearEdits:se,buildSavePatch:ce,buildResetPatch:V}=pr({catalogCallSiteIds:I,persistedOverrides:s,persistedAdvisor:L,isSeeded:P}),H=(0,Q.useMemo)(()=>new Set(I),[I]),le=(0,Q.useCallback)(e=>Rt(c,e),[c]),ue=(0,Q.useCallback)((e,t)=>({value:e.name,label:Re(e),...ee(e,c,t)===`undispatchable`?{icon:(0,$.jsx)(tn,{className:`h-3.5 w-3.5 text-[var(--system-mid-strong)]`}),tooltip:Be(e)}:{}}),[c]),de=(0,Q.useMemo)(()=>ve(c,[L],p).map(e=>ue(e,p)),[c,L,ue,p]),fe=(0,Q.useMemo)(()=>{let e=_.trim().toLowerCase();return e===``||`advisor`.includes(e)||`second opinion`.includes(e)},[_]),pe=(0,Q.useMemo)(()=>j.some(e=>or(e,s[e.id])!==null),[j,s]),U=(0,Q.useMemo)(()=>Object.entries(s).some(([e,t])=>H.has(e)&&(t?.profile!=null||t?.provider!=null||t?.model!=null)),[s,H]),me=(0,Q.useCallback)(e=>[...ve(c,[e],m).map(e=>ue(e,m)),{value:ir,label:r(`overridesDetailPanel.customProfileOption`)}],[c,ue,m,r]),he=(0,Q.useMemo)(()=>{if(!_.trim())return j;let e=_.toLowerCase();return j.filter(t=>(t.displayName??``).toLowerCase().includes(e)||(t.description??``).toLowerCase().includes(e)||(t.domain??``).toLowerCase().includes(e))},[j,_]),ge=(0,Q.useMemo)(()=>{if(!T)return[];let e=T.domains.map(e=>e.id),t=new Map(T.domains.map(e=>[e.id,e])),n=[];for(let r of e){let e=he.filter(e=>e.domain===r);e.length>0&&n.push({domain:t.get(r),sites:e})}let i=new Set(e),a=he.filter(e=>!i.has(e.domain));return a.length>0&&n.push({domain:{id:`other`,displayName:r(`overridesDetailPanel.otherDomain`)},sites:a}),n},[T,he,r]),_e=(0,Q.useCallback)((e,t)=>{if(!t){z(e,null);return}let n=Le(c,j.find(t=>t.id===e)?.defaultProfile,m);if(n)z(e,{profile:n});else{let t=u[0]??Gt[0];z(e,{provider:t,model:D(t)??``})}},[j,c,u,z,m]),ye=(0,Q.useCallback)(async()=>{b(!0);try{let t=ce();await h.mutateAsync({path:{assistant_id:e},body:{llm:{...ie?{callSites:t}:{},...ne?{advisorProfile:R}:{}}}}),n(),q.success(r(`overridesDetailPanel.overridesSavedToast`))}catch(e){q.error(r(`overridesDetailPanel.saveFailedToast`)),f(e,{context:`call_site_overrides_save`})}finally{b(!1)}},[ce,ie,ne,R,n,h,e,r]),xe=(0,Q.useCallback)(async()=>{b(!0);try{let t=V();await h.mutateAsync({path:{assistant_id:e},body:{llm:{callSites:t}}}),n(),q.success(r(`overridesDetailPanel.overridesResetToast`))}catch(e){q.error(r(`overridesDetailPanel.resetFailedToast`)),f(e,{context:`call_site_overrides_reset`})}finally{b(!1)}},[V,n,h,e,r]),Se=(0,$.jsxs)(`div`,{className:`flex items-center justify-end gap-2`,children:[U&&(0,$.jsx)(l,{variant:`outlined`,onClick:()=>S(!0),disabled:y||!P,tintColor:`var(--system-negative-strong)`,className:`mr-auto`,children:r(`overridesDetailPanel.resetToDefaults`)}),(0,$.jsx)(l,{variant:`primary`,onClick:()=>void ye(),loading:y,disabled:!ae||oe||y,children:r(`overridesDetailPanel.save`)})]});return(0,$.jsxs)(be,{title:r(`overridesDetailPanel.title`),closeVariant:`outlined`,onClose:n,footer:Se,children:[(0,$.jsxs)(`div`,{className:`flex flex-col gap-5`,children:[(0,$.jsx)(`p`,{className:`text-body-medium-lighter text-[var(--content-tertiary)]`,children:r(`overridesDetailPanel.description`)}),(0,$.jsxs)(`div`,{className:`flex flex-col gap-5`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(`div`,{className:`min-w-0 flex-1`,children:(0,$.jsx)(G,{type:`search`,value:_,onChange:e=>v(e.target.value),placeholder:r(`overridesDetailPanel.searchPlaceholder`),leftIcon:(0,$.jsx)(sn,{className:`h-4 w-4`}),fullWidth:!0})}),(0,$.jsx)(l,{variant:`outlined`,onClick:()=>w(!0),disabled:!P||y||ae||!pe,title:ae?r(`overridesDetailPanel.bulkChangeUnsavedTitle`):pe?void 0:r(`overridesDetailPanel.bulkChangeNoCandidatesTitle`),children:r(`overridesDetailPanel.bulkChange`)})]}),N&&fe&&(0,$.jsxs)(`div`,{children:[(0,$.jsx)(pn,{children:r(`overridesDetailPanel.advisorSection`)}),(0,$.jsx)(rr,{value:R,profileOptions:de,disabled:y,onChange:B})]}),E&&(0,$.jsx)($e,{placement:`panel`}),O&&(0,$.jsx)(g,{tone:`error`,title:r(`overridesDetailPanel.loadErrorTitle`),actions:(0,$.jsx)(l,{variant:`outlined`,onClick:()=>void k(),children:r(`overridesDetailPanel.retry`)}),children:r(`overridesDetailPanel.loadErrorHint`)}),!E&&!O&&T&&(0,$.jsx)(ur,{groups:ge,drafts:te,buildProfileOptionsForRow:me,profileLabelFor:le,advisorMatchesSearch:fe,connections:A?.connections,onDraftChange:z,onToggle:_e})]})]}),C&&T&&(0,$.jsx)(cr,{assistantId:e,callSites:j,domains:T.domains,persistedOverrides:s,orderedProfiles:c,onClose:()=>w(!1),onApplied:se}),(0,$.jsx)(bt,{open:x,title:r(`overridesDetailPanel.resetToDefaults`),message:r(`overridesDetailPanel.resetConfirmMessage`),confirmLabel:r(`overridesDetailPanel.resetToDefaults`),destructive:!0,onConfirm:()=>{S(!1),xe()},onCancel:()=>S(!1)})]})}var hr=e(Yt(),1);function gr({mode:e,connection:t,assistantId:n,existingNames:i,connections:o,variant:s=`modal`,actionsSlot:c,onSave:u,onCancel:d}){let{t:f}=Y(`settings`),[p,m]=(0,Q.useState)(t?.label??``),h=t?.name??``,g=t?.provider??`anthropic`,_=t?.auth.type??`api_key`,[v,y]=(0,Q.useState)(()=>t?.auth.type===`api_key`?t.auth.credential:t?``:`credential/anthropic/api_key`),[b,x]=(0,Q.useState)(t?.baseUrl??``),[S,C]=(0,Q.useState)(()=>t?.models?t.models.map(e=>e.id).join(`, `):``),[w,T]=(0,Q.useState)(!1),[E,D]=(0,Q.useState)(null),O=g===`openai-compatible`,k=it(g),A=xt(g),[j,M]=(0,Q.useState)(``),[N,P]=(0,Q.useState)(!1),F=Z(),I=(0,Q.useMemo)(()=>Ot(v),[v]),ee=_===`api_key`&&I!==null,{hasStoredCredential:te,isLoading:R}=L({assistantId:n,credentialKind:`credential`,credentialName:I?`${I.service}:${I.field}`:``,enabled:ee}),{credentials:ne}=ye({assistantId:n,enabled:_===`api_key`});(0,Q.useEffect)(()=>{let e=t?.provider??`anthropic`;m(t?.label??``),t?.auth.type===`api_key`?y(t.auth.credential):y(t?``:`credential/${e}/api_key`),D(null),x(t?.baseUrl??``),C(t?.models?t.models.map(e=>e.id).join(`, `):``),M(``),P(!1)},[t]);let re=p.trim()!==(t?.label??``).trim(),ie=O&&re?vt(p,o,t?.name):null,ae=h.trim().length>0&&ie===null;async function oe(){if(ae){T(!0),D(null);try{let e;if(_===`api_key`){let t=v.trim()||`credential/${g}/api_key`,r=j.trim();if(r){P(!0);try{let e=Ot(t);await We({path:{assistant_id:n},body:e?{type:`credential`,name:`${e.service}:${e.field}`,value:r}:{type:`api_key`,name:g,value:r},throwOnError:!0});let i=Dt(n,`credential`,e?`${e.service}:${e.field}`:``);F.setQueryData(i,!0),F.invalidateQueries({queryKey:Ye({path:{assistant_id:n}})})}catch{D(f(`providerEditorContent.failedSaveApiKey`));return}finally{P(!1)}}e={type:`api_key`,credential:t}}else if(t)e=t.auth;else{D(f(`providerEditorContent.nothingToEdit`));return}let r=p.trim()||null,i={auth:e,label:r,...k&&{base_url:b.trim()||null},...A&&{models:S.trim()?S.split(`,`).map(e=>({id:e.trim()})).filter(e=>e.id):null}},{data:a,error:o,response:s}=await we({path:{assistant_id:n,name:t?.name??h.trim()},body:i});if(!s?.ok){D(kt(s?.status,o)??_t(s?.status));return}if(!a){D(f(`providerEditorContent.emptyServerResponse`));return}Je(a,f),u(a)}catch{D(f(`providerEditorContent.failedSaveProvider`))}finally{T(!1)}}}let z=ne.filter(e=>e.service===g),B=e!==`create`&&t?.auth.type===`api_key`,se=z.length>0||B,ce=r(f(`providerEditorContent.apiKeyPlaceholder`),te);if(e===`create`)return(0,$.jsx)(Ve,{variant:s===`panel`?`inline`:`modal`,actionsSlot:c,assistantId:n,existingNames:i,connections:o,defaultProviderType:g,onCreated:u,onCancel:d});let V=(0,$.jsxs)(`div`,{className:`space-y-4`,children:[(0,$.jsxs)(`div`,{className:`space-y-1`,children:[(0,$.jsx)(`label`,{className:`block text-body-small-default text-[var(--content-tertiary)]`,children:(0,$.jsx)(qt,{i18nKey:`providerEditorContent.displayNameLabel`,ns:`settings`,components:{optional:(0,$.jsx)(`span`,{className:`text-[var(--content-disabled)]`})}})}),(0,$.jsx)(G,{value:p,onChange:e=>m(e.target.value),placeholder:f(`providerEditorContent.displayNamePlaceholder`),fullWidth:!0}),ie?(0,$.jsx)(a,{variant:`body-small-default`,as:`p`,className:`text-(--system-negative-strong)`,children:Nt[ie]}):null]}),k&&(0,$.jsxs)(`div`,{className:`space-y-1`,children:[(0,$.jsx)(`label`,{className:`block text-body-small-default text-[var(--content-tertiary)]`,children:f(`providerEditorContent.baseUrlLabel`)}),(0,$.jsx)(G,{value:b,onChange:e=>x(e.target.value),placeholder:f(g===`ollama`?`providerEditorContent.baseUrlPlaceholderOllama`:g===`opencode`?`providerEditorContent.baseUrlPlaceholderOpencode`:`providerEditorContent.baseUrlPlaceholder`),fullWidth:!0}),g===`ollama`?(0,$.jsx)(a,{variant:`body-small-default`,as:`p`,className:`text-[var(--content-tertiary)]`,children:f(`providerEditorContent.baseUrlHintOllama`)}):null,g===`opencode`?(0,$.jsx)(a,{variant:`body-small-default`,as:`p`,className:`text-[var(--content-tertiary)]`,children:f(`providerEditorContent.baseUrlHintOpencode`)}):null]}),A&&(0,$.jsxs)(`div`,{className:`space-y-1`,children:[(0,$.jsx)(`label`,{className:`block text-body-small-default text-[var(--content-tertiary)]`,children:f(`providerEditorContent.modelsLabel`)}),(0,$.jsx)(G,{value:S,onChange:e=>C(e.target.value),placeholder:f(`providerEditorContent.modelsPlaceholder`),fullWidth:!0}),(0,$.jsx)(a,{variant:`body-small-default`,as:`p`,className:`text-[var(--content-tertiary)]`,children:f(`providerEditorContent.modelsHint`)})]}),_===`api_key`&&(0,$.jsx)(Qe,{apiKeyValue:j,onApiKeyChange:M,credential:v,onCredentialChange:y,isLoadingCredential:R,apiKeyPlaceholder:ce,provider:g,providerCredentials:z,showAdvancedSection:se,onError:D}),_===`oauth_subscription`&&(0,$.jsx)(wt,{assistantId:n,onConnected:u}),E&&(0,$.jsx)(a,{variant:`body-small-default`,as:`p`,className:`text-(--system-negative-strong)`,children:E})]}),H=(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(l,{variant:`ghost`,onClick:d,children:f(`providerEditorContent.cancel`)}),(0,$.jsx)(l,{variant:`primary`,disabled:!ae||w||N,onClick:()=>void oe(),children:f(w?`providerEditorContent.saving`:`providerEditorContent.saveChanges`)})]});return s===`panel`?(0,$.jsxs)(`div`,{className:`space-y-4`,children:[V,c===void 0?(0,$.jsx)(`div`,{className:`flex justify-end gap-2`,children:H}):c&&(0,hr.createPortal)(H,c)]}):(0,$.jsxs)(W.Content,{size:`md`,children:[(0,$.jsxs)(W.Header,{children:[(0,$.jsx)(W.Title,{children:f(`providerEditorContent.editProviderTitle`)}),(0,$.jsx)(W.Description,{children:t?f(`providerEditorContent.editingConnection`,{name:Ge(t)}):f(`providerEditorContent.editProviderSettingsFallback`)})]}),(0,$.jsx)(W.Body,{children:V}),(0,$.jsx)(W.Footer,{children:H})]})}function _r({assistantId:e,connectionName:t,onClose:n}){let{t:r}=Y(`settings`),i=Z(),[a,o]=(0,Q.useState)(null),{data:s,isLoading:c}=J(F({path:{assistant_id:e}})),l=(0,Q.useMemo)(()=>s?.connections??[],[s]),u=(0,Q.useMemo)(()=>t==null?void 0:l.find(e=>e.name===t),[t,l]),d=t!=null&&s!=null&&u==null;(0,Q.useEffect)(()=>{d&&n()},[d,n]);function f(){i.invalidateQueries({queryKey:ie({path:{assistant_id:e}})}),i.invalidateQueries({queryKey:gt({path:{assistant_id:e}})}),n()}return(0,$.jsx)(be,{title:u?Ge(u):r(`providerDetailPanel.addProviderTitle`),closeVariant:`outlined`,onClose:n,footer:(0,$.jsx)(`div`,{ref:o,className:`flex justify-end gap-2`}),children:t!=null&&c?(0,$.jsx)($e,{placement:`panel`}):t==null||u!=null?(0,$.jsx)(gr,{mode:u?`edit`:`create`,connection:u,variant:`panel`,actionsSlot:a,assistantId:e,existingNames:l.map(e=>e.name),connections:l,onSave:f,onCancel:n}):null})}var vr={vellum:{provider:`vellum`},deepgram:{provider:`deepgram`,credentialService:`deepgram`},openai:{provider:`openai-whisper`,credentialService:`openai`}},yr={vellum:`vellum`,deepgram:`deepgram`,"openai-whisper":`openai`},br=`deepgram`;function xr({assistantId:e,hideSaveButton:t=!1,hideCredentialsGuide:n=!1,onSaveStateChange:r}={}){let i=yt(),a=e??i,o=He(),s=Z(),{t:c}=Y(),l=(0,Q.useMemo)(()=>ae(nt(),{displayName:c(`sttProviderForm.windowsNativeDisplayName`),subtitle:c(`sttProviderForm.windowsNativeSubtitle`),setupWarning:c(`sttProviderForm.windowsNativeSetupWarning`)}).filter(e=>!e.requiresNativeDictation||Ce()),[c]),u=br,{data:d}=J({...pt({path:{assistant_id:a}}),enabled:o,staleTime:3e4}),f=d?.services?.stt,p=f?.mode===`managed`?`vellum`:f?.provider,m=(0,Q.useMemo)(()=>{let e=p?yr[p]:void 0;if(e&&l.some(t=>t.id===e))return e;let t=V(Oe,u);return l.some(e=>e.id===t)?t:u},[p,l,u]),h=!!p,[g,_]=yn(m),{available:v,currentCode:y,configuredProviderId:b,selectLanguage:x,selecting:S}=at(a),[C,w]=(0,Q.useState)(!1),T=v&&g===m&&(vr[g]?.provider===b||!!p&&!yr[p]),[E,D]=(0,Q.useState)(``),[O,k]=(0,Q.useState)(!1),[A,j]=(0,Q.useState)(!1);(0,Q.useEffect)(()=>{let e=V(Oe,u);e===`macos-native`&&!l.some(t=>t.id===e)&&M(Oe,u)},[l,u]);let N=(0,Q.useMemo)(()=>l.find(e=>e.id===g)??l[0],[l,g]),P=N.apiKeyPlaceholder!==void 0;(0,Q.useEffect)(()=>{k(V(Ht+g,``).length>0),D(``)},[g]);let F=(0,Q.useMemo)(()=>{let e=g!==m,t=E.trim().length>0;return e||t},[g,m,E]),I=(0,Q.useCallback)(async()=>{let e=E.trim();M(Oe,g),e.length>0&&M(Ht+g,e);let t=vr[g];j(!0);try{if(t?.credentialService){let n=e.length>0?e:V(Ht+g,``);if(n.length>0){let{response:e}=await le({path:{assistant_id:a},body:{service:t.credentialService,field:`api_key`,value:n,label:`${N.displayName} API Key`},throwOnError:!1});if(!e?.ok)throw Error(`Failed to store API key (HTTP ${e?.status??`?`})`)}}if(t&&(g!==m||!h)||p===`vellum`&&g!==`vellum`){let e=t?.provider??br,{response:n}=await Bt({path:{assistant_id:a},body:{services:{stt:{provider:e,mode:e===`vellum`?`managed`:`your-own`}}},throwOnError:!1});if(!n?.ok)throw Error(`Failed to save configuration (HTTP ${n?.status??`?`})`)}return e.length>0&&k(!0),D(``),s.invalidateQueries({queryKey:It({path:{assistant_id:a}})}),q.success(c(`sttProviderForm.saveSuccess`)),!0}catch(e){return q.error(e instanceof Error?e.message:c(`sttProviderForm.saveFailed`)),!1}finally{j(!1)}},[a,g,E,N,m,h,p,s,c]);(0,Q.useEffect)(()=>{r?.({hasChanges:F,saving:A,save:I})},[r,F,A,I]);let ee=(0,Q.useCallback)(()=>{M(Ht+g,``),k(!1),D(``)},[g]),L=O?c(`sttProviderForm.apiKeyPlaceholderReplace`):N.apiKeyPlaceholder;return(0,$.jsxs)(`div`,{className:`space-y-4`,children:[(0,$.jsxs)(`div`,{className:`space-y-1`,children:[(0,$.jsx)(`label`,{className:`block text-body-small-default text-[var(--content-tertiary)]`,children:c(`sttProviderForm.providerLabel`)}),(0,$.jsx)(K,{value:g,onChange:_,options:l.map(e=>({value:e.id,label:e.displayName})),"aria-label":c(`sttProviderForm.providerAriaLabel`)})]}),T&&(0,$.jsxs)(`div`,{className:`space-y-1`,children:[(0,$.jsx)(`label`,{className:`block text-body-small-default text-[var(--content-tertiary)]`,children:c(`sttProviderForm.spokenLanguage`)}),(0,$.jsx)(At,{"aria-label":c(`sttProviderForm.spokenLanguage`),"aria-haspopup":`dialog`,onClick:()=>w(!0),value:St(y,b)}),(0,$.jsx)(`p`,{className:`text-body-small-default text-[var(--content-tertiary)]`,children:c(`sttProviderForm.spokenLanguageApplies`)}),(0,$.jsx)(_n,{open:C,onOpenChange:w,title:c(`sttProviderForm.spokenLanguage`),currentCode:y,configuredProviderId:b,selectLanguage:x,selecting:S})]}),P&&(0,$.jsxs)(`div`,{className:`space-y-1`,children:[(0,$.jsx)(`label`,{className:`block text-body-small-default text-[var(--content-tertiary)]`,children:c(`sttProviderForm.apiKeyLabel`)}),(0,$.jsx)(G,{type:`password`,value:E,onChange:e=>D(e.target.value),placeholder:L,fullWidth:!0})]}),N.setupWarning&&(0,$.jsxs)(`div`,{className:`flex items-start gap-2 rounded-lg border border-[var(--border-subtle)] bg-[var(--surface-sunken)] p-3 text-body-small-default text-[var(--content-tertiary)]`,children:[(0,$.jsx)($t,{className:`mt-0.5 h-3.5 w-3.5 shrink-0 text-[var(--system-mid-strong)]`}),(0,$.jsx)(`span`,{children:N.setupWarning})]}),!n&&N.credentialsGuide&&(0,$.jsx)(fn,{guide:N.credentialsGuide}),g===`vellum`&&(0,$.jsx)(`p`,{className:`text-body-medium-lighter text-[var(--content-tertiary)]`,children:c(`sttProviderForm.vellumTranscription`)}),(!t||O)&&(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[!t&&(0,$.jsx)(dn,{onClick:I,disabled:!F||A}),O&&(0,$.jsx)(un,{onClick:ee})]})]})}var Sr={batch:`sttRoleOverrides.role.batch`,dictation:`sttRoleOverrides.role.dictation`,liveVoice:`sttRoleOverrides.role.liveVoice`,telephony:`sttRoleOverrides.role.telephony`,watch:`sttRoleOverrides.role.watch`};function Cr(e){let t=e?.roles;if(!t)return[];let n=e?.provider,r=n?e?.providers?.[n]?.model:void 0,i=[];for(let[e,a]of Object.entries(t)){let t=a?.provider;t&&(t===n&&a?.model===r||i.push({role:e,provider:t,...a?.model===void 0?{}:{model:a.model}}))}return i}function wr({assistantId:e}){let{t}=Y(`settings`),n=Z(),r=He(),[i,a]=(0,Q.useState)(null),{data:o}=J({...pt({path:{assistant_id:e}}),enabled:r,staleTime:3e4}),s=o?.services?.stt,c=Cr(s),{data:u}=J({...De({path:{assistant_id:e}}),enabled:r&&c.length>0,staleTime:5*6e4});if(c.length===0)return null;let d=e=>u?.providers?.find(t=>t.id===e)?.displayName??e,f=async r=>{a(r);try{let{response:t}=await Bt({path:{assistant_id:e},body:{services:{stt:{roles:{[r]:null}}}},throwOnError:!1});if(!t?.ok)throw Error(String(t?.status??``));await n.invalidateQueries({queryKey:It({path:{assistant_id:e}})})}catch{q.error(t(`sttRoleOverrides.clearFailed`))}finally{a(null)}};return(0,$.jsxs)(`div`,{className:`mt-1 flex flex-col gap-2 border-t border-[var(--border-subtle)] pt-4`,children:[(0,$.jsx)(`span`,{className:`text-body-small-default text-[var(--content-tertiary)]`,children:t(`sttRoleOverrides.title`)}),(0,$.jsx)(`ul`,{className:`flex flex-col gap-1`,children:c.map(e=>{let n=Sr[e.role];return(0,$.jsxs)(`li`,{className:`flex items-center gap-4 rounded-md border border-[var(--border-subtle)] bg-[var(--surface-sunken)] px-3 py-2`,children:[(0,$.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-body-medium-lighter text-[var(--content-default)]`,children:n?t(n):e.role}),(0,$.jsx)(`span`,{className:`min-w-0 truncate text-body-small-default text-[var(--content-default)]`,children:e.model?`${d(e.provider)} · ${e.model}`:d(e.provider)}),(0,$.jsx)(l,{variant:`ghost`,size:`compact`,"aria-label":t(`sttRoleOverrides.clearAria`,{feature:n?t(n):e.role}),className:`[--vbtn-fg:var(--content-tertiary)]`,disabled:i===e.role,onClick:()=>void f(e.role),children:t(`sttRoleOverrides.clear`)})]},e.role)})})]})}function Tr(){let{t:e}=Y(`settings`),t=yt();return(0,$.jsxs)(ln,{title:e(`speechToTextCard.title`),subtitle:e(`speechToTextCard.subtitle`),children:[(0,$.jsx)(xr,{}),(0,$.jsx)(wr,{assistantId:t})]})}async function Er(e){let{provider:t,apiKey:n,voiceId:r,text:i}=e;if(n.trim().length===0)return{kind:`error`,message:`Save an API key for this provider first.`};try{return t===`elevenlabs`?await Dr(n,r,i):t===`deepgram`?await Or(n,i):t===`fish-audio`?{kind:`unsupported`,message:`Fish Audio TTS is only supported in the desktop app today. Use ElevenLabs or Deepgram to test from the browser.`}:t===`xai`?{kind:`unsupported`,message:`xAI TTS is only supported in the desktop app today. Use ElevenLabs or Deepgram to test from the browser.`}:{kind:`unsupported`,message:`TTS testing for "${t}" is not supported from the browser yet.`}}catch(e){return{kind:`error`,message:e instanceof Error?e.message:`Failed to reach the TTS provider.`}}}async function Dr(e,t,n){let r=t.trim();if(r.length===0)return{kind:`error`,message:`Enter and save a Voice ID before testing ElevenLabs.`};let i=await fetch(`https://api.elevenlabs.io/v1/text-to-speech/${encodeURIComponent(r)}?output_format=mp3_44100_128`,{method:`POST`,headers:{"xi-api-key":e,"Content-Type":`application/json`,Accept:`audio/mpeg`},body:JSON.stringify({text:n,model_id:`eleven_turbo_v2_5`})});return i.ok?{kind:`audio`,blob:await i.blob()}:{kind:`error`,message:await kr(i,`ElevenLabs rejected the request.`)}}async function Or(e,t){let n=await fetch(`https://api.deepgram.com/v1/speak?model=aura-2-thalia-en`,{method:`POST`,headers:{Authorization:`Token ${e}`,"Content-Type":`application/json`,Accept:`audio/mpeg`},body:JSON.stringify({text:t})});return n.ok?{kind:`audio`,blob:await n.blob()}:{kind:`error`,message:await kr(n,`Deepgram rejected the request.`)}}async function kr(e,t){try{let n=await e.text();if(n.length===0)return`${t} (HTTP ${e.status})`;try{let e=JSON.parse(n);if(e&&typeof e==`object`&&`detail`in e&&typeof e.detail==`string`)return e.detail;if(e&&typeof e==`object`&&`message`in e&&typeof e.message==`string`)return e.message}catch{}return n.slice(0,200)}catch{return`${t} (HTTP ${e.status})`}}function Ar({assistantId:e,value:t,onChange:n,className:r}){let{t:i}=Y(),[a,o]=(0,Q.useState)(!1),{voices:s}=fe(e);if(s.length===0)return null;let c=s.find(e=>e.model===t)??s[0];return(0,$.jsxs)(Lt.Root,{open:a,onOpenChange:o,children:[(0,$.jsx)(Lt.Trigger,{asChild:!0,children:(0,$.jsx)(At,{"aria-label":i(`voicePickerField.ariaLabel`),value:c?v(c.description):i(`voicePickerField.selectVoice`),className:r})}),(0,$.jsx)(Lt.Content,{side:`bottom`,align:`start`,className:`w-[var(--radix-popover-trigger-width)] p-1`,children:(0,$.jsx)(Mt,{assistantId:e,value:t,onChange:n,onSelect:()=>o(!1),showSource:!0,autoScrollToSelected:!0})})]})}var jr={elevenlabs:`voiceId`,"fish-audio":`referenceId`,xai:`voiceId`};function Mr({assistantId:e,hideSaveButton:t=!1,hideCredentialsGuide:n=!1,onSaveStateChange:r}={}){let{t:i}=Y(),a=yt(),o=e??a,s=Ue.use.name()??`your assistant`,c=He(),u=Z(),{data:d}=J({...m({path:{assistant_id:o}}),enabled:c,staleTime:1/0}),f=(0,Q.useMemo)(()=>{let e=d?.providers;if(!e)return _e;if(e.some(e=>e.id===`vellum`))return e;let t=_e.find(e=>e.id===`vellum`);return t?[t,...e]:e},[d]),{data:p}=J({...pt({path:{assistant_id:o}}),enabled:c,staleTime:3e4}),g=p?.services?.tts,_=g?.mode===`managed`?`vellum`:g?.provider,v=`elevenlabs`,y=(0,Q.useMemo)(()=>_??V(`vellum:voice:ttsProvider`,v),[_,v]),b=!!_,[x,S]=yn(y),[C,w]=(0,Q.useState)(``),[T,E]=(0,Q.useState)(``),[D,O]=(0,Q.useState)(``),[k,A]=(0,Q.useState)(!1),[j,N]=(0,Q.useState)(!1),[P,F]=(0,Q.useState)(!1),{voices:I,defaultModel:ee,fetched:L}=dt(o,{enabled:x===`vellum`}),te=g?.providers?.vellum?.model??ee??``,[R,ne]=yn(te),re=I.find(e=>e.model===R)??I[0],[ie,ae]=(0,Q.useState)(null),oe=I.some(e=>e.model===te),z=ie??(L&&te!==``&&!oe),B=(0,Q.useMemo)(()=>f.find(e=>e.id===x)??f[0],[x,f]),se=x===`vellum`&&B.supportsVoiceSelection&&R.trim()!==``&&R.trim()!==te,ce=(0,Q.useCallback)(e=>{let t=V(h+e,``),n=V(Ae+e,``);A(t.length>0),E(n),O(n),w(``)},[]);(0,Q.useEffect)(()=>{ce(x)},[x,ce]);let H=(0,Q.useMemo)(()=>{let e=x!==y,t=C.trim().length>0,n=T.trim()!==D;return e||t||n||se},[x,y,C,T,D,se]),ue=(0,Q.useCallback)(async()=>{let e=C.trim(),t=T.trim(),n=B.id;M(zt,n),e.length>0&&M(h+n,e),M(Ae+n,t);let r=e.length>0?e:V(h+n,``),a=jr[n];F(!0);try{if(r.length>0){let{response:e}=await le({path:{assistant_id:o},body:{service:n,field:`api_key`,value:r,label:`${B.displayName} API Key`},throwOnError:!1});if(!e?.ok)throw Error(`Failed to store API key (HTTP ${e?.status??`?`})`)}let e={...x!==y||!b?{provider:n,mode:n===`vellum`?`managed`:`your-own`}:{},...a?{providers:{[n]:{[a]:t}}}:{},...se?{providers:{vellum:{model:R.trim()}}}:{}};if(Object.keys(e).length>0){let{response:t}=await Bt({path:{assistant_id:o},body:{services:{tts:e}},throwOnError:!1});if(!t?.ok)throw Error(`Failed to save configuration (HTTP ${t?.status??`?`})`)}return A(r.length>0),O(t),w(``),u.invalidateQueries({queryKey:It({path:{assistant_id:o}})}),q.success(i(`ttsProviderForm.saved`)),!0}catch(e){return q.error(e instanceof Error?e.message:i(`ttsProviderForm.saveFailed`)),!1}finally{F(!1)}},[o,x,R,se,C,T,B,y,b,u,i]);(0,Q.useEffect)(()=>{r?.({hasChanges:H,saving:P,save:ue})},[r,H,P,ue]);let de=(0,Q.useCallback)(()=>{M(h+x,``),A(!1),w(``)},[x]),fe=(0,Q.useCallback)(async()=>{N(!0);try{let e=V(h+x,``),t=C.trim(),n=t.length>0?t:e;if(n.length===0){q.error(i(`ttsProviderForm.apiKeyRequired`));return}let r=V(Ae+x,``),a=T.trim(),o=await Er({provider:x,apiKey:n,voiceId:a.length>0?a:r,text:`Hey! It's ${s}. How does this sound?`});if(o.kind!==`audio`){q.error(o.message);return}let c=URL.createObjectURL(o.blob);try{let e=new Audio(c);await e.play(),await new Promise(t=>{e.onended=()=>t(),e.onerror=()=>t()})}finally{URL.revokeObjectURL(c)}}finally{N(!1)}},[s,C,x,T,i]),pe=k?`•••••••• (Enter a new key to replace)`:B.apiKeyPlaceholder,U=x===`vellum`,me=U&&B.supportsVoiceSelection,he=(0,$.jsxs)(l,{variant:`link`,size:`compact`,className:`inline-flex h-auto items-center gap-1 px-0 underline [--vbtn-fg:var(--content-tertiary)]`,onClick:()=>{ae(!1),I.some(e=>e.model===R)||ne(ee||I[0]?.model||``)},children:[(0,$.jsx)(nn,{className:`h-3.5 w-3.5`,"aria-hidden":!0}),i(`ttsProviderForm.chooseFromCatalog`)]}),ge=me&&z&&I.length>0?he:null;return(0,$.jsxs)(`div`,{className:`space-y-4`,children:[(0,$.jsxs)(`div`,{className:`space-y-1`,children:[(0,$.jsx)(`label`,{className:`block text-body-small-default text-[var(--content-tertiary)]`,children:i(`ttsProviderForm.provider`)}),(0,$.jsx)(K,{value:x,onChange:S,options:f.map(e=>({value:e.id,label:e.displayName})),"aria-label":i(`ttsProviderForm.providerAriaLabel`)})]}),!U&&(0,$.jsxs)(`div`,{className:`space-y-1`,children:[(0,$.jsx)(`label`,{className:`block text-body-small-default text-[var(--content-tertiary)]`,children:i(`ttsProviderForm.apiKey`)}),(0,$.jsx)(G,{type:`password`,value:C,onChange:e=>w(e.target.value),placeholder:pe,fullWidth:!0})]}),me&&(0,$.jsxs)(`div`,{className:`space-y-1`,children:[(0,$.jsx)(`label`,{className:`block text-body-small-default text-[var(--content-tertiary)]`,children:i(`ttsProviderForm.voice`)}),z?(0,$.jsx)(G,{type:`text`,value:R,onChange:e=>ne(e.target.value),placeholder:i(`ttsProviderForm.voiceIdPlaceholder`),"aria-label":i(`ttsProviderForm.customVoiceIdAriaLabel`),fullWidth:!0}):re?(0,$.jsx)(Ar,{assistantId:o,value:R,onChange:ne}):L&&(0,$.jsx)(`p`,{className:`text-body-small-default text-[var(--content-tertiary)]`,children:i(`ttsProviderForm.noManagedVoices`)})]}),B.supportsVoiceSelection&&!U&&(0,$.jsxs)(`div`,{className:`space-y-1`,children:[(0,$.jsx)(`label`,{className:`block text-body-small-default text-[var(--content-tertiary)]`,children:i(`ttsProviderForm.voiceId`)}),(0,$.jsx)(G,{type:`text`,value:T,onChange:e=>E(e.target.value),placeholder:i(`ttsProviderForm.voiceIdPlaceholder`),fullWidth:!0})]}),!n&&!U&&(0,$.jsx)(fn,{guide:B.credentialsGuide}),(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[!U&&(0,$.jsx)(l,{variant:`outlined`,onClick:fe,disabled:j,children:i(j?`ttsProviderForm.testing`:`ttsProviderForm.test`)}),(0,$.jsxs)(`div`,{className:`flex items-center gap-3`,children:[ge,!t&&(0,$.jsx)(dn,{onClick:ue,disabled:!H||P}),k&&!U&&(0,$.jsx)(un,{onClick:de})]})]})]})}function Nr(){let{t:e}=Y(`settings`);return(0,$.jsx)(ln,{id:`text-to-speech`,title:e(`textToSpeechCard.title`),subtitle:e(`textToSpeechCard.subtitle`),children:(0,$.jsx)(Mr,{})})}var Pr=`default`;function Fr(){let{t:e}=Y(`settings`),t=yt(),n=Z(),{data:i}=J({...pt({path:{assistant_id:t}}),staleTime:3e4}),a=de({onSuccess:e=>{Xe(n,{path:{assistant_id:t}},e)}}),o=vn(),s=(0,Q.useMemo)(()=>i?i.services?.[`web-fetch`]?.provider||V(`vellum:ai:webFetchProvider`,Pr):V(x,Pr),[i]),c=(0,Q.useMemo)(()=>i?.services?.[`web-fetch`]?.apiBase??``,[i]),[l,u]=(0,Q.useState)(!1),[d,p]=yn(s),[m,h]=yn(c),[g,_]=(0,Q.useState)(``),v=z.has(d),y=H.has(d),{hasStoredCredential:b}=L({assistantId:t,credentialKind:`api_key`,credentialName:d,enabled:y}),S=g.trim().length>0,w=m.trim(),T=Ut(d,v&&w.length>0),E=d!==s||v&&w!==c.trim(),D=l||y&&!T&&!b&&!S||!E&&!S,O=r(ne[d]??e(`webFetchCard.apiKeyPlaceholder`),b),k=me[d]??``,A=(0,Q.useCallback)(async()=>{u(!0);let r=g.trim(),i=y&&r.length>0;try{i&&await o(d,r),await a.mutateAsync({path:{assistant_id:t},body:{services:{"web-fetch":{provider:d,...v?{apiBase:w}:{}}}}}).catch(t=>{throw q.error(e(`webFetchCard.configUpdateFailedToast`)),f(t,{context:`patch_daemon_config`}),t})}catch{u(!1);return}u(!1);try{if(M(x,d),i){let e=Ee(d);e&&M(e,r);let i=Dt(t,`api_key`,d);n.setQueryData(i,!0),n.invalidateQueries({queryKey:i}),_(``)}q.success(e(`webFetchCard.savedToast`))}catch(t){f(t,{context:`settings-ai-web-fetch-persist-local`}),q.error(e(`webFetchCard.localPreferencesFailedToast`))}},[y,a,o,n,t,g,d,v,w,e]),j=(0,Q.useCallback)(()=>{let e=Ee(d);e&&U(e),_(``),h(``),p(Pr),M(x,Pr)},[d,p,h]);return(0,$.jsx)(ln,{id:`web-fetch`,title:e(`webFetchCard.title`),subtitle:e(`webFetchCard.subtitle`),children:(0,$.jsxs)(`div`,{className:`space-y-4`,children:[(0,$.jsxs)(`div`,{className:`space-y-1`,children:[(0,$.jsx)(`label`,{className:`block text-body-small-default text-[var(--content-tertiary)]`,children:e(`webFetchCard.providerLabel`)}),(0,$.jsx)(K,{value:d,onChange:p,options:N.map(e=>({value:e,label:C[e]??e}))})]}),v&&(0,$.jsxs)(`div`,{className:`space-y-1`,children:[(0,$.jsx)(G,{label:e(`webFetchCard.apiBaseLabel`),type:`url`,value:m,onChange:e=>h(e.target.value),placeholder:k||e(`webFetchCard.apiBasePlaceholder`),fullWidth:!0}),k?(0,$.jsx)(`p`,{className:`text-body-small-lighter text-[var(--content-tertiary)]`,children:e(`webFetchCard.apiBaseHint`,{defaultBase:k})}):null]}),y&&(0,$.jsx)(G,{label:e(`webFetchCard.apiKeyLabel`),type:`password`,value:g,onChange:e=>_(e.target.value),placeholder:O,fullWidth:!0}),(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(dn,{onClick:A,disabled:D}),l&&(0,$.jsx)(rn,{className:`h-4 w-4 animate-spin text-[var(--content-disabled)]`}),y&&(0,$.jsx)(un,{onClick:j,filled:!0})]})]})})}var Ir=`0.10.12`;function Lr(){return s(Ir)}function Rr(){let{t:e}=Y(`settings`),t=yt(),n=Z(),i=He(),{data:a}=J({...pt({path:{assistant_id:t}}),enabled:i,staleTime:3e4}),s=de({onSuccess:e=>{Xe(n,{path:{assistant_id:t}},e)}}),c=vn(),l=(0,Q.useMemo)(()=>{if(!a)return V(y,`inference-provider-native`);let e=a.services?.[`web-search`];return(e?.mode===`managed`&&e?.provider!==`inference-provider-native`?`vellum`:e?.provider)||V(`vellum:ai:webSearchProvider`,`inference-provider-native`)},[a]),u=(0,Q.useMemo)(()=>a?.services?.[`web-search`]?.apiBase??``,[a]),[d,m]=(0,Q.useState)(!1),[h,g]=yn(l),[v,x]=yn(u),[S,C]=(0,Q.useState)(``),w=ke.has(h),T=b.has(h),E=_.has(h),{hasStoredCredential:D}=L({assistantId:t,credentialKind:`api_key`,credentialName:h,enabled:T}),O=S.trim().length>0,k=v.trim(),A=Ut(h,w&&k.length>0),j=h!==l||w&&k!==u.trim(),N=ue[h]??``,P=T&&!E&&!A&&!D&&!O,F=w&&N.length===0&&!k,I=d||P||F||!j&&!O,ee=r(ot[h]??e(`webSearchCard.apiKeyPlaceholder`),D),te=(0,Q.useCallback)(async()=>{m(!0);let r=S.trim(),i=p(h),a=T&&r.length>0;try{a&&await c(h,r),await he();let n=h===`vellum`?Lr()?{provider:`vellum`,mode:`managed`}:{mode:`managed`}:{provider:h,mode:`your-own`,...w?{apiBase:k}:{}};await s.mutateAsync({path:{assistant_id:t},body:{services:{"web-search":n}}}).catch(t=>{throw q.error(e(`webSearchCard.configUpdateFailedToast`)),f(t,{context:`patch_daemon_config`}),t})}catch{m(!1);return}m(!1);try{if(M(y,h),a){i&&M(i,r);let e=Dt(t,`api_key`,h);n.setQueryData(e,!0),n.invalidateQueries({queryKey:e}),C(``)}q.success(e(`webSearchCard.savedToast`))}catch(t){f(t,{context:`settings-ai-web-search-persist-local`}),q.error(e(`webSearchCard.localPreferencesFailedToast`))}},[T,s,c,n,t,S,h,w,k,e]),R=(0,Q.useCallback)(()=>{let e=p(h);e&&U(e),C(``),x(``),g(`inference-provider-native`),M(y,`inference-provider-native`)},[h,g,x]);return(0,$.jsx)(ln,{title:e(`webSearchCard.title`),subtitle:e(`webSearchCard.subtitle`),children:(0,$.jsxs)(`div`,{className:`space-y-4`,children:[(0,$.jsxs)(`div`,{className:`space-y-1`,children:[(0,$.jsx)(`label`,{className:`block text-body-small-default text-[var(--content-tertiary)]`,children:e(`webSearchCard.providerLabel`)}),(0,$.jsx)(K,{"aria-label":e(`webSearchCard.providerAriaLabel`),value:h,onChange:g,options:o.map(e=>({value:e,label:ut[e]??e}))})]}),h===`vellum`&&(0,$.jsx)(`p`,{className:`text-body-medium-lighter text-[var(--content-tertiary)]`,children:e(`webSearchCard.vellumNote`)}),w&&(0,$.jsxs)(`div`,{className:`space-y-1`,children:[(0,$.jsx)(G,{label:e(`webSearchCard.apiBaseLabel`),type:`url`,value:v,onChange:e=>x(e.target.value),placeholder:N||e(`webSearchCard.apiBasePlaceholder`),fullWidth:!0}),N?(0,$.jsx)(`p`,{className:`text-body-small-lighter text-[var(--content-tertiary)]`,children:e(`webSearchCard.apiBaseHint`,{defaultBase:N})}):null]}),T&&(0,$.jsx)(G,{label:e(`webSearchCard.apiKeyLabel`),type:`password`,value:S,onChange:e=>C(e.target.value),placeholder:ee,fullWidth:!0}),(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(dn,{onClick:te,disabled:I}),d&&(0,$.jsx)(rn,{className:`h-4 w-4 animate-spin text-[var(--content-disabled)]`}),T&&(0,$.jsx)(un,{onClick:R,filled:!0})]})]})})}function zr(){let e=yt(),t=ze(),[n,r]=(0,Q.useState)(null);(0,Q.useEffect)(()=>{let e=window.location.hash.slice(1);e&&requestAnimationFrame(()=>{document.getElementById(e)?.scrollIntoView({block:`start`})})},[]);let i=(0,$.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-5 overflow-y-auto`,children:[(0,$.jsx)(tr,{}),(0,$.jsx)($n,{panel:n,onOpenPanel:r,onClosePanel:()=>r(null)}),(0,$.jsx)(Rr,{}),(0,$.jsx)(Fr,{}),(0,$.jsx)(wn,{}),(0,$.jsx)(Nr,{}),(0,$.jsx)(Tr,{})]}),a=`${e??`none`}:${n?.kind===`profile`?`profile:${n.name}`:n?.kind===`provider`?`provider:${n.name}`:n?.kind??`closed`}`,o=n?.kind===`provider`||n?.kind===`add-provider`,s=n!=null&&e?n.kind===`overrides`?(0,$.jsx)(mr,{assistantId:e,onClose:()=>r(null)},a):o?(0,$.jsx)(_r,{assistantId:e,connectionName:n.kind===`provider`?n.name:null,onClose:()=>r(null)},a):(0,$.jsx)(nr,{assistantId:e,profileName:n.kind===`profile`?n.name:null,onClose:()=>r(null)},a):null;return s&&t?(0,$.jsx)(mn,{children:s}):s?(0,$.jsx)(gn,{storageKey:`aiSettingsDetailDrawerWidth`,detailKey:a,section:i,detail:s}):i}export{zr as AiPage};
|
|
1
|
+
import{o as e}from"./rolldown-runtime-BM3Ffeng.js";import{$ as t,$S as n,$f as r,$m as i,AC as a,Ab as o,Ag as s,As as c,BC as l,Bb as u,Bf as d,CS as f,Cb as p,Cm as m,Cs as h,DC as g,Db as _,Do as v,Ds as y,Eb as b,Es as x,FC as S,Fb as C,Fm as w,Fp as T,Fs as E,Gb as D,HC as O,Hb as k,Hf as A,Hi as j,IS as M,Ib as N,If as P,Ip as F,Is as I,J as ee,Jm as L,KS as te,Kb as R,Lb as ne,Lf as re,Lp as ie,Ls as ae,Lv as oe,Mb as z,Ms as B,My as se,NC as ce,NS as V,Nb as H,Nv as le,Ob as ue,Om as de,Oo as fe,Os as pe,PS as U,Pb as me,Pg as he,Pp as ge,Ps as _e,Q as ve,Qf as ye,Qn as be,Rb as xe,Rf as Se,Rs as Ce,Rv as we,SC as Te,Sb as Ee,Sm as De,Ss as Oe,Tb as ke,Ts as Ae,Ub as je,Uf as Me,Ui as Ne,Vb as Pe,Vf as Fe,Wb as Ie,X as Le,Y as Re,Yl as ze,Z as Be,Zf as Ve,Zm as He,Zx as Ue,_y as We,ah as Ge,bb as Ke,bs as qe,cC as W,ch as Je,dm as Ye,dp as Xe,eh as Ze,ep as Qe,er as $e,fp as et,gC as G,hC as tt,hg as nt,hp as rt,iC as K,ih as it,it as at,jb as ot,jg as st,js as ct,kS as lt,kb as ut,ko as dt,lm as ft,lp as pt,mC as mt,mn as ht,mp as gt,nh as _t,np as vt,nt as yt,oC as bt,oh as xt,ot as St,pp as Ct,pv as wt,q as Tt,qb as Et,qm as Dt,rh as Ot,sC as q,sh as kt,st as At,th as jt,tn as Mt,tp as Nt,ty as Pt,um as Ft,up as It,vC as Lt,wb as Rt,ws as zt,wv as Bt,xb as Vt,xs as Ht,yb as Ut,ys as Wt,zb as Gt,zf as Kt}from"./app-XG_RF2yi.js";import{$n as J,E as Y,O as qt,Xn as Jt,j as X,nr as Z}from"./vendor-DwMhK7fD.js";import{b as Yt,t as Xt,x as Zt}from"./react-B9IgSVeK.js";import{A as Qt,D as $t,Lt as en,Ui as tn,Xn as nn,Yn as rn,Zr as an,fr as on,vt as sn}from"./icons-C0wyat6T.js";import{t as cn}from"./ellipsis-vertical-Bg7ccW1x.js";import{i as ln,n as un,r as dn,t as fn}from"./service-form-controls-DtPD00wU.js";import{o as pn}from"./detail-primitives-wlzeidYY.js";import{d as mn,o as hn,u as gn}from"./schedules-B_xQSD0K.js";import{t as _n}from"./stt-language-picker-modal-oMpmGSKQ.js";var Q=e(Zt(),1);function vn(){let e=yt();return(0,Q.useCallback)(async(t,n)=>{try{let{data:r}=await We({path:{assistant_id:e},body:{value:n,type:`api_key`,name:t},throwOnError:!0});Ke(r)}catch(e){throw e instanceof Error&&e.message===`No assistant found`?q.error(X(`settings:useDaemonConfig.assistantNotReadyToast`)):q.error(X(`settings:useDaemonConfig.saveApiKeyFailedToast`,{providerName:t})),f(e,{context:`provision_provider_key`}),e}},[e])}function yn(e){let[t,n]=(0,Q.useState)(void 0);return(0,Q.useEffect)(()=>{t!==void 0&&e===t.value&&n(void 0)},[e,t]),[t===void 0?e:t.value,(0,Q.useCallback)(e=>n(e===void 0?void 0:{value:e}),[])]}var bn=`0.11.0`;function xn(){return s(bn)}var $=Xt(),Sn=`gemini-3.1-flash-image-preview`;function Cn(e,t){return e===`openrouter`?`openrouter`:I(t)}function wn(){let{t:e}=Y(`settings`),t=yt(),n=Z(),i=He(),{data:a}=J({...pt({path:{assistant_id:t}}),enabled:i,staleTime:3e4}),o=de({onSuccess:e=>{Xe(n,{path:{assistant_id:t}},e)}}),s=vn(),l=a?.services?.[`image-generation`],u=(0,Q.useMemo)(()=>a?l?.mode===`managed`?`vellum`:l?.provider||V(`vellum:ai:imageGenProvider`,`gemini`):V(qe,`gemini`),[a,l?.mode,l?.provider]),[d,p]=yn(u),[m,h]=(0,Q.useState)(()=>V(Wt,Sn)),[g,_]=(0,Q.useState)(null),v=u===`openrouter`&&typeof l?.model==`string`?l.model:void 0,y=g??v??V(`vellum:ai:imageGenModel`,`google/gemini-3.1-flash-image-preview`),b=d===`openrouter`,x=E(d),S=b?y.trim()||`google/gemini-3.1-flash-image-preview`:x.includes(m)?m:x[0]??Sn,[C,w]=(0,Q.useState)(``),[T,D]=(0,Q.useState)(!1),O=ct.map(e=>({value:e,label:B[e]??e})),k=(0,Q.useMemo)(()=>E(d).map(e=>({value:e,label:c[e]??e})),[d]),A=d===`gemini`||d===`openai`||d===`openrouter`,{hasStoredCredential:j}=L({assistantId:t,credentialKind:`api_key`,credentialName:d,enabled:A}),N=(0,Q.useCallback)(e=>{p(e),e===`openrouter`&&g===null&&_(v??`google/gemini-3.1-flash-image-preview`)},[g,v,p]),P=(0,Q.useCallback)(async()=>{D(!0);let r=C.trim(),i=A&&r.length>0;try{await he(),i&&await s(Cn(d,S),r);let a=d===`vellum`&&!xn()?{mode:`managed`}:{provider:d,mode:d===`vellum`?`managed`:`your-own`};await o.mutateAsync({path:{assistant_id:t},body:{services:{"image-generation":a}}}).catch(t=>{throw q.error(e(`imageGenerationCard.configUpdateFailedToast`)),f(t,{context:`patch_daemon_config`}),t});try{await Pt({path:{assistant_id:t},body:{modelId:S},throwOnError:!0})}catch(t){throw q.error(e(`imageGenerationCard.modelUpdateFailedToast`)),f(t,{context:`set_image_gen_model`}),t}finally{n.invalidateQueries({queryKey:It({path:{assistant_id:t}})})}}catch{D(!1);return}D(!1);try{if(M(qe,d),M(Wt,S),i){let e=Dt(t,`api_key`,d);n.setQueryData(e,!0),n.invalidateQueries({queryKey:e}),w(``)}q.success(e(`imageGenerationCard.savedToast`))}catch(t){f(t,{context:`settings-ai-image-gen-persist-local`}),q.error(e(`imageGenerationCard.localPreferencesFailedToast`))}},[C,d,A,S,t,o,s,n,e]),F=(0,Q.useCallback)(()=>{if(w(``),d===`openrouter`){_(pe),M(Wt,pe);return}h(Sn),M(Wt,Sn)},[d]),I=e(d===`openai`?`imageGenerationCard.openaiApiKeyPlaceholder`:d===`openrouter`?`imageGenerationCard.openrouterApiKeyPlaceholder`:`imageGenerationCard.geminiApiKeyPlaceholder`);return(0,$.jsx)(ln,{title:e(`imageGenerationCard.title`),subtitle:e(`imageGenerationCard.subtitle`),children:(0,$.jsxs)(`div`,{className:`space-y-4`,children:[(0,$.jsxs)(`div`,{className:`space-y-1`,children:[(0,$.jsx)(`label`,{className:`block text-body-small-default text-[var(--content-tertiary)]`,children:e(`imageGenerationCard.providerLabel`)}),(0,$.jsx)(K,{"aria-label":e(`imageGenerationCard.providerAriaLabel`),value:d,onChange:N,options:O})]}),d===`vellum`&&(0,$.jsx)(`p`,{className:`text-body-medium-lighter text-[var(--content-tertiary)]`,children:e(`imageGenerationCard.vellumNote`)}),A&&(0,$.jsx)(G,{label:e(`imageGenerationCard.apiKeyLabel`),type:`password`,value:C,onChange:e=>w(e.target.value),placeholder:r(I,j),fullWidth:!0}),(0,$.jsxs)(`div`,{className:`space-y-1`,children:[(0,$.jsx)(`label`,{className:`block text-body-small-default text-[var(--content-tertiary)]`,children:e(`imageGenerationCard.activeModelLabel`)}),b?(0,$.jsx)(G,{"aria-label":e(`imageGenerationCard.modelAriaLabel`),value:y,onChange:e=>_(e.target.value),placeholder:e(`imageGenerationCard.openrouterModelPlaceholder`),fullWidth:!0}):(0,$.jsx)(K,{"aria-label":e(`imageGenerationCard.modelAriaLabel`),value:S,onChange:h,options:k})]}),(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(dn,{onClick:P,disabled:T}),T&&(0,$.jsx)(rn,{className:`h-4 w-4 animate-spin text-[var(--content-disabled)]`}),A&&(0,$.jsx)(un,{onClick:F})]})]})})}function Tn({title:e,count:t,action:n,children:r}){return(0,$.jsxs)(`section`,{className:`rounded-xl border border-[var(--border-hover)] bg-[var(--surface-overlay)] px-3 py-4`,children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,$.jsxs)(`div`,{className:`flex items-baseline gap-2`,children:[(0,$.jsx)(a,{variant:`body-large-default`,as:`h3`,className:`text-[var(--content-secondary)]`,children:e}),t==null?null:(0,$.jsxs)(a,{variant:`body-large-default`,as:`span`,"aria-label":`${t} ${e.toLowerCase()}`,className:`text-[var(--content-disabled)]`,children:[`·`,` `,t]})]}),n]}),r==null?null:(0,$.jsx)(`div`,{className:`mt-4 border-t border-[var(--border-base)]`,children:r})]})}function En(e){return e.scheduleNames.length>0||e.deferredReminderCount>0||e.scheduleLookupFailed}var Dn=5;function On({title:e,items:t,mono:n}){return(0,$.jsxs)(`div`,{className:`space-y-1`,children:[(0,$.jsx)(a,{variant:`body-small-default`,as:`p`,className:`text-(--content-tertiary)`,children:e}),(0,$.jsx)(`ul`,{className:`space-y-1 pl-1`,children:t.map(e=>(0,$.jsxs)(`li`,{className:`text-body-small-default text-(--content-secondary)`,children:[`• `,n?(0,$.jsx)(`code`,{children:e}):e]},e))})]})}function kn(e){let t=e.label||e.name,n=[];e.isActive&&n.push(X(`settings:manageProfilesBlockedDeleteModal.clauseDefaultProfile`)),e.callSiteIds.length>0&&n.push(X(`settings:manageProfilesBlockedDeleteModal.clauseActionOverrides`,{count:e.callSiteIds.length}));let r=e.scheduleNames.length,i=e.deferredReminderCount;return r>0&&i>0?n.push(X(`settings:manageProfilesBlockedDeleteModal.clauseRunsBoth`,{schedules:r,reminders:i})):r>0?n.push(X(`settings:manageProfilesBlockedDeleteModal.clauseRunsSchedules`,{count:r})):i>0&&n.push(X(`settings:manageProfilesBlockedDeleteModal.clauseRunsReminders`,{count:i})),n.length===0?X(`settings:manageProfilesBlockedDeleteModal.summaryNoReferences`,{display:t}):n.length===1?X(`settings:manageProfilesBlockedDeleteModal.summaryOneClause`,{display:t,clause1:n[0]}):n.length===2?X(`settings:manageProfilesBlockedDeleteModal.summaryTwoClauses`,{display:t,clause1:n[0],clause2:n[1]}):X(`settings:manageProfilesBlockedDeleteModal.summaryThreeClauses`,{display:t,clause1:n[0],clause2:n[1],clause3:n[2]})}function An({blocked:e,availableReplacements:t,replacement:n,onReplacementChange:r,error:i,saving:o,onClose:s,onConfirm:c}){let{t:u}=Y(`settings`),d=e?.scheduleNames??[],f=d.slice(0,Dn),p=d.length-f.length,m=e!=null&&En(e);return(0,$.jsx)(W.Root,{open:e!==null,onOpenChange:e=>{e||s()},children:(0,$.jsxs)(W.Content,{size:`sm`,children:[(0,$.jsx)(W.Header,{children:(0,$.jsx)(W.Title,{children:u(`manageProfilesBlockedDeleteModal.title`)})}),(0,$.jsxs)(W.Body,{className:`space-y-4`,children:[e&&(0,$.jsx)(a,{variant:`body-medium-default`,as:`p`,children:kn(e)}),e&&e.callSiteIds.length>0&&(0,$.jsx)(On,{title:u(`manageProfilesBlockedDeleteModal.actionOverridesTitle`),items:e.callSiteIds,mono:!0}),f.length>0&&(0,$.jsxs)(`div`,{className:`space-y-1`,children:[(0,$.jsx)(On,{title:u(`manageProfilesBlockedDeleteModal.schedulesTitle`),items:f}),p>0&&(0,$.jsx)(a,{variant:`body-small-default`,as:`p`,className:`pl-1 text-(--content-tertiary)`,children:u(`manageProfilesBlockedDeleteModal.moreSchedules`,{count:p})})]}),e?.scheduleLookupFailed&&(0,$.jsx)(a,{variant:`body-small-default`,as:`p`,className:`text-(--system-mid-strong)`,children:u(`manageProfilesBlockedDeleteModal.scheduleLookupFailed`)}),(0,$.jsxs)(`div`,{className:`space-y-1`,children:[(0,$.jsx)(`label`,{className:`block text-body-small-default text-(--content-tertiary)`,children:u(`manageProfilesBlockedDeleteModal.replacementLabel`)}),(0,$.jsx)(K,{"aria-label":u(`manageProfilesBlockedDeleteModal.replacementLabel`),value:n,onChange:r,placeholder:u(`manageProfilesBlockedDeleteModal.replacementPlaceholder`),options:t.map(e=>{let t=m&&e.status===`disabled`;return{value:e.name,label:Re(e),disabled:t,tooltip:t?u(`manageProfilesBlockedDeleteModal.disabledTargetTooltip`):void 0}})})]}),i&&(0,$.jsx)(a,{variant:`body-small-default`,as:`p`,className:`text-(--system-negative-strong)`,children:i})]}),(0,$.jsxs)(W.Footer,{children:[(0,$.jsx)(l,{variant:`ghost`,size:`compact`,onClick:s,children:u(`manageProfilesBlockedDeleteModal.cancel`)}),(0,$.jsx)(l,{variant:`primary`,size:`compact`,disabled:!n||o,onClick:c,children:u(o?`manageProfilesBlockedDeleteModal.saving`:`manageProfilesBlockedDeleteModal.reassignAndDelete`)})]})]})})}function jn({profile:e,isActiveProfile:t,selected:n,connections:r,deletePending:i=!1,onOpen:a,onMakeActive:o,onSetStatus:s,onDelete:c}){let{t:u}=Y(`settings`),d=e.source===`managed`,f=e.status===`disabled`,p=e.label??e.name,m=[];e.name===`auto`&&d?m.push(u(`profileRow.autoRouting`)):e.model&&m.push(Kt(e.provider??void 0,e.model,r)),d&&m.push(u(`profileRow.managedByVellum`));let h=e.availability,g=e.config_issue,_=g!=null||h?.status===`incomplete`,v=h?.message??u(`profileRow.providerUnavailableDefault`),y=g==null?h!=null&&h.status!==`ok`?_?u(`profileRow.providerUnavailableFixable`,{message:v}):v:null:u(`profileRow.providerUnavailableFixable`,{message:u(g.code===`over_output_cap`?`profileRow.configIssueOverOutputCap`:g.code===`no_input_room`?`profileRow.configIssueNoInputRoom`:`profileRow.configIssueModelUnknown`)});return(0,$.jsx)(te,{title:(0,$.jsx)(`span`,{className:f?`opacity-55`:void 0,children:p}),subtitle:m.length>0?m.join(` • `):void 0,onClick:a,showChevron:!1,selected:n,disabled:i,contentAriaLabel:u(`profileRow.openProfileAriaLabel`,{displayName:p}),trailingInteractive:!0,trailing:(0,$.jsxs)($.Fragment,{children:[y==null?null:(0,$.jsx)(O,{content:y,children:_?(0,$.jsx)(`button`,{type:`button`,onClick:a,"aria-label":y,className:`inline-flex cursor-pointer rounded-sm p-0.5 keyboard-focus:ring-2 keyboard-focus:ring-[var(--ring)]`,children:(0,$.jsx)(tn,{className:`h-4 w-4 text-[var(--system-mid-strong)]`,"aria-hidden":`true`})}):(0,$.jsx)(`span`,{className:`inline-flex p-0.5`,tabIndex:0,children:(0,$.jsx)(tn,{className:`h-4 w-4 text-[var(--system-mid-strong)]`,"aria-label":y,role:`img`})})}),f?(0,$.jsx)(Te,{tone:`neutral`,children:u(`profileRow.disabledTag`)}):null,t?(0,$.jsx)(Te,{tone:`positive`,children:u(`profileRow.defaultTag`)}):null,(0,$.jsxs)(S.Root,{children:[(0,$.jsx)(S.Trigger,{asChild:!0,children:(0,$.jsx)(l,{variant:`ghost`,size:`compact`,iconOnly:(0,$.jsx)(cn,{}),"aria-label":u(`profileRow.actionsAriaLabel`,{displayName:p}),disabled:i})}),(0,$.jsxs)(S.Content,{align:`end`,sideOffset:4,children:[(0,$.jsx)(S.Item,{onSelect:a,children:u(d?`profileRow.view`:`profileRow.edit`)}),!t&&!f&&Ie(e.provider,e.model)?(0,$.jsx)(S.Item,{onSelect:o,children:u(`profileRow.makeDefault`)}):null,f?(0,$.jsx)(S.Item,{onSelect:()=>s(!0),children:u(`profileRow.enable`)}):d?null:(0,$.jsx)(S.Item,{onSelect:()=>s(!1),children:u(`profileRow.disable`)}),d?null:(0,$.jsx)(S.Item,{onSelect:c,className:ce.anchored,children:u(`profileRow.delete`)})]})]})]})})}function Mn(e,t){let n=j(),{data:r}=J({...ge({path:{assistant_id:e}}),enabled:n,staleTime:3e4}),{profiles:i,profileOrder:a}=ht(t?.llm,e);return(0,Q.useMemo)(()=>r==null?{entries:Vt(i,a).map(e=>({name:e.name,label:e.label??null,provider:e.provider??null,model:e.model??null,status:e.status===`disabled`?`disabled`:`active`,source:e.source===`managed`?`managed`:`user`,provider_connection:e.provider_connection,availability:null})),isEffectiveCatalog:!1}:{entries:r.profiles,isEffectiveCatalog:!0},[r,i,a])}var Nn=`0.10.8`;function Pn(e){return st(Nn,e)}var Fn=`settings-ai-profile-make-active`,In=`Failed to set the active profile. Please try again.`;function Ln(e){let t=re(),n=Z(),r=Pn(e),i=w({onSuccess:()=>{n.invalidateQueries({queryKey:It({path:{assistant_id:e}})}),n.invalidateQueries({queryKey:T({path:{assistant_id:e}})})}});async function a(n,r,i){try{await t.mutateAsync({path:{assistant_id:e},body:{llm:n}})}catch(e){throw f(e,{context:r}),q.error(i),e}}async function o(t){if(!r){await a({activeProfile:t},Fn,In);return}try{await i.mutateAsync({path:{assistant_id:e},body:{name:t}})}catch(e){let t=lt(e);throw q.error(t??In),t||f(e,{context:Fn}),e}}return{makeActive:o,setStatus:(e,t)=>a({profiles:{[e]:{status:t?`active`:`disabled`}}},`settings-ai-profile-toggle`,`Failed to update the profile. Please try again.`),deleteProfile:(e,t,n)=>a({profiles:{[e]:null},profileOrder:t.filter(t=>t!==e),...n?.isAdvisor?{advisorProfile:null}:{}},`settings-ai-profile-delete`,`Failed to delete the profile. Please try again.`),patchLlm:a,isPending:t.isPending||i.isPending}}var Rn=`The profile was not deleted.`,zn=`Failed to move the schedules. ${Rn}`;function Bn(e){let t=lt(e);return t?`${/[.!?]$/.test(t)?t:`${t}.`} ${Rn}`:zn}function Vn(e,n,r){let i=Ln(e),a=Z(),o=t(),s=n?.llm?.activeProfile??null,c=n?.llm?.advisorProfile??null,l=n?.llm?.callSites??{},u=(0,Q.useMemo)(()=>n?.llm?.profiles??{},[n?.llm?.profiles]),d=(0,Q.useMemo)(()=>n?.llm?.profileOrder??[],[n?.llm?.profileOrder]),p=(0,Q.useMemo)(()=>Vt(u,d),[u,d]),[m,h]=(0,Q.useState)(null),[g,_]=(0,Q.useState)(null),[v,y]=(0,Q.useState)(``),[b,x]=(0,Q.useState)(!1),[S,C]=(0,Q.useState)(null),w=(0,Q.useRef)(!1);function T(e){return p.filter(t=>t.name===e?!1:t.status===`disabled`?!0:Tt(t,p,{requireOwnProviderAndModel:o}))}function E(e,t){let n=T(e).filter(e=>!t||e.status!==`disabled`),r=n.find(e=>e.name===s),i=n.find(e=>e.source!==`managed`);return(r??i??n[0])?.name??``}async function D(e){try{await i.deleteProfile(e,d,{isAdvisor:e===c}),r?.onDeleted?.(e)}catch{}}async function O(t){let n=u[t]?.label??t,r=t===s,i=Object.entries(l).filter(([e,n])=>e!==`mainAgent`&&n?.profile===t).map(([e])=>e),o=[],c=0,d=!1;try{let n=(await a.fetchQuery({...ft({path:{assistant_id:e},query:{inference_profile:t,include_all:`true`}}),retry:!1,staleTime:0})).schedules??[];o=n.filter(e=>!e.isDeferred).map(e=>e.name),c=n.filter(e=>e.isDeferred).length}catch(e){f(e,{context:`settings-ai-profile-delete-schedule-scan`}),d=!0}if(!(r||i.length>0||o.length>0||c>0)&&!d){await D(t);return}let p={name:t,label:n,isActive:r,callSiteIds:i,scheduleNames:o,deferredReminderCount:c,scheduleLookupFailed:d};h(p),y(E(t,En(p))),_(null)}function k(e){n==null||w.current||(w.current=!0,C(e),O(e).finally(()=>{w.current=!1,C(null)}))}async function A(){if(!m||!v)return;if(x(!0),_(null),En(m))try{await hn(e,m.name,v),await a.invalidateQueries({queryKey:Ft({path:{assistant_id:e}})})}catch(e){f(e,{context:`settings-ai-profile-reassign-schedules`}),_(Bn(e)),x(!1);return}let t={};if(m.isActive&&(t.activeProfile=v),m.callSiteIds.length>0){let e={};for(let t of m.callSiteIds)e[t]={profile:v};t.callSites=e}if(Object.keys(t).length>0)try{await i.patchLlm(t,`settings-ai-profile-reassign-delete`,`Failed to reassign references. Please try again.`)}catch{_(`Failed to reassign references. Please try again.`),x(!1);return}let n=m.name;h(null),x(!1),D(n)}return{requestDelete:k,pendingDeleteName:S,blockedDeleteModalProps:{blocked:m,availableReplacements:T(m?.name??null),replacement:v,onReplacementChange:y,error:g,saving:b,onClose:()=>{h(null),_(null)},onConfirm:()=>void A()}}}function Hn(){}function Un({assistantId:e,config:t,connections:n,selectedProfileName:r,onOpenProfile:i,onCreateProfile:o,onProfileDeleted:s}){let{t:c}=Y(`settings`),{entries:u}=Mn(e,t),d=Ln(e),f=Vn(e,t,{onDeleted:s}),p=t?.llm?.activeProfile??null;return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(Tn,{title:c(`profilesSection.title`),action:(0,$.jsx)(l,{variant:`primary`,onClick:o,leftIcon:(0,$.jsx)(en,{}),disabled:t==null,children:c(`profilesSection.createProfile`)}),children:t==null?(0,$.jsx)(a,{variant:`body-medium-lighter`,as:`p`,className:`py-4 text-center text-(--content-tertiary)`,children:c(`profilesSection.loading`)}):u.length===0?(0,$.jsx)(a,{variant:`body-medium-lighter`,as:`p`,className:`py-4 text-center text-(--content-tertiary)`,children:c(`profilesSection.emptyState`)}):u.map(e=>(0,$.jsx)(jn,{profile:e,isActiveProfile:e.name===p,selected:e.name===r,connections:n,deletePending:f.pendingDeleteName===e.name,onOpen:()=>i(e.name),onMakeActive:()=>void d.makeActive(e.name).catch(Hn),onSetStatus:t=>void d.setStatus(e.name,t).catch(Hn),onDelete:()=>f.requestDelete(e.name)},e.name))}),(0,$.jsx)(An,{...f.blockedDeleteModalProps})]})}var Wn={anthropic:!0,openai:!0,gemini:!0,fireworks:!0,openrouter:!0,chatgpt:!0,vellum:!0,together:!0,"vercel-ai-gateway":!0,minimax:!0,atlascloud:!0,baseten:!0,poolside:!0};function Gn(e){return e in Wn}function Kn(e){if(!e.baseUrl)return null;try{return new URL(e.baseUrl).host}catch{return e.baseUrl}}function qn(e){let t=Kn(e)??``,n=[];t&&n.push(t);let r=e.models?.length??0;return r>0&&n.push(`${r} ${r===1?`model`:`models`}`),e.auth.type===`none`&&n.push(`keyless`),n.join(` · `)}function Jn(e){switch(e.auth.type){case`api_key`:return`Own API key`;case`oauth_subscription`:return`ChatGPT subscription`;case`none`:return`No API key needed`;default:return null}}function Yn(e){if(e.provider===`vellum`)return`Included with your plan`;if(e.provider===`openai-compatible`)return qn(e);let t=[];if(e.provider===`ollama`||e.provider===`opencode`){let n=Kn(e);n&&t.push(n)}let n=e.provider===`chatgpt`?`openai`:e.provider,r=e.auth.type===`oauth_subscription`?Fe(n):R(n),i=e.models?.length??r.length;i>0&&t.push(`${i} ${i===1?`model`:`models`}`);let a=Jn(e);return a&&t.push(a),t.join(` • `)}function Xn({connection:e,isDefault:t,supportsDefaultProvider:n,selected:r,isSettingDefault:i,onOpen:a,onSetDefault:o,onDelete:s}){let{t:c}=Y(`settings`),u=e.isManaged??!1,d=Ge(e),f=Gn(e.provider),p=Yn(e),m=n&&!t&&f,h=!u&&a!=null,g=!u&&!t,_=m||h||g;return(0,$.jsx)(te,{title:d,subtitle:p.length>0?p:void 0,onClick:a,showChevron:!1,selected:r,contentAriaLabel:a?c(`providerRow.openProviderAriaLabel`,{displayName:d}):void 0,trailingInteractive:!0,trailing:(0,$.jsxs)($.Fragment,{children:[u?(0,$.jsx)(Te,{tone:`neutral`,title:c(`providerRow.managedTagTitle`),children:c(`providerRow.managedTag`)}):null,t?(0,$.jsx)(Te,{tone:`info`,title:c(`providerRow.defaultTagTitle`),children:c(`providerRow.defaultTag`)}):null,e.provider===`ollama`?(0,$.jsx)(Te,{tone:`neutral`,title:c(`providerRow.localTagTitle`),children:c(`providerRow.localTag`)}):null,e.provider===`openai-compatible`?(0,$.jsx)(Te,{tone:`neutral`,title:c(`providerRow.customTagTitle`),children:c(`providerRow.customTag`)}):null,_?(0,$.jsxs)(S.Root,{children:[(0,$.jsx)(S.Trigger,{asChild:!0,children:(0,$.jsx)(l,{variant:`ghost`,size:`compact`,iconOnly:(0,$.jsx)(cn,{}),"aria-label":c(`providerRow.actionsAriaLabel`,{displayName:d})})}),(0,$.jsxs)(S.Content,{align:`end`,sideOffset:4,children:[h?(0,$.jsx)(S.Item,{onSelect:a,children:c(`providerRow.edit`)}):null,m?(0,$.jsx)(S.Item,{disabled:i,onSelect:o,children:c(`providerRow.setAsDefault`)}):null,g?(0,$.jsx)(S.Item,{onSelect:s,className:ce.anchored,children:c(`providerRow.delete`)}):null]})]}):(0,$.jsx)(`span`,{className:`inline-block w-8`,"aria-hidden":!0})]})})}function Zn(e,t){let n=Z(),r={path:{assistant_id:e}},i=Jt({...rt(),onSuccess:()=>{n.invalidateQueries({queryKey:gt(r)}),n.invalidateQueries({queryKey:It(r)}),n.invalidateQueries({queryKey:T(r)})},onError:e=>{f(e,{context:`settings-ai-set-default-provider`}),q.error(X(`settings:useProviderActions.setDefaultFailedToast`))}});function a(t){Gn(t.provider)&&i.mutate({path:{assistant_id:e},body:{provider:t.provider,connectionName:t.name}})}function o(e){return i.isPending&&i.variables?.body?.connectionName===e}async function s(i){try{let{response:a}=await oe({path:{assistant_id:e,name:i}});a?.ok||a?.status===404?(n.invalidateQueries({queryKey:ie(r)}),t?.onDeleted?.(i)):a?.status===409?q.error(X(`settings:useProviderActions.deleteInUseToast`)):q.error(X(`settings:useProviderActions.deleteFailedToast`))}catch(e){f(e,{context:`settings-ai-provider-delete`}),q.error(X(`settings:useProviderActions.deleteFailedToast`))}}return{setDefault:a,isSettingDefault:o,deleteConnection:s}}function Qn({assistantId:e,selectedConnectionName:t,onOpenConnection:r,onAddProvider:i,onConnectionDeleted:o}){let{t:s}=Y(`settings`),{data:c,isLoading:d,isError:f}=J(F({path:{assistant_id:e}})),p=Ne(),{data:m}=J({...Ct({path:{assistant_id:e}}),enabled:p}),h=p?m?.resolvedConnectionName??null:null,g=Zn(e,{onDeleted:o}),_=(0,Q.useMemo)(()=>{let e=c?.connections??[];return[...e.filter(e=>e.provider===u),...e.filter(e=>e.provider!==u)]},[c]);return(0,$.jsx)(Tn,{title:s(`providersSection.title`),action:(0,$.jsx)(l,{variant:`outlined`,onClick:i,leftIcon:(0,$.jsx)(en,{}),children:s(`providersSection.addProvider`)}),children:d?(0,$.jsx)(`div`,{className:`space-y-2 py-2`,children:[1,2,3].map(e=>(0,$.jsx)(n,{className:`h-10 rounded-lg`},e))}):f?(0,$.jsx)(a,{variant:`body-medium-default`,as:`p`,className:`py-4 text-center text-(--system-negative-strong)`,children:s(`providersSection.loadError`)}):_.length===0?(0,$.jsx)(a,{variant:`body-medium-lighter`,as:`p`,className:`py-4 text-center text-(--content-tertiary)`,children:s(`providersSection.empty`)}):_.map(e=>(0,$.jsx)(Xn,{connection:e,isDefault:e.name===h,supportsDefaultProvider:p,selected:e.name===t,isSettingDefault:g.isSettingDefault(e.name),onOpen:e.isManaged??!1?void 0:()=>r(e.name),onSetDefault:()=>g.setDefault(e),onDelete:()=>void g.deleteConnection(e.name)},e.name))})}function $n({panel:e,onOpenPanel:t,onClosePanel:n}){let{t:r}=Y(`settings`),i=yt(),{data:a}=J({...pt({path:{assistant_id:i}}),staleTime:3e4}),o=Ne(),{data:s}=J({...Ct({path:{assistant_id:i}}),enabled:o}),c=s?.availability,{data:u}=J({...F({path:{assistant_id:i}})}),d=u?.connections,f=a?.llm?.callSites??{},p=Object.entries(f).filter(([e,t])=>e!==`mainAgent`&&(t?.profile!=null||t?.provider!=null||t?.model!=null)).length;return(0,$.jsx)(ln,{title:r(`languageModelCard.title`),subtitle:r(`languageModelCard.subtitle`),children:(0,$.jsxs)(`div`,{className:`space-y-2`,children:[c&&c.status!==`ok`&&(0,$.jsx)(g,{tone:c.status===`unknown`?`warning`:`error`,children:c.message??r(`languageModelCard.defaultProviderUnavailable`)}),i&&(0,$.jsx)(Un,{assistantId:i,config:a,connections:d,selectedProfileName:e?.kind===`profile`?e.name:null,onOpenProfile:e=>t({kind:`profile`,name:e}),onCreateProfile:()=>t({kind:`create-profile`}),onProfileDeleted:t=>{e?.kind===`profile`&&e.name===t&&n()}}),i&&(0,$.jsx)(Qn,{assistantId:i,selectedConnectionName:e?.kind===`provider`?e.name:null,onOpenConnection:e=>t({kind:`provider`,name:e}),onAddProvider:()=>t({kind:`add-provider`}),onConnectionDeleted:t=>{e?.kind===`provider`&&e.name===t&&n()}}),(0,$.jsx)(Tn,{title:r(`languageModelCard.overridesTitle`),count:p,action:(0,$.jsx)(l,{variant:`outlined`,onClick:()=>t({kind:`overrides`}),children:r(`languageModelCard.manage`)})})]})})}function er({children:e}){return(0,$.jsxs)(se,{href:`https://www.vellum.ai/docs/pricing`,tone:`default`,className:`inline-flex items-center gap-1`,glyph:!1,children:[e,(0,$.jsx)(an,{className:`h-3.5 w-3.5`})]})}function tr(){return(0,$.jsxs)(`div`,{className:`flex items-start gap-2 rounded-lg border border-[var(--border-base)] bg-[var(--surface-base)] px-4 py-2.5`,children:[(0,$.jsx)(on,{className:`mt-0.5 h-4 w-4 shrink-0 text-[var(--content-tertiary)]`}),(0,$.jsx)(`p`,{className:`text-body-medium-lighter text-[var(--content-secondary)]`,children:(0,$.jsx)(qt,{i18nKey:`managedServicesBanner.body`,ns:`common`,components:{link:(0,$.jsx)(er,{})}})})]})}function nr({assistantId:e,profileName:t,onClose:n}){let{t:r}=Y(`settings`),{data:i}=J({...pt({path:{assistant_id:e}}),staleTime:3e4}),{data:a}=J({...F({path:{assistant_id:e}})}),o=a?.connections,s=(0,Q.useMemo)(()=>i?.llm?.profiles??{},[i?.llm?.profiles]),c=Object.keys(s),u=(0,Q.useMemo)(()=>{if(t==null)return;let e=s[t];return e?{name:t,...e}:void 0},[t,s]),f=t==null?`create`:u?.source===`managed`||u?.invariant===!0?`view`:`edit`,{saveProfile:p,isPending:m}=P(e,{onSaved:n}),h=Se({mode:f,profileName:t??void 0,initialValues:u,existingNames:c,connections:o,assistantId:e,onSave:p}),g=Vn(e,i,{onDeleted:()=>n()}),_=t!=null&&g.pendingDeleteName===t,v=t!=null&&i!=null&&!(t in s);(0,Q.useEffect)(()=>{v&&!h.saving&&!m&&n()},[v,h.saving,m,n]);let y=f===`view`;return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(be,{title:h.effectiveMode===`create`?r(`profileDetailPanel.createTitle`):u?.label??t??r(`profileDetailPanel.defaultTitle`),closeVariant:`outlined`,onClose:n,headerTrailing:y&&h.effectiveMode!==`create`?(0,$.jsx)(Te,{tone:`neutral`,children:r(`profileDetailPanel.managedTag`)}):null,headerActions:h.effectiveMode!==`create`&&!h.isReadOnly?(0,$.jsx)(l,{variant:`dangerOutline`,loading:_,iconOnly:(0,$.jsx)(Qt,{}),"aria-label":r(_?`profileDetailPanel.deleting`:`profileDetailPanel.delete`),tooltip:r(`profileDetailPanel.delete`),onClick:()=>{t!=null&&g.requestDelete(t)},disabled:h.saving||_}):null,footer:h.isReadOnly?(0,$.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,$.jsx)(l,{variant:`outlined`,onClick:h.switchToSaveAsNew,disabled:h.saving,children:r(`profileDetailPanel.saveAsNew`)}),h.hasViewModeChanges?(0,$.jsx)(l,{variant:`primary`,onClick:()=>void h.handleSave(),disabled:h.saving,children:h.saving?r(`profileDetailPanel.saving`):r(`profileDetailPanel.save`)}):null]}):(0,$.jsx)(`div`,{className:`flex justify-end`,children:(0,$.jsx)(l,{variant:`primary`,onClick:()=>void h.handleSave(),disabled:h.isInvalid||h.saving,children:h.saving?r(`profileDetailPanel.saving`):h.effectiveMode===`create`?r(`profileDetailPanel.create`):r(`profileDetailPanel.saveChanges`)})}),children:(0,$.jsx)(d,{editor:h,assistantId:e,connections:o,variant:`panel`})}),(0,$.jsx)(An,{...g.blockedDeleteModalProps})]})}function rr({value:e,profileOptions:t,disabled:n,onChange:r}){let{t:i}=Y(`settings`);return(0,$.jsx)(`div`,{className:`rounded-lg border border-[var(--border-base)] bg-[var(--surface-overlay)] p-3`,children:(0,$.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,$.jsxs)(`div`,{className:`min-w-0`,children:[(0,$.jsx)(`p`,{className:`text-body-medium-default font-medium text-[var(--content-default)]`,children:i(`advisorProfileRow.title`)}),(0,$.jsx)(`p`,{className:`mt-0.5 text-body-small-lighter text-[var(--content-tertiary)]`,children:i(`advisorProfileRow.description`)})]}),(0,$.jsx)(K,{value:e,onChange:r,options:t,placeholder:i(`advisorProfileRow.chooseProfilePlaceholder`),className:`w-44`,menuMinWidth:280,menuAlign:`start`,disabled:n})]})})}var ir=`__custom__`;function ar(e){return e?!!(e.profile||e.provider||e.model):!1}function or(e,t){if(t?.provider||t?.model)return null;let n=e.defaultProfile??e.shippedDefaultProfile;return n?{profile:n,via:t?.profile===n?`override`:`default`}:null}function sr(e,t){let n=ar(e);return n===ar(t)?n?(e?.profile??null)===(t?.profile??null)&&(e?.provider??null)===(t?.provider??null)&&(e?.model??null)===(t?.model??null):!0:!1}function cr({assistantId:e,callSites:n,domains:r,persistedOverrides:i,orderedProfiles:o,onClose:s,onApplied:c}){let{t:u}=Y(`settings`),d=re(),p=t(),m=(0,Q.useMemo)(()=>({requireOwnProviderAndModel:p,requireTextGeneration:!1}),[p]),h=(0,Q.useMemo)(()=>{let e=new Map;for(let t of n){let n=or(t,i[t.id]);n&&e.set(t.id,n)}return e},[n,i]),_=(0,Q.useMemo)(()=>{let e=new Set(Array.from(h.values(),e=>e.profile));return o.filter(t=>e.has(t.name))},[o,h]),[v,y]=(0,Q.useState)(()=>_[0]?.name??``),[b,x]=(0,Q.useState)(``),[S,C]=(0,Q.useState)(new Set),[w,T]=(0,Q.useState)(!1),E=(0,Q.useMemo)(()=>{let e=new Map(r.map(e=>[e.id,e.displayName]));return t=>e.get(t)??t},[r]),D=(0,Q.useMemo)(()=>n.filter(e=>h.get(e.id)?.profile===v),[n,h,v]),O=(0,Q.useMemo)(()=>D.map(e=>e.id).filter(e=>!S.has(e)),[D,S]),k=(0,Q.useMemo)(()=>_.map(e=>({value:e.name,label:Re(e)})),[_]),A=(0,Q.useMemo)(()=>ve(o,[],m).filter(e=>e.name!==v).map(e=>({value:e.name,label:Re(e)})),[o,v,m]),j=Rt(o,v),M=Rt(o,b),N=S.size===0;function P(e){y(e),C(new Set),e===b&&x(``)}function F(e,t){C(n=>{let r=new Set(n);return t?r.delete(e):r.add(e),r})}async function I(){if(!(!v||!b||O.length===0)){T(!0);try{let t={};for(let e of O)t[e]={profile:b};await d.mutateAsync({path:{assistant_id:e},body:{llm:{callSites:t}}}),q.success(u(`bulkOverrideSwapModal.successToast`,{count:O.length,targetLabel:M})),c(),s()}catch(e){let t=lt(e);q.error(t??u(`bulkOverrideSwapModal.updateFailedToast`)),t||f(e,{context:`settings-ai-bulk-override-swap`})}finally{T(!1)}}}return(0,$.jsx)(W.Root,{open:!0,onOpenChange:e=>{e||s()},children:(0,$.jsxs)(W.Content,{size:`md`,children:[(0,$.jsx)(W.Header,{children:(0,$.jsx)(W.Title,{children:u(`bulkOverrideSwapModal.title`)})}),(0,$.jsxs)(W.Body,{className:`space-y-4`,children:[(0,$.jsx)(a,{variant:`body-medium-default`,as:`p`,children:u(`bulkOverrideSwapModal.intro`)}),(0,$.jsxs)(`div`,{className:`grid grid-cols-2 gap-3`,children:[(0,$.jsx)(K,{id:`bulk-swap-source`,label:u(`bulkOverrideSwapModal.currentlyUsingLabel`),value:v,onChange:P,options:k}),(0,$.jsx)(K,{id:`bulk-swap-target`,label:u(`bulkOverrideSwapModal.changeToLabel`),value:b,onChange:x,options:A,placeholder:u(`bulkOverrideSwapModal.targetPlaceholder`)})]}),(0,$.jsx)(g,{tone:`info`,title:u(`bulkOverrideSwapModal.noticeTitle`),children:u(`bulkOverrideSwapModal.noticeBody`,{sourceLabel:j})}),(0,$.jsxs)(`div`,{children:[(0,$.jsxs)(`div`,{className:`mb-2 flex items-baseline justify-between gap-2`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(a,{variant:`body-medium-default`,as:`p`,children:u(`bulkOverrideSwapModal.affectedSummary`,{count:D.length,profile:j})}),(0,$.jsx)(a,{variant:`body-small-default`,as:`p`,className:`text-[color:var(--content-secondary)]`,children:u(`bulkOverrideSwapModal.chooseActions`)})]}),(0,$.jsx)(l,{variant:`ghost`,onClick:()=>C(N?new Set(D.map(e=>e.id)):new Set),children:u(N?`bulkOverrideSwapModal.clearAll`:`bulkOverrideSwapModal.selectAll`)})]}),(0,$.jsx)(`div`,{className:`max-h-72 space-y-1 overflow-y-auto`,children:D.map(e=>(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-3 rounded-md border border-[var(--border-base)] px-3 py-2`,children:[(0,$.jsx)(mt,{checked:!S.has(e.id),onCheckedChange:t=>F(e.id,t===!0),disabled:w,label:e.displayName,helperText:E(e.domain)}),(0,$.jsx)(`span`,{className:`shrink-0 text-body-small-default text-[color:var(--content-tertiary)]`,children:h.get(e.id)?.via===`override`?u(`bulkOverrideSwapModal.viaOverride`):u(`bulkOverrideSwapModal.viaDefault`)})]},e.id))})]})]}),(0,$.jsxs)(W.Footer,{children:[(0,$.jsx)(a,{variant:`body-small-default`,as:`p`,className:`mr-auto self-center text-[color:var(--content-secondary)]`,children:u(`bulkOverrideSwapModal.willChange`,{count:O.length})}),(0,$.jsx)(l,{variant:`ghost`,onClick:s,disabled:w,children:u(`bulkOverrideSwapModal.cancel`)}),(0,$.jsx)(l,{variant:`primary`,loading:w,disabled:!v||!b||O.length===0||w,onClick:()=>void I(),children:u(`bulkOverrideSwapModal.applyTo`,{count:O.length})})]})]})})}function lr({id:e,displayName:t,description:n,defaultProfileLabel:r,draft:a,profileOptions:o,connections:s,onDraftChange:c,onToggle:l}){let{t:u}=Y(`settings`),d=je({hostedInference:Me.use.vellumHostedInference()}),f=ar(a),p=!a||!f?``:a.provider||a.model?ir:a.profile??``,m=p===ir,h=jt(),g=i(),_=(s??[]).some(e=>e.provider===xe),v=[...Gt,..._?[xe]:[]],y=h[0]??Gt[0],b=a?.provider,x=Pe(b)?b:b===`chatgpt`?xe:void 0,S=x!==void 0&&v.some(e=>e===x),C=x??y,w=A(C,``,(s??[]).filter(e=>Ze(e.provider,C)))?Fe(C):Et(C,d),T=w.map(e=>({value:e.id,label:e.displayName})),E=typeof a?.model==`string`?a.model:``;if(E&&!w.some(e=>e.id===E)){let e=R(C).find(e=>e.id===E)?.displayName??E;T.push({value:E,label:u(`callSiteOverridesRow.unavailableOption`,{name:e})})}let O=!!a?.provider&&!a?.model,j=[...v.map(e=>({value:e,label:k[e]??e,...g(e)})),...x&&!S?[{value:x,label:u(`callSiteOverridesRow.unavailableOption`,{name:k[x]??x})}]:[]];function M(t){t===`__custom__`?c(e,{profile:null,provider:y,model:D(y)??``}):t===``?c(e,null):c(e,{profile:t,provider:null,model:null})}function N(t){let n=D(t)??``;c(e,{...a??{},profile:null,provider:t,model:n})}function P(t){c(e,{...a??{},model:t})}return(0,$.jsxs)(`div`,{className:`rounded-lg border border-[var(--border-base)] bg-[var(--surface-overlay)] p-3`,children:[(0,$.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,$.jsx)(`p`,{className:`text-body-medium-default font-medium text-[var(--content-default)]`,children:t}),n&&(0,$.jsxs)(`p`,{className:`mt-0.5 text-body-small-default text-[var(--content-tertiary)]`,children:[n,r&&(0,$.jsx)(`span`,{className:`ml-1.5 text-body-small-default text-[var(--content-tertiary)] opacity-60`,children:u(`callSiteOverridesRow.defaultProfileSuffix`,{label:r})})]})]}),(0,$.jsx)(tt,{checked:f,onChange:t=>l(e,t),"aria-label":u(`callSiteOverridesRow.overrideAriaLabel`,{displayName:t}),className:`shrink-0`})]}),f&&(0,$.jsx)(`div`,{className:`mt-3`,children:(0,$.jsx)(K,{value:p,onChange:M,options:o,className:`w-44`,menuMinWidth:280,menuAlign:`start`})}),f&&m&&(0,$.jsxs)(`div`,{className:`mt-3 space-y-2 border-t border-[var(--border-base)] pt-3`,children:[(0,$.jsxs)(`div`,{className:`flex gap-2`,children:[(0,$.jsxs)(`div`,{className:`flex-1`,children:[(0,$.jsx)(`label`,{className:`mb-1 block text-body-small-default text-[var(--content-tertiary)]`,children:u(`callSiteOverridesRow.providerLabel`)}),(0,$.jsx)(K,{value:C??``,onChange:N,options:j})]}),(0,$.jsxs)(`div`,{className:`flex-1`,children:[(0,$.jsx)(`label`,{className:`mb-1 block text-body-small-default text-[var(--content-tertiary)]`,children:u(`callSiteOverridesRow.modelLabel`)}),(0,$.jsx)(K,{value:a?.model??``,onChange:P,options:T})]})]}),O&&(0,$.jsx)(`p`,{className:`text-body-small-default text-[var(--system-negative-strong)]`,children:u(`callSiteOverridesRow.pickModelError`)})]})]})}function ur({groups:e,drafts:t,buildProfileOptionsForRow:n,profileLabelFor:r,advisorMatchesSearch:i,connections:a,onDraftChange:o,onToggle:s}){let{t:c}=Y(`settings`);return(0,$.jsx)(`div`,{className:`space-y-4`,children:e.length===0?i?null:(0,$.jsx)(`p`,{className:`py-8 text-center text-body-medium-lighter text-[var(--content-tertiary)]`,children:c(`overridesCallSiteList.emptySearch`)}):e.map(({domain:e,sites:i})=>(0,$.jsxs)(`div`,{children:[(0,$.jsx)(pn,{children:e.displayName}),(0,$.jsx)(`div`,{className:`space-y-1`,children:i.map(e=>{let i=(()=>{let n=t[e.id]??null;return!n||!ar(n)?``:n.provider||n.model?ir:n.profile??``})(),c=e.shippedDefaultProfile??e.defaultProfile,l=c?r(c):null;return(0,$.jsx)(lr,{id:e.id,displayName:e.displayName,description:e.description,defaultProfileLabel:l,draft:t[e.id]??null,profileOptions:n(i===``||i===`__custom__`?null:i),connections:a,onDraftChange:o,onToggle:s},e.id)})})]},e.id))})}function dr(e,t){let n={};for(let r of Object.keys(e)){let i=e[r]??null;ar(i)?n[r]={profile:i?.profile??null,provider:i?.provider??null,model:i?.model??null}:r in t&&t[r]===null&&(n[r]=null)}return n}function fr(e){let t={};for(let n of Object.keys(e))t[n]=null;return t}function pr({catalogCallSiteIds:e,persistedOverrides:t,persistedAdvisor:n,isSeeded:r}){let[i,a]=(0,Q.useState)({}),[o,s]=(0,Q.useState)(void 0),c=(0,Q.useMemo)(()=>{if(!r)return{};let n={};for(let r of e)if(r in i)n[r]=i[r];else{let e=t[r];n[r]=e?{...e}:{}}return n},[r,e,t,i]),l=o??n,u=l!==n,d=(0,Q.useMemo)(()=>{if(!r)return!1;for(let e of Object.keys(c))if(!sr(c[e],t[e]))return!0;return!1},[r,c,t]);return{drafts:c,advisorProfile:l,advisorDirty:u,callSiteDraftsDirty:d,hasUnsavedDrafts:u||d,hasValidationError:(0,Q.useMemo)(()=>Object.values(c).some(e=>ar(e)&&!!e?.provider&&!e?.model),[c]),setDraft:(0,Q.useCallback)((e,t)=>{a(n=>({...n,[e]:t}))},[]),setAdvisor:(0,Q.useCallback)(e=>{s(e)},[]),clearEdits:(0,Q.useCallback)(()=>{a({}),s(void 0)},[]),buildSavePatch:(0,Q.useCallback)(()=>dr(c,i),[c,i]),buildResetPatch:(0,Q.useCallback)(()=>fr(c),[c])}}function mr({assistantId:e,onClose:n}){let{t:r}=Y(`settings`),{data:i}=J({...pt({path:{assistant_id:e}}),staleTime:3e4}),a=(0,Q.useMemo)(()=>i?.llm?.profiles??{},[i?.llm?.profiles]),o=(0,Q.useMemo)(()=>i?.llm?.profileOrder??[],[i?.llm?.profileOrder]),s=(0,Q.useMemo)(()=>i?.llm?.callSites??{},[i?.llm?.callSites]),c=(0,Q.useMemo)(()=>Vt(a,o),[a,o]),u=jt(),d=t(),p=(0,Q.useMemo)(()=>({requireOwnProviderAndModel:d}),[d]),m=(0,Q.useMemo)(()=>({requireOwnProviderAndModel:d,requireTextGeneration:!1}),[d]),h=re(),[_,v]=(0,Q.useState)(``),[y,b]=(0,Q.useState)(!1),[x,S]=(0,Q.useState)(!1),[C,w]=(0,Q.useState)(!1),{data:T,isLoading:E,isError:O,refetch:k}=J({...et({path:{assistant_id:e}}),enabled:!!e,staleTime:6e4,refetchOnWindowFocus:!1}),{data:A}=J({...F({path:{assistant_id:e}}),enabled:!!e}),j=(0,Q.useMemo)(()=>(T?.callSites??[]).filter(e=>e.id!==`mainAgent`),[T]),M=!E&&!O&&!!T,N=!!i,P=M&&N,I=(0,Q.useMemo)(()=>j.map(e=>e.id),[j]),L=i?.llm?.advisorProfile??``,{drafts:te,advisorProfile:R,advisorDirty:ne,callSiteDraftsDirty:ie,hasUnsavedDrafts:ae,hasValidationError:oe,setDraft:z,setAdvisor:B,clearEdits:se,buildSavePatch:ce,buildResetPatch:V}=pr({catalogCallSiteIds:I,persistedOverrides:s,persistedAdvisor:L,isSeeded:P}),H=(0,Q.useMemo)(()=>new Set(I),[I]),le=(0,Q.useCallback)(e=>Rt(c,e),[c]),ue=(0,Q.useCallback)((e,t)=>({value:e.name,label:Re(e),...ee(e,c,t)===`undispatchable`?{icon:(0,$.jsx)(tn,{className:`h-3.5 w-3.5 text-[var(--system-mid-strong)]`}),tooltip:Be(e)}:{}}),[c]),de=(0,Q.useMemo)(()=>ve(c,[L],p).map(e=>ue(e,p)),[c,L,ue,p]),fe=(0,Q.useMemo)(()=>{let e=_.trim().toLowerCase();return e===``||`advisor`.includes(e)||`second opinion`.includes(e)},[_]),pe=(0,Q.useMemo)(()=>j.some(e=>or(e,s[e.id])!==null),[j,s]),U=(0,Q.useMemo)(()=>Object.entries(s).some(([e,t])=>H.has(e)&&(t?.profile!=null||t?.provider!=null||t?.model!=null)),[s,H]),me=(0,Q.useCallback)(e=>[...ve(c,[e],m).map(e=>ue(e,m)),{value:ir,label:r(`overridesDetailPanel.customProfileOption`)}],[c,ue,m,r]),he=(0,Q.useMemo)(()=>{if(!_.trim())return j;let e=_.toLowerCase();return j.filter(t=>(t.displayName??``).toLowerCase().includes(e)||(t.description??``).toLowerCase().includes(e)||(t.domain??``).toLowerCase().includes(e))},[j,_]),ge=(0,Q.useMemo)(()=>{if(!T)return[];let e=T.domains.map(e=>e.id),t=new Map(T.domains.map(e=>[e.id,e])),n=[];for(let r of e){let e=he.filter(e=>e.domain===r);e.length>0&&n.push({domain:t.get(r),sites:e})}let i=new Set(e),a=he.filter(e=>!i.has(e.domain));return a.length>0&&n.push({domain:{id:`other`,displayName:r(`overridesDetailPanel.otherDomain`)},sites:a}),n},[T,he,r]),_e=(0,Q.useCallback)((e,t)=>{if(!t){z(e,null);return}let n=Le(c,j.find(t=>t.id===e)?.defaultProfile,m);if(n)z(e,{profile:n});else{let t=u[0]??Gt[0];z(e,{provider:t,model:D(t)??``})}},[j,c,u,z,m]),ye=(0,Q.useCallback)(async()=>{b(!0);try{let t=ce();await h.mutateAsync({path:{assistant_id:e},body:{llm:{...ie?{callSites:t}:{},...ne?{advisorProfile:R}:{}}}}),n(),q.success(r(`overridesDetailPanel.overridesSavedToast`))}catch(e){q.error(r(`overridesDetailPanel.saveFailedToast`)),f(e,{context:`call_site_overrides_save`})}finally{b(!1)}},[ce,ie,ne,R,n,h,e,r]),xe=(0,Q.useCallback)(async()=>{b(!0);try{let t=V();await h.mutateAsync({path:{assistant_id:e},body:{llm:{callSites:t}}}),n(),q.success(r(`overridesDetailPanel.overridesResetToast`))}catch(e){q.error(r(`overridesDetailPanel.resetFailedToast`)),f(e,{context:`call_site_overrides_reset`})}finally{b(!1)}},[V,n,h,e,r]),Se=(0,$.jsxs)(`div`,{className:`flex items-center justify-end gap-2`,children:[U&&(0,$.jsx)(l,{variant:`outlined`,onClick:()=>S(!0),disabled:y||!P,tintColor:`var(--system-negative-strong)`,className:`mr-auto`,children:r(`overridesDetailPanel.resetToDefaults`)}),(0,$.jsx)(l,{variant:`primary`,onClick:()=>void ye(),loading:y,disabled:!ae||oe||y,children:r(`overridesDetailPanel.save`)})]});return(0,$.jsxs)(be,{title:r(`overridesDetailPanel.title`),closeVariant:`outlined`,onClose:n,footer:Se,children:[(0,$.jsxs)(`div`,{className:`flex flex-col gap-5`,children:[(0,$.jsx)(`p`,{className:`text-body-medium-lighter text-[var(--content-tertiary)]`,children:r(`overridesDetailPanel.description`)}),(0,$.jsxs)(`div`,{className:`flex flex-col gap-5`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(`div`,{className:`min-w-0 flex-1`,children:(0,$.jsx)(G,{type:`search`,value:_,onChange:e=>v(e.target.value),placeholder:r(`overridesDetailPanel.searchPlaceholder`),leftIcon:(0,$.jsx)(sn,{className:`h-4 w-4`}),fullWidth:!0})}),(0,$.jsx)(l,{variant:`outlined`,onClick:()=>w(!0),disabled:!P||y||ae||!pe,title:ae?r(`overridesDetailPanel.bulkChangeUnsavedTitle`):pe?void 0:r(`overridesDetailPanel.bulkChangeNoCandidatesTitle`),children:r(`overridesDetailPanel.bulkChange`)})]}),N&&fe&&(0,$.jsxs)(`div`,{children:[(0,$.jsx)(pn,{children:r(`overridesDetailPanel.advisorSection`)}),(0,$.jsx)(rr,{value:R,profileOptions:de,disabled:y,onChange:B})]}),E&&(0,$.jsx)($e,{placement:`panel`}),O&&(0,$.jsx)(g,{tone:`error`,title:r(`overridesDetailPanel.loadErrorTitle`),actions:(0,$.jsx)(l,{variant:`outlined`,onClick:()=>void k(),children:r(`overridesDetailPanel.retry`)}),children:r(`overridesDetailPanel.loadErrorHint`)}),!E&&!O&&T&&(0,$.jsx)(ur,{groups:ge,drafts:te,buildProfileOptionsForRow:me,profileLabelFor:le,advisorMatchesSearch:fe,connections:A?.connections,onDraftChange:z,onToggle:_e})]})]}),C&&T&&(0,$.jsx)(cr,{assistantId:e,callSites:j,domains:T.domains,persistedOverrides:s,orderedProfiles:c,onClose:()=>w(!1),onApplied:se}),(0,$.jsx)(bt,{open:x,title:r(`overridesDetailPanel.resetToDefaults`),message:r(`overridesDetailPanel.resetConfirmMessage`),confirmLabel:r(`overridesDetailPanel.resetToDefaults`),destructive:!0,onConfirm:()=>{S(!1),xe()},onCancel:()=>S(!1)})]})}var hr=e(Yt(),1);function gr({mode:e,connection:t,assistantId:n,existingNames:i,connections:o,variant:s=`modal`,actionsSlot:c,onSave:u,onCancel:d}){let{t:f}=Y(`settings`),[p,m]=(0,Q.useState)(t?.label??``),h=t?.name??``,g=t?.provider??`anthropic`,_=t?.auth.type??`api_key`,[v,y]=(0,Q.useState)(()=>t?.auth.type===`api_key`?t.auth.credential:t?``:`credential/anthropic/api_key`),[b,x]=(0,Q.useState)(t?.baseUrl??``),[S,C]=(0,Q.useState)(()=>t?.models?t.models.map(e=>e.id).join(`, `):``),[w,T]=(0,Q.useState)(!1),[E,D]=(0,Q.useState)(null),O=g===`openai-compatible`,k=it(g),A=xt(g),[j,M]=(0,Q.useState)(``),[N,P]=(0,Q.useState)(!1),F=Z(),I=(0,Q.useMemo)(()=>Ot(v),[v]),ee=_===`api_key`&&I!==null,{hasStoredCredential:te,isLoading:R}=L({assistantId:n,credentialKind:`credential`,credentialName:I?`${I.service}:${I.field}`:``,enabled:ee}),{credentials:ne}=ye({assistantId:n,enabled:_===`api_key`});(0,Q.useEffect)(()=>{let e=t?.provider??`anthropic`;m(t?.label??``),t?.auth.type===`api_key`?y(t.auth.credential):y(t?``:`credential/${e}/api_key`),D(null),x(t?.baseUrl??``),C(t?.models?t.models.map(e=>e.id).join(`, `):``),M(``),P(!1)},[t]);let re=p.trim()!==(t?.label??``).trim(),ie=O&&re?vt(p,o,t?.name):null,ae=h.trim().length>0&&ie===null;async function oe(){if(ae){T(!0),D(null);try{let e;if(_===`api_key`){let t=v.trim()||`credential/${g}/api_key`,r=j.trim();if(r){P(!0);try{let e=Ot(t);await We({path:{assistant_id:n},body:e?{type:`credential`,name:`${e.service}:${e.field}`,value:r}:{type:`api_key`,name:g,value:r},throwOnError:!0});let i=Dt(n,`credential`,e?`${e.service}:${e.field}`:``);F.setQueryData(i,!0),F.invalidateQueries({queryKey:Ye({path:{assistant_id:n}})})}catch{D(f(`providerEditorContent.failedSaveApiKey`));return}finally{P(!1)}}e={type:`api_key`,credential:t}}else if(t)e=t.auth;else{D(f(`providerEditorContent.nothingToEdit`));return}let r=p.trim()||null,i={auth:e,label:r,...k&&{base_url:b.trim()||null},...A&&{models:S.trim()?S.split(`,`).map(e=>({id:e.trim()})).filter(e=>e.id):null}},{data:a,error:o,response:s}=await we({path:{assistant_id:n,name:t?.name??h.trim()},body:i});if(!s?.ok){D(kt(s?.status,o)??_t(s?.status));return}if(!a){D(f(`providerEditorContent.emptyServerResponse`));return}Je(a,f),u(a)}catch{D(f(`providerEditorContent.failedSaveProvider`))}finally{T(!1)}}}let z=ne.filter(e=>e.service===g),B=e!==`create`&&t?.auth.type===`api_key`,se=z.length>0||B,ce=r(f(`providerEditorContent.apiKeyPlaceholder`),te);if(e===`create`)return(0,$.jsx)(Ve,{variant:s===`panel`?`inline`:`modal`,actionsSlot:c,assistantId:n,existingNames:i,connections:o,defaultProviderType:g,onCreated:u,onCancel:d});let V=(0,$.jsxs)(`div`,{className:`space-y-4`,children:[(0,$.jsxs)(`div`,{className:`space-y-1`,children:[(0,$.jsx)(`label`,{className:`block text-body-small-default text-[var(--content-tertiary)]`,children:(0,$.jsx)(qt,{i18nKey:`providerEditorContent.displayNameLabel`,ns:`settings`,components:{optional:(0,$.jsx)(`span`,{className:`text-[var(--content-disabled)]`})}})}),(0,$.jsx)(G,{value:p,onChange:e=>m(e.target.value),placeholder:f(`providerEditorContent.displayNamePlaceholder`),fullWidth:!0}),ie?(0,$.jsx)(a,{variant:`body-small-default`,as:`p`,className:`text-(--system-negative-strong)`,children:Nt[ie]}):null]}),k&&(0,$.jsxs)(`div`,{className:`space-y-1`,children:[(0,$.jsx)(`label`,{className:`block text-body-small-default text-[var(--content-tertiary)]`,children:f(`providerEditorContent.baseUrlLabel`)}),(0,$.jsx)(G,{value:b,onChange:e=>x(e.target.value),placeholder:f(g===`ollama`?`providerEditorContent.baseUrlPlaceholderOllama`:g===`opencode`?`providerEditorContent.baseUrlPlaceholderOpencode`:`providerEditorContent.baseUrlPlaceholder`),fullWidth:!0}),g===`ollama`?(0,$.jsx)(a,{variant:`body-small-default`,as:`p`,className:`text-[var(--content-tertiary)]`,children:f(`providerEditorContent.baseUrlHintOllama`)}):null,g===`opencode`?(0,$.jsx)(a,{variant:`body-small-default`,as:`p`,className:`text-[var(--content-tertiary)]`,children:f(`providerEditorContent.baseUrlHintOpencode`)}):null]}),A&&(0,$.jsxs)(`div`,{className:`space-y-1`,children:[(0,$.jsx)(`label`,{className:`block text-body-small-default text-[var(--content-tertiary)]`,children:f(`providerEditorContent.modelsLabel`)}),(0,$.jsx)(G,{value:S,onChange:e=>C(e.target.value),placeholder:f(`providerEditorContent.modelsPlaceholder`),fullWidth:!0}),(0,$.jsx)(a,{variant:`body-small-default`,as:`p`,className:`text-[var(--content-tertiary)]`,children:f(`providerEditorContent.modelsHint`)})]}),_===`api_key`&&(0,$.jsx)(Qe,{apiKeyValue:j,onApiKeyChange:M,credential:v,onCredentialChange:y,isLoadingCredential:R,apiKeyPlaceholder:ce,provider:g,providerCredentials:z,showAdvancedSection:se,onError:D}),_===`oauth_subscription`&&(0,$.jsx)(wt,{assistantId:n,onConnected:u}),E&&(0,$.jsx)(a,{variant:`body-small-default`,as:`p`,className:`text-(--system-negative-strong)`,children:E})]}),H=(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(l,{variant:`ghost`,onClick:d,children:f(`providerEditorContent.cancel`)}),(0,$.jsx)(l,{variant:`primary`,disabled:!ae||w||N,onClick:()=>void oe(),children:f(w?`providerEditorContent.saving`:`providerEditorContent.saveChanges`)})]});return s===`panel`?(0,$.jsxs)(`div`,{className:`space-y-4`,children:[V,c===void 0?(0,$.jsx)(`div`,{className:`flex justify-end gap-2`,children:H}):c&&(0,hr.createPortal)(H,c)]}):(0,$.jsxs)(W.Content,{size:`md`,children:[(0,$.jsxs)(W.Header,{children:[(0,$.jsx)(W.Title,{children:f(`providerEditorContent.editProviderTitle`)}),(0,$.jsx)(W.Description,{children:t?f(`providerEditorContent.editingConnection`,{name:Ge(t)}):f(`providerEditorContent.editProviderSettingsFallback`)})]}),(0,$.jsx)(W.Body,{children:V}),(0,$.jsx)(W.Footer,{children:H})]})}function _r({assistantId:e,connectionName:t,onClose:n}){let{t:r}=Y(`settings`),i=Z(),[a,o]=(0,Q.useState)(null),{data:s,isLoading:c}=J(F({path:{assistant_id:e}})),l=(0,Q.useMemo)(()=>s?.connections??[],[s]),u=(0,Q.useMemo)(()=>t==null?void 0:l.find(e=>e.name===t),[t,l]),d=t!=null&&s!=null&&u==null;(0,Q.useEffect)(()=>{d&&n()},[d,n]);function f(){i.invalidateQueries({queryKey:ie({path:{assistant_id:e}})}),i.invalidateQueries({queryKey:gt({path:{assistant_id:e}})}),n()}return(0,$.jsx)(be,{title:u?Ge(u):r(`providerDetailPanel.addProviderTitle`),closeVariant:`outlined`,onClose:n,footer:(0,$.jsx)(`div`,{ref:o,className:`flex justify-end gap-2`}),children:t!=null&&c?(0,$.jsx)($e,{placement:`panel`}):t==null||u!=null?(0,$.jsx)(gr,{mode:u?`edit`:`create`,connection:u,variant:`panel`,actionsSlot:a,assistantId:e,existingNames:l.map(e=>e.name),connections:l,onSave:f,onCancel:n}):null})}var vr={vellum:{provider:`vellum`},deepgram:{provider:`deepgram`,credentialService:`deepgram`},openai:{provider:`openai-whisper`,credentialService:`openai`}},yr={vellum:`vellum`,deepgram:`deepgram`,"openai-whisper":`openai`},br=`deepgram`;function xr({assistantId:e,hideSaveButton:t=!1,hideCredentialsGuide:n=!1,onSaveStateChange:r}={}){let i=yt(),a=e??i,o=He(),s=Z(),{t:c}=Y(),l=(0,Q.useMemo)(()=>ae(nt(),{displayName:c(`sttProviderForm.windowsNativeDisplayName`),subtitle:c(`sttProviderForm.windowsNativeSubtitle`),setupWarning:c(`sttProviderForm.windowsNativeSetupWarning`)}).filter(e=>!e.requiresNativeDictation||Ce()),[c]),u=br,{data:d}=J({...pt({path:{assistant_id:a}}),enabled:o,staleTime:3e4}),f=d?.services?.stt,p=f?.mode===`managed`?`vellum`:f?.provider,m=(0,Q.useMemo)(()=>{let e=p?yr[p]:void 0;if(e&&l.some(t=>t.id===e))return e;let t=V(Oe,u);return l.some(e=>e.id===t)?t:u},[p,l,u]),h=!!p,[g,_]=yn(m),{available:v,currentCode:y,configuredProviderId:b,selectLanguage:x,selecting:S}=at(a),[C,w]=(0,Q.useState)(!1),T=v&&g===m&&(vr[g]?.provider===b||!!p&&!yr[p]),[E,D]=(0,Q.useState)(``),[O,k]=(0,Q.useState)(!1),[A,j]=(0,Q.useState)(!1);(0,Q.useEffect)(()=>{let e=V(Oe,u);e===`macos-native`&&!l.some(t=>t.id===e)&&M(Oe,u)},[l,u]);let N=(0,Q.useMemo)(()=>l.find(e=>e.id===g)??l[0],[l,g]),P=N.apiKeyPlaceholder!==void 0;(0,Q.useEffect)(()=>{k(V(Ht+g,``).length>0),D(``)},[g]);let F=(0,Q.useMemo)(()=>{let e=g!==m,t=E.trim().length>0;return e||t},[g,m,E]),I=(0,Q.useCallback)(async()=>{let e=E.trim();M(Oe,g),e.length>0&&M(Ht+g,e);let t=vr[g];j(!0);try{if(t?.credentialService){let n=e.length>0?e:V(Ht+g,``);if(n.length>0){let{response:e}=await le({path:{assistant_id:a},body:{service:t.credentialService,field:`api_key`,value:n,label:`${N.displayName} API Key`},throwOnError:!1});if(!e?.ok)throw Error(`Failed to store API key (HTTP ${e?.status??`?`})`)}}if(t&&(g!==m||!h)||p===`vellum`&&g!==`vellum`){let e=t?.provider??br,{response:n}=await Bt({path:{assistant_id:a},body:{services:{stt:{provider:e,mode:e===`vellum`?`managed`:`your-own`}}},throwOnError:!1});if(!n?.ok)throw Error(`Failed to save configuration (HTTP ${n?.status??`?`})`)}return e.length>0&&k(!0),D(``),s.invalidateQueries({queryKey:It({path:{assistant_id:a}})}),q.success(c(`sttProviderForm.saveSuccess`)),!0}catch(e){return q.error(e instanceof Error?e.message:c(`sttProviderForm.saveFailed`)),!1}finally{j(!1)}},[a,g,E,N,m,h,p,s,c]);(0,Q.useEffect)(()=>{r?.({hasChanges:F,saving:A,save:I})},[r,F,A,I]);let ee=(0,Q.useCallback)(()=>{M(Ht+g,``),k(!1),D(``)},[g]),L=O?c(`sttProviderForm.apiKeyPlaceholderReplace`):N.apiKeyPlaceholder;return(0,$.jsxs)(`div`,{className:`space-y-4`,children:[(0,$.jsxs)(`div`,{className:`space-y-1`,children:[(0,$.jsx)(`label`,{className:`block text-body-small-default text-[var(--content-tertiary)]`,children:c(`sttProviderForm.providerLabel`)}),(0,$.jsx)(K,{value:g,onChange:_,options:l.map(e=>({value:e.id,label:e.displayName})),"aria-label":c(`sttProviderForm.providerAriaLabel`)})]}),T&&(0,$.jsxs)(`div`,{className:`space-y-1`,children:[(0,$.jsx)(`label`,{className:`block text-body-small-default text-[var(--content-tertiary)]`,children:c(`sttProviderForm.spokenLanguage`)}),(0,$.jsx)(At,{"aria-label":c(`sttProviderForm.spokenLanguage`),"aria-haspopup":`dialog`,onClick:()=>w(!0),value:St(y,b)}),(0,$.jsx)(`p`,{className:`text-body-small-default text-[var(--content-tertiary)]`,children:c(`sttProviderForm.spokenLanguageApplies`)}),(0,$.jsx)(_n,{open:C,onOpenChange:w,title:c(`sttProviderForm.spokenLanguage`),currentCode:y,configuredProviderId:b,selectLanguage:x,selecting:S})]}),P&&(0,$.jsxs)(`div`,{className:`space-y-1`,children:[(0,$.jsx)(`label`,{className:`block text-body-small-default text-[var(--content-tertiary)]`,children:c(`sttProviderForm.apiKeyLabel`)}),(0,$.jsx)(G,{type:`password`,value:E,onChange:e=>D(e.target.value),placeholder:L,fullWidth:!0})]}),N.setupWarning&&(0,$.jsxs)(`div`,{className:`flex items-start gap-2 rounded-lg border border-[var(--border-subtle)] bg-[var(--surface-sunken)] p-3 text-body-small-default text-[var(--content-tertiary)]`,children:[(0,$.jsx)($t,{className:`mt-0.5 h-3.5 w-3.5 shrink-0 text-[var(--system-mid-strong)]`}),(0,$.jsx)(`span`,{children:N.setupWarning})]}),!n&&N.credentialsGuide&&(0,$.jsx)(fn,{guide:N.credentialsGuide}),g===`vellum`&&(0,$.jsx)(`p`,{className:`text-body-medium-lighter text-[var(--content-tertiary)]`,children:c(`sttProviderForm.vellumTranscription`)}),(!t||O)&&(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[!t&&(0,$.jsx)(dn,{onClick:I,disabled:!F||A}),O&&(0,$.jsx)(un,{onClick:ee})]})]})}var Sr={batch:`sttRoleOverrides.role.batch`,dictation:`sttRoleOverrides.role.dictation`,liveVoice:`sttRoleOverrides.role.liveVoice`,telephony:`sttRoleOverrides.role.telephony`,watch:`sttRoleOverrides.role.watch`};function Cr(e){let t=e?.roles;if(!t)return[];let n=e?.provider,r=n?e?.providers?.[n]?.model:void 0,i=[];for(let[e,a]of Object.entries(t)){let t=a?.provider;t&&(t===n&&a?.model===r||i.push({role:e,provider:t,...a?.model===void 0?{}:{model:a.model}}))}return i}function wr({assistantId:e}){let{t}=Y(`settings`),n=Z(),r=He(),[i,a]=(0,Q.useState)(null),{data:o}=J({...pt({path:{assistant_id:e}}),enabled:r,staleTime:3e4}),s=o?.services?.stt,c=Cr(s),{data:u}=J({...De({path:{assistant_id:e}}),enabled:r&&c.length>0,staleTime:5*6e4});if(c.length===0)return null;let d=e=>u?.providers?.find(t=>t.id===e)?.displayName??e,f=async r=>{a(r);try{let{response:t}=await Bt({path:{assistant_id:e},body:{services:{stt:{roles:{[r]:null}}}},throwOnError:!1});if(!t?.ok)throw Error(String(t?.status??``));await n.invalidateQueries({queryKey:It({path:{assistant_id:e}})})}catch{q.error(t(`sttRoleOverrides.clearFailed`))}finally{a(null)}};return(0,$.jsxs)(`div`,{className:`mt-1 flex flex-col gap-2 border-t border-[var(--border-subtle)] pt-4`,children:[(0,$.jsx)(`span`,{className:`text-body-small-default text-[var(--content-tertiary)]`,children:t(`sttRoleOverrides.title`)}),(0,$.jsx)(`ul`,{className:`flex flex-col gap-1`,children:c.map(e=>{let n=Sr[e.role];return(0,$.jsxs)(`li`,{className:`flex items-center gap-4 rounded-md border border-[var(--border-subtle)] bg-[var(--surface-sunken)] px-3 py-2`,children:[(0,$.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-body-medium-lighter text-[var(--content-default)]`,children:n?t(n):e.role}),(0,$.jsx)(`span`,{className:`min-w-0 truncate text-body-small-default text-[var(--content-default)]`,children:e.model?`${d(e.provider)} · ${e.model}`:d(e.provider)}),(0,$.jsx)(l,{variant:`ghost`,size:`compact`,"aria-label":t(`sttRoleOverrides.clearAria`,{feature:n?t(n):e.role}),className:`[--vbtn-fg:var(--content-tertiary)]`,disabled:i===e.role,onClick:()=>void f(e.role),children:t(`sttRoleOverrides.clear`)})]},e.role)})})]})}function Tr(){let{t:e}=Y(`settings`),t=yt();return(0,$.jsxs)(ln,{title:e(`speechToTextCard.title`),subtitle:e(`speechToTextCard.subtitle`),children:[(0,$.jsx)(xr,{}),(0,$.jsx)(wr,{assistantId:t})]})}async function Er(e){let{provider:t,apiKey:n,voiceId:r,text:i}=e;if(n.trim().length===0)return{kind:`error`,message:`Save an API key for this provider first.`};try{return t===`elevenlabs`?await Dr(n,r,i):t===`deepgram`?await Or(n,i):t===`fish-audio`?{kind:`unsupported`,message:`Fish Audio TTS is only supported in the desktop app today. Use ElevenLabs or Deepgram to test from the browser.`}:t===`xai`?{kind:`unsupported`,message:`xAI TTS is only supported in the desktop app today. Use ElevenLabs or Deepgram to test from the browser.`}:{kind:`unsupported`,message:`TTS testing for "${t}" is not supported from the browser yet.`}}catch(e){return{kind:`error`,message:e instanceof Error?e.message:`Failed to reach the TTS provider.`}}}async function Dr(e,t,n){let r=t.trim();if(r.length===0)return{kind:`error`,message:`Enter and save a Voice ID before testing ElevenLabs.`};let i=await fetch(`https://api.elevenlabs.io/v1/text-to-speech/${encodeURIComponent(r)}?output_format=mp3_44100_128`,{method:`POST`,headers:{"xi-api-key":e,"Content-Type":`application/json`,Accept:`audio/mpeg`},body:JSON.stringify({text:n,model_id:`eleven_turbo_v2_5`})});return i.ok?{kind:`audio`,blob:await i.blob()}:{kind:`error`,message:await kr(i,`ElevenLabs rejected the request.`)}}async function Or(e,t){let n=await fetch(`https://api.deepgram.com/v1/speak?model=aura-2-thalia-en`,{method:`POST`,headers:{Authorization:`Token ${e}`,"Content-Type":`application/json`,Accept:`audio/mpeg`},body:JSON.stringify({text:t})});return n.ok?{kind:`audio`,blob:await n.blob()}:{kind:`error`,message:await kr(n,`Deepgram rejected the request.`)}}async function kr(e,t){try{let n=await e.text();if(n.length===0)return`${t} (HTTP ${e.status})`;try{let e=JSON.parse(n);if(e&&typeof e==`object`&&`detail`in e&&typeof e.detail==`string`)return e.detail;if(e&&typeof e==`object`&&`message`in e&&typeof e.message==`string`)return e.message}catch{}return n.slice(0,200)}catch{return`${t} (HTTP ${e.status})`}}function Ar({assistantId:e,value:t,onChange:n,className:r}){let{t:i}=Y(),[a,o]=(0,Q.useState)(!1),{voices:s}=fe(e);if(s.length===0)return null;let c=s.find(e=>e.model===t)??s[0];return(0,$.jsxs)(Lt.Root,{open:a,onOpenChange:o,children:[(0,$.jsx)(Lt.Trigger,{asChild:!0,children:(0,$.jsx)(At,{"aria-label":i(`voicePickerField.ariaLabel`),value:c?v(c.description):i(`voicePickerField.selectVoice`),className:r})}),(0,$.jsx)(Lt.Content,{side:`bottom`,align:`start`,className:`w-[var(--radix-popover-trigger-width)] p-1`,children:(0,$.jsx)(Mt,{assistantId:e,value:t,onChange:n,onSelect:()=>o(!1),showSource:!0,autoScrollToSelected:!0})})]})}var jr={elevenlabs:`voiceId`,"fish-audio":`referenceId`,xai:`voiceId`};function Mr({assistantId:e,hideSaveButton:t=!1,hideCredentialsGuide:n=!1,onSaveStateChange:r}={}){let{t:i}=Y(),a=yt(),o=e??a,s=Ue.use.name()??`your assistant`,c=He(),u=Z(),{data:d}=J({...m({path:{assistant_id:o}}),enabled:c,staleTime:1/0}),f=(0,Q.useMemo)(()=>{let e=d?.providers;if(!e)return _e;if(e.some(e=>e.id===`vellum`))return e;let t=_e.find(e=>e.id===`vellum`);return t?[t,...e]:e},[d]),{data:p}=J({...pt({path:{assistant_id:o}}),enabled:c,staleTime:3e4}),g=p?.services?.tts,_=g?.mode===`managed`?`vellum`:g?.provider,v=`elevenlabs`,y=(0,Q.useMemo)(()=>_??V(`vellum:voice:ttsProvider`,v),[_,v]),b=!!_,[x,S]=yn(y),[C,w]=(0,Q.useState)(``),[T,E]=(0,Q.useState)(``),[D,O]=(0,Q.useState)(``),[k,A]=(0,Q.useState)(!1),[j,N]=(0,Q.useState)(!1),[P,F]=(0,Q.useState)(!1),{voices:I,defaultModel:ee,fetched:L}=dt(o,{enabled:x===`vellum`}),te=g?.providers?.vellum?.model??ee??``,[R,ne]=yn(te),re=I.find(e=>e.model===R)??I[0],[ie,ae]=(0,Q.useState)(null),oe=I.some(e=>e.model===te),z=ie??(L&&te!==``&&!oe),B=(0,Q.useMemo)(()=>f.find(e=>e.id===x)??f[0],[x,f]),se=x===`vellum`&&B.supportsVoiceSelection&&R.trim()!==``&&R.trim()!==te,ce=(0,Q.useCallback)(e=>{let t=V(h+e,``),n=V(Ae+e,``);A(t.length>0),E(n),O(n),w(``)},[]);(0,Q.useEffect)(()=>{ce(x)},[x,ce]);let H=(0,Q.useMemo)(()=>{let e=x!==y,t=C.trim().length>0,n=T.trim()!==D;return e||t||n||se},[x,y,C,T,D,se]),ue=(0,Q.useCallback)(async()=>{let e=C.trim(),t=T.trim(),n=B.id;M(zt,n),e.length>0&&M(h+n,e),M(Ae+n,t);let r=e.length>0?e:V(h+n,``),a=jr[n];F(!0);try{if(r.length>0){let{response:e}=await le({path:{assistant_id:o},body:{service:n,field:`api_key`,value:r,label:`${B.displayName} API Key`},throwOnError:!1});if(!e?.ok)throw Error(`Failed to store API key (HTTP ${e?.status??`?`})`)}let e={...x!==y||!b?{provider:n,mode:n===`vellum`?`managed`:`your-own`}:{},...a?{providers:{[n]:{[a]:t}}}:{},...se?{providers:{vellum:{model:R.trim()}}}:{}};if(Object.keys(e).length>0){let{response:t}=await Bt({path:{assistant_id:o},body:{services:{tts:e}},throwOnError:!1});if(!t?.ok)throw Error(`Failed to save configuration (HTTP ${t?.status??`?`})`)}return A(r.length>0),O(t),w(``),u.invalidateQueries({queryKey:It({path:{assistant_id:o}})}),q.success(i(`ttsProviderForm.saved`)),!0}catch(e){return q.error(e instanceof Error?e.message:i(`ttsProviderForm.saveFailed`)),!1}finally{F(!1)}},[o,x,R,se,C,T,B,y,b,u,i]);(0,Q.useEffect)(()=>{r?.({hasChanges:H,saving:P,save:ue})},[r,H,P,ue]);let de=(0,Q.useCallback)(()=>{M(h+x,``),A(!1),w(``)},[x]),fe=(0,Q.useCallback)(async()=>{N(!0);try{let e=V(h+x,``),t=C.trim(),n=t.length>0?t:e;if(n.length===0){q.error(i(`ttsProviderForm.apiKeyRequired`));return}let r=V(Ae+x,``),a=T.trim(),o=await Er({provider:x,apiKey:n,voiceId:a.length>0?a:r,text:`Hey! It's ${s}. How does this sound?`});if(o.kind!==`audio`){q.error(o.message);return}let c=URL.createObjectURL(o.blob);try{let e=new Audio(c);await e.play(),await new Promise(t=>{e.onended=()=>t(),e.onerror=()=>t()})}finally{URL.revokeObjectURL(c)}}finally{N(!1)}},[s,C,x,T,i]),pe=k?`•••••••• (Enter a new key to replace)`:B.apiKeyPlaceholder,U=x===`vellum`,me=U&&B.supportsVoiceSelection,he=(0,$.jsxs)(l,{variant:`link`,size:`compact`,className:`inline-flex h-auto items-center gap-1 px-0 underline [--vbtn-fg:var(--content-tertiary)]`,onClick:()=>{ae(!1),I.some(e=>e.model===R)||ne(ee||I[0]?.model||``)},children:[(0,$.jsx)(nn,{className:`h-3.5 w-3.5`,"aria-hidden":!0}),i(`ttsProviderForm.chooseFromCatalog`)]}),ge=me&&z&&I.length>0?he:null;return(0,$.jsxs)(`div`,{className:`space-y-4`,children:[(0,$.jsxs)(`div`,{className:`space-y-1`,children:[(0,$.jsx)(`label`,{className:`block text-body-small-default text-[var(--content-tertiary)]`,children:i(`ttsProviderForm.provider`)}),(0,$.jsx)(K,{value:x,onChange:S,options:f.map(e=>({value:e.id,label:e.displayName})),"aria-label":i(`ttsProviderForm.providerAriaLabel`)})]}),!U&&(0,$.jsxs)(`div`,{className:`space-y-1`,children:[(0,$.jsx)(`label`,{className:`block text-body-small-default text-[var(--content-tertiary)]`,children:i(`ttsProviderForm.apiKey`)}),(0,$.jsx)(G,{type:`password`,value:C,onChange:e=>w(e.target.value),placeholder:pe,fullWidth:!0})]}),me&&(0,$.jsxs)(`div`,{className:`space-y-1`,children:[(0,$.jsx)(`label`,{className:`block text-body-small-default text-[var(--content-tertiary)]`,children:i(`ttsProviderForm.voice`)}),z?(0,$.jsx)(G,{type:`text`,value:R,onChange:e=>ne(e.target.value),placeholder:i(`ttsProviderForm.voiceIdPlaceholder`),"aria-label":i(`ttsProviderForm.customVoiceIdAriaLabel`),fullWidth:!0}):re?(0,$.jsx)(Ar,{assistantId:o,value:R,onChange:ne}):L&&(0,$.jsx)(`p`,{className:`text-body-small-default text-[var(--content-tertiary)]`,children:i(`ttsProviderForm.noManagedVoices`)})]}),B.supportsVoiceSelection&&!U&&(0,$.jsxs)(`div`,{className:`space-y-1`,children:[(0,$.jsx)(`label`,{className:`block text-body-small-default text-[var(--content-tertiary)]`,children:i(`ttsProviderForm.voiceId`)}),(0,$.jsx)(G,{type:`text`,value:T,onChange:e=>E(e.target.value),placeholder:i(`ttsProviderForm.voiceIdPlaceholder`),fullWidth:!0})]}),!n&&!U&&(0,$.jsx)(fn,{guide:B.credentialsGuide}),(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[!U&&(0,$.jsx)(l,{variant:`outlined`,onClick:fe,disabled:j,children:i(j?`ttsProviderForm.testing`:`ttsProviderForm.test`)}),(0,$.jsxs)(`div`,{className:`flex items-center gap-3`,children:[ge,!t&&(0,$.jsx)(dn,{onClick:ue,disabled:!H||P}),k&&!U&&(0,$.jsx)(un,{onClick:de})]})]})]})}function Nr(){let{t:e}=Y(`settings`);return(0,$.jsx)(ln,{id:`text-to-speech`,title:e(`textToSpeechCard.title`),subtitle:e(`textToSpeechCard.subtitle`),children:(0,$.jsx)(Mr,{})})}var Pr=`default`;function Fr(){let{t:e}=Y(`settings`),t=yt(),n=Z(),{data:i}=J({...pt({path:{assistant_id:t}}),staleTime:3e4}),a=de({onSuccess:e=>{Xe(n,{path:{assistant_id:t}},e)}}),o=vn(),s=(0,Q.useMemo)(()=>i?i.services?.[`web-fetch`]?.provider||V(`vellum:ai:webFetchProvider`,Pr):V(x,Pr),[i]),c=(0,Q.useMemo)(()=>i?.services?.[`web-fetch`]?.apiBase??``,[i]),[l,u]=(0,Q.useState)(!1),[d,p]=yn(s),[m,h]=yn(c),[g,_]=(0,Q.useState)(``),v=z.has(d),y=H.has(d),{hasStoredCredential:b}=L({assistantId:t,credentialKind:`api_key`,credentialName:d,enabled:y}),S=g.trim().length>0,w=m.trim(),T=Ut(d,v&&w.length>0),E=d!==s||v&&w!==c.trim(),D=l||y&&!T&&!b&&!S||!E&&!S,O=r(ne[d]??e(`webFetchCard.apiKeyPlaceholder`),b),k=me[d]??``,A=(0,Q.useCallback)(async()=>{u(!0);let r=g.trim(),i=y&&r.length>0;try{i&&await o(d,r),await a.mutateAsync({path:{assistant_id:t},body:{services:{"web-fetch":{provider:d,...v?{apiBase:w}:{}}}}}).catch(t=>{throw q.error(e(`webFetchCard.configUpdateFailedToast`)),f(t,{context:`patch_daemon_config`}),t})}catch{u(!1);return}u(!1);try{if(M(x,d),i){let e=Ee(d);e&&M(e,r);let i=Dt(t,`api_key`,d);n.setQueryData(i,!0),n.invalidateQueries({queryKey:i}),_(``)}q.success(e(`webFetchCard.savedToast`))}catch(t){f(t,{context:`settings-ai-web-fetch-persist-local`}),q.error(e(`webFetchCard.localPreferencesFailedToast`))}},[y,a,o,n,t,g,d,v,w,e]),j=(0,Q.useCallback)(()=>{let e=Ee(d);e&&U(e),_(``),h(``),p(Pr),M(x,Pr)},[d,p,h]);return(0,$.jsx)(ln,{id:`web-fetch`,title:e(`webFetchCard.title`),subtitle:e(`webFetchCard.subtitle`),children:(0,$.jsxs)(`div`,{className:`space-y-4`,children:[(0,$.jsxs)(`div`,{className:`space-y-1`,children:[(0,$.jsx)(`label`,{className:`block text-body-small-default text-[var(--content-tertiary)]`,children:e(`webFetchCard.providerLabel`)}),(0,$.jsx)(K,{value:d,onChange:p,options:N.map(e=>({value:e,label:C[e]??e}))})]}),v&&(0,$.jsxs)(`div`,{className:`space-y-1`,children:[(0,$.jsx)(G,{label:e(`webFetchCard.apiBaseLabel`),type:`url`,value:m,onChange:e=>h(e.target.value),placeholder:k||e(`webFetchCard.apiBasePlaceholder`),fullWidth:!0}),k?(0,$.jsx)(`p`,{className:`text-body-small-lighter text-[var(--content-tertiary)]`,children:e(`webFetchCard.apiBaseHint`,{defaultBase:k})}):null]}),y&&(0,$.jsx)(G,{label:e(`webFetchCard.apiKeyLabel`),type:`password`,value:g,onChange:e=>_(e.target.value),placeholder:O,fullWidth:!0}),(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(dn,{onClick:A,disabled:D}),l&&(0,$.jsx)(rn,{className:`h-4 w-4 animate-spin text-[var(--content-disabled)]`}),y&&(0,$.jsx)(un,{onClick:j,filled:!0})]})]})})}var Ir=`0.10.12`;function Lr(){return s(Ir)}function Rr(){let{t:e}=Y(`settings`),t=yt(),n=Z(),i=He(),{data:a}=J({...pt({path:{assistant_id:t}}),enabled:i,staleTime:3e4}),s=de({onSuccess:e=>{Xe(n,{path:{assistant_id:t}},e)}}),c=vn(),l=(0,Q.useMemo)(()=>{if(!a)return V(y,`inference-provider-native`);let e=a.services?.[`web-search`];return(e?.mode===`managed`&&e?.provider!==`inference-provider-native`?`vellum`:e?.provider)||V(`vellum:ai:webSearchProvider`,`inference-provider-native`)},[a]),u=(0,Q.useMemo)(()=>a?.services?.[`web-search`]?.apiBase??``,[a]),[d,m]=(0,Q.useState)(!1),[h,g]=yn(l),[v,x]=yn(u),[S,C]=(0,Q.useState)(``),w=ke.has(h),T=b.has(h),E=_.has(h),{hasStoredCredential:D}=L({assistantId:t,credentialKind:`api_key`,credentialName:h,enabled:T}),O=S.trim().length>0,k=v.trim(),A=Ut(h,w&&k.length>0),j=h!==l||w&&k!==u.trim(),N=ue[h]??``,P=T&&!E&&!A&&!D&&!O,F=w&&N.length===0&&!k,I=d||P||F||!j&&!O,ee=r(ot[h]??e(`webSearchCard.apiKeyPlaceholder`),D),te=(0,Q.useCallback)(async()=>{m(!0);let r=S.trim(),i=p(h),a=T&&r.length>0;try{a&&await c(h,r),await he();let n=h===`vellum`?Lr()?{provider:`vellum`,mode:`managed`}:{mode:`managed`}:{provider:h,mode:`your-own`,...w?{apiBase:k}:{}};await s.mutateAsync({path:{assistant_id:t},body:{services:{"web-search":n}}}).catch(t=>{throw q.error(e(`webSearchCard.configUpdateFailedToast`)),f(t,{context:`patch_daemon_config`}),t})}catch{m(!1);return}m(!1);try{if(M(y,h),a){i&&M(i,r);let e=Dt(t,`api_key`,h);n.setQueryData(e,!0),n.invalidateQueries({queryKey:e}),C(``)}q.success(e(`webSearchCard.savedToast`))}catch(t){f(t,{context:`settings-ai-web-search-persist-local`}),q.error(e(`webSearchCard.localPreferencesFailedToast`))}},[T,s,c,n,t,S,h,w,k,e]),R=(0,Q.useCallback)(()=>{let e=p(h);e&&U(e),C(``),x(``),g(`inference-provider-native`),M(y,`inference-provider-native`)},[h,g,x]);return(0,$.jsx)(ln,{title:e(`webSearchCard.title`),subtitle:e(`webSearchCard.subtitle`),children:(0,$.jsxs)(`div`,{className:`space-y-4`,children:[(0,$.jsxs)(`div`,{className:`space-y-1`,children:[(0,$.jsx)(`label`,{className:`block text-body-small-default text-[var(--content-tertiary)]`,children:e(`webSearchCard.providerLabel`)}),(0,$.jsx)(K,{"aria-label":e(`webSearchCard.providerAriaLabel`),value:h,onChange:g,options:o.map(e=>({value:e,label:ut[e]??e}))})]}),h===`vellum`&&(0,$.jsx)(`p`,{className:`text-body-medium-lighter text-[var(--content-tertiary)]`,children:e(`webSearchCard.vellumNote`)}),w&&(0,$.jsxs)(`div`,{className:`space-y-1`,children:[(0,$.jsx)(G,{label:e(`webSearchCard.apiBaseLabel`),type:`url`,value:v,onChange:e=>x(e.target.value),placeholder:N||e(`webSearchCard.apiBasePlaceholder`),fullWidth:!0}),N?(0,$.jsx)(`p`,{className:`text-body-small-lighter text-[var(--content-tertiary)]`,children:e(`webSearchCard.apiBaseHint`,{defaultBase:N})}):null]}),T&&(0,$.jsx)(G,{label:e(`webSearchCard.apiKeyLabel`),type:`password`,value:S,onChange:e=>C(e.target.value),placeholder:ee,fullWidth:!0}),(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(dn,{onClick:te,disabled:I}),d&&(0,$.jsx)(rn,{className:`h-4 w-4 animate-spin text-[var(--content-disabled)]`}),T&&(0,$.jsx)(un,{onClick:R,filled:!0})]})]})})}function zr(){let e=yt(),t=ze(),[n,r]=(0,Q.useState)(null);(0,Q.useEffect)(()=>{let e=window.location.hash.slice(1);e&&requestAnimationFrame(()=>{document.getElementById(e)?.scrollIntoView({block:`start`})})},[]);let i=(0,$.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-5 overflow-y-auto`,children:[(0,$.jsx)(tr,{}),(0,$.jsx)($n,{panel:n,onOpenPanel:r,onClosePanel:()=>r(null)}),(0,$.jsx)(Rr,{}),(0,$.jsx)(Fr,{}),(0,$.jsx)(wn,{}),(0,$.jsx)(Nr,{}),(0,$.jsx)(Tr,{})]}),a=`${e??`none`}:${n?.kind===`profile`?`profile:${n.name}`:n?.kind===`provider`?`provider:${n.name}`:n?.kind??`closed`}`,o=n?.kind===`provider`||n?.kind===`add-provider`,s=n!=null&&e?n.kind===`overrides`?(0,$.jsx)(mr,{assistantId:e,onClose:()=>r(null)},a):o?(0,$.jsx)(_r,{assistantId:e,connectionName:n.kind===`provider`?n.name:null,onClose:()=>r(null)},a):(0,$.jsx)(nr,{assistantId:e,profileName:n.kind===`profile`?n.name:null,onClose:()=>r(null)},a):null;return s&&t?(0,$.jsx)(mn,{children:s}):s?(0,$.jsx)(gn,{storageKey:`aiSettingsDetailDrawerWidth`,detailKey:a,section:i,detail:s}):i}export{zr as AiPage};
|