@vellumai/web 0.11.2-dev.202608042227.b54139c → 0.11.2-dev.202608042326.c3f0775
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/{access-DL6ZqmDW.js → access-W_K3fAhi.js} +1 -1
- package/dist/assets/{account-page-BckvBDX6.js → account-page-DLv1gn3z.js} +1 -1
- package/dist/assets/{acp-run-actions-SclBvksz.js → acp-run-actions-CrmJu7rx.js} +1 -1
- package/dist/assets/{acp-run-detail-panel-CvsVT-Fm.js → acp-run-detail-panel-IJrqRMkc.js} +1 -1
- package/dist/assets/{activity-steps-panel-litv3D3H.js → activity-steps-panel-CzdYkB5v.js} +1 -1
- package/dist/assets/{add-credential-modal-huCvTQuI.js → add-credential-modal-DC27OZIF.js} +1 -1
- package/dist/assets/{add-credits-modal-ChtBtqP0.js → add-credits-modal-DfhgmdMJ.js} +1 -1
- package/dist/assets/ai-page-CJ9bXxJ9.js +1 -0
- package/dist/assets/api-DZ1FASA0.js +1 -0
- package/dist/assets/{api-CSQLVOps.js → api-Du7TU0QH.js} +1 -1
- package/dist/assets/{api-errors-CFiCT7Ap.js → api-errors-37rFaJd8.js} +1 -1
- package/dist/assets/{api-key-screen-CAISP4Mb.js → api-key-screen-BkTfV3Qn.js} +1 -1
- package/dist/assets/{app-card-CVbbaWgL.js → app-card-DCRNbEQh.js} +1 -1
- package/dist/assets/{assistant-status-panel-Cpn_vawB.js → assistant-status-panel-DDg5udm6.js} +1 -1
- package/dist/assets/auth-store-DekEIBJ-.js +2 -0
- package/dist/assets/{avatar-random-KFUMUc0u.js → avatar-random-YP7nnkKq.js} +1 -1
- package/dist/assets/{background-task-actions-DOvMbNR5.js → background-task-actions-DCK7Zaq0.js} +1 -1
- package/dist/assets/{background-task-detail-panel-BWdxuRXx.js → background-task-detail-panel-BC3aFNit.js} +1 -1
- package/dist/assets/{billing-page-sgpzYbPn.js → billing-page-Br1Uk-r-.js} +1 -1
- package/dist/assets/{bookmarks-page-BT4HI-vx.js → bookmarks-page-C1Zgigj5.js} +1 -1
- package/dist/assets/{browser-BlLwMkM7.js → browser-CRqxfh4J.js} +1 -1
- package/dist/assets/{build-state-CaPWg2qV.js → build-state-CglE0Rll.js} +1 -1
- package/dist/assets/{capture-error-Bj8_eutd.js → capture-error-DIcLdUu5.js} +1 -1
- package/dist/assets/{channels-page-route-CCzU4jYB.js → channels-page-route-VABt7uGC.js} +1 -1
- package/dist/assets/{chat-avatar-yNiGc9Qd.js → chat-avatar-sxVQW_3f.js} +1 -1
- package/dist/assets/{chat-markdown-message-B-QgIcXI.js → chat-markdown-message-B7KyT8R6.js} +1 -1
- package/dist/assets/{checkout-continuation-2s8QrvBM.js → checkout-continuation-Cl65aymU.js} +1 -1
- package/dist/assets/{checkout-page-6J1AkP4E.js → checkout-page-DXEJIHgt.js} +1 -1
- package/dist/assets/{client-identity-C7zeQXr0.js → client-identity-BnKTNCur.js} +1 -1
- package/dist/assets/{command-palette-DWMcsxOz.js → command-palette-CqeAUZ7i.js} +1 -1
- package/dist/assets/{command-palette-window-page-DMIb9rDp.js → command-palette-window-page-BC-NqUJb.js} +1 -1
- package/dist/assets/composer-settings-BCdO5DgY.js +1 -0
- package/dist/assets/{connect-page-DidjPRWR.js → connect-page-wARav6bT.js} +1 -1
- package/dist/assets/{contacts-gateway-B1tIdiPt.js → contacts-gateway-DwsqXavB.js} +1 -1
- package/dist/assets/{contacts-page-route-BvLo0kNr.js → contacts-page-route-gExgKPWT.js} +1 -1
- package/dist/assets/{conversation-cache-CtPnlBgy.js → conversation-cache-7dknjN95.js} +1 -1
- package/dist/assets/conversation-list-fetchers-pQIA8p0a.js +1 -0
- package/dist/assets/{conversation-navigation-DtwiHfoU.js → conversation-navigation-E1eTQF9G.js} +1 -1
- package/dist/assets/{conversation-queries-BgTAbbMF.js → conversation-queries-FFcLyyLn.js} +1 -1
- package/dist/assets/{copy-to-clipboard-DTcTjpel.js → copy-to-clipboard-C7crtX7A.js} +1 -1
- package/dist/assets/{credential-entry-page-DhbcJuKj.js → credential-entry-page-BmdIrT2Y.js} +1 -1
- package/dist/assets/credentials-page-CiiyNKdo.js +1 -0
- package/dist/assets/debug-page-CE5XbjSz.js +4 -0
- package/dist/assets/{deploy-dialogs-CpUhx5Wn.js → deploy-dialogs-DfHoeMRm.js} +1 -1
- package/dist/assets/{deploy-store-BNgH3BhM.js → deploy-store-DLP6cvZ5.js} +1 -1
- package/dist/assets/{developer-page-BxhmZb2S.js → developer-page-BgA4DxkT.js} +1 -1
- package/dist/assets/{diagnostics-Zt4l-3-X.js → diagnostics-_ZD3ioXN.js} +1 -1
- package/dist/assets/{doctor-handoff-store-BMewN4B5.js → doctor-handoff-store-ChvNtnd_.js} +1 -1
- package/dist/assets/{document-viewer-container-DWSbD2Vy.js → document-viewer-container-woODGy7z.js} +1 -1
- package/dist/assets/{document-viewer-page-CMhJ-yEr.js → document-viewer-page-CYAOctOT.js} +1 -1
- package/dist/assets/{emails-page-CGGFauIm.js → emails-page-3dzcnHA-.js} +1 -1
- package/dist/assets/{file-editor-C17bp9Ul.js → file-editor-DIHQt7wk.js} +1 -1
- package/dist/assets/{first-run-scope-B9Y4wKSQ.js → first-run-scope-D3N3NroW.js} +1 -1
- package/dist/assets/{funnel-events-CQ8HwOa-.js → funnel-events-ffWj10fc.js} +1 -1
- package/dist/assets/general-page-DEtTOkmX.js +1 -0
- package/dist/assets/get-memory-stats-DlFA3ogw.js +1 -0
- package/dist/assets/{haptics-B3p6ezq1.js → haptics-DbwTJGZZ.js} +1 -1
- package/dist/assets/hatching-screen-VWKyL7PN.js +1 -0
- package/dist/assets/{home-page-route-CIWcCDlk.js → home-page-route-Dem157OH.js} +1 -1
- package/dist/assets/{hosting-screen-L3YT9qlq.js → hosting-screen-qLr_TRNM.js} +1 -1
- package/dist/assets/{identity-page-route-B0LXvvHJ.js → identity-page-route-EkHcefPi.js} +2 -2
- package/dist/assets/identity-rP3YP3TT.js +1 -0
- package/dist/assets/{index-COSnTmLV.js → index-C3fItXMG.js} +2 -2
- package/dist/assets/{ingest-B6HgY85V.js → ingest-CqJEC1Mw.js} +1 -1
- package/dist/assets/{inspect-page-DZGJ3_DF.js → inspect-page-CvP75CQ-.js} +2 -2
- package/dist/assets/{installed-plugins-query-B-E60ZeG.js → installed-plugins-query-BgWRd1f2.js} +1 -1
- package/dist/assets/{integrations-page-BnTDIPsE.js → integrations-page-DmFfaVvO.js} +1 -1
- package/dist/assets/invalidate-memory-queries-CTdOb-mM.js +1 -0
- package/dist/assets/{invalidate-plugin-queries-DaqjVAFQ.js → invalidate-plugin-queries-DXYeJp__.js} +1 -1
- package/dist/assets/{latest-assistant-text-DsAf5nM_.js → latest-assistant-text-Cb-Ghdzy.js} +2 -2
- package/dist/assets/{library-detail-page-CBZQyjfQ.js → library-detail-page-8ZR3RYWA.js} +1 -1
- package/dist/assets/{library-page-CKmgCstM.js → library-page-DE_OFTfB.js} +1 -1
- package/dist/assets/local-mode-BR8wpdXp.js +39 -0
- package/dist/assets/{local-runtime-upgrade-7dQktWp2.js → local-runtime-upgrade-_rhlsPXA.js} +1 -1
- package/dist/assets/{login-flow-C4ibtEr1.js → login-flow-Fa5lhU8O.js} +1 -1
- package/dist/assets/{login-page-F6N_qd4T.js → login-page-BOdhBuLN.js} +1 -1
- package/dist/assets/{logout-page-B0hW96ua.js → logout-page-DsVO5L6c.js} +1 -1
- package/dist/assets/{logs-layout-3YyZqc3F.js → logs-layout-vFF3A72W.js} +1 -1
- package/dist/assets/{media-preview-iDbnoYfk.js → media-preview-rARx2Int.js} +1 -1
- package/dist/assets/{memory-page-route-D94kYR-f.js → memory-page-route-BGgGr1Tx.js} +2 -2
- package/dist/assets/{memory-router-playground-page-C2PQxytb.js → memory-router-playground-page-B9_4U-AR.js} +1 -1
- package/dist/assets/{message-files-panel-DeTBvyEy.js → message-files-panel-CaD100Ny.js} +1 -1
- package/dist/assets/{messages-DseJQFO_.js → messages-C-vKlp4O.js} +2 -2
- package/dist/assets/{mobile-sidebar-drawer-BaytB4Wh.js → mobile-sidebar-drawer-BuhyMfvL.js} +1 -1
- package/dist/assets/native-anchor-h-7_Ixx1.js +1 -0
- package/dist/assets/{native-biometric-BFYdgeUL.js → native-biometric-DSA3t7PV.js} +1 -1
- package/dist/assets/{navigation-resolver-C6RwDq2H.js → navigation-resolver-C8Qyk5eO.js} +1 -1
- package/dist/assets/{notifications-BBZLLHJ7.js → notifications-BjQ5uKx3.js} +1 -1
- package/dist/assets/{notifications-page-DQinn00V.js → notifications-page-CBdNYPIQ.js} +1 -1
- package/dist/assets/{open-workspace-file-BltzxPLh.js → open-workspace-file-BvNK-d7r.js} +2 -2
- package/dist/assets/page-empty-state-DmpUmh0F.js +1 -0
- package/dist/assets/{pairing-page-CvD5zLsA.js → pairing-page-BgztYa3j.js} +1 -1
- package/dist/assets/{pdf-file-preview-iKAI2_qQ.js → pdf-file-preview-C6FaePs9.js} +1 -1
- package/dist/assets/{personality-page-CUROlUST.js → personality-page-D7yQSrSy.js} +1 -1
- package/dist/assets/{plans-page-DUYS0cbu.js → plans-page-BJ_VUH2T.js} +1 -1
- package/dist/assets/{platform-detection-BXhmJnUZ.js → platform-detection-HB9owK_1.js} +1 -1
- package/dist/assets/{platform-login-notice-CMolXtmN.js → platform-login-notice-RoCbvg6A.js} +1 -1
- package/dist/assets/{platform-loopback-page-CmT91jzA.js → platform-loopback-page-tN33GJpO.js} +1 -1
- package/dist/assets/{privacy-page-ob9lLxyy.js → privacy-page-Bh2g74yA.js} +1 -1
- package/dist/assets/{privacy-screen-OGHbIDa3.js → privacy-screen-ZtEUgaFO.js} +1 -1
- package/dist/assets/{provider-callback-page-CvY7wldu.js → provider-callback-page-lHpQdhnn.js} +1 -1
- package/dist/assets/{provider-key-CH3fSqvf.js → provider-key-CqQjkBY-.js} +1 -1
- package/dist/assets/{provider-signup-page-B5LtbL5y.js → provider-signup-page-CUDgC3JO.js} +1 -1
- package/dist/assets/{push-registration-Sip6OSUC.js → push-registration-BgFveATO.js} +1 -1
- package/dist/assets/react-query.gen-BAqQbp0v.js +1 -0
- package/dist/assets/{remote-gateway-session-BwqxJZBJ.js → remote-gateway-session-BKw7UXep.js} +1 -1
- package/dist/assets/research-onboarding-route-Brrv-n9N.js +50 -0
- package/dist/assets/resolved-assistants-store-BymuLyDm.js +1 -0
- package/dist/assets/retire-confirm-dialog-DDygwaih.js +1 -0
- package/dist/assets/{review-terms-screen-BwYhdJD2.js → review-terms-screen-D6fE_IZF.js} +1 -1
- package/dist/assets/routes-DtFdxjqA.js +23 -0
- package/dist/assets/{runtime-upgrade-banner-D7nbieEW.js → runtime-upgrade-banner-qYvLLq3w.js} +1 -1
- package/dist/assets/schedules-3D7sEK9E.js +1 -0
- package/dist/assets/{schedules-page-CDnzNb2Y.js → schedules-page-GvSjqlbG.js} +1 -1
- package/dist/assets/{sdk.gen-D7tvT1tz.js → sdk.gen-qwmaWHuE.js} +1 -1
- package/dist/assets/select-assistant-screen-C4qxV0Pa.js +1 -0
- package/dist/assets/settings-layout-BEL_LKRd.js +1 -0
- package/dist/assets/{settings-navigation-C1HwOIUt.js → settings-navigation-CPjj6MNt.js} +1 -1
- package/dist/assets/{share-feedback-modal-CnRDFGbB.js → share-feedback-modal-gu4QhEe8.js} +1 -1
- package/dist/assets/{sidebar-tree-CQFcWGT1.js → sidebar-tree-CAUC85d7.js} +1 -1
- package/dist/assets/{signup-page-bcvMAmof.js → signup-page-C4KzACfO.js} +1 -1
- package/dist/assets/{skill-detail-page-D8PfNLuP.js → skill-detail-page-SyoQbE1f.js} +1 -1
- package/dist/assets/{skill-detail-panel-CUbOWneV.js → skill-detail-panel-DE6qJgVy.js} +1 -1
- package/dist/assets/{skills-DKKY5OMN.js → skills-B_P-yx6k.js} +1 -1
- package/dist/assets/{sound-manager-C_1KnCOC.js → sound-manager-DsEGEHS2.js} +1 -1
- package/dist/assets/{sounds-page-CGUckr1i.js → sounds-page-CbISCeOu.js} +1 -1
- package/dist/assets/{subagent-detail-panel-Cko5R1_J.js → subagent-detail-panel-CT8jfCE0.js} +1 -1
- package/dist/assets/{subagent-store-aUi9z1GE.js → subagent-store-BT0jwnVK.js} +2 -2
- package/dist/assets/{superpowers-page-ZtpKl4Lq.js → superpowers-page-BK0_ws_J.js} +1 -1
- package/dist/assets/{system-events-page-Cy608Ykp.js → system-events-page-CVTcu6cf.js} +1 -1
- package/dist/assets/{threshold-presets-xxr02Qfr.js → threshold-presets-D0pLHWTj.js} +1 -1
- package/dist/assets/{tool-detail-panel-Bkj5ZAeI.js → tool-detail-panel-DXlGhcTR.js} +1 -1
- package/dist/assets/{transcript-message-body-shared-BFfgWZy2.js → transcript-message-body-shared-Cp7KnGNi.js} +1 -1
- package/dist/assets/{trust-rules-api-DJrse6lT.js → trust-rules-api-1-m2AuJz.js} +1 -1
- package/dist/assets/{upgrade-cancel-page-BeY5T4kB.js → upgrade-cancel-page-DvXKHcjR.js} +1 -1
- package/dist/assets/{upgrade-success-page--joUbj6k.js → upgrade-success-page-C8g9Eiy6.js} +1 -1
- package/dist/assets/{use-active-assistant-id-Bpz6E0Zc.js → use-active-assistant-id-CaI-sL1J.js} +1 -1
- package/dist/assets/{use-assistant-avatar-DMG3FqL-.js → use-assistant-avatar-2AaP2LdS.js} +1 -1
- package/dist/assets/{use-assistant-capability-B8hrKD40.js → use-assistant-capability-De7J71CP.js} +1 -1
- package/dist/assets/{use-assistant-identity-details-CeLOmSn3.js → use-assistant-identity-details-BUYFliCc.js} +1 -1
- package/dist/assets/{use-attachment-preview-CZ1ukJ84.js → use-attachment-preview-CrF3FARl.js} +1 -1
- package/dist/assets/{use-attachment-squares-DlMC872S.js → use-attachment-squares-DVZKTc3j.js} +1 -1
- package/dist/assets/{use-bookmarks-CdFuT6Xg.js → use-bookmarks-Cgl5CAWW.js} +1 -1
- package/dist/assets/{use-checkout-dismiss-refresh-DNcYC868.js → use-checkout-dismiss-refresh-CKllX5Xb.js} +1 -1
- package/dist/assets/use-command-palette-sections-C29KKzRs.js +1 -0
- package/dist/assets/{use-edge-swipe-back-DwIF21EZ.js → use-edge-swipe-back-DdZtH51d.js} +1 -1
- package/dist/assets/{use-edge-swipe-CwUOiFEN.js → use-edge-swipe-keD8fPuu.js} +1 -1
- package/dist/assets/{use-edit-app-BA6KXCBI.js → use-edit-app-DQW0am13.js} +1 -1
- package/dist/assets/{use-invite-link-dialog-BB8L3PzM.js → use-invite-link-dialog-CnfC4JFV.js} +1 -1
- package/dist/assets/{use-is-org-ready-BsyTIiNf.js → use-is-org-ready-Ba1VneeM.js} +1 -1
- package/dist/assets/{use-local-file-info-CtbuzUis.js → use-local-file-info-D_S980Q_.js} +1 -1
- package/dist/assets/{use-onboarding-login-CJRp506m.js → use-onboarding-login-C0q-KHn1.js} +1 -1
- package/dist/assets/{use-platform-assistant-id-DN1IV-Ay.js → use-platform-assistant-id-kmmtsyrT.js} +1 -1
- package/dist/assets/{use-platform-gate-lLb0F3yZ.js → use-platform-gate-BJ0RnKAt.js} +1 -1
- package/dist/assets/{use-return-to-short-circuit-DDqqgAes.js → use-return-to-short-circuit-CFPolYK1.js} +1 -1
- package/dist/assets/{use-save-twilio-credentials-Bt8-VmNu.js → use-save-twilio-credentials-BLyYNJH2.js} +1 -1
- package/dist/assets/{use-skill-actions-dO7SAuVJ.js → use-skill-actions-D9_B3Vcv.js} +1 -1
- package/dist/assets/{use-skill-detail-files-_k3UzMmc.js → use-skill-detail-files-D6FqY1Nr.js} +1 -1
- package/dist/assets/use-sticky-profiles-lwpGwyht.js +1 -0
- package/dist/assets/{use-subagent-card-data-DnRhUNpn.js → use-subagent-card-data-DXfFlYKE.js} +1 -1
- package/dist/assets/use-transcript-message-by-id-COcp9JAj.js +1 -0
- package/dist/assets/{use-transcript-messages-oi26Ktnj.js → use-transcript-messages-D9wMtUJD.js} +1 -1
- package/dist/assets/{use-voice-sample-preview-Du5pNP6H.js → use-voice-sample-preview-DCfnm57n.js} +1 -1
- package/dist/assets/{utils-D_YMyAVe.js → utils-C7bxXeGZ.js} +1 -1
- package/dist/assets/{viewer-store-TG2_cF5e.js → viewer-store-CUIaUN_G.js} +1 -1
- package/dist/assets/{voice-list-DkZ8sHUi.js → voice-list-DSHC3x_a.js} +1 -1
- package/dist/assets/{voice-page-CrASdsw3.js → voice-page-NgWl-zB9.js} +1 -1
- package/dist/assets/{welcome-screen-atrG4Qhw.js → welcome-screen-CrS-WygA.js} +1 -1
- package/dist/assets/{workflow-store-ClxNt3tJ.js → workflow-store-Y8yA0kxw.js} +1 -1
- package/dist/assets/workspace-page-DceqGo6d.js +1 -0
- package/dist/assets/workspace-tree-query-CUw_yH2P.js +1 -0
- package/dist/index.html +83 -83
- package/package.json +1 -1
- package/dist/assets/ai-page-DEeQhQ4O.js +0 -1
- package/dist/assets/api-BMYk8zh_.js +0 -1
- package/dist/assets/auth-store-BQ6VXv_c.js +0 -2
- package/dist/assets/conversation-list-fetchers-NHbvfoK8.js +0 -1
- package/dist/assets/credentials-page-CWUWEzME.js +0 -1
- package/dist/assets/debug-page-hmPXX1LP.js +0 -4
- package/dist/assets/general-page-m0mev7wE.js +0 -1
- package/dist/assets/get-memory-stats-C6qisNce.js +0 -1
- package/dist/assets/hatching-screen-Dv3wxBV9.js +0 -1
- package/dist/assets/identity-DGwGuDNu.js +0 -1
- package/dist/assets/invalidate-memory-queries-CUCHL1MU.js +0 -1
- package/dist/assets/local-mode-StEqYyqw.js +0 -39
- package/dist/assets/native-anchor-DrIjle7B.js +0 -1
- package/dist/assets/page-empty-state-ClhYSor9.js +0 -1
- package/dist/assets/react-query.gen-CVlTRWus.js +0 -1
- package/dist/assets/research-onboarding-route-DiM1EmlB.js +0 -50
- package/dist/assets/resolved-assistants-store-O7lFWIXI.js +0 -1
- package/dist/assets/retire-confirm-dialog-Dvnyjmcs.js +0 -1
- package/dist/assets/routes-CTQZmUb6.js +0 -23
- package/dist/assets/schedules-DgU4kSjP.js +0 -1
- package/dist/assets/select-assistant-screen-9T4BRd_t.js +0 -1
- package/dist/assets/settings-layout-Du5Oap1d.js +0 -1
- package/dist/assets/use-command-palette-sections-BCeqKPyX.js +0 -1
- package/dist/assets/use-ios-app-nudge-DDQgAxyu.js +0 -1
- package/dist/assets/use-sticky-profiles-C9kTgzMU.js +0 -1
- package/dist/assets/use-transcript-message-by-id-BsMDrCkA.js +0 -1
- package/dist/assets/workspace-page-D-yLftlB.js +0 -1
- package/dist/assets/workspace-tree-query-D58SWaA3.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as e}from"./auth-store-
|
|
1
|
+
import{n as e}from"./auth-store-DekEIBJ-.js";import{t}from"./assistant-feature-flag-store-B-Q1aqEl.js";function n(e,t){return t||e?.isStaff===!0||e?.email?.toLowerCase().endsWith(`@vellum.ai`)===!0}function r(){return n(e.use.user(),t.use.settingsDeveloperNav()===!0)}export{r as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{o as e}from"./chunk-jRWAZmH_.js";import{t}from"./react-BFJW0bSv.js";import{t as n}from"./chunk-5KNZJZUH-Bsoom5--.js";import{t as r}from"./jsx-runtime-D3ZM-ToX.js";import{a as i,n as a,s as o}from"./auth-store-
|
|
1
|
+
import{o as e}from"./chunk-jRWAZmH_.js";import{t}from"./react-BFJW0bSv.js";import{t as n}from"./chunk-5KNZJZUH-Bsoom5--.js";import{t as r}from"./jsx-runtime-D3ZM-ToX.js";import{a as i,n as a,s as o}from"./auth-store-DekEIBJ-.js";import{f as s}from"./native-biometric-DSA3t7PV.js";import{d as c}from"./routes-CAe1h0Db.js";import{t as l}from"./hard-navigate-Dou11GyV.js";import{n as u,t as d}from"./login-flow-Fa5lhU8O.js";import{r as f,t as p}from"./account-shell-CrUI5eAF.js";var m=e(t(),1),h=r();function g(){let e=i(),t=o(),r=a.use.user(),g=a.use.logout(),[_,v]=(0,m.useState)(null),[y,b]=(0,m.useState)(!1),x=async()=>{v(null),b(!0);try{await s(u,d)}catch(e){console.error(`[account] auth flow failed:`,e),v(`Something went wrong. Please try again.`),b(!1)}};return t?(0,h.jsx)(p,{children:(0,h.jsx)(f,{title:`Loading...`})}):e?(0,h.jsxs)(p,{children:[(0,h.jsx)(f,{title:`Welcome${r?.username?`, ${r.username}`:``}!`,subtitle:`You are signed in.`}),(0,h.jsxs)(`div`,{className:`flex flex-col items-center gap-4`,children:[(0,h.jsx)(n,{to:c.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:`Go to your assistant`}),(0,h.jsx)(`button`,{type:`button`,onClick:async()=>{await g(),l(c.account.login)},className:`cursor-pointer bg-transparent text-sm font-normal text-[var(--content-secondary)] transition-colors hover:text-[var(--content-default)]`,children:`Sign out`})]})]}):(0,h.jsxs)(p,{children:[(0,h.jsx)(f,{title:`Welcome to Vellum`,subtitle:`Sign in to get started.`}),_&&(0,h.jsx)(`p`,{className:`text-center text-sm text-[var(--system-negative-strong)]`,children:_}),(0,h.jsx)(`div`,{className:`flex flex-col items-center gap-4`,children:(0,h.jsx)(`button`,{type:`button`,onClick:()=>void x(),disabled:y,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:`Sign in`})})]})}export{g as AccountPage};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as e}from"./jsx-runtime-D3ZM-ToX.js";import{t}from"./createLucideIcon-CAM1RhH8.js";import{t as n}from"./code-D6SOwRrI.js";import{n as r}from"./resolved-assistants-store-
|
|
1
|
+
import{t as e}from"./jsx-runtime-D3ZM-ToX.js";import{t}from"./createLucideIcon-CAM1RhH8.js";import{t as n}from"./code-D6SOwRrI.js";import{n as r}from"./resolved-assistants-store-BymuLyDm.js";import{Jr as i}from"./sdk.gen-qwmaWHuE.js";import{t as a}from"./public-asset-CKQ1B7-c.js";import{r as o}from"./acp-run-store-Beu3Bcgz.js";var s=t(`arrow-down`,[[`path`,{d:`M12 5v14`,key:`s699le`}],[`path`,{d:`m19 12-7 7-7-7`,key:`1idqje`}]]),c=t(`folder-input`,[[`path`,{d:`M2 9V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2v-1`,key:`fm4g5t`}],[`path`,{d:`M2 13h10`,key:`pgb2dq`}],[`path`,{d:`m9 16 3-3-3-3`,key:`6m91ic`}]]),l=t(`list-checks`,[[`path`,{d:`M13 5h8`,key:`a7qcls`}],[`path`,{d:`M13 12h8`,key:`h98zly`}],[`path`,{d:`M13 19h8`,key:`c3s6r1`}],[`path`,{d:`m3 17 2 2 4-4`,key:`1jhpwq`}],[`path`,{d:`m3 7 2 2 4-4`,key:`1obspn`}]]),u=e();function d(e){let t=e.toLowerCase();if(t.includes(`claude`))return`/images/prior-assistants/claude.svg`;if(t.includes(`codex`)||t.includes(`openai`)||t.includes(`gpt`))return`/images/prior-assistants/chatgpt.svg`;if(t.includes(`copilot`))return`/images/prior-assistants/copilot.svg`}function f({agent:e,className:t=`h-4 w-4 shrink-0`}){let r=e?d(e):void 0;return r?(0,u.jsx)(`img`,{src:a(r),alt:``,"aria-hidden":!0,"data-testid":`acp-agent-icon-brand`,className:t}):(0,u.jsx)(n,{className:`${t} text-[var(--content-secondary)]`,"aria-hidden":!0})}function p(){let e=r.getState().activeAssistantId;if(!e)throw Error(`No active assistant`);return e}async function m(e){let t=p(),n=o.getState(),r=n.byId[e]?.status;n.cancelRun({acpSessionId:e,completedAt:Date.now()});try{let{response:n}=await i.post({url:`/v1/assistants/{assistant_id}/acp/{id}/cancel`,path:{assistant_id:t,id:e},body:{}});if(!n?.ok)throw Error(`Failed to stop ACP run: ${n?.status}`)}catch(t){throw r!==void 0&&o.getState().restoreRunStatus({acpSessionId:e,status:r}),t}}async function h(e,t){let{data:n,response:r}=await i.post({url:`/v1/assistants/{assistant_id}/acp/{id}/steer`,path:{assistant_id:p(),id:e},body:{instruction:t}});if(!r?.ok)throw Error(`Failed to steer ACP run: ${r?.status}`);return n}export{c as a,l as i,m as n,s as o,f as r,h as t};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{o as e}from"./chunk-jRWAZmH_.js";import{t}from"./capture-error-
|
|
1
|
+
import{o as e}from"./chunk-jRWAZmH_.js";import{t}from"./capture-error-DIcLdUu5.js";import{t as n}from"./react-BFJW0bSv.js";import{t as r}from"./button-fyWSnR9X.js";import{t as i}from"./jsx-runtime-D3ZM-ToX.js";import{t as a}from"./typography-DEI9Ra9z.js";import{t as o}from"./createLucideIcon-CAM1RhH8.js";import{a as s,i as c,n as l,o as u,r as d,t as f}from"./acp-run-actions-CrmJu7rx.js";import{t as p}from"./arrow-left-W84B6oJL.js";import{t as m}from"./brain-CN4zzNgU.js";import{t as h}from"./chevron-down-BNidRDh1.js";import{t as g}from"./chevron-right-CANAtgGn.js";import{t as _}from"./circle-check-DvrCdroD.js";import{t as v}from"./circle-minus-BBDKV6k6.js";import{w as y}from"./menu-D7gzADvH.js";import{t as b}from"./code-D6SOwRrI.js";import"./src-ly8ixpHd.js";import{t as x}from"./file-text-CwGsMgaa.js";import{t as S}from"./globe-CdLn4IX7.js";import{t as C}from"./chat-markdown-message-B7KyT8R6.js";import{t as ee}from"./repeat-CP_vsQPN.js";import{t as te}from"./search-DL-2uX3K.js";import{t as ne}from"./send-Bdmy_GSE.js";import{t as w}from"./square-DTFrgbZb.js";import{t as T}from"./terminal-BucMVaPU.js";import{t as re}from"./trash-2-DfVRfykB.js";import{t as ie}from"./triangle-alert-D6bAGtMw.js";import{t as ae}from"./x-D4O9yIS7.js";import{t as oe}from"./tag-Bz-I4QwU.js";import{a as E,i as se,n as D,r as O}from"./acp-run-store-Beu3Bcgz.js";import{t as k}from"./three-dot-indicator-BRr0F0MO.js";import{t as ce}from"./status-badge-pill-B_SDkd4E.js";var le=o(`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`}]]),A=e(n(),1),j=``;function M(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 ue(e){return(e.messageId?.startsWith(`local-marker-`)??!1)||(e.content?.startsWith(`↻ Steering: `)??!1)}function N(e){let t=e??``;return t.startsWith(`↻ Steering: `)?t.slice(D.length):t}function P(e){let t=e[e.length-1];t&&(t.kind===`agent`||t.kind===`thinking`)&&!t.isComplete&&(e[e.length-1]={...t,isComplete:!0})}function F(e,t){if(t.updateType===`agent_message_chunk`&&ue(t)){P(e),e.push({kind:`user`,id:t.messageId??`steer-${e.length}`,content:N(t.content)});return}switch(t.updateType){case`user_message_chunk`:{let n=t.messageId??j,r=N(t.content),i=e[e.length-1];i&&i.kind===`user`&&i.id===n?e[e.length-1]={...i,content:i.content+r}:(P(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??j,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!==j&&r&&r.kind===`agent`&&r.messageId===j&&!r.isComplete&&r.content===(t.content??``)){e[e.length-1]={...r,messageId:n};return}P(e),e.push({kind:`agent`,messageId:n,content:t.content??``,isComplete:!1});return}case`agent_thought_chunk`:{let n=t.messageId??j,r=e[e.length-1];if(r&&r.kind===`thinking`&&r.messageId===n){e[e.length-1]={...r,content:r.content+(t.content??``)};return}P(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;P(e),e.push({kind:`tool`,toolCallId:n,title:t.toolTitle??``,toolKind:t.toolKind,status:M(t.toolStatus,`running`),content:t.content,locations:I(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=I(t);e[r]={...i,title:t.toolTitle??i.title,toolKind:t.toolKind??i.toolKind,status:M(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=de(t.content);if(n===null)return;let r=e.findIndex(e=>e.kind===`plan`),i={kind:`plan`,entries:n};r===-1?(P(e),e.push(i)):e[r]=i;return}}}function I(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 de(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 fe(e){let t=[];for(let n of e)F(t,n);return t}function pe(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 me(){let e=null,t=[];function n(n){return t=fe(n),e=n,t}function r(r){let i=pe(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++)F(n,r[e]);return e=r,t=n,t}case`mutate-last`:case`fallback`:return n(r)}}return{project:r}}function L(e){let t=(0,A.useRef)(null);return t.current??=me(),t.current.project(e)}function R(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=z(e);t&&r.push(t)}return r}function z(e){if(typeof e!=`object`||!e)return null;let t=e;switch(t.type){case`content`:return{type:`content`,text:he(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=ge(t);return e===void 0?{type:`terminal`}:{type:`terminal`,text:e}}default:return null}}function he(e){if(typeof e==`string`)return e;if(typeof e==`object`&&e){let t=e.text;if(typeof t==`string`)return t}return``}function ge(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 B(e){if(typeof e!=`object`||!e)return;let t=e.command;return typeof t==`string`?t:void 0}function V(e){return R(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 H(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 U(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 W=i();function _e({content:e,isComplete:t,assistantId:n}){return(0,W.jsxs)(`div`,{"data-testid":`acp-chat-agent-message`,className:`flex w-full flex-col items-start text-chat text-[var(--content-default)]`,children:[(0,W.jsx)(C,{content:e,assistantId:n}),!t&&(0,W.jsx)(k,{className:`mt-1`,"data-testid":`acp-chat-agent-streaming`})]})}function ve({entries:e}){return e.length===0?null:(0,W.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,W.jsxs)(`div`,{className:`mb-2 flex items-center gap-1.5 text-[var(--content-tertiary)]`,children:[(0,W.jsx)(c,{"aria-hidden":!0,className:`h-3.5 w-3.5 shrink-0`}),(0,W.jsx)(a,{variant:`body-small-emphasised`,className:`text-inherit`,children:`Plan`})]}),(0,W.jsx)(`ul`,{className:`flex flex-col gap-1.5`,children:e.map((e,t)=>(0,W.jsxs)(`li`,{"data-testid":`acp-chat-plan-entry`,"data-checked":e.checked,className:`flex items-start gap-2`,children:[e.checked?(0,W.jsx)(_,{"aria-hidden":!0,className:`mt-0.5 h-4 w-4 shrink-0 text-[var(--system-positive-strong)]`}):(0,W.jsx)(y,{"aria-hidden":!0,className:`mt-0.5 h-4 w-4 shrink-0 text-[var(--content-disabled)]`}),(0,W.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 ye(e){switch(e){case`max_tokens`:case`max_turn_requests`:return`Stopped: limit reached`;case`refusal`:return`Refused`;case`cancelled`:return`Cancelled`;default:return`Completed`}}function be(e){return new Date(e).toLocaleTimeString([],{hour:`numeric`,minute:`2-digit`})}function G({completedAt:e}){return e===void 0?null:(0,W.jsxs)(`span`,{"data-testid":`acp-chat-terminal-time`,children:[`at `,be(e)]})}function xe({status:e,stopReason:t,error:n,completedAt:r}){if(E(e))return null;if(e===`failed`)return(0,W.jsxs)(`div`,{"data-testid":`acp-chat-terminal-block`,"data-terminal-kind":`failed`,className:`flex items-start gap-2 rounded-lg bg-[var(--system-negative-weak)] px-3 py-2 text-body-small-default text-[var(--system-negative-strong)]`,children:[(0,W.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,W.jsx)(ie,{className:`h-4 w-4`})}),(0,W.jsx)(`span`,{children:n??`Run failed`})]});if(e===`cancelled`)return(0,W.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,W.jsx)(v,{"aria-hidden":!0,className:`h-4 w-4 shrink-0`}),(0,W.jsx)(`span`,{children:`Cancelled`}),(0,W.jsx)(G,{completedAt:r})]});let i=ye(t);return(0,W.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,W.jsx)(_,{"aria-hidden":!0,className:`h-4 w-4 shrink-0 text-[var(--system-positive-strong)]`}),(0,W.jsx)(`span`,{children:i}),(0,W.jsx)(G,{completedAt:r})]})}function Se({showDot:e,isLast:t,children:n}){return(0,W.jsxs)(`div`,{className:`relative flex items-start gap-2${t?``:` pb-4`}`,children:[!t&&(0,W.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,W.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,W.jsx)(`span`,{className:`h-[5px] w-[5px] rounded-full bg-[var(--content-disabled)]`})}):(0,W.jsx)(`span`,{"aria-hidden":!0,className:`h-[14px] w-[14px] shrink-0`}),(0,W.jsx)(`div`,{className:`min-w-0 flex-1`,children:n})]})}function Ce({content:e,isComplete:t,assistantId:n}){let[r,i]=(0,A.useState)(null),a=r??!t,o=e.trim().length>0,s=t?`Thought process`:`Thinking`,c=t?(0,W.jsx)(m,{"aria-hidden":!0,className:`h-3.5 w-3.5 shrink-0`}):(0,W.jsx)(k,{dotSize:5,className:`shrink-0`,"data-testid":`acp-chat-thinking-streaming`});return o?(0,W.jsxs)(`div`,{"data-testid":`acp-chat-thinking-block`,className:`w-full`,children:[(0,W.jsxs)(`button`,{type:`button`,"aria-expanded":a,onClick:()=>i(!a),"data-testid":`acp-chat-thinking-toggle`,className:`flex w-full items-center gap-1.5 text-body-small-default text-[var(--content-tertiary)] transition-colors hover:text-[var(--content-secondary)]`,children:[a?(0,W.jsx)(h,{"aria-hidden":!0,className:`h-3.5 w-3.5 shrink-0`}):(0,W.jsx)(g,{"aria-hidden":!0,className:`h-3.5 w-3.5 shrink-0`}),c,(0,W.jsx)(`span`,{children:s})]}),a&&(0,W.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,W.jsx)(C,{content:e,assistantId:n})})]}):(0,W.jsx)(`div`,{"data-testid":`acp-chat-thinking-block`,className:`w-full`,children:(0,W.jsxs)(`div`,{className:`flex w-full items-center gap-1.5 text-body-small-default text-[var(--content-tertiary)]`,children:[c,(0,W.jsx)(`span`,{children:s})]})})}var we={running:`neutral`,completed:`positive`,error:`negative`,ended:`neutral`},Te={running:`Running`,completed:`Completed`,error:`Failed`,ended:`Ended`},Ee={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`},De=`Tool call`,Oe={read:x,edit:le,delete:re,move:s,search:te,execute:T,think:m,fetch:S,switch_mode:ee},ke=new Set([`read`,`edit`,`delete`,`move`]);function Ae({toolKind:e}){return(0,W.jsx)(e&&Oe[e]||b,{"aria-hidden":!0,className:`h-4 w-4 shrink-0 text-[var(--content-tertiary)]`})}function K({label:e,value:t,testId:n}){return(0,W.jsxs)(`div`,{"data-testid":n,children:[(0,W.jsx)(`div`,{className:`mb-1 text-body-small-default text-[var(--content-tertiary)]`,children:e}),(0,W.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 je({block:e,isTerminal:t=!1,onOpenDiff:n,onOpenOutput:r}){let[i,o]=(0,A.useState)(!1),s=(0,A.useMemo)(()=>R(e.content),[e.content]),c=(0,A.useMemo)(()=>V(e.content),[e.content]),l=(0,A.useMemo)(()=>c.split(`
|
|
3
3
|
`).map(e=>e.trim()).find(e=>e.length>0&&!e.startsWith("```"))||`View output`,[c]),u=(0,A.useMemo)(()=>U(s,e.locations),[s,e.locations]),d=t&&e.status===`running`?`ended`:e.status,f=d===`running`,p=e.toolKind&&Ee[e.toolKind]||De,m=B(e.rawInput)??e.title,_=m&&m!==p&&(!ke.has(e.toolKind??``)||u.length===0)?m:null,v=H(e.rawInput),y=H(e.rawOutput),b=v!==void 0||y!==void 0;return(0,W.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,W.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,W.jsx)(Ae,{toolKind:e.toolKind}),(0,W.jsx)(a,{variant:`body-small-emphasised`,className:`min-w-0 flex-1 truncate text-[var(--content-default)]`,title:e.title,children:p}),(0,W.jsx)(oe,{tone:we[d],"data-testid":`acp-chat-tool-status`,children:Te[d]}),f&&(0,W.jsx)(k,{className:`shrink-0`,"data-testid":`acp-chat-tool-running`})]}),_&&(0,W.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:_}),u.length>0&&(0,W.jsx)(`div`,{className:`mt-2 flex flex-wrap gap-1.5`,children:u.map(t=>{let r=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 r?(0,W.jsxs)(`button`,{type:`button`,"data-testid":`acp-chat-tool-file-chip`,onClick:()=>n(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(--border-focus)]`,children:[(0,W.jsx)(x,{"aria-hidden":!0,className:`h-3.5 w-3.5 shrink-0`}),(0,W.jsx)(`span`,{className:`truncate font-mono`,children:t.path})]},t.path):(0,W.jsxs)(`span`,{"data-testid":`acp-chat-tool-file-ref`,title:t.path,className:i,children:[(0,W.jsx)(x,{"aria-hidden":!0,className:`h-3.5 w-3.5 shrink-0`}),(0,W.jsx)(`span`,{className:`truncate font-mono`,children:t.path})]},t.path)})}),c.length>0&&(0,W.jsxs)(`button`,{type:`button`,"data-testid":`acp-chat-tool-output-open`,onClick:()=>r?.(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(--border-focus)]`,children:[(0,W.jsx)(T,{"aria-hidden":!0,className:`h-3.5 w-3.5 shrink-0 text-[var(--content-tertiary)]`}),(0,W.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-mono text-body-small-default text-[var(--content-secondary)]`,children:l}),(0,W.jsx)(g,{"aria-hidden":!0,className:`h-3.5 w-3.5 shrink-0 text-[var(--content-tertiary)]`})]}),b&&(0,W.jsxs)(`div`,{className:`mt-2`,"data-testid":`acp-chat-tool-raw`,children:[(0,W.jsxs)(`button`,{type:`button`,"data-testid":`acp-chat-tool-raw-toggle`,"aria-expanded":i,onClick:()=>o(e=>!e),className:`flex items-center gap-1 text-body-small-default text-[var(--content-tertiary)] transition-colors hover:text-[var(--content-default)]`,children:[i?(0,W.jsx)(h,{"aria-hidden":!0,className:`h-3.5 w-3.5 shrink-0`}):(0,W.jsx)(g,{"aria-hidden":!0,className:`h-3.5 w-3.5 shrink-0`}),(0,W.jsx)(`span`,{children:i?`Hide raw input/output`:`Show raw input/output`})]}),i&&(0,W.jsxs)(`div`,{className:`mt-1.5 flex flex-col gap-2`,children:[v!==void 0&&(0,W.jsx)(K,{label:`Raw input`,value:v,testId:`acp-chat-tool-raw-input`}),y!==void 0&&(0,W.jsx)(K,{label:`Raw output`,value:y,testId:`acp-chat-tool-raw-output`})]})]})]})}function Me({content:e}){return(0,W.jsx)(`div`,{"data-testid":`acp-chat-user-turn`,className:`flex w-full justify-end`,children:(0,W.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 Ne(e,t){let n=e=>new Intl.NumberFormat(void 0,{style:`currency`,currency:t}).format(e);return e>0&&e<.01?`<${n(.01)}`:n(e)}var q=new Intl.NumberFormat(`en-US`);function J({label:e,value:t}){return(0,W.jsxs)(`div`,{className:`flex items-baseline gap-1`,"data-usage-stat":e.toLowerCase(),children:[(0,W.jsx)(a,{variant:`label-small-default`,className:`text-[var(--content-tertiary)]`,children:e}),(0,W.jsx)(a,{variant:`body-small-default`,className:`text-[var(--content-secondary)] tabular-nums`,children:t})]})}function Pe({entry:e}){let{inputTokens:t,outputTokens:n,costAmount:r,costCurrency:i}=e;if(t===void 0&&n===void 0)return null;let a=t??0,o=n??0,s=r!=null&&i!=null;return(0,W.jsxs)(`div`,{className:`flex items-center gap-3`,"data-testid":`acp-usage-meter`,children:[(0,W.jsx)(J,{label:`Input`,value:q.format(a)}),(0,W.jsx)(J,{label:`Output`,value:q.format(o)}),s&&(0,W.jsx)(J,{label:`Cost`,value:Ne(r,i)})]})}function Fe({content:e,assistantId:t}){return(0,W.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,W.jsx)(C,{content:V(e),hardLineBreaks:!0,assistantId:t})})}var Y=2e3;function X(e){if(e===``)return[];let t=e.split(`
|
|
4
4
|
`);return e.endsWith(`
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{o as e}from"./chunk-jRWAZmH_.js";import{t}from"./react-BFJW0bSv.js";import{t as n}from"./button-fyWSnR9X.js";import{t as r}from"./jsx-runtime-D3ZM-ToX.js";import{t as i}from"./typography-DEI9Ra9z.js";import{m as a,n as o,t as s}from"./message-content-B6_GZQl9.js";import{_ as c,a as l,f as u,g as d,i as f,r as p,v as m,y as h}from"./transcript-message-body-shared-
|
|
1
|
+
import{o as e}from"./chunk-jRWAZmH_.js";import{t}from"./react-BFJW0bSv.js";import{t as n}from"./button-fyWSnR9X.js";import{t as r}from"./jsx-runtime-D3ZM-ToX.js";import{t as i}from"./typography-DEI9Ra9z.js";import{m as a,n as o,t as s}from"./message-content-B6_GZQl9.js";import{_ as c,a as l,f as u,g as d,i as f,r as p,v as m,y as h}from"./transcript-message-body-shared-Cp7KnGNi.js";import{t as g}from"./chevron-left-CrxnPze-.js";import"./src-ly8ixpHd.js";import{t as _}from"./chat-markdown-message-B7KyT8R6.js";import{t as v}from"./workflow-store-Y8yA0kxw.js";import{t as y}from"./background-task-store-BYeLr6QX.js";import{r as b}from"./acp-run-store-Beu3Bcgz.js";import{a as x,g as S,i as C,n as w,r as T,s as E,w as D,x as O}from"./site-favicon-CqThQ_7z.js";import{t as k}from"./detail-shell-DnpawtUB.js";import{t as A}from"./use-transcript-message-by-id-COcp9JAj.js";import{ToolDetailBody as j,t as M}from"./tool-detail-panel-DXlGhcTR.js";var N=e(t(),1);function P(e,t,n){let r=f(t,n.workflow),i=e=>{let t=u(e,n.workflow.byToolUseId);if(t!==null&&r.has(t))return!0;let i=p(e,n.acpByToolUseId);if(i!==null&&n.acpById[i]!==void 0)return!0;let a=l(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 F(e,t){let n=A(e),r=v.use.byId(),i=v.use.byToolUseId(),a=v.use.notFoundRunIds(),c=v.use.hydrationFailedRunIds(),l=b.use.byId(),u=b.use.byToolUseId(),d=y.use.byId();return(0,N.useMemo)(()=>{if(!n||t==null)return null;let e=o(n.contentBlocks??[],{splitInlineThinking:n.role!==`user`})[t];if(!e||e.type!==`activity`)return null;let{cardItems:f,toolCalls:p}=s(e.items);return P(f,p,{workflow:{byId:r,byToolUseId:i,notFoundRunIds:a,hydrationFailedRunIds:c},acpById:l,acpByToolUseId:u,backgroundTaskById:d})},[n,t,r,i,a,c,l,u,d])}var I=r(),L=60;function R({payload:e,onClose:t,assistantId:r}){let[a,o]=(0,N.useState)(null),s=F(e.messageId,e.groupIndex),l=s?.items??e.items,u=s?.toolCalls??e.toolCalls,f=h(l),p=c(f.steps),_=m(f.state,f.steps),v=_===`loading`,y=d(_,f.totalDurationLabel??``,p.failed),b=v&&f.currentStepTitle||y,x=new Map(u.map(e=>[e.id,e])),C=a?a.kind===`thinking`?`Thinking`:a.activity||a.title:``;return(0,I.jsx)(k,{titleNode:a?(0,I.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1 py-0.5`,children:[(0,I.jsx)(n,{variant:`ghost`,iconOnly:(0,I.jsx)(g,{}),"aria-label":`Back to all steps`,tooltip:`All steps`,onClick:()=>o(null),className:`-ml-2.5 shrink-0`}),(0,I.jsx)(i,{variant:`title-medium`,className:`min-w-0 shrink truncate leading-snug text-[var(--content-default)]`,children:C})]}):(0,I.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1.5 py-0.5`,children:[(0,I.jsx)(i,{variant:`title-medium`,className:`min-w-0 shrink truncate leading-snug text-[var(--content-default)]`,children:v?(0,I.jsx)(S,{children:b}):b}),f.stepCount?(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(`span`,{"aria-hidden":!0,className:`size-[3px] shrink-0 rounded-full bg-[var(--content-tertiary)]`}),(0,I.jsx)(i,{variant:`title-medium`,className:`shrink-0 whitespace-nowrap leading-snug text-[var(--content-secondary)]`,children:f.stepCount})]}):null]}),closeLabel:`Close steps`,onClose:t,children:a?(0,I.jsx)(B,{detail:a,assistantId:r}):(0,I.jsx)(E,{steps:f.steps,timeline:!0,renderStep:t=>(0,I.jsx)(z,{step:t,activeDetail:a,onOpenDetail:o,lookupToolCall:e=>x.get(e),messageId:e.messageId,groupIndex:e.groupIndex})})})}function z({step:e,activeDetail:t,onOpenDetail:n,lookupToolCall:r,messageId:i,groupIndex:o}){if(e.kind===`thinking`){let t=i!=null&&e.thinkingItemIndex!=null?{messageId:i,thinkingGroupIndex:o,thinkingItemIndex:e.thinkingItemIndex}:{};return(0,I.jsx)(C,{iconName:`brain`,label:a(D(e.text),L),ariaLabel:`View thinking`,active:!1,onClick:()=>n({kind:`thinking`,toolCallId:``,toolName:``,title:`Thinking`,activity:``,input:{},status:`completed`,thinkingText:e.text,...t})})}if(e.kind===`web_search`)return(0,I.jsx)(T,{step:e});if(e.kind===`web_search_error`)return(0,I.jsx)(w,{step:e});if(e.kind!==`tool`)return(0,I.jsx)(x,{step:e});let s=r(e.toolCallId);return(0,I.jsx)(C,{iconName:e.iconName,label:e.activity||e.info||e.title,active:t?.toolCallId===e.toolCallId,onClick:()=>{s&&n(O(s))}})}function B({detail:e,assistantId:t}){let n=M(e.kind===`thinking`?e.messageId:void 0,e.thinkingGroupIndex,e.thinkingItemIndex);return(0,I.jsx)(`div`,{className:`flex flex-col gap-4`,children:e.kind===`thinking`?(0,I.jsx)(_,{content:n??e.thinkingText??``,hardLineBreaks:!0,assistantId:t}):(0,I.jsx)(j,{detail:e})})}export{R as ActivityStepsPanel};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{o as e}from"./chunk-jRWAZmH_.js";import{t}from"./react-BFJW0bSv.js";import{t as n}from"./button-fyWSnR9X.js";import{n as r}from"./QueryClientProvider-CMu7CkQU.js";import{t as i}from"./jsx-runtime-D3ZM-ToX.js";import{t as a}from"./key-round-BFkuiQGH.js";import{t as o}from"./loader-circle-DWWXcfTQ.js";import{t as s}from"./input-B_e9sgY6.js";import{t as c}from"./modal-D946-vqt.js";import{n as l}from"./toast-DJj-rM9J.js";import{Jt as u}from"./react-query.gen-
|
|
1
|
+
import{o as e}from"./chunk-jRWAZmH_.js";import{t}from"./react-BFJW0bSv.js";import{t as n}from"./button-fyWSnR9X.js";import{n as r}from"./QueryClientProvider-CMu7CkQU.js";import{t as i}from"./jsx-runtime-D3ZM-ToX.js";import{t as a}from"./key-round-BFkuiQGH.js";import{t as o}from"./loader-circle-DWWXcfTQ.js";import{t as s}from"./input-B_e9sgY6.js";import{t as c}from"./modal-D946-vqt.js";import{n as l}from"./toast-DJj-rM9J.js";import{Jt as u}from"./react-query.gen-BAqQbp0v.js";import{t as d}from"./use-active-assistant-id-CaI-sL1J.js";var f=e(t(),1),p=i();function m(e){return[`credentials-list`,e]}function h({open:e,onClose:t,onSaved:i,initialValues:h,successToastMessage:g=`Credential saved.`}){let _=d(),v=r(),[y,b]=(0,f.useState)(h?.service??``),[x,S]=(0,f.useState)(h?.field??``),[C,w]=(0,f.useState)(h?.value??``),[T,E]=(0,f.useState)(h?.label??``),D=(0,f.useRef)(h);(0,f.useLayoutEffect)(()=>{D.current=h},[h]),(0,f.useEffect)(()=>{if(e){let e=D.current;b(e?.service??``),S(e?.field??``),w(e?.value??``),E(e?.label??``)}},[e]);let O=u({onError:e=>{l.error(e.message||`Failed to save credential`)}}),k=O.isPending,A=()=>{b(``),S(``),w(``),E(``),t()};return(0,p.jsx)(c.Root,{open:e,onOpenChange:e=>{!e&&!k&&A()},children:(0,p.jsx)(c.Content,{size:`sm`,children:(0,p.jsxs)(`form`,{onSubmit:e=>{e.preventDefault();let t=y.trim(),n=x.trim();if(!t||!n||!C.trim())return;let r=T.trim()||void 0;O.mutate({path:{assistant_id:_},body:{service:t,field:n,value:C,label:r}},{onSuccess:()=>{v.invalidateQueries({queryKey:m(_)}),l.success(g),i?.({service:t,field:n,label:r}),A()}})},children:[(0,p.jsxs)(c.Header,{children:[(0,p.jsx)(c.Title,{icon:a,children:`Add credential`}),(0,p.jsx)(c.Description,{children:`Add an API key or token to let tools and integrations use it.`})]}),(0,p.jsxs)(c.Body,{className:`flex flex-col gap-3`,children:[(0,p.jsxs)(`div`,{className:`flex flex-col gap-3 sm:flex-row`,children:[(0,p.jsx)(s,{label:`Service`,type:`text`,value:y,onChange:e=>b(e.target.value),placeholder:`e.g. github`,autoFocus:!0,fullWidth:!0}),(0,p.jsx)(s,{label:`Field`,type:`text`,value:x,onChange:e=>S(e.target.value),placeholder:`e.g. api_token`,fullWidth:!0})]}),(0,p.jsx)(s,{label:`Value`,type:`password`,value:C,onChange:e=>w(e.target.value),placeholder:`Enter the secret value`,fullWidth:!0}),(0,p.jsx)(s,{label:`Label (optional)`,type:`text`,value:T,onChange:e=>E(e.target.value),placeholder:`e.g. GitHub personal access token`,fullWidth:!0})]}),(0,p.jsxs)(c.Footer,{children:[(0,p.jsx)(n,{type:`button`,variant:`outlined`,onClick:A,disabled:k,children:`Cancel`}),(0,p.jsx)(n,{type:`submit`,variant:`primary`,disabled:k||!y.trim()||!x.trim()||!C.trim(),leftIcon:k?(0,p.jsx)(o,{className:`animate-spin`,"aria-hidden":!0}):void 0,children:`Save`})]})]})})})}export{m as n,h as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{o as e,r as t}from"./chunk-jRWAZmH_.js";import{t as n}from"./react-BFJW0bSv.js";import{t as r}from"./button-fyWSnR9X.js";import{l as i,m as a,t as o}from"./chunk-5KNZJZUH-Bsoom5--.js";import{n as s}from"./QueryClientProvider-CMu7CkQU.js";import{t as c}from"./useQuery-Bz-fbQ-m.js";import{t as l}from"./useMutation-CXGTrp4W.js";import{t as u}from"./jsx-runtime-D3ZM-ToX.js";import{t as d}from"./chevron-right-CANAtgGn.js";import{t as f}from"./circle-alert-DQMH8VJH.js";import{t as p}from"./loader-circle-DWWXcfTQ.js";import{t as m}from"./modal-D946-vqt.js";import{t as h}from"./dropdown-Dj83uU1o.js";import{d as g}from"./routes-CAe1h0Db.js";import{
|
|
1
|
+
import{o as e,r as t}from"./chunk-jRWAZmH_.js";import{t as n}from"./react-BFJW0bSv.js";import{t as r}from"./button-fyWSnR9X.js";import{l as i,m as a,t as o}from"./chunk-5KNZJZUH-Bsoom5--.js";import{n as s}from"./QueryClientProvider-CMu7CkQU.js";import{t as c}from"./useQuery-Bz-fbQ-m.js";import{t as l}from"./useMutation-CXGTrp4W.js";import{t as u}from"./jsx-runtime-D3ZM-ToX.js";import{t as d}from"./chevron-right-CANAtgGn.js";import{t as f}from"./circle-alert-DQMH8VJH.js";import{t as p}from"./loader-circle-DWWXcfTQ.js";import{t as m}from"./modal-D946-vqt.js";import{t as h}from"./dropdown-Dj83uU1o.js";import{d as g}from"./routes-CAe1h0Db.js";import{f as _}from"./platform-detection-HB9owK_1.js";import{n as v,r as y}from"./browser-CRqxfh4J.js";import{ht as b,pt as x}from"./react-query.gen-Y3EA71xS.js";import{t as S}from"./android-consumption-only-DVgl1UqJ.js";var C=t({AddCreditsModal:()=>A}),w=e(n(),1),T=u(),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:t}){let n=s(),{pathname:u}=i(),[_]=a(),S=_.toString()?`${u}?${_.toString()}`:u,{data:C,isLoading:k}=c(x()),A=C?.allowed_top_up_amounts?.length?C.allowed_top_up_amounts:E,[j,M]=(0,w.useState)(null),N=j&&A.includes(j)?j:A[0]??E[0],P=l(b());return(0,w.useEffect)(()=>y(()=>{t(!1),n.invalidateQueries(x())}),[t,n]),(0,T.jsx)(m.Root,{open:e,onOpenChange:t,children:(0,T.jsxs)(m.Content,{size:`sm`,children:[(0,T.jsxs)(m.Header,{children:[(0,T.jsx)(m.Title,{children:`Add Credits`}),(0,T.jsx)(m.Description,{children:`You'll be redirected to Stripe to complete the payment.`})]}),(0,T.jsx)(m.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:`Amount`}),(0,T.jsx)(h,{id:`add-credits-amount`,value:N,onChange:e=>{M(e),P.isError&&P.reset()},disabled:k||!C,options:A.map(e=>({value:e,label:D(e)}))})]}),P.isError&&(0,T.jsxs)(`div`,{className:`flex items-center gap-2 text-body-small-default text-[var(--system-negative-strong)]`,children:[(0,T.jsx)(f,{className:`h-3.5 w-3.5 shrink-0`}),O(P.error)]}),(0,T.jsxs)(o,{to:g.settings.usageBillingConfigureTopUps,className:`flex items-center gap-1 text-body-small-default text-[var(--content-tertiary)] hover:text-[var(--content-secondary)]`,onClick:()=>t(!1),children:[`Configure Automatic Top-Ups`,(0,T.jsx)(d,{className:`size-4`})]}),(0,T.jsx)(`div`,{className:`h-px w-full bg-[var(--border-subtle)]`})]})}),(0,T.jsxs)(m.Footer,{children:[(0,T.jsx)(m.Close,{asChild:!0,children:(0,T.jsx)(r,{variant:`outlined`,children:`Cancel`})}),(0,T.jsx)(r,{variant:`primary`,leftIcon:P.isPending?(0,T.jsx)(p,{className:`animate-spin`}):void 0,onClick:()=>{P.isPending||P.mutate({body:{amount:N,return_path:S}},{onSuccess:e=>{v(e.checkout_url)}})},disabled:P.isPending||k||!C,children:`Continue`})]})]})})}function A(e){return _()?(0,T.jsx)(m.Root,{open:e.open,onOpenChange:e.onOpenChange,children:(0,T.jsxs)(m.Content,{size:`sm`,children:[(0,T.jsxs)(m.Header,{children:[(0,T.jsx)(m.Title,{children:`Billing`}),(0,T.jsx)(m.Description,{children:S})]}),(0,T.jsx)(m.Footer,{children:(0,T.jsx)(m.Close,{asChild:!0,children:(0,T.jsx)(r,{variant:`outlined`,children:`Close`})})})]})}):(0,T.jsx)(k,{...e})}export{C as n,A as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{o as e}from"./chunk-jRWAZmH_.js";import{i as t,l as n,o as r}from"./local-settings-Bx7FsNo5.js";import{r as i,t as a}from"./capture-error-DIcLdUu5.js";import{t as o}from"./react-BFJW0bSv.js";import{t as s}from"./button-fyWSnR9X.js";import{m as c,u as l}from"./chunk-5KNZJZUH-Bsoom5--.js";import{n as u}from"./QueryClientProvider-CMu7CkQU.js";import{t as d}from"./useQuery-Bz-fbQ-m.js";import{t as f}from"./useMutation-CXGTrp4W.js";import{t as p}from"./jsx-runtime-D3ZM-ToX.js";import{t as m}from"./typography-DEI9Ra9z.js";import{t as h}from"./check-Dt2rQhdg.js";import{t as g}from"./circle-alert-DQMH8VJH.js";import{t as _}from"./circle-check-DvrCdroD.js";import{t as v}from"./menu-D7gzADvH.js";import{t as y}from"./clock-DeynsyYL.js";import{r as b,z as x}from"./src-ly8ixpHd.js";import{t as S}from"./ellipsis-vertical-qQRDY5dB.js";import{t as C}from"./external-link-GPGZ1LGU.js";import{t as w}from"./info-DkhVkzmK.js";import{t as T}from"./list-D2LnQ7lS.js";import{t as E}from"./loader-circle-DWWXcfTQ.js";import{t as D}from"./mail-DyUf40pu.js";import{t as O}from"./plus-EJu6s6xR.js";import{t as k}from"./search-DL-2uX3K.js";import{t as A}from"./trash-2-DfVRfykB.js";import{t as j}from"./triangle-alert-D6bAGtMw.js";import{t as M}from"./notice-Dslxs3H6.js";import{t as N}from"./tag-Bz-I4QwU.js";import{t as P}from"./popover-2EzQYOOf.js";import{t as F}from"./input-B_e9sgY6.js";import{t as I}from"./toggle-BEPV0rQM.js";import{t as L}from"./modal-D946-vqt.js";import{n as R}from"./toast-DJj-rM9J.js";import{t as z}from"./confirm-dialog-Ro8nszbc.js";import{t as B}from"./dropdown-Dj83uU1o.js";import{$ as V,A as H,B as U,C as W,D as G,G as K,H as ee,J as q,K as J,L as te,O as ne,Q as Y,R as X,S as Z,T as re,U as ie,V as ae,W as oe,X as se,Y as ce,Z as le,_ as ue,_t as de,a as fe,at as pe,b as me,c as he,ct as ge,d as _e,dt as ve,et as ye,f as be,ft as xe,g as Se,gt as Ce,h as we,ht as Te,i as Ee,it as De,j as Oe,k as ke,lt as Ae,m as je,mt as Me,n as Ne,nt as Pe,o as Fe,ot as Ie,p as Le,pt as Re,q as ze,r as Be,rt as Ve,st as He,t as Ue,tt as We,u as Ge,ut as Ke,v as qe,w as Je,x as Ye,y as Xe,z as Ze}from"./use-sticky-profiles-lwpGwyht.js";import{t as Qe}from"./assistant-identity-store-CBR9g2br.js";import{i as $e,n as et,o as tt,r as nt}from"./utils-CGftFn10.js";import{i as rt,r as it}from"./api-errors-37rFaJd8.js";import{Dn as at,Kt as ot,cr as st,ft as ct,j as lt,lt as ut,qt as dt}from"./sdk.gen-qwmaWHuE.js";import{d as ft}from"./routes-CAe1h0Db.js";import{f as pt}from"./platform-detection-HB9owK_1.js";import{i as mt}from"./use-platform-gate-BJ0RnKAt.js";import{r as ht}from"./use-is-org-ready-Ba1VneeM.js";import{H as gt,Rt as _t,U as vt,Ut as yt,V as bt,W as xt,c as St,d as Ct,en as wt,f as Tt,l as Et,m as Dt,p as Ot,u as kt,yt as At}from"./react-query.gen-BAqQbp0v.js";import{n as jt}from"./use-is-mobile-DVIn_Q66.js";import{c as Mt,d as Nt,f as Pt,g as Ft,h as It,l as Lt,m as Rt,o as zt,p as Bt,s as Vt,u as Ht,ut as Ut,v as Wt,y as Gt}from"./react-query.gen-Y3EA71xS.js";import{t as Kt}from"./platform-login-notice-RoCbvg6A.js";import{t as qt}from"./android-consumption-only-DVgl1UqJ.js";import{n as Jt}from"./use-voice-sample-preview-DCfnm57n.js";import{a as Yt,i as Xt,n as Zt}from"./voice-list-DSHC3x_a.js";import{t as Qt}from"./use-active-assistant-id-CaI-sL1J.js";import{t as $t}from"./detail-shell-DnpawtUB.js";import{t as en}from"./detail-card-4afu5RY8.js";import{n as tn,t as nn}from"./detail-drawer-BFIRH__A.js";import{t as rn}from"./use-platform-assistant-id-kmmtsyrT.js";import{t as an}from"./environment-store-CaT6bPjE.js";var Q=e(o(),1),$=p();function on({mode:e,onChange:t}){return(0,$.jsx)(`div`,{className:`max-w-[280px]`,children:(0,$.jsx)(x,{ariaLabel:`Service mode`,value:e,onChange:t,items:[{value:`managed`,label:`Managed`},{value:`your-own`,label:`Your Own`}]})})}function sn({id:e,title:t,subtitle:n,mode:r,onModeChange:i,children:a}){return(0,$.jsxs)(en,{id:e,title:t,subtitle:n,accessory:(0,$.jsx)(on,{mode:r,onChange:i}),children:[(0,$.jsx)(`div`,{className:`h-px bg-[var(--surface-active)]`}),(0,$.jsx)(`div`,{className:`mt-4`,children:a})]})}function cn({id:e,title:t,subtitle:n,children:r}){return(0,$.jsxs)(en,{id:e,title:t,subtitle:n,children:[(0,$.jsx)(`div`,{className:`h-px bg-[var(--surface-active)]`}),(0,$.jsx)(`div`,{className:`mt-4`,children:r})]})}function ln(){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)(w,{className:`mt-0.5 h-4 w-4 shrink-0 text-[var(--content-tertiary)]`}),(0,$.jsxs)(`p`,{className:`text-body-medium-lighter text-[var(--content-secondary)]`,children:[`Managed services are metered and deducted from your Vellum account balance.`,` `,(0,$.jsxs)(`a`,{href:`https://www.vellum.ai/docs/pricing`,target:`_blank`,rel:`noopener noreferrer`,className:`inline-flex items-center gap-1 text-[var(--primary-base)] hover:underline`,children:[`View pricing`,(0,$.jsx)(C,{className:`h-3.5 w-3.5`})]})]})]})}function un({status:e,message:t,isLoading:n}){return n?(0,$.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded-full bg-[var(--tag-bg-neutral)] px-2.5 py-0.5 text-body-small-default text-[var(--content-quiet)]`,children:[(0,$.jsx)(E,{className:`h-3 w-3 animate-spin`}),`Checking domain…`]}):e?e===`verified`?(0,$.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded-full bg-[var(--system-positive-weak)] px-2.5 py-0.5 text-body-small-default text-[var(--system-positive-strong)]`,title:`DNS records have been verified. Your domain is ready to send and receive email.`,children:[(0,$.jsx)(h,{className:`h-3 w-3`}),`Domain verified`]}):e===`pending`||e===`not_started`?(0,$.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded-full bg-[var(--system-mid-weak)] px-2.5 py-0.5 text-body-small-default text-[var(--system-mid-strong)]`,title:`DNS records have been provisioned. Waiting for the email provider to verify them — this usually takes a few minutes.`,children:[(0,$.jsx)(y,{className:`h-3 w-3`}),`Verifying domain…`]}):(0,$.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded-full bg-[var(--system-negative-weak)] px-2.5 py-0.5 text-body-small-default text-[var(--system-negative-strong)]`,title:`Domain verification failed. DNS records may not have propagated correctly. You could try releasing and re-registering the domain.`,children:[(0,$.jsx)(g,{className:`h-3 w-3`}),`Verification failed`]}):(0,$.jsx)(`span`,{className:`inline-flex items-center gap-1 rounded-full bg-[var(--tag-bg-neutral)] px-2.5 py-0.5 text-body-small-default text-[var(--content-quiet)]`,title:`Unable to retrieve domain verification status.`,children:`Unknown status`})}function dn({onClick:e,disabled:t}){return(0,$.jsx)(s,{onClick:e,disabled:t,children:`Save`})}function fn({onClick:e,filled:t=!1}){return(0,$.jsx)(s,{variant:t?`danger`:`dangerGhost`,onClick:e,children:`Reset`})}function pn({guide:e}){return(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)(w,{className:`mt-0.5 h-3.5 w-3.5 shrink-0 text-[var(--system-positive-strong)]`}),(0,$.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,$.jsx)(`span`,{children:e.description}),(0,$.jsxs)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,className:`inline-flex items-center gap-1 text-[var(--system-positive-strong)] underline hover:opacity-80`,children:[e.linkLabel,(0,$.jsx)(C,{className:`h-3 w-3`})]})]})]})}function mn({subdomain:e,onSubdomainChange:t,domainSuffix:n,subdomainPlaceholder:r=`my-assistant`,disabled:i,autoFocus:a,prefix:o,error:s,locked:c,lockedMessage:l}){return(0,$.jsxs)(`div`,{children:[(0,$.jsxs)(`div`,{className:`flex h-9 w-full items-center rounded-md border bg-[var(--field-bg)] text-body-medium-lighter transition-[border-color] duration-150 ${s?`border-[var(--system-negative-strong)]`:`border-[var(--field-border)] focus-within:border-[var(--border-active)]`}`,children:[o,(0,$.jsx)(`input`,{value:e,onChange:e=>t(e.target.value.toLowerCase().trim()),disabled:i||c,readOnly:c,autoFocus:a,placeholder:r,"aria-label":`Subdomain`,"aria-invalid":!!s,className:`h-full min-w-0 flex-1 bg-transparent ${o?`pl-1.5`:`pl-3`} pr-1 text-[var(--content-default)] placeholder:text-[var(--content-tertiary)] outline-none disabled:cursor-not-allowed disabled:opacity-60`}),(0,$.jsxs)(`span`,{className:`shrink-0 pr-3 font-mono text-[var(--content-secondary)]`,children:[`.`,n]})]}),s&&(0,$.jsx)(`p`,{className:`mt-1.5 text-body-small-default text-[var(--system-negative-strong)]`,children:s}),c&&l&&(0,$.jsx)(`p`,{className:`mt-1.5 text-body-small-default text-[var(--content-tertiary)]`,children:l})]})}function hn({assistantId:e,assistantHandle:t,emailRootDomain:n}){let r=u(),i=l(),o=pt(),[p,m]=c(),[h,g]=(0,Q.useState)(``),[_,v]=(0,Q.useState)(!1),[y,b]=(0,Q.useState)(null),[x,S]=(0,Q.useState)(``),[C,w]=(0,Q.useState)(null),[T,O]=(0,Q.useState)(!1),[k,j]=(0,Q.useState)(!1),[N,P]=(0,Q.useState)(!1);(0,Q.useEffect)(()=>{_||!t||h||(g(t),v(!0))},[t,_,h]);let F=d({...Ut(),enabled:!0}),I=F.data,L=I?.entitlements,B=L?.managed_email===!0,V=!!L&&!B,H=!I&&F.isError&&!F.isFetching,U=d({...Mt({path:{assistant_id:e}}),enabled:!V}),W=d({...Bt({path:{assistant_id:e}}),enabled:!V}),G=U.data?.results?.[0],K=W.data?.results?.[0],ee=G?`${G.subdomain}.${n}`:null,q=d({...It({path:{assistant_id:e,id:K?.id??``}}),enabled:!!K?.id,refetchOnWindowFocus:!1}),J=d({...Ht({path:{assistant_id:e,id:G?.id??``}}),enabled:!!G?.id,refetchInterval:e=>{let t=e.state.data?.status;return t===`verified`||t===`failed`?!1:1e4},refetchOnWindowFocus:!0});(0,Q.useEffect)(()=>{p.get(`release`)!==`1`||!G||K||(j(!0),m(e=>{let t=new URLSearchParams(e);return t.delete(`release`),t},{replace:!0}))},[K,G,p,m]);let te=f(zt()),ne=f(Vt()),Y=f(Nt()),X=f(Pt()),Z=(0,Q.useCallback)(()=>{let t={assistant_id:e};r.invalidateQueries({queryKey:Lt({path:t})}),r.invalidateQueries({queryKey:Rt({path:t})}),K?.id&&r.invalidateQueries({queryKey:Ft({path:{...t,id:K.id}})}),r.invalidateQueries({queryKey:Gt()})},[K?.id,e,r]),re=(0,Q.useCallback)(async()=>{let t=h.trim().toLowerCase();if(!t){b(`Enter a subdomain.`);return}O(!1);try{await te.mutateAsync({path:{assistant_id:e},body:{subdomain:t}}),g(``),b(null),Z(),R.success(`Domain ${t}.${n} registered.`)}catch(e){b(rt(e,void 0,`Failed to register domain.`))}},[e,n,Z,te,h]),ie=(0,Q.useCallback)(async()=>{let t=x.trim().toLowerCase();if(!t){w(`Enter an email username.`);return}try{await Y.mutateAsync({path:{assistant_id:e},body:{username:t}}),S(``),w(null),Z(),R.success(`Email address created.`)}catch(e){w(rt(e,void 0,`Failed to create email address.`))}},[e,Z,Y,x]),ae=(0,Q.useCallback)(async()=>{if(K?.id){P(!1);try{await X.mutateAsync({path:{assistant_id:e,id:K.id}}),Z(),R.success(`Email address removed.`)}catch(e){a(e,{context:`email_address_delete`}),R.error(`Failed to remove email address.`)}}},[K?.id,e,X,Z]),oe=(0,Q.useCallback)(async()=>{if(!G?.id)return;if(K){R.error(`Remove the email address first.`);return}j(!1);let t=G.subdomain;try{await ne.mutateAsync({path:{assistant_id:e,id:G.id}}),g(t),Z(),R.success(`Domain released.`)}catch(e){a(e,{context:`email_domain_release`}),R.error(`Failed to release domain.`)}},[K,e,ne,G?.id,G?.subdomain,Z]);if(F.isLoading)return(0,$.jsxs)(`div`,{className:`flex items-center gap-2 text-body-small-default text-[var(--content-tertiary)]`,children:[(0,$.jsx)(E,{className:`h-4 w-4 animate-spin`}),`Checking subscription…`]});if(V)return(0,$.jsx)(M,{tone:`info`,icon:(0,$.jsx)(D,{className:`h-4 w-4`,"aria-hidden":!0}),title:`Give your assistant its own email address`,actions:o?void 0:(0,$.jsx)(s,{size:`compact`,onClick:()=>i(ft.plans),children:`Upgrade`}),children:o?qt:(0,$.jsx)($.Fragment,{children:`Upgrade to a plan that includes an email address for your assistant. No provider setup required.`})});let se=H?(0,$.jsx)(M,{tone:`warning`,title:`Couldn't verify subscription status`,actions:(0,$.jsx)(s,{size:`compact`,variant:`outlined`,onClick:()=>F.refetch(),children:`Retry`}),children:`We couldn't reach the billing service. The form below assumes managed email is enabled for your org — if it isn't, registering a domain will fail.`}):null;return G?K?(0,$.jsxs)(`div`,{className:`space-y-4`,children:[se,(0,$.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,$.jsx)(`label`,{className:`block text-body-small-default text-[var(--content-tertiary)]`,children:`Address`}),(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(`span`,{className:`font-mono text-body-small-default text-[var(--content-default)]`,children:K.address}),(0,$.jsx)(un,{status:J.data?.status,message:J.data?.message,isLoading:J.isLoading}),(0,$.jsx)(s,{variant:`dangerGhost`,size:`compact`,iconOnly:(0,$.jsx)(A,{}),onClick:()=>P(!0),disabled:X.isPending,"aria-label":`Remove email address`})]}),(0,$.jsx)(z,{open:N,title:`Remove Email Address`,message:(0,$.jsxs)($.Fragment,{children:[`Are you sure you want to remove`,` `,(0,$.jsx)(`code`,{className:`rounded bg-[var(--surface-active)] px-1 py-0.5 font-mono text-[0.9em]`,children:K.address}),`? Your assistant will no longer be able to send or receive email at this address.`]}),confirmLabel:`Remove`,destructive:!0,onConfirm:ae,onCancel:()=>P(!1)})]}),q.data?.usage&&(0,$.jsxs)(`p`,{className:`text-body-small-default text-[var(--content-tertiary)]`,children:[q.data.usage.sent_today,` /`,` `,q.data.usage.daily_limit,` sent today ·`,` `,q.data.usage.received_today,` received`]})]}):(0,$.jsxs)(`div`,{className:`space-y-4`,children:[se,(0,$.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,$.jsx)(`label`,{className:`block text-body-small-default text-[var(--content-tertiary)]`,children:`Domain`}),(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsxs)(`span`,{className:`font-mono text-body-small-default text-[var(--content-default)]`,children:[G.subdomain,`.`,n]}),(0,$.jsx)(un,{status:J.data?.status,message:J.data?.message,isLoading:J.isLoading}),(0,$.jsx)(s,{variant:`dangerGhost`,size:`compact`,iconOnly:(0,$.jsx)(A,{}),onClick:()=>j(!0),disabled:ne.isPending,"aria-label":`Release domain`})]}),(0,$.jsx)(z,{open:k,title:`Release Domain`,message:(0,$.jsxs)($.Fragment,{children:[`Are you sure you want to release`,` `,(0,$.jsxs)(`code`,{className:`rounded bg-[var(--surface-active)] px-1 py-0.5 font-mono text-[0.9em]`,children:[G.subdomain,`.`,n]}),`? The subdomain will become available for others to claim.`]}),confirmLabel:`Release`,destructive:!0,onConfirm:oe,onCancel:()=>j(!1)})]}),(0,$.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,$.jsx)(`label`,{className:`block text-body-small-default text-[var(--content-tertiary)]`,children:`Email address`}),(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsxs)(`div`,{className:`flex h-9 min-w-0 flex-1 items-center rounded-md border bg-[var(--field-bg)] text-body-medium-lighter transition-[border-color] duration-150 ${C?`border-[var(--system-negative-strong)]`:`border-[var(--field-border)] focus-within:border-[var(--border-active)]`}`,children:[(0,$.jsx)(`input`,{value:x,onChange:e=>{S(e.target.value.toLowerCase()),C&&w(null)},placeholder:`hi`,"aria-label":`Email username`,"aria-invalid":!!C,className:`h-full min-w-0 flex-1 bg-transparent pl-3 pr-1 text-[var(--content-default)] placeholder:text-[var(--content-tertiary)] outline-none`}),(0,$.jsxs)(`span`,{className:`shrink-0 pr-3 font-mono text-[var(--content-secondary)]`,children:[`@`,ee]})]}),(0,$.jsx)(s,{onClick:ie,disabled:Y.isPending||!x.trim(),children:Y.isPending?`Creating…`:`Create`})]}),C&&(0,$.jsx)(`p`,{className:`text-body-small-default text-[var(--system-negative-strong)]`,children:C})]})]}):(0,$.jsxs)(`div`,{className:`space-y-3`,children:[se,(0,$.jsx)(`label`,{className:`block text-body-small-default text-[var(--content-tertiary)]`,children:`Subdomain`}),(0,$.jsx)(mn,{subdomain:h,onSubdomainChange:e=>{g(e),y&&b(null)},domainSuffix:n,subdomainPlaceholder:`my-assistant`,error:y}),(0,$.jsx)(`p`,{className:`text-body-small-default text-[var(--content-tertiary)]`,children:`Each assistant gets its own subdomain. Lowercase letters, numbers, and hyphens only.`}),(0,$.jsx)(s,{onClick:()=>O(!0),disabled:te.isPending||!h.trim(),children:te.isPending?`Registering…`:`Register`}),(0,$.jsx)(z,{open:T,title:`Set Subdomain`,message:(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`code`,{className:`rounded bg-[var(--surface-active)] px-1 py-0.5 font-mono text-[0.9em]`,children:h.trim().toLowerCase()||`subdomain`}),` `,`will also become your assistant's public handle. You won't be able to change it once set.`]}),confirmLabel:`Confirm`,onConfirm:re,onCancel:()=>O(!1)})]})}function gn(){let e=Qt(),r=ht(),{data:o}=d({...Wt(),enabled:r}),s=o?.results?.[0]?.handle,c=an.use.emailRootDomain(),l=mt(),[u,f]=(0,Q.useState)(()=>l===`gated`?`your-own`:De(t(be,`managed`),`managed`)),[p,m]=(0,Q.useState)(()=>{let e=t(_e,`resend`);return e===`mailgun`||e===`resend`?e:`resend`}),{platformAssistantId:h,error:g}=rn(e,l===`full`&&u===`managed`),v=h??(g?e:null),y=d({queryKey:[`byoEmailCredential`,e,p],queryFn:async()=>{let{data:t}=await ut({path:{assistant_id:e},body:{service:p,field:`api_key`},throwOnError:!0});return t},enabled:u===`your-own`||l===`gated`,staleTime:6e4,retry:i,meta:{errorContext:`byo_email_credential_check`}});(0,Q.useEffect)(()=>{y.error&&a(y.error,{context:`byo_email_credential_check`,bestEffort:!0})},[y.error]);let b=y.data?.hasSecret===!0,x=(0,Q.useCallback)(e=>{f(e),n(be,e)},[]),S=(0,Q.useCallback)(()=>{n(_e,p),R.success(`Email settings saved.`)},[p]),T=(0,Q.useMemo)(()=>Z.find(e=>e.id===p)??Z[0],[p]),D=(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)(w,{className:`mt-0.5 h-3.5 w-3.5 shrink-0 text-[var(--system-positive-strong)]`}),(0,$.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,$.jsxs)(`span`,{children:[`Configure `,T.displayName,` via the assistant CLI: ask the assistant to run the`,` `,(0,$.jsx)(`code`,{className:`rounded bg-[var(--surface-active)] px-1 py-0.5 text-[12px]`,children:T.setupSkill}),` `,`skill. It walks you through storing the API key, detecting the domain, and (optionally) wiring up an inbound webhook.`]}),(0,$.jsxs)(`a`,{href:T.docsUrl,target:`_blank`,rel:`noopener noreferrer`,className:`inline-flex items-center gap-1 text-[var(--system-positive-strong)] underline hover:opacity-80`,children:[`Open `,T.displayName,(0,$.jsx)(C,{className:`h-3 w-3`})]})]})]}),O=(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:`Provider`}),(0,$.jsx)(B,{value:p,onChange:e=>{(e===`mailgun`||e===`resend`)&&m(e)},options:Z.map(e=>({value:e.id,label:e.displayName}))})]}),b?(0,$.jsxs)(`div`,{className:`space-y-3`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2 rounded-lg border border-[var(--system-positive-subtle)] bg-[var(--surface-sunken)] p-3 text-body-small-default text-[var(--content-default)]`,children:[(0,$.jsx)(_,{className:`h-4 w-4 shrink-0 text-[var(--system-positive-strong)]`}),(0,$.jsxs)(`span`,{children:[T.displayName,` API key configured. To reconfigure, run the`,` `,(0,$.jsx)(`code`,{className:`rounded bg-[var(--surface-active)] px-1 py-0.5 text-[12px]`,children:T.setupSkill}),` `,`skill.`]})]}),(0,$.jsxs)(`a`,{href:T.docsUrl,target:`_blank`,rel:`noopener noreferrer`,className:`inline-flex items-center gap-1 text-body-small-default text-[var(--system-positive-strong)] underline hover:opacity-80`,children:[`Open `,T.displayName,(0,$.jsx)(C,{className:`h-3 w-3`})]})]}):D,(0,$.jsx)(`div`,{className:`flex items-center gap-2`,children:(0,$.jsx)(dn,{onClick:S,disabled:!1})})]});return l===`gated`?(0,$.jsx)(cn,{id:`email`,title:`Email`,subtitle:`Configure how your assistant sends and receives email`,children:O}):(0,$.jsx)(sn,{id:`email`,title:`Email`,subtitle:`Configure how your assistant sends and receives email`,mode:u,onModeChange:x,children:u===`managed`?(0,$.jsx)(`div`,{className:`space-y-4`,children:l===`disabled`?(0,$.jsx)(Kt,{children:`Log in to the Vellum platform to manage email settings.`}):v===null?(0,$.jsxs)(`div`,{className:`flex items-center gap-2 text-body-small-default text-[var(--content-tertiary)]`,children:[(0,$.jsx)(E,{className:`h-4 w-4 animate-spin`}),`Connecting to the Vellum platform…`]}):(0,$.jsx)(hn,{assistantId:v,assistantHandle:s,emailRootDomain:c})}):O})}function _n(){let e=Qt();return(0,Q.useCallback)(async(t,n)=>{try{let{data:r}=await st({path:{assistant_id:e},body:{value:n,type:`api_key`,name:t},throwOnError:!0});ye(r)}catch(e){throw e instanceof Error&&e.message===`No assistant found`?R.error(`Assistant not ready. Please try again.`):R.error(`Failed to save ${t} API key. Please try again.`),a(e,{context:`provision_provider_key`}),e}},[e])}function vn(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 yn=`0.11.0`;function bn(){return et(yn)}var xn=`gemini-3.1-flash-image-preview`;function Sn(){let e=Qt(),r=u(),i=ht(),{data:o}=d({...St({path:{assistant_id:e}}),enabled:i,staleTime:3e4}),s=yt({onSuccess:t=>{kt(r,{path:{assistant_id:e}},t)}}),c=_n(),[l,f]=vn((0,Q.useMemo)(()=>{if(!o)return t(je,`gemini`);let e=o.services?.[`image-generation`];return e?.mode===`managed`?`vellum`:e?.provider||t(`vellum:ai:imageGenProvider`,`gemini`)},[o])),[p,m]=(0,Q.useState)(()=>t(Le,xn)),h=ke(l),g=h.includes(p)?p:h[0]??xn,[_,v]=(0,Q.useState)(``),[y,b]=(0,Q.useState)(!1),x=Je.map(e=>({value:e,label:re[e]??e})),S=(0,Q.useMemo)(()=>ke(l).map(e=>({value:e,label:W[e]??e})),[l]),C=l===`gemini`||l===`openai`,{hasStoredCredential:w}=q({assistantId:e,credentialKind:`api_key`,credentialName:l,enabled:C}),T=f,D=(0,Q.useCallback)(async()=>{b(!0);let t=_.trim(),i=C&&t.length>0;try{i&&await c(H(g),t),await tt();let n=l===`vellum`&&!bn()?{mode:`managed`}:{provider:l,mode:l===`vellum`?`managed`:`your-own`};await s.mutateAsync({path:{assistant_id:e},body:{services:{"image-generation":n}}}).catch(e=>{throw R.error(`Failed to update assistant configuration. Please try again.`),a(e,{context:`patch_daemon_config`}),e});try{await at({path:{assistant_id:e},body:{modelId:g},throwOnError:!0})}catch(e){throw R.error(`Failed to update image generation model. Please try again.`),a(e,{context:`set_image_gen_model`}),e}finally{r.invalidateQueries({queryKey:Et({path:{assistant_id:e}})})}}catch{b(!1);return}b(!1);try{if(n(je,l),n(Le,g),i){let t=ze(e,`api_key`,l);r.setQueryData(t,!0),r.invalidateQueries({queryKey:t}),v(``)}R.success(`Image generation settings saved.`)}catch(e){a(e,{context:`settings-ai-image-gen-persist-local`}),R.error(`Saved, but local preferences could not be written.`)}},[_,l,C,g,e,s,c,r]),O=(0,Q.useCallback)(()=>{v(``),m(xn),n(Le,xn)},[]);return(0,$.jsx)(cn,{title:`Image Generation`,subtitle:`Configure which model your assistant uses to generate images`,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:`Provider`}),(0,$.jsx)(B,{"aria-label":`Image generation provider`,value:l,onChange:T,options:x})]}),l===`vellum`&&(0,$.jsx)(`p`,{className:`text-body-medium-lighter text-[var(--content-tertiary)]`,children:`Image generation runs through your Vellum account.`}),C&&(0,$.jsx)(F,{label:`API Key`,type:`password`,value:_,onChange:e=>v(e.target.value),placeholder:ee(l===`openai`?`Enter your OpenAI API key`:`Enter your Gemini API key`,w),fullWidth:!0}),(0,$.jsxs)(`div`,{className:`space-y-1`,children:[(0,$.jsx)(`label`,{className:`block text-body-small-default text-[var(--content-tertiary)]`,children:`Active Model`}),(0,$.jsx)(B,{"aria-label":`Image generation model`,value:g,onChange:m,options:S})]}),(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(dn,{onClick:D,disabled:y}),y&&(0,$.jsx)(E,{className:`h-4 w-4 animate-spin text-[var(--content-disabled)]`}),C&&(0,$.jsx)(fn,{onClick:O})]})]})})}function Cn({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)(m,{variant:`body-large-default`,as:`h3`,className:`text-[var(--content-secondary)]`,children:e}),t==null?null:(0,$.jsxs)(m,{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 wn({blocked:e,availableReplacements:t,replacement:n,onReplacementChange:r,error:i,saving:a,onClose:o,onConfirm:c}){let l=``;if(e){let t=e.label||e.name;l=e.isActive&&e.callSiteIds.length>0?`"${t}" is the active profile and is used by ${e.callSiteIds.length} call site(s). Pick a replacement profile.`:e.isActive?`"${t}" is the active profile. Pick a different active profile before deleting, or select a replacement below.`:`"${t}" is used by ${e.callSiteIds.length} call site(s). Select a replacement profile to reassign them before deleting.`}return(0,$.jsx)(L.Root,{open:e!==null,onOpenChange:e=>{e||o()},children:(0,$.jsxs)(L.Content,{size:`sm`,children:[(0,$.jsx)(L.Header,{children:(0,$.jsx)(L.Title,{children:`Can't Delete Profile`})}),(0,$.jsxs)(L.Body,{className:`space-y-4`,children:[(0,$.jsx)(m,{variant:`body-medium-default`,as:`p`,children:l}),e&&e.callSiteIds.length>0&&(0,$.jsx)(`ul`,{className:`space-y-1 pl-1`,children:e.callSiteIds.map(e=>(0,$.jsxs)(`li`,{className:`text-body-small-default text-(--content-secondary)`,children:[`• `,(0,$.jsx)(`code`,{children:e})]},e))}),(0,$.jsxs)(`div`,{className:`space-y-1`,children:[(0,$.jsx)(`label`,{className:`block text-body-small-default text-[var(--content-tertiary)]`,children:`Replacement profile`}),(0,$.jsx)(B,{"aria-label":`Replacement profile`,value:n,onChange:r,options:[{value:``,label:`Select a replacement…`},...t.map(e=>({value:e.name,label:e.label??e.name}))]})]}),i&&(0,$.jsx)(m,{variant:`body-small-default`,as:`p`,className:`text-(--system-negative-strong)`,children:i})]}),(0,$.jsxs)(L.Footer,{children:[(0,$.jsx)(s,{variant:`ghost`,size:`compact`,onClick:o,children:`Cancel`}),(0,$.jsx)(s,{variant:`primary`,size:`compact`,disabled:!n||a,onClick:c,children:a?`Saving…`:`Reassign and Delete`})]})]})})}function Tn({profile:e,isActiveProfile:t,selected:n,connections:r,onOpen:i,onMakeActive:a,onSetStatus:o,onDelete:c}){let l=e.source===`managed`,u=e.status===`disabled`,d=e.label??e.name,f=[];e.model&&f.push(X(e.provider??void 0,e.model,r)),l&&f.push(`Managed by Vellum`);let p=e.availability,m=p!=null&&p.status!==`ok`?p.message??`This profile's provider is not available.`:null;return(0,$.jsx)(b,{title:(0,$.jsx)(`span`,{className:u?`opacity-55`:void 0,children:d}),subtitle:f.length>0?f.join(` • `):void 0,onClick:i,showChevron:!1,selected:n,contentAriaLabel:`Open profile ${d}`,trailingInteractive:!0,trailing:(0,$.jsxs)($.Fragment,{children:[m==null?null:(0,$.jsx)(`span`,{title:m,className:`inline-flex`,children:(0,$.jsx)(g,{className:`h-4 w-4 text-[var(--system-mid-strong)]`,"aria-label":m,role:`img`})}),u?(0,$.jsx)(N,{tone:`neutral`,children:`Disabled`}):null,t?(0,$.jsx)(N,{tone:`positive`,children:`Default`}):null,(0,$.jsxs)(v.Root,{children:[(0,$.jsx)(v.Trigger,{asChild:!0,children:(0,$.jsx)(s,{variant:`ghost`,size:`compact`,iconOnly:(0,$.jsx)(S,{}),"aria-label":`Actions for ${d}`})}),(0,$.jsxs)(v.Content,{align:`end`,sideOffset:4,children:[(0,$.jsx)(v.Item,{onSelect:i,children:l?`View`:`Edit`}),!t&&!u?(0,$.jsx)(v.Item,{onSelect:a,children:`Make Default`}):null,u?(0,$.jsx)(v.Item,{onSelect:()=>o(!0),children:`Enable`}):l?null:(0,$.jsx)(v.Item,{onSelect:()=>o(!1),children:`Disable`}),l?null:(0,$.jsx)(v.Item,{onSelect:c,className:`text-[var(--system-negative-strong)] data-[highlighted]:text-[var(--system-negative-strong)]`,children:`Delete`})]})]})]})})}var En=`0.11.0`;function Dn(){return $e(En)}function On(e,t){let n=Dn(),{data:r}=d({...bt({path:{assistant_id:e}}),enabled:n,staleTime:3e4}),{profiles:i,profileOrder:a}=Ue(t?.llm,e);return(0,Q.useMemo)(()=>r==null?{entries:We(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])}function kn(e){let t=u();return yt({onSuccess:n=>{kt(t,{path:{assistant_id:e}},n),t.invalidateQueries({queryKey:gt({path:{assistant_id:e}})})}})}var An=`0.10.8`;function jn(e){return nt(An,e)}var Mn=`settings-ai-profile-make-active`,Nn=`Failed to set the active profile. Please try again.`;function Pn(e){let t=kn(e),n=u(),r=jn(e),i=wt({onSuccess:()=>{n.invalidateQueries({queryKey:Et({path:{assistant_id:e}})}),n.invalidateQueries({queryKey:gt({path:{assistant_id:e}})})}});async function o(n,r,i){try{await t.mutateAsync({path:{assistant_id:e},body:{llm:n}})}catch(e){throw a(e,{context:r}),R.error(i),e}}async function s(t){if(!r){await o({activeProfile:t},Mn,Nn);return}try{await i.mutateAsync({path:{assistant_id:e},body:{name:t}})}catch(e){let t=it(e);throw R.error(t??Nn),t||a(e,{context:Mn}),e}}return{makeActive:s,setStatus:(e,t)=>o({profiles:{[e]:{status:t?`active`:`disabled`}}},`settings-ai-profile-toggle`,`Failed to update the profile. Please try again.`),deleteProfile:(e,t,n)=>o({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:o,isPending:t.isPending||i.isPending}}function Fn(e,t,n){let r=Pn(e),i=t?.llm?.activeProfile??null,a=t?.llm?.advisorProfile??null,o=t?.llm?.callSites??{},s=(0,Q.useMemo)(()=>t?.llm?.profiles??{},[t?.llm?.profiles]),c=(0,Q.useMemo)(()=>t?.llm?.profileOrder??[],[t?.llm?.profileOrder]),l=(0,Q.useMemo)(()=>We(s,c),[s,c]),[u,d]=(0,Q.useState)(null),[f,p]=(0,Q.useState)(null),[m,h]=(0,Q.useState)(``),[g,_]=(0,Q.useState)(!1);async function v(e){try{await r.deleteProfile(e,c,{isAdvisor:e===a}),n?.onDeleted?.(e)}catch{}}function y(e){if(t==null)return;let n=s[e]?.label??e,r=e===i,a=Object.entries(o).filter(([t,n])=>t!==`mainAgent`&&n?.profile===e).map(([e])=>e);if(r||a.length>0){d({name:e,label:n,isActive:r,callSiteIds:a}),h(``),p(null);return}v(e)}async function b(){if(!u||!m)return;_(!0),p(null);let e={};if(u.isActive&&(e.activeProfile=m),u.callSiteIds.length>0){let t={};for(let e of u.callSiteIds)t[e]={profile:m};e.callSites=t}if(Object.keys(e).length>0)try{await r.patchLlm(e,`settings-ai-profile-reassign-delete`,`Failed to reassign references. Please try again.`)}catch{p(`Failed to reassign references. Please try again.`),_(!1);return}let t=u.name;d(null),_(!1),v(t)}let x=l.filter(e=>e.name!==u?.name&&e.source!==`managed`);return{requestDelete:y,blockedDeleteModalProps:{blocked:u,availableReplacements:x.length>0?x:l.filter(e=>e.name!==u?.name),replacement:m,onReplacementChange:h,error:f,saving:g,onClose:()=>{d(null),p(null)},onConfirm:()=>void b()}}}function In(){}function Ln({assistantId:e,config:t,connections:n,selectedProfileName:r,onOpenProfile:i,onCreateProfile:a,onProfileDeleted:o}){let{entries:c}=On(e,t),l=Pn(e),u=Fn(e,t,{onDeleted:o}),d=t?.llm?.activeProfile??null;return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(Cn,{title:`Profiles`,action:(0,$.jsx)(s,{variant:`primary`,size:`compact`,onClick:a,leftIcon:(0,$.jsx)(O,{}),disabled:t==null,children:`Create Profile`}),children:t==null?(0,$.jsx)(m,{variant:`body-medium-lighter`,as:`p`,className:`py-4 text-center text-(--content-tertiary)`,children:`Loading profiles…`}):c.length===0?(0,$.jsx)(m,{variant:`body-medium-lighter`,as:`p`,className:`py-4 text-center text-(--content-tertiary)`,children:`No profiles yet. Create one to get started.`}):c.map(e=>(0,$.jsx)(Tn,{profile:e,isActiveProfile:e.name===d,selected:e.name===r,connections:n,onOpen:()=>i(e.name),onMakeActive:()=>void l.makeActive(e.name).catch(In),onSetStatus:t=>void l.setStatus(e.name,t).catch(In),onDelete:()=>u.requestDelete(e.name)},e.name))}),(0,$.jsx)(wn,{...u.blockedDeleteModalProps})]})}var Rn={anthropic:!0,openai:!0,gemini:!0,fireworks:!0,openrouter:!0,vellum:!0,together:!0,"vercel-ai-gateway":!0,minimax:!0,atlascloud:!0,baseten:!0,poolside:!0};function zn(e){return e in Rn}function Bn(e){let t=e.baseUrl??``;try{e.baseUrl&&(t=new URL(e.baseUrl).host)}catch{}let 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 Vn(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 Hn(e){if(e.provider===`vellum`)return`Included with your plan`;if(e.provider===`openai-compatible`)return Bn(e);let t=[],n=e.models?.length??de(e.provider).length;n>0&&t.push(`${n} ${n===1?`model`:`models`}`);let r=Vn(e);return r&&t.push(r),t.join(` • `)}function Un({connection:e,isDefault:t,supportsDefaultProvider:n,selected:r,isSettingDefault:i,onOpen:a,onSetDefault:o,onDelete:c}){let l=e.isManaged??!1,u=Y(e),d=zn(e.provider),f=Hn(e),p=n&&!t&&d,m=!l&&a!=null,h=!l&&!t,g=p||m||h;return(0,$.jsx)(b,{title:u,subtitle:f.length>0?f:void 0,onClick:a,showChevron:!1,selected:r,contentAriaLabel:a?`Open provider ${u}`:void 0,trailingInteractive:!0,trailing:(0,$.jsxs)($.Fragment,{children:[l?(0,$.jsx)(N,{tone:`neutral`,title:`Runs on Vellum's managed credentials.`,children:`Managed`}):null,t?(0,$.jsx)(N,{tone:`info`,title:`Built-in profiles (Balanced, Quality, Cost, Speed) use this provider.`,children:`Default`}):null,e.provider===`ollama`?(0,$.jsx)(N,{tone:`neutral`,title:`Runs models on this machine.`,children:`Local`}):null,e.provider===`openai-compatible`?(0,$.jsx)(N,{tone:`neutral`,title:`A provider you created, served by an OpenAI-compatible endpoint.`,children:`Custom`}):null,g?(0,$.jsxs)(v.Root,{children:[(0,$.jsx)(v.Trigger,{asChild:!0,children:(0,$.jsx)(s,{variant:`ghost`,size:`compact`,iconOnly:(0,$.jsx)(S,{}),"aria-label":`Actions for ${u}`})}),(0,$.jsxs)(v.Content,{align:`end`,sideOffset:4,children:[m?(0,$.jsx)(v.Item,{onSelect:a,children:`Edit`}):null,p?(0,$.jsx)(v.Item,{disabled:i,onSelect:o,children:`Set as default`}):null,h?(0,$.jsx)(v.Item,{onSelect:c,className:`text-[var(--system-negative-strong)] data-[highlighted]:text-[var(--system-negative-strong)]`,children:`Delete`}):null]})]}):(0,$.jsx)(`span`,{className:`inline-block w-8`,"aria-hidden":!0})]})})}function Wn(e,t){let n=u(),r={path:{assistant_id:e}},i=f({...Dt(),onSuccess:()=>{n.invalidateQueries({queryKey:Ot(r)}),n.invalidateQueries({queryKey:Et(r)}),n.invalidateQueries({queryKey:gt(r)})},onError:e=>{a(e,{context:`settings-ai-set-default-provider`}),R.error(`Failed to set the default provider. Please try again.`)}});function o(t){zn(t.provider)&&i.mutate({path:{assistant_id:e},body:{provider:t.provider,connectionName:t.name}})}function s(e){return i.isPending&&i.variables?.body?.connectionName===e}async function c(i){try{let{response:a}=await ot({path:{assistant_id:e,name:i}});a?.ok||a?.status===404?(n.invalidateQueries({queryKey:xt(r)}),t?.onDeleted?.(i)):a?.status===409?R.error(`This provider is in use by a profile or as the default provider. Update those settings before deleting it.`):R.error(`Failed to delete the provider. Please try again.`)}catch(e){a(e,{context:`settings-ai-provider-delete`}),R.error(`Failed to delete the provider. Please try again.`)}}return{setDefault:o,isSettingDefault:s,deleteConnection:c}}var Gn=`0.10.8`;function Kn(){return $e(Gn)}function qn({assistantId:e,selectedConnectionName:t,onOpenConnection:n,onAddProvider:r,onConnectionDeleted:i}){let{data:a,isLoading:o,isError:c}=d(vt({path:{assistant_id:e}})),l=Kn(),{data:u}=d({...Tt({path:{assistant_id:e}}),enabled:l}),f=l?u?.resolvedConnectionName??null:null,p=Wn(e,{onDeleted:i}),h=(0,Q.useMemo)(()=>{let e=a?.connections??[];return[...e.filter(e=>e.provider===Me),...e.filter(e=>e.provider!==Me)]},[a]);return(0,$.jsx)(Cn,{title:`Providers`,action:(0,$.jsx)(s,{variant:`outlined`,size:`compact`,onClick:r,leftIcon:(0,$.jsx)(O,{}),children:`Add Provider`}),children:o?(0,$.jsx)(`div`,{className:`space-y-2 py-2`,children:[1,2,3].map(e=>(0,$.jsx)(`div`,{className:`h-10 animate-pulse rounded-lg bg-[var(--surface-active)]`},e))}):c?(0,$.jsx)(m,{variant:`body-medium-default`,as:`p`,className:`py-4 text-center text-(--system-negative-strong)`,children:`Failed to load providers. Please try again.`}):h.length===0?(0,$.jsx)(m,{variant:`body-medium-lighter`,as:`p`,className:`py-4 text-center text-(--content-tertiary)`,children:`No providers yet. Add one to get started.`}):h.map(e=>(0,$.jsx)(Un,{connection:e,isDefault:e.name===f,supportsDefaultProvider:l,selected:e.name===t,isSettingDefault:p.isSettingDefault(e.name),onOpen:e.isManaged??!1?void 0:()=>n(e.name),onSetDefault:()=>p.setDefault(e),onDelete:()=>void p.deleteConnection(e.name)},e.name))})}function Jn({panel:e,onOpenPanel:t,onClosePanel:n}){let r=Qt(),{data:i}=d({...St({path:{assistant_id:r}}),staleTime:3e4}),a=Kn(),{data:o}=d({...Tt({path:{assistant_id:r}}),enabled:a}),c=o?.availability,{data:l}=d({...vt({path:{assistant_id:r}})}),u=l?.connections,f=i?.llm?.callSites??{},p=Object.entries(f).filter(([e,t])=>e!==`mainAgent`&&(t?.profile!=null||t?.provider!=null||t?.model!=null)).length;return(0,$.jsx)(cn,{title:`Language Model`,subtitle:`Profiles choose which model answers. Providers supply access to it`,children:(0,$.jsxs)(`div`,{className:`space-y-2`,children:[c&&c.status!==`ok`&&(0,$.jsx)(M,{tone:c.status===`unknown`?`warning`:`error`,children:c.message??`Your default provider is not available.`}),r&&(0,$.jsx)(Ln,{assistantId:r,config:i,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()}}),r&&(0,$.jsx)(qn,{assistantId:r,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)(Cn,{title:`Overrides`,count:p,action:(0,$.jsx)(s,{variant:`outlined`,size:`compact`,onClick:()=>t({kind:`overrides`}),children:`Manage`})})]})})}function Yn(e,{onSaved:t}={}){let n=kn(e),{data:r}=d({...St({path:{assistant_id:e}}),staleTime:3e4}),i=(0,Q.useMemo)(()=>r?.llm?.profiles??{},[r?.llm?.profiles]),o=r?.llm?.profileOrder??[];async function s(r,s,c){let l=c?.mode??`replace`,u=!(r in i);if(l===`merge`&&!u){await n.mutateAsync({path:{assistant_id:e},body:{llm:{profiles:{[r]:s}}}}),t?.();return}let d={profiles:{[r]:s}};if(u&&(d.profileOrder=o.includes(r)?o:[...o,r]),u)await n.mutateAsync({path:{assistant_id:e},body:{llm:d}});else{let t=i[r];await n.mutateAsync({path:{assistant_id:e},body:{llm:{profiles:{[r]:null}}}});try{await n.mutateAsync({path:{assistant_id:e},body:{llm:d}})}catch(i){throw a(i,{context:`settings-ai-profile-edit-recreate`}),t!=null&&await n.mutateAsync({path:{assistant_id:e},body:{llm:{profiles:{[r]:t}}}}).catch(()=>{}),i}}u&&R.success(`Profile "${s.label??r}" created`),t?.()}return{saveProfile:s,isPending:n.isPending}}function Xn({assistantId:e,profileName:t,onClose:n}){let{data:r}=d({...St({path:{assistant_id:e}}),staleTime:3e4}),{data:i}=d({...vt({path:{assistant_id:e}})}),a=i?.connections,o=(0,Q.useMemo)(()=>r?.llm?.profiles??{},[r?.llm?.profiles]),c=Object.keys(o),l=(0,Q.useMemo)(()=>{if(t==null)return;let e=o[t];return e?{name:t,...e}:void 0},[t,o]),u=t==null?`create`:l?.source===`managed`||l?.invariant===!0?`view`:`edit`,{saveProfile:f,isPending:p}=Yn(e,{onSaved:n}),m=te({mode:u,profileName:t??void 0,initialValues:l,existingNames:c,connections:a,assistantId:e,onSave:f}),h=Fn(e,r,{onDeleted:()=>n()}),g=t!=null&&r!=null&&!(t in o);(0,Q.useEffect)(()=>{g&&!m.saving&&!p&&n()},[g,m.saving,p,n]);let _=u===`view`;return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)($t,{title:m.effectiveMode===`create`?`New Profile`:l?.label??t??`Profile`,closeVariant:`outlined`,onClose:n,headerTrailing:_&&m.effectiveMode!==`create`?(0,$.jsx)(N,{tone:`neutral`,children:`Managed by Vellum`}):null,headerActions:m.effectiveMode!==`create`&&!m.isReadOnly?(0,$.jsx)(s,{variant:`outlined`,size:`compact`,leftIcon:(0,$.jsx)(A,{}),tintColor:`var(--system-negative-strong)`,onClick:()=>{t!=null&&h.requestDelete(t)},disabled:m.saving,children:`Delete`}):null,footer:m.isReadOnly?(0,$.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,$.jsx)(s,{variant:`outlined`,onClick:m.switchToSaveAsNew,disabled:m.saving,children:`Save As New`}),m.hasViewModeChanges?(0,$.jsx)(s,{variant:`primary`,onClick:()=>void m.handleSave(),disabled:m.saving,children:m.saving?`Saving…`:`Save`}):null]}):(0,$.jsx)(`div`,{className:`flex justify-end`,children:(0,$.jsx)(s,{variant:`primary`,onClick:()=>void m.handleSave(),disabled:m.isInvalid||m.saving,children:m.saving?`Saving…`:m.effectiveMode===`create`?`Create Profile`:`Save Changes`})}),children:(0,$.jsx)(Ze,{editor:m,assistantId:e,connections:a,variant:`panel`})}),(0,$.jsx)(wn,{...h.blockedDeleteModalProps})]})}function Zn({value:e,profileOptions:t,disabled:n,onChange:r}){return(0,$.jsx)(`div`,{className:`rounded-lg border border-[var(--border-base)] bg-[var(--surface-base)] 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:`Advisor`}),(0,$.jsx)(`p`,{className:`mt-0.5 text-body-small-default text-[var(--content-tertiary)]`,children:`The profile your assistant consults for a second opinion when it wants to check a plan or review its own work.`})]}),(0,$.jsx)(`div`,{className:`flex shrink-0 items-center gap-2`,children:(0,$.jsx)(B,{value:e,onChange:r,options:t,placeholder:`Choose profile…`,className:`w-44`,menuMinWidth:280,menuAlign:`end`,disabled:n})})]})})}var Qn=`__custom__`;function $n(e){return e?!!(e.profile||e.provider||e.model):!1}function er(e,t){let n=$n(e);return n===$n(t)?n?(e?.profile??null)===(t?.profile??null)&&(e?.provider??null)===(t?.provider??null)&&(e?.model??null)===(t?.model??null):!0:!1}function tr({id:e,displayName:t,description:n,defaultProfileLabel:r,draft:i,profileOptions:a,onDraftChange:o,onToggle:s}){let c=$n(i),l=!i||!c?``:i.provider||i.model?Qn:i.profile??``,u=l===Qn,d=ce(),f=d[0]??Re[0],p=d.find(e=>e===i?.provider)??f,m=de(p).map(e=>({value:e.id,label:e.displayName})),h=!!i?.provider&&!i?.model;function g(t){t===`__custom__`?o(e,{profile:null,provider:f,model:Ce(f)??``}):t===``?o(e,null):o(e,{profile:t,provider:null,model:null})}function _(t){let n=Ce(t)??``;o(e,{...i??{},profile:null,provider:t,model:n})}function v(t){o(e,{...i??{},model:t})}return(0,$.jsxs)(`div`,{className:`rounded-lg border border-[var(--border-base)] bg-[var(--surface-base)] 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,$.jsxs)(`span`,{className:`ml-1.5 text-body-small-default text-[var(--content-tertiary)] opacity-60`,children:[`· Default: `,r]})]})]}),(0,$.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2`,children:[c&&(0,$.jsx)(B,{value:l,onChange:g,options:a,className:`w-44`,menuMinWidth:280,menuAlign:`end`}),(0,$.jsx)(I,{checked:c,onChange:t=>s(e,t),"aria-label":`Override ${t}`})]})]}),c&&u&&(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:`Provider`}),(0,$.jsx)(B,{value:p??``,onChange:_,options:d.map(e=>({value:e,label:Te[e]??e}))})]}),(0,$.jsxs)(`div`,{className:`flex-1`,children:[(0,$.jsx)(`label`,{className:`mb-1 block text-body-small-default text-[var(--content-tertiary)]`,children:`Model`}),(0,$.jsx)(B,{value:i?.model??``,onChange:v,options:m})]})]}),h&&(0,$.jsx)(`p`,{className:`text-body-small-default text-[var(--system-negative-strong)]`,children:`Pick a model`})]})]})}function nr({assistantId:e,onClose:t}){let n=u(),{data:r}=d({...St({path:{assistant_id:e}}),staleTime:3e4}),i=(0,Q.useMemo)(()=>r?.llm?.profiles??{},[r?.llm?.profiles]),o=(0,Q.useMemo)(()=>r?.llm?.profileOrder??[],[r?.llm?.profileOrder]),c=(0,Q.useMemo)(()=>r?.llm?.callSites??{},[r?.llm?.callSites]),l=(0,Q.useMemo)(()=>We(i,o),[i,o]),f=ce(),p=yt({onSuccess:t=>{kt(n,{path:{assistant_id:e}},t)}}),[m,h]=(0,Q.useState)(``),[g,_]=(0,Q.useState)({}),[v,y]=(0,Q.useState)(void 0),[b,x]=(0,Q.useState)(!1),[S,C]=(0,Q.useState)(!1),{data:w,isLoading:T,isError:D,refetch:O}=d({...Ct({path:{assistant_id:e}}),enabled:!!e,staleTime:6e4,refetchOnWindowFocus:!1}),A=(0,Q.useMemo)(()=>(w?.callSites??[]).filter(e=>e.id!==`mainAgent`),[w]),j=!T&&!D&&!!w,M=!!r,N=j&&M,P=(0,Q.useMemo)(()=>A.map(e=>e.id),[A]),I=(0,Q.useMemo)(()=>{if(!N)return{};let e={};for(let t of P)if(t in g)e[t]=g[t];else{let n=c[t];e[t]=n?{...n}:{}}return e},[N,P,c,g]),L=(0,Q.useMemo)(()=>new Set(P),[P]),B=(0,Q.useCallback)(e=>l.find(t=>t.name===e)?.label??e,[l]),V=r?.llm?.advisorProfile??``,H=v??V,U=H!==V,W=(0,Q.useMemo)(()=>Ee(l,[V]).map(e=>({value:e.name,label:Ne(e)})),[l,V]),G=(0,Q.useMemo)(()=>{let e=m.trim().toLowerCase();return e===``||`advisor`.includes(e)||`second opinion`.includes(e)},[m]),K=(0,Q.useMemo)(()=>Object.entries(c).some(([e,t])=>L.has(e)&&(t?.profile!=null||t?.provider!=null||t?.model!=null)),[c,L]),ee=(0,Q.useMemo)(()=>{if(!N)return!1;for(let e of Object.keys(I))if(!er(I[e],c[e]))return!0;return!1},[N,I,c]),q=U||ee,J=(0,Q.useMemo)(()=>Object.values(I).some(e=>$n(e)&&!!e?.provider&&!e?.model),[I]),te=(0,Q.useCallback)(e=>[...Ee(l,[e]).map(e=>({value:e.name,label:Ne(e)})),{value:Qn,label:`Custom`}],[l]),ne=(0,Q.useMemo)(()=>{if(!m.trim())return A;let e=m.toLowerCase();return A.filter(t=>(t.displayName??``).toLowerCase().includes(e)||(t.description??``).toLowerCase().includes(e)||(t.domain??``).toLowerCase().includes(e))},[A,m]),Y=(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=ne.filter(e=>e.domain===r);e.length>0&&n.push({domain:t.get(r),sites:e})}let r=new Set(e),i=ne.filter(e=>!r.has(e.domain));return i.length>0&&n.push({domain:{id:`other`,displayName:`Other`},sites:i}),n},[w,ne]),X=(0,Q.useCallback)((e,t)=>{_(n=>({...n,[e]:t}))},[]),Z=(0,Q.useCallback)((e,t)=>{if(!t){_(t=>({...t,[e]:null}));return}let n=Be(l,A.find(t=>t.id===e)?.defaultProfile);if(n)_(t=>({...t,[e]:{profile:n}}));else{let t=f[0]??Re[0],n=Ce(t)??``;_(r=>({...r,[e]:{provider:t,model:n}}))}},[A,l,f]),re=(0,Q.useCallback)(async()=>{x(!0);try{let n={};for(let e of Object.keys(I)){let t=I[e]??null;$n(t)?n[e]={profile:t?.profile??null,provider:t?.provider??null,model:t?.model??null}:e in g&&g[e]===null&&(n[e]=null)}await p.mutateAsync({path:{assistant_id:e},body:{llm:{...ee?{callSites:n}:{},...U?{advisorProfile:H}:{}}}}),t(),R.success(`Overrides saved.`)}catch(e){R.error(`Failed to save overrides. Please try again.`),a(e,{context:`call_site_overrides_save`})}finally{x(!1)}},[I,g,ee,U,H,t,p,e]),ie=(0,Q.useCallback)(async()=>{x(!0);try{let n={};for(let e of Object.keys(I))n[e]=null;await p.mutateAsync({path:{assistant_id:e},body:{llm:{callSites:n}}}),t(),R.success(`Overrides reset.`)}catch(e){R.error(`Failed to reset overrides. Please try again.`),a(e,{context:`call_site_overrides_reset`})}finally{x(!1)}},[I,t,p,e]);return(0,$.jsxs)($t,{title:`Action Overrides`,closeVariant:`outlined`,onClose:t,footer:(0,$.jsxs)(`div`,{className:`flex items-center justify-end gap-2`,children:[K&&(0,$.jsx)(s,{variant:`outlined`,size:`compact`,onClick:()=>C(!0),disabled:b||!N,tintColor:`var(--system-negative-strong)`,className:`mr-auto`,children:`Reset to Defaults`}),(0,$.jsx)(s,{variant:`primary`,size:`compact`,onClick:()=>void re(),disabled:!q||J||b,children:b?(0,$.jsx)(E,{className:`h-4 w-4 animate-spin`}):`Save`})]}),children:[(0,$.jsx)(`p`,{className:`mb-4 text-body-medium-lighter text-[var(--content-tertiary)]`,children:`Customize which model profile specific actions should use. Uses your default profile if no override is set.`}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`div`,{className:`mb-4`,children:(0,$.jsx)(F,{type:`search`,value:m,onChange:e=>h(e.target.value),placeholder:`Search actions…`,leftIcon:(0,$.jsx)(k,{className:`h-4 w-4`}),fullWidth:!0})}),M&&G&&(0,$.jsxs)(`div`,{className:`mb-4`,children:[(0,$.jsx)(`p`,{className:`mb-2 text-body-small-default font-semibold uppercase tracking-wider text-[var(--content-tertiary)]`,children:`Advisor`}),(0,$.jsx)(Zn,{value:H,profileOptions:W,disabled:b,onChange:y})]}),T&&(0,$.jsx)(`div`,{className:`flex items-center justify-center py-12`,children:(0,$.jsx)(E,{className:`h-6 w-6 animate-spin text-[var(--content-tertiary)]`})}),D&&(0,$.jsxs)(`div`,{className:`flex flex-col items-center gap-3 py-12 text-center`,children:[(0,$.jsx)(`p`,{className:`text-body-medium-default text-[var(--content-default)]`,children:`Couldn't load actions`}),(0,$.jsx)(`p`,{className:`text-body-medium-lighter text-[var(--content-tertiary)]`,children:`Make sure your assistant is running`}),(0,$.jsx)(s,{variant:`outlined`,size:`compact`,onClick:()=>void O(),children:`Retry`})]}),!T&&!D&&w&&(0,$.jsx)(`div`,{className:`space-y-4`,children:Y.length===0?G?null:(0,$.jsx)(`p`,{className:`py-8 text-center text-body-medium-lighter text-[var(--content-tertiary)]`,children:`No actions match your search.`}):Y.map(({domain:e,sites:t})=>(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`p`,{className:`mb-2 text-body-small-default font-semibold uppercase tracking-wider text-[var(--content-tertiary)]`,children:e.displayName}),(0,$.jsx)(`div`,{className:`space-y-1`,children:t.map(e=>{let t=(()=>{let t=I[e.id]??null;return!t||!$n(t)?``:t.provider||t.model?`__custom__`:t.profile??``})(),n=e.shippedDefaultProfile??e.defaultProfile,r=n?B(n):null;return(0,$.jsx)(tr,{id:e.id,displayName:e.displayName,description:e.description,defaultProfileLabel:r,draft:I[e.id]??null,profileOptions:te(t===``||t===`__custom__`?null:t),onDraftChange:X,onToggle:Z},e.id)})})]},e.id))})]}),(0,$.jsx)(z,{open:S,title:`Reset to Defaults`,message:`Every action override will be reset and will follow its default. This cannot be undone.`,confirmLabel:`Reset to Defaults`,destructive:!0,onConfirm:()=>{C(!1),ie()},onCancel:()=>C(!1)})]})}function rr({mode:e,connection:t,assistantId:n,existingNames:r,connections:i,variant:a=`modal`,onSave:o,onCancel:c}){let[l,d]=(0,Q.useState)(t?.label??``),f=t?.name??``,p=t?.provider??`anthropic`,h=t?.auth.type??`api_key`,[g,_]=(0,Q.useState)(()=>t?.auth.type===`api_key`?t.auth.credential:t?``:`credential/anthropic/api_key`),[v,y]=(0,Q.useState)(t?.baseUrl??``),[b,x]=(0,Q.useState)(()=>t?.models?t.models.map(e=>e.id).join(`, `):``),[S,C]=(0,Q.useState)(!1),[w,T]=(0,Q.useState)(null),E=p===`openai-compatible`,[D,O]=(0,Q.useState)(``),[k,A]=(0,Q.useState)(!1),j=u(),M=(0,Q.useMemo)(()=>le(g),[g]),N=h===`api_key`&&M!==null,{hasStoredCredential:P,isLoading:I}=q({assistantId:n,credentialKind:`credential`,credentialName:M?`${M.service}:${M.field}`:``,enabled:N}),{credentials:R}=ae({assistantId:n,enabled:h===`api_key`});(0,Q.useEffect)(()=>{let e=t?.provider??`anthropic`;d(t?.label??``),t?.auth.type===`api_key`?_(t.auth.credential):_(t?``:`credential/${e}/api_key`),T(null),y(t?.baseUrl??``),x(t?.models?t.models.map(e=>e.id).join(`, `):``),O(``),A(!1)},[t]);let z=l.trim()!==(t?.label??``).trim(),B=E&&z?K(l,i,t?.name):null,H=f.trim().length>0&&B===null;async function W(){if(H){C(!0),T(null);try{let e;if(h===`api_key`){let t=g.trim()||`credential/${p}/api_key`,r=D.trim();if(r){A(!0);try{let e=le(t);await st({path:{assistant_id:n},body:e?{type:`credential`,name:`${e.service}:${e.field}`,value:r}:{type:`api_key`,name:p,value:r},throwOnError:!0});let i=ze(n,`credential`,e?`${e.service}:${e.field}`:``);j.setQueryData(i,!0),j.invalidateQueries({queryKey:At({path:{assistant_id:n}})})}catch{T(`Failed to save API key. Please try again.`);return}finally{A(!1)}}e={type:`api_key`,credential:t}}else if(t)e=t.auth;else{T(`Nothing to edit. Close and try again.`);return}let r=l.trim()||null,i={auth:e,label:r,...E&&{base_url:v.trim()||null,models:b.trim()?b.split(`,`).map(e=>({id:e.trim()})).filter(e=>e.id):null}},{data:a,error:s,response:c}=await dt({path:{assistant_id:n,name:t?.name??f.trim()},body:i});if(!c?.ok){T(V(c?.status,s)??se(c?.status));return}if(!a){T(`Server returned an empty response. Please try again.`);return}o(a)}catch{T(`Failed to save provider. Please try again.`)}finally{C(!1)}}}let G=R.filter(e=>e.service===p),te=e!==`create`&&t?.auth.type===`api_key`,ne=G.length>0||te,X=ee(`Enter your API key`,P);if(e===`create`)return(0,$.jsx)(U,{variant:a===`panel`?`inline`:`modal`,assistantId:n,existingNames:r,connections:i,defaultProviderType:p,onCreated:o,onCancel:c});let Z=(0,$.jsxs)(`div`,{className:`space-y-4`,children:[(0,$.jsxs)(`div`,{className:`space-y-1`,children:[(0,$.jsxs)(`label`,{className:`block text-body-small-default text-[var(--content-tertiary)]`,children:[`Display Name`,` `,(0,$.jsx)(`span`,{className:`text-[var(--content-disabled)]`,children:`(optional)`})]}),(0,$.jsx)(F,{value:l,onChange:e=>d(e.target.value),placeholder:`e.g. My Anthropic Key`,fullWidth:!0}),B?(0,$.jsx)(m,{variant:`body-small-default`,as:`p`,className:`text-(--system-negative-strong)`,children:oe[B]}):null]}),E&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`div`,{className:`space-y-1`,children:[(0,$.jsx)(`label`,{className:`block text-body-small-default text-[var(--content-tertiary)]`,children:`Base URL`}),(0,$.jsx)(F,{value:v,onChange:e=>y(e.target.value),placeholder:`https://api.example.com/v1`,fullWidth:!0})]}),(0,$.jsxs)(`div`,{className:`space-y-1`,children:[(0,$.jsx)(`label`,{className:`block text-body-small-default text-[var(--content-tertiary)]`,children:`Models`}),(0,$.jsx)(F,{value:b,onChange:e=>x(e.target.value),placeholder:`model-1, model-2`,fullWidth:!0}),(0,$.jsx)(m,{variant:`body-small-default`,as:`p`,className:`text-[var(--content-tertiary)]`,children:`Comma-separated model identifiers exposed by your endpoint.`})]})]}),h===`api_key`&&(0,$.jsx)(ie,{apiKeyValue:D,onApiKeyChange:O,credential:g,onCredentialChange:_,isLoadingCredential:I,apiKeyPlaceholder:X,provider:p,providerCredentials:G,showAdvancedSection:ne,onError:T}),h===`oauth_subscription`&&(0,$.jsx)(J,{assistantId:n,onConnected:o}),w&&(0,$.jsx)(m,{variant:`body-small-default`,as:`p`,className:`text-(--system-negative-strong)`,children:w})]}),re=(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(s,{variant:`ghost`,size:`compact`,onClick:c,children:`Cancel`}),(0,$.jsx)(s,{variant:`primary`,size:`compact`,disabled:!H||S||k,onClick:()=>void W(),children:S?`Saving…`:`Save Changes`})]});return a===`panel`?(0,$.jsxs)(`div`,{className:`space-y-4`,children:[Z,(0,$.jsx)(`div`,{className:`flex justify-end gap-2`,children:re})]}):(0,$.jsxs)(L.Content,{size:`md`,children:[(0,$.jsxs)(L.Header,{children:[(0,$.jsx)(L.Title,{children:`Edit Provider`}),(0,$.jsx)(L.Description,{children:t?`Editing ${Y(t)}.`:`Edit provider settings.`})]}),(0,$.jsx)(L.Body,{children:Z}),(0,$.jsx)(L.Footer,{children:re})]})}function ir({assistantId:e,connectionName:t,onClose:n}){let r=u(),{data:i}=d(vt({path:{assistant_id:e}})),a=(0,Q.useMemo)(()=>i?.connections??[],[i]),o=(0,Q.useMemo)(()=>t==null?void 0:a.find(e=>e.name===t),[t,a]),s=t!=null&&i!=null&&o==null;(0,Q.useEffect)(()=>{s&&n()},[s,n]);function c(){r.invalidateQueries({queryKey:xt({path:{assistant_id:e}})}),r.invalidateQueries({queryKey:Ot({path:{assistant_id:e}})}),n()}return(0,$.jsx)($t,{title:o?Y(o):`Add Provider`,closeVariant:`outlined`,onClose:n,children:t==null||o!=null?(0,$.jsx)(rr,{mode:o?`edit`:`create`,connection:o,variant:`panel`,assistantId:e,existingNames:a.map(e=>e.name),connections:a,onSave:c,onCancel:n}):null})}function ar({open:e,onOpenChange:t,title:n,currentCode:r,configuredProviderId:i,suggestedCode:a,selectLanguage:o,selecting:s}){return(0,$.jsx)(L.Root,{open:e,onOpenChange:t,children:(0,$.jsxs)(L.Content,{size:`sm`,onOpenAutoFocus:e=>{e.preventDefault(),e.target?.querySelector(`input[role="combobox"]`)?.focus()},children:[(0,$.jsxs)(L.Header,{children:[(0,$.jsx)(L.Title,{children:n}),(0,$.jsx)(L.Description,{children:`Applies from your next spoken turn.`})]}),(0,$.jsx)(L.Body,{children:(0,$.jsx)(Fe,{currentCode:r,configuredProviderId:i,suggestedCode:a,selectLanguage:o,selecting:s,onDone:()=>t(!1)})})]})})}var or={vellum:{provider:`vellum`},deepgram:{provider:`deepgram`,credentialService:`deepgram`},openai:{provider:`openai-whisper`,credentialService:`openai`}},sr={vellum:`vellum`,deepgram:`deepgram`,"openai-whisper":`openai`},cr=`deepgram`;function lr({assistantId:e,hideSaveButton:r=!1,hideCredentialsGuide:i=!1,onSaveStateChange:a}={}){let o=Qt(),s=e??o,c=ht(),l=u(),[f]=(0,Q.useState)(()=>G.filter(e=>!e.requiresNativeDictation||Oe())),p=cr,{data:m}=d({...St({path:{assistant_id:s}}),enabled:c,staleTime:3e4}),h=m?.services?.stt,g=h?.mode===`managed`?`vellum`:h?.provider,_=(0,Q.useMemo)(()=>{let e=g?sr[g]:void 0;if(e&&f.some(t=>t.id===e))return e;let n=t(Se,p);return f.some(e=>e.id===n)?n:p},[g,f,p]),v=!!g,[y,b]=vn(_),{available:x,currentCode:S,configuredProviderId:C,selectLanguage:w,selecting:T}=fe(s),[E,D]=(0,Q.useState)(!1),O=x&&y===_&&(or[y]?.provider===C||!!g&&!sr[g]),[k,A]=(0,Q.useState)(``),[M,N]=(0,Q.useState)(!1),[P,I]=(0,Q.useState)(!1);(0,Q.useEffect)(()=>{let e=t(Se,p);e===`macos-native`&&!f.some(t=>t.id===e)&&n(Se,p)},[f,p]);let L=(0,Q.useMemo)(()=>f.find(e=>e.id===y)??f[0],[f,y]),z=L.apiKeyPlaceholder!==void 0;(0,Q.useEffect)(()=>{N(t(we+y,``).length>0),A(``)},[y]);let V=(0,Q.useMemo)(()=>{let e=y!==_,t=k.trim().length>0;return e||t},[y,_,k]),H=(0,Q.useCallback)(async()=>{let e=k.trim();n(Se,y),e.length>0&&n(we+y,e);let r=or[y];I(!0);try{if(r?.credentialService){let n=e.length>0?e:t(we+y,``);if(n.length>0){let{response:e}=await ct({path:{assistant_id:s},body:{service:r.credentialService,field:`api_key`,value:n,label:`${L.displayName} API Key`},throwOnError:!1});if(!e?.ok)throw Error(`Failed to store API key (HTTP ${e?.status??`?`})`)}}if(r&&(y!==_||!v)||g===`vellum`&&y!==`vellum`){let e=r?.provider??cr,{response:t}=await lt({path:{assistant_id:s},body:{services:{stt:{provider:e,mode:e===`vellum`?`managed`:`your-own`}}},throwOnError:!1});if(!t?.ok)throw Error(`Failed to save configuration (HTTP ${t?.status??`?`})`)}return e.length>0&&N(!0),A(``),l.invalidateQueries({queryKey:Et({path:{assistant_id:s}})}),R.success(`Speech-to-text settings saved`),!0}catch(e){return R.error(e instanceof Error?e.message:`Failed to save speech-to-text settings`),!1}finally{I(!1)}},[s,y,k,L,_,v,g,l]);(0,Q.useEffect)(()=>{a?.({hasChanges:V,saving:P,save:H})},[a,V,P,H]);let U=(0,Q.useCallback)(()=>{n(we+y,``),N(!1),A(``)},[y]),W=M?`•••••••• (Enter a new key to replace)`:L.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:`Provider`}),(0,$.jsx)(B,{value:y,onChange:b,options:f.map(e=>({value:e.id,label:e.displayName})),"aria-label":`STT provider`})]}),O&&(0,$.jsxs)(`div`,{className:`space-y-1`,children:[(0,$.jsx)(`label`,{className:`block text-body-small-default text-[var(--content-tertiary)]`,children:`Spoken language`}),(0,$.jsx)(Ge,{"aria-label":`Spoken language`,"aria-haspopup":`dialog`,onClick:()=>D(!0),value:he(S,C)}),(0,$.jsx)(`p`,{className:`text-body-small-default text-[var(--content-tertiary)]`,children:`Applies from your next spoken turn.`}),(0,$.jsx)(ar,{open:E,onOpenChange:D,title:`Spoken language`,currentCode:S,configuredProviderId:C,selectLanguage:w,selecting:T})]}),z&&(0,$.jsxs)(`div`,{className:`space-y-1`,children:[(0,$.jsx)(`label`,{className:`block text-body-small-default text-[var(--content-tertiary)]`,children:`API Key`}),(0,$.jsx)(F,{type:`password`,value:k,onChange:e=>A(e.target.value),placeholder:W,fullWidth:!0})]}),L.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)(j,{className:`mt-0.5 h-3.5 w-3.5 shrink-0 text-[var(--system-mid-strong)]`}),(0,$.jsx)(`span`,{children:L.setupWarning})]}),!i&&L.credentialsGuide&&(0,$.jsx)(pn,{guide:L.credentialsGuide}),y===`vellum`&&(0,$.jsx)(`p`,{className:`text-body-medium-lighter text-[var(--content-tertiary)]`,children:`Transcription runs through your Vellum account.`}),(!r||M)&&(0,$.jsxs)(`div`,{className:`flex items-center justify-end gap-2`,children:[!r&&(0,$.jsx)(dn,{onClick:H,disabled:!V||P}),M&&(0,$.jsx)(fn,{onClick:U})]})]})}function ur(){return(0,$.jsx)(cn,{title:`Speech-to-Text`,subtitle:`Configure how your assistant transcribes speech`,children:(0,$.jsx)(lr,{})})}async function dr(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 fr(n,r,i):t===`deepgram`?await pr(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 fr(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 mr(i,`ElevenLabs rejected the request.`)}}async function pr(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 mr(n,`Deepgram rejected the request.`)}}async function mr(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 hr({assistantId:e,value:t,onChange:n,className:r}){let[i,a]=(0,Q.useState)(!1),{voices:o}=Yt(e);if(o.length===0)return null;let s=o.find(e=>e.model===t)??o[0];return(0,$.jsxs)(P.Root,{open:i,onOpenChange:a,children:[(0,$.jsx)(P.Trigger,{asChild:!0,children:(0,$.jsx)(Ge,{"aria-label":`Voice`,value:s?Xt(s.description):`Select a voice`,className:r})}),(0,$.jsx)(P.Content,{side:`bottom`,align:`start`,className:`w-[var(--radix-popover-trigger-width)] p-1`,children:(0,$.jsx)(Zt,{assistantId:e,value:t,onChange:n,onSelect:()=>a(!1),showSource:!0})})]})}var gr={elevenlabs:`voiceId`,"fish-audio":`referenceId`,xai:`voiceId`};function _r({assistantId:e,hideSaveButton:r=!1,hideCredentialsGuide:i=!1,onSaveStateChange:a}={}){let o=Qt(),c=e??o,l=Qe.use.name()??`your assistant`,f=ht(),p=u(),{data:m}=d({..._t({path:{assistant_id:c}}),enabled:f,staleTime:1/0}),h=(0,Q.useMemo)(()=>{let e=m?.providers;if(!e)return ne;if(e.some(e=>e.id===`vellum`))return e;let t=ne.find(e=>e.id===`vellum`);return t?[t,...e]:e},[m]),{data:g}=d({...St({path:{assistant_id:c}}),enabled:f,staleTime:3e4}),_=g?.services?.tts,v=_?.mode===`managed`?`vellum`:_?.provider,y=`elevenlabs`,b=(0,Q.useMemo)(()=>v??t(`vellum:voice:ttsProvider`,y),[v,y]),x=!!v,[S,C]=vn(b),[w,E]=(0,Q.useState)(``),[D,O]=(0,Q.useState)(``),[k,A]=(0,Q.useState)(``),[j,M]=(0,Q.useState)(!1),[N,P]=(0,Q.useState)(!1),[I,L]=(0,Q.useState)(!1),{voices:z,defaultModel:V,fetched:H}=Jt(c,{enabled:S===`vellum`}),U=_?.providers?.vellum?.model??V??``,[W,G]=vn(U),K=z.find(e=>e.model===W)??z[0],[ee,q]=(0,Q.useState)(null),J=z.some(e=>e.model===U),te=ee??(H&&U!==``&&!J),Y=(0,Q.useMemo)(()=>h.find(e=>e.id===S)??h[0],[S,h]),X=S===`vellum`&&Y.supportsVoiceSelection&&W.trim()!==``&&W.trim()!==U,Z=(0,Q.useCallback)(e=>{let n=t(ue+e,``),r=t(Xe+e,``);M(n.length>0),O(r),A(r),E(``)},[]);(0,Q.useEffect)(()=>{Z(S)},[S,Z]);let re=(0,Q.useMemo)(()=>{let e=S!==b,t=w.trim().length>0,n=D.trim()!==k;return e||t||n||X},[S,b,w,D,k,X]),ie=(0,Q.useCallback)(async()=>{let e=w.trim(),r=D.trim(),i=Y.id;n(qe,i),e.length>0&&n(ue+i,e),n(Xe+i,r);let a=e.length>0?e:t(ue+i,``),o=gr[i];L(!0);try{if(a.length>0){let{response:e}=await ct({path:{assistant_id:c},body:{service:i,field:`api_key`,value:a,label:`${Y.displayName} API Key`},throwOnError:!1});if(!e?.ok)throw Error(`Failed to store API key (HTTP ${e?.status??`?`})`)}let e={...S!==b||!x?{provider:i,mode:i===`vellum`?`managed`:`your-own`}:{},...o?{providers:{[i]:{[o]:r}}}:{},...X?{providers:{vellum:{model:W.trim()}}}:{}};if(Object.keys(e).length>0){let{response:t}=await lt({path:{assistant_id:c},body:{services:{tts:e}},throwOnError:!1});if(!t?.ok)throw Error(`Failed to save configuration (HTTP ${t?.status??`?`})`)}return M(a.length>0),A(r),E(``),p.invalidateQueries({queryKey:Et({path:{assistant_id:c}})}),R.success(`Text-to-speech settings saved`),!0}catch(e){return R.error(e instanceof Error?e.message:`Failed to save text-to-speech settings`),!1}finally{L(!1)}},[c,S,W,X,w,D,Y,b,x,p]);(0,Q.useEffect)(()=>{a?.({hasChanges:re,saving:I,save:ie})},[a,re,I,ie]);let ae=(0,Q.useCallback)(()=>{n(ue+S,``),M(!1),E(``)},[S]),oe=(0,Q.useCallback)(async()=>{P(!0);try{let e=t(ue+S,``),n=w.trim(),r=n.length>0?n:e;if(r.length===0){R.error(`Save an API key for this provider before testing.`);return}let i=t(Xe+S,``),a=D.trim(),o=await dr({provider:S,apiKey:r,voiceId:a.length>0?a:i,text:`Hey! It's ${l}. How does this sound?`});if(o.kind!==`audio`){R.error(o.message);return}let s=URL.createObjectURL(o.blob);try{let e=new Audio(s);await e.play(),await new Promise(t=>{e.onended=()=>t(),e.onerror=()=>t()})}finally{URL.revokeObjectURL(s)}}finally{P(!1)}},[l,w,S,D]),se=j?`•••••••• (Enter a new key to replace)`:Y.apiKeyPlaceholder,ce=S===`vellum`,le=ce&&Y.supportsVoiceSelection,de=(0,$.jsxs)(s,{variant:`link`,size:`compact`,className:`inline-flex h-auto items-center gap-1 px-0 underline [--vbtn-fg:var(--content-tertiary)]`,onClick:()=>{q(!1),z.some(e=>e.model===W)||G(V||z[0]?.model||``)},children:[(0,$.jsx)(T,{className:`h-3.5 w-3.5`,"aria-hidden":!0}),`Choose from catalog`]}),fe=le&&te&&z.length>0?de: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:`Provider`}),(0,$.jsx)(B,{value:S,onChange:C,options:h.map(e=>({value:e.id,label:e.displayName})),"aria-label":`TTS provider`})]}),!ce&&(0,$.jsxs)(`div`,{className:`space-y-1`,children:[(0,$.jsx)(`label`,{className:`block text-body-small-default text-[var(--content-tertiary)]`,children:`API Key`}),(0,$.jsx)(F,{type:`password`,value:w,onChange:e=>E(e.target.value),placeholder:se,fullWidth:!0})]}),le&&(0,$.jsxs)(`div`,{className:`space-y-1`,children:[(0,$.jsx)(`label`,{className:`block text-body-small-default text-[var(--content-tertiary)]`,children:`Voice`}),te?(0,$.jsx)(F,{type:`text`,value:W,onChange:e=>G(e.target.value),placeholder:`Enter a voice ID`,"aria-label":`Custom voice ID`,fullWidth:!0}):K?(0,$.jsx)(hr,{assistantId:c,value:W,onChange:G}):H&&(0,$.jsx)(`p`,{className:`text-body-small-default text-[var(--content-tertiary)]`,children:`No managed voices are currently available.`})]}),Y.supportsVoiceSelection&&!ce&&(0,$.jsxs)(`div`,{className:`space-y-1`,children:[(0,$.jsx)(`label`,{className:`block text-body-small-default text-[var(--content-tertiary)]`,children:`Voice ID`}),(0,$.jsx)(F,{type:`text`,value:D,onChange:e=>O(e.target.value),placeholder:`Enter a voice ID`,fullWidth:!0})]}),!i&&!ce&&(0,$.jsx)(pn,{guide:Y.credentialsGuide}),(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[!ce&&(0,$.jsx)(s,{variant:`outlined`,onClick:oe,disabled:N,children:N?`Testing…`:`Test`}),(0,$.jsxs)(`div`,{className:`ml-auto flex items-center gap-3`,children:[fe,!r&&(0,$.jsx)(dn,{onClick:ie,disabled:!re||I}),j&&!ce&&(0,$.jsx)(fn,{onClick:ae})]})]})]})}function vr(){return(0,$.jsx)(cn,{id:`text-to-speech`,title:`Text-to-Speech`,subtitle:`Configure how your assistant speaks`,children:(0,$.jsx)(_r,{})})}var yr=`default`;function br(){let e=Qt(),i=u(),{data:o}=d({...St({path:{assistant_id:e}}),staleTime:3e4}),s=yt({onSuccess:t=>{kt(i,{path:{assistant_id:e}},t)}}),c=_n(),l=(0,Q.useMemo)(()=>o?o.services?.[`web-fetch`]?.provider||t(`vellum:ai:webFetchProvider`,yr):t(me,yr),[o]),[f,p]=(0,Q.useState)(!1),[m,h]=vn(l),[g,_]=(0,Q.useState)(``),v=Ae.has(m),{hasStoredCredential:y}=q({assistantId:e,credentialKind:`api_key`,credentialName:m,enabled:v}),b=g.trim().length>0,x=f||v&&!y&&!b||m===l&&!b,S=ee(xe[m]??`Enter your API key`,y),C=(0,Q.useCallback)(async()=>{p(!0);let t=g.trim(),r=v&&t.length>0;try{r&&await c(m,t),await s.mutateAsync({path:{assistant_id:e},body:{services:{"web-fetch":{provider:m}}}}).catch(e=>{throw R.error(`Failed to update assistant configuration. Please try again.`),a(e,{context:`patch_daemon_config`}),e})}catch{p(!1);return}p(!1);try{if(n(me,m),r){let r=Pe(m);r&&n(r,t);let a=ze(e,`api_key`,m);i.setQueryData(a,!0),i.invalidateQueries({queryKey:a}),_(``)}R.success(`Web fetch settings saved.`)}catch(e){a(e,{context:`settings-ai-web-fetch-persist-local`}),R.error(`Saved, but local preferences could not be written.`)}},[v,s,c,i,e,g,m]),w=(0,Q.useCallback)(()=>{let e=Pe(m);e&&r(e),_(``),h(yr),n(me,yr)},[m,h]);return(0,$.jsx)(cn,{id:`web-fetch`,title:`Web Fetch`,subtitle:`Configure how your assistant reads individual web pages`,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:`Provider`}),(0,$.jsx)(B,{value:m,onChange:h,options:ve.map(e=>({value:e,label:Ke[e]??e}))})]}),v&&(0,$.jsx)(F,{label:`API Key`,type:`password`,value:g,onChange:e=>_(e.target.value),placeholder:S,fullWidth:!0}),(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(dn,{onClick:C,disabled:x}),f&&(0,$.jsx)(E,{className:`h-4 w-4 animate-spin text-[var(--content-disabled)]`}),v&&(0,$.jsx)(fn,{onClick:w,filled:!0})]})]})})}var xr=`0.10.12`;function Sr(){return et(xr)}function Cr(){let e=Qt(),i=u(),o=ht(),{data:s}=d({...St({path:{assistant_id:e}}),enabled:o,staleTime:3e4}),c=yt({onSuccess:t=>{kt(i,{path:{assistant_id:e}},t)}}),l=_n(),f=(0,Q.useMemo)(()=>{if(!s)return t(Ye,`inference-provider-native`);let e=s.services?.[`web-search`];return(e?.mode===`managed`&&e?.provider!==`inference-provider-native`?`vellum`:e?.provider)||t(`vellum:ai:webSearchProvider`,`inference-provider-native`)},[s]),[p,m]=(0,Q.useState)(!1),[h,g]=vn(f),[_,v]=(0,Q.useState)(``),y=pe.has(h),{hasStoredCredential:b}=q({assistantId:e,credentialKind:`api_key`,credentialName:h,enabled:y}),x=_.trim().length>0,S=p||y&&!b&&!x||h===f&&!x,C=ee(ge[h]??`Enter your API key`,b),w=(0,Q.useCallback)(async()=>{m(!0);let t=_.trim(),r=Ve(h),o=y&&t.length>0;try{o&&await l(h,t),await tt();let n=h===`vellum`?Sr()?{provider:`vellum`,mode:`managed`}:{mode:`managed`}:{provider:h,mode:`your-own`};await c.mutateAsync({path:{assistant_id:e},body:{services:{"web-search":n}}}).catch(e=>{throw R.error(`Failed to update assistant configuration. Please try again.`),a(e,{context:`patch_daemon_config`}),e})}catch{m(!1);return}m(!1);try{if(n(Ye,h),o){r&&n(r,t);let a=ze(e,`api_key`,h);i.setQueryData(a,!0),i.invalidateQueries({queryKey:a}),v(``)}R.success(`Web search settings saved.`)}catch(e){a(e,{context:`settings-ai-web-search-persist-local`}),R.error(`Saved, but local preferences could not be written.`)}},[y,c,l,i,e,_,h]),T=(0,Q.useCallback)(()=>{let e=Ve(h);e&&r(e),v(``),g(`inference-provider-native`),n(Ye,`inference-provider-native`)},[h,g]);return(0,$.jsx)(cn,{title:`Web Search`,subtitle:`Configure how your assistant should search the web`,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:`Provider`}),(0,$.jsx)(B,{"aria-label":`Web search provider`,value:h,onChange:g,options:He.map(e=>({value:e,label:Ie[e]??e}))})]}),h===`vellum`&&(0,$.jsx)(`p`,{className:`text-body-medium-lighter text-[var(--content-tertiary)]`,children:`Search runs through your Vellum account.`}),y&&(0,$.jsx)(F,{label:`API Key`,type:`password`,value:_,onChange:e=>v(e.target.value),placeholder:C,fullWidth:!0}),(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(dn,{onClick:w,disabled:S}),p&&(0,$.jsx)(E,{className:`h-4 w-4 animate-spin text-[var(--content-disabled)]`}),y&&(0,$.jsx)(fn,{onClick:T,filled:!0})]})]})})}function wr(){let e=Qt(),t=jt(),[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)(ln,{}),(0,$.jsx)(Jn,{panel:n,onOpenPanel:r,onClosePanel:()=>r(null)}),(0,$.jsx)(Cr,{}),(0,$.jsx)(br,{}),(0,$.jsx)(gn,{}),(0,$.jsx)(Sn,{}),(0,$.jsx)(vr,{}),(0,$.jsx)(ur,{})]}),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)(nr,{assistantId:e,onClose:()=>r(null)},a):o?(0,$.jsx)(ir,{assistantId:e,connectionName:n.kind===`provider`?n.name:null,onClose:()=>r(null)},a):(0,$.jsx)(Xn,{assistantId:e,profileName:n.kind===`profile`?n.name:null,onClose:()=>r(null)},a):null;return s&&t?(0,$.jsx)(tn,{children:s}):s?(0,$.jsx)(nn,{storageKey:`aiSettingsDetailDrawerWidth`,detailKey:a,section:i,detail:s}):i}export{wr as AiPage};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as e}from"./chunk-jRWAZmH_.js";import{_t as t,at as n,bt as ee,ct as r,dt as i,ft as a,gt as o,ht as s,it as te,lt as c,mt as l,ot as u,pt as d,st as ne,ut as f,vt as p,yt as re}from"./local-mode-BR8wpdXp.js";function m(e){return ee(n,e)}function ie(e){return re(te,e)}var ae=u([`end_turn`,`max_tokens`,`max_turn_requests`,`refusal`,`cancelled`]),oe=d({type:i(`acp_session_completed`),acpSessionId:o(),stopReason:ae}).strict(),se=d({type:i(`acp_session_error`),acpSessionId:o(),error:o()}).strict(),ce=d({type:i(`acp_session_spawned`),acpSessionId:o(),agent:o(),parentConversationId:o(),parentToolUseId:o().optional(),task:o().optional()}).strict(),le=u([`agent_message_chunk`,`agent_thought_chunk`,`user_message_chunk`,`tool_call`,`tool_call_update`,`plan`]),ue=d({type:i(`acp_session_update`),acpSessionId:o(),updateType:le,content:o().optional(),toolCallId:o().optional(),toolTitle:o().optional(),toolKind:o().optional(),toolStatus:o().optional(),rawInput:p().optional(),rawOutput:p().optional(),locations:r(d({path:o(),line:a().optional()})).optional(),messageId:o().optional(),seq:a().optional()}).strict(),de=d({type:i(`acp_session_usage`),acpSessionId:o(),usedTokens:a(),contextSize:a(),inputTokens:a().optional(),outputTokens:a().optional(),costAmount:a().optional(),costCurrency:o().optional()}).strict(),fe=d({type:i(`app_files_changed`),appId:o()}),pe=u([`idle`,`thinking`,`streaming`,`tool_running`,`awaiting_confirmation`]),me=u([`assistant_turn`,`user_turn`,`global`]),he=u([`message_dequeued`,`thinking_delta`,`first_text_delta`,`tool_use_start`,`preview_start`,`tool_result_received`,`confirmation_requested`,`confirmation_resolved`,`context_compacting`,`message_complete`,`generation_cancelled`,`error_terminal`]),ge=d({type:i(`assistant_activity_state`),conversationId:o(),activityVersion:a(),phase:pe,anchor:me,reason:he,requestId:o().optional(),statusText:o().optional()}),_e=d({type:i(`assistant_status`),version:o().optional(),keyFingerprint:o().optional()}),ve=d({type:i(`assistant_text_delta`),text:o(),messageId:o().optional(),conversationId:o().optional()}),ye=d({type:i(`assistant_thinking_delta`),thinking:o(),messageId:o().optional(),conversationId:o().optional(),timestampMs:a().optional()}),be=d({type:i(`assistant_turn_start`),messageId:o(),conversationId:o().optional()}),xe=d({type:i(`avatar_updated`),avatarPath:o()}),Se=d({type:i(`background_tool_completed`),id:o(),conversationId:o(),status:u([`completed`,`failed`,`cancelled`]),exitCode:a().nullable().optional(),output:o().optional(),completedAt:a()}),Ce=d({type:i(`background_tool_started`),id:o(),toolName:o(),conversationId:o(),command:o(),startedAt:a()}),we=d({id:o(),messageId:o(),conversationId:o(),conversationTitle:o().nullable(),messagePreview:o(),messageRole:o(),messageCreatedAt:a(),createdAt:a()}),Te=d({type:i(`bookmark.created`),bookmark:we}),Ee=d({type:i(`bookmark.deleted`),messageId:o()}),De=d({type:i(`client_settings_update`),key:o(),value:o()}),Oe=d({type:i(`compaction_circuit_closed`),conversationId:o()}),ke=d({type:i(`compaction_circuit_open`),conversationId:o(),reason:i(`3_consecutive_failures`),openUntil:a()}),Ae=d({type:i(`config_changed`)}),h=d({label:o(),description:o(),pattern:o()}),g=d({label:o(),scope:o()}),_=d({label:o(),scope:o()}),v=d({filePath:o(),oldContent:o(),newContent:o(),isNewFile:c()}),je=u([`allow_once`,`allow_always`,`reject_once`,`reject_always`]),Me=d({optionId:o(),name:o(),kind:je}),Ne=u([`sandbox`,`host`]),Pe=d({type:i(`confirmation_request`),requestId:o(),toolName:o(),input:s(o(),p()),riskLevel:o(),riskReason:o().optional(),isContainerized:c().optional(),executionTarget:Ne.optional(),allowlistOptions:r(h),scopeOptions:r(g),directoryScopeOptions:r(_).optional(),diff:v.optional(),conversationId:o().optional(),persistentDecisionsAllowed:c().optional(),toolUseId:o().optional(),acpToolKind:o().optional(),acpOptions:r(Me).optional()}),Fe=d({type:i(`confirmation_state_changed`),conversationId:o(),requestId:o(),state:u([`pending`,`approved`,`denied`,`timed_out`,`resolved_stale`]),source:u([`button`,`inline_nl`,`auto_deny`,`timeout`,`system`]),causedByRequestId:o().optional(),decisionText:o().optional(),toolUseId:o().optional()}),Ie=d({type:i(`contact_request`),requestId:o(),channel:o().optional(),placeholder:o().optional(),defaultValue:o().optional(),label:o().optional(),description:o().optional(),role:o().optional()}),Le=d({type:i(`contacts_changed`)}),Re=d({type:i(`context_compacted`),conversationId:o(),previousEstimatedInputTokens:a(),estimatedInputTokens:a(),maxInputTokens:a(),thresholdTokens:a(),compactedMessages:a(),summaryCalls:a(),summaryInputTokens:a(),summaryOutputTokens:a(),summaryModel:o(),summaryCharCount:a().optional(),summaryHeaderCount:a().optional(),summaryHadMemoryEcho:c().optional()}),ze=d({type:i(`context_window_usage`),conversationId:o(),tokens:a(),maxTokens:a()}),y=u([`PROVIDER_NETWORK`,`PROVIDER_RATE_LIMIT`,`MANAGED_USAGE_LIMIT`,`PROVIDER_OVERLOADED`,`PROVIDER_API`,`IMAGE_TOO_LARGE`,`PROVIDER_BILLING`,`PROVIDER_ORDERING`,`PROVIDER_WEB_SEARCH`,`PROVIDER_NOT_CONFIGURED`,`PROVIDER_INVALID_KEY`,`MANAGED_KEY_INVALID`,`CONTEXT_TOO_LARGE`,`BUDGET_YIELD_UNRECOVERED`,`MAX_TOKENS_REACHED`,`CONVERSATION_ABORTED`,`CONVERSATION_PROCESSING_FAILED`,`DISK_SPACE_CRITICAL`,`UNKNOWN`]),Be=d({type:i(`conversation_error`),conversationId:o(),code:y,userMessage:o(),retryable:c(),debugDetails:o().optional(),errorCategory:o().optional(),connectionName:o().optional(),profileName:o().optional()}),Ve=d({type:i(`conversation_inference_profile_updated`),conversationId:o(),profile:o().nullable(),sessionId:o().nullable().optional(),expiresAt:a().nullable().optional()}),He=u([`created`,`renamed`,`deleted`,`reordered`,`seen_changed`]),Ue=d({type:i(`conversation_list_invalidated`),reason:He}),We=u([`memory_v3`]),Ge=d({type:i(`conversation_notice`),conversationId:o(),source:We,code:y,userMessage:o(),errorCategory:o().optional()}),Ke=d({type:i(`conversation_title_updated`),conversationId:o(),title:o()}),qe=u([`disabled`,`ok`,`warning`,`critical`,`unknown`]),Je=u([`agent-turns`,`background-work`,`remote-ingress`]),b=d({enabled:c(),state:qe,locked:c(),acknowledged:c(),overrideActive:c(),effectivelyLocked:c(),lockId:o().nullable(),usagePercent:a().nullable(),thresholdPercent:a(),path:o().nullable(),lastCheckedAt:o().nullable(),blockedCapabilities:r(Je),error:o().nullable()}),Ye=d({type:i(`disk_pressure_status_changed`),status:b}),Xe=d({id:o(),surfaceId:o(),author:o(),content:o(),anchorStart:a().optional(),anchorEnd:a().optional(),anchorText:o().optional(),parentCommentId:o().optional(),status:o(),createdAt:a(),updatedAt:a()}),Ze=d({type:i(`document_comment_created`),conversationId:o(),surfaceId:o(),comment:Xe}),Qe=d({type:i(`document_comment_deleted`),conversationId:o(),surfaceId:o(),commentId:o()}),$e=d({type:i(`document_comment_reopened`),conversationId:o(),surfaceId:o(),commentId:o()}),et=d({type:i(`document_comment_resolved`),conversationId:o(),surfaceId:o(),commentId:o(),resolvedBy:o()}),tt=d({type:i(`document_editor_show`),conversationId:o(),surfaceId:o(),title:o(),initialContent:o()}),nt=d({type:i(`document_editor_update`),conversationId:o(),surfaceId:o(),markdown:o(),mode:o()}),rt=d({type:i(`error`),message:o(),code:o().optional(),category:o().optional(),errorCategory:o().optional(),requestId:o().optional(),conversationId:o().optional()}),it=d({type:i(`generation_cancelled`),conversationId:o().optional()}),x=d({id:o().optional(),filename:o(),mimeType:o(),data:o(),sourceType:u([`sandbox_file`,`host_file`,`tool_block`]).optional(),sizeBytes:a().optional(),thumbnailData:o().optional(),fileBacked:c().optional(),filePath:o().optional()}),at=d({type:i(`generation_handoff`),conversationId:o().optional(),requestId:o().optional(),queuedCount:a(),messageId:o().optional(),attachments:r(x).optional(),attachmentWarnings:r(o()).optional()}),ot=d({type:i(`heartbeat_alert`),title:o(),body:o()}),st=d({type:i(`heartbeat_conversation_created`),conversationId:o(),title:o()}),ct=d({type:i(`home_feed_updated`),updatedAt:o(),newItemCount:a()}),lt=d({kind:u([`plugin`,`workspace`]),id:o()}),ut=d({type:i(`hook_event`),conversationId:o().optional(),hookName:o(),owner:lt,detail:s(o(),p())}),dt=d({tool:i(`start`),app:o(),args:r(o()).optional()}),ft=d({tool:i(`observe`),app:o(),settle_ms:a().optional()}),pt=d({tool:i(`press`),app:o(),key:o(),modifiers:r(o()).optional(),duration_ms:a().optional()}),mt=d({tool:i(`combo`),app:o(),keys:r(o()),duration_ms:a().optional()}),ht=d({key:o(),modifiers:r(o()).optional(),duration_ms:a().optional(),gap_ms:a().optional()}),gt=f(`tool`,[dt,ft,pt,mt,d({tool:i(`sequence`),app:o(),steps:r(ht)}),d({tool:i(`type`),app:o(),text:o()}),d({tool:i(`click`),app:o(),x:a(),y:a(),button:u([`left`,`right`,`middle`]).optional(),double:c().optional()}),d({tool:i(`drag`),app:o(),from_x:a(),from_y:a(),to_x:a(),to_y:a(),button:u([`left`,`right`,`middle`]).optional()}),d({tool:i(`stop`),app:o().optional(),reason:o().optional()})]),_t=d({type:i(`host_app_control_request`),requestId:o(),conversationId:o(),toolName:o(),input:gt}),vt=d({type:i(`host_app_control_cancel`),requestId:o(),conversationId:o()}),yt=d({type:i(`host_bash_request`),requestId:o(),conversationId:o(),command:o(),working_dir:o().optional(),timeout_seconds:a().optional(),env:s(o(),o()).optional(),targetClientId:o().optional()}),bt=d({type:i(`host_bash_cancel`),requestId:o(),conversationId:o(),targetClientId:o().optional()}),xt=d({type:i(`host_browser_request`),requestId:o(),conversationId:o(),cdpMethod:o(),cdpParams:s(o(),p()).optional(),cdpSessionId:o().optional(),timeout_seconds:a().optional()}),St=d({type:i(`host_browser_cancel`),requestId:o()}),Ct=d({type:i(`host_cu_request`),requestId:o(),conversationId:o(),targetClientId:o().optional(),toolName:o(),input:s(o(),p()),stepNumber:a(),reasoning:o().optional()}),wt=d({type:i(`host_cu_cancel`),requestId:o(),conversationId:o(),targetClientId:o().optional()}),Tt=f(`operation`,[d({type:i(`host_file_request`),requestId:o(),conversationId:o(),targetClientId:o().optional(),operation:i(`read`),path:o(),offset:a().optional(),limit:a().optional()}),d({type:i(`host_file_request`),requestId:o(),conversationId:o(),targetClientId:o().optional(),operation:i(`write`),path:o(),content:o()}),d({type:i(`host_file_request`),requestId:o(),conversationId:o(),targetClientId:o().optional(),operation:i(`edit`),path:o(),old_string:o(),new_string:o(),replace_all:c().optional()})]),Et=d({type:i(`host_file_cancel`),requestId:o(),conversationId:o(),targetClientId:o().optional()}),Dt=f(`direction`,[d({type:i(`host_transfer_request`),requestId:o(),conversationId:o(),targetClientId:o().optional(),direction:i(`to_host`),transferId:o(),destPath:o(),sizeBytes:a(),sha256:o(),overwrite:c()}),d({type:i(`host_transfer_request`),requestId:o(),conversationId:o(),targetClientId:o().optional(),direction:i(`to_sandbox`),transferId:o(),sourcePath:o()})]),Ot=d({type:i(`host_transfer_cancel`),requestId:o(),conversationId:o(),targetClientId:o().optional()}),kt=u([`sampler`,`chat`]),At=d({type:i(`host_ui_snapshot_request`),requestId:o(),view:kt,tokens:s(o(),o()).optional()}),jt=d({type:i(`host_ui_snapshot_cancel`),requestId:o()}),Mt=d({type:i(`identity_changed`),name:o(),role:o(),personality:o(),emoji:o(),home:o()}),Nt=u([`approved`,`rejected`,`answered`,`cancelled`,`superseded`]),Pt=d({type:i(`interaction_resolved`),requestId:o(),conversationId:o(),state:Nt,kind:o()}),S=d({semanticUnavailable:c(),reason:o(),fallbackSources:r(o())}),Ft=d({key:o(),type:o(),kind:o(),finalScore:a(),semantic:a(),recency:a()}),It=d({type:i(`memory_recalled`),provider:o(),model:o(),degradation:S.optional(),semanticHits:a(),tier1Count:a(),tier2Count:a(),hybridSearchLatencyMs:a(),sparseVectorUsed:c(),mergedCount:a(),selectedCount:a(),injectedTokens:a(),latencyMs:a(),topCandidates:r(Ft)}),Lt=d({type:i(`memory_status`),enabled:c(),degraded:c(),degradation:S.optional(),reason:o().optional(),provider:o().optional(),model:o().optional()}),Rt=d({type:i(`message_complete`),messageId:o().optional(),conversationId:o().optional(),source:u([`main`,`aux`]).optional(),attachments:r(x).optional(),attachmentWarnings:r(o()).optional()}),zt=d({type:i(`message_dequeued`),conversationId:o(),requestId:o(),clientMessageId:o().optional()}),Bt=d({type:i(`message_queued`),conversationId:o(),requestId:o(),position:a(),clientMessageId:o().optional()}),Vt=d({type:i(`message_queued_deleted`),conversationId:o(),requestId:o(),clientMessageId:o().optional()}),Ht=d({type:i(`message_request_complete`),conversationId:o(),requestId:o(),runStillActive:c().optional()}),Ut=d({type:i(`message_requeued`),conversationId:o(),requestId:o(),position:a(),clientMessageId:o().optional()}),Wt=d({type:i(`message_steered`),conversationId:o(),requestId:o()}),Gt=d({id:o(),displayName:o()}),Kt=d({id:o(),displayName:o(),models:r(Gt),defaultModel:o(),apiKeyUrl:o().optional(),apiKeyPlaceholder:o().optional()}),qt=d({type:i(`model_info`),conversationId:o().optional(),model:o(),provider:o(),configuredProviders:r(o()).optional(),availableModels:r(Gt).optional(),allProviders:r(Kt).optional()}),Jt=d({type:i(`navigate_settings`),tab:o()}),Yt=d({type:i(`notification_conversation_created`),conversationId:o(),title:o(),sourceEventName:o(),targetGuardianPrincipalId:o().optional(),groupId:o().optional(),source:o().optional(),silent:c().optional()}),Xt=d({type:i(`notification_intent`),sourceEventName:o(),title:o(),body:o(),deliveryId:o().optional(),correlationId:o().optional(),deepLinkMetadata:s(o(),p()).optional(),targetGuardianPrincipalId:o().optional(),silent:c().optional(),remotePushDispatched:c().optional(),remotePushPlatforms:r(u([`ios`,`android`])).optional()}),Zt=d({type:i(`oauth_connect_result`),success:c(),service:o().optional(),grantedScopes:r(o()).optional(),accountInfo:o().optional(),error:o().optional()}),Qt=d({type:i(`open_conversation`),conversationId:o(),title:o().optional(),anchorMessageId:o().optional(),focus:c().optional()}),$t=d({type:i(`open_panel`),panelType:o(),data:s(o(),p()).optional(),conversationId:o().optional(),surfaceId:o().optional()}),en=d({type:i(`open_url`),url:o().min(1),title:o().optional(),conversationId:o().optional()}),tn=d({type:i(`platform_disconnected`)}),C=d({id:o(),label:o(),description:o().optional()}),w=d({id:o(),question:o(),description:o().optional(),options:r(C),freeTextPlaceholder:o().optional()}),nn=d({type:i(`question_request`),requestId:o(),questions:r(w),question:o(),description:o().optional(),options:r(C),freeTextPlaceholder:o().optional(),conversationId:o().optional(),toolUseId:o().optional()}),rn=d({captureScope:u([`display`,`window`]).optional(),displayId:o().optional(),windowId:a().optional(),includeAudio:c().optional(),includeMicrophone:c().optional(),promptForSource:c().optional()}),an=d({type:i(`recording_start`),recordingId:o(),attachToConversationId:o().optional(),options:rn.optional(),operationToken:o().optional()}),on=d({type:i(`recording_stop`),recordingId:o()}),sn=d({type:i(`recording_pause`),recordingId:o()}),cn=d({type:i(`recording_resume`),recordingId:o()}),ln=d({type:i(`relationship_state_updated`),updatedAt:o()}),un=d({type:i(`schedule_conversation_created`),conversationId:o(),scheduleJobId:o(),title:o()}),dn=d({type:i(`secret_request`),requestId:o(),service:o(),field:o(),label:o(),description:o().optional(),placeholder:o().optional(),conversationId:o().optional(),purpose:o().optional(),allowedTools:r(o()).optional(),allowedDomains:r(o()).optional(),allowOneTimeSend:c().optional()}),fn=d({type:i(`service_group_update_complete`),installedVersion:o(),success:c(),rolledBackToVersion:o().optional()}),pn=d({type:i(`service_group_update_progress`),statusMessage:o()}),mn=d({type:i(`service_group_update_starting`),targetVersion:o(),expectedDowntimeSeconds:a()}),hn=d({type:i(`show_platform_login`)}),gn=d({type:i(`skills_state_changed`),name:o(),state:u([`enabled`,`disabled`,`installed`,`uninstalled`])}),_n=d({type:i(`sounds_config_updated`)}),vn=d({type:o(),content:o().optional(),text:o().optional(),result:o().optional(),input:s(o(),p()).optional(),toolName:o().optional(),isError:c().optional(),toolUseId:o().optional()}).passthrough(),yn=d({type:i(`subagent_event`),conversationId:o(),subagentId:o(),event:vn}).strict(),bn=d({type:i(`subagent_spawned`),subagentId:o(),parentConversationId:o(),label:o(),objective:o(),isFork:c().optional(),parentToolUseId:o().optional()}).strict(),T=u([`pending`,`running`,`awaiting_input`,`completed`,`failed`,`aborted`,`interrupted`]),E=d({inputTokens:a(),outputTokens:a(),estimatedCost:a()}).strict(),xn=d({type:i(`subagent_status_changed`),subagentId:o(),status:T,error:o().optional(),usage:E.optional()}).strict(),Sn=d({type:i(`sync_changed`),tags:r(o().min(1)).min(1),originClientId:o().min(1).optional()}),Cn=d({type:i(`tool_input_delta`),toolName:o(),content:o(),conversationId:o().optional(),toolUseId:o().optional(),messageId:o().optional()}),wn=u([`tool_start`,`tool_complete`,`status`]),Tn=d({type:i(`tool_output_chunk`),chunk:o(),conversationId:o().optional(),toolUseId:o().optional(),subType:wn.optional(),subToolName:o().optional(),subToolInput:o().optional(),subToolIsError:c().optional(),subToolId:o().optional(),messageId:o().optional()}),En=d({questionId:o(),decision:u([`option`,`free_text`,`skipped`]),optionId:o().optional(),text:o().optional()}),D=d({requestId:o(),questions:r(w),responses:r(En),overall:u([`completed`,`closed`])}),Dn=d({pattern:o(),label:o()}),On=u([`anthropic-native`,`brave`,`perplexity`,`tavily`,`keenable`,`firecrawl`]),kn=u([`default`,`firecrawl`]),An=d({rank:a(),title:o(),url:o(),domain:o(),faviconUrl:o().optional(),snippet:o().optional(),age:o().optional(),score:a().optional()}),jn=d({query:o(),provider:On,resultCount:a(),durationMs:a(),results:r(An),errorMessage:o().optional()}),Mn=d({url:o(),finalUrl:o(),provider:kn.optional(),status:a(),contentType:o().optional(),byteCount:a(),charCount:a(),truncated:c(),title:o().optional(),domain:o(),faviconUrl:o().optional(),redirectCount:a(),durationMs:a(),errorMessage:o().optional(),mayRequireJavaScript:c().optional()}),O=d({webSearch:jn.optional(),webFetch:Mn.optional()}),Nn=d({type:i(`tool_result`),toolName:o(),result:o(),isError:c().optional(),diff:v.optional(),status:o().optional(),conversationId:o().optional(),imageData:o().optional(),imageDataList:r(o()).optional(),toolUseId:o().optional(),messageId:o().optional(),riskLevel:o().optional(),riskReason:o().optional(),matchedTrustRuleId:o().optional(),isContainerized:c().optional(),riskScopeOptions:r(Dn).optional(),riskAllowlistOptions:r(h).optional(),riskDirectoryScopeOptions:r(_).optional(),approvalMode:o().optional(),approvalReason:o().optional(),riskThreshold:o().optional(),activityMetadata:O.optional(),answeredQuestion:D.optional(),errorCode:o().optional(),completedAt:a().optional()}),Pn=d({type:i(`tool_use_preview_start`),toolUseId:o(),toolName:o(),conversationId:o().optional(),messageId:o().optional(),previewStartedAt:a().optional()}),Fn=d({type:i(`tool_use_start`),toolName:o(),input:s(o(),p()),toolUseId:o().optional(),messageId:o().optional(),conversationId:o().optional(),startedAt:a().optional(),previewStartedAt:a().optional()}),In=d({type:i(`ui_surface_complete`),conversationId:o(),surfaceId:o(),summary:o(),submittedData:s(o(),p()).optional()}),Ln=d({type:i(`ui_surface_dismiss`),conversationId:o(),surfaceId:o()}),Rn=d({type:i(`ui_surface_pending`),conversationId:o(),surfaceType:i(`visual`),toolUseId:o(),messageId:o().optional()}),zn=d({id:o(),label:o(),style:u([`primary`,`secondary`,`destructive`]).optional(),data:s(o(),p()).optional()}),Bn=d({type:i(`ui_surface_show`),conversationId:o(),surfaceId:o(),surfaceType:o(),title:o().optional(),data:s(o(),p()),actions:r(zn).optional(),display:u([`inline`,`panel`]).optional(),messageId:o().optional(),persistent:c().optional(),toolCallId:o().optional()}),Vn=d({type:i(`ui_surface_undo_result`),conversationId:o(),surfaceId:o(),success:c(),remainingUndos:a()}),Hn=d({type:i(`ui_surface_update`),conversationId:o(),surfaceId:o(),data:s(o(),p())}),k=d({type:i(`usage_progress`),conversationId:o(),inputTokens:a(),outputTokens:a(),estimatedCost:a(),model:o()}),Un=d({type:i(`usage_update`),conversationId:o(),inputTokens:a(),outputTokens:a(),cacheCreationInputTokens:a().optional(),cacheReadInputTokens:a().optional(),totalInputTokens:a(),totalOutputTokens:a(),estimatedCost:a(),model:o(),contextWindowTokens:a().optional(),contextWindowMaxTokens:a().optional()}),Wn=d({type:i(`user_message_echo`),text:o(),conversationId:o().optional(),messageId:o().optional(),requestId:o().optional(),clientMessageId:o().optional()}).strict(),A=u([`running`,`completed`,`failed`,`aborted`,`cap_exceeded`,`interrupted`]),Gn=d({type:i(`workflow_completed`),runId:o(),conversationId:o().optional(),status:A,agentsSpawned:a(),inputTokens:a(),outputTokens:a(),summary:o().optional()}).strict(),Kn=d({type:i(`workflow_leaf_finished`),runId:o(),conversationId:o(),seq:a().int(),status:u([`completed`,`failed`]),label:o().optional(),inputTokens:a().optional(),outputTokens:a().optional(),resultSummary:o().optional()}).strict(),qn=d({type:i(`workflow_leaf_started`),runId:o(),conversationId:o(),seq:a().int(),label:o().optional(),phase:o().optional(),promptSummary:o().optional()}).strict(),Jn=d({type:i(`workflow_progress`),runId:o(),conversationId:o().optional(),agentsSpawned:a(),phase:o().optional(),label:o().optional(),message:o().optional()}).strict(),Yn=d({type:i(`workflow_started`),runId:o(),conversationId:o(),toolUseId:o().optional(),label:o().optional()}).strict(),Xn=`syntheticAgentErrorMessage`,Zn=`compactionAgent`,Qn=3e4,$n=d({cursorInTextField:c().optional().describe(`Whether the cursor is in an editable text field when dictation started`)}).passthrough().describe(`Dictation context (app name, window title, bundle ID, cursor state, selected text)`),er=d({transcription:o().describe(`Raw speech transcription`),context:$n,profileId:o().describe(`Optional dictation profile ID`).optional()}),j=d({id:o(),filename:o(),mimeType:o(),sizeBytes:a(),kind:o(),data:o().optional(),thumbnailData:o().optional(),fileBacked:c().optional()}),tr=d({pattern:o(),label:o()}),nr=d({label:o(),description:o(),pattern:o()}),rr=d({scope:o(),label:o()}),ir=d({requestId:o(),title:o().optional(),description:o().optional(),toolName:o().optional(),riskLevel:o().optional(),riskReason:o().optional(),input:s(o(),p()).optional(),allowlistOptions:r(h).optional(),scopeOptions:r(g).optional(),directoryScopeOptions:r(_).optional(),persistentDecisionsAllowed:c().optional()}),ar=d({requestId:o(),entries:r(w)}),or=u([`approved`,`denied`,`timed_out`]),M=d({id:o().optional(),name:o(),input:s(o(),p()),result:o().optional(),isError:c().optional(),errorCode:o().optional(),imageData:o().optional(),imageDataList:r(o()).optional(),imageAttachmentIds:r(o()).optional(),startedAt:a().optional(),previewStartedAt:a().optional(),completedAt:a().optional(),confirmationDecision:or.optional(),confirmationLabel:o().optional(),riskLevel:o().optional(),riskReason:o().optional(),matchedTrustRuleId:o().optional(),autoApproved:c().optional(),approvalMode:o().optional(),approvalReason:o().optional(),riskThreshold:o().optional(),riskScopeOptions:r(tr).optional(),riskAllowlistOptions:r(nr).optional(),riskDirectoryScopeOptions:r(rr).optional(),activityMetadata:O.optional(),scopeOptions:r(g).optional(),pendingConfirmation:ir.optional(),pendingQuestion:ar.optional(),answeredQuestion:D.optional()}),sr=d({id:o(),label:o(),style:o().optional(),data:s(o(),p()).optional()}),N=d({surfaceId:o(),surfaceType:o(),title:o().optional(),data:s(o(),p()),actions:r(sr).optional(),display:o().optional(),persistent:c().optional(),completed:c().optional(),completionSummary:o().optional(),toolCallId:o().optional()}),cr=d({subagentId:o(),label:o(),status:o(),error:o().optional(),conversationId:o().optional(),objective:o().optional()}),lr=d({acpSessionId:o(),agent:o().optional()}),ur=d({id:o(),toolName:o(),conversationId:o(),command:o(),startedAt:a(),status:u([`completed`,`failed`,`cancelled`]),exitCode:a().nullable(),output:o(),completedAt:a()}),dr=d({appUrl:o().optional(),webUrl:o().optional()}),fr=d({emoji:o(),op:u([`added`,`removed`]),actorDisplayName:o().optional(),targetChannelTs:o()}),pr=d({channelId:o(),channelName:o().optional(),channelTs:o(),threadTs:o().optional(),sender:d({displayName:o().optional(),externalUserId:o().optional()}).optional(),messageLink:dr.optional(),threadLink:dr.optional(),eventKind:u([`message`,`reaction`]).optional(),reaction:fr.optional()}),mr=d({type:i(`text`),text:o()}),hr=d({type:i(`thinking`),thinking:o(),startedAt:a().optional(),completedAt:a().optional()}),gr=d({type:i(`tool_use`),toolCall:M}),_r=d({type:i(`surface`),surface:N}),vr=d({type:i(`attachment`),attachment:j}),yr=f(`type`,[mr,hr,gr,_r,vr]),br=d({id:o(),mergedMessageIds:r(o()).optional(),clientMessageId:o().optional(),role:u([`user`,`assistant`]),timestamp:o(),attachments:r(j),toolCalls:r(M).meta({deprecated:!0,description:`Deprecated: superseded by contentBlocks (the tool_use variant). Flat list of tool calls.`}).optional(),surfaces:r(N).meta({deprecated:!0,description:`Deprecated: superseded by contentBlocks (the surface variant). Flat list of surfaces.`}).optional(),textSegments:r(o()).meta({deprecated:!0,description:`Deprecated: superseded by contentBlocks. Text segments split by tool-call boundaries.`}).optional(),thinkingSegments:r(o()).meta({deprecated:!0,description:`Deprecated: superseded by contentBlocks. Reasoning text extracted from thinking blocks.`}).optional(),contentOrder:r(o()).meta({deprecated:!0,description:`Deprecated: superseded by contentBlocks. Positional "<type>:<index>" content ordering (e.g. "text:0", "thinking:1").`}).optional(),contentBlocks:r(yr).optional(),subagentNotification:cr.optional(),acpNotification:lr.optional(),backgroundEventNotification:c().optional(),backgroundToolCompletion:ur.optional(),systemCard:c().optional(),providerError:d({code:o().optional(),category:o().optional()}).optional(),slackMessage:pr.optional(),queueStatus:u([`queued`,`processing`]).optional(),queuePosition:a().optional()}),xr=d({status:b}),Sr=i(`notification`),Cr=u([`new`,`seen`,`acted_on`,`dismissed`]),wr=u([`low`,`medium`,`high`,`critical`]),Tr=u([`security`,`scheduling`,`background`,`email`,`system`]),Er=u([`heartbeat`,`memory_consolidation`,`schedule`,`auto_analysis`,`user`,`other`]),Dr=d({id:o(),label:o(),prompt:o()}),Or=u([`emailDraft`,`documentPreview`,`permissionChat`,`paymentAuth`,`toolPermission`,`updatesList`]),kr=d({kind:Or}),Ar=d({id:o(),type:Sr,priority:a().int().min(0).max(100),title:o().optional(),summary:o(),timestamp:o(),status:Cr.default(`new`),expiresAt:o().optional(),actions:r(Dr).optional(),urgency:wr.optional(),conversationId:o().optional(),detailPanel:kr.optional(),category:Tr.optional(),noteworthy:c().optional(),fromAssistant:c().optional(),metadata:s(o(),p()).optional(),sourceType:Er.optional(),sourceKey:o().optional(),sourceLabel:o().optional(),createdAt:o()}),jr=u([`deterministic`,`assistant`]),Mr=d({id:o(),label:o(),icon:o().optional(),prompt:o(),source:jr}),Nr=d({greeting:o(),timeAwayLabel:o(),newCount:a().int().min(0)}),Pr=d({items:r(Ar),updatedAt:o(),contextBanner:Nr,suggestedPrompts:r(Mr)}),Fr=d({id:o(),category:u([`voice`,`world`,`priorities`]),text:o(),confidence:u([`strong`,`uncertain`]),source:u([`onboarding`,`inferred`])}),Ir=d({id:o(),name:o(),description:o(),tier:u([`unlocked`,`next-up`,`earned`]),gate:o(),unlockHint:o().optional(),ctaLabel:o().optional()}),Lr=d({version:i(1),assistantId:o(),tier:t([i(1),i(2),i(3),i(4)]),progressPercent:a(),facts:r(Fr),capabilities:r(Ir),conversationCount:a(),hatchedDate:o(),assistantName:o(),userName:o().optional(),updatedAt:o()}),Rr=d({key:o(),label:o(),ms:a()}),zr=d({key:o(),label:o(),ms:a(),subPhases:r(Rr).optional()}),Br=d({phases:r(zr),ttftMs:a().nullish(),totalToFirstTokenMs:a().nullish(),providerDurationMs:a().nullish(),firstTokenKind:u([`thinking`,`text`]).nullish()}),Vr=d({provider:o().nullish(),model:o().nullish(),status:o().nullish(),inputTokens:a().nullish(),outputTokens:a().nullish(),cacheCreationInputTokens:a().nullish(),cacheReadInputTokens:a().nullish(),stopReason:o().nullish(),requestMessageCount:a().nullish(),requestToolCount:a().nullish(),responseMessageCount:a().nullish(),responseToolCallCount:a().nullish(),responsePreview:o().nullish(),toolCallNames:r(o()).nullish(),estimatedCostUsd:a().nullish(),durationMs:a().nullish()}),P=d({kind:o(),label:o().nullish(),role:o().nullish(),text:o().nullish(),toolName:o().nullish(),data:p().optional(),language:o().nullish()}),Hr=d({name:o().nullish(),message:o().nullish(),code:o().nullish(),provider:o().nullish(),statusCode:a().nullish(),retryAfterMs:a().nullish(),apiErrorCode:o().nullish(),apiErrorType:o().nullish(),apiErrorParam:o().nullish(),requestId:o().nullish()}),Ur=d({id:o(),createdAt:a(),requestPayload:ne(),responsePayload:ne(),provider:o().nullish(),summary:Vr.nullish(),requestSections:r(P).nullish(),responseSections:r(P).nullish(),agentLoopExitReason:o().nullish(),callSite:o().nullish(),error:Hr.nullish(),latency:Br.nullish()}),Wr=d({nodeId:o(),score:a(),semanticSimilarity:a(),recencyBoost:a(),type:o().optional()}),Gr=d({reason:o(),semanticUnavailable:c(),fallbackSources:r(o())}),Kr=d({enabled:c(),degraded:c(),provider:o().nullable(),model:o().nullable(),degradation:Gr.nullable(),semanticHits:a().nullish(),mergedCount:a().nullish(),selectedCount:a().nullish(),tier1Count:a().nullish(),tier2Count:a().nullish(),hybridSearchLatencyMs:a().nullish(),sparseVectorUsed:c().nullish(),injectedTokens:a().nullish(),latencyMs:a().nullish(),topCandidates:r(Wr),injectedText:o().nullable(),reason:o().nullable(),queryContext:o().nullable()}),qr=d({slug:o(),finalActivation:a(),ownActivation:a(),priorActivation:a(),simUser:a(),simAssistant:a(),simNow:a(),simUserRerankBoost:a().optional(),simAssistantRerankBoost:a().optional(),inRerankPool:c().optional(),spreadContribution:a(),source:o(),status:o()}),Jr=d({d:a(),c_user:a(),c_assistant:a(),c_now:a(),k:a(),hops:a(),top_k:a(),epsilon:a()}),Yr=d({turn:a(),mode:o(),concepts:r(qr),config:Jr}),Xr=d({slug:o(),source:o(),pinned:c(),sectionOrdinal:a().nullable().optional(),sectionHeading:o().nullable().optional()}),Zr=d({turn:a(),live:c(),selections:r(Xr),injectedText:o()}),Qr=d({messageId:o().nullish(),conversationKey:o().nullish(),conversationId:o().nullish(),conversationKind:o(),conversationTotalEstimatedCostUsd:a().nullish(),logs:r(Ur),memoryRecall:Kr.nullable(),memoryV2Activation:Yr.nullable(),memoryV3Selection:Zr.nullish()}),$r=d({type:o(),content:o(),toolName:o().optional(),isError:c().optional(),messageId:o().optional(),toolUseId:o().optional(),input:s(o(),p()).optional()}),ei=d({subagentId:o(),objective:o().optional(),status:T.optional(),usage:E.optional(),events:r($r),label:o().optional(),parentToolUseId:o().optional(),conversationId:o().optional()}),ti=d({seq:a().int(),kind:u([`agent`,`workflow`]),label:o().optional(),phase:o().optional(),promptSummary:o().optional(),status:o(),resultSummary:o().optional(),inputTokens:a().optional(),outputTokens:a().optional(),createdAt:a().nullable()}),ni=d({runId:o(),status:A.optional(),agentsSpawned:a().optional(),inputTokens:a().optional(),outputTokens:a().optional(),phase:o().optional(),leaves:r(ti)});function F(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function ri(e){if(F(e))return e;if(typeof e==`string`)try{let t=JSON.parse(e);if(F(t))return t}catch{}return{}}var I=()=>o().optional().catch(void 0),L=()=>c().optional().catch(void 0),R=()=>a().finite().optional().catch(void 0);function z(e){return l(e=>Array.isArray(e)?e.filter(F):[],r(e))}var B=d({title:o().optional(),subtitle:o().optional(),body:o().optional(),metadata:r(d({label:m(),value:m()})).optional(),template:o().optional(),templateData:s(o(),p()).optional()}),ii=l(e=>{let t=(typeof e==`string`?e.split(`,`):Array.isArray(e)?e:[]).map(e=>typeof e==`string`||typeof e==`number`?String(e).trim():``).filter(e=>e.length>0);return t.length>0?t:void 0},r(o()).optional()),V=d({prompt:m().optional(),acceptedTypes:ii,maxFiles:ie().int().positive().optional().catch(void 0),maxSizeBytes:ie().positive().optional().catch(void 0)}),H=d({text:o().catch(``),label:I(),language:I()});function ai(e,t){let n={...t};for(let t of[`text`,`label`,`language`])typeof n[t]!=`string`&&typeof e[t]==`string`&&(n[t]=e[t]);return H.parse(n)}var oi=d({id:o(),title:o(),description:I(),recommended:L(),data:s(o(),p()).optional().catch(void 0)}),si=l(e=>Array.isArray(e)?e.flatMap(e=>{if(!F(e))return[];let t=typeof e.id==`string`?e.id.trim():``,n=typeof e.title==`string`?e.title.trim():typeof e.label==`string`?e.label.trim():``;return!t||!n?[]:[{...e,id:t,title:n}]}):[],r(oi)),U=d({description:I(),options:si,selectionMode:l(e=>e===`multiple`?`multiple`:`single`,u([`single`,`multiple`])),commitOnSelect:L(),submitLabel:I()}),W=d({providerKey:l(e=>typeof e==`string`?e.trim():e,o()).catch(``),displayName:I(),description:I(),logoUrl:o().nullable().optional().catch(void 0)}),G=d({id:o().catch(``),type:u([`text`,`textarea`,`select`,`toggle`,`number`,`password`]).catch(`text`),label:o().catch(``),placeholder:I(),required:L(),defaultValue:t([o(),a(),c()]).optional().catch(void 0),options:r(d({label:m(),value:m()})).optional().catch(void 0)}),ci=d({id:o().catch(``),title:o().catch(``),description:I(),fields:z(G)}),K=d({description:I(),fields:z(G),submitLabel:I(),pages:z(ci).optional().catch(void 0),pageLabels:d({next:I(),back:I(),submit:I()}).optional().catch(void 0),progressStyle:u([`bar`,`tabs`]).optional().catch(void 0)}),li=d({id:o().catch(``),title:o().catch(``),subtitle:I(),icon:I(),selected:L()}),q=d({items:z(li),selectionMode:u([`single`,`multiple`,`none`]).catch(`none`)}),ui=d({id:o().catch(``),label:o().catch(``),width:R()}),di=d({text:m().catch(``),icon:I(),iconColor:I()}),fi=d({id:o().catch(``),cells:s(o(),t([o(),di]).catch(``)).catch({}),selectable:L(),selected:L()}),J=d({columns:z(ui),rows:z(fi),selectionMode:u([`none`,`single`,`multiple`]).optional().catch(void 0),caption:I()}),Y=d({message:o().catch(``),detail:I(),confirmLabel:I(),confirmedLabel:I(),cancelLabel:I(),destructive:L()}),pi=d({title:o().catch(``),subtitle:I(),description:I(),icon:I(),metrics:r(d({label:m(),value:m()})).optional().catch(void 0),context:u([`app_create`,`general`]).optional().catch(void 0),previewImage:I()}),mi=d({html:o().catch(``),width:R(),height:R(),appId:I(),dirName:I(),reloadGeneration:R(),status:I(),preview:pi.optional().catch(void 0)}),hi=d({title:o().catch(``),surfaceId:o().catch(``),subtitle:I(),content:I(),mimeType:I()}),gi=u([`completed`,`partial`,`failed`,`in_progress`]),X=u([`neutral`,`positive`,`warning`,`negative`]),_i=u([`items`,`timeline`,`diff`,`artifacts`,`warnings`]),vi=()=>({label:m().catch(``),value:t([o(),a()]).catch(``)}),yi=d({...vi(),detail:I(),tone:X.optional().catch(void 0)}),bi=d(vi()),Z=d({id:I(),title:m().catch(``),description:I(),status:I(),tone:X.optional().catch(void 0),metadata:z(bi).optional().catch(void 0),href:I()}),xi=d({label:I(),before:I(),after:I()}),Si=d({id:I(),title:m().catch(``),description:I(),type:_i.optional().catch(void 0),items:z(Z).optional().catch(void 0),diffs:z(xi).optional().catch(void 0)}),Ci=d({eyebrow:I(),status:gi.optional().catch(void 0),summary:I(),metrics:z(yi).optional().catch(void 0),sections:z(Si).optional().catch(void 0)}),wi=d({html:o().catch(``),height:R()}),Q=[`card`,`channel_setup`,`choice`,`copy_block`,`oauth_connect`,`form`,`list`,`table`,`confirmation`,`dynamic_page`,`file_upload`,`document_preview`,`task_preferences`,`work_result`,`skill_card`,`call_summary`,`visual`],Ti=u(Q),Ei=[`skill_card`,`call_summary`],Di=new Set(Ei);function Oi(e){return Di.has(e)}var ki=Q.filter(e=>!Oi(e));new Set(Q);var Ai={card:B,channel_setup:s(o(),p()),choice:U,copy_block:H,oauth_connect:W,form:K,list:q,table:J,confirmation:Y,dynamic_page:mi,file_upload:V,document_preview:hi,task_preferences:s(o(),p()),work_result:Ci,skill_card:s(o(),p()),call_summary:s(o(),p()),visual:wi},ji=e({ACPOptionKindSchema:()=>je,ACPOptionSchema:()=>Me,AcpSessionCompletedEventSchema:()=>oe,AcpSessionErrorEventSchema:()=>se,AcpSessionSpawnedEventSchema:()=>ce,AcpSessionUpdateEventSchema:()=>ue,AcpSessionUpdateTypeSchema:()=>le,AcpSessionUsageEventSchema:()=>de,AcpStopReasonSchema:()=>ae,AllowlistOptionSchema:()=>h,AnsweredQuestionResponseSchema:()=>En,AnsweredQuestionSchema:()=>D,AppFilesChangedEventSchema:()=>fe,AssistantActivityAnchorSchema:()=>me,AssistantActivityPhaseSchema:()=>pe,AssistantActivityReasonSchema:()=>he,AssistantActivityStateEventSchema:()=>ge,AssistantEventEnvelopeSchema:()=>Mi,AssistantEventSchema:()=>$,AssistantOutboundAttachmentSchema:()=>x,AssistantStatusEventSchema:()=>_e,AssistantTextDeltaEventSchema:()=>ve,AssistantThinkingDeltaEventSchema:()=>ye,AssistantTurnStartEventSchema:()=>be,AvatarUpdatedEventSchema:()=>xe,BackgroundToolCompletedEventSchema:()=>Se,BackgroundToolStartedEventSchema:()=>Ce,BookmarkCreatedEventSchema:()=>Te,BookmarkDeletedEventSchema:()=>Ee,BookmarkSummarySchema:()=>we,CALL_SITE_COMPACTION_AGENT:()=>Zn,CALL_SITE_SYNTHETIC_AGENT_ERROR_MESSAGE:()=>Xn,CapabilitySchema:()=>Ir,CardSurfaceDataSchema:()=>B,ChoiceOptionSchema:()=>oi,ChoiceSurfaceDataSchema:()=>U,ClientSettingsUpdateEventSchema:()=>De,CompactionCircuitClosedEventSchema:()=>Oe,CompactionCircuitOpenEventSchema:()=>ke,ConfigChangedEventSchema:()=>Ae,ConfirmationDiffSchema:()=>v,ConfirmationExecutionTargetSchema:()=>Ne,ConfirmationRequestEventSchema:()=>Pe,ConfirmationStateChangedEventSchema:()=>Fe,ConfirmationSurfaceDataSchema:()=>Y,ContactRequestEventSchema:()=>Ie,ContactsChangedEventSchema:()=>Le,ContextBannerSchema:()=>Nr,ContextCompactedEventSchema:()=>Re,ContextWindowUsageEventSchema:()=>ze,ConversationAttachmentBlockSchema:()=>vr,ConversationContentBlockSchema:()=>yr,ConversationErrorCodeSchema:()=>y,ConversationErrorEventSchema:()=>Be,ConversationInferenceProfileUpdatedEventSchema:()=>Ve,ConversationListInvalidatedEventSchema:()=>Ue,ConversationListInvalidatedReasonSchema:()=>He,ConversationMessageAttachmentSchema:()=>j,ConversationMessageSchema:()=>br,ConversationMessageSurfaceSchema:()=>N,ConversationMessageToolCallSchema:()=>M,ConversationNoticeEventSchema:()=>Ge,ConversationNoticeSourceSchema:()=>We,ConversationSlackMessageSchema:()=>pr,ConversationSubagentNotificationSchema:()=>cr,ConversationSurfaceBlockSchema:()=>_r,ConversationTextBlockSchema:()=>mr,ConversationThinkingBlockSchema:()=>hr,ConversationTitleUpdatedEventSchema:()=>Ke,ConversationToolUseBlockSchema:()=>gr,CopyBlockSurfaceDataSchema:()=>H,DAEMON_INTERNAL_SURFACE_TYPES:()=>Ei,DEFAULT_TOOL_EXECUTION_TIMEOUT_SEC:()=>120,DictationContextSchema:()=>$n,DictationRequestSchema:()=>er,DirectoryScopeOptionSchema:()=>_,DiskPressureBlockedCapabilitySchema:()=>Je,DiskPressureStateSchema:()=>qe,DiskPressureStatusChangedEventSchema:()=>Ye,DiskPressureStatusResponseSchema:()=>xr,DiskPressureStatusSchema:()=>b,DocumentCommentCreatedEventSchema:()=>Ze,DocumentCommentDeletedEventSchema:()=>Qe,DocumentCommentReopenedEventSchema:()=>$e,DocumentCommentResolvedEventSchema:()=>et,DocumentEditorShowEventSchema:()=>tt,DocumentEditorUpdateEventSchema:()=>nt,DocumentPreviewSurfaceDataSchema:()=>hi,DynamicPagePreviewSchema:()=>pi,DynamicPageSurfaceDataSchema:()=>mi,ErrorEventSchema:()=>rt,FactSchema:()=>Fr,FeedActionSchema:()=>Dr,FeedItemCategorySchema:()=>Tr,FeedItemDetailPanelKindSchema:()=>Or,FeedItemDetailPanelSchema:()=>kr,FeedItemSchema:()=>Ar,FeedItemSourceTypeSchema:()=>Er,FeedItemStatusSchema:()=>Cr,FeedItemTypeSchema:()=>Sr,FeedItemUrgencySchema:()=>wr,FileUploadSurfaceDataSchema:()=>V,FormFieldSchema:()=>G,FormPageSchema:()=>ci,FormSurfaceDataSchema:()=>K,GenerationCancelledEventSchema:()=>it,GenerationHandoffEventSchema:()=>at,HeartbeatAlertEventSchema:()=>ot,HeartbeatConversationCreatedEventSchema:()=>st,HomeFeedResponseSchema:()=>Pr,HomeFeedUpdatedEventSchema:()=>ct,HookEventOwnerSchema:()=>lt,HookEventSchema:()=>ut,HostAppControlCancelEventSchema:()=>vt,HostAppControlInputSchema:()=>gt,HostAppControlRequestEventSchema:()=>_t,HostAppControlSequenceStepSchema:()=>ht,HostBashCancelEventSchema:()=>bt,HostBashRequestEventSchema:()=>yt,HostBrowserCancelEventSchema:()=>St,HostBrowserRequestEventSchema:()=>xt,HostCuCancelEventSchema:()=>wt,HostCuRequestEventSchema:()=>Ct,HostFileCancelEventSchema:()=>Et,HostFileRequestEventSchema:()=>Tt,HostTransferCancelEventSchema:()=>Ot,HostTransferRequestEventSchema:()=>Dt,HostUiSnapshotCancelEventSchema:()=>jt,HostUiSnapshotRequestEventSchema:()=>At,HostUiSnapshotViewSchema:()=>kt,IdentityChangedEventSchema:()=>Mt,InteractionResolutionStateSchema:()=>Nt,InteractionResolvedEventSchema:()=>Pt,LLMCallErrorSchema:()=>Hr,LLMCallSummarySchema:()=>Vr,LLMContextSectionSchema:()=>P,LLMRequestLogEntrySchema:()=>Ur,LatencyBreakdownSchema:()=>Br,LatencyPhaseSchema:()=>zr,ListItemSchema:()=>li,ListSurfaceDataSchema:()=>q,LlmContextResponseSchema:()=>Qr,MODEL_INVOKABLE_SURFACE_TYPES:()=>ki,MemoryCandidateSchema:()=>Wr,MemoryDegradationSchema:()=>Gr,MemoryRecallLogSchema:()=>Kr,MemoryRecalledCandidateDebugSchema:()=>Ft,MemoryRecalledDegradationSchema:()=>S,MemoryRecalledEventSchema:()=>It,MemoryStatusEventSchema:()=>Lt,MemoryV2ActivationLogSchema:()=>Yr,MemoryV2ConceptRowSchema:()=>qr,MemoryV2ConfigSnapshotSchema:()=>Jr,MemoryV3SelectionLogSchema:()=>Zr,MemoryV3SelectionRowSchema:()=>Xr,MessageCompleteEventSchema:()=>Rt,MessageDequeuedEventSchema:()=>zt,MessageQueuedDeletedEventSchema:()=>Vt,MessageQueuedEventSchema:()=>Bt,MessageRequestCompleteEventSchema:()=>Ht,MessageRequeuedEventSchema:()=>Ut,MessageSteeredEventSchema:()=>Wt,ModelInfoEventSchema:()=>qt,NavigateSettingsEventSchema:()=>Jt,NotificationConversationCreatedEventSchema:()=>Yt,NotificationIntentEventSchema:()=>Xt,OAuthConnectResultEventSchema:()=>Zt,OAuthConnectSurfaceDataSchema:()=>W,OpenConversationEventSchema:()=>Qt,OpenPanelEventSchema:()=>$t,OpenUrlEventSchema:()=>en,PendingToolConfirmationSchema:()=>ir,PlatformDisconnectedEventSchema:()=>tn,QuestionEntrySchema:()=>w,QuestionOptionSchema:()=>C,QuestionRequestEventSchema:()=>nn,RecordingOptionsSchema:()=>rn,RecordingPauseEventSchema:()=>sn,RecordingResumeEventSchema:()=>cn,RecordingStartEventSchema:()=>an,RecordingStopEventSchema:()=>on,RelationshipStateSchema:()=>Lr,RelationshipStateUpdatedEventSchema:()=>ln,RiskScopeOptionSchema:()=>Dn,SSE_REPLAY_RING_AGE_LIMIT_MS:()=>Qn,SSE_REPLAY_RING_COUNT_LIMIT:()=>200,SURFACE_DATA_SCHEMAS:()=>Ai,SURFACE_TYPES:()=>Q,ScheduleConversationCreatedEventSchema:()=>un,ScopeOptionSchema:()=>g,SecretRequestEventSchema:()=>dn,ServiceGroupUpdateCompleteEventSchema:()=>fn,ServiceGroupUpdateProgressEventSchema:()=>pn,ServiceGroupUpdateStartingEventSchema:()=>mn,ShowPlatformLoginEventSchema:()=>hn,SkillStateChangedEventSchema:()=>gn,SoundsConfigUpdatedEventSchema:()=>_n,SubagentDetailEventSchema:()=>$r,SubagentDetailResponseSchema:()=>ei,SubagentEventEventSchema:()=>yn,SubagentInnerEventSchema:()=>vn,SubagentSpawnedEventSchema:()=>bn,SubagentStatusChangedEventSchema:()=>xn,SubagentStatusSchema:()=>T,SubagentUsageStatsSchema:()=>E,SuggestedPromptSchema:()=>Mr,SuggestedPromptSourceSchema:()=>jr,SurfaceActionSchema:()=>zn,SurfaceTypeSchema:()=>Ti,SyncChangedEventSchema:()=>Sn,TableCellValueSchema:()=>di,TableColumnSchema:()=>ui,TableRowSchema:()=>fi,TableSurfaceDataSchema:()=>J,ToolActivityMetadataSchema:()=>O,ToolInputDeltaEventSchema:()=>Cn,ToolOutputChunkEventSchema:()=>Tn,ToolOutputChunkSubTypeSchema:()=>wn,ToolResultEventSchema:()=>Nn,ToolUsePreviewStartEventSchema:()=>Pn,ToolUseStartEventSchema:()=>Fn,UISurfaceCompleteEventSchema:()=>In,UISurfaceDismissEventSchema:()=>Ln,UISurfacePendingEventSchema:()=>Rn,UISurfaceShowEventSchema:()=>Bn,UISurfaceUndoResultEventSchema:()=>Vn,UISurfaceUpdateEventSchema:()=>Hn,UsageProgressEventSchema:()=>k,UsageUpdateEventSchema:()=>Un,UserMessageEchoEventSchema:()=>Wn,VisualSurfaceDataSchema:()=>wi,WebFetchMetadataSchema:()=>Mn,WebSearchMetadataSchema:()=>jn,WebSearchProviderIdSchema:()=>On,WebSearchResultItemSchema:()=>An,WorkResultDiffSchema:()=>xi,WorkResultItemSchema:()=>Z,WorkResultMetadataSchema:()=>bi,WorkResultMetricSchema:()=>yi,WorkResultSectionSchema:()=>Si,WorkResultSectionTypeSchema:()=>_i,WorkResultStatusSchema:()=>gi,WorkResultSurfaceDataSchema:()=>Ci,WorkResultToneSchema:()=>X,WorkflowCompletedEventSchema:()=>Gn,WorkflowJournalResponseSchema:()=>ni,WorkflowLeafFinishedEventSchema:()=>Kn,WorkflowLeafSchema:()=>ti,WorkflowLeafStartedEventSchema:()=>qn,WorkflowProgressEventSchema:()=>Jn,WorkflowRunStatusSchema:()=>A,WorkflowStartedEventSchema:()=>Yn,coerceSurfaceDataRecord:()=>ri,isDaemonInternalSurfaceType:()=>Oi,normalizeCopyBlockShowData:()=>ai}),$=f(`type`,[oe,se,ce,ue,de,fe,ge,_e,ve,ye,be,xe,Se,Ce,Te,Ee,De,Oe,ke,Ae,Pe,Fe,Ie,Le,Re,ze,Be,Ve,Ue,Ge,Ke,Ye,Ze,Qe,$e,et,tt,nt,rt,it,at,ot,st,ct,ut,vt,_t,bt,yt,St,xt,wt,Ct,Et,Tt,Ot,Dt,jt,At,Mt,Pt,It,Lt,Rt,zt,Bt,Vt,Ht,Ut,Wt,qt,Jt,Yt,Xt,Zt,Qt,$t,en,tn,nn,sn,cn,an,on,ln,un,dn,fn,pn,mn,hn,gn,_n,yn,bn,xn,Sn,Cn,Tn,Nn,Pn,Fn,In,Ln,Rn,Bn,Vn,Hn,k,Un,Wn,Gn,Kn,qn,Jn,Yn]),Mi=d({id:o(),conversationId:o().optional(),seq:a().int().optional(),emittedAt:o(),message:$});export{Zn as _,U as a,T as b,V as c,W as d,J as f,Qn as g,xr as h,B as i,K as l,ei as m,$ as n,Y as o,ni as p,ji as r,H as s,Mi as t,q as u,Xn as v,k as y};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{U as e,Z as t,l as n,s as r}from"./local-mode-BR8wpdXp.js";import{h as i}from"./api-DZ1FASA0.js";import{n as a,o}from"./api-errors-37rFaJd8.js";import{H as s,T as c,U as l,V as u,a as d,i as f,o as p,w as m}from"./sdk.gen-DKp2Mbw9.js";import{_ as h,ht as g,jt as _,mt as v,v as y,y as b}from"./sdk.gen-qwmaWHuE.js";async function x(e,t){let{data:n,error:r,response:i}=await m({body:e??{},query:t?{mode:t}:void 0,throwOnError:!1});return a(i,r,`Failed to hatch assistant.`),i.ok?{ok:!0,status:i.status,data:n}:{ok:!1,status:i.status,error:o(r,i)}}async function S(e){if(t()){let t=e?r(e):n();if(t)return{ok:!0,status:200,data:{id:t.assistantId,name:t.name??t.assistantId,status:`active`,is_local:!0,created:t.hatchedAt??``}}}if(e){let{data:t,error:n,response:r}=await l({path:{id:e},throwOnError:!1});return a(r,n,`Failed to get assistant.`),r.ok?{ok:!0,status:r.status,data:t}:{ok:!1,status:r.status,error:o(n,r)}}let i=await c({query:{hosting:`platform`},throwOnError:!1});if(a(i.response,i.error,`Failed to get assistant.`),!i.response.ok)return{ok:!1,status:i.response.status,error:o(i.error,i.response)};let s=i.data?.results??[];if(s.length>0)return{ok:!0,status:i.response.status,data:s[0]};let u=await c({query:{hosting:`local`},throwOnError:!1});if(a(u.response,u.error,`Failed to get assistant.`),u.response.ok){let e=u.data?.results??[];if(e.length>0)return{ok:!0,status:u.response.status,data:e[0]}}return u.response.ok?{ok:!1,status:404,error:{detail:`No assistants found`}}:{ok:!1,status:u.response.status,error:o(u.error,u.response)}}async function C(e){let{data:t,error:n,response:r}=await _({path:{assistant_id:e},throwOnError:!1});return a(r,n,`Failed to get assistant healthz.`),r.ok&&t?{ok:!0,status:r.status,data:t}:{ok:!1,status:r.status,error:o(n,r)}}async function w(e){let{data:t,error:n,response:r}=await g({path:{assistant_id:e},throwOnError:!1});if(a(r,n,`Failed to get assistant disk pressure status.`),r.ok){let e=i.safeParse(t);return e.success?{ok:!0,status:r.status,data:e.data}:{ok:!1,status:r.status,error:o(e.error.message,r)}}return{ok:!1,status:r.status,error:o(n,r)}}async function T(e){let{data:t,error:n,response:r}=await v({path:{assistant_id:e},throwOnError:!1});if(a(r,n,`Failed to acknowledge assistant disk pressure.`),r.ok){let e=i.safeParse(t);return e.success?{ok:!0,status:r.status,data:e.data}:{ok:!1,status:r.status,error:o(e.error.message,r)}}return{ok:!1,status:r.status,error:o(n,r)}}function E(e){let t=e&&typeof e==`object`&&!Array.isArray(e)?e:{};if(Array.isArray(t.backups))return t.backups;let n=t,r=[],i=n.local?.snapshots;if(Array.isArray(i))for(let e of i)r.push({snapshot_name:e.filename,pvc:``,created_at:e.created_at,ready_to_use:!0,backup_type:`scheduled`,path:e.path});if(Array.isArray(n.offsite)){for(let e of n.offsite)if(Array.isArray(e.snapshots))for(let t of e.snapshots)r.push({snapshot_name:t.filename,pvc:``,created_at:t.created_at,ready_to_use:!t.encrypted,backup_type:`scheduled`,path:t.path})}return r}function D(e){let t=e&&typeof e==`object`&&!Array.isArray(e)?e:{};return Array.isArray(t.backups)?t.backups:[]}async function O(t){let n=!e(),[r,i]=await Promise.all([y({path:{assistant_id:t},throwOnError:!1}),n?p({path:{assistant_id:t},throwOnError:!1}):null]);if(a(r.response,r.error,`Failed to list assistant backups.`),!r.response.ok)return{ok:!1,status:r.response.status,error:o(r.error,r.response)};let s=E(r.data);if(i){if(i.response?.ok){let e=D(i.data);return{ok:!0,status:r.response.status,data:[...e,...s]}}if(s.length===0&&i.response)return{ok:!1,status:i.response.status,error:o(i.error,i.response)}}return{ok:!0,status:r.response.status,data:s}}async function k(t){let{data:n,error:r,response:i}=e()?await h({path:{assistant_id:t},throwOnError:!1}):await f({path:{assistant_id:t},throwOnError:!1});if(a(i,r,`Failed to create assistant backup.`),i.ok){let e=n&&typeof n==`object`&&!Array.isArray(n)?n:{};return{ok:!0,status:i.status,data:e}}return{ok:!1,status:i.status,error:o(r,i)}}async function A(t,n){let{data:r,error:i,response:s}=e()?await b({path:{assistant_id:t},body:{path:n.path??n.snapshot_name},throwOnError:!1}):await d({path:{assistant_id:t,snapshot_name:n.snapshot_name},throwOnError:!1});if(a(s,i,`Failed to restore assistant backup.`),s.ok){let e=r&&typeof r==`object`&&!Array.isArray(r)?r:{};return{ok:!0,status:s.status,data:e}}return{ok:!1,status:s.status,error:o(i,s)}}async function j(e){let{data:t,error:n,response:r}=await u({path:{id:e},throwOnError:!1});return a(r,n,`Failed to restart assistant.`),r.ok?{ok:!0,data:t&&typeof t==`object`&&!Array.isArray(t)?t:{}}:{ok:!1,status:r.status,error:o(n,r)}}async function M(e){let{error:t,response:n}=await s({path:{id:e},throwOnError:!1});return a(n,t,`Failed to retire assistant.`),n.ok?{ok:!0}:{ok:!1,status:n.status,error:o(t,n)}}async function N(){let{data:e,error:t,response:n}=await c({query:{hosting:`all`},throwOnError:!1});return a(n,t,`Failed to list assistants.`),n.ok?{ok:!0,status:n.status,data:e?.results??[]}:{ok:!1,status:n.status,error:o(t,n)}}export{C as a,N as c,M as d,w as i,j as l,k as n,x as o,S as r,O as s,T as t,A as u};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function e(e,t){return e&&typeof e==`object`&&!Array.isArray(e)?e:typeof e==`string`&&!e.trimStart().startsWith(`<`)?{detail:e.slice(0,500)||t?.statusText||`Request failed.`}:{detail:t?.statusText||`Request failed.`}}function t(e,t,n){if(e&&typeof e==`object`&&!Array.isArray(e)){if(`detail`in e&&typeof e.detail==`string`)return e.detail;if(`error`in e){if(typeof e.error==`string`)return e.error;if(e.error&&typeof e.error==`object`&&`message`in e.error&&typeof e.error.message==`string`)return e.error.message}if(`message`in e&&typeof e.message==`string`)return e.message}return typeof e==`string`&&e&&!e.trimStart().startsWith(`<`)?e:n??(t?`HTTP ${t.status}`:`Request failed.`)}function n(e,t,n){if(!e)throw t instanceof Error?t:Error(n)}var r=class extends Error{status;constructor(e,t){super(t),this.name=`ApiError`,this.status=e}};function i(e,n){return new r(n.status,t(e,n,`HTTP ${n.status}`))}export{
|
|
1
|
+
function e(e,t){return e&&typeof e==`object`&&!Array.isArray(e)?e:typeof e==`string`&&!e.trimStart().startsWith(`<`)?{detail:e.slice(0,500)||t?.statusText||`Request failed.`}:{detail:t?.statusText||`Request failed.`}}function t(e,t,n){if(e&&typeof e==`object`&&!Array.isArray(e)){if(`detail`in e&&typeof e.detail==`string`)return e.detail;if(`error`in e){if(typeof e.error==`string`)return e.error;if(e.error&&typeof e.error==`object`&&`message`in e.error&&typeof e.error.message==`string`)return e.error.message}if(`message`in e&&typeof e.message==`string`)return e.message}return typeof e==`string`&&e&&!e.trimStart().startsWith(`<`)?e:n??(t?`HTTP ${t.status}`:`Request failed.`)}function n(e,t,n){if(!e)throw t instanceof Error?t:Error(n)}var r=class extends Error{status;constructor(e,t){super(t),this.name=`ApiError`,this.status=e}};function i(e){if(!(e instanceof r)||e.status!==400)return;let t=e.message.trim();if(!(t.length===0||/^HTTP \d+$/.test(t)))return t}function a(e,n){return new r(n.status,t(e,n,`HTTP ${n.status}`))}export{a,t as i,n,e as o,i as r,r as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{o as e}from"./chunk-jRWAZmH_.js";import{t}from"./react-BFJW0bSv.js";import{t as n}from"./button-fyWSnR9X.js";import{m as r,u as i}from"./chunk-5KNZJZUH-Bsoom5--.js";import{t as a}from"./jsx-runtime-D3ZM-ToX.js";import{t as o}from"./input-B_e9sgY6.js";import{t as s}from"./dropdown-Dj83uU1o.js";import{t as c}from"./is-electron-DLs5KNwr.js";import{d as l}from"./routes-CAe1h0Db.js";import{t as u}from"./onboarding-layout--37tB9YP.js";import{a as d,c as f,i as p,o as m,r as h,s as g}from"./provider-key-
|
|
1
|
+
import{o as e}from"./chunk-jRWAZmH_.js";import{t}from"./react-BFJW0bSv.js";import{t as n}from"./button-fyWSnR9X.js";import{m as r,u as i}from"./chunk-5KNZJZUH-Bsoom5--.js";import{t as a}from"./jsx-runtime-D3ZM-ToX.js";import{t as o}from"./input-B_e9sgY6.js";import{t as s}from"./dropdown-Dj83uU1o.js";import{t as c}from"./is-electron-DLs5KNwr.js";import{d as l}from"./routes-CAe1h0Db.js";import{t as u}from"./onboarding-layout--37tB9YP.js";import{a as d,c as f,i as p,o as m,r as h,s as g}from"./provider-key-CqQjkBY-.js";import"./onboarding-step-layout-C3Maoz0G.js";var _=e(t(),1),v=a();function y(){let e=i(),[t]=r(),a=t.get(`hosting`),y=c(),b=h(),[x,S]=(0,_.useState)(()=>b?.provider??d.id),[C,w]=(0,_.useState)(()=>b?.key??``),[T,E]=(0,_.useState)(()=>b?.model??g(b?.provider??d.id)??``),[D,O]=(0,_.useState)(()=>b?.baseUrl??``),[k,A]=(0,_.useState)(()=>b?.customModels??``),j=f(x)??d,M=j.models??[],N=j.requiresKey,P=M.length>0,F=x===`openai-compatible`,I=(!(N&&!F)||C.trim().length>0)&&(!P||T.trim().length>0)&&(!F||D.trim().length>0&&k.trim().length>0);return(0,v.jsx)(u,{children:(0,v.jsxs)(`div`,{className:`mx-auto flex w-full max-w-xl flex-col items-center ${y?`min-h-full px-8 pt-21 pb-4 electron-prechat-type`:`px-6 py-16`} text-[var(--content-default)]`,children:[(0,v.jsx)(`h1`,{className:y?`text-title-large`:`text-3xl font-semibold tracking-tight`,style:{animation:`fadeInUp 0.5s ease-out 0.1s both`},children:`Connect a Model Provider`}),(0,v.jsx)(`p`,{className:`text-center text-body-medium-lighter text-[var(--content-tertiary)] ${y?`mt-3.5`:`mt-3`}`,style:{animation:`fadeInUp 0.5s ease-out 0.3s both`},children:`Choose the model provider your assistant should use.`}),(0,v.jsxs)(`div`,{className:`flex w-full flex-col gap-4 ${y?`mt-8`:`mt-10`}`,style:{animation:`fadeInUp 0.5s ease-out 0.4s both`},children:[(0,v.jsxs)(`div`,{className:`flex flex-col ${y?`gap-2`:`gap-1`}`,children:[(0,v.jsx)(`label`,{className:`text-body-small-default text-[var(--content-tertiary)]`,children:`Provider`}),(0,v.jsx)(s,{"aria-label":`Provider`,value:x,onChange:e=>{let t=f(e);t&&(S(t.id),w(``),E(g(t.id)??``))},options:m.map(e=>({value:e.id,label:e.displayName}))})]}),M.length>0&&(0,v.jsxs)(`div`,{className:`flex flex-col ${y?`gap-2`:`gap-1`}`,children:[(0,v.jsx)(`label`,{className:`text-body-small-default text-[var(--content-tertiary)]`,children:`Model`}),(0,v.jsx)(s,{"aria-label":`Model`,value:T,onChange:E,options:M.map(e=>({value:e.id,label:e.displayName}))})]}),F&&(0,v.jsxs)(v.Fragment,{children:[(0,v.jsxs)(`div`,{className:`flex flex-col ${y?`gap-2`:`gap-1`}`,children:[(0,v.jsx)(`label`,{className:`text-body-small-default text-[var(--content-tertiary)]`,children:`Base URL`}),(0,v.jsx)(o,{type:`text`,placeholder:`http://localhost:1234/v1`,value:D,onChange:e=>O(e.target.value),fullWidth:!0})]}),(0,v.jsxs)(`div`,{className:`flex flex-col ${y?`gap-2`:`gap-1`}`,children:[(0,v.jsx)(`label`,{className:`text-body-small-default text-[var(--content-tertiary)]`,children:`Models`}),(0,v.jsx)(o,{type:`text`,placeholder:`model-1, model-2`,value:k,onChange:e=>A(e.target.value),fullWidth:!0}),(0,v.jsx)(`p`,{className:`text-body-small-default text-[var(--content-tertiary)]`,children:`Comma-separated model identifiers exposed by your endpoint.`})]})]}),N&&(0,v.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,v.jsx)(o,{type:`password`,label:`${j.displayName} API Key`,placeholder:j.apiKeyPlaceholder??`Enter your API key`,value:C,onChange:e=>w(e.target.value),className:`touch-mobile:text-[16px]`,fullWidth:!0}),j.docsUrl&&(0,v.jsxs)(`p`,{className:`self-start text-body-medium-lighter text-[var(--content-tertiary)]`,children:[`Don't have it?`,` `,(0,v.jsx)(`a`,{href:j.docsUrl,target:`_blank`,rel:`noreferrer`,className:`text-[var(--content-default)] underline`,children:`Get an API key here`})]})]})]}),(0,v.jsxs)(`div`,{className:`mt-8 flex w-full flex-col ${y?`gap-2.5`:`gap-2`}`,style:{animation:`fadeInUp 0.5s ease-out 0.5s both`},children:[(0,v.jsx)(n,{variant:`primary`,size:`regular`,fullWidth:!0,disabled:!I,onClick:()=>{if(!I)return;let t=T.trim()||g(x);p({provider:x,key:C.trim(),...t?{model:t}:{},...F?{baseUrl:D.trim(),customModels:k.trim()}:{}}),e(a?`${l.onboarding.privacy}?hosting=${a}`:l.onboarding.privacy)},className:y?void 0:`h-11 text-base`,children:`Continue`}),(0,v.jsx)(n,{variant:`outlined`,size:`regular`,fullWidth:!0,onClick:()=>{e(l.onboarding.hosting)},className:y?void 0:`h-11 text-base`,children:`Back`})]})]})})}export{y as ApiKeyScreen};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{o as e}from"./chunk-jRWAZmH_.js";import{t}from"./react-BFJW0bSv.js";import{t as n}from"./button-fyWSnR9X.js";import{n as r}from"./QueryClientProvider-CMu7CkQU.js";import{t as i}from"./jsx-runtime-D3ZM-ToX.js";import{t as a}from"./cn-CJf7MmLX.js";import{t as o}from"./createLucideIcon-CAM1RhH8.js";import"./src-ly8ixpHd.js";import{t as s}from"./external-link-GPGZ1LGU.js";import{t as c}from"./puzzle-4NgH5snP.js";import{n as l}from"./toast-DJj-rM9J.js";import{t as u}from"./confirm-dialog-Ro8nszbc.js";import{n as d,t as f}from"./create-selectors-CEbfsat6.js";import{t as p}from"./sdk.gen-
|
|
1
|
+
import{o as e}from"./chunk-jRWAZmH_.js";import{t}from"./react-BFJW0bSv.js";import{t as n}from"./button-fyWSnR9X.js";import{n as r}from"./QueryClientProvider-CMu7CkQU.js";import{t as i}from"./jsx-runtime-D3ZM-ToX.js";import{t as a}from"./cn-CJf7MmLX.js";import{t as o}from"./createLucideIcon-CAM1RhH8.js";import"./src-ly8ixpHd.js";import{t as s}from"./external-link-GPGZ1LGU.js";import{t as c}from"./puzzle-4NgH5snP.js";import{n as l}from"./toast-DJj-rM9J.js";import{t as u}from"./confirm-dialog-Ro8nszbc.js";import{n as d,t as f}from"./create-selectors-CEbfsat6.js";import{t as p}from"./sdk.gen-qwmaWHuE.js";import{i as m}from"./typed-storage-C92iOTRi.js";import{n as h}from"./react-query.gen-BAqQbp0v.js";import{a as g}from"./viewer-store-CUIaUN_G.js";import{t as _}from"./haptics-DbwTJGZZ.js";import{t as v}from"./pointer-DY1bgd8h.js";import{t as y}from"./misc-DBwubycL.js";import{t as b}from"./edge-swipe-arbiter-store-CfH9mu8t.js";import{i as x}from"./sandbox-bridge-TDSWydru.js";var S=o(`pin-off`,[[`path`,{d:`M12 17v5`,key:`bb1du9`}],[`path`,{d:`M15 9.34V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H7.89`,key:`znwnzq`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}],[`path`,{d:`M9 9v1.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h11`,key:`c9qhm2`}]]),C=o(`pin`,[[`path`,{d:`M12 17v5`,key:`bb1du9`}],[`path`,{d:`M9 10.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-.76a2 2 0 0 0-1.11-1.79l-1.78-.9A2 2 0 0 1 15 10.76V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H8a2 2 0 0 0 0 4 1 1 0 0 1 1 1z`,key:`1nkz8b`}]]),w=e(t(),1),T=36,E=.8,D=8,O=.35;function k({enabled:e,leadingActions:t,trailingActions:n}){let r=(t?.length??0)*72,i=(n?.length??0)*72,[a,o]=(0,w.useState)(0),[s,c]=(0,w.useState)(!1),[l,u]=(0,w.useState)(`none`),d=b.use.registerOpenRow(),f=b.use.unregisterOpenRow();(0,w.useEffect)(()=>{if(l!==`none`)return d(),f},[l,d,f]);let p=(0,w.useRef)(null),m=(0,w.useCallback)(()=>{p.current=null,c(!1),o(0)},[]),h=(0,w.useCallback)(()=>{o(0),u(`none`)},[]);return{offset:a,isDragging:s,revealedSide:l,leadingWidth:r,trailingWidth:i,onTouchStart:(0,w.useCallback)(r=>{if(!e||!t&&!n)return;if(r.touches.length!==1){m();return}let i=r.touches[0];p.current={touchId:i.identifier,startX:i.clientX,startY:i.clientY,axis:`undecided`,lastDx:0,startOffset:a}},[e,t,n,a,m]),onTouchMove:(0,w.useCallback)(e=>{let t=p.current;if(!t)return;if(e.touches.length!==1){m();return}let n=e.touches[0];if(n.identifier!==t.touchId)return;let a=n.clientX-t.startX,s=n.clientY-t.startY;if(t.lastDx=a,t.axis===`undecided`){if(Math.abs(a)<D&&Math.abs(s)<D)return;if(Math.abs(s)>Math.abs(a)*E){p.current=null;return}t.axis=`horizontal`,c(!0)}if(t.axis!==`horizontal`)return;if(Math.abs(a)<T&&Math.abs(s)>Math.abs(a)*E){m(),o(t.startOffset);return}let l=t.startOffset+a,u=r,d=-i;l>u?l=u+(l-u)*O:l<d&&(l=d+(l-d)*O),(t.startOffset>0&&l<0&&i===0||t.startOffset<0&&l>0&&r===0)&&(l*=O),o(l)},[r,i,m]),onTouchEnd:(0,w.useCallback)(e=>{let t=p.current;if(!t){m();return}if(t.axis===`undecided`){p.current=null,c(!1);return}if(t.axis!==`horizontal`){m();return}if(e.touches.length>0){m();return}let n=Array.from(e.changedTouches).find(e=>e.identifier===t.touchId),a=n?n.clientX-t.startX:t.lastDx,s=t.startOffset+a;s<=-T&&i>0?(_.light(),o(-i),u(`trailing`)):s>=T&&r>0?(_.light(),o(r),u(`leading`)):(o(0),u(`none`)),p.current=null,c(!1)},[r,i,m]),onTouchCancel:(0,w.useCallback)(()=>{h(),m()},[h,m]),close:h}}var A=i();function j({action:e,onAfterSelect:t,hidden:n=!1}){let r=(0,w.useCallback)(()=>{e.onSelect(),t()},[e,t]),i=e.icon;return(0,A.jsxs)(`button`,{type:`button`,"aria-label":e.label,"aria-hidden":n,tabIndex:n?-1:0,onClick:r,className:a(`flex shrink-0 flex-col items-center justify-center gap-1`,`touch-mobile:transition-none`),style:{width:72,color:e.variant===`destructive`?`var(--aux-white)`:`var(--content-inset)`,background:e.variant===`destructive`?`var(--system-negative-strong)`:`var(--primary-base)`},children:[(0,A.jsx)(i,{size:18}),(0,A.jsx)(`span`,{className:`text-[10px] font-medium leading-none`,children:e.label})]})}var M=(0,w.forwardRef)(function({children:e,leadingActions:t,trailingActions:n,enabled:r=v(),className:i,style:o,...s},c){let l=r&&((t?.length??0)>0||(n?.length??0)>0),{offset:u,isDragging:d,onTouchStart:f,onTouchMove:p,onTouchEnd:m,onTouchCancel:h,close:g}=k({enabled:l,leadingActions:t,trailingActions:n});return l?(0,A.jsxs)(`div`,{ref:c,className:a(`relative overflow-hidden`,i),...s,style:{...o,touchAction:`pan-y`},onTouchStart:f,onTouchMove:p,onTouchEnd:m,onTouchCancel:h,children:[n&&n.length>0?(0,A.jsx)(`div`,{className:`absolute inset-y-0 right-0 flex`,"aria-hidden":u>=0,style:u>=0?{pointerEvents:`none`}:void 0,children:n.map(e=>(0,A.jsx)(j,{action:e,onAfterSelect:g,hidden:u>=0},e.id))}):null,t&&t.length>0?(0,A.jsx)(`div`,{className:`absolute inset-y-0 left-0 flex`,"aria-hidden":u<=0,style:u<=0?{pointerEvents:`none`}:void 0,children:t.map(e=>(0,A.jsx)(j,{action:e,onAfterSelect:g,hidden:u<=0},e.id))}):null,(0,A.jsx)(`div`,{className:a(`relative bg-[var(--surface-overlay)] transition-transform`,d&&`transition-none`),style:{transform:`translateX(${u}px)`,zIndex:1},children:e})]}):(0,A.jsx)(`div`,{ref:c,className:i,style:o,...s,children:e})});function N(e){if(!e||typeof e!=`object`)return!1;let t=e;return typeof t.appId==`string`&&typeof t.pinnedOrder==`number`&&Number.isFinite(t.pinnedOrder)&&typeof t.name==`string`&&(t.icon===void 0||typeof t.icon==`string`)}function P(e){let t=JSON.parse(e);return Array.isArray(t)?t.filter(N):null}var F=m({key:`vellum:pinnedApps`,scope:`user`,parse:P,serialize:JSON.stringify,fallback:[]}),I=F.load;F.save;function L(e){let t=F.load();if(t.some(t=>t.appId===e.id))return;let n=t.reduce((e,t)=>Math.max(e,t.pinnedOrder),0);F.save([...t,{appId:e.id,pinnedOrder:n+1,name:e.name,icon:e.icon}])}function R(e){let t=F.load().filter(t=>t.appId!==e);t=t.sort((e,t)=>e.pinnedOrder-t.pinnedOrder).map((e,t)=>({...e,pinnedOrder:t+1})),F.save(t)}var z=new Set;function B(){let e=I();return{pinnedApps:e,pinnedAppIds:new Set(e.map(e=>e.appId))}}var V=f(d()((e,t)=>({...B(),togglePin:n=>{t().pinnedAppIds.has(n.id)?t().unpin(n.id):(L(n),e(B()))},unpin:n=>{if(t().pinnedAppIds.has(n)){R(n),e(B());for(let e of z)e(n)}},isPinned:e=>t().pinnedAppIds.has(e),onUnpin:e=>(z.add(e),()=>{z.delete(e)})})));function H({app:e,isDeleting:t,onConfirm:n,onCancel:r}){return(0,A.jsx)(u,{open:e!==null,title:`Delete app`,message:e?`"${e.name}" will be permanently removed.`:``,confirmLabel:t?`Deleting…`:`Delete`,destructive:!0,onConfirm:n,onCancel:r})}function U(e){let t=r(),n=V.use.togglePin(),i=V.use.pinnedAppIds(),[a,o]=(0,w.useState)(null),[s,c]=(0,w.useState)(!1);return{pendingDelete:a,isDeleting:s,requestDelete:o,confirmDelete:(0,w.useCallback)(async()=>{if(!(!a||s)){c(!0);try{await p({path:{assistant_id:e,id:a.id},throwOnError:!0}),g(e,a.id),t.invalidateQueries({queryKey:h({path:{assistant_id:e}})}),i.has(a.id)&&n(a),o(null)}catch(e){l.error(e instanceof Error?e.message:`Failed to delete app`)}finally{c(!1)}}},[a,s,e,i,n,t]),cancelDelete:(0,w.useCallback)(()=>{s||o(null)},[s])}}function W({name:e,description:t,icon:r,loadHtml:i,isPinned:a=!1,isLoading:o=!1,isOpenDisabled:c=!1,isPreviewPending:l=!1,onOpen:u,onPin:d}){return(0,A.jsxs)(`div`,{className:y(`flex flex-col gap-2 rounded-xl border border-[var(--border-base)]`,`bg-[var(--surface-lift)] p-3`),children:[(0,A.jsx)(G,{name:e,icon:r,loadHtml:l?void 0:i,isLoading:o,isPreviewPending:l}),(0,A.jsxs)(`div`,{className:`flex flex-col gap-0.5 px-0.5`,children:[(0,A.jsxs)(`span`,{className:`flex items-center gap-2 truncate text-body-large-default text-[color:var(--content-emphasised)]`,children:[r?(0,A.jsx)(`span`,{"aria-hidden":!0,className:`leading-none`,children:r}):null,(0,A.jsx)(`span`,{className:`truncate`,children:e})]}),t?(0,A.jsx)(`span`,{className:`truncate text-body-medium-default text-[color:var(--content-secondary)]`,children:t}):null]}),(0,A.jsxs)(`div`,{className:`flex items-center gap-1.5 px-0.5`,children:[(0,A.jsx)(n,{variant:`primary`,leftIcon:(0,A.jsx)(s,{}),onClick:u,disabled:c||u==null,children:`Open App`}),(0,A.jsx)(n,{variant:`outlined`,leftIcon:a?(0,A.jsx)(S,{}):(0,A.jsx)(C,{}),onClick:d,disabled:d==null,children:a?`Unpin`:`Pin`})]})]})}function G({name:e,icon:t,loadHtml:n,isLoading:r=!1,isPreviewPending:i=!1,className:a}){let o=(0,w.useRef)(null),[s,l]=(0,w.useState)(null),[u,d]=(0,w.useState)(!1);return(0,w.useEffect)(()=>{if(n==null)return;let e=o.current;if(!e||typeof IntersectionObserver>`u`)return;let t=new IntersectionObserver(([e])=>{e?.isIntersecting&&(d(!0),t.disconnect())},{rootMargin:`200px`});return t.observe(e),()=>t.disconnect()},[n]),(0,w.useEffect)(()=>{if(!u||n==null)return;let e=!1;return n().then(t=>{e||l(t)}).catch(()=>{}),()=>{e=!0}},[u,n]),(0,A.jsxs)(`div`,{ref:o,className:y(`relative aspect-[16/10] w-full overflow-hidden rounded-lg`,`border border-[var(--border-base)] bg-[var(--surface-base)]`,a),children:[(0,A.jsx)(`div`,{className:`absolute inset-0 flex items-center justify-center`,children:i?null:t?(0,A.jsx)(`span`,{className:`text-4xl`,children:t}):(0,A.jsx)(c,{size:32,className:`text-[var(--content-tertiary)]`})}),s!=null&&(0,A.jsx)(`iframe`,{srcDoc:x(s),sandbox:`allow-scripts`,referrerPolicy:`no-referrer`,title:`${e} preview`,"aria-hidden":`true`,tabIndex:-1,loading:`lazy`,scrolling:`no`,className:`absolute left-0 top-0 border-none bg-[var(--surface-base)]`,style:{width:`200%`,height:`200%`,transform:`scale(0.5)`,transformOrigin:`top left`,pointerEvents:`none`}}),r&&(0,A.jsx)(`div`,{className:`absolute inset-0 z-10 flex items-center justify-center bg-[var(--surface-base)]/60 backdrop-blur-sm`,children:(0,A.jsx)(`div`,{className:`h-5 w-5 animate-spin rounded-full border-2 border-[var(--border-base)] border-t-[var(--primary-base)]`})})]})}export{V as a,S as c,H as i,G as n,M as o,U as r,C as s,W as t};
|