local-operator-ui 0.31.5 → 0.31.6
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/out/main/index.js +151 -9
- package/out/renderer/assets/{_basePickBy-BFnTyl9Q.js → _basePickBy-CGLVGNHn.js} +1 -1
- package/out/renderer/assets/{_baseUniq-DD9jcRtU.js → _baseUniq-6RtLbuuN.js} +1 -1
- package/out/renderer/assets/agent-details-page-Dq1-pmjJ.js +6 -0
- package/out/renderer/assets/agent-hub-page-DDslXUso.js +6 -0
- package/out/renderer/assets/agents-page-Cn5t3IkR.js +2 -0
- package/out/renderer/assets/arc-CqB6YrvF.js +1 -0
- package/out/renderer/assets/{architectureDiagram-IEHRJDOE-7e2mo6tq.js → architectureDiagram-IEHRJDOE-BsWj-SB2.js} +1 -1
- package/out/renderer/assets/{blockDiagram-JOT3LUYC-BVljD84R.js → blockDiagram-JOT3LUYC-DjuQQrO2.js} +1 -1
- package/out/renderer/assets/{book-open-B8nHgs3o.js → book-open-DI1UBxnn.js} +1 -1
- package/out/renderer/assets/browser-page-C8W7mUVJ.js +1 -0
- package/out/renderer/assets/{browser-webauthn-prompt-BiNyKO73.js → browser-webauthn-prompt-CpHuczqZ.js} +1 -1
- package/out/renderer/assets/{c4Diagram-VJAJSXHY-JwdJCFiM.js → c4Diagram-VJAJSXHY-DfqMyqGt.js} +1 -1
- package/out/renderer/assets/channel-DG4irCIe.js +1 -0
- package/out/renderer/assets/{chunk-4BMEZGHF-ysuKUzF3.js → chunk-4BMEZGHF-B7fJK-xk.js} +1 -1
- package/out/renderer/assets/{chunk-A2AXSNBT-DsztjjTP.js → chunk-A2AXSNBT-CYCL2Vnh.js} +1 -1
- package/out/renderer/assets/{chunk-AEK57VVT-pv5-Z61i.js → chunk-AEK57VVT-07JQHm7w.js} +1 -1
- package/out/renderer/assets/{chunk-D6G4REZN-B0HKfeJ8.js → chunk-D6G4REZN-Dk1JIt6P.js} +1 -1
- package/out/renderer/assets/{chunk-RZ5BOZE2-DNjaGyn6.js → chunk-RZ5BOZE2-BLq7IQcw.js} +1 -1
- package/out/renderer/assets/{chunk-XZIHB7SX-CB3yOZ7o.js → chunk-XZIHB7SX-sn_IP0cx.js} +1 -1
- package/out/renderer/assets/classDiagram-GIVACNV2-Bn3g2tY9.js +1 -0
- package/out/renderer/assets/classDiagram-v2-COTLJTTW-Bn3g2tY9.js +1 -0
- package/out/renderer/assets/clone-hlCMGtcg.js +1 -0
- package/out/renderer/assets/{console-mirror-BoykuSNB.js → console-mirror-CpiNswSB.js} +1 -1
- package/out/renderer/assets/{consoleCapture-Cujhy7_W.js → consoleCapture-Dawe559T.js} +1 -1
- package/out/renderer/assets/{dagre-OKDRZEBW-DscYjoQb.js → dagre-OKDRZEBW-BH1-vZrD.js} +1 -1
- package/out/renderer/assets/{diagram-SSKATNLV-MR2_cP2x.js → diagram-SSKATNLV-BB2zhdj2.js} +1 -1
- package/out/renderer/assets/{diagram-VNBRO52H-BmkFh4Vx.js → diagram-VNBRO52H-DoIDnsFj.js} +1 -1
- package/out/renderer/assets/{erDiagram-Q7BY3M3F-D07ZEVLp.js → erDiagram-Q7BY3M3F-CFI6DH5z.js} +1 -1
- package/out/renderer/assets/{error-boundary-BX3Jjofp.js → error-boundary-DtDjc7C4.js} +2 -2
- package/out/renderer/assets/{flowDiagram-4HSFHLVR-DvEjarQP.js → flowDiagram-4HSFHLVR-R35rZly5.js} +1 -1
- package/out/renderer/assets/{ganttDiagram-APWFNJXF-D5UFT4S7.js → ganttDiagram-APWFNJXF-BwH-YH2d.js} +4 -4
- package/out/renderer/assets/{gitGraphDiagram-7IBYFJ6S-DH2UEbHf.js → gitGraphDiagram-7IBYFJ6S-B9Ij_MPV.js} +1 -1
- package/out/renderer/assets/{graph-BKMaU8e_.js → graph-B6vab2kN.js} +1 -1
- package/out/renderer/assets/{index-BZWSvhnc.js → index-30UPLouO.js} +1 -1
- package/out/renderer/assets/index-CBxomwo0.js +7 -0
- package/out/renderer/assets/{index-DyfVjYXR.js → index-gd7H8-q6.js} +392 -387
- package/out/renderer/assets/index-rZRMapOd.css +1 -0
- package/out/renderer/assets/{infoDiagram-PH2N3AL5-BB9p2nRT.js → infoDiagram-PH2N3AL5-BoFC5xGX.js} +1 -1
- package/out/renderer/assets/{installer-1ycbb4_E.js → installer-DrfIP-VV.js} +1 -1
- package/out/renderer/assets/{journeyDiagram-U35MCT3I-Dt2T-pPF.js → journeyDiagram-U35MCT3I-D8hZEZM9.js} +1 -1
- package/out/renderer/assets/{kanban-definition-NDS4AKOZ-BxdASKeG.js → kanban-definition-NDS4AKOZ-CfK7CfsY.js} +1 -1
- package/out/renderer/assets/{layout-BOJV8F98.js → layout-9INEUX4j.js} +1 -1
- package/out/renderer/assets/legacy-agents-page-DYFr_Ms9.js +38 -0
- package/out/renderer/assets/{mermaid.core-Dm5FgUKb.js → mermaid.core-J-3igmgd.js} +19 -19
- package/out/renderer/assets/mesh-page-BR-tHXFg.js +1 -0
- package/out/renderer/assets/{mindmap-definition-ALO5MXBD-C54cCZAD.js → mindmap-definition-ALO5MXBD-BiJ-Ieo8.js} +1 -1
- package/out/renderer/assets/org-surface-gate-Dvz4sPXB.js +1 -0
- package/out/renderer/assets/{page-header-DtDPxJCD.js → page-header-B9QalVj7.js} +1 -1
- package/out/renderer/assets/{pieDiagram-IB7DONF6-CrhdJ9uV.js → pieDiagram-IB7DONF6-Cjt4ER3c.js} +1 -1
- package/out/renderer/assets/{projects-page-DRQqnIMU.js → projects-page-CMQ2URwK.js} +3 -3
- package/out/renderer/assets/{quadrantDiagram-7GDLP6J5-BWSQJ0gX.js → quadrantDiagram-7GDLP6J5--_022w7n.js} +1 -1
- package/out/renderer/assets/{radar-MK3ICKWK-CJpp5uw3.js → radar-MK3ICKWK-m7dr7eu0.js} +1 -1
- package/out/renderer/assets/radient-auth-buttons-BCb9PgbG.js +1 -0
- package/out/renderer/assets/{requirementDiagram-KVF5MWMF-B7hVsPNs.js → requirementDiagram-KVF5MWMF-BAi8whQW.js} +1 -1
- package/out/renderer/assets/{sankeyDiagram-QLVOVGJD-BJT1eAxQ.js → sankeyDiagram-QLVOVGJD-BuunvXYL.js} +1 -1
- package/out/renderer/assets/{schedules-page-Br3MWcWr.js → schedules-page-fhJg4v1A.js} +1 -1
- package/out/renderer/assets/{sequenceDiagram-X6HHIX6F-DxQHWkSx.js → sequenceDiagram-X6HHIX6F-DROalkBZ.js} +1 -1
- package/out/renderer/assets/{settings-page-Cz2ODzjH.js → settings-page-UoDbqEse.js} +14 -14
- package/out/renderer/assets/settings-section-BTFkBz1F.js +6 -0
- package/out/renderer/assets/{stateDiagram-DGXRK772-7zKxJIA5.js → stateDiagram-DGXRK772-I2ycj_Cg.js} +1 -1
- package/out/renderer/assets/stateDiagram-v2-YXO3MK2T-Bt6AfJJN.js +1 -0
- package/out/renderer/assets/{timeline-definition-BDJGKUSR-CKvl8Sf0.js → timeline-definition-BDJGKUSR-CXcA6v6z.js} +1 -1
- package/out/renderer/assets/use-download-agent-mutation-wvsX88DW.js +61 -0
- package/out/renderer/assets/use-memberships-query-7cBHUXI2.js +1 -0
- package/out/renderer/assets/{xychartDiagram-VJFVF3MP-B2w5N_2D.js → xychartDiagram-VJFVF3MP-TPcfOSE-.js} +3 -3
- package/out/renderer/console-capture.html +4 -4
- package/out/renderer/index.html +5 -5
- package/out/renderer/installer.html +4 -4
- package/package.json +2 -2
- package/out/renderer/assets/agent-details-page-G90FKyVP.js +0 -6
- package/out/renderer/assets/agent-hub-page-BaU9D2Uf.js +0 -6
- package/out/renderer/assets/agents-page-BWmJb3M1.js +0 -2
- package/out/renderer/assets/arc-D4G69weg.js +0 -1
- package/out/renderer/assets/browser-page-Dc7F-WKs.js +0 -1
- package/out/renderer/assets/channel-DY5WkW10.js +0 -1
- package/out/renderer/assets/classDiagram-GIVACNV2-mWo2wa6Q.js +0 -1
- package/out/renderer/assets/classDiagram-v2-COTLJTTW-mWo2wa6Q.js +0 -1
- package/out/renderer/assets/clone-Cbm34QyD.js +0 -1
- package/out/renderer/assets/compact-pagination-CEfQ3P1V.js +0 -1
- package/out/renderer/assets/index-D4l3Ha6i.js +0 -7
- package/out/renderer/assets/index-YlW7OZrX.css +0 -1
- package/out/renderer/assets/legacy-agents-page-DlUvUwjx.js +0 -38
- package/out/renderer/assets/publication-validation-Cke6xOnn.js +0 -1
- package/out/renderer/assets/radient-auth-buttons-DPiKAtaZ.js +0 -6
- package/out/renderer/assets/stateDiagram-v2-YXO3MK2T-3TyB4Xbk.js +0 -1
- package/out/renderer/assets/use-download-agent-mutation-yItIUILb.js +0 -61
- /package/out/renderer/assets/{index-hIJSZMtz.js → index-CSEVqIl1.js} +0 -0
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import{r,j as e,c as R}from"./index-hIJSZMtz.js";import{P as Ye}from"./page-header-DtDPxJCD.js";import{c as Q,D as _e,s as Ie,B as T,t as Se,u as B,S as De,T as q,I as Ee,v as Fe,C as Ze,w as re,L as oe,p as Pe,X as Te,P as Je,x as Xe,y as et,A as ne,h as de,i as ee,r as tt,z as at,l as st,m as nt}from"./error-boundary-BX3Jjofp.js";import{bf as it,bg as Le,bh as Ue,bi as he,bj as pe,bk as ot,av as rt,bl as je,bm as lt,g as Re,f as Oe,bn as fe,bd as K,ar as qe,as as ct,bo as dt,al as te,a as ut,bp as mt,bq as ht,ak as Me,br as pt,ay as Y,az as ie,P as ze,bs as xt,bt as G,bu as F,bv as ft,bw as gt,bx as bt,by as yt,ax as jt,b7 as kt,bz as vt,B as ge,bA as $e,bB as wt,be as xe,h as be,c as Nt,a6 as Ct,a5 as _t,am as Ae,bC as Be,bD as It,bE as He,r as St,bF as Dt,bG as Et,bH as ke}from"./index-DyfVjYXR.js";import{I as Pt,a as ue,N as Tt,R as ve}from"./radient-auth-buttons-DPiKAtaZ.js";import{C as Lt}from"./compact-pagination-CEfQ3P1V.js";import{c as Ut,p as Rt,u as Ot}from"./console-mirror-BoykuSNB.js";import{i as qt,p as Mt,t as zt,b as we}from"./publication-validation-Cke6xOnn.js";/**
|
|
2
|
-
* @license lucide-react v0.507.0 - ISC
|
|
3
|
-
*
|
|
4
|
-
* This source code is licensed under the ISC license.
|
|
5
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
6
|
-
*/const $t=[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M3 10h18",key:"8toen8"}]],At=Q("calendar",$t);/**
|
|
7
|
-
* @license lucide-react v0.507.0 - ISC
|
|
8
|
-
*
|
|
9
|
-
* This source code is licensed under the ISC license.
|
|
10
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
11
|
-
*/const Bt=[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"12",cy:"5",r:"1",key:"gxeob9"}],["circle",{cx:"12",cy:"19",r:"1",key:"lyex9k"}]],Ht=Q("ellipsis-vertical",Bt);/**
|
|
12
|
-
* @license lucide-react v0.507.0 - ISC
|
|
13
|
-
*
|
|
14
|
-
* This source code is licensed under the ISC license.
|
|
15
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
16
|
-
*/const Wt=[["path",{d:"M4 22h14a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v4",key:"1pf5j1"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M2 15h10",key:"jfw4w8"}],["path",{d:"m9 18 3-3-3-3",key:"112psh"}]],Ne=Q("file-input",Wt);/**
|
|
17
|
-
* @license lucide-react v0.507.0 - ISC
|
|
18
|
-
*
|
|
19
|
-
* This source code is licensed under the ISC license.
|
|
20
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
21
|
-
*/const Vt=[["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M4 7V4a2 2 0 0 1 2-2 2 2 0 0 0-2 2",key:"1vk7w2"}],["path",{d:"M4.063 20.999a2 2 0 0 0 2 1L18 22a2 2 0 0 0 2-2V7l-5-5H6",key:"1jink5"}],["path",{d:"m5 11-3 3",key:"1dgrs4"}],["path",{d:"m5 17-3-3h10",key:"1mvvaf"}]],Kt=Q("file-output",Vt);/**
|
|
22
|
-
* @license lucide-react v0.507.0 - ISC
|
|
23
|
-
*
|
|
24
|
-
* This source code is licensed under the ISC license.
|
|
25
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
26
|
-
*/const Qt=[["line",{x1:"6",x2:"6",y1:"3",y2:"15",key:"17qcm7"}],["circle",{cx:"18",cy:"6",r:"3",key:"1h7g24"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}],["path",{d:"M18 9a9 9 0 0 1-9 9",key:"n2h4wq"}]],Gt=Q("git-branch",Qt);/**
|
|
27
|
-
* @license lucide-react v0.507.0 - ISC
|
|
28
|
-
*
|
|
29
|
-
* This source code is licensed under the ISC license.
|
|
30
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
31
|
-
*/const Yt=[["path",{d:"M16 10h2",key:"8sgtl7"}],["path",{d:"M16 14h2",key:"epxaof"}],["path",{d:"M6.17 15a3 3 0 0 1 5.66 0",key:"n6f512"}],["circle",{cx:"9",cy:"11",r:"2",key:"yxgjnd"}],["rect",{x:"2",y:"5",width:"20",height:"14",rx:"2",key:"qneu4z"}]],Ft=Q("id-card",Yt);/**
|
|
32
|
-
* @license lucide-react v0.507.0 - ISC
|
|
33
|
-
*
|
|
34
|
-
* This source code is licensed under the ISC license.
|
|
35
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
36
|
-
*/const Zt=[["path",{d:"M12 3v12",key:"1x0j5s"}],["path",{d:"m8 11 4 4 4-4",key:"1dohi6"}],["path",{d:"M8 5H4a2 2 0 0 0-2 2v10a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V7a2 2 0 0 0-2-2h-4",key:"1ywtjm"}]],Jt=Q("import",Zt),Xt=({agentId:t,agentName:s,onAgentDeleted:a,buttonSx:i={},isAgentsPage:n=!1,onViewAgentSettings:o,onChatWithAgent:l,onExportAgent:x,onClearConversation:m,onUploadAgentToHub:j})=>{const[h,y]=r.useState(!1),[c,d]=r.useState(!1),[u,f]=r.useState(!1),k=r.useRef(!1),S=it(),{clearAgentFromAllPages:_}=Le(),L=async()=>{try{await S.mutateAsync(t),_(t),a?.(t)}catch(w){console.error("Failed to delete agent:",w)}finally{d(!1)}};return e.jsxs(e.Fragment,{children:[e.jsxs(_e,{open:h,onOpenChange:y,modal:!1,children:[e.jsx(Ie,{asChild:!0,children:e.jsx(T,{variant:"ghost",size:"icon-sm","aria-label":"agent options","data-tour-tag":"agent-options-button",onClick:w=>{w.stopPropagation(),w.detail===0&&y(D=>!D)},style:i,children:e.jsx(Ht,{"aria-hidden":"true"})})}),e.jsxs(Se,{align:"end",className:"min-w-45",onClick:w=>w.stopPropagation(),onInteractOutside:w=>{const D=w.detail.originalEvent.target;D instanceof Element&&D.closest(".shepherd-element")&&w.preventDefault()},onCloseAutoFocus:w=>{k.current&&(k.current=!1,w.preventDefault())},children:[n&&l&&e.jsxs(B,{onSelect:l,children:[e.jsx(Ue,{"aria-hidden":"true"}),e.jsx("span",{children:"Chat with agent"})]}),!n&&o&&e.jsxs(B,{"data-tour-tag":"view-agent-settings-menu-item",onSelect:o,children:[e.jsx(he,{"aria-hidden":"true"}),e.jsx("span",{children:"View agent settings"})]}),x&&e.jsxs(B,{onSelect:x,children:[e.jsx(Kt,{"aria-hidden":"true"}),e.jsx("span",{children:"Export agent"})]}),j&&e.jsxs(B,{"data-tour-tag":"upload-to-hub-menu-item",onSelect:j,children:[e.jsx(pe,{"aria-hidden":"true"}),e.jsx("span",{children:"Upload to hub"})]}),m&&e.jsxs(B,{className:"text-warning data-[highlighted]:bg-warning-wash",onSelect:()=>{k.current=!0,f(!0)},children:[e.jsx(ot,{"aria-hidden":"true"}),e.jsx("span",{children:"Clear conversation"})]}),e.jsxs(B,{destructive:!0,onSelect:()=>{k.current=!0,d(!0)},children:[e.jsx(rt,{"aria-hidden":"true"}),e.jsx("span",{children:"Delete agent"})]})]})]}),e.jsx(je,{open:c,title:"Delete agent",message:e.jsxs(e.Fragment,{children:[e.jsxs("p",{className:"text-body text-ink",children:['Are you sure you want to delete the agent "',s,'"?']}),e.jsx("p",{className:"mt-2 text-body-sm text-ink-muted",children:"This action cannot be undone. All conversations with this agent will be permanently deleted."})]}),confirmText:"Delete",cancelText:"Cancel",isDangerous:!0,onConfirm:L,onCancel:()=>d(!1)}),e.jsx(je,{open:u,title:"Clear this conversation?",message:"Every message in it is deleted from this computer, and there is no undo. The agent itself is not affected.",confirmText:"Clear",cancelText:"Cancel",isDangerous:!0,onConfirm:()=>{m?.(),f(!1)},onCancel:()=>f(!1)})]})},We=t=>["agent-system-prompt",t],Ve=t=>{const{shouldEnableQuery:s}=lt();return Re({enabled:s({bypassInternetCheck:!0})&&!!t,queryKey:We(t),queryFn:async()=>{try{const i=await fe(K.baseUrl).agents.getAgentSystemPrompt(t);if(i.status>=400)throw new Error(i.message||"Failed to fetch agent system prompt");return i.result?.system_prompt||""}catch(a){const i=a instanceof Error?a.message:"An unknown error occurred while fetching agent system prompt";throw te(i),a}},refetchOnWindowFocus:!1,staleTime:5e3})},ea=t=>{const s=Oe(),a=fe(K.baseUrl);return qe({mutationFn:async i=>{const n=dt(i);if(n)throw te(n),new Error(n);try{const o=await a.agents.updateAgentSystemPrompt(t,i);if(o.status>=400)throw new Error(o.message||"Failed to update agent system prompt");return o}catch(o){const l=o instanceof Error?o.message:"An unknown error occurred while updating agent system prompt";throw te(l),o}},onSuccess:async()=>{await s.invalidateQueries({queryKey:We(t)}),ct("Agent system prompt updated")},onError:i=>{console.error("Error updating agent system prompt:",i)}})},ta=()=>{const[t,s]=ut(),a=mt(),i=()=>{const o=t.get("page");return o?Number.parseInt(o,10):1},n=o=>{const l=new URLSearchParams(t);o===1?l.delete("page"):l.set("page",o.toString()),s(l)};return{page:i(),setPage:n,isView:o=>a.pathname.startsWith(`/${o}`)}},aa=({open:t,onClose:s,onAgentImported:a})=>{const[i,n]=r.useState(null),[o,l]=r.useState(!1),[x,m]=r.useState(null),j=r.useRef(null),h=ht(),y=r.useCallback(g=>{g.preventDefault(),g.stopPropagation(),l(!0)},[]),c=r.useCallback(g=>{g.preventDefault(),g.stopPropagation(),l(!1)},[]),d=r.useCallback(g=>{g.preventDefault(),g.stopPropagation()},[]),u=r.useCallback(g=>g.name.toLowerCase().endsWith(".zip")?(m(null),!0):(m("Only ZIP files are supported"),!1),[]),f=r.useCallback(g=>{if(g.preventDefault(),g.stopPropagation(),l(!1),g.dataTransfer.files&&g.dataTransfer.files.length>0){const E=g.dataTransfer.files[0];u(E)&&n(E)}},[u]),k=r.useCallback(g=>{if(g.target.files&&g.target.files.length>0){const E=g.target.files[0];u(E)&&n(E)}},[u]),S=r.useCallback(()=>{j.current?.click()},[]),_=async()=>{if(i)try{const g=await h.mutateAsync(i);n(null),m(null),a&&g&&a(g.id),s()}catch(g){console.error("Failed to import agent:",g)}},L=()=>{n(null),m(null),s()},w=h.isPending,D=w||!i,p=e.jsxs(e.Fragment,{children:[e.jsx(Ne,{size:19,className:"text-accent","aria-hidden":"true"}),"Import agent"]}),C=e.jsxs(e.Fragment,{children:[e.jsx(Y,{onClick:L,disabled:w,children:"Cancel"}),e.jsx(ie,{onClick:_,disabled:D,startIcon:w?e.jsx(De,{}):null,children:"Import agent"})]});return e.jsxs(Me,{open:t,onClose:L,title:p,actions:C,maxWidth:"sm",children:[e.jsx("p",{className:"mb-4 text-body-sm text-ink-muted",children:"Import an agent from a ZIP file exported from Local Operator. The file should contain an agent.yml file."}),e.jsxs("div",{className:"flex flex-col gap-5",children:[e.jsx("input",{ref:j,type:"file",accept:".zip",onChange:k,disabled:w,className:"hidden"}),e.jsx("button",{type:"button",onClick:S,onDragEnter:y,onDragLeave:c,onDragOver:d,onDrop:f,disabled:w,className:R("cursor-pointer rounded-lg border-2 border-control border-dashed bg-surface p-4 text-center","transition-colors duration-base ease-out-quart","hover:bg-accent-wash","disabled:border-hairline disabled:bg-sunken disabled:text-ink-disabled",o&&"border-accent bg-accent-wash"),children:i?e.jsxs(e.Fragment,{children:[e.jsx(Ne,{size:32,className:"mx-auto mb-2 text-ink-muted","aria-hidden":"true"}),e.jsx("p",{className:"text-body text-ink",children:i.name}),e.jsx("p",{className:"text-body-sm text-ink-muted",children:"Click or drag to replace"})]}):e.jsxs(e.Fragment,{children:[e.jsx(pt,{size:32,className:"mx-auto mb-2 text-ink-muted","aria-hidden":"true"}),e.jsx("p",{className:"text-body text-ink",children:"Drag and drop a ZIP file here"}),e.jsx("p",{className:"text-body-sm text-ink-muted",children:"or click to select a file"})]})}),x&&e.jsx("p",{role:"alert",className:"text-body-sm text-danger",children:x})]})]})},sa=({title:t,searchQuery:s,onSearchChange:a,onNewAgentClick:i,searchPlaceholder:n="Search agents",newAgentTooltip:o="Create a new agent",onImportAgentClick:l,importAgentTooltip:x="Import an agent from a ZIP file"})=>e.jsxs("div",{className:"p-4",children:[e.jsxs("div",{className:"mb-3 flex items-center justify-between gap-2",children:[e.jsx("h2",{className:"truncate text-heading text-ink",children:t}),e.jsxs("div",{className:"flex shrink-0 gap-1",children:[l&&e.jsx(q,{content:x,children:e.jsx(T,{variant:"ghost",size:"icon",onClick:l,"aria-label":"Import agent",children:e.jsx(Jt,{"aria-hidden":"true"})})}),e.jsx(q,{content:o,children:e.jsx(T,{variant:"primary",size:"icon",onClick:i,"aria-label":"New agent","data-tour-tag":"create-new-agent-button",children:e.jsx(ze,{"aria-hidden":"true"})})})]})]}),e.jsxs("div",{className:"relative",children:[e.jsx(xt,{size:16,"aria-hidden":"true",className:"pointer-events-none absolute top-1/2 left-3 -translate-y-1/2 text-ink-dim"}),e.jsx(Ee,{type:"search",inputSize:"lg",placeholder:n,value:s,onChange:m=>a(m.target.value),"aria-label":n,className:"pl-9"})]})]}),N={temperature:.2,top_p:.9,top_k:40,max_tokens:4096,frequency_penalty:0,presence_penalty:0,seed:42},A=({label:t,description:s,defaultLabel:a,onSet:i})=>e.jsxs("div",{className:"flex items-start justify-between gap-4",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsxs("div",{className:"flex items-baseline gap-2",children:[e.jsx("span",{className:"text-body-sm text-ink",children:t}),e.jsx("span",{className:"text-meta text-ink-dim",children:"Not set yet"})]}),e.jsx("p",{className:"mt-1 text-meta text-ink-dim",children:s})]}),e.jsxs(T,{variant:"secondary",size:"sm",className:"shrink-0",onClick:i,children:["Set to default (",a,")"]})]}),me=({title:t,children:s})=>e.jsxs("div",{className:"flex flex-col gap-4",children:[e.jsx("h3",{className:"text-body-sm font-semibold text-ink-muted",children:t}),s]}),na=({selectedAgent:t,savingField:s,setSavingField:a,updateAgentMutation:i,refetchAgent:n,initialSelectedAgentId:o})=>{const[l,x]=r.useState(t);r.useEffect(()=>{x(t)},[t]);const[m,j]=r.useState(!1),h=r.useId(),y=m?Fe:Ze;return e.jsxs("div",{children:[e.jsxs("h2",{className:"flex items-center gap-2",children:[e.jsxs("button",{type:"button",onClick:()=>j(!m),"aria-expanded":m,"aria-controls":h,className:"group flex items-center gap-2 py-1 text-left text-heading text-ink",children:[e.jsx(y,{size:14,"aria-hidden":"true",className:"shrink-0 text-ink-dim transition-colors duration-fast ease-out-quart group-hover:text-ink"}),"Advanced chat settings"]}),e.jsx(q,{content:"Advanced settings to change how the agent generates responses",children:e.jsx(T,{variant:"ghost",size:"icon-sm","aria-label":"About advanced chat settings",children:e.jsx(re,{})})})]}),m&&e.jsxs("div",{id:h,className:"mt-3",children:[e.jsx("p",{className:"max-w-2xl text-body-sm text-ink-muted",children:"Set custom values for any of these options. Anything left unset uses a default optimized from user testing."}),e.jsxs("div",{className:"mt-6 flex flex-col gap-8",children:[e.jsxs(me,{title:"Sampling",children:[l.temperature===null?e.jsx(A,{label:"Temperature",description:"Controls randomness in responses (0.0-1.0). Higher values make output more random.",defaultLabel:N.temperature,onSet:async()=>{a("temperature");try{const c={temperature:N.temperature};await i.mutateAsync({agentId:t.id,update:c}),x(d=>({...d,temperature:N.temperature})),t.id===o&&n&&await n()}catch{}finally{a(null)}}}):e.jsx(G,{value:l.temperature??N.temperature,label:"Temperature",description:"Controls randomness in responses (0.0-1.0). Higher values make output more random.",min:0,max:1,step:.01,isSaving:s==="temperature",onChange:async c=>{a("temperature");try{const d={temperature:c};await i.mutateAsync({agentId:t.id,update:d}),t.id===o&&n&&await n()}catch{}finally{a(null)}}}),l.top_p===null?e.jsx(A,{label:"Top P",description:"Controls cumulative probability of tokens to sample from (0.0-1.0).",defaultLabel:N.top_p,onSet:async()=>{a("top_p");try{const c={top_p:N.top_p};await i.mutateAsync({agentId:t.id,update:c}),x(d=>({...d,top_p:N.top_p})),t.id===o&&n&&await n()}catch{}finally{a(null)}}}):e.jsx(G,{value:l.top_p??N.top_p,label:"Top P",description:"Controls cumulative probability of tokens to sample from (0.0-1.0).",min:0,max:1,step:.01,isSaving:s==="top_p",onChange:async c=>{a("top_p");try{const d={top_p:c};await i.mutateAsync({agentId:t.id,update:d}),t.id===o&&n&&await n()}catch{}finally{a(null)}}}),l.top_k===null?e.jsx(A,{label:"Top K",description:"Limits tokens to sample from at each step.",defaultLabel:N.top_k,onSet:async()=>{a("top_k");try{const c={top_k:N.top_k};await i.mutateAsync({agentId:t.id,update:c}),x(d=>({...d,top_k:N.top_k})),t.id===o&&n&&await n()}catch{}finally{a(null)}}}):e.jsx(G,{value:l.top_k??N.top_k,label:"Top K",description:"Limits tokens to sample from at each step.",min:1,max:100,step:1,isSaving:s==="top_k",onChange:async c=>{a("top_k");try{const d={top_k:c};await i.mutateAsync({agentId:t.id,update:d}),t.id===o&&n&&await n()}catch{}finally{a(null)}}}),l.seed===null?e.jsx(A,{label:"Seed",description:"Random number seed for deterministic generation.",defaultLabel:N.seed,onSet:async()=>{a("seed");try{const c={seed:N.seed};await i.mutateAsync({agentId:t.id,update:c}),x(d=>({...d,seed:N.seed})),t.id===o&&n&&await n()}catch{}finally{a(null)}}}):e.jsx(F,{value:l.seed?.toString()||"",label:"Seed",placeholder:"Random number seed for deterministic generation",icon:e.jsx(he,{size:16}),isSaving:s==="seed",onSave:async c=>{a("seed");try{const d=c.trim()?Number.parseInt(c,10):void 0;if(c.trim()&&Number.isNaN(d)){te("Seed must be a valid number");return}const u={seed:d};await i.mutateAsync({agentId:t.id,update:u}),t.id===o&&n&&await n()}catch{}finally{a(null)}}})]}),e.jsxs(me,{title:"Repetition",children:[l.frequency_penalty===null?e.jsx(A,{label:"Frequency penalty",description:"Reduces repetition by lowering likelihood of repeated tokens (-2.0 to 2.0).",defaultLabel:N.frequency_penalty,onSet:async()=>{a("frequency_penalty");try{const c={frequency_penalty:N.frequency_penalty};await i.mutateAsync({agentId:t.id,update:c}),x(d=>({...d,frequency_penalty:N.frequency_penalty})),t.id===o&&n&&await n()}catch{}finally{a(null)}}}):e.jsx(G,{value:l.frequency_penalty??N.frequency_penalty,label:"Frequency penalty",description:"Reduces repetition by lowering likelihood of repeated tokens (-2.0 to 2.0).",min:-2,max:2,step:.01,isSaving:s==="frequency_penalty",onChange:async c=>{a("frequency_penalty");try{const d={frequency_penalty:c};await i.mutateAsync({agentId:t.id,update:d}),t.id===o&&n&&await n()}catch{}finally{a(null)}}}),l.presence_penalty===null?e.jsx(A,{label:"Presence penalty",description:"Increases diversity by lowering likelihood of prompt tokens (-2.0 to 2.0).",defaultLabel:N.presence_penalty,onSet:async()=>{a("presence_penalty");try{const c={presence_penalty:N.presence_penalty};await i.mutateAsync({agentId:t.id,update:c}),x(d=>({...d,presence_penalty:N.presence_penalty})),t.id===o&&n&&await n()}catch{}finally{a(null)}}}):e.jsx(G,{value:l.presence_penalty??N.presence_penalty,label:"Presence penalty",description:"Increases diversity by lowering likelihood of prompt tokens (-2.0 to 2.0).",min:-2,max:2,step:.01,isSaving:s==="presence_penalty",onChange:async c=>{a("presence_penalty");try{const d={presence_penalty:c};await i.mutateAsync({agentId:t.id,update:d}),t.id===o&&n&&await n()}catch{}finally{a(null)}}})]}),e.jsxs(me,{title:"Length and stopping",children:[l.max_tokens===null?e.jsx(A,{label:"Max tokens",description:"Maximum tokens to generate in response.",defaultLabel:N.max_tokens,onSet:async()=>{a("max_tokens");try{const c={max_tokens:N.max_tokens};await i.mutateAsync({agentId:t.id,update:c}),x(d=>({...d,max_tokens:N.max_tokens})),t.id===o&&n&&await n()}catch{}finally{a(null)}}}):e.jsx(G,{value:l.max_tokens??N.max_tokens,label:"Max tokens",description:"Maximum tokens to generate in response.",min:1,max:8192,step:1,isSaving:s==="max_tokens",onChange:async c=>{a("max_tokens");try{const d={max_tokens:c};await i.mutateAsync({agentId:t.id,update:d}),t.id===o&&n&&await n()}catch{}finally{a(null)}}}),l.stop===null?e.jsx(A,{label:"Stop sequences",description:"Sequences that will cause the model to stop generating text.",defaultLabel:"empty",onSet:async()=>{a("stop");try{const c={stop:[]};await i.mutateAsync({agentId:t.id,update:c}),x(d=>({...d,stop:[]})),t.id===o&&n&&await n()}catch{}finally{a(null)}}}):e.jsx(F,{value:l.stop?.join(`
|
|
37
|
-
`)||"",label:"Stop sequences",placeholder:"Enter stop sequences (one per line)...",icon:e.jsx(he,{size:16}),multiline:!0,rows:3,isSaving:s==="stop",onSave:async c=>{a("stop");try{const d=c.split(`
|
|
38
|
-
`).map(f=>f.trim()).filter(f=>f.length>0),u={stop:d.length>0?d:void 0};await i.mutateAsync({agentId:t.id,update:u}),t.id===o&&n&&await n()}catch{}finally{a(null)}}})]})]})]})]})},Ke=["investment","accounting","healthcare","legal","software","security","role_play","personal_assistance","education","marketing","sales","research","analysis","management","social_media","other"],se=Object.fromEntries(Ke.map(t=>[t,t.split("_").map(s=>s.charAt(0).toUpperCase()+s.slice(1)).join(" ")])),ia=({value:t,label:s,onChange:a,placeholder:i="Add category...",disabled:n=!1,icon:o})=>{const[l,x]=r.useState(""),[m,j]=r.useState(!1),[h,y]=r.useState(0),c=r.useRef(null),d=r.useRef([]),u=r.useId(),f=r.useId(),k=r.useMemo(()=>{const p=l.trim().toLowerCase();return Ke.filter(C=>!t.includes(C)&&(!p||se[C].toLowerCase().includes(p)))},[t,l]);r.useEffect(()=>{m&&d.current[h]?.scrollIntoView({block:"nearest"})},[h,m]);const S=p=>{t.includes(p)||a([...t,p]),x(""),j(!1),y(0),c.current?.focus()},_=p=>{x(p.target.value),y(0),j(!0)},L=p=>{const C=k.length;switch(p.key){case"ArrowDown":if(p.preventDefault(),C===0)break;m?y((h+1)%C):(y(0),j(!0));break;case"ArrowUp":if(p.preventDefault(),C===0)break;m?y((h-1+C)%C):(y(C-1),j(!0));break;case"Enter":m&&k[h]&&(p.preventDefault(),S(k[h]));break;case"Escape":m&&(p.preventDefault(),j(!1));break;case"Home":m&&(p.preventDefault(),y(0));break;case"End":m&&(p.preventDefault(),y(k.length-1));break}},w=p=>{a(t.filter(C=>C!==p)),y(0)},D=m&&k[h]?`${f}-option-${h}`:void 0;return e.jsxs("div",{children:[e.jsxs(oe,{htmlFor:u,className:"mb-1.5 flex items-center gap-2 text-ink-muted",children:[o,s]}),e.jsxs("div",{className:R("flex min-h-11 flex-wrap items-center gap-2 rounded-sm border border-control bg-surface p-2","has-[input:focus-visible]:outline-solid has-[input:focus-visible]:outline-2","has-[input:focus-visible]:outline-accent has-[input:focus-visible]:outline-offset-2",n&&"border-hairline bg-sunken"),children:[t.map(p=>e.jsxs(Pe,{className:"gap-1 pr-1 text-ink",children:[se[p]||p,e.jsx("button",{type:"button","aria-label":`Remove category ${se[p]||p}`,disabled:n,onClick:()=>w(p),className:R("rounded-xs text-ink-dim","transition-colors duration-fast ease-out-quart","hover:text-danger disabled:text-ink-disabled"),children:e.jsx(Te,{})})]},p)),e.jsxs(Je,{open:m,onOpenChange:j,children:[e.jsx(Xe,{asChild:!0,children:e.jsx("input",{id:u,ref:c,type:"text",role:"combobox","aria-expanded":m,"aria-controls":f,"aria-autocomplete":"list","aria-activedescendant":D,autoComplete:"off",value:l,placeholder:i,disabled:n,"aria-label":s,onChange:_,onKeyDown:L,onClick:()=>{k.length>0&&j(!0)},className:R("min-w-20 flex-1 bg-transparent px-1 py-0.5 outline-none","text-body-sm text-ink placeholder:text-ink-dim","disabled:text-ink-disabled disabled:placeholder:text-ink-disabled")})}),e.jsx(et,{align:"start",sideOffset:4,onOpenAutoFocus:p=>p.preventDefault(),className:"max-h-60 w-(--radix-popover-trigger-width) overflow-y-auto p-1",children:e.jsx("div",{id:f,role:"listbox","aria-label":s,children:k.map((p,C)=>e.jsx("div",{id:`${f}-option-${C}`,ref:g=>{d.current[C]=g},role:"option","aria-selected":C===h,onMouseDown:g=>{g.preventDefault()},onMouseEnter:()=>y(C),onClick:()=>S(p),className:R("cursor-pointer rounded-sm px-3 py-1.5 font-medium text-body-sm",C===h?"bg-accent-wash":void 0,"text-ink"),children:se[p]||p},p))})})]})]}),t.length===0&&e.jsx("span",{className:"mt-1 ml-1 block text-ink-dim text-meta",children:"No categories selected"})]})},oa=({value:t,label:s,onChange:a,placeholder:i="Add tag...",disabled:n=!1,icon:o})=>{const[l,x]=r.useState(""),m=r.useRef(null),j=r.useId(),h=u=>{x(u.target.value)},y=()=>{const u=l.trim().toLowerCase();u&&!t.includes(u)&&a([...t,u]),x("")},c=u=>{u.key==="Enter"&&l.trim()?(u.preventDefault(),y()):u.key==="Backspace"&&!l&&t.length>0&&a(t.slice(0,-1))},d=u=>{a(t.filter(f=>f!==u))};return e.jsxs("div",{children:[e.jsxs(oe,{htmlFor:j,className:"mb-1.5 flex items-center gap-2 text-ink-muted",children:[o,s]}),e.jsxs("div",{className:R("flex min-h-11 flex-wrap items-center gap-2 rounded-sm border border-control bg-surface p-2","has-[input:focus-visible]:outline-solid has-[input:focus-visible]:outline-2","has-[input:focus-visible]:outline-accent has-[input:focus-visible]:outline-offset-2",n&&"border-hairline bg-sunken"),children:[t.map(u=>e.jsxs(Pe,{className:"gap-1 pr-1 text-ink",children:[u,e.jsx("button",{type:"button","aria-label":`Remove tag ${u}`,disabled:n,onClick:()=>d(u),className:R("rounded-xs text-ink-dim","transition-colors duration-fast ease-out-quart","hover:text-danger disabled:text-ink-disabled"),children:e.jsx(Te,{})})]},u)),e.jsx("input",{id:j,ref:m,type:"text",value:l,onChange:h,onKeyDown:c,placeholder:i,disabled:n,"aria-label":s,className:R("min-w-20 flex-1 bg-transparent px-1 py-0.5 outline-none","text-body-sm text-ink placeholder:text-ink-dim","disabled:text-ink-disabled disabled:placeholder:text-ink-disabled")}),l.trim()&&e.jsx(T,{variant:"ghost",size:"icon-sm","aria-label":"Add tag",disabled:n,onClick:()=>{y(),m.current?.focus()},className:"text-accent hover:text-accent",children:e.jsx(ze,{})})]}),t.length===0&&!l&&e.jsx("span",{className:"mt-1 ml-1 block text-ink-dim text-meta",children:"No tags added"})]})},ra=({selectedAgent:t,savingField:s,setSavingField:a,updateAgentMutation:i,refetchAgent:n,initialSelectedAgentId:o})=>{const{data:l,isLoading:x}=ft(),[m,j]=r.useState("");r.useEffect(()=>{!x&&l?.values?j(t.hosting||l.values.hosting||""):x||j(t.hosting||"")},[t,l,x]);const[h,y]=r.useState(!1),[c,d]=r.useState(!1);return e.jsxs("div",{className:"flex flex-col gap-4",children:[e.jsx(F,{value:t.name,label:"Agent name",placeholder:"Enter agent name...",isSaving:s==="name",onSave:async u=>{if(!u.trim()){te("Agent name cannot be empty");return}a("name");try{const f={name:u};await i.mutateAsync({agentId:t.id,update:f}),t.id===o&&n&&await n()}catch{}finally{a(null)}}}),e.jsxs("div",{className:"grid gap-4 lg:grid-cols-2",children:[e.jsx("div",{"data-tour-tag":"agent-settings-hosting-select",children:e.jsx(gt,{value:t.hosting||(l?.values.hosting??""),isSaving:s==="hosting",onSave:async u=>{a("hosting"),j(u);try{const f={hosting:u,model:""};await i.mutateAsync({agentId:t.id,update:f}),t.id===o&&n&&await n()}catch{j(t.hosting||"")}finally{a(null)}},filterByCredentials:!0,allowDefault:!0},`hosting-select-${t.id}-${t.hosting||(l?.values.hosting??"default")}`)}),e.jsx("div",{"data-tour-tag":"agent-settings-model-select",children:m?e.jsx(bt,{value:t.hosting?t.model||"":t.model||(l?.values.model_name??""),hostingId:m,isSaving:s==="model",allowDefault:!0,onSave:async u=>{a("model");try{const f={model:u};await i.mutateAsync({agentId:t.id,update:f}),t.id===o&&n&&await n()}catch{}finally{a(null)}}},`model-select-${t.id}-${m}-${t.model||(!t.hosting&&l?.values.model_name?l.values.model_name:"default")}`):e.jsxs("div",{className:"relative",children:[e.jsx(q,{content:"Select a hosting provider first, and then select the AI model that you want to use. Each model has different capabilities and costs. Recommended: Automatic",children:e.jsxs("div",{className:"mb-1.5 flex w-fit items-center gap-2 text-body-sm text-ink-muted",children:[e.jsx(yt,{size:16,"aria-hidden":"true"}),"Model"]})}),e.jsx("div",{className:"flex h-8 w-full items-center rounded-sm border border-control bg-surface px-3",children:e.jsx("span",{className:"truncate text-body-sm text-ink-disabled",children:"Select a hosting provider first..."})})]})})]}),e.jsxs("h2",{className:"mt-4 flex items-center gap-2 text-heading text-ink",children:[e.jsx(re,{size:16,className:"shrink-0 text-ink-dim"}),"Agent information"]}),e.jsxs("div",{className:"flex flex-col gap-4",children:[e.jsx(F,{value:t.description||"",label:"Description",placeholder:"Enter agent description...",multiline:!0,rows:3,isSaving:s==="description",onSave:async u=>{a("description");try{const f={description:u};await i.mutateAsync({agentId:t.id,update:f}),t.id===o&&n&&await n()}catch{}finally{a(null)}}}),e.jsx(oa,{value:t.tags||[],label:"Tags",placeholder:"Add tag...",disabled:h,onChange:async u=>{if(!(Array.isArray(t.tags)&&u.length===t.tags.length&&u.every((f,k)=>f===t.tags?.[k]))){y(!0);try{const f={tags:u};await i.mutateAsync({agentId:t.id,update:f}),t.id===o&&n&&await n()}catch{}finally{y(!1)}}}}),e.jsx(ia,{value:t.categories||[],label:"Categories",placeholder:"Add category...",disabled:c,onChange:async u=>{if(!(Array.isArray(t.categories)&&u.length===t.categories.length&&u.every((f,k)=>f===t.categories?.[k]))){d(!0);try{const f={categories:u};await i.mutateAsync({agentId:t.id,update:f}),t.id===o&&n&&await n()}catch{}finally{d(!1)}}}}),e.jsxs(Pt,{children:[e.jsx(ue,{label:e.jsxs(e.Fragment,{children:[e.jsx(Ft,{size:12,"aria-hidden":"true"}),"ID"]}),value:e.jsx("span",{className:"font-mono text-mono-sm",children:t.id})}),e.jsx(ue,{label:e.jsxs(e.Fragment,{children:[e.jsx(At,{size:12,"aria-hidden":"true"}),"Created"]}),value:jt(t.created_date)}),e.jsx(ue,{label:e.jsxs(e.Fragment,{children:[e.jsx(Gt,{size:12,"aria-hidden":"true"}),"Version"]}),value:t.version})]})]})]})},la=({selectedAgent:t,savingField:s,setSavingField:a,updateAgentMutation:i,refetchAgent:n,initialSelectedAgentId:o})=>e.jsxs("div",{"data-tour-tag":"agent-settings-security",children:[e.jsxs("h2",{className:"flex items-center gap-2 text-heading text-ink",children:[e.jsx(kt,{size:16,className:"shrink-0 text-ink-dim"}),"Security instructions",e.jsx(q,{content:`Security instructions that guide the agent's behavior and limitations. This is the "system prompt" for the security agent.`,children:e.jsx(T,{variant:"ghost",size:"icon-sm","aria-label":"About security instructions",children:e.jsx(re,{})})})]}),e.jsx("p",{className:"mt-1 max-w-2xl text-body-sm text-ink-muted",children:`This prompt is directed to the AI security reviewer. It helps the reviewer decide whether to block or allow actions based on safety. Write as if talking to another agent that is watching this agent (eg. "Allow all git operations", "Don't let the agent access drive files in the restricted folder"). Update this to allow the agent to perform actions if you are getting frequent security blocks.`}),e.jsx("div",{className:"mt-4",children:e.jsx(F,{value:t.security_prompt||"",label:"",placeholder:"Enter instructions for the security agent...",multiline:!0,rows:6,isSaving:s==="security_prompt",onSave:async l=>{a("security_prompt");try{const x={security_prompt:l};await i.mutateAsync({agentId:t.id,update:x}),t.id===o&&n&&await n()}catch{}finally{a(null)}}})})]}),ca=({selectedAgent:t,savingField:s,setSavingField:a,refetchAgent:i,initialSelectedAgentId:n})=>{const{data:o,isLoading:l}=Ve(t.id),x=ea(t.id),[m,j]=r.useState("");return r.useEffect(()=>{o!==void 0&&j(o)},[o]),e.jsxs("div",{"data-tour-tag":"agent-settings-system-prompt",children:[e.jsxs("h2",{className:"flex items-center gap-2 text-heading text-ink",children:[e.jsx(Tt,{size:16,className:"shrink-0 text-ink-dim"}),"Agent instructions",e.jsx(q,{content:`System instructions that define the agent's behavior and capabilities. This is the agent's "system prompt".`,children:e.jsx(T,{variant:"ghost",size:"icon-sm","aria-label":"About agent instructions",children:e.jsx(re,{})})})]}),e.jsx("p",{className:"mt-1 max-w-2xl text-body-sm text-ink-muted",children:`Define the agent's role, personality, or provide context. Write as if talking to the agent (e.g., "You are an expert researcher") and/or about yourself (e.g., "My name is John").`}),e.jsx("div",{className:"mt-4",children:e.jsx(F,{value:m,label:"",placeholder:l?"Loading system prompt...":"Enter instructions for the agent...",multiline:!0,rows:6,isSaving:s==="system_prompt",onSave:async h=>{a("system_prompt");try{await x.mutateAsync(h),t.id===n&&i&&await i()}finally{a(null)}}})})]})},da=({selectedAgent:t,refetchAgent:s,initialSelectedAgentId:a})=>{const[i,n]=r.useState(null),o=vt();return e.jsx("div",{"data-tour-tag":"agent-settings-details-paper",className:"h-full overflow-hidden",children:t?e.jsx("div",{className:"h-full overflow-y-auto",children:e.jsxs("div",{className:"mx-auto flex w-full max-w-4xl flex-col gap-8 pb-8",children:[e.jsx(ra,{selectedAgent:t,savingField:i,setSavingField:n,updateAgentMutation:o,refetchAgent:s,initialSelectedAgentId:a}),e.jsx(ca,{selectedAgent:t,savingField:i,setSavingField:n,refetchAgent:s,initialSelectedAgentId:a}),e.jsx(la,{selectedAgent:t,savingField:i,setSavingField:n,updateAgentMutation:o,refetchAgent:s,initialSelectedAgentId:a}),e.jsx(na,{selectedAgent:t,savingField:i,setSavingField:n,updateAgentMutation:o,refetchAgent:s,initialSelectedAgentId:a})]})}):e.jsxs("div",{className:"flex h-full flex-col items-center justify-center gap-2 p-8 text-center",children:[e.jsx(ge,{size:48,className:"text-ink-dim","aria-hidden":"true"}),e.jsx("h2",{className:"text-heading text-ink",children:"No agent selected"}),e.jsx("p",{className:"max-w-md text-body-sm text-ink-muted",children:"Select an agent from the list on the left to view its configuration and details."})]})})},ye=Ut()(Rt(t=>({listings:{},remember:(s,a)=>{t(i=>({listings:{...i.listings,[s]:a}}))},forget:s=>{t(a=>{if(!(s in a.listings))return a;const i={...a.listings};return delete i[s],{listings:i}})}}),{name:"published-listings-storage"})),ua=t=>ye(s=>t?s.listings[t]??null:null),ma=400,ha=2,pa=t=>[...t].length>=ha;function xa(t){if(!t)return{state:"unknown",builtinName:null};if(t.available)return{state:"available",builtinName:null};const s=t.details?.builtin_name??null;return t.code==="name_taken"?{state:"taken",builtinName:null}:t.code==="name_reserved_builtin"?{state:"reserved",builtinName:s}:{state:"unknown",builtinName:null}}const fa=(t,s)=>{const a=t.trim(),i=$e(a,ma),n=s&&i===a&&pa(i)&&wt(i),o=Re({queryKey:["agent-name-availability",i],enabled:n,queryFn:async()=>(await xe.getAgentNameAvailability(K.baseUrl,i)).result,retry:!1,staleTime:15e3,refetchOnWindowFocus:!1});return!n||o.isPending?{state:n?"checking":"idle",builtinName:null}:o.isError?{state:"unknown",builtinName:null}:xa(o.data)},ga=()=>{const t=Oe();return qe({mutationFn:async({agentId:s,document:a,hubAgentId:i})=>{if(!K.baseUrl)throw new Error("Local Operator API URL is not configured.");return i?xe.republishAgentInstructionSet(K.baseUrl,s,i,a):xe.publishAgentInstructionSet(K.baseUrl,s,a)},onSuccess:(s,a)=>{const i=s.result;i?.agent_id&&ye.getState().remember(a.agentId,{hubAgentId:i.agent_id,name:i.name,publishedAt:new Date().toISOString()}),t.invalidateQueries({queryKey:["public-agents"]})},onError:s=>{console.error("Publishing an agent to the hub failed:",s)}})},Qe=({open:t,onClose:s,agent:a,isAuthenticated:i,onSignInSuccess:n,onPublished:o})=>{const[l,x]=r.useState(!1),[m,j]=r.useState(""),[h,y]=r.useState(null),[c,d]=r.useState(null),[u,f]=r.useState(!1),k=r.useRef(null),S=r.useRef(null),_=be(),L=ga(),w=ua(a?.id??null),D=r.useId(),p=r.useId(),{data:C}=Ve(t&&a?a.id:""),{data:g}=Nt(t);r.useEffect(()=>{t&&j(a?.name??"")},[t,a?.name]),r.useEffect(()=>{t||(x(!1),y(null),d(null),f(!1))},[t]);const E=r.useMemo(()=>(g??[]).filter(v=>v.source==="builtin").map(v=>v.name),[g]),H=qt(m,E),ae=fa(m,t&&i),M=r.useMemo(()=>{const v=Mt({name:m,description:a?.description??"",instructions:C??null,tools:zt(a?.tags)});return H&&v.unshift({field:"name",message:we({code:"name_reserved_builtin",message:""},{name:m,hubAgentId:null}).body}),v},[m,a?.description,a?.tags,C,H]),P=h?we(h,{name:m,hubAgentId:w?.hubAgentId??null}):null,W=L.isPending,Z=async v=>{if(!a||W||M.length>0)return;y(null);const U=v?.asNewListing?null:w?.hubAgentId??null,b=!!U;try{const I={name:m.trim()},O=(await L.mutateAsync({agentId:a.id,document:I,hubAgentId:U})).result,V={name:O?.name??m.trim(),hubAgentId:O?.agent_id??null,republished:b};d(V),O&&o?.(O,V.republished)}catch(I){y(_t(I)?{code:I.code,message:I.message,details:I.details}:{message:Ct(I,"The agent could not be published. Try again.")})}},J=v=>{switch(v){case"focus-name":y(null),requestAnimationFrame(()=>{k.current?.focus(),k.current?.select()});break;case"update-listing":{const U=h?.details?.existing_agent_id??w?.hubAgentId;U&&(s(),_(`/agent-hub/${U}`));break}case"install-builtin":{const U=h?.details?.builtin_name??ae.builtinName;U&&(s(),_(`/agents?kind=agent&name=${encodeURIComponent(U)}`));break}case"edit-instructions":case"edit-agent":a&&(s(),_(`/agents/${a.id}`));break;case"publish-as-new":a&&ye.getState().forget(a.id),Z({asNewListing:!0});break;case"sign-in":f(!0);break;case"refresh-hub":s(),_("/agent-hub");break;case"retry":Z();break}},z=a?.name??"",le=c?c.republished?`Updated the Agent hub listing for "${z}"`:`Published "${z}" to the Agent hub`:w?`Update the Agent hub listing for "${z}"?`:`Publish "${z}" to the Agent hub?`;r.useLayoutEffect(()=>{!h&&!c||S.current?.focus()},[h,c]);const ce=c?e.jsxs(e.Fragment,{children:[e.jsx(Y,{onClick:s,"data-tour-tag":"upload-agent-dialog-cancel-button",children:"Close"}),c.hubAgentId&&e.jsx(ie,{onClick:()=>{s(),_(`/agent-hub/${c.hubAgentId}`)},children:"Open the listing"})]}):P?e.jsxs(e.Fragment,{children:[e.jsx(Y,{onClick:s,"data-tour-tag":"upload-agent-dialog-cancel-button",children:"Close"}),P.actions.map((v,U)=>U===0?e.jsx(ie,{onClick:()=>J(v),disabled:W,children:Ce[v]},v):e.jsx(Y,{onClick:()=>J(v),disabled:W,children:Ce[v]},v))]}):e.jsxs(e.Fragment,{children:[e.jsx(Y,{onClick:s,"data-tour-tag":"upload-agent-dialog-cancel-button",children:"Cancel"}),M.some(v=>v.field!=="name")&&e.jsx(Y,{onClick:()=>{a&&(s(),_(`/agents/${a.id}`))},children:"Edit the agent"}),i&&e.jsx(ie,{"data-testid":"publish-submit",onClick:()=>void Z(),disabled:!l||M.length>0||!m.trim()||W,children:W?"Publishing…":w?"Update listing":"Publish"})]});return e.jsx(Me,{open:t,onClose:s,title:le,maxWidth:"sm",fullWidth:!0,actions:ce,dataTourTag:"upload-agent-dialog",dialogProps:{className:"outline-none"},children:e.jsxs("div",{ref:S,tabIndex:h||c?-1:void 0,className:R("flex flex-col gap-4",(h||c)&&"outline-none"),children:[i?c?e.jsxs(ne,{variant:"success","aria-live":"polite",children:[e.jsx(de,{children:c.republished?"Listing updated":"Published to the hub"}),e.jsx(ee,{children:c.republished?`The hub now holds the current instruction set of "${c.name}".`:`"${c.name}" is on the hub as an instruction set. Anyone can read and install it.`}),e.jsx(ee,{className:"text-ink-muted",children:"Nothing else left this machine: no conversation, no execution history, no memory, no plan and no machine-specific configuration."})]}):P&&h?e.jsxs(ne,{variant:P.variant,role:"alert",children:[e.jsx(de,{children:P.headline}),e.jsx(ee,{children:P.body}),P.note&&e.jsx(ee,{className:"text-ink-muted",children:P.note})]}):null:e.jsxs("div",{className:"flex flex-col items-center gap-6 text-center",children:[e.jsx("p",{className:"text-body text-ink",children:"You need to be signed in to Radient to publish agents to the Agent hub."}),e.jsx(ve,{titleText:"Sign in to continue",descriptionText:"",onSignInSuccess:n})]}),P&&u&&e.jsxs("div",{className:"flex flex-col items-center gap-6 text-center",children:[e.jsx("p",{className:"text-body text-ink",children:"Sign in to Radient again to replace the credential the hub refused."}),e.jsx(ve,{titleText:"Sign in again",descriptionText:"",onSignInSuccess:()=>{f(!1),y(null),n?.()}})]}),!c&&!P&&e.jsxs(e.Fragment,{children:[e.jsx("p",{className:"text-body text-ink",children:"You are about to publish this agent's instruction set to the public Agent hub. What is published is what describes the agent:"}),e.jsxs("ul",{className:"list-disc space-y-1 pl-5 text-body text-ink-muted",children:[e.jsx("li",{children:"Its name and description"}),e.jsx("li",{children:"Its instructions"}),e.jsx("li",{children:"Its tool surface, effort and delegation, when it has them"})]}),e.jsx("p",{className:"text-body text-ink",children:"Nothing else leaves this machine: no conversation, no execution history, no memory or learnings, no plan, and no machine-specific configuration. Anyone can read and install what you publish."}),M.length>0&&e.jsxs(ne,{variant:"danger",children:[e.jsx(de,{children:"This agent cannot be published yet"}),e.jsx("ul",{className:"list-disc space-y-1 pl-5",children:M.map(v=>e.jsx("li",{children:v.message},`${v.field}:${v.message}`))})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(oe,{htmlFor:p,children:"Name on the hub"}),e.jsx(Ee,{id:p,ref:k,value:m,onChange:v=>j(v.target.value),autoComplete:"off",spellCheck:!1,"aria-invalid":M.some(v=>v.field==="name"),"aria-describedby":`${p}-hint`}),e.jsx("p",{id:`${p}-hint`,className:"text-meta text-ink-muted",children:'No "/", "\\" or ":". Up to 128 characters.'}),ba(ae)]}),e.jsxs("div",{className:"flex gap-3",children:[e.jsx("span",{className:"flex h-5 shrink-0 items-center",children:e.jsx(tt,{id:D,name:"termsAgreement","data-testid":"publish-consent",checked:l,onCheckedChange:v=>x(v===!0)})}),e.jsxs(oe,{htmlFor:D,className:"block font-normal text-body text-ink",children:["I confirm that I have read and agree to the"," ",e.jsx("a",{href:"https://radienthq.com/terms",target:"_blank",rel:"noopener noreferrer",className:"text-accent underline-offset-4 hover:text-accent-hover hover:underline",children:"terms and conditions"})," ","and that this agent does not contain malicious content or violate usage policies."]})]})]}),(c||P)&&z&&e.jsxs("p",{className:"text-meta text-ink-muted",children:["Agent: ",z]})]})})},ba=t=>{switch(t.state){case"checking":return e.jsx("p",{className:"text-meta text-ink-muted",children:"Checking whether this name is free…"});case"available":return e.jsx("p",{className:"text-meta text-ink-muted",children:"This name looks free."});case"taken":return e.jsx("p",{className:"text-meta text-ink",children:"This name is already published on the hub."});case"reserved":return e.jsx("p",{className:"text-meta text-ink-muted",children:t.builtinName?`The hub reserves "${t.builtinName}" for one of its built-in agents.`:"The hub reserves this name for one of its built-in agents."});default:return null}},Ce={"focus-name":"Choose another name","update-listing":"Update the existing listing","install-builtin":"Install the built-in instead",retry:"Try again","edit-instructions":"Edit the instructions","edit-agent":"Edit the agent","publish-as-new":"Publish as a new listing","sign-in":"Sign in again","refresh-hub":"Refresh the hub"},ya=1200,ja=({agent:t,isSelected:s,onSelectAgent:a,onChatWithAgent:i,onExportAgent:n,onAgentDeleted:o,onUploadAgentToHub:l})=>{const x=t.description||"No description";return e.jsxs("li",{className:"group relative",children:[e.jsxs("button",{type:"button",onClick:()=>a(t),"aria-current":s?"true":void 0,"data-tour-tag":"agent-list-item-button",className:R("flex w-full items-center gap-2 rounded-sm py-1.5 pr-9 pl-2 text-left","transition-colors duration-fast ease-out-quart",s?St:"hover:bg-row-hover"),children:[e.jsx(st,{className:"size-8 shrink-0",children:e.jsx(nt,{className:"border border-control bg-sunken",children:e.jsx(ge,{size:16,"aria-hidden":!0})})}),e.jsxs("span",{className:"min-w-0 flex-1",children:[e.jsx(q,{content:t.name,side:"top",align:"start",children:e.jsx("span",{className:"block truncate font-medium text-body-sm text-ink",children:t.name})}),e.jsx(q,{content:x,side:"bottom",align:"start",children:e.jsx("span",{className:"block truncate text-meta text-ink-dim",children:x})})]})]}),e.jsx("div",{className:R("pointer-events-none absolute top-0 right-1 flex h-full items-center","opacity-0 transition-opacity duration-fast ease-out-quart","group-hover:pointer-events-auto group-hover:opacity-100","group-focus-within:pointer-events-auto group-focus-within:opacity-100"),children:e.jsx(q,{content:"Agent options",children:e.jsx("span",{children:e.jsx(Xt,{agentId:t.id,agentName:t.name,isAgentsPage:!0,onAgentDeleted:()=>o(t.id),onChatWithAgent:()=>i(t.id),onExportAgent:()=>n(t.id),onUploadAgentToHub:()=>l(t),buttonSx:{width:24,height:24,borderRadius:"6px",display:"flex",justifyContent:"center",alignItems:"center"}})})})})]})},ka=(t,s)=>t.isSelected===s.isSelected&&t.agent.id===s.agent.id&&t.agent.name===s.agent.name&&t.agent.description===s.agent.description&&t.onSelectAgent===s.onSelectAgent&&t.onChatWithAgent===s.onChatWithAgent&&t.onExportAgent===s.onExportAgent&&t.onAgentDeleted===s.onAgentDeleted&&t.onUploadAgentToHub===s.onUploadAgentToHub,va=r.memo(ja,ka),wa=({selectedAgentId:t,onSelectAgent:s})=>{const a=be(),[i,n]=r.useState(""),o=Ot(b=>b.openCreateAgentDialog),l=$e(i.trim(),250),[x,m]=r.useState(!1),j=50,[h,y]=r.useState(!1),[c,d]=r.useState(null),{isAuthenticated:u}=Ae(),f=r.useMemo(()=>fe(K.baseUrl),[]),k=Be(),{page:S,setPage:_}=ta(),{data:L,isLoading:w,isError:D,refetch:p}=It(S,j,0,l||void 0,"created_date","desc"),C=L?.agents||[],g=L?.total||0,{data:E}=He(t&&!C.find(b=>b.id===t)?t:void 0),H=r.useMemo(()=>{const b=[...C];return E&&!b.find(I=>I.id===E.id)&&b.push(E),b.sort((I,$)=>new Date($.created_date).getTime()-new Date(I.created_date).getTime()),b},[C,E]),ae=r.useCallback(b=>{_(b)},[_]),M=r.useCallback(b=>{s(b)},[s]),P=r.useCallback(()=>{m(!0)},[]),W=r.useCallback(()=>{m(!1)},[]),Z=r.useCallback(async b=>{try{const I=await k.mutateAsync(b),$=H.find(Ge=>Ge.id===b),O=$?$.name.replace(/\s+/g,"-").toLowerCase():b,V=URL.createObjectURL(I),X=document.createElement("a");X.href=V,X.download=`${O}-export.zip`,document.body.appendChild(X),X.click(),URL.revokeObjectURL(V),document.body.removeChild(X)}catch(I){console.error("Failed to export agent:",I)}},[H,k]),J=r.useCallback(b=>{d(b),y(!0)},[]),z=r.useCallback(()=>{y(!1),d(null)},[]),le=r.useCallback(async b=>{try{const $=((await p()).data?.agents||[]).find(V=>V.id===b);if($){s($);return}const O=await f.agents.getAgent(b);O.status<400&&O.result&&s(O.result)}catch(I){console.error("Error selecting newly created agent:",I)}},[s,p,f]),ce=r.useCallback(b=>{a(`/chat/${b}`)},[a]),v=r.useCallback(b=>{p(),a("/agents")},[t,p,a]),U=r.useCallback(b=>{J(b)},[J]);return e.jsxs("div",{className:"flex h-full w-full flex-col overflow-hidden border-hairline border-r bg-surface",children:[e.jsx(sa,{title:"Agents",searchQuery:i,onSearchChange:b=>n(b),onNewAgentClick:o,onImportAgentClick:P,importAgentTooltip:"Import an agent from a ZIP file"}),w?e.jsx("div",{className:"flex flex-1 items-center justify-center",children:e.jsx(De,{size:"lg",label:"Loading agents"})}):D?e.jsxs(ne,{variant:"danger",role:"alert",className:"m-4 w-auto",children:[e.jsx(ee,{children:"Failed to load agents. Please try again."}),e.jsx(T,{variant:"ghost",size:"sm",className:"self-start",onClick:()=>p(),children:"Retry"})]}):H.length===0&&!w?e.jsx("p",{className:"p-6 text-center text-body-sm text-ink-muted",children:i?"No agents match your search":"No agents found"}):e.jsx(at,{delayDuration:ya,skipDelayDuration:0,children:e.jsx("ul",{className:"flex min-h-0 flex-1 flex-col gap-1 overflow-y-auto p-2",children:H.map(b=>e.jsx(va,{agent:b,isSelected:t===b.id||E?.id===b.id,onSelectAgent:M,onChatWithAgent:ce,onExportAgent:Z,onAgentDeleted:v,onUploadAgentToHub:U},b.id))})}),e.jsx(aa,{open:x,onClose:W,onAgentImported:le}),g>0&&e.jsx(Lt,{page:S,count:Math.max(1,Math.ceil(g/j)),onChange:ae}),e.jsx(Qe,{open:h,onClose:z,agent:c,isAuthenticated:u})]})},Na=r.memo(wa),La=()=>{const{agentId:t,navigateToAgent:s}=Dt(),a=be(),{isAuthenticated:i}=Ae(),[n,o]=r.useState(!1),l=Be(),{setLastAgentsPageAgentId:x,getLastAgentId:m}=Le(),j=t||m("agents"),{data:h,refetch:y}=He(j||void 0);r.useEffect(()=>{t&&x(t)},[t,x]);const c=async()=>{if(h)try{const k=await l.mutateAsync(h.id),S=URL.createObjectURL(k),_=document.createElement("a");_.href=S,_.download=`${h.name.replace(/\s+/g,"-").toLowerCase()}-lo-agent.zip`,document.body.appendChild(_),_.click(),URL.revokeObjectURL(S),document.body.removeChild(_)}catch(k){console.error("Failed to export agent:",k)}},d=()=>{o(!0)},u=()=>{o(!1)},f=k=>{x(k.id),s(k.id,"agents")};return e.jsxs("div",{className:"flex h-full w-full overflow-hidden",children:[e.jsx("div",{className:"h-full w-70 shrink-0",children:e.jsx(Na,{selectedAgentId:h?.id,onSelectAgent:f})}),e.jsx("div",{className:"h-full grow overflow-hidden",children:e.jsxs("div",{className:"flex h-full flex-col gap-8 p-4 sm:p-6 lg:p-8",children:[e.jsx("div",{className:"mx-auto w-full max-w-4xl",children:e.jsx(Ye,{title:"Agent management",icon:ge,subtitle:"View, configure and manage your agents",children:h&&e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs(_e,{children:[e.jsx(Ie,{asChild:!0,children:e.jsx(T,{"data-tour-tag":"upload-to-hub-header-button",variant:"secondary",size:"icon","aria-label":"More agent actions",className:"@min-[400px]:hidden",children:e.jsx(Et,{"aria-hidden":"true"})})}),e.jsxs(Se,{align:"end",className:"min-w-45",children:[e.jsxs(B,{disabled:l.isPending,onSelect:c,children:[e.jsx(ke,{"aria-hidden":"true"}),e.jsx("span",{children:"Export"})]}),e.jsxs(B,{onSelect:d,children:[e.jsx(pe,{"aria-hidden":"true"}),e.jsx("span",{children:"Upload to hub"})]})]})]}),e.jsxs(T,{variant:"secondary",onClick:c,disabled:l.isPending,className:"hidden @min-[400px]:inline-flex",children:[e.jsx(ke,{"aria-hidden":"true"}),"Export"]}),e.jsxs(T,{"data-tour-tag":"upload-to-hub-header-button","data-tour-action":"open-upload-dialog",variant:"secondary",onClick:d,className:"hidden @min-[400px]:inline-flex",children:[e.jsx(pe,{"aria-hidden":"true"}),"Upload to hub"]}),e.jsx(q,{content:`Chat with ${h.name||"this agent"}`,children:e.jsxs(T,{variant:"primary",onClick:()=>a(`/chat/${h.id}`),children:[e.jsx(Ue,{"aria-hidden":"true"}),"Chat"]})})]})})}),e.jsx("div",{className:"min-h-0 grow overflow-hidden",children:e.jsx(da,{selectedAgent:h??null,refetchAgent:y,initialSelectedAgentId:t})})]})}),h&&e.jsx(Qe,{open:n,onClose:u,agent:h,isAuthenticated:i})]})};export{La as LegacyAgentsPage};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a4 as l,a5 as d,a6 as c,a7 as h,a8 as s,a9 as b,aa as m,ab as g,ac as p,ad as _,ae as w}from"./index-DyfVjYXR.js";const i={malware_or_exploitation:"Instructions to build or spread malware, or to attack systems you do not own, cannot be published.",credential_theft:"Instructions to obtain someone else's credentials or tokens cannot be published.",fraud_or_deception:"Instructions to deceive or defraud people cannot be published.",harassment_or_hate:"Instructions to harass, threaten or target people cannot be published.",sexual_content_minors:"This agent cannot be published. If you believe this is a mistake, contact support.",sexual_content:"Explicit sexual content cannot be published.",violence_or_weapons:"Instructions to build weapons or to injure people cannot be published.",drugs_or_controlled_substances:"Instructions to make or traffic illegal drugs cannot be published.",self_harm:"This agent cannot be published. If you believe this is a mistake, contact support.",mass_surveillance_or_privacy_abuse:"Instructions to surveil or profile people without their consent cannot be published.",evasion_or_abuse_tooling:"Instructions to evade or defeat safety and anti-abuse systems cannot be published.",prompt_injection:"This instruction set tries to instruct the reviewer rather than describe an agent, so it cannot be published.",unclear_dual_use:"We could not tell whether this is aimed at your own systems or someone else's. Add a sentence stating the scope and target, then publish again.",other_harmful:"This agent was rejected because its instructions would cause harm."},f=n=>{const t=n.trim();return t.length>12&&/\s/.test(t)&&!/^(not found|bad request|unauthorized|error|internal server error)\.?$/i.test(t)};function y(n){const t=n?.categories?.[0];return t&&m(t)?i[t]:i.other_harmful}function T(n,t){const e=t?.rule?` ${t.rule}`:"";switch(t?.field){case"name":return{body:`Name${e||" is not acceptable"}.`,field:"name"};case"instructions":return{body:e?`The instruction body${e}.`:`The instruction body must be between 1 and ${b} characters.`,field:"instructions"};case"description":return{body:`Description${e}.`,field:"description"};case"tools":return{body:`Tools${e}.`,field:"tools"};case"when_to_use":return{body:`When to use${e}.`,field:"when_to_use"};case"categories":return{body:`Categories${e}.`,field:"categories"};case"tags":return{body:`Tags${e}.`,field:"tags"};default:return{body:n,field:null}}}function k(n,t){const e=t.name.trim()||"this agent";switch(n.code){case"name_taken":return n.details?.owned_by_caller===!0?{variant:"danger",headline:"You already published this agent",body:`You published "${e}" already. Update that listing instead of publishing a second one.`,note:null,actions:n.details?.existing_agent_id||t.hubAgentId?["update-listing","focus-name"]:["focus-name"]}:{variant:"danger",headline:"That name is taken",body:`"${e}" is already published on the hub by another account. Agent names are unique across the hub.`,note:null,actions:["focus-name"]};case"name_claim_in_flight":return{variant:"warning",headline:"That name is being published right now",body:`Someone is publishing an agent called "${e}" at this moment. It is not claimed — try again in a moment.`,note:null,actions:["retry"]};case"name_reserved_builtin":{const o=n.details?.builtin_name,a=o?s(o)===s(e):!1;return{variant:"danger",headline:"That name is reserved",body:o&&!a?`"${e}" is reserved by the built-in agent "${o}". Built-in names cannot be published to the hub.`:`"${o??e}" is the name of a built-in agent. Built-in names cannot be published to the hub.`,note:null,actions:["focus-name","install-builtin"]}}case"moderation_rejected":return{variant:"danger",headline:"This agent was not accepted",body:n.details?.reason?.trim()||n.message,note:y(n.details),actions:["edit-instructions"]};case"moderation_unavailable":return{variant:"warning",headline:"Review is temporarily unavailable",body:"We could not review this agent just now. Nothing was published. Try again in a minute.",note:null,actions:["retry"]};case"invalid_instruction_set":{const{body:o,field:a}=T(n.message,n.details);return{variant:"danger",headline:"The agent document is not valid",body:o,note:null,actions:a==="name"?["focus-name"]:a==="instructions"?["edit-instructions"]:["edit-agent"]}}case"payload_too_large":{const o=n.details?.limit_bytes;return{variant:"danger",headline:"This agent is too large to publish",body:o?`The instruction set is larger than ${Math.round(o/1024)} KiB. Shorten the instructions.`:"The instruction set is larger than the hub accepts. Shorten the instructions.",note:null,actions:["edit-instructions"]}}case"not_owner":return{variant:"danger",headline:"You cannot update this listing",body:"This listing belongs to another account.",note:null,actions:["publish-as-new"]};case"agent_not_found":return{variant:"danger",headline:"That listing no longer exists",body:"It may have been delisted.",note:null,actions:["publish-as-new","refresh-hub"]};case"hub_unauthorized":return{variant:"danger",headline:"The hub refused this machine's sign-in",body:"Nothing was published. Sign in to Radient again to replace the credential the hub refused, then publish again.",note:null,actions:["sign-in"]};case"hub_unavailable":return{variant:"warning",headline:"The publication did not go through",body:f(n.message)?n.message:"Nothing was published. Try again in a moment, or update the backend if the hub has moved.",note:null,actions:["retry"]};case"local_failure":return{variant:"warning",headline:"The agent could not be published from this machine",body:n.message,note:null,actions:["retry"]};default:return{variant:"danger",headline:"The agent could not be published",body:n.message,note:null,actions:["retry"]}}}const v=[/^(?:Download agent from Radient failed: )?(?:Error downloading agent from Radient: )?\s*/,/^Failed to download agent(?: [^\s]+)? from Radient Agent Hub(?: due to a requests error)?:\s*/,/^[A-Za-z_][\w.]*\([^)]*\):\s*/],$=/^(\d{3})\b/,I=new Set([404,410]),N=["read timed out","connection timed out","connection refused","connection aborted","connection reset","connectionerror","connecttimeout","remote end closed connection","max retries exceeded","temporary failure in name resolution","name or service not known","no route to host"],R=n=>{const t=n.toLowerCase();return N.some(e=>t.includes(e))||h(n)},A=(n,t)=>{const e=t.trim()?`"${t.trim()}"`:"That agent";if(d(n))switch(n.code){case"agent_not_found":return`${e} is no longer on the hub, so nothing was downloaded.`;case"hub_unavailable":return`The hub did not complete the download, so ${e} was not downloaded.`;default:return`${e} was not downloaded: ${n.message}`}const o=v.reduce((r,u)=>r.replace(u,""),c(n,"").trim()).trim();if(!o)return`${e} could not be downloaded.`;const a=Number($.exec(o)?.[1]??Number.NaN);return I.has(a)?`${e} is no longer on the hub, so nothing was downloaded.`:R(o)||a===408?`The hub could not be reached, so ${e} was not downloaded.`:a===429?`The hub is busy, so ${e} was not downloaded. Try again in a moment.`:a===401||a===403?`The hub refused this machine's sign-in, so ${e} was not downloaded.`:a>=500?`The hub could not complete the download, so ${e} was not downloaded. Try again in a moment.`:a>=400?`The hub refused the download, so ${e} is not here.`:`${e} was not downloaded: ${o}`},L="The action did not complete.",C=(n,t,e)=>n==="download"?A(t,e):l(L,t),S={name:"Name",description:"Description",instructions:"The instruction body",tools:"Tools"};function x(n){const t=[],e=(o,a)=>{a&&t.push({field:o,message:`${S[o]} ${a}.`})};return e("name",g(n.name)),e("description",p(n.description)),n.instructions!==null&&e("instructions",_(n.instructions)),e("tools",w(n.tools??[])),t}function O(n,t){const e=s(n);return t.some(o=>s(o)===e)}function P(n){for(const t of n??[]){const e=t.indexOf(":");if(e<0||t.slice(0,e).trim().toLowerCase()!=="tools")continue;const o=t.slice(e+1).split(",").map(a=>a.trim()).filter(Boolean);return o.length>0?o:null}return null}function U(n,t){const e=s(n);return t.find(o=>s(o)===e)??null}export{C as a,k as b,O as i,U as l,x as p,P as t};
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import{c as h,A as m,S as p}from"./error-boundary-BX3Jjofp.js";import{j as e,c}from"./index-hIJSZMtz.js";import{f as u,b as v,d as g,af as k,ag as b,ah as f}from"./index-DyfVjYXR.js";/**
|
|
2
|
-
* @license lucide-react v0.507.0 - ISC
|
|
3
|
-
*
|
|
4
|
-
* This source code is licensed under the ISC license.
|
|
5
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
6
|
-
*/const j=[["path",{d:"M13.4 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-7.4",key:"re6nr2"}],["path",{d:"M2 6h4",key:"aawbzj"}],["path",{d:"M2 10h4",key:"l0bgd4"}],["path",{d:"M2 14h4",key:"1gsvsf"}],["path",{d:"M2 18h4",key:"1bu2t1"}],["path",{d:"M21.378 5.626a1 1 0 1 0-3.004-3.004l-5.01 5.012a2 2 0 0 0-.506.854l-.837 2.87a.5.5 0 0 0 .62.62l2.87-.837a2 2 0 0 0 .854-.506z",key:"pqwjuv"}]],I=h("notebook-pen",j),S=({title:t,description:a,icon:s,children:n,titleComponent:l,sectionRef:i,dataTourTag:d,className:o,id:r})=>e.jsxs("div",{ref:i,id:r,tabIndex:r?-1:void 0,"data-tour-tag":d,className:c("w-full",o),children:[l??e.jsxs("h2",{className:"flex items-center gap-2 text-heading text-ink",children:[s&&e.jsx(s,{size:16,className:"shrink-0 text-ink-dim"}),t]}),a&&e.jsx("p",{className:"mt-1 max-w-2xl text-body-sm text-ink-muted",children:a}),e.jsx("div",{className:"mt-4",children:n})]}),D=({label:t,value:a,className:s,valueClassName:n})=>e.jsxs("div",{className:c("min-w-0",s),children:[e.jsx("div",{className:"flex items-center gap-1.5 text-meta text-ink-dim",children:t}),e.jsx("div",{className:c("mt-0.5 break-words text-body-sm",n??"text-ink"),children:a})]}),M=({children:t,className:a})=>e.jsx("div",{className:c("grid grid-cols-[repeat(auto-fit,minmax(160px,1fr))] gap-x-6 gap-y-4",a),children:t}),y="radient",C=({onSignInSuccess:t,onAfterCredentialUpdate:a,titleText:s="Sign in to Radient",descriptionText:n="Connect your Radient account to use Radient services."})=>{const l=u(),i=v(),d=g(i.data,"auth"),o=k(d),r=o.data?.find(x=>x.id===y);return i.isSuccess&&!d?e.jsx(m,{variant:"warning",children:"Signing in needs a newer Local Operator backend. Update the backend and restart the app."}):o.isLoading||i.isLoading?e.jsx("div",{className:"flex h-24 items-center justify-center",children:e.jsx(p,{size:"md",label:"Loading sign-in options"})}):r?e.jsxs("div",{className:"mx-auto w-full max-w-md",children:[s&&e.jsx("p",{className:"mb-2 text-center text-heading text-ink",children:s}),n&&e.jsx("p",{className:"mb-6 text-center text-body-sm text-ink-muted",children:n}),e.jsx(b,{provider:r,onConnected:()=>{l.invalidateQueries({queryKey:f.all}),a?.(),t?.()}})]}):e.jsx(m,{variant:"warning",children:"Radient is not available from this backend's provider registry."})};export{M as I,I as N,C as R,S,D as a};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{s as r,b as e,a,S as s}from"./chunk-AEK57VVT-pv5-Z61i.js";import{_ as i}from"./mermaid.core-Dm5FgUKb.js";import"./chunk-RZ5BOZE2-DNjaGyn6.js";import"./index-DyfVjYXR.js";import"./index-hIJSZMtz.js";import"./error-boundary-BX3Jjofp.js";import"./console-mirror-BoykuSNB.js";var n={parser:a,get db(){return new s(2)},renderer:e,styles:r,init:i(t=>{t.state||(t.state={}),t.state.arrowMarkerAbsolute=t.arrowMarkerAbsolute},"init")};export{n as diagram};
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
import{c as d}from"./error-boundary-BX3Jjofp.js";import{t as q,c as H,n as K,a as z,g as Q,e as V,h as D,i as N,j as C,f as S}from"./en-US-BkS8Ixxl.js";import{j as i,c as b,r as Y}from"./index-hIJSZMtz.js";import{b5 as $,b6 as B,U as Z,b7 as G,b8 as W,b9 as h,am as A,g as E,ba as X,aA as J,f as _,ar as M,h as ee,as as I,bb as te,bc as F,bd as L,be as ne}from"./index-DyfVjYXR.js";import{B as ae}from"./book-open-B8nHgs3o.js";import{l as se}from"./publication-validation-Cke6xOnn.js";/**
|
|
2
|
-
* @license lucide-react v0.507.0 - ISC
|
|
3
|
-
*
|
|
4
|
-
* This source code is licensed under the ISC license.
|
|
5
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
6
|
-
*/const oe=[["path",{d:"M16 20V4a2 2 0 0 0-2-2h-4a2 2 0 0 0-2 2v16",key:"jecpp"}],["rect",{width:"20",height:"14",x:"2",y:"6",rx:"2",key:"i6l2r4"}]],re=d("briefcase",oe);/**
|
|
7
|
-
* @license lucide-react v0.507.0 - ISC
|
|
8
|
-
*
|
|
9
|
-
* This source code is licensed under the ISC license.
|
|
10
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
11
|
-
*/const ie=[["line",{x1:"18",x2:"18",y1:"20",y2:"10",key:"1xfpm4"}],["line",{x1:"12",x2:"12",y1:"20",y2:"4",key:"be30l9"}],["line",{x1:"6",x2:"6",y1:"20",y2:"14",key:"1r4le6"}]],ce=d("chart-no-axes-column",ie);/**
|
|
12
|
-
* @license lucide-react v0.507.0 - ISC
|
|
13
|
-
*
|
|
14
|
-
* This source code is licensed under the ISC license.
|
|
15
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
16
|
-
*/const ue=[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1",key:"tgr4d6"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2",key:"116196"}],["path",{d:"M12 11h4",key:"1jrz19"}],["path",{d:"M12 16h4",key:"n85exb"}],["path",{d:"M8 11h.01",key:"1dfujw"}],["path",{d:"M8 16h.01",key:"18s6g9"}]],le=d("clipboard-list",ue);/**
|
|
17
|
-
* @license lucide-react v0.507.0 - ISC
|
|
18
|
-
*
|
|
19
|
-
* This source code is licensed under the ISC license.
|
|
20
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
21
|
-
*/const de=[["path",{d:"M21.54 15H17a2 2 0 0 0-2 2v4.54",key:"1djwo0"}],["path",{d:"M7 3.34V5a3 3 0 0 0 3 3a2 2 0 0 1 2 2c0 1.1.9 2 2 2a2 2 0 0 0 2-2c0-1.1.9-2 2-2h3.17",key:"1tzkfa"}],["path",{d:"M11 21.95V18a2 2 0 0 0-2-2a2 2 0 0 1-2-2v-1a2 2 0 0 0-2-2H2.05",key:"14pb5j"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],he=d("earth",de);/**
|
|
22
|
-
* @license lucide-react v0.507.0 - ISC
|
|
23
|
-
*
|
|
24
|
-
* This source code is licensed under the ISC license.
|
|
25
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
26
|
-
*/const me=[["path",{d:"M12 17h.01",key:"p32p05"}],["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7z",key:"1mlx9k"}],["path",{d:"M9.1 9a3 3 0 0 1 5.82 1c0 2-3 3-3 3",key:"mhlwft"}]],fe=d("file-question",me);/**
|
|
27
|
-
* @license lucide-react v0.507.0 - ISC
|
|
28
|
-
*
|
|
29
|
-
* This source code is licensed under the ISC license.
|
|
30
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
31
|
-
*/const ye=[["path",{d:"M14 2v6a2 2 0 0 0 .245.96l5.51 10.08A2 2 0 0 1 18 22H6a2 2 0 0 1-1.755-2.96l5.51-10.08A2 2 0 0 0 10 8V2",key:"18mbvz"}],["path",{d:"M6.453 15h11.094",key:"3shlmq"}],["path",{d:"M8.5 2h7",key:"csnxdl"}]],ge=d("flask-conical",ye);/**
|
|
32
|
-
* @license lucide-react v0.507.0 - ISC
|
|
33
|
-
*
|
|
34
|
-
* This source code is licensed under the ISC license.
|
|
35
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
36
|
-
*/const pe=[["path",{d:"M21.42 10.922a1 1 0 0 0-.019-1.838L12.83 5.18a2 2 0 0 0-1.66 0L2.6 9.08a1 1 0 0 0 0 1.832l8.57 3.908a2 2 0 0 0 1.66 0z",key:"j76jl0"}],["path",{d:"M22 10v6",key:"1lu8f3"}],["path",{d:"M6 12.5V16a6 3 0 0 0 12 0v-3.5",key:"1r8lef"}]],ke=d("graduation-cap",pe);/**
|
|
37
|
-
* @license lucide-react v0.507.0 - ISC
|
|
38
|
-
*
|
|
39
|
-
* This source code is licensed under the ISC license.
|
|
40
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
41
|
-
*/const xe=[["path",{d:"M19 14c1.49-1.46 3-3.21 3-5.5A5.5 5.5 0 0 0 16.5 3c-1.76 0-3 .5-4.5 2-1.5-1.5-2.74-2-4.5-2A5.5 5.5 0 0 0 2 8.5c0 2.3 1.5 4.05 3 5.5l7 7Z",key:"c3ymky"}],["path",{d:"M3.22 12H9.5l.5-1 2 4.5 2-7 1.5 3.5h5.27",key:"1uw2ng"}]],we=d("heart-pulse",xe);/**
|
|
42
|
-
* @license lucide-react v0.507.0 - ISC
|
|
43
|
-
*
|
|
44
|
-
* This source code is licensed under the ISC license.
|
|
45
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
46
|
-
*/const be=[["path",{d:"M19 14c1.49-1.46 3-3.21 3-5.5A5.5 5.5 0 0 0 16.5 3c-1.76 0-3 .5-4.5 2-1.5-1.5-2.74-2-4.5-2A5.5 5.5 0 0 0 2 8.5c0 2.3 1.5 4.05 3 5.5l7 7Z",key:"c3ymky"}]],Be=d("heart",be);/**
|
|
47
|
-
* @license lucide-react v0.507.0 - ISC
|
|
48
|
-
*
|
|
49
|
-
* This source code is licensed under the ISC license.
|
|
50
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
51
|
-
*/const Ae=[["path",{d:"m3 11 18-5v12L3 14v-3z",key:"n962bs"}],["path",{d:"M11.6 16.8a3 3 0 1 1-5.8-1.6",key:"1yl0tm"}]],_e=d("megaphone",Ae);/**
|
|
52
|
-
* @license lucide-react v0.507.0 - ISC
|
|
53
|
-
*
|
|
54
|
-
* This source code is licensed under the ISC license.
|
|
55
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
56
|
-
*/const Me=[["path",{d:"m16 16 3-8 3 8c-.87.65-1.92 1-3 1s-2.13-.35-3-1Z",key:"7g6ntu"}],["path",{d:"m2 16 3-8 3 8c-.87.65-1.92 1-3 1s-2.13-.35-3-1Z",key:"ijws7r"}],["path",{d:"M7 21h10",key:"1b0cd5"}],["path",{d:"M12 3v18",key:"108xh3"}],["path",{d:"M3 7h2c2 0 5-1 7-2 2 1 5 2 7 2h2",key:"3gwbw2"}]],je=d("scale",Me);/**
|
|
57
|
-
* @license lucide-react v0.507.0 - ISC
|
|
58
|
-
*
|
|
59
|
-
* This source code is licensed under the ISC license.
|
|
60
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
61
|
-
*/const ve=[["circle",{cx:"8",cy:"21",r:"1",key:"jimo8o"}],["circle",{cx:"19",cy:"21",r:"1",key:"13723u"}],["path",{d:"M2.05 2.05h2l2.66 12.42a2 2 0 0 0 2 1.58h9.78a2 2 0 0 0 1.95-1.57l1.65-7.43H5.12",key:"9zh506"}]],qe=d("shopping-cart",ve);function ze(e,t){const o=+q(e)-+q(t);return o<0?-1:o>0?1:o}function De(e){return H(e,Date.now())}function Ne(e){return t=>{const n=(e?Math[e]:Math.trunc)(t);return n===0?0:n}}function Ce(e,t,o){const n=Q(),a=o?.locale??n.locale??V,s=ze(e,t);if(isNaN(s))throw new RangeError("Invalid time value");const r=Object.assign({},o,{addSuffix:o?.addSuffix,comparison:s}),[f,g]=K(o?.in,...s>0?[t,e]:[e,t]),c=Ne("round"),u=g.getTime()-f.getTime(),p=u/S,P=z(g)-z(f),k=(u-P)/S,U=o?.unit;let m;if(p<1?m="second":p<60?m="minute":p<D?m="hour":k<N?m="day":k<C?m="month":m="year",m==="second"){const l=c(u/1e3);return a.formatDistance("xSeconds",l,r)}else if(m==="minute"){const l=c(p);return a.formatDistance("xMinutes",l,r)}else if(m==="hour"){const l=c(p/60);return a.formatDistance("xHours",l,r)}else if(m==="day"){const l=c(k/D);return a.formatDistance("xDays",l,r)}else if(m==="month"){const l=c(k/N);return l===12&&U!=="month"?a.formatDistance("xYears",1,r):a.formatDistance("xMonths",l,r)}else{const l=c(k/C);return a.formatDistance("xYears",l,r)}}function Ze(e,t){return Ce(e,De(e),t)}const O={investment:{icon:i.jsx(re,{size:14,"aria-hidden":"true"}),label:"Investment"},accounting:{icon:i.jsx(ae,{size:14,"aria-hidden":"true"}),label:"Accounting"},healthcare:{icon:i.jsx(we,{size:14,"aria-hidden":"true"}),label:"Healthcare"},legal:{icon:i.jsx(je,{size:14,"aria-hidden":"true"}),label:"Legal"},software:{icon:i.jsx(W,{size:14,"aria-hidden":"true"}),label:"Software"},security:{icon:i.jsx(G,{size:14,"aria-hidden":"true"}),label:"Security"},role_play:{icon:i.jsx(Z,{size:14,"aria-hidden":"true"}),label:"Role play"},personal_assistance:{icon:i.jsx(B,{size:14,"aria-hidden":"true"}),label:"Personal assistance"},education:{icon:i.jsx(ke,{size:14,"aria-hidden":"true"}),label:"Education"},marketing:{icon:i.jsx(_e,{size:14,"aria-hidden":"true"}),label:"Marketing"},sales:{icon:i.jsx(qe,{size:14,"aria-hidden":"true"}),label:"Sales"},research:{icon:i.jsx(ge,{size:14,"aria-hidden":"true"}),label:"Research"},analysis:{icon:i.jsx(ce,{size:14,"aria-hidden":"true"}),label:"Analysis"},management:{icon:i.jsx(le,{size:14,"aria-hidden":"true"}),label:"Management"},social_media:{icon:i.jsx(he,{size:14,"aria-hidden":"true"}),label:"Social media"},other:{icon:i.jsx(fe,{size:14,"aria-hidden":"true"}),label:"Other"}};function x(e){const t=e.split("_").join(" ");return t.charAt(0).toUpperCase()+t.slice(1)}const Se=e=>O[e]??{icon:i.jsx($,{size:14,"aria-hidden":"true"}),label:x(e)},T="inline-flex min-h-5.5 items-center rounded-full border border-hairline bg-sunken px-2 text-meta leading-none",Ge=({tags:e,categories:t,className:o})=>{if((!e||e.length===0)&&(!t||t.length===0))return null;const n=new Set((t??[]).map(s=>(O[s]?.label??x(s)).toLowerCase())),a=(e??[]).filter(s=>!n.has(x(s).toLowerCase()));return i.jsxs("div",{className:b("relative flex flex-wrap items-center gap-1.5 overflow-hidden",o),"data-testid":"agent-tags-and-categories",children:[t?.map(s=>{const r=Se(s);return i.jsxs("span",{className:b(T,"gap-1 font-medium text-ink-muted"),children:[r.icon,r.label]},s)}),a.map(s=>i.jsxs("span",{className:b(T,"gap-1 font-normal text-ink-dim"),children:[i.jsx($,{size:12,"aria-hidden":"true"}),x(s)]},s))]})};function y(){return crypto.randomUUID()}async function Ie(e=1,t=20,o){const n={page:e,per_page:t};if(o)for(const[a,s]of Object.entries(o))s&&(n[a]=s);return h({operation:"agents.list",query:n})}async function We(e){return h({operation:"agents.get",agentId:e})}async function Xe(e){return h({operation:"agents.delete",agentId:e,requestId:y(),confirmed:!0})}async function Le(e){return h({operation:"agents.like",agentId:e,requestId:y()})}async function Te(e){return h({operation:"agents.unlike",agentId:e,requestId:y(),confirmed:!0})}async function $e(e){return h({operation:"agents.favourite",agentId:e,requestId:y()})}async function Ee(e){return h({operation:"agents.unfavourite",agentId:e,requestId:y(),confirmed:!0})}async function Je(e,t){return h({operation:"comments.create",agentId:e,payload:t,requestId:y()})}async function et(e,t=1,o=20){return h({operation:"comments.list",agentId:e,query:{page:t,per_page:o}})}async function tt(e,t,o){return h({operation:"comments.update",agentId:e,commentId:t,payload:o,requestId:y()})}async function nt(e,t){return h({operation:"comments.delete",agentId:e,commentId:t,requestId:y(),confirmed:!0})}async function Fe(e){return h({operation:"agents.statuses",query:{agent_ids:e.join(",")}})}const j={all:["agent-statuses"],page:e=>[...j.all,"page",[...e]]},Oe=e=>[...new Set(e)].sort(),at=({agentIds:e,enabled:t=!0})=>{const{isAuthenticated:o}=A(),n=e.join(","),a=Y.useMemo(()=>Oe(e),[n]),s=E({queryKey:j.page(a),queryFn:async()=>(await Fe(a)).result?.statuses??{},enabled:t&&o&&a.length>0,staleTime:5*60*1e3,gcTime:10*60*1e3,refetchOnWindowFocus:!1,retry:!1});return{...s,statuses:s.data??{},isKnown:s.isSuccess}},st=(e,t,o)=>o?e&&t[o]!==void 0:!1,R=(e,t,o)=>{e.setQueriesData({queryKey:j.all},n=>{if(!n)return n;const a=n[t]??{liked:!1,favourited:!1};return{...n,[t]:{...a,...o}}})},Re="download_count",w={all:["public-agents"],list:e=>[...w.all,"list",{page:e.page,perPage:e.perPage,categories:e.categories?.join(",")??void 0,name:e.name??void 0,description:e.description??void 0,sort:e.sort,order:e.order}]},ot=e=>e.invalidateQueries({queryKey:w.all}),rt=({page:e=1,perPage:t=20,enabled:o=!0,categories:n,name:a,description:s,sort:r=Re,order:f="desc"}={})=>{const g={page:e,perPage:t,categories:n,name:a,description:s,sort:r,order:f},c=E({queryKey:w.list(g),queryFn:async()=>{const u={};return n&&n.length>0&&(u.categories=n.join(",")),a&&(u.name=a),s&&(u.description=s),u.sort=r,u.order=f,await Ie(e,t,u)},select:u=>u.result,enabled:o,retry:J,staleTime:5*60*1e3,gcTime:10*60*1e3,refetchOnWindowFocus:!1,placeholderData:X});return{...c,agents:c.data?.records,isRefreshing:c.isFetching&&c.data!==void 0,pagination:c.data?{page:c.data.page,perPage:c.data.per_page,totalPages:c.data.total_pages,totalRecords:c.data.total_records}:void 0}},v=(e,{agentId:t,field:o,delta:n})=>{e.setQueriesData({queryKey:w.all},a=>{if(!a)return a;const s=a.result?.records??[];return s.some(r=>r.id===t)?{...a,result:{...a.result,records:s.map(r=>r.id===t?{...r,[o]:Math.max(0,(r[o]??0)+n)}:r)}}:a})},it=()=>{const e=_(),{isAuthenticated:t}=A();return M({mutationFn:async({agentId:n,isCurrentlyFavourited:a})=>{if(!t)throw new Error("Authentication required to favourite/unfavourite an agent.");if(!n)throw new Error("Agent ID is required.");return a?(await Ee(n),{favourited:!1,changed:!0}):{favourited:!0,changed:(await $e(n)).result?.already_favourited!==!0}},onSuccess:({favourited:n,changed:a},s)=>{R(e,s.agentId,{favourited:n}),a&&v(e,{agentId:s.agentId,field:"favourite_count",delta:n?1:-1})}})},ct=()=>{const e=_(),{isAuthenticated:t}=A();return M({mutationFn:async({agentId:n,isCurrentlyLiked:a})=>{if(!t)throw new Error("Authentication required to like/unlike an agent.");if(!n)throw new Error("Agent ID is required.");return a?(await Te(n),{liked:!1,changed:!0}):{liked:!0,changed:(await Le(n)).result?.already_liked!==!0}},onSuccess:({liked:n,changed:a},s)=>{R(e,s.agentId,{liked:n}),a&&v(e,{agentId:s.agentId,field:"like_count",delta:n?1:-1})}})},Pe=(e,t)=>{const o=[];for(const[,n]of e.getQueriesData({queryKey:F}))for(const a of n?.agents??[])a.id!==t&&o.push(a.name);return o},ut=()=>{const e=_(),t=ee();return M({mutationFn:async({agentId:n})=>{if(!L.baseUrl)throw new Error("Local Operator API URL is not configured.");return ne.downloadAgentFromRadient(L.baseUrl,n)},onSuccess:(n,a)=>{const s=n.result,r=s?.name?.trim()||a.agentName?.trim()||"Agent",f=s?.renamed_from?.trim()||null,g=s?.id?se(r,Pe(e,s.id)):null;f?I(`Downloaded "${r}" — you already have an agent called "${f}".`):g?te(`Downloaded "${r}". You already have an agent called "${g}", so two agents now answer to that name and either may be picked. Rename one of them.`):I(`Downloaded "${r}" from the hub.`),e.invalidateQueries({queryKey:F}),v(e,{agentId:a.agentId,field:"download_count",delta:1});const c=n.result;c?.id?t(`/chat/${c.id}`):console.warn("Downloaded agent ID not found in response, cannot navigate to chat.")}})};export{Ge as A,O as C,Be as H,it as a,ut as b,Se as c,rt as d,at as e,Ze as f,Je as g,tt as h,st as i,nt as j,We as k,et as l,ot as m,Xe as n,ct as u};
|
|
File without changes
|