@vellumai/web 0.8.9-staging.3 → 0.8.9-staging.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/{account-page-JOmrd7O5.js → account-page-DLWgiDpL.js} +1 -1
- package/dist/assets/add-credits-modal-KR3l-hlL.js +1 -0
- package/dist/assets/{advanced-page-DfQKcHki.js → advanced-page-CM1prrIX.js} +1 -1
- package/dist/assets/ai-page-DfYw7V-1.js +1 -0
- package/dist/assets/{api-key-screen-BFaPTjaE.js → api-key-screen-_pmVhsup.js} +1 -1
- package/dist/assets/{archive-page-BA9_f8tE.js → archive-page-C3-LAH2o.js} +1 -1
- package/dist/assets/{assistant-status-panel-B2a_ey3l.js → assistant-status-panel-AFf9Mjwp.js} +1 -1
- package/dist/assets/auth-store-CiQCAKS1.js +6 -0
- package/dist/assets/billing-page-o68CnS02.js +34 -0
- package/dist/assets/{chunk-5KNZJZUH-B4b1m-Ya.js → chunk-5KNZJZUH-DdS6bb-3.js} +2 -2
- package/dist/assets/{command-palette-BiZB4OSo.js → command-palette-BcHAzecz.js} +1 -1
- package/dist/assets/{community-page-j-8N5lFa.js → community-page-BCX3CsOx.js} +1 -1
- package/dist/assets/{connect-page-zFzMI9NA.js → connect-page-DXB8Xkpw.js} +1 -1
- package/dist/assets/{contacts-gateway-DjUsIJ09.js → contacts-gateway-DBRvewkn.js} +1 -1
- package/dist/assets/contacts-page-route-8pMuZN4b.js +1 -0
- package/dist/assets/danger-zone-redirect-page-G9ozZFrR.js +1 -0
- package/dist/assets/debug-page-CS2bRZp9.js +3 -0
- package/dist/assets/deploy-dialogs-EImApd6S.js +1 -0
- package/dist/assets/{developer-page-CZfUJHd7.js → developer-page-C6j4GZcn.js} +1 -1
- package/dist/assets/devices-page-C1id1sIt.js +1 -0
- package/dist/assets/{document-viewer-page-DP01_kUJ.js → document-viewer-page-D-zkJQlm.js} +1 -1
- package/dist/assets/{earn-credits-modal-QwO92K15.js → earn-credits-modal-RXLM_09P.js} +1 -1
- package/dist/assets/{emails-page-Bqv0y6Lp.js → emails-page-BFlPmeFT.js} +1 -1
- package/dist/assets/general-page-q3bvwcHU.js +1 -0
- package/dist/assets/{hatching-screen-B8RlGI3J.js → hatching-screen-6TxMgPxR.js} +1 -1
- package/dist/assets/home-page-route-mDiWda9f.js +1 -0
- package/dist/assets/{hosting-screen-DoltpG5X.js → hosting-screen-XKK-VeRo.js} +1 -1
- package/dist/assets/identity-page-route-BCiHzwmk.js +1 -0
- package/dist/assets/index-BjEJFZTJ.js +124 -0
- package/dist/assets/{inspect-page-Dmp2FUpn.js → inspect-page-BrUzgvle.js} +2 -2
- package/dist/assets/{install-Db4K638M.js → install-Uj6CrGld.js} +1 -1
- package/dist/assets/integrations-page-BL9LXHFe.js +1 -0
- package/dist/assets/{intelligence-layout-D96EIdSw.js → intelligence-layout-BwYGHEw7.js} +1 -1
- package/dist/assets/{keyboard-shortcuts-page-LBckCCBl.js → keyboard-shortcuts-page-QHFTyWOo.js} +1 -1
- package/dist/assets/library-detail-page-nUyEDHke.js +1 -0
- package/dist/assets/library-page-B0AzCNkJ.js +1 -0
- package/dist/assets/{login-flow-CaZb4l04.js → login-flow-Bi4ujzeb.js} +1 -1
- package/dist/assets/{login-page-C-HGOjOK.js → login-page-BOH-K9Pj.js} +1 -1
- package/dist/assets/{logout-page-Dl5euYyX.js → logout-page-B1QXMyiH.js} +1 -1
- package/dist/assets/{logs-layout-BTlzvT2f.js → logs-layout-zcrIEQRy.js} +1 -1
- package/dist/assets/{memory-router-playground-page-BBlTxde7.js → memory-router-playground-page-CeZ4XMd2.js} +1 -1
- package/dist/assets/{mobile-sidebar-drawer-9EUmVwhv.js → mobile-sidebar-drawer-BjPgVWjw.js} +1 -1
- package/dist/assets/notifications-page-omwlGRbj.js +1 -0
- package/dist/assets/{oauth-complete-page-AZTJJBVl.js → oauth-complete-page--ojS1AzN.js} +1 -1
- package/dist/assets/{oauth-popup-complete-page-CzA0WXr4.js → oauth-popup-complete-page-D5wVrngS.js} +2 -2
- package/dist/assets/password-reset-page-BJo9vGl_.js +1 -0
- package/dist/assets/{platform-loopback-page-CNTdcgsZ.js → platform-loopback-page--72P008D.js} +1 -1
- package/dist/assets/{plugin-detail-page-CS_wmEDi.js → plugin-detail-page-Co_JFwRa.js} +1 -1
- package/dist/assets/{plugins-page-CRtYNHW4.js → plugins-page-D7VpzRFc.js} +1 -1
- package/dist/assets/pre-chat-flow-BoePpEU7.js +1 -0
- package/dist/assets/privacy-page-DpKZ9VJG.js +1 -0
- package/dist/assets/{privacy-screen-qeQ2XoHu.js → privacy-screen-CEsX-1V3.js} +1 -1
- package/dist/assets/{provider-callback-page-C87AasMA.js → provider-callback-page-DDEEkkDM.js} +1 -1
- package/dist/assets/{provider-signup-page-CfbGs1zY.js → provider-signup-page-CZqSVAQl.js} +1 -1
- package/dist/assets/{review-terms-screen-BnGyRURw.js → review-terms-screen-CYFxXWmR.js} +1 -1
- package/dist/assets/routes-Dk5Qeryt.js +1 -0
- package/dist/assets/schedules-page-Dk-YbWK3.js +1 -0
- package/dist/assets/select-assistant-screen-CYpMf074.js +1 -0
- package/dist/assets/settings-layout-C_sqrv5S.js +1 -0
- package/dist/assets/share-feedback-modal-Cg8gci5A.js +1 -0
- package/dist/assets/{sidebar-tree-DyEHuZeN.js → sidebar-tree-Cme65q7r.js} +1 -1
- package/dist/assets/{signup-page-BTfxDffn.js → signup-page-BBM_CboU.js} +1 -1
- package/dist/assets/skills-page-J6mZv9bN.js +1 -0
- package/dist/assets/{sounds-page-CkLyWMqe.js → sounds-page-DpRhAAJv.js} +1 -1
- package/dist/assets/{step-indicator-dots-BjA1nnWA.js → step-indicator-dots-Dmj2aMuo.js} +1 -1
- package/dist/assets/{subagent-detail-panel-4B8mdN25.js → subagent-detail-panel-Dq-GDI61.js} +2 -2
- package/dist/assets/system-events-page-DNln669W.js +1 -0
- package/dist/assets/system-events-redirect-page-DY7BhERh.js +1 -0
- package/dist/assets/{tiptap-document-editor-D_JJ-i8w.js → tiptap-document-editor-DucA37Km.js} +1 -1
- package/dist/assets/tool-detail-panel-CwQTuANT.js +1 -0
- package/dist/assets/trace-page-CKTCZonQ.js +1 -0
- package/dist/assets/upgrade-cancel-page-BsW23ioD.js +1 -0
- package/dist/assets/upgrade-success-page-DqSBwFJv.js +1 -0
- package/dist/assets/{usage-page-DTCDhatY.js → usage-page-D6cPGTNn.js} +1 -1
- package/dist/assets/{use-current-platform-assistant-4FcCb-TC.js → use-current-platform-assistant-Cu95G65M.js} +1 -1
- package/dist/assets/use-is-org-ready-IPLcsl77.js +1 -0
- package/dist/assets/{use-oauth-complete-deep-link-listener-DODuMYm6.js → use-oauth-complete-deep-link-listener-BQZGv8sr.js} +1 -1
- package/dist/assets/{use-onboarding-login-CEqnm099.js → use-onboarding-login-Cd72-1Qe.js} +1 -1
- package/dist/assets/voice-page-D8IZifkA.js +1 -0
- package/dist/assets/{weather-forecast-display-CEt-zNG2.js → weather-forecast-display-DgqpUX3a.js} +1 -1
- package/dist/assets/{welcome-screen-3Gi6zm9f.js → welcome-screen-B2tizoBp.js} +1 -1
- package/dist/assets/workspace-page-Bu8beso_.js +1 -0
- package/dist/index.html +5 -5
- package/package.json +1 -1
- package/dist/assets/add-credits-modal-D1PUmkv8.js +0 -1
- package/dist/assets/ai-page-BHdzWA1C.js +0 -1
- package/dist/assets/auth-store-oleg80LZ.js +0 -6
- package/dist/assets/billing-page-BtGA4D1N.js +0 -34
- package/dist/assets/contacts-page-route-CIhz_sJO.js +0 -1
- package/dist/assets/danger-zone-redirect-page-BOK4eL8M.js +0 -1
- package/dist/assets/debug-page-EPqbjJSc.js +0 -3
- package/dist/assets/deploy-dialogs-DlIjxp-4.js +0 -1
- package/dist/assets/devices-page-CjKo24zw.js +0 -1
- package/dist/assets/general-page-BSf6qSem.js +0 -1
- package/dist/assets/home-page-route-D3PEij2C.js +0 -1
- package/dist/assets/identity-page-route-MDSvMuG9.js +0 -1
- package/dist/assets/index-DM63H2B6.js +0 -124
- package/dist/assets/integrations-page-DKhH4frU.js +0 -1
- package/dist/assets/library-detail-page-T4MedcS4.js +0 -1
- package/dist/assets/library-page-RtbQs7L5.js +0 -1
- package/dist/assets/notifications-page-DlDftqR1.js +0 -1
- package/dist/assets/password-reset-page-DyimUxBH.js +0 -1
- package/dist/assets/pre-chat-flow-BDhreJ7B.js +0 -1
- package/dist/assets/privacy-page-C1kpEJg_.js +0 -1
- package/dist/assets/routes-DMbyM_oF.js +0 -1
- package/dist/assets/schedules-page-DL7EfeDQ.js +0 -1
- package/dist/assets/select-assistant-screen-BGPc4tCz.js +0 -1
- package/dist/assets/settings-layout-Ce4VYURq.js +0 -1
- package/dist/assets/share-feedback-modal-le4GoR2Z.js +0 -1
- package/dist/assets/skills-page-D_8aU82C.js +0 -1
- package/dist/assets/system-events-page-BuSkwmMl.js +0 -1
- package/dist/assets/system-events-redirect-page-Dq56rHVE.js +0 -1
- package/dist/assets/tool-detail-panel-WvA0b4nW.js +0 -1
- package/dist/assets/trace-page-Ckyukuwf.js +0 -1
- package/dist/assets/upgrade-cancel-page-C_KXGnp0.js +0 -1
- package/dist/assets/upgrade-success-page-yvoI0p_k.js +0 -1
- package/dist/assets/use-is-org-ready-tTrrZoWV.js +0 -1
- package/dist/assets/voice-page-pG9E3NoZ.js +0 -1
- package/dist/assets/workspace-page-DNw6D4Sj.js +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{o as e}from"./chunk-jRWAZmH_.js";import{r as t,s as n}from"./local-settings-lVNyIOJ_.js";import{t as r}from"./capture-error-CZsNGL6n.js";import{t as i}from"./react-DJZBPgpf.js";import{d as a,m as o}from"./chunk-5KNZJZUH-B4b1m-Ya.js";import{n as s}from"./QueryClientProvider-DNHWXaGq.js";import{t as c}from"./useQuery-D2zf6Uhu.js";import{t as l}from"./useMutation-BuofVRHk.js";import{t as u}from"./jsx-runtime-CVSDxk6A.js";import{t as d}from"./button-DdEh-9f_.js";import{t as f}from"./card-CL5iEMJO.js";import{t as p}from"./confirm-dialog-NYG-K9zN.js";import{t as m}from"./notice-CF2pptne.js";import{n as h,r as g,t as _}from"./panel-item-FzMfzMJA.js";import{t as v}from"./input-Cu3PPVCq.js";import{n as y}from"./toast-DU1nH33j.js";import{t as b}from"./external-link-BCB1rbW9.js";import{t as x}from"./loader-circle-BSAFLoPH.js";import{t as S}from"./pencil-BA9LOIzP.js";import{t as C}from"./x-BDqbYVtS.js";import{$t as w,Qt as T,Xt as E,Zt as D,en as O,nn as k,rn as A,tn as j}from"./sdk.gen-AJllUeDf.js";import{r as M}from"./api-errors-ChauV4ed.js";import{O as ee}from"./auth-store-oleg80LZ.js";import{r as N}from"./api-DEEx3e9R.js";import{i as P}from"./routes-DMbyM_oF.js";import{n as F}from"./use-is-mobile-D_xrnINF.js";import{F as I,Ft as L,Ji as R,L as z,Mi as B,Mt as V,Nt as H,P as U,Pt as W,R as G,et as te,fo as K,ft as q,oo as J,po as ne,qa as re,ta as Y,tt as ie,zi as ae}from"./index-DM63H2B6.js";import{t as oe}from"./use-oauth-complete-deep-link-listener-DODuMYm6.js";var X=e(i(),1);async function se(e){let{data:t,error:n}=await A({path:{assistant_id:e},throwOnError:!1});if(n||!t)throw Error(`Failed to fetch OAuth providers`);return t.providers}async function ce(e,t){let{data:n,error:r}=await k({path:{assistant_id:e,providerKey:t},throwOnError:!1});if(r||!n)throw Error(`Failed to fetch OAuth provider detail`);return{oauth_callback_url:n.oauth_callback_url??null}}function Z(e,t){if(e&&typeof e==`object`){let t=e;if(t.error?.message)return t.error.message;if(t.detail)return t.detail;if(t.message)return t.message}return t}async function le(e,t){let{data:n,error:r}=await w({path:{assistant_id:e},query:{provider_key:t},throwOnError:!1});if(r||!n)throw Error(Z(r,`Failed to load OAuth apps`));return n.apps}async function ue(e,t){let{data:n,error:r}=await O({path:{assistant_id:e},body:t,throwOnError:!1});if(r||!n)throw Error(Z(r,`Failed to create OAuth app`));return n.app}async function de(e,t){let{error:n}=await T({path:{assistant_id:e,id:t},throwOnError:!1});if(n)throw Error(Z(n,`Failed to delete OAuth app`))}async function fe(e,t){let{data:n,error:r}=await D({path:{assistant_id:e,appId:t},throwOnError:!1});if(r||!n)throw Error(Z(r,`Failed to load OAuth app connections`));return n.connections}async function pe(e,t){let{error:n}=await j({path:{assistant_id:e,id:t},throwOnError:!1});if(n)throw Error(Z(n,`Failed to disconnect OAuth account`))}async function me(e,t,n){let{data:r,error:i}=await E({path:{assistant_id:e,appId:t},body:{callback_transport:`gateway`,scopes:n??[]},throwOnError:!1});if(i||!r)throw Error(Z(i,`Failed to start OAuth flow`));if(!(`auth_url`in r))throw Error(`OAuth flow did not return an authorization URL`);return{authUrl:r.auth_url,state:r.state}}function he(e){return e.length>16?`${e.slice(0,12)}…${e.slice(-4)}`:e.length>8?`${e.slice(0,8)}…`:e}function ge(e){try{return new Date(e).toLocaleDateString(void 0,{year:`numeric`,month:`short`,day:`numeric`})}catch{return``}}var Q=u();function _e(e){return new Promise(t=>setTimeout(t,e))}function ve(e){return JSON.stringify({status:e.status,connected:e.connected,account_label:e.account_label,scopes_granted:[...e.scopes_granted].sort(),expires_at:e.expires_at})}function ye(e,t){return new Map((e??[]).filter(e=>e.provider===t).map(e=>[e.id,ve(e)]))}function be(e,t,n){return e.some(e=>e.provider===t&&e.connected&&n.get(e.id)!==ve(e))}function xe({assistantId:e,providerKey:t,displayName:n,description:r,logoUrl:i,platformGate:a,onClose:o}){let u=s(),f=ee(),h=a===`full`,[g,_]=(0,X.useState)(a===`gated`?`your-own`:`managed`),[v,b]=(0,X.useState)(null),[x,S]=(0,X.useState)(null),w=(0,X.useRef)(null),T=(0,X.useRef)(null),E=(0,X.useRef)(null),D=(0,X.useRef)(null),[O,k]=(0,X.useState)(!1),A=(0,X.useCallback)(()=>{T.current=null,k(!1)},[]),j=(0,X.useCallback)(()=>{w.current&&!w.current.closed&&w.current.close(),w.current=null,E.current&&=(clearInterval(E.current),null),D.current&&=(clearTimeout(D.current),null)},[]),N=H({path:{assistant_id:e}}),F=(0,X.useCallback)(e=>{if(e.type!==`vellum:oauth-complete`||!T.current||e.requestId!==T.current.requestId)return;let{oauthStatus:t,oauthCode:r}=e;if(j(),A(),t===`connected`)y.success(`${n} account connected.`),u.invalidateQueries({queryKey:N});else{let e=r?`Error: ${r}`:`Authorization failed`;y.error(`${n} ${e}`)}},[A,j,N,n,u]),R=(0,X.useCallback)(async n=>{if(!h)return!1;for(let r=0;r<8;r+=1){r>0&&await _e(750);try{if(u.invalidateQueries({queryKey:N}),be(await u.fetchQuery({...V({path:{assistant_id:e}}),staleTime:0}),t,n))return!0}catch{}}return!1},[e,N,h,t,u]);(0,X.useEffect)(()=>{let e=e=>{e.key===`Escape`&&o()};document.addEventListener(`keydown`,e);let t=document.body.style.overflow;return document.body.style.overflow=`hidden`,()=>{document.removeEventListener(`keydown`,e),document.body.style.overflow=t}},[o]),(0,X.useEffect)(()=>{let e=e=>{let t=T.current;if(!t)return;let n=U(e,window.location.origin,t.requestId);n&&F(n)},t=e=>{let t=T.current;if(!t)return;let n=I(e,t.requestId);n&&(F(n),window.localStorage.removeItem(z(t.requestId)))};return window.addEventListener(`message`,e),window.addEventListener(`storage`,t),()=>{window.removeEventListener(`message`,e),window.removeEventListener(`storage`,t)}},[F]),oe((0,X.useCallback)(e=>{let t=T.current;t&&e.requestId===t.requestId&&F({type:`vellum:oauth-complete`,requestId:e.requestId,oauthStatus:e.oauthStatus,oauthProvider:e.oauthProvider,oauthCode:e.oauthCode})},[F])),(0,X.useEffect)(()=>ie(()=>{let e=T.current;e&&(async()=>{let t=await R(e.baselineConnectionSignatures);T.current&&(A(),t&&y.success(`${n} account connected.`))})()}),[A,R,n]),(0,X.useEffect)(()=>()=>{E.current&&clearInterval(E.current),D.current&&clearTimeout(D.current),w.current&&!w.current.closed&&w.current.close()},[]);let{data:B,isLoading:K}=c({...V({path:{assistant_id:e}}),enabled:h}),q=(B??[]).filter(e=>e.provider===t&&e.connected),J=l({...L()}),ne=l({...W(),onSuccess(e,t){y.success(`${n} account disconnected.`);let r=t.path.connection_id;u.setQueryData(N,e=>e?.filter(e=>e.id!==r)),u.invalidateQueries({queryKey:N}),b(null)},onError(e){let t=M(e,void 0,`Failed to disconnect ${n} account.`);y.error(t),b(null)}}),re=(0,X.useCallback)(()=>{if(!h)return;let r=crypto.randomUUID();if(f){k(!0),T.current={requestId:r,provider:t,baselineConnectionSignatures:ye(u.getQueryData(N)??B,t)},J.mutate({path:{assistant_id:e,provider:t},body:{requested_scopes:[],redirect_after_connect:`${P.account.oauth.popupComplete}?requestId=${r}&native=1`}},{onSuccess(e){te(e.connect_url)},onError(e){A();let t=M(e,void 0,`Failed to start ${n} authorization.`);y.error(t)}});return}let i=window.open(``,`_blank`,`width=500,height=600`);if(i===null){y.error(`Popup blocked. Please enable popups and try again.`);return}w.current=i,k(!0),T.current={requestId:r,provider:t,baselineConnectionSignatures:ye(u.getQueryData(N)??B,t)},E.current=setInterval(()=>{w.current&&w.current.closed&&T.current&&!D.current&&(D.current=setTimeout(async()=>{D.current=null;let e=T.current;if(!e)return;let t=window.localStorage.getItem(z(e.requestId));if(t)try{F(JSON.parse(t)),window.localStorage.removeItem(z(e.requestId));return}catch{}let r=await R(e.baselineConnectionSignatures);if(T.current){if(r){j(),A(),y.success(`${n} account connected.`);return}j(),A(),y.error(`${n} connection failed: authorization popup closed.`)}},1e3))},100),J.mutate({path:{assistant_id:e,provider:t},body:{requested_scopes:[],redirect_after_connect:`${P.account.oauth.popupComplete}?requestId=${r}`}},{onSuccess(e){w.current&&!w.current.closed?w.current.location.href=e.connect_url:T.current&&(j(),A(),y.error(`${n} connection failed: popup closed.`))},onError(e){j(),A();let t=M(e,void 0,`Failed to start ${n} authorization.`);y.error(t)}})},[e,t,n,B,N,u,A,j,F,R,J,f,h]),Y=e=>{S(e)},ae=()=>{let t=x;S(null),t&&(b(t.id),ne.mutate({path:{assistant_id:e,connection_id:t.id}}))},se=r?`Configure ${n} OAuth for ${r}`:`Configure ${n} OAuth`;return(0,Q.jsxs)(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center bg-black/40 p-4`,children:[(0,Q.jsxs)(`div`,{role:`dialog`,"aria-modal":`true`,"aria-labelledby":`integration-modal-title`,className:`flex w-full max-w-[520px] flex-col overflow-hidden rounded-xl bg-white shadow-xl dark:bg-[var(--surface-lift)]`,children:[(0,Q.jsxs)(`div`,{className:`flex items-start justify-between gap-3 border-b border-[var(--border-base)] px-5 py-4 dark:border-[var(--border-base)]`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,Q.jsx)(G,{providerKey:t,displayName:n,logoUrl:i,size:32}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsxs)(`h2`,{id:`integration-modal-title`,className:`text-title-small text-[var(--content-default)]`,children:[n,` OAuth`]}),(0,Q.jsx)(`p`,{className:`text-body-small-default text-[var(--content-tertiary)]`,children:se})]})]}),(0,Q.jsx)(d,{variant:`ghost`,size:`compact`,iconOnly:(0,Q.jsx)(C,{}),"aria-label":`Close`,onClick:o})]}),(0,Q.jsxs)(`div`,{className:`space-y-4 px-5 py-4`,children:[a!==`gated`&&(0,Q.jsxs)(`div`,{role:`tablist`,"aria-label":`OAuth mode`,className:`flex w-full rounded-md border border-[var(--border-base)] bg-[var(--surface-base)] p-0.5 dark:border-[var(--border-base)] dark:bg-[var(--surface-base)]/40`,children:[(0,Q.jsx)(Se,{active:g===`managed`,onClick:()=>_(`managed`),children:`Managed`}),(0,Q.jsx)(Se,{active:g===`your-own`,onClick:()=>_(`your-own`),children:`Your Own`})]}),g===`managed`&&a!==`gated`?a===`disabled`?(0,Q.jsx)(m,{tone:`info`,children:`Log in to the Vellum platform to manage OAuth connections.`}):(0,Q.jsx)(Ce,{displayName:n,providerKey:t,logoUrl:i,connections:q,connectionsLoading:K,startPending:J.isPending,oauthInProgress:O,disconnectingId:ne.isPending?v:null,onConnect:re,onDisconnect:Y}):(0,Q.jsx)(we,{assistantId:e,providerKey:t,displayName:n,logoUrl:i})]}),(0,Q.jsx)(`div`,{className:`flex justify-end border-t border-[var(--border-base)] px-5 py-3 dark:border-[var(--border-base)]`,children:(0,Q.jsx)(d,{variant:`outlined`,size:`compact`,onClick:o,children:`Confirm`})})]}),(0,Q.jsx)(p,{open:x!==null,title:`Disconnect ${n}?`,message:x?`Disconnect ${x.account_label??`${n} Account`}? You can reconnect later.`:``,confirmLabel:`Disconnect`,destructive:!0,onConfirm:ae,onCancel:()=>S(null)})]})}function Se({active:e,onClick:t,children:n}){return(0,Q.jsx)(`button`,{type:`button`,role:`tab`,"aria-selected":e,onClick:t,className:`flex-1 cursor-pointer rounded-[5px] px-3 py-1.5 text-body-medium-default transition-colors ${e?`bg-white text-[var(--content-default)] shadow-sm dark:bg-[var(--surface-lift)] dark:text-[var(--content-default)]`:`text-[var(--content-secondary)] hover:text-[var(--content-default)] dark:text-[var(--content-disabled)] dark:hover:text-[var(--content-default)]`}`,children:n})}function Ce({displayName:e,providerKey:t,logoUrl:n,connections:r,connectionsLoading:i,startPending:a,oauthInProgress:o,disconnectingId:s,onConnect:c,onDisconnect:l}){return i?(0,Q.jsx)(`div`,{className:`flex items-center justify-center py-10`,children:(0,Q.jsx)(x,{className:`h-5 w-5 animate-spin text-[var(--content-disabled)]`})}):r.length===0?a||o?(0,Q.jsxs)(`div`,{className:`flex flex-col items-center gap-3 py-10`,children:[(0,Q.jsx)(G,{providerKey:t,displayName:e,logoUrl:n,size:48}),(0,Q.jsxs)(`div`,{className:`flex items-center gap-2 text-body-medium-lighter text-[var(--content-tertiary)]`,children:[(0,Q.jsx)(x,{className:`h-3.5 w-3.5 animate-spin`}),`Waiting for authorization...`]})]}):(0,Q.jsxs)(`div`,{className:`flex flex-col items-center gap-3 py-10`,children:[(0,Q.jsx)(G,{providerKey:t,displayName:e,logoUrl:n,size:48}),(0,Q.jsx)(`p`,{className:`text-body-medium-default text-[var(--content-secondary)]`,children:`Connect Account to continue`}),(0,Q.jsx)(d,{variant:`primary`,size:`compact`,leftIcon:(0,Q.jsx)(Y,{}),onClick:c,disabled:a||o,children:`Connect Account`})]}):(0,Q.jsxs)(`div`,{className:`rounded-lg border border-[var(--border-base)]`,children:[(0,Q.jsx)(`ul`,{className:`divide-y divide-[var(--border-base)]`,children:r.map(r=>{let i=s===r.id;return(0,Q.jsxs)(`li`,{className:`flex items-center gap-3 px-4 py-3`,children:[(0,Q.jsx)(G,{providerKey:t,displayName:e,logoUrl:n,size:20}),(0,Q.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-body-medium-default text-[var(--content-default)]`,children:r.account_label??`${e} Account`}),(0,Q.jsx)(d,{variant:`dangerOutline`,size:`compact`,iconOnly:i?(0,Q.jsx)(x,{className:`animate-spin`}):(0,Q.jsx)(B,{}),onClick:()=>l(r),disabled:i,"aria-label":`Disconnect ${r.account_label??`${e} account`}`})]},r.id)})}),(0,Q.jsx)(`div`,{className:`border-t border-[var(--border-base)] px-4 py-3 dark:border-[var(--border-base)]`,children:a||o?(0,Q.jsxs)(`div`,{className:`flex items-center gap-2 text-body-medium-lighter text-[var(--content-tertiary)]`,children:[(0,Q.jsx)(x,{className:`h-3.5 w-3.5 animate-spin`}),`Waiting for authorization...`]}):(0,Q.jsx)(d,{variant:`primary`,size:`compact`,leftIcon:(0,Q.jsx)(b,{}),onClick:c,disabled:a||o,children:`Connect account`})})]})}function we({assistantId:e,providerKey:t,displayName:n,logoUrl:r}){let[i,a]=(0,X.useState)([]),[o,s]=(0,X.useState)({}),[c,l]=(0,X.useState)(!0),[u,m]=(0,X.useState)(!1),[h,g]=(0,X.useState)(``),[_,S]=(0,X.useState)(``),[C,w]=(0,X.useState)(!1),[T,E]=(0,X.useState)(null),[D,O]=(0,X.useState)(!1),[k,A]=(0,X.useState)(null),[j,M]=(0,X.useState)(null),[ee,N]=(0,X.useState)(null),[P,F]=(0,X.useState)(null),[I,L]=(0,X.useState)(null),R=(0,X.useCallback)(async t=>{try{let n=await fe(e,t);s(e=>({...e,[t]:n}))}catch(e){let t=e instanceof Error?e.message:`Failed to load connections`;y.error(t)}},[e]),z=(0,X.useCallback)(async()=>{l(!0);try{let n=await le(e,t);a(n),await Promise.all(n.map(e=>R(e.id)))}catch(e){let t=e instanceof Error?e.message:`Failed to load OAuth apps`;y.error(t)}finally{l(!1)}},[e,t,R]);(0,X.useEffect)(()=>{z()},[z]),(0,X.useEffect)(()=>{let n=!0;return ce(e,t).then(e=>{n&&E(e.oauth_callback_url)},()=>{}),()=>{n=!1}},[e,t]);let V=i.length===0||u,H=async()=>{if(!(!h.trim()||!_.trim())){w(!0);try{let r=await ue(e,{provider_key:t,client_id:h.trim(),client_secret:_.trim()});a(e=>[...e,r]),s(e=>({...e,[r.id]:[]})),g(``),S(``),m(!1),y.success(`${n} OAuth app added.`)}catch(e){let t=e instanceof Error?e.message:`Failed to create OAuth app`;y.error(t)}finally{w(!1)}}},U=e=>{F(e)},W=async()=>{let t=P;if(F(null),t){A(t.id);try{await de(e,t.id),a(e=>e.filter(e=>e.id!==t.id)),s(e=>{let n={...e};return delete n[t.id],n}),y.success(`OAuth app deleted.`)}catch(e){let t=e instanceof Error?e.message:`Failed to delete OAuth app`;y.error(t)}finally{A(null)}}},te=async t=>{M(t.id);try{let{authUrl:n}=await me(e,t.id);window.location.href=n}catch(e){let t=e instanceof Error?e.message:`Failed to start OAuth flow`;y.error(t),M(null)}},K=(e,t)=>{L({appId:e,connection:t})},q=async()=>{let t=I;if(L(null),!t)return;let{appId:r,connection:i}=t;N(i.id);try{await pe(e,i.id),s(e=>({...e,[r]:(e[r]??[]).filter(e=>e.id!==i.id)})),y.success(`${n} account disconnected.`)}catch(e){let t=e instanceof Error?e.message:`Failed to disconnect account`;y.error(t)}finally{N(null)}};return c?(0,Q.jsx)(`div`,{className:`flex items-center justify-center py-10`,children:(0,Q.jsx)(x,{className:`h-5 w-5 animate-spin text-[var(--content-disabled)]`})}):(0,Q.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[V?(0,Q.jsx)(f.Root,{children:(0,Q.jsxs)(f.Body,{className:`flex flex-col gap-3`,children:[(0,Q.jsxs)(`div`,{className:`space-y-1`,children:[(0,Q.jsx)(`p`,{className:`text-body-medium-default text-[var(--content-default)]`,children:i.length===0?`Add your own ${n} OAuth app`:`Add another ${n} OAuth app`}),(0,Q.jsx)(`p`,{className:`text-body-small-default leading-relaxed text-[var(--content-tertiary)]`,children:`Credentials are stored encrypted on the assistant and are never sent to Vellum.`})]}),T?(0,Q.jsxs)(`div`,{className:`space-y-1`,children:[(0,Q.jsx)(`p`,{className:`text-body-small-default text-[var(--content-secondary)]`,children:`Redirect URL`}),(0,Q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Q.jsx)(v,{type:`text`,value:T,readOnly:!0,fullWidth:!0}),(0,Q.jsx)(d,{type:`button`,variant:`outlined`,size:`compact`,onClick:()=>{navigator.clipboard.writeText(T).then(()=>{O(!0),y.success(`Copied to clipboard!`),setTimeout(()=>O(!1),2e3)})},"aria-label":D?`Copied`:`Copy redirect URL`,iconOnly:D?(0,Q.jsx)(ne,{"aria-hidden":!0}):(0,Q.jsx)(re,{"aria-hidden":!0})})]}),(0,Q.jsx)(`p`,{className:`text-body-small-default text-[var(--content-tertiary)]`,children:`Add this URL to your OAuth app's redirect settings.`})]}):null,(0,Q.jsx)(v,{label:`Client ID`,type:`text`,value:h,onChange:e=>g(e.target.value),placeholder:`Enter your client ID`,fullWidth:!0}),(0,Q.jsx)(v,{label:`Client Secret`,type:`password`,value:_,onChange:e=>S(e.target.value),placeholder:`Enter your client secret`,fullWidth:!0}),(0,Q.jsxs)(`div`,{className:`flex items-center justify-end gap-2 pt-1`,children:[i.length>0?(0,Q.jsx)(d,{type:`button`,variant:`outlined`,size:`compact`,onClick:()=>{m(!1),g(``),S(``)},disabled:C,children:`Cancel`}):null,(0,Q.jsx)(d,{type:`button`,size:`compact`,onClick:H,disabled:C||!h.trim()||!_.trim(),leftIcon:C?(0,Q.jsx)(x,{className:`animate-spin`,"aria-hidden":!0}):(0,Q.jsx)(Y,{"aria-hidden":!0}),children:`Add App`})]})]})}):null,i.map(e=>{let i=o[e.id]??[],a=k===e.id,s=j===e.id;return(0,Q.jsx)(f.Root,{children:(0,Q.jsxs)(f.Body,{className:`flex flex-col gap-3`,children:[(0,Q.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[(0,Q.jsxs)(`div`,{className:`min-w-0 space-y-0.5`,children:[(0,Q.jsx)(`p`,{className:`truncate text-body-medium-default text-[var(--content-default)]`,children:he(e.client_id)}),(0,Q.jsxs)(`p`,{className:`text-body-small-default text-[var(--content-tertiary)]`,children:[`Added `,ge(e.created_at)]})]}),(0,Q.jsx)(d,{type:`button`,variant:`dangerOutline`,size:`compact`,onClick:()=>U(e),disabled:a,"aria-label":`Delete OAuth app ${he(e.client_id)}`,iconOnly:a?(0,Q.jsx)(x,{className:`animate-spin`,"aria-hidden":!0}):(0,Q.jsx)(B,{"aria-hidden":!0})})]}),i.length>0?(0,Q.jsx)(`ul`,{className:`divide-y divide-[var(--border-base)] overflow-hidden rounded-md border border-[var(--border-base)] dark:divide-[var(--border-base)] dark:border-[var(--border-base)]`,children:i.map(i=>{let a=ee===i.id;return(0,Q.jsxs)(`li`,{className:`flex items-center gap-3 px-3 py-2`,children:[(0,Q.jsx)(G,{providerKey:t,displayName:n,logoUrl:r,size:18}),(0,Q.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-body-medium-lighter text-[var(--content-default)]`,children:i.account_info??`${n} Account`}),(0,Q.jsx)(d,{type:`button`,variant:`dangerOutline`,size:`compact`,onClick:()=>K(e.id,i),disabled:a,"aria-label":`Disconnect ${i.account_info??`${n} account`}`,iconOnly:a?(0,Q.jsx)(x,{className:`animate-spin`,"aria-hidden":!0}):(0,Q.jsx)(B,{"aria-hidden":!0})})]},i.id)})}):null,(0,Q.jsx)(d,{type:`button`,size:`compact`,onClick:()=>te(e),disabled:s,className:`w-full`,leftIcon:s?(0,Q.jsx)(x,{className:`animate-spin`,"aria-hidden":!0}):(0,Q.jsx)(b,{"aria-hidden":!0}),children:s?`Waiting for authorization...`:`Connect account`})]})},e.id)}),i.length>0&&!u?(0,Q.jsx)(d,{type:`button`,variant:`outlined`,size:`compact`,onClick:()=>m(!0),className:`w-full border-dashed`,leftIcon:(0,Q.jsx)(Y,{"aria-hidden":!0}),children:`Add Another App`}):null,(0,Q.jsx)(p,{open:P!==null,title:`Delete OAuth app`,message:P?`Delete OAuth app '${he(P.client_id)}'? This will disconnect all linked accounts.`:``,confirmLabel:`Delete`,destructive:!0,onConfirm:()=>{W()},onCancel:()=>F(null)}),(0,Q.jsx)(p,{open:I!==null,title:`Disconnect ${n}?`,message:I?`Disconnect ${I.connection.account_info??`${n} Account`}? You can reconnect later.`:``,confirmLabel:`Disconnect`,destructive:!0,onConfirm:()=>{q()},onCancel:()=>L(null)})]})}function Te({assistantId:e,providerKey:t,displayName:n,description:r,logoUrl:i,connection:a,platformGate:o,onConfigure:c}){let u=s(),m=!!a?.connected,[h,g]=(0,X.useState)(!1),[_,v]=(0,X.useState)(!1),b=F(),x=H({path:{assistant_id:e}}),S=l({...W(),onSuccess(e,t){y.success(`${n} account disconnected.`);let r=t.path.connection_id;u.setQueryData(x,e=>e?.filter(e=>e.id!==r)),u.invalidateQueries({queryKey:x})},onError(e){let t=M(e,void 0,`Failed to disconnect ${n} account.`);y.error(t)}}),C=()=>{a?.id&&v(!0)};return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(f.Root,{children:(0,Q.jsxs)(f.Body,{padding:`sm`,className:`flex items-center gap-4 px-4`,children:[(0,Q.jsx)(G,{providerKey:t,displayName:n,logoUrl:i,size:32}),(0,Q.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Q.jsx)(`p`,{className:`truncate text-title-small text-[var(--content-default)]`,children:n}),r&&(0,Q.jsx)(`p`,{className:`truncate text-body-medium-lighter text-[var(--content-tertiary)]`,children:r})]}),m&&o===`full`?(0,Q.jsx)(`div`,{className:`shrink-0`,children:(0,Q.jsx)(Ee,{displayName:n,open:h,onOpenChange:g,onEditConnections:()=>{g(!1),c()},onDisable:()=>{g(!1),C()},disablePending:S.isPending,isMobile:b})}):(0,Q.jsx)(d,{variant:`primary`,onClick:c,className:`shrink-0`,children:`Enable`})]})}),(0,Q.jsx)(p,{open:_,title:`Disconnect ${n}?`,message:`Disconnect your ${n} account? You can reconnect it later.`,confirmLabel:`Disconnect`,destructive:!0,onConfirm:()=>{v(!1),a?.id&&S.mutate({path:{assistant_id:e,connection_id:a.id}})},onCancel:()=>v(!1)})]})}function Ee({displayName:e,open:t,onOpenChange:n,onEditConnections:r,onDisable:i,disablePending:a,isMobile:o}){return o?(0,Q.jsxs)(h.Root,{open:t,onOpenChange:n,children:[(0,Q.jsx)(h.Trigger,{asChild:!0,children:(0,Q.jsx)(d,{variant:`outlined`,rightIcon:(0,Q.jsx)(K,{}),"aria-haspopup":`menu`,"aria-expanded":t,children:`Configure`})}),(0,Q.jsxs)(h.Content,{children:[(0,Q.jsx)(h.Header,{children:(0,Q.jsx)(h.Title,{children:e})}),(0,Q.jsxs)(h.Body,{children:[(0,Q.jsx)(_,{icon:S,label:`Edit connections`,onSelect:r}),(0,Q.jsx)(_,{icon:a?x:J,label:`Disable`,onSelect:()=>{a||i()}})]})]})]}):(0,Q.jsxs)(g.Root,{open:t,onOpenChange:n,children:[(0,Q.jsx)(g.Trigger,{asChild:!0,children:(0,Q.jsx)(d,{variant:`outlined`,rightIcon:(0,Q.jsx)(K,{}),"aria-haspopup":`menu`,"aria-expanded":t,children:`Configure`})}),(0,Q.jsxs)(g.Content,{align:`end`,sideOffset:4,role:`menu`,className:`w-56 overflow-hidden p-0`,children:[(0,Q.jsx)(d,{type:`button`,role:`menuitem`,variant:`ghost`,onClick:r,className:`w-full justify-start rounded-none`,leftIcon:(0,Q.jsx)(S,{"aria-hidden":!0}),children:`Edit connections`}),(0,Q.jsx)(d,{type:`button`,role:`menuitem`,variant:`dangerGhost`,onClick:i,disabled:a,className:`w-full justify-start rounded-none`,leftIcon:a?(0,Q.jsx)(x,{className:`animate-spin`,"aria-hidden":!0}):(0,Q.jsx)(J,{"aria-hidden":!0}),children:`Disable`})]})]})}var De=`vellum:integrations:bannerDismissed`,Oe=[{value:`all`,label:`All`},{value:`enabled`,label:`Enabled`},{value:`not-enabled`,label:`Not Enabled`}];function $(e,t){return e?.find(e=>e.provider===t)??null}function ke(){let[e]=o(),i=a(),s=q(),[l,u]=(0,X.useState)(null),[d,f]=(0,X.useState)(!0),[p,h]=(0,X.useState)(``),[_,b]=(0,X.useState)(`all`),[S,C]=(0,X.useState)(!1),[w,T]=(0,X.useState)(!0),[E,D]=(0,X.useState)(null);(0,X.useEffect)(()=>{T(t(De,`false`)===`true`)},[]);let O=()=>{T(!0),n(De,`true`)};(0,X.useEffect)(()=>{let e=!0;return(async()=>{try{let t=await N();e&&t.ok&&u(t.data)}catch(e){r(e,{context:`integrations.getAssistant`})}finally{e&&f(!1)}})(),()=>{e=!1}},[]);let{data:k,isLoading:A,isError:j}=c({queryKey:[`oauth-providers`,l?.id],queryFn:()=>se(l.id),enabled:!!l}),{data:M,isLoading:ee}=c({...V({path:{assistant_id:l?.id??``}}),enabled:!!l&&s===`full`});(0,X.useEffect)(()=>{let t=e.get(`oauth_status`);if(!t)return;let n=e.get(`oauth_provider`),r=n?n.charAt(0).toUpperCase()+n.slice(1):null;if(t===`connected`)y.success(r?`${r} account connected successfully.`:`Account connected successfully.`);else if(t===`error`){let t=e.get(`oauth_code`)??`unknown`;y.error({denied:`Authorization was denied. Please try again.`,state_invalid:`Authorization state was invalid. Please try again.`,state_expired:`Authorization expired. Please try again.`,exchange_failed:`Failed to complete authorization. Please try again.`,identity_failed:`Failed to verify account identity. Please try again.`}[t]??(r?`Failed to connect ${r}.`:`Failed to connect. Please try again.`))}i(P.settings.integrations,{replace:!0})},[e,i]);let F=(0,X.useMemo)(()=>k?.filter(e=>e.supports_managed_mode)??[],[k]),I=(0,X.useMemo)(()=>{let e=p.trim().toLowerCase(),t=F.filter(t=>{if(!e)return!0;let n=(t.display_name??t.provider_key).toLowerCase(),r=(t.description??``).toLowerCase();return n.includes(e)||r.includes(e)});return _!==`all`&&(t=t.filter(e=>{let t=!!$(M,e.provider_key)?.connected;return _===`enabled`?t:!t})),[...t].sort((e,t)=>{let n=!!$(M,e.provider_key)?.connected;if(n!==!!$(M,t.provider_key)?.connected)return n?-1:1;let r=(e.display_name??e.provider_key).toLowerCase(),i=(t.display_name??t.provider_key).toLowerCase();return r.localeCompare(i)})},[F,M,p,_]),L=d||A||ee,z=Oe.find(e=>e.value===_)?.label??`All`,B=(()=>{if(p.trim())return`No integrations matched`;switch(_){case`enabled`:return`No Enabled Integrations`;case`not-enabled`:return`All Integrations Are Enabled`;default:return`No Integrations Available`}})(),H=(()=>{if(p.trim())return`No integrations matched "${p.trim()}"`;switch(_){case`enabled`:return`Connect an integration to get started.`;case`not-enabled`:return`All available integrations have been connected.`;default:return`Check your connection and try again.`}})(),U=(0,X.useMemo)(()=>E?F.find(e=>e.provider_key===E)??null:null,[F,E]);return(0,Q.jsxs)(`div`,{className:`space-y-4`,children:[!w&&(0,Q.jsxs)(m,{tone:`info`,icon:(0,Q.jsx)(ae,{className:`h-3.5 w-3.5`}),onDismiss:O,children:[(0,Q.jsx)(`span`,{className:`text-body-medium-default`,children:`Tip:`}),` You can enable integrations by mentioning them in chat.`]}),(0,Q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Q.jsx)(v,{type:`text`,value:p,onChange:e=>h(e.target.value),placeholder:`Search Integrations`,"aria-label":`Search integrations`,leftIcon:(0,Q.jsx)(R,{className:`h-3.5 w-3.5`,"aria-hidden":!0}),fullWidth:!0,wrapperClassName:`flex-1`}),(0,Q.jsxs)(g.Root,{open:S,onOpenChange:C,children:[(0,Q.jsx)(g.Trigger,{asChild:!0,children:(0,Q.jsxs)(`button`,{type:`button`,"aria-haspopup":`listbox`,"aria-expanded":S,className:`flex w-36 cursor-pointer items-center justify-between gap-2 rounded-md border border-[var(--border-element)] bg-[var(--surface-lift)] px-3 py-1.5 text-body-medium-lighter text-[var(--content-default)] transition-colors hover:bg-[var(--ghost-hover)]`,children:[(0,Q.jsx)(`span`,{children:z}),(0,Q.jsx)(K,{className:`h-3.5 w-3.5`})]})}),(0,Q.jsx)(g.Content,{align:`end`,sideOffset:4,className:`w-36 overflow-hidden p-0`,children:(0,Q.jsx)(`div`,{role:`listbox`,children:Oe.map(e=>{let t=e.value===_;return(0,Q.jsx)(`button`,{type:`button`,role:`option`,"aria-selected":t,onClick:()=>{b(e.value),C(!1)},className:`flex w-full cursor-pointer items-center px-3 py-1.5 text-left hover:bg-[var(--ghost-hover)] ${t?`text-body-medium-default text-[var(--content-default)]`:`text-body-medium-lighter text-[var(--content-default)]`}`,children:e.label},e.value)})})})]})]}),(0,Q.jsx)(`div`,{children:L?(0,Q.jsxs)(`div`,{className:`flex items-center gap-2 py-6 text-body-medium-lighter text-[var(--content-tertiary)]`,children:[(0,Q.jsx)(x,{className:`h-4 w-4 animate-spin`}),(0,Q.jsx)(`span`,{children:`Loading...`})]}):j?(0,Q.jsx)(`p`,{className:`text-body-medium-lighter text-[var(--content-tertiary)]`,children:`Failed to load integrations. Please try again.`}):l?I.length===0?(0,Q.jsxs)(`div`,{className:`flex flex-col items-center gap-2 rounded-lg border border-dashed border-[var(--border-element)] px-4 py-12 text-center`,children:[(0,Q.jsx)(R,{className:`h-6 w-6 text-[var(--content-disabled)]`}),(0,Q.jsx)(`p`,{className:`text-body-medium-default text-[var(--content-default)]`,children:B}),(0,Q.jsx)(`p`,{className:`text-body-small-default text-[var(--content-tertiary)]`,children:H})]}):(0,Q.jsx)(`div`,{className:`space-y-2`,children:I.map(e=>(0,Q.jsx)(Te,{assistantId:l.id,providerKey:e.provider_key,displayName:e.display_name??e.provider_key,description:e.description,logoUrl:e.logo_url,connection:$(M,e.provider_key),platformGate:s,onConfigure:()=>D(e.provider_key)},e.provider_key))}):(0,Q.jsx)(`p`,{className:`text-body-medium-lighter text-[var(--content-tertiary)]`,children:`No assistant found. Hatch an assistant to connect integrations.`})}),U&&l&&(0,Q.jsx)(xe,{assistantId:l.id,providerKey:U.provider_key,displayName:U.display_name??U.provider_key,description:U.description,logoUrl:U.logo_url,platformGate:s,onClose:()=>D(null)})]})}function Ae(){return(0,Q.jsx)(`div`,{className:`space-y-6`,children:(0,Q.jsx)(X.Suspense,{children:(0,Q.jsx)(ke,{})})})}export{Ae as IntegrationsPage};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{o as e}from"./chunk-jRWAZmH_.js";import{t}from"./react-DJZBPgpf.js";import{d as n,f as r}from"./chunk-5KNZJZUH-B4b1m-Ya.js";import{t as i}from"./jsx-runtime-CVSDxk6A.js";import"./src-hn7lwVCD.js";import{n as a}from"./toast-DU1nH33j.js";import{t as o}from"./loader-circle-BSAFLoPH.js";import{n as s}from"./sdk.gen-AJllUeDf.js";import{i as c}from"./routes-DMbyM_oF.js";import{r as l}from"./app-html-cache-DNQd-TK8.js";import{Z as u,st as d,t as f}from"./index-DM63H2B6.js";import{t as p}from"./use-active-assistant-id-BIhArlF_.js";var m=e(t(),1),h=i();function g(){let{appId:e}=r(),t=p(),i=n(),[g,_]=(0,m.useState)(null),[v,y]=(0,m.useState)(null),[b,x]=(0,m.useState)(!1),S=(0,m.useRef)(null);(0,m.useEffect)(()=>{if(e)return S.current=e,_(null),y(null),s({path:{assistant_id:t,id:e},throwOnError:!0}).then(({data:n})=>{S.current===e&&(l(t,n.appId,n.html),_({appId:n.appId,dirName:n.dirName,name:n.name,html:n.html}))}).catch(t=>{S.current===e&&y(t instanceof Error?t.message:`Failed to open app`)}),()=>{S.current=null}},[t,e]);let C=(0,m.useCallback)(()=>{i(c.library.root)},[i]),w=f(),T=(0,m.useCallback)(()=>{g&&w(g)},[g,w]),E=(0,m.useCallback)(async()=>{if(!(!g||b)){x(!0);try{await d(t,g.appId,g.name),a.success(`App exported`,{description:`${g.name}.vellum`})}catch(e){a.error(`Failed to share app`,{description:e instanceof Error?e.message:void 0})}finally{x(!1)}}},[t,g,b]);return e?v?(0,h.jsxs)(`div`,{className:`flex flex-1 flex-col items-center justify-center gap-4`,children:[(0,h.jsx)(`p`,{className:`text-body-medium-lighter text-[var(--content-tertiary)]`,children:v}),(0,h.jsx)(`button`,{type:`button`,onClick:C,className:`text-body-medium-default text-[var(--primary-base)] underline`,children:`Back to Library`})]}):g?(0,h.jsx)(u,{appId:g.appId,appName:g.name,html:g.html,assistantId:t,onClose:C,onEdit:T,onShare:E,isSharing:b,enableFullscreen:!0}):(0,h.jsx)(`div`,{className:`flex flex-1 items-center justify-center`,children:(0,h.jsx)(o,{className:`h-6 w-6 animate-spin text-[var(--content-tertiary)]`})}):null}export{g as LibraryDetailPage};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{o as e}from"./chunk-jRWAZmH_.js";import{t}from"./react-DJZBPgpf.js";import{d as n}from"./chunk-5KNZJZUH-B4b1m-Ya.js";import{n as r}from"./QueryClientProvider-DNHWXaGq.js";import{t as i}from"./useQuery-D2zf6Uhu.js";import{t as a}from"./jsx-runtime-CVSDxk6A.js";import{t as o}from"./button-DdEh-9f_.js";import{t as s}from"./menu-B79-l6IU.js";import"./src-hn7lwVCD.js";import{t as c}from"./confirm-dialog-NYG-K9zN.js";import{n as l,t as u}from"./panel-item-FzMfzMJA.js";import{t as d}from"./input-Cu3PPVCq.js";import{n as f}from"./toast-DU1nH33j.js";import{t as p}from"./arrow-up-BLnb2N1m.js";import{t as m}from"./globe-ByNYDdSW.js";import{s as h,t as g}from"./sdk.gen-AJllUeDf.js";import{f as _,n as v,t as y}from"./react-query.gen-B8xaBreR.js";import{i as b}from"./routes-DMbyM_oF.js";import{t as x}from"./assistant-feature-flag-store-0382ImYF.js";import{n as S}from"./use-is-mobile-D_xrnINF.js";import{n as C,t as w}from"./app-html-cache-DNQd-TK8.js";import{t as T}from"./misc-MEUnNRwX.js";import{Ia as E,Ji as D,Mi as O,Va as k,aa as A,ia as j,jn as M,ki as N,ot as P,st as F,wa as I,z as L}from"./index-DM63H2B6.js";import{t as R}from"./deploy-dialogs-DlIjxp-4.js";import{t as z}from"./use-active-assistant-id-BIhArlF_.js";import{t as B}from"./page-shell-CYsp3hSr.js";import{t as V}from"./format-date-lYqfuFdi.js";var H=e(t(),1),U=a();function W({app:e,isDeleting:t,onConfirm:n,onCancel:r}){return(0,U.jsx)(c,{open:e!==null,title:`Delete app`,message:e?`"${e.name}" will be permanently removed.`:``,confirmLabel:t?`Deleting…`:`Delete`,destructive:!0,onConfirm:n,onCancel:r})}function G(e){return e===1?`1 word`:`${e} words`}function K({document:e,onOpen:t}){return(0,U.jsxs)(`div`,{className:`group relative flex flex-col gap-2`,children:[(0,U.jsxs)(`button`,{type:`button`,onClick:()=>t(e.surfaceId),className:T(`relative flex w-full cursor-pointer flex-col items-center justify-center gap-2 overflow-hidden rounded-xl border border-[var(--border-base)] bg-[var(--surface-base)]`,`aspect-[16/10]`,`outline-none focus-visible:ring-2 focus-visible:ring-[var(--ring)]`),children:[(0,U.jsx)(E,{size:34,className:`text-[var(--content-tertiary)]`}),(0,U.jsx)(`span`,{className:`text-body-small-default text-[var(--content-tertiary)]`,children:G(e.wordCount)})]}),(0,U.jsxs)(`button`,{type:`button`,onClick:()=>t(e.surfaceId),className:`flex cursor-pointer flex-col gap-0.5 px-0.5 text-left outline-none`,children:[(0,U.jsx)(`span`,{className:`truncate text-body-large-default text-[color:var(--content-emphasised)]`,children:e.title}),(0,U.jsx)(`span`,{className:`text-body-small-default text-[color:var(--content-tertiary)]`,children:V(new Date(e.updatedAt))})]})]})}function q({fileInputRef:e,isImporting:t,onImportBundle:n,onNewConversation:r}){return(0,U.jsxs)(`div`,{className:`flex h-full flex-col items-center justify-center gap-4 px-4 py-24`,children:[(0,U.jsx)(`input`,{ref:e,type:`file`,accept:`.vellum`,className:`hidden`,onChange:n}),(0,U.jsx)(`div`,{className:`flex h-16 w-16 items-center justify-center rounded-xl bg-[var(--surface-base)]`,children:(0,U.jsx)(I,{size:32,className:`text-[var(--content-tertiary)]`})}),(0,U.jsx)(`h2`,{className:`text-title-medium text-[var(--content-default)]`,children:`Your library is empty`}),(0,U.jsx)(`p`,{className:`max-w-md text-center text-body-medium-lighter text-[color:var(--content-tertiary)]`,children:`Ask your assistant to build something, or import a shared app`}),(0,U.jsxs)(`div`,{className:`flex flex-col items-center gap-3`,children:[r?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(o,{variant:`primary`,size:`regular`,onClick:r,children:`New Conversation`}),(0,U.jsx)(`span`,{className:`text-body-small-default text-[color:var(--content-tertiary)]`,children:`or`})]}):null,(0,U.jsxs)(o,{variant:`outlined`,size:`regular`,onClick:()=>e.current?.click(),disabled:t,children:[t?(0,U.jsx)(`div`,{className:`h-4 w-4 animate-spin rounded-full border-2 border-current border-t-transparent`}):(0,U.jsx)(N,{size:14}),(0,U.jsx)(`span`,{className:`ml-1.5`,children:`Import .vellum File`})]})]})]})}function J({app:e,assistantId:t,isPinned:n,onOpen:r,onPin:i,onDelete:a,onDeploy:o,justImported:s,onAnimationEnd:c}){let[l,u]=(0,H.useState)(!1),d=(0,H.useCallback)(()=>C(t,e.id),[t,e.id]),p=(0,H.useCallback)(async()=>{if(!l){u(!0);try{await F(t,e.id,e.name),f.success(`App exported`,{description:`${e.name}.vellum`})}catch(e){f.error(`Failed to share app`,{description:e instanceof Error?e.message:void 0})}finally{u(!1)}}},[t,e.id,e.name,l]),[m,h]=(0,H.useState)(!1),g=S();return(0,U.jsxs)(`div`,{className:T(`group relative flex flex-col gap-2`,s&&`animate-[card-entrance_400ms_ease-out]`),onAnimationEnd:s?c:void 0,children:[(0,U.jsx)(`button`,{type:`button`,onClick:()=>r(e.id),className:T(`relative w-full cursor-pointer overflow-hidden rounded-xl`,`outline-none focus-visible:ring-2 focus-visible:ring-[var(--ring)]`),children:(0,U.jsx)(L,{name:e.name,icon:e.icon,loadHtml:d})}),(0,U.jsx)(`div`,{className:T(`absolute right-2 top-2 z-20 transition-opacity`,`max-md:opacity-100`,`md:group-hover:opacity-100 md:group-focus-within:opacity-100`,m?`opacity-100`:`md:opacity-0`),children:(0,U.jsx)(Y,{appName:e.name,isPinned:n,open:m,onOpenChange:h,onPin:()=>i(e),onDelete:a?()=>a(e):void 0,onShare:p,onDeploy:o,isMobile:g})}),(0,U.jsxs)(`button`,{type:`button`,onClick:()=>r(e.id),className:`flex cursor-pointer flex-col gap-0.5 px-0.5 text-left outline-none`,children:[(0,U.jsx)(`span`,{className:`truncate text-body-large-default text-[color:var(--content-emphasised)]`,children:e.name}),(0,U.jsx)(`span`,{className:`text-body-small-default text-[color:var(--content-tertiary)]`,children:V(new Date(e.createdAt))})]})]})}function Y({appName:e,isPinned:t,open:n,onOpenChange:r,onPin:i,onDelete:a,onShare:c,onDeploy:d,isMobile:f}){return f?(0,U.jsxs)(l.Root,{open:n,onOpenChange:r,children:[(0,U.jsx)(l.Trigger,{asChild:!0,children:(0,U.jsx)(o,{variant:`primary`,size:`compact`,iconOnly:(0,U.jsx)(k,{}),"aria-label":`App actions`,onClick:e=>e.stopPropagation()})}),(0,U.jsxs)(l.Content,{children:[(0,U.jsx)(l.Header,{className:`sr-only`,children:(0,U.jsx)(l.Title,{children:e})}),(0,U.jsxs)(l.Body,{className:`pt-0`,children:[(0,U.jsx)(u,{icon:t?A:j,label:t?`Unpin`:`Pin`,onSelect:()=>{r(!1),i()}}),c?(0,U.jsx)(u,{icon:p,label:(0,U.jsxs)(`span`,{className:`flex flex-col gap-0.5 overflow-visible whitespace-normal`,children:[(0,U.jsx)(`span`,{children:`Share`}),(0,U.jsx)(`span`,{className:`text-body-small-default text-[var(--content-tertiary)]`,children:`Export as .vellum file`})]}),onSelect:()=>{r(!1),c()}}):null,d?(0,U.jsx)(u,{icon:m,label:(0,U.jsxs)(`span`,{className:`flex flex-col gap-0.5 overflow-visible whitespace-normal`,children:[(0,U.jsx)(`span`,{children:`Deploy to Vercel`}),(0,U.jsx)(`span`,{className:`text-body-small-default text-[var(--content-tertiary)]`,children:`Publish as a static page`})]}),onSelect:()=>{r(!1),d()}}):null,a?(0,U.jsx)(u,{icon:O,label:`Delete`,onSelect:()=>{r(!1),a()}}):null]})]})]}):(0,U.jsxs)(s.Root,{open:n,onOpenChange:r,children:[(0,U.jsx)(s.Trigger,{asChild:!0,children:(0,U.jsx)(o,{variant:`primary`,size:`compact`,iconOnly:(0,U.jsx)(k,{}),"aria-label":`App actions`,onClick:e=>e.stopPropagation()})}),(0,U.jsxs)(s.Content,{align:`end`,sideOffset:4,children:[(0,U.jsx)(s.Item,{leftIcon:t?(0,U.jsx)(A,{size:14}):(0,U.jsx)(j,{size:14}),onSelect:()=>i(),className:`whitespace-nowrap`,children:t?`Unpin`:`Pin`}),c?(0,U.jsx)(s.Item,{leftIcon:(0,U.jsx)(p,{size:14}),onSelect:()=>c(),className:`whitespace-nowrap`,children:`Share`}):null,d?(0,U.jsx)(s.Item,{leftIcon:(0,U.jsx)(m,{size:14}),onSelect:()=>d(),className:`whitespace-nowrap`,children:`Deploy to Vercel`}):null,a?(0,U.jsx)(s.Item,{leftIcon:(0,U.jsx)(O,{size:14,className:`text-red-600`}),onSelect:()=>a(),className:`whitespace-nowrap text-red-600 data-[highlighted]:text-red-700`,children:`Delete`}):null]})]})}function X({title:e,apps:t,assistantId:n,pinnedAppIds:r,lastImportedAppId:i,onOpen:a,onPin:o,onDelete:s,onDeploy:c,onAnimationEnd:l}){return t.length===0?null:(0,U.jsxs)(`section`,{children:[(0,U.jsx)(`h2`,{className:`mb-4 text-body-small-emphasised text-[color:var(--content-secondary)]`,children:e}),(0,U.jsx)(`div`,{className:`grid grid-cols-[repeat(auto-fill,minmax(max(220px,calc((100%-6rem)/5)),1fr))] gap-6`,children:t.map(e=>(0,U.jsx)(J,{app:e,assistantId:n,isPinned:r.has(e.id),onOpen:a,onPin:o,onDelete:s,justImported:e.id===i,onAnimationEnd:l,onDeploy:c?()=>c(e.id):void 0},e.id))})]})}function Z(e){let t=M.use.pinnedAppIds(),{data:n=[],isLoading:r,error:a}=i({...y({path:{assistant_id:e}}),select:e=>e.apps}),{data:o=[],isLoading:s,error:c}=i({..._({path:{assistant_id:e}}),select:e=>e.documents}),l=r||s,u=a&&c?a instanceof Error?a.message:`Failed to load library`:null,[d,f]=(0,H.useState)(``),p=(0,H.useMemo)(()=>{if(!d.trim())return n;let e=d.toLowerCase();return n.filter(t=>t.name.toLowerCase().includes(e)||t.description?.toLowerCase().includes(e))},[n,d]);return{apps:n,documents:o,filteredApps:p,pinnedApps:(0,H.useMemo)(()=>p.filter(e=>t.has(e.id)).sort((e,t)=>t.createdAt-e.createdAt),[p,t]),recentApps:(0,H.useMemo)(()=>p.filter(e=>!t.has(e.id)).sort((e,t)=>t.createdAt-e.createdAt),[p,t]),filteredDocuments:(0,H.useMemo)(()=>{if(!d.trim())return o;let e=d.toLowerCase();return o.filter(t=>t.title.toLowerCase().includes(e))},[o,d]),searchText:d,setSearchText:f,loading:l,error:u}}async function ee(e,t){let{data:n,error:r,response:i}=await h({path:{assistant_id:e},body:t,bodySerializer:e=>e,headers:{"Content-Type":`application/octet-stream`},throwOnError:!1});if(!i||!i.ok){let e=(r&&typeof r==`object`&&`message`in r?r.message:null)??`Failed to import app.`;throw Error(e)}return n}function Q({assistantId:e,assistantName:t,title:n,onNewConversation:i,onOpenDocument:a,onOpenApp:s}){let c=r(),l=x.use.deployToVercel(),u=M.use.togglePin(),p=M.use.pinnedAppIds(),m=P.use.isDeploying(),{apps:h,documents:_,filteredApps:y,pinnedApps:b,recentApps:S,filteredDocuments:T,searchText:E,setSearchText:O,loading:k,error:A}=Z(e),[j,F]=(0,H.useState)(null),[I,L]=(0,H.useState)(!1),z=(0,H.useCallback)(async()=>{let t=j;if(!(!t||I)){L(!0);try{await g({path:{assistant_id:e,id:t.id},throwOnError:!0}),w(e,t.id),c.invalidateQueries({queryKey:v({path:{assistant_id:e}})}),p.has(t.id)&&u(t),F(null)}catch(e){f.error(e instanceof Error?e.message:`Failed to delete app`)}finally{L(!1)}}},[j,I,e,p,u,c]),B=(0,H.useCallback)(()=>{I||F(null)},[I]),V=(0,H.useRef)(null),[G,J]=(0,H.useState)(!1),Y=(0,H.useCallback)(async t=>{let n=t.target.files?.[0];if(!(!n||G)){J(!0);try{let t=await ee(e,n);await c.invalidateQueries({queryKey:v({path:{assistant_id:e}})}),f.success(t.name+` imported`),s(t.appId)}catch(e){f.error(e instanceof Error?e.message:`Failed to import app`)}finally{J(!1),V.current&&(V.current.value=``)}}},[e,G,c,s]),Q=(0,H.useCallback)(async t=>{if(m)return;let n=h.find(e=>e.id===t)?.name??`this app`;try{let r=await C(e,t);P.getState().deployApp(e,t,n,r)}catch{P.getState().deployApp(e,t,n,``)}},[e,m,h]),$=(0,H.useCallback)(e=>u(e),[u]);return k?(0,U.jsx)(`div`,{className:`flex h-full items-center justify-center`,children:(0,U.jsx)(`div`,{className:`h-6 w-6 animate-spin rounded-full border-2 border-[var(--border-base)] border-t-[var(--primary-base)]`,role:`status`,"aria-label":`Loading apps`})}):A?(0,U.jsxs)(`div`,{className:`flex h-full flex-col items-center justify-center gap-4 px-4`,children:[(0,U.jsx)(`p`,{className:`text-body-medium-lighter text-[var(--content-tertiary)]`,children:A}),(0,U.jsx)(`button`,{type:`button`,className:`rounded-lg bg-[var(--primary-base)] px-4 py-2 text-body-medium-default text-[var(--content-inset)] transition-colors hover:bg-[var(--primary-hover)]`,onClick:()=>window.location.reload(),children:`Retry`})]}):h.length===0&&_.length===0?(0,U.jsx)(q,{fileInputRef:V,isImporting:G,onImportBundle:Y,onNewConversation:i?()=>i():void 0}):(0,U.jsxs)(`div`,{className:`flex h-full flex-col overflow-hidden`,children:[(0,U.jsxs)(`div`,{className:`mb-4 flex shrink-0 items-center justify-between gap-4`,children:[n?(0,U.jsx)(`h1`,{className:`text-title-large text-[var(--content-default)]`,children:n}):(0,U.jsx)(`span`,{}),(0,U.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,U.jsx)(`input`,{ref:V,type:`file`,accept:`.vellum`,className:`hidden`,onChange:Y}),(0,U.jsxs)(o,{variant:`outlined`,size:`regular`,onClick:()=>V.current?.click(),disabled:G,children:[G?(0,U.jsx)(`div`,{className:`h-4 w-4 animate-spin rounded-full border-2 border-current border-t-transparent`}):(0,U.jsx)(N,{size:14}),(0,U.jsx)(`span`,{className:`ml-1.5`,children:`Import`})]})]})]}),(0,U.jsx)(`div`,{className:`mb-6 shrink-0`,children:(0,U.jsx)(d,{fullWidth:!0,type:`text`,placeholder:`Search your library`,value:E,onChange:e=>O(e.target.value),leftIcon:(0,U.jsx)(D,{size:16})})}),(0,U.jsx)(`div`,{className:`flex-1 overflow-y-auto`,children:y.length===0&&T.length===0?(0,U.jsxs)(`div`,{className:`flex flex-col items-center justify-center py-16`,children:[(0,U.jsx)(D,{size:32,className:`mb-4 text-[var(--content-tertiary)]`}),(0,U.jsxs)(`p`,{className:`text-body-medium-lighter text-[var(--content-tertiary)]`,children:[`No apps or documents matched “`,E,`”`]})]}):(0,U.jsxs)(`div`,{className:`flex flex-col gap-8`,children:[(0,U.jsx)(X,{title:`Pinned`,apps:b,assistantId:e,pinnedAppIds:p,onOpen:s,onPin:$,onDelete:F,onDeploy:l?Q:void 0}),(0,U.jsx)(X,{title:`Recents`,apps:S,assistantId:e,pinnedAppIds:p,onOpen:s,onPin:$,onDelete:F,onDeploy:l?Q:void 0}),T.length>0?(0,U.jsxs)(`section`,{children:[(0,U.jsx)(`h2`,{className:`mb-4 text-body-small-emphasised text-[color:var(--content-secondary)]`,children:`Documents`}),(0,U.jsx)(`div`,{className:`grid grid-cols-[repeat(auto-fill,minmax(max(220px,calc((100%-6rem)/5)),1fr))] gap-6`,children:T.map(e=>(0,U.jsx)(K,{document:e,onOpen:e=>{a&&a(e)}},e.surfaceId))})]}):null]})}),(0,U.jsx)(R,{assistantId:e,assistantName:t,onStartConversation:i}),(0,U.jsx)(W,{app:j,isDeleting:I,onConfirm:z,onCancel:B})]})}function $(){let e=z(),t=n();return(0,U.jsx)(B,{children:(0,U.jsx)(Q,{assistantId:e,title:`Library`,onNewConversation:(0,H.useCallback)(e=>{t(b.assistant)},[t]),onOpenDocument:(0,H.useCallback)(e=>{t(b.document(e))},[t]),onOpenApp:(0,H.useCallback)(e=>{t(b.library.app(e))},[t])})})}export{$ as LibraryPage};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{o as e}from"./chunk-jRWAZmH_.js";import{t}from"./react-DJZBPgpf.js";import{r as n}from"./chunk-5KNZJZUH-B4b1m-Ya.js";import{n as r}from"./QueryClientProvider-DNHWXaGq.js";import{t as i}from"./useQuery-D2zf6Uhu.js";import{t as a}from"./useMutation-BuofVRHk.js";import{t as o}from"./jsx-runtime-CVSDxk6A.js";import{t as s}from"./menu-B79-l6IU.js";import{t as c}from"./notice-CF2pptne.js";import{n as l,r as u,t as d}from"./panel-item-FzMfzMJA.js";import{t as f}from"./input-Cu3PPVCq.js";import{t as p}from"./createLucideIcon-D6d6iDdi.js";import{t as m}from"./bell-C7RL04h4.js";import{t as h}from"./loader-circle-BSAFLoPH.js";import{i as g}from"./routes-DMbyM_oF.js";import{n as _}from"./use-is-mobile-D_xrnINF.js";import{Ai as v,Cn as y,Dn as b,En as x,Sn as S,Tn as C,da as w,dt as T,ft as E,po as D,ut as O,wn as k,xn as A}from"./index-DM63H2B6.js";import{r as j}from"./format-date-lYqfuFdi.js";var M=p(`bell-off`,[[`path`,{d:`M10.268 21a2 2 0 0 0 3.464 0`,key:`vwvbt9`}],[`path`,{d:`M17 17H4a1 1 0 0 1-.74-1.673C4.59 13.956 6 12.499 6 8a6 6 0 0 1 .258-1.742`,key:`178tsu`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}],[`path`,{d:`M8.668 3.01A6 6 0 0 1 18 8c0 2.687.77 4.653 1.707 6.05`,key:`1hqiys`}]]),N=p(`check-check`,[[`path`,{d:`M18 6 7 17l-5-5`,key:`116fxf`}],[`path`,{d:`m22 10-7.5 7.5L13 16`,key:`ke71qq`}]]),P=e(t(),1);function F(e){e.invalidateQueries({queryKey:y()}),e.invalidateQueries({queryKey:b()})}function I(e){return e.snoozed_until?new Date(e.snoozed_until)>new Date:!1}var L=[{label:`1 hour`,hours:1},{label:`4 hours`,hours:4},{label:`24 hours`,hours:24},{label:`1 week`,hours:168}],R=o();function z({notificationId:e,currentlySnoozed:t,children:n}){let i=r(),o=a(x()),c=_(),[u,f]=(0,P.useState)(!1),p=()=>F(i),m=async t=>{let n=new Date(new Date().getTime()+t*60*60*1e3).toISOString();await o.mutateAsync({path:{id:e},body:{snoozed_until:n}}),p()},h=async()=>{await o.mutateAsync({path:{id:e},body:{snoozed_until:null}}),p()};return c?(0,R.jsxs)(l.Root,{open:u,onOpenChange:f,children:[(0,R.jsx)(l.Trigger,{asChild:!0,children:n}),(0,R.jsxs)(l.Content,{children:[(0,R.jsx)(l.Header,{children:(0,R.jsx)(l.Title,{children:`Snooze until…`})}),(0,R.jsxs)(l.Body,{children:[L.map(({label:e,hours:t})=>(0,R.jsx)(d,{label:e,onSelect:()=>{o.isPending||(f(!1),m(t))}},e)),t&&(0,R.jsx)(d,{label:`Clear snooze`,onSelect:()=>{o.isPending||(f(!1),h())}})]})]})]}):(0,R.jsxs)(s.Root,{open:u,onOpenChange:f,children:[(0,R.jsx)(s.Trigger,{children:n}),(0,R.jsxs)(s.Content,{align:`start`,className:`min-w-[12rem]`,children:[(0,R.jsx)(s.Label,{children:`Snooze until…`}),L.map(({label:e,hours:t})=>(0,R.jsx)(s.Item,{disabled:o.isPending,onSelect:()=>void m(t),children:e},e)),t&&(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(s.Separator,{}),(0,R.jsx)(s.Item,{disabled:o.isPending,onSelect:()=>void h(),children:`Clear snooze`})]})]})]})}function B({existingRules:e,onClose:t,onPauseCreated:n,onPauseDeleted:i,hideTitle:o=!1}){let s=r(),c=a(k()),l=a(C()),[u,d]=(0,P.useState)(``),p=()=>F(s),m=async()=>{let e=new Date(new Date().getTime()+365*24*60*60*1e3).toISOString();n(await c.mutateAsync({body:{notification_type:`alert`,dedupe_key_prefix:``,reason:u.trim()||`User requested pause`,expires_at:e}})),p(),t()},g=async e=>{await l.mutateAsync({path:{rule_id:e}}),i(e),p(),t()},_=c.isPending||l.isPending;return(0,R.jsxs)(`div`,{children:[!o&&(0,R.jsx)(`p`,{className:`mb-2 text-body-medium-default text-[var(--content-default)]`,children:`Pause alerts`}),e.length>0?(0,R.jsxs)(`div`,{className:`space-y-2`,children:[(0,R.jsx)(`p`,{className:`text-body-small-default text-[var(--content-secondary)]`,children:`Active pause rules:`}),e.map(e=>(0,R.jsxs)(`div`,{className:`flex items-center justify-between rounded-md border border-[var(--border-base)] bg-[var(--surface-base)] px-2 py-2`,children:[(0,R.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,R.jsx)(`p`,{className:`truncate text-body-small-default text-[var(--content-default)]`,children:e.reason||`All alerts paused`}),e.expires_at&&(0,R.jsxs)(`p`,{className:`text-body-small-default text-[var(--content-secondary)]`,children:[`Expires `,j(e.expires_at)]})]}),(0,R.jsx)(`button`,{type:`button`,onClick:()=>void g(e.id),disabled:_,className:`ml-2 shrink-0 cursor-pointer rounded px-2 py-1 text-body-small-default text-[var(--system-negative-strong)] transition-opacity hover:opacity-80 disabled:cursor-not-allowed disabled:opacity-50`,children:`Resume`})]},e.id))]}):(0,R.jsxs)(`div`,{className:`space-y-2`,children:[(0,R.jsx)(`p`,{className:`text-body-small-default text-[var(--content-secondary)]`,children:`Temporarily mute all alert notifications.`}),(0,R.jsx)(f,{type:`text`,value:u,onChange:e=>d(e.target.value),placeholder:`Reason (optional)`}),(0,R.jsx)(`button`,{type:`button`,onClick:()=>void m(),disabled:_,className:`w-full cursor-pointer rounded-md bg-[var(--primary-base)] px-3 py-1.5 text-body-medium-default text-[var(--content-inset)] transition-opacity hover:opacity-90 disabled:cursor-not-allowed disabled:opacity-50`,children:c.isPending?(0,R.jsxs)(`span`,{className:`flex items-center justify-center gap-2`,children:[(0,R.jsx)(h,{className:`h-3 w-3 animate-spin`}),`Pausing…`]}):`Pause all alerts`})]})]})}function V({notification:e,onAck:t,isAcking:n}){let r=e.notification_type===`alert`,i=I(e),a=!e.is_read;return(0,R.jsxs)(`div`,{className:`relative rounded-lg border border-[var(--border-base)] p-4`,style:{background:e.is_resolved?`var(--surface-base)`:`var(--surface-lift)`,opacity:e.is_resolved?.75:1},children:[(0,R.jsx)(`div`,{className:`flex items-start gap-3`,children:(0,R.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col items-start gap-1`,children:[(0,R.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[a&&!e.is_resolved&&(0,R.jsx)(`span`,{"aria-hidden":!0,className:`h-2 w-2 shrink-0 rounded-full bg-[var(--primary-base)]`}),r&&(0,R.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded-full bg-[color-mix(in_oklab,var(--system-negative-strong)_14%,transparent)] px-2 py-0.5 text-body-small-default text-[var(--system-negative-strong)]`,children:[(0,R.jsx)(v,{className:`h-3 w-3`}),`Alert`]}),i&&(0,R.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded-full bg-[var(--surface-base)] px-2 py-0.5 text-body-small-default text-[var(--content-secondary)]`,children:[(0,R.jsx)(w,{className:`h-3 w-3`}),`Snoozed`]}),e.is_resolved&&(0,R.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded-full bg-[color-mix(in_oklab,var(--system-positive-strong)_14%,transparent)] px-2 py-0.5 text-body-small-default text-[var(--system-positive-strong)]`,children:[(0,R.jsx)(D,{className:`h-3 w-3`}),`Resolved`]})]}),(0,R.jsx)(`h3`,{className:`text-body-medium-default leading-tight`,style:{color:e.is_resolved?`var(--content-secondary)`:`var(--content-default)`},children:e.title}),e.body&&(0,R.jsx)(`p`,{className:`text-body-small-default leading-relaxed text-[var(--content-secondary)]`,children:e.body})]})}),(0,R.jsxs)(`div`,{className:`mt-3 flex items-center gap-3 text-body-small-default text-[var(--content-secondary)]`,children:[(0,R.jsxs)(`span`,{children:[`Last seen `,j(e.last_seen_at)]}),e.occurrence_count>1&&(0,R.jsxs)(`span`,{children:[`· `,e.occurrence_count,`× occurrences`]})]}),!e.is_resolved&&(0,R.jsxs)(`div`,{className:`mt-3 flex items-center gap-2 border-t border-[var(--border-base)] pt-3`,children:[(0,R.jsxs)(`button`,{type:`button`,onClick:()=>t(e.id,a),disabled:n,className:`flex cursor-pointer items-center gap-1.5 rounded-md px-3 py-1.5 text-body-small-default transition-opacity hover:opacity-80 disabled:cursor-not-allowed disabled:opacity-50`,style:{background:a?`var(--primary-base)`:`var(--surface-base)`,color:a?`var(--content-inset)`:`var(--content-secondary)`},children:[n?(0,R.jsx)(h,{className:`h-3 w-3 animate-spin`}):(0,R.jsx)(D,{className:`h-3 w-3`}),a?`Mark as read`:`Mark as unread`]}),(0,R.jsx)(z,{notificationId:e.id,currentlySnoozed:i,children:(0,R.jsxs)(`button`,{type:`button`,className:`flex cursor-pointer items-center gap-1.5 rounded-md border border-[var(--border-base)] bg-[var(--surface-base)] px-3 py-1.5 text-body-small-default text-[var(--content-secondary)] transition-opacity hover:opacity-80`,children:[(0,R.jsx)(w,{className:`h-3 w-3`}),i?`Change snooze`:`Snooze`]})})]})]})}function H(){let e=E({platformHostedOnly:!0}),t=O(),o=T(),s=r(),d=_(),[f,p]=(0,P.useState)(`open`),[v,y]=(0,P.useState)(!1),[b,x]=(0,P.useState)([]),{data:C,isLoading:w,isError:D,refetch:k}=i({...S({query:{status:f}}),enabled:e===`full`&&t}),j=e===`full`&&o||(t?w:!1);(0,P.useEffect)(()=>{!t&&v&&y(!1)},[t,v]);let I=t?D:!1,L=t?C?.results??[]:[],z=L.filter(e=>!e.is_read&&!e.is_resolved),H=a(A()),[U,W]=(0,P.useState)(new Set),[G,K]=(0,P.useState)(!1),q=(0,P.useCallback)(()=>F(s),[s]),J=async(e,t)=>{W(t=>new Set(t).add(e));try{await H.mutateAsync({path:{id:e},body:{acknowledged:t}}),q()}finally{W(t=>{let n=new Set(t);return n.delete(e),n})}},Y=async()=>{if(!(z.length===0||G)){K(!0);try{await Promise.allSettled(z.map(e=>H.mutateAsync({path:{id:e.id},body:{acknowledged:!0}})))}finally{q(),K(!1)}}},X=(0,R.jsxs)(`button`,{type:`button`,className:`flex cursor-pointer items-center gap-1.5 rounded-md border border-[var(--border-base)] bg-[var(--surface-base)] px-3 py-1.5 text-body-small-default text-[var(--content-secondary)] transition-opacity hover:opacity-80`,title:`Pause alerts`,children:[(0,R.jsx)(M,{className:`h-3.5 w-3.5`}),`Pause alerts`]}),Z=(0,R.jsx)(B,{existingRules:b,onClose:()=>y(!1),onPauseCreated:e=>x(t=>[...t,e]),onPauseDeleted:e=>x(t=>t.filter(t=>t.id!==e))});return e===`gated`?(0,R.jsx)(n,{replace:!0,to:g.settings.general}):e===`disabled`?(0,R.jsxs)(`div`,{className:`space-y-4`,children:[(0,R.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,R.jsx)(m,{className:`h-5 w-5 text-[var(--content-secondary)]`}),(0,R.jsxs)(`div`,{className:`flex-1`,children:[(0,R.jsx)(`h2`,{className:`text-title-medium text-[var(--content-default)]`,children:`Notifications`}),(0,R.jsx)(`p`,{className:`text-body-medium-lighter text-[var(--content-secondary)]`,children:`Platform alerts and status notifications`})]})]}),(0,R.jsx)(c,{tone:`info`,children:`Log in to the Vellum platform to view notifications.`})]}):(0,R.jsxs)(`div`,{className:`space-y-4`,children:[(0,R.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,R.jsx)(m,{className:`h-5 w-5 text-[var(--content-secondary)]`}),(0,R.jsxs)(`div`,{className:`flex-1`,children:[(0,R.jsx)(`h2`,{className:`text-title-medium text-[var(--content-default)]`,children:`Notifications`}),(0,R.jsx)(`p`,{className:`text-body-medium-lighter text-[var(--content-secondary)]`,children:`Platform alerts and status notifications`})]}),t&&(d?(0,R.jsxs)(l.Root,{open:v,onOpenChange:y,children:[(0,R.jsx)(l.Trigger,{asChild:!0,children:X}),(0,R.jsxs)(l.Content,{children:[(0,R.jsx)(l.Header,{children:(0,R.jsx)(l.Title,{children:`Pause alerts`})}),(0,R.jsx)(l.Body,{children:(0,R.jsx)(B,{existingRules:b,onClose:()=>y(!1),onPauseCreated:e=>x(t=>[...t,e]),onPauseDeleted:e=>x(t=>t.filter(t=>t.id!==e)),hideTitle:!0})})]})]}):(0,R.jsxs)(u.Root,{open:v,onOpenChange:y,children:[(0,R.jsx)(u.Trigger,{asChild:!0,children:X}),(0,R.jsx)(u.Content,{align:`end`,className:`w-72`,children:Z})]}))]}),(0,R.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,R.jsx)(`div`,{className:`flex gap-1 rounded-md border border-[var(--border-base)] bg-[var(--surface-base)] p-1`,children:[`open`,`resolved`].map(e=>{let t=f===e;return(0,R.jsx)(`button`,{type:`button`,onClick:()=>p(e),className:`cursor-pointer rounded px-3 py-1 text-body-small-default capitalize transition-colors`,style:{background:t?`var(--surface-lift)`:`transparent`,color:t?`var(--content-default)`:`var(--content-secondary)`,boxShadow:t?`0 1px 2px rgba(0,0,0,0.08)`:void 0},children:e},e)})}),f===`open`&&z.length>1&&(0,R.jsxs)(`button`,{type:`button`,onClick:()=>void Y(),disabled:G,className:`ml-auto flex cursor-pointer items-center gap-1.5 rounded-md border border-[var(--border-base)] bg-transparent px-3 py-1.5 text-body-small-default text-[var(--content-secondary)] transition-opacity hover:opacity-80 disabled:cursor-not-allowed disabled:opacity-50`,children:[G?(0,R.jsx)(h,{className:`h-3 w-3 animate-spin`}):(0,R.jsx)(N,{className:`h-3 w-3`}),`Mark all as read (`,z.length,`)`]})]}),j?(0,R.jsxs)(`div`,{className:`flex items-center gap-2 py-6 text-body-medium-lighter text-[var(--content-secondary)]`,children:[(0,R.jsx)(h,{className:`h-4 w-4 animate-spin`}),`Loading notifications…`]}):I?(0,R.jsxs)(c,{tone:`error`,children:[`Failed to load notifications.`,` `,(0,R.jsx)(`button`,{type:`button`,onClick:()=>void k(),className:`cursor-pointer underline hover:no-underline`,children:`Retry`})]}):L.length===0?(0,R.jsxs)(`div`,{className:`flex flex-col items-center justify-center gap-2 py-12 text-center`,children:[(0,R.jsx)(`div`,{className:`flex h-12 w-12 items-center justify-center rounded-full bg-[var(--surface-base)]`,children:(0,R.jsx)(m,{className:`h-5 w-5 text-[var(--content-secondary)]`})}),(0,R.jsxs)(`p`,{className:`text-body-medium-default text-[var(--content-default)]`,children:[`No `,f,` notifications`]}),(0,R.jsx)(`p`,{className:`text-body-small-default text-[var(--content-secondary)]`,children:f===`open`?`You're all caught up!`:`Nothing to show here.`})]}):(0,R.jsx)(`div`,{className:`space-y-3`,children:L.map(e=>(0,R.jsx)(V,{notification:e,onAck:(e,t)=>void J(e,t),isAcking:U.has(e.id)},e.id))})]})}export{H as NotificationsPage};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as e}from"./chunk-5KNZJZUH-B4b1m-Ya.js";import{t}from"./jsx-runtime-CVSDxk6A.js";import{i as n}from"./routes-DMbyM_oF.js";var r=t();function i(){return(0,r.jsx)(e,{to:n.account.login,replace:!0})}export{i as PasswordResetPage};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{o as e}from"./chunk-jRWAZmH_.js";import{t}from"./react-DJZBPgpf.js";import{d as n}from"./chunk-5KNZJZUH-B4b1m-Ya.js";import{n as r}from"./QueryClientProvider-DNHWXaGq.js";import{t as i}from"./useQuery-D2zf6Uhu.js";import{t as a}from"./useMutation-BuofVRHk.js";import{t as o}from"./jsx-runtime-CVSDxk6A.js";import{t as s}from"./button-DdEh-9f_.js";import{t as c}from"./card-CL5iEMJO.js";import{t as l}from"./input-Cu3PPVCq.js";import{f as u,l as d,s as f,t as p}from"./resolved-assistants-store-ub66utfl.js";import{t as m}from"./is-electron-CavSPgmY.js";import{t as h}from"./loader-circle-BSAFLoPH.js";import{t as g}from"./pencil-BA9LOIzP.js";import{t as _}from"./x-BDqbYVtS.js";import{B as v,O as ee,V as y,a as b,i as x,n as S}from"./auth-store-oleg80LZ.js";import{t as C}from"./client.gen-BKAMS0D0.js";import{i as w}from"./routes-DMbyM_oF.js";import{t as T}from"./public-asset-Dx4la7Nv.js";import{A as E,F as te,Ft as D,Gn as O,I as k,Kn as A,L as j,Mt as ne,P as re,Un as M,Va as N,Wn as P,_ as F,_r as ie,do as I,et as L,fr as R,g as ae,h as oe,ht as se,k as z,mr as ce,po as B,tt as V,v as le}from"./index-DM63H2B6.js";import{t as H}from"./onboarding-layout-BIVa2BnX.js";import{c as ue,i as de,n as U,o as fe,r as pe,s as me,t as W}from"./step-indicator-dots-BjA1nnWA.js";import{t as he}from"./use-oauth-complete-deep-link-listener-DODuMYm6.js";var G=e(t(),1);async function ge(){try{let{data:e,response:t}=await C.get({url:`/v1/onboarding/recipe/`,throwOnError:!1});if(!t?.ok||!e)return null;let n=e;return typeof n.cohort!=`string`||!Array.isArray(n.tasks)||typeof n.tone!=`string`||typeof n.bootstrap_template!=`string`||typeof n.initial_message!=`string`||!Array.isArray(n.skills)||typeof n.skip_prechat!=`boolean`?null:{cohort:n.cohort,tasks:n.tasks,tone:n.tone,bootstrapTemplate:n.bootstrap_template,initialMessage:n.initial_message,skills:n.skills,skipPrechat:n.skip_prechat}}catch{return null}}var K=o(),_e=[{label:`Push notifications`,detail:`stay in the loop even when the browser is closed`},{label:`Biometric login`,detail:`Face ID & Touch ID for instant, secure access`},{label:`Native haptics`,detail:`tactile feedback that feels part of the device`},{label:`Home screen access`,detail:`launch your assistant with a single tap`}];function ve({onComplete:e}){function t(){F(),oe(),e()}return(0,K.jsx)(H,{showCreatureFooter:!1,children:(0,K.jsxs)(`div`,{className:`mx-auto flex min-h-screen w-full max-w-md flex-col items-center justify-center px-6 pb-40 text-center`,children:[(0,K.jsx)(`div`,{className:`mb-8 flex size-16 items-center justify-center rounded-2xl border`,style:{background:`var(--surface-overlay)`,borderColor:`var(--border-element)`,boxShadow:`0 1px 3px rgba(0,0,0,0.06), 0 4px 12px rgba(0,0,0,0.04)`,animation:`fadeInUp 0.3s ease-out both`},children:(0,K.jsxs)(`svg`,{width:`28`,height:`28`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.5`,strokeLinecap:`round`,strokeLinejoin:`round`,style:{color:`var(--content-default)`},"aria-hidden":!0,children:[(0,K.jsx)(`rect`,{x:`5`,y:`2`,width:`14`,height:`20`,rx:`3`}),(0,K.jsx)(`line`,{x1:`12`,y1:`18`,x2:`12`,y2:`18.01`})]})}),(0,K.jsx)(`p`,{className:`text-label-small-default mb-3 uppercase tracking-[0.2em]`,style:{color:`var(--content-tertiary)`,animation:`fadeInUp 0.3s ease-out 0.05s both`},children:`One more thing`}),(0,K.jsx)(`h1`,{className:`mb-3 text-3xl font-semibold tracking-tight`,style:{color:`var(--content-default)`,animation:`fadeInUp 0.3s ease-out 0.1s both`},children:`Your assistant, in your pocket.`}),(0,K.jsx)(`p`,{className:`text-body-medium-lighter mb-10 max-w-sm`,style:{color:`var(--content-secondary)`,animation:`fadeInUp 0.3s ease-out 0.15s both`},children:`The iOS app keeps your assistant a tap away — with push notifications, biometric login, and native haptics.`}),(0,K.jsx)(`div`,{className:`mb-10 w-full rounded-xl border px-5 py-4`,style:{background:`var(--surface-overlay)`,borderColor:`var(--border-element)`,animation:`fadeInUp 0.3s ease-out 0.2s both`},children:(0,K.jsx)(`ul`,{className:`space-y-4`,children:_e.map((e,t)=>(0,K.jsxs)(`li`,{className:`flex items-start gap-3`,style:{animation:`fadeInUp 0.3s ease-out ${.25+t*.05}s both`},children:[(0,K.jsx)(`span`,{className:`mt-0.5 flex size-5 shrink-0 items-center justify-center rounded-full`,style:{background:`var(--system-positive-weak)`},children:(0,K.jsx)(B,{size:12,style:{color:`var(--system-positive-strong)`}})}),(0,K.jsxs)(`span`,{className:`text-left`,children:[(0,K.jsx)(`span`,{className:`text-body-medium-default`,style:{color:`var(--content-default)`},children:e.label}),(0,K.jsxs)(`span`,{className:`text-body-medium-lighter`,style:{color:`var(--content-tertiary)`},children:[` — `,e.detail]})]})]},e.label))})}),(0,K.jsxs)(`div`,{className:`flex w-full flex-col gap-2`,style:{animation:`fadeInUp 0.3s ease-out 0.45s both`},children:[(0,K.jsx)(s,{variant:`primary`,size:`regular`,fullWidth:!0,onClick:t,className:`h-11 text-base`,children:`Download on the App Store`}),(0,K.jsx)(s,{variant:`ghost`,size:`regular`,fullWidth:!0,onClick:e,className:`h-11 text-base`,children:`Continue in browser`})]})]})})}var q=`google`,ye=[{id:`gmail`,label:`Gmail`,logoSrc:T(`/images/integrations/gmail.svg`)},{id:`google-calendar`,label:`Google Calendar`,logoSrc:T(`/images/integrations/google-calendar.svg`)},{id:`google-drive`,label:`Google Drive`,logoSrc:T(`/images/integrations/google-drive.svg`)}];function be({assistantId:e,assistantName:t,onConnect:n,onSkip:i,onBack:o}){let c=m(),l=r(),u=ee(),d=(0,G.useRef)(null),f=(0,G.useRef)(null),p=(0,G.useRef)(null),g=(0,G.useRef)(null),_=(0,G.useRef)(null),v=(0,G.useRef)(null),y=(0,G.useRef)(null),[b,x]=(0,G.useState)(!1),S=(0,G.useCallback)(()=>{f.current=null,x(!1)},[]),C=(0,G.useCallback)(()=>{_.current&&=(window.removeEventListener(`message`,_.current),null),v.current&&=(window.removeEventListener(`storage`,v.current),null)},[]),T=(0,G.useCallback)(()=>{d.current&&!d.current.closed&&d.current.close(),d.current=null,p.current&&=(clearInterval(p.current),null),g.current&&=(clearTimeout(g.current),null)},[]),E=a({...D()});(0,G.useEffect)(()=>()=>{p.current&&clearInterval(p.current),g.current&&clearTimeout(g.current),d.current&&!d.current.closed&&d.current.close(),_.current&&window.removeEventListener(`message`,_.current),v.current&&window.removeEventListener(`storage`,v.current),y.current&&=(y.current(),null)},[]);let O=(0,G.useCallback)(async()=>{try{return(await l.fetchQuery({...ne({path:{assistant_id:e}}),staleTime:0})).find(e=>e.provider===q&&e.connected)??null}catch{return null}},[e,l]),A=(0,G.useCallback)(async()=>{T(),S(),n((await O())?.scopes_granted??[])},[S,T,O,n]),M=(0,G.useCallback)(e=>{e.type===`vellum:oauth-complete`&&(!f.current||e.requestId!==f.current.requestId||(e.oauthStatus===`connected`?A():(T(),S())))},[S,T,A]),N=(0,G.useCallback)(e=>{let t=f.current;if(!t)return;let n=re(e,window.location.origin,t.requestId);n&&M(n)},[M]),P=(0,G.useCallback)(e=>{let t=f.current;if(!t)return;let n=te(e,t.requestId);n&&(M(n),window.localStorage.removeItem(j(t.requestId)))},[M]);he((0,G.useCallback)(e=>{let t=f.current;t&&e.requestId===t.requestId&&M({type:`vellum:oauth-complete`,requestId:e.requestId,oauthStatus:e.oauthStatus,oauthProvider:e.oauthProvider,oauthCode:e.oauthCode})},[M]));let F=(0,G.useCallback)(()=>{let t=crypto.randomUUID();if(C(),_.current=N,v.current=P,u){x(!0),f.current={requestId:t},E.mutate({path:{assistant_id:e,provider:q},body:{requested_scopes:[],redirect_after_connect:`${w.account.oauth.popupComplete}?requestId=${t}&native=1`}},{onSuccess(e){L(e.connect_url)},onError(){S()}}),window.addEventListener(`message`,N),window.addEventListener(`storage`,P),y.current&&y.current();let n=V(()=>{if(!f.current){n(),y.current=null;return}(async()=>{let e=await O();f.current&&(e?await A():S(),C(),n(),y.current=null)})()});y.current=n;return}let n=window.open(``,`_blank`,`width=500,height=600`);if(n===null){C();return}d.current=n,x(!0),f.current={requestId:t},window.addEventListener(`message`,N),window.addEventListener(`storage`,P),p.current=setInterval(()=>{d.current&&d.current.closed&&f.current&&!g.current&&(g.current=setTimeout(async()=>{g.current=null;let e=f.current;if(!e)return;let t=window.localStorage.getItem(j(e.requestId));if(t)try{let n=JSON.parse(t);if(k(n,e.requestId)){M(n),window.localStorage.removeItem(j(e.requestId)),C();return}}catch{}let n=await O();f.current&&(n?await A():(T(),S()),C())},1e3))},100),E.mutate({path:{assistant_id:e,provider:q},body:{requested_scopes:[],redirect_after_connect:`${w.account.oauth.popupComplete}?requestId=${t}`}},{onSuccess(e){d.current&&!d.current.closed?d.current.location.href=e.connect_url:f.current&&(T(),S(),C())},onError(){T(),S(),C()}})},[e,S,T,O,M,N,P,A,u,C,E]),ie=t||`your assistant`,R=t||`Your assistant`;return(0,K.jsx)(H,{showCreatureFooter:!1,children:(0,K.jsxs)(`div`,{className:`mx-auto flex w-full max-w-md flex-col items-center ${c?`px-8 pt-7 pb-4 electron-prechat-type`:`px-6 pt-12 pb-40`} text-[var(--content-default)]`,children:[(0,K.jsxs)(`div`,{className:`grid w-full grid-cols-[auto_1fr_auto] items-center`,style:{animation:`fadeInUp 0.3s ease-out 0.1s both`},children:[(0,K.jsx)(`button`,{type:`button`,onClick:o,"aria-label":`Back`,className:`flex h-8 w-8 cursor-pointer items-center justify-center rounded-md text-[var(--content-secondary)] transition-colors hover:bg-[var(--surface-base)]`,children:(0,K.jsx)(I,{className:`h-4 w-4`})}),(0,K.jsx)(`h1`,{className:`text-center ${c?`text-title-large`:`text-3xl font-semibold tracking-tight`}`,children:`Connect Google`}),(0,K.jsx)(`div`,{"aria-hidden":`true`,className:`h-8 w-8`})]}),(0,K.jsx)(`p`,{className:`mt-4 text-center text-body-medium-lighter text-[var(--content-secondary)]`,style:{animation:`fadeInUp 0.3s ease-out 0.15s both`},children:`If you use Google, ${ie} can use Gmail, Calendar, and Drive with your permission.`}),(0,K.jsx)(`div`,{className:`mt-6 flex items-stretch justify-center gap-3`,style:{animation:`fadeInUp 0.3s ease-out 0.2s both`},children:ye.map(e=>(0,K.jsxs)(`div`,{className:`flex w-24 flex-col items-center gap-2.5 rounded-2xl bg-[var(--surface-lift)] px-3 pb-3 pt-4`,children:[(0,K.jsx)(`img`,{src:e.logoSrc,alt:``,width:28,height:28,className:`h-7 w-7 object-contain`,loading:`eager`}),(0,K.jsx)(`span`,{className:`text-center text-xs leading-tight text-[var(--content-tertiary)]`,children:e.label})]},e.id))}),(0,K.jsx)(`p`,{className:`mt-8 text-center text-body-medium-lighter text-[var(--content-secondary)]`,style:{animation:`fadeInUp 0.3s ease-out 0.25s both`},children:`${R} will never send email, change calendar events, or edit files without your permission. You can disconnect at any time.`}),(0,K.jsxs)(`div`,{className:`mt-8 flex w-full flex-col gap-2`,style:{animation:`fadeInUp 0.3s ease-out 0.35s both`},children:[(0,K.jsx)(s,{variant:`primary`,size:`regular`,fullWidth:!0,onClick:F,disabled:b||E.isPending,className:`${c?`h-9`:`h-11 text-base`}`,children:b||E.isPending?(0,K.jsxs)(`span`,{className:`flex items-center justify-center gap-2`,children:[(0,K.jsx)(h,{className:`h-4 w-4 animate-spin`,"aria-hidden":!0}),`Waiting for authorization...`]}):`Connect Google`}),(0,K.jsx)(s,{variant:`ghost`,size:`regular`,fullWidth:!0,onClick:i,disabled:b||E.isPending,className:`${c?`h-9`:`h-11 text-base`}`,children:`Skip for now`})]})]})})}var xe=[{id:`grounded`,label:`Grounded`,descriptor:`Calm and precise`,tagline:`Measured. No filler.`,names:[`Penn`,`Sage`,`Atlas`,`Orion`,`Reed`,`Quill`]},{id:`warm`,label:`Warm`,descriptor:`Warm and easy`,tagline:`Friendly and casual.`,names:[`Kit`,`Remy`,`Wren`,`Milo`,`Fenn`,`Cleo`]},{id:`energetic`,label:`Energetic`,descriptor:`Fast and direct`,tagline:`Brief. To the point.`,names:[`Nova`,`Ember`,`Cade`,`Lark`,`Vela`,`Ziggy`]},{id:`poetic`,label:`Poetic`,descriptor:`Quiet and observant`,tagline:`Listens, then replies.`,names:[`Luna`,`Iris`,`Vesper`,`Lyra`,`Juno`,`Ada`]}],Se=6;function Ce(){return xe.flatMap(e=>e.names)}function we(){let e=Ce(),t=Math.min(Se,e.length);for(let n=0;n<t;n+=1){let t=n+Math.floor(Math.random()*(e.length-n)),r=e[n];e[n]=e[t],e[t]=r}return e.slice(0,t)}function Te({userName:e,assistantName:t,selectedGroupId:n,displayedAssistantNames:r,onUserNameChange:i,onAssistantNameChange:a,onGroupChange:o,onBack:c,onComplete:u,onSkip:d}){let f=m();return(0,K.jsx)(H,{showCreatureFooter:!1,children:(0,K.jsxs)(`div`,{className:`mx-auto flex w-full max-w-md flex-col items-center ${f?`px-8 pt-11 pb-4 electron-prechat-type`:`px-6 pt-12 pb-40`} text-[var(--content-default)]`,children:[(0,K.jsxs)(`div`,{className:`grid w-full items-center ${c?`grid-cols-[auto_1fr_auto]`:``}`,style:{animation:`fadeInUp 0.3s ease-out 0.1s both`},children:[c?(0,K.jsx)(`button`,{type:`button`,onClick:c,"aria-label":`Back`,className:`flex h-8 w-8 cursor-pointer items-center justify-center rounded-md text-[var(--content-secondary)] transition-colors hover:bg-[var(--surface-base)]`,children:(0,K.jsx)(I,{className:`h-4 w-4`})}):null,(0,K.jsx)(`h1`,{className:`text-center ${f?`text-title-large`:`text-3xl font-semibold tracking-tight`}`,children:`Let's get to know each other.`}),c?(0,K.jsx)(`div`,{"aria-hidden":`true`,className:`h-8 w-8`}):null]}),(0,K.jsx)(`p`,{className:`mt-2 text-center text-body-medium-lighter text-[var(--content-secondary)]`,style:{animation:`fadeInUp 0.3s ease-out 0.15s both`},children:`You can change these any time.`}),(0,K.jsxs)(`div`,{className:`${f?`mt-6`:`mt-8`} flex w-full flex-col ${f?`gap-4`:`gap-6`}`,style:{animation:`fadeInUp 0.3s ease-out 0.3s both`},children:[(0,K.jsx)(l,{label:`Your name`,placeholder:`Your name`,value:e,onChange:e=>i(e.target.value),fullWidth:!0}),(0,K.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,K.jsx)(l,{label:`What should I go by?`,placeholder:`Assistant name`,value:t,onChange:e=>a(e.target.value),fullWidth:!0}),(0,K.jsx)(`p`,{className:`text-body-small-default text-[var(--content-tertiary)]`,children:`A few to try`}),(0,K.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:r.map(e=>{let n=e===t;return(0,K.jsx)(`button`,{type:`button`,onClick:()=>a(e),"aria-pressed":n,className:`cursor-pointer rounded-full border px-3 py-1 text-label-small-default transition-colors ${n?`border-[var(--primary-base)] bg-[var(--primary-base)] text-[var(--content-inset)]`:`border-[var(--border-element)] bg-[var(--surface-lift)] text-[var(--content-secondary)] hover:bg-[var(--surface-base)]`}`,children:e},e)})})]}),(0,K.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,K.jsx)(`p`,{className:`text-body-small-default text-[var(--content-secondary)]`,children:`Pick a vibe`}),(0,K.jsx)(`div`,{className:`grid grid-cols-2 gap-2`,children:xe.map(e=>(0,K.jsx)(Ee,{group:e,isActive:n===e.id,onToggle:()=>o(n===e.id?null:e.id)},e.id))})]})]}),(0,K.jsxs)(`div`,{className:`mt-8 flex w-full flex-col gap-2`,style:{animation:`fadeInUp 0.3s ease-out 0.3s both`},children:[(0,K.jsx)(s,{variant:`primary`,size:`regular`,fullWidth:!0,onClick:u,className:`${f?`h-9`:`h-11 text-base`}`,children:`Let's go`}),(0,K.jsx)(s,{variant:`ghost`,size:`regular`,fullWidth:!0,onClick:d,className:`${f?`h-9`:`h-11 text-base`}`,children:`Skip`})]})]})})}function Ee({group:e,isActive:t,onToggle:n}){return(0,K.jsxs)(`button`,{type:`button`,onClick:n,"aria-pressed":t,"aria-label":`${e.label}, ${e.descriptor}`,className:`flex cursor-pointer flex-col items-start gap-0.5 rounded-lg border p-3 text-left transition-colors ${t?`border-[var(--primary-base)] bg-[var(--primary-base)] text-[var(--content-inset)]`:`border-[var(--border-element)] bg-[var(--surface-lift)] hover:bg-[var(--surface-base)]`}`,children:[(0,K.jsx)(`span`,{className:`text-body-medium-default ${t?`text-[var(--content-inset)]`:`text-[var(--content-default)]`}`,children:e.descriptor}),(0,K.jsx)(`span`,{className:`text-body-small-default ${t?`text-[var(--content-inset)] opacity-60`:`text-[var(--content-tertiary)]`}`,children:e.tagline})]})}function De({userName:e,assistantName:t,displayedAssistantNames:n,onUserNameChange:r,onAssistantNameChange:i,onBack:a,onContinue:o,onSkip:c,currentStep:u,totalSteps:d}){return(0,K.jsx)(H,{showCreatureFooter:!1,children:(0,K.jsxs)(`div`,{className:`mx-auto flex min-h-screen w-full max-w-md flex-col px-6 pb-40 text-[var(--content-default)]`,children:[(0,K.jsxs)(`div`,{className:`grid w-full grid-cols-[auto_1fr_auto] items-center pb-4`,style:{paddingTop:`calc(var(--safe-area-inset-top, env(safe-area-inset-top, 0px)) + 1rem)`,animation:`fadeInUp 0.3s ease-out 0.1s both`},children:[a?(0,K.jsx)(s,{variant:`ghost`,size:`compact`,iconOnly:(0,K.jsx)(I,{}),onClick:a,"aria-label":`Back`}):(0,K.jsx)(`div`,{"aria-hidden":`true`,className:`h-8 w-8`}),(0,K.jsx)(`div`,{className:`flex justify-center`,children:(0,K.jsx)(W,{current:u,total:d})}),(0,K.jsx)(`div`,{"aria-hidden":`true`,className:`h-8 w-8`})]}),(0,K.jsxs)(`div`,{className:`flex flex-1 flex-col items-center pt-4`,children:[(0,K.jsx)(`h1`,{className:`text-center text-3xl font-semibold tracking-tight`,style:{animation:`fadeInUp 0.3s ease-out 0.1s both`},children:`Let's get to know each other.`}),(0,K.jsx)(`p`,{className:`mt-2 text-center text-body-medium-lighter text-[var(--content-secondary)]`,style:{animation:`fadeInUp 0.3s ease-out 0.15s both`},children:`You can change these any time.`}),(0,K.jsxs)(`div`,{className:`mt-8 flex w-full flex-col gap-6`,style:{animation:`fadeInUp 0.3s ease-out 0.3s both`},children:[(0,K.jsx)(l,{label:`Your name`,placeholder:`Your name`,value:e,onChange:e=>r(e.target.value),fullWidth:!0}),(0,K.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,K.jsx)(l,{label:`What should I go by?`,placeholder:`Assistant name`,value:t,onChange:e=>i(e.target.value),fullWidth:!0}),(0,K.jsx)(`p`,{className:`text-body-small-default text-[var(--content-tertiary)]`,children:`A few to try`}),(0,K.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:n.map(e=>{let n=e===t;return(0,K.jsx)(`button`,{type:`button`,onClick:()=>i(e),"aria-pressed":n,className:`cursor-pointer rounded-full border px-3 py-1 text-label-small-default transition-colors ${n?`border-[var(--primary-base)] bg-[var(--primary-base)] text-[var(--content-inset)]`:`border-[var(--border-element)] bg-[var(--surface-lift)] text-[var(--content-secondary)] hover:bg-[var(--surface-base)]`}`,children:e},e)})})]})]})]}),(0,K.jsxs)(`div`,{className:`flex w-full flex-col gap-2 pb-4`,style:{animation:`fadeInUp 0.3s ease-out 0.3s both`},children:[(0,K.jsx)(s,{variant:`primary`,size:`regular`,fullWidth:!0,onClick:o,className:`h-11 text-base`,children:`Continue`}),(0,K.jsx)(s,{variant:`ghost`,size:`regular`,fullWidth:!0,onClick:c,className:`h-11 text-base`,children:`Skip`})]})]})})}var Oe=[{id:`chatgpt`,label:`ChatGPT`,logoSrc:T(`/images/prior-assistants/chatgpt.svg`)},{id:`claude`,label:`Claude`,logoSrc:T(`/images/prior-assistants/claude.svg`)},{id:`openclaw`,label:`OpenClaw`,logoSrc:T(`/images/prior-assistants/openclaw.png`)},{id:`hermes`,label:`Hermes`,logoSrc:T(`/images/prior-assistants/hermes.png`)},{id:`manus`,label:`Manus`,logoSrc:T(`/images/prior-assistants/manus.svg`)},{id:`gemini`,label:`Gemini`,logoSrc:T(`/images/prior-assistants/gemini.svg`)},{id:`copilot`,label:`Copilot`,logoSrc:T(`/images/prior-assistants/copilot.svg`)}];function ke({selectedAssistants:e,onChange:t,onBack:n,onContinue:r,onSkip:i}){let a=m(),[o,u]=(0,G.useState)(()=>je(e)),[d,f]=(0,G.useState)(()=>o.length>0),p=(0,G.useRef)(Me(e));(0,G.useEffect)(()=>{let t=Me(e);if(t===p.current)return;let n=je(e);u(n),f(e=>e||n.length>0),p.current=t},[e]),(0,G.useEffect)(()=>{let n=new Set([...e].filter(e=>!e.startsWith(`other:`))),r=new Set;for(let e of o.split(`,`)){let t=e.trim();t&&(r.has(t)||(r.add(t),n.add(`other:${t}`)))}Ae(n,e)||(p.current=Me(n),t(n))},[o]);let h=n=>{let r=new Set(e);r.has(n)?r.delete(n):r.add(n),t(r)},v=(0,G.useMemo)(()=>{let e=new Set;return o.split(`,`).map(e=>e.trim()).filter(t=>!t||e.has(t)?!1:(e.add(t),!0))},[o]),ee=e.size===0?`Continue`:`Continue · ${e.size} selected`;return(0,K.jsx)(H,{showCreatureFooter:!1,children:(0,K.jsxs)(`div`,{className:`mx-auto flex w-full max-w-2xl flex-col items-center ${a?`px-8 pt-7 pb-4 electron-prechat-type`:`px-6 pt-12 pb-40`} text-[var(--content-default)]`,children:[(0,K.jsxs)(`div`,{className:`grid w-full items-center grid-cols-[auto_1fr_auto]`,style:{animation:`fadeInUp 0.3s ease-out 0.1s both`},children:[(0,K.jsx)(`button`,{type:`button`,onClick:n,"aria-label":`Back`,className:`flex h-8 w-8 cursor-pointer items-center justify-center rounded-md text-[var(--content-secondary)] transition-colors hover:bg-[var(--surface-base)]`,children:(0,K.jsx)(I,{className:`h-4 w-4`})}),(0,K.jsx)(`h1`,{className:`text-center ${a?`text-title-large`:`text-3xl font-semibold tracking-tight`}`,children:`Have you used any of these?`}),(0,K.jsx)(`div`,{"aria-hidden":`true`,className:`h-8 w-8`})]}),(0,K.jsx)(`p`,{className:`${a?`mt-3`:`mt-4`} text-center text-body-medium-lighter text-[var(--content-${a?`secondary`:`tertiary`})]`,style:{animation:`fadeInUp 0.3s ease-out 0.15s both`},children:`If you've built anything with another assistant, I can help you bring it over.`}),(0,K.jsxs)(`div`,{className:`${a?`mt-4`:`mt-8`} grid w-full grid-cols-2 gap-2 sm:grid-cols-3 md:grid-cols-4`,style:{animation:`fadeInUp 0.3s ease-out 0.2s both`},children:[Oe.map(t=>(0,K.jsx)(Ne,{assistant:t,selected:e.has(t.id),onToggle:()=>h(t.id)},t.id)),d?null:(0,K.jsx)(Pe,{onClick:()=>f(!0)})]}),d?(0,K.jsx)(c,{padding:`md`,className:`mt-3 w-full border-[var(--primary-base)] bg-[color-mix(in_srgb,var(--primary-base)_8%,transparent)]`,children:(0,K.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,K.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,K.jsx)(g,{className:`h-3.5 w-3.5 text-[var(--content-secondary)]`,"aria-hidden":`true`}),(0,K.jsx)(`span`,{className:`text-body-medium-default prechat-md-regular text-[var(--content-default)]`,children:`Something else`}),(0,K.jsx)(`button`,{type:`button`,onClick:()=>{f(!1),u(``)},"aria-label":`Dismiss custom assistants`,className:`ml-auto inline-flex h-6 w-6 cursor-pointer items-center justify-center rounded-md text-[var(--content-tertiary)] hover:bg-[var(--surface-base)]`,children:(0,K.jsx)(_,{className:`h-3 w-3`,"aria-hidden":`true`})})]}),(0,K.jsx)(l,{"aria-label":`Other assistants`,placeholder:`e.g. Perplexity, Poe, Character.AI...`,value:o,onChange:e=>u(e.target.value),helperText:`Separate multiple assistants with commas`,fullWidth:!0}),v.length>0?(0,K.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:v.map(e=>(0,K.jsx)(`span`,{className:`rounded-full bg-[var(--primary-base)] px-3 py-1 text-label-small-default text-[var(--content-inset)]`,children:e},e))}):null]})}):null,(0,K.jsxs)(`div`,{className:`${a?`mt-6`:`mt-8`} flex w-full flex-col gap-2`,style:{animation:`fadeInUp 0.3s ease-out 0.3s both`},children:[(0,K.jsx)(s,{variant:`primary`,size:`regular`,fullWidth:!0,disabled:e.size===0,onClick:r,className:`${a?`h-9`:`h-11 text-base`}`,children:ee}),(0,K.jsx)(s,{variant:`ghost`,size:`regular`,fullWidth:!0,onClick:i,className:`${a?`h-9`:`h-11 text-base`}`,children:`I haven't used any`})]})]})})}function Ae(e,t){if(e.size!==t.size)return!1;for(let n of e)if(!t.has(n))return!1;return!0}function je(e){return[...e].filter(e=>e.startsWith(`other:`)).map(e=>e.slice(6)).sort().join(`, `)}function Me(e){return[...e].filter(e=>e.startsWith(`other:`)).sort().join(`|`)}function Ne({assistant:e,selected:t,onToggle:n}){return(0,K.jsxs)(`button`,{type:`button`,onClick:n,"aria-pressed":t,"aria-label":e.label,className:`relative flex h-[88px] w-full cursor-pointer flex-col items-center justify-center gap-1.5 rounded-lg border p-2 transition-colors ${t?`border-[var(--primary-base)] bg-[color-mix(in_srgb,var(--primary-base)_10%,transparent)]`:`border-[var(--border-element)] bg-[var(--surface-lift)] hover:bg-[var(--surface-base)]`}`,children:[(0,K.jsx)(J,{assistant:e,size:32}),(0,K.jsx)(`span`,{className:`line-clamp-2 text-center text-label-medium-default text-[var(--content-default)]`,children:e.label}),t?(0,K.jsx)(`span`,{"aria-hidden":`true`,className:`absolute right-2 top-2 flex h-4 w-4 items-center justify-center rounded-full bg-[var(--primary-base)]`,children:(0,K.jsx)(B,{className:`h-2.5 w-2.5 text-[var(--content-inset)]`,"aria-hidden":`true`})}):null]})}function Pe({onClick:e}){return(0,K.jsxs)(`button`,{type:`button`,onClick:e,"aria-label":`Something else`,className:`flex h-[88px] w-full cursor-pointer flex-col items-center justify-center gap-1.5 rounded-lg border border-[var(--border-element)] bg-[var(--surface-lift)] p-2 transition-colors hover:bg-[var(--surface-base)]`,children:[(0,K.jsx)(`span`,{className:`flex h-8 w-8 items-center justify-center rounded-full bg-[var(--surface-base)]`,children:(0,K.jsx)(N,{className:`h-4 w-4 text-[var(--content-secondary)]`,"aria-hidden":`true`})}),(0,K.jsx)(`span`,{className:`line-clamp-2 text-center text-label-medium-default text-[var(--content-default)]`,children:`Something else`})]})}function J({assistant:e,size:t}){if(e.logoSrc)return e.logoSrcDark?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`span`,{className:`flex items-center justify-center dark:hidden`,style:{width:t,height:t},"aria-hidden":`true`,children:(0,K.jsx)(`img`,{src:e.logoSrc,alt:``,width:t,height:t,className:`max-h-full max-w-full object-contain`,loading:`eager`})}),(0,K.jsx)(`span`,{className:`hidden items-center justify-center dark:flex`,style:{width:t,height:t},"aria-hidden":`true`,children:(0,K.jsx)(`img`,{src:e.logoSrcDark,alt:``,width:t,height:t,className:`max-h-full max-w-full object-contain`,loading:`eager`})})]}):(0,K.jsx)(`span`,{className:`flex items-center justify-center`,style:{width:t,height:t},children:(0,K.jsx)(`img`,{src:e.logoSrc,alt:``,width:t,height:t,className:`max-h-full max-w-full object-contain`,loading:`eager`})});let n=e.label.slice(0,2).toUpperCase();return(0,K.jsx)(`span`,{className:`flex items-center justify-center rounded-full bg-[var(--surface-base)] text-label-small-default text-[var(--content-default)]`,style:{width:t,height:t},"aria-hidden":`true`,children:n})}function Fe({selectedTasks:e,onChange:t,onBack:n,onContinue:r,onSkip:i}){let a=m(),o=n=>{let r=new Set(e);r.has(n)?r.delete(n):r.add(n),t(r)};return(0,K.jsx)(H,{showCreatureFooter:!1,children:(0,K.jsxs)(`div`,{className:`mx-auto flex w-full max-w-xl flex-col items-center ${a?`px-8 pt-7 pb-4 electron-prechat-type`:`px-6 pt-12 pb-40`} text-[var(--content-default)]`,children:[(0,K.jsxs)(`div`,{className:`grid w-full grid-cols-[auto_1fr_auto] items-center`,style:{animation:`fadeInUp 0.3s ease-out 0.1s both`},children:[(0,K.jsx)(`button`,{type:`button`,onClick:n,"aria-label":`Back`,className:`flex h-8 w-8 cursor-pointer items-center justify-center rounded-md text-[var(--content-secondary)] transition-colors hover:bg-[var(--surface-base)]`,children:(0,K.jsx)(I,{className:`h-4 w-4`})}),(0,K.jsx)(`h1`,{className:`text-center ${a?`text-title-large`:`text-3xl font-semibold tracking-tight`}`,children:`What are you working on?`}),(0,K.jsx)(`div`,{"aria-hidden":`true`,className:`h-8 w-8`})]}),(0,K.jsx)(`p`,{className:`${a?`mt-2`:`mt-4`} text-center text-body-medium-lighter text-[var(--content-${a?`secondary`:`tertiary`})]`,style:{animation:`fadeInUp 0.3s ease-out 0.15s both`},children:`Pick the one or two you do most — you can select more if it really is all of it.`}),(0,K.jsx)(`div`,{className:`${a?`mt-6`:`mt-8`} flex w-full flex-col ${a?`gap-1`:`gap-2`}`,style:{animation:`fadeInUp 0.3s ease-out 0.2s both`},children:z.map(t=>{let n=E[t.iconKey],r=e.has(t.id);return(0,K.jsxs)(`button`,{type:`button`,onClick:()=>o(t.id),"aria-pressed":r,className:`group flex w-full cursor-pointer items-center ${a?`gap-2 p-3`:`gap-3 px-4 py-3`} rounded-lg border text-left transition-colors ${r?`border-[var(--primary-base)] bg-[var(--primary-base)]/10`:`border-[var(--border-element)] bg-[var(--surface-lift)] hover:bg-[var(--surface-base)]`}`,children:[(0,K.jsx)(`div`,{className:`flex w-6 shrink-0 items-center justify-center text-[var(--content-secondary)]`,children:n?(0,K.jsx)(n,{className:`h-4 w-4`}):null}),(0,K.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,K.jsx)(`div`,{className:`text-body-medium-default prechat-md-regular text-[var(--content-default)]`,children:t.label}),(0,K.jsx)(`p`,{className:`mt-0.5 text-body-small-default text-[var(--content-tertiary)]`,children:t.sublabel})]}),(0,K.jsx)(`div`,{"aria-hidden":`true`,className:`flex h-5 w-5 shrink-0 items-center justify-center rounded-md ${r?`bg-[var(--primary-base)]`:`border-[1.5px] border-[var(--border-element)]`}`,children:r?(0,K.jsx)(B,{className:`h-3 w-3 text-[var(--content-inset)]`}):null})]},t.id)})}),(0,K.jsxs)(`div`,{className:`${a?`mt-6`:`mt-8`} flex w-full flex-col gap-2`,style:{animation:`fadeInUp 0.3s ease-out 0.3s both`},children:[(0,K.jsx)(s,{variant:`primary`,size:`regular`,fullWidth:!0,disabled:e.size===0,onClick:r,className:`${a?`h-9`:`h-11 text-base`}`,children:`Continue`}),(0,K.jsx)(s,{variant:`ghost`,size:`regular`,fullWidth:!0,onClick:i,className:`${a?`h-9`:`h-11 text-base`}`,children:`I'll set this up later`})]})]})})}var Ie=new Set([`gmail`,`google-calendar`,`google-drive`]),Le=[{id:`gmail`,label:`Gmail`,logoSrc:T(`/images/integrations/gmail.svg`)},{id:`outlook`,label:`Outlook`,logoSrc:T(`/images/integrations/outlook.png`)},{id:`google-calendar`,label:`Google Calendar`,logoSrc:T(`/images/integrations/google-calendar.svg`)},{id:`slack`,label:`Slack`,logoSrc:T(`/images/integrations/slack.svg`)},{id:`notion`,label:`Notion`,logoSrc:T(`/images/integrations/notion.svg`)},{id:`linear`,label:`Linear`,logoSrc:T(`/images/integrations/linear-light-logo.svg`)},{id:`jira`,label:`Jira`,logoSrc:T(`/images/integrations/jira.svg`)},{id:`github`,label:`GitHub`,logoSrc:T(`/images/integrations/github.svg`),logoSrcDark:T(`/images/integrations/github-dark.svg`)},{id:`figma`,label:`Figma`,logoSrc:T(`/images/integrations/figma.svg`)},{id:`google-drive`,label:`Google Drive`,logoSrc:T(`/images/integrations/google-drive.svg`)},{id:`excel`,label:`Excel`,logoSrc:T(`/images/integrations/excel.svg`)},{id:`apple-notes`,label:`Apple Notes`,logoSrc:T(`/images/integrations/apple-notes.svg`)}];function Y(e){let t=e.map(e=>e.startsWith(`other:`)?e.slice(6):e);return Array.from(new Set(t)).sort()}function Re({selectedTools:e,onChange:t,onBack:n,onContinue:r,onSkip:i}){let a=m(),[o,u]=(0,G.useState)(()=>Be(e)),[d,f]=(0,G.useState)(()=>o.length>0),p=(0,G.useRef)(Ve(e));(0,G.useEffect)(()=>{let t=Ve(e);if(t===p.current)return;let n=Be(e);u(n),f(e=>e||n.length>0),p.current=t},[e]),(0,G.useEffect)(()=>{let n=new Set([...e].filter(e=>!e.startsWith(`other:`))),r=new Set;for(let e of o.split(`,`)){let t=e.trim();t&&(r.has(t)||(r.add(t),n.add(`other:${t}`)))}ze(n,e)||(p.current=Ve(n),t(n))},[o]);let h=n=>{let r=new Set(e);r.has(n)?r.delete(n):r.add(n),t(r)},v=(0,G.useMemo)(()=>{let e=new Set;return o.split(`,`).map(e=>e.trim()).filter(t=>!t||e.has(t)?!1:(e.add(t),!0))},[o]),ee=e.size===0?`Continue`:`Continue · ${e.size} selected`;return(0,K.jsx)(H,{showCreatureFooter:!1,children:(0,K.jsxs)(`div`,{className:`mx-auto flex w-full max-w-2xl flex-col items-center ${a?`px-8 pt-7 pb-4 electron-prechat-type`:`px-6 pt-12 pb-40`} text-[var(--content-default)]`,children:[(0,K.jsxs)(`div`,{className:`grid w-full items-center ${n?`grid-cols-[auto_1fr_auto]`:``}`,style:{animation:`fadeInUp 0.3s ease-out 0.1s both`},children:[n?(0,K.jsx)(`button`,{type:`button`,onClick:n,"aria-label":`Back`,className:`flex h-8 w-8 cursor-pointer items-center justify-center rounded-md text-[var(--content-secondary)] transition-colors hover:bg-[var(--surface-base)]`,children:(0,K.jsx)(I,{className:`h-4 w-4`})}):null,(0,K.jsx)(`h1`,{className:`text-center ${a?`text-title-large`:`text-3xl font-semibold tracking-tight`}`,children:`What do you use?`}),n?(0,K.jsx)(`div`,{"aria-hidden":`true`,className:`h-8 w-8`}):null]}),(0,K.jsx)(`p`,{className:`${a?`mt-3`:`mt-4`} text-center text-body-medium-lighter text-[var(--content-${a?`secondary`:`tertiary`})]`,style:{animation:`fadeInUp 0.3s ease-out 0.15s both`},children:`This helps me tailor how I assist you. No connections needed — you can set those up later.`}),(0,K.jsxs)(`div`,{className:`grid w-full gap-2 ${a?`mt-4 grid-cols-4`:`mt-8 grid-cols-2 sm:grid-cols-3 md:grid-cols-4`}`,style:{animation:`fadeInUp 0.3s ease-out 0.2s both`},children:[Le.map(t=>(0,K.jsx)(X,{tool:t,selected:e.has(t.id),onToggle:()=>h(t.id),electron:a},t.id)),d?null:(0,K.jsx)(He,{onClick:()=>f(!0),electron:a})]}),d?(0,K.jsx)(c,{padding:a?`sm`:`md`,className:`mt-3 w-full border-[var(--primary-base)] bg-[color-mix(in_srgb,var(--primary-base)_8%,transparent)]`,children:(0,K.jsxs)(`div`,{className:`flex flex-col ${a?`gap-2`:`gap-3`}`,children:[(0,K.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,K.jsx)(g,{className:`h-3.5 w-3.5 text-[var(--content-secondary)]`,"aria-hidden":`true`}),(0,K.jsx)(`span`,{className:`text-body-medium-default prechat-md-regular text-[var(--content-default)]`,children:`Something else`}),(0,K.jsx)(`button`,{type:`button`,onClick:()=>{f(!1),u(``)},"aria-label":`Dismiss custom tools`,className:`ml-auto inline-flex h-6 w-6 cursor-pointer items-center justify-center rounded-md text-[var(--content-tertiary)] hover:bg-[var(--surface-base)]`,children:(0,K.jsx)(_,{className:`h-3 w-3`,"aria-hidden":`true`})})]}),(0,K.jsx)(l,{"aria-label":`Other tools`,placeholder:`e.g. Trello, Basecamp, Asana...`,value:o,onChange:e=>u(e.target.value),helperText:`Separate multiple tools with commas`,fullWidth:!0}),v.length>0?(0,K.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:v.map(e=>(0,K.jsx)(`span`,{className:`rounded-full bg-[var(--primary-base)] px-3 py-1 text-label-small-default text-[var(--content-inset)]`,children:e},e))}):null]})}):null,(0,K.jsxs)(`div`,{className:`${a?`mt-6`:`mt-8`} flex w-full flex-col gap-2`,style:{animation:`fadeInUp 0.3s ease-out 0.3s both`},children:[(0,K.jsx)(s,{variant:`primary`,size:`regular`,fullWidth:!0,disabled:e.size===0,onClick:r,className:`${a?`h-9`:`h-11 text-base`}`,children:ee}),(0,K.jsx)(s,{variant:`ghost`,size:`regular`,fullWidth:!0,onClick:i,className:`${a?`h-9`:`h-11 text-base`}`,children:`I'll set this up later`})]})]})})}function ze(e,t){if(e.size!==t.size)return!1;for(let n of e)if(!t.has(n))return!1;return!0}function Be(e){return[...e].filter(e=>e.startsWith(`other:`)).map(e=>e.slice(6)).sort().join(`, `)}function Ve(e){return[...e].filter(e=>e.startsWith(`other:`)).sort().join(`|`)}function X({tool:e,selected:t,onToggle:n,electron:r}){return(0,K.jsxs)(`button`,{type:`button`,onClick:n,"aria-pressed":t,"aria-label":e.label,className:`relative flex ${r?`h-[72px]`:`h-[88px]`} w-full cursor-pointer flex-col items-center justify-center gap-1.5 rounded-lg border p-2 transition-colors ${t?`border-[var(--primary-base)] bg-[color-mix(in_srgb,var(--primary-base)_10%,transparent)]`:`border-[var(--border-element)] bg-[var(--surface-lift)] hover:bg-[var(--surface-base)]`}`,children:[(0,K.jsx)(Ue,{tool:e,size:32}),(0,K.jsx)(`span`,{className:`${r?`w-full truncate`:`line-clamp-2`} text-center text-label-medium-default text-[var(--content-default)]`,children:e.label}),t?(0,K.jsx)(`span`,{"aria-hidden":`true`,className:`absolute right-2 top-2 flex h-4 w-4 items-center justify-center rounded-full bg-[var(--primary-base)]`,children:(0,K.jsx)(B,{className:`h-2.5 w-2.5 text-[var(--content-inset)]`,"aria-hidden":`true`})}):null]})}function He({onClick:e,electron:t}){return(0,K.jsxs)(`button`,{type:`button`,onClick:e,"aria-label":`Something else`,className:`flex ${t?`min-h-[72px]`:`h-[88px]`} w-full cursor-pointer flex-col items-center justify-center gap-1.5 rounded-lg border border-[var(--border-element)] bg-[var(--surface-lift)] p-2 transition-colors hover:bg-[var(--surface-base)]`,children:[(0,K.jsx)(`span`,{className:`flex h-8 w-8 items-center justify-center rounded-full bg-[var(--surface-base)]`,children:(0,K.jsx)(N,{className:`h-4 w-4 text-[var(--content-secondary)]`,"aria-hidden":`true`})}),(0,K.jsx)(`span`,{className:`line-clamp-2 text-center text-label-medium-default text-[var(--content-default)]`,children:`Something else`})]})}function Ue({tool:e,size:t}){if(e.logoSrc)return e.logoSrcDark?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`span`,{className:`flex items-center justify-center dark:hidden`,style:{width:t,height:t},"aria-hidden":`true`,children:(0,K.jsx)(`img`,{src:e.logoSrc,alt:``,width:t,height:t,className:`max-h-full max-w-full object-contain`,loading:`eager`})}),(0,K.jsx)(`span`,{className:`hidden items-center justify-center dark:flex`,style:{width:t,height:t},"aria-hidden":`true`,children:(0,K.jsx)(`img`,{src:e.logoSrcDark,alt:``,width:t,height:t,className:`max-h-full max-w-full object-contain`,loading:`eager`})})]}):(0,K.jsx)(`span`,{className:`flex items-center justify-center`,style:{width:t,height:t},children:(0,K.jsx)(`img`,{src:e.logoSrc,alt:``,width:t,height:t,className:`max-h-full max-w-full object-contain`,loading:`eager`})});let n=e.label.slice(0,2).toUpperCase();return(0,K.jsx)(`span`,{className:`flex items-center justify-center rounded-full bg-[var(--surface-base)] text-label-small-default text-[var(--content-default)]`,style:{width:t,height:t},"aria-hidden":`true`,children:n})}function We({selectedGroupId:e,onGroupChange:t,onBack:n,onContinue:r,onSkip:i,currentStep:a,totalSteps:o}){return(0,K.jsx)(H,{showCreatureFooter:!1,children:(0,K.jsxs)(`div`,{className:`mx-auto flex min-h-screen w-full max-w-md flex-col px-6 pb-40 text-[var(--content-default)]`,children:[(0,K.jsxs)(`div`,{className:`grid w-full grid-cols-[auto_1fr_auto] items-center pb-4`,style:{paddingTop:`calc(var(--safe-area-inset-top, env(safe-area-inset-top, 0px)) + 1rem)`,animation:`fadeInUp 0.3s ease-out 0.1s both`},children:[(0,K.jsx)(s,{variant:`ghost`,size:`compact`,iconOnly:(0,K.jsx)(I,{}),onClick:n,"aria-label":`Back`}),(0,K.jsx)(`div`,{className:`flex justify-center`,children:(0,K.jsx)(W,{current:a,total:o})}),(0,K.jsx)(`div`,{"aria-hidden":`true`,className:`h-8 w-8`})]}),(0,K.jsxs)(`div`,{className:`flex flex-1 flex-col items-center pt-4`,children:[(0,K.jsx)(`h1`,{className:`w-full text-left text-3xl font-semibold tracking-tight`,style:{animation:`fadeInUp 0.3s ease-out 0.1s both`},children:`What's my vibe?`}),(0,K.jsx)(`p`,{className:`mt-2 w-full text-left text-body-medium-lighter text-[var(--content-secondary)]`,style:{animation:`fadeInUp 0.3s ease-out 0.15s both`},children:`You can change this any time.`}),(0,K.jsx)(`div`,{className:`mt-8 flex w-full flex-col gap-3`,style:{animation:`fadeInUp 0.3s ease-out 0.3s both`},children:xe.map(n=>{let r=e===n.id;return(0,K.jsxs)(`button`,{type:`button`,onClick:()=>t(r?null:n.id),"aria-pressed":r,className:`flex cursor-pointer items-center justify-between rounded-xl border px-4 py-4 text-left transition-colors ${r?`border-[var(--content-default)] bg-[var(--surface-lift)]`:`border-[var(--border-element)] bg-[var(--surface-lift)] hover:bg-[var(--surface-base)]`}`,children:[(0,K.jsx)(`span`,{className:`text-body-medium-default text-[var(--content-default)]`,children:n.descriptor}),(0,K.jsx)(`span`,{className:`flex h-5 w-5 items-center justify-center rounded-full border-2 transition-colors ${r?`border-[var(--content-default)]`:`border-[var(--content-disabled)]`}`,children:r&&(0,K.jsx)(`span`,{className:`h-2.5 w-2.5 rounded-full bg-[var(--content-default)]`})})]},n.id)})})]}),(0,K.jsxs)(`div`,{className:`flex w-full flex-col gap-2 pb-4`,style:{animation:`fadeInUp 0.3s ease-out 0.3s both`},children:[(0,K.jsx)(s,{variant:`primary`,size:`regular`,fullWidth:!0,onClick:r,className:`h-11 text-base`,children:`Continue`}),(0,K.jsx)(s,{variant:`ghost`,size:`regular`,fullWidth:!0,onClick:i,className:`h-11 text-base`,children:`Skip`})]})]})})}function Ge(e){let[t,n]=(0,G.useState)(()=>(e??``).trim()),r=(0,G.useRef)(!1);return(0,G.useEffect)(()=>{if(r.current)return;let t=(e??``).trim();t&&n(e=>e||t)},[e]),{value:t,onChange:(0,G.useCallback)(e=>{r.current=!0,n(e)},[])}}var Ke=[`gmail`,`google-calendar`,`google-drive`],Z=`experiment-activation-flow-2026-06-03`,Q=`BOOTSTRAP-ACTIVATION-RAIL.md`;function $(e,t,n){return t?.initialMessage?t.initialMessage:n?P(e):M}function qe(e){let{mode:t,recipe:n}=e,r=e.connectedScopes!==void 0,i;i=t===`native`?{tools:[],tasks:[],tone:e.tone,googleConnected:!1}:t===`paredDown`?{tools:r?[...Ke]:[],tasks:n?.tasks??[],tone:e.tone,googleConnected:r}:{tools:Y([...e.selectedTools]),tasks:[...e.selectedTasks].sort(),tone:e.tone},n&&(i.cohort=n.cohort,i.bootstrapTemplate=n.bootstrapTemplate,i.skills=n.skills),e.activationFlowEnabled&&(i.cohort=Z,i.bootstrapTemplate=Q);let a=e.userName.trim();a&&(i.userName=a);let o=e.assistantName.trim();return o&&(i.assistantName=o),t===`paredDown`?r&&(i.googleScopes=e.connectedScopes):t===`control`&&(r?(i.googleConnected=!0,i.googleScopes=e.connectedScopes):e.googleConnected?(i.googleConnected=!0,i.googleScopes=e.googleScopes):i.googleConnected=!1),t===`control`&&e.selectedPriorAssistants.size>0&&(i.priorAssistants=Y([...e.selectedPriorAssistants])),i.initialMessage=$(i,e.activationFlowEnabled?null:n,e.selfIntroGreetingEnabled),i}function Je(e){return!e.localMode||e.platformSession===`present`?!0:e.platformSession===`unknown`&&e.hasCachedPlatformAssistant}function Ye(e){let{paredDown:t}=e;return[{id:`name`,funnelStep:U.nameVibe,enabled:!0},{id:`taskTone`,funnelStep:U.controlWorkType,enabled:!t},{id:`tools`,funnelStep:U.controlTools,enabled:!t},{id:`priorAssistants`,funnelStep:U.controlPriorAssistants,enabled:!t&&e.canOfferPriorAssistants},{id:`google`,funnelStep:t?U.gmailConnect:U.controlGmailConnect,enabled:e.canOfferGoogleStep&&(t||e.hasGoogleTool)},{id:`iosApp`,funnelStep:U.controlGetApp,enabled:!t&&e.showIOSAppStep}].filter(e=>e.enabled).map(({enabled:e,...t})=>t)}function Xe(){return[{id:`nativeName`,funnelStep:null},{id:`nativeVibe`,funnelStep:null}]}var Ze=`1`;function Qe(e){return e===`nativeVibe`||e===Ze?`nativeVibe`:null}function $e(e,t){let n=e.findIndex(e=>e.id===t);return n<0?null:e[n+1]?.id??null}function et(e,t){let n=e.findIndex(e=>e.id===t);return n<=0?null:e[n-1]?.id??null}var tt=3;function nt(){let e=d();return e?.cloud===`vellum`?e.assistantId:f()[0]?.assistantId??null}function rt(){let e=n(),t=S.use.user(),r=x(),a=b(),o=t?.id??null,s=t?.firstName??``,c=t?.lastName??``,l=ee(),d=p.use.activeAssistantId(),f=u(),m=le()&&!ae(),h=R.use.stringFlags().preChatOnboardingExperiment20260606??`control`,g=(R.use.stringFlags().experimentActivationFlow20260603??`control`)===`variant-a`,_=R.use.selfIntroGreeting(),C=fe(h),T=me()??C,E=T===pe.paredDown,te=f?nt():null,D=o?`prechat_native_screen:${o}`:null,[k,j]=(0,G.useState)(()=>l?`nativeName`:`name`),ne=(0,G.useCallback)(e=>{if(D)try{e===null?sessionStorage.removeItem(D):sessionStorage.setItem(D,e)}catch{}},[D]);(0,G.useLayoutEffect)(()=>{if(D)try{let e=Qe(sessionStorage.getItem(D));e&&j(e)}catch{}},[D]),(0,G.useEffect)(()=>{l&&ne(k===`nativeVibe`?`nativeVibe`:null)},[l,k,ne]);let re=S.use.platformSession(),M=y(re),[N,P]=(0,G.useState)(()=>new Set),[F,I]=(0,G.useState)(()=>new Set),[L,oe]=(0,G.useState)(()=>new Set),{value:z,onChange:B}=Ge(f&&!M?``:s||c),[V,H]=(0,G.useState)(null),[U]=(0,G.useState)(()=>we()),[W,he]=(0,G.useState)(``),[_e,q]=(0,G.useState)(!1),[ye,xe]=(0,G.useState)([]),{data:Se}=i({...se(),enabled:!a&&r&&(!f||M)}),{data:Ce,isLoading:Ee}=i({queryKey:[`onboarding-recipe`,o],queryFn:ge,enabled:!a&&r&&!l&&!f,staleTime:1/0}),Oe=Ce??null,Ae=Se?.id??d??te,je=Je({localMode:f,platformSession:re,hasCachedPlatformAssistant:te!==null}),Me=je,Ne=je,Pe=(0,G.useCallback)(async()=>{await v.checkAssistant(),e(`${w.assistant}?onboarding=1`,{replace:!0})},[e]),[J,Le]=(0,G.useState)(()=>a||!r?{userId:o,decision:`pending`}:{userId:o,decision:ie()&&ce()?`ok`:`missing`}),Y=J.decision;(0,G.useEffect)(()=>{a||!r||J.userId===o&&J.decision!==`pending`||Le({userId:o,decision:ie()&&ce()?`ok`:`missing`})},[J,a,r,o]),(0,G.useEffect)(()=>{if(!a){if(!r){e(w.account.login,{replace:!0});return}if(Y===`missing`&&!l){e(w.onboarding.privacy,{replace:!0});return}}},[Y,a,r,l,e,Pe,o]);let ze=a||!r||!(l||Y===`ok`)||!!Ee;function Be(e,t=T){de(e,{userId:o,variant:ue(t)})}let Ve=[...N].some(e=>Ie.has(e)),X=l?Xe():Ye({paredDown:E,canOfferPriorAssistants:Ne,canOfferGoogleStep:Me,hasGoogleTool:Ve,showIOSAppStep:m});async function He(e){A(qe({mode:E?`paredDown`:`control`,recipe:Oe,selectedTools:N,selectedTasks:F,selectedPriorAssistants:e?.selectedPriorAssistants??L,tone:V??Oe?.tone??`grounded`,userName:z,assistantName:W,selfIntroGreetingEnabled:_,activationFlowEnabled:g,googleConnected:_e,googleScopes:ye,connectedScopes:e?.connectedScopes}));let t=W.trim();t&&O(t),v.markExpectingFirstMessage(),await Pe()}function Ue(){A(qe({mode:`native`,recipe:null,selectedTools:N,selectedTasks:F,selectedPriorAssistants:L,tone:V??`grounded`,userName:z,assistantName:W,selfIntroGreetingEnabled:_,googleConnected:!1,googleScopes:[]}));let t=W.trim();t&&O(t),ne(null),e(w.onboarding.privacy)}let Ke=e=>{l?Ue():He(e)},Z=(e,t)=>{e.funnelStep&&Be(e.funnelStep);let n=$e(X,e.id);n?j(n):Ke(t)},Q=e=>{let t=et(X,e);t&&j(t)};if(ze)return null;let $=X.find(e=>e.id===k)??X[0];return $?$.id===`nativeName`?(0,K.jsx)(De,{userName:z,assistantName:W,displayedAssistantNames:U,onUserNameChange:B,onAssistantNameChange:he,onContinue:()=>Z($),onSkip:()=>Z($),currentStep:0,totalSteps:tt}):$.id===`nativeVibe`?(0,K.jsx)(We,{selectedGroupId:V,onGroupChange:H,onBack:()=>Q($.id),onContinue:()=>Z($),onSkip:()=>Z($),currentStep:1,totalSteps:tt}):$.id===`name`?(0,K.jsx)(Te,{userName:z,assistantName:W,selectedGroupId:V,displayedAssistantNames:U,onUserNameChange:B,onAssistantNameChange:he,onGroupChange:H,onComplete:()=>Z($),onSkip:()=>Z($)}):$.id===`taskTone`?(0,K.jsx)(Fe,{selectedTasks:F,onChange:I,onBack:()=>Q($.id),onContinue:()=>Z($),onSkip:()=>Z($)}):$.id===`tools`?(0,K.jsx)(Re,{selectedTools:N,onChange:P,onBack:()=>Q($.id),onContinue:()=>Z($),onSkip:()=>Z($)}):$.id===`priorAssistants`?(0,K.jsx)(ke,{selectedAssistants:L,onChange:oe,onBack:()=>Q($.id),onContinue:()=>Z($),onSkip:()=>{let e=new Set;oe(e),Z($,{selectedPriorAssistants:e})}}):$.id===`google`?Ae?(0,K.jsx)(be,{assistantId:Ae,assistantName:W,onConnect:e=>{q(!0),xe(e),Z($,{connectedScopes:e})},onSkip:()=>Z($),onBack:()=>Q($.id)}):null:$.id===`iosApp`?(0,K.jsx)(ve,{onComplete:()=>Z($)}):null:null}export{rt as PreChatFlow};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{o as e}from"./chunk-jRWAZmH_.js";import{n as t,o as n,r}from"./device-settings-C07QvMzm.js";import{t as i}from"./react-DJZBPgpf.js";import{T as a}from"./portal-container-DIXEBWUe.js";import{n as o}from"./QueryClientProvider-DNHWXaGq.js";import{t as s}from"./useQuery-D2zf6Uhu.js";import{t as c}from"./useMutation-BuofVRHk.js";import{t as l}from"./jsx-runtime-CVSDxk6A.js";import{t as u}from"./button-DdEh-9f_.js";import{t as d}from"./card-CL5iEMJO.js";import{t as f}from"./dropdown-CocFV5yi.js";import{t as p}from"./confirm-dialog-NYG-K9zN.js";import{t as m}from"./notice-CF2pptne.js";import{t as h}from"./tag-Ccr7Quy6.js";import{t as g}from"./input-Cu3PPVCq.js";import{t as _}from"./toggle-CEm3M86o.js";import{n as v}from"./toast-DU1nH33j.js";import{t as y}from"./chevron-right-zTNPbA1m.js";import{t as b}from"./loader-circle-BSAFLoPH.js";import{t as x}from"./pencil-BA9LOIzP.js";import{t as S}from"./x-BDqbYVtS.js";import{C,O as w,S as T,b as E,d as D,r as O,v as k,w as A,x as j,y as M}from"./auth-store-oleg80LZ.js";import{t as N}from"./sdk.gen-BO4vbMAj.js";import{H as P,Mi as ee,S as te,U as F,V as I,Wi as L,b as R,dt as z,fo as B,ft as V,mt as ne,pt as re,ut as ie,x as ae,y as H}from"./index-DM63H2B6.js";import{t as U}from"./use-active-assistant-id-BIhArlF_.js";import{t as W}from"./detail-card-B5j4Rqau.js";var G=e(i(),1),K=l();function q(){let e=V({platformHostedOnly:!0}),t=ie(),n=z(),r=o(),{data:i,isLoading:a,isError:l}=s({...re(),enabled:e===`full`&&t}),u=c({mutationFn:async e=>{let{data:t}=await N({body:{access_consented:e},throwOnError:!0});return t},onSuccess:e=>{r.setQueryData(ne(),e),v.success(e?.access_consented?`Admin data access enabled.`:`Admin data access disabled.`)},onError:()=>{v.error(`Failed to update log access consent.`)}});if(e===`gated`)return null;let d=e===`full`&&n,f=i?.access_consented??!1,p=e!==`full`||!t||a||l||u.isPending;return(0,K.jsxs)(`div`,{children:[(0,K.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,K.jsxs)(`div`,{className:`flex-1`,children:[(0,K.jsx)(`div`,{className:`text-body-medium-default text-[var(--content-default)]`,children:`Allow admin access to assistant data`}),(0,K.jsxs)(`p`,{className:`mt-1 text-body-small-default text-[var(--content-tertiary)]`,children:[`Lets Vellum administrators reach privileged data on your assistant pod for debugging — today this means tailing the daily assistant log at`,` `,(0,K.jsx)(`code`,{className:`rounded bg-[var(--surface-base)] px-1.5 font-mono text-[var(--content-secondary)] dark:bg-[var(--surface-lift)] dark:text-[var(--content-default)]`,children:`/workspace/data/logs/assistant-YYYY-MM-DD.log`}),`. Off by default. Turn on temporarily when asking support to investigate an issue, then turn off when you're done.`]}),e===`full`&&l&&(0,K.jsx)(`p`,{className:`mt-1 text-body-small-default text-[var(--system-negative-strong)]`,children:`Failed to load consent setting.`})]}),(0,K.jsx)(`div`,{className:`flex items-center gap-2`,children:e===`disabled`?null:(0,K.jsxs)(K.Fragment,{children:[(u.isPending||d)&&(0,K.jsx)(b,{className:`h-4 w-4 animate-spin text-[var(--content-tertiary)]`}),(0,K.jsx)(_,{checked:f,disabled:p,onChange:()=>u.mutate(!f)})]})})]}),e===`disabled`&&(0,K.jsx)(m,{tone:`info`,className:`mt-3`,children:`Log in to the Vellum platform to manage admin data access.`})]})}function oe(){let e=w(),[t,n]=(0,G.useState)(()=>j()),[r,i]=(0,G.useState)(!1),[a,o]=(0,G.useState)(`Face ID`),[s,c]=(0,G.useState)(!1);if((0,G.useEffect)(()=>{e&&(E().then(i),M().then(o))},[e]),!e||!r)return null;let l=async()=>{c(!0);try{if(t)T(!1),await k(),n(!1);else{let e=A();e&&await C(e),T(!0),n(!0)}}finally{c(!1)}};return(0,K.jsx)(W,{title:`Security`,children:(0,K.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,K.jsxs)(`div`,{className:`flex-1`,children:[(0,K.jsxs)(`div`,{className:`text-body-medium-default text-[var(--content-default)]`,children:[`Use `,a,` for sign-in`]}),(0,K.jsxs)(`p`,{className:`mt-1 text-body-small-default text-[var(--content-tertiary)]`,children:[`When your session expires, verify with `,a,` or your device passcode instead of signing in again.`]})]}),(0,K.jsx)(_,{checked:t,onChange:()=>void l(),disabled:s})]})})}function J(){return(0,K.jsx)(`div`,{className:`h-px bg-[var(--surface-active)] dark:bg-[var(--surface-lift)]`})}var Y=H.map(e=>({value:e.id,label:e.label,icon:(0,K.jsx)(e.icon,{className:`h-3.5 w-3.5`})}));function se(){let e=U(),t=o(),{data:n,isError:r}=s({queryKey:[`thresholds`,e],queryFn:()=>ae(e),staleTime:3e4}),[i,a]=(0,G.useState)(`relaxed`),[c,l]=(0,G.useState)(`conservative`),[u,p]=(0,G.useState)(`strict`),[m,h]=(0,G.useState)(!1),g=(0,G.useRef)(!1),[_,v]=(0,G.useState)(!1),b=(0,G.useRef)(null),x=(0,G.useRef)(null);(0,G.useEffect)(()=>{!n||g.current||(a(R(n.interactive).id),l(R(n.autonomous).id),p(R(n.headless).id),v(!0))},[n]),(0,G.useEffect)(()=>()=>{b.current!==null&&(clearTimeout(b.current),b.current=null,x.current?.(),x.current=null)},[]);let S=(0,G.useCallback)((n,r,i)=>{if(!e||!_)return;let a=H.find(e=>e.id===n)?.riskThreshold,o=H.find(e=>e.id===r)?.riskThreshold,s=H.find(e=>e.id===i)?.riskThreshold;!a||!o||!s||te(e,{interactive:a,autonomous:o,headless:s}).then(()=>{t.invalidateQueries({queryKey:[`thresholds`,e]})}).catch(()=>{})},[e,_,t]),C=(0,G.useCallback)((e,t,n)=>{b.current!==null&&clearTimeout(b.current),x.current=()=>S(e,t,n),b.current=setTimeout(()=>{x.current?.(),b.current=null,x.current=null},500)},[S]),w=(0,G.useCallback)(e=>{g.current=!0,a(e),C(e,c,u)},[c,u,C]),T=(0,G.useCallback)(e=>{g.current=!0,l(e),C(i,e,u)},[i,u,C]),E=(0,G.useCallback)(e=>{g.current=!0,p(e),C(i,c,e)},[i,c,C]),D=H.find(e=>e.id===i),O=H.find(e=>e.id===c),k=H.find(e=>e.id===u),A=!e||!_;return(0,K.jsxs)(d,{children:[(0,K.jsx)(`h2`,{className:`text-title-medium text-[var(--content-default)]`,children:`Risk Tolerance`}),(0,K.jsx)(`p`,{className:`mt-1 text-body-medium-lighter text-[var(--content-tertiary)]`,children:`Control which actions your assistant can take without asking first. Each action is classified by risk level — your tolerance determines which levels auto-approve.`}),r&&(0,K.jsx)(`p`,{className:`mt-2 text-body-small-default text-[var(--system-negative-strong)]`,children:`Could not load threshold settings. Check your connection and reload.`}),(0,K.jsxs)(`div`,{className:`mt-4 space-y-4`,children:[(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`div`,{className:`text-body-medium-default text-[var(--content-default)]`,children:`Conversations`}),(0,K.jsx)(`p`,{className:`mt-0.5 text-body-small-default text-[var(--content-tertiary)]`,children:`When you're chatting with your assistant directly.`}),(0,K.jsx)(`div`,{className:`mt-2`,style:{maxWidth:280},children:(0,K.jsx)(f,{value:i,onChange:w,options:Y,disabled:A})}),D&&(0,K.jsx)(`p`,{className:`mt-2 text-body-small-default text-[var(--content-tertiary)]`,children:D.description})]}),(0,K.jsx)(J,{}),(0,K.jsxs)(`div`,{children:[(0,K.jsxs)(`button`,{type:`button`,onClick:()=>h(e=>!e),className:`flex items-center gap-1 text-[var(--content-secondary)] hover:text-[var(--content-default)] transition-colors`,"aria-expanded":m,children:[m?(0,K.jsx)(B,{className:`h-4 w-4`}):(0,K.jsx)(y,{className:`h-4 w-4`}),(0,K.jsx)(`span`,{className:`text-body-medium-default`,children:`Advanced`})]}),(0,K.jsxs)(`div`,{className:m?`mt-4 space-y-4`:`hidden`,children:[(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`div`,{className:`text-body-medium-default text-[var(--content-default)]`,children:`Background`}),(0,K.jsx)(`p`,{className:`mt-0.5 text-body-small-default text-[var(--content-tertiary)]`,children:`When your assistant acts without you — scheduled tasks, background jobs, and external triggers.`}),(0,K.jsx)(`div`,{className:`mt-2`,style:{maxWidth:280},children:(0,K.jsx)(f,{value:c,onChange:T,options:Y,disabled:A})}),O&&(0,K.jsx)(`p`,{className:`mt-2 text-body-small-default text-[var(--content-tertiary)]`,children:O.description})]}),(0,K.jsx)(J,{}),(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`div`,{className:`text-body-medium-default text-[var(--content-default)]`,children:`Headless`}),(0,K.jsx)(`p`,{className:`mt-0.5 text-body-small-default text-[var(--content-tertiary)]`,children:`When triggered externally with no interactive client.`}),(0,K.jsx)(`div`,{className:`mt-2`,style:{maxWidth:280},children:(0,K.jsx)(f,{value:u,onChange:E,options:Y,disabled:A})}),k&&(0,K.jsx)(`p`,{className:`mt-2 text-body-small-default text-[var(--content-tertiary)]`,children:k.description})]})]})]})]})]})}var X=e(a(),1),ce=[`bash`,`file_read`,`file_write`,`file_edit`,`web_fetch`,`skill_load`],le=[{value:`low`,label:`Low`,description:`Auto-approve without prompting`},{value:`medium`,label:`Medium`,description:`Prompt before executing`},{value:`high`,label:`High`,description:`Always require explicit approval`}];function ue({assistantId:e,existingRule:t,onClose:n,onSaved:r}){let i=(0,G.useRef)(null),[a,o]=(0,G.useState)(t.tool),[s,c]=(0,G.useState)(t.pattern),[l,u]=(0,G.useState)(t.risk),[d,p]=(0,G.useState)(t.description??``),[h,_]=(0,G.useState)(!1),[v,y]=(0,G.useState)(null),b=s.trim(),x=b.length>0&&!h,C=(0,G.useCallback)(async n=>{if(n.preventDefault(),!x)return;let i=d.trim()||`${a} — ${b}`;_(!0),y(null);try{await F(e,t.id,{risk:l,description:i}),r()}catch(e){y(e instanceof Error?e.message:`Failed to save trust rule.`)}finally{_(!1)}},[e,x,d,t,r,l,a,b]);return(0,X.createPortal)((0,K.jsx)(`div`,{ref:i,role:`dialog`,"aria-modal":`true`,"aria-labelledby":`trust-rule-form-title`,className:`fixed inset-0 z-50 flex items-center justify-center bg-black/50`,onKeyDown:(0,G.useCallback)(e=>{e.key===`Escape`&&n()},[n]),onClick:(0,G.useCallback)(e=>{e.target===i.current&&n()},[n]),children:(0,K.jsxs)(`div`,{className:`mx-4 flex max-h-[calc(100vh-2rem)] w-full max-w-md flex-col rounded-xl border border-[var(--border-base)] bg-[var(--surface-lift)] shadow-xl`,children:[(0,K.jsxs)(`div`,{className:`flex items-center justify-between gap-3 border-b border-[var(--border-base)] px-6 py-4`,children:[(0,K.jsx)(`h2`,{id:`trust-rule-form-title`,className:`text-title-medium text-[var(--content-default)]`,children:`Edit Trust Rule`}),(0,K.jsx)(`button`,{type:`button`,onClick:n,"aria-label":`Close`,className:`rounded-lg p-1.5 text-[var(--content-tertiary)] transition-colors hover:bg-[var(--surface-base)] hover:text-[var(--content-default)]`,children:(0,K.jsx)(S,{className:`h-4 w-4`})})]}),(0,K.jsxs)(`form`,{onSubmit:e=>void C(e),className:`min-h-0 flex-1 space-y-4 overflow-y-auto px-6 py-4`,children:[v&&(0,K.jsx)(m,{tone:`error`,children:v}),(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`label`,{htmlFor:`trust-rule-tool`,className:`block text-body-medium-default text-[var(--content-default)]`,children:`Tool`}),(0,K.jsx)(`div`,{className:`mt-1`,children:(0,K.jsx)(f,{value:a,onChange:o,disabled:!0,options:ce.map(e=>({value:e,label:e}))})})]}),(0,K.jsx)(g,{label:`Pattern`,type:`text`,value:s,onChange:e=>c(e.target.value),placeholder:`e.g., git *`,disabled:!0}),(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`span`,{className:`block text-body-medium-default text-[var(--content-default)]`,children:`Risk Level`}),(0,K.jsx)(`div`,{className:`mt-2 flex gap-2`,children:le.map(e=>(0,K.jsxs)(`button`,{type:`button`,onClick:()=>u(e.value),className:`flex-1 rounded-lg border px-3 py-2 text-left text-body-small-default transition-colors ${l===e.value?e.value===`low`?`border-[var(--system-positive-strong)] bg-[var(--system-positive-weak)] text-[var(--system-positive-strong)]`:e.value===`medium`?`border-[var(--system-warning-strong)] bg-[var(--system-warning-weak)] text-[var(--system-warning-strong)]`:`border-[var(--system-negative-strong)] bg-[var(--system-negative-weak)] text-[var(--system-negative-strong)]`:`border-[var(--border-element)] text-[var(--content-default)] hover:bg-[var(--surface-base)]`}`,children:[(0,K.jsx)(`div`,{children:e.label}),(0,K.jsx)(`div`,{className:`mt-0.5 text-label-medium-default leading-tight opacity-70`,children:e.description})]},e.value))})]}),(0,K.jsx)(g,{label:`Description (optional)`,type:`text`,value:d,onChange:e=>p(e.target.value),placeholder:`${a} — ${b||`pattern`}`}),(0,K.jsxs)(`div`,{className:`flex justify-end gap-2 pt-2`,children:[(0,K.jsx)(`button`,{type:`button`,onClick:n,className:`rounded-lg border border-[var(--border-element)] bg-white px-4 py-2 text-body-medium-default text-[var(--content-default)] transition-colors hover:bg-[var(--surface-base)] dark:border-[var(--border-base)] dark:bg-[var(--surface-lift)] dark:hover:bg-[var(--ghost-hover)]`,children:`Cancel`}),(0,K.jsx)(`button`,{type:`submit`,disabled:!x,className:`rounded-lg bg-[var(--system-positive-strong)] px-4 py-2 text-body-medium-default text-white transition-colors hover:bg-[var(--system-positive-strong)] disabled:cursor-not-allowed disabled:opacity-50`,children:h?`Saving…`:`Save`})]})]})]})}),document.body)}function de(e){return e.origin===`default`&&!e.userModified}function fe(e,t){let n=new Set,r=[];for(let t of e)n.has(t.id)||(n.add(t.id),r.push(t));for(let e of t)n.has(e.id)||(n.add(e.id),r.push(e));return r.sort((e,t)=>e.tool===t.tool?e.description.localeCompare(t.description):e.tool.localeCompare(t.tool))}function pe(e){switch(e){case`low`:return`positive`;case`medium`:return`warning`;case`high`:return`negative`}}function Z(e){return e.charAt(0).toUpperCase()+e.slice(1)}function me({assistantId:e,onClose:t}){let n=(0,G.useRef)(null),[r,i]=(0,G.useState)([]),[a,o]=(0,G.useState)(!0),[s,c]=(0,G.useState)(null),[l,d]=(0,G.useState)(null),[f,g]=(0,G.useState)(null),[v,y]=(0,G.useState)(!1),b=(0,G.useCallback)(async t=>{if(t){let[t,n]=await Promise.all([P(e),P(e,{origin:`default`})]);return fe(t,n)}return P(e)},[e]),S=(0,G.useCallback)(async()=>{o(!0);try{i(await b(v)),c(null)}catch(e){c(e instanceof Error?e.message:`Failed to load trust rules.`)}finally{o(!1)}},[b,v]);(0,G.useEffect)(()=>{let e=!1;return(async()=>{o(!0);try{let t=await b(v);e||(i(t),c(null))}catch(t){e||c(t instanceof Error?t.message:`Failed to load trust rules.`)}finally{e||o(!1)}})(),()=>{e=!0}},[b,v]);let C=(0,G.useCallback)(async()=>{if(f)try{await I(e,f.id),S()}catch(e){c(e instanceof Error?e.message:`Failed to delete trust rule.`)}finally{g(null)}},[e,f,S]);return(0,X.createPortal)((0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`div`,{ref:n,role:`dialog`,"aria-modal":`true`,"aria-labelledby":`trust-rules-title`,className:`fixed inset-0 z-50 flex items-center justify-center bg-black/50`,onKeyDown:(0,G.useCallback)(e=>{e.key===`Escape`&&t()},[t]),onClick:(0,G.useCallback)(e=>{e.target===n.current&&t()},[t]),children:(0,K.jsxs)(`div`,{className:`mx-4 flex max-h-[80vh] w-full max-w-2xl flex-col rounded-xl border border-[var(--border-base)] bg-[var(--surface-lift)] shadow-xl`,children:[(0,K.jsxs)(`div`,{className:`flex items-center justify-between gap-3 border-b border-[var(--border-base)] px-6 py-4`,children:[(0,K.jsx)(`h2`,{id:`trust-rules-title`,className:`text-title-medium text-[var(--content-default)]`,children:`Trust Rules`}),(0,K.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,K.jsx)(_,{checked:v,onChange:y,label:`Show all defaults`}),(0,K.jsx)(u,{variant:`outlined`,onClick:t,children:`Done`})]})]}),(0,K.jsxs)(`div`,{className:`flex-1 overflow-y-auto px-6 py-4`,children:[s&&(0,K.jsx)(`div`,{className:`mb-3`,children:(0,K.jsx)(m,{tone:`error`,children:s})}),a?(0,K.jsx)(`div`,{className:`flex h-48 items-center justify-center text-body-medium-lighter text-[var(--content-tertiary)]`,children:`Loading…`}):r.length===0?(0,K.jsxs)(`div`,{className:`flex h-48 flex-col items-center justify-center gap-2 px-6 text-[var(--content-tertiary)]`,children:[(0,K.jsx)(L,{className:`h-8 w-8`}),(0,K.jsx)(`p`,{className:`max-w-xs text-center text-body-medium-lighter`,children:`No trust rules yet. Rules are created when you classify actions from permission prompts.`})]}):(0,K.jsx)(`ul`,{className:`divide-y divide-[var(--border-base)]`,children:r.map(e=>{let t=de(e);return(0,K.jsxs)(`li`,{className:`flex items-start gap-3 py-3`,children:[(0,K.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,K.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,K.jsx)(`span`,{className:`text-body-medium-default text-[var(--content-default)]`,children:e.tool}),(0,K.jsx)(h,{tone:pe(e.risk),children:Z(e.risk)}),e.origin===`default`&&(0,K.jsx)(h,{tone:`neutral`,children:`Default`}),e.userModified&&(0,K.jsx)(h,{tone:`warning`,children:`Modified`})]}),(0,K.jsx)(`div`,{className:`mt-1 truncate font-mono text-body-small-default text-[var(--content-secondary)]`,children:e.pattern}),e.description&&(0,K.jsx)(`div`,{className:`mt-0.5 truncate text-body-small-default text-[var(--content-tertiary)]`,children:e.description})]}),(0,K.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1`,children:[(0,K.jsx)(`button`,{type:`button`,"aria-label":`Edit ${e.tool} rule`,onClick:()=>d(e),className:`rounded-lg p-1.5 text-[var(--content-tertiary)] transition-colors hover:bg-[var(--surface-base)] hover:text-[var(--content-default)]`,children:(0,K.jsx)(x,{className:`h-4 w-4`})}),(!t||e.userModified)&&(0,K.jsx)(`button`,{type:`button`,"aria-label":`Delete ${e.tool} rule`,onClick:()=>g(e),className:`rounded-lg p-1.5 text-[var(--system-negative-strong)] transition-colors hover:bg-[var(--system-negative-weak)]`,children:(0,K.jsx)(ee,{className:`h-4 w-4`})})]})]},e.id)})})]})]})}),l&&(0,K.jsx)(ue,{assistantId:e,existingRule:l,onClose:()=>d(null),onSaved:()=>{d(null),S()}}),(0,K.jsx)(p,{open:f!==null,title:`Delete Trust Rule?`,message:f?`Remove the ${Z(f.risk).toLowerCase()}-risk rule for ${f.tool} matching "${f.pattern}"?`:``,confirmLabel:`Delete`,cancelLabel:`Cancel`,destructive:!0,onConfirm:()=>void C(),onCancel:()=>g(null)})]}),document.body)}function he(){let e=U(),[t,n]=(0,G.useState)(!1);return(0,K.jsxs)(d,{children:[(0,K.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,K.jsx)(L,{className:`mt-0.5 h-5 w-5 shrink-0 text-[var(--content-secondary)]`}),(0,K.jsxs)(`div`,{className:`flex-1`,children:[(0,K.jsx)(`h2`,{className:`text-title-medium text-[var(--content-default)]`,children:`Trust Rules`}),(0,K.jsx)(`p`,{className:`mt-1 text-body-medium-lighter text-[var(--content-tertiary)]`,children:`Manage per-tool rules that control which actions auto-approve and which require your explicit permission.`})]}),(0,K.jsx)(u,{variant:`outlined`,onClick:()=>n(!0),children:`Manage`})]}),t&&(0,K.jsx)(me,{assistantId:e,onClose:()=>n(!1)})]})}var ge=[{value:`dontRetain`,label:`Don't retain`},{value:`oneHour`,label:`1 hour`},{value:`oneDay`,label:`1 day`},{value:`sevenDays`,label:`7 days`},{value:`thirtyDays`,label:`30 days`},{value:`ninetyDays`,label:`90 days`},{value:`keepForever`,label:`Keep forever`}],_e=`thirtyDays`;function Q({label:e,helperText:t,checked:n,onChange:r}){return(0,K.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,K.jsxs)(`div`,{className:`flex-1`,children:[(0,K.jsx)(`div`,{className:`text-body-medium-default text-[var(--content-default)]`,children:e}),(0,K.jsx)(`p`,{className:`mt-1 text-body-small-default text-[var(--content-tertiary)]`,children:t})]}),(0,K.jsx)(_,{checked:n,onChange:r,label:e})]})}function $(){return(0,K.jsx)(`div`,{className:`h-px bg-[var(--surface-active)] dark:bg-[var(--surface-lift)]`})}function ve(){let e=V({platformHostedOnly:!0}),i=O(),[a,o]=(0,G.useState)(()=>t(`shareAnalytics`,!0)),[s,c]=(0,G.useState)(()=>t(`shareDiagnostics`,!0)),[l,u]=(0,G.useState)(()=>r(`llmLogRetention`,_e));return(0,K.jsxs)(`div`,{className:`space-y-4`,children:[(0,K.jsx)(oe,{}),(0,K.jsx)(he,{}),(0,K.jsx)(se,{}),(0,K.jsx)(W,{title:`Privacy`,children:(0,K.jsxs)(`div`,{className:`space-y-4`,children:[(0,K.jsx)(Q,{label:`Share Analytics`,helperText:`Send anonymous product usage data. Your conversations and personal data are never included.`,checked:a,onChange:()=>{let e=!a;o(e),D(`share_analytics`,e,i)}}),(0,K.jsx)($,{}),(0,K.jsx)(Q,{label:`Share Diagnostics`,helperText:`Send crash reports and performance metrics. Your conversations and personal data are never included.`,checked:s,onChange:()=>{let e=!s;c(e),D(`share_diagnostics`,e,i)}}),(0,K.jsx)($,{}),(0,K.jsx)(q,{}),e!==`gated`&&(0,K.jsx)($,{}),(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`label`,{htmlFor:`llm-log-retention`,className:`block text-body-medium-default text-[var(--content-default)]`,children:`LLM Request Log Retention`}),(0,K.jsx)(`div`,{className:`mt-2`,style:{maxWidth:280},children:(0,K.jsx)(f,{value:l,onChange:e=>{u(e),n(`llmLogRetention`,e)},options:ge})}),(0,K.jsx)(`p`,{className:`mt-2 text-body-small-default text-[var(--content-tertiary)]`,children:`How long to keep LLM request and response logs on this device. These logs record the prompts and completions sent to model providers and are used for debugging. Shorter retention improves privacy; longer retention helps troubleshoot issues.`})]})]})})]})}export{ve as PrivacyPage};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var e=e=>e,t=(e,t)=>`${e}/${t}`,n=e(`/assistant/logs/usage`),r={assistant:e(`/assistant`),about:e(`/assistant/about`),bundleConfirm:e(`/assistant/bundle/confirm`),quickInput:e(`/assistant/quick-input`),conversation:n=>t(e(`/assistant/conversations`),n),inspect:n=>`${t(e(`/assistant/conversations`),n)}/inspect`,logs:{root:e(`/assistant/logs`),trace:e(`/assistant/logs/trace`),usage:n,usageForSchedule:e=>`${n}?${new URLSearchParams({range:`7d`,groupBy:`schedule`,scheduleId:e}).toString()}`,emails:e(`/assistant/logs/emails`),systemEvents:e(`/assistant/logs/system-events`)},account:{root:e(`/account`),login:e(`/account/login`),signup:e(`/account/signup`),providerSignup:e(`/account/provider/signup`),providerCallback:e(`/account/provider/callback`),oauth:{popupComplete:e(`/account/oauth/popup-complete`),complete:e(`/account/oauth/complete`),desktopComplete:e(`/account/oauth/desktop-complete`)}},onboarding:{welcome:e(`/assistant/onboarding/welcome`),selectAssistant:e(`/assistant/onboarding/select-assistant`),hosting:e(`/assistant/onboarding/hosting`),apiKey:e(`/assistant/onboarding/api-key`),privacy:e(`/assistant/onboarding/privacy`),reviewTerms:e(`/assistant/onboarding/review-terms`),prechat:e(`/assistant/onboarding/prechat`),hatching:e(`/assistant/onboarding/hatching`)},home:e(`/assistant/home`),identity:e(`/assistant/identity`),plugins:e(`/assistant/plugins`),plugin:n=>t(e(`/assistant/plugins`),n),skills:e(`/assistant/skills`),workspace:e(`/assistant/workspace`),library:{root:e(`/assistant/library`),app:n=>t(e(`/assistant/library`),n)},document:n=>t(e(`/assistant/documents`),n),connect:e(`/assistant/connect`),contacts:{root:e(`/assistant/contacts`)},settings:{root:e(`/assistant/settings`),general:e(`/assistant/settings/general`),ai:e(`/assistant/settings/ai`),integrations:e(`/assistant/settings/integrations`),schedules:e(`/assistant/settings/schedules`),schedule:n=>t(e(`/assistant/settings/schedules`),n),notifications:e(`/assistant/settings/notifications`),keyboardShortcuts:e(`/assistant/settings/keyboard-shortcuts`),sounds:e(`/assistant/settings/sounds`),voice:e(`/assistant/settings/voice`),devices:e(`/assistant/settings/devices`),privacy:e(`/assistant/settings/privacy`),archive:e(`/assistant/settings/archive`),billing:e(`/assistant/settings/billing`),community:e(`/assistant/settings/community`),debug:e(`/assistant/settings/debug`),developer:e(`/assistant/settings/developer`),advanced:e(`/assistant/settings/advanced`),dangerZone:e(`/assistant/settings/danger-zone`),systemEvents:e(`/assistant/settings/system-events`),upgradeCancel:e(`/assistant/settings/billing/upgrade/cancel`),upgradeSuccess:e(`/assistant/settings/billing/upgrade/success`)},admin:{root:e(`/admin`)},docs:{hostingOptions:e(`/docs/hosting-options`),legal:{privacyPolicy:e(`/docs/privacy-policy`),termsOfUse:e(`/docs/vellum-terms-of-use`),dataSharing:e(`/docs/data-sharing`),prohibitedUse:e(`/docs/prohibited-use`),privacyAndData:e(`/docs/trust-security/privacy-and-data`)}}},i=`vellum.ai`;function a(e){return o(e)}function o(e){return`https://${i}${e}`}function s(){return r.admin.root}export{r as i,o as n,a as r,s as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{o as e}from"./chunk-jRWAZmH_.js";import{t}from"./capture-error-CZsNGL6n.js";import{t as n}from"./react-DJZBPgpf.js";import{d as r,f as i}from"./chunk-5KNZJZUH-B4b1m-Ya.js";import{n as a}from"./QueryClientProvider-DNHWXaGq.js";import{t as o}from"./useQuery-D2zf6Uhu.js";import{t as s}from"./jsx-runtime-CVSDxk6A.js";import{t as c}from"./button-DdEh-9f_.js";import{t as l}from"./notice-CF2pptne.js";import{t as u}from"./tag-Ccr7Quy6.js";import{t as d}from"./panel-item-FzMfzMJA.js";import{n as f,t as p}from"./input-Cu3PPVCq.js";import{t as m}from"./toggle-CEm3M86o.js";import{t as h}from"./modal-BYMhDpQo.js";import{n as g}from"./toast-DU1nH33j.js";import{t as _}from"./calendar-CP_Q3Aw6.js";import{t as v}from"./chevron-right-zTNPbA1m.js";import{t as y}from"./loader-circle-BSAFLoPH.js";import{D as b,E as x,O as S,T as C,_n as w,dn as T,fn as E,gt as ee,hn as te,ht as D,mn as ne,mt as re,pn as O,pt as k,vn as ie}from"./sdk.gen-AJllUeDf.js";import{n as A,r as j,t as M}from"./api-errors-ChauV4ed.js";import{i as N}from"./routes-DMbyM_oF.js";import{c as P,l as ae,s as oe}from"./query-tags-Cez88bzY.js";import{t as se}from"./assistant-feature-flag-store-0382ImYF.js";import{t as F}from"./effective-timezone-CKEcAtDc.js";import{Mi as ce,Xn as le,ma as ue,mo as de,ra as I,ta as fe,yo as L}from"./index-DM63H2B6.js";import{t as pe}from"./use-active-assistant-id-BIhArlF_.js";import{t as R}from"./detail-card-B5j4Rqau.js";import{n as z}from"./usage-window-D5EMg2nb.js";import{t as B}from"./schedules-BJAra2Ob.js";var V=e(n(),1);async function H(e,t){let{error:n,response:r}=await w({path:{assistant_id:e},body:t,throwOnError:!1});if(A(r,n,`Failed to create schedule.`),!r.ok)throw new M(r.status,j(n,r,`Failed to create schedule.`))}async function U(e,t,n){let{error:r,response:i}=await E({path:{assistant_id:e,id:t},body:n,throwOnError:!1});if(A(i,r,`Failed to update schedule.`),!i.ok)throw new M(i.status,j(r,i,`Failed to update schedule.`))}async function me(e){return B(e)}async function he(e,t,n=10){let{data:r,error:i,response:a}=await ne({path:{assistant_id:e,id:t},query:{limit:n},throwOnError:!1});if(A(a,i,`Failed to load schedule runs.`),!a.ok)throw new M(a.status,j(i,a,`Failed to load schedule runs.`));return r?.runs??[]}async function ge(e,t){let{data:n,error:r,response:i}=await ie({path:{assistant_id:e},query:{from:t.from,to:t.to},throwOnError:!1});if(A(i,r,`Failed to load schedule usage.`),!i.ok)throw new M(i.status,j(r,i,`Failed to load schedule usage.`));return n?.summaries??[]}async function _e(e,t,n){let{error:r,response:i}=await te({path:{assistant_id:e,id:t},body:{enabled:n},throwOnError:!1});if(A(i,r,`Failed to toggle schedule.`),!i.ok)throw new M(i.status,j(r,i,`Failed to toggle schedule.`))}async function W(e,t){let{error:n,response:r}=await T({path:{assistant_id:e,id:t},throwOnError:!1});if(A(r,n,`Failed to delete schedule.`),!r.ok&&r.status!==204)throw new M(r.status,j(n,r,`Failed to delete schedule.`))}async function G(e,t){let{error:n,response:r}=await O({path:{assistant_id:e,id:t},throwOnError:!1});if(A(r,n,`Failed to run schedule.`),!r.ok)throw new M(r.status,j(n,r,`Failed to run schedule.`))}async function ve(e,t=10){let{data:n,error:r,response:i}=await ee({path:{assistant_id:e},query:{limit:t},throwOnError:!1});if(A(i,r,`Failed to load heartbeat runs.`),!i.ok)throw new M(i.status,j(r,i,`Failed to load heartbeat runs.`));return(n?.runs??[]).map(e=>({id:e.id,jobId:`heartbeat`,status:e.status,startedAt:e.startedAt??e.scheduledFor,finishedAt:e.finishedAt,durationMs:e.durationMs,output:e.skipReason?`Skipped: ${e.skipReason}`:null,error:e.error,conversationId:e.conversationId,conversationExists:e.conversationExists,conversationArchivedAt:e.conversationArchivedAt,estimatedCostUsd:e.estimatedCostUsd,createdAt:e.createdAt}))}async function ye(e,t=10){let{data:n,error:r,response:i}=await S({path:{assistant_id:e},query:{limit:t},throwOnError:!1});if(A(i,r,`Failed to load consolidation runs.`),!i.ok)throw new M(i.status,j(r,i,`Failed to load consolidation runs.`));return(n?.runs??[]).map(e=>({id:e.id,jobId:`consolidation`,status:e.status,startedAt:e.startedAt??e.scheduledFor,finishedAt:e.finishedAt,durationMs:e.durationMs,output:null,error:e.error,conversationId:e.conversationId,conversationExists:e.conversationExists,conversationArchivedAt:e.conversationArchivedAt,estimatedCostUsd:e.estimatedCostUsd,createdAt:e.createdAt}))}async function be(e){let{data:t,error:n,response:r}=await k({path:{assistant_id:e},throwOnError:!1});if(A(r,n,`Failed to load heartbeat config.`),!r.ok||!t)throw new M(r.status,j(n,r,`Failed to load heartbeat config.`));return t}async function K(e,t){let{data:n,error:r,response:i}=await e();if(A(i,r,t),!i.ok||!n)throw new M(i.status,j(r,i,t));return n}async function xe(e,t){return K(()=>re({path:{assistant_id:e},body:t,throwOnError:!1}),`Failed to update heartbeat config.`)}async function Se(e){let{data:t,error:n,response:r}=await D({path:{assistant_id:e},throwOnError:!1});if(A(r,n,`Failed to run heartbeat.`),!r.ok||!t)throw new M(r.status,j(n,r,`Failed to run heartbeat.`));return t}async function Ce(e){let{data:t,error:n,response:r}=await C({path:{assistant_id:e},throwOnError:!1});if(A(r,n,`Failed to load consolidation config.`),!r.ok||!t)throw new M(r.status,j(n,r,`Failed to load consolidation config.`));return t}async function we(e,t){return K(()=>x({path:{assistant_id:e},body:t,throwOnError:!1}),`Failed to update consolidation config.`)}async function Te(e){let{data:t,error:n,response:r}=await b({path:{assistant_id:e},throwOnError:!1});if(A(r,n,`Failed to run consolidation.`),!r.ok||!t)throw new M(r.status,j(n,r,`Failed to run consolidation.`));return t}var q=s(),Ee=[{label:`Every hour`,expression:`0 * * * *`},{label:`Every day at 9am`,expression:`0 9 * * *`},{label:`Every weekday at 9am`,expression:`0 9 * * 1-5`},{label:`Every Monday at 9am`,expression:`0 9 * * 1`},{label:`Every 1st of month, 9am`,expression:`0 9 1 * *`}];function De({isOpen:e,assistantId:t,onClose:n,onCreated:r}){return(0,q.jsx)(h.Root,{open:e,onOpenChange:e=>{e||n()},children:e?(0,q.jsx)(Oe,{assistantId:t,onClose:n,onCreated:r}):null})}function Oe({assistantId:e,onClose:t,onCreated:n}){let[r,i]=(0,V.useState)(``),[a,o]=(0,V.useState)(``),[s,l]=(0,V.useState)(``),[u,d]=(0,V.useState)(``),[m,g]=(0,V.useState)(!1),[_,v]=(0,V.useState)(null),y=r.trim(),b=a.trim(),x=s.trim(),S=y.length>0&&b.length>0&&x.length>0&&!m;return(0,q.jsxs)(h.Content,{size:`md`,children:[(0,q.jsxs)(h.Header,{children:[(0,q.jsx)(h.Title,{children:`Create schedule`}),(0,q.jsx)(h.Description,{children:`Schedule a recurring instruction for your assistant. Runs in execute mode — the message is delivered to the assistant on each fire.`})]}),(0,q.jsxs)(`form`,{onSubmit:async t=>{if(t.preventDefault(),S){g(!0),v(null);try{let t={name:y,expression:b,message:x},r=u.trim();r&&(t.timezone=r),await H(e,t),g(!1),n()}catch(e){v(e instanceof Error?e.message:`Failed to create schedule.`),g(!1)}}},children:[(0,q.jsx)(h.Body,{children:(0,q.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,q.jsx)(p,{label:`Name`,placeholder:`Morning briefing`,value:r,onChange:e=>i(e.target.value),required:!0,autoFocus:!0,fullWidth:!0}),(0,q.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,q.jsx)(p,{label:`Cron expression`,placeholder:`0 9 * * *`,value:a,onChange:e=>o(e.target.value),required:!0,fullWidth:!0,helperText:`Standard 5-field cron (minute hour day month weekday). RRULE expressions are also accepted.`}),(0,q.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:Ee.map(e=>(0,q.jsx)(c,{variant:`outlined`,size:`compact`,type:`button`,onClick:()=>o(e.expression),children:e.label},e.expression))})]}),(0,q.jsx)(p,{label:`Timezone (optional)`,placeholder:`America/New_York`,value:u,onChange:e=>d(e.target.value),fullWidth:!0,helperText:`IANA timezone name. Leave blank to use UTC.`}),(0,q.jsx)(f,{label:`Message`,placeholder:`What should the assistant do on each fire?`,value:s,onChange:e=>l(e.target.value),required:!0,fullWidth:!0,rows:4}),_?(0,q.jsx)(`p`,{className:`text-body-small-default text-[var(--system-negative-strong)]`,children:_}):null]})}),(0,q.jsxs)(h.Footer,{children:[(0,q.jsx)(c,{variant:`outlined`,onClick:t,type:`button`,children:`Cancel`}),(0,q.jsx)(c,{variant:`primary`,type:`submit`,disabled:!S,children:m?`Creating…`:`Create schedule`})]})]})]})}function ke(e=F(),t=Date.now()){return z(`7d`,e,t)}function J(e){return e?new Date(e).toLocaleString(void 0,{month:`short`,day:`numeric`,hour:`numeric`,minute:`2-digit`,hour12:!0}):`—`}function Ae(e){return e==null?`—`:e<1e3?`${e}ms`:`${(e/1e3).toFixed(1)}s`}var je=new Intl.NumberFormat(void 0,{style:`currency`,currency:`USD`,minimumFractionDigits:2,maximumFractionDigits:4});function Y(e){return e==null||!Number.isFinite(e)?`—`:je.format(e)}function Me(e){return`${e.toLocaleString()} ${e===1?`run`:`runs`}`}function Ne(e){return!!e.createdFromConversationId&&e.createdFromConversationExists===!0&&e.createdFromConversationArchivedAt==null}function Pe(e){return!!e.conversationId&&e.conversationExists===!0&&e.conversationArchivedAt==null}function Fe(e){return Ne(e)?e.createdFromConversationId??null:null}function Ie(e){return Pe(e)?e.conversationId??null:null}function Le(e){return typeof e==`string`&&e.length>0}function Re(e){let t=Math.round(e/6e4);return t>=60&&t%60==0?`Every ${t/60} hr`:`Every ${t} min`}function ze(e){if(e.cronExpression)return e.timezone?`Cron: ${e.cronExpression} (${e.timezone})`:`Cron: ${e.cronExpression}`;let t=Re(e.intervalMs);return e.activeHoursStart!=null&&e.activeHoursEnd!=null&&(t+=` (${e.activeHoursStart}:00–${e.activeHoursEnd}:00)`),t}function Be(e){return Re(e.intervalMs)}var X={execute:`positive`,notify:`warning`,script:`neutral`},Z={heartbeat:`system-heartbeat`,consolidation:`system-consolidation`},Q=100;function Ve(e,t){return e&&t}function He(e){switch(e){case Z.heartbeat:return`heartbeat`;case Z.consolidation:return`consolidation`;default:return null}}function $({status:e}){return(0,q.jsx)(`span`,{className:`inline-block h-2 w-2 rounded-full`,style:{backgroundColor:e===`ok`||e===`completed`?`var(--system-positive-strong)`:e===`error`||e===`failed`?`var(--system-negative-strong)`:`var(--content-tertiary)`},"aria-label":e??`unknown`})}function Ue({onCreate:e}){return(0,q.jsxs)(`div`,{className:`flex min-h-[400px] flex-col items-center justify-center rounded-lg border border-[var(--border-subtle)] bg-[var(--surface-lift)] px-6 py-16 text-center`,children:[(0,q.jsx)(`div`,{className:`flex h-12 w-12 items-center justify-center rounded-full bg-[var(--tag-bg-neutral)]`,children:(0,q.jsx)(_,{className:`h-6 w-6 text-[var(--content-faint)]`})}),(0,q.jsx)(`h2`,{className:`mt-4 text-title-small text-[var(--content-default)]`,children:`No schedules`}),(0,q.jsx)(`p`,{className:`mt-1 text-body-medium-lighter text-[var(--content-quiet)]`,children:`Scheduled automations will appear here once created. You can create one yourself or ask your assistant to set it up.`}),(0,q.jsx)(`div`,{className:`mt-4`,children:(0,q.jsxs)(c,{variant:`primary`,onClick:e,children:[(0,q.jsx)(fe,{className:`h-4 w-4`}),`Create schedule`]})})]})}function We({onBack:e}){return(0,q.jsxs)(`div`,{className:`space-y-4`,children:[(0,q.jsxs)(`button`,{type:`button`,onClick:e,className:`flex items-center gap-1.5 text-body-medium-lighter text-[var(--content-secondary)] hover:text-[var(--content-default)] transition-colors`,children:[(0,q.jsx)(L,{className:`h-4 w-4`}),`Back to schedules`]}),(0,q.jsx)(l,{tone:`error`,children:`Schedule not found. It may have been deleted or the link may be out of date.`})]})}function Ge({runs:e,isLoading:t,emptyMessage:n=`No runs yet.`}){let i=r(),[a,o]=(0,V.useState)(null);return(0,q.jsx)(R,{title:`Recent runs`,children:t?(0,q.jsx)(`div`,{className:`flex items-center justify-center py-8`,children:(0,q.jsx)(y,{className:`h-5 w-5 animate-spin text-stone-400`})}):!e||e.length===0?(0,q.jsx)(`p`,{className:`py-4 text-center text-body-medium-lighter text-[var(--content-tertiary)] italic`,children:n}):(0,q.jsx)(`div`,{className:`divide-y divide-[var(--border-base)]`,children:e.map((e,t)=>{let n=Ie(e),r=Le(e.output),s=Le(e.error),c=!n&&(r||s),l=a===e.id,u=`schedule-run-details-${t}`;return(0,q.jsxs)(`div`,{children:[(0,q.jsx)(d,{label:(0,q.jsxs)(`span`,{className:`flex min-w-0 flex-1 items-center gap-3`,children:[(0,q.jsx)($,{status:e.status}),(0,q.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,q.jsx)(`span`,{className:`block text-body-medium-lighter text-[var(--content-default)]`,children:J(e.startedAt)}),(0,q.jsxs)(`span`,{className:`block text-body-small-default text-[var(--content-tertiary)]`,children:[Ae(e.durationMs),` ·`,` `,Y(e.estimatedCostUsd),e.status===`error`&&e.error&&(0,q.jsxs)(`span`,{className:`ml-2 text-[var(--system-negative-strong)]`,children:[e.error.slice(0,80),e.error.length>80?`…`:``]})]})]}),n||c?(0,q.jsx)(v,{className:`h-4 w-4 shrink-0 text-[var(--content-tertiary)] transition-transform ${l?`rotate-90`:``}`}):null]}),onSelect:n?()=>i(N.conversation(n)):c?()=>o(l?null:e.id):void 0,"aria-label":`Run at ${J(e.startedAt)}`,"aria-expanded":c?l:void 0,"aria-controls":c?u:void 0,className:`h-auto py-2.5 gap-3 -mx-2 px-2`}),c&&l?(0,q.jsx)(`div`,{id:u,className:`px-2 pb-3`,children:(0,q.jsxs)(`div`,{className:`space-y-3 rounded-md border border-[var(--border-subtle)] bg-[var(--surface-sunken)] p-3`,children:[r?(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`div`,{className:`mb-1 text-body-small-default text-[var(--content-secondary)]`,children:`Output`}),(0,q.jsx)(`pre`,{className:`max-h-64 overflow-auto whitespace-pre-wrap break-words text-body-small-default font-mono text-[var(--content-default)]`,children:e.output})]}):null,s?(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`div`,{className:`mb-1 text-body-small-default text-[var(--content-secondary)]`,children:`Error`}),(0,q.jsx)(`pre`,{className:`max-h-64 overflow-auto whitespace-pre-wrap break-words text-body-small-default font-mono text-[var(--system-negative-strong)]`,children:e.error})]}):null]})}):null]},e.id)})})})}var Ke=6e4,qe=1,Je=1800;function Ye({schedule:e,assistantId:n,onUpdated:r}){let i=Math.round((e.timeoutMs??Ke)/1e3),[a,o]=(0,V.useState)(!1),[s,l]=(0,V.useState)(String(i)),[u,d]=(0,V.useState)(!1),f=(0,V.useCallback)(()=>{l(String(i)),o(!0)},[i]),m=(0,V.useCallback)(async i=>{d(!0);try{await U(n,e.id,{timeoutMs:i}),o(!1),r()}catch(e){t(e,{context:`schedule_update_timeout`}),g.error(`Failed to update timeout.`)}finally{d(!1)}},[n,e.id,r]),h=(0,V.useCallback)(()=>{let e=Number(s);if(!Number.isInteger(e)||e<qe||e>Je){g.error(`Timeout must be a whole number between ${qe} and ${Je} seconds.`);return}m(e*1e3)},[s,m]);return a?(0,q.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,q.jsx)(`span`,{className:`text-[var(--content-secondary)]`,children:`Timeout`}),(0,q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,q.jsx)(p,{type:`number`,min:qe,max:Je,value:s,onChange:e=>l(e.target.value),className:`w-24`,"aria-label":`Timeout in seconds`}),(0,q.jsx)(`span`,{className:`text-[var(--content-tertiary)]`,children:`sec`}),(0,q.jsx)(c,{size:`compact`,onClick:h,disabled:u,children:u?`Saving…`:`Save`}),(0,q.jsx)(c,{variant:`outlined`,size:`compact`,onClick:()=>o(!1),disabled:u,children:`Cancel`})]})]}):(0,q.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,q.jsx)(`span`,{className:`text-[var(--content-secondary)]`,children:`Timeout`}),(0,q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,q.jsxs)(`span`,{children:[i,`s`,e.timeoutMs==null?` (default)`:``]}),(0,q.jsx)(c,{variant:`outlined`,size:`compact`,onClick:f,children:`Edit`}),e.timeoutMs!=null&&(0,q.jsx)(c,{variant:`outlined`,size:`compact`,onClick:()=>void m(null),disabled:u,children:`Reset`})]})]})}function Xe({schedule:e,assistantId:n,onBack:i,onDeleted:a,onUpdated:s}){let l=r(),{data:d,isLoading:f,refetch:p}=o({queryKey:oe(n,e.id),queryFn:()=>he(n,e.id),staleTime:1e4}),[m,h]=(0,V.useState)(!1),[_,v]=(0,V.useState)(!1),[b,x]=(0,V.useState)(!1),S=(0,V.useCallback)(async()=>{h(!0);try{await G(n,e.id),setTimeout(()=>void p(),1e3)}catch(e){t(e,{context:`schedule_run_now`}),g.error(`Failed to run schedule.`)}finally{h(!1)}},[n,e.id,p]),C=(0,V.useCallback)(async()=>{x(!0);try{await W(n,e.id),a()}catch(e){t(e,{context:`schedule_delete`}),g.error(`Failed to delete schedule.`),x(!1),v(!1)}},[n,e.id,a]),w=Fe(e);return(0,q.jsxs)(`div`,{className:`space-y-4`,children:[(0,q.jsxs)(`button`,{type:`button`,onClick:i,className:`flex items-center gap-1.5 text-body-medium-lighter text-[var(--content-secondary)] hover:text-[var(--content-default)] transition-colors`,children:[(0,q.jsx)(L,{className:`h-4 w-4`}),`Back to schedules`]}),(0,q.jsx)(R,{title:e.name,subtitle:e.description??void 0,accessory:(0,q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,q.jsx)(u,{tone:X[e.mode]??`neutral`,children:e.mode}),(0,q.jsx)(c,{variant:`outlined`,size:`compact`,leftIcon:(0,q.jsx)(de,{className:`h-3.5 w-3.5`}),onClick:()=>l(N.logs.usageForSchedule(e.id)),children:`View usage`}),w?(0,q.jsx)(c,{variant:`outlined`,size:`compact`,leftIcon:(0,q.jsx)(ue,{className:`h-3.5 w-3.5`}),onClick:()=>l(N.conversation(w)),children:`Source`}):null,e.mode===`script`&&(0,q.jsx)(c,{variant:`outlined`,size:`compact`,leftIcon:m?(0,q.jsx)(y,{className:`h-3.5 w-3.5 animate-spin`}):(0,q.jsx)(I,{className:`h-3.5 w-3.5`}),onClick:S,disabled:m,children:m?`Running…`:`Run now`})]}),children:(0,q.jsxs)(`div`,{className:`space-y-2 text-body-medium-lighter`,children:[e.mode===`script`&&e.script&&(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`span`,{className:`text-[var(--content-secondary)] text-body-small-default`,children:`Command`}),(0,q.jsx)(`pre`,{className:`mt-1 rounded-md bg-[var(--surface-sunken)] p-2 text-body-small-default font-mono text-[var(--content-default)] whitespace-pre-wrap break-all`,children:e.script})]}),e.mode===`script`&&(0,q.jsx)(Ye,{schedule:e,assistantId:n,onUpdated:s}),(0,q.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,q.jsx)(`span`,{className:`text-[var(--content-secondary)]`,children:`Status`}),(0,q.jsx)(`span`,{children:e.enabled?`Enabled`:`Disabled`})]}),(0,q.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,q.jsx)(`span`,{className:`text-[var(--content-secondary)]`,children:`Next run`}),(0,q.jsx)(`span`,{children:J(e.nextRunAt)})]}),e.lastRunAt&&(0,q.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,q.jsx)(`span`,{className:`text-[var(--content-secondary)]`,children:`Last run`}),(0,q.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,q.jsx)($,{status:e.lastStatus}),J(e.lastRunAt)]})]})]})}),(0,q.jsx)(Ge,{runs:d,isLoading:f}),(0,q.jsx)(R,{title:`Danger zone`,children:(0,q.jsxs)(`div`,{className:`flex items-center justify-between gap-4`,children:[(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`p`,{className:`text-body-medium-default text-[var(--content-default)]`,children:`Delete this schedule`}),(0,q.jsx)(`p`,{className:`text-body-small-default text-[var(--content-tertiary)]`,children:`Permanently removes the schedule and all its run history. This cannot be undone.`})]}),_?(0,q.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2`,children:[(0,q.jsx)(c,{variant:`ghost`,size:`compact`,onClick:()=>v(!1),disabled:b,children:`Cancel`}),(0,q.jsx)(c,{variant:`danger`,size:`compact`,onClick:()=>void C(),disabled:b,children:b?`Deleting…`:`Yes, delete`})]}):(0,q.jsx)(c,{variant:`dangerOutline`,size:`compact`,leftIcon:(0,q.jsx)(ce,{className:`h-3.5 w-3.5`}),onClick:()=>v(!0),children:`Delete`})]})})]})}function Ze(e,t,n=!0){return{queryKey:P(e,t),queryFn:()=>e?ge(e,ke(t)):Promise.resolve([]),enabled:n,staleTime:1e4}}function Qe(e){return{scheduleId:e,runCount:0,totalEstimatedCostUsd:0,eventCount:0}}function $e(e,t,n){let r=(t??[]).filter(e=>{let t=e.startedAt??e.createdAt;return t>=n.from&&t<=n.to});return{scheduleId:e,runCount:r.length,totalEstimatedCostUsd:r.reduce((e,t)=>{let n=t.estimatedCostUsd;return typeof n==`number`&&Number.isFinite(n)?e+n:e},0),eventCount:0}}function et({scheduleName:e,usage:t,onOpenUsage:n}){if(t.status===`loading`)return(0,q.jsxs)(`div`,{"aria-label":`Loading schedule usage`,className:`flex w-[136px] shrink-0 items-center justify-end gap-3`,children:[(0,q.jsx)(`span`,{className:`h-8 w-14 animate-pulse rounded bg-[var(--surface-muted)]`}),(0,q.jsx)(`span`,{className:`h-8 w-14 animate-pulse rounded bg-[var(--surface-muted)]`})]});let r=t.status===`error`,i=r?`--`:Y(t.summary.totalEstimatedCostUsd),a=r?`--`:Me(t.summary.runCount);return(0,q.jsxs)(`div`,{className:`flex w-[136px] shrink-0 items-center justify-end gap-3 text-right`,children:[n?(0,q.jsxs)(`button`,{type:`button`,onClick:n,"aria-label":`View usage for ${e}`,className:`min-w-[54px] cursor-pointer rounded px-1 py-0.5 text-right transition-colors hover:bg-[var(--surface-hover)]`,children:[(0,q.jsx)(`span`,{className:`block text-label-small-default text-[var(--content-tertiary)]`,children:`Cost`}),(0,q.jsx)(`span`,{className:`block text-body-small-default text-[var(--content-default)]`,children:i})]}):(0,q.jsxs)(`span`,{"aria-label":`Cost for ${e} in the last 7 days: ${i}`,className:`block min-w-[54px] px-1 py-0.5`,children:[(0,q.jsx)(`span`,{className:`block text-label-small-default text-[var(--content-tertiary)]`,children:`Cost`}),(0,q.jsx)(`span`,{className:`block text-body-small-default text-[var(--content-default)]`,children:i})]}),(0,q.jsxs)(`span`,{"aria-label":`Runs for ${e} in the last 7 days: ${a}`,className:`block min-w-[54px] px-1 py-0.5`,children:[(0,q.jsx)(`span`,{className:`block text-label-small-default text-[var(--content-tertiary)]`,children:`Runs`}),(0,q.jsx)(`span`,{className:`block text-body-small-default text-[var(--content-default)]`,children:a})]})]})}function tt({schedule:e,usage:t,onClick:n,onToggle:r,onOpenUsage:i}){return(0,q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3 py-3 first:pt-0 last:pb-0 [&+&]:border-t [&+&]:border-[var(--border-base)]`,children:[(0,q.jsxs)(`button`,{type:`button`,onClick:n,className:`min-w-0 flex-1 text-left`,children:[(0,q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,q.jsx)(`span`,{className:`truncate text-body-medium-default text-[var(--content-default)]`,children:e.name}),(0,q.jsx)(u,{tone:X[e.mode]??`neutral`,children:e.mode})]}),(0,q.jsxs)(`div`,{className:`mt-0.5 flex items-center gap-3 text-body-small-default text-[var(--content-tertiary)]`,children:[(0,q.jsx)(`span`,{className:`truncate`,children:e.description}),e.lastRunAt&&(0,q.jsxs)(`span`,{className:`flex shrink-0 items-center gap-1`,children:[(0,q.jsx)($,{status:e.lastStatus}),J(e.lastRunAt)]})]})]}),(0,q.jsxs)(`div`,{className:`flex shrink-0 items-center gap-3`,children:[(0,q.jsx)(et,{scheduleName:e.name,usage:t,onOpenUsage:i}),(0,q.jsx)(m,{checked:e.enabled,onChange:r,"aria-label":`Toggle ${e.name}`}),(0,q.jsx)(`button`,{type:`button`,onClick:n,"aria-label":`Open ${e.name}`,className:`flex h-7 w-7 cursor-pointer items-center justify-center rounded text-[var(--content-tertiary)] transition-colors hover:bg-[var(--surface-hover)]`,children:(0,q.jsx)(v,{className:`h-4 w-4`})})]})]})}function nt(e){let t=[],n=[];for(let r of e)r.isOneShot?n.push(r):t.push(r);return t.sort((e,t)=>e.enabled===t.enabled?(e.nextRunAt??1/0)-(t.nextRunAt??1/0):e.enabled?-1:1),n.sort((e,t)=>{let n=e.lastRunAt??e.nextRunAt??0;return(t.lastRunAt??t.nextRunAt??0)-n}),{recurring:t,oneTime:n}}function rt({kind:e,assistantId:t,name:n,subtitle:r,enabled:i,nextRunAt:a,lastRunAt:s,isRunning:l,onBack:d,onRunNow:f}){let{data:p,isLoading:m}=o({queryKey:[`system-task-runs`,t,e],queryFn:()=>e===`heartbeat`?ve(t):ye(t),staleTime:1e4});return(0,q.jsxs)(`div`,{className:`space-y-4`,children:[(0,q.jsxs)(`button`,{type:`button`,onClick:d,className:`flex items-center gap-1.5 text-body-medium-lighter text-[var(--content-secondary)] hover:text-[var(--content-default)] transition-colors`,children:[(0,q.jsx)(L,{className:`h-4 w-4`}),`Back to schedules`]}),(0,q.jsx)(R,{title:n,subtitle:r,accessory:(0,q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,q.jsx)(u,{tone:`neutral`,children:`system`}),(0,q.jsx)(c,{variant:`outlined`,size:`compact`,leftIcon:l?(0,q.jsx)(y,{className:`h-3.5 w-3.5 animate-spin`}):(0,q.jsx)(I,{className:`h-3.5 w-3.5`}),onClick:f,disabled:l,children:l?`Running…`:`Run now`})]}),children:(0,q.jsxs)(`div`,{className:`space-y-2 text-body-medium-lighter`,children:[(0,q.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,q.jsx)(`span`,{className:`text-[var(--content-secondary)]`,children:`Status`}),(0,q.jsx)(`span`,{children:i?`Enabled`:`Disabled`})]}),(0,q.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,q.jsx)(`span`,{className:`text-[var(--content-secondary)]`,children:`Next run`}),(0,q.jsx)(`span`,{children:J(a)})]}),(0,q.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,q.jsx)(`span`,{className:`text-[var(--content-secondary)]`,children:`Last run`}),(0,q.jsx)(`span`,{children:J(s)})]})]})}),(0,q.jsx)(Ge,{runs:p,isLoading:m})]})}function it({name:e,subtitle:t,enabled:n,nextRunAt:r,lastRunAt:i,usage:a,showToggle:o,onClick:s,onToggle:c}){return(0,q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3 rounded-md px-2 py-3 transition-colors hover:bg-[var(--surface-hover)] [&+&]:border-t [&+&]:border-[var(--border-base)]`,children:[(0,q.jsxs)(`button`,{type:`button`,onClick:s,"aria-label":`Open ${e}`,className:`flex min-w-0 flex-1 cursor-pointer flex-wrap items-center gap-3 text-left focus:outline-none focus-visible:ring-2 focus-visible:ring-[var(--ring)]`,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)(`span`,{className:`truncate text-body-medium-default text-[var(--content-default)]`,children:e}),(0,q.jsx)(u,{tone:`neutral`,children:`system`})]}),(0,q.jsx)(`div`,{className:`mt-0.5 text-body-small-default text-[var(--content-tertiary)]`,children:t}),(0,q.jsxs)(`div`,{className:`mt-0.5 flex flex-wrap items-center gap-x-3 gap-y-1 text-body-small-default text-[var(--content-tertiary)]`,children:[r?(0,q.jsxs)(`span`,{children:[`Next: `,J(r)]}):null,i?(0,q.jsxs)(`span`,{children:[`Last: `,J(i)]}):null]})]}),(0,q.jsxs)(`div`,{className:`flex shrink-0 flex-wrap items-center justify-end gap-3`,children:[(0,q.jsx)(et,{scheduleName:e,usage:a}),o?null:(0,q.jsx)(`span`,{className:`h-2 w-2 rounded-full`,style:{backgroundColor:n?`var(--system-positive-strong)`:`var(--content-disabled)`},"aria-label":n?`enabled`:`disabled`}),(0,q.jsx)(v,{className:`h-4 w-4 text-[var(--content-tertiary)]`})]})]}),o?(0,q.jsx)(m,{checked:n,onChange:c,"aria-label":`Toggle ${e}`}):null]})}function at({heartbeatConfig:e,consolidationConfig:t,heartbeatUsage:n,consolidationUsage:r,isLoading:i,hasError:a,onRetry:o,onSelectHeartbeat:s,onSelectConsolidation:c,showSystemTaskToggles:u,onToggleHeartbeat:d,onToggleConsolidation:f}){let p=e!=null,m=t?.available===!0;return!i&&!a&&!p&&!m?null:(0,q.jsx)(R,{title:`System`,subtitle:`Built-in jobs managed by the assistant runtime.`,children:i?(0,q.jsx)(`div`,{className:`flex items-center justify-center py-8`,children:(0,q.jsx)(y,{className:`h-5 w-5 animate-spin text-stone-400`})}):a&&!p&&!m?(0,q.jsxs)(l,{tone:`error`,children:[`Failed to load system jobs.`,` `,(0,q.jsx)(`button`,{type:`button`,onClick:o,className:`cursor-pointer underline hover:no-underline`,children:`Retry`})]}):(0,q.jsxs)(`div`,{children:[p?(0,q.jsx)(it,{name:`Heartbeat`,subtitle:ze(e),enabled:e.enabled,nextRunAt:e.nextRunAt,lastRunAt:e.lastRunAt,usage:n,showToggle:u,onClick:s,onToggle:d}):null,m?(0,q.jsx)(it,{name:`Consolidation`,subtitle:Be(t),enabled:t.enabled,nextRunAt:t.nextRunAt,lastRunAt:t.lastRunAt,usage:r,showToggle:u,onClick:c,onToggle:f}):null,a?(0,q.jsx)(`div`,{className:`pt-3 first:pt-0`,children:(0,q.jsxs)(l,{tone:`error`,children:[`Some system jobs failed to load.`,` `,(0,q.jsx)(`button`,{type:`button`,onClick:o,className:`cursor-pointer underline hover:no-underline`,children:`Retry`})]})}):null]})})}function ot(){let e=r(),n=a(),{scheduleId:s}=i(),u=le(),d=Ve(se.use.hasHydrated(),se.use.systemScheduleToggles()),f=pe(),{data:p,isLoading:m,isError:h,refetch:_}=o({queryKey:ae(f),queryFn:()=>me(f),staleTime:1e4}),{data:v,isLoading:b,isError:x}=o(Ze(f,u,s==null)),{data:S,isLoading:C,isError:w,refetch:T}=o({queryKey:[`heartbeat-config`,f],queryFn:()=>be(f),staleTime:1e4}),{data:E,isLoading:ee,isError:te,refetch:D}=o({queryKey:[`consolidation-config`,f],queryFn:()=>Ce(f),staleTime:1e4}),{data:ne,isLoading:re,isError:O,refetch:k}=o({queryKey:[`system-task-runs-summary`,f,`heartbeat`,Q],queryFn:()=>ve(f,Q),enabled:S!=null,staleTime:1e4}),{data:ie,isLoading:A,isError:j,refetch:M}=o({queryKey:[`system-task-runs-summary`,f,`consolidation`,Q],queryFn:()=>ye(f,Q),enabled:E?.available===!0,staleTime:1e4}),P=He(s),[oe,F]=(0,V.useState)(!1),[ce,ue]=(0,V.useState)(!1),[de,I]=(0,V.useState)(!1),z=(0,V.useMemo)(()=>s&&!P?p?.find(e=>e.id===s)??null:null,[p,s,P]),B=(0,V.useMemo)(()=>new Map((v??[]).map(e=>[e.scheduleId,e])),[v]),H=(0,V.useCallback)(e=>b?{status:`loading`}:x?{status:`error`}:{status:`ready`,summary:B.get(e)??Qe(e)},[x,b,B]),U=(0,V.useMemo)(()=>ke(u),[u]),he=(0,V.useMemo)(()=>re?{status:`loading`}:O?{status:`error`}:{status:`ready`,summary:$e(Z.heartbeat,ne,U)},[ne,O,re,U]),ge=(0,V.useMemo)(()=>A?{status:`loading`}:j?{status:`error`}:{status:`ready`,summary:$e(Z.consolidation,ie,U)},[ie,j,A,U]),W=(0,V.useCallback)(()=>{e(N.settings.schedules)},[e]),G=(0,V.useCallback)(t=>{e(N.settings.schedule(t))},[e]),K=(0,V.useCallback)(()=>{F(!1),_(),g.success(`Schedule created.`)},[_]),Ee=(0,V.useCallback)(async(e,n)=>{if(f)try{await _e(f,e,n),_()}catch(e){t(e,{context:`schedule_toggle`}),g.error(`Failed to toggle schedule.`)}},[f,_]),Oe=C||ee,J=w||te,Ae=S!=null||E?.available===!0,je=(0,V.useCallback)(()=>{T(),D(),k(),M()},[D,M,T,k]),Y=(0,V.useCallback)((e,t=!1)=>{if(!f)return;let r=()=>{n.invalidateQueries({queryKey:[`system-task-runs`,f,e]})};r(),t&&(setTimeout(r,1e3),setTimeout(r,5e3))},[f,n]),Me=(0,V.useCallback)(async()=>{if(f){ue(!0);try{let e=await Se(f);T(),Y(`heartbeat`),k(),e.ran?g.success(`Heartbeat started.`):g.info(`Heartbeat skipped.`)}catch(e){t(e,{context:`heartbeat_run_now`}),g.error(`Failed to run heartbeat.`)}finally{ue(!1)}}},[f,T,k,Y]),Ne=(0,V.useCallback)(async e=>{if(f)try{let t=await xe(f,{enabled:e});n.setQueryData([`heartbeat-config`,f],t),g.success(e?`Heartbeat enabled.`:`Heartbeat disabled.`)}catch(e){t(e,{context:`heartbeat_toggle`}),g.error(`Failed to toggle heartbeat.`)}},[f,n]),Pe=(0,V.useCallback)(async()=>{if(f){I(!0);try{let e=await Te(f);D(),Y(`consolidation`,e.ran),M(),e.ran?g.success(`Consolidation queued.`):g.info(`Consolidation already queued or running.`)}catch(e){t(e,{context:`consolidation_run_now`}),g.error(`Failed to run consolidation.`)}finally{I(!1)}}},[f,D,M,Y]),Fe=(0,V.useCallback)(async e=>{if(f)try{let t=await we(f,{enabled:e});n.setQueryData([`consolidation-config`,f],t),g.success(e?`Consolidation enabled.`:`Consolidation disabled.`)}catch(e){t(e,{context:`consolidation_toggle`}),g.error(`Failed to toggle consolidation.`)}},[f,n]),Ie=m,Le=P===`heartbeat`&&C||P===`consolidation`&&ee,Re=P===`heartbeat`&&w||P===`consolidation`&&te;if(P===`heartbeat`&&f&&S)return(0,q.jsx)(rt,{kind:`heartbeat`,assistantId:f,name:`Heartbeat`,subtitle:ze(S),enabled:S.enabled,nextRunAt:S.nextRunAt,lastRunAt:S.lastRunAt,isRunning:ce,onBack:W,onRunNow:Me},`heartbeat`);if(P===`consolidation`&&f&&E?.available===!0)return(0,q.jsx)(rt,{kind:`consolidation`,assistantId:f,name:`Consolidation`,subtitle:Be(E),enabled:E.enabled,nextRunAt:E.nextRunAt,lastRunAt:E.lastRunAt,isRunning:de,onBack:W,onRunNow:Pe},`consolidation`);if(z&&f)return(0,q.jsx)(Xe,{schedule:z,assistantId:f,onBack:W,onDeleted:()=>{W(),_()},onUpdated:()=>void _()},z.id);if(Ie||Le)return(0,q.jsx)(`div`,{className:`w-full`,children:(0,q.jsx)(`div`,{className:`flex min-h-[400px] items-center justify-center`,children:(0,q.jsx)(y,{className:`h-6 w-6 animate-spin text-stone-400`})})});if(h&&!p)return(0,q.jsx)(`div`,{className:`w-full`,children:(0,q.jsxs)(l,{tone:`error`,children:[`Failed to load schedules.`,` `,(0,q.jsx)(`button`,{type:`button`,onClick:()=>void _(),className:`cursor-pointer underline hover:no-underline`,children:`Retry`})]})});if(Re)return(0,q.jsxs)(`div`,{className:`mx-auto max-w-[940px] space-y-3`,children:[(0,q.jsxs)(l,{tone:`error`,children:[`Failed to load`,` `,P===`heartbeat`?`heartbeat`:`consolidation`,` `,`schedule.`,` `,(0,q.jsx)(`button`,{type:`button`,onClick:()=>{P===`heartbeat`?T():D()},className:`cursor-pointer underline hover:no-underline`,children:`Retry`})]}),(0,q.jsxs)(c,{variant:`outlined`,onClick:W,children:[(0,q.jsx)(L,{className:`h-4 w-4`}),`Back to schedules`]})]});if(s!=null)return(0,q.jsx)(We,{onBack:W});if(!p||p.length===0&&!Ae&&!Oe&&!J)return(0,q.jsxs)(`div`,{className:`w-full`,children:[(0,q.jsx)(Ue,{onCreate:()=>F(!0)}),f?(0,q.jsx)(De,{isOpen:oe,assistantId:f,onClose:()=>F(!1),onCreated:K}):null]});let{recurring:X,oneTime:$}=nt(p);return(0,q.jsxs)(`div`,{className:`space-y-4`,children:[(0,q.jsx)(`div`,{className:`flex items-center justify-end`,children:(0,q.jsxs)(c,{variant:`primary`,onClick:()=>F(!0),children:[(0,q.jsx)(fe,{className:`h-4 w-4`}),`New schedule`]})}),x?(0,q.jsx)(l,{tone:`warning`,className:`py-2 text-body-small-default`,children:`Schedule usage stats are unavailable right now.`}):null,X.length>0&&(0,q.jsx)(R,{title:`Schedules`,subtitle:`Recurring automations managed by your assistant.`,children:(0,q.jsx)(`div`,{children:X.map(t=>(0,q.jsx)(tt,{schedule:t,usage:H(t.id),onClick:()=>G(t.id),onToggle:e=>void Ee(t.id,e),onOpenUsage:()=>e(N.logs.usageForSchedule(t.id))},t.id))})}),(0,q.jsx)(at,{heartbeatConfig:S,consolidationConfig:E,heartbeatUsage:he,consolidationUsage:ge,isLoading:Oe,hasError:J,onRetry:je,onSelectHeartbeat:()=>G(Z.heartbeat),onSelectConsolidation:()=>G(Z.consolidation),showSystemTaskToggles:d,onToggleHeartbeat:Ne,onToggleConsolidation:Fe}),$.length>0&&(0,q.jsx)(R,{title:`One-time`,subtitle:`One-shot automations that run once at a scheduled time.`,children:(0,q.jsx)(`div`,{children:$.map(t=>(0,q.jsx)(tt,{schedule:t,usage:H(t.id),onClick:()=>G(t.id),onToggle:e=>void Ee(t.id,e),onOpenUsage:()=>e(N.logs.usageForSchedule(t.id))},t.id))})}),f?(0,q.jsx)(De,{isOpen:oe,assistantId:f,onClose:()=>F(!1),onCreated:K}):null]})}export{ot as SchedulesPage};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{o as e}from"./chunk-jRWAZmH_.js";import{t}from"./react-DJZBPgpf.js";import{d as n,m as r}from"./chunk-5KNZJZUH-B4b1m-Ya.js";import{t as i}from"./jsx-runtime-CVSDxk6A.js";import{t as a}from"./button-DdEh-9f_.js";import{t as o}from"./resolved-assistants-store-ub66utfl.js";import{n as s,r as c}from"./auth-store-oleg80LZ.js";import{i as l}from"./routes-DMbyM_oF.js";import{Jn as u,Ta as d,Za as f,po as p}from"./index-DM63H2B6.js";import{r as m}from"./format-date-lYqfuFdi.js";import{t as h}from"./onboarding-layout-BIVa2BnX.js";import{t as g}from"./use-onboarding-login-CEqnm099.js";var _=e(t(),1),v=i();function y(e){return e.name?e.name:e.isLocal?`Local Assistant`:`Cloud Assistant`}function b(e){if(e.hatchedAt)return`Created ${m(e.hatchedAt)}`}function x(){let e=n(),[t]=r(),i=t.get(`fromLogin`)===`1`,d=c(),f=o.use.assistants(),{loading:p,error:m,login:y,cancel:b}=g(),x=e=>e.isLocal||d,C=f.filter(x),w=f.some(e=>e.isPlatformHosted)&&!d,[T,E]=(0,_.useState)(null),[D,O]=(0,_.useState)(!1),[k,A]=(0,_.useState)(!1),[j,M]=(0,_.useState)(null);(0,_.useEffect)(()=>{T==null&&C.length>0&&E(C[0].id)},[T,C]);let N=async t=>{O(!0),M(null);try{t.isLocal?await s.getState().connectLocalAssistant(t.id):(await u(t.id),await s.getState().connectPlatformAssistant(t.id)),e(l.assistant,{replace:!0})}catch{M(`Failed to connect. Please try again.`),O(!1)}};(0,_.useEffect)(()=>{i||f.length!==0&&f.length===1&&C.length===1&&(A(!0),N(C[0]))},[]);let P=()=>{let e=f.find(e=>e.id===T);e&&N(e)},F=()=>{e(l.onboarding.welcome)},I=m??j;return k&&!I?(0,v.jsx)(h,{children:(0,v.jsx)(`div`,{className:`mx-auto flex min-h-screen w-full max-w-xl flex-col items-center justify-center px-6 text-[var(--content-default)]`,children:(0,v.jsx)(`p`,{className:`text-body-medium-lighter text-[var(--content-tertiary)]`,children:`Connecting to your assistant…`})})}):(0,v.jsx)(h,{children:(0,v.jsxs)(`div`,{className:`mx-auto flex min-h-screen w-full max-w-xl flex-col items-center px-6 pb-40 pt-16 text-[var(--content-default)]`,children:[(0,v.jsx)(`h1`,{className:`text-3xl font-semibold tracking-tight`,style:{animation:`fadeInUp 0.5s ease-out 0.1s both`},children:`Choose an Assistant`}),(0,v.jsx)(`p`,{className:`mt-3 text-body-medium-lighter text-[var(--content-tertiary)]`,style:{animation:`fadeInUp 0.5s ease-out 0.3s both`},children:`Select which assistant you’d like to use.`}),I&&(0,v.jsx)(`p`,{className:`mt-4 text-body-small-default text-[var(--system-negative-strong)]`,children:I}),(0,v.jsx)(`div`,{className:`mt-10 flex w-full flex-col gap-3`,style:{animation:`fadeInUp 0.5s ease-out 0.4s both`},children:f.map(e=>{let t=x(e);return(0,v.jsx)(S,{assistant:e,selected:T===e.id,disabled:!t,badge:!t&&e.isPlatformHosted?`Requires Account`:void 0,onSelect:()=>{t&&E(e.id)}},e.id)})}),(0,v.jsxs)(`div`,{className:`mt-8 flex w-full flex-col gap-2`,style:{animation:`fadeInUp 0.5s ease-out 0.5s both`},children:[C.length>0&&(0,v.jsx)(a,{variant:`primary`,size:`regular`,fullWidth:!0,className:`h-11 text-base`,onClick:P,disabled:!T||D,children:D?`Connecting…`:`Continue`}),(0,v.jsx)(a,{variant:`outlined`,size:`regular`,fullWidth:!0,className:`h-11 text-base`,onClick:()=>void e(`${l.onboarding.hosting}?from=select-assistant`),disabled:D||p,children:`Create New Assistant`}),w&&(0,v.jsx)(a,{variant:`outlined`,size:`regular`,fullWidth:!0,className:`h-11 text-base`,onClick:p?b:()=>void y(),disabled:D,children:p?`Cancel`:`Log In`}),(0,v.jsx)(a,{variant:`outlined`,size:`regular`,fullWidth:!0,className:`h-11 text-base`,onClick:F,disabled:D||p,children:`Back`})]})]})})}function S({assistant:e,selected:t,disabled:n,badge:r,onSelect:i}){let a=b(e);return(0,v.jsxs)(`button`,{type:`button`,onClick:i,disabled:n,className:[`group flex w-full items-center gap-4 rounded-2xl border px-5 py-4 text-left`,`transition-all duration-200 ease-out`,n?`cursor-not-allowed opacity-50`:`cursor-pointer hover:bg-[var(--surface-secondary)]`,t&&!n?`border-[var(--primary-base)] bg-[var(--primary-base)]/[0.08] shadow-[inset_0_0_0_1px_var(--primary-base)]`:`border-[var(--border-element)] bg-transparent`].join(` `),children:[(0,v.jsx)(`div`,{className:[`flex h-10 w-10 shrink-0 items-center justify-center rounded-xl transition-colors duration-200`,t&&!n?`bg-[var(--primary-base)]/15 text-[var(--primary-base)]`:`bg-[var(--surface-tertiary)] text-[var(--content-secondary)]`].join(` `),children:e.isLocal?(0,v.jsx)(d,{className:`h-5 w-5`}):(0,v.jsx)(f,{className:`h-5 w-5`})}),(0,v.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,v.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,v.jsx)(`span`,{className:`text-body-medium-default text-[var(--content-default)]`,children:y(e)}),r&&(0,v.jsx)(`span`,{className:`rounded-full bg-[var(--surface-tertiary)] px-2 py-0.5 text-body-small-default text-[var(--content-tertiary)]`,children:r})]}),a&&(0,v.jsx)(`span`,{className:`mt-0.5 block text-body-small-default text-[var(--content-tertiary)]`,children:a})]}),!n&&(0,v.jsx)(`div`,{className:[`flex h-5 w-5 shrink-0 items-center justify-center rounded-full border-2 transition-all duration-200`,t?`border-[var(--primary-base)] bg-[var(--primary-base)]`:`border-[var(--border-element)] group-hover:border-[var(--content-tertiary)]`].join(` `),children:t&&(0,v.jsx)(p,{className:`h-3 w-3 text-white`,strokeWidth:3})})]})}export{x as SelectAssistantScreen};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{o as e}from"./chunk-jRWAZmH_.js";import{t}from"./react-DJZBPgpf.js";import{i as n,u as r}from"./chunk-5KNZJZUH-B4b1m-Ya.js";import{n as i}from"./QueryClientProvider-DNHWXaGq.js";import{t as a}from"./jsx-runtime-CVSDxk6A.js";import{t as o}from"./typography-Czgs_2w_.js";import{t as s}from"./resolved-assistants-store-ub66utfl.js";import{t as c}from"./is-electron-CavSPgmY.js";import{t as l}from"./loader-circle-BSAFLoPH.js";import{Y as u}from"./auth-store-oleg80LZ.js";import{i as d}from"./routes-DMbyM_oF.js";import{_ as f,g as p,v as m}from"./query-tags-Cez88bzY.js";import{t as h}from"./assistant-feature-flag-store-0382ImYF.js";import{t as g}from"./use-bus-subscription-BuU6xaZz.js";import{$ as _,fr as v,ft as y,nt as b,rr as x}from"./index-DM63H2B6.js";import{n as S,t as C}from"./sidebar-tree-DyEHuZeN.js";var w=e(t(),1);function T(){let e=E(i(),s.use.activeAssistantId());g(`sse.event`,t=>{if(!e)return;let n=t.message;n.type===`sync_changed`&&e.dispatch(n)}),g(`sse.opened`,({cause:t})=>{e&&t!==`fresh`&&e.dispatchReconnect()}),g(`app.resume`,()=>{e&&e.dispatchReconnect()})}function E(e,t){let n=(0,w.useMemo)(()=>{if(!t)return null;let n=b();return n.register(x.assistantConfig,()=>{p(e,t)}),n.register(x.assistantSounds,()=>{m(e,t)}),n.register(x.assistantSchedules,()=>{f(e,t)}),n},[e,t]);return(0,w.useEffect)(()=>{if(n)return()=>n.clear()},[n]),n}var D=a();function O(){let e=s.use.activeAssistantId(),t=u(e=>e.assistantState.kind),i=h.use.settingsDeveloperNav(),a=v.use.platformNotifications(),f=h.use.sounds(),p=y({platformHostedOnly:!0}),m=y(),{pathname:g}=r(),b=(0,w.useMemo)(()=>_.filter(e=>!(e.id===`notifications`&&(!a||p===`gated`)||e.id===`billing`&&m!==`full`||e.id===`devices`&&p===`gated`||e.id===`sounds`&&!f||e.id===`keyboard-shortcuts`&&!c()||e.id===`developer`)),[a,f,p,m]),x=(0,w.useMemo)(()=>i?_.filter(e=>e.id===`developer`):[],[i]),E=(0,w.useMemo)(()=>{if(g===d.settings.root)return`Settings`;let e=_.find(e=>g===e.href||g.startsWith(e.href+`/`));return e?e.label:`Settings`},[g]);return T(),(0,D.jsx)(S,{backHref:d.assistant,sidebar:(0,D.jsx)(C,{items:b,bottomItems:x}),title:E,children:!e||t!==`active`&&t!==`self_hosted`?(0,D.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col items-center justify-center gap-[var(--app-spacing-md)] text-[var(--content-tertiary)]`,role:`status`,"aria-live":`polite`,children:[(0,D.jsx)(l,{className:`size-6 animate-spin`,"aria-hidden":`true`}),(0,D.jsx)(o,{variant:`body-medium-default`,children:`Connecting to your assistant…`})]}):(0,D.jsx)(n,{})})}export{O as SettingsLayout};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{o as e,r as t}from"./chunk-jRWAZmH_.js";import{t as n}from"./react-DJZBPgpf.js";import{T as r}from"./portal-container-DIXEBWUe.js";import{t as i}from"./useMutation-BuofVRHk.js";import{t as a}from"./jsx-runtime-CVSDxk6A.js";import{n as o,t as s}from"./button-DdEh-9f_.js";import{t as c}from"./dropdown-CocFV5yi.js";import{t as l}from"./notice-CF2pptne.js";import{n as u,t as d}from"./input-Cu3PPVCq.js";import{t as f}from"./toggle-CEm3M86o.js";import{t as p}from"./is-electron-CavSPgmY.js";import{t as m}from"./bug-DDEBp29t.js";import{t as h}from"./loader-circle-BSAFLoPH.js";import{t as g}from"./x-BDqbYVtS.js";import{zt as _}from"./sdk.gen-AJllUeDf.js";import{n as v}from"./auth-store-oleg80LZ.js";import{t as y}from"./dist-B4KYfSON.js";import{t as b}from"./impersonate-version-flag-DXEwev6c.js";import{Ca as x,Ea as ee,Yt as te,ca as S,ga as C,or as w,qi as ne,ya as re}from"./index-DM63H2B6.js";var T=e(n(),1),ie=e(r(),1),E=`vellum:debug:`;function D(){let e={};if(typeof window>`u`)return e;try{for(let t=0;t<window.localStorage.length;t++){let n=window.localStorage.key(t);if(n===null||!n.startsWith(E))continue;let r=window.localStorage.getItem(n);r!==null&&(e[n]=r)}}catch{}return e}function O(){return{collectedAt:new Date().toISOString(),resolved:{impersonateAssistantVersion:b()},overrides:D()}}var k=t({ShareFeedbackModal:()=>z}),A=a(),j=[{value:`bug_report`,label:`Bug Report`,icon:m,includesLogsByDefault:!0},{value:`feature_request`,label:`Feature Request`,icon:x,includesLogsByDefault:!1},{value:`other`,label:`Other`,icon:C,includesLogsByDefault:!1}],M=[{value:`past_hour`,label:`Past hour`,cutoffMs:3600*1e3},{value:`past_24_hours`,label:`Past 24 hours`,cutoffMs:1440*60*1e3},{value:`all_time`,label:`All time`,cutoffMs:null}],ae=M.map(e=>({value:e.value,label:e.label})),N=new Set([`image/png`,`image/jpeg`,`image/gif`,`image/webp`,`video/mp4`,`video/quicktime`,`video/webm`]),P=new Set([`png`,`jpg`,`jpeg`,`gif`,`webp`,`mp4`,`mov`,`webm`]),F=10,I=50*1024*1024,oe={bug_report:`bug_report`,feature_request:`feature_request`,other:`other`};function se(){return p()?`macos`:y.getPlatform()===`ios`?`ios`:`web`}function ce(e){if(e.size>I)return!1;if(e.type&&N.has(e.type))return!0;if(!e.type){let t=e.name.split(`.`).pop()?.toLowerCase();return t?P.has(t):!1}return!1}function L(e,t){let n=Math.ceil(t.length/512),r=new Uint8Array(512+n*512),i=new TextEncoder,a=(e,t,n)=>{let a=i.encode(e);r.set(a.slice(0,n),t)},o=(e,t,n)=>{a(e.toString(8).padStart(n-1,`0`)+`\0`,t,n)};a(e,0,100),o(420,100,8),o(0,108,8),o(0,116,8),o(t.length,124,12),o(Math.floor(Date.now()/1e3),136,12);for(let e=148;e<156;e++)r[e]=32;r[156]=48,a(`ustar\0`,257,6),a(`00`,263,2);let s=0;for(let e=0;e<512;e++)s+=r[e];return o(s,148,7),r[155]=32,r.set(t,512),r}async function R(e,t){try{let n={};t.window.startTime!=null&&(n.startTime=t.window.startTime,n.endTime=t.window.endTime),t.activeConversationId&&(n.conversationId=t.activeConversationId);let{data:r,error:i}=await _({path:{assistant_id:e},body:n,parseAs:`blob`,throwOnError:!1});if(i||!(r instanceof Blob))return null;let a=await r.arrayBuffer();return new Uint8Array(a)}catch{return null}}async function le(e,t,n,r){if(typeof CompressionStream>`u`)return null;let i=new Date,a=M.find(t=>t.value===e),o=i.getTime(),s=a?.cutoffMs==null?null:o-a.cutoffMs,c=s==null?null:new Date(s).toISOString(),l=null;try{l=r?.()??null}catch{l=null}let u=w(l),d={collected_at:i.toISOString(),time_range:e,cutoff:c,log_window:{start_time_ms:s,end_time_ms:o},assistant_id:t,active_conversation_id:n,user_agent:typeof navigator<`u`?navigator.userAgent:``,language:typeof navigator<`u`?navigator.language:``,platform:typeof navigator<`u`?navigator.platform:``,url:typeof window<`u`?window.location.href:``,viewport:typeof window<`u`?{width:window.innerWidth,height:window.innerHeight}:null,screen:typeof screen<`u`?{width:screen.width,height:screen.height}:null,connection:typeof navigator<`u`&&`connection`in navigator?{effectiveType:navigator.connection.effectiveType,downlink:navigator.connection.downlink,rtt:navigator.connection.rtt}:null,deviceMemory:typeof navigator<`u`&&`deviceMemory`in navigator?navigator.deviceMemory:null,hardwareConcurrency:typeof navigator<`u`?navigator.hardwareConcurrency:null},f=new TextEncoder().encode(JSON.stringify(d,null,2)),m=new TextEncoder().encode(JSON.stringify(u,null,2)),h=[L(`web-client-context.json`,f),L(`web-chat-diagnostics.json`,m)],g=new TextEncoder().encode(JSON.stringify(O(),null,2));h.push(L(`web-debug-flags.json`,g));try{let e=typeof window<`u`?window._vellumDebug?.chat:null;if(e){let t={clientMessages:e.getClientMessages?.()??null,transcriptItems:e.getTranscriptItems?.()??null,thinkingIndicator:e.thinkingIndicator?.()??null,streamingRing:e.streamingRing?.()??null},n=new TextEncoder().encode(JSON.stringify(t,null,2));h.push(L(`web-chat-debug-api-triage.json`,n))}}catch{}try{let e=typeof window<`u`?window._vellumDebug?.events:null;if(e){let t={focus:typeof document<`u`?{hasFocus:typeof document.hasFocus==`function`?document.hasFocus():null,visibilityState:document.visibilityState}:null,clients:e.getClients().map(({abortSignal:e,...t})=>({...t,aborted:e.aborted})),events:e.getEvents()},n=new TextEncoder().encode(JSON.stringify(t,null,2));h.push(L(`web-sse-liveness-triage.json`,n))}}catch{}if(p()&&window.vellum?.feedback){try{let e=await window.vellum.feedback.diagnostics(),t=new TextEncoder().encode(JSON.stringify(e,null,2));h.push(L(`electron-diagnostics.json`,t))}catch{}try{let e=await window.vellum.feedback.logs();if(e){let t=new TextEncoder().encode(e);h.push(L(`electron-main-logs.txt`,t))}}catch{}}if(t){let e=await R(t,{window:{startTime:s,endTime:o},activeConversationId:n});e&&h.push(L(`platform-logs.tar.gz`,e))}h.push(new Uint8Array(1024));let _=h.reduce((e,t)=>e+t.length,0),v=new Uint8Array(_),y=0;for(let e of h)v.set(e,y),y+=e.length;let b=new Blob([v.buffer]),x=await new Response(b.stream().pipeThrough(new CompressionStream(`gzip`))).blob();return new File([x],`web-client-logs-${i.getTime()}.tar.gz`,{type:`application/gzip`})}function z({open:e,onClose:t,initialReason:n,onSubmitted:r,assistantId:a,assistantVersion:m,activeConversationId:_,getDiagnosticsSnapshot:y}){let b=v.use.user()?.email,x=(0,T.useId)(),C=(0,T.useRef)(null),w=(0,T.useRef)(null),E=(0,T.useRef)(null),D=(0,T.useRef)(null),[O,k]=(0,T.useState)(n??`bug_report`),[M,N]=(0,T.useState)(``),[P,I]=(0,T.useState)(``),[L,R]=(0,T.useState)(j.find(e=>e.value===(n??`bug_report`))?.includesLogsByDefault??!0),[z,B]=(0,T.useState)(!1),[V,H]=(0,T.useState)(`past_hour`),[U,W]=(0,T.useState)([]),[G,K]=(0,T.useState)(null),[fe,q]=(0,T.useState)(!1),[J,Y]=(0,T.useState)(!1),X=i(te()),[pe,Z]=(0,T.useState)(!1),Q=X.isPending||pe,me=!b,he=(0,T.useMemo)(()=>M.trim().length>0&&P.trim().length>0,[M,P]);(0,T.useEffect)(()=>{if(!e)return;let t=n??`bug_report`;k(t),N(``),I(b??``),R(j.find(e=>e.value===t)?.includesLogsByDefault??!0),B(!1),H(`past_hour`),W([]),Y(!1),K(null),Z(!1),X.reset();let r=setTimeout(()=>{b?E.current?.focus():D.current?.focus()},50);return()=>clearTimeout(r)},[e]),(0,T.useEffect)(()=>{if(!e)return;let t=document.body.style.overflow;return document.body.style.overflow=`hidden`,()=>{document.body.style.overflow=t}},[e]);let ge=e=>{k(e),z||R(j.find(t=>t.value===e)?.includesLogsByDefault??!1)},_e=()=>{R(e=>!e),B(!0)},ve=(0,T.useCallback)(e=>{e.key===`Escape`&&!Q&&t()},[t,Q]),ye=(0,T.useCallback)(e=>{e.target===C.current&&!Q&&t()},[t,Q]),$=(0,T.useCallback)(e=>{W(t=>{let n=F-t.length;if(n<=0)return t;let r=new Set(t.map(e=>`${e.name}:${e.size}`)),i=[];for(let t of e){if(i.length>=n)break;if(!ce(t))continue;let e=`${t.name}:${t.size}`;r.has(e)||(r.add(e),i.push(t))}return i.length>0?[...t,...i]:t})},[]),be=e=>{e.target.files&&$(Array.from(e.target.files)),e.target.value=``},xe=e=>{e.preventDefault(),q(!1),e.dataTransfer.files?.length&&$(Array.from(e.dataTransfer.files))},Se=e=>{e.preventDefault(),q(!0)},Ce=e=>{e.preventDefault(),e.currentTarget===e.target&&q(!1)},we=e=>{W(t=>t.filter((t,n)=>n!==e))};return e?(0,ie.createPortal)((0,A.jsx)(`div`,{ref:C,role:`dialog`,"aria-modal":`true`,"aria-labelledby":x,className:`fixed inset-0 z-50 flex items-center justify-center bg-black/50`,onKeyDown:ve,onClick:ye,onDrop:xe,onDragOver:Se,onDragLeave:Ce,children:(0,A.jsxs)(`div`,{className:`mx-4 flex w-full max-w-lg flex-col rounded-xl border p-6 shadow-xl`,style:{backgroundColor:`var(--surface-lift)`,borderColor:`var(--border-base)`,maxHeight:`calc(100vh - 2rem)`},children:[(0,A.jsxs)(`div`,{className:`flex items-center justify-between border-b pb-4`,style:{borderColor:`var(--border-subtle)`},children:[(0,A.jsx)(`h2`,{id:x,className:`!m-0 text-title-small text-[var(--content-default)]`,children:`Share Feedback`}),(0,A.jsx)(s,{variant:`ghost`,iconOnly:(0,A.jsx)(g,{}),onClick:t,disabled:Q,"aria-label":`Close`,tintColor:`var(--content-secondary)`})]}),(0,A.jsxs)(`div`,{className:`flex flex-col gap-3.5 overflow-y-auto pt-4 ${Q?`pointer-events-none opacity-60`:``}`,children:[me&&(0,A.jsx)(d,{id:`${x}-email`,ref:D,label:`Email`,type:`email`,placeholder:`you@example.com`,value:P,onChange:e=>I(e.target.value),leftIcon:(0,A.jsx)(re,{className:`h-4 w-4`,"aria-hidden":!0}),fullWidth:!0}),(0,A.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,A.jsx)(`span`,{className:`text-body-small-default text-[var(--content-secondary)]`,children:`Category`}),(0,A.jsx)(`div`,{className:`flex gap-2`,children:j.map(e=>(0,A.jsx)(ue,{option:e,isSelected:O===e.value,onSelect:()=>ge(e.value)},e.value))})]}),(0,A.jsx)(`hr`,{className:`border-[var(--border-subtle)]`}),O===`bug_report`&&(0,A.jsxs)(l,{tone:`info`,children:[`Tip: Get faster support by posting in our`,` `,(0,A.jsx)(`a`,{href:`https://vellum.ai/community`,target:`_blank`,rel:`noopener noreferrer`,className:`underline text-[var(--content-default)]`,children:`Discord community`})]}),O===`feature_request`&&(0,A.jsxs)(l,{tone:`info`,children:[`Tip: Vote on features on our`,` `,(0,A.jsx)(`a`,{href:`https://vellum.ai/roadmap`,target:`_blank`,rel:`noopener noreferrer`,className:`underline text-[var(--content-default)]`,children:`public roadmap`})]}),(0,A.jsx)(u,{id:`${x}-message`,ref:E,label:O===`bug_report`?`What went wrong?`:O===`feature_request`?`Describe your idea`:`What's on your mind?`,rows:3,placeholder:O===`bug_report`?`What did you expect to happen, and what happened instead?`:O===`feature_request`?`What problem would this solve for you?`:`Share your thoughts...`,value:M,onChange:e=>N(e.target.value),fullWidth:!0}),O!==`feature_request`&&(0,A.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,A.jsxs)(`div`,{className:`flex items-center gap-2.5`,children:[(0,A.jsxs)(`label`,{className:`flex cursor-pointer items-center gap-2.5`,children:[(0,A.jsx)(f,{checked:L,onChange:_e,"aria-label":`Include browser diagnostics`}),(0,A.jsx)(`span`,{className:`text-body-medium-lighter leading-6 text-[var(--content-default)]`,children:`Include diagnostics`})]}),(0,A.jsx)(o,{content:`Diagnostics include browser context, assistant logs, and timestamps — never passwords or credentials.`,children:(0,A.jsx)(`button`,{type:`button`,"aria-label":`About diagnostics`,className:`inline-flex items-center justify-center text-[var(--content-tertiary)]`,children:(0,A.jsx)(ee,{className:`h-3.5 w-3.5`})})})]}),L&&(0,A.jsx)(c,{options:ae,value:V,onChange:H,"aria-label":`Diagnostics time range`})]}),p()&&_&&O!==`feature_request`&&(0,A.jsxs)(`label`,{className:`flex cursor-pointer items-center gap-2.5`,children:[(0,A.jsx)(f,{checked:J,onChange:()=>Y(e=>!e),"aria-label":`Include the most recent conversation`}),(0,A.jsx)(`span`,{className:`text-body-medium-lighter leading-6 text-[var(--content-default)]`,children:`Include the most recent conversation`})]}),(0,A.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,A.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,A.jsxs)(`span`,{className:`text-body-small-default text-[var(--content-secondary)]`,children:[`Attachments`,U.length>0&&(0,A.jsxs)(`span`,{className:`text-[var(--content-tertiary)]`,children:[` · `,U.length,`/`,F]})]}),(0,A.jsx)(s,{variant:`outlined`,size:`compact`,leftIcon:(0,A.jsx)(S,{}),onClick:()=>w.current?.click(),disabled:U.length>=F,children:`Add files`}),(0,A.jsx)(`input`,{ref:w,type:`file`,multiple:!0,accept:`image/png,image/jpeg,image/gif,image/webp,video/mp4,video/quicktime,video/webm`,onChange:be,className:`hidden`})]}),U.length>0&&(0,A.jsx)(`div`,{className:`flex gap-2 overflow-x-auto`,children:U.map((e,t)=>(0,A.jsx)(de,{file:e,onRemove:()=>we(t)},`${e.name}-${t}`))}),fe&&(0,A.jsx)(`p`,{className:`text-body-small-default text-[var(--content-tertiary)]`,children:`Drop files to attach…`})]}),G&&(0,A.jsx)(`p`,{className:`text-body-medium-lighter text-[var(--system-negative-strong)]`,children:G})]}),(0,A.jsx)(`div`,{className:`mt-4 flex items-center justify-end gap-2 border-t pt-4`,style:{borderColor:`var(--border-subtle)`},children:Q?(0,A.jsxs)(`span`,{className:`inline-flex items-center gap-2 text-body-medium-lighter text-[var(--content-secondary)]`,children:[(0,A.jsx)(h,{className:`h-4 w-4 animate-spin`}),`Sending feedback…`]}):(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(s,{variant:`ghost`,onClick:t,children:`Cancel`}),(0,A.jsx)(s,{variant:`primary`,leftIcon:(0,A.jsx)(ne,{}),onClick:async()=>{if(!(!he||Q)){K(null),Z(!0);try{let e=L&&O!==`feature_request`?await le(V,a??null,p()?J?_??null:null:_??null,y):null;await X.mutateAsync({headers:{"Content-Type":null},body:{message:M.trim(),classification:oe[O],email:P.trim(),client:se(),client_version:void 0,...a?{assistant_id:a}:{},...m?{assistant_version:m}:{},...e?{logs_file:e}:{},...U.length?{attachments:U}:{}},bodySerializer:e=>{let t=new FormData;for(let[n,r]of Object.entries(e))if(r!=null){if(n===`attachments`&&Array.isArray(r)){for(let e of r)t.append(`attachments`,e);continue}r instanceof Blob?t.append(n,r):t.append(n,String(r))}return t}}),r?.(),t()}catch(e){K(e instanceof Error?e.message:`Failed to submit feedback. Please try again.`)}finally{Z(!1)}}},disabled:!he,children:`Submit`})]})})]})}),document.body):null}function ue({option:e,isSelected:t,onSelect:n}){let r=e.icon;return(0,A.jsxs)(`button`,{type:`button`,onClick:n,"aria-pressed":t,className:`flex items-center gap-1.5 rounded-full border px-3 py-1.5 text-left transition-colors`,style:{borderColor:t?`var(--primary-base)`:`var(--border-base)`,backgroundColor:t?`color-mix(in oklab, var(--primary-base) 10%, transparent)`:`transparent`},children:[(0,A.jsx)(r,{className:`h-3.5 w-3.5 shrink-0`,style:{color:t?`var(--primary-base)`:`var(--content-secondary)`}}),(0,A.jsx)(`span`,{className:`text-body-small-default`,style:{color:t?`var(--primary-base)`:`var(--content-default)`},children:e.label})]})}function de({file:e,onRemove:t}){let n=e.type.startsWith(`image/`),r=(0,T.useMemo)(()=>n?URL.createObjectURL(e):null,[e,n]);return(0,T.useEffect)(()=>{if(r)return()=>URL.revokeObjectURL(r)},[r]),(0,A.jsxs)(`div`,{className:`relative flex h-16 w-16 shrink-0 items-center justify-center overflow-hidden rounded-lg border border-[var(--border-base)] bg-[var(--surface-base)]`,title:e.name,children:[n&&r?(0,A.jsx)(`img`,{src:r,alt:e.name,className:`h-full w-full object-cover`}):(0,A.jsx)(S,{className:`h-5 w-5 text-[var(--content-secondary)]`}),(0,A.jsx)(s,{variant:`ghost`,size:`compact`,iconOnly:(0,A.jsx)(g,{}),onClick:t,"aria-label":`Remove ${e.name}`,className:`absolute top-0.5 right-0.5 h-4 w-4 rounded-full bg-black/60 text-white hover:bg-black/70`,tintColor:`#fff`})]})}export{k as n,z as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{o as e}from"./chunk-jRWAZmH_.js";import{a as t,t as n}from"./local-settings-lVNyIOJ_.js";import{t as r}from"./react-DJZBPgpf.js";import{T as i}from"./portal-container-DIXEBWUe.js";import{m as a}from"./chunk-5KNZJZUH-B4b1m-Ya.js";import{n as o}from"./QueryClientProvider-DNHWXaGq.js";import{t as s}from"./useQuery-D2zf6Uhu.js";import{t as c}from"./useMutation-BuofVRHk.js";import{t as l}from"./jsx-runtime-CVSDxk6A.js";import{t as u}from"./button-DdEh-9f_.js";import{t as d}from"./card-CL5iEMJO.js";import{t as f}from"./menu-B79-l6IU.js";import"./src-hn7lwVCD.js";import{t as p}from"./confirm-dialog-NYG-K9zN.js";import{n as m,r as h,t as g}from"./panel-item-FzMfzMJA.js";import{t as _}from"./input-Cu3PPVCq.js";import{n as v}from"./stat-square-sRJmexc-.js";import{t as y}from"./createLucideIcon-D6d6iDdi.js";import{a as b,c as x,i as S,n as C,o as w,r as T,s as E,t as D}from"./install-Db4K638M.js";import{t as O}from"./calendar-CP_Q3Aw6.js";import{t as k}from"./globe-ByNYDdSW.js";import{t as A}from"./link-2-BHdo-6Lp.js";import{t as j}from"./loader-circle-BSAFLoPH.js";import{t as M}from"./x-BDqbYVtS.js";import{F as N,I as ee,L as te,M as ne,N as P,P as F}from"./react-query.gen-B8xaBreR.js";import{n as re}from"./use-is-mobile-D_xrnINF.js";import{$a as I,Ai as L,Di as R,Hi as ie,Ia as z,Ji as B,Ki as V,Mi as H,Na as U,Ni as W,Si as G,Xa as K,bo as q,fo as ae,ga as oe,ka as se,la as ce,lo as J,pa as le,po as ue,wa as Y,ya as de,yo as fe,za as pe,zi as me}from"./index-DM63H2B6.js";import{t as he}from"./use-active-assistant-id-BIhArlF_.js";import{n as ge,t as _e}from"./file-markdown-DX5x9ziL.js";var ve=y(`funnel`,[[`path`,{d:`M10 20a1 1 0 0 0 .553.895l2 1A1 1 0 0 0 14 21v-7a2 2 0 0 1 .517-1.341L21.74 4.67A1 1 0 0 0 21 3H3a1 1 0 0 0-.742 1.67l7.225 7.989A2 2 0 0 1 10 14z`,key:`sc7q7i`}]]),ye=y(`palette`,[[`path`,{d:`M12 22a1 1 0 0 1 0-20 10 9 0 0 1 10 9 5 5 0 0 1-5 5h-2.25a1.75 1.75 0 0 0-1.4 2.8l.3.4a1.75 1.75 0 0 1-1.4 2.8z`,key:`e79jfc`}],[`circle`,{cx:`13.5`,cy:`6.5`,r:`.5`,fill:`currentColor`,key:`1okk4w`}],[`circle`,{cx:`17.5`,cy:`10.5`,r:`.5`,fill:`currentColor`,key:`f64h9f`}],[`circle`,{cx:`6.5`,cy:`12.5`,r:`.5`,fill:`currentColor`,key:`qy21gx`}],[`circle`,{cx:`8.5`,cy:`7.5`,r:`.5`,fill:`currentColor`,key:`fotxhn`}]]),X=e(r(),1),be={mail:de,calendar:O,"message-circle":oe,globe:k,zap:G,code:K,mic:le,"shopping-cart":ie,palette:ye,heart:se,settings:V,"link-2":A};function xe(e){return be[e]}var Z=l();function Se({selected:e,onSelect:t,counts:n,totalCount:r,showCounts:i,categories:a}){let o=[...a].sort((e,t)=>e.label.localeCompare(t.label));return(0,Z.jsxs)(`nav`,{className:`flex flex-col gap-1`,"aria-label":`Skill categories`,children:[(0,Z.jsx)(Ce,{icon:Y,label:`All`,count:r,isActive:e===null,showCount:i,onClick:()=>t(null)}),o.map(r=>(0,Z.jsx)(Ce,{icon:xe(r.icon)??Y,label:r.label,count:n[r.slug]??0,isActive:e===r.slug,showCount:i,onClick:()=>t(r.slug)},r.slug))]})}function Ce({icon:e,label:t,count:n,isActive:r,showCount:i,onClick:a}){return(0,Z.jsxs)(u,{variant:`ghost`,onClick:a,"aria-pressed":r,className:`h-auto justify-between gap-3 rounded-lg border-0 bg-transparent px-3 py-2 text-left hover:bg-[var(--ghost-hover)]`,style:{backgroundColor:r?`var(--surface-active)`:void 0,color:r?`var(--content-default)`:`var(--content-secondary)`},children:[(0,Z.jsxs)(`span`,{className:`flex items-center gap-2.5`,children:[(0,Z.jsx)(e,{className:`h-4 w-4 shrink-0`,"aria-hidden":!0}),(0,Z.jsx)(`span`,{className:`text-body-medium-default`,children:t})]}),i&&(0,Z.jsx)(`span`,{className:`text-body-small-default`,style:{color:`var(--content-tertiary)`},children:n})]})}var we=e(i(),1);function Te(e,t){return t??e.find(e=>e.name===`SKILL.md`)?.path??null}function Ee(e,t){let[n,r]=(0,X.useState)(null),i=s({...F({path:{assistant_id:e,id:t}}),select:e=>e??null}),a=(0,X.useMemo)(()=>i.data?.files??[],[i.data]),o=(0,X.useMemo)(()=>a.find(e=>e.name===`SKILL.md`),[a]),c=Te(a,n),l=s({...P({path:{assistant_id:e,id:t},query:{path:c??``}}),select:e=>e??null,enabled:!!c});return{fileEntries:a,skillMd:o,selectedPath:n,setSelectedPath:r,activePath:c,activeFile:a.find(e=>e.path===c),isFilesLoading:i.isLoading,fileContent:l.data?.content??null,isBinary:!!l.data?.isBinary,isContentLoading:l.isLoading}}function De({fileName:e,content:t,isBinary:n,viewMode:r=`preview`}){return n?(0,Z.jsx)(`p`,{className:`flex h-full items-center justify-center text-body-medium-lighter`,style:{color:`var(--content-tertiary)`},children:`Binary file — no preview available.`}):t===null?(0,Z.jsxs)(`p`,{className:`flex h-full items-center justify-center text-body-medium-lighter`,style:{color:`var(--content-tertiary)`},children:[`No preview available for `,e,`.`]}):ge(e,void 0)&&r===`preview`?(0,Z.jsx)(`div`,{className:`h-full overflow-auto px-6 py-4`,style:{color:`var(--content-default)`},children:(0,Z.jsx)(_e,{content:t})}):(0,Z.jsx)(`pre`,{className:`h-full overflow-y-auto whitespace-pre-wrap break-words p-4 font-mono text-body-small-default`,style:{color:`var(--content-default)`},children:t})}function Oe({assistantId:e,skill:t,onBack:n,onInstall:r,onRemove:i,isInstalling:a=!1,isRemoving:o=!1}){let s=T(t),c=b(t),{fileEntries:l,setSelectedPath:f,activePath:p,activeFile:m,isFilesLoading:h,fileContent:g,isBinary:_,isContentLoading:y}=Ee(e,t.id),[x,S]=(0,X.useState)(`preview`);(0,X.useEffect)(()=>{S(`preview`)},[p]);let[C,D]=(0,X.useState)(null);(0,X.useEffect)(()=>{D(document.getElementById(`viewport-overlays`))},[]);let O=m?ge(m.name,void 0):!1,k=O?x:`raw`,A=(0,Z.jsxs)(`div`,{className:`fixed inset-0 z-40 flex flex-col overflow-hidden bg-[var(--surface-overlay)]`,style:{paddingTop:`calc(8px + var(--safe-area-inset-top, env(safe-area-inset-top, 0px)))`,paddingBottom:`calc(8px + var(--safe-area-inset-bottom, env(safe-area-inset-bottom, 0px)))`,paddingLeft:`calc(12px + var(--safe-area-inset-left, env(safe-area-inset-left, 0px)))`,paddingRight:`calc(12px + var(--safe-area-inset-right, env(safe-area-inset-right, 0px)))`},children:[(0,Z.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,Z.jsx)(u,{variant:`ghost`,iconOnly:(0,Z.jsx)(fe,{"aria-hidden":!0}),expandOnMobile:!0,"aria-label":`Back to skills`,onClick:n,className:`max-md:bg-[var(--surface-active)]`}),(0,Z.jsx)(`span`,{className:`min-w-0 flex-1 truncate px-2 text-center text-body-medium-default`,style:{color:`var(--content-secondary)`},children:t.name}),(0,Z.jsx)(ke,{available:s,removable:c,isInstalling:a,isRemoving:o,onInstall:r,onRemove:i})]}),(0,Z.jsxs)(`div`,{className:`mt-4 flex flex-col gap-2`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,Z.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,Z.jsx)(E,{skill:t,className:`h-6 w-6 shrink-0 text-[22px] leading-none`}),(0,Z.jsx)(`h2`,{className:`min-w-0 truncate text-title-medium`,style:{color:`var(--content-emphasised)`},children:t.name})]}),(0,Z.jsx)(w,{origin:t.origin})]}),(0,Z.jsx)(`p`,{className:`text-body-medium-lighter`,style:{color:`var(--content-tertiary)`},children:t.description})]}),(0,Z.jsx)(d.Root,{asChild:!0,noPadding:!0,children:(0,Z.jsxs)(`div`,{className:`mt-6 flex min-h-0 flex-1 flex-col overflow-hidden rounded-2xl border bg-[var(--surface-lift)]`,style:{borderColor:`var(--border-hover)`},children:[(0,Z.jsxs)(`div`,{className:`flex items-center justify-between gap-2 border-b px-3 py-2`,style:{borderColor:`var(--border-hover)`},children:[(0,Z.jsx)(je,{fileEntries:l,activePath:p,activeName:m?.name??null,onSelect:f}),(0,Z.jsx)(v,{iconOnly:!0,ariaLabel:`File view mode`,value:k,onChange:S,items:[{value:`preview`,label:`Preview`,icon:(0,Z.jsx)(pe,{"aria-hidden":!0}),disabled:!O},{value:`raw`,label:`Source`,icon:(0,Z.jsx)(K,{"aria-hidden":!0})}]})]}),(0,Z.jsx)(`div`,{className:`min-h-0 flex-1 overflow-hidden`,children:h||y?(0,Z.jsx)(`div`,{className:`flex h-full items-center justify-center`,children:(0,Z.jsx)(j,{className:`h-6 w-6 animate-spin`,style:{color:`var(--content-tertiary)`}})}):m?(0,Z.jsx)(De,{fileName:m.name,content:g,isBinary:_,viewMode:k}):(0,Z.jsx)(`p`,{className:`flex h-full items-center justify-center text-body-medium-lighter`,style:{color:`var(--content-tertiary)`},children:`Select a file to view its contents.`})})]})})]});return C?(0,we.createPortal)(A,C):A}function ke({available:e,removable:t,isInstalling:n,isRemoving:r,onInstall:i,onRemove:a}){return n||r?(0,Z.jsx)(u,{variant:`ghost`,iconOnly:(0,Z.jsx)(j,{className:`animate-spin`,"aria-hidden":!0}),expandOnMobile:!0,disabled:!0,"aria-label":`Pending`,className:`max-md:bg-[var(--surface-active)]`}):e?(0,Z.jsx)(u,{variant:`ghost`,iconOnly:(0,Z.jsx)(q,{"aria-hidden":!0}),expandOnMobile:!0,"aria-label":`Install skill`,onClick:i,disabled:!i,className:`max-md:bg-[var(--surface-active)]`}):t?(0,Z.jsx)(u,{variant:`dangerGhost`,iconOnly:(0,Z.jsx)(H,{"aria-hidden":!0}),expandOnMobile:!0,"aria-label":`Remove skill`,onClick:a,disabled:!a,className:`max-md:rounded-full max-md:bg-[var(--system-negative-weak)]`}):(0,Z.jsx)(u,{variant:`dangerGhost`,iconOnly:(0,Z.jsx)(H,{"aria-hidden":!0}),expandOnMobile:!0,disabled:!0,title:`Bundled skills cannot be removed`,"aria-label":`Bundled skill cannot be removed`,className:`max-md:rounded-full max-md:bg-[var(--system-negative-weak)]`})}function Ae(e){return(e??``).endsWith(`/directory`)}function je({fileEntries:e,activePath:t,activeName:n,onSelect:r}){let i=n??`Select a file`;return e.length===0?(0,Z.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2 text-body-medium-default`,style:{color:`var(--content-emphasised)`},children:[(0,Z.jsx)(Me,{}),(0,Z.jsx)(`span`,{className:`truncate`,children:i})]}):(0,Z.jsxs)(f.Root,{children:[(0,Z.jsx)(f.Trigger,{children:(0,Z.jsxs)(`button`,{type:`button`,className:`flex min-w-0 items-center gap-2 rounded-md text-body-medium-default`,style:{color:`var(--content-emphasised)`},children:[(0,Z.jsx)(Me,{}),(0,Z.jsx)(`span`,{className:`truncate`,children:i}),(0,Z.jsx)(ae,{className:`h-4 w-4 shrink-0`,style:{color:`var(--content-tertiary)`},"aria-hidden":!0})]})}),(0,Z.jsx)(f.Content,{align:`start`,children:e.map(e=>{let n=Ae(e.mimeType);return(0,Z.jsx)(f.Item,{onSelect:()=>r(e.path),leftIcon:n?(0,Z.jsx)(U,{}):(0,Z.jsx)(z,{}),"aria-current":e.path===t?`true`:void 0,children:e.name},e.path)})})]})}function Me(){return(0,Z.jsx)(`span`,{className:`flex h-6 w-6 shrink-0 items-center justify-center rounded-md bg-[var(--surface-base)]`,"aria-hidden":!0,children:(0,Z.jsx)(z,{className:`h-4 w-4`,style:{color:`var(--content-secondary)`}})})}var Ne=[{value:`all`,label:`All`,icon:Y},{value:`installed`,label:`Installed`,icon:J},{value:`available`,label:`Available`,icon:q}],Pe=[{value:`vellum`,label:`Vellum`,icon:x},{value:`clawhub`,label:`Clawhub`,icon:k},{value:`skillssh`,label:`skills.sh`,icon:W},{value:`custom`,label:`Custom`,icon:R}];function Fe({search:e,onSearchChange:t,filter:n,onFilterChange:r,isSearching:i,categories:a,category:o,onCategoryChange:s,counts:c,totalCount:l,showCounts:u}){return(0,Z.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,Z.jsx)(_,{type:`search`,value:e,onChange:e=>{t(e.target.value)},placeholder:`Search skills`,"aria-label":`Search skills`,leftIcon:(0,Z.jsx)(B,{className:`h-4 w-4`,"aria-hidden":!0}),rightIcon:i?(0,Z.jsx)(j,{className:`h-4 w-4 animate-spin`,"aria-hidden":!0}):void 0,fullWidth:!0,wrapperClassName:`flex-1`}),(0,Z.jsx)(Ie,{filter:n,onFilterChange:r,categories:a,category:o,onCategoryChange:s,counts:c,totalCount:l,showCounts:u})]})}function Ie(e){let t=re(),[n,r]=(0,X.useState)(!1),i=(0,Z.jsx)(u,{type:`button`,variant:`outlined`,iconOnly:(0,Z.jsx)(ve,{"aria-hidden":!0}),"aria-label":`Filter skills`,"aria-haspopup":t?`dialog`:`listbox`,"aria-expanded":n,tintColor:`var(--primary-base)`});return t?(0,Z.jsx)(Le,{...e,open:n,onOpenChange:r,trigger:i}):(0,Z.jsxs)(h.Root,{open:n,onOpenChange:r,children:[(0,Z.jsx)(h.Trigger,{asChild:!0,children:i}),(0,Z.jsx)(h.Content,{align:`end`,sideOffset:4,className:`w-44 overflow-hidden p-0`,children:(0,Z.jsxs)(`ul`,{role:`listbox`,children:[(0,Z.jsx)(Re,{label:`Status`,options:Ne,selected:e.filter,onSelect:t=>{e.onFilterChange(t),r(!1)}}),(0,Z.jsx)(`div`,{className:`border-t`,style:{borderColor:`var(--border-base)`}}),(0,Z.jsx)(Re,{label:`Source`,options:Pe,selected:e.filter,onSelect:t=>{e.onFilterChange(t),r(!1)}})]})})]})}function Le({filter:e,onFilterChange:t,categories:n,category:r,onCategoryChange:i,counts:a,totalCount:o,showCounts:s,open:c,onOpenChange:l,trigger:d}){let f=[...n].sort((e,t)=>e.label.localeCompare(t.label));return(0,Z.jsxs)(m.Root,{open:c,onOpenChange:l,children:[(0,Z.jsx)(m.Trigger,{asChild:!0,children:d}),(0,Z.jsxs)(m.Content,{className:`max-h-[85dvh]`,"aria-describedby":void 0,children:[(0,Z.jsx)(`div`,{"aria-hidden":!0,className:`mx-auto mb-3 h-1 w-9 shrink-0 rounded-full bg-[var(--border-element)]`}),(0,Z.jsx)(m.Header,{children:(0,Z.jsx)(m.Title,{children:`Filters`})}),(0,Z.jsxs)(m.Body,{className:`flex flex-col gap-3 pt-2`,children:[(0,Z.jsx)(Q,{label:`Status`,children:Ne.map(n=>(0,Z.jsx)($,{icon:n.icon,label:n.label,active:e===n.value,onSelect:()=>t(n.value)},n.value))}),(0,Z.jsx)(Q,{label:`Source`,children:Pe.map(n=>(0,Z.jsx)($,{icon:n.icon,label:n.label,active:e===n.value,onSelect:()=>t(n.value)},n.value))}),(0,Z.jsxs)(Q,{label:`Categories`,children:[(0,Z.jsx)($,{icon:Y,label:`All`,active:r===null,badge:s?o:void 0,onSelect:()=>i(null)}),f.map(e=>(0,Z.jsx)($,{icon:xe(e.icon)??Y,label:e.label,active:r===e.slug,badge:s?a[e.slug]??0:void 0,onSelect:()=>i(e.slug)},e.slug))]})]}),(0,Z.jsx)(m.Footer,{children:(0,Z.jsx)(u,{type:`button`,variant:`primary`,fullWidth:!0,onClick:()=>l(!1),children:`Done`})})]})]})}function Q({label:e,children:t}){return(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`div`,{className:`px-2 pb-1 text-body-small-default uppercase tracking-wide`,style:{color:`var(--content-tertiary)`},children:e}),t]})}function $({icon:e,label:t,active:n,badge:r,onSelect:i}){return(0,Z.jsx)(g,{icon:e,label:t,active:n,activeVariant:`branded`,badge:r,trailingAction:n&&r==null?(0,Z.jsx)(ue,{className:`h-4 w-4 text-[var(--primary-base)]`,"aria-hidden":!0}):void 0,onSelect:i})}function Re({label:e,options:t,selected:n,onSelect:r}){return(0,Z.jsxs)(`li`,{children:[(0,Z.jsx)(`div`,{className:`px-3 pb-1 pt-2 text-body-small-default uppercase tracking-wide`,style:{color:`var(--content-tertiary)`},children:e}),(0,Z.jsx)(`ul`,{children:t.map(e=>{let t=e.icon,i=n===e.value;return(0,Z.jsx)(`li`,{children:(0,Z.jsxs)(`button`,{type:`button`,onClick:()=>r(e.value),role:`option`,"aria-selected":i,className:`flex w-full items-center gap-2 px-3 py-1.5 text-left text-body-medium-lighter transition-colors hover:bg-[var(--surface-hover)]`,style:{color:i?`var(--primary-base)`:`var(--content-default)`},children:[(0,Z.jsx)(t,{className:`h-4 w-4`,"aria-hidden":!0}),(0,Z.jsx)(`span`,{className:`flex-1`,children:e.label}),i&&(0,Z.jsx)(J,{className:`h-3.5 w-3.5`,"aria-hidden":!0})]})},e.value)})})]})}function ze({skill:e,onSelect:t,onInstall:n,onRemove:r,isInstalling:i=!1,isRemoving:a=!1}){let o=T(e),s=b(e);return(0,Z.jsx)(d.Root,{asChild:!0,children:(0,Z.jsxs)(`div`,{role:`button`,tabIndex:0,onClick:t,onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),t())},className:`flex cursor-pointer items-center gap-3 px-3 py-2 text-left transition-colors hover:bg-[var(--surface-hover)] focus:outline-none focus-visible:ring-2 focus-visible:ring-[var(--ring)]`,children:[(0,Z.jsx)(`div`,{className:`flex shrink-0 items-center justify-center text-[28px] leading-none`,children:(0,Z.jsx)(E,{skill:e,className:`h-7 w-7`})}),(0,Z.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(`span`,{className:`truncate text-body-medium-default`,style:{color:`var(--content-emphasised)`},children:e.name}),(0,Z.jsx)(w,{origin:e.origin})]}),(0,Z.jsx)(`p`,{className:`mt-1 truncate text-body-medium-lighter`,style:{color:`var(--content-tertiary)`},children:e.description})]}),o?i?(0,Z.jsx)(u,{type:`button`,iconOnly:(0,Z.jsx)(j,{className:`animate-spin`,"aria-hidden":!0}),disabled:!0,"aria-label":`Installing`,expandOnMobile:!1}):(0,Z.jsx)(u,{type:`button`,iconOnly:(0,Z.jsx)(q,{"aria-hidden":!0}),onClick:e=>{e.stopPropagation(),n?.()},disabled:!n,"aria-label":`Install skill`,expandOnMobile:!1}):(0,Z.jsx)(u,{type:`button`,variant:`dangerOutline`,iconOnly:a?(0,Z.jsx)(j,{className:`animate-spin`,"aria-hidden":!0}):(0,Z.jsx)(H,{"aria-hidden":!0}),onClick:e=>{e.stopPropagation(),r?.()},disabled:!s||a||!r,"aria-label":s?`Remove skill`:`Bundled skill cannot be removed`,title:s?void 0:`Bundled skills cannot be removed`,expandOnMobile:!1})]})})}function Be(e){return s({...N({path:{assistant_id:e}}),select:e=>e.categories,staleTime:300*1e3})}function Ve(e){switch(e){case`installed`:return{kind:`installed`};case`available`:return{kind:`available`};case`vellum`:case`clawhub`:case`skillssh`:case`custom`:return{origin:e};default:return{}}}function He(e){return[...e].sort((e,t)=>{let n=S(e);return n===S(t)?e.name.localeCompare(t.name,void 0,{sensitivity:`base`}):n?-1:1})}function Ue(e,t){let[n,r]=(0,X.useState)(e);return(0,X.useEffect)(()=>{let n=setTimeout(()=>{r(e)},t);return()=>clearTimeout(n)},[e,t]),n}var We=300,Ge=`vellum:skills:tipDismissed`;function Ke({assistantId:e,initialSkillId:r}){let i=o(),a=re(),[l,u]=(0,X.useState)(``),d=Ue(l.trim(),We),[f,m]=(0,X.useState)(`all`),[h,g]=(0,X.useState)(null),[_,v]=(0,X.useState)(r??null),[y,b]=(0,X.useState)(null),[x,S]=(0,X.useState)(null),[w,T]=(0,X.useState)(null),[E,O]=(0,X.useState)(()=>n(Ge,!1)),{data:k=[]}=Be(e),{origin:A,kind:j}=(0,X.useMemo)(()=>Ve(f),[f]),M=s({...ee({path:{assistant_id:e},query:{include:`catalog`,origin:A,kind:j,q:d||void 0,category:h??void 0}}),select:e=>({skills:e.skills,categoryCounts:e.categoryCounts,totalCount:e.totalCount}),enabled:!!e}),N=s({...ee({path:{assistant_id:e},query:{include:`catalog`,origin:A,kind:j,q:d||void 0}}),select:e=>({skills:e.skills,categoryCounts:e.categoryCounts,totalCount:e.totalCount}),enabled:!!e&&h!==null}),P=(0,X.useCallback)(()=>{i.invalidateQueries({queryKey:te({path:{assistant_id:e}})})},[e,i]),F=c({mutationFn:t=>D(e,t),onMutate:e=>b(e),onSettled:()=>{b(null),P()}}),I=c({...ne(),onMutate:e=>S(e.path.id),onSettled:()=>{S(null),P()}}),L=(0,X.useCallback)(e=>{F.mutate(e.slug??e.id)},[F]),R=(0,X.useCallback)(e=>{T(e)},[]),ie=(0,X.useCallback)(()=>{w&&(I.mutate({path:{assistant_id:e,id:w.id}}),T(null))},[e,w,I]),z=(0,X.useCallback)(()=>{O(!0),t(Ge,!0)},[]),B=(0,X.useMemo)(()=>M.data?.skills??[],[M.data?.skills]),V=h===null?M.data:N.data,{counts:H,totalCount:U}=qe(V?.skills??B,V?.categoryCounts,V?.totalCount),W=(0,X.useMemo)(()=>He(B),[B]),G=(0,X.useMemo)(()=>_?B.find(e=>e.id===_)??null:null,[B,_]),K=(0,Z.jsx)(p,{open:w!==null,title:`Remove skill`,message:w?`Remove "${w.name}" from this assistant?`:``,confirmLabel:`Remove`,destructive:!0,onConfirm:ie,onCancel:()=>T(null)});if(G){let t={assistantId:e,skill:G,onBack:()=>v(null),onInstall:()=>L(G),onRemove:()=>R(G),isInstalling:y===(G.slug??G.id),isRemoving:x===G.id};return(0,Z.jsxs)(Z.Fragment,{children:[a?(0,Z.jsx)(Oe,{...t}):(0,Z.jsx)(C,{...t}),K]})}let q=M.isFetching&&!!d;return(0,Z.jsxs)(`div`,{className:`flex h-full min-h-0 flex-1 flex-col gap-4`,children:[!E&&(0,Z.jsx)(Je,{onDismiss:z}),(0,Z.jsx)(Fe,{search:l,onSearchChange:u,filter:f,onFilterChange:m,isSearching:q,categories:k,category:h,onCategoryChange:g,counts:H,totalCount:U,showCounts:!q}),(0,Z.jsxs)(`div`,{className:`flex min-h-0 flex-1 gap-6`,children:[(0,Z.jsx)(`aside`,{className:`hidden w-56 shrink-0 overflow-y-auto sm:block`,children:(0,Z.jsx)(Se,{selected:h,onSelect:g,counts:H,totalCount:U,showCounts:!q,categories:k})}),(0,Z.jsx)(`div`,{className:`min-w-0 flex-1 overflow-y-auto`,children:M.isLoading?(0,Z.jsx)(Ye,{}):M.isError?(0,Z.jsx)(Xe,{}):W.length===0?(0,Z.jsx)(Ze,{filter:f,category:h}):(0,Z.jsx)(`ul`,{className:`flex flex-col gap-2`,children:W.map(e=>(0,Z.jsx)(`li`,{children:(0,Z.jsx)(ze,{skill:e,onSelect:()=>v(e.id),onInstall:()=>L(e),onRemove:()=>R(e),isInstalling:y===(e.slug??e.id),isRemoving:x===e.id})},e.id))})})]}),K]})}function qe(e,t,n){return(0,X.useMemo)(()=>{if(t&&Object.keys(t).length>0)return{counts:t,totalCount:n??e.length};let r={};for(let t of e){let e=t.category??`system`;r[e]=(r[e]??0)+1}return{counts:r,totalCount:n??e.length}},[e,t,n])}function Je({onDismiss:e}){return(0,Z.jsxs)(`div`,{className:`flex items-center gap-2 rounded-lg px-4 py-2.5 text-body-small-default`,style:{backgroundColor:`var(--surface-base)`,color:`var(--content-secondary)`},children:[(0,Z.jsx)(me,{className:`h-4 w-4 shrink-0`,style:{color:`var(--primary-base)`}}),(0,Z.jsx)(`p`,{className:`flex-1`,children:`You can create a new custom skill by describing what you want in chat.`}),(0,Z.jsx)(u,{type:`button`,variant:`ghost`,size:`compact`,iconOnly:(0,Z.jsx)(M,{"aria-hidden":!0}),onClick:e,"aria-label":`Dismiss tip`,tintColor:`var(--content-tertiary)`,expandOnMobile:!1})]})}function Ye(){return(0,Z.jsx)(`div`,{className:`flex items-center justify-center py-16`,children:(0,Z.jsx)(j,{className:`h-6 w-6 animate-spin`,style:{color:`var(--content-tertiary)`}})})}function Xe(){return(0,Z.jsx)(d.Root,{children:(0,Z.jsxs)(d.Body,{className:`flex flex-col items-center justify-center py-16 text-center`,children:[(0,Z.jsx)(L,{className:`mb-3 h-8 w-8`,style:{color:`var(--system-danger)`},"aria-hidden":!0}),(0,Z.jsx)(`h3`,{className:`text-title-small`,style:{color:`var(--content-default)`},children:`Failed to load skills`}),(0,Z.jsx)(`p`,{className:`mt-1 max-w-sm text-body-medium-lighter`,style:{color:`var(--content-tertiary)`},children:`Something went wrong. Try refreshing the page.`})]})})}function Ze({filter:e,category:t}){let{title:n,subtitle:r,Icon:i}=Qe(e,t);return(0,Z.jsx)(d.Root,{children:(0,Z.jsxs)(d.Body,{className:`flex flex-col items-center justify-center py-16 text-center`,children:[(0,Z.jsx)(i,{className:`mb-3 h-8 w-8`,style:{color:`var(--content-tertiary)`},"aria-hidden":!0}),(0,Z.jsx)(`h3`,{className:`text-title-small`,style:{color:`var(--content-default)`},children:n}),(0,Z.jsx)(`p`,{className:`mt-1 max-w-sm text-body-medium-lighter`,style:{color:`var(--content-tertiary)`},children:r})]})})}function Qe(e,t){if(t)return{title:`No skills in this category`,subtitle:`Try selecting a different category or clearing the filter.`,Icon:Y};switch(e){case`installed`:return{title:`No Skills Installed`,subtitle:`Ask your assistant in chat to search for and install new skills.`,Icon:G};case`available`:return{title:`No Skills Available`,subtitle:`All available skills have been installed.`,Icon:J};case`vellum`:return{title:`No Vellum Skills`,subtitle:`No bundled Vellum skills found.`,Icon:ce};case`clawhub`:return{title:`No Clawhub Skills`,subtitle:`No Clawhub skills found. Try searching the catalog.`,Icon:k};case`skillssh`:return{title:`No skills.sh Skills`,subtitle:`No skills.sh skills found. Try searching the catalog.`,Icon:W};case`custom`:return{title:`No Custom Skills`,subtitle:`Create a custom skill by describing what you want in chat.`,Icon:R};default:return{title:`No Skills Available`,subtitle:`Check your connection to the Vellum catalog.`,Icon:I}}}function $e(){let e=he(),[t]=a();return(0,Z.jsx)(Ke,{assistantId:e,initialSkillId:t.get(`skill`)??void 0})}export{$e as SkillsPage};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{o as e}from"./chunk-jRWAZmH_.js";import{t}from"./react-DJZBPgpf.js";import{r as n}from"./chunk-5KNZJZUH-B4b1m-Ya.js";import{t as r}from"./jsx-runtime-CVSDxk6A.js";import"./src-hn7lwVCD.js";import{t as i}from"./notice-CF2pptne.js";import{t as a}from"./tag-Ccr7Quy6.js";import{t as o}from"./loader-circle-BSAFLoPH.js";import{i as s}from"./routes-DMbyM_oF.js";import{Ai as c,Kt as l,dt as u,fo as d,ft as f,io as p,lo as m,oo as h,ut as g,xo as _}from"./index-DM63H2B6.js";import{t as v}from"./use-current-platform-assistant-4FcCb-TC.js";var y=e(t(),1),b=r();function x(e){switch(e){case`lifecycle`:return`Lifecycle`;case`upgrade`:return`Upgrade`;case`rollback`:return`Rollback`;case`crash`:return`Crash`;case`idle_sleep`:return`Idle Sleep`;case`wake`:return`Wake`;case`profiler`:return`Profiler`;case`other`:return`Other`;default:return e}}function S(e){switch(e){case`started`:return`Started`;case`succeeded`:return`Succeeded`;case`failed`:return`Failed`;case`in_progress`:return`In Progress`;default:return e}}function C(e){return e===`succeeded`}function w(e){return e===`failed`}function T(e){return new Date(e).toLocaleString(void 0,{year:`numeric`,month:`short`,day:`numeric`,hour:`2-digit`,minute:`2-digit`,second:`2-digit`})}function E(e){if(e.type!==`idle_sleep`)return!1;let t=e.details?.idle_timeout_seconds;return typeof t==`number`&&t>=21600}function D(e,t){switch(e){case`wake`:return`positive`;case`rollback`:return`warning`;case`crash`:return`negative`;case`idle_sleep`:return t&&E(t)?`warning`:`neutral`;default:return`neutral`}}function O({type:e,event:t}){return(0,b.jsx)(a,{tone:D(e,t),children:x(e)})}function k({status:e}){let t=S(e);return C(e)?(0,b.jsx)(a,{tone:`positive`,leftIcon:(0,b.jsx)(m,{}),children:t}):w(e)?(0,b.jsx)(a,{tone:`negative`,leftIcon:(0,b.jsx)(h,{}),children:t}):(0,b.jsx)(a,{tone:`neutral`,children:t})}function A({event:e}){let[t,n]=(0,y.useState)(!1),r=e.details!==null&&e.details!==void 0&&Object.keys(e.details).length>0;return(0,b.jsxs)(`div`,{className:`rounded-xl border p-4`,style:{background:`var(--surface-lift)`,borderColor:`var(--border-base)`},children:[(0,b.jsxs)(`div`,{className:`flex flex-col gap-2 sm:flex-row sm:items-start sm:justify-between`,children:[(0,b.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-1.5`,children:[(0,b.jsx)(`p`,{className:`text-body-medium-default`,style:{color:`var(--content-default)`},children:e.display_text}),(0,b.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:[(0,b.jsx)(O,{type:e.type,event:e}),(0,b.jsx)(k,{status:e.event_status}),E(e)&&(0,b.jsx)(a,{tone:`warning`,leftIcon:(0,b.jsx)(c,{className:`h-3 w-3`}),children:`Long sleep`})]})]}),(0,b.jsxs)(`div`,{className:`text-body-small-default flex shrink-0 items-center gap-1.5`,style:{color:`var(--content-tertiary)`},children:[(0,b.jsx)(p,{className:`h-3 w-3`}),(0,b.jsx)(`span`,{children:T(e.occurred_at)})]})]}),r&&(0,b.jsxs)(`div`,{className:`mt-2`,children:[(0,b.jsxs)(`button`,{type:`button`,onClick:()=>n(e=>!e),className:`text-body-small-default flex items-center gap-1`,style:{color:`var(--content-tertiary)`},children:[(0,b.jsx)(d,{className:`h-3 w-3 transition-transform ${t?`rotate-180`:``}`}),t?`Hide details`:`Show details`]}),t&&(0,b.jsx)(`pre`,{className:`mt-2 overflow-x-auto rounded-md p-3 text-body-small-default`,style:{background:`var(--surface-base)`,color:`var(--content-default)`},children:JSON.stringify(e.details,null,2)})]})]})}function j({assistantId:e}){let{data:t,isLoading:n,isError:r,isFetchingNextPage:i,hasNextPage:a,fetchNextPage:s}=_({...l({path:{assistant_id:e}}),initialPageParam:0,getNextPageParam:(e,t)=>{if(e.next)return t.reduce((e,t)=>e+t.results.length,0)}}),u=t?.pages.flatMap(e=>e.results)??[];return(0,b.jsxs)(`div`,{className:`space-y-4`,children:[(0,b.jsx)(`p`,{className:`text-body-medium-lighter`,style:{color:`var(--content-tertiary)`},children:`Lifecycle events for your assistant from the last 30 days, newest first.`}),n?(0,b.jsxs)(`div`,{className:`text-body-medium-lighter flex items-center gap-2`,style:{color:`var(--content-tertiary)`},children:[(0,b.jsx)(o,{className:`h-4 w-4 animate-spin`}),`Loading system events...`]}):r?(0,b.jsxs)(`div`,{className:`text-body-medium-lighter flex items-center gap-2`,style:{color:`var(--system-negative-strong)`},children:[(0,b.jsx)(c,{className:`h-4 w-4 shrink-0`}),`Failed to load system events. Please refresh and try again.`]}):u.length===0?(0,b.jsx)(`p`,{className:`text-body-medium-lighter`,style:{color:`var(--content-tertiary)`},children:`No system events recorded in the last 30 days.`}):(0,b.jsxs)(`div`,{className:`space-y-2`,children:[u.map(e=>(0,b.jsx)(A,{event:e},e.id)),a&&(0,b.jsx)(`div`,{className:`pt-2 text-center`,children:(0,b.jsx)(`button`,{type:`button`,onClick:()=>s(),disabled:i,className:`text-body-medium-default flex w-full items-center justify-center gap-2 rounded-md border px-4 py-2 transition-colors disabled:cursor-not-allowed disabled:opacity-50`,style:{borderColor:`var(--border-element)`,color:`var(--content-secondary)`},children:i?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(o,{className:`h-4 w-4 animate-spin`}),`Loading older events...`]}):`Load older events`})})]})]})}function M(){let e=f({platformHostedOnly:!0}),t=g(),r=u(),{assistantId:a}=v();return e===`gated`?(0,b.jsx)(n,{replace:!0,to:s.logs.root}):e===`disabled`?(0,b.jsx)(i,{tone:`info`,children:`Log in to the Vellum platform to view system events.`}):r?(0,b.jsxs)(`div`,{className:`flex items-center gap-2 py-6 text-body-medium-lighter text-[var(--content-secondary)]`,children:[(0,b.jsx)(o,{className:`h-4 w-4 animate-spin`}),`Loading system events…`]}):t?a?(0,b.jsx)(j,{assistantId:a}):null:(0,b.jsx)(i,{tone:`warning`,children:`System events aren't available for the current assistant.`})}export{M as SystemEventsPage};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{o as e}from"./chunk-jRWAZmH_.js";import{t}from"./react-DJZBPgpf.js";import{d as n}from"./chunk-5KNZJZUH-B4b1m-Ya.js";import{i as r}from"./routes-DMbyM_oF.js";var i=e(t(),1);function a(){let e=n();return(0,i.useEffect)(()=>{e(r.logs.systemEvents,{replace:!0})},[e]),null}export{a as SystemEventsRedirectPage};
|
|
@@ -1 +0,0 @@
|
|
|
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"./button-DdEh-9f_.js";import{t as i}from"./typography-Czgs_2w_.js";import"./src-hn7lwVCD.js";import{t as a}from"./x-BDqbYVtS.js";import{B as o,C as s,Ia as c,Oi as l,T as u,Xa as d,fa as f,go as p,ho as m,na as h,po as g,qa as _,sa as v,w as y,zi as b}from"./index-DM63H2B6.js";var x=e(t(),1),S=n(),C={code:d,file:c,pen:v,monitor:f,plug:h,sparkle:b,"user-plus":l,bolt:p,brain:m},w=1500;function T({text:e}){let[t,n]=(0,x.useState)(!1),r=(0,x.useRef)(null);return(0,x.useEffect)(()=>()=>{r.current&&clearTimeout(r.current)},[]),(0,S.jsxs)(`button`,{type:`button`,onClick:()=>{navigator.clipboard.writeText(e),n(!0),r.current&&clearTimeout(r.current),r.current=setTimeout(()=>n(!1),w)},"aria-label":t?`Copied`:`Copy`,className:`absolute right-2 top-2 flex items-center gap-1 rounded p-1 text-label-small-default text-[var(--content-tertiary)] transition-colors hover:bg-[var(--ghost-hover)] hover:text-[var(--content-default)]`,children:[t?(0,S.jsx)(g,{className:`h-3.5 w-3.5`}):(0,S.jsx)(_,{className:`h-3.5 w-3.5`}),t?`Copied`:null]})}function E({text:e}){return(0,S.jsxs)(`div`,{className:`relative`,children:[(0,S.jsx)(`pre`,{className:`rounded-lg border border-[var(--border-base)] bg-[var(--surface-overlay)] p-3 font-mono text-xs whitespace-pre-wrap break-words text-[var(--content-default)]`,children:e}),(0,S.jsx)(T,{text:e})]})}function D({children:e}){return(0,S.jsx)(i,{variant:`label-small-default`,as:`div`,className:`mb-1.5 uppercase tracking-wider text-[var(--content-tertiary)]`,children:e})}function O({Glyph:e,title:t,headerTrailing:n,onClose:o,children:s}){return(0,S.jsxs)(`div`,{className:`flex h-full flex-col overflow-hidden rounded-xl bg-[var(--surface-lift)]`,children:[(0,S.jsxs)(`div`,{className:`flex shrink-0 items-center gap-3 border-b border-[var(--border-base)] px-5 py-4`,children:[(0,S.jsx)(e,{className:`h-5 w-5 shrink-0 text-[var(--content-secondary)]`,"aria-hidden":!0}),(0,S.jsx)(i,{variant:`title-medium`,className:`min-w-0 shrink truncate py-0.5 leading-snug text-[var(--content-default)]`,children:t}),n,(0,S.jsx)(`span`,{className:`flex-1`}),(0,S.jsx)(r,{variant:`ghost`,iconOnly:(0,S.jsx)(a,{}),onClick:o,"aria-label":`Close tool details`,tooltip:`Close`,className:`shrink-0`})]}),(0,S.jsx)(`div`,{className:`flex-1 overflow-y-auto px-5 py-5`,children:s})]})}function k({detail:e,onClose:t,onRiskBadgeClick:n}){if(e.kind===`thinking`)return(0,S.jsx)(O,{Glyph:m,title:e.title,onClose:t,children:(0,S.jsx)(o,{content:e.thinkingText??``,hardLineBreaks:!0})});let{iconName:r}=y(e.toolName,e.input),a=C[r]??p,c=e.activity||e.title,l=e.result!==void 0&&e.result!==``,d=e.status===`running`,f=JSON.stringify(e.input,null,2);return(0,S.jsx)(O,{Glyph:a,title:c,onClose:t,headerTrailing:(0,S.jsx)(s,{level:e.riskLevel,onClick:n}),children:(0,S.jsxs)(S.Fragment,{children:[e.riskReason&&(0,S.jsx)(i,{variant:`body-small-default`,as:`p`,className:`mb-4 text-[var(--content-tertiary)]`,children:e.riskReason}),(0,S.jsxs)(`div`,{children:[(0,S.jsx)(D,{children:`Technical details`}),(0,S.jsx)(i,{variant:`body-medium-default`,as:`div`,className:`text-[var(--content-default)]`,children:u(e.toolName)}),e.activity&&(0,S.jsx)(i,{variant:`body-small-default`,as:`p`,className:`mt-0.5 text-[var(--content-secondary)]`,children:e.activity}),(0,S.jsx)(`div`,{className:`mt-2`,children:(0,S.jsx)(E,{text:f})})]}),(l||d)&&(0,S.jsxs)(`div`,{className:`mt-5`,children:[(0,S.jsx)(D,{children:`Output`}),l?(0,S.jsx)(E,{text:e.result}):(0,S.jsx)(i,{variant:`body-small-default`,as:`p`,className:`text-[var(--content-tertiary)]`,children:`Running…`})]})]})})}export{k as ToolDetailPanel};
|