@lacneu/atrium 0.48.0 → 0.50.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (73) hide show
  1. package/README.md +14 -1
  2. package/dist/assets/{AccessTab-DMtobe3Y.js → AccessTab-YfxJ8TyH.js} +1 -1
  3. package/dist/assets/{AdvancedFilter-B6lCXnk_.js → AdvancedFilter-Bw_6N4Fp.js} +1 -1
  4. package/dist/assets/AgentFilesTab-BGjK8vy-.js +3 -0
  5. package/dist/assets/AnomaliesTab-ClY_uTZu.js +1 -0
  6. package/dist/assets/AuditTab-DNV2Z66C.js +1 -0
  7. package/dist/assets/BridgeTab-BDp1JcI8.js +1 -0
  8. package/dist/assets/ChatDefaultsTab-Cuma5jME.js +1 -0
  9. package/dist/assets/{DataTableShell-Bzopt4OT.js → DataTableShell-HZGBUlvm.js} +1 -1
  10. package/dist/assets/{DetailChips-PKnLEOOY.js → DetailChips-gFOfqX_a.js} +1 -1
  11. package/dist/assets/FeedbacksTab-BaSoBVK5.js +1 -0
  12. package/dist/assets/{FieldLabel-RnB1EBjO.js → FieldLabel-pNGSpfk-.js} +1 -1
  13. package/dist/assets/FilesTab-BxjNQ6IX.js +1 -0
  14. package/dist/assets/{FilterBar-Dy10_IPZ.js → FilterBar-DlPympG5.js} +1 -1
  15. package/dist/assets/{GroupsTab-DfguxlfH.js → GroupsTab-CUch1a_C.js} +1 -1
  16. package/dist/assets/InstancesTab-DRWZsjZC.js +1 -0
  17. package/dist/assets/IntegrationsTab-C7KPWF6x.js +1 -0
  18. package/dist/assets/KpiTab-6QaTYyCv.js +1 -0
  19. package/dist/assets/PreferencesTab-CLEVHQTj.js +1 -0
  20. package/dist/assets/PromptInjectionsTab-CnlX7r8C.js +4 -0
  21. package/dist/assets/RolesTab-orl-1HS-.js +1 -0
  22. package/dist/assets/ServiceAccountsTab-CtwpNIDj.js +1 -0
  23. package/dist/assets/{SubAgentReportsTab-DDkU2OZ0.js → SubAgentReportsTab-MRixaruJ.js} +1 -1
  24. package/dist/assets/ThemeShowroom-BCYOO2fm.js +1 -0
  25. package/dist/assets/{TimeRangePicker-CZSYqXhd.js → TimeRangePicker-Cm5l2vkz.js} +1 -1
  26. package/dist/assets/TracesTab-BATP4Ee5.js +1 -0
  27. package/dist/assets/UsersTab-CN9dGPvE.js +1 -0
  28. package/dist/assets/VoiceTab-DJyEAu0o.js +1 -0
  29. package/dist/assets/{button-D5AXX04a.js → button-B4Nos6AU.js} +1 -1
  30. package/dist/assets/{card-DYY__lMj.js → card-DhM6Y5He.js} +1 -1
  31. package/dist/assets/chevrons-up-down-Du6glRFD.js +1 -0
  32. package/dist/assets/{compatView-DWV4JVj_.js → compatView-DwEzKEAD.js} +1 -1
  33. package/dist/assets/dispatchErrorInfo-C27wKMfE.js +1 -0
  34. package/dist/assets/dist-BTpttlbH.js +44 -0
  35. package/dist/assets/{dist-Cy-5Eo9H.js → dist-BwHHVs_B.js} +1 -1
  36. package/dist/assets/{dist-fE9pwpr-.js → dist-BzsC63K9.js} +1 -1
  37. package/dist/assets/{dist-DVwJLFHG.js → dist-qfxevi2g.js} +1 -1
  38. package/dist/assets/{highlighted-body-OFNGDK62-BAuJrSyk.js → highlighted-body-OFNGDK62-DUhXym2u.js} +1 -1
  39. package/dist/assets/{index-CaPvOhvq.css → index-CnCsAZYf.css} +1 -1
  40. package/dist/assets/index-GIhUlE6M.js +233 -0
  41. package/dist/assets/mermaid-GHXKKRXX-D_CGWBHm.js +1 -0
  42. package/dist/assets/{pdf-Di4Z0VhC.js → pdf-BjDyP8tM.js} +1 -1
  43. package/dist/assets/roleDescriptions-8ML7Rdme.js +1 -0
  44. package/dist/assets/{table-BDhz0ajJ.js → table-BBE4oFvW.js} +1 -1
  45. package/dist/assets/{tabs-Cd17i-th.js → tabs-DlXyYN7h.js} +1 -1
  46. package/dist/assets/x-BLHWZzIt.js +1 -0
  47. package/dist/index.html +8 -8
  48. package/package.json +1 -1
  49. package/dist/assets/AgentFilesTab-DgC5PVEh.js +0 -3
  50. package/dist/assets/AnomaliesTab-D_NGV0y1.js +0 -1
  51. package/dist/assets/AuditTab-Rr5xuXKd.js +0 -1
  52. package/dist/assets/BridgeTab-Cg51jMGo.js +0 -1
  53. package/dist/assets/ChatDefaultsTab-3cQQbcJp.js +0 -1
  54. package/dist/assets/FeedbacksTab-Bvdu_42J.js +0 -1
  55. package/dist/assets/FilesTab-Dizy2z9U.js +0 -1
  56. package/dist/assets/InstancesTab-CTlgjqaF.js +0 -1
  57. package/dist/assets/IntegrationsTab-DDj4VHj-.js +0 -1
  58. package/dist/assets/KpiTab-CxrZ8A9u.js +0 -1
  59. package/dist/assets/PreferencesTab-4GLPWMHl.js +0 -1
  60. package/dist/assets/PromptInjectionsTab-dPl70NdT.js +0 -4
  61. package/dist/assets/RolesTab-CmIvQLbD.js +0 -1
  62. package/dist/assets/ServiceAccountsTab-kzUegapD.js +0 -1
  63. package/dist/assets/ThemeShowroom-ClrciIxw.js +0 -1
  64. package/dist/assets/TracesTab-CYp5UZUL.js +0 -1
  65. package/dist/assets/UsersTab-CeGA0ymg.js +0 -1
  66. package/dist/assets/VoiceTab-DfO3ivrS.js +0 -1
  67. package/dist/assets/chevrons-up-down-C-bHailH.js +0 -1
  68. package/dist/assets/dispatchErrorInfo-BtpDRwp-.js +0 -1
  69. package/dist/assets/dist-CGzSsL4i.js +0 -44
  70. package/dist/assets/index-B0Kloary.js +0 -233
  71. package/dist/assets/mermaid-GHXKKRXX-DqdnANNu.js +0 -1
  72. package/dist/assets/roleDescriptions-BXezQ4Y4.js +0 -1
  73. package/dist/assets/x-CQuunpf5.js +0 -1
@@ -0,0 +1 @@
1
+ import{Fy as e,Iy as t,Ly as n,Py as r,Ry as i}from"./dist-BTpttlbH.js";var a={pending:i,user:n,admin:t,observer:e,agent:r};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-CGzSsL4i.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-BTpttlbH.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-CGzSsL4i.js";import{t as d}from"./dist-Cy-5Eo9H.js";import{Dt as f,Et as p,Ot as m}from"./index-B0Kloary.js";var h=t(e(),1),g=n(),_=`Tabs`,[v,y]=a(_,[m]),b=m(),[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)(f,{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-BTpttlbH.js";import{t as d}from"./dist-BwHHVs_B.js";import{Dt as f,Et as p,Ot as m}from"./index-GIhUlE6M.js";var h=t(e(),1),g=n(),_=`Tabs`,[v,y]=a(_,[m]),b=m(),[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)(f,{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-BTpttlbH.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
@@ -53,15 +53,15 @@
53
53
  document.documentElement.dataset.motion = "static";
54
54
  })();
55
55
  </script>
56
- <script type="module" crossorigin src="/assets/index-B0Kloary.js"></script>
56
+ <script type="module" crossorigin src="/assets/index-GIhUlE6M.js"></script>
57
57
  <link rel="modulepreload" crossorigin href="/assets/bundle-mjs-C73ZY4La.js">
58
- <link rel="modulepreload" crossorigin href="/assets/dist-CGzSsL4i.js">
59
- <link rel="modulepreload" crossorigin href="/assets/dist-Cy-5Eo9H.js">
60
- <link rel="modulepreload" crossorigin href="/assets/dist-DVwJLFHG.js">
61
- <link rel="modulepreload" crossorigin href="/assets/dist-fE9pwpr-.js">
62
- <link rel="modulepreload" crossorigin href="/assets/x-CQuunpf5.js">
63
- <link rel="modulepreload" crossorigin href="/assets/button-D5AXX04a.js">
64
- <link rel="stylesheet" crossorigin href="/assets/index-CaPvOhvq.css">
58
+ <link rel="modulepreload" crossorigin href="/assets/dist-BTpttlbH.js">
59
+ <link rel="modulepreload" crossorigin href="/assets/dist-BwHHVs_B.js">
60
+ <link rel="modulepreload" crossorigin href="/assets/dist-qfxevi2g.js">
61
+ <link rel="modulepreload" crossorigin href="/assets/dist-BzsC63K9.js">
62
+ <link rel="modulepreload" crossorigin href="/assets/x-BLHWZzIt.js">
63
+ <link rel="modulepreload" crossorigin href="/assets/button-B4Nos6AU.js">
64
+ <link rel="stylesheet" crossorigin href="/assets/index-CnCsAZYf.css">
65
65
  </head>
66
66
  <body>
67
67
  <div id="root"></div>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lacneu/atrium",
3
- "version": "0.48.0",
3
+ "version": "0.50.0",
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{Ac as r,Ar as i,Bc as a,Br as o,Cc as s,Cr as c,Dc as l,Dr as u,E as d,Ec as f,Er as p,FE as m,Fc as h,Fr as g,Hr as _,Ic as v,Ir as y,Jj as b,Kj as x,Lc as S,Lr as C,Mc as w,Mr as T,Nc as E,Nr as D,Oc as O,Or as k,Pc as A,Pr as j,Qj as M,Rc as ee,Rr as te,Sc as N,Sl as ne,Sr as P,Tc as F,Tr as I,Vc as L,Vr as R,_c as re,bc as ie,dr as ae,eM as z,fc as B,fr as V,gc as oe,hc as se,hr as H,jc as ce,jr as U,kc as le,kr as ue,lr as de,mc as fe,mr as pe,pc as me,pr as he,tM as W,ur as ge,vc as _e,wc as ve,wl as G,wr as ye,xc as be,yc as xe,zc as Se,zr as Ce}from"./dist-CGzSsL4i.js";import{t as K}from"./button-D5AXX04a.js";import{At as q,C as we,G as Te,H as Ee,J as De,K as Oe,S as ke,U as Ae,W as je,Y as Me,b as Ne,ct as Pe,dt as Fe,ft as Ie,ht as Le,mt as Re,q as ze,ut as Be,w as Ve,x as He,xt as Ue,y as We,z as J}from"./index-B0Kloary.js";import{n as Ge,t as Ke}from"./curation-CQksaIbm.js";import{i as qe}from"./compatView-DWV4JVj_.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=W(d.me.getMe,{host:Ue}),t=e?.role===`admin`,n=(e?.permissions??[]).includes(`bridge.read`),i=W(d.admin.listInstances,e!==void 0&&t?{}:`skip`),[o,s]=(0,Y.useState)(null);(0,Y.useEffect)(()=>{!t||!i||i.length===0||(!o||!i.some(e=>e.name===o))&&s(i[0].name)},[t,i,o]);let c=W(d.agents.listAgentsForInstance,t&&o?{instanceName:o}:`skip`),l=W(d.agents.listMyAgents,e!==void 0&&!t?{}:`skip`),u=(0,Y.useMemo)(()=>{if(e!==void 0){if(t)return o===null||c===void 0?i!==void 0&&i.length===0?[]:void 0:c.agents.map(e=>({instanceName:o,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,o,c,i,l]),[f,p]=(0,Y.useState)(null);(0,Y.useEffect)(()=>{!u||u.length===0||(!f||!u.some(e=>$(e)===f))&&p($(u[0]))},[u,f]);let m=u?.find(e=>$(e)===f)??null,g=M(d.agentFiles.listAgentFiles),[_,y]=(0,Y.useState)({status:`idle`}),T=m?.instanceName??null,D=m?.agentId??null,O=W(d.compat.forInstance,n&&T!==null?{instanceName:T}:`skip`),k=n&&T!==null?We(O,`agentFiles`):null,j=k===null?!1:k===`loading`?null:k.blocked,N=(0,Y.useCallback)(async()=>{if(!(T===null||D===null)){y({status:`loading`});try{y({status:`done`,files:(await g({instanceName:T,agentId:D})).files})}catch{y({status:`error`})}}},[g,T,D]);(0,Y.useEffect)(()=>{j===!1&&N()},[N,j]);let[P,F]=(0,Y.useState)(null),I=W(d.agentFileCuration.listCurations,t&&T!==null&&D!==null?{instanceName:T,agentId:D}:`skip`),R=W(d.agentFileCuration.curationSettings,t&&T!==null?{instanceName:T}:`skip`),re=M(d.agentFileCuration.requestCuration),[ie,ae]=(0,Y.useState)(null),[z,B]=(0,Y.useState)(null),{toast:V}=J(),oe=(0,Y.useMemo)(()=>{let e=new Map;for(let t of I??[])e.has(t.name)||e.set(t.name,t);return e},[I]),se=(0,Y.useCallback)(async e=>{if(!(T===null||D===null)){ae(e);try{let t=await re({instanceName:T,agentId:D,name:e,trigger:`manual`});t.ok?V({title:Ce(),variant:`success`}):V({title:te({reason:t.reason??`unknown`}),variant:`error`})}catch{V({title:C(),variant:`error`})}finally{ae(null)}}},[re,T,D,V]),H=b(),U=(0,Y.useMemo)(()=>new Intl.NumberFormat(H,{maximumFractionDigits:0}),[H]);return e===void 0||u===void 0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:x()}):(0,Q.jsxs)(`div`,{className:`oc-afiles`,children:[(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:L()}),(0,Q.jsxs)(`div`,{className:`oc-afiles__picker`,children:[t&&(i?.length??0)>1?(0,Q.jsxs)(Ne,{value:o??``,onValueChange:e=>s(e),children:[(0,Q.jsx)(we,{size:`sm`,"aria-label":a(),children:(0,Q.jsx)(Ve,{})}),(0,Q.jsx)(He,{children:(i??[]).map(e=>(0,Q.jsx)(ke,{value:e.name,children:e.name},e.name))})]}):null,u.length>0?(0,Q.jsxs)(Ne,{value:f??``,onValueChange:e=>p(e),children:[(0,Q.jsx)(we,{size:`sm`,"aria-label":Se(),children:(0,Q.jsx)(Ve,{})}),(0,Q.jsx)(He,{children:u.map(e=>(0,Q.jsx)(ke,{value:$(e),children:e.label},$(e)))})]}):(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:ee()})]}),m===null?null:k===`loading`?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:x()}):k!==null&&k.blocked?(0,Q.jsxs)(`p`,{className:`oc-compat__blocked`,role:`status`,children:[(0,Q.jsx)(q,{size:14,"aria-hidden":!0}),` `,qe(k.gatewayVersion,k.provider)]}):_.status===`loading`||_.status===`idle`?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:x()}):_.status===`error`?(0,Q.jsxs)(`p`,{className:`oc-afiles__error`,role:`alert`,children:[v(),` `,(0,Q.jsx)(K,{variant:`outline`,size:`sm`,onClick:()=>void N(),children:ne()})]}):_.files.length===0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:S()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`div`,{className:`oc-afiles__list`,children:_.files.map(e=>{let n=Ye(e.size),i=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)(Pe,{variant:`outline`,children:h()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`span`,{className:`oc-afiles__size`,children:A({size:Z(e.size,H)})}),(0,Q.jsx)(`span`,{className:`oc-afiles__gauge${i?` 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:E({pct:U.format(n)})}),i?(0,Q.jsx)(q,{size:14,className:`oc-afiles__warn`,"aria-label":w()}):(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:()=>F(e),children:t?r():le()}),t&&!e.missing?(0,Q.jsx)(nt,{curatable:Ke.includes(e.name),size:e.size??0,budget:R?.budgetChars??null,enabled:R?.enabled??!1,curation:oe.get(e.name)??null,inFlight:ie===e.name,onCurate:()=>void se(e.name),onReview:e=>B(e)}):null]},e.name)})}),(0,Q.jsx)(`p`,{className:`oc-afiles__budget`,children:ce({used:Z(Ze(_.files),H),total:Z(Je,H),pct:U.format(Xe(Ze(_.files)))})})]}),P&&m?(0,Q.jsx)(rt,{instanceName:m.instanceName,agentId:m.agentId,name:P.name,isAdmin:t,onClose:()=>F(null),onSaved:()=>void N()}):null,z?(0,Q.jsx)(it,{curationId:z,onClose:()=>B(null),onApplied:()=>{B(null),N()}}):null]})}function nt({curatable:e,size:t,budget:n,enabled:r,curation:i,inFlight:a,onCurate:s,onReview:c}){return i?.status===`proposed`?(0,Q.jsx)(K,{variant:`default`,size:`sm`,className:`oc-afiles__curate`,onClick:()=>c(i._id),children:R()}):a||i?.status===`dispatched`||i?.status===`applying`?(0,Q.jsx)(Pe,{variant:`outline`,className:`oc-afiles__curate-status`,children:o()}):e&&r&&n!==null&&Ge(t,n)?(0,Q.jsx)(K,{variant:`outline`,size:`sm`,className:`oc-afiles__curate`,onClick:s,children:_()}):null}function rt({instanceName:e,agentId:t,name:n,isAdmin:r,onClose:i,onSaved:a}){let o=M(d.agentFiles.getAgentFile),c=M(d.agentFiles.setAgentFile),u=J(),[p,h]=(0,Y.useState)(null),[g,_]=(0,Y.useState)(!1),[v,y]=(0,Y.useState)(``),[S,C]=(0,Y.useState)(!1),[w,T]=(0,Y.useState)(!1),[E,D]=(0,Y.useState)(!1),[k,A]=(0,Y.useState)(!1),j=(0,Y.useCallback)(async r=>{_(!1);try{let i=await o({instanceName:e,agentId:t,name:n});h({content:i.content,updatedAtMs:i.updatedAtMs}),r||y(i.content),D(!1)}catch{_(!0)}},[o,e,t,n]);(0,Y.useEffect)(()=>{j(!1)},[j]);async function ee(){if(p!==null){T(!0),A(!1);try{await c({instanceName:e,agentId:t,name:n,content:v,baseUpdatedAtMs:p.updatedAtMs??void 0}),u.success(N({name:n})),a(),await j(!1)}catch(e){et(e)?D(!0):A(!0)}finally{T(!1)}}}let te=p!==null&&v!==p.content,P=(0,Y.useMemo)(()=>p===null?null:$e(p.content,v),[p,v]),I=v.length>X,L=b(),R=(0,Y.useMemo)(()=>new Intl.NumberFormat(L),[L]);return(0,Q.jsx)(Be,{open:!0,onOpenChange:e=>!e&&i(),children:(0,Q.jsxs)(Fe,{className:`oc-afiles__editor`,children:[(0,Q.jsxs)(Re,{children:[(0,Q.jsx)(Le,{children:O({name:n})}),(0,Q.jsxs)(Ie,{children:[l({agent:t,instance:e}),r?null:(0,Q.jsxs)(Q.Fragment,{children:[` · `,f()]})]})]}),g?(0,Q.jsxs)(`p`,{className:`oc-afiles__error`,role:`alert`,children:[ie(),` `,(0,Q.jsx)(K,{variant:`outline`,size:`sm`,onClick:()=>void j(!1),children:ne()})]}):p===null?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:x()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`textarea`,{className:`oc-afiles__source`,value:v,readOnly:!r,spellCheck:!1,onChange:e=>y(e.target.value),"aria-label":O({name:n})}),(0,Q.jsx)(`p`,{className:`oc-afiles__hint`,children:F()}),E?(0,Q.jsxs)(`p`,{className:`oc-afiles__error`,role:`alert`,children:[xe(),` `,(0,Q.jsx)(K,{variant:`outline`,size:`sm`,onClick:()=>void j(!0),children:_e()})]}):null,k?(0,Q.jsx)(`p`,{className:`oc-afiles__error`,role:`alert`,children:be()}):null,(0,Q.jsxs)(`div`,{className:`oc-afiles__editor-foot`,children:[(0,Q.jsx)(`span`,{className:`oc-afiles__count${I?` is-over`:``}`,children:ve({count:R.format(v.length),max:R.format(X)})}),r?(0,Q.jsx)(K,{size:`sm`,disabled:!te||w||E,onClick:()=>C(!0),children:w?G():s()}):null]})]}),(0,Q.jsx)(Ee,{open:S,onOpenChange:C,children:(0,Q.jsxs)(Te,{children:[(0,Q.jsxs)(De,{children:[(0,Q.jsx)(Me,{children:re({name:n})}),(0,Q.jsx)(Oe,{children:oe({agent:t})})]}),P?(0,Q.jsxs)(`div`,{className:`oc-afiles__diff`,children:[(0,Q.jsx)(`p`,{className:`oc-afiles__diff-counts`,children:se({added:P.added,removed:P.removed})}),P.sampleAdded.length>0?(0,Q.jsxs)(`div`,{className:`oc-afiles__diff-block`,children:[(0,Q.jsx)(`span`,{className:`oc-afiles__diff-label`,children:fe()}),P.sampleAdded.map((e,t)=>(0,Q.jsx)(`code`,{className:`oc-afiles__diff-line is-add`,children:e||` `},t))]}):null,P.sampleRemoved.length>0?(0,Q.jsxs)(`div`,{className:`oc-afiles__diff-block`,children:[(0,Q.jsx)(`span`,{className:`oc-afiles__diff-label`,children:me()}),P.sampleRemoved.map((e,t)=>(0,Q.jsx)(`code`,{className:`oc-afiles__diff-line is-del`,children:e||` `},t))]}):null]}):null,(0,Q.jsxs)(ze,{children:[(0,Q.jsx)(je,{children:m()}),(0,Q.jsx)(Ae,{onClick:()=>void ee(),children:B()})]})]})})]})})}function it({curationId:e,onClose:t,onApplied:n}){let r=W(d.agentFileCuration.getProposal,{curationId:e}),a=M(d.agentFileCuration.approveCuration),o=z(d.agentFileCuration.rejectCuration),{toast:s}=J(),[l,f]=(0,Y.useState)(null),[m,h]=(0,Y.useState)(!1),[_,v]=(0,Y.useState)(``),S=b(),w=(0,Y.useMemo)(()=>r?$e(r.beforeContent,r.proposedContent):null,[r]);async function E(){f(`approve`);try{let t=await a({curationId:e});t.ok?(s({title:y(),variant:`success`}),n()):s({title:t.reason===`conflict`?j():D({reason:t.reason??`unknown`}),variant:`error`})}catch{s({title:C(),variant:`error`})}finally{f(null)}}async function O(n){f(`reject`);try{let r=_.trim();(await o({curationId:e,...r?{comment:r}:{},relaunch:n})).ok?s({title:n?ge():g(),variant:`success`}):s({title:i(),variant:`error`}),t()}catch{s({title:C(),variant:`error`})}finally{f(null)}}return(0,Q.jsx)(Be,{open:!0,onOpenChange:e=>e?void 0:t(),children:(0,Q.jsxs)(Fe,{className:`oc-afiles__review`,children:[(0,Q.jsxs)(Re,{children:[(0,Q.jsx)(Le,{children:r?T({name:r.name}):x()}),(0,Q.jsx)(Ie,{children:U()})]}),r===void 0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:x()}):r===null?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:i()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`p`,{className:`oc-afiles__review-sizes`,children:[ue({before:Z(r.beforeSize,S),after:Z(r.proposedSize,S)}),r.overBudget?(0,Q.jsxs)(Q.Fragment,{children:[` `,(0,Q.jsx)(q,{size:13,"aria-hidden":!0}),` `,k()]}):null]}),w?(0,Q.jsx)(`p`,{className:`oc-afiles__review-diff`,children:u({added:w.added,removed:w.removed})}):null,r.feedback?(0,Q.jsx)(`p`,{className:`oc-afiles__review-feedback`,children:de({feedback:r.feedback})}):null,w&&w.sampleRemoved.length>0?(0,Q.jsxs)(`div`,{className:`oc-afiles__review-removed`,children:[(0,Q.jsx)(`p`,{className:`oc-afiles__review-label`,children:P()}),(0,Q.jsx)(`ul`,{children:w.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:c()}),(0,Q.jsx)(`pre`,{className:`oc-afiles__review-pre`,children:r.beforeContent})]}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`p`,{className:`oc-afiles__review-label`,children:p()}),(0,Q.jsx)(`pre`,{className:`oc-afiles__review-pre`,children:r.proposedContent})]})]})]}),m?(0,Q.jsxs)(`div`,{className:`oc-afiles__reject-form`,children:[(0,Q.jsx)(`label`,{className:`oc-afiles__review-label`,htmlFor:`curation-reject-comment`,children:H()}),(0,Q.jsx)(`textarea`,{id:`curation-reject-comment`,className:`oc-afiles__reject-textarea`,rows:3,placeholder:pe(),value:_,onChange:e=>v(e.target.value)}),(0,Q.jsxs)(`div`,{className:`oc-afiles__review-actions`,children:[(0,Q.jsx)(K,{variant:`ghost`,onClick:()=>h(!1),disabled:l!==null,children:he()}),(0,Q.jsx)(K,{variant:`outline`,onClick:()=>void O(!1),disabled:l!==null,children:l===`reject`?G():V()}),(0,Q.jsx)(K,{variant:`default`,onClick:()=>void O(!0),disabled:l!==null,children:l===`reject`?G():ae()})]})]}):(0,Q.jsxs)(`div`,{className:`oc-afiles__review-actions`,children:[(0,Q.jsx)(K,{variant:`outline`,onClick:()=>h(!0),disabled:l!==null||r==null,children:I()}),(0,Q.jsx)(K,{variant:`default`,onClick:()=>void E(),disabled:l!==null||r==null,children:l===`approve`?G():ye()})]})]})})}export{tt as AgentFilesTab};
@@ -1 +0,0 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$v as r,Av as i,Bv as a,Dv as o,E as s,Fv as c,Gv as ee,Hv as l,Iv as te,Jv as ne,Kv as u,Lv as d,Mv as f,Nv as p,Ov as m,Pv as h,Qv as g,Rv as re,Uv as ie,Vv as ae,Wv as _,Xv as oe,Yv as se,Zv as ce,ay as le,cy as ue,dy as de,eM as fe,ey as pe,fy as me,hy as v,iy as he,jv as ge,kv as y,ly as b,my as x,ny as S,oy as C,py as w,qv as T,ry as E,sy as D,tM as O,ty as k,uy as A,zv as j}from"./dist-CGzSsL4i.js";import{B as M,C as N,S as P,Xt as F,Yt as I,a as L,b as R,ct as z,et as _e,r as ve,w as B,x as V,xt as ye,z as be}from"./index-B0Kloary.js";import{n as xe}from"./TimeRangePicker-CZSYqXhd.js";import{t as Se}from"./FilterBar-Dy10_IPZ.js";import{t as Ce}from"./DataTableShell-Bzopt4OT.js";import{t as H}from"./dispatchErrorInfo-BtpDRwp-.js";var U=t(e(),1),W=n(),G=`__all__`,we=[{value:`open`},{value:`acknowledged`},{value:`resolved`}];function Te(e){return e===`open`?v():e===`acknowledged`?x():w()}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=I({from:`/settings/anomalies`}),n=e.q??``,i=e.status===K?G:e.status,o=e.severity??G,m=e.kind??G,[v,y]=(0,U.useState)(G),x=ve(e.from,e.to),{from:w,to:H}=xe(x),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,...L(e)})}),Ie=M(),X=be(),Z=fe(s.anomalies.resolveAnomaly),Le=(O(s.me.getMe,{host:ye})?.permissions??[]).includes(`admin.manage`),Q=O(s.anomalies.listAnomalies,{limit:ke,filter:{q:n||void 0,from:w,to:H,anomalyStatus:i===G?void 0:i,severity:o===G?void 0:o,source:v===G?void 0:v,kind:m===G?void 0:m}}),$=(0,U.useMemo)(()=>{let e=new Set;for(let t of Q??[])e.add(t.kind);return[...e].sort()},[Q]),Re=n!==``||i!==`open`||o!==G||v!==G||m!==G||x.kind!==`relative`||x.from!==Oe.from;function ze(){y(G),t({search:{status:`open`},replace:!0})}async function Be(e){if(await Ie({title:me(),description:(0,W.jsxs)(W.Fragment,{children:[de(),` `,(0,W.jsx)(`span`,{className:`font-mono`,children:e.kind}),` `,A(),` `,(0,W.jsx)(`strong`,{children:b()}),`.`,` `,ue()]}),confirmLabel:D()}))try{await Z({anomalyId:e._id,status:`resolved`}),X.success(C(),e.kind)}catch(e){X.error(le(),e)}}async function Ve(e){try{await Z({anomalyId:e._id,status:`acknowledged`}),X.success(he(),e.kind)}catch(e){X.error(E(),e)}}return(0,W.jsxs)(W.Fragment,{children:[(0,W.jsxs)(`p`,{className:`oc-admin__hint`,children:[S(),` `,(0,W.jsx)(`strong`,{children:k()}),` `,pe(),` `,(0,W.jsx)(`strong`,{children:r()}),` `,g(),` `,(0,W.jsx)(`strong`,{children:ce()}),` `,oe(),` `,(0,W.jsx)(`span`,{className:`oc-filter__window`,children:se()})]}),(0,W.jsxs)(Se,{q:n,onQChange:q,searchPlaceholder:ne(),timeRange:x,onTimeRangeChange:Fe,onReset:ze,canReset:Re,children:[(0,W.jsxs)(R,{value:i,onValueChange:J,children:[(0,W.jsx)(N,{size:`sm`,className:`w-36`,children:(0,W.jsx)(B,{})}),(0,W.jsxs)(V,{children:[(0,W.jsx)(P,{value:G,children:T()}),we.map(e=>(0,W.jsx)(P,{value:e.value,children:Te(e.value)},e.value))]})]}),(0,W.jsxs)(R,{value:o,onValueChange:Y,children:[(0,W.jsx)(N,{size:`sm`,className:`w-36`,children:(0,W.jsx)(B,{placeholder:u()})}),(0,W.jsxs)(V,{children:[(0,W.jsx)(P,{value:G,children:ee()}),Ee.map(e=>(0,W.jsx)(P,{value:e,children:e},e))]})]}),(0,W.jsxs)(R,{value:v,onValueChange:y,children:[(0,W.jsx)(N,{size:`sm`,className:`w-32`,children:(0,W.jsx)(B,{placeholder:_()})}),(0,W.jsxs)(V,{children:[(0,W.jsx)(P,{value:G,children:ie()}),De.map(e=>(0,W.jsx)(P,{value:e,children:e},e))]})]}),(0,W.jsxs)(R,{value:m,onValueChange:Pe,children:[(0,W.jsx)(N,{size:`sm`,className:`w-36`,children:(0,W.jsx)(B,{placeholder:l()})}),(0,W.jsxs)(V,{children:[(0,W.jsx)(P,{value:G,children:ae()}),$.map(e=>(0,W.jsx)(P,{value:e,children:e},e))]})]})]}),(0,W.jsx)(Ce,{title:a(),rows:Q,emptyHint:i===`open`?j():re(),rowActions:e=>Le&&e.status===`open`?[{label:d(),onSelect:()=>void Be(e)},{label:te(),onSelect:()=>void Ve(e)}]:[],columns:[{header:c(),cell:e=>(0,W.jsx)(`span`,{className:`oc-traces__time`,children:_e(e.at)}),sort:e=>e.at},{header:l(),cell:e=>(0,W.jsx)(`code`,{className:`oc-traces__mono`,children:e.kind}),sort:e=>e.kind},{header:u(),cell:e=>(0,W.jsx)(je,{severity:e.severity}),sort:e=>e.severity===`critical`?2:+(e.severity===`warn`)},{header:h(),cell:e=>(0,W.jsx)(Me,{status:e.status}),sort:e=>e.status===`resolved`?2:+(e.status===`acknowledged`)},{header:_(),cell:e=>(0,W.jsx)(z,{variant:`outline`,children:e.source}),sort:e=>e.source},{header:p(),cell:e=>(0,W.jsx)(`span`,{className:`oc-anomaly__msg`,children:e.message}),sort:e=>e.message},{header:f(),cell:e=>(0,W.jsx)(Ae,{row:e}),sort:e=>e.evidence??null},{header:ge(),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=I();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:[`↗ `,i()]}):null]})}let n=J(e);if(!n.dominantCode)return(0,W.jsx)(`span`,{className:`oc-traces__muted`,children:`—`});let r=H(n.dominantCode),a=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}),a?(0,W.jsxs)(`button`,{type:`button`,className:`oc-anomaly__drill`,onClick:()=>void t({to:`/settings/traces`,search:{q:a,limit:100}}),children:[`↗ `,i()]}):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)(z,{variant:`destructive`,children:y()}):e===`acknowledged`?(0,W.jsx)(z,{variant:`secondary`,children:m()}):(0,W.jsx)(z,{variant:`outline`,children:o()})}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{E as r,Sn as i,_b as a,_n as o,bb as s,bn as c,cb as l,db as u,fb as d,gb as f,hb as p,lb as m,mb as h,ob as g,pb as _,sb as v,tM as y,ub as b,vb as x,vn as S,xn as C,yb as w,yn as T}from"./dist-CGzSsL4i.js";import{C as E,S as D,Xt as O,Yt as k,a as A,b as j,et as M,i as N,o as P,r as F,t as I,w as L,x as R}from"./index-B0Kloary.js";import{n as ee}from"./TimeRangePicker-CZSYqXhd.js";import{t as z}from"./FilterBar-Dy10_IPZ.js";import{t as B}from"./AdvancedFilter-B6lCXnk_.js";import{t as V}from"./DataTableShell-Bzopt4OT.js";var H=t(e(),1),U=n(),W={kind:`relative`,from:I,to:`now`},G=`__all__`,K=[{value:`action`,label:i()},{value:`realLabel`,label:C()},{value:`targetLabel`,label:c()},{value:`impersonated`,label:T()},{value:`resource`,label:S()},{value:`resourceId`,label:o()}];function q(){let e=O({from:`/settings/audit`}),t=k({from:`/settings/audit`}),n=e.q??``,i=e.action??G,o=e.impersonated??G,c=e.resource??G,S=F(e.from,e.to),C=(0,H.useMemo)(()=>P(e.adv),[e.adv]),{from:T,to:I}=ee(S),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,...A(e)})}),Q=e=>void t({search:t=>({...t,adv:N(e)}),replace:!0}),$=y(r.admin.listAudit,{filter:{q:n||void 0,from:T,to:I,action:i===G?void 0:i,resource:c===G?void 0:c,impersonated:o===G?void 0:o===`yes`,advanced:C.length>0?C: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!==``||i!==G||o!==G||c!==G||C.length>0||S.kind!==`relative`||S.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:[s(),` `,(0,U.jsx)(`span`,{className:`oc-filter__window`,children:w()})]}),(0,U.jsxs)(z,{q:n,onQChange:q,searchPlaceholder:x(),timeRange:S,onTimeRangeChange:Z,onReset:ie,canReset:re,children:[(0,U.jsxs)(j,{value:i,onValueChange:J,children:[(0,U.jsx)(E,{size:`sm`,className:`w-40`,children:(0,U.jsx)(L,{placeholder:a()})}),(0,U.jsxs)(R,{children:[(0,U.jsx)(D,{value:G,children:f()}),te.map(e=>(0,U.jsx)(D,{value:e,children:e},e))]})]}),(0,U.jsxs)(j,{value:o,onValueChange:Y,children:[(0,U.jsx)(E,{size:`sm`,className:`w-40`,children:(0,U.jsx)(L,{})}),(0,U.jsxs)(R,{children:[(0,U.jsx)(D,{value:G,children:p()}),(0,U.jsx)(D,{value:`yes`,children:h()}),(0,U.jsx)(D,{value:`no`,children:_()})]})]}),(0,U.jsxs)(j,{value:c,onValueChange:X,children:[(0,U.jsx)(E,{size:`sm`,className:`w-40`,children:(0,U.jsx)(L,{placeholder:d()})}),(0,U.jsxs)(R,{children:[(0,U.jsx)(D,{value:G,children:u()}),ne.map(e=>(0,U.jsx)(D,{value:e,children:e},e))]})]})]}),(0,U.jsx)(B,{fields:K,seed:C,onChange:Q}),(0,U.jsx)(V,{title:b(),rows:$,emptyHint:m(),columns:[{header:l(),cell:e=>M(e.at),sort:e=>e.at},{header:a(),cell:e=>e.action,sort:e=>e.action},{header:v(),cell:e=>e.realLabel,sort:e=>e.realLabel},{header:g(),cell:e=>e.targetLabel??`—`,sort:e=>e.targetLabel??null},{header:d(),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,$s as i,Ah as a,Bh as o,Bt as s,Cg as c,Ch as l,D as u,Dg as d,Dh as f,E as p,Eh as m,Fh as h,Gh as ee,Gs as g,Hh as te,Ht as _,Ih as v,Js as y,Kh as ne,Ks as re,Kt as b,Lh as ie,Mh as ae,Nh as oe,Og as se,Oh as ce,Ph as le,Qj as ue,Qm as de,Qs as fe,Rh as pe,Sg as me,Sh as he,Tg as ge,Th as _e,Uh as ve,Us as ye,Ut as be,Vh as xe,Vt as Se,Wh as Ce,Ws as we,Xs as Te,Ys as Ee,Zm as De,Zs as Oe,_h as ke,ah as Ae,bg as je,bh as Me,ch as Ne,dh as x,eM as Pe,ec as Fe,eh as Ie,fh as Le,gh as Re,hg as ze,hh as Be,ih as Ve,jh as He,kh as Ue,lh as We,mg as Ge,mh as Ke,nh as qe,oh as Je,ph as Ye,qs as Xe,rh as Ze,sh as Qe,tM as S,tc as $e,th as et,uh as tt,vg as nt,vh as rt,wg as it,wh as at,xg as ot,xh as st,yg as ct,yh as lt,zh as ut,zs as dt,zt as ft}from"./dist-CGzSsL4i.js";import{i as C,r as pt}from"./dist-Cy-5Eo9H.js";import{t as mt}from"./chevrons-up-down-C-bHailH.js";import{i as ht,n as w,o as gt,r as _t,s as vt}from"./FieldLabel-RnB1EBjO.js";import{i as yt,n as bt,r as xt,t as St}from"./tabs-Cd17i-th.js";import{t as Ct}from"./button-D5AXX04a.js";import{At as T,C as E,Kt as wt,Nt as D,Q as Tt,S as O,X as Et,Xt as Dt,Yt as k,Z as Ot,b as A,ct as j,dt as kt,et as M,ft as At,ht as jt,lt as N,m as Mt,mt as Nt,p as Pt,qt as Ft,tt as P,ut as It,w as F,x as I,xt as Lt,z as Rt,zt}from"./index-B0Kloary.js";import{r as Bt}from"./locales-CPjguROj.js";import{a as Vt,i as L,n as R,o as z,r as B,t as V}from"./table-BDhz0ajJ.js";import{t as Ht}from"./FilterBar-Dy10_IPZ.js";import{a as H,n as Ut,o as U,r as W,s as Wt,t as Gt}from"./compatView-DWV4JVj_.js";import{t as G}from"./dispatchErrorInfo-BtpDRwp-.js";var Kt=u(`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=u(`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),[i,a]=(0,K.useState)(null),o=(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+(e.downstreamRejectCount??0),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]),s=(0,K.useMemo)(()=>sn(o),[o]),c=(0,K.useMemo)(()=>cn(o),[o]),l=(0,K.useMemo)(()=>ln(o),[o]),u=(0,K.useMemo)(()=>on(nn(o,n),i),[o,n,i]);function d(e){a(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:Be()}):(0,Q.jsxs)(`div`,{className:`oc-conn`,children:[(0,Q.jsxs)(Ht,{q:n.q,onQChange:e=>r(t=>({...t,q:e})),searchPlaceholder:Le(),onReset:()=>r(en),canReset:tn(n),children:[(0,Q.jsxs)(A,{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:tt()})}),(0,Q.jsxs)(I,{children:[(0,Q.jsx)(O,{value:Y,children:x()}),s.map(e=>(0,Q.jsx)(O,{value:e,children:fn(e)},e))]})]}),(0,Q.jsxs)(A,{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:We()})}),(0,Q.jsxs)(I,{children:[(0,Q.jsx)(O,{value:Y,children:x()}),c.map(e=>(0,Q.jsx)(O,{value:e.name,children:e.label},e.name))]})]}),(0,Q.jsxs)(A,{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:Ne()})}),(0,Q.jsxs)(I,{children:[(0,Q.jsx)(O,{value:Y,children:x()}),l.map(e=>(0,Q.jsx)(O,{value:e,children:e},e))]})]})]}),u.length===0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:Qe()}):(0,Q.jsxs)(V,{className:`oc-conn__table`,children:[(0,Q.jsx)(Vt,{children:(0,Q.jsxs)(z,{children:[(0,Q.jsx)($,{label:Je(),sortKey:`target`,sort:i,onSort:d}),(0,Q.jsx)($,{label:Ae(),sortKey:`state`,sort:i,onSort:d}),(0,Q.jsx)($,{label:Ve(),sortKey:`instance`,sort:i,onSort:d}),(0,Q.jsx)($,{label:Ze(),sortKey:`host`,sort:i,onSort:d}),(0,Q.jsx)($,{label:qe(),sortKey:`version`,sort:i,onSort:d}),(0,Q.jsx)(L,{children:et()}),(0,Q.jsx)($,{label:Ie(),sortKey:`lastOk`,sort:i,onSort:d})]})}),(0,Q.jsx)(R,{children:u.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)(L,{"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:Ke({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:P(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?` · ${P(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:[Ye({label:n.label}),` `,(0,Q.jsx)(`code`,{className:`oc-traces__mono`,children:e.lastDownstreamRejectCode}),e.lastDownstreamRejectAt?` · ${P(e.lastDownstreamRejectAt)}`:``]}):null]})}):null]})}function fn(e){return e===`connected`?r():e===`error`?de():De()}function pn({state:e}){return e===`connected`?(0,Q.jsx)(j,{variant:`secondary`,children:r()}):e===`error`?(0,Q.jsx)(j,{variant:`destructive`,children:de()}):(0,Q.jsx)(j,{variant:`outline`,children:De()})}function mn(){return S(p.bridgeHealth.getBridgeHealth,{})}function hn(){let e=mn(),t=S(p.compat.getBridgeCompat,{}),n=S(p.me.getMe,{host:Lt})?.role===`admin`,r=S(p.admin.listInstances,n?{}:`skip`),i=S(p.agents.usageForInstances,n?{}:`skip`),a=k(),o=()=>void a({to:`/settings/anomalies`,search:{status:`open`}}),c=$t(e?e.targets:[],t?t.targets:[],r??[]),{section:l}=Dt({from:`/settings/bridge`}),u=k({from:`/settings/bridge`}),d=t?.compat??null,f=t===void 0?`loading`:t===null?`nodata`:`ready`,m=d!==null&&Ut(d,`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:o}),(0,Q.jsx)(`p`,{className:`oc-admin__hint oc-bridge__caption`,children:ae()}),i&&i.length>0?(0,Q.jsxs)(`section`,{className:`oc-bridge__usage`,children:[(0,Q.jsx)(`h3`,{className:`oc-bridge__usage-title`,children:He()}),(0,Q.jsxs)(V,{children:[(0,Q.jsx)(Vt,{children:(0,Q.jsxs)(z,{children:[(0,Q.jsx)(L,{children:be()}),(0,Q.jsx)(L,{children:_()}),(0,Q.jsx)(L,{children:Se()}),(0,Q.jsx)(L,{children:s()}),(0,Q.jsx)(L,{children:ft()})]})}),(0,Q.jsx)(R,{children:i.flatMap(e=>{let t=Mt(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)(D,{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:d,compatStatus:f,compatReachable:t?.reachable??!0,protocol:e.key===`openclaw`?t?.protocol??null:null})},e.key))]}):null,m?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:dt()}):null]})}function gn({health:e,compat:t,onSeeAnomalies:n}){let r=t!=null&&t.buildVersion!=null&&t.bridgeVersion!=null&&t.buildVersion!==t.bridgeVersion,a=t?.buildRevision&&t.buildRevision!==`unknown`?t.buildRevision.slice(0,7):null,o=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)}),a?(0,Q.jsxs)(Q.Fragment,{children:[` `,(0,Q.jsxs)(`code`,{className:`oc-traces__mono`,title:i(),children:[`(`,a,`)`]})]}):null,r?(0,Q.jsxs)(`strong`,{className:`oc-bridge-card__mismatch`,children:[` `,fe({build:t.buildVersion??`?`})]}):null,` · `,Oe(),` `,(0,Q.jsx)(`code`,{className:`oc-traces__mono`,children:t.protocolVersion===null?Te():String(t.protocolVersion)})]}):null;if(e===void 0)return(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:at()});if(e===null)return(0,Q.jsx)(`div`,{className:`oc-bridge-card oc-bridge-card--idle`,children:l()});let s=Jt(e.targets),c=!e.reachable,u=Yt(e),d=u?`ok`:`error`,f=M(e.checkedAt),p=e.startedAt==null?null:M(e.startedAt);return(0,Q.jsxs)(`div`,{className:`oc-bridge-card oc-bridge-card--${d}`,children:[(0,Q.jsx)(`div`,{className:`oc-bridge-card__icon`,"aria-hidden":!0,children:u?(0,Q.jsx)(wt,{size:22}):c?(0,Q.jsx)(qt,{size:22}):(0,Q.jsx)(T,{size:22})}),(0,Q.jsxs)(`div`,{className:`oc-bridge-card__body`,children:[(0,Q.jsx)(`div`,{className:`oc-bridge-card__title`,children:u?he():c?st():Me({count:s.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}),` `,lt({time:f})]}),p?(0,Q.jsx)(`span`,{children:rt({time:p})}):null,o]}),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:ke()})]})}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)(D,{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:$e()}),(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)(Ft,{size:13,"aria-hidden":!0}),Re({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:[a(),i.length>0?(0,Q.jsx)(j,{variant:`destructive`,children:ce({count:i.length})}):(0,Q.jsx)(j,{variant:`secondary`,children:Ue()})]}),(0,Q.jsxs)(`p`,{className:`oc-admin__hint`,children:[f({version:e.vendoredVersion}),r?` · `+m({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)(Ft,{size:13,"aria-hidden":!0}),_e({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:at()}):t===`nodata`?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:Fe()}):(0,Q.jsxs)(`div`,{className:`oc-compat`,children:[n?null:(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:Ee()}),r===null?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:y()}):(0,Q.jsxs)(`div`,{className:`oc-compat__support`,children:[(0,Q.jsx)(`span`,{className:`oc-compat__label`,children:b({provider:a})}),e&&e.range!==null?(0,Q.jsx)(`span`,{children:Xe({min:e.range.min,max:e.range.maxValidated})}):(0,Q.jsx)(`span`,{children:Te()}),e?(0,Q.jsx)(Cn,{versions:e.validatedVersions}):null]}),i.length===0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:ye()}):(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)(It,{open:!0,onOpenChange:e=>!e&&t(),children:(0,Q.jsxs)(kt,{className:`oc-bridge-config-dialog`,onOpenAutoFocus:e=>e.preventDefault(),children:[(0,Q.jsxs)(Nt,{children:[(0,Q.jsx)(jt,{children:se({instance:e.displayName??e.name})}),(0,Q.jsx)(At,{children:d()})]}),(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)(wt,{"aria-hidden":!0}):(0,Q.jsx)(T,{"aria-hidden":!0}),(0,Q.jsxs)(`span`,{children:[e,` — `,t.ok?v():t.detail]})]}):(0,Q.jsxs)(`p`,{className:`oc-bridge-config__check-row oc-bridge-config__check-row--skip`,children:[e,` — `,h()]}):null}function Sn({instance:e,onClose:t}){let n=Pe(p.admin.upsertInstanceConfig),r=ue(p.bridge.validateMediaPaths),i=Rt(),a=Bt(e.config?.contentLocale,void 0),[s,l]=(0,K.useState)(()=>ht(e.config??{},a)),[u,d]=(0,K.useState)(!1),[f,m]=(0,K.useState)(!1),[h,g]=(0,K.useState)(null),_=s.inboundMediaMode===`shared-fs`,v=s.mediaMode===`shared-fs`,y=_||v;async function re(){m(!0),g(null);try{g(await r({instanceName:e.name,inboundMediaMode:s.inboundMediaMode,mediaMode:s.mediaMode}))}catch(e){i.error(o(),e)}finally{m(!1)}}async function b(){d(!0);try{let r=e.config??{};await n({instanceId:e._id,config:_t(s,r,a)}),t()}catch(e){i.error(je(),e)}finally{d(!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:ge(),help:ct()}),(0,Q.jsxs)(A,{value:s.mediaMode,onValueChange:e=>l({...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)(O,{value:e,children:e},e))})]})]}),(0,Q.jsxs)(`label`,{className:`oc-field`,children:[(0,Q.jsx)(w,{label:it(),help:nt()}),(0,Q.jsxs)(A,{value:s.inboundMediaMode,onValueChange:e=>l({...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)(O,{value:e,children:e},e))})]})]}),(0,Q.jsxs)(`label`,{className:`oc-field`,children:[(0,Q.jsx)(w,{label:c(),help:ze()}),(0,Q.jsx)(N,{type:`number`,min:1,max:4096,className:`w-full`,value:s.mediaMaxMb,onChange:e=>l({...s,mediaMaxMb:Math.trunc(Number(e.target.value)||0)})})]})]}),y&&(0,Q.jsxs)(`div`,{className:`oc-bridge-config__grid`,children:[_&&(0,Q.jsxs)(`label`,{className:`oc-field`,children:[(0,Q.jsx)(w,{label:ne(),help:ee()}),(0,Q.jsx)(N,{className:`w-full`,spellCheck:!1,value:s.inboundAgentMount,onChange:e=>l({...s,inboundAgentMount:e.target.value})})]}),v&&(0,Q.jsxs)(`label`,{className:`oc-field`,children:[(0,Q.jsx)(w,{label:Ce(),help:ve()}),(0,Q.jsx)(N,{className:`w-full`,spellCheck:!1,value:s.outboundAgentMount,onChange:e=>l({...s,outboundAgentMount:e.target.value})})]})]}),(0,Q.jsxs)(`label`,{className:`oc-field--row`,children:[(0,Q.jsx)(Pt,{checked:s.rehydration,onCheckedChange:e=>l({...s,rehydration:e===!0})}),(0,Q.jsx)(w,{label:me(),help:Ge()})]}),y&&h!==null&&(0,Q.jsx)(`div`,{className:`oc-bridge-config__check`,children:h.reachable?!h.inbound&&!h.outbound?(0,Q.jsxs)(`p`,{className:`oc-bridge-config__check-row oc-bridge-config__check-row--err`,children:[(0,Q.jsx)(T,{"aria-hidden":!0}),oe({reason:h.reason??`?`})]}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(xn,{label:pe(),result:h.inbound}),(0,Q.jsx)(xn,{label:ie(),result:h.outbound}),(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:ut()})]}):(0,Q.jsxs)(`p`,{className:`oc-bridge-config__check-row oc-bridge-config__check-row--err`,children:[(0,Q.jsx)(T,{"aria-hidden":!0}),le()]})}),(0,Q.jsxs)(`div`,{className:`oc-bridge-config__actions`,children:[y&&(0,Q.jsxs)(Ct,{variant:`outline`,size:`sm`,onClick:()=>void re(),disabled:f,children:[f?(0,Q.jsx)(zt,{className:`size-4 animate-spin`,"aria-hidden":!0}):null,f?xe():te()]}),(0,Q.jsx)(Ct,{size:`sm`,onClick:()=>void b(),disabled:u,children:ot()})]})]})})}function Cn({versions:e}){if(e.length===0)return null;let t=[...e].reverse();return(0,Q.jsxs)(Et,{children:[(0,Q.jsx)(Tt,{asChild:!0,children:(0,Q.jsxs)(`button`,{type:`button`,className:`oc-compat__versions-btn`,children:[e.length===1?re():g({count:e.length}),(0,Q.jsx)(C,{size:13,"aria-hidden":!0})]})}),(0,Q.jsxs)(Ot,{className:`oc-compat__versions-pop`,align:`start`,children:[(0,Q.jsx)(`p`,{className:`oc-compat__versions-title`,children:we()}),(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{Ai as r,Bc as i,Di as a,E as o,Eg as s,Fi as c,Gt as l,Ii as u,Kj as d,Mi as f,Ni as p,Oi as m,Pi as h,Qj as g,Sl as _,_l as v,ac as y,cc as b,eM as x,ic as S,ji as C,ki as w,lc as T,nc as E,oc as D,rc as O,sc as k,tM as A,uc as j,vl as M,wl as N}from"./dist-CGzSsL4i.js";import{t as P}from"./button-D5AXX04a.js";import{At as F,C as I,S as L,b as R,d as z,f as B,lt as V,p as H,w as U,x as W,y as G}from"./index-B0Kloary.js";import{i as K}from"./compatView-DWV4JVj_.js";/* empty css */var q=t(e(),1),J=[`off`,`minimal`,`low`,`medium`,`high`,`xhigh`];function Y(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 X=n();function Z({instance:e}){let t=x(o.admin.upsertInstanceConfig),n=A(o.agents.listAgentsForInstance,{instanceName:e.name}),r=typeof e.config?.converterAgentId==`string`?e.config.converterAgentId:``,[i,a]=(0,q.useState)(r),[s,c]=(0,q.useState)(`idle`);(0,q.useEffect)(()=>{a(r),c(`idle`)},[e._id,r]);let l=`__none__`,u=i!==r;async function d(){c(`saving`);try{let n={...e.config??{}};i===``||i===l?delete n.converterAgentId:n.converterAgentId=i,await t({instanceId:e._id,config:n}),c(`done`)}catch{c(`error`)}}let m=n?.agents??[];return(0,X.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,X.jsx)(`span`,{className:`oc-cdefaults__label`,children:p()}),(0,X.jsx)(`p`,{className:`oc-admin__hint`,children:f()}),(0,X.jsxs)(`div`,{className:`oc-cdefaults__inline`,children:[(0,X.jsxs)(R,{value:i===``?l:i,onValueChange:e=>a(e===l?``:e),children:[(0,X.jsx)(I,{className:`oc-cdefaults__select`,"aria-label":p(),children:(0,X.jsx)(U,{placeholder:C()})}),(0,X.jsxs)(W,{children:[(0,X.jsx)(L,{value:l,children:C()}),m.map(e=>(0,X.jsx)(L,{value:e.agentId,children:e.displayName?`${e.displayName} (${e.agentId})`:e.agentId},e.agentId))]})]}),(0,X.jsx)(P,{size:`sm`,disabled:!u||s===`saving`,onClick:()=>void d(),children:s===`saving`?N():S()})]}),s===`done`?(0,X.jsx)(`p`,{className:`oc-admin__hint`,role:`status`,children:O()}):null,s===`error`?(0,X.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:E()}):null]})}function Q({instance:e}){let t=x(o.admin.upsertInstanceConfig),n=e.config?.curationEnabled===!0,i=typeof e.config?.curationBudgetChars==`number`?e.config.curationBudgetChars:null,[a,s]=(0,q.useState)(n),[c,l]=(0,q.useState)(i===null?``:String(i)),[u,d]=(0,q.useState)(`idle`);(0,q.useEffect)(()=>{s(n),l(i===null?``:String(i)),d(`idle`)},[e._id,n,i]);let f=c.trim(),p=f===``?null:/^\d+$/.test(f)?Number.parseInt(f,10):NaN,g=!a||p===null||Number.isInteger(p)&&p>=4e3&&p<=6e4,_=a!==n||(p??null)!==i;async function v(){d(`saving`);try{let n={...e.config??{}};n.curationEnabled=a,!a||p===null||Number.isNaN(p)?delete n.curationBudgetChars:n.curationBudgetChars=p,await t({instanceId:e._id,config:n}),d(`done`)}catch{d(`error`)}}return(0,X.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,X.jsxs)(`label`,{className:`oc-cdefaults__inline`,style:{cursor:`pointer`},children:[(0,X.jsx)(H,{checked:a,onCheckedChange:e=>s(e===!0),"aria-label":h()}),(0,X.jsx)(`span`,{className:`oc-cdefaults__label`,children:h()})]}),(0,X.jsxs)(`div`,{className:`oc-cdefaults__inline`,children:[(0,X.jsx)(V,{type:`number`,min:4e3,max:6e4,step:1e3,placeholder:`20000`,value:c,onChange:e=>l(e.target.value),className:`oc-cdefaults__number`,"aria-invalid":!g,"aria-label":r(),disabled:!a}),(0,X.jsx)(P,{size:`sm`,disabled:!_||!g||u===`saving`,onClick:()=>void v(),children:u===`saving`?N():S()})]}),g?null:(0,X.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:w()}),u===`done`?(0,X.jsx)(`p`,{className:`oc-admin__hint`,role:`status`,children:O()}):null,u===`error`?(0,X.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:E()}):null,(0,X.jsx)(`p`,{className:`oc-cdefaults__help`,children:m()})]})}function $({instance:e}){let t=x(o.admin.upsertInstanceConfig),n=typeof e.config?.summarizeThresholdChars==`number`?e.config.summarizeThresholdChars:null,[r,i]=(0,q.useState)(n===null?``:String(n)),[s,l]=(0,q.useState)(`idle`);(0,q.useEffect)(()=>{i(n===null?``:String(n)),l(`idle`)},[e._id,n]);let d=r.trim(),f=d===``?null:/^\d+$/.test(d)?Number.parseInt(d,10):NaN,p=f===null||Number.isInteger(f)&&f>=1e3&&f<=2e5,m=(f??null)!==n;async function h(){l(`saving`);try{let n={...e.config??{}};f===null?delete n.summarizeThresholdChars:n.summarizeThresholdChars=f,await t({instanceId:e._id,config:n}),l(`done`)}catch{l(`error`)}}return(0,X.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,X.jsx)(`span`,{className:`oc-cdefaults__label`,children:u()}),(0,X.jsxs)(`div`,{className:`oc-cdefaults__inline`,children:[(0,X.jsx)(V,{type:`number`,min:1e3,max:2e5,step:1e3,placeholder:`8000`,value:r,onChange:e=>i(e.target.value),className:`oc-cdefaults__number`,"aria-invalid":!p}),(0,X.jsx)(P,{size:`sm`,disabled:!m||!p||s===`saving`,onClick:()=>void h(),children:s===`saving`?N():S()})]}),p?null:(0,X.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:a()}),s===`done`?(0,X.jsx)(`p`,{className:`oc-admin__hint`,role:`status`,children:O()}):null,s===`error`?(0,X.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:E()}):null,(0,X.jsx)(`p`,{className:`oc-cdefaults__help`,children:c()})]})}function ee(){let e=g(o.agentFiles.getChatDefaults),[t,n]=(0,q.useState)({status:`loading`}),r=A(o.admin.listInstances,{}),[a,c]=(0,q.useState)(null);(0,q.useEffect)(()=>{!r||r.length===0||(!a||!r.some(e=>e.name===a))&&c(r[0].name)},[r,a]);let u=(r?.length??0)>1,f=r!==void 0&&r.length===0,p=A(o.compat.forInstance,a?{instanceName:a}:`skip`),m=a?G(p,`configDefaults`):`loading`,h=m===`loading`?null:m.blocked,x=(0,q.useMemo)(()=>u&&a?{instanceName:a}:{},[u,a]),S=(0,q.useRef)(0),C=(0,q.useCallback)(async()=>{let t=++S.current;n({status:`loading`});try{let r=Y(await e(x));if(S.current!==t)return;n({status:`done`,current:r})}catch{if(S.current!==t)return;n({status:`error`})}},[e,x]);(0,q.useEffect)(()=>{h===!1&&(u&&!a||C())},[C,h,u,a]);let w=t.status===`done`?t.current:null,E=(0,q.useMemo)(()=>J.map(e=>({id:e,label:B(e)})),[]),O=(0,q.useMemo)(()=>[{id:`fast`,label:M()},{id:`standard`,label:v()}],[]);return(0,X.jsxs)(`div`,{className:`oc-cdefaults`,children:[(0,X.jsx)(`p`,{className:`oc-admin__hint`,children:j()}),u&&a?(0,X.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,X.jsx)(`span`,{className:`oc-cdefaults__label`,children:i()}),(0,X.jsxs)(R,{value:a,onValueChange:e=>c(e),children:[(0,X.jsx)(I,{size:`sm`,"aria-label":i(),children:(0,X.jsx)(U,{})}),(0,X.jsx)(W,{children:(r??[]).map(e=>(0,X.jsx)(L,{value:e.name,children:e.name},e.name))})]})]}):null,f?(0,X.jsx)(`p`,{className:`oc-admin__hint`,role:`status`,children:s()}):m===`loading`?(0,X.jsx)(`p`,{className:`oc-admin__hint`,children:d()}):m.blocked?(0,X.jsxs)(`p`,{className:`oc-compat__blocked`,role:`status`,children:[(0,X.jsx)(F,{size:14,"aria-hidden":!0}),` `,K(m.gatewayVersion,m.provider)]}):t.status===`loading`?(0,X.jsx)(`p`,{className:`oc-admin__hint`,children:d()}):t.status===`error`?(0,X.jsxs)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:[y(),` `,(0,X.jsx)(P,{variant:`outline`,size:`sm`,onClick:()=>void C(),children:_()})]}):(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,X.jsx)(`span`,{className:`oc-cdefaults__label`,children:T()}),(0,X.jsx)(z,{options:E,value:w?.thinkingDefault??null,onChange:()=>{},disabled:!0}),(0,X.jsx)(`p`,{className:`oc-cdefaults__help`,children:b()})]}),(0,X.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,X.jsx)(`span`,{className:`oc-cdefaults__label`,children:k()}),(0,X.jsx)(z,{options:O,value:w===null||w.fastModeDefault===null?null:w.fastModeDefault?`fast`:`standard`,onChange:()=>{},disabled:!0}),(0,X.jsx)(`p`,{className:`oc-cdefaults__help`,children:D()})]}),(0,X.jsx)(`p`,{className:`oc-cdefaults__note`,children:l()})]}),(()=>{let e=r?.find(e=>e.name===(a??r[0]?.name));return e?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)($,{instance:e}),(0,X.jsx)(Q,{instance:e}),(0,X.jsx)(Z,{instance:e})]}):null})()]})}export{ee 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,AC as i,BS as a,CC as o,DC as s,E as c,EC as l,FC as u,FS as d,GS as f,HS as p,IC as m,IS as h,JS as g,Jr as _,KS as ee,Kr as te,LS as ne,MC as re,NC as ie,OC as v,PC as y,QS as b,RS as x,SC as S,TC as C,US as w,VS as T,WS as E,XS as D,YS as O,ZS as k,_C as A,aC as j,bC as M,cC as N,dC as P,eC as F,eM as I,fC as L,gC as R,hC as z,iC as B,jC as V,kC as ae,lC as H,mC as U,nC as W,oC as G,pC as K,qS as q,rC as J,sC as oe,tC as se,tM as ce,uC as le,vC as ue,wC as de,xC as fe,yC as pe,zS as me}from"./dist-CGzSsL4i.js";import{t as he}from"./button-D5AXX04a.js";import{B as ge,et as _e}from"./index-B0Kloary.js";import{t as Y}from"./DataTableShell-Bzopt4OT.js";var X=t(e(),1),Z=n(),ve={altered_words:()=>m(),incorrect:()=>u(),incoherence:()=>y(),formatting:()=>ie(),latency:()=>re(),api_error:()=>V(),other:()=>i()},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:v()}):e===!1?(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-warn`,children:s()}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill`,children:`—`}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill`,children:ae()})}function ye({data:e,closeReason:t}){let n=e.snapshot,r=I(c.feedback.respondToFeedback),[i,a]=(0,X.useState)(e.thread),[s,u]=(0,X.useState)(``),[d,f]=(0,X.useState)(!1);async function p(){let t=s.trim();if(!(!t||d)){f(!0);try{await r({feedbackId:e._id,text:t}),a(e=>[...e,{authorRole:`admin`,text:t,at:Date.now()}]),u(``)}finally{f(!1)}}}let m=[];try{m=n.contextJson?JSON.parse(n.contextJson):[]}catch{m=[]}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?` · ${l()}`:``,n.openclawModel?` · ${n.openclawModel}`:``,n.openclawRuntime?` (${n.openclawRuntime})`:``]})]}),e.comment?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:C()}),(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:T()}),(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:de()}),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`?o():e.authorRole===`agent`?e.authorLabel??_():S()}),(0,Z.jsx)(`span`,{className:`oc-notif__msg-text`,children:e.text})]},t))}):(0,Z.jsx)(`p`,{className:`oc-fbadmin__meta`,children:fe()}),(0,Z.jsx)(`textarea`,{className:`oc-feedback__textarea`,placeholder:M(),value:s,maxLength:2e3,rows:3,onChange:e=>u(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 p(),disabled:!s.trim()||d,children:d?pe():ue()})})]}),(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:A()}),(0,Z.jsx)(`pre`,{className:`oc-msg__source-pre`,children:n.messageText||R()})]}),n.clientInfo?.sourceWasOpen&&n.displayedText!==void 0?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:z()}),(0,Z.jsx)(`pre`,{className:`oc-msg__source-pre`,children:n.displayedText||R()})]}):null,n.promptText?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:U()}),(0,Z.jsx)(`pre`,{className:`oc-msg__source-pre`,children:n.promptText})]}):null,m.length>0?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:K({count:n.contextCount??m.length,truncated:n.contextTruncated?L():``})}),(0,Z.jsx)(`div`,{className:`oc-fbadmin__ctx`,children:m.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:P()}),(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:le()}),(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:H()}),(0,Z.jsxs)(`p`,{className:`oc-fbadmin__env`,children:[[n.clientInfo?.language,n.clientInfo?.timezone,n.clientInfo?.theme?N({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:[oe(),` `,n.clientInfo.plugins.join(`, `),(0,Z.jsxs)(`span`,{className:`oc-fbadmin__note`,children:[` `,G()]})]}):null,n.clientInfo?.userAgent?(0,Z.jsx)(`span`,{className:`oc-fbadmin__ua`,children:n.clientInfo.userAgent}):null]})]})]})}function be(){let e=ce(c.feedback.listForAdmin,{}),t=I(c.feedback.readSnapshot),n=I(c.feedback.deleteFeedback),i=ge(),[o,s]=(0,X.useState)(null),[l,u]=(0,X.useState)({});async function m(e){if(o===e._id){s(null);return}if(!l[e._id]){let n=await t({feedbackId:e._id});u(t=>({...t,[e._id]:n}))}s(e._id)}async function _(e){await i({title:ne(),description:h(),confirmLabel:d(),destructive:!0})&&(await n({feedbackId:e._id}),o===e._id&&s(null))}return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`p`,{className:`oc-admin__hint`,children:[j(),` `,(0,Z.jsx)(`strong`,{children:B()}),` `,J()]}),(0,Z.jsx)(Y,{title:W(),rows:e,emptyHint:se(),isExpanded:e=>o===e._id&&!!l[e._id],renderExpanded:e=>l[e._id]?(0,Z.jsx)(ye,{data:l[e._id],closeReason:e.userCloseReason}):null,columns:[{header:F(),cell:e=>_e(e.at),sort:e=>e.at},{header:r(),cell:e=>Q(e.category),sort:e=>Q(e.category)},{header:b(),cell:e=>e.messageRole===`user`?k():D(),sort:e=>e.messageRole},{header:O(),cell:e=>(e.reporterEmail||e.reporterName||`—`)+(e.impersonated&&e.realOperatorEmail?` ${g({operator:e.realOperatorEmail})}`:``),sort:e=>e.reporterEmail||e.reporterName||null},{header:q(),cell:e=>(0,Z.jsx)($,{matches:e.displayedMatchesStored,sourceWasOpen:e.sourceWasOpen}),sort:e=>e.displayedMatchesStored===!1?0:e.displayedMatchesStored===!0?1:2},{header:ee(),cell:e=>e.hasComment?`✎`:`—`,sort:e=>+!!e.hasComment},{header:f(),cell:e=>e.userClosedAt==null?e.resolvedAt==null?e.answered?(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-ok`,children:E()}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill`,children:w()}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-ok`,title:e.resolvedBy??void 0,children:te()}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-closed`,children:p()}),sort:e=>e.userClosedAt==null?e.resolvedAt==null?+!!e.answered:2:3}],rowActions:e=>[{label:o===e._id?a():me(),onSelect:()=>void m(e)},{label:x(),onSelect:()=>void _(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{$A as r,Cj as i,E as a,Ej as o,FE as s,GA as ee,JA as te,Jj as ne,KA as re,Kj as ie,QA as ae,Qr as c,Sj as l,Tj as u,XA as oe,YA as se,ZA as ce,Zr as le,_j as ue,aj as de,bj as fe,cj as pe,dj as d,eM as me,ej as he,fj as f,gj as ge,hj as p,ij as _e,lj as m,mj as h,nj as ve,oj as ye,pj as g,qA as be,rj as xe,sj as Se,tM as _,tj as v,uj as y,vj as b,wj as x,xj as S,yj as C}from"./dist-CGzSsL4i.js";import{t as w}from"./button-D5AXX04a.js";import{C as T,Ft as E,G as D,H as O,Ht as k,J as A,K as j,S as M,U as Ce,Ut as N,W as we,Y as Te,b as P,ct as F,it as I,jt as Ee,nt as De,p as Oe,q as ke,rt as Ae,st as je,w as L,x as R,z as Me}from"./index-B0Kloary.js";import{a as Ne,i as z,n as Pe,o as B,r as V,t as Fe}from"./table-BDhz0ajJ.js";var H=t(e(),1),U=n(),W=`all`;function G(e){switch(e){case`image`:return p();case`audio`:return h();case`video`:return g();case`pdf`:return f();case`document`:return d();case`archive`:return y();default:return m()}}function K(){let[e,t]=(0,H.useState)(W),[n,d]=(0,H.useState)(W),[f,p]=(0,H.useState)(W),[m,h]=(0,H.useState)(W),[g,y]=(0,H.useState)(!1),[K,q]=(0,H.useState)(null),J=me(a.files.softDelete),Y=Me();function Ie(){t(W),d(W),p(W),h(W)}async function Le(){let e=K;if(q(null),e)try{await J({fileId:e.id}),Y.success(ae())}catch(e){Y.error(ce(),e)}}let X=_(a.files.listMine,{direction:e===W?void 0:e,chatId:n===W?void 0:n,instanceName:f===W?void 0:f,category:m===W?void 0:m,includeAutoGenerated:g||void 0}),Re=(0,H.useMemo)(()=>new Intl.DateTimeFormat(ne(),{dateStyle:`medium`,timeStyle:`short`}),[]);if(X===void 0)return(0,U.jsx)(`p`,{className:`oc-admin__hint`,children:ie()});let{files:Z,facets:Q,truncated:ze,cap:Be}=X,$=e!==W||n!==W||f!==W||m!==W;return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`p`,{className:`oc-admin__hint`,children:o()}),(0,U.jsxs)(`div`,{className:`oc-files__filters`,style:{display:`flex`,flexWrap:`wrap`,gap:8,margin:`12px 0`},children:[(0,U.jsxs)(P,{value:e,onValueChange:t,children:[(0,U.jsx)(T,{size:`sm`,"aria-label":u(),children:(0,U.jsx)(L,{})}),(0,U.jsxs)(R,{children:[(0,U.jsx)(M,{value:W,children:x()}),(0,U.jsx)(M,{value:`inbound`,children:i()}),(0,U.jsx)(M,{value:`outbound`,children:l()})]})]}),(0,U.jsxs)(P,{value:n,onValueChange:d,children:[(0,U.jsx)(T,{size:`sm`,"aria-label":S(),children:(0,U.jsx)(L,{})}),(0,U.jsxs)(R,{children:[(0,U.jsx)(M,{value:W,children:fe()}),Q.chats.map(e=>(0,U.jsx)(M,{value:e.id,children:e.title},e.id))]})]}),Q.multiProvider?(0,U.jsxs)(P,{value:f,onValueChange:p,children:[(0,U.jsx)(T,{size:`sm`,"aria-label":C(),children:(0,U.jsx)(L,{})}),(0,U.jsxs)(R,{children:[(0,U.jsx)(M,{value:W,children:b()}),Q.instances.map(e=>(0,U.jsx)(M,{value:e,children:e},e))]})]}):null,(0,U.jsxs)(P,{value:m,onValueChange:h,children:[(0,U.jsx)(T,{size:`sm`,"aria-label":ue(),children:(0,U.jsx)(L,{})}),(0,U.jsxs)(R,{children:[(0,U.jsx)(M,{value:W,children:ge()}),Q.categories.map(e=>(0,U.jsx)(M,{value:e,children:G(e)},e))]})]}),(0,U.jsxs)(`label`,{className:`oc-files__autogen`,children:[(0,U.jsx)(Oe,{checked:g,onCheckedChange:e=>y(e===!0),"aria-label":c()}),(0,U.jsx)(`span`,{children:c()})]}),$?(0,U.jsxs)(w,{variant:`ghost`,size:`sm`,onClick:Ie,style:{display:`inline-flex`,alignItems:`center`,gap:4,marginLeft:`auto`},children:[(0,U.jsx)(E,{size:14,"aria-hidden":!0}),v()]}):null]}),Z.length===0?(0,U.jsx)(`p`,{className:`oc-admin__hint`,children:$?re():be()}):(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:pe()}),(0,U.jsx)(z,{children:Se()}),(0,U.jsx)(z,{children:ye()}),(0,U.jsx)(z,{children:de()}),(0,U.jsx)(z,{children:_e()}),(0,U.jsx)(z,{className:`text-right`,children:xe()})]})}),(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)(F,{variant:`outline`,style:{marginLeft:6},children:le()}):null]}),(0,U.jsx)(V,{title:e.mimeType,children:G(e.category)}),(0,U.jsx)(V,{children:(0,U.jsx)(F,{variant:`secondary`,children:e.direction===`inbound`?i():l()})}),(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)(De,{children:[(0,U.jsx)(je,{asChild:!0,children:(0,U.jsx)(w,{variant:`ghost`,size:`icon`,"aria-label":he(),children:(0,U.jsx)(k,{size:16})})}),(0,U.jsxs)(Ae,{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)(N,{size:14}),ve()]})}):(0,U.jsxs)(I,{disabled:!0,children:[(0,U.jsx)(N,{size:14}),te()]}),(0,U.jsxs)(I,{variant:`destructive`,onSelect:()=>q({id:e._id,filename:e.filename}),children:[(0,U.jsx)(Ee,{size:14}),r()]})]})]})})]},e._id))})]}),ze?(0,U.jsx)(`p`,{className:`oc-admin__hint`,style:{marginTop:8},children:ee({cap:Be})}):null]}),(0,U.jsx)(O,{open:K!==null,onOpenChange:e=>!e&&q(null),children:(0,U.jsxs)(D,{children:[(0,U.jsxs)(A,{children:[(0,U.jsx)(Te,{children:oe()}),(0,U.jsx)(j,{children:se()})]}),(0,U.jsxs)(ke,{children:[(0,U.jsx)(we,{children:s()}),(0,U.jsx)(Ce,{onClick:()=>void Le(),children:r()})]})]})})]})}export{K as FilesTab};
@@ -1 +0,0 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$b as r,$i as i,$x as a,Ab as o,Ax as s,Bb as c,Bx as l,Cb as u,Cx as d,DD as f,Db as p,Dx as m,E as h,Eb as g,Ex as _,Fb as v,Fx as y,Gb as b,Gx as x,Hb as S,Hx as C,Ib as w,Ix as ee,Jb as T,Jt as E,Jx as te,Kb as ne,Kx as re,Lb as ie,Lx as ae,Mb as oe,Mx as se,Nb as ce,Nx as le,OD as ue,Ob as de,Ox as fe,Pb as pe,Px as me,Qb as he,Qi as ge,Qj as D,Qx as _e,Rb as ve,Rx as ye,Sb as be,Sx as xe,Tb as Se,Tx as Ce,Ub as we,Ux as Te,Vb as Ee,Vx as De,Wb as Oe,Wx as ke,Xb as Ae,Xt as je,Xx as Me,Yb as Ne,Yt as Pe,Yx as Fe,Zb as Ie,Zi as Le,Zx as Re,_g as ze,_x as Be,aS as Ve,ax as He,bx as Ue,cx as We,dx as Ge,eM as O,eS as Ke,ea as qe,ex as Je,fx as Ye,gg as Xe,gx as Ze,hx as Qe,iS as $e,ix as et,jb as tt,jx as nt,kb as rt,kx as it,lx as at,mx as ot,nS as st,nx as ct,oS as lt,ox as ut,px as k,qb as A,qx as j,rS as dt,rx as ft,sS as pt,sx as mt,tM as M,tS as ht,tx as gt,ux as _t,vx as vt,wb as yt,wx as N,xb as bt,xx as xt,yx as St,zb as Ct,zx as wt}from"./dist-CGzSsL4i.js";import{a as Tt,c as Et}from"./FieldLabel-RnB1EBjO.js";import{t as P}from"./button-D5AXX04a.js";import{B as Dt,C as F,Q as Ot,S as I,X as kt,Z as At,b as L,ct as R,dt as z,ft as B,ht as V,lt as H,mt as U,p as W,u as jt,ut as G,w as K,x as q,z as J}from"./index-B0Kloary.js";import{t as Mt}from"./DataTableShell-Bzopt4OT.js";import{InstanceConfigDialog as Nt}from"./BridgeTab-Cg51jMGo.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:Tt},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=M(h.admin.listInstances,{}),t=M(h.agents.listAllInstanceAgents,{}),n=O(h.admin.upsertInstance),r=O(h.admin.deleteInstance),i=J(),[o,c]=(0,Y.useState)(!1),[u,d]=(0,Y.useState)(Q),[f,p]=(0,Y.useState)(null),[m,g]=(0,Y.useState)(null),[_,v]=(0,Y.useState)(null),[b,S]=(0,Y.useState)(null);async function w(){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}),d(Q),S(null),c(!1)}catch(e){i.error(Ve(),e)}}return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`p`,{className:`oc-admin__hint`,children:[$e(),(0,Z.jsx)(`strong`,{children:dt()}),st()]}),(0,Z.jsx)(Mt,{title:ht(),rows:e,addLabel:Ke(),onAdd:()=>{S(null),d(Q),c(!0)},emptyHint:a(),columns:[{header:_e(),cell:e=>e.name,sort:e=>e.name},{header:Re(),cell:e=>(0,Z.jsx)(R,{variant:`outline`,children:e.kind??`openclaw`}),sort:e=>e.kind??`openclaw`},{header:Me(),cell:e=>e.gatewayUrl,sort:e=>e.gatewayUrl},{header:Fe(),cell:e=>e.displayName??`—`,sort:e=>e.displayName??null},{header:pt(),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)?be():void 0,children:[e.emoji?`${e.emoji} `:``,e.displayName??e.agentId]},e.agentId))})}}],rowActions:e=>[{label:x(),onSelect:()=>{S(e._id),d(Rt(e)),c(!0)}},{label:lt(),onSelect:()=>p(e.name)},{label:s(),onSelect:()=>v(e)},{label:te(),onSelect:()=>g(e)},{label:j(),variant:`destructive`,onSelect:()=>void r({instanceId:e._id})}],bulkActions:[{label:j(),variant:`destructive`,onSelect:e=>e.forEach(e=>void r({instanceId:e}))}]}),(0,Z.jsx)(jt,{open:o,onOpenChange:c,title:b?ke():re(),description:C(),canSubmit:!!(u.name&&u.gatewayUrl),onSubmit:w,submitLabel:De(),children:(0,Z.jsxs)(`div`,{className:`oc-form`,children:[(0,Z.jsxs)($,{label:l(),children:[(0,Z.jsx)(H,{value:u.name,disabled:b!==null,onChange:e=>d({...u,name:e.target.value})}),b?(0,Z.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:Te()}):null]}),(0,Z.jsx)($,{label:wt(),children:(0,Z.jsxs)(L,{value:u.kind,onValueChange:e=>d({...u,kind:e}),children:[(0,Z.jsx)(F,{size:`sm`,className:`w-40`,children:(0,Z.jsx)(K,{})}),(0,Z.jsxs)(q,{children:[(0,Z.jsx)(I,{value:`openclaw`,children:`OpenClaw`}),(0,Z.jsx)(I,{value:`hermes`,children:`Hermes`})]})]})}),u.kind===`hermes`?(0,Z.jsx)($,{label:je(),children:(0,Z.jsxs)(L,{value:u.transport,onValueChange:e=>d({...u,transport:e}),children:[(0,Z.jsx)(F,{size:`sm`,className:`w-56`,children:(0,Z.jsx)(K,{})}),(0,Z.jsxs)(q,{children:[(0,Z.jsx)(I,{value:`ws`,children:Pe()}),(0,Z.jsx)(I,{value:`rest`,children:E()})]})]})}):null,(0,Z.jsx)($,{label:ye(),children:(0,Z.jsx)(H,{value:u.gatewayUrl,onChange:e=>d({...u,gatewayUrl:e.target.value})})}),(0,Z.jsx)($,{label:ae(),children:(0,Z.jsx)(H,{value:u.bridgeUrl,placeholder:ee(),onChange:e=>d({...u,bridgeUrl:e.target.value})})}),(0,Z.jsx)($,{label:y(),children:(0,Z.jsx)(H,{value:u.displayName,onChange:e=>d({...u,displayName:e.target.value})})}),(0,Z.jsxs)($,{label:ze(),children:[(0,Z.jsxs)(L,{value:u.streamTransport,onValueChange:e=>d({...u,streamTransport:e}),children:[(0,Z.jsx)(F,{size:`sm`,className:`w-40`,children:(0,Z.jsx)(K,{})}),(0,Z.jsx)(q,{children:Et.map(e=>(0,Z.jsx)(I,{value:e,children:e},e))})]}),(0,Z.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:Xe()})]}),(0,Z.jsx)($,{label:me(),children:(0,Z.jsx)(H,{value:u.gatewayVersion,placeholder:le(),onChange:e=>d({...u,gatewayVersion:e.target.value})})}),(0,Z.jsx)($,{label:se(),children:(0,Z.jsx)(H,{value:u.gatewayHttpUrl,placeholder:nt(),onChange:e=>d({...u,gatewayHttpUrl:e.target.value})})})]})}),(0,Z.jsx)(Yt,{instanceName:f,open:f!==null,onOpenChange:e=>{e||p(null)}}),m?(0,Z.jsx)(Nt,{instance:m,onClose:()=>g(null)},m._id):null,_?(0,Z.jsx)(Bt,{instance:_,onClose:()=>v(null)},_._id):null]})}function Bt({instance:e,onClose:t}){let n=M(h.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)(G,{open:!0,onOpenChange:e=>!e&&t(),children:(0,Z.jsxs)(z,{onOpenAutoFocus:e=>e.preventDefault(),children:[(0,Z.jsxs)(U,{children:[(0,Z.jsx)(V,{children:it({instance:e.displayName??e.name})}),(0,Z.jsx)(B,{children:fe()})]}),(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=D(h.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(We());break;case`no_agents`:n.success(ut());break;case`no_bridge_url`:n.error(He());break;case`deploy_misconfigured`:n.error(et());break;case`unauthorized`:n.error(ct());break;case`not_served`:n.error(gt());break;default:n.error(ft());break}}catch(e){n.error(mt(),e)}finally{i(!1)}}}return(0,Z.jsxs)(`div`,{className:`oc-form`,children:[(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:Je()}),(0,Z.jsx)(`div`,{className:`flex items-center gap-2`,children:(0,Z.jsx)(P,{size:`sm`,variant:`outline`,onClick:()=>void a(),disabled:r,children:r?at():_t()})})]})}function Ht({instance:e}){let t=M(h.bridgeAuth.listBridgeAuthStatus,{}),n=D(h.bridgeAuth.mintBridgeSecret),i=O(h.bridgeAuth.revokeBridgeSecret),a=J(),[o,s]=(0,Y.useState)(!1),[c,l]=(0,Y.useState)(null),[u,p]=(0,Y.useState)(!1),m=(t??[]).find(t=>t.instanceId===e._id),g=m!==void 0;async function _(){if(!o){s(!0);try{l((await n({instanceId:e._id})).plaintext),p(!1)}catch(e){a.error(A(),e)}finally{s(!1)}}}async function v(){if(!o){s(!0);try{await i({instanceId:e._id}),l(null),a.success(T())}catch(e){a.error(A(),e)}finally{s(!1)}}}async function y(){if(c)try{await navigator.clipboard.writeText(c),p(!0)}catch{}}return(0,Z.jsxs)($,{label:r(),children:[(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:he()}),(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Z.jsx)(R,{variant:g?`outline`:`secondary`,children:g?`${N()} · ${m.prefix}…${m.lastFour}`:d()}),(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(P,{size:`sm`,onClick:()=>void _(),disabled:o,children:g?Ae():Ie()}),g?(0,Z.jsx)(P,{size:`sm`,variant:`destructive`,onClick:()=>void v(),disabled:o,children:Ne()}):null]})]}),c?(0,Z.jsxs)(`div`,{className:`oc-bridgesecret__reveal`,children:[(0,Z.jsx)(`p`,{className:`oc-sa__minted-warning`,children:ne()}),(0,Z.jsxs)(`div`,{className:`oc-sa__minted-box`,children:[(0,Z.jsx)(`code`,{className:`oc-sa__minted-plain`,children:c}),(0,Z.jsx)(P,{variant:`outline`,size:`sm`,onClick:()=>void y(),children:u?ue():f()})]}),(0,Z.jsx)(P,{size:`sm`,variant:`ghost`,onClick:()=>{l(null),p(!1)},children:b()})]}):null]})}function Ut({instanceId:e,field:t,updatedAt:n}){let r=D(h.instanceSecrets.setInstanceSecret),i=O(h.instanceSecrets.clearInstanceSecret),a=D(h.deviceIdentity.generateDeviceIdentity),o=J(),[s,c]=(0,Y.useState)(``),[l,u]=(0,Y.useState)(!1),[p,g]=(0,Y.useState)(null),[v,y]=(0,Y.useState)(!1),x=n!==null,S=t===`deviceIdentity`,C=t===`token`?m():t===`deviceIdentity`?_():Ce();async function w(){if(!(!s.trim()||l)){u(!0);try{await r({instanceId:e,field:t,plaintext:s}),c(``),g(null),y(!1),o.success(vt())}catch(e){o.error(Be(),e)}finally{u(!1)}}}async function ee(){if(!l){u(!0);try{await i({instanceId:e,field:t}),g(null),y(!1),o.success(Ze())}catch(e){o.error(Be(),e)}finally{u(!1)}}}async function T(){if(!l){u(!0);try{g(await a({instanceId:e})),y(!1),o.success(k())}catch(e){o.error(Ge(),e)}finally{u(!1)}}}let E=p?`openclaw devices approve ${p.id}`:``;async function te(){if(E)try{await navigator.clipboard.writeText(E),y(!0)}catch{}}return(0,Z.jsxs)($,{label:C,children:[S?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:ot()}):null,(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Z.jsx)(R,{variant:x?`outline`:`secondary`,children:x?N():d()}),(0,Z.jsx)(H,{type:`password`,autoComplete:`off`,className:`flex-1 min-w-32`,value:s,placeholder:x?xt():xe(),onChange:e=>c(e.target.value)}),(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(P,{size:`sm`,onClick:()=>void w(),disabled:l||s.trim().length===0,children:Ue()}),S?(0,Z.jsx)(P,{size:`sm`,variant:`outline`,onClick:()=>void T(),disabled:l,children:Qe()}):null,x?(0,Z.jsx)(P,{size:`sm`,variant:`destructive`,onClick:()=>void ee(),disabled:l,children:St()}):null]})]}),p?(0,Z.jsxs)(`div`,{className:`oc-bridgesecret__reveal`,children:[(0,Z.jsx)(`p`,{className:`text-sm font-medium`,children:k()}),(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:Ye()}),(0,Z.jsxs)(`div`,{className:`oc-sa__minted-box`,children:[(0,Z.jsx)(`code`,{className:`oc-sa__minted-plain`,children:E}),(0,Z.jsx)(P,{variant:`outline`,size:`sm`,onClick:()=>void te(),children:v?ue():f()})]}),(0,Z.jsx)(P,{size:`sm`,variant:`ghost`,onClick:()=>{g(null),y(!1)},children:b()})]}):null]})}var Wt={conversational:ie,documentary:v,summarizer:qe,curator:ge},Gt={conversational:w,documentary:pe,summarizer:i,curator:Le},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:Ee()}),t.map(e=>(0,Z.jsx)(R,{variant:`secondary`,className:`oc-agenttype__chip`,title:qt(e),children:Kt(e)},e)),(0,Z.jsxs)(kt,{children:[(0,Z.jsx)(Ot,{asChild:!0,children:(0,Z.jsx)(P,{type:`button`,variant:`outline`,size:`sm`,className:`h-7`,children:c()})}),(0,Z.jsxs)(At,{align:`start`,className:`oc-agenttypes-pop`,children:[(0,Z.jsx)(`p`,{className:`oc-agenttypes-pop__title`,children:Ct()}),(0,Z.jsx)(`p`,{className:`oc-agenttypes-pop__hint`,children:ve()}),(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)(W,{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=M(h.agents.listAgentsForInstance,t&&e?{instanceName:e}:`skip`),i=O(h.agents.setAgentEnabled).withOptimisticUpdate((e,{instanceName:t,agentId:n,enabled:r})=>{let i=e.getQuery(h.agents.listAgentsForInstance,{instanceName:t});i&&e.setQuery(h.agents.listAgentsForInstance,{instanceName:t},{...i,agents:i.agents.map(e=>e.agentId===n?{...e,enabled:r}:e)})}),a=O(h.agents.setInstanceDefaultAgent).withOptimisticUpdate((e,{instanceName:t,agentId:n})=>{let r=e.getQuery(h.agents.listAgentsForInstance,{instanceName:t});r&&e.setQuery(h.agents.listAgentsForInstance,{instanceName:t},{...r,defaultAgentId:n})}),s=O(h.agents.setAgentTypes).withOptimisticUpdate((e,{instanceName:t,agentId:n,types:r})=>{let i=e.getQuery(h.agents.listAgentsForInstance,{instanceName:t});if(!i)return;let a=It(r);e.setQuery(h.agents.listAgentsForInstance,{instanceName:t},{...i,agents:i.agents.map(e=>e.agentId===n?{...e,types:a}:e)})}),c=O(h.agents.removeInstanceAgent),l=Dt(),d=J();async function f(t,n){if(e)try{await i({instanceName:e,agentId:t,enabled:n})}catch(e){d.error(S(),e)}}async function m(t){if(e)try{await a({instanceName:e,agentId:t})}catch(e){d.error(S(),e)}}async function _(t,n,r){if(!e)return;let i=r.includes(n)?r.filter(e=>e!==n):[...r,n];try{await s({instanceName:e,agentId:t,types:i})}catch(e){d.error(S(),e)}}async function v(t,n){if(e&&await l({title:tt({name:n}),description:o(),confirmLabel:rt(),destructive:!0}))try{await c({instanceName:e,agentId:t}),d.success(de())}catch(e){d.error(S(),e)}}return(0,Z.jsx)(G,{open:t,onOpenChange:n,children:(0,Z.jsxs)(z,{className:`oc-access`,children:[(0,Z.jsxs)(U,{children:[(0,Z.jsx)(V,{children:Oe({name:e??``})}),(0,Z.jsx)(B,{children:we()})]}),r===void 0?(0,Z.jsx)(`p`,{className:`oc-access__hint`,children:p()}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`div`,{className:`oc-access__poll`,children:r.discovery===null?g():r.discovery.lastPollOk?Se():yt({error:r.discovery.error??`?`})}),r.agents.length===0?(0,Z.jsx)(`p`,{className:`oc-access__hint`,children:u()}):(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)(W,{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:bt()}),(0,Z.jsx)(P,{size:`sm`,variant:`ghost`,className:`h-7 text-destructive`,onClick:()=>void v(e.agentId,i),children:oe()})]}):n?(0,Z.jsx)(R,{variant:`default`,children:be()}):(0,Z.jsx)(P,{size:`sm`,variant:`outline`,className:`h-7`,disabled:!e.enabled,onClick:()=>void m(e.agentId),children:ce()})]}),e.enabled?(0,Z.jsx)(Jt,{agentId:e.agentId,types:a,onToggle:t=>void _(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{BC as r,E as i,GC as a,HC as o,JC as s,KC as c,LC as l,Qj as u,RC as d,UC as f,VC as p,WC as m,XC as h,YC as g,_o as _,bo as v,eM as y,go as b,ho as x,mo as S,po as C,qC as w,tM as T,vo as E,xo as D,yo as O,zC as k}from"./dist-CGzSsL4i.js";import{t as A}from"./button-D5AXX04a.js";import{ct as j,lt as M,p as N}from"./index-B0Kloary.js";var P=t(e(),1),F=n();function I(){let e=T(i.integrations.status.status,{}),t=y(i.admin.setIntegrationConfig),[n,u]=(0,P.useState)(null);if((0,P.useEffect)(()=>{e&&n===null&&u(e.config)},[e,n]),!e||!n)return(0,F.jsx)(`p`,{className:`oc-admin__hint`,children:h()});let _=n,b=(e,t,n)=>u({..._,[e]:{..._[e],[t]:n}}),x=(e,n)=>void t({[e]:n});return(0,F.jsxs)(F.Fragment,{children:[(0,F.jsxs)(`p`,{className:`oc-admin__hint`,children:[g(),` `,(0,F.jsx)(`strong`,{children:s()}),` `,w()]}),(0,F.jsxs)(L,{title:`Langfuse`,status:e.langfuse.configured?e.langfuse.enabled?(0,F.jsx)(j,{variant:`secondary`,children:c()}):(0,F.jsx)(j,{variant:`outline`,children:a()}):(0,F.jsx)(j,{variant:`outline`,children:m()}),note:f(),children:[(0,F.jsx)(R,{label:p(),children:(0,F.jsx)(M,{value:_.langfuse.host??``,placeholder:e.langfuse.effectiveHost,onChange:e=>b(`langfuse`,`host`,e.target.value),onBlur:()=>x(`langfuse`,{host:_.langfuse.host??``})})}),(0,F.jsx)(z,{label:l(),checked:_.langfuse.enabled??!0,onChange:e=>{b(`langfuse`,`enabled`,e),x(`langfuse`,{enabled:e})}})]}),(0,F.jsxs)(L,{title:`Opik`,status:e.opik.configured?e.opik.enabled?(0,F.jsx)(j,{variant:`secondary`,children:c()}):(0,F.jsx)(j,{variant:`outline`,children:a()}):(0,F.jsx)(j,{variant:`outline`,children:m()}),note:o(),children:[(0,F.jsx)(R,{label:r(),children:(0,F.jsx)(M,{value:_.opik.baseUrl??``,placeholder:e.opik.effectiveBaseUrl,onChange:e=>b(`opik`,`baseUrl`,e.target.value),onBlur:()=>x(`opik`,{baseUrl:_.opik.baseUrl??``})})}),(0,F.jsx)(R,{label:k(),children:(0,F.jsx)(M,{value:_.opik.workspace??``,placeholder:e.opik.effectiveWorkspace||d(),onChange:e=>b(`opik`,`workspace`,e.target.value),onBlur:()=>x(`opik`,{workspace:_.opik.workspace??``})})}),(0,F.jsx)(z,{label:l(),checked:_.opik.enabled??!0,onChange:e=>{b(`opik`,`enabled`,e),x(`opik`,{enabled:e})}})]}),(0,F.jsxs)(L,{title:`OpenTelemetry (OTLP)`,status:e.otlp.configured?e.otlp.enabled?(0,F.jsx)(j,{variant:`secondary`,children:c()}):(0,F.jsx)(j,{variant:`outline`,children:a()}):(0,F.jsx)(j,{variant:`outline`,children:D()}),note:v(),children:[(0,F.jsx)(R,{label:O(),children:(0,F.jsx)(M,{value:_.otlp.endpoint??``,placeholder:e.otlp.effectiveEndpoint||`https://otlp.example.com/v1/traces`,onChange:e=>b(`otlp`,`endpoint`,e.target.value),onBlur:()=>x(`otlp`,{endpoint:_.otlp.endpoint??``})})}),(0,F.jsx)(B,{headersSet:e.otlp.headersSet}),(0,F.jsx)(z,{label:l(),checked:_.otlp.enabled??!0,onChange:e=>{b(`otlp`,`enabled`,e),x(`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=u(i.integrations.otlpSecret.setOtlpHeaders),n=y(i.integrations.otlpSecret.clearOtlpHeaders),[r,a]=(0,P.useState)(``),[o,s]=(0,P.useState)(null),[c,l]=(0,P.useState)(!1),d=async()=>{l(!0),s(null);try{await t({headersJson:r}),a(``)}catch(e){s(e instanceof Error?e.message:String(e))}finally{l(!1)}};return(0,F.jsxs)(R,{label:E(),children:[(0,F.jsx)(M,{value:r,placeholder:e?_():b(),onChange:e=>a(e.target.value)}),(0,F.jsxs)(`div`,{className:`oc-int__otlp-headers-actions`,children:[(0,F.jsx)(A,{size:`sm`,disabled:c||r.trim().length===0,onClick:()=>void d(),children:x()}),e?(0,F.jsx)(A,{variant:`ghost`,size:`sm`,disabled:c,onClick:()=>void n({}),children:S()}):null]}),o?(0,F.jsx)(`p`,{className:`oc-int__otlp-headers-error`,children:o}):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{Am as r,Aw as i,Cw as a,Dm as o,E as s,Em as c,Fm as l,Im as u,Lm as d,Mm as f,Mw as p,Nm as m,Nw as h,Om as g,Pm as _,Sw as v,Tm as y,iT as b,jm as x,jw as S,km as C,tM as w,wm as T}from"./dist-CGzSsL4i.js";import{Xt as E,Yt as D,a as ee,n as te,r as ne,xt as re}from"./index-B0Kloary.js";import{a as O,n as k,o as A,r as j,t as M}from"./card-DYY__lMj.js";import{n as N,t as P}from"./TimeRangePicker-CZSYqXhd.js";var F=t(e(),1),I=n(),L=15,R=e=>String(Math.round(e));function z(){let e=w(s.me.getMe,{host:re})?.permissions?.includes(`traces.read`)??!1,t=w(s.deliveryTiming.listDeliverySessions,e?{}:`skip`),n=(0,F.useMemo)(()=>t?t.filter(e=>!e.active&&e.rollup!==null&&e.rollup.cP50!==null&&e.rollup.aP50!==null).slice(0,L).reverse().map(e=>({startedAt:e.startedAt,cP50:e.rollup?.cP50,aP50:e.rollup?.aP50})):[],[t]);return t===void 0?null:(0,I.jsxs)(`section`,{className:`oc-kpi__group`,children:[(0,I.jsx)(`h2`,{className:`oc-kpi__group-title`,children:b()}),(0,I.jsxs)(M,{children:[(0,I.jsxs)(O,{children:[(0,I.jsx)(A,{children:h()}),(0,I.jsx)(j,{children:S()})]}),(0,I.jsx)(k,{children:n.length<2?(0,I.jsx)(`p`,{className:`oc-admin__hint`,children:i()}):(0,I.jsx)(B,{series:n})})]})]})}function B({series:e}){let t=e.map(e=>e.cP50),n=e.map(e=>e.aP50),r=Math.max(1,...t,...n),i=t=>6+t*468/(e.length-1),o=e=>74-e*68/r,s=e=>e.map((e,t)=>`${t===0?`M`:`L`}${i(t).toFixed(1)},${o(e).toFixed(1)}`).join(` `),c=e[e.length-1];return(0,I.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,I.jsxs)(`div`,{className:`flex gap-3 text-xs text-muted-foreground`,children:[(0,I.jsxs)(`span`,{style:{color:`var(--primary)`},children:[v(),` p50 `,R(c.cP50),` `,p()]}),(0,I.jsxs)(`span`,{children:[a(),` p50 `,R(c.aP50),` `,p()]})]}),(0,I.jsxs)(`svg`,{viewBox:`0 0 480 80`,className:`h-20 w-full`,preserveAspectRatio:`none`,role:`img`,"aria-label":h(),children:[(0,I.jsx)(`path`,{d:s(n),fill:`none`,style:{stroke:`var(--muted-foreground)`},strokeWidth:1.5}),(0,I.jsx)(`path`,{d:s(t),fill:`none`,style:{stroke:`var(--primary)`},strokeWidth:1.5})]})]})}var V=[{metric:`api.calls`,label:d(),unit:`/h`,group:`API`,isError:!1},{metric:`api.errors`,label:u(),unit:`/h`,group:`API`,isError:!0},{metric:`api.latency.avg_ms`,label:l(),unit:`ms`,group:`API`,isError:!1},{metric:`openclaw.ingest`,label:_(),unit:`/h`,group:`OpenClaw`,isError:!1},{metric:`chat.send`,label:m(),unit:`/h`,group:`Chat`,isError:!1},{metric:`assistant.stream.errors`,label:f(),unit:`/h`,group:`Assistant`,isError:!0}],H=V.length,U=[`API`,`OpenClaw`,`Chat`,`Assistant`],W=1e3,G=36e5;function K(e,t){let n=Math.max(1,Math.ceil((t-e)/G)),r=Math.min(n*H,W);return{rowLimit:r,buckets:Math.max(1,Math.floor(r/H))}}function q(){let e=E({from:`/settings/kpi`}),t=D({from:`/settings/kpi`}),n=ne(e.from,e.to,te,`now`),i=e=>void t({search:t=>({...t,...ee(e)})}),{from:a,to:o}=N(n),{rowLimit:c,buckets:l}=K(a,o),u=w(s.kpi.listKpis,{limit:c,filter:{from:a,to:o}}),d=(0,F.useMemo)(()=>{let e=new Map;for(let t of u??[]){let n=e.get(t.metric)??[];n.push({bucket:t.bucket,value:t.value}),e.set(t.metric,n)}for(let[t,n]of e)n.sort((e,t)=>e.bucket<t.bucket?-1:+(e.bucket>t.bucket)),n.length>l&&e.set(t,n.slice(n.length-l));return e},[u,l]),f=(0,I.jsxs)(I.Fragment,{children:[(0,I.jsxs)(`p`,{className:`oc-admin__hint`,children:[x(),` `,(0,I.jsx)(`span`,{className:`oc-filter__window`,children:r()})]}),(0,I.jsx)(J,{value:n,onChange:i})]});return u===void 0?(0,I.jsxs)(I.Fragment,{children:[f,(0,I.jsx)(z,{}),(0,I.jsx)(`p`,{className:`oc-admin__hint`,children:C()})]}):u.length===0?(0,I.jsxs)(I.Fragment,{children:[f,(0,I.jsx)(z,{}),(0,I.jsx)(`p`,{className:`oc-admin__hint`,children:g()})]}):(0,I.jsxs)(I.Fragment,{children:[f,(0,I.jsx)(z,{}),U.map(e=>{let t=V.filter(t=>t.group===e);return t.some(e=>(d.get(e.metric)??[]).length>0)?(0,I.jsxs)(`section`,{className:`oc-kpi__group`,children:[(0,I.jsx)(`h2`,{className:`oc-kpi__group-title`,children:e}),(0,I.jsx)(`div`,{className:`oc-kpi__grid`,children:t.map(e=>(0,I.jsx)(Y,{config:e,series:d.get(e.metric)??[]},e.metric))})]},e):null})]})}function J({value:e,onChange:t}){return(0,I.jsx)(`div`,{className:`oc-kpi__toolbar`,children:(0,I.jsx)(P,{value:e,onChange:t})})}function Y({config:e,series:t}){let n=t.length>0?t[t.length-1]:null,r=n?n.value:0;return(0,I.jsxs)(M,{size:`sm`,className:`oc-kpi__card`,children:[(0,I.jsxs)(O,{children:[(0,I.jsx)(A,{className:`oc-kpi__card-title`,children:e.label}),(0,I.jsx)(j,{className:`oc-kpi__card-metric`,children:(0,I.jsx)(`code`,{children:e.metric})})]}),(0,I.jsxs)(k,{className:`oc-kpi__card-body`,children:[(0,I.jsxs)(`div`,{className:`oc-kpi__value-row`,children:[(0,I.jsx)(`span`,{className:`oc-kpi__value`+(e.isError&&r>0?` oc-kpi__value--error`:``),children:Q(r)}),(0,I.jsx)(`span`,{className:`oc-kpi__unit`,children:e.unit})]}),(0,I.jsx)(ae,{series:t,isError:e.isError,unit:e.unit}),(0,I.jsxs)(`div`,{className:`oc-kpi__axis`,children:[n?(0,I.jsx)(`span`,{className:`oc-kpi__axis-latest`,children:o({value:$(n.bucket)})}):(0,I.jsx)(`span`,{className:`oc-kpi__muted`,children:c()}),(0,I.jsx)(`span`,{className:`oc-kpi__muted`,children:y({count:t.length})})]})]})]})}var X=240,Z=48,ie=1;function ae({series:e,isError:t,unit:n}){if(e.length===0)return(0,I.jsx)(`div`,{className:`oc-kpi__chart oc-kpi__chart--empty`,"aria-hidden":!0});let r=e.reduce((e,t)=>t.value>e?t.value:e,0),i=X/e.length,a=Math.max(i-ie,1);return(0,I.jsx)(`svg`,{className:`oc-kpi__chart`,viewBox:`0 0 ${X} ${Z}`,preserveAspectRatio:`none`,role:`img`,"aria-label":T({max:Q(r),unit:n}),children:e.map((e,o)=>{let s=r>0?e.value/r*(Z-1):0,c=o*i,l=Z-s;return(0,I.jsx)(`rect`,{className:`oc-kpi__bar`+(t&&e.value>0?` oc-kpi__bar--error`:``),x:c,y:l,width:a,height:s,children:(0,I.jsxs)(`title`,{children:[$(e.bucket),` · `,Q(e.value),` `,n]})},e.bucket)})})}function Q(e){return Number.isFinite(e)?Math.abs(e)>=1e3?(e/1e3).toFixed(e%1e3==0?0:1)+`k`:String(e):`0`}function $(e){let t=new Date(`${e}:00:00Z`);return Number.isNaN(t.getTime())?e:`${String(t.getUTCDate()).padStart(2,`0`)}/${String(t.getUTCMonth()+1).padStart(2,`0`)} ${String(t.getUTCHours()).padStart(2,`0`)}h`}export{q as KpiTab};
@@ -1 +0,0 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$O as r,A as i,Aj as a,BO as o,E as s,F as c,Fj as l,G as u,GO as d,HO as f,I as p,Ij as m,JO as ee,KO as te,Kj as ne,L as re,Lj as ie,M as ae,Mj as oe,N as se,Nj as ce,Oj as h,P as le,Pj as ue,QO as de,Rj as fe,UO as pe,VO as me,Vj as he,Vx as ge,WO as g,X as _,XO as v,YO as y,Z as b,ZO as x,_k as S,ak as C,bk as w,ck as T,dk as E,eM as D,ek as O,fk as k,gk as A,hk as j,ik as M,j as N,jj as P,kj as F,lk as I,mk as L,n as R,nk as _e,ok as ve,pk as ye,qO as z,rk as be,sk as xe,tM as B,tk as Se,uk as Ce,vk as we,yk as Te}from"./dist-CGzSsL4i.js";import{t as V}from"./button-D5AXX04a.js";import{A as Ee,C as H,S as U,b as De,bt as Oe,ct as W,lt as G,p as K,vt as ke,w as Ae,x as je,xt as q,yt as Me,z as Ne}from"./index-B0Kloary.js";import{t as Pe}from"./localePickerView-C2RmOS86.js";var J=t(e(),1),Y=n();function Fe({className:e,checked:t,onCheckedChange:n,disabled:r,...i}){return(0,Y.jsx)(`button`,{type:`button`,role:`switch`,"aria-checked":t,"data-state":t?`checked`:`unchecked`,disabled:r,onClick:()=>n(!t),className:R(`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,Y.jsx)(`span`,{className:R(`pointer-events-none block size-4 rounded-full bg-background shadow transition-transform`,t?`translate-x-[18px]`:`translate-x-[2px]`)})})}var X=[{id:`messages`,label:()=>w()},{id:`composer`,label:()=>Te()},{id:`sidebar`,label:()=>we()},{id:`other`,label:()=>S()}],Z={showSource:{category:`messages`,label:()=>A(),help:()=>j()},showReport:{category:`messages`,label:()=>L(),help:()=>ye()},copyAssistant:{category:`messages`,label:()=>k()},copyUser:{category:`messages`,label:()=>E()},showDelete:{category:`messages`,label:()=>Ce()},showTools:{category:`messages`,label:()=>I(),help:()=>T()},voiceInput:{category:`composer`,label:()=>xe(),help:()=>ve()},showUsage:{category:`composer`,label:()=>C(),help:()=>M()},autoReadAloud:{category:`composer`,label:()=>b(),help:()=>_()},showChatAge:{category:`sidebar`,label:()=>be(),help:()=>_e()},showChatProvider:{category:`sidebar`,label:()=>Se(),help:()=>O()}};function Q(e){return e.toLowerCase().normalize(`NFD`).replace(/\p{Diacritic}/gu,``)}function Ie(e,t){let n=Q(t.trim()),r=new Map(X.map(e=>[e.id,e.label()])),i=new Map(X.map(e=>[e.id,[]]));for(let t of e){let e=Z[t],a=e?.category??`other`;n&&!Q(`${e?e.label():t} ${e?.help?e.help():``} ${t} ${r.get(a)??``}`).includes(n)||i.get(a).push(t)}return X.map(e=>({id:e.id,label:r.get(e.id),keys:i.get(e.id)})).filter(e=>e.keys.length>0)}var Le=[`showSource`,`showReport`,`copyAssistant`,`copyUser`,`showDelete`,`showTools`,`voiceInput`,`showChatAge`,`showChatProvider`,`showUsage`,`autoReadAloud`],Re={voiceInput:`voiceInput`};function ze(e){return Le.includes(e)}function $(e){return e===`admin`}function Be(e){return e===!0?`on`:e===!1?`off`:`inherit`}function Ve(e){return e===`on`?!0:e===`off`?!1:null}function He(e){return ze(e)?Re[e]:void 0}var Ue={voiceInput:()=>g()};function We({prefKey:e,ui:t}){let n=D(s.admin.setUiPrefDefault),r=D(s.admin.setFeatureEnabled),i=He(e),a=i?Ue[e]?.():void 0;return(0,Y.jsxs)(`div`,{className:`oc-prefs__gov`,children:[(0,Y.jsxs)(`div`,{className:`oc-prefs__gov-row`,children:[(0,Y.jsx)(`span`,{className:`oc-prefs__gov-label`,children:ee()}),(0,Y.jsxs)(De,{value:Be(t.defaults[e]),onValueChange:t=>void n({key:e,value:Ve(t)}),children:[(0,Y.jsx)(H,{size:`sm`,className:`w-36`,children:(0,Y.jsx)(Ae,{})}),(0,Y.jsxs)(je,{children:[(0,Y.jsx)(U,{value:`on`,children:f()}),(0,Y.jsx)(U,{value:`off`,children:me()}),(0,Y.jsx)(U,{value:`inherit`,children:o()})]})]}),i?(0,Y.jsxs)(`span`,{className:`oc-prefs__gov-gate`,children:[(0,Y.jsx)(K,{checked:t.featuresEnabled[i]===!0,onCheckedChange:e=>void r({key:i,enabled:e===!0}),"aria-label":z()}),z()]}):null]}),a?(0,Y.jsx)(`span`,{className:`oc-prefs__gov-help`,children:a}):null]})}function Ge({current:e,enabled:t}){let n=D(s.me.setDictationShortcut),[r,a]=(0,J.useState)(!1),[o,l]=(0,J.useState)(!1);return(0,J.useEffect)(()=>{if(!r)return;let e=e=>{if(e.preventDefault(),e.stopPropagation(),e.key===`Escape`){a(!1);return}let t=Me(e);if(t===null){[`Shift`,`Control`,`Meta`,`Alt`].includes(e.key)||(l(!0),window.setTimeout(()=>l(!1),1800));return}a(!1),n({shortcut:t})};return window.addEventListener(`keydown`,e,!0),()=>window.removeEventListener(`keydown`,e,!0)},[r,n]),(0,Y.jsxs)(`div`,{className:`oc-prefs__row${t?``:` is-locked`}`,children:[(0,Y.jsxs)(`div`,{className:`oc-prefs__info`,children:[(0,Y.jsxs)(`span`,{className:`oc-prefs__label`,children:[re(),e?(0,Y.jsx)(W,{variant:`secondary`,children:Oe(e,ke())}):null]}),(0,Y.jsx)(`span`,{className:`oc-prefs__help`,children:o?le():r?c():p()})]}),(0,Y.jsxs)(`div`,{className:`oc-prefs__ctl`,children:[e&&!r?(0,Y.jsx)(`button`,{type:`button`,className:`oc-prefs__reset`,onClick:()=>void n({shortcut:null}),children:i()}):null,(0,Y.jsx)(`button`,{type:`button`,className:`oc-prefs__reset`,disabled:!t,"aria-pressed":r,onClick:()=>a(e=>!e),children:r?N():e?ae():se()})]})]})}function Ke(){let[e,t]=(0,J.useState)(``),[n,i]=(0,J.useState)(!1),a=B(s.me.getMe,{host:q}),o=a?.ui,c=$(a?.role)&&n,l=D(s.me.setUiPref).withOptimisticUpdate(Ee),f=(0,J.useMemo)(()=>o?Ie(Object.keys(o.effective),e):[],[o,e]);return o?(0,Y.jsxs)(`div`,{className:`oc-prefs-panel`,children:[$(a?.role)?(0,Y.jsxs)(`label`,{className:`oc-prefs__gov-toggle`,children:[(0,Y.jsx)(K,{checked:n,onCheckedChange:e=>i(e===!0),"aria-label":y()}),y()]}):null,c?(0,Y.jsxs)(`div`,{className:`oc-prefs__gov-head`,children:[(0,Y.jsx)(`p`,{children:te()}),(0,Y.jsx)(`p`,{children:d()}),(0,Y.jsx)(`p`,{children:pe()})]}):null,(0,Y.jsx)(G,{value:e,onChange:e=>t(e.target.value),placeholder:r(),"aria-label":r(),className:`mb-2`}),f.length===0?(0,Y.jsx)(`div`,{className:`oc-prefs__empty`,children:de()}):(0,Y.jsx)(`div`,{className:`oc-prefs`,children:f.map(e=>(0,Y.jsxs)(`section`,{className:`oc-prefs__card`,children:[(0,Y.jsx)(`h4`,{className:`oc-prefs__cat`,children:e.label}),e.keys.map(e=>{let t=Z[e],n=t?t.label():e,r=t?.help?.(),i=o.locked[e],a=o.effective[e],s=o.userOverrides[e]!==void 0;return(0,Y.jsxs)(`div`,{className:`oc-prefs__row${i?` is-locked`:``}`,children:[(0,Y.jsxs)(`div`,{className:`oc-prefs__info`,children:[(0,Y.jsxs)(`span`,{className:`oc-prefs__label`,children:[n,i?(0,Y.jsx)(W,{variant:`outline`,children:x()}):s?(0,Y.jsx)(W,{variant:`secondary`,children:u()}):null]}),r?(0,Y.jsx)(`span`,{className:`oc-prefs__help`,children:r}):null]}),(0,Y.jsxs)(`div`,{className:`oc-prefs__ctl`,children:[!i&&s?(0,Y.jsx)(`button`,{type:`button`,className:`oc-prefs__reset`,onClick:()=>void l({key:e,value:null}),children:v()}):null,(0,Y.jsx)(Fe,{checked:a,disabled:i,onCheckedChange:t=>void l({key:e,value:t}),"aria-label":n})]}),c?(0,Y.jsx)(We,{prefKey:e,ui:o}):null]},e)})]},e.id))}),(0,Y.jsx)(Ge,{current:a?.dictationShortcut??null,enabled:o.effective.voiceInput===!0})]}):(0,Y.jsx)(`div`,{className:`oc-prefs__empty`,children:ne()})}function qe(){let e=B(s.me.getMe,{host:q}),t=D(s.me.setLocale),n=D(s.me.setMyName),r=Ne(),i=e?.locale??`default`,o=e?.name??``,[c,u]=(0,J.useState)(null),d=c??o,f=d.trim()!==o.trim();async function p(){try{await n({name:d}),u(null),r.success(ue())}catch(e){r.error(ce(),e)}}return(0,Y.jsxs)(`div`,{className:`oc-appearance`,children:[(0,Y.jsxs)(`section`,{className:`oc-show__section`,children:[(0,Y.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,Y.jsx)(`h2`,{className:`oc-show__title`,children:fe()}),(0,Y.jsx)(`p`,{className:`oc-show__desc`,children:ie()})]}),(0,Y.jsxs)(`div`,{className:`oc-show__row`,children:[(0,Y.jsx)(G,{className:`max-w-xs`,value:d,maxLength:120,placeholder:m(),onChange:e=>u(e.target.value),onKeyDown:e=>{e.key===`Enter`&&f&&(e.preventDefault(),p())}}),(0,Y.jsx)(V,{size:`sm`,disabled:!f,onClick:()=>void p(),children:ge()})]}),(0,Y.jsx)(`p`,{className:`oc-show__desc`,children:l()})]}),(0,Y.jsxs)(`section`,{className:`oc-show__section`,children:[(0,Y.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,Y.jsx)(`h2`,{className:`oc-show__title`,children:oe()}),(0,Y.jsx)(`p`,{className:`oc-show__desc`,children:P()})]}),(0,Y.jsxs)(`div`,{className:`oc-show__row`,children:[Pe().map(e=>(0,Y.jsx)(V,{variant:i===e.value?`default`:`outline`,size:`sm`,onClick:()=>void t({locale:e.value}),children:e.label},e.value)),(0,Y.jsx)(V,{variant:i==="default"?`default`:`outline`,size:`sm`,onClick:()=>void t({locale:null}),children:he()})]}),(0,Y.jsx)(`p`,{className:`oc-show__desc`,children:a()})]}),(0,Y.jsxs)(`section`,{className:`oc-show__section`,children:[(0,Y.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,Y.jsx)(`h2`,{className:`oc-show__title`,children:F()}),(0,Y.jsx)(`p`,{className:`oc-show__desc`,children:h()})]}),(0,Y.jsx)(Ke,{})]})]})}export{qe as PreferencesTab};
@@ -1,4 +0,0 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$h as r,$t as i,E as a,Jh as o,Qh as s,Qt as c,Xh as l,Yh as u,Zh as d,Zt as f,_r as p,aa as m,ag as h,bg as g,br as _,cg as v,dg as y,eM as b,eg as x,fg as S,gr as C,ia as w,ig as T,lg as ee,na as E,ng as D,og as te,pg as ne,ra as re,rg as ie,sg as ae,tM as O,ta as k,tg as A,ug as j,vr as M,xg as N,xr as P,yr as F}from"./dist-CGzSsL4i.js";import{d as I,f as L,i as R,l as z,n as B,r as V,t as H,u as U}from"./FieldLabel-RnB1EBjO.js";import{t as W}from"./button-D5AXX04a.js";import{C as G,S as K,b as q,p as J,w as Y,x as X,xt as oe,z as se}from"./index-B0Kloary.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:v,help:ae},documentary_fetch:{label:te,help:h},inbound_files:{label:T,help:ie},history_summary:{label:m,help:w},file_curation:{label:P,help:_}},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:l,references:u,files:o,previous_summary:re,new_messages:E,max_chars:k,file_name:F,budget_chars:M,feedback:p,content:C};function pe(){let e=O(a.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:A()})});let r=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)(B,{label:ne(),help:S()}),(0,$.jsxs)(`label`,{className:`oc-injtab__picker`,children:[(0,$.jsx)(`span`,{children:D()}),(0,$.jsxs)(q,{value:r._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:r},r._id)]})}function me({instance:e}){let t=b(a.admin.upsertInstanceConfig),n=se(),r=O(a.me.getMe,{host:oe}),o=e.config??{},s=Z(e.config?.contentLocale,r?.defaultLocale??void 0),[l,u]=(0,Q.useState)(()=>R(o,s));(0,Q.useEffect)(()=>{u(R(o,s))},[s,e._id]);let[d,p]=(0,Q.useState)(!1),m=l.promptInjections,h=(e,t)=>u({...l,promptInjections:{...m,[e]:{...m[e],...t}}});async function _(){p(!0);try{await t({instanceId:e._id,config:V(l,o,s)})}catch(e){n.error(g(),e)}finally{p(!1)}}async function v(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(g(),e)}}let y=e.config?.contentLocale??`default`,x=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:i()}),(0,$.jsxs)(q,{value:y,onValueChange:e=>void v(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:f({locale:x})}),le().map(e=>(0,$.jsx)(K,{value:e.value,children:e.label},e.value))]})]}),(0,$.jsx)(`p`,{className:`oc-admin__hint`,children:c()})]}),U.map(e=>(0,$.jsx)(he,{injKey:e,def:z[e],i18n:ue[e],row:m[e]??{enabled:!0,template:z[e].defaultTemplate[s]},contentLocale:s,onChange:t=>h(e,t)},e)),(0,$.jsx)(`div`,{className:`oc-injtab__actions`,children:(0,$.jsx)(W,{size:`sm`,onClick:()=>void _(),disabled:d,children:N()})})]})}function he({injKey:e,def:t,i18n:n,row:i,contentLocale:a,onChange:o}){let[c,l]=(0,Q.useState)(!1),u=i.template.trim()!==t.defaultTemplate[a],f=t.togglable&&!i.enabled,p=Object.fromEntries(t.placeholders.map(e=>[e,de[e]??`{${e}}`])),m=I(e,i,a),h=m?L(m,p):``;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)(J,{checked:i.enabled,onCheckedChange:e=>o({enabled:e===!0})}),(0,$.jsx)(B,{label:n.label(),help:n.help()})]}):(0,$.jsx)(B,{label:n.label(),help:n.help()}),u&&(0,$.jsx)(`span`,{className:`oc-injection__badge`,children:j()})]}),(0,$.jsx)(`textarea`,{className:`oc-injcard__text`,value:i.template,disabled:f,rows:8,spellCheck:!1,onChange:e=>o({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:ee()}),t.placeholders.map(e=>(0,$.jsxs)(`span`,{className:`oc-injcard__ph-chip`,children:[(0,$.jsx)(`code`,{children:`{${e}}`}),(0,$.jsx)(H,{text:(fe[e]??(()=>e))()})]},e))]}),(0,$.jsxs)(`div`,{className:`oc-injcard__btns`,children:[(0,$.jsx)(W,{variant:`ghost`,size:`sm`,onClick:()=>l(e=>!e),children:c?r():x()}),u&&(0,$.jsx)(W,{variant:`ghost`,size:`sm`,onClick:()=>o({template:t.defaultTemplate[a]}),children:y()})]})]}),c&&(0,$.jsx)(`div`,{className:`oc-injcard__preview`,children:h?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`pre`,{className:`oc-injcard__previewtext`,children:h}),(0,$.jsx)(`span`,{className:`oc-injection__ph`,children:s()})]}):(0,$.jsx)(`span`,{className:`oc-injection__ph`,children:d()})})]})}export{pe as PromptInjectionsTab};
@@ -1 +0,0 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$y as r,Ay as i,By as a,Cy as ee,E as o,Fy as s,Gr as c,Gy as l,Hy as u,Iy as d,Jy as f,Ky as p,Ly as m,My as h,Ny as te,Py as ne,Qy as g,Ry as re,Sy as _,Uy as v,Vy as y,Wy as b,Xy as x,Yy as S,Zy as C,_y as ie,ab as w,by as T,eM as E,eb as D,gy as O,ib as k,jy as A,nb as j,qy as M,rb as N,tM as P,tb as F,vy as I,wy as L,xy as R,yy as ae,zy as z}from"./dist-CGzSsL4i.js";import{t as B}from"./button-D5AXX04a.js";import{B as V,Rt as H,ct as U,lt as W,p as G,u as K,z as q}from"./index-B0Kloary.js";import{t as J}from"./roleDescriptions-BXezQ4Y4.js";var Y=t(e(),1),X=n(),Z=[{group:()=>w(),keys:[{key:`traces.read`,label:()=>D()},{key:`traces.read.content`,label:()=>r(),phi:!0},{key:`traces.write`,label:()=>g()}]},{group:()=>k(),keys:[{key:`kpi.read`,label:()=>D()},{key:`kpi.write`,label:()=>g()}]},{group:()=>N(),keys:[{key:`openclaw.query`,label:()=>C()},{key:`anomalies.read`,label:()=>x()},{key:`anomalies.report`,label:()=>S()}]},{group:()=>j(),keys:[{key:`chats.read`,label:()=>D()},{key:`selfheal`,label:()=>M()},{key:`feedback.respond`,label:()=>c()}]},{group:()=>F(),keys:[{key:`admin.manage`,label:()=>f()}]}],oe=Z.flatMap(e=>e.keys.map(e=>e.key));function Q(e){return e.includes(`*`)}var $={key:``,name:``,description:``};function se(){let e=P(o.apiKeys.listRoles,{}),t=E(o.apiKeys.createRole),n=E(o.apiKeys.ensureRolesSeeded),r=E(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))}),c=V(),f=q(),[g,x]=(0,Y.useState)(!1),[S,C]=(0,Y.useState)($),[w,D]=(0,Y.useState)(new Set);(0,Y.useEffect)(()=>{n({}).catch(e=>{f.error(l(),e)})},[n,f]);let k=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 c({title:b({name:e.name}),description:v(),confirmLabel:u()}))){D(t=>new Set(t).add(e._id));try{await r({roleId:e._id,permissions:n})}catch(e){f.error(y(),e)}finally{D(t=>{let n=new Set(t);return n.delete(e._id),n})}}}async function M(){try{await t({key:S.key,name:S.name,description:S.description||void 0,permissions:[]}),C($),x(!1)}catch(e){f.error(a(),e)}}let N=e===void 0,F=!N&&k.length===0;return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`p`,{className:`oc-admin__hint`,children:[z(),` `,(0,X.jsx)(`code`,{children:`admin`}),` `,re(),` `,(0,X.jsx)(`code`,{children:`traces.read.content`}),` `,m()]}),(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:d()}),(0,X.jsx)(`div`,{className:`oc-dt__bar-actions`,children:(0,X.jsx)(B,{size:`sm`,onClick:()=>{C($),x(!0)},children:s()})})]}),N?(0,X.jsx)(`p`,{className:`oc-admin__hint`,children:ne()}):F?(0,X.jsx)(`p`,{className:`oc-admin__hint`,children:te()}):(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:h()}),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?p({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:k.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)(U,{variant:`outline`,className:`gap-1`,children:[(0,X.jsx)(H,{}),` `,A()]}):(0,X.jsx)(U,{variant:`secondary`,children:i()})]}),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?L():n?ee():r,onCheckedChange:()=>void j(e,r)})},r))]},e.key)})})]})})]}),(0,X.jsx)(K,{open:g,onOpenChange:x,title:_(),description:R(),canSubmit:!!(S.key&&S.name),onSubmit:M,submitLabel:T(),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:ae()}),(0,X.jsx)(W,{value:S.key,placeholder:I(),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:ie()}),(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:O()}),(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{$D as r,AD as i,AO as ee,BD as a,CD as o,CO as te,DD as s,DO as ne,E as c,ED as l,EO as re,FD as u,FO as ie,GD as ae,HD as d,ID as f,IO as oe,JD as se,KD as ce,LD as p,LO as le,MD as m,MO as ue,ND as h,NO as g,OD as _,OO as de,PD as fe,PO as pe,QD as me,Qj as he,RD as v,RO as ge,SD as y,SO as _e,TD as ve,TO as ye,UD as be,VD as b,WD as xe,XD as Se,YD as Ce,ZD as we,_O as Te,aO as Ee,bD as x,bO as De,cO as Oe,dO as ke,eM as S,eO as Ae,fO as je,gO as Me,hO as Ne,iO as Pe,jD as C,jO as Fe,kD as w,kO as Ie,lO as Le,mO as Re,nO as ze,oO as Be,pO as Ve,qD as He,rO as Ue,sO as We,tM as T,tO as Ge,uO as Ke,vO as qe,wD as E,wO as Je,xD as D,xO as Ye,yD as O,yO as Xe,zD as k,zO as Ze}from"./dist-CGzSsL4i.js";import{n as A}from"./dist-fE9pwpr-.js";import{i as Qe}from"./dist-Cy-5Eo9H.js";import{t as j}from"./button-D5AXX04a.js";import{$ as M,B as $e,C as N,S as P,Wt as F,Xt as et,Yt as tt,b as I,ct as L,dt as R,et as z,ft as B,ht as V,lt as H,mt as U,pt as nt,qt as rt,u as it,ut as W,w as G,x as K,z as at}from"./index-B0Kloary.js";import{t as ot}from"./FilterBar-Dy10_IPZ.js";import{t as st}from"./DataTableShell-Bzopt4OT.js";import{t as ct}from"./roleDescriptions-BXezQ4Y4.js";var q=t(e(),1),J=n(),Y=[{value:`never`,label:()=>ve(),days:null},{value:`30`,label:()=>E(),days:30},{value:`90`,label:()=>o(),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??``,i=e.status??Z,[a,o]=(0,q.useState)(Z),s=e=>void t({search:t=>({...t,q:e||void 0}),replace:!0}),l=e=>void t({search:t=>({...t,status:e===Z?void 0:e})}),u=T(c.apiKeys.listServiceAccounts,{filter:{q:n||void 0,role:a===Z?void 0:a,disabled:i===Z?void 0:i===`disabled`}}),d=T(c.apiKeys.listKeys,{}),f=T(c.apiKeys.listRoles,{}),p=S(c.apiKeys.createServiceAccount),m=S(c.apiKeys.updateServiceAccount),h=S(c.apiKeys.deleteServiceAccount),_=he(c.apiKeys.mintApiKey),fe=S(c.apiKeys.revokeApiKey),v=$e(),y=at(),ve=n!==``||a!==Z||i!==Z;function b(){o(Z),t({search:{},replace:!0})}let[x,C]=(0,q.useState)(!1),[w,E]=(0,q.useState)(Q),[D,O]=(0,q.useState)(null),[k,A]=(0,q.useState)(new Set),[M,F]=(0,q.useState)(null),R=(0,q.useRef)(!1),[z,B]=(0,q.useState)(new Set),[V,U]=(0,q.useState)({}),[nt,W]=(0,q.useState)(null),X=(0,q.useMemo)(()=>{let e=new Map;for(let t of d??[]){let n=e.get(t.serviceAccountId)??[];n.push(t),e.set(t.serviceAccountId,n)}return e},[d]);function $(e){A(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})}async function dt(){try{D?(await m({serviceAccountId:D,name:w.name,roleKey:w.roleKey,description:w.description}),y.success(Ue())):await p({name:w.name,roleKey:w.roleKey,description:w.description||void 0}),E(Q),O(null),C(!1)}catch(e){y.error(D?Pe():Ee(),e)}}function ft(e){E({name:e.name,roleKey:e.roleKey,description:e.description??``}),O(e._id),C(!0)}async function pt(e){if(R.current)return;R.current=!0;let t=V[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 _({serviceAccountId:e._id,expiresAt:r});W({accountName:e.name,plaintext:t.plaintext,prefix:t.prefix,lastFour:t.lastFour})}catch(e){y.error(ze(),e)}finally{R.current=!1,F(null)}}async function mt(e){if(await v({title:Ge(),description:(0,J.jsxs)(J.Fragment,{children:[Ae(),` `,(0,J.jsx)(`span`,{className:`font-mono`,children:e.name}),` `,r(),` `,(0,J.jsx)(`strong`,{children:me()}),` `,we()]}),confirmWord:e.name,confirmLabel:Se(),destructive:!0}))try{await h({serviceAccountId:e._id}),y.success(Ce(),e.name)}catch(e){y.error(se(),e)}}async function ht(e){if(await v({title:He(),description:(0,J.jsxs)(J.Fragment,{children:[ce(),` `,(0,J.jsxs)(`span`,{className:`font-mono`,children:[e.prefix,`…`,e.lastFour]}),` `,ae()]}),confirmLabel:xe(),destructive:!0})&&!z.has(e._id)){B(t=>new Set(t).add(e._id));try{await fe({keyId:e._id})}catch(e){y.error(be(),e)}finally{B(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:Ze()}),(0,J.jsxs)(ot,{q:n,onQChange:s,searchPlaceholder:ge(),onReset:b,canReset:ve,children:[(0,J.jsxs)(I,{value:a,onValueChange:o,children:[(0,J.jsx)(N,{size:`sm`,className:`w-40`,children:(0,J.jsx)(G,{placeholder:le()})}),(0,J.jsxs)(K,{children:[(0,J.jsx)(P,{value:Z,children:oe()}),(f??[]).map(e=>(0,J.jsx)(P,{value:e.key,children:e.key},e._id))]})]}),(0,J.jsxs)(I,{value:i,onValueChange:l,children:[(0,J.jsx)(N,{size:`sm`,className:`w-36`,children:(0,J.jsx)(G,{})}),(0,J.jsxs)(K,{children:[(0,J.jsx)(P,{value:Z,children:ie()}),(0,J.jsx)(P,{value:`active`,children:pe()}),(0,J.jsx)(P,{value:`disabled`,children:g()})]})]})]}),(0,J.jsx)(st,{title:ue(),rows:u,addLabel:Fe(),onAdd:()=>{E(Q),O(null),C(!0)},emptyHint:ee(),isExpanded:e=>k.has(e._id),renderExpanded:e=>(0,J.jsx)(lt,{account:e,keys:X.get(e._id)??[],onRevoke:ht,revoking:z}),rowActions:e=>[{label:re(),onSelect:()=>ft(e)},{label:Ie(),onSelect:()=>void pt(e)},{label:k.has(e._id)?de():ne(),onSelect:()=>$(e._id)},{label:ye(),variant:`destructive`,onSelect:()=>void mt(e)}],columns:[{header:``,className:`w-8`,cell:e=>(0,J.jsx)(j,{variant:`ghost`,size:`icon-sm`,"aria-label":k.has(e._id)?Je():te(),onClick:()=>$(e._id),children:k.has(e._id)?(0,J.jsx)(Qe,{}):(0,J.jsx)(rt,{})})},{header:_e(),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:Ye(),sort:e=>e.roleKey,cell:e=>(0,J.jsx)(L,{variant:`secondary`,children:e.roleKey})},{header:De(),sort:e=>+!!e.disabled,cell:e=>e.disabled?(0,J.jsx)(L,{variant:`destructive`,children:g()}):(0,J.jsx)(L,{variant:`outline`,children:pe()})},{header:Xe(),cell:e=>(0,J.jsxs)(I,{value:V[e._id]??`never`,onValueChange:t=>U(n=>({...n,[e._id]:t})),children:[(0,J.jsx)(N,{size:`sm`,className:`w-32`,children:(0,J.jsx)(G,{})}),(0,J.jsx)(K,{children:Y.map(e=>(0,J.jsx)(P,{value:e.value,children:e.label()},e.value))})]})},{header:qe(),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:M===e._id?Te():Me({count:t})})}}]}),(0,J.jsx)(it,{open:x,onOpenChange:e=>{C(e),e||O(null)},title:D?Ne():je(),description:D?Re():ke(),canSubmit:!!(w.name&&w.roleKey),onSubmit:dt,submitLabel:D?Ve():Ke(),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:Le()}),(0,J.jsx)(H,{value:w.name,onChange:e=>E({...w,name:e.target.value})})]}),(0,J.jsxs)(`label`,{className:`oc-field`,children:[(0,J.jsx)(`span`,{className:`oc-field__label`,children:Oe()}),(0,J.jsxs)(I,{value:w.roleKey||void 0,onValueChange:e=>E({...w,roleKey:e}),children:[(0,J.jsx)(N,{className:`w-full`,children:(0,J.jsx)(G,{placeholder:We()})}),(0,J.jsx)(K,{children:(f??[]).map(e=>(0,J.jsxs)(P,{value:e.key,children:[e.name,` (`,e.key,`)`]},e._id))})]}),(()=>{let e=(f??[]).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:Be()}),(0,J.jsx)(H,{value:w.description,onChange:e=>E({...w,description:e.target.value})})]})]})}),(0,J.jsx)(ut,{minted:nt,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:[d(),` `,(0,J.jsx)(`span`,{className:`font-medium`,children:e.name})]}),t.length===0?(0,J.jsx)(`p`,{className:`oc-admin__hint`,children:b()}):(0,J.jsxs)(`table`,{className:`oc-sa__keytable`,children:[(0,J.jsx)(`thead`,{children:(0,J.jsxs)(`tr`,{children:[(0,J.jsx)(`th`,{children:a()}),(0,J.jsx)(`th`,{children:k()}),(0,J.jsx)(`th`,{children:v()}),(0,J.jsx)(`th`,{children:p()}),(0,J.jsx)(`th`,{children:f()}),(0,J.jsx)(`th`,{children:u()}),(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:z(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)(j,{variant:`destructive`,size:`sm`,disabled:r.has(t._id),onClick:()=>n(t),children:r.has(t._id)?fe():h()})})]},t._id))})]})]})}function ut({minted:e,onClose:t}){let[n,r]=(0,q.useState)(!1);async function ee(){if(e)try{await navigator.clipboard.writeText(e.plaintext),r(!0),window.setTimeout(()=>r(!1),2e3)}catch{}}return(0,J.jsx)(W,{open:e!==null,onOpenChange:e=>{e||(r(!1),t())},children:e?(0,J.jsxs)(R,{className:`max-w-lg`,showCloseButton:!1,onInteractOutside:e=>e.preventDefault(),onEscapeKeyDown:e=>e.preventDefault(),children:[(0,J.jsxs)(U,{children:[(0,J.jsx)(V,{children:m()}),(0,J.jsx)(B,{children:C({name:e.accountName})})]}),(0,J.jsx)(`div`,{className:`oc-sa__minted-warning`,children:i()}),(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)(j,{variant:`outline`,size:`sm`,onClick:()=>void ee(),"aria-label":w(),children:[n?(0,J.jsx)(A,{}):(0,J.jsx)(F,{}),n?_():s()]})]}),(0,J.jsx)(nt,{children:(0,J.jsx)(j,{onClick:()=>{r(!1),t()},children:l()})})]}):null})}function dt(e){return e===null?!1:Date.now()-e>X}function ft(e){return e===null?y():z(e)}function pt(e){return e===null?`—`:M(e)}function mt(e){return e.disabled?(0,J.jsx)(L,{variant:`destructive`,children:D()}):e.expiresAt!==null&&e.expiresAt<Date.now()?(0,J.jsx)(L,{variant:`outline`,children:x()}):(0,J.jsx)(L,{variant:`outline`,children:O()})}export{$ as ServiceAccountsTab};
@@ -1 +0,0 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$k as r,AA as i,Ak as a,BA as o,Bk as s,CA as c,Ck as l,D as u,DA as d,Dk as f,E as p,EA as m,Ek as h,FA as g,Fk as _,Gk as v,HA as y,Hj as b,Hk as ee,IA as te,Ik as ne,Jk as re,Kk as ie,LA as ae,Lk as oe,MA as se,Mk as ce,NA as x,Nk as le,OA as ue,Ok as de,PA as fe,Pk as pe,Qj as me,Qk as he,RA as ge,Rk as _e,SA as ve,Sk as ye,TA as be,Tk as S,UA as xe,Uj as Se,Uk as Ce,VA as we,Vk as C,Wj as Te,Wk as Ee,Xk as De,Yk as Oe,Zk as ke,_A as Ae,aA as je,bA as Me,cA as Ne,ca as Pe,dA as Fe,eA as Ie,eM as w,fA as Le,gA as Re,hA as ze,iA as Be,jA as Ve,jk as He,kA as Ue,kk as T,lA as We,la as E,mA as Ge,n as Ke,nA as qe,oA as D,oa as Je,pA as Ye,qk as Xe,rA as Ze,sA as Qe,sa as $e,tA as et,tM as O,uA as tt,vA as nt,wA as rt,wk as it,xA as at,xk as ot,yA as st,zA as ct,zk as lt}from"./dist-CGzSsL4i.js";import{n as k}from"./dist-fE9pwpr-.js";import{t as A}from"./x-CQuunpf5.js";import{t as j}from"./button-D5AXX04a.js";import{C as M,Ht as N,S as P,Ut as ut,_t as dt,at as ft,b as F,ct as I,gt as pt,it as L,lt as R,nt as mt,ot as ht,p as z,rt as gt,st as _t,w as B,x as V,xt as H}from"./index-B0Kloary.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-DYY__lMj.js";import{a as Tt,i as U,n as Et,o as W,r as G,t as Dt}from"./table-BDhz0ajJ.js";import{t as Ot}from"./TimeRangePicker-CZSYqXhd.js";import{t as kt}from"./FilterBar-Dy10_IPZ.js";import{t as At}from"./AdvancedFilter-B6lCXnk_.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(Ee());if(e.size>Rt)throw Error(Ce());let{source:n,width:r,height:i,cleanup:a}=await Ut(e);try{let a=e.type===`image/svg+xml`,o=Math.min(zt/r,Bt/i,a?1/0:1),c=Math.max(1,Math.round(r*o)),l=Math.max(1,Math.round(i*o)),u=document.createElement(`canvas`);u.width=c,u.height=l;let d=u.getContext(`2d`);if(!d)throw Error(C());d.imageSmoothingEnabled=!0,d.imageSmoothingQuality=`high`,d.drawImage(n,0,0,c,l);let f=Pt(d.getImageData(0,0,c,l).data,c,l)??{x:0,y:0,width:c,height:l},p=document.createElement(`canvas`);p.width=f.width,p.height=f.height;let m=p.getContext(`2d`);if(!m)throw Error(C());if(m.drawImage(u,f.x,f.y,f.width,f.height,0,0,f.width,f.height),t.variantFor){let e=m.getImageData(0,0,f.width,f.height);J(e.data,f.width,f.height)?It(e.data,t.variantFor===`dark`?Mt:Nt):Lt(e.data),m.putImageData(e,0,0)}let h=J(m.getImageData(0,0,f.width,f.height).data,f.width,f.height),g=await X(p,`image/webp`,Vt)??await X(p,`image/png`);if(!g)throw Error(s());return{blob:g,hasAlpha:h}}finally{a()}}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(ee())),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`?Te():e===`dark`?Se():b()}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:Ke(`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)(k,{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)(j,{type:`button`,variant:`ghost`,size:`icon`,className:`oc-chart-card__export`,onClick:o,"aria-label":E(),title:E(),children:(0,Z.jsx)(ut,{className:`size-4`})}):null]})}function Zt({selectedKey:e,resolvedMode:t}){let n=O(p.charts.listMyCharts),r=w(p.charts.setMyChart);async function a(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:g()}),(0,Z.jsx)(`p`,{className:`oc-show__desc`,children:fe()})]}),(0,Z.jsxs)(`div`,{className:`oc-chart-grid`,children:[(0,Z.jsx)(Xt,{selected:e===null,title:x(),subtitle:se(),tokens:null,mode:t,onSelect:()=>void a(null)}),(n??[]).map(n=>{let r=n.via===`common`?Ve():n.via===`owner`?i():Ue({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 a(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:ue()}):null]})}function Qt(){let e=w(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),[l,u]=(0,q.useState)(!1);async function d(e){let t=e.target.files?.[0];if(e.target.value=``,t){o(null),c(!1);try{i(await t.text())}catch{o(D())}}}async function f(){if(o(null),c(!1),t.trim()===``){o(Be());return}let a;try{a=JSON.parse(r)}catch{o(D());return}u(!0);try{await e({name:t.trim(),tokens:a}),c(!0),n(``),i(``)}catch(e){o(e instanceof Error?e.message:String(e))}finally{u(!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:Ge()}),(0,Z.jsx)(`p`,{className:`oc-show__desc`,children:Ye()})]}),(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:Le()}),(0,Z.jsx)(R,{value:t,onChange:e=>n(e.target.value),placeholder:Fe(),maxLength:60})]}),(0,Z.jsxs)(`label`,{className:`oc-chart-import__field`,children:[(0,Z.jsx)(`span`,{className:`oc-chart-import__label`,children:tt()}),(0,Z.jsx)(`textarea`,{className:`oc-chart-import__textarea`,value:r,onChange:e=>i(e.target.value),placeholder:We(),rows:8,spellCheck:!1})]}),(0,Z.jsxs)(`div`,{className:`oc-show__row`,children:[(0,Z.jsx)(j,{variant:`outline`,size:`sm`,asChild:!0,children:(0,Z.jsxs)(`label`,{className:`oc-chart-import__file`,children:[(0,Z.jsx)(K,{className:`size-4`}),Ne(),(0,Z.jsx)(`input`,{type:`file`,accept:`application/json,.json`,className:`oc-chart-import__file-input`,onChange:e=>void d(e)})]})}),(0,Z.jsx)(j,{size:`sm`,disabled:l,onClick:()=>void f(),children:Qe()})]}),a?(0,Z.jsx)(`p`,{className:`oc-chart-import__error`,children:a}):null,s?(0,Z.jsx)(`p`,{className:`oc-chart-import__ok`,children:je()}):null]})]})}function $t({chart:e}){let t=me(p.charts.setChartLogo),n=w(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`?ke():De()}),(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)(j,{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?re():Oe(),(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)(j,{variant:`ghost`,size:`sm`,disabled:r,onClick:()=>void d(e),children:ie()}):null,t?(0,Z.jsx)(j,{variant:`ghost`,size:`sm`,disabled:r,onClick:()=>void u(e),children:Xe()}):null]})}return(0,Z.jsxs)(`div`,{className:`oc-chart-mine__logo`,children:[(0,Z.jsx)(`span`,{className:`oc-chart-mine__groups-label`,children:he()}),(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:v()}):null,a?(0,Z.jsx)(`p`,{className:`oc-chart-import__error`,children:a}):null]})}function en({chart:e}){let t=O(p.me.getMe,{host:H}),n=w(p.charts.addChartDomain),r=w(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:lt()}),(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:_()}):u.map(e=>(0,Z.jsxs)(I,{variant:`secondary`,className:`oc-chart-avail__chip`,children:[e,(0,Z.jsx)(`button`,{type:`button`,className:`oc-chart-avail__chip-x`,"aria-label":pe({domain:e}),onClick:()=>void f(e),children:(0,Z.jsx)(A,{className:`size-3`})})]},e))}),(0,Z.jsxs)(`div`,{className:`oc-show__row`,children:[(0,Z.jsx)(R,{value:i,onChange:e=>a(e.target.value),placeholder:oe(),className:`oc-chart-mine__domains-input`,onKeyDown:e=>{e.key===`Enter`&&d()}}),(0,Z.jsx)(j,{variant:`outline`,size:`sm`,disabled:c,onClick:()=>void d(),children:ne()})]}),(0,Z.jsx)(`span`,{className:`oc-show__desc`,children:_e()}),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=w(p.charts.updateChart),n=w(p.charts.deleteChart),[i,o]=(0,q.useState)(!1),[s,c]=(0,q.useState)(e.name),[l,u]=(0,q.useState)(()=>tn(e.tokens)),[d,f]=(0,q.useState)(e.tokens.bpm??0),[m,h]=(0,q.useState)(null),[g,_]=(0,q.useState)(!1);function v(){c(e.name),u(tn(e.tokens)),f(e.tokens.bpm??0),h(null),o(!0)}async function y(){if(e.chartId===void 0)return;h(null);let n;try{n=JSON.parse(l)}catch{h(D());return}if(n&&typeof n==`object`&&!Array.isArray(n)){let e=n;d>0?e.bpm=d:delete e.bpm}_(!0);try{await t({chartId:e.chartId,name:s.trim(),tokens:n}),o(!1)}catch(e){h(e instanceof Error?e.message:String(e))}finally{_(!1)}}async function b(){if(e.chartId!==void 0&&window.confirm(T()))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:i?null:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(j,{variant:`outline`,size:`sm`,onClick:v,children:Ie()}),(0,Z.jsx)(j,{variant:`ghost`,size:`sm`,onClick:()=>void b(),children:r()})]})})]}),i?(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:He()}),(0,Z.jsx)(R,{value:s,onChange:e=>c(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:Pe()}),(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:d,onChange:e=>f(Number(e.target.value)),"aria-label":Pe()}),(0,Z.jsx)(`span`,{className:`oc-chart-bpm__value`,children:d===0?$e():`${d} BPM`})]}),(0,Z.jsx)(`span`,{className:`oc-show__desc`,children:Je()})]}),(0,Z.jsxs)(`label`,{className:`oc-chart-import__field`,children:[(0,Z.jsx)(`span`,{className:`oc-chart-import__label`,children:a()}),(0,Z.jsx)(`textarea`,{className:`oc-chart-import__textarea`,value:l,onChange:e=>u(e.target.value),rows:10,spellCheck:!1})]}),m?(0,Z.jsx)(`p`,{className:`oc-chart-import__error`,children:m}):null,(0,Z.jsxs)(`div`,{className:`oc-show__row`,children:[(0,Z.jsx)(j,{size:`sm`,disabled:g,onClick:()=>void y(),children:le()}),(0,Z.jsx)(j,{variant:`ghost`,size:`sm`,onClick:()=>o(!1),children:ce()})]})]}):null,(0,Z.jsx)($t,{chart:e}),(0,Z.jsx)(en,{chart:e})]})}function rn(){let e=O(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:Ze()}),(0,Z.jsx)(`p`,{className:`oc-show__desc`,children:qe()})]}),e!==void 0&&t.length===0?(0,Z.jsx)(`p`,{className:`oc-show__desc`,children:et()}):(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=w(p.charts.addChartToGroupPool),r=w(p.charts.removeChartFromGroupPool),i=e.restrictedToGroups,a=e.poolGroups,o=new Set((a??[]).map(e=>e.groupId)),s=t.filter(e=>!o.has(e._id));async function c(t){try{await n({groupId:t,chartKey:e.key})}catch{}}async function l(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)(I,{variant:i?`secondary`:`outline`,className:`oc-chart-avail__state`,children:i?Me():e.kind===`custom`&&e.scope===`personal`?S():at()}),e.isGlobalDefault?(0,Z.jsx)(I,{variant:`default`,children:st()}):null]}),(0,Z.jsxs)(`div`,{className:`oc-chart-avail__groups`,children:[(0,Z.jsx)(`span`,{className:`oc-chart-mine__groups-label`,children:Ae()}),(a??[]).map(e=>(0,Z.jsxs)(I,{variant:`secondary`,className:`oc-chart-avail__chip`,children:[e.name,(0,Z.jsx)(`button`,{type:`button`,className:`oc-chart-avail__chip-x`,"aria-label":ze({group:e.name}),onClick:()=>void l(e.groupId),children:(0,Z.jsx)(A,{className:`size-3`})})]},e.groupId)),s.length>0?(0,Z.jsxs)(F,{value:``,onValueChange:e=>void c(e),children:[(0,Z.jsx)(M,{size:`sm`,className:`w-56`,children:(0,Z.jsx)(B,{placeholder:Re()})}),(0,Z.jsx)(V,{children:s.map(e=>(0,Z.jsx)(P,{value:e._id,children:e.name},e._id))})]}):t.length===0?(0,Z.jsx)(`span`,{className:`oc-show__desc`,children:nt()}):null]})]})}function on({chart:e}){let t=w(p.charts.promoteChartToCommon),n=w(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(T()))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)(I,{variant:e.scope===`common`?`outline`:`secondary`,children:e.scope===`common`?it():S()}),e.ownerLabel?(0,Z.jsx)(`span`,{className:`oc-show__desc`,children:h({owner:e.ownerLabel})}):null]}),(0,Z.jsxs)(`div`,{className:`oc-show__row`,children:[e.scope===`personal`?(0,Z.jsx)(j,{variant:`outline`,size:`sm`,onClick:()=>void r(),children:l()}):null,(0,Z.jsx)(j,{variant:`ghost`,size:`sm`,onClick:()=>void i(),children:ye()})]})]})}function sn({defaultThemeMode:e,defaultLocale:t,defaultChartKey:n}){let r=w(p.admin.setDefaultThemeMode),i=w(p.admin.setDefaultLocale),a=w(p.charts.setDefaultChart),s=O(p.charts.listChartsAdmin),l=O(p.groups.listGroups,{}),u=e??`system`,h=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:te()})]}),(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:d()}),(0,Z.jsx)(`p`,{className:`oc-show__desc`,children:m()})]}),(0,Z.jsxs)(`div`,{className:`oc-show__row`,children:[(0,Z.jsx)(j,{variant:n===null?`default`:`outline`,size:`sm`,onClick:()=>void a({name:null}),children:x()}),dt.map(e=>(0,Z.jsx)(j,{variant:n===e.key?`default`:`outline`,size:`sm`,onClick:()=>void a({name:e.key}),children:e.name},e.key)),(s??[]).filter(e=>e.kind===`custom`&&e.scope===`common`).map(e=>(0,Z.jsx)(j,{variant:n===e.key?`default`:`outline`,size:`sm`,onClick:()=>void a({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:be()}),(0,Z.jsx)(`p`,{className:`oc-show__desc`,children:rt()})]}),(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:l??[]},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:c()}),(0,Z.jsx)(`p`,{className:`oc-show__desc`,children:ve()})]}),(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:de()}),(0,Z.jsx)(`p`,{className:`oc-show__desc`,children:f()})]}),(()=>{let e=(s??[]).filter(e=>e.kind===`custom`);return e.length===0?(0,Z.jsx)(`p`,{className:`oc-show__desc`,children:ot()}):(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:xe()}),(0,Z.jsx)(`p`,{className:`oc-show__desc`,children:y()})]}),(0,Z.jsx)(`div`,{className:`oc-show__row`,children:[`light`,`dark`,`system`].map(e=>(0,Z.jsx)(j,{variant:u===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:we()}),(0,Z.jsx)(`p`,{className:`oc-show__desc`,children:o()})]}),(0,Z.jsx)(`div`,{className:`oc-show__row`,children:vt().map(e=>(0,Z.jsx)(j,{variant:h===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:ct()})]})]})}function cn(){let e=O(p.me.getMe,{host:H}),t=pt(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:ge()}),(0,Z.jsxs)($,{title:`Buttons`,description:`Variants`,children:[(0,Z.jsxs)(`div`,{className:`oc-show__row`,children:[(0,Z.jsx)(j,{children:`Default`}),(0,Z.jsx)(j,{variant:`secondary`,children:`Secondary`}),(0,Z.jsx)(j,{variant:`outline`,children:`Outline`}),(0,Z.jsx)(j,{variant:`ghost`,children:`Ghost`}),(0,Z.jsx)(j,{variant:`destructive`,children:`Destructive`}),(0,Z.jsx)(j,{variant:`link`,children:`Link`})]}),(0,Z.jsxs)(`div`,{className:`oc-show__row`,children:[(0,Z.jsx)(j,{size:`sm`,children:`Small`}),(0,Z.jsx)(j,{children:`Default`}),(0,Z.jsx)(j,{size:`lg`,children:`Large`}),(0,Z.jsx)(j,{size:`icon`,"aria-label":`more`,children:(0,Z.jsx)(N,{})}),(0,Z.jsx)(j,{disabled:!0,children:`Disabled`})]})]}),(0,Z.jsx)($,{title:`Badges`,children:(0,Z.jsxs)(`div`,{className:`oc-show__row`,children:[(0,Z.jsx)(I,{children:`Default`}),(0,Z.jsx)(I,{variant:`secondary`,children:`Secondary`}),(0,Z.jsx)(I,{variant:`outline`,children:`Outline`}),(0,Z.jsx)(I,{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)(R,{placeholder:`Text input…`}),(0,Z.jsxs)(`div`,{className:`oc-show__row`,children:[(0,Z.jsxs)(F,{value:n,onValueChange:r,children:[(0,Z.jsx)(M,{className:`w-56`,children:(0,Z.jsx)(B,{placeholder:`Select…`})}),(0,Z.jsxs)(V,{children:[(0,Z.jsx)(P,{value:`per-user`,children:`per-user (chacun son agent)`}),(0,Z.jsx)(P,{value:`shared`,children:`shared (agent commun)`})]})]}),(0,Z.jsxs)(`label`,{className:`oc-show__check`,children:[(0,Z.jsx)(z,{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)(M,{size:`sm`,children:(0,Z.jsx)(B,{})}),(0,Z.jsxs)(V,{children:[(0,Z.jsx)(P,{value:Q,children:`Toutes directions`}),(0,Z.jsx)(P,{value:`inbound`,children:`inbound`}),(0,Z.jsx)(P,{value:`outbound`,children:`outbound`}),(0,Z.jsx)(P,{value:`internal`,children:`internal`})]})]}),(0,Z.jsxs)(F,{value:c,onValueChange:l,children:[(0,Z.jsx)(M,{size:`sm`,children:(0,Z.jsx)(B,{})}),(0,Z.jsxs)(V,{children:[(0,Z.jsx)(P,{value:Q,children:`Toutes sévérités`}),(0,Z.jsx)(P,{value:`info`,children:`info`}),(0,Z.jsx)(P,{value:`warn`,children:`warn`}),(0,Z.jsx)(P,{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)(mt,{children:[(0,Z.jsx)(_t,{asChild:!0,children:(0,Z.jsx)(j,{variant:`outline`,size:`icon`,"aria-label":`Open menu`,children:(0,Z.jsx)(N,{})})}),(0,Z.jsxs)(gt,{align:`start`,children:[(0,Z.jsx)(ft,{children:`Actions`}),(0,Z.jsx)(ht,{}),(0,Z.jsx)(L,{children:`Edit`}),(0,Z.jsx)(L,{children:`Duplicate`}),(0,Z.jsx)(ht,{}),(0,Z.jsx)(L,{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)(j,{size:`sm`,children:`Save`}),(0,Z.jsx)(j,{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)(z,{"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)(z,{"aria-label":`select ${e.n}`})}),(0,Z.jsx)(G,{className:`font-medium`,children:e.n}),(0,Z.jsx)(G,{children:(0,Z.jsx)(I,{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)(k,{className:`size-3.5`}),` `,e.s]})}),(0,Z.jsx)(G,{children:(0,Z.jsx)(j,{variant:`ghost`,size:`icon`,"aria-label":`row actions`,children:(0,Z.jsx)(N,{})})})]},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{$_ as r,$w as i,A_ as a,B_ as o,Bw as s,C_ as c,Cw as l,D as u,D_ as d,Dw as f,E as p,E_ as m,Ew as h,F_ as g,Fw as _,G_ as ee,Gw as v,H_ as y,Hw as b,I_ as x,Iw as S,J_ as te,Jw as C,K_ as ne,Kw as w,L_ as re,Lw as T,M_ as ie,N_ as ae,O_ as oe,Ow as se,P_ as ce,Pw as E,Q_ as le,Qw as D,R_ as ue,Rw as O,S_ as de,Sw as k,T_ as fe,Tw as pe,U_ as me,Uw as he,V_ as ge,Vw as _e,W_ as ve,Ww as ye,X_ as be,Xw as xe,Y_ as Se,Yw as Ce,Z_ as we,Zw as A,__ as Te,_w as Ee,b_ as De,bw as Oe,eM as j,eT as M,g_ as N,gn as P,gw as F,h_ as ke,hn as Ae,hw as je,iT as Me,j_ as Ne,k_ as Pe,kw as Fe,mn as Ie,nT as Le,q_ as Re,qw as ze,rT as Be,tM as I,tT as Ve,v_ as He,vw as Ue,w_ as We,ww as Ge,x_ as Ke,xw as qe,y_ as Je,yw as Ye,z_ as Xe,zw as Ze}from"./dist-CGzSsL4i.js";import{n as Qe}from"./dist-fE9pwpr-.js";import{t as $e}from"./x-CQuunpf5.js";import{i as L,n as R,r as et,t as tt}from"./tabs-Cd17i-th.js";import{t as z}from"./button-D5AXX04a.js";import{Bt as nt,C as B,S as V,Vt as rt,Wt as it,Xt as at,Yt as ot,a as st,b as H,ct as U,dt as ct,et as W,ft as lt,ht as ut,i as dt,j as ft,mt as pt,o as mt,r as ht,tt as gt,ut as _t,w as G,x as K,xt as vt}from"./index-B0Kloary.js";import{n as yt}from"./TimeRangePicker-CZSYqXhd.js";import{t as bt}from"./FilterBar-Dy10_IPZ.js";import{t as xt}from"./AdvancedFilter-B6lCXnk_.js";import{t as St}from"./DataTableShell-Bzopt4OT.js";var Ct=u(`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`}]]),wt=u(`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`}]]),q=t(e(),1),J=n(),Y={kind:`relative`,from:`now-520w`,to:`now`},X=e=>e===null?`-`:String(Math.round(e));function Tt(e){let t=e.indexOf(`:`);if(t<0)return e;let n=e.slice(0,t),r=e.slice(t+1);return n===`admin`?Ze():n===`agent`?`${O()} - ${r}`:e}function Et(){let e=I(p.me.getMe,{host:vt})?.role===`admin`,t=I(p.deliveryTiming.getDeliveryStatus,{}),n=j(p.deliveryTiming.startDeliveryRecord),r=j(p.deliveryTiming.stopDeliveryRecord),[a,o]=(0,q.useState)(!1),[s,c]=(0,q.useState)(!1),l=t?.recording??!1,u=async()=>{c(!0);try{l?await r({}):await n({})}finally{c(!1)}};return(0,J.jsxs)(`section`,{className:`mb-4 flex flex-col gap-3 rounded-lg border border-border p-4`,children:[(0,J.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`h3`,{className:`text-sm font-semibold`,children:Me()}),(0,J.jsx)(`p`,{className:`oc-admin__hint`,children:Be()})]}),e?(0,J.jsx)(z,{variant:l?`destructive`:`default`,size:`sm`,disabled:s||t===void 0,onClick:()=>void u(),children:l?Ve():Le()}):null]}),l?(0,J.jsxs)(`p`,{className:`flex items-center gap-2 text-sm`,children:[(0,J.jsx)(U,{variant:`secondary`,children:M()}),t?.startedAt?(0,J.jsx)(`span`,{className:`text-muted-foreground`,children:i({time:gt(t.startedAt)})}):null]}):null,(0,J.jsx)(`div`,{children:(0,J.jsx)(z,{variant:`outline`,size:`sm`,onClick:()=>o(e=>!e),children:a?xe():A()})}),a?(0,J.jsx)(Dt,{isAdmin:e}):null]})}function Dt({isAdmin:e}){let t=I(p.deliveryTiming.listDeliverySessions,{}),n=j(p.deliveryTiming.deleteDeliverySessions),[r,i]=(0,q.useState)(``),[a,o]=(0,q.useState)(`all`),[c,l]=(0,q.useState)(Y),[u,d]=(0,q.useState)(null),{from:f,to:m}=yt(c),h=c.to===`now`?1/0:m,g=r.trim()!==``||a!==`all`||c!==Y,ee=()=>{i(``),o(`all`),l(Y)},y=(0,q.useMemo)(()=>{if(t===void 0)return;let e=r.trim().toLowerCase();return t.filter(t=>(e===``||t.startedBy.toLowerCase().includes(e))&&(a===`all`||(a===`active`?t.active:!t.active))&&t.startedAt>=f&&t.startedAt<=h).map(e=>({...e,_id:e.sessionId}))},[t,r,a,f,h]),x=e=>{let t=new Set((y??[]).map(e=>e.sessionId)),r=e.filter(e=>t.has(e));r.length!==0&&(n({sessionIds:r}),u!==null&&r.includes(u)&&d(null))};return(0,J.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,J.jsx)(bt,{q:r,onQChange:i,searchPlaceholder:C(),timeRange:c,onTimeRangeChange:l,onReset:ee,canReset:g,children:(0,J.jsxs)(H,{value:a,onValueChange:e=>o(e),children:[(0,J.jsx)(B,{size:`sm`,className:`w-36`,children:(0,J.jsx)(G,{})}),(0,J.jsxs)(K,{children:[(0,J.jsx)(V,{value:`all`,children:ze()}),(0,J.jsx)(V,{value:`active`,children:w()}),(0,J.jsx)(V,{value:`stopped`,children:v()})]})]})}),(0,J.jsx)(St,{title:Ce(),rows:y,emptyHint:F(),columns:[{header:``,className:`w-8`,cell:e=>(0,J.jsx)(z,{variant:`ghost`,size:`icon`,"aria-label":u===e.sessionId?S():T(),onClick:()=>d(t=>t===e.sessionId?null:e.sessionId),children:u===e.sessionId?(0,J.jsx)(Ct,{size:15,"aria-hidden":!0}):(0,J.jsx)(rt,{size:15,"aria-hidden":!0})})},{header:ye(),sort:e=>e.startedAt,cell:e=>(0,J.jsx)(`span`,{className:`tabular-nums`,children:W(e.startedAt)})},{header:he(),sort:e=>e.stoppedAt,cell:e=>e.stoppedAt===null?(0,J.jsx)(`span`,{className:`text-muted-foreground`,children:`-`}):(0,J.jsx)(`span`,{className:`tabular-nums`,children:W(e.stoppedAt)})},{header:b(),sort:e=>e.count,cell:e=>(0,J.jsx)(`span`,{className:`tabular-nums`,children:X(e.count)})},{header:_e(),sort:e=>e.startedBy,cell:e=>Tt(e.startedBy)},{header:s(),sort:e=>e.active,cell:e=>e.active?(0,J.jsx)(U,{variant:`secondary`,children:w()}):(0,J.jsx)(`span`,{className:`text-muted-foreground`,children:v()})}],rowActions:e?e=>[{label:_(),variant:`destructive`,onSelect:()=>x([e.sessionId])}]:void 0,bulkActions:e?[{label:_(),variant:`destructive`,onSelect:e=>x(e)}]:void 0,isExpanded:e=>e.sessionId===u,renderExpanded:e=>(0,J.jsx)(Ot,{sessionId:e.sessionId})})]})}function Ot({sessionId:e}){let t=I(p.deliveryTiming.getDeliveryReport,{sessionId:e}),[n,r]=(0,q.useState)(!1);return(0,J.jsx)(kt,{report:t,copied:n,onCopy:()=>{t&&navigator.clipboard?.writeText(ft(t)).then(()=>{r(!0),window.setTimeout(()=>r(!1),1200)}).catch(()=>{})}})}function kt({report:e,copied:t,onCopy:n}){if(!e)return(0,J.jsx)(`p`,{className:`oc-admin__hint`,children:E()});if(e.count===0||e.segments===null)return(0,J.jsx)(`p`,{className:`oc-admin__hint`,children:D()});let r=e.segments,i=(e,t)=>(0,J.jsxs)(`tr`,{className:`border-t border-border`,children:[(0,J.jsx)(`td`,{className:`py-1`,children:e}),(0,J.jsx)(`td`,{className:`py-1 text-right tabular-nums`,children:t.count}),(0,J.jsxs)(`td`,{className:`py-1 text-right tabular-nums`,children:[X(t.p50),` / `,X(t.p95),` / `,X(t.max)]})]});return(0,J.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,J.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,J.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[e.count,` `,je()]}),(0,J.jsxs)(z,{variant:`outline`,size:`sm`,onClick:n,children:[t?(0,J.jsx)(Qe,{size:13,"aria-hidden":!0}):(0,J.jsx)(it,{size:13,"aria-hidden":!0}),t?Ee():Ue()]})]}),(0,J.jsxs)(`table`,{className:`w-full text-sm`,children:[(0,J.jsx)(`thead`,{children:(0,J.jsxs)(`tr`,{className:`text-left text-muted-foreground`,children:[(0,J.jsx)(`th`,{className:`py-1 font-medium`,children:f()}),(0,J.jsx)(`th`,{className:`py-1 text-right font-medium`,children:h()}),(0,J.jsx)(`th`,{className:`py-1 text-right font-medium`,children:pe()})]})}),(0,J.jsxs)(`tbody`,{children:[i(Ge(),r.bridge),i(l(),r.A),i(k(),r.C)]})]}),(0,J.jsx)(`p`,{className:`oc-admin__hint`,children:qe()}),e.truncated?(0,J.jsx)(`p`,{className:`oc-admin__hint`,children:Ye()}):null,(0,J.jsx)(`p`,{className:`oc-admin__hint`,children:Oe()})]})}var At=[50,100,200,500],Z=`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:P()},{value:`principalType`,label:Ae()},{value:`direction`,label:`direction`},{value:`roleKey`,label:Ie()},{value:`route`,label:`route`},{value:`correlationId`,label:`correlationId`}];function It(){let e=at({from:`/settings/traces`}),t=ot({from:`/settings/traces`}),n=e.limit,i=e.kind,s=e.statusClass??Q,l=e.principalType??Q,u=e.direction??Q,f=e.roleKey??Q,h=e.q??``,_=ht(e.from,e.to),v=(0,q.useMemo)(()=>mt(e.adv),[e.adv]),{from:b,to:S}=yt(_),[C,w]=(0,q.useState)(null),[T,E]=(0,q.useState)(null),D=e=>void t({search:t=>({...t,limit:e})}),O=e=>void t({search:t=>({...t,kind:e})}),k=e=>void t({search:t=>({...t,q:e||void 0}),replace:!0}),pe=e=>void t({search:t=>({...t,statusClass:e===Q?void 0:e})}),he=e=>void t({search:t=>({...t,principalType:e===Q?void 0:e})}),_e=e=>void t({search:t=>({...t,direction:e===Q?void 0:e})}),ye=e=>void t({search:t=>({...t,roleKey:e===Q?void 0:e})}),xe=e=>void t({search:t=>({...t,...st(e)})}),Ce=e=>void t({search:t=>({...t,adv:dt(e)}),replace:!0}),A=I(p.observability.listEvents,{limit:n}),Te=I(p.observability.listEvents,{limit:n,kind:i===Z?void 0:i,filter:{q:h||void 0,from:b,to:S,statusClass:s===Q?void 0:s,principalType:l===Q?void 0:l,direction:u===Q?void 0:u,roleKey:f===Q?void 0:f,advanced:v.length>0?v:void 0}}),Ee=(0,q.useMemo)(()=>{let e=new Set;for(let t of A??[])e.add(t.kind);return[...e].sort()},[A]),Oe=(0,q.useMemo)(()=>{let e=new Set;for(let t of A??[])t.roleKey&&e.add(t.roleKey);return[...e].sort()},[A]),j=h!==``||s!==Q||l!==Q||u!==Q||f!==Q||v.length>0||_.kind!==`relative`||_.from!==Pt.from;function M(){t({search:{limit:100,kind:`all`},replace:!0})}let N=C?A?.filter(e=>e.correlationId===C):Te,P=e.section,F=e=>void t({search:t=>({...t,section:e}),replace:!0});return(0,J.jsxs)(tt,{value:P,onValueChange:e=>F(e),children:[(0,J.jsxs)(et,{className:`w-full`,children:[(0,J.jsxs)(L,{value:`latency`,className:`flex-1 gap-1.5`,children:[(0,J.jsx)(nt,{size:13,"aria-hidden":!0}),Fe()]}),(0,J.jsxs)(L,{value:`events`,className:`flex-1 gap-1.5`,children:[(0,J.jsx)(wt,{size:13,"aria-hidden":!0}),se()]})]}),(0,J.jsx)(R,{value:`latency`,children:(0,J.jsx)(Et,{})}),(0,J.jsxs)(R,{value:`events`,className:`flex flex-col gap-3`,children:[(0,J.jsxs)(`p`,{className:`oc-admin__hint`,children:[r(),(0,J.jsx)(`strong`,{children:le()}),we(),` `,(0,J.jsx)(`span`,{className:`oc-filter__window`,children:be()})]}),(0,J.jsxs)(bt,{q:h,onQChange:k,searchPlaceholder:Se(),timeRange:_,onTimeRangeChange:xe,onReset:M,canReset:j,children:[(0,J.jsxs)(H,{value:s,onValueChange:pe,children:[(0,J.jsx)(B,{size:`sm`,className:`w-32`,children:(0,J.jsx)(G,{placeholder:te()})}),(0,J.jsxs)(K,{children:[(0,J.jsx)(V,{value:Q,children:Re()}),jt.map(e=>(0,J.jsx)(V,{value:e,children:e},e))]})]}),(0,J.jsxs)(H,{value:l,onValueChange:he,children:[(0,J.jsx)(B,{size:`sm`,className:`w-32`,children:(0,J.jsx)(G,{placeholder:ne()})}),(0,J.jsxs)(K,{children:[(0,J.jsx)(V,{value:Q,children:ee()}),Mt.map(e=>(0,J.jsx)(V,{value:e,children:e},e))]})]}),(0,J.jsxs)(H,{value:u,onValueChange:_e,children:[(0,J.jsx)(B,{size:`sm`,className:`w-32`,children:(0,J.jsx)(G,{placeholder:ve()})}),(0,J.jsxs)(K,{children:[(0,J.jsx)(V,{value:Q,children:me()}),Nt.map(e=>(0,J.jsx)(V,{value:e,children:e},e))]})]}),(0,J.jsxs)(H,{value:f,onValueChange:ye,children:[(0,J.jsx)(B,{size:`sm`,className:`w-36`,children:(0,J.jsx)(G,{placeholder:y()})}),(0,J.jsxs)(K,{children:[(0,J.jsx)(V,{value:Q,children:ge()}),Oe.map(e=>(0,J.jsx)(V,{value:e,children:e},e))]})]}),(0,J.jsxs)(H,{value:i,onValueChange:O,children:[(0,J.jsx)(B,{size:`sm`,className:`w-44`,children:(0,J.jsx)(G,{placeholder:o()})}),(0,J.jsxs)(K,{children:[(0,J.jsx)(V,{value:Z,children:Xe()}),Ee.map(e=>(0,J.jsx)(V,{value:e,children:e},e))]})]}),(0,J.jsxs)(H,{value:String(n),onValueChange:e=>D(Number(e)),children:[(0,J.jsx)(B,{size:`sm`,className:`w-28`,children:(0,J.jsx)(G,{})}),(0,J.jsx)(K,{children:At.map(e=>(0,J.jsx)(V,{value:String(e),children:ue({count:e})},e))})]})]}),(0,J.jsx)(xt,{fields:Ft,seed:v,onChange:Ce}),C?(0,J.jsx)(`div`,{className:`oc-traces__followline`,children:(0,J.jsxs)(`button`,{type:`button`,className:`oc-traces__chip`,onClick:()=>w(null),title:re(),children:[(0,J.jsxs)(`span`,{className:`oc-traces__chip-label`,children:[x(),(0,J.jsx)(`code`,{children:$(C)})]}),(0,J.jsx)($e,{className:`oc-traces__chip-x`,"aria-hidden":!0}),(0,J.jsx)(`span`,{className:`sr-only`,children:g()})]})}):null,(0,J.jsx)(St,{title:ce(),rows:N,emptyHint:C?ae():ie(),columns:[{header:Ne(),sort:e=>e.at,cell:e=>(0,J.jsx)(`span`,{className:`oc-traces__time`,children:W(e.at)})},{header:a(),sort:e=>e.kind,cell:e=>(0,J.jsx)(U,{variant:`secondary`,children:e.kind})},{header:Pe(),sort:e=>Rt(e)??null,cell:e=>{let t=Rt(e);return t?(0,J.jsxs)(`span`,{className:`oc-traces__fail`,title:t,children:[`✕ `,t]}):(0,J.jsx)(`span`,{className:`oc-traces__ok`,"aria-label":oe(),children:`✓`})}},{header:d(),sort:e=>e.direction,cell:e=>e.direction?(0,J.jsx)(U,{variant:`outline`,children:e.direction}):(0,J.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})},{header:m(),sort:e=>e.principalType,cell:e=>(0,J.jsxs)(`span`,{className:`oc-traces__principal`,children:[(0,J.jsx)(U,{variant:`outline`,children:e.principalType}),e.principalId?(0,J.jsx)(`code`,{className:`oc-traces__mono`,children:$(e.principalId)}):null]})},{header:fe(),sort:e=>e.roleKey,cell:e=>e.roleKey?(0,J.jsx)(U,{variant:`secondary`,children:e.roleKey}):(0,J.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})},{header:We(),sort:e=>e.route,cell:e=>e.route?(0,J.jsxs)(`span`,{className:`oc-traces__route`,children:[e.method?(0,J.jsx)(`span`,{className:`oc-traces__method`,children:e.method}):null,(0,J.jsx)(`code`,{className:`oc-traces__mono`,children:e.route})]}):(0,J.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})},{header:c(),sort:e=>e.status,cell:e=>e.status===null?(0,J.jsx)(`span`,{className:`oc-traces__muted`,children:`—`}):(0,J.jsx)(`span`,{className:`oc-traces__status ${Lt(e.status)}`,children:e.status})},{header:de(),sort:e=>e.latencyMs,cell:e=>e.latencyMs===null?(0,J.jsx)(`span`,{className:`oc-traces__muted`,children:`—`}):(0,J.jsxs)(`span`,{className:`oc-traces__mono`,children:[e.latencyMs,` ms`]})},{header:Ke(),sort:e=>e.correlationId,cell:e=>e.correlationId?(0,J.jsx)(`button`,{type:`button`,className:`oc-traces__corr`,title:De(),onClick:()=>w(e.correlationId),children:$(e.correlationId)}):(0,J.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})},{header:Je(),sort:e=>+!!e.meta,cell:e=>e.meta?(0,J.jsx)(z,{variant:`outline`,size:`sm`,onClick:()=>E(e),children:He()}):(0,J.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})}]}),(0,J.jsx)(zt,{row:T,onClose:()=>E(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,q.useMemo)(()=>{if(!e?.meta)return``;try{return JSON.stringify(JSON.parse(e.meta),null,2)}catch{return e.meta}},[e]);return(0,J.jsx)(_t,{open:e!==null,onOpenChange:e=>{e||t()},children:e?(0,J.jsxs)(ct,{className:`max-w-lg`,children:[(0,J.jsxs)(pt,{children:[(0,J.jsxs)(ut,{className:`oc-traces__meta-title`,children:[Te(),` `,(0,J.jsx)(`code`,{children:e.kind}),(0,J.jsx)(U,{variant:`outline`,children:N()})]}),(0,J.jsx)(lt,{children:ke()})]}),(0,J.jsx)(`pre`,{className:`oc-traces__meta-json`,children:n})]}):null})}export{It as TracesTab};
@@ -1 +0,0 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{AS as r,Ag as i,Bg as a,CS as o,DS as s,E as c,ES as l,Fg as u,Ig as d,Lg as f,MS as p,Mg as m,NS as h,Ng as g,OS as _,PS as v,Pg as y,Rg as b,SS as ee,TS as x,Vg as S,Vx as te,_S as ne,bS as re,cS as ie,dS as ae,du as C,eM as w,fS as oe,fu as T,gS as E,hS as se,jS as ce,jg as D,kS as O,kg as k,lS as le,mS as ue,oS as de,pS as fe,sS as pe,tM as A,uS as me,uu as j,vS as he,wS as ge,xS as _e,yS as M,zg as N}from"./dist-CGzSsL4i.js";import{t as P}from"./button-D5AXX04a.js";import{B as F,C as I,Mt as L,Nt as R,S as z,V as ve,Xt as ye,Yt as be,at as B,b as V,c as xe,ct as H,dt as Se,ft as Ce,ht as we,it as Te,l as U,mt as Ee,nt as De,p as W,rt as Oe,s as G,st as ke,ut as Ae,w as K,x as q,xt as J,z as Y}from"./index-B0Kloary.js";import{t as je}from"./FilterBar-Dy10_IPZ.js";import{t as Me}from"./DataTableShell-Bzopt4OT.js";import{t as Ne}from"./DetailChips-PKnLEOOY.js";var X=t(e(),1),Z=n();function Pe({profileId:e,userLabel:t,open:n,onOpenChange:r}){let i=A(c.agents.listAgentPoolForUser,n&&e?{profileId:e}:`skip`),o=A(c.agents.listUserAgents,n&&e?{profileId:e}:`skip`),s=new Set((o??[]).map(e=>`${e.instanceName}/${e.agentId}`)),l=(o??[]).find(e=>e.isDefault)??null,u=l?`${l.instanceName}/${l.agentId}`:null,d=new Set((i?.agents??[]).map(e=>`${e.instanceName}/${e.agentId}`)),p=[...(i?.agents??[]).map(e=>({...e,outOfPool:!1})),...(o??[]).filter(e=>!d.has(`${e.instanceName}/${e.agentId}`)).map(e=>({instanceName:e.instanceName,agentId:e.agentId,displayName:e.displayName,emoji:e.emoji,model:e.model,kind:e.kind,enabled:e.enabled,state:e.state,outOfPool:!0}))],m=new Map;for(let e of p){let t=m.get(e.instanceName)??[];t.push(e),m.set(e.instanceName,t)}return(0,Z.jsx)(Ae,{open:n,onOpenChange:r,children:(0,Z.jsxs)(Se,{className:`oc-access`,children:[(0,Z.jsxs)(Ee,{children:[(0,Z.jsx)(we,{children:S({user:t})}),(0,Z.jsx)(Ce,{children:a()})]}),i?(0,Z.jsx)(`p`,{className:`oc-access__hint`,children:i.inGroup?N():b()}):null,(0,Z.jsx)(`div`,{className:`oc-access__list`,children:i===void 0?(0,Z.jsx)(`p`,{className:`oc-access__hint`,children:f()}):p.length===0?(0,Z.jsx)(`p`,{className:`oc-access__hint`,children:y()}):[...m.entries()].map(([t,n])=>(0,Z.jsx)(Fe,{profileId:e,instanceName:t,kind:n[0].kind,agents:n,assigned:s,defaultKey:u},t))})]})})}function Fe({profileId:e,instanceName:t,kind:n,agents:r,assigned:a,defaultKey:o}){let s=w(c.agents.assignAgent),l=w(c.agents.removeAgent),f=w(c.agents.setDefaultAgent),p=Y();if(!e)return null;async function h(n,r){try{r?await l({profileId:e,instanceName:t,agentId:n}):await s({profileId:e,instanceName:t,agentId:n})}catch(e){p.error(d(),e)}}async function _(n){try{await f({profileId:e,instanceName:t,agentId:n})}catch(e){p.error(u(),e)}}return(0,Z.jsxs)(`div`,{className:`oc-access__group`,children:[(0,Z.jsxs)(`div`,{className:`oc-access__instance`,children:[(0,Z.jsx)(R,{size:13,"aria-hidden":!0}),(0,Z.jsx)(`span`,{children:t}),(0,Z.jsx)(H,{variant:`outline`,className:`oc-access__kind`,children:n})]}),r.map(e=>{let n=`${t}/${e.agentId}`,r=a.has(n),s=o===n,c=e.state===`deleted`,l=!e.enabled;return(0,Z.jsxs)(`div`,{className:`oc-access__row${l?` is-disabled`:``}`,children:[(0,Z.jsx)(W,{checked:r,disabled:(c||l)&&!r,onCheckedChange:()=>void h(e.agentId,r),"aria-label":g({name:e.displayName??e.agentId})}),(0,Z.jsxs)(`span`,{className:`oc-access__label`,children:[e.emoji?`${e.emoji} `:``,e.displayName??e.agentId]}),e.model?(0,Z.jsx)(`span`,{className:`oc-access__model`,children:e.model}):null,c?(0,Z.jsx)(H,{variant:`outline`,className:`oc-access__gone`,children:m()}):null,e.outOfPool?(0,Z.jsx)(H,{variant:`outline`,className:`oc-access__gone`,children:D()}):null,r?s?(0,Z.jsx)(`span`,{className:`oc-access__fav`,role:`img`,"aria-label":i(),title:i(),children:(0,Z.jsx)(L,{size:14,fill:`currentColor`})}):(0,Z.jsx)(P,{type:`button`,size:`icon-sm`,variant:`ghost`,className:`oc-access__setdefault`,"aria-label":k(),title:k(),disabled:l,onClick:()=>void _(e.agentId),children:(0,Z.jsx)(L,{size:14})}):null]},e.agentId)})]})}var Q=`__all__`;function $(e){switch(e){case`pending`:return j();case`user`:return C();case`admin`:return T();default:return e}}function Ie({granted:e,onToggle:t}){let n=new Set(e),r=G.filter(e=>n.has(U[e])).length;return(0,Z.jsxs)(De,{children:[(0,Z.jsx)(ke,{asChild:!0,children:(0,Z.jsx)(P,{variant:`outline`,size:`sm`,className:`h-8 w-36 justify-start font-normal`,children:r===0?v():h({count:r})})}),(0,Z.jsxs)(Oe,{align:`start`,className:`w-52`,children:[(0,Z.jsx)(B,{children:p()}),G.map(e=>{let r=U[e];return(0,Z.jsxs)(Te,{className:`gap-2`,onSelect:e=>{e.preventDefault(),t(r)},children:[(0,Z.jsx)(W,{checked:n.has(r),"aria-hidden":!0,tabIndex:-1,className:`pointer-events-none`}),(0,Z.jsx)(`span`,{children:xe[e]()})]},e)})]})]})}function Le(){let e=ye({from:`/settings/users`}),t=be({from:`/settings/users`}),n=e.q??``,i=e.role??Q,a=e=>void t({search:t=>({...t,q:e||void 0}),replace:!0}),u=e=>void t({search:t=>({...t,role:e===Q?void 0:e})}),d=A(c.admin.listUsers,{filter:{q:n||void 0,role:i===Q?void 0:i},withAgents:!0}),f=A(c.me.getMe,{host:J}),p=w(c.admin.setRole),m=w(c.admin.setUserPermissions),h=w(c.admin.startImpersonation),g=w(c.admin.deleteUser),v=w(c.admin.setUserName),y=F(),b=ve(),S=Y(),[C,T]=(0,X.useState)(null),D=(0,X.useMemo)(()=>{let e=new Set([`pending`,`user`,`admin`]);for(let t of d??[])e.add(t.role);return[...e]},[d]),k=n!==``||i!==Q;function j(){t({search:{},replace:!0})}async function N(e){try{await p(e)}catch(e){S.error(ce(),e)}}async function P(e){try{await m(e)}catch(e){S.error(r(),e)}}async function L(e){let t=e.email||e.name||e.canonical||e.userId.slice(0,8);if(await y({title:o(),description:ee({user:t}),confirmWord:_e(),confirmLabel:re(),destructive:!0}))try{await g({profileId:e._id}),S.success(he({user:t}))}catch(e){S.error(M(),e)}}async function B(e){let t=e.email||e.name||e.userId.slice(0,8),n=await b({title:E(),label:se({user:t}),placeholder:ue(),defaultValue:e.name??``,confirmLabel:te()});if(n!==null)try{await v({profileId:e._id,name:n}),S.success(fe())}catch(e){S.error(oe(),e)}}return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(je,{q:n,onQChange:a,searchPlaceholder:O(),onReset:j,canReset:k,children:(0,Z.jsxs)(V,{value:i,onValueChange:u,children:[(0,Z.jsx)(I,{size:`sm`,className:`w-36`,children:(0,Z.jsx)(K,{})}),(0,Z.jsxs)(q,{children:[(0,Z.jsx)(z,{value:Q,children:_()}),D.map(e=>(0,Z.jsx)(z,{value:e,children:$(e)},e))]})]})}),(0,Z.jsx)(Me,{title:s(),rows:d,emptyHint:l(),rowActions:e=>{let t=[{label:de(),onSelect:()=>T({profileId:e._id,label:e.email||e.name||e.canonical||e.userId.slice(0,8)})},{label:ne(),onSelect:()=>void B(e)}];return e.userId!==f?.userId&&t.push({label:x(),onSelect:()=>void h({profileId:e._id})},{label:ge(),variant:`destructive`,onSelect:()=>void L(e)}),t},columns:[{header:ae(),cell:e=>{let t=e.email||e.name||e.canonical||e.userId.slice(0,8),n=e.email&&e.name&&e.name!==e.email?e.name:null;return(0,Z.jsxs)(`div`,{className:`flex flex-col`,children:[(0,Z.jsx)(`span`,{children:t}),n?(0,Z.jsx)(`span`,{className:`text-muted-foreground text-xs`,children:n}):null]})},sort:e=>e.email||e.name||e.canonical||e.userId},{header:me(),sort:e=>e.role===`admin`?2:+(e.role===`user`),cell:e=>(0,Z.jsxs)(V,{value:e.role,onValueChange:t=>void N({profileId:e._id,role:t}),children:[(0,Z.jsx)(I,{size:`sm`,className:`w-28`,children:(0,Z.jsx)(K,{})}),(0,Z.jsxs)(q,{children:[(0,Z.jsx)(z,{value:`pending`,children:$(`pending`)}),(0,Z.jsx)(z,{value:`user`,children:$(`user`)}),(0,Z.jsx)(z,{value:`admin`,children:$(`admin`)})]})]})},{header:le(),sort:e=>e.role===`admin`?9999:e.extraPermissions?.length??0,cell:e=>e.role===`admin`?(0,Z.jsx)(`span`,{className:`text-muted-foreground text-xs`,children:ie()}):(0,Z.jsx)(Ie,{granted:e.extraPermissions??[],onToggle:t=>{let n=new Set(e.extraPermissions??[]);n.has(t)?n.delete(t):n.add(t),P({profileId:e._id,permissions:[...n]})}})},{header:pe(),cell:e=>(0,Z.jsx)(Ne,{icon:(0,Z.jsx)(R,{size:12,"aria-hidden":!0}),total:e.agentCount??0,items:e.agents.map(e=>({label:e}))}),sort:e=>e.agentCount??0}]}),(0,Z.jsx)(Pe,{profileId:C?.profileId??null,userLabel:C?.label??``,open:C!==null,onOpenChange:e=>{e||T(null)}})]})}export{Le as UsersTab};
@@ -1 +0,0 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$ as r,At as i,Ct as a,D as o,Dt as s,E as c,Et as l,Ft as u,H as ee,J as d,Jj as te,K as f,Kj as p,Mt as m,Nt as h,Ot as g,Pt as _,Q as v,Qj as ne,St as y,Tt as b,U as re,V as ie,W as x,Y as S,_t as C,bt as w,dt as T,eM as E,et as ae,ft as oe,gt as D,ht as se,ic as ce,jt as le,k as ue,kt as O,mt as k,nc as de,nt as fe,pt as pe,q as me,tM as A,tt as j,ut as M,vt as N,wl as P,wt as F,xt as I,yt as L}from"./dist-CGzSsL4i.js";import{i as R,n as z,r as he,t as ge}from"./tabs-Cd17i-th.js";import{t as B}from"./button-D5AXX04a.js";import{C as V,F as _e,I as H,L as U,Lt as ve,M as ye,N as be,P as xe,R as Se,S as W,Xt as Ce,Yt as we,b as G,ct as K,kt as Te,p as q,w as J,x as Y,xt as Ee}from"./index-B0Kloary.js";/* empty css */var De=o(`audio-lines`,[[`path`,{d:`M2 10v3`,key:`1fnikh`}],[`path`,{d:`M6 6v11`,key:`11sgs0`}],[`path`,{d:`M10 3v18`,key:`yhl04a`}],[`path`,{d:`M14 8v7`,key:`3a1oy3`}],[`path`,{d:`M18 5v13`,key:`123xd1`}],[`path`,{d:`M22 10v3`,key:`154ddg`}]]),X=t(e(),1),Z=n(),Q=[[`auto`,()=>g()],[`fr-FR`,()=>fe()],[`en-US`,()=>j()],[`en-GB`,()=>ae()],[`de-DE`,()=>r()],[`es-ES`,()=>v()]],Oe=[[`0.75`,()=>l()],[`1`,()=>b()],[`1.25`,()=>F()],[`1.5`,()=>a()]],$=0;function ke({instance:e}){let t=E(c.admin.upsertInstanceConfig),n=e.config??{},r={enabled:n.voiceEnabled===!0,engine:n.voiceEngine===`gateway`?`gateway`:`browser`,lang:typeof n.voiceLang==`string`?n.voiceLang:`auto`,rate:typeof n.voiceRate==`number`?String(n.voiceRate):`1`,autoRead:n.voiceAutoRead===!0},[a,o]=(0,X.useState)(r),[l,u]=(0,X.useState)(`idle`),[d,f]=(0,X.useState)(!1),[p,m]=(0,X.useState)(!1),h=ne(c.voice.gatewayTtsPreview);(0,X.useEffect)(()=>{o({enabled:n.voiceEnabled===!0,engine:n.voiceEngine===`gateway`?`gateway`:`browser`,lang:typeof n.voiceLang==`string`?n.voiceLang:`auto`,rate:typeof n.voiceRate==`number`?String(n.voiceRate):`1`,autoRead:n.voiceAutoRead===!0}),u(`idle`)},[e._id]);let g=a.enabled!==r.enabled||a.engine!==r.engine||a.lang!==r.lang||a.rate!==r.rate||a.autoRead!==r.autoRead;async function _(){u(`saving`);try{let n={...e.config??{}};n.voiceEnabled=a.enabled,a.engine===`gateway`?n.voiceEngine=`gateway`:delete n.voiceEngine,a.lang===`auto`?delete n.voiceLang:n.voiceLang=a.lang;let r=Number.parseFloat(a.rate);!Number.isFinite(r)||r===1?delete n.voiceRate:n.voiceRate=r,a.autoRead?n.voiceAutoRead=!0:delete n.voiceAutoRead,await t({instanceId:e._id,config:n}),u(`idle`)}catch{u(`error`)}}return(0,Z.jsxs)(`section`,{className:`oc-voice__card`,children:[(0,Z.jsxs)(`header`,{className:`oc-voice__cardhead`,children:[(0,Z.jsx)(`span`,{className:`oc-voice__instance`,children:e.name}),(0,Z.jsx)(K,{variant:`secondary`,children:e.kind===`hermes`?`Hermes`:`OpenClaw`})]}),(0,Z.jsxs)(`label`,{className:`oc-cdefaults__inline`,style:{cursor:`pointer`},children:[(0,Z.jsx)(q,{checked:a.enabled,onCheckedChange:e=>o({...a,enabled:e===!0}),"aria-label":i()}),(0,Z.jsx)(`span`,{className:`oc-cdefaults__label`,children:i()})]}),(0,Z.jsxs)(`div`,{className:`oc-voice__row`,children:[(0,Z.jsx)(`span`,{className:`oc-cdefaults__label`,children:x()}),(0,Z.jsxs)(G,{value:a.engine,onValueChange:e=>o({...a,engine:e}),disabled:!a.enabled,children:[(0,Z.jsx)(V,{size:`sm`,"aria-label":x(),children:(0,Z.jsx)(J,{})}),(0,Z.jsxs)(Y,{children:[(0,Z.jsx)(W,{value:`browser`,children:re()}),e.kind===`hermes`?null:(0,Z.jsx)(W,{value:`gateway`,children:ee()})]})]})]}),a.engine===`gateway`?(0,Z.jsx)(`p`,{className:`oc-cdefaults__help`,children:ie()}):null,a.engine===`gateway`?null:(0,Z.jsxs)(`div`,{className:`oc-voice__row`,children:[(0,Z.jsx)(`span`,{className:`oc-cdefaults__label`,children:O()}),(0,Z.jsxs)(G,{value:a.lang,onValueChange:e=>o({...a,lang:e}),disabled:!a.enabled,children:[(0,Z.jsx)(V,{size:`sm`,"aria-label":O(),children:(0,Z.jsx)(J,{})}),(0,Z.jsx)(Y,{children:Q.map(([e,t])=>(0,Z.jsx)(W,{value:e,children:t()},e))})]})]}),(0,Z.jsxs)(`div`,{className:`oc-voice__row`,children:[(0,Z.jsx)(`span`,{className:`oc-cdefaults__label`,children:s()}),(0,Z.jsxs)(G,{value:a.rate,onValueChange:e=>o({...a,rate:e}),disabled:!a.enabled,children:[(0,Z.jsx)(V,{size:`sm`,"aria-label":s(),children:(0,Z.jsx)(J,{})}),(0,Z.jsx)(Y,{children:Oe.map(([e,t])=>(0,Z.jsx)(W,{value:e,children:t()},e))})]})]}),a.engine===`gateway`?null:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`label`,{className:`oc-cdefaults__inline`,style:{cursor:`pointer`},children:[(0,Z.jsx)(q,{checked:a.autoRead,onCheckedChange:e=>o({...a,autoRead:e===!0}),disabled:!a.enabled,"aria-label":y()}),(0,Z.jsx)(`span`,{className:`oc-cdefaults__label`,children:y()})]}),(0,Z.jsx)(`p`,{className:`oc-cdefaults__help`,children:I()})]}),(0,Z.jsxs)(`div`,{className:`oc-cdefaults__inline`,children:[(0,Z.jsx)(B,{size:`sm`,disabled:!g||l===`saving`,onClick:()=>void _(),children:l===`saving`?P():ce()}),(0,Z.jsx)(B,{variant:`outline`,size:`sm`,disabled:!a.enabled||d,onClick:()=>{let t=Number.parseFloat(a.rate)||1,n=++$;if(m(!1),U(),H(),a.engine!==`gateway`){_e(N(),{lang:xe(a.lang,te()),rate:t});return}f(!0),h({instanceName:e.name,text:N()}).then(({mime:e,audioBase64:r})=>{n===$&&be(r,e,{rate:t})}).catch(()=>{n===$&&m(!0)}).finally(()=>f(!1))},children:d?P():w()}),(0,Z.jsx)(B,{variant:`ghost`,size:`sm`,onClick:()=>{$++,f(!1),U(),H()},children:L()})]}),l===`error`||p?(0,Z.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:p?ue():de()}):null]})}function Ae({stt:e}){let t=A(c.me.getMe,{host:Ee}),n=E(c.admin.setFeatureEnabled),r=t?.ui?.featuresEnabled?.voiceInput===!0,i=t?.role===`admin`;return(0,Z.jsxs)(`section`,{className:`oc-voice__card`,children:[(0,Z.jsxs)(`header`,{className:`oc-voice__cardhead`,children:[(0,Z.jsx)(`span`,{className:`oc-voice__instance`,children:D()}),(0,Z.jsx)(K,{variant:e?`secondary`:`outline`,children:e?T():M()}),(0,Z.jsx)(K,{variant:r?`secondary`:`destructive`,children:r?d():me()})]}),i?(0,Z.jsxs)(`label`,{className:`oc-cdefaults__inline`,style:{cursor:`pointer`},children:[(0,Z.jsx)(q,{checked:r,onCheckedChange:e=>void n({key:`voiceInput`,enabled:e===!0}),"aria-label":S()}),(0,Z.jsx)(`span`,{className:`oc-cdefaults__label`,children:S()})]}):null,(0,Z.jsx)(`p`,{className:`oc-cdefaults__help`,children:se()})]})}function je(){let e=A(c.admin.listInstances,{}),t=(0,X.useMemo)(()=>Se(),[]),n=(0,X.useMemo)(()=>ye(),[]),{section:r}=Ce({from:`/settings/voice`}),i=we({from:`/settings/voice`});return(0,Z.jsxs)(`div`,{className:`oc-admin__tab oc-voice`,children:[(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:u()}),(0,Z.jsxs)(`div`,{className:`oc-voice__support`,children:[(0,Z.jsx)(K,{variant:t?`secondary`:`destructive`,children:t?_():h()}),(0,Z.jsx)(K,{variant:n?`secondary`:`destructive`,children:n?m():le()})]}),(0,Z.jsxs)(ge,{value:r,onValueChange:e=>void i({search:{section:e},replace:!0}),children:[(0,Z.jsxs)(he,{className:`w-full`,children:[(0,Z.jsxs)(R,{value:`readaloud`,className:`flex-1 gap-1.5`,children:[(0,Z.jsx)(Te,{size:13,"aria-hidden":!0}),f()]}),(0,Z.jsxs)(R,{value:`dictation`,className:`flex-1 gap-1.5`,children:[(0,Z.jsx)(ve,{size:13,"aria-hidden":!0}),D()]}),(0,Z.jsxs)(R,{value:`talk`,className:`flex-1 gap-1.5`,children:[(0,Z.jsx)(De,{size:13,"aria-hidden":!0}),k()]})]}),(0,Z.jsx)(z,{value:`readaloud`,children:e===void 0?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:p()}):e.length===0?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:C()}):e.map(e=>(0,Z.jsx)(ke,{instance:e},e._id))}),(0,Z.jsx)(z,{value:`dictation`,children:(0,Z.jsx)(Ae,{stt:n})}),(0,Z.jsx)(z,{value:`talk`,children:(0,Z.jsxs)(`section`,{className:`oc-voice__card`,children:[(0,Z.jsxs)(`header`,{className:`oc-voice__cardhead`,children:[(0,Z.jsx)(`span`,{className:`oc-voice__instance`,children:k()}),(0,Z.jsx)(K,{variant:`outline`,children:pe()})]}),(0,Z.jsx)(`p`,{className:`oc-cdefaults__help`,children:oe()})]})})]})]})}export{je as VoiceTab};
@@ -1 +0,0 @@
1
- import{D as e}from"./dist-CGzSsL4i.js";var t=e(`chevrons-up-down`,[[`path`,{d:`m7 15 5 5 5-5`,key:`1hf1tw`}],[`path`,{d:`m7 9 5-5 5 5`,key:`sgt6xg`}]]);export{t};
@@ -1 +0,0 @@
1
- import{$d as e,Jd as t,Qd as n,Sf as r,Xd as i,Yd as a,Zd as o,_f as s,af as c,bf as l,cf as u,df as d,ef as f,ff as p,gf as m,hf as h,if as g,lf as _,mf as v,nf as y,of as b,pf as x,rf as S,sf as C,tf as w,uf as T,vf as E,xf as D,yf as O}from"./dist-CGzSsL4i.js";var k={AGENT_NOT_FOUND:()=>({label:r(),hint:D()}),AUTH_TOKEN_MISMATCH:()=>({label:l(),hint:O()}),DEVICE_SIGNING_FAILED:()=>({label:E(),hint:s()}),SESSION_SCOPE_DENIED:()=>({label:m(),hint:h()}),GATEWAY_TIMEOUT:()=>({label:v(),hint:x()}),GATEWAY_DISCONNECTED:()=>({label:p(),hint:d()}),ATTACHMENT_TOO_LARGE:()=>({label:u(),hint:C()}),ATTACHMENT_REJECTED:()=>({label:b(),hint:c()}),BRIDGE_UNREACHABLE:()=>({label:T(),hint:_()}),INVALID_REQUEST:()=>({label:g(),hint:S()}),NOT_CONFIGURED:()=>({label:y(),hint:w()}),UNROUTED:()=>({label:f(),hint:e()}),UPSTREAM_ERROR:()=>({label:n(),hint:o()}),UNKNOWN:()=>({label:i(),hint:a()})};function A(e){return e?k[e]?.()??{label:e,hint:t()}:k.UNKNOWN()}export{A as t};