@lacneu/atrium 0.25.0 → 0.26.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (69) hide show
  1. package/dist/assets/{AccessTab-DPObL362.js → AccessTab-C_Lvzi-s.js} +1 -1
  2. package/dist/assets/{AdvancedFilter-SyUsoxag.js → AdvancedFilter-DnGyDWXx.js} +1 -1
  3. package/dist/assets/AgentFilesTab-mB_H9qhv.js +3 -0
  4. package/dist/assets/AnomaliesTab-DXWIdPjg.js +1 -0
  5. package/dist/assets/{AuditTab-7VH_0ygv.js → AuditTab-CM3yKrcE.js} +1 -1
  6. package/dist/assets/BridgeTab-Bba1_oYY.js +1 -0
  7. package/dist/assets/ChatDefaultsTab-BJWGY5p4.js +1 -0
  8. package/dist/assets/{DataTableShell-CJHDSNd8.js → DataTableShell-y4F1v6a9.js} +1 -1
  9. package/dist/assets/{DetailChips-DZXcy4x8.js → DetailChips-BFrPLaU7.js} +1 -1
  10. package/dist/assets/FeedbacksTab-Dypzq2xC.js +1 -0
  11. package/dist/assets/{FieldLabel-DbxkeyLF.js → FieldLabel-GI9NETEt.js} +1 -1
  12. package/dist/assets/FilesTab-Bo0mLlHv.js +1 -0
  13. package/dist/assets/{FilterBar-DR1-M_rz.js → FilterBar-B_mSpGb-.js} +1 -1
  14. package/dist/assets/GroupsTab-BsdKKpSh.js +1 -0
  15. package/dist/assets/InstancesTab-AFQsddYr.js +1 -0
  16. package/dist/assets/IntegrationsTab-_AZobXTN.js +1 -0
  17. package/dist/assets/{KpiTab-CG_InEj6.js → KpiTab-DS2vaP8Y.js} +1 -1
  18. package/dist/assets/PreferencesTab-D5id-SH6.js +1 -0
  19. package/dist/assets/PromptInjectionsTab-DHLbMEQv.js +3 -0
  20. package/dist/assets/RolesTab-DfLWu7KJ.js +1 -0
  21. package/dist/assets/ServiceAccountsTab-BdNBgyiw.js +1 -0
  22. package/dist/assets/SubAgentReportsTab-DiGx-0oc.js +1 -0
  23. package/dist/assets/ThemeShowroom-BAS4cMDv.js +1 -0
  24. package/dist/assets/{TimeRangePicker-DQjAXG44.js → TimeRangePicker-CFCLAlKB.js} +1 -1
  25. package/dist/assets/TracesTab-w5olufef.js +1 -0
  26. package/dist/assets/UsersTab-DFcSXBQJ.js +1 -0
  27. package/dist/assets/button-BOkPsnkZ.js +1 -0
  28. package/dist/assets/{card-DlAKM9gH.js → card-D7I9UeSH.js} +1 -1
  29. package/dist/assets/chevrons-up-down-Cg6ojBxr.js +1 -0
  30. package/dist/assets/{compatView-BiLj8anr.js → compatView-CcKTaWCH.js} +1 -1
  31. package/dist/assets/{dispatchErrorInfo-B8AArkw7.js → dispatchErrorInfo-_T-F61vE.js} +1 -1
  32. package/dist/assets/dist-CI2WPmAQ.js +5 -0
  33. package/dist/assets/{dist-DS_sZFhE.js → dist-CRGyTqMI.js} +1 -1
  34. package/dist/assets/dist-CZgL-Z5m.js +1 -0
  35. package/dist/assets/{dist-DRXIQewX.js → dist-Cxz8d8g5.js} +1 -1
  36. package/dist/assets/{highlighted-body-OFNGDK62-DodvFtaI.js → highlighted-body-OFNGDK62-D8Rm1ZUS.js} +1 -1
  37. package/dist/assets/index-BlRMvXrJ.js +227 -0
  38. package/dist/assets/mermaid-GHXKKRXX-CS3UuvWM.js +1 -0
  39. package/dist/assets/roleDescriptions-mq0g_Z5c.js +1 -0
  40. package/dist/assets/{table-3aSLasBW.js → table-XSL9PnTz.js} +1 -1
  41. package/dist/assets/{tabs-JwsMaDCr.js → tabs-DT8VXxMj.js} +1 -1
  42. package/dist/assets/x-BimfpZdd.js +1 -0
  43. package/dist/index.html +7 -7
  44. package/package.json +1 -1
  45. package/dist/assets/AgentFilesTab-BGD4kAbk.js +0 -3
  46. package/dist/assets/AnomaliesTab-D_GHz68q.js +0 -1
  47. package/dist/assets/BridgeTab-BFCNmd2S.js +0 -1
  48. package/dist/assets/ChatDefaultsTab-CgnQ1mjk.js +0 -1
  49. package/dist/assets/FeedbacksTab-COwyJW_S.js +0 -1
  50. package/dist/assets/FilesTab-DT_ugZ6O.js +0 -1
  51. package/dist/assets/GroupsTab-C0p3i-xP.js +0 -1
  52. package/dist/assets/InstancesTab-CqW60gW6.js +0 -1
  53. package/dist/assets/IntegrationsTab-CG7skUYX.js +0 -1
  54. package/dist/assets/PreferencesTab-CKs4bId7.js +0 -1
  55. package/dist/assets/PromptInjectionsTab-CWVt4aOU.js +0 -3
  56. package/dist/assets/RolesTab-BOO72Gkp.js +0 -1
  57. package/dist/assets/ServiceAccountsTab-RXAbUgIh.js +0 -1
  58. package/dist/assets/SubAgentReportsTab-C4E3BFxa.js +0 -1
  59. package/dist/assets/ThemeShowroom-Bow6souM.js +0 -1
  60. package/dist/assets/TracesTab-CV0hVN5Z.js +0 -1
  61. package/dist/assets/UsersTab-DMNjo9il.js +0 -1
  62. package/dist/assets/button-CrkRjd-T.js +0 -1
  63. package/dist/assets/chevrons-up-down-BUZg64Ip.js +0 -1
  64. package/dist/assets/dist-BDdbnJdn.js +0 -5
  65. package/dist/assets/dist-H7gCiaFZ.js +0 -1
  66. package/dist/assets/index-DcMWPy01.js +0 -227
  67. package/dist/assets/mermaid-GHXKKRXX-COYwG8Lj.js +0 -1
  68. package/dist/assets/roleDescriptions-n6KA5Mb1.js +0 -1
  69. package/dist/assets/x-1RyayDYu.js +0 -1
@@ -0,0 +1 @@
1
+ import{D as e}from"./index-BlRMvXrJ.js";export{e as Mermaid};
@@ -0,0 +1 @@
1
+ import{ah as e,ch as t,ih as n,oh as r,sh as i}from"./dist-Cxz8d8g5.js";var a={pending:t,user:i,admin:r,observer:e,agent:n};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-DRXIQewX.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-Cxz8d8g5.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{dO as r,iO as i,n as a,nO as o,rO as s,sO as c,t as l,uO as u}from"./dist-DRXIQewX.js";import{t as d}from"./dist-H7gCiaFZ.js";import{dt as f,ft as p,pt as m}from"./index-DcMWPy01.js";var h=t(e(),1),g=n(),_=`Tabs`,[v,y]=c(_,[m]),b=m(),[x,S]=v(_),C=h.forwardRef((e,t)=>{let{__scopeTabs:n,value:a,onValueChange:s,defaultValue:c,orientation:l=`horizontal`,dir:u,activationMode:f=`automatic`,...p}=e,m=d(u),[h,v]=i({prop:a,onChange:s,defaultProp:c??``,caller:_});return(0,g.jsx)(x,{scope:n,baseId:o(),value:h,onValueChange:v,orientation:l,dir:m,activationMode:f,children:(0,g.jsx)(r.div,{dir:m,"data-orientation":l,...p,ref:t})})});C.displayName=_;var w=`TabsList`,T=h.forwardRef((e,t)=>{let{__scopeTabs:n,loop:i=!0,...a}=e,o=S(w,n),s=b(n);return(0,g.jsx)(p,{asChild:!0,...s,orientation:o.orientation,dir:o.dir,loop:i,children:(0,g.jsx)(r.div,{role:`tablist`,"aria-orientation":o.orientation,...a,ref:t})})});T.displayName=w;var E=`TabsTrigger`,D=h.forwardRef((e,t)=>{let{__scopeTabs:n,value:i,disabled:a=!1,...o}=e,s=S(E,n),c=b(n),l=A(s.baseId,i),d=j(s.baseId,i),p=i===s.value;return(0,g.jsx)(f,{asChild:!0,...c,focusable:!a,active:p,children:(0,g.jsx)(r.button,{type:`button`,role:`tab`,"aria-selected":p,"aria-controls":d,"data-state":p?`active`:`inactive`,"data-disabled":a?``:void 0,disabled:a,id:l,...o,ref:t,onMouseDown:u(e.onMouseDown,e=>{!a&&e.button===0&&e.ctrlKey===!1?s.onValueChange(i):e.preventDefault()}),onKeyDown:u(e.onKeyDown,e=>{[` `,`Enter`].includes(e.key)&&s.onValueChange(i)}),onFocus:u(e.onFocus,()=>{let e=s.activationMode!==`manual`;!p&&!a&&e&&s.onValueChange(i)})})})});D.displayName=E;var O=`TabsContent`,k=h.forwardRef((e,t)=>{let{__scopeTabs:n,value:i,forceMount:a,children:o,...c}=e,l=S(O,n),u=A(l.baseId,i),d=j(l.baseId,i),f=i===l.value,p=h.useRef(f);return h.useEffect(()=>{let e=requestAnimationFrame(()=>p.current=!1);return()=>cancelAnimationFrame(e)},[]),(0,g.jsx)(s,{present:a||f,children:({present:n})=>(0,g.jsx)(r.div,{"data-state":f?`active`:`inactive`,"data-orientation":l.orientation,role:`tabpanel`,"aria-labelledby":u,hidden:!n,id:d,tabIndex:0,...c,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:a(`group/tabs flex gap-2 data-horizontal:flex-col`,e),...n})}var L=l(`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:a(L({variant:t}),e),...n})}function z({className:e,...t}){return(0,g.jsx)(P,{"data-slot":`tabs-trigger`,className:a(`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:a(`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{aO as r,cO as i,dO as a,fO as o,iO as s,n as c,rO as l,t as u}from"./dist-Cxz8d8g5.js";import{t as d}from"./dist-CZgL-Z5m.js";import{dt as f,ft as p,pt as m}from"./index-BlRMvXrJ.js";var h=t(e(),1),g=n(),_=`Tabs`,[v,y]=i(_,[m]),b=m(),[x,S]=v(_),C=h.forwardRef((e,t)=>{let{__scopeTabs:n,value:i,onValueChange:a,defaultValue:s,orientation:c=`horizontal`,dir:u,activationMode:f=`automatic`,...p}=e,m=d(u),[h,v]=r({prop:i,onChange:a,defaultProp:s??``,caller:_});return(0,g.jsx)(x,{scope:n,baseId:l(),value:h,onValueChange:v,orientation:c,dir:m,activationMode:f,children:(0,g.jsx)(o.div,{dir:m,"data-orientation":c,...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),s=b(n);return(0,g.jsx)(p,{asChild:!0,...s,orientation:a.orientation,dir:a.dir,loop:r,children:(0,g.jsx)(o.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,...s}=e,c=S(E,n),l=b(n),u=A(c.baseId,r),d=j(c.baseId,r),p=r===c.value;return(0,g.jsx)(f,{asChild:!0,...l,focusable:!i,active:p,children:(0,g.jsx)(o.button,{type:`button`,role:`tab`,"aria-selected":p,"aria-controls":d,"data-state":p?`active`:`inactive`,"data-disabled":i?``:void 0,disabled:i,id:u,...s,ref:t,onMouseDown:a(e.onMouseDown,e=>{!i&&e.button===0&&e.ctrlKey===!1?c.onValueChange(r):e.preventDefault()}),onKeyDown:a(e.onKeyDown,e=>{[` `,`Enter`].includes(e.key)&&c.onValueChange(r)}),onFocus:a(e.onFocus,()=>{let e=c.activationMode!==`manual`;!p&&!i&&e&&c.onValueChange(r)})})})});D.displayName=E;var O=`TabsContent`,k=h.forwardRef((e,t)=>{let{__scopeTabs:n,value:r,forceMount:i,children:a,...c}=e,l=S(O,n),u=A(l.baseId,r),d=j(l.baseId,r),f=r===l.value,p=h.useRef(f);return h.useEffect(()=>{let e=requestAnimationFrame(()=>p.current=!1);return()=>cancelAnimationFrame(e)},[]),(0,g.jsx)(s,{present:i||f,children:({present:n})=>(0,g.jsx)(o.div,{"data-state":f?`active`:`inactive`,"data-orientation":l.orientation,role:`tabpanel`,"aria-labelledby":u,hidden:!n,id:d,tabIndex:0,...c,ref:t,style:{...e.style,animationDuration:p.current?`0s`:void 0},children:n&&a})})});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:c(`group/tabs flex gap-2 data-horizontal:flex-col`,e),...n})}var L=u(`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:c(L({variant:t}),e),...n})}function z({className:e,...t}){return(0,g.jsx)(P,{"data-slot":`tabs-trigger`,className:c(`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:c(`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{bO as e}from"./dist-Cxz8d8g5.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
@@ -38,14 +38,14 @@
38
38
  document.documentElement.dataset.ambiance = a === "off" ? "off" : "on";
39
39
  })();
40
40
  </script>
41
- <script type="module" crossorigin src="/assets/index-DcMWPy01.js"></script>
41
+ <script type="module" crossorigin src="/assets/index-BlRMvXrJ.js"></script>
42
42
  <link rel="modulepreload" crossorigin href="/assets/bundle-mjs-C73ZY4La.js">
43
- <link rel="modulepreload" crossorigin href="/assets/dist-DRXIQewX.js">
44
- <link rel="modulepreload" crossorigin href="/assets/dist-H7gCiaFZ.js">
45
- <link rel="modulepreload" crossorigin href="/assets/dist-BDdbnJdn.js">
46
- <link rel="modulepreload" crossorigin href="/assets/dist-DS_sZFhE.js">
47
- <link rel="modulepreload" crossorigin href="/assets/x-1RyayDYu.js">
48
- <link rel="modulepreload" crossorigin href="/assets/button-CrkRjd-T.js">
43
+ <link rel="modulepreload" crossorigin href="/assets/dist-Cxz8d8g5.js">
44
+ <link rel="modulepreload" crossorigin href="/assets/dist-CZgL-Z5m.js">
45
+ <link rel="modulepreload" crossorigin href="/assets/dist-CI2WPmAQ.js">
46
+ <link rel="modulepreload" crossorigin href="/assets/dist-CRGyTqMI.js">
47
+ <link rel="modulepreload" crossorigin href="/assets/x-BimfpZdd.js">
48
+ <link rel="modulepreload" crossorigin href="/assets/button-BOkPsnkZ.js">
49
49
  <link rel="stylesheet" crossorigin href="/assets/index-DbRDkkXU.css">
50
50
  </head>
51
51
  <body>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lacneu/atrium",
3
- "version": "0.25.0",
3
+ "version": "0.26.1",
4
4
  "description": "Atrium — public, self-hostable, Convex-backed web chat UI for AI agent gateways (OpenClaw today, Hermes next). Ships an origin-agnostic static bundle (Convex URL injected at runtime via /config.json).",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -1,3 +0,0 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Ci as r,Di as i,Ei as a,GD as o,IS as s,Oi as c,SO as l,Si as ee,TO as u,Ti as d,_i as te,ai as f,bi as ne,ci as p,di as m,ei as h,fa as g,fi as _,gi as v,hi as y,ii as re,ki as b,li as x,mi as S,ni as C,oi as w,pi as ie,qD as ae,ri as T,si as E,ti as D,ua as oe,ui as se,vO as O,vi as k,wi as A,xi as ce,yi as j}from"./dist-DRXIQewX.js";import{t as M}from"./button-CrkRjd-T.js";import{$ as N,A as P,B as F,C as I,F as le,I as ue,L as de,N as fe,P as pe,Q as me,R as he,S as L,X as R,b as z,et as ge,mt as B,nt as _e,ot as V,rt as ve,v as H,x as U,y as W,z as ye}from"./index-DcMWPy01.js";import{i as G}from"./compatView-BiLj8anr.js";/* empty css */var K=t(e(),1),q=2e4,J=6e4;function Y(e){return typeof e!=`number`||e<=0?0:Math.round(e/q*100)}function X(e){return e<=0?0:Math.round(e/J*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 be(e){return e.reduce((e,t)=>e+(typeof t.size==`number`&&t.size>0?t.size:0),0)}var xe=3;function Se(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<xe&&a.push(e)):t>0&&(i+=t,o.length<xe&&o.push(e));return{added:r,removed:i,sampleAdded:a,sampleRemoved:o}}function Ce(e){return e instanceof Error?e.message.includes(`conflict:`):String(e).includes(`conflict:`)}var Q=n(),$=e=>`${e.instanceName}::${e.agentId}`;function we(){let e=u(O.me.getMe,{host:V}),t=e?.role===`admin`,n=(e?.permissions??[]).includes(`bridge.read`),s=u(O.admin.listInstances,e!==void 0&&t?{}:`skip`),[f,p]=(0,K.useState)(null);(0,K.useEffect)(()=>{!t||!s||s.length===0||(!f||!s.some(e=>e.name===f))&&p(s[0].name)},[t,s,f]);let m=u(O.agents.listAgentsForInstance,t&&f?{instanceName:f}:`skip`),h=u(O.agents.listMyAgents,e!==void 0&&!t?{}:`skip`),g=(0,K.useMemo)(()=>{if(e!==void 0){if(t)return f===null||m===void 0?s!==void 0&&s.length===0?[]:void 0:m.agents.map(e=>({instanceName:f,agentId:e.agentId,label:`${e.emoji?`${e.emoji} `:``}${e.displayName??e.agentId}`}));if(h!==void 0)return h.map(e=>({instanceName:e.instanceName,agentId:e.agentId,label:`${e.emoji?`${e.emoji} `:``}${e.displayName??e.agentId}`}))}},[e,t,f,m,s,h]),[_,v]=(0,K.useState)(null);(0,K.useEffect)(()=>{!g||g.length===0||(!_||!g.some(e=>$(e)===_))&&v($(g[0]))},[g,_]);let y=g?.find(e=>$(e)===_)??null,re=l(O.agentFiles.listAgentFiles),[x,S]=(0,K.useState)({status:`idle`}),C=y?.instanceName??null,w=y?.agentId??null,ie=u(O.compat.forInstance,n&&C!==null?{instanceName:C}:`skip`),T=n&&C!==null?H(ie,`agentFiles`):null,E=T===null?!1:T===`loading`?null:T.blocked,D=(0,K.useCallback)(async()=>{if(!(C===null||w===null)){S({status:`loading`});try{S({status:`done`,files:(await re({instanceName:C,agentId:w})).files})}catch{S({status:`error`})}}},[re,C,w]);(0,K.useEffect)(()=>{E===!1&&D()},[D,E]);let[se,N]=(0,K.useState)(null),P=ae(),F=(0,K.useMemo)(()=>new Intl.NumberFormat(P,{maximumFractionDigits:0}),[P]);return e===void 0||g===void 0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:o()}):(0,Q.jsxs)(`div`,{className:`oc-afiles`,children:[(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:b()}),(0,Q.jsxs)(`div`,{className:`oc-afiles__picker`,children:[t&&(s?.length??0)>1?(0,Q.jsxs)(W,{value:f??``,onValueChange:e=>p(e),children:[(0,Q.jsx)(L,{size:`sm`,"aria-label":c(),children:(0,Q.jsx)(I,{})}),(0,Q.jsx)(z,{children:(s??[]).map(e=>(0,Q.jsx)(U,{value:e.name,children:e.name},e.name))})]}):null,g.length>0?(0,Q.jsxs)(W,{value:_??``,onValueChange:e=>v(e),children:[(0,Q.jsx)(L,{size:`sm`,"aria-label":i(),children:(0,Q.jsx)(I,{})}),(0,Q.jsx)(z,{children:g.map(e=>(0,Q.jsx)(U,{value:$(e),children:e.label},$(e)))})]}):(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:a()})]}),y===null?null:T===`loading`?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:o()}):T!==null&&T.blocked?(0,Q.jsxs)(`p`,{className:`oc-compat__blocked`,role:`status`,children:[(0,Q.jsx)(B,{size:14,"aria-hidden":!0}),` `,G(T.gatewayVersion)]}):x.status===`loading`||x.status===`idle`?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:o()}):x.status===`error`?(0,Q.jsxs)(`p`,{className:`oc-afiles__error`,role:`alert`,children:[A(),` `,(0,Q.jsx)(M,{variant:`outline`,size:`sm`,onClick:()=>void D(),children:oe()})]}):x.files.length===0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:d()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`div`,{className:`oc-afiles__list`,children:x.files.map(e=>{let n=Y(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)(R,{variant:`outline`,children:r()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`span`,{className:`oc-afiles__size`,children:ee({size:Z(e.size,P)})}),(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:ce({pct:F.format(n)})}),i?(0,Q.jsx)(B,{size:14,className:`oc-afiles__warn`,"aria-label":ne()}):(0,Q.jsx)(`span`,{className:`oc-afiles__warn-slot`,"aria-hidden":!0})]}),(0,Q.jsx)(M,{variant:`outline`,size:`sm`,className:`oc-afiles__open`,onClick:()=>N(e),children:t?k():te()})]},e.name)})}),(0,Q.jsx)(`p`,{className:`oc-afiles__budget`,children:j({used:Z(be(x.files),P),total:Z(J,P),pct:F.format(X(be(x.files)))})})]}),se&&y?(0,Q.jsx)(Te,{instanceName:y.instanceName,agentId:y.agentId,name:se.name,isAdmin:t,onClose:()=>N(null),onSaved:()=>void D()}):null]})}function Te({instanceName:e,agentId:t,name:n,isAdmin:r,onClose:i,onSaved:a}){let c=l(O.agentFiles.getAgentFile),ee=l(O.agentFiles.setAgentFile),u=P(),[d,te]=(0,K.useState)(null),[ne,b]=(0,K.useState)(!1),[k,A]=(0,K.useState)(``),[ce,j]=(0,K.useState)(!1),[I,L]=(0,K.useState)(!1),[R,z]=(0,K.useState)(!1),[B,V]=(0,K.useState)(!1),H=(0,K.useCallback)(async r=>{b(!1);try{let i=await c({instanceName:e,agentId:t,name:n});te({content:i.content,updatedAtMs:i.updatedAtMs}),r||A(i.content),z(!1)}catch{b(!0)}},[c,e,t,n]);(0,K.useEffect)(()=>{H(!1)},[H]);async function U(){if(d!==null){L(!0),V(!1);try{await ee({instanceName:e,agentId:t,name:n,content:k,baseUpdatedAtMs:d.updatedAtMs??void 0}),u.success(se({name:n})),a(),await H(!1)}catch(e){Ce(e)?z(!0):V(!0)}finally{L(!1)}}}let W=d!==null&&k!==d.content,G=(0,K.useMemo)(()=>d===null?null:Se(d.content,k),[d,k]),J=k.length>q,Y=ae(),X=(0,K.useMemo)(()=>new Intl.NumberFormat(Y),[Y]);return(0,Q.jsx)(me,{open:!0,onOpenChange:e=>!e&&i(),children:(0,Q.jsxs)(N,{className:`oc-afiles__editor`,children:[(0,Q.jsxs)(_e,{children:[(0,Q.jsx)(ve,{children:v({name:n})}),(0,Q.jsxs)(ge,{children:[y({agent:t,instance:e}),r?null:(0,Q.jsxs)(Q.Fragment,{children:[` · `,S()]})]})]}),ne?(0,Q.jsxs)(`p`,{className:`oc-afiles__error`,role:`alert`,children:[p(),` `,(0,Q.jsx)(M,{variant:`outline`,size:`sm`,onClick:()=>void H(!1),children:oe()})]}):d===null?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:o()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`textarea`,{className:`oc-afiles__source`,value:k,readOnly:!r,spellCheck:!1,onChange:e=>A(e.target.value),"aria-label":v({name:n})}),(0,Q.jsx)(`p`,{className:`oc-afiles__hint`,children:ie()}),R?(0,Q.jsxs)(`p`,{className:`oc-afiles__error`,role:`alert`,children:[E(),` `,(0,Q.jsx)(M,{variant:`outline`,size:`sm`,onClick:()=>void H(!0),children:w()})]}):null,B?(0,Q.jsx)(`p`,{className:`oc-afiles__error`,role:`alert`,children:x()}):null,(0,Q.jsxs)(`div`,{className:`oc-afiles__editor-foot`,children:[(0,Q.jsx)(`span`,{className:`oc-afiles__count${J?` is-over`:``}`,children:_({count:X.format(k.length),max:X.format(q)})}),r?(0,Q.jsx)(M,{size:`sm`,disabled:!W||I||R,onClick:()=>j(!0),children:I?g():m()}):null]})]}),(0,Q.jsx)(fe,{open:ce,onOpenChange:j,children:(0,Q.jsxs)(ue,{children:[(0,Q.jsxs)(ye,{children:[(0,Q.jsx)(F,{children:f({name:n})}),(0,Q.jsx)(de,{children:re({agent:t})})]}),G?(0,Q.jsxs)(`div`,{className:`oc-afiles__diff`,children:[(0,Q.jsx)(`p`,{className:`oc-afiles__diff-counts`,children:T({added:G.added,removed:G.removed})}),G.sampleAdded.length>0?(0,Q.jsxs)(`div`,{className:`oc-afiles__diff-block`,children:[(0,Q.jsx)(`span`,{className:`oc-afiles__diff-label`,children:C()}),G.sampleAdded.map((e,t)=>(0,Q.jsx)(`code`,{className:`oc-afiles__diff-line is-add`,children:e||` `},t))]}):null,G.sampleRemoved.length>0?(0,Q.jsxs)(`div`,{className:`oc-afiles__diff-block`,children:[(0,Q.jsx)(`span`,{className:`oc-afiles__diff-label`,children:D()}),G.sampleRemoved.map((e,t)=>(0,Q.jsx)(`code`,{className:`oc-afiles__diff-line is-del`,children:e||` `},t))]}):null]}):null,(0,Q.jsxs)(he,{children:[(0,Q.jsx)(le,{children:s()}),(0,Q.jsx)(pe,{onClick:()=>void U(),children:h()})]})]})})]})})}export{we as AgentFilesTab};
@@ -1 +0,0 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Am as r,Bm as i,Cm as ee,Dm as a,Em as o,Fm as te,Gm as s,Hm as ne,Im as re,Km as c,Lm as l,Mm as u,Nm as d,Om as f,Pm as p,Rm as m,Sm as h,TO as g,Tm as ie,Um as ae,Vm as oe,Wm as se,_m as ce,am as _,bm as v,cm as y,dm as le,fm as ue,gm as de,hm as fe,jm as pe,km as me,lm as he,mm as ge,om as b,pm as x,qm as S,sm as C,um as w,vO as T,vm as E,wO as D,wm as O,xm as k,ym as A,zm as j}from"./dist-DRXIQewX.js";import{A as M,C as N,Mt as P,S as F,X as I,a as L,b as R,j as _e,jt as z,ot as ve,r as ye,x as B,y as V}from"./index-DcMWPy01.js";import{n as be}from"./TimeRangePicker-DQjAXG44.js";import{t as xe}from"./FilterBar-DR1-M_rz.js";import{t as Se}from"./DataTableShell-CJHDSNd8.js";import{t as H}from"./dispatchErrorInfo-B8AArkw7.js";var U=t(e(),1),W=n(),G=`__all__`,Ce=[{value:`open`},{value:`acknowledged`},{value:`resolved`}];function we(e){return e===`open`?S():e===`acknowledged`?c():s()}var Te=[`info`,`warn`,`critical`],Ee=[`detector`,`agent`,`user`],De={kind:`relative`,from:`now-30d`,to:`now`},Oe=200,K=`all`;function q(){let e=P({from:`/settings/anomalies`}),t=z({from:`/settings/anomalies`}),n=e.q??``,s=e.status===K?G:e.status,c=e.severity??G,_=e.kind??G,[y,b]=(0,U.useState)(G),S=ye(e.from,e.to),{from:C,to:H}=be(S),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})}),Ne=e=>void t({search:t=>({...t,kind:e===G?void 0:e})}),X=e=>void t({search:t=>({...t,...L(e)})}),Pe=_e(),Z=M(),Q=D(T.anomalies.resolveAnomaly),Fe=(g(T.me.getMe,{host:ve})?.permissions??[]).includes(`admin.manage`),$=g(T.anomalies.listAnomalies,{limit:Oe,filter:{q:n||void 0,from:C,to:H,anomalyStatus:s===G?void 0:s,severity:c===G?void 0:c,source:y===G?void 0:y,kind:_===G?void 0:_}}),Ie=(0,U.useMemo)(()=>{let e=new Set;for(let t of $??[])e.add(t.kind);return[...e].sort()},[$]),Le=n!==``||s!==`open`||c!==G||y!==G||_!==G||S.kind!==`relative`||S.from!==De.from;function Re(){b(G),t({search:{status:`open`},replace:!0})}async function ze(e){if(await Pe({title:se(),description:(0,W.jsxs)(W.Fragment,{children:[ae(),` `,(0,W.jsx)(`span`,{className:`font-mono`,children:e.kind}),` `,ne(),` `,(0,W.jsx)(`strong`,{children:oe()}),`.`,` `,i()]}),confirmLabel:j()}))try{await Q({anomalyId:e._id,status:`resolved`}),Z.success(m(),e.kind)}catch(e){Z.error(l(),e)}}async function Be(e){try{await Q({anomalyId:e._id,status:`acknowledged`}),Z.success(re(),e.kind)}catch(e){Z.error(te(),e)}}return(0,W.jsxs)(W.Fragment,{children:[(0,W.jsxs)(`p`,{className:`oc-admin__hint`,children:[p(),` `,(0,W.jsx)(`strong`,{children:d()}),` `,u(),` `,(0,W.jsx)(`strong`,{children:pe()}),` `,r(),` `,(0,W.jsx)(`strong`,{children:me()}),` `,f(),` `,(0,W.jsx)(`span`,{className:`oc-filter__window`,children:a()})]}),(0,W.jsxs)(xe,{q:n,onQChange:q,searchPlaceholder:o(),timeRange:S,onTimeRangeChange:X,onReset:Re,canReset:Le,children:[(0,W.jsxs)(V,{value:s,onValueChange:J,children:[(0,W.jsx)(F,{size:`sm`,className:`w-36`,children:(0,W.jsx)(N,{})}),(0,W.jsxs)(R,{children:[(0,W.jsx)(B,{value:G,children:ie()}),Ce.map(e=>(0,W.jsx)(B,{value:e.value,children:we(e.value)},e.value))]})]}),(0,W.jsxs)(V,{value:c,onValueChange:Y,children:[(0,W.jsx)(F,{size:`sm`,className:`w-36`,children:(0,W.jsx)(N,{placeholder:O()})}),(0,W.jsxs)(R,{children:[(0,W.jsx)(B,{value:G,children:ee()}),Te.map(e=>(0,W.jsx)(B,{value:e,children:e},e))]})]}),(0,W.jsxs)(V,{value:y,onValueChange:b,children:[(0,W.jsx)(F,{size:`sm`,className:`w-32`,children:(0,W.jsx)(N,{placeholder:h()})}),(0,W.jsxs)(R,{children:[(0,W.jsx)(B,{value:G,children:k()}),Ee.map(e=>(0,W.jsx)(B,{value:e,children:e},e))]})]}),(0,W.jsxs)(V,{value:_,onValueChange:Ne,children:[(0,W.jsx)(F,{size:`sm`,className:`w-36`,children:(0,W.jsx)(N,{placeholder:v()})}),(0,W.jsxs)(R,{children:[(0,W.jsx)(B,{value:G,children:A()}),Ie.map(e=>(0,W.jsx)(B,{value:e,children:e},e))]})]})]}),(0,W.jsx)(Se,{title:E(),rows:$,emptyHint:s===`open`?ce():de(),rowActions:e=>Fe&&e.status===`open`?[{label:fe(),onSelect:()=>void ze(e)},{label:ge(),onSelect:()=>void Be(e)}]:[],columns:[{header:x(),cell:e=>(0,W.jsx)(`span`,{className:`oc-traces__time`,children:new Date(e.at).toLocaleString(`fr-FR`)}),sort:e=>e.at},{header:v(),cell:e=>(0,W.jsx)(`code`,{className:`oc-traces__mono`,children:e.kind}),sort:e=>e.kind},{header:O(),cell:e=>(0,W.jsx)(Ae,{severity:e.severity}),sort:e=>e.severity===`critical`?2:+(e.severity===`warn`)},{header:ue(),cell:e=>(0,W.jsx)(je,{status:e.status}),sort:e=>e.status===`resolved`?2:+(e.status===`acknowledged`)},{header:h(),cell:e=>(0,W.jsx)(I,{variant:`outline`,children:e.source}),sort:e=>e.source},{header:le(),cell:e=>(0,W.jsx)(`span`,{className:`oc-anomaly__msg`,children:e.message}),sort:e=>e.message},{header:w(),cell:e=>(0,W.jsx)(ke,{row:e}),sort:e=>e.evidence??null},{header:he(),cell:e=>e.correlationId?(0,W.jsx)(`code`,{className:`oc-traces__mono`,children:Me(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 ke({row:e}){let t=z();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:[`↗ `,y()]}):null]})}let n=J(e);if(!n.dominantCode)return(0,W.jsx)(`span`,{className:`oc-traces__muted`,children:`—`});let r=H(n.dominantCode),i=n.sampleCorrelationId;return(0,W.jsxs)(`div`,{className:`oc-anomaly__cause`,children:[(0,W.jsxs)(`div`,{className:`oc-anomaly__cause-head`,children:[(0,W.jsx)(`span`,{className:`oc-anomaly__cause-label`,children:r.label}),(0,W.jsx)(`code`,{className:`oc-traces__mono`,children:n.dominantCode})]}),(0,W.jsx)(`p`,{className:`oc-anomaly__cause-hint`,children:r.hint}),i?(0,W.jsxs)(`button`,{type:`button`,className:`oc-anomaly__drill`,onClick:()=>void t({to:`/settings/traces`,search:{q:i,limit:100}}),children:[`↗ `,y()]}):null]})}function Ae({severity:e}){return(0,W.jsx)(`span`,{className:`oc-anomaly__sev oc-anomaly__sev--${e}`,children:e})}function je({status:e}){return e===`open`?(0,W.jsx)(I,{variant:`destructive`,children:C()}):e===`acknowledged`?(0,W.jsx)(I,{variant:`secondary`,children:b()}):(0,W.jsx)(I,{variant:`outline`,children:_()})}function Me(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{$d as r,$u as i,Ar as a,Au as o,Bu as s,Cd as c,Dr as l,Er as u,Fr as d,Fu as f,Gu as p,Hu as m,Ir as h,Iu as g,Ju as _,Kd as ee,Ku as te,Lr as v,Lu as ne,Mr as re,Mu as y,Nr as ie,Nu as ae,Or as oe,Pr as b,Pu as se,Qd as ce,Qu as le,Rr as ue,Ru as de,SO as fe,Sd as pe,Sr as me,TO as x,Uu as he,Vu as ge,Wu as S,Xd as _e,Xu as ve,Yu as ye,Zd as be,Zu as xe,_d as Se,ad as Ce,af as we,bd as Te,cd as Ee,dd as De,ed as Oe,ef as ke,fd as Ae,gd as je,hd as Me,id as Ne,jr as Pe,ju as C,kr as Fe,ld as Ie,md as Le,nd as Re,nf as ze,od as Be,of as Ve,pd as He,qd as Ue,qu as We,rd as w,rf as Ge,sd as Ke,td as qe,tf as Je,ud as Ye,vO as T,vd as Xe,wO as Ze,wd as Qe,xd as $e,yO as E,yd as et,zr as tt,zu as nt}from"./dist-DRXIQewX.js";import{i as D,r as rt}from"./dist-H7gCiaFZ.js";import{t as it}from"./chevrons-up-down-BUZg64Ip.js";import{i as at,n as O,o as ot,r as st,s as ct}from"./FieldLabel-DbxkeyLF.js";import{t as k}from"./button-CrkRjd-T.js";import{$ as lt,A as ut,At as A,C as j,H as dt,Q as ft,S as M,St as pt,U as mt,V as ht,X as N,Z as P,_ as gt,_t,b as F,et as vt,jt as yt,kt as I,mt as L,nt as bt,ot as xt,rt as St,x as R,y as z}from"./index-DcMWPy01.js";import{a as Ct,i as B,n as wt,o as V,r as H,t as Tt}from"./table-3aSLasBW.js";import{t as Et}from"./FilterBar-DR1-M_rz.js";import{a as U,n as Dt,o as W,r as Ot,s as kt,t as At}from"./compatView-BiLj8anr.js";import{t as G}from"./dispatchErrorInfo-B8AArkw7.js";var jt=E(`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`}]]),Mt=E(`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 Nt(e){return e.filter(e=>e.state===`error`)}function Pt(e){return e.reachable&&Nt(e.targets).length===0}function Ft(e){return e.state===`error`&&e.lastErrorCode!==null}function It(e){return!!e.lastDownstreamRejectCode}function q(e){return e.kind??`openclaw`}function Lt(e){return[...e].sort((e,t)=>e===`openclaw`?-1:t===`openclaw`?1:e.localeCompare(t))}function Rt(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 Lt(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 zt(e){return e===`openclaw`?`OpenClaw`:e===`hermes`?`Hermes`:e.charAt(0).toUpperCase()+e.slice(1)}var J=`__all__`,Bt={q:``,state:J,instance:J,version:J},Y={connected:0,error:1,idle:2};function Vt(e){return e.q.trim()!==``||e.state!==`__all__`||e.instance!==`__all__`||e.version!==`__all__`}function Ht(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 X(e,t){return e.localeCompare(t,void 0,{numeric:!0,sensitivity:`base`})}function Ut(e,t){return e===`version`?t.gatewayVersion===null:e===`lastOk`?t.lastOkAt===null:!1}function Wt(e,t,n){switch(e){case`state`:return(Y[t.state]??99)-(Y[n.state]??99);case`instance`:return X(t.instanceLabel??t.instanceName??``,n.instanceLabel??n.instanceName??``);case`host`:return X(t.gatewayHost,n.gatewayHost);case`version`:{let e=t.gatewayVersion,r=n.gatewayVersion;return W(e,r)??X(e,r)}case`lastOk`:return t.lastOkAt-n.lastOkAt;default:return X(t.targetLabel,n.targetLabel)}}function Gt(e,t){if(!t)return e;let n=t.dir===`asc`?1:-1;return[...e].sort((e,r)=>{let i=Ut(t.key,e),a=Ut(t.key,r);return i&&a?0:i?1:a?-1:n*Wt(t.key,e,r)})}function Kt(e){let t=new Set;for(let n of e)t.add(n.state);return[...t].sort((e,t)=>(Y[e]??99)-(Y[t]??99))}function qt(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)=>X(e.label,t.label))}function Jt(e){let t=new Set;for(let n of e)n.gatewayVersion!==null&&t.add(n.gatewayVersion);return[...t].sort((e,t)=>W(e,t)??X(e,t))}var Z=n();function Yt({connections:e,displayByInstance:t}){let[n,r]=(0,K.useState)(Bt),[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,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]),c=(0,K.useMemo)(()=>Kt(o),[o]),l=(0,K.useMemo)(()=>qt(o),[o]),u=(0,K.useMemo)(()=>Jt(o),[o]),d=(0,K.useMemo)(()=>Gt(Ht(o,n),i),[o,n,i]);function h(e){a(t=>t?.key===e?t.dir===`asc`?{key:e,dir:`desc`}:null:{key:e,dir:`asc`})}return e.length===0?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:_()}):(0,Z.jsxs)(`div`,{className:`oc-conn`,children:[(0,Z.jsxs)(Et,{q:n.q,onQChange:e=>r(t=>({...t,q:e})),searchPlaceholder:p(),onReset:()=>r(Bt),canReset:Vt(n),children:[(0,Z.jsxs)(z,{value:n.state,onValueChange:e=>r(t=>({...t,state:e})),children:[(0,Z.jsx)(M,{size:`sm`,className:`w-36`,children:(0,Z.jsx)(j,{placeholder:he()})}),(0,Z.jsxs)(F,{children:[(0,Z.jsx)(R,{value:J,children:S()}),c.map(e=>(0,Z.jsx)(R,{value:e,children:Zt(e)},e))]})]}),(0,Z.jsxs)(z,{value:n.instance,onValueChange:e=>r(t=>({...t,instance:e})),children:[(0,Z.jsx)(M,{size:`sm`,className:`w-40`,children:(0,Z.jsx)(j,{placeholder:m()})}),(0,Z.jsxs)(F,{children:[(0,Z.jsx)(R,{value:J,children:S()}),l.map(e=>(0,Z.jsx)(R,{value:e.name,children:e.label},e.name))]})]}),(0,Z.jsxs)(z,{value:n.version,onValueChange:e=>r(t=>({...t,version:e})),children:[(0,Z.jsx)(M,{size:`sm`,className:`w-36`,children:(0,Z.jsx)(j,{placeholder:ge()})}),(0,Z.jsxs)(F,{children:[(0,Z.jsx)(R,{value:J,children:S()}),u.map(e=>(0,Z.jsx)(R,{value:e,children:e},e))]})]})]}),d.length===0?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:s()}):(0,Z.jsxs)(Tt,{className:`oc-conn__table`,children:[(0,Z.jsx)(Ct,{children:(0,Z.jsxs)(V,{children:[(0,Z.jsx)(Q,{label:nt(),sortKey:`target`,sort:i,onSort:h}),(0,Z.jsx)(Q,{label:de(),sortKey:`state`,sort:i,onSort:h}),(0,Z.jsx)(Q,{label:ne(),sortKey:`instance`,sort:i,onSort:h}),(0,Z.jsx)(Q,{label:g(),sortKey:`host`,sort:i,onSort:h}),(0,Z.jsx)(Q,{label:f(),sortKey:`version`,sort:i,onSort:h}),(0,Z.jsx)(B,{children:se()}),(0,Z.jsx)(Q,{label:ae(),sortKey:`lastOk`,sort:i,onSort:h})]})}),(0,Z.jsx)(wt,{children:d.map(e=>(0,Z.jsx)(Xt,{r:e},e._id))})]})]})}function Q({label:e,sortKey:t,sort:n,onSort:r}){let i=n?.key===t,a=i?n.dir:null;return(0,Z.jsx)(B,{"aria-sort":i?a===`asc`?`ascending`:`descending`:`none`,children:(0,Z.jsxs)(`button`,{type:`button`,className:`oc-conn__sort`,onClick:()=>r(t),children:[e,i?a===`asc`?(0,Z.jsx)(rt,{size:13,"aria-hidden":!0}):(0,Z.jsx)(D,{size:13,"aria-hidden":!0}):(0,Z.jsx)(it,{size:13,"aria-hidden":!0,className:`oc-conn__sort-idle`})]})})}function Xt({r:e}){let t=Ft(e)?G(e.lastErrorCode):null,n=It(e)?G(e.lastDownstreamRejectCode):null;return(0,Z.jsxs)(K.Fragment,{children:[(0,Z.jsxs)(V,{className:`oc-conn__row oc-conn__row--${e.state}`,children:[(0,Z.jsx)(H,{children:(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:e.targetLabel})}),(0,Z.jsx)(H,{children:(0,Z.jsx)(Qt,{state:e.state})}),(0,Z.jsx)(H,{children:e.instanceLabel?(0,Z.jsx)(`span`,{className:`oc-bridge-target__instance`,children:e.instanceLabel}):(0,Z.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})}),(0,Z.jsx)(H,{children:(0,Z.jsx)(`span`,{className:`oc-bridge-target__host`,children:e.gatewayHost})}),(0,Z.jsx)(H,{children:e.gatewayVersion?(0,Z.jsx)(`span`,{className:`oc-bridge-target__version`,children:e.gatewayVersion}):(0,Z.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})}),(0,Z.jsx)(H,{children:(0,Z.jsx)(`span`,{className:`oc-conn__stats`,children:We({ok:e.okCount,errors:e.errorCount,attempts:e.attempts})})}),(0,Z.jsx)(H,{children:e.lastOkAt?(0,Z.jsx)(`span`,{className:`oc-traces__mono`,children:new Date(e.lastOkAt).toLocaleTimeString(`fr-FR`)}):(0,Z.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})})]}),t||n?(0,Z.jsx)(V,{className:`oc-conn__detail-row`,children:(0,Z.jsxs)(H,{colSpan:7,className:`oc-conn__detail-cell`,children:[t?(0,Z.jsxs)(`div`,{className:`oc-bridge-target__error`,children:[(0,Z.jsx)(`strong`,{children:t.label}),` `,(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:e.lastErrorCode}),e.lastErrorAt?` · ${new Date(e.lastErrorAt).toLocaleTimeString(`fr-FR`)}`:``,(0,Z.jsx)(`p`,{className:`oc-bridge-card__hint`,children:t.hint})]}):null,n?(0,Z.jsxs)(`div`,{className:`oc-bridge-target__downstream`,children:[te({label:n.label}),` `,(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:e.lastDownstreamRejectCode}),e.lastDownstreamRejectAt?` · ${new Date(e.lastDownstreamRejectAt).toLocaleTimeString(`fr-FR`)}`:``]}):null]})}):null]})}function Zt(e){return e===`connected`?y():e===`error`?C():o()}function Qt({state:e}){return e===`connected`?(0,Z.jsx)(N,{variant:`secondary`,children:y()}):e===`error`?(0,Z.jsx)(N,{variant:`destructive`,children:C()}):(0,Z.jsx)(N,{variant:`outline`,children:o()})}function $t(){return x(T.bridgeHealth.getBridgeHealth,{})}function en(){let e=$t(),t=x(T.compat.getBridgeCompat,{}),n=x(T.me.getMe,{host:xt})?.role===`admin`,r=x(T.admin.listInstances,n?{}:`skip`),i=yt(),a=()=>void i({to:`/settings/anomalies`,search:{status:`open`}}),o=Rt(e?e.targets:[],t?t.targets:[],r??[]),s=t?.compat??null,c=t===void 0?`loading`:t===null?`nodata`:`ready`,l=s!==null&&Dt(s,`hermes`)&&!o.some(e=>e.key===`hermes`);return(0,Z.jsxs)(`div`,{className:`oc-bridge`,children:[(0,Z.jsx)(tn,{health:e,compat:t,onSeeAnomalies:a}),(0,Z.jsx)(`p`,{className:`oc-admin__hint oc-bridge__caption`,children:Ye()}),o.map(e=>(0,Z.jsx)(nn,{providerKey:e.key,connections:e.connections,instances:e.instances,manifest:s,compatStatus:c,compatReachable:t?.reachable??!0,protocol:e.key===`openclaw`?t?.protocol??null:null},e.key)),l?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:me()}):null]})}function tn({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,Z.jsxs)(`span`,{className:`oc-bridge-card__ver`,children:[(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:U(t.bridgeVersion)}),a?(0,Z.jsxs)(Z.Fragment,{children:[` `,(0,Z.jsxs)(`code`,{className:`oc-traces__mono`,title:v(),children:[`(`,a,`)`]})]}):null,r?(0,Z.jsxs)(`strong`,{className:`oc-bridge-card__mismatch`,children:[` `,h({build:t.buildVersion??`?`})]}):null,` · `,d(),` `,(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:t.protocolVersion===null?b():String(t.protocolVersion)})]}):null;if(e===void 0)return(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:w()});if(e===null)return(0,Z.jsx)(`div`,{className:`oc-bridge-card oc-bridge-card--idle`,children:Re()});let s=Nt(e.targets),c=!e.reachable,l=Pt(e),u=l?`ok`:`error`,f=new Date(e.checkedAt).toLocaleString(`fr-FR`),p=e.startedAt==null?null:new Date(e.startedAt).toLocaleString(`fr-FR`);return(0,Z.jsxs)(`div`,{className:`oc-bridge-card oc-bridge-card--${u}`,children:[(0,Z.jsx)(`div`,{className:`oc-bridge-card__icon`,"aria-hidden":!0,children:l?(0,Z.jsx)(I,{size:22}):c?(0,Z.jsx)(Mt,{size:22}):(0,Z.jsx)(L,{size:22})}),(0,Z.jsxs)(`div`,{className:`oc-bridge-card__body`,children:[(0,Z.jsx)(`div`,{className:`oc-bridge-card__title`,children:l?qe():c?Oe():i({count:s.length})}),(0,Z.jsxs)(`div`,{className:`oc-bridge-card__meta`,children:[(0,Z.jsxs)(`span`,{children:[(0,Z.jsx)(jt,{size:12,"aria-hidden":!0}),` `,le({time:f})]}),p?(0,Z.jsx)(`span`,{children:xe({time:p})}):null,o]}),c?(0,Z.jsx)(`p`,{className:`oc-bridge-card__hint`,children:G(e.lastError===`not_configured`?`NOT_CONFIGURED`:`BRIDGE_UNREACHABLE`).hint}):null]}),(0,Z.jsx)(`button`,{type:`button`,className:`oc-bridgebar__drill`,onClick:n,children:ve()})]})}function nn({providerKey:e,connections:t,instances:n,manifest:r,compatStatus:i,compatReachable:a,protocol:o}){let s=r?kt(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:At(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,Z.jsxs)(`section`,{className:`oc-bridge-provider`,children:[(0,Z.jsxs)(`header`,{className:`oc-bridge-provider__head`,children:[(0,Z.jsx)(_t,{size:15,"aria-hidden":!0,className:`oc-bridge-provider__icon`}),(0,Z.jsx)(`span`,{className:`oc-bridge-provider__name`,children:zt(e)}),f?(0,Z.jsx)(N,{variant:f===`beyond`?`destructive`:`secondary`,children:Ot(f)}):null]}),(0,Z.jsx)(`h4`,{className:`oc-bridge-provider__sub`,children:tt()}),(0,Z.jsx)(an,{support:s,compatStatus:i,compatReachable:a,manifest:r,instanceRows:l}),o?(0,Z.jsx)(rn,{protocol:o}):null,(0,Z.jsxs)(`button`,{type:`button`,className:`oc-bridge-provider__sub oc-bridge-provider__sub--toggle`,"aria-expanded":p,onClick:()=>m(e=>!e),children:[p?(0,Z.jsx)(D,{size:13,"aria-hidden":!0}):(0,Z.jsx)(A,{size:13,"aria-hidden":!0}),ye({count:t.length})]}),p?(0,Z.jsx)(Yt,{connections:t,displayByInstance:c}):null]})}function rn({protocol:e}){let[t,n]=(0,K.useState)(!1),r=e.coverage,i=e.drift??[];return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`h4`,{className:`oc-bridge-provider__sub`,children:[Ie(),i.length>0?(0,Z.jsx)(N,{variant:`destructive`,children:Ke({count:i.length})}):(0,Z.jsx)(N,{variant:`secondary`,children:Ee()})]}),(0,Z.jsxs)(`p`,{className:`oc-admin__hint`,children:[Be({version:e.vendoredVersion}),r?` · `+Ce({handled:r.handled,ignored:r.ignored,gaps:r.gaps}):null]}),i.length>0?(0,Z.jsx)(`ul`,{className:`oc-bridge-protocol__list`,role:`list`,children:i.map(e=>(0,Z.jsxs)(`li`,{children:[(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:e.shape}),` × `,e.count]},e.shape))}):null,r&&r.gapList.length>0?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`button`,{type:`button`,className:`oc-bridge-provider__sub oc-bridge-provider__sub--toggle`,"aria-expanded":t,onClick:()=>n(e=>!e),children:[t?(0,Z.jsx)(D,{size:13,"aria-hidden":!0}):(0,Z.jsx)(A,{size:13,"aria-hidden":!0}),Ne({count:r.gapList.length})]}),t?(0,Z.jsx)(`ul`,{className:`oc-bridge-protocol__list`,role:`list`,children:r.gapList.map(e=>(0,Z.jsx)(`li`,{children:(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:e})},e))}):null]}):null]})}function an({support:e,compatStatus:t,compatReachable:n,manifest:r,instanceRows:i}){return t===`loading`?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:w()}):t===`nodata`?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:ue()}):(0,Z.jsxs)(`div`,{className:`oc-compat`,children:[n?null:(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:ie()}),r===null?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:re()}):(0,Z.jsxs)(`div`,{className:`oc-compat__support`,children:[(0,Z.jsx)(`span`,{className:`oc-compat__label`,children:Pe()}),e&&e.range!==null?(0,Z.jsx)(`span`,{children:a({min:e.range.min,max:e.range.maxValidated})}):(0,Z.jsx)(`span`,{children:b()}),e?(0,Z.jsx)(cn,{versions:e.validatedVersions}):null]}),i.length===0?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:u()}):(0,Z.jsx)(`div`,{className:`oc-compat__targets`,children:i.map(e=>(0,Z.jsxs)(`div`,{className:`oc-compat__target`,children:[(0,Z.jsx)(`span`,{className:`oc-compat__instance`,children:e.displayName}),(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:U(e.version)}),(0,Z.jsx)(N,{variant:e.state===`supported`?`secondary`:e.state===`beyond`?`destructive`:`outline`,children:Ot(e.state)})]},e.instanceName))})]})}function on({instance:e,onClose:t}){return(0,Z.jsx)(ft,{open:!0,onOpenChange:e=>!e&&t(),children:(0,Z.jsxs)(lt,{className:`oc-bridge-config-dialog`,onOpenAutoFocus:e=>e.preventDefault(),children:[(0,Z.jsxs)(bt,{children:[(0,Z.jsx)(St,{children:Ve({instance:e.displayName??e.name})}),(0,Z.jsx)(vt,{children:we()})]}),(0,Z.jsx)(sn,{instance:e,onClose:t})]})})}function $({label:e,result:t}){return t?t.checked?(0,Z.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,Z.jsx)(I,{"aria-hidden":!0}):(0,Z.jsx)(L,{"aria-hidden":!0}),(0,Z.jsxs)(`span`,{children:[e,` — `,t.ok?Le():t.detail]})]}):(0,Z.jsxs)(`p`,{className:`oc-bridge-config__check-row oc-bridge-config__check-row--skip`,children:[e,` — `,He()]}):null}function sn({instance:e,onClose:t}){let n=Ze(T.admin.upsertInstanceConfig),i=fe(T.bridge.validateMediaPaths),a=ut(),[o,s]=(0,K.useState)(()=>at(e.config??{})),[l,u]=(0,K.useState)(!1),[d,f]=(0,K.useState)(!1),[p,m]=(0,K.useState)(null),h=o.inboundMediaMode===`shared-fs`,g=o.mediaMode===`shared-fs`,_=h||g;async function te(){f(!0),m(null);try{m(await i({instanceName:e.name,inboundMediaMode:o.inboundMediaMode,mediaMode:o.mediaMode}))}catch(e){a.error(Xe(),e)}finally{f(!1)}}async function v(){u(!0);try{let r=e.config??{};await n({instanceId:e._id,config:st(o,r)}),t()}catch(e){a.error(ce(),e)}finally{u(!1)}}return(0,Z.jsx)(`div`,{className:`oc-bridge-config`,children:(0,Z.jsxs)(`div`,{className:`oc-bridge-config__form`,children:[(0,Z.jsxs)(`div`,{className:`oc-bridge-config__grid`,children:[(0,Z.jsxs)(`label`,{className:`oc-field`,children:[(0,Z.jsx)(O,{label:Ge(),help:be()}),(0,Z.jsxs)(z,{value:o.mediaMode,onValueChange:e=>s({...o,mediaMode:e}),children:[(0,Z.jsx)(M,{size:`sm`,className:`w-full`,children:(0,Z.jsx)(j,{})}),(0,Z.jsx)(F,{children:ct.map(e=>(0,Z.jsx)(R,{value:e,children:e},e))})]})]}),(0,Z.jsxs)(`label`,{className:`oc-field`,children:[(0,Z.jsx)(O,{label:ze(),help:_e()}),(0,Z.jsxs)(z,{value:o.inboundMediaMode,onValueChange:e=>s({...o,inboundMediaMode:e}),children:[(0,Z.jsx)(M,{size:`sm`,className:`w-full`,children:(0,Z.jsx)(j,{})}),(0,Z.jsx)(F,{children:ot.map(e=>(0,Z.jsx)(R,{value:e,children:e},e))})]})]}),(0,Z.jsxs)(`label`,{className:`oc-field`,children:[(0,Z.jsx)(O,{label:Je(),help:Ue()}),(0,Z.jsx)(P,{type:`number`,min:1,max:4096,className:`w-full`,value:o.mediaMaxMb,onChange:e=>s({...o,mediaMaxMb:Math.trunc(Number(e.target.value)||0)})})]})]}),_&&(0,Z.jsxs)(`div`,{className:`oc-bridge-config__grid`,children:[h&&(0,Z.jsxs)(`label`,{className:`oc-field`,children:[(0,Z.jsx)(O,{label:Qe(),help:c()}),(0,Z.jsx)(P,{className:`w-full`,spellCheck:!1,value:o.inboundAgentMount,onChange:e=>s({...o,inboundAgentMount:e.target.value})})]}),g&&(0,Z.jsxs)(`label`,{className:`oc-field`,children:[(0,Z.jsx)(O,{label:pe(),help:$e()}),(0,Z.jsx)(P,{className:`w-full`,spellCheck:!1,value:o.outboundAgentMount,onChange:e=>s({...o,outboundAgentMount:e.target.value})})]})]}),(0,Z.jsxs)(`label`,{className:`oc-field--row`,children:[(0,Z.jsx)(gt,{checked:o.rehydration,onCheckedChange:e=>s({...o,rehydration:e===!0})}),(0,Z.jsx)(O,{label:ke(),help:ee()})]}),_&&p!==null&&(0,Z.jsx)(`div`,{className:`oc-bridge-config__check`,children:p.reachable?!p.inbound&&!p.outbound?(0,Z.jsxs)(`p`,{className:`oc-bridge-config__check-row oc-bridge-config__check-row--err`,children:[(0,Z.jsx)(L,{"aria-hidden":!0}),De({reason:p.reason??`?`})]}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)($,{label:je(),result:p.inbound}),(0,Z.jsx)($,{label:Me(),result:p.outbound}),(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:Se()})]}):(0,Z.jsxs)(`p`,{className:`oc-bridge-config__check-row oc-bridge-config__check-row--err`,children:[(0,Z.jsx)(L,{"aria-hidden":!0}),Ae()]})}),(0,Z.jsxs)(`div`,{className:`oc-bridge-config__actions`,children:[_&&(0,Z.jsxs)(k,{variant:`outline`,size:`sm`,onClick:()=>void te(),disabled:d,children:[d?(0,Z.jsx)(pt,{className:`size-4 animate-spin`,"aria-hidden":!0}):null,d?et():Te()]}),(0,Z.jsx)(k,{size:`sm`,onClick:()=>void v(),disabled:l,children:r()})]})]})})}function cn({versions:e}){if(e.length===0)return null;let t=[...e].reverse();return(0,Z.jsxs)(ht,{children:[(0,Z.jsx)(mt,{asChild:!0,children:(0,Z.jsxs)(`button`,{type:`button`,className:`oc-compat__versions-btn`,children:[e.length===1?Fe():oe({count:e.length}),(0,Z.jsx)(D,{size:13,"aria-hidden":!0})]})}),(0,Z.jsxs)(dt,{className:`oc-compat__versions-pop`,align:`start`,children:[(0,Z.jsx)(`p`,{className:`oc-compat__versions-title`,children:l()}),(0,Z.jsx)(`div`,{className:`oc-compat__versions-list`,children:t.map(e=>(0,Z.jsx)(N,{variant:`secondary`,children:e},e))})]})]})}export{en as BridgeTab,on as InstanceConfigDialog};
@@ -1 +0,0 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Br as r,GD as i,Gr as a,Hr as o,IS as s,Jr as c,Kr as l,Oi as u,Qr as d,S as f,SO as p,TO as m,Ur as ee,Vr as te,Wr as h,Xr as ne,Yr as g,Zr as re,aa as _,b as v,fa as y,if as b,oa as ie,qr as ae,ua as oe,vO as x,wO as S,x as C}from"./dist-DRXIQewX.js";import{t as w}from"./button-CrkRjd-T.js";import{A as se,B as ce,C as le,F as ue,I as de,L as fe,N as pe,P as me,R as he,S as ge,Z as T,b as E,g as D,h as O,mt as k,v as A,x as j,y as M,z as N}from"./index-DcMWPy01.js";import{i as P}from"./compatView-BiLj8anr.js";/* empty css */var F=t(e(),1),I=[`off`,`minimal`,`low`,`medium`,`high`,`xhigh`];function L(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 R=n();function _e({instance:e}){let t=S(x.admin.upsertInstanceConfig),n=typeof e.config?.summarizeThresholdChars==`number`?e.config.summarizeThresholdChars:null,[r,i]=(0,F.useState)(n===null?``:String(n)),[o,s]=(0,F.useState)(`idle`);(0,F.useEffect)(()=>{i(n===null?``:String(n)),s(`idle`)},[e._id,n]);let c=r.trim(),u=c===``?null:/^\d+$/.test(c)?Number.parseInt(c,10):NaN,d=u===null||Number.isInteger(u)&&u>=1e3&&u<=2e5,p=(u??null)!==n;async function m(){s(`saving`);try{let n={...e.config??{}};u===null?delete n.summarizeThresholdChars:n.summarizeThresholdChars=u,await t({instanceId:e._id,config:n}),s(`done`)}catch{s(`error`)}}return(0,R.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,R.jsx)(`span`,{className:`oc-cdefaults__label`,children:f()}),(0,R.jsxs)(`div`,{className:`oc-cdefaults__inline`,children:[(0,R.jsx)(T,{type:`number`,min:1e3,max:2e5,step:1e3,placeholder:`8000`,value:r,onChange:e=>i(e.target.value),className:`oc-cdefaults__number`,"aria-invalid":!d}),(0,R.jsx)(w,{size:`sm`,disabled:!p||!d||o===`saving`,onClick:()=>void m(),children:o===`saving`?y():l()})]}),d?null:(0,R.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:v()}),o===`done`?(0,R.jsx)(`p`,{className:`oc-admin__hint`,role:`status`,children:a()}):null,o===`error`?(0,R.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:h()}):null,(0,R.jsx)(`p`,{className:`oc-cdefaults__help`,children:C()})]})}function z(){let e=p(x.agentFiles.getChatDefaults),t=p(x.agentFiles.setChatDefaults),n=se(),[f,v]=(0,F.useState)({status:`loading`}),[S,C]=(0,F.useState)({thinkingDefault:null,fastModeDefault:null}),[T,z]=(0,F.useState)(!1),[B,V]=(0,F.useState)(!1),H=m(x.admin.listInstances,{}),[U,W]=(0,F.useState)(null);(0,F.useEffect)(()=>{!H||H.length===0||(!U||!H.some(e=>e.name===U))&&W(H[0].name)},[H,U]);let G=(H?.length??0)>1,ve=H!==void 0&&H.length===0,ye=m(x.compat.forInstance,U?{instanceName:U}:`skip`),K=U?A(ye,`configDefaults`):`loading`,q=K===`loading`?null:K.blocked,J=(0,F.useMemo)(()=>G&&U?{instanceName:U}:{},[G,U]),Y=(0,F.useRef)(0),X=(0,F.useCallback)(async()=>{let t=++Y.current;v({status:`loading`});try{let n=L(await e(J));if(Y.current!==t)return;v({status:`done`,current:n}),C(n)}catch{if(Y.current!==t)return;v({status:`error`})}},[e,J]);(0,F.useEffect)(()=>{q===!1&&(G&&!U||X())},[X,q,G,U]);let Z=f.status===`done`?f.current:null,Q=Z!==null&&S.thinkingDefault!==null&&S.thinkingDefault!==Z.thinkingDefault,$=Z!==null&&S.fastModeDefault!==null&&S.fastModeDefault!==Z.fastModeDefault,be=Q||$;async function xe(){V(!0);try{await t({...J,...Q?{thinkingDefault:S.thinkingDefault}:{},...$?{fastModeDefault:S.fastModeDefault}:{}}),n.success(a()),await X()}catch(e){n.error(h(),e)}finally{V(!1)}}let Se=(0,F.useMemo)(()=>I.map(e=>({id:e,label:D(e)})),[]),Ce=(0,F.useMemo)(()=>[{id:`fast`,label:ie()},{id:`standard`,label:_()}],[]);return(0,R.jsxs)(`div`,{className:`oc-cdefaults`,children:[(0,R.jsx)(`p`,{className:`oc-admin__hint`,children:d()}),G&&U?(0,R.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,R.jsx)(`span`,{className:`oc-cdefaults__label`,children:u()}),(0,R.jsxs)(M,{value:U,onValueChange:e=>W(e),disabled:B,children:[(0,R.jsx)(ge,{size:`sm`,"aria-label":u(),children:(0,R.jsx)(le,{})}),(0,R.jsx)(E,{children:(H??[]).map(e=>(0,R.jsx)(j,{value:e.name,children:e.name},e.name))})]})]}):null,ve?(0,R.jsx)(`p`,{className:`oc-admin__hint`,role:`status`,children:b()}):K===`loading`?(0,R.jsx)(`p`,{className:`oc-admin__hint`,children:i()}):K.blocked?(0,R.jsxs)(`p`,{className:`oc-compat__blocked`,role:`status`,children:[(0,R.jsx)(k,{size:14,"aria-hidden":!0}),` `,P(K.gatewayVersion)]}):f.status===`loading`?(0,R.jsx)(`p`,{className:`oc-admin__hint`,children:i()}):f.status===`error`?(0,R.jsxs)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:[ae(),` `,(0,R.jsx)(w,{variant:`outline`,size:`sm`,onClick:()=>void X(),children:oe()})]}):(0,R.jsxs)(R.Fragment,{children:[(0,R.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,R.jsx)(`span`,{className:`oc-cdefaults__label`,children:re()}),(0,R.jsx)(O,{options:Se,value:S.thinkingDefault,onChange:e=>C({...S,thinkingDefault:e}),disabled:B}),(0,R.jsx)(`p`,{className:`oc-cdefaults__help`,children:ne()})]}),(0,R.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,R.jsx)(`span`,{className:`oc-cdefaults__label`,children:g()}),(0,R.jsx)(O,{options:Ce,value:S.fastModeDefault===null?null:S.fastModeDefault?`fast`:`standard`,onChange:e=>C({...S,fastModeDefault:e===`fast`}),disabled:B}),(0,R.jsx)(`p`,{className:`oc-cdefaults__help`,children:c()})]}),(0,R.jsx)(`div`,{className:`oc-cdefaults__actions`,children:(0,R.jsx)(w,{size:`sm`,disabled:!be||B,onClick:()=>z(!0),children:B?y():l()})}),(0,R.jsx)(`p`,{className:`oc-cdefaults__note`,children:ee()})]}),(()=>{let e=H?.find(e=>e.name===(U??H[0]?.name));return e?(0,R.jsx)(_e,{instance:e}):null})(),(0,R.jsx)(pe,{open:T,onOpenChange:z,children:(0,R.jsxs)(de,{children:[(0,R.jsxs)(N,{children:[(0,R.jsx)(ce,{children:o()}),(0,R.jsx)(fe,{children:te()})]}),(0,R.jsxs)(he,{children:[(0,R.jsx)(ue,{children:s()}),(0,R.jsx)(me,{onClick:()=>void xe(),children:r()})]})]})})]})}export{z as ChatDefaultsTab};
@@ -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,Cv as o,Dv as s,Ev as c,Fv as l,Gv as u,Hv as d,Iv as f,Jv as p,Kv as m,Lv as h,Mv as g,Nv as _,Ov as ee,Pv as te,Qv as v,Rv as ne,Sv as re,TO as ie,Tv as ae,Uv as oe,Vv as y,Wv as b,Xv as x,Yv as S,Zv as C,_v as w,ay as T,bv as E,cy as D,dy as O,ey as k,fy as A,gv as j,hv as M,iy as N,jv as P,kv as F,ly as I,mv as L,my as R,ny as se,oy as z,pv as B,py as V,qv as H,ry as U,sy as W,ty as G,uy as K,vO as q,vv as ce,wO as J,wv as le,xv as ue,yv as de,zv as fe}from"./dist-DRXIQewX.js";import{t as pe}from"./button-CrkRjd-T.js";import{j as me}from"./index-DcMWPy01.js";import{t as he}from"./DataTableShell-CJHDSNd8.js";var Y=t(e(),1),X=n(),Z={altered_words:()=>R(),incorrect:()=>V(),incoherence:()=>A(),formatting:()=>O(),latency:()=>K(),api_error:()=>I(),other:()=>D()},Q=e=>Z[e]?.()??e;function $({matches:e,sourceWasOpen:t}){return t?e===!0?(0,X.jsx)(`span`,{className:`oc-fbadmin__pill is-ok`,children:z()}):e===!1?(0,X.jsx)(`span`,{className:`oc-fbadmin__pill is-warn`,children:T()}):(0,X.jsx)(`span`,{className:`oc-fbadmin__pill`,children:`—`}):(0,X.jsx)(`span`,{className:`oc-fbadmin__pill`,children:W()})}function ge({data:e,closeReason:t}){let n=e.snapshot,i=J(q.feedback.respondToFeedback),[o,s]=(0,Y.useState)(e.thread),[c,l]=(0,Y.useState)(``),[f,h]=(0,Y.useState)(!1);async function g(){let t=c.trim();if(!(!t||f)){h(!0);try{await i({feedbackId:e._id,text:t}),s(e=>[...e,{authorRole:`admin`,text:t,at:Date.now()}]),l(``)}finally{h(!1)}}}let _=[];try{_=n.contextJson?JSON.parse(n.contextJson):[]}catch{_=[]}return(0,X.jsxs)(`div`,{className:`oc-fbadmin__detail`,children:[(0,X.jsxs)(`div`,{className:`oc-fbadmin__row`,children:[(0,X.jsx)($,{matches:n.displayedMatchesStored,sourceWasOpen:n.clientInfo?.sourceWasOpen??!1}),(0,X.jsxs)(`span`,{className:`oc-fbadmin__meta`,children:[Q(e.category),` · `,n.messageRole,n.isRegeneration?` · ${N()}`:``,n.openclawModel?` · ${n.openclawModel}`:``,n.openclawRuntime?` (${n.openclawRuntime})`:``]})]}),e.comment?(0,X.jsxs)(`section`,{children:[(0,X.jsx)(`h4`,{className:`oc-fbadmin__h`,children:U()}),(0,X.jsx)(`p`,{className:`oc-fbadmin__comment`,children:e.comment})]}):null,t?(0,X.jsxs)(`section`,{children:[(0,X.jsx)(`h4`,{className:`oc-fbadmin__h`,children:de()}),(0,X.jsx)(`p`,{className:`oc-fbadmin__comment`,children:t})]}):null,(0,X.jsxs)(`section`,{children:[(0,X.jsx)(`h4`,{className:`oc-fbadmin__h`,children:se()}),o.length>0?(0,X.jsx)(`div`,{className:`oc-fbadmin__thread`,children:o.map((e,t)=>(0,X.jsxs)(`div`,{className:`oc-notif__msg oc-notif__msg--${e.authorRole}`,children:[(0,X.jsx)(`span`,{className:`oc-notif__msg-who`,children:e.authorRole===`admin`?G():k()}),(0,X.jsx)(`span`,{className:`oc-notif__msg-text`,children:e.text})]},t))}):(0,X.jsx)(`p`,{className:`oc-fbadmin__meta`,children:r()}),(0,X.jsx)(`textarea`,{className:`oc-feedback__textarea`,placeholder:v(),value:c,maxLength:2e3,rows:3,onChange:e=>l(e.target.value.slice(0,2e3))}),(0,X.jsx)(`div`,{className:`oc-fbadmin__row`,style:{justifyContent:`flex-end`},children:(0,X.jsx)(pe,{size:`sm`,onClick:()=>void g(),disabled:!c.trim()||f,children:f?C():x()})})]}),(0,X.jsxs)(`section`,{children:[(0,X.jsx)(`h4`,{className:`oc-fbadmin__h`,children:S()}),(0,X.jsx)(`pre`,{className:`oc-msg__source-pre`,children:n.messageText||p()})]}),n.clientInfo?.sourceWasOpen&&n.displayedText!==void 0?(0,X.jsxs)(`section`,{children:[(0,X.jsx)(`h4`,{className:`oc-fbadmin__h`,children:H()}),(0,X.jsx)(`pre`,{className:`oc-msg__source-pre`,children:n.displayedText||p()})]}):null,n.promptText?(0,X.jsxs)(`section`,{children:[(0,X.jsx)(`h4`,{className:`oc-fbadmin__h`,children:m()}),(0,X.jsx)(`pre`,{className:`oc-msg__source-pre`,children:n.promptText})]}):null,_.length>0?(0,X.jsxs)(`section`,{children:[(0,X.jsx)(`h4`,{className:`oc-fbadmin__h`,children:u({count:n.contextCount??_.length,truncated:n.contextTruncated?b():``})}),(0,X.jsx)(`div`,{className:`oc-fbadmin__ctx`,children:_.map((e,t)=>(0,X.jsxs)(`div`,{className:`oc-fbadmin__ctx-turn`,children:[(0,X.jsx)(`span`,{className:`oc-fbadmin__ctx-role`,children:e.role}),(0,X.jsx)(`span`,{className:`oc-fbadmin__ctx-text`,children:e.text})]},t))})]}):null,n.outboxAvailable?(0,X.jsxs)(`section`,{children:[(0,X.jsx)(`h4`,{className:`oc-fbadmin__h`,children:oe()}),(0,X.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,X.jsxs)(`section`,{children:[(0,X.jsx)(`h4`,{className:`oc-fbadmin__h`,children:d()}),(0,X.jsx)(`div`,{className:`oc-fbadmin__row`,children:n.clientInfo.extensionsDetected.map(e=>(0,X.jsx)(`span`,{className:`oc-fbadmin__pill is-warn`,children:e},e))})]}):null,(0,X.jsxs)(`section`,{children:[(0,X.jsx)(`h4`,{className:`oc-fbadmin__h`,children:y()}),(0,X.jsxs)(`p`,{className:`oc-fbadmin__env`,children:[[n.clientInfo?.language,n.clientInfo?.timezone,n.clientInfo?.theme?a({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,X.jsxs)(`span`,{className:`oc-fbadmin__plugins`,children:[fe(),` `,n.clientInfo.plugins.join(`, `),(0,X.jsxs)(`span`,{className:`oc-fbadmin__note`,children:[` `,ne()]})]}):null,n.clientInfo?.userAgent?(0,X.jsx)(`span`,{className:`oc-fbadmin__ua`,children:n.clientInfo.userAgent}):null]})]})]})}function _e(){let e=ie(q.feedback.listForAdmin,{}),t=J(q.feedback.readSnapshot),n=J(q.feedback.deleteFeedback),r=me(),[a,u]=(0,Y.useState)(null),[d,p]=(0,Y.useState)({});async function m(e){if(a===e._id){u(null);return}if(!d[e._id]){let n=await t({feedbackId:e._id});p(t=>({...t,[e._id]:n}))}u(e._id)}async function v(e){await r({title:M(),description:L(),confirmLabel:B(),destructive:!0})&&(await n({feedbackId:e._id}),a===e._id&&u(null))}return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`p`,{className:`oc-admin__hint`,children:[h(),` `,(0,X.jsx)(`strong`,{children:f()}),` `,l()]}),(0,X.jsx)(he,{title:te(),rows:e,emptyHint:_(),isExpanded:e=>a===e._id&&!!d[e._id],renderExpanded:e=>d[e._id]?(0,X.jsx)(ge,{data:d[e._id],closeReason:e.userCloseReason}):null,columns:[{header:g(),cell:e=>new Date(e.at).toLocaleString(`fr-FR`),sort:e=>e.at},{header:P(),cell:e=>Q(e.category),sort:e=>Q(e.category)},{header:i(),cell:e=>e.messageRole===`user`?F():ee(),sort:e=>e.messageRole},{header:s(),cell:e=>(e.reporterEmail||e.reporterName||`—`)+(e.impersonated&&e.realOperatorEmail?` ${c({operator:e.realOperatorEmail})}`:``),sort:e=>e.reporterEmail||e.reporterName||null},{header:ae(),cell:e=>(0,X.jsx)($,{matches:e.displayedMatchesStored,sourceWasOpen:e.sourceWasOpen}),sort:e=>e.displayedMatchesStored===!1?0:e.displayedMatchesStored===!0?1:2},{header:le(),cell:e=>e.hasComment?`✎`:`—`,sort:e=>+!!e.hasComment},{header:o(),cell:e=>e.userClosedAt==null?e.answered?(0,X.jsx)(`span`,{className:`oc-fbadmin__pill is-ok`,children:re()}):(0,X.jsx)(`span`,{className:`oc-fbadmin__pill`,children:ue()}):(0,X.jsx)(`span`,{className:`oc-fbadmin__pill is-closed`,children:E()}),sort:e=>e.userClosedAt==null?+!!e.answered:2}],rowActions:e=>[{label:a===e._id?ce():w(),onSelect:()=>void m(e)},{label:j(),onSelect:()=>void v(e),variant:`destructive`}]})]})}export{_e as FeedbacksTab};
@@ -1 +0,0 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$E as r,CD as ee,GD as te,GE as ne,HE as re,IS as ie,JE as ae,KE as i,QE as a,SD as o,TO as s,UE as c,WE as l,XE as u,YE as d,ZE as oe,_D as se,aD as ce,bD as f,cD as p,dD as m,eD as le,fD as h,gD as ue,hD as de,iD as fe,lD as g,mD as pe,nD as me,oD as _,pD as he,qD as ge,qE as _e,rD as ve,sD as v,tD as y,uD as b,vD as x,vO as S,wO as C,xD as w,yD as T}from"./dist-DRXIQewX.js";import{t as E}from"./button-CrkRjd-T.js";import{A as D,B as O,C as k,Et as A,F as j,G as M,I as N,K as P,L as F,N as ye,P as be,R as xe,S as I,Tt as Se,W as Ce,X as we,Y as Te,b as L,ht as Ee,x as R,y as z,yt as De,z as Oe}from"./index-DcMWPy01.js";import{a as ke,i as B,n as Ae,o as V,r as H,t as je}from"./table-3aSLasBW.js";var U=t(e(),1),W=n(),G=`all`;function K(e){switch(e){case`image`:return h();case`audio`:return m();case`video`:return b();case`pdf`:return g();case`document`:return p();case`archive`:return v();default:return _()}}function q(){let[e,t]=(0,U.useState)(G),[n,p]=(0,U.useState)(G),[m,h]=(0,U.useState)(G),[g,_]=(0,U.useState)(G),[v,b]=(0,U.useState)(null),q=C(S.files.softDelete),J=D();function Me(){t(G),p(G),h(G),_(G)}async function Ne(){let e=v;if(b(null),e)try{await q({fileId:e.id}),J.success(d())}catch(e){J.error(ae(),e)}}let Y=s(S.files.listMine,{direction:e===G?void 0:e,chatId:n===G?void 0:n,instanceName:m===G?void 0:m,category:g===G?void 0:g}),X=(0,U.useMemo)(()=>new Intl.DateTimeFormat(ge(),{dateStyle:`medium`,timeStyle:`short`}),[]);if(Y===void 0)return(0,W.jsx)(`p`,{className:`oc-admin__hint`,children:te()});let{files:Z,facets:Q,truncated:Pe,cap:Fe}=Y,$=e!==G||n!==G||m!==G||g!==G;return(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`p`,{className:`oc-admin__hint`,children:ee()}),(0,W.jsxs)(`div`,{className:`oc-files__filters`,style:{display:`flex`,flexWrap:`wrap`,gap:8,margin:`12px 0`},children:[(0,W.jsxs)(z,{value:e,onValueChange:t,children:[(0,W.jsx)(I,{size:`sm`,"aria-label":o(),children:(0,W.jsx)(k,{})}),(0,W.jsxs)(L,{children:[(0,W.jsx)(R,{value:G,children:w()}),(0,W.jsx)(R,{value:`inbound`,children:f()}),(0,W.jsx)(R,{value:`outbound`,children:T()})]})]}),(0,W.jsxs)(z,{value:n,onValueChange:p,children:[(0,W.jsx)(I,{size:`sm`,"aria-label":x(),children:(0,W.jsx)(k,{})}),(0,W.jsxs)(L,{children:[(0,W.jsx)(R,{value:G,children:se()}),Q.chats.map(e=>(0,W.jsx)(R,{value:e.id,children:e.title},e.id))]})]}),Q.multiProvider?(0,W.jsxs)(z,{value:m,onValueChange:h,children:[(0,W.jsx)(I,{size:`sm`,"aria-label":ue(),children:(0,W.jsx)(k,{})}),(0,W.jsxs)(L,{children:[(0,W.jsx)(R,{value:G,children:de()}),Q.instances.map(e=>(0,W.jsx)(R,{value:e,children:e},e))]})]}):null,(0,W.jsxs)(z,{value:g,onValueChange:_,children:[(0,W.jsx)(I,{size:`sm`,"aria-label":pe(),children:(0,W.jsx)(k,{})}),(0,W.jsxs)(L,{children:[(0,W.jsx)(R,{value:G,children:he()}),Q.categories.map(e=>(0,W.jsx)(R,{value:e,children:K(e)},e))]})]}),$?(0,W.jsxs)(E,{variant:`ghost`,size:`sm`,onClick:Me,style:{display:`inline-flex`,alignItems:`center`,gap:4,marginLeft:`auto`},children:[(0,W.jsx)(De,{size:14,"aria-hidden":!0}),a()]}):null]}),Z.length===0?(0,W.jsx)(`p`,{className:`oc-admin__hint`,children:$?c():l()}):(0,W.jsxs)(W.Fragment,{children:[(0,W.jsxs)(je,{children:[(0,W.jsx)(ke,{children:(0,W.jsxs)(V,{children:[(0,W.jsx)(B,{children:ce()}),(0,W.jsx)(B,{children:fe()}),(0,W.jsx)(B,{children:ve()}),(0,W.jsx)(B,{children:me()}),(0,W.jsx)(B,{children:y()}),(0,W.jsx)(B,{className:`text-right`,children:le()})]})}),(0,W.jsx)(Ae,{children:Z.map(e=>(0,W.jsxs)(V,{children:[(0,W.jsx)(H,{className:`font-medium`,style:{maxWidth:280,overflow:`hidden`,textOverflow:`ellipsis`},title:e.filename,children:e.filename}),(0,W.jsx)(H,{title:e.mimeType,children:K(e.category)}),(0,W.jsx)(H,{children:(0,W.jsx)(we,{variant:`secondary`,children:e.direction===`inbound`?f():T()})}),(0,W.jsx)(H,{style:{maxWidth:220,overflow:`hidden`,textOverflow:`ellipsis`},title:e.chatTitle,children:e.chatTitle}),(0,W.jsx)(H,{className:`whitespace-nowrap text-muted-foreground`,children:X.format(e.createdAt)}),(0,W.jsx)(H,{className:`text-right`,children:(0,W.jsxs)(Ce,{children:[(0,W.jsx)(Te,{asChild:!0,children:(0,W.jsx)(E,{variant:`ghost`,size:`icon`,"aria-label":oe(),children:(0,W.jsx)(Se,{size:16})})}),(0,W.jsxs)(M,{align:`end`,children:[e.url?(0,W.jsx)(P,{asChild:!0,children:(0,W.jsxs)(`a`,{href:e.url,download:e.filename,target:`_blank`,rel:`noopener noreferrer`,children:[(0,W.jsx)(A,{size:14}),r()]})}):(0,W.jsxs)(P,{disabled:!0,children:[(0,W.jsx)(A,{size:14}),ne()]}),(0,W.jsxs)(P,{variant:`destructive`,onSelect:()=>b({id:e._id,filename:e.filename}),children:[(0,W.jsx)(Ee,{size:14}),u()]})]})]})})]},e._id))})]}),Pe?(0,W.jsx)(`p`,{className:`oc-admin__hint`,style:{marginTop:8},children:re({cap:Fe})}):null]}),(0,W.jsx)(ye,{open:v!==null,onOpenChange:e=>!e&&b(null),children:(0,W.jsxs)(N,{children:[(0,W.jsxs)(Oe,{children:[(0,W.jsx)(O,{children:_e()}),(0,W.jsx)(F,{children:i()})]}),(0,W.jsxs)(xe,{children:[(0,W.jsx)(j,{children:ie()}),(0,W.jsx)(be,{onClick:()=>void Ne(),children:u()})]})]})})]})}export{q as FilesTab};
@@ -1 +0,0 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$a as r,Aa as i,Ao as a,Ba as o,Co as s,Da as c,Do as l,Ea as u,Eo as d,Fa as f,Ga as p,Ha as m,Ia as h,Ja as g,Ka as _,La as v,Ma as y,Mo as b,Na as x,No as ee,Oa as S,Oo as C,Pa as w,Qa as T,Ra as E,So as te,TO as D,Ta as O,To as k,Ua as A,Va as j,Wa as ne,Xa as re,Ya as M,Za as ie,_o as N,ao as ae,bo as oe,co as se,do as ce,eo as P,fo as le,go as ue,ho as de,io as F,ja as fe,jo as pe,ka as me,ko as he,lo as ge,mo as _e,no as ve,oo as ye,po as be,qa as xe,ro as Se,so as Ce,to as we,uo as Te,vO as I,vo as Ee,wO as L,wa as R,wo as De,xo as Oe,yO as z,yo as ke,za as Ae}from"./dist-DRXIQewX.js";import{t as je}from"./x-1RyayDYu.js";import{i as B,n as V,r as Me,t as Ne}from"./tabs-JwsMaDCr.js";import{t as H}from"./button-CrkRjd-T.js";import{$ as Pe,A as U,At as Fe,C as Ie,Q as Le,S as Re,X as W,Z as G,_ as K,_t as q,b as ze,et as Be,gt as J,j as Ve,m as He,nt as Ue,ot as We,rt as Ge,x as Ke,y as qe}from"./index-DcMWPy01.js";import{t as Je}from"./FilterBar-DR1-M_rz.js";import{t as Ye}from"./DataTableShell-CJHDSNd8.js";import{t as Y}from"./DetailChips-DZXcy4x8.js";var Xe=z(`chevron-left`,[[`path`,{d:`m15 18-6-6 6-6`,key:`1wnfg3`}]]),Ze=z(`palette`,[[`path`,{d:`M12 22a1 1 0 0 1 0-20 10 9 0 0 1 10 9 5 5 0 0 1-5 5h-2.25a1.75 1.75 0 0 0-1.4 2.8l.3.4a1.75 1.75 0 0 1-1.4 2.8z`,key:`e79jfc`}],[`circle`,{cx:`13.5`,cy:`6.5`,r:`.5`,fill:`currentColor`,key:`1okk4w`}],[`circle`,{cx:`17.5`,cy:`10.5`,r:`.5`,fill:`currentColor`,key:`f64h9f`}],[`circle`,{cx:`6.5`,cy:`12.5`,r:`.5`,fill:`currentColor`,key:`qy21gx`}],[`circle`,{cx:`8.5`,cy:`7.5`,r:`.5`,fill:`currentColor`,key:`fotxhn`}]]),X=z(`shield-check`,[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`,key:`oel41y`}],[`path`,{d:`m9 12 2 2 4-4`,key:`dzmm74`}]]),Qe=z(`users`,[[`path`,{d:`M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2`,key:`1yyitq`}],[`path`,{d:`M16 3.128a4 4 0 0 1 0 7.744`,key:`16gr8j`}],[`path`,{d:`M22 21v-2a4 4 0 0 0-3-3.87`,key:`kshegd`}],[`circle`,{cx:`9`,cy:`7`,r:`4`,key:`nufk8`}]]),Z=t(e(),1);function $e(e,t,n){let r=t.trim().toLowerCase();return[...r?e.filter(e=>[e.email,e.name,e.canonical].some(e=>e!=null&&e.toLowerCase().includes(r))):e.slice()].sort((e,t)=>!n.has(e.userId)-+!n.has(t.userId))}function et(e,t){let n=e.filter(e=>e.source===`discovered`),r=t.trim().toLowerCase();return r?n.filter(e=>(e.displayName??e.agentId).toLowerCase().includes(r)||e.agentId.toLowerCase().includes(r)):n}function tt(e){let t=e.name?.trim()??``,n=e.email?.trim()??``,r=e.canonical?.trim()||`u-${e.userId.slice(0,8)}`;return t?{primary:t,secondary:n||`@${r}`}:n?{primary:n,secondary:null}:{primary:`@${r}`,secondary:null}}function nt(e){switch(e){case`admin`:return P();case`user`:return r();case`pending`:return T();default:return e}}function rt(e,t){if(e.length===0)return`none`;let n=0;for(let r of e)t(r)&&n++;return n===0?`none`:n===e.length?`all`:`some`}function it(e,t,n){let r=Math.max(1,Math.ceil(e.length/n)),i=Math.min(Math.max(1,Math.floor(t)),r),a=(i-1)*n;return{pageItems:e.slice(a,a+n),page:i,pageCount:r}}var Q=n(),$={name:``,description:``};function at(){let e=D(I.groups.listGroups,{}),t=D(I.me.getMe,{host:We})?.role===`admin`,n=L(I.groups.createGroup),r=L(I.groups.updateGroup),i=L(I.groups.deleteGroup),o=Ve(),f=U(),[p,m]=(0,Z.useState)(!1),[h,g]=(0,Z.useState)(null),[_,v]=(0,Z.useState)($),[y,x]=(0,Z.useState)(null),[S,w]=(0,Z.useState)(``),T=(0,Z.useMemo)(()=>{if(!e)return e;let t=S.trim().toLowerCase();return t?e.filter(e=>e.name.toLowerCase().includes(t)||(e.description??``).toLowerCase().includes(t)||e.members.some(e=>e.label.toLowerCase().includes(t))||e.agents.some(e=>e.toLowerCase().includes(t))||e.charts.some(e=>e.name.toLowerCase().includes(t))):e},[e,S]);function E(){g(null),v($),m(!0)}function O(e){g(e),v({name:e.name,description:e.description??``}),m(!0)}async function A(){try{h?await r({groupId:h._id,name:_.name,description:_.description}):await n({name:_.name,description:_.description||void 0}),v($),g(null),m(!1)}catch(e){f.error(c(),e)}}async function j(e){if(await o({title:_e({name:e.name}),description:be(),confirmWord:e.name,confirmLabel:le(),cancelLabel:oe(),destructive:!0}))try{await i({groupId:e._id})}catch(e){f.error(u(),e)}}return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:b()}),(0,Q.jsx)(Je,{q:S,onQChange:w,onReset:()=>w(``),canReset:S!==``,searchPlaceholder:k()}),(0,Q.jsx)(Ye,{title:ee(),rows:T,addLabel:pe(),onAdd:t?E:void 0,emptyHint:a(),columns:[{header:he(),cell:e=>e.name,sort:e=>e.name},{header:C(),cell:e=>(0,Q.jsx)(Y,{icon:(0,Q.jsx)(Qe,{size:12,"aria-hidden":!0}),total:e.memberCount,items:e.members.map(e=>({label:e.label,marker:e.manager?(0,Q.jsx)(X,{size:11,"aria-hidden":!0}):null,highlight:e.manager}))}),sort:e=>e.memberCount},{header:l(),cell:e=>(0,Q.jsx)(Y,{icon:(0,Q.jsx)(q,{size:12,"aria-hidden":!0}),total:e.agentCount,items:e.agents.map(e=>({label:e}))}),sort:e=>e.agentCount},{header:d(),cell:e=>(0,Q.jsx)(Y,{icon:(0,Q.jsx)(Ze,{size:12,"aria-hidden":!0}),total:e.chartCount,items:e.charts.map(e=>({label:e.name,marker:e.isDefault?(0,Q.jsx)(J,{size:11,fill:`currentColor`,"aria-hidden":!0}):null,highlight:e.isDefault}))}),sort:e=>e.chartCount}],rowActions:e=>[{label:De(),onSelect:()=>x({groupId:e._id,name:e.name})},...t?[{label:s(),onSelect:()=>O(e)},{label:te(),variant:`destructive`,onSelect:()=>void j(e)}]:[]]}),(0,Q.jsx)(He,{open:p,onOpenChange:m,title:h?Ee():ke(),description:N(),canSubmit:!!_.name.trim(),onSubmit:A,submitLabel:Oe(),children:(0,Q.jsxs)(`div`,{className:`oc-form`,children:[(0,Q.jsxs)(`label`,{className:`oc-field`,children:[(0,Q.jsx)(`span`,{className:`oc-field__label`,children:ue()}),(0,Q.jsx)(G,{value:_.name,onChange:e=>v({..._,name:e.target.value})})]}),(0,Q.jsxs)(`label`,{className:`oc-field`,children:[(0,Q.jsx)(`span`,{className:`oc-field__label`,children:de()}),(0,Q.jsx)(G,{value:_.description,onChange:e=>v({..._,description:e.target.value})})]})]})}),(0,Q.jsx)(ct,{groupId:y?.groupId??null,groupName:y?.name??``,open:y!==null,onOpenChange:e=>{e||x(null)}})]})}var ot=8;function st({page:e,pageCount:t,onPage:n}){return t<=1?null:(0,Q.jsxs)(`div`,{className:`oc-access__pager`,children:[(0,Q.jsxs)(H,{type:`button`,variant:`ghost`,size:`sm`,disabled:e<=1,onClick:()=>n(e-1),children:[(0,Q.jsx)(Xe,{size:14,"aria-hidden":!0}),Se()]}),(0,Q.jsxs)(`span`,{className:`oc-access__pageinfo`,"aria-label":we({page:e,pages:t}),children:[e,` / `,t]}),(0,Q.jsxs)(H,{type:`button`,variant:`ghost`,size:`sm`,disabled:e>=t,onClick:()=>n(e+1),children:[ve(),(0,Q.jsx)(Fe,{size:14,"aria-hidden":!0})]})]})}function ct({groupId:e,groupName:t,open:n,onOpenChange:r}){let a=D(I.groups.getGroup,n&&e?{groupId:e}:`skip`),s=D(I.groups.listAssignableInstances,n?{}:`skip`),c=D(I.groups.listAssignableUsers,n?{}:`skip`),l=L(I.groups.addMember),u=L(I.groups.removeMember),d=L(I.groups.bulkSetMembers),f=L(I.groups.setGroupManager),p=U(),[m,h]=(0,Z.useState)(``),[g,v]=(0,Z.useState)(``),[b,x]=(0,Z.useState)(`members`),[ee,S]=(0,Z.useState)(1),[C,w]=(0,Z.useState)(new Set),T=(0,Z.useRef)(null),E=(0,Z.useMemo)(()=>new Set((a?.members??[]).map(e=>e.userId)),[a]),te=(0,Z.useMemo)(()=>new Set((a?.members??[]).filter(e=>e.manager).map(e=>e.userId)),[a]),k=a?.viewerIsAdmin===!0,A=(0,Z.useMemo)(()=>new Set((a?.agents??[]).map(e=>`${e.instanceName}/${e.agentId}`)),[a]);(0,Z.useEffect)(()=>{h(``),v(``),x(`members`),S(1),T.current=null},[n,e]),(0,Z.useEffect)(()=>{S(1)},[m]),(0,Z.useEffect)(()=>{n&&a&&e&&T.current!==e&&(T.current=e,w(new Set((a.members??[]).map(e=>e.userId))))},[n,a,e]);let j=(0,Z.useMemo)(()=>c?$e(c,m,C):[],[c,m,C]);async function ne(t,n){if(e)try{n?await u({groupId:e,userId:t}):await l({groupId:e,userId:t})}catch(e){p.error(O(),e)}}async function re(t,n){if(e)try{await f({groupId:e,userId:t,manager:!n})}catch(e){p.error(me(),e)}}let N=rt(j,e=>E.has(e.userId)),oe=j.filter(e=>E.has(e.userId)).length,P=it(j,ee,ot);async function le(){if(!e||j.length===0)return;let t=j.map(e=>e.userId);try{await d({groupId:e,userIds:t,member:N!==`all`})}catch(e){p.error(O(),e)}}return(0,Q.jsx)(Le,{open:n,onOpenChange:r,children:(0,Q.jsxs)(Pe,{className:`oc-access`,children:[(0,Q.jsxs)(Ue,{children:[(0,Q.jsx)(Ge,{children:ce({name:t})}),(0,Q.jsx)(Be,{children:Te()})]}),(0,Q.jsxs)(Ne,{value:b,onValueChange:x,className:`oc-access__tabs`,children:[(0,Q.jsxs)(Me,{className:`w-full`,children:[(0,Q.jsxs)(B,{value:`members`,className:`flex-1 gap-1.5`,children:[(0,Q.jsx)(Qe,{size:13,"aria-hidden":!0}),ge(),a?(0,Q.jsx)(W,{variant:`secondary`,className:`oc-access__tabcount`,children:E.size}):null]}),(0,Q.jsxs)(B,{value:`agents`,className:`flex-1 gap-1.5`,children:[(0,Q.jsx)(q,{size:13,"aria-hidden":!0}),Ce(),a?(0,Q.jsx)(W,{variant:`secondary`,className:`oc-access__tabcount`,children:A.size}):null]}),(0,Q.jsxs)(B,{value:`charts`,className:`flex-1 gap-1.5`,children:[(0,Q.jsx)(Ze,{size:13,"aria-hidden":!0}),o(),a?(0,Q.jsx)(W,{variant:`secondary`,className:`oc-access__tabcount`,children:a.chartCount}):null]})]}),(0,Q.jsx)(V,{value:`members`,children:c===void 0||a===void 0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:M()}):c.length===0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:xe()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(G,{value:m,onChange:e=>h(e.target.value),placeholder:se(),className:`oc-access__search`}),j.length===0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:ae()}):(0,Q.jsxs)(Q.Fragment,{children:[j.length>1?(0,Q.jsxs)(`div`,{className:`oc-access__row oc-access__selectall`,children:[(0,Q.jsx)(K,{checked:N===`all`?!0:N===`some`?`indeterminate`:!1,onCheckedChange:()=>void le(),"aria-label":F()}),(0,Q.jsx)(`span`,{className:`oc-access__label`,children:F()}),(0,Q.jsxs)(W,{variant:`outline`,className:`oc-access__count`,children:[oe,` / `,j.length]})]}):null,(0,Q.jsx)(`div`,{className:`oc-access__list`,children:P.pageItems.map(e=>{let t=E.has(e.userId),n=tt(e),r=te.has(e.userId);return(0,Q.jsxs)(`div`,{className:`oc-access__row`,children:[(0,Q.jsx)(K,{checked:t,onCheckedChange:()=>void ne(e.userId,t),"aria-label":ie({user:n.primary})}),(0,Q.jsxs)(`span`,{className:`oc-access__who`,children:[(0,Q.jsx)(`span`,{className:`oc-access__label`,title:n.primary,children:n.primary}),n.secondary?(0,Q.jsx)(`span`,{className:`oc-access__sub`,title:n.secondary,children:n.secondary}):null]}),(0,Q.jsx)(W,{variant:`outline`,className:`oc-access__role`,children:nt(e.role)}),(0,Q.jsx)(`span`,{className:`oc-access__mgrslot`,children:t&&k?(0,Q.jsx)(H,{type:`button`,variant:`ghost`,size:`icon`,className:`shrink-0 oc-access__mgr${r?` oc-access__mgr--on`:``}`,"aria-pressed":r,"aria-label":r?i():fe(),title:r?i():fe(),onClick:()=>void re(e.userId,r),children:(0,Q.jsx)(X,{size:15,"aria-hidden":!0})}):t&&r?(0,Q.jsx)(`span`,{className:`oc-access__mgr oc-access__mgr--on`,role:`img`,"aria-label":y(),title:y(),children:(0,Q.jsx)(X,{size:15,"aria-hidden":!0})}):null})]},e._id)})}),(0,Q.jsx)(st,{page:P.page,pageCount:P.pageCount,onPage:S})]})]})}),(0,Q.jsx)(V,{value:`agents`,children:s===void 0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:M()}):s.length===0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:_()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(G,{value:g,onChange:e=>v(e.target.value),placeholder:ye(),className:`oc-access__search`}),(0,Q.jsx)(`div`,{className:`oc-access__list`,children:s.map(t=>(0,Q.jsx)(lt,{groupId:e,instanceName:t.name,kind:t.kind??`openclaw`,assigned:A,query:g},`${e}-${t._id}`))})]})}),(0,Q.jsx)(V,{value:`charts`,children:(0,Q.jsx)(ut,{groupId:e})})]})]})})}function lt({groupId:e,instanceName:t,kind:n,assigned:r,query:i}){let a=D(I.groups.listAssignableAgents,{instanceName:t}),o=L(I.groups.assignAgentToGroup),s=L(I.groups.removeAgentFromGroup),c=L(I.groups.bulkSetGroupAgents),l=U(),[u,d]=(0,Z.useState)(1);if((0,Z.useEffect)(()=>{d(1)},[i]),!e)return null;let f=et(a?.agents??[],i),h=a?.discovery&&!a.discovery.lastPollOk;if(i.trim()&&f.length===0)return null;let _=f.filter(e=>e.presentInLastOk!==!1),v=rt(_,e=>r.has(`${t}/${e.agentId}`)),y=it(f,u,ot);async function b(n,r){try{r?await s({groupId:e,instanceName:t,agentId:n}):await o({groupId:e,instanceName:t,agentId:n})}catch(e){l.error(R(),e)}}async function x(){if(_.length===0)return;let n=_.map(e=>e.agentId);try{await c({groupId:e,instanceName:t,agentIds:n,assigned:v!==`all`})}catch(e){l.error(R(),e)}}return(0,Q.jsxs)(`div`,{className:`oc-access__group`,children:[(0,Q.jsxs)(`div`,{className:`oc-access__instance`,children:[(0,Q.jsx)(q,{size:13,"aria-hidden":!0}),(0,Q.jsx)(`span`,{children:t}),(0,Q.jsx)(W,{variant:`outline`,className:`oc-access__kind`,children:n}),h?(0,Q.jsx)(W,{variant:`outline`,className:`oc-access__stale`,children:A()}):null]}),a===void 0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:g()}):f.length===0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:h?ne():p()}):(0,Q.jsxs)(Q.Fragment,{children:[_.length>1?(0,Q.jsxs)(`div`,{className:`oc-access__row oc-access__selectall`,children:[(0,Q.jsx)(K,{checked:v===`all`?!0:v===`some`?`indeterminate`:!1,onCheckedChange:()=>void x(),"aria-label":F()}),(0,Q.jsx)(`span`,{className:`oc-access__label`,children:F()})]}):null,y.pageItems.map(e=>{let n=`${t}/${e.agentId}`,i=r.has(n),a=e.presentInLastOk===!1;return(0,Q.jsxs)(`div`,{className:`oc-access__row`,children:[(0,Q.jsx)(K,{checked:i,disabled:a&&!i,onCheckedChange:()=>void b(e.agentId,i),"aria-label":re({name:e.displayName??e.agentId})}),(0,Q.jsxs)(`span`,{className:`oc-access__label`,title:e.displayName??e.agentId,children:[e.emoji?`${e.emoji} `:``,e.displayName??e.agentId]}),e.model?(0,Q.jsx)(`span`,{className:`oc-access__model`,children:e.model}):null,e.isDefaultOnInstance?(0,Q.jsx)(`span`,{className:`oc-access__fav`,role:`img`,"aria-label":j(),title:j(),children:(0,Q.jsx)(J,{size:14,fill:`currentColor`})}):null,a?(0,Q.jsx)(W,{variant:`outline`,className:`oc-access__gone`,children:m()}):null]},e.agentId)}),(0,Q.jsx)(st,{page:y.page,pageCount:y.pageCount,onPage:d})]})]})}function ut({groupId:e}){let t=D(I.charts.listGroupChartSelection,e?{groupId:e}:`skip`),n=L(I.charts.assignChartToGroup),r=L(I.charts.removeChartFromGroup),i=L(I.charts.setGroupDefaultChart),a=L(I.charts.addChartToGroupPool),o=L(I.charts.removeChartFromGroupPool),s=U();if(!e)return null;if(t===void 0)return(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:M()});let{pool:c,addable:l,canManagePool:u}=t;if(c.length===0&&!u)return(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:Ae()});async function d(t,i){try{i?await r({groupId:e,chartKey:t}):await n({groupId:e,chartKey:t})}catch(e){s.error(S(),e)}}async function p(t){try{await i({groupId:e,chartKey:t})}catch(e){s.error(S(),e)}}async function m(t){try{await a({groupId:e,chartKey:t})}catch(e){s.error(S(),e)}}async function g(t){try{await o({groupId:e,chartKey:t})}catch(e){s.error(S(),e)}}return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`div`,{className:`oc-access__list`,children:c.map(e=>(0,Q.jsxs)(`div`,{className:`oc-access__row`,children:[(0,Q.jsx)(K,{checked:e.selected,onCheckedChange:()=>void d(e.chartKey,e.selected),"aria-label":f({name:e.name})}),(0,Q.jsx)(`span`,{className:`oc-access__label`,title:e.name,children:e.name}),e.selected?e.isDefault?(0,Q.jsx)(`span`,{className:`oc-access__fav`,role:`img`,"aria-label":w(),title:w(),children:(0,Q.jsx)(J,{size:14,fill:`currentColor`})}):(0,Q.jsx)(H,{type:`button`,variant:`ghost`,size:`sm`,onClick:()=>void p(e.chartKey),children:x()}):null,u?(0,Q.jsx)(H,{type:`button`,variant:`ghost`,size:`sm`,"aria-label":h({name:e.name}),title:h({name:e.name}),onClick:()=>void g(e.chartKey),children:(0,Q.jsx)(je,{size:14,"aria-hidden":!0})}):null]},e.chartKey))}),u?l.length>0?(0,Q.jsxs)(qe,{value:``,onValueChange:e=>void m(e),children:[(0,Q.jsx)(Re,{size:`sm`,className:`oc-access__search`,children:(0,Q.jsx)(Ie,{placeholder:v()})}),(0,Q.jsx)(ze,{children:l.map(e=>(0,Q.jsx)(Ke,{value:e.chartKey,children:e.name},e.chartKey))})]}):c.length===0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:E()}):null:null]})}export{at as GroupsTab};
@@ -1 +0,0 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$g as r,$h as i,A_ as a,Ag as o,Bg as s,C_ as c,Cg as l,D_ as u,Dg as d,EC as f,E_ as p,Eg as m,F_ as h,Fg as g,Gg as _,Hg as v,I_ as y,Ig as b,Jd as x,Jg as S,Kg as C,L as w,L_ as T,Lg as E,M_ as D,Mg as O,N_ as ee,Ng as te,O_ as ne,Og as re,P_ as ie,Pg as ae,Qg as oe,R as se,R_ as ce,Rg as le,SO as k,S_ as ue,Sg as de,TC as fe,TO as A,T_ as pe,Tg as me,Ug as he,Vg as ge,Wg as _e,Xg as ve,Yd as ye,Yg as j,Zg as be,__ as xe,_g as Se,a_ as Ce,ag as we,b_ as Te,bg as M,c_ as Ee,cg as De,d_ as Oe,dg as ke,e_ as Ae,eg as N,f_ as je,fg as Me,g_ as Ne,gg as Pe,h_ as Fe,hg as Ie,i_ as Le,ig as Re,j_ as ze,jg as Be,k_ as Ve,kg as He,l_ as Ue,lg as We,m_ as Ge,mg as Ke,n_ as P,ng as qe,o_ as Je,og as Ye,p_ as Xe,pg as Ze,qg as Qe,r_ as $e,rg as et,s_ as tt,sg as nt,t_ as F,tg as rt,u_ as it,ug as at,vO as I,v_ as ot,vg as st,wO as L,w_ as ct,wg as lt,x_ as ut,xg as dt,y_ as ft,yg as pt,z_ as mt,zg as ht}from"./dist-DRXIQewX.js";import{a as gt,c as _t}from"./FieldLabel-DbxkeyLF.js";import{t as R}from"./button-CrkRjd-T.js";import{$ as z,A as B,C as V,H as vt,Q as H,S as U,U as yt,V as bt,X as W,Z as G,_ as K,b as q,et as xt,j as St,m as Ct,nt as wt,rt as Tt,x as J,y as Et}from"./index-DcMWPy01.js";import{t as Dt}from"./DataTableShell-CJHDSNd8.js";import{InstanceConfigDialog as Ot}from"./BridgeTab-BFCNmd2S.js";var Y=t(e(),1),X=[`conversational`,`documentary`,`summarizer`],kt=new Set(X),At=`conversational`;function jt(e){let t=new Set((e??[]).filter(e=>kt.has(e)));return t.size===0?[At]:X.filter(e=>t.has(e))}var Z=n(),Q={name:``,gatewayUrl:``,bridgeUrl:``,displayName:``,kind:`openclaw`,gatewayVersion:``,gatewayHttpUrl:``,streamTransport:gt},Mt={openclaw:[`token`,`deviceIdentity`],hermes:[`apiKey`]};function Nt(e){return{name:e.name,gatewayUrl:e.gatewayUrl,bridgeUrl:e.bridgeUrl??``,displayName:e.displayName??``,kind:e.kind??`openclaw`,gatewayVersion:e.gatewayVersion??``,gatewayHttpUrl:e.gatewayHttpUrl??``,streamTransport:e.streamTransport??`reactive`}}function Pt(){let e=A(I.admin.listInstances,{}),t=A(I.agents.listAllInstanceAgents,{}),n=L(I.admin.upsertInstance),r=L(I.admin.deleteInstance),i=B(),[o,s]=(0,Y.useState)(!1),[l,d]=(0,Y.useState)(Q),[f,m]=(0,Y.useState)(null),[g,_]=(0,Y.useState)(null),[v,b]=(0,Y.useState)(null),[S,C]=(0,Y.useState)(null);async function w(){try{await n({instanceId:S??void 0,name:l.name,gatewayUrl:l.gatewayUrl,bridgeUrl:l.bridgeUrl||void 0,displayName:l.displayName||void 0,kind:l.kind,gatewayVersion:l.gatewayVersion||void 0,gatewayHttpUrl:l.gatewayHttpUrl||void 0,streamTransport:l.streamTransport}),d(Q),C(null),s(!1)}catch(e){i.error(T(),e)}}return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`p`,{className:`oc-admin__hint`,children:[y(),(0,Z.jsx)(`strong`,{children:h()}),ie()]}),(0,Z.jsx)(Dt,{title:ee(),rows:e,addLabel:D(),onAdd:()=>{C(null),d(Q),s(!0)},emptyHint:ze(),columns:[{header:a(),cell:e=>e.name,sort:e=>e.name},{header:Ve(),cell:e=>(0,Z.jsx)(W,{variant:`outline`,children:e.kind??`openclaw`}),sort:e=>e.kind??`openclaw`},{header:ne(),cell:e=>e.gatewayUrl,sort:e=>e.gatewayUrl},{header:u(),cell:e=>e.displayName??`—`,sort:e=>e.displayName??null},{header:mt(),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)(W,{variant:r(e.agentId)?`default`:`outline`,title:r(e.agentId)?N():void 0,children:[e.emoji?`${e.emoji} `:``,e.displayName??e.agentId]},e.agentId))})}}],rowActions:e=>[{label:c(),onSelect:()=>{C(e._id),d(Nt(e)),s(!0)}},{label:ce(),onSelect:()=>m(e.name)},{label:Ee(),onSelect:()=>b(e)},{label:p(),onSelect:()=>_(e)},{label:pe(),variant:`destructive`,onSelect:()=>void r({instanceId:e._id})}],bulkActions:[{label:pe(),variant:`destructive`,onSelect:e=>e.forEach(e=>void r({instanceId:e}))}]}),(0,Z.jsx)(Ct,{open:o,onOpenChange:s,title:S?ue():ct(),description:Te(),canSubmit:!!(l.name&&l.gatewayUrl),onSubmit:w,submitLabel:ft(),children:(0,Z.jsxs)(`div`,{className:`oc-form`,children:[(0,Z.jsxs)($,{label:ot(),children:[(0,Z.jsx)(G,{value:l.name,disabled:S!==null,onChange:e=>d({...l,name:e.target.value})}),S?(0,Z.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:ut()}):null]}),(0,Z.jsx)($,{label:xe(),children:(0,Z.jsxs)(Et,{value:l.kind,onValueChange:e=>d({...l,kind:e}),children:[(0,Z.jsx)(U,{size:`sm`,className:`w-40`,children:(0,Z.jsx)(V,{})}),(0,Z.jsxs)(q,{children:[(0,Z.jsx)(J,{value:`openclaw`,children:`OpenClaw`}),(0,Z.jsx)(J,{value:`hermes`,children:`Hermes`})]})]})}),(0,Z.jsx)($,{label:Ne(),children:(0,Z.jsx)(G,{value:l.gatewayUrl,onChange:e=>d({...l,gatewayUrl:e.target.value})})}),(0,Z.jsx)($,{label:Fe(),children:(0,Z.jsx)(G,{value:l.bridgeUrl,placeholder:Ge(),onChange:e=>d({...l,bridgeUrl:e.target.value})})}),(0,Z.jsx)($,{label:Xe(),children:(0,Z.jsx)(G,{value:l.displayName,onChange:e=>d({...l,displayName:e.target.value})})}),(0,Z.jsxs)($,{label:ye(),children:[(0,Z.jsxs)(Et,{value:l.streamTransport,onValueChange:e=>d({...l,streamTransport:e}),children:[(0,Z.jsx)(U,{size:`sm`,className:`w-40`,children:(0,Z.jsx)(V,{})}),(0,Z.jsx)(q,{children:_t.map(e=>(0,Z.jsx)(J,{value:e,children:e},e))})]}),(0,Z.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:x()})]}),(0,Z.jsx)($,{label:je(),children:(0,Z.jsx)(G,{value:l.gatewayVersion,placeholder:Oe(),onChange:e=>d({...l,gatewayVersion:e.target.value})})}),(0,Z.jsx)($,{label:it(),children:(0,Z.jsx)(G,{value:l.gatewayHttpUrl,placeholder:Ue(),onChange:e=>d({...l,gatewayHttpUrl:e.target.value})})})]})}),(0,Z.jsx)(Wt,{instanceName:f,open:f!==null,onOpenChange:e=>{e||m(null)}}),g?(0,Z.jsx)(Ot,{instance:g,onClose:()=>_(null)},g._id):null,v?(0,Z.jsx)(Ft,{instance:v,onClose:()=>b(null)},v._id):null]})}function Ft({instance:e,onClose:t}){let n=A(I.instanceSecrets.listInstanceSecretStatus,{}),r=Mt[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)(H,{open:!0,onOpenChange:e=>!e&&t(),children:(0,Z.jsxs)(z,{onOpenAutoFocus:e=>e.preventDefault(),children:[(0,Z.jsxs)(wt,{children:[(0,Z.jsx)(Tt,{children:tt({instance:e.displayName??e.name})}),(0,Z.jsx)(xt,{children:Je()})]}),(0,Z.jsx)(`div`,{className:`oc-form`,children:r.map(t=>(0,Z.jsx)(Rt,{instanceId:e._id,field:t,updatedAt:i[t]??null},t))}),(0,Z.jsx)(`div`,{className:`oc-bridgesecret`,children:(0,Z.jsx)(Lt,{instance:e})}),(0,Z.jsx)(It,{instance:e})]})})}function It({instance:e}){let t=k(I.instanceSync.forceInstanceSync),n=B(),[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(s());break;case`no_agents`:n.success(le());break;case`no_bridge_url`:n.error(E());break;case`deploy_misconfigured`:n.error(b());break;case`unauthorized`:n.error(ae());break;case`not_served`:n.error(te());break;default:n.error(g());break}}catch(e){n.error(ht(),e)}finally{i(!1)}}}return(0,Z.jsxs)(`div`,{className:`oc-form`,children:[(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:O()}),(0,Z.jsx)(`div`,{className:`flex items-center gap-2`,children:(0,Z.jsx)(R,{size:`sm`,variant:`outline`,onClick:()=>void a(),disabled:r,children:r?ge():v()})})]})}function Lt({instance:e}){let t=A(I.bridgeAuth.listBridgeAuthStatus,{}),n=k(I.bridgeAuth.mintBridgeSecret),r=L(I.bridgeAuth.revokeBridgeSecret),i=B(),[a,s]=(0,Y.useState)(!1),[c,u]=(0,Y.useState)(null),[p,h]=(0,Y.useState)(!1),g=(t??[]).find(t=>t.instanceId===e._id),_=g!==void 0;async function v(){if(!a){s(!0);try{u((await n({instanceId:e._id})).plaintext),h(!1)}catch(e){i.error(me(),e)}finally{s(!1)}}}async function y(){if(!a){s(!0);try{await r({instanceId:e._id}),u(null),i.success(m())}catch(e){i.error(me(),e)}finally{s(!1)}}}async function b(){if(c)try{await navigator.clipboard.writeText(c),h(!0)}catch{}}return(0,Z.jsxs)($,{label:Be(),children:[(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:o()}),(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Z.jsx)(W,{variant:_?`outline`:`secondary`,children:_?`${P()} · ${g.prefix}…${g.lastFour}`:F()}),(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(R,{size:`sm`,onClick:()=>void v(),disabled:a,children:_?re():He()}),_?(0,Z.jsx)(R,{size:`sm`,variant:`destructive`,onClick:()=>void y(),disabled:a,children:d()}):null]})]}),c?(0,Z.jsxs)(`div`,{className:`oc-bridgesecret__reveal`,children:[(0,Z.jsx)(`p`,{className:`oc-sa__minted-warning`,children:lt()}),(0,Z.jsxs)(`div`,{className:`oc-sa__minted-box`,children:[(0,Z.jsx)(`code`,{className:`oc-sa__minted-plain`,children:c}),(0,Z.jsx)(R,{variant:`outline`,size:`sm`,onClick:()=>void b(),children:p?f():fe()})]}),(0,Z.jsx)(R,{size:`sm`,variant:`ghost`,onClick:()=>{u(null),h(!1)},children:l()})]}):null]})}function Rt({instanceId:e,field:t,updatedAt:n}){let i=k(I.instanceSecrets.setInstanceSecret),a=L(I.instanceSecrets.clearInstanceSecret),o=k(I.deviceIdentity.generateDeviceIdentity),s=B(),[c,u]=(0,Y.useState)(``),[d,p]=(0,Y.useState)(!1),[m,h]=(0,Y.useState)(null),[g,v]=(0,Y.useState)(!1),y=n!==null,b=t===`deviceIdentity`,x=t===`token`?Ce():t===`deviceIdentity`?Le():$e();async function w(){if(!(!c.trim()||d)){p(!0);try{await i({instanceId:e,field:t,plaintext:c}),u(``),h(null),v(!1),s.success(ve())}catch(e){s.error(j(),e)}finally{p(!1)}}}async function T(){if(!d){p(!0);try{await a({instanceId:e,field:t}),h(null),v(!1),s.success(S())}catch(e){s.error(j(),e)}finally{p(!1)}}}async function E(){if(!d){p(!0);try{h(await o({instanceId:e})),v(!1),s.success(_())}catch(e){s.error(he(),e)}finally{p(!1)}}}let D=m?`openclaw devices approve ${m.id}`:``;async function O(){if(D)try{await navigator.clipboard.writeText(D),v(!0)}catch{}}return(0,Z.jsxs)($,{label:x,children:[b?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:C()}):null,(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Z.jsx)(W,{variant:y?`outline`:`secondary`,children:y?P():F()}),(0,Z.jsx)(G,{type:`password`,autoComplete:`off`,className:`flex-1 min-w-32`,value:c,placeholder:y?r():Ae(),onChange:e=>u(e.target.value)}),(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(R,{size:`sm`,onClick:()=>void w(),disabled:d||c.trim().length===0,children:oe()}),b?(0,Z.jsx)(R,{size:`sm`,variant:`outline`,onClick:()=>void E(),disabled:d,children:Qe()}):null,y?(0,Z.jsx)(R,{size:`sm`,variant:`destructive`,onClick:()=>void T(),disabled:d,children:be()}):null]})]}),m?(0,Z.jsxs)(`div`,{className:`oc-bridgesecret__reveal`,children:[(0,Z.jsx)(`p`,{className:`text-sm font-medium`,children:_()}),(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:_e()}),(0,Z.jsxs)(`div`,{className:`oc-sa__minted-box`,children:[(0,Z.jsx)(`code`,{className:`oc-sa__minted-plain`,children:D}),(0,Z.jsx)(R,{variant:`outline`,size:`sm`,onClick:()=>void O(),children:g?f():fe()})]}),(0,Z.jsx)(R,{size:`sm`,variant:`ghost`,onClick:()=>{h(null),v(!1)},children:l()})]}):null]})}var zt={conversational:Ie,documentary:Ze,summarizer:se},Bt={conversational:Ke,documentary:Me,summarizer:w},Vt=e=>(zt[e]??(()=>e))(),Ht=e=>(Bt[e]??(()=>``))();function Ut({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:pt()}),t.map(e=>(0,Z.jsx)(W,{variant:`secondary`,className:`oc-agenttype__chip`,title:Ht(e),children:Vt(e)},e)),(0,Z.jsxs)(bt,{children:[(0,Z.jsx)(yt,{asChild:!0,children:(0,Z.jsx)(R,{type:`button`,variant:`outline`,size:`sm`,className:`h-7`,children:st()})}),(0,Z.jsxs)(vt,{align:`start`,className:`oc-agenttypes-pop`,children:[(0,Z.jsx)(`p`,{className:`oc-agenttypes-pop__title`,children:Se()}),(0,Z.jsx)(`p`,{className:`oc-agenttypes-pop__hint`,children:Pe()}),(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)(K,{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:Vt(r)}),(0,Z.jsx)(`span`,{className:`oc-agenttypes-pop__desc`,children:Ht(r)})]})]},r)})})]})]})]})}function Wt({instanceName:e,open:t,onOpenChange:n}){let r=A(I.agents.listAgentsForInstance,t&&e?{instanceName:e}:`skip`),a=L(I.agents.setAgentEnabled).withOptimisticUpdate((e,{instanceName:t,agentId:n,enabled:r})=>{let i=e.getQuery(I.agents.listAgentsForInstance,{instanceName:t});i&&e.setQuery(I.agents.listAgentsForInstance,{instanceName:t},{...i,agents:i.agents.map(e=>e.agentId===n?{...e,enabled:r}:e)})}),o=L(I.agents.setInstanceDefaultAgent).withOptimisticUpdate((e,{instanceName:t,agentId:n})=>{let r=e.getQuery(I.agents.listAgentsForInstance,{instanceName:t});r&&e.setQuery(I.agents.listAgentsForInstance,{instanceName:t},{...r,defaultAgentId:n})}),s=L(I.agents.setAgentTypes).withOptimisticUpdate((e,{instanceName:t,agentId:n,types:r})=>{let i=e.getQuery(I.agents.listAgentsForInstance,{instanceName:t});if(!i)return;let a=jt(r);e.setQuery(I.agents.listAgentsForInstance,{instanceName:t},{...i,agents:i.agents.map(e=>e.agentId===n?{...e,types:a}:e)})}),c=L(I.agents.removeInstanceAgent),l=St(),u=B();async function d(t,n){if(e)try{await a({instanceName:e,agentId:t,enabled:n})}catch(e){u.error(M(),e)}}async function f(t){if(e)try{await o({instanceName:e,agentId:t})}catch(e){u.error(M(),e)}}async function p(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){u.error(M(),e)}}async function m(t,n){if(e&&await l({title:We({name:n}),description:De(),confirmLabel:nt(),destructive:!0}))try{await c({instanceName:e,agentId:t}),u.success(Ye())}catch(e){u.error(M(),e)}}return(0,Z.jsx)(H,{open:t,onOpenChange:n,children:(0,Z.jsxs)(z,{className:`oc-access`,children:[(0,Z.jsxs)(wt,{children:[(0,Z.jsx)(Tt,{children:de({name:e??``})}),(0,Z.jsx)(xt,{children:dt()})]}),r===void 0?(0,Z.jsx)(`p`,{className:`oc-access__hint`,children:we()}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`div`,{className:`oc-access__poll`,children:r.discovery===null?Re():r.discovery.lastPollOk?et():qe({error:r.discovery.error??`?`})}),r.agents.length===0?(0,Z.jsx)(`p`,{className:`oc-access__hint`,children:rt()}):(0,Z.jsx)(`div`,{className:`oc-access__list`,children:r.agents.map(e=>{let t=e.presentInLastOk===!1,n=r.defaultAgentId===e.agentId,a=e.displayName??e.agentId,o=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)(K,{checked:e.enabled,disabled:t,"aria-label":a,onCheckedChange:t=>void d(e.agentId,t===!0)}),(0,Z.jsxs)(`span`,{className:`oc-agentcard__name`,title:a,children:[e.emoji?`${e.emoji} `:``,a]}),e.model?(0,Z.jsx)(`span`,{className:`oc-access__model`,children:e.model}):null,t?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(W,{variant:`outline`,className:`oc-access__gone`,children:i()}),(0,Z.jsx)(R,{size:`sm`,variant:`ghost`,className:`h-7 text-destructive`,onClick:()=>void m(e.agentId,a),children:at()})]}):n?(0,Z.jsx)(W,{variant:`default`,children:N()}):(0,Z.jsx)(R,{size:`sm`,variant:`outline`,className:`h-7`,disabled:!e.enabled,onClick:()=>void f(e.agentId),children:ke()})]}),e.enabled?(0,Z.jsx)(Ut,{agentId:e.agentId,types:o,onToggle:t=>void p(e.agentId,t,o)}):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{Pt as InstancesTab};
@@ -1 +0,0 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$t as r,$y as i,Ay as a,By as o,Cy as s,Dy as c,Ey as l,Fy as u,Gy as ee,Hy as te,Iy as d,Jy as f,Ky as ne,Ly as p,My as re,Ny as m,Oy as h,Py as g,Qt as _,Qy as v,Ry as y,SO as b,Sy as ie,TO as ae,Ty as oe,Uy as se,Vy as ce,Wy as le,Xy as ue,Yy as de,Zt as x,Zy as S,_y as C,ab as w,an as T,by as E,eb as D,en as O,gy as k,hy as A,ib as j,in as M,jy as N,ky as P,nb as F,nn as I,ob as L,qy as R,rb as z,rn as B,sb as V,tb as H,tn as fe,vO as U,vy as pe,wO as W,wy as me,xy as he,yy as ge,zy as _e}from"./dist-DRXIQewX.js";import{t as G}from"./button-CrkRjd-T.js";import{C as ve,S as ye,X as K,Z as q,_ as be,b as xe,x as Se,y as Ce}from"./index-DcMWPy01.js";import{t as we}from"./DataTableShell-CJHDSNd8.js";var J=t(e(),1),Y=n();function Te(){let e=ae(U.integrations.status.status,{}),t=W(U.admin.setIntegrationConfig),[n,r]=(0,J.useState)(null);if((0,J.useEffect)(()=>{e&&n===null&&r(e.config)},[e,n]),!e||!n)return(0,Y.jsx)(`p`,{className:`oc-admin__hint`,children:V()});let _=n,b=(e,t,n)=>r({..._,[e]:{..._[e],[t]:n}}),x=(e,n)=>void t({[e]:n});return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(`p`,{className:`oc-admin__hint`,children:[L(),` `,(0,Y.jsx)(`strong`,{children:w()}),` `,j()]}),(0,Y.jsxs)(X,{title:`Langfuse`,status:e.langfuse.configured?e.langfuse.enabled?(0,Y.jsx)(K,{variant:`secondary`,children:z()}):(0,Y.jsx)(K,{variant:`outline`,children:F()}):(0,Y.jsx)(K,{variant:`outline`,children:H()}),note:i(),children:[(0,Y.jsx)(Z,{label:S(),children:(0,Y.jsx)(q,{value:_.langfuse.host??``,placeholder:e.langfuse.effectiveHost,onChange:e=>b(`langfuse`,`host`,e.target.value),onBlur:()=>x(`langfuse`,{host:_.langfuse.host??``})})}),(0,Y.jsx)(Q,{label:R(),checked:_.langfuse.enabled??!0,onChange:e=>{b(`langfuse`,`enabled`,e),x(`langfuse`,{enabled:e})}})]}),(0,Y.jsxs)(X,{title:`Opik`,status:e.opik.configured?e.opik.enabled?(0,Y.jsx)(K,{variant:`secondary`,children:z()}):(0,Y.jsx)(K,{variant:`outline`,children:F()}):(0,Y.jsx)(K,{variant:`outline`,children:H()}),note:v(),children:[(0,Y.jsx)(Z,{label:ue(),children:(0,Y.jsx)(q,{value:_.opik.baseUrl??``,placeholder:e.opik.effectiveBaseUrl,onChange:e=>b(`opik`,`baseUrl`,e.target.value),onBlur:()=>x(`opik`,{baseUrl:_.opik.baseUrl??``})})}),(0,Y.jsx)(Z,{label:de(),children:(0,Y.jsx)(q,{value:_.opik.workspace??``,placeholder:e.opik.effectiveWorkspace||f(),onChange:e=>b(`opik`,`workspace`,e.target.value),onBlur:()=>x(`opik`,{workspace:_.opik.workspace??``})})}),(0,Y.jsx)(Q,{label:R(),checked:_.opik.enabled??!0,onChange:e=>{b(`opik`,`enabled`,e),x(`opik`,{enabled:e})}})]}),(0,Y.jsxs)(X,{title:`OpenTelemetry (OTLP)`,status:e.otlp.configured?e.otlp.enabled?(0,Y.jsx)(K,{variant:`secondary`,children:z()}):(0,Y.jsx)(K,{variant:`outline`,children:F()}):(0,Y.jsx)(K,{variant:`outline`,children:T()}),note:M(),children:[(0,Y.jsx)(Z,{label:B(),children:(0,Y.jsx)(q,{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,Y.jsx)(Ee,{headersSet:e.otlp.headersSet}),(0,Y.jsx)(Q,{label:R(),checked:_.otlp.enabled??!0,onChange:e=>{b(`otlp`,`enabled`,e),x(`otlp`,{enabled:e})}})]}),(0,Y.jsxs)(X,{title:ne(),status:(0,Y.jsx)(K,{variant:`outline`,children:D()}),note:ee(),children:[(0,Y.jsx)(Z,{label:le(),children:(0,Y.jsx)($,{value:_.tts.auto??`off`,options:[[`off`,se()],[`always`,te()],[`inbound`,ce()],[`tagged`,o()]],onChange:e=>{b(`tts`,`auto`,e),x(`tts`,{auto:e})}})}),(0,Y.jsx)(Z,{label:_e(),children:(0,Y.jsx)($,{value:_.tts.provider??`openai`,options:[[`openai`,`OpenAI`],[`elevenlabs`,`ElevenLabs`],[`microsoft`,y()],[`azure`,`Azure Speech`],[`google`,`Google Gemini`]],onChange:e=>{b(`tts`,`provider`,e),x(`tts`,{provider:e})}})}),(0,Y.jsx)(Z,{label:p(),children:(0,Y.jsx)(q,{value:_.tts.model??``,placeholder:`eleven_multilingual_v2`,onChange:e=>b(`tts`,`model`,e.target.value),onBlur:()=>x(`tts`,{model:_.tts.model??``})})}),(0,Y.jsx)(Z,{label:d(),children:(0,Y.jsx)(q,{value:_.tts.voice??``,placeholder:u(),onChange:e=>b(`tts`,`voice`,e.target.value),onBlur:()=>x(`tts`,{voice:_.tts.voice??``})})})]}),(0,Y.jsxs)(X,{title:g(),status:(0,Y.jsx)(K,{variant:`outline`,children:D()}),note:e.secrets.openai?m():re(),children:[(0,Y.jsx)(Q,{label:N(),checked:_.talk.enabled??!1,onChange:e=>{b(`talk`,`enabled`,e),x(`talk`,{enabled:e})}}),(0,Y.jsx)(Z,{label:a(),children:(0,Y.jsx)($,{value:_.talk.realtimeProvider??`openai`,options:[[`openai`,`OpenAI (gpt-realtime)`],[`google`,`Google`]],onChange:e=>{b(`talk`,`realtimeProvider`,e),x(`talk`,{realtimeProvider:e})}})}),(0,Y.jsx)(Z,{label:P(),children:(0,Y.jsx)(q,{value:_.talk.realtimeModel??``,placeholder:`gpt-realtime-2`,onChange:e=>b(`talk`,`realtimeModel`,e.target.value),onBlur:()=>x(`talk`,{realtimeModel:_.talk.realtimeModel??``})})}),(0,Y.jsx)(Z,{label:d(),children:(0,Y.jsx)(q,{value:_.talk.voice??``,placeholder:`cedar / marin`,onChange:e=>b(`talk`,`voice`,e.target.value),onBlur:()=>x(`talk`,{voice:_.talk.voice??``})})}),(0,Y.jsx)(Z,{label:h(),children:(0,Y.jsx)($,{value:_.talk.transport??`webrtc`,options:[[`webrtc`,c()],[`provider-websocket`,`Provider WebSocket`],[`gateway-relay`,`Gateway relay`]],onChange:e=>{b(`talk`,`transport`,e),x(`talk`,{transport:e})}})}),(0,Y.jsx)(Z,{label:l(),children:(0,Y.jsx)(q,{value:_.talk.speechLocale??``,placeholder:`fr-CA`,onChange:e=>b(`talk`,`speechLocale`,e.target.value),onBlur:()=>x(`talk`,{speechLocale:_.talk.speechLocale??``})})}),(0,Y.jsx)(Q,{label:oe(),checked:_.talk.interruptOnSpeech??!0,onChange:e=>{b(`talk`,`interruptOnSpeech`,e),x(`talk`,{interruptOnSpeech:e})}})]}),(0,Y.jsxs)(`section`,{className:`oc-int__section`,children:[(0,Y.jsxs)(`div`,{className:`oc-int__section-head`,children:[(0,Y.jsx)(`h3`,{className:`oc-uipa__h`,children:me()}),(0,Y.jsx)(K,{variant:`outline`,children:s()})]}),(0,Y.jsxs)(`p`,{className:`oc-uipa__note`,children:[ie(),(0,Y.jsx)(`code`,{children:` voicewake.get/set`}),`.`]})]}),(0,Y.jsx)(we,{title:he(),rows:e.cursors.map(e=>({...e,_id:e.vendor})),emptyHint:E(),columns:[{header:ge(),cell:e=>(0,Y.jsx)(K,{variant:`secondary`,children:e.vendor}),sort:e=>e.vendor},{header:pe(),cell:e=>e.lastAt>0?new Date(e.lastAt).toLocaleString(`fr-FR`):`—`,sort:e=>e.lastAt>0?e.lastAt:null},{header:C(),cell:e=>String(e.failureCount),sort:e=>e.failureCount},{header:k(),cell:e=>e.lastErrorStatus??`—`,sort:e=>e.lastErrorStatus??null},{header:A(),cell:e=>e.lastError??`—`,sort:e=>e.lastError??null}]})]})}function X({title:e,status:t,note:n,children:r}){return(0,Y.jsxs)(`section`,{className:`oc-int__section`,children:[(0,Y.jsxs)(`div`,{className:`oc-int__section-head`,children:[(0,Y.jsx)(`h3`,{className:`oc-uipa__h`,children:e}),t]}),n?(0,Y.jsx)(`p`,{className:`oc-uipa__note`,children:n}):null,(0,Y.jsx)(`div`,{className:`oc-int__fields`,children:r})]})}function Z({label:e,children:t}){return(0,Y.jsxs)(`label`,{className:`oc-int__field`,children:[(0,Y.jsx)(`span`,{className:`oc-int__field-label`,children:e}),t]})}function Q({label:e,checked:t,onChange:n}){return(0,Y.jsxs)(`label`,{className:`oc-int__toggle`,children:[(0,Y.jsx)(be,{checked:t,onCheckedChange:e=>n(e===!0)}),(0,Y.jsx)(`span`,{children:e})]})}function $({value:e,options:t,onChange:n}){return(0,Y.jsxs)(Ce,{value:e,onValueChange:n,children:[(0,Y.jsx)(ye,{size:`sm`,className:`w-full`,children:(0,Y.jsx)(ve,{})}),(0,Y.jsx)(xe,{children:t.map(([e,t])=>(0,Y.jsx)(Se,{value:e,children:t},e))})]})}function Ee({headersSet:e}){let t=b(U.integrations.otlpSecret.setOtlpHeaders),n=W(U.integrations.otlpSecret.clearOtlpHeaders),[i,a]=(0,J.useState)(``),[o,s]=(0,J.useState)(null),[c,l]=(0,J.useState)(!1),u=async()=>{l(!0),s(null);try{await t({headersJson:i}),a(``)}catch(e){s(e instanceof Error?e.message:String(e))}finally{l(!1)}};return(0,Y.jsxs)(Z,{label:I(),children:[(0,Y.jsx)(q,{value:i,placeholder:e?fe():O(),onChange:e=>a(e.target.value)}),(0,Y.jsxs)(`div`,{className:`oc-int__otlp-headers-actions`,children:[(0,Y.jsx)(G,{size:`sm`,disabled:c||i.trim().length===0,onClick:()=>void u(),children:r()}),e?(0,Y.jsx)(G,{variant:`ghost`,size:`sm`,disabled:c,onClick:()=>void n({}),children:_()}):null]}),o?(0,Y.jsx)(`p`,{className:`oc-int__otlp-headers-error`,children:o}):null,(0,Y.jsx)(`p`,{className:`oc-uipa__note`,children:x()})]})}export{Te as IntegrationsTab};
@@ -1 +0,0 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$w as r,AD as i,BD as a,Bw as o,DD as s,ED as c,FD as l,GD as u,Gw as d,Hw as f,ID as ee,Jw as p,Kw as m,LD as te,MD as h,ND as g,OD as _,PD as ne,Qw as v,Rw as re,TD as ie,TO as y,Uw as ae,Vw as oe,Ww as se,Xw as ce,Yw as le,Zw as ue,_T as de,aT as fe,cT as b,dT as x,eT as S,fT as C,gT as w,hT as T,iT as E,jD as D,kD as O,lT as k,mT as A,nT as j,oT as M,pT as N,qw as P,rT as F,sT as I,tT as L,uT as R,vO as z,wO as B,y_ as V,zw as pe}from"./dist-DRXIQewX.js";import{t as H}from"./button-CrkRjd-T.js";import{A as me,C as he,O as ge,S as _e,Z as U,_ as W,b as ve,ot as G,x as K,y as ye}from"./index-DcMWPy01.js";var q=t(e(),1),J=[{id:`messages`,label:()=>de()},{id:`composer`,label:()=>w()},{id:`sidebar`,label:()=>T()},{id:`other`,label:()=>A()}],Y={showSource:{category:`messages`,label:()=>N(),help:()=>C()},showReport:{category:`messages`,label:()=>x(),help:()=>R()},copyAssistant:{category:`messages`,label:()=>k()},copyUser:{category:`messages`,label:()=>b()},showDelete:{category:`messages`,label:()=>I()},showTools:{category:`messages`,label:()=>M(),help:()=>fe()},voiceInput:{category:`composer`,label:()=>E(),help:()=>F()},showChatAge:{category:`sidebar`,label:()=>j(),help:()=>L()},showChatProvider:{category:`sidebar`,label:()=>S(),help:()=>r()}};function X(e){return e.toLowerCase().normalize(`NFD`).replace(/\p{Diacritic}/gu,``)}function be(e,t){let n=X(t.trim()),r=new Map(J.map(e=>[e.id,e.label()])),i=new Map(J.map(e=>[e.id,[]]));for(let t of e){let e=Y[t],a=e?.category??`other`;n&&!X(`${e?e.label():t} ${e?.help?e.help():``} ${t} ${r.get(a)??``}`).includes(n)||i.get(a).push(t)}return J.map(e=>({id:e.id,label:r.get(e.id),keys:i.get(e.id)})).filter(e=>e.keys.length>0)}var xe=[`showSource`,`showReport`,`copyAssistant`,`copyUser`,`showDelete`,`showTools`,`voiceInput`,`showChatAge`,`showChatProvider`],Se={voiceInput:`voiceInput`};function Ce(e){return xe.includes(e)}function Z(e){return e===`admin`}function we(e){return e===!0?`on`:e===!1?`off`:`inherit`}function Q(e){return e===`on`?!0:e===`off`?!1:null}function Te(e){return Ce(e)?Se[e]:void 0}var $=n(),Ee={voiceInput:()=>f()};function De({prefKey:e,ui:t}){let n=B(z.admin.setUiPrefDefault),r=B(z.admin.setFeatureEnabled),i=Te(e),a=i?Ee[e]?.():void 0;return(0,$.jsxs)(`div`,{className:`oc-prefs__gov`,children:[(0,$.jsxs)(`div`,{className:`oc-prefs__gov-row`,children:[(0,$.jsx)(`span`,{className:`oc-prefs__gov-label`,children:m()}),(0,$.jsxs)(ye,{value:we(t.defaults[e]),onValueChange:t=>void n({key:e,value:Q(t)}),children:[(0,$.jsx)(_e,{size:`sm`,className:`w-36`,children:(0,$.jsx)(he,{})}),(0,$.jsxs)(ve,{children:[(0,$.jsx)(K,{value:`on`,children:o()}),(0,$.jsx)(K,{value:`off`,children:pe()}),(0,$.jsx)(K,{value:`inherit`,children:re()})]})]}),i?(0,$.jsxs)(`span`,{className:`oc-prefs__gov-gate`,children:[(0,$.jsx)(W,{checked:t.featuresEnabled[i]===!0,onCheckedChange:e=>void r({key:i,enabled:e===!0}),"aria-label":d()}),d()]}):null]}),a?(0,$.jsx)(`span`,{className:`oc-prefs__gov-help`,children:a}):null]})}function Oe(){let[e,t]=(0,q.useState)(``),[n,r]=(0,q.useState)(!1),i=y(z.me.getMe,{host:G}),a=i?.ui,o=Z(i?.role)&&n,s=B(z.me.setUiPref).withOptimisticUpdate(ge),c=(0,q.useMemo)(()=>a?be(Object.keys(a.effective),e):[],[a,e]);return a?(0,$.jsxs)(`div`,{className:`oc-prefs-panel`,children:[Z(i?.role)?(0,$.jsxs)(`label`,{className:`oc-prefs__gov-toggle`,children:[(0,$.jsx)(W,{checked:n,onCheckedChange:e=>r(e===!0),"aria-label":P()}),P()]}):null,o?(0,$.jsxs)(`div`,{className:`oc-prefs__gov-head`,children:[(0,$.jsx)(`p`,{children:se()}),(0,$.jsx)(`p`,{children:ae()}),(0,$.jsx)(`p`,{children:oe()})]}):null,(0,$.jsx)(U,{value:e,onChange:e=>t(e.target.value),placeholder:v(),"aria-label":v(),className:`mb-2`}),c.length===0?(0,$.jsx)(`div`,{className:`oc-prefs__empty`,children:ue()}):(0,$.jsx)(`div`,{className:`oc-prefs`,children:c.map(e=>(0,$.jsxs)(`div`,{className:`oc-prefs__group`,children:[(0,$.jsx)(`h4`,{className:`oc-prefs__cat`,children:e.label}),e.keys.map(e=>{let t=Y[e],n=t?t.label():e,r=t?.help?.(),i=a.locked[e],c=a.effective[e],l=a.userOverrides[e]!==void 0;return(0,$.jsxs)(`div`,{className:`oc-prefs__row${i?` is-locked`:``}${l&&!i?` is-overridden`:``}`,children:[(0,$.jsxs)(`div`,{className:`oc-prefs__info`,children:[(0,$.jsxs)(`span`,{className:`oc-prefs__label`,children:[n,i?(0,$.jsx)(`span`,{className:`oc-prefs__lock`,children:ce()}):l?null:(0,$.jsx)(`span`,{className:`oc-prefs__def`,children:le()})]}),r?(0,$.jsx)(`span`,{className:`oc-prefs__help`,children:r}):null]}),(0,$.jsxs)(`div`,{className:`oc-prefs__ctl`,children:[!i&&l?(0,$.jsx)(`button`,{type:`button`,className:`oc-prefs__reset`,onClick:()=>void s({key:e,value:null}),children:p()}):null,(0,$.jsx)(W,{checked:c,disabled:i,onCheckedChange:t=>void s({key:e,value:t===!0}),"aria-label":n})]}),o?(0,$.jsx)(De,{prefKey:e,ui:a}):null]},e)})]},e.id))})]}):(0,$.jsx)(`div`,{className:`oc-prefs__empty`,children:u()})}function ke(){let e=y(z.me.getMe,{host:G}),t=B(z.me.setLocale),n=B(z.me.setMyName),r=me(),o=e?.locale??`default`,u=e?.name??``,[d,f]=(0,q.useState)(null),p=d??u,m=p.trim()!==u.trim();async function v(){try{await n({name:p}),f(null),r.success(g())}catch(e){r.error(h(),e)}}return(0,$.jsxs)(`div`,{className:`oc-appearance`,children:[(0,$.jsxs)(`section`,{className:`oc-show__section`,children:[(0,$.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,$.jsx)(`h2`,{className:`oc-show__title`,children:te()}),(0,$.jsx)(`p`,{className:`oc-show__desc`,children:ee()})]}),(0,$.jsxs)(`div`,{className:`oc-show__row`,children:[(0,$.jsx)(U,{className:`max-w-xs`,value:p,maxLength:120,placeholder:l(),onChange:e=>f(e.target.value),onKeyDown:e=>{e.key===`Enter`&&m&&(e.preventDefault(),v())}}),(0,$.jsx)(H,{size:`sm`,disabled:!m,onClick:()=>void v(),children:V()})]}),(0,$.jsx)(`p`,{className:`oc-show__desc`,children:ne()})]}),(0,$.jsxs)(`section`,{className:`oc-show__section`,children:[(0,$.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,$.jsx)(`h2`,{className:`oc-show__title`,children:D()}),(0,$.jsx)(`p`,{className:`oc-show__desc`,children:i()})]}),(0,$.jsx)(`div`,{className:`oc-show__row`,children:[`fr`,`en`,`default`].map(e=>(0,$.jsx)(H,{variant:o===e?`default`:`outline`,size:`sm`,onClick:()=>void t({locale:e==="default"?null:e}),children:e===`fr`?c():e===`en`?ie():a()},e))}),(0,$.jsx)(`p`,{className:`oc-show__desc`,children:O()})]}),(0,$.jsxs)(`section`,{className:`oc-show__section`,children:[(0,$.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,$.jsx)(`h2`,{className:`oc-show__title`,children:_()}),(0,$.jsx)(`p`,{className:`oc-show__desc`,children:s()})]}),(0,$.jsx)(Oe,{})]})]})}export{ke as PreferencesTab};
@@ -1,3 +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,B as a,Bd as o,Dd as s,Ed as c,Fd as l,Gd as u,H as d,Hd as f,Id as p,Ld as ee,Md as m,Nd as h,Od as g,Pd as _,Qd as v,Rd as y,TO as b,U as x,Ud as S,V as C,Vd as w,Wd as T,jd as E,kd as D,vO as O,wO as k,z as A,zd as j}from"./dist-DRXIQewX.js";import{d as M,f as N,i as P,l as F,n as I,r as L,t as R,u as z}from"./FieldLabel-DbxkeyLF.js";import{t as B}from"./button-CrkRjd-T.js";import{A as V,C as H,S as U,_ as W,b as G,x as K,y as q}from"./index-DcMWPy01.js";/* empty css */var J=t(e(),1),Y=n(),X={media_delivery:{label:o,help:j},documentary_fetch:{label:y,help:ee},inbound_files:{label:p,help:l},history_summary:{label:x,help:d}},Z={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`},Q={outboundDir:g,references:s,files:c,previous_summary:C,new_messages:a,max_chars:A};function $(){let e=b(O.admin.listInstances,{}),[t,n]=(0,J.useState)(null);if(e===void 0)return(0,Y.jsx)(`div`,{className:`oc-settings__tab-loading`,"aria-busy":`true`});if(e.length===0)return(0,Y.jsx)(`div`,{className:`oc-injtab`,children:(0,Y.jsx)(`p`,{className:`oc-admin__hint`,children:h()})});let r=e.find(e=>e._id===t)??e[0];return(0,Y.jsxs)(`div`,{className:`oc-injtab`,children:[(0,Y.jsxs)(`div`,{className:`oc-injtab__head`,children:[(0,Y.jsx)(I,{label:u(),help:T()}),(0,Y.jsxs)(`label`,{className:`oc-injtab__picker`,children:[(0,Y.jsx)(`span`,{children:_()}),(0,Y.jsxs)(q,{value:r._id,onValueChange:e=>n(e),children:[(0,Y.jsx)(U,{size:`sm`,className:`min-w-44`,children:(0,Y.jsx)(H,{})}),(0,Y.jsx)(G,{children:e.map(e=>(0,Y.jsx)(K,{value:e._id,children:e.displayName??e.name},e._id))})]})]})]}),(0,Y.jsx)(te,{instance:r},r._id)]})}function te({instance:e}){let t=k(O.admin.upsertInstanceConfig),n=V(),i=e.config??{},[a,o]=(0,J.useState)(()=>P(i)),[s,c]=(0,J.useState)(!1),l=a.promptInjections,u=(e,t)=>o({...a,promptInjections:{...l,[e]:{...l[e],...t}}});async function d(){c(!0);try{await t({instanceId:e._id,config:L(a,i)})}catch(e){n.error(v(),e)}finally{c(!1)}}return(0,Y.jsxs)(`div`,{className:`oc-injtab__body`,children:[z.map(e=>(0,Y.jsx)(ne,{injKey:e,def:F[e],i18n:X[e],row:l[e]??{enabled:!0,template:F[e].defaultTemplate},onChange:t=>u(e,t)},e)),(0,Y.jsx)(`div`,{className:`oc-injtab__actions`,children:(0,Y.jsx)(B,{size:`sm`,onClick:()=>void d(),disabled:s,children:r()})})]})}function ne({injKey:e,def:t,i18n:n,row:r,onChange:a}){let[o,s]=(0,J.useState)(!1),c=r.template.trim()!==t.defaultTemplate,l=t.togglable&&!r.enabled,u=Object.fromEntries(t.placeholders.map(e=>[e,Z[e]??`{${e}}`])),d=M(e,r),p=d?N(d,u):``;return(0,Y.jsxs)(`section`,{className:`oc-injcard`,children:[(0,Y.jsxs)(`div`,{className:`oc-injcard__head`,children:[t.togglable?(0,Y.jsxs)(`label`,{className:`oc-field--row`,children:[(0,Y.jsx)(W,{checked:r.enabled,onCheckedChange:e=>a({enabled:e===!0})}),(0,Y.jsx)(I,{label:n.label(),help:n.help()})]}):(0,Y.jsx)(I,{label:n.label(),help:n.help()}),c&&(0,Y.jsx)(`span`,{className:`oc-injection__badge`,children:f()})]}),(0,Y.jsx)(`textarea`,{className:`oc-injcard__text`,value:r.template,disabled:l,rows:8,spellCheck:!1,onChange:e=>a({template:e.target.value})}),(0,Y.jsxs)(`div`,{className:`oc-injection__foot`,children:[(0,Y.jsxs)(`div`,{className:`oc-injcard__phs`,children:[(0,Y.jsx)(`span`,{className:`oc-injection__ph`,children:w()}),t.placeholders.map(e=>(0,Y.jsxs)(`span`,{className:`oc-injcard__ph-chip`,children:[(0,Y.jsx)(`code`,{children:`{${e}}`}),(0,Y.jsx)(R,{text:(Q[e]??(()=>e))()})]},e))]}),(0,Y.jsxs)(`div`,{className:`oc-injcard__btns`,children:[(0,Y.jsx)(B,{variant:`ghost`,size:`sm`,onClick:()=>s(e=>!e),children:o?E():m()}),c&&(0,Y.jsx)(B,{variant:`ghost`,size:`sm`,onClick:()=>a({template:t.defaultTemplate}),children:S()})]})]}),o&&(0,Y.jsx)(`div`,{className:`oc-injcard__preview`,children:p?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`pre`,{className:`oc-injcard__previewtext`,children:p}),(0,Y.jsx)(`span`,{className:`oc-injection__ph`,children:i()})]}):(0,Y.jsx)(`span`,{className:`oc-injection__ph`,children:D()})})]})}export{$ as PromptInjectionsTab};
@@ -1 +0,0 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$m as r,Ah as i,Ch as a,Dh as o,Eh as s,Fh as c,Ih as l,Jm as u,Lh as d,Mh as f,Nh as p,Oh as m,Ph as h,Qm as g,Sh as _,TO as v,Th as y,Xm as b,Ym as x,Zm as S,_h as ee,bh as te,ch as ne,dh as re,eh as ie,fh as ae,gh as C,hh as w,jh as T,kh as E,lh as D,mh as O,nh as k,ph as A,th as j,uh as M,vO as N,vh as P,wO as F,wh as I,xh as L,yh as R}from"./dist-DRXIQewX.js";import{t as z}from"./button-CrkRjd-T.js";import{A as B,X as V,Z as H,_ as U,j as W,m as G,xt as K}from"./index-DcMWPy01.js";import{t as q}from"./roleDescriptions-n6KA5Mb1.js";var J=t(e(),1),Y=n(),X=[{group:()=>d(),keys:[{key:`traces.read`,label:()=>f()},{key:`traces.read.content`,label:()=>T(),phi:!0},{key:`traces.write`,label:()=>i()}]},{group:()=>l(),keys:[{key:`kpi.read`,label:()=>f()},{key:`kpi.write`,label:()=>i()}]},{group:()=>c(),keys:[{key:`openclaw.query`,label:()=>E()},{key:`anomalies.read`,label:()=>m()},{key:`anomalies.report`,label:()=>o()}]},{group:()=>h(),keys:[{key:`chats.read`,label:()=>f()},{key:`selfheal`,label:()=>y()}]},{group:()=>p(),keys:[{key:`admin.manage`,label:()=>s()}]}],oe=X.flatMap(e=>e.keys.map(e=>e.key));function Z(e){return e.includes(`*`)}var Q={key:``,name:``,description:``};function $(){let e=v(N.apiKeys.listRoles,{}),t=F(N.apiKeys.createRole),n=F(N.apiKeys.ensureRolesSeeded),i=F(N.apiKeys.updateRolePermissions).withOptimisticUpdate((e,{roleId:t,permissions:n})=>{let r=e.getQuery(N.apiKeys.listRoles,{});r&&e.setQuery(N.apiKeys.listRoles,{},r.map(e=>e._id===t?{...e,permissions:n}:e))}),o=W(),s=B(),[c,l]=(0,J.useState)(!1),[d,f]=(0,J.useState)(Q),[p,m]=(0,J.useState)(new Set);(0,J.useEffect)(()=>{n({}).catch(e=>{s.error(a(),e)})},[n,s]);let h=e??[];async function y(e,t){if(Z(e.permissions)||p.has(e._id))return;let n=e.permissions.includes(t)?e.permissions.filter(e=>e!==t):[...e.permissions,t];if(!(e.builtin&&!await o({title:_({name:e.name}),description:L(),confirmLabel:te()}))){m(t=>new Set(t).add(e._id));try{await i({roleId:e._id,permissions:n})}catch(e){s.error(R(),e)}finally{m(t=>{let n=new Set(t);return n.delete(e._id),n})}}}async function T(){try{await t({key:d.key,name:d.name,description:d.description||void 0,permissions:[]}),f(Q),l(!1)}catch(e){s.error(P(),e)}}let E=e===void 0,$=!E&&h.length===0;return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(`p`,{className:`oc-admin__hint`,children:[ee(),` `,(0,Y.jsx)(`code`,{children:`admin`}),` `,C(),` `,(0,Y.jsx)(`code`,{children:`traces.read.content`}),` `,w()]}),(0,Y.jsxs)(`div`,{className:`oc-dt`,children:[(0,Y.jsxs)(`div`,{className:`oc-dt__bar`,children:[(0,Y.jsx)(`h2`,{className:`oc-dt__title`,children:O()}),(0,Y.jsx)(`div`,{className:`oc-dt__bar-actions`,children:(0,Y.jsx)(z,{size:`sm`,onClick:()=>{f(Q),l(!0)},children:A()})})]}),E?(0,Y.jsx)(`p`,{className:`oc-admin__hint`,children:ae()}):$?(0,Y.jsx)(`p`,{className:`oc-admin__hint`,children:re()}):(0,Y.jsx)(`div`,{className:`oc-matrix__scroll`,children:(0,Y.jsxs)(`table`,{className:`oc-matrix`,children:[(0,Y.jsxs)(`thead`,{children:[(0,Y.jsxs)(`tr`,{children:[(0,Y.jsx)(`th`,{className:`oc-matrix__corner`,rowSpan:2,children:M()}),X.map(e=>(0,Y.jsx)(`th`,{className:`oc-matrix__group`,colSpan:e.keys.length,children:e.group()},e.group()))]}),(0,Y.jsx)(`tr`,{children:X.flatMap(e=>e.keys.map(e=>(0,Y.jsxs)(`th`,{className:`oc-matrix__perm`,title:e.phi?I({key:e.key}):e.key,children:[e.label(),e.phi?(0,Y.jsx)(`span`,{className:`oc-matrix__phi`,children:` ⚠`}):null]},e.key)))})]}),(0,Y.jsx)(`tbody`,{children:h.map(e=>{let t=Z(e.permissions),n=p.has(e._id);return(0,Y.jsxs)(`tr`,{children:[(0,Y.jsxs)(`th`,{className:`oc-matrix__rolecell`,children:[(0,Y.jsxs)(`div`,{className:`oc-matrix__rolename`,children:[(0,Y.jsx)(`span`,{children:e.name}),(0,Y.jsx)(`code`,{className:`oc-matrix__rolekey`,children:e.key}),e.builtin?(0,Y.jsxs)(V,{variant:`outline`,className:`gap-1`,children:[(0,Y.jsx)(K,{}),` `,D()]}):(0,Y.jsx)(V,{variant:`secondary`,children:ne()})]}),q(e)?(0,Y.jsx)(`p`,{className:`oc-matrix__roledesc`,children:q(e)}):null]}),oe.map(r=>(0,Y.jsx)(`td`,{className:`oc-matrix__cell`,children:(0,Y.jsx)(U,{checked:t||e.permissions.includes(r),disabled:t||n,"aria-label":`${e.key} · ${r}`,title:t?k():n?j():r,onCheckedChange:()=>void y(e,r)})},r))]},e.key)})})]})})]}),(0,Y.jsx)(G,{open:c,onOpenChange:l,title:ie(),description:r(),canSubmit:!!(d.key&&d.name),onSubmit:T,submitLabel:g(),children:(0,Y.jsxs)(`div`,{className:`oc-form`,children:[(0,Y.jsxs)(`label`,{className:`oc-field`,children:[(0,Y.jsx)(`span`,{className:`oc-field__label`,children:S()}),(0,Y.jsx)(H,{value:d.key,placeholder:b(),onChange:e=>f({...d,key:e.target.value})})]}),(0,Y.jsxs)(`label`,{className:`oc-field`,children:[(0,Y.jsx)(`span`,{className:`oc-field__label`,children:x()}),(0,Y.jsx)(H,{value:d.name,onChange:e=>f({...d,name:e.target.value})})]}),(0,Y.jsxs)(`label`,{className:`oc-field`,children:[(0,Y.jsx)(`span`,{className:`oc-field__label`,children:u()}),(0,Y.jsx)(H,{value:d.description,onChange:e=>f({...d,description:e.target.value})})]})]})})]})}export{$ as RolesTab};
@@ -1 +0,0 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$C as r,AC as i,Aw as ee,BC as a,CC as o,Cw as te,DC as s,Dw as ne,EC as c,Ew as re,FC as l,Fw as ie,GC as ae,HC as oe,IC as u,Iw as se,JC as ce,KC as le,LC as d,Lw as ue,MC as de,Mw as fe,NC as f,Nw as pe,OC as p,Ow as me,PC as m,Pw as he,QC as ge,RC as h,SC as g,SO as _e,Sw as ve,TC as _,TO as v,Tw as ye,UC as be,VC as xe,WC as Se,XC as Ce,YC as we,ZC as Te,_C as y,_w as Ee,aw as De,bC as b,bw as Oe,cw as ke,dw as Ae,ew as je,fw as Me,gw as Ne,hw as Pe,iw as Fe,jC as x,jw as S,kC as C,kw as Ie,lw as Le,mw as Re,nw as ze,ow as Be,pw as Ve,qC as He,rw as Ue,sw as We,tw as Ge,uw as Ke,vC as w,vO as T,vw as qe,wC as E,wO as D,ww as Je,xC as O,xw as Ye,yC as k,yw as Xe,zC as A}from"./dist-DRXIQewX.js";import{n as Ze}from"./dist-DS_sZFhE.js";import{i as Qe}from"./dist-H7gCiaFZ.js";import{t as j}from"./button-CrkRjd-T.js";import{$ as M,A as $e,At as et,C as N,Dt as P,Mt as tt,Q as F,S as I,X as L,Z as R,b as z,et as B,j as nt,jt as rt,m as it,nt as V,rt as H,tt as U,x as W,y as G}from"./index-DcMWPy01.js";import{t as at}from"./FilterBar-DR1-M_rz.js";import{t as ot}from"./DataTableShell-CJHDSNd8.js";import{t as st}from"./roleDescriptions-n6KA5Mb1.js";var K=t(e(),1),q=n(),ct=[{value:`never`,label:()=>o(),days:null},{value:`30`,label:()=>g(),days:30},{value:`90`,label:()=>O(),days:90}],lt=720*60*60*1e3,J=`__all__`,Y={name:``,roleKey:``,description:``};function X(){let e=tt({from:`/settings/serviceAccounts`}),t=rt({from:`/settings/serviceAccounts`}),n=e.q??``,i=e.status??J,[a,o]=(0,K.useState)(J),s=e=>void t({search:t=>({...t,q:e||void 0}),replace:!0}),c=e=>void t({search:t=>({...t,status:e===J?void 0:e})}),l=v(T.apiKeys.listServiceAccounts,{filter:{q:n||void 0,role:a===J?void 0:a,disabled:i===J?void 0:i===`disabled`}}),u=v(T.apiKeys.listKeys,{}),d=v(T.apiKeys.listRoles,{}),de=D(T.apiKeys.createServiceAccount),f=D(T.apiKeys.updateServiceAccount),p=D(T.apiKeys.deleteServiceAccount),m=_e(T.apiKeys.mintApiKey),h=D(T.apiKeys.revokeApiKey),g=nt(),_=$e(),y=n!==``||a!==J||i!==J;function b(){o(J),t({search:{},replace:!0})}let[x,C]=(0,K.useState)(!1),[w,E]=(0,K.useState)(Y),[O,k]=(0,K.useState)(null),[A,Ze]=(0,K.useState)(new Set),[M,P]=(0,K.useState)(null),F=(0,K.useRef)(!1),[B,V]=(0,K.useState)(new Set),[H,U]=(0,K.useState)({}),[lt,X]=(0,K.useState)(null),Z=(0,K.useMemo)(()=>{let e=new Map;for(let t of u??[]){let n=e.get(t.serviceAccountId)??[];n.push(t),e.set(t.serviceAccountId,n)}return e},[u]);function Q(e){Ze(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})}async function ft(){try{O?(await f({serviceAccountId:O,name:w.name,roleKey:w.roleKey,description:w.description}),_.success(Ge())):await de({name:w.name,roleKey:w.roleKey,description:w.description||void 0}),E(Y),k(null),C(!1)}catch(e){_.error(O?ze():Ue(),e)}}function pt(e){E({name:e.name,roleKey:e.roleKey,description:e.description??``}),k(e._id),C(!0)}async function $(e){if(F.current)return;F.current=!0;let t=H[e._id]??`never`,n=ct.find(e=>e.value===t)?.days??null,r=n?Date.now()+n*24*60*60*1e3:void 0;P(e._id);try{let t=await m({serviceAccountId:e._id,expiresAt:r});X({accountName:e.name,plaintext:t.plaintext,prefix:t.prefix,lastFour:t.lastFour})}catch(e){_.error(je(),e)}finally{F.current=!1,P(null)}}async function mt(e){if(await g({title:r(),description:(0,q.jsxs)(q.Fragment,{children:[ge(),` `,(0,q.jsx)(`span`,{className:`font-mono`,children:e.name}),` `,Te(),` `,(0,q.jsx)(`strong`,{children:Ce()}),` `,we()]}),confirmWord:e.name,confirmLabel:ce(),destructive:!0}))try{await p({serviceAccountId:e._id}),_.success(He(),e.name)}catch(e){_.error(le(),e)}}async function ht(e){if(await g({title:ae(),description:(0,q.jsxs)(q.Fragment,{children:[Se(),` `,(0,q.jsxs)(`span`,{className:`font-mono`,children:[e.prefix,`…`,e.lastFour]}),` `,be()]}),confirmLabel:oe(),destructive:!0})&&!B.has(e._id)){V(t=>new Set(t).add(e._id));try{await h({keyId:e._id})}catch(e){_.error(xe(),e)}finally{V(t=>{let n=new Set(t);return n.delete(e._id),n})}}}return(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(`p`,{className:`oc-admin__hint`,children:ue()}),(0,q.jsxs)(at,{q:n,onQChange:s,searchPlaceholder:se(),onReset:b,canReset:y,children:[(0,q.jsxs)(G,{value:a,onValueChange:o,children:[(0,q.jsx)(I,{size:`sm`,className:`w-40`,children:(0,q.jsx)(N,{placeholder:ie()})}),(0,q.jsxs)(z,{children:[(0,q.jsx)(W,{value:J,children:he()}),(d??[]).map(e=>(0,q.jsx)(W,{value:e.key,children:e.key},e._id))]})]}),(0,q.jsxs)(G,{value:i,onValueChange:c,children:[(0,q.jsx)(I,{size:`sm`,className:`w-36`,children:(0,q.jsx)(N,{})}),(0,q.jsxs)(z,{children:[(0,q.jsx)(W,{value:J,children:pe()}),(0,q.jsx)(W,{value:`active`,children:fe()}),(0,q.jsx)(W,{value:`disabled`,children:S()})]})]})]}),(0,q.jsx)(ot,{title:ee(),rows:l,addLabel:Ie(),onAdd:()=>{E(Y),k(null),C(!0)},emptyHint:me(),isExpanded:e=>A.has(e._id),renderExpanded:e=>(0,q.jsx)(ut,{account:e,keys:Z.get(e._id)??[],onRevoke:ht,revoking:B}),rowActions:e=>[{label:Je(),onSelect:()=>pt(e)},{label:ne(),onSelect:()=>void $(e)},{label:A.has(e._id)?re():ye(),onSelect:()=>Q(e._id)},{label:te(),variant:`destructive`,onSelect:()=>void mt(e)}],columns:[{header:``,className:`w-8`,cell:e=>(0,q.jsx)(j,{variant:`ghost`,size:`icon-sm`,"aria-label":A.has(e._id)?ve():Ye(),onClick:()=>Q(e._id),children:A.has(e._id)?(0,q.jsx)(Qe,{}):(0,q.jsx)(et,{})})},{header:Oe(),sort:e=>e.name,cell:e=>(0,q.jsxs)(`div`,{className:`flex flex-col`,children:[(0,q.jsx)(`span`,{children:e.name}),e.description?(0,q.jsx)(`span`,{className:`text-muted-foreground text-xs`,children:e.description}):null]})},{header:Xe(),sort:e=>e.roleKey,cell:e=>(0,q.jsx)(L,{variant:`secondary`,children:e.roleKey})},{header:qe(),sort:e=>+!!e.disabled,cell:e=>e.disabled?(0,q.jsx)(L,{variant:`destructive`,children:S()}):(0,q.jsx)(L,{variant:`outline`,children:fe()})},{header:Ee(),cell:e=>(0,q.jsxs)(G,{value:H[e._id]??`never`,onValueChange:t=>U(n=>({...n,[e._id]:t})),children:[(0,q.jsx)(I,{size:`sm`,className:`w-32`,children:(0,q.jsx)(N,{})}),(0,q.jsx)(z,{children:ct.map(e=>(0,q.jsx)(W,{value:e.value,children:e.label()},e.value))})]})},{header:Ne(),sort:e=>(Z.get(e._id)??[]).filter(e=>!e.disabled).length,cell:e=>{let t=(Z.get(e._id)??[]).filter(e=>!e.disabled).length;return(0,q.jsx)(`span`,{className:`oc-sa__keycount`,children:M===e._id?Pe():Re({count:t})})}}]}),(0,q.jsx)(it,{open:x,onOpenChange:e=>{C(e),e||k(null)},title:O?Ve():Ke(),description:O?Me():Le(),canSubmit:!!(w.name&&w.roleKey),onSubmit:ft,submitLabel:O?Ae():ke(),children:(0,q.jsxs)(`div`,{className:`oc-form`,children:[(0,q.jsxs)(`label`,{className:`oc-field`,children:[(0,q.jsx)(`span`,{className:`oc-field__label`,children:We()}),(0,q.jsx)(R,{value:w.name,onChange:e=>E({...w,name:e.target.value})})]}),(0,q.jsxs)(`label`,{className:`oc-field`,children:[(0,q.jsx)(`span`,{className:`oc-field__label`,children:Be()}),(0,q.jsxs)(G,{value:w.roleKey||void 0,onValueChange:e=>E({...w,roleKey:e}),children:[(0,q.jsx)(I,{className:`w-full`,children:(0,q.jsx)(N,{placeholder:De()})}),(0,q.jsx)(z,{children:(d??[]).map(e=>(0,q.jsxs)(W,{value:e.key,children:[e.name,` (`,e.key,`)`]},e._id))})]}),(()=>{let e=(d??[]).find(e=>e.key===w.roleKey),t=e?st(e):null;return t?(0,q.jsx)(`span`,{className:`text-muted-foreground text-xs`,children:t}):null})()]}),(0,q.jsxs)(`label`,{className:`oc-field`,children:[(0,q.jsx)(`span`,{className:`oc-field__label`,children:Fe()}),(0,q.jsx)(R,{value:w.description,onChange:e=>E({...w,description:e.target.value})})]})]})}),(0,q.jsx)(dt,{minted:lt,onClose:()=>X(null)})]})}function ut({account:e,keys:t,onRevoke:n,revoking:r}){return(0,q.jsxs)(`div`,{className:`oc-sa__keys`,children:[(0,q.jsxs)(`div`,{className:`oc-sa__keys-head`,children:[a(),` `,(0,q.jsx)(`span`,{className:`font-medium`,children:e.name})]}),t.length===0?(0,q.jsx)(`p`,{className:`oc-admin__hint`,children:A()}):(0,q.jsxs)(`table`,{className:`oc-sa__keytable`,children:[(0,q.jsx)(`thead`,{children:(0,q.jsxs)(`tr`,{children:[(0,q.jsx)(`th`,{children:h()}),(0,q.jsx)(`th`,{children:d()}),(0,q.jsx)(`th`,{children:u()}),(0,q.jsx)(`th`,{children:l()}),(0,q.jsx)(`th`,{children:m()}),(0,q.jsx)(`th`,{children:f()}),(0,q.jsx)(`th`,{})]})}),(0,q.jsx)(`tbody`,{children:t.map(t=>(0,q.jsxs)(`tr`,{children:[(0,q.jsx)(`td`,{children:(0,q.jsxs)(`code`,{className:`oc-sa__keyid`,children:[t.prefix,`…`,t.lastFour]})}),(0,q.jsx)(`td`,{children:(0,q.jsx)(L,{variant:`secondary`,children:e.roleKey})}),(0,q.jsx)(`td`,{children:Z(t.createdAt)}),(0,q.jsx)(`td`,{className:Q(t.lastUsedAt)?`oc-sa__stale`:``,children:ft(t.lastUsedAt)}),(0,q.jsx)(`td`,{children:pt(t.expiresAt)}),(0,q.jsx)(`td`,{children:$(t)}),(0,q.jsx)(`td`,{className:`text-right`,children:t.disabled?null:(0,q.jsx)(j,{variant:`destructive`,size:`sm`,disabled:r.has(t._id),onClick:()=>n(t),children:r.has(t._id)?de():x()})})]},t._id))})]})]})}function dt({minted:e,onClose:t}){let[n,r]=(0,K.useState)(!1);async function ee(){if(e)try{await navigator.clipboard.writeText(e.plaintext),r(!0),window.setTimeout(()=>r(!1),2e3)}catch{}}return(0,q.jsx)(F,{open:e!==null,onOpenChange:e=>{e||(r(!1),t())},children:e?(0,q.jsxs)(M,{className:`max-w-lg`,showCloseButton:!1,onInteractOutside:e=>e.preventDefault(),onEscapeKeyDown:e=>e.preventDefault(),children:[(0,q.jsxs)(V,{children:[(0,q.jsx)(H,{children:i()}),(0,q.jsx)(B,{children:C({name:e.accountName})})]}),(0,q.jsx)(`div`,{className:`oc-sa__minted-warning`,children:p()}),(0,q.jsxs)(`div`,{className:`oc-sa__minted-box`,children:[(0,q.jsx)(`code`,{className:`oc-sa__minted-plain`,children:e.plaintext}),(0,q.jsxs)(j,{variant:`outline`,size:`sm`,onClick:()=>void ee(),"aria-label":s(),children:[n?(0,q.jsx)(Ze,{}):(0,q.jsx)(P,{}),n?c():_()]})]}),(0,q.jsx)(U,{children:(0,q.jsx)(j,{onClick:()=>{r(!1),t()},children:E()})})]}):null})}function Z(e){return new Date(e).toLocaleString(`fr-FR`)}function Q(e){return e===null?!1:Date.now()-e>lt}function ft(e){return e===null?b():new Date(e).toLocaleString(`fr-FR`)}function pt(e){return e===null?`—`:new Date(e).toLocaleDateString(`fr-FR`)}function $(e){return e.disabled?(0,q.jsx)(L,{variant:`destructive`,children:k()}):e.expiresAt!==null&&e.expiresAt<Date.now()?(0,q.jsx)(L,{variant:`outline`,children:w()}):(0,q.jsx)(L,{variant:`outline`,children:y()})}export{X as ServiceAccountsTab};
@@ -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,Dt as o,Et as s,J as c,Mt as l,Ot as u,Q as d,St as f,TO as p,Tt as m,X as h,Y as g,Z as _,_t as v,at as y,bt as b,ct as x,dt as S,et as C,ft as w,gt as T,ht as E,it as D,jt as O,kt as k,lt as A,mt as j,nt as M,ot as N,pt as P,rt as F,st as I,tt as L,ut as R,vO as z,vt as B,wO as V,wt as H,xt as U,yt as W}from"./dist-DRXIQewX.js";import{t as G}from"./button-CrkRjd-T.js";import{j as K}from"./index-DcMWPy01.js";import{t as q}from"./DataTableShell-CJHDSNd8.js";var J=t(e(),1),Y=n(),X={hung:()=>E(),wrong_result:()=>j(),error:()=>P(),other:()=>w()},Z=e=>(e&&X[e]?.())??e??`—`;function Q(e){let t=e.slice(e.lastIndexOf(`:`)+1)||e;return t.length>12?`${t.slice(0,12)}…`:t}function $({data:e}){let t=e.snapshot,n=V(z.subAgentReports.respondToReport),[i,a]=(0,J.useState)(e.thread),[o,s]=(0,J.useState)(``),[c,l]=(0,J.useState)(!1);async function u(){let t=o.trim();if(!(!t||c)){l(!0);try{await n({reportId:e._id,text:t}),a(e=>[...e,{authorRole:`admin`,text:t,at:Date.now()}]),s(``)}finally{l(!1)}}}return(0,Y.jsxs)(`div`,{className:`oc-fbadmin__detail`,children:[(0,Y.jsx)(`div`,{className:`oc-fbadmin__row`,children:(0,Y.jsxs)(`span`,{className:`oc-fbadmin__meta`,children:[Z(e.category),` · `,S({failed:t.failedCount,total:t.totalCount}),t.openclawModel?` · ${t.openclawModel}`:``,t.openclawRuntime?` (${t.openclawRuntime})`:``]})}),e.comment?(0,Y.jsxs)(`section`,{children:[(0,Y.jsx)(`h4`,{className:`oc-fbadmin__h`,children:R()}),(0,Y.jsx)(`p`,{className:`oc-fbadmin__comment`,children:e.comment})]}):null,(0,Y.jsxs)(`section`,{children:[(0,Y.jsx)(`h4`,{className:`oc-fbadmin__h`,children:A()}),i.length>0?(0,Y.jsx)(`div`,{className:`oc-fbadmin__thread`,children:i.map((e,t)=>(0,Y.jsxs)(`div`,{className:`oc-notif__msg oc-notif__msg--${e.authorRole}`,children:[(0,Y.jsx)(`span`,{className:`oc-notif__msg-who`,children:e.authorRole===`admin`?x():I()}),(0,Y.jsx)(`span`,{className:`oc-notif__msg-text`,children:e.text})]},t))}):(0,Y.jsx)(`p`,{className:`oc-fbadmin__meta`,children:N()}),(0,Y.jsx)(`textarea`,{className:`oc-feedback__textarea`,placeholder:y(),value:o,maxLength:2e3,rows:3,onChange:e=>s(e.target.value.slice(0,2e3))}),(0,Y.jsx)(`div`,{className:`oc-fbadmin__row`,style:{justifyContent:`flex-end`},children:(0,Y.jsx)(G,{size:`sm`,onClick:()=>void u(),disabled:!o.trim()||c,children:c?F():D()})})]}),(0,Y.jsxs)(`section`,{children:[(0,Y.jsxs)(`h4`,{className:`oc-fbadmin__h`,children:[M({count:t.children.length}),t.childrenTruncated?` ${L()}`:``,t.textTruncated?` ${C()}`:``]}),(0,Y.jsx)(`div`,{className:`oc-fbadmin__ctx`,children:t.children.map((e,n)=>(0,Y.jsxs)(`div`,{className:`oc-fbadmin__ctx-turn`,children:[(0,Y.jsxs)(`span`,{className:`oc-fbadmin__ctx-role`,children:[(e.taskName?.trim()||Q(e.childSessionKey))+` · ${e.status}`,e.phase?` · ${e.phase}`:``,e.childSessionKey===t.flaggedChildSessionKey?` · ${r()}`:``]}),e.errorMessage?(0,Y.jsx)(`pre`,{className:`oc-msg__source-pre`,children:e.errorMessage}):null,e.resultText?(0,Y.jsx)(`pre`,{className:`oc-msg__source-pre`,children:e.resultText}):null]},n))})]}),t.parentText?(0,Y.jsxs)(`section`,{children:[(0,Y.jsx)(`h4`,{className:`oc-fbadmin__h`,children:d()}),(0,Y.jsx)(`pre`,{className:`oc-msg__source-pre`,children:t.parentText})]}):null,(0,Y.jsxs)(`section`,{children:[(0,Y.jsx)(`h4`,{className:`oc-fbadmin__h`,children:_()}),(0,Y.jsx)(`p`,{className:`oc-fbadmin__env`,children:[t.parentStatus?`status: ${t.parentStatus}`:null,t.parentErrorCode?`code: ${t.parentErrorCode}`:null,t.parentRunId?`run ${t.parentRunId.slice(0,12)}…`:null,e.correlationId?`corr ${e.correlationId.slice(0,16)}…`:null,t.openclawProvider].filter(Boolean).join(` · `)||`—`})]})]})}function ee(){let e=p(z.subAgentReports.listForAdmin,{}),t=V(z.subAgentReports.readReport),n=V(z.subAgentReports.deleteReport),r=K(),[d,_]=(0,J.useState)(null),[y,x]=(0,J.useState)({});async function S(e){if(d===e._id){_(null);return}if(!y[e._id]){let n=await t({reportId:e._id});x(t=>({...t,[e._id]:n}))}_(e._id)}async function C(e){await r({title:h(),description:g(),confirmLabel:c(),destructive:!0})&&(await n({reportId:e._id}),d===e._id&&_(null))}return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(`p`,{className:`oc-admin__hint`,children:[i(),` `,(0,Y.jsx)(`strong`,{children:k()}),` `,u()]}),(0,Y.jsx)(q,{title:l(),rows:e,emptyHint:O(),isExpanded:e=>d===e._id&&!!y[e._id],renderExpanded:e=>y[e._id]?(0,Y.jsx)($,{data:y[e._id]}):null,columns:[{header:o(),cell:e=>new Date(e.at).toLocaleString(`fr-FR`),sort:e=>e.at},{header:s(),cell:e=>Z(e.category),sort:e=>Z(e.category)},{header:m(),cell:e=>`${e.failedCount}/${e.totalCount}`,sort:e=>e.failedCount},{header:H(),cell:e=>(e.reporterEmail||e.reporterName||`—`)+(e.impersonated&&e.realOperatorEmail?` ${U({operator:e.realOperatorEmail})}`:``),sort:e=>e.reporterEmail||e.reporterName||null},{header:a(),cell:e=>e.hasComment?`✎`:`—`,sort:e=>+!!e.hasComment},{header:f(),cell:e=>e.answered?(0,Y.jsx)(`span`,{className:`oc-fbadmin__pill is-ok`,children:b()}):(0,Y.jsx)(`span`,{className:`oc-fbadmin__pill`,children:W()}),sort:e=>+!!e.answered}],rowActions:e=>[{label:d===e._id?v():B(),onSelect:()=>void S(e)},{label:T(),onSelect:()=>void C(e),variant:`destructive`}]})]})}export{ee as SubAgentReportsTab};
@@ -1 +0,0 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$T as r,AE as i,AT as a,BE as o,BT as s,CE as c,CT as l,DE as u,DT as d,ED as f,EE as p,ET as m,FE as h,FT as g,G as ee,GT as _,HD as v,HT as te,IE as ne,IT as re,JT as ie,K as y,KT as ae,LE as oe,LT as se,ME as ce,MT as le,NE as ue,NT as de,OE as fe,OT as pe,PE as me,PT as he,QT as ge,RE as _e,RT as b,SE as ve,SO as ye,ST as x,TD as be,TE as xe,TO as S,TT as Se,UD as Ce,UT as we,VD as Te,VT as Ee,W as De,WT as Oe,XT as ke,YT as Ae,ZT as je,_E as Me,aE as Ne,bE as Pe,bT as Fe,cE as Ie,dE as Le,eE as Re,fE as ze,gE as Be,hE as Ve,iE as He,jE as Ue,jT as We,kE as Ge,kT as Ke,lE as qe,mE as Je,n as Ye,nE as Xe,oE as Ze,pE as Qe,q as C,qT as $e,rE as w,sE as et,tE as tt,uE as nt,vE as rt,vO as T,vT as it,wE as at,wO as E,wT as ot,xE as st,xT as ct,yE as lt,yO as ut,yT as dt,zE as ft,zT as pt}from"./dist-DRXIQewX.js";import{n as D}from"./dist-DS_sZFhE.js";import{t as O}from"./x-1RyayDYu.js";import{t as k}from"./button-CrkRjd-T.js";import{C as A,Et as mt,G as ht,J as j,K as M,S as N,Tt as P,W as gt,X as F,Y as _t,Z as I,_ as L,at as vt,b as R,it as yt,ot as z,q as bt,x as B,y as V}from"./index-DcMWPy01.js";import{a as xt,i as St,n as Ct,o as wt,r as Tt,t as Et}from"./card-DlAKM9gH.js";import{a as Dt,i as H,n as Ot,o as U,r as W,t as kt}from"./table-3aSLasBW.js";import{t as At}from"./TimeRangePicker-DQjAXG44.js";import{t as jt}from"./FilterBar-DR1-M_rz.js";import{t as Mt}from"./AdvancedFilter-SyUsoxag.js";var G=ut(`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`}]]),K=t(e(),1),Nt=.1,Pt=[248,248,248],Ft=[24,24,24];function It(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 Lt(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 q(e,t,n){return Lt(e,t,n)>=Nt}function Rt(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 zt(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 Bt=12*1024*1024,Vt=480,Ht=160,Ut=.92;async function Wt(e,t={}){if(!e.type.startsWith(`image/`))throw Error(Ee());if(e.size>Bt)throw Error(s());let{source:n,width:r,height:i,cleanup:a}=await Gt(e);try{let a=e.type===`image/svg+xml`,o=Math.min(Vt/r,Ht/i,a?1/0:1),s=Math.max(1,Math.round(r*o)),c=Math.max(1,Math.round(i*o)),l=document.createElement(`canvas`);l.width=s,l.height=c;let u=l.getContext(`2d`);if(!u)throw Error(b());u.imageSmoothingEnabled=!0,u.imageSmoothingQuality=`high`,u.drawImage(n,0,0,s,c);let d=It(u.getImageData(0,0,s,c).data,s,c)??{x:0,y:0,width:s,height:c},f=document.createElement(`canvas`);f.width=d.width,f.height=d.height;let p=f.getContext(`2d`);if(!p)throw Error(b());if(p.drawImage(l,d.x,d.y,d.width,d.height,0,0,d.width,d.height),t.variantFor){let e=p.getImageData(0,0,d.width,d.height);q(e.data,d.width,d.height)?Rt(e.data,t.variantFor===`dark`?Pt:Ft):zt(e.data),p.putImageData(e,0,0)}let m=q(p.getImageData(0,0,d.width,d.height).data,d.width,d.height),h=await Y(f,`image/webp`,Ut)??await Y(f,`image/png`);if(!h)throw Error(se());return{blob:h,hasAlpha:m}}finally{a()}}async function Gt(e){if(e.type===`image/svg+xml`)return J(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 J(e)}async function J(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(pt())),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 Y(e,t,n){return new Promise(r=>e.toBlob(e=>r(e),t,n))}var X=n();function Kt(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 Z=`__all__`,Q={kind:`relative`,from:`now-24h`,to:`now`},qt=[{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,X.jsxs)(`section`,{className:`oc-show__section`,children:[(0,X.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,X.jsx)(`h2`,{className:`oc-show__title`,children:e}),t?(0,X.jsx)(`p`,{className:`oc-show__desc`,children:t}):null]}),(0,X.jsx)(`div`,{className:`oc-show__demo`,children:n})]})}function Jt(e){return e===`light`?Ce():e===`dark`?v():Te()}var Yt=[`primary`,`secondary`,`accent`,`muted`,`chart-1`,`chart-2`];function Xt({tokens:e,mode:t}){let n=e.colors[t];return(0,X.jsx)(`div`,{className:`oc-chart-swatches`,"aria-hidden":!0,children:Yt.map(e=>{let t=n[e];return(0,X.jsx)(`span`,{className:`oc-chart-swatch`,style:t?{background:t}:void 0},e)})})}function Zt({selected:e,title:t,subtitle:n,tokens:r,mode:i,onSelect:a,onExport:o}){return(0,X.jsxs)(`div`,{className:`oc-chart-card-wrap`,children:[(0,X.jsxs)(`button`,{type:`button`,className:Ye(`oc-chart-card`,e&&`oc-chart-card--selected`),"aria-pressed":e,onClick:a,children:[(0,X.jsxs)(`div`,{className:`oc-chart-card__head`,children:[(0,X.jsx)(`span`,{className:`oc-chart-card__title`,children:t}),e?(0,X.jsx)(D,{className:`size-4 text-primary`,"aria-hidden":!0}):null]}),r?(0,X.jsx)(Xt,{tokens:r,mode:i}):(0,X.jsx)(`div`,{className:`oc-chart-swatches oc-chart-swatches--native`,"aria-hidden":!0}),(0,X.jsx)(`div`,{className:`oc-chart-card__meta`,children:(0,X.jsx)(`span`,{className:`oc-chart-card__subtitle`,children:n})})]}),o?(0,X.jsx)(k,{type:`button`,variant:`ghost`,size:`icon`,className:`oc-chart-card__export`,onClick:o,"aria-label":C(),title:C(),children:(0,X.jsx)(mt,{className:`size-4`})}):null]})}function Qt({selectedKey:e,resolvedMode:t}){let n=S(T.charts.listMyCharts),r=E(T.charts.setMyChart);async function a(e){try{await r({name:e})}catch{}}return(0,X.jsxs)(`section`,{className:`oc-show__section`,children:[(0,X.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,X.jsx)(`h2`,{className:`oc-show__title`,children:ce()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:Ue()})]}),(0,X.jsxs)(`div`,{className:`oc-chart-grid`,children:[(0,X.jsx)(Zt,{selected:e===null,title:i(),subtitle:Ge(),tokens:null,mode:t,onSelect:()=>void a(null)}),(n??[]).map(n=>{let r=n.via===`common`?fe():n.via===`owner`?u():p({group:n.via.group});return(0,X.jsx)(Zt,{selected:e===n.key,title:n.name,subtitle:r,tokens:n.tokens,mode:t,onSelect:()=>void a(n.key),onExport:()=>Kt(n.name,n.tokens)},n.key)})]}),n!==void 0&&n.length===0?(0,X.jsx)(`p`,{className:`oc-show__desc`,children:xe()}):null]})}function $t(){let e=E(T.charts.importChart),[t,n]=(0,K.useState)(``),[r,i]=(0,K.useState)(``),[a,o]=(0,K.useState)(null),[s,c]=(0,K.useState)(!1),[l,u]=(0,K.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(w())}}}async function f(){if(o(null),c(!1),t.trim()===``){o(tt());return}let a;try{a=JSON.parse(r)}catch{o(w());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,X.jsxs)(`section`,{className:`oc-show__section`,children:[(0,X.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,X.jsx)(`h2`,{className:`oc-show__title`,children:Le()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:nt()})]}),(0,X.jsxs)(`div`,{className:`oc-chart-import`,children:[(0,X.jsxs)(`label`,{className:`oc-chart-import__field`,children:[(0,X.jsx)(`span`,{className:`oc-chart-import__label`,children:qe()}),(0,X.jsx)(I,{value:t,onChange:e=>n(e.target.value),placeholder:Ie(),maxLength:60})]}),(0,X.jsxs)(`label`,{className:`oc-chart-import__field`,children:[(0,X.jsx)(`span`,{className:`oc-chart-import__label`,children:et()}),(0,X.jsx)(`textarea`,{className:`oc-chart-import__textarea`,value:r,onChange:e=>i(e.target.value),placeholder:Ze(),rows:8,spellCheck:!1})]}),(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsx)(k,{variant:`outline`,size:`sm`,asChild:!0,children:(0,X.jsxs)(`label`,{className:`oc-chart-import__file`,children:[(0,X.jsx)(G,{className:`size-4`}),Ne(),(0,X.jsx)(`input`,{type:`file`,accept:`application/json,.json`,className:`oc-chart-import__file-input`,onChange:e=>void d(e)})]})}),(0,X.jsx)(k,{size:`sm`,disabled:l,onClick:()=>void f(),children:He()})]}),a?(0,X.jsx)(`p`,{className:`oc-chart-import__error`,children:a}):null,s?(0,X.jsx)(`p`,{className:`oc-chart-import__ok`,children:Xe()}):null]})]})}function en({chart:e}){let t=ye(T.charts.setChartLogo),n=E(T.charts.removeChartLogo),[r,i]=(0,K.useState)(!1),[a,o]=(0,K.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 Wt(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,X.jsxs)(`div`,{className:`oc-chart-mine__logo-slot`,children:[(0,X.jsx)(`span`,{className:`oc-chart-mine__logo-mode`,children:e===`light`?ie():$e()}),(0,X.jsx)(`span`,{className:`oc-chart-mine__logo-preview`,"data-mode":e,"data-empty":t?void 0:`1`,children:t?(0,X.jsx)(`img`,{src:t,alt:``}):null}),(0,X.jsx)(k,{variant:`outline`,size:`sm`,asChild:!0,children:(0,X.jsxs)(`label`,{className:`oc-chart-import__file`,children:[(0,X.jsx)(G,{className:`size-4`}),t?_():ae(),(0,X.jsx)(`input`,{type:`file`,accept:`image/*`,className:`oc-chart-import__file-input`,onChange:t=>void l(e,t)})]})}),!t&&n?(0,X.jsx)(k,{variant:`ghost`,size:`sm`,disabled:r,onClick:()=>void d(e),children:we()}):null,t?(0,X.jsx)(k,{variant:`ghost`,size:`sm`,disabled:r,onClick:()=>void u(e),children:Oe()}):null]})}return(0,X.jsxs)(`div`,{className:`oc-chart-mine__logo`,children:[(0,X.jsx)(`span`,{className:`oc-chart-mine__groups-label`,children:Ae()}),(0,X.jsxs)(`div`,{className:`oc-chart-mine__logo-slots`,children:[(0,X.jsx)(f,{mode:`light`}),(0,X.jsx)(f,{mode:`dark`})]}),r?(0,X.jsx)(`span`,{className:`oc-show__desc`,children:te()}):null,a?(0,X.jsx)(`p`,{className:`oc-chart-import__error`,children:a}):null]})}function tn({chart:e}){let t=S(T.me.getMe,{host:z}),n=E(T.charts.addChartDomain),r=E(T.charts.removeChartDomain),[i,a]=(0,K.useState)(``),[o,s]=(0,K.useState)(null),[c,l]=(0,K.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,X.jsxs)(`div`,{className:`oc-chart-mine__domains`,children:[(0,X.jsx)(`span`,{className:`oc-chart-mine__groups-label`,children:re()}),(0,X.jsxs)(`div`,{className:`oc-chart-mine__domains-body`,children:[(0,X.jsx)(`div`,{className:`oc-chart-avail__groups`,children:u.length===0?(0,X.jsx)(`span`,{className:`oc-show__desc`,children:le()}):u.map(e=>(0,X.jsxs)(F,{variant:`secondary`,className:`oc-chart-avail__chip`,children:[e,(0,X.jsx)(`button`,{type:`button`,className:`oc-chart-avail__chip-x`,"aria-label":We({domain:e}),onClick:()=>void f(e),children:(0,X.jsx)(O,{className:`size-3`})})]},e))}),(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsx)(I,{value:i,onChange:e=>a(e.target.value),placeholder:he(),className:`oc-chart-mine__domains-input`,onKeyDown:e=>{e.key===`Enter`&&d()}}),(0,X.jsx)(k,{variant:`outline`,size:`sm`,disabled:c,onClick:()=>void d(),children:de()})]}),(0,X.jsx)(`span`,{className:`oc-show__desc`,children:g()}),o?(0,X.jsx)(`p`,{className:`oc-chart-import__error`,children:o}):null]})]})}function nn(e){let t={...e};return delete t.bpm,JSON.stringify(t,null,2)}function rn({chart:e}){let t=E(T.charts.updateChart),n=E(T.charts.deleteChart),[r,i]=(0,K.useState)(!1),[o,s]=(0,K.useState)(e.name),[c,l]=(0,K.useState)(()=>nn(e.tokens)),[u,f]=(0,K.useState)(e.tokens.bpm??0),[p,h]=(0,K.useState)(null),[g,_]=(0,K.useState)(!1);function v(){s(e.name),l(nn(e.tokens)),f(e.tokens.bpm??0),h(null),i(!0)}async function te(){if(e.chartId===void 0)return;h(null);let n;try{n=JSON.parse(c)}catch{h(w());return}if(n&&typeof n==`object`&&!Array.isArray(n)){let e=n;u>0?e.bpm=u:delete e.bpm}_(!0);try{await t({chartId:e.chartId,name:o.trim(),tokens:n}),i(!1)}catch(e){h(e instanceof Error?e.message:String(e))}finally{_(!1)}}async function ne(){if(e.chartId!==void 0&&window.confirm(m()))try{await n({chartId:e.chartId})}catch{}}return(0,X.jsxs)(`div`,{className:`oc-chart-mine__row`,children:[(0,X.jsxs)(`div`,{className:`oc-chart-mine__head`,children:[(0,X.jsx)(`span`,{className:`oc-chart-mine__name`,children:e.name}),(0,X.jsx)(`div`,{className:`oc-show__row`,children:r?null:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(k,{variant:`outline`,size:`sm`,onClick:v,children:je()}),(0,X.jsx)(k,{variant:`ghost`,size:`sm`,onClick:()=>void ne(),children:ke()})]})})]}),r?(0,X.jsxs)(`div`,{className:`oc-chart-mine__editor`,children:[(0,X.jsxs)(`label`,{className:`oc-chart-import__field`,children:[(0,X.jsx)(`span`,{className:`oc-chart-import__label`,children:pe()}),(0,X.jsx)(I,{value:o,onChange:e=>s(e.target.value),maxLength:60})]}),(0,X.jsxs)(`div`,{className:`oc-chart-import__field`,children:[(0,X.jsx)(`span`,{className:`oc-chart-import__label`,children:y()}),(0,X.jsxs)(`div`,{className:`oc-chart-bpm`,children:[(0,X.jsx)(`input`,{type:`range`,className:`oc-chart-bpm__slider`,min:0,max:90,step:5,value:u,onChange:e=>f(Number(e.target.value)),"aria-label":y()}),(0,X.jsx)(`span`,{className:`oc-chart-bpm__value`,children:u===0?ee():`${u} BPM`})]}),(0,X.jsx)(`span`,{className:`oc-show__desc`,children:De()})]}),(0,X.jsxs)(`label`,{className:`oc-chart-import__field`,children:[(0,X.jsx)(`span`,{className:`oc-chart-import__label`,children:d()}),(0,X.jsx)(`textarea`,{className:`oc-chart-import__textarea`,value:c,onChange:e=>l(e.target.value),rows:10,spellCheck:!1})]}),p?(0,X.jsx)(`p`,{className:`oc-chart-import__error`,children:p}):null,(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsx)(k,{size:`sm`,disabled:g,onClick:()=>void te(),children:a()}),(0,X.jsx)(k,{variant:`ghost`,size:`sm`,onClick:()=>i(!1),children:Ke()})]})]}):null,(0,X.jsx)(en,{chart:e}),(0,X.jsx)(tn,{chart:e})]})}function an(){let e=S(T.charts.listMyCharts),t=(e??[]).filter(e=>e.via===`owner`);return(0,X.jsxs)(`section`,{className:`oc-show__section`,children:[(0,X.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,X.jsx)(`h2`,{className:`oc-show__title`,children:Re()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:r()})]}),e!==void 0&&t.length===0?(0,X.jsx)(`p`,{className:`oc-show__desc`,children:ge()}):(0,X.jsx)(`div`,{className:`oc-chart-mine-list`,children:t.map(e=>(0,X.jsx)(rn,{chart:e},e.key))})]})}function on({chart:e,groups:t}){let n=E(T.charts.addChartToGroupPool),r=E(T.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,X.jsxs)(`div`,{className:`oc-chart-avail`,children:[(0,X.jsxs)(`div`,{className:`oc-chart-avail__head`,children:[(0,X.jsx)(`span`,{className:`oc-chart-avail__name`,children:e.name}),(0,X.jsx)(F,{variant:i?`secondary`:`outline`,className:`oc-chart-avail__state`,children:i?Me():e.kind===`custom`&&e.scope===`personal`?x():rt()}),e.isGlobalDefault?(0,X.jsx)(F,{variant:`default`,children:Be()}):null]}),(0,X.jsxs)(`div`,{className:`oc-chart-avail__groups`,children:[(0,X.jsx)(`span`,{className:`oc-chart-mine__groups-label`,children:Je()}),(a??[]).map(e=>(0,X.jsxs)(F,{variant:`secondary`,className:`oc-chart-avail__chip`,children:[e.name,(0,X.jsx)(`button`,{type:`button`,className:`oc-chart-avail__chip-x`,"aria-label":ze({group:e.name}),onClick:()=>void l(e.groupId),children:(0,X.jsx)(O,{className:`size-3`})})]},e.groupId)),s.length>0?(0,X.jsxs)(V,{value:``,onValueChange:e=>void c(e),children:[(0,X.jsx)(N,{size:`sm`,className:`w-56`,children:(0,X.jsx)(A,{placeholder:Qe()})}),(0,X.jsx)(R,{children:s.map(e=>(0,X.jsx)(B,{value:e._id,children:e.name},e._id))})]}):t.length===0?(0,X.jsx)(`span`,{className:`oc-show__desc`,children:Ve()}):null]})]})}function sn({chart:e}){let t=E(T.charts.promoteChartToCommon),n=E(T.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(m()))try{await n({chartId:e.chartId})}catch{}}return(0,X.jsxs)(`div`,{className:`oc-chart-avail`,children:[(0,X.jsxs)(`div`,{className:`oc-chart-avail__head`,children:[(0,X.jsx)(`span`,{className:`oc-chart-avail__name`,children:e.name}),(0,X.jsx)(F,{variant:e.scope===`common`?`outline`:`secondary`,children:e.scope===`common`?ct():x()}),e.ownerLabel?(0,X.jsx)(`span`,{className:`oc-show__desc`,children:l({owner:e.ownerLabel})}):null]}),(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[e.scope===`personal`?(0,X.jsx)(k,{variant:`outline`,size:`sm`,onClick:()=>void r(),children:Fe()}):null,(0,X.jsx)(k,{variant:`ghost`,size:`sm`,onClick:()=>void i(),children:dt()})]})]})}function cn({defaultThemeMode:e,defaultLocale:t,defaultChartKey:n}){let r=E(T.admin.setDefaultThemeMode),a=E(T.admin.setDefaultLocale),s=E(T.charts.setDefaultChart),l=S(T.charts.listChartsAdmin),u=S(T.groups.listGroups,{}),d=e??`system`,p=t??`fr`;return(0,X.jsxs)(`div`,{className:`oc-appearance-admin`,children:[(0,X.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,X.jsx)(`h2`,{className:`oc-show__title`,children:me()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:ue()})]}),(0,X.jsxs)(`section`,{className:`oc-show__section`,children:[(0,X.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,X.jsx)(`h3`,{className:`oc-show__title`,children:at()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:c()})]}),(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsx)(k,{variant:n===null?`default`:`outline`,size:`sm`,onClick:()=>void s({name:null}),children:i()}),vt.map(e=>(0,X.jsx)(k,{variant:n===e.key?`default`:`outline`,size:`sm`,onClick:()=>void s({name:e.key}),children:e.name},e.key)),(l??[]).filter(e=>e.kind===`custom`&&e.scope===`common`).map(e=>(0,X.jsx)(k,{variant:n===e.key?`default`:`outline`,size:`sm`,onClick:()=>void s({name:e.key}),children:e.name},e.key))]})]}),(0,X.jsxs)(`section`,{className:`oc-show__section`,children:[(0,X.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,X.jsx)(`h3`,{className:`oc-show__title`,children:ve()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:st()})]}),(0,X.jsx)(`div`,{className:`oc-chart-avail-list`,children:(l??[]).filter(e=>!(e.kind===`custom`&&e.scope===`common`)).map(e=>(0,X.jsx)(on,{chart:e,groups:u??[]},e.key))})]}),(0,X.jsxs)(`section`,{className:`oc-show__section`,children:[(0,X.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,X.jsx)(`h3`,{className:`oc-show__title`,children:Pe()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:lt()})]}),(0,X.jsx)(`div`,{className:`oc-chart-avail-list`,children:(l??[]).filter(e=>e.kind===`builtin`||e.scope===`common`).map(e=>(0,X.jsxs)(`div`,{className:`oc-chart-avail`,children:[(0,X.jsx)(`div`,{className:`oc-chart-avail__head`,children:(0,X.jsx)(`span`,{className:`oc-chart-avail__name`,children:e.name})}),(0,X.jsx)(tn,{chart:e})]},e.key))})]}),(0,X.jsxs)(`section`,{className:`oc-show__section`,children:[(0,X.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,X.jsx)(`h3`,{className:`oc-show__title`,children:Se()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:ot()})]}),(()=>{let e=(l??[]).filter(e=>e.kind===`custom`);return e.length===0?(0,X.jsx)(`p`,{className:`oc-show__desc`,children:it()}):(0,X.jsx)(`div`,{className:`oc-chart-avail-list`,children:e.map(e=>(0,X.jsx)(sn,{chart:e},e.key))})})()]}),(0,X.jsxs)(`section`,{className:`oc-show__section`,children:[(0,X.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,X.jsx)(`h3`,{className:`oc-show__title`,children:o()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:ft()})]}),(0,X.jsx)(`div`,{className:`oc-show__row`,children:[`light`,`dark`,`system`].map(e=>(0,X.jsx)(k,{variant:d===e?`default`:`outline`,size:`sm`,onClick:()=>void r({mode:e}),children:Jt(e)},e))})]}),(0,X.jsxs)(`section`,{className:`oc-show__section`,children:[(0,X.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,X.jsx)(`h3`,{className:`oc-show__title`,children:_e()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:oe()})]}),(0,X.jsx)(`div`,{className:`oc-show__row`,children:[`fr`,`en`].map(e=>(0,X.jsx)(k,{variant:p===e?`default`:`outline`,size:`sm`,onClick:()=>void a({locale:e}),children:e===`fr`?f():be()},e))}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:ne()})]})]})}function ln(){let e=S(T.me.getMe,{host:z}),t=yt(e?.resolvedThemeMode);return(0,X.jsxs)(`div`,{className:`oc-appearance`,children:[(0,X.jsx)(Qt,{selectedKey:e?.chartKey??null,resolvedMode:t}),(0,X.jsx)($t,{}),(0,X.jsx)(an,{}),e?.role===`admin`?(0,X.jsx)(cn,{defaultThemeMode:e.defaultThemeMode,defaultLocale:e.defaultLocale,defaultChartKey:e.defaultChartKey}):null]})}function un(){let[e,t]=(0,K.useState)(!0),[n,r]=(0,K.useState)(`per-user`),[i,a]=(0,K.useState)(``),[o,s]=(0,K.useState)(Z),[c,l]=(0,K.useState)(Z),[u,d]=(0,K.useState)(Q),f=i!==``||o!==Z||c!==Z;function p(){a(``),s(Z),l(Z),d(Q)}return(0,X.jsxs)(`div`,{className:`oc-show`,children:[(0,X.jsx)(ln,{}),(0,X.jsxs)(`details`,{className:`oc-show__ref`,children:[(0,X.jsx)(`summary`,{className:`oc-show__title`,children:h()}),(0,X.jsxs)($,{title:`Buttons`,description:`Variants`,children:[(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsx)(k,{children:`Default`}),(0,X.jsx)(k,{variant:`secondary`,children:`Secondary`}),(0,X.jsx)(k,{variant:`outline`,children:`Outline`}),(0,X.jsx)(k,{variant:`ghost`,children:`Ghost`}),(0,X.jsx)(k,{variant:`destructive`,children:`Destructive`}),(0,X.jsx)(k,{variant:`link`,children:`Link`})]}),(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsx)(k,{size:`sm`,children:`Small`}),(0,X.jsx)(k,{children:`Default`}),(0,X.jsx)(k,{size:`lg`,children:`Large`}),(0,X.jsx)(k,{size:`icon`,"aria-label":`more`,children:(0,X.jsx)(P,{})}),(0,X.jsx)(k,{disabled:!0,children:`Disabled`})]})]}),(0,X.jsx)($,{title:`Badges`,children:(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsx)(F,{children:`Default`}),(0,X.jsx)(F,{variant:`secondary`,children:`Secondary`}),(0,X.jsx)(F,{variant:`outline`,children:`Outline`}),(0,X.jsx)(F,{variant:`destructive`,children:`Destructive`})]})}),(0,X.jsx)($,{title:`Inputs & selection`,children:(0,X.jsxs)(`div`,{className:`oc-show__row oc-show__row--col`,children:[(0,X.jsx)(I,{placeholder:`Text input…`}),(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsxs)(V,{value:n,onValueChange:r,children:[(0,X.jsx)(N,{className:`w-56`,children:(0,X.jsx)(A,{placeholder:`Select…`})}),(0,X.jsxs)(R,{children:[(0,X.jsx)(B,{value:`per-user`,children:`per-user (chacun son agent)`}),(0,X.jsx)(B,{value:`shared`,children:`shared (agent commun)`})]})]}),(0,X.jsxs)(`label`,{className:`oc-show__check`,children:[(0,X.jsx)(L,{checked:e,onCheckedChange:e=>t(!!e)}),`Checkbox`]})]})]})}),(0,X.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,X.jsxs)(`div`,{className:`oc-show__row oc-show__row--col`,children:[(0,X.jsxs)(jt,{q:i,onQChange:a,searchPlaceholder:`Rechercher (kind, principal, rôle, route…)`,timeRange:u,onTimeRangeChange:d,onReset:p,canReset:f,children:[(0,X.jsxs)(V,{value:o,onValueChange:s,children:[(0,X.jsx)(N,{size:`sm`,children:(0,X.jsx)(A,{})}),(0,X.jsxs)(R,{children:[(0,X.jsx)(B,{value:Z,children:`Toutes directions`}),(0,X.jsx)(B,{value:`inbound`,children:`inbound`}),(0,X.jsx)(B,{value:`outbound`,children:`outbound`}),(0,X.jsx)(B,{value:`internal`,children:`internal`})]})]}),(0,X.jsxs)(V,{value:c,onValueChange:l,children:[(0,X.jsx)(N,{size:`sm`,children:(0,X.jsx)(A,{})}),(0,X.jsxs)(R,{children:[(0,X.jsx)(B,{value:Z,children:`Toutes sévérités`}),(0,X.jsx)(B,{value:`info`,children:`info`}),(0,X.jsx)(B,{value:`warn`,children:`warn`}),(0,X.jsx)(B,{value:`critical`,children:`critical`})]})]})]}),(0,X.jsx)(Mt,{fields:qt,onChange:()=>{}}),(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsx)(`span`,{className:`oc-show__desc`,children:`Sélecteur de plage seul :`}),(0,X.jsx)(At,{value:u,onChange:d})]})]})}),(0,X.jsx)($,{title:`Dropdown menu`,description:`Row actions / kebab`,children:(0,X.jsxs)(gt,{children:[(0,X.jsx)(_t,{asChild:!0,children:(0,X.jsx)(k,{variant:`outline`,size:`icon`,"aria-label":`Open menu`,children:(0,X.jsx)(P,{})})}),(0,X.jsxs)(ht,{align:`start`,children:[(0,X.jsx)(bt,{children:`Actions`}),(0,X.jsx)(j,{}),(0,X.jsx)(M,{children:`Edit`}),(0,X.jsx)(M,{children:`Duplicate`}),(0,X.jsx)(j,{}),(0,X.jsx)(M,{variant:`destructive`,children:`Delete`})]})]})}),(0,X.jsx)($,{title:`Card`,children:(0,X.jsxs)(Et,{className:`w-80`,children:[(0,X.jsxs)(xt,{children:[(0,X.jsx)(wt,{children:`Instance`}),(0,X.jsx)(Tt,{children:`Non-secret metadata only.`})]}),(0,X.jsx)(Ct,{className:`text-sm text-muted-foreground`,children:`ws://gateway.example.org:18789`}),(0,X.jsxs)(St,{className:`gap-2`,children:[(0,X.jsx)(k,{size:`sm`,children:`Save`}),(0,X.jsx)(k,{size:`sm`,variant:`ghost`,children:`Cancel`})]})]})}),(0,X.jsx)($,{title:`Table`,children:(0,X.jsxs)(kt,{children:[(0,X.jsx)(Dt,{children:(0,X.jsxs)(U,{children:[(0,X.jsx)(H,{className:`w-8`,children:(0,X.jsx)(L,{"aria-label":`select all`})}),(0,X.jsx)(H,{children:`Name`}),(0,X.jsx)(H,{children:`Mode`}),(0,X.jsx)(H,{className:`text-right`,children:`Status`}),(0,X.jsx)(H,{className:`w-8`})]})}),(0,X.jsx)(Ot,{children:[{n:`admins`,m:`per-user`,s:`active`},{n:`family`,m:`shared`,s:`active`}].map(e=>(0,X.jsxs)(U,{children:[(0,X.jsx)(W,{children:(0,X.jsx)(L,{"aria-label":`select ${e.n}`})}),(0,X.jsx)(W,{className:`font-medium`,children:e.n}),(0,X.jsx)(W,{children:(0,X.jsx)(F,{variant:`secondary`,children:e.m})}),(0,X.jsx)(W,{className:`text-right`,children:(0,X.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-muted-foreground`,children:[(0,X.jsx)(D,{className:`size-3.5`}),` `,e.s]})}),(0,X.jsx)(W,{children:(0,X.jsx)(k,{variant:`ghost`,size:`icon`,"aria-label":`row actions`,children:(0,X.jsx)(P,{})})})]},e.n))})]})}),(0,X.jsx)($,{title:`App fragments`,description:`Chat-specific components`,children:(0,X.jsxs)(`div`,{className:`oc-show__row oc-show__row--col`,children:[(0,X.jsx)(`div`,{className:`oc-msg oc-msg--assistant`,children:(0,X.jsx)(`div`,{className:`oc-msg__body`,children:`Assistant message bubble.`})}),(0,X.jsx)(`div`,{className:`oc-tool oc-tool--completed`,children:(0,X.jsxs)(`div`,{className:`oc-tool__header`,children:[(0,X.jsx)(`span`,{className:`oc-tool__icon`,children:`✓`}),(0,X.jsx)(`span`,{className:`oc-tool__name`,children:`write-file`}),(0,X.jsx)(`span`,{className:`oc-tool__phase`,children:`completed`})]})}),(0,X.jsxs)(`div`,{className:`oc-run-status oc-run-status--streaming`,children:[(0,X.jsx)(`span`,{className:`oc-run-status__dot`}),(0,X.jsx)(`span`,{className:`oc-run-status__label`,children:`Running`})]})]})})]})]})}export{un as ThemeShowroom};
@@ -1 +0,0 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$b as r,$f as i,Ab as a,Ap as o,Bb as s,Cp as c,Dp as l,Ep as u,Fb as d,Hb as f,Ib as p,Jb as m,Jf as h,Lb as g,Mb as _,Nb as v,Ob as y,Op as ee,Pb as b,Qb as te,Qf as ne,Rb as x,Sp as re,TO as S,Tp as ie,Vb as ae,Xb as C,Xf as oe,Yb as w,Yf as T,Zb as E,Zf as se,_p as ce,_x as le,ap as ue,ax as D,bp as de,cp as fe,cx as pe,dp as me,dx as he,ep as ge,ex as _e,fp as ve,fx as O,gp as ye,gx as be,hp as xe,hx as k,ip as Se,ix as A,jb as j,jp as Ce,kb as M,kp as we,lp as Te,lx as N,mp as Ee,mx as P,np as De,nx as F,op as Oe,ox as ke,pp as Ae,px as je,qb as Me,qf as Ne,rp as Pe,rx as Fe,sp as Ie,sx as Le,tp as Re,tx as ze,up as Be,ux as Ve,vO as I,vp as He,wO as L,wp as Ue,xp as We,yO as R,yp as Ge,zb as Ke}from"./dist-DRXIQewX.js";import{n as qe}from"./dist-DS_sZFhE.js";import{t as Je}from"./x-1RyayDYu.js";import{i as z,n as B,r as Ye,t as Xe}from"./tabs-JwsMaDCr.js";import{t as V}from"./button-CrkRjd-T.js";import{$ as Ze,C as H,Ct as Qe,Dt as $e,Mt as et,Q as tt,S as U,X as W,a as nt,b as G,et as rt,i as it,jt as at,k as ot,nt as st,o as ct,ot as lt,r as ut,rt as dt,wt as ft,x as K,y as q}from"./index-DcMWPy01.js";import{n as pt}from"./TimeRangePicker-DQjAXG44.js";import{t as mt}from"./FilterBar-DR1-M_rz.js";import{t as ht}from"./AdvancedFilter-SyUsoxag.js";import{t as gt}from"./DataTableShell-CJHDSNd8.js";var _t=R(`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`}]]),vt=R(`scroll-text`,[[`path`,{d:`M15 12h-5`,key:`r7krc0`}],[`path`,{d:`M15 8h-5`,key:`1khuty`}],[`path`,{d:`M19 17V5a2 2 0 0 0-2-2H4`,key:`zz82l3`}],[`path`,{d:`M8 21h12a2 2 0 0 0 2-2v-1a1 1 0 0 0-1-1H11a1 1 0 0 0-1 1v1a2 2 0 1 1-4 0V5a2 2 0 1 0-4 0v2a1 1 0 0 0 1 1h3`,key:`1ph1d7`}]]),J=t(e(),1),Y=n(),X={kind:`relative`,from:`now-520w`,to:`now`},Z=e=>e===null?`-`:String(Math.round(e));function yt(e){let t=e.indexOf(`:`);if(t<0)return e;let n=e.slice(0,t),r=e.slice(t+1);return n===`admin`?te():n===`agent`?`${E()} - ${r}`:e}function bt(){let e=S(I.me.getMe,{host:lt})?.role===`admin`,t=S(I.deliveryTiming.getDeliveryStatus,{}),n=L(I.deliveryTiming.startDeliveryRecord),r=L(I.deliveryTiming.stopDeliveryRecord),[i,a]=(0,J.useState)(!1),[o,s]=(0,J.useState)(!1),c=t?.recording??!1,l=async()=>{s(!0);try{c?await r({}):await n({})}finally{s(!1)}};return(0,Y.jsxs)(`section`,{className:`mb-4 flex flex-col gap-3 rounded-lg border border-border p-4`,children:[(0,Y.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`h3`,{className:`text-sm font-semibold`,children:le()}),(0,Y.jsx)(`p`,{className:`oc-admin__hint`,children:be()})]}),e?(0,Y.jsx)(V,{variant:c?`destructive`:`default`,size:`sm`,disabled:o||t===void 0,onClick:()=>void l(),children:c?P():k()}):null]}),c?(0,Y.jsxs)(`p`,{className:`flex items-center gap-2 text-sm`,children:[(0,Y.jsx)(W,{variant:`secondary`,children:je()}),t?.startedAt?(0,Y.jsx)(`span`,{className:`text-muted-foreground`,children:O({time:new Date(t.startedAt).toLocaleTimeString()})}):null]}):null,(0,Y.jsx)(`div`,{children:(0,Y.jsx)(V,{variant:`outline`,size:`sm`,onClick:()=>a(e=>!e),children:i?N():Ve()})}),i?(0,Y.jsx)(xt,{isAdmin:e}):null]})}function xt({isAdmin:e}){let t=S(I.deliveryTiming.listDeliverySessions,{}),n=L(I.deliveryTiming.deleteDeliverySessions),[i,a]=(0,J.useState)(``),[o,s]=(0,J.useState)(`all`),[c,l]=(0,J.useState)(X),[u,d]=(0,J.useState)(null),{from:f,to:p}=pt(c),h=c.to===`now`?1/0:p,g=i.trim()!==``||o!==`all`||c!==X,_=()=>{a(``),s(`all`),l(X)},v=(0,J.useMemo)(()=>{if(t===void 0)return;let e=i.trim().toLowerCase();return t.filter(t=>(e===``||t.startedBy.toLowerCase().includes(e))&&(o===`all`||(o===`active`?t.active:!t.active))&&t.startedAt>=f&&t.startedAt<=h).map(e=>({...e,_id:e.sessionId}))},[t,i,o,f,h]),y=e=>{let t=new Set((v??[]).map(e=>e.sessionId)),r=e.filter(e=>t.has(e));r.length!==0&&(n({sessionIds:r}),u!==null&&r.includes(u)&&d(null))};return(0,Y.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Y.jsx)(mt,{q:i,onQChange:a,searchPlaceholder:Le(),timeRange:c,onTimeRangeChange:l,onReset:_,canReset:g,children:(0,Y.jsxs)(q,{value:o,onValueChange:e=>s(e),children:[(0,Y.jsx)(U,{size:`sm`,className:`w-36`,children:(0,Y.jsx)(H,{})}),(0,Y.jsxs)(G,{children:[(0,Y.jsx)(K,{value:`all`,children:ke()}),(0,Y.jsx)(K,{value:`active`,children:D()}),(0,Y.jsx)(K,{value:`stopped`,children:A()})]})]})}),(0,Y.jsx)(gt,{title:pe(),rows:v,emptyHint:M(),columns:[{header:``,className:`w-8`,cell:e=>(0,Y.jsx)(V,{variant:`ghost`,size:`icon`,"aria-label":u===e.sessionId?w():C(),onClick:()=>d(t=>t===e.sessionId?null:e.sessionId),children:u===e.sessionId?(0,Y.jsx)(_t,{size:15,"aria-hidden":!0}):(0,Y.jsx)(ft,{size:15,"aria-hidden":!0})})},{header:Fe(),sort:e=>e.startedAt,cell:e=>(0,Y.jsx)(`span`,{className:`tabular-nums`,children:new Date(e.startedAt).toLocaleString()})},{header:F(),sort:e=>e.stoppedAt,cell:e=>e.stoppedAt===null?(0,Y.jsx)(`span`,{className:`text-muted-foreground`,children:`-`}):(0,Y.jsx)(`span`,{className:`tabular-nums`,children:new Date(e.stoppedAt).toLocaleString()})},{header:ze(),sort:e=>e.count,cell:e=>(0,Y.jsx)(`span`,{className:`tabular-nums`,children:Z(e.count)})},{header:_e(),sort:e=>e.startedBy,cell:e=>yt(e.startedBy)},{header:r(),sort:e=>e.active,cell:e=>e.active?(0,Y.jsx)(W,{variant:`secondary`,children:D()}):(0,Y.jsx)(`span`,{className:`text-muted-foreground`,children:A()})}],rowActions:e?e=>[{label:m(),variant:`destructive`,onSelect:()=>y([e.sessionId])}]:void 0,bulkActions:e?[{label:m(),variant:`destructive`,onSelect:e=>y(e)}]:void 0,isExpanded:e=>e.sessionId===u,renderExpanded:e=>(0,Y.jsx)(St,{sessionId:e.sessionId})})]})}function St({sessionId:e}){let t=S(I.deliveryTiming.getDeliveryReport,{sessionId:e}),[n,r]=(0,J.useState)(!1);return(0,Y.jsx)(Ct,{report:t,copied:n,onCopy:()=>{t&&navigator.clipboard?.writeText(ot(t)).then(()=>{r(!0),window.setTimeout(()=>r(!1),1200)}).catch(()=>{})}})}function Ct({report:e,copied:t,onCopy:n}){if(!e)return(0,Y.jsx)(`p`,{className:`oc-admin__hint`,children:Me()});if(e.count===0||e.segments===null)return(0,Y.jsx)(`p`,{className:`oc-admin__hint`,children:he()});let r=e.segments,i=(e,t)=>(0,Y.jsxs)(`tr`,{className:`border-t border-border`,children:[(0,Y.jsx)(`td`,{className:`py-1`,children:e}),(0,Y.jsx)(`td`,{className:`py-1 text-right tabular-nums`,children:t.count}),(0,Y.jsxs)(`td`,{className:`py-1 text-right tabular-nums`,children:[Z(t.p50),` / `,Z(t.p95),` / `,Z(t.max)]})]});return(0,Y.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,Y.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[e.count,` `,y()]}),(0,Y.jsxs)(V,{variant:`outline`,size:`sm`,onClick:n,children:[t?(0,Y.jsx)(qe,{size:13,"aria-hidden":!0}):(0,Y.jsx)($e,{size:13,"aria-hidden":!0}),t?a():j()]})]}),(0,Y.jsxs)(`table`,{className:`w-full text-sm`,children:[(0,Y.jsx)(`thead`,{children:(0,Y.jsxs)(`tr`,{className:`text-left text-muted-foreground`,children:[(0,Y.jsx)(`th`,{className:`py-1 font-medium`,children:s()}),(0,Y.jsx)(`th`,{className:`py-1 text-right font-medium`,children:Ke()}),(0,Y.jsx)(`th`,{className:`py-1 text-right font-medium`,children:x()})]})}),(0,Y.jsxs)(`tbody`,{children:[i(g(),r.bridge),i(p(),r.A),i(d(),r.C)]})]}),(0,Y.jsx)(`p`,{className:`oc-admin__hint`,children:b()}),e.truncated?(0,Y.jsx)(`p`,{className:`oc-admin__hint`,children:_()}):null,(0,Y.jsx)(`p`,{className:`oc-admin__hint`,children:v()})]})}var wt=[50,100,200,500],Tt=`all`,Q=`__all__`,Et=[`2xx`,`4xx`,`5xx`],Dt=[`user`,`service`,`system`],Ot=[`inbound`,`outbound`,`internal`],kt={kind:`relative`,from:`now-30d`,to:`now`},At=[{value:`kind`,label:`kind`},{value:`status`,label:`status`},{value:`latencyMs`,label:`latence (ms)`},{value:`principalType`,label:`principal`},{value:`direction`,label:`direction`},{value:`roleKey`,label:`rôle`},{value:`route`,label:`route`},{value:`correlationId`,label:`correlationId`}];function jt(){let e=et({from:`/settings/traces`}),t=at({from:`/settings/traces`}),n=e.limit,r=e.kind,a=e.statusClass??Q,s=e.principalType??Q,d=e.direction??Q,p=e.roleKey??Q,m=e.q??``,h=ut(e.from,e.to),g=(0,J.useMemo)(()=>ct(e.adv),[e.adv]),{from:_,to:v}=pt(h),[y,b]=(0,J.useState)(null),[te,x]=(0,J.useState)(null),C=e=>void t({search:t=>({...t,limit:e})}),w=e=>void t({search:t=>({...t,kind:e})}),T=e=>void t({search:t=>({...t,q:e||void 0}),replace:!0}),E=e=>void t({search:t=>({...t,statusClass:e===Q?void 0:e})}),le=e=>void t({search:t=>({...t,principalType:e===Q?void 0:e})}),D=e=>void t({search:t=>({...t,direction:e===Q?void 0:e})}),pe=e=>void t({search:t=>({...t,roleKey:e===Q?void 0:e})}),he=e=>void t({search:t=>({...t,...nt(e)})}),_e=e=>void t({search:t=>({...t,adv:it(e)}),replace:!0}),O=S(I.observability.listEvents,{limit:n}),be=S(I.observability.listEvents,{limit:n,kind:r===Tt?void 0:r,filter:{q:m||void 0,from:_,to:v,statusClass:a===Q?void 0:a,principalType:s===Q?void 0:s,direction:d===Q?void 0:d,roleKey:p===Q?void 0:p,advanced:g.length>0?g:void 0}}),k=(0,J.useMemo)(()=>{let e=new Set;for(let t of O??[])e.add(t.kind);return[...e].sort()},[O]),A=(0,J.useMemo)(()=>{let e=new Set;for(let t of O??[])t.roleKey&&e.add(t.roleKey);return[...e].sort()},[O]),j=m!==``||a!==Q||s!==Q||d!==Q||p!==Q||g.length>0||h.kind!==`relative`||h.from!==kt.from;function M(){t({search:{limit:100,kind:`all`},replace:!0})}let N=y?O?.filter(e=>e.correlationId===y):be,[P,F]=(0,J.useState)(`events`);return(0,Y.jsxs)(Xe,{value:P,onValueChange:e=>F(e),children:[(0,Y.jsxs)(Ye,{className:`w-full`,children:[(0,Y.jsxs)(z,{value:`latency`,className:`flex-1 gap-1.5`,children:[(0,Y.jsx)(Qe,{size:13,"aria-hidden":!0}),f()]}),(0,Y.jsxs)(z,{value:`events`,className:`flex-1 gap-1.5`,children:[(0,Y.jsx)(vt,{size:13,"aria-hidden":!0}),ae()]})]}),(0,Y.jsx)(B,{value:`latency`,children:(0,Y.jsx)(bt,{})}),(0,Y.jsxs)(B,{value:`events`,className:`flex flex-col gap-3`,children:[(0,Y.jsxs)(`p`,{className:`oc-admin__hint`,children:[Ce(),(0,Y.jsx)(`strong`,{children:o()}),we(),` `,(0,Y.jsx)(`span`,{className:`oc-filter__window`,children:ee()})]}),(0,Y.jsxs)(mt,{q:m,onQChange:T,searchPlaceholder:l(),timeRange:h,onTimeRangeChange:he,onReset:M,canReset:j,children:[(0,Y.jsxs)(q,{value:a,onValueChange:E,children:[(0,Y.jsx)(U,{size:`sm`,className:`w-32`,children:(0,Y.jsx)(H,{placeholder:u()})}),(0,Y.jsxs)(G,{children:[(0,Y.jsx)(K,{value:Q,children:ie()}),Et.map(e=>(0,Y.jsx)(K,{value:e,children:e},e))]})]}),(0,Y.jsxs)(q,{value:s,onValueChange:le,children:[(0,Y.jsx)(U,{size:`sm`,className:`w-32`,children:(0,Y.jsx)(H,{placeholder:Ue()})}),(0,Y.jsxs)(G,{children:[(0,Y.jsx)(K,{value:Q,children:c()}),Dt.map(e=>(0,Y.jsx)(K,{value:e,children:e},e))]})]}),(0,Y.jsxs)(q,{value:d,onValueChange:D,children:[(0,Y.jsx)(U,{size:`sm`,className:`w-32`,children:(0,Y.jsx)(H,{placeholder:re()})}),(0,Y.jsxs)(G,{children:[(0,Y.jsx)(K,{value:Q,children:We()}),Ot.map(e=>(0,Y.jsx)(K,{value:e,children:e},e))]})]}),(0,Y.jsxs)(q,{value:p,onValueChange:pe,children:[(0,Y.jsx)(U,{size:`sm`,className:`w-36`,children:(0,Y.jsx)(H,{placeholder:de()})}),(0,Y.jsxs)(G,{children:[(0,Y.jsx)(K,{value:Q,children:Ge()}),A.map(e=>(0,Y.jsx)(K,{value:e,children:e},e))]})]}),(0,Y.jsxs)(q,{value:r,onValueChange:w,children:[(0,Y.jsx)(U,{size:`sm`,className:`w-44`,children:(0,Y.jsx)(H,{placeholder:He()})}),(0,Y.jsxs)(G,{children:[(0,Y.jsx)(K,{value:Tt,children:ce()}),k.map(e=>(0,Y.jsx)(K,{value:e,children:e},e))]})]}),(0,Y.jsxs)(q,{value:String(n),onValueChange:e=>C(Number(e)),children:[(0,Y.jsx)(U,{size:`sm`,className:`w-28`,children:(0,Y.jsx)(H,{})}),(0,Y.jsx)(G,{children:wt.map(e=>(0,Y.jsx)(K,{value:String(e),children:ye({count:e})},e))})]})]}),(0,Y.jsx)(ht,{fields:At,seed:g,onChange:_e}),y?(0,Y.jsx)(`div`,{className:`oc-traces__followline`,children:(0,Y.jsxs)(`button`,{type:`button`,className:`oc-traces__chip`,onClick:()=>b(null),title:xe(),children:[(0,Y.jsxs)(`span`,{className:`oc-traces__chip-label`,children:[Ee(),(0,Y.jsx)(`code`,{children:$(y)})]}),(0,Y.jsx)(Je,{className:`oc-traces__chip-x`,"aria-hidden":!0}),(0,Y.jsx)(`span`,{className:`sr-only`,children:Ae()})]})}):null,(0,Y.jsx)(gt,{title:ve(),rows:N,emptyHint:y?me():Be(),columns:[{header:Te(),sort:e=>e.at,cell:e=>(0,Y.jsx)(`span`,{className:`oc-traces__time`,children:new Date(e.at).toLocaleString(`fr-FR`)})},{header:fe(),sort:e=>e.kind,cell:e=>(0,Y.jsx)(W,{variant:`secondary`,children:e.kind})},{header:Ie(),sort:e=>Nt(e)??null,cell:e=>{let t=Nt(e);return t?(0,Y.jsxs)(`span`,{className:`oc-traces__fail`,title:t,children:[`✕ `,t]}):(0,Y.jsx)(`span`,{className:`oc-traces__ok`,"aria-label":Oe(),children:`✓`})}},{header:ue(),sort:e=>e.direction,cell:e=>e.direction?(0,Y.jsx)(W,{variant:`outline`,children:e.direction}):(0,Y.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})},{header:Se(),sort:e=>e.principalType,cell:e=>(0,Y.jsxs)(`span`,{className:`oc-traces__principal`,children:[(0,Y.jsx)(W,{variant:`outline`,children:e.principalType}),e.principalId?(0,Y.jsx)(`code`,{className:`oc-traces__mono`,children:$(e.principalId)}):null]})},{header:Pe(),sort:e=>e.roleKey,cell:e=>e.roleKey?(0,Y.jsx)(W,{variant:`secondary`,children:e.roleKey}):(0,Y.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})},{header:De(),sort:e=>e.route,cell:e=>e.route?(0,Y.jsxs)(`span`,{className:`oc-traces__route`,children:[e.method?(0,Y.jsx)(`span`,{className:`oc-traces__method`,children:e.method}):null,(0,Y.jsx)(`code`,{className:`oc-traces__mono`,children:e.route})]}):(0,Y.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})},{header:Re(),sort:e=>e.status,cell:e=>e.status===null?(0,Y.jsx)(`span`,{className:`oc-traces__muted`,children:`—`}):(0,Y.jsx)(`span`,{className:`oc-traces__status ${Mt(e.status)}`,children:e.status})},{header:ge(),sort:e=>e.latencyMs,cell:e=>e.latencyMs===null?(0,Y.jsx)(`span`,{className:`oc-traces__muted`,children:`—`}):(0,Y.jsxs)(`span`,{className:`oc-traces__mono`,children:[e.latencyMs,` ms`]})},{header:i(),sort:e=>e.correlationId,cell:e=>e.correlationId?(0,Y.jsx)(`button`,{type:`button`,className:`oc-traces__corr`,title:ne(),onClick:()=>b(e.correlationId),children:$(e.correlationId)}):(0,Y.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})},{header:se(),sort:e=>+!!e.meta,cell:e=>e.meta?(0,Y.jsx)(V,{variant:`outline`,size:`sm`,onClick:()=>x(e),children:oe()}):(0,Y.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})}]}),(0,Y.jsx)(Pt,{row:te,onClose:()=>x(null)})]})]})}function Mt(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 Nt(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 Pt({row:e,onClose:t}){let n=(0,J.useMemo)(()=>{if(!e?.meta)return``;try{return JSON.stringify(JSON.parse(e.meta),null,2)}catch{return e.meta}},[e]);return(0,Y.jsx)(tt,{open:e!==null,onOpenChange:e=>{e||t()},children:e?(0,Y.jsxs)(Ze,{className:`max-w-lg`,children:[(0,Y.jsxs)(st,{children:[(0,Y.jsxs)(dt,{className:`oc-traces__meta-title`,children:[T(),` `,(0,Y.jsx)(`code`,{children:e.kind}),(0,Y.jsx)(W,{variant:`outline`,children:h()})]}),(0,Y.jsx)(rt,{children:Ne()})]}),(0,Y.jsx)(`pre`,{className:`oc-traces__meta-json`,children:n})]}):null})}export{jt as TracesTab};
@@ -1 +0,0 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$_ as r,B_ as i,G_ as a,H_ as o,J_ as s,K_ as c,Q_ as l,R_ as u,TO as d,U_ as f,V_ as ee,W_ as te,X_ as ne,Y_ as re,Z_ as ie,_f as p,av as ae,cf as m,cv as oe,df as h,dv as g,ev as se,ff as _,fv as v,gf as y,hf as b,iv as ce,lf as x,lv as le,mf as S,nv as C,ov as ue,pf as w,q_ as de,rv as fe,sf as T,sv as E,tv as pe,uf as D,uv as O,vO as k,vf as A,wO as j,y_ as me,yf as M,z_ as he}from"./dist-DRXIQewX.js";import{t as N}from"./button-CrkRjd-T.js";import{$ as P,A as F,C as I,G as L,K as R,M as ge,Mt as _e,Q as z,S as B,W as V,X as H,Y as ve,_ as U,_t as W,b as G,d as K,et as ye,f as be,gt as q,j as xe,jt as Se,nt as Ce,ot as we,p as J,q as Te,rt as Ee,x as Y,y as X}from"./index-DcMWPy01.js";import{t as De}from"./FilterBar-DR1-M_rz.js";import{t as Oe}from"./DataTableShell-CJHDSNd8.js";import{t as ke}from"./DetailChips-DZXcy4x8.js";var Z=t(e(),1),Q=n();function Ae({profileId:e,userLabel:t,open:n,onOpenChange:r}){let i=d(k.agents.listAgentPoolForUser,n&&e?{profileId:e}:`skip`),a=d(k.agents.listUserAgents,n&&e?{profileId:e}:`skip`),o=new Set((a??[]).map(e=>`${e.instanceName}/${e.agentId}`)),s=(a??[]).find(e=>e.isDefault)??null,c=s?`${s.instanceName}/${s.agentId}`:null,l=new Set((i?.agents??[]).map(e=>`${e.instanceName}/${e.agentId}`)),u=[...(i?.agents??[]).map(e=>({...e,outOfPool:!1})),...(a??[]).filter(e=>!l.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,state:e.state,outOfPool:!0}))],f=new Map;for(let e of u){let t=f.get(e.instanceName)??[];t.push(e),f.set(e.instanceName,t)}return(0,Q.jsx)(z,{open:n,onOpenChange:r,children:(0,Q.jsxs)(P,{className:`oc-access`,children:[(0,Q.jsxs)(Ce,{children:[(0,Q.jsx)(Ee,{children:M({user:t})}),(0,Q.jsx)(ye,{children:A()})]}),i?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:i.inGroup?p():y()}):null,(0,Q.jsx)(`div`,{className:`oc-access__list`,children:i===void 0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:b()}):u.length===0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:_()}):[...f.entries()].map(([t,n])=>(0,Q.jsx)(je,{profileId:e,instanceName:t,kind:n[0].kind,agents:n,assigned:o,defaultKey:c},t))})]})})}function je({profileId:e,instanceName:t,kind:n,agents:r,assigned:i,defaultKey:a}){let o=j(k.agents.assignAgent),s=j(k.agents.removeAgent),c=j(k.agents.setDefaultAgent),l=F();if(!e)return null;async function u(n,r){try{r?await s({profileId:e,instanceName:t,agentId:n}):await o({profileId:e,instanceName:t,agentId:n})}catch(e){l.error(S(),e)}}async function d(n){try{await c({profileId:e,instanceName:t,agentId:n})}catch(e){l.error(w(),e)}}return(0,Q.jsxs)(`div`,{className:`oc-access__group`,children:[(0,Q.jsxs)(`div`,{className:`oc-access__instance`,children:[(0,Q.jsx)(W,{size:13,"aria-hidden":!0}),(0,Q.jsx)(`span`,{children:t}),(0,Q.jsx)(H,{variant:`outline`,className:`oc-access__kind`,children:n})]}),r.map(e=>{let n=`${t}/${e.agentId}`,r=i.has(n),o=a===n,s=e.state===`deleted`;return(0,Q.jsxs)(`div`,{className:`oc-access__row`,children:[(0,Q.jsx)(U,{checked:r,disabled:s&&!r,onCheckedChange:()=>void u(e.agentId,r),"aria-label":h({name:e.displayName??e.agentId})}),(0,Q.jsxs)(`span`,{className:`oc-access__label`,children:[e.emoji?`${e.emoji} `:``,e.displayName??e.agentId]}),e.model?(0,Q.jsx)(`span`,{className:`oc-access__model`,children:e.model}):null,s?(0,Q.jsx)(H,{variant:`outline`,className:`oc-access__gone`,children:D()}):null,e.outOfPool?(0,Q.jsx)(H,{variant:`outline`,className:`oc-access__gone`,children:x()}):null,r?o?(0,Q.jsx)(`span`,{className:`oc-access__fav`,role:`img`,"aria-label":m(),title:m(),children:(0,Q.jsx)(q,{size:14,fill:`currentColor`})}):(0,Q.jsx)(N,{type:`button`,size:`icon-sm`,variant:`ghost`,className:`oc-access__setdefault`,"aria-label":T(),title:T(),onClick:()=>void d(e.agentId),children:(0,Q.jsx)(q,{size:14})}):null]},e.agentId)})]})}var $=`__all__`;function Me({granted:e,onToggle:t}){let n=new Set(e),r=K.filter(e=>n.has(J[e])).length;return(0,Q.jsxs)(V,{children:[(0,Q.jsx)(ve,{asChild:!0,children:(0,Q.jsx)(N,{variant:`outline`,size:`sm`,className:`h-8 w-36 justify-start font-normal`,children:r===0?v():g({count:r})})}),(0,Q.jsxs)(L,{align:`start`,className:`w-52`,children:[(0,Q.jsx)(Te,{children:O()}),K.map(e=>{let r=J[e];return(0,Q.jsxs)(R,{className:`gap-2`,onSelect:e=>{e.preventDefault(),t(r)},children:[(0,Q.jsx)(U,{checked:n.has(r),"aria-hidden":!0,tabIndex:-1,className:`pointer-events-none`}),(0,Q.jsx)(`span`,{children:be[e]??e})]},e)})]})]})}function Ne(){let e=_e({from:`/settings/users`}),t=Se({from:`/settings/users`}),n=e.q??``,p=e.role??$,m=e=>void t({search:t=>({...t,q:e||void 0}),replace:!0}),h=e=>void t({search:t=>({...t,role:e===$?void 0:e})}),g=d(k.admin.listUsers,{filter:{q:n||void 0,role:p===$?void 0:p},withAgents:!0}),_=d(k.me.getMe,{host:we}),v=j(k.admin.setRole),y=j(k.admin.setUserPermissions),b=j(k.admin.startImpersonation),x=j(k.admin.deleteUser),S=j(k.admin.setUserName),w=xe(),T=ge(),D=F(),[O,A]=(0,Z.useState)(null),M=(0,Z.useMemo)(()=>{let e=new Set([`pending`,`user`,`admin`]);for(let t of g??[])e.add(t.role);return[...e]},[g]),N=n!==``||p!==$;function P(){t({search:{},replace:!0})}async function L(e){try{await v(e)}catch(e){D.error(le(),e)}}async function R(e){try{await y(e)}catch(e){D.error(oe(),e)}}async function z(e){let t=e.email||e.name||e.canonical||e.userId.slice(0,8);if(await w({title:pe(),description:se({user:t}),confirmWord:r(),confirmLabel:l(),destructive:!0}))try{await x({profileId:e._id}),D.success(ne({user:t}))}catch(e){D.error(ie(),e)}}async function V(e){let t=e.email||e.name||e.userId.slice(0,8),n=await T({title:s(),label:de({user:t}),placeholder:c(),defaultValue:e.name??``,confirmLabel:me()});if(n!==null)try{await S({profileId:e._id,name:n}),D.success(a())}catch(e){D.error(te(),e)}}return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(De,{q:n,onQChange:m,searchPlaceholder:E(),onReset:P,canReset:N,children:(0,Q.jsxs)(X,{value:p,onValueChange:h,children:[(0,Q.jsx)(B,{size:`sm`,className:`w-36`,children:(0,Q.jsx)(I,{})}),(0,Q.jsxs)(G,{children:[(0,Q.jsx)(Y,{value:$,children:ue()}),M.map(e=>(0,Q.jsx)(Y,{value:e,children:e},e))]})]})}),(0,Q.jsx)(Oe,{title:ae(),rows:g,emptyHint:ce(),rowActions:e=>{let t=[{label:u(),onSelect:()=>A({profileId:e._id,label:e.email||e.name||e.canonical||e.userId.slice(0,8)})},{label:re(),onSelect:()=>void V(e)}];return e.userId!==_?.userId&&t.push({label:fe(),onSelect:()=>void b({profileId:e._id})},{label:C(),variant:`destructive`,onSelect:()=>void z(e)}),t},columns:[{header:f(),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,Q.jsxs)(`div`,{className:`flex flex-col`,children:[(0,Q.jsx)(`span`,{children:t}),n?(0,Q.jsx)(`span`,{className:`text-muted-foreground text-xs`,children:n}):null]})},sort:e=>e.email||e.name||e.canonical||e.userId},{header:o(),sort:e=>e.role===`admin`?2:+(e.role===`user`),cell:e=>(0,Q.jsxs)(X,{value:e.role,onValueChange:t=>void L({profileId:e._id,role:t}),children:[(0,Q.jsx)(B,{size:`sm`,className:`w-28`,children:(0,Q.jsx)(I,{})}),(0,Q.jsxs)(G,{children:[(0,Q.jsx)(Y,{value:`pending`,children:`pending`}),(0,Q.jsx)(Y,{value:`user`,children:`user`}),(0,Q.jsx)(Y,{value:`admin`,children:`admin`})]})]})},{header:ee(),sort:e=>e.role===`admin`?9999:e.extraPermissions?.length??0,cell:e=>e.role===`admin`?(0,Q.jsx)(`span`,{className:`text-muted-foreground text-xs`,children:i()}):(0,Q.jsx)(Me,{granted:e.extraPermissions??[],onToggle:t=>{let n=new Set(e.extraPermissions??[]);n.has(t)?n.delete(t):n.add(t),R({profileId:e._id,permissions:[...n]})}})},{header:he(),cell:e=>(0,Q.jsx)(ke,{icon:(0,Q.jsx)(W,{size:12,"aria-hidden":!0}),total:e.agentCount??0,items:e.agents.map(e=>({label:e}))}),sort:e=>e.agentCount??0}]}),(0,Q.jsx)(Ae,{profileId:O?.profileId??null,userLabel:O?.label??``,open:O!==null,onOpenChange:e=>{e||A(null)}})]})}export{Ne as UsersTab};
@@ -1 +0,0 @@
1
- import{a as e,r as t}from"./bundle-mjs-C73ZY4La.js";import{n,pO as r,t as i}from"./dist-DRXIQewX.js";e();var a=t(),o=i(`group/button inline-flex shrink-0 items-center justify-center rounded-lg border border-transparent bg-clip-padding text-sm font-medium whitespace-nowrap transition-all outline-none select-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 active:not-aria-[haspopup]:translate-y-px disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,{variants:{variant:{default:`bg-primary text-primary-foreground hover:bg-primary/80`,outline:`border-border bg-background hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:border-input dark:bg-input/30 dark:hover:bg-input/50`,secondary:`bg-secondary text-secondary-foreground hover:bg-[color-mix(in_oklch,var(--secondary),var(--foreground)_5%)] aria-expanded:bg-secondary aria-expanded:text-secondary-foreground`,ghost:`hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:hover:bg-muted/50`,destructive:`bg-destructive/10 text-destructive hover:bg-destructive/20 focus-visible:border-destructive/40 focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:hover:bg-destructive/30 dark:focus-visible:ring-destructive/40`,link:`text-primary underline-offset-4 hover:underline`},size:{default:`h-8 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2`,xs:`h-6 gap-1 rounded-[min(var(--radius-md),10px)] px-2 text-xs in-data-[slot=button-group]:rounded-lg has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3`,sm:`h-7 gap-1 rounded-[min(var(--radius-md),12px)] px-2.5 text-[0.8rem] in-data-[slot=button-group]:rounded-lg has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3.5`,lg:`h-9 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2`,icon:`size-8`,"icon-xs":`size-6 rounded-[min(var(--radius-md),10px)] in-data-[slot=button-group]:rounded-lg [&_svg:not([class*='size-'])]:size-3`,"icon-sm":`size-7 rounded-[min(var(--radius-md),12px)] in-data-[slot=button-group]:rounded-lg`,"icon-lg":`size-9`}},defaultVariants:{variant:`default`,size:`default`}});function s({className:e,variant:t=`default`,size:i=`default`,asChild:s=!1,...c}){return(0,a.jsx)(s?r:`button`,{"data-slot":`button`,"data-variant":t,"data-size":i,className:n(o({variant:t,size:i,className:e})),...c})}export{o as n,s as t};
@@ -1 +0,0 @@
1
- import{yO as e}from"./dist-DRXIQewX.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};