@vellumai/web 0.8.12-staging.1 → 0.8.12

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.
Files changed (112) hide show
  1. package/dist/assets/{BundleConfirmPage-jkqaLCJa.js → BundleConfirmPage-YJRCo0Hn.js} +1 -1
  2. package/dist/assets/{account-page-CnPPGmfm.js → account-page-Dj92GjiR.js} +1 -1
  3. package/dist/assets/{add-credits-modal-BxO-aOIt.js → add-credits-modal-CsP4udDc.js} +1 -1
  4. package/dist/assets/{advanced-page-B-9YunGO.js → advanced-page-BCnHb6oY.js} +1 -1
  5. package/dist/assets/{ai-page-Ccq4dwgh.js → ai-page-DcBsmsTv.js} +1 -1
  6. package/dist/assets/ai-utils-NK8I8SN2.js +1 -0
  7. package/dist/assets/{api-OKSSIP8W.js → api-DiLLlhgt.js} +1 -1
  8. package/dist/assets/{api-key-screen-BdonZw0y.js → api-key-screen-Nxq7EclW.js} +1 -1
  9. package/dist/assets/{app-html-cache-D7jkI5-i.js → app-html-cache-DuUq2_RD.js} +1 -1
  10. package/dist/assets/{archive-page-D-lt2ew2.js → archive-page-DGVZ9qUU.js} +1 -1
  11. package/dist/assets/{assistant-status-panel-DXNBZech.js → assistant-status-panel-B-yM7DE5.js} +1 -1
  12. package/dist/assets/{auth-store-BDBEYGBC.js → auth-store-C4gcHOWH.js} +1 -1
  13. package/dist/assets/{avatar-api-DbhDkml8.js → avatar-api-CLSAZR4o.js} +1 -1
  14. package/dist/assets/billing-page-C_pAWHkv.js +3 -0
  15. package/dist/assets/{command-palette-oEhmGGJ_.js → command-palette-CmihDJi0.js} +1 -1
  16. package/dist/assets/{command-palette-window-page-CDLfRYDZ.js → command-palette-window-page-CHxcr6A6.js} +1 -1
  17. package/dist/assets/{community-page-BwBAzLWc.js → community-page-BgwEi2WM.js} +1 -1
  18. package/dist/assets/{connect-page-BmHjyuVm.js → connect-page-DKR1ECD0.js} +1 -1
  19. package/dist/assets/contacts-page-route-ALOLGdXW.js +1 -0
  20. package/dist/assets/{debug-page-DIjs01B3.js → debug-page-DwWy2v03.js} +1 -1
  21. package/dist/assets/{deploy-dialogs-K3jkgI2T.js → deploy-dialogs-DrOvG0Ma.js} +1 -1
  22. package/dist/assets/{developer-page-DFhuZ_hl.js → developer-page-CNY0EBWx.js} +1 -1
  23. package/dist/assets/{devices-page-DdDILkUC.js → devices-page-DyJCd4s2.js} +1 -1
  24. package/dist/assets/{dictation-overlay-page-CxBuw-hP.js → dictation-overlay-page-bAy1yMeW.js} +1 -1
  25. package/dist/assets/{document-viewer-page-Y69T82fT.js → document-viewer-page-B1YXPDXM.js} +1 -1
  26. package/dist/assets/{earn-credits-modal-CYjyqSQ0.js → earn-credits-modal-BVhrVwKQ.js} +1 -1
  27. package/dist/assets/{emails-page-DBN4Tl5W.js → emails-page-xMdxei56.js} +1 -1
  28. package/dist/assets/{general-page-Bp5ucjKX.js → general-page-CzxX_ytO.js} +1 -1
  29. package/dist/assets/{hatching-screen-CzrL6chE.js → hatching-screen-BvaGi8x7.js} +1 -1
  30. package/dist/assets/{home-page-route-CaqhLSrL.js → home-page-route-Bxgs4dcd.js} +1 -1
  31. package/dist/assets/{hosting-screen-WK7sHIGI.js → hosting-screen-Jp346VHw.js} +1 -1
  32. package/dist/assets/{identity-page-route-B3RBccXw.js → identity-page-route-DHz3LOu0.js} +1 -1
  33. package/dist/assets/{index-Ue-r3LET.js → index-87hTkD_v.js} +20 -20
  34. package/dist/assets/inspect-page-B9wa3RHM.js +3 -0
  35. package/dist/assets/{install-DKeB-cXi.js → install-BlwjvAKk.js} +1 -1
  36. package/dist/assets/integrations-page-2soaHaLH.js +1 -0
  37. package/dist/assets/{intelligence-layout-CmazwWMA.js → intelligence-layout-DRGbJocy.js} +1 -1
  38. package/dist/assets/{keyboard-shortcuts-page-jZLFffHe.js → keyboard-shortcuts-page-DqPqhIaF.js} +1 -1
  39. package/dist/assets/{library-detail-page-arp0ms3i.js → library-detail-page-DLekVuPD.js} +1 -1
  40. package/dist/assets/{library-page-B_Um_0PB.js → library-page-DFBGqpq4.js} +1 -1
  41. package/dist/assets/{login-flow-BbNFfr7k.js → login-flow-DmfVD3r_.js} +1 -1
  42. package/dist/assets/{login-page-C1onXPvg.js → login-page-CaI9s3W4.js} +1 -1
  43. package/dist/assets/{logout-page-CZh6Uq_T.js → logout-page-DMO7Ro8q.js} +1 -1
  44. package/dist/assets/{logs-layout-DH3tK8BL.js → logs-layout-XvmAJO6n.js} +1 -1
  45. package/dist/assets/{memory-router-playground-page-BWcZZNFJ.js → memory-router-playground-page-DbSrBXJN.js} +1 -1
  46. package/dist/assets/{mobile-sidebar-drawer-BRnz4Jvz.js → mobile-sidebar-drawer-CBYUCY4b.js} +1 -1
  47. package/dist/assets/{notifications-page-BdpIL_Je.js → notifications-page-BWn1NfeD.js} +1 -1
  48. package/dist/assets/{oauth-complete-page-CYJsWX1G.js → oauth-complete-page-qd6rU5o-.js} +1 -1
  49. package/dist/assets/{oauth-popup-complete-page-B4P5UDKV.js → oauth-popup-complete-page-EU9BzQqV.js} +1 -1
  50. package/dist/assets/{platform-loopback-page-C1Kd436W.js → platform-loopback-page-ZNZz8YUX.js} +1 -1
  51. package/dist/assets/plugin-detail-page-D7tzIKVl.js +1 -0
  52. package/dist/assets/plugins-page-D-kijwJP.js +1 -0
  53. package/dist/assets/{pre-chat-flow-CpevOsrA.js → pre-chat-flow-BSXfD6S0.js} +1 -1
  54. package/dist/assets/{privacy-page-DbFKqGg4.js → privacy-page-BiyTmDHN.js} +1 -1
  55. package/dist/assets/{privacy-screen-CpDWfUis.js → privacy-screen-mhJ5CnV4.js} +1 -1
  56. package/dist/assets/{provider-callback-page-CQuLD5No.js → provider-callback-page-BuPFhW7i.js} +1 -1
  57. package/dist/assets/{provider-key-BYLNbH9o.js → provider-key-Clqsm-h7.js} +1 -1
  58. package/dist/assets/{provider-signup-page-C6xTOqI6.js → provider-signup-page-DhOuxnxY.js} +1 -1
  59. package/dist/assets/{query-tags-D58uls0S.js → query-tags-DPKpdc1_.js} +1 -1
  60. package/dist/assets/react-query.gen-B_oGDSP8.js +1 -0
  61. package/dist/assets/{review-terms-screen-itzeD0QH.js → review-terms-screen-BgLGEzR9.js} +1 -1
  62. package/dist/assets/{schedules-CULDXQU7.js → schedules-Cxb9otxN.js} +1 -1
  63. package/dist/assets/schedules-page-SwCpd9Y6.js +1 -0
  64. package/dist/assets/{sdk.gen-18Tp6Ee_.js → sdk.gen-DgqwY_WN.js} +1 -1
  65. package/dist/assets/{select-assistant-screen-DXbNAlGe.js → select-assistant-screen-CIVt4gg2.js} +1 -1
  66. package/dist/assets/{settings-layout-N_A_6E3u.js → settings-layout-L6c6Zaje.js} +1 -1
  67. package/dist/assets/{share-feedback-modal-B9w8RmIj.js → share-feedback-modal-BlMDGejV.js} +1 -1
  68. package/dist/assets/{sidebar-tree-CivI4sXe.js → sidebar-tree-KVdXcht-.js} +1 -1
  69. package/dist/assets/{signup-page-COvQK9fm.js → signup-page-FdYQKUli.js} +1 -1
  70. package/dist/assets/{skills-page-BoipXRsU.js → skills-page-Cs1mTTpA.js} +1 -1
  71. package/dist/assets/{sounds-page-2GDbwQsL.js → sounds-page-BtPyTbtD.js} +1 -1
  72. package/dist/assets/{step-indicator-dots-BusA89ya.js → step-indicator-dots-C_x0ZHGS.js} +1 -1
  73. package/dist/assets/{subagent-detail-panel-CN_sN89F.js → subagent-detail-panel-C6FfdUDE.js} +1 -1
  74. package/dist/assets/{system-events-page-DJIYOd5W.js → system-events-page-D9gAK-2s.js} +1 -1
  75. package/dist/assets/{tiptap-document-editor-B5IBRg7q.js → tiptap-document-editor-Cl8KJbb0.js} +1 -1
  76. package/dist/assets/{tool-detail-panel-CAZdGcvz.js → tool-detail-panel-DP9ZUGgW.js} +1 -1
  77. package/dist/assets/{trace-page-Db3S2Hsr.js → trace-page-ClDbcKcm.js} +1 -1
  78. package/dist/assets/{upgrade-cancel-page-mjlsJGp8.js → upgrade-cancel-page-BXZOicV3.js} +1 -1
  79. package/dist/assets/{upgrade-success-page-BHISIP3f.js → upgrade-success-page-CeM_gFIj.js} +1 -1
  80. package/dist/assets/{usage-page-BlvccKgv.js → usage-page-DHofU58j.js} +1 -1
  81. package/dist/assets/{use-daemon-config-DBKbFpqu.js → use-daemon-config-BLCgqB8a.js} +1 -1
  82. package/dist/assets/use-is-org-ready-BgB6QXom.js +1 -0
  83. package/dist/assets/{use-oauth-complete-deep-link-listener-Bteh0USx.js → use-oauth-complete-deep-link-listener-DnDBZsXG.js} +1 -1
  84. package/dist/assets/{use-onboarding-login-ByZGkreO.js → use-onboarding-login-CYb9P9G7.js} +1 -1
  85. package/dist/assets/use-plugin-drift-uJRE3xTx.js +1 -0
  86. package/dist/assets/{viewer-store-cX7oqdcL.js → viewer-store-o5byTOZU.js} +1 -1
  87. package/dist/assets/{voice-page-DOpV3VSS.js → voice-page-sB7S0uAp.js} +1 -1
  88. package/dist/assets/{weather-forecast-display-ByPBvVhv.js → weather-forecast-display-C5PORkTk.js} +1 -1
  89. package/dist/assets/{welcome-screen-3d2lXMb8.js → welcome-screen-Rm6Zm5dD.js} +1 -1
  90. package/dist/assets/{workspace-page-JSb7VYXM.js → workspace-page-zV0pbQfl.js} +1 -1
  91. package/dist/index.html +11 -11
  92. package/package.json +1 -1
  93. package/dist/assets/ai-utils-C-JayVoL.js +0 -1
  94. package/dist/assets/billing-page-BJ__Ep9o.js +0 -3
  95. package/dist/assets/contacts-page-route-CcDLyEf6.js +0 -1
  96. package/dist/assets/inspect-page-B3_pcn__.js +0 -3
  97. package/dist/assets/integrations-page-BaDzdFWK.js +0 -1
  98. package/dist/assets/plugin-detail-page-BEjyf-Ux.js +0 -1
  99. package/dist/assets/plugins-page-B6qln-fF.js +0 -1
  100. package/dist/assets/react-query.gen-Bp_whSkG.js +0 -1
  101. package/dist/assets/schedules-page-LaB58sYQ.js +0 -1
  102. package/dist/assets/use-is-org-ready-7bL7PowO.js +0 -1
  103. /package/dist/assets/{avatar-bundled-components-CL39cwfR.js → avatar-bundled-components-D1Q_IPFc.js} +0 -0
  104. /package/dist/assets/{danger-zone-redirect-page-KLttOmNm.js → danger-zone-redirect-page-B7We5zLz.js} +0 -0
  105. /package/dist/assets/{environment-store-BFK2MIjF.js → environment-store-D3R6E-cP.js} +0 -0
  106. /package/dist/assets/{format-CCVadvyp.js → format-Bx7lme44.js} +0 -0
  107. /package/dist/assets/{format-date-Pw0m-fQ8.js → format-date-6MJxjyy6.js} +0 -0
  108. /package/dist/assets/{format-file-size-DRikIrHj.js → format-file-size-DkWrZmJq.js} +0 -0
  109. /package/dist/assets/{llm-dimension-CN3sxcTZ.js → llm-dimension-v8X-KTEz.js} +0 -0
  110. /package/dist/assets/{onboarding-layout-40CHAFT0.js → onboarding-layout-BAx3atHc.js} +0 -0
  111. /package/dist/assets/{system-events-redirect-page-BAb2LAAA.js → system-events-redirect-page-De2HLo0x.js} +0 -0
  112. /package/dist/assets/{usage-window-BZdZL5mo.js → usage-window-DIaL-FoL.js} +0 -0
@@ -1 +1 @@
1
- import{o as e}from"./chunk-jRWAZmH_.js";import{t}from"./react-DJZBPgpf.js";import{t as n}from"./jsx-runtime-CVSDxk6A.js";import{t as r}from"./misc-Dml34IDG.js";import{t as i}from"./format-file-size-DRikIrHj.js";var a=e(t(),1),o=n(),s={verified:{label:`Verified`,className:`bg-[var(--system-positive-weak)] text-[var(--system-positive-strong)]`},signed:{label:`Signed`,className:`bg-[var(--system-info-weak)] text-[var(--system-info-strong)]`},unsigned:{label:`Unsigned`,className:`bg-[var(--surface-active)] text-[var(--content-secondary)]`},tampered:{label:`Tampered — signature invalid`,className:`bg-[var(--system-negative-weak)] text-[var(--system-negative-strong)]`}};function c(){let[e,t]=(0,a.useState)(null),[n,c]=(0,a.useState)(!1);if((0,a.useEffect)(()=>{window.vellum?.bundleConfirm?.getData().then(e=>{e&&t(e)})},[]),!e)return(0,o.jsx)(`div`,{className:`flex h-svh w-screen items-center justify-center bg-background text-muted-foreground select-none`,children:`Loading...`});let{manifest:l,scanResult:u,signatureResult:d,bundleSizeBytes:f}=e,p=s[d.trustTier],m=d.trustTier===`tampered`,h=u.warnings;return(0,o.jsxs)(`div`,{className:`flex h-svh w-screen flex-col bg-background px-6 pt-14 pb-6 text-foreground select-none`,children:[(0,o.jsxs)(`div`,{className:`flex items-start gap-3`,children:[l.icon?(0,o.jsx)(`span`,{className:`text-5xl leading-none`,children:l.icon}):(0,o.jsx)(`span`,{className:`text-5xl leading-none`,children:`📦`}),(0,o.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,o.jsx)(`h1`,{className:`truncate text-lg font-semibold`,children:l.name}),l.description&&(0,o.jsx)(`p`,{className:`text-muted-foreground mt-0.5 text-sm leading-snug`,children:l.description})]})]}),(0,o.jsxs)(`div`,{className:`mt-4 flex items-center gap-2`,children:[(0,o.jsx)(`span`,{className:r(`inline-block rounded-full px-2.5 py-0.5 text-xs font-medium`,p.className),children:p.label}),d.trustTier===`signed`&&d.signerDisplayName&&(0,o.jsxs)(`span`,{className:`text-muted-foreground text-xs`,children:[`by `,d.signerDisplayName]})]}),(0,o.jsxs)(`dl`,{className:`mt-4 grid grid-cols-[auto_1fr] gap-x-3 gap-y-1.5 text-sm`,children:[(0,o.jsx)(`dt`,{className:`text-muted-foreground`,children:`Size`}),(0,o.jsx)(`dd`,{children:i(f)}),(0,o.jsx)(`dt`,{className:`text-muted-foreground`,children:`Created by`}),(0,o.jsx)(`dd`,{className:`truncate`,children:l.created_by}),l.capabilities.length>0&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(`dt`,{className:`text-muted-foreground`,children:`Capabilities`}),(0,o.jsx)(`dd`,{className:`truncate`,children:l.capabilities.join(`, `)})]})]}),h.length>0&&(0,o.jsxs)(`div`,{className:`mt-4`,children:[(0,o.jsxs)(`button`,{type:`button`,className:`text-muted-foreground text-xs font-medium hover:underline`,onClick:()=>c(e=>!e),children:[n?`Hide`:`Show`,` Warnings (`,h.length,`)`]}),n&&(0,o.jsx)(`ul`,{className:`mt-1.5 space-y-1 text-xs`,children:h.map((e,t)=>(0,o.jsx)(`li`,{className:`rounded bg-[var(--system-mid-weak)] px-2 py-1 text-[var(--system-mid-strong)]`,children:e},t))})]}),(0,o.jsxs)(`div`,{className:`mt-auto flex items-center justify-end gap-3 pt-4`,children:[(0,o.jsx)(`button`,{type:`button`,className:`rounded-md border border-border px-4 py-1.5 text-sm font-medium text-foreground hover:bg-muted`,onClick:()=>window.vellum?.bundleConfirm?.respond(!1),children:`Cancel`}),(0,o.jsx)(`button`,{type:`button`,className:r(`rounded-md px-4 py-1.5 text-sm font-medium text-white`,m?`bg-red-600 hover:bg-red-700`:`bg-primary hover:bg-primary/90`),onClick:()=>window.vellum?.bundleConfirm?.respond(!0),children:m?`Install Anyway`:`Install`})]})]})}export{c as BundleConfirmPage};
1
+ import{o as e}from"./chunk-jRWAZmH_.js";import{t}from"./react-DJZBPgpf.js";import{t as n}from"./jsx-runtime-CVSDxk6A.js";import{t as r}from"./misc-Dml34IDG.js";import{t as i}from"./format-file-size-DkWrZmJq.js";var a=e(t(),1),o=n(),s={verified:{label:`Verified`,className:`bg-[var(--system-positive-weak)] text-[var(--system-positive-strong)]`},signed:{label:`Signed`,className:`bg-[var(--system-info-weak)] text-[var(--system-info-strong)]`},unsigned:{label:`Unsigned`,className:`bg-[var(--surface-active)] text-[var(--content-secondary)]`},tampered:{label:`Tampered — signature invalid`,className:`bg-[var(--system-negative-weak)] text-[var(--system-negative-strong)]`}};function c(){let[e,t]=(0,a.useState)(null),[n,c]=(0,a.useState)(!1);if((0,a.useEffect)(()=>{window.vellum?.bundleConfirm?.getData().then(e=>{e&&t(e)})},[]),!e)return(0,o.jsx)(`div`,{className:`flex h-svh w-screen items-center justify-center bg-background text-muted-foreground select-none`,children:`Loading...`});let{manifest:l,scanResult:u,signatureResult:d,bundleSizeBytes:f}=e,p=s[d.trustTier],m=d.trustTier===`tampered`,h=u.warnings;return(0,o.jsxs)(`div`,{className:`flex h-svh w-screen flex-col bg-background px-6 pt-14 pb-6 text-foreground select-none`,children:[(0,o.jsxs)(`div`,{className:`flex items-start gap-3`,children:[l.icon?(0,o.jsx)(`span`,{className:`text-5xl leading-none`,children:l.icon}):(0,o.jsx)(`span`,{className:`text-5xl leading-none`,children:`📦`}),(0,o.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,o.jsx)(`h1`,{className:`truncate text-lg font-semibold`,children:l.name}),l.description&&(0,o.jsx)(`p`,{className:`text-muted-foreground mt-0.5 text-sm leading-snug`,children:l.description})]})]}),(0,o.jsxs)(`div`,{className:`mt-4 flex items-center gap-2`,children:[(0,o.jsx)(`span`,{className:r(`inline-block rounded-full px-2.5 py-0.5 text-xs font-medium`,p.className),children:p.label}),d.trustTier===`signed`&&d.signerDisplayName&&(0,o.jsxs)(`span`,{className:`text-muted-foreground text-xs`,children:[`by `,d.signerDisplayName]})]}),(0,o.jsxs)(`dl`,{className:`mt-4 grid grid-cols-[auto_1fr] gap-x-3 gap-y-1.5 text-sm`,children:[(0,o.jsx)(`dt`,{className:`text-muted-foreground`,children:`Size`}),(0,o.jsx)(`dd`,{children:i(f)}),(0,o.jsx)(`dt`,{className:`text-muted-foreground`,children:`Created by`}),(0,o.jsx)(`dd`,{className:`truncate`,children:l.created_by}),l.capabilities.length>0&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(`dt`,{className:`text-muted-foreground`,children:`Capabilities`}),(0,o.jsx)(`dd`,{className:`truncate`,children:l.capabilities.join(`, `)})]})]}),h.length>0&&(0,o.jsxs)(`div`,{className:`mt-4`,children:[(0,o.jsxs)(`button`,{type:`button`,className:`text-muted-foreground text-xs font-medium hover:underline`,onClick:()=>c(e=>!e),children:[n?`Hide`:`Show`,` Warnings (`,h.length,`)`]}),n&&(0,o.jsx)(`ul`,{className:`mt-1.5 space-y-1 text-xs`,children:h.map((e,t)=>(0,o.jsx)(`li`,{className:`rounded bg-[var(--system-mid-weak)] px-2 py-1 text-[var(--system-mid-strong)]`,children:e},t))})]}),(0,o.jsxs)(`div`,{className:`mt-auto flex items-center justify-end gap-3 pt-4`,children:[(0,o.jsx)(`button`,{type:`button`,className:`rounded-md border border-border px-4 py-1.5 text-sm font-medium text-foreground hover:bg-muted`,onClick:()=>window.vellum?.bundleConfirm?.respond(!1),children:`Cancel`}),(0,o.jsx)(`button`,{type:`button`,className:r(`rounded-md px-4 py-1.5 text-sm font-medium text-white`,m?`bg-red-600 hover:bg-red-700`:`bg-primary hover:bg-primary/90`),onClick:()=>window.vellum?.bundleConfirm?.respond(!0),children:m?`Install Anyway`:`Install`})]})]})}export{c as BundleConfirmPage};
@@ -1 +1 @@
1
- import{o as e}from"./chunk-jRWAZmH_.js";import{t}from"./react-DJZBPgpf.js";import{t as n}from"./chunk-5KNZJZUH-DdS6bb-3.js";import{t as r}from"./jsx-runtime-CVSDxk6A.js";import{E as i,a,i as o,n as s}from"./auth-store-BDBEYGBC.js";import{i as c}from"./routes-VcLWbBmh.js";import{xr as l}from"./index-Ue-r3LET.js";import{r as u,t as d}from"./account-shell-C6-wTQZB.js";import{n as f,t as p}from"./login-flow-BbNFfr7k.js";var m=e(t(),1),h=r();function g(){let e=o(),t=a(),r=s.use.user(),g=s.use.logout(),[_,v]=(0,m.useState)(null),[y,b]=(0,m.useState)(!1),x=async()=>{v(null),b(!0);try{await i(f,p)}catch(e){console.error(`[account] auth flow failed:`,e),v(`Something went wrong. Please try again.`),b(!1)}};return t?(0,h.jsx)(d,{children:(0,h.jsx)(u,{title:`Loading...`})}):e?(0,h.jsxs)(d,{children:[(0,h.jsx)(u,{title:`Welcome${r?.username?`, ${r.username}`:``}!`,subtitle:`You are signed in.`}),(0,h.jsxs)(`div`,{className:`flex flex-col items-center gap-4`,children:[(0,h.jsx)(n,{to:c.assistant,className:`inline-flex w-full items-center justify-center gap-2 rounded-lg bg-[var(--primary-base)] px-6 py-3 text-sm font-medium text-[var(--content-inset)] no-underline transition-colors hover:bg-[var(--primary-hover)]`,children:`Go to your assistant`}),(0,h.jsx)(`button`,{type:`button`,onClick:async()=>{await g(),l(c.account.login)},className:`cursor-pointer bg-transparent text-sm font-normal text-stone-400 transition-colors hover:text-stone-300`,children:`Sign out`})]})]}):(0,h.jsxs)(d,{children:[(0,h.jsx)(u,{title:`Welcome to Vellum`,subtitle:`Sign in to get started.`}),_&&(0,h.jsx)(`p`,{className:`text-center text-sm text-[var(--system-negative-strong)]`,children:_}),(0,h.jsx)(`div`,{className:`flex flex-col items-center gap-4`,children:(0,h.jsx)(`button`,{type:`button`,onClick:()=>void x(),disabled:y,className:`inline-flex w-full cursor-pointer items-center justify-center gap-2 rounded-lg bg-[var(--primary-base)] px-6 py-3 text-sm font-medium text-[var(--content-inset)] transition-colors hover:bg-[var(--primary-hover)] disabled:opacity-50`,children:`Sign in`})})]})}export{g as AccountPage};
1
+ import{o as e}from"./chunk-jRWAZmH_.js";import{t}from"./react-DJZBPgpf.js";import{t as n}from"./chunk-5KNZJZUH-DdS6bb-3.js";import{t as r}from"./jsx-runtime-CVSDxk6A.js";import{E as i,a,i as o,n as s}from"./auth-store-C4gcHOWH.js";import{i as c}from"./routes-VcLWbBmh.js";import{xr as l}from"./index-87hTkD_v.js";import{r as u,t as d}from"./account-shell-C6-wTQZB.js";import{n as f,t as p}from"./login-flow-DmfVD3r_.js";var m=e(t(),1),h=r();function g(){let e=o(),t=a(),r=s.use.user(),g=s.use.logout(),[_,v]=(0,m.useState)(null),[y,b]=(0,m.useState)(!1),x=async()=>{v(null),b(!0);try{await i(f,p)}catch(e){console.error(`[account] auth flow failed:`,e),v(`Something went wrong. Please try again.`),b(!1)}};return t?(0,h.jsx)(d,{children:(0,h.jsx)(u,{title:`Loading...`})}):e?(0,h.jsxs)(d,{children:[(0,h.jsx)(u,{title:`Welcome${r?.username?`, ${r.username}`:``}!`,subtitle:`You are signed in.`}),(0,h.jsxs)(`div`,{className:`flex flex-col items-center gap-4`,children:[(0,h.jsx)(n,{to:c.assistant,className:`inline-flex w-full items-center justify-center gap-2 rounded-lg bg-[var(--primary-base)] px-6 py-3 text-sm font-medium text-[var(--content-inset)] no-underline transition-colors hover:bg-[var(--primary-hover)]`,children:`Go to your assistant`}),(0,h.jsx)(`button`,{type:`button`,onClick:async()=>{await g(),l(c.account.login)},className:`cursor-pointer bg-transparent text-sm font-normal text-stone-400 transition-colors hover:text-stone-300`,children:`Sign out`})]})]}):(0,h.jsxs)(d,{children:[(0,h.jsx)(u,{title:`Welcome to Vellum`,subtitle:`Sign in to get started.`}),_&&(0,h.jsx)(`p`,{className:`text-center text-sm text-[var(--system-negative-strong)]`,children:_}),(0,h.jsx)(`div`,{className:`flex flex-col items-center gap-4`,children:(0,h.jsx)(`button`,{type:`button`,onClick:()=>void x(),disabled:y,className:`inline-flex w-full cursor-pointer items-center justify-center gap-2 rounded-lg bg-[var(--primary-base)] px-6 py-3 text-sm font-medium text-[var(--content-inset)] transition-colors hover:bg-[var(--primary-hover)] disabled:opacity-50`,children:`Sign in`})})]})}export{g as AccountPage};
@@ -1 +1 @@
1
- import{o as e,r as t}from"./chunk-jRWAZmH_.js";import{t as n}from"./react-DJZBPgpf.js";import{h as r,t as i,u as a}from"./chunk-5KNZJZUH-DdS6bb-3.js";import{n as o}from"./QueryClientProvider-DKhXIxGb.js";import{t as s}from"./useQuery-B45lW1Kk.js";import{t as c}from"./useMutation-Lj4VunQV.js";import{t as l}from"./jsx-runtime-CVSDxk6A.js";import{t as u}from"./button-C68o-wep.js";import{t as d}from"./dropdown-CocFV5yi.js";import{t as f}from"./modal-BYMhDpQo.js";import{t as p}from"./loader-circle-C563RcPZ.js";import{Na as m,Za as h,cn as g,it as _,rt as v,un as y}from"./index-Ue-r3LET.js";var b=t({AddCreditsModal:()=>E}),x=e(n(),1),S=l(),C=[`10.00`,`20.00`,`30.00`,`40.00`,`50.00`,`60.00`,`70.00`,`80.00`,`90.00`,`100.00`];function w(e){let t=parseFloat(e);if(Number.isNaN(t))return`0 credits`;let n=t.toLocaleString(`en-US`,{minimumFractionDigits:2,maximumFractionDigits:2});return`${n.endsWith(`.00`)?n.slice(0,-3):n} credits`}function T(e){if(e&&typeof e==`object`){let t=e.amount;if(Array.isArray(t)&&typeof t[0]==`string`)return t[0]}return`Failed to create checkout session. Please try again.`}function E({open:e,onOpenChange:t}){let n=o(),{pathname:l}=a(),[b]=r(),E=b.toString()?`${l}?${b.toString()}`:l,{data:D,isLoading:O}=s(g()),k=D?.allowed_top_up_amounts?.length?D.allowed_top_up_amounts:C,[A,j]=(0,x.useState)(null),M=A&&k.includes(A)?A:k[0]??C[0],N=c(y());return(0,x.useEffect)(()=>_(()=>{t(!1),n.invalidateQueries(g())}),[t,n]),(0,S.jsx)(f.Root,{open:e,onOpenChange:t,children:(0,S.jsxs)(f.Content,{size:`sm`,children:[(0,S.jsxs)(f.Header,{children:[(0,S.jsx)(f.Title,{icon:m,children:`Add Credits`}),(0,S.jsx)(f.Description,{children:`Purchase credits to continue using the assistant. You'll be redirected to Stripe to complete the payment.`})]}),(0,S.jsx)(f.Body,{children:(0,S.jsxs)(`div`,{className:`space-y-4`,children:[(0,S.jsxs)(`div`,{children:[(0,S.jsx)(`label`,{htmlFor:`add-credits-amount`,className:`block text-body-small-default text-[var(--content-tertiary)]`,children:`Amount`}),(0,S.jsx)(d,{id:`add-credits-amount`,value:M,onChange:e=>{j(e),N.isError&&N.reset()},disabled:O||!D,options:k.map(e=>({value:e,label:w(e)}))})]}),N.isError&&(0,S.jsxs)(`div`,{className:`flex items-center gap-2 text-body-small-default text-[var(--system-negative-strong)]`,children:[(0,S.jsx)(h,{className:`h-3.5 w-3.5 shrink-0`}),T(N.error)]}),(0,S.jsx)(i,{to:`/assistant/settings/billing`,className:`text-body-small-default text-[var(--content-tertiary)] underline hover:text-[var(--content-secondary)]`,onClick:()=>t(!1),children:`Configure Automatic Top-Ups →`})]})}),(0,S.jsxs)(f.Footer,{children:[(0,S.jsx)(f.Close,{asChild:!0,children:(0,S.jsx)(u,{variant:`outlined`,children:`Cancel`})}),(0,S.jsx)(u,{variant:`primary`,leftIcon:N.isPending?(0,S.jsx)(p,{className:`animate-spin`}):void 0,onClick:()=>{N.isPending||N.mutate({body:{amount:M,return_path:E}},{onSuccess:e=>{v(e.checkout_url)}})},disabled:N.isPending||O||!D,children:`Add credits`})]})]})})}export{b as n,E as t};
1
+ import{o as e,r as t}from"./chunk-jRWAZmH_.js";import{t as n}from"./react-DJZBPgpf.js";import{h as r,t as i,u as a}from"./chunk-5KNZJZUH-DdS6bb-3.js";import{n as o}from"./QueryClientProvider-DKhXIxGb.js";import{t as s}from"./useQuery-B45lW1Kk.js";import{t as c}from"./useMutation-Lj4VunQV.js";import{t as l}from"./jsx-runtime-CVSDxk6A.js";import{t as u}from"./button-C68o-wep.js";import{t as d}from"./dropdown-CocFV5yi.js";import{t as f}from"./modal-BYMhDpQo.js";import{t as p}from"./loader-circle-C563RcPZ.js";import{Na as m,Qa as h,cn as g,it as _,rt as v,un as y}from"./index-87hTkD_v.js";var b=t({AddCreditsModal:()=>E}),x=e(n(),1),S=l(),C=[`10.00`,`20.00`,`30.00`,`40.00`,`50.00`,`60.00`,`70.00`,`80.00`,`90.00`,`100.00`];function w(e){let t=parseFloat(e);if(Number.isNaN(t))return`0 credits`;let n=t.toLocaleString(`en-US`,{minimumFractionDigits:2,maximumFractionDigits:2});return`${n.endsWith(`.00`)?n.slice(0,-3):n} credits`}function T(e){if(e&&typeof e==`object`){let t=e.amount;if(Array.isArray(t)&&typeof t[0]==`string`)return t[0]}return`Failed to create checkout session. Please try again.`}function E({open:e,onOpenChange:t}){let n=o(),{pathname:l}=a(),[b]=r(),E=b.toString()?`${l}?${b.toString()}`:l,{data:D,isLoading:O}=s(g()),k=D?.allowed_top_up_amounts?.length?D.allowed_top_up_amounts:C,[A,j]=(0,x.useState)(null),M=A&&k.includes(A)?A:k[0]??C[0],N=c(y());return(0,x.useEffect)(()=>_(()=>{t(!1),n.invalidateQueries(g())}),[t,n]),(0,S.jsx)(f.Root,{open:e,onOpenChange:t,children:(0,S.jsxs)(f.Content,{size:`sm`,children:[(0,S.jsxs)(f.Header,{children:[(0,S.jsx)(f.Title,{icon:m,children:`Add Credits`}),(0,S.jsx)(f.Description,{children:`Purchase credits to continue using the assistant. You'll be redirected to Stripe to complete the payment.`})]}),(0,S.jsx)(f.Body,{children:(0,S.jsxs)(`div`,{className:`space-y-4`,children:[(0,S.jsxs)(`div`,{children:[(0,S.jsx)(`label`,{htmlFor:`add-credits-amount`,className:`block text-body-small-default text-[var(--content-tertiary)]`,children:`Amount`}),(0,S.jsx)(d,{id:`add-credits-amount`,value:M,onChange:e=>{j(e),N.isError&&N.reset()},disabled:O||!D,options:k.map(e=>({value:e,label:w(e)}))})]}),N.isError&&(0,S.jsxs)(`div`,{className:`flex items-center gap-2 text-body-small-default text-[var(--system-negative-strong)]`,children:[(0,S.jsx)(h,{className:`h-3.5 w-3.5 shrink-0`}),T(N.error)]}),(0,S.jsx)(i,{to:`/assistant/settings/billing`,className:`text-body-small-default text-[var(--content-tertiary)] underline hover:text-[var(--content-secondary)]`,onClick:()=>t(!1),children:`Configure Automatic Top-Ups →`})]})}),(0,S.jsxs)(f.Footer,{children:[(0,S.jsx)(f.Close,{asChild:!0,children:(0,S.jsx)(u,{variant:`outlined`,children:`Cancel`})}),(0,S.jsx)(u,{variant:`primary`,leftIcon:N.isPending?(0,S.jsx)(p,{className:`animate-spin`}):void 0,onClick:()=>{N.isPending||N.mutate({body:{amount:M,return_path:E}},{onSuccess:e=>{v(e.checkout_url)}})},disabled:N.isPending||O||!D,children:`Add credits`})]})]})})}export{b as n,E as t};
@@ -1 +1 @@
1
- import{o as e}from"./chunk-jRWAZmH_.js";import{t}from"./capture-error-Dze4ISSQ.js";import{t as n}from"./react-DJZBPgpf.js";import{n as r}from"./QueryClientProvider-DKhXIxGb.js";import{t as i}from"./useQuery-B45lW1Kk.js";import{t as a}from"./useMutation-Lj4VunQV.js";import{t as o}from"./jsx-runtime-CVSDxk6A.js";import{t as s}from"./button-C68o-wep.js";import{t as c}from"./notice-CF2pptne.js";import{t as l}from"./input-Cu3PPVCq.js";import{t as u}from"./toggle-CEm3M86o.js";import{n as d}from"./stat-square-BENJGRZr.js";import{n as f}from"./toast-BL8OPiip.js";import{t as p}from"./loader-circle-C563RcPZ.js";import{q as m}from"./sdk.gen-ClmX029Q.js";import{Bt as h,Dn as g,zt as _}from"./index-Ue-r3LET.js";import{t as v}from"./detail-card-BOk0V4_4.js";import{n as y,r as b}from"./use-daemon-config-DBKbFpqu.js";import{r as x}from"./assistant-status-panel-DXNBZech.js";var S=e(n(),1),C=o(),w=[[`Mon`,0],[`Tue`,1],[`Wed`,2],[`Thu`,3],[`Fri`,4],[`Sat`,5],[`Sun`,6]];function T(e){let[t,n]=e.split(`:`).map(Number),r=new Date,i=new Date(Date.UTC(r.getUTCFullYear(),r.getUTCMonth(),r.getUTCDate(),t,n));return`${i.getHours().toString().padStart(2,`0`)}:${i.getMinutes().toString().padStart(2,`0`)}`}function E(e){let[t,n]=e.split(`:`).map(Number),r=new Date,i=new Date(r.getFullYear(),r.getMonth(),r.getDate(),t,n);return`${i.getUTCHours().toString().padStart(2,`0`)}:${i.getUTCMinutes().toString().padStart(2,`0`)}`}function D(){return Intl.DateTimeFormat(void 0,{timeZoneName:`short`}).formatToParts(new Date).find(e=>e.type===`timeZoneName`)?.value??``}function O(e){let t=e?.schedule?.window.start??`06:00`,n=e?.schedule?.window.end??`08:00`;return{enabled:e?.enabled??!0,timezone:`UTC`,frequency:e?.schedule?.frequency??`weekly`,daysOfWeek:e?.schedule?.days_of_week??[0],daysOfMonth:e?.schedule?.days_of_month??[],windowStart:T(t),windowEnd:T(n)}}function k({assistantId:e}){let t=r(),{data:n,isLoading:o,isError:c}=i(_({path:{id:e}})),g=(0,S.useMemo)(()=>O(n),[n]),[v,y]=(0,S.useState)(null),b=v??g,x=v!==null,T=(0,S.useMemo)(()=>D(),[]),[k,A]=(0,S.useState)(null),j=k??b.daysOfMonth.join(`, `),M=a({mutationFn:async t=>{let{data:n}=await m({path:{id:e},body:t,throwOnError:!0});return n}}),N=e=>{y(t=>({...t??g,...e}))},P=e=>{N({daysOfWeek:b.daysOfWeek.includes(e)?b.daysOfWeek.filter(t=>t!==e):[...b.daysOfWeek,e].sort((e,t)=>e-t)})},F=e=>e.split(`,`).map(e=>parseInt(e.trim(),10)).filter(e=>!isNaN(e)&&e>=1&&e<=31);return o?(0,C.jsxs)(`div`,{className:`flex items-center gap-2 text-body-medium-lighter text-[var(--content-tertiary)]`,children:[(0,C.jsx)(p,{className:`h-4 w-4 animate-spin`}),`Loading update window settings...`]}):c?(0,C.jsx)(`p`,{className:`text-body-medium-lighter text-[var(--system-negative-strong)]`,children:`Failed to load update window policy. Refresh the page to try again.`}):(0,C.jsxs)(`div`,{className:`space-y-6`,children:[(0,C.jsx)(u,{checked:b.enabled,onChange:e=>N({enabled:e}),label:`Automatic updates`,helperText:`Update automatically during a configured time window`}),b.enabled&&(0,C.jsxs)(`div`,{className:`space-y-5`,children:[(0,C.jsxs)(`div`,{className:`space-y-2`,children:[(0,C.jsx)(`label`,{className:`block text-body-small-default text-[var(--content-secondary)]`,children:`Frequency`}),(0,C.jsx)(`div`,{className:`max-w-[400px]`,children:(0,C.jsx)(d,{ariaLabel:`Frequency`,value:b.frequency,onChange:e=>{e!==`monthly`&&A(null),N({frequency:e})},items:[{value:`daily`,label:`Daily`},{value:`weekly`,label:`Weekly`},{value:`monthly`,label:`Monthly`}]})})]}),b.frequency===`weekly`&&(0,C.jsxs)(`div`,{className:`space-y-2`,children:[(0,C.jsx)(`label`,{className:`block text-body-small-default text-[var(--content-secondary)]`,children:`Day(s) of week`}),(0,C.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:w.map(([e,t])=>(0,C.jsx)(s,{variant:`outlined`,size:`compact`,active:b.daysOfWeek.includes(t),onClick:()=>P(t),children:e},t))})]}),b.frequency===`monthly`&&(0,C.jsx)(l,{label:`Day(s) of month`,type:`text`,value:j,onChange:e=>A(e.target.value),onBlur:e=>{let t=F(e.target.value);N({daysOfMonth:t}),A(t.join(`, `))},placeholder:`e.g. 1, 15`,helperText:`Comma-separated day numbers (1–31)`,className:`w-48`}),(0,C.jsxs)(`div`,{className:`space-y-2`,children:[(0,C.jsxs)(`label`,{className:`block text-body-small-default text-[var(--content-secondary)]`,children:[`Update window`,T?` (${T})`:``]}),(0,C.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,C.jsx)(l,{type:`time`,value:b.windowStart,onChange:e=>N({windowStart:e.target.value})}),(0,C.jsx)(`span`,{className:`text-body-medium-lighter text-[var(--content-tertiary)]`,children:`to`}),(0,C.jsx)(l,{type:`time`,value:b.windowEnd,onChange:e=>N({windowEnd:e.target.value})})]})]})]}),(0,C.jsx)(s,{variant:`primary`,leftIcon:M.isPending?(0,C.jsx)(p,{className:`animate-spin`}):void 0,onClick:async()=>{let n=b.frequency===`monthly`&&k!==null?F(k):b.daysOfMonth;try{await M.mutateAsync({enabled:b.enabled,timezone:`UTC`,schedule:{frequency:b.frequency,days_of_week:b.frequency===`weekly`?b.daysOfWeek:[],days_of_month:b.frequency===`monthly`?n:[],window:{start:E(b.windowStart),end:E(b.windowEnd)}}}),f.success(`Auto-update policy saved.`),y(null),A(null),t.invalidateQueries({queryKey:h({path:{id:e}})})}catch{f.error(`Failed to save policy. Please try again.`)}},disabled:M.isPending||!x,children:`Save policy`})]})}function A(){let{assistant:e,healthz:n}=x(),r=g({platformHostedOnly:!0}),i=e?.is_local?null:e,a=n?.capabilities?.memoryOptOut===!0,{config:o}=b({enabled:a}),s=y(),l=o?.memory?.enabled!==!1,d=async e=>{try{await s.mutateAsync({memory:{enabled:e}}),f.success(e?`Memory enabled.`:`Memory disabled.`)}catch(e){t(e,{context:`settings-memory-toggle`}),f.error(`Failed to update memory setting.`)}};return(0,C.jsxs)(`div`,{className:`space-y-4`,children:[r===`full`&&i&&(0,C.jsx)(v,{title:`Update Window`,subtitle:`Configure when automatic updates are applied.`,children:(0,C.jsx)(k,{assistantId:i.id})}),r===`disabled`&&(0,C.jsx)(v,{title:`Update Window`,subtitle:`Configure when automatic updates are applied.`,children:(0,C.jsx)(c,{tone:`info`,children:`Log in to the Vellum platform to manage update window policy.`})}),a?(0,C.jsx)(v,{title:`Memory`,subtitle:`Let your assistant remember information from past conversations. Turning this off also pauses memory consolidation.`,accessory:(0,C.jsx)(u,{checked:l,onChange:e=>void d(e),"aria-label":`Enable memory`,disabled:s.isPending}),compactAccessory:!0}):null]})}export{A as AdvancedPage};
1
+ import{o as e}from"./chunk-jRWAZmH_.js";import{t}from"./capture-error-Dze4ISSQ.js";import{t as n}from"./react-DJZBPgpf.js";import{n as r}from"./QueryClientProvider-DKhXIxGb.js";import{t as i}from"./useQuery-B45lW1Kk.js";import{t as a}from"./useMutation-Lj4VunQV.js";import{t as o}from"./jsx-runtime-CVSDxk6A.js";import{t as s}from"./button-C68o-wep.js";import{t as c}from"./notice-CF2pptne.js";import{t as l}from"./input-Cu3PPVCq.js";import{t as u}from"./toggle-CEm3M86o.js";import{n as d}from"./stat-square-BENJGRZr.js";import{n as f}from"./toast-BL8OPiip.js";import{t as p}from"./loader-circle-C563RcPZ.js";import{q as m}from"./sdk.gen-ClmX029Q.js";import{Bt as h,Dn as g,zt as _}from"./index-87hTkD_v.js";import{t as v}from"./detail-card-BOk0V4_4.js";import{n as y,r as b}from"./use-daemon-config-BLCgqB8a.js";import{r as x}from"./assistant-status-panel-B-yM7DE5.js";var S=e(n(),1),C=o(),w=[[`Mon`,0],[`Tue`,1],[`Wed`,2],[`Thu`,3],[`Fri`,4],[`Sat`,5],[`Sun`,6]];function T(e){let[t,n]=e.split(`:`).map(Number),r=new Date,i=new Date(Date.UTC(r.getUTCFullYear(),r.getUTCMonth(),r.getUTCDate(),t,n));return`${i.getHours().toString().padStart(2,`0`)}:${i.getMinutes().toString().padStart(2,`0`)}`}function E(e){let[t,n]=e.split(`:`).map(Number),r=new Date,i=new Date(r.getFullYear(),r.getMonth(),r.getDate(),t,n);return`${i.getUTCHours().toString().padStart(2,`0`)}:${i.getUTCMinutes().toString().padStart(2,`0`)}`}function D(){return Intl.DateTimeFormat(void 0,{timeZoneName:`short`}).formatToParts(new Date).find(e=>e.type===`timeZoneName`)?.value??``}function O(e){let t=e?.schedule?.window.start??`06:00`,n=e?.schedule?.window.end??`08:00`;return{enabled:e?.enabled??!0,timezone:`UTC`,frequency:e?.schedule?.frequency??`weekly`,daysOfWeek:e?.schedule?.days_of_week??[0],daysOfMonth:e?.schedule?.days_of_month??[],windowStart:T(t),windowEnd:T(n)}}function k({assistantId:e}){let t=r(),{data:n,isLoading:o,isError:c}=i(_({path:{id:e}})),g=(0,S.useMemo)(()=>O(n),[n]),[v,y]=(0,S.useState)(null),b=v??g,x=v!==null,T=(0,S.useMemo)(()=>D(),[]),[k,A]=(0,S.useState)(null),j=k??b.daysOfMonth.join(`, `),M=a({mutationFn:async t=>{let{data:n}=await m({path:{id:e},body:t,throwOnError:!0});return n}}),N=e=>{y(t=>({...t??g,...e}))},P=e=>{N({daysOfWeek:b.daysOfWeek.includes(e)?b.daysOfWeek.filter(t=>t!==e):[...b.daysOfWeek,e].sort((e,t)=>e-t)})},F=e=>e.split(`,`).map(e=>parseInt(e.trim(),10)).filter(e=>!isNaN(e)&&e>=1&&e<=31);return o?(0,C.jsxs)(`div`,{className:`flex items-center gap-2 text-body-medium-lighter text-[var(--content-tertiary)]`,children:[(0,C.jsx)(p,{className:`h-4 w-4 animate-spin`}),`Loading update window settings...`]}):c?(0,C.jsx)(`p`,{className:`text-body-medium-lighter text-[var(--system-negative-strong)]`,children:`Failed to load update window policy. Refresh the page to try again.`}):(0,C.jsxs)(`div`,{className:`space-y-6`,children:[(0,C.jsx)(u,{checked:b.enabled,onChange:e=>N({enabled:e}),label:`Automatic updates`,helperText:`Update automatically during a configured time window`}),b.enabled&&(0,C.jsxs)(`div`,{className:`space-y-5`,children:[(0,C.jsxs)(`div`,{className:`space-y-2`,children:[(0,C.jsx)(`label`,{className:`block text-body-small-default text-[var(--content-secondary)]`,children:`Frequency`}),(0,C.jsx)(`div`,{className:`max-w-[400px]`,children:(0,C.jsx)(d,{ariaLabel:`Frequency`,value:b.frequency,onChange:e=>{e!==`monthly`&&A(null),N({frequency:e})},items:[{value:`daily`,label:`Daily`},{value:`weekly`,label:`Weekly`},{value:`monthly`,label:`Monthly`}]})})]}),b.frequency===`weekly`&&(0,C.jsxs)(`div`,{className:`space-y-2`,children:[(0,C.jsx)(`label`,{className:`block text-body-small-default text-[var(--content-secondary)]`,children:`Day(s) of week`}),(0,C.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:w.map(([e,t])=>(0,C.jsx)(s,{variant:`outlined`,size:`compact`,active:b.daysOfWeek.includes(t),onClick:()=>P(t),children:e},t))})]}),b.frequency===`monthly`&&(0,C.jsx)(l,{label:`Day(s) of month`,type:`text`,value:j,onChange:e=>A(e.target.value),onBlur:e=>{let t=F(e.target.value);N({daysOfMonth:t}),A(t.join(`, `))},placeholder:`e.g. 1, 15`,helperText:`Comma-separated day numbers (1–31)`,className:`w-48`}),(0,C.jsxs)(`div`,{className:`space-y-2`,children:[(0,C.jsxs)(`label`,{className:`block text-body-small-default text-[var(--content-secondary)]`,children:[`Update window`,T?` (${T})`:``]}),(0,C.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,C.jsx)(l,{type:`time`,value:b.windowStart,onChange:e=>N({windowStart:e.target.value})}),(0,C.jsx)(`span`,{className:`text-body-medium-lighter text-[var(--content-tertiary)]`,children:`to`}),(0,C.jsx)(l,{type:`time`,value:b.windowEnd,onChange:e=>N({windowEnd:e.target.value})})]})]})]}),(0,C.jsx)(s,{variant:`primary`,leftIcon:M.isPending?(0,C.jsx)(p,{className:`animate-spin`}):void 0,onClick:async()=>{let n=b.frequency===`monthly`&&k!==null?F(k):b.daysOfMonth;try{await M.mutateAsync({enabled:b.enabled,timezone:`UTC`,schedule:{frequency:b.frequency,days_of_week:b.frequency===`weekly`?b.daysOfWeek:[],days_of_month:b.frequency===`monthly`?n:[],window:{start:E(b.windowStart),end:E(b.windowEnd)}}}),f.success(`Auto-update policy saved.`),y(null),A(null),t.invalidateQueries({queryKey:h({path:{id:e}})})}catch{f.error(`Failed to save policy. Please try again.`)}},disabled:M.isPending||!x,children:`Save policy`})]})}function A(){let{assistant:e,healthz:n}=x(),r=g({platformHostedOnly:!0}),i=e?.is_local?null:e,a=n?.capabilities?.memoryOptOut===!0,{config:o}=b({enabled:a}),s=y(),l=o?.memory?.enabled!==!1,d=async e=>{try{await s.mutateAsync({memory:{enabled:e}}),f.success(e?`Memory enabled.`:`Memory disabled.`)}catch(e){t(e,{context:`settings-memory-toggle`}),f.error(`Failed to update memory setting.`)}};return(0,C.jsxs)(`div`,{className:`space-y-4`,children:[r===`full`&&i&&(0,C.jsx)(v,{title:`Update Window`,subtitle:`Configure when automatic updates are applied.`,children:(0,C.jsx)(k,{assistantId:i.id})}),r===`disabled`&&(0,C.jsx)(v,{title:`Update Window`,subtitle:`Configure when automatic updates are applied.`,children:(0,C.jsx)(c,{tone:`info`,children:`Log in to the Vellum platform to manage update window policy.`})}),a?(0,C.jsx)(v,{title:`Memory`,subtitle:`Let your assistant remember information from past conversations. Turning this off also pauses memory consolidation.`,accessory:(0,C.jsx)(u,{checked:l,onChange:e=>void d(e),"aria-label":`Enable memory`,disabled:s.isPending}),compactAccessory:!0}):null]})}export{A as AdvancedPage};
@@ -1 +1 @@
1
- import{o as e}from"./chunk-jRWAZmH_.js";import{i as t,r as n,s as r}from"./local-settings-lVNyIOJ_.js";import{r as i,t as a}from"./capture-error-Dze4ISSQ.js";import{t as o}from"./react-DJZBPgpf.js";import{d as s,h as c}from"./chunk-5KNZJZUH-DdS6bb-3.js";import{n as l}from"./QueryClientProvider-DKhXIxGb.js";import{t as u}from"./useQuery-B45lW1Kk.js";import{t as d}from"./useMutation-Lj4VunQV.js";import{t as f}from"./jsx-runtime-CVSDxk6A.js";import{t as p}from"./button-C68o-wep.js";import{t as m}from"./typography-Czgs_2w_.js";import{t as h}from"./dropdown-CocFV5yi.js";import{t as g}from"./confirm-dialog-94QFOD8a.js";import{t as _}from"./notice-CF2pptne.js";import{t as v}from"./tag-Ccr7Quy6.js";import{t as y}from"./input-Cu3PPVCq.js";import{t as b}from"./toggle-CEm3M86o.js";import{n as x}from"./stat-square-BENJGRZr.js";import{t as S}from"./modal-BYMhDpQo.js";import{n as C}from"./toast-BL8OPiip.js";import{t as w}from"./createLucideIcon-D6d6iDdi.js";import{n as T,t as E}from"./domain-field-PnLPKONf.js";import{t as D}from"./external-link-Dj8dup-K.js";import{t as O}from"./loader-circle-C563RcPZ.js";import{C as k,E as A,M as j,N as M,O as N,P as ee,S as P,T as F,_ as I,a as L,b as R,c as z,d as B,f as V,g as H,h as U,k as W,l as te,m as G,p as K,s as ne,u as re,v as q,w as J,x as Y,y as ie}from"./ai-utils-C-JayVoL.js";import{Dt as ae,Ot as oe,Xt as se,Z as ce,wn as le}from"./sdk.gen-18Tp6Ee_.js";import{C as ue,J as de,S as fe,s as pe}from"./react-query.gen-Bp_whSkG.js";import{r as me}from"./api-errors-CsfCFJ8r.js";import{i as he}from"./routes-VcLWbBmh.js";import{t as ge}from"./use-is-org-ready-7bL7PowO.js";import{r as _e}from"./query-tags-D58uls0S.js";import{t as ve}from"./assistant-identity-store-CRzGEuvZ.js";import{t as ye}from"./assistant-feature-flag-store-BPZq6n_3.js";import{$a as be,$r as xe,Ct as Se,Dn as Ce,Ga as we,Gr as Te,Jr as Ee,Kr as De,Li as Oe,Qr as ke,St as Ae,Xr as je,Ya as Me,Yr as Ne,Za as Pe,Zr as Fe,_t as Ie,ai as Le,bt as Re,ci as ze,dt as Be,ei as Ve,ft as He,gt as Ue,ht as We,ii as Ge,in as Ke,ma as qe,mt as Je,ni as Ye,oi as Xe,pt as Ze,qr as Qe,ri as $e,si as et,ti as tt,ut as nt,vt as rt,xi as it,yt as at}from"./index-Ue-r3LET.js";import{t as ot}from"./use-active-assistant-id-B2Zd0B4I.js";import{t as st}from"./detail-card-BOk0V4_4.js";import{i as ct,n as X,r as lt,t as ut}from"./use-daemon-config-DBKbFpqu.js";import{t as dt}from"./environment-store-BFK2MIjF.js";var ft=w(`grip-vertical`,[[`circle`,{cx:`9`,cy:`12`,r:`1`,key:`1vctgf`}],[`circle`,{cx:`9`,cy:`5`,r:`1`,key:`hp0tcf`}],[`circle`,{cx:`9`,cy:`19`,r:`1`,key:`fkjjf6`}],[`circle`,{cx:`15`,cy:`12`,r:`1`,key:`1tmaij`}],[`circle`,{cx:`15`,cy:`5`,r:`1`,key:`19l28e`}],[`circle`,{cx:`15`,cy:`19`,r:`1`,key:`f4zoj3`}]]),Z=e(o(),1),Q=f();function pt({mode:e,onChange:t}){return(0,Q.jsx)(`div`,{className:`max-w-[280px]`,children:(0,Q.jsx)(x,{ariaLabel:`Service mode`,value:e,onChange:t,items:[{value:`managed`,label:`Managed`},{value:`your-own`,label:`Your Own`}]})})}function mt({id:e,title:t,subtitle:n,mode:r,onModeChange:i,children:a}){return(0,Q.jsxs)(st,{id:e,title:t,subtitle:n,accessory:(0,Q.jsx)(pt,{mode:r,onChange:i}),children:[(0,Q.jsx)(`div`,{className:`h-px bg-[var(--surface-active)]`}),(0,Q.jsx)(`div`,{className:`mt-4`,children:a})]})}function $({onClick:e,disabled:t}){return(0,Q.jsx)(p,{onClick:e,disabled:t,children:`Save`})}function ht({onClick:e,filled:t=!1}){return(0,Q.jsx)(p,{variant:t?`danger`:`dangerGhost`,onClick:e,children:`Reset`})}function gt({id:e,title:t,subtitle:n,children:r}){return(0,Q.jsxs)(st,{id:e,title:t,subtitle:n,children:[(0,Q.jsx)(`div`,{className:`h-px bg-[var(--surface-active)]`}),(0,Q.jsx)(`div`,{className:`mt-4`,children:r})]})}function _t({guide:e}){return(0,Q.jsxs)(`div`,{className:`flex items-start gap-2 rounded-lg border border-[var(--border-subtle)] bg-[var(--surface-sunken)] p-3 text-body-small-default text-[var(--content-tertiary)]`,children:[(0,Q.jsx)(qe,{className:`mt-0.5 h-3.5 w-3.5 shrink-0 text-[var(--system-positive-strong)]`}),(0,Q.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,Q.jsx)(`span`,{children:e.description}),(0,Q.jsxs)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,className:`inline-flex items-center gap-1 text-[var(--system-positive-strong)] underline hover:opacity-80`,children:[e.linkLabel,(0,Q.jsx)(D,{className:`h-3 w-3`})]})]})]})}function vt({status:e,message:t,isLoading:n}){return n?(0,Q.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded-full bg-[var(--tag-bg-neutral)] px-2.5 py-0.5 text-body-small-default text-[var(--content-quiet)]`,children:[(0,Q.jsx)(O,{className:`h-3 w-3 animate-spin`}),`Checking domain…`]}):e?e===`verified`?(0,Q.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded-full bg-[var(--system-positive-weak)] px-2.5 py-0.5 text-body-small-default text-[var(--system-positive-strong)]`,title:`DNS records have been verified. Your domain is ready to send and receive email.`,children:[(0,Q.jsx)(be,{className:`h-3 w-3`}),`Domain verified`]}):e===`pending`||e===`not_started`?(0,Q.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded-full bg-[var(--system-mid-weak)] px-2.5 py-0.5 text-body-small-default text-[var(--system-mid-strong)]`,title:`DNS records have been provisioned. Waiting for the email provider to verify them — this usually takes a few minutes.`,children:[(0,Q.jsx)(we,{className:`h-3 w-3`}),`Verifying domain…`]}):(0,Q.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded-full bg-[var(--system-negative-weak)] px-2.5 py-0.5 text-body-small-default text-[var(--system-negative-strong)]`,title:`Domain verification failed. DNS records may not have propagated correctly. You could try releasing and re-registering the domain.`,children:[(0,Q.jsx)(Pe,{className:`h-3 w-3`}),`Verification failed`]}):(0,Q.jsx)(`span`,{className:`inline-flex items-center gap-1 rounded-full bg-[var(--tag-bg-neutral)] px-2.5 py-0.5 text-body-small-default text-[var(--content-quiet)]`,title:`Unable to retrieve domain verification status.`,children:`Unknown status`})}var yt=`__custom__`;function bt(e){return e?!!(e.profile||e.provider||e.model):!1}function xt(e,t){let n=bt(e);return n===bt(t)?n?(e?.profile??null)===(t?.profile??null)&&(e?.provider??null)===(t?.provider??null)&&(e?.model??null)===(t?.model??null):!0:!1}function St({id:e,displayName:t,description:n,defaultProfileLabel:r,draft:i,profileOptions:a,onDraftChange:o,onToggle:s}){let c=bt(i),l=!i||!c?``:i.provider||i.model?yt:i.profile??``,u=l===yt,d=i?.provider??G[0],f=M(d??`anthropic`).map(e=>({value:e.id,label:e.displayName})),p=!!i?.provider&&!i?.model;function m(t){if(t===`__custom__`){let t=G[0];o(e,{profile:null,provider:t,model:j(t)??``})}else t===``?o(e,null):o(e,{profile:t,provider:null,model:null})}function g(t){let n=j(t)??``;o(e,{...i??{},profile:null,provider:t,model:n})}function _(t){o(e,{...i??{},model:t})}return(0,Q.jsxs)(`div`,{className:`rounded-lg border border-[var(--border-base)] bg-[var(--surface-base)] p-3`,children:[(0,Q.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,Q.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Q.jsx)(`p`,{className:`text-body-medium-default font-medium text-[var(--content-default)]`,children:t}),n&&(0,Q.jsxs)(`p`,{className:`mt-0.5 text-body-small-default text-[var(--content-tertiary)]`,children:[n,r&&(0,Q.jsxs)(`span`,{className:`ml-1.5 text-body-small-default text-[var(--content-tertiary)] opacity-60`,children:[`· Default: `,r]})]})]}),(0,Q.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2`,children:[c&&(0,Q.jsx)(h,{value:l,onChange:m,options:a,className:`w-36`}),(0,Q.jsx)(b,{checked:c,onChange:t=>s(e,t),"aria-label":`Override ${t}`})]})]}),c&&u&&(0,Q.jsxs)(`div`,{className:`mt-3 space-y-2 border-t border-[var(--border-base)] pt-3`,children:[(0,Q.jsxs)(`div`,{className:`flex gap-2`,children:[(0,Q.jsxs)(`div`,{className:`flex-1`,children:[(0,Q.jsx)(`label`,{className:`mb-1 block text-body-small-default text-[var(--content-tertiary)]`,children:`Provider`}),(0,Q.jsx)(h,{value:d??``,onChange:g,options:G.map(e=>({value:e,label:U[e]??e}))})]}),(0,Q.jsxs)(`div`,{className:`flex-1`,children:[(0,Q.jsx)(`label`,{className:`mb-1 block text-body-small-default text-[var(--content-tertiary)]`,children:`Model`}),(0,Q.jsx)(h,{value:i?.model??``,onChange:_,options:f})]})]}),p&&(0,Q.jsx)(`p`,{className:`text-body-small-default text-[var(--system-negative-strong)]`,children:`Pick a model`})]})]})}function Ct({isOpen:e,onClose:t,assistantId:n}){let r=(0,Z.useRef)(!1);return(0,Q.jsx)(S.Root,{open:e,onOpenChange:e=>{!e&&!r.current&&t()},children:e?(0,Q.jsx)(wt,{assistantId:n,onClose:t,onSavingChange:e=>{r.current=e}}):null})}function wt({assistantId:e,onClose:t,onSavingChange:n}){let{orderedProfiles:r,callSites:i,config:o}=lt(),s=X(),[c,l]=(0,Z.useState)(``),[d,f]=(0,Z.useState)({}),[m,h]=(0,Z.useState)(!1),[_,v]=(0,Z.useState)(!1),b=ye.use.analyzeConversation(),{data:x,isLoading:w,isError:T,refetch:E}=u({...pe({path:{assistant_id:e}}),enabled:!!e,staleTime:6e4,refetchOnWindowFocus:!1}),D=(0,Z.useMemo)(()=>{let e=(x?.callSites??[]).filter(e=>e.id!==`mainAgent`);return b?e:e.filter(e=>e.id!==`analyzeConversation`)},[x,b]),k=!w&&!T&&!!x&&!!o,A=(0,Z.useMemo)(()=>D.map(e=>e.id),[D]),M=(0,Z.useMemo)(()=>{if(!k)return{};let e={};for(let t of A)if(t in d)e[t]=d[t];else{let n=i[t];e[t]=n?{...n}:{}}return e},[k,A,i,d]),N=(0,Z.useMemo)(()=>new Set(A),[A]),ee=(0,Z.useMemo)(()=>Object.entries(i).some(([e,t])=>N.has(e)&&(t?.profile!=null||t?.provider!=null||t?.model!=null)),[i,N]),P=(0,Z.useMemo)(()=>{if(!k)return!1;for(let e of Object.keys(M))if(!xt(M[e],i[e]))return!0;return!1},[k,M,i]),F=(0,Z.useMemo)(()=>Object.values(M).some(e=>bt(e)&&!!e?.provider&&!e?.model),[M]),I=ye.use.queryComplexityRouting(),L=(0,Z.useCallback)(e=>[...Le(ze(r,[e]),I).map(e=>({value:e.name,label:Xe(e)})),{value:yt,label:`Custom`}],[r,I]),R=(0,Z.useMemo)(()=>{if(!c.trim())return D;let e=c.toLowerCase();return D.filter(t=>(t.displayName??``).toLowerCase().includes(e)||(t.description??``).toLowerCase().includes(e)||(t.domain??``).toLowerCase().includes(e))},[D,c]),z=(0,Z.useMemo)(()=>{if(!x)return[];let e=x.domains.map(e=>e.id),t=new Map(x.domains.map(e=>[e.id,e])),n=[];for(let r of e){let e=R.filter(e=>e.domain===r);e.length>0&&n.push({domain:t.get(r),sites:e})}let r=new Set(e),i=R.filter(e=>!r.has(e.domain));return i.length>0&&n.push({domain:{id:`other`,displayName:`Other`},sites:i}),n},[x,R]),B=(0,Z.useCallback)((e,t)=>{f(n=>({...n,[e]:t}))},[]),V=(0,Z.useCallback)((e,t)=>{if(!t){f(t=>({...t,[e]:null}));return}let n=et(r,D.find(t=>t.id===e)?.defaultProfile,I);if(n)f(t=>({...t,[e]:{profile:n}}));else{let t=G[0],n=j(t)??``;f(r=>({...r,[e]:{provider:t,model:n}}))}},[D,r,I]),H=(0,Z.useCallback)(async()=>{h(!0),n?.(!0);try{let e={};for(let t of Object.keys(M)){let n=M[t]??null;e[t]=bt(n)?{profile:n?.profile??null,provider:n?.provider??null,model:n?.model??null}:null}await s.mutateAsync({llm:{callSites:e}}),t(),C.success(`Overrides saved.`)}catch(e){C.error(`Failed to save overrides. Please try again.`),a(e,{context:`call_site_overrides_save`})}finally{h(!1),n?.(!1)}},[M,t,s,n]),U=(0,Z.useCallback)(async()=>{h(!0),n?.(!0);try{let e={};for(let t of Object.keys(M))e[t]=null;await s.mutateAsync({llm:{callSites:e}}),t(),C.success(`Overrides reset.`)}catch(e){C.error(`Failed to reset overrides. Please try again.`),a(e,{context:`call_site_overrides_reset`})}finally{h(!1),n?.(!1)}},[M,t,s,n]);return(0,Q.jsxs)(S.Content,{size:`lg`,hideCloseButton:!0,children:[(0,Q.jsxs)(S.Header,{children:[(0,Q.jsx)(S.Title,{children:`Action Overrides`}),(0,Q.jsx)(S.Description,{children:`Customize which model profile specific actions should use. Uses your default profile if no override is set.`})]}),(0,Q.jsxs)(S.Body,{children:[(0,Q.jsx)(`div`,{className:`mb-4`,children:(0,Q.jsx)(y,{type:`search`,value:c,onChange:e=>l(e.target.value),placeholder:`Search actions…`,leftIcon:(0,Q.jsx)(Oe,{className:`h-4 w-4`}),fullWidth:!0})}),w&&(0,Q.jsx)(`div`,{className:`flex items-center justify-center py-12`,children:(0,Q.jsx)(O,{className:`h-6 w-6 animate-spin text-[var(--content-tertiary)]`})}),T&&(0,Q.jsxs)(`div`,{className:`flex flex-col items-center gap-3 py-12 text-center`,children:[(0,Q.jsx)(`p`,{className:`text-body-medium-default text-[var(--content-default)]`,children:`Couldn't load actions`}),(0,Q.jsx)(`p`,{className:`text-body-medium-lighter text-[var(--content-tertiary)]`,children:`Make sure your assistant is running`}),(0,Q.jsx)(p,{variant:`outlined`,size:`compact`,onClick:()=>void E(),children:`Retry`})]}),!w&&!T&&x&&(0,Q.jsx)(`div`,{className:`space-y-4`,children:z.length===0?(0,Q.jsx)(`p`,{className:`py-8 text-center text-body-medium-lighter text-[var(--content-tertiary)]`,children:`No actions match your search.`}):z.map(({domain:e,sites:t})=>(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`p`,{className:`mb-2 text-body-small-default font-semibold uppercase tracking-wider text-[var(--content-tertiary)]`,children:e.displayName}),(0,Q.jsx)(`div`,{className:`space-y-1`,children:t.map(e=>{let t=(()=>{let t=M[e.id]??null;return!t||!bt(t)?``:t.provider||t.model?`__custom__`:t.profile??``})(),n=e.defaultProfile?r.find(t=>t.name===e.defaultProfile)?.label??e.defaultProfile:null;return(0,Q.jsx)(St,{id:e.id,displayName:e.displayName,description:e.description,defaultProfileLabel:n,draft:M[e.id]??null,profileOptions:L(t===``||t===`__custom__`?null:t),onDraftChange:B,onToggle:V},e.id)})})]},e.id))})]}),(0,Q.jsxs)(S.Footer,{children:[ee&&(0,Q.jsx)(p,{variant:`outlined`,size:`compact`,onClick:()=>v(!0),disabled:m||!k,tintColor:`var(--system-negative-strong)`,className:`mr-auto`,children:`Reset to Defaults`}),(0,Q.jsx)(p,{variant:`outlined`,size:`compact`,onClick:t,disabled:m,children:`Cancel`}),(0,Q.jsx)(p,{variant:`primary`,size:`compact`,onClick:()=>void H(),disabled:!P||F||m,children:m?(0,Q.jsx)(O,{className:`h-4 w-4 animate-spin`}):`Save`})]}),(0,Q.jsx)(g,{open:_,title:`Reset to Defaults`,message:`Every task override will be reset and will follow your active profile. This cannot be undone.`,confirmLabel:`Reset to Defaults`,destructive:!0,onConfirm:()=>{v(!1),U()},onCancel:()=>v(!1)})]})}function Tt({blocked:e,availableReplacements:t,replacement:n,onReplacementChange:r,error:i,saving:a,onClose:o,onConfirm:s}){let c=``;if(e){let t=e.label||e.name;c=e.isActive&&e.callSiteIds.length>0?`"${t}" is the active profile and is used by ${e.callSiteIds.length} call site(s). Pick a replacement profile.`:e.isActive?`"${t}" is the active profile. Pick a different active profile before deleting, or select a replacement below.`:`"${t}" is used by ${e.callSiteIds.length} call site(s). Select a replacement profile to reassign them before deleting.`}return(0,Q.jsx)(S.Root,{open:e!==null,onOpenChange:e=>{e||o()},children:(0,Q.jsxs)(S.Content,{size:`sm`,children:[(0,Q.jsx)(S.Header,{children:(0,Q.jsx)(S.Title,{children:`Can't Delete Profile`})}),(0,Q.jsxs)(S.Body,{className:`space-y-4`,children:[(0,Q.jsx)(m,{variant:`body-medium-default`,as:`p`,children:c}),e&&e.callSiteIds.length>0&&(0,Q.jsx)(`ul`,{className:`space-y-1 pl-1`,children:e.callSiteIds.map(e=>(0,Q.jsxs)(`li`,{className:`text-body-small-default text-(--content-secondary)`,children:[`• `,(0,Q.jsx)(`code`,{children:e})]},e))}),(0,Q.jsxs)(`div`,{className:`space-y-1`,children:[(0,Q.jsx)(`label`,{className:`block text-body-small-default text-[var(--content-tertiary)]`,children:`Replacement profile`}),(0,Q.jsx)(h,{"aria-label":`Replacement profile`,value:n,onChange:r,options:[{value:``,label:`Select a replacement…`},...t.map(e=>({value:e.name,label:e.label??e.name}))]})]}),i&&(0,Q.jsx)(m,{variant:`body-small-default`,as:`p`,className:`text-(--system-negative-strong)`,children:i})]}),(0,Q.jsxs)(S.Footer,{children:[(0,Q.jsx)(p,{variant:`ghost`,size:`compact`,onClick:o,children:`Cancel`}),(0,Q.jsx)(p,{variant:`primary`,size:`compact`,disabled:!n||a,onClick:s,children:a?`Saving…`:`Reassign and Delete`})]})]})})}function Et({profile:e,isDragging:t,dropTarget:n,isDeleting:r,deleteError:i,isToggling:a,onDragStart:o,onDragEnd:s,onDragOver:c,onDragLeave:l,onDrop:u,onEditClick:d,onDeleteClick:f,onStatusToggle:h}){let g=e.source===`managed`,_=e.status!==`disabled`,y=e.name===Ge;return(0,Q.jsxs)(`div`,{className:`relative`,children:[n?.name===e.name&&!n.after&&(0,Q.jsx)(`div`,{className:`mx-0 h-0.5 rounded-full bg-[var(--border-active)]`}),(0,Q.jsxs)(`div`,{className:`flex items-center gap-2 rounded-lg pr-2 py-2${t?` opacity-50`:``}`,draggable:!g,onDragStart:o,onDragEnd:s,onDragOver:c,onDragLeave:l,onDrop:u,children:[(0,Q.jsx)(ft,{className:`h-4 w-4 shrink-0 ${g?`invisible`:`cursor-grab text-[var(--content-tertiary)]`}`}),(0,Q.jsxs)(`div`,{className:`min-w-0 flex-1${_?``:` opacity-55`}`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Q.jsx)(m,{variant:`body-medium-default`,as:`span`,className:`text-(--content-default)`,children:e.label??e.name}),g&&e.name!==`auto`&&(0,Q.jsx)(v,{tone:`positive`,title:`Managed by Platform — auth is locked, but you can rename or disable this profile.`,children:`Platform`})]}),e.description?(0,Q.jsx)(m,{variant:`body-medium-lighter`,as:`p`,className:`mt-0.5 text-(--content-tertiary)`,children:e.description}):null,e.model??e.provider?(0,Q.jsx)(m,{variant:`body-medium-lighter`,as:`p`,className:`mt-0.5 text-(--content-tertiary)`,children:e.model??e.provider}):null]}),(0,Q.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2`,children:[(0,Q.jsx)(`div`,{className:`flex shrink-0 items-center`,title:_?`Active — toggle to hide from pickers`:`Disabled — toggle to show in pickers`,children:(0,Q.jsx)(b,{checked:_,onChange:e=>h(e),disabled:a,"aria-label":`${_?`Disable`:`Enable`} ${e.label??e.name}`})}),(0,Q.jsxs)(`div`,{className:`flex w-[92px] items-center justify-end gap-2${y?` invisible`:``}`,children:[(0,Q.jsx)(p,{variant:`ghost`,size:`compact`,onClick:d,children:g?`View`:`Edit`}),(0,Q.jsx)(p,{variant:`ghost`,size:`compact`,iconOnly:(0,Q.jsx)(it,{}),"aria-label":`Delete ${e.label??e.name}`,disabled:g||r,title:g?`Managed profiles cannot be deleted`:void 0,onClick:f,tintColor:`var(--system-negative-strong)`})]})]})]}),n?.name===e.name&&n.after&&(0,Q.jsx)(`div`,{className:`mx-0 h-0.5 rounded-full bg-[var(--border-active)]`}),i?(0,Q.jsx)(m,{variant:`body-small-default`,as:`p`,className:`px-2 pb-1 text-(--system-negative-strong)`,children:i}):null,e.name===`auto`&&(0,Q.jsx)(`div`,{className:`mx-2 mt-1 border-b border-[var(--border-subtle)]`})]})}function Dt({isOpen:e,assistantId:t,onClose:n}){let{profiles:r,profileOrder:i,orderedProfiles:o,activeProfile:s,callSites:c}=lt(),l=X(),[d,f]=(0,Z.useState)(!1),[p,m]=(0,Z.useState)(null),{data:h}=u({...fe({path:{assistant_id:t}}),enabled:e}),g=h?.connections,_=Object.keys(r);async function v(e,t,n){let o=n?.mode??`replace`,s=!(e in r);if(o===`merge`&&!s){await l.mutateAsync({llm:{profiles:{[e]:t}}}),f(!1),m(null);return}let c={profiles:{[e]:t}};if(s&&(c.profileOrder=i.includes(e)?i:[...i,e]),s)await l.mutateAsync({llm:c});else{let t=r[e];await l.mutateAsync({llm:{profiles:{[e]:null}}});try{await l.mutateAsync({llm:c})}catch(n){throw a(n,{context:`settings-ai-profile-edit-recreate`}),t!=null&&await l.mutateAsync({llm:{profiles:{[e]:t}}}).catch(()=>{}),n}}s&&C.success(`Profile "${t.label??e}" created`),f(!1),m(null)}return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(S.Root,{open:e,onOpenChange:e=>{e||n()},children:e?(0,Q.jsx)(Ot,{profiles:r,profileOrder:i,orderedProfiles:o,activeProfile:s,callSiteOverrides:c,onClose:n,onEditClick:e=>{m(e),f(!0)},onNewClick:()=>{m(null),f(!0)}}):null}),(0,Q.jsx)(Te,{isOpen:d,mode:p?p.source===`managed`?`view`:`edit`:`create`,profileName:p?.name,initialValues:p??void 0,existingNames:_,connections:g,assistantId:t,onSave:v,onCancel:()=>{f(!1),m(null)}})]})}function Ot({profiles:e,profileOrder:t,orderedProfiles:n,activeProfile:r,callSiteOverrides:i,onClose:o,onEditClick:s,onNewClick:c}){let l=X(),[u,d]=(0,Z.useState)({}),[f,h]=(0,Z.useState)({}),[g,_]=(0,Z.useState)(new Set),[v,y]=(0,Z.useState)(null),[b,x]=(0,Z.useState)(null),[C,w]=(0,Z.useState)(null),[T,E]=(0,Z.useState)(null),D=(0,Z.useRef)(null),O=(0,Z.useRef)(null),[k,A]=(0,Z.useState)(null),[j,M]=(0,Z.useState)(null),[N,ee]=(0,Z.useState)(``),[P,F]=(0,Z.useState)(!1),I=ye.use.queryComplexityRouting(),L=(0,Z.useMemo)(()=>Le(n,I),[n,I]);async function R(t,n){if(g.has(t.name))return!1;_(e=>new Set(e).add(t.name)),y(null);let r=n?`active`:`disabled`;if(!e[t.name])return _(e=>{let n=new Set(e);return n.delete(t.name),n}),!1;try{return await l.mutateAsync({llm:{profiles:{[t.name]:{status:r}}}}),!0}catch(e){return a(e,{context:`settings-ai-profile-toggle`}),y(`Couldn't update "${t.label??t.name}". Please try again.`),!1}finally{_(e=>{let n=new Set(e);return n.delete(t.name),n})}}async function z(e){h(t=>({...t,[e]:!0})),d(t=>{let n={...t};return delete n[e],n});try{let n=t.filter(t=>t!==e);await l.mutateAsync({llm:{profiles:{[e]:null},profileOrder:n}})}catch(t){a(t,{context:`settings-ai-profile-delete`}),d(t=>({...t,[e]:`Failed to delete profile. Please try again.`}))}finally{h(t=>{let n={...t};return delete n[e],n})}}function B(e){let t=L.find(t=>t.name===e)?.label??e,n=e===r,a=Object.entries(i).filter(([t,n])=>t!==`mainAgent`&&n?.profile===e).map(([e])=>e);if(n||a.length>0){A({name:e,label:t,isActive:n,callSiteIds:a}),ee(``),M(null);return}z(e)}async function V(){if(!k||!N)return;F(!0),M(null);let e={};if(k.isActive&&(e.activeProfile=N),k.callSiteIds.length>0){let t={};for(let e of k.callSiteIds)t[e]={profile:N};e.callSites=t}if(Object.keys(e).length>0)try{await l.mutateAsync({llm:e})}catch(e){a(e,{context:`settings-ai-profile-reassign-delete`}),M(`Failed to reassign references. Please try again.`),F(!1);return}let t=k.name;A(null),F(!1),z(t)}async function H(e,n){if(e===n.name)return;E(null);let r=t.filter(t=>t!==e),i=r.indexOf(n.name);if(i===-1)return;n.after&&(i+=1);let o=[...r.slice(0,i),e,...r.slice(i)];try{await l.mutateAsync({llm:{profileOrder:o}})}catch(e){a(e,{context:`settings-ai-profile-reorder`}),E(`Failed to reorder profiles. Please try again.`)}}let U=L.filter(e=>e.name!==k?.name&&e.source!==`managed`),W=U.length>0?U:L.filter(e=>e.name!==k?.name);return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(S.Content,{size:`md`,children:[(0,Q.jsxs)(S.Header,{children:[(0,Q.jsx)(S.Title,{children:`Model Profiles`}),(0,Q.jsx)(S.Description,{children:`Bundle a provider and model into a named profile. Assign profiles to specific actions or swap between them when chatting.`})]}),(0,Q.jsxs)(S.Body,{children:[L.length===0?(0,Q.jsx)(m,{variant:`body-medium-lighter`,as:`p`,className:`py-4 text-center text-(--content-tertiary)`,children:`No profiles yet. Create one to get started.`}):(0,Q.jsx)(`div`,{className:`space-y-1`,children:L.map(e=>(0,Q.jsx)(Et,{profile:e,isDragging:b===e.name,dropTarget:C,isDeleting:f[e.name]??!1,deleteError:u[e.name],isToggling:g.has(e.name),onDragStart:t=>{D.current=e.name,x(e.name),t.dataTransfer&&(t.dataTransfer.effectAllowed=`move`)},onDragEnd:()=>{D.current=null,O.current=null,x(null),w(null)},onDragOver:t=>{t.preventDefault();let n=t.currentTarget.getBoundingClientRect(),r=t.clientY>n.top+n.height/2,i={name:e.name,after:r};O.current=i,w(i)},onDragLeave:t=>{t.currentTarget.contains(t.relatedTarget)||(O.current=null,w(t=>t?.name===e.name?null:t))},onDrop:e=>{e.preventDefault();let t=D.current,n=O.current;D.current=null,O.current=null,x(null),w(null),t&&n&&H(t,n)},onEditClick:()=>s(e),onDeleteClick:()=>B(e.name),onStatusToggle:t=>void R(e,t)},e.name))}),T&&(0,Q.jsx)(m,{variant:`body-small-default`,as:`p`,className:`mt-2 text-(--system-negative-strong)`,children:T}),v&&(0,Q.jsx)(m,{variant:`body-small-default`,as:`p`,className:`mt-2 text-(--system-negative-strong)`,children:v})]}),(0,Q.jsxs)(S.Footer,{className:`justify-between`,children:[(0,Q.jsx)(p,{variant:`outlined`,size:`compact`,onClick:c,children:`+ New Profile`}),(0,Q.jsx)(p,{variant:`outlined`,size:`compact`,onClick:o,children:`Done`})]})]}),(0,Q.jsx)(Tt,{blocked:k,availableReplacements:W,replacement:N,onReplacementChange:ee,error:j,saving:P,onClose:()=>{A(null),M(null)},onConfirm:()=>void V()})]})}function kt({mode:e,connection:t,assistantId:n,existingNames:r,onSave:i,onCancel:a}){let[o,s]=(0,Z.useState)(e),[c,u]=(0,Z.useState)(void 0),d=o===`managed-edit`,[f,g]=(0,Z.useState)(t?.label??``),[_,v]=(0,Z.useState)(t?.name??``),[b,x]=(0,Z.useState)(t?.provider??`anthropic`),[C,w]=(0,Z.useState)(()=>t?t.auth.type:`platform`),[T,E]=(0,Z.useState)(()=>t?.auth.type===`api_key`?t.auth.credential:t?``:`credential/anthropic/api_key`),[D,O]=(0,Z.useState)(t?.baseUrl??``),[k,A]=(0,Z.useState)(()=>t?.models?t.models.map(e=>e.id).join(`, `):``),[j,M]=(0,Z.useState)(!1),[N,P]=(0,Z.useState)(null),F=b===`openai-compatible`,I=(0,Z.useMemo)(()=>b&&!Fe.includes(b)?[...Fe,b]:Fe,[b]),{handleLabelChange:L,resetDirty:R}=Ee(o,g,v),[z,B]=(0,Z.useState)(``),[V,H]=(0,Z.useState)(!1),U=l(),W=(0,Z.useMemo)(()=>xe(T),[T]),te=C===`api_key`&&W!==null,{hasStoredCredential:G,isLoading:K,queryKey:ne}=$e({assistantId:n,credentialKind:`credential`,credentialName:W?`${W.service}:${W.field}`:``,enabled:te,errorContext:`settings-provider-editor-credential-presence`}),{credentials:re,queryKey:q}=Qe({assistantId:n,enabled:C===`api_key`});(0,Z.useEffect)(()=>{let e=t?.provider??`anthropic`;g(t?.label??``),v(t?.name??``),x(e),w(t?t.auth.type:`platform`),t?.auth.type===`api_key`?E(t.auth.credential):E(t?``:`credential/${e}/api_key`),R(),P(null),O(t?.baseUrl??``),A(t?.models?t.models.map(e=>e.id).join(`, `):``),B(``),H(!1)},[t,R]);function J(){s(`create`),u(b===`ollama`?`none`:`api_key`)}let Y=_.trim().length>0;async function ie(){if(Y){M(!0),P(null);try{let e;if(C===`api_key`){let t=T.trim()||`credential/${b}/api_key`,r=z.trim();if(r){H(!0);try{let e=xe(t);await le({path:{assistant_id:n},body:e?{type:`credential`,name:`${e.service}:${e.field}`,value:r}:{type:`api_key`,name:b,value:r},throwOnError:!0}),U.setQueryData(ne,!0),U.invalidateQueries({queryKey:q})}catch{P(`Failed to save API key. Please try again.`);return}finally{H(!1)}}e={type:`api_key`,credential:t}}else if(C===`oauth_subscription`)if(t?.auth.type===`oauth_subscription`)e=t.auth;else{P(`Use the "Sign in with ChatGPT" button to connect your subscription.`);return}else e=C===`none`?{type:`none`}:{type:`platform`};let r=f.trim()||null,a={auth:e,label:r,...F&&{base_url:D.trim()||null,models:k.trim()?k.split(`,`).map(e=>({id:e.trim()})).filter(e=>e.id):null}},{data:o,response:s}=await oe({path:{assistant_id:n,name:t?.name??_.trim()},body:a});if(!s?.ok){P(ke(s?.status,_.trim()));return}if(!o){P(`Server returned an empty response. Please try again.`);return}i(o)}catch{P(`Failed to save connection. Please try again.`)}finally{M(!1)}}}let ae=re.filter(e=>e.service===b),se=o!==`create`&&t?.auth.type===`api_key`,ce=ae.length>0||se,ue=Ne(`Enter your API key`,G);return o===`create`?(0,Q.jsx)(De,{variant:`modal`,assistantId:n,existingNames:r,defaultProviderType:b,defaultAuthType:c,onCreated:i,onCancel:a},b):(0,Q.jsxs)(S.Content,{size:`md`,children:[(0,Q.jsxs)(S.Header,{children:[(0,Q.jsx)(S.Title,{children:`Edit Connection`}),(0,Q.jsx)(S.Description,{children:d?`Managed by Vellum — auth is locked, but you can rename "${t?.name}".`:`Editing "${t?.name}".`})]}),(0,Q.jsxs)(S.Body,{className:`space-y-4`,children:[(0,Q.jsxs)(`div`,{className:`space-y-1`,children:[(0,Q.jsxs)(`label`,{className:`block text-body-small-default text-[var(--content-tertiary)]`,children:[`Display Name`,` `,(0,Q.jsx)(`span`,{className:`text-[var(--content-disabled)]`,children:`(optional)`})]}),(0,Q.jsx)(y,{value:f,onChange:e=>L(e.target.value),placeholder:`e.g. My Anthropic Key`,fullWidth:!0})]}),(0,Q.jsxs)(`div`,{className:`space-y-1`,children:[(0,Q.jsx)(`label`,{className:`block text-body-small-default text-[var(--content-tertiary)]`,children:`Key`}),(0,Q.jsx)(y,{value:_,placeholder:`e.g. anthropic-personal`,disabled:!0,fullWidth:!0})]}),(0,Q.jsxs)(`div`,{className:`space-y-1`,children:[(0,Q.jsx)(`label`,{className:`block text-body-small-default text-[var(--content-tertiary)]`,children:`Provider`}),(0,Q.jsx)(h,{"aria-label":`Provider`,value:b,onChange:e=>x(e),disabled:!0,options:I.map(e=>({value:e,label:tt[e]}))})]}),F&&(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`div`,{className:`space-y-1`,children:[(0,Q.jsx)(`label`,{className:`block text-body-small-default text-[var(--content-tertiary)]`,children:`Base URL`}),(0,Q.jsx)(y,{value:D,onChange:e=>O(e.target.value),placeholder:`https://api.example.com/v1`,disabled:d,fullWidth:!0})]}),(0,Q.jsxs)(`div`,{className:`space-y-1`,children:[(0,Q.jsx)(`label`,{className:`block text-body-small-default text-[var(--content-tertiary)]`,children:`Models`}),(0,Q.jsx)(y,{value:k,onChange:e=>A(e.target.value),placeholder:`model-1, model-2`,disabled:d,fullWidth:!0}),(0,Q.jsx)(m,{variant:`body-small-default`,as:`p`,className:`text-[var(--content-tertiary)]`,children:`Comma-separated model identifiers exposed by your endpoint.`})]})]}),(0,Q.jsxs)(`div`,{className:`space-y-1`,children:[(0,Q.jsx)(`label`,{className:`block text-body-small-default text-[var(--content-tertiary)]`,children:`Auth Type`}),(0,Q.jsx)(h,{"aria-label":`Auth type`,value:C,onChange:e=>{w(e),P(null)},disabled:d||b===`ollama`,options:(()=>{let e;return e=b===`ollama`?[`none`]:ee(b)?[`api_key`,`platform`]:[`api_key`],C&&!e.includes(C)&&e.push(C),e.map(e=>({value:e,label:je[e]}))})()})]}),C===`api_key`&&(0,Q.jsx)(Ve,{apiKeyValue:z,onApiKeyChange:B,credential:T,onCredentialChange:E,isAuthLocked:d,isLoadingCredential:K,apiKeyPlaceholder:ue,provider:b,providerCredentials:ae,showAdvancedSection:ce,onError:P}),C===`oauth_subscription`&&(0,Q.jsx)(Ye,{assistantId:n,onConnected:i}),N&&(0,Q.jsx)(m,{variant:`body-small-default`,as:`p`,className:`text-(--system-negative-strong)`,children:N})]}),(0,Q.jsxs)(S.Footer,{children:[(0,Q.jsx)(p,{variant:`ghost`,size:`compact`,onClick:a,children:`Cancel`}),o===`managed-edit`&&(0,Q.jsx)(p,{variant:`outlined`,size:`compact`,onClick:J,disabled:j||V,children:`Save as New`}),(0,Q.jsx)(p,{variant:`primary`,size:`compact`,disabled:!Y||j||V,onClick:()=>void ie(),children:j?`Saving…`:`Save`})]})]})}function At(e){switch(e.type){case`api_key`:return`API key · ${e.credential}`;case`oauth_subscription`:return`ChatGPT Subscription`;case`platform`:return`Managed proxy`;case`none`:return`None (local)`;default:return e.type}}function jt({isOpen:e,assistantId:t,onClose:n}){let[r,i]=(0,Z.useState)(!1),[a,o]=(0,Z.useState)(null),s=l(),{data:c,isLoading:d,isError:f}=u({...fe({path:{assistant_id:t}}),enabled:e}),p=(0,Z.useMemo)(()=>c?.connections??[],[c]);function m(e){s.invalidateQueries({queryKey:ue({path:{assistant_id:t}})}),i(!1),o(null)}let h=p.map(e=>e.name),g=()=>{i(!1),o(null)};return(0,Q.jsx)(S.Root,{open:e,onOpenChange:e=>{e||(r?g():n())},children:e?r?(0,Q.jsx)(kt,{mode:a?a.isManaged?`managed-edit`:`edit`:`create`,connection:a??void 0,assistantId:t,existingNames:h,onSave:m,onCancel:g}):(0,Q.jsx)(Mt,{connections:p,loading:d,isError:f,assistantId:t,onClose:n,onEditClick:e=>{o(e),i(!0)},onNewClick:()=>{o(null),i(!0)},onConnectionDeleted:()=>{s.invalidateQueries({queryKey:ue({path:{assistant_id:t}})})}}):null})}function Mt({connections:e,loading:t,isError:n,assistantId:r,onClose:i,onEditClick:a,onNewClick:o,onConnectionDeleted:s}){let[c,l]=(0,Z.useState)({}),[u,d]=(0,Z.useState)({});async function f(e){d(t=>({...t,[e]:!0})),l(t=>{let n={...t};return delete n[e],n});try{let{response:t}=await ae({path:{assistant_id:r,name:e}});t?.ok||t?.status===404?s(e):t?.status===409?l(t=>({...t,[e]:`Connection is in use by one or more profiles. Remove those references first.`})):l(t=>({...t,[e]:`Failed to delete connection. Please try again.`}))}catch{l(t=>({...t,[e]:`Failed to delete connection. Please try again.`}))}finally{d(t=>{let n={...t};return delete n[e],n})}}return(0,Q.jsxs)(S.Content,{size:`md`,children:[(0,Q.jsxs)(S.Header,{children:[(0,Q.jsx)(S.Title,{children:`Provider Connections`}),(0,Q.jsx)(S.Description,{children:`Manage inference provider connections. Each connection binds a name to a provider and auth configuration.`})]}),(0,Q.jsx)(S.Body,{children:t?(0,Q.jsx)(`div`,{className:`space-y-2 py-2`,children:[1,2,3].map(e=>(0,Q.jsx)(`div`,{className:`h-10 animate-pulse rounded-lg bg-[var(--surface-active)]`},e))}):n?(0,Q.jsx)(m,{variant:`body-medium-default`,as:`p`,className:`py-4 text-center text-(--system-negative-strong)`,children:`Failed to load connections. Please try again.`}):e.length===0?(0,Q.jsx)(m,{variant:`body-medium-lighter`,as:`p`,className:`py-4 text-center text-(--content-tertiary)`,children:`No connections yet. Create one to get started.`}):(0,Q.jsx)(`div`,{className:`space-y-1`,children:e.map(e=>{let t=u[e.name]??!1,n=c[e.name],r=e.isManaged??!1;return(0,Q.jsxs)(`div`,{children:[(0,Q.jsxs)(`div`,{className:`flex items-center gap-3 rounded-lg px-2 py-2`,children:[(0,Q.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Q.jsx)(m,{variant:`body-medium-default`,as:`span`,className:`text-(--content-default)`,children:e.label??e.name}),r&&(0,Q.jsx)(v,{tone:`positive`,title:`Managed by Platform — auth is locked, but you can rename this connection.`,children:`Platform`})]}),(0,Q.jsxs)(m,{variant:`body-medium-lighter`,as:`p`,className:`mt-0.5 text-(--content-tertiary)`,children:[e.label?`${e.name} · `:``,tt[e.provider]??e.provider,` · `,At(e.auth)]})]}),(0,Q.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2`,children:[(0,Q.jsx)(p,{variant:`ghost`,size:`compact`,onClick:()=>a(e),children:`Edit`}),(0,Q.jsx)(p,{variant:`ghost`,size:`compact`,iconOnly:(0,Q.jsx)(it,{}),"aria-label":`Delete ${e.name}`,disabled:r||t,title:r?`Managed connections cannot be deleted`:void 0,onClick:()=>void f(e.name),tintColor:`var(--system-negative-strong)`})]})]}),n?(0,Q.jsx)(m,{variant:`body-small-default`,as:`p`,className:`px-2 pb-1 text-(--system-negative-strong)`,children:n}):null]},e.name)})})}),(0,Q.jsxs)(S.Footer,{className:`justify-between`,children:[(0,Q.jsx)(p,{variant:`outlined`,size:`compact`,onClick:o,children:`+ New Connection`}),(0,Q.jsx)(p,{variant:`outlined`,size:`compact`,onClick:i,children:`Done`})]})]})}function Nt(e){let[t,n]=(0,Z.useState)(void 0);return(0,Z.useEffect)(()=>{t!==void 0&&e===t.value&&n(void 0)},[e,t]),[t===void 0?e:t.value,(0,Z.useCallback)(e=>n(e===void 0?void 0:{value:e}),[])]}function Pt(){let{assistantId:e,orderedProfiles:t,activeProfile:n,callSites:r}=lt(),i=X(),[o,s]=Nt(n),[c,l]=(0,Z.useState)(!1),[u,d]=(0,Z.useState)(!1),[f,g]=(0,Z.useState)(!1),_=ye.use.queryComplexityRouting(),v=(0,Z.useMemo)(()=>Le(ze(t,[o]),_),[t,o,_]),y=Object.entries(r).filter(([e,t])=>e!==`mainAgent`&&(t?.profile!=null||t?.provider!=null||t?.model!=null)).length,b=y===1?`1 Override`:y>0?`${y} Overrides`:`Overrides`,x=o!==n,S=(0,Z.useCallback)(async()=>{try{await i.mutateAsync({llm:{activeProfile:o}}),C.success(`Profile saved.`)}catch(e){C.error(`Failed to switch profile. Please try again.`),a(e,{context:`settings-ai-language-model-save`})}},[o,i]);return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(gt,{title:`Language Model`,subtitle:`Configure the LLMs that power your assistant`,children:(0,Q.jsxs)(`div`,{className:`space-y-4`,children:[(0,Q.jsxs)(`div`,{className:`space-y-1`,children:[(0,Q.jsx)(`label`,{className:`block text-body-small-default text-[var(--content-tertiary)]`,children:`Default Profile`}),(0,Q.jsx)(h,{value:o??``,onChange:e=>{s(e===``?null:e)},placeholder:`Select a default profile…`,options:v.map(e=>({value:e.name,label:e.name===`auto`?`Automatically switch between profiles`:Xe(e)}))}),_&&o===`auto`&&(0,Q.jsx)(`div`,{className:`flex items-center gap-2 rounded-lg bg-[var(--surface-warning-subtle)] px-3 py-2`,children:(0,Q.jsx)(`span`,{className:`text-body-small-default text-[var(--content-warning)]`,children:`Auto may use more powerful models when needed, which can increase costs.`})}),v.length===0?(0,Q.jsx)(m,{variant:`body-small-default`,as:`p`,className:`mt-1 text-(--content-tertiary)`,children:`No profiles yet. Click Profiles below to create one.`}):null]}),(0,Q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Q.jsx)(p,{variant:`outlined`,size:`compact`,onClick:()=>g(!0),children:`Providers`}),(0,Q.jsx)(p,{variant:`outlined`,size:`compact`,onClick:()=>l(!0),children:`Profiles`}),(0,Q.jsx)(p,{variant:`outlined`,size:`compact`,onClick:()=>d(!0),children:b})]}),x&&(0,Q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Q.jsx)($,{onClick:S,disabled:i.isPending}),i.isPending&&(0,Q.jsx)(O,{className:`h-4 w-4 animate-spin text-[var(--content-disabled)]`})]})]})}),e&&(0,Q.jsx)(Dt,{isOpen:c,assistantId:e,onClose:()=>l(!1)}),e&&(0,Q.jsx)(Ct,{isOpen:u,onClose:()=>d(!1),assistantId:e}),e&&(0,Q.jsx)(jt,{isOpen:f,assistantId:e,onClose:()=>g(!1)})]})}function Ft(){let{assistantId:e,config:i}=lt(),o=X(),s=ct(),c=l(),{serverWebSearchMode:u,serverWebSearchProvider:d}=(0,Z.useMemo)(()=>{if(!i)return{serverWebSearchMode:n(F,`your-own`),serverWebSearchProvider:n(A,`inference-provider-native`)};let e=i.services?.[`web-search`],t=e?.mode;return{serverWebSearchMode:t===`managed`||t===`your-own`?t:n(F,`your-own`),serverWebSearchProvider:e?.provider||n(`vellum:ai:webSearchProvider`,`inference-provider-native`)}},[i]),[f,p]=(0,Z.useState)(!1),[m,g]=Nt(u),[_,v]=Nt(d),[b,x]=(0,Z.useState)(``),S=ne.has(_),{hasStoredCredential:w,queryKey:T}=$e({assistantId:e,credentialKind:`api_key`,credentialName:_,enabled:S,errorContext:`settings-ai-web-search-read-credential`}),E=b.trim().length>0,D=f||m===`your-own`&&S&&!w&&!E||!(m!==u||(m===`managed`?`inference-provider-native`:_)!==d)&&!E,k=Ne(re[_]??`Enter your API key`,w),j=(0,Z.useCallback)(async()=>{p(!0);let e=b.trim(),t=m===`managed`?`inference-provider-native`:_,n=L(t),i=m===`your-own`&&S&&e.length>0;try{i&&await s(t,e),await o.mutateAsync({services:{"web-search":{mode:m,provider:t}}}).catch(e=>{throw C.error(`Failed to update assistant configuration. Please try again.`),a(e,{context:`patch_daemon_config`}),e})}catch{p(!1);return}p(!1);try{r(F,m),r(A,t),i&&(n&&r(n,e),c.setQueryData(T,!0),c.invalidateQueries({queryKey:T}),x(``)),C.success(`Web search settings saved.`)}catch(e){a(e,{context:`settings-ai-web-search-persist-local`}),C.error(`Saved, but local preferences could not be written.`)}},[S,o,s,c,T,b,m,_]),M=(0,Z.useCallback)(()=>{let e=L(_);e&&t(e),x(``),v(`inference-provider-native`),r(A,`inference-provider-native`)},[_,v]);return(0,Q.jsx)(mt,{title:`Web Search`,subtitle:`Configure how your assistant should search the web`,mode:m,onModeChange:e=>g(e),children:m===`managed`?(0,Q.jsxs)(`div`,{className:`space-y-3`,children:[(0,Q.jsx)(`p`,{className:`text-body-medium-lighter text-[var(--content-tertiary)]`,children:`Web search is included with managed inference.`}),(0,Q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Q.jsx)($,{onClick:j,disabled:D}),f&&(0,Q.jsx)(O,{className:`h-4 w-4 animate-spin text-[var(--content-disabled)]`})]})]}):(0,Q.jsxs)(`div`,{className:`space-y-4`,children:[(0,Q.jsxs)(`div`,{className:`space-y-1`,children:[(0,Q.jsx)(`label`,{className:`block text-body-small-default text-[var(--content-tertiary)]`,children:`Provider`}),(0,Q.jsx)(h,{value:_,onChange:v,options:te.map(e=>({value:e,label:z[e]??e}))})]}),S&&(0,Q.jsx)(y,{label:`API Key`,type:`password`,value:b,onChange:e=>x(e.target.value),placeholder:k,fullWidth:!0}),(0,Q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Q.jsx)($,{onClick:j,disabled:D}),f&&(0,Q.jsx)(O,{className:`h-4 w-4 animate-spin text-[var(--content-disabled)]`}),S&&(0,Q.jsx)(ht,{onClick:M,filled:!0})]})]})})}function It({assistantId:e,assistantHandle:t,emailRootDomain:n}){let r=l(),i=s(),[o,f]=c(),[m,h]=(0,Z.useState)(``),[v,y]=(0,Z.useState)(!1),[b,x]=(0,Z.useState)(null),[S,w]=(0,Z.useState)(``),[D,k]=(0,Z.useState)(null),[A,j]=(0,Z.useState)(!1),[M,N]=(0,Z.useState)(!1),[ee,P]=(0,Z.useState)(!1);(0,Z.useEffect)(()=>{v||!t||m||(h(t),y(!0))},[t,v,m]);let F=u({...Ke(),enabled:!0}),I=F.data,L=I?.entitlements,R=L?.managed_email===!0,z=!!L&&!R,B=!I&&F.isError&&!F.isFetching,V=u({...He({path:{assistant_id:e}}),enabled:!z}),H=u({...Ie({path:{assistant_id:e}}),enabled:!z}),U=V.data?.results?.[0],W=H.data?.results?.[0],te=U?`${U.subdomain}.${n}`:null,G=u({...at({path:{assistant_id:e,id:W?.id??``}}),enabled:!!W?.id,refetchOnWindowFocus:!1}),K=u({...Je({path:{assistant_id:e,id:U?.id??``}}),enabled:!!U?.id,refetchInterval:e=>{let t=e.state.data?.status;return t===`verified`||t===`failed`?!1:1e4},refetchOnWindowFocus:!0});(0,Z.useEffect)(()=>{o.get(`release`)!==`1`||!U||W||(N(!0),f(e=>{let t=new URLSearchParams(e);return t.delete(`release`),t},{replace:!0}))},[W,U,o,f]);let ne=d(nt()),re=d(Be()),q=d(We()),J=d(Ue()),Y=(0,Z.useCallback)(()=>{let t={assistant_id:e};r.invalidateQueries({queryKey:Ze({path:t})}),r.invalidateQueries({queryKey:rt({path:t})}),W?.id&&r.invalidateQueries({queryKey:Re({path:{...t,id:W.id}})}),r.invalidateQueries({queryKey:Se()})},[W?.id,e,r]),ie=(0,Z.useCallback)(async()=>{let t=m.trim().toLowerCase();if(!t){x(`Enter a subdomain.`);return}j(!1);try{await ne.mutateAsync({path:{assistant_id:e},body:{subdomain:t}}),h(``),x(null),Y(),C.success(`Domain ${t}.${n} registered.`)}catch(e){x(me(e,void 0,`Failed to register domain.`))}},[e,n,Y,ne,m]),ae=(0,Z.useCallback)(async()=>{let t=S.trim().toLowerCase();if(!t){k(`Enter an email username.`);return}try{await q.mutateAsync({path:{assistant_id:e},body:{username:t}}),w(``),k(null),Y(),C.success(`Email address created.`)}catch(e){k(me(e,void 0,`Failed to create email address.`))}},[e,Y,q,S]),oe=(0,Z.useCallback)(async()=>{if(W?.id){P(!1);try{await J.mutateAsync({path:{assistant_id:e,id:W.id}}),Y(),C.success(`Email address removed.`)}catch(e){a(e,{context:`email_address_delete`}),C.error(`Failed to remove email address.`)}}},[W?.id,e,J,Y]),se=(0,Z.useCallback)(async()=>{if(!U?.id)return;if(W){C.error(`Remove the email address first.`);return}N(!1);let t=U.subdomain;try{await re.mutateAsync({path:{assistant_id:e,id:U.id}}),h(t),Y(),C.success(`Domain released.`)}catch(e){a(e,{context:`email_domain_release`}),C.error(`Failed to release domain.`)}},[W,e,re,U?.id,U?.subdomain,Y]);if(F.isLoading)return(0,Q.jsxs)(`div`,{className:`flex items-center gap-2 text-body-small-default text-[var(--content-tertiary)]`,children:[(0,Q.jsx)(O,{className:`h-4 w-4 animate-spin`}),`Checking subscription…`]});if(z)return(0,Q.jsxs)(_,{tone:`info`,icon:(0,Q.jsx)(T,{className:`h-4 w-4`,"aria-hidden":!0}),title:`Get a dedicated email address for your assistant`,actions:(0,Q.jsx)(p,{size:`compact`,onClick:()=>i(`${he.settings.billing}?adjust_plan`),children:`Upgrade to Pro`}),children:[`Pro plans include a managed`,` `,`<your-subdomain>.${n}`,` inbox — no provider setup required. Or switch to `,(0,Q.jsx)(`strong`,{children:`Your Own`}),` to bring an existing provider.`]});let ce=B?(0,Q.jsx)(_,{tone:`warning`,title:`Couldn't verify subscription status`,actions:(0,Q.jsx)(p,{size:`compact`,variant:`outlined`,onClick:()=>F.refetch(),children:`Retry`}),children:`We couldn't reach the billing service. The form below assumes managed email is enabled for your org — if it isn't, registering a domain will fail.`}):null;return U?W?(0,Q.jsxs)(`div`,{className:`space-y-4`,children:[ce,(0,Q.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,Q.jsx)(`label`,{className:`block text-body-small-default text-[var(--content-tertiary)]`,children:`Address`}),(0,Q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Q.jsx)(`span`,{className:`font-mono text-body-small-default text-[var(--content-default)]`,children:W.address}),(0,Q.jsx)(vt,{status:K.data?.status,message:K.data?.message,isLoading:K.isLoading}),(0,Q.jsx)(p,{variant:`dangerGhost`,size:`compact`,iconOnly:(0,Q.jsx)(it,{}),onClick:()=>P(!0),disabled:J.isPending,"aria-label":`Remove email address`})]}),(0,Q.jsx)(g,{open:ee,title:`Remove Email Address`,message:(0,Q.jsxs)(Q.Fragment,{children:[`Are you sure you want to remove `,(0,Q.jsx)(`code`,{className:`rounded bg-[var(--surface-active)] px-1 py-0.5 font-mono text-[0.9em]`,children:W.address}),`? Your assistant will no longer be able to send or receive email at this address.`]}),confirmLabel:`Remove`,destructive:!0,onConfirm:oe,onCancel:()=>P(!1)})]}),G.data?.usage&&(0,Q.jsxs)(`p`,{className:`text-body-small-default text-[var(--content-tertiary)]`,children:[G.data.usage.sent_today,` /`,` `,G.data.usage.daily_limit,` sent today ·`,` `,G.data.usage.received_today,` received`]})]}):(0,Q.jsxs)(`div`,{className:`space-y-4`,children:[ce,(0,Q.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,Q.jsx)(`label`,{className:`block text-body-small-default text-[var(--content-tertiary)]`,children:`Domain`}),(0,Q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Q.jsxs)(`span`,{className:`font-mono text-body-small-default text-[var(--content-default)]`,children:[U.subdomain,`.`,n]}),(0,Q.jsx)(vt,{status:K.data?.status,message:K.data?.message,isLoading:K.isLoading}),(0,Q.jsx)(p,{variant:`dangerGhost`,size:`compact`,iconOnly:(0,Q.jsx)(it,{}),onClick:()=>N(!0),disabled:re.isPending,"aria-label":`Release domain`})]}),(0,Q.jsx)(g,{open:M,title:`Release Domain`,message:(0,Q.jsxs)(Q.Fragment,{children:[`Are you sure you want to release `,(0,Q.jsxs)(`code`,{className:`rounded bg-[var(--surface-active)] px-1 py-0.5 font-mono text-[0.9em]`,children:[U.subdomain,`.`,n]}),`? The subdomain will become available for others to claim.`]}),confirmLabel:`Release`,destructive:!0,onConfirm:se,onCancel:()=>N(!1)})]}),(0,Q.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,Q.jsx)(`label`,{className:`block text-body-small-default text-[var(--content-tertiary)]`,children:`Email address`}),(0,Q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Q.jsxs)(`div`,{className:`flex h-9 min-w-0 flex-1 items-center rounded-md border bg-[var(--field-bg)] text-body-medium-lighter transition-[border-color] duration-150 ${D?`border-[var(--system-negative-strong)]`:`border-[var(--field-border)] focus-within:border-[var(--border-active)]`}`,children:[(0,Q.jsx)(`input`,{value:S,onChange:e=>{w(e.target.value.toLowerCase()),D&&k(null)},placeholder:`hi`,"aria-label":`Email username`,"aria-invalid":!!D,className:`h-full min-w-0 flex-1 bg-transparent pl-3 pr-1 text-[var(--content-default)] placeholder:text-[var(--content-tertiary)] outline-none`}),(0,Q.jsxs)(`span`,{className:`shrink-0 pr-3 font-mono text-[var(--content-secondary)]`,children:[`@`,te]})]}),(0,Q.jsx)(p,{onClick:ae,disabled:q.isPending||!S.trim(),children:q.isPending?`Creating…`:`Create`})]}),D&&(0,Q.jsx)(`p`,{className:`text-body-small-default text-[var(--system-negative-strong)]`,children:D})]})]}):(0,Q.jsxs)(`div`,{className:`space-y-3`,children:[ce,(0,Q.jsx)(`label`,{className:`block text-body-small-default text-[var(--content-tertiary)]`,children:`Subdomain`}),(0,Q.jsx)(E,{subdomain:m,onSubdomainChange:e=>{h(e),b&&x(null)},domainSuffix:n,subdomainPlaceholder:`my-assistant`,error:b}),(0,Q.jsx)(`p`,{className:`text-body-small-default text-[var(--content-tertiary)]`,children:`Each assistant gets its own subdomain. Lowercase letters, numbers, and hyphens only.`}),(0,Q.jsx)(p,{onClick:()=>j(!0),disabled:ne.isPending||!m.trim(),children:ne.isPending?`Registering…`:`Register`}),(0,Q.jsx)(g,{open:A,title:`Set Subdomain`,message:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`code`,{className:`rounded bg-[var(--surface-active)] px-1 py-0.5 font-mono text-[0.9em]`,children:m.trim().toLowerCase()||`subdomain`}),` will also become your assistant's public handle. You won't be able to change it once set.`]}),confirmLabel:`Confirm`,onConfirm:ie,onCancel:()=>j(!1)})]})}function Lt(){let e=ot(),t=ge(),{data:o}=u({...Ae(),enabled:t}),s=o?.results?.[0]?.handle,c=dt.use.emailRootDomain(),l=Ce(),[d,f]=(0,Z.useState)(()=>l===`gated`?`your-own`:n(I,`managed`)),[p,m]=(0,Z.useState)(()=>n(H,`resend`)),g=u({queryKey:[`byoEmailCredential`,e,p],queryFn:async()=>{let{data:t}=await ce({path:{assistant_id:e},body:{service:p,field:`api_key`},throwOnError:!0});return t},enabled:d===`your-own`||l===`gated`,staleTime:6e4,retry:i,meta:{errorContext:`byo_email_credential_check`}});(0,Z.useEffect)(()=>{g.error&&a(g.error,{context:`byo_email_credential_check`,bestEffort:!0})},[g.error]);let v=g.data?.hasSecret===!0,y=(0,Z.useCallback)(e=>{f(e),r(I,e)},[]),b=(0,Z.useCallback)(()=>{r(H,p),C.success(`Email settings saved.`)},[p]),x=(0,Z.useMemo)(()=>V.find(e=>e.id===p)??V[0],[p]),S=(0,Q.jsxs)(`div`,{className:`flex items-start gap-2 rounded-lg border border-[var(--border-subtle)] bg-[var(--surface-sunken)] p-3 text-body-small-default text-[var(--content-tertiary)]`,children:[(0,Q.jsx)(qe,{className:`mt-0.5 h-3.5 w-3.5 shrink-0 text-[var(--system-positive-strong)]`}),(0,Q.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,Q.jsxs)(`span`,{children:[`Configure `,x.displayName,` via the assistant CLI: ask the assistant to run the`,` `,(0,Q.jsx)(`code`,{className:`rounded bg-[var(--surface-active)] px-1 py-0.5 text-[12px]`,children:x.setupSkill}),` `,`skill. It walks you through storing the API key, detecting the domain, and (optionally) wiring up an inbound webhook.`]}),(0,Q.jsxs)(`a`,{href:x.docsUrl,target:`_blank`,rel:`noopener noreferrer`,className:`inline-flex items-center gap-1 text-[var(--system-positive-strong)] underline hover:opacity-80`,children:[`Open `,x.displayName,(0,Q.jsx)(D,{className:`h-3 w-3`})]})]})]}),w=(0,Q.jsxs)(`div`,{className:`space-y-4`,children:[(0,Q.jsxs)(`div`,{className:`space-y-1`,children:[(0,Q.jsx)(`label`,{className:`block text-body-small-default text-[var(--content-tertiary)]`,children:`Provider`}),(0,Q.jsx)(h,{value:p,onChange:e=>m(e),options:V.map(e=>({value:e.id,label:e.displayName}))})]}),v?(0,Q.jsxs)(`div`,{className:`space-y-3`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center gap-2 rounded-lg border border-[var(--system-positive-subtle)] bg-[var(--surface-sunken)] p-3 text-body-small-default text-[var(--content-default)]`,children:[(0,Q.jsx)(Me,{className:`h-4 w-4 shrink-0 text-[var(--system-positive-strong)]`}),(0,Q.jsxs)(`span`,{children:[x.displayName,` API key configured. To reconfigure, run the`,` `,(0,Q.jsx)(`code`,{className:`rounded bg-[var(--surface-active)] px-1 py-0.5 text-[12px]`,children:x.setupSkill}),` `,`skill.`]})]}),(0,Q.jsxs)(`a`,{href:x.docsUrl,target:`_blank`,rel:`noopener noreferrer`,className:`inline-flex items-center gap-1 text-body-small-default text-[var(--system-positive-strong)] underline hover:opacity-80`,children:[`Open `,x.displayName,(0,Q.jsx)(D,{className:`h-3 w-3`})]})]}):S,(0,Q.jsx)(`div`,{className:`flex items-center gap-2`,children:(0,Q.jsx)($,{onClick:b,disabled:!1})})]});return l===`gated`?(0,Q.jsx)(gt,{id:`email`,title:`Email`,subtitle:`Configure how your assistant sends and receives email`,children:w}):(0,Q.jsx)(mt,{id:`email`,title:`Email`,subtitle:`Configure how your assistant sends and receives email`,mode:d,onModeChange:y,children:d===`managed`?(0,Q.jsx)(`div`,{className:`space-y-4`,children:l===`disabled`?(0,Q.jsx)(_,{tone:`info`,children:`Log in to the Vellum platform to manage email settings.`}):(0,Q.jsx)(It,{assistantId:e,assistantHandle:s,emailRootDomain:c})}):w})}function Rt(){let{config:e}=lt(),{resolveAssistantId:t}=ut(),i=l(),o=X(),s=ct(),[c,u]=Nt((0,Z.useMemo)(()=>{if(!e)return n(q,`your-own`);let t=e.services?.[`image-generation`]?.mode;return t===`managed`||t===`your-own`?t:n(q,`your-own`)},[e])),[d,f]=(0,Z.useState)(()=>n(ie,`gemini-3.1-flash-image-preview`)),[p,m]=(0,Z.useState)(``),[g,_]=(0,Z.useState)(!1),v=(0,Z.useCallback)(async()=>{_(!0);let e=p.trim(),n=c===`your-own`&&e.length>0;try{n&&await s(`gemini`,e),await o.mutateAsync({services:{"image-generation":{mode:c}}}).catch(e=>{throw C.error(`Failed to update assistant configuration. Please try again.`),a(e,{context:`patch_daemon_config`}),e});let r=await t();try{await se({path:{assistant_id:r},body:{modelId:d},throwOnError:!0})}catch(e){throw C.error(`Failed to update image generation model. Please try again.`),a(e,{context:`set_image_gen_model`}),e}finally{i.invalidateQueries({queryKey:_e(r)})}}catch{_(!1);return}_(!1);try{r(q,c),r(ie,d),n&&m(``),C.success(`Image generation settings saved.`)}catch(e){a(e,{context:`settings-ai-image-gen-persist-local`}),C.error(`Saved, but local preferences could not be written.`)}},[p,c,d,o,s,t,i]),b=(0,Z.useCallback)(()=>{m(``),f(`gemini-3.1-flash-image-preview`),r(ie,`gemini-3.1-flash-image-preview`)},[]);return(0,Q.jsx)(mt,{title:`Image Generation`,subtitle:`Configure which model your assistant uses to generate images`,mode:c,onModeChange:e=>u(e),children:c===`managed`?(0,Q.jsxs)(`div`,{className:`space-y-3`,children:[(0,Q.jsx)(`label`,{className:`block text-body-small-default text-[var(--content-tertiary)]`,children:`Active Model`}),(0,Q.jsxs)(`div`,{className:`flex items-end gap-3`,children:[(0,Q.jsx)(h,{className:`flex-1`,value:d,onChange:f,options:B.map(e=>({value:e,label:K[e]??e}))}),(0,Q.jsx)($,{onClick:v,disabled:g}),g&&(0,Q.jsx)(O,{className:`h-4 w-4 animate-spin text-[var(--content-disabled)]`})]})]}):(0,Q.jsxs)(`div`,{className:`space-y-4`,children:[(0,Q.jsx)(y,{label:`API Key`,type:`password`,value:p,onChange:e=>m(e.target.value),placeholder:`Enter your Gemini API key`,fullWidth:!0}),(0,Q.jsxs)(`div`,{className:`space-y-1`,children:[(0,Q.jsx)(`label`,{className:`block text-body-small-default text-[var(--content-tertiary)]`,children:`Active Model`}),(0,Q.jsx)(h,{value:d,onChange:f,options:B.map(e=>({value:e,label:K[e]??e}))})]}),(0,Q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Q.jsx)($,{onClick:v,disabled:g}),g&&(0,Q.jsx)(O,{className:`h-4 w-4 animate-spin text-[var(--content-disabled)]`}),(0,Q.jsx)(ht,{onClick:b})]})]})})}async function zt(e){let{provider:t,apiKey:n,voiceId:r,text:i}=e;if(n.trim().length===0)return{kind:`error`,message:`Save an API key for this provider first.`};try{return t===`elevenlabs`?await Bt(n,r,i):t===`deepgram`?await Vt(n,i):t===`fish-audio`?{kind:`unsupported`,message:`Fish Audio TTS is only supported in the desktop app today. Use ElevenLabs or Deepgram to test from the browser.`}:t===`xai`?{kind:`unsupported`,message:`xAI TTS is only supported in the desktop app today. Use ElevenLabs or Deepgram to test from the browser.`}:{kind:`unsupported`,message:`TTS testing for "${t}" is not supported from the browser yet.`}}catch(e){return{kind:`error`,message:e instanceof Error?e.message:`Failed to reach the TTS provider.`}}}async function Bt(e,t,n){let r=t.trim();if(r.length===0)return{kind:`error`,message:`Enter and save a Voice ID before testing ElevenLabs.`};let i=await fetch(`https://api.elevenlabs.io/v1/text-to-speech/${encodeURIComponent(r)}?output_format=mp3_44100_128`,{method:`POST`,headers:{"xi-api-key":e,"Content-Type":`application/json`,Accept:`audio/mpeg`},body:JSON.stringify({text:n,model_id:`eleven_turbo_v2_5`})});return i.ok?{kind:`audio`,blob:await i.blob()}:{kind:`error`,message:await Ht(i,`ElevenLabs rejected the request.`)}}async function Vt(e,t){let n=await fetch(`https://api.deepgram.com/v1/speak?model=aura-2-thalia-en`,{method:`POST`,headers:{Authorization:`Token ${e}`,"Content-Type":`application/json`,Accept:`audio/mpeg`},body:JSON.stringify({text:t})});return n.ok?{kind:`audio`,blob:await n.blob()}:{kind:`error`,message:await Ht(n,`Deepgram rejected the request.`)}}async function Ht(e,t){try{let n=await e.text();if(n.length===0)return`${t} (HTTP ${e.status})`;try{let e=JSON.parse(n);if(e&&typeof e==`object`&&`detail`in e&&typeof e.detail==`string`)return e.detail;if(e&&typeof e==`object`&&`message`in e&&typeof e.message==`string`)return e.message}catch{}return n.slice(0,200)}catch{return`${t} (HTTP ${e.status})`}}function Ut(){let e=ot(),t=ve.use.name()??`your assistant`,i=ge(),{data:a}=u({...de({path:{assistant_id:e}}),enabled:i,staleTime:1/0}),o=a?.providers??W,s=o[0]?.id??`elevenlabs`,[c,l]=(0,Z.useState)(()=>n(k,s)),[d,f]=(0,Z.useState)(c),[m,g]=(0,Z.useState)(``),[_,v]=(0,Z.useState)(``),[b,x]=(0,Z.useState)(``),[S,w]=(0,Z.useState)(!1),[T,E]=(0,Z.useState)(!1),D=(0,Z.useMemo)(()=>o.find(e=>e.id===c)??o[0],[c,o]),O=(0,Z.useCallback)(e=>{let t=n(P+e,``),r=n(J+e,``);w(t.length>0),v(r),x(r),g(``)},[]);(0,Z.useEffect)(()=>{O(c)},[c,O]);let A=(0,Z.useMemo)(()=>{let e=c!==d,t=m.trim().length>0,n=_.trim()!==b;return e||t||n},[c,d,m,_,b]),j=(0,Z.useCallback)(()=>{r(k,c);let e=m.trim();e.length>0&&(r(P+c,e),w(!0));let t=_.trim();r(J+c,t),f(c),x(t),g(``)},[c,m,_]),M=(0,Z.useCallback)(()=>{r(P+c,``),w(!1),g(``)},[c]),N=(0,Z.useCallback)(async()=>{E(!0);try{let e=n(P+c,``),r=m.trim(),i=r.length>0?r:e;if(i.length===0){C.error(`Save an API key for this provider before testing.`);return}let a=n(J+c,``),o=_.trim(),s=await zt({provider:c,apiKey:i,voiceId:o.length>0?o:a,text:`Hey! It's ${t}. How does this sound?`});if(s.kind!==`audio`){C.error(s.message);return}let l=URL.createObjectURL(s.blob);try{let e=new Audio(l);await e.play(),await new Promise(t=>{e.onended=()=>t(),e.onerror=()=>t()})}finally{URL.revokeObjectURL(l)}}finally{E(!1)}},[t,m,c,_]),ee=S?`•••••••• (Enter a new key to replace)`:D.apiKeyPlaceholder;return(0,Q.jsx)(gt,{title:`Text-to-Speech`,subtitle:D.subtitle,children:(0,Q.jsxs)(`div`,{className:`space-y-4`,children:[(0,Q.jsxs)(`div`,{className:`space-y-1`,children:[(0,Q.jsx)(`label`,{className:`block text-body-small-default text-[var(--content-tertiary)]`,children:`Provider`}),(0,Q.jsx)(h,{value:c,onChange:l,options:o.map(e=>({value:e.id,label:e.displayName})),"aria-label":`TTS provider`})]}),(0,Q.jsxs)(`div`,{className:`space-y-1`,children:[(0,Q.jsx)(`label`,{className:`block text-body-small-default text-[var(--content-tertiary)]`,children:`API Key`}),(0,Q.jsx)(y,{type:`password`,value:m,onChange:e=>g(e.target.value),placeholder:ee,fullWidth:!0})]}),D.supportsVoiceSelection&&(0,Q.jsxs)(`div`,{className:`space-y-1`,children:[(0,Q.jsx)(`label`,{className:`block text-body-small-default text-[var(--content-tertiary)]`,children:`Voice ID`}),(0,Q.jsx)(y,{type:`text`,value:_,onChange:e=>v(e.target.value),placeholder:`Enter a voice ID`,fullWidth:!0})]}),(0,Q.jsx)(_t,{guide:D.credentialsGuide}),(0,Q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Q.jsx)(p,{variant:`outlined`,onClick:N,disabled:T,children:T?`Testing…`:`Test`}),(0,Q.jsxs)(`div`,{className:`ml-auto flex items-center gap-2`,children:[(0,Q.jsx)($,{onClick:j,disabled:!A}),S&&(0,Q.jsx)(ht,{onClick:M})]})]})]})})}function Wt(){let e=N[0]?.id??`deepgram`,[t,i]=(0,Z.useState)(()=>n(Y,e)),[a,o]=(0,Z.useState)(t),[s,c]=(0,Z.useState)(``),[l,u]=(0,Z.useState)(!1),d=(0,Z.useMemo)(()=>N.find(e=>e.id===t)??N[0],[t]);(0,Z.useEffect)(()=>{u(n(R+t,``).length>0),c(``)},[t]);let f=(0,Z.useMemo)(()=>{let e=t!==a,n=s.trim().length>0;return e||n},[t,a,s]),p=(0,Z.useCallback)(()=>{r(Y,t);let e=s.trim();e.length>0&&(r(R+t,e),u(!0)),o(t),c(``)},[t,s]),m=(0,Z.useCallback)(()=>{r(R+t,``),u(!1),c(``)},[t]),g=l?`•••••••• (Enter a new key to replace)`:d.apiKeyPlaceholder;return(0,Q.jsx)(gt,{title:`Speech-to-Text`,subtitle:d.subtitle,children:(0,Q.jsxs)(`div`,{className:`space-y-4`,children:[(0,Q.jsxs)(`div`,{className:`space-y-1`,children:[(0,Q.jsx)(`label`,{className:`block text-body-small-default text-[var(--content-tertiary)]`,children:`Provider`}),(0,Q.jsx)(h,{value:t,onChange:i,options:N.map(e=>({value:e.id,label:e.displayName})),"aria-label":`STT provider`})]}),(0,Q.jsxs)(`div`,{className:`space-y-1`,children:[(0,Q.jsx)(`label`,{className:`block text-body-small-default text-[var(--content-tertiary)]`,children:`API Key`}),(0,Q.jsx)(y,{type:`password`,value:s,onChange:e=>c(e.target.value),placeholder:g,fullWidth:!0})]}),(0,Q.jsx)(_t,{guide:d.credentialsGuide}),(0,Q.jsxs)(`div`,{className:`flex items-center justify-end gap-2`,children:[(0,Q.jsx)($,{onClick:p,disabled:!f}),l&&(0,Q.jsx)(ht,{onClick:m})]})]})})}function Gt(){return(0,Z.useEffect)(()=>{let e=window.location.hash.slice(1);e&&requestAnimationFrame(()=>{document.getElementById(e)?.scrollIntoView({block:`start`})})},[]),(0,Q.jsxs)(`div`,{className:`space-y-5`,children:[(0,Q.jsxs)(`div`,{className:`flex items-start gap-2 rounded-lg border border-[var(--border-base)] bg-[var(--surface-base)] px-4 py-2.5`,children:[(0,Q.jsx)(qe,{className:`mt-0.5 h-4 w-4 shrink-0 text-[var(--content-tertiary)]`}),(0,Q.jsxs)(`p`,{className:`text-body-medium-lighter text-[var(--content-secondary)]`,children:[`Managed services are metered and deducted from your Vellum account balance.`,` `,(0,Q.jsxs)(`a`,{href:`https://www.vellum.ai/docs/pricing`,target:`_blank`,rel:`noopener noreferrer`,className:`inline-flex items-center gap-1 text-[var(--primary-base)] hover:underline`,children:[`View pricing`,(0,Q.jsx)(D,{className:`h-3.5 w-3.5`})]})]})]}),(0,Q.jsx)(Pt,{}),(0,Q.jsx)(Ft,{}),(0,Q.jsx)(Lt,{}),(0,Q.jsx)(Rt,{}),(0,Q.jsx)(Ut,{}),(0,Q.jsx)(Wt,{})]})}export{Gt as AiPage};
1
+ import{o as e}from"./chunk-jRWAZmH_.js";import{i as t,r as n,s as r}from"./local-settings-lVNyIOJ_.js";import{r as i,t as a}from"./capture-error-Dze4ISSQ.js";import{t as o}from"./react-DJZBPgpf.js";import{d as s,h as c}from"./chunk-5KNZJZUH-DdS6bb-3.js";import{n as l}from"./QueryClientProvider-DKhXIxGb.js";import{t as u}from"./useQuery-B45lW1Kk.js";import{t as d}from"./useMutation-Lj4VunQV.js";import{t as f}from"./jsx-runtime-CVSDxk6A.js";import{t as p}from"./button-C68o-wep.js";import{t as m}from"./typography-Czgs_2w_.js";import{t as h}from"./dropdown-CocFV5yi.js";import{t as g}from"./confirm-dialog-94QFOD8a.js";import{t as _}from"./notice-CF2pptne.js";import{t as v}from"./tag-Ccr7Quy6.js";import{t as y}from"./input-Cu3PPVCq.js";import{t as b}from"./toggle-CEm3M86o.js";import{n as x}from"./stat-square-BENJGRZr.js";import{t as S}from"./modal-BYMhDpQo.js";import{n as C}from"./toast-BL8OPiip.js";import{t as w}from"./createLucideIcon-D6d6iDdi.js";import{n as T,t as E}from"./domain-field-PnLPKONf.js";import{t as D}from"./external-link-Dj8dup-K.js";import{t as O}from"./loader-circle-C563RcPZ.js";import{C as k,E as A,M as j,N as M,O as N,P as ee,S as P,T as F,_ as I,a as L,b as R,c as z,d as B,f as V,g as H,h as U,k as W,l as te,m as G,p as K,s as ne,u as re,v as q,w as J,x as Y,y as ie}from"./ai-utils-NK8I8SN2.js";import{Dn as ae,Dt as oe,Ot as se,Z as ce,Zt as le}from"./sdk.gen-DgqwY_WN.js";import{C as ue,S as de,Z as fe,s as pe}from"./react-query.gen-B_oGDSP8.js";import{r as me}from"./api-errors-CsfCFJ8r.js";import{i as he}from"./routes-VcLWbBmh.js";import{t as ge}from"./use-is-org-ready-BgB6QXom.js";import{r as _e}from"./query-tags-DPKpdc1_.js";import{t as ve}from"./assistant-identity-store-CRzGEuvZ.js";import{t as ye}from"./assistant-feature-flag-store-BPZq6n_3.js";import{$r as be,Ct as xe,Dn as Se,Ga as Ce,Gr as we,Jr as Te,Kr as Ee,Li as De,Qa as Oe,Qr as ke,St as Ae,Xr as je,Ya as Me,Yr as Ne,Zr as Pe,_t as Fe,ai as Ie,bt as Le,ci as Re,dt as ze,ei as Be,eo as Ve,ft as He,gt as Ue,ht as We,ii as Ge,in as Ke,ma as qe,mt as Je,ni as Ye,oi as Xe,pt as Ze,qr as Qe,ri as $e,si as et,ti as tt,ut as nt,vt as rt,xi as it,yt as at}from"./index-87hTkD_v.js";import{t as ot}from"./use-active-assistant-id-B2Zd0B4I.js";import{t as st}from"./detail-card-BOk0V4_4.js";import{i as ct,n as X,r as lt,t as ut}from"./use-daemon-config-BLCgqB8a.js";import{t as dt}from"./environment-store-D3R6E-cP.js";var ft=w(`grip-vertical`,[[`circle`,{cx:`9`,cy:`12`,r:`1`,key:`1vctgf`}],[`circle`,{cx:`9`,cy:`5`,r:`1`,key:`hp0tcf`}],[`circle`,{cx:`9`,cy:`19`,r:`1`,key:`fkjjf6`}],[`circle`,{cx:`15`,cy:`12`,r:`1`,key:`1tmaij`}],[`circle`,{cx:`15`,cy:`5`,r:`1`,key:`19l28e`}],[`circle`,{cx:`15`,cy:`19`,r:`1`,key:`f4zoj3`}]]),Z=e(o(),1),Q=f();function pt({mode:e,onChange:t}){return(0,Q.jsx)(`div`,{className:`max-w-[280px]`,children:(0,Q.jsx)(x,{ariaLabel:`Service mode`,value:e,onChange:t,items:[{value:`managed`,label:`Managed`},{value:`your-own`,label:`Your Own`}]})})}function mt({id:e,title:t,subtitle:n,mode:r,onModeChange:i,children:a}){return(0,Q.jsxs)(st,{id:e,title:t,subtitle:n,accessory:(0,Q.jsx)(pt,{mode:r,onChange:i}),children:[(0,Q.jsx)(`div`,{className:`h-px bg-[var(--surface-active)]`}),(0,Q.jsx)(`div`,{className:`mt-4`,children:a})]})}function $({onClick:e,disabled:t}){return(0,Q.jsx)(p,{onClick:e,disabled:t,children:`Save`})}function ht({onClick:e,filled:t=!1}){return(0,Q.jsx)(p,{variant:t?`danger`:`dangerGhost`,onClick:e,children:`Reset`})}function gt({id:e,title:t,subtitle:n,children:r}){return(0,Q.jsxs)(st,{id:e,title:t,subtitle:n,children:[(0,Q.jsx)(`div`,{className:`h-px bg-[var(--surface-active)]`}),(0,Q.jsx)(`div`,{className:`mt-4`,children:r})]})}function _t({guide:e}){return(0,Q.jsxs)(`div`,{className:`flex items-start gap-2 rounded-lg border border-[var(--border-subtle)] bg-[var(--surface-sunken)] p-3 text-body-small-default text-[var(--content-tertiary)]`,children:[(0,Q.jsx)(qe,{className:`mt-0.5 h-3.5 w-3.5 shrink-0 text-[var(--system-positive-strong)]`}),(0,Q.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,Q.jsx)(`span`,{children:e.description}),(0,Q.jsxs)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,className:`inline-flex items-center gap-1 text-[var(--system-positive-strong)] underline hover:opacity-80`,children:[e.linkLabel,(0,Q.jsx)(D,{className:`h-3 w-3`})]})]})]})}function vt({status:e,message:t,isLoading:n}){return n?(0,Q.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded-full bg-[var(--tag-bg-neutral)] px-2.5 py-0.5 text-body-small-default text-[var(--content-quiet)]`,children:[(0,Q.jsx)(O,{className:`h-3 w-3 animate-spin`}),`Checking domain…`]}):e?e===`verified`?(0,Q.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded-full bg-[var(--system-positive-weak)] px-2.5 py-0.5 text-body-small-default text-[var(--system-positive-strong)]`,title:`DNS records have been verified. Your domain is ready to send and receive email.`,children:[(0,Q.jsx)(Ve,{className:`h-3 w-3`}),`Domain verified`]}):e===`pending`||e===`not_started`?(0,Q.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded-full bg-[var(--system-mid-weak)] px-2.5 py-0.5 text-body-small-default text-[var(--system-mid-strong)]`,title:`DNS records have been provisioned. Waiting for the email provider to verify them — this usually takes a few minutes.`,children:[(0,Q.jsx)(Ce,{className:`h-3 w-3`}),`Verifying domain…`]}):(0,Q.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded-full bg-[var(--system-negative-weak)] px-2.5 py-0.5 text-body-small-default text-[var(--system-negative-strong)]`,title:`Domain verification failed. DNS records may not have propagated correctly. You could try releasing and re-registering the domain.`,children:[(0,Q.jsx)(Oe,{className:`h-3 w-3`}),`Verification failed`]}):(0,Q.jsx)(`span`,{className:`inline-flex items-center gap-1 rounded-full bg-[var(--tag-bg-neutral)] px-2.5 py-0.5 text-body-small-default text-[var(--content-quiet)]`,title:`Unable to retrieve domain verification status.`,children:`Unknown status`})}var yt=`__custom__`;function bt(e){return e?!!(e.profile||e.provider||e.model):!1}function xt(e,t){let n=bt(e);return n===bt(t)?n?(e?.profile??null)===(t?.profile??null)&&(e?.provider??null)===(t?.provider??null)&&(e?.model??null)===(t?.model??null):!0:!1}function St({id:e,displayName:t,description:n,defaultProfileLabel:r,draft:i,profileOptions:a,onDraftChange:o,onToggle:s}){let c=bt(i),l=!i||!c?``:i.provider||i.model?yt:i.profile??``,u=l===yt,d=i?.provider??G[0],f=M(d??`anthropic`).map(e=>({value:e.id,label:e.displayName})),p=!!i?.provider&&!i?.model;function m(t){if(t===`__custom__`){let t=G[0];o(e,{profile:null,provider:t,model:j(t)??``})}else t===``?o(e,null):o(e,{profile:t,provider:null,model:null})}function g(t){let n=j(t)??``;o(e,{...i??{},profile:null,provider:t,model:n})}function _(t){o(e,{...i??{},model:t})}return(0,Q.jsxs)(`div`,{className:`rounded-lg border border-[var(--border-base)] bg-[var(--surface-base)] p-3`,children:[(0,Q.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,Q.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Q.jsx)(`p`,{className:`text-body-medium-default font-medium text-[var(--content-default)]`,children:t}),n&&(0,Q.jsxs)(`p`,{className:`mt-0.5 text-body-small-default text-[var(--content-tertiary)]`,children:[n,r&&(0,Q.jsxs)(`span`,{className:`ml-1.5 text-body-small-default text-[var(--content-tertiary)] opacity-60`,children:[`· Default: `,r]})]})]}),(0,Q.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2`,children:[c&&(0,Q.jsx)(h,{value:l,onChange:m,options:a,className:`w-36`}),(0,Q.jsx)(b,{checked:c,onChange:t=>s(e,t),"aria-label":`Override ${t}`})]})]}),c&&u&&(0,Q.jsxs)(`div`,{className:`mt-3 space-y-2 border-t border-[var(--border-base)] pt-3`,children:[(0,Q.jsxs)(`div`,{className:`flex gap-2`,children:[(0,Q.jsxs)(`div`,{className:`flex-1`,children:[(0,Q.jsx)(`label`,{className:`mb-1 block text-body-small-default text-[var(--content-tertiary)]`,children:`Provider`}),(0,Q.jsx)(h,{value:d??``,onChange:g,options:G.map(e=>({value:e,label:U[e]??e}))})]}),(0,Q.jsxs)(`div`,{className:`flex-1`,children:[(0,Q.jsx)(`label`,{className:`mb-1 block text-body-small-default text-[var(--content-tertiary)]`,children:`Model`}),(0,Q.jsx)(h,{value:i?.model??``,onChange:_,options:f})]})]}),p&&(0,Q.jsx)(`p`,{className:`text-body-small-default text-[var(--system-negative-strong)]`,children:`Pick a model`})]})]})}function Ct({isOpen:e,onClose:t,assistantId:n}){let r=(0,Z.useRef)(!1);return(0,Q.jsx)(S.Root,{open:e,onOpenChange:e=>{!e&&!r.current&&t()},children:e?(0,Q.jsx)(wt,{assistantId:n,onClose:t,onSavingChange:e=>{r.current=e}}):null})}function wt({assistantId:e,onClose:t,onSavingChange:n}){let{orderedProfiles:r,callSites:i,config:o}=lt(),s=X(),[c,l]=(0,Z.useState)(``),[d,f]=(0,Z.useState)({}),[m,h]=(0,Z.useState)(!1),[_,v]=(0,Z.useState)(!1),b=ye.use.analyzeConversation(),{data:x,isLoading:w,isError:T,refetch:E}=u({...pe({path:{assistant_id:e}}),enabled:!!e,staleTime:6e4,refetchOnWindowFocus:!1}),D=(0,Z.useMemo)(()=>{let e=(x?.callSites??[]).filter(e=>e.id!==`mainAgent`);return b?e:e.filter(e=>e.id!==`analyzeConversation`)},[x,b]),k=!w&&!T&&!!x&&!!o,A=(0,Z.useMemo)(()=>D.map(e=>e.id),[D]),M=(0,Z.useMemo)(()=>{if(!k)return{};let e={};for(let t of A)if(t in d)e[t]=d[t];else{let n=i[t];e[t]=n?{...n}:{}}return e},[k,A,i,d]),N=(0,Z.useMemo)(()=>new Set(A),[A]),ee=(0,Z.useMemo)(()=>Object.entries(i).some(([e,t])=>N.has(e)&&(t?.profile!=null||t?.provider!=null||t?.model!=null)),[i,N]),P=(0,Z.useMemo)(()=>{if(!k)return!1;for(let e of Object.keys(M))if(!xt(M[e],i[e]))return!0;return!1},[k,M,i]),F=(0,Z.useMemo)(()=>Object.values(M).some(e=>bt(e)&&!!e?.provider&&!e?.model),[M]),I=ye.use.queryComplexityRouting(),L=(0,Z.useCallback)(e=>[...Ie(Re(r,[e]),I).map(e=>({value:e.name,label:Xe(e)})),{value:yt,label:`Custom`}],[r,I]),R=(0,Z.useMemo)(()=>{if(!c.trim())return D;let e=c.toLowerCase();return D.filter(t=>(t.displayName??``).toLowerCase().includes(e)||(t.description??``).toLowerCase().includes(e)||(t.domain??``).toLowerCase().includes(e))},[D,c]),z=(0,Z.useMemo)(()=>{if(!x)return[];let e=x.domains.map(e=>e.id),t=new Map(x.domains.map(e=>[e.id,e])),n=[];for(let r of e){let e=R.filter(e=>e.domain===r);e.length>0&&n.push({domain:t.get(r),sites:e})}let r=new Set(e),i=R.filter(e=>!r.has(e.domain));return i.length>0&&n.push({domain:{id:`other`,displayName:`Other`},sites:i}),n},[x,R]),B=(0,Z.useCallback)((e,t)=>{f(n=>({...n,[e]:t}))},[]),V=(0,Z.useCallback)((e,t)=>{if(!t){f(t=>({...t,[e]:null}));return}let n=et(r,D.find(t=>t.id===e)?.defaultProfile,I);if(n)f(t=>({...t,[e]:{profile:n}}));else{let t=G[0],n=j(t)??``;f(r=>({...r,[e]:{provider:t,model:n}}))}},[D,r,I]),H=(0,Z.useCallback)(async()=>{h(!0),n?.(!0);try{let e={};for(let t of Object.keys(M)){let n=M[t]??null;e[t]=bt(n)?{profile:n?.profile??null,provider:n?.provider??null,model:n?.model??null}:null}await s.mutateAsync({llm:{callSites:e}}),t(),C.success(`Overrides saved.`)}catch(e){C.error(`Failed to save overrides. Please try again.`),a(e,{context:`call_site_overrides_save`})}finally{h(!1),n?.(!1)}},[M,t,s,n]),U=(0,Z.useCallback)(async()=>{h(!0),n?.(!0);try{let e={};for(let t of Object.keys(M))e[t]=null;await s.mutateAsync({llm:{callSites:e}}),t(),C.success(`Overrides reset.`)}catch(e){C.error(`Failed to reset overrides. Please try again.`),a(e,{context:`call_site_overrides_reset`})}finally{h(!1),n?.(!1)}},[M,t,s,n]);return(0,Q.jsxs)(S.Content,{size:`lg`,hideCloseButton:!0,children:[(0,Q.jsxs)(S.Header,{children:[(0,Q.jsx)(S.Title,{children:`Action Overrides`}),(0,Q.jsx)(S.Description,{children:`Customize which model profile specific actions should use. Uses your default profile if no override is set.`})]}),(0,Q.jsxs)(S.Body,{children:[(0,Q.jsx)(`div`,{className:`mb-4`,children:(0,Q.jsx)(y,{type:`search`,value:c,onChange:e=>l(e.target.value),placeholder:`Search actions…`,leftIcon:(0,Q.jsx)(De,{className:`h-4 w-4`}),fullWidth:!0})}),w&&(0,Q.jsx)(`div`,{className:`flex items-center justify-center py-12`,children:(0,Q.jsx)(O,{className:`h-6 w-6 animate-spin text-[var(--content-tertiary)]`})}),T&&(0,Q.jsxs)(`div`,{className:`flex flex-col items-center gap-3 py-12 text-center`,children:[(0,Q.jsx)(`p`,{className:`text-body-medium-default text-[var(--content-default)]`,children:`Couldn't load actions`}),(0,Q.jsx)(`p`,{className:`text-body-medium-lighter text-[var(--content-tertiary)]`,children:`Make sure your assistant is running`}),(0,Q.jsx)(p,{variant:`outlined`,size:`compact`,onClick:()=>void E(),children:`Retry`})]}),!w&&!T&&x&&(0,Q.jsx)(`div`,{className:`space-y-4`,children:z.length===0?(0,Q.jsx)(`p`,{className:`py-8 text-center text-body-medium-lighter text-[var(--content-tertiary)]`,children:`No actions match your search.`}):z.map(({domain:e,sites:t})=>(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`p`,{className:`mb-2 text-body-small-default font-semibold uppercase tracking-wider text-[var(--content-tertiary)]`,children:e.displayName}),(0,Q.jsx)(`div`,{className:`space-y-1`,children:t.map(e=>{let t=(()=>{let t=M[e.id]??null;return!t||!bt(t)?``:t.provider||t.model?`__custom__`:t.profile??``})(),n=e.defaultProfile?r.find(t=>t.name===e.defaultProfile)?.label??e.defaultProfile:null;return(0,Q.jsx)(St,{id:e.id,displayName:e.displayName,description:e.description,defaultProfileLabel:n,draft:M[e.id]??null,profileOptions:L(t===``||t===`__custom__`?null:t),onDraftChange:B,onToggle:V},e.id)})})]},e.id))})]}),(0,Q.jsxs)(S.Footer,{children:[ee&&(0,Q.jsx)(p,{variant:`outlined`,size:`compact`,onClick:()=>v(!0),disabled:m||!k,tintColor:`var(--system-negative-strong)`,className:`mr-auto`,children:`Reset to Defaults`}),(0,Q.jsx)(p,{variant:`outlined`,size:`compact`,onClick:t,disabled:m,children:`Cancel`}),(0,Q.jsx)(p,{variant:`primary`,size:`compact`,onClick:()=>void H(),disabled:!P||F||m,children:m?(0,Q.jsx)(O,{className:`h-4 w-4 animate-spin`}):`Save`})]}),(0,Q.jsx)(g,{open:_,title:`Reset to Defaults`,message:`Every task override will be reset and will follow your active profile. This cannot be undone.`,confirmLabel:`Reset to Defaults`,destructive:!0,onConfirm:()=>{v(!1),U()},onCancel:()=>v(!1)})]})}function Tt({blocked:e,availableReplacements:t,replacement:n,onReplacementChange:r,error:i,saving:a,onClose:o,onConfirm:s}){let c=``;if(e){let t=e.label||e.name;c=e.isActive&&e.callSiteIds.length>0?`"${t}" is the active profile and is used by ${e.callSiteIds.length} call site(s). Pick a replacement profile.`:e.isActive?`"${t}" is the active profile. Pick a different active profile before deleting, or select a replacement below.`:`"${t}" is used by ${e.callSiteIds.length} call site(s). Select a replacement profile to reassign them before deleting.`}return(0,Q.jsx)(S.Root,{open:e!==null,onOpenChange:e=>{e||o()},children:(0,Q.jsxs)(S.Content,{size:`sm`,children:[(0,Q.jsx)(S.Header,{children:(0,Q.jsx)(S.Title,{children:`Can't Delete Profile`})}),(0,Q.jsxs)(S.Body,{className:`space-y-4`,children:[(0,Q.jsx)(m,{variant:`body-medium-default`,as:`p`,children:c}),e&&e.callSiteIds.length>0&&(0,Q.jsx)(`ul`,{className:`space-y-1 pl-1`,children:e.callSiteIds.map(e=>(0,Q.jsxs)(`li`,{className:`text-body-small-default text-(--content-secondary)`,children:[`• `,(0,Q.jsx)(`code`,{children:e})]},e))}),(0,Q.jsxs)(`div`,{className:`space-y-1`,children:[(0,Q.jsx)(`label`,{className:`block text-body-small-default text-[var(--content-tertiary)]`,children:`Replacement profile`}),(0,Q.jsx)(h,{"aria-label":`Replacement profile`,value:n,onChange:r,options:[{value:``,label:`Select a replacement…`},...t.map(e=>({value:e.name,label:e.label??e.name}))]})]}),i&&(0,Q.jsx)(m,{variant:`body-small-default`,as:`p`,className:`text-(--system-negative-strong)`,children:i})]}),(0,Q.jsxs)(S.Footer,{children:[(0,Q.jsx)(p,{variant:`ghost`,size:`compact`,onClick:o,children:`Cancel`}),(0,Q.jsx)(p,{variant:`primary`,size:`compact`,disabled:!n||a,onClick:s,children:a?`Saving…`:`Reassign and Delete`})]})]})})}function Et({profile:e,isDragging:t,dropTarget:n,isDeleting:r,deleteError:i,isToggling:a,onDragStart:o,onDragEnd:s,onDragOver:c,onDragLeave:l,onDrop:u,onEditClick:d,onDeleteClick:f,onStatusToggle:h}){let g=e.source===`managed`,_=e.status!==`disabled`,y=e.name===Ge;return(0,Q.jsxs)(`div`,{className:`relative`,children:[n?.name===e.name&&!n.after&&(0,Q.jsx)(`div`,{className:`mx-0 h-0.5 rounded-full bg-[var(--border-active)]`}),(0,Q.jsxs)(`div`,{className:`flex items-center gap-2 rounded-lg pr-2 py-2${t?` opacity-50`:``}`,draggable:!g,onDragStart:o,onDragEnd:s,onDragOver:c,onDragLeave:l,onDrop:u,children:[(0,Q.jsx)(ft,{className:`h-4 w-4 shrink-0 ${g?`invisible`:`cursor-grab text-[var(--content-tertiary)]`}`}),(0,Q.jsxs)(`div`,{className:`min-w-0 flex-1${_?``:` opacity-55`}`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Q.jsx)(m,{variant:`body-medium-default`,as:`span`,className:`text-(--content-default)`,children:e.label??e.name}),g&&e.name!==`auto`&&(0,Q.jsx)(v,{tone:`positive`,title:`Managed by Platform — auth is locked, but you can rename or disable this profile.`,children:`Platform`})]}),e.description?(0,Q.jsx)(m,{variant:`body-medium-lighter`,as:`p`,className:`mt-0.5 text-(--content-tertiary)`,children:e.description}):null,e.model??e.provider?(0,Q.jsx)(m,{variant:`body-medium-lighter`,as:`p`,className:`mt-0.5 text-(--content-tertiary)`,children:e.model??e.provider}):null]}),(0,Q.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2`,children:[(0,Q.jsx)(`div`,{className:`flex shrink-0 items-center`,title:_?`Active — toggle to hide from pickers`:`Disabled — toggle to show in pickers`,children:(0,Q.jsx)(b,{checked:_,onChange:e=>h(e),disabled:a,"aria-label":`${_?`Disable`:`Enable`} ${e.label??e.name}`})}),(0,Q.jsxs)(`div`,{className:`flex w-[92px] items-center justify-end gap-2${y?` invisible`:``}`,children:[(0,Q.jsx)(p,{variant:`ghost`,size:`compact`,onClick:d,children:g?`View`:`Edit`}),(0,Q.jsx)(p,{variant:`ghost`,size:`compact`,iconOnly:(0,Q.jsx)(it,{}),"aria-label":`Delete ${e.label??e.name}`,disabled:g||r,title:g?`Managed profiles cannot be deleted`:void 0,onClick:f,tintColor:`var(--system-negative-strong)`})]})]})]}),n?.name===e.name&&n.after&&(0,Q.jsx)(`div`,{className:`mx-0 h-0.5 rounded-full bg-[var(--border-active)]`}),i?(0,Q.jsx)(m,{variant:`body-small-default`,as:`p`,className:`px-2 pb-1 text-(--system-negative-strong)`,children:i}):null,e.name===`auto`&&(0,Q.jsx)(`div`,{className:`mx-2 mt-1 border-b border-[var(--border-subtle)]`})]})}function Dt({isOpen:e,assistantId:t,onClose:n}){let{profiles:r,profileOrder:i,orderedProfiles:o,activeProfile:s,callSites:c}=lt(),l=X(),[d,f]=(0,Z.useState)(!1),[p,m]=(0,Z.useState)(null),{data:h}=u({...de({path:{assistant_id:t}}),enabled:e}),g=h?.connections,_=Object.keys(r);async function v(e,t,n){let o=n?.mode??`replace`,s=!(e in r);if(o===`merge`&&!s){await l.mutateAsync({llm:{profiles:{[e]:t}}}),f(!1),m(null);return}let c={profiles:{[e]:t}};if(s&&(c.profileOrder=i.includes(e)?i:[...i,e]),s)await l.mutateAsync({llm:c});else{let t=r[e];await l.mutateAsync({llm:{profiles:{[e]:null}}});try{await l.mutateAsync({llm:c})}catch(n){throw a(n,{context:`settings-ai-profile-edit-recreate`}),t!=null&&await l.mutateAsync({llm:{profiles:{[e]:t}}}).catch(()=>{}),n}}s&&C.success(`Profile "${t.label??e}" created`),f(!1),m(null)}return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(S.Root,{open:e,onOpenChange:e=>{e||n()},children:e?(0,Q.jsx)(Ot,{profiles:r,profileOrder:i,orderedProfiles:o,activeProfile:s,callSiteOverrides:c,onClose:n,onEditClick:e=>{m(e),f(!0)},onNewClick:()=>{m(null),f(!0)}}):null}),(0,Q.jsx)(we,{isOpen:d,mode:p?p.source===`managed`?`view`:`edit`:`create`,profileName:p?.name,initialValues:p??void 0,existingNames:_,connections:g,assistantId:t,onSave:v,onCancel:()=>{f(!1),m(null)}})]})}function Ot({profiles:e,profileOrder:t,orderedProfiles:n,activeProfile:r,callSiteOverrides:i,onClose:o,onEditClick:s,onNewClick:c}){let l=X(),[u,d]=(0,Z.useState)({}),[f,h]=(0,Z.useState)({}),[g,_]=(0,Z.useState)(new Set),[v,y]=(0,Z.useState)(null),[b,x]=(0,Z.useState)(null),[C,w]=(0,Z.useState)(null),[T,E]=(0,Z.useState)(null),D=(0,Z.useRef)(null),O=(0,Z.useRef)(null),[k,A]=(0,Z.useState)(null),[j,M]=(0,Z.useState)(null),[N,ee]=(0,Z.useState)(``),[P,F]=(0,Z.useState)(!1),I=ye.use.queryComplexityRouting(),L=(0,Z.useMemo)(()=>Ie(n,I),[n,I]);async function R(t,n){if(g.has(t.name))return!1;_(e=>new Set(e).add(t.name)),y(null);let r=n?`active`:`disabled`;if(!e[t.name])return _(e=>{let n=new Set(e);return n.delete(t.name),n}),!1;try{return await l.mutateAsync({llm:{profiles:{[t.name]:{status:r}}}}),!0}catch(e){return a(e,{context:`settings-ai-profile-toggle`}),y(`Couldn't update "${t.label??t.name}". Please try again.`),!1}finally{_(e=>{let n=new Set(e);return n.delete(t.name),n})}}async function z(e){h(t=>({...t,[e]:!0})),d(t=>{let n={...t};return delete n[e],n});try{let n=t.filter(t=>t!==e);await l.mutateAsync({llm:{profiles:{[e]:null},profileOrder:n}})}catch(t){a(t,{context:`settings-ai-profile-delete`}),d(t=>({...t,[e]:`Failed to delete profile. Please try again.`}))}finally{h(t=>{let n={...t};return delete n[e],n})}}function B(e){let t=L.find(t=>t.name===e)?.label??e,n=e===r,a=Object.entries(i).filter(([t,n])=>t!==`mainAgent`&&n?.profile===e).map(([e])=>e);if(n||a.length>0){A({name:e,label:t,isActive:n,callSiteIds:a}),ee(``),M(null);return}z(e)}async function V(){if(!k||!N)return;F(!0),M(null);let e={};if(k.isActive&&(e.activeProfile=N),k.callSiteIds.length>0){let t={};for(let e of k.callSiteIds)t[e]={profile:N};e.callSites=t}if(Object.keys(e).length>0)try{await l.mutateAsync({llm:e})}catch(e){a(e,{context:`settings-ai-profile-reassign-delete`}),M(`Failed to reassign references. Please try again.`),F(!1);return}let t=k.name;A(null),F(!1),z(t)}async function H(e,n){if(e===n.name)return;E(null);let r=t.filter(t=>t!==e),i=r.indexOf(n.name);if(i===-1)return;n.after&&(i+=1);let o=[...r.slice(0,i),e,...r.slice(i)];try{await l.mutateAsync({llm:{profileOrder:o}})}catch(e){a(e,{context:`settings-ai-profile-reorder`}),E(`Failed to reorder profiles. Please try again.`)}}let U=L.filter(e=>e.name!==k?.name&&e.source!==`managed`),W=U.length>0?U:L.filter(e=>e.name!==k?.name);return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(S.Content,{size:`md`,children:[(0,Q.jsxs)(S.Header,{children:[(0,Q.jsx)(S.Title,{children:`Model Profiles`}),(0,Q.jsx)(S.Description,{children:`Bundle a provider and model into a named profile. Assign profiles to specific actions or swap between them when chatting.`})]}),(0,Q.jsxs)(S.Body,{children:[L.length===0?(0,Q.jsx)(m,{variant:`body-medium-lighter`,as:`p`,className:`py-4 text-center text-(--content-tertiary)`,children:`No profiles yet. Create one to get started.`}):(0,Q.jsx)(`div`,{className:`space-y-1`,children:L.map(e=>(0,Q.jsx)(Et,{profile:e,isDragging:b===e.name,dropTarget:C,isDeleting:f[e.name]??!1,deleteError:u[e.name],isToggling:g.has(e.name),onDragStart:t=>{D.current=e.name,x(e.name),t.dataTransfer&&(t.dataTransfer.effectAllowed=`move`)},onDragEnd:()=>{D.current=null,O.current=null,x(null),w(null)},onDragOver:t=>{t.preventDefault();let n=t.currentTarget.getBoundingClientRect(),r=t.clientY>n.top+n.height/2,i={name:e.name,after:r};O.current=i,w(i)},onDragLeave:t=>{t.currentTarget.contains(t.relatedTarget)||(O.current=null,w(t=>t?.name===e.name?null:t))},onDrop:e=>{e.preventDefault();let t=D.current,n=O.current;D.current=null,O.current=null,x(null),w(null),t&&n&&H(t,n)},onEditClick:()=>s(e),onDeleteClick:()=>B(e.name),onStatusToggle:t=>void R(e,t)},e.name))}),T&&(0,Q.jsx)(m,{variant:`body-small-default`,as:`p`,className:`mt-2 text-(--system-negative-strong)`,children:T}),v&&(0,Q.jsx)(m,{variant:`body-small-default`,as:`p`,className:`mt-2 text-(--system-negative-strong)`,children:v})]}),(0,Q.jsxs)(S.Footer,{className:`justify-between`,children:[(0,Q.jsx)(p,{variant:`outlined`,size:`compact`,onClick:c,children:`+ New Profile`}),(0,Q.jsx)(p,{variant:`outlined`,size:`compact`,onClick:o,children:`Done`})]})]}),(0,Q.jsx)(Tt,{blocked:k,availableReplacements:W,replacement:N,onReplacementChange:ee,error:j,saving:P,onClose:()=>{A(null),M(null)},onConfirm:()=>void V()})]})}function kt({mode:e,connection:t,assistantId:n,existingNames:r,onSave:i,onCancel:a}){let[o,s]=(0,Z.useState)(e),[c,u]=(0,Z.useState)(void 0),d=o===`managed-edit`,[f,g]=(0,Z.useState)(t?.label??``),[_,v]=(0,Z.useState)(t?.name??``),[b,x]=(0,Z.useState)(t?.provider??`anthropic`),[C,w]=(0,Z.useState)(()=>t?t.auth.type:`platform`),[T,E]=(0,Z.useState)(()=>t?.auth.type===`api_key`?t.auth.credential:t?``:`credential/anthropic/api_key`),[D,O]=(0,Z.useState)(t?.baseUrl??``),[k,A]=(0,Z.useState)(()=>t?.models?t.models.map(e=>e.id).join(`, `):``),[j,M]=(0,Z.useState)(!1),[N,P]=(0,Z.useState)(null),F=b===`openai-compatible`,I=(0,Z.useMemo)(()=>b&&!Pe.includes(b)?[...Pe,b]:Pe,[b]),{handleLabelChange:L,resetDirty:R}=Te(o,g,v),[z,B]=(0,Z.useState)(``),[V,H]=(0,Z.useState)(!1),U=l(),W=(0,Z.useMemo)(()=>be(T),[T]),te=C===`api_key`&&W!==null,{hasStoredCredential:G,isLoading:K,queryKey:ne}=$e({assistantId:n,credentialKind:`credential`,credentialName:W?`${W.service}:${W.field}`:``,enabled:te,errorContext:`settings-provider-editor-credential-presence`}),{credentials:re,queryKey:q}=Qe({assistantId:n,enabled:C===`api_key`});(0,Z.useEffect)(()=>{let e=t?.provider??`anthropic`;g(t?.label??``),v(t?.name??``),x(e),w(t?t.auth.type:`platform`),t?.auth.type===`api_key`?E(t.auth.credential):E(t?``:`credential/${e}/api_key`),R(),P(null),O(t?.baseUrl??``),A(t?.models?t.models.map(e=>e.id).join(`, `):``),B(``),H(!1)},[t,R]);function J(){s(`create`),u(b===`ollama`?`none`:`api_key`)}let Y=_.trim().length>0;async function ie(){if(Y){M(!0),P(null);try{let e;if(C===`api_key`){let t=T.trim()||`credential/${b}/api_key`,r=z.trim();if(r){H(!0);try{let e=be(t);await ae({path:{assistant_id:n},body:e?{type:`credential`,name:`${e.service}:${e.field}`,value:r}:{type:`api_key`,name:b,value:r},throwOnError:!0}),U.setQueryData(ne,!0),U.invalidateQueries({queryKey:q})}catch{P(`Failed to save API key. Please try again.`);return}finally{H(!1)}}e={type:`api_key`,credential:t}}else if(C===`oauth_subscription`)if(t?.auth.type===`oauth_subscription`)e=t.auth;else{P(`Use the "Sign in with ChatGPT" button to connect your subscription.`);return}else e=C===`none`?{type:`none`}:{type:`platform`};let r=f.trim()||null,a={auth:e,label:r,...F&&{base_url:D.trim()||null,models:k.trim()?k.split(`,`).map(e=>({id:e.trim()})).filter(e=>e.id):null}},{data:o,response:s}=await se({path:{assistant_id:n,name:t?.name??_.trim()},body:a});if(!s?.ok){P(ke(s?.status,_.trim()));return}if(!o){P(`Server returned an empty response. Please try again.`);return}i(o)}catch{P(`Failed to save connection. Please try again.`)}finally{M(!1)}}}let oe=re.filter(e=>e.service===b),ce=o!==`create`&&t?.auth.type===`api_key`,le=oe.length>0||ce,ue=Ne(`Enter your API key`,G);return o===`create`?(0,Q.jsx)(Ee,{variant:`modal`,assistantId:n,existingNames:r,defaultProviderType:b,defaultAuthType:c,onCreated:i,onCancel:a},b):(0,Q.jsxs)(S.Content,{size:`md`,children:[(0,Q.jsxs)(S.Header,{children:[(0,Q.jsx)(S.Title,{children:`Edit Connection`}),(0,Q.jsx)(S.Description,{children:d?`Managed by Vellum — auth is locked, but you can rename "${t?.name}".`:`Editing "${t?.name}".`})]}),(0,Q.jsxs)(S.Body,{className:`space-y-4`,children:[(0,Q.jsxs)(`div`,{className:`space-y-1`,children:[(0,Q.jsxs)(`label`,{className:`block text-body-small-default text-[var(--content-tertiary)]`,children:[`Display Name`,` `,(0,Q.jsx)(`span`,{className:`text-[var(--content-disabled)]`,children:`(optional)`})]}),(0,Q.jsx)(y,{value:f,onChange:e=>L(e.target.value),placeholder:`e.g. My Anthropic Key`,fullWidth:!0})]}),(0,Q.jsxs)(`div`,{className:`space-y-1`,children:[(0,Q.jsx)(`label`,{className:`block text-body-small-default text-[var(--content-tertiary)]`,children:`Key`}),(0,Q.jsx)(y,{value:_,placeholder:`e.g. anthropic-personal`,disabled:!0,fullWidth:!0})]}),(0,Q.jsxs)(`div`,{className:`space-y-1`,children:[(0,Q.jsx)(`label`,{className:`block text-body-small-default text-[var(--content-tertiary)]`,children:`Provider`}),(0,Q.jsx)(h,{"aria-label":`Provider`,value:b,onChange:e=>x(e),disabled:!0,options:I.map(e=>({value:e,label:tt[e]}))})]}),F&&(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`div`,{className:`space-y-1`,children:[(0,Q.jsx)(`label`,{className:`block text-body-small-default text-[var(--content-tertiary)]`,children:`Base URL`}),(0,Q.jsx)(y,{value:D,onChange:e=>O(e.target.value),placeholder:`https://api.example.com/v1`,disabled:d,fullWidth:!0})]}),(0,Q.jsxs)(`div`,{className:`space-y-1`,children:[(0,Q.jsx)(`label`,{className:`block text-body-small-default text-[var(--content-tertiary)]`,children:`Models`}),(0,Q.jsx)(y,{value:k,onChange:e=>A(e.target.value),placeholder:`model-1, model-2`,disabled:d,fullWidth:!0}),(0,Q.jsx)(m,{variant:`body-small-default`,as:`p`,className:`text-[var(--content-tertiary)]`,children:`Comma-separated model identifiers exposed by your endpoint.`})]})]}),(0,Q.jsxs)(`div`,{className:`space-y-1`,children:[(0,Q.jsx)(`label`,{className:`block text-body-small-default text-[var(--content-tertiary)]`,children:`Auth Type`}),(0,Q.jsx)(h,{"aria-label":`Auth type`,value:C,onChange:e=>{w(e),P(null)},disabled:d||b===`ollama`,options:(()=>{let e;return e=b===`ollama`?[`none`]:ee(b)?[`api_key`,`platform`]:[`api_key`],C&&!e.includes(C)&&e.push(C),e.map(e=>({value:e,label:je[e]}))})()})]}),C===`api_key`&&(0,Q.jsx)(Be,{apiKeyValue:z,onApiKeyChange:B,credential:T,onCredentialChange:E,isAuthLocked:d,isLoadingCredential:K,apiKeyPlaceholder:ue,provider:b,providerCredentials:oe,showAdvancedSection:le,onError:P}),C===`oauth_subscription`&&(0,Q.jsx)(Ye,{assistantId:n,onConnected:i}),N&&(0,Q.jsx)(m,{variant:`body-small-default`,as:`p`,className:`text-(--system-negative-strong)`,children:N})]}),(0,Q.jsxs)(S.Footer,{children:[(0,Q.jsx)(p,{variant:`ghost`,size:`compact`,onClick:a,children:`Cancel`}),o===`managed-edit`&&(0,Q.jsx)(p,{variant:`outlined`,size:`compact`,onClick:J,disabled:j||V,children:`Save as New`}),(0,Q.jsx)(p,{variant:`primary`,size:`compact`,disabled:!Y||j||V,onClick:()=>void ie(),children:j?`Saving…`:`Save`})]})]})}function At(e){switch(e.type){case`api_key`:return`API key · ${e.credential}`;case`oauth_subscription`:return`ChatGPT Subscription`;case`platform`:return`Managed proxy`;case`none`:return`None (local)`;default:return e.type}}function jt({isOpen:e,assistantId:t,onClose:n}){let[r,i]=(0,Z.useState)(!1),[a,o]=(0,Z.useState)(null),s=l(),{data:c,isLoading:d,isError:f}=u({...de({path:{assistant_id:t}}),enabled:e}),p=(0,Z.useMemo)(()=>c?.connections??[],[c]);function m(e){s.invalidateQueries({queryKey:ue({path:{assistant_id:t}})}),i(!1),o(null)}let h=p.map(e=>e.name),g=()=>{i(!1),o(null)};return(0,Q.jsx)(S.Root,{open:e,onOpenChange:e=>{e||(r?g():n())},children:e?r?(0,Q.jsx)(kt,{mode:a?a.isManaged?`managed-edit`:`edit`:`create`,connection:a??void 0,assistantId:t,existingNames:h,onSave:m,onCancel:g}):(0,Q.jsx)(Mt,{connections:p,loading:d,isError:f,assistantId:t,onClose:n,onEditClick:e=>{o(e),i(!0)},onNewClick:()=>{o(null),i(!0)},onConnectionDeleted:()=>{s.invalidateQueries({queryKey:ue({path:{assistant_id:t}})})}}):null})}function Mt({connections:e,loading:t,isError:n,assistantId:r,onClose:i,onEditClick:a,onNewClick:o,onConnectionDeleted:s}){let[c,l]=(0,Z.useState)({}),[u,d]=(0,Z.useState)({});async function f(e){d(t=>({...t,[e]:!0})),l(t=>{let n={...t};return delete n[e],n});try{let{response:t}=await oe({path:{assistant_id:r,name:e}});t?.ok||t?.status===404?s(e):t?.status===409?l(t=>({...t,[e]:`Connection is in use by one or more profiles. Remove those references first.`})):l(t=>({...t,[e]:`Failed to delete connection. Please try again.`}))}catch{l(t=>({...t,[e]:`Failed to delete connection. Please try again.`}))}finally{d(t=>{let n={...t};return delete n[e],n})}}return(0,Q.jsxs)(S.Content,{size:`md`,children:[(0,Q.jsxs)(S.Header,{children:[(0,Q.jsx)(S.Title,{children:`Provider Connections`}),(0,Q.jsx)(S.Description,{children:`Manage inference provider connections. Each connection binds a name to a provider and auth configuration.`})]}),(0,Q.jsx)(S.Body,{children:t?(0,Q.jsx)(`div`,{className:`space-y-2 py-2`,children:[1,2,3].map(e=>(0,Q.jsx)(`div`,{className:`h-10 animate-pulse rounded-lg bg-[var(--surface-active)]`},e))}):n?(0,Q.jsx)(m,{variant:`body-medium-default`,as:`p`,className:`py-4 text-center text-(--system-negative-strong)`,children:`Failed to load connections. Please try again.`}):e.length===0?(0,Q.jsx)(m,{variant:`body-medium-lighter`,as:`p`,className:`py-4 text-center text-(--content-tertiary)`,children:`No connections yet. Create one to get started.`}):(0,Q.jsx)(`div`,{className:`space-y-1`,children:e.map(e=>{let t=u[e.name]??!1,n=c[e.name],r=e.isManaged??!1;return(0,Q.jsxs)(`div`,{children:[(0,Q.jsxs)(`div`,{className:`flex items-center gap-3 rounded-lg px-2 py-2`,children:[(0,Q.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Q.jsx)(m,{variant:`body-medium-default`,as:`span`,className:`text-(--content-default)`,children:e.label??e.name}),r&&(0,Q.jsx)(v,{tone:`positive`,title:`Managed by Platform — auth is locked, but you can rename this connection.`,children:`Platform`})]}),(0,Q.jsxs)(m,{variant:`body-medium-lighter`,as:`p`,className:`mt-0.5 text-(--content-tertiary)`,children:[e.label?`${e.name} · `:``,tt[e.provider]??e.provider,` · `,At(e.auth)]})]}),(0,Q.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2`,children:[(0,Q.jsx)(p,{variant:`ghost`,size:`compact`,onClick:()=>a(e),children:`Edit`}),(0,Q.jsx)(p,{variant:`ghost`,size:`compact`,iconOnly:(0,Q.jsx)(it,{}),"aria-label":`Delete ${e.name}`,disabled:r||t,title:r?`Managed connections cannot be deleted`:void 0,onClick:()=>void f(e.name),tintColor:`var(--system-negative-strong)`})]})]}),n?(0,Q.jsx)(m,{variant:`body-small-default`,as:`p`,className:`px-2 pb-1 text-(--system-negative-strong)`,children:n}):null]},e.name)})})}),(0,Q.jsxs)(S.Footer,{className:`justify-between`,children:[(0,Q.jsx)(p,{variant:`outlined`,size:`compact`,onClick:o,children:`+ New Connection`}),(0,Q.jsx)(p,{variant:`outlined`,size:`compact`,onClick:i,children:`Done`})]})]})}function Nt(e){let[t,n]=(0,Z.useState)(void 0);return(0,Z.useEffect)(()=>{t!==void 0&&e===t.value&&n(void 0)},[e,t]),[t===void 0?e:t.value,(0,Z.useCallback)(e=>n(e===void 0?void 0:{value:e}),[])]}function Pt(){let{assistantId:e,orderedProfiles:t,activeProfile:n,callSites:r}=lt(),i=X(),[o,s]=Nt(n),[c,l]=(0,Z.useState)(!1),[u,d]=(0,Z.useState)(!1),[f,g]=(0,Z.useState)(!1),_=ye.use.queryComplexityRouting(),v=(0,Z.useMemo)(()=>Ie(Re(t,[o]),_),[t,o,_]),y=Object.entries(r).filter(([e,t])=>e!==`mainAgent`&&(t?.profile!=null||t?.provider!=null||t?.model!=null)).length,b=y===1?`1 Override`:y>0?`${y} Overrides`:`Overrides`,x=o!==n,S=(0,Z.useCallback)(async()=>{try{await i.mutateAsync({llm:{activeProfile:o}}),C.success(`Profile saved.`)}catch(e){C.error(`Failed to switch profile. Please try again.`),a(e,{context:`settings-ai-language-model-save`})}},[o,i]);return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(gt,{title:`Language Model`,subtitle:`Configure the LLMs that power your assistant`,children:(0,Q.jsxs)(`div`,{className:`space-y-4`,children:[(0,Q.jsxs)(`div`,{className:`space-y-1`,children:[(0,Q.jsx)(`label`,{className:`block text-body-small-default text-[var(--content-tertiary)]`,children:`Default Profile`}),(0,Q.jsx)(h,{value:o??``,onChange:e=>{s(e===``?null:e)},placeholder:`Select a default profile…`,options:v.map(e=>({value:e.name,label:e.name===`auto`?`Automatically switch between profiles`:Xe(e)}))}),_&&o===`auto`&&(0,Q.jsx)(`div`,{className:`flex items-center gap-2 rounded-lg bg-[var(--surface-warning-subtle)] px-3 py-2`,children:(0,Q.jsx)(`span`,{className:`text-body-small-default text-[var(--content-warning)]`,children:`Auto may use more powerful models when needed, which can increase costs.`})}),v.length===0?(0,Q.jsx)(m,{variant:`body-small-default`,as:`p`,className:`mt-1 text-(--content-tertiary)`,children:`No profiles yet. Click Profiles below to create one.`}):null]}),(0,Q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Q.jsx)(p,{variant:`outlined`,size:`compact`,onClick:()=>g(!0),children:`Providers`}),(0,Q.jsx)(p,{variant:`outlined`,size:`compact`,onClick:()=>l(!0),children:`Profiles`}),(0,Q.jsx)(p,{variant:`outlined`,size:`compact`,onClick:()=>d(!0),children:b})]}),x&&(0,Q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Q.jsx)($,{onClick:S,disabled:i.isPending}),i.isPending&&(0,Q.jsx)(O,{className:`h-4 w-4 animate-spin text-[var(--content-disabled)]`})]})]})}),e&&(0,Q.jsx)(Dt,{isOpen:c,assistantId:e,onClose:()=>l(!1)}),e&&(0,Q.jsx)(Ct,{isOpen:u,onClose:()=>d(!1),assistantId:e}),e&&(0,Q.jsx)(jt,{isOpen:f,assistantId:e,onClose:()=>g(!1)})]})}function Ft(){let{assistantId:e,config:i}=lt(),o=X(),s=ct(),c=l(),{serverWebSearchMode:u,serverWebSearchProvider:d}=(0,Z.useMemo)(()=>{if(!i)return{serverWebSearchMode:n(F,`your-own`),serverWebSearchProvider:n(A,`inference-provider-native`)};let e=i.services?.[`web-search`],t=e?.mode;return{serverWebSearchMode:t===`managed`||t===`your-own`?t:n(F,`your-own`),serverWebSearchProvider:e?.provider||n(`vellum:ai:webSearchProvider`,`inference-provider-native`)}},[i]),[f,p]=(0,Z.useState)(!1),[m,g]=Nt(u),[_,v]=Nt(d),[b,x]=(0,Z.useState)(``),S=ne.has(_),{hasStoredCredential:w,queryKey:T}=$e({assistantId:e,credentialKind:`api_key`,credentialName:_,enabled:S,errorContext:`settings-ai-web-search-read-credential`}),E=b.trim().length>0,D=f||m===`your-own`&&S&&!w&&!E||!(m!==u||(m===`managed`?`inference-provider-native`:_)!==d)&&!E,k=Ne(re[_]??`Enter your API key`,w),j=(0,Z.useCallback)(async()=>{p(!0);let e=b.trim(),t=m===`managed`?`inference-provider-native`:_,n=L(t),i=m===`your-own`&&S&&e.length>0;try{i&&await s(t,e),await o.mutateAsync({services:{"web-search":{mode:m,provider:t}}}).catch(e=>{throw C.error(`Failed to update assistant configuration. Please try again.`),a(e,{context:`patch_daemon_config`}),e})}catch{p(!1);return}p(!1);try{r(F,m),r(A,t),i&&(n&&r(n,e),c.setQueryData(T,!0),c.invalidateQueries({queryKey:T}),x(``)),C.success(`Web search settings saved.`)}catch(e){a(e,{context:`settings-ai-web-search-persist-local`}),C.error(`Saved, but local preferences could not be written.`)}},[S,o,s,c,T,b,m,_]),M=(0,Z.useCallback)(()=>{let e=L(_);e&&t(e),x(``),v(`inference-provider-native`),r(A,`inference-provider-native`)},[_,v]);return(0,Q.jsx)(mt,{title:`Web Search`,subtitle:`Configure how your assistant should search the web`,mode:m,onModeChange:e=>g(e),children:m===`managed`?(0,Q.jsxs)(`div`,{className:`space-y-3`,children:[(0,Q.jsx)(`p`,{className:`text-body-medium-lighter text-[var(--content-tertiary)]`,children:`Web search is included with managed inference.`}),(0,Q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Q.jsx)($,{onClick:j,disabled:D}),f&&(0,Q.jsx)(O,{className:`h-4 w-4 animate-spin text-[var(--content-disabled)]`})]})]}):(0,Q.jsxs)(`div`,{className:`space-y-4`,children:[(0,Q.jsxs)(`div`,{className:`space-y-1`,children:[(0,Q.jsx)(`label`,{className:`block text-body-small-default text-[var(--content-tertiary)]`,children:`Provider`}),(0,Q.jsx)(h,{value:_,onChange:v,options:te.map(e=>({value:e,label:z[e]??e}))})]}),S&&(0,Q.jsx)(y,{label:`API Key`,type:`password`,value:b,onChange:e=>x(e.target.value),placeholder:k,fullWidth:!0}),(0,Q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Q.jsx)($,{onClick:j,disabled:D}),f&&(0,Q.jsx)(O,{className:`h-4 w-4 animate-spin text-[var(--content-disabled)]`}),S&&(0,Q.jsx)(ht,{onClick:M,filled:!0})]})]})})}function It({assistantId:e,assistantHandle:t,emailRootDomain:n}){let r=l(),i=s(),[o,f]=c(),[m,h]=(0,Z.useState)(``),[v,y]=(0,Z.useState)(!1),[b,x]=(0,Z.useState)(null),[S,w]=(0,Z.useState)(``),[D,k]=(0,Z.useState)(null),[A,j]=(0,Z.useState)(!1),[M,N]=(0,Z.useState)(!1),[ee,P]=(0,Z.useState)(!1);(0,Z.useEffect)(()=>{v||!t||m||(h(t),y(!0))},[t,v,m]);let F=u({...Ke(),enabled:!0}),I=F.data,L=I?.entitlements,R=L?.managed_email===!0,z=!!L&&!R,B=!I&&F.isError&&!F.isFetching,V=u({...He({path:{assistant_id:e}}),enabled:!z}),H=u({...Fe({path:{assistant_id:e}}),enabled:!z}),U=V.data?.results?.[0],W=H.data?.results?.[0],te=U?`${U.subdomain}.${n}`:null,G=u({...at({path:{assistant_id:e,id:W?.id??``}}),enabled:!!W?.id,refetchOnWindowFocus:!1}),K=u({...Je({path:{assistant_id:e,id:U?.id??``}}),enabled:!!U?.id,refetchInterval:e=>{let t=e.state.data?.status;return t===`verified`||t===`failed`?!1:1e4},refetchOnWindowFocus:!0});(0,Z.useEffect)(()=>{o.get(`release`)!==`1`||!U||W||(N(!0),f(e=>{let t=new URLSearchParams(e);return t.delete(`release`),t},{replace:!0}))},[W,U,o,f]);let ne=d(nt()),re=d(ze()),q=d(We()),J=d(Ue()),Y=(0,Z.useCallback)(()=>{let t={assistant_id:e};r.invalidateQueries({queryKey:Ze({path:t})}),r.invalidateQueries({queryKey:rt({path:t})}),W?.id&&r.invalidateQueries({queryKey:Le({path:{...t,id:W.id}})}),r.invalidateQueries({queryKey:xe()})},[W?.id,e,r]),ie=(0,Z.useCallback)(async()=>{let t=m.trim().toLowerCase();if(!t){x(`Enter a subdomain.`);return}j(!1);try{await ne.mutateAsync({path:{assistant_id:e},body:{subdomain:t}}),h(``),x(null),Y(),C.success(`Domain ${t}.${n} registered.`)}catch(e){x(me(e,void 0,`Failed to register domain.`))}},[e,n,Y,ne,m]),ae=(0,Z.useCallback)(async()=>{let t=S.trim().toLowerCase();if(!t){k(`Enter an email username.`);return}try{await q.mutateAsync({path:{assistant_id:e},body:{username:t}}),w(``),k(null),Y(),C.success(`Email address created.`)}catch(e){k(me(e,void 0,`Failed to create email address.`))}},[e,Y,q,S]),oe=(0,Z.useCallback)(async()=>{if(W?.id){P(!1);try{await J.mutateAsync({path:{assistant_id:e,id:W.id}}),Y(),C.success(`Email address removed.`)}catch(e){a(e,{context:`email_address_delete`}),C.error(`Failed to remove email address.`)}}},[W?.id,e,J,Y]),se=(0,Z.useCallback)(async()=>{if(!U?.id)return;if(W){C.error(`Remove the email address first.`);return}N(!1);let t=U.subdomain;try{await re.mutateAsync({path:{assistant_id:e,id:U.id}}),h(t),Y(),C.success(`Domain released.`)}catch(e){a(e,{context:`email_domain_release`}),C.error(`Failed to release domain.`)}},[W,e,re,U?.id,U?.subdomain,Y]);if(F.isLoading)return(0,Q.jsxs)(`div`,{className:`flex items-center gap-2 text-body-small-default text-[var(--content-tertiary)]`,children:[(0,Q.jsx)(O,{className:`h-4 w-4 animate-spin`}),`Checking subscription…`]});if(z)return(0,Q.jsxs)(_,{tone:`info`,icon:(0,Q.jsx)(T,{className:`h-4 w-4`,"aria-hidden":!0}),title:`Get a dedicated email address for your assistant`,actions:(0,Q.jsx)(p,{size:`compact`,onClick:()=>i(`${he.settings.billing}?adjust_plan`),children:`Upgrade to Pro`}),children:[`Pro plans include a managed`,` `,`<your-subdomain>.${n}`,` inbox — no provider setup required. Or switch to `,(0,Q.jsx)(`strong`,{children:`Your Own`}),` to bring an existing provider.`]});let ce=B?(0,Q.jsx)(_,{tone:`warning`,title:`Couldn't verify subscription status`,actions:(0,Q.jsx)(p,{size:`compact`,variant:`outlined`,onClick:()=>F.refetch(),children:`Retry`}),children:`We couldn't reach the billing service. The form below assumes managed email is enabled for your org — if it isn't, registering a domain will fail.`}):null;return U?W?(0,Q.jsxs)(`div`,{className:`space-y-4`,children:[ce,(0,Q.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,Q.jsx)(`label`,{className:`block text-body-small-default text-[var(--content-tertiary)]`,children:`Address`}),(0,Q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Q.jsx)(`span`,{className:`font-mono text-body-small-default text-[var(--content-default)]`,children:W.address}),(0,Q.jsx)(vt,{status:K.data?.status,message:K.data?.message,isLoading:K.isLoading}),(0,Q.jsx)(p,{variant:`dangerGhost`,size:`compact`,iconOnly:(0,Q.jsx)(it,{}),onClick:()=>P(!0),disabled:J.isPending,"aria-label":`Remove email address`})]}),(0,Q.jsx)(g,{open:ee,title:`Remove Email Address`,message:(0,Q.jsxs)(Q.Fragment,{children:[`Are you sure you want to remove `,(0,Q.jsx)(`code`,{className:`rounded bg-[var(--surface-active)] px-1 py-0.5 font-mono text-[0.9em]`,children:W.address}),`? Your assistant will no longer be able to send or receive email at this address.`]}),confirmLabel:`Remove`,destructive:!0,onConfirm:oe,onCancel:()=>P(!1)})]}),G.data?.usage&&(0,Q.jsxs)(`p`,{className:`text-body-small-default text-[var(--content-tertiary)]`,children:[G.data.usage.sent_today,` /`,` `,G.data.usage.daily_limit,` sent today ·`,` `,G.data.usage.received_today,` received`]})]}):(0,Q.jsxs)(`div`,{className:`space-y-4`,children:[ce,(0,Q.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,Q.jsx)(`label`,{className:`block text-body-small-default text-[var(--content-tertiary)]`,children:`Domain`}),(0,Q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Q.jsxs)(`span`,{className:`font-mono text-body-small-default text-[var(--content-default)]`,children:[U.subdomain,`.`,n]}),(0,Q.jsx)(vt,{status:K.data?.status,message:K.data?.message,isLoading:K.isLoading}),(0,Q.jsx)(p,{variant:`dangerGhost`,size:`compact`,iconOnly:(0,Q.jsx)(it,{}),onClick:()=>N(!0),disabled:re.isPending,"aria-label":`Release domain`})]}),(0,Q.jsx)(g,{open:M,title:`Release Domain`,message:(0,Q.jsxs)(Q.Fragment,{children:[`Are you sure you want to release `,(0,Q.jsxs)(`code`,{className:`rounded bg-[var(--surface-active)] px-1 py-0.5 font-mono text-[0.9em]`,children:[U.subdomain,`.`,n]}),`? The subdomain will become available for others to claim.`]}),confirmLabel:`Release`,destructive:!0,onConfirm:se,onCancel:()=>N(!1)})]}),(0,Q.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,Q.jsx)(`label`,{className:`block text-body-small-default text-[var(--content-tertiary)]`,children:`Email address`}),(0,Q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Q.jsxs)(`div`,{className:`flex h-9 min-w-0 flex-1 items-center rounded-md border bg-[var(--field-bg)] text-body-medium-lighter transition-[border-color] duration-150 ${D?`border-[var(--system-negative-strong)]`:`border-[var(--field-border)] focus-within:border-[var(--border-active)]`}`,children:[(0,Q.jsx)(`input`,{value:S,onChange:e=>{w(e.target.value.toLowerCase()),D&&k(null)},placeholder:`hi`,"aria-label":`Email username`,"aria-invalid":!!D,className:`h-full min-w-0 flex-1 bg-transparent pl-3 pr-1 text-[var(--content-default)] placeholder:text-[var(--content-tertiary)] outline-none`}),(0,Q.jsxs)(`span`,{className:`shrink-0 pr-3 font-mono text-[var(--content-secondary)]`,children:[`@`,te]})]}),(0,Q.jsx)(p,{onClick:ae,disabled:q.isPending||!S.trim(),children:q.isPending?`Creating…`:`Create`})]}),D&&(0,Q.jsx)(`p`,{className:`text-body-small-default text-[var(--system-negative-strong)]`,children:D})]})]}):(0,Q.jsxs)(`div`,{className:`space-y-3`,children:[ce,(0,Q.jsx)(`label`,{className:`block text-body-small-default text-[var(--content-tertiary)]`,children:`Subdomain`}),(0,Q.jsx)(E,{subdomain:m,onSubdomainChange:e=>{h(e),b&&x(null)},domainSuffix:n,subdomainPlaceholder:`my-assistant`,error:b}),(0,Q.jsx)(`p`,{className:`text-body-small-default text-[var(--content-tertiary)]`,children:`Each assistant gets its own subdomain. Lowercase letters, numbers, and hyphens only.`}),(0,Q.jsx)(p,{onClick:()=>j(!0),disabled:ne.isPending||!m.trim(),children:ne.isPending?`Registering…`:`Register`}),(0,Q.jsx)(g,{open:A,title:`Set Subdomain`,message:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`code`,{className:`rounded bg-[var(--surface-active)] px-1 py-0.5 font-mono text-[0.9em]`,children:m.trim().toLowerCase()||`subdomain`}),` will also become your assistant's public handle. You won't be able to change it once set.`]}),confirmLabel:`Confirm`,onConfirm:ie,onCancel:()=>j(!1)})]})}function Lt(){let e=ot(),t=ge(),{data:o}=u({...Ae(),enabled:t}),s=o?.results?.[0]?.handle,c=dt.use.emailRootDomain(),l=Se(),[d,f]=(0,Z.useState)(()=>l===`gated`?`your-own`:n(I,`managed`)),[p,m]=(0,Z.useState)(()=>n(H,`resend`)),g=u({queryKey:[`byoEmailCredential`,e,p],queryFn:async()=>{let{data:t}=await ce({path:{assistant_id:e},body:{service:p,field:`api_key`},throwOnError:!0});return t},enabled:d===`your-own`||l===`gated`,staleTime:6e4,retry:i,meta:{errorContext:`byo_email_credential_check`}});(0,Z.useEffect)(()=>{g.error&&a(g.error,{context:`byo_email_credential_check`,bestEffort:!0})},[g.error]);let v=g.data?.hasSecret===!0,y=(0,Z.useCallback)(e=>{f(e),r(I,e)},[]),b=(0,Z.useCallback)(()=>{r(H,p),C.success(`Email settings saved.`)},[p]),x=(0,Z.useMemo)(()=>V.find(e=>e.id===p)??V[0],[p]),S=(0,Q.jsxs)(`div`,{className:`flex items-start gap-2 rounded-lg border border-[var(--border-subtle)] bg-[var(--surface-sunken)] p-3 text-body-small-default text-[var(--content-tertiary)]`,children:[(0,Q.jsx)(qe,{className:`mt-0.5 h-3.5 w-3.5 shrink-0 text-[var(--system-positive-strong)]`}),(0,Q.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,Q.jsxs)(`span`,{children:[`Configure `,x.displayName,` via the assistant CLI: ask the assistant to run the`,` `,(0,Q.jsx)(`code`,{className:`rounded bg-[var(--surface-active)] px-1 py-0.5 text-[12px]`,children:x.setupSkill}),` `,`skill. It walks you through storing the API key, detecting the domain, and (optionally) wiring up an inbound webhook.`]}),(0,Q.jsxs)(`a`,{href:x.docsUrl,target:`_blank`,rel:`noopener noreferrer`,className:`inline-flex items-center gap-1 text-[var(--system-positive-strong)] underline hover:opacity-80`,children:[`Open `,x.displayName,(0,Q.jsx)(D,{className:`h-3 w-3`})]})]})]}),w=(0,Q.jsxs)(`div`,{className:`space-y-4`,children:[(0,Q.jsxs)(`div`,{className:`space-y-1`,children:[(0,Q.jsx)(`label`,{className:`block text-body-small-default text-[var(--content-tertiary)]`,children:`Provider`}),(0,Q.jsx)(h,{value:p,onChange:e=>m(e),options:V.map(e=>({value:e.id,label:e.displayName}))})]}),v?(0,Q.jsxs)(`div`,{className:`space-y-3`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center gap-2 rounded-lg border border-[var(--system-positive-subtle)] bg-[var(--surface-sunken)] p-3 text-body-small-default text-[var(--content-default)]`,children:[(0,Q.jsx)(Me,{className:`h-4 w-4 shrink-0 text-[var(--system-positive-strong)]`}),(0,Q.jsxs)(`span`,{children:[x.displayName,` API key configured. To reconfigure, run the`,` `,(0,Q.jsx)(`code`,{className:`rounded bg-[var(--surface-active)] px-1 py-0.5 text-[12px]`,children:x.setupSkill}),` `,`skill.`]})]}),(0,Q.jsxs)(`a`,{href:x.docsUrl,target:`_blank`,rel:`noopener noreferrer`,className:`inline-flex items-center gap-1 text-body-small-default text-[var(--system-positive-strong)] underline hover:opacity-80`,children:[`Open `,x.displayName,(0,Q.jsx)(D,{className:`h-3 w-3`})]})]}):S,(0,Q.jsx)(`div`,{className:`flex items-center gap-2`,children:(0,Q.jsx)($,{onClick:b,disabled:!1})})]});return l===`gated`?(0,Q.jsx)(gt,{id:`email`,title:`Email`,subtitle:`Configure how your assistant sends and receives email`,children:w}):(0,Q.jsx)(mt,{id:`email`,title:`Email`,subtitle:`Configure how your assistant sends and receives email`,mode:d,onModeChange:y,children:d===`managed`?(0,Q.jsx)(`div`,{className:`space-y-4`,children:l===`disabled`?(0,Q.jsx)(_,{tone:`info`,children:`Log in to the Vellum platform to manage email settings.`}):(0,Q.jsx)(It,{assistantId:e,assistantHandle:s,emailRootDomain:c})}):w})}function Rt(){let{config:e}=lt(),{resolveAssistantId:t}=ut(),i=l(),o=X(),s=ct(),[c,u]=Nt((0,Z.useMemo)(()=>{if(!e)return n(q,`your-own`);let t=e.services?.[`image-generation`]?.mode;return t===`managed`||t===`your-own`?t:n(q,`your-own`)},[e])),[d,f]=(0,Z.useState)(()=>n(ie,`gemini-3.1-flash-image-preview`)),[p,m]=(0,Z.useState)(``),[g,_]=(0,Z.useState)(!1),v=(0,Z.useCallback)(async()=>{_(!0);let e=p.trim(),n=c===`your-own`&&e.length>0;try{n&&await s(`gemini`,e),await o.mutateAsync({services:{"image-generation":{mode:c}}}).catch(e=>{throw C.error(`Failed to update assistant configuration. Please try again.`),a(e,{context:`patch_daemon_config`}),e});let r=await t();try{await le({path:{assistant_id:r},body:{modelId:d},throwOnError:!0})}catch(e){throw C.error(`Failed to update image generation model. Please try again.`),a(e,{context:`set_image_gen_model`}),e}finally{i.invalidateQueries({queryKey:_e(r)})}}catch{_(!1);return}_(!1);try{r(q,c),r(ie,d),n&&m(``),C.success(`Image generation settings saved.`)}catch(e){a(e,{context:`settings-ai-image-gen-persist-local`}),C.error(`Saved, but local preferences could not be written.`)}},[p,c,d,o,s,t,i]),b=(0,Z.useCallback)(()=>{m(``),f(`gemini-3.1-flash-image-preview`),r(ie,`gemini-3.1-flash-image-preview`)},[]);return(0,Q.jsx)(mt,{title:`Image Generation`,subtitle:`Configure which model your assistant uses to generate images`,mode:c,onModeChange:e=>u(e),children:c===`managed`?(0,Q.jsxs)(`div`,{className:`space-y-3`,children:[(0,Q.jsx)(`label`,{className:`block text-body-small-default text-[var(--content-tertiary)]`,children:`Active Model`}),(0,Q.jsxs)(`div`,{className:`flex items-end gap-3`,children:[(0,Q.jsx)(h,{className:`flex-1`,value:d,onChange:f,options:B.map(e=>({value:e,label:K[e]??e}))}),(0,Q.jsx)($,{onClick:v,disabled:g}),g&&(0,Q.jsx)(O,{className:`h-4 w-4 animate-spin text-[var(--content-disabled)]`})]})]}):(0,Q.jsxs)(`div`,{className:`space-y-4`,children:[(0,Q.jsx)(y,{label:`API Key`,type:`password`,value:p,onChange:e=>m(e.target.value),placeholder:`Enter your Gemini API key`,fullWidth:!0}),(0,Q.jsxs)(`div`,{className:`space-y-1`,children:[(0,Q.jsx)(`label`,{className:`block text-body-small-default text-[var(--content-tertiary)]`,children:`Active Model`}),(0,Q.jsx)(h,{value:d,onChange:f,options:B.map(e=>({value:e,label:K[e]??e}))})]}),(0,Q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Q.jsx)($,{onClick:v,disabled:g}),g&&(0,Q.jsx)(O,{className:`h-4 w-4 animate-spin text-[var(--content-disabled)]`}),(0,Q.jsx)(ht,{onClick:b})]})]})})}async function zt(e){let{provider:t,apiKey:n,voiceId:r,text:i}=e;if(n.trim().length===0)return{kind:`error`,message:`Save an API key for this provider first.`};try{return t===`elevenlabs`?await Bt(n,r,i):t===`deepgram`?await Vt(n,i):t===`fish-audio`?{kind:`unsupported`,message:`Fish Audio TTS is only supported in the desktop app today. Use ElevenLabs or Deepgram to test from the browser.`}:t===`xai`?{kind:`unsupported`,message:`xAI TTS is only supported in the desktop app today. Use ElevenLabs or Deepgram to test from the browser.`}:{kind:`unsupported`,message:`TTS testing for "${t}" is not supported from the browser yet.`}}catch(e){return{kind:`error`,message:e instanceof Error?e.message:`Failed to reach the TTS provider.`}}}async function Bt(e,t,n){let r=t.trim();if(r.length===0)return{kind:`error`,message:`Enter and save a Voice ID before testing ElevenLabs.`};let i=await fetch(`https://api.elevenlabs.io/v1/text-to-speech/${encodeURIComponent(r)}?output_format=mp3_44100_128`,{method:`POST`,headers:{"xi-api-key":e,"Content-Type":`application/json`,Accept:`audio/mpeg`},body:JSON.stringify({text:n,model_id:`eleven_turbo_v2_5`})});return i.ok?{kind:`audio`,blob:await i.blob()}:{kind:`error`,message:await Ht(i,`ElevenLabs rejected the request.`)}}async function Vt(e,t){let n=await fetch(`https://api.deepgram.com/v1/speak?model=aura-2-thalia-en`,{method:`POST`,headers:{Authorization:`Token ${e}`,"Content-Type":`application/json`,Accept:`audio/mpeg`},body:JSON.stringify({text:t})});return n.ok?{kind:`audio`,blob:await n.blob()}:{kind:`error`,message:await Ht(n,`Deepgram rejected the request.`)}}async function Ht(e,t){try{let n=await e.text();if(n.length===0)return`${t} (HTTP ${e.status})`;try{let e=JSON.parse(n);if(e&&typeof e==`object`&&`detail`in e&&typeof e.detail==`string`)return e.detail;if(e&&typeof e==`object`&&`message`in e&&typeof e.message==`string`)return e.message}catch{}return n.slice(0,200)}catch{return`${t} (HTTP ${e.status})`}}function Ut(){let e=ot(),t=ve.use.name()??`your assistant`,i=ge(),{data:a}=u({...fe({path:{assistant_id:e}}),enabled:i,staleTime:1/0}),o=a?.providers??W,s=o[0]?.id??`elevenlabs`,[c,l]=(0,Z.useState)(()=>n(k,s)),[d,f]=(0,Z.useState)(c),[m,g]=(0,Z.useState)(``),[_,v]=(0,Z.useState)(``),[b,x]=(0,Z.useState)(``),[S,w]=(0,Z.useState)(!1),[T,E]=(0,Z.useState)(!1),D=(0,Z.useMemo)(()=>o.find(e=>e.id===c)??o[0],[c,o]),O=(0,Z.useCallback)(e=>{let t=n(P+e,``),r=n(J+e,``);w(t.length>0),v(r),x(r),g(``)},[]);(0,Z.useEffect)(()=>{O(c)},[c,O]);let A=(0,Z.useMemo)(()=>{let e=c!==d,t=m.trim().length>0,n=_.trim()!==b;return e||t||n},[c,d,m,_,b]),j=(0,Z.useCallback)(()=>{r(k,c);let e=m.trim();e.length>0&&(r(P+c,e),w(!0));let t=_.trim();r(J+c,t),f(c),x(t),g(``)},[c,m,_]),M=(0,Z.useCallback)(()=>{r(P+c,``),w(!1),g(``)},[c]),N=(0,Z.useCallback)(async()=>{E(!0);try{let e=n(P+c,``),r=m.trim(),i=r.length>0?r:e;if(i.length===0){C.error(`Save an API key for this provider before testing.`);return}let a=n(J+c,``),o=_.trim(),s=await zt({provider:c,apiKey:i,voiceId:o.length>0?o:a,text:`Hey! It's ${t}. How does this sound?`});if(s.kind!==`audio`){C.error(s.message);return}let l=URL.createObjectURL(s.blob);try{let e=new Audio(l);await e.play(),await new Promise(t=>{e.onended=()=>t(),e.onerror=()=>t()})}finally{URL.revokeObjectURL(l)}}finally{E(!1)}},[t,m,c,_]),ee=S?`•••••••• (Enter a new key to replace)`:D.apiKeyPlaceholder;return(0,Q.jsx)(gt,{title:`Text-to-Speech`,subtitle:D.subtitle,children:(0,Q.jsxs)(`div`,{className:`space-y-4`,children:[(0,Q.jsxs)(`div`,{className:`space-y-1`,children:[(0,Q.jsx)(`label`,{className:`block text-body-small-default text-[var(--content-tertiary)]`,children:`Provider`}),(0,Q.jsx)(h,{value:c,onChange:l,options:o.map(e=>({value:e.id,label:e.displayName})),"aria-label":`TTS provider`})]}),(0,Q.jsxs)(`div`,{className:`space-y-1`,children:[(0,Q.jsx)(`label`,{className:`block text-body-small-default text-[var(--content-tertiary)]`,children:`API Key`}),(0,Q.jsx)(y,{type:`password`,value:m,onChange:e=>g(e.target.value),placeholder:ee,fullWidth:!0})]}),D.supportsVoiceSelection&&(0,Q.jsxs)(`div`,{className:`space-y-1`,children:[(0,Q.jsx)(`label`,{className:`block text-body-small-default text-[var(--content-tertiary)]`,children:`Voice ID`}),(0,Q.jsx)(y,{type:`text`,value:_,onChange:e=>v(e.target.value),placeholder:`Enter a voice ID`,fullWidth:!0})]}),(0,Q.jsx)(_t,{guide:D.credentialsGuide}),(0,Q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Q.jsx)(p,{variant:`outlined`,onClick:N,disabled:T,children:T?`Testing…`:`Test`}),(0,Q.jsxs)(`div`,{className:`ml-auto flex items-center gap-2`,children:[(0,Q.jsx)($,{onClick:j,disabled:!A}),S&&(0,Q.jsx)(ht,{onClick:M})]})]})]})})}function Wt(){let e=N[0]?.id??`deepgram`,[t,i]=(0,Z.useState)(()=>n(Y,e)),[a,o]=(0,Z.useState)(t),[s,c]=(0,Z.useState)(``),[l,u]=(0,Z.useState)(!1),d=(0,Z.useMemo)(()=>N.find(e=>e.id===t)??N[0],[t]);(0,Z.useEffect)(()=>{u(n(R+t,``).length>0),c(``)},[t]);let f=(0,Z.useMemo)(()=>{let e=t!==a,n=s.trim().length>0;return e||n},[t,a,s]),p=(0,Z.useCallback)(()=>{r(Y,t);let e=s.trim();e.length>0&&(r(R+t,e),u(!0)),o(t),c(``)},[t,s]),m=(0,Z.useCallback)(()=>{r(R+t,``),u(!1),c(``)},[t]),g=l?`•••••••• (Enter a new key to replace)`:d.apiKeyPlaceholder;return(0,Q.jsx)(gt,{title:`Speech-to-Text`,subtitle:d.subtitle,children:(0,Q.jsxs)(`div`,{className:`space-y-4`,children:[(0,Q.jsxs)(`div`,{className:`space-y-1`,children:[(0,Q.jsx)(`label`,{className:`block text-body-small-default text-[var(--content-tertiary)]`,children:`Provider`}),(0,Q.jsx)(h,{value:t,onChange:i,options:N.map(e=>({value:e.id,label:e.displayName})),"aria-label":`STT provider`})]}),(0,Q.jsxs)(`div`,{className:`space-y-1`,children:[(0,Q.jsx)(`label`,{className:`block text-body-small-default text-[var(--content-tertiary)]`,children:`API Key`}),(0,Q.jsx)(y,{type:`password`,value:s,onChange:e=>c(e.target.value),placeholder:g,fullWidth:!0})]}),(0,Q.jsx)(_t,{guide:d.credentialsGuide}),(0,Q.jsxs)(`div`,{className:`flex items-center justify-end gap-2`,children:[(0,Q.jsx)($,{onClick:p,disabled:!f}),l&&(0,Q.jsx)(ht,{onClick:m})]})]})})}function Gt(){return(0,Z.useEffect)(()=>{let e=window.location.hash.slice(1);e&&requestAnimationFrame(()=>{document.getElementById(e)?.scrollIntoView({block:`start`})})},[]),(0,Q.jsxs)(`div`,{className:`space-y-5`,children:[(0,Q.jsxs)(`div`,{className:`flex items-start gap-2 rounded-lg border border-[var(--border-base)] bg-[var(--surface-base)] px-4 py-2.5`,children:[(0,Q.jsx)(qe,{className:`mt-0.5 h-4 w-4 shrink-0 text-[var(--content-tertiary)]`}),(0,Q.jsxs)(`p`,{className:`text-body-medium-lighter text-[var(--content-secondary)]`,children:[`Managed services are metered and deducted from your Vellum account balance.`,` `,(0,Q.jsxs)(`a`,{href:`https://www.vellum.ai/docs/pricing`,target:`_blank`,rel:`noopener noreferrer`,className:`inline-flex items-center gap-1 text-[var(--primary-base)] hover:underline`,children:[`View pricing`,(0,Q.jsx)(D,{className:`h-3.5 w-3.5`})]})]})]}),(0,Q.jsx)(Pt,{}),(0,Q.jsx)(Ft,{}),(0,Q.jsx)(Lt,{}),(0,Q.jsx)(Rt,{}),(0,Q.jsx)(Ut,{}),(0,Q.jsx)(Wt,{})]})}export{Gt as AiPage};
@@ -0,0 +1 @@
1
+ var e={anthropic:[{id:`claude-fable-5`,displayName:`Claude Fable 5`,contextWindowTokens:1e6,defaultContextWindowTokens:2e5,maxOutputTokens:128e3,supportsThinking:!0,adaptiveThinkingOnly:!0,longContextPricingThresholdTokens:2e5},{id:`claude-opus-4-8`,displayName:`Claude Opus 4.8`,contextWindowTokens:1e6,defaultContextWindowTokens:2e5,maxOutputTokens:128e3,supportsThinking:!0,longContextPricingThresholdTokens:2e5},{id:`claude-opus-4-7`,displayName:`Claude Opus 4.7`,contextWindowTokens:1e6,defaultContextWindowTokens:2e5,maxOutputTokens:128e3,supportsThinking:!0,longContextPricingThresholdTokens:2e5},{id:`claude-opus-4-6`,displayName:`Claude Opus 4.6`,contextWindowTokens:1e6,defaultContextWindowTokens:2e5,maxOutputTokens:128e3,supportsThinking:!0,longContextPricingThresholdTokens:2e5},{id:`claude-sonnet-4-6`,displayName:`Claude Sonnet 4.6`,contextWindowTokens:1e6,defaultContextWindowTokens:2e5,maxOutputTokens:64e3,supportsThinking:!0,longContextPricingThresholdTokens:2e5},{id:`claude-sonnet-4-5-20250929`,displayName:`Claude Sonnet 4.5`,contextWindowTokens:2e5,defaultContextWindowTokens:2e5,maxOutputTokens:64e3,supportsThinking:!0},{id:`claude-opus-4-5-20251101`,displayName:`Claude Opus 4.5`,contextWindowTokens:2e5,defaultContextWindowTokens:2e5,maxOutputTokens:64e3,supportsThinking:!0},{id:`claude-haiku-4-5-20251001`,displayName:`Claude Haiku 4.5`,contextWindowTokens:2e5,defaultContextWindowTokens:2e5,maxOutputTokens:64e3,supportsThinking:!0}],openai:[{id:`gpt-5.5`,displayName:`GPT-5.5`,contextWindowTokens:105e4,defaultContextWindowTokens:2e5,maxOutputTokens:128e3,supportsThinking:!0,longContextPricingThresholdTokens:272e3},{id:`gpt-5.5-pro`,displayName:`GPT-5.5 Pro`,contextWindowTokens:105e4,defaultContextWindowTokens:2e5,maxOutputTokens:128e3,supportsThinking:!0,longContextPricingThresholdTokens:272e3},{id:`gpt-5.4`,displayName:`GPT-5.4`,contextWindowTokens:105e4,defaultContextWindowTokens:2e5,maxOutputTokens:128e3,supportsThinking:!0,longContextPricingThresholdTokens:272e3},{id:`gpt-5.2`,displayName:`GPT-5.2`,contextWindowTokens:4e5,defaultContextWindowTokens:2e5,maxOutputTokens:128e3,supportsThinking:!0},{id:`gpt-5.4-mini`,displayName:`GPT-5.4 Mini`,contextWindowTokens:4e5,defaultContextWindowTokens:2e5,maxOutputTokens:128e3,supportsThinking:!0},{id:`gpt-5.4-nano`,displayName:`GPT-5.4 Nano`,contextWindowTokens:4e5,defaultContextWindowTokens:2e5,maxOutputTokens:128e3,supportsThinking:!0}],gemini:[{id:`gemini-3.5-flash`,displayName:`Gemini 3.5 Flash`,contextWindowTokens:1048576,defaultContextWindowTokens:2e5,maxOutputTokens:65536,supportsThinking:!0},{id:`gemini-3.1-pro-preview`,displayName:`Gemini 3.1 Pro Preview`,contextWindowTokens:1048576,defaultContextWindowTokens:2e5,maxOutputTokens:65536,supportsThinking:!0,longContextPricingThresholdTokens:2e5},{id:`gemini-3.1-pro-preview-customtools`,displayName:`Gemini 3.1 Pro Preview (Custom Tools)`,contextWindowTokens:1048576,defaultContextWindowTokens:2e5,maxOutputTokens:65536,supportsThinking:!0,longContextPricingThresholdTokens:2e5},{id:`gemini-3-flash-preview`,displayName:`Gemini 3 Flash Preview`,contextWindowTokens:1048576,defaultContextWindowTokens:2e5,maxOutputTokens:65536,supportsThinking:!0},{id:`gemini-3.1-flash-lite-preview`,displayName:`Gemini 3.1 Flash-Lite Preview`,contextWindowTokens:1048576,defaultContextWindowTokens:2e5,maxOutputTokens:65536,supportsThinking:!0},{id:`gemini-3.1-flash-lite`,displayName:`Gemini 3.1 Flash-Lite`,contextWindowTokens:1048576,defaultContextWindowTokens:2e5,maxOutputTokens:65536,supportsThinking:!0},{id:`gemini-2.5-flash`,displayName:`Gemini 2.5 Flash`,contextWindowTokens:1e6,defaultContextWindowTokens:2e5,maxOutputTokens:65536,supportsThinking:!0},{id:`gemini-2.5-flash-lite`,displayName:`Gemini 2.5 Flash Lite`,contextWindowTokens:1e6,defaultContextWindowTokens:2e5,maxOutputTokens:65536},{id:`gemini-2.5-pro`,displayName:`Gemini 2.5 Pro`,contextWindowTokens:1048576,defaultContextWindowTokens:2e5,maxOutputTokens:65536,supportsThinking:!0,longContextPricingThresholdTokens:2e5}],fireworks:[{id:`accounts/fireworks/models/kimi-k2p6`,displayName:`Kimi K2.6`,contextWindowTokens:262144,defaultContextWindowTokens:2e5,maxOutputTokens:32768,supportsThinking:!0},{id:`accounts/fireworks/models/kimi-k2p5`,displayName:`Kimi K2.5`,contextWindowTokens:256e3,defaultContextWindowTokens:2e5,maxOutputTokens:32768},{id:`accounts/fireworks/models/minimax-m3`,displayName:`MiniMax M3`,contextWindowTokens:524288,defaultContextWindowTokens:2e5,maxOutputTokens:512e3,supportsThinking:!0},{id:`accounts/fireworks/models/minimax-m2p7`,displayName:`MiniMax M2.7`,contextWindowTokens:196608,defaultContextWindowTokens:196608,maxOutputTokens:25e3},{id:`accounts/fireworks/models/minimax-m2p5`,displayName:`MiniMax M2.5`,contextWindowTokens:196608,defaultContextWindowTokens:196608,maxOutputTokens:25e3},{id:`accounts/fireworks/models/deepseek-v4-pro`,displayName:`DeepSeek V4 Pro`,contextWindowTokens:104e4,defaultContextWindowTokens:2e5,maxOutputTokens:131072,supportsThinking:!0}],openrouter:[{id:`anthropic/claude-fable-5`,displayName:`Claude Fable 5`,contextWindowTokens:1e6,defaultContextWindowTokens:2e5,maxOutputTokens:128e3,supportsThinking:!0,adaptiveThinkingOnly:!0,longContextPricingThresholdTokens:2e5},{id:`anthropic/claude-opus-4.8`,displayName:`Claude Opus 4.8`,contextWindowTokens:1e6,defaultContextWindowTokens:2e5,maxOutputTokens:128e3,supportsThinking:!0,longContextPricingThresholdTokens:2e5},{id:`anthropic/claude-opus-4.7`,displayName:`Claude Opus 4.7`,contextWindowTokens:1e6,defaultContextWindowTokens:2e5,maxOutputTokens:128e3,supportsThinking:!0,longContextPricingThresholdTokens:2e5},{id:`anthropic/claude-opus-4.6`,displayName:`Claude Opus 4.6`,contextWindowTokens:1e6,defaultContextWindowTokens:2e5,maxOutputTokens:128e3,supportsThinking:!0,longContextPricingThresholdTokens:2e5},{id:`anthropic/claude-sonnet-4.6`,displayName:`Claude Sonnet 4.6`,contextWindowTokens:1e6,defaultContextWindowTokens:2e5,maxOutputTokens:64e3,supportsThinking:!0,longContextPricingThresholdTokens:2e5},{id:`anthropic/claude-sonnet-4.5`,displayName:`Claude Sonnet 4.5`,contextWindowTokens:2e5,defaultContextWindowTokens:2e5,maxOutputTokens:64e3,supportsThinking:!0},{id:`anthropic/claude-opus-4.5`,displayName:`Claude Opus 4.5`,contextWindowTokens:2e5,defaultContextWindowTokens:2e5,maxOutputTokens:64e3,supportsThinking:!0},{id:`anthropic/claude-haiku-4.5`,displayName:`Claude Haiku 4.5`,contextWindowTokens:2e5,defaultContextWindowTokens:2e5,maxOutputTokens:64e3,supportsThinking:!0},{id:`x-ai/grok-4.20-beta`,displayName:`Grok 4.20 Beta`,contextWindowTokens:256e3,defaultContextWindowTokens:2e5,maxOutputTokens:16e3,supportsThinking:!0},{id:`x-ai/grok-4.3`,displayName:`Grok 4.3`,contextWindowTokens:1e6,defaultContextWindowTokens:2e5,maxOutputTokens:16e3,supportsThinking:!0},{id:`x-ai/grok-4`,displayName:`Grok 4`,contextWindowTokens:131072,defaultContextWindowTokens:131072,maxOutputTokens:16e3,supportsThinking:!0},{id:`deepseek/deepseek-r1-0528`,displayName:`DeepSeek R1`,contextWindowTokens:163840,defaultContextWindowTokens:163840,maxOutputTokens:32e3,supportsThinking:!0},{id:`deepseek/deepseek-chat-v3-0324`,displayName:`DeepSeek V3`,contextWindowTokens:163840,defaultContextWindowTokens:163840,maxOutputTokens:32e3},{id:`deepseek/deepseek-v4-pro`,displayName:`DeepSeek V4 Pro`,contextWindowTokens:1048576,defaultContextWindowTokens:2e5,maxOutputTokens:384e3,supportsThinking:!0},{id:`deepseek/deepseek-v4-flash`,displayName:`DeepSeek V4 Flash`,contextWindowTokens:1048576,defaultContextWindowTokens:2e5,maxOutputTokens:384e3,supportsThinking:!0},{id:`deepseek/deepseek-v3.2-speciale`,displayName:`DeepSeek V3.2 Speciale`,contextWindowTokens:163840,defaultContextWindowTokens:163840,maxOutputTokens:163840,supportsThinking:!0},{id:`qwen/qwen3.5-plus-02-15`,displayName:`Qwen 3.5 Plus`,contextWindowTokens:131072,defaultContextWindowTokens:131072,maxOutputTokens:8192,supportsThinking:!0},{id:`qwen/qwen3.5-397b-a17b`,displayName:`Qwen 3.5 397B`,contextWindowTokens:131072,defaultContextWindowTokens:131072,maxOutputTokens:8192,supportsThinking:!0},{id:`qwen/qwen3.5-flash-02-23`,displayName:`Qwen 3.5 Flash`,contextWindowTokens:131072,defaultContextWindowTokens:131072,maxOutputTokens:8192},{id:`qwen/qwen3-coder-next`,displayName:`Qwen 3 Coder`,contextWindowTokens:131072,defaultContextWindowTokens:131072,maxOutputTokens:8192},{id:`moonshotai/kimi-k2.6`,displayName:`Kimi K2.6`,contextWindowTokens:262144,defaultContextWindowTokens:2e5,maxOutputTokens:32768,supportsThinking:!0},{id:`moonshotai/kimi-k2.5`,displayName:`Kimi K2.5`,contextWindowTokens:256e3,defaultContextWindowTokens:2e5,maxOutputTokens:32768},{id:`minimax/minimax-m3`,displayName:`MiniMax M3`,contextWindowTokens:524288,defaultContextWindowTokens:2e5,maxOutputTokens:512e3,supportsThinking:!0},{id:`minimax/minimax-m2.7`,displayName:`MiniMax M2.7`,contextWindowTokens:196608,defaultContextWindowTokens:196608,maxOutputTokens:131072,supportsThinking:!0},{id:`minimax/minimax-m2.5`,displayName:`MiniMax M2.5`,contextWindowTokens:196608,defaultContextWindowTokens:196608,maxOutputTokens:196608,supportsThinking:!0},{id:`minimax/minimax-m2.1`,displayName:`MiniMax M2.1`,contextWindowTokens:196608,defaultContextWindowTokens:196608,maxOutputTokens:196608,supportsThinking:!0},{id:`minimax/minimax-m2`,displayName:`MiniMax M2`,contextWindowTokens:196608,defaultContextWindowTokens:196608,maxOutputTokens:196608,supportsThinking:!0},{id:`minimax/minimax-m2-her`,displayName:`MiniMax M2-her`,contextWindowTokens:65536,defaultContextWindowTokens:65536,maxOutputTokens:2048},{id:`minimax/minimax-m1`,displayName:`MiniMax M1`,contextWindowTokens:1e6,defaultContextWindowTokens:2e5,maxOutputTokens:4e4,supportsThinking:!0},{id:`minimax/minimax-01`,displayName:`MiniMax-01`,contextWindowTokens:1e6,defaultContextWindowTokens:2e5,maxOutputTokens:1e6},{id:`mistralai/mistral-medium-3`,displayName:`Mistral Medium 3`,contextWindowTokens:131072,defaultContextWindowTokens:131072,maxOutputTokens:16e3},{id:`mistralai/mistral-small-2603`,displayName:`Mistral Small 4`,contextWindowTokens:131072,defaultContextWindowTokens:131072,maxOutputTokens:16e3},{id:`mistralai/devstral-2512`,displayName:`Devstral 2`,contextWindowTokens:131072,defaultContextWindowTokens:131072,maxOutputTokens:16e3},{id:`meta-llama/llama-4-maverick`,displayName:`Llama 4 Maverick`,contextWindowTokens:1e6,defaultContextWindowTokens:2e5,maxOutputTokens:16e3},{id:`meta-llama/llama-4-scout`,displayName:`Llama 4 Scout`,contextWindowTokens:327680,defaultContextWindowTokens:2e5,maxOutputTokens:16e3},{id:`amazon/nova-pro-v1`,displayName:`Amazon Nova Pro`,contextWindowTokens:3e5,defaultContextWindowTokens:2e5,maxOutputTokens:5e3},{id:`openrouter/owl-alpha`,displayName:`Owl Alpha`,contextWindowTokens:1048576,defaultContextWindowTokens:2e5,maxOutputTokens:262144}],minimax:[{id:`MiniMax-M3`,displayName:`MiniMax M3`,contextWindowTokens:1e6,defaultContextWindowTokens:2e5,maxOutputTokens:512e3,supportsThinking:!0},{id:`MiniMax-M2.7`,displayName:`MiniMax M2.7`,contextWindowTokens:2e5,defaultContextWindowTokens:2e5,maxOutputTokens:16384,supportsThinking:!0}],"openai-compatible":[]},t={anthropic:`claude-opus-4-8`,openai:`gpt-5.5`,gemini:`gemini-2.5-flash`,fireworks:`accounts/fireworks/models/kimi-k2p5`,openrouter:`x-ai/grok-4.20-beta`,minimax:`MiniMax-M2.7`,"openai-compatible":``},n={anthropic:`Anthropic`,openai:`OpenAI`,gemini:`Google Gemini`,ollama:`Ollama`,fireworks:`Fireworks`,openrouter:`OpenRouter`,"openai-compatible":`OpenAI-compatible`,minimax:`MiniMax`},r={anthropic:!0,openai:!0,gemini:!0,ollama:!1,fireworks:!0,openrouter:!1,"openai-compatible":!1,minimax:!1};e.anthropic;function i(t){return e[t]??[]}function a(e){return t[e]}function o(e){return r[e]===!0}var s=`openai-compatible`,c=[`gemini-3.1-flash-image-preview`,`gemini-3-pro-image-preview`],l={"gemini-3.1-flash-image-preview":`Nano Banana 2`,"gemini-3-pro-image-preview":`Nano Banana Pro`},u=[`anthropic`,`openai`,`fireworks`,`openrouter`,`gemini`,`minimax`],d=n,f=[{id:`elevenlabs`,displayName:`ElevenLabs`,subtitle:`High-quality voice synthesis for conversations and read-aloud. Requires an ElevenLabs API key.`,supportsVoiceSelection:!0,apiKeyPlaceholder:`sk_…`,credentialsGuide:{description:`Sign in to ElevenLabs, go to your Profile, and copy your API key.`,url:`https://elevenlabs.io/app/settings/api-keys`,linkLabel:`Open ElevenLabs API Keys`}},{id:`fish-audio`,displayName:`Fish Audio`,subtitle:`Natural-sounding voice synthesis with custom voice cloning. Requires a Fish Audio API key and voice reference ID.`,supportsVoiceSelection:!0,apiKeyPlaceholder:`Enter your Fish Audio API key`,credentialsGuide:{description:`Sign in to Fish Audio, navigate to API Keys in your dashboard, and create a new key.`,url:`https://fish.audio/app/api-keys/`,linkLabel:`Open Fish Audio API Keys`}},{id:`deepgram`,displayName:`Deepgram`,subtitle:`Fast, accurate text-to-speech synthesis. Uses the same API key as Deepgram speech-to-text.`,supportsVoiceSelection:!1,apiKeyPlaceholder:`Enter your Deepgram API key`,credentialsGuide:{description:`Sign in to Deepgram, navigate to your API Keys page, and create or copy an existing key. This is the same key used for speech-to-text.`,url:`https://console.deepgram.com/`,linkLabel:`Open Deepgram Console`}},{id:`xai`,displayName:`xAI`,subtitle:`Text-to-speech from xAI with expressive voices (eve, ara, rex, sal, leo). Requires an xAI API key.`,supportsVoiceSelection:!1,apiKeyPlaceholder:`Enter your xAI API key`,credentialsGuide:{description:`Sign in to the xAI console, navigate to API Keys, and create a new key.`,url:`https://console.x.ai/`,linkLabel:`Open xAI Console`}}],p=[{id:`deepgram`,displayName:`Deepgram`,subtitle:`Fast, accurate speech-to-text transcription. Uses the same API key as Deepgram text-to-speech.`,apiKeyPlaceholder:`Enter your Deepgram API key`,credentialsGuide:{description:`Sign in to Deepgram, navigate to your API Keys page, and create or copy an existing key. This is the same key used for text-to-speech.`,url:`https://console.deepgram.com/`,linkLabel:`Open Deepgram Console`}},{id:`openai`,displayName:`OpenAI`,subtitle:`OpenAI Whisper transcription. Requires an OpenAI API key.`,apiKeyPlaceholder:`sk-…`,credentialsGuide:{description:`Sign in to the OpenAI platform, navigate to API Keys, and create a new secret key.`,url:`https://platform.openai.com/api-keys`,linkLabel:`Open OpenAI API Keys`}}],m=[{id:`mailgun`,displayName:`Mailgun`,setupSkill:`mailgun-setup`,docsUrl:`https://www.mailgun.com/`},{id:`resend`,displayName:`Resend`,setupSkill:`resend-setup`,docsUrl:`https://resend.com/`}],h=`vellum:ai:imageGenMode`,g=`vellum:ai:imageGenModel`,_=`vellum:ai:webSearchMode`,v=`vellum:ai:webSearchProvider`,y=`vellum:ai:emailMode`,b=`vellum:ai:emailByoProvider`,x=`vellum:voice:ttsProvider`,S=`vellum:voice:ttsApiKey:`,C=`vellum:voice:ttsVoiceId:`,w=`vellum:voice:sttProvider`,T=`vellum:voice:sttApiKey:`,E=[`inference-provider-native`,`perplexity`,`brave`,`tavily`],D={"inference-provider-native":`Provider Native`,perplexity:`Perplexity`,brave:`Brave`,tavily:`Tavily`},O={perplexity:`pplx-...`,brave:`BSA...`,tavily:`tvly-...`},k={perplexity:`vellum:ai:perplexityKey`,brave:`vellum:ai:braveKey`,tavily:`vellum:ai:tavilyKey`},A=new Set([`perplexity`,`brave`,`tavily`]);function j(e,t){let n=t.filter(t=>t in e).map(t=>({name:t,...e[t]})),r=new Set(t),i=Object.entries(e).filter(([e])=>!r.has(e)).map(([e,t])=>({name:e,...t}));return[...n,...i]}function M(e){if(e&&typeof e==`object`&&`success`in e&&e.success===!1)throw Error(`Failed to provision API key: server returned success=false`)}function N(e,t){return e.toLocaleString(`en-US`,{maximumFractionDigits:t,minimumFractionDigits:0})}function P(e){let t=Array.isArray(e)?e[0]??0:e,n=Math.round(t);return Math.abs(n)>=1e6?`${N(n/1e6,2)}M`:Math.abs(n)>=1e3?`${N(n/1e3,1)}K`:n.toLocaleString(`en-US`)}function F(e){return k[e]??``}function I(e,t){let n={};if(`memory`in t&&(n.memory=e.memory?structuredClone(e.memory):null),t.services){let r={};`web-search`in t.services&&(r[`web-search`]=e.services?.[`web-search`]?{...e.services[`web-search`]}:null),`image-generation`in t.services&&(r[`image-generation`]=e.services?.[`image-generation`]?{...e.services[`image-generation`]}:null),n.services=r}if(t.llm){let r={};if(`activeProfile`in t.llm&&(r.activeProfile=e.llm?.activeProfile??null),`profileOrder`in t.llm&&(r.profileOrder=e.llm?.profileOrder?[...e.llm.profileOrder]:[]),`default`in t.llm&&(r.default=e.llm?.default?{...e.llm.default}:null),t.llm.profiles){let n={};for(let r of Object.keys(t.llm.profiles)){let t=e.llm?.profiles?.[r];n[r]=t?{...t}:null}r.profiles=n}if(t.llm.callSites){let n={};for(let r of Object.keys(t.llm.callSites)){let t=e.llm?.callSites?.[r];n[r]=t?{...t}:null}r.callSites=n}n.llm=r}return n}function L(e,t){let n={...e};if(`memory`in t&&(t.memory===null?delete n.memory:t.memory&&(n.memory={...n.memory,...t.memory})),t.services){let e={...n.services};if(`web-search`in t.services){let n=t.services[`web-search`];n===null?delete e[`web-search`]:n&&(e[`web-search`]={...e[`web-search`],...n})}if(`image-generation`in t.services){let n=t.services[`image-generation`];n===null?delete e[`image-generation`]:n&&(e[`image-generation`]={...e[`image-generation`],...n})}n.services=e}if(t.llm){let e={...n.llm};if(`activeProfile`in t.llm&&(e.activeProfile=t.llm.activeProfile??void 0),`profileOrder`in t.llm&&(e.profileOrder=t.llm.profileOrder),`default`in t.llm&&(t.llm.default===null?delete e.default:t.llm.default&&(e.default={...e.default,...t.llm.default})),t.llm.profiles){let n={...e.profiles};for(let[e,r]of Object.entries(t.llm.profiles))r===null?delete n[e]:n[e]={...n[e],...r};e.profiles=n}if(t.llm.callSites){let n={...e.callSites};for(let[e,r]of Object.entries(t.llm.callSites))r===null?n[e]=null:n[e]={...n[e]??{},...r};e.callSites=n}n.llm=e}return n}export{e as A,x as C,s as D,v as E,a as M,i as N,p as O,o as P,S,_ as T,y as _,F as a,T as b,D as c,c as d,m as f,b as g,d as h,P as i,n as j,f as k,E as l,u as m,M as n,I as o,l as p,j as r,A as s,L as t,O as u,h as v,C as w,w as x,g as y};
@@ -1,4 +1,4 @@
1
- import{r as e}from"./chunk-jRWAZmH_.js";import{A as t,C as n,l as r}from"./resolved-assistants-store-B5ATyCT9.js";import{$ as i,_ as a,et as o,g as s,h as c,mt as l}from"./sdk.gen-18Tp6Ee_.js";import{i as u,n as d}from"./api-errors-CsfCFJ8r.js";import{C as f,F as p,I as ee,L as te,a as ne,i as re,o as ie,w as ae}from"./sdk.gen-ClmX029Q.js";Object.freeze({status:`aborted`});function m(e,t,n){function r(n,r){if(n._zod||Object.defineProperty(n,`_zod`,{value:{def:r,constr:o,traits:new Set},enumerable:!1}),n._zod.traits.has(e))return;n._zod.traits.add(e),t(n,r);let i=o.prototype,a=Object.keys(i);for(let e=0;e<a.length;e++){let t=a[e];t in n||(n[t]=i[t].bind(n))}}let i=n?.Parent??Object;class a extends i{}Object.defineProperty(a,`name`,{value:e});function o(e){var t;let i=n?.Parent?new a:this;r(i,e),(t=i._zod).deferred??(t.deferred=[]);for(let e of i._zod.deferred)e();return i}return Object.defineProperty(o,`init`,{value:r}),Object.defineProperty(o,Symbol.hasInstance,{value:t=>n?.Parent&&t instanceof n.Parent?!0:t?._zod?.traits?.has(e)}),Object.defineProperty(o,`name`,{value:e}),o}var h=class extends Error{constructor(){super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`)}},oe=class extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name=`ZodEncodeError`}},se={};function g(e){return e&&Object.assign(se,e),se}function ce(e){let t=Object.values(e).filter(e=>typeof e==`number`);return Object.entries(e).filter(([e,n])=>t.indexOf(+e)===-1).map(([e,t])=>t)}function le(e,t){return typeof t==`bigint`?t.toString():t}function _(e){return{get value(){{let t=e();return Object.defineProperty(this,`value`,{value:t}),t}throw Error(`cached value already set`)}}}function ue(e){return e==null}function de(e){let t=+!!e.startsWith(`^`),n=e.endsWith(`$`)?e.length-1:e.length;return e.slice(t,n)}function fe(e,t){let n=(e.toString().split(`.`)[1]||``).length,r=t.toString(),i=(r.split(`.`)[1]||``).length;if(i===0&&/\d?e-\d?/.test(r)){let e=r.match(/\d?e-(\d?)/);e?.[1]&&(i=Number.parseInt(e[1]))}let a=n>i?n:i;return Number.parseInt(e.toFixed(a).replace(`.`,``))%Number.parseInt(t.toFixed(a).replace(`.`,``))/10**a}var pe=Symbol(`evaluating`);function v(e,t,n){let r;Object.defineProperty(e,t,{get(){if(r!==pe)return r===void 0&&(r=pe,r=n()),r},set(n){Object.defineProperty(e,t,{value:n})},configurable:!0})}function y(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function b(...e){let t={};for(let n of e)Object.assign(t,Object.getOwnPropertyDescriptors(n));return Object.defineProperties({},t)}function me(e){return JSON.stringify(e)}function he(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,``).replace(/[\s_-]+/g,`-`).replace(/^-+|-+$/g,``)}var ge=`captureStackTrace`in Error?Error.captureStackTrace:(...e)=>{};function x(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}var _e=_(()=>{if(typeof navigator<`u`&&navigator?.userAgent?.includes(`Cloudflare`))return!1;try{return Function(``),!0}catch{return!1}});function S(e){if(x(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!=`function`)return!0;let n=t.prototype;return!(x(n)===!1||Object.prototype.hasOwnProperty.call(n,`isPrototypeOf`)===!1)}function ve(e){return S(e)?{...e}:Array.isArray(e)?[...e]:e}var ye=new Set([`string`,`number`,`symbol`]);function C(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function w(e,t,n){let r=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(r._zod.parent=e),r}function T(e){let t=e;if(!t)return{};if(typeof t==`string`)return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error==`string`?{...t,error:()=>t.error}:t}function be(e){return Object.keys(e).filter(t=>e[t]._zod.optin===`optional`&&e[t]._zod.optout===`optional`)}var xe={safeint:[-(2**53-1),2**53-1],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function Se(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.pick() cannot be used on object schemas containing refinements`);return w(e,b(e._zod.def,{get shape(){let e={};for(let r in t){if(!(r in n.shape))throw Error(`Unrecognized key: "${r}"`);t[r]&&(e[r]=n.shape[r])}return y(this,`shape`,e),e},checks:[]}))}function Ce(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.omit() cannot be used on object schemas containing refinements`);return w(e,b(e._zod.def,{get shape(){let r={...e._zod.def.shape};for(let e in t){if(!(e in n.shape))throw Error(`Unrecognized key: "${e}"`);t[e]&&delete r[e]}return y(this,`shape`,r),r},checks:[]}))}function we(e,t){if(!S(t))throw Error(`Invalid input to extend: expected a plain object`);let n=e._zod.def.checks;if(n&&n.length>0){let n=e._zod.def.shape;for(let e in t)if(Object.getOwnPropertyDescriptor(n,e)!==void 0)throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}return w(e,b(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return y(this,`shape`,n),n}}))}function Te(e,t){if(!S(t))throw Error(`Invalid input to safeExtend: expected a plain object`);return w(e,b(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return y(this,`shape`,n),n}}))}function Ee(e,t){return w(e,b(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t._zod.def.shape};return y(this,`shape`,n),n},get catchall(){return t._zod.def.catchall},checks:[]}))}function De(e,t,n){let r=t._zod.def.checks;if(r&&r.length>0)throw Error(`.partial() cannot be used on object schemas containing refinements`);return w(t,b(t._zod.def,{get shape(){let r=t._zod.def.shape,i={...r};if(n)for(let t in n){if(!(t in r))throw Error(`Unrecognized key: "${t}"`);n[t]&&(i[t]=e?new e({type:`optional`,innerType:r[t]}):r[t])}else for(let t in r)i[t]=e?new e({type:`optional`,innerType:r[t]}):r[t];return y(this,`shape`,i),i},checks:[]}))}function Oe(e,t,n){return w(t,b(t._zod.def,{get shape(){let r=t._zod.def.shape,i={...r};if(n)for(let t in n){if(!(t in i))throw Error(`Unrecognized key: "${t}"`);n[t]&&(i[t]=new e({type:`nonoptional`,innerType:r[t]}))}else for(let t in r)i[t]=new e({type:`nonoptional`,innerType:r[t]});return y(this,`shape`,i),i}}))}function E(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue!==!0)return!0;return!1}function D(e,t){return t.map(t=>{var n;return(n=t).path??(n.path=[]),t.path.unshift(e),t})}function O(e){return typeof e==`string`?e:e?.message}function k(e,t,n){let r={...e,path:e.path??[]};return e.message||(r.message=O(e.inst?._zod.def?.error?.(e))??O(t?.error?.(e))??O(n.customError?.(e))??O(n.localeError?.(e))??`Invalid input`),delete r.inst,delete r.continue,t?.reportInput||delete r.input,r}function ke(e){return Array.isArray(e)?`array`:typeof e==`string`?`string`:`unknown`}function A(...e){let[t,n,r]=e;return typeof t==`string`?{message:t,code:`custom`,input:n,inst:r}:{...t}}var Ae=(e,t)=>{e.name=`$ZodError`,Object.defineProperty(e,`_zod`,{value:e._zod,enumerable:!1}),Object.defineProperty(e,`issues`,{value:t,enumerable:!1}),e.message=JSON.stringify(t,le,2),Object.defineProperty(e,`toString`,{value:()=>e.message,enumerable:!1})},je=m(`$ZodError`,Ae),Me=m(`$ZodError`,Ae,{Parent:Error});function Ne(e,t=e=>e.message){let n={},r=[];for(let i of e.issues)i.path.length>0?(n[i.path[0]]=n[i.path[0]]||[],n[i.path[0]].push(t(i))):r.push(t(i));return{formErrors:r,fieldErrors:n}}function Pe(e,t=e=>e.message){let n={_errors:[]},r=e=>{for(let i of e.issues)if(i.code===`invalid_union`&&i.errors.length)i.errors.map(e=>r({issues:e}));else if(i.code===`invalid_key`)r({issues:i.issues});else if(i.code===`invalid_element`)r({issues:i.issues});else if(i.path.length===0)n._errors.push(t(i));else{let e=n,r=0;for(;r<i.path.length;){let n=i.path[r];r===i.path.length-1?(e[n]=e[n]||{_errors:[]},e[n]._errors.push(t(i))):e[n]=e[n]||{_errors:[]},e=e[n],r++}}};return r(e),n}var Fe=e=>(t,n,r,i)=>{let a=r?Object.assign(r,{async:!1}):{async:!1},o=t._zod.run({value:n,issues:[]},a);if(o instanceof Promise)throw new h;if(o.issues.length){let t=new(i?.Err??e)(o.issues.map(e=>k(e,a,g())));throw ge(t,i?.callee),t}return o.value},Ie=e=>async(t,n,r,i)=>{let a=r?Object.assign(r,{async:!0}):{async:!0},o=t._zod.run({value:n,issues:[]},a);if(o instanceof Promise&&(o=await o),o.issues.length){let t=new(i?.Err??e)(o.issues.map(e=>k(e,a,g())));throw ge(t,i?.callee),t}return o.value},j=e=>(t,n,r)=>{let i=r?{...r,async:!1}:{async:!1},a=t._zod.run({value:n,issues:[]},i);if(a instanceof Promise)throw new h;return a.issues.length?{success:!1,error:new(e??je)(a.issues.map(e=>k(e,i,g())))}:{success:!0,data:a.value}},Le=j(Me),Re=e=>async(t,n,r)=>{let i=r?Object.assign(r,{async:!0}):{async:!0},a=t._zod.run({value:n,issues:[]},i);return a instanceof Promise&&(a=await a),a.issues.length?{success:!1,error:new e(a.issues.map(e=>k(e,i,g())))}:{success:!0,data:a.value}},ze=Re(Me),Be=e=>(t,n,r)=>{let i=r?Object.assign(r,{direction:`backward`}):{direction:`backward`};return Fe(e)(t,n,i)},Ve=e=>(t,n,r)=>Fe(e)(t,n,r),He=e=>async(t,n,r)=>{let i=r?Object.assign(r,{direction:`backward`}):{direction:`backward`};return Ie(e)(t,n,i)},Ue=e=>async(t,n,r)=>Ie(e)(t,n,r),We=e=>(t,n,r)=>{let i=r?Object.assign(r,{direction:`backward`}):{direction:`backward`};return j(e)(t,n,i)},Ge=e=>(t,n,r)=>j(e)(t,n,r),Ke=e=>async(t,n,r)=>{let i=r?Object.assign(r,{direction:`backward`}):{direction:`backward`};return Re(e)(t,n,i)},qe=e=>async(t,n,r)=>Re(e)(t,n,r),Je=/^[cC][^\s-]{8,}$/,Ye=/^[0-9a-z]+$/,Xe=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,Ze=/^[0-9a-vA-V]{20}$/,Qe=/^[A-Za-z0-9]{27}$/,$e=/^[a-zA-Z0-9_-]{21}$/,et=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,tt=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,nt=e=>e?RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,rt=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,it=`^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$`;function at(){return new RegExp(it,`u`)}var ot=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,st=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,ct=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,lt=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,ut=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,dt=/^[A-Za-z0-9_-]*$/,ft=/^\+[1-9]\d{6,14}$/,pt=`(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))`,mt=RegExp(`^${pt}$`);function ht(e){let t=`(?:[01]\\d|2[0-3]):[0-5]\\d`;return typeof e.precision==`number`?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function gt(e){return RegExp(`^${ht(e)}$`)}function _t(e){let t=ht({precision:e.precision}),n=[`Z`];e.local&&n.push(``),e.offset&&n.push(`([+-](?:[01]\\d|2[0-3]):[0-5]\\d)`);let r=`${t}(?:${n.join(`|`)})`;return RegExp(`^${pt}T(?:${r})$`)}var vt=e=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??``}}`:`[\\s\\S]*`;return RegExp(`^${t}$`)},yt=/^-?\d+$/,bt=/^-?\d+(?:\.\d+)?$/,xt=/^(?:true|false)$/i,St=/^null$/i,Ct=/^[^A-Z]*$/,wt=/^[^a-z]*$/,M=m(`$ZodCheck`,(e,t)=>{var n;e._zod??={},e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),Tt={number:`number`,bigint:`bigint`,object:`date`},Et=m(`$ZodCheckLessThan`,(e,t)=>{M.init(e,t);let n=Tt[typeof t.value];e._zod.onattach.push(e=>{let n=e._zod.bag,r=(t.inclusive?n.maximum:n.exclusiveMaximum)??1/0;t.value<r&&(t.inclusive?n.maximum=t.value:n.exclusiveMaximum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value<=t.value:r.value<t.value)||r.issues.push({origin:n,code:`too_big`,maximum:typeof t.value==`object`?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Dt=m(`$ZodCheckGreaterThan`,(e,t)=>{M.init(e,t);let n=Tt[typeof t.value];e._zod.onattach.push(e=>{let n=e._zod.bag,r=(t.inclusive?n.minimum:n.exclusiveMinimum)??-1/0;t.value>r&&(t.inclusive?n.minimum=t.value:n.exclusiveMinimum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value>=t.value:r.value>t.value)||r.issues.push({origin:n,code:`too_small`,minimum:typeof t.value==`object`?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Ot=m(`$ZodCheckMultipleOf`,(e,t)=>{M.init(e,t),e._zod.onattach.push(e=>{var n;(n=e._zod.bag).multipleOf??(n.multipleOf=t.value)}),e._zod.check=n=>{if(typeof n.value!=typeof t.value)throw Error(`Cannot mix number and bigint in multiple_of check.`);(typeof n.value==`bigint`?n.value%t.value===BigInt(0):fe(n.value,t.value)===0)||n.issues.push({origin:typeof n.value,code:`not_multiple_of`,divisor:t.value,input:n.value,inst:e,continue:!t.abort})}}),kt=m(`$ZodCheckNumberFormat`,(e,t)=>{M.init(e,t),t.format=t.format||`float64`;let n=t.format?.includes(`int`),r=n?`int`:`number`,[i,a]=xe[t.format];e._zod.onattach.push(e=>{let r=e._zod.bag;r.format=t.format,r.minimum=i,r.maximum=a,n&&(r.pattern=yt)}),e._zod.check=o=>{let s=o.value;if(n){if(!Number.isInteger(s)){o.issues.push({expected:r,format:t.format,code:`invalid_type`,continue:!1,input:s,inst:e});return}if(!Number.isSafeInteger(s)){s>0?o.issues.push({input:s,code:`too_big`,maximum:2**53-1,note:`Integers must be within the safe integer range.`,inst:e,origin:r,inclusive:!0,continue:!t.abort}):o.issues.push({input:s,code:`too_small`,minimum:-(2**53-1),note:`Integers must be within the safe integer range.`,inst:e,origin:r,inclusive:!0,continue:!t.abort});return}}s<i&&o.issues.push({origin:`number`,input:s,code:`too_small`,minimum:i,inclusive:!0,inst:e,continue:!t.abort}),s>a&&o.issues.push({origin:`number`,input:s,code:`too_big`,maximum:a,inclusive:!0,inst:e,continue:!t.abort})}}),At=m(`$ZodCheckMaxLength`,(e,t)=>{var n;M.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!ue(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag.maximum??1/0;t.maximum<n&&(e._zod.bag.maximum=t.maximum)}),e._zod.check=n=>{let r=n.value;if(r.length<=t.maximum)return;let i=ke(r);n.issues.push({origin:i,code:`too_big`,maximum:t.maximum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),jt=m(`$ZodCheckMinLength`,(e,t)=>{var n;M.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!ue(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag.minimum??-1/0;t.minimum>n&&(e._zod.bag.minimum=t.minimum)}),e._zod.check=n=>{let r=n.value;if(r.length>=t.minimum)return;let i=ke(r);n.issues.push({origin:i,code:`too_small`,minimum:t.minimum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),Mt=m(`$ZodCheckLengthEquals`,(e,t)=>{var n;M.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!ue(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag;n.minimum=t.length,n.maximum=t.length,n.length=t.length}),e._zod.check=n=>{let r=n.value,i=r.length;if(i===t.length)return;let a=ke(r),o=i>t.length;n.issues.push({origin:a,...o?{code:`too_big`,maximum:t.length}:{code:`too_small`,minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),Nt=m(`$ZodCheckStringFormat`,(e,t)=>{var n,r;M.init(e,t),e._zod.onattach.push(e=>{let n=e._zod.bag;n.format=t.format,t.pattern&&(n.patterns??=new Set,n.patterns.add(t.pattern))}),t.pattern?(n=e._zod).check??(n.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:`string`,code:`invalid_format`,format:t.format,input:n.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(r=e._zod).check??(r.check=()=>{})}),Pt=m(`$ZodCheckRegex`,(e,t)=>{Nt.init(e,t),e._zod.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:`string`,code:`invalid_format`,format:`regex`,input:n.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),Ft=m(`$ZodCheckLowerCase`,(e,t)=>{t.pattern??=Ct,Nt.init(e,t)}),It=m(`$ZodCheckUpperCase`,(e,t)=>{t.pattern??=wt,Nt.init(e,t)}),Lt=m(`$ZodCheckIncludes`,(e,t)=>{M.init(e,t);let n=C(t.includes),r=new RegExp(typeof t.position==`number`?`^.{${t.position}}${n}`:n);t.pattern=r,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(r)}),e._zod.check=n=>{n.value.includes(t.includes,t.position)||n.issues.push({origin:`string`,code:`invalid_format`,format:`includes`,includes:t.includes,input:n.value,inst:e,continue:!t.abort})}}),Rt=m(`$ZodCheckStartsWith`,(e,t)=>{M.init(e,t);let n=RegExp(`^${C(t.prefix)}.*`);t.pattern??=n,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(n)}),e._zod.check=n=>{n.value.startsWith(t.prefix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`starts_with`,prefix:t.prefix,input:n.value,inst:e,continue:!t.abort})}}),zt=m(`$ZodCheckEndsWith`,(e,t)=>{M.init(e,t);let n=RegExp(`.*${C(t.suffix)}$`);t.pattern??=n,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(n)}),e._zod.check=n=>{n.value.endsWith(t.suffix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`ends_with`,suffix:t.suffix,input:n.value,inst:e,continue:!t.abort})}}),Bt=m(`$ZodCheckOverwrite`,(e,t)=>{M.init(e,t),e._zod.check=e=>{e.value=t.tx(e.value)}}),Vt=class{constructor(e=[]){this.content=[],this.indent=0,this&&(this.args=e)}indented(e){this.indent+=1,e(this),--this.indent}write(e){if(typeof e==`function`){e(this,{execution:`sync`}),e(this,{execution:`async`});return}let t=e.split(`
1
+ import{r as e}from"./chunk-jRWAZmH_.js";import{A as t,C as n,l as r}from"./resolved-assistants-store-B5ATyCT9.js";import{$ as i,_ as a,et as o,g as s,h as c,mt as l}from"./sdk.gen-DgqwY_WN.js";import{i as u,n as d}from"./api-errors-CsfCFJ8r.js";import{C as f,F as p,I as ee,L as te,a as ne,i as re,o as ie,w as ae}from"./sdk.gen-ClmX029Q.js";Object.freeze({status:`aborted`});function m(e,t,n){function r(n,r){if(n._zod||Object.defineProperty(n,`_zod`,{value:{def:r,constr:o,traits:new Set},enumerable:!1}),n._zod.traits.has(e))return;n._zod.traits.add(e),t(n,r);let i=o.prototype,a=Object.keys(i);for(let e=0;e<a.length;e++){let t=a[e];t in n||(n[t]=i[t].bind(n))}}let i=n?.Parent??Object;class a extends i{}Object.defineProperty(a,`name`,{value:e});function o(e){var t;let i=n?.Parent?new a:this;r(i,e),(t=i._zod).deferred??(t.deferred=[]);for(let e of i._zod.deferred)e();return i}return Object.defineProperty(o,`init`,{value:r}),Object.defineProperty(o,Symbol.hasInstance,{value:t=>n?.Parent&&t instanceof n.Parent?!0:t?._zod?.traits?.has(e)}),Object.defineProperty(o,`name`,{value:e}),o}var h=class extends Error{constructor(){super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`)}},oe=class extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name=`ZodEncodeError`}},se={};function g(e){return e&&Object.assign(se,e),se}function ce(e){let t=Object.values(e).filter(e=>typeof e==`number`);return Object.entries(e).filter(([e,n])=>t.indexOf(+e)===-1).map(([e,t])=>t)}function le(e,t){return typeof t==`bigint`?t.toString():t}function _(e){return{get value(){{let t=e();return Object.defineProperty(this,`value`,{value:t}),t}throw Error(`cached value already set`)}}}function ue(e){return e==null}function de(e){let t=+!!e.startsWith(`^`),n=e.endsWith(`$`)?e.length-1:e.length;return e.slice(t,n)}function fe(e,t){let n=(e.toString().split(`.`)[1]||``).length,r=t.toString(),i=(r.split(`.`)[1]||``).length;if(i===0&&/\d?e-\d?/.test(r)){let e=r.match(/\d?e-(\d?)/);e?.[1]&&(i=Number.parseInt(e[1]))}let a=n>i?n:i;return Number.parseInt(e.toFixed(a).replace(`.`,``))%Number.parseInt(t.toFixed(a).replace(`.`,``))/10**a}var pe=Symbol(`evaluating`);function v(e,t,n){let r;Object.defineProperty(e,t,{get(){if(r!==pe)return r===void 0&&(r=pe,r=n()),r},set(n){Object.defineProperty(e,t,{value:n})},configurable:!0})}function y(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function b(...e){let t={};for(let n of e)Object.assign(t,Object.getOwnPropertyDescriptors(n));return Object.defineProperties({},t)}function me(e){return JSON.stringify(e)}function he(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,``).replace(/[\s_-]+/g,`-`).replace(/^-+|-+$/g,``)}var ge=`captureStackTrace`in Error?Error.captureStackTrace:(...e)=>{};function x(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}var _e=_(()=>{if(typeof navigator<`u`&&navigator?.userAgent?.includes(`Cloudflare`))return!1;try{return Function(``),!0}catch{return!1}});function S(e){if(x(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!=`function`)return!0;let n=t.prototype;return!(x(n)===!1||Object.prototype.hasOwnProperty.call(n,`isPrototypeOf`)===!1)}function ve(e){return S(e)?{...e}:Array.isArray(e)?[...e]:e}var ye=new Set([`string`,`number`,`symbol`]);function C(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function w(e,t,n){let r=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(r._zod.parent=e),r}function T(e){let t=e;if(!t)return{};if(typeof t==`string`)return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error==`string`?{...t,error:()=>t.error}:t}function be(e){return Object.keys(e).filter(t=>e[t]._zod.optin===`optional`&&e[t]._zod.optout===`optional`)}var xe={safeint:[-(2**53-1),2**53-1],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function Se(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.pick() cannot be used on object schemas containing refinements`);return w(e,b(e._zod.def,{get shape(){let e={};for(let r in t){if(!(r in n.shape))throw Error(`Unrecognized key: "${r}"`);t[r]&&(e[r]=n.shape[r])}return y(this,`shape`,e),e},checks:[]}))}function Ce(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.omit() cannot be used on object schemas containing refinements`);return w(e,b(e._zod.def,{get shape(){let r={...e._zod.def.shape};for(let e in t){if(!(e in n.shape))throw Error(`Unrecognized key: "${e}"`);t[e]&&delete r[e]}return y(this,`shape`,r),r},checks:[]}))}function we(e,t){if(!S(t))throw Error(`Invalid input to extend: expected a plain object`);let n=e._zod.def.checks;if(n&&n.length>0){let n=e._zod.def.shape;for(let e in t)if(Object.getOwnPropertyDescriptor(n,e)!==void 0)throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}return w(e,b(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return y(this,`shape`,n),n}}))}function Te(e,t){if(!S(t))throw Error(`Invalid input to safeExtend: expected a plain object`);return w(e,b(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return y(this,`shape`,n),n}}))}function Ee(e,t){return w(e,b(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t._zod.def.shape};return y(this,`shape`,n),n},get catchall(){return t._zod.def.catchall},checks:[]}))}function De(e,t,n){let r=t._zod.def.checks;if(r&&r.length>0)throw Error(`.partial() cannot be used on object schemas containing refinements`);return w(t,b(t._zod.def,{get shape(){let r=t._zod.def.shape,i={...r};if(n)for(let t in n){if(!(t in r))throw Error(`Unrecognized key: "${t}"`);n[t]&&(i[t]=e?new e({type:`optional`,innerType:r[t]}):r[t])}else for(let t in r)i[t]=e?new e({type:`optional`,innerType:r[t]}):r[t];return y(this,`shape`,i),i},checks:[]}))}function Oe(e,t,n){return w(t,b(t._zod.def,{get shape(){let r=t._zod.def.shape,i={...r};if(n)for(let t in n){if(!(t in i))throw Error(`Unrecognized key: "${t}"`);n[t]&&(i[t]=new e({type:`nonoptional`,innerType:r[t]}))}else for(let t in r)i[t]=new e({type:`nonoptional`,innerType:r[t]});return y(this,`shape`,i),i}}))}function E(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue!==!0)return!0;return!1}function D(e,t){return t.map(t=>{var n;return(n=t).path??(n.path=[]),t.path.unshift(e),t})}function O(e){return typeof e==`string`?e:e?.message}function k(e,t,n){let r={...e,path:e.path??[]};return e.message||(r.message=O(e.inst?._zod.def?.error?.(e))??O(t?.error?.(e))??O(n.customError?.(e))??O(n.localeError?.(e))??`Invalid input`),delete r.inst,delete r.continue,t?.reportInput||delete r.input,r}function ke(e){return Array.isArray(e)?`array`:typeof e==`string`?`string`:`unknown`}function A(...e){let[t,n,r]=e;return typeof t==`string`?{message:t,code:`custom`,input:n,inst:r}:{...t}}var Ae=(e,t)=>{e.name=`$ZodError`,Object.defineProperty(e,`_zod`,{value:e._zod,enumerable:!1}),Object.defineProperty(e,`issues`,{value:t,enumerable:!1}),e.message=JSON.stringify(t,le,2),Object.defineProperty(e,`toString`,{value:()=>e.message,enumerable:!1})},je=m(`$ZodError`,Ae),Me=m(`$ZodError`,Ae,{Parent:Error});function Ne(e,t=e=>e.message){let n={},r=[];for(let i of e.issues)i.path.length>0?(n[i.path[0]]=n[i.path[0]]||[],n[i.path[0]].push(t(i))):r.push(t(i));return{formErrors:r,fieldErrors:n}}function Pe(e,t=e=>e.message){let n={_errors:[]},r=e=>{for(let i of e.issues)if(i.code===`invalid_union`&&i.errors.length)i.errors.map(e=>r({issues:e}));else if(i.code===`invalid_key`)r({issues:i.issues});else if(i.code===`invalid_element`)r({issues:i.issues});else if(i.path.length===0)n._errors.push(t(i));else{let e=n,r=0;for(;r<i.path.length;){let n=i.path[r];r===i.path.length-1?(e[n]=e[n]||{_errors:[]},e[n]._errors.push(t(i))):e[n]=e[n]||{_errors:[]},e=e[n],r++}}};return r(e),n}var Fe=e=>(t,n,r,i)=>{let a=r?Object.assign(r,{async:!1}):{async:!1},o=t._zod.run({value:n,issues:[]},a);if(o instanceof Promise)throw new h;if(o.issues.length){let t=new(i?.Err??e)(o.issues.map(e=>k(e,a,g())));throw ge(t,i?.callee),t}return o.value},Ie=e=>async(t,n,r,i)=>{let a=r?Object.assign(r,{async:!0}):{async:!0},o=t._zod.run({value:n,issues:[]},a);if(o instanceof Promise&&(o=await o),o.issues.length){let t=new(i?.Err??e)(o.issues.map(e=>k(e,a,g())));throw ge(t,i?.callee),t}return o.value},j=e=>(t,n,r)=>{let i=r?{...r,async:!1}:{async:!1},a=t._zod.run({value:n,issues:[]},i);if(a instanceof Promise)throw new h;return a.issues.length?{success:!1,error:new(e??je)(a.issues.map(e=>k(e,i,g())))}:{success:!0,data:a.value}},Le=j(Me),Re=e=>async(t,n,r)=>{let i=r?Object.assign(r,{async:!0}):{async:!0},a=t._zod.run({value:n,issues:[]},i);return a instanceof Promise&&(a=await a),a.issues.length?{success:!1,error:new e(a.issues.map(e=>k(e,i,g())))}:{success:!0,data:a.value}},ze=Re(Me),Be=e=>(t,n,r)=>{let i=r?Object.assign(r,{direction:`backward`}):{direction:`backward`};return Fe(e)(t,n,i)},Ve=e=>(t,n,r)=>Fe(e)(t,n,r),He=e=>async(t,n,r)=>{let i=r?Object.assign(r,{direction:`backward`}):{direction:`backward`};return Ie(e)(t,n,i)},Ue=e=>async(t,n,r)=>Ie(e)(t,n,r),We=e=>(t,n,r)=>{let i=r?Object.assign(r,{direction:`backward`}):{direction:`backward`};return j(e)(t,n,i)},Ge=e=>(t,n,r)=>j(e)(t,n,r),Ke=e=>async(t,n,r)=>{let i=r?Object.assign(r,{direction:`backward`}):{direction:`backward`};return Re(e)(t,n,i)},qe=e=>async(t,n,r)=>Re(e)(t,n,r),Je=/^[cC][^\s-]{8,}$/,Ye=/^[0-9a-z]+$/,Xe=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,Ze=/^[0-9a-vA-V]{20}$/,Qe=/^[A-Za-z0-9]{27}$/,$e=/^[a-zA-Z0-9_-]{21}$/,et=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,tt=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,nt=e=>e?RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,rt=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,it=`^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$`;function at(){return new RegExp(it,`u`)}var ot=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,st=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,ct=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,lt=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,ut=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,dt=/^[A-Za-z0-9_-]*$/,ft=/^\+[1-9]\d{6,14}$/,pt=`(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))`,mt=RegExp(`^${pt}$`);function ht(e){let t=`(?:[01]\\d|2[0-3]):[0-5]\\d`;return typeof e.precision==`number`?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function gt(e){return RegExp(`^${ht(e)}$`)}function _t(e){let t=ht({precision:e.precision}),n=[`Z`];e.local&&n.push(``),e.offset&&n.push(`([+-](?:[01]\\d|2[0-3]):[0-5]\\d)`);let r=`${t}(?:${n.join(`|`)})`;return RegExp(`^${pt}T(?:${r})$`)}var vt=e=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??``}}`:`[\\s\\S]*`;return RegExp(`^${t}$`)},yt=/^-?\d+$/,bt=/^-?\d+(?:\.\d+)?$/,xt=/^(?:true|false)$/i,St=/^null$/i,Ct=/^[^A-Z]*$/,wt=/^[^a-z]*$/,M=m(`$ZodCheck`,(e,t)=>{var n;e._zod??={},e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),Tt={number:`number`,bigint:`bigint`,object:`date`},Et=m(`$ZodCheckLessThan`,(e,t)=>{M.init(e,t);let n=Tt[typeof t.value];e._zod.onattach.push(e=>{let n=e._zod.bag,r=(t.inclusive?n.maximum:n.exclusiveMaximum)??1/0;t.value<r&&(t.inclusive?n.maximum=t.value:n.exclusiveMaximum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value<=t.value:r.value<t.value)||r.issues.push({origin:n,code:`too_big`,maximum:typeof t.value==`object`?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Dt=m(`$ZodCheckGreaterThan`,(e,t)=>{M.init(e,t);let n=Tt[typeof t.value];e._zod.onattach.push(e=>{let n=e._zod.bag,r=(t.inclusive?n.minimum:n.exclusiveMinimum)??-1/0;t.value>r&&(t.inclusive?n.minimum=t.value:n.exclusiveMinimum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value>=t.value:r.value>t.value)||r.issues.push({origin:n,code:`too_small`,minimum:typeof t.value==`object`?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Ot=m(`$ZodCheckMultipleOf`,(e,t)=>{M.init(e,t),e._zod.onattach.push(e=>{var n;(n=e._zod.bag).multipleOf??(n.multipleOf=t.value)}),e._zod.check=n=>{if(typeof n.value!=typeof t.value)throw Error(`Cannot mix number and bigint in multiple_of check.`);(typeof n.value==`bigint`?n.value%t.value===BigInt(0):fe(n.value,t.value)===0)||n.issues.push({origin:typeof n.value,code:`not_multiple_of`,divisor:t.value,input:n.value,inst:e,continue:!t.abort})}}),kt=m(`$ZodCheckNumberFormat`,(e,t)=>{M.init(e,t),t.format=t.format||`float64`;let n=t.format?.includes(`int`),r=n?`int`:`number`,[i,a]=xe[t.format];e._zod.onattach.push(e=>{let r=e._zod.bag;r.format=t.format,r.minimum=i,r.maximum=a,n&&(r.pattern=yt)}),e._zod.check=o=>{let s=o.value;if(n){if(!Number.isInteger(s)){o.issues.push({expected:r,format:t.format,code:`invalid_type`,continue:!1,input:s,inst:e});return}if(!Number.isSafeInteger(s)){s>0?o.issues.push({input:s,code:`too_big`,maximum:2**53-1,note:`Integers must be within the safe integer range.`,inst:e,origin:r,inclusive:!0,continue:!t.abort}):o.issues.push({input:s,code:`too_small`,minimum:-(2**53-1),note:`Integers must be within the safe integer range.`,inst:e,origin:r,inclusive:!0,continue:!t.abort});return}}s<i&&o.issues.push({origin:`number`,input:s,code:`too_small`,minimum:i,inclusive:!0,inst:e,continue:!t.abort}),s>a&&o.issues.push({origin:`number`,input:s,code:`too_big`,maximum:a,inclusive:!0,inst:e,continue:!t.abort})}}),At=m(`$ZodCheckMaxLength`,(e,t)=>{var n;M.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!ue(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag.maximum??1/0;t.maximum<n&&(e._zod.bag.maximum=t.maximum)}),e._zod.check=n=>{let r=n.value;if(r.length<=t.maximum)return;let i=ke(r);n.issues.push({origin:i,code:`too_big`,maximum:t.maximum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),jt=m(`$ZodCheckMinLength`,(e,t)=>{var n;M.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!ue(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag.minimum??-1/0;t.minimum>n&&(e._zod.bag.minimum=t.minimum)}),e._zod.check=n=>{let r=n.value;if(r.length>=t.minimum)return;let i=ke(r);n.issues.push({origin:i,code:`too_small`,minimum:t.minimum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),Mt=m(`$ZodCheckLengthEquals`,(e,t)=>{var n;M.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!ue(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag;n.minimum=t.length,n.maximum=t.length,n.length=t.length}),e._zod.check=n=>{let r=n.value,i=r.length;if(i===t.length)return;let a=ke(r),o=i>t.length;n.issues.push({origin:a,...o?{code:`too_big`,maximum:t.length}:{code:`too_small`,minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),Nt=m(`$ZodCheckStringFormat`,(e,t)=>{var n,r;M.init(e,t),e._zod.onattach.push(e=>{let n=e._zod.bag;n.format=t.format,t.pattern&&(n.patterns??=new Set,n.patterns.add(t.pattern))}),t.pattern?(n=e._zod).check??(n.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:`string`,code:`invalid_format`,format:t.format,input:n.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(r=e._zod).check??(r.check=()=>{})}),Pt=m(`$ZodCheckRegex`,(e,t)=>{Nt.init(e,t),e._zod.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:`string`,code:`invalid_format`,format:`regex`,input:n.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),Ft=m(`$ZodCheckLowerCase`,(e,t)=>{t.pattern??=Ct,Nt.init(e,t)}),It=m(`$ZodCheckUpperCase`,(e,t)=>{t.pattern??=wt,Nt.init(e,t)}),Lt=m(`$ZodCheckIncludes`,(e,t)=>{M.init(e,t);let n=C(t.includes),r=new RegExp(typeof t.position==`number`?`^.{${t.position}}${n}`:n);t.pattern=r,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(r)}),e._zod.check=n=>{n.value.includes(t.includes,t.position)||n.issues.push({origin:`string`,code:`invalid_format`,format:`includes`,includes:t.includes,input:n.value,inst:e,continue:!t.abort})}}),Rt=m(`$ZodCheckStartsWith`,(e,t)=>{M.init(e,t);let n=RegExp(`^${C(t.prefix)}.*`);t.pattern??=n,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(n)}),e._zod.check=n=>{n.value.startsWith(t.prefix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`starts_with`,prefix:t.prefix,input:n.value,inst:e,continue:!t.abort})}}),zt=m(`$ZodCheckEndsWith`,(e,t)=>{M.init(e,t);let n=RegExp(`.*${C(t.suffix)}$`);t.pattern??=n,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(n)}),e._zod.check=n=>{n.value.endsWith(t.suffix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`ends_with`,suffix:t.suffix,input:n.value,inst:e,continue:!t.abort})}}),Bt=m(`$ZodCheckOverwrite`,(e,t)=>{M.init(e,t),e._zod.check=e=>{e.value=t.tx(e.value)}}),Vt=class{constructor(e=[]){this.content=[],this.indent=0,this&&(this.args=e)}indented(e){this.indent+=1,e(this),--this.indent}write(e){if(typeof e==`function`){e(this,{execution:`sync`}),e(this,{execution:`async`});return}let t=e.split(`
2
2
  `).filter(e=>e),n=Math.min(...t.map(e=>e.length-e.trimStart().length)),r=t.map(e=>e.slice(n)).map(e=>` `.repeat(this.indent*2)+e);for(let e of r)this.content.push(e)}compile(){let e=Function,t=this?.args,n=[...(this?.content??[``]).map(e=>` ${e}`)];return new e(...t,n.join(`
3
3
  `))}},Ht={major:4,minor:3,patch:6},N=m(`$ZodType`,(e,t)=>{var n;e??={},e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=Ht;let r=[...e._zod.def.checks??[]];e._zod.traits.has(`$ZodCheck`)&&r.unshift(e);for(let t of r)for(let n of t._zod.onattach)n(e);if(r.length===0)(n=e._zod).deferred??(n.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let t=(e,t,n)=>{let r=E(e),i;for(let a of t){if(a._zod.def.when){if(!a._zod.def.when(e))continue}else if(r)continue;let t=e.issues.length,o=a._zod.check(e);if(o instanceof Promise&&n?.async===!1)throw new h;if(i||o instanceof Promise)i=(i??Promise.resolve()).then(async()=>{await o,e.issues.length!==t&&(r||=E(e,t))});else{if(e.issues.length===t)continue;r||=E(e,t)}}return i?i.then(()=>e):e},n=(n,i,a)=>{if(E(n))return n.aborted=!0,n;let o=t(i,r,a);if(o instanceof Promise){if(a.async===!1)throw new h;return o.then(t=>e._zod.parse(t,a))}return e._zod.parse(o,a)};e._zod.run=(i,a)=>{if(a.skipChecks)return e._zod.parse(i,a);if(a.direction===`backward`){let t=e._zod.parse({value:i.value,issues:[]},{...a,skipChecks:!0});return t instanceof Promise?t.then(e=>n(e,i,a)):n(t,i,a)}let o=e._zod.parse(i,a);if(o instanceof Promise){if(a.async===!1)throw new h;return o.then(e=>t(e,r,a))}return t(o,r,a)}}v(e,`~standard`,()=>({validate:t=>{try{let n=Le(e,t);return n.success?{value:n.data}:{issues:n.error?.issues}}catch{return ze(e,t).then(e=>e.success?{value:e.data}:{issues:e.error?.issues})}},vendor:`zod`,version:1}))}),Ut=m(`$ZodString`,(e,t)=>{N.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??vt(e._zod.bag),e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=String(n.value)}catch{}return typeof n.value==`string`||n.issues.push({expected:`string`,code:`invalid_type`,input:n.value,inst:e}),n}}),P=m(`$ZodStringFormat`,(e,t)=>{Nt.init(e,t),Ut.init(e,t)}),Wt=m(`$ZodGUID`,(e,t)=>{t.pattern??=tt,P.init(e,t)}),Gt=m(`$ZodUUID`,(e,t)=>{if(t.version){let e={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(e===void 0)throw Error(`Invalid UUID version: "${t.version}"`);t.pattern??=nt(e)}else t.pattern??=nt();P.init(e,t)}),Kt=m(`$ZodEmail`,(e,t)=>{t.pattern??=rt,P.init(e,t)}),qt=m(`$ZodURL`,(e,t)=>{P.init(e,t),e._zod.check=n=>{try{let r=n.value.trim(),i=new URL(r);t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(i.hostname)||n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid hostname`,pattern:t.hostname.source,input:n.value,inst:e,continue:!t.abort})),t.protocol&&(t.protocol.lastIndex=0,t.protocol.test(i.protocol.endsWith(`:`)?i.protocol.slice(0,-1):i.protocol)||n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid protocol`,pattern:t.protocol.source,input:n.value,inst:e,continue:!t.abort})),t.normalize?n.value=i.href:n.value=r;return}catch{n.issues.push({code:`invalid_format`,format:`url`,input:n.value,inst:e,continue:!t.abort})}}}),Jt=m(`$ZodEmoji`,(e,t)=>{t.pattern??=at(),P.init(e,t)}),Yt=m(`$ZodNanoID`,(e,t)=>{t.pattern??=$e,P.init(e,t)}),Xt=m(`$ZodCUID`,(e,t)=>{t.pattern??=Je,P.init(e,t)}),Zt=m(`$ZodCUID2`,(e,t)=>{t.pattern??=Ye,P.init(e,t)}),Qt=m(`$ZodULID`,(e,t)=>{t.pattern??=Xe,P.init(e,t)}),$t=m(`$ZodXID`,(e,t)=>{t.pattern??=Ze,P.init(e,t)}),en=m(`$ZodKSUID`,(e,t)=>{t.pattern??=Qe,P.init(e,t)}),tn=m(`$ZodISODateTime`,(e,t)=>{t.pattern??=_t(t),P.init(e,t)}),nn=m(`$ZodISODate`,(e,t)=>{t.pattern??=mt,P.init(e,t)}),rn=m(`$ZodISOTime`,(e,t)=>{t.pattern??=gt(t),P.init(e,t)}),an=m(`$ZodISODuration`,(e,t)=>{t.pattern??=et,P.init(e,t)}),on=m(`$ZodIPv4`,(e,t)=>{t.pattern??=ot,P.init(e,t),e._zod.bag.format=`ipv4`}),sn=m(`$ZodIPv6`,(e,t)=>{t.pattern??=st,P.init(e,t),e._zod.bag.format=`ipv6`,e._zod.check=n=>{try{new URL(`http://[${n.value}]`)}catch{n.issues.push({code:`invalid_format`,format:`ipv6`,input:n.value,inst:e,continue:!t.abort})}}}),cn=m(`$ZodCIDRv4`,(e,t)=>{t.pattern??=ct,P.init(e,t)}),ln=m(`$ZodCIDRv6`,(e,t)=>{t.pattern??=lt,P.init(e,t),e._zod.check=n=>{let r=n.value.split(`/`);try{if(r.length!==2)throw Error();let[e,t]=r;if(!t)throw Error();let n=Number(t);if(`${n}`!==t||n<0||n>128)throw Error();new URL(`http://[${e}]`)}catch{n.issues.push({code:`invalid_format`,format:`cidrv6`,input:n.value,inst:e,continue:!t.abort})}}});function un(e){if(e===``)return!0;if(e.length%4!=0)return!1;try{return atob(e),!0}catch{return!1}}var dn=m(`$ZodBase64`,(e,t)=>{t.pattern??=ut,P.init(e,t),e._zod.bag.contentEncoding=`base64`,e._zod.check=n=>{un(n.value)||n.issues.push({code:`invalid_format`,format:`base64`,input:n.value,inst:e,continue:!t.abort})}});function fn(e){if(!dt.test(e))return!1;let t=e.replace(/[-_]/g,e=>e===`-`?`+`:`/`);return un(t.padEnd(Math.ceil(t.length/4)*4,`=`))}var pn=m(`$ZodBase64URL`,(e,t)=>{t.pattern??=dt,P.init(e,t),e._zod.bag.contentEncoding=`base64url`,e._zod.check=n=>{fn(n.value)||n.issues.push({code:`invalid_format`,format:`base64url`,input:n.value,inst:e,continue:!t.abort})}}),mn=m(`$ZodE164`,(e,t)=>{t.pattern??=ft,P.init(e,t)});function hn(e,t=null){try{let n=e.split(`.`);if(n.length!==3)return!1;let[r]=n;if(!r)return!1;let i=JSON.parse(atob(r));return!(`typ`in i&&i?.typ!==`JWT`||!i.alg||t&&(!(`alg`in i)||i.alg!==t))}catch{return!1}}var gn=m(`$ZodJWT`,(e,t)=>{P.init(e,t),e._zod.check=n=>{hn(n.value,t.alg)||n.issues.push({code:`invalid_format`,format:`jwt`,input:n.value,inst:e,continue:!t.abort})}}),_n=m(`$ZodNumber`,(e,t)=>{N.init(e,t),e._zod.pattern=e._zod.bag.pattern??bt,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=Number(n.value)}catch{}let i=n.value;if(typeof i==`number`&&!Number.isNaN(i)&&Number.isFinite(i))return n;let a=typeof i==`number`?Number.isNaN(i)?`NaN`:Number.isFinite(i)?void 0:`Infinity`:void 0;return n.issues.push({expected:`number`,code:`invalid_type`,input:i,inst:e,...a?{received:a}:{}}),n}}),vn=m(`$ZodNumberFormat`,(e,t)=>{kt.init(e,t),_n.init(e,t)}),yn=m(`$ZodBoolean`,(e,t)=>{N.init(e,t),e._zod.pattern=xt,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=!!n.value}catch{}let i=n.value;return typeof i==`boolean`||n.issues.push({expected:`boolean`,code:`invalid_type`,input:i,inst:e}),n}}),bn=m(`$ZodNull`,(e,t)=>{N.init(e,t),e._zod.pattern=St,e._zod.values=new Set([null]),e._zod.parse=(t,n)=>{let r=t.value;return r===null||t.issues.push({expected:`null`,code:`invalid_type`,input:r,inst:e}),t}}),xn=m(`$ZodUnknown`,(e,t)=>{N.init(e,t),e._zod.parse=e=>e}),Sn=m(`$ZodNever`,(e,t)=>{N.init(e,t),e._zod.parse=(t,n)=>(t.issues.push({expected:`never`,code:`invalid_type`,input:t.value,inst:e}),t)});function Cn(e,t,n){e.issues.length&&t.issues.push(...D(n,e.issues)),t.value[n]=e.value}var wn=m(`$ZodArray`,(e,t)=>{N.init(e,t),e._zod.parse=(n,r)=>{let i=n.value;if(!Array.isArray(i))return n.issues.push({expected:`array`,code:`invalid_type`,input:i,inst:e}),n;n.value=Array(i.length);let a=[];for(let e=0;e<i.length;e++){let o=i[e],s=t.element._zod.run({value:o,issues:[]},r);s instanceof Promise?a.push(s.then(t=>Cn(t,n,e))):Cn(s,n,e)}return a.length?Promise.all(a).then(()=>n):n}});function F(e,t,n,r,i){if(e.issues.length){if(i&&!(n in r))return;t.issues.push(...D(n,e.issues))}e.value===void 0?n in r&&(t.value[n]=void 0):t.value[n]=e.value}function Tn(e){let t=Object.keys(e.shape);for(let n of t)if(!e.shape?.[n]?._zod?.traits?.has(`$ZodType`))throw Error(`Invalid element at key "${n}": expected a Zod schema`);let n=be(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(n)}}function En(e,t,n,r,i,a){let o=[],s=i.keySet,c=i.catchall._zod,l=c.def.type,u=c.optout===`optional`;for(let i in t){if(s.has(i))continue;if(l===`never`){o.push(i);continue}let a=c.run({value:t[i],issues:[]},r);a instanceof Promise?e.push(a.then(e=>F(e,n,i,t,u))):F(a,n,i,t,u)}return o.length&&n.issues.push({code:`unrecognized_keys`,keys:o,input:t,inst:a}),e.length?Promise.all(e).then(()=>n):n}var Dn=m(`$ZodObject`,(e,t)=>{if(N.init(e,t),!Object.getOwnPropertyDescriptor(t,`shape`)?.get){let e=t.shape;Object.defineProperty(t,`shape`,{get:()=>{let n={...e};return Object.defineProperty(t,`shape`,{value:n}),n}})}let n=_(()=>Tn(t));v(e._zod,`propValues`,()=>{let e=t.shape,n={};for(let t in e){let r=e[t]._zod;if(r.values){n[t]??(n[t]=new Set);for(let e of r.values)n[t].add(e)}}return n});let r=x,i=t.catchall,a;e._zod.parse=(t,o)=>{a??=n.value;let s=t.value;if(!r(s))return t.issues.push({expected:`object`,code:`invalid_type`,input:s,inst:e}),t;t.value={};let c=[],l=a.shape;for(let e of a.keys){let n=l[e],r=n._zod.optout===`optional`,i=n._zod.run({value:s[e],issues:[]},o);i instanceof Promise?c.push(i.then(n=>F(n,t,e,s,r))):F(i,t,e,s,r)}return i?En(c,s,t,o,n.value,e):c.length?Promise.all(c).then(()=>t):t}}),On=m(`$ZodObjectJIT`,(e,t)=>{Dn.init(e,t);let n=e._zod.parse,r=_(()=>Tn(t)),i=e=>{let t=new Vt([`shape`,`payload`,`ctx`]),n=r.value,i=e=>{let t=me(e);return`shape[${t}]._zod.run({ value: input[${t}], issues: [] }, ctx)`};t.write(`const input = payload.value;`);let a=Object.create(null),o=0;for(let e of n.keys)a[e]=`key_${o++}`;t.write(`const newResult = {};`);for(let r of n.keys){let n=a[r],o=me(r),s=e[r]?._zod?.optout===`optional`;t.write(`const ${n} = ${i(r)};`),s?t.write(`
4
4
  if (${n}.issues.length) {
@@ -1 +1 @@
1
- import{o as e}from"./chunk-jRWAZmH_.js";import{t}from"./react-DJZBPgpf.js";import{d as n,h as r}from"./chunk-5KNZJZUH-DdS6bb-3.js";import{t as i}from"./jsx-runtime-CVSDxk6A.js";import{t as a}from"./button-C68o-wep.js";import{t as o}from"./dropdown-CocFV5yi.js";import{t as s}from"./input-Cu3PPVCq.js";import{t as c}from"./is-electron-CavSPgmY.js";import{i as l}from"./routes-VcLWbBmh.js";import{t as u}from"./onboarding-layout-40CHAFT0.js";import{n as d,r as f}from"./provider-key-BYLNbH9o.js";var p=e(t(),1),m=[{id:`anthropic`,displayName:`Anthropic`,apiKeyPlaceholder:`sk-ant-api03-...`,docsUrl:`https://console.anthropic.com/settings/keys`,requiresKey:!0},{id:`openai`,displayName:`OpenAI`,apiKeyPlaceholder:`sk-proj-...`,docsUrl:`https://platform.openai.com/api-keys`,requiresKey:!0},{id:`gemini`,displayName:`Google Gemini`,apiKeyPlaceholder:`AIza...`,docsUrl:`https://aistudio.google.com/apikey`,requiresKey:!0},{id:`ollama`,displayName:`Ollama`,apiKeyPlaceholder:null,docsUrl:`https://ollama.com/download`,requiresKey:!1},{id:`fireworks`,displayName:`Fireworks`,apiKeyPlaceholder:`fw_...`,docsUrl:`https://fireworks.ai/account/api-keys`,requiresKey:!0},{id:`openrouter`,displayName:`OpenRouter`,apiKeyPlaceholder:`sk-or-v1-...`,docsUrl:`https://openrouter.ai/keys`,requiresKey:!0},{id:`openai-compatible`,displayName:`OpenAI-compatible`,apiKeyPlaceholder:`Your provider's API key`,docsUrl:null,requiresKey:!0}],h=m[0];function g(e){return m.find(t=>t.id===e)}var _=i();function v(){let e=n(),[t]=r(),i=t.get(`hosting`),v=c(),[y,b]=(0,p.useState)(()=>d()?.provider??h.id),[x,S]=(0,p.useState)(()=>d()?.key??``),C=g(y)??h,w=C.requiresKey,T=!w||x.trim().length>0;return(0,_.jsx)(u,{children:(0,_.jsxs)(`div`,{className:`mx-auto flex w-full max-w-xl flex-col items-center ${v?`min-h-full px-8 pt-21 pb-4 electron-prechat-type`:`px-6 py-16`} text-[var(--content-default)]`,children:[(0,_.jsx)(`h1`,{className:v?`text-title-large`:`text-3xl font-semibold tracking-tight`,style:{animation:`fadeInUp 0.5s ease-out 0.1s both`},children:`Connect a Model Provider`}),(0,_.jsx)(`p`,{className:`text-center text-body-medium-lighter text-[var(--content-tertiary)] ${v?`mt-3.5`:`mt-3`}`,style:{animation:`fadeInUp 0.5s ease-out 0.3s both`},children:`Enter an API key to connect your model provider.`}),(0,_.jsxs)(`div`,{className:`flex w-full flex-col gap-4 ${v?`mt-8`:`mt-10`}`,style:{animation:`fadeInUp 0.5s ease-out 0.4s both`},children:[(0,_.jsxs)(`div`,{className:`flex flex-col ${v?`gap-2`:`gap-1`}`,children:[(0,_.jsx)(`label`,{className:`text-body-small-default text-[var(--content-tertiary)]`,children:`Provider`}),(0,_.jsx)(o,{"aria-label":`Provider`,value:y,onChange:e=>{let t=g(e);t&&(b(t.id),S(``))},options:m.map(e=>({value:e.id,label:e.displayName}))})]}),w&&(0,_.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,_.jsx)(s,{type:`password`,label:`${C.displayName} API Key`,placeholder:C.apiKeyPlaceholder??`Enter your API key`,value:x,onChange:e=>S(e.target.value),fullWidth:!0}),C.docsUrl&&(0,_.jsxs)(`p`,{className:`self-start text-body-medium-lighter text-[var(--content-tertiary)]`,children:[`Don't have it?`,` `,(0,_.jsx)(`a`,{href:C.docsUrl,target:`_blank`,rel:`noreferrer`,className:`text-[var(--content-default)] underline`,children:`Get an API key here`})]})]})]}),(0,_.jsxs)(`div`,{className:`mt-8 flex w-full flex-col ${v?`gap-2.5`:`gap-2`}`,style:{animation:`fadeInUp 0.5s ease-out 0.5s both`},children:[(0,_.jsx)(a,{variant:`primary`,size:`regular`,fullWidth:!0,disabled:!T,onClick:()=>{T&&(f({provider:y,key:w?x.trim():``}),e(i?`${l.onboarding.privacy}?hosting=${i}`:l.onboarding.privacy))},className:v?void 0:`h-11 text-base`,children:`Continue`}),(0,_.jsx)(a,{variant:`outlined`,size:`regular`,fullWidth:!0,onClick:()=>{e(l.onboarding.hosting)},className:v?void 0:`h-11 text-base`,children:`Back`})]})]})})}export{v as ApiKeyScreen};
1
+ import{o as e}from"./chunk-jRWAZmH_.js";import{t}from"./react-DJZBPgpf.js";import{d as n,h as r}from"./chunk-5KNZJZUH-DdS6bb-3.js";import{t as i}from"./jsx-runtime-CVSDxk6A.js";import{t as a}from"./button-C68o-wep.js";import{t as o}from"./dropdown-CocFV5yi.js";import{t as s}from"./input-Cu3PPVCq.js";import{t as c}from"./is-electron-CavSPgmY.js";import{i as l}from"./routes-VcLWbBmh.js";import{t as u}from"./onboarding-layout-BAx3atHc.js";import{n as d,r as f}from"./provider-key-Clqsm-h7.js";var p=e(t(),1),m=[{id:`anthropic`,displayName:`Anthropic`,apiKeyPlaceholder:`sk-ant-api03-...`,docsUrl:`https://console.anthropic.com/settings/keys`,requiresKey:!0},{id:`openai`,displayName:`OpenAI`,apiKeyPlaceholder:`sk-proj-...`,docsUrl:`https://platform.openai.com/api-keys`,requiresKey:!0},{id:`gemini`,displayName:`Google Gemini`,apiKeyPlaceholder:`AIza...`,docsUrl:`https://aistudio.google.com/apikey`,requiresKey:!0},{id:`ollama`,displayName:`Ollama`,apiKeyPlaceholder:null,docsUrl:`https://ollama.com/download`,requiresKey:!1},{id:`fireworks`,displayName:`Fireworks`,apiKeyPlaceholder:`fw_...`,docsUrl:`https://fireworks.ai/account/api-keys`,requiresKey:!0},{id:`openrouter`,displayName:`OpenRouter`,apiKeyPlaceholder:`sk-or-v1-...`,docsUrl:`https://openrouter.ai/keys`,requiresKey:!0},{id:`openai-compatible`,displayName:`OpenAI-compatible`,apiKeyPlaceholder:`Your provider's API key`,docsUrl:null,requiresKey:!0}],h=m[0];function g(e){return m.find(t=>t.id===e)}var _=i();function v(){let e=n(),[t]=r(),i=t.get(`hosting`),v=c(),[y,b]=(0,p.useState)(()=>d()?.provider??h.id),[x,S]=(0,p.useState)(()=>d()?.key??``),C=g(y)??h,w=C.requiresKey,T=!w||x.trim().length>0;return(0,_.jsx)(u,{children:(0,_.jsxs)(`div`,{className:`mx-auto flex w-full max-w-xl flex-col items-center ${v?`min-h-full px-8 pt-21 pb-4 electron-prechat-type`:`px-6 py-16`} text-[var(--content-default)]`,children:[(0,_.jsx)(`h1`,{className:v?`text-title-large`:`text-3xl font-semibold tracking-tight`,style:{animation:`fadeInUp 0.5s ease-out 0.1s both`},children:`Connect a Model Provider`}),(0,_.jsx)(`p`,{className:`text-center text-body-medium-lighter text-[var(--content-tertiary)] ${v?`mt-3.5`:`mt-3`}`,style:{animation:`fadeInUp 0.5s ease-out 0.3s both`},children:`Enter an API key to connect your model provider.`}),(0,_.jsxs)(`div`,{className:`flex w-full flex-col gap-4 ${v?`mt-8`:`mt-10`}`,style:{animation:`fadeInUp 0.5s ease-out 0.4s both`},children:[(0,_.jsxs)(`div`,{className:`flex flex-col ${v?`gap-2`:`gap-1`}`,children:[(0,_.jsx)(`label`,{className:`text-body-small-default text-[var(--content-tertiary)]`,children:`Provider`}),(0,_.jsx)(o,{"aria-label":`Provider`,value:y,onChange:e=>{let t=g(e);t&&(b(t.id),S(``))},options:m.map(e=>({value:e.id,label:e.displayName}))})]}),w&&(0,_.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,_.jsx)(s,{type:`password`,label:`${C.displayName} API Key`,placeholder:C.apiKeyPlaceholder??`Enter your API key`,value:x,onChange:e=>S(e.target.value),fullWidth:!0}),C.docsUrl&&(0,_.jsxs)(`p`,{className:`self-start text-body-medium-lighter text-[var(--content-tertiary)]`,children:[`Don't have it?`,` `,(0,_.jsx)(`a`,{href:C.docsUrl,target:`_blank`,rel:`noreferrer`,className:`text-[var(--content-default)] underline`,children:`Get an API key here`})]})]})]}),(0,_.jsxs)(`div`,{className:`mt-8 flex w-full flex-col ${v?`gap-2.5`:`gap-2`}`,style:{animation:`fadeInUp 0.5s ease-out 0.5s both`},children:[(0,_.jsx)(a,{variant:`primary`,size:`regular`,fullWidth:!0,disabled:!T,onClick:()=>{T&&(f({provider:y,key:w?x.trim():``}),e(i?`${l.onboarding.privacy}?hosting=${i}`:l.onboarding.privacy))},className:v?void 0:`h-11 text-base`,children:`Continue`}),(0,_.jsx)(a,{variant:`outlined`,size:`regular`,fullWidth:!0,onClick:()=>{e(l.onboarding.hosting)},className:v?void 0:`h-11 text-base`,children:`Back`})]})]})})}export{v as ApiKeyScreen};
@@ -1 +1 @@
1
- import{n as e}from"./sdk.gen-18Tp6Ee_.js";var t=new Map;function n(e,t){return`${e}::${t}`}function r(r,i){let a=n(r,i),o=t.get(a);return o??(o=e({path:{assistant_id:r,id:i},throwOnError:!0}).then(e=>e.data.html).catch(e=>{throw t.delete(a),e}),t.set(a,o)),o}function i(e,r,i){t.set(n(e,r),Promise.resolve(i))}function a(e,r){t.delete(n(e,r))}export{r as n,i as r,a as t};
1
+ import{n as e}from"./sdk.gen-DgqwY_WN.js";var t=new Map;function n(e,t){return`${e}::${t}`}function r(r,i){let a=n(r,i),o=t.get(a);return o??(o=e({path:{assistant_id:r,id:i},throwOnError:!0}).then(e=>e.data.html).catch(e=>{throw t.delete(a),e}),t.set(a,o)),o}function i(e,r,i){t.set(n(e,r),Promise.resolve(i))}function a(e,r){t.delete(n(e,r))}export{r as n,i as r,a as t};