@vellumai/web 0.10.12-dev.202607270720.ec1a36e → 0.10.12-dev.202607271108.d02cf25
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/{access-CtLAkoqT.js → access-Cgg2YGHu.js} +1 -1
- package/dist/assets/{assistant-feature-flag-store-ltLrn6Vo.js → assistant-feature-flag-store-v8SP-gAp.js} +1 -1
- package/dist/assets/{assistant-status-panel-D3DgDcV3.js → assistant-status-panel-wSQLMiYn.js} +1 -1
- package/dist/assets/{channels-page-route-Dr5Dcclp.js → channels-page-route-C39tt3rc.js} +1 -1
- package/dist/assets/{client-feature-flag-store-c2ESRWJ1.js → client-feature-flag-store-iq53KePp.js} +1 -1
- package/dist/assets/{command-palette-window-page-B32sNiQn.js → command-palette-window-page-BbLaIsmz.js} +1 -1
- package/dist/assets/{contacts-page-route-CZqDmtyP.js → contacts-page-route-DyWv0cNt.js} +1 -1
- package/dist/assets/{developer-page-1f6jrwxQ.js → developer-page-Dg0kHXTI.js} +1 -1
- package/dist/assets/feature-flag-catalog-D6qrHLNs.js +1 -0
- package/dist/assets/{general-page-DCAQIgnL.js → general-page-6SNyo-gb.js} +1 -1
- package/dist/assets/{hosting-screen-CfPYgSut.js → hosting-screen-BXkOVGUe.js} +1 -1
- package/dist/assets/{index-CFFjpYBn.js → index-BD3297Vd.js} +1 -1
- package/dist/assets/{inspect-page-MVs65rFl.js → inspect-page-BMinJbDH.js} +1 -1
- package/dist/assets/{integrations-page-CW8CC9Fu.js → integrations-page-DvQNxZD-.js} +1 -1
- package/dist/assets/{logs-layout-DzoQjkar.js → logs-layout-BlQn7Oay.js} +1 -1
- package/dist/assets/{memory-router-playground-page-CpZv3OeU.js → memory-router-playground-page-C_pz-249.js} +1 -1
- package/dist/assets/{open-workspace-file-C27kg3Nv.js → open-workspace-file-uxYH7HsS.js} +2 -2
- package/dist/assets/{routes-DZue-W2n.js → routes-CLjnH8mS.js} +13 -13
- package/dist/assets/{runtime-upgrade-banner-CmOUB4cy.js → runtime-upgrade-banner-BmBNxtWT.js} +1 -1
- package/dist/assets/{schedules-page-B3tYyfvO.js → schedules-page-Bq4sYMEL.js} +1 -1
- package/dist/assets/{settings-layout-DImJvQrL.js → settings-layout-Dpedmj52.js} +1 -1
- package/dist/assets/{sidebar-tree-D5wIcOeZ.js → sidebar-tree-X0U4U6VH.js} +1 -1
- package/dist/assets/{skill-detail-page-D3WwddGt.js → skill-detail-page-BTDipcJc.js} +1 -1
- package/dist/assets/{theme-stage-page-BGDFiDpJ.js → theme-stage-page-CrhMJ-XT.js} +1 -1
- package/dist/assets/{use-app-theme-qjEhUKP2.js → use-app-theme-BEtFr7FK.js} +1 -1
- package/dist/assets/{use-command-palette-sections-CXtO2-XS.js → use-command-palette-sections-nhGyCH9v.js} +1 -1
- package/dist/assets/{use-ios-app-nudge-DMRPSgrQ.js → use-ios-app-nudge-C3u87ee6.js} +1 -1
- package/dist/index.html +11 -11
- package/package.json +1 -1
- package/dist/assets/feature-flag-catalog-D0c-Ac1N.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as e}from"./auth-store-D0-gDCVn.js";import{t}from"./assistant-feature-flag-store-
|
|
1
|
+
import{n as e}from"./auth-store-D0-gDCVn.js";import{t}from"./assistant-feature-flag-store-v8SP-gAp.js";function n(e,t){return t||e?.isStaff===!0||e?.email?.toLowerCase().endsWith(`@vellum.ai`)===!0}function r(){return n(e.use.user(),t.use.settingsDeveloperNav()===!0)}export{r as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as e}from"./toast-LgLp4obE.js";import{n as t,t as n}from"./create-selectors-Qo7kcikX.js";import{c as r,n as i,s as a,t as o,u as s}from"./feature-flag-catalog-
|
|
1
|
+
import{n as e}from"./toast-LgLp4obE.js";import{n as t,t as n}from"./create-selectors-Qo7kcikX.js";import{c as r,n as i,s as a,t as o,u as s}from"./feature-flag-catalog-D6qrHLNs.js";import{h as c}from"./sdk.gen-DPKrJeho.js";var l={...o},u={...i},d=0,f={};function p(e={}){l={...o,...e};for(let e of Object.keys(f))delete f[e]}function m(e={}){u={...i,...e}}function h(){p(),m()}var g=a(`assistant`);function _(e){return l[e]??o[e]??!1}function v(e){return u[e]??i[e]??``}var y=n(t()(t=>{let n=t;return{...o,...g.bool,hasHydrated:!1,stringFlags:{...i,...g.str},setFlags:e=>t(t=>{p(e);let n={...e,...g.bool};return Object.keys(n).some(e=>n[e]!==t[e])?n:t}),setFlag:(n,i,a)=>{let o=++d,u=()=>{if(f[n]!==o)return;delete f[n];let a=_(n);t(e=>e[n]===i?{[n]:a}:e),e.error(`Couldn't update "${r(n)?.label??n}" — change reverted.`)},p=s(n);!a||!p||(f[n]=o,c({path:{assistant_id:a,flag_key:p},body:{enabled:i},throwOnError:!1}).then(e=>{e.response?.ok?(l[n]=i,f[n]===o&&delete f[n]):u()}).catch(u),t({[n]:g.bool[n]??i}))},markHydrated:()=>t({hasHydrated:!0}),resetForAssistantSwitch:()=>{h(),t({...o,...g.bool,hasHydrated:!1}),n({stringFlags:{...i,...g.str}})},setStringFlags:e=>n(t=>{m(e);let n={...e,...g.str},r=t.stringFlags;return Object.keys(n).some(e=>n[e]!==r[e])?{stringFlags:n}:t}),setStringFlag:(t,i,a)=>{let o=++d,l=()=>{if(f[t]!==o)return;delete f[t];let a=v(t);n(e=>e.stringFlags[t]===i?{stringFlags:{...e.stringFlags,[t]:a}}:e),e.error(`Couldn't update "${r(t)?.label??t}" — change reverted.`)},p=s(t);!a||!p||(f[t]=o,c({path:{assistant_id:a,flag_key:p},body:{enabled:i},throwOnError:!1}).then(e=>{e.response?.ok?(u[t]=i,f[t]===o&&delete f[t]):l()}).catch(l),n(e=>({stringFlags:{...e.stringFlags,[t]:g.str[t]??i}})))}}}));export{y as t};
|
package/dist/assets/{assistant-status-panel-D3DgDcV3.js → assistant-status-panel-wSQLMiYn.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{o as e}from"./chunk-jRWAZmH_.js";import{n as t,t as n}from"./capture-error-Bj8_eutd.js";import{t as r}from"./react-BFJW0bSv.js";import{t as i}from"./useQuery-Bz-fbQ-m.js";import{t as a}from"./jsx-runtime-D3ZM-ToX.js";import{t as o}from"./loader-circle-XREx3i4W.js";import"./src-D89CNeuT.js";import"./tag-NXcyiTkK.js";import{n as s}from"./toast-LgLp4obE.js";import"./auth-store-D0-gDCVn.js";import{a as c,r as l}from"./api-XwdNiVE9.js";import{t as u}from"./assistant-feature-flag-store-
|
|
1
|
+
import{o as e}from"./chunk-jRWAZmH_.js";import{n as t,t as n}from"./capture-error-Bj8_eutd.js";import{t as r}from"./react-BFJW0bSv.js";import{t as i}from"./useQuery-Bz-fbQ-m.js";import{t as a}from"./jsx-runtime-D3ZM-ToX.js";import{t as o}from"./loader-circle-XREx3i4W.js";import"./src-D89CNeuT.js";import"./tag-NXcyiTkK.js";import{n as s}from"./toast-LgLp4obE.js";import"./auth-store-D0-gDCVn.js";import{a as c,r as l}from"./api-XwdNiVE9.js";import{t as u}from"./assistant-feature-flag-store-v8SP-gAp.js";import{t as d}from"./use-active-assistant-id-CXhDyK7y.js";import"./environment-store-Dk9rAKWX.js";var f=e(r(),1),p=a();function m({value:e,max:t,caption:n}){let r=t>0?Math.max(0,Math.min(e/t*100,100)):0,i=r>90;return(0,p.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,p.jsx)(`div`,{className:`h-2 w-full overflow-hidden rounded-full bg-[var(--surface-active)]`,children:(0,p.jsx)(`div`,{className:`h-full rounded-full transition-[width] duration-200`,style:{width:`${r}%`,backgroundColor:i?`var(--system-negative-strong)`:`var(--system-positive-strong)`}})}),n&&(0,p.jsx)(`span`,{className:`text-label-medium-default text-[var(--content-tertiary)]`,children:n})]})}var h=7,g=2e3;function _(e){let t=(0,f.useRef)(0),n=(0,f.useRef)(null),[r,i]=(0,f.useState)(null),a=(0,f.useCallback)(()=>{if(t.current+=1,t.current>=h){t.current=0;let r=u.getState(),a=!r.settingsDeveloperNav;r.setFlag(`settingsDeveloperNav`,a,e),i(a?`Developer mode enabled`:`Developer mode disabled`),n.current!==null&&clearTimeout(n.current),n.current=setTimeout(()=>{i(null),n.current=null},g)}},[e]);return(0,f.useEffect)(()=>()=>{n.current!==null&&clearTimeout(n.current)},[]),{onTap:a,message:r}}function v({version:e,loading:t,assistantId:n}){let{onTap:r,message:i}=_(n);return t?(0,p.jsxs)(`span`,{className:`flex items-center gap-2 text-body-medium-lighter text-[var(--content-tertiary)]`,children:[(0,p.jsx)(o,{className:`h-4 w-4 animate-spin`}),`Loading version...`]}):e?(0,p.jsxs)(`div`,{children:[(0,p.jsx)(`button`,{type:`button`,className:`break-all text-left text-body-medium-lighter text-[var(--content-default)]`,onClick:r,children:e}),i&&(0,p.jsx)(`p`,{className:`mt-1 text-body-small-default text-[var(--content-accent)]`,children:i})]}):(0,p.jsx)(`span`,{className:`text-body-medium-lighter text-[var(--content-tertiary)]`,children:`—`})}var y=`currentAssistant`,b=4e3,x=9e4;function S(e,t){return(e.memory?.maxMb??null)!==(t.memory?.maxMb??null)||(e.cpu?.maxCores??null)!==(t.cpu?.maxCores??null)}function C(){let e=d(),{data:r=null,isLoading:a,refetch:o}=i({queryKey:[y,e],queryFn:async()=>{let t=await l(e);return t.ok?t.data:null},retry:!1}),u=r?.id,[p,m]=(0,f.useState)(null),[h,g]=(0,f.useState)(!1),[_,v]=(0,f.useState)(!1),C=(0,f.useRef)(0),w=(0,f.useRef)(0),T=(0,f.useCallback)(async e=>{if(!u)return m(null),g(!1),null;C.current+=1;let r=C.current;g(!0);try{let t=await c(u);return r===C.current?t.ok?(m(t.data),t.data):(e?.keepStaleOnError||m(null),null):null}catch(i){return r===C.current?(e?.keepStaleOnError||m(null),!t(i)&&!e?.keepStaleOnError&&(n(i,{context:`fetch_assistant_healthz`}),s.error(`Failed to load assistant info`)),null):null}finally{r===C.current&&g(!1)}},[u]);return(0,f.useEffect)(()=>{T()},[T]),(0,f.useEffect)(()=>()=>{w.current+=1,v(!1),m(null)},[u]),{assistant:r,assistantLoading:a,healthz:p,healthzLoading:h,healthzPolling:_,refetch:(0,f.useCallback)(async()=>{await o(),await T()},[o,T]),refetchUntilResized:(0,f.useCallback)(async e=>{let t=++w.current,n=Date.now()+x;v(!0);let r=e;try{for(o();Date.now()<n&&t===w.current;){if(await new Promise(e=>setTimeout(e,b)),t!==w.current)return;let e=await T({keepStaleOnError:!0});if(t!==w.current)return;if(e){if(r==null){r=e;continue}if(S(e,r))return}}}finally{t===w.current&&v(!1)}},[T,o])}}function w(e){return e>=1024?`${(e/1024).toFixed(1)} GB`:`${e.toFixed(0)} MB`}export{m as a,_ as i,C as n,v as r,w as t};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{o as e}from"./chunk-jRWAZmH_.js";import{t}from"./react-BFJW0bSv.js";import{t as n}from"./button-Dy5001j6.js";import{m as r,t as i,u as a}from"./chunk-5KNZJZUH-Bsoom5--.js";import{n as o}from"./QueryClientProvider-CMu7CkQU.js";import{t as s}from"./useQuery-Bz-fbQ-m.js";import{t as c}from"./useMutation-CXGTrp4W.js";import{t as l}from"./jsx-runtime-D3ZM-ToX.js";import{t as u}from"./cn-CJf7MmLX.js";import{t as d}from"./typography-DEI9Ra9z.js";import{t as f}from"./card-DRIctGVs.js";import{b as p,c as m,d as h,g,h as _,l as v,o as y}from"./use-save-twilio-credentials-dUedxPbM.js";import{t as b}from"./chevron-down-B5A-0g8A.js";import{t as x}from"./circle-check-big-DSsDH5_6.js";import{t as S}from"./list-row-B1wPb2Au.js";import{o as C,r as w,t as T,u as E}from"./threshold-presets-BO8En2q0.js";import{t as D}from"./message-square-CQGiY4zk.js";import{t as O}from"./search-BVW-n8to.js";import{t as ee}from"./notice-BMK7xqUw.js";import{M as k,N as A,a as j,i as M}from"./src-D89CNeuT.js";import{t as N}from"./tag-NXcyiTkK.js";import{t as P}from"./input-hw3el2GJ.js";import{t as te}from"./panel-item-CrtoJCrd.js";import{t as F}from"./confirm-dialog-UYFm4osC.js";import{t as I}from"./dropdown-BCfnSdIZ.js";import{n as ne,t as re}from"./create-selectors-Qo7kcikX.js";import{t as ie}from"./assistant-identity-store-DIyVo8LV.js";import{r as ae}from"./utils-CnB60ZJN.js";import{u as oe}from"./routes-vE-2hncW.js";import{n as se}from"./conversation-navigation-DE-Nj8N3.js";import{i as L,o as ce,r as R}from"./sdk.gen-DPKrJeho.js";import{t as le}from"./assistant-feature-flag-store-ltLrn6Vo.js";import{t as z}from"./public-asset-CbDDcomC.js";import{t as ue}from"./use-active-assistant-id-CXhDyK7y.js";import{t as de}from"./slack-setup-wizard-CAVg-F3_.js";import{c as fe,i as pe,l as B,n as me,o as he,r as ge,s as _e,t as ve}from"./use-invite-link-dialog-Cvvpn0Hm.js";import{t as ye}from"./detail-card-BMRGmkia.js";import{n as be,t as xe}from"./mobile-sidebar-drawer-CXGCmJ_p.js";import{t as V}from"./mutation-error-zQ6oi-va.js";var H=e(t(),1),U=re(ne()(e=>({selectedAdapter:`slack`,selectAdapter:t=>e({selectedAdapter:t})}))),W={slack:{label:`Slack`,disconnectMessage:`This clears the stored Slack bot and app tokens for this assistant. You can reconnect later.`,hasTrustFloorControl:!1},telegram:{label:`Telegram`,disconnectMessage:`This clears the stored Telegram bot token for this assistant. You can reconnect later.`,hasTrustFloorControl:!0,disconnectedPitch:e=>`Connect a Telegram bot so ${e} can send and receive messages on Telegram.`},phone:{label:`Phone Calling`,disconnectMessage:`This clears the stored Twilio credentials for this assistant. You can reconnect later.`,hasTrustFloorControl:!0,disconnectedPitch:e=>`Connect your Twilio account so ${e} can make and answer phone calls.`}},G=l();function K({channels:e,selectedKey:t,onSelect:n}){return(0,G.jsx)(f.Root,{className:`flex h-full flex-col overflow-hidden`,children:(0,G.jsxs)(f.Body,{className:`flex min-h-0 min-w-0 flex-1 flex-col gap-4`,children:[(0,G.jsx)(`h2`,{className:`text-title-medium`,style:{color:`var(--content-default)`},children:`Channels`}),(0,G.jsx)(`div`,{className:`flex flex-col gap-1`,children:e.map(e=>(0,G.jsx)(Se,{channel:e,selected:e.key===t,onClick:()=>n(e.key)},e.key))})]})})}function Se({channel:e,selected:t,onClick:n}){let r=e.status===`ready`,i=h(e.key),a=r?`Connected`:`Not connected`;return(0,G.jsx)(te,{asChild:!0,active:t,label:`${i}, ${a}`,children:(0,G.jsxs)(`button`,{type:`button`,onClick:n,className:`flex h-auto w-full items-center gap-2 rounded-[6px] px-[8px] py-2 text-left`,children:[(0,G.jsx)(v,{channelId:e.key,className:`h-4 w-4 shrink-0 text-[color:var(--content-secondary)]`}),(0,G.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-body-medium-default`,children:i}),(0,G.jsx)(`span`,{className:`flex shrink-0 items-center`,children:(0,G.jsx)(N,{tone:r?`positive`:`neutral`,children:a})})]})})}function q({icon:e,title:t,description:n,action:r,className:i}){return(0,G.jsxs)(`div`,{className:u(`flex flex-col items-center justify-center gap-3 px-4 py-12 text-center`,i),children:[e?(0,G.jsx)(`div`,{className:`flex h-12 w-12 items-center justify-center rounded-xl bg-[var(--surface-sunken)] text-[var(--content-tertiary)]`,children:e}):null,(0,G.jsx)(`h3`,{className:`text-title-small text-[var(--content-default)]`,children:t}),n?(0,G.jsx)(`p`,{className:`max-w-md text-body-medium-lighter text-[color:var(--content-tertiary)]`,children:n}):null,r?(0,G.jsx)(`div`,{className:`mt-1`,children:r}):null]})}function Ce({assistantDisplayName:e,policy:t,saving:n=!1,loading:r=!1,error:i=!1,onChange:a}){let o=t??`trusted_contacts`,s=fe(e),c=he.map(e=>({value:e,label:_e[e],tooltip:s[e]}));return(0,G.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,G.jsxs)(d,{as:`span`,variant:`body-small-emphasised`,className:`text-[color:var(--content-secondary)]`,children:[`Who can message `,e]}),r?(0,G.jsx)(d,{as:`span`,variant:`body-small-default`,className:`text-[color:var(--content-tertiary)]`,children:`Loading…`}):i?(0,G.jsx)(d,{as:`span`,variant:`body-small-default`,className:`text-[color:var(--content-negative)]`,children:`Couldn’t load this setting. Try reopening this page.`}):(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`div`,{style:{maxWidth:280},children:(0,G.jsx)(I,{value:o,onChange:a,options:c,disabled:n,"aria-label":`Who can message ${e}`})}),(0,G.jsx)(d,{as:`span`,variant:`body-small-default`,className:`text-[color:var(--content-tertiary)]`,children:s[o]}),o===`trusted_contacts`?(0,G.jsxs)(ee,{tone:`info`,className:`max-w-lg`,children:[`People you haven’t verified yet — even teammates in the same channel — can’t get through: `,e,` lets them know they need to be verified and notifies you. You can verify people ahead of time in Contacts.`]}):null]})]})}function we({address:e,pending:t,onDisconnect:r}){return(0,G.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,G.jsx)(N,{tone:`positive`,leftIcon:(0,G.jsx)(x,{}),children:`Connected`}),e?(0,G.jsx)(`span`,{className:`text-body-medium-lighter`,style:{color:`var(--content-tertiary)`},children:e}):null,(0,G.jsx)(`div`,{className:`ml-auto`,children:(0,G.jsx)(n,{type:`button`,variant:`danger`,onClick:r,disabled:!r||t,children:t?`Disconnecting…`:`Disconnect`})})]})}function Te({children:e}){return(0,G.jsxs)(f.Root,{children:[(0,G.jsx)(f.Header,{children:(0,G.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,G.jsx)(`img`,{src:z(`/images/integrations/slack.svg`),alt:``,className:`size-8 rounded-lg bg-[var(--surface-sunken)] p-1`}),(0,G.jsx)(d,{as:`span`,variant:`body-medium-default`,children:`Slack setup`})]})}),(0,G.jsx)(f.Body,{children:e})]})}var J=T.map(e=>e.riskThreshold),Y={none:{label:w(`none`).label,sublabel:`asks every time`,tone:`negative`,dotColor:`var(--system-negative-strong)`},low:{label:w(`low`).label,sublabel:`safe lookups`,tone:`warning`,dotColor:`var(--system-mid-strong)`},medium:{label:w(`medium`).label,sublabel:`broader lookups`,tone:`info`,dotColor:`var(--system-info-strong)`},high:{label:w(`high`).label,sublabel:`any lookup`,tone:`positive`,dotColor:`var(--system-positive-strong)`}},X=[`trusted_contact`,`unverified_contact`,`unknown`];function Ee(e,t){let n={};for(let r of e){if(r.selector.scope!==`channel`||r.selector.adapter!==t)continue;let e=r.selector.channelExternalId;e&&(r.contactType===`trusted_contact`||!(e in n))&&(n[e]=r.threshold)}return n}function Z(e,t,n){return n===`channels`?e.selector.scope===`adapter`&&e.selector.adapter===t:e.selector.scope===`channel_type`&&e.selector.adapter===t&&e.selector.channelType===`dm`}function Q(e,t,n){let r;for(let i of e)Z(i,t,n)&&(i.contactType===`trusted_contact`||r===void 0)&&(r=i.threshold);return r}function De({color:e}){return(0,G.jsx)(`span`,{"aria-hidden":`true`,className:`h-1.5 w-1.5 shrink-0 rounded-full`,style:{backgroundColor:e}})}function Oe({tier:e,defaultTier:t,disabled:n,onTierChange:r,onReset:i,"aria-label":a}){let o=e??t,s=J.map(e=>({value:e,label:Y[e].label,icon:(0,G.jsx)(De,{color:Y[e].dotColor}),suffix:e===t?(0,G.jsx)(`span`,{className:`text-[color:var(--content-tertiary)]`,children:`default`}):void 0,tooltip:Y[e].sublabel}));return(0,G.jsx)(I,{value:o??``,onChange:e=>{e===t?i():r(e)},options:s,placeholder:`Default`,disabled:n,size:`compact`,menuAlign:`end`,"aria-label":a})}function $(e){return e.type===`dm`?`dm`:e.isPrivate?`private`:`public`}function ke(e){return e.filter(e=>$(e)!==`dm`)}function Ae(e,t,n){let r=t.trim().toLowerCase();return e.filter(e=>(n===null||$(e)===n)&&(r===``||e.name.toLowerCase().includes(r))).sort((e,t)=>e.name.localeCompare(t.name))}function je(e){let t={public:0,private:0,dm:0};for(let n of e)t[$(n)]+=1;return t}function Me(e){return e.memberCount==null?null:e.memberCount===1?`1 member`:`${e.memberCount} members`}var Ne=[{value:null,label:`All`},{value:`public`,label:`Public`},{value:`private`,label:`Private`}],Pe={public:p,private:E},Fe=100,Ie=new Set;function Le({assistantDisplayName:e,slackHandle:t,channels:n,loading:r=!1,error:i=!1,tierOverrides:a,defaultTier:o=null,accessControlsSupported:s=!0,tierOverridesLoading:c=!1,tierOverridesError:l=!1,pendingChannelIds:f=Ie,onTierChange:m,onTierReset:h}){let[g,_]=(0,H.useState)(``),[v,y]=(0,H.useState)(null),b=(0,H.useMemo)(()=>ke(n??[]),[n]),x=(0,H.useMemo)(()=>Ae(b,g,v),[b,g,v]),S=(0,H.useMemo)(()=>je(b),[b]),C=t??`@${e}`;return(0,G.jsxs)(`div`,{className:`flex flex-col gap-3 p-4`,children:[(0,G.jsx)(d,{as:`p`,variant:`body-small-default`,className:`text-[color:var(--content-tertiary)]`,children:(0,G.jsxs)(G.Fragment,{children:[`Add with`,` `,(0,G.jsxs)(`code`,{className:`text-[color:var(--content-secondary)]`,children:[`/invite `,C]}),` `,`or remove with`,` `,(0,G.jsxs)(`code`,{className:`text-[color:var(--content-secondary)]`,children:[`/remove `,C]}),` `,`in that Slack channel. Only channels `,e,` is in appear here.`]})}),r?(0,G.jsx)(d,{as:`span`,variant:`body-small-default`,className:`text-[color:var(--content-tertiary)]`,children:`Loading…`}):i?(0,G.jsx)(d,{as:`span`,variant:`body-small-default`,className:`text-[color:var(--content-negative)]`,children:`Couldn’t load channels. Try reopening this page.`}):b.length===0?(0,G.jsx)(q,{icon:(0,G.jsx)(p,{className:`h-6 w-6`}),title:`No channels yet`}):(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,G.jsx)(`div`,{className:`min-w-56 flex-1`,children:(0,G.jsx)(P,{type:`search`,value:g,onChange:e=>_(e.target.value),placeholder:`Search channels`,"aria-label":`Search channels`,leftIcon:(0,G.jsx)(O,{className:`h-4 w-4`}),fullWidth:!0})}),(0,G.jsx)(`div`,{className:`flex items-center gap-2`,role:`group`,"aria-label":`Filter channels by type`,children:Ne.map(({value:e,label:t})=>{let n=v===e,r=e===null?b.length:S[e];return(0,G.jsxs)(`button`,{type:`button`,"aria-pressed":n,onClick:()=>y(e),className:u(`inline-flex h-6 items-center rounded-full px-2.5 text-body-small-emphasised leading-none transition-colors`,n?`bg-[var(--content-default)] text-[var(--surface-base)]`:`bg-[var(--tag-bg-neutral)] text-[color:var(--content-secondary)] hover:text-[color:var(--content-default)]`),children:[t,` `,r]},e??`all`)})})]}),x.length===0?(0,G.jsx)(d,{as:`span`,variant:`body-small-default`,className:`py-4 text-center text-[color:var(--content-tertiary)]`,children:`No channels match.`}):x.length>Fe?(0,G.jsx)(`div`,{className:`h-96`,children:(0,G.jsx)(j,{items:x,computeItemKey:(e,t)=>t.id,itemContent:(e,t)=>(0,G.jsx)(Re,{channel:t,pending:f.has(t.id),overridesLoading:c,overridesError:l,defaultTier:o,accessControls:s,tierOverride:a?.[t.id],onTierChange:e=>m?.(t.id,e),onReset:()=>h?.(t.id)}),className:`h-full`})}):(0,G.jsx)(`div`,{className:`max-h-96 overflow-y-auto`,children:x.map(e=>(0,G.jsx)(Re,{channel:e,pending:f.has(e.id),overridesLoading:c,overridesError:l,defaultTier:o,accessControls:s,tierOverride:a?.[e.id],onTierChange:t=>m?.(e.id,t),onReset:()=>h?.(e.id)},e.id))})]})]})}function Re({channel:e,pending:t,overridesLoading:n,overridesError:r,defaultTier:i,accessControls:a,tierOverride:o,onTierChange:s,onReset:c}){let l=$(e);if(l===`dm`)return null;let u=Pe[l],d=Me(e),f=`[&+&]:border-t [&+&]:border-[var(--border-base)]`;return a?(0,G.jsx)(S,{className:f,leading:(0,G.jsx)(u,{className:`h-4 w-4 text-[var(--content-tertiary)]`}),title:e.name,subtitle:d??void 0,trailing:(0,G.jsx)(`div`,{className:`w-40 sm:w-48`,children:(0,G.jsx)(Oe,{tier:o,defaultTier:i,disabled:t||n||r,onTierChange:s,onReset:c,"aria-label":`Assistant Access in ${e.name}`})})}):(0,G.jsx)(S,{className:f,leading:(0,G.jsx)(u,{className:`h-4 w-4 text-[var(--content-tertiary)]`}),title:e.name,trailing:d==null?void 0:(0,G.jsx)(`span`,{className:`text-body-small-default text-[color:var(--content-tertiary)]`,children:d})})}function ze(e,t){switch(e){case`none`:return`${t} replies, but asks you before looking anything up — even a web search.`;case`low`:return`Low-risk lookups run on their own: web searches, reading files in ${t}'s own workspace.`;case`medium`:return`Also allows medium-risk lookups to run on their own.`;case`high`:return`Any lookup runs on its own, including reads of sensitive local files.`}}function Be({assistantName:e,defaultTier:t}){return(0,G.jsxs)(`div`,{className:`flex flex-col gap-2 px-4 py-3`,children:[(0,G.jsx)(d,{as:`span`,variant:`body-small-emphasised`,children:`Assistant Access levels`}),(0,G.jsxs)(d,{as:`p`,variant:`body-small-default`,className:`text-[color:var(--content-tertiary)]`,children:[`Applies to other people in the channel — your own requests use your global Assistant Access. The levels only cover how much `,e,` `,`looks up on its own before answering; writing, sending, and spending always come to you first, at every level. Your`,` `,(0,G.jsx)(i,{to:oe.settings.privacy,className:`text-[var(--content-link)] underline hover:text-[var(--content-link-hover)]`,children:`Trust Rules`}),` `,`fine-tune when it asks.`]}),(0,G.jsx)(`ul`,{className:`grid gap-x-6 gap-y-3 sm:grid-cols-2`,children:J.map(n=>{let r=Y[n];return(0,G.jsxs)(`li`,{className:`flex flex-col gap-0.5`,children:[(0,G.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,G.jsx)(De,{color:r.dotColor}),(0,G.jsx)(d,{as:`span`,variant:`body-small-emphasised`,children:r.label}),n===t?(0,G.jsx)(d,{as:`span`,variant:`body-small-default`,className:`text-[color:var(--content-tertiary)]`,children:`· default`}):null]}),(0,G.jsx)(d,{as:`span`,variant:`body-small-default`,className:`text-[color:var(--content-tertiary)]`,children:ze(n,e)})]},n)})})]})}var Ve=[{bucket:`channels`,icon:p,title:`Channels`,description:`Public and private channels`},{bucket:`dm`,icon:D,title:`Direct messages`,description:`One-on-one DMs`}];function He({assistantName:e,globalDefaultTier:t,bucketTiers:n,loading:r,error:i,pendingBuckets:a,onBucketChange:o,onBucketReset:s}){return(0,G.jsxs)(f.Root,{children:[(0,G.jsx)(f.Header,{children:(0,G.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[`Default access`,(0,G.jsxs)(d,{as:`p`,variant:`body-small-default`,className:`text-[color:var(--content-tertiary)]`,children:[`How much `,e,` does on its own, by conversation type. Individual channels can override this below.`]})]})}),(0,G.jsx)(f.Body,{className:`py-1`,children:Ve.map(({bucket:e,icon:c,title:l,description:u})=>{let d=e===`dm`?n?.channels??t:t;return(0,G.jsx)(S,{className:`[&+&]:border-t [&+&]:border-[var(--border-base)]`,leading:(0,G.jsx)(c,{className:`h-4 w-4 text-[var(--content-tertiary)]`}),title:l,subtitle:u,trailing:(0,G.jsx)(`div`,{className:`w-40 sm:w-48`,children:(0,G.jsx)(Oe,{tier:n?.[e],defaultTier:d,disabled:r||i||a.has(e),onTierChange:t=>o(e,t),onReset:()=>s(e),"aria-label":`Default Assistant Access for ${l}`})})},e)})}),(0,G.jsx)(f.Footer,{className:`p-0`,children:(0,G.jsx)(Be,{assistantName:e,defaultTier:t})})]})}var Ue=`0.10.8`;function We(){return ae(Ue)}function Ge(e,t,n){return X.map(r=>({selector:{scope:`channel`,adapter:e,channelExternalId:t},contactType:r,threshold:n}))}function Ke(e,t,n){return e.selector.scope===`channel`&&e.selector.adapter===t&&e.selector.channelExternalId===n}function qe(e,t){return t===`channels`?{scope:`adapter`,adapter:e}:{scope:`channel_type`,adapter:e,channelType:`dm`}}function Je(e,t,n){let r=qe(e,t);return X.map(e=>({selector:r,contactType:e,threshold:n}))}function Ye({assistantId:e,adapter:t}){let n=o(),r=We()&&!!e,i=(0,H.useMemo)(()=>({path:{assistant_id:e}}),[e]),a=(0,H.useMemo)(()=>g(i),[i]),l=(0,H.useMemo)(()=>[`channel-permission-resolve`,e,t],[e,t]),u=s({..._(i),enabled:r}),d=u.data?.cells,f=(0,H.useMemo)(()=>d?Ee(d,t):void 0,[d,t]),p=(0,H.useMemo)(()=>d?{channels:Q(d,t,`channels`),dm:Q(d,t,`dm`)}:void 0,[d,t]),m=s({queryKey:l,queryFn:async()=>{let{data:e}=await ce({...i,body:{adapter:t,contactType:`trusted_contact`},throwOnError:!0});return e.resolved?.threshold??null},enabled:r,retry:!1,staleTime:3e4}),h=(e,t)=>{let r=n.getQueryData(a),i=Date.now();return n.setQueryData(a,n=>({cells:[...(n?.cells??[]).filter(t=>!e(t)),...t.map(e=>({...e,updatedAt:i}))]})),{previous:r}},v=c({mutationFn:async({channelExternalId:e,tier:n})=>{await Promise.all(Ge(t,e,n).map(e=>L({...i,body:e,throwOnError:!0})))},onMutate:({channelExternalId:e,tier:n})=>h(n=>Ke(n,t,e),Ge(t,e,n)),onError:(e,t,r)=>{n.setQueryData(a,r?.previous),V(`Failed to save channel settings`)(e)},onSettled:()=>n.invalidateQueries({queryKey:a})}),y=c({mutationFn:async({channelExternalId:e})=>{await Promise.all(X.map(n=>R({...i,body:{selector:{scope:`channel`,adapter:t,channelExternalId:e},contactType:n},throwOnError:!0})))},onMutate:({channelExternalId:e})=>h(n=>Ke(n,t,e),[]),onError:(e,t,r)=>{n.setQueryData(a,r?.previous),V(`Failed to reset channel settings`)(e)},onSettled:()=>n.invalidateQueries({queryKey:a})}),b=c({mutationFn:async({bucket:e,tier:n})=>{await Promise.all(Je(t,e,n).map(e=>L({...i,body:e,throwOnError:!0})))},onMutate:({bucket:e,tier:n})=>h(n=>Z(n,t,e),Je(t,e,n)),onError:(e,t,r)=>{n.setQueryData(a,r?.previous),V(`Failed to save the default`)(e)},onSettled:(e,t,{bucket:r})=>{n.invalidateQueries({queryKey:a}),r===`channels`&&n.invalidateQueries({queryKey:l})}}),x=c({mutationFn:async({bucket:e})=>{let n=qe(t,e);await Promise.all(X.map(e=>R({...i,body:{selector:n,contactType:e},throwOnError:!0})))},onMutate:({bucket:e})=>h(n=>Z(n,t,e),[]),onError:(e,t,r)=>{n.setQueryData(a,r?.previous),V(`Failed to reset the default`)(e)},onSettled:(e,t,{bucket:r})=>{n.invalidateQueries({queryKey:a}),r===`channels`&&n.invalidateQueries({queryKey:l})}}),S=(0,H.useMemo)(()=>{let e=new Set;return v.isPending&&v.variables&&e.add(v.variables.channelExternalId),y.isPending&&y.variables&&e.add(y.variables.channelExternalId),e},[v.isPending,v.variables,y.isPending,y.variables]),C=(0,H.useMemo)(()=>{let e=new Set;return b.isPending&&b.variables&&e.add(b.variables.bucket),x.isPending&&x.variables&&e.add(x.variables.bucket),e},[b.isPending,b.variables,x.isPending,x.variables]);return!r||u.isError?{supported:!1,tierOverrides:void 0,defaultCellTier:void 0,bucketTiers:void 0,pendingChannelIds:new Set,pendingBuckets:new Set,isLoading:!1,isError:!1,onTierChange:void 0,onTierReset:void 0,onBucketChange:void 0,onBucketReset:void 0}:{supported:!0,tierOverrides:f,defaultCellTier:m.data,bucketTiers:p,pendingChannelIds:S,pendingBuckets:C,isLoading:u.isPending,isError:u.isError,onTierChange:(e,t)=>v.mutate({channelExternalId:e,tier:t}),onTierReset:e=>{f?.[e]!==void 0&&y.mutate({channelExternalId:e})},onBucketChange:(e,t)=>b.mutate({bucket:e,tier:t}),onBucketReset:e=>{p?.[e]!==void 0&&x.mutate({bucket:e})}}}function Xe({assistantId:e,assistantDisplayName:t,slackHandle:n}){let r=s({...y(e),enabled:!!e,select:e=>e.channels}),i=Ye({assistantId:e,adapter:`slack`}),a=s({queryKey:[`thresholds`,e],queryFn:()=>C(e),enabled:i.supported&&!!e,staleTime:3e4}).data?.interactive??null,o=i.defaultCellTier===void 0?null:i.defaultCellTier??a,c=(0,G.jsx)(Le,{assistantDisplayName:t,slackHandle:n,accessControlsSupported:i.supported,defaultTier:o,channels:r.data,loading:r.isPending,error:r.isError,tierOverrides:i.tierOverrides,tierOverridesLoading:i.isLoading,tierOverridesError:i.isError,pendingChannelIds:i.pendingChannelIds,onTierChange:i.onTierChange,onTierReset:i.onTierReset});return!i.supported||!i.onBucketChange||!i.onBucketReset?(0,G.jsx)(f.Root,{noPadding:!0,clipContents:!0,children:c}):(0,G.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,G.jsx)(He,{assistantName:t,globalDefaultTier:a,bucketTiers:i.bucketTiers,loading:i.isLoading,error:i.isError,pendingBuckets:i.pendingBuckets,onBucketChange:i.onBucketChange,onBucketReset:i.onBucketReset}),(0,G.jsx)(f.Root,{noPadding:!0,clipContents:!0,children:(0,G.jsx)(M.Root,{type:`single`,collapsible:!0,children:(0,G.jsxs)(M.Item,{value:`per-channel-overrides`,children:[(0,G.jsxs)(M.Trigger,{className:`group justify-between gap-2 px-4 py-3`,children:[(0,G.jsx)(d,{as:`span`,variant:`body-small-emphasised`,children:`Per-channel overrides`}),(0,G.jsx)(b,{"aria-hidden":`true`,className:`h-4 w-4 shrink-0 text-[var(--content-tertiary)] transition-transform group-data-[state=open]:rotate-180`})]}),(0,G.jsx)(M.Content,{className:`border-[var(--border-base)] data-[state=open]:border-t`,children:c})]})})})]})}function Ze({slackHandle:e,disconnectPending:t=!1,onDisconnect:r,children:i}){return(0,G.jsxs)(f.Root,{children:[(0,G.jsx)(f.Header,{children:(0,G.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,G.jsx)(`img`,{src:z(`/images/integrations/slack.svg`),alt:``,className:`size-8 rounded-lg bg-[var(--surface-sunken)] p-1`}),e?(0,G.jsx)(d,{as:`span`,variant:`body-medium-default`,children:e}):null,(0,G.jsx)(N,{tone:`positive`,leftIcon:(0,G.jsx)(x,{}),children:`Connected`}),(0,G.jsx)(`div`,{className:`ml-auto`,children:(0,G.jsx)(n,{type:`button`,variant:`ghost`,onClick:r,disabled:!r||t,children:t?`Disconnecting…`:`Disconnect`})})]})}),(0,G.jsx)(f.Body,{children:i})]})}function Qe({threadMode:e,threadModePending:t=!1,onThreadModeChange:n}){return(0,G.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,G.jsx)(d,{as:`span`,variant:`body-small-emphasised`,className:`text-[color:var(--content-secondary)]`,children:`Thread Behavior`}),(0,G.jsxs)(A,{value:e??`mention_then_thread`,onValueChange:e=>n?.(e),disabled:t||!n,"aria-label":`Slack thread behavior`,children:[(0,G.jsx)(k,{value:`mention_only`,label:`Mentions only`,helperText:`Bot only responds when @mentioned.`}),(0,G.jsx)(k,{value:`mention_then_thread`,label:`Follow threads after first mention`,helperText:`After an @mention in a thread, bot listens to all subsequent replies.`})]})]})}function $e({onSave:e}){let[t,r]=(0,H.useState)(``),[i,a]=(0,H.useState)(!1),[o,s]=(0,H.useState)(null),c=t.trim().length>0&&!i;return(0,G.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,G.jsx)(P,{label:`Bot Token`,type:`password`,value:t,onChange:e=>r(e.target.value),placeholder:`Paste your Telegram bot token`,disabled:i,fullWidth:!0}),o?(0,G.jsx)(`p`,{className:`text-label-small`,style:{color:`var(--content-negative)`},children:o}):null,(0,G.jsx)(`div`,{children:(0,G.jsx)(n,{type:`button`,onClick:async()=>{if(!(!e||!c)){a(!0),s(null);try{await e(t.trim()),r(``)}catch(e){s(e instanceof Error?e.message:`Failed to save`)}finally{a(!1)}}},disabled:!c,children:i?`Saving…`:`Save`})})]})}function et({onSave:e}){let[t,r]=(0,H.useState)(``),[i,a]=(0,H.useState)(``),[o,s]=(0,H.useState)(!1),[c,l]=(0,H.useState)(null),u=t.trim().length>0&&i.trim().length>0&&!o;return(0,G.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,G.jsx)(P,{label:`Account SID`,type:`text`,value:t,onChange:e=>r(e.target.value),placeholder:`ACxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx`,disabled:o,fullWidth:!0}),(0,G.jsx)(P,{label:`Auth Token`,type:`password`,value:i,onChange:e=>a(e.target.value),placeholder:`Twilio auth token`,disabled:o,fullWidth:!0}),c?(0,G.jsx)(`p`,{className:`text-label-small`,style:{color:`var(--content-negative)`},children:c}):null,(0,G.jsx)(`div`,{children:(0,G.jsx)(n,{type:`button`,onClick:async()=>{if(!(!e||!u)){s(!0),l(null);try{await e(t.trim(),i.trim()),r(``),a(``)}catch(e){l(e instanceof Error?e.message:`Failed to save`)}finally{s(!1)}}},disabled:!u,children:o?`Saving…`:`Save`})})]})}function tt({channel:e,assistantId:t,assistantName:r,assistantDisplayName:i,pending:a,initialManualEntry:o=!1,onSetup:s,onDisconnect:c,onSaveTelegramToken:l,onSaveSlackConfig:u,slackSaveStatus:d,slackSaveError:f,slackThreadMode:p,slackThreadModePending:m=!1,onSlackThreadModeChange:g,onSaveTwilioCredentials:_,policy:y,policySaving:b=!1,policyLoading:x=!1,policyError:S=!1,onPolicyChange:C}){let w=e.status===`ready`,[T,E]=(0,H.useState)(o);if(e.key===`slack`)return(0,G.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[w?(0,G.jsx)(Ze,{slackHandle:e.address,disconnectPending:a,onDisconnect:c,children:(0,G.jsx)(Qe,{threadMode:p,threadModePending:m,onThreadModeChange:g})}):(0,G.jsx)(Te,{children:(0,G.jsx)(de,{assistantName:r,onSave:u,saveStatus:d,saveError:f})}),w?(0,G.jsx)(Xe,{assistantId:t,assistantDisplayName:i,slackHandle:e.address}):null]});let D=W[e.key];return(0,G.jsx)(`div`,{className:`flex flex-col gap-4`,children:w?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(we,{address:e.address,pending:a,onDisconnect:c}),D.hasTrustFloorControl&&C?(0,G.jsx)(Ce,{assistantDisplayName:i,policy:y,saving:b,loading:x,error:S,onChange:C}):null]}):T?e.key===`telegram`?(0,G.jsx)($e,{onSave:l}):(0,G.jsx)(et,{onSave:_}):(0,G.jsx)(q,{icon:(0,G.jsx)(v,{channelId:e.key,className:`h-6 w-6`}),title:`${h(e.key)} isn't connected`,description:D.disconnectedPitch?.(i),action:(0,G.jsxs)(`div`,{className:`flex flex-col items-center gap-1`,children:[(0,G.jsx)(n,{type:`button`,variant:`outlined`,onClick:s,disabled:!s||a,children:a?`Opening…`:`Set up`}),(0,G.jsx)(n,{type:`button`,variant:`link`,onClick:()=>E(!0),children:`or connect manually`})]})})})}var nt={no_one:{title:`Block all messages?`,message:`Setting this channel to “No one” hard-denies every inbound message — including messages from you.
|
|
1
|
+
import{o as e}from"./chunk-jRWAZmH_.js";import{t}from"./react-BFJW0bSv.js";import{t as n}from"./button-Dy5001j6.js";import{m as r,t as i,u as a}from"./chunk-5KNZJZUH-Bsoom5--.js";import{n as o}from"./QueryClientProvider-CMu7CkQU.js";import{t as s}from"./useQuery-Bz-fbQ-m.js";import{t as c}from"./useMutation-CXGTrp4W.js";import{t as l}from"./jsx-runtime-D3ZM-ToX.js";import{t as u}from"./cn-CJf7MmLX.js";import{t as d}from"./typography-DEI9Ra9z.js";import{t as f}from"./card-DRIctGVs.js";import{b as p,c as m,d as h,g,h as _,l as v,o as y}from"./use-save-twilio-credentials-dUedxPbM.js";import{t as b}from"./chevron-down-B5A-0g8A.js";import{t as x}from"./circle-check-big-DSsDH5_6.js";import{t as S}from"./list-row-B1wPb2Au.js";import{o as C,r as w,t as T,u as E}from"./threshold-presets-BO8En2q0.js";import{t as D}from"./message-square-CQGiY4zk.js";import{t as O}from"./search-BVW-n8to.js";import{t as ee}from"./notice-BMK7xqUw.js";import{M as k,N as A,a as j,i as M}from"./src-D89CNeuT.js";import{t as N}from"./tag-NXcyiTkK.js";import{t as P}from"./input-hw3el2GJ.js";import{t as te}from"./panel-item-CrtoJCrd.js";import{t as F}from"./confirm-dialog-UYFm4osC.js";import{t as I}from"./dropdown-BCfnSdIZ.js";import{n as ne,t as re}from"./create-selectors-Qo7kcikX.js";import{t as ie}from"./assistant-identity-store-DIyVo8LV.js";import{r as ae}from"./utils-CnB60ZJN.js";import{u as oe}from"./routes-vE-2hncW.js";import{n as se}from"./conversation-navigation-DE-Nj8N3.js";import{i as L,o as ce,r as R}from"./sdk.gen-DPKrJeho.js";import{t as le}from"./assistant-feature-flag-store-v8SP-gAp.js";import{t as z}from"./public-asset-CbDDcomC.js";import{t as ue}from"./use-active-assistant-id-CXhDyK7y.js";import{t as de}from"./slack-setup-wizard-CAVg-F3_.js";import{c as fe,i as pe,l as B,n as me,o as he,r as ge,s as _e,t as ve}from"./use-invite-link-dialog-Cvvpn0Hm.js";import{t as ye}from"./detail-card-BMRGmkia.js";import{n as be,t as xe}from"./mobile-sidebar-drawer-CXGCmJ_p.js";import{t as V}from"./mutation-error-zQ6oi-va.js";var H=e(t(),1),U=re(ne()(e=>({selectedAdapter:`slack`,selectAdapter:t=>e({selectedAdapter:t})}))),W={slack:{label:`Slack`,disconnectMessage:`This clears the stored Slack bot and app tokens for this assistant. You can reconnect later.`,hasTrustFloorControl:!1},telegram:{label:`Telegram`,disconnectMessage:`This clears the stored Telegram bot token for this assistant. You can reconnect later.`,hasTrustFloorControl:!0,disconnectedPitch:e=>`Connect a Telegram bot so ${e} can send and receive messages on Telegram.`},phone:{label:`Phone Calling`,disconnectMessage:`This clears the stored Twilio credentials for this assistant. You can reconnect later.`,hasTrustFloorControl:!0,disconnectedPitch:e=>`Connect your Twilio account so ${e} can make and answer phone calls.`}},G=l();function K({channels:e,selectedKey:t,onSelect:n}){return(0,G.jsx)(f.Root,{className:`flex h-full flex-col overflow-hidden`,children:(0,G.jsxs)(f.Body,{className:`flex min-h-0 min-w-0 flex-1 flex-col gap-4`,children:[(0,G.jsx)(`h2`,{className:`text-title-medium`,style:{color:`var(--content-default)`},children:`Channels`}),(0,G.jsx)(`div`,{className:`flex flex-col gap-1`,children:e.map(e=>(0,G.jsx)(Se,{channel:e,selected:e.key===t,onClick:()=>n(e.key)},e.key))})]})})}function Se({channel:e,selected:t,onClick:n}){let r=e.status===`ready`,i=h(e.key),a=r?`Connected`:`Not connected`;return(0,G.jsx)(te,{asChild:!0,active:t,label:`${i}, ${a}`,children:(0,G.jsxs)(`button`,{type:`button`,onClick:n,className:`flex h-auto w-full items-center gap-2 rounded-[6px] px-[8px] py-2 text-left`,children:[(0,G.jsx)(v,{channelId:e.key,className:`h-4 w-4 shrink-0 text-[color:var(--content-secondary)]`}),(0,G.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-body-medium-default`,children:i}),(0,G.jsx)(`span`,{className:`flex shrink-0 items-center`,children:(0,G.jsx)(N,{tone:r?`positive`:`neutral`,children:a})})]})})}function q({icon:e,title:t,description:n,action:r,className:i}){return(0,G.jsxs)(`div`,{className:u(`flex flex-col items-center justify-center gap-3 px-4 py-12 text-center`,i),children:[e?(0,G.jsx)(`div`,{className:`flex h-12 w-12 items-center justify-center rounded-xl bg-[var(--surface-sunken)] text-[var(--content-tertiary)]`,children:e}):null,(0,G.jsx)(`h3`,{className:`text-title-small text-[var(--content-default)]`,children:t}),n?(0,G.jsx)(`p`,{className:`max-w-md text-body-medium-lighter text-[color:var(--content-tertiary)]`,children:n}):null,r?(0,G.jsx)(`div`,{className:`mt-1`,children:r}):null]})}function Ce({assistantDisplayName:e,policy:t,saving:n=!1,loading:r=!1,error:i=!1,onChange:a}){let o=t??`trusted_contacts`,s=fe(e),c=he.map(e=>({value:e,label:_e[e],tooltip:s[e]}));return(0,G.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,G.jsxs)(d,{as:`span`,variant:`body-small-emphasised`,className:`text-[color:var(--content-secondary)]`,children:[`Who can message `,e]}),r?(0,G.jsx)(d,{as:`span`,variant:`body-small-default`,className:`text-[color:var(--content-tertiary)]`,children:`Loading…`}):i?(0,G.jsx)(d,{as:`span`,variant:`body-small-default`,className:`text-[color:var(--content-negative)]`,children:`Couldn’t load this setting. Try reopening this page.`}):(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`div`,{style:{maxWidth:280},children:(0,G.jsx)(I,{value:o,onChange:a,options:c,disabled:n,"aria-label":`Who can message ${e}`})}),(0,G.jsx)(d,{as:`span`,variant:`body-small-default`,className:`text-[color:var(--content-tertiary)]`,children:s[o]}),o===`trusted_contacts`?(0,G.jsxs)(ee,{tone:`info`,className:`max-w-lg`,children:[`People you haven’t verified yet — even teammates in the same channel — can’t get through: `,e,` lets them know they need to be verified and notifies you. You can verify people ahead of time in Contacts.`]}):null]})]})}function we({address:e,pending:t,onDisconnect:r}){return(0,G.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,G.jsx)(N,{tone:`positive`,leftIcon:(0,G.jsx)(x,{}),children:`Connected`}),e?(0,G.jsx)(`span`,{className:`text-body-medium-lighter`,style:{color:`var(--content-tertiary)`},children:e}):null,(0,G.jsx)(`div`,{className:`ml-auto`,children:(0,G.jsx)(n,{type:`button`,variant:`danger`,onClick:r,disabled:!r||t,children:t?`Disconnecting…`:`Disconnect`})})]})}function Te({children:e}){return(0,G.jsxs)(f.Root,{children:[(0,G.jsx)(f.Header,{children:(0,G.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,G.jsx)(`img`,{src:z(`/images/integrations/slack.svg`),alt:``,className:`size-8 rounded-lg bg-[var(--surface-sunken)] p-1`}),(0,G.jsx)(d,{as:`span`,variant:`body-medium-default`,children:`Slack setup`})]})}),(0,G.jsx)(f.Body,{children:e})]})}var J=T.map(e=>e.riskThreshold),Y={none:{label:w(`none`).label,sublabel:`asks every time`,tone:`negative`,dotColor:`var(--system-negative-strong)`},low:{label:w(`low`).label,sublabel:`safe lookups`,tone:`warning`,dotColor:`var(--system-mid-strong)`},medium:{label:w(`medium`).label,sublabel:`broader lookups`,tone:`info`,dotColor:`var(--system-info-strong)`},high:{label:w(`high`).label,sublabel:`any lookup`,tone:`positive`,dotColor:`var(--system-positive-strong)`}},X=[`trusted_contact`,`unverified_contact`,`unknown`];function Ee(e,t){let n={};for(let r of e){if(r.selector.scope!==`channel`||r.selector.adapter!==t)continue;let e=r.selector.channelExternalId;e&&(r.contactType===`trusted_contact`||!(e in n))&&(n[e]=r.threshold)}return n}function Z(e,t,n){return n===`channels`?e.selector.scope===`adapter`&&e.selector.adapter===t:e.selector.scope===`channel_type`&&e.selector.adapter===t&&e.selector.channelType===`dm`}function Q(e,t,n){let r;for(let i of e)Z(i,t,n)&&(i.contactType===`trusted_contact`||r===void 0)&&(r=i.threshold);return r}function De({color:e}){return(0,G.jsx)(`span`,{"aria-hidden":`true`,className:`h-1.5 w-1.5 shrink-0 rounded-full`,style:{backgroundColor:e}})}function Oe({tier:e,defaultTier:t,disabled:n,onTierChange:r,onReset:i,"aria-label":a}){let o=e??t,s=J.map(e=>({value:e,label:Y[e].label,icon:(0,G.jsx)(De,{color:Y[e].dotColor}),suffix:e===t?(0,G.jsx)(`span`,{className:`text-[color:var(--content-tertiary)]`,children:`default`}):void 0,tooltip:Y[e].sublabel}));return(0,G.jsx)(I,{value:o??``,onChange:e=>{e===t?i():r(e)},options:s,placeholder:`Default`,disabled:n,size:`compact`,menuAlign:`end`,"aria-label":a})}function $(e){return e.type===`dm`?`dm`:e.isPrivate?`private`:`public`}function ke(e){return e.filter(e=>$(e)!==`dm`)}function Ae(e,t,n){let r=t.trim().toLowerCase();return e.filter(e=>(n===null||$(e)===n)&&(r===``||e.name.toLowerCase().includes(r))).sort((e,t)=>e.name.localeCompare(t.name))}function je(e){let t={public:0,private:0,dm:0};for(let n of e)t[$(n)]+=1;return t}function Me(e){return e.memberCount==null?null:e.memberCount===1?`1 member`:`${e.memberCount} members`}var Ne=[{value:null,label:`All`},{value:`public`,label:`Public`},{value:`private`,label:`Private`}],Pe={public:p,private:E},Fe=100,Ie=new Set;function Le({assistantDisplayName:e,slackHandle:t,channels:n,loading:r=!1,error:i=!1,tierOverrides:a,defaultTier:o=null,accessControlsSupported:s=!0,tierOverridesLoading:c=!1,tierOverridesError:l=!1,pendingChannelIds:f=Ie,onTierChange:m,onTierReset:h}){let[g,_]=(0,H.useState)(``),[v,y]=(0,H.useState)(null),b=(0,H.useMemo)(()=>ke(n??[]),[n]),x=(0,H.useMemo)(()=>Ae(b,g,v),[b,g,v]),S=(0,H.useMemo)(()=>je(b),[b]),C=t??`@${e}`;return(0,G.jsxs)(`div`,{className:`flex flex-col gap-3 p-4`,children:[(0,G.jsx)(d,{as:`p`,variant:`body-small-default`,className:`text-[color:var(--content-tertiary)]`,children:(0,G.jsxs)(G.Fragment,{children:[`Add with`,` `,(0,G.jsxs)(`code`,{className:`text-[color:var(--content-secondary)]`,children:[`/invite `,C]}),` `,`or remove with`,` `,(0,G.jsxs)(`code`,{className:`text-[color:var(--content-secondary)]`,children:[`/remove `,C]}),` `,`in that Slack channel. Only channels `,e,` is in appear here.`]})}),r?(0,G.jsx)(d,{as:`span`,variant:`body-small-default`,className:`text-[color:var(--content-tertiary)]`,children:`Loading…`}):i?(0,G.jsx)(d,{as:`span`,variant:`body-small-default`,className:`text-[color:var(--content-negative)]`,children:`Couldn’t load channels. Try reopening this page.`}):b.length===0?(0,G.jsx)(q,{icon:(0,G.jsx)(p,{className:`h-6 w-6`}),title:`No channels yet`}):(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,G.jsx)(`div`,{className:`min-w-56 flex-1`,children:(0,G.jsx)(P,{type:`search`,value:g,onChange:e=>_(e.target.value),placeholder:`Search channels`,"aria-label":`Search channels`,leftIcon:(0,G.jsx)(O,{className:`h-4 w-4`}),fullWidth:!0})}),(0,G.jsx)(`div`,{className:`flex items-center gap-2`,role:`group`,"aria-label":`Filter channels by type`,children:Ne.map(({value:e,label:t})=>{let n=v===e,r=e===null?b.length:S[e];return(0,G.jsxs)(`button`,{type:`button`,"aria-pressed":n,onClick:()=>y(e),className:u(`inline-flex h-6 items-center rounded-full px-2.5 text-body-small-emphasised leading-none transition-colors`,n?`bg-[var(--content-default)] text-[var(--surface-base)]`:`bg-[var(--tag-bg-neutral)] text-[color:var(--content-secondary)] hover:text-[color:var(--content-default)]`),children:[t,` `,r]},e??`all`)})})]}),x.length===0?(0,G.jsx)(d,{as:`span`,variant:`body-small-default`,className:`py-4 text-center text-[color:var(--content-tertiary)]`,children:`No channels match.`}):x.length>Fe?(0,G.jsx)(`div`,{className:`h-96`,children:(0,G.jsx)(j,{items:x,computeItemKey:(e,t)=>t.id,itemContent:(e,t)=>(0,G.jsx)(Re,{channel:t,pending:f.has(t.id),overridesLoading:c,overridesError:l,defaultTier:o,accessControls:s,tierOverride:a?.[t.id],onTierChange:e=>m?.(t.id,e),onReset:()=>h?.(t.id)}),className:`h-full`})}):(0,G.jsx)(`div`,{className:`max-h-96 overflow-y-auto`,children:x.map(e=>(0,G.jsx)(Re,{channel:e,pending:f.has(e.id),overridesLoading:c,overridesError:l,defaultTier:o,accessControls:s,tierOverride:a?.[e.id],onTierChange:t=>m?.(e.id,t),onReset:()=>h?.(e.id)},e.id))})]})]})}function Re({channel:e,pending:t,overridesLoading:n,overridesError:r,defaultTier:i,accessControls:a,tierOverride:o,onTierChange:s,onReset:c}){let l=$(e);if(l===`dm`)return null;let u=Pe[l],d=Me(e),f=`[&+&]:border-t [&+&]:border-[var(--border-base)]`;return a?(0,G.jsx)(S,{className:f,leading:(0,G.jsx)(u,{className:`h-4 w-4 text-[var(--content-tertiary)]`}),title:e.name,subtitle:d??void 0,trailing:(0,G.jsx)(`div`,{className:`w-40 sm:w-48`,children:(0,G.jsx)(Oe,{tier:o,defaultTier:i,disabled:t||n||r,onTierChange:s,onReset:c,"aria-label":`Assistant Access in ${e.name}`})})}):(0,G.jsx)(S,{className:f,leading:(0,G.jsx)(u,{className:`h-4 w-4 text-[var(--content-tertiary)]`}),title:e.name,trailing:d==null?void 0:(0,G.jsx)(`span`,{className:`text-body-small-default text-[color:var(--content-tertiary)]`,children:d})})}function ze(e,t){switch(e){case`none`:return`${t} replies, but asks you before looking anything up — even a web search.`;case`low`:return`Low-risk lookups run on their own: web searches, reading files in ${t}'s own workspace.`;case`medium`:return`Also allows medium-risk lookups to run on their own.`;case`high`:return`Any lookup runs on its own, including reads of sensitive local files.`}}function Be({assistantName:e,defaultTier:t}){return(0,G.jsxs)(`div`,{className:`flex flex-col gap-2 px-4 py-3`,children:[(0,G.jsx)(d,{as:`span`,variant:`body-small-emphasised`,children:`Assistant Access levels`}),(0,G.jsxs)(d,{as:`p`,variant:`body-small-default`,className:`text-[color:var(--content-tertiary)]`,children:[`Applies to other people in the channel — your own requests use your global Assistant Access. The levels only cover how much `,e,` `,`looks up on its own before answering; writing, sending, and spending always come to you first, at every level. Your`,` `,(0,G.jsx)(i,{to:oe.settings.privacy,className:`text-[var(--content-link)] underline hover:text-[var(--content-link-hover)]`,children:`Trust Rules`}),` `,`fine-tune when it asks.`]}),(0,G.jsx)(`ul`,{className:`grid gap-x-6 gap-y-3 sm:grid-cols-2`,children:J.map(n=>{let r=Y[n];return(0,G.jsxs)(`li`,{className:`flex flex-col gap-0.5`,children:[(0,G.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,G.jsx)(De,{color:r.dotColor}),(0,G.jsx)(d,{as:`span`,variant:`body-small-emphasised`,children:r.label}),n===t?(0,G.jsx)(d,{as:`span`,variant:`body-small-default`,className:`text-[color:var(--content-tertiary)]`,children:`· default`}):null]}),(0,G.jsx)(d,{as:`span`,variant:`body-small-default`,className:`text-[color:var(--content-tertiary)]`,children:ze(n,e)})]},n)})})]})}var Ve=[{bucket:`channels`,icon:p,title:`Channels`,description:`Public and private channels`},{bucket:`dm`,icon:D,title:`Direct messages`,description:`One-on-one DMs`}];function He({assistantName:e,globalDefaultTier:t,bucketTiers:n,loading:r,error:i,pendingBuckets:a,onBucketChange:o,onBucketReset:s}){return(0,G.jsxs)(f.Root,{children:[(0,G.jsx)(f.Header,{children:(0,G.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[`Default access`,(0,G.jsxs)(d,{as:`p`,variant:`body-small-default`,className:`text-[color:var(--content-tertiary)]`,children:[`How much `,e,` does on its own, by conversation type. Individual channels can override this below.`]})]})}),(0,G.jsx)(f.Body,{className:`py-1`,children:Ve.map(({bucket:e,icon:c,title:l,description:u})=>{let d=e===`dm`?n?.channels??t:t;return(0,G.jsx)(S,{className:`[&+&]:border-t [&+&]:border-[var(--border-base)]`,leading:(0,G.jsx)(c,{className:`h-4 w-4 text-[var(--content-tertiary)]`}),title:l,subtitle:u,trailing:(0,G.jsx)(`div`,{className:`w-40 sm:w-48`,children:(0,G.jsx)(Oe,{tier:n?.[e],defaultTier:d,disabled:r||i||a.has(e),onTierChange:t=>o(e,t),onReset:()=>s(e),"aria-label":`Default Assistant Access for ${l}`})})},e)})}),(0,G.jsx)(f.Footer,{className:`p-0`,children:(0,G.jsx)(Be,{assistantName:e,defaultTier:t})})]})}var Ue=`0.10.8`;function We(){return ae(Ue)}function Ge(e,t,n){return X.map(r=>({selector:{scope:`channel`,adapter:e,channelExternalId:t},contactType:r,threshold:n}))}function Ke(e,t,n){return e.selector.scope===`channel`&&e.selector.adapter===t&&e.selector.channelExternalId===n}function qe(e,t){return t===`channels`?{scope:`adapter`,adapter:e}:{scope:`channel_type`,adapter:e,channelType:`dm`}}function Je(e,t,n){let r=qe(e,t);return X.map(e=>({selector:r,contactType:e,threshold:n}))}function Ye({assistantId:e,adapter:t}){let n=o(),r=We()&&!!e,i=(0,H.useMemo)(()=>({path:{assistant_id:e}}),[e]),a=(0,H.useMemo)(()=>g(i),[i]),l=(0,H.useMemo)(()=>[`channel-permission-resolve`,e,t],[e,t]),u=s({..._(i),enabled:r}),d=u.data?.cells,f=(0,H.useMemo)(()=>d?Ee(d,t):void 0,[d,t]),p=(0,H.useMemo)(()=>d?{channels:Q(d,t,`channels`),dm:Q(d,t,`dm`)}:void 0,[d,t]),m=s({queryKey:l,queryFn:async()=>{let{data:e}=await ce({...i,body:{adapter:t,contactType:`trusted_contact`},throwOnError:!0});return e.resolved?.threshold??null},enabled:r,retry:!1,staleTime:3e4}),h=(e,t)=>{let r=n.getQueryData(a),i=Date.now();return n.setQueryData(a,n=>({cells:[...(n?.cells??[]).filter(t=>!e(t)),...t.map(e=>({...e,updatedAt:i}))]})),{previous:r}},v=c({mutationFn:async({channelExternalId:e,tier:n})=>{await Promise.all(Ge(t,e,n).map(e=>L({...i,body:e,throwOnError:!0})))},onMutate:({channelExternalId:e,tier:n})=>h(n=>Ke(n,t,e),Ge(t,e,n)),onError:(e,t,r)=>{n.setQueryData(a,r?.previous),V(`Failed to save channel settings`)(e)},onSettled:()=>n.invalidateQueries({queryKey:a})}),y=c({mutationFn:async({channelExternalId:e})=>{await Promise.all(X.map(n=>R({...i,body:{selector:{scope:`channel`,adapter:t,channelExternalId:e},contactType:n},throwOnError:!0})))},onMutate:({channelExternalId:e})=>h(n=>Ke(n,t,e),[]),onError:(e,t,r)=>{n.setQueryData(a,r?.previous),V(`Failed to reset channel settings`)(e)},onSettled:()=>n.invalidateQueries({queryKey:a})}),b=c({mutationFn:async({bucket:e,tier:n})=>{await Promise.all(Je(t,e,n).map(e=>L({...i,body:e,throwOnError:!0})))},onMutate:({bucket:e,tier:n})=>h(n=>Z(n,t,e),Je(t,e,n)),onError:(e,t,r)=>{n.setQueryData(a,r?.previous),V(`Failed to save the default`)(e)},onSettled:(e,t,{bucket:r})=>{n.invalidateQueries({queryKey:a}),r===`channels`&&n.invalidateQueries({queryKey:l})}}),x=c({mutationFn:async({bucket:e})=>{let n=qe(t,e);await Promise.all(X.map(e=>R({...i,body:{selector:n,contactType:e},throwOnError:!0})))},onMutate:({bucket:e})=>h(n=>Z(n,t,e),[]),onError:(e,t,r)=>{n.setQueryData(a,r?.previous),V(`Failed to reset the default`)(e)},onSettled:(e,t,{bucket:r})=>{n.invalidateQueries({queryKey:a}),r===`channels`&&n.invalidateQueries({queryKey:l})}}),S=(0,H.useMemo)(()=>{let e=new Set;return v.isPending&&v.variables&&e.add(v.variables.channelExternalId),y.isPending&&y.variables&&e.add(y.variables.channelExternalId),e},[v.isPending,v.variables,y.isPending,y.variables]),C=(0,H.useMemo)(()=>{let e=new Set;return b.isPending&&b.variables&&e.add(b.variables.bucket),x.isPending&&x.variables&&e.add(x.variables.bucket),e},[b.isPending,b.variables,x.isPending,x.variables]);return!r||u.isError?{supported:!1,tierOverrides:void 0,defaultCellTier:void 0,bucketTiers:void 0,pendingChannelIds:new Set,pendingBuckets:new Set,isLoading:!1,isError:!1,onTierChange:void 0,onTierReset:void 0,onBucketChange:void 0,onBucketReset:void 0}:{supported:!0,tierOverrides:f,defaultCellTier:m.data,bucketTiers:p,pendingChannelIds:S,pendingBuckets:C,isLoading:u.isPending,isError:u.isError,onTierChange:(e,t)=>v.mutate({channelExternalId:e,tier:t}),onTierReset:e=>{f?.[e]!==void 0&&y.mutate({channelExternalId:e})},onBucketChange:(e,t)=>b.mutate({bucket:e,tier:t}),onBucketReset:e=>{p?.[e]!==void 0&&x.mutate({bucket:e})}}}function Xe({assistantId:e,assistantDisplayName:t,slackHandle:n}){let r=s({...y(e),enabled:!!e,select:e=>e.channels}),i=Ye({assistantId:e,adapter:`slack`}),a=s({queryKey:[`thresholds`,e],queryFn:()=>C(e),enabled:i.supported&&!!e,staleTime:3e4}).data?.interactive??null,o=i.defaultCellTier===void 0?null:i.defaultCellTier??a,c=(0,G.jsx)(Le,{assistantDisplayName:t,slackHandle:n,accessControlsSupported:i.supported,defaultTier:o,channels:r.data,loading:r.isPending,error:r.isError,tierOverrides:i.tierOverrides,tierOverridesLoading:i.isLoading,tierOverridesError:i.isError,pendingChannelIds:i.pendingChannelIds,onTierChange:i.onTierChange,onTierReset:i.onTierReset});return!i.supported||!i.onBucketChange||!i.onBucketReset?(0,G.jsx)(f.Root,{noPadding:!0,clipContents:!0,children:c}):(0,G.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,G.jsx)(He,{assistantName:t,globalDefaultTier:a,bucketTiers:i.bucketTiers,loading:i.isLoading,error:i.isError,pendingBuckets:i.pendingBuckets,onBucketChange:i.onBucketChange,onBucketReset:i.onBucketReset}),(0,G.jsx)(f.Root,{noPadding:!0,clipContents:!0,children:(0,G.jsx)(M.Root,{type:`single`,collapsible:!0,children:(0,G.jsxs)(M.Item,{value:`per-channel-overrides`,children:[(0,G.jsxs)(M.Trigger,{className:`group justify-between gap-2 px-4 py-3`,children:[(0,G.jsx)(d,{as:`span`,variant:`body-small-emphasised`,children:`Per-channel overrides`}),(0,G.jsx)(b,{"aria-hidden":`true`,className:`h-4 w-4 shrink-0 text-[var(--content-tertiary)] transition-transform group-data-[state=open]:rotate-180`})]}),(0,G.jsx)(M.Content,{className:`border-[var(--border-base)] data-[state=open]:border-t`,children:c})]})})})]})}function Ze({slackHandle:e,disconnectPending:t=!1,onDisconnect:r,children:i}){return(0,G.jsxs)(f.Root,{children:[(0,G.jsx)(f.Header,{children:(0,G.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,G.jsx)(`img`,{src:z(`/images/integrations/slack.svg`),alt:``,className:`size-8 rounded-lg bg-[var(--surface-sunken)] p-1`}),e?(0,G.jsx)(d,{as:`span`,variant:`body-medium-default`,children:e}):null,(0,G.jsx)(N,{tone:`positive`,leftIcon:(0,G.jsx)(x,{}),children:`Connected`}),(0,G.jsx)(`div`,{className:`ml-auto`,children:(0,G.jsx)(n,{type:`button`,variant:`ghost`,onClick:r,disabled:!r||t,children:t?`Disconnecting…`:`Disconnect`})})]})}),(0,G.jsx)(f.Body,{children:i})]})}function Qe({threadMode:e,threadModePending:t=!1,onThreadModeChange:n}){return(0,G.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,G.jsx)(d,{as:`span`,variant:`body-small-emphasised`,className:`text-[color:var(--content-secondary)]`,children:`Thread Behavior`}),(0,G.jsxs)(A,{value:e??`mention_then_thread`,onValueChange:e=>n?.(e),disabled:t||!n,"aria-label":`Slack thread behavior`,children:[(0,G.jsx)(k,{value:`mention_only`,label:`Mentions only`,helperText:`Bot only responds when @mentioned.`}),(0,G.jsx)(k,{value:`mention_then_thread`,label:`Follow threads after first mention`,helperText:`After an @mention in a thread, bot listens to all subsequent replies.`})]})]})}function $e({onSave:e}){let[t,r]=(0,H.useState)(``),[i,a]=(0,H.useState)(!1),[o,s]=(0,H.useState)(null),c=t.trim().length>0&&!i;return(0,G.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,G.jsx)(P,{label:`Bot Token`,type:`password`,value:t,onChange:e=>r(e.target.value),placeholder:`Paste your Telegram bot token`,disabled:i,fullWidth:!0}),o?(0,G.jsx)(`p`,{className:`text-label-small`,style:{color:`var(--content-negative)`},children:o}):null,(0,G.jsx)(`div`,{children:(0,G.jsx)(n,{type:`button`,onClick:async()=>{if(!(!e||!c)){a(!0),s(null);try{await e(t.trim()),r(``)}catch(e){s(e instanceof Error?e.message:`Failed to save`)}finally{a(!1)}}},disabled:!c,children:i?`Saving…`:`Save`})})]})}function et({onSave:e}){let[t,r]=(0,H.useState)(``),[i,a]=(0,H.useState)(``),[o,s]=(0,H.useState)(!1),[c,l]=(0,H.useState)(null),u=t.trim().length>0&&i.trim().length>0&&!o;return(0,G.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,G.jsx)(P,{label:`Account SID`,type:`text`,value:t,onChange:e=>r(e.target.value),placeholder:`ACxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx`,disabled:o,fullWidth:!0}),(0,G.jsx)(P,{label:`Auth Token`,type:`password`,value:i,onChange:e=>a(e.target.value),placeholder:`Twilio auth token`,disabled:o,fullWidth:!0}),c?(0,G.jsx)(`p`,{className:`text-label-small`,style:{color:`var(--content-negative)`},children:c}):null,(0,G.jsx)(`div`,{children:(0,G.jsx)(n,{type:`button`,onClick:async()=>{if(!(!e||!u)){s(!0),l(null);try{await e(t.trim(),i.trim()),r(``),a(``)}catch(e){l(e instanceof Error?e.message:`Failed to save`)}finally{s(!1)}}},disabled:!u,children:o?`Saving…`:`Save`})})]})}function tt({channel:e,assistantId:t,assistantName:r,assistantDisplayName:i,pending:a,initialManualEntry:o=!1,onSetup:s,onDisconnect:c,onSaveTelegramToken:l,onSaveSlackConfig:u,slackSaveStatus:d,slackSaveError:f,slackThreadMode:p,slackThreadModePending:m=!1,onSlackThreadModeChange:g,onSaveTwilioCredentials:_,policy:y,policySaving:b=!1,policyLoading:x=!1,policyError:S=!1,onPolicyChange:C}){let w=e.status===`ready`,[T,E]=(0,H.useState)(o);if(e.key===`slack`)return(0,G.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[w?(0,G.jsx)(Ze,{slackHandle:e.address,disconnectPending:a,onDisconnect:c,children:(0,G.jsx)(Qe,{threadMode:p,threadModePending:m,onThreadModeChange:g})}):(0,G.jsx)(Te,{children:(0,G.jsx)(de,{assistantName:r,onSave:u,saveStatus:d,saveError:f})}),w?(0,G.jsx)(Xe,{assistantId:t,assistantDisplayName:i,slackHandle:e.address}):null]});let D=W[e.key];return(0,G.jsx)(`div`,{className:`flex flex-col gap-4`,children:w?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(we,{address:e.address,pending:a,onDisconnect:c}),D.hasTrustFloorControl&&C?(0,G.jsx)(Ce,{assistantDisplayName:i,policy:y,saving:b,loading:x,error:S,onChange:C}):null]}):T?e.key===`telegram`?(0,G.jsx)($e,{onSave:l}):(0,G.jsx)(et,{onSave:_}):(0,G.jsx)(q,{icon:(0,G.jsx)(v,{channelId:e.key,className:`h-6 w-6`}),title:`${h(e.key)} isn't connected`,description:D.disconnectedPitch?.(i),action:(0,G.jsxs)(`div`,{className:`flex flex-col items-center gap-1`,children:[(0,G.jsx)(n,{type:`button`,variant:`outlined`,onClick:s,disabled:!s||a,children:a?`Opening…`:`Set up`}),(0,G.jsx)(n,{type:`button`,variant:`link`,onClick:()=>E(!0),children:`or connect manually`})]})})})}var nt={no_one:{title:`Block all messages?`,message:`Setting this channel to “No one” hard-denies every inbound message — including messages from you.
|
|
2
2
|
|
|
3
3
|
You can reverse this at any time.`,confirmLabel:`Block all`,destructive:!0},any_contact:{title:`Allow any contact?`,message:`“Any contact” admits every matched contact in this channel — including pending, unverified ones — not just your verified contacts.
|
|
4
4
|
|
package/dist/assets/{client-feature-flag-store-c2ESRWJ1.js → client-feature-flag-store-iq53KePp.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as e,t}from"./create-selectors-Qo7kcikX.js";import{i as n,r,s as i}from"./feature-flag-catalog-
|
|
1
|
+
import{n as e,t}from"./create-selectors-Qo7kcikX.js";import{i as n,r,s as i}from"./feature-flag-catalog-D6qrHLNs.js";var a=`vellum:ff:`,o=`vellum:ff-str:`;function s(){if(typeof window>`u`)return{};let e={};try{for(let t of Object.keys(r)){let n=localStorage.getItem(a+t);n!==null&&(e[t]=n===`true`)}}catch{}return e}function c(){if(typeof window>`u`)return{};let e={};try{for(let t of Object.keys(n)){let n=localStorage.getItem(o+t);n!==null&&(e[t]=n)}}catch{}return e}var l=s(),u=c(),d=i(`client`),f=t(e()(e=>{let t=e;return{...r,...l,...d.bool,stringFlags:{...n,...u,...d.str},hydrated:!1,setFlags:t=>e(e=>{let n=s(),r={...t,...n,...d.bool};return Object.keys(r).some(t=>r[t]!==e[t])?{...r,hydrated:!0}:e.hydrated?e:{hydrated:!0}}),setFlag:(t,n)=>{try{localStorage.setItem(a+t,String(n))}catch{}e({[t]:d.bool[t]??n})},clearOverride:t=>{try{localStorage.removeItem(a+t)}catch{}let n=d.bool[t]??r[t];n!==void 0&&e({[t]:n})},setStringFlags:e=>t(t=>{let n=c(),r={...e,...n,...d.str},i=t.stringFlags;return Object.keys(r).some(e=>r[e]!==i[e])?{stringFlags:r}:t}),setStringFlag:(e,n)=>{try{localStorage.setItem(o+e,n)}catch{}t(t=>({stringFlags:{...t.stringFlags,[e]:d.str[e]??n}}))},clearStringOverride:e=>{try{localStorage.removeItem(o+e)}catch{}let r=d.str[e]??n[e];t(t=>({stringFlags:{...t.stringFlags,[e]:r??``}}))}}}));export{f as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{o as e}from"./chunk-jRWAZmH_.js";import{t}from"./react-BFJW0bSv.js";import{t as n}from"./jsx-runtime-D3ZM-ToX.js";import{c as r,i,n as a,o,t as s}from"./use-command-palette-sections-
|
|
1
|
+
import{o as e}from"./chunk-jRWAZmH_.js";import{t}from"./react-BFJW0bSv.js";import{t as n}from"./jsx-runtime-D3ZM-ToX.js";import{c as r,i,n as a,o,t as s}from"./use-command-palette-sections-nhGyCH9v.js";import{ct as c}from"./local-mode-Ckii2tmN.js";import{n as l}from"./resolved-assistants-store-C-PdxK8f.js";import{D as u,O as d,i as f,n as p,s as m}from"./auth-store-D0-gDCVn.js";import{t as h}from"./client-feature-flag-store-iq53KePp.js";import{t as g}from"./use-app-theme-BEtFr7FK.js";import{i as _}from"./conversation-queries-rKv2GF7f.js";import{CommandPalette as v}from"./command-palette-DcxNV4b9.js";var y=e(t(),1),b=n(),x=()=>void 0,S=e=>void 0,C=e=>{switch(e.id){case`action-new-conversation`:return{kind:`newConversation`};case`action-current-conversation`:return{kind:`currentConversation`};case`action-settings`:return{kind:`openSettings`};case`action-library`:return{kind:`openLibrary`};case`action-intelligence`:return{kind:`openIdentity`};case`action-back`:return{kind:`navigateBack`};case`action-forward`:return{kind:`navigateForward`};case`action-zoom-in`:return{kind:`zoomIn`};case`action-zoom-out`:return{kind:`zoomOut`};case`action-actual-size`:return{kind:`actualSize`};default:return e.id.startsWith(`conv-`)?{kind:`openConversation`,conversationId:e.id.slice(5)}:e.id.startsWith(`search-conv-`)?{kind:`openConversation`,conversationId:e.id.slice(12)}:e.id.startsWith(`search-schedule-`)||e.id.startsWith(`search-contact-`)?{kind:`openIdentity`}:null}};function w(){let e=p.use.sessionStatus(),t=m(),n=f();g(),o(!t),r({sessionStatus:e,hasPlatformSession:n});let w=l.use.assistants(),T=l.use.activeAssistantId(),E=l.use.selectedAssistantId(),D=u.use.currentOrganizationId(),O=h.use.multiPlatformAssistant(),k=(0,y.useMemo)(()=>{let e=O&&!c()&&D?d(D):T;if(!e)return null;let t=w.find(t=>t.id===e);return t?{id:t.id,name:t.name}:null},[O,T,w,D,E]),A=k?.id??null,{conversations:j}=_(A,!0),M=(0,y.useCallback)(e=>{let t=C(e);t&&i(t)},[]),{commandPalette:N,mergedSections:P,handleItemSelect:F}=s({assistantId:A,assistantName:k?.name,conversations:j,activeConversationId:void 0,startNewConversation:x,switchConversation:x,navigate:S,navigateToSettings:x,isOpen:!0,onClose:()=>{a()},onItemSelect:M});return(0,b.jsx)(`div`,{className:`h-screen w-screen bg-transparent`,children:(0,b.jsx)(v,{isOpen:!0,surface:`window`,onClose:N.close,query:N.query,onQueryChange:N.setQuery,selectedIndex:N.selectedIndex,sections:P,isSearching:N.isSearching,onItemSelect:F,onKeyDown:N.handleKeyDown})})}export{w as CommandPaletteWindowPage};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{o as e}from"./chunk-jRWAZmH_.js";import{t}from"./react-BFJW0bSv.js";import{t as n}from"./button-Dy5001j6.js";import{m as r,n as i,u as a}from"./chunk-5KNZJZUH-Bsoom5--.js";import{n as o}from"./QueryClientProvider-CMu7CkQU.js";import{t as s}from"./useQuery-Bz-fbQ-m.js";import{t as c}from"./useMutation-CXGTrp4W.js";import{t as l}from"./jsx-runtime-D3ZM-ToX.js";import{t as u}from"./typography-DEI9Ra9z.js";import{t as d}from"./card-DRIctGVs.js";import{t as f}from"./createLucideIcon-CAM1RhH8.js";import{t as p}from"./arrow-left-C2ylPLHq.js";import{t as m}from"./arrow-right-B-jRJNWP.js";import{a as h,b as g,c as _,d as v,l as y,x as b,y as x}from"./use-save-twilio-credentials-dUedxPbM.js";import{t as S}from"./circle-check-big-DSsDH5_6.js";import{t as C}from"./link-2-BKL8QWRX.js";import{t as w}from"./loader-circle-XREx3i4W.js";import{t as T}from"./mail-CMdPNysl.js";import{t as E}from"./message-square-CQGiY4zk.js";import{t as D}from"./pencil-D38YNe2r.js";import{t as O}from"./plus-jH3kAliM.js";import{t as k}from"./search-BVW-n8to.js";import{t as A}from"./send-Q71Exj3z.js";import{t as j}from"./user-plus-oiIr9ey8.js";import{t as M}from"./tag-NXcyiTkK.js";import{t as N}from"./input-hw3el2GJ.js";import{t as P}from"./modal-BR4CUFBd.js";import{t as F}from"./panel-item-CrtoJCrd.js";import{n as ee}from"./toast-LgLp4obE.js";import{t as I}from"./confirm-dialog-UYFm4osC.js";import{C as te}from"./sdk.gen-BVAVE6A_.js";import{Ht as ne,S as L,Ut as re,a as ie,b as ae,x as oe}from"./react-query.gen-r3I6j8-1.js";import{t as se}from"./assistant-identity-store-DIyVo8LV.js";import{u as ce}from"./routes-vE-2hncW.js";import{n as R}from"./conversation-navigation-DE-Nj8N3.js";import{t as le}from"./assistant-feature-flag-store-ltLrn6Vo.js";import{t as z}from"./use-active-assistant-id-CXhDyK7y.js";import{i as ue,l as de,n as fe,r as B,t as pe}from"./use-invite-link-dialog-Cvvpn0Hm.js";import{t as V}from"./detail-card-BMRGmkia.js";import{n as me,t as he}from"./mobile-sidebar-drawer-CXGCmJ_p.js";import{t as H}from"./mutation-error-zQ6oi-va.js";import{a as ge,i as _e,n as U,t as ve}from"./contacts-gateway-CFNbQjfX.js";var ye=f(`circle-question-mark`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3`,key:`1u773s`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]]),W=f(`ellipsis-vertical`,[[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}],[`circle`,{cx:`12`,cy:`5`,r:`1`,key:`gxeob9`}],[`circle`,{cx:`12`,cy:`19`,r:`1`,key:`lyex9k`}]]),be=f(`git-merge`,[[`circle`,{cx:`18`,cy:`18`,r:`3`,key:`1xkwt0`}],[`circle`,{cx:`6`,cy:`6`,r:`3`,key:`1lh9wr`}],[`path`,{d:`M6 21V9a9 9 0 0 0 9 9`,key:`7kw0sc`}]]),G=e(t(),1),xe=new Set([`slack`]);function K(e){return e.status===`verified`||e.status===`active`&&e.verifiedAt!=null}var q=l();function Se({channels:e,pendingChannelKey:t=null,onConnect:n,onDisconnect:r}){let[i,a]=(0,G.useState)(null);return(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(`div`,{className:`flex flex-col`,children:e.map((e,i)=>(0,q.jsxs)(`div`,{children:[i>0?(0,q.jsx)(`div`,{className:`border-t`,style:{borderColor:`var(--border-base)`}}):null,(0,q.jsx)(J,{channel:e,pending:t===e.key,onConnect:n?()=>n(e.key):void 0,onDisconnect:r?()=>a(e.key):void 0})]},e.key))}),(0,q.jsx)(I,{open:i!==null,title:`Disconnect ${i?v(i):``}?`,message:`This clears the stored credentials for this channel. You can reconnect later.`,confirmLabel:`Disconnect`,destructive:!0,onConfirm:()=>{i&&r&&r(i),a(null)},onCancel:()=>a(null)})]})}function J({channel:e,pending:t,onConnect:r,onDisconnect:i}){let a=e.status===`ready`;return(0,q.jsxs)(`div`,{className:`flex items-center gap-3 py-4`,children:[(0,q.jsx)(y,{channelId:e.key,className:`h-4 w-4 shrink-0 text-[color:var(--content-secondary)]`}),(0,q.jsx)(`span`,{className:`text-body-medium-default`,style:{color:`var(--content-default)`},children:v(e.key)}),a&&e.address?(0,q.jsx)(`span`,{className:`truncate text-body-medium-lighter`,style:{color:`var(--content-tertiary)`},children:e.address}):null,(0,q.jsx)(`div`,{className:`ml-auto flex shrink-0 items-center gap-2`,children:a?(0,q.jsxs)(q.Fragment,{children:[(0,q.jsxs)(`span`,{className:`inline-flex items-center gap-1 h-8 px-2.5 rounded-md whitespace-nowrap select-none text-body-small-emphasised leading-none bg-[var(--content-default)] text-[var(--surface-base)]`,children:[(0,q.jsx)(S,{className:`h-3 w-3`}),`Connected`]}),(0,q.jsx)(n,{variant:`danger`,onClick:i,disabled:!i||t,children:t?`Disconnecting…`:`Disconnect`})]}):(0,q.jsx)(n,{variant:`outlined`,onClick:r,disabled:!r||t,children:`Connect`})})]})}function Y({role:e,contactType:t}){let{label:n,tone:r}=X(e,t);return(0,q.jsx)(M,{tone:r,children:n})}function X(e,t){switch(e){case`guardian`:return{label:`Guardian`,tone:`positive`};case`assistant`:return{label:`Assistant`,tone:`negative`};default:return t===`assistant`?{label:`Assistant`,tone:`negative`}:{label:`Human`,tone:`warning`}}}function Ce({assistantName:e,...t}){let n=de(e);return(0,q.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[(0,q.jsx)(V,{title:`${n} (Your Assistant)`,accessory:(0,q.jsx)(Y,{role:`assistant`}),compactAccessory:!0}),(0,q.jsx)(V,{title:`Channels`,subtitle:`Where ${n} can be reached.`,children:(0,q.jsx)(Se,{...t})})]})}var Z=new Set([`telegram`,`phone`,`vellum`,`whatsapp`,`slack`,`email`,`platform`,`a2a`]);function we(e){return Z.has(e)}function Te(e,t){return e.id===`a2a`?t&&t.status!==`revoked`?{kind:`connected`}:{kind:`setup`}:t!=null&&K(t)?{kind:`verified`}:t?.status===`blocked`?{kind:`none`}:t&&t.status!==`revoked`?{kind:`unverified`}:{kind:`setup`}}function Ee(e,t,n){let r=[],i=new Set;if(e)for(let t of e)t.id===`a2a`&&!n||(r.push(t),i.add(t.id));for(let e of t)e.status===`revoked`||i.has(e.type)||e.type===`a2a`&&!n||we(e.type)&&(r.push({id:e.type,label:e.type.charAt(0).toUpperCase()+e.type.slice(1),subtitle:``,icon:`help-circle`,supportsVerification:!1,setupMessages:{guardian:``,contact:``}}),i.add(e.type));return r}function Q({name:e,className:t,style:n}){switch(e){case`bot`:return(0,q.jsx)(b,{className:t,style:n});case`hash`:return(0,q.jsx)(g,{className:t,style:n});case`send`:return(0,q.jsx)(A,{className:t,style:n});case`phone`:return(0,q.jsx)(x,{className:t,style:n});case`mail`:return(0,q.jsx)(T,{className:t,style:n});case`message-square`:return(0,q.jsx)(E,{className:t,style:n});default:return(0,q.jsx)(ye,{className:t,style:n})}}function $({contactChannels:e,availableChannels:t,a2aEnabled:n,setupLabel:r=`Invite`,verifyLoading:i,verifySubject:a=`self`,onSetupChannel:o,onVerifyChannel:s,onRevokeChannel:c,onLinkAccount:l}){let[u,d]=(0,G.useState)(null),[f,p]=(0,G.useState)(null),m=new Map;for(let t of e)t.status!==`revoked`&&(m.has(t.type)||m.set(t.type,t));return(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(`div`,{className:`flex flex-col`,children:Ee(t,e,n).map((e,t)=>{let n=m.get(e.id);return(0,q.jsxs)(`div`,{children:[t>0&&(0,q.jsx)(`div`,{className:`border-t`,style:{borderColor:`var(--border-base)`}}),(0,q.jsx)(De,{info:e,existing:n,setupLabel:r,verifyLoading:i,onSetup:o?()=>o(e.id):void 0,onVerify:s&&e.supportsVerification?()=>d(e):void 0,onRevoke:c&&n?()=>p({channelId:n.id,channel:e}):void 0,onLinkAccount:l&&xe.has(e.id)?()=>l(e.id):void 0})]},e.id)})}),u&&(0,q.jsx)(I,{open:!0,title:`Verify ${u.label}`,message:a===`contact`?`This will mark this contact's ${u.label} channel as verified. Your assistant will recognize them when they reach out from it.`:`This will mark your ${u.label} channel as verified. Your assistant will recognize you when you reach out from it.`,confirmLabel:`Verify`,onConfirm:()=>{u&&(s?.(u.id),d(null))},onCancel:()=>d(null)}),f&&(0,q.jsx)(I,{open:!0,title:`Revoke ${f.channel.label}`,message:`This will disconnect the verified channel. The contact will need to re-verify to use this channel again.`,confirmLabel:`Revoke`,destructive:!0,onConfirm:()=>{c?.(f.channelId,f.channel.id),p(null)},onCancel:()=>p(null)})]})}function De({info:e,existing:t,setupLabel:r,verifyLoading:i,onSetup:a,onVerify:o,onRevoke:s,onLinkAccount:c}){let l=Te(e,t);return(0,q.jsxs)(`div`,{className:`flex items-center gap-3 py-4`,children:[(0,q.jsx)(Q,{name:e.icon,className:`h-4 w-4 shrink-0`,style:{color:`var(--content-secondary)`}}),(0,q.jsx)(`span`,{className:`text-body-medium-default`,style:{color:`var(--content-default)`},children:e.label}),t?.address?(0,q.jsx)(`span`,{className:`truncate text-body-medium-lighter`,style:{color:`var(--content-tertiary)`},children:t.address}):null,(0,q.jsx)(`div`,{className:`ml-auto flex shrink-0 items-center gap-2`,children:l.kind===`connected`?(0,q.jsxs)(q.Fragment,{children:[(0,q.jsxs)(`span`,{className:`inline-flex items-center gap-1 h-8 px-2.5 rounded-md whitespace-nowrap select-none text-body-small-emphasised leading-none bg-[var(--content-default)] text-[var(--surface-base)]`,children:[(0,q.jsx)(S,{className:`h-3 w-3`}),`Connected`]}),s?(0,q.jsx)(n,{variant:`danger`,onClick:s,children:`Revoke`}):null]}):l.kind===`verified`?(0,q.jsxs)(q.Fragment,{children:[(0,q.jsxs)(`span`,{className:`inline-flex items-center gap-1 h-8 px-2.5 rounded-md whitespace-nowrap select-none text-body-small-emphasised leading-none bg-[var(--content-default)] text-[var(--surface-base)]`,children:[(0,q.jsx)(S,{className:`h-3 w-3`}),`Verified`]}),s?(0,q.jsx)(n,{variant:`danger`,onClick:s,children:`Revoke`}):null]}):l.kind===`unverified`?(0,q.jsx)(n,{variant:`outlined`,onClick:o,disabled:!o||i,children:i?`Verifying…`:`Verify`}):l.kind===`setup`?e.id===`a2a`?null:(0,q.jsxs)(q.Fragment,{children:[c?(0,q.jsxs)(n,{onClick:c,children:[(0,q.jsx)(C,{className:`h-3.5 w-3.5`}),`Link account`]}):null,(0,q.jsx)(n,{variant:`outlined`,onClick:a,disabled:!a,children:r})]}):null})]})}function Oe(e){return(0,q.jsx)(ke,{...e},e.contact.id)}function ke({contact:e,savePending:t,deletePending:r,verifyPending:i,mergePending:a=!1,canMerge:o=!1,availableChannels:s,a2aEnabled:c,onSave:l,onDelete:u,onMerge:d,onSetupChannel:f,onVerifyChannel:p,onRevokeChannel:m,onLinkAccount:h}){let g=e.displayName===`New Contact`,[_,v]=(0,G.useState)(g?``:e.displayName),[y,b]=(0,G.useState)(e.notes??``),[x,S]=(0,G.useState)(!1),C=_.trim(),w=y.trim(),T=g?``:e.displayName,E=e.notes??``,D=C!==T||w!==E,O=C.length>0&&D&&!t&&!r,k=g&&e.channels.length===0&&e.interactionCount===0,A=C||e.displayName,j=`${e.interactionCount} interaction${e.interactionCount===1?``:`s`}`;return(0,q.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[(0,q.jsx)(V,{title:A,accessory:(0,q.jsx)(Y,{role:e.role,contactType:e.contactType}),compactAccessory:!0,subtitle:j,children:(0,q.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,q.jsx)(N,{label:`Name`,type:`text`,value:_,onChange:e=>v(e.target.value),placeholder:`Give this human a name`,autoFocus:g,disabled:t||r,fullWidth:!0}),(0,q.jsx)(N,{label:`Notes`,type:`text`,value:y,onChange:e=>b(e.target.value),placeholder:`Optional notes about the human which AI will take into account`,disabled:t||r,fullWidth:!0}),(0,q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,q.jsx)(n,{type:`button`,onClick:()=>l({displayName:C,notes:w}),disabled:!O,children:t?`Saving…`:`Save`}),d?(0,q.jsx)(n,{type:`button`,variant:`outlined`,onClick:d,disabled:!o||k||D||a||t||r,title:o?k?`Save this contact before merging`:D?`Save your changes before merging`:void 0:`No other contacts available to merge`,children:a?`Merging…`:`Merge…`}):null,(0,q.jsx)(n,{type:`button`,variant:`danger`,onClick:()=>{k?u():S(!0)},disabled:r,children:r?`Deleting…`:`Delete Contact`})]})]})}),(0,q.jsx)(V,{title:`Linked accounts`,subtitle:`Where the assistant recognizes this contact. Link accounts you know, invite the ones you don't.`,children:(0,q.jsx)($,{contactChannels:e.channels,availableChannels:s,a2aEnabled:c,verifyLoading:i,verifySubject:`contact`,onSetupChannel:f,onVerifyChannel:p,onRevokeChannel:m,onLinkAccount:h})}),(0,q.jsx)(I,{open:x,title:`Delete ${e.displayName}?`,message:`This will permanently delete this contact and all their channels. This action cannot be undone.`,confirmLabel:`Delete`,destructive:!0,onConfirm:()=>{S(!1),u()},onCancel:()=>S(!1)})]})}function Ae(e){return(0,q.jsx)(je,{...e},`${e.survivor.id}:${e.open?`open`:`closed`}`)}function je({open:e,survivor:t,candidates:r,pending:i,errorMessage:a,onMerge:o,onClose:s}){let[c,l]=(0,G.useState)(``),[d,f]=(0,G.useState)(null);(0,G.useEffect)(()=>{d&&!r.some(e=>e.id===d)&&f(null)},[r,d]);let m=(0,G.useMemo)(()=>{let e=c.trim().toLowerCase();return e?r.filter(t=>t.displayName.toLowerCase().includes(e)):r},[r,c]),h=d?r.find(e=>e.id===d)??null:null,g=Ie(t);return(0,q.jsx)(P.Root,{open:e,onOpenChange:e=>{!e&&!i&&s()},children:(0,q.jsxs)(P.Content,{size:`md`,children:[(0,q.jsxs)(P.Header,{children:[(0,q.jsx)(P.Title,{icon:be,children:h?`Merge "${h.displayName}" into ${g}?`:`Merge another contact into ${g}`}),(0,q.jsx)(P.Description,{children:h?`Channels and notes from the merged contact will move over. The merged contact will be deleted.`:`The contact you pick will be deleted. Its channels and notes will be added to this one.`})]}),(0,q.jsxs)(P.Body,{className:`flex flex-col gap-3`,children:[h?(0,q.jsx)(Pe,{survivor:t,donor:h}):r.length===0?(0,q.jsx)(Fe,{}):(0,q.jsx)(Me,{search:c,onSearch:l,candidates:m,onPick:f}),a?(0,q.jsx)(u,{as:`p`,variant:`body-small-default`,className:`text-(--system-negative-strong)`,role:`alert`,children:a}):null]}),(0,q.jsx)(P.Footer,{children:h?(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(n,{variant:`outlined`,onClick:()=>f(null),disabled:i,leftIcon:(0,q.jsx)(p,{"aria-hidden":!0}),children:`Back`}),(0,q.jsx)(n,{variant:`danger`,onClick:()=>o(h.id),disabled:i,children:i?`Merging…`:`Merge`})]}):(0,q.jsx)(n,{variant:`outlined`,onClick:s,disabled:i,children:`Cancel`})})]})})}function Me({search:e,onSearch:t,candidates:n,onPick:r}){return(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(N,{type:`text`,value:e,onChange:e=>t(e.target.value),placeholder:`Search contacts`,leftIcon:(0,q.jsx)(k,{className:`h-3.5 w-3.5`,"aria-hidden":!0}),fullWidth:!0}),(0,q.jsx)(`div`,{className:`flex max-h-[320px] min-h-[120px] flex-col gap-1 overflow-y-auto`,role:`listbox`,"aria-label":`Select a contact to merge`,children:n.length===0?(0,q.jsx)(u,{as:`p`,variant:`body-small-default`,className:`px-3 py-4 text-center text-(--content-tertiary)`,children:`No matching contacts`}):n.map(e=>(0,q.jsx)(Ne,{contact:e,onPick:()=>r(e.id)},e.id))})]})}function Ne({contact:e,onPick:t}){let n=Be(e).join(` | `)||void 0;return(0,q.jsx)(F,{asChild:!0,label:``,children:(0,q.jsx)(`button`,{type:`button`,onClick:t,role:`option`,"aria-selected":`false`,className:`flex h-auto w-full items-center gap-2 rounded-[6px] px-[8px] py-2 text-left`,children:(0,q.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col`,children:[(0,q.jsx)(`span`,{className:`truncate text-body-medium-default`,children:e.displayName}),n?(0,q.jsx)(`span`,{className:`truncate text-body-small-default text-(--content-tertiary)`,children:n}):null]})})})}function Pe({survivor:e,donor:t}){let n=Ie(e),{moved:r,duplicates:i}=ze(e,t);return(0,q.jsxs)(`ul`,{className:`flex flex-col gap-2 text-body-medium-lighter text-(--content-secondary)`,children:[(0,q.jsxs)(`li`,{children:[(0,q.jsxs)(`span`,{className:`text-(--content-default)`,children:[`“`,t.displayName,`”`]}),` `,`will be deleted.`]}),(0,q.jsx)(`li`,{children:r.length===0?`No new channels will move to ${n}.`:`${r.length} channel${r.length===1?``:`s`} will move to ${n}: ${r.map(e=>Re(e.type)).join(`, `)}.`}),i.length>0?(0,q.jsxs)(`li`,{className:`text-(--content-tertiary)`,children:[i.length,` duplicate channel`,i.length===1?``:`s`,` already on `,n,` `,`(skipped).`]}):null,t.notes?(0,q.jsx)(`li`,{children:`Notes from the merged contact will be appended.`}):null,(0,q.jsx)(`li`,{className:`text-(--content-tertiary)`,children:`This cannot be undone.`})]})}function Fe(){return(0,q.jsx)(u,{as:`p`,variant:`body-medium-lighter`,className:`px-3 py-6 text-center text-(--content-tertiary)`,children:`No other contacts available to merge.`})}function Ie(e){return e.role===`guardian`?!e.displayName||e.displayName.startsWith(`vellum-principal-`)?`you`:`${e.displayName} (you)`:e.displayName||`this contact`}var Le={slack:`Slack`,telegram:`Telegram`,phone:`Phone`,email:`Email`,whatsapp:`WhatsApp`};function Re(e){return Le[e.toLowerCase()]??e}function ze(e,t){let n=[],r=[];for(let i of t.channels)i.status!==`revoked`&&(e.channels.some(e=>e.type===i.type&&e.address.toLowerCase()===i.address.toLowerCase())?r.push(i):n.push(i));return{moved:n,duplicates:r}}function Be(e){let t=new Set,n=[];for(let r of e.channels){if(r.status===`revoked`)continue;let e=r.type.toLowerCase();t.has(e)||(t.add(e),n.push(Le[e]??r.type))}return n}function Ve({loading:e,guardian:t,assistantName:r,regularContacts:i,selection:a,onSelect:o,onAddContact:s,addingContact:c=!1}){let[l,u]=(0,G.useState)(``),f=l.trim()?i.filter(e=>e.displayName.toLowerCase().includes(l.trim().toLowerCase())):i;return(0,q.jsx)(d.Root,{className:`flex h-full flex-col overflow-hidden`,children:(0,q.jsxs)(d.Body,{className:`flex min-h-0 min-w-0 flex-1 flex-col gap-4`,children:[(0,q.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,q.jsx)(`h2`,{className:`text-title-medium`,style:{color:`var(--content-default)`},children:`Entries`}),(0,q.jsx)(n,{type:`button`,variant:`ghost`,iconOnly:c?(0,q.jsx)(w,{className:`animate-spin`,"aria-hidden":!0}):(0,q.jsx)(O,{"aria-hidden":!0}),onClick:s,disabled:c,"aria-label":`Add contact`,tintColor:`var(--content-secondary)`})]}),(0,q.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[t?(0,q.jsx)(He,{name:t.displayName?`${t.displayName} (You)`:`You`,role:t.role,channelTypes:t.channelTypes,selected:a?.kind===`contact`&&a.contactId===t.id,onClick:()=>o({kind:`contact`,contactId:t.id}),trailingIcon:`pencil`}):null,(0,q.jsx)(He,{name:r?.trim()||`Your Assistant`,role:`assistant`,selected:a?.kind===`assistant`,onClick:()=>o({kind:`assistant`}),trailingIcon:`more`})]}),(0,q.jsx)(`div`,{className:`border-t`,style:{borderColor:`var(--border-base)`}}),i.length>0?(0,q.jsx)(N,{type:`text`,value:l,onChange:e=>u(e.target.value),placeholder:`Search Contacts`,leftIcon:(0,q.jsx)(k,{className:`h-3.5 w-3.5`,"aria-hidden":!0}),fullWidth:!0}):null,i.length>0?(0,q.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto flex flex-col gap-1`,children:[f.map(e=>(0,q.jsx)(He,{name:e.displayName,role:e.role,contactType:e.contactType,channelTypes:e.channelTypes,verified:e.verified,selected:a?.kind===`contact`&&a.contactId===e.id,onClick:()=>o({kind:`contact`,contactId:e.id}),trailingIcon:`more`},e.id)),f.length===0?(0,q.jsx)(`p`,{className:`px-3 py-4 text-center text-body-small-default`,style:{color:`var(--content-tertiary)`},children:`No matching contacts`}):null]}):e?null:(0,q.jsx)(n,{type:`button`,variant:`ghost`,onClick:s,disabled:c,tintColor:`var(--primary-base)`,leftIcon:c?(0,q.jsx)(w,{className:`animate-spin`,"aria-hidden":!0}):(0,q.jsx)(j,{"aria-hidden":!0}),children:`Add Contact`})]})})}function He({name:e,role:t,contactType:n,channelTypes:r,selected:i,onClick:a,trailingIcon:o,verified:s}){let c=r&&r.length>0?r.join(` | `):void 0;return(0,q.jsx)(F,{asChild:!0,active:i,label:``,trailingAction:o===`pencil`?(0,q.jsx)(D,{className:`h-3.5 w-3.5`,"aria-hidden":!0}):o===`more`?(0,q.jsx)(W,{className:`h-3.5 w-3.5`,"aria-hidden":!0}):void 0,children:(0,q.jsxs)(`button`,{type:`button`,onClick:a,className:`flex h-auto w-full items-center gap-2 rounded-[6px] px-[8px] py-2 text-left`,children:[(0,q.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col`,children:[(0,q.jsx)(`span`,{className:`truncate text-body-medium-default`,children:e}),c?(0,q.jsx)(`span`,{className:`truncate text-body-small-default`,style:{color:`var(--content-tertiary)`},children:c}):null]}),(0,q.jsxs)(`span`,{className:`flex shrink-0 items-center gap-1`,children:[s===void 0?null:(0,q.jsx)(M,{tone:s?`positive`:`neutral`,children:s?`Verified`:`Unverified`}),(0,q.jsx)(Y,{role:t,contactType:n})]})]})})}function Ue(e){return(0,q.jsx)(We,{...e},e.contact.id)}function We({contact:e,savePending:t,verifyPending:r,mergePending:i=!1,canMerge:a=!1,availableChannels:o,a2aEnabled:s,onSave:c,onMerge:l,onSetupChannel:u,onVerifyChannel:d,onRevokeChannel:f,onGenerateInviteLink:p}){let m=e.displayName.startsWith(`vellum-principal-`),h=m?``:e.displayName,[g,_]=(0,G.useState)(h),[v,y]=(0,G.useState)(e.notes??``),b=g.trim(),x=v.trim(),S=b!==h.trim()||x!==(e.notes??``).trim(),C=S&&!t,w=`${e.interactionCount} interaction${e.interactionCount===1?``:`s`}`;return(0,q.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[(0,q.jsx)(V,{title:m?`You`:`${e.displayName} (You)`,accessory:(0,q.jsx)(Y,{role:`guardian`}),compactAccessory:!0,subtitle:w,children:(0,q.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,q.jsx)(N,{label:`Name`,type:`text`,value:g,onChange:e=>_(e.target.value),placeholder:`Your name`,disabled:t,fullWidth:!0}),(0,q.jsx)(N,{label:`Notes`,type:`text`,value:v,onChange:e=>y(e.target.value),placeholder:`Notes about yourself which AI will take into account`,disabled:t,fullWidth:!0}),(0,q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,q.jsx)(n,{variant:`primary`,onClick:()=>c({displayName:b||e.displayName,notes:x}),disabled:!C,children:t?`Saving…`:`Save`}),l?(0,q.jsx)(n,{variant:`outlined`,onClick:l,disabled:!a||S||i||t,title:a?S?`Save your changes before merging`:void 0:`No other contacts available to merge`,children:i?`Merging…`:`Merge…`}):null]})]})}),(0,q.jsx)(V,{title:`Channels`,subtitle:`Once verified, your assistant will recognize you when you message from these channels.`,children:(0,q.jsx)($,{contactChannels:e.channels,availableChannels:o,a2aEnabled:s,setupLabel:`Verify me`,verifyLoading:r,onSetupChannel:u,onVerifyChannel:d,onRevokeChannel:f})}),p?(0,q.jsx)(B,{onClick:p}):null]})}function Ge(e,t){let n=t.trim().toLowerCase().replace(/^@/,``);return n===``?e:e.filter(e=>e.displayName.toLowerCase().includes(n)||e.username.toLowerCase().includes(n))}function Ke(e){let t=e.trim().split(/\s+/).filter(Boolean);return`${t[0]?.[0]??`?`}${t.length>1?t[t.length-1]?.[0]??``:``}`.toUpperCase()}function qe({open:e,channelLabel:t,contactName:r,accounts:i,loading:a,errorMessage:o,pendingAccountId:s,onPick:c,onClose:l,onInviteInstead:u}){let[d,f]=(0,G.useState)(``);(0,G.useEffect)(()=>{e&&f(``)},[e]);let p=(0,G.useMemo)(()=>Ge(i??[],d),[i,d]),h=s!=null;return(0,q.jsx)(P.Root,{open:e,onOpenChange:e=>!e&&l(),children:(0,q.jsxs)(P.Content,{size:`sm`,children:[(0,q.jsxs)(P.Header,{children:[(0,q.jsxs)(P.Title,{children:[`Link `,t,` account`]}),(0,q.jsxs)(P.Description,{children:[`Search your `,t,` workspace and pick`,` `,(0,q.jsx)(`span`,{className:`text-[color:var(--content-default)]`,children:r}),`’s account.`]})]}),(0,q.jsxs)(P.Body,{className:`flex flex-col gap-3`,children:[(0,q.jsx)(N,{type:`search`,value:d,onChange:e=>f(e.target.value),placeholder:`Search by name or @handle`,"aria-label":`Search ${t} workspace accounts`,leftIcon:(0,q.jsx)(k,{className:`h-4 w-4`}),fullWidth:!0}),o?(0,q.jsx)(`p`,{className:`text-body-small-default text-[color:var(--content-negative)]`,children:o}):null,(0,q.jsx)(`div`,{className:`max-h-80 overflow-y-auto`,children:a?(0,q.jsx)(`p`,{className:`py-4 text-center text-body-small-default text-[color:var(--content-tertiary)]`,children:`Loading workspace members…`}):p.length===0?(0,q.jsx)(`p`,{className:`py-4 text-center text-body-small-default text-[color:var(--content-tertiary)]`,children:(i?.length??0)===0?`No workspace members found.`:`No members match.`}):(0,q.jsx)(`ul`,{className:`flex flex-col`,children:p.map(e=>(0,q.jsx)(`li`,{children:(0,q.jsxs)(`button`,{type:`button`,onClick:()=>c(e),disabled:h,className:`flex w-full cursor-pointer items-center gap-3 rounded-md px-2 py-2 text-left transition-colors hover:bg-[var(--surface-overlay)] disabled:cursor-not-allowed disabled:opacity-60`,children:[e.imageUrl?(0,q.jsx)(`img`,{src:e.imageUrl,alt:``,className:`h-8 w-8 shrink-0 rounded-full`}):(0,q.jsx)(`span`,{"aria-hidden":`true`,className:`flex h-8 w-8 shrink-0 items-center justify-center rounded-full bg-[var(--tag-bg-neutral)] text-body-small-emphasised text-[color:var(--content-secondary)]`,children:Ke(e.displayName)}),(0,q.jsxs)(`span`,{className:`flex min-w-0 flex-col`,children:[(0,q.jsx)(`span`,{className:`truncate text-body-medium-default text-[color:var(--content-default)]`,children:e.displayName}),(0,q.jsxs)(`span`,{className:`truncate text-body-small-default text-[color:var(--content-tertiary)]`,children:[`@`,e.username]})]}),s===e.id?(0,q.jsx)(`span`,{className:`ml-auto shrink-0 text-body-small-default text-[color:var(--content-tertiary)]`,children:`Linking…`}):null]})},e.id))})})]}),(0,q.jsxs)(P.Footer,{className:`items-center justify-between gap-3 border-t border-[var(--border-base)]`,children:[(0,q.jsxs)(`p`,{className:`text-body-small-default text-[color:var(--content-tertiary)]`,children:[`Picking marks this account as`,` `,(0,q.jsx)(`span`,{className:`text-[color:var(--content-secondary)]`,children:`guardian-linked`}),` `,`— you vouch for the identity, no handshake needed.`]}),u?(0,q.jsxs)(n,{variant:`link`,className:`shrink-0`,onClick:u,disabled:h,children:[`Or send an invite instead`,(0,q.jsx)(m,{className:`h-3.5 w-3.5`})]}):null]})]})})}function Je({assistantId:e,channelType:t,contact:n,onLinked:r}){let[i,a]=(0,G.useState)(!1),o=c({mutationFn:n=>U(e,n.contact,{type:t,address:n.account.id}),onSuccess:(e,t)=>{a(!1),ee.success(`Linked as @${t.account.username}`),r()}}),s=(0,G.useCallback)(()=>{o.reset(),a(!0)},[o]),l=(0,G.useCallback)(()=>{o.isPending||(o.reset(),a(!1))},[o]),u=(0,G.useCallback)(e=>{!n||o.isPending||o.mutate({contact:n,account:e})},[n,o]);return{channelType:t,dialogOpen:i,open:s,close:l,linkErrorMessage:o.error instanceof Error?o.error.message:o.error?`Failed to link account`:null,pendingAccountId:o.isPending?o.variables.account.id:null,pick:u}}var Ye=[{id:`slack`,label:`Slack`,subtitle:`Message your assistant from Slack`,icon:`hash`,supportsVerification:!0,setupMessages:{guardian:`I'd like to verify my identity as your guardian on Slack. Can you help me set that up?`,contact:`I'd like to verify a contact's Slack identity. Can you walk me through it?`}},{id:`telegram`,label:`Telegram`,subtitle:`Message your assistant from Telegram`,icon:`send`,supportsVerification:!0,setupMessages:{guardian:`I'd like to verify my identity as your guardian on Telegram. Can you help me set that up?`,contact:`I'd like to verify a contact's Telegram identity. Can you walk me through it?`}},{id:`phone`,label:`Phone Calling`,subtitle:`Call or text your assistant via phone`,icon:`phone`,supportsVerification:!0,setupMessages:{guardian:`I'd like to verify my identity as your guardian for phone calls. Can you help me set that up?`,contact:`I'd like to verify a contact's phone number. Can you help me set that up?`}}],Xe=[];function Ze({assistantId:e,onStartSetupConversation:t}){let n=le.use.a2aChannel(),a=se.use.name(),l=o(),[u]=r(),d=u.get(`setup`),f=d&&_(d)?d:null,[p,m]=(0,G.useState)({kind:`assistant`}),g=pe(e),[v,y]=(0,G.useState)(!1),[b,x]=(0,G.useState)(!1),S=de(a),C=(0,G.useMemo)(()=>({path:{assistant_id:e}}),[e]),w=oe(C),T=s({...ae(C),enabled:!!e,select:e=>e.contacts}),E=fe({assistantId:e,onStartSetupConversation:t}),D=s({...ie({path:{assistant_id:e}}),enabled:!!e,queryFn:async({signal:t})=>{let{data:n,error:r,response:i}=await te({path:{assistant_id:e},signal:t,throwOnError:!1});if(!i||i.status===404)return{channels:Ye};if(!i.ok)throw r??Error(`Failed to fetch channel availability`);return n},select:e=>e.channels}).data??Xe,O=T.data,k=(0,G.useMemo)(()=>O?.find(e=>e.role===`guardian`)??null,[O]),A=(0,G.useMemo)(()=>O?.filter(e=>e.role!==`guardian`)??[],[O]),j=(0,G.useMemo)(()=>p.kind===`contact`?O?.find(e=>e.id===p.contactId)??null:null,[O,p]),M=(0,G.useMemo)(()=>!O||!j?[]:O.filter(e=>e.id!==j.id&&e.role!==`guardian`),[O,j]),N=M.length>0,P=(0,G.useRef)(!!f);(0,G.useEffect)(()=>{P.current||k&&(P.current=!0,m({kind:`contact`,contactId:k.id}))},[k]);let F=(0,G.useCallback)(()=>l.invalidateQueries({queryKey:w}),[l,w]),I=c({mutationFn:()=>_e(e,{displayName:`New Contact`}),onMutate:async()=>{await l.cancelQueries({queryKey:w})},onSuccess:e=>{L(l,C,t=>t?{...t,contacts:[...t.contacts,e]}:void 0),m({kind:`contact`,contactId:e.id})},onError:H(`Failed to create contact`),onSettled:()=>F()}),R=c({mutationFn:t=>ve(e,t),onSuccess:(e,t)=>{L(l,C,e=>e?{...e,contacts:e.contacts.filter(e=>e.id!==t)}:void 0),m({kind:`assistant`})},onError:H(`Failed to delete contact`),onSettled:()=>F()}),z=c({mutationFn:({contactId:t,patch:n})=>_e(e,{id:t,displayName:n.displayName,notes:n.notes}),onSuccess:e=>{L(l,C,t=>t?{...t,contacts:t.contacts.map(t=>t.id===e.id?e:t)}:void 0)},onError:H(`Failed to save contact`),onSettled:()=>F()}),B=re({onMutate:async()=>{await l.cancelQueries({queryKey:w})},onSuccess:(e,t)=>{let n=e.contact,r=t.body.mergeId;n&&(L(l,C,e=>e?{...e,contacts:e.contacts.filter(e=>e.id!==r).map(e=>e.id===n.id?n:e)}:void 0),m({kind:`contact`,contactId:n.id})),x(!1),ee.success(`Contacts merged`)},onSettled:()=>F()}),V=(0,G.useCallback)(e=>{m(e),y(!1),x(!1),B.reset()},[B]),U=(0,G.useCallback)(()=>{B.reset(),x(!0)},[B]),ye=(0,G.useCallback)(()=>{B.isPending||(x(!1),B.reset())},[B]),W=ne({onSuccess:()=>F()}),be=(0,G.useCallback)((t,n)=>{W.mutate({path:{assistant_id:e,contactChannelId:t},body:{status:`revoked`}})},[W,e]),xe=(0,G.useCallback)(()=>{I.isPending||I.mutate()},[I]),K=(0,G.useCallback)(e=>{if(!t)return;let n=D.find(t=>t.id===e)?.setupMessages.contact;n&&t(n)},[D,t]),Se=(0,G.useCallback)(e=>{if(!t)return;let n=D.find(t=>t.id===e)?.setupMessages.guardian;n&&t(n)},[D,t]),J=c({mutationFn:t=>ge(e,t.channelId),onSuccess:()=>F(),onError:H(`Failed to verify channel`)}),Y=(0,G.useCallback)(e=>{if(!j)return;let t=j.channels.find(t=>t.type===e&&t.status!==`revoked`);t&&J.mutate({channelId:t.id})},[j,J]),X=Je({assistantId:e,channelType:`slack`,contact:j?{id:j.id,displayName:j.displayName}:null,onLinked:F}),Z=s({...h(e),enabled:!!e&&X.dialogOpen,select:e=>e.users}),we=E.channels.some(e=>e.key===`slack`&&e.status===`ready`),Te=(0,G.useCallback)(e=>{e===X.channelType&&X.open()},[X]),Ee=R.isPending?R.variables:null,Q=(0,G.useMemo)(()=>j?z.isPending&&z.variables?.contactId===j.id?{...j,displayName:z.variables.patch.displayName,notes:z.variables.patch.notes}:j:null,[j,z.isPending,z.variables]);if(f)return(0,q.jsx)(i,{to:`${ce.channels}?setup=${f}`,replace:!0});let $={loading:T.isLoading,assistantName:S,guardian:k?{id:k.id,displayName:k.displayName.startsWith(`vellum-principal-`)?``:k.displayName,role:k.role,channelTypes:tt(k.channels,n)}:null,regularContacts:A.filter(e=>e.id!==Ee).map(e=>({id:e.id,displayName:e.displayName,role:e.role,contactType:e.contactType,channelTypes:tt(e.channels,n),verified:et(e.channels)})),selection:p,onAddContact:xe,addingContact:I.isPending};return(0,q.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-4 overflow-hidden sm:flex-row sm:gap-6`,children:[(0,q.jsx)(`div`,{className:`flex items-center sm:hidden`,children:(0,q.jsx)(me,{onClick:()=>y(!0)})}),(0,q.jsx)(he,{open:v,onClose:()=>y(!1),title:`Contacts`,children:(0,q.jsx)(Ve,{...$,onSelect:V})}),(0,q.jsx)(`aside`,{className:`hidden min-h-0 w-[320px] shrink-0 overflow-y-auto self-stretch sm:block`,children:(0,q.jsx)(Ve,{...$,onSelect:V})}),(0,q.jsx)(`section`,{className:`min-h-0 min-w-0 flex-1 overflow-y-auto`,children:p.kind===`assistant`||p.kind===`contact`&&p.contactId===Ee?(0,q.jsx)(Ce,{assistantName:S,channels:E.channels,pendingChannelKey:E.pendingChannelKey,onConnect:E.onSetup,onDisconnect:E.onDisconnect}):Q?Q.role===`guardian`?(0,q.jsx)(Ue,{contact:Q,savePending:z.isPending,verifyPending:J.isPending,mergePending:B.isPending,canMerge:N,availableChannels:D,a2aEnabled:n,onSave:e=>{z.mutate({contactId:Q.id,patch:e})},onMerge:U,onSetupChannel:t?Se:void 0,onVerifyChannel:Y,onRevokeChannel:be,onGenerateInviteLink:n?g.open:void 0}):(0,q.jsx)(Oe,{contact:Q,savePending:z.isPending,deletePending:R.isPending,verifyPending:J.isPending,mergePending:B.isPending,canMerge:N,availableChannels:D,a2aEnabled:n,onSave:e=>{z.mutate({contactId:Q.id,patch:e})},onDelete:()=>{R.mutate(Q.id)},onMerge:U,onSetupChannel:t?K:void 0,onVerifyChannel:Y,onRevokeChannel:be,onLinkAccount:we?Te:void 0}):(0,q.jsx)(Qe,{})}),j?(0,q.jsx)(Ae,{open:b,survivor:j,candidates:M,pending:B.isPending,errorMessage:B.error instanceof Error?B.error.message:B.error?`Failed to merge contacts`:null,onMerge:t=>B.mutate({path:{assistant_id:e},body:{keepId:j.id,mergeId:t}}),onClose:ye}):null,(0,q.jsx)(qe,{open:X.dialogOpen,channelLabel:`Slack`,contactName:j?.displayName??``,accounts:Z.data,loading:Z.isLoading,errorMessage:Z.isError?`Couldn’t load the workspace roster. Check the Slack connection and try again.`:X.linkErrorMessage,pendingAccountId:X.pendingAccountId,onPick:X.pick,onClose:X.close,onInviteInstead:t?()=>{X.close(),K(X.channelType)}:void 0}),(0,q.jsx)(ue,{open:g.isOpen,assistantId:e,onClose:g.close})]})}function Qe(){return(0,q.jsx)(`div`,{className:`flex h-full items-center justify-center py-16`,children:(0,q.jsx)(`p`,{className:`text-body-medium-lighter`,style:{color:`var(--content-tertiary)`},children:`Select a contact`})})}var $e={slack:`Slack`,telegram:`Telegram`,phone:`Phone`,email:`Email`,whatsapp:`WhatsApp`,a2a:`A2A`};function et(e){return e.some(e=>e.status!==`revoked`&&(e.type===`a2a`||K(e)))}function tt(e,t){let n=new Set,r=[];for(let i of e){if(i.status===`revoked`)continue;let e=i.type.toLowerCase();n.has(e)||e===`a2a`&&!t||(n.add(e),r.push($e[e]??i.type))}return r}function nt(){let e=a(),t=z();return(0,q.jsx)(Ze,{assistantId:t,onStartSetupConversation:t=>{R(e,{prompt:t})}},t)}export{nt as ContactsPageRoute};
|
|
1
|
+
import{o as e}from"./chunk-jRWAZmH_.js";import{t}from"./react-BFJW0bSv.js";import{t as n}from"./button-Dy5001j6.js";import{m as r,n as i,u as a}from"./chunk-5KNZJZUH-Bsoom5--.js";import{n as o}from"./QueryClientProvider-CMu7CkQU.js";import{t as s}from"./useQuery-Bz-fbQ-m.js";import{t as c}from"./useMutation-CXGTrp4W.js";import{t as l}from"./jsx-runtime-D3ZM-ToX.js";import{t as u}from"./typography-DEI9Ra9z.js";import{t as d}from"./card-DRIctGVs.js";import{t as f}from"./createLucideIcon-CAM1RhH8.js";import{t as p}from"./arrow-left-C2ylPLHq.js";import{t as m}from"./arrow-right-B-jRJNWP.js";import{a as h,b as g,c as _,d as v,l as y,x as b,y as x}from"./use-save-twilio-credentials-dUedxPbM.js";import{t as S}from"./circle-check-big-DSsDH5_6.js";import{t as C}from"./link-2-BKL8QWRX.js";import{t as w}from"./loader-circle-XREx3i4W.js";import{t as T}from"./mail-CMdPNysl.js";import{t as E}from"./message-square-CQGiY4zk.js";import{t as D}from"./pencil-D38YNe2r.js";import{t as O}from"./plus-jH3kAliM.js";import{t as k}from"./search-BVW-n8to.js";import{t as A}from"./send-Q71Exj3z.js";import{t as j}from"./user-plus-oiIr9ey8.js";import{t as M}from"./tag-NXcyiTkK.js";import{t as N}from"./input-hw3el2GJ.js";import{t as P}from"./modal-BR4CUFBd.js";import{t as F}from"./panel-item-CrtoJCrd.js";import{n as ee}from"./toast-LgLp4obE.js";import{t as I}from"./confirm-dialog-UYFm4osC.js";import{C as te}from"./sdk.gen-BVAVE6A_.js";import{Ht as ne,S as L,Ut as re,a as ie,b as ae,x as oe}from"./react-query.gen-r3I6j8-1.js";import{t as se}from"./assistant-identity-store-DIyVo8LV.js";import{u as ce}from"./routes-vE-2hncW.js";import{n as R}from"./conversation-navigation-DE-Nj8N3.js";import{t as le}from"./assistant-feature-flag-store-v8SP-gAp.js";import{t as z}from"./use-active-assistant-id-CXhDyK7y.js";import{i as ue,l as de,n as fe,r as B,t as pe}from"./use-invite-link-dialog-Cvvpn0Hm.js";import{t as V}from"./detail-card-BMRGmkia.js";import{n as me,t as he}from"./mobile-sidebar-drawer-CXGCmJ_p.js";import{t as H}from"./mutation-error-zQ6oi-va.js";import{a as ge,i as _e,n as U,t as ve}from"./contacts-gateway-CFNbQjfX.js";var ye=f(`circle-question-mark`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3`,key:`1u773s`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]]),W=f(`ellipsis-vertical`,[[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}],[`circle`,{cx:`12`,cy:`5`,r:`1`,key:`gxeob9`}],[`circle`,{cx:`12`,cy:`19`,r:`1`,key:`lyex9k`}]]),be=f(`git-merge`,[[`circle`,{cx:`18`,cy:`18`,r:`3`,key:`1xkwt0`}],[`circle`,{cx:`6`,cy:`6`,r:`3`,key:`1lh9wr`}],[`path`,{d:`M6 21V9a9 9 0 0 0 9 9`,key:`7kw0sc`}]]),G=e(t(),1),xe=new Set([`slack`]);function K(e){return e.status===`verified`||e.status===`active`&&e.verifiedAt!=null}var q=l();function Se({channels:e,pendingChannelKey:t=null,onConnect:n,onDisconnect:r}){let[i,a]=(0,G.useState)(null);return(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(`div`,{className:`flex flex-col`,children:e.map((e,i)=>(0,q.jsxs)(`div`,{children:[i>0?(0,q.jsx)(`div`,{className:`border-t`,style:{borderColor:`var(--border-base)`}}):null,(0,q.jsx)(J,{channel:e,pending:t===e.key,onConnect:n?()=>n(e.key):void 0,onDisconnect:r?()=>a(e.key):void 0})]},e.key))}),(0,q.jsx)(I,{open:i!==null,title:`Disconnect ${i?v(i):``}?`,message:`This clears the stored credentials for this channel. You can reconnect later.`,confirmLabel:`Disconnect`,destructive:!0,onConfirm:()=>{i&&r&&r(i),a(null)},onCancel:()=>a(null)})]})}function J({channel:e,pending:t,onConnect:r,onDisconnect:i}){let a=e.status===`ready`;return(0,q.jsxs)(`div`,{className:`flex items-center gap-3 py-4`,children:[(0,q.jsx)(y,{channelId:e.key,className:`h-4 w-4 shrink-0 text-[color:var(--content-secondary)]`}),(0,q.jsx)(`span`,{className:`text-body-medium-default`,style:{color:`var(--content-default)`},children:v(e.key)}),a&&e.address?(0,q.jsx)(`span`,{className:`truncate text-body-medium-lighter`,style:{color:`var(--content-tertiary)`},children:e.address}):null,(0,q.jsx)(`div`,{className:`ml-auto flex shrink-0 items-center gap-2`,children:a?(0,q.jsxs)(q.Fragment,{children:[(0,q.jsxs)(`span`,{className:`inline-flex items-center gap-1 h-8 px-2.5 rounded-md whitespace-nowrap select-none text-body-small-emphasised leading-none bg-[var(--content-default)] text-[var(--surface-base)]`,children:[(0,q.jsx)(S,{className:`h-3 w-3`}),`Connected`]}),(0,q.jsx)(n,{variant:`danger`,onClick:i,disabled:!i||t,children:t?`Disconnecting…`:`Disconnect`})]}):(0,q.jsx)(n,{variant:`outlined`,onClick:r,disabled:!r||t,children:`Connect`})})]})}function Y({role:e,contactType:t}){let{label:n,tone:r}=X(e,t);return(0,q.jsx)(M,{tone:r,children:n})}function X(e,t){switch(e){case`guardian`:return{label:`Guardian`,tone:`positive`};case`assistant`:return{label:`Assistant`,tone:`negative`};default:return t===`assistant`?{label:`Assistant`,tone:`negative`}:{label:`Human`,tone:`warning`}}}function Ce({assistantName:e,...t}){let n=de(e);return(0,q.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[(0,q.jsx)(V,{title:`${n} (Your Assistant)`,accessory:(0,q.jsx)(Y,{role:`assistant`}),compactAccessory:!0}),(0,q.jsx)(V,{title:`Channels`,subtitle:`Where ${n} can be reached.`,children:(0,q.jsx)(Se,{...t})})]})}var Z=new Set([`telegram`,`phone`,`vellum`,`whatsapp`,`slack`,`email`,`platform`,`a2a`]);function we(e){return Z.has(e)}function Te(e,t){return e.id===`a2a`?t&&t.status!==`revoked`?{kind:`connected`}:{kind:`setup`}:t!=null&&K(t)?{kind:`verified`}:t?.status===`blocked`?{kind:`none`}:t&&t.status!==`revoked`?{kind:`unverified`}:{kind:`setup`}}function Ee(e,t,n){let r=[],i=new Set;if(e)for(let t of e)t.id===`a2a`&&!n||(r.push(t),i.add(t.id));for(let e of t)e.status===`revoked`||i.has(e.type)||e.type===`a2a`&&!n||we(e.type)&&(r.push({id:e.type,label:e.type.charAt(0).toUpperCase()+e.type.slice(1),subtitle:``,icon:`help-circle`,supportsVerification:!1,setupMessages:{guardian:``,contact:``}}),i.add(e.type));return r}function Q({name:e,className:t,style:n}){switch(e){case`bot`:return(0,q.jsx)(b,{className:t,style:n});case`hash`:return(0,q.jsx)(g,{className:t,style:n});case`send`:return(0,q.jsx)(A,{className:t,style:n});case`phone`:return(0,q.jsx)(x,{className:t,style:n});case`mail`:return(0,q.jsx)(T,{className:t,style:n});case`message-square`:return(0,q.jsx)(E,{className:t,style:n});default:return(0,q.jsx)(ye,{className:t,style:n})}}function $({contactChannels:e,availableChannels:t,a2aEnabled:n,setupLabel:r=`Invite`,verifyLoading:i,verifySubject:a=`self`,onSetupChannel:o,onVerifyChannel:s,onRevokeChannel:c,onLinkAccount:l}){let[u,d]=(0,G.useState)(null),[f,p]=(0,G.useState)(null),m=new Map;for(let t of e)t.status!==`revoked`&&(m.has(t.type)||m.set(t.type,t));return(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(`div`,{className:`flex flex-col`,children:Ee(t,e,n).map((e,t)=>{let n=m.get(e.id);return(0,q.jsxs)(`div`,{children:[t>0&&(0,q.jsx)(`div`,{className:`border-t`,style:{borderColor:`var(--border-base)`}}),(0,q.jsx)(De,{info:e,existing:n,setupLabel:r,verifyLoading:i,onSetup:o?()=>o(e.id):void 0,onVerify:s&&e.supportsVerification?()=>d(e):void 0,onRevoke:c&&n?()=>p({channelId:n.id,channel:e}):void 0,onLinkAccount:l&&xe.has(e.id)?()=>l(e.id):void 0})]},e.id)})}),u&&(0,q.jsx)(I,{open:!0,title:`Verify ${u.label}`,message:a===`contact`?`This will mark this contact's ${u.label} channel as verified. Your assistant will recognize them when they reach out from it.`:`This will mark your ${u.label} channel as verified. Your assistant will recognize you when you reach out from it.`,confirmLabel:`Verify`,onConfirm:()=>{u&&(s?.(u.id),d(null))},onCancel:()=>d(null)}),f&&(0,q.jsx)(I,{open:!0,title:`Revoke ${f.channel.label}`,message:`This will disconnect the verified channel. The contact will need to re-verify to use this channel again.`,confirmLabel:`Revoke`,destructive:!0,onConfirm:()=>{c?.(f.channelId,f.channel.id),p(null)},onCancel:()=>p(null)})]})}function De({info:e,existing:t,setupLabel:r,verifyLoading:i,onSetup:a,onVerify:o,onRevoke:s,onLinkAccount:c}){let l=Te(e,t);return(0,q.jsxs)(`div`,{className:`flex items-center gap-3 py-4`,children:[(0,q.jsx)(Q,{name:e.icon,className:`h-4 w-4 shrink-0`,style:{color:`var(--content-secondary)`}}),(0,q.jsx)(`span`,{className:`text-body-medium-default`,style:{color:`var(--content-default)`},children:e.label}),t?.address?(0,q.jsx)(`span`,{className:`truncate text-body-medium-lighter`,style:{color:`var(--content-tertiary)`},children:t.address}):null,(0,q.jsx)(`div`,{className:`ml-auto flex shrink-0 items-center gap-2`,children:l.kind===`connected`?(0,q.jsxs)(q.Fragment,{children:[(0,q.jsxs)(`span`,{className:`inline-flex items-center gap-1 h-8 px-2.5 rounded-md whitespace-nowrap select-none text-body-small-emphasised leading-none bg-[var(--content-default)] text-[var(--surface-base)]`,children:[(0,q.jsx)(S,{className:`h-3 w-3`}),`Connected`]}),s?(0,q.jsx)(n,{variant:`danger`,onClick:s,children:`Revoke`}):null]}):l.kind===`verified`?(0,q.jsxs)(q.Fragment,{children:[(0,q.jsxs)(`span`,{className:`inline-flex items-center gap-1 h-8 px-2.5 rounded-md whitespace-nowrap select-none text-body-small-emphasised leading-none bg-[var(--content-default)] text-[var(--surface-base)]`,children:[(0,q.jsx)(S,{className:`h-3 w-3`}),`Verified`]}),s?(0,q.jsx)(n,{variant:`danger`,onClick:s,children:`Revoke`}):null]}):l.kind===`unverified`?(0,q.jsx)(n,{variant:`outlined`,onClick:o,disabled:!o||i,children:i?`Verifying…`:`Verify`}):l.kind===`setup`?e.id===`a2a`?null:(0,q.jsxs)(q.Fragment,{children:[c?(0,q.jsxs)(n,{onClick:c,children:[(0,q.jsx)(C,{className:`h-3.5 w-3.5`}),`Link account`]}):null,(0,q.jsx)(n,{variant:`outlined`,onClick:a,disabled:!a,children:r})]}):null})]})}function Oe(e){return(0,q.jsx)(ke,{...e},e.contact.id)}function ke({contact:e,savePending:t,deletePending:r,verifyPending:i,mergePending:a=!1,canMerge:o=!1,availableChannels:s,a2aEnabled:c,onSave:l,onDelete:u,onMerge:d,onSetupChannel:f,onVerifyChannel:p,onRevokeChannel:m,onLinkAccount:h}){let g=e.displayName===`New Contact`,[_,v]=(0,G.useState)(g?``:e.displayName),[y,b]=(0,G.useState)(e.notes??``),[x,S]=(0,G.useState)(!1),C=_.trim(),w=y.trim(),T=g?``:e.displayName,E=e.notes??``,D=C!==T||w!==E,O=C.length>0&&D&&!t&&!r,k=g&&e.channels.length===0&&e.interactionCount===0,A=C||e.displayName,j=`${e.interactionCount} interaction${e.interactionCount===1?``:`s`}`;return(0,q.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[(0,q.jsx)(V,{title:A,accessory:(0,q.jsx)(Y,{role:e.role,contactType:e.contactType}),compactAccessory:!0,subtitle:j,children:(0,q.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,q.jsx)(N,{label:`Name`,type:`text`,value:_,onChange:e=>v(e.target.value),placeholder:`Give this human a name`,autoFocus:g,disabled:t||r,fullWidth:!0}),(0,q.jsx)(N,{label:`Notes`,type:`text`,value:y,onChange:e=>b(e.target.value),placeholder:`Optional notes about the human which AI will take into account`,disabled:t||r,fullWidth:!0}),(0,q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,q.jsx)(n,{type:`button`,onClick:()=>l({displayName:C,notes:w}),disabled:!O,children:t?`Saving…`:`Save`}),d?(0,q.jsx)(n,{type:`button`,variant:`outlined`,onClick:d,disabled:!o||k||D||a||t||r,title:o?k?`Save this contact before merging`:D?`Save your changes before merging`:void 0:`No other contacts available to merge`,children:a?`Merging…`:`Merge…`}):null,(0,q.jsx)(n,{type:`button`,variant:`danger`,onClick:()=>{k?u():S(!0)},disabled:r,children:r?`Deleting…`:`Delete Contact`})]})]})}),(0,q.jsx)(V,{title:`Linked accounts`,subtitle:`Where the assistant recognizes this contact. Link accounts you know, invite the ones you don't.`,children:(0,q.jsx)($,{contactChannels:e.channels,availableChannels:s,a2aEnabled:c,verifyLoading:i,verifySubject:`contact`,onSetupChannel:f,onVerifyChannel:p,onRevokeChannel:m,onLinkAccount:h})}),(0,q.jsx)(I,{open:x,title:`Delete ${e.displayName}?`,message:`This will permanently delete this contact and all their channels. This action cannot be undone.`,confirmLabel:`Delete`,destructive:!0,onConfirm:()=>{S(!1),u()},onCancel:()=>S(!1)})]})}function Ae(e){return(0,q.jsx)(je,{...e},`${e.survivor.id}:${e.open?`open`:`closed`}`)}function je({open:e,survivor:t,candidates:r,pending:i,errorMessage:a,onMerge:o,onClose:s}){let[c,l]=(0,G.useState)(``),[d,f]=(0,G.useState)(null);(0,G.useEffect)(()=>{d&&!r.some(e=>e.id===d)&&f(null)},[r,d]);let m=(0,G.useMemo)(()=>{let e=c.trim().toLowerCase();return e?r.filter(t=>t.displayName.toLowerCase().includes(e)):r},[r,c]),h=d?r.find(e=>e.id===d)??null:null,g=Ie(t);return(0,q.jsx)(P.Root,{open:e,onOpenChange:e=>{!e&&!i&&s()},children:(0,q.jsxs)(P.Content,{size:`md`,children:[(0,q.jsxs)(P.Header,{children:[(0,q.jsx)(P.Title,{icon:be,children:h?`Merge "${h.displayName}" into ${g}?`:`Merge another contact into ${g}`}),(0,q.jsx)(P.Description,{children:h?`Channels and notes from the merged contact will move over. The merged contact will be deleted.`:`The contact you pick will be deleted. Its channels and notes will be added to this one.`})]}),(0,q.jsxs)(P.Body,{className:`flex flex-col gap-3`,children:[h?(0,q.jsx)(Pe,{survivor:t,donor:h}):r.length===0?(0,q.jsx)(Fe,{}):(0,q.jsx)(Me,{search:c,onSearch:l,candidates:m,onPick:f}),a?(0,q.jsx)(u,{as:`p`,variant:`body-small-default`,className:`text-(--system-negative-strong)`,role:`alert`,children:a}):null]}),(0,q.jsx)(P.Footer,{children:h?(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(n,{variant:`outlined`,onClick:()=>f(null),disabled:i,leftIcon:(0,q.jsx)(p,{"aria-hidden":!0}),children:`Back`}),(0,q.jsx)(n,{variant:`danger`,onClick:()=>o(h.id),disabled:i,children:i?`Merging…`:`Merge`})]}):(0,q.jsx)(n,{variant:`outlined`,onClick:s,disabled:i,children:`Cancel`})})]})})}function Me({search:e,onSearch:t,candidates:n,onPick:r}){return(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(N,{type:`text`,value:e,onChange:e=>t(e.target.value),placeholder:`Search contacts`,leftIcon:(0,q.jsx)(k,{className:`h-3.5 w-3.5`,"aria-hidden":!0}),fullWidth:!0}),(0,q.jsx)(`div`,{className:`flex max-h-[320px] min-h-[120px] flex-col gap-1 overflow-y-auto`,role:`listbox`,"aria-label":`Select a contact to merge`,children:n.length===0?(0,q.jsx)(u,{as:`p`,variant:`body-small-default`,className:`px-3 py-4 text-center text-(--content-tertiary)`,children:`No matching contacts`}):n.map(e=>(0,q.jsx)(Ne,{contact:e,onPick:()=>r(e.id)},e.id))})]})}function Ne({contact:e,onPick:t}){let n=Be(e).join(` | `)||void 0;return(0,q.jsx)(F,{asChild:!0,label:``,children:(0,q.jsx)(`button`,{type:`button`,onClick:t,role:`option`,"aria-selected":`false`,className:`flex h-auto w-full items-center gap-2 rounded-[6px] px-[8px] py-2 text-left`,children:(0,q.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col`,children:[(0,q.jsx)(`span`,{className:`truncate text-body-medium-default`,children:e.displayName}),n?(0,q.jsx)(`span`,{className:`truncate text-body-small-default text-(--content-tertiary)`,children:n}):null]})})})}function Pe({survivor:e,donor:t}){let n=Ie(e),{moved:r,duplicates:i}=ze(e,t);return(0,q.jsxs)(`ul`,{className:`flex flex-col gap-2 text-body-medium-lighter text-(--content-secondary)`,children:[(0,q.jsxs)(`li`,{children:[(0,q.jsxs)(`span`,{className:`text-(--content-default)`,children:[`“`,t.displayName,`”`]}),` `,`will be deleted.`]}),(0,q.jsx)(`li`,{children:r.length===0?`No new channels will move to ${n}.`:`${r.length} channel${r.length===1?``:`s`} will move to ${n}: ${r.map(e=>Re(e.type)).join(`, `)}.`}),i.length>0?(0,q.jsxs)(`li`,{className:`text-(--content-tertiary)`,children:[i.length,` duplicate channel`,i.length===1?``:`s`,` already on `,n,` `,`(skipped).`]}):null,t.notes?(0,q.jsx)(`li`,{children:`Notes from the merged contact will be appended.`}):null,(0,q.jsx)(`li`,{className:`text-(--content-tertiary)`,children:`This cannot be undone.`})]})}function Fe(){return(0,q.jsx)(u,{as:`p`,variant:`body-medium-lighter`,className:`px-3 py-6 text-center text-(--content-tertiary)`,children:`No other contacts available to merge.`})}function Ie(e){return e.role===`guardian`?!e.displayName||e.displayName.startsWith(`vellum-principal-`)?`you`:`${e.displayName} (you)`:e.displayName||`this contact`}var Le={slack:`Slack`,telegram:`Telegram`,phone:`Phone`,email:`Email`,whatsapp:`WhatsApp`};function Re(e){return Le[e.toLowerCase()]??e}function ze(e,t){let n=[],r=[];for(let i of t.channels)i.status!==`revoked`&&(e.channels.some(e=>e.type===i.type&&e.address.toLowerCase()===i.address.toLowerCase())?r.push(i):n.push(i));return{moved:n,duplicates:r}}function Be(e){let t=new Set,n=[];for(let r of e.channels){if(r.status===`revoked`)continue;let e=r.type.toLowerCase();t.has(e)||(t.add(e),n.push(Le[e]??r.type))}return n}function Ve({loading:e,guardian:t,assistantName:r,regularContacts:i,selection:a,onSelect:o,onAddContact:s,addingContact:c=!1}){let[l,u]=(0,G.useState)(``),f=l.trim()?i.filter(e=>e.displayName.toLowerCase().includes(l.trim().toLowerCase())):i;return(0,q.jsx)(d.Root,{className:`flex h-full flex-col overflow-hidden`,children:(0,q.jsxs)(d.Body,{className:`flex min-h-0 min-w-0 flex-1 flex-col gap-4`,children:[(0,q.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,q.jsx)(`h2`,{className:`text-title-medium`,style:{color:`var(--content-default)`},children:`Entries`}),(0,q.jsx)(n,{type:`button`,variant:`ghost`,iconOnly:c?(0,q.jsx)(w,{className:`animate-spin`,"aria-hidden":!0}):(0,q.jsx)(O,{"aria-hidden":!0}),onClick:s,disabled:c,"aria-label":`Add contact`,tintColor:`var(--content-secondary)`})]}),(0,q.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[t?(0,q.jsx)(He,{name:t.displayName?`${t.displayName} (You)`:`You`,role:t.role,channelTypes:t.channelTypes,selected:a?.kind===`contact`&&a.contactId===t.id,onClick:()=>o({kind:`contact`,contactId:t.id}),trailingIcon:`pencil`}):null,(0,q.jsx)(He,{name:r?.trim()||`Your Assistant`,role:`assistant`,selected:a?.kind===`assistant`,onClick:()=>o({kind:`assistant`}),trailingIcon:`more`})]}),(0,q.jsx)(`div`,{className:`border-t`,style:{borderColor:`var(--border-base)`}}),i.length>0?(0,q.jsx)(N,{type:`text`,value:l,onChange:e=>u(e.target.value),placeholder:`Search Contacts`,leftIcon:(0,q.jsx)(k,{className:`h-3.5 w-3.5`,"aria-hidden":!0}),fullWidth:!0}):null,i.length>0?(0,q.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto flex flex-col gap-1`,children:[f.map(e=>(0,q.jsx)(He,{name:e.displayName,role:e.role,contactType:e.contactType,channelTypes:e.channelTypes,verified:e.verified,selected:a?.kind===`contact`&&a.contactId===e.id,onClick:()=>o({kind:`contact`,contactId:e.id}),trailingIcon:`more`},e.id)),f.length===0?(0,q.jsx)(`p`,{className:`px-3 py-4 text-center text-body-small-default`,style:{color:`var(--content-tertiary)`},children:`No matching contacts`}):null]}):e?null:(0,q.jsx)(n,{type:`button`,variant:`ghost`,onClick:s,disabled:c,tintColor:`var(--primary-base)`,leftIcon:c?(0,q.jsx)(w,{className:`animate-spin`,"aria-hidden":!0}):(0,q.jsx)(j,{"aria-hidden":!0}),children:`Add Contact`})]})})}function He({name:e,role:t,contactType:n,channelTypes:r,selected:i,onClick:a,trailingIcon:o,verified:s}){let c=r&&r.length>0?r.join(` | `):void 0;return(0,q.jsx)(F,{asChild:!0,active:i,label:``,trailingAction:o===`pencil`?(0,q.jsx)(D,{className:`h-3.5 w-3.5`,"aria-hidden":!0}):o===`more`?(0,q.jsx)(W,{className:`h-3.5 w-3.5`,"aria-hidden":!0}):void 0,children:(0,q.jsxs)(`button`,{type:`button`,onClick:a,className:`flex h-auto w-full items-center gap-2 rounded-[6px] px-[8px] py-2 text-left`,children:[(0,q.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col`,children:[(0,q.jsx)(`span`,{className:`truncate text-body-medium-default`,children:e}),c?(0,q.jsx)(`span`,{className:`truncate text-body-small-default`,style:{color:`var(--content-tertiary)`},children:c}):null]}),(0,q.jsxs)(`span`,{className:`flex shrink-0 items-center gap-1`,children:[s===void 0?null:(0,q.jsx)(M,{tone:s?`positive`:`neutral`,children:s?`Verified`:`Unverified`}),(0,q.jsx)(Y,{role:t,contactType:n})]})]})})}function Ue(e){return(0,q.jsx)(We,{...e},e.contact.id)}function We({contact:e,savePending:t,verifyPending:r,mergePending:i=!1,canMerge:a=!1,availableChannels:o,a2aEnabled:s,onSave:c,onMerge:l,onSetupChannel:u,onVerifyChannel:d,onRevokeChannel:f,onGenerateInviteLink:p}){let m=e.displayName.startsWith(`vellum-principal-`),h=m?``:e.displayName,[g,_]=(0,G.useState)(h),[v,y]=(0,G.useState)(e.notes??``),b=g.trim(),x=v.trim(),S=b!==h.trim()||x!==(e.notes??``).trim(),C=S&&!t,w=`${e.interactionCount} interaction${e.interactionCount===1?``:`s`}`;return(0,q.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[(0,q.jsx)(V,{title:m?`You`:`${e.displayName} (You)`,accessory:(0,q.jsx)(Y,{role:`guardian`}),compactAccessory:!0,subtitle:w,children:(0,q.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,q.jsx)(N,{label:`Name`,type:`text`,value:g,onChange:e=>_(e.target.value),placeholder:`Your name`,disabled:t,fullWidth:!0}),(0,q.jsx)(N,{label:`Notes`,type:`text`,value:v,onChange:e=>y(e.target.value),placeholder:`Notes about yourself which AI will take into account`,disabled:t,fullWidth:!0}),(0,q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,q.jsx)(n,{variant:`primary`,onClick:()=>c({displayName:b||e.displayName,notes:x}),disabled:!C,children:t?`Saving…`:`Save`}),l?(0,q.jsx)(n,{variant:`outlined`,onClick:l,disabled:!a||S||i||t,title:a?S?`Save your changes before merging`:void 0:`No other contacts available to merge`,children:i?`Merging…`:`Merge…`}):null]})]})}),(0,q.jsx)(V,{title:`Channels`,subtitle:`Once verified, your assistant will recognize you when you message from these channels.`,children:(0,q.jsx)($,{contactChannels:e.channels,availableChannels:o,a2aEnabled:s,setupLabel:`Verify me`,verifyLoading:r,onSetupChannel:u,onVerifyChannel:d,onRevokeChannel:f})}),p?(0,q.jsx)(B,{onClick:p}):null]})}function Ge(e,t){let n=t.trim().toLowerCase().replace(/^@/,``);return n===``?e:e.filter(e=>e.displayName.toLowerCase().includes(n)||e.username.toLowerCase().includes(n))}function Ke(e){let t=e.trim().split(/\s+/).filter(Boolean);return`${t[0]?.[0]??`?`}${t.length>1?t[t.length-1]?.[0]??``:``}`.toUpperCase()}function qe({open:e,channelLabel:t,contactName:r,accounts:i,loading:a,errorMessage:o,pendingAccountId:s,onPick:c,onClose:l,onInviteInstead:u}){let[d,f]=(0,G.useState)(``);(0,G.useEffect)(()=>{e&&f(``)},[e]);let p=(0,G.useMemo)(()=>Ge(i??[],d),[i,d]),h=s!=null;return(0,q.jsx)(P.Root,{open:e,onOpenChange:e=>!e&&l(),children:(0,q.jsxs)(P.Content,{size:`sm`,children:[(0,q.jsxs)(P.Header,{children:[(0,q.jsxs)(P.Title,{children:[`Link `,t,` account`]}),(0,q.jsxs)(P.Description,{children:[`Search your `,t,` workspace and pick`,` `,(0,q.jsx)(`span`,{className:`text-[color:var(--content-default)]`,children:r}),`’s account.`]})]}),(0,q.jsxs)(P.Body,{className:`flex flex-col gap-3`,children:[(0,q.jsx)(N,{type:`search`,value:d,onChange:e=>f(e.target.value),placeholder:`Search by name or @handle`,"aria-label":`Search ${t} workspace accounts`,leftIcon:(0,q.jsx)(k,{className:`h-4 w-4`}),fullWidth:!0}),o?(0,q.jsx)(`p`,{className:`text-body-small-default text-[color:var(--content-negative)]`,children:o}):null,(0,q.jsx)(`div`,{className:`max-h-80 overflow-y-auto`,children:a?(0,q.jsx)(`p`,{className:`py-4 text-center text-body-small-default text-[color:var(--content-tertiary)]`,children:`Loading workspace members…`}):p.length===0?(0,q.jsx)(`p`,{className:`py-4 text-center text-body-small-default text-[color:var(--content-tertiary)]`,children:(i?.length??0)===0?`No workspace members found.`:`No members match.`}):(0,q.jsx)(`ul`,{className:`flex flex-col`,children:p.map(e=>(0,q.jsx)(`li`,{children:(0,q.jsxs)(`button`,{type:`button`,onClick:()=>c(e),disabled:h,className:`flex w-full cursor-pointer items-center gap-3 rounded-md px-2 py-2 text-left transition-colors hover:bg-[var(--surface-overlay)] disabled:cursor-not-allowed disabled:opacity-60`,children:[e.imageUrl?(0,q.jsx)(`img`,{src:e.imageUrl,alt:``,className:`h-8 w-8 shrink-0 rounded-full`}):(0,q.jsx)(`span`,{"aria-hidden":`true`,className:`flex h-8 w-8 shrink-0 items-center justify-center rounded-full bg-[var(--tag-bg-neutral)] text-body-small-emphasised text-[color:var(--content-secondary)]`,children:Ke(e.displayName)}),(0,q.jsxs)(`span`,{className:`flex min-w-0 flex-col`,children:[(0,q.jsx)(`span`,{className:`truncate text-body-medium-default text-[color:var(--content-default)]`,children:e.displayName}),(0,q.jsxs)(`span`,{className:`truncate text-body-small-default text-[color:var(--content-tertiary)]`,children:[`@`,e.username]})]}),s===e.id?(0,q.jsx)(`span`,{className:`ml-auto shrink-0 text-body-small-default text-[color:var(--content-tertiary)]`,children:`Linking…`}):null]})},e.id))})})]}),(0,q.jsxs)(P.Footer,{className:`items-center justify-between gap-3 border-t border-[var(--border-base)]`,children:[(0,q.jsxs)(`p`,{className:`text-body-small-default text-[color:var(--content-tertiary)]`,children:[`Picking marks this account as`,` `,(0,q.jsx)(`span`,{className:`text-[color:var(--content-secondary)]`,children:`guardian-linked`}),` `,`— you vouch for the identity, no handshake needed.`]}),u?(0,q.jsxs)(n,{variant:`link`,className:`shrink-0`,onClick:u,disabled:h,children:[`Or send an invite instead`,(0,q.jsx)(m,{className:`h-3.5 w-3.5`})]}):null]})]})})}function Je({assistantId:e,channelType:t,contact:n,onLinked:r}){let[i,a]=(0,G.useState)(!1),o=c({mutationFn:n=>U(e,n.contact,{type:t,address:n.account.id}),onSuccess:(e,t)=>{a(!1),ee.success(`Linked as @${t.account.username}`),r()}}),s=(0,G.useCallback)(()=>{o.reset(),a(!0)},[o]),l=(0,G.useCallback)(()=>{o.isPending||(o.reset(),a(!1))},[o]),u=(0,G.useCallback)(e=>{!n||o.isPending||o.mutate({contact:n,account:e})},[n,o]);return{channelType:t,dialogOpen:i,open:s,close:l,linkErrorMessage:o.error instanceof Error?o.error.message:o.error?`Failed to link account`:null,pendingAccountId:o.isPending?o.variables.account.id:null,pick:u}}var Ye=[{id:`slack`,label:`Slack`,subtitle:`Message your assistant from Slack`,icon:`hash`,supportsVerification:!0,setupMessages:{guardian:`I'd like to verify my identity as your guardian on Slack. Can you help me set that up?`,contact:`I'd like to verify a contact's Slack identity. Can you walk me through it?`}},{id:`telegram`,label:`Telegram`,subtitle:`Message your assistant from Telegram`,icon:`send`,supportsVerification:!0,setupMessages:{guardian:`I'd like to verify my identity as your guardian on Telegram. Can you help me set that up?`,contact:`I'd like to verify a contact's Telegram identity. Can you walk me through it?`}},{id:`phone`,label:`Phone Calling`,subtitle:`Call or text your assistant via phone`,icon:`phone`,supportsVerification:!0,setupMessages:{guardian:`I'd like to verify my identity as your guardian for phone calls. Can you help me set that up?`,contact:`I'd like to verify a contact's phone number. Can you help me set that up?`}}],Xe=[];function Ze({assistantId:e,onStartSetupConversation:t}){let n=le.use.a2aChannel(),a=se.use.name(),l=o(),[u]=r(),d=u.get(`setup`),f=d&&_(d)?d:null,[p,m]=(0,G.useState)({kind:`assistant`}),g=pe(e),[v,y]=(0,G.useState)(!1),[b,x]=(0,G.useState)(!1),S=de(a),C=(0,G.useMemo)(()=>({path:{assistant_id:e}}),[e]),w=oe(C),T=s({...ae(C),enabled:!!e,select:e=>e.contacts}),E=fe({assistantId:e,onStartSetupConversation:t}),D=s({...ie({path:{assistant_id:e}}),enabled:!!e,queryFn:async({signal:t})=>{let{data:n,error:r,response:i}=await te({path:{assistant_id:e},signal:t,throwOnError:!1});if(!i||i.status===404)return{channels:Ye};if(!i.ok)throw r??Error(`Failed to fetch channel availability`);return n},select:e=>e.channels}).data??Xe,O=T.data,k=(0,G.useMemo)(()=>O?.find(e=>e.role===`guardian`)??null,[O]),A=(0,G.useMemo)(()=>O?.filter(e=>e.role!==`guardian`)??[],[O]),j=(0,G.useMemo)(()=>p.kind===`contact`?O?.find(e=>e.id===p.contactId)??null:null,[O,p]),M=(0,G.useMemo)(()=>!O||!j?[]:O.filter(e=>e.id!==j.id&&e.role!==`guardian`),[O,j]),N=M.length>0,P=(0,G.useRef)(!!f);(0,G.useEffect)(()=>{P.current||k&&(P.current=!0,m({kind:`contact`,contactId:k.id}))},[k]);let F=(0,G.useCallback)(()=>l.invalidateQueries({queryKey:w}),[l,w]),I=c({mutationFn:()=>_e(e,{displayName:`New Contact`}),onMutate:async()=>{await l.cancelQueries({queryKey:w})},onSuccess:e=>{L(l,C,t=>t?{...t,contacts:[...t.contacts,e]}:void 0),m({kind:`contact`,contactId:e.id})},onError:H(`Failed to create contact`),onSettled:()=>F()}),R=c({mutationFn:t=>ve(e,t),onSuccess:(e,t)=>{L(l,C,e=>e?{...e,contacts:e.contacts.filter(e=>e.id!==t)}:void 0),m({kind:`assistant`})},onError:H(`Failed to delete contact`),onSettled:()=>F()}),z=c({mutationFn:({contactId:t,patch:n})=>_e(e,{id:t,displayName:n.displayName,notes:n.notes}),onSuccess:e=>{L(l,C,t=>t?{...t,contacts:t.contacts.map(t=>t.id===e.id?e:t)}:void 0)},onError:H(`Failed to save contact`),onSettled:()=>F()}),B=re({onMutate:async()=>{await l.cancelQueries({queryKey:w})},onSuccess:(e,t)=>{let n=e.contact,r=t.body.mergeId;n&&(L(l,C,e=>e?{...e,contacts:e.contacts.filter(e=>e.id!==r).map(e=>e.id===n.id?n:e)}:void 0),m({kind:`contact`,contactId:n.id})),x(!1),ee.success(`Contacts merged`)},onSettled:()=>F()}),V=(0,G.useCallback)(e=>{m(e),y(!1),x(!1),B.reset()},[B]),U=(0,G.useCallback)(()=>{B.reset(),x(!0)},[B]),ye=(0,G.useCallback)(()=>{B.isPending||(x(!1),B.reset())},[B]),W=ne({onSuccess:()=>F()}),be=(0,G.useCallback)((t,n)=>{W.mutate({path:{assistant_id:e,contactChannelId:t},body:{status:`revoked`}})},[W,e]),xe=(0,G.useCallback)(()=>{I.isPending||I.mutate()},[I]),K=(0,G.useCallback)(e=>{if(!t)return;let n=D.find(t=>t.id===e)?.setupMessages.contact;n&&t(n)},[D,t]),Se=(0,G.useCallback)(e=>{if(!t)return;let n=D.find(t=>t.id===e)?.setupMessages.guardian;n&&t(n)},[D,t]),J=c({mutationFn:t=>ge(e,t.channelId),onSuccess:()=>F(),onError:H(`Failed to verify channel`)}),Y=(0,G.useCallback)(e=>{if(!j)return;let t=j.channels.find(t=>t.type===e&&t.status!==`revoked`);t&&J.mutate({channelId:t.id})},[j,J]),X=Je({assistantId:e,channelType:`slack`,contact:j?{id:j.id,displayName:j.displayName}:null,onLinked:F}),Z=s({...h(e),enabled:!!e&&X.dialogOpen,select:e=>e.users}),we=E.channels.some(e=>e.key===`slack`&&e.status===`ready`),Te=(0,G.useCallback)(e=>{e===X.channelType&&X.open()},[X]),Ee=R.isPending?R.variables:null,Q=(0,G.useMemo)(()=>j?z.isPending&&z.variables?.contactId===j.id?{...j,displayName:z.variables.patch.displayName,notes:z.variables.patch.notes}:j:null,[j,z.isPending,z.variables]);if(f)return(0,q.jsx)(i,{to:`${ce.channels}?setup=${f}`,replace:!0});let $={loading:T.isLoading,assistantName:S,guardian:k?{id:k.id,displayName:k.displayName.startsWith(`vellum-principal-`)?``:k.displayName,role:k.role,channelTypes:tt(k.channels,n)}:null,regularContacts:A.filter(e=>e.id!==Ee).map(e=>({id:e.id,displayName:e.displayName,role:e.role,contactType:e.contactType,channelTypes:tt(e.channels,n),verified:et(e.channels)})),selection:p,onAddContact:xe,addingContact:I.isPending};return(0,q.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-4 overflow-hidden sm:flex-row sm:gap-6`,children:[(0,q.jsx)(`div`,{className:`flex items-center sm:hidden`,children:(0,q.jsx)(me,{onClick:()=>y(!0)})}),(0,q.jsx)(he,{open:v,onClose:()=>y(!1),title:`Contacts`,children:(0,q.jsx)(Ve,{...$,onSelect:V})}),(0,q.jsx)(`aside`,{className:`hidden min-h-0 w-[320px] shrink-0 overflow-y-auto self-stretch sm:block`,children:(0,q.jsx)(Ve,{...$,onSelect:V})}),(0,q.jsx)(`section`,{className:`min-h-0 min-w-0 flex-1 overflow-y-auto`,children:p.kind===`assistant`||p.kind===`contact`&&p.contactId===Ee?(0,q.jsx)(Ce,{assistantName:S,channels:E.channels,pendingChannelKey:E.pendingChannelKey,onConnect:E.onSetup,onDisconnect:E.onDisconnect}):Q?Q.role===`guardian`?(0,q.jsx)(Ue,{contact:Q,savePending:z.isPending,verifyPending:J.isPending,mergePending:B.isPending,canMerge:N,availableChannels:D,a2aEnabled:n,onSave:e=>{z.mutate({contactId:Q.id,patch:e})},onMerge:U,onSetupChannel:t?Se:void 0,onVerifyChannel:Y,onRevokeChannel:be,onGenerateInviteLink:n?g.open:void 0}):(0,q.jsx)(Oe,{contact:Q,savePending:z.isPending,deletePending:R.isPending,verifyPending:J.isPending,mergePending:B.isPending,canMerge:N,availableChannels:D,a2aEnabled:n,onSave:e=>{z.mutate({contactId:Q.id,patch:e})},onDelete:()=>{R.mutate(Q.id)},onMerge:U,onSetupChannel:t?K:void 0,onVerifyChannel:Y,onRevokeChannel:be,onLinkAccount:we?Te:void 0}):(0,q.jsx)(Qe,{})}),j?(0,q.jsx)(Ae,{open:b,survivor:j,candidates:M,pending:B.isPending,errorMessage:B.error instanceof Error?B.error.message:B.error?`Failed to merge contacts`:null,onMerge:t=>B.mutate({path:{assistant_id:e},body:{keepId:j.id,mergeId:t}}),onClose:ye}):null,(0,q.jsx)(qe,{open:X.dialogOpen,channelLabel:`Slack`,contactName:j?.displayName??``,accounts:Z.data,loading:Z.isLoading,errorMessage:Z.isError?`Couldn’t load the workspace roster. Check the Slack connection and try again.`:X.linkErrorMessage,pendingAccountId:X.pendingAccountId,onPick:X.pick,onClose:X.close,onInviteInstead:t?()=>{X.close(),K(X.channelType)}:void 0}),(0,q.jsx)(ue,{open:g.isOpen,assistantId:e,onClose:g.close})]})}function Qe(){return(0,q.jsx)(`div`,{className:`flex h-full items-center justify-center py-16`,children:(0,q.jsx)(`p`,{className:`text-body-medium-lighter`,style:{color:`var(--content-tertiary)`},children:`Select a contact`})})}var $e={slack:`Slack`,telegram:`Telegram`,phone:`Phone`,email:`Email`,whatsapp:`WhatsApp`,a2a:`A2A`};function et(e){return e.some(e=>e.status!==`revoked`&&(e.type===`a2a`||K(e)))}function tt(e,t){let n=new Set,r=[];for(let i of e){if(i.status===`revoked`)continue;let e=i.type.toLowerCase();n.has(e)||e===`a2a`&&!t||(n.add(e),r.push($e[e]??i.type))}return r}function nt(){let e=a(),t=z();return(0,q.jsx)(Ze,{assistantId:t,onStartSetupConversation:t=>{R(e,{prompt:t})}},t)}export{nt as ContactsPageRoute};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{o as e}from"./chunk-jRWAZmH_.js";import{a as t,m as n,o as r,t as i}from"./capture-error-Bj8_eutd.js";import{t as a}from"./react-BFJW0bSv.js";import{t as o}from"./button-Dy5001j6.js";import{m as s,n as c,u as l}from"./chunk-5KNZJZUH-Bsoom5--.js";import{n as u}from"./QueryClientProvider-CMu7CkQU.js";import{t as d}from"./useQuery-Bz-fbQ-m.js";import{t as f}from"./jsx-runtime-D3ZM-ToX.js";import{t as p}from"./cn-CJf7MmLX.js";import{t as m}from"./createLucideIcon-CAM1RhH8.js";import{t as h}from"./bug-VUcJFHwN.js";import{t as g}from"./circle-x-17dBxF06.js";import{t as ee}from"./info-vgPTIsGI.js";import{t as _}from"./loader-circle-XREx3i4W.js";import{t as v}from"./search-BVW-n8to.js";import{t as y}from"./triangle-alert-CQfiAg_t.js";import"./src-D89CNeuT.js";import{t as b}from"./tag-NXcyiTkK.js";import{t as x}from"./toggle-lfnhEAcN.js";import{n as S}from"./toast-LgLp4obE.js";import{t as C}from"./confirm-dialog-UYFm4osC.js";import{t as w}from"./dropdown-BCfnSdIZ.js";import{C as T,f as E}from"./local-mode-Ckii2tmN.js";import{Bt as D,Qt as O,X as te,Y as ne,Zt as re,c as ie,u as ae}from"./react-query.gen-r3I6j8-1.js";import{D as oe}from"./auth-store-D0-gDCVn.js";import{t as se}from"./client.gen-CV05d-kw.js";import{c as ce,o as le}from"./api-XwdNiVE9.js";import{u as k}from"./routes-vE-2hncW.js";import{t as A}from"./use-is-org-ready-DGc9B_-V.js";import{a as j,l as M,o as N}from"./feature-flag-catalog-D0c-Ac1N.js";import{t as P}from"./client-feature-flag-store-c2ESRWJ1.js";import{O as F,v as I}from"./react-query.gen-Mwd5l-vZ.js";import{t as L}from"./assistant-feature-flag-store-ltLrn6Vo.js";import{t as R}from"./misc-DckBb5zz.js";import{t as z}from"./use-active-assistant-id-CXhDyK7y.js";import{t as B}from"./detail-card-BMRGmkia.js";import{t as V}from"./environment-store-Dk9rAKWX.js";import{n as H}from"./assistant-status-panel-D3DgDcV3.js";var U=m(`flame`,[[`path`,{d:`M12 3q1 4 4 6.5t3 5.5a1 1 0 0 1-14 0 5 5 0 0 1 1-3 1 1 0 0 0 5 0c0-2-1.5-3-1.5-5q0-2 2.5-4`,key:`1slcih`}]]),W=m(`timer`,[[`line`,{x1:`10`,x2:`14`,y1:`2`,y2:`2`,key:`14vaq8`}],[`line`,{x1:`12`,x2:`15`,y1:`14`,y2:`11`,key:`17fdiu`}],[`circle`,{cx:`12`,cy:`14`,r:`8`,key:`1e1u0o`}]]),G=e(a(),1),K=f();function ue({memoryEnabled:e}){let t=z(),n=u(),{data:r}=d({...ne({path:{assistant_id:t}}),staleTime:3e4}),a=e=>{te(n,{path:{assistant_id:t}},t=>t&&{...t,status:e?`running`:`not_running`})},o=re({onSuccess:()=>a(!0)}),s=O({onSuccess:()=>a(!1)}),c=async e=>{try{e?(await o.mutateAsync({path:{assistant_id:t}}),S.success(`Background worker started.`)):(await s.mutateAsync({path:{assistant_id:t}}),S.success(`Background worker stopped.`))}catch(e){i(e,{context:`settings-memory-worker-toggle`}),S.error(`Failed to update background worker.`)}};if(!r)return null;let l=o.isPending||s.isPending;return(0,K.jsxs)(`div`,{className:`flex flex-row items-start justify-between gap-4 border-t border-[var(--border-subtle)] pt-4`,children:[(0,K.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-2`,children:[(0,K.jsx)(`h3`,{className:`text-body-medium-default text-[var(--content-emphasised)]`,children:`Background worker`}),(0,K.jsx)(`p`,{className:`text-body-medium-default text-[var(--content-tertiary)]`,children:`Run memory consolidation in a dedicated background process. It starts automatically; stop it to pause background memory processing until the next restart.`})]}),(0,K.jsx)(x,{checked:r.status===`running`,onChange:e=>void c(e),"aria-label":`Enable background memory worker`,disabled:!e||l})]})}function de(){let{healthz:e}=H(),t=z(),n=u(),r=e?.capabilities?.memoryOptOut===!0,{data:a}=d({...ie({path:{assistant_id:t}}),staleTime:3e4,enabled:r}),o=D({onSuccess:e=>{ae(n,{path:{assistant_id:t}},e)}}),s=a?.memory?.enabled!==!1,c=async e=>{try{await o.mutateAsync({path:{assistant_id:t},body:{memory:{enabled:e}}}),S.success(e?`Memory enabled.`:`Memory disabled.`)}catch(e){i(e,{context:`settings-memory-toggle`}),S.error(`Failed to update memory setting.`)}};return r?(0,K.jsx)(B,{title:`Memory`,subtitle:`Let your assistant remember information from past conversations. Turning this off also pauses memory consolidation.`,accessory:(0,K.jsx)(x,{checked:s,onChange:e=>void c(e),"aria-label":`Enable memory`,disabled:o.isPending}),compactAccessory:!0,children:(0,K.jsx)(ue,{memoryEnabled:s})}):null}function fe(){let e=u(),[t,n]=(0,G.useState)(!1),[r,i]=(0,G.useState)(!1),a=A(),s=z(),{data:c,isLoading:l}=d({...F({path:{id:s}}),enabled:a}),{data:f,isLoading:p}=d({...I({query:{hosting:`all`}}),enabled:a}),m=l||p,h=f?.results??[];return(0,K.jsxs)(`div`,{className:`space-y-6`,children:[(0,K.jsx)(pe,{assistant:c??null,loading:m}),(0,K.jsx)(me,{assistants:h,activeAssistantId:s,loading:m}),(0,K.jsxs)(B,{title:`Hatch New Assistant`,subtitle:`Create a new assistant instance.`,children:[(0,K.jsxs)(`div`,{className:`flex items-center justify-between gap-4`,children:[(0,K.jsx)(`p`,{className:`text-body-medium-lighter text-[var(--content-tertiary)]`,children:`Provision a new assistant. This may take a moment.`}),(0,K.jsx)(o,{variant:`outlined`,leftIcon:t?(0,K.jsx)(_,{className:`animate-spin`}):void 0,onClick:()=>i(!0),disabled:t,className:`shrink-0`,children:`Hatch`})]}),(0,K.jsx)(C,{open:r,title:`Hatch New Assistant`,message:`Are you sure you want to create a new assistant? This will provision new infrastructure.`,confirmLabel:`Hatch`,onConfirm:async()=>{i(!1),n(!0);try{let t=await le(void 0,`create`);if(t.ok){if(E())try{let e=await ce();e.ok&&await T(e.data,oe.getState().currentOrganizationId??void 0)}catch{}S.success(t.status===201?`New assistant hatched successfully.`:`Returned your existing assistant — no new one was created.`),e.invalidateQueries({queryKey:[{_id:`assistantsRetrieve`}]}),e.invalidateQueries({queryKey:I({query:{hosting:`all`}}).queryKey})}else{let e=typeof t.error?.detail==`string`?t.error.detail:`Failed to hatch assistant.`;S.error(e)}}catch{S.error(`Failed to hatch assistant.`)}finally{n(!1)}},onCancel:()=>i(!1)})]})]})}function pe({assistant:e,loading:t}){return t?(0,K.jsx)(B,{title:`Assistant Info`,children:(0,K.jsxs)(`div`,{className:`flex items-center gap-2 text-body-medium-lighter text-[var(--content-tertiary)]`,children:[(0,K.jsx)(_,{className:`h-4 w-4 animate-spin`}),`Loading assistant info...`]})}):e?(0,K.jsx)(B,{title:`Assistant Info`,subtitle:`Current assistant details.`,children:(0,K.jsxs)(`div`,{className:`grid grid-cols-[140px_minmax(0,1fr)] gap-y-3`,children:[(0,K.jsx)(q,{children:`Name`}),(0,K.jsx)(J,{children:e.name??`Unnamed`}),(0,K.jsx)(q,{children:`Status`}),(0,K.jsx)(`div`,{children:(0,K.jsx)(b,{tone:e.status===`active`?`positive`:`neutral`,children:e.status})}),(0,K.jsx)(q,{children:`Assistant ID`}),(0,K.jsx)(`span`,{className:`break-all font-mono text-body-small-default text-[var(--content-tertiary)]`,children:e.id}),e.machine_id&&(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(q,{children:`Machine ID`}),(0,K.jsx)(`span`,{className:`break-all font-mono text-body-small-default text-[var(--content-tertiary)]`,children:e.machine_id})]}),(0,K.jsx)(q,{children:`Created`}),(0,K.jsx)(J,{children:new Date(e.created).toLocaleDateString()}),(0,K.jsx)(q,{children:`Last Modified`}),(0,K.jsx)(J,{children:new Date(e.modified).toLocaleDateString()}),e.current_release_version&&(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(q,{children:`Version`}),(0,K.jsx)(J,{children:e.current_release_version})]})]})}):(0,K.jsx)(B,{title:`Assistant Info`,children:(0,K.jsx)(`p`,{className:`text-body-medium-lighter text-[var(--content-tertiary)]`,children:`No assistant found. Hatch an assistant to get started.`})})}function me({assistants:e,activeAssistantId:t,loading:n}){return n||e.length===0?null:(0,K.jsx)(B,{title:`All Assistants`,subtitle:`${e.length} assistant${e.length===1?``:`s`} found.`,children:(0,K.jsx)(`div`,{className:`max-h-[300px] space-y-2 overflow-y-auto`,children:e.map(e=>{let n=e.id===t;return(0,K.jsx)(`div`,{className:`flex items-center justify-between gap-4 rounded-lg border px-4 py-3 ${n?`border-[var(--border-focus)] bg-[var(--surface-lift)]`:`border-[var(--border-base)] bg-[var(--surface-default)]`}`,children:(0,K.jsxs)(`div`,{className:`min-w-0`,children:[(0,K.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,K.jsx)(`span`,{className:`truncate text-body-medium-default text-[var(--content-default)]`,children:e.name||`Unnamed`}),(0,K.jsx)(b,{tone:e.status===`active`?`positive`:`neutral`,children:e.status}),n&&(0,K.jsx)(b,{tone:`warning`,children:`Current`})]}),(0,K.jsx)(`span`,{className:`font-mono text-body-small-default text-[var(--content-tertiary)]`,children:e.id})]})},e.id)})})})}function q({children:e}){return(0,K.jsx)(`span`,{className:`text-body-medium-default text-[var(--content-tertiary)]`,children:e})}function J({children:e}){return(0,K.jsx)(`span`,{className:`text-body-medium-lighter text-[var(--content-default)]`,children:e})}function he(){let e=V.use.emailRootDomain(),t=V.use.isNonProduction(),n=V.use.setEnvironment();return(0,K.jsx)(B,{title:`Environment`,subtitle:`Environment configuration overrides for this session.`,children:(0,K.jsxs)(`div`,{className:`space-y-2`,children:[(0,K.jsxs)(`div`,{className:`flex items-start gap-3 py-3`,children:[(0,K.jsx)(`div`,{className:`shrink-0 pt-0.5`,children:(0,K.jsx)(x,{checked:t,onChange:e=>n({isNonProduction:e}),"aria-label":`Non-Production is ${t?`on`:`off`}`})}),(0,K.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-0.5`,children:[(0,K.jsx)(`span`,{className:`text-body-medium-default text-[var(--content-default)]`,children:`Non-Production`}),(0,K.jsx)(`span`,{className:`block text-body-small-default text-[var(--content-tertiary)]`,children:`Indicates a non-production environment. Enables dev-only UI surfaces and diagnostics.`})]})]}),(0,K.jsxs)(`div`,{className:`flex items-start gap-3 py-3`,children:[(0,K.jsx)(`div`,{className:`shrink-0 pt-0.5`,children:(0,K.jsx)(b,{tone:`neutral`,children:e})}),(0,K.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-0.5`,children:[(0,K.jsx)(`span`,{className:`text-body-medium-default text-[var(--content-default)]`,children:`Email Root Domain`}),(0,K.jsx)(`span`,{className:`block text-body-small-default text-[var(--content-tertiary)]`,children:`Root domain used for assistant email addresses (e.g. vellum.me).`})]})]})]})})}async function ge(){let{data:e,response:t}=await se.get({url:`/v1/feature-flags/`,throwOnError:!1});return t?.ok?e?.flags??[]:[]}var Y={client:`warning`,assistant:`positive`};function _e(){let e=z(),{data:t}=d({queryKey:[`feature-flag-definitions`],queryFn:ge,enabled:A(),staleTime:300*1e3}),n=(0,G.useMemo)(()=>{let e=new Map;if(!t)return e;for(let n of t)n.type===`string`&&n.values?.length&&e.set(n.key,n.values);return e},[t]),[r,i]=(0,G.useState)(``),a=P(),o=L(),s=(0,G.useMemo)(()=>{let e=[];for(let t of N){let r=j(t.key);if(typeof t.defaultEnabled==`boolean`){let n=a[r],i=o[r],s=t.scope===`both`?n===!0||i===!0:t.scope===`assistant`?i:n;if(typeof s!=`boolean`)continue;e.push({kind:`boolean`,storeKey:r,scope:t.scope,label:t.label,description:t.description,value:s,defaultValue:t.defaultEnabled})}else if(typeof t.defaultEnabled==`string`){let i=a.stringFlags?.[r],s=o.stringFlags?.[r],c=t.scope===`assistant`?s??t.defaultEnabled:i??t.defaultEnabled;e.push({kind:`string`,storeKey:r,scope:t.scope,label:t.label,description:t.description,value:c,defaultValue:t.defaultEnabled,values:n.get(t.key)??t.values})}}return e.sort((e,t)=>e.label.localeCompare(t.label,void 0,{sensitivity:`base`}))},[a,o,n]),c=(0,G.useMemo)(()=>{if(!r.trim())return s;let e=r.trim().toLowerCase();return s.filter(t=>t.label.toLowerCase().includes(e)||t.description.toLowerCase().includes(e)||t.storeKey.toLowerCase().includes(e)||t.scope.includes(e)||t.scope===`both`&&(`client`.includes(e)||`assistant`.includes(e)))},[s,r]);return(0,K.jsx)(B,{title:`Feature Flags`,subtitle:`Active feature flags evaluated for the current session.`,children:(0,K.jsxs)(`div`,{className:`space-y-4`,children:[(0,K.jsxs)(`div`,{className:`relative`,children:[(0,K.jsx)(v,{className:`absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-[var(--content-tertiary)]`}),(0,K.jsx)(`input`,{type:`text`,placeholder:`Search flags...`,value:r,onChange:e=>i(e.target.value),className:`w-full rounded-lg border border-[var(--border-base)] bg-[var(--surface-default)] py-2 pl-9 pr-3 text-body-medium-default text-[var(--content-default)] placeholder:text-[var(--content-tertiary)] focus:border-[var(--border-focus)] focus:outline-none`})]}),c.length===0&&(0,K.jsx)(`p`,{className:`text-body-medium-lighter text-[var(--content-tertiary)]`,children:`No matching flags.`}),c.length>0&&(0,K.jsx)(`div`,{className:`max-h-[500px] space-y-2 overflow-y-auto`,children:c.map(t=>(0,K.jsx)(ye,{flag:t,assistantId:e},t.storeKey))})]})})}function X({scope:e}){return e===`both`?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(b,{tone:Y.client,children:`client`}),(0,K.jsx)(b,{tone:Y.assistant,children:`assistant`})]}):(0,K.jsx)(b,{tone:Y[e],children:e})}function ve({flag:e,assistantId:t}){let n=P.use.setFlag(),r=L.use.setFlag();return(0,K.jsxs)(`div`,{className:`flex items-start gap-3 py-3`,children:[(0,K.jsx)(`div`,{className:`shrink-0 pt-0.5`,children:(0,K.jsx)(x,{checked:e.value,onChange:i=>{M(e.scope,`client`)&&n(e.storeKey,i),M(e.scope,`assistant`)&&r(e.storeKey,i,t)},"aria-label":`${e.label} is ${e.value?`on`:`off`}`})}),(0,K.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-0.5`,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.label}),(0,K.jsx)(X,{scope:e.scope})]}),(0,K.jsx)(`span`,{className:`block text-body-small-default text-[var(--content-tertiary)]`,children:e.description}),(0,K.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,K.jsx)(`span`,{className:`text-body-small-default text-[var(--content-tertiary)]`,children:`Default:`}),(0,K.jsx)(b,{tone:`neutral`,children:e.defaultValue?`On`:`Off`})]})]})]})}function Z({flag:e,assistantId:t}){let n=P.use.setStringFlag(),r=L.use.setStringFlag(),[i,a]=(0,G.useState)(e.value);(0,G.useEffect)(()=>{a(e.value)},[e.value]);let o=i=>{i!==e.value&&(M(e.scope,`client`)&&n(e.storeKey,i),M(e.scope,`assistant`)&&r(e.storeKey,i,t))},s=i!==e.value,c=e.values&&e.values.length>0?e.values:null,l=s&&c!=null&&!c.includes(i),u=()=>{l||o(i)},d=e=>{e.key===`Enter`&&e.currentTarget.blur()},f=c!=null&&c.includes(e.value);return(0,K.jsx)(`div`,{className:`flex items-start gap-3 py-3`,children:(0,K.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-1.5`,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.label}),(0,K.jsx)(X,{scope:e.scope})]}),(0,K.jsx)(`span`,{className:`block text-body-small-default text-[var(--content-tertiary)]`,children:e.description}),f?(0,K.jsx)(w,{value:e.value,onChange:e=>{a(e),o(e)},options:c.map(e=>({value:e,label:e})),className:`w-48`,"aria-label":`${e.label} value`}):(0,K.jsxs)(`div`,{className:`space-y-1`,children:[(0,K.jsx)(`input`,{type:`text`,value:i,onChange:e=>a(e.target.value),onBlur:u,onKeyDown:d,className:p(`w-full rounded-lg border bg-[var(--surface-default)] px-3 py-1.5 text-body-small-default text-[var(--content-default)] placeholder:text-[var(--content-tertiary)] focus:outline-none`,l?`border-[var(--system-negative-strong)]`:`border-[var(--border-base)] focus:border-[var(--border-focus)]`),placeholder:e.defaultValue||`Enter value...`}),l&&(0,K.jsxs)(`span`,{className:`block text-body-small-default text-[var(--system-negative-strong)]`,children:[`Expected one of: `,c.join(`, `)]})]}),(0,K.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,K.jsx)(`span`,{className:`text-body-small-default text-[var(--content-tertiary)]`,children:`Default:`}),(0,K.jsx)(b,{tone:`neutral`,children:e.defaultValue||`(empty)`})]})]})})}function ye({flag:e,assistantId:t}){return e.kind===`string`?(0,K.jsx)(Z,{flag:e,assistantId:t}):(0,K.jsx)(ve,{flag:e,assistantId:t})}function be(){let e=(0,G.useCallback)(()=>{t(Error(`[Dev Settings] Test error event`)),S.success(`Sentry error event sent.`)},[]),i=(0,G.useCallback)(()=>{r(`[Dev Settings] Test warning event`,`warning`),S.success(`Sentry warning event sent.`)},[]),a=(0,G.useCallback)(()=>{r(`[Dev Settings] Test info event`,`info`),S.success(`Sentry info event sent.`)},[]),o=(0,G.useCallback)(()=>{r(`[Dev Settings] Test fatal event`,`fatal`),S.success(`Sentry fatal event sent.`)},[]),s=(0,G.useCallback)(()=>{n({name:`[Dev Settings] Test transaction`,op:`test.transaction`,forceTransaction:!0}).end(),S.success(`Sentry performance transaction sent.`)},[]);return(0,K.jsx)(B,{title:`Sentry Testing`,subtitle:`Fire test events to verify Sentry integration is working.`,children:(0,K.jsxs)(`div`,{className:`space-y-3`,children:[(0,K.jsx)(Q,{icon:(0,K.jsx)(U,{className:`h-4 w-4 text-[var(--system-negative-strong)]`}),label:`Fatal Event`,description:`Send a fatal-level event to Sentry.`,onClick:o}),(0,K.jsx)(Q,{icon:(0,K.jsx)(g,{className:`h-4 w-4 text-[var(--system-negative-default)]`}),label:`Error Event`,description:`Capture a test Error exception.`,onClick:e}),(0,K.jsx)(Q,{icon:(0,K.jsx)(y,{className:`h-4 w-4 text-[var(--system-warning-default)]`}),label:`Warning Event`,description:`Send a warning-level message.`,onClick:i}),(0,K.jsx)(Q,{icon:(0,K.jsx)(ee,{className:`h-4 w-4 text-[var(--content-tertiary)]`}),label:`Info Event`,description:`Send an info-level message.`,onClick:a}),(0,K.jsx)(Q,{icon:(0,K.jsx)(W,{className:`h-4 w-4 text-[var(--system-positive-default)]`}),label:`Performance Transaction`,description:`Start and end a test transaction span.`,onClick:s})]})})}function Q({icon:e,label:t,description:n,onClick:r}){return(0,K.jsxs)(`div`,{className:`flex items-center justify-between gap-4 rounded-lg border border-[var(--border-base)] px-4 py-3`,children:[(0,K.jsxs)(`div`,{className:`flex min-w-0 items-center gap-3`,children:[(0,K.jsx)(`div`,{className:`shrink-0`,children:e}),(0,K.jsxs)(`div`,{className:`min-w-0`,children:[(0,K.jsx)(`p`,{className:`text-body-medium-default text-[var(--content-default)]`,children:t}),(0,K.jsx)(`p`,{className:`text-body-small-default text-[var(--content-tertiary)]`,children:n})]})]}),(0,K.jsxs)(o,{variant:`outlined`,size:`compact`,onClick:r,children:[(0,K.jsx)(h,{className:`h-4 w-4`}),`Send`]})]})}var $=[{id:`feature-flags`,label:`Feature Flags`},{id:`lifecycle`,label:`Assistant Lifecycle`},{id:`sentry`,label:`Sentry Testing`},{id:`memory`,label:`Memory`}];function xe(){let e=l(),[t,n]=s(),r=L.use.settingsDeveloperNav(),i=L.use.hasHydrated(),a=(0,G.useMemo)(()=>{let e=t.get(`tab`);return $.find(t=>t.id===e)?.id??`feature-flags`},[t]);if(i&&!r)return(0,K.jsx)(c,{replace:!0,to:k.settings.general});let u=e=>{let r=new URLSearchParams(t.toString());e===`feature-flags`?r.delete(`tab`):r.set(`tab`,e),n(r,{replace:!0})};return(0,K.jsxs)(`div`,{"data-slot":`developer-page`,className:`flex min-h-0 flex-1 flex-col`,children:[(0,K.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between gap-4 border-b border-[var(--border-base)]`,children:[(0,K.jsx)(`div`,{role:`tablist`,"aria-label":`Developer sections`,className:`flex items-center gap-1`,children:$.map(e=>{let t=e.id===a;return(0,K.jsx)(`button`,{type:`button`,role:`tab`,"aria-selected":t,"aria-controls":`developer-tab-panel-${e.id}`,id:`developer-tab-${e.id}`,onClick:()=>u(e.id),className:R(`relative -mb-px cursor-pointer border-b-2 px-4 py-2 text-body-medium-default transition-colors`,t?`border-[var(--system-positive-strong)] text-[var(--system-positive-strong)]`:`border-transparent text-[var(--content-tertiary)] hover:text-[var(--content-default)] dark:text-[var(--content-disabled)] dark:hover:text-[var(--content-default)]`),children:e.label},e.id)})}),E()&&(0,K.jsx)(o,{variant:`outlined`,className:`mb-1 shrink-0`,onClick:()=>void e(`${k.selectAssistant}?noAutoSkip=1`),children:`Choose Assistant`})]}),(0,K.jsxs)(`div`,{id:`developer-tab-panel-${a}`,role:`tabpanel`,"aria-labelledby":`developer-tab-${a}`,className:`flex min-h-0 flex-1 flex-col pt-6`,children:[a===`feature-flags`&&(0,K.jsxs)(`div`,{className:`space-y-6`,children:[(0,K.jsx)(_e,{}),(0,K.jsx)(he,{})]}),a===`lifecycle`&&(0,K.jsx)(fe,{}),a===`sentry`&&(0,K.jsx)(be,{}),a===`memory`&&(0,K.jsx)(`div`,{className:`space-y-4`,children:(0,K.jsx)(de,{})})]})]})}export{xe as DeveloperPage};
|
|
1
|
+
import{o as e}from"./chunk-jRWAZmH_.js";import{a as t,m as n,o as r,t as i}from"./capture-error-Bj8_eutd.js";import{t as a}from"./react-BFJW0bSv.js";import{t as o}from"./button-Dy5001j6.js";import{m as s,n as c,u as l}from"./chunk-5KNZJZUH-Bsoom5--.js";import{n as u}from"./QueryClientProvider-CMu7CkQU.js";import{t as d}from"./useQuery-Bz-fbQ-m.js";import{t as f}from"./jsx-runtime-D3ZM-ToX.js";import{t as p}from"./cn-CJf7MmLX.js";import{t as m}from"./createLucideIcon-CAM1RhH8.js";import{t as h}from"./bug-VUcJFHwN.js";import{t as g}from"./circle-x-17dBxF06.js";import{t as ee}from"./info-vgPTIsGI.js";import{t as _}from"./loader-circle-XREx3i4W.js";import{t as v}from"./search-BVW-n8to.js";import{t as y}from"./triangle-alert-CQfiAg_t.js";import"./src-D89CNeuT.js";import{t as b}from"./tag-NXcyiTkK.js";import{t as x}from"./toggle-lfnhEAcN.js";import{n as S}from"./toast-LgLp4obE.js";import{t as C}from"./confirm-dialog-UYFm4osC.js";import{t as w}from"./dropdown-BCfnSdIZ.js";import{C as T,f as E}from"./local-mode-Ckii2tmN.js";import{Bt as D,Qt as O,X as te,Y as ne,Zt as re,c as ie,u as ae}from"./react-query.gen-r3I6j8-1.js";import{D as oe}from"./auth-store-D0-gDCVn.js";import{t as se}from"./client.gen-CV05d-kw.js";import{c as ce,o as le}from"./api-XwdNiVE9.js";import{u as k}from"./routes-vE-2hncW.js";import{t as A}from"./use-is-org-ready-DGc9B_-V.js";import{a as j,l as M,o as N}from"./feature-flag-catalog-D6qrHLNs.js";import{t as P}from"./client-feature-flag-store-iq53KePp.js";import{O as F,v as I}from"./react-query.gen-Mwd5l-vZ.js";import{t as L}from"./assistant-feature-flag-store-v8SP-gAp.js";import{t as R}from"./misc-DckBb5zz.js";import{t as z}from"./use-active-assistant-id-CXhDyK7y.js";import{t as B}from"./detail-card-BMRGmkia.js";import{t as V}from"./environment-store-Dk9rAKWX.js";import{n as H}from"./assistant-status-panel-wSQLMiYn.js";var U=m(`flame`,[[`path`,{d:`M12 3q1 4 4 6.5t3 5.5a1 1 0 0 1-14 0 5 5 0 0 1 1-3 1 1 0 0 0 5 0c0-2-1.5-3-1.5-5q0-2 2.5-4`,key:`1slcih`}]]),W=m(`timer`,[[`line`,{x1:`10`,x2:`14`,y1:`2`,y2:`2`,key:`14vaq8`}],[`line`,{x1:`12`,x2:`15`,y1:`14`,y2:`11`,key:`17fdiu`}],[`circle`,{cx:`12`,cy:`14`,r:`8`,key:`1e1u0o`}]]),G=e(a(),1),K=f();function ue({memoryEnabled:e}){let t=z(),n=u(),{data:r}=d({...ne({path:{assistant_id:t}}),staleTime:3e4}),a=e=>{te(n,{path:{assistant_id:t}},t=>t&&{...t,status:e?`running`:`not_running`})},o=re({onSuccess:()=>a(!0)}),s=O({onSuccess:()=>a(!1)}),c=async e=>{try{e?(await o.mutateAsync({path:{assistant_id:t}}),S.success(`Background worker started.`)):(await s.mutateAsync({path:{assistant_id:t}}),S.success(`Background worker stopped.`))}catch(e){i(e,{context:`settings-memory-worker-toggle`}),S.error(`Failed to update background worker.`)}};if(!r)return null;let l=o.isPending||s.isPending;return(0,K.jsxs)(`div`,{className:`flex flex-row items-start justify-between gap-4 border-t border-[var(--border-subtle)] pt-4`,children:[(0,K.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-2`,children:[(0,K.jsx)(`h3`,{className:`text-body-medium-default text-[var(--content-emphasised)]`,children:`Background worker`}),(0,K.jsx)(`p`,{className:`text-body-medium-default text-[var(--content-tertiary)]`,children:`Run memory consolidation in a dedicated background process. It starts automatically; stop it to pause background memory processing until the next restart.`})]}),(0,K.jsx)(x,{checked:r.status===`running`,onChange:e=>void c(e),"aria-label":`Enable background memory worker`,disabled:!e||l})]})}function de(){let{healthz:e}=H(),t=z(),n=u(),r=e?.capabilities?.memoryOptOut===!0,{data:a}=d({...ie({path:{assistant_id:t}}),staleTime:3e4,enabled:r}),o=D({onSuccess:e=>{ae(n,{path:{assistant_id:t}},e)}}),s=a?.memory?.enabled!==!1,c=async e=>{try{await o.mutateAsync({path:{assistant_id:t},body:{memory:{enabled:e}}}),S.success(e?`Memory enabled.`:`Memory disabled.`)}catch(e){i(e,{context:`settings-memory-toggle`}),S.error(`Failed to update memory setting.`)}};return r?(0,K.jsx)(B,{title:`Memory`,subtitle:`Let your assistant remember information from past conversations. Turning this off also pauses memory consolidation.`,accessory:(0,K.jsx)(x,{checked:s,onChange:e=>void c(e),"aria-label":`Enable memory`,disabled:o.isPending}),compactAccessory:!0,children:(0,K.jsx)(ue,{memoryEnabled:s})}):null}function fe(){let e=u(),[t,n]=(0,G.useState)(!1),[r,i]=(0,G.useState)(!1),a=A(),s=z(),{data:c,isLoading:l}=d({...F({path:{id:s}}),enabled:a}),{data:f,isLoading:p}=d({...I({query:{hosting:`all`}}),enabled:a}),m=l||p,h=f?.results??[];return(0,K.jsxs)(`div`,{className:`space-y-6`,children:[(0,K.jsx)(pe,{assistant:c??null,loading:m}),(0,K.jsx)(me,{assistants:h,activeAssistantId:s,loading:m}),(0,K.jsxs)(B,{title:`Hatch New Assistant`,subtitle:`Create a new assistant instance.`,children:[(0,K.jsxs)(`div`,{className:`flex items-center justify-between gap-4`,children:[(0,K.jsx)(`p`,{className:`text-body-medium-lighter text-[var(--content-tertiary)]`,children:`Provision a new assistant. This may take a moment.`}),(0,K.jsx)(o,{variant:`outlined`,leftIcon:t?(0,K.jsx)(_,{className:`animate-spin`}):void 0,onClick:()=>i(!0),disabled:t,className:`shrink-0`,children:`Hatch`})]}),(0,K.jsx)(C,{open:r,title:`Hatch New Assistant`,message:`Are you sure you want to create a new assistant? This will provision new infrastructure.`,confirmLabel:`Hatch`,onConfirm:async()=>{i(!1),n(!0);try{let t=await le(void 0,`create`);if(t.ok){if(E())try{let e=await ce();e.ok&&await T(e.data,oe.getState().currentOrganizationId??void 0)}catch{}S.success(t.status===201?`New assistant hatched successfully.`:`Returned your existing assistant — no new one was created.`),e.invalidateQueries({queryKey:[{_id:`assistantsRetrieve`}]}),e.invalidateQueries({queryKey:I({query:{hosting:`all`}}).queryKey})}else{let e=typeof t.error?.detail==`string`?t.error.detail:`Failed to hatch assistant.`;S.error(e)}}catch{S.error(`Failed to hatch assistant.`)}finally{n(!1)}},onCancel:()=>i(!1)})]})]})}function pe({assistant:e,loading:t}){return t?(0,K.jsx)(B,{title:`Assistant Info`,children:(0,K.jsxs)(`div`,{className:`flex items-center gap-2 text-body-medium-lighter text-[var(--content-tertiary)]`,children:[(0,K.jsx)(_,{className:`h-4 w-4 animate-spin`}),`Loading assistant info...`]})}):e?(0,K.jsx)(B,{title:`Assistant Info`,subtitle:`Current assistant details.`,children:(0,K.jsxs)(`div`,{className:`grid grid-cols-[140px_minmax(0,1fr)] gap-y-3`,children:[(0,K.jsx)(q,{children:`Name`}),(0,K.jsx)(J,{children:e.name??`Unnamed`}),(0,K.jsx)(q,{children:`Status`}),(0,K.jsx)(`div`,{children:(0,K.jsx)(b,{tone:e.status===`active`?`positive`:`neutral`,children:e.status})}),(0,K.jsx)(q,{children:`Assistant ID`}),(0,K.jsx)(`span`,{className:`break-all font-mono text-body-small-default text-[var(--content-tertiary)]`,children:e.id}),e.machine_id&&(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(q,{children:`Machine ID`}),(0,K.jsx)(`span`,{className:`break-all font-mono text-body-small-default text-[var(--content-tertiary)]`,children:e.machine_id})]}),(0,K.jsx)(q,{children:`Created`}),(0,K.jsx)(J,{children:new Date(e.created).toLocaleDateString()}),(0,K.jsx)(q,{children:`Last Modified`}),(0,K.jsx)(J,{children:new Date(e.modified).toLocaleDateString()}),e.current_release_version&&(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(q,{children:`Version`}),(0,K.jsx)(J,{children:e.current_release_version})]})]})}):(0,K.jsx)(B,{title:`Assistant Info`,children:(0,K.jsx)(`p`,{className:`text-body-medium-lighter text-[var(--content-tertiary)]`,children:`No assistant found. Hatch an assistant to get started.`})})}function me({assistants:e,activeAssistantId:t,loading:n}){return n||e.length===0?null:(0,K.jsx)(B,{title:`All Assistants`,subtitle:`${e.length} assistant${e.length===1?``:`s`} found.`,children:(0,K.jsx)(`div`,{className:`max-h-[300px] space-y-2 overflow-y-auto`,children:e.map(e=>{let n=e.id===t;return(0,K.jsx)(`div`,{className:`flex items-center justify-between gap-4 rounded-lg border px-4 py-3 ${n?`border-[var(--border-focus)] bg-[var(--surface-lift)]`:`border-[var(--border-base)] bg-[var(--surface-default)]`}`,children:(0,K.jsxs)(`div`,{className:`min-w-0`,children:[(0,K.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,K.jsx)(`span`,{className:`truncate text-body-medium-default text-[var(--content-default)]`,children:e.name||`Unnamed`}),(0,K.jsx)(b,{tone:e.status===`active`?`positive`:`neutral`,children:e.status}),n&&(0,K.jsx)(b,{tone:`warning`,children:`Current`})]}),(0,K.jsx)(`span`,{className:`font-mono text-body-small-default text-[var(--content-tertiary)]`,children:e.id})]})},e.id)})})})}function q({children:e}){return(0,K.jsx)(`span`,{className:`text-body-medium-default text-[var(--content-tertiary)]`,children:e})}function J({children:e}){return(0,K.jsx)(`span`,{className:`text-body-medium-lighter text-[var(--content-default)]`,children:e})}function he(){let e=V.use.emailRootDomain(),t=V.use.isNonProduction(),n=V.use.setEnvironment();return(0,K.jsx)(B,{title:`Environment`,subtitle:`Environment configuration overrides for this session.`,children:(0,K.jsxs)(`div`,{className:`space-y-2`,children:[(0,K.jsxs)(`div`,{className:`flex items-start gap-3 py-3`,children:[(0,K.jsx)(`div`,{className:`shrink-0 pt-0.5`,children:(0,K.jsx)(x,{checked:t,onChange:e=>n({isNonProduction:e}),"aria-label":`Non-Production is ${t?`on`:`off`}`})}),(0,K.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-0.5`,children:[(0,K.jsx)(`span`,{className:`text-body-medium-default text-[var(--content-default)]`,children:`Non-Production`}),(0,K.jsx)(`span`,{className:`block text-body-small-default text-[var(--content-tertiary)]`,children:`Indicates a non-production environment. Enables dev-only UI surfaces and diagnostics.`})]})]}),(0,K.jsxs)(`div`,{className:`flex items-start gap-3 py-3`,children:[(0,K.jsx)(`div`,{className:`shrink-0 pt-0.5`,children:(0,K.jsx)(b,{tone:`neutral`,children:e})}),(0,K.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-0.5`,children:[(0,K.jsx)(`span`,{className:`text-body-medium-default text-[var(--content-default)]`,children:`Email Root Domain`}),(0,K.jsx)(`span`,{className:`block text-body-small-default text-[var(--content-tertiary)]`,children:`Root domain used for assistant email addresses (e.g. vellum.me).`})]})]})]})})}async function ge(){let{data:e,response:t}=await se.get({url:`/v1/feature-flags/`,throwOnError:!1});return t?.ok?e?.flags??[]:[]}var Y={client:`warning`,assistant:`positive`};function _e(){let e=z(),{data:t}=d({queryKey:[`feature-flag-definitions`],queryFn:ge,enabled:A(),staleTime:300*1e3}),n=(0,G.useMemo)(()=>{let e=new Map;if(!t)return e;for(let n of t)n.type===`string`&&n.values?.length&&e.set(n.key,n.values);return e},[t]),[r,i]=(0,G.useState)(``),a=P(),o=L(),s=(0,G.useMemo)(()=>{let e=[];for(let t of N){let r=j(t.key);if(typeof t.defaultEnabled==`boolean`){let n=a[r],i=o[r],s=t.scope===`both`?n===!0||i===!0:t.scope===`assistant`?i:n;if(typeof s!=`boolean`)continue;e.push({kind:`boolean`,storeKey:r,scope:t.scope,label:t.label,description:t.description,value:s,defaultValue:t.defaultEnabled})}else if(typeof t.defaultEnabled==`string`){let i=a.stringFlags?.[r],s=o.stringFlags?.[r],c=t.scope===`assistant`?s??t.defaultEnabled:i??t.defaultEnabled;e.push({kind:`string`,storeKey:r,scope:t.scope,label:t.label,description:t.description,value:c,defaultValue:t.defaultEnabled,values:n.get(t.key)??t.values})}}return e.sort((e,t)=>e.label.localeCompare(t.label,void 0,{sensitivity:`base`}))},[a,o,n]),c=(0,G.useMemo)(()=>{if(!r.trim())return s;let e=r.trim().toLowerCase();return s.filter(t=>t.label.toLowerCase().includes(e)||t.description.toLowerCase().includes(e)||t.storeKey.toLowerCase().includes(e)||t.scope.includes(e)||t.scope===`both`&&(`client`.includes(e)||`assistant`.includes(e)))},[s,r]);return(0,K.jsx)(B,{title:`Feature Flags`,subtitle:`Active feature flags evaluated for the current session.`,children:(0,K.jsxs)(`div`,{className:`space-y-4`,children:[(0,K.jsxs)(`div`,{className:`relative`,children:[(0,K.jsx)(v,{className:`absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-[var(--content-tertiary)]`}),(0,K.jsx)(`input`,{type:`text`,placeholder:`Search flags...`,value:r,onChange:e=>i(e.target.value),className:`w-full rounded-lg border border-[var(--border-base)] bg-[var(--surface-default)] py-2 pl-9 pr-3 text-body-medium-default text-[var(--content-default)] placeholder:text-[var(--content-tertiary)] focus:border-[var(--border-focus)] focus:outline-none`})]}),c.length===0&&(0,K.jsx)(`p`,{className:`text-body-medium-lighter text-[var(--content-tertiary)]`,children:`No matching flags.`}),c.length>0&&(0,K.jsx)(`div`,{className:`max-h-[500px] space-y-2 overflow-y-auto`,children:c.map(t=>(0,K.jsx)(ye,{flag:t,assistantId:e},t.storeKey))})]})})}function X({scope:e}){return e===`both`?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(b,{tone:Y.client,children:`client`}),(0,K.jsx)(b,{tone:Y.assistant,children:`assistant`})]}):(0,K.jsx)(b,{tone:Y[e],children:e})}function ve({flag:e,assistantId:t}){let n=P.use.setFlag(),r=L.use.setFlag();return(0,K.jsxs)(`div`,{className:`flex items-start gap-3 py-3`,children:[(0,K.jsx)(`div`,{className:`shrink-0 pt-0.5`,children:(0,K.jsx)(x,{checked:e.value,onChange:i=>{M(e.scope,`client`)&&n(e.storeKey,i),M(e.scope,`assistant`)&&r(e.storeKey,i,t)},"aria-label":`${e.label} is ${e.value?`on`:`off`}`})}),(0,K.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-0.5`,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.label}),(0,K.jsx)(X,{scope:e.scope})]}),(0,K.jsx)(`span`,{className:`block text-body-small-default text-[var(--content-tertiary)]`,children:e.description}),(0,K.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,K.jsx)(`span`,{className:`text-body-small-default text-[var(--content-tertiary)]`,children:`Default:`}),(0,K.jsx)(b,{tone:`neutral`,children:e.defaultValue?`On`:`Off`})]})]})]})}function Z({flag:e,assistantId:t}){let n=P.use.setStringFlag(),r=L.use.setStringFlag(),[i,a]=(0,G.useState)(e.value);(0,G.useEffect)(()=>{a(e.value)},[e.value]);let o=i=>{i!==e.value&&(M(e.scope,`client`)&&n(e.storeKey,i),M(e.scope,`assistant`)&&r(e.storeKey,i,t))},s=i!==e.value,c=e.values&&e.values.length>0?e.values:null,l=s&&c!=null&&!c.includes(i),u=()=>{l||o(i)},d=e=>{e.key===`Enter`&&e.currentTarget.blur()},f=c!=null&&c.includes(e.value);return(0,K.jsx)(`div`,{className:`flex items-start gap-3 py-3`,children:(0,K.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-1.5`,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.label}),(0,K.jsx)(X,{scope:e.scope})]}),(0,K.jsx)(`span`,{className:`block text-body-small-default text-[var(--content-tertiary)]`,children:e.description}),f?(0,K.jsx)(w,{value:e.value,onChange:e=>{a(e),o(e)},options:c.map(e=>({value:e,label:e})),className:`w-48`,"aria-label":`${e.label} value`}):(0,K.jsxs)(`div`,{className:`space-y-1`,children:[(0,K.jsx)(`input`,{type:`text`,value:i,onChange:e=>a(e.target.value),onBlur:u,onKeyDown:d,className:p(`w-full rounded-lg border bg-[var(--surface-default)] px-3 py-1.5 text-body-small-default text-[var(--content-default)] placeholder:text-[var(--content-tertiary)] focus:outline-none`,l?`border-[var(--system-negative-strong)]`:`border-[var(--border-base)] focus:border-[var(--border-focus)]`),placeholder:e.defaultValue||`Enter value...`}),l&&(0,K.jsxs)(`span`,{className:`block text-body-small-default text-[var(--system-negative-strong)]`,children:[`Expected one of: `,c.join(`, `)]})]}),(0,K.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,K.jsx)(`span`,{className:`text-body-small-default text-[var(--content-tertiary)]`,children:`Default:`}),(0,K.jsx)(b,{tone:`neutral`,children:e.defaultValue||`(empty)`})]})]})})}function ye({flag:e,assistantId:t}){return e.kind===`string`?(0,K.jsx)(Z,{flag:e,assistantId:t}):(0,K.jsx)(ve,{flag:e,assistantId:t})}function be(){let e=(0,G.useCallback)(()=>{t(Error(`[Dev Settings] Test error event`)),S.success(`Sentry error event sent.`)},[]),i=(0,G.useCallback)(()=>{r(`[Dev Settings] Test warning event`,`warning`),S.success(`Sentry warning event sent.`)},[]),a=(0,G.useCallback)(()=>{r(`[Dev Settings] Test info event`,`info`),S.success(`Sentry info event sent.`)},[]),o=(0,G.useCallback)(()=>{r(`[Dev Settings] Test fatal event`,`fatal`),S.success(`Sentry fatal event sent.`)},[]),s=(0,G.useCallback)(()=>{n({name:`[Dev Settings] Test transaction`,op:`test.transaction`,forceTransaction:!0}).end(),S.success(`Sentry performance transaction sent.`)},[]);return(0,K.jsx)(B,{title:`Sentry Testing`,subtitle:`Fire test events to verify Sentry integration is working.`,children:(0,K.jsxs)(`div`,{className:`space-y-3`,children:[(0,K.jsx)(Q,{icon:(0,K.jsx)(U,{className:`h-4 w-4 text-[var(--system-negative-strong)]`}),label:`Fatal Event`,description:`Send a fatal-level event to Sentry.`,onClick:o}),(0,K.jsx)(Q,{icon:(0,K.jsx)(g,{className:`h-4 w-4 text-[var(--system-negative-default)]`}),label:`Error Event`,description:`Capture a test Error exception.`,onClick:e}),(0,K.jsx)(Q,{icon:(0,K.jsx)(y,{className:`h-4 w-4 text-[var(--system-warning-default)]`}),label:`Warning Event`,description:`Send a warning-level message.`,onClick:i}),(0,K.jsx)(Q,{icon:(0,K.jsx)(ee,{className:`h-4 w-4 text-[var(--content-tertiary)]`}),label:`Info Event`,description:`Send an info-level message.`,onClick:a}),(0,K.jsx)(Q,{icon:(0,K.jsx)(W,{className:`h-4 w-4 text-[var(--system-positive-default)]`}),label:`Performance Transaction`,description:`Start and end a test transaction span.`,onClick:s})]})})}function Q({icon:e,label:t,description:n,onClick:r}){return(0,K.jsxs)(`div`,{className:`flex items-center justify-between gap-4 rounded-lg border border-[var(--border-base)] px-4 py-3`,children:[(0,K.jsxs)(`div`,{className:`flex min-w-0 items-center gap-3`,children:[(0,K.jsx)(`div`,{className:`shrink-0`,children:e}),(0,K.jsxs)(`div`,{className:`min-w-0`,children:[(0,K.jsx)(`p`,{className:`text-body-medium-default text-[var(--content-default)]`,children:t}),(0,K.jsx)(`p`,{className:`text-body-small-default text-[var(--content-tertiary)]`,children:n})]})]}),(0,K.jsxs)(o,{variant:`outlined`,size:`compact`,onClick:r,children:[(0,K.jsx)(h,{className:`h-4 w-4`}),`Send`]})]})}var $=[{id:`feature-flags`,label:`Feature Flags`},{id:`lifecycle`,label:`Assistant Lifecycle`},{id:`sentry`,label:`Sentry Testing`},{id:`memory`,label:`Memory`}];function xe(){let e=l(),[t,n]=s(),r=L.use.settingsDeveloperNav(),i=L.use.hasHydrated(),a=(0,G.useMemo)(()=>{let e=t.get(`tab`);return $.find(t=>t.id===e)?.id??`feature-flags`},[t]);if(i&&!r)return(0,K.jsx)(c,{replace:!0,to:k.settings.general});let u=e=>{let r=new URLSearchParams(t.toString());e===`feature-flags`?r.delete(`tab`):r.set(`tab`,e),n(r,{replace:!0})};return(0,K.jsxs)(`div`,{"data-slot":`developer-page`,className:`flex min-h-0 flex-1 flex-col`,children:[(0,K.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between gap-4 border-b border-[var(--border-base)]`,children:[(0,K.jsx)(`div`,{role:`tablist`,"aria-label":`Developer sections`,className:`flex items-center gap-1`,children:$.map(e=>{let t=e.id===a;return(0,K.jsx)(`button`,{type:`button`,role:`tab`,"aria-selected":t,"aria-controls":`developer-tab-panel-${e.id}`,id:`developer-tab-${e.id}`,onClick:()=>u(e.id),className:R(`relative -mb-px cursor-pointer border-b-2 px-4 py-2 text-body-medium-default transition-colors`,t?`border-[var(--system-positive-strong)] text-[var(--system-positive-strong)]`:`border-transparent text-[var(--content-tertiary)] hover:text-[var(--content-default)] dark:text-[var(--content-disabled)] dark:hover:text-[var(--content-default)]`),children:e.label},e.id)})}),E()&&(0,K.jsx)(o,{variant:`outlined`,className:`mb-1 shrink-0`,onClick:()=>void e(`${k.selectAssistant}?noAutoSkip=1`),children:`Choose Assistant`})]}),(0,K.jsxs)(`div`,{id:`developer-tab-panel-${a}`,role:`tabpanel`,"aria-labelledby":`developer-tab-${a}`,className:`flex min-h-0 flex-1 flex-col pt-6`,children:[a===`feature-flags`&&(0,K.jsxs)(`div`,{className:`space-y-6`,children:[(0,K.jsx)(_e,{}),(0,K.jsx)(he,{})]}),a===`lifecycle`&&(0,K.jsx)(fe,{}),a===`sentry`&&(0,K.jsx)(be,{}),a===`memory`&&(0,K.jsx)(`div`,{className:`space-y-4`,children:(0,K.jsx)(de,{})})]})]})}export{xe as DeveloperPage};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var e={version:1,flags:[{id:`in-chat-onboarding-tour`,scope:`client`,key:`in-chat-onboarding-tour`,label:`In-Chat Onboarding Tour`,description:`Multivariate experiment for the eyes-led in-chat onboarding tour. control = straight to chat after research onboarding (current behavior); tour = the extended tour auto-plays on first workspace entry. Desktop-only: phone-width viewports and the native shell get neither the tour nor its telemetry (not even the exposure event), so the funnel measures desktop sessions exclusively. Targeted via LaunchDarkly (70% tour / 30% control).`,defaultEnabled:`control`,values:[`control`,`tour`]},{id:`user-hosted-enabled`,scope:`client`,key:`user-hosted-enabled`,label:`User Hosted Enabled`,description:`Enable user-hosted onboarding flow`,defaultEnabled:!1},{id:`proactive-tips`,scope:`client`,key:`proactive-tips`,label:`Proactive Tips`,description:`Gates the dismissible proactive tip card in the web sidebar. String-valued so future A/B arms can be added as new values.`,defaultEnabled:`off`,values:[`off`,`on`]},{id:`experiment-activation-flow-2026-06-03`,scope:`both`,key:`experiment-activation-flow-2026-06-03`,label:`Activation Flow Experiment 2026-06-03`,description:`Multivariate activation-flow experiment. control = standard flow; variant-a = activation rail; personal-page = new sign-up-page variant (front-end only). Targeted via LaunchDarkly.`,defaultEnabled:`control`,values:[`control`,`variant-a`,`personal-page`]},{id:`experiment-billing-cta-2026-07-23`,scope:`client`,key:`experiment-billing-cta-2026-07-23`,label:`Experiment: Billing CTA 2026-07-23`,description:`Credit paywall CTA experiment. control = single Add Credits CTA for everyone (opens Add Credits modal). upgrade-cta = FREE users (plan_id base) get a single Upgrade CTA (View Plans takeover) instead; PAID users still get Add Credits.`,defaultEnabled:`control`,values:[`control`,`upgrade-cta`]},{id:`local-docker-enabled`,scope:`client`,key:`local-docker-enabled`,label:`Local Docker Mode`,description:`When enabled, the Local hosting option uses Docker under the hood for sandboxed execution, hiding the separate Docker card`,defaultEnabled:!1},{id:`a2a-channel`,scope:`assistant`,key:`a2a-channel`,label:`A2A Channel`,description:`Enable the A2A (Agent-to-Agent) channel for inter-assistant communication via the open A2A protocol`,defaultEnabled:!1},{id:`settings-developer-nav`,scope:`assistant`,key:`settings-developer-nav`,label:`Settings Developer Nav`,description:`Control Developer nav visibility in macOS settings`,defaultEnabled:!1},{id:`developer-menu-items`,scope:`client`,key:`developer-menu-items`,label:`Developer Menu Items`,description:`Show Component Gallery and Replay Onboarding in the menu bar`,defaultEnabled:!1},{id:`settings-embedding-provider`,scope:`assistant`,key:`settings-embedding-provider`,label:`Embedding Provider Settings`,description:`Show the Embedding service card in Models & Services settings`,defaultEnabled:!1},{id:`multi-platform-assistant`,scope:`client`,key:`multi-platform-assistant`,label:`Multi-Platform Assistant Switcher`,description:`Enable the menu-bar assistant switcher for managing multiple platform-hosted assistants (new/switch/retire)`,defaultEnabled:!1},{id:`quick-input`,scope:`client`,key:`quick-input`,label:`Quick Input`,description:`Enable the Quick Input popover on right-click of the menu bar icon`,defaultEnabled:!1},{id:`expand-completed-steps`,scope:`client`,key:`expand-completed-steps`,label:`Expand Completed Steps`,description:`Auto-expand completed tool call step groups instead of showing them collapsed`,defaultEnabled:!1},{id:`backward-releases`,scope:`assistant`,key:`backward-releases`,label:`Backward Releases`,description:`Show older versions in the version picker, allowing rollback to previous releases`,defaultEnabled:!1},{id:`voice-mode`,scope:`assistant`,key:`voice-mode`,label:`Voice Mode`,description:`Show the live voice conversation button in the composer`,defaultEnabled:!1},{id:`voice-duplex-handoff`,scope:`assistant`,key:`voice-duplex-handoff`,label:`Voice Duplex Handoff`,description:`When a user barges in during live voice, keep the interrupted turn running as a background subagent instead of discarding it (true-duplex handoff)`,defaultEnabled:!1},{id:`fast-mode`,scope:`assistant`,key:`fast-mode`,label:`Fast Mode`,description:`Enable Anthropic fast mode for Opus models (4.6, 4.7, 4.8), delivering up to 2.5x higher output tokens per second at premium pricing`,defaultEnabled:!1},{id:`teleport`,scope:`client`,key:`teleport`,label:`Teleport`,description:`Enable teleport UI in General settings for moving assistants between hosting environments`,defaultEnabled:!1},{id:`apple-container`,scope:`client`,key:`apple-container`,label:`Apple Container`,description:`Enable assistant sandboxing via Apple Containers on macOS 26+, providing a lightweight native sandbox without third-party dependencies`,defaultEnabled:!1},{id:`fork-from-message`,scope:`client`,key:`fork-from-message`,label:`Fork from Message`,description:`Show the 'Fork from here' option in message overflow menus`,defaultEnabled:!1},{id:`home-tab`,scope:`client`,key:`home-tab`,label:`Home Tab`,description:`Replace the knowledge graph top-level tab with a new Home page showing relationship progression, facts, and capability tiers`,defaultEnabled:!1},{id:`scroll-debug-overlay`,scope:`client`,key:`scroll-debug-overlay`,label:`Scroll Debug Overlay`,description:`Show a live HUD in the top-right of the conversation with scroll geometry, velocity, update rate, and anchor-preserver activity. Developer diagnostic for investigating scroll jank.`,defaultEnabled:!1},{id:`compaction-playground`,scope:`assistant`,key:`compaction-playground`,label:`Compaction Playground`,description:`Expose the developer-only Compaction Playground tab in macOS Settings and enable the /playground/* HTTP endpoints for exercising compaction conditions. Dev-only; default off.`,defaultEnabled:!1},{id:`app-control`,scope:`assistant`,key:`app-control`,label:`App Control`,description:`Enable the app-control skill (per-app screenshot + raw input bypassing AX tree)`,defaultEnabled:!1},{id:`velvet-theme`,scope:`client`,key:`velvet-theme`,label:`Velvet Theme`,description:`Show the Velvet theme option in the macOS appearance settings. Velvet is a dark-mode variant with red/pink accent colors.`,defaultEnabled:!1},{id:`queue-steering`,scope:`assistant`,key:`queue-steering`,label:`Queue Steering`,description:`Enable the 'Push to agent' button on queued messages, allowing users to steer the assistant to a specific queued message by aborting the current generation and promoting the message to the head of the queue.`,defaultEnabled:!1},{id:`chat-pull-to-refresh-enabled`,scope:`client`,key:`chat-pull-to-refresh-enabled`,label:`Chat Pull to Refresh`,description:`Enable pull-to-refresh gesture in the chat view.`,defaultEnabled:!1},{id:`platform-notifications`,scope:`client`,key:`platform-notifications`,label:`Platform Notifications`,description:`Enable the Notifications tab in settings.`,defaultEnabled:!1},{id:`centralized-assistant-status`,scope:`client`,key:`centralized-assistant-status`,label:`Centralized Assistant Status`,description:`Enable client polling of the centralized assistant operational status endpoint.`,defaultEnabled:!1},{id:`preview-channel`,scope:`client`,key:`preview-channel`,label:`Preview Channel`,description:`Enable user-facing Preview release channel controls in assistant settings.`,defaultEnabled:!1},{id:`rollback-enabled`,scope:`assistant`,key:`rollback-enabled`,label:`Rollback Enabled`,description:`Show older versions in the version picker, allowing rollback to previous releases.`,defaultEnabled:!1},{id:`self-hosted-assistant`,scope:`client`,key:`self-hosted-assistant`,label:`Self-Hosted Assistant`,description:`Enable self-hosted assistant configuration.`,defaultEnabled:!1},{id:`web-remote-ingress`,scope:`assistant`,key:`web-remote-ingress`,label:`Web Remote Ingress`,description:`Serve the web client over a public tunnel and enable browser pairing for self-hosted assistants.`,defaultEnabled:!1},{id:`settings-sleep-policy`,scope:`assistant`,key:`settings-sleep-policy`,label:`Settings Sleep Policy`,description:`Enable sleep policy settings.`,defaultEnabled:!1},{id:`velvet`,scope:`client`,key:`velvet`,label:`Velvet`,description:`Enable the Velvet design theme.`,defaultEnabled:!1},{id:`memory-router-playground`,scope:`client`,key:`memory-router-playground`,label:`Memory Router Playground`,description:`Expose the developer-only Memory Router Playground tab in macOS Settings and the /assistant/memory-router-playground web page for dry-running v4 router config overrides against the live page index. Dev-only; default off.`,defaultEnabled:!1},{id:`self-intro-greeting`,scope:`both`,key:`self-intro-greeting`,label:`Self-intro first message`,description:`On the first conversation, send a natural self-introduction (e.g. "Hi Vela, I'm alex. Nice to meet you.") on the user's behalf and route it through real LLM inference, instead of serving the canned first greeting. Names come from the onboarding context; falls back to the canned greeting when no name is known. Exposed to clients so pre-hatch onboarding can compute the source-of-truth initial message, and to the assistant so older clients can still be gated server-side. See assistant/src/daemon/first-greeting.ts (buildSelfIntroMessage).`,defaultEnabled:!1},{id:`channel-trust-floors`,scope:`assistant`,key:`channel-trust-floors`,label:`Channel Trust Floors`,description:`Expose the Channel Trust Floors settings card (per-channel inbound admission policy) on the Privacy settings page. When off, the card is hidden and channels fall back to their default admission floors. On by default; disable to hide the card.`,defaultEnabled:!0},{id:`mcp-add-server`,scope:`assistant`,key:`mcp-add-server`,label:`MCP Add Server`,description:`Show the Add Server action on the MCP settings page. The MCP page itself remains visible; this flag gates only creating new Model Context Protocol server connections.`,defaultEnabled:!1},{id:`os-beta`,scope:`assistant`,key:`os-beta`,label:`OS Beta`,description:`Enable the OS Beta model profile (MiniMax M3 / Together) in the assistant's model profile selection.`,defaultEnabled:!1},{id:`new-thread-suggestions`,scope:`client`,key:`new-thread-suggestions`,label:`New-thread suggestions library`,description:`Replace the empty-state conversation-starter chips with the scrollable, categorized suggestions library and detail drawer (currently mocked data).`,defaultEnabled:!1},{id:`account-mfa`,scope:`client`,key:`account-mfa`,label:`Account MFA`,description:`Surface the Security settings page where users enroll and manage TOTP two-factor authentication for their Vellum (WorkOS) account. Applies to email/password sign-in only.`,defaultEnabled:!1},{id:`chat-credential-reveal`,scope:`assistant`,key:`chat-credential-reveal`,label:`Chat Credential Reveal`,description:"Persist chat secret redactions as sentinel markers instead of the legacy HTML marker, enriched with the vault identity when the value byte-matches a credential revealed this turn. Also gates the `credentials reveal --for-chat` channel and the live-stream swap that replaces an echoed reveal plaintext with its sentinel before emission. Redaction itself is NOT gated: a route-proven reveal plaintext stays out of persisted rows in both modes. Client chip rendering is gated on daemon version, not on this flag.",defaultEnabled:!1},{id:`composer-secret-guard`,scope:`assistant`,key:`composer-secret-guard`,label:`Composer Secret Guard`,description:`Detect API keys/secrets typed into the chat composer and offer secure credential storage before send`,defaultEnabled:!1}]};function t(e,t){return e===t||e===`both`}var n=e.flags,r={};function i(e){return r[e]||e.split(`-`).map((e,t)=>e===`ui`?`UI`:t===0?e:e[0].toUpperCase()+e.slice(1)).join(``)}function a(e){let r={};for(let a of n)typeof a.defaultEnabled==`boolean`&&t(a.scope,e)&&(r[i(a.key)]=a.defaultEnabled);return r}function o(e){let r={};for(let a of n)typeof a.defaultEnabled==`string`&&t(a.scope,e)&&(r[i(a.key)]=a.defaultEnabled);return r}var s=a(`client`),c=a(`assistant`),l=o(`client`),u=o(`assistant`),d=new Map;for(let e of n)d.set(i(e.key),e);var f=new Map;for(let e of n)f.set(i(e.key),e.key);function p(e){return i(e)}function m(e){return f.get(e)}function h(e){return d.get(e)}var g=`VITE_VELLUM_FLAG_`;function _(e){return e.toLowerCase().replace(/_/g,`-`)}var v=new Set([`true`,`1`,`yes`,`on`]),y=new Set([`false`,`0`,`no`,`off`]),b=new Map;for(let e of n)b.set(e.key,e);function x(e){return typeof e?.defaultEnabled==`string`}function S(e,t){let n=b.get(e),r=t.toLowerCase();return x(n)?n?.values?n.values.find(e=>e.toLowerCase()===r):t:v.has(r)?!0:y.has(r)?!1:t}function C(){if(typeof window<`u`&&window.__VELLUM_FLAG_OVERRIDES__!=null)return{...window.__VELLUM_FLAG_OVERRIDES__};let e={},t={BASE_URL:`/assistant/`,DEV:!1,MODE:`production`,PROD:!0,SSR:!1,VITE_PLATFORM_MODE:`false`};for(let n of Object.keys(t))if(n.startsWith(g)){let r=_(n.slice(17)),i=t[n];if(i!=null){let t=S(r,i);t!==void 0&&(e[r]=t)}}return e}var w=null;function T(){return w===null&&(w=C()),w}function E(e){let n=T(),r={},i={};for(let[a,o]of Object.entries(n)){let n=b.get(a);if(!n||!t(n.scope,e))continue;let s=p(a);if(x(n)){let e=typeof o==`string`?o:o?`on`:`off`;(typeof o==`string`||n.values?.includes(e))&&(i[s]=e)}else typeof o==`boolean`?r[s]=o:i[s]=o}return{bool:r,str:i}}export{p as a,h as c,l as i,t as l,u as n,n as o,s as r,E as s,c as t,m as u};
|