local-operator-ui 0.44.2 → 0.45.1
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 +1931 -19
- package/out/preload/index.js +140 -4
- package/out/renderer/assets/{_basePickBy-LPJBKSk3.js → _basePickBy-CVZ8Tl0V.js} +1 -1
- package/out/renderer/assets/{_baseUniq-D8M8HOYM.js → _baseUniq-BobmJdk5.js} +1 -1
- package/out/renderer/assets/{agent-details-page-CZuUDIS7.js → agent-details-page-D8Tarcuy.js} +2 -2
- package/out/renderer/assets/{agent-hub-page-B2h53zmZ.js → agent-hub-page-CBGln8EN.js} +2 -2
- package/out/renderer/assets/{agents-page-DxPAtB0k.js → agents-page-CYG5qf21.js} +3 -3
- package/out/renderer/assets/{approvalsOverlay-BjR3EVfg.js → approvalsOverlay-S8pdZ3-7.js} +1 -1
- package/out/renderer/assets/arc-Dg6ybBgr.js +1 -0
- package/out/renderer/assets/{architectureDiagram-IEHRJDOE-BKX_zyB3.js → architectureDiagram-IEHRJDOE-DHAX1jW8.js} +1 -1
- package/out/renderer/assets/{blockDiagram-JOT3LUYC-DesagpJf.js → blockDiagram-JOT3LUYC-DZcxg05T.js} +1 -1
- package/out/renderer/assets/{book-open-BGI5fs27.js → book-open-CdC2zEgH.js} +1 -1
- package/out/renderer/assets/browser-page-vhGc40ZY.js +1 -0
- package/out/renderer/assets/{browser-webauthn-prompt-dv7y6_dA.js → browser-webauthn-prompt-CdK-HuAT.js} +1 -1
- package/out/renderer/assets/{building-2-D2OTMmkt.js → building-2-Benl7pk9.js} +1 -1
- package/out/renderer/assets/{c4Diagram-VJAJSXHY-CWsH54Hv.js → c4Diagram-VJAJSXHY-Cx4qX_yG.js} +1 -1
- package/out/renderer/assets/channel-DExCwSCX.js +1 -0
- package/out/renderer/assets/{chunk-4BMEZGHF-B0-zmu4b.js → chunk-4BMEZGHF-BtkfVpFr.js} +1 -1
- package/out/renderer/assets/{chunk-A2AXSNBT-RQCYYGRS.js → chunk-A2AXSNBT-afZjtcpb.js} +1 -1
- package/out/renderer/assets/{chunk-AEK57VVT-DwkZ07Wr.js → chunk-AEK57VVT-Bpj7-5H4.js} +1 -1
- package/out/renderer/assets/{chunk-D6G4REZN-BWg_1fD9.js → chunk-D6G4REZN-BKkq1UmK.js} +1 -1
- package/out/renderer/assets/{chunk-RZ5BOZE2-3EjCkn2h.js → chunk-RZ5BOZE2-Dg2i64O_.js} +1 -1
- package/out/renderer/assets/{chunk-XZIHB7SX-DoadzlFd.js → chunk-XZIHB7SX-CaES14PJ.js} +1 -1
- package/out/renderer/assets/classDiagram-GIVACNV2-DLQDM2Ay.js +1 -0
- package/out/renderer/assets/classDiagram-v2-COTLJTTW-DLQDM2Ay.js +1 -0
- package/out/renderer/assets/clone-B68rMBW5.js +1 -0
- package/out/renderer/assets/{console-mirror-Cx1_mcwT.js → console-mirror-DSWcncyi.js} +1 -1
- package/out/renderer/assets/{consoleCapture-CBiwH6qH.js → consoleCapture-CUT0XggJ.js} +1 -1
- package/out/renderer/assets/{conversation-input-sync-6W6mDd5c.js → conversation-input-sync-zEjzdlxD.js} +269 -252
- package/out/renderer/assets/{dagre-OKDRZEBW-CkNv39Aw.js → dagre-OKDRZEBW-CCmRW0yR.js} +1 -1
- package/out/renderer/assets/{diagram-SSKATNLV-DKGhEDc0.js → diagram-SSKATNLV-CydNMulU.js} +1 -1
- package/out/renderer/assets/{diagram-VNBRO52H-2dRMMinF.js → diagram-VNBRO52H-Jg3izSnT.js} +1 -1
- package/out/renderer/assets/{erDiagram-Q7BY3M3F-BaZqUE9f.js → erDiagram-Q7BY3M3F-BE0KyDQW.js} +1 -1
- package/out/renderer/assets/{error-boundary-BhcUnSSp.js → error-boundary-D6IZ3d5-.js} +2 -2
- package/out/renderer/assets/{flowDiagram-4HSFHLVR-DO71jsf7.js → flowDiagram-4HSFHLVR-IF60u56J.js} +1 -1
- package/out/renderer/assets/{ganttDiagram-APWFNJXF-aaChmBo1.js → ganttDiagram-APWFNJXF-Ct9VCrPe.js} +4 -4
- package/out/renderer/assets/{gitGraphDiagram-7IBYFJ6S-DH2o95aG.js → gitGraphDiagram-7IBYFJ6S-Cm0QXAxs.js} +1 -1
- package/out/renderer/assets/{graph-BzuMIyA9.js → graph-CECEq7w7.js} +1 -1
- package/out/renderer/assets/{hash-Bof-oLZ7.js → hash-mEjOcoLm.js} +1 -1
- package/out/renderer/assets/{heart-Bd5kZnjR.js → heart-CjmRir0P.js} +1 -1
- package/out/renderer/assets/{index-CNnTZGuV.js → index-CoWefa1B.js} +1 -1
- package/out/renderer/assets/{index-Bf_5C9hH.js → index-DK94pJ0b.js} +202 -212
- package/out/renderer/assets/index-XEWoUf3I.js +1 -0
- package/out/renderer/assets/index-aqB-N4KQ.css +1 -0
- package/out/renderer/assets/index-k5Cho3oR.js +7 -0
- package/out/renderer/assets/infoDiagram-PH2N3AL5-B8el69WJ.js +2 -0
- package/out/renderer/assets/installer-CAaGsgAe.js +1 -0
- package/out/renderer/assets/{journeyDiagram-U35MCT3I-B1iYgquG.js → journeyDiagram-U35MCT3I-CYzjtyDG.js} +1 -1
- package/out/renderer/assets/{kanban-definition-NDS4AKOZ-D6b_9SBk.js → kanban-definition-NDS4AKOZ-DC4RazVr.js} +1 -1
- package/out/renderer/assets/{layout-BYe1V9vC.js → layout-DAYjqs7X.js} +1 -1
- package/out/renderer/assets/{legacy-agents-page-B4QsRAZI.js → legacy-agents-page-yWew17m3.js} +6 -6
- package/out/renderer/assets/library-page-DDZSxu8V.js +157 -0
- package/out/renderer/assets/{mermaid.core-CENNKUw2.js → mermaid.core-C3Fh0aVF.js} +5 -5
- package/out/renderer/assets/mesh-page-C-BLbDFS.js +1 -0
- package/out/renderer/assets/{messages-Bst4VOU3.js → messages-Du2guuiW.js} +10 -10
- package/out/renderer/assets/{mindmap-definition-ALO5MXBD-DPYnshtf.js → mindmap-definition-ALO5MXBD-BwYwzJXX.js} +1 -1
- package/out/renderer/assets/mini-aiIXUMzz.js +1 -0
- package/out/renderer/assets/{notebook-pen-CZVJiq5R.js → notebook-pen-Cbl0LGX4.js} +1 -1
- package/out/renderer/assets/notifications-page-CEtRrueI.js +1 -0
- package/out/renderer/assets/{org-access-DZc8cPye.js → org-access-Kw828GQV.js} +1 -1
- package/out/renderer/assets/{org-surface-gate-Bj7rZIwL.js → org-surface-gate-CT3zfrdt.js} +1 -1
- package/out/renderer/assets/{page-header-Dtg6CqtK.js → page-header-Nw5c8tPb.js} +1 -1
- package/out/renderer/assets/path-utils-CPnlSslq.js +58 -0
- package/out/renderer/assets/{pieDiagram-IB7DONF6-1_U-X3IZ.js → pieDiagram-IB7DONF6-K902j96U.js} +2 -2
- package/out/renderer/assets/project-markdown-BGwzkGeB.js +1 -0
- package/out/renderer/assets/{projects-page-Bw-AAZ11.js → projects-page-CwK1EUHo.js} +13 -13
- package/out/renderer/assets/publication-validation-_q5dCFqY.js +1 -0
- package/out/renderer/assets/{quadrantDiagram-7GDLP6J5-kbwdrehe.js → quadrantDiagram-7GDLP6J5-CMxcmmaj.js} +1 -1
- package/out/renderer/assets/{radar-MK3ICKWK-DpsIZo-R.js → radar-MK3ICKWK-BoTD7NCk.js} +1 -1
- package/out/renderer/assets/{radient-auth-buttons-C1Juzc0D.js → radient-auth-buttons-B3TH2lPK.js} +1 -1
- package/out/renderer/assets/{requirementDiagram-KVF5MWMF-qtUg8gWV.js → requirementDiagram-KVF5MWMF-CkhXXt7a.js} +1 -1
- package/out/renderer/assets/{sankeyDiagram-QLVOVGJD-B6i8Lf5L.js → sankeyDiagram-QLVOVGJD-D9vzlZ4F.js} +1 -1
- package/out/renderer/assets/{schedules-page-DjiYevaS.js → schedules-page-lflLstHa.js} +1 -1
- package/out/renderer/assets/{sequenceDiagram-X6HHIX6F-B3NVLrcT.js → sequenceDiagram-X6HHIX6F-BY5Td94x.js} +1 -1
- package/out/renderer/assets/{settings-page-BUpTYpEG.js → settings-page-DjSt92Lz.js} +6 -6
- package/out/renderer/assets/{smartart-BTOCcWLh.js → smartart-enfyFmW9.js} +1 -1
- package/out/renderer/assets/{stateDiagram-DGXRK772-nACatGwh.js → stateDiagram-DGXRK772-CvU5I-Gh.js} +1 -1
- package/out/renderer/assets/stateDiagram-v2-YXO3MK2T-C9OxG4rC.js +1 -0
- package/out/renderer/assets/team-bridge-page-EdYZwdEw.js +21 -0
- package/out/renderer/assets/{timeline-definition-BDJGKUSR-BXO43hMG.js → timeline-definition-BDJGKUSR-gpDmrz_j.js} +1 -1
- package/out/renderer/assets/{use-default-on-banner-DjHLTfeK.js → use-default-on-banner-D4ExL869.js} +1 -1
- package/out/renderer/assets/{use-download-agent-mutation-D6QgUMMQ.js → use-download-agent-mutation-Ddu_n321.js} +2 -2
- package/out/renderer/assets/{use-session-snapshot-CI2ND9fV.js → use-session-snapshot-DtZtLFCM.js} +1 -1
- package/out/renderer/assets/{xychartDiagram-VJFVF3MP-CA90n1Qk.js → xychartDiagram-VJFVF3MP-DgiVkF0W.js} +1 -1
- package/out/renderer/browser-approvals-overlay.html +2 -2
- package/out/renderer/console-capture.html +6 -6
- package/out/renderer/index.html +8 -8
- package/out/renderer/installer.html +5 -5
- package/out/renderer/mini.html +8 -8
- package/package.json +2 -2
- package/out/renderer/assets/arc-Blq81BHO.js +0 -1
- package/out/renderer/assets/browser-page-C156D5SG.js +0 -1
- package/out/renderer/assets/channel-DEPypRI4.js +0 -1
- package/out/renderer/assets/classDiagram-GIVACNV2-D64NGwBp.js +0 -1
- package/out/renderer/assets/classDiagram-v2-COTLJTTW-D64NGwBp.js +0 -1
- package/out/renderer/assets/clone-BrsLxtaK.js +0 -1
- package/out/renderer/assets/index-B0Ue5RBi.js +0 -7
- package/out/renderer/assets/index-BABrnwf5.css +0 -1
- package/out/renderer/assets/index-CxK1ypFa.js +0 -1
- package/out/renderer/assets/infoDiagram-PH2N3AL5-DZJ-3Hbl.js +0 -2
- package/out/renderer/assets/installer-BTKc-9AM.js +0 -1
- package/out/renderer/assets/library-page-VgK0BSR2.js +0 -157
- package/out/renderer/assets/mesh-page-CEgyAVW-.js +0 -1
- package/out/renderer/assets/mini-DjdzboAc.js +0 -1
- package/out/renderer/assets/path-utils-CzhWDDSj.js +0 -58
- package/out/renderer/assets/publication-validation-Iutn5hzY.js +0 -1
- package/out/renderer/assets/stateDiagram-v2-YXO3MK2T-LbiD2EL_.js +0 -1
- package/out/renderer/assets/team-bridge-page-BW45aiP2.js +0 -21
package/out/renderer/assets/{legacy-agents-page-B4QsRAZI.js → legacy-agents-page-yWew17m3.js}
RENAMED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import{r as l,j as e,c as $}from"./index-
|
|
1
|
+
import{r as l,j as e,c as $}from"./index-CoWefa1B.js";import{P as Nt}from"./page-header-Nw5c8tPb.js";import{c as oe,u as P,D as Ae,d as et,B as E,e as tt,f as F,J as at,S as st,y as W,K as nt,l as Ct,a5 as je,L as ce,j as it,X as ot,a6 as St,a7 as It,a8 as Dt,A as ye,a as Se,z as le,M as Pt,N as Lt,O as Et,P as Tt,Q as Ie,i as Ot,a9 as qt,w as Ut,x as zt}from"./error-boundary-D6IZ3d5-.js";import{bc as Rt,bd as rt,be as Ee,bf as Te,bg as $t,bh as Ge,bi as Mt,bj as Ht,aU as lt,bk as se,bl as ie,bm as Bt,bn as Wt,bo as Vt,bp as Kt,bq as De,br as Qt,b5 as Gt,bs as Yt,G as qe,bt as ct,aT as Ft,aH as Jt,E as Xt,aJ as Zt,aQ as At,bu as ut,bv as ea,bw as dt,aS as ta,bx as aa,by as Ye}from"./index-DK94pJ0b.js";import{c7 as mt,bb as sa,bZ as na,c8 as ia,a6 as Ue,a7 as Z,ba as pt,aZ as oa,c9 as ra,W as ue,aK as la,be as ne,bf as _e,V as gt,bX as ca,ca as ua,bd as da,c0 as Oe,c3 as ma,bR as pa,S as ga,b9 as ht,aA as ha}from"./conversation-input-sync-zEjzdlxD.js";import{i as xt,u as bt,_ as xa,a2 as ba,a7 as fa,a8 as ya,B as ze,a as _a,c as ja,C as ka,h as va,x as wa,q as ft}from"./path-utils-CPnlSslq.js";import{t as a}from"./messages-Du2guuiW.js";import{N as Na}from"./notebook-pen-Cbl0LGX4.js";import{n as Pe,u as Ca,j as Sa,H as Ia,p as Da}from"./org-access-Kw828GQV.js";import{o as Pa,a as La}from"./org-surface-gate-CT3zfrdt.js";import{R as Fe}from"./radient-auth-buttons-B3TH2lPK.js";import{c as Ea,i as Ta,d as Oa,e as qa,t as Ua,p as Je,P as Xe}from"./publication-validation-_q5dCFqY.js";import"./console-mirror-DSWcncyi.js";/**
|
|
2
2
|
* @license lucide-react v0.507.0 - ISC
|
|
3
3
|
*
|
|
4
4
|
* This source code is licensed under the ISC license.
|
|
5
5
|
* See the LICENSE file in the root directory of this source tree.
|
|
6
|
-
*/const
|
|
6
|
+
*/const za=[["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"}]],Ra=oe("ellipsis-vertical",za);/**
|
|
7
7
|
* @license lucide-react v0.507.0 - ISC
|
|
8
8
|
*
|
|
9
9
|
* This source code is licensed under the ISC license.
|
|
10
10
|
* See the LICENSE file in the root directory of this source tree.
|
|
11
|
-
*/const $a=[["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"}]],
|
|
11
|
+
*/const $a=[["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"}]],Ze=oe("file-input",$a);/**
|
|
12
12
|
* @license lucide-react v0.507.0 - ISC
|
|
13
13
|
*
|
|
14
14
|
* This source code is licensed under the ISC license.
|
|
@@ -23,11 +23,11 @@ import{r as l,j as e,c as $}from"./index-CNnTZGuV.js";import{P as Nt}from"./page
|
|
|
23
23
|
*
|
|
24
24
|
* This source code is licensed under the ISC license.
|
|
25
25
|
* See the LICENSE file in the root directory of this source tree.
|
|
26
|
-
*/const
|
|
26
|
+
*/const Va=[["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"}]],Ka=oe("id-card",Va);/**
|
|
27
27
|
* @license lucide-react v0.507.0 - ISC
|
|
28
28
|
*
|
|
29
29
|
* This source code is licensed under the ISC license.
|
|
30
30
|
* See the LICENSE file in the root directory of this source tree.
|
|
31
|
-
*/const Ka=[["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"}]],Ga=oe("import",Ka),Fa=({agentId:t,agentName:n,onAgentDeleted:s,buttonSx:o={},isAgentsPage:i=!1,onViewAgentSettings:c,onChatWithAgent:u,onExportAgent:x,onClearConversation:f,onUploadAgentToHub:j})=>{P();const[b,k]=l.useState(!1),[r,d]=l.useState(!1),[m,y]=l.useState(!1),v=l.useRef(!1),S=Rt(),{clearAgentFromAllPages:C}=mt(),q=async()=>{try{await S.mutateAsync(t),C(t),s?.(t)}catch(N){console.error("Failed to delete agent:",N)}finally{d(!1)}};return e.jsxs(e.Fragment,{children:[e.jsxs(Ze,{open:b,onOpenChange:k,modal:!1,children:[e.jsx(et,{asChild:!0,children:e.jsx(E,{variant:"ghost",size:"icon-sm","aria-label":a("ui.agents.dialogs.menu.accessible"),"data-tour-tag":"agent-options-button",onClick:N=>{N.stopPropagation(),N.detail===0&&k(T=>!T)},style:o,children:e.jsx(Ra,{"aria-hidden":"true"})})}),e.jsxs(tt,{align:"end",className:"min-w-45",onClick:N=>N.stopPropagation(),onInteractOutside:N=>{const T=N.detail.originalEvent.target;T instanceof Element&&T.closest(".shepherd-element")&&N.preventDefault()},onCloseAutoFocus:N=>{v.current&&(v.current=!1,N.preventDefault())},children:[i&&u&&e.jsxs(Y,{onSelect:u,children:[e.jsx(rt,{"aria-hidden":"true"}),e.jsx("span",{children:a("ui.agents.dialogs.menu.chat")})]}),!i&&c&&e.jsxs(Y,{"data-tour-tag":"view-agent-settings-menu-item",onSelect:c,children:[e.jsx(Ee,{"aria-hidden":"true"}),e.jsx("span",{children:a("ui.agents.dialogs.menu.settings")})]}),x&&e.jsxs(Y,{onSelect:x,children:[e.jsx(Ha,{"aria-hidden":"true"}),e.jsx("span",{children:a("ui.agents.dialogs.menu.export")})]}),j&&e.jsxs(Y,{"data-tour-tag":"upload-to-hub-menu-item",onSelect:j,children:[e.jsx(Te,{"aria-hidden":"true"}),e.jsx("span",{children:a("ui.agents.dialogs.menu.upload")})]}),f&&e.jsxs(Y,{className:"text-warning data-[highlighted]:bg-warning-wash",onSelect:()=>{v.current=!0,y(!0)},children:[e.jsx($t,{"aria-hidden":"true"}),e.jsx("span",{children:a("ui.agents.dialogs.menu.clear")})]}),e.jsxs(Y,{destructive:!0,onSelect:()=>{v.current=!0,d(!0)},children:[e.jsx(sa,{"aria-hidden":"true"}),e.jsx("span",{children:a("ui.agents.dialogs.menu.delete")})]})]})]}),e.jsx(Ge,{open:r,title:a("ui.agents.dialogs.delete.title"),message:e.jsxs(e.Fragment,{children:[e.jsx("p",{className:"text-body text-ink",children:a("ui.agents.dialogs.delete.question",{name:n})}),e.jsx("p",{className:"mt-2 text-body-sm text-ink-muted",children:a("ui.agents.dialogs.delete.warning")})]}),confirmText:a("ui.agents.dialogs.delete.confirm"),cancelText:a("ui.agents.dialogs.delete.cancel"),isDangerous:!0,onConfirm:q,onCancel:()=>d(!1)}),e.jsx(Ge,{open:m,title:a("ui.agents.dialogs.clear.title"),message:a("ui.agents.dialogs.clear.warning"),confirmText:a("ui.agents.dialogs.clear.confirm"),cancelText:a("ui.agents.dialogs.clear.cancel"),isDangerous:!0,onConfirm:()=>{f?.(),y(!1)},onCancel:()=>y(!1)})]})},Ya=({page:t,count:n,onChange:s})=>{P();const o=()=>{t>1&&s(t-1)},i=()=>{t<n&&s(t+1)};return n<=1?null:e.jsxs("div",{className:"sticky bottom-0 left-0 right-0 z-10 flex min-h-13 items-center justify-between border-t border-hairline bg-surface px-4 py-2",children:[e.jsx(E,{variant:"ghost",size:"icon-sm",onClick:o,disabled:t<=1,"aria-label":a("ui.common.forms.compact_pagination.previous_page"),children:e.jsx(na,{})}),e.jsx("span",{className:"select-none text-meta text-ink-dim",children:a("ui.common.forms.pagination.position",{page:String(t),count:String(n)})}),e.jsx(E,{variant:"ghost",size:"icon-sm",onClick:i,disabled:t>=n,"aria-label":a("ui.common.forms.compact_pagination.next_page"),children:e.jsx(at,{})})]})},yt=t=>["agent-system-prompt",t],_t=t=>{const{shouldEnableQuery:n}=ia();return xt({enabled:n({bypassInternetCheck:!0})&&!!t,queryKey:yt(t),queryFn:async()=>{try{const o=await ze(X.baseUrl).agents.getAgentSystemPrompt(t);if(o.status>=400)throw new Error(o.message||a("ui.common.errors.agent_prompt_fetch"));return o.result?.system_prompt||""}catch(s){const o=s instanceof Error?s.message:a("ui.common.errors.agent_prompt_fetch_unknown");throw ue(o),s}},refetchOnWindowFocus:!1,staleTime:5e3})},Ja=t=>{const n=bt(),s=ze(X.baseUrl);return pt({mutationFn:async o=>{const i=ra(o);if(i)throw ue(i),new Error(i);try{const c=await s.agents.updateAgentSystemPrompt(t,o);if(c.status>=400)throw new Error(c.message||a("ui.common.errors.agent_prompt_update_simple"));return c}catch(c){const u=c instanceof Error?c.message:a("ui.common.errors.agent_prompt_update_unknown");throw ue(u),c}},onSuccess:async()=>{await n.invalidateQueries({queryKey:yt(t)}),oa(a("ui.notices.agents.system_prompt_updated"))},onError:o=>{console.error("Error updating agent system prompt:",o)}})},Aa=()=>{const[t,n]=la(),s=xa(),o=()=>{const c=t.get("page");return c?Number.parseInt(c,10):1},i=c=>{const u=new URLSearchParams(t);c===1?u.delete("page"):u.set("page",c.toString()),n(u)};return{page:o(),setPage:i,isView:c=>s.pathname.startsWith(`/${c}`)}},Xa=({open:t,onClose:n,onAgentImported:s})=>{P();const[o,i]=l.useState(null),[c,u]=l.useState(!1),[x,f]=l.useState(null),j=l.useRef(null),b=Mt(),k=l.useCallback(g=>{g.preventDefault(),g.stopPropagation(),u(!0)},[]),r=l.useCallback(g=>{g.preventDefault(),g.stopPropagation(),u(!1)},[]),d=l.useCallback(g=>{g.preventDefault(),g.stopPropagation()},[]),m=l.useCallback(g=>g.name.toLowerCase().endsWith(".zip")?(f(null),!0):(f("ui.agents.dialogs.import.invalid_zip"),!1),[]),y=l.useCallback(g=>{if(g.preventDefault(),g.stopPropagation(),u(!1),g.dataTransfer.files&&g.dataTransfer.files.length>0){const I=g.dataTransfer.files[0];m(I)&&i(I)}},[m]),v=l.useCallback(g=>{if(g.target.files&&g.target.files.length>0){const I=g.target.files[0];m(I)&&i(I)}},[m]),S=l.useCallback(()=>{j.current?.click()},[]),C=async()=>{if(o)try{const g=await b.mutateAsync(o);i(null),f(null),s&&g&&s(g.id),n()}catch(g){console.error("Failed to import agent:",g)}},q=()=>{i(null),f(null),n()},N=b.isPending,T=N||!o,L=e.jsxs(e.Fragment,{children:[e.jsx(Xe,{size:19,className:"text-accent","aria-hidden":"true"}),a("ui.agents.dialogs.import.title")]}),_=e.jsxs(e.Fragment,{children:[e.jsx(ne,{onClick:q,disabled:N,children:a("ui.agents.dialogs.import.cancel")}),e.jsx(_e,{onClick:C,disabled:T,startIcon:N?e.jsx(st,{}):null,children:a("ui.agents.dialogs.import.submit")})]});return e.jsxs(gt,{open:t,onClose:q,title:L,actions:_,maxWidth:"sm",children:[e.jsx("p",{className:"mb-4 text-body-sm text-ink-muted",children:a("ui.agents.dialogs.import.intro")}),e.jsxs("div",{className:"flex flex-col gap-5",children:[e.jsx("input",{ref:j,type:"file",accept:".zip",onChange:v,disabled:N,className:"hidden"}),e.jsx("button",{type:"button",onClick:S,onDragEnter:k,onDragLeave:r,onDragOver:d,onDrop:y,disabled:N,className:$("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",c&&"border-accent bg-accent-wash"),children:o?e.jsxs(e.Fragment,{children:[e.jsx(Xe,{size:32,className:"mx-auto mb-2 text-ink-muted","aria-hidden":"true"}),e.jsx("p",{className:"text-body text-ink",children:o.name}),e.jsx("p",{className:"text-body-sm text-ink-muted",children:a("ui.agents.dialogs.import.replace_file")})]}):e.jsxs(e.Fragment,{children:[e.jsx(Ht,{size:32,className:"mx-auto mb-2 text-ink-muted","aria-hidden":"true"}),e.jsx("p",{className:"text-body text-ink",children:a("ui.agents.dialogs.import.drop_file")}),e.jsx("p",{className:"text-body-sm text-ink-muted",children:a("ui.agents.dialogs.import.choose_file")})]})}),x&&e.jsx("p",{role:"alert",className:"text-body-sm text-danger",children:a(x)})]})]})},Za=({title:t,searchQuery:n,onSearchChange:s,onNewAgentClick:o,searchPlaceholder:i=a("ui.common.layout.sidebar_header.search_agents"),newAgentTooltip:c=a("ui.common.layout.sidebar_header.create_a_new_agent"),onImportAgentClick:u,importAgentTooltip:x=a("ui.common.layout.sidebar_header.import_an_agent_from_a_zip_file")})=>(P(),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:[u&&e.jsx(W,{content:x,children:e.jsx(E,{variant:"ghost",size:"icon",onClick:u,"aria-label":a("ui.common.layout.sidebar_header.import_agent"),children:e.jsx(Ga,{"aria-hidden":"true"})})}),e.jsx(W,{content:c,children:e.jsx(E,{variant:"primary",size:"icon",onClick:o,"aria-label":a("ui.common.layout.sidebar_header.new_agent"),"data-tour-tag":"create-new-agent-button",children:e.jsx(lt,{"aria-hidden":"true"})})})]})]}),e.jsxs("div",{className:"relative",children:[e.jsx(ca,{size:16,"aria-hidden":"true",className:"pointer-events-none absolute top-1/2 start-3 -translate-y-1/2 text-ink-dim"}),e.jsx(nt,{type:"search",inputSize:"lg",placeholder:i,value:n,onChange:f=>s(f.target.value),"aria-label":i,className:"ps-9"})]})]})),w={temperature:.2,top_p:.9,top_k:40,max_tokens:4096,frequency_penalty:0,presence_penalty:0,seed:42},F=({label:t,description:n,defaultLabel:s,onSet:o})=>(P(),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:a("ui.agents.settings.chat.not_set_yet")})]}),e.jsx("p",{className:"mt-1 text-meta text-ink-dim",children:n})]}),e.jsx(E,{variant:"secondary",size:"sm",className:"shrink-0",onClick:o,children:a("ui.agents.settings.chat.set_to_default",{value:String(s)})})]})),Le=({title:t,children:n})=>e.jsxs("div",{className:"flex flex-col gap-4",children:[e.jsx("h3",{className:"text-body-sm font-semibold text-ink-muted",children:t}),n]}),es=({selectedAgent:t,savingField:n,setSavingField:s,updateAgentMutation:o,refetchAgent:i,initialSelectedAgentId:c})=>{P();const[u,x]=l.useState(t);l.useEffect(()=>{x(t)},[t]);const[f,j]=l.useState(!1),b=l.useId(),k=f?Ct:at;return e.jsxs("div",{children:[e.jsxs("h2",{className:"flex items-center gap-2",children:[e.jsxs("button",{type:"button",onClick:()=>j(!f),"aria-expanded":f,"aria-controls":b,className:"group flex items-center gap-2 py-1 text-start text-heading text-ink",children:[e.jsx(k,{size:14,"aria-hidden":"true",className:"shrink-0 text-ink-dim transition-colors duration-fast ease-out-quart group-hover:text-ink rtl:-scale-x-100"}),a("ui.agents.settings.chat.advanced_chat_settings")]}),e.jsx(W,{content:a("ui.agents.settings.chat.advanced_settings_to_change_how_the_agent"),children:e.jsx(E,{variant:"ghost",size:"icon-sm","aria-label":a("ui.agents.settings.chat.about_advanced_chat_settings"),children:e.jsx(je,{})})})]}),f&&e.jsxs("div",{id:b,className:"mt-3",children:[e.jsx("p",{className:"max-w-2xl text-body-sm text-ink-muted",children:a("ui.agents.settings.chat.set_custom_values_for_any_of_these")}),e.jsxs("div",{className:"mt-6 flex flex-col gap-8",children:[e.jsxs(Le,{title:a("ui.agents.settings.chat.sampling"),children:[u.temperature===null?e.jsx(F,{label:a("ui.agents.settings.chat.temperature"),description:a("ui.agents.settings.chat.controls_randomness_in_responses_0_0_1"),defaultLabel:w.temperature,onSet:async()=>{s("temperature");try{const r={temperature:w.temperature};await o.mutateAsync({agentId:t.id,update:r}),x(d=>({...d,temperature:w.temperature})),t.id===c&&i&&await i()}catch{}finally{s(null)}}}):e.jsx(se,{value:u.temperature??w.temperature,label:a("ui.agents.settings.chat.temperature"),description:a("ui.agents.settings.chat.controls_randomness_in_responses_0_0_1"),min:0,max:1,step:.01,isSaving:n==="temperature",onChange:async r=>{s("temperature");try{const d={temperature:r};await o.mutateAsync({agentId:t.id,update:d}),t.id===c&&i&&await i()}catch{}finally{s(null)}}}),u.top_p===null?e.jsx(F,{label:a("ui.agents.settings.chat.top_p"),description:a("ui.agents.settings.chat.controls_cumulative_probability_of_tokens_to_sample"),defaultLabel:w.top_p,onSet:async()=>{s("top_p");try{const r={top_p:w.top_p};await o.mutateAsync({agentId:t.id,update:r}),x(d=>({...d,top_p:w.top_p})),t.id===c&&i&&await i()}catch{}finally{s(null)}}}):e.jsx(se,{value:u.top_p??w.top_p,label:a("ui.agents.settings.chat.top_p"),description:a("ui.agents.settings.chat.controls_cumulative_probability_of_tokens_to_sample"),min:0,max:1,step:.01,isSaving:n==="top_p",onChange:async r=>{s("top_p");try{const d={top_p:r};await o.mutateAsync({agentId:t.id,update:d}),t.id===c&&i&&await i()}catch{}finally{s(null)}}}),u.top_k===null?e.jsx(F,{label:a("ui.agents.settings.chat.top_k"),description:a("ui.agents.settings.chat.limits_tokens_to_sample_from_at_each"),defaultLabel:w.top_k,onSet:async()=>{s("top_k");try{const r={top_k:w.top_k};await o.mutateAsync({agentId:t.id,update:r}),x(d=>({...d,top_k:w.top_k})),t.id===c&&i&&await i()}catch{}finally{s(null)}}}):e.jsx(se,{value:u.top_k??w.top_k,label:a("ui.agents.settings.chat.top_k"),description:a("ui.agents.settings.chat.limits_tokens_to_sample_from_at_each"),min:1,max:100,step:1,isSaving:n==="top_k",onChange:async r=>{s("top_k");try{const d={top_k:r};await o.mutateAsync({agentId:t.id,update:d}),t.id===c&&i&&await i()}catch{}finally{s(null)}}}),u.seed===null?e.jsx(F,{label:a("ui.agents.settings.chat.seed"),description:a("ui.agents.settings.chat.random_number_seed_for_deterministic_generation"),defaultLabel:w.seed,onSet:async()=>{s("seed");try{const r={seed:w.seed};await o.mutateAsync({agentId:t.id,update:r}),x(d=>({...d,seed:w.seed})),t.id===c&&i&&await i()}catch{}finally{s(null)}}}):e.jsx(ie,{value:u.seed?.toString()||"",label:a("ui.agents.settings.chat.seed"),placeholder:a("ui.agents.settings.chat.random_number_seed_for_deterministic_generation_detail"),icon:e.jsx(Ee,{size:16}),isSaving:n==="seed",onSave:async r=>{s("seed");try{const d=r.trim()?Number.parseInt(r,10):void 0;if(r.trim()&&Number.isNaN(d)){ue(a("ui.agents.settings.chat.error.invalid_seed"));return}const m={seed:d};await o.mutateAsync({agentId:t.id,update:m}),t.id===c&&i&&await i()}catch{}finally{s(null)}}})]}),e.jsxs(Le,{title:a("ui.agents.settings.chat.repetition"),children:[u.frequency_penalty===null?e.jsx(F,{label:a("ui.agents.settings.chat.frequency_penalty"),description:a("ui.agents.settings.chat.reduces_repetition_by_lowering_likelihood_of_repeated"),defaultLabel:w.frequency_penalty,onSet:async()=>{s("frequency_penalty");try{const r={frequency_penalty:w.frequency_penalty};await o.mutateAsync({agentId:t.id,update:r}),x(d=>({...d,frequency_penalty:w.frequency_penalty})),t.id===c&&i&&await i()}catch{}finally{s(null)}}}):e.jsx(se,{value:u.frequency_penalty??w.frequency_penalty,label:a("ui.agents.settings.chat.frequency_penalty"),description:a("ui.agents.settings.chat.reduces_repetition_by_lowering_likelihood_of_repeated"),min:-2,max:2,step:.01,isSaving:n==="frequency_penalty",onChange:async r=>{s("frequency_penalty");try{const d={frequency_penalty:r};await o.mutateAsync({agentId:t.id,update:d}),t.id===c&&i&&await i()}catch{}finally{s(null)}}}),u.presence_penalty===null?e.jsx(F,{label:a("ui.agents.settings.chat.presence_penalty"),description:a("ui.agents.settings.chat.increases_diversity_by_lowering_likelihood_of_prompt"),defaultLabel:w.presence_penalty,onSet:async()=>{s("presence_penalty");try{const r={presence_penalty:w.presence_penalty};await o.mutateAsync({agentId:t.id,update:r}),x(d=>({...d,presence_penalty:w.presence_penalty})),t.id===c&&i&&await i()}catch{}finally{s(null)}}}):e.jsx(se,{value:u.presence_penalty??w.presence_penalty,label:a("ui.agents.settings.chat.presence_penalty"),description:a("ui.agents.settings.chat.increases_diversity_by_lowering_likelihood_of_prompt"),min:-2,max:2,step:.01,isSaving:n==="presence_penalty",onChange:async r=>{s("presence_penalty");try{const d={presence_penalty:r};await o.mutateAsync({agentId:t.id,update:d}),t.id===c&&i&&await i()}catch{}finally{s(null)}}})]}),e.jsxs(Le,{title:a("ui.agents.settings.chat.length_and_stopping"),children:[u.max_tokens===null?e.jsx(F,{label:a("ui.agents.settings.chat.max_tokens"),description:a("ui.agents.settings.chat.maximum_tokens_to_generate_in_response"),defaultLabel:w.max_tokens,onSet:async()=>{s("max_tokens");try{const r={max_tokens:w.max_tokens};await o.mutateAsync({agentId:t.id,update:r}),x(d=>({...d,max_tokens:w.max_tokens})),t.id===c&&i&&await i()}catch{}finally{s(null)}}}):e.jsx(se,{value:u.max_tokens??w.max_tokens,label:a("ui.agents.settings.chat.max_tokens"),description:a("ui.agents.settings.chat.maximum_tokens_to_generate_in_response"),min:1,max:8192,step:1,isSaving:n==="max_tokens",onChange:async r=>{s("max_tokens");try{const d={max_tokens:r};await o.mutateAsync({agentId:t.id,update:d}),t.id===c&&i&&await i()}catch{}finally{s(null)}}}),u.stop===null?e.jsx(F,{label:a("ui.agents.settings.chat.stop_sequences"),description:a("ui.agents.settings.chat.sequences_that_will_cause_the_model_to"),defaultLabel:a("ui.agents.settings.chat.empty"),onSet:async()=>{s("stop");try{const r={stop:[]};await o.mutateAsync({agentId:t.id,update:r}),x(d=>({...d,stop:[]})),t.id===c&&i&&await i()}catch{}finally{s(null)}}}):e.jsx(ie,{value:u.stop?.join(`
|
|
31
|
+
*/const Qa=[["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"}]],Ga=oe("import",Qa),Ya=({agentId:t,agentName:n,onAgentDeleted:s,buttonSx:o={},isAgentsPage:i=!1,onViewAgentSettings:c,onChatWithAgent:u,onExportAgent:x,onClearConversation:f,onUploadAgentToHub:j})=>{P();const[b,k]=l.useState(!1),[r,d]=l.useState(!1),[m,y]=l.useState(!1),v=l.useRef(!1),S=Rt(),{clearAgentFromAllPages:C}=mt(),q=async()=>{try{await S.mutateAsync(t),C(t),s?.(t)}catch(N){console.error("Failed to delete agent:",N)}finally{d(!1)}};return e.jsxs(e.Fragment,{children:[e.jsxs(Ae,{open:b,onOpenChange:k,modal:!1,children:[e.jsx(et,{asChild:!0,children:e.jsx(E,{variant:"ghost",size:"icon-sm","aria-label":a("ui.agents.dialogs.menu.accessible"),"data-tour-tag":"agent-options-button",onClick:N=>{N.stopPropagation(),N.detail===0&&k(T=>!T)},style:o,children:e.jsx(Ra,{"aria-hidden":"true"})})}),e.jsxs(tt,{align:"end",className:"min-w-45",onClick:N=>N.stopPropagation(),onInteractOutside:N=>{const T=N.detail.originalEvent.target;T instanceof Element&&T.closest(".shepherd-element")&&N.preventDefault()},onCloseAutoFocus:N=>{v.current&&(v.current=!1,N.preventDefault())},children:[i&&u&&e.jsxs(F,{onSelect:u,children:[e.jsx(rt,{"aria-hidden":"true"}),e.jsx("span",{children:a("ui.agents.dialogs.menu.chat")})]}),!i&&c&&e.jsxs(F,{"data-tour-tag":"view-agent-settings-menu-item",onSelect:c,children:[e.jsx(Ee,{"aria-hidden":"true"}),e.jsx("span",{children:a("ui.agents.dialogs.menu.settings")})]}),x&&e.jsxs(F,{onSelect:x,children:[e.jsx(Ha,{"aria-hidden":"true"}),e.jsx("span",{children:a("ui.agents.dialogs.menu.export")})]}),j&&e.jsxs(F,{"data-tour-tag":"upload-to-hub-menu-item",onSelect:j,children:[e.jsx(Te,{"aria-hidden":"true"}),e.jsx("span",{children:a("ui.agents.dialogs.menu.upload")})]}),f&&e.jsxs(F,{className:"text-warning data-[highlighted]:bg-warning-wash",onSelect:()=>{v.current=!0,y(!0)},children:[e.jsx($t,{"aria-hidden":"true"}),e.jsx("span",{children:a("ui.agents.dialogs.menu.clear")})]}),e.jsxs(F,{destructive:!0,onSelect:()=>{v.current=!0,d(!0)},children:[e.jsx(sa,{"aria-hidden":"true"}),e.jsx("span",{children:a("ui.agents.dialogs.menu.delete")})]})]})]}),e.jsx(Ge,{open:r,title:a("ui.agents.dialogs.delete.title"),message:e.jsxs(e.Fragment,{children:[e.jsx("p",{className:"text-body text-ink",children:a("ui.agents.dialogs.delete.question",{name:n})}),e.jsx("p",{className:"mt-2 text-body-sm text-ink-muted",children:a("ui.agents.dialogs.delete.warning")})]}),confirmText:a("ui.agents.dialogs.delete.confirm"),cancelText:a("ui.agents.dialogs.delete.cancel"),isDangerous:!0,onConfirm:q,onCancel:()=>d(!1)}),e.jsx(Ge,{open:m,title:a("ui.agents.dialogs.clear.title"),message:a("ui.agents.dialogs.clear.warning"),confirmText:a("ui.agents.dialogs.clear.confirm"),cancelText:a("ui.agents.dialogs.clear.cancel"),isDangerous:!0,onConfirm:()=>{f?.(),y(!1)},onCancel:()=>y(!1)})]})},Fa=({page:t,count:n,onChange:s})=>{P();const o=()=>{t>1&&s(t-1)},i=()=>{t<n&&s(t+1)};return n<=1?null:e.jsxs("div",{className:"sticky bottom-0 left-0 right-0 z-10 flex min-h-13 items-center justify-between border-t border-hairline bg-surface px-4 py-2",children:[e.jsx(E,{variant:"ghost",size:"icon-sm",onClick:o,disabled:t<=1,"aria-label":a("ui.common.forms.compact_pagination.previous_page"),children:e.jsx(na,{})}),e.jsx("span",{className:"select-none text-meta text-ink-dim",children:a("ui.common.forms.pagination.position",{page:String(t),count:String(n)})}),e.jsx(E,{variant:"ghost",size:"icon-sm",onClick:i,disabled:t>=n,"aria-label":a("ui.common.forms.compact_pagination.next_page"),children:e.jsx(at,{})})]})},yt=t=>["agent-system-prompt",t],_t=t=>{const{shouldEnableQuery:n}=ia();return xt({enabled:n({bypassInternetCheck:!0})&&!!t,queryKey:yt(t),queryFn:async()=>{try{const o=await Ue(Z.baseUrl).agents.getAgentSystemPrompt(t);if(o.status>=400)throw new Error(o.message||a("ui.common.errors.agent_prompt_fetch"));return o.result?.system_prompt||""}catch(s){const o=s instanceof Error?s.message:a("ui.common.errors.agent_prompt_fetch_unknown");throw ue(o),s}},refetchOnWindowFocus:!1,staleTime:5e3})},Ja=t=>{const n=bt(),s=Ue(Z.baseUrl);return pt({mutationFn:async o=>{const i=ra(o);if(i)throw ue(i),new Error(i);try{const c=await s.agents.updateAgentSystemPrompt(t,o);if(c.status>=400)throw new Error(c.message||a("ui.common.errors.agent_prompt_update_simple"));return c}catch(c){const u=c instanceof Error?c.message:a("ui.common.errors.agent_prompt_update_unknown");throw ue(u),c}},onSuccess:async()=>{await n.invalidateQueries({queryKey:yt(t)}),oa(a("ui.notices.agents.system_prompt_updated"))},onError:o=>{console.error("Error updating agent system prompt:",o)}})},Xa=()=>{const[t,n]=la(),s=xa(),o=()=>{const c=t.get("page");return c?Number.parseInt(c,10):1},i=c=>{const u=new URLSearchParams(t);c===1?u.delete("page"):u.set("page",c.toString()),n(u)};return{page:o(),setPage:i,isView:c=>s.pathname.startsWith(`/${c}`)}},Za=({open:t,onClose:n,onAgentImported:s})=>{P();const[o,i]=l.useState(null),[c,u]=l.useState(!1),[x,f]=l.useState(null),j=l.useRef(null),b=Mt(),k=l.useCallback(g=>{g.preventDefault(),g.stopPropagation(),u(!0)},[]),r=l.useCallback(g=>{g.preventDefault(),g.stopPropagation(),u(!1)},[]),d=l.useCallback(g=>{g.preventDefault(),g.stopPropagation()},[]),m=l.useCallback(g=>g.name.toLowerCase().endsWith(".zip")?(f(null),!0):(f("ui.agents.dialogs.import.invalid_zip"),!1),[]),y=l.useCallback(g=>{if(g.preventDefault(),g.stopPropagation(),u(!1),g.dataTransfer.files&&g.dataTransfer.files.length>0){const I=g.dataTransfer.files[0];m(I)&&i(I)}},[m]),v=l.useCallback(g=>{if(g.target.files&&g.target.files.length>0){const I=g.target.files[0];m(I)&&i(I)}},[m]),S=l.useCallback(()=>{j.current?.click()},[]),C=async()=>{if(o)try{const g=await b.mutateAsync(o);i(null),f(null),s&&g&&s(g.id),n()}catch(g){console.error("Failed to import agent:",g)}},q=()=>{i(null),f(null),n()},N=b.isPending,T=N||!o,L=e.jsxs(e.Fragment,{children:[e.jsx(Ze,{size:19,className:"text-accent","aria-hidden":"true"}),a("ui.agents.dialogs.import.title")]}),_=e.jsxs(e.Fragment,{children:[e.jsx(ne,{onClick:q,disabled:N,children:a("ui.agents.dialogs.import.cancel")}),e.jsx(_e,{onClick:C,disabled:T,startIcon:N?e.jsx(st,{}):null,children:a("ui.agents.dialogs.import.submit")})]});return e.jsxs(gt,{open:t,onClose:q,title:L,actions:_,maxWidth:"sm",children:[e.jsx("p",{className:"mb-4 text-body-sm text-ink-muted",children:a("ui.agents.dialogs.import.intro")}),e.jsxs("div",{className:"flex flex-col gap-5",children:[e.jsx("input",{ref:j,type:"file",accept:".zip",onChange:v,disabled:N,className:"hidden"}),e.jsx("button",{type:"button",onClick:S,onDragEnter:k,onDragLeave:r,onDragOver:d,onDrop:y,disabled:N,className:$("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",c&&"border-accent bg-accent-wash"),children:o?e.jsxs(e.Fragment,{children:[e.jsx(Ze,{size:32,className:"mx-auto mb-2 text-ink-muted","aria-hidden":"true"}),e.jsx("p",{className:"text-body text-ink",children:o.name}),e.jsx("p",{className:"text-body-sm text-ink-muted",children:a("ui.agents.dialogs.import.replace_file")})]}):e.jsxs(e.Fragment,{children:[e.jsx(Ht,{size:32,className:"mx-auto mb-2 text-ink-muted","aria-hidden":"true"}),e.jsx("p",{className:"text-body text-ink",children:a("ui.agents.dialogs.import.drop_file")}),e.jsx("p",{className:"text-body-sm text-ink-muted",children:a("ui.agents.dialogs.import.choose_file")})]})}),x&&e.jsx("p",{role:"alert",className:"text-body-sm text-danger",children:a(x)})]})]})},Aa=({title:t,searchQuery:n,onSearchChange:s,onNewAgentClick:o,searchPlaceholder:i=a("ui.common.layout.sidebar_header.search_agents"),newAgentTooltip:c=a("ui.common.layout.sidebar_header.create_a_new_agent"),onImportAgentClick:u,importAgentTooltip:x=a("ui.common.layout.sidebar_header.import_an_agent_from_a_zip_file")})=>(P(),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:[u&&e.jsx(W,{content:x,children:e.jsx(E,{variant:"ghost",size:"icon",onClick:u,"aria-label":a("ui.common.layout.sidebar_header.import_agent"),children:e.jsx(Ga,{"aria-hidden":"true"})})}),e.jsx(W,{content:c,children:e.jsx(E,{variant:"primary",size:"icon",onClick:o,"aria-label":a("ui.common.layout.sidebar_header.new_agent"),"data-tour-tag":"create-new-agent-button",children:e.jsx(lt,{"aria-hidden":"true"})})})]})]}),e.jsxs("div",{className:"relative",children:[e.jsx(ca,{size:16,"aria-hidden":"true",className:"pointer-events-none absolute top-1/2 start-3 -translate-y-1/2 text-ink-dim"}),e.jsx(nt,{type:"search",inputSize:"lg",placeholder:i,value:n,onChange:f=>s(f.target.value),"aria-label":i,className:"ps-9"})]})]})),w={temperature:.2,top_p:.9,top_k:40,max_tokens:4096,frequency_penalty:0,presence_penalty:0,seed:42},Y=({label:t,description:n,defaultLabel:s,onSet:o})=>(P(),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:a("ui.agents.settings.chat.not_set_yet")})]}),e.jsx("p",{className:"mt-1 text-meta text-ink-dim",children:n})]}),e.jsx(E,{variant:"secondary",size:"sm",className:"shrink-0",onClick:o,children:a("ui.agents.settings.chat.set_to_default",{value:String(s)})})]})),Le=({title:t,children:n})=>e.jsxs("div",{className:"flex flex-col gap-4",children:[e.jsx("h3",{className:"text-body-sm font-semibold text-ink-muted",children:t}),n]}),es=({selectedAgent:t,savingField:n,setSavingField:s,updateAgentMutation:o,refetchAgent:i,initialSelectedAgentId:c})=>{P();const[u,x]=l.useState(t);l.useEffect(()=>{x(t)},[t]);const[f,j]=l.useState(!1),b=l.useId(),k=f?Ct:at;return e.jsxs("div",{children:[e.jsxs("h2",{className:"flex items-center gap-2",children:[e.jsxs("button",{type:"button",onClick:()=>j(!f),"aria-expanded":f,"aria-controls":b,className:"group flex items-center gap-2 py-1 text-start text-heading text-ink",children:[e.jsx(k,{size:14,"aria-hidden":"true",className:"shrink-0 text-ink-dim transition-colors duration-fast ease-out-quart group-hover:text-ink rtl:-scale-x-100"}),a("ui.agents.settings.chat.advanced_chat_settings")]}),e.jsx(W,{content:a("ui.agents.settings.chat.advanced_settings_to_change_how_the_agent"),children:e.jsx(E,{variant:"ghost",size:"icon-sm","aria-label":a("ui.agents.settings.chat.about_advanced_chat_settings"),children:e.jsx(je,{})})})]}),f&&e.jsxs("div",{id:b,className:"mt-3",children:[e.jsx("p",{className:"max-w-2xl text-body-sm text-ink-muted",children:a("ui.agents.settings.chat.set_custom_values_for_any_of_these")}),e.jsxs("div",{className:"mt-6 flex flex-col gap-8",children:[e.jsxs(Le,{title:a("ui.agents.settings.chat.sampling"),children:[u.temperature===null?e.jsx(Y,{label:a("ui.agents.settings.chat.temperature"),description:a("ui.agents.settings.chat.controls_randomness_in_responses_0_0_1"),defaultLabel:w.temperature,onSet:async()=>{s("temperature");try{const r={temperature:w.temperature};await o.mutateAsync({agentId:t.id,update:r}),x(d=>({...d,temperature:w.temperature})),t.id===c&&i&&await i()}catch{}finally{s(null)}}}):e.jsx(se,{value:u.temperature??w.temperature,label:a("ui.agents.settings.chat.temperature"),description:a("ui.agents.settings.chat.controls_randomness_in_responses_0_0_1"),min:0,max:1,step:.01,isSaving:n==="temperature",onChange:async r=>{s("temperature");try{const d={temperature:r};await o.mutateAsync({agentId:t.id,update:d}),t.id===c&&i&&await i()}catch{}finally{s(null)}}}),u.top_p===null?e.jsx(Y,{label:a("ui.agents.settings.chat.top_p"),description:a("ui.agents.settings.chat.controls_cumulative_probability_of_tokens_to_sample"),defaultLabel:w.top_p,onSet:async()=>{s("top_p");try{const r={top_p:w.top_p};await o.mutateAsync({agentId:t.id,update:r}),x(d=>({...d,top_p:w.top_p})),t.id===c&&i&&await i()}catch{}finally{s(null)}}}):e.jsx(se,{value:u.top_p??w.top_p,label:a("ui.agents.settings.chat.top_p"),description:a("ui.agents.settings.chat.controls_cumulative_probability_of_tokens_to_sample"),min:0,max:1,step:.01,isSaving:n==="top_p",onChange:async r=>{s("top_p");try{const d={top_p:r};await o.mutateAsync({agentId:t.id,update:d}),t.id===c&&i&&await i()}catch{}finally{s(null)}}}),u.top_k===null?e.jsx(Y,{label:a("ui.agents.settings.chat.top_k"),description:a("ui.agents.settings.chat.limits_tokens_to_sample_from_at_each"),defaultLabel:w.top_k,onSet:async()=>{s("top_k");try{const r={top_k:w.top_k};await o.mutateAsync({agentId:t.id,update:r}),x(d=>({...d,top_k:w.top_k})),t.id===c&&i&&await i()}catch{}finally{s(null)}}}):e.jsx(se,{value:u.top_k??w.top_k,label:a("ui.agents.settings.chat.top_k"),description:a("ui.agents.settings.chat.limits_tokens_to_sample_from_at_each"),min:1,max:100,step:1,isSaving:n==="top_k",onChange:async r=>{s("top_k");try{const d={top_k:r};await o.mutateAsync({agentId:t.id,update:d}),t.id===c&&i&&await i()}catch{}finally{s(null)}}}),u.seed===null?e.jsx(Y,{label:a("ui.agents.settings.chat.seed"),description:a("ui.agents.settings.chat.random_number_seed_for_deterministic_generation"),defaultLabel:w.seed,onSet:async()=>{s("seed");try{const r={seed:w.seed};await o.mutateAsync({agentId:t.id,update:r}),x(d=>({...d,seed:w.seed})),t.id===c&&i&&await i()}catch{}finally{s(null)}}}):e.jsx(ie,{value:u.seed?.toString()||"",label:a("ui.agents.settings.chat.seed"),placeholder:a("ui.agents.settings.chat.random_number_seed_for_deterministic_generation_detail"),icon:e.jsx(Ee,{size:16}),isSaving:n==="seed",onSave:async r=>{s("seed");try{const d=r.trim()?Number.parseInt(r,10):void 0;if(r.trim()&&Number.isNaN(d)){ue(a("ui.agents.settings.chat.error.invalid_seed"));return}const m={seed:d};await o.mutateAsync({agentId:t.id,update:m}),t.id===c&&i&&await i()}catch{}finally{s(null)}}})]}),e.jsxs(Le,{title:a("ui.agents.settings.chat.repetition"),children:[u.frequency_penalty===null?e.jsx(Y,{label:a("ui.agents.settings.chat.frequency_penalty"),description:a("ui.agents.settings.chat.reduces_repetition_by_lowering_likelihood_of_repeated"),defaultLabel:w.frequency_penalty,onSet:async()=>{s("frequency_penalty");try{const r={frequency_penalty:w.frequency_penalty};await o.mutateAsync({agentId:t.id,update:r}),x(d=>({...d,frequency_penalty:w.frequency_penalty})),t.id===c&&i&&await i()}catch{}finally{s(null)}}}):e.jsx(se,{value:u.frequency_penalty??w.frequency_penalty,label:a("ui.agents.settings.chat.frequency_penalty"),description:a("ui.agents.settings.chat.reduces_repetition_by_lowering_likelihood_of_repeated"),min:-2,max:2,step:.01,isSaving:n==="frequency_penalty",onChange:async r=>{s("frequency_penalty");try{const d={frequency_penalty:r};await o.mutateAsync({agentId:t.id,update:d}),t.id===c&&i&&await i()}catch{}finally{s(null)}}}),u.presence_penalty===null?e.jsx(Y,{label:a("ui.agents.settings.chat.presence_penalty"),description:a("ui.agents.settings.chat.increases_diversity_by_lowering_likelihood_of_prompt"),defaultLabel:w.presence_penalty,onSet:async()=>{s("presence_penalty");try{const r={presence_penalty:w.presence_penalty};await o.mutateAsync({agentId:t.id,update:r}),x(d=>({...d,presence_penalty:w.presence_penalty})),t.id===c&&i&&await i()}catch{}finally{s(null)}}}):e.jsx(se,{value:u.presence_penalty??w.presence_penalty,label:a("ui.agents.settings.chat.presence_penalty"),description:a("ui.agents.settings.chat.increases_diversity_by_lowering_likelihood_of_prompt"),min:-2,max:2,step:.01,isSaving:n==="presence_penalty",onChange:async r=>{s("presence_penalty");try{const d={presence_penalty:r};await o.mutateAsync({agentId:t.id,update:d}),t.id===c&&i&&await i()}catch{}finally{s(null)}}})]}),e.jsxs(Le,{title:a("ui.agents.settings.chat.length_and_stopping"),children:[u.max_tokens===null?e.jsx(Y,{label:a("ui.agents.settings.chat.max_tokens"),description:a("ui.agents.settings.chat.maximum_tokens_to_generate_in_response"),defaultLabel:w.max_tokens,onSet:async()=>{s("max_tokens");try{const r={max_tokens:w.max_tokens};await o.mutateAsync({agentId:t.id,update:r}),x(d=>({...d,max_tokens:w.max_tokens})),t.id===c&&i&&await i()}catch{}finally{s(null)}}}):e.jsx(se,{value:u.max_tokens??w.max_tokens,label:a("ui.agents.settings.chat.max_tokens"),description:a("ui.agents.settings.chat.maximum_tokens_to_generate_in_response"),min:1,max:8192,step:1,isSaving:n==="max_tokens",onChange:async r=>{s("max_tokens");try{const d={max_tokens:r};await o.mutateAsync({agentId:t.id,update:d}),t.id===c&&i&&await i()}catch{}finally{s(null)}}}),u.stop===null?e.jsx(Y,{label:a("ui.agents.settings.chat.stop_sequences"),description:a("ui.agents.settings.chat.sequences_that_will_cause_the_model_to"),defaultLabel:a("ui.agents.settings.chat.empty"),onSet:async()=>{s("stop");try{const r={stop:[]};await o.mutateAsync({agentId:t.id,update:r}),x(d=>({...d,stop:[]})),t.id===c&&i&&await i()}catch{}finally{s(null)}}}):e.jsx(ie,{value:u.stop?.join(`
|
|
32
32
|
`)||"",label:a("ui.agents.settings.chat.stop_sequences"),placeholder:a("ui.agents.settings.chat.enter_stop_sequences_one_per_line"),icon:e.jsx(Ee,{size:16}),multiline:!0,rows:3,isSaving:n==="stop",onSave:async r=>{s("stop");try{const d=r.split(`
|
|
33
|
-
`).map(y=>y.trim()).filter(y=>y.length>0),m={stop:d.length>0?d:void 0};await o.mutateAsync({agentId:t.id,update:m}),t.id===c&&i&&await i()}catch{}finally{s(null)}}})]})]})]})]})},ts=["investment","accounting","healthcare","legal","software","security","role_play","personal_assistance","education","marketing","sales","research","analysis","management","social_media","other"],be=t=>a("ui.common.forms.categories_input_chips.category",{category:t==="other"?"other_category":t}),as=({value:t,label:n,onChange:s,placeholder:o=a("ui.common.forms.categories_input_chips.add_category"),disabled:i=!1,icon:c})=>{const u=P(),[x,f]=l.useState(""),[j,b]=l.useState(!1),[k,r]=l.useState(0),d=l.useRef(null),m=l.useRef([]),y=l.useId(),v=l.useId(),S=l.useMemo(()=>{const _=x.trim().toLowerCase();return ts.filter(g=>!t.includes(g)&&(!_||be(g).toLowerCase().includes(_)))},[t,x,u]);l.useEffect(()=>{j&&m.current[k]?.scrollIntoView({block:"nearest"})},[k,j]);const C=_=>{t.includes(_)||s([...t,_]),f(""),b(!1),r(0),d.current?.focus()},q=_=>{f(_.target.value),r(0),b(!0)},N=_=>{const g=S.length;switch(_.key){case"ArrowDown":if(_.preventDefault(),g===0)break;j?r((k+1)%g):(r(0),b(!0));break;case"ArrowUp":if(_.preventDefault(),g===0)break;j?r((k-1+g)%g):(r(g-1),b(!0));break;case"Enter":j&&S[k]&&(_.preventDefault(),C(S[k]));break;case"Escape":j&&(_.preventDefault(),b(!1));break;case"Home":j&&(_.preventDefault(),r(0));break;case"End":j&&(_.preventDefault(),r(S.length-1));break}},T=_=>{s(t.filter(g=>g!==_)),r(0)},L=j&&S[k]?`${v}-option-${k}`:void 0;return e.jsxs("div",{children:[e.jsxs(ce,{htmlFor:y,className:"mb-1.5 flex items-center gap-2 text-ink-muted",children:[c,n]}),e.jsxs("div",{className:$("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",i&&"border-hairline bg-sunken"),children:[t.map(_=>e.jsxs(it,{className:"gap-1 pe-1 text-ink",children:[be(_),e.jsx("button",{type:"button","aria-label":a("ui.common.forms.categories_input_chips.remove_category",{value:be(_)}),disabled:i,onClick:()=>T(_),className:$("rounded-xs text-ink-dim","transition-colors duration-fast ease-out-quart","hover:text-danger disabled:text-ink-disabled"),children:e.jsx(ot,{})})]},_)),e.jsxs(St,{open:j,onOpenChange:b,children:[e.jsx(It,{asChild:!0,children:e.jsx("input",{id:y,ref:d,type:"text",role:"combobox","aria-expanded":j,"aria-controls":v,"aria-autocomplete":"list","aria-activedescendant":L,autoComplete:"off",value:x,placeholder:o,disabled:i,"aria-label":n,onChange:q,onKeyDown:N,onClick:()=>{S.length>0&&b(!0)},className:$("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(Dt,{align:"start",sideOffset:4,onOpenAutoFocus:_=>_.preventDefault(),className:"max-h-60 w-(--radix-popover-trigger-width) overflow-y-auto p-1",children:e.jsx("div",{id:v,role:"listbox","aria-label":n,children:S.map((_,g)=>e.jsx("div",{id:`${v}-option-${g}`,ref:I=>{m.current[g]=I},role:"option","aria-selected":g===k,onMouseDown:I=>{I.preventDefault()},onMouseEnter:()=>r(g),onClick:()=>C(_),className:$("cursor-pointer rounded-sm px-3 py-1.5 font-medium text-body-sm",g===k?"bg-accent-wash":void 0,"text-ink"),children:be(_)},_))})})]})]}),t.length===0&&e.jsx("span",{className:"mt-1 ms-1 block text-ink-dim text-meta",children:a("ui.common.forms.categories_input_chips.no_categories_selected")})]})},ss=({value:t,label:n,onChange:s,placeholder:o=a("ui.common.forms.tags_input_chips.add_tag"),disabled:i=!1,icon:c})=>{P();const[u,x]=l.useState(""),f=l.useRef(null),j=l.useId(),b=m=>{x(m.target.value)},k=()=>{const m=u.trim().toLowerCase();m&&!t.includes(m)&&s([...t,m]),x("")},r=m=>{m.key==="Enter"&&u.trim()?(m.preventDefault(),k()):m.key==="Backspace"&&!u&&t.length>0&&s(t.slice(0,-1))},d=m=>{s(t.filter(y=>y!==m))};return e.jsxs("div",{children:[e.jsxs(ce,{htmlFor:j,className:"mb-1.5 flex items-center gap-2 text-ink-muted",children:[c,n]}),e.jsxs("div",{className:$("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",i&&"border-hairline bg-sunken"),children:[t.map(m=>e.jsxs(it,{className:"gap-1 pe-1 text-ink",children:[m,e.jsx("button",{type:"button","aria-label":a("ui.common.forms.tags_input_chips.remove_tag",{tag:m}),disabled:i,onClick:()=>d(m),className:$("rounded-xs text-ink-dim","transition-colors duration-fast ease-out-quart","hover:text-danger disabled:text-ink-disabled"),children:e.jsx(ot,{})})]},m)),e.jsx("input",{id:j,ref:f,type:"text",value:u,onChange:b,onKeyDown:r,placeholder:o,disabled:i,"aria-label":n,className:$("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")}),u.trim()&&e.jsx(E,{variant:"ghost",size:"icon-sm","aria-label":a("ui.common.forms.tags_input_chips.add_tage0db29"),disabled:i,onClick:()=>{k(),f.current?.focus()},className:"text-accent hover:text-accent",children:e.jsx(lt,{})})]}),t.length===0&&!u&&e.jsx("span",{className:"mt-1 ms-1 block text-ink-dim text-meta",children:a("ui.common.forms.tags_input_chips.no_tags_added")})]})},ns=({selectedAgent:t,savingField:n,setSavingField:s,updateAgentMutation:o,refetchAgent:i,initialSelectedAgentId:c})=>{P();const{data:u,isLoading:x}=ua(),[f,j]=l.useState("");l.useEffect(()=>{!x&&u?.values?j(t.hosting||u.values.hosting||""):x||j(t.hosting||"")},[t,u,x]);const[b,k]=l.useState(!1),[r,d]=l.useState(!1);return e.jsxs("div",{className:"flex flex-col gap-4",children:[e.jsx(ie,{value:t.name,label:a("ui.agents.settings.general.agent_name"),placeholder:a("ui.agents.settings.general.enter_agent_name"),isSaving:n==="name",onSave:async m=>{if(!m.trim()){ue(a("ui.agents.settings.general.error.empty_name"));return}s("name");try{const y={name:m};await o.mutateAsync({agentId:t.id,update:y}),t.id===c&&i&&await i()}catch{}finally{s(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(Bt,{value:t.hosting||(u?.values.hosting??""),isSaving:n==="hosting",onSave:async m=>{s("hosting"),j(m);try{const y={hosting:m,model:""};await o.mutateAsync({agentId:t.id,update:y}),t.id===c&&i&&await i()}catch{j(t.hosting||"")}finally{s(null)}},filterByCredentials:!0,allowDefault:!0},`hosting-select-${t.id}-${t.hosting||(u?.values.hosting??"default")}`)}),e.jsx("div",{"data-tour-tag":"agent-settings-model-select",children:f?e.jsx(Wt,{value:t.hosting?t.model||"":t.model||(u?.values.model_name??""),hostingId:f,isSaving:n==="model",allowDefault:!0,onSave:async m=>{s("model");try{const y={model:m};await o.mutateAsync({agentId:t.id,update:y}),t.id===c&&i&&await i()}catch{}finally{s(null)}}},`model-select-${t.id}-${f}-${t.model||(!t.hosting&&u?.values.model_name?u.values.model_name:"default")}`):e.jsxs("div",{className:"relative",children:[e.jsx(W,{content:a("ui.agents.settings.general.select_a_hosting_provider_first_and_then"),children:e.jsxs("div",{className:"mb-1.5 flex w-fit items-center gap-2 text-body-sm text-ink-muted",children:[e.jsx(Qt,{size:16,"aria-hidden":"true"}),a("ui.agents.settings.general.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:a("ui.agents.settings.general.select_a_hosting_provider_first")})})]})})]}),e.jsxs("h2",{className:"mt-4 flex items-center gap-2 text-heading text-ink",children:[e.jsx(je,{size:16,className:"shrink-0 text-ink-dim"}),a("ui.agents.settings.general.agent_information")]}),e.jsxs("div",{className:"flex flex-col gap-4",children:[e.jsx(ie,{value:t.description||"",label:a("ui.agents.settings.general.description"),placeholder:a("ui.agents.settings.general.enter_agent_description"),multiline:!0,rows:3,isSaving:n==="description",onSave:async m=>{s("description");try{const y={description:m};await o.mutateAsync({agentId:t.id,update:y}),t.id===c&&i&&await i()}catch{}finally{s(null)}}}),e.jsx(ss,{value:t.tags||[],label:a("ui.agents.settings.general.tags"),placeholder:a("ui.agents.settings.general.add_tag"),disabled:b,onChange:async m=>{if(!(Array.isArray(t.tags)&&m.length===t.tags.length&&m.every((y,v)=>y===t.tags?.[v]))){k(!0);try{const y={tags:m};await o.mutateAsync({agentId:t.id,update:y}),t.id===c&&i&&await i()}catch{}finally{k(!1)}}}}),e.jsx(as,{value:t.categories||[],label:a("ui.agents.settings.general.categories"),placeholder:a("ui.agents.settings.general.add_category"),disabled:r,onChange:async m=>{if(!(Array.isArray(t.categories)&&m.length===t.categories.length&&m.every((y,v)=>y===t.categories?.[v]))){d(!0);try{const y={categories:m};await o.mutateAsync({agentId:t.id,update:y}),t.id===c&&i&&await i()}catch{}finally{d(!1)}}}}),e.jsxs(Vt,{children:[e.jsx(De,{label:e.jsxs(e.Fragment,{children:[e.jsx(Va,{size:12,"aria-hidden":"true"}),a("ui.agents.settings.general.id")]}),value:e.jsx("span",{className:"font-mono text-mono-sm",children:t.id})}),e.jsx(De,{label:e.jsxs(e.Fragment,{children:[e.jsx(Kt,{size:12,"aria-hidden":"true"}),a("ui.agents.settings.general.created")]}),value:da(t.created_date)}),e.jsx(De,{label:e.jsxs(e.Fragment,{children:[e.jsx(Wa,{size:12,"aria-hidden":"true"}),a("ui.agents.settings.general.version")]}),value:t.version})]})]})]})},is=({selectedAgent:t,savingField:n,setSavingField:s,updateAgentMutation:o,refetchAgent:i,initialSelectedAgentId:c})=>(P(),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(Gt,{size:16,className:"shrink-0 text-ink-dim"}),a("ui.agents.settings.security.security_instructions"),e.jsx(W,{content:a("ui.agents.settings.security.security_instructions_that_guide_the_agent_s"),children:e.jsx(E,{variant:"ghost",size:"icon-sm","aria-label":a("ui.agents.settings.security.about_security_instructions"),children:e.jsx(je,{})})})]}),e.jsx("p",{className:"mt-1 max-w-2xl text-body-sm text-ink-muted",children:a("ui.agents.settings.security.this_prompt_is_directed_to_the_ai")}),e.jsx("div",{className:"mt-4",children:e.jsx(ie,{value:t.security_prompt||"",label:"",placeholder:a("ui.agents.settings.security.enter_instructions_for_the_security_agent"),multiline:!0,rows:6,isSaving:n==="security_prompt",onSave:async u=>{s("security_prompt");try{const x={security_prompt:u};await o.mutateAsync({agentId:t.id,update:x}),t.id===c&&i&&await i()}catch{}finally{s(null)}}})})]})),os=({selectedAgent:t,savingField:n,setSavingField:s,refetchAgent:o,initialSelectedAgentId:i})=>{P();const{data:c,isLoading:u}=_t(t.id),x=Ja(t.id),[f,j]=l.useState("");return l.useEffect(()=>{c!==void 0&&j(c)},[c]),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(Na,{size:16,className:"shrink-0 text-ink-dim"}),a("ui.agents.settings.system_prompt.agent_instructions"),e.jsx(W,{content:a("ui.agents.settings.system_prompt.system_instructions_that_define_the_agent_s"),children:e.jsx(E,{variant:"ghost",size:"icon-sm","aria-label":a("ui.agents.settings.system_prompt.about_agent_instructions"),children:e.jsx(je,{})})})]}),e.jsx("p",{className:"mt-1 max-w-2xl text-body-sm text-ink-muted",children:a("ui.agents.settings.system_prompt.define_the_agent_s_role_personality_or")}),e.jsx("div",{className:"mt-4",children:e.jsx(ie,{value:f,label:"",placeholder:u?a("ui.agents.settings.system_prompt.loading_system_prompt"):a("ui.agents.settings.system_prompt.enter_instructions_for_the_agent"),multiline:!0,rows:6,isSaving:n==="system_prompt",onSave:async b=>{s("system_prompt");try{await x.mutateAsync(b),t.id===i&&o&&await o()}finally{s(null)}}})})]})},rs=({selectedAgent:t,refetchAgent:n,initialSelectedAgentId:s})=>{P();const[o,i]=l.useState(null),c=Ft();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(ns,{selectedAgent:t,savingField:o,setSavingField:i,updateAgentMutation:c,refetchAgent:n,initialSelectedAgentId:s}),e.jsx(os,{selectedAgent:t,savingField:o,setSavingField:i,refetchAgent:n,initialSelectedAgentId:s}),e.jsx(is,{selectedAgent:t,savingField:o,setSavingField:i,updateAgentMutation:c,refetchAgent:n,initialSelectedAgentId:s}),e.jsx(es,{selectedAgent:t,savingField:o,setSavingField:i,updateAgentMutation:c,refetchAgent:n,initialSelectedAgentId:s})]})}):e.jsxs("div",{className:"flex h-full flex-col items-center justify-center gap-2 p-8 text-center",children:[e.jsx(qe,{size:48,className:"text-ink-dim","aria-hidden":"true"}),e.jsx("h2",{className:"text-heading text-ink",children:a("ui.agents.settings.agent.no_agent_selected")}),e.jsx("p",{className:"max-w-md text-body-sm text-ink-muted",children:a("ui.agents.settings.agent.select_an_agent_from_the_list_on")})]})})},Re=ba()(fa(t=>({listings:{},remember:(n,s)=>{t(o=>({listings:{...o.listings,[n]:s}}))},forget:n=>{t(s=>{if(!(n in s.listings))return s;const o={...s.listings};return delete o[n],{listings:o}})}}),{name:"published-listings-storage"})),ls=t=>Re(n=>t?n.listings[t]??null:null),cs=400,us=2,ds=t=>[...t].length>=us;function ms(t){if(!t)return{state:"unknown",builtinName:null};if(t.available)return{state:"available",builtinName:null};const n=t.details?.builtin_name??null;return t.code==="name_taken"?{state:"taken",builtinName:null}:t.code==="name_reserved_builtin"?{state:"reserved",builtinName:n}:{state:"unknown",builtinName:null}}const ps=(t,n)=>{const s=t.trim(),o=ct(s,cs),i=n&&o===s&&ds(o)&&ya(o),c=xt({queryKey:["agent-name-availability",o],enabled:i,queryFn:async()=>(await Oe.getAgentNameAvailability(X.baseUrl,o)).result,retry:!1,staleTime:15e3,refetchOnWindowFocus:!1});return!i||c.isPending?{state:i?"checking":"idle",builtinName:null}:c.isError?{state:"unknown",builtinName:null}:ms(c.data)},gs=()=>{const t=bt();return pt({mutationFn:async({agentId:n,document:s,hubAgentId:o,target:i,policy:c})=>{if(!X.baseUrl)throw new Error("Local Operator API URL is not configured.");return o?Oe.republishAgentInstructionSet(X.baseUrl,n,o,s,i,c):Oe.publishAgentInstructionSet(X.baseUrl,n,s,i,c)},onSuccess:(n,s)=>{const o=n.result;o?.agent_id&&!s.target&&Re.getState().remember(s.agentId,{hubAgentId:o.agent_id,name:o.name,publishedAt:new Date().toISOString()}),o?.local_link_receipt&&t.invalidateQueries({queryKey:Yt}),s.target?Ea(t,s.target.tenantId):Ta(t)},onError:n=>{console.error("Publishing an agent to the hub failed:",n)}})},fe="public",jt=({open:t,onClose:n,agent:s,isAuthenticated:o,onSignInSuccess:i,onPublished:c})=>{const[u,x]=l.useState(!1),[f,j]=l.useState(""),[b,k]=l.useState(null),[r,d]=l.useState(null),[m,y]=l.useState(!1),v=l.useRef(null),S=l.useRef(null),C=Ue(),q=gs();P();const[N,T]=l.useState(Pe),L=l.useRef(null),_=l.useRef({open:!1,id:null}),g=ls(s?.id??null),I=_a(),z=ja(I.data,"hub_links"),Q=Jt(t&&z),ke=ma(),de=ka(I.data,"radient_org"),ve=La(de),me=o?Pa(de,ke??null):null,{memberships:J,isError:we}=At({enabled:t&&o&&ve}),Z=l.useMemo(()=>Ca(J),[J]),A=l.useMemo(()=>Sa(J),[J]),[M,pe]=l.useState(fe),h=M!==fe,O=(Q.data?.links??[]).filter(p=>p.kind==="agent"&&p.local_id===s?.id),D=O.find(p=>p.visibility===(h?"org":"public")&&p.tenant_id===(h?M:null)),H=O.find(p=>p.link_id!==D?.link_id),K=Q.data?.unresolved.some(p=>p.kind==="agent"&&p.local_id===s?.id),B=Z.find(p=>p.tenant_id===M),ge=h?B?.tenant_name?a("ui.hub.links.source_private",{organization:B.tenant_name}):a("ui.hub.links.source_unavailable"):a("ui.hub.links.source_public"),re=Z.find(p=>p.tenant_id===M)?.tenant_name||"this organization",he=l.useId(),xe=l.useId(),{data:$e}=_t(t&&s?s.id:""),{data:Me}=pa(t);l.useEffect(()=>{t&&(!_.current.open||_.current.id!==(s?.id??null))&&j(s?.name??""),_.current={open:t,id:s?.id??null}},[t,s?.id,s?.name]),l.useEffect(()=>{t||(x(!1),k(null),d(null),y(!1),pe(fe),T(Pe()),L.current=null)},[t]);const kt=l.useMemo(()=>(Me??[]).filter(p=>p.source==="builtin").map(p=>p.name),[Me]),He=Oa(f,kt),Be=ps(f,t&&o),ee=l.useMemo(()=>{const p=qa({name:f,description:s?.description??"",instructions:$e??null,tools:za(s?.tags)});return He&&p.unshift({field:"name",message:Je({code:"name_reserved_builtin",message:""},{name:f,hubAgentId:null}).body}),p},[f,s?.description,s?.tags,$e,He]),U=b?Je(b,{name:f,hubAgentId:g?.hubAgentId??null}):null,te=q.isPending,Ne=async p=>{if(!s||te||ee.length>0||h&&!B)return;k(null);const R=p?.asNewListing?null:D?.hub_id??(h?null:g?.hubAgentId??null),Qe=!!R;if(!(z&&(!Q.isSuccess||H||K)))try{const G={name:f.trim()},Ve=JSON.stringify({agent:s.id,document:G,hubAgentId:R,target:M,policy:D?null:N}),Ce=L.current?.tuple===Ve?L.current:{tuple:Ve,id:crypto.randomUUID()};L.current=Ce;const ae=(await q.mutateAsync({agentId:s.id,document:G,hubAgentId:R,...z?{policy:D?{requestId:Ce.id,...D.remote_revision&&Qe?{expectedRemoteRevision:D.remote_revision}:{}}:{requestId:Ce.id,...N}}:{},target:h?{visibility:"org",tenantId:M}:void 0})).result,Ke={name:ae?.name??f.trim(),hubAgentId:ae?.agent_id??null,republished:Qe,orgName:h?re:null,localPolicies:ae?.local_link_receipt?Da(ae)?"complete":"pending":z?"pending":null};d(Ke),ae&&c?.(ae,Ke.republished)}catch(G){k(ga(G)?{code:G.code,message:G.message,details:G.details}:{message:va(G,"The agent could not be published. Try again.")})}},We=p=>{switch(p){case"focus-name":k(null),requestAnimationFrame(()=>{v.current?.focus(),v.current?.select()});break;case"update-listing":{const R=b?.details?.existing_agent_id??g?.hubAgentId;R&&(n(),C(`/agent-hub/${R}`));break}case"install-builtin":{const R=b?.details?.builtin_name??Be.builtinName;R&&(n(),C(`/agents?kind=agent&name=${encodeURIComponent(R)}`));break}case"edit-instructions":case"edit-agent":s&&(n(),C(`/agents/${s.id}`));break;case"publish-as-new":s&&Re.getState().forget(s.id),Ne({asNewListing:!0});break;case"sign-in":y(!0);break;case"refresh-hub":n(),C("/agent-hub");break;case"retry":Ne();break}},V=s?.name??"",vt=r?r.orgName?`Published "${V}" to ${r.orgName}`:r.republished?`Updated the Agent Hub listing for "${V}"`:`Published "${V}" to the Agent Hub`:h?`Publish "${V}" to ${re}?`:g?`Update the Agent Hub listing for "${V}"?`:`Publish "${V}" to the Agent Hub?`;l.useLayoutEffect(()=>{!b&&!r||S.current?.focus()},[b,r]);const wt=r?e.jsxs(e.Fragment,{children:[e.jsx(ne,{onClick:n,"data-tour-tag":"upload-agent-dialog-cancel-button",children:a("ui.common.actions.close")}),r.hubAgentId&&e.jsx(_e,{onClick:()=>{n(),C(`/agent-hub/${r.hubAgentId}`)},children:a("ui.agents.upload.action.open_listing")})]}):U?e.jsxs(e.Fragment,{children:[e.jsx(ne,{onClick:n,"data-tour-tag":"upload-agent-dialog-cancel-button",children:a("ui.common.actions.close")}),U.actions.map((p,R)=>R===0?e.jsx(_e,{onClick:()=>We(p),disabled:te,children:Ae[p]},p):e.jsx(ne,{onClick:()=>We(p),disabled:te,children:Ae[p]},p))]}):e.jsxs(e.Fragment,{children:[e.jsx(ne,{onClick:n,"data-tour-tag":"upload-agent-dialog-cancel-button",children:a("ui.common.actions.cancel")}),ee.some(p=>p.field!=="name")&&e.jsx(ne,{onClick:()=>{s&&(n(),C(`/agents/${s.id}`))},children:a("ui.agents.upload.action.edit_agent")}),o&&e.jsx(_e,{"data-testid":"publish-submit",onClick:()=>void Ne(),disabled:h&&!B||!u||ee.length>0||!f.trim()||te||z&&(!Q.isSuccess||!!H||!!K),children:te?"Publishing…":g&&!h?"Update listing":"Publish"})]});return e.jsx(gt,{open:t,onClose:n,title:vt,maxWidth:"sm",fullWidth:!0,actions:wt,dataTourTag:"upload-agent-dialog",dialogProps:{className:"outline-none"},children:e.jsxs("div",{ref:S,tabIndex:b||r?-1:void 0,className:$("flex flex-col gap-4",(b||r)&&"outline-none"),children:[o?r?e.jsxs(ye,{variant:"success","aria-live":"polite",children:[e.jsx(Se,{children:r.orgName?`Published to ${r.orgName}`:r.republished?"Listing updated":"Published to the hub"}),e.jsx(le,{children:r.orgName?`"${r.name}" is in ${r.orgName}'s shared agents as an instruction set. Its members can read and install it; nobody outside the organization can.`:r.republished?a("ui.agents.upload.published.republished",{name:r.name}):a("ui.agents.upload.published.listed",{name:r.name})}),e.jsx(le,{className:"text-ink-muted",children:a("ui.agents.upload.sign_in.nothing_left")})]}):U&&b?e.jsxs(ye,{variant:U.variant,role:"alert",children:[e.jsx(Se,{children:U.headline}),e.jsx(le,{children:U.body}),U.note&&e.jsx(le,{className:"text-ink-muted",children:U.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:a("ui.agents.upload.sign_in.needed")}),e.jsx(Ye,{titleText:"Sign in to continue",descriptionText:"",onSignInSuccess:i})]}),U&&m&&e.jsxs("div",{className:"flex flex-col items-center gap-6 text-center",children:[e.jsx("p",{className:"text-body text-ink",children:a("ui.agents.upload.sign_in.reauthenticate")}),e.jsx(Ye,{titleText:"Sign in again",descriptionText:"",onSignInSuccess:()=>{y(!1),k(null),i?.()}})]}),r?.localPolicies==="pending"&&e.jsx("p",{role:"alert",className:"text-body-sm text-warning",children:a("ui.hub.skills.policy_pending")}),!r&&z&&e.jsx("div",{className:"flex flex-col gap-3",children:Q.isLoading?e.jsx("p",{className:"text-meta text-ink-muted",children:a("ui.hub.links.loading")}):Q.error?e.jsx("p",{role:"alert",className:"text-body-sm text-warning",children:a("ui.hub.links.load_failed")}):H?e.jsx("p",{className:"text-body-sm text-warning",children:a("ui.hub.subscriptions.source_separation",{currentSource:Xt(H),newSource:ge})}):K?e.jsx("p",{className:"text-body-sm text-warning",children:a("ui.hub.links.source_unavailable")}):D?e.jsx(Zt,{link:D}):e.jsx(Ia,{value:N,onChange:T,source:ge,item:f||V,visibility:h?"org":"public",organization:h?re:null,destinationKey:`${M}:${s?.id??""}`,canEnableAutoPush:!1,disabled:te||!Q.isSuccess})}),!r&&!U&&e.jsxs(e.Fragment,{children:[e.jsx("p",{className:"text-body text-ink",children:h?`You are about to publish this agent's instruction set into ${re}, where only its members can read and install it. What is published is what describes the agent:`:"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 ps-5 text-body text-ink-muted",children:[e.jsx("li",{children:a("ui.agents.upload.list.name")}),e.jsx("li",{children:a("ui.agents.upload.list.instructions")}),e.jsx("li",{children:a("ui.agents.upload.list.surface")})]}),e.jsx("p",{className:"text-body text-ink",children:h?`Nothing else leaves this machine: no conversation, no execution history, no memory or learnings, no plan, and no machine-specific configuration. ${re}'s members can read and install what you publish; nobody outside it can.`:"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."}),Z.length>0||A.length>0?e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(ce,{htmlFor:`${he}-target`,children:a("ui.agents.upload.target.label")}),e.jsxs(Pt,{value:M,onValueChange:p=>{pe(p),T(Pe()),L.current=null},children:[e.jsx(Lt,{id:`${he}-target`,className:"w-full","data-testid":"publish-target",children:e.jsx(Et,{})}),e.jsxs(Tt,{children:[e.jsx(Ie,{value:fe,children:a("ui.hub.pages.scope.public")}),Z.map(p=>e.jsx(Ie,{value:p.tenant_id,children:p.tenant_name||"Organization"},p.tenant_id)),A.map(p=>e.jsxs(Ie,{value:p.tenant_id,disabled:!0,children:[p.tenant_name||a("ui.hub.pages.scope.org_label")," ",a("ui.agents.upload.target.upgrade")]},p.tenant_id))]})]}),e.jsx("p",{className:"text-meta text-ink-muted","data-testid":"publish-target-hint",children:A.length>0?`Sharing agents inside an organization is part of the Team plan. An owner of ${A.length===1?A[0].tenant_name||"this organization":"any of the organizations marked above"} can activate it in the Radient console.`:"Public hub publications are readable by anyone. An organization's agents are readable by its members only."})]}):me?e.jsx("p",{className:"text-meta text-ink-muted","data-testid":"publish-target-unavailable",children:me}):we?e.jsx("p",{className:"text-meta text-ink-muted","data-testid":"publish-target-failed",children:a("ui.agents.upload.target.orgs_unread")}):null,ee.length>0&&e.jsxs(ye,{variant:"danger",children:[e.jsx(Se,{children:a("ui.agents.upload.error.cannot_publish")}),e.jsx("ul",{className:"list-disc space-y-1 ps-5",children:ee.map(p=>e.jsx("li",{children:p.message},`${p.field}:${p.message}`))})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(ce,{htmlFor:xe,children:a("ui.agents.upload.field.name_label")}),e.jsx(nt,{id:xe,ref:v,value:f,onChange:p=>j(p.target.value),autoComplete:"off",spellCheck:!1,"aria-invalid":ee.some(p=>p.field==="name"),"aria-describedby":`${xe}-hint`}),e.jsx("p",{id:`${xe}-hint`,className:"text-meta text-ink-muted",children:a("ui.agents.upload.field.name_hint")}),!h&&hs(Be)]}),e.jsxs("div",{className:"flex gap-3",children:[e.jsx("span",{className:"flex h-5 shrink-0 items-center",children:e.jsx(Ot,{id:he,name:"termsAgreement","data-testid":"publish-consent",checked:u,onCheckedChange:p=>x(p===!0)})}),e.jsxs(ce,{htmlFor:he,className:"block font-normal text-body text-ink",children:[a("ui.agents.upload.terms.lead")," ",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:a("ui.agents.upload.terms.link")})," ",a("ui.agents.upload.terms.tail")]})]})]}),(r||U)&&V&&e.jsxs("p",{className:"text-meta text-ink-muted",children:[a("ui.agents.upload.availability.agent_label")," ",V]})]})})},hs=t=>{switch(t.state){case"checking":return e.jsx("p",{className:"text-meta text-ink-muted",children:a("ui.agents.upload.availability.checking")});case"available":return e.jsx("p",{className:"text-meta text-ink-muted",children:a("ui.agents.upload.availability.free")});case"taken":return e.jsx("p",{className:"text-meta text-ink",children:a("ui.agents.upload.availability.taken")});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}},xs=1200,bs=({agent:t,isSelected:n,onSelectAgent:s,onChatWithAgent:o,onExportAgent:i,onAgentDeleted:c,onUploadAgentToHub:u})=>{P();const x=t.description||a("ui.agents.navigation.sidebar.no_description");return e.jsxs("li",{className:"group relative",children:[e.jsxs("button",{type:"button",onClick:()=>s(t),"aria-current":n?"true":void 0,"data-tour-tag":"agent-list-item-button",className:$("flex w-full items-center gap-2 rounded-sm py-1.5 pe-9 ps-2 text-start","transition-colors duration-fast ease-out-quart",n?ta:"hover:bg-row-hover"),children:[e.jsx(zt,{className:"size-8 shrink-0",children:e.jsx(Ut,{className:"border border-control bg-sunken",children:e.jsx(qe,{size:16,"aria-hidden":!0})})}),e.jsxs("span",{className:"min-w-0 flex-1",children:[e.jsx(W,{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(W,{content:x,side:"bottom",align:"start",children:e.jsx("span",{className:"block truncate text-meta text-ink-dim",children:x})})]})]}),e.jsx("div",{className:$("pointer-events-none absolute top-0 end-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(W,{content:a("ui.agents.navigation.sidebar.options"),children:e.jsx("span",{children:e.jsx(Fa,{agentId:t.id,agentName:t.name,isAgentsPage:!0,onAgentDeleted:()=>c(t.id),onChatWithAgent:()=>o(t),onExportAgent:()=>i(t.id),onUploadAgentToHub:()=>u(t),buttonSx:{width:24,height:24,borderRadius:"6px",display:"flex",justifyContent:"center",alignItems:"center"}})})})})]})},fs=(t,n)=>t.isSelected===n.isSelected&&t.agent.id===n.agent.id&&t.agent.name===n.agent.name&&t.agent.description===n.agent.description&&t.onSelectAgent===n.onSelectAgent&&t.onChatWithAgent===n.onChatWithAgent&&t.onExportAgent===n.onExportAgent&&t.onAgentDeleted===n.onAgentDeleted&&t.onUploadAgentToHub===n.onUploadAgentToHub,ys=l.memo(bs,fs),_s=({selectedAgentId:t,onSelectAgent:n})=>{const s=Ue();P();const[o,i]=l.useState(""),c=wa(h=>h.openCreateAgentDialog),u=ct(o.trim(),250),[x,f]=l.useState(!1),j=50,[b,k]=l.useState(!1),[r,d]=l.useState(null),{isAuthenticated:m}=ht(),y=l.useMemo(()=>ze(X.baseUrl),[]),v=ut(),{page:S,setPage:C}=Aa(),{data:q,isLoading:N,isError:T,refetch:L}=ea(S,j,0,u||void 0,"created_date","desc"),_=q?.agents||[],g=q?.total||0,{data:I}=dt(t&&!_.find(h=>h.id===t)?t:void 0),z=l.useMemo(()=>{const h=[..._];return I&&!h.find(O=>O.id===I.id)&&h.push(I),h.sort((O,D)=>new Date(D.created_date).getTime()-new Date(O.created_date).getTime()),h},[_,I]),Q=l.useCallback(h=>{C(h)},[C]),ke=l.useCallback(h=>{n(h)},[n]),de=l.useCallback(()=>{f(!0)},[]),ve=l.useCallback(()=>{f(!1)},[]),me=l.useCallback(async h=>{try{const O=await v.mutateAsync(h),D=z.find(ge=>ge.id===h),H=D?D.name.replace(/\s+/g,"-").toLowerCase():h,K=URL.createObjectURL(O),B=document.createElement("a");B.href=K,B.download=`${H}-export.zip`,document.body.appendChild(B),B.click(),URL.revokeObjectURL(K),document.body.removeChild(B)}catch(O){console.error("Failed to export agent:",O)}},[z,v]),J=l.useCallback(h=>{d(h),k(!0)},[]),we=l.useCallback(()=>{k(!1),d(null)},[]),Z=l.useCallback(async h=>{try{const D=((await L()).data?.agents||[]).find(K=>K.id===h);if(D){n(D);return}const H=await y.agents.getAgent(h);H.status<400&&H.result&&n(H.result)}catch(O){console.error("Error selecting newly created agent:",O)}},[n,L,y]),A=l.useCallback(h=>{ft.getState().stageDraft({kind:"agent",name:h.name}),s("/chat")},[s]),M=l.useCallback(h=>{L(),s("/agents")},[t,L,s]),pe=l.useCallback(h=>{J(h)},[J]);return e.jsxs("div",{"data-glass-region":"page-sidebar",className:"panel-top-pad flex h-full w-full flex-col overflow-hidden bg-surface",children:[e.jsx(Za,{title:a("ui.agents.navigation.sidebar.title"),searchQuery:o,onSearchChange:h=>i(h),onNewAgentClick:c,onImportAgentClick:de,importAgentTooltip:a("ui.agents.navigation.sidebar.import_hint")}),N?e.jsx("div",{className:"flex flex-1 items-center justify-center",children:e.jsx(st,{size:"lg",label:a("ui.agents.navigation.sidebar.loading")})}):T?e.jsxs(ye,{variant:"danger",role:"alert",className:"m-4 w-auto",children:[e.jsx(le,{children:a("ui.agents.navigation.sidebar.error")}),e.jsx(E,{variant:"ghost",size:"sm",className:"self-start",onClick:()=>L(),children:a("ui.agents.navigation.sidebar.retry")})]}):z.length===0&&!N?e.jsx("p",{className:"p-6 text-center text-body-sm text-ink-muted",children:o?a("ui.agents.navigation.sidebar.search_empty"):a("ui.agents.navigation.sidebar.empty")}):e.jsx(qt,{delayDuration:xs,skipDelayDuration:0,children:e.jsx("ul",{className:"flex min-h-0 flex-1 flex-col gap-1 overflow-y-auto p-2",children:z.map(h=>e.jsx(ys,{agent:h,isSelected:t===h.id||I?.id===h.id,onSelectAgent:ke,onChatWithAgent:A,onExportAgent:me,onAgentDeleted:M,onUploadAgentToHub:pe},h.id))})}),e.jsx(Xa,{open:x,onClose:ve,onAgentImported:Z}),g>0&&e.jsx(Ya,{page:S,count:Math.max(1,Math.ceil(g/j)),onChange:Q}),e.jsx(jt,{open:b,onClose:we,agent:r,isAuthenticated:m})]})},js=l.memo(_s),zs=()=>{P();const{agentId:t,navigateToAgent:n}=aa(),s=Ue(),{isAuthenticated:o}=ht(),[i,c]=l.useState(!1),u=ut(),{setLastAgentsPageAgentId:x,getLastAgentId:f}=mt(),j=t||f("agents"),{data:b,refetch:k}=dt(j||void 0);l.useEffect(()=>{t&&x(t)},[t,x]);const r=async()=>{if(b)try{const v=await u.mutateAsync(b.id),S=URL.createObjectURL(v),C=document.createElement("a");C.href=S,C.download=`${b.name.replace(/\s+/g,"-").toLowerCase()}-lo-agent.zip`,document.body.appendChild(C),C.click(),URL.revokeObjectURL(S),document.body.removeChild(C)}catch(v){console.error("Failed to export agent:",v)}},d=()=>{c(!0)},m=()=>{c(!1)},y=v=>{x(v.id),n(v.id,"agents")};return e.jsxs("div",{"data-glass-split":"",className:"panel-flush flex min-h-0 flex-1 overflow-hidden",children:[e.jsx("div",{className:"h-full w-70 shrink-0",children:e.jsx(js,{selectedAgentId:b?.id,onSelectAgent:y})}),e.jsx("div",{"data-glass-region":"canvas-content",className:"panel-top-pad 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(Nt,{title:a("ui.agents.navigation.legacy.title"),icon:qe,subtitle:a("ui.agents.navigation.legacy.subtitle"),children:b&&e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs(Ze,{children:[e.jsx(et,{asChild:!0,children:e.jsx(E,{"data-tour-tag":"upload-to-hub-header-button",variant:"secondary",size:"icon","aria-label":a("ui.agents.navigation.legacy.more_actions"),className:"@min-[400px]:hidden",children:e.jsx(ha,{"aria-hidden":"true"})})}),e.jsxs(tt,{align:"end",className:"min-w-45",children:[e.jsxs(Y,{disabled:u.isPending,onSelect:r,children:[e.jsx(Fe,{"aria-hidden":"true"}),e.jsx("span",{children:a("ui.agents.navigation.legacy.export")})]}),e.jsxs(Y,{onSelect:d,children:[e.jsx(Te,{"aria-hidden":"true"}),e.jsx("span",{children:a("ui.agents.navigation.legacy.upload")})]})]})]}),e.jsxs(E,{variant:"secondary",onClick:r,disabled:u.isPending,className:"hidden @min-[400px]:inline-flex",children:[e.jsx(Fe,{"aria-hidden":"true"}),a("ui.agents.navigation.legacy.export")]}),e.jsxs(E,{"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(Te,{"aria-hidden":"true"}),a("ui.agents.navigation.legacy.upload")]}),e.jsx(W,{content:a("ui.agents.navigation.legacy.chat_named",{name:b.name||a("ui.agents.navigation.legacy.unnamed_agent")}),children:e.jsxs(E,{variant:"primary",onClick:()=>{ft.getState().stageDraft({kind:"agent",name:b.name}),s("/chat")},children:[e.jsx(rt,{"aria-hidden":"true"}),a("ui.agents.navigation.legacy.chat")]})})]})})}),e.jsx("div",{className:"min-h-0 grow overflow-hidden",children:e.jsx(rs,{selectedAgent:b??null,refetchAgent:k,initialSelectedAgentId:t})})]})}),b&&e.jsx(jt,{open:i,onClose:m,agent:b,isAuthenticated:o})]})};export{zs as LegacyAgentsPage};
|
|
33
|
+
`).map(y=>y.trim()).filter(y=>y.length>0),m={stop:d.length>0?d:void 0};await o.mutateAsync({agentId:t.id,update:m}),t.id===c&&i&&await i()}catch{}finally{s(null)}}})]})]})]})]})},ts=["investment","accounting","healthcare","legal","software","security","role_play","personal_assistance","education","marketing","sales","research","analysis","management","social_media","other"],be=t=>a("ui.common.forms.categories_input_chips.category",{category:t==="other"?"other_category":t}),as=({value:t,label:n,onChange:s,placeholder:o=a("ui.common.forms.categories_input_chips.add_category"),disabled:i=!1,icon:c})=>{const u=P(),[x,f]=l.useState(""),[j,b]=l.useState(!1),[k,r]=l.useState(0),d=l.useRef(null),m=l.useRef([]),y=l.useId(),v=l.useId(),S=l.useMemo(()=>{const _=x.trim().toLowerCase();return ts.filter(g=>!t.includes(g)&&(!_||be(g).toLowerCase().includes(_)))},[t,x,u]);l.useEffect(()=>{j&&m.current[k]?.scrollIntoView({block:"nearest"})},[k,j]);const C=_=>{t.includes(_)||s([...t,_]),f(""),b(!1),r(0),d.current?.focus()},q=_=>{f(_.target.value),r(0),b(!0)},N=_=>{const g=S.length;switch(_.key){case"ArrowDown":if(_.preventDefault(),g===0)break;j?r((k+1)%g):(r(0),b(!0));break;case"ArrowUp":if(_.preventDefault(),g===0)break;j?r((k-1+g)%g):(r(g-1),b(!0));break;case"Enter":j&&S[k]&&(_.preventDefault(),C(S[k]));break;case"Escape":j&&(_.preventDefault(),b(!1));break;case"Home":j&&(_.preventDefault(),r(0));break;case"End":j&&(_.preventDefault(),r(S.length-1));break}},T=_=>{s(t.filter(g=>g!==_)),r(0)},L=j&&S[k]?`${v}-option-${k}`:void 0;return e.jsxs("div",{children:[e.jsxs(ce,{htmlFor:y,className:"mb-1.5 flex items-center gap-2 text-ink-muted",children:[c,n]}),e.jsxs("div",{className:$("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",i&&"border-hairline bg-sunken"),children:[t.map(_=>e.jsxs(it,{className:"gap-1 pe-1 text-ink",children:[be(_),e.jsx("button",{type:"button","aria-label":a("ui.common.forms.categories_input_chips.remove_category",{value:be(_)}),disabled:i,onClick:()=>T(_),className:$("rounded-xs text-ink-dim","transition-colors duration-fast ease-out-quart","hover:text-danger disabled:text-ink-disabled"),children:e.jsx(ot,{})})]},_)),e.jsxs(St,{open:j,onOpenChange:b,children:[e.jsx(It,{asChild:!0,children:e.jsx("input",{id:y,ref:d,type:"text",role:"combobox","aria-expanded":j,"aria-controls":v,"aria-autocomplete":"list","aria-activedescendant":L,autoComplete:"off",value:x,placeholder:o,disabled:i,"aria-label":n,onChange:q,onKeyDown:N,onClick:()=>{S.length>0&&b(!0)},className:$("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(Dt,{align:"start",sideOffset:4,onOpenAutoFocus:_=>_.preventDefault(),className:"max-h-60 w-(--radix-popover-trigger-width) overflow-y-auto p-1",children:e.jsx("div",{id:v,role:"listbox","aria-label":n,children:S.map((_,g)=>e.jsx("div",{id:`${v}-option-${g}`,ref:I=>{m.current[g]=I},role:"option","aria-selected":g===k,onMouseDown:I=>{I.preventDefault()},onMouseEnter:()=>r(g),onClick:()=>C(_),className:$("cursor-pointer rounded-sm px-3 py-1.5 font-medium text-body-sm",g===k?"bg-accent-wash":void 0,"text-ink"),children:be(_)},_))})})]})]}),t.length===0&&e.jsx("span",{className:"mt-1 ms-1 block text-ink-dim text-meta",children:a("ui.common.forms.categories_input_chips.no_categories_selected")})]})},ss=({value:t,label:n,onChange:s,placeholder:o=a("ui.common.forms.tags_input_chips.add_tag"),disabled:i=!1,icon:c})=>{P();const[u,x]=l.useState(""),f=l.useRef(null),j=l.useId(),b=m=>{x(m.target.value)},k=()=>{const m=u.trim().toLowerCase();m&&!t.includes(m)&&s([...t,m]),x("")},r=m=>{m.key==="Enter"&&u.trim()?(m.preventDefault(),k()):m.key==="Backspace"&&!u&&t.length>0&&s(t.slice(0,-1))},d=m=>{s(t.filter(y=>y!==m))};return e.jsxs("div",{children:[e.jsxs(ce,{htmlFor:j,className:"mb-1.5 flex items-center gap-2 text-ink-muted",children:[c,n]}),e.jsxs("div",{className:$("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",i&&"border-hairline bg-sunken"),children:[t.map(m=>e.jsxs(it,{className:"gap-1 pe-1 text-ink",children:[m,e.jsx("button",{type:"button","aria-label":a("ui.common.forms.tags_input_chips.remove_tag",{tag:m}),disabled:i,onClick:()=>d(m),className:$("rounded-xs text-ink-dim","transition-colors duration-fast ease-out-quart","hover:text-danger disabled:text-ink-disabled"),children:e.jsx(ot,{})})]},m)),e.jsx("input",{id:j,ref:f,type:"text",value:u,onChange:b,onKeyDown:r,placeholder:o,disabled:i,"aria-label":n,className:$("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")}),u.trim()&&e.jsx(E,{variant:"ghost",size:"icon-sm","aria-label":a("ui.common.forms.tags_input_chips.add_tage0db29"),disabled:i,onClick:()=>{k(),f.current?.focus()},className:"text-accent hover:text-accent",children:e.jsx(lt,{})})]}),t.length===0&&!u&&e.jsx("span",{className:"mt-1 ms-1 block text-ink-dim text-meta",children:a("ui.common.forms.tags_input_chips.no_tags_added")})]})},ns=({selectedAgent:t,savingField:n,setSavingField:s,updateAgentMutation:o,refetchAgent:i,initialSelectedAgentId:c})=>{P();const{data:u,isLoading:x}=ua(),[f,j]=l.useState("");l.useEffect(()=>{!x&&u?.values?j(t.hosting||u.values.hosting||""):x||j(t.hosting||"")},[t,u,x]);const[b,k]=l.useState(!1),[r,d]=l.useState(!1);return e.jsxs("div",{className:"flex flex-col gap-4",children:[e.jsx(ie,{value:t.name,label:a("ui.agents.settings.general.agent_name"),placeholder:a("ui.agents.settings.general.enter_agent_name"),isSaving:n==="name",onSave:async m=>{if(!m.trim()){ue(a("ui.agents.settings.general.error.empty_name"));return}s("name");try{const y={name:m};await o.mutateAsync({agentId:t.id,update:y}),t.id===c&&i&&await i()}catch{}finally{s(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(Bt,{value:t.hosting||(u?.values.hosting??""),isSaving:n==="hosting",onSave:async m=>{s("hosting"),j(m);try{const y={hosting:m,model:""};await o.mutateAsync({agentId:t.id,update:y}),t.id===c&&i&&await i()}catch{j(t.hosting||"")}finally{s(null)}},filterByCredentials:!0,allowDefault:!0},`hosting-select-${t.id}-${t.hosting||(u?.values.hosting??"default")}`)}),e.jsx("div",{"data-tour-tag":"agent-settings-model-select",children:f?e.jsx(Wt,{value:t.hosting?t.model||"":t.model||(u?.values.model_name??""),hostingId:f,isSaving:n==="model",allowDefault:!0,onSave:async m=>{s("model");try{const y={model:m};await o.mutateAsync({agentId:t.id,update:y}),t.id===c&&i&&await i()}catch{}finally{s(null)}}},`model-select-${t.id}-${f}-${t.model||(!t.hosting&&u?.values.model_name?u.values.model_name:"default")}`):e.jsxs("div",{className:"relative",children:[e.jsx(W,{content:a("ui.agents.settings.general.select_a_hosting_provider_first_and_then"),children:e.jsxs("div",{className:"mb-1.5 flex w-fit items-center gap-2 text-body-sm text-ink-muted",children:[e.jsx(Vt,{size:16,"aria-hidden":"true"}),a("ui.agents.settings.general.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:a("ui.agents.settings.general.select_a_hosting_provider_first")})})]})})]}),e.jsxs("h2",{className:"mt-4 flex items-center gap-2 text-heading text-ink",children:[e.jsx(je,{size:16,className:"shrink-0 text-ink-dim"}),a("ui.agents.settings.general.agent_information")]}),e.jsxs("div",{className:"flex flex-col gap-4",children:[e.jsx(ie,{value:t.description||"",label:a("ui.agents.settings.general.description"),placeholder:a("ui.agents.settings.general.enter_agent_description"),multiline:!0,rows:3,isSaving:n==="description",onSave:async m=>{s("description");try{const y={description:m};await o.mutateAsync({agentId:t.id,update:y}),t.id===c&&i&&await i()}catch{}finally{s(null)}}}),e.jsx(ss,{value:t.tags||[],label:a("ui.agents.settings.general.tags"),placeholder:a("ui.agents.settings.general.add_tag"),disabled:b,onChange:async m=>{if(!(Array.isArray(t.tags)&&m.length===t.tags.length&&m.every((y,v)=>y===t.tags?.[v]))){k(!0);try{const y={tags:m};await o.mutateAsync({agentId:t.id,update:y}),t.id===c&&i&&await i()}catch{}finally{k(!1)}}}}),e.jsx(as,{value:t.categories||[],label:a("ui.agents.settings.general.categories"),placeholder:a("ui.agents.settings.general.add_category"),disabled:r,onChange:async m=>{if(!(Array.isArray(t.categories)&&m.length===t.categories.length&&m.every((y,v)=>y===t.categories?.[v]))){d(!0);try{const y={categories:m};await o.mutateAsync({agentId:t.id,update:y}),t.id===c&&i&&await i()}catch{}finally{d(!1)}}}}),e.jsxs(Kt,{children:[e.jsx(De,{label:e.jsxs(e.Fragment,{children:[e.jsx(Ka,{size:12,"aria-hidden":"true"}),a("ui.agents.settings.general.id")]}),value:e.jsx("span",{className:"font-mono text-mono-sm",children:t.id})}),e.jsx(De,{label:e.jsxs(e.Fragment,{children:[e.jsx(Qt,{size:12,"aria-hidden":"true"}),a("ui.agents.settings.general.created")]}),value:da(t.created_date)}),e.jsx(De,{label:e.jsxs(e.Fragment,{children:[e.jsx(Wa,{size:12,"aria-hidden":"true"}),a("ui.agents.settings.general.version")]}),value:t.version})]})]})]})},is=({selectedAgent:t,savingField:n,setSavingField:s,updateAgentMutation:o,refetchAgent:i,initialSelectedAgentId:c})=>(P(),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(Gt,{size:16,className:"shrink-0 text-ink-dim"}),a("ui.agents.settings.security.security_instructions"),e.jsx(W,{content:a("ui.agents.settings.security.security_instructions_that_guide_the_agent_s"),children:e.jsx(E,{variant:"ghost",size:"icon-sm","aria-label":a("ui.agents.settings.security.about_security_instructions"),children:e.jsx(je,{})})})]}),e.jsx("p",{className:"mt-1 max-w-2xl text-body-sm text-ink-muted",children:a("ui.agents.settings.security.this_prompt_is_directed_to_the_ai")}),e.jsx("div",{className:"mt-4",children:e.jsx(ie,{value:t.security_prompt||"",label:"",placeholder:a("ui.agents.settings.security.enter_instructions_for_the_security_agent"),multiline:!0,rows:6,isSaving:n==="security_prompt",onSave:async u=>{s("security_prompt");try{const x={security_prompt:u};await o.mutateAsync({agentId:t.id,update:x}),t.id===c&&i&&await i()}catch{}finally{s(null)}}})})]})),os=({selectedAgent:t,savingField:n,setSavingField:s,refetchAgent:o,initialSelectedAgentId:i})=>{P();const{data:c,isLoading:u}=_t(t.id),x=Ja(t.id),[f,j]=l.useState("");return l.useEffect(()=>{c!==void 0&&j(c)},[c]),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(Na,{size:16,className:"shrink-0 text-ink-dim"}),a("ui.agents.settings.system_prompt.agent_instructions"),e.jsx(W,{content:a("ui.agents.settings.system_prompt.system_instructions_that_define_the_agent_s"),children:e.jsx(E,{variant:"ghost",size:"icon-sm","aria-label":a("ui.agents.settings.system_prompt.about_agent_instructions"),children:e.jsx(je,{})})})]}),e.jsx("p",{className:"mt-1 max-w-2xl text-body-sm text-ink-muted",children:a("ui.agents.settings.system_prompt.define_the_agent_s_role_personality_or")}),e.jsx("div",{className:"mt-4",children:e.jsx(ie,{value:f,label:"",placeholder:u?a("ui.agents.settings.system_prompt.loading_system_prompt"):a("ui.agents.settings.system_prompt.enter_instructions_for_the_agent"),multiline:!0,rows:6,isSaving:n==="system_prompt",onSave:async b=>{s("system_prompt");try{await x.mutateAsync(b),t.id===i&&o&&await o()}finally{s(null)}}})})]})},rs=({selectedAgent:t,refetchAgent:n,initialSelectedAgentId:s})=>{P();const[o,i]=l.useState(null),c=Yt();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(ns,{selectedAgent:t,savingField:o,setSavingField:i,updateAgentMutation:c,refetchAgent:n,initialSelectedAgentId:s}),e.jsx(os,{selectedAgent:t,savingField:o,setSavingField:i,refetchAgent:n,initialSelectedAgentId:s}),e.jsx(is,{selectedAgent:t,savingField:o,setSavingField:i,updateAgentMutation:c,refetchAgent:n,initialSelectedAgentId:s}),e.jsx(es,{selectedAgent:t,savingField:o,setSavingField:i,updateAgentMutation:c,refetchAgent:n,initialSelectedAgentId:s})]})}):e.jsxs("div",{className:"flex h-full flex-col items-center justify-center gap-2 p-8 text-center",children:[e.jsx(qe,{size:48,className:"text-ink-dim","aria-hidden":"true"}),e.jsx("h2",{className:"text-heading text-ink",children:a("ui.agents.settings.agent.no_agent_selected")}),e.jsx("p",{className:"max-w-md text-body-sm text-ink-muted",children:a("ui.agents.settings.agent.select_an_agent_from_the_list_on")})]})})},Re=ba()(fa(t=>({listings:{},remember:(n,s)=>{t(o=>({listings:{...o.listings,[n]:s}}))},forget:n=>{t(s=>{if(!(n in s.listings))return s;const o={...s.listings};return delete o[n],{listings:o}})}}),{name:"published-listings-storage"})),ls=t=>Re(n=>t?n.listings[t]??null:null),cs=400,us=2,ds=t=>[...t].length>=us;function ms(t){if(!t)return{state:"unknown",builtinName:null};if(t.available)return{state:"available",builtinName:null};const n=t.details?.builtin_name??null;return t.code==="name_taken"?{state:"taken",builtinName:null}:t.code==="name_reserved_builtin"?{state:"reserved",builtinName:n}:{state:"unknown",builtinName:null}}const ps=(t,n)=>{const s=t.trim(),o=ct(s,cs),i=n&&o===s&&ds(o)&&ya(o),c=xt({queryKey:["agent-name-availability",o],enabled:i,queryFn:async()=>(await Oe.getAgentNameAvailability(Z.baseUrl,o)).result,retry:!1,staleTime:15e3,refetchOnWindowFocus:!1});return!i||c.isPending?{state:i?"checking":"idle",builtinName:null}:c.isError?{state:"unknown",builtinName:null}:ms(c.data)},gs=()=>{const t=bt();return pt({mutationFn:async({agentId:n,document:s,hubAgentId:o,target:i,policy:c})=>{if(!Z.baseUrl)throw new Error("Local Operator API URL is not configured.");return o?Oe.republishAgentInstructionSet(Z.baseUrl,n,o,s,i,c):Oe.publishAgentInstructionSet(Z.baseUrl,n,s,i,c)},onSuccess:(n,s)=>{const o=n.result;o?.agent_id&&!s.target&&Re.getState().remember(s.agentId,{hubAgentId:o.agent_id,name:o.name,publishedAt:new Date().toISOString()}),o?.local_link_receipt&&t.invalidateQueries({queryKey:Ft}),s.target?Ea(t,s.target.tenantId):Ta(t)},onError:n=>{console.error("Publishing an agent to the hub failed:",n)}})},fe="public",jt=({open:t,onClose:n,agent:s,isAuthenticated:o,onSignInSuccess:i,onPublished:c})=>{const[u,x]=l.useState(!1),[f,j]=l.useState(""),[b,k]=l.useState(null),[r,d]=l.useState(null),[m,y]=l.useState(!1),v=l.useRef(null),S=l.useRef(null),C=ze(),q=gs();P();const[N,T]=l.useState(Pe),L=l.useRef(null),_=l.useRef({open:!1,id:null}),g=ls(s?.id??null),I=_a(),U=ja(I.data,"hub_links"),V=Jt(t&&U),ke=ma(),de=ka(I.data,"radient_org"),ve=La(de),me=o?Pa(de,ke??null):null,{memberships:J,isError:we}=Xt({enabled:t&&o&&ve}),A=l.useMemo(()=>Ca(J),[J]),X=l.useMemo(()=>Sa(J),[J]),[M,pe]=l.useState(fe),h=M!==fe,O=(V.data?.links??[]).filter(p=>p.kind==="agent"&&p.local_id===s?.id),D=O.find(p=>p.visibility===(h?"org":"public")&&p.tenant_id===(h?M:null)),H=O.find(p=>p.link_id!==D?.link_id),Q=V.data?.unresolved.some(p=>p.kind==="agent"&&p.local_id===s?.id),B=A.find(p=>p.tenant_id===M),ge=h?B?.tenant_name?a("ui.hub.links.source_private",{organization:B.tenant_name}):a("ui.hub.links.source_unavailable"):a("ui.hub.links.source_public"),re=A.find(p=>p.tenant_id===M)?.tenant_name||"this organization",he=l.useId(),xe=l.useId(),{data:$e}=_t(t&&s?s.id:""),{data:Me}=pa(t);l.useEffect(()=>{t&&(!_.current.open||_.current.id!==(s?.id??null))&&j(s?.name??""),_.current={open:t,id:s?.id??null}},[t,s?.id,s?.name]),l.useEffect(()=>{t||(x(!1),k(null),d(null),y(!1),pe(fe),T(Pe()),L.current=null)},[t]);const kt=l.useMemo(()=>(Me??[]).filter(p=>p.source==="builtin").map(p=>p.name),[Me]),He=Oa(f,kt),Be=ps(f,t&&o),ee=l.useMemo(()=>{const p=qa({name:f,description:s?.description??"",instructions:$e??null,tools:Ua(s?.tags)});return He&&p.unshift({field:"name",message:Je({code:"name_reserved_builtin",message:""},{name:f,hubAgentId:null}).body}),p},[f,s?.description,s?.tags,$e,He]),z=b?Je(b,{name:f,hubAgentId:g?.hubAgentId??null}):null,te=q.isPending,Ne=async p=>{if(!s||te||ee.length>0||h&&!B)return;k(null);const R=p?.asNewListing?null:D?.hub_id??(h?null:g?.hubAgentId??null),Ve=!!R;if(!(U&&(!V.isSuccess||H||Q)))try{const G={name:f.trim()},Ke=JSON.stringify({agent:s.id,document:G,hubAgentId:R,target:M,policy:D?null:N}),Ce=L.current?.tuple===Ke?L.current:{tuple:Ke,id:crypto.randomUUID()};L.current=Ce;const ae=(await q.mutateAsync({agentId:s.id,document:G,hubAgentId:R,...U?{policy:D?{requestId:Ce.id,...D.remote_revision&&Ve?{expectedRemoteRevision:D.remote_revision}:{}}:{requestId:Ce.id,...N}}:{},target:h?{visibility:"org",tenantId:M}:void 0})).result,Qe={name:ae?.name??f.trim(),hubAgentId:ae?.agent_id??null,republished:Ve,orgName:h?re:null,localPolicies:ae?.local_link_receipt?Da(ae)?"complete":"pending":U?"pending":null};d(Qe),ae&&c?.(ae,Qe.republished)}catch(G){k(ga(G)?{code:G.code,message:G.message,details:G.details}:{message:va(G,"The agent could not be published. Try again.")})}},We=p=>{switch(p){case"focus-name":k(null),requestAnimationFrame(()=>{v.current?.focus(),v.current?.select()});break;case"update-listing":{const R=b?.details?.existing_agent_id??g?.hubAgentId;R&&(n(),C(`/agent-hub/${R}`));break}case"install-builtin":{const R=b?.details?.builtin_name??Be.builtinName;R&&(n(),C(`/agents?kind=agent&name=${encodeURIComponent(R)}`));break}case"edit-instructions":case"edit-agent":s&&(n(),C(`/agents/${s.id}`));break;case"publish-as-new":s&&Re.getState().forget(s.id),Ne({asNewListing:!0});break;case"sign-in":y(!0);break;case"refresh-hub":n(),C("/agent-hub");break;case"retry":Ne();break}},K=s?.name??"",vt=r?r.orgName?`Published "${K}" to ${r.orgName}`:r.republished?`Updated the Agent Hub listing for "${K}"`:`Published "${K}" to the Agent Hub`:h?`Publish "${K}" to ${re}?`:g?`Update the Agent Hub listing for "${K}"?`:`Publish "${K}" to the Agent Hub?`;l.useLayoutEffect(()=>{!b&&!r||S.current?.focus()},[b,r]);const wt=r?e.jsxs(e.Fragment,{children:[e.jsx(ne,{onClick:n,"data-tour-tag":"upload-agent-dialog-cancel-button",children:a("ui.common.actions.close")}),r.hubAgentId&&e.jsx(_e,{onClick:()=>{n(),C(`/agent-hub/${r.hubAgentId}`)},children:a("ui.agents.upload.action.open_listing")})]}):z?e.jsxs(e.Fragment,{children:[e.jsx(ne,{onClick:n,"data-tour-tag":"upload-agent-dialog-cancel-button",children:a("ui.common.actions.close")}),z.actions.map((p,R)=>R===0?e.jsx(_e,{onClick:()=>We(p),disabled:te,children:Xe[p]},p):e.jsx(ne,{onClick:()=>We(p),disabled:te,children:Xe[p]},p))]}):e.jsxs(e.Fragment,{children:[e.jsx(ne,{onClick:n,"data-tour-tag":"upload-agent-dialog-cancel-button",children:a("ui.common.actions.cancel")}),ee.some(p=>p.field!=="name")&&e.jsx(ne,{onClick:()=>{s&&(n(),C(`/agents/${s.id}`))},children:a("ui.agents.upload.action.edit_agent")}),o&&e.jsx(_e,{"data-testid":"publish-submit",onClick:()=>void Ne(),disabled:h&&!B||!u||ee.length>0||!f.trim()||te||U&&(!V.isSuccess||!!H||!!Q),children:te?"Publishing…":g&&!h?"Update listing":"Publish"})]});return e.jsx(gt,{open:t,onClose:n,title:vt,maxWidth:"sm",fullWidth:!0,actions:wt,dataTourTag:"upload-agent-dialog",dialogProps:{className:"outline-none"},children:e.jsxs("div",{ref:S,tabIndex:b||r?-1:void 0,className:$("flex flex-col gap-4",(b||r)&&"outline-none"),children:[o?r?e.jsxs(ye,{variant:"success","aria-live":"polite",children:[e.jsx(Se,{children:r.orgName?`Published to ${r.orgName}`:r.republished?"Listing updated":"Published to the hub"}),e.jsx(le,{children:r.orgName?`"${r.name}" is in ${r.orgName}'s shared agents as an instruction set. Its members can read and install it; nobody outside the organization can.`:r.republished?a("ui.agents.upload.published.republished",{name:r.name}):a("ui.agents.upload.published.listed",{name:r.name})}),e.jsx(le,{className:"text-ink-muted",children:a("ui.agents.upload.sign_in.nothing_left")})]}):z&&b?e.jsxs(ye,{variant:z.variant,role:"alert",children:[e.jsx(Se,{children:z.headline}),e.jsx(le,{children:z.body}),z.note&&e.jsx(le,{className:"text-ink-muted",children:z.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:a("ui.agents.upload.sign_in.needed")}),e.jsx(Fe,{titleText:"Sign in to continue",descriptionText:"",onSignInSuccess:i})]}),z&&m&&e.jsxs("div",{className:"flex flex-col items-center gap-6 text-center",children:[e.jsx("p",{className:"text-body text-ink",children:a("ui.agents.upload.sign_in.reauthenticate")}),e.jsx(Fe,{titleText:"Sign in again",descriptionText:"",onSignInSuccess:()=>{y(!1),k(null),i?.()}})]}),r?.localPolicies==="pending"&&e.jsx("p",{role:"alert",className:"text-body-sm text-warning",children:a("ui.hub.skills.policy_pending")}),!r&&U&&e.jsx("div",{className:"flex flex-col gap-3",children:V.isLoading?e.jsx("p",{className:"text-meta text-ink-muted",children:a("ui.hub.links.loading")}):V.error?e.jsx("p",{role:"alert",className:"text-body-sm text-warning",children:a("ui.hub.links.load_failed")}):H?e.jsx("p",{className:"text-body-sm text-warning",children:a("ui.hub.subscriptions.source_separation",{currentSource:Zt(H),newSource:ge})}):Q?e.jsx("p",{className:"text-body-sm text-warning",children:a("ui.hub.links.source_unavailable")}):D?e.jsx(At,{link:D}):e.jsx(Ia,{value:N,onChange:T,source:ge,item:f||K,visibility:h?"org":"public",organization:h?re:null,destinationKey:`${M}:${s?.id??""}`,canEnableAutoPush:!1,disabled:te||!V.isSuccess})}),!r&&!z&&e.jsxs(e.Fragment,{children:[e.jsx("p",{className:"text-body text-ink",children:h?`You are about to publish this agent's instruction set into ${re}, where only its members can read and install it. What is published is what describes the agent:`:"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 ps-5 text-body text-ink-muted",children:[e.jsx("li",{children:a("ui.agents.upload.list.name")}),e.jsx("li",{children:a("ui.agents.upload.list.instructions")}),e.jsx("li",{children:a("ui.agents.upload.list.surface")})]}),e.jsx("p",{className:"text-body text-ink",children:h?`Nothing else leaves this machine: no conversation, no execution history, no memory or learnings, no plan, and no machine-specific configuration. ${re}'s members can read and install what you publish; nobody outside it can.`:"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."}),A.length>0||X.length>0?e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(ce,{htmlFor:`${he}-target`,children:a("ui.agents.upload.target.label")}),e.jsxs(Pt,{value:M,onValueChange:p=>{pe(p),T(Pe()),L.current=null},children:[e.jsx(Lt,{id:`${he}-target`,className:"w-full","data-testid":"publish-target",children:e.jsx(Et,{})}),e.jsxs(Tt,{children:[e.jsx(Ie,{value:fe,children:a("ui.hub.pages.scope.public")}),A.map(p=>e.jsx(Ie,{value:p.tenant_id,children:p.tenant_name||"Organization"},p.tenant_id)),X.map(p=>e.jsxs(Ie,{value:p.tenant_id,disabled:!0,children:[p.tenant_name||a("ui.hub.pages.scope.org_label")," ",a("ui.agents.upload.target.upgrade")]},p.tenant_id))]})]}),e.jsx("p",{className:"text-meta text-ink-muted","data-testid":"publish-target-hint",children:X.length>0?`Sharing agents inside an organization is part of the Team plan. An owner of ${X.length===1?X[0].tenant_name||"this organization":"any of the organizations marked above"} can activate it in the Radient console.`:"Public hub publications are readable by anyone. An organization's agents are readable by its members only."})]}):me?e.jsx("p",{className:"text-meta text-ink-muted","data-testid":"publish-target-unavailable",children:me}):we?e.jsx("p",{className:"text-meta text-ink-muted","data-testid":"publish-target-failed",children:a("ui.agents.upload.target.orgs_unread")}):null,ee.length>0&&e.jsxs(ye,{variant:"danger",children:[e.jsx(Se,{children:a("ui.agents.upload.error.cannot_publish")}),e.jsx("ul",{className:"list-disc space-y-1 ps-5",children:ee.map(p=>e.jsx("li",{children:p.message},`${p.field}:${p.message}`))})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(ce,{htmlFor:xe,children:a("ui.agents.upload.field.name_label")}),e.jsx(nt,{id:xe,ref:v,value:f,onChange:p=>j(p.target.value),autoComplete:"off",spellCheck:!1,"aria-invalid":ee.some(p=>p.field==="name"),"aria-describedby":`${xe}-hint`}),e.jsx("p",{id:`${xe}-hint`,className:"text-meta text-ink-muted",children:a("ui.agents.upload.field.name_hint")}),!h&&hs(Be)]}),e.jsxs("div",{className:"flex gap-3",children:[e.jsx("span",{className:"flex h-5 shrink-0 items-center",children:e.jsx(Ot,{id:he,name:"termsAgreement","data-testid":"publish-consent",checked:u,onCheckedChange:p=>x(p===!0)})}),e.jsxs(ce,{htmlFor:he,className:"block font-normal text-body text-ink",children:[a("ui.agents.upload.terms.lead")," ",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:a("ui.agents.upload.terms.link")})," ",a("ui.agents.upload.terms.tail")]})]})]}),(r||z)&&K&&e.jsxs("p",{className:"text-meta text-ink-muted",children:[a("ui.agents.upload.availability.agent_label")," ",K]})]})})},hs=t=>{switch(t.state){case"checking":return e.jsx("p",{className:"text-meta text-ink-muted",children:a("ui.agents.upload.availability.checking")});case"available":return e.jsx("p",{className:"text-meta text-ink-muted",children:a("ui.agents.upload.availability.free")});case"taken":return e.jsx("p",{className:"text-meta text-ink",children:a("ui.agents.upload.availability.taken")});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}},xs=1200,bs=({agent:t,isSelected:n,onSelectAgent:s,onChatWithAgent:o,onExportAgent:i,onAgentDeleted:c,onUploadAgentToHub:u})=>{P();const x=t.description||a("ui.agents.navigation.sidebar.no_description");return e.jsxs("li",{className:"group relative",children:[e.jsxs("button",{type:"button",onClick:()=>s(t),"aria-current":n?"true":void 0,"data-tour-tag":"agent-list-item-button",className:$("flex w-full items-center gap-2 rounded-sm py-1.5 pe-9 ps-2 text-start","transition-colors duration-fast ease-out-quart",n?ta:"hover:bg-row-hover"),children:[e.jsx(Ut,{className:"size-8 shrink-0",children:e.jsx(zt,{className:"border border-control bg-sunken",children:e.jsx(qe,{size:16,"aria-hidden":!0})})}),e.jsxs("span",{className:"min-w-0 flex-1",children:[e.jsx(W,{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(W,{content:x,side:"bottom",align:"start",children:e.jsx("span",{className:"block truncate text-meta text-ink-dim",children:x})})]})]}),e.jsx("div",{className:$("pointer-events-none absolute top-0 end-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(W,{content:a("ui.agents.navigation.sidebar.options"),children:e.jsx("span",{children:e.jsx(Ya,{agentId:t.id,agentName:t.name,isAgentsPage:!0,onAgentDeleted:()=>c(t.id),onChatWithAgent:()=>o(t),onExportAgent:()=>i(t.id),onUploadAgentToHub:()=>u(t),buttonSx:{width:24,height:24,borderRadius:"6px",display:"flex",justifyContent:"center",alignItems:"center"}})})})})]})},fs=(t,n)=>t.isSelected===n.isSelected&&t.agent.id===n.agent.id&&t.agent.name===n.agent.name&&t.agent.description===n.agent.description&&t.onSelectAgent===n.onSelectAgent&&t.onChatWithAgent===n.onChatWithAgent&&t.onExportAgent===n.onExportAgent&&t.onAgentDeleted===n.onAgentDeleted&&t.onUploadAgentToHub===n.onUploadAgentToHub,ys=l.memo(bs,fs),_s=({selectedAgentId:t,onSelectAgent:n})=>{const s=ze();P();const[o,i]=l.useState(""),c=wa(h=>h.openCreateAgentDialog),u=ct(o.trim(),250),[x,f]=l.useState(!1),j=50,[b,k]=l.useState(!1),[r,d]=l.useState(null),{isAuthenticated:m}=ht(),y=l.useMemo(()=>Ue(Z.baseUrl),[]),v=ut(),{page:S,setPage:C}=Xa(),{data:q,isLoading:N,isError:T,refetch:L}=ea(S,j,0,u||void 0,"created_date","desc"),_=q?.agents||[],g=q?.total||0,{data:I}=dt(t&&!_.find(h=>h.id===t)?t:void 0),U=l.useMemo(()=>{const h=[..._];return I&&!h.find(O=>O.id===I.id)&&h.push(I),h.sort((O,D)=>new Date(D.created_date).getTime()-new Date(O.created_date).getTime()),h},[_,I]),V=l.useCallback(h=>{C(h)},[C]),ke=l.useCallback(h=>{n(h)},[n]),de=l.useCallback(()=>{f(!0)},[]),ve=l.useCallback(()=>{f(!1)},[]),me=l.useCallback(async h=>{try{const O=await v.mutateAsync(h),D=U.find(ge=>ge.id===h),H=D?D.name.replace(/\s+/g,"-").toLowerCase():h,Q=URL.createObjectURL(O),B=document.createElement("a");B.href=Q,B.download=`${H}-export.zip`,document.body.appendChild(B),B.click(),URL.revokeObjectURL(Q),document.body.removeChild(B)}catch(O){console.error("Failed to export agent:",O)}},[U,v]),J=l.useCallback(h=>{d(h),k(!0)},[]),we=l.useCallback(()=>{k(!1),d(null)},[]),A=l.useCallback(async h=>{try{const D=((await L()).data?.agents||[]).find(Q=>Q.id===h);if(D){n(D);return}const H=await y.agents.getAgent(h);H.status<400&&H.result&&n(H.result)}catch(O){console.error("Error selecting newly created agent:",O)}},[n,L,y]),X=l.useCallback(h=>{ft.getState().stageDraft({kind:"agent",name:h.name}),s("/chat")},[s]),M=l.useCallback(h=>{L(),s("/agents")},[t,L,s]),pe=l.useCallback(h=>{J(h)},[J]);return e.jsxs("div",{"data-glass-region":"page-sidebar",className:"panel-top-pad flex h-full w-full flex-col overflow-hidden bg-surface",children:[e.jsx(Aa,{title:a("ui.agents.navigation.sidebar.title"),searchQuery:o,onSearchChange:h=>i(h),onNewAgentClick:c,onImportAgentClick:de,importAgentTooltip:a("ui.agents.navigation.sidebar.import_hint")}),N?e.jsx("div",{className:"flex flex-1 items-center justify-center",children:e.jsx(st,{size:"lg",label:a("ui.agents.navigation.sidebar.loading")})}):T?e.jsxs(ye,{variant:"danger",role:"alert",className:"m-4 w-auto",children:[e.jsx(le,{children:a("ui.agents.navigation.sidebar.error")}),e.jsx(E,{variant:"ghost",size:"sm",className:"self-start",onClick:()=>L(),children:a("ui.agents.navigation.sidebar.retry")})]}):U.length===0&&!N?e.jsx("p",{className:"p-6 text-center text-body-sm text-ink-muted",children:o?a("ui.agents.navigation.sidebar.search_empty"):a("ui.agents.navigation.sidebar.empty")}):e.jsx(qt,{delayDuration:xs,skipDelayDuration:0,children:e.jsx("ul",{className:"flex min-h-0 flex-1 flex-col gap-1 overflow-y-auto p-2",children:U.map(h=>e.jsx(ys,{agent:h,isSelected:t===h.id||I?.id===h.id,onSelectAgent:ke,onChatWithAgent:X,onExportAgent:me,onAgentDeleted:M,onUploadAgentToHub:pe},h.id))})}),e.jsx(Za,{open:x,onClose:ve,onAgentImported:A}),g>0&&e.jsx(Fa,{page:S,count:Math.max(1,Math.ceil(g/j)),onChange:V}),e.jsx(jt,{open:b,onClose:we,agent:r,isAuthenticated:m})]})},js=l.memo(_s),Us=()=>{P();const{agentId:t,navigateToAgent:n}=aa(),s=ze(),{isAuthenticated:o}=ht(),[i,c]=l.useState(!1),u=ut(),{setLastAgentsPageAgentId:x,getLastAgentId:f}=mt(),j=t||f("agents"),{data:b,refetch:k}=dt(j||void 0);l.useEffect(()=>{t&&x(t)},[t,x]);const r=async()=>{if(b)try{const v=await u.mutateAsync(b.id),S=URL.createObjectURL(v),C=document.createElement("a");C.href=S,C.download=`${b.name.replace(/\s+/g,"-").toLowerCase()}-lo-agent.zip`,document.body.appendChild(C),C.click(),URL.revokeObjectURL(S),document.body.removeChild(C)}catch(v){console.error("Failed to export agent:",v)}},d=()=>{c(!0)},m=()=>{c(!1)},y=v=>{x(v.id),n(v.id,"agents")};return e.jsxs("div",{"data-glass-split":"",className:"panel-flush flex min-h-0 flex-1 overflow-hidden",children:[e.jsx("div",{className:"h-full w-70 shrink-0",children:e.jsx(js,{selectedAgentId:b?.id,onSelectAgent:y})}),e.jsx("div",{"data-glass-region":"canvas-content",className:"panel-top-pad 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(Nt,{title:a("ui.agents.navigation.legacy.title"),icon:qe,subtitle:a("ui.agents.navigation.legacy.subtitle"),children:b&&e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs(Ae,{children:[e.jsx(et,{asChild:!0,children:e.jsx(E,{"data-tour-tag":"upload-to-hub-header-button",variant:"secondary",size:"icon","aria-label":a("ui.agents.navigation.legacy.more_actions"),className:"@min-[400px]:hidden",children:e.jsx(ha,{"aria-hidden":"true"})})}),e.jsxs(tt,{align:"end",className:"min-w-45",children:[e.jsxs(F,{disabled:u.isPending,onSelect:r,children:[e.jsx(Ye,{"aria-hidden":"true"}),e.jsx("span",{children:a("ui.agents.navigation.legacy.export")})]}),e.jsxs(F,{onSelect:d,children:[e.jsx(Te,{"aria-hidden":"true"}),e.jsx("span",{children:a("ui.agents.navigation.legacy.upload")})]})]})]}),e.jsxs(E,{variant:"secondary",onClick:r,disabled:u.isPending,className:"hidden @min-[400px]:inline-flex",children:[e.jsx(Ye,{"aria-hidden":"true"}),a("ui.agents.navigation.legacy.export")]}),e.jsxs(E,{"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(Te,{"aria-hidden":"true"}),a("ui.agents.navigation.legacy.upload")]}),e.jsx(W,{content:a("ui.agents.navigation.legacy.chat_named",{name:b.name||a("ui.agents.navigation.legacy.unnamed_agent")}),children:e.jsxs(E,{variant:"primary",onClick:()=>{ft.getState().stageDraft({kind:"agent",name:b.name}),s("/chat")},children:[e.jsx(rt,{"aria-hidden":"true"}),a("ui.agents.navigation.legacy.chat")]})})]})})}),e.jsx("div",{className:"min-h-0 grow overflow-hidden",children:e.jsx(rs,{selectedAgent:b??null,refetchAgent:k,initialSelectedAgentId:t})})]})}),b&&e.jsx(jt,{open:i,onClose:m,agent:b,isAuthenticated:o})]})};export{Us as LegacyAgentsPage};
|