@vellumai/web 0.10.9-staging.1 → 0.10.9-staging.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/{a2a-invite-BgVgm24S.js → a2a-invite-CwD3hY_-.js} +1 -1
- package/dist/assets/{account-page-BYVwf7xV.js → account-page-uVMhWTmh.js} +1 -1
- package/dist/assets/{acp-run-detail-panel-D7Shyx6k.js → acp-run-detail-panel-DKXp8jTf.js} +1 -1
- package/dist/assets/{activity-steps-panel-CuI8SWWZ.js → activity-steps-panel-Bq9yj1qu.js} +1 -1
- package/dist/assets/{add-credits-modal-B2t4geb6.js → add-credits-modal-DjQdNLWh.js} +1 -1
- package/dist/assets/{advanced-page-MbQr5gTH.js → advanced-page-CQPwr2B4.js} +1 -1
- package/dist/assets/{ai-page-BbtSlOOr.js → ai-page-CO4dBJpg.js} +1 -1
- package/dist/assets/{api-D2xHldt2.js → api-Dfrm6N2I.js} +1 -1
- package/dist/assets/{api-key-screen--mSD5piK.js → api-key-screen-DhFeDT-n.js} +1 -1
- package/dist/assets/{archive-page-Y2o3PaeP.js → archive-page-BLEqhIZ8.js} +1 -1
- package/dist/assets/{assistant-feature-flag-store-4edQKaeq.js → assistant-feature-flag-store-BA3GR2m5.js} +1 -1
- package/dist/assets/{assistant-status-panel-CdoOjV0m.js → assistant-status-panel-CW7lTRBE.js} +1 -1
- package/dist/assets/{auth-store-B8a9KLUt.js → auth-store-65JKPW7C.js} +2 -2
- package/dist/assets/{background-task-detail-panel-Dj6SWg-M.js → background-task-detail-panel-ChfmmS5C.js} +1 -1
- package/dist/assets/{billing-page-BAtqAcvw.js → billing-page-CaP8_CF9.js} +3 -3
- package/dist/assets/{bookmarks-page-BdcQABPJ.js → bookmarks-page-BdcnBpJK.js} +1 -1
- package/dist/assets/{browser-WjU02SUS.js → browser-Cnr7iqbJ.js} +2 -2
- package/dist/assets/{build-state-CTWX014G.js → build-state-D-aPe0DY.js} +1 -1
- package/dist/assets/{channels-page-route-DoG1IfDg.js → channels-page-route-DKkdGS4b.js} +1 -1
- package/dist/assets/{chat-markdown-message-B6ba9Nea.js → chat-markdown-message-Cp8stHaU.js} +2 -2
- package/dist/assets/{client-feature-flag-store-Bm7cFUky.js → client-feature-flag-store-Ri-a_LuI.js} +1 -1
- package/dist/assets/{client-identity-C5bng1El.js → client-identity-DfC94VQ4.js} +1 -1
- package/dist/assets/{command-palette-3Kt4aKqv.js → command-palette-Bu2Qjyle.js} +1 -1
- package/dist/assets/{command-palette-window-page-Ce_JAimQ.js → command-palette-window-page-CtQ40jMw.js} +1 -1
- package/dist/assets/{community-page-BwkGsQOO.js → community-page-DL_oR63v.js} +1 -1
- package/dist/assets/{connect-page-GobyNuEq.js → connect-page-BCb6nr8x.js} +1 -1
- package/dist/assets/{consent-controls-C7ZF8P6y.js → consent-controls-udcijSAB.js} +1 -1
- package/dist/assets/constants-BQVXM0At.js +1 -0
- package/dist/assets/{contacts-page-route-mJdb0p-P.js → contacts-page-route-CicU-jSI.js} +1 -1
- package/dist/assets/{credentials-page-D7wWekUv.js → credentials-page-DDM2V8iZ.js} +1 -1
- package/dist/assets/{danger-zone-redirect-page-BwbAORqw.js → danger-zone-redirect-page-BpM01x_c.js} +1 -1
- package/dist/assets/debug-page-BGhdwv9M.js +4 -0
- package/dist/assets/{deploy-dialogs-3Mkwr6Lr.js → deploy-dialogs-C6pCnoVj.js} +1 -1
- package/dist/assets/{detail-panel-stop-button-B89ORnF4.js → detail-panel-stop-button-H9sXvWGa.js} +1 -1
- package/dist/assets/{developer-page-BepHaWqd.js → developer-page-DZdwzLQu.js} +1 -1
- package/dist/assets/{devices-page-Bvgt1Qx3.js → devices-page-ChwagiFL.js} +1 -1
- package/dist/assets/{diagnostics-BjIFTbZd.js → diagnostics-CUmYxbmM.js} +1 -1
- package/dist/assets/{dictation-overlay-page-DlScWKYV.js → dictation-overlay-page-BmLNyGeD.js} +1 -1
- package/dist/assets/{document-viewer-page-7mbMVgWm.js → document-viewer-page-B-ShLH6Y.js} +1 -1
- package/dist/assets/{earn-credits-modal-BLyGdcsU.js → earn-credits-modal-BILKTI_F.js} +1 -1
- package/dist/assets/{emails-page-kA5rCqOM.js → emails-page-D_ZdkIHT.js} +1 -1
- package/dist/assets/{esm-bqqA92jW.js → esm-BC-IlNg6.js} +2 -2
- package/dist/assets/{esm-BgQ9CqZD.js → esm-BVzHqFEK.js} +2 -2
- package/dist/assets/{esm-k-oyYh2U.js → esm-CE4Ehw9K.js} +2 -2
- package/dist/assets/{esm-B0Io_iMT.js → esm-D4S5VlIC.js} +2 -2
- package/dist/assets/{esm-CWRflJ6T.js → esm-Ddwl5DWt.js} +2 -2
- package/dist/assets/esm-ZgeaRH-O.js +2 -0
- package/dist/assets/feature-flag-catalog-DjfXrBPD.js +1 -0
- package/dist/assets/{general-page-yhD_Wuar.js → general-page-61s8VehJ.js} +1 -1
- package/dist/assets/{haptics-Dgz3Ixf7.js → haptics-BOswdY5A.js} +2 -2
- package/dist/assets/{hatching-screen-trN-MWFq.js → hatching-screen-DiUygZtk.js} +1 -1
- package/dist/assets/{home-page-route-CmuFehkr.js → home-page-route-1hEkRjdv.js} +1 -1
- package/dist/assets/{hosting-screen-Cxg-qKjE.js → hosting-screen-nru73FGU.js} +1 -1
- package/dist/assets/identity-page-route-CbHcVb6m.js +1 -0
- package/dist/assets/{index-CkKSY1-Q.js → index-B4Qq7TL7.js} +23 -23
- package/dist/assets/index-CCPsEVwr.css +2 -0
- package/dist/assets/{inspect-page-T3Y4-Vmv.js → inspect-page-DoA1sfxg.js} +3 -3
- package/dist/assets/{integrations-page-Ock6mFN1.js → integrations-page-vFP_lh3w.js} +1 -1
- package/dist/assets/intelligence-layout-oIGPC8W1.js +1 -0
- package/dist/assets/{keyboard-shortcuts-page-CG1twx2C.js → keyboard-shortcuts-page-BzeIMUpj.js} +1 -1
- package/dist/assets/{library-detail-page-C2iWMOjx.js → library-detail-page-D0Dv3ZLJ.js} +1 -1
- package/dist/assets/{library-page-BC0GGthr.js → library-page-D7I-sk41.js} +1 -1
- package/dist/assets/{login-flow-DdiUXQhA.js → login-flow-DYLpX6IU.js} +1 -1
- package/dist/assets/{login-page-CGmLnOmi.js → login-page-UotBWZu9.js} +1 -1
- package/dist/assets/{logout-page-4e8K14KD.js → logout-page-xucijGcq.js} +1 -1
- package/dist/assets/{logs-layout-wJKzizjg.js → logs-layout-JUd7Ag6q.js} +1 -1
- package/dist/assets/memory-page-route-DqM6EMFu.js +1 -0
- package/dist/assets/{memory-router-playground-page-FZC-VIVr.js → memory-router-playground-page-DikxzmKT.js} +1 -1
- package/dist/assets/{messages-BnurE-6y.js → messages-B2CZAuPN.js} +1 -1
- package/dist/assets/{mobile-sidebar-drawer-BN_mMpOa.js → mobile-sidebar-drawer-BaL8el3Y.js} +1 -1
- package/dist/assets/{native-biometric-Dy5Vb7o0.js → native-biometric-B2cBAQ1U.js} +1 -1
- package/dist/assets/{native-file-H6DBFhbO.js → native-file-BZDk5eyB.js} +2 -2
- package/dist/assets/{notifications-page-D8wbor2x.js → notifications-page-BISnBOYH.js} +1 -1
- package/dist/assets/{oauth-complete-page-Ce1AmHXp.js → oauth-complete-page-SfFEsa_M.js} +1 -1
- package/dist/assets/{oauth-popup-complete-page-M9ID8MBR.js → oauth-popup-complete-page-D4Xoa-Gr.js} +1 -1
- package/dist/assets/{pairing-page-COwbBOrn.js → pairing-page-B5xnM6XX.js} +1 -1
- package/dist/assets/{password-reset-page-DfUZ0wSh.js → password-reset-page-NF13YMiM.js} +1 -1
- package/dist/assets/{platform-detection-DJWRuZPt.js → platform-detection-DGxL0AsS.js} +1 -1
- package/dist/assets/{platform-loopback-page-MtmBE9rf.js → platform-loopback-page-_IbNDHN2.js} +1 -1
- package/dist/assets/{plugin-detail-page-jrt28WVX.js → plugin-detail-page-_iCqtxl9.js} +1 -1
- package/dist/assets/{plugins-page-BkFE86Ch.js → plugins-page-DHiFqgxf.js} +1 -1
- package/dist/assets/{prechat-route-CyUlbfqD.js → prechat-route-BwML3ZL1.js} +1 -1
- package/dist/assets/{prefs-BLNqdDWZ.js → prefs-DNYLVDvB.js} +1 -1
- package/dist/assets/{privacy-page-DD2N7jR3.js → privacy-page-DhxWA9mA.js} +1 -1
- package/dist/assets/{privacy-screen-CiInQmTP.js → privacy-screen-DRGDGj0W.js} +1 -1
- package/dist/assets/{provider-callback-page-apRb9-js.js → provider-callback-page-BoO2JgZt.js} +1 -1
- package/dist/assets/{provider-signup-page-ajKQp8fF.js → provider-signup-page-DLVKMYZh.js} +1 -1
- package/dist/assets/{quick-input-page-Bfry352-.js → quick-input-page-7z8Ti2GI.js} +1 -1
- package/dist/assets/react-query.gen-DV9K_z-o.js +1 -0
- package/dist/assets/{research-mock-page-D_q1_UFd.js → research-mock-page-CoMthbl4.js} +1 -1
- package/dist/assets/{research-onboarding-route-CWQvTAZs.js → research-onboarding-route-CeTflgoE.js} +1 -1
- package/dist/assets/{review-terms-screen-DQscfsQA.js → review-terms-screen-DAZ66rIh.js} +1 -1
- package/dist/assets/{risk-CGuJt8eV.js → risk-BQ3NV8r8.js} +1 -1
- package/dist/assets/routes-BXlWEOF0.js +1 -0
- package/dist/assets/sdk.gen-9Cdt87h5.js +1 -0
- package/dist/assets/{security-page-PDmclL0z.js → security-page-BS1WxY0d.js} +1 -1
- package/dist/assets/{select-assistant-screen-NbYyB8gd.js → select-assistant-screen-z3B8ngdP.js} +1 -1
- package/dist/assets/{settings-layout-CXwmK0bq.js → settings-layout-DFzwR63d.js} +1 -1
- package/dist/assets/{share-feedback-modal-8FYv2LvY.js → share-feedback-modal-DH2dhWbo.js} +1 -1
- package/dist/assets/{sidebar-tree-DXcgyQSp.js → sidebar-tree-DWJkYLPh.js} +1 -1
- package/dist/assets/{signup-page-7ln71c_p.js → signup-page-D2LQXMnG.js} +1 -1
- package/dist/assets/site-favicon-DsYdnaxV.js +1 -0
- package/dist/assets/{skill-detail-page-D-KI1GRv.js → skill-detail-page-CcZFUjdw.js} +1 -1
- package/dist/assets/{skill-detail-panel-B6dgeIjw.js → skill-detail-panel-B4WEYtK9.js} +1 -1
- package/dist/assets/{skills-page-BANGKYGT.js → skills-page-Di8dGQGo.js} +1 -1
- package/dist/assets/{sounds-page-B5nmCucp.js → sounds-page-CF3gwgc9.js} +1 -1
- package/dist/assets/{subagent-detail-panel-B-XO_qpq.js → subagent-detail-panel-BqYWP0b9.js} +1 -1
- package/dist/assets/{system-events-page-3D8JNX2E.js → system-events-page-DdvtYv0_.js} +1 -1
- package/dist/assets/{system-events-redirect-page-CXWqj4sU.js → system-events-redirect-page-HeBGwZCZ.js} +1 -1
- package/dist/assets/{theme-stage-page-9uebvm3N.js → theme-stage-page-8v_hsKXd.js} +1 -1
- package/dist/assets/{tiptap-document-editor-BQsMI5MK.js → tiptap-document-editor-1QvKHdlQ.js} +1 -1
- package/dist/assets/{tool-detail-panel-C6bS4xqt.js → tool-detail-panel-DarSpKEx.js} +1 -1
- package/dist/assets/{upgrade-cancel-page-DFVxgGMD.js → upgrade-cancel-page-wop4boqC.js} +1 -1
- package/dist/assets/{upgrade-success-page-CmS8UX41.js → upgrade-success-page-DWPEHzlo.js} +1 -1
- package/dist/assets/{usage-page-J9DnhUSp.js → usage-page-CB5oigmL.js} +1 -1
- package/dist/assets/{use-edge-swipe-back-CGjL1V81.js → use-edge-swipe-back-R9ItWgTp.js} +1 -1
- package/dist/assets/{use-invite-link-dialog-DiQ0mtix.js → use-invite-link-dialog-_LChrtmw.js} +1 -1
- package/dist/assets/use-is-org-ready-1Xighdsa.js +1 -0
- package/dist/assets/{use-onboarding-login-CymKDO-T.js → use-onboarding-login-BHrngniO.js} +1 -1
- package/dist/assets/{use-skill-actions-DgIZqg7U.js → use-skill-actions-mJaMNpfO.js} +1 -1
- package/dist/assets/{use-skill-categories-573c1Oen.js → use-skill-categories-Bit2V2fA.js} +1 -1
- package/dist/assets/{use-skill-detail-files-omgWFzAG.js → use-skill-detail-files-DDUUobr0.js} +1 -1
- package/dist/assets/{voice-page-CDyjR4fA.js → voice-page-Dfl4T4_g.js} +1 -1
- package/dist/assets/{weather-forecast-display-C5EykzzK.js → weather-forecast-display-DOXofTcV.js} +1 -1
- package/dist/assets/{web-BRWcXGs9.js → web-BrbVmY32.js} +1 -1
- package/dist/assets/{web-CKE5sM1b.js → web-CBHy41qN.js} +1 -1
- package/dist/assets/{welcome-screen-Dz0Avnjt.js → welcome-screen-kc41a0yS.js} +1 -1
- package/dist/assets/{workflow-detail-panel-D-1Pxr3t.js → workflow-detail-panel-Dctg7w-3.js} +1 -1
- package/dist/assets/{workspace-page-D5FdWIRh.js → workspace-page-BWn-Je40.js} +1 -1
- package/dist/index.html +26 -26
- package/package.json +1 -1
- package/dist/assets/debug-page-b1M-_rZF.js +0 -4
- package/dist/assets/esm-C9MocOv0.js +0 -2
- package/dist/assets/feature-flag-catalog-CM5COdiW.js +0 -1
- package/dist/assets/identity-page-route-CEUFy067.js +0 -1
- package/dist/assets/index-CnqTir5A.css +0 -2
- package/dist/assets/intelligence-layout-DzdGg3IO.js +0 -1
- package/dist/assets/react-query.gen-GVQbBTEp.js +0 -1
- package/dist/assets/routes-DYcJgn9k.js +0 -1
- package/dist/assets/sdk.gen-CmKfVpgB.js +0 -1
- package/dist/assets/site-favicon-BXY4qlvA.js +0 -1
- package/dist/assets/use-is-org-ready-B5vVKY9m.js +0 -1
- /package/dist/assets/{BundleConfirmPage-C02c50EO.js → BundleConfirmPage-DwVI7U0b.js} +0 -0
- /package/dist/assets/{build.umd-D88jX3tx.js → build.umd-t16r8k1T.js} +0 -0
- /package/dist/assets/{definitions-RERkHOnv.js → definitions-CK0CSdwt.js} +0 -0
- /package/dist/assets/{definitions-EvNC1i1H.js → definitions-Dj7uajgZ.js} +0 -0
- /package/dist/assets/{esm-D_FdLNK8.js → esm-wMYgN14J.js} +0 -0
- /package/dist/assets/{pdf-OTWpgOp2.js → pdf-jCZ1S_t-.js} +0 -0
- /package/dist/assets/{web-ClHk8mQB.js → web-6YTn0Mpt.js} +0 -0
- /package/dist/assets/{web-Qpx2h8tK.js → web-B6BDTvZe.js} +0 -0
- /package/dist/assets/{web-CU5yzmqR.js → web-BEtTYpif.js} +0 -0
- /package/dist/assets/{web-CTmLPP3c.js → web-C3rsbCeg.js} +0 -0
- /package/dist/assets/{web-8CyK9syi.js → web-CIdUPUaN.js} +0 -0
- /package/dist/assets/{web-CyGs80Wd.js → web-DGaEiOw7.js} +0 -0
- /package/dist/assets/{xterm-fGXm5t6D.js → xterm-CJZcgQLM.js} +0 -0
- /package/dist/assets/{xterm-addon-fit-DNV09uVI.js → xterm-addon-fit-BmGG02AS.js} +0 -0
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/web-BrbVmY32.js","assets/dist-RkT480s0.js","assets/definitions-Dj7uajgZ.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{t as e}from"./preload-helper-BewR0kVT.js";import{i as t}from"./dist-RkT480s0.js";import{n,t as r}from"./definitions-Dj7uajgZ.js";var i=t(`Haptics`,{web:()=>e(()=>import(`./web-BrbVmY32.js`).then(e=>new e.HapticsWeb),__vite__mapDeps([0,1,2]))});export{i as Haptics,r as ImpactStyle,n as NotificationType};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var e={version:1,flags:[{id:`user-hosted-enabled`,scope:`client`,key:`user-hosted-enabled`,label:`User Hosted Enabled`,description:`Enable user-hosted onboarding flow`,defaultEnabled:!1},{id:`pre-chat-onboarding-experiment-2026-06-06`,scope:`client`,key:`pre-chat-onboarding-experiment-2026-06-06`,label:`Pre-chat Onboarding Experiment 2026-06-06`,description:`Pre-chat onboarding experiment with control and variant-a arms. Control shows the full funnel; variant-a shows the condensed pared-down flow.`,defaultEnabled:`control`,values:[`control`,`variant-a`]},{id:`experiment-activation-flow-2026-06-03`,scope:`both`,key:`experiment-activation-flow-2026-06-03`,label:`Activation Flow Experiment 2026-06-03`,description:`Multivariate activation-flow experiment. control = standard flow; variant-a = activation rail; personal-page = new sign-up-page variant (front-end only). Targeted via LaunchDarkly.`,defaultEnabled:`control`,values:[`control`,`variant-a`,`personal-page`]},{id:`local-docker-enabled`,scope:`client`,key:`local-docker-enabled`,label:`Local Docker Mode`,description:`When enabled, the Local hosting option uses Docker under the hood for sandboxed execution, hiding the separate Docker card`,defaultEnabled:!1},{id:`a2a-channel`,scope:`assistant`,key:`a2a-channel`,label:`A2A Channel`,description:`Enable the A2A (Agent-to-Agent) channel for inter-assistant communication via the open A2A protocol`,defaultEnabled:!1},{id:`settings-developer-nav`,scope:`assistant`,key:`settings-developer-nav`,label:`Settings Developer Nav`,description:`Control Developer nav visibility in macOS settings`,defaultEnabled:!1},{id:`developer-menu-items`,scope:`client`,key:`developer-menu-items`,label:`Developer Menu Items`,description:`Show Component Gallery and Replay Onboarding in the menu bar`,defaultEnabled:!1},{id:`settings-embedding-provider`,scope:`assistant`,key:`settings-embedding-provider`,label:`Embedding Provider Settings`,description:`Show the Embedding service card in Models & Services settings`,defaultEnabled:!1},{id:`multi-platform-assistant`,scope:`client`,key:`multi-platform-assistant`,label:`Multi-Platform Assistant Switcher`,description:`Enable the menu-bar assistant switcher for managing multiple platform-hosted assistants (new/switch/retire)`,defaultEnabled:!1},{id:`quick-input`,scope:`client`,key:`quick-input`,label:`Quick Input`,description:`Enable the Quick Input popover on right-click of the menu bar icon`,defaultEnabled:!1},{id:`expand-completed-steps`,scope:`client`,key:`expand-completed-steps`,label:`Expand Completed Steps`,description:`Auto-expand completed tool call step groups instead of showing them collapsed`,defaultEnabled:!1},{id:`backward-releases`,scope:`assistant`,key:`backward-releases`,label:`Backward Releases`,description:`Show older versions in the version picker, allowing rollback to previous releases`,defaultEnabled:!1},{id:`voice-mode`,scope:`assistant`,key:`voice-mode`,label:`Voice Mode`,description:`Show the live voice conversation button in the composer`,defaultEnabled:!1},{id:`voice-triage-escalate`,scope:`assistant`,key:`voice-triage-escalate`,label:`Voice Triage & Escalate`,description:`Front phone-call turns with a fast model that answers simple turns and escalates tricky ones to the quality model, cutting perceived latency`,defaultEnabled:!1},{id:`fast-mode`,scope:`assistant`,key:`fast-mode`,label:`Fast Mode`,description:`Enable Anthropic fast mode for Opus models (4.6, 4.7, 4.8), delivering up to 2.5x higher output tokens per second at premium pricing`,defaultEnabled:!1},{id:`teleport`,scope:`client`,key:`teleport`,label:`Teleport`,description:`Enable teleport UI in General settings for moving assistants between hosting environments`,defaultEnabled:!1},{id:`apple-container`,scope:`client`,key:`apple-container`,label:`Apple Container`,description:`Enable assistant sandboxing via Apple Containers on macOS 26+, providing a lightweight native sandbox without third-party dependencies`,defaultEnabled:!1},{id:`bookmarks`,scope:`client`,key:`bookmarks`,label:`Message Bookmarks`,description:`Show the bookmark icon on messages and enable the Bookmarks tab in Settings`,defaultEnabled:!1},{id:`fork-from-message`,scope:`client`,key:`fork-from-message`,label:`Fork from Message`,description:`Show the 'Fork from here' option in message overflow menus`,defaultEnabled:!1},{id:`home-tab`,scope:`client`,key:`home-tab`,label:`Home Tab`,description:`Replace the knowledge graph top-level tab with a new Home page showing relationship progression, facts, and capability tiers`,defaultEnabled:!1},{id:`scroll-debug-overlay`,scope:`client`,key:`scroll-debug-overlay`,label:`Scroll Debug Overlay`,description:`Show a live HUD in the top-right of the conversation with scroll geometry, velocity, update rate, and anchor-preserver activity. Developer diagnostic for investigating scroll jank.`,defaultEnabled:!1},{id:`compaction-playground`,scope:`assistant`,key:`compaction-playground`,label:`Compaction Playground`,description:`Expose the developer-only Compaction Playground tab in macOS Settings and enable the /playground/* HTTP endpoints for exercising compaction conditions. Dev-only; default off.`,defaultEnabled:!1},{id:`app-control`,scope:`assistant`,key:`app-control`,label:`App Control`,description:`Enable the app-control skill (per-app screenshot + raw input bypassing AX tree)`,defaultEnabled:!1},{id:`velvet-theme`,scope:`client`,key:`velvet-theme`,label:`Velvet Theme`,description:`Show the Velvet theme option in the macOS appearance settings. Velvet is a dark-mode variant with red/pink accent colors.`,defaultEnabled:!1},{id:`queue-steering`,scope:`assistant`,key:`queue-steering`,label:`Queue Steering`,description:`Enable the 'Push to agent' button on queued messages, allowing users to steer the assistant to a specific queued message by aborting the current generation and promoting the message to the head of the queue.`,defaultEnabled:!1},{id:`chat-pull-to-refresh-enabled`,scope:`client`,key:`chat-pull-to-refresh-enabled`,label:`Chat Pull to Refresh`,description:`Enable pull-to-refresh gesture in the chat view.`,defaultEnabled:!1},{id:`platform-notifications`,scope:`client`,key:`platform-notifications`,label:`Platform Notifications`,description:`Enable the Notifications tab in settings.`,defaultEnabled:!1},{id:`centralized-assistant-status`,scope:`client`,key:`centralized-assistant-status`,label:`Centralized Assistant Status`,description:`Enable client polling of the centralized assistant operational status endpoint.`,defaultEnabled:!1},{id:`preview-channel`,scope:`client`,key:`preview-channel`,label:`Preview Channel`,description:`Enable user-facing Preview release channel controls in assistant settings.`,defaultEnabled:!1},{id:`rollback-enabled`,scope:`assistant`,key:`rollback-enabled`,label:`Rollback Enabled`,description:`Show older versions in the version picker, allowing rollback to previous releases.`,defaultEnabled:!1},{id:`self-hosted-assistant`,scope:`client`,key:`self-hosted-assistant`,label:`Self-Hosted Assistant`,description:`Enable self-hosted assistant configuration.`,defaultEnabled:!1},{id:`web-remote-ingress`,scope:`assistant`,key:`web-remote-ingress`,label:`Web Remote Ingress`,description:`Serve the web client over a public tunnel and enable browser pairing for self-hosted assistants.`,defaultEnabled:!1},{id:`settings-sleep-policy`,scope:`assistant`,key:`settings-sleep-policy`,label:`Settings Sleep Policy`,description:`Enable sleep policy settings.`,defaultEnabled:!1},{id:`velvet`,scope:`client`,key:`velvet`,label:`Velvet`,description:`Enable the Velvet design theme.`,defaultEnabled:!1},{id:`memory-router-playground`,scope:`client`,key:`memory-router-playground`,label:`Memory Router Playground`,description:`Expose the developer-only Memory Router Playground tab in macOS Settings and the /assistant/memory-router-playground web page for dry-running v4 router config overrides against the live page index. Dev-only; default off.`,defaultEnabled:!1},{id:`memory-v3-injection-gate`,scope:`assistant`,key:`memory-v3-injection-gate`,label:`Memory v3 injection gate`,description:`Per-turn injection gate for memory v3: after the BM25F needle + dense cosine finder lanes run, skip the selectPool LLM call (inject nothing) when finder-lane scores fall below the configured thresholds (memory.v3.gate). Default on (flipped remotely July 2026); this registry value is the fallback when no platform snapshot is available.`,defaultEnabled:!0},{id:`memory-concept-graph`,scope:`assistant`,key:`memory-concept-graph`,label:`Memory concept graph`,description:`Gates the Obsidian-style memory concept graph on its own Memory tab (/assistant/memory) and the backend-agnostic /memory-graph + /memory-graph-node routes that feed it. When off, the Memory tab is hidden; the identity page keeps the skills constellation. Only produces a graph on memory-v3 backends. Default off.`,defaultEnabled:!1},{id:`self-intro-greeting`,scope:`both`,key:`self-intro-greeting`,label:`Self-intro first message`,description:`On the first conversation, send a natural self-introduction (e.g. "Hi Vela, I'm alex. Nice to meet you.") on the user's behalf and route it through real LLM inference, instead of serving the canned first greeting. Names come from the onboarding context; falls back to the canned greeting when no name is known. Exposed to clients so pre-hatch onboarding can compute the source-of-truth initial message, and to the assistant so older clients can still be gated server-side. See assistant/src/daemon/first-greeting.ts (buildSelfIntroMessage).`,defaultEnabled:!1},{id:`research-onboarding`,scope:`client`,key:`research-onboarding`,label:`Research onboarding (spike)`,description:`Spike: replace pre-chat onboarding with a web-research "here's what I know about you" flow, including a Google Calendar "Let's chat tomorrow" step shown over the streaming research. Gates the /assistant/onboarding/research route and the research mock harness. Off by default; enable locally via the feature-flags panel.`,defaultEnabled:!1},{id:`personality-onboarding`,scope:`client`,key:`personality-onboarding`,label:`Personality onboarding step (spike)`,description:`Spike: show the "Create my personality" trait-slider step in the research-onboarding flow (between the pitch and the integration step). On continue it applies the sliders to the assistant's persona on a throwaway side conversation. When off, the step is skipped entirely. Off by default; enable locally via the feature-flags panel.`,defaultEnabled:!1},{id:`channel-trust-floors`,scope:`assistant`,key:`channel-trust-floors`,label:`Channel Trust Floors`,description:`Expose the Channel Trust Floors settings card (per-channel inbound admission policy) on the Privacy settings page. When off, the card is hidden and channels fall back to their default admission floors. On by default; disable to hide the card.`,defaultEnabled:!0},{id:`mcp-add-server`,scope:`assistant`,key:`mcp-add-server`,label:`MCP Add Server`,description:`Show the Add Server action on the MCP settings page. The MCP page itself remains visible; this flag gates only creating new Model Context Protocol server connections.`,defaultEnabled:!1},{id:`os-beta`,scope:`assistant`,key:`os-beta`,label:`OS Beta`,description:`Enable the OS Beta model profile (MiniMax M3 / Together) in the assistant's model profile selection.`,defaultEnabled:!1},{id:`new-thread-suggestions`,scope:`client`,key:`new-thread-suggestions`,label:`New-thread suggestions library`,description:`Replace the empty-state conversation-starter chips with the scrollable, categorized suggestions library and detail drawer (currently mocked data).`,defaultEnabled:!1},{id:`account-mfa`,scope:`client`,key:`account-mfa`,label:`Account MFA`,description:`Surface the Security settings page where users enroll and manage TOTP two-factor authentication for their Vellum (WorkOS) account. Applies to email/password sign-in only.`,defaultEnabled:!1},{id:`credentials-settings`,scope:`assistant`,key:`credentials-settings`,label:`Credentials settings page`,description:`Show the Credentials page in web settings for listing, adding, and deleting stored credentials.`,defaultEnabled:!1},{id:`credential-requests`,scope:`assistant`,key:`credential-requests`,label:`One-time credential request links`,description:`Enable one-time credential-request links: the generate-link action in settings, the public credential entry page, and assistant-initiated links on channels without secure input.`,defaultEnabled:!1},{id:`summarize-up-to-here`,scope:`both`,key:`summarize-up-to-here`,label:`Summarize Up To Here`,description:`Show the per-message Summarize up to here action and enable the conversation summarize endpoint`,defaultEnabled:!1},{id:`override-or-default-resolution`,scope:`assistant`,key:`override-or-default-resolution`,label:`Override-or-Default Profile Resolution`,description:`Resolve inference profiles as single complete overrides (or the call site's default intent through the default provider) instead of the legacy deep-merge cascade. Ships enabled; disable as a kill switch to restore merge semantics.`,defaultEnabled:!0}]};function t(e,t){return e===t||e===`both`}var n=e.flags,r={};function i(e){return r[e]||e.split(`-`).map((e,t)=>e===`ui`?`UI`:t===0?e:e[0].toUpperCase()+e.slice(1)).join(``)}function a(e){let r={};for(let a of n)typeof a.defaultEnabled==`boolean`&&t(a.scope,e)&&(r[i(a.key)]=a.defaultEnabled);return r}function o(e){let r={};for(let a of n)typeof a.defaultEnabled==`string`&&t(a.scope,e)&&(r[i(a.key)]=a.defaultEnabled);return r}var s=a(`client`),c=a(`assistant`),l=o(`client`),u=o(`assistant`),d=new Map;for(let e of n)d.set(i(e.key),e);var f=new Map;for(let e of n)f.set(i(e.key),e.key);function p(e){return i(e)}function m(e){return f.get(e)}function h(e){return d.get(e)}var g=`VITE_VELLUM_FLAG_`;function _(e){return e.toLowerCase().replace(/_/g,`-`)}var v=new Set([`true`,`1`,`yes`,`on`]),y=new Set([`false`,`0`,`no`,`off`]);function b(e){let t=e.toLowerCase();return v.has(t)?!0:y.has(t)?!1:e}function x(){if(typeof window<`u`&&window.__VELLUM_FLAG_OVERRIDES__!=null)return{...window.__VELLUM_FLAG_OVERRIDES__};let e={},t={BASE_URL:`/assistant/`,DEV:!1,MODE:`production`,PROD:!0,SSR:!1,VITE_PLATFORM_MODE:`false`};for(let n of Object.keys(t))if(n.startsWith(g)){let r=_(n.slice(17)),i=t[n];i!=null&&(e[r]=b(i))}return e}var S=null;function C(){return S===null&&(S=x()),S}var w=new Map;for(let e of n)w.set(e.key,e);function T(e){let n=C(),r={},i={};for(let[a,o]of Object.entries(n)){let n=w.get(a);if(!n||!t(n.scope,e))continue;let s=p(a);typeof o==`boolean`?r[s]=o:i[s]=o}return{bool:r,str:i}}export{p as a,h as c,l as i,t as l,u as n,n as o,s as r,T as s,c as t,m as u};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{o as e}from"./chunk-jRWAZmH_.js";import{a as t,n,o as r,r as i,s as a}from"./device-settings-BBwtGKJb.js";import{t as o}from"./capture-error-Dhiismgm.js";import{t as s}from"./react-DJZBPgpf.js";import{t as c}from"./button-amTXFI-2.js";import{d as l,t as u}from"./chunk-5KNZJZUH-DdS6bb-3.js";import{n as d}from"./QueryClientProvider-DKhXIxGb.js";import{t as f}from"./useQuery-B45lW1Kk.js";import{t as p}from"./useMutation-Lj4VunQV.js";import{t as m}from"./jsx-runtime-CVSDxk6A.js";import{t as h}from"./cn-C36Yvcac.js";import{t as g}from"./createLucideIcon-IRfcSUxS.js";import{t as _}from"./bell-BQLonLMp.js";import{t as v}from"./check-DFNrQERi.js";import{t as y}from"./chevron-down-qD-re7AW.js";import{t as b}from"./chevron-right-DqqmezXC.js";import{t as x}from"./circle-alert-zOqdmf25.js";import{t as S}from"./circle-check-VSiny8yl.js";import{t as C}from"./hard-drive-rDxhoRUm.js";import{t as w}from"./loader-circle-Cz7opInR.js";import{t as T}from"./monitor-DfbL8_59.js";import{t as E}from"./moon-B8qiwjrW.js";import{t as D}from"./refresh-cw-DevIHL7J.js";import{a as O,c as k,o as A,r as j,s as M,t as N}from"./resize-errors-DqIkO0UI.js";import{t as P}from"./sparkles-PGiR5v1g.js";import{t as F}from"./triangle-alert-Z0Gq0IuB.js";import{t as I}from"./notice-DkcNAP8O.js";import{t as L}from"./progress-bar-Ca8gmE3B.js";import{A as R,k as ee,n as z}from"./src-DZbMXyC2.js";import{t as te}from"./tag-CV4v7fRF.js";import{t as B}from"./input-CoUmPnRU.js";import{t as V}from"./toggle-CDfguvUz.js";import{n as ne}from"./stat-square-CTHnQ1jc.js";import{t as H}from"./modal-D5nLWNN9.js";import{n as U}from"./toast-xTp-xwYL.js";import{t as W}from"./confirm-dialog-CSkhRFRk.js";import{t as re}from"./dropdown-ByHOpeOU.js";import{C as G,D as ie,S as K,_ as ae,c as oe,f as se,g as ce,i as le,k as ue,l as de,p as fe,r as pe}from"./local-mode-Bskd5bsT.js";import{t as me}from"./is-electron-y5bNUVyG.js";import{n as he}from"./resolved-assistants-store-DAzPZ1eV.js";import{r as ge,t as _e}from"./semver-DIkpaM51.js";import{n as ve,r as ye,t as be}from"./api-errors-CrWDzVca.js";import{D as xe,S as Se,T as Ce,a as we,b as Te,g as Ee,h as De,k as Oe,l as ke,n as Ae,v as je,y as Me}from"./auth-store-B8a9KLUt.js";import{t as q}from"./client.gen-DVfIRXUZ.js";import{A as Ne,S as Pe,V as Fe,Y as Ie,j as Le,w as Re}from"./sdk.gen-CmKfVpgB.js";import{a as ze,o as Be}from"./api-D2xHldt2.js";import{c as J}from"./routes-DYcJgn9k.js";import{a as Ve,r as He}from"./platform-detection-DJWRuZPt.js";import{t as Ue}from"./client-feature-flag-store-Bm7cFUky.js";import{n as We,r as Ge,t as Ke}from"./theme-preferences-D1vs2UH8.js";import{A as qe,D as Je,E as Ye,M as Xe,Ot as Ze,T as Qe,Tt as $e,bt as et,c as tt,it as nt,j as rt,k as it,nt as at,v as ot,w as st,wt as ct}from"./react-query.gen-GVQbBTEp.js";import{t as lt}from"./assistant-feature-flag-store-4edQKaeq.js";import{t as ut}from"./pointer-qy7F2Zff.js";import{t as dt}from"./proxy-Cadlowdl.js";import{t as ft}from"./AnimatePresence-TZWSGjkI.js";import{t as pt}from"./use-reduced-motion-BPBlq9_a.js";import{D as mt,Fn as ht,Gr as gt,Ni as _t,Pi as vt,Pn as yt,Ti as bt,Ur as xt,Vt as St,Wr as Ct,_ as wt,_n as Tt,aa as Et,bn as Dt,br as Ot,h as kt,lt as At,v as jt,vn as Mt,xi as Nt,yi as Pt,yn as Ft}from"./index-CkKSY1-Q.js";import{t as It}from"./use-active-assistant-id-CGeH4Gl6.js";import{t as Y}from"./detail-card-GPqFZVmX.js";import{t as Lt}from"./app-info-BxdEjcok.js";import{t as Rt}from"./environment-store-Bxe2pTvW.js";import{i as zt,n as Bt,r as Vt,t as Ht}from"./assistant-status-panel-CdoOjV0m.js";var Ut=g(`fingerprint-pattern`,[[`path`,{d:`M12 10a2 2 0 0 0-2 2c0 1.02-.1 2.51-.26 4`,key:`1nerag`}],[`path`,{d:`M14 13.12c0 2.38 0 6.38-1 8.88`,key:`o46ks0`}],[`path`,{d:`M17.29 21.02c.12-.6.43-2.3.5-3.02`,key:`ptglia`}],[`path`,{d:`M2 12a10 10 0 0 1 18-6`,key:`ydlgp0`}],[`path`,{d:`M2 16h.01`,key:`1gqxmh`}],[`path`,{d:`M21.8 16c.2-2 .131-5.354 0-6`,key:`drycrb`}],[`path`,{d:`M5 19.5C5.5 18 6 15 6 12a6 6 0 0 1 .34-2`,key:`1tidbn`}],[`path`,{d:`M8.65 22c.21-.66.45-1.32.57-2`,key:`13wd9y`}],[`path`,{d:`M9 6.8a6 6 0 0 1 9 5.2v2`,key:`1fr1j5`}]]),Wt=g(`vibrate`,[[`path`,{d:`m2 8 2 2-2 2 2 2-2 2`,key:`sv1b1`}],[`path`,{d:`m22 8-2 2 2 2-2 2 2 2`,key:`101i4y`}],[`rect`,{width:`8`,height:`14`,x:`8`,y:`5`,rx:`1`,key:`1oyrl4`}]]),X=e(s(),1),Gt=De,Kt=`Please choose a different handle.`;async function qt(e,t){let{data:n,error:r,response:i}=await Le({path:{id:e},body:{handle:t},throwOnError:!1});if(!i)return{kind:`error`,message:ye(r,void 0,`Failed to save handle.`)??`Failed to save handle.`};if(i.ok&&n)return{kind:`ok`,data:n};if(i.status===409){let{message:e}=Te(r,`handle`,Gt.taken);return{kind:`taken`,message:e}}if(i.status===400){let{code:e,message:t}=Te(r,`handle`,Kt);return{kind:`invalid`,code:e,message:t}}return{kind:`error`,message:ye(r,i,`Failed to save handle.`)}}async function Jt(e,t,n){let{data:r,error:i,response:a}=await Pe({path:{assistant_id:e},query:{handle:t},signal:n,throwOnError:!1});if(ve(a,i,`Failed to check handle availability.`),!a.ok||!r)throw new be(a.status,a.status===429?`Too many checks — try again in a moment.`:ye(i,a,`Failed to check handle availability.`));return{available:r.available,code:r.code??null,message:r.message??null}}function Yt(e){return/\d{2,}$/.test(e)}var Z=m(),Xt=300,Zt=1400;function Qt({initialHandle:e,inputLabel:t,helperText:n,idleHelperText:r,checkAvailable:i,save:a,onSaved:o,saveSuccessToast:s,fieldId:l}){let[u,d]=(0,X.useState)(e),[f,p]=(0,X.useState)(null),[m,h]=(0,X.useState)(!1),[g,_]=(0,X.useState)(`idle`),[y,b]=(0,X.useState)(null),S=pt(),C=(0,X.useRef)(null),T=(0,X.useMemo)(()=>u.trim().toLowerCase(),[u]),E=T===e.toLowerCase();(0,X.useEffect)(()=>{if(E||T.length===0){h(!1),C.current?.abort();return}let e=new AbortController;C.current?.abort(),C.current=e,h(!0);let t=window.setTimeout(async()=>{try{let t=await i(T,e.signal);e.signal.aborted||p(t)}catch(t){e.signal.aborted||b(t instanceof Error?t.message:`Couldn't check availability.`)}finally{e.signal.aborted||h(!1)}},Xt);return()=>{window.clearTimeout(t),e.abort()}},[T,E,i]);let D=(()=>{if(y)return y;if(f&&!f.available){let e=f.code;return f.message??(e?Gt[e]:`Please choose a different handle.`)}return null})(),O=D?n:E?r??null:m?`Checking availability…`:f?.available?`Available.`:null,k=!E&&!m&&f?.available!==!1&&g!==`saving`,A=(0,X.useCallback)(async()=>{if(!k)return;_(`saving`),b(null);let e=await a(T);if(e.kind===`ok`){_(`saved`),o(e.data),U.success(s),window.setTimeout(()=>_(`idle`),Zt);return}if(e.kind===`taken`){_(`idle`),p({available:!1,code:`taken`,message:e.message});return}if(e.kind===`invalid`){_(`idle`),p({available:!1,code:e.code,message:e.message});return}_(`error`),b(e.message),U.error(e.message)},[k,T,o,a,s]),j=(()=>{if(E&&u.length>0||u.length===0)return null;let e=m?`checking`:f?.available?`available`:f?.available===!1?`invalid`:null;return e?(0,Z.jsx)(ft,{mode:`wait`,initial:!1,children:(0,Z.jsxs)(dt.span,{initial:S?!1:{opacity:0,scale:.85},animate:{opacity:1,scale:1},exit:S?void 0:{opacity:0,scale:.85},transition:{duration:.14,ease:`easeOut`},className:`flex items-center`,"aria-hidden":e!==`available`&&e!==`invalid`,children:[e===`checking`&&(0,Z.jsx)(w,{className:`h-4 w-4 animate-spin text-[var(--content-tertiary)]`}),e===`available`&&(0,Z.jsx)(v,{className:`h-4 w-4 text-[var(--system-positive-strong)]`,"aria-label":`Available`}),e===`invalid`&&(0,Z.jsx)(x,{className:`h-4 w-4 text-[var(--system-negative-strong)]`,"aria-label":`Not available`})]},e)}):null})(),M=(()=>{switch(g){case`saving`:return(0,Z.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,Z.jsx)(w,{className:`h-3.5 w-3.5 animate-spin`,"aria-hidden":!0}),`Saving…`]});case`saved`:return(0,Z.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,Z.jsx)(v,{className:`h-3.5 w-3.5`,"aria-hidden":!0}),`Saved`]});default:return`Save`}})();return(0,Z.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,Z.jsx)(B,{label:t,value:u,onChange:e=>{d(e.target.value.replace(/\s+/g,``)),p(null),b(null)},autoCorrect:`off`,autoCapitalize:`none`,spellCheck:!1,maxLength:30,leftIcon:(0,Z.jsx)(`span`,{className:`select-none font-mono text-[var(--content-tertiary)]`,"aria-hidden":!0,children:`@`}),rightIcon:j,errorText:D??void 0,helperText:O??void 0,"aria-invalid":!!D,fullWidth:!0,"data-testid":`${l}-input`}),(!E||g!==`idle`)&&(0,Z.jsx)(`div`,{className:`flex justify-end`,children:(0,Z.jsx)(c,{variant:`primary`,size:`compact`,onClick:A,disabled:!k,"aria-live":`polite`,"data-testid":`${l}-save`,children:M})})]})}function $t({initial:e,onSaved:t}){let n=Ae.use.refreshSession(),r=Yt(e.username)?`Your handle was auto-generated at signup — pick one you like.`:void 0,i=(0,X.useCallback)(async e=>await Me({username:e}),[]),a=(0,X.useCallback)((e,t)=>Ee(e,t),[]),o=(0,X.useCallback)(e=>{t(e),n()},[t,n]);return(0,Z.jsx)(Qt,{initialHandle:e.username,inputLabel:`User handle`,helperText:`Lowercase letters, digits, hyphens, and underscores. 3–30 characters.`,idleHelperText:r,checkAvailable:a,save:i,onSaved:o,saveSuccessToast:`Profile updated.`,fieldId:`user-handle`})}function en({assistant:e,onSaved:t}){let n=e.handle??``,r=f({...tt({path:{assistant_id:e.id}})}).data?.results?.[0],i=!!r&&r.subdomain.toLowerCase()===n.toLowerCase(),a=n.length===0?`Your assistant doesn't have a handle yet — claim one to make it mentionable.`:void 0,o=(0,X.useCallback)(async t=>await qt(e.id,t),[e.id]),s=(0,X.useCallback)((t,n)=>Jt(e.id,t,n),[e.id]);return i?(0,Z.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Z.jsx)(B,{label:`Assistant handle`,value:n,readOnly:!0,disabled:!0,leftIcon:(0,Z.jsx)(`span`,{className:`select-none font-mono text-[var(--content-tertiary)]`,"aria-hidden":!0,children:`@`}),fullWidth:!0,"data-testid":`assistant-handle-input`}),(0,Z.jsxs)(`p`,{className:`text-body-small-default text-[var(--content-tertiary)]`,children:[`Your assistant's handle is locked because it's used as its email subdomain. To change it,`,` `,(0,Z.jsx)(u,{to:`${J.settings.ai}?release=1#email`,className:`text-[var(--content-link)] underline hover:text-[var(--content-link-hover)]`,children:`release the subdomain`}),` `,`first.`]})]}):(0,Z.jsx)(Qt,{initialHandle:n,inputLabel:`Assistant handle`,helperText:`Lowercase letters, digits, hyphens, and underscores. 3–30 characters.`,idleHelperText:a,checkAvailable:s,save:o,onSaved:t,saveSuccessToast:`Assistant handle updated.`,fieldId:`assistant-handle`})}function tn(){return(0,Z.jsxs)(`div`,{className:`flex flex-col gap-4`,"aria-busy":!0,"aria-live":`polite`,children:[(0,Z.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Z.jsx)(`div`,{className:`h-3 w-16 animate-pulse rounded bg-[var(--surface-muted)]`}),(0,Z.jsx)(`div`,{className:`h-9 w-full animate-pulse rounded-md bg-[var(--surface-muted)]`}),(0,Z.jsx)(`div`,{className:`h-3 w-72 animate-pulse rounded bg-[var(--surface-muted)]`})]}),(0,Z.jsx)(`div`,{className:`h-9 w-full animate-pulse rounded-md bg-[var(--surface-muted)]`}),(0,Z.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,Z.jsx)(`div`,{className:`h-3 w-60 animate-pulse rounded bg-[var(--surface-muted)]`}),(0,Z.jsx)(`div`,{className:`h-7 w-16 animate-pulse rounded-md bg-[var(--surface-muted)]`})]}),(0,Z.jsx)(`span`,{className:`sr-only`,children:`Loading your profile…`})]})}function nn({assistant:e}={}){let[t,n]=(0,X.useState)(null),[r,i]=(0,X.useState)(null),a=pt(),[o,s]=(0,X.useState)(e??null);return(0,X.useEffect)(()=>{s(e??null)},[e]),(0,X.useEffect)(()=>{let e=!1;return je().then(t=>{e||n(t)}).catch(t=>{e||i(t instanceof Error?t.message:`Failed to load profile.`)}),()=>{e=!0}},[]),(0,Z.jsx)(Y,{title:`Profile`,subtitle:`Manage your user and assistant public handles.`,children:r?(0,Z.jsx)(`p`,{className:`text-body-small-default text-[var(--system-negative-strong)]`,children:r}):t?(0,Z.jsxs)(dt.div,{initial:a?!1:{opacity:0,y:4},animate:{opacity:1,y:0},transition:{duration:.22,ease:`easeOut`},className:`flex flex-col gap-6`,children:[(0,Z.jsx)($t,{initial:t,onSaved:n}),o&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`div`,{className:`border-t border-[var(--border-subtle)]`}),(0,Z.jsx)(en,{assistant:o,onSaved:s})]})]}):(0,Z.jsx)(tn,{})})}var rn=ot({query:{hosting:`platform`}});function an(){let e=It(),t=f(rn),n=t.data?.results??[];return t.isPending||n.length<2?null:(0,Z.jsx)(Y,{title:`Switch Assistant`,subtitle:`Choose which assistant is active for this account.`,children:(0,Z.jsx)(`div`,{className:`space-y-2`,children:n.map(t=>{let n=t.id===e;return(0,Z.jsxs)(`div`,{className:`flex items-center justify-between gap-4 rounded-lg border px-4 py-3 ${n?`border-[var(--border-focus)] bg-[var(--surface-lift)]`:`border-[var(--border-base)] bg-[var(--surface-default)]`}`,children:[(0,Z.jsxs)(`div`,{className:`flex min-w-0 items-center gap-3`,children:[(0,Z.jsx)(T,{className:`h-4 w-4 shrink-0 text-[var(--content-tertiary)]`}),(0,Z.jsx)(`div`,{className:`min-w-0`,children:(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(`span`,{className:`truncate text-body-medium-default text-[var(--content-default)]`,children:t.name||`Unnamed`}),t.status!==`active`&&(0,Z.jsx)(te,{tone:`warning`,children:t.status})]})})]}),(0,Z.jsx)(`div`,{className:`shrink-0`,children:n?(0,Z.jsxs)(`span`,{className:`flex items-center gap-1.5 text-body-small-default text-[var(--system-positive-default)]`,children:[(0,Z.jsx)(v,{className:`h-4 w-4`}),`Active`]}):(0,Z.jsx)(c,{variant:`outlined`,size:`compact`,disabled:t.status!==`active`,onClick:()=>{Oe(t.id),U.success(`Switched active assistant.`)},children:`Switch`})})]},t.id)})})})}var on=[{label:`Never`,seconds:0},{label:`5 min`,seconds:300,devOnly:!0},{label:`10 min`,seconds:600,devOnly:!0},{label:`1 hour`,seconds:3600},{label:`3 hours`,seconds:10800},{label:`1 day`,seconds:86400},{label:`3 days`,seconds:259200},{label:`7 days`,seconds:604800},{label:`14 days`,seconds:1209600},{label:`30 days`,seconds:2592e3}];function sn(e){if(e===0)return`Never (sleep disabled)`;let t=Math.floor(e/86400),n=Math.floor(e%86400/3600);if(t>0&&n>0)return`${t}d ${n}h`;if(t>0)return`${t} day${t===1?``:`s`}`;if(n>0)return`${n} hour${n===1?``:`s`}`;let r=Math.floor(e/60);return r>0?`${r} minute${r===1?``:`s`}`:`${e}s`}function cn({assistantId:e}){let t=d(),n=Rt.use.isNonProduction(),r=(0,X.useMemo)(()=>on.filter(e=>!e.devOnly||n),[n]),{data:i,isLoading:a,isError:o}=f(rt({path:{id:e}})),s=(0,X.useMemo)(()=>i?.idle_timeout_seconds??259200,[i]),[l,u]=(0,X.useState)(null),p=l??s,m=l!==null,h=$e({onSuccess:()=>{U.success(`Sleep policy saved.`),u(null),t.invalidateQueries({queryKey:Xe({path:{id:e}})})},onError:()=>{U.error(`Failed to save sleep policy. Please try again.`)}});return a?(0,Z.jsxs)(`div`,{className:`flex items-center gap-2 text-body-medium-lighter text-[var(--content-tertiary)]`,children:[(0,Z.jsx)(w,{className:`h-4 w-4 animate-spin`}),`Loading sleep settings...`]}):o?(0,Z.jsx)(`p`,{className:`text-body-medium-lighter text-[var(--system-negative-strong)]`,children:`Failed to load sleep policy. Refresh the page to try again.`}):(0,Z.jsxs)(`div`,{className:`space-y-4`,children:[(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`label`,{className:`block text-body-medium-default text-[var(--content-default)]`,children:`Idle timeout`}),(0,Z.jsx)(`p`,{className:`text-body-small-default text-[var(--content-tertiary)]`,children:`How long the assistant can be idle before it is put to sleep. "Never" disables idle sleep entirely.`}),(0,Z.jsx)(`div`,{className:`mt-2 flex flex-wrap gap-2`,children:r.map(e=>(0,Z.jsx)(c,{variant:`outlined`,active:p===e.seconds,onClick:()=>u(e.seconds),children:e.label},e.seconds))}),(0,Z.jsxs)(`p`,{className:`mt-2 text-body-small-default text-[var(--content-tertiary)]`,children:[`Current: `,sn(p)]})]}),m&&(0,Z.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,Z.jsx)(c,{variant:`primary`,leftIcon:h.isPending?(0,Z.jsx)(w,{className:`animate-spin`}):void 0,onClick:()=>h.mutate({path:{id:e},body:{idle_timeout_seconds:p}}),disabled:h.isPending,children:`Save`}),(0,Z.jsx)(c,{variant:`outlined`,onClick:()=>u(null),disabled:h.isPending,children:`Cancel`})]})]})}function ln(e,t,n){let r=[e.version];return e.version===n&&r.push(`(latest)`),t&&e.version===t&&r.push(`(current)`),r.join(` `)}var un=3e3;function dn({assistantId:e,currentVersion:t,releaseChannel:n,onUpgradeComplete:r}){let i=lt.use.rollbackEnabled(),a=Ue.use.previewChannel(),o=d(),s=Mt(n,a),l=s===`preview`,[u,m]=(0,X.useState)(!1),h=(0,X.useRef)(null),[g,_]=(0,X.useState)(null),[v,y]=(0,X.useState)(!1),[b,x]=(0,X.useState)(!1),[S,C]=(0,X.useState)(null),T=e=>e&&h.current&&e===h.current?(queueMicrotask(()=>{C(b?`Successfully rolled back to version ${h.current}.`:`Successfully updated to version ${h.current}.`),m(!1),h.current=null,_(null),U.success(b?`Rollback complete — assistant is healthy.`:`Update complete — assistant is healthy.`,{id:`runtime-upgrade-complete`,tone:`strong`}),r?.()}),!1):un;f({...it({path:{id:e}}),refetchInterval:u?e=>T(e.state.data?.current_release_version):!1});let{data:E,isLoading:O}=f(et({query:{channel:s}})),k=E?.find(e=>e.is_stable!==!1)??E?.[0],A=g??k?.version??null,j=(0,X.useMemo)(()=>{if(!i||!A||!t)return!1;let e=ge(A),n=ge(t);return!e||!n?!1:_e(e,n)<0},[i,A,t]),M=(0,X.useMemo)(()=>{if(!A)return!1;if(!t)return!0;let e=ge(A),n=ge(t);if(!e||!n)return A!==t;let r=_e(e,n);return i?r!==0:r>0},[i,A,t]),N=p({mutationFn:async t=>{let{data:n}=await Ie({path:{id:e},body:t,throwOnError:!0});return n}}),P=p({mutationFn:async t=>{let{data:n}=await Fe({path:{id:e},body:t,throwOnError:!0});return n}});return(0,Z.jsxs)(`div`,{className:`space-y-5`,children:[(0,Z.jsxs)(`div`,{className:`flex flex-col gap-4 md:grid md:grid-cols-[auto_minmax(0,1fr)] md:items-center md:gap-x-8 md:gap-y-4`,children:[(0,Z.jsxs)(`div`,{className:`flex flex-col gap-1 md:contents`,children:[(0,Z.jsx)(`span`,{className:`text-body-medium-default text-[var(--content-tertiary)]`,children:`Current`}),(0,Z.jsx)(`span`,{className:`block min-w-0 break-all text-body-medium-lighter text-[var(--content-default)]`,children:t??`—`})]}),(0,Z.jsxs)(`div`,{className:`flex flex-col gap-1 md:contents`,children:[(0,Z.jsx)(`span`,{className:`text-body-medium-default text-[var(--content-tertiary)]`,children:l?`Preview release`:M?j?`Rollback to`:`Update to`:`Selected`}),(0,Z.jsx)(`span`,{className:`block min-w-0`,children:O?(0,Z.jsxs)(`span`,{className:`flex items-center gap-1 text-body-medium-lighter text-[var(--content-tertiary)]`,children:[(0,Z.jsx)(w,{className:`h-3 w-3 animate-spin`}),`Loading...`]}):E&&E.length>0?i?(0,Z.jsx)(re,{value:A??``,onChange:e=>_(e===k?.version?null:e),disabled:u||N.isPending||P.isPending,options:E.map(e=>({value:e.version,label:ln(e,t,k?.version)}))}):(0,Z.jsx)(`span`,{className:`block min-w-0 break-all text-body-medium-lighter text-[var(--content-default)]`,children:k?ln(k,t,k.version):`—`}):`No releases available`})]})]}),(0,Z.jsx)(c,{variant:j?`outlined`:`primary`,className:`min-w-[160px]`,leftIcon:N.isPending||P.isPending||u?(0,Z.jsx)(w,{className:`animate-spin`}):(0,Z.jsx)(D,{}),onClick:()=>y(!0),disabled:!M||N.isPending||P.isPending||u||O||!E?.length,children:u?b?`Rolling back...`:`Updating...`:j?`Rollback`:l?`Update preview`:`Update`}),l&&(0,Z.jsxs)(`p`,{className:`text-body-small-default text-[var(--content-tertiary)]`,children:[`Using Preview releases.`,` `,(0,Z.jsx)(`a`,{href:`#preview-release-channel`,className:`text-[var(--primary-base)] underline-offset-2 hover:underline`,children:`Switch back to Stable`})]}),!M&&t&&A&&!O&&(0,Z.jsx)(`p`,{className:`text-body-medium-lighter text-[var(--system-positive-strong)]`,children:S??`You are already on this version.`}),(0,Z.jsx)(W,{open:v,title:j?`Rollback assistant`:l?`Update preview release`:`Update assistant`,message:j?`Rollback to version ${A??`unknown`}? The assistant will be briefly unavailable.`:l?`Update to preview version ${A??`latest`}? The assistant will be briefly unavailable during the update.`:`Update to version ${A??`latest`}? The assistant will be briefly unavailable during the update.`,confirmLabel:j?`Rollback`:l?`Update preview`:`Update`,onConfirm:async()=>{y(!1),C(null);let t=g??void 0;try{if(j){let e=await P.mutateAsync({version:t});h.current=e.version??t??null,U.success(e.detail||`Rollback to ${t} initiated.`)}else{let e=await N.mutateAsync({version:t});if(e.detail?.includes(`Already on the latest`)){U.warning(e.detail);return}h.current=e.version??t??null,U.success(e.detail||`Update to ${e.version??t??`latest`} initiated.`)}x(j),m(!0),o.invalidateQueries({queryKey:qe({path:{id:e}})})}catch{U.error(j?`Failed to trigger rollback. Please try again.`:`Failed to trigger update. Please try again.`)}},onCancel:()=>y(!1)})]})}function fn({assistantId:e,currentVersion:t,onUpgradeComplete:n}){let[r,i]=(0,X.useState)(!1),[a,o]=(0,X.useState)(null),{data:s,isLoading:l}=f(et({query:{stable:!0,limit:100}})),u=(0,X.useMemo)(()=>Tt(s),[s]),d=u?.version,p=t?Ft(t,d):!!d,m=Dt({assistantId:e,targetVersion:d});return(0,Z.jsxs)(`div`,{className:`space-y-5`,children:[(0,Z.jsxs)(`div`,{className:`flex flex-col gap-4 md:grid md:grid-cols-[auto_minmax(0,1fr)] md:items-center md:gap-x-8 md:gap-y-4`,children:[(0,Z.jsxs)(`div`,{className:`flex flex-col gap-1 md:contents`,children:[(0,Z.jsx)(`span`,{className:`text-body-medium-default text-[var(--content-tertiary)]`,children:`Current`}),(0,Z.jsx)(`span`,{className:`block min-w-0 break-all text-body-medium-lighter text-[var(--content-default)]`,children:t??`—`})]}),(0,Z.jsxs)(`div`,{className:`flex flex-col gap-1 md:contents`,children:[(0,Z.jsx)(`span`,{className:`text-body-medium-default text-[var(--content-tertiary)]`,children:`Update to`}),(0,Z.jsx)(`span`,{className:`block min-w-0 break-all text-body-medium-lighter text-[var(--content-default)]`,children:l?`Loading...`:d&&u?ln(u,t,d):`No releases available`})]})]}),(0,Z.jsx)(c,{variant:`primary`,className:`min-w-[160px]`,leftIcon:m.isPending?(0,Z.jsx)(w,{className:`animate-spin`}):(0,Z.jsx)(D,{}),onClick:()=>i(!0),disabled:m.isPending||l||!d||!p,children:m.isPending?`Updating...`:d?`Update to ${d}`:`Update`}),a&&(0,Z.jsx)(`p`,{className:`text-body-medium-lighter text-[var(--system-positive-strong)]`,children:a}),!a&&!p&&d&&!l&&(0,Z.jsx)(`p`,{className:`text-body-medium-lighter text-[var(--system-positive-strong)]`,children:`You are already on this version.`}),(0,Z.jsx)(W,{open:r,title:`Update assistant`,message:`Update to version ${d??`latest`}? The assistant will be briefly unavailable during the update.`,confirmLabel:`Update`,onConfirm:async()=>{i(!1),o(null);try{let e=await m.upgrade();o(e.version?`Successfully updated to version ${e.version}.`:`Successfully updated to version ${d??`latest`}.`),U.success(`Update complete — assistant is healthy.`,{id:`runtime-upgrade-complete`,tone:`strong`}),n?.()}catch(e){U.error(e instanceof Error?e.message:`Failed to trigger update. Please try again.`)}},onCancel:()=>i(!1)})]})}function pn(){let e=jt.useValue();if(ut())return null;let t=He()?`Cmd`:`Ctrl`;return(0,Z.jsx)(Y,{title:`Composer`,children:(0,Z.jsx)(V,{checked:e,onChange:jt.save,label:`Send with ${t}+Enter`,helperText:`When enabled, Enter inserts a new line and ${t}+Enter sends.`})})}function mn(){let e=gt({platformHostedOnly:!0}),t=Ct(),n=Ae.use.user()?.id??null,r=Ae.use.logout(),[i,a]=(0,X.useState)(!1),o=Ze({onSuccess:async()=>{U.success(`Account deletion requested. You will be logged out shortly.`),ke(n),await r(),Ot(J.account.login)},onError:()=>{U.error(`Failed to request account deletion. Please try again.`)}}),s=e===`full`&&t;return(0,X.useEffect)(()=>{s&&i&&a(!1)},[s,i]),e===`gated`?null:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(Y,{title:`Delete Account`,subtitle:`Permanently delete your account and all associated data.`,variant:`danger`,children:e===`disabled`?(0,Z.jsx)(mt,{children:`Log in to the Vellum platform to delete your account.`}):(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(c,{variant:`dangerOutline`,onClick:()=>a(!0),disabled:o.isPending||s,className:`self-start`,children:`Delete My Account`}),s&&(0,Z.jsx)(w,{className:`h-4 w-4 animate-spin text-[var(--content-tertiary)]`})]})}),(0,Z.jsx)(W,{open:i,title:`Delete Account`,message:`This will permanently delete your account and all associated data. This action cannot be undone.`,confirmLabel:`Delete Account`,destructive:!0,onConfirm:()=>{if(s){a(!1);return}a(!1),o.mutate({})},onCancel:()=>a(!1)})]})}function hn({title:e,subtitle:t,benefits:n,ctaLabel:r,ctaLeftIcon:i,onAction:a}){return(0,Z.jsx)(Y,{title:e,subtitle:t,children:(0,Z.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,Z.jsx)(`ul`,{className:`space-y-3`,children:n.map(({icon:e,text:t})=>(0,Z.jsxs)(`li`,{className:`flex items-center gap-3`,children:[(0,Z.jsx)(`span`,{className:`flex size-7 shrink-0 items-center justify-center rounded-md`,style:{background:`var(--surface-base)`},children:(0,Z.jsx)(e,{size:14,style:{color:`var(--content-secondary)`},"aria-hidden":!0})}),(0,Z.jsx)(`span`,{className:`text-body-medium-lighter text-[color:var(--content-secondary)]`,children:t})]},t))}),(0,Z.jsx)(c,{variant:`primary`,size:`regular`,leftIcon:i,onClick:a,className:`self-start`,children:r})]})})}function gn(){return Ve()?(0,Z.jsx)(hn,{title:`Get the iOS App`,subtitle:`The Vellum iOS app gives you a native experience.`,benefits:[{icon:_,text:`Push notifications`},{icon:Ut,text:`Biometric login`},{icon:Wt,text:`Native haptics`},{icon:bt,text:`Home screen access`}],ctaLabel:`Download`,ctaLeftIcon:(0,Z.jsx)(bt,{size:16}),onAction:()=>{wt(),kt()}}):null}async function _n(){if(!me())return!1;let e=window.vellum;return e?.launchAtLogin?e.launchAtLogin.get():!1}async function vn(e){if(!me())return;let t=window.vellum;t?.launchAtLogin&&await t.launchAtLogin.set(e)}function yn(){let[e,t]=(0,X.useState)(!1);(0,X.useEffect)(()=>{_n().then(t)},[]);let n=async e=>{t(e);try{await vn(e)}catch{t(!e)}};return(0,Z.jsx)(Y,{title:`Launch at Login`,subtitle:`Automatically start Vellum when you log in to your Mac.`,children:(0,Z.jsx)(V,{checked:e,onChange:e=>void n(e),"aria-label":`Launch at Login`})})}function bn({className:e}){return(0,Z.jsx)(`div`,{role:`presentation`,className:h(`h-px w-full bg-[var(--border-base)]`,e)})}var xn=[`youtube.com`,`youtu.be`,`vimeo.com`,`loom.com`];function Sn(e){try{let t=JSON.parse(e);if(Array.isArray(t))return t.filter(e=>typeof e==`string`)}catch{}return[...xn]}function Cn(){return n(`mediaEmbedsEnabled`,!0)}function wn(){let e=i(`mediaEmbedDomains`,``);return e?Sn(e):[...xn]}function Tn(){let[e,n]=(0,X.useState)(()=>Cn()),[i,a]=(0,X.useState)(()=>wn()),[o,s]=(0,X.useState)(!1),[l,u]=(0,X.useState)(``),d=(0,X.useMemo)(()=>l.trim().toLowerCase(),[l]),f=e=>{n(e),t(`mediaEmbedsEnabled`,e)},p=e=>{a(e),r(`mediaEmbedDomains`,JSON.stringify(e))},m=()=>{if(d){if(i.includes(d)){u(``);return}p([...i,d]),u(``)}},h=e=>{p(i.filter(t=>t!==e))},g=()=>{p([...xn])},_=i.length===xn.length&&i.every((e,t)=>e===xn[t]);return(0,Z.jsxs)(Y,{title:`Media Embeds`,subtitle:`Automatically embed images, videos, and other media shared in chat messages.`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,Z.jsx)(`div`,{className:`text-body-medium-lighter text-[var(--content-default)]`,children:`Auto Media Embeds`}),(0,Z.jsx)(V,{checked:e,onChange:f})]}),e&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`div`,{className:`mt-4`,children:(0,Z.jsx)(bn,{})}),(0,Z.jsxs)(c,{type:`button`,variant:`ghost`,onClick:()=>s(e=>!e),className:`mt-4 w-full justify-between px-3`,"aria-expanded":o,children:[(0,Z.jsxs)(`span`,{className:`flex items-center gap-2`,children:[o?(0,Z.jsx)(y,{className:`h-4 w-4`,"aria-hidden":!0}):(0,Z.jsx)(b,{className:`h-4 w-4`,"aria-hidden":!0}),`Video Domain Allowlist`]}),(0,Z.jsxs)(`span`,{className:`text-body-small-default text-[var(--content-tertiary)]`,children:[i.length,` domain`,i.length===1?``:`s`]})]}),o&&(0,Z.jsxs)(`div`,{className:`mt-3 space-y-3`,children:[(0,Z.jsxs)(`div`,{className:`flex items-end gap-2`,children:[(0,Z.jsx)(B,{label:`Add Domain`,type:`text`,value:l,onChange:e=>u(e.target.value),onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),m())},placeholder:`Add domain (e.g. example.com)`,fullWidth:!0,wrapperClassName:`flex-1`}),(0,Z.jsx)(c,{variant:`primary`,size:`compact`,onClick:m,disabled:!d,children:`Add`})]}),i.length>0&&(0,Z.jsx)(`div`,{className:`flex justify-end`,children:(0,Z.jsx)(c,{type:`button`,variant:`ghost`,size:`compact`,onClick:g,disabled:_,tintColor:`var(--content-tertiary)`,children:`Reset to Defaults`})}),i.length>0&&(0,Z.jsx)(`ul`,{className:`space-y-2`,children:i.map(e=>(0,Z.jsxs)(`li`,{className:`flex items-center justify-between rounded-md border border-[var(--border-base)] px-3 py-2 text-body-medium-lighter`,children:[(0,Z.jsx)(`span`,{className:`font-mono text-[var(--content-default)]`,children:e}),(0,Z.jsx)(c,{variant:`dangerGhost`,size:`compact`,iconOnly:(0,Z.jsx)(Pt,{}),onClick:()=>h(e),"aria-label":`Remove ${e}`})]},e))})]})]})]})}function En(e){return e===`preview`?`preview`:`stable`}function Dn(e){if(!e)return`Unknown`;let t=new Date(e);return Number.isNaN(t.getTime())?`Unknown`:t.toLocaleString(void 0,{year:`numeric`,month:`short`,day:`numeric`,hour:`numeric`,minute:`2-digit`})}function On(e){return e.source_release_version?`Stable ${e.source_release_version}`:e.snapshot_name}function kn(e){return e.filter(e=>e.ready_to_use)}function An(e){return e?.feature_enabled===!1}function jn({assistantId:e,onComplete:t}){let n=Ue.use.previewChannel(),r=d(),[i,a]=(0,X.useState)(),[o,s]=(0,X.useState)(!1),[c,l]=(0,X.useState)(!1),[u,m]=(0,X.useState)(`restore_backup`),[h,g]=(0,X.useState)(``),_=Ye({path:{assistant_id:e}}),v=Je({path:{assistant_id:e}}),b=qe({path:{id:e}}),{data:x,isLoading:S,isError:C}=f({..._,enabled:n,retry:!1}),T=x?.preview_backups??[],E=(0,X.useMemo)(()=>kn(T),[T]),D=E[0],O=E.find(e=>e.snapshot_name===h)??D,k=()=>{r.invalidateQueries({queryKey:v}),r.invalidateQueries({queryKey:b}),t?.()},A=p(st()),j=p(Qe()),M=En(x?.current_channel),N=A.isPending||j.isPending,P=N||An(x)||!x?.latest_preview_release,F=u===`restore_backup`&&!O;if((0,X.useEffect)(()=>{a(M===`preview`?`release-channel`:void 0)},[M]),!n)return null;let L=x?.standard_upgrade_available??!1;return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(z.Root,{type:`single`,collapsible:!0,value:i,onValueChange:e=>a(e||void 0),className:`mt-5 border-t border-[var(--border-base)] pt-5`,children:(0,Z.jsxs)(z.Item,{value:`release-channel`,id:`preview-release-channel`,children:[(0,Z.jsxs)(z.Trigger,{className:`group justify-between gap-3`,children:[(0,Z.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,Z.jsx)(`span`,{className:`text-body-medium-default text-[var(--content-secondary)]`,children:`Release Channel`}),x&&(0,Z.jsx)(te,{tone:M===`preview`?`warning`:`neutral`,children:M===`preview`?`Preview`:`Stable`})]}),(0,Z.jsx)(y,{className:`h-4 w-4 shrink-0 text-[var(--content-tertiary)] transition-transform group-data-[state=open]:rotate-180`})]}),(0,Z.jsx)(z.Content,{children:(0,Z.jsxs)(`div`,{className:`mt-4 space-y-4`,children:[S&&(0,Z.jsxs)(`div`,{className:`flex items-center gap-2 text-body-medium-lighter text-[var(--content-tertiary)]`,children:[(0,Z.jsx)(w,{className:`h-4 w-4 animate-spin`}),`Loading release channel...`]}),C&&(0,Z.jsx)(I,{tone:`error`,title:`Could not load release channel status`,children:`Refresh this page before changing release channels.`}),x&&(0,Z.jsxs)(Z.Fragment,{children:[An(x)&&(0,Z.jsx)(I,{tone:`neutral`,title:`Preview channel is unavailable`,children:`The Preview channel is not enabled for this assistant.`}),M===`stable`?(0,Z.jsx)(Mn,{status:x,isChangingChannel:N,optInDisabled:P,onOptIn:()=>s(!0)}):(0,Z.jsx)(Nn,{status:x,isChangingChannel:N,onOptOut:()=>{let e=D;g(e?.snapshot_name??``),m(e?`restore_backup`:L?`standard_upgrade`:`restore_backup`),l(!0)}})]})]})})]})}),(0,Z.jsx)(Fn,{open:o,isPending:A.isPending,previewVersion:x?.latest_preview_release?.version,onConfirm:async()=>{try{let t=await A.mutateAsync({path:{assistant_id:e}});U.success(t.detail||`Preview channel enabled.`),s(!1),k()}catch(e){U.error(ye(e,void 0,`Could not enable Preview channel.`))}},onCancel:()=>s(!1)}),(0,Z.jsx)(In,{open:c,backups:E,mode:u,selectedSnapshotName:O?.snapshot_name??``,isPending:j.isPending,restoreModeDisabled:F,standardUpgradeAvailable:L,onModeChange:m,onSnapshotChange:g,onConfirm:async()=>{if(!F)try{let t=await j.mutateAsync({path:{assistant_id:e},body:u===`restore_backup`?{mode:`restore_backup`,snapshot_name:O?.snapshot_name}:{mode:`standard_upgrade`}});U.success(t.detail||`Stable channel enabled.`),l(!1),k()}catch(e){U.error(ye(e,void 0,`Could not switch to Stable.`))}},onCancel:()=>l(!1)})]})}function Mn({status:e,isChangingChannel:t,optInDisabled:n,onOptIn:r}){return(0,Z.jsxs)(`div`,{className:`space-y-4`,children:[(0,Z.jsx)(Pn,{status:e}),!e.latest_preview_release&&(0,Z.jsx)(I,{tone:`neutral`,title:`No Preview release is available`,children:`Stable remains the only available release channel.`}),(0,Z.jsx)(c,{variant:`outlined`,leftIcon:t?(0,Z.jsx)(w,{className:`animate-spin`}):(0,Z.jsx)(vt,{}),disabled:n,onClick:r,children:`Opt in to Preview`})]})}function Nn({status:e,isChangingChannel:t,onOptOut:n}){return(0,Z.jsxs)(`div`,{className:`space-y-4`,children:[(0,Z.jsx)(Pn,{status:e}),(0,Z.jsx)(c,{variant:`outlined`,leftIcon:t?(0,Z.jsx)(w,{className:`animate-spin`}):(0,Z.jsx)(_t,{}),disabled:t,onClick:n,children:`Switch back to Stable`})]})}function Pn({status:e}){return(0,Z.jsxs)(`dl`,{className:`grid gap-3 text-body-medium-lighter sm:grid-cols-2`,children:[(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`dt`,{className:`text-[var(--content-tertiary)]`,children:`Latest Stable`}),(0,Z.jsx)(`dd`,{className:`break-all text-[var(--content-default)]`,children:e.latest_stable_release?.version??`None`})]}),(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`dt`,{className:`text-[var(--content-tertiary)]`,children:`Latest Preview`}),(0,Z.jsx)(`dd`,{className:`break-all text-[var(--content-default)]`,children:e.latest_preview_release?.version??`None`})]})]})}function Fn({open:e,isPending:t,previewVersion:n,onConfirm:r,onCancel:i}){return(0,Z.jsx)(H.Root,{open:e,onOpenChange:e=>!e&&i(),children:(0,Z.jsxs)(H.Content,{size:`md`,hideCloseButton:t,children:[(0,Z.jsxs)(H.Header,{children:[(0,Z.jsx)(H.Title,{icon:F,children:`Opt in to Preview`}),(0,Z.jsx)(H.Description,{children:`Preview releases may be unstable. A 90-day safety backup is taken before the image changes.`})]}),(0,Z.jsx)(H.Body,{children:(0,Z.jsxs)(`div`,{className:`space-y-3`,children:[(0,Z.jsx)(I,{tone:`warning`,title:`Data loss may occur when returning to Stable`,children:`Preview data may not be compatible with the Stable channel. The safety backup lets you restore the Stable-channel data that existed before opt-in.`}),(0,Z.jsxs)(`ol`,{className:`list-decimal space-y-2 pl-5 text-body-medium-lighter text-[var(--content-secondary)]`,children:[(0,Z.jsx)(`li`,{children:`Create and verify a Preview safety backup.`}),(0,Z.jsxs)(`li`,{children:[`Switch to Preview image `,n??`latest`,`.`]}),(0,Z.jsx)(`li`,{children:`Run the normal upgrade path and wait for health.`})]})]})}),(0,Z.jsxs)(H.Footer,{children:[(0,Z.jsx)(c,{variant:`outlined`,disabled:t,onClick:i,children:`Cancel`}),(0,Z.jsx)(c,{variant:`primary`,disabled:t,leftIcon:t?(0,Z.jsx)(w,{className:`animate-spin`}):(0,Z.jsx)(vt,{}),onClick:r,children:t?`Switching...`:`Take Backup and Switch`})]})]})})}function In({open:e,backups:t,mode:n,selectedSnapshotName:r,isPending:i,restoreModeDisabled:a,standardUpgradeAvailable:o,onModeChange:s,onSnapshotChange:l,onConfirm:u,onCancel:d}){return(0,Z.jsx)(H.Root,{open:e,onOpenChange:e=>!e&&d(),children:(0,Z.jsxs)(H.Content,{size:`md`,hideCloseButton:i,children:[(0,Z.jsxs)(H.Header,{children:[(0,Z.jsx)(H.Title,{icon:F,children:`Switch back to Stable`}),(0,Z.jsx)(H.Description,{children:`Choose how this assistant should leave the Preview channel.`})]}),(0,Z.jsx)(H.Body,{children:(0,Z.jsxs)(`div`,{className:`space-y-4`,children:[(0,Z.jsxs)(R,{value:n,onValueChange:s,disabled:i,"aria-label":`Stable channel return method`,children:[(0,Z.jsx)(ee,{value:`restore_backup`,disabled:t.length===0,label:`Restore safety backup`,helperText:`Return to the Stable-channel data captured before Preview opt-in.`}),(0,Z.jsx)(ee,{value:`standard_upgrade`,disabled:!o,label:`Switch to Stable without restoring backup`,helperText:o?`Keep the current data and directly switch to the Stable image.`:`Unavailable because the latest Stable release is older than this assistant's Preview release.`})]}),n===`restore_backup`&&t.length>0&&(0,Z.jsxs)(`label`,{className:`flex flex-col gap-1 text-body-medium-default text-[var(--content-secondary)]`,children:[`Safety backup`,(0,Z.jsx)(re,{value:r,onChange:l,disabled:i,options:t.map(e=>({value:e.snapshot_name,label:`${On(e)} - ${Dn(e.created_at)}`}))})]}),n===`restore_backup`&&t.length===0&&!o&&(0,Z.jsx)(I,{tone:`error`,title:`Stable requires a safety backup`,children:`This Preview release is newer than the latest Stable release, so switching directly is blocked. Wait for a newer Stable release, or run Vellum Doctor if the safety backup is missing.`}),n===`standard_upgrade`&&(0,Z.jsx)(I,{tone:`error`,title:`Preview data may not survive this`,children:`Switching directly to the Stable image without restoring the safety backup may cause data loss or leave the assistant unusable if Preview data is incompatible with Stable.`})]})}),(0,Z.jsxs)(H.Footer,{children:[(0,Z.jsx)(c,{variant:`outlined`,disabled:i,onClick:d,children:`Cancel`}),(0,Z.jsx)(c,{variant:n===`standard_upgrade`?`danger`:`primary`,disabled:i||a||n===`standard_upgrade`&&!o,leftIcon:i?(0,Z.jsx)(w,{className:`animate-spin`}):(0,Z.jsx)(D,{}),onClick:u,children:i?`Switching...`:`Switch to Stable`})]})]})})}function Ln({assistant:e,healthz:t,healthzLoading:n,healthzPolling:r,refetch:i,refetchUntilResized:a}){let o=l(),s=f(nt()),d=s.data,p=!e.is_local,m=d?.plan_id===`pro`,h=f({...at(),enabled:m}),g=e.machine_size||`small`,_=O(h.data?.max_machine_tier??null),v=(0,X.useMemo)(()=>A(_,g,(0,Z.jsx)(te,{tone:`positive`,children:`Current`})),[_,g]),y=h.data?.selected_storage_gib??null,[b,x]=(0,X.useState)(!1),S=_.length>0?_[_.length-1]:null,[T,E]=(0,X.useState)(null),F=T??S??g,[L,R]=(0,X.useState)(null),[ee,z]=(0,X.useState)(null),B=ct({onSuccess:(e,n)=>{U.success(`Resize started. Changes will apply shortly.`,{id:`assistant-resize`}),z(null),E(null),x(!1),n.body?.machine_size==null?i():a(t)},onError:e=>{z(N(e,`Failed to resize assistant. Please try again.`))}});if(s.isError&&d==null)return(0,Z.jsx)(Y,{id:`storage-resources`,title:`Compute & Resources`,subtitle:`Monitor resource usage and manage your assistant's compute profile.`,children:(0,Z.jsx)(I,{tone:`error`,children:`Could not load your subscription. Please try again.`})});let V=m&&_.includes(F)&&F!==g?F:null,ne=m&&y!=null&&!0,W=m&&_.length>0&&M(g)<M(_[_.length-1]),G=B.isPending||r,ie=y==null?t?.disk?.totalMb??null:y*1024,K=t?.disk&&ie!=null?{value:t.disk.usedMb,max:ie,caption:`${Bt(t.disk.usedMb)} of ${Bt(ie)}`}:null,ae=t?.cpu?{value:t.cpu.currentPercent,max:100,caption:`${t.cpu.currentPercent.toFixed(1)}%`}:null,oe=t?.memory?{value:t.memory.currentMb,max:t.memory.maxMb,caption:`${Bt(t.memory.currentMb)} of ${Bt(t.memory.maxMb)}`}:null,se=p?m?ne?(0,Z.jsxs)(`button`,{type:`button`,disabled:G,onClick:()=>x(!0),className:`flex items-center gap-1.5 rounded-lg border border-amber-500/30 bg-amber-500/15 px-3 py-1.5 text-body-small-default font-medium text-amber-400 transition-colors hover:bg-amber-500/25 disabled:opacity-50`,children:[(0,Z.jsx)(P,{className:`h-3.5 w-3.5`}),`Increase Storage`]}):(0,Z.jsx)(c,{variant:`ghost`,size:`compact`,disabled:G,onClick:()=>x(!0),children:`Resize`}):(0,Z.jsx)(c,{variant:`ghost`,size:`compact`,onClick:()=>R(`storage`),children:`Resize`}):null,ce=p?m?W?(0,Z.jsxs)(`button`,{type:`button`,disabled:G,onClick:()=>x(!0),className:`flex items-center gap-1.5 rounded-lg border border-amber-500/30 bg-amber-500/15 px-3 py-1.5 text-body-small-default font-medium text-amber-400 transition-colors hover:bg-amber-500/25 disabled:opacity-50`,children:[(0,Z.jsx)(P,{className:`h-3.5 w-3.5`}),`Increase Size`]}):(0,Z.jsx)(c,{variant:`ghost`,size:`compact`,disabled:G,onClick:()=>x(!0),children:`Resize`}):(0,Z.jsx)(c,{variant:`ghost`,size:`compact`,onClick:()=>R(`machine`),children:`Resize`}):null;return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(Y,{id:`storage-resources`,title:`Compute & Resources`,subtitle:`Monitor resource usage and manage your assistant's compute profile.`,compactAccessory:!0,accessory:(0,Z.jsx)(c,{variant:`ghost`,size:`compact`,iconOnly:n||r?(0,Z.jsx)(w,{className:`animate-spin`}):(0,Z.jsx)(D,{}),tooltip:r?`Applying resize…`:`Refresh resource metrics`,"aria-label":`Refresh resource metrics`,disabled:n||r,onClick:()=>void i()}),children:(0,Z.jsxs)(`div`,{className:`grid grid-cols-1 gap-2 sm:grid-cols-[1fr_2fr]`,children:[(0,Z.jsxs)(`div`,{className:`flex flex-col rounded-lg bg-[var(--surface-base)] p-3`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,Z.jsx)(`span`,{className:`text-[var(--content-tertiary)]`,children:(0,Z.jsx)(C,{className:`h-3.5 w-3.5`})}),(0,Z.jsx)(`span`,{className:`text-label-medium-default text-[var(--content-tertiary)]`,children:`Disk`})]}),se]}),(0,Z.jsxs)(`div`,{className:`mt-auto flex flex-col gap-1 pt-3`,children:[(0,Z.jsx)(`span`,{className:`text-label-medium-default text-[var(--content-tertiary)]`,children:`Storage`}),K?(0,Z.jsx)(zt,{value:K.value,max:K.max,caption:K.caption}):n?(0,Z.jsx)(`div`,{className:`flex items-center gap-2 text-[var(--content-tertiary)]`,children:(0,Z.jsx)(w,{className:`h-3 w-3 animate-spin`})}):(0,Z.jsx)(`span`,{className:`text-label-medium-default text-[var(--content-tertiary)]`,children:`Unavailable`})]})]}),(0,Z.jsxs)(`div`,{className:`flex flex-col rounded-lg bg-[var(--surface-base)] p-3`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,Z.jsx)(`span`,{className:`text-[var(--content-tertiary)]`,children:(0,Z.jsx)(k,{className:`h-3.5 w-3.5`})}),(0,Z.jsx)(`span`,{className:`text-label-medium-default text-[var(--content-tertiary)]`,children:`Machine`}),(0,Z.jsx)(te,{tone:`neutral`,children:j[g]})]}),ce]}),(0,Z.jsxs)(`div`,{className:`mt-auto grid grid-cols-2 gap-3 pt-3`,children:[(0,Z.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,Z.jsx)(`span`,{className:`text-label-medium-default text-[var(--content-tertiary)]`,children:`CPU`}),ae?(0,Z.jsx)(zt,{value:ae.value,max:ae.max,caption:ae.caption}):n?(0,Z.jsx)(`div`,{className:`flex items-center gap-2 text-[var(--content-tertiary)]`,children:(0,Z.jsx)(w,{className:`h-3 w-3 animate-spin`})}):(0,Z.jsx)(`span`,{className:`text-label-medium-default text-[var(--content-tertiary)]`,children:`—`})]}),(0,Z.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,Z.jsx)(`span`,{className:`text-label-medium-default text-[var(--content-tertiary)]`,children:`Memory`}),oe?(0,Z.jsx)(zt,{value:oe.value,max:oe.max,caption:oe.caption}):n?(0,Z.jsx)(`div`,{className:`flex items-center gap-2 text-[var(--content-tertiary)]`,children:(0,Z.jsx)(w,{className:`h-3 w-3 animate-spin`})}):(0,Z.jsx)(`span`,{className:`text-label-medium-default text-[var(--content-tertiary)]`,children:`—`})]})]})]})]})}),(0,Z.jsx)(H.Root,{open:L!=null,onOpenChange:e=>{e||R(null)},children:(0,Z.jsxs)(H.Content,{size:`sm`,children:[(0,Z.jsxs)(H.Header,{children:[(0,Z.jsx)(H.Title,{children:`Upgrade to Pro`}),(0,Z.jsx)(H.Description,{children:L===`storage`?`Upgrade to the Pro plan to increase your storage allocation and get more space for your assistant.`:`Upgrade to the Pro plan to unlock larger machine sizes with more CPU and memory for your assistant.`})]}),(0,Z.jsxs)(H.Footer,{children:[(0,Z.jsx)(c,{variant:`ghost`,onClick:()=>R(null),children:`Cancel`}),(0,Z.jsx)(c,{onClick:()=>{R(null),o(`${J.settings.billing}?adjust_plan=1`)},children:`Upgrade`})]})]})}),(0,Z.jsx)(H.Root,{open:b,onOpenChange:e=>{e||(x(!1),E(null),z(null))},children:(0,Z.jsxs)(H.Content,{size:`sm`,children:[(0,Z.jsxs)(H.Header,{children:[(0,Z.jsx)(H.Title,{icon:k,children:`Resize Assistant`}),(0,Z.jsx)(H.Description,{children:`Resize your assistant's compute and storage. Your assistant will briefly restart.`})]}),(0,Z.jsx)(H.Body,{children:(0,Z.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[_.length===0?(0,Z.jsx)(I,{tone:`warning`,children:`No machine tier configured. Visit the community for help.`}):(0,Z.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,Z.jsx)(`span`,{className:`text-label-medium-default text-[var(--content-secondary)]`,children:`Machine Size`}),(0,Z.jsx)(re,{options:v,value:F,onChange:E,"aria-label":`Compute machine size`,"data-testid":`resize-machine-size`})]}),ne?(0,Z.jsx)(I,{tone:`info`,children:`Storage will be expanded to ${y} GiB.`}):(0,Z.jsx)(I,{tone:`neutral`,children:`Storage will not change.`}),ee&&(0,Z.jsx)(I,{tone:`error`,children:ee})]})}),(0,Z.jsxs)(H.Footer,{className:`items-center justify-between`,children:[(0,Z.jsxs)(`span`,{className:`text-label-small-default text-[var(--content-tertiary)]`,children:[`Need more?`,` `,(0,Z.jsx)(u,{to:`${J.settings.billing}?adjust_plan=1`,className:`text-[var(--content-secondary)] underline decoration-[var(--border-element)] underline-offset-2 transition-colors hover:text-[var(--content-default)]`,onClick:()=>x(!1),children:`Upgrade plan`})]}),(0,Z.jsxs)(`div`,{className:`flex gap-2`,children:[(0,Z.jsx)(c,{variant:`ghost`,onClick:()=>{x(!1),E(null),z(null)},children:`Cancel`}),(0,Z.jsx)(c,{disabled:V==null&&!ne||G,leftIcon:G?(0,Z.jsx)(w,{className:`animate-spin`}):void 0,onClick:()=>{z(null);let t={};V!=null&&(t.machine_size=V),ne&&y!=null&&(t.storage_gib=y),B.mutate({path:{id:e.id},body:t})},children:ee?`Retry`:`Apply`})]})]})]})})]})}function Rn({assistantId:e}){let t=l(),[n,r]=(0,X.useState)(!1),[i,a]=(0,X.useState)(!1);return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(c,{variant:`dangerOutline`,onClick:()=>r(!0),className:`shrink-0`,children:`Retire Assistant`}),(0,Z.jsx)(yt,{open:n,isPending:i,onConfirm:async()=>{a(!0);let n=await ht(e);if(n.ok){r(!1),t(n.nextRoute,{replace:!0});return}U.error(n.error),a(!1),r(!1)},onCancel:()=>r(!1)})]})}var zn=`UTC.Africa/Cairo.Africa/Johannesburg.Africa/Lagos.Africa/Nairobi.America/Anchorage.America/Argentina/Buenos_Aires.America/Bogota.America/Chicago.America/Denver.America/Halifax.America/Lima.America/Los_Angeles.America/Mexico_City.America/New_York.America/Phoenix.America/Santiago.America/Sao_Paulo.America/Toronto.America/Vancouver.Asia/Bangkok.Asia/Dubai.Asia/Hong_Kong.Asia/Jakarta.Asia/Jerusalem.Asia/Karachi.Asia/Kolkata.Asia/Kuala_Lumpur.Asia/Manila.Asia/Seoul.Asia/Shanghai.Asia/Singapore.Asia/Taipei.Asia/Tokyo.Australia/Melbourne.Australia/Perth.Australia/Sydney.Europe/Amsterdam.Europe/Athens.Europe/Berlin.Europe/Brussels.Europe/Dublin.Europe/Istanbul.Europe/Lisbon.Europe/London.Europe/Madrid.Europe/Moscow.Europe/Paris.Europe/Rome.Europe/Stockholm.Europe/Vienna.Europe/Warsaw.Europe/Zurich.Pacific/Auckland.Pacific/Honolulu`.split(`.`);function Bn(){let e=Intl;if(typeof e.supportedValuesOf==`function`)try{let t=e.supportedValuesOf(`timeZone`);if(t.length>0)return[...t].sort()}catch{}return[...zn].sort()}function Vn(e){let t=e.split(`/`),n=(t[t.length-1]??e).replace(/_/g,` `),r=t.length>1?(t[0]??``).replace(/_/g,` `):``,i=0,a=``;try{let t=new Intl.DateTimeFormat(`en-US`,{timeZone:e,timeZoneName:`shortOffset`}).formatToParts(new Date).find(e=>e.type===`timeZoneName`)?.value??`GMT`;a=t.startsWith(`GMT`)||t.startsWith(`UTC`)?t:`GMT ${t}`;let n=t.match(/([+-])(\d{1,2})(?::(\d{2}))?/);if(n){let e=n[1]===`-`?-1:1,t=parseInt(n[2]??`0`,10),r=parseInt(n[3]??`0`,10);i=e*(t*60+r)}}catch{return null}return{identifier:e,city:n,region:r,offsetLabel:a,offsetMinutes:i}}function Hn(e){try{return new Intl.DateTimeFormat(`en-US`,{timeZone:e,hour:`numeric`,minute:`2-digit`,hour12:!0}).format(new Date)}catch{return``}}function Un(e){if(!e)return`Not set`;try{let t=new Intl.DateTimeFormat(`en-US`,{timeZone:e,timeZoneName:`long`}).formatToParts(new Date).find(e=>e.type===`timeZoneName`)?.value;if(t)return t}catch{}return e.replace(/_/g,` `)}function Wn({value:e,onChange:t}){let[n,r]=(0,X.useState)(``),[i,a]=(0,X.useState)(``),[o,s]=(0,X.useState)(!1),c=(0,X.useRef)(null),l=(0,X.useRef)(null),u=(0,X.useMemo)(()=>Bn().map(e=>Vn(e)).filter(e=>e!==null),[]);(0,X.useEffect)(()=>{let e=window.setTimeout(()=>{a(n.trim().toLowerCase())},200);return()=>window.clearTimeout(e)},[n]),(0,X.useEffect)(()=>{if(!o)return;let e=e=>{c.current&&!c.current.contains(e.target)&&s(!1)};return document.addEventListener(`mousedown`,e),()=>document.removeEventListener(`mousedown`,e)},[o]);let d=(0,X.useMemo)(()=>i?u.filter(e=>e.city.toLowerCase().includes(i)||e.region.toLowerCase().includes(i)||e.offsetLabel.toLowerCase().includes(i)||e.identifier.toLowerCase().includes(i)):u,[u,i]),f=(0,X.useMemo)(()=>{if(!e)return``;let t=e.split(`/`);return(t[t.length-1]??e).replace(/_/g,` `)},[e]),p=e=>{t(e),r(``),s(!1),l.current?.blur()};return(0,Z.jsxs)(`div`,{ref:c,className:`space-y-3`,children:[(0,Z.jsxs)(`div`,{className:`flex flex-col gap-1.5 md:flex-row md:items-center md:justify-between md:gap-4`,children:[(0,Z.jsx)(`span`,{className:`text-body-medium-lighter text-[var(--content-tertiary)]`,children:`Closest city`}),(0,Z.jsxs)(`div`,{className:`relative w-full md:max-w-[280px]`,children:[(0,Z.jsx)(B,{ref:l,type:`text`,value:n,placeholder:f||`Search city or country...`,onChange:e=>{r(e.target.value),s(!0)},onFocus:()=>s(!0),onKeyDown:e=>{e.key===`Escape`&&(r(``),s(!1),l.current?.blur())},fullWidth:!0}),o&&d.length>0&&(0,Z.jsx)(`div`,{className:`absolute left-0 right-0 top-full z-20 mt-1 max-h-[240px] overflow-y-auto rounded-md border border-[var(--border-base)] bg-[var(--surface-lift)] shadow-lg`,children:d.slice(0,200).map(t=>(0,Z.jsxs)(`button`,{type:`button`,onClick:()=>p(t.identifier),className:`flex w-full cursor-pointer items-center justify-between gap-3 px-3 py-2 text-left text-body-medium-lighter transition-colors ${t.identifier===e?`bg-[var(--surface-active)] text-[var(--content-default)]`:`text-[var(--content-default)] hover:bg-[var(--surface-active)]`}`,children:[(0,Z.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Z.jsx)(`div`,{className:`truncate text-body-medium-default`,children:t.city}),t.region&&(0,Z.jsx)(`div`,{className:`truncate text-body-small-default text-[var(--content-tertiary)]`,children:t.region})]}),(0,Z.jsxs)(`div`,{className:`flex shrink-0 flex-col items-end gap-0.5 text-body-small-default text-[var(--content-tertiary)]`,children:[(0,Z.jsx)(`span`,{children:Hn(t.identifier)}),(0,Z.jsx)(`span`,{children:t.offsetLabel})]})]},t.identifier))})]})]}),(0,Z.jsx)(bn,{}),(0,Z.jsxs)(`div`,{className:`flex items-center justify-between gap-4`,children:[(0,Z.jsx)(`span`,{className:`text-body-medium-lighter text-[var(--content-tertiary)]`,children:`Time zone`}),(0,Z.jsx)(`span`,{className:`text-body-medium-lighter text-[var(--content-default)]`,children:Un(e)})]})]})}var Q=class extends Error{code;constructor(e,t){super(t),this.name=`TeleportError`,this.code=e}},Gn=`local`,Kn=`docker`,qn=`vellum`;function Jn(e){switch((e??``).toLowerCase()){case Gn:return`local`;case Kn:return`docker`;case qn:return`managed`;default:return`other`}}function Yn(e){let t=Jn(e);return t===`managed`?`local`:t===`local`?`platform`:null}function Xn(e){switch(e){case`docker`:return`Move to Docker`;case`platform`:return`Move to Cloud (Platform)`;case`local`:return`Move to Local`}}function Zn(e){switch(e){case`docker`:return`Run your assistant in a Docker container on this Mac.`;case`platform`:return`Run your assistant in the cloud, managed by the Vellum platform.`;case`local`:return`Run your assistant locally on this Mac.`}}function Qn(e){if(!e||typeof e!=`object`)return null;let t=e;if(t.reason!==`version_mismatch`)return null;let n=t.bundle_compat,r=t.target_runtime_version;if(!n||typeof n!=`object`||typeof r!=`string`)return null;let i=n,a=i.min_runtime_version;if(typeof a!=`string`)return null;let o=typeof i.max_runtime_version==`string`?i.max_runtime_version:null;return`Cannot import: bundle requires runtime ${o?`${a}–${o}`:`${a}+`}, but this local runtime is ${r}. Update your local runtime before importing.`}async function $n(e,t){let n=Number(e.headers.get(`Content-Length`)??0);if(!e.body||!t||n<=0){let n=await e.arrayBuffer();return t?.(1),n}let r=e.body.getReader(),i=[],a=0;for(;;){let{done:e,value:o}=await r.read();if(e)break;i.push(o),a+=o.length,t(a/n)}let o=new Uint8Array(a),s=0;for(let e of i)o.set(e,s),s+=e.length;return t(1),o.buffer}function er(e){let t=le(e);if(!t)throw new Q(`local_assistant_not_found`,`Assistant ${e.assistantId} has no resolved local gateway.`);return`${window.location.origin}${t}`}async function tr(e,t){let n=await ie(e.assistantId),r=await fetch(`${t}/auth/token`,{method:`POST`,headers:{Authorization:`Bearer ${n}`}});if(!r.ok)throw new Q(`not_signed_in`,`Gateway token request failed (HTTP ${r.status}).`);let{token:i}=await r.json();return i}async function nr(e,t){let n=er(e),r=await tr(e,n),i=await fetch(`${n}/v1/migrations/export`,{method:`POST`,headers:{Authorization:`Bearer ${r}`}});if(!i.ok)throw new Q(`export_failed`,`Export failed (HTTP ${i.status}).`);return $n(i,t)}async function rr(e,t){let n=er(e),r=await tr(e,n),i=await fetch(`${n}/v1/migrations/import`,{method:`POST`,headers:{Authorization:`Bearer ${r}`},body:new Blob([t],{type:`application/octet-stream`})});if(!i.ok)throw new Q(`import_failed`,`Import failed (HTTP ${i.status}).`);let a=await or(i);if(a&&a.success===!1)throw new Q(`import_failed`,a.error??`Import reported failure`)}async function ir(e,t){let{data:n,response:r}=await q.post({url:`/v1/assistants/{assistant_id}/migrations/export-to-gcs/`,path:{assistant_id:e},body:{upload_url:t},throwOnError:!1}),i=r?.status??0;if(!(r?.ok??!1)&&i!==202)throw new Q(`export_failed`,`Export failed (HTTP ${i}).`);let a=n?.job_id;if(!a)throw new Q(`export_failed`,`Export accepted but no job ID was returned.`);return a}async function ar(e,t){let{data:n,response:r}=await q.get({url:`/v1/assistants/{assistant_id}/migrations/jobs/{job_id}`,path:{assistant_id:e,job_id:t},throwOnError:!1}),i=r?.status??0;if(i>=500)return`processing`;if(!(r?.ok??!1))throw new Q(`export_job_failed`,`Job status check failed (HTTP ${i})`);let a=n;if(a?.status===`failed`)throw new Q(`export_job_failed`,a.error??`Export job failed`);return a?.status??`processing`}async function or(e){try{return await e.json()}catch{return null}}var sr=new Set([500,502,503,504]),$=3,cr=e=>new Promise(t=>setTimeout(t,e));async function lr(e,t=new Set){for(let n=0;n<=$;n++){let{response:r,data:i,error:a}=await e(),o=r?.status??0;if(n<$&&sr.has(o)&&!t.has(o)){await cr(2**n*1e3);continue}return{status:o,data:i,error:a}}throw new Q(`unknown`,`Unexpected retry loop exit`)}async function ur(e,t){let n={operation:`upload`};e&&(n.min_runtime_version=e,n.max_runtime_version=null),t&&(n.consumer=t);let{status:r,data:i}=await lr(()=>q.post({url:`/v1/migrations/signed-url/`,body:n,throwOnError:!1}),new Set([404,503]));if(r===503||r===404)throw new Q(`export_failed`,`Signed URL uploads are not available — the platform may not support this feature yet.`);if(r!==201)throw new Q(`export_failed`,`Migration request failed (HTTP ${r}).`);let a=i;return{url:a.url,bundleKey:a.bundle_key,expiresAt:a.expires_at}}async function dr(e,t){let{status:n,data:r,error:i}=await lr(()=>q.post({url:`/v1/migrations/signed-url/`,body:{operation:`download`,bundle_key:e,target_runtime_version:t},throwOnError:!1}),new Set([422]));if(n===422){let e=Qn(i);if(e)throw new Q(`version_mismatch`,e)}if(n!==200&&n!==201)throw new Q(`import_failed`,`Migration request failed (HTTP ${n}).`);return r.url}async function fr(e,t,n){for(let r=0;r<=$;r++){let i=await pr(e,t,n);if(r<$&&sr.has(i)){await cr(2**r*1e3),n?.(0);continue}if(i<200||i>=300)throw new Q(`export_failed`,`Bundle upload failed (HTTP ${i}).`);return}}function pr(e,t,n){return new Promise((r,i)=>{let a=new XMLHttpRequest;a.open(`PUT`,e),a.setRequestHeader(`Content-Type`,`application/octet-stream`),a.timeout=36e5,n&&(a.upload.onprogress=e=>{e.lengthComputable&&n(e.loaded/e.total)}),a.onload=()=>{n?.(1),r(a.status)},a.onerror=()=>i(new Q(`export_failed`,`Bundle upload failed.`)),a.ontimeout=()=>i(new Q(`export_timed_out`,`Bundle upload timed out.`)),a.send(t)})}async function mr(e,t){for(let n=0;n<=$;n++){let r=await fetch(e,{method:`GET`});if(n<$&&sr.has(r.status)){await cr(2**n*1e3),t?.(0);continue}if(!r.ok)throw new Q(`import_failed`,`Bundle download failed (HTTP ${r.status}).`);return $n(r,t)}throw new Q(`import_failed`,`Unexpected retry loop exit`)}async function hr(e){let{status:t,data:n,error:r}=await lr(()=>q.post({url:`/v1/migrations/import-from-gcs/`,body:{bundle_key:e},throwOnError:!1}));return{status:t,body:n??r??null}}async function gr(e){let{status:t,data:n}=await lr(()=>q.get({url:`/v1/migrations/jobs/{job_id}/`,path:{job_id:e},throwOnError:!1}));if(t!==200)throw new Q(`import_failed`,`Job status check failed (HTTP ${t})`);let r=n??{};return{status:typeof r.status==`string`?r.status:`unknown`,jobId:typeof r.job_id==`string`?r.job_id:null,error:typeof r.error==`string`?r.error:null}}var _r=5e3,vr=36e5,yr=5*6e4,br=30,xr=e=>new Promise(t=>setTimeout(t,e));function Sr(){let e=l(),t=de(),n=Yn(t?.cloud),[r,i]=(0,X.useState)({kind:`idle`}),[a,s]=(0,X.useState)(!1),c=(0,X.useRef)(null),u=(0,X.useRef)(null),d=(0,X.useCallback)(e=>{i({kind:`transferring`,step:e,progress:null})},[]),f=(0,X.useCallback)(e=>{i(t=>t.kind===`transferring`?{...t,progress:e}:t)},[]),p=(0,X.useCallback)(async()=>{if(!(!t||!n)){u.current={id:t.assistantId,kind:Jn(t.cloud)===`managed`?`managed`:`local`,createdFresh:!1};try{if(n===`platform`)await Cr(t,d,f,c);else if(n===`local`)await wr(t,d,f,c);else throw new Q(`unknown`,`Unsupported teleport destination.`);i({kind:`verifying`})}catch(e){i({kind:`failed`,error:`Teleport failed: ${e instanceof Q||e instanceof Error?e.message:`Teleport failed.`}`}),o(e,{context:`teleport-execute`}),await Er(c.current,u.current,`teleport-execute-cleanup`),c.current=null}}},[t,n,d,f]),m=(0,X.useCallback)(()=>s(!0),[]),h=(0,X.useCallback)(()=>s(!1),[]),g=(0,X.useCallback)(()=>{s(!1),p()},[p]),_=(0,X.useCallback)(()=>{c.current=null,u.current=null,i({kind:`idle`})},[]);return{destination:n,phase:r,confirmOpen:a,requestTeleport:m,cancelConfirm:h,confirm:g,confirmAndSwitch:(0,X.useCallback)(()=>{let t=c.current,n=u.current;t&&(async()=>{try{let e=Ae.getState();t.kind===`managed`?await e.connectPlatformAssistant(t.id):(await e.connectLocalAssistant(t.id),Se(t.id,{onError:e=>o(e,{context:`teleport-inject-platform-identity`})}))}catch(e){i({kind:`failed`,error:`Switch failed: ${e instanceof Error?e.message:`Failed to switch assistant.`}`}),o(e,{context:`teleport-confirm-switch`});return}n&&ht(n.id).then(e=>{e.ok||o(Error(e.error),{context:`teleport-retire-source`})}),_(),e(J.assistant,{replace:!0})})()},[e,_]),cancelTeleport:(0,X.useCallback)(()=>{let e=c.current,t=u.current;c.current=null,u.current=null,i({kind:`idle`}),Er(e,t,`teleport-cancel-retire-target`)},[]),reset:_}}async function Cr(e,t,n,r){t(`Exporting assistant data...`);let i=await nr(e,n);t(`Resolving organization...`);let a=await Or();t(`Checking for existing assistant...`);let o=(await Re({query:{hosting:`platform`},throwOnError:!1})).data?.results?.[0];if(o)throw new Q(`existing_platform_assistant`,`You already have a platform assistant '${o.id}'. Retire it first, then retry the teleport.`);t(`Uploading data to cloud...`);let s=await ur(e.resources?.runtimeVersion);await fr(s.url,i,n),t(`Setting up cloud assistant...`);let c=await Be(void 0,`create`);if(!c.ok)throw new Q(`import_failed`,`Failed to set up the cloud assistant.`);if(c.status===200)throw new Q(`existing_platform_assistant`,`You already have a platform assistant '${c.data.id}'. Retire it first, then retry the teleport.`);let l=c.data.id;await K({assistantId:l,name:c.data.name,cloud:`vellum`,runtimeUrl:oe(),hatchedAt:c.data.created??new Date().toISOString(),organizationId:a}),await G(e.assistantId),r.current={id:l,kind:`managed`,createdFresh:!0},t(`Finalizing cloud assistant...`),await kr(l),t(`Importing data to cloud...`);let u=await hr(s.bundleKey);if(u.status<200||u.status>=300){let e=u.body;throw new Q(`import_failed`,e?.error??`Import failed (HTTP ${u.status}).`)}if(u.status===202){let e=u.body?.job_id;if(!e)throw new Q(`import_failed`,`Import accepted but no job ID returned.`);await Ar(e)}else{let e=u.body;if(e&&e.success===!1)throw new Q(`import_failed`,e.error??`Import reported failure.`)}}async function wr(e,t,n,r){t(`Preparing export...`);let i=await ur(await Dr(e.assistantId),`runtime`);t(`Exporting cloud data...`);let a=await ir(e.assistantId,i.url);await jr(e.assistantId,a),t(`Preparing local assistant...`);let{assistant:o,createdFresh:s}=await Mr();r.current={id:o.assistantId,kind:`local`,createdFresh:s};let c=await Tr(o,s);if(!c)throw new Q(`local_assistant_not_found`,`Could not determine the local assistant's runtime version. Restart or upgrade the local assistant, then retry the teleport.`);t(`Preparing import...`);let l=await dr(i.bundleKey,c);t(`Downloading data...`);let u=await mr(l,n);t(`Importing data...`),await Pr(o,u),await G(e.assistantId)}async function Tr(e,t){if(e.resources?.runtimeVersion)return e.resources.runtimeVersion;if(t)return(await Lt())?.version??void 0}async function Er(e,t,n){if(e?.createdFresh){let t=await ht(e.id);t.ok||o(Error(t.error),{context:n})}t&&await G(t.id)}async function Dr(e){let t=await ze(e);return t.ok?t.data.version??void 0:void 0}async function Or(){let e=xe.getState();e.organizations.length===0&&await e.fetchOrganizations();let t=xe.getState().organizations,n=Ce();if(n&&t.some(e=>e.id===n))return n;if(t.length===0)throw new Q(`no_organizations`,`No organizations found for this account.`);if(t.length>1)throw new Q(`multiple_organizations`,`Multiple organizations found — please select one in account settings first.`);let r=t[0].id;return xe.getState().setCurrentOrganizationId(r),r}async function kr(e){let t=Date.now();for(;Date.now()-t<yr;){let{data:t,response:n}=await Ne({path:{id:e},throwOnError:!1});if(n?.ok&&t?.state===`active`)return;await xr(_r)}}async function Ar(e){let t=Date.now();for(;Date.now()-t<vr;){await xr(_r);let t=await gr(e);if(t.status===`complete`)return;if(t.status===`failed`)throw new Q(`import_failed`,t.error??`Import job failed`)}throw new Q(`import_failed`,`Import timed out after 60 minutes.`)}async function jr(e,t){let n=Date.now();for(;Date.now()-n<vr;)if(await xr(_r),await ar(e,t)===`complete`)return;throw new Q(`export_timed_out`,`Export timed out.`)}async function Mr(){let e=await ue(void 0,void 0);if(!e.ok)throw new Q(`local_assistant_not_found`,e.error??`Could not create a local assistant.`);await ae();let t=e.assistantId?pe().find(t=>t.assistantId===e.assistantId):Nr();if(!t)throw new Q(`local_assistant_not_found`,`Could not find or create a local assistant.`);return{assistant:t,createdFresh:!0}}function Nr(){return pe().slice().sort((e,t)=>(t.hatchedAt??``).localeCompare(e.hatchedAt??``))[0]}async function Pr(e,t){let n;for(let r=0;r<br;r++)try{await rr(e,t);return}catch(e){n=e,await xr(1e3)}throw n instanceof Error?n:new Q(`import_failed`,`Import failed.`)}function Fr(){let e=Sr(),{destination:t,phase:n}=e;return t?(0,Z.jsxs)(Y,{title:`Teleport`,subtitle:`Move your assistant to a different hosting environment.`,children:[n.kind===`idle`&&(0,Z.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Z.jsx)(`p`,{className:`text-body-medium-default text-[var(--content-tertiary)]`,children:Zn(t)}),(0,Z.jsx)(c,{variant:`outlined`,className:`self-start`,onClick:e.requestTeleport,children:Xn(t)})]}),n.kind===`transferring`&&(0,Z.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[n.progress==null&&(0,Z.jsx)(w,{className:`h-4 w-4 animate-spin text-[var(--content-tertiary)]`}),(0,Z.jsx)(`span`,{className:`text-body-medium-default text-[var(--content-tertiary)]`,children:n.step})]}),n.progress!=null&&(0,Z.jsx)(L,{value:n.progress,"aria-label":`Teleport progress`,className:`max-w-[240px]`})]}),n.kind===`verifying`&&(0,Z.jsx)(I,{tone:`success`,icon:(0,Z.jsx)(S,{className:`h-4 w-4`}),title:`Transfer complete — verify your new assistant is working.`,actions:(0,Z.jsxs)(`div`,{className:`flex gap-2`,children:[(0,Z.jsx)(c,{variant:`primary`,onClick:e.confirmAndSwitch,children:`Confirm & Switch`}),(0,Z.jsx)(c,{variant:`outlined`,onClick:e.cancelTeleport,children:`Cancel`})]})}),n.kind===`failed`&&(0,Z.jsx)(I,{tone:`error`,title:n.error,actions:(0,Z.jsx)(c,{variant:`outlined`,onClick:e.reset,children:`Try Again`})}),(0,Z.jsx)(W,{open:e.confirmOpen,title:Xn(t),message:`Your data will be copied to the new environment. The current assistant will remain available until you confirm the new one works.`,confirmLabel:`Teleport`,onConfirm:e.confirm,onCancel:e.cancelConfirm})]}):null}function Ir(){let e=Ue.use.velvet(),[t,n]=(0,X.useState)(()=>We({velvetEnabled:e}));return(0,X.useEffect)(()=>{n(We({velvetEnabled:e}))},[e]),(0,X.useEffect)(()=>a(`theme`,()=>{n(We({velvetEnabled:e}))}),[e]),(0,X.useEffect)(()=>{Ke(t)},[t]),(0,Z.jsx)(Y,{title:`Theme`,children:(0,Z.jsx)(`div`,{className:`max-w-[360px]`,children:(0,Z.jsx)(ne,{ariaLabel:`Theme`,value:t,onChange:e=>{n(e),Ge(e),Ke(e)},items:[{value:`system`,label:`System`,icon:(0,Z.jsx)(T,{className:`h-4 w-4`})},{value:`light`,label:`Light`,icon:(0,Z.jsx)(Nt,{className:`h-4 w-4`})},{value:`dark`,label:`Dark`,icon:(0,Z.jsx)(E,{className:`h-4 w-4`})},...e?[{value:`velvet`,label:`Velvet`,icon:(0,Z.jsx)(Et,{className:`h-4 w-4`})}]:[]]})})})}function Lr(){let e=he.use.activeAssistantId(),[t,n]=(0,X.useState)(()=>i(`timezone`,``)),a=(0,X.useRef)(e);(0,X.useEffect)(()=>{a.current=e},[e]);let s=(0,X.useRef)(!1),c=(0,X.useRef)(null),l=(0,X.useRef)(()=>{}),u=e=>{if(s.current){c.current=e;return}let t=a.current;if(!t){c.current=null;return}s.current=!0,c.current=null,q.patch({url:`/v1/assistants/{assistant_id}/config`,path:{assistant_id:t},body:{ui:{userTimezone:e}},throwOnError:!0}).catch(e=>{o(e,{context:`settings-timezone-override`})}).finally(()=>{s.current=!1;let e=c.current;c.current=null,e!==null&&l.current(e)})};return(0,X.useEffect)(()=>{l.current=u}),(0,Z.jsx)(Y,{title:`Timezone`,subtitle:`Used when displaying times and scheduling reminders.`,children:(0,Z.jsx)(Wn,{value:t,onChange:e=>{n(e),r(`timezone`,e),u(e)}})})}function Rr(){let{assistant:e,assistantLoading:t,healthz:n,healthzLoading:r,healthzPolling:i,refetch:a,refetchUntilResized:o}=Vt(),s=Ue.use.multiPlatformAssistant(),c=Ue.use.teleport(),u=lt.use.settingsSleepPolicy(),d=we(),f=l(),p=gt(),m=gt({platformHostedOnly:!0}),h=xt(),g=St({assistantId:e?.id??null,enabled:m===`full`&&h}),_=e?.is_local&&!fe()?null:e,v=de(),y=fe()&&!!e&&!!v&&se(v),b=y,x=y&&!ce();return(0,X.useEffect)(()=>{!e||window.location.hash!==`#storage-resources`||requestAnimationFrame(()=>{document.getElementById(`storage-resources`)?.scrollIntoView({block:`start`})})},[e]),(0,Z.jsxs)(`div`,{className:`space-y-4`,children:[g.status&&g.mode!==`inactive`&&(0,Z.jsx)(At,{status:g.status,mode:g.mode,isAcknowledging:g.isAcknowledging,acknowledgeError:g.acknowledgeError?.message??null,onAcknowledge:()=>void g.acknowledge(),onReviewWorkspaceData:()=>void f(`${J.workspace}?sort=size`),onUpgradeStorage:m===`full`?()=>void f(`${J.settings.billing}?adjust_plan=1`):null}),(0,Z.jsx)(Y,{title:`General`,children:(0,Z.jsx)(Ht,{assistant:_,assistantLoading:t,healthz:n,healthzLoading:r})}),d&&p===`full`&&(0,Z.jsx)(nn,{assistant:h?_:null}),m===`full`&&e&&(0,Z.jsx)(Ln,{assistant:e,healthz:n,healthzLoading:r,healthzPolling:i,refetch:a,refetchUntilResized:o}),m===`disabled`&&(0,Z.jsx)(Y,{id:`storage-resources`,title:`Compute & Resources`,subtitle:`Monitor resource usage and manage your assistant's compute profile.`,children:(0,Z.jsx)(mt,{children:`Log in to the Vellum platform to manage compute resources.`})}),(0,Z.jsx)(Ir,{}),(0,Z.jsx)(pn,{}),me()&&(0,Z.jsx)(yn,{}),c&&me()&&(0,Z.jsx)(Fr,{}),m===`full`&&_&&(0,Z.jsxs)(Y,{title:`Software Updates`,children:[(0,Z.jsx)(dn,{assistantId:_.id,currentVersion:n?.version??_.current_release_version??null,releaseChannel:_.release_channel,onUpgradeComplete:()=>{a()}}),(0,Z.jsx)(jn,{assistantId:_.id,onComplete:()=>{a()}})]}),x&&e&&(0,Z.jsx)(Y,{title:`Software Updates`,children:(0,Z.jsx)(fn,{assistantId:e.id,currentVersion:n?.version??e.current_release_version??null,onUpgradeComplete:()=>{a()}})}),m===`disabled`&&!x&&(0,Z.jsx)(Y,{title:`Software Updates`,children:(0,Z.jsx)(mt,{children:`Log in to the Vellum platform to manage software updates.`})}),(0,Z.jsx)(gn,{}),m===`full`&&_&&u&&(0,Z.jsx)(Y,{title:`Sleep Policy`,subtitle:`Control how long this assistant stays awake when idle.`,children:(0,Z.jsx)(cn,{assistantId:_.id})}),m===`disabled`&&u&&(0,Z.jsx)(Y,{title:`Sleep Policy`,subtitle:`Control how long this assistant stays awake when idle.`,children:(0,Z.jsx)(mt,{children:`Log in to the Vellum platform to manage sleep policy.`})}),(0,Z.jsx)(Lr,{}),(0,Z.jsx)(Tn,{}),s&&(0,Z.jsx)(an,{}),(p===`full`||b)&&_&&(0,Z.jsx)(Y,{variant:`danger`,title:`Retire Assistant`,subtitle:`Permanently retire this assistant and delete all associated data.`,children:(0,Z.jsx)(Rn,{assistantId:_.id})}),p===`disabled`&&!b&&(0,Z.jsx)(Y,{variant:`danger`,title:`Retire Assistant`,subtitle:`Permanently retire this assistant and delete all associated data.`,children:(0,Z.jsx)(mt,{children:`Log in to the Vellum platform to retire this assistant.`})}),(0,Z.jsx)(mn,{})]})}export{Rr as GeneralPage};
|
|
1
|
+
import{o as e}from"./chunk-jRWAZmH_.js";import{a as t,n,o as r,r as i,s as a}from"./device-settings-BBwtGKJb.js";import{t as o}from"./capture-error-Dhiismgm.js";import{t as s}from"./react-DJZBPgpf.js";import{t as c}from"./button-amTXFI-2.js";import{d as l,t as u}from"./chunk-5KNZJZUH-DdS6bb-3.js";import{n as d}from"./QueryClientProvider-DKhXIxGb.js";import{t as f}from"./useQuery-B45lW1Kk.js";import{t as p}from"./useMutation-Lj4VunQV.js";import{t as m}from"./jsx-runtime-CVSDxk6A.js";import{t as h}from"./cn-C36Yvcac.js";import{t as g}from"./createLucideIcon-IRfcSUxS.js";import{t as _}from"./bell-BQLonLMp.js";import{t as v}from"./check-DFNrQERi.js";import{t as y}from"./chevron-down-qD-re7AW.js";import{t as b}from"./chevron-right-DqqmezXC.js";import{t as x}from"./circle-alert-zOqdmf25.js";import{t as S}from"./circle-check-VSiny8yl.js";import{t as C}from"./hard-drive-rDxhoRUm.js";import{t as w}from"./loader-circle-Cz7opInR.js";import{t as T}from"./monitor-DfbL8_59.js";import{t as E}from"./moon-B8qiwjrW.js";import{t as D}from"./refresh-cw-DevIHL7J.js";import{a as O,c as k,o as A,r as j,s as M,t as N}from"./resize-errors-DqIkO0UI.js";import{t as P}from"./sparkles-PGiR5v1g.js";import{t as F}from"./triangle-alert-Z0Gq0IuB.js";import{t as I}from"./notice-DkcNAP8O.js";import{t as L}from"./progress-bar-Ca8gmE3B.js";import{A as R,k as ee,n as z}from"./src-DZbMXyC2.js";import{t as te}from"./tag-CV4v7fRF.js";import{t as B}from"./input-CoUmPnRU.js";import{t as V}from"./toggle-CDfguvUz.js";import{n as ne}from"./stat-square-CTHnQ1jc.js";import{t as H}from"./modal-D5nLWNN9.js";import{n as U}from"./toast-xTp-xwYL.js";import{t as W}from"./confirm-dialog-CSkhRFRk.js";import{t as re}from"./dropdown-ByHOpeOU.js";import{C as G,D as ie,S as K,_ as ae,c as oe,f as se,g as ce,i as le,k as ue,l as de,p as fe,r as pe}from"./local-mode-Bskd5bsT.js";import{t as me}from"./is-electron-y5bNUVyG.js";import{n as he}from"./resolved-assistants-store-DAzPZ1eV.js";import{r as ge,t as _e}from"./semver-DIkpaM51.js";import{n as ve,r as ye,t as be}from"./api-errors-CrWDzVca.js";import{D as xe,S as Se,T as Ce,a as we,b as Te,g as Ee,h as De,k as Oe,l as ke,n as Ae,v as je,y as Me}from"./auth-store-65JKPW7C.js";import{t as q}from"./client.gen-DVfIRXUZ.js";import{C as Ne,H as Pe,M as Fe,T as Ie,X as Le,j as Re}from"./sdk.gen-9Cdt87h5.js";import{a as ze,o as Be}from"./api-Dfrm6N2I.js";import{c as J}from"./routes-BXlWEOF0.js";import{a as Ve,r as He}from"./platform-detection-DGxL0AsS.js";import{t as Ue}from"./client-feature-flag-store-Ri-a_LuI.js";import{n as We,r as Ge,t as Ke}from"./theme-preferences-D1vs2UH8.js";import{A as qe,D as Je,E as Ye,M as Xe,Ot as Ze,T as Qe,Tt as $e,bt as et,c as tt,it as nt,j as rt,k as it,nt as at,v as ot,w as st,wt as ct}from"./react-query.gen-DV9K_z-o.js";import{t as lt}from"./assistant-feature-flag-store-BA3GR2m5.js";import{t as ut}from"./pointer-qy7F2Zff.js";import{t as dt}from"./proxy-Cadlowdl.js";import{t as ft}from"./AnimatePresence-TZWSGjkI.js";import{t as pt}from"./use-reduced-motion-BPBlq9_a.js";import{D as mt,Fn as ht,Gr as gt,Ni as _t,Pi as vt,Pn as yt,Ti as bt,Ur as xt,Vt as St,Wr as Ct,_ as wt,_n as Tt,aa as Et,bn as Dt,br as Ot,h as kt,lt as At,v as jt,vn as Mt,xi as Nt,yi as Pt,yn as Ft}from"./index-B4Qq7TL7.js";import{t as It}from"./use-active-assistant-id-CGeH4Gl6.js";import{t as Y}from"./detail-card-GPqFZVmX.js";import{t as Lt}from"./app-info-BxdEjcok.js";import{t as Rt}from"./environment-store-Bxe2pTvW.js";import{i as zt,n as Bt,r as Vt,t as Ht}from"./assistant-status-panel-CW7lTRBE.js";var Ut=g(`fingerprint-pattern`,[[`path`,{d:`M12 10a2 2 0 0 0-2 2c0 1.02-.1 2.51-.26 4`,key:`1nerag`}],[`path`,{d:`M14 13.12c0 2.38 0 6.38-1 8.88`,key:`o46ks0`}],[`path`,{d:`M17.29 21.02c.12-.6.43-2.3.5-3.02`,key:`ptglia`}],[`path`,{d:`M2 12a10 10 0 0 1 18-6`,key:`ydlgp0`}],[`path`,{d:`M2 16h.01`,key:`1gqxmh`}],[`path`,{d:`M21.8 16c.2-2 .131-5.354 0-6`,key:`drycrb`}],[`path`,{d:`M5 19.5C5.5 18 6 15 6 12a6 6 0 0 1 .34-2`,key:`1tidbn`}],[`path`,{d:`M8.65 22c.21-.66.45-1.32.57-2`,key:`13wd9y`}],[`path`,{d:`M9 6.8a6 6 0 0 1 9 5.2v2`,key:`1fr1j5`}]]),Wt=g(`vibrate`,[[`path`,{d:`m2 8 2 2-2 2 2 2-2 2`,key:`sv1b1`}],[`path`,{d:`m22 8-2 2 2 2-2 2 2 2`,key:`101i4y`}],[`rect`,{width:`8`,height:`14`,x:`8`,y:`5`,rx:`1`,key:`1oyrl4`}]]),X=e(s(),1),Gt=De,Kt=`Please choose a different handle.`;async function qt(e,t){let{data:n,error:r,response:i}=await Fe({path:{id:e},body:{handle:t},throwOnError:!1});if(!i)return{kind:`error`,message:ye(r,void 0,`Failed to save handle.`)??`Failed to save handle.`};if(i.ok&&n)return{kind:`ok`,data:n};if(i.status===409){let{message:e}=Te(r,`handle`,Gt.taken);return{kind:`taken`,message:e}}if(i.status===400){let{code:e,message:t}=Te(r,`handle`,Kt);return{kind:`invalid`,code:e,message:t}}return{kind:`error`,message:ye(r,i,`Failed to save handle.`)}}async function Jt(e,t,n){let{data:r,error:i,response:a}=await Ne({path:{assistant_id:e},query:{handle:t},signal:n,throwOnError:!1});if(ve(a,i,`Failed to check handle availability.`),!a.ok||!r)throw new be(a.status,a.status===429?`Too many checks — try again in a moment.`:ye(i,a,`Failed to check handle availability.`));return{available:r.available,code:r.code??null,message:r.message??null}}function Yt(e){return/\d{2,}$/.test(e)}var Z=m(),Xt=300,Zt=1400;function Qt({initialHandle:e,inputLabel:t,helperText:n,idleHelperText:r,checkAvailable:i,save:a,onSaved:o,saveSuccessToast:s,fieldId:l}){let[u,d]=(0,X.useState)(e),[f,p]=(0,X.useState)(null),[m,h]=(0,X.useState)(!1),[g,_]=(0,X.useState)(`idle`),[y,b]=(0,X.useState)(null),S=pt(),C=(0,X.useRef)(null),T=(0,X.useMemo)(()=>u.trim().toLowerCase(),[u]),E=T===e.toLowerCase();(0,X.useEffect)(()=>{if(E||T.length===0){h(!1),C.current?.abort();return}let e=new AbortController;C.current?.abort(),C.current=e,h(!0);let t=window.setTimeout(async()=>{try{let t=await i(T,e.signal);e.signal.aborted||p(t)}catch(t){e.signal.aborted||b(t instanceof Error?t.message:`Couldn't check availability.`)}finally{e.signal.aborted||h(!1)}},Xt);return()=>{window.clearTimeout(t),e.abort()}},[T,E,i]);let D=(()=>{if(y)return y;if(f&&!f.available){let e=f.code;return f.message??(e?Gt[e]:`Please choose a different handle.`)}return null})(),O=D?n:E?r??null:m?`Checking availability…`:f?.available?`Available.`:null,k=!E&&!m&&f?.available!==!1&&g!==`saving`,A=(0,X.useCallback)(async()=>{if(!k)return;_(`saving`),b(null);let e=await a(T);if(e.kind===`ok`){_(`saved`),o(e.data),U.success(s),window.setTimeout(()=>_(`idle`),Zt);return}if(e.kind===`taken`){_(`idle`),p({available:!1,code:`taken`,message:e.message});return}if(e.kind===`invalid`){_(`idle`),p({available:!1,code:e.code,message:e.message});return}_(`error`),b(e.message),U.error(e.message)},[k,T,o,a,s]),j=(()=>{if(E&&u.length>0||u.length===0)return null;let e=m?`checking`:f?.available?`available`:f?.available===!1?`invalid`:null;return e?(0,Z.jsx)(ft,{mode:`wait`,initial:!1,children:(0,Z.jsxs)(dt.span,{initial:S?!1:{opacity:0,scale:.85},animate:{opacity:1,scale:1},exit:S?void 0:{opacity:0,scale:.85},transition:{duration:.14,ease:`easeOut`},className:`flex items-center`,"aria-hidden":e!==`available`&&e!==`invalid`,children:[e===`checking`&&(0,Z.jsx)(w,{className:`h-4 w-4 animate-spin text-[var(--content-tertiary)]`}),e===`available`&&(0,Z.jsx)(v,{className:`h-4 w-4 text-[var(--system-positive-strong)]`,"aria-label":`Available`}),e===`invalid`&&(0,Z.jsx)(x,{className:`h-4 w-4 text-[var(--system-negative-strong)]`,"aria-label":`Not available`})]},e)}):null})(),M=(()=>{switch(g){case`saving`:return(0,Z.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,Z.jsx)(w,{className:`h-3.5 w-3.5 animate-spin`,"aria-hidden":!0}),`Saving…`]});case`saved`:return(0,Z.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,Z.jsx)(v,{className:`h-3.5 w-3.5`,"aria-hidden":!0}),`Saved`]});default:return`Save`}})();return(0,Z.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,Z.jsx)(B,{label:t,value:u,onChange:e=>{d(e.target.value.replace(/\s+/g,``)),p(null),b(null)},autoCorrect:`off`,autoCapitalize:`none`,spellCheck:!1,maxLength:30,leftIcon:(0,Z.jsx)(`span`,{className:`select-none font-mono text-[var(--content-tertiary)]`,"aria-hidden":!0,children:`@`}),rightIcon:j,errorText:D??void 0,helperText:O??void 0,"aria-invalid":!!D,fullWidth:!0,"data-testid":`${l}-input`}),(!E||g!==`idle`)&&(0,Z.jsx)(`div`,{className:`flex justify-end`,children:(0,Z.jsx)(c,{variant:`primary`,size:`compact`,onClick:A,disabled:!k,"aria-live":`polite`,"data-testid":`${l}-save`,children:M})})]})}function $t({initial:e,onSaved:t}){let n=Ae.use.refreshSession(),r=Yt(e.username)?`Your handle was auto-generated at signup — pick one you like.`:void 0,i=(0,X.useCallback)(async e=>await Me({username:e}),[]),a=(0,X.useCallback)((e,t)=>Ee(e,t),[]),o=(0,X.useCallback)(e=>{t(e),n()},[t,n]);return(0,Z.jsx)(Qt,{initialHandle:e.username,inputLabel:`User handle`,helperText:`Lowercase letters, digits, hyphens, and underscores. 3–30 characters.`,idleHelperText:r,checkAvailable:a,save:i,onSaved:o,saveSuccessToast:`Profile updated.`,fieldId:`user-handle`})}function en({assistant:e,onSaved:t}){let n=e.handle??``,r=f({...tt({path:{assistant_id:e.id}})}).data?.results?.[0],i=!!r&&r.subdomain.toLowerCase()===n.toLowerCase(),a=n.length===0?`Your assistant doesn't have a handle yet — claim one to make it mentionable.`:void 0,o=(0,X.useCallback)(async t=>await qt(e.id,t),[e.id]),s=(0,X.useCallback)((t,n)=>Jt(e.id,t,n),[e.id]);return i?(0,Z.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Z.jsx)(B,{label:`Assistant handle`,value:n,readOnly:!0,disabled:!0,leftIcon:(0,Z.jsx)(`span`,{className:`select-none font-mono text-[var(--content-tertiary)]`,"aria-hidden":!0,children:`@`}),fullWidth:!0,"data-testid":`assistant-handle-input`}),(0,Z.jsxs)(`p`,{className:`text-body-small-default text-[var(--content-tertiary)]`,children:[`Your assistant's handle is locked because it's used as its email subdomain. To change it,`,` `,(0,Z.jsx)(u,{to:`${J.settings.ai}?release=1#email`,className:`text-[var(--content-link)] underline hover:text-[var(--content-link-hover)]`,children:`release the subdomain`}),` `,`first.`]})]}):(0,Z.jsx)(Qt,{initialHandle:n,inputLabel:`Assistant handle`,helperText:`Lowercase letters, digits, hyphens, and underscores. 3–30 characters.`,idleHelperText:a,checkAvailable:s,save:o,onSaved:t,saveSuccessToast:`Assistant handle updated.`,fieldId:`assistant-handle`})}function tn(){return(0,Z.jsxs)(`div`,{className:`flex flex-col gap-4`,"aria-busy":!0,"aria-live":`polite`,children:[(0,Z.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Z.jsx)(`div`,{className:`h-3 w-16 animate-pulse rounded bg-[var(--surface-muted)]`}),(0,Z.jsx)(`div`,{className:`h-9 w-full animate-pulse rounded-md bg-[var(--surface-muted)]`}),(0,Z.jsx)(`div`,{className:`h-3 w-72 animate-pulse rounded bg-[var(--surface-muted)]`})]}),(0,Z.jsx)(`div`,{className:`h-9 w-full animate-pulse rounded-md bg-[var(--surface-muted)]`}),(0,Z.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,Z.jsx)(`div`,{className:`h-3 w-60 animate-pulse rounded bg-[var(--surface-muted)]`}),(0,Z.jsx)(`div`,{className:`h-7 w-16 animate-pulse rounded-md bg-[var(--surface-muted)]`})]}),(0,Z.jsx)(`span`,{className:`sr-only`,children:`Loading your profile…`})]})}function nn({assistant:e}={}){let[t,n]=(0,X.useState)(null),[r,i]=(0,X.useState)(null),a=pt(),[o,s]=(0,X.useState)(e??null);return(0,X.useEffect)(()=>{s(e??null)},[e]),(0,X.useEffect)(()=>{let e=!1;return je().then(t=>{e||n(t)}).catch(t=>{e||i(t instanceof Error?t.message:`Failed to load profile.`)}),()=>{e=!0}},[]),(0,Z.jsx)(Y,{title:`Profile`,subtitle:`Manage your user and assistant public handles.`,children:r?(0,Z.jsx)(`p`,{className:`text-body-small-default text-[var(--system-negative-strong)]`,children:r}):t?(0,Z.jsxs)(dt.div,{initial:a?!1:{opacity:0,y:4},animate:{opacity:1,y:0},transition:{duration:.22,ease:`easeOut`},className:`flex flex-col gap-6`,children:[(0,Z.jsx)($t,{initial:t,onSaved:n}),o&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`div`,{className:`border-t border-[var(--border-subtle)]`}),(0,Z.jsx)(en,{assistant:o,onSaved:s})]})]}):(0,Z.jsx)(tn,{})})}var rn=ot({query:{hosting:`platform`}});function an(){let e=It(),t=f(rn),n=t.data?.results??[];return t.isPending||n.length<2?null:(0,Z.jsx)(Y,{title:`Switch Assistant`,subtitle:`Choose which assistant is active for this account.`,children:(0,Z.jsx)(`div`,{className:`space-y-2`,children:n.map(t=>{let n=t.id===e;return(0,Z.jsxs)(`div`,{className:`flex items-center justify-between gap-4 rounded-lg border px-4 py-3 ${n?`border-[var(--border-focus)] bg-[var(--surface-lift)]`:`border-[var(--border-base)] bg-[var(--surface-default)]`}`,children:[(0,Z.jsxs)(`div`,{className:`flex min-w-0 items-center gap-3`,children:[(0,Z.jsx)(T,{className:`h-4 w-4 shrink-0 text-[var(--content-tertiary)]`}),(0,Z.jsx)(`div`,{className:`min-w-0`,children:(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(`span`,{className:`truncate text-body-medium-default text-[var(--content-default)]`,children:t.name||`Unnamed`}),t.status!==`active`&&(0,Z.jsx)(te,{tone:`warning`,children:t.status})]})})]}),(0,Z.jsx)(`div`,{className:`shrink-0`,children:n?(0,Z.jsxs)(`span`,{className:`flex items-center gap-1.5 text-body-small-default text-[var(--system-positive-default)]`,children:[(0,Z.jsx)(v,{className:`h-4 w-4`}),`Active`]}):(0,Z.jsx)(c,{variant:`outlined`,size:`compact`,disabled:t.status!==`active`,onClick:()=>{Oe(t.id),U.success(`Switched active assistant.`)},children:`Switch`})})]},t.id)})})})}var on=[{label:`Never`,seconds:0},{label:`5 min`,seconds:300,devOnly:!0},{label:`10 min`,seconds:600,devOnly:!0},{label:`1 hour`,seconds:3600},{label:`3 hours`,seconds:10800},{label:`1 day`,seconds:86400},{label:`3 days`,seconds:259200},{label:`7 days`,seconds:604800},{label:`14 days`,seconds:1209600},{label:`30 days`,seconds:2592e3}];function sn(e){if(e===0)return`Never (sleep disabled)`;let t=Math.floor(e/86400),n=Math.floor(e%86400/3600);if(t>0&&n>0)return`${t}d ${n}h`;if(t>0)return`${t} day${t===1?``:`s`}`;if(n>0)return`${n} hour${n===1?``:`s`}`;let r=Math.floor(e/60);return r>0?`${r} minute${r===1?``:`s`}`:`${e}s`}function cn({assistantId:e}){let t=d(),n=Rt.use.isNonProduction(),r=(0,X.useMemo)(()=>on.filter(e=>!e.devOnly||n),[n]),{data:i,isLoading:a,isError:o}=f(rt({path:{id:e}})),s=(0,X.useMemo)(()=>i?.idle_timeout_seconds??259200,[i]),[l,u]=(0,X.useState)(null),p=l??s,m=l!==null,h=$e({onSuccess:()=>{U.success(`Sleep policy saved.`),u(null),t.invalidateQueries({queryKey:Xe({path:{id:e}})})},onError:()=>{U.error(`Failed to save sleep policy. Please try again.`)}});return a?(0,Z.jsxs)(`div`,{className:`flex items-center gap-2 text-body-medium-lighter text-[var(--content-tertiary)]`,children:[(0,Z.jsx)(w,{className:`h-4 w-4 animate-spin`}),`Loading sleep settings...`]}):o?(0,Z.jsx)(`p`,{className:`text-body-medium-lighter text-[var(--system-negative-strong)]`,children:`Failed to load sleep policy. Refresh the page to try again.`}):(0,Z.jsxs)(`div`,{className:`space-y-4`,children:[(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`label`,{className:`block text-body-medium-default text-[var(--content-default)]`,children:`Idle timeout`}),(0,Z.jsx)(`p`,{className:`text-body-small-default text-[var(--content-tertiary)]`,children:`How long the assistant can be idle before it is put to sleep. "Never" disables idle sleep entirely.`}),(0,Z.jsx)(`div`,{className:`mt-2 flex flex-wrap gap-2`,children:r.map(e=>(0,Z.jsx)(c,{variant:`outlined`,active:p===e.seconds,onClick:()=>u(e.seconds),children:e.label},e.seconds))}),(0,Z.jsxs)(`p`,{className:`mt-2 text-body-small-default text-[var(--content-tertiary)]`,children:[`Current: `,sn(p)]})]}),m&&(0,Z.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,Z.jsx)(c,{variant:`primary`,leftIcon:h.isPending?(0,Z.jsx)(w,{className:`animate-spin`}):void 0,onClick:()=>h.mutate({path:{id:e},body:{idle_timeout_seconds:p}}),disabled:h.isPending,children:`Save`}),(0,Z.jsx)(c,{variant:`outlined`,onClick:()=>u(null),disabled:h.isPending,children:`Cancel`})]})]})}function ln(e,t,n){let r=[e.version];return e.version===n&&r.push(`(latest)`),t&&e.version===t&&r.push(`(current)`),r.join(` `)}var un=3e3;function dn({assistantId:e,currentVersion:t,releaseChannel:n,onUpgradeComplete:r}){let i=lt.use.rollbackEnabled(),a=Ue.use.previewChannel(),o=d(),s=Mt(n,a),l=s===`preview`,[u,m]=(0,X.useState)(!1),h=(0,X.useRef)(null),[g,_]=(0,X.useState)(null),[v,y]=(0,X.useState)(!1),[b,x]=(0,X.useState)(!1),[S,C]=(0,X.useState)(null),T=e=>e&&h.current&&e===h.current?(queueMicrotask(()=>{C(b?`Successfully rolled back to version ${h.current}.`:`Successfully updated to version ${h.current}.`),m(!1),h.current=null,_(null),U.success(b?`Rollback complete — assistant is healthy.`:`Update complete — assistant is healthy.`,{id:`runtime-upgrade-complete`,tone:`strong`}),r?.()}),!1):un;f({...it({path:{id:e}}),refetchInterval:u?e=>T(e.state.data?.current_release_version):!1});let{data:E,isLoading:O}=f(et({query:{channel:s}})),k=E?.find(e=>e.is_stable!==!1)??E?.[0],A=g??k?.version??null,j=(0,X.useMemo)(()=>{if(!i||!A||!t)return!1;let e=ge(A),n=ge(t);return!e||!n?!1:_e(e,n)<0},[i,A,t]),M=(0,X.useMemo)(()=>{if(!A)return!1;if(!t)return!0;let e=ge(A),n=ge(t);if(!e||!n)return A!==t;let r=_e(e,n);return i?r!==0:r>0},[i,A,t]),N=p({mutationFn:async t=>{let{data:n}=await Le({path:{id:e},body:t,throwOnError:!0});return n}}),P=p({mutationFn:async t=>{let{data:n}=await Pe({path:{id:e},body:t,throwOnError:!0});return n}});return(0,Z.jsxs)(`div`,{className:`space-y-5`,children:[(0,Z.jsxs)(`div`,{className:`flex flex-col gap-4 md:grid md:grid-cols-[auto_minmax(0,1fr)] md:items-center md:gap-x-8 md:gap-y-4`,children:[(0,Z.jsxs)(`div`,{className:`flex flex-col gap-1 md:contents`,children:[(0,Z.jsx)(`span`,{className:`text-body-medium-default text-[var(--content-tertiary)]`,children:`Current`}),(0,Z.jsx)(`span`,{className:`block min-w-0 break-all text-body-medium-lighter text-[var(--content-default)]`,children:t??`—`})]}),(0,Z.jsxs)(`div`,{className:`flex flex-col gap-1 md:contents`,children:[(0,Z.jsx)(`span`,{className:`text-body-medium-default text-[var(--content-tertiary)]`,children:l?`Preview release`:M?j?`Rollback to`:`Update to`:`Selected`}),(0,Z.jsx)(`span`,{className:`block min-w-0`,children:O?(0,Z.jsxs)(`span`,{className:`flex items-center gap-1 text-body-medium-lighter text-[var(--content-tertiary)]`,children:[(0,Z.jsx)(w,{className:`h-3 w-3 animate-spin`}),`Loading...`]}):E&&E.length>0?i?(0,Z.jsx)(re,{value:A??``,onChange:e=>_(e===k?.version?null:e),disabled:u||N.isPending||P.isPending,options:E.map(e=>({value:e.version,label:ln(e,t,k?.version)}))}):(0,Z.jsx)(`span`,{className:`block min-w-0 break-all text-body-medium-lighter text-[var(--content-default)]`,children:k?ln(k,t,k.version):`—`}):`No releases available`})]})]}),(0,Z.jsx)(c,{variant:j?`outlined`:`primary`,className:`min-w-[160px]`,leftIcon:N.isPending||P.isPending||u?(0,Z.jsx)(w,{className:`animate-spin`}):(0,Z.jsx)(D,{}),onClick:()=>y(!0),disabled:!M||N.isPending||P.isPending||u||O||!E?.length,children:u?b?`Rolling back...`:`Updating...`:j?`Rollback`:l?`Update preview`:`Update`}),l&&(0,Z.jsxs)(`p`,{className:`text-body-small-default text-[var(--content-tertiary)]`,children:[`Using Preview releases.`,` `,(0,Z.jsx)(`a`,{href:`#preview-release-channel`,className:`text-[var(--primary-base)] underline-offset-2 hover:underline`,children:`Switch back to Stable`})]}),!M&&t&&A&&!O&&(0,Z.jsx)(`p`,{className:`text-body-medium-lighter text-[var(--system-positive-strong)]`,children:S??`You are already on this version.`}),(0,Z.jsx)(W,{open:v,title:j?`Rollback assistant`:l?`Update preview release`:`Update assistant`,message:j?`Rollback to version ${A??`unknown`}? The assistant will be briefly unavailable.`:l?`Update to preview version ${A??`latest`}? The assistant will be briefly unavailable during the update.`:`Update to version ${A??`latest`}? The assistant will be briefly unavailable during the update.`,confirmLabel:j?`Rollback`:l?`Update preview`:`Update`,onConfirm:async()=>{y(!1),C(null);let t=g??void 0;try{if(j){let e=await P.mutateAsync({version:t});h.current=e.version??t??null,U.success(e.detail||`Rollback to ${t} initiated.`)}else{let e=await N.mutateAsync({version:t});if(e.detail?.includes(`Already on the latest`)){U.warning(e.detail);return}h.current=e.version??t??null,U.success(e.detail||`Update to ${e.version??t??`latest`} initiated.`)}x(j),m(!0),o.invalidateQueries({queryKey:qe({path:{id:e}})})}catch{U.error(j?`Failed to trigger rollback. Please try again.`:`Failed to trigger update. Please try again.`)}},onCancel:()=>y(!1)})]})}function fn({assistantId:e,currentVersion:t,onUpgradeComplete:n}){let[r,i]=(0,X.useState)(!1),[a,o]=(0,X.useState)(null),{data:s,isLoading:l}=f(et({query:{stable:!0,limit:100}})),u=(0,X.useMemo)(()=>Tt(s),[s]),d=u?.version,p=t?Ft(t,d):!!d,m=Dt({assistantId:e,targetVersion:d});return(0,Z.jsxs)(`div`,{className:`space-y-5`,children:[(0,Z.jsxs)(`div`,{className:`flex flex-col gap-4 md:grid md:grid-cols-[auto_minmax(0,1fr)] md:items-center md:gap-x-8 md:gap-y-4`,children:[(0,Z.jsxs)(`div`,{className:`flex flex-col gap-1 md:contents`,children:[(0,Z.jsx)(`span`,{className:`text-body-medium-default text-[var(--content-tertiary)]`,children:`Current`}),(0,Z.jsx)(`span`,{className:`block min-w-0 break-all text-body-medium-lighter text-[var(--content-default)]`,children:t??`—`})]}),(0,Z.jsxs)(`div`,{className:`flex flex-col gap-1 md:contents`,children:[(0,Z.jsx)(`span`,{className:`text-body-medium-default text-[var(--content-tertiary)]`,children:`Update to`}),(0,Z.jsx)(`span`,{className:`block min-w-0 break-all text-body-medium-lighter text-[var(--content-default)]`,children:l?`Loading...`:d&&u?ln(u,t,d):`No releases available`})]})]}),(0,Z.jsx)(c,{variant:`primary`,className:`min-w-[160px]`,leftIcon:m.isPending?(0,Z.jsx)(w,{className:`animate-spin`}):(0,Z.jsx)(D,{}),onClick:()=>i(!0),disabled:m.isPending||l||!d||!p,children:m.isPending?`Updating...`:d?`Update to ${d}`:`Update`}),a&&(0,Z.jsx)(`p`,{className:`text-body-medium-lighter text-[var(--system-positive-strong)]`,children:a}),!a&&!p&&d&&!l&&(0,Z.jsx)(`p`,{className:`text-body-medium-lighter text-[var(--system-positive-strong)]`,children:`You are already on this version.`}),(0,Z.jsx)(W,{open:r,title:`Update assistant`,message:`Update to version ${d??`latest`}? The assistant will be briefly unavailable during the update.`,confirmLabel:`Update`,onConfirm:async()=>{i(!1),o(null);try{let e=await m.upgrade();o(e.version?`Successfully updated to version ${e.version}.`:`Successfully updated to version ${d??`latest`}.`),U.success(`Update complete — assistant is healthy.`,{id:`runtime-upgrade-complete`,tone:`strong`}),n?.()}catch(e){U.error(e instanceof Error?e.message:`Failed to trigger update. Please try again.`)}},onCancel:()=>i(!1)})]})}function pn(){let e=jt.useValue();if(ut())return null;let t=He()?`Cmd`:`Ctrl`;return(0,Z.jsx)(Y,{title:`Composer`,children:(0,Z.jsx)(V,{checked:e,onChange:jt.save,label:`Send with ${t}+Enter`,helperText:`When enabled, Enter inserts a new line and ${t}+Enter sends.`})})}function mn(){let e=gt({platformHostedOnly:!0}),t=Ct(),n=Ae.use.user()?.id??null,r=Ae.use.logout(),[i,a]=(0,X.useState)(!1),o=Ze({onSuccess:async()=>{U.success(`Account deletion requested. You will be logged out shortly.`),ke(n),await r(),Ot(J.account.login)},onError:()=>{U.error(`Failed to request account deletion. Please try again.`)}}),s=e===`full`&&t;return(0,X.useEffect)(()=>{s&&i&&a(!1)},[s,i]),e===`gated`?null:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(Y,{title:`Delete Account`,subtitle:`Permanently delete your account and all associated data.`,variant:`danger`,children:e===`disabled`?(0,Z.jsx)(mt,{children:`Log in to the Vellum platform to delete your account.`}):(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(c,{variant:`dangerOutline`,onClick:()=>a(!0),disabled:o.isPending||s,className:`self-start`,children:`Delete My Account`}),s&&(0,Z.jsx)(w,{className:`h-4 w-4 animate-spin text-[var(--content-tertiary)]`})]})}),(0,Z.jsx)(W,{open:i,title:`Delete Account`,message:`This will permanently delete your account and all associated data. This action cannot be undone.`,confirmLabel:`Delete Account`,destructive:!0,onConfirm:()=>{if(s){a(!1);return}a(!1),o.mutate({})},onCancel:()=>a(!1)})]})}function hn({title:e,subtitle:t,benefits:n,ctaLabel:r,ctaLeftIcon:i,onAction:a}){return(0,Z.jsx)(Y,{title:e,subtitle:t,children:(0,Z.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,Z.jsx)(`ul`,{className:`space-y-3`,children:n.map(({icon:e,text:t})=>(0,Z.jsxs)(`li`,{className:`flex items-center gap-3`,children:[(0,Z.jsx)(`span`,{className:`flex size-7 shrink-0 items-center justify-center rounded-md`,style:{background:`var(--surface-base)`},children:(0,Z.jsx)(e,{size:14,style:{color:`var(--content-secondary)`},"aria-hidden":!0})}),(0,Z.jsx)(`span`,{className:`text-body-medium-lighter text-[color:var(--content-secondary)]`,children:t})]},t))}),(0,Z.jsx)(c,{variant:`primary`,size:`regular`,leftIcon:i,onClick:a,className:`self-start`,children:r})]})})}function gn(){return Ve()?(0,Z.jsx)(hn,{title:`Get the iOS App`,subtitle:`The Vellum iOS app gives you a native experience.`,benefits:[{icon:_,text:`Push notifications`},{icon:Ut,text:`Biometric login`},{icon:Wt,text:`Native haptics`},{icon:bt,text:`Home screen access`}],ctaLabel:`Download`,ctaLeftIcon:(0,Z.jsx)(bt,{size:16}),onAction:()=>{wt(),kt()}}):null}async function _n(){if(!me())return!1;let e=window.vellum;return e?.launchAtLogin?e.launchAtLogin.get():!1}async function vn(e){if(!me())return;let t=window.vellum;t?.launchAtLogin&&await t.launchAtLogin.set(e)}function yn(){let[e,t]=(0,X.useState)(!1);(0,X.useEffect)(()=>{_n().then(t)},[]);let n=async e=>{t(e);try{await vn(e)}catch{t(!e)}};return(0,Z.jsx)(Y,{title:`Launch at Login`,subtitle:`Automatically start Vellum when you log in to your Mac.`,children:(0,Z.jsx)(V,{checked:e,onChange:e=>void n(e),"aria-label":`Launch at Login`})})}function bn({className:e}){return(0,Z.jsx)(`div`,{role:`presentation`,className:h(`h-px w-full bg-[var(--border-base)]`,e)})}var xn=[`youtube.com`,`youtu.be`,`vimeo.com`,`loom.com`];function Sn(e){try{let t=JSON.parse(e);if(Array.isArray(t))return t.filter(e=>typeof e==`string`)}catch{}return[...xn]}function Cn(){return n(`mediaEmbedsEnabled`,!0)}function wn(){let e=i(`mediaEmbedDomains`,``);return e?Sn(e):[...xn]}function Tn(){let[e,n]=(0,X.useState)(()=>Cn()),[i,a]=(0,X.useState)(()=>wn()),[o,s]=(0,X.useState)(!1),[l,u]=(0,X.useState)(``),d=(0,X.useMemo)(()=>l.trim().toLowerCase(),[l]),f=e=>{n(e),t(`mediaEmbedsEnabled`,e)},p=e=>{a(e),r(`mediaEmbedDomains`,JSON.stringify(e))},m=()=>{if(d){if(i.includes(d)){u(``);return}p([...i,d]),u(``)}},h=e=>{p(i.filter(t=>t!==e))},g=()=>{p([...xn])},_=i.length===xn.length&&i.every((e,t)=>e===xn[t]);return(0,Z.jsxs)(Y,{title:`Media Embeds`,subtitle:`Automatically embed images, videos, and other media shared in chat messages.`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,Z.jsx)(`div`,{className:`text-body-medium-lighter text-[var(--content-default)]`,children:`Auto Media Embeds`}),(0,Z.jsx)(V,{checked:e,onChange:f})]}),e&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`div`,{className:`mt-4`,children:(0,Z.jsx)(bn,{})}),(0,Z.jsxs)(c,{type:`button`,variant:`ghost`,onClick:()=>s(e=>!e),className:`mt-4 w-full justify-between px-3`,"aria-expanded":o,children:[(0,Z.jsxs)(`span`,{className:`flex items-center gap-2`,children:[o?(0,Z.jsx)(y,{className:`h-4 w-4`,"aria-hidden":!0}):(0,Z.jsx)(b,{className:`h-4 w-4`,"aria-hidden":!0}),`Video Domain Allowlist`]}),(0,Z.jsxs)(`span`,{className:`text-body-small-default text-[var(--content-tertiary)]`,children:[i.length,` domain`,i.length===1?``:`s`]})]}),o&&(0,Z.jsxs)(`div`,{className:`mt-3 space-y-3`,children:[(0,Z.jsxs)(`div`,{className:`flex items-end gap-2`,children:[(0,Z.jsx)(B,{label:`Add Domain`,type:`text`,value:l,onChange:e=>u(e.target.value),onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),m())},placeholder:`Add domain (e.g. example.com)`,fullWidth:!0,wrapperClassName:`flex-1`}),(0,Z.jsx)(c,{variant:`primary`,size:`compact`,onClick:m,disabled:!d,children:`Add`})]}),i.length>0&&(0,Z.jsx)(`div`,{className:`flex justify-end`,children:(0,Z.jsx)(c,{type:`button`,variant:`ghost`,size:`compact`,onClick:g,disabled:_,tintColor:`var(--content-tertiary)`,children:`Reset to Defaults`})}),i.length>0&&(0,Z.jsx)(`ul`,{className:`space-y-2`,children:i.map(e=>(0,Z.jsxs)(`li`,{className:`flex items-center justify-between rounded-md border border-[var(--border-base)] px-3 py-2 text-body-medium-lighter`,children:[(0,Z.jsx)(`span`,{className:`font-mono text-[var(--content-default)]`,children:e}),(0,Z.jsx)(c,{variant:`dangerGhost`,size:`compact`,iconOnly:(0,Z.jsx)(Pt,{}),onClick:()=>h(e),"aria-label":`Remove ${e}`})]},e))})]})]})]})}function En(e){return e===`preview`?`preview`:`stable`}function Dn(e){if(!e)return`Unknown`;let t=new Date(e);return Number.isNaN(t.getTime())?`Unknown`:t.toLocaleString(void 0,{year:`numeric`,month:`short`,day:`numeric`,hour:`numeric`,minute:`2-digit`})}function On(e){return e.source_release_version?`Stable ${e.source_release_version}`:e.snapshot_name}function kn(e){return e.filter(e=>e.ready_to_use)}function An(e){return e?.feature_enabled===!1}function jn({assistantId:e,onComplete:t}){let n=Ue.use.previewChannel(),r=d(),[i,a]=(0,X.useState)(),[o,s]=(0,X.useState)(!1),[c,l]=(0,X.useState)(!1),[u,m]=(0,X.useState)(`restore_backup`),[h,g]=(0,X.useState)(``),_=Ye({path:{assistant_id:e}}),v=Je({path:{assistant_id:e}}),b=qe({path:{id:e}}),{data:x,isLoading:S,isError:C}=f({..._,enabled:n,retry:!1}),T=x?.preview_backups??[],E=(0,X.useMemo)(()=>kn(T),[T]),D=E[0],O=E.find(e=>e.snapshot_name===h)??D,k=()=>{r.invalidateQueries({queryKey:v}),r.invalidateQueries({queryKey:b}),t?.()},A=p(st()),j=p(Qe()),M=En(x?.current_channel),N=A.isPending||j.isPending,P=N||An(x)||!x?.latest_preview_release,F=u===`restore_backup`&&!O;if((0,X.useEffect)(()=>{a(M===`preview`?`release-channel`:void 0)},[M]),!n)return null;let L=x?.standard_upgrade_available??!1;return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(z.Root,{type:`single`,collapsible:!0,value:i,onValueChange:e=>a(e||void 0),className:`mt-5 border-t border-[var(--border-base)] pt-5`,children:(0,Z.jsxs)(z.Item,{value:`release-channel`,id:`preview-release-channel`,children:[(0,Z.jsxs)(z.Trigger,{className:`group justify-between gap-3`,children:[(0,Z.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,Z.jsx)(`span`,{className:`text-body-medium-default text-[var(--content-secondary)]`,children:`Release Channel`}),x&&(0,Z.jsx)(te,{tone:M===`preview`?`warning`:`neutral`,children:M===`preview`?`Preview`:`Stable`})]}),(0,Z.jsx)(y,{className:`h-4 w-4 shrink-0 text-[var(--content-tertiary)] transition-transform group-data-[state=open]:rotate-180`})]}),(0,Z.jsx)(z.Content,{children:(0,Z.jsxs)(`div`,{className:`mt-4 space-y-4`,children:[S&&(0,Z.jsxs)(`div`,{className:`flex items-center gap-2 text-body-medium-lighter text-[var(--content-tertiary)]`,children:[(0,Z.jsx)(w,{className:`h-4 w-4 animate-spin`}),`Loading release channel...`]}),C&&(0,Z.jsx)(I,{tone:`error`,title:`Could not load release channel status`,children:`Refresh this page before changing release channels.`}),x&&(0,Z.jsxs)(Z.Fragment,{children:[An(x)&&(0,Z.jsx)(I,{tone:`neutral`,title:`Preview channel is unavailable`,children:`The Preview channel is not enabled for this assistant.`}),M===`stable`?(0,Z.jsx)(Mn,{status:x,isChangingChannel:N,optInDisabled:P,onOptIn:()=>s(!0)}):(0,Z.jsx)(Nn,{status:x,isChangingChannel:N,onOptOut:()=>{let e=D;g(e?.snapshot_name??``),m(e?`restore_backup`:L?`standard_upgrade`:`restore_backup`),l(!0)}})]})]})})]})}),(0,Z.jsx)(Fn,{open:o,isPending:A.isPending,previewVersion:x?.latest_preview_release?.version,onConfirm:async()=>{try{let t=await A.mutateAsync({path:{assistant_id:e}});U.success(t.detail||`Preview channel enabled.`),s(!1),k()}catch(e){U.error(ye(e,void 0,`Could not enable Preview channel.`))}},onCancel:()=>s(!1)}),(0,Z.jsx)(In,{open:c,backups:E,mode:u,selectedSnapshotName:O?.snapshot_name??``,isPending:j.isPending,restoreModeDisabled:F,standardUpgradeAvailable:L,onModeChange:m,onSnapshotChange:g,onConfirm:async()=>{if(!F)try{let t=await j.mutateAsync({path:{assistant_id:e},body:u===`restore_backup`?{mode:`restore_backup`,snapshot_name:O?.snapshot_name}:{mode:`standard_upgrade`}});U.success(t.detail||`Stable channel enabled.`),l(!1),k()}catch(e){U.error(ye(e,void 0,`Could not switch to Stable.`))}},onCancel:()=>l(!1)})]})}function Mn({status:e,isChangingChannel:t,optInDisabled:n,onOptIn:r}){return(0,Z.jsxs)(`div`,{className:`space-y-4`,children:[(0,Z.jsx)(Pn,{status:e}),!e.latest_preview_release&&(0,Z.jsx)(I,{tone:`neutral`,title:`No Preview release is available`,children:`Stable remains the only available release channel.`}),(0,Z.jsx)(c,{variant:`outlined`,leftIcon:t?(0,Z.jsx)(w,{className:`animate-spin`}):(0,Z.jsx)(vt,{}),disabled:n,onClick:r,children:`Opt in to Preview`})]})}function Nn({status:e,isChangingChannel:t,onOptOut:n}){return(0,Z.jsxs)(`div`,{className:`space-y-4`,children:[(0,Z.jsx)(Pn,{status:e}),(0,Z.jsx)(c,{variant:`outlined`,leftIcon:t?(0,Z.jsx)(w,{className:`animate-spin`}):(0,Z.jsx)(_t,{}),disabled:t,onClick:n,children:`Switch back to Stable`})]})}function Pn({status:e}){return(0,Z.jsxs)(`dl`,{className:`grid gap-3 text-body-medium-lighter sm:grid-cols-2`,children:[(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`dt`,{className:`text-[var(--content-tertiary)]`,children:`Latest Stable`}),(0,Z.jsx)(`dd`,{className:`break-all text-[var(--content-default)]`,children:e.latest_stable_release?.version??`None`})]}),(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`dt`,{className:`text-[var(--content-tertiary)]`,children:`Latest Preview`}),(0,Z.jsx)(`dd`,{className:`break-all text-[var(--content-default)]`,children:e.latest_preview_release?.version??`None`})]})]})}function Fn({open:e,isPending:t,previewVersion:n,onConfirm:r,onCancel:i}){return(0,Z.jsx)(H.Root,{open:e,onOpenChange:e=>!e&&i(),children:(0,Z.jsxs)(H.Content,{size:`md`,hideCloseButton:t,children:[(0,Z.jsxs)(H.Header,{children:[(0,Z.jsx)(H.Title,{icon:F,children:`Opt in to Preview`}),(0,Z.jsx)(H.Description,{children:`Preview releases may be unstable. A 90-day safety backup is taken before the image changes.`})]}),(0,Z.jsx)(H.Body,{children:(0,Z.jsxs)(`div`,{className:`space-y-3`,children:[(0,Z.jsx)(I,{tone:`warning`,title:`Data loss may occur when returning to Stable`,children:`Preview data may not be compatible with the Stable channel. The safety backup lets you restore the Stable-channel data that existed before opt-in.`}),(0,Z.jsxs)(`ol`,{className:`list-decimal space-y-2 pl-5 text-body-medium-lighter text-[var(--content-secondary)]`,children:[(0,Z.jsx)(`li`,{children:`Create and verify a Preview safety backup.`}),(0,Z.jsxs)(`li`,{children:[`Switch to Preview image `,n??`latest`,`.`]}),(0,Z.jsx)(`li`,{children:`Run the normal upgrade path and wait for health.`})]})]})}),(0,Z.jsxs)(H.Footer,{children:[(0,Z.jsx)(c,{variant:`outlined`,disabled:t,onClick:i,children:`Cancel`}),(0,Z.jsx)(c,{variant:`primary`,disabled:t,leftIcon:t?(0,Z.jsx)(w,{className:`animate-spin`}):(0,Z.jsx)(vt,{}),onClick:r,children:t?`Switching...`:`Take Backup and Switch`})]})]})})}function In({open:e,backups:t,mode:n,selectedSnapshotName:r,isPending:i,restoreModeDisabled:a,standardUpgradeAvailable:o,onModeChange:s,onSnapshotChange:l,onConfirm:u,onCancel:d}){return(0,Z.jsx)(H.Root,{open:e,onOpenChange:e=>!e&&d(),children:(0,Z.jsxs)(H.Content,{size:`md`,hideCloseButton:i,children:[(0,Z.jsxs)(H.Header,{children:[(0,Z.jsx)(H.Title,{icon:F,children:`Switch back to Stable`}),(0,Z.jsx)(H.Description,{children:`Choose how this assistant should leave the Preview channel.`})]}),(0,Z.jsx)(H.Body,{children:(0,Z.jsxs)(`div`,{className:`space-y-4`,children:[(0,Z.jsxs)(R,{value:n,onValueChange:s,disabled:i,"aria-label":`Stable channel return method`,children:[(0,Z.jsx)(ee,{value:`restore_backup`,disabled:t.length===0,label:`Restore safety backup`,helperText:`Return to the Stable-channel data captured before Preview opt-in.`}),(0,Z.jsx)(ee,{value:`standard_upgrade`,disabled:!o,label:`Switch to Stable without restoring backup`,helperText:o?`Keep the current data and directly switch to the Stable image.`:`Unavailable because the latest Stable release is older than this assistant's Preview release.`})]}),n===`restore_backup`&&t.length>0&&(0,Z.jsxs)(`label`,{className:`flex flex-col gap-1 text-body-medium-default text-[var(--content-secondary)]`,children:[`Safety backup`,(0,Z.jsx)(re,{value:r,onChange:l,disabled:i,options:t.map(e=>({value:e.snapshot_name,label:`${On(e)} - ${Dn(e.created_at)}`}))})]}),n===`restore_backup`&&t.length===0&&!o&&(0,Z.jsx)(I,{tone:`error`,title:`Stable requires a safety backup`,children:`This Preview release is newer than the latest Stable release, so switching directly is blocked. Wait for a newer Stable release, or run Vellum Doctor if the safety backup is missing.`}),n===`standard_upgrade`&&(0,Z.jsx)(I,{tone:`error`,title:`Preview data may not survive this`,children:`Switching directly to the Stable image without restoring the safety backup may cause data loss or leave the assistant unusable if Preview data is incompatible with Stable.`})]})}),(0,Z.jsxs)(H.Footer,{children:[(0,Z.jsx)(c,{variant:`outlined`,disabled:i,onClick:d,children:`Cancel`}),(0,Z.jsx)(c,{variant:n===`standard_upgrade`?`danger`:`primary`,disabled:i||a||n===`standard_upgrade`&&!o,leftIcon:i?(0,Z.jsx)(w,{className:`animate-spin`}):(0,Z.jsx)(D,{}),onClick:u,children:i?`Switching...`:`Switch to Stable`})]})]})})}function Ln({assistant:e,healthz:t,healthzLoading:n,healthzPolling:r,refetch:i,refetchUntilResized:a}){let o=l(),s=f(nt()),d=s.data,p=!e.is_local,m=d?.plan_id===`pro`,h=f({...at(),enabled:m}),g=e.machine_size||`small`,_=O(h.data?.max_machine_tier??null),v=(0,X.useMemo)(()=>A(_,g,(0,Z.jsx)(te,{tone:`positive`,children:`Current`})),[_,g]),y=h.data?.selected_storage_gib??null,[b,x]=(0,X.useState)(!1),S=_.length>0?_[_.length-1]:null,[T,E]=(0,X.useState)(null),F=T??S??g,[L,R]=(0,X.useState)(null),[ee,z]=(0,X.useState)(null),B=ct({onSuccess:(e,n)=>{U.success(`Resize started. Changes will apply shortly.`,{id:`assistant-resize`}),z(null),E(null),x(!1),n.body?.machine_size==null?i():a(t)},onError:e=>{z(N(e,`Failed to resize assistant. Please try again.`))}});if(s.isError&&d==null)return(0,Z.jsx)(Y,{id:`storage-resources`,title:`Compute & Resources`,subtitle:`Monitor resource usage and manage your assistant's compute profile.`,children:(0,Z.jsx)(I,{tone:`error`,children:`Could not load your subscription. Please try again.`})});let V=m&&_.includes(F)&&F!==g?F:null,ne=m&&y!=null&&!0,W=m&&_.length>0&&M(g)<M(_[_.length-1]),G=B.isPending||r,ie=y==null?t?.disk?.totalMb??null:y*1024,K=t?.disk&&ie!=null?{value:t.disk.usedMb,max:ie,caption:`${Bt(t.disk.usedMb)} of ${Bt(ie)}`}:null,ae=t?.cpu?{value:t.cpu.currentPercent,max:100,caption:`${t.cpu.currentPercent.toFixed(1)}%`}:null,oe=t?.memory?{value:t.memory.currentMb,max:t.memory.maxMb,caption:`${Bt(t.memory.currentMb)} of ${Bt(t.memory.maxMb)}`}:null,se=p?m?ne?(0,Z.jsxs)(`button`,{type:`button`,disabled:G,onClick:()=>x(!0),className:`flex items-center gap-1.5 rounded-lg border border-amber-500/30 bg-amber-500/15 px-3 py-1.5 text-body-small-default font-medium text-amber-400 transition-colors hover:bg-amber-500/25 disabled:opacity-50`,children:[(0,Z.jsx)(P,{className:`h-3.5 w-3.5`}),`Increase Storage`]}):(0,Z.jsx)(c,{variant:`ghost`,size:`compact`,disabled:G,onClick:()=>x(!0),children:`Resize`}):(0,Z.jsx)(c,{variant:`ghost`,size:`compact`,onClick:()=>R(`storage`),children:`Resize`}):null,ce=p?m?W?(0,Z.jsxs)(`button`,{type:`button`,disabled:G,onClick:()=>x(!0),className:`flex items-center gap-1.5 rounded-lg border border-amber-500/30 bg-amber-500/15 px-3 py-1.5 text-body-small-default font-medium text-amber-400 transition-colors hover:bg-amber-500/25 disabled:opacity-50`,children:[(0,Z.jsx)(P,{className:`h-3.5 w-3.5`}),`Increase Size`]}):(0,Z.jsx)(c,{variant:`ghost`,size:`compact`,disabled:G,onClick:()=>x(!0),children:`Resize`}):(0,Z.jsx)(c,{variant:`ghost`,size:`compact`,onClick:()=>R(`machine`),children:`Resize`}):null;return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(Y,{id:`storage-resources`,title:`Compute & Resources`,subtitle:`Monitor resource usage and manage your assistant's compute profile.`,compactAccessory:!0,accessory:(0,Z.jsx)(c,{variant:`ghost`,size:`compact`,iconOnly:n||r?(0,Z.jsx)(w,{className:`animate-spin`}):(0,Z.jsx)(D,{}),tooltip:r?`Applying resize…`:`Refresh resource metrics`,"aria-label":`Refresh resource metrics`,disabled:n||r,onClick:()=>void i()}),children:(0,Z.jsxs)(`div`,{className:`grid grid-cols-1 gap-2 sm:grid-cols-[1fr_2fr]`,children:[(0,Z.jsxs)(`div`,{className:`flex flex-col rounded-lg bg-[var(--surface-base)] p-3`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,Z.jsx)(`span`,{className:`text-[var(--content-tertiary)]`,children:(0,Z.jsx)(C,{className:`h-3.5 w-3.5`})}),(0,Z.jsx)(`span`,{className:`text-label-medium-default text-[var(--content-tertiary)]`,children:`Disk`})]}),se]}),(0,Z.jsxs)(`div`,{className:`mt-auto flex flex-col gap-1 pt-3`,children:[(0,Z.jsx)(`span`,{className:`text-label-medium-default text-[var(--content-tertiary)]`,children:`Storage`}),K?(0,Z.jsx)(zt,{value:K.value,max:K.max,caption:K.caption}):n?(0,Z.jsx)(`div`,{className:`flex items-center gap-2 text-[var(--content-tertiary)]`,children:(0,Z.jsx)(w,{className:`h-3 w-3 animate-spin`})}):(0,Z.jsx)(`span`,{className:`text-label-medium-default text-[var(--content-tertiary)]`,children:`Unavailable`})]})]}),(0,Z.jsxs)(`div`,{className:`flex flex-col rounded-lg bg-[var(--surface-base)] p-3`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,Z.jsx)(`span`,{className:`text-[var(--content-tertiary)]`,children:(0,Z.jsx)(k,{className:`h-3.5 w-3.5`})}),(0,Z.jsx)(`span`,{className:`text-label-medium-default text-[var(--content-tertiary)]`,children:`Machine`}),(0,Z.jsx)(te,{tone:`neutral`,children:j[g]})]}),ce]}),(0,Z.jsxs)(`div`,{className:`mt-auto grid grid-cols-2 gap-3 pt-3`,children:[(0,Z.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,Z.jsx)(`span`,{className:`text-label-medium-default text-[var(--content-tertiary)]`,children:`CPU`}),ae?(0,Z.jsx)(zt,{value:ae.value,max:ae.max,caption:ae.caption}):n?(0,Z.jsx)(`div`,{className:`flex items-center gap-2 text-[var(--content-tertiary)]`,children:(0,Z.jsx)(w,{className:`h-3 w-3 animate-spin`})}):(0,Z.jsx)(`span`,{className:`text-label-medium-default text-[var(--content-tertiary)]`,children:`—`})]}),(0,Z.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,Z.jsx)(`span`,{className:`text-label-medium-default text-[var(--content-tertiary)]`,children:`Memory`}),oe?(0,Z.jsx)(zt,{value:oe.value,max:oe.max,caption:oe.caption}):n?(0,Z.jsx)(`div`,{className:`flex items-center gap-2 text-[var(--content-tertiary)]`,children:(0,Z.jsx)(w,{className:`h-3 w-3 animate-spin`})}):(0,Z.jsx)(`span`,{className:`text-label-medium-default text-[var(--content-tertiary)]`,children:`—`})]})]})]})]})}),(0,Z.jsx)(H.Root,{open:L!=null,onOpenChange:e=>{e||R(null)},children:(0,Z.jsxs)(H.Content,{size:`sm`,children:[(0,Z.jsxs)(H.Header,{children:[(0,Z.jsx)(H.Title,{children:`Upgrade to Pro`}),(0,Z.jsx)(H.Description,{children:L===`storage`?`Upgrade to the Pro plan to increase your storage allocation and get more space for your assistant.`:`Upgrade to the Pro plan to unlock larger machine sizes with more CPU and memory for your assistant.`})]}),(0,Z.jsxs)(H.Footer,{children:[(0,Z.jsx)(c,{variant:`ghost`,onClick:()=>R(null),children:`Cancel`}),(0,Z.jsx)(c,{onClick:()=>{R(null),o(`${J.settings.billing}?adjust_plan=1`)},children:`Upgrade`})]})]})}),(0,Z.jsx)(H.Root,{open:b,onOpenChange:e=>{e||(x(!1),E(null),z(null))},children:(0,Z.jsxs)(H.Content,{size:`sm`,children:[(0,Z.jsxs)(H.Header,{children:[(0,Z.jsx)(H.Title,{icon:k,children:`Resize Assistant`}),(0,Z.jsx)(H.Description,{children:`Resize your assistant's compute and storage. Your assistant will briefly restart.`})]}),(0,Z.jsx)(H.Body,{children:(0,Z.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[_.length===0?(0,Z.jsx)(I,{tone:`warning`,children:`No machine tier configured. Visit the community for help.`}):(0,Z.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,Z.jsx)(`span`,{className:`text-label-medium-default text-[var(--content-secondary)]`,children:`Machine Size`}),(0,Z.jsx)(re,{options:v,value:F,onChange:E,"aria-label":`Compute machine size`,"data-testid":`resize-machine-size`})]}),ne?(0,Z.jsx)(I,{tone:`info`,children:`Storage will be expanded to ${y} GiB.`}):(0,Z.jsx)(I,{tone:`neutral`,children:`Storage will not change.`}),ee&&(0,Z.jsx)(I,{tone:`error`,children:ee})]})}),(0,Z.jsxs)(H.Footer,{className:`items-center justify-between`,children:[(0,Z.jsxs)(`span`,{className:`text-label-small-default text-[var(--content-tertiary)]`,children:[`Need more?`,` `,(0,Z.jsx)(u,{to:`${J.settings.billing}?adjust_plan=1`,className:`text-[var(--content-secondary)] underline decoration-[var(--border-element)] underline-offset-2 transition-colors hover:text-[var(--content-default)]`,onClick:()=>x(!1),children:`Upgrade plan`})]}),(0,Z.jsxs)(`div`,{className:`flex gap-2`,children:[(0,Z.jsx)(c,{variant:`ghost`,onClick:()=>{x(!1),E(null),z(null)},children:`Cancel`}),(0,Z.jsx)(c,{disabled:V==null&&!ne||G,leftIcon:G?(0,Z.jsx)(w,{className:`animate-spin`}):void 0,onClick:()=>{z(null);let t={};V!=null&&(t.machine_size=V),ne&&y!=null&&(t.storage_gib=y),B.mutate({path:{id:e.id},body:t})},children:ee?`Retry`:`Apply`})]})]})]})})]})}function Rn({assistantId:e}){let t=l(),[n,r]=(0,X.useState)(!1),[i,a]=(0,X.useState)(!1);return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(c,{variant:`dangerOutline`,onClick:()=>r(!0),className:`shrink-0`,children:`Retire Assistant`}),(0,Z.jsx)(yt,{open:n,isPending:i,onConfirm:async()=>{a(!0);let n=await ht(e);if(n.ok){r(!1),t(n.nextRoute,{replace:!0});return}U.error(n.error),a(!1),r(!1)},onCancel:()=>r(!1)})]})}var zn=`UTC.Africa/Cairo.Africa/Johannesburg.Africa/Lagos.Africa/Nairobi.America/Anchorage.America/Argentina/Buenos_Aires.America/Bogota.America/Chicago.America/Denver.America/Halifax.America/Lima.America/Los_Angeles.America/Mexico_City.America/New_York.America/Phoenix.America/Santiago.America/Sao_Paulo.America/Toronto.America/Vancouver.Asia/Bangkok.Asia/Dubai.Asia/Hong_Kong.Asia/Jakarta.Asia/Jerusalem.Asia/Karachi.Asia/Kolkata.Asia/Kuala_Lumpur.Asia/Manila.Asia/Seoul.Asia/Shanghai.Asia/Singapore.Asia/Taipei.Asia/Tokyo.Australia/Melbourne.Australia/Perth.Australia/Sydney.Europe/Amsterdam.Europe/Athens.Europe/Berlin.Europe/Brussels.Europe/Dublin.Europe/Istanbul.Europe/Lisbon.Europe/London.Europe/Madrid.Europe/Moscow.Europe/Paris.Europe/Rome.Europe/Stockholm.Europe/Vienna.Europe/Warsaw.Europe/Zurich.Pacific/Auckland.Pacific/Honolulu`.split(`.`);function Bn(){let e=Intl;if(typeof e.supportedValuesOf==`function`)try{let t=e.supportedValuesOf(`timeZone`);if(t.length>0)return[...t].sort()}catch{}return[...zn].sort()}function Vn(e){let t=e.split(`/`),n=(t[t.length-1]??e).replace(/_/g,` `),r=t.length>1?(t[0]??``).replace(/_/g,` `):``,i=0,a=``;try{let t=new Intl.DateTimeFormat(`en-US`,{timeZone:e,timeZoneName:`shortOffset`}).formatToParts(new Date).find(e=>e.type===`timeZoneName`)?.value??`GMT`;a=t.startsWith(`GMT`)||t.startsWith(`UTC`)?t:`GMT ${t}`;let n=t.match(/([+-])(\d{1,2})(?::(\d{2}))?/);if(n){let e=n[1]===`-`?-1:1,t=parseInt(n[2]??`0`,10),r=parseInt(n[3]??`0`,10);i=e*(t*60+r)}}catch{return null}return{identifier:e,city:n,region:r,offsetLabel:a,offsetMinutes:i}}function Hn(e){try{return new Intl.DateTimeFormat(`en-US`,{timeZone:e,hour:`numeric`,minute:`2-digit`,hour12:!0}).format(new Date)}catch{return``}}function Un(e){if(!e)return`Not set`;try{let t=new Intl.DateTimeFormat(`en-US`,{timeZone:e,timeZoneName:`long`}).formatToParts(new Date).find(e=>e.type===`timeZoneName`)?.value;if(t)return t}catch{}return e.replace(/_/g,` `)}function Wn({value:e,onChange:t}){let[n,r]=(0,X.useState)(``),[i,a]=(0,X.useState)(``),[o,s]=(0,X.useState)(!1),c=(0,X.useRef)(null),l=(0,X.useRef)(null),u=(0,X.useMemo)(()=>Bn().map(e=>Vn(e)).filter(e=>e!==null),[]);(0,X.useEffect)(()=>{let e=window.setTimeout(()=>{a(n.trim().toLowerCase())},200);return()=>window.clearTimeout(e)},[n]),(0,X.useEffect)(()=>{if(!o)return;let e=e=>{c.current&&!c.current.contains(e.target)&&s(!1)};return document.addEventListener(`mousedown`,e),()=>document.removeEventListener(`mousedown`,e)},[o]);let d=(0,X.useMemo)(()=>i?u.filter(e=>e.city.toLowerCase().includes(i)||e.region.toLowerCase().includes(i)||e.offsetLabel.toLowerCase().includes(i)||e.identifier.toLowerCase().includes(i)):u,[u,i]),f=(0,X.useMemo)(()=>{if(!e)return``;let t=e.split(`/`);return(t[t.length-1]??e).replace(/_/g,` `)},[e]),p=e=>{t(e),r(``),s(!1),l.current?.blur()};return(0,Z.jsxs)(`div`,{ref:c,className:`space-y-3`,children:[(0,Z.jsxs)(`div`,{className:`flex flex-col gap-1.5 md:flex-row md:items-center md:justify-between md:gap-4`,children:[(0,Z.jsx)(`span`,{className:`text-body-medium-lighter text-[var(--content-tertiary)]`,children:`Closest city`}),(0,Z.jsxs)(`div`,{className:`relative w-full md:max-w-[280px]`,children:[(0,Z.jsx)(B,{ref:l,type:`text`,value:n,placeholder:f||`Search city or country...`,onChange:e=>{r(e.target.value),s(!0)},onFocus:()=>s(!0),onKeyDown:e=>{e.key===`Escape`&&(r(``),s(!1),l.current?.blur())},fullWidth:!0}),o&&d.length>0&&(0,Z.jsx)(`div`,{className:`absolute left-0 right-0 top-full z-20 mt-1 max-h-[240px] overflow-y-auto rounded-md border border-[var(--border-base)] bg-[var(--surface-lift)] shadow-lg`,children:d.slice(0,200).map(t=>(0,Z.jsxs)(`button`,{type:`button`,onClick:()=>p(t.identifier),className:`flex w-full cursor-pointer items-center justify-between gap-3 px-3 py-2 text-left text-body-medium-lighter transition-colors ${t.identifier===e?`bg-[var(--surface-active)] text-[var(--content-default)]`:`text-[var(--content-default)] hover:bg-[var(--surface-active)]`}`,children:[(0,Z.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Z.jsx)(`div`,{className:`truncate text-body-medium-default`,children:t.city}),t.region&&(0,Z.jsx)(`div`,{className:`truncate text-body-small-default text-[var(--content-tertiary)]`,children:t.region})]}),(0,Z.jsxs)(`div`,{className:`flex shrink-0 flex-col items-end gap-0.5 text-body-small-default text-[var(--content-tertiary)]`,children:[(0,Z.jsx)(`span`,{children:Hn(t.identifier)}),(0,Z.jsx)(`span`,{children:t.offsetLabel})]})]},t.identifier))})]})]}),(0,Z.jsx)(bn,{}),(0,Z.jsxs)(`div`,{className:`flex items-center justify-between gap-4`,children:[(0,Z.jsx)(`span`,{className:`text-body-medium-lighter text-[var(--content-tertiary)]`,children:`Time zone`}),(0,Z.jsx)(`span`,{className:`text-body-medium-lighter text-[var(--content-default)]`,children:Un(e)})]})]})}var Q=class extends Error{code;constructor(e,t){super(t),this.name=`TeleportError`,this.code=e}},Gn=`local`,Kn=`docker`,qn=`vellum`;function Jn(e){switch((e??``).toLowerCase()){case Gn:return`local`;case Kn:return`docker`;case qn:return`managed`;default:return`other`}}function Yn(e){let t=Jn(e);return t===`managed`?`local`:t===`local`?`platform`:null}function Xn(e){switch(e){case`docker`:return`Move to Docker`;case`platform`:return`Move to Cloud (Platform)`;case`local`:return`Move to Local`}}function Zn(e){switch(e){case`docker`:return`Run your assistant in a Docker container on this Mac.`;case`platform`:return`Run your assistant in the cloud, managed by the Vellum platform.`;case`local`:return`Run your assistant locally on this Mac.`}}function Qn(e){if(!e||typeof e!=`object`)return null;let t=e;if(t.reason!==`version_mismatch`)return null;let n=t.bundle_compat,r=t.target_runtime_version;if(!n||typeof n!=`object`||typeof r!=`string`)return null;let i=n,a=i.min_runtime_version;if(typeof a!=`string`)return null;let o=typeof i.max_runtime_version==`string`?i.max_runtime_version:null;return`Cannot import: bundle requires runtime ${o?`${a}–${o}`:`${a}+`}, but this local runtime is ${r}. Update your local runtime before importing.`}async function $n(e,t){let n=Number(e.headers.get(`Content-Length`)??0);if(!e.body||!t||n<=0){let n=await e.arrayBuffer();return t?.(1),n}let r=e.body.getReader(),i=[],a=0;for(;;){let{done:e,value:o}=await r.read();if(e)break;i.push(o),a+=o.length,t(a/n)}let o=new Uint8Array(a),s=0;for(let e of i)o.set(e,s),s+=e.length;return t(1),o.buffer}function er(e){let t=le(e);if(!t)throw new Q(`local_assistant_not_found`,`Assistant ${e.assistantId} has no resolved local gateway.`);return`${window.location.origin}${t}`}async function tr(e,t){let n=await ie(e.assistantId),r=await fetch(`${t}/auth/token`,{method:`POST`,headers:{Authorization:`Bearer ${n}`}});if(!r.ok)throw new Q(`not_signed_in`,`Gateway token request failed (HTTP ${r.status}).`);let{token:i}=await r.json();return i}async function nr(e,t){let n=er(e),r=await tr(e,n),i=await fetch(`${n}/v1/migrations/export`,{method:`POST`,headers:{Authorization:`Bearer ${r}`}});if(!i.ok)throw new Q(`export_failed`,`Export failed (HTTP ${i.status}).`);return $n(i,t)}async function rr(e,t){let n=er(e),r=await tr(e,n),i=await fetch(`${n}/v1/migrations/import`,{method:`POST`,headers:{Authorization:`Bearer ${r}`},body:new Blob([t],{type:`application/octet-stream`})});if(!i.ok)throw new Q(`import_failed`,`Import failed (HTTP ${i.status}).`);let a=await or(i);if(a&&a.success===!1)throw new Q(`import_failed`,a.error??`Import reported failure`)}async function ir(e,t){let{data:n,response:r}=await q.post({url:`/v1/assistants/{assistant_id}/migrations/export-to-gcs/`,path:{assistant_id:e},body:{upload_url:t},throwOnError:!1}),i=r?.status??0;if(!(r?.ok??!1)&&i!==202)throw new Q(`export_failed`,`Export failed (HTTP ${i}).`);let a=n?.job_id;if(!a)throw new Q(`export_failed`,`Export accepted but no job ID was returned.`);return a}async function ar(e,t){let{data:n,response:r}=await q.get({url:`/v1/assistants/{assistant_id}/migrations/jobs/{job_id}`,path:{assistant_id:e,job_id:t},throwOnError:!1}),i=r?.status??0;if(i>=500)return`processing`;if(!(r?.ok??!1))throw new Q(`export_job_failed`,`Job status check failed (HTTP ${i})`);let a=n;if(a?.status===`failed`)throw new Q(`export_job_failed`,a.error??`Export job failed`);return a?.status??`processing`}async function or(e){try{return await e.json()}catch{return null}}var sr=new Set([500,502,503,504]),$=3,cr=e=>new Promise(t=>setTimeout(t,e));async function lr(e,t=new Set){for(let n=0;n<=$;n++){let{response:r,data:i,error:a}=await e(),o=r?.status??0;if(n<$&&sr.has(o)&&!t.has(o)){await cr(2**n*1e3);continue}return{status:o,data:i,error:a}}throw new Q(`unknown`,`Unexpected retry loop exit`)}async function ur(e,t){let n={operation:`upload`};e&&(n.min_runtime_version=e,n.max_runtime_version=null),t&&(n.consumer=t);let{status:r,data:i}=await lr(()=>q.post({url:`/v1/migrations/signed-url/`,body:n,throwOnError:!1}),new Set([404,503]));if(r===503||r===404)throw new Q(`export_failed`,`Signed URL uploads are not available — the platform may not support this feature yet.`);if(r!==201)throw new Q(`export_failed`,`Migration request failed (HTTP ${r}).`);let a=i;return{url:a.url,bundleKey:a.bundle_key,expiresAt:a.expires_at}}async function dr(e,t){let{status:n,data:r,error:i}=await lr(()=>q.post({url:`/v1/migrations/signed-url/`,body:{operation:`download`,bundle_key:e,target_runtime_version:t},throwOnError:!1}),new Set([422]));if(n===422){let e=Qn(i);if(e)throw new Q(`version_mismatch`,e)}if(n!==200&&n!==201)throw new Q(`import_failed`,`Migration request failed (HTTP ${n}).`);return r.url}async function fr(e,t,n){for(let r=0;r<=$;r++){let i=await pr(e,t,n);if(r<$&&sr.has(i)){await cr(2**r*1e3),n?.(0);continue}if(i<200||i>=300)throw new Q(`export_failed`,`Bundle upload failed (HTTP ${i}).`);return}}function pr(e,t,n){return new Promise((r,i)=>{let a=new XMLHttpRequest;a.open(`PUT`,e),a.setRequestHeader(`Content-Type`,`application/octet-stream`),a.timeout=36e5,n&&(a.upload.onprogress=e=>{e.lengthComputable&&n(e.loaded/e.total)}),a.onload=()=>{n?.(1),r(a.status)},a.onerror=()=>i(new Q(`export_failed`,`Bundle upload failed.`)),a.ontimeout=()=>i(new Q(`export_timed_out`,`Bundle upload timed out.`)),a.send(t)})}async function mr(e,t){for(let n=0;n<=$;n++){let r=await fetch(e,{method:`GET`});if(n<$&&sr.has(r.status)){await cr(2**n*1e3),t?.(0);continue}if(!r.ok)throw new Q(`import_failed`,`Bundle download failed (HTTP ${r.status}).`);return $n(r,t)}throw new Q(`import_failed`,`Unexpected retry loop exit`)}async function hr(e){let{status:t,data:n,error:r}=await lr(()=>q.post({url:`/v1/migrations/import-from-gcs/`,body:{bundle_key:e},throwOnError:!1}));return{status:t,body:n??r??null}}async function gr(e){let{status:t,data:n}=await lr(()=>q.get({url:`/v1/migrations/jobs/{job_id}/`,path:{job_id:e},throwOnError:!1}));if(t!==200)throw new Q(`import_failed`,`Job status check failed (HTTP ${t})`);let r=n??{};return{status:typeof r.status==`string`?r.status:`unknown`,jobId:typeof r.job_id==`string`?r.job_id:null,error:typeof r.error==`string`?r.error:null}}var _r=5e3,vr=36e5,yr=5*6e4,br=30,xr=e=>new Promise(t=>setTimeout(t,e));function Sr(){let e=l(),t=de(),n=Yn(t?.cloud),[r,i]=(0,X.useState)({kind:`idle`}),[a,s]=(0,X.useState)(!1),c=(0,X.useRef)(null),u=(0,X.useRef)(null),d=(0,X.useCallback)(e=>{i({kind:`transferring`,step:e,progress:null})},[]),f=(0,X.useCallback)(e=>{i(t=>t.kind===`transferring`?{...t,progress:e}:t)},[]),p=(0,X.useCallback)(async()=>{if(!(!t||!n)){u.current={id:t.assistantId,kind:Jn(t.cloud)===`managed`?`managed`:`local`,createdFresh:!1};try{if(n===`platform`)await Cr(t,d,f,c);else if(n===`local`)await wr(t,d,f,c);else throw new Q(`unknown`,`Unsupported teleport destination.`);i({kind:`verifying`})}catch(e){i({kind:`failed`,error:`Teleport failed: ${e instanceof Q||e instanceof Error?e.message:`Teleport failed.`}`}),o(e,{context:`teleport-execute`}),await Er(c.current,u.current,`teleport-execute-cleanup`),c.current=null}}},[t,n,d,f]),m=(0,X.useCallback)(()=>s(!0),[]),h=(0,X.useCallback)(()=>s(!1),[]),g=(0,X.useCallback)(()=>{s(!1),p()},[p]),_=(0,X.useCallback)(()=>{c.current=null,u.current=null,i({kind:`idle`})},[]);return{destination:n,phase:r,confirmOpen:a,requestTeleport:m,cancelConfirm:h,confirm:g,confirmAndSwitch:(0,X.useCallback)(()=>{let t=c.current,n=u.current;t&&(async()=>{try{let e=Ae.getState();t.kind===`managed`?await e.connectPlatformAssistant(t.id):(await e.connectLocalAssistant(t.id),Se(t.id,{onError:e=>o(e,{context:`teleport-inject-platform-identity`})}))}catch(e){i({kind:`failed`,error:`Switch failed: ${e instanceof Error?e.message:`Failed to switch assistant.`}`}),o(e,{context:`teleport-confirm-switch`});return}n&&ht(n.id).then(e=>{e.ok||o(Error(e.error),{context:`teleport-retire-source`})}),_(),e(J.assistant,{replace:!0})})()},[e,_]),cancelTeleport:(0,X.useCallback)(()=>{let e=c.current,t=u.current;c.current=null,u.current=null,i({kind:`idle`}),Er(e,t,`teleport-cancel-retire-target`)},[]),reset:_}}async function Cr(e,t,n,r){t(`Exporting assistant data...`);let i=await nr(e,n);t(`Resolving organization...`);let a=await Or();t(`Checking for existing assistant...`);let o=(await Ie({query:{hosting:`platform`},throwOnError:!1})).data?.results?.[0];if(o)throw new Q(`existing_platform_assistant`,`You already have a platform assistant '${o.id}'. Retire it first, then retry the teleport.`);t(`Uploading data to cloud...`);let s=await ur(e.resources?.runtimeVersion);await fr(s.url,i,n),t(`Setting up cloud assistant...`);let c=await Be(void 0,`create`);if(!c.ok)throw new Q(`import_failed`,`Failed to set up the cloud assistant.`);if(c.status===200)throw new Q(`existing_platform_assistant`,`You already have a platform assistant '${c.data.id}'. Retire it first, then retry the teleport.`);let l=c.data.id;await K({assistantId:l,name:c.data.name,cloud:`vellum`,runtimeUrl:oe(),hatchedAt:c.data.created??new Date().toISOString(),organizationId:a}),await G(e.assistantId),r.current={id:l,kind:`managed`,createdFresh:!0},t(`Finalizing cloud assistant...`),await kr(l),t(`Importing data to cloud...`);let u=await hr(s.bundleKey);if(u.status<200||u.status>=300){let e=u.body;throw new Q(`import_failed`,e?.error??`Import failed (HTTP ${u.status}).`)}if(u.status===202){let e=u.body?.job_id;if(!e)throw new Q(`import_failed`,`Import accepted but no job ID returned.`);await Ar(e)}else{let e=u.body;if(e&&e.success===!1)throw new Q(`import_failed`,e.error??`Import reported failure.`)}}async function wr(e,t,n,r){t(`Preparing export...`);let i=await ur(await Dr(e.assistantId),`runtime`);t(`Exporting cloud data...`);let a=await ir(e.assistantId,i.url);await jr(e.assistantId,a),t(`Preparing local assistant...`);let{assistant:o,createdFresh:s}=await Mr();r.current={id:o.assistantId,kind:`local`,createdFresh:s};let c=await Tr(o,s);if(!c)throw new Q(`local_assistant_not_found`,`Could not determine the local assistant's runtime version. Restart or upgrade the local assistant, then retry the teleport.`);t(`Preparing import...`);let l=await dr(i.bundleKey,c);t(`Downloading data...`);let u=await mr(l,n);t(`Importing data...`),await Pr(o,u),await G(e.assistantId)}async function Tr(e,t){if(e.resources?.runtimeVersion)return e.resources.runtimeVersion;if(t)return(await Lt())?.version??void 0}async function Er(e,t,n){if(e?.createdFresh){let t=await ht(e.id);t.ok||o(Error(t.error),{context:n})}t&&await G(t.id)}async function Dr(e){let t=await ze(e);return t.ok?t.data.version??void 0:void 0}async function Or(){let e=xe.getState();e.organizations.length===0&&await e.fetchOrganizations();let t=xe.getState().organizations,n=Ce();if(n&&t.some(e=>e.id===n))return n;if(t.length===0)throw new Q(`no_organizations`,`No organizations found for this account.`);if(t.length>1)throw new Q(`multiple_organizations`,`Multiple organizations found — please select one in account settings first.`);let r=t[0].id;return xe.getState().setCurrentOrganizationId(r),r}async function kr(e){let t=Date.now();for(;Date.now()-t<yr;){let{data:t,response:n}=await Re({path:{id:e},throwOnError:!1});if(n?.ok&&t?.state===`active`)return;await xr(_r)}}async function Ar(e){let t=Date.now();for(;Date.now()-t<vr;){await xr(_r);let t=await gr(e);if(t.status===`complete`)return;if(t.status===`failed`)throw new Q(`import_failed`,t.error??`Import job failed`)}throw new Q(`import_failed`,`Import timed out after 60 minutes.`)}async function jr(e,t){let n=Date.now();for(;Date.now()-n<vr;)if(await xr(_r),await ar(e,t)===`complete`)return;throw new Q(`export_timed_out`,`Export timed out.`)}async function Mr(){let e=await ue(void 0,void 0);if(!e.ok)throw new Q(`local_assistant_not_found`,e.error??`Could not create a local assistant.`);await ae();let t=e.assistantId?pe().find(t=>t.assistantId===e.assistantId):Nr();if(!t)throw new Q(`local_assistant_not_found`,`Could not find or create a local assistant.`);return{assistant:t,createdFresh:!0}}function Nr(){return pe().slice().sort((e,t)=>(t.hatchedAt??``).localeCompare(e.hatchedAt??``))[0]}async function Pr(e,t){let n;for(let r=0;r<br;r++)try{await rr(e,t);return}catch(e){n=e,await xr(1e3)}throw n instanceof Error?n:new Q(`import_failed`,`Import failed.`)}function Fr(){let e=Sr(),{destination:t,phase:n}=e;return t?(0,Z.jsxs)(Y,{title:`Teleport`,subtitle:`Move your assistant to a different hosting environment.`,children:[n.kind===`idle`&&(0,Z.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Z.jsx)(`p`,{className:`text-body-medium-default text-[var(--content-tertiary)]`,children:Zn(t)}),(0,Z.jsx)(c,{variant:`outlined`,className:`self-start`,onClick:e.requestTeleport,children:Xn(t)})]}),n.kind===`transferring`&&(0,Z.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[n.progress==null&&(0,Z.jsx)(w,{className:`h-4 w-4 animate-spin text-[var(--content-tertiary)]`}),(0,Z.jsx)(`span`,{className:`text-body-medium-default text-[var(--content-tertiary)]`,children:n.step})]}),n.progress!=null&&(0,Z.jsx)(L,{value:n.progress,"aria-label":`Teleport progress`,className:`max-w-[240px]`})]}),n.kind===`verifying`&&(0,Z.jsx)(I,{tone:`success`,icon:(0,Z.jsx)(S,{className:`h-4 w-4`}),title:`Transfer complete — verify your new assistant is working.`,actions:(0,Z.jsxs)(`div`,{className:`flex gap-2`,children:[(0,Z.jsx)(c,{variant:`primary`,onClick:e.confirmAndSwitch,children:`Confirm & Switch`}),(0,Z.jsx)(c,{variant:`outlined`,onClick:e.cancelTeleport,children:`Cancel`})]})}),n.kind===`failed`&&(0,Z.jsx)(I,{tone:`error`,title:n.error,actions:(0,Z.jsx)(c,{variant:`outlined`,onClick:e.reset,children:`Try Again`})}),(0,Z.jsx)(W,{open:e.confirmOpen,title:Xn(t),message:`Your data will be copied to the new environment. The current assistant will remain available until you confirm the new one works.`,confirmLabel:`Teleport`,onConfirm:e.confirm,onCancel:e.cancelConfirm})]}):null}function Ir(){let e=Ue.use.velvet(),[t,n]=(0,X.useState)(()=>We({velvetEnabled:e}));return(0,X.useEffect)(()=>{n(We({velvetEnabled:e}))},[e]),(0,X.useEffect)(()=>a(`theme`,()=>{n(We({velvetEnabled:e}))}),[e]),(0,X.useEffect)(()=>{Ke(t)},[t]),(0,Z.jsx)(Y,{title:`Theme`,children:(0,Z.jsx)(`div`,{className:`max-w-[360px]`,children:(0,Z.jsx)(ne,{ariaLabel:`Theme`,value:t,onChange:e=>{n(e),Ge(e),Ke(e)},items:[{value:`system`,label:`System`,icon:(0,Z.jsx)(T,{className:`h-4 w-4`})},{value:`light`,label:`Light`,icon:(0,Z.jsx)(Nt,{className:`h-4 w-4`})},{value:`dark`,label:`Dark`,icon:(0,Z.jsx)(E,{className:`h-4 w-4`})},...e?[{value:`velvet`,label:`Velvet`,icon:(0,Z.jsx)(Et,{className:`h-4 w-4`})}]:[]]})})})}function Lr(){let e=he.use.activeAssistantId(),[t,n]=(0,X.useState)(()=>i(`timezone`,``)),a=(0,X.useRef)(e);(0,X.useEffect)(()=>{a.current=e},[e]);let s=(0,X.useRef)(!1),c=(0,X.useRef)(null),l=(0,X.useRef)(()=>{}),u=e=>{if(s.current){c.current=e;return}let t=a.current;if(!t){c.current=null;return}s.current=!0,c.current=null,q.patch({url:`/v1/assistants/{assistant_id}/config`,path:{assistant_id:t},body:{ui:{userTimezone:e}},throwOnError:!0}).catch(e=>{o(e,{context:`settings-timezone-override`})}).finally(()=>{s.current=!1;let e=c.current;c.current=null,e!==null&&l.current(e)})};return(0,X.useEffect)(()=>{l.current=u}),(0,Z.jsx)(Y,{title:`Timezone`,subtitle:`Used when displaying times and scheduling reminders.`,children:(0,Z.jsx)(Wn,{value:t,onChange:e=>{n(e),r(`timezone`,e),u(e)}})})}function Rr(){let{assistant:e,assistantLoading:t,healthz:n,healthzLoading:r,healthzPolling:i,refetch:a,refetchUntilResized:o}=Vt(),s=Ue.use.multiPlatformAssistant(),c=Ue.use.teleport(),u=lt.use.settingsSleepPolicy(),d=we(),f=l(),p=gt(),m=gt({platformHostedOnly:!0}),h=xt(),g=St({assistantId:e?.id??null,enabled:m===`full`&&h}),_=e?.is_local&&!fe()?null:e,v=de(),y=fe()&&!!e&&!!v&&se(v),b=y,x=y&&!ce();return(0,X.useEffect)(()=>{!e||window.location.hash!==`#storage-resources`||requestAnimationFrame(()=>{document.getElementById(`storage-resources`)?.scrollIntoView({block:`start`})})},[e]),(0,Z.jsxs)(`div`,{className:`space-y-4`,children:[g.status&&g.mode!==`inactive`&&(0,Z.jsx)(At,{status:g.status,mode:g.mode,isAcknowledging:g.isAcknowledging,acknowledgeError:g.acknowledgeError?.message??null,onAcknowledge:()=>void g.acknowledge(),onReviewWorkspaceData:()=>void f(`${J.workspace}?sort=size`),onUpgradeStorage:m===`full`?()=>void f(`${J.settings.billing}?adjust_plan=1`):null}),(0,Z.jsx)(Y,{title:`General`,children:(0,Z.jsx)(Ht,{assistant:_,assistantLoading:t,healthz:n,healthzLoading:r})}),d&&p===`full`&&(0,Z.jsx)(nn,{assistant:h?_:null}),m===`full`&&e&&(0,Z.jsx)(Ln,{assistant:e,healthz:n,healthzLoading:r,healthzPolling:i,refetch:a,refetchUntilResized:o}),m===`disabled`&&(0,Z.jsx)(Y,{id:`storage-resources`,title:`Compute & Resources`,subtitle:`Monitor resource usage and manage your assistant's compute profile.`,children:(0,Z.jsx)(mt,{children:`Log in to the Vellum platform to manage compute resources.`})}),(0,Z.jsx)(Ir,{}),(0,Z.jsx)(pn,{}),me()&&(0,Z.jsx)(yn,{}),c&&me()&&(0,Z.jsx)(Fr,{}),m===`full`&&_&&(0,Z.jsxs)(Y,{title:`Software Updates`,children:[(0,Z.jsx)(dn,{assistantId:_.id,currentVersion:n?.version??_.current_release_version??null,releaseChannel:_.release_channel,onUpgradeComplete:()=>{a()}}),(0,Z.jsx)(jn,{assistantId:_.id,onComplete:()=>{a()}})]}),x&&e&&(0,Z.jsx)(Y,{title:`Software Updates`,children:(0,Z.jsx)(fn,{assistantId:e.id,currentVersion:n?.version??e.current_release_version??null,onUpgradeComplete:()=>{a()}})}),m===`disabled`&&!x&&(0,Z.jsx)(Y,{title:`Software Updates`,children:(0,Z.jsx)(mt,{children:`Log in to the Vellum platform to manage software updates.`})}),(0,Z.jsx)(gn,{}),m===`full`&&_&&u&&(0,Z.jsx)(Y,{title:`Sleep Policy`,subtitle:`Control how long this assistant stays awake when idle.`,children:(0,Z.jsx)(cn,{assistantId:_.id})}),m===`disabled`&&u&&(0,Z.jsx)(Y,{title:`Sleep Policy`,subtitle:`Control how long this assistant stays awake when idle.`,children:(0,Z.jsx)(mt,{children:`Log in to the Vellum platform to manage sleep policy.`})}),(0,Z.jsx)(Lr,{}),(0,Z.jsx)(Tn,{}),s&&(0,Z.jsx)(an,{}),(p===`full`||b)&&_&&(0,Z.jsx)(Y,{variant:`danger`,title:`Retire Assistant`,subtitle:`Permanently retire this assistant and delete all associated data.`,children:(0,Z.jsx)(Rn,{assistantId:_.id})}),p===`disabled`&&!b&&(0,Z.jsx)(Y,{variant:`danger`,title:`Retire Assistant`,subtitle:`Permanently retire this assistant and delete all associated data.`,children:(0,Z.jsx)(mt,{children:`Log in to the Vellum platform to retire this assistant.`})}),(0,Z.jsx)(mn,{})]})}export{Rr as GeneralPage};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/esm-
|
|
2
|
-
import{t as e}from"./preload-helper-BewR0kVT.js";import{u as t}from"./native-biometric-
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/esm-ZgeaRH-O.js","assets/preload-helper-BewR0kVT.js","assets/dist-RkT480s0.js","assets/definitions-Dj7uajgZ.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{t as e}from"./preload-helper-BewR0kVT.js";import{u as t}from"./native-biometric-B2cBAQ1U.js";var n=async e=>{if(t())try{await e()}catch{}},r={light:()=>n(async()=>{let{Haptics:t,ImpactStyle:n}=await e(async()=>{let{Haptics:e,ImpactStyle:t}=await import(`./esm-ZgeaRH-O.js`);return{Haptics:e,ImpactStyle:t}},__vite__mapDeps([0,1,2,3]));await t.impact({style:n.Light})}),medium:()=>n(async()=>{let{Haptics:t,ImpactStyle:n}=await e(async()=>{let{Haptics:e,ImpactStyle:t}=await import(`./esm-ZgeaRH-O.js`);return{Haptics:e,ImpactStyle:t}},__vite__mapDeps([0,1,2,3]));await t.impact({style:n.Medium})}),success:()=>n(async()=>{let{Haptics:t,NotificationType:n}=await e(async()=>{let{Haptics:e,NotificationType:t}=await import(`./esm-ZgeaRH-O.js`);return{Haptics:e,NotificationType:t}},__vite__mapDeps([0,1,2,3]));await t.notification({type:n.Success})}),error:()=>n(async()=>{let{Haptics:t,NotificationType:n}=await e(async()=>{let{Haptics:e,NotificationType:t}=await import(`./esm-ZgeaRH-O.js`);return{Haptics:e,NotificationType:t}},__vite__mapDeps([0,1,2,3]));await t.notification({type:n.Error})})};export{r as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{o as e}from"./chunk-jRWAZmH_.js";import{o as t,t as n}from"./capture-error-Dhiismgm.js";import{t as r}from"./react-DJZBPgpf.js";import{t as i}from"./button-amTXFI-2.js";import{d as a,h as o}from"./chunk-5KNZJZUH-DdS6bb-3.js";import{n as s}from"./QueryClientProvider-DKhXIxGb.js";import{t as c}from"./jsx-runtime-CVSDxk6A.js";import{t as l}from"./progress-bar-Ca8gmE3B.js";import{S as u,_ as ee,b as te,c as d,k as ne,p as f,rt as re,v as ie}from"./local-mode-Bskd5bsT.js";import{t as p}from"./is-electron-y5bNUVyG.js";import{n as m}from"./resolved-assistants-store-DAzPZ1eV.js";import{r as ae}from"./api-errors-CrWDzVca.js";import{A as h,B as oe,D as g,L as se,P as _,R as ce,k as v,n as le,z as y}from"./auth-store-
|
|
1
|
+
import{o as e}from"./chunk-jRWAZmH_.js";import{o as t,t as n}from"./capture-error-Dhiismgm.js";import{t as r}from"./react-DJZBPgpf.js";import{t as i}from"./button-amTXFI-2.js";import{d as a,h as o}from"./chunk-5KNZJZUH-DdS6bb-3.js";import{n as s}from"./QueryClientProvider-DKhXIxGb.js";import{t as c}from"./jsx-runtime-CVSDxk6A.js";import{t as l}from"./progress-bar-Ca8gmE3B.js";import{S as u,_ as ee,b as te,c as d,k as ne,p as f,rt as re,v as ie}from"./local-mode-Bskd5bsT.js";import{t as p}from"./is-electron-y5bNUVyG.js";import{n as m}from"./resolved-assistants-store-DAzPZ1eV.js";import{r as ae}from"./api-errors-CrWDzVca.js";import{A as h,B as oe,D as g,L as se,P as _,R as ce,k as v,n as le,z as y}from"./auth-store-65JKPW7C.js";import{a as ue,o as de,r as b}from"./api-Dfrm6N2I.js";import{u as fe}from"./native-biometric-B2cBAQ1U.js";import{c as x}from"./routes-BXlWEOF0.js";import{a as pe,m as me}from"./prefs-DNYLVDvB.js";import{r as S,t as C}from"./build-state-D-aPe0DY.js";import{t as w}from"./avatar-bundled-components-CMIiT9CS.js";import{t as T}from"./avatar-svg-compositor-DQyPgWSC.js";import{fr as E,gr as D,hr as O,on as k}from"./index-B4Qq7TL7.js";import{t as he}from"./provider-key-B-hx1r3c.js";var A=e(r(),1);async function ge(e,t,r){try{await O(e)||await D(e,t),r.invalidateQueries({queryKey:E(e)})}catch(e){n(e,{context:`onboarding_avatar_sync`})}}function j(e){let t=e=>e[Math.floor(Math.random()*e.length)];return{bodyShape:t(e.bodyShapes).id,eyeStyle:t(e.eyeStyles).id,color:t(e.colors).id}}var M=c(),N=3e3,_e=800,P=3e5,F=null,I=null,L=null;function R(){F=null,I=null,L=null}var ve={initializing:0,provisioning:.33,connecting:.66,ready:1},z=1500,ye={initializing:`Getting things ready…`,provisioning:`Setting up your assistant…`,connecting:`Connecting to your assistant…`,ready:`Ready`};function be(e,t,n){if(e>=t)return t;let r=1-(1-Math.min(1,n/z))**3;return e+(t-e)*r}function xe(){let e=S(C(),{kind:`hatch-gate`});return e.action===`redirect`?{kind:`redirect`,to:e.to}:e.action===`wait`?{kind:`wait`}:{kind:`proceed`}}function B(){let e=a(),r=s(),[c]=o(),S=c.get(`hosting`),C=c.get(`fail`),E=p(),D=f()&&S!==null&&S!==`vellum-cloud`,O=le.use.sessionStatus(),z=D?_(O):O,[B]=(0,A.useState)(()=>L??=j(w)),V=(0,A.useMemo)(()=>{let e=T(w,B.bodyShape,B.eyeStyle,B.color,320);return`data:image/svg+xml;charset=utf-8,${encodeURIComponent(e)}`},[B]),[H,U]=(0,A.useState)(`initializing`),[W,G]=(0,A.useState)(null),[Se,K]=(0,A.useState)(!1),[Ce,we]=(0,A.useState)(0),[Te,q]=(0,A.useState)(0),[Ee,J]=(0,A.useState)(0),Y=(0,A.useRef)(H),X=(0,A.useRef)(0),Z=(0,A.useRef)(0),Q=(0,A.useRef)(0),$=(0,A.useCallback)(e=>{X.current=Q.current,Z.current=Date.now(),Y.current=e,U(e),J(e=>e+1)},[]);return(0,A.useEffect)(()=>{if(C!==null){G(`Simulated hatch failure (developer menu → Replay Hatch Failure).`);return}let i=xe();if(i.kind===`redirect`){e(i.to,{replace:!0});return}if(i.kind===`wait`)return;K(!1);let a=!1,o=null,s=null,c=null,l=Date.now(),p,_=!1,w=!1,T=pe(),E=t=>{try{me(``)}catch(e){n(e,{context:`onboarding_mark_completed`})}q(1),Q.current=1,X.current=1,U(`ready`),Y.current=`ready`,s=setTimeout(()=>{a||(R(),(async()=>{if(await h.checkAssistant(),!a){if(fe()){h.markExpectingFirstMessage(),e(`${x.assistant}?onboarding=1`,{replace:!0});return}if(D){let n=new URLSearchParams;S&&n.set(`hosting`,S),t&&n.set(`assistant`,t);let r=n.toString();e(`${x.onboarding.research}${r?`?${r}`:``}`,{replace:!0});return}e(x.onboarding.prechat,{replace:!0})}})())},_e)},O=e=>ge(e,B,r),k=async()=>{if($(`provisioning`),!D){try{let e=await b(),t=y(e);if(!a&&e.ok&&t.kind===`active`){f()&&u({assistantId:e.data.id,name:e.data.name,cloud:`vellum`,runtimeUrl:d(),hatchedAt:new Date().toISOString(),organizationId:g.getState().currentOrganizationId??void 0}),E();return}t.kind===`auto_hatch`&&(w=!0)}catch{}if(a)return}if(D){try{F||=ne(void 0,S===`docker`?`docker`:void 0);let e=await F;if(a)return;if(!e.ok){R(),G(e.error??`Failed to hatch local assistant.`);return}await ee(),e.assistantId&&v(e.assistantId),$(`connecting`);let t=!1;for(;!a&&!t;){if(await te()){re(),await ie(),t=!0;break}if(Date.now()-l>=P){R(),G(`Your assistant is taking longer than expected. Please try again.`);return}await new Promise(e=>{c=setTimeout(e,N)}),c=null}if(a)return;if(e.assistantId)try{await he(e.assistantId)}catch(e){n(e,{context:`onboarding_apply_provider_key`})}e.assistantId&&await le.getState().connectLocalAssistant(e.assistantId),e.assistantId&&(m.getState().upsertFromApi({id:e.assistantId,name:e.assistantId,status:`active`,is_local:!0,created:new Date().toISOString()}),v(e.assistantId),O(e.assistantId)),E(e.assistantId)}catch{if(R(),a)return;G(`Failed to hatch local assistant. Check CLI logs for details.`)}return}try{I||=de(T?{version:T}:void 0);let e=await I;if(I=null,a)return;if(e.ok&&(p=e.data.id),_=e.ok&&e.status===201,!e.ok){if(t(`Onboarding hatch request failed`,{level:`warning`,extra:{status:e.status,error:e.error}}),ce(e.status,e.error)){G(se),K(!0);return}if(!oe(e.status)){G(ae(e.error,void 0,`Failed to start your assistant. Please try again.`));return}}}catch(e){if(I=null,n(e,{context:`onboarding_hatch_assistant`}),a)return}A(0)},A=e=>{a||(o=setTimeout(j,e))},j=async()=>{if(!a){if(Date.now()-l>=P){t(`Onboarding hatch wait exceeded timeout`,{level:`warning`,extra:{maxWaitMs:P}}),G(`Your assistant is taking longer than expected. Please try again.`);return}try{let e=await b(p);if(a||p&&!e.ok&&e.status===404&&(p=void 0,e=await b(),a))return;let t=y(e);if(t.kind===`active`){if(e.ok){let t=e.data.id;for(m.getState().upsertFromApi(e.data),v(t),(_||w)&&O(t),f()&&u({assistantId:t,name:e.data.name,cloud:`vellum`,runtimeUrl:d(),hatchedAt:new Date().toISOString(),organizationId:g.getState().currentOrganizationId??void 0}),$(`connecting`);!a;){try{if((await ue(t)).ok)break}catch{}if(Date.now()-l>=P){G(`Your assistant is taking longer than expected. Please try again.`);return}await new Promise(e=>{o=setTimeout(e,N)}),o=null}if(a)return}E();return}if(t.kind===`error`){G(t.message);return}t.kind!==`auto_hatch`&&Y.current===`provisioning`&&$(`connecting`),A(N)}catch(e){if(n(e,{context:`onboarding_poll_assistant`}),a)return;A(N)}}};return k(),()=>{a=!0,o&&clearTimeout(o),s&&clearTimeout(s),c&&clearTimeout(c)}},[Ce,C,B,z,e,r,$,D]),(0,A.useEffect)(()=>{Z.current===0&&(Z.current=Date.now());let e,t=()=>{let n=Date.now()-Z.current,r=ve[Y.current],i=be(X.current,r,n);Q.current=i,q(i),r-i>1e-6&&(e=requestAnimationFrame(t))};return e=requestAnimationFrame(t),()=>cancelAnimationFrame(e)},[Ee]),W?(0,M.jsx)(k,{children:(0,M.jsxs)(`div`,{role:`alert`,className:`mx-auto flex w-full max-w-xl flex-col items-center ${E?`min-h-full px-8 pt-21 pb-28 electron-prechat-type`:`min-h-screen justify-center px-6 pb-40`} text-center text-[var(--content-default)]`,children:[(0,M.jsx)(`h1`,{className:E?`text-title-large`:`text-3xl font-semibold tracking-tight`,children:`Something went wrong`}),(0,M.jsx)(`p`,{className:`text-body-medium-lighter text-[var(--content-tertiary)] ${E?`mt-3.5`:`mt-4`}`,children:W}),Se&&(0,M.jsxs)(`div`,{className:`mt-6 flex w-full max-w-sm flex-col items-center gap-3`,children:[(0,M.jsx)(`p`,{className:`text-body-medium-default text-[var(--content-default)]`,children:`Get started today with a local assistant`}),(0,M.jsx)(i,{asChild:!0,variant:`primary`,size:`regular`,fullWidth:!0,className:E?void 0:`h-11 text-base`,children:(0,M.jsx)(`a`,{href:`${window.location.origin}/download`,children:`Download the macOS app`})})]}),(0,M.jsx)(`img`,{src:V,alt:``,width:160,height:160,className:`${E?`my-auto py-8`:`my-16`} onboarding-avatar-failed`}),(0,M.jsxs)(`div`,{className:`flex w-full flex-col ${E?`gap-2.5 max-w-[280px]`:`gap-2 max-w-sm`}`,children:[(0,M.jsx)(i,{variant:`primary`,size:`regular`,fullWidth:!0,className:E?void 0:`h-11 text-base`,onClick:()=>{X.current=0,Z.current=Date.now(),Y.current=`initializing`,Q.current=0,U(`initializing`),q(0),J(e=>e+1),G(null),K(!1),we(e=>e+1)},children:`Try again`}),(0,M.jsx)(i,{variant:`outlined`,size:`regular`,fullWidth:!0,className:E?void 0:`h-11 text-base`,onClick:()=>void e(D?x.onboarding.hosting:x.onboarding.privacy,{replace:!0}),children:`Back`})]})]})}):(0,M.jsx)(k,{children:(0,M.jsxs)(`div`,{className:`mx-auto flex w-full max-w-xl flex-col items-center ${E?`min-h-full px-8 pt-21 pb-28 electron-prechat-type`:`min-h-screen justify-center px-6 pb-40`} text-center text-[var(--content-default)]`,children:[(0,M.jsx)(`h1`,{className:E?`text-title-large`:`text-3xl font-semibold tracking-tight`,children:H===`ready`?`Your assistant is ready!`:`Waking up…`}),H!==`ready`&&(0,M.jsx)(`p`,{className:`text-body-medium-lighter text-[var(--content-tertiary)] ${E?`mt-3.5`:`mt-4`}`,children:`Hang tight — your assistant will have a few questions for you once it's up.`}),(0,M.jsx)(`img`,{src:V,alt:``,width:160,height:160,className:`${E?`my-auto py-8`:`my-16`} ${H===`ready`?`onboarding-avatar-awake`:`onboarding-avatar-pulse`}`}),(0,M.jsx)(l,{value:Te,height:6,className:`w-full ${E?`max-w-[200px]`:`max-w-sm`}`,"aria-label":`Assistant startup progress`}),(0,M.jsx)(`p`,{className:`text-[var(--content-tertiary)] ${E?`mt-4 text-label-small-default`:`mt-3 text-body-small-default`}`,children:ye[H]})]})})}export{B as HatchingScreen};
|