@lacneu/atrium 0.42.0 → 0.42.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 (71) hide show
  1. package/dist/assets/{AccessTab-BL-D0RWF.js → AccessTab-7oUNhFz1.js} +1 -1
  2. package/dist/assets/{AdvancedFilter--hO9zyz3.js → AdvancedFilter-CO1cUNNw.js} +1 -1
  3. package/dist/assets/AgentFilesTab-DDaKUZVQ.js +3 -0
  4. package/dist/assets/AnomaliesTab-BwN4hyVY.js +1 -0
  5. package/dist/assets/AuditTab--JJkDPIe.js +1 -0
  6. package/dist/assets/BridgeTab-D_ZDAPja.js +1 -0
  7. package/dist/assets/ChatDefaultsTab-kUb2IOW3.js +1 -0
  8. package/dist/assets/{DataTableShell-qDyq_xxR.js → DataTableShell-BB1Bp-iF.js} +1 -1
  9. package/dist/assets/{DetailChips-izXRLBqs.js → DetailChips-CqxPS6Xc.js} +1 -1
  10. package/dist/assets/FeedbacksTab-B_TKW5tq.js +1 -0
  11. package/dist/assets/{FieldLabel-BZyPIkg8.js → FieldLabel-DMT2Hkyy.js} +1 -1
  12. package/dist/assets/FilesTab-S52Eip5O.js +1 -0
  13. package/dist/assets/{FilterBar-5McK3w7W.js → FilterBar-CghkUT3Y.js} +1 -1
  14. package/dist/assets/GroupsTab-4qA6hYSX.js +1 -0
  15. package/dist/assets/InstancesTab-DcTjSMdS.js +1 -0
  16. package/dist/assets/IntegrationsTab-Osutx3AF.js +1 -0
  17. package/dist/assets/{KpiTab-DkbJVBPh.js → KpiTab-DIl1PUwB.js} +1 -1
  18. package/dist/assets/PreferencesTab-oX3gGWZq.js +1 -0
  19. package/dist/assets/PromptInjectionsTab-DyYdCXtn.js +4 -0
  20. package/dist/assets/RolesTab-BLB85Fx_.js +1 -0
  21. package/dist/assets/ServiceAccountsTab-iGJvmXO8.js +1 -0
  22. package/dist/assets/SubAgentReportsTab-B8ZIdQCy.js +1 -0
  23. package/dist/assets/ThemeShowroom-Dq-FeNYt.js +1 -0
  24. package/dist/assets/{TimeRangePicker-BSn6eVzh.js → TimeRangePicker-xtCsggB6.js} +1 -1
  25. package/dist/assets/TracesTab-CohGGYH-.js +1 -0
  26. package/dist/assets/UsersTab-DdnixSeG.js +1 -0
  27. package/dist/assets/VoiceTab-Dxx8qprL.js +1 -0
  28. package/dist/assets/{button-ANIiyoGJ.js → button-BMEzTwMt.js} +1 -1
  29. package/dist/assets/{card-DBM3tlH1.js → card-B1HFd4xj.js} +1 -1
  30. package/dist/assets/chevrons-up-down-D1ZuXFq9.js +1 -0
  31. package/dist/assets/{compatView-7kUvOpPX.js → compatView-C7qH0iQd.js} +1 -1
  32. package/dist/assets/dispatchErrorInfo-Bg7B8_Mz.js +1 -0
  33. package/dist/assets/{dist-C7FCY2SP.js → dist-C9SiL-Kv.js} +1 -1
  34. package/dist/assets/{dist-B1vUBlGT.js → dist-CISpbyhZ.js} +1 -1
  35. package/dist/assets/{dist-BjwyR-Rb.js → dist-D7m7ryC2.js} +5 -5
  36. package/dist/assets/{dist-Bo3HymDk.js → dist-DnoignCJ.js} +1 -1
  37. package/dist/assets/{highlighted-body-OFNGDK62-2ke1wKtw.js → highlighted-body-OFNGDK62-qrGeiXTR.js} +1 -1
  38. package/dist/assets/{index-BsEfIgPs.css → index-B4voP0zS.css} +1 -1
  39. package/dist/assets/index-CvZ8WIcf.js +233 -0
  40. package/dist/assets/mermaid-GHXKKRXX-B3J6Tm21.js +1 -0
  41. package/dist/assets/roleDescriptions-B5qSDg7b.js +1 -0
  42. package/dist/assets/{table-CMG1KRZm.js → table-vlXds7sd.js} +1 -1
  43. package/dist/assets/{tabs-WMNx-KXA.js → tabs-CZZSNNGS.js} +1 -1
  44. package/dist/assets/x-g5TNru3k.js +1 -0
  45. package/dist/index.html +8 -8
  46. package/package.json +1 -1
  47. package/dist/assets/AgentFilesTab-CqDiGMNH.js +0 -3
  48. package/dist/assets/AnomaliesTab-BX2kTeDF.js +0 -1
  49. package/dist/assets/AuditTab-B_b_jEqf.js +0 -1
  50. package/dist/assets/BridgeTab-CljQLbGy.js +0 -1
  51. package/dist/assets/ChatDefaultsTab-CsQOgs8v.js +0 -1
  52. package/dist/assets/FeedbacksTab-B_xc9m8w.js +0 -1
  53. package/dist/assets/FilesTab-CS-wCMiC.js +0 -1
  54. package/dist/assets/GroupsTab-BeiKXHnJ.js +0 -1
  55. package/dist/assets/InstancesTab-C-m6f25i.js +0 -1
  56. package/dist/assets/IntegrationsTab-DsRNO8vX.js +0 -1
  57. package/dist/assets/PreferencesTab-MosSvdiK.js +0 -1
  58. package/dist/assets/PromptInjectionsTab-CGedejI8.js +0 -4
  59. package/dist/assets/RolesTab-CLdqp6kf.js +0 -1
  60. package/dist/assets/ServiceAccountsTab-CET__Sdi.js +0 -1
  61. package/dist/assets/SubAgentReportsTab-8ct5u4Vu.js +0 -1
  62. package/dist/assets/ThemeShowroom-FOLK9Y43.js +0 -1
  63. package/dist/assets/TracesTab-DPoyHlxC.js +0 -1
  64. package/dist/assets/UsersTab-BpNHWue_.js +0 -1
  65. package/dist/assets/VoiceTab-CLA8rIEV.js +0 -1
  66. package/dist/assets/chevrons-up-down-Bk2JiK_g.js +0 -1
  67. package/dist/assets/dispatchErrorInfo-JTswda6A.js +0 -1
  68. package/dist/assets/index-BGXPyQxx.js +0 -233
  69. package/dist/assets/mermaid-GHXKKRXX-CRt8o-g1.js +0 -1
  70. package/dist/assets/roleDescriptions-MwIEr4oZ.js +0 -1
  71. package/dist/assets/x-y131Bn-k.js +0 -1
@@ -0,0 +1 @@
1
+ import{O as e}from"./index-CvZ8WIcf.js";export{e as Mermaid};
@@ -0,0 +1 @@
1
+ import{Gv as e,Jv as t,Kv as n,Yv as r,qv as i}from"./dist-D7m7ryC2.js";var a={pending:r,user:t,admin:i,observer:n,agent:e};function o(e){if(e.builtin){let t=a[e.key];if(t)return t()}return e.description}export{o as t};
@@ -1 +1 @@
1
- import{a as e,r as t}from"./bundle-mjs-C73ZY4La.js";import{n}from"./dist-BjwyR-Rb.js";e();var r=t();function i({className:e,...t}){return(0,r.jsx)(`div`,{"data-slot":`table-container`,className:`relative w-full overflow-x-auto`,children:(0,r.jsx)(`table`,{"data-slot":`table`,className:n(`w-full caption-bottom text-sm`,e),...t})})}function a({className:e,...t}){return(0,r.jsx)(`thead`,{"data-slot":`table-header`,className:n(`[&_tr]:border-b`,e),...t})}function o({className:e,...t}){return(0,r.jsx)(`tbody`,{"data-slot":`table-body`,className:n(`[&_tr:last-child]:border-0`,e),...t})}function s({className:e,...t}){return(0,r.jsx)(`tr`,{"data-slot":`table-row`,className:n(`border-b transition-colors hover:bg-muted/50 has-aria-expanded:bg-muted/50 data-[state=selected]:bg-muted`,e),...t})}function c({className:e,...t}){return(0,r.jsx)(`th`,{"data-slot":`table-head`,className:n(`h-10 px-2 text-left align-middle font-medium whitespace-nowrap text-foreground [&:has([role=checkbox])]:pr-0`,e),...t})}function l({className:e,...t}){return(0,r.jsx)(`td`,{"data-slot":`table-cell`,className:n(`p-2 align-middle whitespace-nowrap [&:has([role=checkbox])]:pr-0`,e),...t})}export{a,c as i,o as n,s as o,l as r,i as t};
1
+ import{a as e,r as t}from"./bundle-mjs-C73ZY4La.js";import{n}from"./dist-D7m7ryC2.js";e();var r=t();function i({className:e,...t}){return(0,r.jsx)(`div`,{"data-slot":`table-container`,className:`relative w-full overflow-x-auto`,children:(0,r.jsx)(`table`,{"data-slot":`table`,className:n(`w-full caption-bottom text-sm`,e),...t})})}function a({className:e,...t}){return(0,r.jsx)(`thead`,{"data-slot":`table-header`,className:n(`[&_tr]:border-b`,e),...t})}function o({className:e,...t}){return(0,r.jsx)(`tbody`,{"data-slot":`table-body`,className:n(`[&_tr:last-child]:border-0`,e),...t})}function s({className:e,...t}){return(0,r.jsx)(`tr`,{"data-slot":`table-row`,className:n(`border-b transition-colors hover:bg-muted/50 has-aria-expanded:bg-muted/50 data-[state=selected]:bg-muted`,e),...t})}function c({className:e,...t}){return(0,r.jsx)(`th`,{"data-slot":`table-head`,className:n(`h-10 px-2 text-left align-middle font-medium whitespace-nowrap text-foreground [&:has([role=checkbox])]:pr-0`,e),...t})}function l({className:e,...t}){return(0,r.jsx)(`td`,{"data-slot":`table-cell`,className:n(`p-2 align-middle whitespace-nowrap [&:has([role=checkbox])]:pr-0`,e),...t})}export{a,c as i,o as n,s as o,l as r,i as t};
@@ -1 +1 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{d as r,f as i,h as a,n as o,t as s,u as c,v as l,y as u}from"./dist-BjwyR-Rb.js";import{t as d}from"./dist-C7FCY2SP.js";import{St as f,bt as p,xt as m}from"./index-BGXPyQxx.js";var h=t(e(),1),g=n(),_=`Tabs`,[v,y]=a(_,[f]),b=f(),[x,S]=v(_),C=h.forwardRef((e,t)=>{let{__scopeTabs:n,value:r,onValueChange:a,defaultValue:o,orientation:s=`horizontal`,dir:l,activationMode:f=`automatic`,...p}=e,m=d(l),[h,v]=i({prop:r,onChange:a,defaultProp:o??``,caller:_});return(0,g.jsx)(x,{scope:n,baseId:c(),value:h,onValueChange:v,orientation:s,dir:m,activationMode:f,children:(0,g.jsx)(u.div,{dir:m,"data-orientation":s,...p,ref:t})})});C.displayName=_;var w=`TabsList`,T=h.forwardRef((e,t)=>{let{__scopeTabs:n,loop:r=!0,...i}=e,a=S(w,n),o=b(n);return(0,g.jsx)(m,{asChild:!0,...o,orientation:a.orientation,dir:a.dir,loop:r,children:(0,g.jsx)(u.div,{role:`tablist`,"aria-orientation":a.orientation,...i,ref:t})})});T.displayName=w;var E=`TabsTrigger`,D=h.forwardRef((e,t)=>{let{__scopeTabs:n,value:r,disabled:i=!1,...a}=e,o=S(E,n),s=b(n),c=A(o.baseId,r),d=j(o.baseId,r),f=r===o.value;return(0,g.jsx)(p,{asChild:!0,...s,focusable:!i,active:f,children:(0,g.jsx)(u.button,{type:`button`,role:`tab`,"aria-selected":f,"aria-controls":d,"data-state":f?`active`:`inactive`,"data-disabled":i?``:void 0,disabled:i,id:c,...a,ref:t,onMouseDown:l(e.onMouseDown,e=>{!i&&e.button===0&&e.ctrlKey===!1?o.onValueChange(r):e.preventDefault()}),onKeyDown:l(e.onKeyDown,e=>{[` `,`Enter`].includes(e.key)&&o.onValueChange(r)}),onFocus:l(e.onFocus,()=>{let e=o.activationMode!==`manual`;!f&&!i&&e&&o.onValueChange(r)})})})});D.displayName=E;var O=`TabsContent`,k=h.forwardRef((e,t)=>{let{__scopeTabs:n,value:i,forceMount:a,children:o,...s}=e,c=S(O,n),l=A(c.baseId,i),d=j(c.baseId,i),f=i===c.value,p=h.useRef(f);return h.useEffect(()=>{let e=requestAnimationFrame(()=>p.current=!1);return()=>cancelAnimationFrame(e)},[]),(0,g.jsx)(r,{present:a||f,children:({present:n})=>(0,g.jsx)(u.div,{"data-state":f?`active`:`inactive`,"data-orientation":c.orientation,role:`tabpanel`,"aria-labelledby":l,hidden:!n,id:d,tabIndex:0,...s,ref:t,style:{...e.style,animationDuration:p.current?`0s`:void 0},children:n&&o})})});k.displayName=O;function A(e,t){return`${e}-trigger-${t}`}function j(e,t){return`${e}-content-${t}`}var M=C,N=T,P=D,F=k;function I({className:e,orientation:t=`horizontal`,...n}){return(0,g.jsx)(M,{"data-slot":`tabs`,"data-orientation":t,className:o(`group/tabs flex gap-2 data-horizontal:flex-col`,e),...n})}var L=s(`group/tabs-list inline-flex w-fit items-center justify-center rounded-lg p-[3px] text-muted-foreground group-data-horizontal/tabs:h-8 group-data-vertical/tabs:h-fit group-data-vertical/tabs:flex-col data-[variant=line]:rounded-none`,{variants:{variant:{default:`bg-muted`,line:`gap-1 bg-transparent`}},defaultVariants:{variant:`default`}});function R({className:e,variant:t=`default`,...n}){return(0,g.jsx)(N,{"data-slot":`tabs-list`,"data-variant":t,className:o(L({variant:t}),e),...n})}function z({className:e,...t}){return(0,g.jsx)(P,{"data-slot":`tabs-trigger`,className:o(`relative inline-flex h-[calc(100%-1px)] flex-1 items-center justify-center gap-1.5 rounded-md border border-transparent px-1.5 py-0.5 text-sm font-medium whitespace-nowrap text-foreground/60 transition-all group-data-vertical/tabs:w-full group-data-vertical/tabs:justify-start hover:text-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-1 focus-visible:outline-ring disabled:pointer-events-none disabled:opacity-50 has-data-[icon=inline-end]:pr-1 has-data-[icon=inline-start]:pl-1 dark:text-muted-foreground dark:hover:text-foreground group-data-[variant=default]/tabs-list:data-active:shadow-sm group-data-[variant=line]/tabs-list:data-active:shadow-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,`group-data-[variant=line]/tabs-list:bg-transparent group-data-[variant=line]/tabs-list:data-active:bg-transparent dark:group-data-[variant=line]/tabs-list:data-active:border-transparent dark:group-data-[variant=line]/tabs-list:data-active:bg-transparent`,`data-active:bg-background data-active:text-foreground dark:data-active:border-input dark:data-active:bg-input/30 dark:data-active:text-foreground`,`after:absolute after:bg-foreground after:opacity-0 after:transition-opacity group-data-horizontal/tabs:after:inset-x-0 group-data-horizontal/tabs:after:bottom-[-5px] group-data-horizontal/tabs:after:h-0.5 group-data-vertical/tabs:after:inset-y-0 group-data-vertical/tabs:after:-right-1 group-data-vertical/tabs:after:w-0.5 group-data-[variant=line]/tabs-list:data-active:after:opacity-100`,e),...t})}function B({className:e,...t}){return(0,g.jsx)(F,{"data-slot":`tabs-content`,className:o(`flex-1 text-sm outline-none`,e),...t})}export{z as i,B as n,R as r,I as t};
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{d as r,f as i,h as a,n as o,t as s,u as c,v as l,y as u}from"./dist-D7m7ryC2.js";import{t as d}from"./dist-C9SiL-Kv.js";import{St as f,bt as p,xt as m}from"./index-CvZ8WIcf.js";var h=t(e(),1),g=n(),_=`Tabs`,[v,y]=a(_,[f]),b=f(),[x,S]=v(_),C=h.forwardRef((e,t)=>{let{__scopeTabs:n,value:r,onValueChange:a,defaultValue:o,orientation:s=`horizontal`,dir:l,activationMode:f=`automatic`,...p}=e,m=d(l),[h,v]=i({prop:r,onChange:a,defaultProp:o??``,caller:_});return(0,g.jsx)(x,{scope:n,baseId:c(),value:h,onValueChange:v,orientation:s,dir:m,activationMode:f,children:(0,g.jsx)(u.div,{dir:m,"data-orientation":s,...p,ref:t})})});C.displayName=_;var w=`TabsList`,T=h.forwardRef((e,t)=>{let{__scopeTabs:n,loop:r=!0,...i}=e,a=S(w,n),o=b(n);return(0,g.jsx)(m,{asChild:!0,...o,orientation:a.orientation,dir:a.dir,loop:r,children:(0,g.jsx)(u.div,{role:`tablist`,"aria-orientation":a.orientation,...i,ref:t})})});T.displayName=w;var E=`TabsTrigger`,D=h.forwardRef((e,t)=>{let{__scopeTabs:n,value:r,disabled:i=!1,...a}=e,o=S(E,n),s=b(n),c=A(o.baseId,r),d=j(o.baseId,r),f=r===o.value;return(0,g.jsx)(p,{asChild:!0,...s,focusable:!i,active:f,children:(0,g.jsx)(u.button,{type:`button`,role:`tab`,"aria-selected":f,"aria-controls":d,"data-state":f?`active`:`inactive`,"data-disabled":i?``:void 0,disabled:i,id:c,...a,ref:t,onMouseDown:l(e.onMouseDown,e=>{!i&&e.button===0&&e.ctrlKey===!1?o.onValueChange(r):e.preventDefault()}),onKeyDown:l(e.onKeyDown,e=>{[` `,`Enter`].includes(e.key)&&o.onValueChange(r)}),onFocus:l(e.onFocus,()=>{let e=o.activationMode!==`manual`;!f&&!i&&e&&o.onValueChange(r)})})})});D.displayName=E;var O=`TabsContent`,k=h.forwardRef((e,t)=>{let{__scopeTabs:n,value:i,forceMount:a,children:o,...s}=e,c=S(O,n),l=A(c.baseId,i),d=j(c.baseId,i),f=i===c.value,p=h.useRef(f);return h.useEffect(()=>{let e=requestAnimationFrame(()=>p.current=!1);return()=>cancelAnimationFrame(e)},[]),(0,g.jsx)(r,{present:a||f,children:({present:n})=>(0,g.jsx)(u.div,{"data-state":f?`active`:`inactive`,"data-orientation":c.orientation,role:`tabpanel`,"aria-labelledby":l,hidden:!n,id:d,tabIndex:0,...s,ref:t,style:{...e.style,animationDuration:p.current?`0s`:void 0},children:n&&o})})});k.displayName=O;function A(e,t){return`${e}-trigger-${t}`}function j(e,t){return`${e}-content-${t}`}var M=C,N=T,P=D,F=k;function I({className:e,orientation:t=`horizontal`,...n}){return(0,g.jsx)(M,{"data-slot":`tabs`,"data-orientation":t,className:o(`group/tabs flex gap-2 data-horizontal:flex-col`,e),...n})}var L=s(`group/tabs-list inline-flex w-fit items-center justify-center rounded-lg p-[3px] text-muted-foreground group-data-horizontal/tabs:h-8 group-data-vertical/tabs:h-fit group-data-vertical/tabs:flex-col data-[variant=line]:rounded-none`,{variants:{variant:{default:`bg-muted`,line:`gap-1 bg-transparent`}},defaultVariants:{variant:`default`}});function R({className:e,variant:t=`default`,...n}){return(0,g.jsx)(N,{"data-slot":`tabs-list`,"data-variant":t,className:o(L({variant:t}),e),...n})}function z({className:e,...t}){return(0,g.jsx)(P,{"data-slot":`tabs-trigger`,className:o(`relative inline-flex h-[calc(100%-1px)] flex-1 items-center justify-center gap-1.5 rounded-md border border-transparent px-1.5 py-0.5 text-sm font-medium whitespace-nowrap text-foreground/60 transition-all group-data-vertical/tabs:w-full group-data-vertical/tabs:justify-start hover:text-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-1 focus-visible:outline-ring disabled:pointer-events-none disabled:opacity-50 has-data-[icon=inline-end]:pr-1 has-data-[icon=inline-start]:pl-1 dark:text-muted-foreground dark:hover:text-foreground group-data-[variant=default]/tabs-list:data-active:shadow-sm group-data-[variant=line]/tabs-list:data-active:shadow-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,`group-data-[variant=line]/tabs-list:bg-transparent group-data-[variant=line]/tabs-list:data-active:bg-transparent dark:group-data-[variant=line]/tabs-list:data-active:border-transparent dark:group-data-[variant=line]/tabs-list:data-active:bg-transparent`,`data-active:bg-background data-active:text-foreground dark:data-active:border-input dark:data-active:bg-input/30 dark:data-active:text-foreground`,`after:absolute after:bg-foreground after:opacity-0 after:transition-opacity group-data-horizontal/tabs:after:inset-x-0 group-data-horizontal/tabs:after:bottom-[-5px] group-data-horizontal/tabs:after:h-0.5 group-data-vertical/tabs:after:inset-y-0 group-data-vertical/tabs:after:-right-1 group-data-vertical/tabs:after:w-0.5 group-data-[variant=line]/tabs-list:data-active:after:opacity-100`,e),...t})}function B({className:e,...t}){return(0,g.jsx)(F,{"data-slot":`tabs-content`,className:o(`flex-1 text-sm outline-none`,e),...t})}export{z as i,B as n,R as r,I as t};
@@ -0,0 +1 @@
1
+ import{D as e}from"./dist-D7m7ryC2.js";var t=e(`x`,[[`path`,{d:`M18 6 6 18`,key:`1bl5f8`}],[`path`,{d:`m6 6 12 12`,key:`d8bk6v`}]]);export{t};
package/dist/index.html CHANGED
@@ -42,15 +42,15 @@
42
42
  document.documentElement.dataset.ambiance = a === "off" ? "off" : "on";
43
43
  })();
44
44
  </script>
45
- <script type="module" crossorigin src="/assets/index-BGXPyQxx.js"></script>
45
+ <script type="module" crossorigin src="/assets/index-CvZ8WIcf.js"></script>
46
46
  <link rel="modulepreload" crossorigin href="/assets/bundle-mjs-C73ZY4La.js">
47
- <link rel="modulepreload" crossorigin href="/assets/dist-BjwyR-Rb.js">
48
- <link rel="modulepreload" crossorigin href="/assets/dist-C7FCY2SP.js">
49
- <link rel="modulepreload" crossorigin href="/assets/dist-Bo3HymDk.js">
50
- <link rel="modulepreload" crossorigin href="/assets/dist-B1vUBlGT.js">
51
- <link rel="modulepreload" crossorigin href="/assets/x-y131Bn-k.js">
52
- <link rel="modulepreload" crossorigin href="/assets/button-ANIiyoGJ.js">
53
- <link rel="stylesheet" crossorigin href="/assets/index-BsEfIgPs.css">
47
+ <link rel="modulepreload" crossorigin href="/assets/dist-D7m7ryC2.js">
48
+ <link rel="modulepreload" crossorigin href="/assets/dist-C9SiL-Kv.js">
49
+ <link rel="modulepreload" crossorigin href="/assets/dist-DnoignCJ.js">
50
+ <link rel="modulepreload" crossorigin href="/assets/dist-CISpbyhZ.js">
51
+ <link rel="modulepreload" crossorigin href="/assets/x-g5TNru3k.js">
52
+ <link rel="modulepreload" crossorigin href="/assets/button-BMEzTwMt.js">
53
+ <link rel="stylesheet" crossorigin href="/assets/index-B4voP0zS.css">
54
54
  </head>
55
55
  <body>
56
56
  <div id="root"></div>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lacneu/atrium",
3
- "version": "0.42.0",
3
+ "version": "0.42.1",
4
4
  "description": "Atrium — public, self-hostable, Convex-backed web chat UI for AI agent gateways (OpenClaw today, Hermes next). Ships an origin-agnostic static bundle (Convex URL injected at runtime via /config.json).",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -1,3 +0,0 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$n as r,$s as i,Bs as a,E as o,Fn as s,Fs as c,Gn as l,Gs as u,Hs as d,In as f,Is as p,Jn as m,Js as h,Kn as g,Ks as _,Ln as v,Ls as y,Mn as b,Ms as x,Nn as S,Ns as C,Pn as w,Ps as T,Qn as E,Qs as D,Rn as O,Rs as k,Uc as A,Us as ee,Vc as te,Vs as j,WT as M,Ws as N,Xn as P,Xs as ne,Yn as F,Ys as re,Zn as I,Zs as L,ac as ie,ar as R,cr as z,dr as ae,ec as oe,er as B,ic as se,ir as ce,js as le,lj as ue,lr as de,nc as fe,nr as pe,oc as me,or as V,qn as he,qs as ge,rc as _e,rj as H,rr as ve,sj as U,sr as ye,tc as be,tj as W,tr as xe,uj as G,ur as Se,zs as Ce}from"./dist-BjwyR-Rb.js";import{t as K}from"./button-ANIiyoGJ.js";import{C as we,Ct as q,G as Te,H as Ee,J as De,K as Oe,S as ke,U as Ae,W as je,Y as Me,at as Ne,b as Pe,ct as Fe,dt as Ie,ft as Le,ht as Re,lt as ze,q as Be,st as Ve,w as He,x as Ue,y as We,z as J}from"./index-BGXPyQxx.js";import{n as Ge,t as Ke}from"./curation-CQksaIbm.js";import{i as qe}from"./compatView-7kUvOpPX.js";/* empty css */var Y=t(e(),1),X=2e4,Je=6e4;function Ye(e){return typeof e!=`number`||e<=0?0:Math.round(e/X*100)}function Xe(e){return e<=0?0:Math.round(e/Je*100)}function Z(e,t){let n=(typeof e==`number`&&e>0?e:0)/1e3;return new Intl.NumberFormat(t,{minimumFractionDigits:1,maximumFractionDigits:1}).format(n)}function Ze(e){return e.reduce((e,t)=>e+(typeof t.size==`number`&&t.size>0?t.size:0),0)}var Qe=3;function $e(e,t){let n=new Map;for(let t of e.split(`
2
- `))n.set(t,(n.get(t)??0)+1);for(let e of t.split(`
3
- `))n.set(e,(n.get(e)??0)-1);let r=0,i=0,a=[],o=[];for(let[e,t]of n)t<0?(r+=-t,a.length<Qe&&a.push(e)):t>0&&(i+=t,o.length<Qe&&o.push(e));return{added:r,removed:i,sampleAdded:a,sampleRemoved:o}}function et(e){return e instanceof Error?e.message.includes(`conflict:`):String(e).includes(`conflict:`)}var Q=n(),$=e=>`${e.instanceName}::${e.agentId}`;function tt(){let e=G(o.me.getMe,{host:Re}),t=e?.role===`admin`,n=(e?.permissions??[]).includes(`bridge.read`),r=G(o.admin.listInstances,e!==void 0&&t?{}:`skip`),[a,s]=(0,Y.useState)(null);(0,Y.useEffect)(()=>{!t||!r||r.length===0||(!a||!r.some(e=>e.name===a))&&s(r[0].name)},[t,r,a]);let c=G(o.agents.listAgentsForInstance,t&&a?{instanceName:a}:`skip`),l=G(o.agents.listMyAgents,e!==void 0&&!t?{}:`skip`),u=(0,Y.useMemo)(()=>{if(e!==void 0){if(t)return a===null||c===void 0?r!==void 0&&r.length===0?[]:void 0:c.agents.map(e=>({instanceName:a,agentId:e.agentId,label:`${e.emoji?`${e.emoji} `:``}${e.displayName??e.agentId}`}));if(l!==void 0)return l.map(e=>({instanceName:e.instanceName,agentId:e.agentId,label:`${e.emoji?`${e.emoji} `:``}${e.displayName??e.agentId}`}))}},[e,t,a,c,r,l]),[d,f]=(0,Y.useState)(null);(0,Y.useEffect)(()=>{!u||u.length===0||(!d||!u.some(e=>$(e)===d))&&f($(u[0]))},[u,d]);let p=u?.find(e=>$(e)===d)??null,m=U(o.agentFiles.listAgentFiles),[g,_]=(0,Y.useState)({status:`idle`}),v=p?.instanceName??null,y=p?.agentId??null,b=G(o.compat.forInstance,n&&v!==null?{instanceName:v}:`skip`),x=n&&v!==null?We(b,`agentFiles`):null,S=x===null?!1:x===`loading`?null:x.blocked,C=(0,Y.useCallback)(async()=>{if(!(v===null||y===null)){_({status:`loading`});try{_({status:`done`,files:(await m({instanceName:v,agentId:y})).files})}catch{_({status:`error`})}}},[m,v,y]);(0,Y.useEffect)(()=>{S===!1&&C()},[C,S]);let[w,T]=(0,Y.useState)(null),E=G(o.agentFileCuration.listCurations,t&&v!==null&&y!==null?{instanceName:v,agentId:y}:`skip`),O=G(o.agentFileCuration.curationSettings,t&&v!==null?{instanceName:v}:`skip`),k=U(o.agentFileCuration.requestCuration),[A,ee]=(0,Y.useState)(null),[j,M]=(0,Y.useState)(null),{toast:N}=J(),P=(0,Y.useMemo)(()=>{let e=new Map;for(let t of E??[])e.has(t.name)||e.set(t.name,t);return e},[E]),F=(0,Y.useCallback)(async e=>{if(!(v===null||y===null)){ee(e);try{let t=await k({instanceName:v,agentId:y,name:e,trigger:`manual`});t.ok?N({title:z(),variant:`success`}):N({title:ye({reason:t.reason??`unknown`}),variant:`error`})}catch{N({title:V(),variant:`error`})}finally{ee(null)}}},[k,v,y,N]),I=H(),R=(0,Y.useMemo)(()=>new Intl.NumberFormat(I,{maximumFractionDigits:0}),[I]);return e===void 0||u===void 0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:W()}):(0,Q.jsxs)(`div`,{className:`oc-afiles`,children:[(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:me()}),(0,Q.jsxs)(`div`,{className:`oc-afiles__picker`,children:[t&&(r?.length??0)>1?(0,Q.jsxs)(Pe,{value:a??``,onValueChange:e=>s(e),children:[(0,Q.jsx)(we,{size:`sm`,"aria-label":ie(),children:(0,Q.jsx)(He,{})}),(0,Q.jsx)(Ue,{children:(r??[]).map(e=>(0,Q.jsx)(ke,{value:e.name,children:e.name},e.name))})]}):null,u.length>0?(0,Q.jsxs)(Pe,{value:d??``,onValueChange:e=>f(e),children:[(0,Q.jsx)(we,{size:`sm`,"aria-label":se(),children:(0,Q.jsx)(He,{})}),(0,Q.jsx)(Ue,{children:u.map(e=>(0,Q.jsx)(ke,{value:$(e),children:e.label},$(e)))})]}):(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:_e()})]}),p===null?null:x===`loading`?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:W()}):x!==null&&x.blocked?(0,Q.jsxs)(`p`,{className:`oc-compat__blocked`,role:`status`,children:[(0,Q.jsx)(q,{size:14,"aria-hidden":!0}),` `,qe(x.gatewayVersion,x.provider)]}):g.status===`loading`||g.status===`idle`?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:W()}):g.status===`error`?(0,Q.jsxs)(`p`,{className:`oc-afiles__error`,role:`alert`,children:[be(),` `,(0,Q.jsx)(K,{variant:`outline`,size:`sm`,onClick:()=>void C(),children:te()})]}):g.files.length===0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:fe()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`div`,{className:`oc-afiles__list`,children:g.files.map(e=>{let n=Ye(e.size),r=n>=80;return(0,Q.jsxs)(`div`,{className:`oc-afiles__row`,children:[(0,Q.jsx)(`span`,{className:`oc-afiles__name`,title:e.name,children:e.name}),e.missing?(0,Q.jsx)(Ne,{variant:`outline`,children:oe()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`span`,{className:`oc-afiles__size`,children:i({size:Z(e.size,I)})}),(0,Q.jsx)(`span`,{className:`oc-afiles__gauge${r?` is-warn`:``}`,"aria-hidden":!0,children:(0,Q.jsx)(`span`,{className:`oc-afiles__gauge-fill`,style:{width:`${Math.min(n,100)}%`}})}),(0,Q.jsx)(`span`,{className:`oc-afiles__pct`,children:D({pct:R.format(n)})}),r?(0,Q.jsx)(q,{size:14,className:`oc-afiles__warn`,"aria-label":L()}):(0,Q.jsx)(`span`,{className:`oc-afiles__warn-slot`,"aria-hidden":!0})]}),(0,Q.jsx)(K,{variant:`outline`,size:`sm`,className:`oc-afiles__open`,onClick:()=>T(e),children:t?re():h()}),t&&!e.missing?(0,Q.jsx)(nt,{curatable:Ke.includes(e.name),size:e.size??0,budget:O?.budgetChars??null,enabled:O?.enabled??!1,curation:P.get(e.name)??null,inFlight:A===e.name,onCurate:()=>void F(e.name),onReview:e=>M(e)}):null]},e.name)})}),(0,Q.jsx)(`p`,{className:`oc-afiles__budget`,children:ne({used:Z(Ze(g.files),I),total:Z(Je,I),pct:R.format(Xe(Ze(g.files)))})})]}),w&&p?(0,Q.jsx)(rt,{instanceName:p.instanceName,agentId:p.agentId,name:w.name,isAdmin:t,onClose:()=>T(null),onSaved:()=>void C()}):null,j?(0,Q.jsx)(it,{curationId:j,onClose:()=>M(null),onApplied:()=>{M(null),C()}}):null]})}function nt({curatable:e,size:t,budget:n,enabled:r,curation:i,inFlight:a,onCurate:o,onReview:s}){return i?.status===`proposed`?(0,Q.jsx)(K,{variant:`default`,size:`sm`,className:`oc-afiles__curate`,onClick:()=>s(i._id),children:Se()}):a||i?.status===`dispatched`||i?.status===`applying`?(0,Q.jsx)(Ne,{variant:`outline`,className:`oc-afiles__curate-status`,children:de()}):e&&r&&n!==null&&Ge(t,n)?(0,Q.jsx)(K,{variant:`outline`,size:`sm`,className:`oc-afiles__curate`,onClick:o,children:ae()}):null}function rt({instanceName:e,agentId:t,name:n,isAdmin:r,onClose:i,onSaved:s}){let l=U(o.agentFiles.getAgentFile),f=U(o.agentFiles.setAgentFile),m=J(),[h,g]=(0,Y.useState)(null),[v,b]=(0,Y.useState)(!1),[S,w]=(0,Y.useState)(``),[E,D]=(0,Y.useState)(!1),[O,P]=(0,Y.useState)(!1),[ne,F]=(0,Y.useState)(!1),[re,I]=(0,Y.useState)(!1),L=(0,Y.useCallback)(async r=>{b(!1);try{let i=await l({instanceName:e,agentId:t,name:n});g({content:i.content,updatedAtMs:i.updatedAtMs}),r||w(i.content),F(!1)}catch{b(!0)}},[l,e,t,n]);(0,Y.useEffect)(()=>{L(!1)},[L]);async function ie(){if(h!==null){P(!0),I(!1);try{await f({instanceName:e,agentId:t,name:n,content:S,baseUpdatedAtMs:h.updatedAtMs??void 0}),m.success(j({name:n})),s(),await L(!1)}catch(e){et(e)?F(!0):I(!0)}finally{P(!1)}}}let R=h!==null&&S!==h.content,z=(0,Y.useMemo)(()=>h===null?null:$e(h.content,S),[h,S]),ae=S.length>X,oe=H(),B=(0,Y.useMemo)(()=>new Intl.NumberFormat(oe),[oe]);return(0,Q.jsx)(Ve,{open:!0,onOpenChange:e=>!e&&i(),children:(0,Q.jsxs)(Fe,{className:`oc-afiles__editor`,children:[(0,Q.jsxs)(Ie,{children:[(0,Q.jsx)(Le,{children:ge({name:n})}),(0,Q.jsxs)(ze,{children:[_({agent:t,instance:e}),r?null:(0,Q.jsxs)(Q.Fragment,{children:[` · `,u()]})]})]}),v?(0,Q.jsxs)(`p`,{className:`oc-afiles__error`,role:`alert`,children:[Ce(),` `,(0,Q.jsx)(K,{variant:`outline`,size:`sm`,onClick:()=>void L(!1),children:te()})]}):h===null?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:W()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`textarea`,{className:`oc-afiles__source`,value:S,readOnly:!r,spellCheck:!1,onChange:e=>w(e.target.value),"aria-label":ge({name:n})}),(0,Q.jsx)(`p`,{className:`oc-afiles__hint`,children:N()}),ne?(0,Q.jsxs)(`p`,{className:`oc-afiles__error`,role:`alert`,children:[k(),` `,(0,Q.jsx)(K,{variant:`outline`,size:`sm`,onClick:()=>void L(!0),children:y()})]}):null,re?(0,Q.jsx)(`p`,{className:`oc-afiles__error`,role:`alert`,children:a()}):null,(0,Q.jsxs)(`div`,{className:`oc-afiles__editor-foot`,children:[(0,Q.jsx)(`span`,{className:`oc-afiles__count${ae?` is-over`:``}`,children:ee({count:B.format(S.length),max:B.format(X)})}),r?(0,Q.jsx)(K,{size:`sm`,disabled:!R||O||ne,onClick:()=>D(!0),children:O?A():d()}):null]})]}),(0,Q.jsx)(Ee,{open:E,onOpenChange:D,children:(0,Q.jsxs)(Te,{children:[(0,Q.jsxs)(De,{children:[(0,Q.jsx)(Me,{children:p({name:n})}),(0,Q.jsx)(Oe,{children:c({agent:t})})]}),z?(0,Q.jsxs)(`div`,{className:`oc-afiles__diff`,children:[(0,Q.jsx)(`p`,{className:`oc-afiles__diff-counts`,children:T({added:z.added,removed:z.removed})}),z.sampleAdded.length>0?(0,Q.jsxs)(`div`,{className:`oc-afiles__diff-block`,children:[(0,Q.jsx)(`span`,{className:`oc-afiles__diff-label`,children:C()}),z.sampleAdded.map((e,t)=>(0,Q.jsx)(`code`,{className:`oc-afiles__diff-line is-add`,children:e||` `},t))]}):null,z.sampleRemoved.length>0?(0,Q.jsxs)(`div`,{className:`oc-afiles__diff-block`,children:[(0,Q.jsx)(`span`,{className:`oc-afiles__diff-label`,children:x()}),z.sampleRemoved.map((e,t)=>(0,Q.jsx)(`code`,{className:`oc-afiles__diff-line is-del`,children:e||` `},t))]}):null]}):null,(0,Q.jsxs)(Be,{children:[(0,Q.jsx)(je,{children:M()}),(0,Q.jsx)(Ae,{onClick:()=>void ie(),children:le()})]})]})})]})})}function it({curationId:e,onClose:t,onApplied:n}){let i=G(o.agentFileCuration.getProposal,{curationId:e}),a=U(o.agentFileCuration.approveCuration),c=ue(o.agentFileCuration.rejectCuration),{toast:u}=J(),[d,p]=(0,Y.useState)(null),[h,_]=(0,Y.useState)(!1),[y,x]=(0,Y.useState)(``),C=H(),T=(0,Y.useMemo)(()=>i?$e(i.beforeContent,i.proposedContent):null,[i]);async function D(){p(`approve`);try{let t=await a({curationId:e});t.ok?(u({title:R(),variant:`success`}),n()):u({title:t.reason===`conflict`?ve():pe({reason:t.reason??`unknown`}),variant:`error`})}catch{u({title:V(),variant:`error`})}finally{p(null)}}async function k(n){p(`reject`);try{let i=y.trim();(await c({curationId:e,...i?{comment:i}:{},relaunch:n})).ok?u({title:n?S():ce(),variant:`success`}):u({title:r(),variant:`error`}),t()}catch{u({title:V(),variant:`error`})}finally{p(null)}}return(0,Q.jsx)(Ve,{open:!0,onOpenChange:e=>e?void 0:t(),children:(0,Q.jsxs)(Fe,{className:`oc-afiles__review`,children:[(0,Q.jsxs)(Ie,{children:[(0,Q.jsx)(Le,{children:i?xe({name:i.name}):W()}),(0,Q.jsx)(ze,{children:B()})]}),i===void 0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:W()}):i===null?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:r()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`p`,{className:`oc-afiles__review-sizes`,children:[E({before:Z(i.beforeSize,C),after:Z(i.proposedSize,C)}),i.overBudget?(0,Q.jsxs)(Q.Fragment,{children:[` `,(0,Q.jsx)(q,{size:13,"aria-hidden":!0}),` `,I()]}):null]}),T?(0,Q.jsx)(`p`,{className:`oc-afiles__review-diff`,children:P({added:T.added,removed:T.removed})}):null,i.feedback?(0,Q.jsx)(`p`,{className:`oc-afiles__review-feedback`,children:b({feedback:i.feedback})}):null,T&&T.sampleRemoved.length>0?(0,Q.jsxs)(`div`,{className:`oc-afiles__review-removed`,children:[(0,Q.jsx)(`p`,{className:`oc-afiles__review-label`,children:l()}),(0,Q.jsx)(`ul`,{children:T.sampleRemoved.map((e,t)=>(0,Q.jsx)(`li`,{children:e||`\xA0`},t))})]}):null,(0,Q.jsxs)(`div`,{className:`oc-afiles__review-panes oc-afiles__review-panes--2`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`p`,{className:`oc-afiles__review-label`,children:g()}),(0,Q.jsx)(`pre`,{className:`oc-afiles__review-pre`,children:i.beforeContent})]}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`p`,{className:`oc-afiles__review-label`,children:F()}),(0,Q.jsx)(`pre`,{className:`oc-afiles__review-pre`,children:i.proposedContent})]})]})]}),h?(0,Q.jsxs)(`div`,{className:`oc-afiles__reject-form`,children:[(0,Q.jsx)(`label`,{className:`oc-afiles__review-label`,htmlFor:`curation-reject-comment`,children:O()}),(0,Q.jsx)(`textarea`,{id:`curation-reject-comment`,className:`oc-afiles__reject-textarea`,rows:3,placeholder:v(),value:y,onChange:e=>x(e.target.value)}),(0,Q.jsxs)(`div`,{className:`oc-afiles__review-actions`,children:[(0,Q.jsx)(K,{variant:`ghost`,onClick:()=>_(!1),disabled:d!==null,children:f()}),(0,Q.jsx)(K,{variant:`outline`,onClick:()=>void k(!1),disabled:d!==null,children:d===`reject`?A():s()}),(0,Q.jsx)(K,{variant:`default`,onClick:()=>void k(!0),disabled:d!==null,children:d===`reject`?A():w()})]})]}):(0,Q.jsxs)(`div`,{className:`oc-afiles__review-actions`,children:[(0,Q.jsx)(K,{variant:`outline`,onClick:()=>_(!0),disabled:d!==null||i==null,children:m()}),(0,Q.jsx)(K,{variant:`default`,onClick:()=>void D(),disabled:d!==null||i==null,children:d===`approve`?A():he()})]})]})})}export{tt as AgentFilesTab};
@@ -1 +0,0 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$_ as r,Av as i,Cv as a,Dv as ee,E as o,Ev as te,G_ as s,J_ as c,K_ as l,Mv as u,Nv as d,Ov as f,Q_ as p,Sv as m,Tv as h,X_ as g,Y_ as _,Z_ as ne,_v as re,av as ie,bv as ae,cv as v,dv as oe,ev as se,fv as ce,gv as le,hv as ue,iv as de,jv as y,kv as fe,lj as pe,lv as me,mv as he,nv as ge,ov as b,pv as x,q_ as S,rv as C,sv as w,tv as T,uj as E,uv as D,vv as O,wv as k,xv as A,yv as j}from"./dist-BjwyR-Rb.js";import{A as M,B as N,C as P,Ht as F,S as I,Vt as L,a as _e,at as R,b as z,ht as ve,r as ye,w as B,x as V,z as be}from"./index-BGXPyQxx.js";import{n as xe}from"./TimeRangePicker-BSn6eVzh.js";import{t as Se}from"./FilterBar-5McK3w7W.js";import{t as Ce}from"./DataTableShell-qDyq_xxR.js";import{t as H}from"./dispatchErrorInfo-JTswda6A.js";var U=t(e(),1),W=n(),G=`__all__`,we=[{value:`open`},{value:`acknowledged`},{value:`resolved`}];function Te(e){return e===`open`?d():e===`acknowledged`?u():y()}var Ee=[`info`,`warn`,`critical`],De=[`detector`,`agent`,`user`],Oe={kind:`relative`,from:`now-30d`,to:`now`},ke=200,K=`all`;function q(){let e=F({from:`/settings/anomalies`}),t=L({from:`/settings/anomalies`}),n=e.q??``,s=e.status===K?G:e.status,c=e.severity??G,l=e.kind??G,[u,d]=(0,U.useState)(G),y=ye(e.from,e.to),{from:S,to:H}=xe(y),q=e=>void t({search:t=>({...t,q:e||void 0}),replace:!0}),J=e=>void t({search:t=>({...t,status:e===G?K:e})}),Y=e=>void t({search:t=>({...t,severity:e===G?void 0:e})}),Pe=e=>void t({search:t=>({...t,kind:e===G?void 0:e})}),Fe=e=>void t({search:t=>({...t,..._e(e)})}),Ie=N(),X=be(),Z=pe(o.anomalies.resolveAnomaly),Le=(E(o.me.getMe,{host:ve})?.permissions??[]).includes(`admin.manage`),Q=E(o.anomalies.listAnomalies,{limit:ke,filter:{q:n||void 0,from:S,to:H,anomalyStatus:s===G?void 0:s,severity:c===G?void 0:c,source:u===G?void 0:u,kind:l===G?void 0:l}}),$=(0,U.useMemo)(()=>{let e=new Set;for(let t of Q??[])e.add(t.kind);return[...e].sort()},[Q]),Re=n!==``||s!==`open`||c!==G||u!==G||l!==G||y.kind!==`relative`||y.from!==Oe.from;function ze(){d(G),t({search:{status:`open`},replace:!0})}async function Be(e){if(await Ie({title:i(),description:(0,W.jsxs)(W.Fragment,{children:[fe(),` `,(0,W.jsx)(`span`,{className:`font-mono`,children:e.kind}),` `,f(),` `,(0,W.jsx)(`strong`,{children:ee()}),`.`,` `,te()]}),confirmLabel:h()}))try{await Z({anomalyId:e._id,status:`resolved`}),X.success(k(),e.kind)}catch(e){X.error(a(),e)}}async function Ve(e){try{await Z({anomalyId:e._id,status:`acknowledged`}),X.success(m(),e.kind)}catch(e){X.error(A(),e)}}return(0,W.jsxs)(W.Fragment,{children:[(0,W.jsxs)(`p`,{className:`oc-admin__hint`,children:[ae(),` `,(0,W.jsx)(`strong`,{children:j()}),` `,O(),` `,(0,W.jsx)(`strong`,{children:re()}),` `,le(),` `,(0,W.jsx)(`strong`,{children:ue()}),` `,he(),` `,(0,W.jsx)(`span`,{className:`oc-filter__window`,children:x()})]}),(0,W.jsxs)(Se,{q:n,onQChange:q,searchPlaceholder:ce(),timeRange:y,onTimeRangeChange:Fe,onReset:ze,canReset:Re,children:[(0,W.jsxs)(z,{value:s,onValueChange:J,children:[(0,W.jsx)(P,{size:`sm`,className:`w-36`,children:(0,W.jsx)(B,{})}),(0,W.jsxs)(V,{children:[(0,W.jsx)(I,{value:G,children:oe()}),we.map(e=>(0,W.jsx)(I,{value:e.value,children:Te(e.value)},e.value))]})]}),(0,W.jsxs)(z,{value:c,onValueChange:Y,children:[(0,W.jsx)(P,{size:`sm`,className:`w-36`,children:(0,W.jsx)(B,{placeholder:D()})}),(0,W.jsxs)(V,{children:[(0,W.jsx)(I,{value:G,children:me()}),Ee.map(e=>(0,W.jsx)(I,{value:e,children:e},e))]})]}),(0,W.jsxs)(z,{value:u,onValueChange:d,children:[(0,W.jsx)(P,{size:`sm`,className:`w-32`,children:(0,W.jsx)(B,{placeholder:v()})}),(0,W.jsxs)(V,{children:[(0,W.jsx)(I,{value:G,children:w()}),De.map(e=>(0,W.jsx)(I,{value:e,children:e},e))]})]}),(0,W.jsxs)(z,{value:l,onValueChange:Pe,children:[(0,W.jsx)(P,{size:`sm`,className:`w-36`,children:(0,W.jsx)(B,{placeholder:b()})}),(0,W.jsxs)(V,{children:[(0,W.jsx)(I,{value:G,children:ie()}),$.map(e=>(0,W.jsx)(I,{value:e,children:e},e))]})]})]}),(0,W.jsx)(Ce,{title:de(),rows:Q,emptyHint:s===`open`?C():ge(),rowActions:e=>Le&&e.status===`open`?[{label:T(),onSelect:()=>void Be(e)},{label:se(),onSelect:()=>void Ve(e)}]:[],columns:[{header:r(),cell:e=>(0,W.jsx)(`span`,{className:`oc-traces__time`,children:M(e.at)}),sort:e=>e.at},{header:b(),cell:e=>(0,W.jsx)(`code`,{className:`oc-traces__mono`,children:e.kind}),sort:e=>e.kind},{header:D(),cell:e=>(0,W.jsx)(je,{severity:e.severity}),sort:e=>e.severity===`critical`?2:+(e.severity===`warn`)},{header:p(),cell:e=>(0,W.jsx)(Me,{status:e.status}),sort:e=>e.status===`resolved`?2:+(e.status===`acknowledged`)},{header:v(),cell:e=>(0,W.jsx)(R,{variant:`outline`,children:e.source}),sort:e=>e.source},{header:ne(),cell:e=>(0,W.jsx)(`span`,{className:`oc-anomaly__msg`,children:e.message}),sort:e=>e.message},{header:g(),cell:e=>(0,W.jsx)(Ae,{row:e}),sort:e=>e.evidence??null},{header:_(),cell:e=>e.correlationId?(0,W.jsx)(`code`,{className:`oc-traces__mono`,children:Ne(e.correlationId)}):(0,W.jsx)(`span`,{className:`oc-traces__muted`,children:`—`}),sort:e=>e.correlationId}]})]})}function J(e){if(e.kind!==`openclaw.dispatch_failures`||!e.evidence)return{};try{let t=JSON.parse(e.evidence);return{dominantCode:t.dominantCode,sampleCorrelationId:t.sampleCorrelationId}}catch{return{}}}function Y(e){if(e.kind!==`subagent.failure`||!e.evidence)return{};try{let t=JSON.parse(e.evidence);return{failedCount:t.failedCount,totalCount:t.totalCount,errorCategories:t.errorCategories}}catch{return{}}}function Ae({row:e}){let t=L();if(e.kind===`subagent.failure`){let n=Y(e);return(0,W.jsxs)(`div`,{className:`oc-anomaly__cause`,children:[(0,W.jsx)(`div`,{className:`oc-anomaly__cause-head`,children:[...new Set(n.errorCategories??[])].map(e=>(0,W.jsx)(`code`,{className:`oc-traces__mono`,children:e},e))}),e.correlationId?(0,W.jsxs)(`button`,{type:`button`,className:`oc-anomaly__drill`,onClick:()=>void t({to:`/settings/traces`,search:{q:e.correlationId,limit:100}}),children:[`↗ `,c()]}):null]})}let n=J(e);if(!n.dominantCode)return(0,W.jsx)(`span`,{className:`oc-traces__muted`,children:`—`});let r=H(n.dominantCode),i=n.sampleCorrelationId;return(0,W.jsxs)(`div`,{className:`oc-anomaly__cause`,children:[(0,W.jsxs)(`div`,{className:`oc-anomaly__cause-head`,children:[(0,W.jsx)(`span`,{className:`oc-anomaly__cause-label`,children:r.label}),(0,W.jsx)(`code`,{className:`oc-traces__mono`,children:n.dominantCode})]}),(0,W.jsx)(`p`,{className:`oc-anomaly__cause-hint`,children:r.hint}),i?(0,W.jsxs)(`button`,{type:`button`,className:`oc-anomaly__drill`,onClick:()=>void t({to:`/settings/traces`,search:{q:i,limit:100}}),children:[`↗ `,c()]}):null]})}function je({severity:e}){return(0,W.jsx)(`span`,{className:`oc-anomaly__sev oc-anomaly__sev--${e}`,children:e})}function Me({status:e}){return e===`open`?(0,W.jsx)(R,{variant:`destructive`,children:S()}):e===`acknowledged`?(0,W.jsx)(R,{variant:`secondary`,children:l()}):(0,W.jsx)(R,{variant:`outline`,children:s()})}function Ne(e){return e.length>8?e.slice(0,8):e}export{q as AnomaliesTab};
@@ -1 +0,0 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Ay as r,Dy as i,E as a,Ey as o,Fy as s,Iy as c,Ly as l,My as u,Ny as d,Oy as f,Py as p,Ry as m,Ty as h,an as g,cn as _,jy as v,ky as y,ln as b,on as x,sn as S,uj as C,un as w,wy as T}from"./dist-BjwyR-Rb.js";import{A as E,C as D,Ht as O,S as k,Vt as A,a as j,b as M,i as N,o as P,r as F,t as I,w as L,x as R}from"./index-BGXPyQxx.js";import{n as ee}from"./TimeRangePicker-BSn6eVzh.js";import{t as z}from"./FilterBar-5McK3w7W.js";import{t as B}from"./AdvancedFilter--hO9zyz3.js";import{t as V}from"./DataTableShell-qDyq_xxR.js";var H=t(e(),1),U=n(),W={kind:`relative`,from:I,to:`now`},G=`__all__`,K=[{value:`action`,label:w()},{value:`realLabel`,label:b()},{value:`targetLabel`,label:_()},{value:`impersonated`,label:S()},{value:`resource`,label:x()},{value:`resourceId`,label:g()}];function q(){let e=O({from:`/settings/audit`}),t=A({from:`/settings/audit`}),n=e.q??``,g=e.action??G,_=e.impersonated??G,b=e.resource??G,x=F(e.from,e.to),S=(0,H.useMemo)(()=>P(e.adv),[e.adv]),{from:w,to:I}=ee(x),q=e=>void t({search:t=>({...t,q:e||void 0}),replace:!0}),J=e=>void t({search:t=>({...t,action:e===G?void 0:e})}),Y=e=>void t({search:t=>({...t,impersonated:e===G?void 0:e})}),X=e=>void t({search:t=>({...t,resource:e===G?void 0:e})}),Z=e=>void t({search:t=>({...t,...j(e)})}),Q=e=>void t({search:t=>({...t,adv:N(e)}),replace:!0}),$=C(a.admin.listAudit,{filter:{q:n||void 0,from:w,to:I,action:g===G?void 0:g,resource:b===G?void 0:b,impersonated:_===G?void 0:_===`yes`,advanced:S.length>0?S:void 0}}),te=(0,H.useMemo)(()=>{let e=new Set;for(let t of $??[])e.add(t.action);return[...e].sort()},[$]),ne=(0,H.useMemo)(()=>{let e=new Set;for(let t of $??[])t.resource&&e.add(t.resource);return[...e].sort()},[$]),re=n!==``||g!==G||_!==G||b!==G||S.length>0||x.kind!==`relative`||x.from!==W.from;function ie(){t({search:{},replace:!0})}return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(`p`,{className:`oc-admin__hint`,children:[m(),` `,(0,U.jsx)(`span`,{className:`oc-filter__window`,children:l()})]}),(0,U.jsxs)(z,{q:n,onQChange:q,searchPlaceholder:c(),timeRange:x,onTimeRangeChange:Z,onReset:ie,canReset:re,children:[(0,U.jsxs)(M,{value:g,onValueChange:J,children:[(0,U.jsx)(D,{size:`sm`,className:`w-40`,children:(0,U.jsx)(L,{placeholder:s()})}),(0,U.jsxs)(R,{children:[(0,U.jsx)(k,{value:G,children:p()}),te.map(e=>(0,U.jsx)(k,{value:e,children:e},e))]})]}),(0,U.jsxs)(M,{value:_,onValueChange:Y,children:[(0,U.jsx)(D,{size:`sm`,className:`w-40`,children:(0,U.jsx)(L,{})}),(0,U.jsxs)(R,{children:[(0,U.jsx)(k,{value:G,children:d()}),(0,U.jsx)(k,{value:`yes`,children:u()}),(0,U.jsx)(k,{value:`no`,children:v()})]})]}),(0,U.jsxs)(M,{value:b,onValueChange:X,children:[(0,U.jsx)(D,{size:`sm`,className:`w-40`,children:(0,U.jsx)(L,{placeholder:r()})}),(0,U.jsxs)(R,{children:[(0,U.jsx)(k,{value:G,children:y()}),ne.map(e=>(0,U.jsx)(k,{value:e,children:e},e))]})]})]}),(0,U.jsx)(B,{fields:K,seed:S,onChange:Q}),(0,U.jsx)(V,{title:f(),rows:$,emptyHint:i(),columns:[{header:o(),cell:e=>E(e.at),sort:e=>e.at},{header:s(),cell:e=>e.action,sort:e=>e.action},{header:h(),cell:e=>e.realLabel,sort:e=>e.realLabel},{header:T(),cell:e=>e.targetLabel??`—`,sort:e=>e.targetLabel??null},{header:r(),cell:e=>e.resource?e.resource+(e.resourceId?` · ${e.resourceId.slice(0,8)}`:``):`—`,sort:e=>e.resource??null}]})]})}export{q as AuditTab};
@@ -1 +0,0 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$m as r,Am as i,At as a,Bh as o,Bm as s,Cm as c,D as l,Dm as u,Dt as d,E as f,Em as p,Fm as m,Gh as h,Gm as g,Hh as ee,Hm as _,Ih as te,Im as v,Jm as y,Kh as ne,Km as re,Lh as ie,Lm as ae,Mh as oe,Mm as se,Nh as ce,Nm as le,Om as ue,Ot as de,Pm as fe,Pt as pe,Qm as me,Rh as he,Rm as ge,Sm as _e,Tm as ve,Uh as ye,Um as be,Vh as xe,Vm as Se,Wm as Ce,Xm as we,Ym as Te,Zm as Ee,_m as De,_s as Oe,ah as ke,bm as Ae,bs as je,ch as Me,cs as Ne,ds as Pe,eh as Fe,fs as Ie,gm as Le,gs as Re,hm as ze,hs as b,ih as Be,is as Ve,jm as He,jt as Ue,km as x,kt as We,lh as Ge,lj as Ke,ls as qe,ms as Je,nh as Ye,oh as Xe,ps as Ze,qm as Qe,rh as $e,sh as et,sj as tt,th as nt,uh as rt,uj as S,us as it,vm as at,vs as ot,wm as st,xm as ct,ym as lt,ys as ut,zh as dt,zm as ft}from"./dist-BjwyR-Rb.js";import{i as C,r as pt}from"./dist-C7FCY2SP.js";import{t as mt}from"./chevrons-up-down-Bk2JiK_g.js";import{i as ht,n as w,o as gt,r as _t,s as vt}from"./FieldLabel-BZyPIkg8.js";import{i as yt,n as bt,r as xt,t as St}from"./tabs-WMNx-KXA.js";import{t as Ct}from"./button-ANIiyoGJ.js";import{A as wt,Bt as T,C as E,Ct as D,Et as O,Ht as Tt,Mt as Et,Q as Dt,S as k,Vt as A,X as Ot,Z as kt,at as j,b as M,ct as At,dt as jt,ft as Mt,ht as Nt,j as N,lt as Pt,m as Ft,ot as P,p as It,st as Lt,w as F,x as I,z as Rt,zt as L}from"./index-BGXPyQxx.js";import{r as zt}from"./locales-CPjguROj.js";import{a as Bt,i as R,n as Vt,o as z,r as B,t as V}from"./table-CMG1KRZm.js";import{t as Ht}from"./FilterBar-5McK3w7W.js";import{a as H,n as Ut,o as U,r as W,s as Wt,t as Gt}from"./compatView-7kUvOpPX.js";import{t as G}from"./dispatchErrorInfo-JTswda6A.js";var Kt=l(`refresh-cw`,[[`path`,{d:`M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8`,key:`v9h5vc`}],[`path`,{d:`M21 3v5h-5`,key:`1q7to0`}],[`path`,{d:`M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16`,key:`3uifl3`}],[`path`,{d:`M8 16H3v5`,key:`1cv678`}]]),qt=l(`wifi-off`,[[`path`,{d:`M12 20h.01`,key:`zekei9`}],[`path`,{d:`M8.5 16.429a5 5 0 0 1 7 0`,key:`1bycff`}],[`path`,{d:`M5 12.859a10 10 0 0 1 5.17-2.69`,key:`1dl1wf`}],[`path`,{d:`M19 12.859a10 10 0 0 0-2.007-1.523`,key:`4k23kn`}],[`path`,{d:`M2 8.82a15 15 0 0 1 4.177-2.643`,key:`1grhjp`}],[`path`,{d:`M22 8.82a15 15 0 0 0-11.288-3.764`,key:`z3jwby`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}]]),K=t(e(),1);function Jt(e){return e.filter(e=>e.state===`error`)}function Yt(e){return e.reachable&&Jt(e.targets).length===0}function Xt(e){return e.state===`error`&&e.lastErrorCode!==null}function Zt(e){return!!e.lastDownstreamRejectCode}function q(e){return e.kind??`openclaw`}function Qt(e){return[...e].sort((e,t)=>e===`openclaw`?-1:t===`openclaw`?1:e.localeCompare(t))}function $t(e,t,n){let r=new Map;for(let e of t)e.instanceName&&r.set(e.instanceName,e.provider);for(let e of n)r.set(e.name,q(e));let i=e=>(e.instanceName?r.get(e.instanceName):void 0)??`openclaw`,a=new Set;for(let e of n)a.add(q(e));for(let e of t)a.add(e.provider);for(let t of e)a.add(i(t));return Qt(a).map(r=>({key:r,connections:e.filter(e=>i(e)===r),compatTargets:t.filter(e=>e.provider===r),instances:n.filter(e=>q(e)===r)}))}function J(e){return e===`openclaw`?`OpenClaw`:e===`hermes`?`Hermes`:e.charAt(0).toUpperCase()+e.slice(1)}var Y=`__all__`,en={q:``,state:Y,instance:Y,version:Y},X={connected:0,error:1,idle:2};function tn(e){return e.q.trim()!==``||e.state!==`__all__`||e.instance!==`__all__`||e.version!==`__all__`}function nn(e,t){let n=t.q.trim().toLowerCase();return e.filter(e=>!(n&&!`${e.targetLabel} ${e.gatewayHost}`.toLowerCase().includes(n)||t.state!==`__all__`&&e.state!==t.state||t.instance!==`__all__`&&(e.instanceName??``)!==t.instance||t.version!==`__all__`&&(e.gatewayVersion??``)!==t.version))}function Z(e,t){return e.localeCompare(t,void 0,{numeric:!0,sensitivity:`base`})}function rn(e,t){return e===`version`?t.gatewayVersion===null:e===`lastOk`?t.lastOkAt===null:!1}function an(e,t,n){switch(e){case`state`:return(X[t.state]??99)-(X[n.state]??99);case`instance`:return Z(t.instanceLabel??t.instanceName??``,n.instanceLabel??n.instanceName??``);case`host`:return Z(t.gatewayHost,n.gatewayHost);case`version`:{let e=t.gatewayVersion,r=n.gatewayVersion;return U(e,r)??Z(e,r)}case`lastOk`:return t.lastOkAt-n.lastOkAt;default:return Z(t.targetLabel,n.targetLabel)}}function on(e,t){if(!t)return e;let n=t.dir===`asc`?1:-1;return[...e].sort((e,r)=>{let i=rn(t.key,e),a=rn(t.key,r);return i&&a?0:i?1:a?-1:n*an(t.key,e,r)})}function sn(e){let t=new Set;for(let n of e)t.add(n.state);return[...t].sort((e,t)=>(X[e]??99)-(X[t]??99))}function cn(e){let t=new Map;for(let n of e)n.instanceName!==null&&(t.has(n.instanceName)||t.set(n.instanceName,n.instanceLabel??n.instanceName));return[...t.entries()].map(([e,t])=>({name:e,label:t})).sort((e,t)=>Z(e.label,t.label))}function ln(e){let t=new Set;for(let n of e)n.gatewayVersion!==null&&t.add(n.gatewayVersion);return[...t].sort((e,t)=>U(e,t)??Z(e,t))}var Q=n();function un({connections:e,displayByInstance:t}){let[n,r]=(0,K.useState)(en),[a,o]=(0,K.useState)(null),s=(0,K.useMemo)(()=>e.map((e,n)=>({_id:`${e.key}:${e.canonical}/${e.agentId}:${n}`,targetLabel:`${e.canonical}/${e.agentId}`,state:e.state,instanceName:e.instanceName??null,instanceLabel:e.instanceName?t.get(e.instanceName)??e.instanceName:null,gatewayHost:e.gatewayHost,gatewayVersion:e.gatewayVersion??null,okCount:e.okCount,errorCount:e.errorCount,attempts:e.attempts,lastOkAt:e.lastOkAt??null,lastErrorCode:e.lastErrorCode??null,lastErrorAt:e.lastErrorAt??null,lastDownstreamRejectCode:e.lastDownstreamRejectCode??null,lastDownstreamRejectAt:e.lastDownstreamRejectAt??null})),[e,t]),l=(0,K.useMemo)(()=>sn(s),[s]),d=(0,K.useMemo)(()=>cn(s),[s]),f=(0,K.useMemo)(()=>ln(s),[s]),m=(0,K.useMemo)(()=>on(nn(s,n),a),[s,n,a]);function h(e){o(t=>t?.key===e?t.dir===`asc`?{key:e,dir:`desc`}:null:{key:e,dir:`asc`})}return e.length===0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:le()}):(0,Q.jsxs)(`div`,{className:`oc-conn`,children:[(0,Q.jsxs)(Ht,{q:n.q,onQChange:e=>r(t=>({...t,q:e})),searchPlaceholder:i(),onReset:()=>r(en),canReset:tn(n),children:[(0,Q.jsxs)(M,{value:n.state,onValueChange:e=>r(t=>({...t,state:e})),children:[(0,Q.jsx)(E,{size:`sm`,className:`w-36`,children:(0,Q.jsx)(F,{placeholder:ue()})}),(0,Q.jsxs)(I,{children:[(0,Q.jsx)(k,{value:Y,children:x()}),l.map(e=>(0,Q.jsx)(k,{value:e,children:fn(e)},e))]})]}),(0,Q.jsxs)(M,{value:n.instance,onValueChange:e=>r(t=>({...t,instance:e})),children:[(0,Q.jsx)(E,{size:`sm`,className:`w-40`,children:(0,Q.jsx)(F,{placeholder:u()})}),(0,Q.jsxs)(I,{children:[(0,Q.jsx)(k,{value:Y,children:x()}),d.map(e=>(0,Q.jsx)(k,{value:e.name,children:e.label},e.name))]})]}),(0,Q.jsxs)(M,{value:n.version,onValueChange:e=>r(t=>({...t,version:e})),children:[(0,Q.jsx)(E,{size:`sm`,className:`w-36`,children:(0,Q.jsx)(F,{placeholder:p()})}),(0,Q.jsxs)(I,{children:[(0,Q.jsx)(k,{value:Y,children:x()}),f.map(e=>(0,Q.jsx)(k,{value:e,children:e},e))]})]})]}),m.length===0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:ve()}):(0,Q.jsxs)(V,{className:`oc-conn__table`,children:[(0,Q.jsx)(Bt,{children:(0,Q.jsxs)(z,{children:[(0,Q.jsx)($,{label:st(),sortKey:`target`,sort:a,onSort:h}),(0,Q.jsx)($,{label:c(),sortKey:`state`,sort:a,onSort:h}),(0,Q.jsx)($,{label:_e(),sortKey:`instance`,sort:a,onSort:h}),(0,Q.jsx)($,{label:ct(),sortKey:`host`,sort:a,onSort:h}),(0,Q.jsx)($,{label:Ae(),sortKey:`version`,sort:a,onSort:h}),(0,Q.jsx)(R,{children:lt()}),(0,Q.jsx)($,{label:at(),sortKey:`lastOk`,sort:a,onSort:h})]})}),(0,Q.jsx)(Vt,{children:m.map(e=>(0,Q.jsx)(dn,{r:e},e._id))})]})]})}function $({label:e,sortKey:t,sort:n,onSort:r}){let i=n?.key===t,a=i?n.dir:null;return(0,Q.jsx)(R,{"aria-sort":i?a===`asc`?`ascending`:`descending`:`none`,children:(0,Q.jsxs)(`button`,{type:`button`,className:`oc-conn__sort`,onClick:()=>r(t),children:[e,i?a===`asc`?(0,Q.jsx)(pt,{size:13,"aria-hidden":!0}):(0,Q.jsx)(C,{size:13,"aria-hidden":!0}):(0,Q.jsx)(mt,{size:13,"aria-hidden":!0,className:`oc-conn__sort-idle`})]})})}function dn({r:e}){let t=Xt(e)?G(e.lastErrorCode):null,n=Zt(e)?G(e.lastDownstreamRejectCode):null;return(0,Q.jsxs)(K.Fragment,{children:[(0,Q.jsxs)(z,{className:`oc-conn__row oc-conn__row--${e.state}`,children:[(0,Q.jsx)(B,{children:(0,Q.jsx)(`code`,{className:`oc-traces__mono`,children:e.targetLabel})}),(0,Q.jsx)(B,{children:(0,Q.jsx)(pn,{state:e.state})}),(0,Q.jsx)(B,{children:e.instanceLabel?(0,Q.jsx)(`span`,{className:`oc-bridge-target__instance`,children:e.instanceLabel}):(0,Q.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})}),(0,Q.jsx)(B,{children:(0,Q.jsx)(`span`,{className:`oc-bridge-target__host`,children:e.gatewayHost})}),(0,Q.jsx)(B,{children:e.gatewayVersion?(0,Q.jsx)(`span`,{className:`oc-bridge-target__version`,children:e.gatewayVersion}):(0,Q.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})}),(0,Q.jsx)(B,{children:(0,Q.jsx)(`span`,{className:`oc-conn__stats`,children:se({ok:e.okCount,errors:e.errorCount,attempts:e.attempts})})}),(0,Q.jsx)(B,{children:e.lastOkAt?(0,Q.jsx)(`span`,{className:`oc-traces__mono`,children:N(e.lastOkAt)}):(0,Q.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})})]}),t||n?(0,Q.jsx)(z,{className:`oc-conn__detail-row`,children:(0,Q.jsxs)(B,{colSpan:7,className:`oc-conn__detail-cell`,children:[t?(0,Q.jsxs)(`div`,{className:`oc-bridge-target__error`,children:[(0,Q.jsx)(`strong`,{children:t.label}),` `,(0,Q.jsx)(`code`,{className:`oc-traces__mono`,children:e.lastErrorCode}),e.lastErrorAt?` · ${N(e.lastErrorAt)}`:``,(0,Q.jsx)(`p`,{className:`oc-bridge-card__hint`,children:t.hint})]}):null,n?(0,Q.jsxs)(`div`,{className:`oc-bridge-target__downstream`,children:[He({label:n.label}),` `,(0,Q.jsx)(`code`,{className:`oc-traces__mono`,children:e.lastDownstreamRejectCode}),e.lastDownstreamRejectAt?` · ${N(e.lastDownstreamRejectAt)}`:``]}):null]})}):null]})}function fn(e){return e===`connected`?De():e===`error`?Le():ze()}function pn({state:e}){return e===`connected`?(0,Q.jsx)(j,{variant:`secondary`,children:De()}):e===`error`?(0,Q.jsx)(j,{variant:`destructive`,children:Le()}):(0,Q.jsx)(j,{variant:`outline`,children:ze()})}function mn(){return S(f.bridgeHealth.getBridgeHealth,{})}function hn(){let e=mn(),t=S(f.compat.getBridgeCompat,{}),n=S(f.me.getMe,{host:Nt})?.role===`admin`,r=S(f.admin.listInstances,n?{}:`skip`),i=S(f.agents.usageForInstances,n?{}:`skip`),o=A(),s=()=>void o({to:`/settings/anomalies`,search:{status:`open`}}),c=$t(e?e.targets:[],t?t.targets:[],r??[]),{section:l}=Tt({from:`/settings/bridge`}),u=A({from:`/settings/bridge`}),p=t?.compat??null,m=t===void 0?`loading`:t===null?`nodata`:`ready`,h=p!==null&&Ut(p,`hermes`)&&!c.some(e=>e.key===`hermes`);return(0,Q.jsxs)(`div`,{className:`oc-bridge`,children:[(0,Q.jsx)(gn,{health:e,compat:t,onSeeAnomalies:s}),(0,Q.jsx)(`p`,{className:`oc-admin__hint oc-bridge__caption`,children:we()}),i&&i.length>0?(0,Q.jsxs)(`section`,{className:`oc-bridge__usage`,children:[(0,Q.jsx)(`h3`,{className:`oc-bridge__usage-title`,children:Te()}),(0,Q.jsxs)(V,{children:[(0,Q.jsx)(Bt,{children:(0,Q.jsxs)(z,{children:[(0,Q.jsx)(R,{children:Ue()}),(0,Q.jsx)(R,{children:a()}),(0,Q.jsx)(R,{children:We()}),(0,Q.jsx)(R,{children:de()}),(0,Q.jsx)(R,{children:d()})]})}),(0,Q.jsx)(Vt,{children:i.flatMap(e=>{let t=Ft(e.usage,Date.now());return t?t.windows.map((t,n)=>(0,Q.jsxs)(z,{children:[(0,Q.jsx)(B,{className:`font-medium`,children:n===0?e.instanceName:``}),(0,Q.jsx)(B,{children:t.provider}),(0,Q.jsx)(B,{children:t.label}),(0,Q.jsx)(B,{children:(0,Q.jsxs)(j,{variant:t.percentLeft<=10?`destructive`:t.percentLeft<=25?`outline`:`secondary`,children:[t.percentLeft,`%`]})}),(0,Q.jsx)(B,{className:`text-muted-foreground`,children:t.resetText??`—`})]},`${e.instanceName}:${t.provider}:${t.label}`)):[]})})]})]}):null,c.length>0?(0,Q.jsxs)(St,{value:c.some(e=>e.key===l)?l:c[0]?.key??`openclaw`,onValueChange:e=>void u({search:{section:e},replace:!0}),children:[(0,Q.jsx)(xt,{className:`w-full`,children:c.map(e=>(0,Q.jsxs)(yt,{value:e.key,className:`flex-1 gap-1.5`,children:[(0,Q.jsx)(O,{size:13,"aria-hidden":!0}),J(e.key)]},e.key))}),c.map(e=>(0,Q.jsx)(bt,{value:e.key,children:(0,Q.jsx)(_n,{providerKey:e.key,connections:e.connections,instances:e.instances,manifest:p,compatStatus:m,compatReachable:t?.reachable??!0,protocol:e.key===`openclaw`?t?.protocol??null:null})},e.key))]}):null,h?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:Ve()}):null]})}function gn({health:e,compat:t,onSeeAnomalies:n}){let r=t!=null&&t.buildVersion!=null&&t.bridgeVersion!=null&&t.buildVersion!==t.bridgeVersion,i=t?.buildRevision&&t.buildRevision!==`unknown`?t.buildRevision.slice(0,7):null,a=t&&t!==null?(0,Q.jsxs)(`span`,{className:`oc-bridge-card__ver`,children:[(0,Q.jsx)(`code`,{className:`oc-traces__mono`,children:H(t.bridgeVersion)}),i?(0,Q.jsxs)(Q.Fragment,{children:[` `,(0,Q.jsxs)(`code`,{className:`oc-traces__mono`,title:ot(),children:[`(`,i,`)`]})]}):null,r?(0,Q.jsxs)(`strong`,{className:`oc-bridge-card__mismatch`,children:[` `,Oe({build:t.buildVersion??`?`})]}):null,` · `,Re(),` `,(0,Q.jsx)(`code`,{className:`oc-traces__mono`,children:t.protocolVersion===null?b():String(t.protocolVersion)})]}):null;if(e===void 0)return(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:_()});if(e===null)return(0,Q.jsx)(`div`,{className:`oc-bridge-card oc-bridge-card--idle`,children:Se()});let o=Jt(e.targets),c=!e.reachable,l=Yt(e),u=l?`ok`:`error`,d=wt(e.checkedAt),f=e.startedAt==null?null:wt(e.startedAt);return(0,Q.jsxs)(`div`,{className:`oc-bridge-card oc-bridge-card--${u}`,children:[(0,Q.jsx)(`div`,{className:`oc-bridge-card__icon`,"aria-hidden":!0,children:l?(0,Q.jsx)(L,{size:22}):c?(0,Q.jsx)(qt,{size:22}):(0,Q.jsx)(D,{size:22})}),(0,Q.jsxs)(`div`,{className:`oc-bridge-card__body`,children:[(0,Q.jsx)(`div`,{className:`oc-bridge-card__title`,children:l?s():c?ft():ge({count:o.length})}),(0,Q.jsxs)(`div`,{className:`oc-bridge-card__meta`,children:[(0,Q.jsxs)(`span`,{children:[(0,Q.jsx)(Kt,{size:12,"aria-hidden":!0}),` `,ae({time:d})]}),f?(0,Q.jsx)(`span`,{children:v({time:f})}):null,a]}),c?(0,Q.jsx)(`p`,{className:`oc-bridge-card__hint`,children:G(e.lastError===`not_configured`?`NOT_CONFIGURED`:`BRIDGE_UNREACHABLE`).hint}):null]}),(0,Q.jsx)(`button`,{type:`button`,className:`oc-bridgebar__drill`,onClick:n,children:m()})]})}function _n({providerKey:e,connections:t,instances:n,manifest:r,compatStatus:i,compatReachable:a,protocol:o}){let s=r?Wt(r,e):null,c=new Map;for(let e of n)c.set(e.name,e.displayName??e.name);let l=[],u=new Set;for(let n of t){if(!n.instanceName||u.has(n.instanceName))continue;u.add(n.instanceName);let t=n.gatewayVersion??null;l.push({instanceName:n.instanceName,displayName:c.get(n.instanceName)??n.instanceName,version:t,state:Gt(t,e,r)})}let d=l.map(e=>e.state),f=d.includes(`beyond`)?`beyond`:d.length>0&&d.every(e=>e===`supported`)?`supported`:null,[p,m]=(0,K.useState)(!1);return(0,Q.jsxs)(`section`,{className:`oc-bridge-provider`,children:[(0,Q.jsxs)(`header`,{className:`oc-bridge-provider__head`,children:[(0,Q.jsx)(O,{size:15,"aria-hidden":!0,className:`oc-bridge-provider__icon`}),(0,Q.jsx)(`span`,{className:`oc-bridge-provider__name`,children:J(e)}),f?(0,Q.jsx)(j,{variant:f===`beyond`?`destructive`:`secondary`,children:W(f)}):null]}),(0,Q.jsx)(`h4`,{className:`oc-bridge-provider__sub`,children:je()}),(0,Q.jsx)(yn,{providerName:J(e),support:s,compatStatus:i,compatReachable:a,manifest:r,instanceRows:l}),o?(0,Q.jsx)(vn,{protocol:o}):null,(0,Q.jsxs)(`button`,{type:`button`,className:`oc-bridge-provider__sub oc-bridge-provider__sub--toggle`,"aria-expanded":p,onClick:()=>m(e=>!e),children:[p?(0,Q.jsx)(C,{size:13,"aria-hidden":!0}):(0,Q.jsx)(T,{size:13,"aria-hidden":!0}),fe({count:t.length})]}),p?(0,Q.jsx)(un,{connections:t,displayByInstance:c}):null]})}function vn({protocol:e}){let[t,n]=(0,K.useState)(!1),r=e.coverage,i=e.drift??[];return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`h4`,{className:`oc-bridge-provider__sub`,children:[y(),i.length>0?(0,Q.jsx)(j,{variant:`destructive`,children:re({count:i.length})}):(0,Q.jsx)(j,{variant:`secondary`,children:Qe()})]}),(0,Q.jsxs)(`p`,{className:`oc-admin__hint`,children:[g({version:e.vendoredVersion}),r?` · `+Ce({handled:r.handled,ignored:r.ignored,gaps:r.gaps}):null]}),i.length>0?(0,Q.jsx)(`ul`,{className:`oc-bridge-protocol__list`,role:`list`,children:i.map(e=>(0,Q.jsxs)(`li`,{children:[(0,Q.jsx)(`code`,{className:`oc-traces__mono`,children:e.shape}),` × `,e.count]},e.shape))}):null,r&&r.gapList.length>0?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`button`,{type:`button`,className:`oc-bridge-provider__sub oc-bridge-provider__sub--toggle`,"aria-expanded":t,onClick:()=>n(e=>!e),children:[t?(0,Q.jsx)(C,{size:13,"aria-hidden":!0}):(0,Q.jsx)(T,{size:13,"aria-hidden":!0}),be({count:r.gapList.length})]}),t?(0,Q.jsx)(`ul`,{className:`oc-bridge-protocol__list`,role:`list`,children:r.gapList.map(e=>(0,Q.jsx)(`li`,{children:(0,Q.jsx)(`code`,{className:`oc-traces__mono`,children:e})},e))}):null]}):null]})}function yn({support:e,compatStatus:t,compatReachable:n,manifest:r,instanceRows:i,providerName:a}){return t===`loading`?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:_()}):t===`nodata`?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:ut()}):(0,Q.jsxs)(`div`,{className:`oc-compat`,children:[n?null:(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:Je()}),r===null?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:Ze()}):(0,Q.jsxs)(`div`,{className:`oc-compat__support`,children:[(0,Q.jsx)(`span`,{className:`oc-compat__label`,children:pe({provider:a})}),e&&e.range!==null?(0,Q.jsx)(`span`,{children:Ie({min:e.range.min,max:e.range.maxValidated})}):(0,Q.jsx)(`span`,{children:b()}),e?(0,Q.jsx)(Cn,{versions:e.validatedVersions}):null]}),i.length===0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:Ne()}):(0,Q.jsx)(`div`,{className:`oc-compat__targets`,children:i.map(e=>(0,Q.jsxs)(`div`,{className:`oc-compat__target`,children:[(0,Q.jsx)(`span`,{className:`oc-compat__instance`,children:e.displayName}),(0,Q.jsx)(`code`,{className:`oc-traces__mono`,children:H(e.version)}),(0,Q.jsx)(j,{variant:e.state===`supported`?`secondary`:e.state===`beyond`?`destructive`:`outline`,children:W(e.state)})]},e.instanceName))})]})}function bn({instance:e,onClose:t}){return(0,Q.jsx)(Lt,{open:!0,onOpenChange:e=>!e&&t(),children:(0,Q.jsxs)(At,{className:`oc-bridge-config-dialog`,onOpenAutoFocus:e=>e.preventDefault(),children:[(0,Q.jsxs)(jt,{children:[(0,Q.jsx)(Mt,{children:ne({instance:e.displayName??e.name})}),(0,Q.jsx)(Pt,{children:h()})]}),(0,Q.jsx)(Sn,{instance:e,onClose:t})]})})}function xn({label:e,result:t}){return t?t.checked?(0,Q.jsxs)(`p`,{className:`oc-bridge-config__check-row `+(t.ok?`oc-bridge-config__check-row--ok`:`oc-bridge-config__check-row--err`),children:[t.ok?(0,Q.jsx)(L,{"aria-hidden":!0}):(0,Q.jsx)(D,{"aria-hidden":!0}),(0,Q.jsxs)(`span`,{children:[e,` — `,t.ok?Fe():t.detail]})]}):(0,Q.jsxs)(`p`,{className:`oc-bridge-config__check-row oc-bridge-config__check-row--skip`,children:[e,` — `,r()]}):null}function Sn({instance:e,onClose:t}){let n=Ke(f.admin.upsertInstanceConfig),r=tt(f.bridge.validateMediaPaths),i=Rt(),a=zt(e.config?.contentLocale,void 0),[s,c]=(0,K.useState)(()=>ht(e.config??{},a)),[l,u]=(0,K.useState)(!1),[d,p]=(0,K.useState)(!1),[m,h]=(0,K.useState)(null),g=s.inboundMediaMode===`shared-fs`,_=s.mediaMode===`shared-fs`,v=g||_;async function y(){p(!0),h(null);try{h(await r({instanceName:e.name,inboundMediaMode:s.inboundMediaMode,mediaMode:s.mediaMode}))}catch(e){i.error(Be(),e)}finally{p(!1)}}async function ne(){u(!0);try{let r=e.config??{};await n({instanceId:e._id,config:_t(s,r,a)}),t()}catch(e){i.error(he(),e)}finally{u(!1)}}return(0,Q.jsx)(`div`,{className:`oc-bridge-config`,children:(0,Q.jsxs)(`div`,{className:`oc-bridge-config__form`,children:[(0,Q.jsxs)(`div`,{className:`oc-bridge-config__grid`,children:[(0,Q.jsxs)(`label`,{className:`oc-field`,children:[(0,Q.jsx)(w,{label:ye(),help:ie()}),(0,Q.jsxs)(M,{value:s.mediaMode,onValueChange:e=>c({...s,mediaMode:e}),children:[(0,Q.jsx)(E,{size:`sm`,className:`w-full`,children:(0,Q.jsx)(F,{})}),(0,Q.jsx)(I,{children:vt.map(e=>(0,Q.jsx)(k,{value:e,children:e},e))})]})]}),(0,Q.jsxs)(`label`,{className:`oc-field`,children:[(0,Q.jsx)(w,{label:ee(),help:te()}),(0,Q.jsxs)(M,{value:s.inboundMediaMode,onValueChange:e=>c({...s,inboundMediaMode:e}),children:[(0,Q.jsx)(E,{size:`sm`,className:`w-full`,children:(0,Q.jsx)(F,{})}),(0,Q.jsx)(I,{children:gt.map(e=>(0,Q.jsx)(k,{value:e,children:e},e))})]})]}),(0,Q.jsxs)(`label`,{className:`oc-field`,children:[(0,Q.jsx)(w,{label:xe(),help:ce()}),(0,Q.jsx)(P,{type:`number`,min:1,max:4096,className:`w-full`,value:s.mediaMaxMb,onChange:e=>c({...s,mediaMaxMb:Math.trunc(Number(e.target.value)||0)})})]})]}),v&&(0,Q.jsxs)(`div`,{className:`oc-bridge-config__grid`,children:[g&&(0,Q.jsxs)(`label`,{className:`oc-field`,children:[(0,Q.jsx)(w,{label:rt(),help:Ge()}),(0,Q.jsx)(P,{className:`w-full`,spellCheck:!1,value:s.inboundAgentMount,onChange:e=>c({...s,inboundAgentMount:e.target.value})})]}),_&&(0,Q.jsxs)(`label`,{className:`oc-field`,children:[(0,Q.jsx)(w,{label:Me(),help:et()}),(0,Q.jsx)(P,{className:`w-full`,spellCheck:!1,value:s.outboundAgentMount,onChange:e=>c({...s,outboundAgentMount:e.target.value})})]})]}),(0,Q.jsxs)(`label`,{className:`oc-field--row`,children:[(0,Q.jsx)(It,{checked:s.rehydration,onCheckedChange:e=>c({...s,rehydration:e===!0})}),(0,Q.jsx)(w,{label:o(),help:oe()})]}),v&&m!==null&&(0,Q.jsx)(`div`,{className:`oc-bridge-config__check`,children:m.reachable?!m.inbound&&!m.outbound?(0,Q.jsxs)(`p`,{className:`oc-bridge-config__check-row oc-bridge-config__check-row--err`,children:[(0,Q.jsx)(D,{"aria-hidden":!0}),Ee({reason:m.reason??`?`})]}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(xn,{label:Ye(),result:m.inbound}),(0,Q.jsx)(xn,{label:nt(),result:m.outbound}),(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:$e()})]}):(0,Q.jsxs)(`p`,{className:`oc-bridge-config__check-row oc-bridge-config__check-row--err`,children:[(0,Q.jsx)(D,{"aria-hidden":!0}),me()]})}),(0,Q.jsxs)(`div`,{className:`oc-bridge-config__actions`,children:[v&&(0,Q.jsxs)(Ct,{variant:`outline`,size:`sm`,onClick:()=>void y(),disabled:d,children:[d?(0,Q.jsx)(Et,{className:`size-4 animate-spin`,"aria-hidden":!0}):null,d?ke():Xe()]}),(0,Q.jsx)(Ct,{size:`sm`,onClick:()=>void ne(),disabled:l,children:dt()})]})]})})}function Cn({versions:e}){if(e.length===0)return null;let t=[...e].reverse();return(0,Q.jsxs)(Ot,{children:[(0,Q.jsx)(Dt,{asChild:!0,children:(0,Q.jsxs)(`button`,{type:`button`,className:`oc-compat__versions-btn`,children:[e.length===1?Pe():it({count:e.length}),(0,Q.jsx)(C,{size:13,"aria-hidden":!0})]})}),(0,Q.jsxs)(kt,{className:`oc-compat__versions-pop`,align:`start`,children:[(0,Q.jsx)(`p`,{className:`oc-compat__versions-title`,children:qe()}),(0,Q.jsx)(`div`,{className:`oc-compat__versions-list`,children:t.map(e=>(0,Q.jsx)(j,{variant:`secondary`,children:e},e))})]})]})}export{hn as BridgeTab,bn as InstanceConfigDialog};
@@ -1 +0,0 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$r as r,Cs as i,Ds as a,E as o,Es as s,Ic as c,Lc as l,Nt as u,Os as d,Qr as f,Ss as p,Ts as m,Uc as h,Vc as g,Wh as _,Xr as v,Zr as y,ac as b,ei as x,ks as S,lj as C,ni as w,sj as T,ti as E,tj as D,uj as O,ws as k,xs as A}from"./dist-BjwyR-Rb.js";import{t as j}from"./button-ANIiyoGJ.js";import{C as M,Ct as N,S as P,b as F,d as I,f as L,ot as R,p as z,w as B,x as V,y as H}from"./index-BGXPyQxx.js";import{i as U}from"./compatView-7kUvOpPX.js";/* empty css */var W=t(e(),1),G=[`off`,`minimal`,`low`,`medium`,`high`,`xhigh`];function K(e){let t=typeof e==`object`&&e?e:{},n=t.defaults!==null&&typeof t.defaults==`object`?t.defaults:{},r=n.thinkingDefault??t.thinkingDefault,i=n.fastModeDefault??t.fastModeDefault;return{thinkingDefault:typeof r==`string`?r:null,fastModeDefault:typeof i==`boolean`?i:null}}var q=n();function J({instance:e}){let t=C(o.admin.upsertInstanceConfig),n=e.config?.curationEnabled===!0,a=typeof e.config?.curationBudgetChars==`number`?e.config.curationBudgetChars:null,[s,c]=(0,W.useState)(n),[l,u]=(0,W.useState)(a===null?``:String(a)),[d,m]=(0,W.useState)(`idle`);(0,W.useEffect)(()=>{c(n),u(a===null?``:String(a)),m(`idle`)},[e._id,n,a]);let g=l.trim(),_=g===``?null:/^\d+$/.test(g)?Number.parseInt(g,10):NaN,v=!s||_===null||Number.isInteger(_)&&_>=4e3&&_<=6e4,b=s!==n||(_??null)!==a;async function S(){m(`saving`);try{let n={...e.config??{}};n.curationEnabled=s,!s||_===null||Number.isNaN(_)?delete n.curationBudgetChars:n.curationBudgetChars=_,await t({instanceId:e._id,config:n}),m(`done`)}catch{m(`error`)}}return(0,q.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,q.jsxs)(`label`,{className:`oc-cdefaults__inline`,style:{cursor:`pointer`},children:[(0,q.jsx)(z,{checked:s,onCheckedChange:e=>c(e===!0),"aria-label":x()}),(0,q.jsx)(`span`,{className:`oc-cdefaults__label`,children:x()})]}),(0,q.jsxs)(`div`,{className:`oc-cdefaults__inline`,children:[(0,q.jsx)(R,{type:`number`,min:4e3,max:6e4,step:1e3,placeholder:`20000`,value:l,onChange:e=>u(e.target.value),className:`oc-cdefaults__number`,"aria-invalid":!v,"aria-label":r(),disabled:!s}),(0,q.jsx)(j,{size:`sm`,disabled:!b||!v||d===`saving`,onClick:()=>void S(),children:d===`saving`?h():i()})]}),v?null:(0,q.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:f()}),d===`done`?(0,q.jsx)(`p`,{className:`oc-admin__hint`,role:`status`,children:p()}):null,d===`error`?(0,q.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:A()}):null,(0,q.jsx)(`p`,{className:`oc-cdefaults__help`,children:y()})]})}function Y({instance:e}){let t=C(o.admin.upsertInstanceConfig),n=typeof e.config?.summarizeThresholdChars==`number`?e.config.summarizeThresholdChars:null,[r,a]=(0,W.useState)(n===null?``:String(n)),[s,c]=(0,W.useState)(`idle`);(0,W.useEffect)(()=>{a(n===null?``:String(n)),c(`idle`)},[e._id,n]);let l=r.trim(),u=l===``?null:/^\d+$/.test(l)?Number.parseInt(l,10):NaN,d=u===null||Number.isInteger(u)&&u>=1e3&&u<=2e5,f=(u??null)!==n;async function m(){c(`saving`);try{let n={...e.config??{}};u===null?delete n.summarizeThresholdChars:n.summarizeThresholdChars=u,await t({instanceId:e._id,config:n}),c(`done`)}catch{c(`error`)}}return(0,q.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,q.jsx)(`span`,{className:`oc-cdefaults__label`,children:w()}),(0,q.jsxs)(`div`,{className:`oc-cdefaults__inline`,children:[(0,q.jsx)(R,{type:`number`,min:1e3,max:2e5,step:1e3,placeholder:`8000`,value:r,onChange:e=>a(e.target.value),className:`oc-cdefaults__number`,"aria-invalid":!d}),(0,q.jsx)(j,{size:`sm`,disabled:!f||!d||s===`saving`,onClick:()=>void m(),children:s===`saving`?h():i()})]}),d?null:(0,q.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:v()}),s===`done`?(0,q.jsx)(`p`,{className:`oc-admin__hint`,role:`status`,children:p()}):null,s===`error`?(0,q.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:A()}):null,(0,q.jsx)(`p`,{className:`oc-cdefaults__help`,children:E()})]})}function X(){let e=T(o.agentFiles.getChatDefaults),[t,n]=(0,W.useState)({status:`loading`}),r=O(o.admin.listInstances,{}),[i,f]=(0,W.useState)(null);(0,W.useEffect)(()=>{!r||r.length===0||(!i||!r.some(e=>e.name===i))&&f(r[0].name)},[r,i]);let p=(r?.length??0)>1,h=r!==void 0&&r.length===0,v=O(o.compat.forInstance,i?{instanceName:i}:`skip`),y=i?H(v,`configDefaults`):`loading`,x=y===`loading`?null:y.blocked,C=(0,W.useMemo)(()=>p&&i?{instanceName:i}:{},[p,i]),w=(0,W.useRef)(0),E=(0,W.useCallback)(async()=>{let t=++w.current;n({status:`loading`});try{let r=K(await e(C));if(w.current!==t)return;n({status:`done`,current:r})}catch{if(w.current!==t)return;n({status:`error`})}},[e,C]);(0,W.useEffect)(()=>{x===!1&&(p&&!i||E())},[E,x,p,i]);let A=t.status===`done`?t.current:null,R=(0,W.useMemo)(()=>G.map(e=>({id:e,label:L(e)})),[]),z=(0,W.useMemo)(()=>[{id:`fast`,label:l()},{id:`standard`,label:c()}],[]);return(0,q.jsxs)(`div`,{className:`oc-cdefaults`,children:[(0,q.jsx)(`p`,{className:`oc-admin__hint`,children:S()}),p&&i?(0,q.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,q.jsx)(`span`,{className:`oc-cdefaults__label`,children:b()}),(0,q.jsxs)(F,{value:i,onValueChange:e=>f(e),children:[(0,q.jsx)(M,{size:`sm`,"aria-label":b(),children:(0,q.jsx)(B,{})}),(0,q.jsx)(V,{children:(r??[]).map(e=>(0,q.jsx)(P,{value:e.name,children:e.name},e.name))})]})]}):null,h?(0,q.jsx)(`p`,{className:`oc-admin__hint`,role:`status`,children:_()}):y===`loading`?(0,q.jsx)(`p`,{className:`oc-admin__hint`,children:D()}):y.blocked?(0,q.jsxs)(`p`,{className:`oc-compat__blocked`,role:`status`,children:[(0,q.jsx)(N,{size:14,"aria-hidden":!0}),` `,U(y.gatewayVersion,y.provider)]}):t.status===`loading`?(0,q.jsx)(`p`,{className:`oc-admin__hint`,children:D()}):t.status===`error`?(0,q.jsxs)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:[k(),` `,(0,q.jsx)(j,{variant:`outline`,size:`sm`,onClick:()=>void E(),children:g()})]}):(0,q.jsxs)(q.Fragment,{children:[(0,q.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,q.jsx)(`span`,{className:`oc-cdefaults__label`,children:d()}),(0,q.jsx)(I,{options:R,value:A?.thinkingDefault??null,onChange:()=>{},disabled:!0}),(0,q.jsx)(`p`,{className:`oc-cdefaults__help`,children:a()})]}),(0,q.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,q.jsx)(`span`,{className:`oc-cdefaults__label`,children:s()}),(0,q.jsx)(I,{options:z,value:A===null||A.fastModeDefault===null?null:A.fastModeDefault?`fast`:`standard`,onChange:()=>{},disabled:!0}),(0,q.jsx)(`p`,{className:`oc-cdefaults__help`,children:m()})]}),(0,q.jsx)(`p`,{className:`oc-cdefaults__note`,children:u()})]}),(()=>{let e=r?.find(e=>e.name===(i??r[0]?.name));return e?(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(Y,{instance:e}),(0,q.jsx)(J,{instance:e})]}):null})()]})}export{X as ChatDefaultsTab};
@@ -1 +0,0 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$S as r,$x as i,AS as a,BS as o,CS as s,DS as c,E as l,ES as u,FS as d,GS as f,HS as ee,IS as te,JS as p,KS as m,LS as ne,MS as h,NS as g,OS as re,PS as _,QS as v,RS as ie,SS as y,TS as b,US as x,VS as S,WS as C,XS as w,YS as T,ZS as E,_S as D,_r as O,aS as k,bS as A,cS as j,dS as M,eC as N,eS as P,fS as F,gS as I,hS as L,hr as R,iS as z,jS as B,kS as V,lS as H,lj as U,mS as ae,nS as W,oS as G,pS as K,qS as q,rS as J,sS as oe,tS as se,uS as ce,uj as le,vS as ue,wS as de,xS as fe,yS as pe,zS as me}from"./dist-BjwyR-Rb.js";import{t as he}from"./button-ANIiyoGJ.js";import{A as ge,B as _e}from"./index-BGXPyQxx.js";import{t as Y}from"./DataTableShell-qDyq_xxR.js";var X=t(e(),1),Z=n(),ve={altered_words:()=>N(),incorrect:()=>r(),incoherence:()=>v(),formatting:()=>E(),latency:()=>w(),api_error:()=>T(),other:()=>p()},Q=e=>ve[e]?.()??e;function $({matches:e,sourceWasOpen:t}){return t?e===!0?(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-ok`,children:m()}):e===!1?(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-warn`,children:f()}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill`,children:`—`}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill`,children:q()})}function ye({data:e,closeReason:t}){let n=e.snapshot,r=U(l.feedback.respondToFeedback),[i,s]=(0,X.useState)(e.thread),[f,p]=(0,X.useState)(``),[m,v]=(0,X.useState)(!1);async function y(){let t=f.trim();if(!(!t||m)){v(!0);try{await r({feedbackId:e._id,text:t}),s(e=>[...e,{authorRole:`admin`,text:t,at:Date.now()}]),p(``)}finally{v(!1)}}}let w=[];try{w=n.contextJson?JSON.parse(n.contextJson):[]}catch{w=[]}return(0,Z.jsxs)(`div`,{className:`oc-fbadmin__detail`,children:[(0,Z.jsxs)(`div`,{className:`oc-fbadmin__row`,children:[(0,Z.jsx)($,{matches:n.displayedMatchesStored,sourceWasOpen:n.clientInfo?.sourceWasOpen??!1}),(0,Z.jsxs)(`span`,{className:`oc-fbadmin__meta`,children:[Q(e.category),` · `,n.messageRole,n.isRegeneration?` · ${C()}`:``,n.openclawModel?` · ${n.openclawModel}`:``,n.openclawRuntime?` (${n.openclawRuntime})`:``]})]}),e.comment?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:x()}),(0,Z.jsx)(`p`,{className:`oc-fbadmin__comment`,children:e.comment})]}):null,t?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:k()}),(0,Z.jsx)(`p`,{className:`oc-fbadmin__comment`,children:t})]}):null,(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:ee()}),i.length>0?(0,Z.jsx)(`div`,{className:`oc-fbadmin__thread`,children:i.map((e,t)=>(0,Z.jsxs)(`div`,{className:`oc-notif__msg oc-notif__msg--${e.authorRole}`,children:[(0,Z.jsx)(`span`,{className:`oc-notif__msg-who`,children:e.authorRole===`admin`?S():e.authorRole===`agent`?e.authorLabel??O():o()}),(0,Z.jsx)(`span`,{className:`oc-notif__msg-text`,children:e.text})]},t))}):(0,Z.jsx)(`p`,{className:`oc-fbadmin__meta`,children:me()}),(0,Z.jsx)(`textarea`,{className:`oc-feedback__textarea`,placeholder:ie(),value:f,maxLength:2e3,rows:3,onChange:e=>p(e.target.value.slice(0,2e3))}),(0,Z.jsx)(`div`,{className:`oc-fbadmin__row`,style:{justifyContent:`flex-end`},children:(0,Z.jsx)(he,{size:`sm`,onClick:()=>void y(),disabled:!f.trim()||m,children:m?ne():te()})})]}),(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:d()}),(0,Z.jsx)(`pre`,{className:`oc-msg__source-pre`,children:n.messageText||_()})]}),n.clientInfo?.sourceWasOpen&&n.displayedText!==void 0?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:g()}),(0,Z.jsx)(`pre`,{className:`oc-msg__source-pre`,children:n.displayedText||_()})]}):null,n.promptText?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:h()}),(0,Z.jsx)(`pre`,{className:`oc-msg__source-pre`,children:n.promptText})]}):null,w.length>0?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:B({count:n.contextCount??w.length,truncated:n.contextTruncated?a():``})}),(0,Z.jsx)(`div`,{className:`oc-fbadmin__ctx`,children:w.map((e,t)=>(0,Z.jsxs)(`div`,{className:`oc-fbadmin__ctx-turn`,children:[(0,Z.jsx)(`span`,{className:`oc-fbadmin__ctx-role`,children:e.role}),(0,Z.jsx)(`span`,{className:`oc-fbadmin__ctx-text`,children:e.text})]},t))})]}):null,n.outboxAvailable?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:V()}),(0,Z.jsxs)(`pre`,{className:`oc-msg__source-pre`,children:[n.outboxText??``,n.outboxStatus?`\n[status: ${n.outboxStatus}]`:``]})]}):null,n.clientInfo?.extensionsDetected&&n.clientInfo.extensionsDetected.length>0?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:re()}),(0,Z.jsx)(`div`,{className:`oc-fbadmin__row`,children:n.clientInfo.extensionsDetected.map(e=>(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-warn`,children:e},e))})]}):null,(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:c()}),(0,Z.jsxs)(`p`,{className:`oc-fbadmin__env`,children:[[n.clientInfo?.language,n.clientInfo?.timezone,n.clientInfo?.theme?u({theme:n.clientInfo.theme}):null,n.runId?`run ${n.runId.slice(0,12)}…`:null].filter(Boolean).join(` · `)||`—`,n.clientInfo?.plugins&&n.clientInfo.plugins.length>0?(0,Z.jsxs)(`span`,{className:`oc-fbadmin__plugins`,children:[b(),` `,n.clientInfo.plugins.join(`, `),(0,Z.jsxs)(`span`,{className:`oc-fbadmin__note`,children:[` `,de()]})]}):null,n.clientInfo?.userAgent?(0,Z.jsx)(`span`,{className:`oc-fbadmin__ua`,children:n.clientInfo.userAgent}):null]})]})]})}function be(){let e=le(l.feedback.listForAdmin,{}),t=U(l.feedback.readSnapshot),n=U(l.feedback.deleteFeedback),r=_e(),[a,o]=(0,X.useState)(null),[c,u]=(0,X.useState)({});async function d(e){if(a===e._id){o(null);return}if(!c[e._id]){let n=await t({feedbackId:e._id});u(t=>({...t,[e._id]:n}))}o(e._id)}async function f(e){await r({title:se(),description:P(),confirmLabel:i(),destructive:!0})&&(await n({feedbackId:e._id}),a===e._id&&o(null))}return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`p`,{className:`oc-admin__hint`,children:[s(),` `,(0,Z.jsx)(`strong`,{children:y()}),` `,fe()]}),(0,Z.jsx)(Y,{title:A(),rows:e,emptyHint:pe(),isExpanded:e=>a===e._id&&!!c[e._id],renderExpanded:e=>c[e._id]?(0,Z.jsx)(ye,{data:c[e._id],closeReason:e.userCloseReason}):null,columns:[{header:ue(),cell:e=>ge(e.at),sort:e=>e.at},{header:D(),cell:e=>Q(e.category),sort:e=>Q(e.category)},{header:I(),cell:e=>e.messageRole===`user`?L():ae(),sort:e=>e.messageRole},{header:K(),cell:e=>(e.reporterEmail||e.reporterName||`—`)+(e.impersonated&&e.realOperatorEmail?` ${F({operator:e.realOperatorEmail})}`:``),sort:e=>e.reporterEmail||e.reporterName||null},{header:M(),cell:e=>(0,Z.jsx)($,{matches:e.displayedMatchesStored,sourceWasOpen:e.sourceWasOpen}),sort:e=>e.displayedMatchesStored===!1?0:e.displayedMatchesStored===!0?1:2},{header:ce(),cell:e=>e.hasComment?`✎`:`—`,sort:e=>+!!e.hasComment},{header:H(),cell:e=>e.userClosedAt==null?e.resolvedAt==null?e.answered?(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-ok`,children:j()}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill`,children:oe()}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-ok`,title:e.resolvedBy??void 0,children:R()}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-closed`,children:G()}),sort:e=>e.userClosedAt==null?e.resolvedAt==null?+!!e.answered:2:3}],rowActions:e=>[{label:a===e._id?z():J(),onSelect:()=>void d(e)},{label:W(),onSelect:()=>void f(e),variant:`destructive`}]})]})}export{be as FeedbacksTab};
@@ -1 +0,0 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{AA as r,CA as i,DA as ee,E as a,EA as te,FA as ne,MA as o,NA as s,OA as c,PA as l,SA as u,TA as d,WT as f,_A as p,aA as m,bA as h,br as re,cA as g,dA as ie,eA as ae,fA as oe,gA as se,hA as ce,iA as le,jA as _,kA as ue,lA as de,lj as fe,mA as pe,nA as me,oA as he,pA as ge,rA as _e,rj as ve,sA as ye,tA as be,tj as xe,uA as v,uj as y,vA as b,wA as x,xA as S,xr as C,yA as w}from"./dist-BjwyR-Rb.js";import{t as T}from"./button-ANIiyoGJ.js";import{$ as E,C as D,Ft as O,G as k,H as A,It as j,J as M,K as Se,Ot as Ce,S as N,U as we,W as Te,Y as Ee,at as P,b as F,et as De,it as Oe,p as ke,q as Ae,tt as I,w as L,wt as je,x as R,z as Me}from"./index-BGXPyQxx.js";import{a as Ne,i as z,n as Pe,o as B,r as V,t as Fe}from"./table-CMG1KRZm.js";var H=t(e(),1),U=n(),W=`all`;function G(e){switch(e){case`image`:return x();case`audio`:return i();case`video`:return u();case`pdf`:return S();case`document`:return h();case`archive`:return w();default:return b()}}function K(){let[e,t]=(0,H.useState)(W),[n,i]=(0,H.useState)(W),[u,h]=(0,H.useState)(W),[b,x]=(0,H.useState)(W),[S,w]=(0,H.useState)(!1),[K,q]=(0,H.useState)(null),J=fe(a.files.softDelete),Y=Me();function Ie(){t(W),i(W),h(W),x(W)}async function Le(){let e=K;if(q(null),e)try{await J({fileId:e.id}),Y.success(ye())}catch(e){Y.error(he(),e)}}let X=y(a.files.listMine,{direction:e===W?void 0:e,chatId:n===W?void 0:n,instanceName:u===W?void 0:u,category:b===W?void 0:b,includeAutoGenerated:S||void 0}),Re=(0,H.useMemo)(()=>new Intl.DateTimeFormat(ve(),{dateStyle:`medium`,timeStyle:`short`}),[]);if(X===void 0)return(0,U.jsx)(`p`,{className:`oc-admin__hint`,children:xe()});let{files:Z,facets:Q,truncated:ze,cap:Be}=X,$=e!==W||n!==W||u!==W||b!==W;return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`p`,{className:`oc-admin__hint`,children:ne()}),(0,U.jsxs)(`div`,{className:`oc-files__filters`,style:{display:`flex`,flexWrap:`wrap`,gap:8,margin:`12px 0`},children:[(0,U.jsxs)(F,{value:e,onValueChange:t,children:[(0,U.jsx)(D,{size:`sm`,"aria-label":l(),children:(0,U.jsx)(L,{})}),(0,U.jsxs)(R,{children:[(0,U.jsx)(N,{value:W,children:s()}),(0,U.jsx)(N,{value:`inbound`,children:o()}),(0,U.jsx)(N,{value:`outbound`,children:_()})]})]}),(0,U.jsxs)(F,{value:n,onValueChange:i,children:[(0,U.jsx)(D,{size:`sm`,"aria-label":r(),children:(0,U.jsx)(L,{})}),(0,U.jsxs)(R,{children:[(0,U.jsx)(N,{value:W,children:ue()}),Q.chats.map(e=>(0,U.jsx)(N,{value:e.id,children:e.title},e.id))]})]}),Q.multiProvider?(0,U.jsxs)(F,{value:u,onValueChange:h,children:[(0,U.jsx)(D,{size:`sm`,"aria-label":c(),children:(0,U.jsx)(L,{})}),(0,U.jsxs)(R,{children:[(0,U.jsx)(N,{value:W,children:ee()}),Q.instances.map(e=>(0,U.jsx)(N,{value:e,children:e},e))]})]}):null,(0,U.jsxs)(F,{value:b,onValueChange:x,children:[(0,U.jsx)(D,{size:`sm`,"aria-label":te(),children:(0,U.jsx)(L,{})}),(0,U.jsxs)(R,{children:[(0,U.jsx)(N,{value:W,children:d()}),Q.categories.map(e=>(0,U.jsx)(N,{value:e,children:G(e)},e))]})]}),(0,U.jsxs)(`label`,{className:`oc-files__autogen`,children:[(0,U.jsx)(ke,{checked:S,onCheckedChange:e=>w(e===!0),"aria-label":C()}),(0,U.jsx)(`span`,{children:C()})]}),$?(0,U.jsxs)(T,{variant:`ghost`,size:`sm`,onClick:Ie,style:{display:`inline-flex`,alignItems:`center`,gap:4,marginLeft:`auto`},children:[(0,U.jsx)(Ce,{size:14,"aria-hidden":!0}),v()]}):null]}),Z.length===0?(0,U.jsx)(`p`,{className:`oc-admin__hint`,children:$?be():me()}):(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(Fe,{children:[(0,U.jsx)(Ne,{children:(0,U.jsxs)(B,{children:[(0,U.jsx)(z,{children:p()}),(0,U.jsx)(z,{children:se()}),(0,U.jsx)(z,{children:ce()}),(0,U.jsx)(z,{children:pe()}),(0,U.jsx)(z,{children:ge()}),(0,U.jsx)(z,{className:`text-right`,children:oe()})]})}),(0,U.jsx)(Pe,{children:Z.map(e=>(0,U.jsxs)(B,{children:[(0,U.jsxs)(V,{className:`font-medium`,style:{maxWidth:280,overflow:`hidden`,textOverflow:`ellipsis`},title:e.filename,children:[e.filename,e.origin===`pasted`?(0,U.jsx)(P,{variant:`outline`,style:{marginLeft:6},children:re()}):null]}),(0,U.jsx)(V,{title:e.mimeType,children:G(e.category)}),(0,U.jsx)(V,{children:(0,U.jsx)(P,{variant:`secondary`,children:e.direction===`inbound`?o():_()})}),(0,U.jsx)(V,{style:{maxWidth:220,overflow:`hidden`,textOverflow:`ellipsis`},title:e.chatTitle,children:e.chatTitle}),(0,U.jsx)(V,{className:`whitespace-nowrap text-muted-foreground`,children:Re.format(e.createdAt)}),(0,U.jsx)(V,{className:`text-right`,children:(0,U.jsxs)(E,{children:[(0,U.jsx)(Oe,{asChild:!0,children:(0,U.jsx)(T,{variant:`ghost`,size:`icon`,"aria-label":de(),children:(0,U.jsx)(O,{size:16})})}),(0,U.jsxs)(De,{align:`end`,children:[e.url?(0,U.jsx)(I,{asChild:!0,children:(0,U.jsxs)(`a`,{href:e.url,download:e.filename,target:`_blank`,rel:`noopener noreferrer`,children:[(0,U.jsx)(j,{size:14}),ie()]})}):(0,U.jsxs)(I,{disabled:!0,children:[(0,U.jsx)(j,{size:14}),_e()]}),(0,U.jsxs)(I,{variant:`destructive`,onSelect:()=>q({id:e._id,filename:e.filename}),children:[(0,U.jsx)(je,{size:14}),g()]})]})]})})]},e._id))})]}),ze?(0,U.jsx)(`p`,{className:`oc-admin__hint`,style:{marginTop:8},children:ae({cap:Be})}):null]}),(0,U.jsx)(A,{open:K!==null,onOpenChange:e=>!e&&q(null),children:(0,U.jsxs)(k,{children:[(0,U.jsxs)(M,{children:[(0,U.jsx)(Ee,{children:m()}),(0,U.jsx)(Se,{children:le()})]}),(0,U.jsxs)(Ae,{children:[(0,U.jsx)(Te,{children:f()}),(0,U.jsx)(we,{onClick:()=>void Le(),children:g()})]})]})})]})}export{K as FilesTab};
@@ -1 +0,0 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$l as r,Al as i,Bl as a,Cl as o,D as s,Dl as c,E as l,El as u,Fl as d,Gl as f,Hl as p,Il as m,Jl as h,Kl as g,Ll as _,Ml as v,Nl as y,Ol as b,Pl as x,Ql as S,Rl as ee,Sl as C,Tl as w,Ul as te,Vl as ne,Wl as T,Xl as E,Yl as D,Zl as O,_l as re,al as k,au as A,bl as j,cl as ie,cu as ae,dl as M,eu as N,fl as P,gl as oe,hl as se,il as F,iu as ce,jl as I,kl as le,lj as L,ll as ue,lu as de,ml as fe,nl as pe,nu as me,ol as he,ou as ge,pl as _e,ql as ve,rl as ye,ru as be,sl as xe,su as Se,tl as Ce,tu as we,uj as R,ul as Te,uu as Ee,vl as De,wl as Oe,xl as ke,yl as Ae,zl as je}from"./dist-BjwyR-Rb.js";import{t as Me}from"./x-y131Bn-k.js";import{i as z,n as B,r as Ne,t as Pe}from"./tabs-WMNx-KXA.js";import{t as V}from"./button-ANIiyoGJ.js";import{B as Fe,Bt as Ie,C as Le,Et as H,S as Re,Tt as U,at as W,b as ze,ct as Be,dt as Ve,ft as He,ht as Ue,lt as We,ot as G,p as K,st as Ge,u as Ke,w as qe,x as Je,z as q}from"./index-BGXPyQxx.js";import{t as Ye}from"./FilterBar-5McK3w7W.js";import{t as Xe}from"./DataTableShell-qDyq_xxR.js";import{t as J}from"./DetailChips-izXRLBqs.js";var Ze=s(`chevron-left`,[[`path`,{d:`m15 18-6-6 6-6`,key:`1wnfg3`}]]),Qe=s(`palette`,[[`path`,{d:`M12 22a1 1 0 0 1 0-20 10 9 0 0 1 10 9 5 5 0 0 1-5 5h-2.25a1.75 1.75 0 0 0-1.4 2.8l.3.4a1.75 1.75 0 0 1-1.4 2.8z`,key:`e79jfc`}],[`circle`,{cx:`13.5`,cy:`6.5`,r:`.5`,fill:`currentColor`,key:`1okk4w`}],[`circle`,{cx:`17.5`,cy:`10.5`,r:`.5`,fill:`currentColor`,key:`f64h9f`}],[`circle`,{cx:`6.5`,cy:`12.5`,r:`.5`,fill:`currentColor`,key:`qy21gx`}],[`circle`,{cx:`8.5`,cy:`7.5`,r:`.5`,fill:`currentColor`,key:`fotxhn`}]]),Y=s(`shield-check`,[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`,key:`oel41y`}],[`path`,{d:`m9 12 2 2 4-4`,key:`dzmm74`}]]),$e=s(`users`,[[`path`,{d:`M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2`,key:`1yyitq`}],[`path`,{d:`M16 3.128a4 4 0 0 1 0 7.744`,key:`16gr8j`}],[`path`,{d:`M22 21v-2a4 4 0 0 0-3-3.87`,key:`kshegd`}],[`circle`,{cx:`9`,cy:`7`,r:`4`,key:`nufk8`}]]),X=t(e(),1);function et(e,t,n){let r=t.trim().toLowerCase();return[...r?e.filter(e=>[e.email,e.name,e.canonical].some(e=>e!=null&&e.toLowerCase().includes(r))):e.slice()].sort((e,t)=>!n.has(e.userId)-+!n.has(t.userId))}function tt(e,t){let n=e.filter(e=>e.source===`discovered`),r=t.trim().toLowerCase();return r?n.filter(e=>(e.displayName??e.agentId).toLowerCase().includes(r)||e.agentId.toLowerCase().includes(r)):n}function nt(e){let t=e.name?.trim()??``,n=e.email?.trim()??``,r=e.canonical?.trim()||`u-${e.userId.slice(0,8)}`;return t?{primary:t,secondary:n||`@${r}`}:n?{primary:n,secondary:null}:{primary:`@${r}`,secondary:null}}function rt(e){switch(e){case`admin`:return I();case`user`:return i();case`pending`:return le();default:return e}}function Z(e,t){if(e.length===0)return`none`;let n=0;for(let r of e)t(r)&&n++;return n===0?`none`:n===e.length?`all`:`some`}function it(e,t,n){let r=Math.max(1,Math.ceil(e.length/n)),i=Math.min(Math.max(1,Math.floor(t)),r),a=(i-1)*n;return{pageItems:e.slice(a,a+n),page:i,pageCount:r}}var Q=n(),$={name:``,description:``};function at(){let e=R(l.groups.listGroups,{}),t=R(l.me.getMe,{host:Ue})?.role===`admin`,n=L(l.groups.createGroup),i=L(l.groups.updateGroup),a=L(l.groups.deleteGroup),o=Fe(),s=q(),[c,u]=(0,X.useState)(!1),[d,p]=(0,X.useState)(null),[m,_]=(0,X.useState)($),[v,y]=(0,X.useState)(null),[b,x]=(0,X.useState)(``),ee=(0,X.useMemo)(()=>{if(!e)return e;let t=b.trim().toLowerCase();return t?e.filter(e=>e.name.toLowerCase().includes(t)||(e.description??``).toLowerCase().includes(t)||e.members.some(e=>e.label.toLowerCase().includes(t))||e.agents.some(e=>e.toLowerCase().includes(t))||e.charts.some(e=>e.name.toLowerCase().includes(t))):e},[e,b]);function C(){p(null),_($),u(!0)}function w(e){p(e),_({name:e.name,description:e.description??``}),u(!0)}async function ne(){try{d?await i({groupId:d._id,name:m.name,description:m.description}):await n({name:m.name,description:m.description||void 0}),_($),p(null),u(!1)}catch(e){s.error(F(),e)}}async function re(e){if(await o({title:f({name:e.name}),description:T(),confirmWord:e.name,confirmLabel:te(),cancelLabel:O(),destructive:!0}))try{await a({groupId:e._id})}catch(e){s.error(ye(),e)}}return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:de()}),(0,Q.jsx)(Ye,{q:b,onQChange:x,onReset:()=>x(``),canReset:b!==``,searchPlaceholder:me()}),(0,Q.jsx)(Xe,{title:Ee(),rows:ee,addLabel:ae(),onAdd:t?C:void 0,emptyHint:Se(),columns:[{header:ge(),cell:e=>e.name,sort:e=>e.name},{header:A(),cell:e=>(0,Q.jsx)(J,{icon:(0,Q.jsx)($e,{size:12,"aria-hidden":!0}),total:e.memberCount,items:e.members.map(e=>({label:e.label,marker:e.manager?(0,Q.jsx)(Y,{size:11,"aria-hidden":!0}):null,highlight:e.manager}))}),sort:e=>e.memberCount},{header:ce(),cell:e=>(0,Q.jsx)(J,{icon:(0,Q.jsx)(H,{size:12,"aria-hidden":!0}),total:e.agentCount,items:e.agents.map(e=>({label:e}))}),sort:e=>e.agentCount},{header:be(),cell:e=>(0,Q.jsx)(J,{icon:(0,Q.jsx)(Qe,{size:12,"aria-hidden":!0}),total:e.chartCount,items:e.charts.map(e=>({label:e.name,marker:e.isDefault?(0,Q.jsx)(U,{size:11,fill:`currentColor`,"aria-hidden":!0}):null,highlight:e.isDefault}))}),sort:e=>e.chartCount}],rowActions:e=>[{label:we(),onSelect:()=>y({groupId:e._id,name:e.name})},...t?[{label:N(),onSelect:()=>w(e)},{label:r(),variant:`destructive`,onSelect:()=>void re(e)}]:[]]}),(0,Q.jsx)(Ke,{open:c,onOpenChange:u,title:d?D():E(),description:h(),canSubmit:!!m.name.trim(),onSubmit:ne,submitLabel:S(),children:(0,Q.jsxs)(`div`,{className:`oc-form`,children:[(0,Q.jsxs)(`label`,{className:`oc-field`,children:[(0,Q.jsx)(`span`,{className:`oc-field__label`,children:ve()}),(0,Q.jsx)(G,{value:m.name,onChange:e=>_({...m,name:e.target.value})})]}),(0,Q.jsxs)(`label`,{className:`oc-field`,children:[(0,Q.jsx)(`span`,{className:`oc-field__label`,children:g()}),(0,Q.jsx)(G,{value:m.description,onChange:e=>_({...m,description:e.target.value})})]})]})}),(0,Q.jsx)(ct,{groupId:v?.groupId??null,groupName:v?.name??``,open:v!==null,onOpenChange:e=>{e||y(null)}})]})}var ot=8;function st({page:e,pageCount:t,onPage:n}){return t<=1?null:(0,Q.jsxs)(`div`,{className:`oc-access__pager`,children:[(0,Q.jsxs)(V,{type:`button`,variant:`ghost`,size:`sm`,disabled:e<=1,onClick:()=>n(e-1),children:[(0,Q.jsx)(Ze,{size:14,"aria-hidden":!0}),x()]}),(0,Q.jsxs)(`span`,{className:`oc-access__pageinfo`,"aria-label":v({page:e,pages:t}),children:[e,` / `,t]}),(0,Q.jsxs)(V,{type:`button`,variant:`ghost`,size:`sm`,disabled:e>=t,onClick:()=>n(e+1),children:[y(),(0,Q.jsx)(Ie,{size:14,"aria-hidden":!0})]})]})}function ct({groupId:e,groupName:t,open:n,onOpenChange:r}){let i=R(l.groups.getGroup,n&&e?{groupId:e}:`skip`),s=R(l.groups.listAssignableInstances,n?{}:`skip`),c=R(l.groups.listAssignableUsers,n?{}:`skip`),f=L(l.groups.addMember),h=L(l.groups.removeMember),g=L(l.groups.bulkSetMembers),v=L(l.groups.setGroupManager),y=q(),[x,S]=(0,X.useState)(``),[C,w]=(0,X.useState)(``),[te,T]=(0,X.useState)(`members`),[E,D]=(0,X.useState)(1),[O,k]=(0,X.useState)(new Set),A=(0,X.useRef)(null),j=(0,X.useMemo)(()=>new Set((i?.members??[]).map(e=>e.userId)),[i]),ae=(0,X.useMemo)(()=>new Set((i?.members??[]).filter(e=>e.manager).map(e=>e.userId)),[i]),M=i?.viewerIsAdmin===!0,N=(0,X.useMemo)(()=>new Set((i?.agents??[]).map(e=>`${e.instanceName}/${e.agentId}`)),[i]);(0,X.useEffect)(()=>{S(``),w(``),T(`members`),D(1),A.current=null},[n,e]),(0,X.useEffect)(()=>{D(1)},[x]),(0,X.useEffect)(()=>{n&&i&&e&&A.current!==e&&(A.current=e,k(new Set((i.members??[]).map(e=>e.userId))))},[n,i,e]);let P=(0,X.useMemo)(()=>c?et(c,x,O):[],[c,x,O]);async function oe(t,n){if(e)try{n?await h({groupId:e,userId:t}):await f({groupId:e,userId:t})}catch(e){y.error(pe(),e)}}async function se(t,n){if(e)try{await v({groupId:e,userId:t,manager:!n})}catch(e){y.error(he(),e)}}let F=Z(P,e=>j.has(e.userId)),ce=P.filter(e=>j.has(e.userId)).length,I=it(P,E,ot);async function le(){if(!e||P.length===0)return;let t=P.map(e=>e.userId);try{await g({groupId:e,userIds:t,member:F!==`all`})}catch(e){y.error(pe(),e)}}return(0,Q.jsx)(Ge,{open:n,onOpenChange:r,children:(0,Q.jsxs)(Be,{className:`oc-access`,children:[(0,Q.jsxs)(Ve,{children:[(0,Q.jsx)(He,{children:p({name:t})}),(0,Q.jsx)(We,{children:ne()})]}),(0,Q.jsxs)(Pe,{value:te,onValueChange:T,className:`oc-access__tabs`,children:[(0,Q.jsxs)(Ne,{className:`w-full`,children:[(0,Q.jsxs)(z,{value:`members`,className:`flex-1 gap-1.5`,children:[(0,Q.jsx)($e,{size:13,"aria-hidden":!0}),a(),i?(0,Q.jsx)(W,{variant:`secondary`,className:`oc-access__tabcount`,children:j.size}):null]}),(0,Q.jsxs)(z,{value:`agents`,className:`flex-1 gap-1.5`,children:[(0,Q.jsx)(H,{size:13,"aria-hidden":!0}),ee(),i?(0,Q.jsx)(W,{variant:`secondary`,className:`oc-access__tabcount`,children:N.size}):null]}),(0,Q.jsxs)(z,{value:`charts`,className:`flex-1 gap-1.5`,children:[(0,Q.jsx)(Qe,{size:13,"aria-hidden":!0}),re(),i?(0,Q.jsx)(W,{variant:`secondary`,className:`oc-access__tabcount`,children:i.chartCount}):null]})]}),(0,Q.jsx)(B,{value:`members`,children:c===void 0||i===void 0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:u()}):c.length===0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:Oe()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(G,{value:x,onChange:e=>S(e.target.value),placeholder:je(),className:`oc-access__search`}),P.length===0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:m()}):(0,Q.jsxs)(Q.Fragment,{children:[P.length>1?(0,Q.jsxs)(`div`,{className:`oc-access__row oc-access__selectall`,children:[(0,Q.jsx)(K,{checked:F===`all`?!0:F===`some`?`indeterminate`:!1,onCheckedChange:()=>void le(),"aria-label":d()}),(0,Q.jsx)(`span`,{className:`oc-access__label`,children:d()}),(0,Q.jsxs)(W,{variant:`outline`,className:`oc-access__count`,children:[ce,` / `,P.length]})]}):null,(0,Q.jsx)(`div`,{className:`oc-access__list`,children:I.pageItems.map(e=>{let t=j.has(e.userId),n=nt(e),r=ae.has(e.userId);return(0,Q.jsxs)(`div`,{className:`oc-access__row`,children:[(0,Q.jsx)(K,{checked:t,onCheckedChange:()=>void oe(e.userId,t),"aria-label":b({user:n.primary})}),(0,Q.jsxs)(`span`,{className:`oc-access__who`,children:[(0,Q.jsx)(`span`,{className:`oc-access__label`,title:n.primary,children:n.primary}),n.secondary?(0,Q.jsx)(`span`,{className:`oc-access__sub`,title:n.secondary,children:n.secondary}):null]}),(0,Q.jsx)(W,{variant:`outline`,className:`oc-access__role`,children:rt(e.role)}),(0,Q.jsx)(`span`,{className:`oc-access__mgrslot`,children:t&&M?(0,Q.jsx)(V,{type:`button`,variant:`ghost`,size:`icon`,className:`shrink-0 oc-access__mgr${r?` oc-access__mgr--on`:``}`,"aria-pressed":r,"aria-label":r?xe():ie(),title:r?xe():ie(),onClick:()=>void se(e.userId,r),children:(0,Q.jsx)(Y,{size:15,"aria-hidden":!0})}):t&&r?(0,Q.jsx)(`span`,{className:`oc-access__mgr oc-access__mgr--on`,role:`img`,"aria-label":ue(),title:ue(),children:(0,Q.jsx)(Y,{size:15,"aria-hidden":!0})}):null})]},e._id)})}),(0,Q.jsx)(st,{page:I.page,pageCount:I.pageCount,onPage:D})]})]})}),(0,Q.jsx)(B,{value:`agents`,children:s===void 0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:u()}):s.length===0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:o()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(G,{value:C,onChange:e=>w(e.target.value),placeholder:_(),className:`oc-access__search`}),(0,Q.jsx)(`div`,{className:`oc-access__list`,children:s.map(t=>(0,Q.jsx)(lt,{groupId:e,instanceName:t.name,kind:t.kind??`openclaw`,assigned:N,query:C},`${e}-${t._id}`))})]})}),(0,Q.jsx)(B,{value:`charts`,children:(0,Q.jsx)(ut,{groupId:e})})]})]})})}function lt({groupId:e,instanceName:t,kind:n,assigned:r,query:i}){let a=R(l.groups.listAssignableAgents,{instanceName:t}),o=L(l.groups.assignAgentToGroup),s=L(l.groups.removeAgentFromGroup),u=L(l.groups.bulkSetGroupAgents),f=q(),[p,m]=(0,X.useState)(1);if((0,X.useEffect)(()=>{m(1)},[i]),!e)return null;let h=tt(a?.agents??[],i),g=a?.discovery&&!a.discovery.lastPollOk;if(i.trim()&&h.length===0)return null;let _=h.filter(e=>e.presentInLastOk!==!1),v=Z(_,e=>r.has(`${t}/${e.agentId}`)),y=it(h,p,ot);async function b(n,r){try{r?await s({groupId:e,instanceName:t,agentId:n}):await o({groupId:e,instanceName:t,agentId:n})}catch(e){f.error(Ce(),e)}}async function x(){if(_.length===0)return;let n=_.map(e=>e.agentId);try{await u({groupId:e,instanceName:t,agentIds:n,assigned:v!==`all`})}catch(e){f.error(Ce(),e)}}return(0,Q.jsxs)(`div`,{className:`oc-access__group`,children:[(0,Q.jsxs)(`div`,{className:`oc-access__instance`,children:[(0,Q.jsx)(H,{size:13,"aria-hidden":!0}),(0,Q.jsx)(`span`,{children:t}),(0,Q.jsx)(W,{variant:`outline`,className:`oc-access__kind`,children:n}),g?(0,Q.jsx)(W,{variant:`outline`,className:`oc-access__stale`,children:j()}):null]}),a===void 0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:w()}):h.length===0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:g?ke():C()}):(0,Q.jsxs)(Q.Fragment,{children:[_.length>1?(0,Q.jsxs)(`div`,{className:`oc-access__row oc-access__selectall`,children:[(0,Q.jsx)(K,{checked:v===`all`?!0:v===`some`?`indeterminate`:!1,onCheckedChange:()=>void x(),"aria-label":d()}),(0,Q.jsx)(`span`,{className:`oc-access__label`,children:d()})]}):null,y.pageItems.map(e=>{let n=`${t}/${e.agentId}`,i=r.has(n),a=e.presentInLastOk===!1;return(0,Q.jsxs)(`div`,{className:`oc-access__row`,children:[(0,Q.jsx)(K,{checked:i,disabled:a&&!i,onCheckedChange:()=>void b(e.agentId,i),"aria-label":c({name:e.displayName??e.agentId})}),(0,Q.jsxs)(`span`,{className:`oc-access__label`,title:e.displayName??e.agentId,children:[e.emoji?`${e.emoji} `:``,e.displayName??e.agentId]}),e.model?(0,Q.jsx)(`span`,{className:`oc-access__model`,children:e.model}):null,e.isDefaultOnInstance?(0,Q.jsx)(`span`,{className:`oc-access__fav`,role:`img`,"aria-label":De(),title:De(),children:(0,Q.jsx)(U,{size:14,fill:`currentColor`})}):null,a?(0,Q.jsx)(W,{variant:`outline`,className:`oc-access__gone`,children:Ae()}):null]},e.agentId)}),(0,Q.jsx)(st,{page:y.page,pageCount:y.pageCount,onPage:m})]})]})}function ut({groupId:e}){let t=R(l.charts.listGroupChartSelection,e?{groupId:e}:`skip`),n=L(l.charts.assignChartToGroup),r=L(l.charts.removeChartFromGroup),i=L(l.charts.setGroupDefaultChart),a=L(l.charts.addChartToGroupPool),o=L(l.charts.removeChartFromGroupPool),s=q();if(!e)return null;if(t===void 0)return(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:u()});let{pool:c,addable:d,canManagePool:f}=t;if(c.length===0&&!f)return(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:oe()});async function p(t,i){try{i?await r({groupId:e,chartKey:t}):await n({groupId:e,chartKey:t})}catch(e){s.error(k(),e)}}async function m(t){try{await i({groupId:e,chartKey:t})}catch(e){s.error(k(),e)}}async function h(t){try{await a({groupId:e,chartKey:t})}catch(e){s.error(k(),e)}}async function g(t){try{await o({groupId:e,chartKey:t})}catch(e){s.error(k(),e)}}return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`div`,{className:`oc-access__list`,children:c.map(e=>(0,Q.jsxs)(`div`,{className:`oc-access__row`,children:[(0,Q.jsx)(K,{checked:e.selected,onCheckedChange:()=>void p(e.chartKey,e.selected),"aria-label":P({name:e.name})}),(0,Q.jsx)(`span`,{className:`oc-access__label`,title:e.name,children:e.name}),e.selected?e.isDefault?(0,Q.jsx)(`span`,{className:`oc-access__fav`,role:`img`,"aria-label":M(),title:M(),children:(0,Q.jsx)(U,{size:14,fill:`currentColor`})}):(0,Q.jsx)(V,{type:`button`,variant:`ghost`,size:`sm`,onClick:()=>void m(e.chartKey),children:Te()}):null,f?(0,Q.jsx)(V,{type:`button`,variant:`ghost`,size:`sm`,"aria-label":_e({name:e.name}),title:_e({name:e.name}),onClick:()=>void g(e.chartKey),children:(0,Q.jsx)(Me,{size:14,"aria-hidden":!0})}):null]},e.chartKey))}),f?d.length>0?(0,Q.jsxs)(ze,{value:``,onValueChange:e=>void h(e),children:[(0,Q.jsx)(Le,{size:`sm`,className:`oc-access__search`,children:(0,Q.jsx)(qe,{placeholder:fe()})}),(0,Q.jsx)(Je,{children:d.map(e=>(0,Q.jsx)(Re,{value:e.chartKey,children:e.name},e.chartKey))})]}):c.length===0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:se()}):null:null]})}export{at as GroupsTab};
@@ -1 +0,0 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$b as r,$y as i,Ab as a,Bb as o,By as s,Cb as c,Cx as l,Db as u,E as d,Eb as f,Fb as p,Fh as m,Gb as h,Gy as g,Hb as _,Hy as v,IE as y,Ib as b,It as ee,Jb as x,Jy as S,Kb as C,Ky as w,LE as te,Lb as ne,Lt as re,Mb as ie,Nb as ae,Ob as T,Pb as oe,Ph as E,Qb as D,Qy as O,Rb as se,Rt as ce,Sb as le,Sx as ue,Tb as de,Tx as fe,Ub as pe,Uy as me,Vb as k,Vy as he,Wb as ge,Wy as _e,Xb as ve,Xy as ye,Yb as be,Yy as xe,Zb as Se,Zy as Ce,_b as we,_i as Te,_x as Ee,ab as De,ax as Oe,bb as ke,bi as Ae,bx as je,cb as Me,cx as Ne,db as A,dx as Pe,eb as Fe,ex as Ie,fb as Le,fx as Re,gb as ze,gx as Be,hb as Ve,hx as He,ib as Ue,ix as We,jb as Ge,kb as Ke,lb as qe,lj as j,lx as Je,mb as Ye,mx as Xe,nb as Ze,nx as Qe,ob as M,ox as $e,pb as et,px as tt,qb as nt,qy as rt,rb as it,rx as at,sb as ot,sj as N,sx as st,tb as ct,tx as lt,ub as ut,uj as P,ux as dt,vb as ft,vi as pt,vx as mt,wb as ht,wx as gt,xb as _t,xx as vt,yb as yt,yi as bt,yx as xt,zb as St,zy as Ct}from"./dist-BjwyR-Rb.js";import{a as wt,c as Tt}from"./FieldLabel-BZyPIkg8.js";import{t as F}from"./button-ANIiyoGJ.js";import{B as Et,C as I,Q as Dt,S as L,X as Ot,Z as kt,at as R,b as z,ct as B,dt as V,ft as H,lt as U,ot as W,p as G,st as At,u as jt,w as K,x as q,z as J}from"./index-BGXPyQxx.js";import{t as Mt}from"./DataTableShell-qDyq_xxR.js";import{InstanceConfigDialog as Nt}from"./BridgeTab-CljQLbGy.js";var Y=t(e(),1),X=[`conversational`,`documentary`,`summarizer`,`curator`],Pt=new Set(X),Ft=`conversational`;function It(e){let t=new Set((e??[]).filter(e=>Pt.has(e)));return t.size===0?[Ft]:X.filter(e=>t.has(e))}var Z=n(),Q={name:``,gatewayUrl:``,bridgeUrl:``,displayName:``,kind:`openclaw`,transport:`ws`,gatewayVersion:``,gatewayHttpUrl:``,streamTransport:wt},Lt={openclaw:[`token`,`deviceIdentity`],hermes:[`apiKey`]};function Rt(e){return{name:e.name,gatewayUrl:e.gatewayUrl,bridgeUrl:e.bridgeUrl??``,displayName:e.displayName??``,kind:e.kind??`openclaw`,transport:e.transport??`ws`,gatewayVersion:e.gatewayVersion??``,gatewayHttpUrl:e.gatewayHttpUrl??``,streamTransport:e.streamTransport??`reactive`}}function zt(){let e=P(d.admin.listInstances,{}),t=P(d.agents.listAllInstanceAgents,{}),n=j(d.admin.upsertInstance),i=j(d.admin.deleteInstance),a=J(),[o,c]=(0,Y.useState)(!1),[u,f]=(0,Y.useState)(Q),[p,h]=(0,Y.useState)(null),[g,_]=(0,Y.useState)(null),[v,y]=(0,Y.useState)(null),[b,S]=(0,Y.useState)(null);async function C(){try{await n({instanceId:b??void 0,name:u.name,gatewayUrl:u.gatewayUrl,bridgeUrl:u.bridgeUrl||void 0,displayName:u.displayName||void 0,kind:u.kind,transport:u.kind===`hermes`?u.transport:void 0,gatewayVersion:u.gatewayVersion||void 0,gatewayHttpUrl:u.gatewayHttpUrl||void 0,streamTransport:u.streamTransport}),f(Q),S(null),c(!1)}catch(e){a.error(l(),e)}}return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`p`,{className:`oc-admin__hint`,children:[ue(),(0,Z.jsx)(`strong`,{children:vt()}),je()]}),(0,Z.jsx)(Mt,{title:xt(),rows:e,addLabel:mt(),onAdd:()=>{S(null),f(Q),c(!0)},emptyHint:Ee(),columns:[{header:Be(),cell:e=>e.name,sort:e=>e.name},{header:He(),cell:e=>(0,Z.jsx)(R,{variant:`outline`,children:e.kind??`openclaw`}),sort:e=>e.kind??`openclaw`},{header:Xe(),cell:e=>e.gatewayUrl,sort:e=>e.gatewayUrl},{header:tt(),cell:e=>e.displayName??`—`,sort:e=>e.displayName??null},{header:fe(),cell:e=>{let n=(t?.[e.name]??[]).filter(e=>e.presentInLastOk!==!1&&e.enabled);if(n.length===0)return(0,Z.jsx)(`span`,{className:`text-muted-foreground`,children:`—`});let r=t=>e.defaultAgentId===t;return(0,Z.jsx)(`div`,{className:`flex flex-wrap gap-1`,children:[...n].sort((e,t)=>Number(r(t.agentId))-Number(r(e.agentId))).map(e=>(0,Z.jsxs)(R,{variant:r(e.agentId)?`default`:`outline`,title:r(e.agentId)?s():void 0,children:[e.emoji?`${e.emoji} `:``,e.displayName??e.agentId]},e.agentId))})}}],rowActions:e=>[{label:Je(),onSelect:()=>{S(e._id),f(Rt(e)),c(!0)}},{label:gt(),onSelect:()=>h(e.name)},{label:x(),onSelect:()=>y(e)},{label:Re(),onSelect:()=>_(e)},{label:Pe(),variant:`destructive`,onSelect:()=>void i({instanceId:e._id})}],bulkActions:[{label:Pe(),variant:`destructive`,onSelect:e=>e.forEach(e=>void i({instanceId:e}))}]}),(0,Z.jsx)(jt,{open:o,onOpenChange:c,title:b?Ne():dt(),description:$e(),canSubmit:!!(u.name&&u.gatewayUrl),onSubmit:C,submitLabel:Oe(),children:(0,Z.jsxs)(`div`,{className:`oc-form`,children:[(0,Z.jsxs)($,{label:We(),children:[(0,Z.jsx)(W,{value:u.name,disabled:b!==null,onChange:e=>f({...u,name:e.target.value})}),b?(0,Z.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:st()}):null]}),(0,Z.jsx)($,{label:at(),children:(0,Z.jsxs)(z,{value:u.kind,onValueChange:e=>f({...u,kind:e}),children:[(0,Z.jsx)(I,{size:`sm`,className:`w-40`,children:(0,Z.jsx)(K,{})}),(0,Z.jsxs)(q,{children:[(0,Z.jsx)(L,{value:`openclaw`,children:`OpenClaw`}),(0,Z.jsx)(L,{value:`hermes`,children:`Hermes`})]})]})}),u.kind===`hermes`?(0,Z.jsx)($,{label:ce(),children:(0,Z.jsxs)(z,{value:u.transport,onValueChange:e=>f({...u,transport:e}),children:[(0,Z.jsx)(I,{size:`sm`,className:`w-56`,children:(0,Z.jsx)(K,{})}),(0,Z.jsxs)(q,{children:[(0,Z.jsx)(L,{value:`ws`,children:re()}),(0,Z.jsx)(L,{value:`rest`,children:ee()})]})]})}):null,(0,Z.jsx)($,{label:Qe(),children:(0,Z.jsx)(W,{value:u.gatewayUrl,onChange:e=>f({...u,gatewayUrl:e.target.value})})}),(0,Z.jsx)($,{label:lt(),children:(0,Z.jsx)(W,{value:u.bridgeUrl,placeholder:Ie(),onChange:e=>f({...u,bridgeUrl:e.target.value})})}),(0,Z.jsx)($,{label:r(),children:(0,Z.jsx)(W,{value:u.displayName,onChange:e=>f({...u,displayName:e.target.value})})}),(0,Z.jsxs)($,{label:m(),children:[(0,Z.jsxs)(z,{value:u.streamTransport,onValueChange:e=>f({...u,streamTransport:e}),children:[(0,Z.jsx)(I,{size:`sm`,className:`w-40`,children:(0,Z.jsx)(K,{})}),(0,Z.jsx)(q,{children:Tt.map(e=>(0,Z.jsx)(L,{value:e,children:e},e))})]}),(0,Z.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:E()})]}),(0,Z.jsx)($,{label:D(),children:(0,Z.jsx)(W,{value:u.gatewayVersion,placeholder:Se(),onChange:e=>f({...u,gatewayVersion:e.target.value})})}),(0,Z.jsx)($,{label:ve(),children:(0,Z.jsx)(W,{value:u.gatewayHttpUrl,placeholder:be(),onChange:e=>f({...u,gatewayHttpUrl:e.target.value})})})]})}),(0,Z.jsx)(Yt,{instanceName:p,open:p!==null,onOpenChange:e=>{e||h(null)}}),g?(0,Z.jsx)(Nt,{instance:g,onClose:()=>_(null)},g._id):null,v?(0,Z.jsx)(Bt,{instance:v,onClose:()=>y(null)},v._id):null]})}function Bt({instance:e,onClose:t}){let n=P(d.instanceSecrets.listInstanceSecretStatus,{}),r=Lt[e.kind??`openclaw`],i=(0,Y.useMemo)(()=>{let t={};for(let r of n??[])r.instanceId===e._id&&(t[r.field]=r.updatedAt);return t},[n,e._id]);return(0,Z.jsx)(At,{open:!0,onOpenChange:e=>!e&&t(),children:(0,Z.jsxs)(B,{onOpenAutoFocus:e=>e.preventDefault(),children:[(0,Z.jsxs)(V,{children:[(0,Z.jsx)(H,{children:nt({instance:e.displayName??e.name})}),(0,Z.jsx)(U,{children:C()})]}),(0,Z.jsx)(`div`,{className:`oc-form`,children:r.map(t=>(0,Z.jsx)(Ut,{instanceId:e._id,field:t,updatedAt:i[t]??null},t))}),(0,Z.jsx)(`div`,{className:`oc-bridgesecret`,children:(0,Z.jsx)(Ht,{instance:e})}),(0,Z.jsx)(Vt,{instance:e})]})})}function Vt({instance:e}){let t=N(d.instanceSync.forceInstanceSync),n=J(),[r,i]=(0,Y.useState)(!1);async function a(){if(!r){i(!0);try{switch((await t({instanceId:e._id})).status){case`synced`:n.success(f());break;case`no_agents`:n.success(ht());break;case`no_bridge_url`:n.error(c());break;case`deploy_misconfigured`:n.error(le());break;case`unauthorized`:n.error(ke());break;case`not_served`:n.error(yt());break;default:n.error(_t());break}}catch(e){n.error(de(),e)}finally{i(!1)}}}return(0,Z.jsxs)(`div`,{className:`oc-form`,children:[(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:ft()}),(0,Z.jsx)(`div`,{className:`flex items-center gap-2`,children:(0,Z.jsx)(F,{size:`sm`,variant:`outline`,onClick:()=>void a(),disabled:r,children:r?u():T()})})]})}function Ht({instance:e}){let t=P(d.bridgeAuth.listBridgeAuthStatus,{}),n=N(d.bridgeAuth.mintBridgeSecret),r=j(d.bridgeAuth.revokeBridgeSecret),i=J(),[a,o]=(0,Y.useState)(!1),[s,c]=(0,Y.useState)(null),[l,u]=(0,Y.useState)(!1),f=(t??[]).find(t=>t.instanceId===e._id),p=f!==void 0;async function m(){if(!a){o(!0);try{c((await n({instanceId:e._id})).plaintext),u(!1)}catch(e){i.error(A(),e)}finally{o(!1)}}}async function h(){if(!a){o(!0);try{await r({instanceId:e._id}),c(null),i.success(Le())}catch(e){i.error(A(),e)}finally{o(!1)}}}async function g(){if(s)try{await navigator.clipboard.writeText(s),u(!0)}catch{}}return(0,Z.jsxs)($,{label:we(),children:[(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:ze()}),(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Z.jsx)(R,{variant:p?`outline`:`secondary`,children:p?`${_()} · ${f.prefix}…${f.lastFour}`:k()}),(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(F,{size:`sm`,onClick:()=>void m(),disabled:a,children:p?Ye():Ve()}),p?(0,Z.jsx)(F,{size:`sm`,variant:`destructive`,onClick:()=>void h(),disabled:a,children:et()}):null]})]}),s?(0,Z.jsxs)(`div`,{className:`oc-bridgesecret__reveal`,children:[(0,Z.jsx)(`p`,{className:`oc-sa__minted-warning`,children:ut()}),(0,Z.jsxs)(`div`,{className:`oc-sa__minted-box`,children:[(0,Z.jsx)(`code`,{className:`oc-sa__minted-plain`,children:s}),(0,Z.jsx)(F,{variant:`outline`,size:`sm`,onClick:()=>void g(),children:l?te():y()})]}),(0,Z.jsx)(F,{size:`sm`,variant:`ghost`,onClick:()=>{c(null),u(!1)},children:qe()})]}):null]})}function Ut({instanceId:e,field:t,updatedAt:n}){let r=N(d.instanceSecrets.setInstanceSecret),i=j(d.instanceSecrets.clearInstanceSecret),s=N(d.deviceIdentity.generateDeviceIdentity),c=J(),[l,u]=(0,Y.useState)(``),[f,m]=(0,Y.useState)(!1),[g,v]=(0,Y.useState)(null),[ee,x]=(0,Y.useState)(!1),S=n!==null,C=t===`deviceIdentity`,w=t===`token`?h():t===`deviceIdentity`?ge():pe();async function re(){if(!(!l.trim()||f)){m(!0);try{await r({instanceId:e,field:t,plaintext:l}),u(``),v(null),x(!1),c.success(b())}catch(e){c.error(p(),e)}finally{m(!1)}}}async function T(){if(!f){m(!0);try{await i({instanceId:e,field:t}),v(null),x(!1),c.success(oe())}catch(e){c.error(p(),e)}finally{m(!1)}}}async function E(){if(!f){m(!0);try{v(await s({instanceId:e})),x(!1),c.success(Ge())}catch(e){c.error(Ke(),e)}finally{m(!1)}}}let D=g?`openclaw devices approve ${g.id}`:``;async function O(){if(D)try{await navigator.clipboard.writeText(D),x(!0)}catch{}}return(0,Z.jsxs)($,{label:w,children:[C?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:ie()}):null,(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Z.jsx)(R,{variant:S?`outline`:`secondary`,children:S?_():k()}),(0,Z.jsx)(W,{type:`password`,autoComplete:`off`,className:`flex-1 min-w-32`,value:l,placeholder:S?St():o(),onChange:e=>u(e.target.value)}),(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(F,{size:`sm`,onClick:()=>void re(),disabled:f||l.trim().length===0,children:se()}),C?(0,Z.jsx)(F,{size:`sm`,variant:`outline`,onClick:()=>void E(),disabled:f,children:ae()}):null,S?(0,Z.jsx)(F,{size:`sm`,variant:`destructive`,onClick:()=>void T(),disabled:f,children:ne()}):null]})]}),g?(0,Z.jsxs)(`div`,{className:`oc-bridgesecret__reveal`,children:[(0,Z.jsx)(`p`,{className:`text-sm font-medium`,children:Ge()}),(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:a()}),(0,Z.jsxs)(`div`,{className:`oc-sa__minted-box`,children:[(0,Z.jsx)(`code`,{className:`oc-sa__minted-plain`,children:D}),(0,Z.jsx)(F,{variant:`outline`,size:`sm`,onClick:()=>void O(),children:ee?te():y()})]}),(0,Z.jsx)(F,{size:`sm`,variant:`ghost`,onClick:()=>{v(null),x(!1)},children:qe()})]}):null]})}var Wt={conversational:ct,documentary:i,summarizer:Ae,curator:pt},Gt={conversational:Fe,documentary:O,summarizer:bt,curator:Te},Kt=e=>(Wt[e]??(()=>e))(),qt=e=>(Gt[e]??(()=>``))();function Jt({agentId:e,types:t,onToggle:n}){return(0,Z.jsxs)(`div`,{className:`oc-agentcard__types`,children:[(0,Z.jsx)(`span`,{className:`oc-agentcard__types-label`,children:De()}),t.map(e=>(0,Z.jsx)(R,{variant:`secondary`,className:`oc-agenttype__chip`,title:qt(e),children:Kt(e)},e)),(0,Z.jsxs)(Ot,{children:[(0,Z.jsx)(Dt,{asChild:!0,children:(0,Z.jsx)(F,{type:`button`,variant:`outline`,size:`sm`,className:`h-7`,children:Ue()})}),(0,Z.jsxs)(kt,{align:`start`,className:`oc-agenttypes-pop`,children:[(0,Z.jsx)(`p`,{className:`oc-agenttypes-pop__title`,children:it()}),(0,Z.jsx)(`p`,{className:`oc-agenttypes-pop__hint`,children:Ze()}),(0,Z.jsx)(`div`,{className:`oc-agenttypes-pop__list`,children:X.map(r=>{let i=`agtype-${e}-${r}`;return(0,Z.jsxs)(`div`,{className:`oc-agenttypes-pop__item`,children:[(0,Z.jsx)(G,{id:i,checked:t.includes(r),onCheckedChange:()=>n(r)}),(0,Z.jsxs)(`label`,{htmlFor:i,className:`oc-agenttypes-pop__text`,children:[(0,Z.jsx)(`span`,{className:`oc-agenttypes-pop__name`,children:Kt(r)}),(0,Z.jsx)(`span`,{className:`oc-agenttypes-pop__desc`,children:qt(r)})]})]},r)})})]})]})]})}function Yt({instanceName:e,open:t,onOpenChange:n}){let r=P(d.agents.listAgentsForInstance,t&&e?{instanceName:e}:`skip`),i=j(d.agents.setAgentEnabled).withOptimisticUpdate((e,{instanceName:t,agentId:n,enabled:r})=>{let i=e.getQuery(d.agents.listAgentsForInstance,{instanceName:t});i&&e.setQuery(d.agents.listAgentsForInstance,{instanceName:t},{...i,agents:i.agents.map(e=>e.agentId===n?{...e,enabled:r}:e)})}),a=j(d.agents.setInstanceDefaultAgent).withOptimisticUpdate((e,{instanceName:t,agentId:n})=>{let r=e.getQuery(d.agents.listAgentsForInstance,{instanceName:t});r&&e.setQuery(d.agents.listAgentsForInstance,{instanceName:t},{...r,defaultAgentId:n})}),o=j(d.agents.setAgentTypes).withOptimisticUpdate((e,{instanceName:t,agentId:n,types:r})=>{let i=e.getQuery(d.agents.listAgentsForInstance,{instanceName:t});if(!i)return;let a=It(r);e.setQuery(d.agents.listAgentsForInstance,{instanceName:t},{...i,agents:i.agents.map(e=>e.agentId===n?{...e,types:a}:e)})}),c=j(d.agents.removeInstanceAgent),l=Et(),u=J();async function f(t,n){if(e)try{await i({instanceName:e,agentId:t,enabled:n})}catch(e){u.error(M(),e)}}async function p(t){if(e)try{await a({instanceName:e,agentId:t})}catch(e){u.error(M(),e)}}async function m(t,n,r){if(!e)return;let i=r.includes(n)?r.filter(e=>e!==n):[...r,n];try{await o({instanceName:e,agentId:t,types:i})}catch(e){u.error(M(),e)}}async function h(t,n){if(e&&await l({title:xe({name:n}),description:S(),confirmLabel:rt(),destructive:!0}))try{await c({instanceName:e,agentId:t}),u.success(w())}catch(e){u.error(M(),e)}}return(0,Z.jsx)(At,{open:t,onOpenChange:n,children:(0,Z.jsxs)(B,{className:`oc-access`,children:[(0,Z.jsxs)(V,{children:[(0,Z.jsx)(H,{children:Me({name:e??``})}),(0,Z.jsx)(U,{children:ot()})]}),r===void 0?(0,Z.jsx)(`p`,{className:`oc-access__hint`,children:g()}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`div`,{className:`oc-access__poll`,children:r.discovery===null?_e():r.discovery.lastPollOk?me():v({error:r.discovery.error??`?`})}),r.agents.length===0?(0,Z.jsx)(`p`,{className:`oc-access__hint`,children:he()}):(0,Z.jsx)(`div`,{className:`oc-access__list`,children:r.agents.map(e=>{let t=e.presentInLastOk===!1,n=r.defaultAgentId===e.agentId,i=e.displayName??e.agentId,a=e.types??[];return(0,Z.jsxs)(`div`,{className:`oc-agentcard`+(e.enabled?``:` oc-agentcard--off`),children:[(0,Z.jsxs)(`div`,{className:`oc-agentcard__head`,children:[(0,Z.jsx)(G,{checked:e.enabled,disabled:t,"aria-label":i,onCheckedChange:t=>void f(e.agentId,t===!0)}),(0,Z.jsxs)(`span`,{className:`oc-agentcard__name`,title:i,children:[e.emoji?`${e.emoji} `:``,i]}),e.model?(0,Z.jsx)(`span`,{className:`oc-access__model`,children:e.model}):null,t?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(R,{variant:`outline`,className:`oc-access__gone`,children:Ct()}),(0,Z.jsx)(F,{size:`sm`,variant:`ghost`,className:`h-7 text-destructive`,onClick:()=>void h(e.agentId,i),children:ye()})]}):n?(0,Z.jsx)(R,{variant:`default`,children:s()}):(0,Z.jsx)(F,{size:`sm`,variant:`outline`,className:`h-7`,disabled:!e.enabled,onClick:()=>void p(e.agentId),children:Ce()})]}),e.enabled?(0,Z.jsx)(Jt,{agentId:e.agentId,types:a,onToggle:t=>void m(e.agentId,t,a)}):null]},e.agentId)})})]})]})})}function $({label:e,children:t}){return(0,Z.jsxs)(`label`,{className:`oc-field`,children:[(0,Z.jsx)(`span`,{className:`oc-field__label`,children:e}),t]})}export{zt as InstancesTab};
@@ -1 +0,0 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Ba as r,E as i,Fa as a,Ia as o,La as s,Na as c,Pa as l,Ra as u,Va as d,aC as f,cC as p,dC as m,fC as h,iC as g,lC as _,lj as v,mC as y,nC as b,oC as x,pC as S,rC as C,sC as w,sj as T,tC as E,uC as D,uj as O,za as k}from"./dist-BjwyR-Rb.js";import{t as A}from"./button-ANIiyoGJ.js";import{at as j,ot as M,p as N}from"./index-BGXPyQxx.js";var P=t(e(),1),F=n();function I(){let e=O(i.integrations.status.status,{}),t=v(i.admin.setIntegrationConfig),[n,a]=(0,P.useState)(null);if((0,P.useEffect)(()=>{e&&n===null&&a(e.config)},[e,n]),!e||!n)return(0,F.jsx)(`p`,{className:`oc-admin__hint`,children:y()});let o=n,s=(e,t,n)=>a({...o,[e]:{...o[e],[t]:n}}),c=(e,n)=>void t({[e]:n});return(0,F.jsxs)(F.Fragment,{children:[(0,F.jsxs)(`p`,{className:`oc-admin__hint`,children:[S(),` `,(0,F.jsx)(`strong`,{children:h()}),` `,m()]}),(0,F.jsxs)(L,{title:`Langfuse`,status:e.langfuse.configured?e.langfuse.enabled?(0,F.jsx)(j,{variant:`secondary`,children:D()}):(0,F.jsx)(j,{variant:`outline`,children:_()}):(0,F.jsx)(j,{variant:`outline`,children:p()}),note:w(),children:[(0,F.jsx)(R,{label:f(),children:(0,F.jsx)(M,{value:o.langfuse.host??``,placeholder:e.langfuse.effectiveHost,onChange:e=>s(`langfuse`,`host`,e.target.value),onBlur:()=>c(`langfuse`,{host:o.langfuse.host??``})})}),(0,F.jsx)(z,{label:E(),checked:o.langfuse.enabled??!0,onChange:e=>{s(`langfuse`,`enabled`,e),c(`langfuse`,{enabled:e})}})]}),(0,F.jsxs)(L,{title:`Opik`,status:e.opik.configured?e.opik.enabled?(0,F.jsx)(j,{variant:`secondary`,children:D()}):(0,F.jsx)(j,{variant:`outline`,children:_()}):(0,F.jsx)(j,{variant:`outline`,children:p()}),note:x(),children:[(0,F.jsx)(R,{label:g(),children:(0,F.jsx)(M,{value:o.opik.baseUrl??``,placeholder:e.opik.effectiveBaseUrl,onChange:e=>s(`opik`,`baseUrl`,e.target.value),onBlur:()=>c(`opik`,{baseUrl:o.opik.baseUrl??``})})}),(0,F.jsx)(R,{label:C(),children:(0,F.jsx)(M,{value:o.opik.workspace??``,placeholder:e.opik.effectiveWorkspace||b(),onChange:e=>s(`opik`,`workspace`,e.target.value),onBlur:()=>c(`opik`,{workspace:o.opik.workspace??``})})}),(0,F.jsx)(z,{label:E(),checked:o.opik.enabled??!0,onChange:e=>{s(`opik`,`enabled`,e),c(`opik`,{enabled:e})}})]}),(0,F.jsxs)(L,{title:`OpenTelemetry (OTLP)`,status:e.otlp.configured?e.otlp.enabled?(0,F.jsx)(j,{variant:`secondary`,children:D()}):(0,F.jsx)(j,{variant:`outline`,children:_()}):(0,F.jsx)(j,{variant:`outline`,children:d()}),note:r(),children:[(0,F.jsx)(R,{label:k(),children:(0,F.jsx)(M,{value:o.otlp.endpoint??``,placeholder:e.otlp.effectiveEndpoint||`https://otlp.example.com/v1/traces`,onChange:e=>s(`otlp`,`endpoint`,e.target.value),onBlur:()=>c(`otlp`,{endpoint:o.otlp.endpoint??``})})}),(0,F.jsx)(B,{headersSet:e.otlp.headersSet}),(0,F.jsx)(z,{label:E(),checked:o.otlp.enabled??!0,onChange:e=>{s(`otlp`,`enabled`,e),c(`otlp`,{enabled:e})}})]})]})}function L({title:e,status:t,note:n,children:r}){return(0,F.jsxs)(`section`,{className:`oc-int__section`,children:[(0,F.jsxs)(`div`,{className:`oc-int__section-head`,children:[(0,F.jsx)(`h3`,{className:`oc-uipa__h`,children:e}),t]}),n?(0,F.jsx)(`p`,{className:`oc-uipa__note`,children:n}):null,(0,F.jsx)(`div`,{className:`oc-int__fields`,children:r})]})}function R({label:e,children:t}){return(0,F.jsxs)(`label`,{className:`oc-int__field`,children:[(0,F.jsx)(`span`,{className:`oc-int__field-label`,children:e}),t]})}function z({label:e,checked:t,onChange:n}){return(0,F.jsxs)(`label`,{className:`oc-int__toggle`,children:[(0,F.jsx)(N,{checked:t,onCheckedChange:e=>n(e===!0)}),(0,F.jsx)(`span`,{children:e})]})}function B({headersSet:e}){let t=T(i.integrations.otlpSecret.setOtlpHeaders),n=v(i.integrations.otlpSecret.clearOtlpHeaders),[r,d]=(0,P.useState)(``),[f,p]=(0,P.useState)(null),[m,h]=(0,P.useState)(!1),g=async()=>{h(!0),p(null);try{await t({headersJson:r}),d(``)}catch(e){p(e instanceof Error?e.message:String(e))}finally{h(!1)}};return(0,F.jsxs)(R,{label:u(),children:[(0,F.jsx)(M,{value:r,placeholder:e?s():o(),onChange:e=>d(e.target.value)}),(0,F.jsxs)(`div`,{className:`oc-int__otlp-headers-actions`,children:[(0,F.jsx)(A,{size:`sm`,disabled:m||r.trim().length===0,onClick:()=>void g(),children:a()}),e?(0,F.jsx)(A,{variant:`ghost`,size:`sm`,disabled:m,onClick:()=>void n({}),children:l()}):null]}),f?(0,F.jsx)(`p`,{className:`oc-int__otlp-headers-error`,children:f}):null,(0,F.jsx)(`p`,{className:`oc-uipa__note`,children:c()})]})}export{I as IntegrationsTab};
@@ -1 +0,0 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$D as r,BA as i,CO as a,DO as o,E as s,EO as c,GA as l,HA as u,KA as ee,LA as d,N as f,OO as p,QD as m,R as h,RA as g,SO as _,TO as v,UA as te,VA as ne,WA as re,XA as ie,XD as ae,YD as oe,ZD as se,_O as ce,aO as le,ax as ue,bO as de,cO as y,dO as fe,eO as pe,fO as b,gO as x,hO as S,iO as C,kO as w,lO as T,lj as E,mO as D,n as O,nO as k,oO as A,pO as j,qA as M,rO as N,sO as P,tO as F,tj as I,uO as L,uj as R,vO as z,wO as B,xO as me,yO as he,z as ge,zA as _e}from"./dist-BjwyR-Rb.js";import{t as V}from"./button-ANIiyoGJ.js";import{C as ve,M as ye,S as H,at as U,b as be,ht as W,ot as G,p as K,w as xe,x as Se,z as Ce}from"./index-BGXPyQxx.js";import{t as we}from"./localePickerView-C2RmOS86.js";var q=t(e(),1),J=n();function Te({className:e,checked:t,onCheckedChange:n,disabled:r,...i}){return(0,J.jsx)(`button`,{type:`button`,role:`switch`,"aria-checked":t,"data-state":t?`checked`:`unchecked`,disabled:r,onClick:()=>n(!t),className:O(`peer inline-flex h-5 w-9 shrink-0 items-center rounded-full border border-transparent transition-colors outline-none`,`focus-visible:ring-2 focus-visible:ring-ring/50`,`disabled:cursor-not-allowed disabled:opacity-50`,t?`bg-primary`:`bg-input`,e),...i,children:(0,J.jsx)(`span`,{className:O(`pointer-events-none block size-4 rounded-full bg-background shadow transition-transform`,t?`translate-x-[18px]`:`translate-x-[2px]`)})})}var Y=[{id:`messages`,label:()=>w()},{id:`composer`,label:()=>p()},{id:`sidebar`,label:()=>o()},{id:`other`,label:()=>c()}],X={showSource:{category:`messages`,label:()=>v(),help:()=>B()},showReport:{category:`messages`,label:()=>a(),help:()=>_()},copyAssistant:{category:`messages`,label:()=>me()},copyUser:{category:`messages`,label:()=>de()},showDelete:{category:`messages`,label:()=>he()},showTools:{category:`messages`,label:()=>z(),help:()=>ce()},voiceInput:{category:`composer`,label:()=>x(),help:()=>S()},showUsage:{category:`composer`,label:()=>D(),help:()=>j()},autoReadAloud:{category:`composer`,label:()=>ge(),help:()=>h()},showChatAge:{category:`sidebar`,label:()=>b(),help:()=>fe()},showChatProvider:{category:`sidebar`,label:()=>L(),help:()=>T()}};function Z(e){return e.toLowerCase().normalize(`NFD`).replace(/\p{Diacritic}/gu,``)}function Ee(e,t){let n=Z(t.trim()),r=new Map(Y.map(e=>[e.id,e.label()])),i=new Map(Y.map(e=>[e.id,[]]));for(let t of e){let e=X[t],a=e?.category??`other`;n&&!Z(`${e?e.label():t} ${e?.help?e.help():``} ${t} ${r.get(a)??``}`).includes(n)||i.get(a).push(t)}return Y.map(e=>({id:e.id,label:r.get(e.id),keys:i.get(e.id)})).filter(e=>e.keys.length>0)}var De=[`showSource`,`showReport`,`copyAssistant`,`copyUser`,`showDelete`,`showTools`,`voiceInput`,`showChatAge`,`showChatProvider`,`showUsage`,`autoReadAloud`],Oe={voiceInput:`voiceInput`};function ke(e){return De.includes(e)}function Q(e){return e===`admin`}function Ae(e){return e===!0?`on`:e===!1?`off`:`inherit`}function $(e){return e===`on`?!0:e===`off`?!1:null}function je(e){return ke(e)?Oe[e]:void 0}var Me={voiceInput:()=>r()};function Ne({prefKey:e,ui:t}){let n=E(s.admin.setUiPrefDefault),r=E(s.admin.setFeatureEnabled),i=je(e),a=i?Me[e]?.():void 0;return(0,J.jsxs)(`div`,{className:`oc-prefs__gov`,children:[(0,J.jsxs)(`div`,{className:`oc-prefs__gov-row`,children:[(0,J.jsx)(`span`,{className:`oc-prefs__gov-label`,children:N()}),(0,J.jsxs)(be,{value:Ae(t.defaults[e]),onValueChange:t=>void n({key:e,value:$(t)}),children:[(0,J.jsx)(ve,{size:`sm`,className:`w-36`,children:(0,J.jsx)(xe,{})}),(0,J.jsxs)(Se,{children:[(0,J.jsx)(H,{value:`on`,children:se()}),(0,J.jsx)(H,{value:`off`,children:ae()}),(0,J.jsx)(H,{value:`inherit`,children:oe()})]})]}),i?(0,J.jsxs)(`span`,{className:`oc-prefs__gov-gate`,children:[(0,J.jsx)(K,{checked:t.featuresEnabled[i]===!0,onCheckedChange:e=>void r({key:i,enabled:e===!0}),"aria-label":k()}),k()]}):null]}),a?(0,J.jsx)(`span`,{className:`oc-prefs__gov-help`,children:a}):null]})}function Pe(){let[e,t]=(0,q.useState)(``),[n,r]=(0,q.useState)(!1),i=R(s.me.getMe,{host:W}),a=i?.ui,o=Q(i?.role)&&n,c=E(s.me.setUiPref).withOptimisticUpdate(ye),l=(0,q.useMemo)(()=>a?Ee(Object.keys(a.effective),e):[],[a,e]);return a?(0,J.jsxs)(`div`,{className:`oc-prefs-panel`,children:[Q(i?.role)?(0,J.jsxs)(`label`,{className:`oc-prefs__gov-toggle`,children:[(0,J.jsx)(K,{checked:n,onCheckedChange:e=>r(e===!0),"aria-label":C()}),C()]}):null,o?(0,J.jsxs)(`div`,{className:`oc-prefs__gov-head`,children:[(0,J.jsx)(`p`,{children:F()}),(0,J.jsx)(`p`,{children:pe()}),(0,J.jsx)(`p`,{children:m()})]}):null,(0,J.jsx)(G,{value:e,onChange:e=>t(e.target.value),placeholder:y(),"aria-label":y(),className:`mb-2`}),l.length===0?(0,J.jsx)(`div`,{className:`oc-prefs__empty`,children:P()}):(0,J.jsx)(`div`,{className:`oc-prefs`,children:l.map(e=>(0,J.jsxs)(`section`,{className:`oc-prefs__card`,children:[(0,J.jsx)(`h4`,{className:`oc-prefs__cat`,children:e.label}),e.keys.map(e=>{let t=X[e],n=t?t.label():e,r=t?.help?.(),i=a.locked[e],s=a.effective[e],l=a.userOverrides[e]!==void 0;return(0,J.jsxs)(`div`,{className:`oc-prefs__row${i?` is-locked`:``}`,children:[(0,J.jsxs)(`div`,{className:`oc-prefs__info`,children:[(0,J.jsxs)(`span`,{className:`oc-prefs__label`,children:[n,i?(0,J.jsx)(U,{variant:`outline`,children:A()}):l?(0,J.jsx)(U,{variant:`secondary`,children:f()}):null]}),r?(0,J.jsx)(`span`,{className:`oc-prefs__help`,children:r}):null]}),(0,J.jsxs)(`div`,{className:`oc-prefs__ctl`,children:[!i&&l?(0,J.jsx)(`button`,{type:`button`,className:`oc-prefs__reset`,onClick:()=>void c({key:e,value:null}),children:le()}):null,(0,J.jsx)(Te,{checked:s,disabled:i,onCheckedChange:t=>void c({key:e,value:t}),"aria-label":n})]}),o?(0,J.jsx)(Ne,{prefKey:e,ui:a}):null]},e)})]},e.id))})]}):(0,J.jsx)(`div`,{className:`oc-prefs__empty`,children:I()})}function Fe(){let e=R(s.me.getMe,{host:W}),t=E(s.me.setLocale),n=E(s.me.setMyName),r=Ce(),a=e?.locale??`default`,o=e?.name??``,[c,f]=(0,q.useState)(null),p=c??o,m=p.trim()!==o.trim();async function h(){try{await n({name:p}),f(null),r.success(te())}catch(e){r.error(u(),e)}}return(0,J.jsxs)(`div`,{className:`oc-appearance`,children:[(0,J.jsxs)(`section`,{className:`oc-show__section`,children:[(0,J.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,J.jsx)(`h2`,{className:`oc-show__title`,children:M()}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:ee()})]}),(0,J.jsxs)(`div`,{className:`oc-show__row`,children:[(0,J.jsx)(G,{className:`max-w-xs`,value:p,maxLength:120,placeholder:l(),onChange:e=>f(e.target.value),onKeyDown:e=>{e.key===`Enter`&&m&&(e.preventDefault(),h())}}),(0,J.jsx)(V,{size:`sm`,disabled:!m,onClick:()=>void h(),children:ue()})]}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:re()})]}),(0,J.jsxs)(`section`,{className:`oc-show__section`,children:[(0,J.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,J.jsx)(`h2`,{className:`oc-show__title`,children:ne()}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:i()})]}),(0,J.jsxs)(`div`,{className:`oc-show__row`,children:[we().map(e=>(0,J.jsx)(V,{variant:a===e.value?`default`:`outline`,size:`sm`,onClick:()=>void t({locale:e.value}),children:e.label},e.value)),(0,J.jsx)(V,{variant:a==="default"?`default`:`outline`,size:`sm`,onClick:()=>void t({locale:null}),children:ie()})]}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:_e()})]}),(0,J.jsxs)(`section`,{className:`oc-show__section`,children:[(0,J.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,J.jsx)(`h2`,{className:`oc-show__title`,children:g()}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:d()})]}),(0,J.jsx)(Pe,{})]})]})}export{Fe as PreferencesTab};
@@ -1,4 +0,0 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Ah as r,Bn as i,Bt as a,Ch as o,Ci as s,Dh as c,E as l,Eh as u,Hn as d,Oh as f,Rh as p,Sh as m,Si as h,Th as g,Ti as _,Un as v,Vn as ee,Vt as y,Wn as te,_h as b,bh as ne,fh as x,gh as S,hh as C,jh as w,kh as T,lj as E,mh as D,ph as re,uj as O,vh as ie,wh as k,wi as A,xh as j,xi as M,yh as N,zh as P,zn as F,zt as I}from"./dist-BjwyR-Rb.js";import{d as L,f as R,i as z,l as B,n as V,r as H,t as U,u as ae}from"./FieldLabel-BZyPIkg8.js";import{t as W}from"./button-ANIiyoGJ.js";import{C as G,S as K,b as q,ht as J,p as oe,w as Y,x as X,z as se}from"./index-BGXPyQxx.js";import{r as Z,t as ce}from"./locales-CPjguROj.js";import{t as le}from"./localePickerView-C2RmOS86.js";/* empty css */var Q=t(e(),1),$=n(),ue={media_delivery:{label:u,help:g},documentary_fetch:{label:k,help:o},inbound_files:{label:m,help:j},history_summary:{label:_,help:A},file_curation:{label:te,help:v}},de={outboundDir:`/home/node/.openclaw/media/outbound`,references:`- gdrive/1a2b3c4d5e6f7890abcd
2
- - gdrive/0f9e8d7c6b5a4321dcba`,files:`- /home/node/.openclaw/media/inbound/rapport.pdf (124800 o, application/pdf)`,previous_summary:`Projet Alpha : budget 40 000 EUR ; choix du serveur en cours.`,new_messages:`Utilisateur : Compare OVH et Scaleway.
3
- Assistant : Comparaison en cours.`,max_chars:`6000`,file_name:`MEMORY.md`,budget_chars:`20000`,feedback:`Trop de suppressions dans la section des liens, garde-les.`,content:`# Memory index
4
- - [Fait 1](fait-1.md) - note du projet`},fe={outboundDir:D,references:re,files:x,previous_summary:s,new_messages:h,max_chars:M,file_name:d,budget_chars:ee,feedback:i,content:F};function pe(){let e=O(l.admin.listInstances,{}),[t,n]=(0,Q.useState)(null);if(e===void 0)return(0,$.jsx)(`div`,{className:`oc-settings__tab-loading`,"aria-busy":`true`});if(e.length===0)return(0,$.jsx)(`div`,{className:`oc-injtab`,children:(0,$.jsx)(`p`,{className:`oc-admin__hint`,children:N()})});let i=e.find(e=>e._id===t)??e[0];return(0,$.jsxs)(`div`,{className:`oc-injtab`,children:[(0,$.jsxs)(`div`,{className:`oc-injtab__head`,children:[(0,$.jsx)(V,{label:w(),help:r()}),(0,$.jsxs)(`label`,{className:`oc-injtab__picker`,children:[(0,$.jsx)(`span`,{children:ne()}),(0,$.jsxs)(q,{value:i._id,onValueChange:e=>n(e),children:[(0,$.jsx)(G,{size:`sm`,className:`min-w-44`,children:(0,$.jsx)(Y,{})}),(0,$.jsx)(X,{children:e.map(e=>(0,$.jsx)(K,{value:e._id,children:e.displayName??e.name},e._id))})]})]})]}),(0,$.jsx)(me,{instance:i},i._id)]})}function me({instance:e}){let t=E(l.admin.upsertInstanceConfig),n=se(),r=O(l.me.getMe,{host:J}),i=e.config??{},o=Z(e.config?.contentLocale,r?.defaultLocale??void 0),[s,c]=(0,Q.useState)(()=>z(i,o));(0,Q.useEffect)(()=>{c(z(i,o))},[o,e._id]);let[u,d]=(0,Q.useState)(!1),f=s.promptInjections,m=(e,t)=>c({...s,promptInjections:{...f,[e]:{...f[e],...t}}});async function h(){d(!0);try{await t({instanceId:e._id,config:H(s,i,o)})}catch(e){n.error(p(),e)}finally{d(!1)}}async function g(r){let i={...e.config??{}};r==="default"?delete i.contentLocale:i.contentLocale=r;try{await t({instanceId:e._id,config:i})}catch(e){n.error(p(),e)}}let _=e.config?.contentLocale??`default`,v=ce[Z(void 0,r?.defaultLocale??void 0)];return(0,$.jsxs)(`div`,{className:`oc-injtab__body`,children:[(0,$.jsxs)(`div`,{className:`oc-injtab__content-locale`,children:[(0,$.jsx)(`span`,{children:y()}),(0,$.jsxs)(q,{value:_,onValueChange:e=>void g(e),children:[(0,$.jsx)(G,{size:`sm`,className:`min-w-44`,children:(0,$.jsx)(Y,{})}),(0,$.jsxs)(X,{children:[(0,$.jsx)(K,{value:`default`,children:I({locale:v})}),le().map(e=>(0,$.jsx)(K,{value:e.value,children:e.label},e.value))]})]}),(0,$.jsx)(`p`,{className:`oc-admin__hint`,children:a()})]}),ae.map(e=>(0,$.jsx)(he,{injKey:e,def:B[e],i18n:ue[e],row:f[e]??{enabled:!0,template:B[e].defaultTemplate[o]},contentLocale:o,onChange:t=>m(e,t)},e)),(0,$.jsx)(`div`,{className:`oc-injtab__actions`,children:(0,$.jsx)(W,{size:`sm`,onClick:()=>void h(),disabled:u,children:P()})})]})}function he({injKey:e,def:t,i18n:n,row:r,contentLocale:i,onChange:a}){let[o,s]=(0,Q.useState)(!1),l=r.template.trim()!==t.defaultTemplate[i],u=t.togglable&&!r.enabled,d=Object.fromEntries(t.placeholders.map(e=>[e,de[e]??`{${e}}`])),p=L(e,r,i),m=p?R(p,d):``;return(0,$.jsxs)(`section`,{className:`oc-injcard`,children:[(0,$.jsxs)(`div`,{className:`oc-injcard__head`,children:[t.togglable?(0,$.jsxs)(`label`,{className:`oc-field--row`,children:[(0,$.jsx)(oe,{checked:r.enabled,onCheckedChange:e=>a({enabled:e===!0})}),(0,$.jsx)(V,{label:n.label(),help:n.help()})]}):(0,$.jsx)(V,{label:n.label(),help:n.help()}),l&&(0,$.jsx)(`span`,{className:`oc-injection__badge`,children:f()})]}),(0,$.jsx)(`textarea`,{className:`oc-injcard__text`,value:r.template,disabled:u,rows:8,spellCheck:!1,onChange:e=>a({template:e.target.value})}),(0,$.jsxs)(`div`,{className:`oc-injection__foot`,children:[(0,$.jsxs)(`div`,{className:`oc-injcard__phs`,children:[(0,$.jsx)(`span`,{className:`oc-injection__ph`,children:c()}),t.placeholders.map(e=>(0,$.jsxs)(`span`,{className:`oc-injcard__ph-chip`,children:[(0,$.jsx)(`code`,{children:`{${e}}`}),(0,$.jsx)(U,{text:(fe[e]??(()=>e))()})]},e))]}),(0,$.jsxs)(`div`,{className:`oc-injcard__btns`,children:[(0,$.jsx)(W,{variant:`ghost`,size:`sm`,onClick:()=>s(e=>!e),children:o?b():ie()}),l&&(0,$.jsx)(W,{variant:`ghost`,size:`sm`,onClick:()=>a({template:t.defaultTemplate[i]}),children:T()})]})]}),o&&(0,$.jsx)(`div`,{className:`oc-injcard__preview`,children:m?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`pre`,{className:`oc-injcard__previewtext`,children:m}),(0,$.jsx)(`span`,{className:`oc-injection__ph`,children:S()})]}):(0,$.jsx)(`span`,{className:`oc-injection__ph`,children:C()})})]})}export{pe as PromptInjectionsTab};
@@ -1 +0,0 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$v as r,Bv as i,Cy as a,E as o,Fv as s,Hv as ee,Iv as te,Jv as c,Lv as ne,Pv as re,Qv as l,Rv as u,Sy as d,Vv as f,Xv as p,Yv as m,Zv as h,_y as g,ay as _,by as v,cy as y,dy as b,ey as x,fy as S,gy as C,hy as w,iy as ie,lj as T,ly as E,mr as D,my as O,ny as k,oy as A,py as j,ry as M,sy as N,ty as P,uj as F,uy as I,vy as L,xy as R,yy as z,zv as ae}from"./dist-BjwyR-Rb.js";import{t as B}from"./button-ANIiyoGJ.js";import{B as V,at as H,jt as U,ot as W,p as G,u as K,z as q}from"./index-BGXPyQxx.js";import{t as J}from"./roleDescriptions-MwIEr4oZ.js";var Y=t(e(),1),X=n(),Z=[{group:()=>a(),keys:[{key:`traces.read`,label:()=>L()},{key:`traces.read.content`,label:()=>g(),phi:!0},{key:`traces.write`,label:()=>C()}]},{group:()=>d(),keys:[{key:`kpi.read`,label:()=>L()},{key:`kpi.write`,label:()=>C()}]},{group:()=>R(),keys:[{key:`openclaw.query`,label:()=>w()},{key:`anomalies.read`,label:()=>O()},{key:`anomalies.report`,label:()=>j()}]},{group:()=>v(),keys:[{key:`chats.read`,label:()=>L()},{key:`selfheal`,label:()=>b()},{key:`feedback.respond`,label:()=>D()}]},{group:()=>z(),keys:[{key:`admin.manage`,label:()=>S()}]}],oe=Z.flatMap(e=>e.keys.map(e=>e.key));function Q(e){return e.includes(`*`)}var $={key:``,name:``,description:``};function se(){let e=F(o.apiKeys.listRoles,{}),t=T(o.apiKeys.createRole),n=T(o.apiKeys.ensureRolesSeeded),a=T(o.apiKeys.updateRolePermissions).withOptimisticUpdate((e,{roleId:t,permissions:n})=>{let r=e.getQuery(o.apiKeys.listRoles,{});r&&e.setQuery(o.apiKeys.listRoles,{},r.map(e=>e._id===t?{...e,permissions:n}:e))}),d=V(),g=q(),[v,b]=(0,Y.useState)(!1),[S,C]=(0,Y.useState)($),[w,D]=(0,Y.useState)(new Set);(0,Y.useEffect)(()=>{n({}).catch(e=>{g.error(E(),e)})},[n,g]);let O=e??[];async function j(e,t){if(Q(e.permissions)||w.has(e._id))return;let n=e.permissions.includes(t)?e.permissions.filter(e=>e!==t):[...e.permissions,t];if(!(e.builtin&&!await d({title:y({name:e.name}),description:N(),confirmLabel:A()}))){D(t=>new Set(t).add(e._id));try{await a({roleId:e._id,permissions:n})}catch(e){g.error(_(),e)}finally{D(t=>{let n=new Set(t);return n.delete(e._id),n})}}}async function L(){try{await t({key:S.key,name:S.name,description:S.description||void 0,permissions:[]}),C($),b(!1)}catch(e){g.error(ie(),e)}}let R=e===void 0,z=!R&&O.length===0;return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`p`,{className:`oc-admin__hint`,children:[M(),` `,(0,X.jsx)(`code`,{children:`admin`}),` `,k(),` `,(0,X.jsx)(`code`,{children:`traces.read.content`}),` `,P()]}),(0,X.jsxs)(`div`,{className:`oc-dt`,children:[(0,X.jsxs)(`div`,{className:`oc-dt__bar`,children:[(0,X.jsx)(`h2`,{className:`oc-dt__title`,children:x()}),(0,X.jsx)(`div`,{className:`oc-dt__bar-actions`,children:(0,X.jsx)(B,{size:`sm`,onClick:()=>{C($),b(!0)},children:r()})})]}),R?(0,X.jsx)(`p`,{className:`oc-admin__hint`,children:l()}):z?(0,X.jsx)(`p`,{className:`oc-admin__hint`,children:h()}):(0,X.jsx)(`div`,{className:`oc-matrix__scroll`,children:(0,X.jsxs)(`table`,{className:`oc-matrix`,children:[(0,X.jsxs)(`thead`,{children:[(0,X.jsxs)(`tr`,{children:[(0,X.jsx)(`th`,{className:`oc-matrix__corner`,rowSpan:2,children:p()}),Z.map(e=>(0,X.jsx)(`th`,{className:`oc-matrix__group`,colSpan:e.keys.length,children:e.group()},e.group()))]}),(0,X.jsx)(`tr`,{children:Z.flatMap(e=>e.keys.map(e=>(0,X.jsxs)(`th`,{className:`oc-matrix__perm`,title:e.phi?I({key:e.key}):e.key,children:[e.label(),e.phi?(0,X.jsx)(`span`,{className:`oc-matrix__phi`,children:` ⚠`}):null]},e.key)))})]}),(0,X.jsx)(`tbody`,{children:O.map(e=>{let t=Q(e.permissions),n=w.has(e._id);return(0,X.jsxs)(`tr`,{children:[(0,X.jsxs)(`th`,{className:`oc-matrix__rolecell`,children:[(0,X.jsxs)(`div`,{className:`oc-matrix__rolename`,children:[(0,X.jsx)(`span`,{children:e.name}),(0,X.jsx)(`code`,{className:`oc-matrix__rolekey`,children:e.key}),e.builtin?(0,X.jsxs)(H,{variant:`outline`,className:`gap-1`,children:[(0,X.jsx)(U,{}),` `,m()]}):(0,X.jsx)(H,{variant:`secondary`,children:c()})]}),J(e)?(0,X.jsx)(`p`,{className:`oc-matrix__roledesc`,children:J(e)}):null]}),oe.map(r=>(0,X.jsx)(`td`,{className:`oc-matrix__cell`,children:(0,X.jsx)(G,{checked:t||e.permissions.includes(r),disabled:t||n,"aria-label":`${e.key} · ${r}`,title:t?ee():n?f():r,onCheckedChange:()=>void j(e,r)})},r))]},e.key)})})]})})]}),(0,X.jsx)(K,{open:v,onOpenChange:b,title:i(),description:ae(),canSubmit:!!(S.key&&S.name),onSubmit:L,submitLabel:u(),children:(0,X.jsxs)(`div`,{className:`oc-form`,children:[(0,X.jsxs)(`label`,{className:`oc-field`,children:[(0,X.jsx)(`span`,{className:`oc-field__label`,children:ne()}),(0,X.jsx)(W,{value:S.key,placeholder:te(),onChange:e=>C({...S,key:e.target.value})})]}),(0,X.jsxs)(`label`,{className:`oc-field`,children:[(0,X.jsx)(`span`,{className:`oc-field__label`,children:s()}),(0,X.jsx)(W,{value:S.name,onChange:e=>C({...S,name:e.target.value})})]}),(0,X.jsxs)(`label`,{className:`oc-field`,children:[(0,X.jsx)(`span`,{className:`oc-field__label`,children:re()}),(0,X.jsx)(W,{value:S.description,onChange:e=>C({...S,description:e.target.value})})]})]})})]})}export{se as RolesTab};
@@ -1 +0,0 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$E as r,AD as i,AE as a,BD as ee,BE as o,CD as te,DD as ne,E as s,ED as re,FD as ie,FE as c,GD as ae,GE as l,HD as u,HE as d,ID as oe,IE as f,JD as se,JE as p,KD as ce,KE as m,LD as le,LE as h,MD as ue,ME as g,ND as de,NE as _,OD as fe,OE as pe,PD as me,PE as he,QE as ge,RD as _e,RE as v,SD as ve,TD as ye,UD as be,UE as y,VD as xe,VE as b,WD as Se,WE as x,XE as S,YE as C,ZE as w,_D as Ce,aD as we,bD as Te,cD as Ee,dD as De,eD as Oe,fD as ke,gD as Ae,hD as je,iD as Me,jD as Ne,jE as T,kD as Pe,kE as E,lD as Fe,lj as D,mD as Ie,nD as Le,oD as Re,pD as ze,qD as Be,qE as O,rD as Ve,sD as He,sj as Ue,tD as We,uD as Ge,uj as k,vD as Ke,wD as qe,xD as Je,yD as Ye,zD as Xe,zE as A}from"./dist-BjwyR-Rb.js";import{n as j}from"./dist-B1vUBlGT.js";import{i as Ze}from"./dist-C7FCY2SP.js";import{t as M}from"./button-ANIiyoGJ.js";import{A as N,B as Qe,Bt as $e,C as P,Ht as et,Lt as F,S as I,Vt as tt,at as L,b as R,ct as z,dt as B,ft as V,k as H,lt as U,ot as nt,st as rt,u as it,ut as W,w as G,x as K,z as at}from"./index-BGXPyQxx.js";import{t as ot}from"./FilterBar-5McK3w7W.js";import{t as st}from"./DataTableShell-qDyq_xxR.js";import{t as ct}from"./roleDescriptions-MwIEr4oZ.js";var q=t(e(),1),J=n(),Y=[{value:`never`,label:()=>he(),days:null},{value:`30`,label:()=>_(),days:30},{value:`90`,label:()=>g(),days:90}],X=720*60*60*1e3,Z=`__all__`,Q={name:``,roleKey:``,description:``};function $(){let e=et({from:`/settings/serviceAccounts`}),t=tt({from:`/settings/serviceAccounts`}),n=e.q??``,a=e.status??Z,[o,c]=(0,q.useState)(Z),l=e=>void t({search:t=>({...t,q:e||void 0}),replace:!0}),d=e=>void t({search:t=>({...t,status:e===Z?void 0:e})}),f=k(s.apiKeys.listServiceAccounts,{filter:{q:n||void 0,role:o===Z?void 0:o,disabled:a===Z?void 0:a===`disabled`}}),p=k(s.apiKeys.listKeys,{}),m=k(s.apiKeys.listRoles,{}),h=D(s.apiKeys.createServiceAccount),g=D(s.apiKeys.updateServiceAccount),_=D(s.apiKeys.deleteServiceAccount),pe=Ue(s.apiKeys.mintApiKey),he=D(s.apiKeys.revokeApiKey),v=Qe(),y=at(),b=n!==``||o!==Z||a!==Z;function x(){c(Z),t({search:{},replace:!0})}let[S,C]=(0,q.useState)(!1),[w,T]=(0,q.useState)(Q),[E,O]=(0,q.useState)(null),[A,j]=(0,q.useState)(new Set),[N,F]=(0,q.useState)(null),z=(0,q.useRef)(!1),[B,V]=(0,q.useState)(new Set),[H,U]=(0,q.useState)({}),[rt,W]=(0,q.useState)(null),X=(0,q.useMemo)(()=>{let e=new Map;for(let t of p??[]){let n=e.get(t.serviceAccountId)??[];n.push(t),e.set(t.serviceAccountId,n)}return e},[p]);function $(e){j(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})}async function dt(){try{E?(await g({serviceAccountId:E,name:w.name,roleKey:w.roleKey,description:w.description}),y.success(ke())):await h({name:w.name,roleKey:w.roleKey,description:w.description||void 0}),T(Q),O(null),C(!1)}catch(e){y.error(E?ze():Ie(),e)}}function ft(e){T({name:e.name,roleKey:e.roleKey,description:e.description??``}),O(e._id),C(!0)}async function pt(e){if(z.current)return;z.current=!0;let t=H[e._id]??`never`,n=Y.find(e=>e.value===t)?.days??null,r=n?Date.now()+n*24*60*60*1e3:void 0;F(e._id);try{let t=await pe({serviceAccountId:e._id,expiresAt:r});W({accountName:e.name,plaintext:t.plaintext,prefix:t.prefix,lastFour:t.lastFour})}catch(e){y.error(De(),e)}finally{z.current=!1,F(null)}}async function mt(e){if(await v({title:Ge(),description:(0,J.jsxs)(J.Fragment,{children:[Fe(),` `,(0,J.jsx)(`span`,{className:`font-mono`,children:e.name}),` `,Ee(),` `,(0,J.jsx)(`strong`,{children:He()}),` `,Re()]}),confirmWord:e.name,confirmLabel:we(),destructive:!0}))try{await _({serviceAccountId:e._id}),y.success(Me(),e.name)}catch(e){y.error(Ve(),e)}}async function ht(e){if(await v({title:Le(),description:(0,J.jsxs)(J.Fragment,{children:[We(),` `,(0,J.jsxs)(`span`,{className:`font-mono`,children:[e.prefix,`…`,e.lastFour]}),` `,Oe()]}),confirmLabel:r(),destructive:!0})&&!B.has(e._id)){V(t=>new Set(t).add(e._id));try{await he({keyId:e._id})}catch(e){y.error(ge(),e)}finally{V(t=>{let n=new Set(t);return n.delete(e._id),n})}}}return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(`p`,{className:`oc-admin__hint`,children:se()}),(0,J.jsxs)(ot,{q:n,onQChange:l,searchPlaceholder:Be(),onReset:x,canReset:b,children:[(0,J.jsxs)(R,{value:o,onValueChange:c,children:[(0,J.jsx)(P,{size:`sm`,className:`w-40`,children:(0,J.jsx)(G,{placeholder:ce()})}),(0,J.jsxs)(K,{children:[(0,J.jsx)(I,{value:Z,children:ae()}),(m??[]).map(e=>(0,J.jsx)(I,{value:e.key,children:e.key},e._id))]})]}),(0,J.jsxs)(R,{value:a,onValueChange:d,children:[(0,J.jsx)(P,{size:`sm`,className:`w-36`,children:(0,J.jsx)(G,{})}),(0,J.jsxs)(K,{children:[(0,J.jsx)(I,{value:Z,children:Se()}),(0,J.jsx)(I,{value:`active`,children:be()}),(0,J.jsx)(I,{value:`disabled`,children:u()})]})]})]}),(0,J.jsx)(st,{title:xe(),rows:f,addLabel:ee(),onAdd:()=>{T(Q),O(null),C(!0)},emptyHint:Xe(),isExpanded:e=>A.has(e._id),renderExpanded:e=>(0,J.jsx)(lt,{account:e,keys:X.get(e._id)??[],onRevoke:ht,revoking:B}),rowActions:e=>[{label:ie(),onSelect:()=>ft(e)},{label:_e(),onSelect:()=>void pt(e)},{label:A.has(e._id)?le():oe(),onSelect:()=>$(e._id)},{label:me(),variant:`destructive`,onSelect:()=>void mt(e)}],columns:[{header:``,className:`w-8`,cell:e=>(0,J.jsx)(M,{variant:`ghost`,size:`icon-sm`,"aria-label":A.has(e._id)?de():ue(),onClick:()=>$(e._id),children:A.has(e._id)?(0,J.jsx)(Ze,{}):(0,J.jsx)($e,{})})},{header:Ne(),sort:e=>e.name,cell:e=>(0,J.jsxs)(`div`,{className:`flex flex-col`,children:[(0,J.jsx)(`span`,{children:e.name}),e.description?(0,J.jsx)(`span`,{className:`text-muted-foreground text-xs`,children:e.description}):null]})},{header:i(),sort:e=>e.roleKey,cell:e=>(0,J.jsx)(L,{variant:`secondary`,children:e.roleKey})},{header:Pe(),sort:e=>+!!e.disabled,cell:e=>e.disabled?(0,J.jsx)(L,{variant:`destructive`,children:u()}):(0,J.jsx)(L,{variant:`outline`,children:be()})},{header:fe(),cell:e=>(0,J.jsxs)(R,{value:H[e._id]??`never`,onValueChange:t=>U(n=>({...n,[e._id]:t})),children:[(0,J.jsx)(P,{size:`sm`,className:`w-32`,children:(0,J.jsx)(G,{})}),(0,J.jsx)(K,{children:Y.map(e=>(0,J.jsx)(I,{value:e.value,children:e.label()},e.value))})]})},{header:ne(),sort:e=>(X.get(e._id)??[]).filter(e=>!e.disabled).length,cell:e=>{let t=(X.get(e._id)??[]).filter(e=>!e.disabled).length;return(0,J.jsx)(`span`,{className:`oc-sa__keycount`,children:N===e._id?re():ye({count:t})})}}]}),(0,J.jsx)(it,{open:S,onOpenChange:e=>{C(e),e||O(null)},title:E?qe():Je(),description:E?te():Te(),canSubmit:!!(w.name&&w.roleKey),onSubmit:dt,submitLabel:E?ve():Ye(),children:(0,J.jsxs)(`div`,{className:`oc-form`,children:[(0,J.jsxs)(`label`,{className:`oc-field`,children:[(0,J.jsx)(`span`,{className:`oc-field__label`,children:Ke()}),(0,J.jsx)(nt,{value:w.name,onChange:e=>T({...w,name:e.target.value})})]}),(0,J.jsxs)(`label`,{className:`oc-field`,children:[(0,J.jsx)(`span`,{className:`oc-field__label`,children:Ce()}),(0,J.jsxs)(R,{value:w.roleKey||void 0,onValueChange:e=>T({...w,roleKey:e}),children:[(0,J.jsx)(P,{className:`w-full`,children:(0,J.jsx)(G,{placeholder:Ae()})}),(0,J.jsx)(K,{children:(m??[]).map(e=>(0,J.jsxs)(I,{value:e.key,children:[e.name,` (`,e.key,`)`]},e._id))})]}),(()=>{let e=(m??[]).find(e=>e.key===w.roleKey),t=e?ct(e):null;return t?(0,J.jsx)(`span`,{className:`text-muted-foreground text-xs`,children:t}):null})()]}),(0,J.jsxs)(`label`,{className:`oc-field`,children:[(0,J.jsx)(`span`,{className:`oc-field__label`,children:je()}),(0,J.jsx)(nt,{value:w.description,onChange:e=>T({...w,description:e.target.value})})]})]})}),(0,J.jsx)(ut,{minted:rt,onClose:()=>W(null)})]})}function lt({account:e,keys:t,onRevoke:n,revoking:r}){return(0,J.jsxs)(`div`,{className:`oc-sa__keys`,children:[(0,J.jsxs)(`div`,{className:`oc-sa__keys-head`,children:[w(),` `,(0,J.jsx)(`span`,{className:`font-medium`,children:e.name})]}),t.length===0?(0,J.jsx)(`p`,{className:`oc-admin__hint`,children:S()}):(0,J.jsxs)(`table`,{className:`oc-sa__keytable`,children:[(0,J.jsx)(`thead`,{children:(0,J.jsxs)(`tr`,{children:[(0,J.jsx)(`th`,{children:C()}),(0,J.jsx)(`th`,{children:p()}),(0,J.jsx)(`th`,{children:O()}),(0,J.jsx)(`th`,{children:m()}),(0,J.jsx)(`th`,{children:l()}),(0,J.jsx)(`th`,{children:x()}),(0,J.jsx)(`th`,{})]})}),(0,J.jsx)(`tbody`,{children:t.map(t=>(0,J.jsxs)(`tr`,{children:[(0,J.jsx)(`td`,{children:(0,J.jsxs)(`code`,{className:`oc-sa__keyid`,children:[t.prefix,`…`,t.lastFour]})}),(0,J.jsx)(`td`,{children:(0,J.jsx)(L,{variant:`secondary`,children:e.roleKey})}),(0,J.jsx)(`td`,{children:N(t.createdAt)}),(0,J.jsx)(`td`,{className:dt(t.lastUsedAt)?`oc-sa__stale`:``,children:ft(t.lastUsedAt)}),(0,J.jsx)(`td`,{children:pt(t.expiresAt)}),(0,J.jsx)(`td`,{children:mt(t)}),(0,J.jsx)(`td`,{className:`text-right`,children:t.disabled?null:(0,J.jsx)(M,{variant:`destructive`,size:`sm`,disabled:r.has(t._id),onClick:()=>n(t),children:r.has(t._id)?y():d()})})]},t._id))})]})]})}function ut({minted:e,onClose:t}){let[n,r]=(0,q.useState)(!1);async function i(){if(e)try{await navigator.clipboard.writeText(e.plaintext),r(!0),window.setTimeout(()=>r(!1),2e3)}catch{}}return(0,J.jsx)(rt,{open:e!==null,onOpenChange:e=>{e||(r(!1),t())},children:e?(0,J.jsxs)(z,{className:`max-w-lg`,showCloseButton:!1,onInteractOutside:e=>e.preventDefault(),onEscapeKeyDown:e=>e.preventDefault(),children:[(0,J.jsxs)(B,{children:[(0,J.jsx)(V,{children:b()}),(0,J.jsx)(U,{children:o({name:e.accountName})})]}),(0,J.jsx)(`div`,{className:`oc-sa__minted-warning`,children:A()}),(0,J.jsxs)(`div`,{className:`oc-sa__minted-box`,children:[(0,J.jsx)(`code`,{className:`oc-sa__minted-plain`,children:e.plaintext}),(0,J.jsxs)(M,{variant:`outline`,size:`sm`,onClick:()=>void i(),"aria-label":v(),children:[n?(0,J.jsx)(j,{}):(0,J.jsx)(F,{}),n?h():f()]})]}),(0,J.jsx)(W,{children:(0,J.jsx)(M,{onClick:()=>{r(!1),t()},children:c()})})]}):null})}function dt(e){return e===null?!1:Date.now()-e>X}function ft(e){return e===null?T():N(e)}function pt(e){return e===null?`—`:H(e)}function mt(e){return e.disabled?(0,J.jsx)(L,{variant:`destructive`,children:a()}):e.expiresAt!==null&&e.expiresAt<Date.now()?(0,J.jsx)(L,{variant:`outline`,children:E()}):(0,J.jsx)(L,{variant:`outline`,children:pe()})}export{$ as ServiceAccountsTab};
@@ -1 +0,0 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$i as r,Ai as i,Bi as a,E as o,Fi as s,Gi as c,Hi as l,Ii as u,Ji as d,Ki as f,Li as p,Mi as m,Ni as h,Pi as g,Qi as _,Ri as v,Ui as y,Vi as b,Wi as x,Xi as S,Yi as C,Zi as w,aa as T,ca as E,da as D,ea as O,fa as k,ia as A,ji as j,la as M,lj as N,ma as P,na as F,oa as I,pa as L,qi as ee,ra as R,sa as z,ta as B,ua as V,uj as H,zi as U}from"./dist-BjwyR-Rb.js";import{t as W}from"./button-ANIiyoGJ.js";import{A as G,B as K}from"./index-BGXPyQxx.js";import{t as q}from"./DataTableShell-qDyq_xxR.js";var J=t(e(),1),Y=n(),X={hung:()=>w(),wrong_result:()=>S(),error:()=>C(),other:()=>d()},Z=e=>(e&&X[e]?.())??e??`—`;function Q(e){let t=e.slice(e.lastIndexOf(`:`)+1)||e;return t.length>12?`${t.slice(0,12)}…`:t}function $({data:e}){let t=e.snapshot,n=N(o.subAgentReports.respondToReport),[r,i]=(0,J.useState)(e.thread),[d,m]=(0,J.useState)(``),[_,S]=(0,J.useState)(!1);async function C(){let t=d.trim();if(!(!t||_)){S(!0);try{await n({reportId:e._id,text:t}),i(e=>[...e,{authorRole:`admin`,text:t,at:Date.now()}]),m(``)}finally{S(!1)}}}return(0,Y.jsxs)(`div`,{className:`oc-fbadmin__detail`,children:[(0,Y.jsx)(`div`,{className:`oc-fbadmin__row`,children:(0,Y.jsxs)(`span`,{className:`oc-fbadmin__meta`,children:[Z(e.category),` · `,ee({failed:t.failedCount,total:t.totalCount}),t.openclawModel?` · ${t.openclawModel}`:``,t.openclawRuntime?` (${t.openclawRuntime})`:``]})}),e.comment?(0,Y.jsxs)(`section`,{children:[(0,Y.jsx)(`h4`,{className:`oc-fbadmin__h`,children:f()}),(0,Y.jsx)(`p`,{className:`oc-fbadmin__comment`,children:e.comment})]}):null,(0,Y.jsxs)(`section`,{children:[(0,Y.jsx)(`h4`,{className:`oc-fbadmin__h`,children:c()}),r.length>0?(0,Y.jsx)(`div`,{className:`oc-fbadmin__thread`,children:r.map((e,t)=>(0,Y.jsxs)(`div`,{className:`oc-notif__msg oc-notif__msg--${e.authorRole}`,children:[(0,Y.jsx)(`span`,{className:`oc-notif__msg-who`,children:e.authorRole===`admin`?x():y()}),(0,Y.jsx)(`span`,{className:`oc-notif__msg-text`,children:e.text})]},t))}):(0,Y.jsx)(`p`,{className:`oc-fbadmin__meta`,children:l()}),(0,Y.jsx)(`textarea`,{className:`oc-feedback__textarea`,placeholder:b(),value:d,maxLength:2e3,rows:3,onChange:e=>m(e.target.value.slice(0,2e3))}),(0,Y.jsx)(`div`,{className:`oc-fbadmin__row`,style:{justifyContent:`flex-end`},children:(0,Y.jsx)(W,{size:`sm`,onClick:()=>void C(),disabled:!d.trim()||_,children:_?U():a()})})]}),(0,Y.jsxs)(`section`,{children:[(0,Y.jsxs)(`h4`,{className:`oc-fbadmin__h`,children:[v({count:t.children.length}),t.childrenTruncated?` ${p()}`:``,t.textTruncated?` ${u()}`:``]}),(0,Y.jsx)(`div`,{className:`oc-fbadmin__ctx`,children:t.children.map((e,n)=>(0,Y.jsxs)(`div`,{className:`oc-fbadmin__ctx-turn`,children:[(0,Y.jsxs)(`span`,{className:`oc-fbadmin__ctx-role`,children:[(e.taskName?.trim()||Q(e.childSessionKey))+` · ${e.status}`,e.phase?` · ${e.phase}`:``,e.childSessionKey===t.flaggedChildSessionKey?` · ${s()}`:``]}),e.errorMessage?(0,Y.jsx)(`pre`,{className:`oc-msg__source-pre`,children:e.errorMessage}):null,e.resultText?(0,Y.jsx)(`pre`,{className:`oc-msg__source-pre`,children:e.resultText}):null]},n))})]}),t.parentText?(0,Y.jsxs)(`section`,{children:[(0,Y.jsx)(`h4`,{className:`oc-fbadmin__h`,children:g()}),(0,Y.jsx)(`pre`,{className:`oc-msg__source-pre`,children:t.parentText})]}):null,(0,Y.jsxs)(`section`,{children:[(0,Y.jsx)(`h4`,{className:`oc-fbadmin__h`,children:h()}),(0,Y.jsx)(`p`,{className:`oc-fbadmin__env`,children:[t.parentStatus?`status: ${t.parentStatus}`:null,t.parentErrorCode?`code: ${t.parentErrorCode}`:null,t.parentRunId?`run ${t.parentRunId.slice(0,12)}…`:null,e.correlationId?`corr ${e.correlationId.slice(0,16)}…`:null,t.openclawProvider].filter(Boolean).join(` · `)||`—`})]})]})}function te(){let e=H(o.subAgentReports.listForAdmin,{}),t=N(o.subAgentReports.readReport),n=N(o.subAgentReports.deleteReport),a=K(),[s,c]=(0,J.useState)(null),[l,u]=(0,J.useState)({});async function d(e){if(s===e._id){c(null);return}if(!l[e._id]){let n=await t({reportId:e._id});u(t=>({...t,[e._id]:n}))}c(e._id)}async function f(e){await a({title:m(),description:j(),confirmLabel:i(),destructive:!0})&&(await n({reportId:e._id}),s===e._id&&c(null))}return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(`p`,{className:`oc-admin__hint`,children:[k(),` `,(0,Y.jsx)(`strong`,{children:D()}),` `,V()]}),(0,Y.jsx)(q,{title:P(),rows:e,emptyHint:L(),isExpanded:e=>s===e._id&&!!l[e._id],renderExpanded:e=>l[e._id]?(0,Y.jsx)($,{data:l[e._id]}):null,columns:[{header:M(),cell:e=>G(e.at),sort:e=>e.at},{header:E(),cell:e=>Z(e.category),sort:e=>Z(e.category)},{header:z(),cell:e=>`${e.failedCount}/${e.totalCount}`,sort:e=>e.failedCount},{header:I(),cell:e=>(e.reporterEmail||e.reporterName||`—`)+(e.impersonated&&e.realOperatorEmail?` ${R({operator:e.realOperatorEmail})}`:``),sort:e=>e.reporterEmail||e.reporterName||null},{header:T(),cell:e=>e.hasComment?`✎`:`—`,sort:e=>+!!e.hasComment},{header:A(),cell:e=>e.answered?(0,Y.jsx)(`span`,{className:`oc-fbadmin__pill is-ok`,children:F()}):(0,Y.jsx)(`span`,{className:`oc-fbadmin__pill`,children:B()}),sort:e=>+!!e.answered}],rowActions:e=>[{label:s===e._id?r():O(),onSelect:()=>void d(e)},{label:_(),onSelect:()=>void f(e),variant:`destructive`}]})]})}export{te as SubAgentReportsTab};
@@ -1 +0,0 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$A as r,$O as i,AO as a,Ak as o,BO as s,Bk as c,Ck as l,D as u,Di as d,Dk as f,E as p,Ei as m,Ek as h,FO as g,Fk as _,GO as v,Gk as y,HO as ee,Hk as b,IO as x,Ik as te,JO as ne,Jk as re,KO as ie,Kk as ae,LO as oe,Lk as se,MO as ce,Mk as le,NO as ue,Nk as de,Oi as fe,Ok as pe,PO as me,Pk as he,QA as ge,QO as _e,Qk as ve,RO as S,Rk as ye,Sk as be,Tk as xe,UO as Se,Uk as Ce,VO as we,Vk as Te,WO as Ee,Wk as De,XO as C,Xk as Oe,YO as ke,Yk as Ae,ZA as je,ZO as Me,Zk as Ne,_k as Pe,ak as Fe,bk as Ie,ck as Le,dk as Re,ek as ze,fk as Be,gk as Ve,hk as w,ik as He,jO as Ue,jk as We,ki as T,kk as Ge,lj as E,lk as Ke,mk as qe,n as Je,nk as Ye,ok as Xe,pk as Ze,qO as Qe,qk as $e,rk as et,sj as tt,sk as nt,tk as rt,uj as D,uk as it,vk as at,wk as ot,xk as st,yk as ct,zO as lt,zk as ut}from"./dist-BjwyR-Rb.js";import{n as O}from"./dist-B1vUBlGT.js";import{t as k}from"./x-y131Bn-k.js";import{t as A}from"./button-ANIiyoGJ.js";import{$ as dt,C as j,Ft as M,It as ft,S as N,at as P,b as F,et as pt,ht as I,it as mt,mt as ht,nt as gt,ot as L,p as R,pt as _t,rt as z,tt as B,w as V,x as H}from"./index-BGXPyQxx.js";import{t as vt}from"./localePickerView-C2RmOS86.js";import{a as yt,i as bt,n as xt,o as St,r as Ct,t as wt}from"./card-DBM3tlH1.js";import{a as Tt,i as U,n as Et,o as W,r as G,t as Dt}from"./table-CMG1KRZm.js";import{t as Ot}from"./TimeRangePicker-BSn6eVzh.js";import{t as kt}from"./FilterBar-5McK3w7W.js";import{t as At}from"./AdvancedFilter--hO9zyz3.js";var K=u(`upload`,[[`path`,{d:`M12 3v12`,key:`1x0j5s`}],[`path`,{d:`m17 8-5-5-5 5`,key:`7q97r8`}],[`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`,key:`ih7n3h`}]]),q=t(e(),1),jt=.1,Mt=[248,248,248],Nt=[24,24,24];function Pt(e,t,n){let r=t,i=n,a=-1,o=-1;for(let s=0;s<n;s++)for(let n=0;n<t;n++)e[(s*t+n)*4+3]>8&&(n<r&&(r=n),n>a&&(a=n),s<i&&(i=s),s>o&&(o=s));return a<0?null:{x:r,y:i,width:a-r+1,height:o-i+1}}function Ft(e,t,n){let r=t*n;if(r===0)return 0;let i=0;for(let t=3;t<e.length;t+=4)e[t]<=8&&i++;return i/r}function J(e,t,n){return Ft(e,t,n)>=jt}function It(e,t){for(let n=0;n<e.length;n+=4)e[n]=t[0],e[n+1]=t[1],e[n+2]=t[2]}function Lt(e){for(let t=0;t<e.length;t+=4)e[t]=255-e[t],e[t+1]=255-e[t+1],e[t+2]=255-e[t+2]}var Rt=12*1024*1024,zt=480,Bt=160,Vt=.92;async function Ht(e,t={}){if(!e.type.startsWith(`image/`))throw Error(i());if(e.size>Rt)throw Error(_e());let{source:n,width:r,height:a,cleanup:o}=await Ut(e);try{let i=e.type===`image/svg+xml`,o=Math.min(zt/r,Bt/a,i?1/0:1),s=Math.max(1,Math.round(r*o)),c=Math.max(1,Math.round(a*o)),l=document.createElement(`canvas`);l.width=s,l.height=c;let u=l.getContext(`2d`);if(!u)throw Error(C());u.imageSmoothingEnabled=!0,u.imageSmoothingQuality=`high`,u.drawImage(n,0,0,s,c);let d=Pt(u.getImageData(0,0,s,c).data,s,c)??{x:0,y:0,width:s,height:c},f=document.createElement(`canvas`);f.width=d.width,f.height=d.height;let p=f.getContext(`2d`);if(!p)throw Error(C());if(p.drawImage(l,d.x,d.y,d.width,d.height,0,0,d.width,d.height),t.variantFor){let e=p.getImageData(0,0,d.width,d.height);J(e.data,d.width,d.height)?It(e.data,t.variantFor===`dark`?Mt:Nt):Lt(e.data),p.putImageData(e,0,0)}let m=J(p.getImageData(0,0,d.width,d.height).data,d.width,d.height),h=await X(f,`image/webp`,Vt)??await X(f,`image/png`);if(!h)throw Error(ke());return{blob:h,hasAlpha:m}}finally{o()}}async function Ut(e){if(e.type===`image/svg+xml`)return Y(e);if(typeof createImageBitmap==`function`)try{let t=await createImageBitmap(e);return{source:t,width:t.width,height:t.height,cleanup:()=>t.close()}}catch{}return Y(e)}async function Y(e){let t=URL.createObjectURL(e);try{let e=new Image;return e.decoding=`async`,await new Promise((n,r)=>{e.onload=()=>n(),e.onerror=()=>r(Error(Me())),e.src=t}),{source:e,width:e.naturalWidth||300,height:e.naturalHeight||150,cleanup:()=>URL.revokeObjectURL(t)}}catch(e){throw URL.revokeObjectURL(t),e}}function X(e,t,n){return new Promise(r=>e.toBlob(e=>r(e),t,n))}var Z=n();function Wt(e,t){let n=e.trim().replace(/[^A-Za-z0-9_.-]+/g,`-`).replace(/^-+|-+$/g,``)||`chart`,r=new Blob([JSON.stringify(t,null,2)],{type:`application/json`}),i=URL.createObjectURL(r),a=document.createElement(`a`);a.href=i,a.download=`${n}.chart.json`,document.body.appendChild(a),a.click(),a.remove(),URL.revokeObjectURL(i)}var Q=`__all__`,Gt={kind:`relative`,from:`now-24h`,to:`now`},Kt=[{value:`status`,label:`Statut`},{value:`latencyMs`,label:`Latence (ms)`},{value:`route`,label:`Route`},{value:`roleKey`,label:`Rôle`},{value:`correlationId`,label:`Corrélation`}];function $({title:e,description:t,children:n}){return(0,Z.jsxs)(`section`,{className:`oc-show__section`,children:[(0,Z.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,Z.jsx)(`h2`,{className:`oc-show__title`,children:e}),t?(0,Z.jsx)(`p`,{className:`oc-show__desc`,children:t}):null]}),(0,Z.jsx)(`div`,{className:`oc-show__demo`,children:n})]})}function qt(e){return e===`light`?r():e===`dark`?ge():je()}var Jt=[`primary`,`secondary`,`accent`,`muted`,`chart-1`,`chart-2`];function Yt({tokens:e,mode:t}){let n=e.colors[t];return(0,Z.jsx)(`div`,{className:`oc-chart-swatches`,"aria-hidden":!0,children:Jt.map(e=>{let t=n[e];return(0,Z.jsx)(`span`,{className:`oc-chart-swatch`,style:t?{background:t}:void 0},e)})})}function Xt({selected:e,title:t,subtitle:n,tokens:r,mode:i,onSelect:a,onExport:o}){return(0,Z.jsxs)(`div`,{className:`oc-chart-card-wrap`,children:[(0,Z.jsxs)(`button`,{type:`button`,className:Je(`oc-chart-card`,e&&`oc-chart-card--selected`),"aria-pressed":e,onClick:a,children:[(0,Z.jsxs)(`div`,{className:`oc-chart-card__head`,children:[(0,Z.jsx)(`span`,{className:`oc-chart-card__title`,children:t}),e?(0,Z.jsx)(O,{className:`size-4 text-primary`,"aria-hidden":!0}):null]}),r?(0,Z.jsx)(Yt,{tokens:r,mode:i}):(0,Z.jsx)(`div`,{className:`oc-chart-swatches oc-chart-swatches--native`,"aria-hidden":!0}),(0,Z.jsx)(`div`,{className:`oc-chart-card__meta`,children:(0,Z.jsx)(`span`,{className:`oc-chart-card__subtitle`,children:n})})]}),o?(0,Z.jsx)(A,{type:`button`,variant:`ghost`,size:`icon`,className:`oc-chart-card__export`,onClick:o,"aria-label":T(),title:T(),children:(0,Z.jsx)(ft,{className:`size-4`})}):null]})}function Zt({selectedKey:e,resolvedMode:t}){let n=D(p.charts.listMyCharts),r=E(p.charts.setMyChart);async function i(e){try{await r({name:e})}catch{}}return(0,Z.jsxs)(`section`,{className:`oc-show__section`,children:[(0,Z.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,Z.jsx)(`h2`,{className:`oc-show__title`,children:De()}),(0,Z.jsx)(`p`,{className:`oc-show__desc`,children:Ce()})]}),(0,Z.jsxs)(`div`,{className:`oc-chart-grid`,children:[(0,Z.jsx)(Xt,{selected:e===null,title:b(),subtitle:Te(),tokens:null,mode:t,onSelect:()=>void i(null)}),(n??[]).map(n=>{let r=n.via===`common`?c():n.via===`owner`?ut():ye({group:n.via.group});return(0,Z.jsx)(Xt,{selected:e===n.key,title:n.name,subtitle:r,tokens:n.tokens,mode:t,onSelect:()=>void i(n.key),onExport:()=>Wt(n.name,n.tokens)},n.key)})]}),n!==void 0&&n.length===0?(0,Z.jsx)(`p`,{className:`oc-show__desc`,children:se()}):null]})}function Qt(){let e=E(p.charts.importChart),[t,n]=(0,q.useState)(``),[r,i]=(0,q.useState)(``),[a,o]=(0,q.useState)(null),[s,c]=(0,q.useState)(!1),[u,d]=(0,q.useState)(!1);async function f(e){let t=e.target.files?.[0];if(e.target.value=``,t){o(null),c(!1);try{i(await t.text())}catch{o(w())}}}async function m(){if(o(null),c(!1),t.trim()===``){o(Ze());return}let a;try{a=JSON.parse(r)}catch{o(w());return}d(!0);try{await e({name:t.trim(),tokens:a}),c(!0),n(``),i(``)}catch(e){o(e instanceof Error?e.message:String(e))}finally{d(!1)}}return(0,Z.jsxs)(`section`,{className:`oc-show__section`,children:[(0,Z.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,Z.jsx)(`h2`,{className:`oc-show__title`,children:l()}),(0,Z.jsx)(`p`,{className:`oc-show__desc`,children:be()})]}),(0,Z.jsxs)(`div`,{className:`oc-chart-import`,children:[(0,Z.jsxs)(`label`,{className:`oc-chart-import__field`,children:[(0,Z.jsx)(`span`,{className:`oc-chart-import__label`,children:st()}),(0,Z.jsx)(L,{value:t,onChange:e=>n(e.target.value),placeholder:Ie(),maxLength:60})]}),(0,Z.jsxs)(`label`,{className:`oc-chart-import__field`,children:[(0,Z.jsx)(`span`,{className:`oc-chart-import__label`,children:ct()}),(0,Z.jsx)(`textarea`,{className:`oc-chart-import__textarea`,value:r,onChange:e=>i(e.target.value),placeholder:at(),rows:8,spellCheck:!1})]}),(0,Z.jsxs)(`div`,{className:`oc-show__row`,children:[(0,Z.jsx)(A,{variant:`outline`,size:`sm`,asChild:!0,children:(0,Z.jsxs)(`label`,{className:`oc-chart-import__file`,children:[(0,Z.jsx)(K,{className:`size-4`}),Pe(),(0,Z.jsx)(`input`,{type:`file`,accept:`application/json,.json`,className:`oc-chart-import__file-input`,onChange:e=>void f(e)})]})}),(0,Z.jsx)(A,{size:`sm`,disabled:u,onClick:()=>void m(),children:Ve()})]}),a?(0,Z.jsx)(`p`,{className:`oc-chart-import__error`,children:a}):null,s?(0,Z.jsx)(`p`,{className:`oc-chart-import__ok`,children:qe()}):null]})]})}function $t({chart:e}){let t=tt(p.charts.setChartLogo),n=E(p.charts.removeChartLogo),[r,i]=(0,q.useState)(!1),[a,o]=(0,q.useState)(null),s=t=>t===`light`?e.logoLightUrl:e.logoDarkUrl;async function c(n,r,a){if(e.chartId!==void 0){o(null),i(!0);try{let{blob:i,hasAlpha:o}=await Ht(r,a?{variantFor:a}:{}),s=await i.arrayBuffer();await t({chartId:e.chartId,bytes:s,mode:n,hasAlpha:o})}catch(e){o(e instanceof Error?e.message:String(e))}finally{i(!1)}}}async function l(e,t){let n=t.target.files?.[0];t.target.value=``,n&&await c(e,n)}async function u(t){if(e.chartId!==void 0){o(null),i(!0);try{await n({chartId:e.chartId,mode:t})}catch(e){o(e instanceof Error?e.message:String(e))}finally{i(!1)}}}async function d(e){let t=s(e===`light`?`dark`:`light`);if(t){o(null),i(!0);try{await c(e,await(await fetch(t)).blob(),e)}catch(e){o(e instanceof Error?e.message:String(e))}finally{i(!1)}}}function f({mode:e}){let t=s(e),n=s(e===`light`?`dark`:`light`);return(0,Z.jsxs)(`div`,{className:`oc-chart-mine__logo-slot`,children:[(0,Z.jsx)(`span`,{className:`oc-chart-mine__logo-mode`,children:e===`light`?Xe():Fe()}),(0,Z.jsx)(`span`,{className:`oc-chart-mine__logo-preview`,"data-mode":e,"data-empty":t?void 0:`1`,children:t?(0,Z.jsx)(`img`,{src:t,alt:``}):null}),(0,Z.jsx)(A,{variant:`outline`,size:`sm`,asChild:!0,children:(0,Z.jsxs)(`label`,{className:`oc-chart-import__file`,children:[(0,Z.jsx)(K,{className:`size-4`}),t?et():He(),(0,Z.jsx)(`input`,{type:`file`,accept:`image/*`,className:`oc-chart-import__file-input`,onChange:t=>void l(e,t)})]})}),!t&&n?(0,Z.jsx)(A,{variant:`ghost`,size:`sm`,disabled:r,onClick:()=>void d(e),children:rt()}):null,t?(0,Z.jsx)(A,{variant:`ghost`,size:`sm`,disabled:r,onClick:()=>void u(e),children:Ye()}):null]})}return(0,Z.jsxs)(`div`,{className:`oc-chart-mine__logo`,children:[(0,Z.jsx)(`span`,{className:`oc-chart-mine__groups-label`,children:nt()}),(0,Z.jsxs)(`div`,{className:`oc-chart-mine__logo-slots`,children:[(0,Z.jsx)(f,{mode:`light`}),(0,Z.jsx)(f,{mode:`dark`})]}),r?(0,Z.jsx)(`span`,{className:`oc-show__desc`,children:ze()}):null,a?(0,Z.jsx)(`p`,{className:`oc-chart-import__error`,children:a}):null]})}function en({chart:e}){let t=D(p.me.getMe,{host:I}),n=E(p.charts.addChartDomain),r=E(p.charts.removeChartDomain),[i,a]=(0,q.useState)(``),[o,s]=(0,q.useState)(null),[c,l]=(0,q.useState)(!1);if(t?.role!==`admin`)return null;let u=e.domains??[];async function d(){let t=i.trim();if(t!==``){s(null),l(!0);try{await n({chartKey:e.key,domain:t}),a(``)}catch(e){s(e instanceof Error?e.message:String(e))}finally{l(!1)}}}async function f(t){s(null);try{await r({chartKey:e.key,domain:t})}catch{}}return(0,Z.jsxs)(`div`,{className:`oc-chart-mine__domains`,children:[(0,Z.jsx)(`span`,{className:`oc-chart-mine__groups-label`,children:ne()}),(0,Z.jsxs)(`div`,{className:`oc-chart-mine__domains-body`,children:[(0,Z.jsx)(`div`,{className:`oc-chart-avail__groups`,children:u.length===0?(0,Z.jsx)(`span`,{className:`oc-show__desc`,children:Ee()}):u.map(e=>(0,Z.jsxs)(P,{variant:`secondary`,className:`oc-chart-avail__chip`,children:[e,(0,Z.jsx)(`button`,{type:`button`,className:`oc-chart-avail__chip-x`,"aria-label":Se({domain:e}),onClick:()=>void f(e),children:(0,Z.jsx)(k,{className:`size-3`})})]},e))}),(0,Z.jsxs)(`div`,{className:`oc-show__row`,children:[(0,Z.jsx)(L,{value:i,onChange:e=>a(e.target.value),placeholder:ie(),className:`oc-chart-mine__domains-input`,onKeyDown:e=>{e.key===`Enter`&&d()}}),(0,Z.jsx)(A,{variant:`outline`,size:`sm`,disabled:c,onClick:()=>void d(),children:v()})]}),(0,Z.jsx)(`span`,{className:`oc-show__desc`,children:Qe()}),o?(0,Z.jsx)(`p`,{className:`oc-chart-import__error`,children:o}):null]})]})}function tn(e){let t={...e};return delete t.bpm,JSON.stringify(t,null,2)}function nn({chart:e}){let t=E(p.charts.updateChart),n=E(p.charts.deleteChart),[r,i]=(0,q.useState)(!1),[a,o]=(0,q.useState)(e.name),[c,l]=(0,q.useState)(()=>tn(e.tokens)),[u,f]=(0,q.useState)(e.tokens.bpm??0),[h,g]=(0,q.useState)(null),[_,v]=(0,q.useState)(!1);function y(){o(e.name),l(tn(e.tokens)),f(e.tokens.bpm??0),g(null),i(!0)}async function b(){if(e.chartId===void 0)return;g(null);let n;try{n=JSON.parse(c)}catch{g(w());return}if(n&&typeof n==`object`&&!Array.isArray(n)){let e=n;u>0?e.bpm=u:delete e.bpm}v(!0);try{await t({chartId:e.chartId,name:a.trim(),tokens:n}),i(!1)}catch(e){g(e instanceof Error?e.message:String(e))}finally{v(!1)}}async function x(){if(e.chartId!==void 0&&window.confirm(S()))try{await n({chartId:e.chartId})}catch{}}return(0,Z.jsxs)(`div`,{className:`oc-chart-mine__row`,children:[(0,Z.jsxs)(`div`,{className:`oc-chart-mine__head`,children:[(0,Z.jsx)(`span`,{className:`oc-chart-mine__name`,children:e.name}),(0,Z.jsx)(`div`,{className:`oc-show__row`,children:r?null:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(A,{variant:`outline`,size:`sm`,onClick:y,children:Ke()}),(0,Z.jsx)(A,{variant:`ghost`,size:`sm`,onClick:()=>void x(),children:Le()})]})})]}),r?(0,Z.jsxs)(`div`,{className:`oc-chart-mine__editor`,children:[(0,Z.jsxs)(`label`,{className:`oc-chart-import__field`,children:[(0,Z.jsx)(`span`,{className:`oc-chart-import__label`,children:s()}),(0,Z.jsx)(L,{value:a,onChange:e=>o(e.target.value),maxLength:60})]}),(0,Z.jsxs)(`div`,{className:`oc-chart-import__field`,children:[(0,Z.jsx)(`span`,{className:`oc-chart-import__label`,children:fe()}),(0,Z.jsxs)(`div`,{className:`oc-chart-bpm`,children:[(0,Z.jsx)(`input`,{type:`range`,className:`oc-chart-bpm__slider`,min:0,max:90,step:5,value:u,onChange:e=>f(Number(e.target.value)),"aria-label":fe()}),(0,Z.jsx)(`span`,{className:`oc-chart-bpm__value`,children:u===0?d():`${u} BPM`})]}),(0,Z.jsx)(`span`,{className:`oc-show__desc`,children:m()})]}),(0,Z.jsxs)(`label`,{className:`oc-chart-import__field`,children:[(0,Z.jsx)(`span`,{className:`oc-chart-import__label`,children:lt()}),(0,Z.jsx)(`textarea`,{className:`oc-chart-import__textarea`,value:c,onChange:e=>l(e.target.value),rows:10,spellCheck:!1})]}),h?(0,Z.jsx)(`p`,{className:`oc-chart-import__error`,children:h}):null,(0,Z.jsxs)(`div`,{className:`oc-show__row`,children:[(0,Z.jsx)(A,{size:`sm`,disabled:_,onClick:()=>void b(),children:ee()}),(0,Z.jsx)(A,{variant:`ghost`,size:`sm`,onClick:()=>i(!1),children:we()})]})]}):null,(0,Z.jsx)($t,{chart:e}),(0,Z.jsx)(en,{chart:e})]})}function rn(){let e=D(p.charts.listMyCharts),t=(e??[]).filter(e=>e.via===`owner`);return(0,Z.jsxs)(`section`,{className:`oc-show__section`,children:[(0,Z.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,Z.jsx)(`h2`,{className:`oc-show__title`,children:Be()}),(0,Z.jsx)(`p`,{className:`oc-show__desc`,children:Re()})]}),e!==void 0&&t.length===0?(0,Z.jsx)(`p`,{className:`oc-show__desc`,children:it()}):(0,Z.jsx)(`div`,{className:`oc-chart-mine-list`,children:t.map(e=>(0,Z.jsx)(nn,{chart:e},e.key))})]})}function an({chart:e,groups:t}){let n=E(p.charts.addChartToGroupPool),r=E(p.charts.removeChartFromGroupPool),i=e.restrictedToGroups,a=e.poolGroups,s=new Set((a??[]).map(e=>e.groupId)),c=t.filter(e=>!s.has(e._id));async function l(t){try{await n({groupId:t,chartKey:e.key})}catch{}}async function u(t){try{await r({groupId:t,chartKey:e.key})}catch{}}return(0,Z.jsxs)(`div`,{className:`oc-chart-avail`,children:[(0,Z.jsxs)(`div`,{className:`oc-chart-avail__head`,children:[(0,Z.jsx)(`span`,{className:`oc-chart-avail__name`,children:e.name}),(0,Z.jsx)(P,{variant:i?`secondary`:`outline`,className:`oc-chart-avail__state`,children:i?Ge():e.kind===`custom`&&e.scope===`personal`?me():o()}),e.isGlobalDefault?(0,Z.jsx)(P,{variant:`default`,children:pe()}):null]}),(0,Z.jsxs)(`div`,{className:`oc-chart-avail__groups`,children:[(0,Z.jsx)(`span`,{className:`oc-chart-mine__groups-label`,children:h()}),(a??[]).map(e=>(0,Z.jsxs)(P,{variant:`secondary`,className:`oc-chart-avail__chip`,children:[e.name,(0,Z.jsx)(`button`,{type:`button`,className:`oc-chart-avail__chip-x`,"aria-label":ot({group:e.name}),onClick:()=>void u(e.groupId),children:(0,Z.jsx)(k,{className:`size-3`})})]},e.groupId)),c.length>0?(0,Z.jsxs)(F,{value:``,onValueChange:e=>void l(e),children:[(0,Z.jsx)(j,{size:`sm`,className:`w-56`,children:(0,Z.jsx)(V,{placeholder:xe()})}),(0,Z.jsx)(H,{children:c.map(e=>(0,Z.jsx)(N,{value:e._id,children:e.name},e._id))})]}):t.length===0?(0,Z.jsx)(`span`,{className:`oc-show__desc`,children:f()}):null]})]})}function on({chart:e}){let t=E(p.charts.promoteChartToCommon),n=E(p.charts.deleteChart);async function r(){if(e.chartId!==void 0)try{await t({chartId:e.chartId})}catch{}}async function i(){if(e.chartId!==void 0&&window.confirm(S()))try{await n({chartId:e.chartId})}catch{}}return(0,Z.jsxs)(`div`,{className:`oc-chart-avail`,children:[(0,Z.jsxs)(`div`,{className:`oc-chart-avail__head`,children:[(0,Z.jsx)(`span`,{className:`oc-chart-avail__name`,children:e.name}),(0,Z.jsx)(P,{variant:e.scope===`common`?`outline`:`secondary`,children:e.scope===`common`?ue():me()}),e.ownerLabel?(0,Z.jsx)(`span`,{className:`oc-show__desc`,children:g({owner:e.ownerLabel})}):null]}),(0,Z.jsxs)(`div`,{className:`oc-show__row`,children:[e.scope===`personal`?(0,Z.jsx)(A,{variant:`outline`,size:`sm`,onClick:()=>void r(),children:ce()}):null,(0,Z.jsx)(A,{variant:`ghost`,size:`sm`,onClick:()=>void i(),children:Ue()})]})]})}function sn({defaultThemeMode:e,defaultLocale:t,defaultChartKey:n}){let r=E(p.admin.setDefaultThemeMode),i=E(p.admin.setDefaultLocale),o=E(p.charts.setDefaultChart),s=D(p.charts.listChartsAdmin),c=D(p.groups.listGroups,{}),l=e??`system`,u=t??`fr`;return(0,Z.jsxs)(`div`,{className:`oc-appearance-admin`,children:[(0,Z.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,Z.jsx)(`h2`,{className:`oc-show__title`,children:ae()}),(0,Z.jsx)(`p`,{className:`oc-show__desc`,children:y()})]}),(0,Z.jsxs)(`section`,{className:`oc-show__section`,children:[(0,Z.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,Z.jsx)(`h3`,{className:`oc-show__title`,children:te()}),(0,Z.jsx)(`p`,{className:`oc-show__desc`,children:_()})]}),(0,Z.jsxs)(`div`,{className:`oc-show__row`,children:[(0,Z.jsx)(A,{variant:n===null?`default`:`outline`,size:`sm`,onClick:()=>void o({name:null}),children:b()}),ht.map(e=>(0,Z.jsx)(A,{variant:n===e.key?`default`:`outline`,size:`sm`,onClick:()=>void o({name:e.key}),children:e.name},e.key)),(s??[]).filter(e=>e.kind===`custom`&&e.scope===`common`).map(e=>(0,Z.jsx)(A,{variant:n===e.key?`default`:`outline`,size:`sm`,onClick:()=>void o({name:e.key}),children:e.name},e.key))]})]}),(0,Z.jsxs)(`section`,{className:`oc-show__section`,children:[(0,Z.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,Z.jsx)(`h3`,{className:`oc-show__title`,children:he()}),(0,Z.jsx)(`p`,{className:`oc-show__desc`,children:de()})]}),(0,Z.jsx)(`div`,{className:`oc-chart-avail-list`,children:(s??[]).filter(e=>!(e.kind===`custom`&&e.scope===`common`)).map(e=>(0,Z.jsx)(an,{chart:e,groups:c??[]},e.key))})]}),(0,Z.jsxs)(`section`,{className:`oc-show__section`,children:[(0,Z.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,Z.jsx)(`h3`,{className:`oc-show__title`,children:le()}),(0,Z.jsx)(`p`,{className:`oc-show__desc`,children:We()})]}),(0,Z.jsx)(`div`,{className:`oc-chart-avail-list`,children:(s??[]).filter(e=>e.kind===`builtin`||e.scope===`common`).map(e=>(0,Z.jsxs)(`div`,{className:`oc-chart-avail`,children:[(0,Z.jsx)(`div`,{className:`oc-chart-avail__head`,children:(0,Z.jsx)(`span`,{className:`oc-chart-avail__name`,children:e.name})}),(0,Z.jsx)(en,{chart:e})]},e.key))})]}),(0,Z.jsxs)(`section`,{className:`oc-show__section`,children:[(0,Z.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,Z.jsx)(`h3`,{className:`oc-show__title`,children:oe()}),(0,Z.jsx)(`p`,{className:`oc-show__desc`,children:x()})]}),(()=>{let e=(s??[]).filter(e=>e.kind===`custom`);return e.length===0?(0,Z.jsx)(`p`,{className:`oc-show__desc`,children:a()}):(0,Z.jsx)(`div`,{className:`oc-chart-avail-list`,children:e.map(e=>(0,Z.jsx)(on,{chart:e},e.key))})})()]}),(0,Z.jsxs)(`section`,{className:`oc-show__section`,children:[(0,Z.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,Z.jsx)(`h3`,{className:`oc-show__title`,children:ve()}),(0,Z.jsx)(`p`,{className:`oc-show__desc`,children:Ne()})]}),(0,Z.jsx)(`div`,{className:`oc-show__row`,children:[`light`,`dark`,`system`].map(e=>(0,Z.jsx)(A,{variant:l===e?`default`:`outline`,size:`sm`,onClick:()=>void r({mode:e}),children:qt(e)},e))})]}),(0,Z.jsxs)(`section`,{className:`oc-show__section`,children:[(0,Z.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,Z.jsx)(`h3`,{className:`oc-show__title`,children:Oe()}),(0,Z.jsx)(`p`,{className:`oc-show__desc`,children:Ae()})]}),(0,Z.jsx)(`div`,{className:`oc-show__row`,children:vt().map(e=>(0,Z.jsx)(A,{variant:u===e.value?`default`:`outline`,size:`sm`,onClick:()=>void i({locale:e.value}),children:e.label},e.value))}),(0,Z.jsx)(`p`,{className:`oc-show__desc`,children:re()})]})]})}function cn(){let e=D(p.me.getMe,{host:I}),t=_t(e?.resolvedThemeMode);return(0,Z.jsxs)(`div`,{className:`oc-appearance`,children:[(0,Z.jsx)(Zt,{selectedKey:e?.chartKey??null,resolvedMode:t}),(0,Z.jsx)(Qt,{}),(0,Z.jsx)(rn,{}),e?.role===`admin`?(0,Z.jsx)(sn,{defaultThemeMode:e.defaultThemeMode,defaultLocale:e.defaultLocale,defaultChartKey:e.defaultChartKey}):null]})}function ln(){let[e,t]=(0,q.useState)(!0),[n,r]=(0,q.useState)(`per-user`),[i,a]=(0,q.useState)(``),[o,s]=(0,q.useState)(Q),[c,l]=(0,q.useState)(Q),[u,d]=(0,q.useState)(Gt),f=i!==``||o!==Q||c!==Q;function p(){a(``),s(Q),l(Q),d(Gt)}return(0,Z.jsxs)(`div`,{className:`oc-show`,children:[(0,Z.jsx)(cn,{}),(0,Z.jsxs)(`details`,{className:`oc-show__ref`,children:[(0,Z.jsx)(`summary`,{className:`oc-show__title`,children:$e()}),(0,Z.jsxs)($,{title:`Buttons`,description:`Variants`,children:[(0,Z.jsxs)(`div`,{className:`oc-show__row`,children:[(0,Z.jsx)(A,{children:`Default`}),(0,Z.jsx)(A,{variant:`secondary`,children:`Secondary`}),(0,Z.jsx)(A,{variant:`outline`,children:`Outline`}),(0,Z.jsx)(A,{variant:`ghost`,children:`Ghost`}),(0,Z.jsx)(A,{variant:`destructive`,children:`Destructive`}),(0,Z.jsx)(A,{variant:`link`,children:`Link`})]}),(0,Z.jsxs)(`div`,{className:`oc-show__row`,children:[(0,Z.jsx)(A,{size:`sm`,children:`Small`}),(0,Z.jsx)(A,{children:`Default`}),(0,Z.jsx)(A,{size:`lg`,children:`Large`}),(0,Z.jsx)(A,{size:`icon`,"aria-label":`more`,children:(0,Z.jsx)(M,{})}),(0,Z.jsx)(A,{disabled:!0,children:`Disabled`})]})]}),(0,Z.jsx)($,{title:`Badges`,children:(0,Z.jsxs)(`div`,{className:`oc-show__row`,children:[(0,Z.jsx)(P,{children:`Default`}),(0,Z.jsx)(P,{variant:`secondary`,children:`Secondary`}),(0,Z.jsx)(P,{variant:`outline`,children:`Outline`}),(0,Z.jsx)(P,{variant:`destructive`,children:`Destructive`})]})}),(0,Z.jsx)($,{title:`Inputs & selection`,children:(0,Z.jsxs)(`div`,{className:`oc-show__row oc-show__row--col`,children:[(0,Z.jsx)(L,{placeholder:`Text input…`}),(0,Z.jsxs)(`div`,{className:`oc-show__row`,children:[(0,Z.jsxs)(F,{value:n,onValueChange:r,children:[(0,Z.jsx)(j,{className:`w-56`,children:(0,Z.jsx)(V,{placeholder:`Select…`})}),(0,Z.jsxs)(H,{children:[(0,Z.jsx)(N,{value:`per-user`,children:`per-user (chacun son agent)`}),(0,Z.jsx)(N,{value:`shared`,children:`shared (agent commun)`})]})]}),(0,Z.jsxs)(`label`,{className:`oc-show__check`,children:[(0,Z.jsx)(R,{checked:e,onCheckedChange:e=>t(!!e)}),`Checkbox`]})]})]})}),(0,Z.jsx)($,{title:`Filtres & plage temporelle`,description:`Barre réutilisable (recherche debouncée + selects rapides à largeur auto + plage façon Grafana) et constructeur de filtre avancé. Câblée dans Users, Groups, Comptes de service, Traces, Anomalies, Audit et KPI.`,children:(0,Z.jsxs)(`div`,{className:`oc-show__row oc-show__row--col`,children:[(0,Z.jsxs)(kt,{q:i,onQChange:a,searchPlaceholder:`Rechercher (kind, principal, rôle, route…)`,timeRange:u,onTimeRangeChange:d,onReset:p,canReset:f,children:[(0,Z.jsxs)(F,{value:o,onValueChange:s,children:[(0,Z.jsx)(j,{size:`sm`,children:(0,Z.jsx)(V,{})}),(0,Z.jsxs)(H,{children:[(0,Z.jsx)(N,{value:Q,children:`Toutes directions`}),(0,Z.jsx)(N,{value:`inbound`,children:`inbound`}),(0,Z.jsx)(N,{value:`outbound`,children:`outbound`}),(0,Z.jsx)(N,{value:`internal`,children:`internal`})]})]}),(0,Z.jsxs)(F,{value:c,onValueChange:l,children:[(0,Z.jsx)(j,{size:`sm`,children:(0,Z.jsx)(V,{})}),(0,Z.jsxs)(H,{children:[(0,Z.jsx)(N,{value:Q,children:`Toutes sévérités`}),(0,Z.jsx)(N,{value:`info`,children:`info`}),(0,Z.jsx)(N,{value:`warn`,children:`warn`}),(0,Z.jsx)(N,{value:`critical`,children:`critical`})]})]})]}),(0,Z.jsx)(At,{fields:Kt,onChange:()=>{}}),(0,Z.jsxs)(`div`,{className:`oc-show__row`,children:[(0,Z.jsx)(`span`,{className:`oc-show__desc`,children:`Sélecteur de plage seul :`}),(0,Z.jsx)(Ot,{value:u,onChange:d})]})]})}),(0,Z.jsx)($,{title:`Dropdown menu`,description:`Row actions / kebab`,children:(0,Z.jsxs)(dt,{children:[(0,Z.jsx)(mt,{asChild:!0,children:(0,Z.jsx)(A,{variant:`outline`,size:`icon`,"aria-label":`Open menu`,children:(0,Z.jsx)(M,{})})}),(0,Z.jsxs)(pt,{align:`start`,children:[(0,Z.jsx)(gt,{children:`Actions`}),(0,Z.jsx)(z,{}),(0,Z.jsx)(B,{children:`Edit`}),(0,Z.jsx)(B,{children:`Duplicate`}),(0,Z.jsx)(z,{}),(0,Z.jsx)(B,{variant:`destructive`,children:`Delete`})]})]})}),(0,Z.jsx)($,{title:`Card`,children:(0,Z.jsxs)(wt,{className:`w-80`,children:[(0,Z.jsxs)(yt,{children:[(0,Z.jsx)(St,{children:`Instance`}),(0,Z.jsx)(Ct,{children:`Non-secret metadata only.`})]}),(0,Z.jsx)(xt,{className:`text-sm text-muted-foreground`,children:`ws://gateway.example.org:18789`}),(0,Z.jsxs)(bt,{className:`gap-2`,children:[(0,Z.jsx)(A,{size:`sm`,children:`Save`}),(0,Z.jsx)(A,{size:`sm`,variant:`ghost`,children:`Cancel`})]})]})}),(0,Z.jsx)($,{title:`Table`,children:(0,Z.jsxs)(Dt,{children:[(0,Z.jsx)(Tt,{children:(0,Z.jsxs)(W,{children:[(0,Z.jsx)(U,{className:`w-8`,children:(0,Z.jsx)(R,{"aria-label":`select all`})}),(0,Z.jsx)(U,{children:`Name`}),(0,Z.jsx)(U,{children:`Mode`}),(0,Z.jsx)(U,{className:`text-right`,children:`Status`}),(0,Z.jsx)(U,{className:`w-8`})]})}),(0,Z.jsx)(Et,{children:[{n:`admins`,m:`per-user`,s:`active`},{n:`family`,m:`shared`,s:`active`}].map(e=>(0,Z.jsxs)(W,{children:[(0,Z.jsx)(G,{children:(0,Z.jsx)(R,{"aria-label":`select ${e.n}`})}),(0,Z.jsx)(G,{className:`font-medium`,children:e.n}),(0,Z.jsx)(G,{children:(0,Z.jsx)(P,{variant:`secondary`,children:e.m})}),(0,Z.jsx)(G,{className:`text-right`,children:(0,Z.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-muted-foreground`,children:[(0,Z.jsx)(O,{className:`size-3.5`}),` `,e.s]})}),(0,Z.jsx)(G,{children:(0,Z.jsx)(A,{variant:`ghost`,size:`icon`,"aria-label":`row actions`,children:(0,Z.jsx)(M,{})})})]},e.n))})]})}),(0,Z.jsx)($,{title:`App fragments`,description:`Chat-specific components`,children:(0,Z.jsxs)(`div`,{className:`oc-show__row oc-show__row--col`,children:[(0,Z.jsx)(`div`,{className:`oc-msg oc-msg--assistant`,children:(0,Z.jsx)(`div`,{className:`oc-msg__body`,children:`Assistant message bubble.`})}),(0,Z.jsx)(`div`,{className:`oc-tool oc-tool--completed`,children:(0,Z.jsxs)(`div`,{className:`oc-tool__header`,children:[(0,Z.jsx)(`span`,{className:`oc-tool__icon`,children:`✓`}),(0,Z.jsx)(`span`,{className:`oc-tool__name`,children:`write-file`}),(0,Z.jsx)(`span`,{className:`oc-tool__phase`,children:`completed`})]})}),(0,Z.jsxs)(`div`,{className:`oc-run-status oc-run-status--streaming`,children:[(0,Z.jsx)(`span`,{className:`oc-run-status__dot`}),(0,Z.jsx)(`span`,{className:`oc-run-status__label`,children:`Running`})]})]})})]})]})}export{ln as ThemeShowroom};
@@ -1 +0,0 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$C as r,$g as i,BC as a,Bg as o,D as s,E as c,FC as l,Fg as u,GC as d,Gg as f,HC as p,Hg as m,IC as h,Ig as g,Jg as _,KC as v,Kg as y,LC as b,Lg as ee,NC as x,Ng as S,PC as C,Pg as te,QC as w,Qg as ne,RC as re,Rg as ie,Sw as ae,UC as oe,Ug as se,VC as ce,Vg as le,WC as ue,Wg as de,Xg as fe,Yg as pe,Zg as me,__ as he,_w as T,a_ as ge,aw as E,bw as D,c_ as _e,cw as O,d_ as ve,dw as k,e_ as ye,ew as A,f_ as be,fw as j,g_ as xe,gw as M,h_ as Se,hw as Ce,i_ as we,in as Te,iw as N,l_ as Ee,lj as P,lw as F,m_ as De,mw as Oe,n_ as ke,nn as Ae,nw as je,o_ as Me,ow as Ne,p_ as Pe,pw as Fe,qC as Ie,qg as Le,r_ as Re,rn as ze,rw as Be,s_ as Ve,sw as He,t_ as Ue,tw as We,u_ as Ge,uj as I,uw as L,vw as Ke,xw as qe,yw as Je,zC as Ye,zg as Xe}from"./dist-BjwyR-Rb.js";import{n as Ze}from"./dist-B1vUBlGT.js";import{t as Qe}from"./x-y131Bn-k.js";import{i as R,n as z,r as $e,t as et}from"./tabs-WMNx-KXA.js";import{t as B}from"./button-ANIiyoGJ.js";import{A as V,C as H,Ht as tt,Lt as nt,N as rt,Nt as it,Pt as at,S as U,Vt as ot,a as st,at as W,b as G,ct,dt as lt,ft as ut,ht as dt,i as ft,j as pt,lt as mt,o as ht,r as gt,st as _t,w as K,x as q}from"./index-BGXPyQxx.js";import{n as vt}from"./TimeRangePicker-BSn6eVzh.js";import{t as yt}from"./FilterBar-5McK3w7W.js";import{t as bt}from"./AdvancedFilter--hO9zyz3.js";import{t as xt}from"./DataTableShell-qDyq_xxR.js";var St=s(`eye-off`,[[`path`,{d:`M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49`,key:`ct8e1f`}],[`path`,{d:`M14.084 14.158a3 3 0 0 1-4.242-4.242`,key:`151rxh`}],[`path`,{d:`M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143`,key:`13bj9a`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}]]),Ct=s(`scroll-text`,[[`path`,{d:`M15 12h-5`,key:`r7krc0`}],[`path`,{d:`M15 8h-5`,key:`1khuty`}],[`path`,{d:`M19 17V5a2 2 0 0 0-2-2H4`,key:`zz82l3`}],[`path`,{d:`M8 21h12a2 2 0 0 0 2-2v-1a1 1 0 0 0-1-1H11a1 1 0 0 0-1 1v1a2 2 0 1 1-4 0V5a2 2 0 1 0-4 0v2a1 1 0 0 0 1 1h3`,key:`1ph1d7`}]]),J=t(e(),1),Y=n(),X={kind:`relative`,from:`now-520w`,to:`now`},Z=e=>e===null?`-`:String(Math.round(e));function wt(e){let t=e.indexOf(`:`);if(t<0)return e;let n=e.slice(0,t),r=e.slice(t+1);return n===`admin`?Be():n===`agent`?`${je()} - ${r}`:e}function Tt(){let e=I(c.me.getMe,{host:dt})?.role===`admin`,t=I(c.deliveryTiming.getDeliveryStatus,{}),n=P(c.deliveryTiming.startDeliveryRecord),r=P(c.deliveryTiming.stopDeliveryRecord),[i,a]=(0,J.useState)(!1),[o,s]=(0,J.useState)(!1),l=t?.recording??!1,u=async()=>{s(!0);try{l?await r({}):await n({})}finally{s(!1)}};return(0,Y.jsxs)(`section`,{className:`mb-4 flex flex-col gap-3 rounded-lg border border-border p-4`,children:[(0,Y.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`h3`,{className:`text-sm font-semibold`,children:ae()}),(0,Y.jsx)(`p`,{className:`oc-admin__hint`,children:qe()})]}),e?(0,Y.jsx)(B,{variant:l?`destructive`:`default`,size:`sm`,disabled:o||t===void 0,onClick:()=>void u(),children:l?Je():D()}):null]}),l?(0,Y.jsxs)(`p`,{className:`flex items-center gap-2 text-sm`,children:[(0,Y.jsx)(W,{variant:`secondary`,children:Ke()}),t?.startedAt?(0,Y.jsx)(`span`,{className:`text-muted-foreground`,children:T({time:pt(t.startedAt)})}):null]}):null,(0,Y.jsx)(`div`,{children:(0,Y.jsx)(B,{variant:`outline`,size:`sm`,onClick:()=>a(e=>!e),children:i?Oe():Ce()})}),i?(0,Y.jsx)(Et,{isAdmin:e}):null]})}function Et({isAdmin:e}){let t=I(c.deliveryTiming.listDeliverySessions,{}),n=P(c.deliveryTiming.deleteDeliverySessions),[i,a]=(0,J.useState)(``),[o,s]=(0,J.useState)(`all`),[l,u]=(0,J.useState)(X),[d,f]=(0,J.useState)(null),{from:p,to:m}=vt(l),h=l.to===`now`?1/0:m,g=i.trim()!==``||o!==`all`||l!==X,_=()=>{a(``),s(`all`),u(X)},v=(0,J.useMemo)(()=>{if(t===void 0)return;let e=i.trim().toLowerCase();return t.filter(t=>(e===``||t.startedBy.toLowerCase().includes(e))&&(o===`all`||(o===`active`?t.active:!t.active))&&t.startedAt>=p&&t.startedAt<=h).map(e=>({...e,_id:e.sessionId}))},[t,i,o,p,h]),y=e=>{let t=new Set((v??[]).map(e=>e.sessionId)),r=e.filter(e=>t.has(e));r.length!==0&&(n({sessionIds:r}),d!==null&&r.includes(d)&&f(null))};return(0,Y.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Y.jsx)(yt,{q:i,onQChange:a,searchPlaceholder:j(),timeRange:l,onTimeRangeChange:u,onReset:_,canReset:g,children:(0,Y.jsxs)(G,{value:o,onValueChange:e=>s(e),children:[(0,Y.jsx)(H,{size:`sm`,className:`w-36`,children:(0,Y.jsx)(K,{})}),(0,Y.jsxs)(q,{children:[(0,Y.jsx)(U,{value:`all`,children:k()}),(0,Y.jsx)(U,{value:`active`,children:L()}),(0,Y.jsx)(U,{value:`stopped`,children:F()})]})]})}),(0,Y.jsx)(xt,{title:Fe(),rows:v,emptyHint:C(),columns:[{header:``,className:`w-8`,cell:e=>(0,Y.jsx)(B,{variant:`ghost`,size:`icon`,"aria-label":d===e.sessionId?A():We(),onClick:()=>f(t=>t===e.sessionId?null:e.sessionId),children:d===e.sessionId?(0,Y.jsx)(St,{size:15,"aria-hidden":!0}):(0,Y.jsx)(at,{size:15,"aria-hidden":!0})})},{header:O(),sort:e=>e.startedAt,cell:e=>(0,Y.jsx)(`span`,{className:`tabular-nums`,children:V(e.startedAt)})},{header:He(),sort:e=>e.stoppedAt,cell:e=>e.stoppedAt===null?(0,Y.jsx)(`span`,{className:`text-muted-foreground`,children:`-`}):(0,Y.jsx)(`span`,{className:`tabular-nums`,children:V(e.stoppedAt)})},{header:Ne(),sort:e=>e.count,cell:e=>(0,Y.jsx)(`span`,{className:`tabular-nums`,children:Z(e.count)})},{header:E(),sort:e=>e.startedBy,cell:e=>wt(e.startedBy)},{header:N(),sort:e=>e.active,cell:e=>e.active?(0,Y.jsx)(W,{variant:`secondary`,children:L()}):(0,Y.jsx)(`span`,{className:`text-muted-foreground`,children:F()})}],rowActions:e?e=>[{label:r(),variant:`destructive`,onSelect:()=>y([e.sessionId])}]:void 0,bulkActions:e?[{label:r(),variant:`destructive`,onSelect:e=>y(e)}]:void 0,isExpanded:e=>e.sessionId===d,renderExpanded:e=>(0,Y.jsx)(Dt,{sessionId:e.sessionId})})]})}function Dt({sessionId:e}){let t=I(c.deliveryTiming.getDeliveryReport,{sessionId:e}),[n,r]=(0,J.useState)(!1);return(0,Y.jsx)(Ot,{report:t,copied:n,onCopy:()=>{t&&navigator.clipboard?.writeText(rt(t)).then(()=>{r(!0),window.setTimeout(()=>r(!1),1200)}).catch(()=>{})}})}function Ot({report:e,copied:t,onCopy:n}){if(!e)return(0,Y.jsx)(`p`,{className:`oc-admin__hint`,children:w()});if(e.count===0||e.segments===null)return(0,Y.jsx)(`p`,{className:`oc-admin__hint`,children:M()});let r=e.segments,i=(e,t)=>(0,Y.jsxs)(`tr`,{className:`border-t border-border`,children:[(0,Y.jsx)(`td`,{className:`py-1`,children:e}),(0,Y.jsx)(`td`,{className:`py-1 text-right tabular-nums`,children:t.count}),(0,Y.jsxs)(`td`,{className:`py-1 text-right tabular-nums`,children:[Z(t.p50),` / `,Z(t.p95),` / `,Z(t.max)]})]});return(0,Y.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,Y.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[e.count,` `,x()]}),(0,Y.jsxs)(B,{variant:`outline`,size:`sm`,onClick:n,children:[t?(0,Y.jsx)(Ze,{size:13,"aria-hidden":!0}):(0,Y.jsx)(nt,{size:13,"aria-hidden":!0}),t?l():h()]})]}),(0,Y.jsxs)(`table`,{className:`w-full text-sm`,children:[(0,Y.jsx)(`thead`,{children:(0,Y.jsxs)(`tr`,{className:`text-left text-muted-foreground`,children:[(0,Y.jsx)(`th`,{className:`py-1 font-medium`,children:d()}),(0,Y.jsx)(`th`,{className:`py-1 text-right font-medium`,children:ue()}),(0,Y.jsx)(`th`,{className:`py-1 text-right font-medium`,children:oe()})]})}),(0,Y.jsxs)(`tbody`,{children:[i(p(),r.bridge),i(ce(),r.A),i(a(),r.C)]})]}),(0,Y.jsx)(`p`,{className:`oc-admin__hint`,children:Ye()}),e.truncated?(0,Y.jsx)(`p`,{className:`oc-admin__hint`,children:b()}):null,(0,Y.jsx)(`p`,{className:`oc-admin__hint`,children:re()})]})}var kt=[50,100,200,500],At=`all`,Q=`__all__`,jt=[`2xx`,`4xx`,`5xx`],Mt=[`user`,`service`,`system`],Nt=[`inbound`,`outbound`,`internal`],Pt={kind:`relative`,from:`now-30d`,to:`now`},Ft=[{value:`kind`,label:`kind`},{value:`status`,label:`status`},{value:`latencyMs`,label:Te()},{value:`principalType`,label:ze()},{value:`direction`,label:`direction`},{value:`roleKey`,label:Ae()},{value:`route`,label:`route`},{value:`correlationId`,label:`correlationId`}];function It(){let e=tt({from:`/settings/traces`}),t=ot({from:`/settings/traces`}),n=e.limit,r=e.kind,a=e.statusClass??Q,s=e.principalType??Q,l=e.direction??Q,u=e.roleKey??Q,d=e.q??``,p=gt(e.from,e.to),h=(0,J.useMemo)(()=>ht(e.adv),[e.adv]),{from:b,to:x}=vt(p),[S,C]=(0,J.useState)(null),[te,w]=(0,J.useState)(null),re=e=>void t({search:t=>({...t,limit:e})}),ae=e=>void t({search:t=>({...t,kind:e})}),oe=e=>void t({search:t=>({...t,q:e||void 0}),replace:!0}),ce=e=>void t({search:t=>({...t,statusClass:e===Q?void 0:e})}),ue=e=>void t({search:t=>({...t,principalType:e===Q?void 0:e})}),T=e=>void t({search:t=>({...t,direction:e===Q?void 0:e})}),E=e=>void t({search:t=>({...t,roleKey:e===Q?void 0:e})}),D=e=>void t({search:t=>({...t,...st(e)})}),O=e=>void t({search:t=>({...t,adv:ft(e)}),replace:!0}),k=I(c.observability.listEvents,{limit:n}),A=I(c.observability.listEvents,{limit:n,kind:r===At?void 0:r,filter:{q:d||void 0,from:b,to:x,statusClass:a===Q?void 0:a,principalType:s===Q?void 0:s,direction:l===Q?void 0:l,roleKey:u===Q?void 0:u,advanced:h.length>0?h:void 0}}),j=(0,J.useMemo)(()=>{let e=new Set;for(let t of k??[])e.add(t.kind);return[...e].sort()},[k]),M=(0,J.useMemo)(()=>{let e=new Set;for(let t of k??[])t.roleKey&&e.add(t.roleKey);return[...e].sort()},[k]),Ce=d!==``||a!==Q||s!==Q||l!==Q||u!==Q||h.length>0||p.kind!==`relative`||p.from!==Pt.from;function Te(){t({search:{limit:100,kind:`all`},replace:!0})}let N=S?k?.filter(e=>e.correlationId===S):A,P=e.section,F=e=>void t({search:t=>({...t,section:e}),replace:!0});return(0,Y.jsxs)(et,{value:P,onValueChange:e=>F(e),children:[(0,Y.jsxs)($e,{className:`w-full`,children:[(0,Y.jsxs)(R,{value:`latency`,className:`flex-1 gap-1.5`,children:[(0,Y.jsx)(it,{size:13,"aria-hidden":!0}),Ie()]}),(0,Y.jsxs)(R,{value:`events`,className:`flex-1 gap-1.5`,children:[(0,Y.jsx)(Ct,{size:13,"aria-hidden":!0}),v()]})]}),(0,Y.jsx)(z,{value:`latency`,children:(0,Y.jsx)(Tt,{})}),(0,Y.jsxs)(z,{value:`events`,className:`flex flex-col gap-3`,children:[(0,Y.jsxs)(`p`,{className:`oc-admin__hint`,children:[he(),(0,Y.jsx)(`strong`,{children:xe()}),Se(),` `,(0,Y.jsx)(`span`,{className:`oc-filter__window`,children:De()})]}),(0,Y.jsxs)(yt,{q:d,onQChange:oe,searchPlaceholder:Pe(),timeRange:p,onTimeRangeChange:D,onReset:Te,canReset:Ce,children:[(0,Y.jsxs)(G,{value:a,onValueChange:ce,children:[(0,Y.jsx)(H,{size:`sm`,className:`w-32`,children:(0,Y.jsx)(K,{placeholder:be()})}),(0,Y.jsxs)(q,{children:[(0,Y.jsx)(U,{value:Q,children:ve()}),jt.map(e=>(0,Y.jsx)(U,{value:e,children:e},e))]})]}),(0,Y.jsxs)(G,{value:s,onValueChange:ue,children:[(0,Y.jsx)(H,{size:`sm`,className:`w-32`,children:(0,Y.jsx)(K,{placeholder:Ge()})}),(0,Y.jsxs)(q,{children:[(0,Y.jsx)(U,{value:Q,children:Ee()}),Mt.map(e=>(0,Y.jsx)(U,{value:e,children:e},e))]})]}),(0,Y.jsxs)(G,{value:l,onValueChange:T,children:[(0,Y.jsx)(H,{size:`sm`,className:`w-32`,children:(0,Y.jsx)(K,{placeholder:_e()})}),(0,Y.jsxs)(q,{children:[(0,Y.jsx)(U,{value:Q,children:Ve()}),Nt.map(e=>(0,Y.jsx)(U,{value:e,children:e},e))]})]}),(0,Y.jsxs)(G,{value:u,onValueChange:E,children:[(0,Y.jsx)(H,{size:`sm`,className:`w-36`,children:(0,Y.jsx)(K,{placeholder:Me()})}),(0,Y.jsxs)(q,{children:[(0,Y.jsx)(U,{value:Q,children:ge()}),M.map(e=>(0,Y.jsx)(U,{value:e,children:e},e))]})]}),(0,Y.jsxs)(G,{value:r,onValueChange:ae,children:[(0,Y.jsx)(H,{size:`sm`,className:`w-44`,children:(0,Y.jsx)(K,{placeholder:we()})}),(0,Y.jsxs)(q,{children:[(0,Y.jsx)(U,{value:At,children:Re()}),j.map(e=>(0,Y.jsx)(U,{value:e,children:e},e))]})]}),(0,Y.jsxs)(G,{value:String(n),onValueChange:e=>re(Number(e)),children:[(0,Y.jsx)(H,{size:`sm`,className:`w-28`,children:(0,Y.jsx)(K,{})}),(0,Y.jsx)(q,{children:kt.map(e=>(0,Y.jsx)(U,{value:String(e),children:ke({count:e})},e))})]})]}),(0,Y.jsx)(bt,{fields:Ft,seed:h,onChange:O}),S?(0,Y.jsx)(`div`,{className:`oc-traces__followline`,children:(0,Y.jsxs)(`button`,{type:`button`,className:`oc-traces__chip`,onClick:()=>C(null),title:Ue(),children:[(0,Y.jsxs)(`span`,{className:`oc-traces__chip-label`,children:[ye(),(0,Y.jsx)(`code`,{children:$(S)})]}),(0,Y.jsx)(Qe,{className:`oc-traces__chip-x`,"aria-hidden":!0}),(0,Y.jsx)(`span`,{className:`sr-only`,children:i()})]})}):null,(0,Y.jsx)(xt,{title:ne(),rows:N,emptyHint:S?me():fe(),columns:[{header:pe(),sort:e=>e.at,cell:e=>(0,Y.jsx)(`span`,{className:`oc-traces__time`,children:V(e.at)})},{header:_(),sort:e=>e.kind,cell:e=>(0,Y.jsx)(W,{variant:`secondary`,children:e.kind})},{header:Le(),sort:e=>Rt(e)??null,cell:e=>{let t=Rt(e);return t?(0,Y.jsxs)(`span`,{className:`oc-traces__fail`,title:t,children:[`✕ `,t]}):(0,Y.jsx)(`span`,{className:`oc-traces__ok`,"aria-label":y(),children:`✓`})}},{header:f(),sort:e=>e.direction,cell:e=>e.direction?(0,Y.jsx)(W,{variant:`outline`,children:e.direction}):(0,Y.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})},{header:de(),sort:e=>e.principalType,cell:e=>(0,Y.jsxs)(`span`,{className:`oc-traces__principal`,children:[(0,Y.jsx)(W,{variant:`outline`,children:e.principalType}),e.principalId?(0,Y.jsx)(`code`,{className:`oc-traces__mono`,children:$(e.principalId)}):null]})},{header:se(),sort:e=>e.roleKey,cell:e=>e.roleKey?(0,Y.jsx)(W,{variant:`secondary`,children:e.roleKey}):(0,Y.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})},{header:m(),sort:e=>e.route,cell:e=>e.route?(0,Y.jsxs)(`span`,{className:`oc-traces__route`,children:[e.method?(0,Y.jsx)(`span`,{className:`oc-traces__method`,children:e.method}):null,(0,Y.jsx)(`code`,{className:`oc-traces__mono`,children:e.route})]}):(0,Y.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})},{header:le(),sort:e=>e.status,cell:e=>e.status===null?(0,Y.jsx)(`span`,{className:`oc-traces__muted`,children:`—`}):(0,Y.jsx)(`span`,{className:`oc-traces__status ${Lt(e.status)}`,children:e.status})},{header:o(),sort:e=>e.latencyMs,cell:e=>e.latencyMs===null?(0,Y.jsx)(`span`,{className:`oc-traces__muted`,children:`—`}):(0,Y.jsxs)(`span`,{className:`oc-traces__mono`,children:[e.latencyMs,` ms`]})},{header:Xe(),sort:e=>e.correlationId,cell:e=>e.correlationId?(0,Y.jsx)(`button`,{type:`button`,className:`oc-traces__corr`,title:ie(),onClick:()=>C(e.correlationId),children:$(e.correlationId)}):(0,Y.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})},{header:ee(),sort:e=>+!!e.meta,cell:e=>e.meta?(0,Y.jsx)(B,{variant:`outline`,size:`sm`,onClick:()=>w(e),children:g()}):(0,Y.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})}]}),(0,Y.jsx)(zt,{row:te,onClose:()=>w(null)})]})]})}function Lt(e){return e>=500?`oc-traces__status--5xx`:e>=400?`oc-traces__status--4xx`:e>=200&&e<300?`oc-traces__status--2xx`:`oc-traces__status--other`}function $(e){return e.length>8?e.slice(0,8):e}function Rt(e){if(typeof e.status==`number`&&e.status>=400)return String(e.status);if(!e.meta)return null;try{let t=JSON.parse(e.meta);if(e.kind===`openclaw.dispatch`&&t.dispatchStatus===`failed`)return t.errorCode??`failed`;if(e.kind===`assistant.stream`&&t.phase===`finalize`&&(t.streamStatus===`error`||t.streamStatus===`aborted`))return t.streamStatus;if(e.kind===`openclaw.ingest.denied`)return`denied`}catch{}return null}function zt({row:e,onClose:t}){let n=(0,J.useMemo)(()=>{if(!e?.meta)return``;try{return JSON.stringify(JSON.parse(e.meta),null,2)}catch{return e.meta}},[e]);return(0,Y.jsx)(_t,{open:e!==null,onOpenChange:e=>{e||t()},children:e?(0,Y.jsxs)(ct,{className:`max-w-lg`,children:[(0,Y.jsxs)(lt,{children:[(0,Y.jsxs)(ut,{className:`oc-traces__meta-title`,children:[u(),` `,(0,Y.jsx)(`code`,{children:e.kind}),(0,Y.jsx)(W,{variant:`outline`,children:te()})]}),(0,Y.jsx)(mt,{children:S()})]}),(0,Y.jsx)(`pre`,{className:`oc-traces__meta-json`,children:n})]}):null})}export{It as TracesTab};