@datalayer/agent-runtimes 1.6.94 → 1.6.95
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-embed/chunks/{ChatView-Cc1GECus.js → ChatView-C8fvqoAH.js} +3 -3
- package/dist-embed/chunks/{SignInIcon-CyBylBLB.js → SignInIcon-DbPUIFJ3.js} +1 -1
- package/dist-embed/chunks/{index.esm-Ch767ax2.js → index.esm-DGPDabeX.js} +1 -1
- package/dist-embed/datalayer-app-main.js +25 -21
- package/lib/chat/prompt/menus/EquipmentMenus.js +5 -2
- package/lib/specs/actions.js +95 -4
- package/lib/specs/agents/agents.js +8 -3
- package/lib/specs/apps.d.ts +6 -6
- package/lib/specs/apps.js +176 -89
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{ad as K,fn as ho,r as o,j as t,ht as xo,hu as bo,cn as ps,B as h,H as It,T as $,v as q,dD as un,fD as bn,hv as ce,a6 as Rt,y as vo,hw as So,aD as yo,fe as jo,hx as Co,be as ko,hy as wo,hz as To,hA as Io,hB as Ro,hC as Eo,hD as Ao,hE as Ts,f6 as Is,f4 as $o,dz as Mo,f7 as vn,hF as
|
|
1
|
+
import{ad as K,fn as ho,r as o,j as t,ht as xo,hu as bo,cn as ps,B as h,H as It,T as $,v as q,dD as un,fD as bn,hv as ce,a6 as Rt,y as vo,hw as So,aD as yo,fe as jo,hx as Co,be as ko,hy as wo,hz as To,hA as Io,hB as Ro,hC as Eo,hD as Ao,hE as Ts,f6 as Is,f4 as $o,dz as Mo,f7 as vn,hF as Oo,hG as Po,hH as Uo,hI as ms,hJ as Lo,hK as Rs,fX as _o,fB as Fo,dF as Ge,fK as zo,bx as te,hL as Bo,hM as Es,hN as As,hO as No,L as Vo,hP as Do,I as $s,hs as Ho,D as Ms,hQ as gs,hR as Wo,hS as Go,E as Ko,cM as qo,hT as Yo,hU as Jo,hV as Qo,hW as Xo,hX as Zo,hY as ea,a8 as fn,hZ as ta,h_ as na,h$ as sa,i0 as oa,i1 as aa,i2 as ia,i3 as ra,i4 as la,i5 as ca,i6 as da,i7 as ua,i8 as fa,i9 as pa,ia as ma,ib as ga,ic as ha,id as xa,ie as ba,ig as va,ih as Sa,ii as ya,ij as dt,ik as ja,il as Ca,im as ka,io as wa,ip as hs,iq as Ta,ir as We,is as Ia,it as Ra,cN as ct,iu as Ea,iv as Aa,iw as xs,ix as $a,iy as Ma,iz as Oa,iA as Pa,iB as Ua,iC as La,iD as _a,iE as Fa,iF as za,fN as Ba,iG as Et,iH as Ce,iI as Na,iJ as Va,iK as Da,iL as Ha,iM as bs,iN as Wa,iO as Ga,iP as Ka,iQ as qa,iR as Ya,iS as Ja,iT as Qa,iU as Xa,iV as Za,iW as ei,iX as ti,iY as ni,iZ as At,i_ as si,i$ as oi,j0 as ai,j1 as ii,j2 as ri,j3 as li,j4 as ci,j5 as vs,j6 as di,j7 as ui,j8 as fi,j9 as pi,ja as mi,jb as Sn,jc as gi,jd as hi,ft as pn,je as xi}from"../datalayer-app-main.js";import{S as bi,E as vi,a as Si,M as yi}from"./SignInIcon-DbPUIFJ3.js";import{F as ji,a as Ci,b as ki}from"./LinkedInGreyIcon-eBP5iBjI.js";function Os(){const e=K(ho);return o.useMemo(()=>e.map(s=>s.value),[e])}const mn={github:{name:"github",oauth2CallbackServerRoute:"jupyter_iam/oauth2/callback",oauth2CallbackUIRoute:"/iam/oauth2/github/callback"},google:{name:"google",oauth2CallbackServerRoute:"jupyter_iam/oauth2/callback",oauth2CallbackUIRoute:"/iam/oauth2/google/callback"},linkedin:{name:"linkedin",oauth2CallbackServerRoute:"jupyter_iam/oauth2/callback",oauth2CallbackUIRoute:"/iam/oauth2/linkedin/callback"}},Ss=()=>{if(typeof document>"u")return"";const e=document.getElementById("datalayer-config-data");if(!e?.textContent)return"";try{const s=JSON.parse(e.textContent);return String(s?.iamUrl||"").replace(/\/$/,"")}catch{return""}},wi=(e,s="Unable to start social sign-in.")=>{if(e instanceof Error&&e.message)return e.message;if(typeof e=="string"&&e.trim())return e;if(e&&typeof e=="object"&&"message"in e){const a=e.message;if(typeof a=="string"&&a.trim())return a}return s},Ti=Co`
|
|
2
2
|
.signin-input-theme-scope input:-webkit-autofill,
|
|
3
3
|
.signin-input-theme-scope input:-webkit-autofill:hover,
|
|
4
4
|
.signin-input-theme-scope input:-webkit-autofill:focus,
|
|
@@ -25,8 +25,8 @@ import{ad as K,fn as ho,r as o,j as t,ht as xo,hu as bo,cn as ps,B as h,H as It,
|
|
|
25
25
|
background-color: var(--bgColor-default) !important;
|
|
26
26
|
opacity: 1 !important;
|
|
27
27
|
}
|
|
28
|
-
`,Ii=({onSignIn:e,onApiKeySignIn:s,loginUrl:a,name:i,title:c="Datalayer OTEL",description:u="Sign in to access the observability dashboard.",icon:x,leadingIcon:l=t.jsx(jo,{size:24}),github:f=!1,google:v=!1,linkedin:m=!1,apiKey:p=!1,signUp:V=!0,socialSignInNavigationTarget:M,asDoc:y=!1,fillHeight:k=!0,hideHero:P=!1,calloutTitle:I,calloutDescription:oe,passwordToggleLabel:ke="Sign in with a password",signUpTitle:z="Don't have an account?",signUpDescription:$t="Create a free Datalayer account with your email address.",signUpLabel:Mt="Sign up with email",signUpHref:Pt="https://datalayer.ai/signup",onSignUp:ue,forgotPasswordHref:we="/password",forgotPasswordLabel:fe="Forgot password?",showForgotPassword:Ot=!0,socialButtonMarginTop:Ue=3,actionButtonMaxWidth:W=320})=>{const Se=y&&!P,Ke=i??(y&&c==="Datalayer OTEL"?"Datalayer Sign In":c),Ut=x??(y?t.jsx(bi,{size:24}):l),j=o.useMemo(()=>{if(a)return a;const g=Ss();return g?`${g}/api/iam/v1/login`:"/api/iam/v1/login"},[a]),[ne,ut]=o.useState(""),[ye,Lt]=o.useState(""),[L,_t]=o.useState(!1),[pe,Ft]=o.useState(!1),[O,Le]=o.useState(!1),[Te,ft]=o.useState(!1),[me,qe]=o.useState(null),[Y,pt]=o.useState(null),[Ie,zt]=o.useState(""),[Re,Bt]=o.useState(null),[mt,ae]=o.useState(null),{enqueueToast:ge}=xo(),[_e,Ye]=o.useState(!1),[he,Ee]=o.useState(""),Je=o.useRef(null),Qe=o.useCallback(g=>bo()?ps.URLExt.join(ps.PageConfig.getBaseUrl(),g.oauth2CallbackServerRoute):`${window.location.protocol}//${window.location.hostname}${window.location.port?`:${window.location.port}`:""}${g.oauth2CallbackUIRoute}`,[]),ie=o.useMemo(()=>{if(typeof window>"u")return"/";const g=`${window.location.pathname}${window.location.search}${window.location.hash}`;return g.startsWith("/")?g:"/"},[]),Fe=o.useCallback(async g=>{if(!Te){ae(null),qe(g.name),ft(!0);try{const U=Ss(),J=new URLSearchParams({provider:g.name,callback_uri:Qe(g)}),Q=M===void 0?void 0:String(M||"").trim(),et=Q===void 0?ie&&ie!=="/"?ie:void 0:Q&&Q.startsWith("/")&&!Q.startsWith("//")?Q:void 0;et&&J.set("post_auth_redirect",et);const E=`${U||""}/api/iam/v1/oauth2/authz/url?${J.toString()}`,F=await fetch(E),T=await F.json(),xe=T?.autorization_url;if(!F.ok||!xe)throw new Error(T?.message||"Unable to start social sign-in.");window.location.assign(xe)}catch(U){const J=wi(U);ae(J),ge(J,{variant:"error"}),qe(null),ft(!1)}}},[Qe,ie,ge,Te,M]);o.useEffect(()=>{_e&&Je.current?.focus()},[_e]);const re=o.useCallback(()=>{Ye(!1),Ee("")},[]),_=o.useCallback(()=>{!he.trim()||!s||(s(he.trim()),re())},[he,s,re]),Xe=o.useCallback(()=>{if(ue){ue();return}window.location.assign(Pt)},[ue,Pt]),Ae=o.useCallback(()=>{if(we){if(we.startsWith("http://")||we.startsWith("https://")){window.open(we,"_blank","noopener,noreferrer");return}window.location.assign(we)}},[we]),ze=o.useCallback(async()=>{if(!(y||!ne||!ye||O)){Le(!0),ae(null);try{const g=await fetch(j,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({handle:ne,password:ye})});if(!g.ok)throw new Error(`HTTP ${g.status}`);const U=await g.json();if(U.success&&U.token){const J=String(U?.user?.id||U?.user?.uid||"").trim();if(!!U?.user?.mfaUrl&&J){pt(J),Bt(U.token),ae(null);return}e&&e(U.token,ne)}else ae(U.message||"Invalid username or password.")}catch(g){ae(g instanceof Error?g.message:String(g))}finally{Le(!1)}}},[y,ne,ye,O,j,e]),Be=o.useCallback(async()=>{if(!(y||O||!Y||!Ie.trim()||!Re)){Le(!0),ae(null);try{const g=new URL(j,window.location.origin),U=g.pathname.endsWith("/api/iam/v1/login")?g.href.replace(/\/api\/iam\/v1\/login$/,""):`${g.origin}`,J=await fetch(`${U}/api/iam/v1/users/${Y}/mfa/validate`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({userUid:Y,code:Ie.trim()})}),Q=await J.json();if(!J.ok||!Q?.success)throw new Error(Q?.message||"Failed to validate your MFA code.");e&&e(Re,ne)}catch(g){const U=g instanceof Error?g.message:String(g);ae(U),ge(U,{variant:"error"})}finally{Le(!1)}}},[y,ge,ne,O,j,Ie,Re,Y,e]),Z=o.useCallback(g=>{g.key==="Enter"&&(Y?Be():ze())},[Y,ze,Be]),Ze=Te||O||y;return t.jsxs(h,{className:"signin-input-theme-scope",display:"flex",alignItems:P||Se||!k?"flex-start":"center",justifyContent:"center",minHeight:P||Se||!k?"auto":"100vh",bg:P?"transparent":"canvas.default",color:"fg.default",py:P?0:Se?2:4,children:[t.jsx(Ti,{}),t.jsxs(h,{width:"100%",maxWidth:440,p:0,children:[!P&&t.jsxs(t.Fragment,{children:[t.jsxs(h,{display:"flex",alignItems:"center",gap:2,mb:Se?2:3,justifyContent:"center",children:[Ut,t.jsx(It,{sx:{fontSize:3},children:Ke})]}),t.jsx($,{as:"p",sx:{fontSize:1,color:"fg.muted",mb:Se?2:3,textAlign:"center"},children:u})]}),(I||oe)&&t.jsxs(h,{mb:3,textAlign:"center",children:[I&&t.jsx(It,{as:"h3",sx:{fontSize:2,mb:1},children:I}),oe&&t.jsx($,{sx:{color:"fg.muted",fontSize:1},children:oe})]}),!Y&&(f||v||m)&&t.jsxs(t.Fragment,{children:[f&&t.jsx(q,{block:!0,size:"large",leadingVisual:me==="github"?()=>t.jsx(un,{size:"small"}):ji,disabled:Ze,onClick:()=>Fe(mn.github),sx:{mt:Ue,maxWidth:W,mx:"auto"},children:"Sign in with GitHub"}),v&&t.jsx(q,{block:!0,size:"large",leadingVisual:me==="google"?()=>t.jsx(un,{size:"small"}):Ci,disabled:Ze,onClick:()=>Fe(mn.google),sx:{mt:Ue,maxWidth:W,mx:"auto"},children:"Sign in with Google"}),m&&t.jsx(q,{block:!0,size:"large",leadingVisual:me==="linkedin"?()=>t.jsx(un,{size:"small"}):ki,disabled:Ze,onClick:()=>Fe(mn.linkedin),sx:{mt:Ue,maxWidth:W,mx:"auto"},children:"Sign in with LinkedIn"})]}),!Y&&!L&&t.jsx(h,{mt:3,display:"flex",justifyContent:"center",children:t.jsx(q,{leadingVisual:bn,size:"large",block:!0,disabled:y||O||Te,onClick:()=>_t(!0),sx:{maxWidth:W,mx:"auto"},children:ke})}),!Y&&L&&t.jsxs(h,{mt:4,children:[t.jsxs(ce,{required:!0,sx:{mb:3},children:[t.jsx(ce.Label,{children:"Username"}),t.jsx(Rt,{autoFocus:!0,block:!0,placeholder:"Your username",value:ne,disabled:O||y,onChange:g=>ut(g.target.value),onKeyDown:Z})]}),t.jsxs(ce,{required:!0,sx:{mb:3},children:[t.jsx(ce.Label,{children:"Password"}),t.jsx(Rt,{block:!0,placeholder:"Your password",type:pe?"text":"password",value:ye,disabled:O||y,onChange:g=>Lt(g.target.value),onKeyDown:Z,trailingAction:t.jsx(Rt.Action,{onClick:()=>Ft(!pe),disabled:O||y,icon:pe?vi:Si,"aria-label":pe?"Hide password":"Show password",sx:{color:"var(--fgColor-muted)"}})})]}),t.jsxs(h,{display:"flex",alignItems:"center",justifyContent:"space-between",mt:3,children:[t.jsx(q,{variant:"primary",disabled:O||y||!ne||!ye,onClick:ze,children:O?"Signing in…":"Sign In"}),Ot&&t.jsx(vo,{as:"button",sx:{fontSize:1,cursor:y?"not-allowed":"pointer",background:"none",border:"none",opacity:y?.6:1},onClick:()=>{y||O||Ae()},children:fe})]})]}),Y&&t.jsxs(t.Fragment,{children:[t.jsxs(ce,{required:!0,sx:{mb:3,mt:2},children:[t.jsx(ce.Label,{children:"MFA Code"}),t.jsx(Rt,{autoFocus:!0,block:!0,placeholder:"Your MFA code",value:Ie,disabled:O||y,onChange:g=>zt(g.target.value),onKeyDown:Z})]}),t.jsx(q,{variant:"primary",block:!0,disabled:O||y||!Ie.trim(),onClick:Be,sx:{maxWidth:W,mx:"auto"},children:O?"Validating…":"Validate MFA Code"})]}),mt&&t.jsx($,{sx:{color:"danger.fg",fontSize:1,mt:3,display:"block"},children:mt}),V&&t.jsxs(h,{mt:4,pt:4,textAlign:"center",borderTop:"1px solid",borderColor:"border.muted",children:[t.jsx(It,{as:"h3",sx:{fontSize:2,mb:2},children:z}),t.jsx($,{as:"p",sx:{color:"fg.muted",fontSize:1,mb:3},children:$t}),t.jsx(h,{display:"flex",justifyContent:"center",children:t.jsx(q,{variant:"primary",size:"large",leadingVisual:So,disabled:y||O,onClick:Xe,children:Mt})})]}),p&&s&&t.jsxs(t.Fragment,{children:[t.jsxs(h,{display:"flex",alignItems:"center",gap:2,my:3,children:[t.jsx(h,{flex:1,height:"1px",bg:"border.default"}),t.jsx($,{sx:{fontSize:0,color:"fg.muted"},children:"or"}),t.jsx(h,{flex:1,height:"1px",bg:"border.default"})]}),t.jsx(q,{block:!0,leadingVisual:bn,disabled:y||O||Te,onClick:()=>Ye(!0),sx:{maxWidth:W,mx:"auto"},children:"Sign in with an API Key"}),_e&&t.jsx(h,{role:"dialog","aria-modal":"true","aria-labelledby":"signin-api-key-title",onKeyDown:g=>{g.key==="Escape"&&re()},onClick:re,position:"fixed",inset:0,zIndex:200,p:3,bg:"canvas.backdrop",display:"flex",alignItems:"center",justifyContent:"center",children:t.jsxs(h,{as:"form",onClick:g=>g.stopPropagation(),onSubmit:g=>{g.preventDefault(),_()},width:"min(560px, 100%)",p:3,borderRadius:2,border:"1px solid",borderColor:"border.default",bg:"canvas.overlay",color:"fg.default",boxShadow:"shadow.large",children:[t.jsx(It,{id:"signin-api-key-title",sx:{fontSize:2,mb:2},children:"Enter your API Key"}),t.jsxs(ce,{required:!0,children:[t.jsx(ce.Label,{children:"API Key"}),t.jsx(yo,{block:!0,required:!0,autoFocus:!0,placeholder:"Paste your API key here",value:he,onInput:g=>Ee(g.currentTarget.value),ref:Je})]}),t.jsxs(h,{mt:3,display:"flex",justifyContent:"flex-end",gap:2,children:[t.jsx(q,{type:"button",onClick:re,children:"Cancel"}),t.jsx(q,{type:"submit",variant:"primary",disabled:!he.trim(),children:"Authenticate"})]})]})})]})]})]})},ys=ko((e,s)=>({pending:void 0,suggest:(a,i)=>{const c=a.trim();c&&e({pending:{text:c,submit:i?.submit??!1,nonce:(s().pending?.nonce??0)+1}})},consume:()=>e({pending:void 0})}));function Ri(e){const{agentId:s,instructions:a,model:i,frontendTools:c,inference:u,subagents:x,sharing:l,onSubagentEvent:f,modeEffect:v}=e;return{type:"browser-vercel-ai",endpoint:"",agentId:s,enableConfigQuery:!1,options:{instructions:a,model:i,frontendTools:c,inference:u,subagents:x,sharing:l,onSubagentEvent:f,modeEffect:v}}}const Ei=({state:e})=>wo[e];class Ai extends Error{constructor(s,a){super(a),this.status=s,this.name="RuntimeRefusal"}status}function $i({baseUrl:e,getAccessToken:s,fetch:a}){const i=e.replace(/\/+$/,""),c=(f={})=>{const v=s();return{...f,...v?{Authorization:`Bearer ${v}`}:{}}},u=async f=>{throw new Ai(f.status,Ro(f.status,f.statusText,await Eo(f)))};return{json:async(f,v="GET",m)=>{const p=await a(`${i}${f}`,{method:v,headers:c({Accept:"application/json",...m===void 0?{}:{"Content-Type":"application/json"}}),...m===void 0?{}:{body:JSON.stringify(m)}});return p.ok?await p.json():u(p)},stream:async(f,v,{onEvent:m,signal:p},V="POST")=>{const M=await a(`${i}${f}`,{method:V,headers:c({"Content-Type":"application/json",Accept:"text/event-stream"}),body:JSON.stringify(v),signal:p});if(!M.ok)return u(M);await Ao(M,m)},refused:u,headers:c,root:i,fetcher:a}}const X=e=>`/api/v1/apps/sessions/${encodeURIComponent(e)}`;function Mi(e){const{json:s,stream:a,fetcher:i,headers:c,refused:u,root:x}=$i(e);return{serverUrl:x,accessToken:()=>e.getAccessToken(),start:(l,f)=>a("/api/v1/apps/sessions",{agent:l.agent,...l.deploymentUid?{deployment_uid:l.deploymentUid}:{},...l.appUid?{app_uid:l.appUid}:{},...l.version?{version:l.version}:{},...l.session?{session:l.session}:{},opener:l.opener},f),message:(l,f,v)=>a(`${X(l)}/messages`,{text:f},v),changeSettings:(l,f,v)=>a(`${X(l)}/settings`,{values:f},v,"PUT"),resume:(l,f,v)=>a(`${X(l)}/resume`,{agent:f},v),stop:l=>s(`${X(l)}/stop`,"POST"),end:l=>s(`${X(l)}/end`,"POST"),describe:l=>s(X(l)),described:async l=>Io(await s(X(l))),list:(l={})=>{const f=new URLSearchParams;for(const[m,p]of Object.entries(l))p!==""&&p!==void 0&&p!==!1&&f.set(m,String(p));const v=f.toString();return s(`/api/v1/apps/sessions${v?`?${v}`:""}`)},swap:(l,f)=>s(`${X(l)}/agent`,"POST",{agent:f}),clone:(l,f={})=>s(`${X(l)}/clone`,"POST",{up_to_turn:f.upToTurn??null,agent:f.agent??null,title:f.title??""}),exportFile:async(l,f="")=>{const v=await i(`${x}${X(l)}/export${f?`?format=${encodeURIComponent(f)}`:""}`,{method:"GET",headers:c()});return v.ok?v.text():u(v)},importFile:async(l,f={})=>{const v=new URLSearchParams;f.agent&&v.set("agent",f.agent),f.format&&v.set("format",f.format);const m=v.toString(),p=await i(`${x}/api/v1/apps/sessions/import${m?`?${m}`:""}`,{method:"POST",headers:c({"Content-Type":"application/x-ndjson"}),body:l});return p.ok?await p.json():u(p)},rename:(l,f)=>s(`${X(l)}/title`,"PUT",{title:f}),archive:(l,f)=>s(`${X(l)}/archived`,"PUT",{archived:f}),messages:async l=>To((await s(`${X(l)}/messages`)).messages)}}const de="";function Pi(e){return{surfaceId:!e||e===Ts?de:e,suspendedId:null}}function Oi({agentName:e,sandboxStillRuns:s=!1,temporary:a=!0,onSignedIn:i,onSignUp:c}){const{configuration:u}=Is(),x=o.useCallback(l=>{$o.getState().checkIAMToken(l),i?.()},[i]);return t.jsx(h,{height:"100%",minHeight:0,overflowY:"auto",bg:"canvas.default",px:4,py:4,children:t.jsxs(h,{maxWidth:440,mx:"auto",children:[t.jsxs(h,{display:"flex",alignItems:"center",justifyContent:"center",gap:2,color:"attention.fg",mb:2,children:[t.jsx(bn,{size:20}),t.jsx($,{sx:{fontSize:2,fontWeight:"semibold",color:"fg.default"},children:a?"This demo runs on a shared key":"Your key has expired"})]}),t.jsxs($,{as:"p",sx:{fontSize:1,color:"fg.muted",textAlign:"center",mb:3},children:[a?`${e??"The agent"} has used the time this key allows. Sign in to point your own agent at it, use your own data, and drop the time limit.`:`${e??"The agent"} stopped because your session ran out.`,s?" Your notebook is still running in this page.":""]}),a&&t.jsxs(h,{display:"flex",flexDirection:"column",alignItems:"center",gap:2,mb:3,"data-anonymous-key-refresh":"",children:[t.jsx($,{sx:{fontSize:1,color:"fg.muted",textAlign:"center"},children:"Or keep trying without an account: refreshing the page gives this demo a new key, and starts the conversation over."}),t.jsx(q,{leadingVisual:Mo,onClick:()=>{typeof window<"u"&&window.location.reload()},children:"Refresh the page for a new key"})]}),t.jsx(Ii,{hideHero:!0,fillHeight:!1,calloutTitle:"Sign in to keep going",github:!0,google:!0,linkedin:!0,socialSignInNavigationTarget:typeof window>"u"?void 0:`${window.location.pathname}${window.location.search}`,loginUrl:u?.iamUrl?`${u.iamUrl}/api/iam/v1/login`:void 0,onSignIn:x,onSignUp:c})]})})}const Ui="https://r1.datalayer.run";function Li(e=!0,s=""){const{configuration:a}=Is(),i=vn(f=>f.token),c=a?.aiInferenceUrl||Ui,u=Po(c,e&&!i,s),x=i||u.token,l=o.useMemo(()=>({inferenceUrl:c,token:x||void 0}),[c,x]);return{inference:l,needsSignIn:Oo(l),anonymous:u,inferenceUrl:c}}const _i={name:"general-purpose",description:"A capable generalist for a task none of the specialists covers: research, reasoning, drafting, checking.",instructions:"You are a capable general-purpose assistant. Carry out the task you are given completely and report the result plainly, saying what you could not do."};function js(e){const s=e?.subagents;if(!s)return[];const a=(s.subagents??[]).map(i=>{const c=i.ref?Uo(i.ref):void 0;return{name:i.name,description:i.description||c?.description||i.name,instructions:i.instructions??c?.systemPrompt,model:i.model??c?.model??s.defaultModel,icon:c?.icon}});return s.includeGeneralPurpose?[...a,_i]:a}const Os=e=>e.replace(/\/+$/,""),Fi=e=>e.split(":")[0];function zi(e,s){return`${Os(e)}/api/v1/apps/agents/${encodeURIComponent(s)}/equipment`}function Bi(e,s){return`${Os(e)}/api/v1/configure/models?agent_id=${encodeURIComponent(s)}`}const Ni=["started","starting","failed","not_started","left_out"],gn=e=>Array.isArray(e)?e.filter(s=>typeof s=="string"):[];function Vi(e){const s=e??{};return{servers:(s.mcp_servers??[]).map(a=>({id:String(a.id??""),name:String(a.name??a.id??""),optional:a.optional===!0,state:Ni.includes(a.state)?a.state:"not_started",...typeof a.reason=="string"&&a.reason?{reason:a.reason}:{},missingEnvVars:gn(a.missing_env_vars),...typeof a.tools=="number"?{tools:a.tools}:{}})),skills:(s.skills??[]).map(a=>({id:String(a.id??""),name:String(a.name??a.id??""),description:String(a.description??""),optional:a.optional===!0,state:a.state==="not_activated"?"not_activated":"active",...typeof a.reason=="string"&&a.reason?{reason:a.reason}:{},missingEnvVars:gn(a.missing_env_vars),oneOfEnvVars:gn(a.one_of_env_vars)}))}}function Di(e){const s=e?ms[e]??ms[Fi(e)]:void 0,a=new Set(s?.optional?.mcpServers??[]),i=new Set(s?.optional?.skills??[]),c=s?[s.model,...s.modelAdditionals??[]].filter(u=>!!u):[];return{source:"declared",modelsSource:"declared",servers:(s?.mcpServers??[]).filter(Boolean).map(u=>({id:u.id,name:u.name||u.id,optional:a.has(u.id),missingEnvVars:[]})),skills:(s?.skills??[]).filter(Boolean).map(u=>({id:u.id,name:u.name||u.id,description:u.description??"",optional:i.has(u.id),missingEnvVars:[],oneOfEnvVars:[]})),models:[...new Set(c)].map((u,x)=>({id:u,name:Lo(u)?.name??u,current:x===0}))}}function Hi(e,s){const a=Rs(e),i=a.find(c=>c.id===s)?.id??a.find(c=>c.isAvailable!==!1)?.id;return a.map(c=>({...c,current:c.id===i}))}function Wi({agentServerUrl:e,agentId:s,token:a,specId:i,model:c,enabled:u,refreshMs:x=3e4}){const l=o.useMemo(()=>Di(i),[i]),[f,v]=o.useState(),[m,p]=o.useState();return o.useEffect(()=>{if(v(void 0),p(void 0),!u||!e||!s)return;let V=new AbortController;const M=a?{Authorization:`Bearer ${a}`}:{},y=()=>{V.abort(),V=new AbortController;const{signal:P}=V;fetch(zi(e,s),{headers:M,signal:P}).then(I=>I.ok?I.json():null).then(I=>{!P.aborted&&I&&v(Vi(I))}).catch(()=>{}),fetch(Bi(e,s),{headers:M,signal:P}).then(I=>I.ok?I.json():null).then(I=>{if(!P.aborted&&I){const oe=Hi(I,c);p(oe.some(ke=>ke.isAvailable!==!1)?oe:void 0)}}).catch(()=>{})};y();const k=setInterval(y,x);return()=>{clearInterval(k),V.abort()}},[u,e,s,a,c,x]),o.useMemo(()=>({source:f?"live":"declared",servers:f?.servers??l.servers,skills:f?.skills??l.skills,modelsSource:m&&m.length>0?"live":"declared",models:m&&m.length>0?m:l.models}),[f,m,l])}const N={readOnly:"Chosen by the application. Shown for you to read: nothing here changes it.",declared:"As its spec declares them: its runtime has not said their state yet.",model:"Model",servers:"MCP servers",skills:"Skills",none:{servers:"It uses no MCP server.",skills:"It has no skill."},optional:"optional",serverState:{started:"Running",starting:"Starting",failed:"Failed",not_started:"Not started",left_out:"Off"},skillState:{active:"Active",not_activated:"Not activated"},modelState:{current:"In use",available:"Available",off:"Not available"},declaredState:"Declared"},Gi={success:{fg:"success.fg",bg:"success.subtle"},attention:{fg:"attention.fg",bg:"attention.subtle"},danger:{fg:"danger.fg",bg:"danger.subtle"},accent:{fg:"accent.fg",bg:"accent.subtle"},neutral:{fg:"fg.muted",bg:"neutral.subtle"}};function Ki(e){const s=N.serverState,a=e.state;return{id:e.id,name:e.name,state:a?s[a]:N.declaredState,tone:a==="started"?"success":a==="failed"?"danger":a==="starting"?"attention":"neutral",on:a==="started",...e.reason?{reason:e.reason}:{},...a==="started"&&e.tools!==void 0?{note:`${e.tools} ${e.tools===1?"tool":"tools"}`}:e.optional?{note:N.optional}:{}}}function qi(e){const s=e.state;return{id:e.id,name:e.name,state:s?N.skillState[s]:N.declaredState,tone:s==="active"?"success":"neutral",on:s==="active",...e.reason?{reason:e.reason}:{},...e.optional?{note:N.optional}:{}}}function Yi(e){const s=e.isAvailable===!1;return{id:e.id,name:e.name,state:e.current?N.modelState.current:s?N.modelState.off:N.modelState.available,tone:e.current?"accent":s?"neutral":"success",on:!s,...s&&e.unavailableReason?{reason:e.unavailableReason}:{}}}function Ji(e){return[e.name,e.state,e.reason,e.note].filter(Boolean).join(", ")}function hn({kind:e,icon:s,title:a,rows:i,count:c,summary:u,empty:x,declared:l=!1,align:f="start"}){const v=`${a} — ${u}`;return t.jsxs(Ge,{children:[t.jsx(Ge.Anchor,{children:t.jsx(zo,{text:v,direction:"n",children:t.jsx(q,{type:"button",variant:"invisible",size:"small","aria-label":v,leadingVisual:s,"data-equipment-menu":e,"data-equipment-source":l?"declared":"live",children:t.jsx($,{sx:{fontSize:0,fontVariantNumeric:"tabular-nums",maxWidth:160,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",display:"inline-block",verticalAlign:"bottom",...e==="model"?{"@media (max-width: 480px)":{display:"none"}}:{}},children:c})})})}),t.jsx(Ge.Overlay,{side:"outside-top",align:f,width:"medium",children:t.jsxs(h,{maxHeight:"60vh",overflowY:"auto",children:[t.jsx(te,{"aria-label":a,children:t.jsxs(te.Group,{children:[t.jsxs(te.GroupHeading,{children:[a,i.length>0?` · ${u}`:""]}),i.length===0?t.jsx(te.Item,{onSelect:m=>m.preventDefault(),sx:{color:"fg.muted"},children:x}):i.map(m=>{const p=Gi[m.tone];return t.jsxs(te.Item,{onSelect:V=>V.preventDefault(),"aria-label":Ji(m),"data-equipment-row":m.id,"data-equipment-on":m.on?"true":"false",sx:m.on?void 0:{color:"fg.muted"},children:[m.name,t.jsx(te.TrailingVisual,{children:t.jsx($,{sx:{fontSize:"11px",px:"6px",py:"1px",borderRadius:999,bg:p.bg,color:p.fg,whiteSpace:"nowrap"},children:m.state})}),m.reason||m.note?t.jsx(te.Description,{variant:"block",children:[m.reason,m.note].filter(Boolean).join(" · ")}):null]},m.id)})]})}),t.jsxs(h,{px:3,py:2,borderTop:"1px solid",borderColor:"border.muted","data-equipment-note":"",children:[t.jsx($,{sx:{fontSize:0,color:"fg.muted",display:"block"},children:N.readOnly}),l?t.jsx($,{sx:{fontSize:0,color:"fg.muted",display:"block"},children:N.declared}):null]})]})})]})}const Cs=(e,s,a)=>a?String(s):`${e}/${s}`;function Qi({equipment:e}){const s=e.source==="declared",a=e.servers.map(Ki),i=e.skills.map(qi),c=e.models.map(Yi),u=a.filter(f=>f.on).length,x=i.filter(f=>f.on).length,l=e.models.find(f=>f.current);return t.jsxs(h,{display:"inline-flex",alignItems:"center",role:"group","aria-label":"What this application runs with","data-equipment-bar":e.source,children:[t.jsx(hn,{kind:"servers",icon:yi,title:N.servers,rows:a,count:Cs(u,a.length,s),summary:a.length===0?"none":s?`${a.length} declared`:`${u} of ${a.length} running`,empty:N.none.servers,declared:s}),t.jsx(hn,{kind:"skills",icon:_o,title:N.skills,rows:i,count:Cs(x,i.length,s),summary:i.length===0?"none":s?`${i.length} declared`:`${x} of ${i.length} active`,empty:N.none.skills,declared:s}),c.length>0?t.jsx(hn,{kind:"model",icon:Fo,title:N.model,rows:c,count:l?.name??String(c.length),summary:l?`${l.name}, of ${c.length} it may run on`:`${c.length} it may run on`,declared:e.modelsSource==="declared",align:"end"}):null]})}function Xi(e){return e.replace(/^datalayer_/,"").replace(/_lexical$/,"")}function Zi(e){const s=Xi(e);return/^executeCodeIn(Notebook|Document)$/.test(s)||/^(read|list)[A-Z]/.test(s)}function er(e,s){return e.filter(a=>s?.has(a.name)||Zi(a.name))}function tr(e,s){const a=i=>s&&i.value.id===`${s}-tools`?0:i.value.id==="notebook-tools"?1:2;return e.map((i,c)=>({entry:i,index:c,rank:a(i)})).sort((i,c)=>i.rank-c.rank||i.index-c.index).map(i=>i.entry)}function nr(e,s,a){if(!a||!e.endsWith("-tools"))return!1;const i=e.slice(0,-6);return s.has(i)&&i!==a}const sr={type:"object",properties:{}};function or(e,s){const a=new Set(e.toolset);return e.commands.filter(i=>a.has(i.name)).map(i=>({name:i.name,description:i.description,parameters:i.parameters??sr,location:"frontend",handler:async c=>{if(!s)throw new Error(`${i.name}: the ${e.plugin??e.id} plugin is not mounted on this page.`);const u=Object.keys(c??{}).length>0?c:void 0,x=await s.executeCommand(i.command,u);return x===void 0?{ok:!0,command:i.command,argument:u}:x}}))}function Us(e,s){return e.flatMap(a=>or(a,s))}function ar(){const e=Bo(),s=Ps();return o.useMemo(()=>Us(s,e),[s,e])}function ir(e){const s=e?.app_instance;if(!s||typeof s!="object")return"";const a=s.deployment_uid;return typeof a=="string"?a.trim():""}function rr(e,s,a){return e||!s?e:{id:a,messages:[]}}function lr(e){const s=(new URLSearchParams(e).get("session")??"").trim();if(!s)return"";if(!/^[A-Za-z0-9_-]{8,128}$/.test(s))throw new Error(`?session=${s} names no session: a session uid is 8 to 128 letters, digits, hyphens or underscores.`);return s}function cr({facts:e}){if(!e)return null;const s=No(e);return t.jsxs(h,{display:"inline-flex",alignItems:"center",gap:2,"data-session-state":e.state,children:[t.jsx(Vo,{size:"small",variant:e.state==="open"?"accent":e.state==="paused"?"attention":"secondary",children:Do(e)}),s?t.jsx($,{sx:{fontSize:0,color:"fg.muted"},"data-session-lineage":"",children:s}):null]})}function dr({facts:e,turn:s,context:a}){const i=K(Es),c=As(i,e,"turn");return!e||c.length===0||s<1?null:t.jsx(h,{display:"inline-flex",gap:1,"data-turn-actions":s,children:c.map(u=>t.jsx(q,{size:"small",variant:"invisible","data-turn-action":u.id,onClick:()=>{Promise.resolve(u.run(e,{...a,atTurn:s})).catch(x=>a.say(String(x.message??x)))},children:u.label},u.id))})}function ur({uid:e,describe:s,context:a}){const i=K(Es),[c,u]=o.useState(void 0),[x,l]=o.useState(!1),[f,v]=o.useState(""),[m,p]=o.useState(void 0),V={...a,show:a.show??p,say:k=>{v(k),a.say(k)}},M=o.useCallback(k=>{l(k),k&&e&&s(e).then(u,()=>u(void 0))},[s,e]);if(!e||i.length===0)return null;const y=As(i,c);return t.jsxs(t.Fragment,{children:[t.jsxs(Ge,{open:x,onOpenChange:M,children:[t.jsx(Ge.Anchor,{children:t.jsx($s,{icon:Ho,"aria-label":"Session actions",variant:"invisible",size:"small","data-testid":"session-actions"})}),t.jsx(Ge.Overlay,{width:"small",children:t.jsxs(te,{children:[y.length===0?t.jsx(te.Item,{disabled:!0,children:c?"Nothing applies to this session now.":"Reading the session…"}):y.map(k=>t.jsx(te.Item,{"data-session-action":k.id,onSelect:()=>{c&&Promise.resolve(k.run(c,V)).catch(P=>V.say(String(P.message??P)))},children:k.label},k.id)),f?t.jsxs(t.Fragment,{children:[t.jsx(te.Divider,{}),t.jsx(te.Item,{disabled:!0,"data-testid":"session-actions-said",children:f})]}):null]})})]}),m?t.jsx(Ms,{title:m.title,onClose:()=>p(void 0),width:"large",children:t.jsx(h,{"data-session-panel":"",children:m.render()})}):null]})}const ks={confirm:"Switch",cancel:"Keep it"};function fr({question:e,onPick:s}){const[a,i]=o.useState(e.options[0]?.id??""),[c,u]=o.useState("");o.useEffect(()=>{let l=!0;if(!e.says||!a){u("");return}return e.says(a).then(f=>l&&u(f),()=>l&&u("")),()=>{l=!1}},[a,e]);const x=e.options.find(l=>l.id===a);return t.jsx(Ms,{title:e.title,onClose:()=>s(void 0),width:"medium",footerButtons:[{buttonType:"default",content:ks.cancel,onClick:()=>s(void 0)},{buttonType:"primary",content:ks.confirm,disabled:!a,onClick:()=>s(a||void 0)}],children:t.jsxs(h,{display:"grid",gap:3,"data-session-choose":"",children:[t.jsxs(ce,{children:[t.jsx(ce.Label,{children:e.title}),t.jsx(gs,{value:a,onChange:l=>i(l.target.value),block:!0,children:e.options.map(l=>t.jsx(gs.Option,{value:l.id,children:l.label},l.id))})]}),x?.description?t.jsx($,{sx:{fontSize:1,color:"fg.muted"},children:x.description}):null,c?t.jsx($,{as:"p",sx:{m:0,fontSize:1,fontStyle:"italic"},"data-session-choose-says":"",children:c}):null]})})}const pr="var(--theme-accent)";function Ls({face:e,size:s}){return typeof e=="string"?t.jsx(Wo,{emoji:e,size:s,label:""}):t.jsx(t.Fragment,{children:e})}function mr({face:e,size:s,state:a}){const i=a==="thinking"||a==="working",c=a==="paused";return t.jsxs(h,{as:"span","aria-hidden":!0,"data-presence":a,position:"relative",display:"inline-flex",alignItems:"center",justifyContent:"center",width:s+8,height:s+8,flexShrink:0,fontSize:s,lineHeight:1,children:[t.jsx(h,{as:"span",position:"absolute",inset:0,borderRadius:"50%",boxShadow:c?"none":`0 0 0 2px ${pr}`,border:c?"2px dashed":"none",borderColor:"border.default",opacity:i||a==="waiting"||c?.9:0,transition:"opacity var(--theme-motion-status, 0ms) var(--theme-motion-easing, ease)",animation:i?"loopPresenceBreath 1.8s ease-in-out infinite":"none",reducedMotion:{animation:"none"},sx:{"@keyframes loopPresenceBreath":{"0%, 100%":{transform:"scale(0.92)",opacity:.35},"50%":{transform:"scale(1.06)",opacity:.9}}}}),t.jsx(h,{as:"span",display:"inline-flex",opacity:c?.55:1,filter:c?"grayscale(0.6)":"none",transition:"opacity var(--theme-motion-status, 0ms) var(--theme-motion-easing, ease)",children:t.jsx(Ls,{face:e,size:s})})]})}function gr({state:e}){return t.jsx($,{role:"status","aria-live":"polite","data-presence-line":e,sx:{fontSize:0,color:e==="waiting"?"fg.default":"fg.muted",fontWeight:e==="waiting"?"semibold":"normal",whiteSpace:"nowrap",flexShrink:0},children:Ei({state:e})})}const hr=Sn(void 0),xr=Sn(""),br=Sn({}),vr=1400,ws=parseInt(xi["--loop-face-large"],10),Sr={};function Tr({workspace:e}){const s=Go(),a=Ko(),i=o.useRef(null),c=o.useRef(void 0),{setViewControls:u}=e,x=o.useRef(e.setThread);x.current=e.setThread;const l=o.useCallback(()=>{const n=i.current?.thread();return n&&x.current?.(n),n},[]),[f,v]=o.useState(null),m=qo(),p=m.getConfig(Yo),V=p?.placeholder||s.placeholder,M=p?.defaultSurface??"notebook",y=m.getConfig(Jo),[k,P]=o.useState(de),[I,oe]=o.useState(null),ke=o.useRef(!1),z=K(Qo),$t=K(Xo),Mt=K(Zo),ue=K(ea)[0]?.value,fe=fn(ue?.promptStance??hr)??ue?.prompt,Ot=K(ta),Ue=na(Ot[0]?.value),W=o.useRef(Ue);W.current=Ue;const Se=o.useRef(""),Ke=K(sa),Ut=o.useMemo(()=>oa(()=>Ke.reduce((n,r)=>aa(n,r.value.extras.value),{})),[Ke]),j=fn(Ke.length>0?Ut:br),ne=o.useRef(new Set),ut=ia(gi,e),ye=!ut.allowed,Lt=ye?ut.reason??"Chat is unavailable for this sandbox":void 0,[L,_t]=o.useState(!1),[pe,Ft]=o.useState(!1),[O,Le]=o.useState(!1),[Te,ft]=o.useState({open:!1,pendingApproval:!1}),me=ra(L,Te,p?.presence?.paused===!0),qe=p?.presence?.onPresence;o.useEffect(()=>{qe?.(me),W.current?.setPresence(me)},[qe,me]);const Y=o.useRef(p?.presence?.onSaying);Y.current=p?.presence?.onSaying;const pt=o.useRef({answering:!1}),Ie=o.useCallback(n=>{i.current=n,Ft(!!n)},[]),zt=o.useCallback(n=>{const{open:r,pendingApproval:d}=la(n);ft(Oe=>Oe.open===r&&Oe.pendingApproval===d?Oe:{open:r,pendingApproval:d});const S={saying:da(n),answering:ca(n)},b=pt.current;(b.saying?.id!==S.saying?.id||b.saying?.text!==S.saying?.text||b.answering!==S.answering)&&(pt.current=S,Y.current?.(S));const ee=W.current;if(!ee)return;ee.items(n);const B=new Set(["complete","completed","done","error","failed","cancelled","canceled","rejected","denied","stopped"]),le={insertcell:"adding a cell",updatecell:"editing a cell",runcell:"running a cell",deletecells:"removing cells",readallcells:"reading the notebook",readcell:"reading a cell",executecode:"running code",insertblock:"adding a block",updateblock:"editing a block",runblock:"running a block",readdocument:"reading the document"};let C;for(let Oe=n.length-1;Oe>=0;Oe-=1){const Tt=n[Oe];if(typeof Tt.toolName=="string"&&Tt.toolCallId){B.has(String(Tt.status).toLowerCase())||(C=Tt);break}}if(!C){ee.activity(void 0);return}const Pe=C.toolName.toLowerCase().replace(/^datalayer_/,"").replace(/_lexical$/,"").replace(/[^a-z]/g,""),go=le[Pe]??`using ${C.toolName}`;ee.activity(`${Se.current||"The agent"} is ${go}…`)},[]),Re=o.useRef(j);Re.current=j;const Bt=o.useCallback(n=>{Ys(n),W.current?.usage(n),Re.current.onUsage?.(n)},[]),mt=o.useCallback(n=>{_t(n),n||W.current?.end("done")},[]),ae=o.useCallback(n=>{const r=W.current;if(!r)return;let d=-1;for(let b=n.length-1;b>=0;b-=1)if(n[b].role==="user"){d=b;break}const S=n.slice(d+1).filter(b=>b.role==="assistant").map(ua).filter(b=>b.trim().length>0).join(`
|
|
28
|
+
`,Ii=({onSignIn:e,onApiKeySignIn:s,loginUrl:a,name:i,title:c="Datalayer OTEL",description:u="Sign in to access the observability dashboard.",icon:x,leadingIcon:l=t.jsx(jo,{size:24}),github:f=!1,google:v=!1,linkedin:m=!1,apiKey:p=!1,signUp:V=!0,socialSignInNavigationTarget:M,asDoc:y=!1,fillHeight:k=!0,hideHero:O=!1,calloutTitle:I,calloutDescription:oe,passwordToggleLabel:ke="Sign in with a password",signUpTitle:z="Don't have an account?",signUpDescription:$t="Create a free Datalayer account with your email address.",signUpLabel:Mt="Sign up with email",signUpHref:Ot="https://datalayer.ai/signup",onSignUp:ue,forgotPasswordHref:we="/password",forgotPasswordLabel:fe="Forgot password?",showForgotPassword:Pt=!0,socialButtonMarginTop:Ue=3,actionButtonMaxWidth:W=320})=>{const Se=y&&!O,Ke=i??(y&&c==="Datalayer OTEL"?"Datalayer Sign In":c),Ut=x??(y?t.jsx(bi,{size:24}):l),j=o.useMemo(()=>{if(a)return a;const g=Ss();return g?`${g}/api/iam/v1/login`:"/api/iam/v1/login"},[a]),[ne,ut]=o.useState(""),[ye,Lt]=o.useState(""),[L,_t]=o.useState(!1),[pe,Ft]=o.useState(!1),[P,Le]=o.useState(!1),[Te,ft]=o.useState(!1),[me,qe]=o.useState(null),[Y,pt]=o.useState(null),[Ie,zt]=o.useState(""),[Re,Bt]=o.useState(null),[mt,ae]=o.useState(null),{enqueueToast:ge}=xo(),[_e,Ye]=o.useState(!1),[he,Ee]=o.useState(""),Je=o.useRef(null),Qe=o.useCallback(g=>bo()?ps.URLExt.join(ps.PageConfig.getBaseUrl(),g.oauth2CallbackServerRoute):`${window.location.protocol}//${window.location.hostname}${window.location.port?`:${window.location.port}`:""}${g.oauth2CallbackUIRoute}`,[]),ie=o.useMemo(()=>{if(typeof window>"u")return"/";const g=`${window.location.pathname}${window.location.search}${window.location.hash}`;return g.startsWith("/")?g:"/"},[]),Fe=o.useCallback(async g=>{if(!Te){ae(null),qe(g.name),ft(!0);try{const U=Ss(),J=new URLSearchParams({provider:g.name,callback_uri:Qe(g)}),Q=M===void 0?void 0:String(M||"").trim(),et=Q===void 0?ie&&ie!=="/"?ie:void 0:Q&&Q.startsWith("/")&&!Q.startsWith("//")?Q:void 0;et&&J.set("post_auth_redirect",et);const E=`${U||""}/api/iam/v1/oauth2/authz/url?${J.toString()}`,F=await fetch(E),T=await F.json(),xe=T?.autorization_url;if(!F.ok||!xe)throw new Error(T?.message||"Unable to start social sign-in.");window.location.assign(xe)}catch(U){const J=wi(U);ae(J),ge(J,{variant:"error"}),qe(null),ft(!1)}}},[Qe,ie,ge,Te,M]);o.useEffect(()=>{_e&&Je.current?.focus()},[_e]);const re=o.useCallback(()=>{Ye(!1),Ee("")},[]),_=o.useCallback(()=>{!he.trim()||!s||(s(he.trim()),re())},[he,s,re]),Xe=o.useCallback(()=>{if(ue){ue();return}window.location.assign(Ot)},[ue,Ot]),Ae=o.useCallback(()=>{if(we){if(we.startsWith("http://")||we.startsWith("https://")){window.open(we,"_blank","noopener,noreferrer");return}window.location.assign(we)}},[we]),ze=o.useCallback(async()=>{if(!(y||!ne||!ye||P)){Le(!0),ae(null);try{const g=await fetch(j,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({handle:ne,password:ye})});if(!g.ok)throw new Error(`HTTP ${g.status}`);const U=await g.json();if(U.success&&U.token){const J=String(U?.user?.id||U?.user?.uid||"").trim();if(!!U?.user?.mfaUrl&&J){pt(J),Bt(U.token),ae(null);return}e&&e(U.token,ne)}else ae(U.message||"Invalid username or password.")}catch(g){ae(g instanceof Error?g.message:String(g))}finally{Le(!1)}}},[y,ne,ye,P,j,e]),Be=o.useCallback(async()=>{if(!(y||P||!Y||!Ie.trim()||!Re)){Le(!0),ae(null);try{const g=new URL(j,window.location.origin),U=g.pathname.endsWith("/api/iam/v1/login")?g.href.replace(/\/api\/iam\/v1\/login$/,""):`${g.origin}`,J=await fetch(`${U}/api/iam/v1/users/${Y}/mfa/validate`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({userUid:Y,code:Ie.trim()})}),Q=await J.json();if(!J.ok||!Q?.success)throw new Error(Q?.message||"Failed to validate your MFA code.");e&&e(Re,ne)}catch(g){const U=g instanceof Error?g.message:String(g);ae(U),ge(U,{variant:"error"})}finally{Le(!1)}}},[y,ge,ne,P,j,Ie,Re,Y,e]),Z=o.useCallback(g=>{g.key==="Enter"&&(Y?Be():ze())},[Y,ze,Be]),Ze=Te||P||y;return t.jsxs(h,{className:"signin-input-theme-scope",display:"flex",alignItems:O||Se||!k?"flex-start":"center",justifyContent:"center",minHeight:O||Se||!k?"auto":"100vh",bg:O?"transparent":"canvas.default",color:"fg.default",py:O?0:Se?2:4,children:[t.jsx(Ti,{}),t.jsxs(h,{width:"100%",maxWidth:440,p:0,children:[!O&&t.jsxs(t.Fragment,{children:[t.jsxs(h,{display:"flex",alignItems:"center",gap:2,mb:Se?2:3,justifyContent:"center",children:[Ut,t.jsx(It,{sx:{fontSize:3},children:Ke})]}),t.jsx($,{as:"p",sx:{fontSize:1,color:"fg.muted",mb:Se?2:3,textAlign:"center"},children:u})]}),(I||oe)&&t.jsxs(h,{mb:3,textAlign:"center",children:[I&&t.jsx(It,{as:"h3",sx:{fontSize:2,mb:1},children:I}),oe&&t.jsx($,{sx:{color:"fg.muted",fontSize:1},children:oe})]}),!Y&&(f||v||m)&&t.jsxs(t.Fragment,{children:[f&&t.jsx(q,{block:!0,size:"large",leadingVisual:me==="github"?()=>t.jsx(un,{size:"small"}):ji,disabled:Ze,onClick:()=>Fe(mn.github),sx:{mt:Ue,maxWidth:W,mx:"auto"},children:"Sign in with GitHub"}),v&&t.jsx(q,{block:!0,size:"large",leadingVisual:me==="google"?()=>t.jsx(un,{size:"small"}):Ci,disabled:Ze,onClick:()=>Fe(mn.google),sx:{mt:Ue,maxWidth:W,mx:"auto"},children:"Sign in with Google"}),m&&t.jsx(q,{block:!0,size:"large",leadingVisual:me==="linkedin"?()=>t.jsx(un,{size:"small"}):ki,disabled:Ze,onClick:()=>Fe(mn.linkedin),sx:{mt:Ue,maxWidth:W,mx:"auto"},children:"Sign in with LinkedIn"})]}),!Y&&!L&&t.jsx(h,{mt:3,display:"flex",justifyContent:"center",children:t.jsx(q,{leadingVisual:bn,size:"large",block:!0,disabled:y||P||Te,onClick:()=>_t(!0),sx:{maxWidth:W,mx:"auto"},children:ke})}),!Y&&L&&t.jsxs(h,{mt:4,children:[t.jsxs(ce,{required:!0,sx:{mb:3},children:[t.jsx(ce.Label,{children:"Username"}),t.jsx(Rt,{autoFocus:!0,block:!0,placeholder:"Your username",value:ne,disabled:P||y,onChange:g=>ut(g.target.value),onKeyDown:Z})]}),t.jsxs(ce,{required:!0,sx:{mb:3},children:[t.jsx(ce.Label,{children:"Password"}),t.jsx(Rt,{block:!0,placeholder:"Your password",type:pe?"text":"password",value:ye,disabled:P||y,onChange:g=>Lt(g.target.value),onKeyDown:Z,trailingAction:t.jsx(Rt.Action,{onClick:()=>Ft(!pe),disabled:P||y,icon:pe?vi:Si,"aria-label":pe?"Hide password":"Show password",sx:{color:"var(--fgColor-muted)"}})})]}),t.jsxs(h,{display:"flex",alignItems:"center",justifyContent:"space-between",mt:3,children:[t.jsx(q,{variant:"primary",disabled:P||y||!ne||!ye,onClick:ze,children:P?"Signing in…":"Sign In"}),Pt&&t.jsx(vo,{as:"button",sx:{fontSize:1,cursor:y?"not-allowed":"pointer",background:"none",border:"none",opacity:y?.6:1},onClick:()=>{y||P||Ae()},children:fe})]})]}),Y&&t.jsxs(t.Fragment,{children:[t.jsxs(ce,{required:!0,sx:{mb:3,mt:2},children:[t.jsx(ce.Label,{children:"MFA Code"}),t.jsx(Rt,{autoFocus:!0,block:!0,placeholder:"Your MFA code",value:Ie,disabled:P||y,onChange:g=>zt(g.target.value),onKeyDown:Z})]}),t.jsx(q,{variant:"primary",block:!0,disabled:P||y||!Ie.trim(),onClick:Be,sx:{maxWidth:W,mx:"auto"},children:P?"Validating…":"Validate MFA Code"})]}),mt&&t.jsx($,{sx:{color:"danger.fg",fontSize:1,mt:3,display:"block"},children:mt}),V&&t.jsxs(h,{mt:4,pt:4,textAlign:"center",borderTop:"1px solid",borderColor:"border.muted",children:[t.jsx(It,{as:"h3",sx:{fontSize:2,mb:2},children:z}),t.jsx($,{as:"p",sx:{color:"fg.muted",fontSize:1,mb:3},children:$t}),t.jsx(h,{display:"flex",justifyContent:"center",children:t.jsx(q,{variant:"primary",size:"large",leadingVisual:So,disabled:y||P,onClick:Xe,children:Mt})})]}),p&&s&&t.jsxs(t.Fragment,{children:[t.jsxs(h,{display:"flex",alignItems:"center",gap:2,my:3,children:[t.jsx(h,{flex:1,height:"1px",bg:"border.default"}),t.jsx($,{sx:{fontSize:0,color:"fg.muted"},children:"or"}),t.jsx(h,{flex:1,height:"1px",bg:"border.default"})]}),t.jsx(q,{block:!0,leadingVisual:bn,disabled:y||P||Te,onClick:()=>Ye(!0),sx:{maxWidth:W,mx:"auto"},children:"Sign in with an API Key"}),_e&&t.jsx(h,{role:"dialog","aria-modal":"true","aria-labelledby":"signin-api-key-title",onKeyDown:g=>{g.key==="Escape"&&re()},onClick:re,position:"fixed",inset:0,zIndex:200,p:3,bg:"canvas.backdrop",display:"flex",alignItems:"center",justifyContent:"center",children:t.jsxs(h,{as:"form",onClick:g=>g.stopPropagation(),onSubmit:g=>{g.preventDefault(),_()},width:"min(560px, 100%)",p:3,borderRadius:2,border:"1px solid",borderColor:"border.default",bg:"canvas.overlay",color:"fg.default",boxShadow:"shadow.large",children:[t.jsx(It,{id:"signin-api-key-title",sx:{fontSize:2,mb:2},children:"Enter your API Key"}),t.jsxs(ce,{required:!0,children:[t.jsx(ce.Label,{children:"API Key"}),t.jsx(yo,{block:!0,required:!0,autoFocus:!0,placeholder:"Paste your API key here",value:he,onInput:g=>Ee(g.currentTarget.value),ref:Je})]}),t.jsxs(h,{mt:3,display:"flex",justifyContent:"flex-end",gap:2,children:[t.jsx(q,{type:"button",onClick:re,children:"Cancel"}),t.jsx(q,{type:"submit",variant:"primary",disabled:!he.trim(),children:"Authenticate"})]})]})})]})]})]})},ys=ko((e,s)=>({pending:void 0,suggest:(a,i)=>{const c=a.trim();c&&e({pending:{text:c,submit:i?.submit??!1,nonce:(s().pending?.nonce??0)+1}})},consume:()=>e({pending:void 0})}));function Ri(e){const{agentId:s,instructions:a,model:i,frontendTools:c,inference:u,subagents:x,sharing:l,onSubagentEvent:f,modeEffect:v}=e;return{type:"browser-vercel-ai",endpoint:"",agentId:s,enableConfigQuery:!1,options:{instructions:a,model:i,frontendTools:c,inference:u,subagents:x,sharing:l,onSubagentEvent:f,modeEffect:v}}}const Ei=({state:e})=>wo[e];class Ai extends Error{constructor(s,a){super(a),this.status=s,this.name="RuntimeRefusal"}status}function $i({baseUrl:e,getAccessToken:s,fetch:a}){const i=e.replace(/\/+$/,""),c=(f={})=>{const v=s();return{...f,...v?{Authorization:`Bearer ${v}`}:{}}},u=async f=>{throw new Ai(f.status,Ro(f.status,f.statusText,await Eo(f)))};return{json:async(f,v="GET",m)=>{const p=await a(`${i}${f}`,{method:v,headers:c({Accept:"application/json",...m===void 0?{}:{"Content-Type":"application/json"}}),...m===void 0?{}:{body:JSON.stringify(m)}});return p.ok?await p.json():u(p)},stream:async(f,v,{onEvent:m,signal:p},V="POST")=>{const M=await a(`${i}${f}`,{method:V,headers:c({"Content-Type":"application/json",Accept:"text/event-stream"}),body:JSON.stringify(v),signal:p});if(!M.ok)return u(M);await Ao(M,m)},refused:u,headers:c,root:i,fetcher:a}}const X=e=>`/api/v1/apps/sessions/${encodeURIComponent(e)}`;function Mi(e){const{json:s,stream:a,fetcher:i,headers:c,refused:u,root:x}=$i(e);return{serverUrl:x,accessToken:()=>e.getAccessToken(),start:(l,f)=>a("/api/v1/apps/sessions",{agent:l.agent,...l.deploymentUid?{deployment_uid:l.deploymentUid}:{},...l.appUid?{app_uid:l.appUid}:{},...l.version?{version:l.version}:{},...l.session?{session:l.session}:{},opener:l.opener},f),message:(l,f,v)=>a(`${X(l)}/messages`,{text:f},v),changeSettings:(l,f,v)=>a(`${X(l)}/settings`,{values:f},v,"PUT"),resume:(l,f,v)=>a(`${X(l)}/resume`,{agent:f},v),stop:l=>s(`${X(l)}/stop`,"POST"),end:l=>s(`${X(l)}/end`,"POST"),describe:l=>s(X(l)),described:async l=>Io(await s(X(l))),list:(l={})=>{const f=new URLSearchParams;for(const[m,p]of Object.entries(l))p!==""&&p!==void 0&&p!==!1&&f.set(m,String(p));const v=f.toString();return s(`/api/v1/apps/sessions${v?`?${v}`:""}`)},swap:(l,f)=>s(`${X(l)}/agent`,"POST",{agent:f}),clone:(l,f={})=>s(`${X(l)}/clone`,"POST",{up_to_turn:f.upToTurn??null,agent:f.agent??null,title:f.title??""}),exportFile:async(l,f="")=>{const v=await i(`${x}${X(l)}/export${f?`?format=${encodeURIComponent(f)}`:""}`,{method:"GET",headers:c()});return v.ok?v.text():u(v)},importFile:async(l,f={})=>{const v=new URLSearchParams;f.agent&&v.set("agent",f.agent),f.format&&v.set("format",f.format);const m=v.toString(),p=await i(`${x}/api/v1/apps/sessions/import${m?`?${m}`:""}`,{method:"POST",headers:c({"Content-Type":"application/x-ndjson"}),body:l});return p.ok?await p.json():u(p)},rename:(l,f)=>s(`${X(l)}/title`,"PUT",{title:f}),archive:(l,f)=>s(`${X(l)}/archived`,"PUT",{archived:f}),messages:async l=>To((await s(`${X(l)}/messages`)).messages)}}const de="";function Oi(e){return{surfaceId:!e||e===Ts?de:e,suspendedId:null}}function Pi({agentName:e,sandboxStillRuns:s=!1,temporary:a=!0,onSignedIn:i,onSignUp:c}){const{configuration:u}=Is(),x=o.useCallback(l=>{$o.getState().checkIAMToken(l),i?.()},[i]);return t.jsx(h,{height:"100%",minHeight:0,overflowY:"auto",bg:"canvas.default",px:4,py:4,children:t.jsxs(h,{maxWidth:440,mx:"auto",children:[t.jsxs(h,{display:"flex",alignItems:"center",justifyContent:"center",gap:2,color:"attention.fg",mb:2,children:[t.jsx(bn,{size:20}),t.jsx($,{sx:{fontSize:2,fontWeight:"semibold",color:"fg.default"},children:a?"This demo runs on a shared key":"Your key has expired"})]}),t.jsxs($,{as:"p",sx:{fontSize:1,color:"fg.muted",textAlign:"center",mb:3},children:[a?`${e??"The agent"} has used the time this key allows. Sign in to point your own agent at it, use your own data, and drop the time limit.`:`${e??"The agent"} stopped because your session ran out.`,s?" Your notebook is still running in this page.":""]}),a&&t.jsxs(h,{display:"flex",flexDirection:"column",alignItems:"center",gap:2,mb:3,"data-anonymous-key-refresh":"",children:[t.jsx($,{sx:{fontSize:1,color:"fg.muted",textAlign:"center"},children:"Or keep trying without an account: refreshing the page gives this demo a new key, and starts the conversation over."}),t.jsx(q,{leadingVisual:Mo,onClick:()=>{typeof window<"u"&&window.location.reload()},children:"Refresh the page for a new key"})]}),t.jsx(Ii,{hideHero:!0,fillHeight:!1,calloutTitle:"Sign in to keep going",github:!0,google:!0,linkedin:!0,socialSignInNavigationTarget:typeof window>"u"?void 0:`${window.location.pathname}${window.location.search}`,loginUrl:u?.iamUrl?`${u.iamUrl}/api/iam/v1/login`:void 0,onSignIn:x,onSignUp:c})]})})}const Ui="https://r1.datalayer.run";function Li(e=!0,s=""){const{configuration:a}=Is(),i=vn(f=>f.token),c=a?.aiInferenceUrl||Ui,u=Oo(c,e&&!i,s),x=i||u.token,l=o.useMemo(()=>({inferenceUrl:c,token:x||void 0}),[c,x]);return{inference:l,needsSignIn:Po(l),anonymous:u,inferenceUrl:c}}const _i={name:"general-purpose",description:"A capable generalist for a task none of the specialists covers: research, reasoning, drafting, checking.",instructions:"You are a capable general-purpose assistant. Carry out the task you are given completely and report the result plainly, saying what you could not do."};function js(e){const s=e?.subagents;if(!s)return[];const a=(s.subagents??[]).map(i=>{const c=i.ref?Uo(i.ref):void 0;return{name:i.name,description:i.description||c?.description||i.name,instructions:i.instructions??c?.systemPrompt,model:i.model??c?.model??s.defaultModel,icon:c?.icon}});return s.includeGeneralPurpose?[...a,_i]:a}const Ps=e=>e.replace(/\/+$/,""),Fi=e=>e.split(":")[0];function zi(e,s){return`${Ps(e)}/api/v1/apps/agents/${encodeURIComponent(s)}/equipment`}function Bi(e,s){return`${Ps(e)}/api/v1/configure/models?agent_id=${encodeURIComponent(s)}`}const Ni=["started","starting","failed","not_started","left_out"],gn=e=>Array.isArray(e)?e.filter(s=>typeof s=="string"):[];function Vi(e){const s=e??{};return{servers:(s.mcp_servers??[]).map(a=>({id:String(a.id??""),name:String(a.name??a.id??""),optional:a.optional===!0,state:Ni.includes(a.state)?a.state:"not_started",...typeof a.reason=="string"&&a.reason?{reason:a.reason}:{},missingEnvVars:gn(a.missing_env_vars),...typeof a.tools=="number"?{tools:a.tools}:{}})),skills:(s.skills??[]).map(a=>({id:String(a.id??""),name:String(a.name??a.id??""),description:String(a.description??""),optional:a.optional===!0,state:a.state==="not_activated"?"not_activated":"active",...typeof a.reason=="string"&&a.reason?{reason:a.reason}:{},missingEnvVars:gn(a.missing_env_vars),oneOfEnvVars:gn(a.one_of_env_vars)}))}}function Di(e){const s=e?ms[e]??ms[Fi(e)]:void 0,a=new Set(s?.optional?.mcpServers??[]),i=new Set(s?.optional?.skills??[]),c=s?[s.model,...s.modelAdditionals??[]].filter(u=>!!u):[];return{source:"declared",modelsSource:"declared",servers:(s?.mcpServers??[]).filter(Boolean).map(u=>({id:u.id,name:u.name||u.id,optional:a.has(u.id),missingEnvVars:[]})),skills:(s?.skills??[]).filter(Boolean).map(u=>({id:u.id,name:u.name||u.id,description:u.description??"",optional:i.has(u.id),missingEnvVars:[],oneOfEnvVars:[]})),models:[...new Set(c)].map((u,x)=>({id:u,name:Lo(u)?.name??u,current:x===0}))}}function Hi(e,s){const a=Rs(e),i=a.find(c=>c.id===s)?.id??a.find(c=>c.isAvailable!==!1)?.id;return a.map(c=>({...c,current:c.id===i}))}function Wi({agentServerUrl:e,agentId:s,token:a,specId:i,model:c,enabled:u,refreshMs:x=3e4}){const l=o.useMemo(()=>Di(i),[i]),[f,v]=o.useState(),[m,p]=o.useState();return o.useEffect(()=>{if(v(void 0),p(void 0),!u||!e||!s)return;let V=new AbortController;const M=a?{Authorization:`Bearer ${a}`}:{},y=()=>{V.abort(),V=new AbortController;const{signal:O}=V;fetch(zi(e,s),{headers:M,signal:O}).then(I=>I.ok?I.json():null).then(I=>{!O.aborted&&I&&v(Vi(I))}).catch(()=>{}),fetch(Bi(e,s),{headers:M,signal:O}).then(I=>I.ok?I.json():null).then(I=>{if(!O.aborted&&I){const oe=Hi(I,c);p(oe.some(ke=>ke.isAvailable!==!1)?oe:void 0)}}).catch(()=>{})};y();const k=setInterval(y,x);return()=>{clearInterval(k),V.abort()}},[u,e,s,a,c,x]),o.useMemo(()=>({source:f?"live":"declared",servers:f?.servers??l.servers,skills:f?.skills??l.skills,modelsSource:m&&m.length>0?"live":"declared",models:m&&m.length>0?m:l.models}),[f,m,l])}const N={readOnly:"Chosen by the application. Shown for you to read: nothing here changes it.",declared:"As its spec declares them: its runtime has not said their state yet.",model:"Model",servers:"MCP servers",skills:"Skills",none:{servers:"It uses no MCP server.",skills:"It has no skill."},optional:"optional",serverState:{started:"Running",starting:"Starting",failed:"Failed",not_started:"Not started",left_out:"Off"},skillState:{active:"Active",not_activated:"Not activated"},modelState:{current:"In use",available:"Available",off:"Not available"},declaredState:"Declared"},Gi={success:{fg:"success.fg",bg:"success.subtle"},attention:{fg:"attention.fg",bg:"attention.subtle"},danger:{fg:"danger.fg",bg:"danger.subtle"},accent:{fg:"accent.fg",bg:"accent.subtle"},neutral:{fg:"fg.muted",bg:"neutral.subtle"}};function Ki(e){const s=N.serverState,a=e.state;return{id:e.id,name:e.name,state:a?s[a]:N.declaredState,tone:a==="started"?"success":a==="failed"?"danger":a==="starting"?"attention":"neutral",on:a==="started",...e.reason?{reason:e.reason}:{},...a==="started"&&e.tools!==void 0?{note:`${e.tools} ${e.tools===1?"tool":"tools"}`}:e.optional?{note:N.optional}:{}}}function qi(e){const s=e.state;return{id:e.id,name:e.name,state:s?N.skillState[s]:N.declaredState,tone:s==="active"?"success":"neutral",on:s==="active",...e.reason?{reason:e.reason}:{},...e.optional?{note:N.optional}:{}}}function Yi(e){const s=e.isAvailable===!1;return{id:e.id,name:e.name,state:e.current?N.modelState.current:s?N.modelState.off:N.modelState.available,tone:e.current?"accent":s?"neutral":"success",on:!s,...s&&e.unavailableReason?{reason:e.unavailableReason}:{}}}function Ji(e){return[e.name,e.state,e.reason,e.note].filter(Boolean).join(", ")}function hn({kind:e,icon:s,title:a,rows:i,count:c,summary:u,empty:x,declared:l=!1,align:f="start"}){const v=`${a} — ${u}`;return t.jsxs(Ge,{children:[t.jsx(Ge.Anchor,{children:t.jsx(zo,{text:v,direction:"n",children:t.jsx(q,{type:"button",variant:"invisible",size:"small","aria-label":v,leadingVisual:s,"data-equipment-menu":e,"data-equipment-source":l?"declared":"live",children:t.jsx($,{sx:{fontSize:0,fontVariantNumeric:"tabular-nums",maxWidth:160,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",display:"inline-block",verticalAlign:"bottom",...e==="model"?{"@media (max-width: 480px)":{display:"none"}}:{}},children:c})})})}),t.jsx(Ge.Overlay,{side:"outside-top",align:f,width:"medium",children:t.jsxs(h,{maxHeight:"60vh",overflowY:"auto",children:[t.jsx(te,{"aria-label":a,children:t.jsxs(te.Group,{children:[t.jsxs(te.GroupHeading,{children:[a,i.length>0?` · ${u}`:""]}),i.length===0?t.jsx(te.Item,{onSelect:m=>m.preventDefault(),sx:{color:"fg.muted"},children:x}):i.map(m=>{const p=Gi[m.tone];return t.jsxs(te.Item,{onSelect:V=>V.preventDefault(),"aria-label":Ji(m),"data-equipment-row":m.id,"data-equipment-on":m.on?"true":"false",sx:m.on?void 0:{color:"fg.muted"},children:[m.name,t.jsx(te.TrailingVisual,{children:t.jsx($,{sx:{fontSize:"11px",px:"6px",py:"1px",borderRadius:999,bg:p.bg,color:p.fg,whiteSpace:"nowrap"},children:m.state})}),m.reason||m.note?t.jsx(te.Description,{variant:"block",children:[m.reason,m.note].filter(Boolean).join(" · ")}):null]},m.id)})]})}),t.jsxs(h,{px:3,py:2,borderTop:"1px solid",borderColor:"border.muted","data-equipment-note":"",children:[t.jsx($,{sx:{fontSize:0,color:"fg.muted",display:"block"},children:N.readOnly}),l?t.jsx($,{sx:{fontSize:0,color:"fg.muted",display:"block"},children:N.declared}):null]})]})})]})}const Cs=(e,s,a)=>a?String(s):`${e}/${s}`;function Qi({equipment:e}){const s=e.source==="declared",a=e.servers.map(Ki),i=e.skills.map(qi),c=e.models.map(Yi),u=a.filter(f=>f.on).length,x=i.filter(f=>f.on).length,l=e.models.find(f=>f.current);return t.jsxs(h,{display:"inline-flex",alignItems:"center",role:"group","aria-label":"What this application runs with","data-equipment-bar":e.source,children:[t.jsx(hn,{kind:"servers",icon:yi,title:N.servers,rows:a,count:Cs(u,a.length,s),summary:a.length===0?"none":s?`${a.length} declared`:`${u} of ${a.length} running`,empty:N.none.servers,declared:s}),t.jsx(hn,{kind:"skills",icon:_o,title:N.skills,rows:i,count:Cs(x,i.length,s),summary:i.length===0?"none":s?`${i.length} declared`:`${x} of ${i.length} active`,empty:N.none.skills,declared:s}),c.length>0?t.jsx(hn,{kind:"model",icon:Fo,title:N.model,rows:c,count:l?.name??String(c.length),summary:l?`${l.name}, of ${c.length} it may run on`:`${c.length} it may run on`,declared:e.modelsSource==="declared",align:"end"}):null]})}function Xi(e){return e.replace(/^datalayer_/,"").replace(/_lexical$/,"")}function Zi(e){const s=Xi(e);return/^executeCodeIn(Notebook|Document)$/.test(s)||/^(read|list)[A-Z]/.test(s)}function er(e,s){return e.filter(a=>s?.has(a.name)||Zi(a.name))}function tr(e,s){const a=i=>s&&i.value.id===`${s}-tools`?0:i.value.id==="notebook-tools"?1:2;return e.map((i,c)=>({entry:i,index:c,rank:a(i)})).sort((i,c)=>i.rank-c.rank||i.index-c.index).map(i=>i.entry)}function nr(e,s,a){if(!a||!e.endsWith("-tools"))return!1;const i=e.slice(0,-6);return s.has(i)&&i!==a}const sr={type:"object",properties:{}};function or(e,s){const a=new Set(e.toolset);return e.commands.filter(i=>a.has(i.name)).map(i=>({name:i.name,description:i.description,parameters:i.parameters??sr,location:"frontend",handler:async c=>{if(!s)throw new Error(`${i.name}: the ${e.plugin??e.id} plugin is not mounted on this page.`);const u=Object.keys(c??{}).length>0?c:void 0,x=await s.executeCommand(i.command,u);return x===void 0?{ok:!0,command:i.command,argument:u}:x}}))}function Us(e,s){return e.flatMap(a=>or(a,s))}function ar(){const e=Bo(),s=Os();return o.useMemo(()=>Us(s,e),[s,e])}function ir(e){const s=e?.app_instance;if(!s||typeof s!="object")return"";const a=s.deployment_uid;return typeof a=="string"?a.trim():""}function rr(e,s,a){return e||!s?e:{id:a,messages:[]}}function lr(e){const s=(new URLSearchParams(e).get("session")??"").trim();if(!s)return"";if(!/^[A-Za-z0-9_-]{8,128}$/.test(s))throw new Error(`?session=${s} names no session: a session uid is 8 to 128 letters, digits, hyphens or underscores.`);return s}function cr({facts:e}){if(!e)return null;const s=No(e);return t.jsxs(h,{display:"inline-flex",alignItems:"center",gap:2,"data-session-state":e.state,children:[t.jsx(Vo,{size:"small",variant:e.state==="open"?"accent":e.state==="paused"?"attention":"secondary",children:Do(e)}),s?t.jsx($,{sx:{fontSize:0,color:"fg.muted"},"data-session-lineage":"",children:s}):null]})}function dr({facts:e,turn:s,context:a}){const i=K(Es),c=As(i,e,"turn");return!e||c.length===0||s<1?null:t.jsx(h,{display:"inline-flex",gap:1,"data-turn-actions":s,children:c.map(u=>t.jsx(q,{size:"small",variant:"invisible","data-turn-action":u.id,onClick:()=>{Promise.resolve(u.run(e,{...a,atTurn:s})).catch(x=>a.say(String(x.message??x)))},children:u.label},u.id))})}function ur({uid:e,describe:s,context:a}){const i=K(Es),[c,u]=o.useState(void 0),[x,l]=o.useState(!1),[f,v]=o.useState(""),[m,p]=o.useState(void 0),V={...a,show:a.show??p,say:k=>{v(k),a.say(k)}},M=o.useCallback(k=>{l(k),k&&e&&s(e).then(u,()=>u(void 0))},[s,e]);if(!e||i.length===0)return null;const y=As(i,c);return t.jsxs(t.Fragment,{children:[t.jsxs(Ge,{open:x,onOpenChange:M,children:[t.jsx(Ge.Anchor,{children:t.jsx($s,{icon:Ho,"aria-label":"Session actions",variant:"invisible",size:"small","data-testid":"session-actions"})}),t.jsx(Ge.Overlay,{width:"small",children:t.jsxs(te,{children:[y.length===0?t.jsx(te.Item,{disabled:!0,children:c?"Nothing applies to this session now.":"Reading the session…"}):y.map(k=>t.jsx(te.Item,{"data-session-action":k.id,onSelect:()=>{c&&Promise.resolve(k.run(c,V)).catch(O=>V.say(String(O.message??O)))},children:k.label},k.id)),f?t.jsxs(t.Fragment,{children:[t.jsx(te.Divider,{}),t.jsx(te.Item,{disabled:!0,"data-testid":"session-actions-said",children:f})]}):null]})})]}),m?t.jsx(Ms,{title:m.title,onClose:()=>p(void 0),width:"large",children:t.jsx(h,{"data-session-panel":"",children:m.render()})}):null]})}const ks={confirm:"Switch",cancel:"Keep it"};function fr({question:e,onPick:s}){const[a,i]=o.useState(e.options[0]?.id??""),[c,u]=o.useState("");o.useEffect(()=>{let l=!0;if(!e.says||!a){u("");return}return e.says(a).then(f=>l&&u(f),()=>l&&u("")),()=>{l=!1}},[a,e]);const x=e.options.find(l=>l.id===a);return t.jsx(Ms,{title:e.title,onClose:()=>s(void 0),width:"medium",footerButtons:[{buttonType:"default",content:ks.cancel,onClick:()=>s(void 0)},{buttonType:"primary",content:ks.confirm,disabled:!a,onClick:()=>s(a||void 0)}],children:t.jsxs(h,{display:"grid",gap:3,"data-session-choose":"",children:[t.jsxs(ce,{children:[t.jsx(ce.Label,{children:e.title}),t.jsx(gs,{value:a,onChange:l=>i(l.target.value),block:!0,children:e.options.map(l=>t.jsx(gs.Option,{value:l.id,children:l.label},l.id))})]}),x?.description?t.jsx($,{sx:{fontSize:1,color:"fg.muted"},children:x.description}):null,c?t.jsx($,{as:"p",sx:{m:0,fontSize:1,fontStyle:"italic"},"data-session-choose-says":"",children:c}):null]})})}const pr="var(--theme-accent)";function Ls({face:e,size:s}){return typeof e=="string"?t.jsx(Wo,{emoji:e,size:s,label:""}):t.jsx(t.Fragment,{children:e})}function mr({face:e,size:s,state:a}){const i=a==="thinking"||a==="working",c=a==="paused";return t.jsxs(h,{as:"span","aria-hidden":!0,"data-presence":a,position:"relative",display:"inline-flex",alignItems:"center",justifyContent:"center",width:s+8,height:s+8,flexShrink:0,fontSize:s,lineHeight:1,children:[t.jsx(h,{as:"span",position:"absolute",inset:0,borderRadius:"50%",boxShadow:c?"none":`0 0 0 2px ${pr}`,border:c?"2px dashed":"none",borderColor:"border.default",opacity:i||a==="waiting"||c?.9:0,transition:"opacity var(--theme-motion-status, 0ms) var(--theme-motion-easing, ease)",animation:i?"loopPresenceBreath 1.8s ease-in-out infinite":"none",reducedMotion:{animation:"none"},sx:{"@keyframes loopPresenceBreath":{"0%, 100%":{transform:"scale(0.92)",opacity:.35},"50%":{transform:"scale(1.06)",opacity:.9}}}}),t.jsx(h,{as:"span",display:"inline-flex",opacity:c?.55:1,filter:c?"grayscale(0.6)":"none",transition:"opacity var(--theme-motion-status, 0ms) var(--theme-motion-easing, ease)",children:t.jsx(Ls,{face:e,size:s})})]})}function gr({state:e}){return t.jsx($,{role:"status","aria-live":"polite","data-presence-line":e,sx:{fontSize:0,color:e==="waiting"?"fg.default":"fg.muted",fontWeight:e==="waiting"?"semibold":"normal",whiteSpace:"nowrap",flexShrink:0},children:Ei({state:e})})}const hr=Sn(void 0),xr=Sn(""),br=Sn({}),vr=1400,ws=parseInt(xi["--loop-face-large"],10),Sr={};function Tr({workspace:e}){const s=Go(),a=Ko(),i=o.useRef(null),c=o.useRef(void 0),{setViewControls:u}=e,x=o.useRef(e.setThread);x.current=e.setThread;const l=o.useCallback(()=>{const n=i.current?.thread();return n&&x.current?.(n),n},[]),[f,v]=o.useState(null),m=qo(),p=m.getConfig(Yo),V=p?.placeholder||s.placeholder,M=p?.defaultSurface??"notebook",y=m.getConfig(Jo),[k,O]=o.useState(de),[I,oe]=o.useState(null),ke=o.useRef(!1),z=K(Qo),$t=K(Xo),Mt=K(Zo),ue=K(ea)[0]?.value,fe=fn(ue?.promptStance??hr)??ue?.prompt,Pt=K(ta),Ue=na(Pt[0]?.value),W=o.useRef(Ue);W.current=Ue;const Se=o.useRef(""),Ke=K(sa),Ut=o.useMemo(()=>oa(()=>Ke.reduce((n,r)=>aa(n,r.value.extras.value),{})),[Ke]),j=fn(Ke.length>0?Ut:br),ne=o.useRef(new Set),ut=ia(gi,e),ye=!ut.allowed,Lt=ye?ut.reason??"Chat is unavailable for this sandbox":void 0,[L,_t]=o.useState(!1),[pe,Ft]=o.useState(!1),[P,Le]=o.useState(!1),[Te,ft]=o.useState({open:!1,pendingApproval:!1}),me=ra(L,Te,p?.presence?.paused===!0),qe=p?.presence?.onPresence;o.useEffect(()=>{qe?.(me),W.current?.setPresence(me)},[qe,me]);const Y=o.useRef(p?.presence?.onSaying);Y.current=p?.presence?.onSaying;const pt=o.useRef({answering:!1}),Ie=o.useCallback(n=>{i.current=n,Ft(!!n)},[]),zt=o.useCallback(n=>{const{open:r,pendingApproval:d}=la(n);ft(Pe=>Pe.open===r&&Pe.pendingApproval===d?Pe:{open:r,pendingApproval:d});const S={saying:da(n),answering:ca(n)},b=pt.current;(b.saying?.id!==S.saying?.id||b.saying?.text!==S.saying?.text||b.answering!==S.answering)&&(pt.current=S,Y.current?.(S));const ee=W.current;if(!ee)return;ee.items(n);const B=new Set(["complete","completed","done","error","failed","cancelled","canceled","rejected","denied","stopped"]),le={insertcell:"adding a cell",updatecell:"editing a cell",runcell:"running a cell",deletecells:"removing cells",readallcells:"reading the notebook",readcell:"reading a cell",executecode:"running code",insertblock:"adding a block",updateblock:"editing a block",runblock:"running a block",readdocument:"reading the document"};let C;for(let Pe=n.length-1;Pe>=0;Pe-=1){const Tt=n[Pe];if(typeof Tt.toolName=="string"&&Tt.toolCallId){B.has(String(Tt.status).toLowerCase())||(C=Tt);break}}if(!C){ee.activity(void 0);return}const Oe=C.toolName.toLowerCase().replace(/^datalayer_/,"").replace(/_lexical$/,"").replace(/[^a-z]/g,""),go=le[Oe]??`using ${C.toolName}`;ee.activity(`${Se.current||"The agent"} is ${go}…`)},[]),Re=o.useRef(j);Re.current=j;const Bt=o.useCallback(n=>{Ys(n),W.current?.usage(n),Re.current.onUsage?.(n)},[]),mt=o.useCallback(n=>{_t(n),n||W.current?.end("done")},[]),ae=o.useCallback(n=>{const r=W.current;if(!r)return;let d=-1;for(let b=n.length-1;b>=0;b-=1)if(n[b].role==="user"){d=b;break}const S=n.slice(d+1).filter(b=>b.role==="assistant").map(ua).filter(b=>b.trim().length>0).join(`
|
|
29
29
|
|
|
30
30
|
`);r.assistant(S)},[]),ge=o.useRef([]),_e=o.useRef(!1),Ye=o.useRef(void 0),he=o.useRef(void 0),Ee=o.useRef(void 0),Je=K(fa),Qe=o.useRef(Je);Qe.current=Je;const ie=o.useCallback((n,r)=>{if(he.current)return he.current;const d=Ee.current;Ee.current=void 0;const S=pa(Qe.current.map(B=>B.value),d?{...r??{},voice:d}:r),b=S?.loop;if(_e.current&&b?.files&&b.files.length>0){const B=Ye.current;if(!B)return"A file is given to an application running on a runtime: run it on Datalayer or on your machine to give it one.";let le;try{le=b.files.map(C=>({file:ga(String(C.name??"")),base64:ma(String(C.data_url??""))}))}catch(C){return C instanceof Error?C.message:String(C)}B.execute(ha(le)).then(C=>{if(!C.success){v(`The files could not be put in the sandbox: ${C.error??"it failed"}.`);return}ie(`${n}
|
|
31
31
|
|
|
32
|
-
${xa(le.map(Pe=>Pe.file))}`,{...S,loop:Object.fromEntries(Object.entries(b).filter(([Pe])=>Pe!=="files"))})});return}W.current?.begin(n,l());const ee=i.current?.send;if(!ee){ge.current.push([n,S]);return}ee(n,S)},[l]);o.useEffect(()=>{u(pe?{busy:L,stop:i.current?.stop,newChat:i.current?.newChat,send:ie}:null)},[L,pe,u,ie]),o.useEffect(()=>()=>u(null),[u]),o.useEffect(()=>e.prompts.subscribe(ie),[e.prompts,ie]),o.useEffect(()=>{if(!pe||ge.current.length===0)return;const n=ge.current.splice(0,ge.current.length);for(const[r,d]of n)l(),i.current?.send(r,d)},[pe,l]);const Fe=o.useRef(!1),re=o.useCallback(async n=>{v(null);const r=await ba(Re.current,n);if(r){r.sent?at(""):v(r.refused);return}Fe.current||(Fe.current=!0,y?.firstPromptHook?.());const d=await e.submit(n);if(!d.handled){v(d.reason??null);return}at(""),d.result?.content&&v(d.result.content)},[e,y?.firstPromptHook]),_=o.useMemo(()=>z.find(n=>n.value.surfaceId===k)?.value,[z,k]),Xe=o.useCallback(n=>{ke.current=!0;const r=Pi(n);oe(r.suspendedId),P(r.surfaceId)},[]);o.useEffect(()=>va(Xe),[Xe]),o.useEffect(()=>{Sa(z.map(n=>n.value.surfaceId))},[z]),o.useEffect(()=>{ya(k&&k!==de?k:Ts)},[k]);const Ae=o.useMemo(()=>M===de||M==="none"?void 0:z.find(n=>n.value.surfaceId===M),[z,M]);o.useEffect(()=>{ke.current||!Ae||dt(Ae.value,e)&&P(M)},[Ae,e,M]);const ze=o.useRef(null),Be=p?.fullScreenTopOffset??0,{fullScreen:Z,usingApi:Ze,toggle:g,topOffsetPx:U}=ja(ze,{forceOverlay:!!Be,topOffset:Be}),[J,Q]=o.useState(!1),et=o.useRef(!1);o.useEffect(()=>{!L||et.current||Z||(et.current=!0,Q(!0))},[L,Z]),o.useEffect(()=>{Z&&Q(!1)},[Z]),o.useEffect(()=>{_&&!dt(_,e)&&(oe(_.surfaceId),P(de))},[_,e]);const gt=o.useMemo(()=>{if(I)return z.find(n=>n.value.surfaceId===I)?.value;if(!ke.current&&k===de)return Ae?.value},[z,I,k,Ae]);o.useEffect(()=>{if(!I||k!==de)return;const n=z.find(r=>r.value.surfaceId===I);n&&dt(n.value,e)&&(oe(null),P(I))},[z,k,I,e]);const E=e.agentId?.trim()||"default",F=Ca(e.sandbox.target??"local");_e.current=F;const T=ka(),xe=fn(T?.selected??xr),R=T?.members.find(n=>n.id===xe),yn=K(wa)[0]?.value,Nt=yn?.specId,A=hs(R?.specId??E)??(Nt?hs(Nt):void 0),Ne=R?void 0:yn,jn=F&&!R?mi(Nt,A):void 0;Se.current=R?.name??A?.name??E;const Cn=K(Ta),kn=j.hiddenOpeners,wn=j.hideOpeners,Vt=j.openers,Dt=o.useMemo(()=>{if(wn)return[];const n=new Set(kn??[]),r=C=>n.size===0?C:C.filter(Pe=>!n.has(Pe.text));if(Vt)return r(Vt);const d=Cn.flatMap(C=>C.value.suggestions);if(d.length>0)return r(d);const S=r(A?.suggestions??[]),b=r(T?.team.suggestions??[]);if(b.length===0)return S;const ee=new Set(b.map(C=>C.text)),B=T?.team.name??"Team",le=R?.name??A?.name??E;return[...b.map(C=>({...C,group:B})),...S.filter(C=>!ee.has(C.text)).map(C=>({...C,group:le}))]},[Cn,T,A,R,E,kn,wn,Vt]),ht=o.useMemo(()=>Dt.map(n=>({title:n.summary??n.text,message:n.message??n.text,group:n.group})),[Dt]),Ht=We(A?.icon),D=p?.presence,_s=We(T?.team.icon),Tn=K(Ia),xt=o.useMemo(()=>{const n=[],r=new Map,d=new Set,S=new Set(z.map(b=>b.value.surfaceId));for(const b of tr(Tn,_?.surfaceId)){if(nr(b.value.id,S,_?.surfaceId))continue;let ee;try{ee=b.value.tools(e)}catch(B){console.warn(`[loop] frontend tools from '${b.plugin}' failed:`,B);continue}for(const B of ee){const le=r.get(B.name);if(le){console.warn(`[loop] frontend tool '${B.name}' from '${b.plugin}' is shadowed by the one from '${le}'.`);continue}r.set(B.name,b.plugin),n.push(B),b.value.chatView&&d.add(B.name)}}for(const b of j.frontendTools??[])r.has(b.name)||(r.set(b.name,"chat-extras"),n.push(b),d.add(b.name));return _?n:er(n,d)},[Tn,e.surfaceId,e.agentId,j.frontendTools,_?.surfaceId,z]),Wt=ar(),tt=o.useMemo(()=>{if(Wt.length===0)return xt;const n=new Set(xt.map(r=>r.name));return[...xt,...Wt.filter(r=>!n.has(r.name))]},[xt,Wt]),In=Ps(),Gt=j.agentToolBundles,Fs=o.useMemo(()=>{const n=j.frontendTools??[];if(!Gt?.length)return j.frontendTools;const r=Us(In.filter(S=>Gt.includes(S.id)),m),d=new Set(n.map(S=>S.name));return[...n,...r.filter(S=>!d.has(S.name))]},[j.frontendTools,Gt,In,m]);Ye.current=F&&tt.some(n=>n.name===Ra)?m.getOutput(ct)?.sandbox:void 0;const w=Ea(e.sandbox,e.serverUrl),nt=o.useMemo(()=>Mi({baseUrl:w??"",getAccessToken:()=>c.current,fetch:(n,r)=>fetch(n,r)}),[w]),Rn=K(Aa),zs=o.useMemo(()=>Rn.filter(n=>n.value.composer).map(n=>({name:n.value.name,description:n.value.description})),[Rn]),Bs=o.useMemo(()=>{if(!T||!R)return js(A).map(d=>({name:d.name,description:d.description,icon:We(d.icon)}));const n=T.members.map(d=>({name:d.name,description:d.description,emoji:d.emoji,icon:We(d.icon),disabled:d.id===R.id,disabledReason:d.id===R.id?`You are already talking to ${d.name}`:void 0})),r=xs(T.team,R.id).filter(d=>!T.members.some(S=>S.name===d.name)).map(d=>({name:d.name,description:d.description,icon:We(d.icon)}));return[...n,...r]},[T,R,A]),Ns=$a(m.getConfig(ct)),{inference:En,anonymous:Vs}=Li(F,Ns),Kt=vn(n=>n.user),qt=F&&Vs.status==="expired",An=!Kt,st=Ma();he.current=st.disabled?st.disableReason||"This conversation is closed here.":void 0;const bt=w===void 0?Pa(e.sandbox,s):void 0,vt=m.getConfig(ct)?.datalayerVisitors,Yt=Oa(vt),se=p?.anonymous,Jt=Ua(se?.maxTurns),Qt=!!(se&&vt&&!Yt.error&&e.sandbox.state!=="error"&&(!Yt.token||w===void 0)),St=se?Jt.refused:"",$n=o.useRef(!1),Mn=Jt.take;o.useEffect(()=>{se&&L&&!$n.current&&Mn(),$n.current=L},[se,L,Mn]);const Ds=La(se??Sr),ot=Qt||!!St||ye||qt||!!jn||!!bt||st.disabled,Pn=Qt?_a.validating:St||(qt?An?s.demoKeyExpired:s.keyExpired:jn??bt??Lt??(st.disabled?st.disableReason:void 0)),[Xt,at]=o.useState(""),[On]=Fa(),it=o.useMemo(()=>p?.voice?za(p.voice,On):void 0,[p?.voice,On]),[Hs,Ws]=o.useState(!1),[Gs,Un]=o.useState(),yt=Gs??Ne?.model??A?.model??e.model??"",Ve=Ba(),Ln=o.useRef(Ve),_n=o.useRef(xe),Fn=o.useRef(Ve);Fn.current=Ve,o.useEffect(()=>{_n.current!==xe&&(_n.current=xe,Ln.current=Fn.current,Un(void 0))},[xe]);const Ks=Ve&&Ve!==Ln.current?Ve:null,[qs,Ys]=o.useState(),Js=Ks??qs??null,Qs=Et(Ce.inpromptMenu),zn=Et(Ce.promptAction),Bn=Et(Ce.chatHeader),Nn=Et(Ce.chatBanner),Xs=o.useMemo(()=>T?.members.map(n=>({id:n.id,name:n.name,description:n.description,icon:We(n.icon)}))??[],[T]),$e=ys(n=>n.pending),[Vn,Zs]=o.useState(0);o.useEffect(()=>Na(()=>Zs(n=>n+1)),[]),o.useEffect(()=>{$e&&(at($e.text),ys.getState().consume(),$e.submit&&re($e.text))},[$e]);const Zt=m.getConfig(ct)?.datalayerCreatePayload,G=!!(Ne?.createPayload?.app_spec||Zt?.app_spec),en=ir(Zt),eo=vn(n=>n.token),to=m.getConfig(ct)?.embedToken,be=vt?Yt.token:to||eo;c.current=be||void 0;const no=o.useMemo(()=>Va(p?.voice,be||void 0),[p?.voice,be]),je=!!(en||vt),tn=!!D&&G&&!F,so=Wi({agentServerUrl:w,agentId:E,token:be||void 0,specId:yr(Ne?.createPayload?.app_spec??Zt?.app_spec),enabled:tn});if(je&&!G)throw new Error("A deployment’s page runs its application: its host gave no app_spec.");const[Dn]=o.useState(Da),[nn,oo]=o.useMemo(()=>{try{return[lr(typeof window>"u"?"":window.location.search),""]}catch(n){return["",n instanceof Error?n.message:String(n)]}},[]),[Hn,ao]=o.useState(void 0),H=o.useMemo(()=>Hn??rr(p?.thread??(nn&&G?{id:nn,messages:[],fromRuntime:!0}:void 0),en,Dn),[Hn,p?.thread,nn,G,en,Dn]),[De,Wn]=o.useState(null),io=!!(H?.fromRuntime&&De?.given!==H.id);o.useEffect(()=>{if(!H?.fromRuntime||!G||!w)return;let n=!0;return(async()=>{let r="";for(let d=0;d<4&&n;d+=1)try{const S=await Ha({agentBaseUrl:w,agentId:E,uid:H.id,token:be});n&&Wn({given:H.id,thread:{...H,fromRuntime:!1,messages:S}});return}catch(S){r=S instanceof Error?S.message:String(S),await new Promise(b=>setTimeout(b,1500))}n&&Wn({given:H.id,thread:{id:Wa(),messages:[],onStarted:H.onStarted},said:bs.notOpened(r)})})(),()=>{n=!1}},[H?.id,H?.fromRuntime,G,w,E,be]);const sn=H?.fromRuntime?De?.given===H.id?De.thread:void 0:H,ve=e.thread||sn?.id||"",[Gn,Kn]=o.useState(void 0),[ro,qn]=o.useState(0),Yn=o.useRef("");o.useEffect(()=>{L&&ve&&(Yn.current=ve)},[L,ve]);const Jn=!!H?.fromRuntime||!!(e.thread&&e.thread===ve)||Yn.current===ve;o.useEffect(()=>{if(!G||!w||!ve||L||!Jn)return;let n=!0;return nt.described(ve).then(r=>n&&Kn(r),()=>n&&Kn(void 0)),()=>{n=!1}},[G,w,ve,L,Jn,ro,nt]);const[Qn,Xn]=o.useState(oo),[Zn,es]=o.useState(null),on=o.useRef(null),an=o.useRef(null),ts=o.useRef(null),ns=o.useMemo(()=>({client:nt,say:n=>{Xn(n),qn(r=>r+1)},openThread:n=>{ao({id:n,messages:[],fromRuntime:!0}),qn(r=>r+1)},download:(n,r,d)=>{const S=URL.createObjectURL(new Blob([r],{type:d})),b=document.createElement("a");b.href=S,b.download=n,b.click(),URL.revokeObjectURL(S)},choose:n=>new Promise(r=>{on.current=r,es(n)}),pickFile:n=>new Promise(r=>{const d=ts.current;if(!d){r(void 0);return}an.current=r,d.accept=n,d.value="",d.click()})}),[nt]),jt=o.useMemo(()=>F?Ri({agentId:R?.specId??E,instructions:Ga(A,Ne?.instructions),model:yt||void 0,inference:En,frontendTools:tt,subagents:T&&R?xs(T.team,R.id):js(A),sharing:T?.sharing,onSubagentEvent:n=>hi.getState().appendSubagentEvent(n),modeEffect:Ne?.modeEffect}):w!==void 0?{type:"ag-ui",endpoint:G?`${w}/api/v1/apps/agents/${encodeURIComponent(E)}/ag-ui/`:`${w}/api/v1/ag-ui/${E}/`,...G&&be?{authToken:be}:{},...G?{uiSocket:`${w.replace(/^http/,"ws")}/api/v1/apps/ui`,uiFiles:`${w}/api/v1/apps/agents/${encodeURIComponent(E)}/files`,appSessions:`${w}/api/v1/apps/sessions`,...je?{ownRoutesOnly:!0}:{}}:{},agentId:E,configEndpoint:`${w}/api/v1/configure`,enableConfigQuery:!0}:void 0,[E,F,En,R,tt,T,A,Ne,yt,w,G,be,je]),Ct=Ka(!F&&jt?.type==="ag-ui",jt?.type==="ag-ui"?jt.configEndpoint:void 0,void 0,E),rt=qa(),kt=Ya(E),[ss,rn]=o.useState(void 0),[lo,co]=o.useState(void 0);o.useEffect(()=>{if(F||w===void 0)return;const n=Ja(w,E,je);if(!n){rn([]);return}let r=!1;return fetch(n).then(d=>d.ok?d.json():null).then(d=>{r||(rn(d?Rs(d):[]),co(d?Qa(d):void 0))}).catch(()=>{r||rn([])}),()=>{r=!0}},[w,E,F,je]);const uo=o.useMemo(()=>Xa(Za(ss,()=>Object.values(ei).filter(n=>n.available&&ti(n)).map(n=>({id:n.id,name:n.name,provider:n.provider}))),!!Kt),[ss,Kt]),os=o.useMemo(()=>{const n=Ct.data?.builtinTools??[],r=new Set(n.map(d=>d.name));return{runtime:n,frontend:tt.filter(d=>!r.has(d.name)).map(d=>({id:d.name,name:d.name}))}},[Ct.data?.builtinTools,tt]),as=o.useMemo(()=>new Set((rt.data?.skills??[]).filter(n=>n.status==="enabled"||n.status==="loaded").map(n=>n.id)),[rt.data]),fo=o.useCallback(async n=>{if(je)throw new Error("A deployment’s chat does not switch its runtime’s model.");Un(n),!(F||w===void 0)&&await fetch(`${w}/api/v1/configure/inference/provider`,{method:"PUT",headers:{"content-type":"application/json"},body:JSON.stringify({model:n})}).catch(()=>{})},[w,F,je]),is=p?.promptPlacement==="bottom-chat",po=p?.promptPlacement==="floating",He=p?.promptPlacement==="top",lt=p?.hidePrompt===!0||j.hidePrompt===!0,ln=Mt[0]?.value.Component,cn=!p?.hideHeader&&!!ln,dn=o.useMemo(()=>({mcpServers:(A?.mcpServers??[]).map(n=>n.name||n.id),skills:(A?.skills??[]).map(n=>n.name||n.id)}),[A]),Me=se?{...Jt,refused:St,config:se,name:D?.name??R?.name??A?.name??"",validating:Qt,headerShown:cn,minutes:ri,disabledMcpServers:dn.mcpServers,disabledSkills:dn.skills,signIn:Ds}:null,mo={onSend:()=>{re(Xt)},input:Xt,setInput:at,focusTrigger:$e||Vn?($e?.nonce??0)+Vn:void 0,placement:po||fe==="floating"||fe==="floating-top"||fe==="floating-bottom"?"floating":"docked",floatingAnchor:fe==="floating-top"?"top":"bottom",isLoading:L,onStop:()=>e.viewControls.stop?.(),placeholder:Pn??j.sendInstead?.says??V,typingSuggestions:Dt.map(n=>n.text),suggestions:ht,disableInputPrompt:ot,connectionConfirmed:!ot,interim:Hs,padding:He||fe==="floating-top"||fe==="floating-bottom"||fe==="docked-top"?2:3,promptVariant:"lexical",autoFocus:p?.autoFocusPrompt??!0,mentionableAgents:Bs,promptCommands:zs,headerContent:Qs.length>0?t.jsx(At,{slot:Ce.inpromptMenu,props:{workspace:e}}):void 0,footerExtras:se||tn||zn.length>0||it&&it.input!=="off"?t.jsxs(t.Fragment,{children:[se?t.jsx(ni,{}):null,tn?t.jsx(Qi,{equipment:so}):null,zn.length>0?t.jsx(At,{slot:Ce.promptAction,props:{workspace:e}}):null,it&&it.input!=="off"?t.jsx(si,{voice:it,input:Xt,setInput:at,disabled:ot,speaking:O,onStopSpeaking:()=>i.current?.stopSpeaking?.(),playbackLevel:()=>i.current?.voiceLevel?.()??0,running:L,onStopRun:()=>(i.current?.interrupt??i.current?.stop)?.(),onInterrupted:()=>i.current?.markInterrupted(),onInterimChange:Ws,answers:!!(p?.voice?.output&&p.voice.output!=="off"&&p.voice.speechUrl),onSpoken:n=>{Ee.current=n},send:(n,r)=>{Ee.current=r,re(n)}}):null]}):void 0,showAgentsMenu:!D,showInlineAgentsMenu:!1,agents:Xs,selectedAgentId:xe,onSelectAgent:n=>T?.select(n),showTokenUsage:j.showTokenUsage??p?.showTokenUsage??!0,showContextRing:!0,agentUsage:Js??void 0,showModelSelector:!D&&!je,models:uo,decisions:lo,selectedModel:yt,onModelSelect:n=>{fo(n)},showToolsMenu:!D,availableTools:os.runtime,availableFrontendTools:os.frontend,mcpServers:Ct.data?.mcpServers??[],mcpStatusData:j.mcpStatusData??void 0,showSkillsMenu:!D,skills:rt.data?.skills??[],skillsLoading:rt.isLoading,enabledSkills:as,onToggleSkill:n=>as.has(n)?kt.disableSkill(n):kt.enableSkill(n),onToggleAllSkills:(n,r)=>n.forEach(d=>r?kt.enableSkill(d):kt.disableSkill(d)),codemodeEnabled:j.codemodeEnabled??!1,onToggleCodemode:j.onToggleCodemode,isA2AProtocol:!1,hasConfigData:!!Ct.data,hasSkillsData:!!rt.data,...se?{anonymousDisabled:dn}:{}},rs=$t[0]?.value.Component,wt=rs?t.jsx(rs,{workspace:e,composer:mo}):null,ls=z.length>0&&p?.showSurfaceSelector!==!1?t.jsx(jr,{surfaces:z.map(n=>n.value),active:_?.surfaceId??gt?.surfaceId??de,onChange:Xe,workspace:e}):null,cs=t.jsxs(t.Fragment,{children:[z.map(n=>{const r=n.value,d=_?.surfaceId===r.surfaceId;return d||ne.current.has(r.surfaceId)||dt(r,e)?(ne.current.add(r.surfaceId),t.jsx(h,{sx:d?{flex:"1 1 0",minWidth:0,minHeight:0}:{position:"absolute",inset:0,visibility:"hidden",pointerEvents:"none",zIndex:-1},children:t.jsx(oi,{load:r.load,props:{surfaceId:r.surfaceId,workspace:e},fallback:t.jsxs(xn,{children:["Loading ",r.title,"…"]}),errorFallback:b=>t.jsxs(xn,{children:[r.title," failed to load: ",b.message]})})},r.surfaceId)):null}),!_&>?t.jsx(h,{flex:"1 1 0",minWidth:0,minHeight:0,children:t.jsxs(xn,{children:["Starting ",gt.title,"…"]})}):null]}),ds=t.jsx(t.Fragment,{children:t.jsxs(h,{flex:He&&_?"0 0 34%":"1 1 0",maxWidth:He&&_?460:void 0,minWidth:0,minHeight:0,display:"flex",flexDirection:"column",borderLeft:_?"1px solid":void 0,borderColor:"border.default",position:"relative",children:[j.errorBanner?t.jsx(h,{flexShrink:0,px:3,py:2,fontSize:1,borderBottom:"1px solid",bg:j.errorBanner.variant==="warning"?"attention.subtle":"danger.subtle",color:j.errorBanner.variant==="warning"?"attention.fg":"danger.fg",borderColor:j.errorBanner.variant==="warning"?"attention.muted":"danger.muted",children:j.errorBanner.message}):null,De?.said&&De.given===H?.id?t.jsx($,{as:"p",role:"status",sx:{m:0,px:3,py:2,fontSize:1,color:"fg.muted"},children:De.said}):null,Qn?t.jsxs(h,{display:"flex",alignItems:"baseline",gap:2,px:3,py:2,fontSize:1,color:"fg.muted",role:"status","data-session-said":"",children:[t.jsx($,{sx:{flex:1},children:Qn}),t.jsx(q,{size:"small",variant:"invisible",onClick:()=>Xn(""),children:"Dismiss"})]}):null,Zn?t.jsx(fr,{question:Zn,onPick:n=>{es(null),on.current?.(n),on.current=null}}):null,t.jsx("input",{ref:ts,type:"file",hidden:!0,"data-session-file":"",onChange:async n=>{const r=n.target.files?.[0],d=r?await r.text():void 0;an.current?.(d),an.current=null}}),t.jsx(h,{flex:"1 1 auto",minHeight:0,display:"flex",children:io?t.jsx($,{as:"p",role:"status",sx:{m:0,p:3,fontSize:1,color:"fg.muted"},children:bs.opening}):t.jsx(ai,{themeVariant:p?.themeVariant,themeOverrides:p?.themeOverrides,colorMode:p?.colorMode,thread:sn,voice:no,disabled:ot,disableReason:Pn,protocol:jt,frontendTools:F?void 0:Fs,initialModel:yt||void 0,title:D?.name??R?.name??A?.name??E,description:D?.welcome??A?.description,brandIcon:D?.face?t.jsx(mr,{face:D.face,size:20,state:me}):t.jsx(Ht,{size:20}),headerLeading:e.chatHeaderLeading,headerContent:D&&!bt||Nn.length>0?t.jsxs(t.Fragment,{children:[D&&!bt?t.jsx(gr,{state:me}):null,Nn.length>0?t.jsx(At,{slot:Ce.chatBanner,props:{workspace:e}}):null]}):void 0,emptyState:{icon:D?.face?t.jsx("span",{"aria-hidden":!0,style:{fontSize:ws,lineHeight:1},children:t.jsx(Ls,{face:D.face,size:ws})}):t.jsx(Ht,{size:48}),title:D?.name??R?.name??A?.name??E,...T&&R?{sections:[{group:T.team.name,icon:t.jsx(_s,{size:48}),title:T.team.name,subtitle:T.team.description},{group:R.name,icon:t.jsx(Ht,{size:32}),title:R.name,subtitle:A?.description}]}:null},suggestions:He||ue||p?.suggestionLabels===!1?[]:ht,showHeader:cn,headerButtons:{showNewChat:p?.headerButtons?.newChat??!1,showClear:p?.headerButtons?.clear??!1},renderHeader:ln?n=>t.jsx(ln,{workspace:e,header:e.chatViewModes?{...n,chatViewMode:e.chatViewModes.value,onChatViewModeChange:e.chatViewModes.onChange,offeredViewModes:e.chatViewModes.offered}:n}):void 0,showInformation:!0,headerItems:[...e.chatHeaderActions?[{key:"workspace-actions",type:"custom",pinned:!0,render:()=>e.chatHeaderActions}]:[],...Me&&!Me.validating&&!Me.refused?[{key:"anonymous-key-clock",type:"custom",render:()=>t.jsx(ii,{state:Me})}]:[],...G&&w?[{key:"session-state",type:"custom",render:()=>t.jsx(cr,{facts:Gn})},{key:"session-actions",type:"custom",pinned:!0,render:()=>t.jsx(ur,{uid:ve||void 0,describe:n=>nt.described(n),context:ns})}]:[],...Bn.map(n=>{const r=n.Component;return{key:`slot-${n.slot}:${n.id}`,type:"custom",priority:-1,render:()=>t.jsx(r,{workspace:e})}}),...e.chatHeaderTrailing?[{key:"right-panel-toggle",type:"custom",pinned:!0,render:()=>e.chatHeaderTrailing}]:[],{key:"full-screen",type:"custom",pinned:!0,render:()=>t.jsx($s,{icon:Z?li:ci,"aria-label":Z?"Exit full screen":"Enter full screen",variant:"invisible",size:"small",onClick:()=>{Q(!1),g()},sx:J?{"@keyframes dla-fullscreen-hint":{"0%, 100%":{opacity:1},"50%":{opacity:.4}},"&&":{bg:`color-mix(in srgb, ${a.primary} 16%, transparent)`,boxShadow:`inset 0 0 0 1.5px ${a.primary}`,animation:`dla-fullscreen-hint ${vr}ms ease-in-out infinite`},"@media (prefers-reduced-motion: reduce)":{"&&":{animation:"none"}}}:void 0})}],showInput:!1,onSendReady:Ie,notebookToolSurfacesId:_?void 0:e.surfaceId,showTurnFooter:j.showTokenUsage??p?.showTokenUsage??!0,onContextSnapshot:Bt,onLoadingChange:mt,renderMessageFooter:G&&w?(n,r)=>n.role==="user"?t.jsx(dr,{facts:Gn,turn:r.turn,context:ns}):null:void 0,onSpeakingChange:Le,onItemsChange:ae,onDisplayItemsChange:zt,enableStreaming:!0},sn?.id)}),!cn&&Bn.length>0?t.jsx(h,{hidden:!0,children:t.jsx(At,{slot:Ce.chatHeader,props:{workspace:e}})}):null,is&&!lt?wt:null]})}),us=p?.suggestionLabels!==!1&&ht.length>0?t.jsx(h,{"aria-label":s.suggestedPrompts,display:"flex",flexWrap:"wrap",gap:2,px:2,pb:"6px",children:ht.map(n=>t.jsx(h,{as:"button",type:"button",title:n.message,disabled:L||ot,onClick:()=>{re(n.message)},appearance:"none",font:"inherit",fontSize:0,fontWeight:"semibold",lineHeight:1.25,px:"10px",py:"5px",width:vs,flex:`0 0 ${vs}px`,borderRadius:"999px",border:"1px solid",bg:"canvas.subtle",whiteSpace:"nowrap",sx:{borderColor:"border.default",color:"fg.default",cursor:"pointer","&:hover:not(:disabled)":{borderColor:"accent.fg",color:"accent.fg"},"&:disabled":{opacity:.5,cursor:"default"}},children:t.jsx(di,{title:n.title,maxWidth:"100%",sx:{minWidth:0},children:n.title})},n.title))}):null,fs=f?t.jsx(h,{flex:"0 0 auto",px:3,py:2,borderTop:"1px solid",borderColor:"border.default",bg:"canvas.subtle",fontSize:1,maxHeight:"40%",overflowY:"auto",children:f}):null;return t.jsx(ui,{value:Me,children:t.jsxs(h,{ref:ze,sx:{height:"100%",minHeight:0,display:"flex",flexDirection:"column",position:"relative",...Z?{bg:"canvas.default"}:null,...Z&&!Ze.current?{position:"fixed",top:U,right:0,bottom:0,left:0,height:"auto",zIndex:1e3}:null},children:[Me?t.jsx(h,{flex:"0 0 auto",children:t.jsx(fi,{state:Me})}):null,ue?t.jsx(ue.Component,{workspace:e,editors:cs,hasEditor:!!_,transcript:ds,prompt:lt?null:wt,chips:lt?null:us,picker:ls,transient:fs}):t.jsxs(t.Fragment,{children:[He&&!lt?t.jsxs(h,{flex:"0 0 auto",borderBottom:"1px solid",borderColor:"border.default",children:[wt,us]}):null,ls,t.jsxs(h,{flex:"1 1 auto",minHeight:0,display:"flex",position:"relative",children:[cs,ds]}),fs,is||lt||He?null:wt]}),qt?t.jsx(h,{position:"absolute",inset:0,zIndex:5,bg:"canvas.default",display:"flex",flexDirection:"column",minHeight:0,children:t.jsx(Oi,{agentName:R?.name??A?.name,sandboxStillRuns:F,temporary:An,onSignedIn:()=>pi.getState().clear()})}):null]})})}function yr(e){const s=e?.agent;return typeof s=="string"&&s?s:void 0}function jr({surfaces:e,active:s,onChange:a,workspace:i}){const c=[...e].sort((u,x)=>(u.order??100)-(x.order??100));return t.jsxs(h,{flex:"0 0 auto",display:"flex",alignItems:"center",gap:2,px:3,py:2,borderBottom:"1px solid",borderColor:"border.default",children:[t.jsx($,{sx:{fontSize:0,color:"fg.muted"},children:"Beside the chat"}),t.jsxs(pn,{"aria-label":"Editor beside the chat",size:"small",children:[t.jsx(pn.Button,{selected:s===de,onClick:()=>a(de),children:"Chat"}),c.map(u=>{const x=dt(u,i),l=x?void 0:u.unavailableReason?.(i)??"Not available right now";return t.jsx(pn.Button,{selected:s===u.surfaceId,"aria-disabled":!x,title:l??u.title,leadingIcon:u.icon,onClick:()=>{x&&a(u.surfaceId)},children:u.title},u.surfaceId)})]})]})}function xn({children:e}){return t.jsx(h,{height:"100%",display:"flex",alignItems:"center",justifyContent:"center",color:"fg.muted",fontSize:1,px:3,textAlign:"center",children:e})}export{Tr as default};
|
|
32
|
+
${xa(le.map(Oe=>Oe.file))}`,{...S,loop:Object.fromEntries(Object.entries(b).filter(([Oe])=>Oe!=="files"))})});return}W.current?.begin(n,l());const ee=i.current?.send;if(!ee){ge.current.push([n,S]);return}ee(n,S)},[l]);o.useEffect(()=>{u(pe?{busy:L,stop:i.current?.stop,newChat:i.current?.newChat,send:ie}:null)},[L,pe,u,ie]),o.useEffect(()=>()=>u(null),[u]),o.useEffect(()=>e.prompts.subscribe(ie),[e.prompts,ie]),o.useEffect(()=>{if(!pe||ge.current.length===0)return;const n=ge.current.splice(0,ge.current.length);for(const[r,d]of n)l(),i.current?.send(r,d)},[pe,l]);const Fe=o.useRef(!1),re=o.useCallback(async n=>{v(null);const r=await ba(Re.current,n);if(r){r.sent?at(""):v(r.refused);return}Fe.current||(Fe.current=!0,y?.firstPromptHook?.());const d=await e.submit(n);if(!d.handled){v(d.reason??null);return}at(""),d.result?.content&&v(d.result.content)},[e,y?.firstPromptHook]),_=o.useMemo(()=>z.find(n=>n.value.surfaceId===k)?.value,[z,k]),Xe=o.useCallback(n=>{ke.current=!0;const r=Oi(n);oe(r.suspendedId),O(r.surfaceId)},[]);o.useEffect(()=>va(Xe),[Xe]),o.useEffect(()=>{Sa(z.map(n=>n.value.surfaceId))},[z]),o.useEffect(()=>{ya(k&&k!==de?k:Ts)},[k]);const Ae=o.useMemo(()=>M===de||M==="none"?void 0:z.find(n=>n.value.surfaceId===M),[z,M]);o.useEffect(()=>{ke.current||!Ae||dt(Ae.value,e)&&O(M)},[Ae,e,M]);const ze=o.useRef(null),Be=p?.fullScreenTopOffset??0,{fullScreen:Z,usingApi:Ze,toggle:g,topOffsetPx:U}=ja(ze,{forceOverlay:!!Be,topOffset:Be}),[J,Q]=o.useState(!1),et=o.useRef(!1);o.useEffect(()=>{!L||et.current||Z||(et.current=!0,Q(!0))},[L,Z]),o.useEffect(()=>{Z&&Q(!1)},[Z]),o.useEffect(()=>{_&&!dt(_,e)&&(oe(_.surfaceId),O(de))},[_,e]);const gt=o.useMemo(()=>{if(I)return z.find(n=>n.value.surfaceId===I)?.value;if(!ke.current&&k===de)return Ae?.value},[z,I,k,Ae]);o.useEffect(()=>{if(!I||k!==de)return;const n=z.find(r=>r.value.surfaceId===I);n&&dt(n.value,e)&&(oe(null),O(I))},[z,k,I,e]);const E=e.agentId?.trim()||"default",F=Ca(e.sandbox.target??"local");_e.current=F;const T=ka(),xe=fn(T?.selected??xr),R=T?.members.find(n=>n.id===xe),yn=K(wa)[0]?.value,Nt=yn?.specId,A=hs(R?.specId??E)??(Nt?hs(Nt):void 0),Ne=R?void 0:yn,jn=F&&!R?mi(Nt,A):void 0;Se.current=R?.name??A?.name??E;const Cn=K(Ta),kn=j.hiddenOpeners,wn=j.hideOpeners,Vt=j.openers,Dt=o.useMemo(()=>{if(wn)return[];const n=new Set(kn??[]),r=C=>n.size===0?C:C.filter(Oe=>!n.has(Oe.text));if(Vt)return r(Vt);const d=Cn.flatMap(C=>C.value.suggestions);if(d.length>0)return r(d);const S=r(A?.suggestions??[]),b=r(T?.team.suggestions??[]);if(b.length===0)return S;const ee=new Set(b.map(C=>C.text)),B=T?.team.name??"Team",le=R?.name??A?.name??E;return[...b.map(C=>({...C,group:B})),...S.filter(C=>!ee.has(C.text)).map(C=>({...C,group:le}))]},[Cn,T,A,R,E,kn,wn,Vt]),ht=o.useMemo(()=>Dt.map(n=>({title:n.summary??n.text,message:n.message??n.text,group:n.group})),[Dt]),Ht=We(A?.icon),D=p?.presence,_s=We(T?.team.icon),Tn=K(Ia),xt=o.useMemo(()=>{const n=[],r=new Map,d=new Set,S=new Set(z.map(b=>b.value.surfaceId));for(const b of tr(Tn,_?.surfaceId)){if(nr(b.value.id,S,_?.surfaceId))continue;let ee;try{ee=b.value.tools(e)}catch(B){console.warn(`[loop] frontend tools from '${b.plugin}' failed:`,B);continue}for(const B of ee){const le=r.get(B.name);if(le){console.warn(`[loop] frontend tool '${B.name}' from '${b.plugin}' is shadowed by the one from '${le}'.`);continue}r.set(B.name,b.plugin),n.push(B),b.value.chatView&&d.add(B.name)}}for(const b of j.frontendTools??[])r.has(b.name)||(r.set(b.name,"chat-extras"),n.push(b),d.add(b.name));return _?n:er(n,d)},[Tn,e.surfaceId,e.agentId,j.frontendTools,_?.surfaceId,z]),Wt=ar(),tt=o.useMemo(()=>{if(Wt.length===0)return xt;const n=new Set(xt.map(r=>r.name));return[...xt,...Wt.filter(r=>!n.has(r.name))]},[xt,Wt]),In=Os(),Gt=j.agentToolBundles,Fs=o.useMemo(()=>{const n=j.frontendTools??[];if(!Gt?.length)return j.frontendTools;const r=Us(In.filter(S=>Gt.includes(S.id)),m),d=new Set(n.map(S=>S.name));return[...n,...r.filter(S=>!d.has(S.name))]},[j.frontendTools,Gt,In,m]);Ye.current=F&&tt.some(n=>n.name===Ra)?m.getOutput(ct)?.sandbox:void 0;const w=Ea(e.sandbox,e.serverUrl),nt=o.useMemo(()=>Mi({baseUrl:w??"",getAccessToken:()=>c.current,fetch:(n,r)=>fetch(n,r)}),[w]),Rn=K(Aa),zs=o.useMemo(()=>Rn.filter(n=>n.value.composer).map(n=>({name:n.value.name,description:n.value.description})),[Rn]),Bs=o.useMemo(()=>{if(!T||!R)return js(A).map(d=>({name:d.name,description:d.description,icon:We(d.icon)}));const n=T.members.map(d=>({name:d.name,description:d.description,emoji:d.emoji,icon:We(d.icon),disabled:d.id===R.id,disabledReason:d.id===R.id?`You are already talking to ${d.name}`:void 0})),r=xs(T.team,R.id).filter(d=>!T.members.some(S=>S.name===d.name)).map(d=>({name:d.name,description:d.description,icon:We(d.icon)}));return[...n,...r]},[T,R,A]),Ns=$a(m.getConfig(ct)),{inference:En,anonymous:Vs}=Li(F,Ns),Kt=vn(n=>n.user),qt=F&&Vs.status==="expired",An=!Kt,st=Ma();he.current=st.disabled?st.disableReason||"This conversation is closed here.":void 0;const bt=w===void 0?Oa(e.sandbox,s):void 0,vt=m.getConfig(ct)?.datalayerVisitors,Yt=Pa(vt),se=p?.anonymous,Jt=Ua(se?.maxTurns),Qt=!!(se&&vt&&!Yt.error&&e.sandbox.state!=="error"&&(!Yt.token||w===void 0)),St=se?Jt.refused:"",$n=o.useRef(!1),Mn=Jt.take;o.useEffect(()=>{se&&L&&!$n.current&&Mn(),$n.current=L},[se,L,Mn]);const Ds=La(se??Sr),ot=Qt||!!St||ye||qt||!!jn||!!bt||st.disabled,On=Qt?_a.validating:St||(qt?An?s.demoKeyExpired:s.keyExpired:jn??bt??Lt??(st.disabled?st.disableReason:void 0)),[Xt,at]=o.useState(""),[Pn]=Fa(),it=o.useMemo(()=>p?.voice?za(p.voice,Pn):void 0,[p?.voice,Pn]),[Hs,Ws]=o.useState(!1),[Gs,Un]=o.useState(),yt=Gs??Ne?.model??A?.model??e.model??"",Ve=Ba(),Ln=o.useRef(Ve),_n=o.useRef(xe),Fn=o.useRef(Ve);Fn.current=Ve,o.useEffect(()=>{_n.current!==xe&&(_n.current=xe,Ln.current=Fn.current,Un(void 0))},[xe]);const Ks=Ve&&Ve!==Ln.current?Ve:null,[qs,Ys]=o.useState(),Js=Ks??qs??null,Qs=Et(Ce.inpromptMenu),zn=Et(Ce.promptAction),Bn=Et(Ce.chatHeader),Nn=Et(Ce.chatBanner),Xs=o.useMemo(()=>T?.members.map(n=>({id:n.id,name:n.name,description:n.description,icon:We(n.icon)}))??[],[T]),$e=ys(n=>n.pending),[Vn,Zs]=o.useState(0);o.useEffect(()=>Na(()=>Zs(n=>n+1)),[]),o.useEffect(()=>{$e&&(at($e.text),ys.getState().consume(),$e.submit&&re($e.text))},[$e]);const Zt=m.getConfig(ct)?.datalayerCreatePayload,G=!!(Ne?.createPayload?.app_spec||Zt?.app_spec),en=ir(Zt),eo=vn(n=>n.token),to=m.getConfig(ct)?.embedToken,be=vt?Yt.token:to||eo;c.current=be||void 0;const no=o.useMemo(()=>Va(p?.voice,be||void 0),[p?.voice,be]),je=!!(en||vt),tn=!!D&&G&&!F,so=Wi({agentServerUrl:w,agentId:E,token:be||void 0,specId:yr(Ne?.createPayload?.app_spec??Zt?.app_spec),enabled:tn});if(je&&!G)throw new Error("A deployment’s page runs its application: its host gave no app_spec.");const[Dn]=o.useState(Da),[nn,oo]=o.useMemo(()=>{try{return[lr(typeof window>"u"?"":window.location.search),""]}catch(n){return["",n instanceof Error?n.message:String(n)]}},[]),[Hn,ao]=o.useState(void 0),H=o.useMemo(()=>Hn??rr(p?.thread??(nn&&G?{id:nn,messages:[],fromRuntime:!0}:void 0),en,Dn),[Hn,p?.thread,nn,G,en,Dn]),[De,Wn]=o.useState(null),io=!!(H?.fromRuntime&&De?.given!==H.id);o.useEffect(()=>{if(!H?.fromRuntime||!G||!w)return;let n=!0;return(async()=>{let r="";for(let d=0;d<4&&n;d+=1)try{const S=await Ha({agentBaseUrl:w,agentId:E,uid:H.id,token:be});n&&Wn({given:H.id,thread:{...H,fromRuntime:!1,messages:S}});return}catch(S){r=S instanceof Error?S.message:String(S),await new Promise(b=>setTimeout(b,1500))}n&&Wn({given:H.id,thread:{id:Wa(),messages:[],onStarted:H.onStarted},said:bs.notOpened(r)})})(),()=>{n=!1}},[H?.id,H?.fromRuntime,G,w,E,be]);const sn=H?.fromRuntime?De?.given===H.id?De.thread:void 0:H,ve=e.thread||sn?.id||"",[Gn,Kn]=o.useState(void 0),[ro,qn]=o.useState(0),Yn=o.useRef("");o.useEffect(()=>{L&&ve&&(Yn.current=ve)},[L,ve]);const Jn=!!H?.fromRuntime||!!(e.thread&&e.thread===ve)||Yn.current===ve;o.useEffect(()=>{if(!G||!w||!ve||L||!Jn)return;let n=!0;return nt.described(ve).then(r=>n&&Kn(r),()=>n&&Kn(void 0)),()=>{n=!1}},[G,w,ve,L,Jn,ro,nt]);const[Qn,Xn]=o.useState(oo),[Zn,es]=o.useState(null),on=o.useRef(null),an=o.useRef(null),ts=o.useRef(null),ns=o.useMemo(()=>({client:nt,say:n=>{Xn(n),qn(r=>r+1)},openThread:n=>{ao({id:n,messages:[],fromRuntime:!0}),qn(r=>r+1)},download:(n,r,d)=>{const S=URL.createObjectURL(new Blob([r],{type:d})),b=document.createElement("a");b.href=S,b.download=n,b.click(),URL.revokeObjectURL(S)},choose:n=>new Promise(r=>{on.current=r,es(n)}),pickFile:n=>new Promise(r=>{const d=ts.current;if(!d){r(void 0);return}an.current=r,d.accept=n,d.value="",d.click()})}),[nt]),jt=o.useMemo(()=>F?Ri({agentId:R?.specId??E,instructions:Ga(A,Ne?.instructions),model:yt||void 0,inference:En,frontendTools:tt,subagents:T&&R?xs(T.team,R.id):js(A),sharing:T?.sharing,onSubagentEvent:n=>hi.getState().appendSubagentEvent(n),modeEffect:Ne?.modeEffect}):w!==void 0?{type:"ag-ui",endpoint:G?`${w}/api/v1/apps/agents/${encodeURIComponent(E)}/ag-ui/`:`${w}/api/v1/ag-ui/${E}/`,...G&&be?{authToken:be}:{},...G?{uiSocket:`${w.replace(/^http/,"ws")}/api/v1/apps/ui`,uiFiles:`${w}/api/v1/apps/agents/${encodeURIComponent(E)}/files`,appSessions:`${w}/api/v1/apps/sessions`,...je?{ownRoutesOnly:!0}:{}}:{},agentId:E,configEndpoint:`${w}/api/v1/configure`,enableConfigQuery:!0}:void 0,[E,F,En,R,tt,T,A,Ne,yt,w,G,be,je]),Ct=Ka(!F&&jt?.type==="ag-ui",jt?.type==="ag-ui"?jt.configEndpoint:void 0,void 0,E),rt=qa(),kt=Ya(E),[ss,rn]=o.useState(void 0),[lo,co]=o.useState(void 0);o.useEffect(()=>{if(F||w===void 0)return;const n=Ja(w,E,je);if(!n){rn([]);return}let r=!1;return fetch(n).then(d=>d.ok?d.json():null).then(d=>{r||(rn(d?Rs(d):[]),co(d?Qa(d):void 0))}).catch(()=>{r||rn([])}),()=>{r=!0}},[w,E,F,je]);const uo=o.useMemo(()=>Xa(Za(ss,()=>Object.values(ei).filter(n=>n.available&&ti(n)).map(n=>({id:n.id,name:n.name,provider:n.provider}))),!!Kt),[ss,Kt]),os=o.useMemo(()=>{const n=Ct.data?.builtinTools??[],r=new Set(n.map(d=>d.name));return{runtime:n,frontend:tt.filter(d=>!r.has(d.name)).map(d=>({id:d.name,name:d.name}))}},[Ct.data?.builtinTools,tt]),as=o.useMemo(()=>new Set((rt.data?.skills??[]).filter(n=>n.status==="enabled"||n.status==="loaded").map(n=>n.id)),[rt.data]),fo=o.useCallback(async n=>{if(je)throw new Error("A deployment’s chat does not switch its runtime’s model.");Un(n),!(F||w===void 0)&&await fetch(`${w}/api/v1/configure/inference/provider`,{method:"PUT",headers:{"content-type":"application/json"},body:JSON.stringify({model:n})}).catch(()=>{})},[w,F,je]),is=p?.promptPlacement==="bottom-chat",po=p?.promptPlacement==="floating",He=p?.promptPlacement==="top",lt=p?.hidePrompt===!0||j.hidePrompt===!0,ln=Mt[0]?.value.Component,cn=!p?.hideHeader&&!!ln,dn=o.useMemo(()=>({mcpServers:(A?.mcpServers??[]).map(n=>n.name||n.id),skills:(A?.skills??[]).map(n=>n.name||n.id)}),[A]),Me=se?{...Jt,refused:St,config:se,name:D?.name??R?.name??A?.name??"",validating:Qt,headerShown:cn,minutes:ri,disabledMcpServers:dn.mcpServers,disabledSkills:dn.skills,signIn:Ds}:null,mo={onSend:()=>{re(Xt)},input:Xt,setInput:at,focusTrigger:$e||Vn?($e?.nonce??0)+Vn:void 0,placement:po||fe==="floating"||fe==="floating-top"||fe==="floating-bottom"?"floating":"docked",floatingAnchor:fe==="floating-top"?"top":"bottom",isLoading:L,onStop:()=>e.viewControls.stop?.(),placeholder:On??j.sendInstead?.says??V,typingSuggestions:Dt.map(n=>n.text),suggestions:ht,disableInputPrompt:ot,connectionConfirmed:!ot,interim:Hs,padding:He||fe==="floating-top"||fe==="floating-bottom"||fe==="docked-top"?2:3,promptVariant:"lexical",autoFocus:p?.autoFocusPrompt??!0,mentionableAgents:Bs,promptCommands:zs,headerContent:Qs.length>0?t.jsx(At,{slot:Ce.inpromptMenu,props:{workspace:e}}):void 0,footerExtras:se||tn||zn.length>0||it&&it.input!=="off"?t.jsxs(t.Fragment,{children:[se?t.jsx(ni,{}):null,tn?t.jsx(Qi,{equipment:so}):null,zn.length>0?t.jsx(At,{slot:Ce.promptAction,props:{workspace:e}}):null,it&&it.input!=="off"?t.jsx(si,{voice:it,input:Xt,setInput:at,disabled:ot,speaking:P,onStopSpeaking:()=>i.current?.stopSpeaking?.(),playbackLevel:()=>i.current?.voiceLevel?.()??0,running:L,onStopRun:()=>(i.current?.interrupt??i.current?.stop)?.(),onInterrupted:()=>i.current?.markInterrupted(),onInterimChange:Ws,answers:!!(p?.voice?.output&&p.voice.output!=="off"&&p.voice.speechUrl),onSpoken:n=>{Ee.current=n},send:(n,r)=>{Ee.current=r,re(n)}}):null]}):void 0,showAgentsMenu:!D,showInlineAgentsMenu:!1,agents:Xs,selectedAgentId:xe,onSelectAgent:n=>T?.select(n),showTokenUsage:j.showTokenUsage??p?.showTokenUsage??!0,showContextRing:!0,agentUsage:Js??void 0,showModelSelector:!D&&!je,models:uo,decisions:lo,selectedModel:yt,onModelSelect:n=>{fo(n)},showToolsMenu:!D,availableTools:os.runtime,availableFrontendTools:os.frontend,mcpServers:Ct.data?.mcpServers??[],mcpStatusData:j.mcpStatusData??void 0,showSkillsMenu:!D,skills:rt.data?.skills??[],skillsLoading:rt.isLoading,enabledSkills:as,onToggleSkill:n=>as.has(n)?kt.disableSkill(n):kt.enableSkill(n),onToggleAllSkills:(n,r)=>n.forEach(d=>r?kt.enableSkill(d):kt.disableSkill(d)),codemodeEnabled:j.codemodeEnabled??!1,onToggleCodemode:j.onToggleCodemode,isA2AProtocol:!1,hasConfigData:!!Ct.data,hasSkillsData:!!rt.data,...se?{anonymousDisabled:dn}:{}},rs=$t[0]?.value.Component,wt=rs?t.jsx(rs,{workspace:e,composer:mo}):null,ls=z.length>0&&p?.showSurfaceSelector!==!1?t.jsx(jr,{surfaces:z.map(n=>n.value),active:_?.surfaceId??gt?.surfaceId??de,onChange:Xe,workspace:e}):null,cs=t.jsxs(t.Fragment,{children:[z.map(n=>{const r=n.value,d=_?.surfaceId===r.surfaceId;return d||ne.current.has(r.surfaceId)||dt(r,e)?(ne.current.add(r.surfaceId),t.jsx(h,{sx:d?{flex:"1 1 0",minWidth:0,minHeight:0}:{position:"absolute",inset:0,visibility:"hidden",pointerEvents:"none",zIndex:-1},children:t.jsx(oi,{load:r.load,props:{surfaceId:r.surfaceId,workspace:e},fallback:t.jsxs(xn,{children:["Loading ",r.title,"…"]}),errorFallback:b=>t.jsxs(xn,{children:[r.title," failed to load: ",b.message]})})},r.surfaceId)):null}),!_&>?t.jsx(h,{flex:"1 1 0",minWidth:0,minHeight:0,children:t.jsxs(xn,{children:["Starting ",gt.title,"…"]})}):null]}),ds=t.jsx(t.Fragment,{children:t.jsxs(h,{flex:He&&_?"0 0 34%":"1 1 0",maxWidth:He&&_?460:void 0,minWidth:0,minHeight:0,display:"flex",flexDirection:"column",borderLeft:_?"1px solid":void 0,borderColor:"border.default",position:"relative",children:[j.errorBanner?t.jsx(h,{flexShrink:0,px:3,py:2,fontSize:1,borderBottom:"1px solid",bg:j.errorBanner.variant==="warning"?"attention.subtle":"danger.subtle",color:j.errorBanner.variant==="warning"?"attention.fg":"danger.fg",borderColor:j.errorBanner.variant==="warning"?"attention.muted":"danger.muted",children:j.errorBanner.message}):null,De?.said&&De.given===H?.id?t.jsx($,{as:"p",role:"status",sx:{m:0,px:3,py:2,fontSize:1,color:"fg.muted"},children:De.said}):null,Qn?t.jsxs(h,{display:"flex",alignItems:"baseline",gap:2,px:3,py:2,fontSize:1,color:"fg.muted",role:"status","data-session-said":"",children:[t.jsx($,{sx:{flex:1},children:Qn}),t.jsx(q,{size:"small",variant:"invisible",onClick:()=>Xn(""),children:"Dismiss"})]}):null,Zn?t.jsx(fr,{question:Zn,onPick:n=>{es(null),on.current?.(n),on.current=null}}):null,t.jsx("input",{ref:ts,type:"file",hidden:!0,"data-session-file":"",onChange:async n=>{const r=n.target.files?.[0],d=r?await r.text():void 0;an.current?.(d),an.current=null}}),t.jsx(h,{flex:"1 1 auto",minHeight:0,display:"flex",children:io?t.jsx($,{as:"p",role:"status",sx:{m:0,p:3,fontSize:1,color:"fg.muted"},children:bs.opening}):t.jsx(ai,{themeVariant:p?.themeVariant,themeOverrides:p?.themeOverrides,colorMode:p?.colorMode,thread:sn,voice:no,disabled:ot,disableReason:On,protocol:jt,frontendTools:F?void 0:Fs,initialModel:yt||void 0,title:D?.name??R?.name??A?.name??E,description:D?.welcome??A?.description,brandIcon:D?.face?t.jsx(mr,{face:D.face,size:20,state:me}):t.jsx(Ht,{size:20}),headerLeading:e.chatHeaderLeading,headerContent:D&&!bt||Nn.length>0?t.jsxs(t.Fragment,{children:[D&&!bt?t.jsx(gr,{state:me}):null,Nn.length>0?t.jsx(At,{slot:Ce.chatBanner,props:{workspace:e}}):null]}):void 0,emptyState:{icon:D?.face?t.jsx("span",{"aria-hidden":!0,style:{fontSize:ws,lineHeight:1},children:t.jsx(Ls,{face:D.face,size:ws})}):t.jsx(Ht,{size:48}),title:D?.name??R?.name??A?.name??E,...T&&R?{sections:[{group:T.team.name,icon:t.jsx(_s,{size:48}),title:T.team.name,subtitle:T.team.description},{group:R.name,icon:t.jsx(Ht,{size:32}),title:R.name,subtitle:A?.description}]}:null},suggestions:He||ue||p?.suggestionLabels===!1?[]:ht,showHeader:cn,headerButtons:{showNewChat:p?.headerButtons?.newChat??!1,showClear:p?.headerButtons?.clear??!1},renderHeader:ln?n=>t.jsx(ln,{workspace:e,header:e.chatViewModes?{...n,chatViewMode:e.chatViewModes.value,onChatViewModeChange:e.chatViewModes.onChange,offeredViewModes:e.chatViewModes.offered}:n}):void 0,showInformation:!0,headerItems:[...e.chatHeaderActions?[{key:"workspace-actions",type:"custom",pinned:!0,render:()=>e.chatHeaderActions}]:[],...Me&&!Me.validating&&!Me.refused?[{key:"anonymous-key-clock",type:"custom",render:()=>t.jsx(ii,{state:Me})}]:[],...G&&w?[{key:"session-state",type:"custom",render:()=>t.jsx(cr,{facts:Gn})},{key:"session-actions",type:"custom",pinned:!0,render:()=>t.jsx(ur,{uid:ve||void 0,describe:n=>nt.described(n),context:ns})}]:[],...Bn.map(n=>{const r=n.Component;return{key:`slot-${n.slot}:${n.id}`,type:"custom",priority:-1,render:()=>t.jsx(r,{workspace:e})}}),...e.chatHeaderTrailing?[{key:"right-panel-toggle",type:"custom",pinned:!0,render:()=>e.chatHeaderTrailing}]:[],{key:"full-screen",type:"custom",pinned:!0,render:()=>t.jsx($s,{icon:Z?li:ci,"aria-label":Z?"Exit full screen":"Enter full screen",variant:"invisible",size:"small",onClick:()=>{Q(!1),g()},sx:J?{"@keyframes dla-fullscreen-hint":{"0%, 100%":{opacity:1},"50%":{opacity:.4}},"&&":{bg:`color-mix(in srgb, ${a.primary} 16%, transparent)`,boxShadow:`inset 0 0 0 1.5px ${a.primary}`,animation:`dla-fullscreen-hint ${vr}ms ease-in-out infinite`},"@media (prefers-reduced-motion: reduce)":{"&&":{animation:"none"}}}:void 0})}],showInput:!1,onSendReady:Ie,notebookToolSurfacesId:_?void 0:e.surfaceId,showTurnFooter:j.showTokenUsage??p?.showTokenUsage??!0,onContextSnapshot:Bt,onLoadingChange:mt,renderMessageFooter:G&&w?(n,r)=>n.role==="user"?t.jsx(dr,{facts:Gn,turn:r.turn,context:ns}):null:void 0,onSpeakingChange:Le,onItemsChange:ae,onDisplayItemsChange:zt,enableStreaming:!0},sn?.id)}),!cn&&Bn.length>0?t.jsx(h,{hidden:!0,children:t.jsx(At,{slot:Ce.chatHeader,props:{workspace:e}})}):null,is&&!lt?wt:null]})}),us=p?.suggestionLabels!==!1&&ht.length>0?t.jsx(h,{"aria-label":s.suggestedPrompts,display:"flex",flexWrap:"wrap",gap:2,px:2,pb:"6px",children:ht.map(n=>t.jsx(h,{as:"button",type:"button",title:n.message,disabled:L||ot,onClick:()=>{re(n.message)},appearance:"none",font:"inherit",fontSize:0,fontWeight:"semibold",lineHeight:1.25,px:"10px",py:"5px",width:vs,flex:`0 0 ${vs}px`,borderRadius:"999px",border:"1px solid",bg:"canvas.subtle",whiteSpace:"nowrap",sx:{borderColor:"border.default",color:"fg.default",cursor:"pointer","&:hover:not(:disabled)":{borderColor:"accent.fg",color:"accent.fg"},"&:disabled":{opacity:.5,cursor:"default"}},children:t.jsx(di,{title:n.title,maxWidth:"100%",sx:{minWidth:0},children:n.title})},n.title))}):null,fs=f?t.jsx(h,{flex:"0 0 auto",px:3,py:2,borderTop:"1px solid",borderColor:"border.default",bg:"canvas.subtle",fontSize:1,maxHeight:"40%",overflowY:"auto",children:f}):null;return t.jsx(ui,{value:Me,children:t.jsxs(h,{ref:ze,sx:{height:"100%",minHeight:0,display:"flex",flexDirection:"column",position:"relative",...Z?{bg:"canvas.default"}:null,...Z&&!Ze.current?{position:"fixed",top:U,right:0,bottom:0,left:0,height:"auto",zIndex:1e3}:null},children:[Me?t.jsx(h,{flex:"0 0 auto",children:t.jsx(fi,{state:Me})}):null,ue?t.jsx(ue.Component,{workspace:e,editors:cs,hasEditor:!!_,transcript:ds,prompt:lt?null:wt,chips:lt?null:us,picker:ls,transient:fs}):t.jsxs(t.Fragment,{children:[He&&!lt?t.jsxs(h,{flex:"0 0 auto",borderBottom:"1px solid",borderColor:"border.default",children:[wt,us]}):null,ls,t.jsxs(h,{flex:"1 1 auto",minHeight:0,display:"flex",position:"relative",children:[cs,ds]}),fs,is||lt||He?null:wt]}),qt?t.jsx(h,{position:"absolute",inset:0,zIndex:5,bg:"canvas.default",display:"flex",flexDirection:"column",minHeight:0,children:t.jsx(Pi,{agentName:R?.name??A?.name,sandboxStillRuns:F,temporary:An,onSignedIn:()=>pi.getState().clear()})}):null]})})}function yr(e){const s=e?.agent;return typeof s=="string"&&s?s:void 0}function jr({surfaces:e,active:s,onChange:a,workspace:i}){const c=[...e].sort((u,x)=>(u.order??100)-(x.order??100));return t.jsxs(h,{flex:"0 0 auto",display:"flex",alignItems:"center",gap:2,px:3,py:2,borderBottom:"1px solid",borderColor:"border.default",children:[t.jsx($,{sx:{fontSize:0,color:"fg.muted"},children:"Beside the chat"}),t.jsxs(pn,{"aria-label":"Editor beside the chat",size:"small",children:[t.jsx(pn.Button,{selected:s===de,onClick:()=>a(de),children:"Chat"}),c.map(u=>{const x=dt(u,i),l=x?void 0:u.unavailableReason?.(i)??"Not available right now";return t.jsx(pn.Button,{selected:s===u.surfaceId,"aria-disabled":!x,title:l??u.title,leadingIcon:u.icon,onClick:()=>{x&&a(u.surfaceId)},children:u.title},u.surfaceId)})]})]})}function xn({children:e}){return t.jsx(h,{height:"100%",display:"flex",alignItems:"center",justifyContent:"center",color:"fg.muted",fontSize:1,px:3,textAlign:"center",children:e})}export{Tr as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{J as a,K as
|
|
1
|
+
import{J as a,K as c}from"../datalayer-app-main.js";var n=["16","24"],l={16:{width:16,path:a.createElement("path",{d:"M8 2c1.981 0 3.671.992 4.933 2.078 1.27 1.091 2.187 2.345 2.637 3.023a1.62 1.62 0 0 1 0 1.798c-.45.678-1.367 1.932-2.637 3.023C11.67 13.008 9.981 14 8 14c-1.981 0-3.671-.992-4.933-2.078C1.797 10.83.88 9.576.43 8.898a1.62 1.62 0 0 1 0-1.798c.45-.677 1.367-1.931 2.637-3.022C4.33 2.992 6.019 2 8 2ZM1.679 7.932a.12.12 0 0 0 0 .136c.411.622 1.241 1.75 2.366 2.717C5.176 11.758 6.527 12.5 8 12.5c1.473 0 2.825-.742 3.955-1.715 1.124-.967 1.954-2.096 2.366-2.717a.12.12 0 0 0 0-.136c-.412-.621-1.242-1.75-2.366-2.717C10.824 4.242 9.473 3.5 8 3.5c-1.473 0-2.825.742-3.955 1.715-1.124.967-1.954 2.096-2.366 2.717ZM8 10a2 2 0 1 1-.001-3.999A2 2 0 0 1 8 10Z"})},24:{width:24,path:a.createElement(a.Fragment,null,a.createElement("path",{d:"M15.5 12a3.5 3.5 0 1 1-7 0 3.5 3.5 0 0 1 7 0Z"}),a.createElement("path",{d:"M12 3.5c3.432 0 6.124 1.534 8.054 3.241 1.926 1.703 3.132 3.61 3.616 4.46a1.6 1.6 0 0 1 0 1.598c-.484.85-1.69 2.757-3.616 4.461-1.929 1.706-4.622 3.24-8.054 3.24-3.432 0-6.124-1.534-8.054-3.24C2.02 15.558.814 13.65.33 12.8a1.6 1.6 0 0 1 0-1.598c.484-.85 1.69-2.757 3.616-4.462C5.875 5.034 8.568 3.5 12 3.5ZM1.633 11.945a.115.115 0 0 0-.017.055c.001.02.006.039.017.056.441.774 1.551 2.527 3.307 4.08C6.691 17.685 9.045 19 12 19c2.955 0 5.31-1.315 7.06-2.864 1.756-1.553 2.866-3.306 3.307-4.08a.111.111 0 0 0 .017-.056.111.111 0 0 0-.017-.056c-.441-.773-1.551-2.527-3.307-4.08C17.309 6.315 14.955 5 12 5 9.045 5 6.69 6.314 4.94 7.865c-1.756 1.552-2.866 3.306-3.307 4.08Z"}))}},r=a.forwardRef(function(e,t){return c(e,t,"octicon octicon-eye",l,n)});r.displayName="EyeIcon";var h=["16","24"],o={16:{width:16,path:a.createElement("path",{d:"M.143 2.31a.75.75 0 0 1 1.047-.167l14.5 10.5a.75.75 0 1 1-.88 1.214l-2.248-1.628C11.346 13.19 9.792 14 8 14c-1.981 0-3.67-.992-4.933-2.078C1.797 10.832.88 9.577.43 8.9a1.619 1.619 0 0 1 0-1.797c.353-.533.995-1.42 1.868-2.305L.31 3.357A.75.75 0 0 1 .143 2.31Zm1.536 5.622A.12.12 0 0 0 1.657 8c0 .021.006.045.022.068.412.621 1.242 1.75 2.366 2.717C5.175 11.758 6.527 12.5 8 12.5c1.195 0 2.31-.488 3.29-1.191L9.063 9.695A2 2 0 0 1 6.058 7.52L3.529 5.688a14.207 14.207 0 0 0-1.85 2.244ZM8 3.5c-.516 0-1.017.09-1.499.251a.75.75 0 1 1-.473-1.423A6.207 6.207 0 0 1 8 2c1.981 0 3.67.992 4.933 2.078 1.27 1.091 2.187 2.345 2.637 3.023a1.62 1.62 0 0 1 0 1.798c-.11.166-.248.365-.41.587a.75.75 0 1 1-1.21-.887c.148-.201.272-.382.371-.53a.119.119 0 0 0 0-.137c-.412-.621-1.242-1.75-2.366-2.717C10.825 4.242 9.473 3.5 8 3.5Z"})},24:{width:24,path:a.createElement("path",{d:"M8.052 5.837A9.715 9.715 0 0 1 12 5c2.955 0 5.309 1.315 7.06 2.864 1.756 1.553 2.866 3.307 3.307 4.08a.11.11 0 0 1 .016.055.122.122 0 0 1-.017.06 16.766 16.766 0 0 1-1.53 2.218.75.75 0 1 0 1.163.946 18.253 18.253 0 0 0 1.67-2.42 1.607 1.607 0 0 0 .001-1.602c-.485-.85-1.69-2.757-3.616-4.46C18.124 5.034 15.432 3.5 12 3.5c-1.695 0-3.215.374-4.552.963a.75.75 0 0 0 .604 1.373Zm11.114 12.15C17.328 19.38 14.933 20.5 12 20.5c-3.432 0-6.125-1.534-8.054-3.24C2.02 15.556.814 13.648.33 12.798a1.606 1.606 0 0 1 .001-1.6A18.283 18.283 0 0 1 3.648 7.01L1.317 5.362a.75.75 0 1 1 .866-1.224l20.5 14.5a.75.75 0 1 1-.866 1.224ZM4.902 7.898c-1.73 1.541-2.828 3.273-3.268 4.044a.112.112 0 0 0-.017.059c0 .015.003.034.016.055.441.774 1.551 2.527 3.307 4.08C6.69 17.685 9.045 19 12 19c2.334 0 4.29-.82 5.874-1.927l-3.516-2.487a3.5 3.5 0 0 1-5.583-3.949L4.902 7.899Z"})}},i=a.forwardRef(function(e,t){return c(e,t,"octicon octicon-eye-closed",o,h)});i.displayName="EyeClosedIcon";var d=["16","24"],m={16:{width:16,path:a.createElement(a.Fragment,null,a.createElement("path",{d:"M5.52 1.12a3.578 3.578 0 0 1 6.078 2.98 3.578 3.578 0 0 1 2.982 6.08l-3.292 3.293a.252.252 0 0 0 0 .354l.843.843a.749.749 0 1 1-1.06 1.06l-.844-.843a1.75 1.75 0 0 1 0-2.474L13.52 9.12a2.08 2.08 0 0 0 0-2.94 2.08 2.08 0 0 0-2.94 0L7.731 9.03A.75.75 0 0 1 6.67 7.97l2.85-2.85a2.08 2.08 0 0 0 0-2.94 2.08 2.08 0 0 0-2.94 0l-4.799 4.8A.75.75 0 0 1 .72 5.92Z"}),a.createElement("path",{d:"M7.52 3.12a.749.749 0 1 1 1.06 1.06L5.731 7.03A2.079 2.079 0 0 0 8.67 9.97l2.85-2.85a.749.749 0 1 1 1.06 1.06l-2.849 2.85A3.578 3.578 0 0 1 4.67 5.97Z"}))},24:{width:24,path:a.createElement(a.Fragment,null,a.createElement("path",{d:"M9.795 1.694a4.287 4.287 0 0 1 6.061 0 4.28 4.28 0 0 1 1.181 3.819 4.282 4.282 0 0 1 3.819 1.181 4.287 4.287 0 0 1 0 6.061l-6.793 6.793a.249.249 0 0 0 0 .353l2.617 2.618a.75.75 0 1 1-1.061 1.061l-2.617-2.618a1.75 1.75 0 0 1 0-2.475l6.793-6.793a2.785 2.785 0 1 0-3.939-3.939l-5.9 5.9a.734.734 0 0 1-.249.165.749.749 0 0 1-.812-1.225l5.9-5.901a2.785 2.785 0 1 0-3.939-3.939L2.931 10.68A.75.75 0 1 1 1.87 9.619l7.925-7.925Z"}),a.createElement("path",{d:"M12.42 4.069a.752.752 0 0 1 1.061 0 .752.752 0 0 1 0 1.061L7.33 11.28a2.788 2.788 0 0 0 0 3.94 2.788 2.788 0 0 0 3.94 0l6.15-6.151a.752.752 0 0 1 1.061 0 .752.752 0 0 1 0 1.061l-6.151 6.15a4.285 4.285 0 1 1-6.06-6.06l6.15-6.151Z"}))}},p=a.forwardRef(function(e,t){return c(e,t,"octicon octicon-mcp",m,d)});p.displayName="McpIcon";var s=["16","24"],C={16:{width:16,path:a.createElement("path",{d:"M2 2.75C2 1.784 2.784 1 3.75 1h2.5a.75.75 0 0 1 0 1.5h-2.5a.25.25 0 0 0-.25.25v10.5c0 .138.112.25.25.25h2.5a.75.75 0 0 1 0 1.5h-2.5A1.75 1.75 0 0 1 2 13.25Zm6.56 4.5h5.69a.75.75 0 0 1 0 1.5H8.56l1.97 1.97a.749.749 0 0 1-.326 1.275.749.749 0 0 1-.734-.215L6.22 8.53a.75.75 0 0 1 0-1.06l3.25-3.25a.749.749 0 0 1 1.275.326.749.749 0 0 1-.215.734Z"})},24:{width:24,path:a.createElement("path",{d:"M3 3.25c0-.966.784-1.75 1.75-1.75h5.5a.75.75 0 0 1 0 1.5h-5.5a.25.25 0 0 0-.25.25v17.5c0 .138.112.25.25.25h5.5a.75.75 0 0 1 0 1.5h-5.5A1.75 1.75 0 0 1 3 20.75Zm9.994 9.5 3.3 3.484a.75.75 0 0 1-1.088 1.032l-4.5-4.75a.75.75 0 0 1 0-1.032l4.5-4.75a.75.75 0 0 1 1.088 1.032l-3.3 3.484h8.256a.75.75 0 0 1 0 1.5Z"})}},M=a.forwardRef(function(e,t){return c(e,t,"octicon octicon-sign-in",C,s)});M.displayName="SignInIcon";export{i as E,p as M,M as S,r as a};
|