PageSourceSearch

https://humanly.ai/assets/agents-DWRPIyqC.js

js humanly.ai collected 2026-10-05 12:55:02 UTC 12,561 bytes, 1 lines download raw bytes

1import{r as c,u as T,e as L,j as e}from"./vendor-query-BMVjWMJQ.js";import{e as V,i as J,j as P,g as p,B as g,I as U,C as x,t as M,q as _,h as F,k as I,a as b,l as X,m as Z,n as h}from"./index-3d_hI99k.js";import{u as ee,F as se}from"./founder-nudge-DewIwEa0.js";import{S as r}from"./skeleton-iYj2JgDG.js";import{A as te,a as ae,b as re,c as ne,d as le,e as ie,f as de,g as ce,h as oe}from"./alert-dialog-Ck2lbk0I.js";import{a7 as O,a8 as q,a9 as me,aa as xe,B as N,a1 as ue,H as ge,ab as he,ac as pe,y as je}from"./vendor-icons-B30IUJ4q.js";import"./vendor-ui-Pyyb4GUe.js";import"./vendor-flow-Vz_24ecm.js";import"./vendor-charts-D0l4f2Jw.js";function B(s){return s==="Sample: Insurance Claims Agent"?{label:"LangChain",color:"bg-orange-100 text-orange-700 border-orange-200 dark:bg-orange-900/30 dark:text-orange-400 dark:border-orange-800"}:s==="Sample: Telecom Billing Agent"?{label:"LangGraph",color:"bg-blue-100 text-blue-700 border-blue-200 dark:bg-blue-900/30 dark:text-blue-400 dark:border-blue-800"}:s.startsWith("Sample:")?{label:"Prompt-based",color:"bg-gray-100 text-gray-600 border-gray-200 dark:bg-gray-800/50 dark:text-gray-400 dark:border-gray-700"}:null}const R={GOOD:"bg-chart-2/10 text-chart-2 border-chart-2/20",BAD:"bg-destructive/10 text-destructive border-destructive/20",LIAR:"bg-chart-4/10 text-chart-4 border-chart-4/20"};function G({agent:s,onDelete:n,onClone:l}){return e.jsxs("div",{className:"flex items-center gap-1",children:[s.isSample&&e.jsx(g,{size:"icon",variant:"ghost",className:"text-muted-foreground h-7 w-7","data-testid":`button-clone-agent-${s.id}`,onClick:a=>{a.preventDefault(),a.stopPropagation(),l(s.id)},title:"Clone agent",children:e.jsx(pe,{className:"w-3.5 h-3.5"})}),e.jsxs(te,{children:[e.jsx(ae,{asChild:!0,children:e.jsx(g,{size:"icon",variant:"ghost",className:"text-muted-foreground h-7 w-7","data-testid":`button-delete-agent-${s.id}`,onClick:a=>{a.stopPropagation()},children:e.jsx(je,{className:"w-3.5 h-3.5"})})}),e.jsxs(re,{children:[e.jsxs(ne,{children:[e.jsx(le,{children:"Delete Agent"}),e.jsxs(ie,{children:['Are you sure you want to delete "',s.name,'"? This action cannot be undone.']})]}),e.jsxs(de,{children:[e.jsx(ce,{children:"Cancel"}),e.jsx(oe,{onClick:()=>n(s.id),className:"bg-destructive text-destructive-foreground",children:"Delete"})]})]})]})]})}function fe({agent:s,onDelete:n,onClone:l}){const a=s.isSample?B(s.name):null;return e.jsxs(x,{className:"hover-elevate transition-all flex flex-col","data-testid":`card-agent-${s.id}`,children:[e.jsxs(p,{href:`/agents/${s.id}`,className:"flex-1",children:[e.jsx(I,{className:"pb-2 cursor-pointer",children:e.jsxs("div",{className:"flex items-start justify-between gap-2",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"flex items-center justify-center w-9 h-9 rounded-md bg-primary/10 text-primary shrink-0",children:e.jsx(N,{className:"w-4 h-4"})}),e.jsxs("div",{className:"min-w-0",children:[e.jsx(X,{className:"text-sm font-medium leading-tight",children:s.name}),e.jsx(Z,{className:"text-xs mt-0.5",children:s.model})]})]}),e.jsxs("div",{className:"flex items-center gap-1 flex-wrap justify-end shrink-0",children:[a&&e.jsx(h,{variant:"outline",className:`text-xs ${a.color}`,"data-testid":`badge-impl-${s.id}`,children:a.label}),e.jsx(h,{variant:"outline",className:`text-xs ${R[s.defaultMode]||""}`,children:s.defaultMode})]})]})}),e.jsx(b,{className:"pt-0 pb-3 cursor-pointer",children:e.jsxs("p",{className:"text-xs text-muted-foreground line-clamp-2",children:[s.systemPrompt.substring(0,120),"…"]})})]}),e.jsx(b,{className:"pt-0 pb-3",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-3 text-xs text-muted-foreground",children:[e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(ue,{className:"w-3 h-3"}),"RAG ",s.ragEnabled?"On":"Off"]}),e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(ge,{className:"w-3 h-3"}),"Temp ",s.temperature]}),e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(he,{className:"w-3 h-3"}),new Date(s.createdAt).toLocaleDateString()]})]}),e.jsx(G,{agent:s,onDelete:n,onClone:l})]})})]})}function be({agent:s,onDelete:n,onClone:l}){const a=s.isSample?B(s.name):null;return e.jsxs("div",{className:"flex items-center gap-3 px-4 py-3 border-b last:border-b-0 hover:bg-muted/40 transition-colors group","data-testid":`row-agent-${s.id}`,children:[e.jsxs(p,{href:`/agents/${s.id}`,className:"flex items-center gap-3 flex-1 min-w-0 cursor-pointer",children:[e.jsx("div",{className:"w-8 h-8 rounded-md bg-primary/10 flex items-center justify-center shrink-0",children:e.jsx(N,{className:"w-4 h-4 text-primary"})}
1),e.jsxs("div",{className:"min-w-0 w-48 shrink-0",children:[e.jsx("p",{className:"text-sm font-medium truncate",children:s.name}),e.jsx("p",{className:"text-xs text-muted-foreground",children:s.model})]}),e.jsxs("p",{className:"text-xs text-muted-foreground truncate flex-1 hidden md:block",children:[s.systemPrompt.substring(0,100),"…"]})]}),e.jsxs("div",{className:"flex items-center gap-1.5 shrink-0",children:[a&&e.jsx(h,{variant:"outline",className:`text-xs ${a.color}`,children:a.label}),e.jsx(h,{variant:"outline",className:`text-xs ${R[s.defaultMode]||""}`,children:s.defaultMode}),e.jsx("span",{className:"text-xs text-muted-foreground hidden lg:block w-20 text-right",children:new Date(s.createdAt).toLocaleDateString()}),e.jsx(G,{agent:s,onDelete:n,onClone:l})]})]})}function Ne(){return e.jsxs(x,{children:[e.jsx(I,{className:"pb-3",children:e.jsxs("div",{className:"flex items-start justify-between gap-2",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(r,{className:"w-9 h-9 rounded-md"}),e.jsxs("div",{children:[e.jsx(r,{className:"h-4 w-32 mb-1"}),e.jsx(r,{className:"h-3 w-20"})]})]}),e.jsx(r,{className:"h-5 w-12"})]})}),e.jsxs(b,{className:"pt-0",children:[e.jsx(r,{className:"h-8 w-full mb-3"}),e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx(r,{className:"h-3 w-14"}),e.jsx(r,{className:"h-3 w-14"}),e.jsx(r,{className:"h-3 w-18"})]})]})]})}function ye(){return e.jsxs("div",{className:"flex items-center gap-3 px-4 py-3 border-b",children:[e.jsx(r,{className:"w-8 h-8 rounded-md shrink-0"}),e.jsx(r,{className:"h-4 w-40"}),e.jsx(r,{className:"h-3 flex-1 hidden md:block"}),e.jsx(r,{className:"h-5 w-14 shrink-0"})]})}function ve(){const{trackEvent:s}=P();return e.jsxs("div",{className:"flex flex-col items-center justify-center py-16 px-4",children:[e.jsx("div",{className:"flex items-center justify-center w-14 h-14 rounded-full bg-muted mb-4",children:e.jsx(N,{className:"w-7 h-7 text-muted-foreground"})}),e.jsx("h3",{className:"text-base font-medium mb-1",children:"No agents yet"}),e.jsx("p",{className:"text-sm text-muted-foreground text-center max-w-sm mb-5",children:"Create your first agent to start testing. You can also clone one of the sample agents as a starting point."}),e.jsx(p,{href:"/agents/new",children:e.jsxs(g,{"data-testid":"button-create-first-agent",onClick:()=>s("create_agent_clicked"),children:[e.jsx(O,{className:"w-4 h-4 mr-2"}),"Create Agent"]})})]})}function we({query:s}){return e.jsxs("div",{className:"flex flex-col items-center justify-center py-12 px-4",children:[e.jsx(q,{className:"w-8 h-8 text-muted-foreground/40 mb-3"}),e.jsxs("p",{className:"text-sm text-muted-foreground",children:['No agents match "',e.jsx("strong",{children:s}),'"']})]})}function Me(){const{toast:s}=V(),{setPageContext:n,autoOpenHelpForPage:l}=J(),{trackEvent:a}=P(),[u,y]=c.useState("my"),[i,v]=c.useState(()=>{try{return localStorage.getItem("agents_view_mode")||"grid"}catch{return"grid"}}),[o,w]=c.useState(""),{data:H}=T({queryKey:["/api/admin/check"],retry:!1}),K=H?.isAdmin===!0,{data:d,isLoading:j,error:z}=T({queryKey:["/api/agents"]}),f=d?.filter(t=>!t.isSample)??[],A=d?.filter(t=>t.isSample)??[],Q=f.length>0,k=ee("idle_agents",{enabled:!Q,isAdmin:K}),C=u==="my"?f:A,m=o.trim()?C.filter(t=>t.name.toLowerCase().includes(o.toLowerCase())):C;c.useEffect(()=>{try{localStorage.setItem("agents_view_mode",i)}catch{}},[i]),c.useEffect(()=>{l("agents","Welcome! You have sample agents pre-loaded to explore. Try cloning one and customizing it, or create your own from scratch.")},[l]),c.useEffect(()=>{d&&n({pageName:"Agents",pageDescription:"Manage AI agents that will be tested using synthetic users.",data:{totalAgents:d.length,agents:d.map(t=>({id:t.id,name:t.name,model:t.model,mode:t.defaultMode,ragEnabled:t.ragEnabled}))}})},[d,n]);const W=L({mutationFn:async t=>{await F("DELETE",`/api/agents/${t}`)},onSuccess:()=>{M("agent_deleted"),s({title:"Agent deleted",description:"The agent has been removed."}),_.invalidateQueries({queryKey:["/api/agents"]})},onError:()=>{s({title:"Error",description:"Failed to delete agent.",variant:"destructive"})}}),Y=L({mutationFn:async t=>(await F("POST",`/api/agents/${t}/clone`)).json(),onSuccess:()=>{M("agent_cloned"),s({title:"Agent cloned",description:"A copy has been created in My Agents."}
1),_.invalidateQueries({queryKey:["/api/agents"]}),y("my")},onError:()=>{s({title:"Error",description:"Failed to clone agent.",variant:"destructive"})}}),S=t=>W.mutate(t),D=t=>Y.mutate(t);return e.jsxs("div",{className:"p-6 lg:p-8 max-w-7xl mx-auto",children:[e.jsxs("div",{className:"flex items-center justify-between gap-4 mb-6",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl font-semibold",children:"Agents"}),e.jsx("p",{className:"text-sm text-muted-foreground mt-0.5",children:"Configure and manage the agents you want to test"})]}),e.jsx(p,{href:"/agents/new",children:e.jsxs(g,{"data-testid":"button-create-agent",onClick:()=>a("create_agent_clicked"),children:[e.jsx(O,{className:"w-4 h-4 mr-2"}),"Create Agent"]})})]}),e.jsxs("div",{className:"flex flex-col sm:flex-row items-start sm:items-center justify-between gap-3 mb-4",children:[e.jsx("div",{className:"flex items-center gap-1 bg-muted/50 rounded-lg p-1","data-testid":"tab-bar-agents",children:[{id:"my",label:"My Agents",count:j?null:f.length},{id:"samples",label:"Samples",count:j?null:A.length}].map(({id:t,label:E,count:$})=>e.jsxs("button",{onClick:()=>{y(t),w("")},className:`flex items-center gap-1.5 px-3 py-1.5 rounded-md text-sm font-medium transition-all ${u===t?"bg-background shadow-sm text-foreground":"text-muted-foreground hover:text-foreground"}`,"data-testid":`tab-${t}`,children:[E,$!==null&&e.jsx("span",{className:`text-xs px-1.5 py-0 rounded-full ${u===t?"bg-primary/10 text-primary":"bg-muted text-muted-foreground"}`,children:$})]},t))}),e.jsxs("div",{className:"flex items-center gap-2 w-full sm:w-auto",children:[e.jsxs("div",{className:"relative flex-1 sm:w-52",children:[e.jsx(q,{className:"absolute left-2.5 top-1/2 -translate-y-1/2 w-3.5 h-3.5 text-muted-foreground"}),e.jsx(U,{placeholder:"Search agents…",value:o,onChange:t=>w(t.target.value),className:"pl-8 h-8 text-sm","data-testid":"input-search-agents"})]}),e.jsxs("div",{className:"flex items-center border rounded-md overflow-hidden",children:[e.jsx("button",{onClick:()=>v("grid"),className:`p-1.5 transition-colors ${i==="grid"?"bg-primary text-primary-foreground":"text-muted-foreground hover:bg-muted"}`,title:"Grid view","data-testid":"button-view-grid",children:e.jsx(me,{className:"w-3.5 h-3.5"})}),e.jsx("button",{onClick:()=>v("list"),className:`p-1.5 transition-colors ${i==="list"?"bg-primary text-primary-foreground":"text-muted-foreground hover:bg-muted"}`,title:"List view","data-testid":"button-view-list",children:e.jsx(xe,{className:"w-3.5 h-3.5"})})]})]})]}),z?e.jsx(x,{className:"p-8",children:e.jsx("div",{className:"text-center text-destructive",children:"Failed to load agents. Please try again."})}):j?i==="grid"?e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:[1,2,3].map(t=>e.jsx(Ne,{},t))}):e.jsx(x,{children:e.jsx("div",{className:"divide-y",children:[1,2,3,4].map(t=>e.jsx(ye,{},t))})}):m.length===0&&o.trim()?e.jsx(we,{query:o}):m.length===0&&u==="my"?e.jsx(ve,{}):m.length===0?e.jsx("div",{className:"text-center py-12 text-sm text-muted-foreground",children:"No sample agents found."}):i==="grid"?e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:m.map(t=>e.jsx(fe,{agent:t,onDelete:S,onClone:D},t.id))}):e.jsx(x,{children:e.jsx("div",{className:"divide-y",children:m.map(t=>e.jsx(be,{agent:t,onDelete:S,onClone:D},t.id))})}),e.jsx(se,{visible:k.visible,onDismiss:k.dismiss})]})}export{Me as default};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.