@vellumai/web 0.12.3-dev.202609221821.7bf89b6 → 0.12.3-dev.202609222016.8d633dd
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-rpUtKVJL.js → a2a-invite-Bt3jJ8eU.js} +1 -1
- package/dist/assets/{about-page-DSrJ-Dhn.js → about-page-DPs4Y_A6.js} +1 -1
- package/dist/assets/{account-page-DwcSa3bn.js → account-page-M3u8qB4f.js} +1 -1
- package/dist/assets/{account-shell-9tuvWEti.js → account-shell-DNIMNmBA.js} +1 -1
- package/dist/assets/{acp-run-detail-panel-DbkPWx6s.js → acp-run-detail-panel-CAEtHOOC.js} +1 -1
- package/dist/assets/{activation-list-route-BZLFv_7I.js → activation-list-route-BKC7B03I.js} +1 -1
- package/dist/assets/{activity-redirect-page-Cn8PLcZA.js → activity-redirect-page-BwZtUVUA.js} +1 -1
- package/dist/assets/{activity-steps-panel-DKHpONt0.js → activity-steps-panel-CTttmau3.js} +1 -1
- package/dist/assets/add-credits-modal-BnlgerS-.js +1 -0
- package/dist/assets/{add-credits-modal-L7gIi3LJ.js → add-credits-modal-CX9RoqXd.js} +1 -1
- package/dist/assets/{ai-page-BA60K82Y.js → ai-page-CouKS5ob.js} +1 -1
- package/dist/assets/{android-billing-handoff-UM5sb6BP.js → android-billing-handoff-DY5xG0W8.js} +1 -1
- package/dist/assets/{api-key-screen-CZf385-r.js → api-key-screen-CCD0pS8l.js} +1 -1
- package/dist/assets/app-BPN4-Rka.css +2 -0
- package/dist/assets/{app-info-BlGLs8-S.js → app-info-BMUxi4jw.js} +1 -1
- package/dist/assets/{app-C-wZhPGb.js → app-us2PS4GU.js} +15 -15
- package/dist/assets/{archive-redirect-page-DsQk9pia.js → archive-redirect-page-BThrzA7i.js} +1 -1
- package/dist/assets/{assistant-handle-modal-HfTl8aq7.js → assistant-handle-modal-MRdBXkfV.js} +1 -1
- package/dist/assets/{assistant-inbox-page-route-fjnXYa3H.js → assistant-inbox-page-route-CKmPZCeH.js} +1 -1
- package/dist/assets/{assistant-inbox-upgrade-body-BNp6nHh6.js → assistant-inbox-upgrade-body-Ble4H_sY.js} +1 -1
- package/dist/assets/{assistant-status-panel-B8DaRgbY.js → assistant-status-panel-CigLNqL4.js} +1 -1
- package/dist/assets/auth-store-aYPcqwKP.js +1 -0
- package/dist/assets/{auth-welcome-screen-C4-dDwdn.js → auth-welcome-screen-CqFdFsC7.js} +1 -1
- package/dist/assets/avatar-bundled-components-BtuYfmGt.js +1 -0
- package/dist/assets/{avatar-random-ClUz-XYn.js → avatar-random-CprsktJ5.js} +2 -2
- package/dist/assets/{await-org-header-settled-B-w086FN.js → await-org-header-settled-CehgUVhD.js} +1 -1
- package/dist/assets/background-task-detail-panel-s3HPEXUs.js +1 -0
- package/dist/assets/{billing-page-B13vXNP8.js → billing-page-dkhDfifV.js} +3 -3
- package/dist/assets/{billing-redirect-page-CtxhbZne.js → billing-redirect-page-D8Amb6p1.js} +1 -1
- package/dist/assets/{bookmarks-page-D2xAAGsa.js → bookmarks-page-Djnn9SKx.js} +1 -1
- package/dist/assets/{bundle-confirm-page-DRhF9iZ1.js → bundle-confirm-page-B_IjNHzr.js} +1 -1
- package/dist/assets/{channel-transcript-panel-dBPN6rEH.js → channel-transcript-panel-DbnL3lPs.js} +1 -1
- package/dist/assets/{channels-page-route-DTtZ6o3O.js → channels-page-route-Cp8KVpyN.js} +1 -1
- package/dist/assets/{chat-info-panel-BWmzYnLi.js → chat-info-panel-B-j6yYzM.js} +1 -1
- package/dist/assets/{checkout-continuation-BV6GD_b5.js → checkout-continuation-BDRZfq1p.js} +1 -1
- package/dist/assets/{checkout-page-CE2p7Jt5.js → checkout-page-hZfW4fv3.js} +1 -1
- package/dist/assets/checkout-return-target-SgAqyqRH.js +1 -0
- package/dist/assets/command-palette-B8pY8ncR.js +1 -0
- package/dist/assets/{command-palette-CnbKLCKX.js → command-palette-C_Lt0zLM.js} +1 -1
- package/dist/assets/{command-palette-window-page-CMoJft53.js → command-palette-window-page-D3irpMXl.js} +1 -1
- package/dist/assets/{community-page-Dz7j87Kp.js → community-page-CNY9qL5h.js} +1 -1
- package/dist/assets/{companion-accent-DUu5OBRn.js → companion-accent-Dx_Qm61H.js} +1 -1
- package/dist/assets/{companion-dock-zones-page-B08n38IE.js → companion-dock-zones-page-DOpLkfsw.js} +1 -1
- package/dist/assets/{companion-layout-DMCsDoU-.js → companion-layout-CoiAWMjI.js} +1 -1
- package/dist/assets/{companion-popover-D5ci8gd2.js → companion-popover-BgY_ijmJ.js} +1 -1
- package/dist/assets/{companion-popover-page-sOeYONG0.js → companion-popover-page--GndGcK4.js} +1 -1
- package/dist/assets/{companion-surface-BmDWzCJq.js → companion-surface-DoOqM1v4.js} +1 -1
- package/dist/assets/{companion-surface-page-LTMduoaR.js → companion-surface-page-C4koT4-2.js} +1 -1
- package/dist/assets/{companion-tour-entry-B04mc9a_.js → companion-tour-entry-NEUncB0b.js} +1 -1
- package/dist/assets/{companion-watch-frame-page-B1zgyOjy.js → companion-watch-frame-page-DRkDxDHS.js} +1 -1
- package/dist/assets/{connect-page-40kgW1kr.js → connect-page-DtNwAJkf.js} +1 -1
- package/dist/assets/{consent-controls-B6XS9FNK.js → consent-controls-Cf5FPKu0.js} +1 -1
- package/dist/assets/{contacts-gateway-Da3XyIxC.js → contacts-gateway-DW18PwBx.js} +1 -1
- package/dist/assets/{contacts-page-route-BFjzsIEr.js → contacts-page-route-BEy8CTTP.js} +1 -1
- package/dist/assets/{copy-button-YBbRBpVY.js → copy-button-kG0OCzWB.js} +1 -1
- package/dist/assets/{credential-entry-page-CnM_gM6G.js → credential-entry-page-1rcno_Nv.js} +1 -1
- package/dist/assets/{credentials-page-Ckduz8-9.js → credentials-page-BKnRCJ1n.js} +1 -1
- package/dist/assets/{csv-preview-DLQFnxiD.js → csv-preview-DRoNFm19.js} +1 -1
- package/dist/assets/{danger-zone-redirect-page-C1LHEr_R.js → danger-zone-redirect-page-BVsh75CA.js} +1 -1
- package/dist/assets/{debug-page-BKCAAURl.js → debug-page-CYZcONX6.js} +1 -1
- package/dist/assets/{deploy-dialogs-D_E-lfCK.js → deploy-dialogs-BT9WVH8B.js} +1 -1
- package/dist/assets/deploy-dialogs-D09xKRvM.js +1 -0
- package/dist/assets/{desktop-preview-content-BQGpjEe0.js → desktop-preview-content-XteajSAE.js} +2 -2
- package/dist/assets/{desktop-status-BvB0K7jR.js → desktop-status-Dv_6dQJI.js} +1 -1
- package/dist/assets/{desktop-viewer-BxQU7CEw.js → desktop-viewer-CcpVuAhA.js} +1 -1
- package/dist/assets/{detail-card-O-mgqs4J.js → detail-card-CXrAh5Pw.js} +1 -1
- package/dist/assets/{detail-panel-stop-button-CM_5jWd2.js → detail-panel-stop-button-D8HXIu6S.js} +1 -1
- package/dist/assets/{detail-primitives-BbKqS783.js → detail-primitives-RYLHwqmj.js} +1 -1
- package/dist/assets/{developer-page-C_USVBb_.js → developer-page-DHdyHGgw.js} +1 -1
- package/dist/assets/{devices-redirect-page-BLAPHg-m.js → devices-redirect-page-DbPU38GG.js} +1 -1
- package/dist/assets/{dictation-overlay-page-CzsDblZu.js → dictation-overlay-page-BCxCENty.js} +1 -1
- package/dist/assets/{document-load-BfL9V5FL.js → document-load-CuNiVamG.js} +1 -1
- package/dist/assets/document-load-D-bTAgoc.js +1 -0
- package/dist/assets/{document-viewer-page-BGJFumBL.js → document-viewer-page-DY_gLIqS.js} +1 -1
- package/dist/assets/{emails-page-Co7lzG4f.js → emails-page-BCc2DRrZ.js} +1 -1
- package/dist/assets/{file-diff-view-DVXDgEcJ.js → file-diff-view-COX-tS5p.js} +1 -1
- package/dist/assets/{file-editor-EYVSB7rU.js → file-editor-DH80o-wQ.js} +1 -1
- package/dist/assets/{general-page-CcM9rHEe.js → general-page-or_vCZkV.js} +1 -1
- package/dist/assets/{hatching-screen-ATSS2gAO.js → hatching-screen-Dq33n2Dl.js} +1 -1
- package/dist/assets/{hosting-screen-1_wbu9v2.js → hosting-screen-B1O9DLG5.js} +1 -1
- package/dist/assets/{identity-page-route-DqIqHVqU.js → identity-page-route-CtWMAmBP.js} +1 -1
- package/dist/assets/{inspect-page-CIKzZ3Go.js → inspect-page-BykAm472.js} +3 -3
- package/dist/assets/{integrations-page-D4XuB6Ss.js → integrations-page-DK9wv67b.js} +1 -1
- package/dist/assets/{intelligence-layout-BACtRsUg.js → intelligence-layout-BpZHBMFQ.js} +1 -1
- package/dist/assets/{intelligence-layout-slots-store-DiVtjSXI.js → intelligence-layout-slots-store-BgcVf55B.js} +1 -1
- package/dist/assets/{keyboard-shortcuts-redirect-page-BAkyJmAV.js → keyboard-shortcuts-redirect-page-CVBgUELo.js} +1 -1
- package/dist/assets/{latest-assistant-text-CC-6y2Pv.js → latest-assistant-text-nefhmLY5.js} +1 -1
- package/dist/assets/{library-detail-page-DM2tSzMh.js → library-detail-page-DSHgenhM.js} +1 -1
- package/dist/assets/{library-page-BW3ieBF_.js → library-page-Ma4c5BHW.js} +1 -1
- package/dist/assets/local-mode-DNKdA9bg.js +1 -0
- package/dist/assets/{login-page-1ybjD0os.js → login-page-Rwmdrh6U.js} +1 -1
- package/dist/assets/{logout-page-C8zVSmFH.js → logout-page-BAGlooOn.js} +1 -1
- package/dist/assets/{logs-layout-DY9jmb_A.js → logs-layout-C6zZyfNk.js} +1 -1
- package/dist/assets/{markdown-preview-BtGbWmR_.js → markdown-preview-BWRjtjMD.js} +1 -1
- package/dist/assets/{media-preview-Cx8XbpMH.js → media-preview-DyKGPRfj.js} +1 -1
- package/dist/assets/{memory-page-route-DWVdG4UQ.js → memory-page-route-eFzXaHHd.js} +1 -1
- package/dist/assets/{memory-router-playground-page-D8oUR4wu.js → memory-router-playground-page-BfCkld8Q.js} +1 -1
- package/dist/assets/{message-files-panel-DbskbwJP.js → message-files-panel-CjrqOfQk.js} +1 -1
- package/dist/assets/{metric-card-Be70UfW4.js → metric-card-DwTBbP-s.js} +1 -1
- package/dist/assets/native-attachment-pickers-C1QtqeN0.js +1 -0
- package/dist/assets/native-file-DPvUzZiK.js +1 -0
- package/dist/assets/{notifications-page-DMQxTCTd.js → notifications-page-Dpx73ipn.js} +1 -1
- package/dist/assets/{oauth-complete-page-CKirHnhC.js → oauth-complete-page-DXtyzBCi.js} +1 -1
- package/dist/assets/{oauth-popup-complete-page-CN6GRnF6.js → oauth-popup-complete-page-DpSrH-CM.js} +1 -1
- package/dist/assets/{old-chats-page-route-BcRKkk3Z.js → old-chats-page-route-BN5SXQPs.js} +1 -1
- package/dist/assets/paired-platform-identity-BsWnSCYy.js +1 -0
- package/dist/assets/{pairing-page-BHeQPwJo.js → pairing-page-WVv4Q_ed.js} +1 -1
- package/dist/assets/password-reset-page-0uJmFyi7.js +1 -0
- package/dist/assets/{pdf-file-preview-DmYcy63l.js → pdf-file-preview-BkSLufw2.js} +1 -1
- package/dist/assets/{personality-page-BE_FULCo.js → personality-page-BR3TURv2.js} +1 -1
- package/dist/assets/{personality-page-Cq98ELod.js → personality-page-gOIWNiul.js} +1 -1
- package/dist/assets/{personality-sliders-D0XQLKCB.js → personality-sliders-CXVvbIQC.js} +1 -1
- package/dist/assets/{plans-page-DJWoTfXs.js → plans-page-W8x4y_ir.js} +1 -1
- package/dist/assets/{platform-loopback-page-CCOobJjk.js → platform-loopback-page-DcMcvqLE.js} +1 -1
- package/dist/assets/{plugin-detail-page-BUAFJ4Ld.js → plugin-detail-page-ClG2F3d4.js} +1 -1
- package/dist/assets/{plugins-page-Bu0FXgMQ.js → plugins-page-wpXokMWh.js} +1 -1
- package/dist/assets/plugins-surface-BDCoAAn1.js +1 -0
- package/dist/assets/{preview-error-BpG0FZB3.js → preview-error-mC5vz-hK.js} +1 -1
- package/dist/assets/{privacy-page-c3ITvzzX.js → privacy-page-J45woqco.js} +1 -1
- package/dist/assets/{privacy-screen-BIvy5Umz.js → privacy-screen-Dm90F_rR.js} +1 -1
- package/dist/assets/{profile-card-COP41sjI.js → profile-card-C__Qda2q.js} +1 -1
- package/dist/assets/{provider-callback-page-CIWXTk6f.js → provider-callback-page-RftUijLN.js} +1 -1
- package/dist/assets/{provider-key-BTZiPZST.js → provider-key-PYCDLSht.js} +1 -1
- package/dist/assets/{provider-signup-page-D9Qudii-.js → provider-signup-page-zJJ5FCqN.js} +1 -1
- package/dist/assets/{quick-input-page-B5L8Ds74.js → quick-input-page-CeeW66FY.js} +1 -1
- package/dist/assets/referral-modal-CFt1VoL0.js +1 -0
- package/dist/assets/{referral-modal-D_pnYQz-.js → referral-modal-Vg5tRHMF.js} +1 -1
- package/dist/assets/{research-mock-page-BhESqsuu.js → research-mock-page-BynHyOpm.js} +1 -1
- package/dist/assets/{research-onboarding-route-DyzHRjSQ.js → research-onboarding-route-TR-ZCAxZ.js} +1 -1
- package/dist/assets/{review-terms-screen-ES46zYiC.js → review-terms-screen-MaXoE9bC.js} +1 -1
- package/dist/assets/routes-BT7h4fTW.js +1 -0
- package/dist/assets/{schedules-q7veJ5HI.js → schedules-Bm74CJrl.js} +1 -1
- package/dist/assets/{schedules-page-DFT05gvL.js → schedules-page-DEmV1_lI.js} +1 -1
- package/dist/assets/{security-redirect-page-qfbu6JR6.js → security-redirect-page-DXwLQ2GI.js} +1 -1
- package/dist/assets/{select-assistant-screen-CzQNjgwy.js → select-assistant-screen-DKf9lyhg.js} +1 -1
- package/dist/assets/{self-hosted-servers-B7rOSA5m.js → self-hosted-servers-m5WnOe94.js} +1 -1
- package/dist/assets/{service-form-controls-CnjbPFu2.js → service-form-controls-BtVHaQ3H.js} +1 -1
- package/dist/assets/{setting-row-CLJs2zck.js → setting-row-CnF3kR3w.js} +1 -1
- package/dist/assets/{settings-layout-4TepjURb.js → settings-layout-CeBHGoSc.js} +1 -1
- package/dist/assets/share-feedback-modal-B0EQXVXy.js +1 -0
- package/dist/assets/{share-feedback-modal-DRAuLHDG.js → share-feedback-modal-CBKUxmOF.js} +1 -1
- package/dist/assets/{sidebar-tree-rGNUN_eY.js → sidebar-tree-wm8X9KBw.js} +1 -1
- package/dist/assets/{signup-page-CjcDy3Ss.js → signup-page-CsaJHnuI.js} +1 -1
- package/dist/assets/{signup-shell-BQCD3z3s.js → signup-shell-DVYv6JFa.js} +1 -1
- package/dist/assets/{skill-detail-page-wiFXyhlD.js → skill-detail-page-i3oyXU_H.js} +1 -1
- package/dist/assets/{skill-detail-panel-Chto7xuu.js → skill-detail-panel-DnYhON7-.js} +1 -1
- package/dist/assets/{skill-removal-dialog-CGIvvyjE.js → skill-removal-dialog-DcMo1V2z.js} +1 -1
- package/dist/assets/{skills-page-D6REfFff.js → skills-page-BnXhIbTc.js} +1 -1
- package/dist/assets/{sounds-page-jR1uExZU.js → sounds-page-IxoxE2nR.js} +1 -1
- package/dist/assets/{start-screen-BcYQecj2.js → start-screen-DXy2OwKK.js} +1 -1
- package/dist/assets/{step-detail-header-DWg_Ya-k.js → step-detail-header-CC5kX9fv.js} +1 -1
- package/dist/assets/{stt-language-picker-modal-Dcb8KJyU.js → stt-language-picker-modal-CFESIfez.js} +1 -1
- package/dist/assets/{subagent-detail-panel-Dl8pMgyw.js → subagent-detail-panel-DMTsYhcN.js} +1 -1
- package/dist/assets/{superpowers-page-BBuDYrDC.js → superpowers-page-DKOHdMVI.js} +1 -1
- package/dist/assets/{system-events-page-Biuen0Zo.js → system-events-page-DsvvELPZ.js} +1 -1
- package/dist/assets/{system-events-redirect-page-B6SKQa_5.js → system-events-redirect-page-CDawpD0E.js} +1 -1
- package/dist/assets/{teleport-gateway-client-CDD1KMDO.js → teleport-gateway-client-BTcyOBR7.js} +1 -1
- package/dist/assets/{text-preview-DVhnVJOY.js → text-preview-E3QCyz1w.js} +1 -1
- package/dist/assets/{theme-stage-page-DR-3WxXL.js → theme-stage-page-22VMS8Gy.js} +1 -1
- package/dist/assets/{tiptap-document-editor-DFY9XJTq.js → tiptap-document-editor-BwljzYae.js} +1 -1
- package/dist/assets/tool-detail-panel-C28_Q2YO.js +1 -0
- package/dist/assets/{tool-detail-panel-DyNooXqZ.js → tool-detail-panel-CReDJ1T-.js} +1 -1
- package/dist/assets/{trait-cycle-row-DMLZ-t-y.js → trait-cycle-row-BUpWQBgr.js} +1 -1
- package/dist/assets/{upgrade-cancel-page-BDlRSUqK.js → upgrade-cancel-page-DwEyIsWw.js} +1 -1
- package/dist/assets/{upgrade-success-page-DSoxVSak.js → upgrade-success-page-fdmnlEWt.js} +1 -1
- package/dist/assets/{usage-redirect-page-BxidYk4Q.js → usage-redirect-page-C6Y9ICeC.js} +1 -1
- package/dist/assets/{use-app-delete-Br82nF3r.js → use-app-delete-ViHPnFbc.js} +1 -1
- package/dist/assets/{use-assistant-identity-details-B_OgDh7J.js → use-assistant-identity-details-zknnSXEB.js} +1 -1
- package/dist/assets/{use-checkout-dismiss-refresh-DJ0B9qDl.js → use-checkout-dismiss-refresh-BtfAKtAo.js} +1 -1
- package/dist/assets/{use-edge-swipe-back-DMXyTZh8.js → use-edge-swipe-back-CxH4vxZq.js} +1 -1
- package/dist/assets/{use-hotkey-recorder-rNDaFPiG.js → use-hotkey-recorder-DOyr7M56.js} +1 -1
- package/dist/assets/{use-invite-link-dialog-DNVUVSPc.js → use-invite-link-dialog-CvHzOcOd.js} +1 -1
- package/dist/assets/{use-plugins-list-BNo_insH.js → use-plugins-list-CKQld1A_.js} +1 -1
- package/dist/assets/{use-return-to-short-circuit-D3W1j8_p.js → use-return-to-short-circuit-ChzpOLEA.js} +1 -1
- package/dist/assets/{use-side-list-room-B8iJQBjV.js → use-side-list-room-rLN51QLa.js} +1 -1
- package/dist/assets/{use-skill-actions-CDTevDeN.js → use-skill-actions-B_jPrbNj.js} +1 -1
- package/dist/assets/{use-skill-detail-files-C2I-W_6d.js → use-skill-detail-files-DFvATRQR.js} +1 -1
- package/dist/assets/use-supports-credentials-settings-D45j_Lir.js +1 -0
- package/dist/assets/{use-transcript-message-by-id-fb9RfgpU.js → use-transcript-message-by-id-Dg564j4O.js} +1 -1
- package/dist/assets/{voice-page-Cg5HTTU6.js → voice-page-Bm_uvsNw.js} +1 -1
- package/dist/assets/{wake-detail-panel-CIRErKz5.js → wake-detail-panel-ixPIyLOp.js} +1 -1
- package/dist/assets/{weather-forecast-display-DytQZB66.js → weather-forecast-display-DvsGbQSR.js} +1 -1
- package/dist/assets/{welcome-screen-mUjbg2ZX.js → welcome-screen-BWg57eWA.js} +1 -1
- package/dist/assets/workflow-detail-panel-C23nxps4.js +1 -0
- package/dist/assets/{workspace-page-CcR75TmT.js → workspace-page-BqKd4go2.js} +1 -1
- package/dist/index.html +2 -2
- package/package.json +1 -1
- package/dist/assets/add-credits-modal-BjLOYpON.js +0 -1
- package/dist/assets/app-Ckr__uf0.css +0 -2
- package/dist/assets/auth-store-D5fIEDuM.js +0 -1
- package/dist/assets/avatar-bundled-components-Dqvfk3JI.js +0 -1
- package/dist/assets/background-task-detail-panel-D6VbY-15.js +0 -1
- package/dist/assets/checkout-return-target-OgaNdTih.js +0 -1
- package/dist/assets/command-palette-De5LXJEw.js +0 -1
- package/dist/assets/deploy-dialogs-DbMyJRIl.js +0 -1
- package/dist/assets/document-load-BowuaJW9.js +0 -1
- package/dist/assets/local-mode-Col1KVEd.js +0 -1
- package/dist/assets/native-attachment-pickers-Cu5J-c7L.js +0 -1
- package/dist/assets/native-file--4Pr6VoX.js +0 -1
- package/dist/assets/paired-platform-identity-05pXKejO.js +0 -1
- package/dist/assets/password-reset-page-BY0PLfaL.js +0 -1
- package/dist/assets/plugins-surface-h2Q62FgB.js +0 -1
- package/dist/assets/referral-modal-BqoitLku.js +0 -1
- package/dist/assets/routes-C4ufBd10.js +0 -1
- package/dist/assets/share-feedback-modal-CQOPd6US.js +0 -1
- package/dist/assets/tool-detail-panel-BoOhuSkU.js +0 -1
- package/dist/assets/use-supports-credentials-settings-CTo63rZG.js +0 -1
- package/dist/assets/workflow-detail-panel-BAQAFgda.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{$x as e}from"./app-
|
|
1
|
+
import{$x as e}from"./app-us2PS4GU.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{aC as t,eS as n,kC as r,mg as i}from"./app-
|
|
1
|
+
import{o as e}from"./rolldown-runtime-BM3Ffeng.js";import{aC as t,eS as n,kC as r,mg as i}from"./app-us2PS4GU.js";import{j as a}from"./vendor-GPbHjL0d.js";import{t as o,x as s}from"./react-B9IgSVeK.js";import{n as c,t as l}from"./app-info-BMUxi4jw.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:r(t(),`text-sm`),onClick:e=>{n()&&(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{$x as t,Bc as n,Ty as r,Vc as i,Yc as a,ih as o,oh as s,th as c}from"./app-
|
|
1
|
+
import{o as e}from"./rolldown-runtime-BM3Ffeng.js";import{$x as t,Bc as n,Ty as r,Vc as i,Yc as a,ih as o,oh as s,th as c}from"./app-us2PS4GU.js";import{j as l}from"./vendor-GPbHjL0d.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-DNIMNmBA.js";var h=e(f(),1),g=d();function _(){let{t:e}=l(`account`),d=o(),f=s(),_=c.use.user(),v=c.use.logout(),[y,b]=(0,h.useState)(null),[x,S]=(0,h.useState)(!1),C=async()=>{b(null),S(!0);try{await r(i,n)}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:t.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(),a(t.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{fC as e}from"./app-
|
|
1
|
+
import{fC as e}from"./app-us2PS4GU.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{Bn as t,Gn as n,Jn as r,Kn as i,TC as a,Wn as o,_r as s,cS as c,gr as l,hC as u,kC as d,kn as f,sC as p,vr as m,yr as h}from"./app-
|
|
1
|
+
import{o as e}from"./rolldown-runtime-BM3Ffeng.js";import{Bn as t,Gn as n,Jn as r,Kn as i,TC as a,Wn as o,_r as s,cS as c,gr as l,hC as u,kC as d,kn as f,sC as p,vr as m,yr as h}from"./app-us2PS4GU.js";import{I as g,j as _}from"./vendor-GPbHjL0d.js";import{t as v,x as y}from"./react-B9IgSVeK.js";import{$ as b,$n as x,A as S,Ai as C,Br as w,Cr as T,D as E,Gi as D,Ha as ee,Ii as O,Ki as k,Nr as te,P as A,Va as ne,Ya as re,_t as ie,ha as j,kt as M,mi as ae,qi as N,vt as oe,zi as P}from"./icons-C0wyat6T.js";import{i as se,n as ce,r as F,t as I}from"./metric-card-DwTBbP-s.js";import{o as le}from"./detail-primitives-RYLHwqmj.js";import{t as ue}from"./file-diff-view-COX-tS5p.js";import{t as de}from"./detail-panel-stop-button-D8HXIu6S.js";import{t as fe}from"./status-badge-pill-ADjzXw4Q.js";var pe=re(`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`}]]),L=e(y(),1),R=``;function z(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 B(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(l.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`&&B(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??R,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??R,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!==R&&r&&r.kind===`agent`&&r.messageId===R&&!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??R,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:z(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:z(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=me(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 me(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 he(e){let t=[];for(let n of e)U(t,n);return t}function ge(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 _e(){let e=null,t=[];function n(n){return t=he(n),e=n,t}function r(r){let i=ge(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 ve(e){let t=(0,L.useRef)(null);return t.current??=_e(),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=ye(e);t&&r.push(t)}return r}function ye(e){if(typeof e!=`object`||!e)return null;let t=e;switch(t.type){case`content`:return{type:`content`,text:be(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=xe(t);return e===void 0?{type:`terminal`}:{type:`terminal`,text:e}}default:return null}}function be(e){if(typeof e==`string`)return e;if(typeof e==`object`&&e){let t=e.text;if(typeof t==`string`)return t}return``}function xe(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=v();function Se({content:e,isComplete:n,assistantId:r}){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)(f,{content:e,assistantId:r}),!n&&(0,X.jsx)(t,{className:`mt-1`,"data-testid":`acp-chat-agent-streaming`})]})}function Ce({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)(x,{"aria-hidden":!0,className:`h-3.5 w-3.5 shrink-0`}),(0,X.jsx)(u,{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)(P,{"aria-hidden":!0,className:`mt-0.5 h-4 w-4 shrink-0 text-[var(--system-positive-strong)]`}):(0,X.jsx)(C,{"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 g(`chat:acpChatTerminalBlock.stoppedLimitReached`);case`refusal`:return g(`chat:acpChatTerminalBlock.refused`);case`cancelled`:return g(`chat:acpChatTerminalBlock.cancelled`);default:return g(`chat:acpChatTerminalBlock.completed`)}}function Te(e){return new Date(e).toLocaleTimeString([],{hour:`numeric`,minute:`2-digit`})}function Z({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)(E,{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)(O,{"aria-hidden":!0,className:`h-4 w-4 shrink-0`}),(0,X.jsx)(`span`,{children:i(`acpChatTerminalBlock.cancelled`)}),(0,X.jsx)(Z,{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)(P,{"aria-hidden":!0,className:`h-4 w-4 shrink-0 text-[var(--system-positive-strong)]`}),(0,X.jsx)(`span`,{children:a}),(0,X.jsx)(Z,{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:n,assistantId:r}){let[i,a]=(0,L.useState)(null),o=i??!n,s=e.trim().length>0,c=n?`Thought process`:`Thinking`,l=n?(0,X.jsx)(j,{"aria-hidden":!0,className:`h-3.5 w-3.5 shrink-0`}):(0,X.jsx)(t,{dotSize:5,className:`shrink-0`,"data-testid":`acp-chat-thinking-streaming`});return s?(0,X.jsxs)(`div`,{"data-testid":`acp-chat-thinking-block`,className:`w-full`,children:[(0,X.jsxs)(`button`,{type:`button`,"aria-expanded":o,onClick:()=>a(!o),"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:[o?(0,X.jsx)(N,{"aria-hidden":!0,className:`h-3.5 w-3.5 shrink-0`}):(0,X.jsx)(D,{"aria-hidden":!0,className:`h-3.5 w-3.5 shrink-0`}),l,(0,X.jsx)(`span`,{children:c})]}),o&&(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)(f,{content:e,assistantId:r})})]}):(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:[l,(0,X.jsx)(`span`,{children:c})]})})}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:w,edit:pe,delete:S,move:te,search:oe,execute:A,think:j,fetch:T,switch_mode:M},Pe=new Set([`read`,`edit`,`delete`,`move`]);function Fe({toolKind:e}){return(0,X.jsx)(e&&Ne[e]||ae,{"aria-hidden":!0,className:`h-4 w-4 shrink-0 text-[var(--content-tertiary)]`})}function Q({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:n=!1,onOpenDiff:r,onOpenOutput:i}){let{t:a}=_(`chat`),[o,s]=(0,L.useState)(!1),c=(0,L.useMemo)(()=>G(e.content),[e.content]),l=(0,L.useMemo)(()=>q(e.content),[e.content]),d=(0,L.useMemo)(()=>l.split(`
|
|
3
3
|
`).map(e=>e.trim()).find(e=>e.length>0&&!e.startsWith("```"))||`View output`,[l]),f=(0,L.useMemo)(()=>Y(c,e.locations),[c,e.locations]),m=n&&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??``)||f.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)(u,{variant:`body-small-emphasised`,className:`min-w-0 flex-1 truncate text-[var(--content-default)]`,title:e.title,children:g}),(0,X.jsx)(p,{tone:ke[m],"data-testid":`acp-chat-tool-status`,children:Ae[m]}),h&&(0,X.jsx)(t,{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}),f.length>0&&(0,X.jsx)(`div`,{className:`mt-2 flex flex-wrap gap-1.5`,children:f.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)(w,{"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)(w,{"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)})}),l.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)(A,{"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:d}),(0,X.jsx)(D,{"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":o,onClick:()=>s(e=>!e),className:`flex items-center gap-1 text-body-small-default text-[var(--content-tertiary)] transition-colors hover:text-[var(--content-default)]`,children:[o?(0,X.jsx)(N,{"aria-hidden":!0,className:`h-3.5 w-3.5 shrink-0`}):(0,X.jsx)(D,{"aria-hidden":!0,className:`h-3.5 w-3.5 shrink-0`}),(0,X.jsx)(`span`,{children:a(o?`acpChatToolCard.hideRaw`:`acpChatToolCard.showRaw`)})]}),o&&(0,X.jsxs)(`div`,{className:`mt-1.5 flex flex-col gap-2`,children:[b!==void 0&&(0,X.jsx)(Q,{label:a(`acpChatToolCard.rawInput`),value:b,testId:`acp-chat-tool-raw-input`}),x!==void 0&&(0,X.jsx)(Q,{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)(ce,{icon:(0,X.jsx)(b,{className:`h-4 w-4 shrink-0`,style:{color:`var(--content-secondary)`}}),value:r,valueTitle: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)(f,{content:q(e),hardLineBreaks:!0,assistantId:t})})}var Be=80;function Ve(e){return e.scrollHeight-e.clientHeight-e.scrollTop<=Be}function $(e){let t=(0,L.useRef)(null),n=(0,L.useRef)(!0),[r,i]=(0,L.useState)(!1),a=(0,L.useCallback)(()=>{let e=t.current;e&&(e.scrollTop=e.scrollHeight)},[]),o=(0,L.useCallback)(()=>{let e=t.current;if(!e)return;let r=Ve(e);n.current=r,i(e=>e===!r?e:!r)},[]),s=(0,L.useCallback)(()=>{n.current=!0,a(),i(!1)},[a]),c=(0,L.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,L.useLayoutEffect)(()=>{n.current?a():o()},[e,a,o]),{scrollRef:c,showScrollToLatest:r,scrollToLatest:s}}function He(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 Ue=[];function We({entry:e,onClose:t,assistantId:n}){let{t:r}=_(`chat`),i=h(e.status),{model:o}=e,c=e.inputTokens!==void 0||e.outputTokens!==void 0,l=ve(s(t=>t.byId[e.acpSessionId]?.events??Ue)),[f,p]=(0,L.useState)(null),[m,g]=(0,L.useState)(e.acpSessionId);m!==e.acpSessionId&&(g(e.acpSessionId),p(null));let v=(0,L.useCallback)((e,t)=>p({kind:`diff`,toolCallId:e,path:t.path}),[]),y=(0,L.useCallback)(e=>p({kind:`output`,toolCallId:e}),[]),b=(0,L.useCallback)(()=>p(null),[]),x=(0,L.useMemo)(()=>f?l.find(e=>e.kind===`tool`&&e.toolCallId===f.toolCallId)??null:null,[f,l]),S=(0,L.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}=$((0,L.useMemo)(()=>({blocks:l,status:e.status,completedAt:e.completedAt}),[l,e.status,e.completedAt])),O=!i;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)(u,{variant:`body-small-default`,as:`span`,children:e.agent})}),(0,X.jsx)(D,{className:`h-2.5 w-2.5 shrink-0 text-[var(--content-tertiary)]`,"aria-hidden":!0}),(0,X.jsx)(u,{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)(Ge,{entry:e,isRunning:i,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:n})}):(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||o!==void 0)&&(0,X.jsxs)(`div`,{className:d(`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)(I,{icon:(0,X.jsx)(ee,{className:`h-4 w-4 shrink-0`,style:{color:`var(--content-secondary)`}}),target:e.inputTokens??0,format:e=>F(Math.round(e)),label:r(`acpRunChatView.inputLabel`)}),(0,X.jsx)(I,{icon:(0,X.jsx)(se,{className:`h-4 w-4 shrink-0`,style:{color:`var(--content-secondary)`}}),target:e.outputTokens??0,format:e=>F(Math.round(e)),label:r(`acpRunChatView.outputLabel`)})]}),o!==void 0&&(0,X.jsx)(`div`,{className:c?`col-span-2`:void 0,children:(0,X.jsx)(Re,{model:o,options:e.availableModels})})]}),(0,X.jsx)(Ke,{task:e.task}),(0,X.jsx)(`div`,{className:`flex flex-col`,"data-testid":`acp-chat-timeline`,children:l.map((e,t)=>(0,X.jsx)(De,{showDot:t===0||t===l.length-1||e.kind===`tool`||e.kind===`plan`,isLast:t===l.length-1,children:(0,X.jsx)(qe,{block:e,isTerminal:O,onOpenDiff:v,onOpenOutput:y,assistantId:n})},He(e,t)))}),!i&&(0,X.jsx)(Ee,{status:e.status,stopReason:e.stopReason,error:e.error,completedAt:e.completedAt})]}),T&&(0,X.jsx)(a,{shape:`pill`,variant:`outlined`,size:`compact`,iconOnly:(0,X.jsx)(ne,{}),onClick:E,"aria-label":r(`acpRunChatView.goToNewest`),tooltip:r(`acpRunChatView.goToNewest`),"data-testid":`acp-chat-scroll-to-latest`,className:`absolute bottom-3 left-1/2 -translate-x-1/2 shadow-md`})]}),i&&!f&&(0,X.jsx)(Je,{acpSessionId:e.acpSessionId},`steer-${e.acpSessionId}`)]})}function Ge({entry:e,isRunning:t,onClose:o,showBack:s=!1,onBack:l}){let{t:u}=_(`chat`),[d,f]=(0,L.useState)(!1),p=m(e.status,e.stopReason),h=(0,L.useCallback)(()=>{f(!0),n(e.acpSessionId).catch(e=>{f(!1),c(e,{context:`AcpRunChatView.stop`})})},[e.acpSessionId]);return(0,X.jsx)(r,{icon:(0,X.jsxs)(X.Fragment,{children:[s&&(0,X.jsx)(a,{variant:`outlined`,iconOnly:(0,X.jsx)(k,{}),onClick:l,"aria-label":u(`acpRunChatView.backToConversationAria`),tooltip:u(`acpRunChatView.backTooltip`),"data-testid":`acp-chat-diff-back`,className:`shrink-0`}),(0,X.jsx)(i,{agent:e.agent,className:`h-5 w-5 shrink-0`})]}),title:e.agent,headerTrailing:(0,X.jsx)(fe,{color:p.color,label:p.label}),headerActions:t?(0,X.jsx)(de,{onStop:h,ariaLabel:u(`acpRunChatView.stopRunAria`),disabled:d}):void 0,closeLabel:u(`acpRunChatView.closeRunDetail`),onClose:o})}function Ke({task:e}){let{t}=_(`chat`);return e?(0,X.jsxs)(`div`,{"data-testid":`acp-chat-objective`,children:[(0,X.jsx)(le,{as:`h3`,children:t(`acpRunChatView.objective`)}),(0,X.jsx)(u,{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 qe({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)(Se,{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)(Ce,{entries:e.entries})}}function Je({acpSessionId:e}){let{t}=_(`chat`),[n,r]=(0,L.useState)(``),[i,u]=(0,L.useState)(!1);return(0,X.jsx)(`form`,{onSubmit:(0,L.useCallback)(t=>{t.preventDefault();let a=n.trim();if(!a||i)return;u(!0);let d=s.getState().appendLocalMarker({acpSessionId:e,content:`${l}${a}`});o(e,a).then(()=>r(``)).catch(t=>{d&&s.getState().removeLocalMarker({acpSessionId:e,markerId:d}),c(t,{context:`AcpRunChatView.steer`})}).finally(()=>u(!1))},[n,i,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=>r(e.target.value),placeholder:t(`acpRunChatView.steerPlaceholder`),disabled:i,"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)(a,{type:`submit`,variant:`primary`,size:`compact`,iconOnly:(0,X.jsx)(ie,{}),disabled:i||n.trim()===``,"aria-label":t(`acpRunChatView.sendSteerAria`),className:`shrink-0`})]})})}function Ye({entry:e,onClose:t,assistantId:n}){return(0,X.jsx)(We,{entry:e,onClose:t,assistantId:n})}export{Ye as AcpRunDetailPanel};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{o as e}from"./rolldown-runtime-BM3Ffeng.js";import{$x as t,Fl as n,Mi as r,Ni as i,Pb as a,a as o,c as s,d as c,ji as l,s as u}from"./app-
|
|
1
|
+
import{o as e}from"./rolldown-runtime-BM3Ffeng.js";import{$x as t,Fl as n,Mi as r,Ni as i,Pb as a,a as o,c as s,d as c,ji as l,s as u}from"./app-us2PS4GU.js";import{j as d}from"./vendor-GPbHjL0d.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=a.use.activeAssistantId(),v=l(),y=i(),{data:b}=r(),{starters:x,items:S}=c(v??``),{launch:C,pendingTaskIds:w}=s(v??``),T=(0,g.useMemo)(()=>[...x,...S],[x,S]),E=(0,g.useCallback)(async t=>{u(await C(t),m,t=>{n(e,t)})},[C,e,m]);return v===null?y?(0,_.jsx)(p,{to:t.assistant,replace:!0}):null:(0,_.jsx)(o,{tasks:T,progress:b?.tasks,pendingTaskIds:w,onLaunch:e=>{E(e)},onOpenConversation:t=>{n(e,t)},assistantId:h??void 0})}export{v as ActivationListRoute};
|
package/dist/assets/{activity-redirect-page-Cn8PLcZA.js → activity-redirect-page-BwZtUVUA.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{o as e}from"./rolldown-runtime-BM3Ffeng.js";import{$x as t}from"./app-
|
|
1
|
+
import{o as e}from"./rolldown-runtime-BM3Ffeng.js";import{$x as t}from"./app-us2PS4GU.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{Cr as t,Ft as n,Gr as r,Hs as i,It as a,Jr as o,Kr as s,Kt as c,Lh as l,Mn as u,Nt as d,Ot as f,Pt as p,Rh as m,Rn as h,Sr as g,St as _,TC as v,Ur as y,Wr as b,Wt as x,Xt as S,Yt as C,Z_ as w,Zn as T,_r as E,_t as ee,bt as D,fi as O,gt as k,ht as te,mt as ne,ph as A,ql as j,qn as M,qt as N,wt as P,xn as F,xt as I,yt as L}from"./app-
|
|
1
|
+
import{o as e}from"./rolldown-runtime-BM3Ffeng.js";import{Cr as t,Ft as n,Gr as r,Hs as i,It as a,Jr as o,Kr as s,Kt as c,Lh as l,Mn as u,Nt as d,Ot as f,Pt as p,Rh as m,Rn as h,Sr as g,St as _,TC as v,Ur as y,Wr as b,Wt as x,Xt as S,Yt as C,Z_ as w,Zn as T,_r as E,_t as ee,bt as D,fi as O,gt as k,ht as te,mt as ne,ph as A,ql as j,qn as M,qt as N,wt as P,xn as F,xt as I,yt as L}from"./app-us2PS4GU.js";import{j as R}from"./vendor-GPbHjL0d.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-Dg564j4O.js";import{l as W,n as G,o as K,t as q}from"./tool-detail-panel-CReDJ1T-.js";import{n as J,t as Y}from"./step-detail-header-CC5kX9fv.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}=h(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)(x,{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:b(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 Q(e,t,n){let r=N(t,n.workflow),i=e=>{let t=S(e,n.workflow.byToolUseId);if(t!==null&&r.has(t))return!0;let i=c(e,n.acpByToolUseId);if(i!==null&&n.acpById[i]!==void 0)return!0;let a=C(e);return a!==void 0&&n.backgroundTaskById[a]!==void 0},a=t.filter(e=>!i(e));if(a.length===t.length)return{items:e,toolCalls:t};let o=new Set(a.map(e=>e.id));return{items:e.filter(e=>e.kind!==`toolCall`||o.has(e.toolCall.id)),toolCalls:a}}function se(e,n,i){let a=U(e),o=g(),c=F(),l=j.use.byId(),u=j.use.byToolUseId(),d=j.use.notFoundRunIds(),f=j.use.hydrationFailedRunIds(),p=E.use.byId(),m=E.use.byToolUseId(),h=t.use.byId();return(0,X.useMemo)(()=>{if(!a||n==null)return null;let e=r(a.contentBlocks??[],s(a,c)),t=oe(e,n,i);if(t==null)return null;let g=e[t];if(!g||g.type!==`activity`)return null;let{cardItems:_,toolCalls:v}=b(g.items);return{...Q(_,v,{workflow:{byId:l,byToolUseId:u,notFoundRunIds:d,hydrationFailedRunIds:f},acpById:p,acpByToolUseId:m,backgroundTaskById:h}),isLastGroup:ie(e,t),isLatestMessage:ae(a,o),groupIndex:t}},[a,o,n,i,c,l,u,d,f,p,m,h])}var ce=60;function le(e,t){return $(e,t.flatMap(e=>e.kind===`tool`?[e.toolCallId]:[]))}function $(e,t,n=a){let r=new Set(t),i=new Set(e.filter(e=>r.has(e.id)&&w(e.name,e.input)).map(e=>e.id)),o=new Map;for(let t of n(e,(e,t,n)=>i.has(e.id)&&t===n))o.set(t.toolCallId,t);let s=[],c=new Set;for(let e of t){if(c.has(e))continue;let t=o.get(e);t&&(c.add(e),s.push({image:t,occurrenceKey:e}))}return s}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:t,assistantId:r}){let{t:i}=R(`chat`),[a,o]=(0,X.useState)(null),s=J(a),c=e.groupToolCallIds?.[0]??e.toolCalls[0]?.id,d=se(e.messageId,e.groupIndex,c),f=d?.items??e.items,p=d?.toolCalls??e.toolCalls,h=m.use.phase(),g=d?d.isLastGroup&&d.isLatestMessage:e.messageId==null,_=ee(f,{active:e.active===!0&&g&&l(h)}),y=(0,X.useMemo)(()=>f.flatMap(e=>e.kind===`toolCall`?[e.toolCall.id]:[]),[f]),b=(0,X.useMemo)(()=>n(),[]),x=(0,X.useMemo)(()=>$(p,y,b),[p,y,b]),S=(0,X.useMemo)(()=>x.map(e=>e.occurrenceKey),[x]),C=(0,X.useMemo)(()=>new Map(x.map((e,t)=>[e.occurrenceKey,t])),[x]),w=(0,X.useMemo)(()=>x.map(e=>e.image),[x]),E=(0,X.useRef)(null),{openPreview:D,previewModal:A}=u(r,w,S,{scopeKey:`${r??``}:${e.messageId??``}:${c??e.groupIndex??``}`,getFallbackFocus:()=>E.current?.querySelector(`button, [role="button"][tabindex="0"]`)??null}),j=te(_.steps),N=k(_.state,_.steps),F=N===`loading`,I=ne(N,_.totalDurationLabel??``,j.failed),L=F&&_.currentStepTitle||I,z=(0,X.useMemo)(()=>new Map(p.map(e=>[e.id,e])),[p]);return(0,Z.jsx)(`div`,{ref:E,className:`contents`,children:(0,Z.jsxs)(M,{icon:a?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(v,{variant:`outlined`,iconOnly:(0,Z.jsx)(V,{}),"aria-label":i(`activityStepsPanel.backAria`),tooltip:i(`activityStepsPanel.backTooltip`),onClick:()=>o(null),className:`shrink-0`}),(0,Z.jsx)(Y,{detail:a,source:K})]}):void 0,title:s,titleNode:a?a.kind===`thinking`?void 0:(0,Z.jsx)(G,{detail:a,source:K}):(0,Z.jsx)(T,{title:F?(0,Z.jsx)(O,{children:L}):L,count:_.stepCount}),closeLabel:i(`activityStepsPanel.closeSteps`),onClose:t,children:[a?(0,Z.jsx)(he,{detail:a,assistantId:r}):(0,Z.jsx)(P,{steps:_.steps,timeline:!0,renderStep:t=>(0,Z.jsx)(me,{step:t,activeDetail:a,onOpenDetail:o,lookupToolCall:e=>z.get(e),messageId:e.messageId,groupIndex:d?.groupIndex??e.groupIndex}),renderPhaseFooter:e=>{let t=pe(e,x,C);if(!t)return null;let{entry:n,step:a,index:o}=t,s=a.activity?.trim(),c=s?i(`activityStepsPanel.screenshotTitle`,{activity:s}):i(`activityStepsPanel.screenshotFallbackTitle`),l=s?i(`activityStepsPanel.screenshotAria`,{activity:s}):i(`activityStepsPanel.screenshotFallbackAria`);return(0,Z.jsx)(re,{assistantId:r,image:n.image,title:c,ariaLabel:l,onPreview:e=>D(n.image,o,e)})}}),A]})})}function pe(e,t,n){if(!f(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:s}){let{t:c}=R(`chat`),l=d();if(e.kind===`thinking`){let t=a!=null&&e.thinkingItemIndex!=null?{messageId:a,thinkingGroupIndex:s,thinkingItemIndex:e.thinkingItemIndex}:{};return(0,Z.jsx)(I,{iconName:`brain`,label:i(o(e.text),ce),ariaLabel:c(`activityStepsPanel.viewThinkingAria`),active:!1,onClick:()=>n({kind:`thinking`,toolCallId:``,toolName:``,title:c(`thinkingDetail.title`),activity:``,input:{},status:`completed`,thinkingText:e.text,...t})})}if(e.kind===`web_search`)return(0,Z.jsx)(D,{step:e});if(e.kind===`web_search_error`)return(0,Z.jsx)(L,{step:e});if(e.kind!==`tool`)return(0,Z.jsx)(_,{step:e});let u=r(e.toolCallId);return(0,Z.jsx)(I,{iconName:e.iconName,label:l({activity:e.activity,actionDisplayKey:e.actionDisplayKey,fallback:e.activity||e.info||e.title}),active:t?.toolCallId===e.toolCallId,onClick:()=>{u&&n(y(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-CX9RoqXd.js";export{e as AddCreditsModal};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{o as e}from"./rolldown-runtime-BM3Ffeng.js";import{$x as t,Sy as n,TC as r,US as i,Zd as a,aC as o,bd as s,kC as c,qS as l,vd as u,xy as d}from"./app-
|
|
1
|
+
import{o as e}from"./rolldown-runtime-BM3Ffeng.js";import{$x as t,Sy as n,TC as r,US as i,Zd as a,aC as o,bd as s,kC as c,qS as l,vd as u,xy as d}from"./app-us2PS4GU.js";import{Qn as f,Yn as p,j as m}from"./vendor-GPbHjL0d.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-DY5xG0W8.js";import{t as C}from"./checkout-return-target-SgAqyqRH.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}=m(),{pathname:S}=g(),[k]=h(),A=k.toString()?`${S}?${k.toString()}`:S,{data:j,isLoading:M}=f(u()),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=p(s());return(0,w.useEffect)(()=>n(()=>{v(!1)}),[v]),a(`deeplink.billingCheckoutComplete`,({flow:e})=>{e===`top_up`&&v(!1)}),(0,T.jsx)(l.Root,{open:e,onOpenChange:v,children:(0,T.jsxs)(l.Content,{size:`sm`,children:[(0,T.jsxs)(l.Header,{children:[(0,T.jsx)(l.Title,{children:y(`addCreditsModal.title`)}),(0,T.jsx)(l.Description,{children:y(`addCreditsModal.description`)})]}),(0,T.jsx)(l.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)(i,{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:t.settings.usageBillingConfigureTopUps,className:c(o({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)(l.Footer,{children:[(0,T.jsx)(l.Close,{asChild:!0,children:(0,T.jsx)(r,{variant:`outlined`,children:y(`addCreditsModal.cancel`)})}),(0,T.jsx)(r,{variant:`primary`,loading:L.isPending,onClick:()=>{L.isPending||L.mutate({body:{amount:I,return_path:A,return_target:C()}},{onSuccess:e=>{d(e.checkout_url)}})},disabled:L.isPending||M||!j,children:y(`addCreditsModal.continue`)})]})]})})}function A(e){return S({open:e.open,path:t.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,Ab as i,Af as a,As as o,Bf as s,Bm as c,Bv as l,Cb as u,Co as d,Cp as f,Cs as p,Cv as m,DC as h,Db as g,Df as _,Ds as v,Eb as y,Ef as b,GS as x,Gm as S,Hf as C,Hm as w,Ii as T,Ix as E,J as D,Jm as O,K as k,KS as A,Km as j,Li as M,Ll as N,Lm as P,Mb as F,Nm as I,Ob as L,Of as ee,Os as te,Pm as ne,Q as R,Q_ as re,Qf as ie,Qt as ae,RS as oe,Sb as se,So as ce,Sp as le,Sv as z,TC as B,Tb as ue,Tf as de,Ts as fe,US as V,Uf as pe,Um as me,Vf as he,Vm as ge,Wf as _e,Wm as ve,X as ye,Xp as be,Y as xe,Yn as Se,Yp as Ce,Z as we,Zf as Te,Zp as Ee,_b as De,_s as Oe,_y as ke,ab as Ae,bC as H,bb as je,bp as Me,bs as Ne,cS as U,cb as Pe,cm as Fe,db as Ie,eC as Le,eg as Re,ep as ze,fC as Be,fb as Ve,fs as He,gb as Ue,gg as We,gs as Ge,hC as W,hb as Ke,hg as qe,hs as Je,ib as Ye,it as Xe,jS as Ze,jb as Qe,jf as $e,js as et,kb as tt,kf as nt,ks as rt,lb as it,lm as at,lv as ot,mS as st,mb as ct,mm as lt,ms as ut,np as dt,nt as ft,ny as pt,ob as mt,ot as ht,pb as gt,ps as _t,q as vt,qS as G,qm as yt,qn as bt,rC as xt,rp as St,sC as Ct,sb as wt,st as Tt,tC as K,tp as Et,ub as Dt,vC as Ot,vS as q,vb as kt,vs as At,vv as jt,wb as Mt,wf as Nt,ws as Pt,xS as J,xb as Ft,xm as It,xo as Lt,xp as Rt,xs as zt,yS as Bt,yb as Vt,yg as Ht,ys as Ut,zf as Wt,zm as Gt}from"./app-C-wZhPGb.js";import{I as Y,N as Kt,Qn as X,Yn as qt,j as Z,tr as Jt}from"./vendor-GPbHjL0d.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-CnjbPFu2.js";import{o as pn}from"./detail-primitives-BbKqS783.js";import{d as mn,o as hn,u as gn}from"./schedules-q7veJ5HI.js";import{t as _n}from"./stt-language-picker-modal-Dcb8KJyU.js";var Q=e(Zt(),1);function vn(){let e=ft();return(0,Q.useCallback)(async(t,n)=>{try{let{data:r}=await pt({path:{assistant_id:e},body:{value:n,type:`api_key`,name:t},throwOnError:!0});Ae(r)}catch(e){throw e instanceof Error&&e.message===`No assistant found`?A.error(Y(`settings:useDaemonConfig.assistantNotReadyToast`)):A.error(Y(`settings:useDaemonConfig.saveApiKeyFailedToast`,{providerName:t})),U(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 qe(bn)}var $=Xt(),Sn=`gemini-3.1-flash-image-preview`;function Cn(e,t){return e===`openrouter`?`openrouter`:rt(t)}function wn(){let{t:e}=Z(`settings`),t=ft(),n=Jt(),i=P(),{data:a}=X({...Te({path:{assistant_id:t}}),enabled:i,staleTime:3e4}),o=lt({onSuccess:e=>{r(n,{path:{assistant_id:t}},e)}}),s=vn(),c=a?.services?.[`image-generation`],u=(0,Q.useMemo)(()=>a?c?.mode===`managed`?`vellum`:c?.provider||q(`vellum:ai:imageGenProvider`,`gemini`):q(_t,`gemini`),[a,c?.mode,c?.provider]),[d,f]=yn(u),[m,h]=(0,Q.useState)(()=>q(He,Sn)),[g,_]=(0,Q.useState)(null),v=u===`openrouter`&&typeof c?.model==`string`?c.model:void 0,y=g??v??q(`vellum:ai:imageGenModel`,`google/gemini-3.1-flash-image-preview`),b=d===`openrouter`,x=te(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,E]=(0,Q.useState)(!1),D=Pt.map(e=>({value:e,label:fe[e]??e})),O=(0,Q.useMemo)(()=>te(d).map(e=>({value:e,label:p[e]??e})),[d]),k=d===`gemini`||d===`openai`||d===`openrouter`,{hasStoredCredential:j}=ne({assistantId:t,credentialKind:`api_key`,credentialName:d,enabled:k}),M=(0,Q.useCallback)(e=>{f(e),e===`openrouter`&&g===null&&_(v??`google/gemini-3.1-flash-image-preview`)},[g,v,f]),N=(0,Q.useCallback)(async()=>{E(!0);let r=C.trim(),i=k&&r.length>0;try{await Ht(),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 A.error(e(`imageGenerationCard.configUpdateFailedToast`)),U(t,{context:`patch_daemon_config`}),t});try{await l({path:{assistant_id:t},body:{modelId:S},throwOnError:!0})}catch(t){throw A.error(e(`imageGenerationCard.modelUpdateFailedToast`)),U(t,{context:`set_image_gen_model`}),t}finally{n.invalidateQueries({queryKey:ie({path:{assistant_id:t}})})}}catch{E(!1);return}E(!1);try{if(J(_t,d),J(He,S),i){let e=I(t,`api_key`,d);n.setQueryData(e,!0),n.invalidateQueries({queryKey:e}),w(``)}A.success(e(`imageGenerationCard.savedToast`))}catch(t){U(t,{context:`settings-ai-image-gen-persist-local`}),A.error(e(`imageGenerationCard.localPreferencesFailedToast`))}},[C,d,k,S,t,o,s,n,e]),F=(0,Q.useCallback)(()=>{if(w(``),d===`openrouter`){_(zt),J(He,zt);return}h(Sn),J(He,Sn)},[d]),L=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)(V,{"aria-label":e(`imageGenerationCard.providerAriaLabel`),value:d,onChange:M,options:D})]}),d===`vellum`&&(0,$.jsx)(`p`,{className:`text-body-medium-lighter text-[var(--content-tertiary)]`,children:e(`imageGenerationCard.vellumNote`)}),k&&(0,$.jsx)(K,{label:e(`imageGenerationCard.apiKeyLabel`),type:`password`,value:C,onChange:e=>w(e.target.value),placeholder:he(L,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)(K,{"aria-label":e(`imageGenerationCard.modelAriaLabel`),value:y,onChange:e=>_(e.target.value),placeholder:e(`imageGenerationCard.openrouterModelPlaceholder`),fullWidth:!0}):(0,$.jsx)(V,{"aria-label":e(`imageGenerationCard.modelAriaLabel`),value:S,onChange:h,options:O})]}),(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(dn,{onClick:N,disabled:T}),T&&(0,$.jsx)(rn,{className:`h-4 w-4 animate-spin text-[var(--content-disabled)]`}),k&&(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)(W,{variant:`body-large-default`,as:`h3`,className:`text-[var(--content-secondary)]`,children:e}),t==null?null:(0,$.jsxs)(W,{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)(W,{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(Y(`settings:manageProfilesBlockedDeleteModal.clauseDefaultProfile`)),e.callSiteIds.length>0&&n.push(Y(`settings:manageProfilesBlockedDeleteModal.clauseActionOverrides`,{count:e.callSiteIds.length}));let r=e.scheduleNames.length,i=e.deferredReminderCount;return r>0&&i>0?n.push(Y(`settings:manageProfilesBlockedDeleteModal.clauseRunsBoth`,{schedules:r,reminders:i})):r>0?n.push(Y(`settings:manageProfilesBlockedDeleteModal.clauseRunsSchedules`,{count:r})):i>0&&n.push(Y(`settings:manageProfilesBlockedDeleteModal.clauseRunsReminders`,{count:i})),n.length===0?Y(`settings:manageProfilesBlockedDeleteModal.summaryNoReferences`,{display:t}):n.length===1?Y(`settings:manageProfilesBlockedDeleteModal.summaryOneClause`,{display:t,clause1:n[0]}):n.length===2?Y(`settings:manageProfilesBlockedDeleteModal.summaryTwoClauses`,{display:t,clause1:n[0],clause2:n[1]}):Y(`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:a,onClose:o,onConfirm:s}){let{t:c}=Z(`settings`),l=e?.scheduleNames??[],u=l.slice(0,Dn),d=l.length-u.length,f=e!=null&&En(e);return(0,$.jsx)(G.Root,{open:e!==null,onOpenChange:e=>{e||o()},children:(0,$.jsxs)(G.Content,{size:`sm`,children:[(0,$.jsx)(G.Header,{children:(0,$.jsx)(G.Title,{children:c(`manageProfilesBlockedDeleteModal.title`)})}),(0,$.jsxs)(G.Body,{className:`space-y-4`,children:[e&&(0,$.jsx)(W,{variant:`body-medium-default`,as:`p`,children:kn(e)}),e&&e.callSiteIds.length>0&&(0,$.jsx)(On,{title:c(`manageProfilesBlockedDeleteModal.actionOverridesTitle`),items:e.callSiteIds,mono:!0}),u.length>0&&(0,$.jsxs)(`div`,{className:`space-y-1`,children:[(0,$.jsx)(On,{title:c(`manageProfilesBlockedDeleteModal.schedulesTitle`),items:u}),d>0&&(0,$.jsx)(W,{variant:`body-small-default`,as:`p`,className:`pl-1 text-(--content-tertiary)`,children:c(`manageProfilesBlockedDeleteModal.moreSchedules`,{count:d})})]}),e?.scheduleLookupFailed&&(0,$.jsx)(W,{variant:`body-small-default`,as:`p`,className:`text-(--system-mid-strong)`,children:c(`manageProfilesBlockedDeleteModal.scheduleLookupFailed`)}),(0,$.jsxs)(`div`,{className:`space-y-1`,children:[(0,$.jsx)(`label`,{className:`block text-body-small-default text-(--content-tertiary)`,children:c(`manageProfilesBlockedDeleteModal.replacementLabel`)}),(0,$.jsx)(V,{"aria-label":c(`manageProfilesBlockedDeleteModal.replacementLabel`),value:n,onChange:r,placeholder:c(`manageProfilesBlockedDeleteModal.replacementPlaceholder`),options:t.map(e=>{let t=f&&e.status===`disabled`;return{value:e.name,label:xe(e),disabled:t,tooltip:t?c(`manageProfilesBlockedDeleteModal.disabledTargetTooltip`):void 0}})})]}),i&&(0,$.jsx)(W,{variant:`body-small-default`,as:`p`,className:`text-(--system-negative-strong)`,children:i})]}),(0,$.jsxs)(G.Footer,{children:[(0,$.jsx)(B,{variant:`ghost`,size:`compact`,onClick:o,children:c(`manageProfilesBlockedDeleteModal.cancel`)}),(0,$.jsx)(B,{variant:`primary`,size:`compact`,disabled:!n||a,onClick:s,children:c(a?`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:l}=Z(`settings`),u=e.source===`managed`,d=e.status===`disabled`,f=e.label??e.name,p=[];e.model&&p.push(_(e.provider??void 0,e.model,r)),u&&p.push(l(`profileRow.managedByVellum`));let m=e.availability,g=e.config_issue,v=g!=null||m?.status===`incomplete`,y=m?.message??l(`profileRow.providerUnavailableDefault`),b=g==null?m!=null&&m.status!==`ok`?v?l(`profileRow.providerUnavailableFixable`,{message:y}):y:null:l(`profileRow.providerUnavailableFixable`,{message:l(g.code===`over_output_cap`?`profileRow.configIssueOverOutputCap`:g.code===`no_input_room`?`profileRow.configIssueNoInputRoom`:`profileRow.configIssueModelUnknown`)});return(0,$.jsx)(Ze,{title:(0,$.jsx)(`span`,{className:d?`opacity-55`:void 0,children:f}),subtitle:p.length>0?p.join(` • `):void 0,onClick:a,showChevron:!1,selected:n,disabled:i,contentAriaLabel:l(`profileRow.openProfileAriaLabel`,{displayName:f}),trailingInteractive:!0,trailing:(0,$.jsxs)($.Fragment,{children:[b==null?null:(0,$.jsx)(h,{content:b,children:v?(0,$.jsx)(`button`,{type:`button`,onClick:a,"aria-label":b,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":b,role:`img`})})}),d?(0,$.jsx)(Ct,{tone:`neutral`,children:l(`profileRow.disabledTag`)}):null,t?(0,$.jsx)(Ct,{tone:`positive`,children:l(`profileRow.defaultTag`)}):null,(0,$.jsxs)(H.Root,{children:[(0,$.jsx)(H.Trigger,{asChild:!0,children:(0,$.jsx)(B,{variant:`ghost`,size:`compact`,iconOnly:(0,$.jsx)(cn,{}),"aria-label":l(`profileRow.actionsAriaLabel`,{displayName:f}),disabled:i})}),(0,$.jsxs)(H.Content,{align:`end`,sideOffset:4,children:[(0,$.jsx)(H.Item,{onSelect:a,children:l(u?`profileRow.view`:`profileRow.edit`)}),!t&&!d&&tt(e.provider,e.model)?(0,$.jsx)(H.Item,{onSelect:o,children:l(`profileRow.makeDefault`)}):null,d?(0,$.jsx)(H.Item,{onSelect:()=>s(!0),children:l(`profileRow.enable`)}):u?null:(0,$.jsx)(H.Item,{onSelect:()=>s(!1),children:l(`profileRow.disable`)}),u?null:(0,$.jsx)(H.Item,{onSelect:c,className:Ot.anchored,children:l(`profileRow.delete`)})]})]})]})})}function Mn(e,t){let n=T(),{data:r}=X({...Me({path:{assistant_id:e}}),enabled:n,staleTime:3e4}),{profiles:i,profileOrder:a}=k(t?.llm,e);return(0,Q.useMemo)(()=>r==null?{entries:mt(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 We(Nn,e)}var Fn=`settings-ai-profile-make-active`,In=`Failed to set the active profile. Please try again.`;function Ln(e){let t=de(),n=Jt(),r=Pn(e),i=It({onSuccess:()=>{n.invalidateQueries({queryKey:ie({path:{assistant_id:e}})}),n.invalidateQueries({queryKey:Rt({path:{assistant_id:e}})})}});async function a(n,r,i){try{await t.mutateAsync({path:{assistant_id:e},body:{llm:n}})}catch(e){throw U(e,{context:r}),A.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=st(e);throw A.error(t??In),t||U(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=st(e);return t?`${/[.!?]$/.test(t)?t:`${t}.`} ${Rn}`:zn}function Vn(e,n,r){let i=Ln(e),a=Jt(),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]),f=(0,Q.useMemo)(()=>mt(u,d),[u,d]),[p,m]=(0,Q.useState)(null),[h,g]=(0,Q.useState)(null),[_,v]=(0,Q.useState)(``),[y,b]=(0,Q.useState)(!1),[x,S]=(0,Q.useState)(null),C=(0,Q.useRef)(!1);function w(e){return f.filter(t=>t.name===e?!1:t.status===`disabled`?!0:vt(t,f,{requireOwnProviderAndModel:o}))}function T(e,t){let n=w(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 E(e){try{await i.deleteProfile(e,d,{isAdvisor:e===c}),r?.onDeleted?.(e)}catch{}}async function D(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({...Ce({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){U(e,{context:`settings-ai-profile-delete-schedule-scan`}),d=!0}if(!(r||i.length>0||o.length>0||c>0)&&!d){await E(t);return}let f={name:t,label:n,isActive:r,callSiteIds:i,scheduleNames:o,deferredReminderCount:c,scheduleLookupFailed:d};m(f),v(T(t,En(f))),g(null)}function O(e){n==null||C.current||(C.current=!0,S(e),D(e).finally(()=>{C.current=!1,S(null)}))}async function k(){if(!p||!_)return;if(b(!0),g(null),En(p))try{await hn(e,p.name,_),await a.invalidateQueries({queryKey:be({path:{assistant_id:e}})})}catch(e){U(e,{context:`settings-ai-profile-reassign-schedules`}),g(Bn(e)),b(!1);return}let t={};if(p.isActive&&(t.activeProfile=_),p.callSiteIds.length>0){let e={};for(let t of p.callSiteIds)e[t]={profile:_};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{g(`Failed to reassign references. Please try again.`),b(!1);return}let n=p.name;m(null),b(!1),E(n)}return{requestDelete:O,pendingDeleteName:x,blockedDeleteModalProps:{blocked:p,availableReplacements:w(p?.name??null),replacement:_,onReplacementChange:v,error:h,saving:y,onClose:()=>{m(null),g(null)},onConfirm:()=>void k()}}}function Hn(){}function Un({assistantId:e,config:t,connections:n,selectedProfileName:r,onOpenProfile:i,onCreateProfile:a,onProfileDeleted:o}){let{t:s}=Z(`settings`),{entries:c}=Mn(e,t),l=Ln(e),u=Vn(e,t,{onDeleted:o}),d=t?.llm?.activeProfile??null;return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(Tn,{title:s(`profilesSection.title`),action:(0,$.jsx)(B,{variant:`primary`,onClick:a,leftIcon:(0,$.jsx)(en,{}),disabled:t==null,children:s(`profilesSection.createProfile`)}),children:t==null?(0,$.jsx)(W,{variant:`body-medium-lighter`,as:`p`,className:`py-4 text-center text-(--content-tertiary)`,children:s(`profilesSection.loading`)}):c.length===0?(0,$.jsx)(W,{variant:`body-medium-lighter`,as:`p`,className:`py-4 text-center text-(--content-tertiary)`,children:s(`profilesSection.emptyState`)}):c.map(e=>(0,$.jsx)(jn,{profile:e,isActiveProfile:e.name===d,selected:e.name===r,connections:n,deletePending:u.pendingDeleteName===e.name,onOpen:()=>i(e.name),onMakeActive:()=>void l.makeActive(e.name).catch(Hn),onSetStatus:t=>void l.setStatus(e.name,t).catch(Hn),onDelete:()=>u.requestDelete(e.name)},e.name))}),(0,$.jsx)(An,{...u.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`?nt(n):Qe(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}=Z(`settings`),l=e.isManaged??!1,u=S(e),d=Gn(e.provider),f=Yn(e),p=n&&!t&&d,m=!l&&a!=null,h=!l&&!t,g=p||m||h;return(0,$.jsx)(Ze,{title:u,subtitle:f.length>0?f:void 0,onClick:a,showChevron:!1,selected:r,contentAriaLabel:a?c(`providerRow.openProviderAriaLabel`,{displayName:u}):void 0,trailingInteractive:!0,trailing:(0,$.jsxs)($.Fragment,{children:[l?(0,$.jsx)(Ct,{tone:`neutral`,title:c(`providerRow.managedTagTitle`),children:c(`providerRow.managedTag`)}):null,t?(0,$.jsx)(Ct,{tone:`info`,title:c(`providerRow.defaultTagTitle`),children:c(`providerRow.defaultTag`)}):null,e.provider===`ollama`?(0,$.jsx)(Ct,{tone:`neutral`,title:c(`providerRow.localTagTitle`),children:c(`providerRow.localTag`)}):null,e.provider===`openai-compatible`?(0,$.jsx)(Ct,{tone:`neutral`,title:c(`providerRow.customTagTitle`),children:c(`providerRow.customTag`)}):null,g?(0,$.jsxs)(H.Root,{children:[(0,$.jsx)(H.Trigger,{asChild:!0,children:(0,$.jsx)(B,{variant:`ghost`,size:`compact`,iconOnly:(0,$.jsx)(cn,{}),"aria-label":c(`providerRow.actionsAriaLabel`,{displayName:u})})}),(0,$.jsxs)(H.Content,{align:`end`,sideOffset:4,children:[m?(0,$.jsx)(H.Item,{onSelect:a,children:c(`providerRow.edit`)}):null,p?(0,$.jsx)(H.Item,{disabled:i,onSelect:o,children:c(`providerRow.setAsDefault`)}):null,h?(0,$.jsx)(H.Item,{onSelect:s,className:Ot.anchored,children:c(`providerRow.delete`)}):null]})]}):(0,$.jsx)(`span`,{className:`inline-block w-8`,"aria-hidden":!0})]})})}function Zn(e,t){let n=Jt(),r={path:{assistant_id:e}},i=qt({...St(),onSuccess:()=>{n.invalidateQueries({queryKey:dt(r)}),n.invalidateQueries({queryKey:ie(r)}),n.invalidateQueries({queryKey:Rt(r)})},onError:e=>{U(e,{context:`settings-ai-set-default-provider`}),A.error(Y(`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 z({path:{assistant_id:e,name:i}});a?.ok||a?.status===404?(n.invalidateQueries({queryKey:f(r)}),t?.onDeleted?.(i)):a?.status===409?A.error(Y(`settings:useProviderActions.deleteInUseToast`)):A.error(Y(`settings:useProviderActions.deleteFailedToast`))}catch(e){U(e,{context:`settings-ai-provider-delete`}),A.error(Y(`settings:useProviderActions.deleteFailedToast`))}}return{setDefault:a,isSettingDefault:o,deleteConnection:s}}function Qn({assistantId:e,selectedConnectionName:t,onOpenConnection:n,onAddProvider:r,onConnectionDeleted:i}){let{t:a}=Z(`settings`),{data:o,isLoading:s,isError:c}=X(le({path:{assistant_id:e}})),l=M(),{data:u}=X({...Et({path:{assistant_id:e}}),enabled:l}),d=l?u?.resolvedConnectionName??null:null,f=Zn(e,{onDeleted:i}),p=(0,Q.useMemo)(()=>{let e=o?.connections??[];return[...e.filter(e=>e.provider===ue),...e.filter(e=>e.provider!==ue)]},[o]);return(0,$.jsx)(Tn,{title:a(`providersSection.title`),action:(0,$.jsx)(B,{variant:`outlined`,onClick:r,leftIcon:(0,$.jsx)(en,{}),children:a(`providersSection.addProvider`)}),children:s?(0,$.jsx)(`div`,{className:`space-y-2 py-2`,children:[1,2,3].map(e=>(0,$.jsx)(oe,{className:`h-10 rounded-lg`},e))}):c?(0,$.jsx)(W,{variant:`body-medium-default`,as:`p`,className:`py-4 text-center text-(--system-negative-strong)`,children:a(`providersSection.loadError`)}):p.length===0?(0,$.jsx)(W,{variant:`body-medium-lighter`,as:`p`,className:`py-4 text-center text-(--content-tertiary)`,children:a(`providersSection.empty`)}):p.map(e=>(0,$.jsx)(Xn,{connection:e,isDefault:e.name===d,supportsDefaultProvider:l,selected:e.name===t,isSettingDefault:f.isSettingDefault(e.name),onOpen:e.isManaged??!1?void 0:()=>n(e.name),onSetDefault:()=>f.setDefault(e),onDelete:()=>void f.deleteConnection(e.name)},e.name))})}function $n({panel:e,onOpenPanel:t,onClosePanel:n}){let{t:r}=Z(`settings`),i=ft(),{data:a}=X({...Te({path:{assistant_id:i}}),staleTime:3e4}),o=M(),{data:s}=X({...Et({path:{assistant_id:i}}),enabled:o}),c=s?.availability,{data:l}=X({...le({path:{assistant_id:i}})}),u=l?.connections,d=a?.llm?.callSites??{},f=Object.entries(d).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)(Be,{tone:c.status===`unknown`?`warning`:`error`,children:c.message??r(`languageModelCard.defaultProviderUnavailable`)}),i&&(0,$.jsx)(Un,{assistantId:i,config:a,connections:u,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:f,action:(0,$.jsx)(B,{variant:`outlined`,onClick:()=>t({kind:`overrides`}),children:r(`languageModelCard.manage`)})})]})})}function er({children:e}){return(0,$.jsxs)(ke,{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)(Kt,{i18nKey:`managedServicesBanner.body`,ns:`common`,components:{link:(0,$.jsx)(er,{})}})})]})}function nr({assistantId:e,profileName:t,onClose:n}){let{t:r}=Z(`settings`),{data:i}=X({...Te({path:{assistant_id:e}}),staleTime:3e4}),{data:a}=X({...le({path:{assistant_id:e}})}),o=a?.connections,s=(0,Q.useMemo)(()=>i?.llm?.profiles??{},[i?.llm?.profiles]),c=Object.keys(s),l=(0,Q.useMemo)(()=>{if(t==null)return;let e=s[t];return e?{name:t,...e}:void 0},[t,s]),u=t==null?`create`:l?.source===`managed`||l?.invariant===!0?`view`:`edit`,{saveProfile:d,isPending:f}=Nt(e,{onSaved:n}),p=b({mode:u,profileName:t??void 0,initialValues:l,existingNames:c,connections:o,assistantId:e,onSave:d}),m=Vn(e,i,{onDeleted:()=>n()}),h=t!=null&&m.pendingDeleteName===t,g=t!=null&&i!=null&&!(t in s);(0,Q.useEffect)(()=>{g&&!p.saving&&!f&&n()},[g,p.saving,f,n]);let _=u===`view`;return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(bt,{title:p.effectiveMode===`create`?r(`profileDetailPanel.createTitle`):l?.label??t??r(`profileDetailPanel.defaultTitle`),closeVariant:`outlined`,onClose:n,headerTrailing:_&&p.effectiveMode!==`create`?(0,$.jsx)(Ct,{tone:`neutral`,children:r(`profileDetailPanel.managedTag`)}):null,headerActions:p.effectiveMode!==`create`&&!p.isReadOnly?(0,$.jsx)(B,{variant:`dangerOutline`,loading:h,iconOnly:(0,$.jsx)(Qt,{}),"aria-label":r(h?`profileDetailPanel.deleting`:`profileDetailPanel.delete`),tooltip:r(`profileDetailPanel.delete`),onClick:()=>{t!=null&&m.requestDelete(t)},disabled:p.saving||h}):null,footer:p.isReadOnly?(0,$.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,$.jsx)(B,{variant:`outlined`,onClick:p.switchToSaveAsNew,disabled:p.saving,children:r(`profileDetailPanel.saveAsNew`)}),p.hasViewModeChanges?(0,$.jsx)(B,{variant:`primary`,onClick:()=>void p.handleSave(),disabled:p.saving,children:p.saving?r(`profileDetailPanel.saving`):r(`profileDetailPanel.save`)}):null]}):(0,$.jsx)(`div`,{className:`flex justify-end`,children:(0,$.jsx)(B,{variant:`primary`,onClick:()=>void p.handleSave(),disabled:p.isInvalid||p.saving,children:p.saving?r(`profileDetailPanel.saving`):p.effectiveMode===`create`?r(`profileDetailPanel.create`):r(`profileDetailPanel.saveChanges`)})}),children:(0,$.jsx)(ee,{editor:p,assistantId:e,connections:o,variant:`panel`})}),(0,$.jsx)(An,{...m.blockedDeleteModalProps})]})}function rr({value:e,profileOptions:t,disabled:n,onChange:r}){let{t:i}=Z(`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)(V,{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:r,domains:i,persistedOverrides:a,orderedProfiles:o,onClose:s,onApplied:c}){let{t:l}=Z(`settings`),u=de(),d=t(),f=(0,Q.useMemo)(()=>({requireOwnProviderAndModel:d,requireTextGeneration:!1}),[d]),p=(0,Q.useMemo)(()=>{let e=new Map;for(let t of r){let n=or(t,a[t.id]);n&&e.set(t.id,n)}return e},[r,a]),m=(0,Q.useMemo)(()=>{let e=new Set(Array.from(p.values(),e=>e.profile));return o.filter(t=>e.has(t.name))},[o,p]),[h,g]=(0,Q.useState)(()=>m[0]?.name??``),[_,v]=(0,Q.useState)(``),[y,b]=(0,Q.useState)(new Set),[x,S]=(0,Q.useState)(!1),C=(0,Q.useMemo)(()=>{let e=new Map(i.map(e=>[e.id,e.displayName]));return t=>e.get(t)??t},[i]),w=(0,Q.useMemo)(()=>r.filter(e=>p.get(e.id)?.profile===h),[r,p,h]),T=(0,Q.useMemo)(()=>w.map(e=>e.id).filter(e=>!y.has(e)),[w,y]),E=(0,Q.useMemo)(()=>m.map(e=>({value:e.name,label:xe(e)})),[m]),D=(0,Q.useMemo)(()=>R(o,[],f).filter(e=>e.name!==h).map(e=>({value:e.name,label:xe(e)})),[o,h,f]),O=it(o,h),k=it(o,_),j=y.size===0;function M(e){g(e),b(new Set),e===_&&v(``)}function N(e,t){b(n=>{let r=new Set(n);return t?r.delete(e):r.add(e),r})}async function P(){if(!(!h||!_||T.length===0)){S(!0);try{let t={};for(let e of T)t[e]={profile:_};await u.mutateAsync({path:{assistant_id:e},body:{llm:{callSites:t}}}),A.success(l(`bulkOverrideSwapModal.successToast`,{count:T.length,targetLabel:k})),c(),s()}catch(e){let t=st(e);A.error(t??l(`bulkOverrideSwapModal.updateFailedToast`)),t||U(e,{context:`settings-ai-bulk-override-swap`})}finally{S(!1)}}}return(0,$.jsx)(G.Root,{open:!0,onOpenChange:e=>{e||s()},children:(0,$.jsxs)(G.Content,{size:`md`,children:[(0,$.jsx)(G.Header,{children:(0,$.jsx)(G.Title,{children:l(`bulkOverrideSwapModal.title`)})}),(0,$.jsxs)(G.Body,{className:`space-y-4`,children:[(0,$.jsx)(W,{variant:`body-medium-default`,as:`p`,children:l(`bulkOverrideSwapModal.intro`)}),(0,$.jsxs)(`div`,{className:`grid grid-cols-2 gap-3`,children:[(0,$.jsx)(V,{id:`bulk-swap-source`,label:l(`bulkOverrideSwapModal.currentlyUsingLabel`),value:h,onChange:M,options:E}),(0,$.jsx)(V,{id:`bulk-swap-target`,label:l(`bulkOverrideSwapModal.changeToLabel`),value:_,onChange:v,options:D,placeholder:l(`bulkOverrideSwapModal.targetPlaceholder`)})]}),(0,$.jsx)(Be,{tone:`info`,title:l(`bulkOverrideSwapModal.noticeTitle`),children:l(`bulkOverrideSwapModal.noticeBody`,{sourceLabel:O})}),(0,$.jsxs)(`div`,{children:[(0,$.jsxs)(`div`,{className:`mb-2 flex items-baseline justify-between gap-2`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(W,{variant:`body-medium-default`,as:`p`,children:l(`bulkOverrideSwapModal.affectedSummary`,{count:w.length,profile:O})}),(0,$.jsx)(W,{variant:`body-small-default`,as:`p`,className:`text-[color:var(--content-secondary)]`,children:l(`bulkOverrideSwapModal.chooseActions`)})]}),(0,$.jsx)(B,{variant:`ghost`,onClick:()=>b(j?new Set(w.map(e=>e.id)):new Set),children:l(j?`bulkOverrideSwapModal.clearAll`:`bulkOverrideSwapModal.selectAll`)})]}),(0,$.jsx)(`div`,{className:`max-h-72 space-y-1 overflow-y-auto`,children:w.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)(n,{checked:!y.has(e.id),onCheckedChange:t=>N(e.id,t===!0),disabled:x,label:e.displayName,helperText:C(e.domain)}),(0,$.jsx)(`span`,{className:`shrink-0 text-body-small-default text-[color:var(--content-tertiary)]`,children:p.get(e.id)?.via===`override`?l(`bulkOverrideSwapModal.viaOverride`):l(`bulkOverrideSwapModal.viaDefault`)})]},e.id))})]})]}),(0,$.jsxs)(G.Footer,{children:[(0,$.jsx)(W,{variant:`body-small-default`,as:`p`,className:`mr-auto self-center text-[color:var(--content-secondary)]`,children:l(`bulkOverrideSwapModal.willChange`,{count:T.length})}),(0,$.jsx)(B,{variant:`ghost`,onClick:s,disabled:x,children:l(`bulkOverrideSwapModal.cancel`)}),(0,$.jsx)(B,{variant:`primary`,loading:x,disabled:!h||!_||T.length===0||x,onClick:()=>void P(),children:l(`bulkOverrideSwapModal.applyTo`,{count:T.length})})]})]})})}function lr({id:e,displayName:t,description:n,defaultProfileLabel:r,draft:o,profileOptions:s,connections:l,onDraftChange:d,onToggle:f}){let{t:p}=Z(`settings`),m=L({hostedInference:$e.use.vellumHostedInference()}),h=ar(o),_=!o||!h?``:o.provider||o.model?ir:o.profile??``,v=_===ir,b=ge(),x=Gt(),S=(l??[]).some(e=>e.provider===u),C=[...Mt,...S?[u]:[]],w=b[0]??Mt[0],T=o?.provider,E=y(T)?T:T===`chatgpt`?u:void 0,D=E!==void 0&&C.some(e=>e===E),O=E??w,k=a(O,``,(l??[]).filter(e=>c(e.provider,O)))?nt(O):F(O,m),A=k.map(e=>({value:e.id,label:e.displayName})),j=typeof o?.model==`string`?o.model:``;if(j&&!k.some(e=>e.id===j)){let e=Qe(O).find(e=>e.id===j)?.displayName??j;A.push({value:j,label:p(`callSiteOverridesRow.unavailableOption`,{name:e})})}let M=!!o?.provider&&!o?.model,N=[...C.map(e=>({value:e,label:g[e]??e,...x(e)})),...E&&!D?[{value:E,label:p(`callSiteOverridesRow.unavailableOption`,{name:g[E]??E})}]:[]];function P(t){t===`__custom__`?d(e,{profile:null,provider:w,model:i(w)??``}):t===``?d(e,null):d(e,{profile:t,provider:null,model:null})}function I(t){let n=i(t)??``;d(e,{...o??{},profile:null,provider:t,model:n})}function ee(t){d(e,{...o??{},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:p(`callSiteOverridesRow.defaultProfileSuffix`,{label:r})})]})]}),(0,$.jsx)(Le,{checked:h,onChange:t=>f(e,t),"aria-label":p(`callSiteOverridesRow.overrideAriaLabel`,{displayName:t}),className:`shrink-0`})]}),h&&(0,$.jsx)(`div`,{className:`mt-3`,children:(0,$.jsx)(V,{value:_,onChange:P,options:s,className:`w-44`,menuMinWidth:280,menuAlign:`start`})}),h&&v&&(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:p(`callSiteOverridesRow.providerLabel`)}),(0,$.jsx)(V,{value:O??``,onChange:I,options:N})]}),(0,$.jsxs)(`div`,{className:`flex-1`,children:[(0,$.jsx)(`label`,{className:`mb-1 block text-body-small-default text-[var(--content-tertiary)]`,children:p(`callSiteOverridesRow.modelLabel`)}),(0,$.jsx)(V,{value:o?.model??``,onChange:ee,options:A})]})]}),M&&(0,$.jsx)(`p`,{className:`text-body-small-default text-[var(--system-negative-strong)]`,children:p(`callSiteOverridesRow.pickModelError`)})]})]})}function ur({groups:e,drafts:t,buildProfileOptionsForRow:n,profileLabelFor:r,advisorMatchesSearch:i,connections:a,onDraftChange:o,onToggle:s}){let{t:c}=Z(`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}=Z(`settings`),{data:a}=X({...Te({path:{assistant_id:e}}),staleTime:3e4}),o=(0,Q.useMemo)(()=>a?.llm?.profiles??{},[a?.llm?.profiles]),s=(0,Q.useMemo)(()=>a?.llm?.profileOrder??[],[a?.llm?.profileOrder]),c=(0,Q.useMemo)(()=>a?.llm?.callSites??{},[a?.llm?.callSites]),l=(0,Q.useMemo)(()=>mt(o,s),[o,s]),u=ge(),d=t(),f=(0,Q.useMemo)(()=>({requireOwnProviderAndModel:d}),[d]),p=(0,Q.useMemo)(()=>({requireOwnProviderAndModel:d,requireTextGeneration:!1}),[d]),m=de(),[h,g]=(0,Q.useState)(``),[_,v]=(0,Q.useState)(!1),[y,b]=(0,Q.useState)(!1),[S,C]=(0,Q.useState)(!1),{data:w,isLoading:T,isError:E,refetch:O}=X({...ze({path:{assistant_id:e}}),enabled:!!e,staleTime:6e4,refetchOnWindowFocus:!1}),{data:k}=X({...le({path:{assistant_id:e}}),enabled:!!e}),j=(0,Q.useMemo)(()=>(w?.callSites??[]).filter(e=>e.id!==`mainAgent`),[w]),M=!T&&!E&&!!w,N=!!a,P=M&&N,F=(0,Q.useMemo)(()=>j.map(e=>e.id),[j]),I=a?.llm?.advisorProfile??``,{drafts:L,advisorProfile:ee,advisorDirty:te,callSiteDraftsDirty:ne,hasUnsavedDrafts:re,hasValidationError:ie,setDraft:ae,setAdvisor:oe,clearEdits:se,buildSavePatch:ce,buildResetPatch:z}=pr({catalogCallSiteIds:F,persistedOverrides:c,persistedAdvisor:I,isSeeded:P}),ue=(0,Q.useMemo)(()=>new Set(F),[F]),fe=(0,Q.useCallback)(e=>it(l,e),[l]),V=(0,Q.useCallback)((e,t)=>({value:e.name,label:xe(e),...D(e,l,t)===`undispatchable`?{icon:(0,$.jsx)(tn,{className:`h-3.5 w-3.5 text-[var(--system-mid-strong)]`}),tooltip:we(e)}:{}}),[l]),pe=(0,Q.useMemo)(()=>R(l,[I],f).map(e=>V(e,f)),[l,I,V,f]),me=(0,Q.useMemo)(()=>{let e=h.trim().toLowerCase();return e===``||`advisor`.includes(e)||`second opinion`.includes(e)},[h]),he=(0,Q.useMemo)(()=>j.some(e=>or(e,c[e.id])!==null),[j,c]),_e=(0,Q.useMemo)(()=>Object.entries(c).some(([e,t])=>ue.has(e)&&(t?.profile!=null||t?.provider!=null||t?.model!=null)),[c,ue]),ve=(0,Q.useCallback)(e=>[...R(l,[e],p).map(e=>V(e,p)),{value:ir,label:r(`overridesDetailPanel.customProfileOption`)}],[l,V,p,r]),be=(0,Q.useMemo)(()=>{if(!h.trim())return j;let e=h.toLowerCase();return j.filter(t=>(t.displayName??``).toLowerCase().includes(e)||(t.description??``).toLowerCase().includes(e)||(t.domain??``).toLowerCase().includes(e))},[j,h]),Ce=(0,Q.useMemo)(()=>{if(!w)return[];let e=w.domains.map(e=>e.id),t=new Map(w.domains.map(e=>[e.id,e])),n=[];for(let r of e){let e=be.filter(e=>e.domain===r);e.length>0&&n.push({domain:t.get(r),sites:e})}let i=new Set(e),a=be.filter(e=>!i.has(e.domain));return a.length>0&&n.push({domain:{id:`other`,displayName:r(`overridesDetailPanel.otherDomain`)},sites:a}),n},[w,be,r]),Ee=(0,Q.useCallback)((e,t)=>{if(!t){ae(e,null);return}let n=ye(l,j.find(t=>t.id===e)?.defaultProfile,p);if(n)ae(e,{profile:n});else{let t=u[0]??Mt[0];ae(e,{provider:t,model:i(t)??``})}},[j,l,u,ae,p]),De=(0,Q.useCallback)(async()=>{v(!0);try{let t=ce();await m.mutateAsync({path:{assistant_id:e},body:{llm:{...ne?{callSites:t}:{},...te?{advisorProfile:ee}:{}}}}),n(),A.success(r(`overridesDetailPanel.overridesSavedToast`))}catch(e){A.error(r(`overridesDetailPanel.saveFailedToast`)),U(e,{context:`call_site_overrides_save`})}finally{v(!1)}},[ce,ne,te,ee,n,m,e,r]),Oe=(0,Q.useCallback)(async()=>{v(!0);try{let t=z();await m.mutateAsync({path:{assistant_id:e},body:{llm:{callSites:t}}}),n(),A.success(r(`overridesDetailPanel.overridesResetToast`))}catch(e){A.error(r(`overridesDetailPanel.resetFailedToast`)),U(e,{context:`call_site_overrides_reset`})}finally{v(!1)}},[z,n,m,e,r]),ke=(0,$.jsxs)(`div`,{className:`flex items-center justify-end gap-2`,children:[_e&&(0,$.jsx)(B,{variant:`outlined`,onClick:()=>b(!0),disabled:_||!P,tintColor:`var(--system-negative-strong)`,className:`mr-auto`,children:r(`overridesDetailPanel.resetToDefaults`)}),(0,$.jsx)(B,{variant:`primary`,onClick:()=>void De(),loading:_,disabled:!re||ie||_,children:r(`overridesDetailPanel.save`)})]});return(0,$.jsxs)(bt,{title:r(`overridesDetailPanel.title`),closeVariant:`outlined`,onClose:n,footer:ke,children:[(0,$.jsx)(`p`,{className:`mb-4 text-body-medium-lighter text-[var(--content-tertiary)]`,children:r(`overridesDetailPanel.description`)}),(0,$.jsxs)(`div`,{children:[(0,$.jsxs)(`div`,{className:`mb-4 flex items-center gap-2`,children:[(0,$.jsx)(`div`,{className:`min-w-0 flex-1`,children:(0,$.jsx)(K,{type:`search`,value:h,onChange:e=>g(e.target.value),placeholder:r(`overridesDetailPanel.searchPlaceholder`),leftIcon:(0,$.jsx)(sn,{className:`h-4 w-4`}),fullWidth:!0})}),(0,$.jsx)(B,{variant:`outlined`,onClick:()=>C(!0),disabled:!P||_||re||!he,title:re?r(`overridesDetailPanel.bulkChangeUnsavedTitle`):he?void 0:r(`overridesDetailPanel.bulkChangeNoCandidatesTitle`),children:r(`overridesDetailPanel.bulkChange`)})]}),N&&me&&(0,$.jsxs)(`div`,{className:`mb-4`,children:[(0,$.jsx)(pn,{children:r(`overridesDetailPanel.advisorSection`)}),(0,$.jsx)(rr,{value:ee,profileOptions:pe,disabled:_,onChange:oe})]}),T&&(0,$.jsx)(Se,{placement:`panel`}),E&&(0,$.jsx)(Be,{tone:`error`,title:r(`overridesDetailPanel.loadErrorTitle`),actions:(0,$.jsx)(B,{variant:`outlined`,onClick:()=>void O(),children:r(`overridesDetailPanel.retry`)}),children:r(`overridesDetailPanel.loadErrorHint`)}),!T&&!E&&w&&(0,$.jsx)(ur,{groups:Ce,drafts:L,buildProfileOptionsForRow:ve,profileLabelFor:fe,advisorMatchesSearch:me,connections:k?.connections,onDraftChange:ae,onToggle:Ee})]}),S&&w&&(0,$.jsx)(cr,{assistantId:e,callSites:j,domains:w.domains,persistedOverrides:c,orderedProfiles:l,onClose:()=>C(!1),onApplied:se}),(0,$.jsx)(x,{open:y,title:r(`overridesDetailPanel.resetToDefaults`),message:r(`overridesDetailPanel.resetConfirmMessage`),confirmLabel:r(`overridesDetailPanel.resetToDefaults`),destructive:!0,onConfirm:()=>{b(!1),Oe()},onCancel:()=>b(!1)})]})}var hr=e(Yt(),1);function gr({mode:e,connection:t,assistantId:n,existingNames:r,connections:i,variant:a=`modal`,actionsSlot:o,onSave:c,onCancel:l}){let{t:u}=Z(`settings`),[d,f]=(0,Q.useState)(t?.label??``),p=t?.name??``,h=t?.provider??`anthropic`,g=t?.auth.type??`api_key`,[_,v]=(0,Q.useState)(()=>t?.auth.type===`api_key`?t.auth.credential:t?``:`credential/anthropic/api_key`),[y,b]=(0,Q.useState)(t?.baseUrl??``),[x,T]=(0,Q.useState)(()=>t?.models?t.models.map(e=>e.id).join(`, `):``),[E,D]=(0,Q.useState)(!1),[k,A]=(0,Q.useState)(null),M=h===`openai-compatible`,N=ve(h),P=j(h),[F,L]=(0,Q.useState)(``),[ee,te]=(0,Q.useState)(!1),R=Jt(),ie=(0,Q.useMemo)(()=>me(_),[_]),ae=g===`api_key`&&ie!==null,{hasStoredCredential:oe,isLoading:se}=ne({assistantId:n,credentialKind:`credential`,credentialName:ie?`${ie.service}:${ie.field}`:``,enabled:ae}),{credentials:ce}=s({assistantId:n,enabled:g===`api_key`});(0,Q.useEffect)(()=>{let e=t?.provider??`anthropic`;f(t?.label??``),t?.auth.type===`api_key`?v(t.auth.credential):v(t?``:`credential/${e}/api_key`),A(null),b(t?.baseUrl??``),T(t?.models?t.models.map(e=>e.id).join(`, `):``),L(``),te(!1)},[t]);let le=d.trim()!==(t?.label??``).trim(),z=M&&le?_e(d,i,t?.name):null,ue=p.trim().length>0&&z===null;async function de(){if(ue){D(!0),A(null);try{let e;if(g===`api_key`){let t=_.trim()||`credential/${h}/api_key`,r=F.trim();if(r){te(!0);try{let e=me(t);await pt({path:{assistant_id:n},body:e?{type:`credential`,name:`${e.service}:${e.field}`,value:r}:{type:`api_key`,name:h,value:r},throwOnError:!0});let i=I(n,`credential`,e?`${e.service}:${e.field}`:``);R.setQueryData(i,!0),R.invalidateQueries({queryKey:Ee({path:{assistant_id:n}})})}catch{A(u(`providerEditorContent.failedSaveApiKey`));return}finally{te(!1)}}e={type:`api_key`,credential:t}}else if(t)e=t.auth;else{A(u(`providerEditorContent.nothingToEdit`));return}let r=d.trim()||null,i={auth:e,label:r,...N&&{base_url:y.trim()||null},...P&&{models:x.trim()?x.split(`,`).map(e=>({id:e.trim()})).filter(e=>e.id):null}},{data:a,error:o,response:s}=await m({path:{assistant_id:n,name:t?.name??p.trim()},body:i});if(!s?.ok){A(yt(s?.status,o)??w(s?.status));return}if(!a){A(u(`providerEditorContent.emptyServerResponse`));return}O(a,u),c(a)}catch{A(u(`providerEditorContent.failedSaveProvider`))}finally{D(!1)}}}let fe=ce.filter(e=>e.service===h),V=e!==`create`&&t?.auth.type===`api_key`,ge=fe.length>0||V,ye=he(u(`providerEditorContent.apiKeyPlaceholder`),oe);if(e===`create`)return(0,$.jsx)(Wt,{variant:a===`panel`?`inline`:`modal`,actionsSlot:o,assistantId:n,existingNames:r,connections:i,defaultProviderType:h,onCreated:c,onCancel:l});let be=(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)(Kt,{i18nKey:`providerEditorContent.displayNameLabel`,ns:`settings`,components:{optional:(0,$.jsx)(`span`,{className:`text-[var(--content-disabled)]`})}})}),(0,$.jsx)(K,{value:d,onChange:e=>f(e.target.value),placeholder:u(`providerEditorContent.displayNamePlaceholder`),fullWidth:!0}),z?(0,$.jsx)(W,{variant:`body-small-default`,as:`p`,className:`text-(--system-negative-strong)`,children:pe[z]}):null]}),N&&(0,$.jsxs)(`div`,{className:`space-y-1`,children:[(0,$.jsx)(`label`,{className:`block text-body-small-default text-[var(--content-tertiary)]`,children:u(`providerEditorContent.baseUrlLabel`)}),(0,$.jsx)(K,{value:y,onChange:e=>b(e.target.value),placeholder:u(h===`ollama`?`providerEditorContent.baseUrlPlaceholderOllama`:h===`opencode`?`providerEditorContent.baseUrlPlaceholderOpencode`:`providerEditorContent.baseUrlPlaceholder`),fullWidth:!0}),h===`ollama`?(0,$.jsx)(W,{variant:`body-small-default`,as:`p`,className:`text-[var(--content-tertiary)]`,children:u(`providerEditorContent.baseUrlHintOllama`)}):null,h===`opencode`?(0,$.jsx)(W,{variant:`body-small-default`,as:`p`,className:`text-[var(--content-tertiary)]`,children:u(`providerEditorContent.baseUrlHintOpencode`)}):null]}),P&&(0,$.jsxs)(`div`,{className:`space-y-1`,children:[(0,$.jsx)(`label`,{className:`block text-body-small-default text-[var(--content-tertiary)]`,children:u(`providerEditorContent.modelsLabel`)}),(0,$.jsx)(K,{value:x,onChange:e=>T(e.target.value),placeholder:u(`providerEditorContent.modelsPlaceholder`),fullWidth:!0}),(0,$.jsx)(W,{variant:`body-small-default`,as:`p`,className:`text-[var(--content-tertiary)]`,children:u(`providerEditorContent.modelsHint`)})]}),g===`api_key`&&(0,$.jsx)(C,{apiKeyValue:F,onApiKeyChange:L,credential:_,onCredentialChange:v,isLoadingCredential:se,apiKeyPlaceholder:ye,provider:h,providerCredentials:fe,showAdvancedSection:ge,onError:A}),g===`oauth_subscription`&&(0,$.jsx)(re,{assistantId:n,onConnected:c}),k&&(0,$.jsx)(W,{variant:`body-small-default`,as:`p`,className:`text-(--system-negative-strong)`,children:k})]}),xe=(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(B,{variant:`ghost`,onClick:l,children:u(`providerEditorContent.cancel`)}),(0,$.jsx)(B,{variant:`primary`,disabled:!ue||E||ee,onClick:()=>void de(),children:u(E?`providerEditorContent.saving`:`providerEditorContent.saveChanges`)})]});return a===`panel`?(0,$.jsxs)(`div`,{className:`space-y-4`,children:[be,o===void 0?(0,$.jsx)(`div`,{className:`flex justify-end gap-2`,children:xe}):o&&(0,hr.createPortal)(xe,o)]}):(0,$.jsxs)(G.Content,{size:`md`,children:[(0,$.jsxs)(G.Header,{children:[(0,$.jsx)(G.Title,{children:u(`providerEditorContent.editProviderTitle`)}),(0,$.jsx)(G.Description,{children:t?u(`providerEditorContent.editingConnection`,{name:S(t)}):u(`providerEditorContent.editProviderSettingsFallback`)})]}),(0,$.jsx)(G.Body,{children:be}),(0,$.jsx)(G.Footer,{children:xe})]})}function _r({assistantId:e,connectionName:t,onClose:n}){let{t:r}=Z(`settings`),i=Jt(),[a,o]=(0,Q.useState)(null),{data:s,isLoading:c}=X(le({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 p(){i.invalidateQueries({queryKey:f({path:{assistant_id:e}})}),i.invalidateQueries({queryKey:dt({path:{assistant_id:e}})}),n()}return(0,$.jsx)(bt,{title:u?S(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)(Se,{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:p,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=ft(),a=e??i,s=P(),c=Jt(),{t:l}=Z(),u=(0,Q.useMemo)(()=>o(Re(),{displayName:l(`sttProviderForm.windowsNativeDisplayName`),subtitle:l(`sttProviderForm.windowsNativeSubtitle`),setupWarning:l(`sttProviderForm.windowsNativeSetupWarning`)}).filter(e=>!e.requiresNativeDictation||et()),[l]),d=br,{data:f}=X({...Te({path:{assistant_id:a}}),enabled:s,staleTime:3e4}),p=f?.services?.stt,m=p?.mode===`managed`?`vellum`:p?.provider,h=(0,Q.useMemo)(()=>{let e=m?yr[m]:void 0;if(e&&u.some(t=>t.id===e))return e;let t=q(Je,d);return u.some(e=>e.id===t)?t:d},[m,u,d]),g=!!m,[_,v]=yn(h),{available:y,currentCode:b,configuredProviderId:x,selectLanguage:S,selecting:C}=Xe(a),[w,T]=(0,Q.useState)(!1),E=y&&_===h&&(vr[_]?.provider===x||!!m&&!yr[m]),[D,O]=(0,Q.useState)(``),[k,j]=(0,Q.useState)(!1),[M,N]=(0,Q.useState)(!1);(0,Q.useEffect)(()=>{let e=q(Je,d);e===`macos-native`&&!u.some(t=>t.id===e)&&J(Je,d)},[u,d]);let F=(0,Q.useMemo)(()=>u.find(e=>e.id===_)??u[0],[u,_]),I=F.apiKeyPlaceholder!==void 0;(0,Q.useEffect)(()=>{j(q(ut+_,``).length>0),O(``)},[_]);let L=(0,Q.useMemo)(()=>{let e=_!==h,t=D.trim().length>0;return e||t},[_,h,D]),ee=(0,Q.useCallback)(async()=>{let e=D.trim();J(Je,_),e.length>0&&J(ut+_,e);let t=vr[_];N(!0);try{if(t?.credentialService){let n=e.length>0?e:q(ut+_,``);if(n.length>0){let{response:e}=await jt({path:{assistant_id:a},body:{service:t.credentialService,field:`api_key`,value:n,label:`${F.displayName} API Key`},throwOnError:!1});if(!e?.ok)throw Error(`Failed to store API key (HTTP ${e?.status??`?`})`)}}if(t&&(_!==h||!g)||m===`vellum`&&_!==`vellum`){let e=t?.provider??br,{response:n}=await ot({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&&j(!0),O(``),c.invalidateQueries({queryKey:ie({path:{assistant_id:a}})}),A.success(l(`sttProviderForm.saveSuccess`)),!0}catch(e){return A.error(e instanceof Error?e.message:l(`sttProviderForm.saveFailed`)),!1}finally{N(!1)}},[a,_,D,F,h,g,m,c,l]);(0,Q.useEffect)(()=>{r?.({hasChanges:L,saving:M,save:ee})},[r,L,M,ee]);let te=(0,Q.useCallback)(()=>{J(ut+_,``),j(!1),O(``)},[_]),ne=k?l(`sttProviderForm.apiKeyPlaceholderReplace`):F.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:l(`sttProviderForm.providerLabel`)}),(0,$.jsx)(V,{value:_,onChange:v,options:u.map(e=>({value:e.id,label:e.displayName})),"aria-label":l(`sttProviderForm.providerAriaLabel`)})]}),E&&(0,$.jsxs)(`div`,{className:`space-y-1`,children:[(0,$.jsx)(`label`,{className:`block text-body-small-default text-[var(--content-tertiary)]`,children:l(`sttProviderForm.spokenLanguage`)}),(0,$.jsx)(Tt,{"aria-label":l(`sttProviderForm.spokenLanguage`),"aria-haspopup":`dialog`,onClick:()=>T(!0),value:ht(b,x)}),(0,$.jsx)(`p`,{className:`text-body-small-default text-[var(--content-tertiary)]`,children:l(`sttProviderForm.spokenLanguageApplies`)}),(0,$.jsx)(_n,{open:w,onOpenChange:T,title:l(`sttProviderForm.spokenLanguage`),currentCode:b,configuredProviderId:x,selectLanguage:S,selecting:C})]}),I&&(0,$.jsxs)(`div`,{className:`space-y-1`,children:[(0,$.jsx)(`label`,{className:`block text-body-small-default text-[var(--content-tertiary)]`,children:l(`sttProviderForm.apiKeyLabel`)}),(0,$.jsx)(K,{type:`password`,value:D,onChange:e=>O(e.target.value),placeholder:ne,fullWidth:!0})]}),F.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:F.setupWarning})]}),!n&&F.credentialsGuide&&(0,$.jsx)(fn,{guide:F.credentialsGuide}),_===`vellum`&&(0,$.jsx)(`p`,{className:`text-body-medium-lighter text-[var(--content-tertiary)]`,children:l(`sttProviderForm.vellumTranscription`)}),(!t||k)&&(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[!t&&(0,$.jsx)(dn,{onClick:ee,disabled:!L||M}),k&&(0,$.jsx)(un,{onClick:te})]})]})}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}=Z(`settings`),n=Jt(),r=P(),[i,a]=(0,Q.useState)(null),{data:o}=X({...Te({path:{assistant_id:e}}),enabled:r,staleTime:3e4}),s=o?.services?.stt,c=Cr(s),{data:l}=X({...Fe({path:{assistant_id:e}}),enabled:r&&c.length>0,staleTime:5*6e4});if(c.length===0)return null;let u=e=>l?.providers?.find(t=>t.id===e)?.displayName??e,d=async r=>{a(r);try{let{response:t}=await ot({path:{assistant_id:e},body:{services:{stt:{roles:{[r]:null}}}},throwOnError:!1});if(!t?.ok)throw Error(String(t?.status??``));await n.invalidateQueries({queryKey:ie({path:{assistant_id:e}})})}catch{A.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?`${u(e.provider)} · ${e.model}`:u(e.provider)}),(0,$.jsx)(B,{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 d(e.role),children:t(`sttRoleOverrides.clear`)})]},e.role)})})]})}function Tr(){let{t:e}=Z(`settings`),t=ft();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}=Z(),[a,o]=(0,Q.useState)(!1),{voices:s}=ce(e);if(s.length===0)return null;let c=s.find(e=>e.model===t)??s[0];return(0,$.jsxs)(xt.Root,{open:a,onOpenChange:o,children:[(0,$.jsx)(xt.Trigger,{asChild:!0,children:(0,$.jsx)(Tt,{"aria-label":i(`voicePickerField.ariaLabel`),value:c?Lt(c.description):i(`voicePickerField.selectVoice`),className:r})}),(0,$.jsx)(xt.Content,{side:`bottom`,align:`start`,className:`w-[var(--radix-popover-trigger-width)] p-1`,children:(0,$.jsx)(ae,{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}=Z(),a=ft(),o=e??a,s=E.use.name()??`your assistant`,c=P(),l=Jt(),{data:u}=X({...at({path:{assistant_id:o}}),enabled:c,staleTime:1/0}),f=(0,Q.useMemo)(()=>{let e=u?.providers;if(!e)return v;if(e.some(e=>e.id===`vellum`))return e;let t=v.find(e=>e.id===`vellum`);return t?[t,...e]:e},[u]),{data:p}=X({...Te({path:{assistant_id:o}}),enabled:c,staleTime:3e4}),m=p?.services?.tts,h=m?.mode===`managed`?`vellum`:m?.provider,g=`elevenlabs`,_=(0,Q.useMemo)(()=>h??q(`vellum:voice:ttsProvider`,g),[h,g]),y=!!h,[b,x]=yn(_),[S,C]=(0,Q.useState)(``),[w,T]=(0,Q.useState)(``),[D,O]=(0,Q.useState)(``),[k,j]=(0,Q.useState)(!1),[M,N]=(0,Q.useState)(!1),[F,I]=(0,Q.useState)(!1),{voices:L,defaultModel:ee,fetched:te}=d(o,{enabled:b===`vellum`}),ne=m?.providers?.vellum?.model??ee??``,[R,re]=yn(ne),ae=L.find(e=>e.model===R)??L[0],[oe,se]=(0,Q.useState)(null),ce=L.some(e=>e.model===ne),le=oe??(te&&ne!==``&&!ce),z=(0,Q.useMemo)(()=>f.find(e=>e.id===b)??f[0],[b,f]),ue=b===`vellum`&&z.supportsVoiceSelection&&R.trim()!==``&&R.trim()!==ne,de=(0,Q.useCallback)(e=>{let t=q(Ge+e,``),n=q(At+e,``);j(t.length>0),T(n),O(n),C(``)},[]);(0,Q.useEffect)(()=>{de(b)},[b,de]);let fe=(0,Q.useMemo)(()=>{let e=b!==_,t=S.trim().length>0,n=w.trim()!==D;return e||t||n||ue},[b,_,S,w,D,ue]),pe=(0,Q.useCallback)(async()=>{let e=S.trim(),t=w.trim(),n=z.id;J(Oe,n),e.length>0&&J(Ge+n,e),J(At+n,t);let r=e.length>0?e:q(Ge+n,``),a=jr[n];I(!0);try{if(r.length>0){let{response:e}=await jt({path:{assistant_id:o},body:{service:n,field:`api_key`,value:r,label:`${z.displayName} API Key`},throwOnError:!1});if(!e?.ok)throw Error(`Failed to store API key (HTTP ${e?.status??`?`})`)}let e={...b!==_||!y?{provider:n,mode:n===`vellum`?`managed`:`your-own`}:{},...a?{providers:{[n]:{[a]:t}}}:{},...ue?{providers:{vellum:{model:R.trim()}}}:{}};if(Object.keys(e).length>0){let{response:t}=await ot({path:{assistant_id:o},body:{services:{tts:e}},throwOnError:!1});if(!t?.ok)throw Error(`Failed to save configuration (HTTP ${t?.status??`?`})`)}return j(r.length>0),O(t),C(``),l.invalidateQueries({queryKey:ie({path:{assistant_id:o}})}),A.success(i(`ttsProviderForm.saved`)),!0}catch(e){return A.error(e instanceof Error?e.message:i(`ttsProviderForm.saveFailed`)),!1}finally{I(!1)}},[o,b,R,ue,S,w,z,_,y,l,i]);(0,Q.useEffect)(()=>{r?.({hasChanges:fe,saving:F,save:pe})},[r,fe,F,pe]);let me=(0,Q.useCallback)(()=>{J(Ge+b,``),j(!1),C(``)},[b]),he=(0,Q.useCallback)(async()=>{N(!0);try{let e=q(Ge+b,``),t=S.trim(),n=t.length>0?t:e;if(n.length===0){A.error(i(`ttsProviderForm.apiKeyRequired`));return}let r=q(At+b,``),a=w.trim(),o=await Er({provider:b,apiKey:n,voiceId:a.length>0?a:r,text:`Hey! It's ${s}. How does this sound?`});if(o.kind!==`audio`){A.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,S,b,w,i]),ge=k?`•••••••• (Enter a new key to replace)`:z.apiKeyPlaceholder,_e=b===`vellum`,ve=_e&&z.supportsVoiceSelection,ye=(0,$.jsxs)(B,{variant:`link`,size:`compact`,className:`inline-flex h-auto items-center gap-1 px-0 underline [--vbtn-fg:var(--content-tertiary)]`,onClick:()=>{se(!1),L.some(e=>e.model===R)||re(ee||L[0]?.model||``)},children:[(0,$.jsx)(nn,{className:`h-3.5 w-3.5`,"aria-hidden":!0}),i(`ttsProviderForm.chooseFromCatalog`)]}),be=ve&&le&&L.length>0?ye: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)(V,{value:b,onChange:x,options:f.map(e=>({value:e.id,label:e.displayName})),"aria-label":i(`ttsProviderForm.providerAriaLabel`)})]}),!_e&&(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)(K,{type:`password`,value:S,onChange:e=>C(e.target.value),placeholder:ge,fullWidth:!0})]}),ve&&(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`)}),le?(0,$.jsx)(K,{type:`text`,value:R,onChange:e=>re(e.target.value),placeholder:i(`ttsProviderForm.voiceIdPlaceholder`),"aria-label":i(`ttsProviderForm.customVoiceIdAriaLabel`),fullWidth:!0}):ae?(0,$.jsx)(Ar,{assistantId:o,value:R,onChange:re}):te&&(0,$.jsx)(`p`,{className:`text-body-small-default text-[var(--content-tertiary)]`,children:i(`ttsProviderForm.noManagedVoices`)})]}),z.supportsVoiceSelection&&!_e&&(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)(K,{type:`text`,value:w,onChange:e=>T(e.target.value),placeholder:i(`ttsProviderForm.voiceIdPlaceholder`),fullWidth:!0})]}),!n&&!_e&&(0,$.jsx)(fn,{guide:z.credentialsGuide}),(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[!_e&&(0,$.jsx)(B,{variant:`outlined`,onClick:he,disabled:M,children:i(M?`ttsProviderForm.testing`:`ttsProviderForm.test`)}),(0,$.jsxs)(`div`,{className:`flex items-center gap-3`,children:[be,!t&&(0,$.jsx)(dn,{onClick:pe,disabled:!fe||F}),k&&!_e&&(0,$.jsx)(un,{onClick:me})]})]})]})}function Nr(){let{t:e}=Z(`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}=Z(`settings`),t=ft(),n=Jt(),{data:i}=X({...Te({path:{assistant_id:t}}),staleTime:3e4}),a=lt({onSuccess:e=>{r(n,{path:{assistant_id:t}},e)}}),o=vn(),s=(0,Q.useMemo)(()=>i?i.services?.[`web-fetch`]?.provider||q(`vellum:ai:webFetchProvider`,Pr):q(Ut,Pr),[i]),c=(0,Q.useMemo)(()=>i?.services?.[`web-fetch`]?.apiBase??``,[i]),[l,u]=(0,Q.useState)(!1),[d,f]=yn(s),[p,m]=yn(c),[h,g]=(0,Q.useState)(``),_=De.has(d),v=kt.has(d),{hasStoredCredential:y}=ne({assistantId:t,credentialKind:`api_key`,credentialName:d,enabled:v}),b=h.trim().length>0,x=p.trim(),S=Ye(d,_&&x.length>0),C=d!==s||_&&x!==c.trim(),w=l||v&&!S&&!y&&!b||!C&&!b,T=he(se[d]??e(`webFetchCard.apiKeyPlaceholder`),y),E=Vt[d]??``,D=(0,Q.useCallback)(async()=>{u(!0);let r=h.trim(),i=v&&r.length>0;try{i&&await o(d,r),await a.mutateAsync({path:{assistant_id:t},body:{services:{"web-fetch":{provider:d,..._?{apiBase:x}:{}}}}}).catch(t=>{throw A.error(e(`webFetchCard.configUpdateFailedToast`)),U(t,{context:`patch_daemon_config`}),t})}catch{u(!1);return}u(!1);try{if(J(Ut,d),i){let e=wt(d);e&&J(e,r);let i=I(t,`api_key`,d);n.setQueryData(i,!0),n.invalidateQueries({queryKey:i}),g(``)}A.success(e(`webFetchCard.savedToast`))}catch(t){U(t,{context:`settings-ai-web-fetch-persist-local`}),A.error(e(`webFetchCard.localPreferencesFailedToast`))}},[v,a,o,n,t,h,d,_,x,e]),O=(0,Q.useCallback)(()=>{let e=wt(d);e&&Bt(e),g(``),m(``),f(Pr),J(Ut,Pr)},[d,f,m]);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)(V,{value:d,onChange:f,options:Ft.map(e=>({value:e,label:je[e]??e}))})]}),_&&(0,$.jsxs)(`div`,{className:`space-y-1`,children:[(0,$.jsx)(K,{label:e(`webFetchCard.apiBaseLabel`),type:`url`,value:p,onChange:e=>m(e.target.value),placeholder:E||e(`webFetchCard.apiBasePlaceholder`),fullWidth:!0}),E?(0,$.jsx)(`p`,{className:`text-body-small-lighter text-[var(--content-tertiary)]`,children:e(`webFetchCard.apiBaseHint`,{defaultBase:E})}):null]}),v&&(0,$.jsx)(K,{label:e(`webFetchCard.apiKeyLabel`),type:`password`,value:h,onChange:e=>g(e.target.value),placeholder:T,fullWidth:!0}),(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(dn,{onClick:D,disabled:w}),l&&(0,$.jsx)(rn,{className:`h-4 w-4 animate-spin text-[var(--content-disabled)]`}),v&&(0,$.jsx)(un,{onClick:O,filled:!0})]})]})})}var Ir=`0.10.12`;function Lr(){return qe(Ir)}function Rr(){let{t:e}=Z(`settings`),t=ft(),n=Jt(),i=P(),{data:a}=X({...Te({path:{assistant_id:t}}),enabled:i,staleTime:3e4}),o=lt({onSuccess:e=>{r(n,{path:{assistant_id:t}},e)}}),s=vn(),c=(0,Q.useMemo)(()=>{if(!a)return q(Ne,`inference-provider-native`);let e=a.services?.[`web-search`];return(e?.mode===`managed`&&e?.provider!==`inference-provider-native`?`vellum`:e?.provider)||q(`vellum:ai:webSearchProvider`,`inference-provider-native`)},[a]),l=(0,Q.useMemo)(()=>a?.services?.[`web-search`]?.apiBase??``,[a]),[u,d]=(0,Q.useState)(!1),[f,p]=yn(c),[m,h]=yn(l),[g,_]=(0,Q.useState)(``),v=Dt.has(f),y=Ie.has(f),b=Ve.has(f),{hasStoredCredential:x}=ne({assistantId:t,credentialKind:`api_key`,credentialName:f,enabled:y}),S=g.trim().length>0,C=m.trim(),w=Ye(f,v&&C.length>0),T=f!==c||v&&C!==l.trim(),E=gt[f]??``,D=y&&!b&&!w&&!x&&!S,O=v&&E.length===0&&!C,k=u||D||O||!T&&!S,j=he(Ue[f]??e(`webSearchCard.apiKeyPlaceholder`),x),M=(0,Q.useCallback)(async()=>{d(!0);let r=g.trim(),i=Pe(f),a=y&&r.length>0;try{a&&await s(f,r),await Ht();let n=f===`vellum`?Lr()?{provider:`vellum`,mode:`managed`}:{mode:`managed`}:{provider:f,mode:`your-own`,...v?{apiBase:C}:{}};await o.mutateAsync({path:{assistant_id:t},body:{services:{"web-search":n}}}).catch(t=>{throw A.error(e(`webSearchCard.configUpdateFailedToast`)),U(t,{context:`patch_daemon_config`}),t})}catch{d(!1);return}d(!1);try{if(J(Ne,f),a){i&&J(i,r);let e=I(t,`api_key`,f);n.setQueryData(e,!0),n.invalidateQueries({queryKey:e}),_(``)}A.success(e(`webSearchCard.savedToast`))}catch(t){U(t,{context:`settings-ai-web-search-persist-local`}),A.error(e(`webSearchCard.localPreferencesFailedToast`))}},[y,o,s,n,t,g,f,v,C,e]),N=(0,Q.useCallback)(()=>{let e=Pe(f);e&&Bt(e),_(``),h(``),p(`inference-provider-native`),J(Ne,`inference-provider-native`)},[f,p,h]);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)(V,{"aria-label":e(`webSearchCard.providerAriaLabel`),value:f,onChange:p,options:Ke.map(e=>({value:e,label:ct[e]??e}))})]}),f===`vellum`&&(0,$.jsx)(`p`,{className:`text-body-medium-lighter text-[var(--content-tertiary)]`,children:e(`webSearchCard.vellumNote`)}),v&&(0,$.jsxs)(`div`,{className:`space-y-1`,children:[(0,$.jsx)(K,{label:e(`webSearchCard.apiBaseLabel`),type:`url`,value:m,onChange:e=>h(e.target.value),placeholder:E||e(`webSearchCard.apiBasePlaceholder`),fullWidth:!0}),E?(0,$.jsx)(`p`,{className:`text-body-small-lighter text-[var(--content-tertiary)]`,children:e(`webSearchCard.apiBaseHint`,{defaultBase:E})}):null]}),y&&(0,$.jsx)(K,{label:e(`webSearchCard.apiKeyLabel`),type:`password`,value:g,onChange:e=>_(e.target.value),placeholder:j,fullWidth:!0}),(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(dn,{onClick:M,disabled:k}),u&&(0,$.jsx)(rn,{className:`h-4 w-4 animate-spin text-[var(--content-disabled)]`}),y&&(0,$.jsx)(un,{onClick:N,filled:!0})]})]})})}function zr(){let e=ft(),t=N(),[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,Ab as i,Af as a,As as o,Bf as s,Bm as c,Bv as l,Cb as u,Co as d,Cp as f,Cs as p,Cv as m,DC as h,Db as g,Df as _,Ds as v,Eb as y,Ef as b,GS as x,Gm as S,Hf as C,Hm as w,Ii as T,Ix as E,J as D,Jm as O,K as k,KS as A,Km as j,Li as M,Ll as N,Lm as P,Mb as F,Nm as I,Ob as L,Of as ee,Os as te,Pm as ne,Q as R,Q_ as re,Qf as ie,Qt as ae,RS as oe,Sb as se,So as ce,Sp as le,Sv as z,TC as B,Tb as ue,Tf as de,Ts as fe,US as V,Uf as pe,Um as me,Vf as he,Vm as ge,Wf as _e,Wm as ve,X as ye,Xp as be,Y as xe,Yn as Se,Yp as Ce,Z as we,Zf as Te,Zp as Ee,_b as De,_s as Oe,_y as ke,ab as Ae,bC as H,bb as je,bp as Me,bs as Ne,cS as U,cb as Pe,cm as Fe,db as Ie,eC as Le,eg as Re,ep as ze,fC as Be,fb as Ve,fs as He,gb as Ue,gg as We,gs as Ge,hC as W,hb as Ke,hg as qe,hs as Je,ib as Ye,it as Xe,jS as Ze,jb as Qe,jf as $e,js as et,kb as tt,kf as nt,ks as rt,lb as it,lm as at,lv as ot,mS as st,mb as ct,mm as lt,ms as ut,np as dt,nt as ft,ny as pt,ob as mt,ot as ht,pb as gt,ps as _t,q as vt,qS as G,qm as yt,qn as bt,rC as xt,rp as St,sC as Ct,sb as wt,st as Tt,tC as K,tp as Et,ub as Dt,vC as Ot,vS as q,vb as kt,vs as At,vv as jt,wb as Mt,wf as Nt,ws as Pt,xS as J,xb as Ft,xm as It,xo as Lt,xp as Rt,xs as zt,yS as Bt,yb as Vt,yg as Ht,ys as Ut,zf as Wt,zm as Gt}from"./app-us2PS4GU.js";import{I as Y,N as Kt,Qn as X,Yn as qt,j as Z,tr as Jt}from"./vendor-GPbHjL0d.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-BtVHaQ3H.js";import{o as pn}from"./detail-primitives-RYLHwqmj.js";import{d as mn,o as hn,u as gn}from"./schedules-Bm74CJrl.js";import{t as _n}from"./stt-language-picker-modal-CFESIfez.js";var Q=e(Zt(),1);function vn(){let e=ft();return(0,Q.useCallback)(async(t,n)=>{try{let{data:r}=await pt({path:{assistant_id:e},body:{value:n,type:`api_key`,name:t},throwOnError:!0});Ae(r)}catch(e){throw e instanceof Error&&e.message===`No assistant found`?A.error(Y(`settings:useDaemonConfig.assistantNotReadyToast`)):A.error(Y(`settings:useDaemonConfig.saveApiKeyFailedToast`,{providerName:t})),U(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 qe(bn)}var $=Xt(),Sn=`gemini-3.1-flash-image-preview`;function Cn(e,t){return e===`openrouter`?`openrouter`:rt(t)}function wn(){let{t:e}=Z(`settings`),t=ft(),n=Jt(),i=P(),{data:a}=X({...Te({path:{assistant_id:t}}),enabled:i,staleTime:3e4}),o=lt({onSuccess:e=>{r(n,{path:{assistant_id:t}},e)}}),s=vn(),c=a?.services?.[`image-generation`],u=(0,Q.useMemo)(()=>a?c?.mode===`managed`?`vellum`:c?.provider||q(`vellum:ai:imageGenProvider`,`gemini`):q(_t,`gemini`),[a,c?.mode,c?.provider]),[d,f]=yn(u),[m,h]=(0,Q.useState)(()=>q(He,Sn)),[g,_]=(0,Q.useState)(null),v=u===`openrouter`&&typeof c?.model==`string`?c.model:void 0,y=g??v??q(`vellum:ai:imageGenModel`,`google/gemini-3.1-flash-image-preview`),b=d===`openrouter`,x=te(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,E]=(0,Q.useState)(!1),D=Pt.map(e=>({value:e,label:fe[e]??e})),O=(0,Q.useMemo)(()=>te(d).map(e=>({value:e,label:p[e]??e})),[d]),k=d===`gemini`||d===`openai`||d===`openrouter`,{hasStoredCredential:j}=ne({assistantId:t,credentialKind:`api_key`,credentialName:d,enabled:k}),M=(0,Q.useCallback)(e=>{f(e),e===`openrouter`&&g===null&&_(v??`google/gemini-3.1-flash-image-preview`)},[g,v,f]),N=(0,Q.useCallback)(async()=>{E(!0);let r=C.trim(),i=k&&r.length>0;try{await Ht(),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 A.error(e(`imageGenerationCard.configUpdateFailedToast`)),U(t,{context:`patch_daemon_config`}),t});try{await l({path:{assistant_id:t},body:{modelId:S},throwOnError:!0})}catch(t){throw A.error(e(`imageGenerationCard.modelUpdateFailedToast`)),U(t,{context:`set_image_gen_model`}),t}finally{n.invalidateQueries({queryKey:ie({path:{assistant_id:t}})})}}catch{E(!1);return}E(!1);try{if(J(_t,d),J(He,S),i){let e=I(t,`api_key`,d);n.setQueryData(e,!0),n.invalidateQueries({queryKey:e}),w(``)}A.success(e(`imageGenerationCard.savedToast`))}catch(t){U(t,{context:`settings-ai-image-gen-persist-local`}),A.error(e(`imageGenerationCard.localPreferencesFailedToast`))}},[C,d,k,S,t,o,s,n,e]),F=(0,Q.useCallback)(()=>{if(w(``),d===`openrouter`){_(zt),J(He,zt);return}h(Sn),J(He,Sn)},[d]),L=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)(V,{"aria-label":e(`imageGenerationCard.providerAriaLabel`),value:d,onChange:M,options:D})]}),d===`vellum`&&(0,$.jsx)(`p`,{className:`text-body-medium-lighter text-[var(--content-tertiary)]`,children:e(`imageGenerationCard.vellumNote`)}),k&&(0,$.jsx)(K,{label:e(`imageGenerationCard.apiKeyLabel`),type:`password`,value:C,onChange:e=>w(e.target.value),placeholder:he(L,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)(K,{"aria-label":e(`imageGenerationCard.modelAriaLabel`),value:y,onChange:e=>_(e.target.value),placeholder:e(`imageGenerationCard.openrouterModelPlaceholder`),fullWidth:!0}):(0,$.jsx)(V,{"aria-label":e(`imageGenerationCard.modelAriaLabel`),value:S,onChange:h,options:O})]}),(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(dn,{onClick:N,disabled:T}),T&&(0,$.jsx)(rn,{className:`h-4 w-4 animate-spin text-[var(--content-disabled)]`}),k&&(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)(W,{variant:`body-large-default`,as:`h3`,className:`text-[var(--content-secondary)]`,children:e}),t==null?null:(0,$.jsxs)(W,{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)(W,{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(Y(`settings:manageProfilesBlockedDeleteModal.clauseDefaultProfile`)),e.callSiteIds.length>0&&n.push(Y(`settings:manageProfilesBlockedDeleteModal.clauseActionOverrides`,{count:e.callSiteIds.length}));let r=e.scheduleNames.length,i=e.deferredReminderCount;return r>0&&i>0?n.push(Y(`settings:manageProfilesBlockedDeleteModal.clauseRunsBoth`,{schedules:r,reminders:i})):r>0?n.push(Y(`settings:manageProfilesBlockedDeleteModal.clauseRunsSchedules`,{count:r})):i>0&&n.push(Y(`settings:manageProfilesBlockedDeleteModal.clauseRunsReminders`,{count:i})),n.length===0?Y(`settings:manageProfilesBlockedDeleteModal.summaryNoReferences`,{display:t}):n.length===1?Y(`settings:manageProfilesBlockedDeleteModal.summaryOneClause`,{display:t,clause1:n[0]}):n.length===2?Y(`settings:manageProfilesBlockedDeleteModal.summaryTwoClauses`,{display:t,clause1:n[0],clause2:n[1]}):Y(`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:a,onClose:o,onConfirm:s}){let{t:c}=Z(`settings`),l=e?.scheduleNames??[],u=l.slice(0,Dn),d=l.length-u.length,f=e!=null&&En(e);return(0,$.jsx)(G.Root,{open:e!==null,onOpenChange:e=>{e||o()},children:(0,$.jsxs)(G.Content,{size:`sm`,children:[(0,$.jsx)(G.Header,{children:(0,$.jsx)(G.Title,{children:c(`manageProfilesBlockedDeleteModal.title`)})}),(0,$.jsxs)(G.Body,{className:`space-y-4`,children:[e&&(0,$.jsx)(W,{variant:`body-medium-default`,as:`p`,children:kn(e)}),e&&e.callSiteIds.length>0&&(0,$.jsx)(On,{title:c(`manageProfilesBlockedDeleteModal.actionOverridesTitle`),items:e.callSiteIds,mono:!0}),u.length>0&&(0,$.jsxs)(`div`,{className:`space-y-1`,children:[(0,$.jsx)(On,{title:c(`manageProfilesBlockedDeleteModal.schedulesTitle`),items:u}),d>0&&(0,$.jsx)(W,{variant:`body-small-default`,as:`p`,className:`pl-1 text-(--content-tertiary)`,children:c(`manageProfilesBlockedDeleteModal.moreSchedules`,{count:d})})]}),e?.scheduleLookupFailed&&(0,$.jsx)(W,{variant:`body-small-default`,as:`p`,className:`text-(--system-mid-strong)`,children:c(`manageProfilesBlockedDeleteModal.scheduleLookupFailed`)}),(0,$.jsxs)(`div`,{className:`space-y-1`,children:[(0,$.jsx)(`label`,{className:`block text-body-small-default text-(--content-tertiary)`,children:c(`manageProfilesBlockedDeleteModal.replacementLabel`)}),(0,$.jsx)(V,{"aria-label":c(`manageProfilesBlockedDeleteModal.replacementLabel`),value:n,onChange:r,placeholder:c(`manageProfilesBlockedDeleteModal.replacementPlaceholder`),options:t.map(e=>{let t=f&&e.status===`disabled`;return{value:e.name,label:xe(e),disabled:t,tooltip:t?c(`manageProfilesBlockedDeleteModal.disabledTargetTooltip`):void 0}})})]}),i&&(0,$.jsx)(W,{variant:`body-small-default`,as:`p`,className:`text-(--system-negative-strong)`,children:i})]}),(0,$.jsxs)(G.Footer,{children:[(0,$.jsx)(B,{variant:`ghost`,size:`compact`,onClick:o,children:c(`manageProfilesBlockedDeleteModal.cancel`)}),(0,$.jsx)(B,{variant:`primary`,size:`compact`,disabled:!n||a,onClick:s,children:c(a?`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:l}=Z(`settings`),u=e.source===`managed`,d=e.status===`disabled`,f=e.label??e.name,p=[];e.model&&p.push(_(e.provider??void 0,e.model,r)),u&&p.push(l(`profileRow.managedByVellum`));let m=e.availability,g=e.config_issue,v=g!=null||m?.status===`incomplete`,y=m?.message??l(`profileRow.providerUnavailableDefault`),b=g==null?m!=null&&m.status!==`ok`?v?l(`profileRow.providerUnavailableFixable`,{message:y}):y:null:l(`profileRow.providerUnavailableFixable`,{message:l(g.code===`over_output_cap`?`profileRow.configIssueOverOutputCap`:g.code===`no_input_room`?`profileRow.configIssueNoInputRoom`:`profileRow.configIssueModelUnknown`)});return(0,$.jsx)(Ze,{title:(0,$.jsx)(`span`,{className:d?`opacity-55`:void 0,children:f}),subtitle:p.length>0?p.join(` • `):void 0,onClick:a,showChevron:!1,selected:n,disabled:i,contentAriaLabel:l(`profileRow.openProfileAriaLabel`,{displayName:f}),trailingInteractive:!0,trailing:(0,$.jsxs)($.Fragment,{children:[b==null?null:(0,$.jsx)(h,{content:b,children:v?(0,$.jsx)(`button`,{type:`button`,onClick:a,"aria-label":b,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":b,role:`img`})})}),d?(0,$.jsx)(Ct,{tone:`neutral`,children:l(`profileRow.disabledTag`)}):null,t?(0,$.jsx)(Ct,{tone:`positive`,children:l(`profileRow.defaultTag`)}):null,(0,$.jsxs)(H.Root,{children:[(0,$.jsx)(H.Trigger,{asChild:!0,children:(0,$.jsx)(B,{variant:`ghost`,size:`compact`,iconOnly:(0,$.jsx)(cn,{}),"aria-label":l(`profileRow.actionsAriaLabel`,{displayName:f}),disabled:i})}),(0,$.jsxs)(H.Content,{align:`end`,sideOffset:4,children:[(0,$.jsx)(H.Item,{onSelect:a,children:l(u?`profileRow.view`:`profileRow.edit`)}),!t&&!d&&tt(e.provider,e.model)?(0,$.jsx)(H.Item,{onSelect:o,children:l(`profileRow.makeDefault`)}):null,d?(0,$.jsx)(H.Item,{onSelect:()=>s(!0),children:l(`profileRow.enable`)}):u?null:(0,$.jsx)(H.Item,{onSelect:()=>s(!1),children:l(`profileRow.disable`)}),u?null:(0,$.jsx)(H.Item,{onSelect:c,className:Ot.anchored,children:l(`profileRow.delete`)})]})]})]})})}function Mn(e,t){let n=T(),{data:r}=X({...Me({path:{assistant_id:e}}),enabled:n,staleTime:3e4}),{profiles:i,profileOrder:a}=k(t?.llm,e);return(0,Q.useMemo)(()=>r==null?{entries:mt(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 We(Nn,e)}var Fn=`settings-ai-profile-make-active`,In=`Failed to set the active profile. Please try again.`;function Ln(e){let t=de(),n=Jt(),r=Pn(e),i=It({onSuccess:()=>{n.invalidateQueries({queryKey:ie({path:{assistant_id:e}})}),n.invalidateQueries({queryKey:Rt({path:{assistant_id:e}})})}});async function a(n,r,i){try{await t.mutateAsync({path:{assistant_id:e},body:{llm:n}})}catch(e){throw U(e,{context:r}),A.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=st(e);throw A.error(t??In),t||U(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=st(e);return t?`${/[.!?]$/.test(t)?t:`${t}.`} ${Rn}`:zn}function Vn(e,n,r){let i=Ln(e),a=Jt(),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]),f=(0,Q.useMemo)(()=>mt(u,d),[u,d]),[p,m]=(0,Q.useState)(null),[h,g]=(0,Q.useState)(null),[_,v]=(0,Q.useState)(``),[y,b]=(0,Q.useState)(!1),[x,S]=(0,Q.useState)(null),C=(0,Q.useRef)(!1);function w(e){return f.filter(t=>t.name===e?!1:t.status===`disabled`?!0:vt(t,f,{requireOwnProviderAndModel:o}))}function T(e,t){let n=w(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 E(e){try{await i.deleteProfile(e,d,{isAdvisor:e===c}),r?.onDeleted?.(e)}catch{}}async function D(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({...Ce({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){U(e,{context:`settings-ai-profile-delete-schedule-scan`}),d=!0}if(!(r||i.length>0||o.length>0||c>0)&&!d){await E(t);return}let f={name:t,label:n,isActive:r,callSiteIds:i,scheduleNames:o,deferredReminderCount:c,scheduleLookupFailed:d};m(f),v(T(t,En(f))),g(null)}function O(e){n==null||C.current||(C.current=!0,S(e),D(e).finally(()=>{C.current=!1,S(null)}))}async function k(){if(!p||!_)return;if(b(!0),g(null),En(p))try{await hn(e,p.name,_),await a.invalidateQueries({queryKey:be({path:{assistant_id:e}})})}catch(e){U(e,{context:`settings-ai-profile-reassign-schedules`}),g(Bn(e)),b(!1);return}let t={};if(p.isActive&&(t.activeProfile=_),p.callSiteIds.length>0){let e={};for(let t of p.callSiteIds)e[t]={profile:_};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{g(`Failed to reassign references. Please try again.`),b(!1);return}let n=p.name;m(null),b(!1),E(n)}return{requestDelete:O,pendingDeleteName:x,blockedDeleteModalProps:{blocked:p,availableReplacements:w(p?.name??null),replacement:_,onReplacementChange:v,error:h,saving:y,onClose:()=>{m(null),g(null)},onConfirm:()=>void k()}}}function Hn(){}function Un({assistantId:e,config:t,connections:n,selectedProfileName:r,onOpenProfile:i,onCreateProfile:a,onProfileDeleted:o}){let{t:s}=Z(`settings`),{entries:c}=Mn(e,t),l=Ln(e),u=Vn(e,t,{onDeleted:o}),d=t?.llm?.activeProfile??null;return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(Tn,{title:s(`profilesSection.title`),action:(0,$.jsx)(B,{variant:`primary`,onClick:a,leftIcon:(0,$.jsx)(en,{}),disabled:t==null,children:s(`profilesSection.createProfile`)}),children:t==null?(0,$.jsx)(W,{variant:`body-medium-lighter`,as:`p`,className:`py-4 text-center text-(--content-tertiary)`,children:s(`profilesSection.loading`)}):c.length===0?(0,$.jsx)(W,{variant:`body-medium-lighter`,as:`p`,className:`py-4 text-center text-(--content-tertiary)`,children:s(`profilesSection.emptyState`)}):c.map(e=>(0,$.jsx)(jn,{profile:e,isActiveProfile:e.name===d,selected:e.name===r,connections:n,deletePending:u.pendingDeleteName===e.name,onOpen:()=>i(e.name),onMakeActive:()=>void l.makeActive(e.name).catch(Hn),onSetStatus:t=>void l.setStatus(e.name,t).catch(Hn),onDelete:()=>u.requestDelete(e.name)},e.name))}),(0,$.jsx)(An,{...u.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`?nt(n):Qe(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}=Z(`settings`),l=e.isManaged??!1,u=S(e),d=Gn(e.provider),f=Yn(e),p=n&&!t&&d,m=!l&&a!=null,h=!l&&!t,g=p||m||h;return(0,$.jsx)(Ze,{title:u,subtitle:f.length>0?f:void 0,onClick:a,showChevron:!1,selected:r,contentAriaLabel:a?c(`providerRow.openProviderAriaLabel`,{displayName:u}):void 0,trailingInteractive:!0,trailing:(0,$.jsxs)($.Fragment,{children:[l?(0,$.jsx)(Ct,{tone:`neutral`,title:c(`providerRow.managedTagTitle`),children:c(`providerRow.managedTag`)}):null,t?(0,$.jsx)(Ct,{tone:`info`,title:c(`providerRow.defaultTagTitle`),children:c(`providerRow.defaultTag`)}):null,e.provider===`ollama`?(0,$.jsx)(Ct,{tone:`neutral`,title:c(`providerRow.localTagTitle`),children:c(`providerRow.localTag`)}):null,e.provider===`openai-compatible`?(0,$.jsx)(Ct,{tone:`neutral`,title:c(`providerRow.customTagTitle`),children:c(`providerRow.customTag`)}):null,g?(0,$.jsxs)(H.Root,{children:[(0,$.jsx)(H.Trigger,{asChild:!0,children:(0,$.jsx)(B,{variant:`ghost`,size:`compact`,iconOnly:(0,$.jsx)(cn,{}),"aria-label":c(`providerRow.actionsAriaLabel`,{displayName:u})})}),(0,$.jsxs)(H.Content,{align:`end`,sideOffset:4,children:[m?(0,$.jsx)(H.Item,{onSelect:a,children:c(`providerRow.edit`)}):null,p?(0,$.jsx)(H.Item,{disabled:i,onSelect:o,children:c(`providerRow.setAsDefault`)}):null,h?(0,$.jsx)(H.Item,{onSelect:s,className:Ot.anchored,children:c(`providerRow.delete`)}):null]})]}):(0,$.jsx)(`span`,{className:`inline-block w-8`,"aria-hidden":!0})]})})}function Zn(e,t){let n=Jt(),r={path:{assistant_id:e}},i=qt({...St(),onSuccess:()=>{n.invalidateQueries({queryKey:dt(r)}),n.invalidateQueries({queryKey:ie(r)}),n.invalidateQueries({queryKey:Rt(r)})},onError:e=>{U(e,{context:`settings-ai-set-default-provider`}),A.error(Y(`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 z({path:{assistant_id:e,name:i}});a?.ok||a?.status===404?(n.invalidateQueries({queryKey:f(r)}),t?.onDeleted?.(i)):a?.status===409?A.error(Y(`settings:useProviderActions.deleteInUseToast`)):A.error(Y(`settings:useProviderActions.deleteFailedToast`))}catch(e){U(e,{context:`settings-ai-provider-delete`}),A.error(Y(`settings:useProviderActions.deleteFailedToast`))}}return{setDefault:a,isSettingDefault:o,deleteConnection:s}}function Qn({assistantId:e,selectedConnectionName:t,onOpenConnection:n,onAddProvider:r,onConnectionDeleted:i}){let{t:a}=Z(`settings`),{data:o,isLoading:s,isError:c}=X(le({path:{assistant_id:e}})),l=M(),{data:u}=X({...Et({path:{assistant_id:e}}),enabled:l}),d=l?u?.resolvedConnectionName??null:null,f=Zn(e,{onDeleted:i}),p=(0,Q.useMemo)(()=>{let e=o?.connections??[];return[...e.filter(e=>e.provider===ue),...e.filter(e=>e.provider!==ue)]},[o]);return(0,$.jsx)(Tn,{title:a(`providersSection.title`),action:(0,$.jsx)(B,{variant:`outlined`,onClick:r,leftIcon:(0,$.jsx)(en,{}),children:a(`providersSection.addProvider`)}),children:s?(0,$.jsx)(`div`,{className:`space-y-2 py-2`,children:[1,2,3].map(e=>(0,$.jsx)(oe,{className:`h-10 rounded-lg`},e))}):c?(0,$.jsx)(W,{variant:`body-medium-default`,as:`p`,className:`py-4 text-center text-(--system-negative-strong)`,children:a(`providersSection.loadError`)}):p.length===0?(0,$.jsx)(W,{variant:`body-medium-lighter`,as:`p`,className:`py-4 text-center text-(--content-tertiary)`,children:a(`providersSection.empty`)}):p.map(e=>(0,$.jsx)(Xn,{connection:e,isDefault:e.name===d,supportsDefaultProvider:l,selected:e.name===t,isSettingDefault:f.isSettingDefault(e.name),onOpen:e.isManaged??!1?void 0:()=>n(e.name),onSetDefault:()=>f.setDefault(e),onDelete:()=>void f.deleteConnection(e.name)},e.name))})}function $n({panel:e,onOpenPanel:t,onClosePanel:n}){let{t:r}=Z(`settings`),i=ft(),{data:a}=X({...Te({path:{assistant_id:i}}),staleTime:3e4}),o=M(),{data:s}=X({...Et({path:{assistant_id:i}}),enabled:o}),c=s?.availability,{data:l}=X({...le({path:{assistant_id:i}})}),u=l?.connections,d=a?.llm?.callSites??{},f=Object.entries(d).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)(Be,{tone:c.status===`unknown`?`warning`:`error`,children:c.message??r(`languageModelCard.defaultProviderUnavailable`)}),i&&(0,$.jsx)(Un,{assistantId:i,config:a,connections:u,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:f,action:(0,$.jsx)(B,{variant:`outlined`,onClick:()=>t({kind:`overrides`}),children:r(`languageModelCard.manage`)})})]})})}function er({children:e}){return(0,$.jsxs)(ke,{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)(Kt,{i18nKey:`managedServicesBanner.body`,ns:`common`,components:{link:(0,$.jsx)(er,{})}})})]})}function nr({assistantId:e,profileName:t,onClose:n}){let{t:r}=Z(`settings`),{data:i}=X({...Te({path:{assistant_id:e}}),staleTime:3e4}),{data:a}=X({...le({path:{assistant_id:e}})}),o=a?.connections,s=(0,Q.useMemo)(()=>i?.llm?.profiles??{},[i?.llm?.profiles]),c=Object.keys(s),l=(0,Q.useMemo)(()=>{if(t==null)return;let e=s[t];return e?{name:t,...e}:void 0},[t,s]),u=t==null?`create`:l?.source===`managed`||l?.invariant===!0?`view`:`edit`,{saveProfile:d,isPending:f}=Nt(e,{onSaved:n}),p=b({mode:u,profileName:t??void 0,initialValues:l,existingNames:c,connections:o,assistantId:e,onSave:d}),m=Vn(e,i,{onDeleted:()=>n()}),h=t!=null&&m.pendingDeleteName===t,g=t!=null&&i!=null&&!(t in s);(0,Q.useEffect)(()=>{g&&!p.saving&&!f&&n()},[g,p.saving,f,n]);let _=u===`view`;return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(bt,{title:p.effectiveMode===`create`?r(`profileDetailPanel.createTitle`):l?.label??t??r(`profileDetailPanel.defaultTitle`),closeVariant:`outlined`,onClose:n,headerTrailing:_&&p.effectiveMode!==`create`?(0,$.jsx)(Ct,{tone:`neutral`,children:r(`profileDetailPanel.managedTag`)}):null,headerActions:p.effectiveMode!==`create`&&!p.isReadOnly?(0,$.jsx)(B,{variant:`dangerOutline`,loading:h,iconOnly:(0,$.jsx)(Qt,{}),"aria-label":r(h?`profileDetailPanel.deleting`:`profileDetailPanel.delete`),tooltip:r(`profileDetailPanel.delete`),onClick:()=>{t!=null&&m.requestDelete(t)},disabled:p.saving||h}):null,footer:p.isReadOnly?(0,$.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,$.jsx)(B,{variant:`outlined`,onClick:p.switchToSaveAsNew,disabled:p.saving,children:r(`profileDetailPanel.saveAsNew`)}),p.hasViewModeChanges?(0,$.jsx)(B,{variant:`primary`,onClick:()=>void p.handleSave(),disabled:p.saving,children:p.saving?r(`profileDetailPanel.saving`):r(`profileDetailPanel.save`)}):null]}):(0,$.jsx)(`div`,{className:`flex justify-end`,children:(0,$.jsx)(B,{variant:`primary`,onClick:()=>void p.handleSave(),disabled:p.isInvalid||p.saving,children:p.saving?r(`profileDetailPanel.saving`):p.effectiveMode===`create`?r(`profileDetailPanel.create`):r(`profileDetailPanel.saveChanges`)})}),children:(0,$.jsx)(ee,{editor:p,assistantId:e,connections:o,variant:`panel`})}),(0,$.jsx)(An,{...m.blockedDeleteModalProps})]})}function rr({value:e,profileOptions:t,disabled:n,onChange:r}){let{t:i}=Z(`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)(V,{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:r,domains:i,persistedOverrides:a,orderedProfiles:o,onClose:s,onApplied:c}){let{t:l}=Z(`settings`),u=de(),d=t(),f=(0,Q.useMemo)(()=>({requireOwnProviderAndModel:d,requireTextGeneration:!1}),[d]),p=(0,Q.useMemo)(()=>{let e=new Map;for(let t of r){let n=or(t,a[t.id]);n&&e.set(t.id,n)}return e},[r,a]),m=(0,Q.useMemo)(()=>{let e=new Set(Array.from(p.values(),e=>e.profile));return o.filter(t=>e.has(t.name))},[o,p]),[h,g]=(0,Q.useState)(()=>m[0]?.name??``),[_,v]=(0,Q.useState)(``),[y,b]=(0,Q.useState)(new Set),[x,S]=(0,Q.useState)(!1),C=(0,Q.useMemo)(()=>{let e=new Map(i.map(e=>[e.id,e.displayName]));return t=>e.get(t)??t},[i]),w=(0,Q.useMemo)(()=>r.filter(e=>p.get(e.id)?.profile===h),[r,p,h]),T=(0,Q.useMemo)(()=>w.map(e=>e.id).filter(e=>!y.has(e)),[w,y]),E=(0,Q.useMemo)(()=>m.map(e=>({value:e.name,label:xe(e)})),[m]),D=(0,Q.useMemo)(()=>R(o,[],f).filter(e=>e.name!==h).map(e=>({value:e.name,label:xe(e)})),[o,h,f]),O=it(o,h),k=it(o,_),j=y.size===0;function M(e){g(e),b(new Set),e===_&&v(``)}function N(e,t){b(n=>{let r=new Set(n);return t?r.delete(e):r.add(e),r})}async function P(){if(!(!h||!_||T.length===0)){S(!0);try{let t={};for(let e of T)t[e]={profile:_};await u.mutateAsync({path:{assistant_id:e},body:{llm:{callSites:t}}}),A.success(l(`bulkOverrideSwapModal.successToast`,{count:T.length,targetLabel:k})),c(),s()}catch(e){let t=st(e);A.error(t??l(`bulkOverrideSwapModal.updateFailedToast`)),t||U(e,{context:`settings-ai-bulk-override-swap`})}finally{S(!1)}}}return(0,$.jsx)(G.Root,{open:!0,onOpenChange:e=>{e||s()},children:(0,$.jsxs)(G.Content,{size:`md`,children:[(0,$.jsx)(G.Header,{children:(0,$.jsx)(G.Title,{children:l(`bulkOverrideSwapModal.title`)})}),(0,$.jsxs)(G.Body,{className:`space-y-4`,children:[(0,$.jsx)(W,{variant:`body-medium-default`,as:`p`,children:l(`bulkOverrideSwapModal.intro`)}),(0,$.jsxs)(`div`,{className:`grid grid-cols-2 gap-3`,children:[(0,$.jsx)(V,{id:`bulk-swap-source`,label:l(`bulkOverrideSwapModal.currentlyUsingLabel`),value:h,onChange:M,options:E}),(0,$.jsx)(V,{id:`bulk-swap-target`,label:l(`bulkOverrideSwapModal.changeToLabel`),value:_,onChange:v,options:D,placeholder:l(`bulkOverrideSwapModal.targetPlaceholder`)})]}),(0,$.jsx)(Be,{tone:`info`,title:l(`bulkOverrideSwapModal.noticeTitle`),children:l(`bulkOverrideSwapModal.noticeBody`,{sourceLabel:O})}),(0,$.jsxs)(`div`,{children:[(0,$.jsxs)(`div`,{className:`mb-2 flex items-baseline justify-between gap-2`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(W,{variant:`body-medium-default`,as:`p`,children:l(`bulkOverrideSwapModal.affectedSummary`,{count:w.length,profile:O})}),(0,$.jsx)(W,{variant:`body-small-default`,as:`p`,className:`text-[color:var(--content-secondary)]`,children:l(`bulkOverrideSwapModal.chooseActions`)})]}),(0,$.jsx)(B,{variant:`ghost`,onClick:()=>b(j?new Set(w.map(e=>e.id)):new Set),children:l(j?`bulkOverrideSwapModal.clearAll`:`bulkOverrideSwapModal.selectAll`)})]}),(0,$.jsx)(`div`,{className:`max-h-72 space-y-1 overflow-y-auto`,children:w.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)(n,{checked:!y.has(e.id),onCheckedChange:t=>N(e.id,t===!0),disabled:x,label:e.displayName,helperText:C(e.domain)}),(0,$.jsx)(`span`,{className:`shrink-0 text-body-small-default text-[color:var(--content-tertiary)]`,children:p.get(e.id)?.via===`override`?l(`bulkOverrideSwapModal.viaOverride`):l(`bulkOverrideSwapModal.viaDefault`)})]},e.id))})]})]}),(0,$.jsxs)(G.Footer,{children:[(0,$.jsx)(W,{variant:`body-small-default`,as:`p`,className:`mr-auto self-center text-[color:var(--content-secondary)]`,children:l(`bulkOverrideSwapModal.willChange`,{count:T.length})}),(0,$.jsx)(B,{variant:`ghost`,onClick:s,disabled:x,children:l(`bulkOverrideSwapModal.cancel`)}),(0,$.jsx)(B,{variant:`primary`,loading:x,disabled:!h||!_||T.length===0||x,onClick:()=>void P(),children:l(`bulkOverrideSwapModal.applyTo`,{count:T.length})})]})]})})}function lr({id:e,displayName:t,description:n,defaultProfileLabel:r,draft:o,profileOptions:s,connections:l,onDraftChange:d,onToggle:f}){let{t:p}=Z(`settings`),m=L({hostedInference:$e.use.vellumHostedInference()}),h=ar(o),_=!o||!h?``:o.provider||o.model?ir:o.profile??``,v=_===ir,b=ge(),x=Gt(),S=(l??[]).some(e=>e.provider===u),C=[...Mt,...S?[u]:[]],w=b[0]??Mt[0],T=o?.provider,E=y(T)?T:T===`chatgpt`?u:void 0,D=E!==void 0&&C.some(e=>e===E),O=E??w,k=a(O,``,(l??[]).filter(e=>c(e.provider,O)))?nt(O):F(O,m),A=k.map(e=>({value:e.id,label:e.displayName})),j=typeof o?.model==`string`?o.model:``;if(j&&!k.some(e=>e.id===j)){let e=Qe(O).find(e=>e.id===j)?.displayName??j;A.push({value:j,label:p(`callSiteOverridesRow.unavailableOption`,{name:e})})}let M=!!o?.provider&&!o?.model,N=[...C.map(e=>({value:e,label:g[e]??e,...x(e)})),...E&&!D?[{value:E,label:p(`callSiteOverridesRow.unavailableOption`,{name:g[E]??E})}]:[]];function P(t){t===`__custom__`?d(e,{profile:null,provider:w,model:i(w)??``}):t===``?d(e,null):d(e,{profile:t,provider:null,model:null})}function I(t){let n=i(t)??``;d(e,{...o??{},profile:null,provider:t,model:n})}function ee(t){d(e,{...o??{},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:p(`callSiteOverridesRow.defaultProfileSuffix`,{label:r})})]})]}),(0,$.jsx)(Le,{checked:h,onChange:t=>f(e,t),"aria-label":p(`callSiteOverridesRow.overrideAriaLabel`,{displayName:t}),className:`shrink-0`})]}),h&&(0,$.jsx)(`div`,{className:`mt-3`,children:(0,$.jsx)(V,{value:_,onChange:P,options:s,className:`w-44`,menuMinWidth:280,menuAlign:`start`})}),h&&v&&(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:p(`callSiteOverridesRow.providerLabel`)}),(0,$.jsx)(V,{value:O??``,onChange:I,options:N})]}),(0,$.jsxs)(`div`,{className:`flex-1`,children:[(0,$.jsx)(`label`,{className:`mb-1 block text-body-small-default text-[var(--content-tertiary)]`,children:p(`callSiteOverridesRow.modelLabel`)}),(0,$.jsx)(V,{value:o?.model??``,onChange:ee,options:A})]})]}),M&&(0,$.jsx)(`p`,{className:`text-body-small-default text-[var(--system-negative-strong)]`,children:p(`callSiteOverridesRow.pickModelError`)})]})]})}function ur({groups:e,drafts:t,buildProfileOptionsForRow:n,profileLabelFor:r,advisorMatchesSearch:i,connections:a,onDraftChange:o,onToggle:s}){let{t:c}=Z(`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}=Z(`settings`),{data:a}=X({...Te({path:{assistant_id:e}}),staleTime:3e4}),o=(0,Q.useMemo)(()=>a?.llm?.profiles??{},[a?.llm?.profiles]),s=(0,Q.useMemo)(()=>a?.llm?.profileOrder??[],[a?.llm?.profileOrder]),c=(0,Q.useMemo)(()=>a?.llm?.callSites??{},[a?.llm?.callSites]),l=(0,Q.useMemo)(()=>mt(o,s),[o,s]),u=ge(),d=t(),f=(0,Q.useMemo)(()=>({requireOwnProviderAndModel:d}),[d]),p=(0,Q.useMemo)(()=>({requireOwnProviderAndModel:d,requireTextGeneration:!1}),[d]),m=de(),[h,g]=(0,Q.useState)(``),[_,v]=(0,Q.useState)(!1),[y,b]=(0,Q.useState)(!1),[S,C]=(0,Q.useState)(!1),{data:w,isLoading:T,isError:E,refetch:O}=X({...ze({path:{assistant_id:e}}),enabled:!!e,staleTime:6e4,refetchOnWindowFocus:!1}),{data:k}=X({...le({path:{assistant_id:e}}),enabled:!!e}),j=(0,Q.useMemo)(()=>(w?.callSites??[]).filter(e=>e.id!==`mainAgent`),[w]),M=!T&&!E&&!!w,N=!!a,P=M&&N,F=(0,Q.useMemo)(()=>j.map(e=>e.id),[j]),I=a?.llm?.advisorProfile??``,{drafts:L,advisorProfile:ee,advisorDirty:te,callSiteDraftsDirty:ne,hasUnsavedDrafts:re,hasValidationError:ie,setDraft:ae,setAdvisor:oe,clearEdits:se,buildSavePatch:ce,buildResetPatch:z}=pr({catalogCallSiteIds:F,persistedOverrides:c,persistedAdvisor:I,isSeeded:P}),ue=(0,Q.useMemo)(()=>new Set(F),[F]),fe=(0,Q.useCallback)(e=>it(l,e),[l]),V=(0,Q.useCallback)((e,t)=>({value:e.name,label:xe(e),...D(e,l,t)===`undispatchable`?{icon:(0,$.jsx)(tn,{className:`h-3.5 w-3.5 text-[var(--system-mid-strong)]`}),tooltip:we(e)}:{}}),[l]),pe=(0,Q.useMemo)(()=>R(l,[I],f).map(e=>V(e,f)),[l,I,V,f]),me=(0,Q.useMemo)(()=>{let e=h.trim().toLowerCase();return e===``||`advisor`.includes(e)||`second opinion`.includes(e)},[h]),he=(0,Q.useMemo)(()=>j.some(e=>or(e,c[e.id])!==null),[j,c]),_e=(0,Q.useMemo)(()=>Object.entries(c).some(([e,t])=>ue.has(e)&&(t?.profile!=null||t?.provider!=null||t?.model!=null)),[c,ue]),ve=(0,Q.useCallback)(e=>[...R(l,[e],p).map(e=>V(e,p)),{value:ir,label:r(`overridesDetailPanel.customProfileOption`)}],[l,V,p,r]),be=(0,Q.useMemo)(()=>{if(!h.trim())return j;let e=h.toLowerCase();return j.filter(t=>(t.displayName??``).toLowerCase().includes(e)||(t.description??``).toLowerCase().includes(e)||(t.domain??``).toLowerCase().includes(e))},[j,h]),Ce=(0,Q.useMemo)(()=>{if(!w)return[];let e=w.domains.map(e=>e.id),t=new Map(w.domains.map(e=>[e.id,e])),n=[];for(let r of e){let e=be.filter(e=>e.domain===r);e.length>0&&n.push({domain:t.get(r),sites:e})}let i=new Set(e),a=be.filter(e=>!i.has(e.domain));return a.length>0&&n.push({domain:{id:`other`,displayName:r(`overridesDetailPanel.otherDomain`)},sites:a}),n},[w,be,r]),Ee=(0,Q.useCallback)((e,t)=>{if(!t){ae(e,null);return}let n=ye(l,j.find(t=>t.id===e)?.defaultProfile,p);if(n)ae(e,{profile:n});else{let t=u[0]??Mt[0];ae(e,{provider:t,model:i(t)??``})}},[j,l,u,ae,p]),De=(0,Q.useCallback)(async()=>{v(!0);try{let t=ce();await m.mutateAsync({path:{assistant_id:e},body:{llm:{...ne?{callSites:t}:{},...te?{advisorProfile:ee}:{}}}}),n(),A.success(r(`overridesDetailPanel.overridesSavedToast`))}catch(e){A.error(r(`overridesDetailPanel.saveFailedToast`)),U(e,{context:`call_site_overrides_save`})}finally{v(!1)}},[ce,ne,te,ee,n,m,e,r]),Oe=(0,Q.useCallback)(async()=>{v(!0);try{let t=z();await m.mutateAsync({path:{assistant_id:e},body:{llm:{callSites:t}}}),n(),A.success(r(`overridesDetailPanel.overridesResetToast`))}catch(e){A.error(r(`overridesDetailPanel.resetFailedToast`)),U(e,{context:`call_site_overrides_reset`})}finally{v(!1)}},[z,n,m,e,r]),ke=(0,$.jsxs)(`div`,{className:`flex items-center justify-end gap-2`,children:[_e&&(0,$.jsx)(B,{variant:`outlined`,onClick:()=>b(!0),disabled:_||!P,tintColor:`var(--system-negative-strong)`,className:`mr-auto`,children:r(`overridesDetailPanel.resetToDefaults`)}),(0,$.jsx)(B,{variant:`primary`,onClick:()=>void De(),loading:_,disabled:!re||ie||_,children:r(`overridesDetailPanel.save`)})]});return(0,$.jsxs)(bt,{title:r(`overridesDetailPanel.title`),closeVariant:`outlined`,onClose:n,footer:ke,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)(K,{type:`search`,value:h,onChange:e=>g(e.target.value),placeholder:r(`overridesDetailPanel.searchPlaceholder`),leftIcon:(0,$.jsx)(sn,{className:`h-4 w-4`}),fullWidth:!0})}),(0,$.jsx)(B,{variant:`outlined`,onClick:()=>C(!0),disabled:!P||_||re||!he,title:re?r(`overridesDetailPanel.bulkChangeUnsavedTitle`):he?void 0:r(`overridesDetailPanel.bulkChangeNoCandidatesTitle`),children:r(`overridesDetailPanel.bulkChange`)})]}),N&&me&&(0,$.jsxs)(`div`,{children:[(0,$.jsx)(pn,{children:r(`overridesDetailPanel.advisorSection`)}),(0,$.jsx)(rr,{value:ee,profileOptions:pe,disabled:_,onChange:oe})]}),T&&(0,$.jsx)(Se,{placement:`panel`}),E&&(0,$.jsx)(Be,{tone:`error`,title:r(`overridesDetailPanel.loadErrorTitle`),actions:(0,$.jsx)(B,{variant:`outlined`,onClick:()=>void O(),children:r(`overridesDetailPanel.retry`)}),children:r(`overridesDetailPanel.loadErrorHint`)}),!T&&!E&&w&&(0,$.jsx)(ur,{groups:Ce,drafts:L,buildProfileOptionsForRow:ve,profileLabelFor:fe,advisorMatchesSearch:me,connections:k?.connections,onDraftChange:ae,onToggle:Ee})]})]}),S&&w&&(0,$.jsx)(cr,{assistantId:e,callSites:j,domains:w.domains,persistedOverrides:c,orderedProfiles:l,onClose:()=>C(!1),onApplied:se}),(0,$.jsx)(x,{open:y,title:r(`overridesDetailPanel.resetToDefaults`),message:r(`overridesDetailPanel.resetConfirmMessage`),confirmLabel:r(`overridesDetailPanel.resetToDefaults`),destructive:!0,onConfirm:()=>{b(!1),Oe()},onCancel:()=>b(!1)})]})}var hr=e(Yt(),1);function gr({mode:e,connection:t,assistantId:n,existingNames:r,connections:i,variant:a=`modal`,actionsSlot:o,onSave:c,onCancel:l}){let{t:u}=Z(`settings`),[d,f]=(0,Q.useState)(t?.label??``),p=t?.name??``,h=t?.provider??`anthropic`,g=t?.auth.type??`api_key`,[_,v]=(0,Q.useState)(()=>t?.auth.type===`api_key`?t.auth.credential:t?``:`credential/anthropic/api_key`),[y,b]=(0,Q.useState)(t?.baseUrl??``),[x,T]=(0,Q.useState)(()=>t?.models?t.models.map(e=>e.id).join(`, `):``),[E,D]=(0,Q.useState)(!1),[k,A]=(0,Q.useState)(null),M=h===`openai-compatible`,N=ve(h),P=j(h),[F,L]=(0,Q.useState)(``),[ee,te]=(0,Q.useState)(!1),R=Jt(),ie=(0,Q.useMemo)(()=>me(_),[_]),ae=g===`api_key`&&ie!==null,{hasStoredCredential:oe,isLoading:se}=ne({assistantId:n,credentialKind:`credential`,credentialName:ie?`${ie.service}:${ie.field}`:``,enabled:ae}),{credentials:ce}=s({assistantId:n,enabled:g===`api_key`});(0,Q.useEffect)(()=>{let e=t?.provider??`anthropic`;f(t?.label??``),t?.auth.type===`api_key`?v(t.auth.credential):v(t?``:`credential/${e}/api_key`),A(null),b(t?.baseUrl??``),T(t?.models?t.models.map(e=>e.id).join(`, `):``),L(``),te(!1)},[t]);let le=d.trim()!==(t?.label??``).trim(),z=M&&le?_e(d,i,t?.name):null,ue=p.trim().length>0&&z===null;async function de(){if(ue){D(!0),A(null);try{let e;if(g===`api_key`){let t=_.trim()||`credential/${h}/api_key`,r=F.trim();if(r){te(!0);try{let e=me(t);await pt({path:{assistant_id:n},body:e?{type:`credential`,name:`${e.service}:${e.field}`,value:r}:{type:`api_key`,name:h,value:r},throwOnError:!0});let i=I(n,`credential`,e?`${e.service}:${e.field}`:``);R.setQueryData(i,!0),R.invalidateQueries({queryKey:Ee({path:{assistant_id:n}})})}catch{A(u(`providerEditorContent.failedSaveApiKey`));return}finally{te(!1)}}e={type:`api_key`,credential:t}}else if(t)e=t.auth;else{A(u(`providerEditorContent.nothingToEdit`));return}let r=d.trim()||null,i={auth:e,label:r,...N&&{base_url:y.trim()||null},...P&&{models:x.trim()?x.split(`,`).map(e=>({id:e.trim()})).filter(e=>e.id):null}},{data:a,error:o,response:s}=await m({path:{assistant_id:n,name:t?.name??p.trim()},body:i});if(!s?.ok){A(yt(s?.status,o)??w(s?.status));return}if(!a){A(u(`providerEditorContent.emptyServerResponse`));return}O(a,u),c(a)}catch{A(u(`providerEditorContent.failedSaveProvider`))}finally{D(!1)}}}let fe=ce.filter(e=>e.service===h),V=e!==`create`&&t?.auth.type===`api_key`,ge=fe.length>0||V,ye=he(u(`providerEditorContent.apiKeyPlaceholder`),oe);if(e===`create`)return(0,$.jsx)(Wt,{variant:a===`panel`?`inline`:`modal`,actionsSlot:o,assistantId:n,existingNames:r,connections:i,defaultProviderType:h,onCreated:c,onCancel:l});let be=(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)(Kt,{i18nKey:`providerEditorContent.displayNameLabel`,ns:`settings`,components:{optional:(0,$.jsx)(`span`,{className:`text-[var(--content-disabled)]`})}})}),(0,$.jsx)(K,{value:d,onChange:e=>f(e.target.value),placeholder:u(`providerEditorContent.displayNamePlaceholder`),fullWidth:!0}),z?(0,$.jsx)(W,{variant:`body-small-default`,as:`p`,className:`text-(--system-negative-strong)`,children:pe[z]}):null]}),N&&(0,$.jsxs)(`div`,{className:`space-y-1`,children:[(0,$.jsx)(`label`,{className:`block text-body-small-default text-[var(--content-tertiary)]`,children:u(`providerEditorContent.baseUrlLabel`)}),(0,$.jsx)(K,{value:y,onChange:e=>b(e.target.value),placeholder:u(h===`ollama`?`providerEditorContent.baseUrlPlaceholderOllama`:h===`opencode`?`providerEditorContent.baseUrlPlaceholderOpencode`:`providerEditorContent.baseUrlPlaceholder`),fullWidth:!0}),h===`ollama`?(0,$.jsx)(W,{variant:`body-small-default`,as:`p`,className:`text-[var(--content-tertiary)]`,children:u(`providerEditorContent.baseUrlHintOllama`)}):null,h===`opencode`?(0,$.jsx)(W,{variant:`body-small-default`,as:`p`,className:`text-[var(--content-tertiary)]`,children:u(`providerEditorContent.baseUrlHintOpencode`)}):null]}),P&&(0,$.jsxs)(`div`,{className:`space-y-1`,children:[(0,$.jsx)(`label`,{className:`block text-body-small-default text-[var(--content-tertiary)]`,children:u(`providerEditorContent.modelsLabel`)}),(0,$.jsx)(K,{value:x,onChange:e=>T(e.target.value),placeholder:u(`providerEditorContent.modelsPlaceholder`),fullWidth:!0}),(0,$.jsx)(W,{variant:`body-small-default`,as:`p`,className:`text-[var(--content-tertiary)]`,children:u(`providerEditorContent.modelsHint`)})]}),g===`api_key`&&(0,$.jsx)(C,{apiKeyValue:F,onApiKeyChange:L,credential:_,onCredentialChange:v,isLoadingCredential:se,apiKeyPlaceholder:ye,provider:h,providerCredentials:fe,showAdvancedSection:ge,onError:A}),g===`oauth_subscription`&&(0,$.jsx)(re,{assistantId:n,onConnected:c}),k&&(0,$.jsx)(W,{variant:`body-small-default`,as:`p`,className:`text-(--system-negative-strong)`,children:k})]}),xe=(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(B,{variant:`ghost`,onClick:l,children:u(`providerEditorContent.cancel`)}),(0,$.jsx)(B,{variant:`primary`,disabled:!ue||E||ee,onClick:()=>void de(),children:u(E?`providerEditorContent.saving`:`providerEditorContent.saveChanges`)})]});return a===`panel`?(0,$.jsxs)(`div`,{className:`space-y-4`,children:[be,o===void 0?(0,$.jsx)(`div`,{className:`flex justify-end gap-2`,children:xe}):o&&(0,hr.createPortal)(xe,o)]}):(0,$.jsxs)(G.Content,{size:`md`,children:[(0,$.jsxs)(G.Header,{children:[(0,$.jsx)(G.Title,{children:u(`providerEditorContent.editProviderTitle`)}),(0,$.jsx)(G.Description,{children:t?u(`providerEditorContent.editingConnection`,{name:S(t)}):u(`providerEditorContent.editProviderSettingsFallback`)})]}),(0,$.jsx)(G.Body,{children:be}),(0,$.jsx)(G.Footer,{children:xe})]})}function _r({assistantId:e,connectionName:t,onClose:n}){let{t:r}=Z(`settings`),i=Jt(),[a,o]=(0,Q.useState)(null),{data:s,isLoading:c}=X(le({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 p(){i.invalidateQueries({queryKey:f({path:{assistant_id:e}})}),i.invalidateQueries({queryKey:dt({path:{assistant_id:e}})}),n()}return(0,$.jsx)(bt,{title:u?S(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)(Se,{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:p,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=ft(),a=e??i,s=P(),c=Jt(),{t:l}=Z(),u=(0,Q.useMemo)(()=>o(Re(),{displayName:l(`sttProviderForm.windowsNativeDisplayName`),subtitle:l(`sttProviderForm.windowsNativeSubtitle`),setupWarning:l(`sttProviderForm.windowsNativeSetupWarning`)}).filter(e=>!e.requiresNativeDictation||et()),[l]),d=br,{data:f}=X({...Te({path:{assistant_id:a}}),enabled:s,staleTime:3e4}),p=f?.services?.stt,m=p?.mode===`managed`?`vellum`:p?.provider,h=(0,Q.useMemo)(()=>{let e=m?yr[m]:void 0;if(e&&u.some(t=>t.id===e))return e;let t=q(Je,d);return u.some(e=>e.id===t)?t:d},[m,u,d]),g=!!m,[_,v]=yn(h),{available:y,currentCode:b,configuredProviderId:x,selectLanguage:S,selecting:C}=Xe(a),[w,T]=(0,Q.useState)(!1),E=y&&_===h&&(vr[_]?.provider===x||!!m&&!yr[m]),[D,O]=(0,Q.useState)(``),[k,j]=(0,Q.useState)(!1),[M,N]=(0,Q.useState)(!1);(0,Q.useEffect)(()=>{let e=q(Je,d);e===`macos-native`&&!u.some(t=>t.id===e)&&J(Je,d)},[u,d]);let F=(0,Q.useMemo)(()=>u.find(e=>e.id===_)??u[0],[u,_]),I=F.apiKeyPlaceholder!==void 0;(0,Q.useEffect)(()=>{j(q(ut+_,``).length>0),O(``)},[_]);let L=(0,Q.useMemo)(()=>{let e=_!==h,t=D.trim().length>0;return e||t},[_,h,D]),ee=(0,Q.useCallback)(async()=>{let e=D.trim();J(Je,_),e.length>0&&J(ut+_,e);let t=vr[_];N(!0);try{if(t?.credentialService){let n=e.length>0?e:q(ut+_,``);if(n.length>0){let{response:e}=await jt({path:{assistant_id:a},body:{service:t.credentialService,field:`api_key`,value:n,label:`${F.displayName} API Key`},throwOnError:!1});if(!e?.ok)throw Error(`Failed to store API key (HTTP ${e?.status??`?`})`)}}if(t&&(_!==h||!g)||m===`vellum`&&_!==`vellum`){let e=t?.provider??br,{response:n}=await ot({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&&j(!0),O(``),c.invalidateQueries({queryKey:ie({path:{assistant_id:a}})}),A.success(l(`sttProviderForm.saveSuccess`)),!0}catch(e){return A.error(e instanceof Error?e.message:l(`sttProviderForm.saveFailed`)),!1}finally{N(!1)}},[a,_,D,F,h,g,m,c,l]);(0,Q.useEffect)(()=>{r?.({hasChanges:L,saving:M,save:ee})},[r,L,M,ee]);let te=(0,Q.useCallback)(()=>{J(ut+_,``),j(!1),O(``)},[_]),ne=k?l(`sttProviderForm.apiKeyPlaceholderReplace`):F.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:l(`sttProviderForm.providerLabel`)}),(0,$.jsx)(V,{value:_,onChange:v,options:u.map(e=>({value:e.id,label:e.displayName})),"aria-label":l(`sttProviderForm.providerAriaLabel`)})]}),E&&(0,$.jsxs)(`div`,{className:`space-y-1`,children:[(0,$.jsx)(`label`,{className:`block text-body-small-default text-[var(--content-tertiary)]`,children:l(`sttProviderForm.spokenLanguage`)}),(0,$.jsx)(Tt,{"aria-label":l(`sttProviderForm.spokenLanguage`),"aria-haspopup":`dialog`,onClick:()=>T(!0),value:ht(b,x)}),(0,$.jsx)(`p`,{className:`text-body-small-default text-[var(--content-tertiary)]`,children:l(`sttProviderForm.spokenLanguageApplies`)}),(0,$.jsx)(_n,{open:w,onOpenChange:T,title:l(`sttProviderForm.spokenLanguage`),currentCode:b,configuredProviderId:x,selectLanguage:S,selecting:C})]}),I&&(0,$.jsxs)(`div`,{className:`space-y-1`,children:[(0,$.jsx)(`label`,{className:`block text-body-small-default text-[var(--content-tertiary)]`,children:l(`sttProviderForm.apiKeyLabel`)}),(0,$.jsx)(K,{type:`password`,value:D,onChange:e=>O(e.target.value),placeholder:ne,fullWidth:!0})]}),F.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:F.setupWarning})]}),!n&&F.credentialsGuide&&(0,$.jsx)(fn,{guide:F.credentialsGuide}),_===`vellum`&&(0,$.jsx)(`p`,{className:`text-body-medium-lighter text-[var(--content-tertiary)]`,children:l(`sttProviderForm.vellumTranscription`)}),(!t||k)&&(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[!t&&(0,$.jsx)(dn,{onClick:ee,disabled:!L||M}),k&&(0,$.jsx)(un,{onClick:te})]})]})}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}=Z(`settings`),n=Jt(),r=P(),[i,a]=(0,Q.useState)(null),{data:o}=X({...Te({path:{assistant_id:e}}),enabled:r,staleTime:3e4}),s=o?.services?.stt,c=Cr(s),{data:l}=X({...Fe({path:{assistant_id:e}}),enabled:r&&c.length>0,staleTime:5*6e4});if(c.length===0)return null;let u=e=>l?.providers?.find(t=>t.id===e)?.displayName??e,d=async r=>{a(r);try{let{response:t}=await ot({path:{assistant_id:e},body:{services:{stt:{roles:{[r]:null}}}},throwOnError:!1});if(!t?.ok)throw Error(String(t?.status??``));await n.invalidateQueries({queryKey:ie({path:{assistant_id:e}})})}catch{A.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?`${u(e.provider)} · ${e.model}`:u(e.provider)}),(0,$.jsx)(B,{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 d(e.role),children:t(`sttRoleOverrides.clear`)})]},e.role)})})]})}function Tr(){let{t:e}=Z(`settings`),t=ft();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}=Z(),[a,o]=(0,Q.useState)(!1),{voices:s}=ce(e);if(s.length===0)return null;let c=s.find(e=>e.model===t)??s[0];return(0,$.jsxs)(xt.Root,{open:a,onOpenChange:o,children:[(0,$.jsx)(xt.Trigger,{asChild:!0,children:(0,$.jsx)(Tt,{"aria-label":i(`voicePickerField.ariaLabel`),value:c?Lt(c.description):i(`voicePickerField.selectVoice`),className:r})}),(0,$.jsx)(xt.Content,{side:`bottom`,align:`start`,className:`w-[var(--radix-popover-trigger-width)] p-1`,children:(0,$.jsx)(ae,{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}=Z(),a=ft(),o=e??a,s=E.use.name()??`your assistant`,c=P(),l=Jt(),{data:u}=X({...at({path:{assistant_id:o}}),enabled:c,staleTime:1/0}),f=(0,Q.useMemo)(()=>{let e=u?.providers;if(!e)return v;if(e.some(e=>e.id===`vellum`))return e;let t=v.find(e=>e.id===`vellum`);return t?[t,...e]:e},[u]),{data:p}=X({...Te({path:{assistant_id:o}}),enabled:c,staleTime:3e4}),m=p?.services?.tts,h=m?.mode===`managed`?`vellum`:m?.provider,g=`elevenlabs`,_=(0,Q.useMemo)(()=>h??q(`vellum:voice:ttsProvider`,g),[h,g]),y=!!h,[b,x]=yn(_),[S,C]=(0,Q.useState)(``),[w,T]=(0,Q.useState)(``),[D,O]=(0,Q.useState)(``),[k,j]=(0,Q.useState)(!1),[M,N]=(0,Q.useState)(!1),[F,I]=(0,Q.useState)(!1),{voices:L,defaultModel:ee,fetched:te}=d(o,{enabled:b===`vellum`}),ne=m?.providers?.vellum?.model??ee??``,[R,re]=yn(ne),ae=L.find(e=>e.model===R)??L[0],[oe,se]=(0,Q.useState)(null),ce=L.some(e=>e.model===ne),le=oe??(te&&ne!==``&&!ce),z=(0,Q.useMemo)(()=>f.find(e=>e.id===b)??f[0],[b,f]),ue=b===`vellum`&&z.supportsVoiceSelection&&R.trim()!==``&&R.trim()!==ne,de=(0,Q.useCallback)(e=>{let t=q(Ge+e,``),n=q(At+e,``);j(t.length>0),T(n),O(n),C(``)},[]);(0,Q.useEffect)(()=>{de(b)},[b,de]);let fe=(0,Q.useMemo)(()=>{let e=b!==_,t=S.trim().length>0,n=w.trim()!==D;return e||t||n||ue},[b,_,S,w,D,ue]),pe=(0,Q.useCallback)(async()=>{let e=S.trim(),t=w.trim(),n=z.id;J(Oe,n),e.length>0&&J(Ge+n,e),J(At+n,t);let r=e.length>0?e:q(Ge+n,``),a=jr[n];I(!0);try{if(r.length>0){let{response:e}=await jt({path:{assistant_id:o},body:{service:n,field:`api_key`,value:r,label:`${z.displayName} API Key`},throwOnError:!1});if(!e?.ok)throw Error(`Failed to store API key (HTTP ${e?.status??`?`})`)}let e={...b!==_||!y?{provider:n,mode:n===`vellum`?`managed`:`your-own`}:{},...a?{providers:{[n]:{[a]:t}}}:{},...ue?{providers:{vellum:{model:R.trim()}}}:{}};if(Object.keys(e).length>0){let{response:t}=await ot({path:{assistant_id:o},body:{services:{tts:e}},throwOnError:!1});if(!t?.ok)throw Error(`Failed to save configuration (HTTP ${t?.status??`?`})`)}return j(r.length>0),O(t),C(``),l.invalidateQueries({queryKey:ie({path:{assistant_id:o}})}),A.success(i(`ttsProviderForm.saved`)),!0}catch(e){return A.error(e instanceof Error?e.message:i(`ttsProviderForm.saveFailed`)),!1}finally{I(!1)}},[o,b,R,ue,S,w,z,_,y,l,i]);(0,Q.useEffect)(()=>{r?.({hasChanges:fe,saving:F,save:pe})},[r,fe,F,pe]);let me=(0,Q.useCallback)(()=>{J(Ge+b,``),j(!1),C(``)},[b]),he=(0,Q.useCallback)(async()=>{N(!0);try{let e=q(Ge+b,``),t=S.trim(),n=t.length>0?t:e;if(n.length===0){A.error(i(`ttsProviderForm.apiKeyRequired`));return}let r=q(At+b,``),a=w.trim(),o=await Er({provider:b,apiKey:n,voiceId:a.length>0?a:r,text:`Hey! It's ${s}. How does this sound?`});if(o.kind!==`audio`){A.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,S,b,w,i]),ge=k?`•••••••• (Enter a new key to replace)`:z.apiKeyPlaceholder,_e=b===`vellum`,ve=_e&&z.supportsVoiceSelection,ye=(0,$.jsxs)(B,{variant:`link`,size:`compact`,className:`inline-flex h-auto items-center gap-1 px-0 underline [--vbtn-fg:var(--content-tertiary)]`,onClick:()=>{se(!1),L.some(e=>e.model===R)||re(ee||L[0]?.model||``)},children:[(0,$.jsx)(nn,{className:`h-3.5 w-3.5`,"aria-hidden":!0}),i(`ttsProviderForm.chooseFromCatalog`)]}),be=ve&&le&&L.length>0?ye: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)(V,{value:b,onChange:x,options:f.map(e=>({value:e.id,label:e.displayName})),"aria-label":i(`ttsProviderForm.providerAriaLabel`)})]}),!_e&&(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)(K,{type:`password`,value:S,onChange:e=>C(e.target.value),placeholder:ge,fullWidth:!0})]}),ve&&(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`)}),le?(0,$.jsx)(K,{type:`text`,value:R,onChange:e=>re(e.target.value),placeholder:i(`ttsProviderForm.voiceIdPlaceholder`),"aria-label":i(`ttsProviderForm.customVoiceIdAriaLabel`),fullWidth:!0}):ae?(0,$.jsx)(Ar,{assistantId:o,value:R,onChange:re}):te&&(0,$.jsx)(`p`,{className:`text-body-small-default text-[var(--content-tertiary)]`,children:i(`ttsProviderForm.noManagedVoices`)})]}),z.supportsVoiceSelection&&!_e&&(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)(K,{type:`text`,value:w,onChange:e=>T(e.target.value),placeholder:i(`ttsProviderForm.voiceIdPlaceholder`),fullWidth:!0})]}),!n&&!_e&&(0,$.jsx)(fn,{guide:z.credentialsGuide}),(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[!_e&&(0,$.jsx)(B,{variant:`outlined`,onClick:he,disabled:M,children:i(M?`ttsProviderForm.testing`:`ttsProviderForm.test`)}),(0,$.jsxs)(`div`,{className:`flex items-center gap-3`,children:[be,!t&&(0,$.jsx)(dn,{onClick:pe,disabled:!fe||F}),k&&!_e&&(0,$.jsx)(un,{onClick:me})]})]})]})}function Nr(){let{t:e}=Z(`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}=Z(`settings`),t=ft(),n=Jt(),{data:i}=X({...Te({path:{assistant_id:t}}),staleTime:3e4}),a=lt({onSuccess:e=>{r(n,{path:{assistant_id:t}},e)}}),o=vn(),s=(0,Q.useMemo)(()=>i?i.services?.[`web-fetch`]?.provider||q(`vellum:ai:webFetchProvider`,Pr):q(Ut,Pr),[i]),c=(0,Q.useMemo)(()=>i?.services?.[`web-fetch`]?.apiBase??``,[i]),[l,u]=(0,Q.useState)(!1),[d,f]=yn(s),[p,m]=yn(c),[h,g]=(0,Q.useState)(``),_=De.has(d),v=kt.has(d),{hasStoredCredential:y}=ne({assistantId:t,credentialKind:`api_key`,credentialName:d,enabled:v}),b=h.trim().length>0,x=p.trim(),S=Ye(d,_&&x.length>0),C=d!==s||_&&x!==c.trim(),w=l||v&&!S&&!y&&!b||!C&&!b,T=he(se[d]??e(`webFetchCard.apiKeyPlaceholder`),y),E=Vt[d]??``,D=(0,Q.useCallback)(async()=>{u(!0);let r=h.trim(),i=v&&r.length>0;try{i&&await o(d,r),await a.mutateAsync({path:{assistant_id:t},body:{services:{"web-fetch":{provider:d,..._?{apiBase:x}:{}}}}}).catch(t=>{throw A.error(e(`webFetchCard.configUpdateFailedToast`)),U(t,{context:`patch_daemon_config`}),t})}catch{u(!1);return}u(!1);try{if(J(Ut,d),i){let e=wt(d);e&&J(e,r);let i=I(t,`api_key`,d);n.setQueryData(i,!0),n.invalidateQueries({queryKey:i}),g(``)}A.success(e(`webFetchCard.savedToast`))}catch(t){U(t,{context:`settings-ai-web-fetch-persist-local`}),A.error(e(`webFetchCard.localPreferencesFailedToast`))}},[v,a,o,n,t,h,d,_,x,e]),O=(0,Q.useCallback)(()=>{let e=wt(d);e&&Bt(e),g(``),m(``),f(Pr),J(Ut,Pr)},[d,f,m]);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)(V,{value:d,onChange:f,options:Ft.map(e=>({value:e,label:je[e]??e}))})]}),_&&(0,$.jsxs)(`div`,{className:`space-y-1`,children:[(0,$.jsx)(K,{label:e(`webFetchCard.apiBaseLabel`),type:`url`,value:p,onChange:e=>m(e.target.value),placeholder:E||e(`webFetchCard.apiBasePlaceholder`),fullWidth:!0}),E?(0,$.jsx)(`p`,{className:`text-body-small-lighter text-[var(--content-tertiary)]`,children:e(`webFetchCard.apiBaseHint`,{defaultBase:E})}):null]}),v&&(0,$.jsx)(K,{label:e(`webFetchCard.apiKeyLabel`),type:`password`,value:h,onChange:e=>g(e.target.value),placeholder:T,fullWidth:!0}),(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(dn,{onClick:D,disabled:w}),l&&(0,$.jsx)(rn,{className:`h-4 w-4 animate-spin text-[var(--content-disabled)]`}),v&&(0,$.jsx)(un,{onClick:O,filled:!0})]})]})})}var Ir=`0.10.12`;function Lr(){return qe(Ir)}function Rr(){let{t:e}=Z(`settings`),t=ft(),n=Jt(),i=P(),{data:a}=X({...Te({path:{assistant_id:t}}),enabled:i,staleTime:3e4}),o=lt({onSuccess:e=>{r(n,{path:{assistant_id:t}},e)}}),s=vn(),c=(0,Q.useMemo)(()=>{if(!a)return q(Ne,`inference-provider-native`);let e=a.services?.[`web-search`];return(e?.mode===`managed`&&e?.provider!==`inference-provider-native`?`vellum`:e?.provider)||q(`vellum:ai:webSearchProvider`,`inference-provider-native`)},[a]),l=(0,Q.useMemo)(()=>a?.services?.[`web-search`]?.apiBase??``,[a]),[u,d]=(0,Q.useState)(!1),[f,p]=yn(c),[m,h]=yn(l),[g,_]=(0,Q.useState)(``),v=Dt.has(f),y=Ie.has(f),b=Ve.has(f),{hasStoredCredential:x}=ne({assistantId:t,credentialKind:`api_key`,credentialName:f,enabled:y}),S=g.trim().length>0,C=m.trim(),w=Ye(f,v&&C.length>0),T=f!==c||v&&C!==l.trim(),E=gt[f]??``,D=y&&!b&&!w&&!x&&!S,O=v&&E.length===0&&!C,k=u||D||O||!T&&!S,j=he(Ue[f]??e(`webSearchCard.apiKeyPlaceholder`),x),M=(0,Q.useCallback)(async()=>{d(!0);let r=g.trim(),i=Pe(f),a=y&&r.length>0;try{a&&await s(f,r),await Ht();let n=f===`vellum`?Lr()?{provider:`vellum`,mode:`managed`}:{mode:`managed`}:{provider:f,mode:`your-own`,...v?{apiBase:C}:{}};await o.mutateAsync({path:{assistant_id:t},body:{services:{"web-search":n}}}).catch(t=>{throw A.error(e(`webSearchCard.configUpdateFailedToast`)),U(t,{context:`patch_daemon_config`}),t})}catch{d(!1);return}d(!1);try{if(J(Ne,f),a){i&&J(i,r);let e=I(t,`api_key`,f);n.setQueryData(e,!0),n.invalidateQueries({queryKey:e}),_(``)}A.success(e(`webSearchCard.savedToast`))}catch(t){U(t,{context:`settings-ai-web-search-persist-local`}),A.error(e(`webSearchCard.localPreferencesFailedToast`))}},[y,o,s,n,t,g,f,v,C,e]),N=(0,Q.useCallback)(()=>{let e=Pe(f);e&&Bt(e),_(``),h(``),p(`inference-provider-native`),J(Ne,`inference-provider-native`)},[f,p,h]);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)(V,{"aria-label":e(`webSearchCard.providerAriaLabel`),value:f,onChange:p,options:Ke.map(e=>({value:e,label:ct[e]??e}))})]}),f===`vellum`&&(0,$.jsx)(`p`,{className:`text-body-medium-lighter text-[var(--content-tertiary)]`,children:e(`webSearchCard.vellumNote`)}),v&&(0,$.jsxs)(`div`,{className:`space-y-1`,children:[(0,$.jsx)(K,{label:e(`webSearchCard.apiBaseLabel`),type:`url`,value:m,onChange:e=>h(e.target.value),placeholder:E||e(`webSearchCard.apiBasePlaceholder`),fullWidth:!0}),E?(0,$.jsx)(`p`,{className:`text-body-small-lighter text-[var(--content-tertiary)]`,children:e(`webSearchCard.apiBaseHint`,{defaultBase:E})}):null]}),y&&(0,$.jsx)(K,{label:e(`webSearchCard.apiKeyLabel`),type:`password`,value:g,onChange:e=>_(e.target.value),placeholder:j,fullWidth:!0}),(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(dn,{onClick:M,disabled:k}),u&&(0,$.jsx)(rn,{className:`h-4 w-4 animate-spin text-[var(--content-disabled)]`}),y&&(0,$.jsx)(un,{onClick:N,filled:!0})]})]})})}function zr(){let e=ft(),t=N(),[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};
|
package/dist/assets/{android-billing-handoff-UM5sb6BP.js → android-billing-handoff-DY5xG0W8.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{o as e}from"./rolldown-runtime-BM3Ffeng.js";import{dg as t,xy as n}from"./app-
|
|
1
|
+
import{o as e}from"./rolldown-runtime-BM3Ffeng.js";import{dg as t,xy as n}from"./app-us2PS4GU.js";import{x as r}from"./react-B9IgSVeK.js";var i=e(r(),1);function a(e){return new URL(e,window.location.origin).toString()}function o(e){n(a(e))}function s(e){let{open:n,path:r,onClose:a}=e,s=t(),c=(0,i.useRef)(a);return(0,i.useEffect)(()=>{c.current=a}),(0,i.useEffect)(()=>{s&&n&&(o(r),c.current())},[s,n,r]),s}export{s as n,o as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{o as e}from"./rolldown-runtime-BM3Ffeng.js";import{$x as t,Hy as n,TC as r,Ti as i,US as a,_y as o,eS as s,tC as c,yi as l}from"./app-
|
|
1
|
+
import{o as e}from"./rolldown-runtime-BM3Ffeng.js";import{$x as t,Hy as n,TC as r,Ti as i,US as a,_y as o,eS as s,tC as c,yi as l}from"./app-us2PS4GU.js";import{j as u}from"./vendor-GPbHjL0d.js";import{_ as d,f,t as p,x as m}from"./react-B9IgSVeK.js";import{a as h,c as g,i as _,o as v,r as y,s as b}from"./provider-key-PYCDLSht.js";import"./onboarding-step-layout-BKtqMP5k.js";var x=e(m(),1),S=p();function C(){let{t:e}=u(`onboarding`),p=f(),[m]=d(),C=m.get(`hosting`),w=s(),T=y(),[E,D]=(0,x.useState)(()=>T?.provider??h.id),[O,k]=(0,x.useState)(()=>T?.key??``),[A,j]=(0,x.useState)(()=>T?.model??b(T?.provider??h.id)??``),[M,N]=(0,x.useState)(()=>T?.baseUrl??``),[P,F]=(0,x.useState)(()=>T?.customModels??``),I=g(E)??h,L=I.models??[],R=I.requiresKey,z=L.length>0,B=E===`openai-compatible`,V=(!(R&&!B)||O.trim().length>0)&&(!z||A.trim().length>0)&&(!B||M.trim().length>0&&P.trim().length>0);return(0,S.jsx)(l,{avatarWave:`beside`,children:(0,S.jsxs)(`div`,{className:`mx-auto flex w-full max-w-xl flex-col items-center ${w?`min-h-full px-8 pt-21 pb-4 electron-prechat-type`:`px-6 py-16`} text-[var(--content-default)]`,children:[(0,S.jsx)(`h1`,{className:w?`text-title-large`:`text-3xl font-semibold tracking-tight`,style:{animation:`fadeInUp 0.5s ease-out 0.1s both`},children:e(`apiKeyScreen.title`)}),(0,S.jsx)(`p`,{className:`text-center text-body-medium-lighter text-[var(--content-tertiary)] ${w?`mt-3.5`:`mt-3`}`,style:{animation:`fadeInUp 0.5s ease-out 0.3s both`},children:e(`apiKeyScreen.body`)}),(0,S.jsxs)(`div`,{className:`flex w-full flex-col gap-4 ${w?`mt-8`:`mt-10`}`,style:{animation:`fadeInUp 0.5s ease-out 0.4s both`},children:[(0,S.jsxs)(`div`,{className:`flex flex-col ${w?`gap-2`:`gap-1`}`,children:[(0,S.jsx)(`label`,{className:`text-body-small-default text-[var(--content-tertiary)]`,children:e(`apiKeyScreen.providerLabel`)}),(0,S.jsx)(a,{"aria-label":e(`apiKeyScreen.providerLabel`),value:E,onChange:e=>{let t=g(e);t&&(D(t.id),k(``),j(b(t.id)??``))},options:v.map(e=>({value:e.id,label:e.displayName}))})]}),L.length>0&&(0,S.jsxs)(`div`,{className:`flex flex-col ${w?`gap-2`:`gap-1`}`,children:[(0,S.jsx)(`label`,{className:`text-body-small-default text-[var(--content-tertiary)]`,children:e(`apiKeyScreen.modelLabel`)}),(0,S.jsx)(a,{"aria-label":e(`apiKeyScreen.modelLabel`),value:A,onChange:j,options:L.map(e=>({value:e.id,label:e.displayName}))})]}),B&&(0,S.jsxs)(S.Fragment,{children:[(0,S.jsxs)(`div`,{className:`flex flex-col ${w?`gap-2`:`gap-1`}`,children:[(0,S.jsx)(`label`,{className:`text-body-small-default text-[var(--content-tertiary)]`,children:e(`apiKeyScreen.baseUrlLabel`)}),(0,S.jsx)(c,{type:`text`,placeholder:`http://localhost:1234/v1`,value:M,onChange:e=>N(e.target.value),fullWidth:!0})]}),(0,S.jsxs)(`div`,{className:`flex flex-col ${w?`gap-2`:`gap-1`}`,children:[(0,S.jsx)(`label`,{className:`text-body-small-default text-[var(--content-tertiary)]`,children:e(`apiKeyScreen.modelsLabel`)}),(0,S.jsx)(c,{type:`text`,placeholder:e(`apiKeyScreen.modelsPlaceholder`),value:P,onChange:e=>F(e.target.value),fullWidth:!0}),(0,S.jsx)(`p`,{className:`text-body-small-lighter text-[var(--content-tertiary)]`,children:e(`apiKeyScreen.modelsHelp`)})]})]}),R&&(0,S.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,S.jsx)(c,{type:`password`,label:e(`apiKeyScreen.apiKeyLabel`,{provider:I.displayName}),placeholder:I.apiKeyPlaceholder??e(`apiKeyScreen.apiKeyPlaceholder`),value:O,onChange:e=>k(e.target.value),className:`touch-mobile:text-[16px]`,fullWidth:!0}),I.docsUrl&&(0,S.jsxs)(`p`,{className:`self-start text-body-medium-lighter text-[var(--content-tertiary)]`,children:[e(`apiKeyScreen.noKeyPrompt`),` `,(0,S.jsx)(o,{href:I.docsUrl,tone:`quiet`,className:`text-[var(--content-default)]`,glyph:!1,children:e(`apiKeyScreen.getKeyLink`)})]})]})]}),(0,S.jsxs)(`div`,{className:`mt-8 flex w-full flex-col ${w?`gap-2.5`:`gap-2`}`,style:{animation:`fadeInUp 0.5s ease-out 0.5s both`},children:[(0,S.jsx)(r,{variant:`primary`,size:w?`regular`:`large`,fullWidth:!0,disabled:!V,onClick:()=>{if(!V)return;let e=A.trim()||b(E);_({provider:E,key:O.trim(),...e?{model:e}:{},...B?{baseUrl:M.trim(),customModels:P.trim()}:{}});let r=new URLSearchParams({[n]:`1`});C&&r.set(`hosting`,C),p(`${t.onboarding.privacy}?${r.toString()}`,i)},children:e(`actions.continue`)}),(0,S.jsx)(r,{variant:`outlined`,size:w?`regular`:`large`,fullWidth:!0,onClick:()=>{p(t.onboarding.hosting,i)},children:e(`actions.back`)})]})]})})}export{C as ApiKeyScreen};
|