@lacneu/atrium 0.27.0 → 0.28.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (72) hide show
  1. package/dist/assets/AccessTab-DvvDXBXb.js +1 -0
  2. package/dist/assets/{AdvancedFilter-C7EdUbso.js → AdvancedFilter-BFrnFKT8.js} +1 -1
  3. package/dist/assets/AgentFilesTab-jMVGc-7o.js +3 -0
  4. package/dist/assets/AnomaliesTab-JRqIpCQ3.js +1 -0
  5. package/dist/assets/AuditTab-BrQtjSHt.js +1 -0
  6. package/dist/assets/BridgeTab-CVMr5-7B.js +1 -0
  7. package/dist/assets/ChatDefaultsTab-CRnsKi17.js +1 -0
  8. package/dist/assets/{DataTableShell-B9cSAz8l.js → DataTableShell-D3UoYiLm.js} +1 -1
  9. package/dist/assets/{DetailChips-CWQEoST8.js → DetailChips-CEPLO74z.js} +1 -1
  10. package/dist/assets/FeedbacksTab-DtcTHukp.js +1 -0
  11. package/dist/assets/{FieldLabel-BGZ_qKFR.js → FieldLabel-D-Hzx5_p.js} +2 -2
  12. package/dist/assets/FilesTab-9huo9v-_.js +1 -0
  13. package/dist/assets/{FilterBar-CHAmMDFh.js → FilterBar-BwVt4XJ7.js} +1 -1
  14. package/dist/assets/GroupsTab-CtYeHOBA.js +1 -0
  15. package/dist/assets/InstancesTab-BNzkCJvr.js +1 -0
  16. package/dist/assets/IntegrationsTab-BRGKBdRH.js +1 -0
  17. package/dist/assets/KpiTab-J9KHRyfK.js +1 -0
  18. package/dist/assets/PreferencesTab-C_MSfGKP.js +1 -0
  19. package/dist/assets/PromptInjectionsTab-twM5Wu4M.js +3 -0
  20. package/dist/assets/RolesTab-C9h6psGw.js +1 -0
  21. package/dist/assets/ServiceAccountsTab-CxPmhPYx.js +1 -0
  22. package/dist/assets/SubAgentReportsTab-BlTwmb10.js +1 -0
  23. package/dist/assets/ThemeShowroom-DZ0Zkebx.js +1 -0
  24. package/dist/assets/{TimeRangePicker-Dj6YRWgA.js → TimeRangePicker-pz6n37si.js} +1 -1
  25. package/dist/assets/TracesTab-Bn3nIxEe.js +1 -0
  26. package/dist/assets/UsersTab-C4Vr4jwt.js +1 -0
  27. package/dist/assets/{button-J0r_4wz5.js → button-BKx-78Cz.js} +1 -1
  28. package/dist/assets/{card-dyG2YjyY.js → card-r-aJwNEo.js} +1 -1
  29. package/dist/assets/chevrons-up-down-59d1_9hJ.js +1 -0
  30. package/dist/assets/{compatView-DPRQjsZh.js → compatView-Cvvm-eZM.js} +1 -1
  31. package/dist/assets/dispatchErrorInfo-BY-uJbtG.js +1 -0
  32. package/dist/assets/{dist-DS1M4Gey.js → dist-CEZ2NhYx.js} +1 -1
  33. package/dist/assets/{dist-DggIHtPt.js → dist-CLSp0oLP.js} +1 -1
  34. package/dist/assets/{dist-BFIP7qvw.js → dist-CdJRWSN2.js} +1 -1
  35. package/dist/assets/dist-DcNll3Cm.js +1 -0
  36. package/dist/assets/{highlighted-body-OFNGDK62-EPlwFMM-.js → highlighted-body-OFNGDK62-BB_6m41R.js} +1 -1
  37. package/dist/assets/{index-B08-jWhj.css → index-BARs9CRG.css} +1 -1
  38. package/dist/assets/index-BDVPDgRe.js +229 -0
  39. package/dist/assets/mermaid-GHXKKRXX-Bt2lAXSp.js +1 -0
  40. package/dist/assets/roleDescriptions-BVyzh7hN.js +1 -0
  41. package/dist/assets/{table-BuMPc1vP.js → table-v_cIgz3K.js} +1 -1
  42. package/dist/assets/{tabs-BTVXPiSJ.js → tabs-ClKgxi4q.js} +1 -1
  43. package/dist/assets/x-DmVX0ZZY.js +1 -0
  44. package/dist/index.html +8 -8
  45. package/package.json +1 -1
  46. package/dist/assets/AccessTab-CEmMOcXT.js +0 -1
  47. package/dist/assets/AgentFilesTab-C9tMrmAg.js +0 -3
  48. package/dist/assets/AnomaliesTab-DrUwzDmG.js +0 -1
  49. package/dist/assets/AuditTab-Aj8uI0v6.js +0 -1
  50. package/dist/assets/BridgeTab-CA5_P4aZ.js +0 -1
  51. package/dist/assets/ChatDefaultsTab-CVNE9suc.js +0 -1
  52. package/dist/assets/FeedbacksTab-DSeHh3a5.js +0 -1
  53. package/dist/assets/FilesTab-Bkb5DTn0.js +0 -1
  54. package/dist/assets/GroupsTab-CR4m4DqG.js +0 -1
  55. package/dist/assets/InstancesTab-V2KYNZTK.js +0 -1
  56. package/dist/assets/IntegrationsTab-B3B8_e3n.js +0 -1
  57. package/dist/assets/KpiTab-Bh67xpFW.js +0 -1
  58. package/dist/assets/PreferencesTab-Bp7NvRbP.js +0 -1
  59. package/dist/assets/PromptInjectionsTab-Bp6feq2x.js +0 -3
  60. package/dist/assets/RolesTab-B22EPCra.js +0 -1
  61. package/dist/assets/ServiceAccountsTab-pWc6hbtd.js +0 -1
  62. package/dist/assets/SubAgentReportsTab-CzLYKjvx.js +0 -1
  63. package/dist/assets/ThemeShowroom-Da9-MU65.js +0 -1
  64. package/dist/assets/TracesTab-Bxfvod8I.js +0 -1
  65. package/dist/assets/UsersTab-C6FpLZh2.js +0 -1
  66. package/dist/assets/chevrons-up-down-0_epvFU7.js +0 -1
  67. package/dist/assets/dispatchErrorInfo-xSgyy7Pa.js +0 -1
  68. package/dist/assets/dist-dDi5a2bA.js +0 -1
  69. package/dist/assets/index-BI4JM57h.js +0 -229
  70. package/dist/assets/mermaid-GHXKKRXX-Dap6Di3w.js +0 -1
  71. package/dist/assets/roleDescriptions-BJkLcyAA.js +0 -1
  72. package/dist/assets/x-CjN2swsp.js +0 -1
@@ -0,0 +1 @@
1
+ import{D as e}from"./index-BDVPDgRe.js";export{e as Mermaid};
@@ -0,0 +1 @@
1
+ import{_h as e,bh as t,vh as n,xh as r,yh as i}from"./dist-CLSp0oLP.js";var a={pending:r,user:t,admin:i,observer:n,agent:e};function o(e){if(e.builtin){let t=a[e.key];if(t)return t()}return e.description}export{o as t};
@@ -1 +1 @@
1
- import{a as e,r as t}from"./bundle-mjs-C73ZY4La.js";import{n}from"./dist-DggIHtPt.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-CLSp0oLP.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{bO as r,dO as i,fO as a,gO as o,n as s,pO as c,t as l,yO as u}from"./dist-DggIHtPt.js";import{t as d}from"./dist-dDi5a2bA.js";import{dt as f,ft as p,pt as m}from"./index-BI4JM57h.js";var h=t(e(),1),g=n(),_=`Tabs`,[v,y]=o(_,[m]),b=m(),[x,S]=v(_),C=h.forwardRef((e,t)=>{let{__scopeTabs:n,value:a,onValueChange:o,defaultValue:s,orientation:l=`horizontal`,dir:u,activationMode:f=`automatic`,...p}=e,m=d(u),[h,v]=c({prop:a,onChange:o,defaultProp:s??``,caller:_});return(0,g.jsx)(x,{scope:n,baseId:i(),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:o,children:s,...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)(a,{present:o||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&&s})})});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:s(`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:s(L({variant:t}),e),...n})}function z({className:e,...t}){return(0,g.jsx)(P,{"data-slot":`tabs-trigger`,className:s(`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:s(`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{TO as r,_O as i,gO as a,n as o,t as s,vO as c,wO as l,xO as u}from"./dist-CLSp0oLP.js";import{t as d}from"./dist-DcNll3Cm.js";import{dt as f,ft as p,pt as m}from"./index-BDVPDgRe.js";var h=t(e(),1),g=n(),_=`Tabs`,[v,y]=u(_,[m]),b=m(),[x,S]=v(_),C=h.forwardRef((e,t)=>{let{__scopeTabs:n,value:i,onValueChange:o,defaultValue:s,orientation:l=`horizontal`,dir:u,activationMode:f=`automatic`,...p}=e,m=d(u),[h,v]=c({prop:i,onChange:o,defaultProp:s??``,caller:_});return(0,g.jsx)(x,{scope:n,baseId:a(),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),u=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:u,...o,ref:t,onMouseDown:l(e.onMouseDown,e=>{!a&&e.button===0&&e.ctrlKey===!1?s.onValueChange(i):e.preventDefault()}),onKeyDown:l(e.onKeyDown,e=>{[` `,`Enter`].includes(e.key)&&s.onValueChange(i)}),onFocus:l(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:a,forceMount:o,children:s,...c}=e,l=S(O,n),u=A(l.baseId,a),d=j(l.baseId,a),f=a===l.value,p=h.useRef(f);return h.useEffect(()=>{let e=requestAnimationFrame(()=>p.current=!1);return()=>cancelAnimationFrame(e)},[]),(0,g.jsx)(i,{present:o||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&&s})})});k.displayName=O;function A(e,t){return`${e}-trigger-${t}`}function j(e,t){return`${e}-content-${t}`}var M=C,N=T,P=D,F=k;function I({className:e,orientation:t=`horizontal`,...n}){return(0,g.jsx)(M,{"data-slot":`tabs`,"data-orientation":t,className:o(`group/tabs flex gap-2 data-horizontal:flex-col`,e),...n})}var L=s(`group/tabs-list inline-flex w-fit items-center justify-center rounded-lg p-[3px] text-muted-foreground group-data-horizontal/tabs:h-8 group-data-vertical/tabs:h-fit group-data-vertical/tabs:flex-col data-[variant=line]:rounded-none`,{variants:{variant:{default:`bg-muted`,line:`gap-1 bg-transparent`}},defaultVariants:{variant:`default`}});function R({className:e,variant:t=`default`,...n}){return(0,g.jsx)(N,{"data-slot":`tabs-list`,"data-variant":t,className:o(L({variant:t}),e),...n})}function z({className:e,...t}){return(0,g.jsx)(P,{"data-slot":`tabs-trigger`,className:o(`relative inline-flex h-[calc(100%-1px)] flex-1 items-center justify-center gap-1.5 rounded-md border border-transparent px-1.5 py-0.5 text-sm font-medium whitespace-nowrap text-foreground/60 transition-all group-data-vertical/tabs:w-full group-data-vertical/tabs:justify-start hover:text-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-1 focus-visible:outline-ring disabled:pointer-events-none disabled:opacity-50 has-data-[icon=inline-end]:pr-1 has-data-[icon=inline-start]:pl-1 dark:text-muted-foreground dark:hover:text-foreground group-data-[variant=default]/tabs-list:data-active:shadow-sm group-data-[variant=line]/tabs-list:data-active:shadow-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,`group-data-[variant=line]/tabs-list:bg-transparent group-data-[variant=line]/tabs-list:data-active:bg-transparent dark:group-data-[variant=line]/tabs-list:data-active:border-transparent dark:group-data-[variant=line]/tabs-list:data-active:bg-transparent`,`data-active:bg-background data-active:text-foreground dark:data-active:border-input dark:data-active:bg-input/30 dark:data-active:text-foreground`,`after:absolute after:bg-foreground after:opacity-0 after:transition-opacity group-data-horizontal/tabs:after:inset-x-0 group-data-horizontal/tabs:after:bottom-[-5px] group-data-horizontal/tabs:after:h-0.5 group-data-vertical/tabs:after:inset-y-0 group-data-vertical/tabs:after:-right-1 group-data-vertical/tabs:after:w-0.5 group-data-[variant=line]/tabs-list:data-active:after:opacity-100`,e),...t})}function B({className:e,...t}){return(0,g.jsx)(F,{"data-slot":`tabs-content`,className:o(`flex-1 text-sm outline-none`,e),...t})}export{z as i,B as n,R as r,I as t};
@@ -0,0 +1 @@
1
+ import{NO as e}from"./dist-CLSp0oLP.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,15 +38,15 @@
38
38
  document.documentElement.dataset.ambiance = a === "off" ? "off" : "on";
39
39
  })();
40
40
  </script>
41
- <script type="module" crossorigin src="/assets/index-BI4JM57h.js"></script>
41
+ <script type="module" crossorigin src="/assets/index-BDVPDgRe.js"></script>
42
42
  <link rel="modulepreload" crossorigin href="/assets/bundle-mjs-C73ZY4La.js">
43
- <link rel="modulepreload" crossorigin href="/assets/dist-DggIHtPt.js">
44
- <link rel="modulepreload" crossorigin href="/assets/dist-dDi5a2bA.js">
45
- <link rel="modulepreload" crossorigin href="/assets/dist-DS1M4Gey.js">
46
- <link rel="modulepreload" crossorigin href="/assets/dist-BFIP7qvw.js">
47
- <link rel="modulepreload" crossorigin href="/assets/x-CjN2swsp.js">
48
- <link rel="modulepreload" crossorigin href="/assets/button-J0r_4wz5.js">
49
- <link rel="stylesheet" crossorigin href="/assets/index-B08-jWhj.css">
43
+ <link rel="modulepreload" crossorigin href="/assets/dist-CLSp0oLP.js">
44
+ <link rel="modulepreload" crossorigin href="/assets/dist-DcNll3Cm.js">
45
+ <link rel="modulepreload" crossorigin href="/assets/dist-CEZ2NhYx.js">
46
+ <link rel="modulepreload" crossorigin href="/assets/dist-CdJRWSN2.js">
47
+ <link rel="modulepreload" crossorigin href="/assets/x-DmVX0ZZY.js">
48
+ <link rel="modulepreload" crossorigin href="/assets/button-BKx-78Cz.js">
49
+ <link rel="stylesheet" crossorigin href="/assets/index-BARs9CRG.css">
50
50
  </head>
51
51
  <body>
52
52
  <div id="root"></div>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lacneu/atrium",
3
- "version": "0.27.0",
3
+ "version": "0.28.0",
4
4
  "description": "Atrium — public, self-hostable, Convex-backed web chat UI for AI agent gateways (OpenClaw today, Hermes next). Ships an origin-agnostic static bundle (Convex URL injected at runtime via /config.json).",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -1 +0,0 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$o as r,DO as i,Go as a,Ho as o,Jo as s,Ko as c,PO as l,Qo as u,Uo as d,Wo as f,Xo as p,Yo as m,Zo as h,eO as g,es as _,ns as v,qo as y,ts as b}from"./dist-DggIHtPt.js";import{C as x,S,X as C,b as w,x as T,y as E}from"./index-BI4JM57h.js";var D=t(e(),1);function O(e){return e===`user`?c():e===`all`?a():f({group:e.group})}function k(e){return e===`common`?d():e===`owner`?o():f({group:e.group})}var A=n();function j(e){return e.name||e.email||e.userId.slice(0,8)}function M(){let e=l(i.admin.listUsers,{}),[t,n]=(0,D.useState)(``),a=l(i.introspect.introspectUser,t?{userId:t}:`skip`);return(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:v()}),(0,A.jsxs)(E,{value:t,onValueChange:n,children:[(0,A.jsx)(S,{size:`sm`,"aria-label":b(),children:(0,A.jsx)(x,{placeholder:b()})}),(0,A.jsx)(w,{children:(e??[]).map(e=>(0,A.jsx)(T,{value:e.userId,children:j(e)},e._id))})]}),t===``?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:_()}):a===void 0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:g()}):(0,A.jsxs)(`div`,{className:`oc-introspect`,children:[(0,A.jsxs)(`section`,{className:`oc-introspect__section`,children:[(0,A.jsx)(`h3`,{className:`oc-introspect__title`,children:r()}),(0,A.jsxs)(`div`,{className:`oc-introspect__id`,children:[(0,A.jsx)(`strong`,{children:a.user.label}),(0,A.jsx)(C,{variant:`secondary`,children:a.role})]})]}),(0,A.jsxs)(`section`,{className:`oc-introspect__section`,children:[(0,A.jsx)(`h3`,{className:`oc-introspect__title`,children:u()}),a.groups.length===0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:s()}):(0,A.jsx)(`div`,{className:`oc-introspect__chips`,children:a.groups.map(e=>(0,A.jsx)(C,{variant:`secondary`,children:e.name},e.groupId))})]}),(0,A.jsxs)(`section`,{className:`oc-introspect__section`,children:[(0,A.jsx)(`h3`,{className:`oc-introspect__title`,children:h()}),a.agents.length===0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:s()}):(0,A.jsx)(`ul`,{className:`oc-introspect__list`,children:a.agents.map(e=>(0,A.jsxs)(`li`,{className:`oc-introspect__row`,children:[(0,A.jsx)(`span`,{className:`oc-introspect__name`,children:e.displayName||e.agentId}),e.isDefault?(0,A.jsx)(C,{variant:`default`,children:y()}):null,(0,A.jsx)(C,{variant:`outline`,children:O(e.via)}),(0,A.jsx)(C,{variant:`secondary`,children:e.state})]},`${e.instanceName} ${e.agentId}`))})]}),(0,A.jsxs)(`section`,{className:`oc-introspect__section`,children:[(0,A.jsx)(`h3`,{className:`oc-introspect__title`,children:p()}),a.charts.length===0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:s()}):(0,A.jsx)(`ul`,{className:`oc-introspect__list`,children:a.charts.map(e=>(0,A.jsxs)(`li`,{className:`oc-introspect__row`,children:[(0,A.jsx)(`span`,{className:`oc-introspect__name`,children:e.name}),(0,A.jsx)(C,{variant:`outline`,children:k(e.via)})]},e.key))})]}),(0,A.jsxs)(`section`,{className:`oc-introspect__section`,children:[(0,A.jsx)(`h3`,{className:`oc-introspect__title`,children:m()}),a.permissions.length===0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:s()}):(0,A.jsx)(`div`,{className:`oc-introspect__chips`,children:a.permissions.map(e=>(0,A.jsx)(C,{variant:`secondary`,children:e},e))})]})]})]})}export{M as AccessTab};
@@ -1,3 +0,0 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Ai as r,Ci as i,DO as a,Di as o,Ei as ee,Fi as s,GS as c,Ii as te,Li as ne,Mi as l,Ni as re,Oi as ie,PO as u,Pi as d,Si as f,Ti as p,_i as m,ba as h,bi as g,ci as _,di as v,eO as y,fi as b,gi as x,hi as S,jO as C,ji as ae,ki as w,li as T,mi as E,nO as oe,pi as D,ui as se,va as ce,vi as O,wi as k,xi as A,yi as j}from"./dist-DggIHtPt.js";import{t as M}from"./button-J0r_4wz5.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-BI4JM57h.js";import{i as G}from"./compatView-DPRQjsZh.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(a.me.getMe,{host:V}),t=e?.role===`admin`,n=(e?.permissions??[]).includes(`bridge.read`),i=u(a.admin.listInstances,e!==void 0&&t?{}:`skip`),[c,f]=(0,K.useState)(null);(0,K.useEffect)(()=>{!t||!i||i.length===0||(!c||!i.some(e=>e.name===c))&&f(i[0].name)},[t,i,c]);let m=u(a.agents.listAgentsForInstance,t&&c?{instanceName:c}:`skip`),h=u(a.agents.listMyAgents,e!==void 0&&!t?{}:`skip`),g=(0,K.useMemo)(()=>{if(e!==void 0){if(t)return c===null||m===void 0?i!==void 0&&i.length===0?[]:void 0:m.agents.map(e=>({instanceName:c,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,c,m,i,h]),[_,v]=(0,K.useState)(null);(0,K.useEffect)(()=>{!g||g.length===0||(!_||!g.some(e=>$(e)===_))&&v($(g[0]))},[g,_]);let b=g?.find(e=>$(e)===_)??null,x=C(a.agentFiles.listAgentFiles),[S,T]=(0,K.useState)({status:`idle`}),E=b?.instanceName??null,D=b?.agentId??null,se=u(a.compat.forInstance,n&&E!==null?{instanceName:E}:`skip`),O=n&&E!==null?H(se,`agentFiles`):null,k=O===null?!1:O===`loading`?null:O.blocked,A=(0,K.useCallback)(async()=>{if(!(E===null||D===null)){T({status:`loading`});try{T({status:`done`,files:(await x({instanceName:E,agentId:D})).files})}catch{T({status:`error`})}}},[x,E,D]);(0,K.useEffect)(()=>{k===!1&&A()},[A,k]);let[j,N]=(0,K.useState)(null),P=oe(),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:y()}):(0,Q.jsxs)(`div`,{className:`oc-afiles`,children:[(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:ne()}),(0,Q.jsxs)(`div`,{className:`oc-afiles__picker`,children:[t&&(i?.length??0)>1?(0,Q.jsxs)(W,{value:c??``,onValueChange:e=>f(e),children:[(0,Q.jsx)(L,{size:`sm`,"aria-label":te(),children:(0,Q.jsx)(I,{})}),(0,Q.jsx)(z,{children:(i??[]).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":s(),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:d()})]}),b===null?null:O===`loading`?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:y()}):O!==null&&O.blocked?(0,Q.jsxs)(`p`,{className:`oc-compat__blocked`,role:`status`,children:[(0,Q.jsx)(B,{size:14,"aria-hidden":!0}),` `,G(O.gatewayVersion)]}):S.status===`loading`||S.status===`idle`?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:y()}):S.status===`error`?(0,Q.jsxs)(`p`,{className:`oc-afiles__error`,role:`alert`,children:[l(),` `,(0,Q.jsx)(M,{variant:`outline`,size:`sm`,onClick:()=>void A(),children:ce()})]}):S.files.length===0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:re()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`div`,{className:`oc-afiles__list`,children:S.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:ae()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`span`,{className:`oc-afiles__size`,children:r({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:w({pct:F.format(n)})}),i?(0,Q.jsx)(B,{size:14,className:`oc-afiles__warn`,"aria-label":ie()}):(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?ee():p()})]},e.name)})}),(0,Q.jsx)(`p`,{className:`oc-afiles__budget`,children:o({used:Z(be(S.files),P),total:Z(J,P),pct:F.format(X(be(S.files)))})})]}),j&&b?(0,Q.jsx)(Te,{instanceName:b.instanceName,agentId:b.agentId,name:j.name,isAdmin:t,onClose:()=>N(null),onSaved:()=>void A()}):null]})}function Te({instanceName:e,agentId:t,name:n,isAdmin:r,onClose:o,onSaved:ee}){let s=C(a.agentFiles.getAgentFile),te=C(a.agentFiles.setAgentFile),ne=P(),[l,re]=(0,K.useState)(null),[ie,u]=(0,K.useState)(!1),[d,p]=(0,K.useState)(``),[ae,w]=(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=>{u(!1);try{let i=await s({instanceName:e,agentId:t,name:n});re({content:i.content,updatedAtMs:i.updatedAtMs}),r||p(i.content),z(!1)}catch{u(!0)}},[s,e,t,n]);(0,K.useEffect)(()=>{H(!1)},[H]);async function U(){if(l!==null){L(!0),V(!1);try{await te({instanceName:e,agentId:t,name:n,content:d,baseUpdatedAtMs:l.updatedAtMs??void 0}),ne.success(O({name:n})),ee(),await H(!1)}catch(e){Ce(e)?z(!0):V(!0)}finally{L(!1)}}}let W=l!==null&&d!==l.content,G=(0,K.useMemo)(()=>l===null?null:Se(l.content,d),[l,d]),J=d.length>q,Y=oe(),X=(0,K.useMemo)(()=>new Intl.NumberFormat(Y),[Y]);return(0,Q.jsx)(me,{open:!0,onOpenChange:e=>!e&&o(),children:(0,Q.jsxs)(N,{className:`oc-afiles__editor`,children:[(0,Q.jsxs)(_e,{children:[(0,Q.jsx)(ve,{children:k({name:n})}),(0,Q.jsxs)(ge,{children:[i({agent:t,instance:e}),r?null:(0,Q.jsxs)(Q.Fragment,{children:[` · `,f()]})]})]}),ie?(0,Q.jsxs)(`p`,{className:`oc-afiles__error`,role:`alert`,children:[x(),` `,(0,Q.jsx)(M,{variant:`outline`,size:`sm`,onClick:()=>void H(!1),children:ce()})]}):l===null?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:y()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`textarea`,{className:`oc-afiles__source`,value:d,readOnly:!r,spellCheck:!1,onChange:e=>p(e.target.value),"aria-label":k({name:n})}),(0,Q.jsx)(`p`,{className:`oc-afiles__hint`,children:A()}),R?(0,Q.jsxs)(`p`,{className:`oc-afiles__error`,role:`alert`,children:[S(),` `,(0,Q.jsx)(M,{variant:`outline`,size:`sm`,onClick:()=>void H(!0),children:E()})]}):null,B?(0,Q.jsx)(`p`,{className:`oc-afiles__error`,role:`alert`,children:m()}):null,(0,Q.jsxs)(`div`,{className:`oc-afiles__editor-foot`,children:[(0,Q.jsx)(`span`,{className:`oc-afiles__count${J?` is-over`:``}`,children:g({count:X.format(d.length),max:X.format(q)})}),r?(0,Q.jsx)(M,{size:`sm`,disabled:!W||I||R,onClick:()=>w(!0),children:I?h():j()}):null]})]}),(0,Q.jsx)(fe,{open:ae,onOpenChange:w,children:(0,Q.jsxs)(ue,{children:[(0,Q.jsxs)(ye,{children:[(0,Q.jsx)(F,{children:D({name:n})}),(0,Q.jsx)(de,{children:b({agent:t})})]}),G?(0,Q.jsxs)(`div`,{className:`oc-afiles__diff`,children:[(0,Q.jsx)(`p`,{className:`oc-afiles__diff-counts`,children:v({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:se()}),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:T()}),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:c()}),(0,Q.jsx)(pe,{onClick:()=>void U(),children:_()})]})]})})]})})}export{we as AgentFilesTab};
@@ -1 +0,0 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$m as r,Am as i,Bm as ee,Cm as a,DO as o,Dm as te,Em as ne,Fm as re,Gm as s,Hm as c,Im as l,Jm as u,Km as d,Lm as f,Mm as p,NO as m,Nm as h,Om as ie,PO as g,Pm as ae,Qm as oe,Rm as se,Sm as ce,Tm as le,Um as ue,Vm as de,Wm as fe,Xm as pe,Ym as me,Zm as he,_m as _,bm as ge,eh as v,gm as y,hm as b,jm as x,km as S,mm as C,nh as w,qm as T,th as E,vm as D,wm as O,xm as k,ym as A,zm as j}from"./dist-DggIHtPt.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-BI4JM57h.js";import{n as be}from"./TimeRangePicker-Dj6YRWgA.js";import{t as xe}from"./FilterBar-CHAmMDFh.js";import{t as Se}from"./DataTableShell-B9cSAz8l.js";import{t as H}from"./dispatchErrorInfo-xSgyy7Pa.js";var U=t(e(),1),W=n(),G=`__all__`,Ce=[{value:`open`},{value:`acknowledged`},{value:`resolved`}];function we(e){return e===`open`?w():e===`acknowledged`?E():v()}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??``,_=e.status===K?G:e.status,v=e.severity??G,y=e.kind??G,[b,C]=(0,U.useState)(G),w=ye(e.from,e.to),{from:E,to:H}=be(w),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=m(o.anomalies.resolveAnomaly),Fe=(g(o.me.getMe,{host:ve})?.permissions??[]).includes(`admin.manage`),$=g(o.anomalies.listAnomalies,{limit:Oe,filter:{q:n||void 0,from:E,to:H,anomalyStatus:_===G?void 0:_,severity:v===G?void 0:v,source:b===G?void 0:b,kind:y===G?void 0:y}}),Ie=(0,U.useMemo)(()=>{let e=new Set;for(let t of $??[])e.add(t.kind);return[...e].sort()},[$]),Le=n!==``||_!==`open`||v!==G||b!==G||y!==G||w.kind!==`relative`||w.from!==De.from;function Re(){C(G),t({search:{status:`open`},replace:!0})}async function ze(e){if(await Pe({title:r(),description:(0,W.jsxs)(W.Fragment,{children:[oe(),` `,(0,W.jsx)(`span`,{className:`font-mono`,children:e.kind}),` `,he(),` `,(0,W.jsx)(`strong`,{children:pe()}),`.`,` `,me()]}),confirmLabel:u()}))try{await Q({anomalyId:e._id,status:`resolved`}),Z.success(T(),e.kind)}catch(e){Z.error(d(),e)}}async function Be(e){try{await Q({anomalyId:e._id,status:`acknowledged`}),Z.success(s(),e.kind)}catch(e){Z.error(fe(),e)}}return(0,W.jsxs)(W.Fragment,{children:[(0,W.jsxs)(`p`,{className:`oc-admin__hint`,children:[ue(),` `,(0,W.jsx)(`strong`,{children:c()}),` `,de(),` `,(0,W.jsx)(`strong`,{children:ee()}),` `,j(),` `,(0,W.jsx)(`strong`,{children:se()}),` `,f(),` `,(0,W.jsx)(`span`,{className:`oc-filter__window`,children:l()})]}),(0,W.jsxs)(xe,{q:n,onQChange:q,searchPlaceholder:re(),timeRange:w,onTimeRangeChange:X,onReset:Re,canReset:Le,children:[(0,W.jsxs)(V,{value:_,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:ae()}),Ce.map(e=>(0,W.jsx)(B,{value:e.value,children:we(e.value)},e.value))]})]}),(0,W.jsxs)(V,{value:v,onValueChange:Y,children:[(0,W.jsx)(F,{size:`sm`,className:`w-36`,children:(0,W.jsx)(N,{placeholder:h()})}),(0,W.jsxs)(R,{children:[(0,W.jsx)(B,{value:G,children:p()}),Te.map(e=>(0,W.jsx)(B,{value:e,children:e},e))]})]}),(0,W.jsxs)(V,{value:b,onValueChange:C,children:[(0,W.jsx)(F,{size:`sm`,className:`w-32`,children:(0,W.jsx)(N,{placeholder:x()})}),(0,W.jsxs)(R,{children:[(0,W.jsx)(B,{value:G,children:i()}),Ee.map(e=>(0,W.jsx)(B,{value:e,children:e},e))]})]}),(0,W.jsxs)(V,{value:y,onValueChange:Ne,children:[(0,W.jsx)(F,{size:`sm`,className:`w-36`,children:(0,W.jsx)(N,{placeholder:S()})}),(0,W.jsxs)(R,{children:[(0,W.jsx)(B,{value:G,children:ie()}),Ie.map(e=>(0,W.jsx)(B,{value:e,children:e},e))]})]})]}),(0,W.jsx)(Se,{title:te(),rows:$,emptyHint:_===`open`?ne():le(),rowActions:e=>Fe&&e.status===`open`?[{label:O(),onSelect:()=>void ze(e)},{label:a(),onSelect:()=>void Be(e)}]:[],columns:[{header:ce(),cell:e=>(0,W.jsx)(`span`,{className:`oc-traces__time`,children:new Date(e.at).toLocaleString(`fr-FR`)}),sort:e=>e.at},{header:S(),cell:e=>(0,W.jsx)(`code`,{className:`oc-traces__mono`,children:e.kind}),sort:e=>e.kind},{header:h(),cell:e=>(0,W.jsx)(Ae,{severity:e.severity}),sort:e=>e.severity===`critical`?2:+(e.severity===`warn`)},{header:k(),cell:e=>(0,W.jsx)(je,{status:e.status}),sort:e=>e.status===`resolved`?2:+(e.status===`acknowledged`)},{header:x(),cell:e=>(0,W.jsx)(I,{variant:`outline`,children:e.source}),sort:e=>e.source},{header:ge(),cell:e=>(0,W.jsx)(`span`,{className:`oc-anomaly__msg`,children:e.message}),sort:e=>e.message},{header:A(),cell:e=>(0,W.jsx)(ke,{row:e}),sort:e=>e.evidence??null},{header:D(),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:[`↗ `,_()]}):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:[`↗ `,_()]}):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:y()}):e===`acknowledged`?(0,W.jsx)(I,{variant:`secondary`,children:b()}):(0,W.jsx)(I,{variant:`outline`,children:C()})}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{$h as r,DO as i,Jh as a,PO as o,Qh as s,Xh as c,Yh as l,Zh as u,ag as ee,eg as d,ig as f,ng as p,og as m,qh as h,rg as g,sg as _,tg as v}from"./dist-DggIHtPt.js";import{C as y,Mt as b,S as x,a as S,b as C,i as w,jt as T,o as E,r as D,t as O,x as k,y as A}from"./index-BI4JM57h.js";import{n as j}from"./TimeRangePicker-Dj6YRWgA.js";import{t as M}from"./FilterBar-CHAmMDFh.js";import{t as N}from"./AdvancedFilter-C7EdUbso.js";import{t as P}from"./DataTableShell-B9cSAz8l.js";var F=t(e(),1),I=n(),L={kind:`relative`,from:O,to:`now`},R=`__all__`,z=[{value:`action`,label:`action`},{value:`realLabel`,label:`acteur réel`},{value:`targetLabel`,label:`au nom de`},{value:`impersonated`,label:`usurpation`},{value:`resource`,label:`ressource`},{value:`resourceId`,label:`id ressource`}];function B(){let e=b({from:`/settings/audit`}),t=T({from:`/settings/audit`}),n=e.q??``,O=e.action??R,B=e.impersonated??R,V=e.resource??R,H=D(e.from,e.to),U=(0,F.useMemo)(()=>E(e.adv),[e.adv]),{from:W,to:G}=j(H),K=e=>void t({search:t=>({...t,q:e||void 0}),replace:!0}),q=e=>void t({search:t=>({...t,action:e===R?void 0:e})}),J=e=>void t({search:t=>({...t,impersonated:e===R?void 0:e})}),Y=e=>void t({search:t=>({...t,resource:e===R?void 0:e})}),X=e=>void t({search:t=>({...t,...S(e)})}),Z=e=>void t({search:t=>({...t,adv:w(e)}),replace:!0}),Q=o(i.admin.listAudit,{filter:{q:n||void 0,from:W,to:G,action:O===R?void 0:O,resource:V===R?void 0:V,impersonated:B===R?void 0:B===`yes`,advanced:U.length>0?U:void 0}}),$=(0,F.useMemo)(()=>{let e=new Set;for(let t of Q??[])e.add(t.action);return[...e].sort()},[Q]),te=(0,F.useMemo)(()=>{let e=new Set;for(let t of Q??[])t.resource&&e.add(t.resource);return[...e].sort()},[Q]),ne=n!==``||O!==R||B!==R||V!==R||U.length>0||H.kind!==`relative`||H.from!==L.from;function re(){t({search:{},replace:!0})}return(0,I.jsxs)(I.Fragment,{children:[(0,I.jsxs)(`p`,{className:`oc-admin__hint`,children:[_(),` `,(0,I.jsx)(`span`,{className:`oc-filter__window`,children:m()})]}),(0,I.jsxs)(M,{q:n,onQChange:K,searchPlaceholder:ee(),timeRange:H,onTimeRangeChange:X,onReset:re,canReset:ne,children:[(0,I.jsxs)(A,{value:O,onValueChange:q,children:[(0,I.jsx)(x,{size:`sm`,className:`w-40`,children:(0,I.jsx)(y,{placeholder:f()})}),(0,I.jsxs)(C,{children:[(0,I.jsx)(k,{value:R,children:g()}),$.map(e=>(0,I.jsx)(k,{value:e,children:e},e))]})]}),(0,I.jsxs)(A,{value:B,onValueChange:J,children:[(0,I.jsx)(x,{size:`sm`,className:`w-40`,children:(0,I.jsx)(y,{})}),(0,I.jsxs)(C,{children:[(0,I.jsx)(k,{value:R,children:p()}),(0,I.jsx)(k,{value:`yes`,children:v()}),(0,I.jsx)(k,{value:`no`,children:d()})]})]}),(0,I.jsxs)(A,{value:V,onValueChange:Y,children:[(0,I.jsx)(x,{size:`sm`,className:`w-40`,children:(0,I.jsx)(y,{placeholder:r()})}),(0,I.jsxs)(C,{children:[(0,I.jsx)(k,{value:R,children:s()}),te.map(e=>(0,I.jsx)(k,{value:e,children:e},e))]})]})]}),(0,I.jsx)(N,{fields:z,seed:U,onChange:Z}),(0,I.jsx)(P,{title:u(),rows:Q,emptyHint:c(),columns:[{header:l(),cell:e=>new Date(e.at).toLocaleString(`fr-FR`),sort:e=>e.at},{header:f(),cell:e=>e.action,sort:e=>e.action},{header:a(),cell:e=>e.realLabel,sort:e=>e.realLabel},{header:h(),cell:e=>e.targetLabel??`—`,sort:e=>e.targetLabel??null},{header:r(),cell:e=>e.resource?e.resource+(e.resourceId?` · ${e.resourceId.slice(0,8)}`:``):`—`,sort:e=>e.resource??null}]})]})}export{B as AuditTab};
@@ -1 +0,0 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$u as r,Ad as i,Ar as a,Br as o,Bu as s,Cd as c,DO as l,Dd as u,Ed as d,Fr as f,Gr as p,Gu as m,Hr as h,Hu as g,Ir as _,Ju as v,Kr as y,Ku as b,Lr as x,Md as ee,NO as te,Nd as ne,OO as S,Od as re,PO as C,Pr as ie,Qu as ae,Rr as oe,Sd as se,Td as ce,Ur as le,Uu as ue,Vr as de,Vu as fe,Wr as pe,Wu as me,Xu as he,Yu as ge,Zu as _e,_d as ve,ad as ye,af as be,bd as xe,cd as Se,cf as Ce,dd as we,df as Te,ed as Ee,fd as w,ff as De,gd as Oe,hd as ke,hf as Ae,id as je,jO as Me,jd as Ne,kd as Pe,ld as Fe,lf as Ie,md as Le,mf as Re,nd as ze,nf as Be,od as Ve,of as He,pd as Ue,qr as We,qu as Ge,rd as Ke,sd as qe,sf as Je,td as Ye,tf as Xe,ud as Ze,uf as Qe,vd as $e,wd as et,xd as tt,yd as nt,zr as rt,zu as T}from"./dist-DggIHtPt.js";import{i as E,r as it}from"./dist-dDi5a2bA.js";import{t as at}from"./chevrons-up-down-0_epvFU7.js";import{i as ot,n as D,o as st,r as ct,s as lt}from"./FieldLabel-BGZ_qKFR.js";import{t as O}from"./button-J0r_4wz5.js";import{$ as ut,A as dt,At as k,C as A,H as ft,Q as pt,S as j,St as mt,U as ht,V as gt,X as M,Z as N,_ as _t,_t as vt,b as P,et as yt,jt as bt,kt as F,mt as I,nt as xt,ot as St,rt as Ct,x as L,y as R}from"./index-BI4JM57h.js";import{a as wt,i as z,n as Tt,o as B,r as V,t as Et}from"./table-BuMPc1vP.js";import{t as Dt}from"./FilterBar-CHAmMDFh.js";import{a as H,n as Ot,o as U,r as W,s as kt,t as At}from"./compatView-DPRQjsZh.js";import{t as G}from"./dispatchErrorInfo-xSgyy7Pa.js";var jt=S(`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=S(`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 U(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)=>U(e,t)??X(e,t))}var Z=n();function Yt({connections:e,displayByInstance:t}){let[n,i]=(0,K.useState)(Bt),[a,o]=(0,K.useState)(null),s=(0,K.useMemo)(()=>e.map((e,n)=>({_id:`${e.key}:${e.canonical}/${e.agentId}:${n}`,targetLabel:`${e.canonical}/${e.agentId}`,state:e.state,instanceName:e.instanceName??null,instanceLabel:e.instanceName?t.get(e.instanceName)??e.instanceName:null,gatewayHost:e.gatewayHost,gatewayVersion:e.gatewayVersion??null,okCount:e.okCount,errorCount:e.errorCount,attempts:e.attempts,lastOkAt:e.lastOkAt??null,lastErrorCode:e.lastErrorCode??null,lastErrorAt:e.lastErrorAt??null,lastDownstreamRejectCode:e.lastDownstreamRejectCode??null,lastDownstreamRejectAt:e.lastDownstreamRejectAt??null})),[e,t]),c=(0,K.useMemo)(()=>Kt(s),[s]),l=(0,K.useMemo)(()=>qt(s),[s]),u=(0,K.useMemo)(()=>Jt(s),[s]),d=(0,K.useMemo)(()=>Gt(Ht(s,n),a),[s,n,a]);function f(e){o(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:Ke()}):(0,Z.jsxs)(`div`,{className:`oc-conn`,children:[(0,Z.jsxs)(Dt,{q:n.q,onQChange:e=>i(t=>({...t,q:e})),searchPlaceholder:Ee(),onReset:()=>i(Bt),canReset:Vt(n),children:[(0,Z.jsxs)(R,{value:n.state,onValueChange:e=>i(t=>({...t,state:e})),children:[(0,Z.jsx)(j,{size:`sm`,className:`w-36`,children:(0,Z.jsx)(A,{placeholder:ae()})}),(0,Z.jsxs)(P,{children:[(0,Z.jsx)(L,{value:J,children:r()}),c.map(e=>(0,Z.jsx)(L,{value:e,children:Zt(e)},e))]})]}),(0,Z.jsxs)(R,{value:n.instance,onValueChange:e=>i(t=>({...t,instance:e})),children:[(0,Z.jsx)(j,{size:`sm`,className:`w-40`,children:(0,Z.jsx)(A,{placeholder:_e()})}),(0,Z.jsxs)(P,{children:[(0,Z.jsx)(L,{value:J,children:r()}),l.map(e=>(0,Z.jsx)(L,{value:e.name,children:e.label},e.name))]})]}),(0,Z.jsxs)(R,{value:n.version,onValueChange:e=>i(t=>({...t,version:e})),children:[(0,Z.jsx)(j,{size:`sm`,className:`w-36`,children:(0,Z.jsx)(A,{placeholder:he()})}),(0,Z.jsxs)(P,{children:[(0,Z.jsx)(L,{value:J,children:r()}),u.map(e=>(0,Z.jsx)(L,{value:e,children:e},e))]})]})]}),d.length===0?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:ge()}):(0,Z.jsxs)(Et,{className:`oc-conn__table`,children:[(0,Z.jsx)(wt,{children:(0,Z.jsxs)(B,{children:[(0,Z.jsx)(Q,{label:v(),sortKey:`target`,sort:a,onSort:f}),(0,Z.jsx)(Q,{label:Ge(),sortKey:`state`,sort:a,onSort:f}),(0,Z.jsx)(Q,{label:b(),sortKey:`instance`,sort:a,onSort:f}),(0,Z.jsx)(Q,{label:m(),sortKey:`host`,sort:a,onSort:f}),(0,Z.jsx)(Q,{label:me(),sortKey:`version`,sort:a,onSort:f}),(0,Z.jsx)(z,{children:ue()}),(0,Z.jsx)(Q,{label:g(),sortKey:`lastOk`,sort:a,onSort:f})]})}),(0,Z.jsx)(Tt,{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)(z,{"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)(it,{size:13,"aria-hidden":!0}):(0,Z.jsx)(E,{size:13,"aria-hidden":!0}):(0,Z.jsx)(at,{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)(B,{className:`oc-conn__row oc-conn__row--${e.state}`,children:[(0,Z.jsx)(V,{children:(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:e.targetLabel})}),(0,Z.jsx)(V,{children:(0,Z.jsx)(Qt,{state:e.state})}),(0,Z.jsx)(V,{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)(V,{children:(0,Z.jsx)(`span`,{className:`oc-bridge-target__host`,children:e.gatewayHost})}),(0,Z.jsx)(V,{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)(V,{children:(0,Z.jsx)(`span`,{className:`oc-conn__stats`,children:ze({ok:e.okCount,errors:e.errorCount,attempts:e.attempts})})}),(0,Z.jsx)(V,{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)(B,{className:`oc-conn__detail-row`,children:(0,Z.jsxs)(V,{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:[Ye({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`?fe():e===`error`?s():T()}function Qt({state:e}){return e===`connected`?(0,Z.jsx)(M,{variant:`secondary`,children:fe()}):e===`error`?(0,Z.jsx)(M,{variant:`destructive`,children:s()}):(0,Z.jsx)(M,{variant:`outline`,children:T()})}function $t(){return C(l.bridgeHealth.getBridgeHealth,{})}function en(){let e=$t(),t=C(l.compat.getBridgeCompat,{}),n=C(l.me.getMe,{host:St})?.role===`admin`,r=C(l.admin.listInstances,n?{}:`skip`),i=bt(),o=()=>void i({to:`/settings/anomalies`,search:{status:`open`}}),s=Rt(e?e.targets:[],t?t.targets:[],r??[]),c=t?.compat??null,u=t===void 0?`loading`:t===null?`nodata`:`ready`,d=c!==null&&Ot(c,`hermes`)&&!s.some(e=>e.key===`hermes`);return(0,Z.jsxs)(`div`,{className:`oc-bridge`,children:[(0,Z.jsx)(tn,{health:e,compat:t,onSeeAnomalies:o}),(0,Z.jsx)(`p`,{className:`oc-admin__hint oc-bridge__caption`,children:nt()}),s.map(e=>(0,Z.jsx)(nn,{providerKey:e.key,connections:e.connections,instances:e.instances,manifest:c,compatStatus:u,compatReachable:t?.reachable??!0,protocol:e.key===`openclaw`?t?.protocol??null:null},e.key)),d?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:a()}):null]})}function tn({health:e,compat:t,onSeeAnomalies:n}){let r=t!=null&&t.buildVersion!=null&&t.bridgeVersion!=null&&t.buildVersion!==t.bridgeVersion,i=t?.buildRevision&&t.buildRevision!==`unknown`?t.buildRevision.slice(0,7):null,a=t&&t!==null?(0,Z.jsxs)(`span`,{className:`oc-bridge-card__ver`,children:[(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:H(t.bridgeVersion)}),i?(0,Z.jsxs)(Z.Fragment,{children:[` `,(0,Z.jsxs)(`code`,{className:`oc-traces__mono`,title:p(),children:[`(`,i,`)`]})]}):null,r?(0,Z.jsxs)(`strong`,{className:`oc-bridge-card__mismatch`,children:[` `,pe({build:t.buildVersion??`?`})]}):null,` · `,le(),` `,(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:t.protocolVersion===null?h():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:we()});let o=Nt(e.targets),s=!e.reachable,c=Pt(e),l=c?`ok`:`error`,u=new Date(e.checkedAt).toLocaleString(`fr-FR`),d=e.startedAt==null?null:new Date(e.startedAt).toLocaleString(`fr-FR`);return(0,Z.jsxs)(`div`,{className:`oc-bridge-card oc-bridge-card--${l}`,children:[(0,Z.jsx)(`div`,{className:`oc-bridge-card__icon`,"aria-hidden":!0,children:c?(0,Z.jsx)(F,{size:22}):s?(0,Z.jsx)(Mt,{size:22}):(0,Z.jsx)(I,{size:22})}),(0,Z.jsxs)(`div`,{className:`oc-bridge-card__body`,children:[(0,Z.jsx)(`div`,{className:`oc-bridge-card__title`,children:c?Ze():s?Fe():Se({count:o.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}),` `,qe({time:u})]}),d?(0,Z.jsx)(`span`,{children:Ve({time:d})}):null,a]}),s?(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:ye()})]})}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)(vt,{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)(M,{variant:f===`beyond`?`destructive`:`secondary`,children:W(f)}):null]}),(0,Z.jsx)(`h4`,{className:`oc-bridge-provider__sub`,children:We()}),(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)(E,{size:13,"aria-hidden":!0}):(0,Z.jsx)(k,{size:13,"aria-hidden":!0}),je({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:[$e(),i.length>0?(0,Z.jsx)(M,{variant:`destructive`,children:Oe({count:i.length})}):(0,Z.jsx)(M,{variant:`secondary`,children:ve()})]}),(0,Z.jsxs)(`p`,{className:`oc-admin__hint`,children:[ke({version:e.vendoredVersion}),r?` · `+Le({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)(E,{size:13,"aria-hidden":!0}):(0,Z.jsx)(k,{size:13,"aria-hidden":!0}),Ue({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:y()}):(0,Z.jsxs)(`div`,{className:`oc-compat`,children:[n?null:(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:de()}),r===null?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:o()}):(0,Z.jsxs)(`div`,{className:`oc-compat__support`,children:[(0,Z.jsx)(`span`,{className:`oc-compat__label`,children:rt()}),e&&e.range!==null?(0,Z.jsx)(`span`,{children:oe({min:e.range.min,max:e.range.maxValidated})}):(0,Z.jsx)(`span`,{children:h()}),e?(0,Z.jsx)(cn,{versions:e.validatedVersions}):null]}),i.length===0?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:ie()}):(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:H(e.version)}),(0,Z.jsx)(M,{variant:e.state===`supported`?`secondary`:e.state===`beyond`?`destructive`:`outline`,children:W(e.state)})]},e.instanceName))})]})}function on({instance:e,onClose:t}){return(0,Z.jsx)(pt,{open:!0,onOpenChange:e=>!e&&t(),children:(0,Z.jsxs)(ut,{className:`oc-bridge-config-dialog`,onOpenAutoFocus:e=>e.preventDefault(),children:[(0,Z.jsxs)(xt,{children:[(0,Z.jsx)(Ct,{children:Ae({instance:e.displayName??e.name})}),(0,Z.jsx)(yt,{children:Re()})]}),(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)(F,{"aria-hidden":!0}):(0,Z.jsx)(I,{"aria-hidden":!0}),(0,Z.jsxs)(`span`,{children:[e,` — `,t.ok?c():t.detail]})]}):(0,Z.jsxs)(`p`,{className:`oc-bridge-config__check-row oc-bridge-config__check-row--skip`,children:[e,` — `,se()]}):null}function sn({instance:e,onClose:t}){let n=te(l.admin.upsertInstanceConfig),r=Me(l.bridge.validateMediaPaths),a=dt(),[o,s]=(0,K.useState)(()=>ot(e.config??{})),[c,f]=(0,K.useState)(!1),[p,m]=(0,K.useState)(!1),[h,g]=(0,K.useState)(null),_=o.inboundMediaMode===`shared-fs`,v=o.mediaMode===`shared-fs`,y=_||v;async function b(){m(!0),g(null);try{g(await r({instanceName:e.name,inboundMediaMode:o.inboundMediaMode,mediaMode:o.mediaMode}))}catch(e){a.error(u(),e)}finally{m(!1)}}async function x(){f(!0);try{let r=e.config??{};await n({instanceId:e._id,config:ct(o,r)}),t()}catch(e){a.error(Je(),e)}finally{f(!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)(D,{label:De(),help:He()}),(0,Z.jsxs)(R,{value:o.mediaMode,onValueChange:e=>s({...o,mediaMode:e}),children:[(0,Z.jsx)(j,{size:`sm`,className:`w-full`,children:(0,Z.jsx)(A,{})}),(0,Z.jsx)(P,{children:lt.map(e=>(0,Z.jsx)(L,{value:e,children:e},e))})]})]}),(0,Z.jsxs)(`label`,{className:`oc-field`,children:[(0,Z.jsx)(D,{label:Te(),help:be()}),(0,Z.jsxs)(R,{value:o.inboundMediaMode,onValueChange:e=>s({...o,inboundMediaMode:e}),children:[(0,Z.jsx)(j,{size:`sm`,className:`w-full`,children:(0,Z.jsx)(A,{})}),(0,Z.jsx)(P,{children:st.map(e=>(0,Z.jsx)(L,{value:e,children:e},e))})]})]}),(0,Z.jsxs)(`label`,{className:`oc-field`,children:[(0,Z.jsx)(D,{label:Qe(),help:Be()}),(0,Z.jsx)(N,{type:`number`,min:1,max:4096,className:`w-full`,value:o.mediaMaxMb,onChange:e=>s({...o,mediaMaxMb:Math.trunc(Number(e.target.value)||0)})})]})]}),y&&(0,Z.jsxs)(`div`,{className:`oc-bridge-config__grid`,children:[_&&(0,Z.jsxs)(`label`,{className:`oc-field`,children:[(0,Z.jsx)(D,{label:ne(),help:ee()}),(0,Z.jsx)(N,{className:`w-full`,spellCheck:!1,value:o.inboundAgentMount,onChange:e=>s({...o,inboundAgentMount:e.target.value})})]}),v&&(0,Z.jsxs)(`label`,{className:`oc-field`,children:[(0,Z.jsx)(D,{label:Ne(),help:i()}),(0,Z.jsx)(N,{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)(_t,{checked:o.rehydration,onCheckedChange:e=>s({...o,rehydration:e===!0})}),(0,Z.jsx)(D,{label:Ie(),help:Xe()})]}),y&&h!==null&&(0,Z.jsx)(`div`,{className:`oc-bridge-config__check`,children:h.reachable?!h.inbound&&!h.outbound?(0,Z.jsxs)(`p`,{className:`oc-bridge-config__check-row oc-bridge-config__check-row--err`,children:[(0,Z.jsx)(I,{"aria-hidden":!0}),xe({reason:h.reason??`?`})]}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)($,{label:ce(),result:h.inbound}),(0,Z.jsx)($,{label:et(),result:h.outbound}),(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:d()})]}):(0,Z.jsxs)(`p`,{className:`oc-bridge-config__check-row oc-bridge-config__check-row--err`,children:[(0,Z.jsx)(I,{"aria-hidden":!0}),tt()]})}),(0,Z.jsxs)(`div`,{className:`oc-bridge-config__actions`,children:[y&&(0,Z.jsxs)(O,{variant:`outline`,size:`sm`,onClick:()=>void b(),disabled:p,children:[p?(0,Z.jsx)(mt,{className:`size-4 animate-spin`,"aria-hidden":!0}):null,p?re():Pe()]}),(0,Z.jsx)(O,{size:`sm`,onClick:()=>void x(),disabled:c,children:Ce()})]})]})})}function cn({versions:e}){if(e.length===0)return null;let t=[...e].reverse();return(0,Z.jsxs)(gt,{children:[(0,Z.jsx)(ht,{asChild:!0,children:(0,Z.jsxs)(`button`,{type:`button`,className:`oc-compat__versions-btn`,children:[e.length===1?x():_({count:e.length}),(0,Z.jsx)(E,{size:13,"aria-hidden":!0})]})}),(0,Z.jsxs)(ft,{className:`oc-compat__versions-pop`,align:`start`,children:[(0,Z.jsx)(`p`,{className:`oc-compat__versions-title`,children:f()}),(0,Z.jsx)(`div`,{className:`oc-compat__versions-list`,children:t.map(e=>(0,Z.jsx)(M,{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{$r as r,A as i,DO as a,GS as o,Ii as s,Jr as c,NO as l,O as u,PO as d,Qr as f,Xr as p,Yr as m,Zr as h,ai as g,ba as _,eO as v,ei as y,ii as b,jO as x,k as S,ma as ee,ni as te,oi as ne,pa as re,pf as ie,ri as ae,ti as oe,va as se}from"./dist-DggIHtPt.js";import{t as C}from"./button-J0r_4wz5.js";import{A as ce,B as le,C as w,F as T,I as ue,L as de,N as fe,P as pe,R as me,S as he,Z as E,b as ge,g as D,h as O,mt as k,v as A,x as j,y as M,z as N}from"./index-BI4JM57h.js";import{i as P}from"./compatView-DPRQjsZh.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=l(a.admin.upsertInstanceConfig),n=typeof e.config?.summarizeThresholdChars==`number`?e.config.summarizeThresholdChars:null,[o,s]=(0,F.useState)(n===null?``:String(n)),[c,d]=(0,F.useState)(`idle`);(0,F.useEffect)(()=>{s(n===null?``:String(n)),d(`idle`)},[e._id,n]);let p=o.trim(),m=p===``?null:/^\d+$/.test(p)?Number.parseInt(p,10):NaN,h=m===null||Number.isInteger(m)&&m>=1e3&&m<=2e5,g=(m??null)!==n;async function v(){d(`saving`);try{let n={...e.config??{}};m===null?delete n.summarizeThresholdChars:n.summarizeThresholdChars=m,await t({instanceId:e._id,config:n}),d(`done`)}catch{d(`error`)}}return(0,R.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,R.jsx)(`span`,{className:`oc-cdefaults__label`,children:i()}),(0,R.jsxs)(`div`,{className:`oc-cdefaults__inline`,children:[(0,R.jsx)(E,{type:`number`,min:1e3,max:2e5,step:1e3,placeholder:`8000`,value:o,onChange:e=>s(e.target.value),className:`oc-cdefaults__number`,"aria-invalid":!h}),(0,R.jsx)(C,{size:`sm`,disabled:!g||!h||c===`saving`,onClick:()=>void v(),children:c===`saving`?_():y()})]}),h?null:(0,R.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:u()}),c===`done`?(0,R.jsx)(`p`,{className:`oc-admin__hint`,role:`status`,children:r()}):null,c===`error`?(0,R.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:f()}):null,(0,R.jsx)(`p`,{className:`oc-cdefaults__help`,children:S()})]})}function z(){let e=x(a.agentFiles.getChatDefaults),t=x(a.agentFiles.setChatDefaults),n=ce(),[i,l]=(0,F.useState)({status:`loading`}),[u,S]=(0,F.useState)({thinkingDefault:null,fastModeDefault:null}),[E,z]=(0,F.useState)(!1),[B,V]=(0,F.useState)(!1),H=d(a.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=d(a.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;l({status:`loading`});try{let n=L(await e(J));if(Y.current!==t)return;l({status:`done`,current:n}),S(n)}catch{if(Y.current!==t)return;l({status:`error`})}},[e,J]);(0,F.useEffect)(()=>{q===!1&&(G&&!U||X())},[X,q,G,U]);let Z=i.status===`done`?i.current:null,Q=Z!==null&&u.thinkingDefault!==null&&u.thinkingDefault!==Z.thinkingDefault,$=Z!==null&&u.fastModeDefault!==null&&u.fastModeDefault!==Z.fastModeDefault,be=Q||$;async function xe(){V(!0);try{await t({...J,...Q?{thinkingDefault:u.thinkingDefault}:{},...$?{fastModeDefault:u.fastModeDefault}:{}}),n.success(r()),await X()}catch(e){n.error(f(),e)}finally{V(!1)}}let Se=(0,F.useMemo)(()=>I.map(e=>({id:e,label:D(e)})),[]),Ce=(0,F.useMemo)(()=>[{id:`fast`,label:ee()},{id:`standard`,label:re()}],[]);return(0,R.jsxs)(`div`,{className:`oc-cdefaults`,children:[(0,R.jsx)(`p`,{className:`oc-admin__hint`,children:ne()}),G&&U?(0,R.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,R.jsx)(`span`,{className:`oc-cdefaults__label`,children:s()}),(0,R.jsxs)(M,{value:U,onValueChange:e=>W(e),disabled:B,children:[(0,R.jsx)(he,{size:`sm`,"aria-label":s(),children:(0,R.jsx)(w,{})}),(0,R.jsx)(ge,{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:ie()}):K===`loading`?(0,R.jsx)(`p`,{className:`oc-admin__hint`,children:v()}):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)]}):i.status===`loading`?(0,R.jsx)(`p`,{className:`oc-admin__hint`,children:v()}):i.status===`error`?(0,R.jsxs)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:[oe(),` `,(0,R.jsx)(C,{variant:`outline`,size:`sm`,onClick:()=>void X(),children:se()})]}):(0,R.jsxs)(R.Fragment,{children:[(0,R.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,R.jsx)(`span`,{className:`oc-cdefaults__label`,children:g()}),(0,R.jsx)(O,{options:Se,value:u.thinkingDefault,onChange:e=>S({...u,thinkingDefault:e}),disabled:B}),(0,R.jsx)(`p`,{className:`oc-cdefaults__help`,children:b()})]}),(0,R.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,R.jsx)(`span`,{className:`oc-cdefaults__label`,children:ae()}),(0,R.jsx)(O,{options:Ce,value:u.fastModeDefault===null?null:u.fastModeDefault?`fast`:`standard`,onChange:e=>S({...u,fastModeDefault:e===`fast`}),disabled:B}),(0,R.jsx)(`p`,{className:`oc-cdefaults__help`,children:te()})]}),(0,R.jsx)(`div`,{className:`oc-cdefaults__actions`,children:(0,R.jsx)(C,{size:`sm`,disabled:!be||B,onClick:()=>z(!0),children:B?_():y()})}),(0,R.jsx)(`p`,{className:`oc-cdefaults__note`,children:h()})]}),(()=>{let e=H?.find(e=>e.name===(U??H[0]?.name));return e?(0,R.jsx)(_e,{instance:e}):null})(),(0,R.jsx)(fe,{open:E,onOpenChange:z,children:(0,R.jsxs)(ue,{children:[(0,R.jsxs)(N,{children:[(0,R.jsx)(le,{children:p()}),(0,R.jsx)(de,{children:m()})]}),(0,R.jsxs)(me,{children:[(0,R.jsx)(T,{children:o()}),(0,R.jsx)(pe,{onClick:()=>void xe(),children:c()})]})]})})]})}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,Cy as s,DO as c,Dv as l,Ev as u,Fv as d,Gv as f,Hv as p,Iv as m,Jv as h,Kv as ee,Lv as te,Mv as g,NO as _,Nv as v,Ov as y,PO as ne,Pv as re,Qv as b,Rv as ie,Sv as x,Sy as S,Tv as C,Uv as w,Vv as T,Wv as E,Xv as D,Yv as O,Zv as k,_y as A,ay as j,by as M,cy as N,dy as P,ey as F,fy as I,gy as L,hy as R,iy as z,jv as B,kv as ae,ly as V,my as H,ny as U,oy as W,py as G,qv as K,ry as q,sy as J,ty as oe,uy as se,vy as ce,wv as le,xy as ue,yy as de,zv as fe}from"./dist-DggIHtPt.js";import{t as pe}from"./button-J0r_4wz5.js";import{j as me}from"./index-BI4JM57h.js";import{t as he}from"./DataTableShell-B9cSAz8l.js";var Y=t(e(),1),X=n(),Z={altered_words:()=>s(),incorrect:()=>S(),incoherence:()=>ue(),formatting:()=>M(),latency:()=>de(),api_error:()=>ce(),other:()=>A()},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:R()}):e===!1?(0,X.jsx)(`span`,{className:`oc-fbadmin__pill is-warn`,children:H()}):(0,X.jsx)(`span`,{className:`oc-fbadmin__pill`,children:`—`}):(0,X.jsx)(`span`,{className:`oc-fbadmin__pill`,children:L()})}function ge({data:e,closeReason:t}){let n=e.snapshot,i=_(c.feedback.respondToFeedback),[a,o]=(0,Y.useState)(e.thread),[s,l]=(0,Y.useState)(``),[u,d]=(0,Y.useState)(!1);async function f(){let t=s.trim();if(!(!t||u)){d(!0);try{await i({feedbackId:e._id,text:t}),o(e=>[...e,{authorRole:`admin`,text:t,at:Date.now()}]),l(``)}finally{d(!1)}}}let p=[];try{p=n.contextJson?JSON.parse(n.contextJson):[]}catch{p=[]}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?` · ${G()}`:``,n.openclawModel?` · ${n.openclawModel}`:``,n.openclawRuntime?` (${n.openclawRuntime})`:``]})]}),e.comment?(0,X.jsxs)(`section`,{children:[(0,X.jsx)(`h4`,{className:`oc-fbadmin__h`,children:I()}),(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:y()}),(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:P()}),a.length>0?(0,X.jsx)(`div`,{className:`oc-fbadmin__thread`,children:a.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`?se():V()}),(0,X.jsx)(`span`,{className:`oc-notif__msg-text`,children:e.text})]},t))}):(0,X.jsx)(`p`,{className:`oc-fbadmin__meta`,children:N()}),(0,X.jsx)(`textarea`,{className:`oc-feedback__textarea`,placeholder:J(),value:s,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 f(),disabled:!s.trim()||u,children:u?W():j()})})]}),(0,X.jsxs)(`section`,{children:[(0,X.jsx)(`h4`,{className:`oc-fbadmin__h`,children:z()}),(0,X.jsx)(`pre`,{className:`oc-msg__source-pre`,children:n.messageText||q()})]}),n.clientInfo?.sourceWasOpen&&n.displayedText!==void 0?(0,X.jsxs)(`section`,{children:[(0,X.jsx)(`h4`,{className:`oc-fbadmin__h`,children:U()}),(0,X.jsx)(`pre`,{className:`oc-msg__source-pre`,children:n.displayedText||q()})]}):null,n.promptText?(0,X.jsxs)(`section`,{children:[(0,X.jsx)(`h4`,{className:`oc-fbadmin__h`,children:oe()}),(0,X.jsx)(`pre`,{className:`oc-msg__source-pre`,children:n.promptText})]}):null,p.length>0?(0,X.jsxs)(`section`,{children:[(0,X.jsx)(`h4`,{className:`oc-fbadmin__h`,children:F({count:n.contextCount??p.length,truncated:n.contextTruncated?r():``})}),(0,X.jsx)(`div`,{className:`oc-fbadmin__ctx`,children:p.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:b()}),(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:k()}),(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:D()}),(0,X.jsxs)(`p`,{className:`oc-fbadmin__env`,children:[[n.clientInfo?.language,n.clientInfo?.timezone,n.clientInfo?.theme?O({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:[h(),` `,n.clientInfo.plugins.join(`, `),(0,X.jsxs)(`span`,{className:`oc-fbadmin__note`,children:[` `,K()]})]}):null,n.clientInfo?.userAgent?(0,X.jsx)(`span`,{className:`oc-fbadmin__ua`,children:n.clientInfo.userAgent}):null]})]})]})}function _e(){let e=ne(c.feedback.listForAdmin,{}),t=_(c.feedback.readSnapshot),n=_(c.feedback.deleteFeedback),r=me(),[s,h]=(0,Y.useState)(null),[y,b]=(0,Y.useState)({});async function S(e){if(s===e._id){h(null);return}if(!y[e._id]){let n=await t({feedbackId:e._id});b(t=>({...t,[e._id]:n}))}h(e._id)}async function D(e){await r({title:le(),description:o(),confirmLabel:x(),destructive:!0})&&(await n({feedbackId:e._id}),s===e._id&&h(null))}return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`p`,{className:`oc-admin__hint`,children:[ee(),` `,(0,X.jsx)(`strong`,{children:f()}),` `,E()]}),(0,X.jsx)(he,{title:w(),rows:e,emptyHint:p(),isExpanded:e=>s===e._id&&!!y[e._id],renderExpanded:e=>y[e._id]?(0,X.jsx)(ge,{data:y[e._id],closeReason:e.userCloseReason}):null,columns:[{header:T(),cell:e=>new Date(e.at).toLocaleString(`fr-FR`),sort:e=>e.at},{header:a(),cell:e=>Q(e.category),sort:e=>Q(e.category)},{header:fe(),cell:e=>e.messageRole===`user`?ie():te(),sort:e=>e.messageRole},{header:m(),cell:e=>(e.reporterEmail||e.reporterName||`—`)+(e.impersonated&&e.realOperatorEmail?` ${d({operator:e.realOperatorEmail})}`:``),sort:e=>e.reporterEmail||e.reporterName||null},{header:re(),cell:e=>(0,X.jsx)($,{matches:e.displayedMatchesStored,sourceWasOpen:e.sourceWasOpen}),sort:e=>e.displayedMatchesStored===!1?0:e.displayedMatchesStored===!0?1:2},{header:v(),cell:e=>e.hasComment?`✎`:`—`,sort:e=>+!!e.hasComment},{header:g(),cell:e=>e.userClosedAt==null?e.answered?(0,X.jsx)(`span`,{className:`oc-fbadmin__pill is-ok`,children:B()}):(0,X.jsx)(`span`,{className:`oc-fbadmin__pill`,children:i()}):(0,X.jsx)(`span`,{className:`oc-fbadmin__pill is-closed`,children:ae()}),sort:e=>e.userClosedAt==null?+!!e.answered:2}],rowActions:e=>[{label:s===e._id?l():u(),onSelect:()=>void S(e)},{label:C(),onSelect:()=>void D(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,AD as ee,CD as te,DD as i,DO as a,ED as o,GS as s,MD as c,NO as l,OD as u,PO as ne,QE as re,SD as ie,TD as ae,ZE as oe,_D as d,aD as f,bD as p,cD as se,dD as ce,eD as le,eO as ue,fD as de,gD as m,hD as h,iD as g,jD as fe,kD as _,lD as pe,mD as me,nD as he,nO as ge,oD as _e,pD as ve,rD as v,sD as y,tD as b,uD as x,vD as S,wD as C,xD as w,yD as T}from"./dist-DggIHtPt.js";import{t as E}from"./button-J0r_4wz5.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 L,W as Se,X as Ce,Y as we,b as R,ht as Te,x as z,y as B,yt as Ee,z as De}from"./index-BI4JM57h.js";import{a as Oe,i as V,n as ke,o as H,r as U,t as Ae}from"./table-BuMPc1vP.js";var W=t(e(),1),G=n(),K=`all`;function q(e){switch(e){case`image`:return w();case`audio`:return p();case`video`:return T();case`pdf`:return S();case`document`:return d();case`archive`:return m();default:return h()}}function J(){let[e,t]=(0,W.useState)(K),[n,d]=(0,W.useState)(K),[p,m]=(0,W.useState)(K),[h,S]=(0,W.useState)(K),[w,T]=(0,W.useState)(null),J=l(a.files.softDelete),Y=D();function je(){t(K),d(K),m(K),S(K)}async function Me(){let e=w;if(T(null),e)try{await J({fileId:e.id}),Y.success(g())}catch(e){Y.error(v(),e)}}let X=ne(a.files.listMine,{direction:e===K?void 0:e,chatId:n===K?void 0:n,instanceName:p===K?void 0:p,category:h===K?void 0:h}),Ne=(0,W.useMemo)(()=>new Intl.DateTimeFormat(ge(),{dateStyle:`medium`,timeStyle:`short`}),[]);if(X===void 0)return(0,G.jsx)(`p`,{className:`oc-admin__hint`,children:ue()});let{files:Z,facets:Q,truncated:Pe,cap:Fe}=X,$=e!==K||n!==K||p!==K||h!==K;return(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`p`,{className:`oc-admin__hint`,children:c()}),(0,G.jsxs)(`div`,{className:`oc-files__filters`,style:{display:`flex`,flexWrap:`wrap`,gap:8,margin:`12px 0`},children:[(0,G.jsxs)(B,{value:e,onValueChange:t,children:[(0,G.jsx)(I,{size:`sm`,"aria-label":fe(),children:(0,G.jsx)(k,{})}),(0,G.jsxs)(R,{children:[(0,G.jsx)(z,{value:K,children:ee()}),(0,G.jsx)(z,{value:`inbound`,children:_()}),(0,G.jsx)(z,{value:`outbound`,children:u()})]})]}),(0,G.jsxs)(B,{value:n,onValueChange:d,children:[(0,G.jsx)(I,{size:`sm`,"aria-label":i(),children:(0,G.jsx)(k,{})}),(0,G.jsxs)(R,{children:[(0,G.jsx)(z,{value:K,children:o()}),Q.chats.map(e=>(0,G.jsx)(z,{value:e.id,children:e.title},e.id))]})]}),Q.multiProvider?(0,G.jsxs)(B,{value:p,onValueChange:m,children:[(0,G.jsx)(I,{size:`sm`,"aria-label":ae(),children:(0,G.jsx)(k,{})}),(0,G.jsxs)(R,{children:[(0,G.jsx)(z,{value:K,children:C()}),Q.instances.map(e=>(0,G.jsx)(z,{value:e,children:e},e))]})]}):null,(0,G.jsxs)(B,{value:h,onValueChange:S,children:[(0,G.jsx)(I,{size:`sm`,"aria-label":te(),children:(0,G.jsx)(k,{})}),(0,G.jsxs)(R,{children:[(0,G.jsx)(z,{value:K,children:ie()}),Q.categories.map(e=>(0,G.jsx)(z,{value:e,children:q(e)},e))]})]}),$?(0,G.jsxs)(E,{variant:`ghost`,size:`sm`,onClick:je,style:{display:`inline-flex`,alignItems:`center`,gap:4,marginLeft:`auto`},children:[(0,G.jsx)(Ee,{size:14,"aria-hidden":!0}),y()]}):null]}),Z.length===0?(0,G.jsx)(`p`,{className:`oc-admin__hint`,children:$?re():r()}):(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(Ae,{children:[(0,G.jsx)(Oe,{children:(0,G.jsxs)(H,{children:[(0,G.jsx)(V,{children:me()}),(0,G.jsx)(V,{children:ve()}),(0,G.jsx)(V,{children:de()}),(0,G.jsx)(V,{children:ce()}),(0,G.jsx)(V,{children:x()}),(0,G.jsx)(V,{className:`text-right`,children:pe()})]})}),(0,G.jsx)(ke,{children:Z.map(e=>(0,G.jsxs)(H,{children:[(0,G.jsx)(U,{className:`font-medium`,style:{maxWidth:280,overflow:`hidden`,textOverflow:`ellipsis`},title:e.filename,children:e.filename}),(0,G.jsx)(U,{title:e.mimeType,children:q(e.category)}),(0,G.jsx)(U,{children:(0,G.jsx)(Ce,{variant:`secondary`,children:e.direction===`inbound`?_():u()})}),(0,G.jsx)(U,{style:{maxWidth:220,overflow:`hidden`,textOverflow:`ellipsis`},title:e.chatTitle,children:e.chatTitle}),(0,G.jsx)(U,{className:`whitespace-nowrap text-muted-foreground`,children:Ne.format(e.createdAt)}),(0,G.jsx)(U,{className:`text-right`,children:(0,G.jsxs)(Se,{children:[(0,G.jsx)(we,{asChild:!0,children:(0,G.jsx)(E,{variant:`ghost`,size:`icon`,"aria-label":_e(),children:(0,G.jsx)(L,{size:16})})}),(0,G.jsxs)(M,{align:`end`,children:[e.url?(0,G.jsx)(P,{asChild:!0,children:(0,G.jsxs)(`a`,{href:e.url,download:e.filename,target:`_blank`,rel:`noopener noreferrer`,children:[(0,G.jsx)(A,{size:14}),se()]})}):(0,G.jsxs)(P,{disabled:!0,children:[(0,G.jsx)(A,{size:14}),le()]}),(0,G.jsxs)(P,{variant:`destructive`,onSelect:()=>T({id:e._id,filename:e.filename}),children:[(0,G.jsx)(Te,{size:14}),f()]})]})]})})]},e._id))})]}),Pe?(0,G.jsx)(`p`,{className:`oc-admin__hint`,style:{marginTop:8},children:oe({cap:Fe})}):null]}),(0,G.jsx)(ye,{open:w!==null,onOpenChange:e=>!e&&T(null),children:(0,G.jsxs)(N,{children:[(0,G.jsxs)(De,{children:[(0,G.jsx)(O,{children:he()}),(0,G.jsx)(F,{children:b()})]}),(0,G.jsxs)(xe,{children:[(0,G.jsx)(j,{children:s()}),(0,G.jsx)(be,{onClick:()=>void Me(),children:f()})]})]})})]})}export{J 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,Ao as i,Ba as a,Bo as o,Co as s,DO as c,Do as l,Eo as u,Fa as d,Fo as f,Ga as p,Ha as m,Ia as h,Io as g,Ja as _,Ka as v,La as y,Lo as b,Ma as x,Mo as ee,NO as S,Na as C,No as w,OO as T,Oo as te,PO as E,Pa as D,Po as O,Qa as k,Ra as A,Ro as ne,So as j,To as M,Ua as N,Va as P,Vo as F,Wa as I,Xa as L,Ya as R,Za as re,_o as ie,ao as ae,bo as oe,co as se,do as ce,eo as le,fo as z,go as ue,ho as de,io as fe,jo as pe,ko as me,lo as he,mo as ge,no as _e,oo as ve,po as ye,qa as be,ro as B,so as xe,to as Se,uo as Ce,vo as we,wo as Te,xo as Ee,yo as De,za as Oe,zo as ke}from"./dist-DggIHtPt.js";import{t as Ae}from"./x-CjN2swsp.js";import{i as V,n as H,r as je,t as Me}from"./tabs-BTVXPiSJ.js";import{t as U}from"./button-J0r_4wz5.js";import{$ as Ne,A as W,At as Pe,C as Fe,Q as Ie,S as Le,X as G,Z as K,_ as q,_t as J,b as Re,et as ze,gt as Y,j as Be,m as Ve,nt as He,ot as Ue,rt as We,x as Ge,y as Ke}from"./index-BI4JM57h.js";import{t as qe}from"./FilterBar-CHAmMDFh.js";import{t as Je}from"./DataTableShell-B9cSAz8l.js";import{t as X}from"./DetailChips-CWQEoST8.js";var Ye=T(`chevron-left`,[[`path`,{d:`m15 18-6-6 6-6`,key:`1wnfg3`}]]),Xe=T(`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`}]]),Z=T(`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`}]]),Ze=T(`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`}]]),Q=t(e(),1);function Qe(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 $e(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 et(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 tt(e){switch(e){case`admin`:return se();case`user`:return xe();case`pending`:return ve();default:return e}}function nt(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 rt(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 $=n(),it={name:``,description:``};function at(){let e=E(c.groups.listGroups,{}),t=E(c.me.getMe,{host:Ue})?.role===`admin`,n=S(c.groups.createGroup),r=S(c.groups.updateGroup),a=S(c.groups.deleteGroup),p=Be(),m=W(),[h,_]=(0,Q.useState)(!1),[v,y]=(0,Q.useState)(null),[x,C]=(0,Q.useState)(it),[T,k]=(0,Q.useState)(null),[A,N]=(0,Q.useState)(``),P=(0,Q.useMemo)(()=>{if(!e)return e;let t=A.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,A]);function I(){y(null),C(it),_(!0)}function L(e){y(e),C({name:e.name,description:e.description??``}),_(!0)}async function R(){try{v?await r({groupId:v._id,name:x.name,description:x.description}):await n({name:x.name,description:x.description||void 0}),C(it),y(null),_(!1)}catch(e){m.error(d(),e)}}async function re(e){if(await p({title:j({name:e.name}),description:Ee(),confirmWord:e.name,confirmLabel:oe(),cancelLabel:te(),destructive:!0}))try{await a({groupId:e._id})}catch(e){m.error(D(),e)}}return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`p`,{className:`oc-admin__hint`,children:o()}),(0,$.jsx)(qe,{q:A,onQChange:N,onReset:()=>N(``),canReset:A!==``,searchPlaceholder:w()}),(0,$.jsx)(Je,{title:F(),rows:P,addLabel:ke(),onAdd:t?I:void 0,emptyHint:ne(),columns:[{header:b(),cell:e=>e.name,sort:e=>e.name},{header:g(),cell:e=>(0,$.jsx)(X,{icon:(0,$.jsx)(Ze,{size:12,"aria-hidden":!0}),total:e.memberCount,items:e.members.map(e=>({label:e.label,marker:e.manager?(0,$.jsx)(Z,{size:11,"aria-hidden":!0}):null,highlight:e.manager}))}),sort:e=>e.memberCount},{header:f(),cell:e=>(0,$.jsx)(X,{icon:(0,$.jsx)(J,{size:12,"aria-hidden":!0}),total:e.agentCount,items:e.agents.map(e=>({label:e}))}),sort:e=>e.agentCount},{header:O(),cell:e=>(0,$.jsx)(X,{icon:(0,$.jsx)(Xe,{size:12,"aria-hidden":!0}),total:e.chartCount,items:e.charts.map(e=>({label:e.name,marker:e.isDefault?(0,$.jsx)(Y,{size:11,fill:`currentColor`,"aria-hidden":!0}):null,highlight:e.isDefault}))}),sort:e=>e.chartCount}],rowActions:e=>[{label:ee(),onSelect:()=>k({groupId:e._id,name:e.name})},...t?[{label:pe(),onSelect:()=>L(e)},{label:i(),variant:`destructive`,onSelect:()=>void re(e)}]:[]]}),(0,$.jsx)(Ve,{open:h,onOpenChange:_,title:v?u():l(),description:M(),canSubmit:!!x.name.trim(),onSubmit:R,submitLabel:me(),children:(0,$.jsxs)(`div`,{className:`oc-form`,children:[(0,$.jsxs)(`label`,{className:`oc-field`,children:[(0,$.jsx)(`span`,{className:`oc-field__label`,children:Te()}),(0,$.jsx)(K,{value:x.name,onChange:e=>C({...x,name:e.target.value})})]}),(0,$.jsxs)(`label`,{className:`oc-field`,children:[(0,$.jsx)(`span`,{className:`oc-field__label`,children:s()}),(0,$.jsx)(K,{value:x.description,onChange:e=>C({...x,description:e.target.value})})]})]})}),(0,$.jsx)(ct,{groupId:T?.groupId??null,groupName:T?.name??``,open:T!==null,onOpenChange:e=>{e||k(null)}})]})}var ot=8;function st({page:e,pageCount:t,onPage:n}){return t<=1?null:(0,$.jsxs)(`div`,{className:`oc-access__pager`,children:[(0,$.jsxs)(U,{type:`button`,variant:`ghost`,size:`sm`,disabled:e<=1,onClick:()=>n(e-1),children:[(0,$.jsx)(Ye,{size:14,"aria-hidden":!0}),ce()]}),(0,$.jsxs)(`span`,{className:`oc-access__pageinfo`,"aria-label":he({page:e,pages:t}),children:[e,` / `,t]}),(0,$.jsxs)(U,{type:`button`,variant:`ghost`,size:`sm`,disabled:e>=t,onClick:()=>n(e+1),children:[Ce(),(0,$.jsx)(Pe,{size:14,"aria-hidden":!0})]})]})}function ct({groupId:e,groupName:t,open:n,onOpenChange:r}){let i=E(c.groups.getGroup,n&&e?{groupId:e}:`skip`),o=E(c.groups.listAssignableInstances,n?{}:`skip`),s=E(c.groups.listAssignableUsers,n?{}:`skip`),l=S(c.groups.addMember),u=S(c.groups.removeMember),d=S(c.groups.bulkSetMembers),f=S(c.groups.setGroupManager),p=W(),[m,h]=(0,Q.useState)(``),[g,v]=(0,Q.useState)(``),[b,x]=(0,Q.useState)(`members`),[ee,w]=(0,Q.useState)(1),[T,te]=(0,Q.useState)(new Set),D=(0,Q.useRef)(null),O=(0,Q.useMemo)(()=>new Set((i?.members??[]).map(e=>e.userId)),[i]),k=(0,Q.useMemo)(()=>new Set((i?.members??[]).filter(e=>e.manager).map(e=>e.userId)),[i]),ne=i?.viewerIsAdmin===!0,j=(0,Q.useMemo)(()=>new Set((i?.agents??[]).map(e=>`${e.instanceName}/${e.agentId}`)),[i]);(0,Q.useEffect)(()=>{h(``),v(``),x(`members`),w(1),D.current=null},[n,e]),(0,Q.useEffect)(()=>{w(1)},[m]),(0,Q.useEffect)(()=>{n&&i&&e&&D.current!==e&&(D.current=e,te(new Set((i.members??[]).map(e=>e.userId))))},[n,i,e]);let M=(0,Q.useMemo)(()=>s?Qe(s,m,T):[],[s,m,T]);async function N(t,n){if(e)try{n?await u({groupId:e,userId:t}):await l({groupId:e,userId:t})}catch(e){p.error(C(),e)}}async function P(t,n){if(e)try{await f({groupId:e,userId:t,manager:!n})}catch(e){p.error(y(),e)}}let F=nt(M,e=>O.has(e.userId)),I=M.filter(e=>O.has(e.userId)).length,L=rt(M,ee,ot);async function R(){if(!e||M.length===0)return;let t=M.map(e=>e.userId);try{await d({groupId:e,userIds:t,member:F!==`all`})}catch(e){p.error(C(),e)}}return(0,$.jsx)(Ie,{open:n,onOpenChange:r,children:(0,$.jsxs)(Ne,{className:`oc-access`,children:[(0,$.jsxs)(He,{children:[(0,$.jsx)(We,{children:De({name:t})}),(0,$.jsx)(ze,{children:we()})]}),(0,$.jsxs)(Me,{value:b,onValueChange:x,className:`oc-access__tabs`,children:[(0,$.jsxs)(je,{className:`w-full`,children:[(0,$.jsxs)(V,{value:`members`,className:`flex-1 gap-1.5`,children:[(0,$.jsx)(Ze,{size:13,"aria-hidden":!0}),ie(),i?(0,$.jsx)(G,{variant:`secondary`,className:`oc-access__tabcount`,children:O.size}):null]}),(0,$.jsxs)(V,{value:`agents`,className:`flex-1 gap-1.5`,children:[(0,$.jsx)(J,{size:13,"aria-hidden":!0}),de(),i?(0,$.jsx)(G,{variant:`secondary`,className:`oc-access__tabcount`,children:j.size}):null]}),(0,$.jsxs)(V,{value:`charts`,className:`flex-1 gap-1.5`,children:[(0,$.jsx)(Xe,{size:13,"aria-hidden":!0}),_(),i?(0,$.jsx)(G,{variant:`secondary`,className:`oc-access__tabcount`,children:i.chartCount}):null]})]}),(0,$.jsx)(H,{value:`members`,children:s===void 0||i===void 0?(0,$.jsx)(`p`,{className:`oc-access__hint`,children:B()}):s.length===0?(0,$.jsx)(`p`,{className:`oc-access__hint`,children:Se()}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(K,{value:m,onChange:e=>h(e.target.value),placeholder:ue(),className:`oc-access__search`}),M.length===0?(0,$.jsx)(`p`,{className:`oc-access__hint`,children:ye()}):(0,$.jsxs)($.Fragment,{children:[M.length>1?(0,$.jsxs)(`div`,{className:`oc-access__row oc-access__selectall`,children:[(0,$.jsx)(q,{checked:F===`all`?!0:F===`some`?`indeterminate`:!1,onCheckedChange:()=>void R(),"aria-label":z()}),(0,$.jsx)(`span`,{className:`oc-access__label`,children:z()}),(0,$.jsxs)(G,{variant:`outline`,className:`oc-access__count`,children:[I,` / `,M.length]})]}):null,(0,$.jsx)(`div`,{className:`oc-access__list`,children:L.pageItems.map(e=>{let t=O.has(e.userId),n=et(e),r=k.has(e.userId);return(0,$.jsxs)(`div`,{className:`oc-access__row`,children:[(0,$.jsx)(q,{checked:t,onCheckedChange:()=>void N(e.userId,t),"aria-label":ae({user:n.primary})}),(0,$.jsxs)(`span`,{className:`oc-access__who`,children:[(0,$.jsx)(`span`,{className:`oc-access__label`,title:n.primary,children:n.primary}),n.secondary?(0,$.jsx)(`span`,{className:`oc-access__sub`,title:n.secondary,children:n.secondary}):null]}),(0,$.jsx)(G,{variant:`outline`,className:`oc-access__role`,children:tt(e.role)}),(0,$.jsx)(`span`,{className:`oc-access__mgrslot`,children:t&&ne?(0,$.jsx)(U,{type:`button`,variant:`ghost`,size:`icon`,className:`shrink-0 oc-access__mgr${r?` oc-access__mgr--on`:``}`,"aria-pressed":r,"aria-label":r?A():Oe(),title:r?A():Oe(),onClick:()=>void P(e.userId,r),children:(0,$.jsx)(Z,{size:15,"aria-hidden":!0})}):t&&r?(0,$.jsx)(`span`,{className:`oc-access__mgr oc-access__mgr--on`,role:`img`,"aria-label":a(),title:a(),children:(0,$.jsx)(Z,{size:15,"aria-hidden":!0})}):null})]},e._id)})}),(0,$.jsx)(st,{page:L.page,pageCount:L.pageCount,onPage:w})]})]})}),(0,$.jsx)(H,{value:`agents`,children:o===void 0?(0,$.jsx)(`p`,{className:`oc-access__hint`,children:B()}):o.length===0?(0,$.jsx)(`p`,{className:`oc-access__hint`,children:le()}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(K,{value:g,onChange:e=>v(e.target.value),placeholder:ge(),className:`oc-access__search`}),(0,$.jsx)(`div`,{className:`oc-access__list`,children:o.map(t=>(0,$.jsx)(lt,{groupId:e,instanceName:t.name,kind:t.kind??`openclaw`,assigned:j,query:g},`${e}-${t._id}`))})]})}),(0,$.jsx)(H,{value:`charts`,children:(0,$.jsx)(ut,{groupId:e})})]})]})})}function lt({groupId:e,instanceName:t,kind:n,assigned:i,query:a}){let o=E(c.groups.listAssignableAgents,{instanceName:t}),s=S(c.groups.assignAgentToGroup),l=S(c.groups.removeAgentFromGroup),u=S(c.groups.bulkSetGroupAgents),d=W(),[f,p]=(0,Q.useState)(1);if((0,Q.useEffect)(()=>{p(1)},[a]),!e)return null;let m=$e(o?.agents??[],a),h=o?.discovery&&!o.discovery.lastPollOk;if(a.trim()&&m.length===0)return null;let g=m.filter(e=>e.presentInLastOk!==!1),_=nt(g,e=>i.has(`${t}/${e.agentId}`)),v=rt(m,f,ot);async function y(n,r){try{r?await l({groupId:e,instanceName:t,agentId:n}):await s({groupId:e,instanceName:t,agentId:n})}catch(e){d.error(x(),e)}}async function b(){if(g.length===0)return;let n=g.map(e=>e.agentId);try{await u({groupId:e,instanceName:t,agentIds:n,assigned:_!==`all`})}catch(e){d.error(x(),e)}}return(0,$.jsxs)(`div`,{className:`oc-access__group`,children:[(0,$.jsxs)(`div`,{className:`oc-access__instance`,children:[(0,$.jsx)(J,{size:13,"aria-hidden":!0}),(0,$.jsx)(`span`,{children:t}),(0,$.jsx)(G,{variant:`outline`,className:`oc-access__kind`,children:n}),h?(0,$.jsx)(G,{variant:`outline`,className:`oc-access__stale`,children:re()}):null]}),o===void 0?(0,$.jsx)(`p`,{className:`oc-access__hint`,children:_e()}):m.length===0?(0,$.jsx)(`p`,{className:`oc-access__hint`,children:h?k():r()}):(0,$.jsxs)($.Fragment,{children:[g.length>1?(0,$.jsxs)(`div`,{className:`oc-access__row oc-access__selectall`,children:[(0,$.jsx)(q,{checked:_===`all`?!0:_===`some`?`indeterminate`:!1,onCheckedChange:()=>void b(),"aria-label":z()}),(0,$.jsx)(`span`,{className:`oc-access__label`,children:z()})]}):null,v.pageItems.map(e=>{let n=`${t}/${e.agentId}`,r=i.has(n),a=e.presentInLastOk===!1;return(0,$.jsxs)(`div`,{className:`oc-access__row`,children:[(0,$.jsx)(q,{checked:r,disabled:a&&!r,onCheckedChange:()=>void y(e.agentId,r),"aria-label":fe({name:e.displayName??e.agentId})}),(0,$.jsxs)(`span`,{className:`oc-access__label`,title:e.displayName??e.agentId,children:[e.emoji?`${e.emoji} `:``,e.displayName??e.agentId]}),e.model?(0,$.jsx)(`span`,{className:`oc-access__model`,children:e.model}):null,e.isDefaultOnInstance?(0,$.jsx)(`span`,{className:`oc-access__fav`,role:`img`,"aria-label":R(),title:R(),children:(0,$.jsx)(Y,{size:14,fill:`currentColor`})}):null,a?(0,$.jsx)(G,{variant:`outline`,className:`oc-access__gone`,children:L()}):null]},e.agentId)}),(0,$.jsx)(st,{page:v.page,pageCount:v.pageCount,onPage:p})]})]})}function ut({groupId:e}){let t=E(c.charts.listGroupChartSelection,e?{groupId:e}:`skip`),n=S(c.charts.assignChartToGroup),r=S(c.charts.removeChartFromGroup),i=S(c.charts.setGroupDefaultChart),a=S(c.charts.addChartToGroupPool),o=S(c.charts.removeChartFromGroupPool),s=W();if(!e)return null;if(t===void 0)return(0,$.jsx)(`p`,{className:`oc-access__hint`,children:B()});let{pool:l,addable:u,canManagePool:d}=t;if(l.length===0&&!d)return(0,$.jsx)(`p`,{className:`oc-access__hint`,children:be()});async function f(t,i){try{i?await r({groupId:e,chartKey:t}):await n({groupId:e,chartKey:t})}catch(e){s.error(h(),e)}}async function g(t){try{await i({groupId:e,chartKey:t})}catch(e){s.error(h(),e)}}async function _(t){try{await a({groupId:e,chartKey:t})}catch(e){s.error(h(),e)}}async function y(t){try{await o({groupId:e,chartKey:t})}catch(e){s.error(h(),e)}}return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`div`,{className:`oc-access__list`,children:l.map(e=>(0,$.jsxs)(`div`,{className:`oc-access__row`,children:[(0,$.jsx)(q,{checked:e.selected,onCheckedChange:()=>void f(e.chartKey,e.selected),"aria-label":N({name:e.name})}),(0,$.jsx)(`span`,{className:`oc-access__label`,title:e.name,children:e.name}),e.selected?e.isDefault?(0,$.jsx)(`span`,{className:`oc-access__fav`,role:`img`,"aria-label":m(),title:m(),children:(0,$.jsx)(Y,{size:14,fill:`currentColor`})}):(0,$.jsx)(U,{type:`button`,variant:`ghost`,size:`sm`,onClick:()=>void g(e.chartKey),children:P()}):null,d?(0,$.jsx)(U,{type:`button`,variant:`ghost`,size:`sm`,"aria-label":I({name:e.name}),title:I({name:e.name}),onClick:()=>void y(e.chartKey),children:(0,$.jsx)(Ae,{size:14,"aria-hidden":!0})}):null]},e.chartKey))}),d?u.length>0?(0,$.jsxs)(Ke,{value:``,onValueChange:e=>void _(e),children:[(0,$.jsx)(Le,{size:`sm`,className:`oc-access__search`,children:(0,$.jsx)(Fe,{placeholder:p()})}),(0,$.jsx)(Re,{children:u.map(e=>(0,$.jsx)(Ge,{value:e.chartKey,children:e.name},e.chartKey))})]}):l.length===0?(0,$.jsx)(`p`,{className:`oc-access__hint`,children:v()}):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,A_ as i,Ag as a,B_ as o,Bg as s,C_ as c,Cg as l,DO as u,D_ as d,Dg as f,E_ as p,Eg as m,FC as h,F_ as g,Fg as _,G as v,G_ as y,Gg as b,H_ as ee,Hg as x,I_ as S,Ig as C,J_ as w,Jg as T,K as E,K_ as te,Kg as ne,L_ as re,Lg as ie,M_ as ae,Mg as oe,NO as D,N_ as se,Ng as ce,O_ as le,Og as ue,PC as de,PO as O,P_ as k,Pg as A,Qg as fe,R_ as pe,Rg as me,S_ as he,Sg as ge,T_ as _e,Tg as ve,U_ as ye,Ug as be,V_ as xe,Vg as Se,W_ as Ce,Wg as we,Xg as Te,Yg as Ee,Zg as De,__ as Oe,_g as ke,a_ as Ae,b_ as je,bg as Me,c_ as Ne,cg as Pe,d_ as j,dg as Fe,e_ as M,f_ as Ie,fg as Le,g_ as Re,gg as ze,h_ as Be,hg as Ve,i_ as N,if as He,jO as P,j_ as Ue,jg as We,k_ as Ge,kg as F,l_ as Ke,lg as I,m_ as qe,mg as Je,n_ as Ye,o_ as Xe,p_ as Ze,pg as Qe,q_ as $e,qg as et,r_ as tt,rf as nt,s_ as rt,t_ as it,u_ as L,ug as at,v_ as ot,vg as st,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-DggIHtPt.js";import{a as gt,c as _t}from"./FieldLabel-BGZ_qKFR.js";import{t as R}from"./button-J0r_4wz5.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-BI4JM57h.js";import{t as Dt}from"./DataTableShell-B9cSAz8l.js";import{InstanceConfigDialog as Ot}from"./BridgeTab-CA5_P4aZ.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=O(u.admin.listInstances,{}),t=O(u.agents.listAllInstanceAgents,{}),n=D(u.admin.upsertInstance),r=D(u.admin.deleteInstance),a=B(),[s,l]=(0,Y.useState)(!1),[f,m]=(0,Y.useState)(Q),[h,_]=(0,Y.useState)(null),[v,b]=(0,Y.useState)(null),[x,C]=(0,Y.useState)(null),[T,E]=(0,Y.useState)(null);async function ne(){try{await n({instanceId:T??void 0,name:f.name,gatewayUrl:f.gatewayUrl,bridgeUrl:f.bridgeUrl||void 0,displayName:f.displayName||void 0,kind:f.kind,gatewayVersion:f.gatewayVersion||void 0,gatewayHttpUrl:f.gatewayHttpUrl||void 0,streamTransport:f.streamTransport}),m(Q),E(null),l(!1)}catch(e){a.error(te(),e)}}return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`p`,{className:`oc-admin__hint`,children:[y(),(0,Z.jsx)(`strong`,{children:Ce()}),ye()]}),(0,Z.jsx)(Dt,{title:ee(),rows:e,addLabel:xe(),onAdd:()=>{E(null),m(Q),l(!0)},emptyHint:o(),columns:[{header:mt(),cell:e=>e.name,sort:e=>e.name},{header:pe(),cell:e=>(0,Z.jsx)(W,{variant:`outline`,children:e.kind??`openclaw`}),sort:e=>e.kind??`openclaw`},{header:re(),cell:e=>e.gatewayUrl,sort:e=>e.gatewayUrl},{header:S(),cell:e=>e.displayName??`—`,sort:e=>e.displayName??null},{header:w(),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)?I():void 0,children:[e.emoji?`${e.emoji} `:``,e.displayName??e.agentId]},e.agentId))})}}],rowActions:e=>[{label:ae(),onSelect:()=>{E(e._id),m(Nt(e)),l(!0)}},{label:$e(),onSelect:()=>_(e.name)},{label:Oe(),onSelect:()=>C(e)},{label:g(),onSelect:()=>b(e)},{label:k(),variant:`destructive`,onSelect:()=>void r({instanceId:e._id})}],bulkActions:[{label:k(),variant:`destructive`,onSelect:e=>e.forEach(e=>void r({instanceId:e}))}]}),(0,Z.jsx)(Ct,{open:s,onOpenChange:l,title:T?Ue():se(),description:Ge(),canSubmit:!!(f.name&&f.gatewayUrl),onSubmit:ne,submitLabel:le(),children:(0,Z.jsxs)(`div`,{className:`oc-form`,children:[(0,Z.jsxs)($,{label:d(),children:[(0,Z.jsx)(G,{value:f.name,disabled:T!==null,onChange:e=>m({...f,name:e.target.value})}),T?(0,Z.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:i()}):null]}),(0,Z.jsx)($,{label:p(),children:(0,Z.jsxs)(Et,{value:f.kind,onValueChange:e=>m({...f,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:_e(),children:(0,Z.jsx)(G,{value:f.gatewayUrl,onChange:e=>m({...f,gatewayUrl:e.target.value})})}),(0,Z.jsx)($,{label:ct(),children:(0,Z.jsx)(G,{value:f.bridgeUrl,placeholder:c(),onChange:e=>m({...f,bridgeUrl:e.target.value})})}),(0,Z.jsx)($,{label:he(),children:(0,Z.jsx)(G,{value:f.displayName,onChange:e=>m({...f,displayName:e.target.value})})}),(0,Z.jsxs)($,{label:He(),children:[(0,Z.jsxs)(Et,{value:f.streamTransport,onValueChange:e=>m({...f,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:nt()})]}),(0,Z.jsx)($,{label:ut(),children:(0,Z.jsx)(G,{value:f.gatewayVersion,placeholder:je(),onChange:e=>m({...f,gatewayVersion:e.target.value})})}),(0,Z.jsx)($,{label:ft(),children:(0,Z.jsx)(G,{value:f.gatewayHttpUrl,placeholder:ot(),onChange:e=>m({...f,gatewayHttpUrl:e.target.value})})})]})}),(0,Z.jsx)(Wt,{instanceName:h,open:h!==null,onOpenChange:e=>{e||_(null)}}),v?(0,Z.jsx)(Ot,{instance:v,onClose:()=>b(null)},v._id):null,x?(0,Z.jsx)(Ft,{instance:x,onClose:()=>C(null)},x._id):null]})}function Ft({instance:e,onClose:t}){let n=O(u.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:Re({instance:e.displayName??e.name})}),(0,Z.jsx)(xt,{children:Be()})]}),(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=P(u.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(Ee());break;case`no_agents`:n.success(et());break;case`no_bridge_url`:n.error(ne());break;case`deploy_misconfigured`:n.error(b());break;case`unauthorized`:n.error(be());break;case`not_served`:n.error(x());break;default:n.error(we());break}}catch(e){n.error(T(),e)}finally{i(!1)}}}return(0,Z.jsxs)(`div`,{className:`oc-form`,children:[(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:Se()}),(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?Te():De()})})]})}function Lt({instance:e}){let t=O(u.bridgeAuth.listBridgeAuthStatus,{}),n=P(u.bridgeAuth.mintBridgeSecret),r=D(u.bridgeAuth.revokeBridgeSecret),i=B(),[a,o]=(0,Y.useState)(!1),[c,l]=(0,Y.useState)(null),[d,f]=(0,Y.useState)(!1),p=(t??[]).find(t=>t.instanceId===e._id),m=p!==void 0;async function g(){if(!a){o(!0);try{l((await n({instanceId:e._id})).plaintext),f(!1)}catch(e){i.error(A(),e)}finally{o(!1)}}}async function v(){if(!a){o(!0);try{await r({instanceId:e._id}),l(null),i.success(_())}catch(e){i.error(A(),e)}finally{o(!1)}}}async function y(){if(c)try{await navigator.clipboard.writeText(c),f(!0)}catch{}}return(0,Z.jsxs)($,{label:s(),children:[(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:ht()}),(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Z.jsx)(W,{variant:m?`outline`:`secondary`,children:m?`${j()} · ${p.prefix}…${p.lastFour}`:L()}),(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(R,{size:`sm`,onClick:()=>void g(),disabled:a,children:m?ie():me()}),m?(0,Z.jsx)(R,{size:`sm`,variant:`destructive`,onClick:()=>void v(),disabled:a,children:C()}):null]})]}),c?(0,Z.jsxs)(`div`,{className:`oc-bridgesecret__reveal`,children:[(0,Z.jsx)(`p`,{className:`oc-sa__minted-warning`,children:ce()}),(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 y(),children:d?h():de()})]}),(0,Z.jsx)(R,{size:`sm`,variant:`ghost`,onClick:()=>{l(null),f(!1)},children:oe()})]}):null]})}function Rt({instanceId:e,field:t,updatedAt:n}){let i=P(u.instanceSecrets.setInstanceSecret),a=D(u.instanceSecrets.clearInstanceSecret),o=P(u.deviceIdentity.generateDeviceIdentity),s=B(),[c,l]=(0,Y.useState)(``),[d,f]=(0,Y.useState)(!1),[p,m]=(0,Y.useState)(null),[g,_]=(0,Y.useState)(!1),v=n!==null,y=t===`deviceIdentity`,b=t===`token`?qe():t===`deviceIdentity`?Ze():Ie();async function ee(){if(!(!c.trim()||d)){f(!0);try{await i({instanceId:e,field:t,plaintext:c}),l(``),m(null),_(!1),s.success(Ae())}catch(e){s.error(N(),e)}finally{f(!1)}}}async function x(){if(!d){f(!0);try{await a({instanceId:e,field:t}),m(null),_(!1),s.success(tt())}catch(e){s.error(N(),e)}finally{f(!1)}}}async function S(){if(!d){f(!0);try{m(await o({instanceId:e})),_(!1),s.success(M())}catch(e){s.error(fe(),e)}finally{f(!1)}}}let C=p?`openclaw devices approve ${p.id}`:``;async function w(){if(C)try{await navigator.clipboard.writeText(C),_(!0)}catch{}}return(0,Z.jsxs)($,{label:b,children:[y?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:it()}):null,(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Z.jsx)(W,{variant:v?`outline`:`secondary`,children:v?j():L()}),(0,Z.jsx)(G,{type:`password`,autoComplete:`off`,className:`flex-1 min-w-32`,value:c,placeholder:v?Ne():Ke(),onChange:e=>l(e.target.value)}),(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(R,{size:`sm`,onClick:()=>void ee(),disabled:d||c.trim().length===0,children:rt()}),y?(0,Z.jsx)(R,{size:`sm`,variant:`outline`,onClick:()=>void S(),disabled:d,children:Ye()}):null,v?(0,Z.jsx)(R,{size:`sm`,variant:`destructive`,onClick:()=>void x(),disabled:d,children:Xe()}):null]})]}),p?(0,Z.jsxs)(`div`,{className:`oc-bridgesecret__reveal`,children:[(0,Z.jsx)(`p`,{className:`text-sm font-medium`,children:M()}),(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:r()}),(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 w(),children:g?h():de()})]}),(0,Z.jsx)(R,{size:`sm`,variant:`ghost`,onClick:()=>{m(null),_(!1)},children:oe()})]}):null]})}var zt={conversational:lt,documentary:ge,summarizer:E},Bt={conversational:l,documentary:dt,summarizer:v},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:ue()}),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:f()})}),(0,Z.jsxs)(vt,{align:`start`,className:`oc-agenttypes-pop`,children:[(0,Z.jsx)(`p`,{className:`oc-agenttypes-pop__title`,children:m()}),(0,Z.jsx)(`p`,{className:`oc-agenttypes-pop__hint`,children:ve()}),(0,Z.jsx)(`div`,{className:`oc-agenttypes-pop__list`,children:X.map(r=>{let i=`agtype-${e}-${r}`;return(0,Z.jsxs)(`div`,{className:`oc-agenttypes-pop__item`,children:[(0,Z.jsx)(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=O(u.agents.listAgentsForInstance,t&&e?{instanceName:e}:`skip`),i=D(u.agents.setAgentEnabled).withOptimisticUpdate((e,{instanceName:t,agentId:n,enabled:r})=>{let i=e.getQuery(u.agents.listAgentsForInstance,{instanceName:t});i&&e.setQuery(u.agents.listAgentsForInstance,{instanceName:t},{...i,agents:i.agents.map(e=>e.agentId===n?{...e,enabled:r}:e)})}),o=D(u.agents.setInstanceDefaultAgent).withOptimisticUpdate((e,{instanceName:t,agentId:n})=>{let r=e.getQuery(u.agents.listAgentsForInstance,{instanceName:t});r&&e.setQuery(u.agents.listAgentsForInstance,{instanceName:t},{...r,defaultAgentId:n})}),s=D(u.agents.setAgentTypes).withOptimisticUpdate((e,{instanceName:t,agentId:n,types:r})=>{let i=e.getQuery(u.agents.listAgentsForInstance,{instanceName:t});if(!i)return;let a=jt(r);e.setQuery(u.agents.listAgentsForInstance,{instanceName:t},{...i,agents:i.agents.map(e=>e.agentId===n?{...e,types:a}:e)})}),c=D(u.agents.removeInstanceAgent),l=St(),d=B();async function f(t,n){if(e)try{await i({instanceName:e,agentId:t,enabled:n})}catch(e){d.error(F(),e)}}async function p(t){if(e)try{await o({instanceName:e,agentId:t})}catch(e){d.error(F(),e)}}async function m(t,n,r){if(!e)return;let i=r.includes(n)?r.filter(e=>e!==n):[...r,n];try{await s({instanceName:e,agentId:t,types:i})}catch(e){d.error(F(),e)}}async function h(t,n){if(e&&await l({title:st({name:n}),description:ke(),confirmLabel:ze(),destructive:!0}))try{await c({instanceName:e,agentId:t}),d.success(Ve())}catch(e){d.error(F(),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:We({name:e??``})}),(0,Z.jsx)(xt,{children:a()})]}),r===void 0?(0,Z.jsx)(`p`,{className:`oc-access__hint`,children:Je()}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`div`,{className:`oc-access__poll`,children:r.discovery===null?Qe():r.discovery.lastPollOk?Le():Fe({error:r.discovery.error??`?`})}),r.agents.length===0?(0,Z.jsx)(`p`,{className:`oc-access__hint`,children:at()}):(0,Z.jsx)(`div`,{className:`oc-access__list`,children:r.agents.map(e=>{let t=e.presentInLastOk===!1,n=r.defaultAgentId===e.agentId,i=e.displayName??e.agentId,a=e.types??[];return(0,Z.jsxs)(`div`,{className:`oc-agentcard`+(e.enabled?``:` oc-agentcard--off`),children:[(0,Z.jsxs)(`div`,{className:`oc-agentcard__head`,children:[(0,Z.jsx)(K,{checked:e.enabled,disabled:t,"aria-label":i,onCheckedChange:t=>void f(e.agentId,t===!0)}),(0,Z.jsxs)(`span`,{className:`oc-agentcard__name`,title:i,children:[e.emoji?`${e.emoji} `:``,i]}),e.model?(0,Z.jsx)(`span`,{className:`oc-access__model`,children:e.model}):null,t?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(W,{variant:`outline`,className:`oc-access__gone`,children:Pe()}),(0,Z.jsx)(R,{size:`sm`,variant:`ghost`,className:`h-7 text-destructive`,onClick:()=>void h(e.agentId,i),children:pt()})]}):n?(0,Z.jsx)(W,{variant:`default`,children:I()}):(0,Z.jsx)(R,{size:`sm`,variant:`outline`,className:`h-7`,disabled:!e.enabled,onClick:()=>void p(e.agentId),children:Me()})]}),e.enabled?(0,Z.jsx)(Ut,{agentId:e.agentId,types:a,onToggle:t=>void m(e.agentId,t,a)}):null]},e.agentId)})})]})]})})}function $({label:e,children:t}){return(0,Z.jsxs)(`label`,{className:`oc-field`,children:[(0,Z.jsx)(`span`,{className:`oc-field__label`,children:e}),t]})}export{Pt as InstancesTab};
@@ -1 +0,0 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$y as r,Ay as i,By as a,DO as o,Dy as s,Ey as c,Fy as l,Gy as u,Hy as ee,Iy as te,Jy as ne,Ky as re,Ly as ie,My as ae,NO as d,Ny as oe,Oy as f,PO as p,Py as m,Qy as h,Ry as g,Ty as _,Uy as v,Vy as y,Wy as se,Xy as ce,Yy as le,Zy as ue,ab as de,an as b,cb as x,cn as S,db as C,dn as w,eb as T,fb as E,fn as D,gb as O,hb as k,ib as A,jO as j,jy as M,ky as N,lb as P,ln as F,mb as I,nb as L,ob as R,on as z,pb as B,pn as V,qy as H,rb as fe,sb as U,sn as pe,tb as me,ub as W,un as he,wy as ge,zy as _e}from"./dist-DggIHtPt.js";import{t as G}from"./button-J0r_4wz5.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-BI4JM57h.js";import{t as we}from"./DataTableShell-B9cSAz8l.js";var J=t(e(),1),Y=n();function Te(){let e=p(o.integrations.status.status,{}),t=d(o.admin.setIntegrationConfig),[n,b]=(0,J.useState)(null);if((0,J.useEffect)(()=>{e&&n===null&&b(e.config)},[e,n]),!e||!n)return(0,Y.jsx)(`p`,{className:`oc-admin__hint`,children:O()});let S=n,j=(e,t,n)=>b({...S,[e]:{...S[e],[t]:n}}),F=(e,n)=>void t({[e]:n});return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(`p`,{className:`oc-admin__hint`,children:[k(),` `,(0,Y.jsx)(`strong`,{children:I()}),` `,B()]}),(0,Y.jsxs)(X,{title:`Langfuse`,status:e.langfuse.configured?e.langfuse.enabled?(0,Y.jsx)(K,{variant:`secondary`,children:E()}):(0,Y.jsx)(K,{variant:`outline`,children:C()}):(0,Y.jsx)(K,{variant:`outline`,children:W()}),note:x(),children:[(0,Y.jsx)(Z,{label:R(),children:(0,Y.jsx)(q,{value:S.langfuse.host??``,placeholder:e.langfuse.effectiveHost,onChange:e=>j(`langfuse`,`host`,e.target.value),onBlur:()=>F(`langfuse`,{host:S.langfuse.host??``})})}),(0,Y.jsx)(Q,{label:L(),checked:S.langfuse.enabled??!0,onChange:e=>{j(`langfuse`,`enabled`,e),F(`langfuse`,{enabled:e})}})]}),(0,Y.jsxs)(X,{title:`Opik`,status:e.opik.configured?e.opik.enabled?(0,Y.jsx)(K,{variant:`secondary`,children:E()}):(0,Y.jsx)(K,{variant:`outline`,children:C()}):(0,Y.jsx)(K,{variant:`outline`,children:W()}),note:U(),children:[(0,Y.jsx)(Z,{label:de(),children:(0,Y.jsx)(q,{value:S.opik.baseUrl??``,placeholder:e.opik.effectiveBaseUrl,onChange:e=>j(`opik`,`baseUrl`,e.target.value),onBlur:()=>F(`opik`,{baseUrl:S.opik.baseUrl??``})})}),(0,Y.jsx)(Z,{label:A(),children:(0,Y.jsx)(q,{value:S.opik.workspace??``,placeholder:e.opik.effectiveWorkspace||fe(),onChange:e=>j(`opik`,`workspace`,e.target.value),onBlur:()=>F(`opik`,{workspace:S.opik.workspace??``})})}),(0,Y.jsx)(Q,{label:L(),checked:S.opik.enabled??!0,onChange:e=>{j(`opik`,`enabled`,e),F(`opik`,{enabled:e})}})]}),(0,Y.jsxs)(X,{title:`OpenTelemetry (OTLP)`,status:e.otlp.configured?e.otlp.enabled?(0,Y.jsx)(K,{variant:`secondary`,children:E()}):(0,Y.jsx)(K,{variant:`outline`,children:C()}):(0,Y.jsx)(K,{variant:`outline`,children:V()}),note:D(),children:[(0,Y.jsx)(Z,{label:w(),children:(0,Y.jsx)(q,{value:S.otlp.endpoint??``,placeholder:e.otlp.effectiveEndpoint||`https://otlp.example.com/v1/traces`,onChange:e=>j(`otlp`,`endpoint`,e.target.value),onBlur:()=>F(`otlp`,{endpoint:S.otlp.endpoint??``})})}),(0,Y.jsx)(Ee,{headersSet:e.otlp.headersSet}),(0,Y.jsx)(Q,{label:L(),checked:S.otlp.enabled??!0,onChange:e=>{j(`otlp`,`enabled`,e),F(`otlp`,{enabled:e})}})]}),(0,Y.jsxs)(X,{title:me(),status:(0,Y.jsx)(K,{variant:`outline`,children:P()}),note:T(),children:[(0,Y.jsx)(Z,{label:r(),children:(0,Y.jsx)($,{value:S.tts.auto??`off`,options:[[`off`,h()],[`always`,ue()],[`inbound`,ce()],[`tagged`,le()]],onChange:e=>{j(`tts`,`auto`,e),F(`tts`,{auto:e})}})}),(0,Y.jsx)(Z,{label:ne(),children:(0,Y.jsx)($,{value:S.tts.provider??`openai`,options:[[`openai`,`OpenAI`],[`elevenlabs`,`ElevenLabs`],[`microsoft`,H()],[`azure`,`Azure Speech`],[`google`,`Google Gemini`]],onChange:e=>{j(`tts`,`provider`,e),F(`tts`,{provider:e})}})}),(0,Y.jsx)(Z,{label:re(),children:(0,Y.jsx)(q,{value:S.tts.model??``,placeholder:`eleven_multilingual_v2`,onChange:e=>j(`tts`,`model`,e.target.value),onBlur:()=>F(`tts`,{model:S.tts.model??``})})}),(0,Y.jsx)(Z,{label:u(),children:(0,Y.jsx)(q,{value:S.tts.voice??``,placeholder:se(),onChange:e=>j(`tts`,`voice`,e.target.value),onBlur:()=>F(`tts`,{voice:S.tts.voice??``})})})]}),(0,Y.jsxs)(X,{title:v(),status:(0,Y.jsx)(K,{variant:`outline`,children:P()}),note:e.secrets.openai?ee():y(),children:[(0,Y.jsx)(Q,{label:a(),checked:S.talk.enabled??!1,onChange:e=>{j(`talk`,`enabled`,e),F(`talk`,{enabled:e})}}),(0,Y.jsx)(Z,{label:_e(),children:(0,Y.jsx)($,{value:S.talk.realtimeProvider??`openai`,options:[[`openai`,`OpenAI (gpt-realtime)`],[`google`,`Google`]],onChange:e=>{j(`talk`,`realtimeProvider`,e),F(`talk`,{realtimeProvider:e})}})}),(0,Y.jsx)(Z,{label:g(),children:(0,Y.jsx)(q,{value:S.talk.realtimeModel??``,placeholder:`gpt-realtime-2`,onChange:e=>j(`talk`,`realtimeModel`,e.target.value),onBlur:()=>F(`talk`,{realtimeModel:S.talk.realtimeModel??``})})}),(0,Y.jsx)(Z,{label:u(),children:(0,Y.jsx)(q,{value:S.talk.voice??``,placeholder:`cedar / marin`,onChange:e=>j(`talk`,`voice`,e.target.value),onBlur:()=>F(`talk`,{voice:S.talk.voice??``})})}),(0,Y.jsx)(Z,{label:ie(),children:(0,Y.jsx)($,{value:S.talk.transport??`webrtc`,options:[[`webrtc`,te()],[`provider-websocket`,`Provider WebSocket`],[`gateway-relay`,`Gateway relay`]],onChange:e=>{j(`talk`,`transport`,e),F(`talk`,{transport:e})}})}),(0,Y.jsx)(Z,{label:l(),children:(0,Y.jsx)(q,{value:S.talk.speechLocale??``,placeholder:`fr-CA`,onChange:e=>j(`talk`,`speechLocale`,e.target.value),onBlur:()=>F(`talk`,{speechLocale:S.talk.speechLocale??``})})}),(0,Y.jsx)(Q,{label:m(),checked:S.talk.interruptOnSpeech??!0,onChange:e=>{j(`talk`,`interruptOnSpeech`,e),F(`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:oe()}),(0,Y.jsx)(K,{variant:`outline`,children:ae()})]}),(0,Y.jsxs)(`p`,{className:`oc-uipa__note`,children:[M(),(0,Y.jsx)(`code`,{children:` voicewake.get/set`}),`.`]})]}),(0,Y.jsx)(we,{title:i(),rows:e.cursors.map(e=>({...e,_id:e.vendor})),emptyHint:N(),columns:[{header:f(),cell:e=>(0,Y.jsx)(K,{variant:`secondary`,children:e.vendor}),sort:e=>e.vendor},{header:s(),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:_(),cell:e=>e.lastErrorStatus??`—`,sort:e=>e.lastErrorStatus??null},{header:ge(),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=j(o.integrations.otlpSecret.setOtlpHeaders),n=d(o.integrations.otlpSecret.clearOtlpHeaders),[r,i]=(0,J.useState)(``),[a,s]=(0,J.useState)(null),[c,l]=(0,J.useState)(!1),u=async()=>{l(!0),s(null);try{await t({headersJson:r}),i(``)}catch(e){s(e instanceof Error?e.message:String(e))}finally{l(!1)}};return(0,Y.jsxs)(Z,{label:he(),children:[(0,Y.jsx)(q,{value:r,placeholder:e?F():S(),onChange:e=>i(e.target.value)}),(0,Y.jsxs)(`div`,{className:`oc-int__otlp-headers-actions`,children:[(0,Y.jsx)(G,{size:`sm`,disabled:c||r.trim().length===0,onClick:()=>void u(),children:pe()}),e?(0,Y.jsx)(G,{variant:`ghost`,size:`sm`,disabled:c,onClick:()=>void n({}),children:z()}):null]}),a?(0,Y.jsx)(`p`,{className:`oc-int__otlp-headers-error`,children:a}):null,(0,Y.jsx)(`p`,{className:`oc-uipa__note`,children:b()})]})}export{Te as IntegrationsTab};
@@ -1 +0,0 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$b as r,Cu as i,DO as a,Ex as o,Gb as s,PO as c,Qb as l,Su as u,Tu as d,Wb as f,_u as p,bu as m,ex as h,fu as g,gu as _,hu as v,mu as y,pu as b,tx as x,vu as S,wu as C,xu as w,yu as T}from"./dist-DggIHtPt.js";import{Mt as E,a as ee,jt as te,n as ne,ot as re,r as D}from"./index-BI4JM57h.js";import{a as O,n as k,o as A,r as j,t as M}from"./card-dyG2YjyY.js";import{n as N,t as P}from"./TimeRangePicker-Dj6YRWgA.js";var F=t(e(),1),I=n(),L=15,R=e=>String(Math.round(e));function z(){let e=c(a.me.getMe,{host:re})?.permissions?.includes(`traces.read`)??!1,t=c(a.deliveryTiming.listDeliverySessions,e?{}:`skip`),n=(0,F.useMemo)(()=>t?t.filter(e=>!e.active&&e.rollup!==null&&e.rollup.cP50!==null&&e.rollup.aP50!==null).slice(0,L).reverse().map(e=>({startedAt:e.startedAt,cP50:e.rollup?.cP50,aP50:e.rollup?.aP50})):[],[t]);return t===void 0?null:(0,I.jsxs)(`section`,{className:`oc-kpi__group`,children:[(0,I.jsx)(`h2`,{className:`oc-kpi__group-title`,children:o()}),(0,I.jsxs)(M,{children:[(0,I.jsxs)(O,{children:[(0,I.jsx)(A,{children:x()}),(0,I.jsx)(j,{children:r()})]}),(0,I.jsx)(k,{children:n.length<2?(0,I.jsx)(`p`,{className:`oc-admin__hint`,children:l()}):(0,I.jsx)(B,{series:n})})]})]})}function B({series:e}){let t=e.map(e=>e.cP50),n=e.map(e=>e.aP50),r=Math.max(1,...t,...n),i=t=>6+t*468/(e.length-1),a=e=>74-e*68/r,o=e=>e.map((e,t)=>`${t===0?`M`:`L`}${i(t).toFixed(1)},${a(e).toFixed(1)}`).join(` `),c=e[e.length-1];return(0,I.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,I.jsxs)(`div`,{className:`flex gap-3 text-xs text-muted-foreground`,children:[(0,I.jsxs)(`span`,{style:{color:`var(--primary)`},children:[f(),` p50 `,R(c.cP50),` `,h()]}),(0,I.jsxs)(`span`,{children:[s(),` p50 `,R(c.aP50),` `,h()]})]}),(0,I.jsxs)(`svg`,{viewBox:`0 0 480 80`,className:`h-20 w-full`,preserveAspectRatio:`none`,role:`img`,"aria-label":x(),children:[(0,I.jsx)(`path`,{d:o(n),fill:`none`,style:{stroke:`var(--muted-foreground)`},strokeWidth:1.5}),(0,I.jsx)(`path`,{d:o(t),fill:`none`,style:{stroke:`var(--primary)`},strokeWidth:1.5})]})]})}var V=[{metric:`api.calls`,label:d(),unit:`/h`,group:`API`,isError:!1},{metric:`api.errors`,label:C(),unit:`/h`,group:`API`,isError:!0},{metric:`api.latency.avg_ms`,label:i(),unit:`ms`,group:`API`,isError:!1},{metric:`openclaw.ingest`,label:u(),unit:`/h`,group:`OpenClaw`,isError:!1},{metric:`chat.send`,label:w(),unit:`/h`,group:`Chat`,isError:!1},{metric:`assistant.stream.errors`,label:m(),unit:`/h`,group:`Assistant`,isError:!0}],H=V.length,U=[`API`,`OpenClaw`,`Chat`,`Assistant`],W=1e3,G=36e5;function K(e,t){let n=Math.max(1,Math.ceil((t-e)/G)),r=Math.min(n*H,W);return{rowLimit:r,buckets:Math.max(1,Math.floor(r/H))}}function q(){let e=E({from:`/settings/kpi`}),t=te({from:`/settings/kpi`}),n=D(e.from,e.to,ne,`now`),r=e=>void t({search:t=>({...t,...ee(e)})}),{from:i,to:o}=N(n),{rowLimit:s,buckets:l}=K(i,o),u=c(a.kpi.listKpis,{limit:s,filter:{from:i,to:o}}),d=(0,F.useMemo)(()=>{let e=new Map;for(let t of u??[]){let n=e.get(t.metric)??[];n.push({bucket:t.bucket,value:t.value}),e.set(t.metric,n)}for(let[t,n]of e)n.sort((e,t)=>e.bucket<t.bucket?-1:+(e.bucket>t.bucket)),n.length>l&&e.set(t,n.slice(n.length-l));return e},[u,l]),f=(0,I.jsxs)(I.Fragment,{children:[(0,I.jsxs)(`p`,{className:`oc-admin__hint`,children:[T(),` `,(0,I.jsx)(`span`,{className:`oc-filter__window`,children:S()})]}),(0,I.jsx)(J,{value:n,onChange:r})]});return u===void 0?(0,I.jsxs)(I.Fragment,{children:[f,(0,I.jsx)(z,{}),(0,I.jsx)(`p`,{className:`oc-admin__hint`,children:p()})]}):u.length===0?(0,I.jsxs)(I.Fragment,{children:[f,(0,I.jsx)(z,{}),(0,I.jsx)(`p`,{className:`oc-admin__hint`,children:_()})]}):(0,I.jsxs)(I.Fragment,{children:[f,(0,I.jsx)(z,{}),U.map(e=>{let t=V.filter(t=>t.group===e);return t.some(e=>(d.get(e.metric)??[]).length>0)?(0,I.jsxs)(`section`,{className:`oc-kpi__group`,children:[(0,I.jsx)(`h2`,{className:`oc-kpi__group-title`,children:e}),(0,I.jsx)(`div`,{className:`oc-kpi__grid`,children:t.map(e=>(0,I.jsx)(Y,{config:e,series:d.get(e.metric)??[]},e.metric))})]},e):null})]})}function J({value:e,onChange:t}){return(0,I.jsx)(`div`,{className:`oc-kpi__toolbar`,children:(0,I.jsx)(P,{value:e,onChange:t})})}function Y({config:e,series:t}){let n=t.length>0?t[t.length-1]:null,r=n?n.value:0;return(0,I.jsxs)(M,{size:`sm`,className:`oc-kpi__card`,children:[(0,I.jsxs)(O,{children:[(0,I.jsx)(A,{className:`oc-kpi__card-title`,children:e.label}),(0,I.jsx)(j,{className:`oc-kpi__card-metric`,children:(0,I.jsx)(`code`,{children:e.metric})})]}),(0,I.jsxs)(k,{className:`oc-kpi__card-body`,children:[(0,I.jsxs)(`div`,{className:`oc-kpi__value-row`,children:[(0,I.jsx)(`span`,{className:`oc-kpi__value`+(e.isError&&r>0?` oc-kpi__value--error`:``),children:Q(r)}),(0,I.jsx)(`span`,{className:`oc-kpi__unit`,children:e.unit})]}),(0,I.jsx)(ae,{series:t,isError:e.isError,unit:e.unit}),(0,I.jsxs)(`div`,{className:`oc-kpi__axis`,children:[n?(0,I.jsx)(`span`,{className:`oc-kpi__axis-latest`,children:v({value:$(n.bucket)})}):(0,I.jsx)(`span`,{className:`oc-kpi__muted`,children:y()}),(0,I.jsx)(`span`,{className:`oc-kpi__muted`,children:b({count:t.length})})]})]})]})}var X=240,Z=48,ie=1;function ae({series:e,isError:t,unit:n}){if(e.length===0)return(0,I.jsx)(`div`,{className:`oc-kpi__chart oc-kpi__chart--empty`,"aria-hidden":!0});let r=e.reduce((e,t)=>t.value>e?t.value:e,0),i=X/e.length,a=Math.max(i-ie,1);return(0,I.jsx)(`svg`,{className:`oc-kpi__chart`,viewBox:`0 0 ${X} ${Z}`,preserveAspectRatio:`none`,role:`img`,"aria-label":g({max:Q(r),unit:n}),children:e.map((e,o)=>{let s=r>0?e.value/r*(Z-1):0,c=o*i,l=Z-s;return(0,I.jsx)(`rect`,{className:`oc-kpi__bar`+(t&&e.value>0?` oc-kpi__bar--error`:``),x:c,y:l,width:a,height:s,children:(0,I.jsxs)(`title`,{children:[$(e.bucket),` · `,Q(e.value),` `,n]})},e.bucket)})})}function Q(e){return Number.isFinite(e)?Math.abs(e)>=1e3?(e/1e3).toFixed(e%1e3==0?0:1)+`k`:String(e):`0`}function $(e){let t=new Date(`${e}:00:00Z`);return Number.isNaN(t.getTime())?e:`${String(t.getUTCDate()).padStart(2,`0`)}/${String(t.getUTCMonth()+1).padStart(2,`0`)} ${String(t.getUTCHours()).padStart(2,`0`)}h`}export{q as KpiTab};
@@ -1 +0,0 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$w as r,BD as i,CT as a,DO as o,ET as s,FD as c,GD as l,HD as u,ID as ee,Jw as d,KD as f,LD as p,NO as m,O_ as te,PD as ne,PO as h,Qw as g,RD as _,ST as v,TT as y,UD as re,VD as ie,WD as ae,Xw as b,YD as oe,Yw as se,Zw as ce,_T as le,aT as ue,bT as de,cT as fe,dT as x,eO as S,eT as C,fT as w,gT as T,hT as E,iT as D,lT as O,mT as k,nT as A,oT as j,pT as M,qw as N,rT as P,sT as F,tT as I,uT as L,vT as R,wT as z,xT as B,yT as V,zD as pe}from"./dist-DggIHtPt.js";import{t as H}from"./button-J0r_4wz5.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-BI4JM57h.js";var q=t(e(),1),J=[{id:`messages`,label:()=>s()},{id:`composer`,label:()=>y()},{id:`sidebar`,label:()=>z()},{id:`other`,label:()=>a()}],Y={showSource:{category:`messages`,label:()=>v(),help:()=>B()},showReport:{category:`messages`,label:()=>de(),help:()=>V()},copyAssistant:{category:`messages`,label:()=>R()},copyUser:{category:`messages`,label:()=>le()},showDelete:{category:`messages`,label:()=>T()},showTools:{category:`messages`,label:()=>E(),help:()=>k()},voiceInput:{category:`composer`,label:()=>M(),help:()=>w()},showChatAge:{category:`sidebar`,label:()=>x(),help:()=>L()},showChatProvider:{category:`sidebar`,label:()=>O(),help:()=>fe()}};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:()=>ce()};function De({prefKey:e,ui:t}){let n=m(o.admin.setUiPrefDefault),r=m(o.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:I()}),(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:se()}),(0,$.jsx)(K,{value:`off`,children:d()}),(0,$.jsx)(K,{value:`inherit`,children:N()})]})]}),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":C()}),C()]}):null]}),a?(0,$.jsx)(`span`,{className:`oc-prefs__gov-help`,children:a}):null]})}function Oe(){let[e,t]=(0,q.useState)(``),[n,i]=(0,q.useState)(!1),a=h(o.me.getMe,{host:G}),s=a?.ui,c=Z(a?.role)&&n,l=m(o.me.setUiPref).withOptimisticUpdate(ge),u=(0,q.useMemo)(()=>s?be(Object.keys(s.effective),e):[],[s,e]);return s?(0,$.jsxs)(`div`,{className:`oc-prefs-panel`,children:[Z(a?.role)?(0,$.jsxs)(`label`,{className:`oc-prefs__gov-toggle`,children:[(0,$.jsx)(W,{checked:n,onCheckedChange:e=>i(e===!0),"aria-label":A()}),A()]}):null,c?(0,$.jsxs)(`div`,{className:`oc-prefs__gov-head`,children:[(0,$.jsx)(`p`,{children:r()}),(0,$.jsx)(`p`,{children:g()}),(0,$.jsx)(`p`,{children:b()})]}):null,(0,$.jsx)(U,{value:e,onChange:e=>t(e.target.value),placeholder:F(),"aria-label":F(),className:`mb-2`}),u.length===0?(0,$.jsx)(`div`,{className:`oc-prefs__empty`,children:j()}):(0,$.jsx)(`div`,{className:`oc-prefs`,children:u.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=s.locked[e],a=s.effective[e],o=s.userOverrides[e]!==void 0;return(0,$.jsxs)(`div`,{className:`oc-prefs__row${i?` is-locked`:``}${o&&!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:ue()}):o?null:(0,$.jsx)(`span`,{className:`oc-prefs__def`,children:D()})]}),r?(0,$.jsx)(`span`,{className:`oc-prefs__help`,children:r}):null]}),(0,$.jsxs)(`div`,{className:`oc-prefs__ctl`,children:[!i&&o?(0,$.jsx)(`button`,{type:`button`,className:`oc-prefs__reset`,onClick:()=>void l({key:e,value:null}),children:P()}):null,(0,$.jsx)(W,{checked:a,disabled:i,onCheckedChange:t=>void l({key:e,value:t===!0}),"aria-label":n})]}),c?(0,$.jsx)(De,{prefKey:e,ui:s}):null]},e)})]},e.id))})]}):(0,$.jsx)(`div`,{className:`oc-prefs__empty`,children:S()})}function ke(){let e=h(o.me.getMe,{host:G}),t=m(o.me.setLocale),n=m(o.me.setMyName),r=me(),a=e?.locale??`default`,s=e?.name??``,[d,g]=(0,q.useState)(null),v=d??s,y=v.trim()!==s.trim();async function b(){try{await n({name:v}),g(null),r.success(u())}catch(e){r.error(ie(),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:f()}),(0,$.jsx)(`p`,{className:`oc-show__desc`,children:l()})]}),(0,$.jsxs)(`div`,{className:`oc-show__row`,children:[(0,$.jsx)(U,{className:`max-w-xs`,value:v,maxLength:120,placeholder:ae(),onChange:e=>g(e.target.value),onKeyDown:e=>{e.key===`Enter`&&y&&(e.preventDefault(),b())}}),(0,$.jsx)(H,{size:`sm`,disabled:!y,onClick:()=>void b(),children:te()})]}),(0,$.jsx)(`p`,{className:`oc-show__desc`,children:re()})]}),(0,$.jsxs)(`section`,{className:`oc-show__section`,children:[(0,$.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,$.jsx)(`h2`,{className:`oc-show__title`,children:i()}),(0,$.jsx)(`p`,{className:`oc-show__desc`,children:pe()})]}),(0,$.jsx)(`div`,{className:`oc-show__row`,children:[`fr`,`en`,`default`].map(e=>(0,$.jsx)(H,{variant:a===e?`default`:`outline`,size:`sm`,onClick:()=>void t({locale:e==="default"?null:e}),children:e===`fr`?c():e===`en`?ne():oe()},e))}),(0,$.jsx)(`p`,{className:`oc-show__desc`,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:p()}),(0,$.jsx)(`p`,{className:`oc-show__desc`,children:ee()})]}),(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,Bd as i,DO as a,Fd as o,Gd as s,Hd as c,Id as l,J as u,Jd as d,Kd as f,Ld as p,NO as m,PO as h,Qd as g,Rd as _,Ud as v,Vd as y,Wd as b,X as x,Xd as S,Y as C,Yd as w,Z as T,Zd as E,cf as D,ef as O,q as k,qd as A,sf as j,zd as M}from"./dist-DggIHtPt.js";import{d as N,f as P,i as ee,l as F,n as I,r as L,t as R,u as z}from"./FieldLabel-BGZ_qKFR.js";import{t as B}from"./button-J0r_4wz5.js";import{A as V,C as H,S as U,_ as W,b as G,x as K,y as q}from"./index-BI4JM57h.js";/* empty css */var J=t(e(),1),Y=n(),X={media_delivery:{label:w,help:d},documentary_fetch:{label:A,help:f},inbound_files:{label:s,help:b},history_summary:{label:T,help:x}},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:p,references:l,files:o,previous_summary:C,new_messages:u,max_chars:k};function $(){let e=h(a.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:c()})});let i=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:O(),help:r()}),(0,Y.jsxs)(`label`,{className:`oc-injtab__picker`,children:[(0,Y.jsx)(`span`,{children:v()}),(0,Y.jsxs)(q,{value:i._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:i},i._id)]})}function te({instance:e}){let t=m(a.admin.upsertInstanceConfig),n=V(),r=e.config??{},[i,o]=(0,J.useState)(()=>ee(r)),[s,c]=(0,J.useState)(!1),l=i.promptInjections,u=(e,t)=>o({...i,promptInjections:{...l,[e]:{...l[e],...t}}});async function d(){c(!0);try{await t({instanceId:e._id,config:L(i,r)})}catch(e){n.error(j(),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:D()})})]})}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=N(e,r),f=d?P(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:E()})]}),(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:S()}),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?i():y()}),c&&(0,Y.jsx)(B,{variant:`ghost`,size:`sm`,onClick:()=>a({template:t.defaultTemplate}),children:g()})]})]}),o&&(0,Y.jsx)(`div`,{className:`oc-injcard__preview`,children:f?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`pre`,{className:`oc-injcard__previewtext`,children:f}),(0,Y.jsx)(`span`,{className:`oc-injection__ph`,children:M()})]}):(0,Y.jsx)(`span`,{className:`oc-injection__ph`,children:_()})})]})}export{$ as PromptInjectionsTab};
@@ -1 +0,0 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Ah as r,Bh as i,Ch as ee,DO as a,Dh as o,Eh as s,Fh as c,Gh as l,Hh as u,Ih as d,Kh as f,Lh as p,Mh as te,NO as m,Nh as ne,Oh as h,PO as g,Ph as _,Rh as v,Sh as y,Th as re,Uh as b,Vh as x,Wh as S,_h as ie,ah as ae,bh as C,ch as w,dh as T,ih as E,jh as D,kh as O,lh as k,oh as A,rh as j,sh as M,uh as N,vh as P,wh as F,xh as I,yh as L,zh as R}from"./dist-DggIHtPt.js";import{t as z}from"./button-J0r_4wz5.js";import{A as B,X as V,Z as H,_ as U,j as W,m as G,xt as K}from"./index-BI4JM57h.js";import{t as q}from"./roleDescriptions-BJkLcyAA.js";var J=t(e(),1),Y=n(),X=[{group:()=>f(),keys:[{key:`traces.read`,label:()=>x()},{key:`traces.read.content`,label:()=>i(),phi:!0},{key:`traces.write`,label:()=>R()}]},{group:()=>l(),keys:[{key:`kpi.read`,label:()=>x()},{key:`kpi.write`,label:()=>R()}]},{group:()=>S(),keys:[{key:`openclaw.query`,label:()=>v()},{key:`anomalies.read`,label:()=>p()},{key:`anomalies.report`,label:()=>d()}]},{group:()=>b(),keys:[{key:`chats.read`,label:()=>x()},{key:`selfheal`,label:()=>_()}]},{group:()=>u(),keys:[{key:`admin.manage`,label:()=>c()}]}],oe=X.flatMap(e=>e.keys.map(e=>e.key));function Z(e){return e.includes(`*`)}var Q={key:``,name:``,description:``};function $(){let e=g(a.apiKeys.listRoles,{}),t=m(a.apiKeys.createRole),n=m(a.apiKeys.ensureRolesSeeded),i=m(a.apiKeys.updateRolePermissions).withOptimisticUpdate((e,{roleId:t,permissions:n})=>{let r=e.getQuery(a.apiKeys.listRoles,{});r&&e.setQuery(a.apiKeys.listRoles,{},r.map(e=>e._id===t?{...e,permissions:n}:e))}),c=W(),l=B(),[u,d]=(0,J.useState)(!1),[f,p]=(0,J.useState)(Q),[_,v]=(0,J.useState)(new Set);(0,J.useEffect)(()=>{n({}).catch(e=>{l.error(te(),e)})},[n,l]);let b=e??[];async function x(e,t){if(Z(e.permissions)||_.has(e._id))return;let n=e.permissions.includes(t)?e.permissions.filter(e=>e!==t):[...e.permissions,t];if(!(e.builtin&&!await c({title:D({name:e.name}),description:r(),confirmLabel:O()}))){v(t=>new Set(t).add(e._id));try{await i({roleId:e._id,permissions:n})}catch(e){l.error(h(),e)}finally{v(t=>{let n=new Set(t);return n.delete(e._id),n})}}}async function S(){try{await t({key:f.key,name:f.name,description:f.description||void 0,permissions:[]}),p(Q),d(!1)}catch(e){l.error(o(),e)}}let R=e===void 0,$=!R&&b.length===0;return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(`p`,{className:`oc-admin__hint`,children:[s(),` `,(0,Y.jsx)(`code`,{children:`admin`}),` `,re(),` `,(0,Y.jsx)(`code`,{children:`traces.read.content`}),` `,F()]}),(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:ee()}),(0,Y.jsx)(`div`,{className:`oc-dt__bar-actions`,children:(0,Y.jsx)(z,{size:`sm`,onClick:()=>{p(Q),d(!0)},children:y()})})]}),R?(0,Y.jsx)(`p`,{className:`oc-admin__hint`,children:I()}):$?(0,Y.jsx)(`p`,{className:`oc-admin__hint`,children:C()}):(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:L()}),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?ne({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:b.map(e=>{let t=Z(e.permissions),n=_.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,{}),` `,P()]}):(0,Y.jsx)(V,{variant:`secondary`,children:ie()})]}),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?T():n?N():r,onCheckedChange:()=>void x(e,r)})},r))]},e.key)})})]})})]}),(0,Y.jsx)(G,{open:u,onOpenChange:d,title:k(),description:w(),canSubmit:!!(f.key&&f.name),onSubmit:S,submitLabel:M(),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:A()}),(0,Y.jsx)(H,{value:f.key,placeholder:ae(),onChange:e=>p({...f,key:e.target.value})})]}),(0,Y.jsxs)(`label`,{className:`oc-field`,children:[(0,Y.jsx)(`span`,{className:`oc-field__label`,children:E()}),(0,Y.jsx)(H,{value:f.name,onChange:e=>p({...f,name:e.target.value})})]}),(0,Y.jsxs)(`label`,{className:`oc-field`,children:[(0,Y.jsx)(`span`,{className:`oc-field__label`,children:j()}),(0,Y.jsx)(H,{value:f.description,onChange:e=>p({...f,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,Bw as o,Cw as te,DC as s,DO as c,Dw as ne,EC as l,Ew as re,FC as u,Fw as ie,GC as d,Gw as ae,HC as f,Hw as oe,IC as p,Iw as se,JC as m,KC as h,Kw as ce,LC as g,Lw as le,MC as ue,Mw as de,NC as _,NO as v,Nw as fe,OC as y,Ow as pe,PC as b,PO as x,Pw as me,QC as he,RC as ge,Rw as _e,Sw as ve,Tw as ye,UC as S,Uw as be,VC as C,Vw as w,WC as T,Ww as xe,XC as Se,YC as E,ZC as Ce,_w as we,aw as Te,bw as Ee,cw as De,dw as Oe,ew as ke,fw as Ae,gw as je,hw as Me,iw as Ne,jC as D,jO as Pe,jw as Fe,kC as O,kw as Ie,lw as Le,mw as Re,nw as ze,ow as Be,pw as Ve,qC as k,rw as He,sw as Ue,tw as We,uw as Ge,vw as Ke,ww as qe,xw as Je,yw as Ye,zC as A,zw as Xe}from"./dist-DggIHtPt.js";import{n as Ze}from"./dist-BFIP7qvw.js";import{i as Qe}from"./dist-dDi5a2bA.js";import{t as j}from"./button-J0r_4wz5.js";import{$ as $e,A as et,At as tt,C as M,Dt as N,Mt as nt,Q as P,S as F,X as I,Z as L,b as R,et as z,j as rt,jt as it,m as at,nt as B,rt as V,tt as H,x as U,y as W}from"./index-BI4JM57h.js";import{t as ot}from"./FilterBar-CHAmMDFh.js";import{t as st}from"./DataTableShell-B9cSAz8l.js";import{t as ct}from"./roleDescriptions-BJkLcyAA.js";var G=t(e(),1),K=n(),q=[{value:`never`,label:()=>ue(),days:null},{value:`30`,label:()=>D(),days:30},{value:`90`,label:()=>i(),days:90}],J=720*60*60*1e3,Y=`__all__`,X={name:``,roleKey:``,description:``};function Z(){let e=nt({from:`/settings/serviceAccounts`}),t=it({from:`/settings/serviceAccounts`}),n=e.q??``,i=e.status??Y,[a,s]=(0,G.useState)(Y),l=e=>void t({search:t=>({...t,q:e||void 0}),replace:!0}),u=e=>void t({search:t=>({...t,status:e===Y?void 0:e})}),d=x(c.apiKeys.listServiceAccounts,{filter:{q:n||void 0,role:a===Y?void 0:a,disabled:i===Y?void 0:i===`disabled`}}),f=x(c.apiKeys.listKeys,{}),p=x(c.apiKeys.listRoles,{}),m=v(c.apiKeys.createServiceAccount),h=v(c.apiKeys.updateServiceAccount),g=v(c.apiKeys.deleteServiceAccount),ue=Pe(c.apiKeys.mintApiKey),_=v(c.apiKeys.revokeApiKey),y=rt(),b=et(),ge=n!==``||a!==Y||i!==Y;function S(){s(Y),t({search:{},replace:!0})}let[C,T]=(0,G.useState)(!1),[E,D]=(0,G.useState)(X),[O,k]=(0,G.useState)(null),[A,Ze]=(0,G.useState)(new Set),[$e,N]=(0,G.useState)(null),P=(0,G.useRef)(!1),[z,B]=(0,G.useState)(new Set),[V,H]=(0,G.useState)({}),[J,Z]=(0,G.useState)(null),Q=(0,G.useMemo)(()=>{let e=new Map;for(let t of f??[]){let n=e.get(t.serviceAccountId)??[];n.push(t),e.set(t.serviceAccountId,n)}return e},[f]);function $(e){Ze(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})}async function dt(){try{O?(await h({serviceAccountId:O,name:E.name,roleKey:E.roleKey,description:E.description}),b.success(Ge())):await m({name:E.name,roleKey:E.roleKey,description:E.description||void 0}),D(X),k(null),T(!1)}catch(e){b.error(O?Oe():Ae(),e)}}function ft(e){D({name:e.name,roleKey:e.roleKey,description:e.description??``}),k(e._id),T(!0)}async function pt(e){if(P.current)return;P.current=!0;let t=V[e._id]??`never`,n=q.find(e=>e.value===t)?.days??null,r=n?Date.now()+n*24*60*60*1e3:void 0;N(e._id);try{let t=await ue({serviceAccountId:e._id,expiresAt:r});Z({accountName:e.name,plaintext:t.plaintext,prefix:t.prefix,lastFour:t.lastFour})}catch(e){b.error(Le(),e)}finally{P.current=!1,N(null)}}async function mt(e){if(await y({title:De(),description:(0,K.jsxs)(K.Fragment,{children:[Ue(),` `,(0,K.jsx)(`span`,{className:`font-mono`,children:e.name}),` `,Be(),` `,(0,K.jsx)(`strong`,{children:Te()}),` `,Ne()]}),confirmWord:e.name,confirmLabel:He(),destructive:!0}))try{await g({serviceAccountId:e._id}),b.success(ze(),e.name)}catch(e){b.error(We(),e)}}async function ht(e){if(await y({title:ke(),description:(0,K.jsxs)(K.Fragment,{children:[r(),` `,(0,K.jsxs)(`span`,{className:`font-mono`,children:[e.prefix,`…`,e.lastFour]}),` `,he()]}),confirmLabel:Ce(),destructive:!0})&&!z.has(e._id)){B(t=>new Set(t).add(e._id));try{await _({keyId:e._id})}catch(e){b.error(Se(),e)}finally{B(t=>{let n=new Set(t);return n.delete(e._id),n})}}}return(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`p`,{className:`oc-admin__hint`,children:ce()}),(0,K.jsxs)(ot,{q:n,onQChange:l,searchPlaceholder:ae(),onReset:S,canReset:ge,children:[(0,K.jsxs)(W,{value:a,onValueChange:s,children:[(0,K.jsx)(F,{size:`sm`,className:`w-40`,children:(0,K.jsx)(M,{placeholder:xe()})}),(0,K.jsxs)(R,{children:[(0,K.jsx)(U,{value:Y,children:be()}),(p??[]).map(e=>(0,K.jsx)(U,{value:e.key,children:e.key},e._id))]})]}),(0,K.jsxs)(W,{value:i,onValueChange:u,children:[(0,K.jsx)(F,{size:`sm`,className:`w-36`,children:(0,K.jsx)(M,{})}),(0,K.jsxs)(R,{children:[(0,K.jsx)(U,{value:Y,children:oe()}),(0,K.jsx)(U,{value:`active`,children:w()}),(0,K.jsx)(U,{value:`disabled`,children:o()})]})]})]}),(0,K.jsx)(st,{title:Xe(),rows:d,addLabel:_e(),onAdd:()=>{D(X),k(null),T(!0)},emptyHint:le(),isExpanded:e=>A.has(e._id),renderExpanded:e=>(0,K.jsx)(lt,{account:e,keys:Q.get(e._id)??[],onRevoke:ht,revoking:z}),rowActions:e=>[{label:fe(),onSelect:()=>ft(e)},{label:se(),onSelect:()=>void pt(e)},{label:A.has(e._id)?ie():me(),onSelect:()=>$(e._id)},{label:de(),variant:`destructive`,onSelect:()=>void mt(e)}],columns:[{header:``,className:`w-8`,cell:e=>(0,K.jsx)(j,{variant:`ghost`,size:`icon-sm`,"aria-label":A.has(e._id)?Fe():ee(),onClick:()=>$(e._id),children:A.has(e._id)?(0,K.jsx)(Qe,{}):(0,K.jsx)(tt,{})})},{header:Ie(),sort:e=>e.name,cell:e=>(0,K.jsxs)(`div`,{className:`flex flex-col`,children:[(0,K.jsx)(`span`,{children:e.name}),e.description?(0,K.jsx)(`span`,{className:`text-muted-foreground text-xs`,children:e.description}):null]})},{header:pe(),sort:e=>e.roleKey,cell:e=>(0,K.jsx)(I,{variant:`secondary`,children:e.roleKey})},{header:ne(),sort:e=>+!!e.disabled,cell:e=>e.disabled?(0,K.jsx)(I,{variant:`destructive`,children:o()}):(0,K.jsx)(I,{variant:`outline`,children:w()})},{header:re(),cell:e=>(0,K.jsxs)(W,{value:V[e._id]??`never`,onValueChange:t=>H(n=>({...n,[e._id]:t})),children:[(0,K.jsx)(F,{size:`sm`,className:`w-32`,children:(0,K.jsx)(M,{})}),(0,K.jsx)(R,{children:q.map(e=>(0,K.jsx)(U,{value:e.value,children:e.label()},e.value))})]})},{header:ye(),sort:e=>(Q.get(e._id)??[]).filter(e=>!e.disabled).length,cell:e=>{let t=(Q.get(e._id)??[]).filter(e=>!e.disabled).length;return(0,K.jsx)(`span`,{className:`oc-sa__keycount`,children:$e===e._id?qe():te({count:t})})}}]}),(0,K.jsx)(at,{open:C,onOpenChange:e=>{T(e),e||k(null)},title:O?ve():Ye(),description:O?Je():Ke(),canSubmit:!!(E.name&&E.roleKey),onSubmit:dt,submitLabel:O?Ee():we(),children:(0,K.jsxs)(`div`,{className:`oc-form`,children:[(0,K.jsxs)(`label`,{className:`oc-field`,children:[(0,K.jsx)(`span`,{className:`oc-field__label`,children:je()}),(0,K.jsx)(L,{value:E.name,onChange:e=>D({...E,name:e.target.value})})]}),(0,K.jsxs)(`label`,{className:`oc-field`,children:[(0,K.jsx)(`span`,{className:`oc-field__label`,children:Me()}),(0,K.jsxs)(W,{value:E.roleKey||void 0,onValueChange:e=>D({...E,roleKey:e}),children:[(0,K.jsx)(F,{className:`w-full`,children:(0,K.jsx)(M,{placeholder:Re()})}),(0,K.jsx)(R,{children:(p??[]).map(e=>(0,K.jsxs)(U,{value:e.key,children:[e.name,` (`,e.key,`)`]},e._id))})]}),(()=>{let e=(p??[]).find(e=>e.key===E.roleKey),t=e?ct(e):null;return t?(0,K.jsx)(`span`,{className:`text-muted-foreground text-xs`,children:t}):null})()]}),(0,K.jsxs)(`label`,{className:`oc-field`,children:[(0,K.jsx)(`span`,{className:`oc-field__label`,children:Ve()}),(0,K.jsx)(L,{value:E.description,onChange:e=>D({...E,description:e.target.value})})]})]})}),(0,K.jsx)(ut,{minted:J,onClose:()=>Z(null)})]})}function lt({account:e,keys:t,onRevoke:n,revoking:r}){return(0,K.jsxs)(`div`,{className:`oc-sa__keys`,children:[(0,K.jsxs)(`div`,{className:`oc-sa__keys-head`,children:[E(),` `,(0,K.jsx)(`span`,{className:`font-medium`,children:e.name})]}),t.length===0?(0,K.jsx)(`p`,{className:`oc-admin__hint`,children:m()}):(0,K.jsxs)(`table`,{className:`oc-sa__keytable`,children:[(0,K.jsx)(`thead`,{children:(0,K.jsxs)(`tr`,{children:[(0,K.jsx)(`th`,{children:k()}),(0,K.jsx)(`th`,{children:h()}),(0,K.jsx)(`th`,{children:d()}),(0,K.jsx)(`th`,{children:T()}),(0,K.jsx)(`th`,{children:S()}),(0,K.jsx)(`th`,{children:f()}),(0,K.jsx)(`th`,{})]})}),(0,K.jsx)(`tbody`,{children:t.map(t=>(0,K.jsxs)(`tr`,{children:[(0,K.jsx)(`td`,{children:(0,K.jsxs)(`code`,{className:`oc-sa__keyid`,children:[t.prefix,`…`,t.lastFour]})}),(0,K.jsx)(`td`,{children:(0,K.jsx)(I,{variant:`secondary`,children:e.roleKey})}),(0,K.jsx)(`td`,{children:Q(t.createdAt)}),(0,K.jsx)(`td`,{className:$(t.lastUsedAt)?`oc-sa__stale`:``,children:dt(t.lastUsedAt)}),(0,K.jsx)(`td`,{children:ft(t.expiresAt)}),(0,K.jsx)(`td`,{children:pt(t)}),(0,K.jsx)(`td`,{className:`text-right`,children:t.disabled?null:(0,K.jsx)(j,{variant:`destructive`,size:`sm`,disabled:r.has(t._id),onClick:()=>n(t),children:r.has(t._id)?C():a()})})]},t._id))})]})]})}function ut({minted:e,onClose:t}){let[n,r]=(0,G.useState)(!1);async function i(){if(e)try{await navigator.clipboard.writeText(e.plaintext),r(!0),window.setTimeout(()=>r(!1),2e3)}catch{}}return(0,K.jsx)(P,{open:e!==null,onOpenChange:e=>{e||(r(!1),t())},children:e?(0,K.jsxs)($e,{className:`max-w-lg`,showCloseButton:!1,onInteractOutside:e=>e.preventDefault(),onEscapeKeyDown:e=>e.preventDefault(),children:[(0,K.jsxs)(B,{children:[(0,K.jsx)(V,{children:A()}),(0,K.jsx)(z,{children:ge({name:e.accountName})})]}),(0,K.jsx)(`div`,{className:`oc-sa__minted-warning`,children:g()}),(0,K.jsxs)(`div`,{className:`oc-sa__minted-box`,children:[(0,K.jsx)(`code`,{className:`oc-sa__minted-plain`,children:e.plaintext}),(0,K.jsxs)(j,{variant:`outline`,size:`sm`,onClick:()=>void i(),"aria-label":p(),children:[n?(0,K.jsx)(Ze,{}):(0,K.jsx)(N,{}),n?u():b()]})]}),(0,K.jsx)(H,{children:(0,K.jsx)(j,{onClick:()=>{r(!1),t()},children:_()})})]}):null})}function Q(e){return new Date(e).toLocaleString(`fr-FR`)}function $(e){return e===null?!1:Date.now()-e>J}function dt(e){return e===null?O():new Date(e).toLocaleString(`fr-FR`)}function ft(e){return e===null?`—`:new Date(e).toLocaleDateString(`fr-FR`)}function pt(e){return e.disabled?(0,K.jsx)(I,{variant:`destructive`,children:y()}):e.expiresAt!==null&&e.expiresAt<Date.now()?(0,K.jsx)(I,{variant:`outline`,children:s()}):(0,K.jsx)(I,{variant:`outline`,children:l()})}export{Z as ServiceAccountsTab};
@@ -1 +0,0 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{At as r,Bt as i,Ct as a,DO as o,Dt as s,Et as c,Ft as l,It as u,Lt as d,Mt as f,NO as p,Nt as m,Ot as h,PO as g,Pt as _,Rt as v,St as y,Tt as b,_t as x,at as S,bt as C,ct as w,dt as T,ft as E,gt as D,ht as O,it as k,jt as A,kt as j,lt as M,mt as N,nt as P,ot as F,pt as I,rt as L,st as ee,ut as R,vt as z,wt as B,xt as V,yt as H,zt as U}from"./dist-DggIHtPt.js";import{t as W}from"./button-J0r_4wz5.js";import{j as G}from"./index-BI4JM57h.js";import{t as K}from"./DataTableShell-B9cSAz8l.js";var q=t(e(),1),J=n(),Y={hung:()=>a(),wrong_result:()=>y(),error:()=>V(),other:()=>C()},X=e=>(e&&Y[e]?.())??e??`—`;function Z(e){let t=e.slice(e.lastIndexOf(`:`)+1)||e;return t.length>12?`${t.slice(0,12)}…`:t}function Q({data:e}){let t=e.snapshot,n=p(o.subAgentReports.respondToReport),[r,i]=(0,q.useState)(e.thread),[a,s]=(0,q.useState)(``),[c,l]=(0,q.useState)(!1);async function u(){let t=a.trim();if(!(!t||c)){l(!0);try{await n({reportId:e._id,text:t}),i(e=>[...e,{authorRole:`admin`,text:t,at:Date.now()}]),s(``)}finally{l(!1)}}}return(0,J.jsxs)(`div`,{className:`oc-fbadmin__detail`,children:[(0,J.jsx)(`div`,{className:`oc-fbadmin__row`,children:(0,J.jsxs)(`span`,{className:`oc-fbadmin__meta`,children:[X(e.category),` · `,H({failed:t.failedCount,total:t.totalCount}),t.openclawModel?` · ${t.openclawModel}`:``,t.openclawRuntime?` (${t.openclawRuntime})`:``]})}),e.comment?(0,J.jsxs)(`section`,{children:[(0,J.jsx)(`h4`,{className:`oc-fbadmin__h`,children:z()}),(0,J.jsx)(`p`,{className:`oc-fbadmin__comment`,children:e.comment})]}):null,(0,J.jsxs)(`section`,{children:[(0,J.jsx)(`h4`,{className:`oc-fbadmin__h`,children:x()}),r.length>0?(0,J.jsx)(`div`,{className:`oc-fbadmin__thread`,children:r.map((e,t)=>(0,J.jsxs)(`div`,{className:`oc-notif__msg oc-notif__msg--${e.authorRole}`,children:[(0,J.jsx)(`span`,{className:`oc-notif__msg-who`,children:e.authorRole===`admin`?D():O()}),(0,J.jsx)(`span`,{className:`oc-notif__msg-text`,children:e.text})]},t))}):(0,J.jsx)(`p`,{className:`oc-fbadmin__meta`,children:N()}),(0,J.jsx)(`textarea`,{className:`oc-feedback__textarea`,placeholder:I(),value:a,maxLength:2e3,rows:3,onChange:e=>s(e.target.value.slice(0,2e3))}),(0,J.jsx)(`div`,{className:`oc-fbadmin__row`,style:{justifyContent:`flex-end`},children:(0,J.jsx)(W,{size:`sm`,onClick:()=>void u(),disabled:!a.trim()||c,children:c?T():E()})})]}),(0,J.jsxs)(`section`,{children:[(0,J.jsxs)(`h4`,{className:`oc-fbadmin__h`,children:[R({count:t.children.length}),t.childrenTruncated?` ${M()}`:``,t.textTruncated?` ${w()}`:``]}),(0,J.jsx)(`div`,{className:`oc-fbadmin__ctx`,children:t.children.map((e,n)=>(0,J.jsxs)(`div`,{className:`oc-fbadmin__ctx-turn`,children:[(0,J.jsxs)(`span`,{className:`oc-fbadmin__ctx-role`,children:[(e.taskName?.trim()||Z(e.childSessionKey))+` · ${e.status}`,e.phase?` · ${e.phase}`:``,e.childSessionKey===t.flaggedChildSessionKey?` · ${ee()}`:``]}),e.errorMessage?(0,J.jsx)(`pre`,{className:`oc-msg__source-pre`,children:e.errorMessage}):null,e.resultText?(0,J.jsx)(`pre`,{className:`oc-msg__source-pre`,children:e.resultText}):null]},n))})]}),t.parentText?(0,J.jsxs)(`section`,{children:[(0,J.jsx)(`h4`,{className:`oc-fbadmin__h`,children:F()}),(0,J.jsx)(`pre`,{className:`oc-msg__source-pre`,children:t.parentText})]}):null,(0,J.jsxs)(`section`,{children:[(0,J.jsx)(`h4`,{className:`oc-fbadmin__h`,children:S()}),(0,J.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 $(){let e=g(o.subAgentReports.listForAdmin,{}),t=p(o.subAgentReports.readReport),n=p(o.subAgentReports.deleteReport),a=G(),[y,x]=(0,q.useState)(null),[S,C]=(0,q.useState)({});async function w(e){if(y===e._id){x(null);return}if(!S[e._id]){let n=await t({reportId:e._id});C(t=>({...t,[e._id]:n}))}x(e._id)}async function T(e){await a({title:k(),description:L(),confirmLabel:P(),destructive:!0})&&(await n({reportId:e._id}),y===e._id&&x(null))}return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(`p`,{className:`oc-admin__hint`,children:[v(),` `,(0,J.jsx)(`strong`,{children:d()}),` `,u()]}),(0,J.jsx)(K,{title:i(),rows:e,emptyHint:U(),isExpanded:e=>y===e._id&&!!S[e._id],renderExpanded:e=>S[e._id]?(0,J.jsx)(Q,{data:S[e._id]}):null,columns:[{header:l(),cell:e=>new Date(e.at).toLocaleString(`fr-FR`),sort:e=>e.at},{header:_(),cell:e=>X(e.category),sort:e=>X(e.category)},{header:m(),cell:e=>`${e.failedCount}/${e.totalCount}`,sort:e=>e.failedCount},{header:f(),cell:e=>(e.reporterEmail||e.reporterName||`—`)+(e.impersonated&&e.realOperatorEmail?` ${j({operator:e.realOperatorEmail})}`:``),sort:e=>e.reporterEmail||e.reporterName||null},{header:A(),cell:e=>e.hasComment?`✎`:`—`,sort:e=>+!!e.hasComment},{header:r(),cell:e=>e.answered?(0,J.jsx)(`span`,{className:`oc-fbadmin__pill is-ok`,children:h()}):(0,J.jsx)(`span`,{className:`oc-fbadmin__pill`,children:s()}),sort:e=>+!!e.answered}],rowActions:e=>[{label:y===e._id?b():c(),onSelect:()=>void w(e)},{label:B(),onSelect:()=>void T(e),variant:`destructive`}]})]})}export{$ as SubAgentReportsTab};
@@ -1 +0,0 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$ as r,$T as i,AE as a,AT as o,BE as s,BT as c,CE as l,DE as u,DO as d,DT as f,EE as p,FD as m,FE as h,FT as g,GE as _,GT as v,HE as y,HT as b,IE as ee,IT as te,JE as ne,JT as re,KE as ie,KT as ae,LE as oe,LT as se,ME as ce,MT as le,NE as ue,NO as x,NT as de,OE as fe,OO as pe,OT as me,PD as he,PE as ge,PO as S,PT as _e,Q as ve,QD as ye,QT as be,RE as xe,RT as Se,SE as Ce,TE as we,UE as Te,UT as Ee,VE as De,VT as Oe,WE as ke,WT as Ae,XD as je,XT as Me,YE as Ne,YT as Pe,ZD as Fe,ZT as Ie,_E as Le,aE as Re,bE as ze,cE as Be,dE as Ve,eE as He,et as C,fE as w,gE as Ue,hE as We,iE as Ge,jE as Ke,jO as qe,jT as Je,kE as Ye,kT as Xe,lE as Ze,mE as Qe,n as $e,nE as et,oE as tt,pE as nt,qE as rt,qT as it,rE as at,sE as ot,tE as st,tt as T,uE as ct,vE as lt,wE as ut,xE as dt,yE as ft,zE as E,zT as pt}from"./dist-DggIHtPt.js";import{n as D}from"./dist-BFIP7qvw.js";import{t as O}from"./x-CjN2swsp.js";import{t as k}from"./button-J0r_4wz5.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-BI4JM57h.js";import{a as xt,i as St,n as Ct,o as wt,r as Tt,t as Et}from"./card-dyG2YjyY.js";import{a as Dt,i as H,n as Ot,o as U,r as W,t as kt}from"./table-BuMPc1vP.js";import{t as At}from"./TimeRangePicker-Dj6YRWgA.js";import{t as jt}from"./FilterBar-CHAmMDFh.js";import{t as Mt}from"./AdvancedFilter-C7EdUbso.js";var G=pe(`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(Me());if(e.size>Bt)throw Error(Pe());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(it());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(it());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(ae());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(re())),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`?ye():e===`dark`?Fe():je()}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:$e(`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":T(),title:T(),children:(0,X.jsx)(mt,{className:`size-4`})}):null]})}function Qt({selectedKey:e,resolvedMode:t}){let n=S(d.charts.listMyCharts),r=x(d.charts.setMyChart);async function i(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:De()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:s()})]}),(0,X.jsxs)(`div`,{className:`oc-chart-grid`,children:[(0,X.jsx)(Zt,{selected:e===null,title:E(),subtitle:xe(),tokens:null,mode:t,onSelect:()=>void i(null)}),(n??[]).map(n=>{let r=n.via===`common`?oe():n.via===`owner`?ee():h({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 i(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:ge()}):null]})}function $t(){let e=x(d.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 f(e){let t=e.target.files?.[0];if(e.target.value=``,t){o(null),c(!1);try{i(await t.text())}catch{o(w())}}}async function p(){if(o(null),c(!1),t.trim()===``){o(ct());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:ze()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:ft()})]}),(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:lt()}),(0,X.jsx)(I,{value:t,onChange:e=>n(e.target.value),placeholder:Le(),maxLength:60})]}),(0,X.jsxs)(`label`,{className:`oc-chart-import__field`,children:[(0,X.jsx)(`span`,{className:`oc-chart-import__label`,children:Ue()}),(0,X.jsx)(`textarea`,{className:`oc-chart-import__textarea`,value:r,onChange:e=>i(e.target.value),placeholder:We(),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`}),Qe(),(0,X.jsx)(`input`,{type:`file`,accept:`application/json,.json`,className:`oc-chart-import__file-input`,onChange:e=>void f(e)})]})}),(0,X.jsx)(k,{size:`sm`,disabled:l,onClick:()=>void p(),children:nt()})]}),a?(0,X.jsx)(`p`,{className:`oc-chart-import__error`,children:a}):null,s?(0,X.jsx)(`p`,{className:`oc-chart-import__ok`,children:Ve()}):null]})]})}function en({chart:e}){let t=qe(d.charts.setChartLogo),n=x(d.charts.removeChartLogo),[r,a]=(0,K.useState)(!1),[o,s]=(0,K.useState)(null),c=t=>t===`light`?e.logoLightUrl:e.logoDarkUrl;async function l(n,r,i){if(e.chartId!==void 0){s(null),a(!0);try{let{blob:a,hasAlpha:o}=await Wt(r,i?{variantFor:i}:{}),s=await a.arrayBuffer();await t({chartId:e.chartId,bytes:s,mode:n,hasAlpha:o})}catch(e){s(e instanceof Error?e.message:String(e))}finally{a(!1)}}}async function u(e,t){let n=t.target.files?.[0];t.target.value=``,n&&await l(e,n)}async function f(t){if(e.chartId!==void 0){s(null),a(!0);try{await n({chartId:e.chartId,mode:t})}catch(e){s(e instanceof Error?e.message:String(e))}finally{a(!1)}}}async function p(e){let t=c(e===`light`?`dark`:`light`);if(t){s(null),a(!0);try{await l(e,await(await fetch(t)).blob(),e)}catch(e){s(e instanceof Error?e.message:String(e))}finally{a(!1)}}}function m({mode:e}){let t=c(e),n=c(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`?at():et()}),(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?He():st(),(0,X.jsx)(`input`,{type:`file`,accept:`image/*`,className:`oc-chart-import__file-input`,onChange:t=>void u(e,t)})]})}),!t&&n?(0,X.jsx)(k,{variant:`ghost`,size:`sm`,disabled:r,onClick:()=>void p(e),children:be()}):null,t?(0,X.jsx)(k,{variant:`ghost`,size:`sm`,disabled:r,onClick:()=>void f(e),children:i()}):null]})}return(0,X.jsxs)(`div`,{className:`oc-chart-mine__logo`,children:[(0,X.jsx)(`span`,{className:`oc-chart-mine__groups-label`,children:Ge()}),(0,X.jsxs)(`div`,{className:`oc-chart-mine__logo-slots`,children:[(0,X.jsx)(m,{mode:`light`}),(0,X.jsx)(m,{mode:`dark`})]}),r?(0,X.jsx)(`span`,{className:`oc-show__desc`,children:Ie()}):null,o?(0,X.jsx)(`p`,{className:`oc-chart-import__error`,children:o}):null]})}function tn({chart:e}){let t=S(d.me.getMe,{host:z}),n=x(d.charts.addChartDomain),r=x(d.charts.removeChartDomain),[i,a]=(0,K.useState)(``),[o,s]=(0,K.useState)(null),[l,u]=(0,K.useState)(!1);if(t?.role!==`admin`)return null;let f=e.domains??[];async function p(){let t=i.trim();if(t!==``){s(null),u(!0);try{await n({chartKey:e.key,domain:t}),a(``)}catch(e){s(e instanceof Error?e.message:String(e))}finally{u(!1)}}}async function m(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:v()}),(0,X.jsxs)(`div`,{className:`oc-chart-mine__domains-body`,children:[(0,X.jsx)(`div`,{className:`oc-chart-avail__groups`,children:f.length===0?(0,X.jsx)(`span`,{className:`oc-show__desc`,children:Oe()}):f.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":c({domain:e}),onClick:()=>void m(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:Ee(),className:`oc-chart-mine__domains-input`,onKeyDown:e=>{e.key===`Enter`&&p()}}),(0,X.jsx)(k,{variant:`outline`,size:`sm`,disabled:l,onClick:()=>void p(),children:b()})]}),(0,X.jsx)(`span`,{className:`oc-show__desc`,children:Ae()}),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=x(d.charts.updateChart),n=x(d.charts.deleteChart),[i,a]=(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,m]=(0,K.useState)(null),[h,_]=(0,K.useState)(!1);function v(){s(e.name),l(nn(e.tokens)),f(e.tokens.bpm??0),m(null),a(!0)}async function y(){if(e.chartId===void 0)return;m(null);let n;try{n=JSON.parse(c)}catch{m(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}),a(!1)}catch(e){m(e instanceof Error?e.message:String(e))}finally{_(!1)}}async function b(){if(e.chartId!==void 0&&window.confirm(g()))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:i?null:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(k,{variant:`outline`,size:`sm`,onClick:v,children:tt()}),(0,X.jsx)(k,{variant:`ghost`,size:`sm`,onClick:()=>void b(),children:Re()})]})})]}),i?(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:se()}),(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:C()}),(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":C()}),(0,X.jsx)(`span`,{className:`oc-chart-bpm__value`,children:u===0?r():`${u} BPM`})]}),(0,X.jsx)(`span`,{className:`oc-show__desc`,children:ve()})]}),(0,X.jsxs)(`label`,{className:`oc-chart-import__field`,children:[(0,X.jsx)(`span`,{className:`oc-chart-import__label`,children:te()}),(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:h,onClick:()=>void y(),children:pt()}),(0,X.jsx)(k,{variant:`ghost`,size:`sm`,onClick:()=>a(!1),children:Se()})]})]}):null,(0,X.jsx)(en,{chart:e}),(0,X.jsx)(tn,{chart:e})]})}function an(){let e=S(d.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:Ze()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:Be()})]}),e!==void 0&&t.length===0?(0,X.jsx)(`p`,{className:`oc-show__desc`,children:ot()}):(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=x(d.charts.addChartToGroupPool),r=x(d.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 f(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?p():e.kind===`custom`&&e.scope===`personal`?Je():u()}),e.isGlobalDefault?(0,X.jsx)(F,{variant:`default`,children:we()}):null]}),(0,X.jsxs)(`div`,{className:`oc-chart-avail__groups`,children:[(0,X.jsx)(`span`,{className:`oc-chart-mine__groups-label`,children:l()}),(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":dt({group:e.name}),onClick:()=>void f(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:Ce()})}),(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:ut()}):null]})]})}function sn({chart:e}){let t=x(d.charts.promoteChartToCommon),n=x(d.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(g()))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`?o():Je()}),e.ownerLabel?(0,X.jsx)(`span`,{className:`oc-show__desc`,children:le({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:Xe()}):null,(0,X.jsx)(k,{variant:`ghost`,size:`sm`,onClick:()=>void i(),children:me()})]})]})}function cn({defaultThemeMode:e,defaultLocale:t,defaultChartKey:n}){let r=x(d.admin.setDefaultThemeMode),i=x(d.admin.setDefaultLocale),o=x(d.charts.setDefaultChart),s=S(d.charts.listChartsAdmin),c=S(d.groups.listGroups,{}),l=e??`system`,u=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:Te()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:y()})]}),(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:ue()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:ce()})]}),(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsx)(k,{variant:n===null?`default`:`outline`,size:`sm`,onClick:()=>void o({name:null}),children:E()}),vt.map(e=>(0,X.jsx)(k,{variant:n===e.key?`default`:`outline`,size:`sm`,onClick:()=>void o({name:e.key}),children:e.name},e.key)),(s??[]).filter(e=>e.kind===`custom`&&e.scope===`common`).map(e=>(0,X.jsx)(k,{variant:n===e.key?`default`:`outline`,size:`sm`,onClick:()=>void o({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:Ke()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:a()})]}),(0,X.jsx)(`div`,{className:`oc-chart-avail-list`,children:(s??[]).filter(e=>!(e.kind===`custom`&&e.scope===`common`)).map(e=>(0,X.jsx)(on,{chart:e,groups:c??[]},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:Ye()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:fe()})]}),(0,X.jsx)(`div`,{className:`oc-chart-avail-list`,children:(s??[]).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:_e()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:de()})]}),(()=>{let e=(s??[]).filter(e=>e.kind===`custom`);return e.length===0?(0,X.jsx)(`p`,{className:`oc-show__desc`,children:f()}):(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:Ne()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:ne()})]}),(0,X.jsx)(`div`,{className:`oc-show__row`,children:[`light`,`dark`,`system`].map(e=>(0,X.jsx)(k,{variant:l===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:rt()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:ie()})]}),(0,X.jsx)(`div`,{className:`oc-show__row`,children:[`fr`,`en`].map(e=>(0,X.jsx)(k,{variant:u===e?`default`:`outline`,size:`sm`,onClick:()=>void i({locale:e}),children:e===`fr`?m():he()},e))}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:_()})]})]})}function ln(){let e=S(d.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:ke()}),(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{Ap as r,Bb as i,Bp as a,Cp as o,Cx as s,DO as c,Dp as l,Ep as u,Ex as d,Fp as f,Gb as p,Hb as m,Ip as h,Jb as g,Kb as _,Lb as v,Lp as ee,Mp as te,NO as y,Np as ne,OO as b,Op as re,PO as x,Pp as ie,Rb as S,Rp as ae,Sp as oe,Sx as C,Tp as se,Tx as w,Ub as T,Vb as ce,Wb as le,Xb as ue,Yb as de,Zb as fe,_p as pe,_x as me,ap as he,ax as ge,bp as _e,bx as E,cp as ve,cx as D,dp as ye,dx as be,fp as xe,fx as O,gp as Se,gx as k,hp as Ce,hx as A,ip as j,ix as M,jp as we,kp as Te,lp as Ee,lx as N,mp as De,mx as P,np as Oe,nx as F,op as ke,ox as I,pp as Ae,px as L,qb as je,rp as Me,rx as R,sp as Ne,sx as Pe,up as Fe,ux as Ie,vp as Le,vx as Re,wp as ze,wx as Be,xp as Ve,xx as He,yp as Ue,yx as We,zb as Ge,zp as Ke}from"./dist-DggIHtPt.js";import{n as qe}from"./dist-BFIP7qvw.js";import{t as Je}from"./x-CjN2swsp.js";import{i as z,n as B,r as Ye,t as Xe}from"./tabs-BTVXPiSJ.js";import{t as V}from"./button-J0r_4wz5.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-BI4JM57h.js";import{n as pt}from"./TimeRangePicker-Dj6YRWgA.js";import{t as mt}from"./FilterBar-CHAmMDFh.js";import{t as ht}from"./AdvancedFilter-C7EdUbso.js";import{t as gt}from"./DataTableShell-B9cSAz8l.js";var _t=b(`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=b(`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`?Pe():n===`agent`?`${I()} - ${r}`:e}function bt(){let e=x(c.me.getMe,{host:lt})?.role===`admin`,t=x(c.deliveryTiming.getDeliveryStatus,{}),n=y(c.deliveryTiming.startDeliveryRecord),r=y(c.deliveryTiming.stopDeliveryRecord),[i,a]=(0,J.useState)(!1),[o,l]=(0,J.useState)(!1),u=t?.recording??!1,f=async()=>{l(!0);try{u?await r({}):await n({})}finally{l(!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:d()}),(0,Y.jsx)(`p`,{className:`oc-admin__hint`,children:w()})]}),e?(0,Y.jsx)(V,{variant:u?`destructive`:`default`,size:`sm`,disabled:o||t===void 0,onClick:()=>void f(),children:u?s():Be()}):null]}),u?(0,Y.jsxs)(`p`,{className:`flex items-center gap-2 text-sm`,children:[(0,Y.jsx)(W,{variant:`secondary`,children:C()}),t?.startedAt?(0,Y.jsx)(`span`,{className:`text-muted-foreground`,children:He({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?Re():We()})}),i?(0,Y.jsx)(xt,{isAdmin:e}):null]})}function xt({isAdmin:e}){let t=x(c.deliveryTiming.listDeliverySessions,{}),n=y(c.deliveryTiming.deleteDeliverySessions),[r,i]=(0,J.useState)(``),[a,o]=(0,J.useState)(`all`),[s,l]=(0,J.useState)(X),[u,d]=(0,J.useState)(null),{from:f,to:p}=pt(s),m=s.to===`now`?1/0:p,h=r.trim()!==``||a!==`all`||s!==X,g=()=>{i(``),o(`all`),l(X)},_=(0,J.useMemo)(()=>{if(t===void 0)return;let e=r.trim().toLowerCase();return t.filter(t=>(e===``||t.startedBy.toLowerCase().includes(e))&&(a===`all`||(a===`active`?t.active:!t.active))&&t.startedAt>=f&&t.startedAt<=m).map(e=>({...e,_id:e.sessionId}))},[t,r,a,f,m]),v=e=>{let t=new Set((_??[]).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:r,onQChange:i,searchPlaceholder:k(),timeRange:s,onTimeRangeChange:l,onReset:g,canReset:h,children:(0,Y.jsxs)(q,{value:a,onValueChange:e=>o(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:A()}),(0,Y.jsx)(K,{value:`active`,children:P()}),(0,Y.jsx)(K,{value:`stopped`,children:L()})]})]})}),(0,Y.jsx)(gt,{title:me(),rows:_,emptyHint:S(),columns:[{header:``,className:`w-8`,cell:e=>(0,Y.jsx)(V,{variant:`ghost`,size:`icon`,"aria-label":u===e.sessionId?M():ge(),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:O(),sort:e=>e.startedAt,cell:e=>(0,Y.jsx)(`span`,{className:`tabular-nums`,children:new Date(e.startedAt).toLocaleString()})},{header:be(),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:Ie(),sort:e=>e.count,cell:e=>(0,Y.jsx)(`span`,{className:`tabular-nums`,children:Z(e.count)})},{header:N(),sort:e=>e.startedBy,cell:e=>yt(e.startedBy)},{header:D(),sort:e=>e.active,cell:e=>e.active?(0,Y.jsx)(W,{variant:`secondary`,children:P()}):(0,Y.jsx)(`span`,{className:`text-muted-foreground`,children:L()})}],rowActions:e?e=>[{label:R(),variant:`destructive`,onSelect:()=>v([e.sessionId])}]:void 0,bulkActions:e?[{label:R(),variant:`destructive`,onSelect:e=>v(e)}]:void 0,isExpanded:e=>e.sessionId===u,renderExpanded:e=>(0,Y.jsx)(St,{sessionId:e.sessionId})})]})}function St({sessionId:e}){let t=x(c.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:F()});if(e.count===0||e.segments===null)return(0,Y.jsx)(`p`,{className:`oc-admin__hint`,children:E()});let r=e.segments,a=(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,` `,v()]}),(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?Ge():i()]})]}),(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:de()}),(0,Y.jsx)(`th`,{className:`py-1 text-right font-medium`,children:g()}),(0,Y.jsx)(`th`,{className:`py-1 text-right font-medium`,children:je()})]})}),(0,Y.jsxs)(`tbody`,{children:[a(_(),r.bridge),a(p(),r.A),a(le(),r.C)]})]}),(0,Y.jsx)(`p`,{className:`oc-admin__hint`,children:T()}),e.truncated?(0,Y.jsx)(`p`,{className:`oc-admin__hint`,children:ce()}):null,(0,Y.jsx)(`p`,{className:`oc-admin__hint`,children:m()})]})}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,i=e.kind,s=e.statusClass??Q,d=e.principalType??Q,p=e.direction??Q,m=e.roleKey??Q,g=e.q??``,_=ut(e.from,e.to),v=(0,J.useMemo)(()=>ct(e.adv),[e.adv]),{from:y,to:b}=pt(_),[S,C]=(0,J.useState)(null),[w,T]=(0,J.useState)(null),ce=e=>void t({search:t=>({...t,limit:e})}),le=e=>void t({search:t=>({...t,kind:e})}),de=e=>void t({search:t=>({...t,q:e||void 0}),replace:!0}),me=e=>void t({search:t=>({...t,statusClass:e===Q?void 0:e})}),ge=e=>void t({search:t=>({...t,principalType:e===Q?void 0:e})}),E=e=>void t({search:t=>({...t,direction:e===Q?void 0:e})}),D=e=>void t({search:t=>({...t,roleKey:e===Q?void 0:e})}),be=e=>void t({search:t=>({...t,...nt(e)})}),O=e=>void t({search:t=>({...t,adv:it(e)}),replace:!0}),k=x(c.observability.listEvents,{limit:n}),A=x(c.observability.listEvents,{limit:n,kind:i===Tt?void 0:i,filter:{q:g||void 0,from:y,to:b,statusClass:s===Q?void 0:s,principalType:d===Q?void 0:d,direction:p===Q?void 0:p,roleKey:m===Q?void 0:m,advanced:v.length>0?v:void 0}}),j=(0,J.useMemo)(()=>{let e=new Set;for(let t of k??[])e.add(t.kind);return[...e].sort()},[k]),M=(0,J.useMemo)(()=>{let e=new Set;for(let t of k??[])t.roleKey&&e.add(t.roleKey);return[...e].sort()},[k]),N=g!==``||s!==Q||d!==Q||p!==Q||m!==Q||v.length>0||_.kind!==`relative`||_.from!==kt.from;function P(){t({search:{limit:100,kind:`all`},replace:!0})}let Oe=S?k?.filter(e=>e.correlationId===S):A,[F,I]=(0,J.useState)(`events`);return(0,Y.jsxs)(Xe,{value:F,onValueChange:e=>I(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}),fe()]}),(0,Y.jsxs)(z,{value:`events`,className:`flex-1 gap-1.5`,children:[(0,Y.jsx)(vt,{size:13,"aria-hidden":!0}),ue()]})]}),(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:[a(),(0,Y.jsx)(`strong`,{children:Ke()}),ae(),` `,(0,Y.jsx)(`span`,{className:`oc-filter__window`,children:ee()})]}),(0,Y.jsxs)(mt,{q:g,onQChange:de,searchPlaceholder:h(),timeRange:_,onTimeRangeChange:be,onReset:P,canReset:N,children:[(0,Y.jsxs)(q,{value:s,onValueChange:me,children:[(0,Y.jsx)(U,{size:`sm`,className:`w-32`,children:(0,Y.jsx)(H,{placeholder:f()})}),(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:d,onValueChange:ge,children:[(0,Y.jsx)(U,{size:`sm`,className:`w-32`,children:(0,Y.jsx)(H,{placeholder:ne()})}),(0,Y.jsxs)(G,{children:[(0,Y.jsx)(K,{value:Q,children:te()}),Dt.map(e=>(0,Y.jsx)(K,{value:e,children:e},e))]})]}),(0,Y.jsxs)(q,{value:p,onValueChange:E,children:[(0,Y.jsx)(U,{size:`sm`,className:`w-32`,children:(0,Y.jsx)(H,{placeholder:we()})}),(0,Y.jsxs)(G,{children:[(0,Y.jsx)(K,{value:Q,children:r()}),Ot.map(e=>(0,Y.jsx)(K,{value:e,children:e},e))]})]}),(0,Y.jsxs)(q,{value:m,onValueChange:D,children:[(0,Y.jsx)(U,{size:`sm`,className:`w-36`,children:(0,Y.jsx)(H,{placeholder:Te()})}),(0,Y.jsxs)(G,{children:[(0,Y.jsx)(K,{value:Q,children:re()}),M.map(e=>(0,Y.jsx)(K,{value:e,children:e},e))]})]}),(0,Y.jsxs)(q,{value:i,onValueChange:le,children:[(0,Y.jsx)(U,{size:`sm`,className:`w-44`,children:(0,Y.jsx)(H,{placeholder:l()})}),(0,Y.jsxs)(G,{children:[(0,Y.jsx)(K,{value:Tt,children:u()}),j.map(e=>(0,Y.jsx)(K,{value:e,children:e},e))]})]}),(0,Y.jsxs)(q,{value:String(n),onValueChange:e=>ce(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:se({count:e})},e))})]})]}),(0,Y.jsx)(ht,{fields:At,seed:v,onChange:O}),S?(0,Y.jsx)(`div`,{className:`oc-traces__followline`,children:(0,Y.jsxs)(`button`,{type:`button`,className:`oc-traces__chip`,onClick:()=>C(null),title:ze(),children:[(0,Y.jsxs)(`span`,{className:`oc-traces__chip-label`,children:[o(),(0,Y.jsx)(`code`,{children:$(S)})]}),(0,Y.jsx)(Je,{className:`oc-traces__chip-x`,"aria-hidden":!0}),(0,Y.jsx)(`span`,{className:`sr-only`,children:oe()})]})}):null,(0,Y.jsx)(gt,{title:Ve(),rows:Oe,emptyHint:S?_e():Ue(),columns:[{header:Le(),sort:e=>e.at,cell:e=>(0,Y.jsx)(`span`,{className:`oc-traces__time`,children:new Date(e.at).toLocaleString(`fr-FR`)})},{header:pe(),sort:e=>e.kind,cell:e=>(0,Y.jsx)(W,{variant:`secondary`,children:e.kind})},{header:Se(),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":Ce(),children:`✓`})}},{header:De(),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:Ae(),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:xe(),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:ye(),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:Fe(),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:Ee(),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:ve(),sort:e=>e.correlationId,cell:e=>e.correlationId?(0,Y.jsx)(`button`,{type:`button`,className:`oc-traces__corr`,title:Ne(),onClick:()=>C(e.correlationId),children:$(e.correlationId)}):(0,Y.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})},{header:ke(),sort:e=>+!!e.meta,cell:e=>e.meta?(0,Y.jsx)(V,{variant:`outline`,size:`sm`,onClick:()=>T(e),children:he()}):(0,Y.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})}]}),(0,Y.jsx)(Pt,{row:w,onClose:()=>T(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:[j(),` `,(0,Y.jsx)(`code`,{children:e.kind}),(0,Y.jsx)(W,{variant:`outline`,children:Me()})]}),(0,Y.jsx)(rt,{children:Oe()})]}),(0,Y.jsx)(`pre`,{className:`oc-traces__meta-json`,children:n})]}):null})}export{jt as TracesTab};