local-operator-ui 0.38.0 → 0.38.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (21) hide show
  1. package/out/renderer/assets/{agent-details-page-ydYZH4Kq.js → agent-details-page-A51rffCS.js} +2 -2
  2. package/out/renderer/assets/{agent-hub-page-C46GCUT2.js → agent-hub-page-DQ-tnD26.js} +1 -1
  3. package/out/renderer/assets/{agents-page-BaARss9y.js → agents-page-Bh6SGDaA.js} +3 -3
  4. package/out/renderer/assets/{browser-page-BVFs2_w9.js → browser-page-Daga5nCP.js} +1 -1
  5. package/out/renderer/assets/{browser-webauthn-prompt-Ch0P_oH9.js → browser-webauthn-prompt-CdHXLdwX.js} +1 -1
  6. package/out/renderer/assets/{index-jVCAPb0a.js → index-BZYkm39z.js} +158 -158
  7. package/out/renderer/assets/{legacy-agents-page-BovdqsXe.js → legacy-agents-page-ccL-99ea.js} +3 -3
  8. package/out/renderer/assets/{library-page-Cm-o3Z-q.js → library-page-C8ymyVUW.js} +3 -3
  9. package/out/renderer/assets/{mesh-page-ChyvMUoR.js → mesh-page-Dn77Ie1F.js} +1 -1
  10. package/out/renderer/assets/{org-access-CU1oOVqv.js → org-access-CfGyU5hi.js} +1 -1
  11. package/out/renderer/assets/{projects-page-BSvdM2gY.js → projects-page-xuLYnWBj.js} +4 -4
  12. package/out/renderer/assets/{publication-validation-g2Kk53C8.js → publication-validation-CCv7pQJH.js} +1 -1
  13. package/out/renderer/assets/{radient-auth-buttons-DP81yj6b.js → radient-auth-buttons-Huoo_kFK.js} +1 -1
  14. package/out/renderer/assets/{schedules-page-CNIApkVt.js → schedules-page-vsfnEcLJ.js} +1 -1
  15. package/out/renderer/assets/{settings-page-Cd8GUEn_.js → settings-page-CnBnFo-w.js} +1 -1
  16. package/out/renderer/assets/{smartart-DAuiyto3.js → smartart-D5HiGUV-.js} +1 -1
  17. package/out/renderer/assets/team-bridge-page-JRqkQ8jV.js +11 -0
  18. package/out/renderer/assets/{use-download-agent-mutation-B-kxWpF6.js → use-download-agent-mutation-BZhcL_Dx.js} +2 -2
  19. package/out/renderer/index.html +1 -1
  20. package/package.json +1 -1
  21. package/out/renderer/assets/team-bridge-page-CosfhCZV.js +0 -11
@@ -1,6 +1,6 @@
1
- import{t as a,r as E,j as e,c as J}from"./index-N0lyyVVo.js";import{i as ge,a as fe}from"./publication-validation-g2Kk53C8.js";import{_ as oe,u as U,aN as C,aO as O,a2 as Y,aP as Q,aQ as le,aR as ce,aS as be,V as je,aT as pe,aU as ee,a1 as ye,aV as we,aW as ve}from"./conversation-input-sync-bgD4kyw3.js";import{c as Ne,u as Ce,L as ke,T as te,B as l,S as K,t as de,v as L,w as I,x as v,X as Ae,y as N,A as se,z as ae,E as ne}from"./error-boundary-DJAF_aYL.js";import{f as De,h as Se,u as _e,i as Te,a as Ee,b as Fe,c as Pe,O as ze,H as Me,A as qe,d as ie}from"./use-download-agent-mutation-B-kxWpF6.js";import{e as re}from"./en-US-CHJkXXr4.js";import{a4 as Le,a5 as Ie,a6 as Ke,a7 as Ue,a8 as Oe,a9 as Qe,aa as Be,ab as Re,K as We,ac as He,F as Ve,ad as Ye}from"./index-jVCAPb0a.js";import"./ui-preferences-store-C91RrpgH.js";import"./book-open-yjstLkVS.js";import"./console-mirror-CkCxHgcU.js";/**
1
+ import{t as a,r as E,j as e,c as J}from"./index-N0lyyVVo.js";import{i as ge,a as fe}from"./publication-validation-CCv7pQJH.js";import{_ as oe,u as U,aN as C,aO as O,a2 as Y,aP as Q,aQ as le,aR as ce,aS as be,V as je,aT as pe,aU as ee,a1 as ye,aV as we,aW as ve}from"./conversation-input-sync-bgD4kyw3.js";import{c as Ne,u as Ce,L as ke,T as te,B as l,S as K,t as de,v as q,w as I,x as v,X as Ae,y as N,A as se,z as ae,E as ne}from"./error-boundary-DJAF_aYL.js";import{f as De,h as Se,u as _e,i as Te,a as Ee,b as Fe,c as Pe,O as ze,H as Me,A as Le,d as ie}from"./use-download-agent-mutation-BZhcL_Dx.js";import{e as re}from"./en-US-CHJkXXr4.js";import{a6 as qe,a7 as Ie,a8 as Ke,a9 as Ue,aa as Oe,ab as Qe,ac as Be,ad as Re,L as We,ae as He,G as Ve,af as Ye}from"./index-BZYkm39z.js";import"./ui-preferences-store-C91RrpgH.js";import"./book-open-yjstLkVS.js";import"./console-mirror-CkCxHgcU.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:"M7.9 20A9 9 0 1 0 4 16.1L2 22Z",key:"vv11sd"}]],Xe=Ne("message-circle",$e);function Ze(t,o=Date.now()){return De(t,o,{locale:{...re,formatDistance(n,i,s){switch(n){case"xSeconds":return a("ui.hub.comments.age.seconds",{count:i});case"xMinutes":return a("ui.hub.comments.age.minutes",{count:i});case"xHours":return a("ui.hub.comments.age.hours",{count:i});case"xDays":return a("ui.hub.comments.age.days",{count:i});case"xMonths":return a("ui.hub.comments.age.months",{count:i});case"xYears":return a("ui.hub.comments.age.years",{count:i});default:return a("ui.hub.comments.age.fallback",{duration:re.formatDistance(n,i,s)})}}}})}const F={all:["agent-comments"],list:t=>[...F.all,"list",t]},Ge=({agentId:t,enabled:o=!0})=>oe({queryKey:F.list(t||"invalid"),queryFn:async()=>{if(!t)throw new Error("Agent ID is required to fetch comments.");return(await Le(t)).result},enabled:!!t&&o,staleTime:2*60*1e3,gcTime:5*60*1e3,refetchOnWindowFocus:!0}),Je=()=>{const t=U(),{isAuthenticated:o}=C();return O({mutationFn:async n=>{const{agentId:i,data:s}=n;if(!o)throw new Error(a("ui.hub.comments.mutation.unauthorized"));return Ie(i,s)},onSuccess:(n,i)=>{t.invalidateQueries({queryKey:F.list(i.agentId)}),Q(a("ui.hub.comments.mutation.posted"))},onError:n=>{Y(a("ui.hub.comments.mutation.post_failed",{reason:n.message}))}})},et=()=>{const t=U(),{isAuthenticated:o}=C();return O({mutationFn:async n=>{const{agentId:i,commentId:s,data:c}=n;if(!o)throw new Error(a("ui.hub.comments.mutation.unauthorized"));return Ke(i,s,c)},onSuccess:(n,i)=>{t.invalidateQueries({queryKey:F.list(i.agentId)}),Q(a("ui.hub.comments.mutation.updated"))},onError:n=>{Y(a("ui.hub.comments.mutation.update_failed",{reason:n.message}))}})},tt=()=>{const t=U(),{isAuthenticated:o}=C();return O({mutationFn:async n=>{const{agentId:i,commentId:s}=n;if(!o)throw new Error(a("ui.hub.comments.mutation.unauthorized"));return Ue(i,s)},onSuccess:(n,i)=>{t.invalidateQueries({queryKey:F.list(i.agentId)}),Q(a("ui.hub.comments.mutation.deleted"))},onError:n=>{Y(a("ui.hub.comments.mutation.delete_failed",{reason:n.message}))}})},st=({agentId:t})=>{Ce();const{isAuthenticated:o,user:n}=C(),[i,s]=E.useState(""),[c,j]=E.useState(null),[x,k]=E.useState(""),{data:u,isLoading:p,error:A}=Ge({agentId:t}),P=u?.records??[],g=Je(),D=et(),B=tt(),S=async r=>{if(r.preventDefault(),!(!i.trim()||!o||!t))try{await g.mutateAsync({agentId:t,data:{text:i}}),s("")}catch(d){console.error("Submit comment error caught in component:",d)}},R=(r,d)=>{j(r),k(d)},m=()=>{j(null),k("")},y=async()=>{if(!(!c||!x.trim()||!o||!t))try{await D.mutateAsync({agentId:t,commentId:c,data:{text:x}}),m()}catch(r){console.error("Update comment error caught in component:",r)}},w=async r=>{if(!(!o||!t)&&window.confirm(a("ui.hub.comments.delete.confirm")))try{await B.mutateAsync({agentId:t,commentId:r})}catch(d){console.error("Delete comment error caught in component:",d)}},W=r=>o&&n?.radientUser?.account?.id===r.account_id;return e.jsxs("div",{className:"mt-6",children:[e.jsx("h2",{className:"mb-4 font-semibold text-heading text-ink",children:a("ui.hub.comments.heading")}),o?e.jsxs("div",{className:"mb-4 flex flex-col gap-1.5",children:[e.jsxs(ke,{htmlFor:"new-comment",children:[e.jsx(Xe,{size:14,"aria-hidden":"true"}),a("ui.hub.comments.form.label")]}),e.jsxs("form",{onSubmit:S,className:"flex flex-col gap-3",children:[e.jsx(te,{id:"new-comment",placeholder:a("ui.hub.comments.form.placeholder"),rows:3,value:i,onChange:r=>s(r.target.value),required:!0}),e.jsx(l,{type:"submit",variant:"primary",disabled:g.isPending||!i.trim(),className:"self-end",children:g.isPending?e.jsx(K,{size:"sm",label:a("ui.hub.comments.form.posting")}):a("ui.hub.comments.form.submit")})]})]}):e.jsx("p",{className:"mt-6 mb-4 text-body-sm text-ink-muted",children:a("ui.hub.comments.form.sign_in")}),e.jsx(de,{className:"my-6"}),p&&e.jsx("ul",{className:"flex flex-col",children:[...Array(3)].map((r,d)=>e.jsxs("li",{className:"flex gap-3 pb-6",children:[e.jsx(L,{children:e.jsx(I,{children:e.jsx(v,{className:"size-full"})})}),e.jsxs("div",{className:"flex w-full flex-col gap-1.5",children:[e.jsx(v,{className:"h-3.5 w-24"}),e.jsx(v,{className:"h-3 w-15"}),e.jsx(v,{className:"mt-2 h-3.5 w-full"}),e.jsx(v,{className:"h-3.5 w-4/5"})]})]},`skeleton-${d}`))}),A&&e.jsx("p",{role:"alert",className:"my-6 text-body-sm text-danger",children:a("ui.hub.comments.load_error",{reason:A.message})}),!p&&!A&&e.jsx("ul",{className:"flex flex-col gap-6",children:P.length===0?e.jsx("li",{className:"text-body-sm text-ink-muted",children:a("ui.hub.comments.empty")}):P.map(r=>c===r.id?e.jsxs("li",{className:"flex gap-3",children:[e.jsx(L,{children:e.jsx(I,{children:r.account_metadata?.name?.charAt(0).toUpperCase()||"?"})}),e.jsxs("div",{className:"flex w-full flex-col gap-2",children:[e.jsx(te,{rows:3,value:x,onChange:d=>k(d.target.value),autoFocus:!0,"aria-label":a("ui.hub.comments.edit.label")}),e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsxs(l,{variant:"secondary",size:"sm",onClick:m,children:[e.jsx(Ae,{}),a("ui.hub.comments.edit.cancel")]}),e.jsxs(l,{variant:"primary",size:"sm",onClick:y,disabled:D.isPending||!x.trim(),children:[D.isPending?e.jsx(K,{size:"xs",label:a("ui.hub.comments.edit.saving")}):e.jsx(Oe,{}),a("ui.hub.comments.edit.save")]})]})]})]},r.id):e.jsxs("li",{className:"flex gap-3",children:[e.jsx(L,{children:e.jsx(I,{children:r.account_metadata?.name?.charAt(0).toUpperCase()||"?"})}),e.jsxs("div",{className:"w-full",children:[e.jsxs("div",{className:"flex w-full items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("p",{className:"font-medium text-body text-ink",children:r.account_metadata?.name||a("ui.hub.comments.author.unknown")}),e.jsx("p",{className:"text-ink-muted text-meta",children:Ze(new Date(r.created_at))})]}),W(r)&&e.jsxs("div",{className:"flex gap-0.5",children:[e.jsx(N,{content:a("ui.hub.comments.edit.label"),children:e.jsx(l,{variant:"ghost",size:"icon-sm",onClick:()=>R(r.id,r.text),disabled:!!c,"aria-label":a("ui.hub.comments.edit.label"),children:e.jsx(Qe,{})})}),e.jsx(N,{content:a("ui.hub.comments.delete.label"),children:e.jsx(l,{variant:"ghost",size:"icon-sm",onClick:()=>w(r.id),disabled:!!c,"aria-label":a("ui.hub.comments.delete.label"),children:e.jsx(le,{})})})]})]}),e.jsx("p",{className:"mt-2 text-body-sm text-ink whitespace-pre-wrap",children:r.text})]})]},r.id))})]})},$={all:["agent-details"],detail:t=>[...$.all,t]},at=({agentId:t,enabled:o=!0})=>oe({queryKey:$.detail(t||"invalid"),queryFn:async()=>{if(!t)throw new Error("Agent ID is required to fetch details.");return await Be(t)},select:i=>i.result,enabled:!!t&&o,staleTime:3e5,gcTime:6e5,refetchOnWindowFocus:!1}),nt=()=>{const t=U(),o=ce(),{isAuthenticated:n}=C();return O({mutationFn:async({agentId:s})=>{if(!n)throw new Error("Authentication required to delist an agent.");if(!s)throw new Error("Agent ID is required to delist.");return Re(s)},onSuccess:(s,c)=>{Q("Agent delisted"),t.invalidateQueries({queryKey:$.detail(c.agentId)}),ge(t),o("/agent-hub")},onError:s=>{console.error("Delist agent error:",s)}})},it={like:"The like did not go through",favourite:"The favourite did not go through",download:"The download did not start",delist:"The agent was not delisted"},V=({children:t})=>e.jsx("span",{className:"inline-flex h-4 min-w-5 items-center text-meta text-ink-muted",children:t}),ft=()=>{const{agentId:t}=be(),o=ce(),{isAuthenticated:n,user:i}=C(),{data:s,isLoading:c,isFetching:j,error:x,refetch:k}=at({agentId:t??"",enabled:!!t}),u=s?.visibility==="org",p=s?Se(s.name):"",{memberships:A}=We({enabled:u}),P=u?A.find(xe=>xe.tenant_id===s?.tenant_id)?.tenant_name??null:null,{statuses:g,isKnown:D,isError:B,isFetching:S,refetch:R}=_e({agentIds:t&&!u?[t]:[]}),m=Te(D,g,t),y=m&&g[t??""]?.liked===!0,w=m&&g[t??""]?.favourited===!0,W=s?.like_count??0,r=s?.favourite_count??0,d=s?.download_count??0,z=Ee(),M=Fe(),_=Pe(),f=nt(),[ue,q]=E.useState(!1),[b,h]=E.useState(null),H=!!i&&!!s&&i.radientUser?.account?.id===s.account_id,X=()=>{!t||!n||z.isPending||(h(null),z.mutate({agentId:t,isCurrentlyLiked:y},{onError:()=>h("like")}))},Z=()=>{!t||!n||M.isPending||(h(null),M.mutate({agentId:t,isCurrentlyFavourited:w},{onError:()=>h("favourite")}))},G=()=>{!t||!s||_.isPending||(h(null),_.mutate({agentId:s.id,agentName:s.name},{onError:()=>h("download")}))},me=()=>{!t||!H||f.isPending||(h(null),f.mutate({agentId:t},{onError:()=>h("delist")}),q(!1))},T=b?b==="like"?{action:"like",error:z.error,retry:X}:b==="favourite"?{action:"favourite",error:M.error,retry:Z}:b==="download"?{action:"download",error:_.error,retry:G}:{action:"delist",error:f.error,retry:void 0}:null,he=()=>{o("/agent-hub")};return c?e.jsx("div",{className:"flex h-full items-center justify-center",children:e.jsx(K,{label:"Loading agent details"})}):x?e.jsx("div",{className:"flex h-full items-center justify-center p-6",children:e.jsxs(se,{variant:"danger",className:"max-w-2xl",children:[e.jsx(ae,{children:"This agent could not be loaded"}),e.jsx(ne,{children:je("The Radient agent catalogue did not answer.",x)}),e.jsx("div",{className:"mt-2",children:e.jsx(l,{variant:"outline",size:"sm",onClick:()=>void k(),disabled:j,"aria-busy":j,children:j?"Trying…":"Try again"})})]})}):s?e.jsxs("div",{className:"m-6 flex flex-1 flex-col rounded-md bg-surface p-8",children:[e.jsxs("div",{className:"mb-6 flex items-center justify-between gap-4",children:[e.jsxs("div",{className:"flex min-w-0 items-center gap-4",children:[e.jsx(l,{variant:"ghost",size:"icon",onClick:he,"aria-label":"Back to Agent hub",children:e.jsx(He,{})}),e.jsx(L,{className:"size-11 shrink-0",children:e.jsx(I,{children:e.jsx(Ve,{size:22,"aria-hidden":"true"})})}),e.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[e.jsx("h1",{className:"truncate text-display text-ink",children:p}),u&&e.jsx(ze,{orgName:P})]})]}),e.jsxs("div",{className:"flex shrink-0 items-center gap-1",children:[!u&&e.jsxs(e.Fragment,{children:[e.jsx(N,{content:"Sign in to Radient to use this feature",disabled:n,children:e.jsx("span",{children:e.jsxs(l,{variant:"ghost",size:"sm",onClick:X,disabled:!n||z.isPending||!m,"aria-label":m?y?"Unlike agent":"Like agent":"Like state unavailable",className:J(y&&"text-danger"),children:[e.jsx(Me,{fill:y?"currentColor":"none"}),e.jsx(V,{children:W})]})})}),e.jsx(N,{content:"Sign in to Radient to use this feature",disabled:n,children:e.jsx("span",{children:e.jsxs(l,{variant:"ghost",size:"sm",onClick:Z,disabled:!n||M.isPending||!m,"aria-label":m?w?"Unfavourite agent":"Favourite agent":"Favourite state unavailable",className:J(w&&"text-warning"),children:[e.jsx(Ye,{fill:w?"currentColor":"none"}),e.jsx(V,{children:r})]})})})]}),e.jsx(N,{content:"Download agent to your computer",children:e.jsx("span",{children:e.jsxs(l,{variant:"ghost",size:"icon",onClick:G,disabled:_.isPending,"aria-label":"Download agent",className:"ml-1",children:[e.jsx(pe,{}),e.jsx(V,{children:_.isPending?e.jsx(v,{className:"h-3.5 w-5"}):d})]})})}),H&&!u&&e.jsx(N,{content:"Permanently delist this agent from Agent hub",children:e.jsx("span",{children:e.jsx(l,{variant:"ghost",size:"icon",onClick:()=>q(!0),disabled:f.isPending,"aria-label":"Delist agent",className:"ml-1 text-danger hover:bg-danger-wash hover:text-danger",children:e.jsx(le,{})})})})]})]}),n&&B&&!b&&!u&&e.jsxs("output",{className:"mb-6 flex flex-wrap items-center gap-2 text-meta text-warning","data-testid":"agent-details-status-unknown",children:[e.jsx("span",{children:"Your likes and favourites could not be read, so this agent's viewer state is not shown."}),e.jsx(l,{variant:"ghost",size:"sm",onClick:()=>void R(),disabled:S,"aria-busy":S,children:S?"Trying…":"Try again"})]}),T&&b&&e.jsxs(se,{variant:"danger",className:"mb-6","data-testid":"agent-details-error",children:[e.jsx(ae,{children:it[b]}),e.jsx(ne,{children:fe(T.action,T.error,p)}),T.retry&&e.jsx("div",{className:"mt-2",children:e.jsx(l,{variant:"outline",size:"sm",onClick:T.retry,children:"Try again"})})]}),e.jsx(qe,{tags:s.tags,categories:s.categories}),e.jsxs("div",{className:"mt-4 mb-6 flex flex-col gap-2 text-body-sm text-ink-muted",children:[e.jsxs("p",{children:["Created by: ",s.account_metadata?.name??"Unknown",s.account_metadata?.email?` (${s.account_metadata.email})`:""]}),e.jsxs("p",{children:["Created: ",ie(new Date(s.created_at))," ago (",ee(s.created_at),")"]}),e.jsxs("p",{children:["Last modified: ",ie(new Date(s.updated_at))," ","ago (",ee(s.updated_at),")"]})]}),e.jsx("div",{className:"mt-2 mb-8 leading-relaxed text-body text-ink",children:s.description||"No description provided."}),e.jsx(de,{className:"my-6"}),!u&&e.jsx(st,{agentId:s.id}),e.jsx(ye,{open:ue,onClose:()=>q(!1),title:"Delist this agent?",maxWidth:"xs",actions:e.jsxs(e.Fragment,{children:[e.jsx(we,{onClick:()=>q(!1),children:"Cancel"}),e.jsx(ve,{onClick:()=>{!t||!H||f.isPending||me()},disabled:f.isPending,children:f.isPending?e.jsx(K,{size:"sm",label:"Delisting agent"}):"Delist"})]}),dialogProps:{"aria-describedby":"delist-dialog-description"},children:e.jsxs("div",{id:"delist-dialog-description",className:"text-body text-ink-muted",children:['This takes "',p,'" off the hub straight away, and nobody will be able to download it. You can upload it again later.']})})]}):e.jsx("div",{className:"flex h-full items-center justify-center",children:e.jsx("p",{className:"text-body text-ink",children:"Agent not found."})})};export{ft as AgentDetailsPage};
6
+ */const $e=[["path",{d:"M7.9 20A9 9 0 1 0 4 16.1L2 22Z",key:"vv11sd"}]],Ge=Ne("message-circle",$e);function Xe(t,o=Date.now()){return De(t,o,{locale:{...re,formatDistance(n,i,s){switch(n){case"xSeconds":return a("ui.hub.comments.age.seconds",{count:i});case"xMinutes":return a("ui.hub.comments.age.minutes",{count:i});case"xHours":return a("ui.hub.comments.age.hours",{count:i});case"xDays":return a("ui.hub.comments.age.days",{count:i});case"xMonths":return a("ui.hub.comments.age.months",{count:i});case"xYears":return a("ui.hub.comments.age.years",{count:i});default:return a("ui.hub.comments.age.fallback",{duration:re.formatDistance(n,i,s)})}}}})}const F={all:["agent-comments"],list:t=>[...F.all,"list",t]},Ze=({agentId:t,enabled:o=!0})=>oe({queryKey:F.list(t||"invalid"),queryFn:async()=>{if(!t)throw new Error("Agent ID is required to fetch comments.");return(await qe(t)).result},enabled:!!t&&o,staleTime:2*60*1e3,gcTime:5*60*1e3,refetchOnWindowFocus:!0}),Je=()=>{const t=U(),{isAuthenticated:o}=C();return O({mutationFn:async n=>{const{agentId:i,data:s}=n;if(!o)throw new Error(a("ui.hub.comments.mutation.unauthorized"));return Ie(i,s)},onSuccess:(n,i)=>{t.invalidateQueries({queryKey:F.list(i.agentId)}),Q(a("ui.hub.comments.mutation.posted"))},onError:n=>{Y(a("ui.hub.comments.mutation.post_failed",{reason:n.message}))}})},et=()=>{const t=U(),{isAuthenticated:o}=C();return O({mutationFn:async n=>{const{agentId:i,commentId:s,data:c}=n;if(!o)throw new Error(a("ui.hub.comments.mutation.unauthorized"));return Ke(i,s,c)},onSuccess:(n,i)=>{t.invalidateQueries({queryKey:F.list(i.agentId)}),Q(a("ui.hub.comments.mutation.updated"))},onError:n=>{Y(a("ui.hub.comments.mutation.update_failed",{reason:n.message}))}})},tt=()=>{const t=U(),{isAuthenticated:o}=C();return O({mutationFn:async n=>{const{agentId:i,commentId:s}=n;if(!o)throw new Error(a("ui.hub.comments.mutation.unauthorized"));return Ue(i,s)},onSuccess:(n,i)=>{t.invalidateQueries({queryKey:F.list(i.agentId)}),Q(a("ui.hub.comments.mutation.deleted"))},onError:n=>{Y(a("ui.hub.comments.mutation.delete_failed",{reason:n.message}))}})},st=({agentId:t})=>{Ce();const{isAuthenticated:o,user:n}=C(),[i,s]=E.useState(""),[c,j]=E.useState(null),[x,k]=E.useState(""),{data:u,isLoading:p,error:A}=Ze({agentId:t}),P=u?.records??[],g=Je(),D=et(),B=tt(),S=async r=>{if(r.preventDefault(),!(!i.trim()||!o||!t))try{await g.mutateAsync({agentId:t,data:{text:i}}),s("")}catch(d){console.error("Submit comment error caught in component:",d)}},R=(r,d)=>{j(r),k(d)},m=()=>{j(null),k("")},y=async()=>{if(!(!c||!x.trim()||!o||!t))try{await D.mutateAsync({agentId:t,commentId:c,data:{text:x}}),m()}catch(r){console.error("Update comment error caught in component:",r)}},w=async r=>{if(!(!o||!t)&&window.confirm(a("ui.hub.comments.delete.confirm")))try{await B.mutateAsync({agentId:t,commentId:r})}catch(d){console.error("Delete comment error caught in component:",d)}},W=r=>o&&n?.radientUser?.account?.id===r.account_id;return e.jsxs("div",{className:"mt-6",children:[e.jsx("h2",{className:"mb-4 font-semibold text-heading text-ink",children:a("ui.hub.comments.heading")}),o?e.jsxs("div",{className:"mb-4 flex flex-col gap-1.5",children:[e.jsxs(ke,{htmlFor:"new-comment",children:[e.jsx(Ge,{size:14,"aria-hidden":"true"}),a("ui.hub.comments.form.label")]}),e.jsxs("form",{onSubmit:S,className:"flex flex-col gap-3",children:[e.jsx(te,{id:"new-comment",placeholder:a("ui.hub.comments.form.placeholder"),rows:3,value:i,onChange:r=>s(r.target.value),required:!0}),e.jsx(l,{type:"submit",variant:"primary",disabled:g.isPending||!i.trim(),className:"self-end",children:g.isPending?e.jsx(K,{size:"sm",label:a("ui.hub.comments.form.posting")}):a("ui.hub.comments.form.submit")})]})]}):e.jsx("p",{className:"mt-6 mb-4 text-body-sm text-ink-muted",children:a("ui.hub.comments.form.sign_in")}),e.jsx(de,{className:"my-6"}),p&&e.jsx("ul",{className:"flex flex-col",children:[...Array(3)].map((r,d)=>e.jsxs("li",{className:"flex gap-3 pb-6",children:[e.jsx(q,{children:e.jsx(I,{children:e.jsx(v,{className:"size-full"})})}),e.jsxs("div",{className:"flex w-full flex-col gap-1.5",children:[e.jsx(v,{className:"h-3.5 w-24"}),e.jsx(v,{className:"h-3 w-15"}),e.jsx(v,{className:"mt-2 h-3.5 w-full"}),e.jsx(v,{className:"h-3.5 w-4/5"})]})]},`skeleton-${d}`))}),A&&e.jsx("p",{role:"alert",className:"my-6 text-body-sm text-danger",children:a("ui.hub.comments.load_error",{reason:A.message})}),!p&&!A&&e.jsx("ul",{className:"flex flex-col gap-6",children:P.length===0?e.jsx("li",{className:"text-body-sm text-ink-muted",children:a("ui.hub.comments.empty")}):P.map(r=>c===r.id?e.jsxs("li",{className:"flex gap-3",children:[e.jsx(q,{children:e.jsx(I,{children:r.account_metadata?.name?.charAt(0).toUpperCase()||"?"})}),e.jsxs("div",{className:"flex w-full flex-col gap-2",children:[e.jsx(te,{rows:3,value:x,onChange:d=>k(d.target.value),autoFocus:!0,"aria-label":a("ui.hub.comments.edit.label")}),e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsxs(l,{variant:"secondary",size:"sm",onClick:m,children:[e.jsx(Ae,{}),a("ui.hub.comments.edit.cancel")]}),e.jsxs(l,{variant:"primary",size:"sm",onClick:y,disabled:D.isPending||!x.trim(),children:[D.isPending?e.jsx(K,{size:"xs",label:a("ui.hub.comments.edit.saving")}):e.jsx(Oe,{}),a("ui.hub.comments.edit.save")]})]})]})]},r.id):e.jsxs("li",{className:"flex gap-3",children:[e.jsx(q,{children:e.jsx(I,{children:r.account_metadata?.name?.charAt(0).toUpperCase()||"?"})}),e.jsxs("div",{className:"w-full",children:[e.jsxs("div",{className:"flex w-full items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("p",{className:"font-medium text-body text-ink",children:r.account_metadata?.name||a("ui.hub.comments.author.unknown")}),e.jsx("p",{className:"text-ink-muted text-meta",children:Xe(new Date(r.created_at))})]}),W(r)&&e.jsxs("div",{className:"flex gap-0.5",children:[e.jsx(N,{content:a("ui.hub.comments.edit.label"),children:e.jsx(l,{variant:"ghost",size:"icon-sm",onClick:()=>R(r.id,r.text),disabled:!!c,"aria-label":a("ui.hub.comments.edit.label"),children:e.jsx(Qe,{})})}),e.jsx(N,{content:a("ui.hub.comments.delete.label"),children:e.jsx(l,{variant:"ghost",size:"icon-sm",onClick:()=>w(r.id),disabled:!!c,"aria-label":a("ui.hub.comments.delete.label"),children:e.jsx(le,{})})})]})]}),e.jsx("p",{className:"mt-2 text-body-sm text-ink whitespace-pre-wrap",children:r.text})]})]},r.id))})]})},$={all:["agent-details"],detail:t=>[...$.all,t]},at=({agentId:t,enabled:o=!0})=>oe({queryKey:$.detail(t||"invalid"),queryFn:async()=>{if(!t)throw new Error("Agent ID is required to fetch details.");return await Be(t)},select:i=>i.result,enabled:!!t&&o,staleTime:3e5,gcTime:6e5,refetchOnWindowFocus:!1}),nt=()=>{const t=U(),o=ce(),{isAuthenticated:n}=C();return O({mutationFn:async({agentId:s})=>{if(!n)throw new Error("Authentication required to delist an agent.");if(!s)throw new Error("Agent ID is required to delist.");return Re(s)},onSuccess:(s,c)=>{Q("Agent delisted"),t.invalidateQueries({queryKey:$.detail(c.agentId)}),ge(t),o("/agent-hub")},onError:s=>{console.error("Delist agent error:",s)}})},it={like:"The like did not go through",favourite:"The favourite did not go through",download:"The download did not start",delist:"The agent was not delisted"},V=({children:t})=>e.jsx("span",{className:"inline-flex h-4 min-w-5 items-center text-meta text-ink-muted",children:t}),ft=()=>{const{agentId:t}=be(),o=ce(),{isAuthenticated:n,user:i}=C(),{data:s,isLoading:c,isFetching:j,error:x,refetch:k}=at({agentId:t??"",enabled:!!t}),u=s?.visibility==="org",p=s?Se(s.name):"",{memberships:A}=We({enabled:u}),P=u?A.find(xe=>xe.tenant_id===s?.tenant_id)?.tenant_name??null:null,{statuses:g,isKnown:D,isError:B,isFetching:S,refetch:R}=_e({agentIds:t&&!u?[t]:[]}),m=Te(D,g,t),y=m&&g[t??""]?.liked===!0,w=m&&g[t??""]?.favourited===!0,W=s?.like_count??0,r=s?.favourite_count??0,d=s?.download_count??0,z=Ee(),M=Fe(),_=Pe(),f=nt(),[ue,L]=E.useState(!1),[b,h]=E.useState(null),H=!!i&&!!s&&i.radientUser?.account?.id===s.account_id,G=()=>{!t||!n||z.isPending||(h(null),z.mutate({agentId:t,isCurrentlyLiked:y},{onError:()=>h("like")}))},X=()=>{!t||!n||M.isPending||(h(null),M.mutate({agentId:t,isCurrentlyFavourited:w},{onError:()=>h("favourite")}))},Z=()=>{!t||!s||_.isPending||(h(null),_.mutate({agentId:s.id,agentName:s.name},{onError:()=>h("download")}))},me=()=>{!t||!H||f.isPending||(h(null),f.mutate({agentId:t},{onError:()=>h("delist")}),L(!1))},T=b?b==="like"?{action:"like",error:z.error,retry:G}:b==="favourite"?{action:"favourite",error:M.error,retry:X}:b==="download"?{action:"download",error:_.error,retry:Z}:{action:"delist",error:f.error,retry:void 0}:null,he=()=>{o("/agent-hub")};return c?e.jsx("div",{className:"flex h-full items-center justify-center",children:e.jsx(K,{label:"Loading agent details"})}):x?e.jsx("div",{className:"flex h-full items-center justify-center p-6",children:e.jsxs(se,{variant:"danger",className:"max-w-2xl",children:[e.jsx(ae,{children:"This agent could not be loaded"}),e.jsx(ne,{children:je("The Radient agent catalogue did not answer.",x)}),e.jsx("div",{className:"mt-2",children:e.jsx(l,{variant:"outline",size:"sm",onClick:()=>void k(),disabled:j,"aria-busy":j,children:j?"Trying…":"Try again"})})]})}):s?e.jsxs("div",{className:"m-6 flex flex-1 flex-col rounded-md bg-surface p-8",children:[e.jsxs("div",{className:"mb-6 flex items-center justify-between gap-4",children:[e.jsxs("div",{className:"flex min-w-0 items-center gap-4",children:[e.jsx(l,{variant:"ghost",size:"icon",onClick:he,"aria-label":"Back to Agent hub",children:e.jsx(He,{})}),e.jsx(q,{className:"size-11 shrink-0",children:e.jsx(I,{children:e.jsx(Ve,{size:22,"aria-hidden":"true"})})}),e.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[e.jsx("h1",{className:"truncate text-display text-ink",children:p}),u&&e.jsx(ze,{orgName:P})]})]}),e.jsxs("div",{className:"flex shrink-0 items-center gap-1",children:[!u&&e.jsxs(e.Fragment,{children:[e.jsx(N,{content:"Sign in to Radient to use this feature",disabled:n,children:e.jsx("span",{children:e.jsxs(l,{variant:"ghost",size:"sm",onClick:G,disabled:!n||z.isPending||!m,"aria-label":m?y?"Unlike agent":"Like agent":"Like state unavailable",className:J(y&&"text-danger"),children:[e.jsx(Me,{fill:y?"currentColor":"none"}),e.jsx(V,{children:W})]})})}),e.jsx(N,{content:"Sign in to Radient to use this feature",disabled:n,children:e.jsx("span",{children:e.jsxs(l,{variant:"ghost",size:"sm",onClick:X,disabled:!n||M.isPending||!m,"aria-label":m?w?"Unfavourite agent":"Favourite agent":"Favourite state unavailable",className:J(w&&"text-warning"),children:[e.jsx(Ye,{fill:w?"currentColor":"none"}),e.jsx(V,{children:r})]})})})]}),e.jsx(N,{content:"Download agent to your computer",children:e.jsx("span",{children:e.jsxs(l,{variant:"ghost",size:"icon",onClick:Z,disabled:_.isPending,"aria-label":"Download agent",className:"ml-1",children:[e.jsx(pe,{}),e.jsx(V,{children:_.isPending?e.jsx(v,{className:"h-3.5 w-5"}):d})]})})}),H&&!u&&e.jsx(N,{content:"Permanently delist this agent from Agent hub",children:e.jsx("span",{children:e.jsx(l,{variant:"ghost",size:"icon",onClick:()=>L(!0),disabled:f.isPending,"aria-label":"Delist agent",className:"ml-1 text-danger hover:bg-danger-wash hover:text-danger",children:e.jsx(le,{})})})})]})]}),n&&B&&!b&&!u&&e.jsxs("output",{className:"mb-6 flex flex-wrap items-center gap-2 text-meta text-warning","data-testid":"agent-details-status-unknown",children:[e.jsx("span",{children:"Your likes and favourites could not be read, so this agent's viewer state is not shown."}),e.jsx(l,{variant:"ghost",size:"sm",onClick:()=>void R(),disabled:S,"aria-busy":S,children:S?"Trying…":"Try again"})]}),T&&b&&e.jsxs(se,{variant:"danger",className:"mb-6","data-testid":"agent-details-error",children:[e.jsx(ae,{children:it[b]}),e.jsx(ne,{children:fe(T.action,T.error,p)}),T.retry&&e.jsx("div",{className:"mt-2",children:e.jsx(l,{variant:"outline",size:"sm",onClick:T.retry,children:"Try again"})})]}),e.jsx(Le,{tags:s.tags,categories:s.categories}),e.jsxs("div",{className:"mt-4 mb-6 flex flex-col gap-2 text-body-sm text-ink-muted",children:[e.jsxs("p",{children:["Created by: ",s.account_metadata?.name??"Unknown",s.account_metadata?.email?` (${s.account_metadata.email})`:""]}),e.jsxs("p",{children:["Created: ",ie(new Date(s.created_at))," ago (",ee(s.created_at),")"]}),e.jsxs("p",{children:["Last modified: ",ie(new Date(s.updated_at))," ","ago (",ee(s.updated_at),")"]})]}),e.jsx("div",{className:"mt-2 mb-8 leading-relaxed text-body text-ink",children:s.description||"No description provided."}),e.jsx(de,{className:"my-6"}),!u&&e.jsx(st,{agentId:s.id}),e.jsx(ye,{open:ue,onClose:()=>L(!1),title:"Delist this agent?",maxWidth:"xs",actions:e.jsxs(e.Fragment,{children:[e.jsx(we,{onClick:()=>L(!1),children:"Cancel"}),e.jsx(ve,{onClick:()=>{!t||!H||f.isPending||me()},disabled:f.isPending,children:f.isPending?e.jsx(K,{size:"sm",label:"Delisting agent"}):"Delist"})]}),dialogProps:{"aria-describedby":"delist-dialog-description"},children:e.jsxs("div",{id:"delist-dialog-description",className:"text-body text-ink-muted",children:['This takes "',p,'" off the hub straight away, and nobody will be able to download it. You can upload it again later.']})})]}):e.jsx("div",{className:"flex h-full items-center justify-center",children:e.jsx("p",{className:"text-body text-ink",children:"Agent not found."})})};export{ft as AgentDetailsPage};
@@ -1,4 +1,4 @@
1
- import{r as c,j as e,c as H,t as l}from"./index-N0lyyVVo.js";import{aR as Os,aN as Ye,aT as ds,bQ as mt,bR as Es,_ as de,ag as G,u as ie,a as Ie,$ as Ge,c as oe,aO as ge,d as fe,bS as us,bO as Ls,a0 as ht,bT as xt,aP as bt,bU as pt,W as $s,V as Je,aX as Fs,bV as _e,bG as gt,bW as ft,b7 as kt,bX as jt}from"./conversation-input-sync-bgD4kyw3.js";import{P as yt}from"./page-header-CZcbRwLy.js";import{c as vt,y as ce,B as P,x as C,u as ke,J as Nt,I as Re,T as zs,D as Fe,a as ze,b as Me,d as De,e as qe,f as Ue,A as xe,z as be,E as pe,a0 as wt,a1 as St,a2 as _t,a3 as Pt,K as ms,M as hs,N as xs,O as bs,P as ps}from"./error-boundary-DJAF_aYL.js";import{a as Tt,p as Ms,P as Ds,u as Ct}from"./publication-validation-g2Kk53C8.js";import{h as ae,O as It,A as Rt,d as At,H as Ot,a as Et,b as Lt,c as $t,e as qs,C as Ft,f as zt,n as Mt,u as Dt,i as qt}from"./use-download-agent-mutation-B-kxWpF6.js";import{ad as Ut,bn as Ht,bm as Bt,bo as Us,bp as Hs,bq as Bs,br as Kt,bs as Qt,bj as Xe,bt as Ke,bc as Vt,ba as Ks,bu as Wt,b8 as Yt,u as Gt,h as Jt,c as gs,bh as Xt,d as Zt,H as ea,bv as sa,K as ta,bw as aa}from"./index-jVCAPb0a.js";import{n as ia,i as na,H as la,p as fs,a as ra,o as Qs,u as ca}from"./org-access-CU1oOVqv.js";import{R as Vs}from"./radient-auth-buttons-DP81yj6b.js";import{f as oa}from"./format-esAOn2VS.js";import{o as da,a as ks}from"./org-surface-gate-C86b758Z.js";import{B as ua}from"./building-2-Cupv31tS.js";import"./ui-preferences-store-C91RrpgH.js";import"./en-US-CHJkXXr4.js";import"./book-open-yjstLkVS.js";import"./console-mirror-CkCxHgcU.js";/**
1
+ import{r as c,j as e,c as H,t as l}from"./index-N0lyyVVo.js";import{aR as Os,aN as Ye,aT as ds,bQ as mt,bR as Es,_ as de,ag as G,u as ie,a as Ie,$ as Ge,c as oe,aO as ge,d as fe,bS as us,bO as Ls,a0 as ht,bT as xt,aP as bt,bU as pt,W as $s,V as Je,aX as Fs,bV as _e,bG as gt,bW as ft,b7 as kt,bX as jt}from"./conversation-input-sync-bgD4kyw3.js";import{P as yt}from"./page-header-CZcbRwLy.js";import{c as vt,y as ce,B as P,x as C,u as ke,J as Nt,I as Re,T as zs,D as Fe,a as ze,b as Me,d as De,e as qe,f as Ue,A as xe,z as be,E as pe,a0 as wt,a1 as St,a2 as _t,a3 as Pt,K as ms,M as hs,N as xs,O as bs,P as ps}from"./error-boundary-DJAF_aYL.js";import{a as Tt,p as Ms,P as Ds,u as Ct}from"./publication-validation-CCv7pQJH.js";import{h as ae,O as It,A as Rt,d as At,H as Ot,a as Et,b as Lt,c as $t,e as qs,C as Ft,f as zt,n as Mt,u as Dt,i as qt}from"./use-download-agent-mutation-BZhcL_Dx.js";import{af as Ut,bp as Ht,bo as Bt,bq as Us,br as Hs,bs as Bs,bt as Kt,bu as Qt,bl as Xe,bv as Ke,be as Vt,bc as Ks,bw as Wt,ba as Yt,u as Gt,h as Jt,c as gs,bj as Xt,d as Zt,H as ea,bx as sa,L as ta,by as aa}from"./index-BZYkm39z.js";import{n as ia,i as na,H as la,p as fs,a as ra,o as Qs,u as ca}from"./org-access-CfGyU5hi.js";import{R as Vs}from"./radient-auth-buttons-Huoo_kFK.js";import{f as oa}from"./format-esAOn2VS.js";import{o as da,a as ks}from"./org-surface-gate-C86b758Z.js";import{B as ua}from"./building-2-Cupv31tS.js";import"./ui-preferences-store-C91RrpgH.js";import"./en-US-CHJkXXr4.js";import"./book-open-yjstLkVS.js";import"./console-mirror-CkCxHgcU.js";/**
2
2
  * @license lucide-react v0.507.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.