local-operator-ui 0.15.2 → 0.17.0

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.
Files changed (74) hide show
  1. package/out/main/index.js +199 -29
  2. package/out/preload/index.js +6 -0
  3. package/out/renderer/assets/{_basePickBy-CefSvQ3Q.js → _basePickBy-BJr_fQtB.js} +1 -1
  4. package/out/renderer/assets/{_baseUniq-DlDqTbuA.js → _baseUniq-CYir-14_.js} +1 -1
  5. package/out/renderer/assets/{agent-details-page-BCuUg55n.js → agent-details-page-D6PQzszA.js} +7 -2
  6. package/out/renderer/assets/{agent-hub-page-BqCCuxo-.js → agent-hub-page-BU8BMGm-.js} +3 -3
  7. package/out/renderer/assets/agents-page-3jWcFYcZ.js +2 -0
  8. package/out/renderer/assets/{architectureDiagram-IEHRJDOE-CUlo4ACF.js → architectureDiagram-IEHRJDOE-CCErX8Tf.js} +1 -1
  9. package/out/renderer/assets/{blockDiagram-JOT3LUYC-nU3IOM88.js → blockDiagram-JOT3LUYC-CUvjtfSj.js} +1 -1
  10. package/out/renderer/assets/{c4Diagram-VJAJSXHY-MT0nxa4-.js → c4Diagram-VJAJSXHY-VeJwMCKK.js} +1 -1
  11. package/out/renderer/assets/channel-BtWQQlRJ.js +1 -0
  12. package/out/renderer/assets/{chunk-4BMEZGHF-CXkPsNEi.js → chunk-4BMEZGHF-3Bq4xtvZ.js} +1 -1
  13. package/out/renderer/assets/{chunk-A2AXSNBT-DiTT6jkA.js → chunk-A2AXSNBT-B3y7xV7i.js} +1 -1
  14. package/out/renderer/assets/{chunk-AEK57VVT-CIZ7-t01.js → chunk-AEK57VVT-EVfEpH4f.js} +1 -1
  15. package/out/renderer/assets/{chunk-D6G4REZN-BIKuFzEX.js → chunk-D6G4REZN-DMvU3WoU.js} +1 -1
  16. package/out/renderer/assets/{chunk-RZ5BOZE2-byZRPh67.js → chunk-RZ5BOZE2-IvUVaxD4.js} +1 -1
  17. package/out/renderer/assets/{chunk-XZIHB7SX-BM-t-ERh.js → chunk-XZIHB7SX-qRGLrBmi.js} +1 -1
  18. package/out/renderer/assets/classDiagram-GIVACNV2-C298zC-3.js +1 -0
  19. package/out/renderer/assets/classDiagram-v2-COTLJTTW-C298zC-3.js +1 -0
  20. package/out/renderer/assets/clone-dCQCshht.js +1 -0
  21. package/out/renderer/assets/compact-pagination-C9MHaQh8.js +1 -0
  22. package/out/renderer/assets/{dagre-OKDRZEBW-DU9huU8P.js → dagre-OKDRZEBW-mkOM0foV.js} +1 -1
  23. package/out/renderer/assets/{diagram-SSKATNLV-C6KmXMQc.js → diagram-SSKATNLV-nPhdvd43.js} +1 -1
  24. package/out/renderer/assets/{diagram-VNBRO52H-B2c-8R3S.js → diagram-VNBRO52H-DwSuRePG.js} +1 -1
  25. package/out/renderer/assets/{erDiagram-Q7BY3M3F-D6QA70K4.js → erDiagram-Q7BY3M3F-H_hDC8d0.js} +1 -1
  26. package/out/renderer/assets/{flowDiagram-4HSFHLVR-Dk0lRNK2.js → flowDiagram-4HSFHLVR-COn1sttR.js} +1 -1
  27. package/out/renderer/assets/{ganttDiagram-APWFNJXF-BevHed3v.js → ganttDiagram-APWFNJXF-DbxYzA4C.js} +1 -1
  28. package/out/renderer/assets/{gitGraphDiagram-7IBYFJ6S-CmOfsj5i.js → gitGraphDiagram-7IBYFJ6S-GJA88tpY.js} +1 -1
  29. package/out/renderer/assets/{graph-CUJVKfm_.js → graph-CDkZGsbw.js} +1 -1
  30. package/out/renderer/assets/{icon-BIaTDBQz.js → icon-D9xnujmI.js} +32 -27
  31. package/out/renderer/assets/icon-DM6KYqqV.css +1 -0
  32. package/out/renderer/assets/{index-DZnGa8Vt.js → index-CVSo1eIn.js} +317 -314
  33. package/out/renderer/assets/{index-Eh3n7DJx.js → index-Coj74S4F.js} +1 -1
  34. package/out/renderer/assets/{index-8mt-yi7u.js → index-DyRL2cJn.js} +1 -1
  35. package/out/renderer/assets/index-aW0Bo_1a.css +1 -0
  36. package/out/renderer/assets/{infoDiagram-PH2N3AL5-DWdIO3pN.js → infoDiagram-PH2N3AL5-DCDmAfuD.js} +1 -1
  37. package/out/renderer/assets/installer-JsKFFZ0N.js +16 -0
  38. package/out/renderer/assets/{journeyDiagram-U35MCT3I-BNOCDq91.js → journeyDiagram-U35MCT3I-D5zuKm0h.js} +1 -1
  39. package/out/renderer/assets/{kanban-definition-NDS4AKOZ-CIVzZzmM.js → kanban-definition-NDS4AKOZ-D28NqnN2.js} +1 -1
  40. package/out/renderer/assets/{layout-zNSVRDKv.js → layout-B__Skqp8.js} +1 -1
  41. package/out/renderer/assets/legacy-agents-page-d_nYp_Kx.js +43 -0
  42. package/out/renderer/assets/{mermaid.core-CFY9BM3R.js → mermaid.core-BHfHBA6R.js} +5 -5
  43. package/out/renderer/assets/{mindmap-definition-ALO5MXBD-yS5L1WQ2.js → mindmap-definition-ALO5MXBD-DKRrQTAb.js} +1 -1
  44. package/out/renderer/assets/{page-header-GWjqQg3-.js → page-header-JYwkpfbT.js} +1 -1
  45. package/out/renderer/assets/{parseISO-DIyaQXAe.js → parseISO-D2eiqdi5.js} +2 -2
  46. package/out/renderer/assets/{pieDiagram-IB7DONF6-BPWYAs8_.js → pieDiagram-IB7DONF6-B1BtzilZ.js} +1 -1
  47. package/out/renderer/assets/{quadrantDiagram-7GDLP6J5-B82PFOoq.js → quadrantDiagram-7GDLP6J5-2ZnW_kzE.js} +1 -1
  48. package/out/renderer/assets/{radar-MK3ICKWK-Z4U7o29x.js → radar-MK3ICKWK-BxdSoZJX.js} +1 -1
  49. package/out/renderer/assets/radient-auth-buttons-Bi1-KXYI.js +6 -0
  50. package/out/renderer/assets/{requirementDiagram-KVF5MWMF-BwhazqTR.js → requirementDiagram-KVF5MWMF-6W-9ZOiF.js} +1 -1
  51. package/out/renderer/assets/{sankeyDiagram-QLVOVGJD-Cg4M6UvE.js → sankeyDiagram-QLVOVGJD-DsCO-xHN.js} +1 -1
  52. package/out/renderer/assets/{schedules-page-ChiypWrp.js → schedules-page-BGkrdg_o.js} +1 -1
  53. package/out/renderer/assets/{sequenceDiagram-X6HHIX6F-hTniLZHQ.js → sequenceDiagram-X6HHIX6F-DTsOsVHj.js} +1 -1
  54. package/out/renderer/assets/{settings-page-CKzoAptg.js → settings-page-UqW8Dofa.js} +2 -2
  55. package/out/renderer/assets/{square-pen-sK57wlY1.js → square-pen-DOIqaj9i.js} +2 -2
  56. package/out/renderer/assets/{stateDiagram-DGXRK772-DI0pBdbL.js → stateDiagram-DGXRK772-Hgu5z66Y.js} +1 -1
  57. package/out/renderer/assets/stateDiagram-v2-YXO3MK2T-BrBwSEFe.js +1 -0
  58. package/out/renderer/assets/{timeline-definition-BDJGKUSR-t0KbQhGu.js → timeline-definition-BDJGKUSR-BkaQadIG.js} +1 -1
  59. package/out/renderer/assets/use-agent-like-mutation-BSrvgpki.js +1 -0
  60. package/out/renderer/assets/{xychartDiagram-VJFVF3MP-BQjVqv5u.js → xychartDiagram-VJFVF3MP-DuWwCccB.js} +1 -1
  61. package/out/renderer/index.html +21 -6
  62. package/out/renderer/installer.html +3 -3
  63. package/package.json +2 -2
  64. package/out/renderer/assets/agents-page-DG4vCZu3.js +0 -18
  65. package/out/renderer/assets/channel-CCadi6VR.js +0 -1
  66. package/out/renderer/assets/classDiagram-GIVACNV2-Bkvtrmw4.js +0 -1
  67. package/out/renderer/assets/classDiagram-v2-COTLJTTW-Bkvtrmw4.js +0 -1
  68. package/out/renderer/assets/clone-DTDvO4Il.js +0 -1
  69. package/out/renderer/assets/icon-CtRkDz9c.css +0 -1
  70. package/out/renderer/assets/index-DikLkf3S.css +0 -1
  71. package/out/renderer/assets/installer-DYZ22Cfq.js +0 -21
  72. package/out/renderer/assets/settings-section-yqdH5CNp.js +0 -6
  73. package/out/renderer/assets/stateDiagram-v2-YXO3MK2T-CG5hsBHO.js +0 -1
  74. package/out/renderer/assets/use-agent-like-mutation-C_nJtNuz.js +0 -1
@@ -1,4 +1,4 @@
1
- import{c as me,r as T,j as m,B as V,S as Ge,y as Im,z as In,g as ie,F as J,i as j,f as Mm,I as Yu,q as Ae,G as bt,T as Zu,J as $m,K as Nm,M as Rm,N as Dm,O as Ju,X as cf,n as Lr,L as mt,Q as Dx,a as Nt,U as qm,V as qx,s as Lx,W as Bx,Y as Fx,C as zx,e as Lm}from"./icon-BIaTDBQz.js";import{aL as Wx,aM as lf,aN as ff,ag as Ux,n as Sn,ah as Bm,ai as pl,K as Fm,q as zm,r as Kx,M as Gx,ac as Hx,aO as Vx,aP as Ct,aQ as hl,aR as Wm,a6 as Xx,aS as df,aT as Yx,aU as nr,aV as Um,aW as Km,aX as Gm,aY as Zx,aZ as Jx,a_ as Un,U as Hm,a$ as Vm,b0 as Br,a9 as Qx,b1 as Xm,b2 as e0,am as t0,b3 as Ym,u as r0,b4 as Zm,a8 as Jm,b5 as n0,b6 as a0,R as i0,b7 as Qm,at as Qu,an as o0,b8 as s0,b9 as u0,ba as c0,bb as l0,bc as f0,bd as d0,be as p0,al as pf,bf as h0,ak as hf,bg as v0,bh as y0,ao as m0,ap as g0,aj as ni,bi as b0,bj as x0,bk as w0,bl as O0,bm as S0}from"./index-DZnGa8Vt.js";import{P as A0}from"./page-header-GWjqQg3-.js";import{S as _e,I as vl,a as Ie,N as P0}from"./settings-section-yqdH5CNp.js";import{S as _0}from"./square-pen-sK57wlY1.js";import{a as j0,P as Q,H as E0,p as ai}from"./parseISO-DIyaQXAe.js";import{w as eg,n as tg,M as yl,a as de,S as T0,T as C0,l as rg,b as He,t as Ea,p as ec,s as Kn,c as ng,F as k0,G as I0,H as M0,I as $0,J as N0,K as R0,L as D0,N as q0,O as L0,k as B0,P as F0,Q as z0}from"./step-DMJAOHzS.js";import{b as tc,p as Fr}from"./band-CquvqAHh.js";import{d as Gn,n as W0,e as U0,i as ml,f as rc,g as zt,h as gl,a as bl,j as vf,k as K0,m as G0,o as at,c as H0,p as Ta,q as ag,l as nc,r as V0}from"./linear-BfLTrHPc.js";import{m as yf,a as mf,p as X0,q as Y0,u as Z0,s as J0,r as Q0,v as ew,w as tw,x as rw,y as nw,z as aw,A as iw,B as ow,t as sw}from"./time-BOTM2Tp0.js";import{i as wt,a as lt}from"./init-Dmth1JHB.js";import{i as uw,o as cw}from"./ordinal-DILIJJjt.js";/**
1
+ import{a as me,r as T,j as m,B as V,S as Ge,G as Im,J as In,h as ie,K as J,m as j,g as Mm,t as Yu,A as Ae,I as bt,T as Zu,M as $m,N as Nm,O as Rm,Q as Dm,U as Ju,X as cf,u as Lr,L as mt,V as Dx,c as Nt,Y as qm,x as qx,z as Lx,Z as Bx,_ as Fx,i as zx,f as Lm}from"./icon-D9xnujmI.js";import{aX as Wx,aY as lf,aZ as ff,az as Ux,g as Sn,aA as Bm,aB as pl,a1 as Fm,f as zm,M as Kx,a2 as Gx,ao as Hx,a_ as Vx,a$ as Ct,b0 as hl,b1 as Wm,ai as Xx,b2 as df,b3 as Yx,j as nr,b as Um,d as Km,b4 as Gm,aF as Zx,b5 as Jx,b6 as Un,a8 as Hm,b7 as Vm,b8 as Br,al as Qx,b9 as Xm,ba as e0,P as t0,bb as Ym,J as r0,bc as Zm,ak as Jm,bd as n0,a6 as a0,be as Qm,aO as Qu,aI as i0,bf as o0,i as s0,bg as u0,aD as c0,bh as l0,bi as f0,bj as d0,av as pf,bk as p0,aH as hf,bl as h0,bm as v0,aJ as y0,aK as m0,aG as ni,bn as g0,bo as b0,bp as x0,bq as w0,br as O0}from"./index-CVSo1eIn.js";import{P as S0}from"./page-header-JYwkpfbT.js";import{S as _e,I as vl,a as Ie,R as A0,N as P0}from"./radient-auth-buttons-Bi1-KXYI.js";import{S as _0}from"./square-pen-DOIqaj9i.js";import{a as j0,P as Q,H as E0,p as ai}from"./parseISO-D2eiqdi5.js";import{w as eg,n as tg,M as yl,a as de,S as T0,T as C0,l as rg,b as He,t as Ea,p as ec,s as Kn,c as ng,F as k0,G as I0,H as M0,I as $0,J as N0,K as R0,L as D0,N as q0,O as L0,k as B0,P as F0,Q as z0}from"./step-DMJAOHzS.js";import{b as tc,p as Fr}from"./band-CquvqAHh.js";import{d as Gn,n as W0,e as U0,i as ml,f as rc,g as zt,h as gl,a as bl,j as vf,k as K0,m as G0,o as at,c as H0,p as Ta,q as ag,l as nc,r as V0}from"./linear-BfLTrHPc.js";import{m as yf,a as mf,p as X0,q as Y0,u as Z0,s as J0,r as Q0,v as ew,w as tw,x as rw,y as nw,z as aw,A as iw,B as ow,t as sw}from"./time-BOTM2Tp0.js";import{i as wt,a as lt}from"./init-Dmth1JHB.js";import{i as uw,o as cw}from"./ordinal-DILIJJjt.js";/**
2
2
  * @license lucide-react v0.507.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -162,4 +162,4 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
162
162
  `).map(y=>y.trim()).filter(Boolean);break;case"cascade":{if(!a.cascadeBase)return;const y={};for(const[v,p]of Object.entries(a.cascadeBase))y[v]=p;l=y,d=t.value??void 0;break}default:t.empty_unsets&&a.value.trim()===""?l=null:l=a.value}i(y=>({...y,saving:!0,error:null}));try{await nr(h()),i(y=>({...y,saving:!1,cascadeBase:null})),await r?.()}catch(y){i(v=>({...v,saving:!1,error:y instanceof Error?y.message:"The setting could not be saved."}))}},u=async()=>{i(l=>({...l,saving:!0,error:null}));try{await nr({op:"settings.reset",key:t.key}),i(l=>({...l,saving:!1})),await r?.()}catch(l){i(d=>({...d,saving:!1,error:l instanceof Error?l.message:"The setting could not be reset."}))}};if(t.redacted)return m.jsx(Ae,{variant:"neutral",className:"w-full",children:"This value carries inline credentials or query parameters and cannot be edited here. Secrets belong in the credential manager."});if(t.kind==="readonly")return m.jsx("p",{className:"text-body-sm text-ink-muted",children:Yt(t.value)||"Not set"});let c;switch(t.kind){case"bool":c=m.jsx(Im,{checked:a.value==="true",onCheckedChange:l=>i(d=>({...d,value:l?"true":"false"})),"aria-label":t.label});break;case"enum":c=m.jsxs($m,{value:a.value,onValueChange:l=>i(d=>({...d,value:l})),children:[m.jsx(Nm,{"aria-label":t.label,className:"w-full",children:m.jsx(Rm,{})}),m.jsx(Dm,{children:t.choices.map(l=>m.jsx(Ju,{value:Yt(l.value),children:l.label},Yt(l.value)))})]});break;case"int":case"float":c=m.jsx(bt,{type:"number",value:a.value,min:t.minimum??void 0,max:t.maximum??void 0,step:t.kind==="int"?1:"any",onChange:l=>i(d=>({...d,value:l.target.value})),"aria-label":t.label});break;case"list":c=m.jsx(Zu,{value:a.value,rows:Math.min(6,t.members.length+2),onChange:l=>i(d=>({...d,value:l.target.value})),"aria-label":t.label,className:"font-mono text-body-sm"});break;case"cascade":{const l=a.cascadeBase??t.value??{};c=m.jsxs("div",{className:"flex flex-col gap-3",children:[Object.entries(l).map(([d,h])=>m.jsxs("div",{className:"flex flex-col gap-1",children:[m.jsx("span",{className:"font-mono text-meta text-ink-dim",children:d}),m.jsx(Zu,{value:h.join(`
163
163
  `),rows:Math.max(2,h.length+1),onChange:y=>i(v=>({...v,cascadeBase:{...v.cascadeBase??l,[d]:y.target.value.split(`
164
164
  `).map(p=>p.trim()).filter(Boolean)}})),"aria-label":`${t.label}: ${d}`,className:"font-mono text-body-sm"})]},d)),m.jsx("p",{className:"text-meta text-ink-dim",children:"One hop per line, as provider/model (effort). An empty chain moves to the next provider."})]});break}default:c=m.jsx(bt,{value:a.value,onChange:l=>i(d=>({...d,value:l.target.value})),"aria-label":t.label})}const f=m.jsxs("div",{className:"flex flex-col gap-2","data-setting-key":t.key,children:[m.jsxs("div",{className:"flex items-center justify-between gap-3",children:[m.jsxs("div",{className:"flex min-w-0 flex-col gap-0.5",children:[m.jsx("span",{className:"text-body-sm text-ink",children:t.label}),t.help&&m.jsx("span",{className:"text-meta text-ink-dim",children:t.help})]}),m.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[!t.is_default&&m.jsxs(V,{variant:"ghost",size:"sm",onClick:()=>void u(),disabled:a.saving,children:[m.jsx(zw,{"aria-hidden":"true"}),"Use default"]}),o&&m.jsx(V,{variant:"primary",size:"sm",onClick:()=>void s(),disabled:a.saving,children:a.saving?"Saving":"Save"})]})]}),c,t.kind!=="bool"&&!t.is_default&&m.jsxs("p",{className:"text-meta text-ink-dim",children:["Changed from the default",e?`; ${e}`:""]}),a.error&&m.jsx(Ae,{variant:"danger",children:m.jsxs("div",{className:"flex items-center justify-between gap-3",children:[m.jsx("span",{children:a.error}),m.jsxs(V,{variant:"secondary",size:"sm",onClick:()=>void s(),disabled:a.saving,children:[m.jsx(Yx,{"aria-hidden":"true"}),"Retry"]})]})})]});return n?n(f):f},SN={all:["desktop","settings"]},Vu={live:"Takes effect immediately","new launch":"Takes effect the next time the app starts","new sessions":"Takes effect for new conversations"},AN=({focusKey:t,initialFilter:e=""})=>{const r=Um(),n=Km(r.data,"settings"),[a,i]=T.useState(e),[o,s]=T.useState(new Set),u=T.useRef(!1),c=Sn({queryKey:SN.all,queryFn:()=>nr({op:"settings.list"}),enabled:n,staleTime:1e4}),f=c.data,l=T.useMemo(()=>{if(!f)return null;const v=x=>x.toLowerCase().replace(/[-_]/g," "),p=v(a.trim());return p?f.settings.filter(x=>v([x.label,x.help,x.key,x.section].join(" ")).includes(p)):f.settings},[f,a]);if(T.useEffect(()=>{if(!t||!f||u.current)return;u.current=!0;const v=f.settings.find(p=>p.key===t);v&&(s(p=>{if(!p.has(v.section))return p;const x=new Set(p);return x.delete(v.section),x}),requestAnimationFrame(()=>{const p=document.querySelector(`[data-setting-key="${CSS.escape(t)}"] input, [data-setting-key="${CSS.escape(t)}"] textarea, [data-setting-key="${CSS.escape(t)}"] button[role="switch"], [data-setting-key="${CSS.escape(t)}"] button`);p?.focus(),p?.scrollIntoView({block:"center"})}))},[t,f]),r.data&&!n)return m.jsx(Ae,{variant:"warning",children:"Searchable settings need a newer Local Operator server. Update the server and restart the app to manage these settings here."});if(c.isLoading||r.isLoading)return m.jsx("div",{className:"flex h-40 items-center justify-center",children:m.jsx(Ge,{size:"lg",label:"Loading settings"})});const d=(r.data?null:r.error)??c.error;if(d||!f||!l){const v=r.isFetching||c.isFetching;return m.jsx(Ae,{variant:"warning",children:m.jsxs("div",{className:"flex items-center justify-between gap-3",children:[m.jsx("span",{children:Gm("Your settings could not be loaded.",d)}),m.jsx(V,{variant:"secondary",size:"sm",className:"shrink-0",onClick:()=>{r.isError?r.refetch():c.refetch()},disabled:v,children:v?"Retrying":"Retry"})]})})}const h=f.sections.filter(v=>l.some(p=>p.section===v.name)),y=v=>s(p=>{const x=new Set(p);return x.has(v)?x.delete(v):x.add(v),x});return m.jsxs("div",{className:"flex flex-col gap-6",children:[m.jsxs("div",{className:"relative",children:[m.jsx(Zx,{size:16,className:"pointer-events-none absolute top-1/2 left-3 -translate-y-1/2 text-ink-dim","aria-hidden":"true"}),m.jsx(bt,{value:a,onChange:v=>i(v.target.value),placeholder:"Search settings by name, description or key","aria-label":"Search settings",className:"pl-9"}),a&&m.jsx(V,{variant:"ghost",size:"icon-sm",className:"absolute top-1/2 right-1 -translate-y-1/2",onClick:()=>i(""),"aria-label":"Clear search",children:m.jsx(cf,{"aria-hidden":"true"})})]}),l.length===0&&m.jsxs("div",{className:"flex flex-col items-center gap-2 py-6 text-center",children:[m.jsx("p",{className:"text-body-sm text-ink-muted",children:"No settings match this search."}),m.jsxs(V,{variant:"secondary",size:"sm",onClick:()=>i(""),children:[m.jsx(cf,{"aria-hidden":"true"}),"Clear search"]})]}),h.map(v=>{const p=l.filter(b=>b.section===v.name),x=o.has(v.name);return m.jsxs("section",{"data-settings-section":v.name,className:"flex flex-col gap-3",children:[m.jsxs("button",{type:"button",onClick:()=>y(v.name),"aria-expanded":!x,className:"flex items-baseline justify-between gap-3 text-left",children:[m.jsxs("span",{className:"flex flex-col gap-0.5",children:[m.jsx("span",{className:"text-heading text-ink",children:v.title}),v.description&&m.jsx("span",{className:"text-meta text-ink-dim",children:v.description})]}),Vu[v.scope]&&m.jsx(Lr,{variant:"neutral",children:Vu[v.scope]})]}),!x&&m.jsx("div",{className:"flex flex-col gap-5",children:p.map(b=>m.jsx(ON,{setting:b,scope:Vu[v.scope],onSaved:()=>c.refetch()},b.key))})]},v.name)})]})},Om=({credentialKey:t,isConfigured:e=!1,onEdit:r,onClear:n,onAdd:a})=>{const i=Jx(t),o=e?_w:Un;return m.jsxs("div",{className:"flex flex-col rounded-md p-3 transition-colors duration-fast ease-out-quart hover:bg-elevated",children:[m.jsxs("div",{className:"min-w-0",children:[m.jsxs("h3",{className:"flex items-center gap-2 text-body font-medium text-ink",children:[m.jsx(o,{className:"size-3.5 shrink-0 text-ink-dim"}),i.name]}),m.jsx("p",{className:"mt-1 break-all text-mono-sm text-ink-dim",children:t}),m.jsx("p",{className:"mt-2 text-body-sm text-ink-muted",children:i.description})]}),m.jsx("div",{className:"mt-auto flex flex-wrap items-center justify-end gap-2 pt-4",children:e?m.jsxs(m.Fragment,{children:[m.jsxs(V,{variant:"ghost",size:"sm",onClick:()=>r?.(t),children:[m.jsx(_0,{}),"Update"]}),m.jsxs(V,{variant:"ghost",size:"sm",className:"text-danger hover:bg-danger-wash hover:text-danger",onClick:()=>n?.(t),children:[m.jsx(Hm,{}),"Clear"]})]}):m.jsxs(m.Fragment,{children:[m.jsxs(V,{variant:"outline",size:"sm",onClick:()=>a?.(t),children:[m.jsx(Un,{}),"Configure"]}),i.url&&m.jsx(Mm,{content:`Get your ${i.name} key`,children:m.jsx(V,{variant:"ghost",size:"icon-sm",asChild:!0,children:m.jsx("a",{href:i.url,target:"_blank",rel:"noopener noreferrer","aria-label":`Get your ${i.name} key`,children:m.jsx(Vm,{})})})})]})})]})},Xu="_custom_",Sm="credential-custom-key",Am="credential-custom-key-error",Pm="credential-type",_m="credential-type-help",jm="credential-value",Em="credential-value-help",Tm=({open:t,onClose:e,onSave:r,initialKey:n="",existingKeys:a,isSaving:i,isEditMode:o})=>{const[s,u]=T.useState(n),[c,f]=T.useState(""),[l,d]=T.useState(""),[h,y]=T.useState(!1);T.useEffect(()=>{if(t){const P=Br.some(E=>E.key===n),k=!o&&n&&!P;u(P?n:""),f(""),d(k?n:""),y(k||o&&!P)}},[t,n,o]);const v=()=>{let P="";if(o?P=n:P=h?l.trim():s,!P){console.error("No key provided for credential");return}if(!c.trim()){console.error("No value provided for credential");return}r({key:P,value:c})},p=P=>a.includes(P)&&P!==n,x=p(l),b=o?!0:h?l.trim()!==""&&!x:s!==""&&!p(s),w=c.trim()!=="",S=b&&w&&!i,g=Br.find(P=>P.key===s),O=!!g&&!h,A=o?"Update credential":"Add new credential",_=m.jsxs(m.Fragment,{children:[m.jsx(V,{variant:"secondary",onClick:e,children:"Cancel"}),m.jsxs(V,{variant:"primary",onClick:v,disabled:!S,children:[i&&m.jsx(Ge,{size:"sm",className:"border-t-on-accent"}),i?"Saving...":"Save"]})]});return m.jsx(Qx,{open:t,onClose:e,title:A,actions:_,maxWidth:"sm",fullWidth:!0,children:m.jsxs("div",{className:"flex flex-col gap-4",children:[o?m.jsx(Ie,{label:"Credential key",value:m.jsx("span",{className:"text-mono-sm",children:n})}):m.jsxs(m.Fragment,{children:[m.jsxs("div",{className:"flex flex-col gap-2",children:[m.jsx(mt,{htmlFor:Pm,children:"Credential type"}),m.jsxs($m,{value:h?Xu:s,onValueChange:P=>{P===Xu?(y(!0),u("")):(y(!1),u(P),d(""))},children:[m.jsx(Nm,{id:Pm,"aria-describedby":O?_m:void 0,children:m.jsx(Rm,{placeholder:"Select a credential type"})}),m.jsxs(Dm,{children:[Br.filter(P=>!P.internal).map(P=>m.jsxs(Ju,{value:P.key,disabled:p(P.key),children:[P.name,p(P.key)&&" (configured)"]},P.key)),m.jsx(Ju,{value:Xu,children:"Custom credential"})]})]}),O&&g&&m.jsxs("div",{id:_m,className:"flex flex-col items-start gap-1",children:[m.jsx("p",{className:"text-meta text-ink-dim",children:g.description}),g.url&&m.jsxs("a",{href:g.url,target:"_blank",rel:"noopener noreferrer",className:"text-accent text-meta underline-offset-4 hover:text-accent-hover hover:underline",children:["Get your ",g.name," key"]})]})]}),h&&m.jsxs("div",{className:"flex flex-col gap-2",children:[m.jsx(mt,{htmlFor:Sm,children:"Custom credential key"}),m.jsx(bt,{id:Sm,value:l,onChange:P=>d(P.target.value),"aria-invalid":x||void 0,"aria-describedby":x?Am:void 0,required:!0,autoFocus:!0}),x&&m.jsx("p",{id:Am,className:"text-danger text-meta",children:"This credential already exists"})]})]}),m.jsxs("div",{className:"flex flex-col gap-2",children:[m.jsx(mt,{htmlFor:jm,children:"Credential value"}),m.jsx(bt,{id:jm,type:"password",value:c,onChange:P=>f(P.target.value),onKeyDown:P=>{P.key==="Enter"&&S&&v()},"aria-describedby":o?Em:void 0,required:!0,autoFocus:o,placeholder:"Enter the credential value or API key"}),o&&m.jsxs("p",{id:Em,className:"text-ink-dim text-meta",children:["Enter the new value for ",n]})]})]})})},Cm=({title:t,description:e,children:r,isEmpty:n=!1,emptyStateType:a="noCredentials"})=>m.jsxs("section",{children:[m.jsx("h3",{className:"text-body font-medium text-ink",children:t}),m.jsx("p",{className:"mt-1 max-w-2xl text-body-sm text-ink-muted",children:e}),m.jsx(Dx,{variant:"surface",padding:"sm",className:"mt-3",children:n?m.jsx(PN,{type:a}):m.jsx("div",{className:"grid grid-cols-[repeat(auto-fit,minmax(260px,1fr))] gap-2",children:r})})]}),PN=({type:t,className:e})=>{const r=t==="noCredentials",n=r?Un:qm;return m.jsxs("div",{className:Nt("flex flex-col items-center px-4 py-8 text-center",e),children:[m.jsx(n,{size:20,className:"text-ink-dim","aria-hidden":!0}),m.jsx("p",{className:"mt-3 text-body font-medium text-ink",children:r?"No credentials configured":"All available credentials configured"}),m.jsx("p",{className:"mt-1 max-w-sm text-body-sm text-ink-muted",children:r?"You haven't set up any API credentials yet. Add credentials from the available options or add a custom one.":"You've configured all the common API credentials. You can still add custom credentials if needed."})]})},_N=()=>{const{data:t,isLoading:e,error:r,refetch:n}=Xm(),a=e0(),[i,o]=T.useState(!1),[s,u]=T.useState(!1),[c,f]=T.useState(null),l=w=>{f(w),o(!0)},d=(w=null)=>{f(w),u(!0)},h=()=>{o(!1),u(!1),f(null)},y=async w=>{try{await a.mutateAsync(w),h(),await n()}catch(S){console.error("Error saving credential:",S)}},v=async w=>{try{await a.mutateAsync({key:w,value:""}),await n()}catch(S){console.error("Error clearing credential:",S)}},p=T.useMemo(()=>t?.keys?.filter(w=>!Br.find(S=>S.key===w)?.internal)??[],[t]),x=T.useMemo(()=>Br.filter(w=>!p.includes(w.key)&&!w.internal),[p]),b=()=>e?m.jsx("div",{className:"flex min-h-40 items-center justify-center",children:m.jsx(Ge,{size:"lg",label:"Loading credentials"})}):r||!t?m.jsxs(Ae,{variant:"danger",role:"alert",children:[m.jsx(qx,{children:"Could not load credentials"}),m.jsx(Lx,{children:r instanceof Error?r.message:"The server did not say why. Check that Local Operator is running, then reopen this page."})]}):m.jsxs(m.Fragment,{children:[m.jsx(Cm,{title:"Configured credentials",description:"These API credentials are currently configured and available for use.",isEmpty:p.length===0,emptyStateType:"noCredentials",children:p.map(w=>m.jsx(Om,{credentialKey:w,isConfigured:!0,onEdit:l,onClear:v},w))}),m.jsx(Cm,{title:"Available credentials",description:"These are common API credentials you can configure to enhance functionality.",isEmpty:x.length===0,emptyStateType:"allConfigured",children:x.map(w=>m.jsx(Om,{credentialKey:w.key,isConfigured:!1,onAdd:()=>d(w.key)},w.key))}),m.jsx("div",{className:"flex justify-center",children:m.jsxs(V,{variant:"secondary",size:"sm",onClick:()=>d(null),children:[m.jsx(t0,{}),"Add custom credential"]})}),i&&m.jsx(Tm,{open:i,onClose:h,onSave:y,initialKey:c||"",existingKeys:p,isSaving:a.isPending,isEditMode:!0}),s&&m.jsx(Tm,{open:s,onClose:h,onSave:y,initialKey:c||"",existingKeys:p,isSaving:a.isPending,isEditMode:!1})]});return m.jsx("div",{className:"flex flex-col gap-6",children:b()})},km={list:t=>["desktop","mcp",t]},jN=({sessionId:t,onAdded:e})=>{const[r,n]=T.useState(""),[a,i]=T.useState("command"),[o,s]=T.useState(""),[u,c]=T.useState(""),[f,l]=T.useState(""),[d,h]=T.useState("global"),[y,v]=T.useState(null),[p,x]=T.useState(!1),b=async()=>{x(!0),v(null);try{await nr({op:"mcp.control",sessionId:t,control:{action:"add",name:r,scope:d,...a==="command"?{command:o,args:u.split(`
165
- `).map(w=>w.trim()).filter(Boolean)}:{url:f}}}),n(""),s(""),c(""),l(""),e()}catch(w){v(w instanceof Error?w.message:"The server could not be added.")}finally{x(!1)}};return m.jsxs("form",{className:"flex flex-col gap-3 rounded-md border border-control bg-surface p-4",onSubmit:w=>{w.preventDefault(),b()},children:[m.jsxs("div",{className:"flex flex-col gap-1",children:[m.jsx(mt,{htmlFor:"mcp-add-name",children:"Name"}),m.jsx(bt,{id:"mcp-add-name",value:r,onChange:w=>n(w.target.value),required:!0})]}),m.jsxs("fieldset",{className:"flex gap-2",children:[m.jsx("legend",{className:"sr-only",children:"Server transport"}),m.jsx(V,{type:"button",variant:a==="command"?"secondary":"ghost",size:"sm",onClick:()=>i("command"),children:"Local command"}),m.jsx(V,{type:"button",variant:a==="url"?"secondary":"ghost",size:"sm",onClick:()=>i("url"),children:"Remote URL"})]}),a==="command"?m.jsxs(m.Fragment,{children:[m.jsxs("div",{className:"flex flex-col gap-1",children:[m.jsx(mt,{htmlFor:"mcp-add-command",children:"Command"}),m.jsx(bt,{id:"mcp-add-command",value:o,onChange:w=>s(w.target.value),className:"font-mono",required:!0})]}),m.jsxs("div",{className:"flex flex-col gap-1",children:[m.jsx(mt,{htmlFor:"mcp-add-args",children:"Arguments, one per line"}),m.jsx("textarea",{id:"mcp-add-args",value:u,onChange:w=>c(w.target.value),rows:2,className:"rounded-sm border border-control bg-surface p-2 font-mono text-body-sm text-ink"})]})]}):m.jsxs("div",{className:"flex flex-col gap-1",children:[m.jsx(mt,{htmlFor:"mcp-add-url",children:"URL"}),m.jsx(bt,{id:"mcp-add-url",type:"url",value:f,onChange:w=>l(w.target.value),className:"font-mono",required:!0}),m.jsx("p",{className:"text-meta text-ink-dim",children:"No inline credentials or query parameters; secrets are referenced from the credential manager."})]}),m.jsxs("fieldset",{className:"flex gap-2",children:[m.jsx("legend",{className:"sr-only",children:"Configuration scope"}),m.jsx(V,{type:"button",variant:d==="global"?"secondary":"ghost",size:"sm",onClick:()=>h("global"),children:"Global"}),m.jsx(V,{type:"button",variant:d==="project"?"secondary":"ghost",size:"sm",onClick:()=>h("project"),children:"This project"})]}),y&&m.jsx(Ae,{variant:"danger",children:y}),m.jsx("div",{children:m.jsxs(V,{type:"submit",variant:"primary",size:"sm",disabled:p||!r||!(a==="command"?o:f),children:[p?m.jsx(Ge,{size:"sm"}):null,"Add server"]})})]})},EN=({sessionId:t,sectionRef:e,highlightServer:r})=>{const n=Um(),a=Km(n.data,"mcp"),i=zm(),[o,s]=T.useState(null),[u,c]=T.useState(null),[f,l]=T.useState(!1),d=Sn({queryKey:km.list(t??""),queryFn:()=>{if(!t)throw new Error("No conversation selected.");return nr({op:"mcp.list",sessionId:t}).then(b=>b.data)},enabled:a&&!!t,staleTime:1e4}),h=d.data?.servers??[],y=T.useRef(null),v=T.useRef(null);T.useEffect(()=>{!r||h.length===0||v.current!==r&&h.some(b=>b.name===r)&&(v.current=r,y.current?.scrollIntoView({block:"center",behavior:"smooth"}))},[r,h]);const p=T.useCallback(()=>{t&&i.invalidateQueries({queryKey:km.list(t)})},[i,t]),x=T.useCallback(async(b,w,S={})=>{if(t){c(null);try{await nr({op:"mcp.control",sessionId:t,control:{action:b,name:w,...S}}),p()}catch(g){c(g instanceof Error?g.message:"The MCP change could not be completed.")}}},[t,p]);return a?t?m.jsx(_e,{title:"Integrations",description:"MCP servers connect agents to your tools and accounts. A connected server is a working transport; the account behind it may still need its own sign-in.",sectionRef:e,children:m.jsxs("div",{className:"flex flex-col gap-4",children:[u&&m.jsx(Ae,{variant:"danger",children:u}),d.isLoading&&m.jsx("div",{className:"flex h-24 items-center justify-center",children:m.jsx(Ge,{size:"lg",label:"Loading MCP servers"})}),d.isError&&m.jsx(Ae,{variant:"warning",children:m.jsxs("div",{className:"flex items-center justify-between gap-3",children:[m.jsx("span",{children:"MCP servers could not be loaded."}),m.jsx(V,{variant:"secondary",size:"sm",onClick:()=>void d.refetch(),children:"Retry"})]})}),d.isSuccess&&h.length===0&&m.jsx("p",{className:"text-body-sm text-ink-muted",children:"No MCP servers configured yet. Add one below."}),h.length>0&&m.jsx("ul",{className:"flex flex-col gap-2",children:h.map(b=>{const w=b.status==="connected",S=b.name===r;return m.jsxs("li",{ref:S?y:void 0,className:Nt("flex flex-col gap-2 rounded-md border border-control bg-surface p-3",S&&"border-accent bg-elevated"),children:[m.jsxs("div",{className:"flex items-center justify-between gap-3",children:[m.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[m.jsx("span",{className:"truncate font-medium text-body text-ink",children:b.name}),b.scope&&m.jsx(Lr,{variant:"neutral",children:b.scope}),b.transport&&m.jsx(Lr,{variant:"outline",children:b.transport})]}),m.jsx(Lr,{variant:w?"success":b.status==="connecting"?"info":"neutral",children:b.status??"unknown"})]}),typeof b.tool_count=="number"&&m.jsxs("p",{className:"text-meta text-ink-dim",children:[b.tool_count," tools available"]}),b.error&&m.jsx("p",{className:"text-body-sm text-danger",children:b.error}),m.jsxs("p",{className:"text-meta text-ink-dim",children:["Account authorization:"," ",b.downstream_authorization==="unknown"||!b.downstream_authorization?"unknown":b.downstream_authorization]}),m.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[w?m.jsxs(V,{variant:"secondary",size:"sm",onClick:()=>{s(null),x("disconnect",b.name,{confirmed:!0})},children:[m.jsx(Ym,{"aria-hidden":"true"}),"Disconnect"]}):m.jsxs(V,{variant:"secondary",size:"sm",onClick:()=>void x("connect",b.name),children:[m.jsx($w,{"aria-hidden":"true"}),"Connect"]}),m.jsxs(V,{variant:"ghost",size:"sm",onClick:()=>void x("reload",b.name),children:[m.jsx(Bx,{"aria-hidden":"true"}),"Reload"]}),b.transport==="http"&&b.transport_oauth_supported!==!1?m.jsx(V,{variant:"ghost",size:"sm",onClick:()=>void x("login",b.name),children:"Grant account access"}):b.setup_prompt?m.jsx(V,{variant:"ghost",size:"sm",onClick:()=>{navigator.clipboard.writeText(b.setup_prompt??"").catch(()=>{})},children:"Copy setup prompt"}):null,o===b.name?m.jsxs(m.Fragment,{children:[m.jsxs("span",{className:"text-body-sm text-ink",children:["Remove ",b.name,"?"]}),m.jsx(V,{variant:"danger",size:"sm",onClick:()=>{s(null),x("remove",b.name,{confirmed:!0,scope:b.scope==="project"?"project":"global"})},children:"Confirm removal"}),m.jsx(V,{variant:"ghost",size:"sm",onClick:()=>s(null),children:"Keep"})]}):m.jsxs(V,{variant:"ghost",size:"sm",className:"text-danger",onClick:()=>s(b.name),children:[m.jsx(Hm,{"aria-hidden":"true"}),"Remove"]})]})]},b.name)})}),f?m.jsx(jN,{sessionId:t,onAdded:()=>{l(!1),p()}}):m.jsx("div",{children:m.jsx(V,{variant:"secondary",size:"sm",onClick:()=>l(!0),"data-tour-tag":"mcp-add-server",children:"Add server"})})]})}):m.jsx(_e,{title:"Integrations",description:"MCP servers connect agents to your tools and accounts.",sectionRef:e,children:m.jsx("p",{className:"text-body-sm text-ink-muted",children:"Open a conversation to manage its MCP servers."})}):m.jsx(_e,{title:"Integrations",description:"MCP servers connect agents to your tools and accounts.",sectionRef:e,children:m.jsx(Ae,{variant:"warning",children:"Integration management needs a newer Local Operator backend. Update the backend and restart the app to manage MCP servers here."})})},TN=({onAfterCredentialUpdate:t})=>{const{isAuthenticated:e,user:r,isLoading:n,error:a,signOut:i}=r0(),o=Zm(f=>f.isSigningOut),s=T.useCallback(async()=>{try{await i()}catch(f){console.error("Error signing out:",f)}},[i]),u=T.useMemo(()=>{if(!e||!r?.radientUser)return null;const{account:f,identity:l}=r.radientUser;return m.jsxs(m.Fragment,{children:[m.jsxs(vl,{children:[m.jsx(Ie,{label:"Status",value:m.jsxs("span",{className:"inline-flex items-center gap-2",children:["Connected",m.jsx(Lr,{variant:"success",className:"capitalize",children:f.status})]})}),m.jsx(Ie,{label:"Name",value:f.name||"Not provided"}),m.jsx(Ie,{label:"Email",value:f.email}),m.jsx(Ie,{label:"Account ID",value:m.jsx("span",{className:"text-mono-sm",children:f.id})}),m.jsx(Ie,{label:"Tenant ID",value:m.jsx("span",{className:"text-mono-sm",children:f.tenant_id})}),m.jsx(Ie,{label:"Provider",value:m.jsx("span",{className:"capitalize",children:l.provider})}),m.jsx(Ie,{label:"Created",value:Jm(f.created_at)})]}),m.jsxs("div",{className:"mt-8",children:[m.jsx("p",{className:"text-body-sm text-ink-muted",children:"Need to sign out or switch accounts?"}),m.jsxs(V,{variant:"danger",className:"mt-3",onClick:s,children:[m.jsx(n0,{}),"Sign out from Radient"]})]})]})},[e,r?.radientUser,s]),c=T.useMemo(()=>e&&r?null:m.jsxs("div",{children:[m.jsx("p",{className:"text-body-sm text-ink-muted",children:"You are not currently signed in to Radient. Sign in to access your account details or sign up to get free credits and unified access to models, tools, and more with Radient Pass. Radient's automatic model router will automatically select the best model for your agents to balance cost and performance. It is often cheaper to use Radient Pass than to use single AI providers due to automatic cost optimization."}),m.jsx("div",{className:"mt-6",children:m.jsx(a0,{titleText:"",onAfterCredentialUpdate:t,descriptionText:"",onSignInSuccess:()=>{}})})]}),[e,r,t]);return n||o?m.jsx("div",{className:"flex min-h-36 items-center justify-center",children:m.jsx(Ge,{size:"lg",label:"Loading account"})}):e&&r?.radientUser?u:m.jsxs("div",{className:"flex flex-col gap-4",children:[a&&m.jsxs(Ae,{variant:"danger",children:["Error checking account status:"," ",a instanceof Error?a.message:String(a)]}),c]})},CN=()=>{const{data:t,isLoading:e,error:r,refetch:n}=Gw(),a=Hw(),[i,o]=T.useState(""),[s,u]=T.useState(!1);T.useEffect(()=>{o(t?.content??""),u(!1)},[t]);const c=y=>{const v=y.target.value;o(v),u(v!==(t?.content??""))},f=async()=>{if(!(!s||a.isPending))try{const y={content:i};await a.mutateAsync(y),await n(),u(!1)}catch(y){console.error("Error updating system prompt:",y)}},l=()=>{o(t?.content??""),u(!1)},d=a.isPending,h=()=>m.jsxs("div",{className:"flex flex-col gap-4",children:[m.jsxs("div",{className:"flex flex-col gap-2",children:[m.jsx(mt,{htmlFor:"app-system-prompt",children:"Instructions"}),m.jsx(Zu,{id:"app-system-prompt",name:"systemPrompt",value:i,onChange:c,placeholder:"Enter instructions for how all agents should behave and respond to your requests...",className:"min-h-50"})]}),m.jsxs("div",{className:"flex gap-3",children:[m.jsxs(V,{variant:"primary",onClick:f,disabled:!s||d,children:[d?m.jsx(Ge,{size:"sm"}):m.jsx(i0,{}),d?"Saving...":"Save changes"]}),m.jsx(V,{onClick:l,disabled:!s||d,children:"Cancel"})]}),t?.last_modified&&m.jsxs("p",{className:"text-ink-dim text-meta",children:["Last modified:"," ",m.jsx("span",{className:"font-mono text-mono-sm",children:Qm(t.last_modified)})]})]});return m.jsx(_e,{title:"System prompt",icon:P0,description:"Every Local Operator agent receives this prompt in addition to its own instructions, so it is the place for baseline expectations and for details you want every agent to know about you, such as your name, location, or preferences. It is sent to your selected hosting provider.",children:e?m.jsx("div",{className:"flex min-h-50 items-center justify-center",children:m.jsx(Ge,{size:"lg",label:"Loading system prompt"})}):r?m.jsxs(Ae,{variant:"danger",children:["Failed to load system prompt:"," ",r instanceof Error?r.message:"Unknown error"]}):h()})},kN={localOperatorDark:Cw,localOperatorLight:Bw,radient:Ow,dracula:Rw,dune:xw,sage:Aw,monokai:zx,tokyoNight:Iw,iceberg:qw,neon:Uw,obsidian:ig,synth:fw},IN=({id:t})=>m.jsxs("div",{"data-theme":t,"aria-hidden":"true",className:"flex h-full bg-canvas",children:[m.jsxs("div",{className:"flex w-1/4 flex-col gap-1 bg-sunken p-1.5",children:[m.jsx("span",{className:"flex h-2.5 items-center rounded-xs bg-accent-wash px-1",children:m.jsx("span",{className:"h-1 w-full rounded-xs bg-accent"})}),m.jsx("span",{className:"mx-1 h-1 w-2/3 rounded-xs bg-ink-dim"}),m.jsx("span",{className:"mx-1 h-1 w-1/2 rounded-xs bg-ink-dim"})]}),m.jsxs("div",{className:"flex flex-1 flex-col justify-between p-2",children:[m.jsxs("div",{className:"flex flex-col gap-1.5 rounded-sm bg-surface p-2",children:[m.jsx("span",{className:"h-1.5 w-3/5 rounded-xs bg-ink"}),m.jsx("span",{className:"h-1 w-full rounded-xs bg-ink-dim"}),m.jsx("span",{className:"h-1 w-4/5 rounded-xs bg-ink-dim"})]}),m.jsxs("div",{className:"flex items-center gap-1.5",children:[m.jsx("span",{className:"h-3 w-9 rounded-xs bg-accent"}),m.jsx("span",{className:"h-3 w-6 rounded-xs border border-control"})]})]})]}),MN=({id:t,name:e,description:r,isSelected:n,onSelect:a})=>{const i=kN[t];return m.jsxs("button",{type:"button","aria-pressed":n,onClick:a,className:Nt("flex flex-col gap-2 rounded-lg p-2 text-left transition-colors duration-fast ease-out-quart",n?"bg-accent-wash":"hover:bg-surface"),children:[m.jsx("span",{className:Nt("block aspect-16/10 overflow-hidden rounded-md border transition-colors duration-fast ease-out-quart",n?"border-accent":"border-hairline"),children:m.jsx(IN,{id:t})}),m.jsxs("span",{className:"flex items-center gap-2 px-1",children:[m.jsx(i,{size:14,className:"shrink-0 text-ink-dim","aria-hidden":"true"}),m.jsx("span",{className:Nt("min-w-0 flex-1 truncate text-body-sm text-ink",n&&"font-medium"),children:e}),n&&m.jsx(qm,{size:14,className:"shrink-0 text-accent","aria-hidden":"true"})]}),m.jsx("span",{className:"px-1 pb-1 text-meta text-ink-muted",children:r})]})},$N=()=>{const{themeName:t,setTheme:e}=Qu(),r=T.useMemo(()=>{const n=Object.values(Fx);return[{label:"Dark",items:n.filter(a=>a.theme.palette.mode==="dark")},{label:"Light",items:n.filter(a=>a.theme.palette.mode==="light")}].filter(a=>a.items.length>0)},[]);return m.jsx("div",{className:"flex flex-col gap-6",children:r.map(n=>m.jsxs("div",{children:[m.jsx("h3",{className:"px-1 pb-2 text-meta text-ink-dim",children:n.label}),m.jsx("div",{className:"grid grid-cols-[repeat(auto-fill,minmax(240px,1fr))] gap-2",children:n.items.map(({id:a,name:i,description:o})=>m.jsx(MN,{id:a,name:i,description:o,isSelected:a===t,onSelect:()=>e(a)},a))})]},n.label))})},NN=()=>{const{data:t,isLoading:e,error:r}=kO({enabled:!0});return m.jsxs("div",{children:[m.jsxs("h3",{className:"mb-3 flex items-center gap-2 text-heading text-ink",children:[m.jsx(gw,{size:16,className:"shrink-0 text-ink-dim"}),"Radient Pass"]}),e&&m.jsx(Lm,{className:"h-6 w-36"}),r&&m.jsxs(Ae,{variant:"warning",children:["Could not load your credit balance. ",r.message]}),t&&!e&&!r&&m.jsxs("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-center",children:[m.jsxs("p",{className:"flex-1 text-body-sm text-ink-muted",children:["Available credits"," ",m.jsx("span",{className:"font-medium text-ink",children:t.balance.toFixed(2)})]}),m.jsx(V,{variant:"secondary",size:"sm",asChild:!0,children:m.jsxs("a",{href:"https://console.radienthq.com/dashboard/billing",target:"_blank",rel:"noopener noreferrer",children:[m.jsx(vw,{}),"Add credits"]})})]})]})},RN=[{id:"credits",label:"Credits"},{id:"tokens",label:"Tokens"}],DN=({active:t,label:e,payload:r,unit:n})=>!t||!r?.length?null:m.jsxs("div",{className:"rounded-md border border-hairline bg-elevated px-3 py-2 shadow-overlay",children:[m.jsx("p",{className:"text-meta text-ink-dim",children:e}),m.jsxs("p",{className:"text-mono text-ink",children:[r[0]?.value," ",n]})]}),qN=()=>{const[t,e]=T.useState("credits"),r=T.useMemo(()=>{const s=new Date,u=Xw(s);return{start_date:gf(u),end_date:gf(s),rollup:"daily"}},[]),{data:n,isLoading:a,error:i}=$O(r,{enabled:!0}),o=T.useMemo(()=>n?.data_points?[...n.data_points].sort((u,c)=>ai(u.timestamp).getTime()-ai(c.timestamp).getTime()).map(u=>({date:O0(ai(u.timestamp),"MMM dd"),credits:Number.parseFloat(u.total_cost.toFixed(2)),tokens:u.total_tokens})):[],[n]);return m.jsxs("div",{children:[m.jsxs("div",{className:"mb-5 flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between",children:[m.jsxs("h3",{className:"flex items-center gap-2 text-heading text-ink",children:[m.jsx(pw,{size:16,className:"shrink-0 text-ink-dim"}),"Usage (last 30 days)"]}),m.jsxs("fieldset",{className:"m-0 w-fit border-0 p-0",children:[m.jsx("legend",{className:"sr-only",children:"Usage metric"}),m.jsx("div",{className:"flex gap-0.5 rounded-md bg-sunken p-0.5",children:RN.map(({id:s,label:u})=>m.jsx(V,{variant:"ghost",size:"sm","aria-pressed":t===s,onClick:()=>e(s),className:Nt(t===s&&"bg-surface text-ink hover:bg-surface"),children:u},s))})]})]}),a&&m.jsx(Lm,{className:"h-62 w-full"}),i&&m.jsxs(Ae,{variant:"warning",children:["Could not load your usage data. ",i.message]}),!a&&!i&&n&&o.length>0&&m.jsx("div",{className:Nt("h-62 w-full","[&_.recharts-cartesian-grid_line]:stroke-hairline","[&_.recharts-cartesian-axis-tick-value]:fill-ink-dim [&_.recharts-cartesian-axis-tick-value]:text-meta","[&_.recharts-line-curve]:stroke-accent","[&_.recharts-active-dot_circle]:fill-accent","[&_.recharts-tooltip-cursor]:stroke-hairline"),children:m.jsx(RP,{width:"100%",height:"100%",children:m.jsxs(gN,{data:o,margin:{top:5,right:20,left:10,bottom:5},children:[m.jsx(xx,{strokeDasharray:"3 3"}),m.jsx(Qa,{dataKey:"date",tickLine:!1,axisLine:!1}),m.jsx(ei,{tickLine:!1,axisLine:!1,width:48}),m.jsx(Ye,{content:m.jsx(DN,{unit:t==="credits"?"credits":"tokens"})}),m.jsx(Cn,{type:"monotone",dataKey:t,strokeWidth:2,dot:!1,activeDot:{r:4,strokeWidth:0},name:t==="credits"?"Credits consumed":"Tokens used"})]})})}),!a&&!i&&(!n||o.length===0)&&m.jsx("p",{className:"text-body-sm text-ink-muted",children:"No usage recorded in the last 30 days."})]})},LN=()=>m.jsxs("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between",children:[m.jsxs("h2",{className:"flex items-center gap-2 text-heading text-ink",children:[m.jsx(S0,{size:16,className:"shrink-0 text-ink-dim"}),"Radient account"]}),m.jsx(V,{variant:"secondary",size:"sm",className:"self-start sm:self-center",asChild:!0,children:m.jsxs("a",{href:"https://console.radienthq.com",target:"_blank",rel:"noopener noreferrer",children:["Go to Radient console",m.jsx(Vm,{})]})})]}),JN=()=>{const t=Qu(q=>q.showAgentReasoning),e=Qu(q=>q.setShowAgentReasoning),{data:r,isLoading:n,isFetching:a,error:i,refetch:o}=o0(),s=s0(),[u,c]=T.useState(null),f=Zm(),{isAuthenticated:l,isLoading:d}=hl(),h=u0(q=>q.activeSessionId),[y,v]=T.useState("general"),[p,x]=T.useState(!1),b=T.useRef(null),w=T.useRef(null),{startTour:S}=c0(),g=l0(),{data:O,refetch:A}=Xm(),{refreshModels:_}=f0(),P=T.useMemo(()=>O?.keys?[...O.keys].sort():[],[O?.keys]),k=T.useRef({keys:"",hosting:void 0});T.useEffect(()=>{const q=P.join(","),U=r?.values?.hosting;(k.current.keys!==q||k.current.hosting!==U)&&(k.current={keys:q,hosting:U},_().catch(L=>{console.error("Failed to refresh models after credentials or hosting change:",L)}))},[P,r?.values?.hosting,_]);const E=T.useRef({general:T.useRef(null),radient:T.useRef(null),integrations:T.useRef(null),appearance:T.useRef(null),credentials:T.useRef(null),providers:T.useRef(null),backend:T.useRef(null),updates:T.useRef(null)}).current,C=T.useMemo(()=>new URLSearchParams(g.search).get("setting"),[g.search]),I=T.useMemo(()=>new URLSearchParams(g.search).get("filter")??"",[g.search]),N=T.useMemo(()=>new URLSearchParams(g.search).get("mcp")??void 0,[g.search]),M=T.useMemo(()=>new URLSearchParams(g.search).get("provider"),[g.search]),R=T.useCallback(q=>{v(q),x(!0);const U=E[q],L=w.current;if(U?.current&&L){const Y=U.current.getBoundingClientRect().top-L.getBoundingClientRect().top;L.scrollHeight>L.clientHeight?L.scrollTo({top:Math.max(0,L.scrollTop+Y-80),behavior:"smooth"}):window.scrollTo({top:Math.max(0,U.current.getBoundingClientRect().top+window.scrollY-80),behavior:"smooth"}),clearTimeout(b.current??void 0),b.current=setTimeout(()=>{x(!1),b.current=null},800)}else x(!1)},[E]);T.useEffect(()=>{const q=setTimeout(()=>{const U=w.current;if(!U)return;const L=()=>{if(p)return;const K=U.getBoundingClientRect(),Y=K.height;let re="",ue=0;for(const[Ve,le]of Object.entries(E))if(le.current){const xe=le.current.getBoundingClientRect(),Xe=K.top,Ee=xe.top-Xe,_t=xe.bottom-Xe,tt=xe.height,pt=Math.max(0,Ee),jt=Math.min(Y,_t),rt=Math.max(0,jt-pt)/tt,ht=rt+(Ee<Y*.3?.1:0);ht>ue&&rt>.1&&(ue=ht,re=Ve)}re&&re!==y&&v(re)};return L(),U.addEventListener("scroll",L,{passive:!0}),()=>{U.removeEventListener("scroll",L),clearTimeout(b.current??void 0)}},100);return()=>clearTimeout(q)},[E,y,p]),T.useEffect(()=>{const q=new URLSearchParams(g.search),U=q.get("section"),L=q.get("setting")?"backend":U,K=L?E[L]:void 0;if(!L||!K)return;let Y=!1,re=Number.NaN,ue=0;const Ve=window.setTimeout(()=>{Y||(Y=!0,xe.disconnect(),R(L))},2e3),le=()=>{if(Y)return;const Xe=K.current;if(!Xe){ue=requestAnimationFrame(le);return}const Ee=Math.round(Xe.getBoundingClientRect().top+window.scrollY);if(Ee===re&&Ee>0){Y=!0,xe.disconnect(),window.clearTimeout(Ve),R(L);return}re=Ee,ue=requestAnimationFrame(le)},xe=new ResizeObserver(()=>{Y||(cancelAnimationFrame(ue),ue=requestAnimationFrame(le))});return w.current&&xe.observe(w.current),ue=requestAnimationFrame(le),()=>{Y=!0,cancelAnimationFrame(ue),xe.disconnect(),window.clearTimeout(Ve)}},[g.search,E,R]);const D=async(q,U)=>{c(q);try{await s.mutateAsync({[q]:U}),await o()}catch(L){console.error(`Error updating ${q}:`,L)}finally{c(null)}},F=n||d,z=IO(F,4e3);return i?m.jsx("div",{className:"flex h-full w-full items-center justify-center bg-canvas p-6",children:m.jsx(Ae,{variant:"warning",className:"w-full max-w-xl",children:m.jsxs("div",{className:"flex items-center justify-between gap-3",children:[m.jsx("span",{children:Gm("Your settings could not be loaded.",i)}),m.jsx(V,{variant:"secondary",size:"sm",className:"shrink-0",onClick:()=>void o(),disabled:a,children:a?"Retrying":"Retry"})]})})}):F?m.jsxs("div",{role:"status",className:"flex h-full w-full flex-col items-center justify-center gap-3 bg-canvas",children:[m.jsx(Ge,{size:"lg",label:z?void 0:"Loading settings"}),z&&m.jsx("p",{className:"max-w-sm text-center text-body-sm text-ink-muted",children:"The Local Operator server is taking longer than usual to answer. If it does not respond, you will be able to retry from here."})]}):r?m.jsxs("div",{className:"flex h-full w-full overflow-hidden bg-canvas",children:[m.jsx("div",{className:"w-12 shrink-0 overflow-y-auto border-r border-hairline min-[1040px]:w-55",children:m.jsx(d0,{activeSection:y,onSelectSection:R,sections:p0})}),m.jsx("div",{ref:w,"data-settings-content":!0,"data-tour-tag":"settings-general-section",className:"flex-1 overflow-y-auto overflow-x-hidden p-4 sm:p-6 md:p-8",children:m.jsxs("div",{className:"mx-auto flex w-full max-w-4xl flex-col gap-8 pb-8",children:[m.jsx(A0,{title:"Settings",icon:pf}),m.jsxs("div",{className:"flex flex-col gap-8",children:[m.jsxs("div",{ref:E.general,className:"flex flex-col gap-8",children:[m.jsx(_e,{title:"User profile",icon:h0,description:`Your user profile information displayed in the application. This information is not provided to the agents. ${l?"These details are provided through your Radient account.":""}`,children:m.jsxs("div",{className:"flex flex-col gap-4",children:[m.jsx(hf,{value:f.profile.name,label:"Display name",placeholder:"Enter your name...",isSaving:u==="user_name",onSave:async q=>{c("user_name");try{f.updateName(q)}finally{c(null)}},readOnly:l}),m.jsx(hf,{value:f.profile.email,label:"Email address",placeholder:"Enter your email...",isSaving:u==="user_email",onSave:async q=>{c("user_email");try{f.updateEmail(q)}finally{c(null)}},readOnly:l})]})}),m.jsx(_e,{title:"Application tour",description:"Missed the application onboarding tour or want a refresher? Start it again here.",children:m.jsxs(V,{variant:"secondary",onClick:()=>{S({forceModalCompleted:!0})},children:[m.jsx(v0,{}),"Take the tour"]})}),m.jsx(_e,{title:"Model settings",icon:y0,description:"Configure the default AI model and hosting providers used for generating responses. This will be used for all agents that don't have a specific model or hosting provider configured. You can override these settings for individual agents in the agent settings.",children:m.jsxs("div",{className:"flex flex-col gap-4",children:[m.jsx(m0,{value:r.values.hosting,isSaving:u==="hosting",onSave:q=>D("hosting",q),filterByCredentials:!0,allowCustom:!0,allowDefault:!1,emptyHelperText:"No hosting providers available. Add one in API credentials, in the list on the left."}),m.jsx(g0,{value:r.values.model_name,hostingId:r.values.hosting,isSaving:u==="model_name",onSave:q=>D("model_name",q),allowCustom:!0,allowDefault:!1}),m.jsx(Ae,{variant:"neutral",icon:m.jsx(Yu,{className:"size-4","aria-hidden":"true"}),children:"You need a Radient account or your own API keys to reach cloud providers. If you don't see more hosting providers and models here, add credentials or sign in to Radient."})]})}),m.jsx(CN,{}),m.jsx(_e,{title:"History settings",icon:E0,description:"Configure how much conversation history is retained and displayed. These are tools to help balance cost and performance by controlling the amount of data used by the agents.",children:m.jsxs("div",{className:"flex flex-col gap-4",children:[m.jsx(ni,{value:r.values.conversation_length,label:"Maximum conversation history",description:"Number of messages to keep in conversation history for context. More messages will make the agents have longer memory but more expensive to run. Recommended: 100",min:10,max:500,step:10,unit:"msgs",icon:Ew,isSaving:u==="conversation_length",onChange:q=>D("conversation_length",q)}),m.jsx(ni,{value:r.values.detail_length,label:"Detail view length",description:"Maximum number of messages to show in the detailed conversation view. Messages beyond this limit will be summarized. Shortening this will decrease costs but some important details could get lost from earlier messages. Recommended: 15",min:10,max:500,step:5,unit:"msgs",icon:b0,isSaving:u==="detail_length",onChange:q=>D("detail_length",q)}),m.jsx(ni,{value:r.values.max_learnings_history,label:"Maximum learnings history",description:"Agents note down specific insights and key learnings in memory which persist beyond the maximum conversation history and summarization. This setting controls the maximum number of learning items to retain. More items will make the agents acquire a longer history of knowledge from your conversations but more expensive to run. Recommended: 50",min:10,max:200,step:10,unit:"notes",icon:x0,isSaving:u==="max_learnings_history",onChange:q=>D("max_learnings_history",q)})]})}),m.jsx(_e,{title:"Configuration information",icon:Yu,description:"System information about the current configuration.",children:m.jsxs(vl,{children:[m.jsx(Ie,{label:"Version",value:m.jsx("span",{className:"text-mono-sm",children:r.version})}),m.jsx(Ie,{label:"Created",value:Jm(r.metadata.created_at)}),m.jsx(Ie,{label:"Last modified",value:Qm(r.metadata.last_modified)}),m.jsx(Ie,{label:"Description",value:r.metadata.description||"No description available"})]})})]}),m.jsx(_e,{title:"Appearance",icon:ig,description:"Customize the look and feel of Local Operator",sectionRef:E.appearance,dataTourTag:"settings-appearance-section",children:m.jsxs("div",{className:"flex flex-col gap-4",children:[m.jsx($N,{}),m.jsx(Vw,{value:t,label:"Show agent reasoning",description:"Adds the agent's Reasoning and Thinking rows to conversations. They stay closed until you open one.",onChange:async q=>e(q)})]})}),m.jsx(_e,{title:"Radient account",titleComponent:m.jsx(LN,{}),description:"Manage your Radient account, Radient Pass details, and credits.",sectionRef:E.radient,dataTourTag:"settings-radient-account-section",children:m.jsxs("div",{className:"flex flex-col gap-8",children:[m.jsx(TN,{onAfterCredentialUpdate:()=>{_(),A()}}),l&&m.jsxs(m.Fragment,{children:[m.jsx(NN,{}),m.jsx(qN,{})]})]})}),m.jsx(_e,{title:"Providers",icon:Ym,description:"Model providers, how you sign in to each, and which are connected.",sectionRef:E.providers,children:m.jsx(w0,{initialProviderId:M})}),m.jsx(_e,{title:"Backend settings",icon:pf,description:"Every setting the backend registry owns, searchable, with typed editors and scopes.",sectionRef:E.backend,children:m.jsx(AN,{focusKey:C,initialFilter:I})}),m.jsx(EN,{sessionId:h??void 0,sectionRef:E.integrations,highlightServer:N}),m.jsx(_e,{title:"API credentials",icon:Un,description:"Manage your API keys for various services and integrations",sectionRef:E.credentials,dataTourTag:"settings-api-credentials-section",children:m.jsx(_N,{})}),m.jsx("div",{ref:E.updates,children:m.jsx(xN,{})})]})]})})]}):m.jsx("div",{className:"flex h-full w-full items-center justify-center bg-canvas p-6",children:m.jsx(Ae,{variant:"warning",className:"w-full max-w-xl",children:"Your settings could not be loaded."})})};export{JN as SettingsPage};
165
+ `).map(w=>w.trim()).filter(Boolean)}:{url:f}}}),n(""),s(""),c(""),l(""),e()}catch(w){v(w instanceof Error?w.message:"The server could not be added.")}finally{x(!1)}};return m.jsxs("form",{className:"flex flex-col gap-3 rounded-md border border-control bg-surface p-4",onSubmit:w=>{w.preventDefault(),b()},children:[m.jsxs("div",{className:"flex flex-col gap-1",children:[m.jsx(mt,{htmlFor:"mcp-add-name",children:"Name"}),m.jsx(bt,{id:"mcp-add-name",value:r,onChange:w=>n(w.target.value),required:!0})]}),m.jsxs("fieldset",{className:"flex gap-2",children:[m.jsx("legend",{className:"sr-only",children:"Server transport"}),m.jsx(V,{type:"button",variant:a==="command"?"secondary":"ghost",size:"sm",onClick:()=>i("command"),children:"Local command"}),m.jsx(V,{type:"button",variant:a==="url"?"secondary":"ghost",size:"sm",onClick:()=>i("url"),children:"Remote URL"})]}),a==="command"?m.jsxs(m.Fragment,{children:[m.jsxs("div",{className:"flex flex-col gap-1",children:[m.jsx(mt,{htmlFor:"mcp-add-command",children:"Command"}),m.jsx(bt,{id:"mcp-add-command",value:o,onChange:w=>s(w.target.value),className:"font-mono",required:!0})]}),m.jsxs("div",{className:"flex flex-col gap-1",children:[m.jsx(mt,{htmlFor:"mcp-add-args",children:"Arguments, one per line"}),m.jsx("textarea",{id:"mcp-add-args",value:u,onChange:w=>c(w.target.value),rows:2,className:"rounded-sm border border-control bg-surface p-2 font-mono text-body-sm text-ink"})]})]}):m.jsxs("div",{className:"flex flex-col gap-1",children:[m.jsx(mt,{htmlFor:"mcp-add-url",children:"URL"}),m.jsx(bt,{id:"mcp-add-url",type:"url",value:f,onChange:w=>l(w.target.value),className:"font-mono",required:!0}),m.jsx("p",{className:"text-meta text-ink-dim",children:"No inline credentials or query parameters; secrets are referenced from the credential manager."})]}),m.jsxs("fieldset",{className:"flex gap-2",children:[m.jsx("legend",{className:"sr-only",children:"Configuration scope"}),m.jsx(V,{type:"button",variant:d==="global"?"secondary":"ghost",size:"sm",onClick:()=>h("global"),children:"Global"}),m.jsx(V,{type:"button",variant:d==="project"?"secondary":"ghost",size:"sm",onClick:()=>h("project"),children:"This project"})]}),y&&m.jsx(Ae,{variant:"danger",children:y}),m.jsx("div",{children:m.jsxs(V,{type:"submit",variant:"primary",size:"sm",disabled:p||!r||!(a==="command"?o:f),children:[p?m.jsx(Ge,{size:"sm"}):null,"Add server"]})})]})},EN=({sessionId:t,sectionRef:e,highlightServer:r})=>{const n=Um(),a=Km(n.data,"mcp"),i=zm(),[o,s]=T.useState(null),[u,c]=T.useState(null),[f,l]=T.useState(!1),d=Sn({queryKey:km.list(t??""),queryFn:()=>{if(!t)throw new Error("No conversation selected.");return nr({op:"mcp.list",sessionId:t}).then(b=>b.data)},enabled:a&&!!t,staleTime:1e4}),h=d.data?.servers??[],y=T.useRef(null),v=T.useRef(null);T.useEffect(()=>{!r||h.length===0||v.current!==r&&h.some(b=>b.name===r)&&(v.current=r,y.current?.scrollIntoView({block:"center",behavior:"smooth"}))},[r,h]);const p=T.useCallback(()=>{t&&i.invalidateQueries({queryKey:km.list(t)})},[i,t]),x=T.useCallback(async(b,w,S={})=>{if(t){c(null);try{await nr({op:"mcp.control",sessionId:t,control:{action:b,name:w,...S}}),p()}catch(g){c(g instanceof Error?g.message:"The MCP change could not be completed.")}}},[t,p]);return a?t?m.jsx(_e,{title:"Integrations",description:"MCP servers connect agents to your tools and accounts. A connected server is a working transport; the account behind it may still need its own sign-in.",sectionRef:e,children:m.jsxs("div",{className:"flex flex-col gap-4",children:[u&&m.jsx(Ae,{variant:"danger",children:u}),d.isLoading&&m.jsx("div",{className:"flex h-24 items-center justify-center",children:m.jsx(Ge,{size:"lg",label:"Loading MCP servers"})}),d.isError&&m.jsx(Ae,{variant:"warning",children:m.jsxs("div",{className:"flex items-center justify-between gap-3",children:[m.jsx("span",{children:"MCP servers could not be loaded."}),m.jsx(V,{variant:"secondary",size:"sm",onClick:()=>void d.refetch(),children:"Retry"})]})}),d.isSuccess&&h.length===0&&m.jsx("p",{className:"text-body-sm text-ink-muted",children:"No MCP servers configured yet. Add one below."}),h.length>0&&m.jsx("ul",{className:"flex flex-col gap-2",children:h.map(b=>{const w=b.status==="connected",S=b.name===r;return m.jsxs("li",{ref:S?y:void 0,className:Nt("flex flex-col gap-2 rounded-md border border-control bg-surface p-3",S&&"border-accent bg-elevated"),children:[m.jsxs("div",{className:"flex items-center justify-between gap-3",children:[m.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[m.jsx("span",{className:"truncate font-medium text-body text-ink",children:b.name}),b.scope&&m.jsx(Lr,{variant:"neutral",children:b.scope}),b.transport&&m.jsx(Lr,{variant:"outline",children:b.transport})]}),m.jsx(Lr,{variant:w?"success":b.status==="connecting"?"info":"neutral",children:b.status??"unknown"})]}),typeof b.tool_count=="number"&&m.jsxs("p",{className:"text-meta text-ink-dim",children:[b.tool_count," tools available"]}),b.error&&m.jsx("p",{className:"text-body-sm text-danger",children:b.error}),m.jsxs("p",{className:"text-meta text-ink-dim",children:["Account authorization:"," ",b.downstream_authorization==="unknown"||!b.downstream_authorization?"unknown":b.downstream_authorization]}),m.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[w?m.jsxs(V,{variant:"secondary",size:"sm",onClick:()=>{s(null),x("disconnect",b.name,{confirmed:!0})},children:[m.jsx(Ym,{"aria-hidden":"true"}),"Disconnect"]}):m.jsxs(V,{variant:"secondary",size:"sm",onClick:()=>void x("connect",b.name),children:[m.jsx($w,{"aria-hidden":"true"}),"Connect"]}),m.jsxs(V,{variant:"ghost",size:"sm",onClick:()=>void x("reload",b.name),children:[m.jsx(Bx,{"aria-hidden":"true"}),"Reload"]}),b.transport==="http"&&b.transport_oauth_supported!==!1?m.jsx(V,{variant:"ghost",size:"sm",onClick:()=>void x("login",b.name),children:"Grant account access"}):b.setup_prompt?m.jsx(V,{variant:"ghost",size:"sm",onClick:()=>{navigator.clipboard.writeText(b.setup_prompt??"").catch(()=>{})},children:"Copy setup prompt"}):null,o===b.name?m.jsxs(m.Fragment,{children:[m.jsxs("span",{className:"text-body-sm text-ink",children:["Remove ",b.name,"?"]}),m.jsx(V,{variant:"danger",size:"sm",onClick:()=>{s(null),x("remove",b.name,{confirmed:!0,scope:b.scope==="project"?"project":"global"})},children:"Confirm removal"}),m.jsx(V,{variant:"ghost",size:"sm",onClick:()=>s(null),children:"Keep"})]}):m.jsxs(V,{variant:"ghost",size:"sm",className:"text-danger",onClick:()=>s(b.name),children:[m.jsx(Hm,{"aria-hidden":"true"}),"Remove"]})]})]},b.name)})}),f?m.jsx(jN,{sessionId:t,onAdded:()=>{l(!1),p()}}):m.jsx("div",{children:m.jsx(V,{variant:"secondary",size:"sm",onClick:()=>l(!0),"data-tour-tag":"mcp-add-server",children:"Add server"})})]})}):m.jsx(_e,{title:"Integrations",description:"MCP servers connect agents to your tools and accounts.",sectionRef:e,children:m.jsx("p",{className:"text-body-sm text-ink-muted",children:"Open a conversation to manage its MCP servers."})}):m.jsx(_e,{title:"Integrations",description:"MCP servers connect agents to your tools and accounts.",sectionRef:e,children:m.jsx(Ae,{variant:"warning",children:"Integration management needs a newer Local Operator backend. Update the backend and restart the app to manage MCP servers here."})})},TN=({onAfterCredentialUpdate:t})=>{const{isAuthenticated:e,user:r,isLoading:n,error:a,signOut:i}=r0(),o=Zm(f=>f.isSigningOut),s=T.useCallback(async()=>{try{await i()}catch(f){console.error("Error signing out:",f)}},[i]),u=T.useMemo(()=>{if(!e||!r?.radientUser)return null;const{account:f,identity:l}=r.radientUser;return m.jsxs(m.Fragment,{children:[m.jsxs(vl,{children:[m.jsx(Ie,{label:"Status",value:m.jsxs("span",{className:"inline-flex items-center gap-2",children:["Connected",m.jsx(Lr,{variant:"success",className:"capitalize",children:f.status})]})}),m.jsx(Ie,{label:"Name",value:f.name||"Not provided"}),m.jsx(Ie,{label:"Email",value:f.email}),m.jsx(Ie,{label:"Account ID",value:m.jsx("span",{className:"text-mono-sm",children:f.id})}),m.jsx(Ie,{label:"Tenant ID",value:m.jsx("span",{className:"text-mono-sm",children:f.tenant_id})}),m.jsx(Ie,{label:"Provider",value:m.jsx("span",{className:"capitalize",children:l.provider})}),m.jsx(Ie,{label:"Created",value:Jm(f.created_at)})]}),m.jsxs("div",{className:"mt-8",children:[m.jsx("p",{className:"text-body-sm text-ink-muted",children:"Need to sign out or switch accounts?"}),m.jsxs(V,{variant:"danger",className:"mt-3",onClick:s,children:[m.jsx(n0,{}),"Sign out from Radient"]})]})]})},[e,r?.radientUser,s]),c=T.useMemo(()=>e&&r?null:m.jsxs("div",{children:[m.jsx("p",{className:"text-body-sm text-ink-muted",children:"You are not currently signed in to Radient. Sign in to access your account details or sign up to get free credits and unified access to models, tools, and more with Radient Pass. Radient's automatic model router will automatically select the best model for your agents to balance cost and performance. It is often cheaper to use Radient Pass than to use single AI providers due to automatic cost optimization."}),m.jsx("div",{className:"mt-6",children:m.jsx(A0,{titleText:"",onAfterCredentialUpdate:t,descriptionText:"",onSignInSuccess:()=>{}})})]}),[e,r,t]);return n||o?m.jsx("div",{className:"flex min-h-36 items-center justify-center",children:m.jsx(Ge,{size:"lg",label:"Loading account"})}):e&&r?.radientUser?u:m.jsxs("div",{className:"flex flex-col gap-4",children:[a&&m.jsxs(Ae,{variant:"danger",children:["Error checking account status:"," ",a instanceof Error?a.message:String(a)]}),c]})},CN=()=>{const{data:t,isLoading:e,error:r,refetch:n}=Gw(),a=Hw(),[i,o]=T.useState(""),[s,u]=T.useState(!1);T.useEffect(()=>{o(t?.content??""),u(!1)},[t]);const c=y=>{const v=y.target.value;o(v),u(v!==(t?.content??""))},f=async()=>{if(!(!s||a.isPending))try{const y={content:i};await a.mutateAsync(y),await n(),u(!1)}catch(y){console.error("Error updating system prompt:",y)}},l=()=>{o(t?.content??""),u(!1)},d=a.isPending,h=()=>m.jsxs("div",{className:"flex flex-col gap-4",children:[m.jsxs("div",{className:"flex flex-col gap-2",children:[m.jsx(mt,{htmlFor:"app-system-prompt",children:"Instructions"}),m.jsx(Zu,{id:"app-system-prompt",name:"systemPrompt",value:i,onChange:c,placeholder:"Enter instructions for how all agents should behave and respond to your requests...",className:"min-h-50"})]}),m.jsxs("div",{className:"flex gap-3",children:[m.jsxs(V,{variant:"primary",onClick:f,disabled:!s||d,children:[d?m.jsx(Ge,{size:"sm"}):m.jsx(a0,{}),d?"Saving...":"Save changes"]}),m.jsx(V,{onClick:l,disabled:!s||d,children:"Cancel"})]}),t?.last_modified&&m.jsxs("p",{className:"text-ink-dim text-meta",children:["Last modified:"," ",m.jsx("span",{className:"font-mono text-mono-sm",children:Qm(t.last_modified)})]})]});return m.jsx(_e,{title:"System prompt",icon:P0,description:"Every Local Operator agent receives this prompt in addition to its own instructions, so it is the place for baseline expectations and for details you want every agent to know about you, such as your name, location, or preferences. It is sent to your selected hosting provider.",children:e?m.jsx("div",{className:"flex min-h-50 items-center justify-center",children:m.jsx(Ge,{size:"lg",label:"Loading system prompt"})}):r?m.jsxs(Ae,{variant:"danger",children:["Failed to load system prompt:"," ",r instanceof Error?r.message:"Unknown error"]}):h()})},kN={localOperatorDark:Cw,localOperatorLight:Bw,radient:Ow,dracula:Rw,dune:xw,sage:Aw,monokai:zx,tokyoNight:Iw,iceberg:qw,neon:Uw,obsidian:ig,synth:fw},IN=({id:t})=>m.jsxs("div",{"data-theme":t,"aria-hidden":"true",className:"flex h-full bg-canvas",children:[m.jsxs("div",{className:"flex w-1/4 flex-col gap-1 bg-sunken p-1.5",children:[m.jsx("span",{className:"flex h-2.5 items-center rounded-xs bg-accent-wash px-1",children:m.jsx("span",{className:"h-1 w-full rounded-xs bg-accent"})}),m.jsx("span",{className:"mx-1 h-1 w-2/3 rounded-xs bg-ink-dim"}),m.jsx("span",{className:"mx-1 h-1 w-1/2 rounded-xs bg-ink-dim"})]}),m.jsxs("div",{className:"flex flex-1 flex-col justify-between p-2",children:[m.jsxs("div",{className:"flex flex-col gap-1.5 rounded-sm bg-surface p-2",children:[m.jsx("span",{className:"h-1.5 w-3/5 rounded-xs bg-ink"}),m.jsx("span",{className:"h-1 w-full rounded-xs bg-ink-dim"}),m.jsx("span",{className:"h-1 w-4/5 rounded-xs bg-ink-dim"})]}),m.jsxs("div",{className:"flex items-center gap-1.5",children:[m.jsx("span",{className:"h-3 w-9 rounded-xs bg-accent"}),m.jsx("span",{className:"h-3 w-6 rounded-xs border border-control"})]})]})]}),MN=({id:t,name:e,description:r,isSelected:n,onSelect:a})=>{const i=kN[t];return m.jsxs("button",{type:"button","aria-pressed":n,onClick:a,className:Nt("flex flex-col gap-2 rounded-lg p-2 text-left transition-colors duration-fast ease-out-quart",n?"bg-accent-wash":"hover:bg-surface"),children:[m.jsx("span",{className:Nt("block aspect-16/10 overflow-hidden rounded-md border transition-colors duration-fast ease-out-quart",n?"border-accent":"border-hairline"),children:m.jsx(IN,{id:t})}),m.jsxs("span",{className:"flex items-center gap-2 px-1",children:[m.jsx(i,{size:14,className:"shrink-0 text-ink-dim","aria-hidden":"true"}),m.jsx("span",{className:Nt("min-w-0 flex-1 truncate text-body-sm text-ink",n&&"font-medium"),children:e}),n&&m.jsx(qm,{size:14,className:"shrink-0 text-accent","aria-hidden":"true"})]}),m.jsx("span",{className:"px-1 pb-1 text-meta text-ink-muted",children:r})]})},$N=()=>{const{themeName:t,setTheme:e}=Qu(),r=T.useMemo(()=>{const n=Object.values(Fx);return[{label:"Dark",items:n.filter(a=>a.theme.palette.mode==="dark")},{label:"Light",items:n.filter(a=>a.theme.palette.mode==="light")}].filter(a=>a.items.length>0)},[]);return m.jsx("div",{className:"flex flex-col gap-6",children:r.map(n=>m.jsxs("div",{children:[m.jsx("h3",{className:"px-1 pb-2 text-meta text-ink-dim",children:n.label}),m.jsx("div",{className:"grid grid-cols-[repeat(auto-fill,minmax(240px,1fr))] gap-2",children:n.items.map(({id:a,name:i,description:o})=>m.jsx(MN,{id:a,name:i,description:o,isSelected:a===t,onSelect:()=>e(a)},a))})]},n.label))})},NN=()=>{const{data:t,isLoading:e,error:r}=kO({enabled:!0});return m.jsxs("div",{children:[m.jsxs("h3",{className:"mb-3 flex items-center gap-2 text-heading text-ink",children:[m.jsx(gw,{size:16,className:"shrink-0 text-ink-dim"}),"Radient Pass"]}),e&&m.jsx(Lm,{className:"h-6 w-36"}),r&&m.jsxs(Ae,{variant:"warning",children:["Could not load your credit balance. ",r.message]}),t&&!e&&!r&&m.jsxs("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-center",children:[m.jsxs("p",{className:"flex-1 text-body-sm text-ink-muted",children:["Available credits"," ",m.jsx("span",{className:"font-medium text-ink",children:t.balance.toFixed(2)})]}),m.jsx(V,{variant:"secondary",size:"sm",asChild:!0,children:m.jsxs("a",{href:"https://console.radienthq.com/dashboard/billing",target:"_blank",rel:"noopener noreferrer",children:[m.jsx(vw,{}),"Add credits"]})})]})]})},RN=[{id:"credits",label:"Credits"},{id:"tokens",label:"Tokens"}],DN=({active:t,label:e,payload:r,unit:n})=>!t||!r?.length?null:m.jsxs("div",{className:"rounded-md border border-hairline bg-elevated px-3 py-2 shadow-overlay",children:[m.jsx("p",{className:"text-meta text-ink-dim",children:e}),m.jsxs("p",{className:"text-mono text-ink",children:[r[0]?.value," ",n]})]}),qN=()=>{const[t,e]=T.useState("credits"),r=T.useMemo(()=>{const s=new Date,u=Xw(s);return{start_date:gf(u),end_date:gf(s),rollup:"daily"}},[]),{data:n,isLoading:a,error:i}=$O(r,{enabled:!0}),o=T.useMemo(()=>n?.data_points?[...n.data_points].sort((u,c)=>ai(u.timestamp).getTime()-ai(c.timestamp).getTime()).map(u=>({date:w0(ai(u.timestamp),"MMM dd"),credits:Number.parseFloat(u.total_cost.toFixed(2)),tokens:u.total_tokens})):[],[n]);return m.jsxs("div",{children:[m.jsxs("div",{className:"mb-5 flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between",children:[m.jsxs("h3",{className:"flex items-center gap-2 text-heading text-ink",children:[m.jsx(pw,{size:16,className:"shrink-0 text-ink-dim"}),"Usage (last 30 days)"]}),m.jsxs("fieldset",{className:"m-0 w-fit border-0 p-0",children:[m.jsx("legend",{className:"sr-only",children:"Usage metric"}),m.jsx("div",{className:"flex gap-0.5 rounded-md bg-sunken p-0.5",children:RN.map(({id:s,label:u})=>m.jsx(V,{variant:"ghost",size:"sm","aria-pressed":t===s,onClick:()=>e(s),className:Nt(t===s&&"bg-surface text-ink hover:bg-surface"),children:u},s))})]})]}),a&&m.jsx(Lm,{className:"h-62 w-full"}),i&&m.jsxs(Ae,{variant:"warning",children:["Could not load your usage data. ",i.message]}),!a&&!i&&n&&o.length>0&&m.jsx("div",{className:Nt("h-62 w-full","[&_.recharts-cartesian-grid_line]:stroke-hairline","[&_.recharts-cartesian-axis-tick-value]:fill-ink-dim [&_.recharts-cartesian-axis-tick-value]:text-meta","[&_.recharts-line-curve]:stroke-accent","[&_.recharts-active-dot_circle]:fill-accent","[&_.recharts-tooltip-cursor]:stroke-hairline"),children:m.jsx(RP,{width:"100%",height:"100%",children:m.jsxs(gN,{data:o,margin:{top:5,right:20,left:10,bottom:5},children:[m.jsx(xx,{strokeDasharray:"3 3"}),m.jsx(Qa,{dataKey:"date",tickLine:!1,axisLine:!1}),m.jsx(ei,{tickLine:!1,axisLine:!1,width:48}),m.jsx(Ye,{content:m.jsx(DN,{unit:t==="credits"?"credits":"tokens"})}),m.jsx(Cn,{type:"monotone",dataKey:t,strokeWidth:2,dot:!1,activeDot:{r:4,strokeWidth:0},name:t==="credits"?"Credits consumed":"Tokens used"})]})})}),!a&&!i&&(!n||o.length===0)&&m.jsx("p",{className:"text-body-sm text-ink-muted",children:"No usage recorded in the last 30 days."})]})},LN=()=>m.jsxs("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between",children:[m.jsxs("h2",{className:"flex items-center gap-2 text-heading text-ink",children:[m.jsx(O0,{size:16,className:"shrink-0 text-ink-dim"}),"Radient account"]}),m.jsx(V,{variant:"secondary",size:"sm",className:"self-start sm:self-center",asChild:!0,children:m.jsxs("a",{href:"https://console.radienthq.com",target:"_blank",rel:"noopener noreferrer",children:["Go to Radient console",m.jsx(Vm,{})]})})]}),JN=()=>{const t=Qu(q=>q.showAgentReasoning),e=Qu(q=>q.setShowAgentReasoning),{data:r,isLoading:n,isFetching:a,error:i,refetch:o}=i0(),s=o0(),[u,c]=T.useState(null),f=Zm(),{isAuthenticated:l,isLoading:d}=hl(),h=s0(q=>q.activeSessionId),[y,v]=T.useState("general"),[p,x]=T.useState(!1),b=T.useRef(null),w=T.useRef(null),{startTour:S}=u0(),g=c0(),{data:O,refetch:A}=Xm(),{refreshModels:_}=l0(),P=T.useMemo(()=>O?.keys?[...O.keys].sort():[],[O?.keys]),k=T.useRef({keys:"",hosting:void 0});T.useEffect(()=>{const q=P.join(","),U=r?.values?.hosting;(k.current.keys!==q||k.current.hosting!==U)&&(k.current={keys:q,hosting:U},_().catch(L=>{console.error("Failed to refresh models after credentials or hosting change:",L)}))},[P,r?.values?.hosting,_]);const E=T.useRef({general:T.useRef(null),radient:T.useRef(null),integrations:T.useRef(null),appearance:T.useRef(null),credentials:T.useRef(null),providers:T.useRef(null),backend:T.useRef(null),updates:T.useRef(null)}).current,C=T.useMemo(()=>new URLSearchParams(g.search).get("setting"),[g.search]),I=T.useMemo(()=>new URLSearchParams(g.search).get("filter")??"",[g.search]),N=T.useMemo(()=>new URLSearchParams(g.search).get("mcp")??void 0,[g.search]),M=T.useMemo(()=>new URLSearchParams(g.search).get("provider"),[g.search]),R=T.useCallback(q=>{v(q),x(!0);const U=E[q],L=w.current;if(U?.current&&L){const Y=U.current.getBoundingClientRect().top-L.getBoundingClientRect().top;L.scrollHeight>L.clientHeight?L.scrollTo({top:Math.max(0,L.scrollTop+Y-80),behavior:"smooth"}):window.scrollTo({top:Math.max(0,U.current.getBoundingClientRect().top+window.scrollY-80),behavior:"smooth"}),clearTimeout(b.current??void 0),b.current=setTimeout(()=>{x(!1),b.current=null},800)}else x(!1)},[E]);T.useEffect(()=>{const q=setTimeout(()=>{const U=w.current;if(!U)return;const L=()=>{if(p)return;const K=U.getBoundingClientRect(),Y=K.height;let re="",ue=0;for(const[Ve,le]of Object.entries(E))if(le.current){const xe=le.current.getBoundingClientRect(),Xe=K.top,Ee=xe.top-Xe,_t=xe.bottom-Xe,tt=xe.height,pt=Math.max(0,Ee),jt=Math.min(Y,_t),rt=Math.max(0,jt-pt)/tt,ht=rt+(Ee<Y*.3?.1:0);ht>ue&&rt>.1&&(ue=ht,re=Ve)}re&&re!==y&&v(re)};return L(),U.addEventListener("scroll",L,{passive:!0}),()=>{U.removeEventListener("scroll",L),clearTimeout(b.current??void 0)}},100);return()=>clearTimeout(q)},[E,y,p]),T.useEffect(()=>{const q=new URLSearchParams(g.search),U=q.get("section"),L=q.get("setting")?"backend":U,K=L?E[L]:void 0;if(!L||!K)return;let Y=!1,re=Number.NaN,ue=0;const Ve=window.setTimeout(()=>{Y||(Y=!0,xe.disconnect(),R(L))},2e3),le=()=>{if(Y)return;const Xe=K.current;if(!Xe){ue=requestAnimationFrame(le);return}const Ee=Math.round(Xe.getBoundingClientRect().top+window.scrollY);if(Ee===re&&Ee>0){Y=!0,xe.disconnect(),window.clearTimeout(Ve),R(L);return}re=Ee,ue=requestAnimationFrame(le)},xe=new ResizeObserver(()=>{Y||(cancelAnimationFrame(ue),ue=requestAnimationFrame(le))});return w.current&&xe.observe(w.current),ue=requestAnimationFrame(le),()=>{Y=!0,cancelAnimationFrame(ue),xe.disconnect(),window.clearTimeout(Ve)}},[g.search,E,R]);const D=async(q,U)=>{c(q);try{await s.mutateAsync({[q]:U}),await o()}catch(L){console.error(`Error updating ${q}:`,L)}finally{c(null)}},F=n||d,z=IO(F,4e3);return i?m.jsx("div",{className:"flex h-full w-full items-center justify-center bg-canvas p-6",children:m.jsx(Ae,{variant:"warning",className:"w-full max-w-xl",children:m.jsxs("div",{className:"flex items-center justify-between gap-3",children:[m.jsx("span",{children:Gm("Your settings could not be loaded.",i)}),m.jsx(V,{variant:"secondary",size:"sm",className:"shrink-0",onClick:()=>void o(),disabled:a,children:a?"Retrying":"Retry"})]})})}):F?m.jsxs("div",{role:"status",className:"flex h-full w-full flex-col items-center justify-center gap-3 bg-canvas",children:[m.jsx(Ge,{size:"lg",label:z?void 0:"Loading settings"}),z&&m.jsx("p",{className:"max-w-sm text-center text-body-sm text-ink-muted",children:"The Local Operator server is taking longer than usual to answer. If it does not respond, you will be able to retry from here."})]}):r?m.jsxs("div",{className:"flex h-full w-full overflow-hidden bg-canvas",children:[m.jsx("div",{className:"w-12 shrink-0 overflow-y-auto border-r border-hairline min-[1040px]:w-55",children:m.jsx(f0,{activeSection:y,onSelectSection:R,sections:d0})}),m.jsx("div",{ref:w,"data-settings-content":!0,"data-tour-tag":"settings-general-section",className:"flex-1 overflow-y-auto overflow-x-hidden p-4 sm:p-6 md:p-8",children:m.jsxs("div",{className:"mx-auto flex w-full max-w-4xl flex-col gap-8 pb-8",children:[m.jsx(S0,{title:"Settings",icon:pf}),m.jsxs("div",{className:"flex flex-col gap-8",children:[m.jsxs("div",{ref:E.general,className:"flex flex-col gap-8",children:[m.jsx(_e,{title:"User profile",icon:p0,description:`Your user profile information displayed in the application. This information is not provided to the agents. ${l?"These details are provided through your Radient account.":""}`,children:m.jsxs("div",{className:"flex flex-col gap-4",children:[m.jsx(hf,{value:f.profile.name,label:"Display name",placeholder:"Enter your name...",isSaving:u==="user_name",onSave:async q=>{c("user_name");try{f.updateName(q)}finally{c(null)}},readOnly:l}),m.jsx(hf,{value:f.profile.email,label:"Email address",placeholder:"Enter your email...",isSaving:u==="user_email",onSave:async q=>{c("user_email");try{f.updateEmail(q)}finally{c(null)}},readOnly:l})]})}),m.jsx(_e,{title:"Application tour",description:"Missed the application onboarding tour or want a refresher? Start it again here.",children:m.jsxs(V,{variant:"secondary",onClick:()=>{S({forceModalCompleted:!0})},children:[m.jsx(h0,{}),"Take the tour"]})}),m.jsx(_e,{title:"Model settings",icon:v0,description:"Configure the default AI model and hosting providers used for generating responses. This will be used for all agents that don't have a specific model or hosting provider configured. You can override these settings for individual agents in the agent settings.",children:m.jsxs("div",{className:"flex flex-col gap-4",children:[m.jsx(y0,{value:r.values.hosting,isSaving:u==="hosting",onSave:q=>D("hosting",q),filterByCredentials:!0,allowCustom:!0,allowDefault:!1,emptyHelperText:"No hosting providers available. Add one in API credentials, in the list on the left."}),m.jsx(m0,{value:r.values.model_name,hostingId:r.values.hosting,isSaving:u==="model_name",onSave:q=>D("model_name",q),allowCustom:!0,allowDefault:!1}),m.jsx(Ae,{variant:"neutral",icon:m.jsx(Yu,{className:"size-4","aria-hidden":"true"}),children:"You need a Radient account or your own API keys to reach cloud providers. If you don't see more hosting providers and models here, add credentials or sign in to Radient."})]})}),m.jsx(CN,{}),m.jsx(_e,{title:"History settings",icon:E0,description:"Configure how much conversation history is retained and displayed. These are tools to help balance cost and performance by controlling the amount of data used by the agents.",children:m.jsxs("div",{className:"flex flex-col gap-4",children:[m.jsx(ni,{value:r.values.conversation_length,label:"Maximum conversation history",description:"Number of messages to keep in conversation history for context. More messages will make the agents have longer memory but more expensive to run. Recommended: 100",min:10,max:500,step:10,unit:"msgs",icon:Ew,isSaving:u==="conversation_length",onChange:q=>D("conversation_length",q)}),m.jsx(ni,{value:r.values.detail_length,label:"Detail view length",description:"Maximum number of messages to show in the detailed conversation view. Messages beyond this limit will be summarized. Shortening this will decrease costs but some important details could get lost from earlier messages. Recommended: 15",min:10,max:500,step:5,unit:"msgs",icon:g0,isSaving:u==="detail_length",onChange:q=>D("detail_length",q)}),m.jsx(ni,{value:r.values.max_learnings_history,label:"Maximum learnings history",description:"Agents note down specific insights and key learnings in memory which persist beyond the maximum conversation history and summarization. This setting controls the maximum number of learning items to retain. More items will make the agents acquire a longer history of knowledge from your conversations but more expensive to run. Recommended: 50",min:10,max:200,step:10,unit:"notes",icon:b0,isSaving:u==="max_learnings_history",onChange:q=>D("max_learnings_history",q)})]})}),m.jsx(_e,{title:"Configuration information",icon:Yu,description:"System information about the current configuration.",children:m.jsxs(vl,{children:[m.jsx(Ie,{label:"Version",value:m.jsx("span",{className:"text-mono-sm",children:r.version})}),m.jsx(Ie,{label:"Created",value:Jm(r.metadata.created_at)}),m.jsx(Ie,{label:"Last modified",value:Qm(r.metadata.last_modified)}),m.jsx(Ie,{label:"Description",value:r.metadata.description||"No description available"})]})})]}),m.jsx(_e,{title:"Appearance",icon:ig,description:"Customize the look and feel of Local Operator",sectionRef:E.appearance,dataTourTag:"settings-appearance-section",children:m.jsxs("div",{className:"flex flex-col gap-4",children:[m.jsx($N,{}),m.jsx(Vw,{value:t,label:"Show agent reasoning",description:"Adds the agent's Reasoning and Thinking rows to conversations. They stay closed until you open one.",onChange:async q=>e(q)})]})}),m.jsx(_e,{title:"Radient account",titleComponent:m.jsx(LN,{}),description:"Manage your Radient account, Radient Pass details, and credits.",sectionRef:E.radient,dataTourTag:"settings-radient-account-section",children:m.jsxs("div",{className:"flex flex-col gap-8",children:[m.jsx(TN,{onAfterCredentialUpdate:()=>{_(),A()}}),l&&m.jsxs(m.Fragment,{children:[m.jsx(NN,{}),m.jsx(qN,{})]})]})}),m.jsx(_e,{title:"Providers",icon:Ym,description:"Model providers, how you sign in to each, and which are connected.",sectionRef:E.providers,children:m.jsx(x0,{initialProviderId:M})}),m.jsx(_e,{title:"Backend settings",icon:pf,description:"Every setting the backend registry owns, searchable, with typed editors and scopes.",sectionRef:E.backend,children:m.jsx(AN,{focusKey:C,initialFilter:I})}),m.jsx(EN,{sessionId:h??void 0,sectionRef:E.integrations,highlightServer:N}),m.jsx(_e,{title:"API credentials",icon:Un,description:"Manage your API keys for various services and integrations",sectionRef:E.credentials,dataTourTag:"settings-api-credentials-section",children:m.jsx(_N,{})}),m.jsx("div",{ref:E.updates,children:m.jsx(xN,{})})]})]})})]}):m.jsx("div",{className:"flex h-full w-full items-center justify-center bg-canvas p-6",children:m.jsx(Ae,{variant:"warning",className:"w-full max-w-xl",children:"Your settings could not be loaded."})})};export{JN as SettingsPage};
@@ -1,6 +1,6 @@
1
- import{c as a}from"./icon-BIaTDBQz.js";/**
1
+ import{a}from"./icon-D9xnujmI.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 e=[["path",{d:"M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7",key:"1m0v6g"}],["path",{d:"M18.375 2.625a1 1 0 0 1 3 3l-9.013 9.014a2 2 0 0 1-.853.505l-2.873.84a.5.5 0 0 1-.62-.62l.84-2.873a2 2 0 0 1 .506-.852z",key:"ohrbg2"}]],c=a("square-pen",e);export{c as S};
6
+ */const e=[["path",{d:"M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7",key:"1m0v6g"}],["path",{d:"M18.375 2.625a1 1 0 0 1 3 3l-9.013 9.014a2 2 0 0 1-.853.505l-2.873.84a.5.5 0 0 1-.62-.62l.84-2.873a2 2 0 0 1 .506-.852z",key:"ohrbg2"}]],r=a("square-pen",e);export{r as S};
@@ -1 +1 @@
1
- import{s as W,a as P,S as N}from"./chunk-AEK57VVT-CIZ7-t01.js";import{_ as u,c as t,d as H,l as S,e as C,k as z,u as U}from"./mermaid.core-CFY9BM3R.js";import{G as F}from"./graph-CUJVKfm_.js";import{l as O}from"./layout-zNSVRDKv.js";import{l as J,k as X}from"./step-DMJAOHzS.js";import"./chunk-RZ5BOZE2-byZRPh67.js";import"./index-DZnGa8Vt.js";import"./icon-BIaTDBQz.js";import"./_baseUniq-DlDqTbuA.js";import"./_basePickBy-CefSvQ3Q.js";var L={},D=u((e,i)=>{L[e]=i},"set"),Y=u(e=>L[e],"get"),G=u(()=>Object.keys(L),"keys"),I=u(()=>G().length,"size"),$={get:Y,set:D,keys:G,size:I},j=u(e=>e.append("circle").attr("class","start-state").attr("r",t().state.sizeUnit).attr("cx",t().state.padding+t().state.sizeUnit).attr("cy",t().state.padding+t().state.sizeUnit),"drawStartState"),q=u(e=>e.append("line").style("stroke","grey").style("stroke-dasharray","3").attr("x1",t().state.textHeight).attr("class","divider").attr("x2",t().state.textHeight*2).attr("y1",0).attr("y2",0),"drawDivider"),Z=u((e,i)=>{const d=e.append("text").attr("x",2*t().state.padding).attr("y",t().state.textHeight+2*t().state.padding).attr("font-size",t().state.fontSize).attr("class","state-title").text(i.id),o=d.node().getBBox();return e.insert("rect",":first-child").attr("x",t().state.padding).attr("y",t().state.padding).attr("width",o.width+2*t().state.padding).attr("height",o.height+2*t().state.padding).attr("rx",t().state.radius),d},"drawSimpleState"),K=u((e,i)=>{const d=u(function(l,B,m){const k=l.append("tspan").attr("x",2*t().state.padding).text(B);m||k.attr("dy",t().state.textHeight)},"addTspan"),n=e.append("text").attr("x",2*t().state.padding).attr("y",t().state.textHeight+1.3*t().state.padding).attr("font-size",t().state.fontSize).attr("class","state-title").text(i.descriptions[0]).node().getBBox(),g=n.height,x=e.append("text").attr("x",t().state.padding).attr("y",g+t().state.padding*.4+t().state.dividerMargin+t().state.textHeight).attr("class","state-description");let a=!0,s=!0;i.descriptions.forEach(function(l){a||(d(x,l,s),s=!1),a=!1});const y=e.append("line").attr("x1",t().state.padding).attr("y1",t().state.padding+g+t().state.dividerMargin/2).attr("y2",t().state.padding+g+t().state.dividerMargin/2).attr("class","descr-divider"),p=x.node().getBBox(),c=Math.max(p.width,n.width);return y.attr("x2",c+3*t().state.padding),e.insert("rect",":first-child").attr("x",t().state.padding).attr("y",t().state.padding).attr("width",c+2*t().state.padding).attr("height",p.height+g+2*t().state.padding).attr("rx",t().state.radius),e},"drawDescrState"),Q=u((e,i,d)=>{const o=t().state.padding,n=2*t().state.padding,g=e.node().getBBox(),x=g.width,a=g.x,s=e.append("text").attr("x",0).attr("y",t().state.titleShift).attr("font-size",t().state.fontSize).attr("class","state-title").text(i.id),p=s.node().getBBox().width+n;let c=Math.max(p,x);c===x&&(c=c+n);let l;const B=e.node().getBBox();i.doc,l=a-o,p>x&&(l=(x-c)/2+o),Math.abs(a-B.x)<o&&p>x&&(l=a-(p-x)/2);const m=1-t().state.textHeight;return e.insert("rect",":first-child").attr("x",l).attr("y",m).attr("class",d?"alt-composit":"composit").attr("width",c).attr("height",B.height+t().state.textHeight+t().state.titleShift+1).attr("rx","0"),s.attr("x",l+o),p<=x&&s.attr("x",a+(c-n)/2-p/2+o),e.insert("rect",":first-child").attr("x",l).attr("y",t().state.titleShift-t().state.textHeight-t().state.padding).attr("width",c).attr("height",t().state.textHeight*3).attr("rx",t().state.radius),e.insert("rect",":first-child").attr("x",l).attr("y",t().state.titleShift-t().state.textHeight-t().state.padding).attr("width",c).attr("height",B.height+3+2*t().state.textHeight).attr("rx",t().state.radius),e},"addTitleAndBox"),V=u(e=>(e.append("circle").attr("class","end-state-outer").attr("r",t().state.sizeUnit+t().state.miniPadding).attr("cx",t().state.padding+t().state.sizeUnit+t().state.miniPadding).attr("cy",t().state.padding+t().state.sizeUnit+t().state.miniPadding),e.append("circle").attr("class","end-state-inner").attr("r",t().state.sizeUnit).attr("cx",t().state.padding+t().state.sizeUnit+2).attr("cy",t().state.padding+t().state.sizeUnit+2)),"drawEndState"),tt=u((e,i)=>{let d=t().state.forkWidth,o=t().state.forkHeight;if(i.parentId){let n=d;d=o,o=n}return e.append("rect").style("stroke","black").style("fill","black").attr("width",d).attr("height",o).attr("x",t().state.padding).attr("y",t().state.padding)},"drawForkJoinState"),et=u((e,i,d,o)=>{let n=0;const g=o.append("text");g.style("text-anchor","start"),g.attr("class","noteText");let x=e.replace(/\r\n/g,"<br/>");x=x.replace(/\n/g,"<br/>");const a=x.split(z.lineBreakRegex);let s=1.25*t().state.noteMargin;for(const y of a){const p=y.trim();if(p.length>0){const c=g.append("tspan");if(c.text(p),s===0){const l=c.node().getBBox();s+=l.height}n+=s,c.attr("x",i+t().state.noteMargin),c.attr("y",d+n+1.25*t().state.noteMargin)}}return{textWidth:g.node().getBBox().width,textHeight:n}},"_drawLongText"),at=u((e,i)=>{i.attr("class","state-note");const d=i.append("rect").attr("x",0).attr("y",t().state.padding),o=i.append("g"),{textWidth:n,textHeight:g}=et(e,0,0,o);return d.attr("height",g+2*t().state.noteMargin),d.attr("width",n+t().state.noteMargin*2),d},"drawNote"),_=u(function(e,i){const d=i.id,o={id:d,label:i.id,width:0,height:0},n=e.append("g").attr("id",d).attr("class","stateGroup");i.type==="start"&&j(n),i.type==="end"&&V(n),(i.type==="fork"||i.type==="join")&&tt(n,i),i.type==="note"&&at(i.note.text,n),i.type==="divider"&&q(n),i.type==="default"&&i.descriptions.length===0&&Z(n,i),i.type==="default"&&i.descriptions.length>0&&K(n,i);const g=n.node().getBBox();return o.width=g.width+2*t().state.padding,o.height=g.height+2*t().state.padding,$.set(d,o),o},"drawState"),A=0,it=u(function(e,i,d){const o=u(function(s){switch(s){case N.relationType.AGGREGATION:return"aggregation";case N.relationType.EXTENSION:return"extension";case N.relationType.COMPOSITION:return"composition";case N.relationType.DEPENDENCY:return"dependency"}},"getRelationType");i.points=i.points.filter(s=>!Number.isNaN(s.y));const n=i.points,g=J().x(function(s){return s.x}).y(function(s){return s.y}).curve(X),x=e.append("path").attr("d",g(n)).attr("id","edge"+A).attr("class","transition");let a="";if(t().state.arrowMarkerAbsolute&&(a=window.location.protocol+"//"+window.location.host+window.location.pathname+window.location.search,a=a.replace(/\(/g,"\\("),a=a.replace(/\)/g,"\\)")),x.attr("marker-end","url("+a+"#"+o(N.relationType.DEPENDENCY)+"End)"),d.title!==void 0){const s=e.append("g").attr("class","stateLabel"),{x:y,y:p}=U.calcLabelPosition(i.points),c=z.getRows(d.title);let l=0;const B=[];let m=0,k=0;for(let f=0;f<=c.length;f++){const h=s.append("text").attr("text-anchor","middle").text(c[f]).attr("x",y).attr("y",p+l),w=h.node().getBBox();m=Math.max(m,w.width),k=Math.min(k,w.x),S.info(w.x,y,p+l),l===0&&(l=h.node().getBBox().height,S.info("Title height",l,p)),B.push(h)}let E=l*c.length;if(c.length>1){const f=(c.length-1)*l*.5;B.forEach((h,w)=>h.attr("y",p+w*l-f)),E=l*c.length}const r=s.node().getBBox();s.insert("rect",":first-child").attr("class","box").attr("x",y-m/2-t().state.padding/2).attr("y",p-E/2-t().state.padding/2-3.5).attr("width",m+t().state.padding).attr("height",E+t().state.padding),S.info(r)}A++},"drawEdge"),b,T={},rt=u(function(){},"setConf"),nt=u(function(e){e.append("defs").append("marker").attr("id","dependencyEnd").attr("refX",19).attr("refY",7).attr("markerWidth",20).attr("markerHeight",28).attr("orient","auto").append("path").attr("d","M 19,7 L9,13 L14,7 L9,1 Z")},"insertMarkers"),st=u(function(e,i,d,o){b=t().state;const n=t().securityLevel;let g;n==="sandbox"&&(g=H("#i"+i));const x=n==="sandbox"?H(g.nodes()[0].contentDocument.body):H("body"),a=n==="sandbox"?g.nodes()[0].contentDocument:document;S.debug("Rendering diagram "+e);const s=x.select(`[id='${i}']`);nt(s);const y=o.db.getRootDoc();R(y,s,void 0,!1,x,a,o);const p=b.padding,c=s.node().getBBox(),l=c.width+p*2,B=c.height+p*2,m=l*1.75;C(s,B,m,b.useMaxWidth),s.attr("viewBox",`${c.x-b.padding} ${c.y-b.padding} `+l+" "+B)},"draw"),dt=u(e=>e?e.length*b.fontSizeFactor:1,"getLabelWidth"),R=u((e,i,d,o,n,g,x)=>{const a=new F({compound:!0,multigraph:!0});let s,y=!0;for(s=0;s<e.length;s++)if(e[s].stmt==="relation"){y=!1;break}d?a.setGraph({rankdir:"LR",multigraph:!0,compound:!0,ranker:"tight-tree",ranksep:y?1:b.edgeLengthFactor,nodeSep:y?1:50,isMultiGraph:!0}):a.setGraph({rankdir:"TB",multigraph:!0,compound:!0,ranksep:y?1:b.edgeLengthFactor,nodeSep:y?1:50,ranker:"tight-tree",isMultiGraph:!0}),a.setDefaultEdgeLabel(function(){return{}});const p=x.db.getStates(),c=x.db.getRelations(),l=Object.keys(p);for(const r of l){const f=p[r];d&&(f.parentId=d);let h;if(f.doc){let w=i.append("g").attr("id",f.id).attr("class","stateGroup");h=R(f.doc,w,f.id,!o,n,g,x);{w=Q(w,f,o);let v=w.node().getBBox();h.width=v.width,h.height=v.height+b.padding/2,T[f.id]={y:b.compositTitleSize}}}else h=_(i,f,a);if(f.note){const w={descriptions:[],id:f.id+"-note",note:f.note,type:"note"},v=_(i,w,a);f.note.position==="left of"?(a.setNode(h.id+"-note",v),a.setNode(h.id,h)):(a.setNode(h.id,h),a.setNode(h.id+"-note",v)),a.setParent(h.id,h.id+"-group"),a.setParent(h.id+"-note",h.id+"-group")}else a.setNode(h.id,h)}S.debug("Count=",a.nodeCount(),a);let B=0;c.forEach(function(r){B++,S.debug("Setting edge",r),a.setEdge(r.id1,r.id2,{relation:r,width:dt(r.title),height:b.labelHeight*z.getRows(r.title).length,labelpos:"c"},"id"+B)}),O(a),S.debug("Graph after layout",a.nodes());const m=i.node();a.nodes().forEach(function(r){r!==void 0&&a.node(r)!==void 0?(S.warn("Node "+r+": "+JSON.stringify(a.node(r))),n.select("#"+m.id+" #"+r).attr("transform","translate("+(a.node(r).x-a.node(r).width/2)+","+(a.node(r).y+(T[r]?T[r].y:0)-a.node(r).height/2)+" )"),n.select("#"+m.id+" #"+r).attr("data-x-shift",a.node(r).x-a.node(r).width/2),g.querySelectorAll("#"+m.id+" #"+r+" .divider").forEach(h=>{const w=h.parentElement;let v=0,M=0;w&&(w.parentElement&&(v=w.parentElement.getBBox().width),M=parseInt(w.getAttribute("data-x-shift"),10),Number.isNaN(M)&&(M=0)),h.setAttribute("x1",0-M+8),h.setAttribute("x2",v-M-8)})):S.debug("No Node "+r+": "+JSON.stringify(a.node(r)))});let k=m.getBBox();a.edges().forEach(function(r){r!==void 0&&a.edge(r)!==void 0&&(S.debug("Edge "+r.v+" -> "+r.w+": "+JSON.stringify(a.edge(r))),it(i,a.edge(r),a.edge(r).relation))}),k=m.getBBox();const E={id:d||"root",label:d||"root",width:0,height:0};return E.width=k.width+2*b.padding,E.height=k.height+2*b.padding,S.debug("Doc rendered",E,a),E},"renderDoc"),ot={setConf:rt,draw:st},mt={parser:P,get db(){return new N(1)},renderer:ot,styles:W,init:u(e=>{e.state||(e.state={}),e.state.arrowMarkerAbsolute=e.arrowMarkerAbsolute},"init")};export{mt as diagram};
1
+ import{s as W,a as P,S as N}from"./chunk-AEK57VVT-EVfEpH4f.js";import{_ as u,c as t,d as H,l as S,e as C,k as z,u as U}from"./mermaid.core-BHfHBA6R.js";import{G as F}from"./graph-CDkZGsbw.js";import{l as O}from"./layout-B__Skqp8.js";import{l as J,k as X}from"./step-DMJAOHzS.js";import"./chunk-RZ5BOZE2-IvUVaxD4.js";import"./index-CVSo1eIn.js";import"./icon-D9xnujmI.js";import"./_baseUniq-CYir-14_.js";import"./_basePickBy-BJr_fQtB.js";var L={},D=u((e,i)=>{L[e]=i},"set"),Y=u(e=>L[e],"get"),G=u(()=>Object.keys(L),"keys"),I=u(()=>G().length,"size"),$={get:Y,set:D,keys:G,size:I},j=u(e=>e.append("circle").attr("class","start-state").attr("r",t().state.sizeUnit).attr("cx",t().state.padding+t().state.sizeUnit).attr("cy",t().state.padding+t().state.sizeUnit),"drawStartState"),q=u(e=>e.append("line").style("stroke","grey").style("stroke-dasharray","3").attr("x1",t().state.textHeight).attr("class","divider").attr("x2",t().state.textHeight*2).attr("y1",0).attr("y2",0),"drawDivider"),Z=u((e,i)=>{const d=e.append("text").attr("x",2*t().state.padding).attr("y",t().state.textHeight+2*t().state.padding).attr("font-size",t().state.fontSize).attr("class","state-title").text(i.id),o=d.node().getBBox();return e.insert("rect",":first-child").attr("x",t().state.padding).attr("y",t().state.padding).attr("width",o.width+2*t().state.padding).attr("height",o.height+2*t().state.padding).attr("rx",t().state.radius),d},"drawSimpleState"),K=u((e,i)=>{const d=u(function(l,B,m){const k=l.append("tspan").attr("x",2*t().state.padding).text(B);m||k.attr("dy",t().state.textHeight)},"addTspan"),n=e.append("text").attr("x",2*t().state.padding).attr("y",t().state.textHeight+1.3*t().state.padding).attr("font-size",t().state.fontSize).attr("class","state-title").text(i.descriptions[0]).node().getBBox(),g=n.height,x=e.append("text").attr("x",t().state.padding).attr("y",g+t().state.padding*.4+t().state.dividerMargin+t().state.textHeight).attr("class","state-description");let a=!0,s=!0;i.descriptions.forEach(function(l){a||(d(x,l,s),s=!1),a=!1});const y=e.append("line").attr("x1",t().state.padding).attr("y1",t().state.padding+g+t().state.dividerMargin/2).attr("y2",t().state.padding+g+t().state.dividerMargin/2).attr("class","descr-divider"),p=x.node().getBBox(),c=Math.max(p.width,n.width);return y.attr("x2",c+3*t().state.padding),e.insert("rect",":first-child").attr("x",t().state.padding).attr("y",t().state.padding).attr("width",c+2*t().state.padding).attr("height",p.height+g+2*t().state.padding).attr("rx",t().state.radius),e},"drawDescrState"),Q=u((e,i,d)=>{const o=t().state.padding,n=2*t().state.padding,g=e.node().getBBox(),x=g.width,a=g.x,s=e.append("text").attr("x",0).attr("y",t().state.titleShift).attr("font-size",t().state.fontSize).attr("class","state-title").text(i.id),p=s.node().getBBox().width+n;let c=Math.max(p,x);c===x&&(c=c+n);let l;const B=e.node().getBBox();i.doc,l=a-o,p>x&&(l=(x-c)/2+o),Math.abs(a-B.x)<o&&p>x&&(l=a-(p-x)/2);const m=1-t().state.textHeight;return e.insert("rect",":first-child").attr("x",l).attr("y",m).attr("class",d?"alt-composit":"composit").attr("width",c).attr("height",B.height+t().state.textHeight+t().state.titleShift+1).attr("rx","0"),s.attr("x",l+o),p<=x&&s.attr("x",a+(c-n)/2-p/2+o),e.insert("rect",":first-child").attr("x",l).attr("y",t().state.titleShift-t().state.textHeight-t().state.padding).attr("width",c).attr("height",t().state.textHeight*3).attr("rx",t().state.radius),e.insert("rect",":first-child").attr("x",l).attr("y",t().state.titleShift-t().state.textHeight-t().state.padding).attr("width",c).attr("height",B.height+3+2*t().state.textHeight).attr("rx",t().state.radius),e},"addTitleAndBox"),V=u(e=>(e.append("circle").attr("class","end-state-outer").attr("r",t().state.sizeUnit+t().state.miniPadding).attr("cx",t().state.padding+t().state.sizeUnit+t().state.miniPadding).attr("cy",t().state.padding+t().state.sizeUnit+t().state.miniPadding),e.append("circle").attr("class","end-state-inner").attr("r",t().state.sizeUnit).attr("cx",t().state.padding+t().state.sizeUnit+2).attr("cy",t().state.padding+t().state.sizeUnit+2)),"drawEndState"),tt=u((e,i)=>{let d=t().state.forkWidth,o=t().state.forkHeight;if(i.parentId){let n=d;d=o,o=n}return e.append("rect").style("stroke","black").style("fill","black").attr("width",d).attr("height",o).attr("x",t().state.padding).attr("y",t().state.padding)},"drawForkJoinState"),et=u((e,i,d,o)=>{let n=0;const g=o.append("text");g.style("text-anchor","start"),g.attr("class","noteText");let x=e.replace(/\r\n/g,"<br/>");x=x.replace(/\n/g,"<br/>");const a=x.split(z.lineBreakRegex);let s=1.25*t().state.noteMargin;for(const y of a){const p=y.trim();if(p.length>0){const c=g.append("tspan");if(c.text(p),s===0){const l=c.node().getBBox();s+=l.height}n+=s,c.attr("x",i+t().state.noteMargin),c.attr("y",d+n+1.25*t().state.noteMargin)}}return{textWidth:g.node().getBBox().width,textHeight:n}},"_drawLongText"),at=u((e,i)=>{i.attr("class","state-note");const d=i.append("rect").attr("x",0).attr("y",t().state.padding),o=i.append("g"),{textWidth:n,textHeight:g}=et(e,0,0,o);return d.attr("height",g+2*t().state.noteMargin),d.attr("width",n+t().state.noteMargin*2),d},"drawNote"),_=u(function(e,i){const d=i.id,o={id:d,label:i.id,width:0,height:0},n=e.append("g").attr("id",d).attr("class","stateGroup");i.type==="start"&&j(n),i.type==="end"&&V(n),(i.type==="fork"||i.type==="join")&&tt(n,i),i.type==="note"&&at(i.note.text,n),i.type==="divider"&&q(n),i.type==="default"&&i.descriptions.length===0&&Z(n,i),i.type==="default"&&i.descriptions.length>0&&K(n,i);const g=n.node().getBBox();return o.width=g.width+2*t().state.padding,o.height=g.height+2*t().state.padding,$.set(d,o),o},"drawState"),A=0,it=u(function(e,i,d){const o=u(function(s){switch(s){case N.relationType.AGGREGATION:return"aggregation";case N.relationType.EXTENSION:return"extension";case N.relationType.COMPOSITION:return"composition";case N.relationType.DEPENDENCY:return"dependency"}},"getRelationType");i.points=i.points.filter(s=>!Number.isNaN(s.y));const n=i.points,g=J().x(function(s){return s.x}).y(function(s){return s.y}).curve(X),x=e.append("path").attr("d",g(n)).attr("id","edge"+A).attr("class","transition");let a="";if(t().state.arrowMarkerAbsolute&&(a=window.location.protocol+"//"+window.location.host+window.location.pathname+window.location.search,a=a.replace(/\(/g,"\\("),a=a.replace(/\)/g,"\\)")),x.attr("marker-end","url("+a+"#"+o(N.relationType.DEPENDENCY)+"End)"),d.title!==void 0){const s=e.append("g").attr("class","stateLabel"),{x:y,y:p}=U.calcLabelPosition(i.points),c=z.getRows(d.title);let l=0;const B=[];let m=0,k=0;for(let f=0;f<=c.length;f++){const h=s.append("text").attr("text-anchor","middle").text(c[f]).attr("x",y).attr("y",p+l),w=h.node().getBBox();m=Math.max(m,w.width),k=Math.min(k,w.x),S.info(w.x,y,p+l),l===0&&(l=h.node().getBBox().height,S.info("Title height",l,p)),B.push(h)}let E=l*c.length;if(c.length>1){const f=(c.length-1)*l*.5;B.forEach((h,w)=>h.attr("y",p+w*l-f)),E=l*c.length}const r=s.node().getBBox();s.insert("rect",":first-child").attr("class","box").attr("x",y-m/2-t().state.padding/2).attr("y",p-E/2-t().state.padding/2-3.5).attr("width",m+t().state.padding).attr("height",E+t().state.padding),S.info(r)}A++},"drawEdge"),b,T={},rt=u(function(){},"setConf"),nt=u(function(e){e.append("defs").append("marker").attr("id","dependencyEnd").attr("refX",19).attr("refY",7).attr("markerWidth",20).attr("markerHeight",28).attr("orient","auto").append("path").attr("d","M 19,7 L9,13 L14,7 L9,1 Z")},"insertMarkers"),st=u(function(e,i,d,o){b=t().state;const n=t().securityLevel;let g;n==="sandbox"&&(g=H("#i"+i));const x=n==="sandbox"?H(g.nodes()[0].contentDocument.body):H("body"),a=n==="sandbox"?g.nodes()[0].contentDocument:document;S.debug("Rendering diagram "+e);const s=x.select(`[id='${i}']`);nt(s);const y=o.db.getRootDoc();R(y,s,void 0,!1,x,a,o);const p=b.padding,c=s.node().getBBox(),l=c.width+p*2,B=c.height+p*2,m=l*1.75;C(s,B,m,b.useMaxWidth),s.attr("viewBox",`${c.x-b.padding} ${c.y-b.padding} `+l+" "+B)},"draw"),dt=u(e=>e?e.length*b.fontSizeFactor:1,"getLabelWidth"),R=u((e,i,d,o,n,g,x)=>{const a=new F({compound:!0,multigraph:!0});let s,y=!0;for(s=0;s<e.length;s++)if(e[s].stmt==="relation"){y=!1;break}d?a.setGraph({rankdir:"LR",multigraph:!0,compound:!0,ranker:"tight-tree",ranksep:y?1:b.edgeLengthFactor,nodeSep:y?1:50,isMultiGraph:!0}):a.setGraph({rankdir:"TB",multigraph:!0,compound:!0,ranksep:y?1:b.edgeLengthFactor,nodeSep:y?1:50,ranker:"tight-tree",isMultiGraph:!0}),a.setDefaultEdgeLabel(function(){return{}});const p=x.db.getStates(),c=x.db.getRelations(),l=Object.keys(p);for(const r of l){const f=p[r];d&&(f.parentId=d);let h;if(f.doc){let w=i.append("g").attr("id",f.id).attr("class","stateGroup");h=R(f.doc,w,f.id,!o,n,g,x);{w=Q(w,f,o);let v=w.node().getBBox();h.width=v.width,h.height=v.height+b.padding/2,T[f.id]={y:b.compositTitleSize}}}else h=_(i,f,a);if(f.note){const w={descriptions:[],id:f.id+"-note",note:f.note,type:"note"},v=_(i,w,a);f.note.position==="left of"?(a.setNode(h.id+"-note",v),a.setNode(h.id,h)):(a.setNode(h.id,h),a.setNode(h.id+"-note",v)),a.setParent(h.id,h.id+"-group"),a.setParent(h.id+"-note",h.id+"-group")}else a.setNode(h.id,h)}S.debug("Count=",a.nodeCount(),a);let B=0;c.forEach(function(r){B++,S.debug("Setting edge",r),a.setEdge(r.id1,r.id2,{relation:r,width:dt(r.title),height:b.labelHeight*z.getRows(r.title).length,labelpos:"c"},"id"+B)}),O(a),S.debug("Graph after layout",a.nodes());const m=i.node();a.nodes().forEach(function(r){r!==void 0&&a.node(r)!==void 0?(S.warn("Node "+r+": "+JSON.stringify(a.node(r))),n.select("#"+m.id+" #"+r).attr("transform","translate("+(a.node(r).x-a.node(r).width/2)+","+(a.node(r).y+(T[r]?T[r].y:0)-a.node(r).height/2)+" )"),n.select("#"+m.id+" #"+r).attr("data-x-shift",a.node(r).x-a.node(r).width/2),g.querySelectorAll("#"+m.id+" #"+r+" .divider").forEach(h=>{const w=h.parentElement;let v=0,M=0;w&&(w.parentElement&&(v=w.parentElement.getBBox().width),M=parseInt(w.getAttribute("data-x-shift"),10),Number.isNaN(M)&&(M=0)),h.setAttribute("x1",0-M+8),h.setAttribute("x2",v-M-8)})):S.debug("No Node "+r+": "+JSON.stringify(a.node(r)))});let k=m.getBBox();a.edges().forEach(function(r){r!==void 0&&a.edge(r)!==void 0&&(S.debug("Edge "+r.v+" -> "+r.w+": "+JSON.stringify(a.edge(r))),it(i,a.edge(r),a.edge(r).relation))}),k=m.getBBox();const E={id:d||"root",label:d||"root",width:0,height:0};return E.width=k.width+2*b.padding,E.height=k.height+2*b.padding,S.debug("Doc rendered",E,a),E},"renderDoc"),ot={setConf:rt,draw:st},mt={parser:P,get db(){return new N(1)},renderer:ot,styles:W,init:u(e=>{e.state||(e.state={}),e.state.arrowMarkerAbsolute=e.arrowMarkerAbsolute},"init")};export{mt as diagram};
@@ -0,0 +1 @@
1
+ import{s as r,b as e,a,S as s}from"./chunk-AEK57VVT-EVfEpH4f.js";import{_ as i}from"./mermaid.core-BHfHBA6R.js";import"./chunk-RZ5BOZE2-IvUVaxD4.js";import"./index-CVSo1eIn.js";import"./icon-D9xnujmI.js";import"./step-DMJAOHzS.js";var u={parser:a,get db(){return new s(2)},renderer:e,styles:r,init:i(t=>{t.state||(t.state={}),t.state.arrowMarkerAbsolute=t.arrowMarkerAbsolute},"init")};export{u as diagram};
@@ -1,4 +1,4 @@
1
- import{_ as s,c as xt,l as E,d as j,V as kt,W as vt,X as _t,Y as bt,D as wt,$ as St,z as Et}from"./mermaid.core-CFY9BM3R.js";import{d as nt}from"./arc-C1_J1TYO.js";import"./index-DZnGa8Vt.js";import"./icon-BIaTDBQz.js";import"./step-DMJAOHzS.js";var Q=function(){var n=s(function(x,i,a,c){for(a=a||{},c=x.length;c--;a[x[c]]=i);return a},"o"),t=[6,8,10,11,12,14,16,17,20,21],e=[1,9],l=[1,10],r=[1,11],d=[1,12],h=[1,13],f=[1,16],m=[1,17],u={trace:s(function(){},"trace"),yy:{},symbols_:{error:2,start:3,timeline:4,document:5,EOF:6,line:7,SPACE:8,statement:9,NEWLINE:10,title:11,acc_title:12,acc_title_value:13,acc_descr:14,acc_descr_value:15,acc_descr_multiline_value:16,section:17,period_statement:18,event_statement:19,period:20,event:21,$accept:0,$end:1},terminals_:{2:"error",4:"timeline",6:"EOF",8:"SPACE",10:"NEWLINE",11:"title",12:"acc_title",13:"acc_title_value",14:"acc_descr",15:"acc_descr_value",16:"acc_descr_multiline_value",17:"section",20:"period",21:"event"},productions_:[0,[3,3],[5,0],[5,2],[7,2],[7,1],[7,1],[7,1],[9,1],[9,2],[9,2],[9,1],[9,1],[9,1],[9,1],[18,1],[19,1]],performAction:s(function(i,a,c,p,y,o,w){var v=o.length-1;switch(y){case 1:return o[v-1];case 2:this.$=[];break;case 3:o[v-1].push(o[v]),this.$=o[v-1];break;case 4:case 5:this.$=o[v];break;case 6:case 7:this.$=[];break;case 8:p.getCommonDb().setDiagramTitle(o[v].substr(6)),this.$=o[v].substr(6);break;case 9:this.$=o[v].trim(),p.getCommonDb().setAccTitle(this.$);break;case 10:case 11:this.$=o[v].trim(),p.getCommonDb().setAccDescription(this.$);break;case 12:p.addSection(o[v].substr(8)),this.$=o[v].substr(8);break;case 15:p.addTask(o[v],0,""),this.$=o[v];break;case 16:p.addEvent(o[v].substr(2)),this.$=o[v];break}},"anonymous"),table:[{3:1,4:[1,2]},{1:[3]},n(t,[2,2],{5:3}),{6:[1,4],7:5,8:[1,6],9:7,10:[1,8],11:e,12:l,14:r,16:d,17:h,18:14,19:15,20:f,21:m},n(t,[2,7],{1:[2,1]}),n(t,[2,3]),{9:18,11:e,12:l,14:r,16:d,17:h,18:14,19:15,20:f,21:m},n(t,[2,5]),n(t,[2,6]),n(t,[2,8]),{13:[1,19]},{15:[1,20]},n(t,[2,11]),n(t,[2,12]),n(t,[2,13]),n(t,[2,14]),n(t,[2,15]),n(t,[2,16]),n(t,[2,4]),n(t,[2,9]),n(t,[2,10])],defaultActions:{},parseError:s(function(i,a){if(a.recoverable)this.trace(i);else{var c=new Error(i);throw c.hash=a,c}},"parseError"),parse:s(function(i){var a=this,c=[0],p=[],y=[null],o=[],w=this.table,v="",N=0,A=0,V=2,U=1,M=o.slice.call(arguments,1),g=Object.create(this.lexer),b={yy:{}};for(var L in this.yy)Object.prototype.hasOwnProperty.call(this.yy,L)&&(b.yy[L]=this.yy[L]);g.setInput(i,b.yy),b.yy.lexer=g,b.yy.parser=this,typeof g.yylloc>"u"&&(g.yylloc={});var P=g.yylloc;o.push(P);var W=g.options&&g.options.ranges;typeof b.yy.parseError=="function"?this.parseError=b.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function Z(T){c.length=c.length-2*T,y.length=y.length-T,o.length=o.length-T}s(Z,"popStack");function tt(){var T;return T=p.pop()||g.lex()||U,typeof T!="number"&&(T instanceof Array&&(p=T,T=p.pop()),T=a.symbols_[T]||T),T}s(tt,"lex");for(var S,C,I,J,R={},B,$,et,O;;){if(C=c[c.length-1],this.defaultActions[C]?I=this.defaultActions[C]:((S===null||typeof S>"u")&&(S=tt()),I=w[C]&&w[C][S]),typeof I>"u"||!I.length||!I[0]){var K="";O=[];for(B in w[C])this.terminals_[B]&&B>V&&O.push("'"+this.terminals_[B]+"'");g.showPosition?K="Parse error on line "+(N+1)+`:
1
+ import{_ as s,c as xt,l as E,d as j,V as kt,W as vt,X as _t,Y as bt,D as wt,$ as St,z as Et}from"./mermaid.core-BHfHBA6R.js";import{d as nt}from"./arc-C1_J1TYO.js";import"./index-CVSo1eIn.js";import"./icon-D9xnujmI.js";import"./step-DMJAOHzS.js";var Q=function(){var n=s(function(x,i,a,c){for(a=a||{},c=x.length;c--;a[x[c]]=i);return a},"o"),t=[6,8,10,11,12,14,16,17,20,21],e=[1,9],l=[1,10],r=[1,11],d=[1,12],h=[1,13],f=[1,16],m=[1,17],u={trace:s(function(){},"trace"),yy:{},symbols_:{error:2,start:3,timeline:4,document:5,EOF:6,line:7,SPACE:8,statement:9,NEWLINE:10,title:11,acc_title:12,acc_title_value:13,acc_descr:14,acc_descr_value:15,acc_descr_multiline_value:16,section:17,period_statement:18,event_statement:19,period:20,event:21,$accept:0,$end:1},terminals_:{2:"error",4:"timeline",6:"EOF",8:"SPACE",10:"NEWLINE",11:"title",12:"acc_title",13:"acc_title_value",14:"acc_descr",15:"acc_descr_value",16:"acc_descr_multiline_value",17:"section",20:"period",21:"event"},productions_:[0,[3,3],[5,0],[5,2],[7,2],[7,1],[7,1],[7,1],[9,1],[9,2],[9,2],[9,1],[9,1],[9,1],[9,1],[18,1],[19,1]],performAction:s(function(i,a,c,p,y,o,w){var v=o.length-1;switch(y){case 1:return o[v-1];case 2:this.$=[];break;case 3:o[v-1].push(o[v]),this.$=o[v-1];break;case 4:case 5:this.$=o[v];break;case 6:case 7:this.$=[];break;case 8:p.getCommonDb().setDiagramTitle(o[v].substr(6)),this.$=o[v].substr(6);break;case 9:this.$=o[v].trim(),p.getCommonDb().setAccTitle(this.$);break;case 10:case 11:this.$=o[v].trim(),p.getCommonDb().setAccDescription(this.$);break;case 12:p.addSection(o[v].substr(8)),this.$=o[v].substr(8);break;case 15:p.addTask(o[v],0,""),this.$=o[v];break;case 16:p.addEvent(o[v].substr(2)),this.$=o[v];break}},"anonymous"),table:[{3:1,4:[1,2]},{1:[3]},n(t,[2,2],{5:3}),{6:[1,4],7:5,8:[1,6],9:7,10:[1,8],11:e,12:l,14:r,16:d,17:h,18:14,19:15,20:f,21:m},n(t,[2,7],{1:[2,1]}),n(t,[2,3]),{9:18,11:e,12:l,14:r,16:d,17:h,18:14,19:15,20:f,21:m},n(t,[2,5]),n(t,[2,6]),n(t,[2,8]),{13:[1,19]},{15:[1,20]},n(t,[2,11]),n(t,[2,12]),n(t,[2,13]),n(t,[2,14]),n(t,[2,15]),n(t,[2,16]),n(t,[2,4]),n(t,[2,9]),n(t,[2,10])],defaultActions:{},parseError:s(function(i,a){if(a.recoverable)this.trace(i);else{var c=new Error(i);throw c.hash=a,c}},"parseError"),parse:s(function(i){var a=this,c=[0],p=[],y=[null],o=[],w=this.table,v="",N=0,A=0,V=2,U=1,M=o.slice.call(arguments,1),g=Object.create(this.lexer),b={yy:{}};for(var L in this.yy)Object.prototype.hasOwnProperty.call(this.yy,L)&&(b.yy[L]=this.yy[L]);g.setInput(i,b.yy),b.yy.lexer=g,b.yy.parser=this,typeof g.yylloc>"u"&&(g.yylloc={});var P=g.yylloc;o.push(P);var W=g.options&&g.options.ranges;typeof b.yy.parseError=="function"?this.parseError=b.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function Z(T){c.length=c.length-2*T,y.length=y.length-T,o.length=o.length-T}s(Z,"popStack");function tt(){var T;return T=p.pop()||g.lex()||U,typeof T!="number"&&(T instanceof Array&&(p=T,T=p.pop()),T=a.symbols_[T]||T),T}s(tt,"lex");for(var S,C,I,J,R={},B,$,et,O;;){if(C=c[c.length-1],this.defaultActions[C]?I=this.defaultActions[C]:((S===null||typeof S>"u")&&(S=tt()),I=w[C]&&w[C][S]),typeof I>"u"||!I.length||!I[0]){var K="";O=[];for(B in w[C])this.terminals_[B]&&B>V&&O.push("'"+this.terminals_[B]+"'");g.showPosition?K="Parse error on line "+(N+1)+`:
2
2
  `+g.showPosition()+`
3
3
  Expecting `+O.join(", ")+", got '"+(this.terminals_[S]||S)+"'":K="Parse error on line "+(N+1)+": Unexpected "+(S==U?"end of input":"'"+(this.terminals_[S]||S)+"'"),this.parseError(K,{text:g.match,token:this.terminals_[S]||S,line:g.yylineno,loc:P,expected:O})}if(I[0]instanceof Array&&I.length>1)throw new Error("Parse Error: multiple actions possible at state: "+C+", token: "+S);switch(I[0]){case 1:c.push(S),y.push(g.yytext),o.push(g.yylloc),c.push(I[1]),S=null,A=g.yyleng,v=g.yytext,N=g.yylineno,P=g.yylloc;break;case 2:if($=this.productions_[I[1]][1],R.$=y[y.length-$],R._$={first_line:o[o.length-($||1)].first_line,last_line:o[o.length-1].last_line,first_column:o[o.length-($||1)].first_column,last_column:o[o.length-1].last_column},W&&(R._$.range=[o[o.length-($||1)].range[0],o[o.length-1].range[1]]),J=this.performAction.apply(R,[v,A,N,b.yy,I[1],y,o].concat(M)),typeof J<"u")return J;$&&(c=c.slice(0,-1*$*2),y=y.slice(0,-1*$),o=o.slice(0,-1*$)),c.push(this.productions_[I[1]][0]),y.push(R.$),o.push(R._$),et=w[c[c.length-2]][c[c.length-1]],c.push(et);break;case 3:return!0}}return!0},"parse")},k=function(){var x={EOF:1,parseError:s(function(a,c){if(this.yy.parser)this.yy.parser.parseError(a,c);else throw new Error(a)},"parseError"),setInput:s(function(i,a){return this.yy=a||this.yy||{},this._input=i,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},"setInput"),input:s(function(){var i=this._input[0];this.yytext+=i,this.yyleng++,this.offset++,this.match+=i,this.matched+=i;var a=i.match(/(?:\r\n?|\n).*/g);return a?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),i},"input"),unput:s(function(i){var a=i.length,c=i.split(/(?:\r\n?|\n)/g);this._input=i+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-a),this.offset-=a;var p=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),c.length-1&&(this.yylineno-=c.length-1);var y=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:c?(c.length===p.length?this.yylloc.first_column:0)+p[p.length-c.length].length-c[0].length:this.yylloc.first_column-a},this.options.ranges&&(this.yylloc.range=[y[0],y[0]+this.yyleng-a]),this.yyleng=this.yytext.length,this},"unput"),more:s(function(){return this._more=!0,this},"more"),reject:s(function(){if(this.options.backtrack_lexer)this._backtrack=!0;else return this.parseError("Lexical error on line "+(this.yylineno+1)+`. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).
4
4
  `+this.showPosition(),{text:"",token:null,line:this.yylineno});return this},"reject"),less:s(function(i){this.unput(this.match.slice(i))},"less"),pastInput:s(function(){var i=this.matched.substr(0,this.matched.length-this.match.length);return(i.length>20?"...":"")+i.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:s(function(){var i=this.match;return i.length<20&&(i+=this._input.substr(0,20-i.length)),(i.substr(0,20)+(i.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:s(function(){var i=this.pastInput(),a=new Array(i.length+1).join("-");return i+this.upcomingInput()+`
@@ -0,0 +1 @@
1
+ import{J as u,g as a,K as d,f as c,M as l,O as g,Q as f,R as h,S as A,T as q,V as w,W as v}from"./index-CVSo1eIn.js";const o={all:["agent-favourite"],detail:t=>[...o.all,t]},F=({agentId:t,enabled:n=!0})=>{const{isAuthenticated:i}=u(),e=a({queryKey:o.detail(t||"invalid"),queryFn:async()=>{if(!t)throw new Error("Agent ID is required to fetch favourite status.");if(!i)throw new Error("Authentication required to fetch favourite status.");return(await d(t)).result},enabled:!!t&&n&&i,staleTime:5*60*1e3,gcTime:10*60*1e3,refetchOnWindowFocus:!0}),r=!!e.data&&Object.keys(e.data).length>0;return{...e,isFavourited:r}},m=()=>{const t=c(),{isAuthenticated:n}=u();return l({mutationFn:async({agentId:e,isCurrentlyFavourited:r})=>{if(!n)throw new Error("Authentication required to favourite/unfavourite an agent.");if(!e)throw new Error("Agent ID is required.");return r?f(e):h(e)},onSuccess:(e,r)=>{t.invalidateQueries({queryKey:o.detail(r.agentId)}),t.invalidateQueries({queryKey:g.count(r.agentId)})},onError:e=>{console.error("Failed to toggle favourite status:",e)}})},s={all:["agent-like"],detail:t=>[...s.all,t]},K=({agentId:t,enabled:n=!0})=>{const{isAuthenticated:i}=u(),e=a({queryKey:s.detail(t||"invalid"),queryFn:async()=>{if(!t)throw new Error("Agent ID is required to fetch like status.");if(!i)throw new Error("Authentication required to fetch like status.");return(await A(t)).result},enabled:!!t&&n&&i,staleTime:5*60*1e3,gcTime:10*60*1e3,refetchOnWindowFocus:!0}),r=!!e.data&&Object.keys(e.data).length>0;return{...e,isLiked:r}},E=()=>{const t=c(),{isAuthenticated:n}=u();return l({mutationFn:async({agentId:e,isCurrentlyLiked:r})=>{if(!n)throw new Error("Authentication required to like/unlike an agent.");if(!e)throw new Error("Agent ID is required.");return r?w(e):v(e)},onSuccess:(e,r)=>{t.invalidateQueries({queryKey:s.detail(r.agentId)}),t.invalidateQueries({queryKey:q.count(r.agentId)})},onError:e=>{console.error("Failed to toggle like status:",e)}})};export{F as a,E as b,m as c,K as u};
@@ -1,4 +1,4 @@
1
- import{_ as n,s as ii,g as ei,t as vt,q as si,a as ni,b as ai,l as Lt,K as oi,e as ri,z as hi,G as lt,F as Et,H as li,M as ci,i as ui,N as gi}from"./mermaid.core-CFY9BM3R.js";import{b as kt}from"./band-CquvqAHh.js";import{l as Tt}from"./linear-BfLTrHPc.js";import{l as Rt}from"./step-DMJAOHzS.js";import"./index-DZnGa8Vt.js";import"./icon-BIaTDBQz.js";import"./init-Dmth1JHB.js";import"./ordinal-DILIJJjt.js";var at=function(){var t=n(function(B,r,l,c){for(l=l||{},c=B.length;c--;l[B[c]]=r);return l},"o"),i=[1,10,12,14,16,18,19,21,23],e=[2,6],s=[1,3],o=[1,5],p=[1,6],g=[1,7],m=[1,5,10,12,14,16,18,19,21,23,34,35,36],T=[1,25],E=[1,26],S=[1,28],R=[1,29],I=[1,30],V=[1,31],_=[1,32],L=[1,33],f=[1,34],C=[1,35],h=[1,36],D=[1,37],N=[1,43],yt=[1,42],bt=[1,47],$=[1,50],b=[1,10,12,14,16,18,19,21,23,34,35,36],J=[1,10,12,14,16,18,19,21,23,24,26,27,28,34,35,36],P=[1,10,12,14,16,18,19,21,23,24,26,27,28,34,35,36,41,42,43,44,45,46,47,48,49,50],At=[1,64],tt={trace:n(function(){},"trace"),yy:{},symbols_:{error:2,start:3,eol:4,XYCHART:5,chartConfig:6,document:7,CHART_ORIENTATION:8,statement:9,title:10,text:11,X_AXIS:12,parseXAxis:13,Y_AXIS:14,parseYAxis:15,LINE:16,plotData:17,BAR:18,acc_title:19,acc_title_value:20,acc_descr:21,acc_descr_value:22,acc_descr_multiline_value:23,SQUARE_BRACES_START:24,commaSeparatedNumbers:25,SQUARE_BRACES_END:26,NUMBER_WITH_DECIMAL:27,COMMA:28,xAxisData:29,bandData:30,ARROW_DELIMITER:31,commaSeparatedTexts:32,yAxisData:33,NEWLINE:34,SEMI:35,EOF:36,alphaNum:37,STR:38,MD_STR:39,alphaNumToken:40,AMP:41,NUM:42,ALPHA:43,PLUS:44,EQUALS:45,MULT:46,DOT:47,BRKT:48,MINUS:49,UNDERSCORE:50,$accept:0,$end:1},terminals_:{2:"error",5:"XYCHART",8:"CHART_ORIENTATION",10:"title",12:"X_AXIS",14:"Y_AXIS",16:"LINE",18:"BAR",19:"acc_title",20:"acc_title_value",21:"acc_descr",22:"acc_descr_value",23:"acc_descr_multiline_value",24:"SQUARE_BRACES_START",26:"SQUARE_BRACES_END",27:"NUMBER_WITH_DECIMAL",28:"COMMA",31:"ARROW_DELIMITER",34:"NEWLINE",35:"SEMI",36:"EOF",38:"STR",39:"MD_STR",41:"AMP",42:"NUM",43:"ALPHA",44:"PLUS",45:"EQUALS",46:"MULT",47:"DOT",48:"BRKT",49:"MINUS",50:"UNDERSCORE"},productions_:[0,[3,2],[3,3],[3,2],[3,1],[6,1],[7,0],[7,2],[9,2],[9,2],[9,2],[9,2],[9,2],[9,3],[9,2],[9,3],[9,2],[9,2],[9,1],[17,3],[25,3],[25,1],[13,1],[13,2],[13,1],[29,1],[29,3],[30,3],[32,3],[32,1],[15,1],[15,2],[15,1],[33,3],[4,1],[4,1],[4,1],[11,1],[11,1],[11,1],[37,1],[37,2],[40,1],[40,1],[40,1],[40,1],[40,1],[40,1],[40,1],[40,1],[40,1],[40,1]],performAction:n(function(r,l,c,u,y,a,X){var x=a.length-1;switch(y){case 5:u.setOrientation(a[x]);break;case 9:u.setDiagramTitle(a[x].text.trim());break;case 12:u.setLineData({text:"",type:"text"},a[x]);break;case 13:u.setLineData(a[x-1],a[x]);break;case 14:u.setBarData({text:"",type:"text"},a[x]);break;case 15:u.setBarData(a[x-1],a[x]);break;case 16:this.$=a[x].trim(),u.setAccTitle(this.$);break;case 17:case 18:this.$=a[x].trim(),u.setAccDescription(this.$);break;case 19:this.$=a[x-1];break;case 20:this.$=[Number(a[x-2]),...a[x]];break;case 21:this.$=[Number(a[x])];break;case 22:u.setXAxisTitle(a[x]);break;case 23:u.setXAxisTitle(a[x-1]);break;case 24:u.setXAxisTitle({type:"text",text:""});break;case 25:u.setXAxisBand(a[x]);break;case 26:u.setXAxisRangeData(Number(a[x-2]),Number(a[x]));break;case 27:this.$=a[x-1];break;case 28:this.$=[a[x-2],...a[x]];break;case 29:this.$=[a[x]];break;case 30:u.setYAxisTitle(a[x]);break;case 31:u.setYAxisTitle(a[x-1]);break;case 32:u.setYAxisTitle({type:"text",text:""});break;case 33:u.setYAxisRangeData(Number(a[x-2]),Number(a[x]));break;case 37:this.$={text:a[x],type:"text"};break;case 38:this.$={text:a[x],type:"text"};break;case 39:this.$={text:a[x],type:"markdown"};break;case 40:this.$=a[x];break;case 41:this.$=a[x-1]+""+a[x];break}},"anonymous"),table:[t(i,e,{3:1,4:2,7:4,5:s,34:o,35:p,36:g}),{1:[3]},t(i,e,{4:2,7:4,3:8,5:s,34:o,35:p,36:g}),t(i,e,{4:2,7:4,6:9,3:10,5:s,8:[1,11],34:o,35:p,36:g}),{1:[2,4],9:12,10:[1,13],12:[1,14],14:[1,15],16:[1,16],18:[1,17],19:[1,18],21:[1,19],23:[1,20]},t(m,[2,34]),t(m,[2,35]),t(m,[2,36]),{1:[2,1]},t(i,e,{4:2,7:4,3:21,5:s,34:o,35:p,36:g}),{1:[2,3]},t(m,[2,5]),t(i,[2,7],{4:22,34:o,35:p,36:g}),{11:23,37:24,38:T,39:E,40:27,41:S,42:R,43:I,44:V,45:_,46:L,47:f,48:C,49:h,50:D},{11:39,13:38,24:N,27:yt,29:40,30:41,37:24,38:T,39:E,40:27,41:S,42:R,43:I,44:V,45:_,46:L,47:f,48:C,49:h,50:D},{11:45,15:44,27:bt,33:46,37:24,38:T,39:E,40:27,41:S,42:R,43:I,44:V,45:_,46:L,47:f,48:C,49:h,50:D},{11:49,17:48,24:$,37:24,38:T,39:E,40:27,41:S,42:R,43:I,44:V,45:_,46:L,47:f,48:C,49:h,50:D},{11:52,17:51,24:$,37:24,38:T,39:E,40:27,41:S,42:R,43:I,44:V,45:_,46:L,47:f,48:C,49:h,50:D},{20:[1,53]},{22:[1,54]},t(b,[2,18]),{1:[2,2]},t(b,[2,8]),t(b,[2,9]),t(J,[2,37],{40:55,41:S,42:R,43:I,44:V,45:_,46:L,47:f,48:C,49:h,50:D}),t(J,[2,38]),t(J,[2,39]),t(P,[2,40]),t(P,[2,42]),t(P,[2,43]),t(P,[2,44]),t(P,[2,45]),t(P,[2,46]),t(P,[2,47]),t(P,[2,48]),t(P,[2,49]),t(P,[2,50]),t(P,[2,51]),t(b,[2,10]),t(b,[2,22],{30:41,29:56,24:N,27:yt}),t(b,[2,24]),t(b,[2,25]),{31:[1,57]},{11:59,32:58,37:24,38:T,39:E,40:27,41:S,42:R,43:I,44:V,45:_,46:L,47:f,48:C,49:h,50:D},t(b,[2,11]),t(b,[2,30],{33:60,27:bt}),t(b,[2,32]),{31:[1,61]},t(b,[2,12]),{17:62,24:$},{25:63,27:At},t(b,[2,14]),{17:65,24:$},t(b,[2,16]),t(b,[2,17]),t(P,[2,41]),t(b,[2,23]),{27:[1,66]},{26:[1,67]},{26:[2,29],28:[1,68]},t(b,[2,31]),{27:[1,69]},t(b,[2,13]),{26:[1,70]},{26:[2,21],28:[1,71]},t(b,[2,15]),t(b,[2,26]),t(b,[2,27]),{11:59,32:72,37:24,38:T,39:E,40:27,41:S,42:R,43:I,44:V,45:_,46:L,47:f,48:C,49:h,50:D},t(b,[2,33]),t(b,[2,19]),{25:73,27:At},{26:[2,28]},{26:[2,20]}],defaultActions:{8:[2,1],10:[2,3],21:[2,2],72:[2,28],73:[2,20]},parseError:n(function(r,l){if(l.recoverable)this.trace(r);else{var c=new Error(r);throw c.hash=l,c}},"parseError"),parse:n(function(r){var l=this,c=[0],u=[],y=[null],a=[],X=this.table,x="",G=0,Ct=0,Kt=2,wt=1,Zt=a.slice.call(arguments,1),A=Object.create(this.lexer),W={yy:{}};for(var it in this.yy)Object.prototype.hasOwnProperty.call(this.yy,it)&&(W.yy[it]=this.yy[it]);A.setInput(r,W.yy),W.yy.lexer=A,W.yy.parser=this,typeof A.yylloc>"u"&&(A.yylloc={});var et=A.yylloc;a.push(et);var Jt=A.options&&A.options.ranges;typeof W.yy.parseError=="function"?this.parseError=W.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function ti(k){c.length=c.length-2*k,y.length=y.length-k,a.length=a.length-k}n(ti,"popStack");function St(){var k;return k=u.pop()||A.lex()||wt,typeof k!="number"&&(k instanceof Array&&(u=k,k=u.pop()),k=l.symbols_[k]||k),k}n(St,"lex");for(var w,O,v,st,z={},j,M,_t,Q;;){if(O=c[c.length-1],this.defaultActions[O]?v=this.defaultActions[O]:((w===null||typeof w>"u")&&(w=St()),v=X[O]&&X[O][w]),typeof v>"u"||!v.length||!v[0]){var nt="";Q=[];for(j in X[O])this.terminals_[j]&&j>Kt&&Q.push("'"+this.terminals_[j]+"'");A.showPosition?nt="Parse error on line "+(G+1)+`:
1
+ import{_ as n,s as ii,g as ei,t as vt,q as si,a as ni,b as ai,l as Lt,K as oi,e as ri,z as hi,G as lt,F as Et,H as li,M as ci,i as ui,N as gi}from"./mermaid.core-BHfHBA6R.js";import{b as kt}from"./band-CquvqAHh.js";import{l as Tt}from"./linear-BfLTrHPc.js";import{l as Rt}from"./step-DMJAOHzS.js";import"./index-CVSo1eIn.js";import"./icon-D9xnujmI.js";import"./init-Dmth1JHB.js";import"./ordinal-DILIJJjt.js";var at=function(){var t=n(function(B,r,l,c){for(l=l||{},c=B.length;c--;l[B[c]]=r);return l},"o"),i=[1,10,12,14,16,18,19,21,23],e=[2,6],s=[1,3],o=[1,5],p=[1,6],g=[1,7],m=[1,5,10,12,14,16,18,19,21,23,34,35,36],T=[1,25],E=[1,26],S=[1,28],R=[1,29],I=[1,30],V=[1,31],_=[1,32],L=[1,33],f=[1,34],C=[1,35],h=[1,36],D=[1,37],N=[1,43],yt=[1,42],bt=[1,47],$=[1,50],b=[1,10,12,14,16,18,19,21,23,34,35,36],J=[1,10,12,14,16,18,19,21,23,24,26,27,28,34,35,36],P=[1,10,12,14,16,18,19,21,23,24,26,27,28,34,35,36,41,42,43,44,45,46,47,48,49,50],At=[1,64],tt={trace:n(function(){},"trace"),yy:{},symbols_:{error:2,start:3,eol:4,XYCHART:5,chartConfig:6,document:7,CHART_ORIENTATION:8,statement:9,title:10,text:11,X_AXIS:12,parseXAxis:13,Y_AXIS:14,parseYAxis:15,LINE:16,plotData:17,BAR:18,acc_title:19,acc_title_value:20,acc_descr:21,acc_descr_value:22,acc_descr_multiline_value:23,SQUARE_BRACES_START:24,commaSeparatedNumbers:25,SQUARE_BRACES_END:26,NUMBER_WITH_DECIMAL:27,COMMA:28,xAxisData:29,bandData:30,ARROW_DELIMITER:31,commaSeparatedTexts:32,yAxisData:33,NEWLINE:34,SEMI:35,EOF:36,alphaNum:37,STR:38,MD_STR:39,alphaNumToken:40,AMP:41,NUM:42,ALPHA:43,PLUS:44,EQUALS:45,MULT:46,DOT:47,BRKT:48,MINUS:49,UNDERSCORE:50,$accept:0,$end:1},terminals_:{2:"error",5:"XYCHART",8:"CHART_ORIENTATION",10:"title",12:"X_AXIS",14:"Y_AXIS",16:"LINE",18:"BAR",19:"acc_title",20:"acc_title_value",21:"acc_descr",22:"acc_descr_value",23:"acc_descr_multiline_value",24:"SQUARE_BRACES_START",26:"SQUARE_BRACES_END",27:"NUMBER_WITH_DECIMAL",28:"COMMA",31:"ARROW_DELIMITER",34:"NEWLINE",35:"SEMI",36:"EOF",38:"STR",39:"MD_STR",41:"AMP",42:"NUM",43:"ALPHA",44:"PLUS",45:"EQUALS",46:"MULT",47:"DOT",48:"BRKT",49:"MINUS",50:"UNDERSCORE"},productions_:[0,[3,2],[3,3],[3,2],[3,1],[6,1],[7,0],[7,2],[9,2],[9,2],[9,2],[9,2],[9,2],[9,3],[9,2],[9,3],[9,2],[9,2],[9,1],[17,3],[25,3],[25,1],[13,1],[13,2],[13,1],[29,1],[29,3],[30,3],[32,3],[32,1],[15,1],[15,2],[15,1],[33,3],[4,1],[4,1],[4,1],[11,1],[11,1],[11,1],[37,1],[37,2],[40,1],[40,1],[40,1],[40,1],[40,1],[40,1],[40,1],[40,1],[40,1],[40,1]],performAction:n(function(r,l,c,u,y,a,X){var x=a.length-1;switch(y){case 5:u.setOrientation(a[x]);break;case 9:u.setDiagramTitle(a[x].text.trim());break;case 12:u.setLineData({text:"",type:"text"},a[x]);break;case 13:u.setLineData(a[x-1],a[x]);break;case 14:u.setBarData({text:"",type:"text"},a[x]);break;case 15:u.setBarData(a[x-1],a[x]);break;case 16:this.$=a[x].trim(),u.setAccTitle(this.$);break;case 17:case 18:this.$=a[x].trim(),u.setAccDescription(this.$);break;case 19:this.$=a[x-1];break;case 20:this.$=[Number(a[x-2]),...a[x]];break;case 21:this.$=[Number(a[x])];break;case 22:u.setXAxisTitle(a[x]);break;case 23:u.setXAxisTitle(a[x-1]);break;case 24:u.setXAxisTitle({type:"text",text:""});break;case 25:u.setXAxisBand(a[x]);break;case 26:u.setXAxisRangeData(Number(a[x-2]),Number(a[x]));break;case 27:this.$=a[x-1];break;case 28:this.$=[a[x-2],...a[x]];break;case 29:this.$=[a[x]];break;case 30:u.setYAxisTitle(a[x]);break;case 31:u.setYAxisTitle(a[x-1]);break;case 32:u.setYAxisTitle({type:"text",text:""});break;case 33:u.setYAxisRangeData(Number(a[x-2]),Number(a[x]));break;case 37:this.$={text:a[x],type:"text"};break;case 38:this.$={text:a[x],type:"text"};break;case 39:this.$={text:a[x],type:"markdown"};break;case 40:this.$=a[x];break;case 41:this.$=a[x-1]+""+a[x];break}},"anonymous"),table:[t(i,e,{3:1,4:2,7:4,5:s,34:o,35:p,36:g}),{1:[3]},t(i,e,{4:2,7:4,3:8,5:s,34:o,35:p,36:g}),t(i,e,{4:2,7:4,6:9,3:10,5:s,8:[1,11],34:o,35:p,36:g}),{1:[2,4],9:12,10:[1,13],12:[1,14],14:[1,15],16:[1,16],18:[1,17],19:[1,18],21:[1,19],23:[1,20]},t(m,[2,34]),t(m,[2,35]),t(m,[2,36]),{1:[2,1]},t(i,e,{4:2,7:4,3:21,5:s,34:o,35:p,36:g}),{1:[2,3]},t(m,[2,5]),t(i,[2,7],{4:22,34:o,35:p,36:g}),{11:23,37:24,38:T,39:E,40:27,41:S,42:R,43:I,44:V,45:_,46:L,47:f,48:C,49:h,50:D},{11:39,13:38,24:N,27:yt,29:40,30:41,37:24,38:T,39:E,40:27,41:S,42:R,43:I,44:V,45:_,46:L,47:f,48:C,49:h,50:D},{11:45,15:44,27:bt,33:46,37:24,38:T,39:E,40:27,41:S,42:R,43:I,44:V,45:_,46:L,47:f,48:C,49:h,50:D},{11:49,17:48,24:$,37:24,38:T,39:E,40:27,41:S,42:R,43:I,44:V,45:_,46:L,47:f,48:C,49:h,50:D},{11:52,17:51,24:$,37:24,38:T,39:E,40:27,41:S,42:R,43:I,44:V,45:_,46:L,47:f,48:C,49:h,50:D},{20:[1,53]},{22:[1,54]},t(b,[2,18]),{1:[2,2]},t(b,[2,8]),t(b,[2,9]),t(J,[2,37],{40:55,41:S,42:R,43:I,44:V,45:_,46:L,47:f,48:C,49:h,50:D}),t(J,[2,38]),t(J,[2,39]),t(P,[2,40]),t(P,[2,42]),t(P,[2,43]),t(P,[2,44]),t(P,[2,45]),t(P,[2,46]),t(P,[2,47]),t(P,[2,48]),t(P,[2,49]),t(P,[2,50]),t(P,[2,51]),t(b,[2,10]),t(b,[2,22],{30:41,29:56,24:N,27:yt}),t(b,[2,24]),t(b,[2,25]),{31:[1,57]},{11:59,32:58,37:24,38:T,39:E,40:27,41:S,42:R,43:I,44:V,45:_,46:L,47:f,48:C,49:h,50:D},t(b,[2,11]),t(b,[2,30],{33:60,27:bt}),t(b,[2,32]),{31:[1,61]},t(b,[2,12]),{17:62,24:$},{25:63,27:At},t(b,[2,14]),{17:65,24:$},t(b,[2,16]),t(b,[2,17]),t(P,[2,41]),t(b,[2,23]),{27:[1,66]},{26:[1,67]},{26:[2,29],28:[1,68]},t(b,[2,31]),{27:[1,69]},t(b,[2,13]),{26:[1,70]},{26:[2,21],28:[1,71]},t(b,[2,15]),t(b,[2,26]),t(b,[2,27]),{11:59,32:72,37:24,38:T,39:E,40:27,41:S,42:R,43:I,44:V,45:_,46:L,47:f,48:C,49:h,50:D},t(b,[2,33]),t(b,[2,19]),{25:73,27:At},{26:[2,28]},{26:[2,20]}],defaultActions:{8:[2,1],10:[2,3],21:[2,2],72:[2,28],73:[2,20]},parseError:n(function(r,l){if(l.recoverable)this.trace(r);else{var c=new Error(r);throw c.hash=l,c}},"parseError"),parse:n(function(r){var l=this,c=[0],u=[],y=[null],a=[],X=this.table,x="",G=0,Ct=0,Kt=2,wt=1,Zt=a.slice.call(arguments,1),A=Object.create(this.lexer),W={yy:{}};for(var it in this.yy)Object.prototype.hasOwnProperty.call(this.yy,it)&&(W.yy[it]=this.yy[it]);A.setInput(r,W.yy),W.yy.lexer=A,W.yy.parser=this,typeof A.yylloc>"u"&&(A.yylloc={});var et=A.yylloc;a.push(et);var Jt=A.options&&A.options.ranges;typeof W.yy.parseError=="function"?this.parseError=W.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function ti(k){c.length=c.length-2*k,y.length=y.length-k,a.length=a.length-k}n(ti,"popStack");function St(){var k;return k=u.pop()||A.lex()||wt,typeof k!="number"&&(k instanceof Array&&(u=k,k=u.pop()),k=l.symbols_[k]||k),k}n(St,"lex");for(var w,O,v,st,z={},j,M,_t,Q;;){if(O=c[c.length-1],this.defaultActions[O]?v=this.defaultActions[O]:((w===null||typeof w>"u")&&(w=St()),v=X[O]&&X[O][w]),typeof v>"u"||!v.length||!v[0]){var nt="";Q=[];for(j in X[O])this.terminals_[j]&&j>Kt&&Q.push("'"+this.terminals_[j]+"'");A.showPosition?nt="Parse error on line "+(G+1)+`:
2
2
  `+A.showPosition()+`
3
3
  Expecting `+Q.join(", ")+", got '"+(this.terminals_[w]||w)+"'":nt="Parse error on line "+(G+1)+": Unexpected "+(w==wt?"end of input":"'"+(this.terminals_[w]||w)+"'"),this.parseError(nt,{text:A.match,token:this.terminals_[w]||w,line:A.yylineno,loc:et,expected:Q})}if(v[0]instanceof Array&&v.length>1)throw new Error("Parse Error: multiple actions possible at state: "+O+", token: "+w);switch(v[0]){case 1:c.push(w),y.push(A.yytext),a.push(A.yylloc),c.push(v[1]),w=null,Ct=A.yyleng,x=A.yytext,G=A.yylineno,et=A.yylloc;break;case 2:if(M=this.productions_[v[1]][1],z.$=y[y.length-M],z._$={first_line:a[a.length-(M||1)].first_line,last_line:a[a.length-1].last_line,first_column:a[a.length-(M||1)].first_column,last_column:a[a.length-1].last_column},Jt&&(z._$.range=[a[a.length-(M||1)].range[0],a[a.length-1].range[1]]),st=this.performAction.apply(z,[x,Ct,G,W.yy,v[1],y,a].concat(Zt)),typeof st<"u")return st;M&&(c=c.slice(0,-1*M*2),y=y.slice(0,-1*M),a=a.slice(0,-1*M)),c.push(this.productions_[v[1]][0]),y.push(z.$),a.push(z._$),_t=X[c[c.length-2]][c[c.length-1]],c.push(_t);break;case 3:return!0}}return!0},"parse")},Qt=function(){var B={EOF:1,parseError:n(function(l,c){if(this.yy.parser)this.yy.parser.parseError(l,c);else throw new Error(l)},"parseError"),setInput:n(function(r,l){return this.yy=l||this.yy||{},this._input=r,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},"setInput"),input:n(function(){var r=this._input[0];this.yytext+=r,this.yyleng++,this.offset++,this.match+=r,this.matched+=r;var l=r.match(/(?:\r\n?|\n).*/g);return l?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),r},"input"),unput:n(function(r){var l=r.length,c=r.split(/(?:\r\n?|\n)/g);this._input=r+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-l),this.offset-=l;var u=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),c.length-1&&(this.yylineno-=c.length-1);var y=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:c?(c.length===u.length?this.yylloc.first_column:0)+u[u.length-c.length].length-c[0].length:this.yylloc.first_column-l},this.options.ranges&&(this.yylloc.range=[y[0],y[0]+this.yyleng-l]),this.yyleng=this.yytext.length,this},"unput"),more:n(function(){return this._more=!0,this},"more"),reject:n(function(){if(this.options.backtrack_lexer)this._backtrack=!0;else return this.parseError("Lexical error on line "+(this.yylineno+1)+`. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).
4
4
  `+this.showPosition(),{text:"",token:null,line:this.yylineno});return this},"reject"),less:n(function(r){this.unput(this.match.slice(r))},"less"),pastInput:n(function(){var r=this.matched.substr(0,this.matched.length-this.match.length);return(r.length>20?"...":"")+r.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:n(function(){var r=this.match;return r.length<20&&(r+=this._input.substr(0,20-r.length)),(r.substr(0,20)+(r.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:n(function(){var r=this.pastInput(),l=new Array(r.length+1).join("-");return r+this.upcomingInput()+`
@@ -5,14 +5,29 @@
5
5
  <meta charset="UTF-8" />
6
6
  <title>Local Operator</title>
7
7
  <link rel="icon" href="./assets/favicon.ico" />
8
- <!-- https://developer.mozilla.org/en-US/docs/Web/HTTP/CSP -->
8
+ <!-- https://developer.mozilla.org/en-US/docs/Web/HTTP/CSP
9
+
10
+ `img-src` carries `blob:` because a canonical transcript image that lives
11
+ in the attachment store arrives as BYTES over the media relay, not as a
12
+ URL the page can name: the durable row holds a content digest, main
13
+ fetches it with the bearer, and the renderer wraps the Uint8Array in a
14
+ blob. Without `blob:` here that path fails silently — the <img> errors,
15
+ the view falls back to its "unavailable" placeholder, and the picture
16
+ simply never appears with nothing in the UI saying why. Verified in the
17
+ real app window: under the previous policy a blob <img> was BLOCKED while
18
+ an identical data: URI loaded.
19
+
20
+ `installer.html` deliberately keeps the narrower policy. It renders no
21
+ transcript and fetches no attachments, so widening it there would buy
22
+ nothing and cost the tighter default. -->
23
+
9
24
  <meta http-equiv="Content-Security-Policy"
10
- content="default-src 'self'; connect-src 'self' http://localhost:1111 http://127.0.0.1:1111 ws://localhost:1111 ws://127.0.0.1:1111 http://localhost:8080 http://127.0.0.1:8080 https://api.radienthq.com https://us.i.posthog.com https://login.microsoftonline.com https://accounts.google.com; script-src 'self' https://us-assets.i.posthog.com https://accounts.google.com https://login.microsoftonline.com; style-src 'self' 'unsafe-inline' data:; img-src 'self' data: http://localhost:1111 http://127.0.0.1:1111; media-src 'self' blob: http://localhost:1111 http://127.0.0.1:1111; font-src 'self' data:; frame-src 'self' data: blob: http://localhost:1111 http://127.0.0.1:1111 https://accounts.google.com https://login.microsoftonline.com" />
25
+ content="default-src 'self'; connect-src 'self' http://localhost:1111 http://127.0.0.1:1111 ws://localhost:1111 ws://127.0.0.1:1111 http://localhost:8080 http://127.0.0.1:8080 https://api.radienthq.com https://us.i.posthog.com https://login.microsoftonline.com https://accounts.google.com; script-src 'self' https://us-assets.i.posthog.com https://accounts.google.com https://login.microsoftonline.com; style-src 'self' 'unsafe-inline' data:; img-src 'self' data: blob: http://localhost:1111 http://127.0.0.1:1111; media-src 'self' blob: http://localhost:1111 http://127.0.0.1:1111; font-src 'self' data:; frame-src 'self' data: blob: http://localhost:1111 http://127.0.0.1:1111 https://accounts.google.com https://login.microsoftonline.com" />
11
26
  <meta http-equiv="Cross-Origin-Opener-Policy" content="same-origin-allow-popups" />
12
- <script type="module" crossorigin src="./assets/index-DZnGa8Vt.js"></script>
13
- <link rel="modulepreload" crossorigin href="./assets/icon-BIaTDBQz.js">
14
- <link rel="stylesheet" crossorigin href="./assets/icon-CtRkDz9c.css">
15
- <link rel="stylesheet" crossorigin href="./assets/index-DikLkf3S.css">
27
+ <script type="module" crossorigin src="./assets/index-CVSo1eIn.js"></script>
28
+ <link rel="modulepreload" crossorigin href="./assets/icon-D9xnujmI.js">
29
+ <link rel="stylesheet" crossorigin href="./assets/icon-DM6KYqqV.css">
30
+ <link rel="stylesheet" crossorigin href="./assets/index-aW0Bo_1a.css">
16
31
  </head>
17
32
 
18
33
  <body>
@@ -8,9 +8,9 @@
8
8
  <!-- https://developer.mozilla.org/en-US/docs/Web/HTTP/CSP -->
9
9
  <meta http-equiv="Content-Security-Policy"
10
10
  content="default-src 'self'; connect-src 'self' http://localhost:1111 http://127.0.0.1:1111; script-src 'self'; style-src 'self' 'unsafe-inline'; img-src 'self' data: http://localhost:1111 http://127.0.0.1:1111; media-src 'self' http://localhost:1111 http://127.0.0.1:1111; font-src 'self' data:" />
11
- <script type="module" crossorigin src="./assets/installer-DYZ22Cfq.js"></script>
12
- <link rel="modulepreload" crossorigin href="./assets/icon-BIaTDBQz.js">
13
- <link rel="stylesheet" crossorigin href="./assets/icon-CtRkDz9c.css">
11
+ <script type="module" crossorigin src="./assets/installer-JsKFFZ0N.js"></script>
12
+ <link rel="modulepreload" crossorigin href="./assets/icon-D9xnujmI.js">
13
+ <link rel="stylesheet" crossorigin href="./assets/icon-DM6KYqqV.css">
14
14
  </head>
15
15
 
16
16
  <body>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "local-operator-ui",
3
- "version": "0.15.2",
3
+ "version": "0.17.0",
4
4
  "productName": "Local Operator",
5
5
  "description": "User interface for AI agent assistants that run Python code safely on your device through an intuitive chat interface. Supports local and cloud LLM models with built-in security features.",
6
6
  "main": "./out/main/index.js",
@@ -65,7 +65,7 @@
65
65
  "check-types:main": "tsc --noEmit -p tsconfig.node.json",
66
66
  "check-types:renderer": "tsc --noEmit -p tsconfig.app.json",
67
67
  "check-types": "pnpm run check-types:main && pnpm run check-types:renderer",
68
- "test:desktop": "node --test scripts/linux-sandbox.test.mjs scripts/desktop-contract.test.mjs scripts/transcript-reducer.test.mjs scripts/provider-state.test.mjs scripts/stale-agent.test.mjs scripts/desktop-renderer-transport.test.mjs scripts/provider-grid-error-copy.test.mjs scripts/settings-time-to-error.test.mjs scripts/backend-error-surfaces.test.mjs",
68
+ "test:desktop": "node --test scripts/linux-sandbox.test.mjs scripts/desktop-contract.test.mjs scripts/transcript-reducer.test.mjs scripts/provider-state.test.mjs scripts/stale-agent.test.mjs scripts/desktop-renderer-transport.test.mjs scripts/provider-grid-error-copy.test.mjs scripts/settings-time-to-error.test.mjs scripts/backend-error-surfaces.test.mjs scripts/canonical-chat.test.mjs scripts/tool-row.test.mjs scripts/attachment-url.test.mjs",
69
69
  "check-themes": "node scripts/generate-theme-css.mjs --check && node scripts/contrast-contract.mjs",
70
70
  "check-evidence": "node scripts/check-evidence.mjs",
71
71
  "check-edit-diffs": "node scripts/check-edit-diffs.mjs",
@@ -1,18 +0,0 @@
1
- import{c as J,r,j as e,k as Ie,m as De,f as U,B as N,I as W,L as ie,a as I,n as re,X as le,P as Se,o as Ee,p as Ue,S as qe,q as Le,s as Pe,t as Te,A as Re,d as Oe,u as ze,v as Me,w as $e,x as ae}from"./icon-BIaTDBQz.js";import{P as He}from"./page-header-GWjqQg3-.js";import{ag as Ve,n as We,q as Ke,ah as X,ai as Z,r as Be,M as Ge,K,aj as T,ak as R,al as se,am as Qe,an as Ye,ao as Je,ap as Xe,aq as Ze,a8 as Ae,ar as Fe,as as et,a3 as A,W as ce,at as tt,au as at,u as de,av as ue,aw as st,ax as nt,ay as pe,az as ot,aA as it,H as rt,aB as me,aC as lt,aD as ct,aE as dt,aF as ut,aG as pt,aH as ne,aI as oe,aJ as mt}from"./index-DZnGa8Vt.js";import{I as ht,a as Q,N as xt}from"./settings-section-yqdH5CNp.js";/**
2
- * @license lucide-react v0.507.0 - ISC
3
- *
4
- * This source code is licensed under the ISC license.
5
- * See the LICENSE file in the root directory of this source tree.
6
- */const yt=[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M3 10h18",key:"8toen8"}]],ft=J("calendar",yt);/**
7
- * @license lucide-react v0.507.0 - ISC
8
- *
9
- * This source code is licensed under the ISC license.
10
- * See the LICENSE file in the root directory of this source tree.
11
- */const gt=[["line",{x1:"6",x2:"6",y1:"3",y2:"15",key:"17qcm7"}],["circle",{cx:"18",cy:"6",r:"3",key:"1h7g24"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}],["path",{d:"M18 9a9 9 0 0 1-9 9",key:"n2h4wq"}]],bt=J("git-branch",gt);/**
12
- * @license lucide-react v0.507.0 - ISC
13
- *
14
- * This source code is licensed under the ISC license.
15
- * See the LICENSE file in the root directory of this source tree.
16
- */const jt=[["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"}]],kt=J("id-card",jt),he=t=>["agent-system-prompt",t],wt=t=>{const{shouldEnableQuery:n}=Ve();return We({enabled:n({bypassInternetCheck:!0})&&!!t,queryKey:he(t),queryFn:async()=>{try{const o=await X(Z.baseUrl).agents.getAgentSystemPrompt(t);if(o.status>=400)throw new Error(o.message||"Failed to fetch agent system prompt");return o.result?.system_prompt||""}catch(s){const o=s instanceof Error?s.message:"An unknown error occurred while fetching agent system prompt";throw K(o),s}},refetchOnWindowFocus:!1,staleTime:5e3})},vt=t=>{const n=Ke(),s=X(Z.baseUrl);return Be({mutationFn:async o=>{try{const a=await s.agents.updateAgentSystemPrompt(t,o);if(a.status>=400)throw new Error(a.message||"Failed to update agent system prompt");return a}catch(a){const l=a instanceof Error?a.message:"An unknown error occurred while updating agent system prompt";throw K(l),a}},onSuccess:async()=>{await n.invalidateQueries({queryKey:he(t)}),Ge("Agent system prompt updated")},onError:o=>{console.error("Error updating agent system prompt:",o)}})},g={temperature:.2,top_p:.9,top_k:40,max_tokens:4096,frequency_penalty:0,presence_penalty:0,seed:42},E=({label:t,description:n,defaultLabel:s,onSet:o})=>e.jsxs("div",{className:"flex items-start justify-between gap-4",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsxs("div",{className:"flex items-baseline gap-2",children:[e.jsx("span",{className:"text-body-sm text-ink",children:t}),e.jsx("span",{className:"text-meta text-ink-dim",children:"Not set yet"})]}),e.jsx("p",{className:"mt-1 text-meta text-ink-dim",children:n})]}),e.jsxs(N,{variant:"secondary",size:"sm",className:"shrink-0",onClick:o,children:["Set to default (",s,")"]})]}),Y=({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]}),Ct=({selectedAgent:t,savingField:n,setSavingField:s,updateAgentMutation:o,refetchAgent:a,initialSelectedAgentId:l})=>{const[c,y]=r.useState(t);r.useEffect(()=>{y(t)},[t]);const[h,f]=r.useState(!1),j=r.useId(),k=h?Ie:De;return e.jsxs("div",{children:[e.jsxs("h2",{className:"flex items-center gap-2",children:[e.jsxs("button",{type:"button",onClick:()=>f(!h),"aria-expanded":h,"aria-controls":j,className:"group flex items-center gap-2 py-1 text-left 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"}),"Advanced chat settings"]}),e.jsx(U,{content:"Advanced settings to change how the agent generates responses",children:e.jsx(N,{variant:"ghost",size:"icon-sm","aria-label":"About advanced chat settings",children:e.jsx(W,{})})})]}),h&&e.jsxs("div",{id:j,className:"mt-3",children:[e.jsx("p",{className:"max-w-2xl text-body-sm text-ink-muted",children:"Set custom values for any of these options. Anything left unset uses a default optimized from user testing."}),e.jsxs("div",{className:"mt-6 flex flex-col gap-8",children:[e.jsxs(Y,{title:"Sampling",children:[c.temperature===null?e.jsx(E,{label:"Temperature",description:"Controls randomness in responses (0.0-1.0). Higher values make output more random.",defaultLabel:g.temperature,onSet:async()=>{s("temperature");try{const u={temperature:g.temperature};await o.mutateAsync({agentId:t.id,update:u}),y(i=>({...i,temperature:g.temperature})),t.id===l&&a&&await a()}catch{}finally{s(null)}}}):e.jsx(T,{value:c.temperature??g.temperature,label:"Temperature",description:"Controls randomness in responses (0.0-1.0). Higher values make output more random.",min:0,max:1,step:.01,isSaving:n==="temperature",onChange:async u=>{s("temperature");try{const i={temperature:u};await o.mutateAsync({agentId:t.id,update:i}),t.id===l&&a&&await a()}catch{}finally{s(null)}}}),c.top_p===null?e.jsx(E,{label:"Top P",description:"Controls cumulative probability of tokens to sample from (0.0-1.0).",defaultLabel:g.top_p,onSet:async()=>{s("top_p");try{const u={top_p:g.top_p};await o.mutateAsync({agentId:t.id,update:u}),y(i=>({...i,top_p:g.top_p})),t.id===l&&a&&await a()}catch{}finally{s(null)}}}):e.jsx(T,{value:c.top_p??g.top_p,label:"Top P",description:"Controls cumulative probability of tokens to sample from (0.0-1.0).",min:0,max:1,step:.01,isSaving:n==="top_p",onChange:async u=>{s("top_p");try{const i={top_p:u};await o.mutateAsync({agentId:t.id,update:i}),t.id===l&&a&&await a()}catch{}finally{s(null)}}}),c.top_k===null?e.jsx(E,{label:"Top K",description:"Limits tokens to sample from at each step.",defaultLabel:g.top_k,onSet:async()=>{s("top_k");try{const u={top_k:g.top_k};await o.mutateAsync({agentId:t.id,update:u}),y(i=>({...i,top_k:g.top_k})),t.id===l&&a&&await a()}catch{}finally{s(null)}}}):e.jsx(T,{value:c.top_k??g.top_k,label:"Top K",description:"Limits tokens to sample from at each step.",min:1,max:100,step:1,isSaving:n==="top_k",onChange:async u=>{s("top_k");try{const i={top_k:u};await o.mutateAsync({agentId:t.id,update:i}),t.id===l&&a&&await a()}catch{}finally{s(null)}}}),c.seed===null?e.jsx(E,{label:"Seed",description:"Random number seed for deterministic generation.",defaultLabel:g.seed,onSet:async()=>{s("seed");try{const u={seed:g.seed};await o.mutateAsync({agentId:t.id,update:u}),y(i=>({...i,seed:g.seed})),t.id===l&&a&&await a()}catch{}finally{s(null)}}}):e.jsx(R,{value:c.seed?.toString()||"",label:"Seed",placeholder:"Random number seed for deterministic generation",icon:e.jsx(se,{size:16}),isSaving:n==="seed",onSave:async u=>{s("seed");try{const i=u.trim()?Number.parseInt(u,10):void 0;if(u.trim()&&Number.isNaN(i)){K("Seed must be a valid number");return}const d={seed:i};await o.mutateAsync({agentId:t.id,update:d}),t.id===l&&a&&await a()}catch{}finally{s(null)}}})]}),e.jsxs(Y,{title:"Repetition",children:[c.frequency_penalty===null?e.jsx(E,{label:"Frequency penalty",description:"Reduces repetition by lowering likelihood of repeated tokens (-2.0 to 2.0).",defaultLabel:g.frequency_penalty,onSet:async()=>{s("frequency_penalty");try{const u={frequency_penalty:g.frequency_penalty};await o.mutateAsync({agentId:t.id,update:u}),y(i=>({...i,frequency_penalty:g.frequency_penalty})),t.id===l&&a&&await a()}catch{}finally{s(null)}}}):e.jsx(T,{value:c.frequency_penalty??g.frequency_penalty,label:"Frequency penalty",description:"Reduces repetition by lowering likelihood of repeated tokens (-2.0 to 2.0).",min:-2,max:2,step:.01,isSaving:n==="frequency_penalty",onChange:async u=>{s("frequency_penalty");try{const i={frequency_penalty:u};await o.mutateAsync({agentId:t.id,update:i}),t.id===l&&a&&await a()}catch{}finally{s(null)}}}),c.presence_penalty===null?e.jsx(E,{label:"Presence penalty",description:"Increases diversity by lowering likelihood of prompt tokens (-2.0 to 2.0).",defaultLabel:g.presence_penalty,onSet:async()=>{s("presence_penalty");try{const u={presence_penalty:g.presence_penalty};await o.mutateAsync({agentId:t.id,update:u}),y(i=>({...i,presence_penalty:g.presence_penalty})),t.id===l&&a&&await a()}catch{}finally{s(null)}}}):e.jsx(T,{value:c.presence_penalty??g.presence_penalty,label:"Presence penalty",description:"Increases diversity by lowering likelihood of prompt tokens (-2.0 to 2.0).",min:-2,max:2,step:.01,isSaving:n==="presence_penalty",onChange:async u=>{s("presence_penalty");try{const i={presence_penalty:u};await o.mutateAsync({agentId:t.id,update:i}),t.id===l&&a&&await a()}catch{}finally{s(null)}}})]}),e.jsxs(Y,{title:"Length and stopping",children:[c.max_tokens===null?e.jsx(E,{label:"Max tokens",description:"Maximum tokens to generate in response.",defaultLabel:g.max_tokens,onSet:async()=>{s("max_tokens");try{const u={max_tokens:g.max_tokens};await o.mutateAsync({agentId:t.id,update:u}),y(i=>({...i,max_tokens:g.max_tokens})),t.id===l&&a&&await a()}catch{}finally{s(null)}}}):e.jsx(T,{value:c.max_tokens??g.max_tokens,label:"Max tokens",description:"Maximum tokens to generate in response.",min:1,max:8192,step:1,isSaving:n==="max_tokens",onChange:async u=>{s("max_tokens");try{const i={max_tokens:u};await o.mutateAsync({agentId:t.id,update:i}),t.id===l&&a&&await a()}catch{}finally{s(null)}}}),c.stop===null?e.jsx(E,{label:"Stop sequences",description:"Sequences that will cause the model to stop generating text.",defaultLabel:"empty",onSet:async()=>{s("stop");try{const u={stop:[]};await o.mutateAsync({agentId:t.id,update:u}),y(i=>({...i,stop:[]})),t.id===l&&a&&await a()}catch{}finally{s(null)}}}):e.jsx(R,{value:c.stop?.join(`
17
- `)||"",label:"Stop sequences",placeholder:"Enter stop sequences (one per line)...",icon:e.jsx(se,{size:16}),multiline:!0,rows:3,isSaving:n==="stop",onSave:async u=>{s("stop");try{const i=u.split(`
18
- `).map(x=>x.trim()).filter(x=>x.length>0),d={stop:i.length>0?i:void 0};await o.mutateAsync({agentId:t.id,update:d}),t.id===l&&a&&await a()}catch{}finally{s(null)}}})]})]})]})]})},xe=["investment","accounting","healthcare","legal","software","security","role_play","personal_assistance","education","marketing","sales","research","analysis","management","social_media","other"],V=Object.fromEntries(xe.map(t=>[t,t.split("_").map(n=>n.charAt(0).toUpperCase()+n.slice(1)).join(" ")])),Nt=({value:t,label:n,onChange:s,placeholder:o="Add category...",disabled:a=!1,icon:l})=>{const[c,y]=r.useState(""),[h,f]=r.useState(!1),[j,k]=r.useState(0),u=r.useRef(null),i=r.useRef([]),d=r.useId(),x=r.useId(),v=r.useMemo(()=>{const p=c.trim().toLowerCase();return xe.filter(b=>!t.includes(b)&&(!p||V[b].toLowerCase().includes(p)))},[t,c]);r.useEffect(()=>{h&&i.current[j]?.scrollIntoView({block:"nearest"})},[j,h]);const D=p=>{t.includes(p)||s([...t,p]),y(""),f(!1),k(0),u.current?.focus()},q=p=>{y(p.target.value),k(0),f(!0)},L=p=>{const b=v.length;switch(p.key){case"ArrowDown":if(p.preventDefault(),b===0)break;h?k((j+1)%b):(k(0),f(!0));break;case"ArrowUp":if(p.preventDefault(),b===0)break;h?k((j-1+b)%b):(k(b-1),f(!0));break;case"Enter":h&&v[j]&&(p.preventDefault(),D(v[j]));break;case"Escape":h&&(p.preventDefault(),f(!1));break;case"Home":h&&(p.preventDefault(),k(0));break;case"End":h&&(p.preventDefault(),k(v.length-1));break}},P=p=>{s(t.filter(b=>b!==p)),k(0)},w=h&&v[j]?`${x}-option-${j}`:void 0;return e.jsxs("div",{children:[e.jsxs(ie,{htmlFor:d,className:"mb-1.5 flex items-center gap-2 text-ink-muted",children:[l,n]}),e.jsxs("div",{className:I("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",a&&"border-hairline bg-sunken"),children:[t.map(p=>e.jsxs(re,{className:"gap-1 pr-1 text-ink",children:[V[p]||p,e.jsx("button",{type:"button","aria-label":`Remove category ${V[p]||p}`,disabled:a,onClick:()=>P(p),className:I("rounded-xs text-ink-dim","transition-colors duration-fast ease-out-quart","hover:text-danger disabled:text-ink-disabled"),children:e.jsx(le,{})})]},p)),e.jsxs(Se,{open:h,onOpenChange:f,children:[e.jsx(Ee,{asChild:!0,children:e.jsx("input",{id:d,ref:u,type:"text",role:"combobox","aria-expanded":h,"aria-controls":x,"aria-autocomplete":"list","aria-activedescendant":w,autoComplete:"off",value:c,placeholder:o,disabled:a,"aria-label":n,onChange:q,onKeyDown:L,onClick:()=>{v.length>0&&f(!0)},className:I("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(Ue,{align:"start",sideOffset:4,onOpenAutoFocus:p=>p.preventDefault(),className:"max-h-60 w-(--radix-popover-trigger-width) overflow-y-auto p-1",children:e.jsx("div",{id:x,role:"listbox","aria-label":n,children:v.map((p,b)=>e.jsx("div",{id:`${x}-option-${b}`,ref:_=>{i.current[b]=_},role:"option","aria-selected":b===j,onMouseDown:_=>{_.preventDefault()},onMouseEnter:()=>k(b),onClick:()=>D(p),className:I("cursor-pointer rounded-sm px-3 py-1.5 font-medium text-body-sm",b===j?"bg-accent-wash":void 0,"text-ink"),children:V[p]||p},p))})})]})]}),t.length===0&&e.jsx("span",{className:"mt-1 ml-1 block text-ink-dim text-meta",children:"No categories selected"})]})},_t=({value:t,label:n,onChange:s,placeholder:o="Add tag...",disabled:a=!1,icon:l})=>{const[c,y]=r.useState(""),h=r.useRef(null),f=r.useId(),j=d=>{y(d.target.value)},k=()=>{const d=c.trim().toLowerCase();d&&!t.includes(d)&&s([...t,d]),y("")},u=d=>{d.key==="Enter"&&c.trim()?(d.preventDefault(),k()):d.key==="Backspace"&&!c&&t.length>0&&s(t.slice(0,-1))},i=d=>{s(t.filter(x=>x!==d))};return e.jsxs("div",{children:[e.jsxs(ie,{htmlFor:f,className:"mb-1.5 flex items-center gap-2 text-ink-muted",children:[l,n]}),e.jsxs("div",{className:I("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",a&&"border-hairline bg-sunken"),children:[t.map(d=>e.jsxs(re,{className:"gap-1 pr-1 text-ink",children:[d,e.jsx("button",{type:"button","aria-label":`Remove tag ${d}`,disabled:a,onClick:()=>i(d),className:I("rounded-xs text-ink-dim","transition-colors duration-fast ease-out-quart","hover:text-danger disabled:text-ink-disabled"),children:e.jsx(le,{})})]},d)),e.jsx("input",{id:f,ref:h,type:"text",value:c,onChange:j,onKeyDown:u,placeholder:o,disabled:a,"aria-label":n,className:I("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")}),c.trim()&&e.jsx(N,{variant:"ghost",size:"icon-sm","aria-label":"Add tag",disabled:a,onClick:()=>{k(),h.current?.focus()},className:"text-accent hover:text-accent",children:e.jsx(Qe,{})})]}),t.length===0&&!c&&e.jsx("span",{className:"mt-1 ml-1 block text-ink-dim text-meta",children:"No tags added"})]})},It=({selectedAgent:t,savingField:n,setSavingField:s,updateAgentMutation:o,refetchAgent:a,initialSelectedAgentId:l})=>{const{data:c,isLoading:y}=Ye(),[h,f]=r.useState("");r.useEffect(()=>{!y&&c?.values?f(t.hosting||c.values.hosting||""):y||f(t.hosting||"")},[t,c,y]);const[j,k]=r.useState(!1),[u,i]=r.useState(!1);return e.jsxs("div",{className:"flex flex-col gap-4",children:[e.jsx(R,{value:t.name,label:"Agent name",placeholder:"Enter agent name...",isSaving:n==="name",onSave:async d=>{if(!d.trim()){K("Agent name cannot be empty");return}s("name");try{const x={name:d};await o.mutateAsync({agentId:t.id,update:x}),t.id===l&&a&&await a()}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(Je,{value:t.hosting||(c?.values.hosting??""),isSaving:n==="hosting",onSave:async d=>{s("hosting"),f(d);try{const x={hosting:d,model:""};await o.mutateAsync({agentId:t.id,update:x}),t.id===l&&a&&await a()}catch{f(t.hosting||"")}finally{s(null)}},filterByCredentials:!0,allowDefault:!0},`hosting-select-${t.id}-${t.hosting||(c?.values.hosting??"default")}`)}),e.jsx("div",{"data-tour-tag":"agent-settings-model-select",children:h?e.jsx(Xe,{value:t.hosting?t.model||"":t.model||(c?.values.model_name??""),hostingId:h,isSaving:n==="model",allowDefault:!0,onSave:async d=>{s("model");try{const x={model:d};await o.mutateAsync({agentId:t.id,update:x}),t.id===l&&a&&await a()}catch{}finally{s(null)}}},`model-select-${t.id}-${h}-${t.model||(!t.hosting&&c?.values.model_name?c.values.model_name:"default")}`):e.jsxs("div",{className:"relative",children:[e.jsx(U,{content:"Select a hosting provider first, and then select the AI model that you want to use. Each model has different capabilities and costs. Recommended: Automatic",children:e.jsxs("div",{className:"mb-1.5 flex w-fit items-center gap-2 text-body-sm text-ink-muted",children:[e.jsx(Ze,{size:16,"aria-hidden":"true"}),"Model"]})}),e.jsx("div",{className:"flex h-8 w-full items-center rounded-sm border border-control bg-surface px-3",children:e.jsx("span",{className:"truncate text-body-sm text-ink-disabled",children:"Select a hosting provider first..."})})]})})]}),e.jsxs("h2",{className:"mt-4 flex items-center gap-2 text-heading text-ink",children:[e.jsx(W,{size:16,className:"shrink-0 text-ink-dim"}),"Agent information"]}),e.jsxs("div",{className:"flex flex-col gap-4",children:[e.jsx(R,{value:t.description||"",label:"Description",placeholder:"Enter agent description...",multiline:!0,rows:3,isSaving:n==="description",onSave:async d=>{s("description");try{const x={description:d};await o.mutateAsync({agentId:t.id,update:x}),t.id===l&&a&&await a()}catch{}finally{s(null)}}}),e.jsx(_t,{value:t.tags||[],label:"Tags",placeholder:"Add tag...",disabled:j,onChange:async d=>{if(!(Array.isArray(t.tags)&&d.length===t.tags.length&&d.every((x,v)=>x===t.tags?.[v]))){k(!0);try{const x={tags:d};await o.mutateAsync({agentId:t.id,update:x}),t.id===l&&a&&await a()}catch{}finally{k(!1)}}}}),e.jsx(Nt,{value:t.categories||[],label:"Categories",placeholder:"Add category...",disabled:u,onChange:async d=>{if(!(Array.isArray(t.categories)&&d.length===t.categories.length&&d.every((x,v)=>x===t.categories?.[v]))){i(!0);try{const x={categories:d};await o.mutateAsync({agentId:t.id,update:x}),t.id===l&&a&&await a()}catch{}finally{i(!1)}}}}),e.jsxs(ht,{children:[e.jsx(Q,{label:e.jsxs(e.Fragment,{children:[e.jsx(kt,{size:12,"aria-hidden":"true"}),"ID"]}),value:e.jsx("span",{className:"font-mono text-mono-sm",children:t.id})}),e.jsx(Q,{label:e.jsxs(e.Fragment,{children:[e.jsx(ft,{size:12,"aria-hidden":"true"}),"Created"]}),value:Ae(t.created_date)}),e.jsx(Q,{label:e.jsxs(e.Fragment,{children:[e.jsx(bt,{size:12,"aria-hidden":"true"}),"Version"]}),value:t.version})]})]})]})},Dt=({selectedAgent:t,savingField:n,setSavingField:s,updateAgentMutation:o,refetchAgent:a,initialSelectedAgentId:l})=>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(Fe,{size:16,className:"shrink-0 text-ink-dim"}),"Security instructions",e.jsx(U,{content:`Security instructions that guide the agent's behavior and limitations. This is the "system prompt" for the security agent.`,children:e.jsx(N,{variant:"ghost",size:"icon-sm","aria-label":"About security instructions",children:e.jsx(W,{})})})]}),e.jsx("p",{className:"mt-1 max-w-2xl text-body-sm text-ink-muted",children:`This prompt is directed to the AI security reviewer. It helps the reviewer decide whether to block or allow actions based on safety. Write as if talking to another agent that is watching this agent (eg. "Allow all git operations", "Don't let the agent access drive files in the restricted folder"). Update this to allow the agent to perform actions if you are getting frequent security blocks.`}),e.jsx("div",{className:"mt-4",children:e.jsx(R,{value:t.security_prompt||"",label:"",placeholder:"Enter instructions for the security agent...",multiline:!0,rows:6,isSaving:n==="security_prompt",onSave:async c=>{s("security_prompt");try{const y={security_prompt:c};await o.mutateAsync({agentId:t.id,update:y}),t.id===l&&a&&await a()}catch{}finally{s(null)}}})})]}),St=({selectedAgent:t,savingField:n,setSavingField:s,refetchAgent:o,initialSelectedAgentId:a})=>{const{data:l,isLoading:c}=wt(t.id),y=vt(t.id),[h,f]=r.useState("");return r.useEffect(()=>{l!==void 0&&f(l)},[l]),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(xt,{size:16,className:"shrink-0 text-ink-dim"}),"Agent instructions",e.jsx(U,{content:`System instructions that define the agent's behavior and capabilities. This is the agent's "system prompt".`,children:e.jsx(N,{variant:"ghost",size:"icon-sm","aria-label":"About agent instructions",children:e.jsx(W,{})})})]}),e.jsx("p",{className:"mt-1 max-w-2xl text-body-sm text-ink-muted",children:`Define the agent's role, personality, or provide context. Write as if talking to the agent (e.g., "You are an expert researcher") and/or about yourself (e.g., "My name is John").`}),e.jsx("div",{className:"mt-4",children:e.jsx(R,{value:h,label:"",placeholder:c?"Loading system prompt...":"Enter instructions for the agent...",multiline:!0,rows:6,isSaving:n==="system_prompt",onSave:async j=>{s("system_prompt");try{await y.mutateAsync(j),t.id===a&&o&&await o()}catch{}finally{s(null)}}})})]})},Et=({selectedAgent:t,refetchAgent:n,initialSelectedAgentId:s})=>{const[o,a]=r.useState(null),l=et();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(It,{selectedAgent:t,savingField:o,setSavingField:a,updateAgentMutation:l,refetchAgent:n,initialSelectedAgentId:s}),e.jsx(St,{selectedAgent:t,savingField:o,setSavingField:a,refetchAgent:n,initialSelectedAgentId:s}),e.jsx(Dt,{selectedAgent:t,savingField:o,setSavingField:a,updateAgentMutation:l,refetchAgent:n,initialSelectedAgentId:s}),e.jsx(Ct,{selectedAgent:t,savingField:o,setSavingField:a,updateAgentMutation:l,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(A,{size:48,className:"text-ink-dim","aria-hidden":"true"}),e.jsx("h2",{className:"text-heading text-ink",children:"No agent selected"}),e.jsx("p",{className:"max-w-md text-body-sm text-ink-muted",children:"Select an agent from the list on the left to view its configuration and details."})]})})},Ut=1200,qt=({agent:t,isSelected:n,onSelectAgent:s,onChatWithAgent:o,onExportAgent:a,onAgentDeleted:l,onUploadAgentToHub:c})=>{const y=t.description||"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:I("flex w-full items-center gap-2 rounded-sm py-1.5 pr-9 pl-2 text-left","transition-colors duration-fast ease-out-quart",n?"bg-accent-wash":"hover:bg-elevated"),children:[e.jsx(Re,{className:"size-8 shrink-0",children:e.jsx(Oe,{children:e.jsx(A,{size:16,"aria-hidden":!0})})}),e.jsxs("span",{className:"min-w-0 flex-1",children:[e.jsx(U,{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(U,{content:y,side:"bottom",align:"start",children:e.jsx("span",{className:"block truncate text-meta text-ink-dim",children:y})})]})]}),e.jsx("div",{className:I("pointer-events-none absolute top-0 right-1 flex h-full items-center","opacity-0 transition-opacity duration-fast ease-out-quart","group-hover:pointer-events-auto group-hover:opacity-100","group-focus-within:pointer-events-auto group-focus-within:opacity-100"),children:e.jsx(U,{content:"Agent options",children:e.jsx("span",{children:e.jsx(lt,{agentId:t.id,agentName:t.name,isAgentsPage:!0,onAgentDeleted:()=>l(t.id),onChatWithAgent:()=>o(t.id),onExportAgent:()=>a(t.id),onUploadAgentToHub:()=>c(t),buttonSx:{width:24,height:24,borderRadius:"6px",display:"flex",justifyContent:"center",alignItems:"center"}})})})})]})},Lt=(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,Pt=r.memo(qt,Lt),Tt=({selectedAgentId:t,onSelectAgent:n})=>{const s=ce(),[o,a]=r.useState(""),l=tt(m=>m.openCreateAgentDialog),c=at(o.trim(),250),[y,h]=r.useState(!1),f=50,[j,k]=r.useState(!1),[u,i]=r.useState(null),[d,x]=r.useState([]),{isAuthenticated:v}=de(),D=r.useMemo(()=>X(Z.baseUrl),[]),q=ue(),{page:L,setPage:P}=st(),{data:w,isLoading:p,isError:b,refetch:_}=nt(L,f,0,c||void 0,"created_date","desc"),B=w?.agents||[],F=w?.total||0,{data:O}=pe(t&&!B.find(m=>m.id===t)?t:void 0),$=r.useMemo(()=>{const m=[...B];return O&&!m.find(C=>C.id===O.id)&&m.push(O),m.sort((C,S)=>new Date(S.created_date).getTime()-new Date(C.created_date).getTime()),m},[B,O]),ye=r.useCallback(m=>{P(m)},[P]),fe=r.useCallback(m=>{n(m)},[n]),ge=r.useCallback(()=>{h(!0)},[]),be=r.useCallback(()=>{h(!1)},[]),je=r.useCallback(async m=>{try{const C=await q.mutateAsync(m),S=$.find(_e=>_e.id===m),z=S?S.name.replace(/\s+/g,"-").toLowerCase():m,H=URL.createObjectURL(C),M=document.createElement("a");M.href=H,M.download=`${z}-export.zip`,document.body.appendChild(M),M.click(),URL.revokeObjectURL(H),document.body.removeChild(M)}catch(C){console.error("Failed to export agent:",C)}},[$,q]),ee=r.useCallback(m=>{if(!m)return["No agent selected."];const C=[];return(!m.name||m.name.trim()==="")&&C.push("Name is required."),(!m.description||m.description.trim()==="")&&C.push("Description is required."),m.categories&&m.categories.length>0||C.push("At least one category is required."),C},[]),te=r.useCallback(m=>{i(m),x(ee(m)),k(!0)},[ee]),G=r.useCallback(()=>{k(!1),i(null),x([])},[]),ke=r.useCallback(()=>{G()},[G]),we=r.useCallback(async m=>{try{const S=((await _()).data?.agents||[]).find(H=>H.id===m);if(S){n(S);return}const z=await D.agents.getAgent(m);z.status<400&&z.result&&n(z.result)}catch(C){console.error("Error selecting newly created agent:",C)}},[n,_,D]),ve=r.useCallback(m=>{s(`/chat/${m}`)},[s]),Ce=r.useCallback(m=>{_(),s("/agents")},[t,_,s]),Ne=r.useCallback(m=>{te(m)},[te]);return e.jsxs("div",{className:"flex h-full w-full flex-col overflow-hidden border-hairline border-r bg-surface",children:[e.jsx(ot,{title:"Agents",searchQuery:o,onSearchChange:m=>a(m),onNewAgentClick:l,onImportAgentClick:ge,importAgentTooltip:"Import an agent from a ZIP file"}),p?e.jsx("div",{className:"flex flex-1 items-center justify-center",children:e.jsx(qe,{size:"lg",label:"Loading agents"})}):b?e.jsxs(Le,{variant:"danger",role:"alert",className:"m-4 w-auto",children:[e.jsx(Pe,{children:"Failed to load agents. Please try again."}),e.jsx(N,{variant:"ghost",size:"sm",className:"self-start",onClick:()=>_(),children:"Retry"})]}):$.length===0&&!p?e.jsx("p",{className:"p-6 text-center text-body-sm text-ink-muted",children:o?"No agents match your search":"No agents found"}):e.jsx(Te,{delayDuration:Ut,skipDelayDuration:0,children:e.jsx("ul",{className:"flex min-h-0 flex-1 flex-col gap-1 overflow-y-auto p-2",children:$.map(m=>e.jsx(Pt,{agent:m,isSelected:t===m.id||O?.id===m.id,onSelectAgent:fe,onChatWithAgent:ve,onExportAgent:je,onAgentDeleted:Ce,onUploadAgentToHub:Ne},m.id))})}),e.jsx(it,{open:y,onClose:be,onAgentImported:we}),F>0&&e.jsx(rt,{page:L,count:Math.max(1,Math.ceil(F/f)),onChange:ye}),e.jsx(me,{open:j,onClose:G,agentName:u?.name||"",isAuthenticated:v,onConfirmUpload:ke,validationIssues:d})]})},Rt=r.memo(Tt),Ht=()=>{const{agentId:t,navigateToAgent:n}=ct(),s=ce(),{isAuthenticated:o}=de(),[a,l]=r.useState(!1),[c,y]=r.useState([]),h=ue(),f=dt(),{setLastAgentsPageAgentId:j,getLastAgentId:k}=ut(),u=t||k("agents"),{data:i,refetch:d}=pe(u||void 0);r.useEffect(()=>{t&&j(t)},[t,j]);const x=async()=>{if(i)try{const w=await h.mutateAsync(i.id),p=URL.createObjectURL(w),b=document.createElement("a");b.href=p,b.download=`${i.name.replace(/\s+/g,"-").toLowerCase()}-lo-agent.zip`,document.body.appendChild(b),b.click(),URL.revokeObjectURL(p),document.body.removeChild(b)}catch(w){console.error("Failed to export agent:",w)}},v=w=>{if(!w)return["No agent selected."];const p=[];return(!w.name||w.name.trim()==="")&&p.push("Name is required."),(!w.description||w.description.trim()==="")&&p.push("Description is required."),w.categories&&w.categories.length>0||p.push("At least one category is required."),p},D=()=>{const w=v(i??null);y(w),l(!0)},q=()=>{l(!1),y([])},L=()=>{!i||!o||(f.mutateAsync(i.id),q())},P=w=>{j(w.id),n(w.id,"agents")};return e.jsxs("div",{className:"flex h-full w-full overflow-hidden",children:[e.jsx("div",{className:"h-full w-70 shrink-0",children:e.jsx(Rt,{selectedAgentId:i?.id,onSelectAgent:P})}),e.jsx("div",{className:"h-full grow overflow-hidden",children:e.jsxs("div",{className:"flex h-full flex-col gap-8 p-4 sm:p-6 lg:p-8",children:[e.jsx("div",{className:"mx-auto w-full max-w-4xl",children:e.jsx(He,{title:"Agent management",icon:A,subtitle:"View, configure and manage your agents",children:i&&e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs(ze,{children:[e.jsx(Me,{asChild:!0,children:e.jsx(N,{"data-tour-tag":"upload-to-hub-header-button",variant:"secondary",size:"icon","aria-label":"More agent actions",className:"@min-[400px]:hidden",children:e.jsx(pt,{"aria-hidden":"true"})})}),e.jsxs($e,{align:"end",className:"min-w-45",children:[e.jsxs(ae,{disabled:h.isPending,onSelect:x,children:[e.jsx(ne,{"aria-hidden":"true"}),e.jsx("span",{children:"Export"})]}),e.jsxs(ae,{disabled:f.isPending,onSelect:D,children:[e.jsx(oe,{"aria-hidden":"true"}),e.jsx("span",{children:f.isPending?"Uploading...":"Upload to hub"})]})]})]}),e.jsxs(N,{variant:"secondary",onClick:x,disabled:h.isPending,className:"hidden @min-[400px]:inline-flex",children:[e.jsx(ne,{"aria-hidden":"true"}),"Export"]}),e.jsxs(N,{"data-tour-tag":"upload-to-hub-header-button","data-tour-action":"open-upload-dialog",variant:"secondary",onClick:D,disabled:f.isPending,className:"hidden @min-[400px]:inline-flex",children:[e.jsx(oe,{"aria-hidden":"true"}),f.isPending?"Uploading...":"Upload to hub"]}),e.jsx(U,{content:`Chat with ${i.name||"this agent"}`,children:e.jsxs(N,{variant:"primary",onClick:()=>s(`/chat/${i.id}`),children:[e.jsx(mt,{"aria-hidden":"true"}),"Chat"]})})]})})}),e.jsx("div",{className:"min-h-0 grow overflow-hidden",children:e.jsx(Et,{selectedAgent:i??null,refetchAgent:d,initialSelectedAgentId:t})})]})}),i&&e.jsx(me,{open:a,onClose:q,agentName:i?.name??"",isAuthenticated:o,onConfirmUpload:L,validationIssues:c})]})};export{Ht as AgentsPage};
@@ -1 +0,0 @@
1
- import{U as a,C as n}from"./mermaid.core-CFY9BM3R.js";const t=(r,o)=>a.lang.round(n.parse(r)[o]);export{t as c};
@@ -1 +0,0 @@
1
- import{s as a,c as s,a as e,C as t}from"./chunk-A2AXSNBT-DiTT6jkA.js";import{_ as i}from"./mermaid.core-CFY9BM3R.js";import"./chunk-RZ5BOZE2-byZRPh67.js";import"./index-DZnGa8Vt.js";import"./icon-BIaTDBQz.js";import"./step-DMJAOHzS.js";var u={parser:e,get db(){return new t},renderer:s,styles:a,init:i(r=>{r.class||(r.class={}),r.class.arrowMarkerAbsolute=r.arrowMarkerAbsolute},"init")};export{u as diagram};