PageSourceSearch

https://app.peerx.ai/assets/custom-agents-CBJX9YC_.js

js peerx.ai collected 2026-10-05 12:26:43 UTC 11,609 bytes, 3 lines download raw bytes

1import{j as e,p as g,H as f,a2 as ie,a0 as oe,r as l,e as u,C as q,K as re,M as le,Q,f as W,a3 as Y,A as ce,F as R,I as de,X as K,U as me}from"./index-CxO6BPM2.js";import{P as ue,a as he,b as pe}from"./PortalLayout-vfu0ia6x.js";import{C as xe}from"./check-DrR6ne-M.js";import{c as J,b as ge,f as Z}from"./format-BZR8EWyr.js";import{p as ee,P as fe,S as je,e as te}from"./kit-BYSIR37U.js";import"./shield-check-DXFWcWX1.js";function ye({steps:s,current:i,variant:r="steps",orientation:d="auto",reviewIndex:S,label:k,className:P}){const E=S??Math.max(0,s.findIndex(h=>h.toLowerCase()==="review")),T=d==="horizontal"?"flex-row":d==="vertical"?"flex-col":"flex-col sm:flex-row";return e.jsx("ol",{"aria-label":k,className:g("flex gap-0",T,P),children:s.map((h,p)=>{const c=p<i,x=p===i,y=p===s.length-1,A=r==="lifecycle"?p<E?"border-dashed border-pencil-500":"border-solid border-prussian-600":c?"border-solid border-ink-600":"border-dashed border-ink-300";return e.jsxs("li",{"aria-current":x?"step":void 0,className:g("relative flex min-w-0 flex-1 gap-3",d==="horizontal"?"flex-col":"flex-row sm:flex-col",y&&"flex-none sm:flex-1"),children:[e.jsxs("div",{className:g("flex items-center",d==="horizontal"?"flex-row":"flex-col sm:flex-row"),children:[e.jsx("span",{className:g("inline-flex h-7 w-7 shrink-0 items-center justify-center rounded-full text-small font-bold",x&&"bg-prussian-600 text-white",c&&"bg-ink-600 text-white",!c&&!x&&"bg-white text-ink-600 shadow-[inset_0_0_0_1.5px_rgb(var(--ink-300))]"),children:c?e.jsx(xe,{className:"h-4 w-4","aria-hidden":"true"}):p+1}),!y&&e.jsx("span",{"aria-hidden":"true",className:g("m-1 border-0",d==="horizontal"?"h-0 flex-1 border-t-2":"min-h-[16px] w-0 flex-1 border-l-2 sm:h-0 sm:min-h-0 sm:w-auto sm:border-l-0 sm:border-t-2",A)})]}),e.jsxs("span",{className:g("pb-4 text-small sm:pb-0 sm:pr-2",x?"font-semibold text-ink-900":"text-ink-600"),children:[h,c&&e.jsx("span",{className:"sr-only",children:" (done)"})]})]},h)})})}const j="/enterprise/custom-agents",I={list:async(s,i=1,r=20)=>{const{data:d}=await f.get(j,{params:{stage:s,page:i,limit:r}});return d.data},create:async s=>{const{data:i}=await f.post(j,s);return i.data},get:async s=>{const{data:i}=await f.get(`${j}/${s}`);return i.data},update:async(s,i)=>{const{data:r}=await f.put(`${j}/${s}`,i);return r.data},advanceStage:async(s,i)=>{const{data:r}=await f.post(`${j}/${s}/advance`,i||{});return r.data},retire:async s=>{const{data:i}=await f.post(`${j}/${s}/retire`);return i.data}},O=["REQUEST","SCOPING","PROPOSAL","APPROVED","DEVELOPMENT","TESTING","UAT","PILOT","PRODUCTION","MAINTENANCE"],we=["Requested","Scoping","Proposal","Accepted","Development","Testing","Your testing","Pilot","Live","Maintenance"],be={REQUEST:{word:"Requested",tone:"moving"},SCOPING:{word:"Being scoped",tone:"moving"},PROPOSAL:{word:"Proposal waiting for you",tone:"yours"},APPROVED:{word:"Proposal accepted",tone:"moving"},DEVELOPMENT:{word:"In development",tone:"moving"},TESTING:{word:"Being tested",tone:"moving"},UAT:{word:"Ready for your testing",tone:"yours"},PILOT:{word:"In pilot",tone:"moving"},PRODUCTION:{word:"Live",tone:"done"},MAINTENANCE:{word:"Live, maintained",tone:"done"},RETIRED:{word:"Retired",tone:"parked"}},N=s=>be[String(s).toUpperCase()]??{word:s,tone:"neutral"},z={PROPOSAL:{action:"Accept proposal",title:s=>`Accept the proposal for ${s}?`,body:"This tells the PeerX team to start building the agent as proposed.",done:"Proposal accepted. The build can start."},UAT:{action:"Sign off testing",title:s=>`Sign off testing for ${s}?`,body:"This confirms the agent works for your team and moves it to a pilot.",done:"Testing signed off. The agent moves to a pilot."}},ve=["low","medium","high","critical"],V=s=>s&&ve.includes(s.toLowerCase())?s.toLowerCase():void 0,se={name:"",description:"",priority:"medium",useCases:""};function Te(){const s=ie(),i=oe(),[r,d]=l.useState([]),[S,k]=l.useState(!0),[P,E]=l.useState(!1),[T,h]=l.useState(null),[p,c]=l.useState(!1),[x,y]=l.useState(!1),[A,L]=l.useState(null),[X,F]=l.useState({}),[o,w]=l.useState(se),[a,b]=l.useState(null),v=l.useCallback(()=>{k(!0),E(!1),I.list().then(t=>d((t==null?void 0:t.requests)||(Array.isArray(t)?t:[]))).catch(()=>{d([]),E(!0)}).finally(()=>k(!1))},[]);l.useEffect(()=>
1{v()},[v]);const ae=t=>{b(t),I.get(t.id).then(n=>{(n==null?void 0:n.id)===t.id&&b(n)}).catch(()=>{})},G=async()=>{const t={};if(o.name.trim()||(t.name="Give the agent a working name."),o.description.trim().length<10&&(t.description="Describe the job in at least 10 characters."),F(t),!Object.keys(t).length){y(!0),L(null);try{const n=o.useCases.split(`
2`).map(C=>C.trim()).filter(Boolean);await I.create({name:o.name.trim(),description:o.description.trim(),priority:o.priority,useCases:n.length?n:void 0}),c(!1),w(se),i.show({title:"Request sent to the PeerX team.",body:o.name.trim(),tone:"success"}),v()}catch(n){L(te(n,"Couldn't send the request. Check the fields, then try again."))}finally{y(!1)}}},H=async t=>{const n=z[String(t.stage).toUpperCase()];if(!(!n||!await s({title:n.title(t.name),body:n.body,confirmLabel:n.action}))){h(t.id);try{const m=await I.advanceStage(t.id);i.show({title:n.done,body:t.name,tone:"success"}),(a==null?void 0:a.id)===t.id&&(m!=null&&m.id)&&b(m),v()}catch(m){i.show({title:`Couldn't record that for ${t.name}.`,body:te(m,"Nothing was changed. Try again."),tone:"danger"})}finally{h(null)}}},D=r.filter(t=>N(t.stage).tone==="yours").length,$=r.filter(t=>N(t.stage).tone==="moving").length,ne=S||P?"Ask the PeerX team to build an agent for a job your organization does often, and follow it to launch.":r.length===0?"No requests yet. Describe a job and the PeerX team scopes an agent for it.":[D?`${ee(D,"request is","requests are")} waiting for you`:null,$?`${$.toLocaleString()} with the PeerX team`:null].filter(Boolean).join(", ")+(D||$?".":`${ee(r.length,"request","requests")}.`),_=a?String(a.stage).toUpperCase():"",U=O.indexOf(_),B=a?z[_]:void 0;return e.jsxs(ue,{children:[e.jsxs("div",{className:fe,children:[e.jsx(he,{title:"Custom agents",description:ne,actions:e.jsx(u,{variant:"primary",leadingIcon:e.jsx(pe,{className:"h-4 w-4","aria-hidden":"true"}),onClick:()=>{F({}),L(null),c(!0)},children:"Request an agent"})}),e.jsxs(q,{as:"section","aria-labelledby":"ca-requests-title",children:[e.jsx(q.Header,{title:"Requests",titleId:"ca-requests-title"}),S?e.jsx(je,{label:"Loading custom agent requests"}):P?e.jsx(re,{title:"Couldn't load your requests.",description:"Try again in a moment.",onRetry:v,className:"px-[18px]"}):r.length===0?e.jsx(le,{title:"No custom agent requests yet.",description:"Describe a job your team does often. The PeerX team scopes it, sends you a proposal, and builds the agent once you accept.",action:e.jsx(u,{size:"sm",variant:"primary",onClick:()=>c(!0),children:"Request an agent"}),className:"px-[18px]"}):e.jsx("ul",{className:"divide-y divide-ink-200",children:r.map(t=>{const n=N(t.stage),C=O.indexOf(String(t.stage).toUpperCase()),m=V(t.priority),M=z[String(t.stage).toUpperCase()];return e.jsxs("li",{className:"flex flex-col gap-3 px-[18px] py-3 sm:flex-row sm:items-center",children:[e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxs("p",{className:"flex flex-wrap items-center gap-2",children:[e.jsx("span",{className:"font-semibold text-ink-900",children:t.name}),m&&e.jsx(Q,{level:m})]}),e.jsx("p",{className:"line-clamp-1 text-body-ui text-ink-700",children:t.description}),e.jsx("p",{className:"text-small text-ink-600",children:[C>=0?`Stage ${C+1} of ${O.length}`:null,t.estimated_cost?`estimated ${J(t.estimated_cost,"USD",{cents:!1})}`:null,`requested ${ge(t.created_at)}`].filter(Boolean).join(", ")})]}),e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsx(W,{tone:n.tone,children:n.word}),M&&e.jsx(u,{size:"sm",variant:"primary",loading:T===t.id,onClick:()=>H(t),"aria-label":`${M.action} for ${t.name}`,children:M.action}),e.jsx(u,{size:"sm",onClick:()=>ae(t),"aria-label":`View ${t.name}`,children:"View"})]})]},t.id)})})]})]}),e.jsx(Y,{open:p,onClose:()=>c(!1),title:"Request an agent",description:"The PeerX team reads every request, scopes it, and sends you a proposal to accept.",footer:e.jsxs(e.Fragment,{children:[e.jsx(u,{onClick:()=>c(!1),children:"Cancel"}),e.jsx(u,{variant:"primary",loading:x,onClick:G,children:"Send request"})]}),children:e.jsxs("form",{className:"flex flex-col gap-4",onSubmit:t=>{t.preventDefault(),G()},noValidate:!0,children:[A&&e.jsx(ce,{tone:"danger",children:A}),e.jsx(R,{label:"Working name",error:X.name,children:t=>e.jsx(de,{...t,value:o.name,onChange:n=>w({...o,name:n.target.value}),placeholder:"Invoice processing agent"})}),e.jsx(R,{label:"What should it do?",hint:"At least 10 characters. Name the job, the inputs and what a good result looks like.",error:X.description,children:t=>e.jsx(K,{...t,rows:4,value:o.description,onChange:n=>w({...o,description:n.target.value})})}),e.jsx(R,{label:"Example tasks",optional:!0,hint:"One per line.",children:t=>e.jsx(K,{...t,rows:3,value:o.useCases,onChange:n=>w({...o,useCases:n.target.value}),placeholder:`Match invoices to purchase orders
3Flag duplicate invoices`})}),e.jsx(R,{label:"Priority",className:"sm:w-56",children:t=>e.jsxs(me,{...t,value:o.priority,onChange:n=>w({...o,priority:n.target.value}),children:[e.jsx("option",{value:"low",children:"Low"}),e.jsx("option",{value:"medium",children:"Medium"}),e.jsx("option",{value:"high",children:"High"}),e.jsx("option",{value:"critical",children:"Critical"})]})})]})}),e.jsx(Y,{open:!!a,onClose:()=>b(null),title:(a==null?void 0:a.name)??"Custom agent",description:a?`Requested ${Z(a.created_at)}`:void 0,size:"lg",footer:e.jsxs(e.Fragment,{children:[e.jsx(u,{onClick:()=>b(null),children:"Close"}),a&&B&&e.jsx(u,{variant:"primary",loading:T===a.id,onClick:()=>H(a),children:B.action})]}),children:a&&e.jsxs("div",{className:"flex flex-col gap-5",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsx(W,{tone:N(a.stage).tone,children:N(a.stage).word}),V(a.priority)&&e.jsx(Q,{level:V(a.priority)})]}),e.jsx("p",{className:"whitespace-pre-wrap text-body text-ink-800",children:a.description}),Array.isArray(a.use_cases)&&a.use_cases.length>0&&e.jsxs("div",{children:[e.jsx("h3",{className:"mb-1 text-h4 text-ink-900",children:"Example tasks"}),e.jsx("ul",{className:"list-disc pl-5 text-body-ui text-ink-700",children:a.use_cases.map((t,n)=>e.jsx("li",{children:t},n))})]}),e.jsxs("dl",{className:"grid grid-cols-1 gap-x-6 gap-y-3 text-body-ui sm:grid-cols-2",children:[e.jsxs("div",{children:[e.jsx("dt",{className:"text-label text-ink-600",children:"Estimated cost"}),e.jsx("dd",{className:"tabular-nums text-ink-900",children:a.estimated_cost?J(
3a.estimated_cost,"USD",{code:!0,cents:!1}):"Not estimated yet"})]}),e.jsxs("div",{children:[e.jsx("dt",{className:"text-label text-ink-600",children:"Expected launch"}),e.jsx("dd",{className:"text-ink-900",children:a.estimated_completion?Z(a.estimated_completion):"Not scheduled yet"})]})]}),_==="RETIRED"?e.jsx("p",{className:"text-body-ui text-ink-700",children:"This agent is retired and no longer runs."}):U>=0?e.jsxs("section",{"aria-labelledby":"ca-track-title",children:[e.jsx("h3",{id:"ca-track-title",className:"mb-3 text-h4 text-ink-900",children:"Where it is"}),e.jsx(ye,{steps:we,current:U,orientation:"vertical",label:"Build stages"}),!B&&U<O.length-2&&e.jsx("p",{className:"mt-3 text-small text-ink-600",children:"The PeerX team moves it to the next stage. You'll be asked to accept the proposal and to sign off testing."})]}):null]})})]})}export{Te as CustomAgentsPage};

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.