@lacneu/atrium 0.62.2 → 0.63.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 (87) hide show
  1. package/dist/assets/AccessTab-CAsqZ6Oe.js +1 -0
  2. package/dist/assets/AdvancedFilter-CAZse6g9.js +1 -0
  3. package/dist/assets/AgentFilesTab-BRgTx-O-.js +3 -0
  4. package/dist/assets/AnomaliesTab-QOz38Dl8.js +1 -0
  5. package/dist/assets/AuditTab-a5iD6OvB.js +1 -0
  6. package/dist/assets/BridgeTab-De8R_lT4.js +1 -0
  7. package/dist/assets/ChatDefaultsTab-BOt-jkMY.js +1 -0
  8. package/dist/assets/DataTableShell-NMYUihjL.js +1 -0
  9. package/dist/assets/DetailChips-2kEsgn1k.js +1 -0
  10. package/dist/assets/FeedbacksTab-CdqQtSm1.js +1 -0
  11. package/dist/assets/{FieldLabel-z7bxzKHq.js → FieldLabel-C647EVei.js} +2 -2
  12. package/dist/assets/FilesTab-DKocgIqP.js +1 -0
  13. package/dist/assets/FilterBar-DHVMse_G.js +1 -0
  14. package/dist/assets/GroupsTab-CBVya3O8.js +1 -0
  15. package/dist/assets/InstancesTab-DaFyjZeq.js +1 -0
  16. package/dist/assets/IntegrationsTab-s2Ug2twA.js +1 -0
  17. package/dist/assets/KpiTab-Bxe5EM3h.js +1 -0
  18. package/dist/assets/PreferencesTab-D150a7hV.js +1 -0
  19. package/dist/assets/ProjectPage-BvCAGro7.js +1 -0
  20. package/dist/assets/ProjectPage-LzMKBi2V.css +1 -0
  21. package/dist/assets/PromptInjectionsTab-DcP-BjeV.js +4 -0
  22. package/dist/assets/RolesTab-DgNPzDM1.js +1 -0
  23. package/dist/assets/ScheduledTab-xwd7u-vS.js +1 -0
  24. package/dist/assets/ServiceAccountsTab-BPH6depc.js +1 -0
  25. package/dist/assets/SubAgentReportsTab-BPYm-SSC.js +1 -0
  26. package/dist/assets/ThemeShowroom-DfNiNZX7.js +1 -0
  27. package/dist/assets/TimeRangePicker-Dtw6LWMh.js +1 -0
  28. package/dist/assets/TracesTab-yLnuqGC_.js +1 -0
  29. package/dist/assets/UsersTab-CopN-6p5.js +1 -0
  30. package/dist/assets/VoiceTab-C0oik6ML.js +1 -0
  31. package/dist/assets/{button-BtQwDeC7.js → button-Bz9USCnz.js} +1 -1
  32. package/dist/assets/{card-BbBjwTkQ.js → card-DKADL750.js} +1 -1
  33. package/dist/assets/check-Wm4Ks3tL.js +1 -0
  34. package/dist/assets/chevron-up-BFinjgRw.js +1 -0
  35. package/dist/assets/chevrons-up-down-DKu9IjDi.js +1 -0
  36. package/dist/assets/{compatView-BvZyYwOM.js → compatView-BHdx-XYA.js} +1 -1
  37. package/dist/assets/{dispatchErrorInfo-CjAxcZ1X.js → dispatchErrorInfo-oI5p4wEL.js} +1 -1
  38. package/dist/assets/dist-DiGkpPjG.js +1 -0
  39. package/dist/assets/dist-_9JGogtQ.js +44 -0
  40. package/dist/assets/{dist-CHUv7VZU.js → dist-xYoBFyN7.js} +1 -1
  41. package/dist/assets/{highlighted-body-OFNGDK62-D3YWtB-x.js → highlighted-body-OFNGDK62-DSCsm23K.js} +1 -1
  42. package/dist/assets/index-CjUx3yzx.css +1 -0
  43. package/dist/assets/index-DIc5ekpE.js +238 -0
  44. package/dist/assets/mermaid-GHXKKRXX-BsmnBvV3.js +1 -0
  45. package/dist/assets/{pdf-BAfFGrd0.js → pdf-D0Fddibm.js} +1 -1
  46. package/dist/assets/roleDescriptions-5AP7N2O_.js +1 -0
  47. package/dist/assets/{table-C9PafBK9.js → table-C8QBboJq.js} +1 -1
  48. package/dist/assets/{tabs-CQ2rDwF5.js → tabs-DSFq9Jhc.js} +1 -1
  49. package/dist/assets/x-CfJhGjMr.js +1 -0
  50. package/dist/index.html +9 -8
  51. package/package.json +1 -1
  52. package/dist/assets/AccessTab-C0DMrq_T.js +0 -1
  53. package/dist/assets/AdvancedFilter-CjfYhQlT.js +0 -1
  54. package/dist/assets/AgentFilesTab-Vt7ogGL4.js +0 -3
  55. package/dist/assets/AnomaliesTab-Bl8B8nuQ.js +0 -1
  56. package/dist/assets/AuditTab-Jv3VbFgH.js +0 -1
  57. package/dist/assets/BridgeTab-BURazhGl.js +0 -1
  58. package/dist/assets/ChatDefaultsTab-A2iJG8ZL.js +0 -1
  59. package/dist/assets/DataTableShell-zzaGmfMk.js +0 -1
  60. package/dist/assets/DetailChips-DNNrvZqq.js +0 -1
  61. package/dist/assets/FeedbacksTab-ChZeDaM6.js +0 -1
  62. package/dist/assets/FilesTab-jc4m4WW7.js +0 -1
  63. package/dist/assets/FilterBar-DRRfKRTQ.js +0 -1
  64. package/dist/assets/GroupsTab-HTPhJMAF.js +0 -1
  65. package/dist/assets/InstancesTab-DUwMvn_C.js +0 -1
  66. package/dist/assets/IntegrationsTab-2PvwRR8s.js +0 -1
  67. package/dist/assets/KpiTab-D4aTV56S.js +0 -1
  68. package/dist/assets/PreferencesTab-LYojtSoz.js +0 -1
  69. package/dist/assets/PromptInjectionsTab-DN8RscNv.js +0 -4
  70. package/dist/assets/RolesTab-BexLEI7q.js +0 -1
  71. package/dist/assets/ScheduledTab-Cm1PSyqy.js +0 -1
  72. package/dist/assets/ServiceAccountsTab-Krm3IzaJ.js +0 -1
  73. package/dist/assets/SubAgentReportsTab-DJNmIHbP.js +0 -1
  74. package/dist/assets/ThemeShowroom-CN7-gPFJ.js +0 -1
  75. package/dist/assets/TimeRangePicker-BPVkrNZN.js +0 -1
  76. package/dist/assets/TracesTab-BTN0YBPo.js +0 -1
  77. package/dist/assets/UsersTab-CclKbkrB.js +0 -1
  78. package/dist/assets/VoiceTab-DS6LrGiz.js +0 -1
  79. package/dist/assets/chevrons-up-down-ImFHIr_N.js +0 -1
  80. package/dist/assets/dist-BCNlHm__.js +0 -1
  81. package/dist/assets/dist-CNZ9o3sc.js +0 -44
  82. package/dist/assets/dist-VGy3W8j2.js +0 -1
  83. package/dist/assets/index-9R1hg_pA.js +0 -238
  84. package/dist/assets/index-jScX6cAP.css +0 -2
  85. package/dist/assets/mermaid-GHXKKRXX-DM0jE2ZW.js +0 -1
  86. package/dist/assets/roleDescriptions-DGSYA21e.js +0 -1
  87. package/dist/assets/x-BR1chqO3.js +0 -1
@@ -0,0 +1 @@
1
+ import{$x as e,Qx as t,Xx as n,Yx as r,Zx as i}from"./dist-_9JGogtQ.js";var a={pending:e,user:t,admin:i,observer:n,agent:r};function o(e){if(e.builtin){let t=a[e.key];if(t)return t()}return e.description}export{o as t};
@@ -1 +1 @@
1
- import{a as e,r as t}from"./bundle-mjs-C73ZY4La.js";import{E as n}from"./dist-CNZ9o3sc.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{E as n}from"./dist-_9JGogtQ.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{E as r,_ as i,d as a,l as o,m as s,t as c,u as l,v as u}from"./dist-CNZ9o3sc.js";import{t as d}from"./dist-VGy3W8j2.js";import{Ct as f,St as p,xt as m}from"./index-9R1hg_pA.js";var h=t(e(),1),g=n(),_=`Tabs`,[v,y]=s(_,[f]),b=f(),[x,S]=v(_),C=h.forwardRef((e,t)=>{let{__scopeTabs:n,value:r,onValueChange:i,defaultValue:s,orientation:c=`horizontal`,dir:l,activationMode:f=`automatic`,...p}=e,m=d(l),[h,v]=a({prop:r,onChange:i,defaultProp:s??``,caller:_});return(0,g.jsx)(x,{scope:n,baseId:o(),value:h,onValueChange:v,orientation:c,dir:m,activationMode:f,children:(0,g.jsx)(u.div,{dir:m,"data-orientation":c,...p,ref:t})})});C.displayName=_;var w=`TabsList`,T=h.forwardRef((e,t)=>{let{__scopeTabs:n,loop:r=!0,...i}=e,a=S(w,n),o=b(n);return(0,g.jsx)(p,{asChild:!0,...o,orientation:a.orientation,dir:a.dir,loop:r,children:(0,g.jsx)(u.div,{role:`tablist`,"aria-orientation":a.orientation,...i,ref:t})})});T.displayName=w;var E=`TabsTrigger`,D=h.forwardRef((e,t)=>{let{__scopeTabs:n,value:r,disabled:a=!1,...o}=e,s=S(E,n),c=b(n),l=A(s.baseId,r),d=j(s.baseId,r),f=r===s.value;return(0,g.jsx)(m,{asChild:!0,...c,focusable:!a,active:f,children:(0,g.jsx)(u.button,{type:`button`,role:`tab`,"aria-selected":f,"aria-controls":d,"data-state":f?`active`:`inactive`,"data-disabled":a?``:void 0,disabled:a,id:l,...o,ref:t,onMouseDown:i(e.onMouseDown,e=>{!a&&e.button===0&&e.ctrlKey===!1?s.onValueChange(r):e.preventDefault()}),onKeyDown:i(e.onKeyDown,e=>{[` `,`Enter`].includes(e.key)&&s.onValueChange(r)}),onFocus:i(e.onFocus,()=>{let e=s.activationMode!==`manual`;!f&&!a&&e&&s.onValueChange(r)})})})});D.displayName=E;var O=`TabsContent`,k=h.forwardRef((e,t)=>{let{__scopeTabs:n,value:r,forceMount:i,children:a,...o}=e,s=S(O,n),c=A(s.baseId,r),d=j(s.baseId,r),f=r===s.value,p=h.useRef(f);return h.useEffect(()=>{let e=requestAnimationFrame(()=>p.current=!1);return()=>cancelAnimationFrame(e)},[]),(0,g.jsx)(l,{present:i||f,children:({present:n})=>(0,g.jsx)(u.div,{"data-state":f?`active`:`inactive`,"data-orientation":s.orientation,role:`tabpanel`,"aria-labelledby":c,hidden:!n,id:d,tabIndex:0,...o,ref:t,style:{...e.style,animationDuration:p.current?`0s`:void 0},children:n&&a})})});k.displayName=O;function A(e,t){return`${e}-trigger-${t}`}function j(e,t){return`${e}-content-${t}`}var M=C,N=T,P=D,F=k;function I({className:e,orientation:t=`horizontal`,...n}){return(0,g.jsx)(M,{"data-slot":`tabs`,"data-orientation":t,className:r(`group/tabs flex gap-2 data-horizontal:flex-col`,e),...n})}var L=c(`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:r(L({variant:t}),e),...n})}function z({className:e,...t}){return(0,g.jsx)(P,{"data-slot":`tabs-trigger`,className:r(`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:r(`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{E as r,_ as i,d as a,l as o,m as s,t as c,u as l,v as u}from"./dist-_9JGogtQ.js";import{t as d}from"./dist-DiGkpPjG.js";import{Gt as f,Kt as p,Wt as m}from"./index-DIc5ekpE.js";var h=t(e(),1),g=n(),_=`Tabs`,[v,y]=s(_,[p]),b=p(),[x,S]=v(_),C=h.forwardRef((e,t)=>{let{__scopeTabs:n,value:r,onValueChange:i,defaultValue:s,orientation:c=`horizontal`,dir:l,activationMode:f=`automatic`,...p}=e,m=d(l),[h,v]=a({prop:r,onChange:i,defaultProp:s??``,caller:_});return(0,g.jsx)(x,{scope:n,baseId:o(),value:h,onValueChange:v,orientation:c,dir:m,activationMode:f,children:(0,g.jsx)(u.div,{dir:m,"data-orientation":c,...p,ref:t})})});C.displayName=_;var w=`TabsList`,T=h.forwardRef((e,t)=>{let{__scopeTabs:n,loop:r=!0,...i}=e,a=S(w,n),o=b(n);return(0,g.jsx)(f,{asChild:!0,...o,orientation:a.orientation,dir:a.dir,loop:r,children:(0,g.jsx)(u.div,{role:`tablist`,"aria-orientation":a.orientation,...i,ref:t})})});T.displayName=w;var E=`TabsTrigger`,D=h.forwardRef((e,t)=>{let{__scopeTabs:n,value:r,disabled:a=!1,...o}=e,s=S(E,n),c=b(n),l=A(s.baseId,r),d=j(s.baseId,r),f=r===s.value;return(0,g.jsx)(m,{asChild:!0,...c,focusable:!a,active:f,children:(0,g.jsx)(u.button,{type:`button`,role:`tab`,"aria-selected":f,"aria-controls":d,"data-state":f?`active`:`inactive`,"data-disabled":a?``:void 0,disabled:a,id:l,...o,ref:t,onMouseDown:i(e.onMouseDown,e=>{!a&&e.button===0&&e.ctrlKey===!1?s.onValueChange(r):e.preventDefault()}),onKeyDown:i(e.onKeyDown,e=>{[` `,`Enter`].includes(e.key)&&s.onValueChange(r)}),onFocus:i(e.onFocus,()=>{let e=s.activationMode!==`manual`;!f&&!a&&e&&s.onValueChange(r)})})})});D.displayName=E;var O=`TabsContent`,k=h.forwardRef((e,t)=>{let{__scopeTabs:n,value:r,forceMount:i,children:a,...o}=e,s=S(O,n),c=A(s.baseId,r),d=j(s.baseId,r),f=r===s.value,p=h.useRef(f);return h.useEffect(()=>{let e=requestAnimationFrame(()=>p.current=!1);return()=>cancelAnimationFrame(e)},[]),(0,g.jsx)(l,{present:i||f,children:({present:n})=>(0,g.jsx)(u.div,{"data-state":f?`active`:`inactive`,"data-orientation":s.orientation,role:`tabpanel`,"aria-labelledby":c,hidden:!n,id:d,tabIndex:0,...o,ref:t,style:{...e.style,animationDuration:p.current?`0s`:void 0},children:n&&a})})});k.displayName=O;function A(e,t){return`${e}-trigger-${t}`}function j(e,t){return`${e}-content-${t}`}var M=C,N=T,P=D,F=k;function I({className:e,orientation:t=`horizontal`,...n}){return(0,g.jsx)(M,{"data-slot":`tabs`,"data-orientation":t,className:r(`group/tabs flex gap-2 data-horizontal:flex-col`,e),...n})}var L=c(`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:r(L({variant:t}),e),...n})}function z({className:e,...t}){return(0,g.jsx)(P,{"data-slot":`tabs-trigger`,className:r(`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:r(`flex-1 text-sm outline-none`,e),...t})}export{z as i,B as n,R as r,I as t};
@@ -0,0 +1 @@
1
+ import{D as e}from"./dist-_9JGogtQ.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
@@ -62,15 +62,16 @@
62
62
  document.documentElement.dataset.motion = "static";
63
63
  })();
64
64
  </script>
65
- <script type="module" crossorigin src="/assets/index-9R1hg_pA.js"></script>
65
+ <script type="module" crossorigin src="/assets/index-DIc5ekpE.js"></script>
66
66
  <link rel="modulepreload" crossorigin href="/assets/bundle-mjs-C73ZY4La.js">
67
- <link rel="modulepreload" crossorigin href="/assets/dist-CNZ9o3sc.js">
68
- <link rel="modulepreload" crossorigin href="/assets/dist-VGy3W8j2.js">
69
- <link rel="modulepreload" crossorigin href="/assets/dist-CHUv7VZU.js">
70
- <link rel="modulepreload" crossorigin href="/assets/dist-BCNlHm__.js">
71
- <link rel="modulepreload" crossorigin href="/assets/x-BR1chqO3.js">
72
- <link rel="modulepreload" crossorigin href="/assets/button-BtQwDeC7.js">
73
- <link rel="stylesheet" crossorigin href="/assets/index-jScX6cAP.css">
67
+ <link rel="modulepreload" crossorigin href="/assets/dist-_9JGogtQ.js">
68
+ <link rel="modulepreload" crossorigin href="/assets/dist-DiGkpPjG.js">
69
+ <link rel="modulepreload" crossorigin href="/assets/dist-xYoBFyN7.js">
70
+ <link rel="modulepreload" crossorigin href="/assets/check-Wm4Ks3tL.js">
71
+ <link rel="modulepreload" crossorigin href="/assets/chevron-up-BFinjgRw.js">
72
+ <link rel="modulepreload" crossorigin href="/assets/x-CfJhGjMr.js">
73
+ <link rel="modulepreload" crossorigin href="/assets/button-Bz9USCnz.js">
74
+ <link rel="stylesheet" crossorigin href="/assets/index-CjUx3yzx.css">
74
75
  </head>
75
76
  <body>
76
77
  <div id="root"></div>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lacneu/atrium",
3
- "version": "0.62.2",
3
+ "version": "0.63.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{Af as r,Cf as i,Df as a,Ef as o,Ff as s,JF as c,Mf as l,Nf as u,Of as d,Pf as f,Sf as p,T as m,Tf as h,jf as g,kf as _,rI as v,wf as y,xf as b}from"./dist-CNZ9o3sc.js";import{Y as x,ct as S,lt as C,ot as w,st as T,ut as E}from"./index-9R1hg_pA.js";var D=t(e(),1);function O(e){return e===`user`?h():e===`all`?y():i({group:e.group})}function k(e){return e===`common`?p():e===`owner`?b():i({group:e.group})}var A=n();function j(e){return e.name||e.email||e.userId.slice(0,8)}function M(){let e=v(m.admin.listUsers,{}),[t,n]=(0,D.useState)(``),i=v(m.introspect.introspectUser,t?{userId:t}:`skip`);return(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:s()}),(0,A.jsxs)(w,{value:t,onValueChange:n,children:[(0,A.jsx)(C,{size:`sm`,"aria-label":f(),children:(0,A.jsx)(E,{placeholder:f()})}),(0,A.jsx)(T,{children:(e??[]).map(e=>(0,A.jsx)(S,{value:e.userId,children:j(e)},e._id))})]}),t===``?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:u()}):i===void 0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:c()}):(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:l()}),(0,A.jsxs)(`div`,{className:`oc-introspect__id`,children:[(0,A.jsx)(`strong`,{children:i.user.label}),(0,A.jsx)(x,{variant:`secondary`,children:i.role})]})]}),(0,A.jsxs)(`section`,{className:`oc-introspect__section`,children:[(0,A.jsx)(`h3`,{className:`oc-introspect__title`,children:g()}),i.groups.length===0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:a()}):(0,A.jsx)(`div`,{className:`oc-introspect__chips`,children:i.groups.map(e=>(0,A.jsx)(x,{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:r()}),i.agents.length===0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:a()}):(0,A.jsx)(`ul`,{className:`oc-introspect__list`,children:i.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)(x,{variant:`default`,children:o()}):null,(0,A.jsx)(x,{variant:`outline`,children:O(e.via)}),(0,A.jsx)(x,{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:_()}),i.charts.length===0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:a()}):(0,A.jsx)(`ul`,{className:`oc-introspect__list`,children:i.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)(x,{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:d()}),i.permissions.length===0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:a()}):(0,A.jsx)(`div`,{className:`oc-introspect__chips`,children:i.permissions.map(e=>(0,A.jsx)(x,{variant:`secondary`,children:e},e))})]})]})]})}export{M as AccessTab};
@@ -1 +0,0 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Gm as r,Hm as i,Jm as a,Km as o,Um as s,Wm as c,qm as l}from"./dist-CNZ9o3sc.js";import{i as u}from"./dist-VGy3W8j2.js";import{t as d}from"./x-BR1chqO3.js";import{t as f}from"./button-BtQwDeC7.js";import{Bt as p,X as m,ct as h,lt as g,ot as _,st as v,ut as y}from"./index-9R1hg_pA.js";import{r as b}from"./TimeRangePicker-BPVkrNZN.js";var x=t(e(),1),S=n(),C=[{value:`eq`,label:`=`},{value:`neq`,label:`≠`},{value:`contains`,label:a()},{value:`gt`,label:`>`},{value:`gte`,label:`≥`},{value:`lt`,label:`<`},{value:`lte`,label:`≤`}],w=1;function T(){return{id:w++,field:``,op:`eq`,value:``}}function E(e){return e.map(e=>({id:w++,field:e.field,op:e.op,value:String(e.value)}))}function D({fields:e,seed:t,onChange:n}){let a=(0,x.useRef)(t),w=!!(a.current&&a.current.length>0),[D,O]=(0,x.useState)(w),[k,A]=(0,x.useState)(()=>w?E(a.current):[]);function j(e){n(e.filter(e=>e.field!==``&&e.value!==``).map(e=>({field:e.field,op:e.op,value:b(e.value)})))}function M(e,t){let n=k.map(n=>n.id===e?{...n,...t}:n);A(n),j(n)}function N(){A(e=>[...e,T()])}function P(e){let t=k.filter(t=>t.id!==e);A(t),j(t)}let F=k.filter(e=>e.field!==``&&e.value!==``).length;return(0,S.jsxs)(`div`,{className:`oc-advfilter`,children:[(0,S.jsxs)(`button`,{type:`button`,className:`oc-advfilter__toggle`,"aria-expanded":D,onClick:()=>O(e=>!e),children:[(0,S.jsx)(u,{className:`oc-advfilter__chevron`+(D?` is-open`:``),"aria-hidden":!0}),l(),F>0?(0,S.jsx)(`span`,{className:`oc-advfilter__count`,children:F}):null]}),D?(0,S.jsxs)(`div`,{className:`oc-advfilter__body`,children:[k.length===0?(0,S.jsx)(`p`,{className:`oc-admin__hint`,children:o()}):(0,S.jsx)(`ul`,{className:`oc-advfilter__rows`,children:k.map(t=>(0,S.jsxs)(`li`,{className:`oc-advfilter__row`,children:[(0,S.jsxs)(_,{value:t.field||void 0,onValueChange:e=>M(t.id,{field:e}),children:[(0,S.jsx)(g,{size:`sm`,className:`w-40`,children:(0,S.jsx)(y,{placeholder:r()})}),(0,S.jsx)(v,{children:e.map(e=>(0,S.jsx)(h,{value:e.value,children:e.label},e.value))})]}),(0,S.jsxs)(_,{value:t.op,onValueChange:e=>M(t.id,{op:e}),children:[(0,S.jsx)(g,{size:`sm`,className:`w-28`,children:(0,S.jsx)(y,{})}),(0,S.jsx)(v,{children:C.map(e=>(0,S.jsx)(h,{value:e.value,children:e.label},e.value))})]}),(0,S.jsx)(m,{className:`oc-advfilter__value`,value:t.value,onChange:e=>M(t.id,{value:e.target.value}),placeholder:c()}),(0,S.jsx)(f,{variant:`ghost`,size:`icon-sm`,"aria-label":s(),onClick:()=>P(t.id),children:(0,S.jsx)(d,{})})]},t.id))}),(0,S.jsxs)(f,{variant:`outline`,size:`sm`,className:`oc-advfilter__add`,onClick:N,children:[(0,S.jsx)(p,{}),i()]})]}):null]})}export{D as t};
@@ -1,3 +0,0 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$i as r,$l as i,$u as a,Bi as o,Gl as s,Hi as c,Hl as l,JF as u,Jl as d,Kl as f,Qi as p,Ql as m,Ri as h,T as g,Ui as _,Ul as v,Vi as y,Vl as b,Wi as x,Wl as S,XF as ee,Xl as C,Yl as w,Zi as T,Zl as E,Zu as D,_a as O,aa as k,au as te,ca as A,cu as j,da as M,du as N,eI as P,ea as F,eu as I,fa as L,fu as ne,ga as R,gu as z,ha as B,hu as re,ia as V,iu as ie,kO as H,la as U,lu as W,ma as ae,mu as oe,nI as se,na as ce,nu as le,oa as ue,ou as de,pa as fe,pu as pe,ql as me,rI as G,ra as he,ru as ge,sa as _e,su as ve,ta as ye,tu as be,ua as xe,uu as Se,zi as Ce}from"./dist-CNZ9o3sc.js";import{t as K}from"./button-BtQwDeC7.js";import{$ as we,F as Te,I as Ee,L as De,M as Oe,N as ke,P as Ae,Pt as q,Q as je,R as Me,Y as Ne,Z as Pe,b as Fe,ct as Ie,gt as Le,lt as Re,nt as ze,ot as Be,st as Ve,tt as He,ut as Ue,wt as J,z as We}from"./index-9R1hg_pA.js";import{n as Ge,t as Ke}from"./curation-CQksaIbm.js";import{i as qe}from"./compatView-BvZyYwOM.js";/* empty css */var Y=t(e(),1),X=2e4,Je=6e4;function Ye(e){return typeof e!=`number`||e<=0?0:Math.round(e/X*100)}function Xe(e){return e<=0?0:Math.round(e/Je*100)}function Z(e,t){let n=(typeof e==`number`&&e>0?e:0)/1e3;return new Intl.NumberFormat(t,{minimumFractionDigits:1,maximumFractionDigits:1}).format(n)}function Ze(e){return e.reduce((e,t)=>e+(typeof t.size==`number`&&t.size>0?t.size:0),0)}var Qe=3;function $e(e,t){let n=new Map;for(let t of e.split(`
2
- `))n.set(t,(n.get(t)??0)+1);for(let e of t.split(`
3
- `))n.set(e,(n.get(e)??0)-1);let r=0,i=0,a=[],o=[];for(let[e,t]of n)t<0?(r+=-t,a.length<Qe&&a.push(e)):t>0&&(i+=t,o.length<Qe&&o.push(e));return{added:r,removed:i,sampleAdded:a,sampleRemoved:o}}function et(e){return e instanceof Error?e.message.includes(`conflict:`):String(e).includes(`conflict:`)}var Q=n(),$=e=>`${e.instanceName}::${e.agentId}`;function tt(){let e=G(g.me.getMe,{host:Le}),t=e?.role===`admin`,n=(e?.permissions??[]).includes(`bridge.read`),r=G(g.admin.listInstances,e!==void 0&&t?{}:`skip`),[i,a]=(0,Y.useState)(null);(0,Y.useEffect)(()=>{!t||!r||r.length===0||(!i||!r.some(e=>e.name===i))&&a(r[0].name)},[t,r,i]);let o=G(g.agents.listAgentsForInstance,t&&i?{instanceName:i}:`skip`),s=G(g.agents.listMyAgents,e!==void 0&&!t?{}:`skip`),c=(0,Y.useMemo)(()=>{if(e!==void 0){if(t)return i===null||o===void 0?r!==void 0&&r.length===0?[]:void 0:o.agents.map(e=>({instanceName:i,agentId:e.agentId,label:`${e.emoji?`${e.emoji} `:``}${e.displayName??e.agentId}`}));if(s!==void 0)return s.map(e=>({instanceName:e.instanceName,agentId:e.agentId,label:`${e.emoji?`${e.emoji} `:``}${e.displayName??e.agentId}`}))}},[e,t,i,o,r,s]),[l,d]=(0,Y.useState)(null);(0,Y.useEffect)(()=>{!c||c.length===0||(!l||!c.some(e=>$(e)===l))&&d($(c[0]))},[c,l]);let f=c?.find(e=>$(e)===l)??null,p=P(g.agentFiles.listAgentFiles),[m,h]=(0,Y.useState)({status:`idle`}),_=f?.instanceName??null,v=f?.agentId??null,y=G(g.compat.forInstance,n&&_!==null?{instanceName:_}:`skip`),b=n&&_!==null?Fe(y,`agentFiles`):null,x=b===null?!1:b===`loading`?null:b.blocked,S=(0,Y.useCallback)(async()=>{if(!(_===null||v===null)){h({status:`loading`});try{h({status:`done`,files:(await p({instanceName:_,agentId:v})).files})}catch{h({status:`error`})}}},[p,_,v]);(0,Y.useEffect)(()=>{x===!1&&S()},[S,x]);let[C,w]=(0,Y.useState)(null),T=G(g.agentFileCuration.listCurations,t&&_!==null&&v!==null?{instanceName:_,agentId:v}:`skip`),E=G(g.agentFileCuration.curationSettings,t&&_!==null?{instanceName:_}:`skip`),O=P(g.agentFileCuration.requestCuration),[k,A]=(0,Y.useState)(null),[M,F]=(0,Y.useState)(null),{toast:I}=J(),R=(0,Y.useMemo)(()=>{let e=new Map;for(let t of T??[])e.has(t.name)||e.set(t.name,t);return e},[T]),B=(0,Y.useCallback)(async e=>{if(!(_===null||v===null)){A(e);try{let t=await O({instanceName:_,agentId:v,name:e,trigger:`manual`});t.ok?I({title:ae(),variant:`success`}):I({title:fe({reason:t.reason??`unknown`}),variant:`error`})}catch{I({title:L(),variant:`error`})}finally{A(null)}}},[O,_,v,I]),V=ee(),H=(0,Y.useMemo)(()=>new Intl.NumberFormat(V,{maximumFractionDigits:0}),[V]);return e===void 0||c===void 0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:u()}):(0,Q.jsxs)(`div`,{className:`oc-afiles`,children:[(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:z()}),(0,Q.jsxs)(`div`,{className:`oc-afiles__picker`,children:[t&&(r?.length??0)>1?(0,Q.jsxs)(Be,{value:i??``,onValueChange:e=>a(e),children:[(0,Q.jsx)(Re,{size:`sm`,"aria-label":re(),children:(0,Q.jsx)(Ue,{})}),(0,Q.jsx)(Ve,{children:(r??[]).map(e=>(0,Q.jsx)(Ie,{value:e.name,children:e.name},e.name))})]}):null,c.length>0?(0,Q.jsxs)(Be,{value:l??``,onValueChange:e=>d(e),children:[(0,Q.jsx)(Re,{size:`sm`,"aria-label":oe(),children:(0,Q.jsx)(Ue,{})}),(0,Q.jsx)(Ve,{children:c.map(e=>(0,Q.jsx)(Ie,{value:$(e),children:e.label},$(e)))})]}):(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:pe()})]}),f===null?null:b===`loading`?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:u()}):b!==null&&b.blocked?(0,Q.jsxs)(`p`,{className:`oc-compat__blocked`,role:`status`,children:[(0,Q.jsx)(q,{size:14,"aria-hidden":!0}),` `,qe(b.gatewayVersion,b.provider)]}):m.status===`loading`||m.status===`idle`?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:u()}):m.status===`error`?(0,Q.jsxs)(`p`,{className:`oc-afiles__error`,role:`alert`,children:[N(),` `,(0,Q.jsx)(K,{variant:`outline`,size:`sm`,onClick:()=>void S(),children:D()})]}):m.files.length===0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:ne()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`div`,{className:`oc-afiles__list`,children:m.files.map(e=>{let n=Ye(e.size),r=n>=80;return(0,Q.jsxs)(`div`,{className:`oc-afiles__row`,children:[(0,Q.jsx)(`span`,{className:`oc-afiles__name`,title:e.name,children:e.name}),e.missing?(0,Q.jsx)(Ne,{variant:`outline`,children:Se()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`span`,{className:`oc-afiles__size`,children:W({size:Z(e.size,V)})}),(0,Q.jsx)(`span`,{className:`oc-afiles__gauge${r?` is-warn`:``}`,"aria-hidden":!0,children:(0,Q.jsx)(`span`,{className:`oc-afiles__gauge-fill`,style:{width:`${Math.min(n,100)}%`}})}),(0,Q.jsx)(`span`,{className:`oc-afiles__pct`,children:j({pct:H.format(n)})}),r?(0,Q.jsx)(q,{size:14,className:`oc-afiles__warn`,"aria-label":ve()}):(0,Q.jsx)(`span`,{className:`oc-afiles__warn-slot`,"aria-hidden":!0})]}),(0,Q.jsx)(K,{variant:`outline`,size:`sm`,className:`oc-afiles__open`,onClick:()=>w(e),children:t?te():ie()}),t&&!e.missing?(0,Q.jsx)(nt,{curatable:Ke.includes(e.name),size:e.size??0,budget:E?.budgetChars??null,enabled:E?.enabled??!1,curation:R.get(e.name)??null,inFlight:k===e.name,onCurate:()=>void B(e.name),onReview:e=>F(e)}):null]},e.name)})}),(0,Q.jsx)(`p`,{className:`oc-afiles__budget`,children:de({used:Z(Ze(m.files),V),total:Z(Je,V),pct:H.format(Xe(Ze(m.files)))})})]}),C&&f?(0,Q.jsx)(rt,{instanceName:f.instanceName,agentId:f.agentId,name:C.name,isAdmin:t,onClose:()=>w(null),onSaved:()=>void S()}):null,M?(0,Q.jsx)(it,{curationId:M,onClose:()=>F(null),onApplied:()=>{F(null),S()}}):null]})}function nt({curatable:e,size:t,budget:n,enabled:r,curation:i,inFlight:a,onCurate:o,onReview:s}){return i?.status===`proposed`?(0,Q.jsx)(K,{variant:`default`,size:`sm`,className:`oc-afiles__curate`,onClick:()=>s(i._id),children:R()}):a||i?.status===`dispatched`||i?.status===`applying`?(0,Q.jsx)(Ne,{variant:`outline`,className:`oc-afiles__curate-status`,children:B()}):e&&r&&n!==null&&Ge(t,n)?(0,Q.jsx)(K,{variant:`outline`,size:`sm`,className:`oc-afiles__curate`,onClick:o,children:O()}):null}function rt({instanceName:e,agentId:t,name:n,isAdmin:r,onClose:o,onSaved:c}){let p=P(g.agentFiles.getAgentFile),h=P(g.agentFiles.setAgentFile),_=J(),[y,x]=(0,Y.useState)(null),[T,O]=(0,Y.useState)(!1),[k,te]=(0,Y.useState)(``),[A,j]=(0,Y.useState)(!1),[M,N]=(0,Y.useState)(!1),[F,L]=(0,Y.useState)(!1),[ne,R]=(0,Y.useState)(!1),z=(0,Y.useCallback)(async r=>{O(!1);try{let i=await p({instanceName:e,agentId:t,name:n});x({content:i.content,updatedAtMs:i.updatedAtMs}),r||te(i.content),L(!1)}catch{O(!0)}},[p,e,t,n]);(0,Y.useEffect)(()=>{z(!1)},[z]);async function B(){if(y!==null){N(!0),R(!1);try{await h({instanceName:e,agentId:t,name:n,content:k,baseUpdatedAtMs:y.updatedAtMs??void 0}),_.success(E({name:n})),c(),await z(!1)}catch(e){et(e)?L(!0):R(!0)}finally{N(!1)}}}let re=y!==null&&k!==y.content,V=(0,Y.useMemo)(()=>y===null?null:$e(y.content,k),[y,k]),ie=k.length>X,U=ee(),W=(0,Y.useMemo)(()=>new Intl.NumberFormat(U),[U]);return(0,Q.jsx)(Pe,{open:!0,onOpenChange:e=>!e&&o(),children:(0,Q.jsxs)(je,{className:`oc-afiles__editor`,children:[(0,Q.jsxs)(He,{children:[(0,Q.jsx)(ze,{children:ge({name:n})}),(0,Q.jsxs)(we,{children:[le({agent:t,instance:e}),r?null:(0,Q.jsxs)(Q.Fragment,{children:[` · `,be()]})]})]}),T?(0,Q.jsxs)(`p`,{className:`oc-afiles__error`,role:`alert`,children:[w(),` `,(0,Q.jsx)(K,{variant:`outline`,size:`sm`,onClick:()=>void z(!1),children:D()})]}):y===null?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:u()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`textarea`,{className:`oc-afiles__source`,value:k,readOnly:!r,spellCheck:!1,onChange:e=>te(e.target.value),"aria-label":ge({name:n})}),(0,Q.jsx)(`p`,{className:`oc-afiles__hint`,children:I()}),F?(0,Q.jsxs)(`p`,{className:`oc-afiles__error`,role:`alert`,children:[d(),` `,(0,Q.jsx)(K,{variant:`outline`,size:`sm`,onClick:()=>void z(!0),children:me()})]}):null,ne?(0,Q.jsx)(`p`,{className:`oc-afiles__error`,role:`alert`,children:C()}):null,(0,Q.jsxs)(`div`,{className:`oc-afiles__editor-foot`,children:[(0,Q.jsx)(`span`,{className:`oc-afiles__count${ie?` is-over`:``}`,children:i({count:W.format(k.length),max:W.format(X)})}),r?(0,Q.jsx)(K,{size:`sm`,disabled:!re||M||F,onClick:()=>j(!0),children:M?a():m()}):null]})]}),(0,Q.jsx)(Oe,{open:A,onOpenChange:j,children:(0,Q.jsxs)(Te,{children:[(0,Q.jsxs)(Me,{children:[(0,Q.jsx)(We,{children:f({name:n})}),(0,Q.jsx)(Ee,{children:s({agent:t})})]}),V?(0,Q.jsxs)(`div`,{className:`oc-afiles__diff`,children:[(0,Q.jsx)(`p`,{className:`oc-afiles__diff-counts`,children:S({added:V.added,removed:V.removed})}),V.sampleAdded.length>0?(0,Q.jsxs)(`div`,{className:`oc-afiles__diff-block`,children:[(0,Q.jsx)(`span`,{className:`oc-afiles__diff-label`,children:v()}),V.sampleAdded.map((e,t)=>(0,Q.jsx)(`code`,{className:`oc-afiles__diff-line is-add`,children:e||` `},t))]}):null,V.sampleRemoved.length>0?(0,Q.jsxs)(`div`,{className:`oc-afiles__diff-block`,children:[(0,Q.jsx)(`span`,{className:`oc-afiles__diff-label`,children:l()}),V.sampleRemoved.map((e,t)=>(0,Q.jsx)(`code`,{className:`oc-afiles__diff-line is-del`,children:e||` `},t))]}):null]}):null,(0,Q.jsxs)(De,{children:[(0,Q.jsx)(Ae,{children:H()}),(0,Q.jsx)(ke,{onClick:()=>void B(),children:b()})]})]})})]})})}function it({curationId:e,onClose:t,onApplied:n}){let i=G(g.agentFileCuration.getProposal,{curationId:e}),s=P(g.agentFileCuration.approveCuration),l=se(g.agentFileCuration.rejectCuration),{toast:d}=J(),[f,m]=(0,Y.useState)(null),[v,b]=(0,Y.useState)(!1),[S,C]=(0,Y.useState)(``),w=ee(),E=(0,Y.useMemo)(()=>i?$e(i.beforeContent,i.proposedContent):null,[i]);async function D(){m(`approve`);try{let t=await s({curationId:e});t.ok?(d({title:M(),variant:`success`}),n()):d({title:t.reason===`conflict`?U():A({reason:t.reason??`unknown`}),variant:`error`})}catch{d({title:L(),variant:`error`})}finally{m(null)}}async function O(n){m(`reject`);try{let r=S.trim();(await l({curationId:e,...r?{comment:r}:{},relaunch:n})).ok?d({title:n?Ce():xe(),variant:`success`}):d({title:k(),variant:`error`}),t()}catch{d({title:L(),variant:`error`})}finally{m(null)}}return(0,Q.jsx)(Pe,{open:!0,onOpenChange:e=>e?void 0:t(),children:(0,Q.jsxs)(je,{className:`oc-afiles__review`,children:[(0,Q.jsxs)(He,{children:[(0,Q.jsx)(ze,{children:i?_e({name:i.name}):u()}),(0,Q.jsx)(we,{children:ue()})]}),i===void 0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:u()}):i===null?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:k()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`p`,{className:`oc-afiles__review-sizes`,children:[V({before:Z(i.beforeSize,w),after:Z(i.proposedSize,w)}),i.overBudget?(0,Q.jsxs)(Q.Fragment,{children:[` `,(0,Q.jsx)(q,{size:13,"aria-hidden":!0}),` `,he()]}):null]}),E?(0,Q.jsx)(`p`,{className:`oc-afiles__review-diff`,children:ce({added:E.added,removed:E.removed})}):null,i.feedback?(0,Q.jsx)(`p`,{className:`oc-afiles__review-feedback`,children:h({feedback:i.feedback})}):null,E&&E.sampleRemoved.length>0?(0,Q.jsxs)(`div`,{className:`oc-afiles__review-removed`,children:[(0,Q.jsx)(`p`,{className:`oc-afiles__review-label`,children:T()}),(0,Q.jsx)(`ul`,{children:E.sampleRemoved.map((e,t)=>(0,Q.jsx)(`li`,{children:e||`\xA0`},t))})]}):null,(0,Q.jsxs)(`div`,{className:`oc-afiles__review-panes oc-afiles__review-panes--2`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`p`,{className:`oc-afiles__review-label`,children:p()}),(0,Q.jsx)(`pre`,{className:`oc-afiles__review-pre`,children:i.beforeContent})]}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`p`,{className:`oc-afiles__review-label`,children:ye()}),(0,Q.jsx)(`pre`,{className:`oc-afiles__review-pre`,children:i.proposedContent})]})]})]}),v?(0,Q.jsxs)(`div`,{className:`oc-afiles__reject-form`,children:[(0,Q.jsx)(`label`,{className:`oc-afiles__review-label`,htmlFor:`curation-reject-comment`,children:x()}),(0,Q.jsx)(`textarea`,{id:`curation-reject-comment`,className:`oc-afiles__reject-textarea`,rows:3,placeholder:_(),value:S,onChange:e=>C(e.target.value)}),(0,Q.jsxs)(`div`,{className:`oc-afiles__review-actions`,children:[(0,Q.jsx)(K,{variant:`ghost`,onClick:()=>b(!1),disabled:f!==null,children:c()}),(0,Q.jsx)(K,{variant:`outline`,onClick:()=>void O(!1),disabled:f!==null,children:f===`reject`?a():y()}),(0,Q.jsx)(K,{variant:`default`,onClick:()=>void O(!0),disabled:f!==null,children:f===`reject`?a():o()})]})]}):(0,Q.jsxs)(`div`,{className:`oc-afiles__review-actions`,children:[(0,Q.jsx)(K,{variant:`outline`,onClick:()=>b(!0),disabled:f!==null||i==null,children:F()}),(0,Q.jsx)(K,{variant:`default`,onClick:()=>void D(),disabled:f!==null||i==null,children:f===`approve`?a():r()})]})]})})}export{tt as AgentFilesTab};
@@ -1 +0,0 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$b as r,Ab as i,Bb as ee,Cb as a,Db as te,Eb as ne,Fb as o,Gb as re,Hb as ie,Ib as ae,Jb as oe,Kb as se,Lb as s,Mb as c,Nb as l,Ob as u,Pb as d,Qb as f,Rb as p,Sb as ce,T as m,Tb as le,Ub as ue,Vb as de,Wb as fe,Xb as pe,Yb as me,Zb as he,_b as h,bb as ge,ex as _e,fb as g,gb as _,hb as v,ix as y,jb as b,kb as ve,mb as x,nI as ye,nx as S,pb as C,qb as w,rI as T,rx as E,tx as D,vb as O,wb as k,xb as A,yb as j,zb as M}from"./dist-CNZ9o3sc.js";import{A as N,Q as P,V as be,Y as F,Z as I,ct as L,gt as xe,i as Se,in as Ce,lt as R,nt as z,o as we,ot as B,rn as V,st as H,tt as U,ut as W,wt as Te}from"./index-9R1hg_pA.js";import{n as Ee}from"./TimeRangePicker-BPVkrNZN.js";import{t as De}from"./FilterBar-DRRfKRTQ.js";import{t as Oe}from"./DataTableShell-zzaGmfMk.js";import{t as G}from"./dispatchErrorInfo-CjAxcZ1X.js";var K=t(e(),1),q=n(),J=`__all__`,ke=[{value:`open`},{value:`acknowledged`},{value:`resolved`}];function Ae(e){return e===`open`?y():e===`acknowledged`?E():S()}var je=[`info`,`warn`,`critical`],Me=[`detector`,`agent`,`user`],Ne={kind:`relative`,from:`now-30d`,to:`now`},Pe=200,Y=`all`;function X(){let e=Ce({from:`/settings/anomalies`}),t=V({from:`/settings/anomalies`}),n=e.q??``,h=e.status===Y?J:e.status,g=e.severity??J,_=e.kind??J,[v,y]=(0,K.useState)(J),x=Se(e.from,e.to),{from:S,to:C}=Ee(x),E=e=>void t({search:t=>({...t,q:e||void 0}),replace:!0}),O=e=>void t({search:t=>({...t,status:e===J?Y:e})}),j=e=>void t({search:t=>({...t,severity:e===J?void 0:e})}),P=e=>void t({search:t=>({...t,kind:e===J?void 0:e})}),I=e=>void t({search:t=>({...t,...we(e)})}),z=N(),U=Te(),G=ye(m.anomalies.resolveAnomaly),X=(T(m.me.getMe,{host:xe})?.permissions??[]).includes(`admin.manage`),Z=T(m.anomalies.listAnomalies,{limit:Pe,filter:{q:n||void 0,from:S,to:C,anomalyStatus:h===J?void 0:h,severity:g===J?void 0:g,source:v===J?void 0:v,kind:_===J?void 0:_}}),Q=(0,K.useMemo)(()=>{let e=new Set;for(let t of Z??[])e.add(t.kind);return[...e].sort()},[Z]),ze=n!==``||h!==`open`||g!==J||v!==J||_!==J||x.kind!==`relative`||x.from!==Ne.from;function Be(){y(J),t({search:{status:`open`},replace:!0})}async function Ve(e){if(await z({title:D(),description:(0,q.jsxs)(q.Fragment,{children:[_e(),` `,(0,q.jsx)(`span`,{className:`font-mono`,children:e.kind}),` `,r(),` `,(0,q.jsx)(`strong`,{children:f()}),`.`,` `,he()]}),confirmLabel:pe()}))try{await G({anomalyId:e._id,status:`resolved`}),U.success(me(),e.kind)}catch(e){U.error(oe(),e)}}async function He(e){try{await G({anomalyId:e._id,status:`acknowledged`}),U.success(w(),e.kind)}catch(e){U.error(se(),e)}}return(0,q.jsxs)(q.Fragment,{children:[(0,q.jsxs)(`p`,{className:`oc-admin__hint`,children:[re(),` `,(0,q.jsx)(`strong`,{children:fe()}),` `,ue(),` `,(0,q.jsx)(`strong`,{children:ie()}),` `,de(),` `,(0,q.jsx)(`strong`,{children:ee()}),` `,M(),` `,(0,q.jsx)(`span`,{className:`oc-filter__window`,children:p()})]}),(0,q.jsxs)(De,{q:n,onQChange:E,searchPlaceholder:s(),timeRange:x,onTimeRangeChange:I,onReset:Be,canReset:ze,children:[(0,q.jsxs)(B,{value:h,onValueChange:O,children:[(0,q.jsx)(R,{size:`sm`,className:`w-36`,children:(0,q.jsx)(W,{})}),(0,q.jsxs)(H,{children:[(0,q.jsx)(L,{value:J,children:ae()}),ke.map(e=>(0,q.jsx)(L,{value:e.value,children:Ae(e.value)},e.value))]})]}),(0,q.jsxs)(B,{value:g,onValueChange:j,children:[(0,q.jsx)(R,{size:`sm`,className:`w-36`,children:(0,q.jsx)(W,{placeholder:o()})}),(0,q.jsxs)(H,{children:[(0,q.jsx)(L,{value:J,children:d()}),je.map(e=>(0,q.jsx)(L,{value:e,children:e},e))]})]}),(0,q.jsxs)(B,{value:v,onValueChange:y,children:[(0,q.jsx)(R,{size:`sm`,className:`w-32`,children:(0,q.jsx)(W,{placeholder:l()})}),(0,q.jsxs)(H,{children:[(0,q.jsx)(L,{value:J,children:c()}),Me.map(e=>(0,q.jsx)(L,{value:e,children:e},e))]})]}),(0,q.jsxs)(B,{value:_,onValueChange:P,children:[(0,q.jsx)(R,{size:`sm`,className:`w-36`,children:(0,q.jsx)(W,{placeholder:b()})}),(0,q.jsxs)(H,{children:[(0,q.jsx)(L,{value:J,children:i()}),Q.map(e=>(0,q.jsx)(L,{value:e,children:e},e))]})]})]}),(0,q.jsx)(Oe,{title:ve(),rows:Z,emptyHint:h===`open`?u():te(),rowActions:e=>X&&e.status===`open`?[{label:ne(),onSelect:()=>void Ve(e)},{label:le(),onSelect:()=>void He(e)}]:[],columns:[{header:k(),cell:e=>(0,q.jsx)(`span`,{className:`oc-traces__time`,children:be(e.at)}),sort:e=>e.at},{header:b(),cell:e=>(0,q.jsx)(`code`,{className:`oc-traces__mono`,children:e.kind}),sort:e=>e.kind},{header:o(),cell:e=>(0,q.jsx)(Le,{severity:e.severity}),sort:e=>e.severity===`critical`?2:+(e.severity===`warn`)},{header:a(),cell:e=>(0,q.jsx)($,{status:e.status}),sort:e=>e.status===`resolved`?2:+(e.status===`acknowledged`)},{header:l(),cell:e=>(0,q.jsx)(F,{variant:`outline`,children:e.source}),sort:e=>e.source},{header:ce(),cell:e=>(0,q.jsxs)(`div`,{className:`oc-anomaly__msgcell`,children:[(0,q.jsx)(`span`,{className:`oc-anomaly__msg`,children:e.message}),(0,q.jsx)(Ie,{row:e})]}),sort:e=>e.message},{header:A(),cell:e=>(0,q.jsx)(Fe,{row:e}),sort:e=>e.evidence??null},{header:ge(),cell:e=>e.correlationId?(0,q.jsx)(`code`,{className:`oc-traces__mono`,children:Re(e.correlationId)}):(0,q.jsx)(`span`,{className:`oc-traces__muted`,children:`—`}),sort:e=>e.correlationId}]})]})}function Z(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 Q(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 Fe({row:e}){let t=V();if(e.kind===`subagent.failure`){let n=Q(e);return(0,q.jsxs)(`div`,{className:`oc-anomaly__cause`,children:[(0,q.jsx)(`div`,{className:`oc-anomaly__cause-head`,children:[...new Set(n.errorCategories??[])].map(e=>(0,q.jsx)(`code`,{className:`oc-traces__mono`,children:e},e))}),e.correlationId?(0,q.jsxs)(`button`,{type:`button`,className:`oc-anomaly__drill`,onClick:()=>void t({to:`/settings/traces`,search:{q:e.correlationId,limit:100}}),children:[`↗ `,j()]}):null]})}let n=Z(e);if(!n.dominantCode)return(0,q.jsx)(`span`,{className:`oc-traces__muted`,children:`—`});let r=G(n.dominantCode),i=n.sampleCorrelationId;return(0,q.jsxs)(`div`,{className:`oc-anomaly__cause`,children:[(0,q.jsxs)(`div`,{className:`oc-anomaly__cause-head`,children:[(0,q.jsx)(`span`,{className:`oc-anomaly__cause-label`,children:r.label}),(0,q.jsx)(`code`,{className:`oc-traces__mono`,children:n.dominantCode})]}),(0,q.jsx)(`p`,{className:`oc-anomaly__cause-hint`,children:r.hint}),i?(0,q.jsxs)(`button`,{type:`button`,className:`oc-anomaly__drill`,onClick:()=>void t({to:`/settings/traces`,search:{q:i,limit:100}}),children:[`↗ `,j()]}):null]})}function Ie({row:e}){let[t,n]=(0,K.useState)(!1),r=T(m.anomalies.getAnomalyAttachments,t?{anomalyId:e._id}:`skip`);return!e.attachments||e.attachments.length===0?null:(0,q.jsxs)(q.Fragment,{children:[(0,q.jsxs)(`button`,{type:`button`,className:`oc-anomaly__drill`,onClick:()=>n(!0),children:[O(),e.attachments.length>1?` (${e.attachments.length})`:``]}),(0,q.jsx)(I,{open:t,onOpenChange:n,children:(0,q.jsxs)(P,{className:`oc-anomaly__attachments-dialog`,children:[(0,q.jsx)(U,{children:(0,q.jsx)(z,{children:h()})}),r===void 0?(0,q.jsx)(`p`,{className:`oc-traces__muted`,children:_()}):r.length===0?(0,q.jsx)(`p`,{className:`oc-traces__muted`,children:v()}):(0,q.jsx)(`div`,{className:`oc-anomaly__attachments`,children:r.map(e=>(0,q.jsxs)(`section`,{className:`oc-anomaly__attachment`,children:[(0,q.jsx)(`h4`,{className:`oc-anomaly__attachment-name`,children:(0,q.jsx)(`code`,{className:`oc-traces__mono`,children:e.name})}),(0,q.jsx)(`pre`,{className:`oc-anomaly__attachment-content`,children:e.content})]},e.name))})]})})]})}function Le({severity:e}){return(0,q.jsx)(`span`,{className:`oc-anomaly__sev oc-anomaly__sev--${e}`,children:e})}function $({status:e}){return e===`open`?(0,q.jsx)(F,{variant:`destructive`,children:x()}):e===`acknowledged`?(0,q.jsx)(F,{variant:`secondary`,children:C()}):(0,q.jsx)(F,{variant:`outline`,children:g()})}function Re(e){return e.length>8?e.slice(0,8):e}export{X as AnomaliesTab};
@@ -1 +0,0 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$x as r,Br as i,Fr as a,Ir as o,Lr as s,Qx as c,Rr as l,T as u,Xx as d,Yx as f,Zx as p,aS as m,cS as h,eS as g,iS as _,lS as v,nS as y,oS as b,rI as x,rS as S,sS as C,tS as w,zr as T}from"./dist-CNZ9o3sc.js";import{V as E,a as D,ct as O,i as k,in as A,lt as j,n as M,o as N,ot as P,rn as F,s as I,st as L,ut as R}from"./index-9R1hg_pA.js";import{n as ee}from"./TimeRangePicker-BPVkrNZN.js";import{t as z}from"./FilterBar-DRRfKRTQ.js";import{t as B}from"./AdvancedFilter-CjfYhQlT.js";import{t as V}from"./DataTableShell-zzaGmfMk.js";var H=t(e(),1),U=n(),W={kind:`relative`,from:M,to:`now`},G=`__all__`,K=[{value:`action`,label:i()},{value:`realLabel`,label:T()},{value:`targetLabel`,label:l()},{value:`impersonated`,label:s()},{value:`resource`,label:o()},{value:`resourceId`,label:a()}];function q(){let e=A({from:`/settings/audit`}),t=F({from:`/settings/audit`}),n=e.q??``,i=e.action??G,a=e.impersonated??G,o=e.resource??G,s=k(e.from,e.to),l=(0,H.useMemo)(()=>I(e.adv),[e.adv]),{from:T,to:M}=ee(s),q=e=>void t({search:t=>({...t,q:e||void 0}),replace:!0}),J=e=>void t({search:t=>({...t,action:e===G?void 0:e})}),Y=e=>void t({search:t=>({...t,impersonated:e===G?void 0:e})}),X=e=>void t({search:t=>({...t,resource:e===G?void 0:e})}),Z=e=>void t({search:t=>({...t,...N(e)})}),Q=e=>void t({search:t=>({...t,adv:D(e)}),replace:!0}),$=x(u.admin.listAudit,{filter:{q:n||void 0,from:T,to:M,action:i===G?void 0:i,resource:o===G?void 0:o,impersonated:a===G?void 0:a===`yes`,advanced:l.length>0?l:void 0}}),te=(0,H.useMemo)(()=>{let e=new Set;for(let t of $??[])e.add(t.action);return[...e].sort()},[$]),ne=(0,H.useMemo)(()=>{let e=new Set;for(let t of $??[])t.resource&&e.add(t.resource);return[...e].sort()},[$]),re=n!==``||i!==G||a!==G||o!==G||l.length>0||s.kind!==`relative`||s.from!==W.from;function ie(){t({search:{},replace:!0})}return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(`p`,{className:`oc-admin__hint`,children:[v(),` `,(0,U.jsx)(`span`,{className:`oc-filter__window`,children:h()})]}),(0,U.jsxs)(z,{q:n,onQChange:q,searchPlaceholder:C(),timeRange:s,onTimeRangeChange:Z,onReset:ie,canReset:re,children:[(0,U.jsxs)(P,{value:i,onValueChange:J,children:[(0,U.jsx)(j,{size:`sm`,className:`w-40`,children:(0,U.jsx)(R,{placeholder:b()})}),(0,U.jsxs)(L,{children:[(0,U.jsx)(O,{value:G,children:m()}),te.map(e=>(0,U.jsx)(O,{value:e,children:e},e))]})]}),(0,U.jsxs)(P,{value:a,onValueChange:Y,children:[(0,U.jsx)(j,{size:`sm`,className:`w-40`,children:(0,U.jsx)(R,{})}),(0,U.jsxs)(L,{children:[(0,U.jsx)(O,{value:G,children:_()}),(0,U.jsx)(O,{value:`yes`,children:S()}),(0,U.jsx)(O,{value:`no`,children:y()})]})]}),(0,U.jsxs)(P,{value:o,onValueChange:X,children:[(0,U.jsx)(j,{size:`sm`,className:`w-40`,children:(0,U.jsx)(R,{placeholder:w()})}),(0,U.jsxs)(L,{children:[(0,U.jsx)(O,{value:G,children:g()}),ne.map(e=>(0,U.jsx)(O,{value:e,children:e},e))]})]})]}),(0,U.jsx)(B,{fields:K,seed:l,onChange:Q}),(0,U.jsx)(V,{title:r(),rows:$,emptyHint:c(),columns:[{header:p(),cell:e=>E(e.at),sort:e=>e.at},{header:b(),cell:e=>e.action,sort:e=>e.action},{header:d(),cell:e=>e.realLabel,sort:e=>e.realLabel},{header:f(),cell:e=>e.targetLabel??`—`,sort:e=>e.targetLabel??null},{header:w(),cell:e=>e.resource?e.resource+(e.resourceId?` · ${e.resourceId.slice(0,8)}`:``):`—`,sort:e=>e.resource??null}]})]})}export{q as AuditTab};
@@ -1 +0,0 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$_ as r,$g as i,A_ as a,Al as o,Bg as s,C_ as c,Cl as l,D as u,D_ as d,Dl as f,E_ as p,El as m,Fg as h,Gg as g,Hg as _,Ig as v,Jg as y,Kg as b,Lg as x,O_ as ee,Ol as S,Pg as C,Qg as te,Rg as ne,S_ as re,Sl as ie,T as w,T_ as ae,Tl as oe,Ug as se,Vg as ce,Wg as le,Xg as ue,Yg as de,Zg as fe,__ as pe,a_ as me,ar as he,av as ge,b_ as _e,bl as ve,c_ as ye,cv as be,d_ as xe,eI as Se,e_ as Ce,ev as we,f_ as Te,fv as Ee,g_ as De,h_ as Oe,i_ as ke,ir as Ae,iv as je,j_ as Me,k_ as Ne,kl as Pe,l_ as T,lv as Fe,m_ as Ie,ml as Le,nI as Re,n_ as ze,o_ as Be,or as Ve,ov as He,p_ as Ue,pv as We,qg as Ge,rI as E,r_ as Ke,rr as qe,rv as Je,s_ as Ye,sr as Xe,sv as Ze,t_ as Qe,u_ as $e,ur as et,uv as tt,v_ as nt,vl as rt,w_ as it,wl as at,x_ as ot,xl as st,y_ as ct,yl as lt,zg as ut}from"./dist-CNZ9o3sc.js";import{i as D,r as dt}from"./dist-VGy3W8j2.js";import{t as ft}from"./chevrons-up-down-ImFHIr_N.js";import{i as pt,n as O,o as mt,r as ht,s as gt}from"./FieldLabel-z7bxzKHq.js";import{i as _t,n as vt,r as yt,t as bt}from"./tabs-CQ2rDwF5.js";import{t as k}from"./button-BtQwDeC7.js";import{$ as xt,$t as A,H as j,Kt as St,Lt as M,Pt as N,Q as Ct,V as wt,X as P,Y as F,Z as Tt,at as Et,ct as I,en as Dt,gt as Ot,h as kt,in as At,it as jt,lt as L,m as Mt,nt as Nt,ot as R,rn as Pt,rt as Ft,st as z,tt as It,ut as B,wt as Lt}from"./index-9R1hg_pA.js";import{r as Rt}from"./locales-CPjguROj.js";import{a as zt,i as V,n as Bt,o as H,r as U,t as Vt}from"./table-C9PafBK9.js";import{t as Ht}from"./FilterBar-DRRfKRTQ.js";import{a as Ut,n as Wt,o as Gt,r as Kt,s as qt,t as Jt}from"./compatView-BvZyYwOM.js";import{t as W}from"./dispatchErrorInfo-CjAxcZ1X.js";var Yt=u(`refresh-cw`,[[`path`,{d:`M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8`,key:`v9h5vc`}],[`path`,{d:`M21 3v5h-5`,key:`1q7to0`}],[`path`,{d:`M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16`,key:`3uifl3`}],[`path`,{d:`M8 16H3v5`,key:`1cv678`}]]),Xt=u(`wifi-off`,[[`path`,{d:`M12 20h.01`,key:`zekei9`}],[`path`,{d:`M8.5 16.429a5 5 0 0 1 7 0`,key:`1bycff`}],[`path`,{d:`M5 12.859a10 10 0 0 1 5.17-2.69`,key:`1dl1wf`}],[`path`,{d:`M19 12.859a10 10 0 0 0-2.007-1.523`,key:`4k23kn`}],[`path`,{d:`M2 8.82a15 15 0 0 1 4.177-2.643`,key:`1grhjp`}],[`path`,{d:`M22 8.82a15 15 0 0 0-11.288-3.764`,key:`z3jwby`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}]]),G=t(e(),1);function Zt(e){return e.filter(e=>e.state===`error`)}function Qt(e){return e.reachable&&Zt(e.targets).length===0}function $t(e){return Qt(e)?(e.unreachableInstances??[]).length>0?`gateways_unreachable`:`ok`:`error`}function en(e){return e.state===`error`&&e.lastErrorCode!==null}function tn(e){return!!e.lastDownstreamRejectCode}function K(e){return e.kind??`openclaw`}function nn(e){return[...e].sort((e,t)=>e===`openclaw`?-1:t===`openclaw`?1:e.localeCompare(t))}function rn(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,K(e));let i=e=>(e.instanceName?r.get(e.instanceName):void 0)??`openclaw`,a=new Set;for(let e of n)a.add(K(e));for(let e of t)a.add(e.provider);for(let t of e)a.add(i(t));return nn(a).map(r=>({key:r,connections:e.filter(e=>i(e)===r),compatTargets:t.filter(e=>e.provider===r),instances:n.filter(e=>K(e)===r)}))}function q(e){return e===`openclaw`?`OpenClaw`:e===`hermes`?`Hermes`:e.charAt(0).toUpperCase()+e.slice(1)}var J=`__all__`,an={q:``,state:J,instance:J,version:J},Y={connected:0,error:1,idle:2};function on(e){return e.q.trim()!==``||e.state!==`__all__`||e.instance!==`__all__`||e.version!==`__all__`}function sn(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 cn(e,t){return e===`version`?t.gatewayVersion===null:e===`lastOk`?t.lastOkAt===null:!1}function ln(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 Gt(e,r)??X(e,r)}case`lastOk`:return t.lastOkAt-n.lastOkAt;default:return X(t.targetLabel,n.targetLabel)}}function un(e,t){if(!t)return e;let n=t.dir===`asc`?1:-1;return[...e].sort((e,r)=>{let i=cn(t.key,e),a=cn(t.key,r);return i&&a?0:i?1:a?-1:n*ln(t.key,e,r)})}function dn(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 fn(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 pn(e){let t=new Set;for(let n of e)n.gatewayVersion!==null&&t.add(n.gatewayVersion);return[...t].sort((e,t)=>Gt(e,t)??X(e,t))}var Z=n();function mn({connections:e,displayByInstance:t}){let[n,r]=(0,G.useState)(an),[i,a]=(0,G.useState)(null),o=(0,G.useMemo)(()=>e.map((e,n)=>({_id:`${e.key}:${e.canonical}/${e.agentId}:${n}`,targetLabel:`${e.canonical}/${e.agentId}`,state:e.state,instanceName:e.instanceName??null,instanceLabel:e.instanceName?t.get(e.instanceName)??e.instanceName:null,gatewayHost:e.gatewayHost,gatewayVersion:e.gatewayVersion??null,okCount:e.okCount,errorCount:e.errorCount+(e.downstreamRejectCount??0),attempts:e.attempts,lastOkAt:e.lastOkAt??null,lastErrorCode:e.lastErrorCode??null,lastErrorAt:e.lastErrorAt??null,lastDownstreamRejectCode:e.lastDownstreamRejectCode??null,lastDownstreamRejectAt:e.lastDownstreamRejectAt??null})),[e,t]),c=(0,G.useMemo)(()=>dn(o),[o]),l=(0,G.useMemo)(()=>fn(o),[o]),u=(0,G.useMemo)(()=>pn(o),[o]),d=(0,G.useMemo)(()=>un(sn(o,n),i),[o,n,i]);function f(e){a(t=>t?.key===e?t.dir===`asc`?{key:e,dir:`desc`}:null:{key:e,dir:`asc`})}return e.length===0?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:te()}):(0,Z.jsxs)(`div`,{className:`oc-conn`,children:[(0,Z.jsxs)(Ht,{q:n.q,onQChange:e=>r(t=>({...t,q:e})),searchPlaceholder:de(),onReset:()=>r(an),canReset:on(n),children:[(0,Z.jsxs)(R,{value:n.state,onValueChange:e=>r(t=>({...t,state:e})),children:[(0,Z.jsx)(L,{size:`sm`,className:`w-36`,children:(0,Z.jsx)(B,{placeholder:Ge()})}),(0,Z.jsxs)(z,{children:[(0,Z.jsx)(I,{value:J,children:y()}),c.map(e=>(0,Z.jsx)(I,{value:e,children:gn(e)},e))]})]}),(0,Z.jsxs)(R,{value:n.instance,onValueChange:e=>r(t=>({...t,instance:e})),children:[(0,Z.jsx)(L,{size:`sm`,className:`w-40`,children:(0,Z.jsx)(B,{placeholder:b()})}),(0,Z.jsxs)(z,{children:[(0,Z.jsx)(I,{value:J,children:y()}),l.map(e=>(0,Z.jsx)(I,{value:e.name,children:e.label},e.name))]})]}),(0,Z.jsxs)(R,{value:n.version,onValueChange:e=>r(t=>({...t,version:e})),children:[(0,Z.jsx)(L,{size:`sm`,className:`w-36`,children:(0,Z.jsx)(B,{placeholder:g()})}),(0,Z.jsxs)(z,{children:[(0,Z.jsx)(I,{value:J,children:y()}),u.map(e=>(0,Z.jsx)(I,{value:e,children:e},e))]})]})]}),d.length===0?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:le()}):(0,Z.jsxs)(Vt,{className:`oc-conn__table`,children:[(0,Z.jsx)(zt,{children:(0,Z.jsxs)(H,{children:[(0,Z.jsx)(Q,{label:se(),sortKey:`target`,sort:i,onSort:f}),(0,Z.jsx)(Q,{label:_(),sortKey:`state`,sort:i,onSort:f}),(0,Z.jsx)(Q,{label:ce(),sortKey:`instance`,sort:i,onSort:f}),(0,Z.jsx)(Q,{label:s(),sortKey:`host`,sort:i,onSort:f}),(0,Z.jsx)(Q,{label:ut(),sortKey:`version`,sort:i,onSort:f}),(0,Z.jsx)(V,{children:ne()}),(0,Z.jsx)(Q,{label:x(),sortKey:`lastOk`,sort:i,onSort:f})]})}),(0,Z.jsx)(Bt,{children:d.map(e=>(0,Z.jsx)(hn,{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)(V,{"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)(dt,{size:13,"aria-hidden":!0}):(0,Z.jsx)(D,{size:13,"aria-hidden":!0}):(0,Z.jsx)(ft,{size:13,"aria-hidden":!0,className:`oc-conn__sort-idle`})]})})}function hn({r:e}){let t=en(e)?W(e.lastErrorCode):null,n=tn(e)?W(e.lastDownstreamRejectCode):null;return(0,Z.jsxs)(G.Fragment,{children:[(0,Z.jsxs)(H,{className:`oc-conn__row oc-conn__row--${e.state}`,children:[(0,Z.jsx)(U,{children:(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:e.targetLabel})}),(0,Z.jsx)(U,{children:(0,Z.jsx)(_n,{state:e.state})}),(0,Z.jsx)(U,{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)(U,{children:(0,Z.jsx)(`span`,{className:`oc-bridge-target__host`,children:e.gatewayHost})}),(0,Z.jsx)(U,{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)(U,{children:(0,Z.jsx)(`span`,{className:`oc-conn__stats`,children:fe({ok:e.okCount,errors:e.errorCount,attempts:e.attempts})})}),(0,Z.jsx)(U,{children:e.lastOkAt?(0,Z.jsx)(`span`,{className:`oc-traces__mono`,children:j(e.lastOkAt)}):(0,Z.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})})]}),t||n?(0,Z.jsx)(H,{className:`oc-conn__detail-row`,children:(0,Z.jsxs)(U,{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?` · ${j(e.lastErrorAt)}`:``,(0,Z.jsx)(`p`,{className:`oc-bridge-card__hint`,children:t.hint})]}):null,n?(0,Z.jsxs)(`div`,{className:`oc-bridge-target__downstream`,children:[ue({label:n.label}),` `,(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:e.lastDownstreamRejectCode}),e.lastDownstreamRejectAt?` · ${j(e.lastDownstreamRejectAt)}`:``]}):null]})}):null]})}function gn(e){return e===`connected`?v():e===`error`?h():C()}function _n({state:e}){return e===`connected`?(0,Z.jsx)(F,{variant:`secondary`,children:v()}):e===`error`?(0,Z.jsx)(F,{variant:`destructive`,children:h()}):(0,Z.jsx)(F,{variant:`outline`,children:C()})}function vn(){return E(w.bridgeHealth.getBridgeHealth,{})}function yn(){let e=vn(),t=E(w.compat.getBridgeCompat,{}),n=E(w.me.getMe,{host:Ot})?.role===`admin`,r=E(w.admin.listInstances,n?{}:`skip`),i=E(w.agents.usageForInstances,n?{}:`skip`),a=Pt(),o=()=>void a({to:`/settings/anomalies`,search:{status:`open`}}),s=rn(e?e.targets:[],t?t.targets:[],r??[]),{section:c}=At({from:`/settings/bridge`}),l=Pt({from:`/settings/bridge`}),u=t?.compat??null,d=t===void 0?`loading`:t===null?`nodata`:`ready`,f=u!==null&&Wt(u,`hermes`)&&!s.some(e=>e.key===`hermes`);return(0,Z.jsxs)(`div`,{className:`oc-bridge`,children:[(0,Z.jsx)(bn,{health:e,compat:t,onSeeAnomalies:o}),(0,Z.jsx)(`p`,{className:`oc-admin__hint oc-bridge__caption`,children:pe()}),i&&i.length>0?(0,Z.jsxs)(`section`,{className:`oc-bridge__usage`,children:[(0,Z.jsx)(`h3`,{className:`oc-bridge__usage-title`,children:De()}),(0,Z.jsxs)(Vt,{children:[(0,Z.jsx)(zt,{children:(0,Z.jsxs)(H,{children:[(0,Z.jsx)(V,{children:Xe()}),(0,Z.jsx)(V,{children:Ve()}),(0,Z.jsx)(V,{children:he()}),(0,Z.jsx)(V,{children:Ae()}),(0,Z.jsx)(V,{children:qe()})]})}),(0,Z.jsx)(Bt,{children:i.flatMap(e=>{let t=kt(e.usage,Date.now());return t?t.windows.map((t,n)=>(0,Z.jsxs)(H,{children:[(0,Z.jsx)(U,{className:`font-medium`,children:n===0?e.instanceName:``}),(0,Z.jsx)(U,{children:t.provider}),(0,Z.jsx)(U,{children:t.label}),(0,Z.jsx)(U,{children:(0,Z.jsxs)(F,{variant:t.percentLeft<=10?`destructive`:t.percentLeft<=25?`outline`:`secondary`,children:[t.percentLeft,`%`]})}),(0,Z.jsx)(U,{className:`text-muted-foreground`,children:t.resetText??`—`})]},`${e.instanceName}:${t.provider}:${t.label}`)):[]})})]})]}):null,s.length>0?(0,Z.jsxs)(bt,{value:s.some(e=>e.key===c)?c:s[0]?.key??`openclaw`,onValueChange:e=>void l({search:{section:e},replace:!0}),children:[(0,Z.jsx)(yt,{className:`w-full`,children:s.map(e=>(0,Z.jsxs)(_t,{value:e.key,className:`flex-1 gap-1.5`,children:[(0,Z.jsx)(M,{size:13,"aria-hidden":!0}),q(e.key)]},e.key))}),s.map(e=>(0,Z.jsx)(vt,{value:e.key,children:(0,Z.jsx)(xn,{providerKey:e.key,connections:e.connections,instances:e.instances,manifest:u,compatStatus:d,compatReachable:t?.reachable??!0,protocol:e.key===`openclaw`?t?.protocol??null:null})},e.key))]}):null,f?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:Le()}):null]})}function bn({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:Ut(t.bridgeVersion)}),i?(0,Z.jsxs)(Z.Fragment,{children:[` `,(0,Z.jsxs)(`code`,{className:`oc-traces__mono`,title:S(),children:[`(`,i,`)`]})]}):null,r?(0,Z.jsxs)(`strong`,{className:`oc-bridge-card__mismatch`,children:[` `,f({build:t.buildVersion??`?`})]}):null,` · `,m(),` `,(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:t.protocolVersion===null?oe():String(t.protocolVersion)})]}):null;if(e===void 0)return(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:T()});if(e===null)return(0,Z.jsx)(`div`,{className:`oc-bridge-card oc-bridge-card--idle`,children:ye()});let o=Zt(e.targets),s=!e.reachable,c=$t(e),l=e.unreachableInstances??[],u=c===`ok`?`ok`:c===`gateways_unreachable`?`warn`:`error`,d=wt(e.checkedAt),p=e.startedAt==null?null:wt(e.startedAt);return(0,Z.jsxs)(`div`,{className:`oc-bridge-card oc-bridge-card--${u}`,children:[(0,Z.jsx)(`div`,{className:`oc-bridge-card__icon`,"aria-hidden":!0,children:c===`ok`?(0,Z.jsx)(A,{size:22}):s||c===`gateways_unreachable`?(0,Z.jsx)(Xt,{size:22}):(0,Z.jsx)(N,{size:22})}),(0,Z.jsxs)(`div`,{className:`oc-bridge-card__body`,children:[(0,Z.jsx)(`div`,{className:`oc-bridge-card__title`,children:c===`ok`?Ye():c===`gateways_unreachable`?Ke({count:l.length}):s?Be():me({count:o.length})}),(0,Z.jsxs)(`div`,{className:`oc-bridge-card__meta`,children:[(0,Z.jsxs)(`span`,{children:[(0,Z.jsx)(Yt,{size:12,"aria-hidden":!0}),` `,ke({time:d})]}),p?(0,Z.jsx)(`span`,{children:Qe({time:p})}):null,a]}),c===`gateways_unreachable`?(0,Z.jsx)(`p`,{className:`oc-bridge-card__hint`,children:ze({names:l.join(`, `)})}):null,s?(0,Z.jsx)(`p`,{className:`oc-bridge-card__hint`,children:W(e.lastError===`not_configured`?`NOT_CONFIGURED`:`BRIDGE_UNREACHABLE`).hint}):null]}),(0,Z.jsx)(`button`,{type:`button`,className:`oc-bridgebar__drill`,onClick:n,children:Ce()})]})}function xn({providerKey:e,connections:t,instances:n,manifest:r,compatStatus:a,compatReachable:s,protocol:c}){let l=r?qt(r,e):null,u=new Map;for(let e of n)u.set(e.name,e.displayName??e.name);let d=[],f=new Set;for(let n of t){if(!n.instanceName||f.has(n.instanceName))continue;f.add(n.instanceName);let t=n.gatewayVersion??null;d.push({instanceName:n.instanceName,displayName:u.get(n.instanceName)??n.instanceName,version:t,state:Jt(t,e,r)})}let p=d.map(e=>e.state),m=p.includes(`beyond`)?`beyond`:p.length>0&&p.every(e=>e===`supported`)?`supported`:null,[h,g]=(0,G.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)(M,{size:15,"aria-hidden":!0,className:`oc-bridge-provider__icon`}),(0,Z.jsx)(`span`,{className:`oc-bridge-provider__name`,children:q(e)}),m?(0,Z.jsx)(F,{variant:m===`beyond`?`destructive`:`secondary`,children:Kt(m)}):null]}),(0,Z.jsx)(`h4`,{className:`oc-bridge-provider__sub`,children:o()}),(0,Z.jsx)(Cn,{providerName:q(e),support:l,compatStatus:a,compatReachable:s,manifest:r,instanceRows:d}),c?(0,Z.jsx)(Sn,{protocol:c}):null,(0,Z.jsxs)(`button`,{type:`button`,className:`oc-bridge-provider__sub oc-bridge-provider__sub--toggle`,"aria-expanded":h,onClick:()=>g(e=>!e),children:[h?(0,Z.jsx)(D,{size:13,"aria-hidden":!0}):(0,Z.jsx)(Dt,{size:13,"aria-hidden":!0}),i({count:t.length})]}),h?(0,Z.jsx)(mn,{connections:t,displayByInstance:u}):null]})}function Sn({protocol:e}){let[t,n]=(0,G.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:[Oe(),i.length>0?(0,Z.jsx)(F,{variant:`destructive`,children:Ue({count:i.length})}):(0,Z.jsx)(F,{variant:`secondary`,children:Ie()})]}),(0,Z.jsxs)(`p`,{className:`oc-admin__hint`,children:[Te({version:e.vendoredVersion}),r?` · `+xe({handled:r.handled,ignored:r.ignored,gaps:r.gaps}):null]}),i.length>0?(0,Z.jsx)(`ul`,{className:`oc-bridge-protocol__list`,role:`list`,children:i.map(e=>(0,Z.jsxs)(`li`,{children:[(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:e.shape}),` × `,e.count]},e.shape))}):null,r&&r.gapList.length>0?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`button`,{type:`button`,className:`oc-bridge-provider__sub oc-bridge-provider__sub--toggle`,"aria-expanded":t,onClick:()=>n(e=>!e),children:[t?(0,Z.jsx)(D,{size:13,"aria-hidden":!0}):(0,Z.jsx)(Dt,{size:13,"aria-hidden":!0}),$e({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 Cn({support:e,compatStatus:t,compatReachable:n,manifest:r,instanceRows:i,providerName:a}){return t===`loading`?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:T()}):t===`nodata`?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:Pe()}):(0,Z.jsxs)(`div`,{className:`oc-compat`,children:[n?null:(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:at()}),r===null?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:l()}):(0,Z.jsxs)(`div`,{className:`oc-compat__support`,children:[(0,Z.jsx)(`span`,{className:`oc-compat__label`,children:et({provider:a})}),e&&e.range!==null?(0,Z.jsx)(`span`,{children:ie({min:e.range.min,max:e.range.maxValidated})}):(0,Z.jsx)(`span`,{children:oe()}),e?(0,Z.jsx)(En,{versions:e.validatedVersions}):null]}),i.length===0?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:rt()}):(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:Ut(e.version)}),(0,Z.jsx)(F,{variant:e.state===`supported`?`secondary`:e.state===`beyond`?`destructive`:`outline`,children:Kt(e.state)})]},e.instanceName))})]})}function wn({instance:e,onClose:t}){return(0,Z.jsx)(Tt,{open:!0,onOpenChange:e=>!e&&t(),children:(0,Z.jsxs)(Ct,{className:`oc-bridge-config-dialog`,onOpenAutoFocus:e=>e.preventDefault(),children:[(0,Z.jsxs)(It,{children:[(0,Z.jsx)(Nt,{children:We({instance:e.displayName??e.name})}),(0,Z.jsx)(xt,{children:Ee()})]}),(0,Z.jsx)(Tn,{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)(A,{"aria-hidden":!0}):(0,Z.jsx)(N,{"aria-hidden":!0}),(0,Z.jsxs)(`span`,{children:[e,` — `,t.ok?ot():t.detail]})]}):(0,Z.jsxs)(`p`,{className:`oc-bridge-config__check-row oc-bridge-config__check-row--skip`,children:[e,` — `,_e()]}):null}function Tn({instance:e,onClose:t}){let n=Re(w.admin.upsertInstanceConfig),i=Se(w.bridge.validateMediaPaths),o=Lt(),s=Rt(e.config?.contentLocale,void 0),[l,u]=(0,G.useState)(()=>pt(e.config??{},s)),[f,m]=(0,G.useState)(!1),[h,g]=(0,G.useState)(!1),[_,v]=(0,G.useState)(null),y=l.inboundMediaMode===`shared-fs`,b=l.mediaMode===`shared-fs`,x=y||b;async function S(){g(!0),v(null);try{v(await i({instanceName:e.name,inboundMediaMode:l.inboundMediaMode,mediaMode:l.mediaMode}))}catch(e){o.error(ae(),e)}finally{g(!1)}}async function C(){m(!0);try{let r=e.config??{};await n({instanceId:e._id,config:ht(l,r,s)}),t()}catch(e){o.error(ge(),e)}finally{m(!1)}}return(0,Z.jsx)(`div`,{className:`oc-bridge-config`,children:(0,Z.jsxs)(`div`,{className:`oc-bridge-config__form`,children:[(0,Z.jsxs)(`div`,{className:`oc-bridge-config__grid`,children:[(0,Z.jsxs)(`label`,{className:`oc-field`,children:[(0,Z.jsx)(O,{label:tt(),help:je()}),(0,Z.jsxs)(R,{value:l.mediaMode,onValueChange:e=>u({...l,mediaMode:e}),children:[(0,Z.jsx)(L,{size:`sm`,className:`w-full`,children:(0,Z.jsx)(B,{})}),(0,Z.jsx)(z,{children:gt.map(e=>(0,Z.jsx)(I,{value:e,children:e},e))})]})]}),(0,Z.jsxs)(`label`,{className:`oc-field`,children:[(0,Z.jsx)(O,{label:Fe(),help:Je()}),(0,Z.jsxs)(R,{value:l.inboundMediaMode,onValueChange:e=>u({...l,inboundMediaMode:e}),children:[(0,Z.jsx)(L,{size:`sm`,className:`w-full`,children:(0,Z.jsx)(B,{})}),(0,Z.jsx)(z,{children:mt.map(e=>(0,Z.jsx)(I,{value:e,children:e},e))})]})]}),(0,Z.jsxs)(`label`,{className:`oc-field`,children:[(0,Z.jsx)(O,{label:be(),help:we()}),(0,Z.jsx)(P,{type:`number`,min:1,max:4096,className:`w-full`,value:l.mediaMaxMb,onChange:e=>u({...l,mediaMaxMb:Math.trunc(Number(e.target.value)||0)})})]})]}),x&&(0,Z.jsxs)(`div`,{className:`oc-bridge-config__grid`,children:[y&&(0,Z.jsxs)(`label`,{className:`oc-field`,children:[(0,Z.jsx)(O,{label:Me(),help:a()}),(0,Z.jsx)(P,{className:`w-full`,spellCheck:!1,value:l.inboundAgentMount,onChange:e=>u({...l,inboundAgentMount:e.target.value})})]}),b&&(0,Z.jsxs)(`label`,{className:`oc-field`,children:[(0,Z.jsx)(O,{label:Ne(),help:ee()}),(0,Z.jsx)(P,{className:`w-full`,spellCheck:!1,value:l.outboundAgentMount,onChange:e=>u({...l,outboundAgentMount:e.target.value})})]})]}),(0,Z.jsxs)(`label`,{className:`oc-field--row`,children:[(0,Z.jsx)(Mt,{checked:l.rehydration,onCheckedChange:e=>u({...l,rehydration:e===!0})}),(0,Z.jsx)(O,{label:Ze(),help:r()})]}),x&&_!==null&&(0,Z.jsx)(`div`,{className:`oc-bridge-config__check`,children:_.reachable?!_.inbound&&!_.outbound?(0,Z.jsxs)(`p`,{className:`oc-bridge-config__check-row oc-bridge-config__check-row--err`,children:[(0,Z.jsx)(N,{"aria-hidden":!0}),nt({reason:_.reason??`?`})]}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)($,{label:c(),result:_.inbound}),(0,Z.jsx)($,{label:re(),result:_.outbound}),(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:it()})]}):(0,Z.jsxs)(`p`,{className:`oc-bridge-config__check-row oc-bridge-config__check-row--err`,children:[(0,Z.jsx)(N,{"aria-hidden":!0}),ct()]})}),(0,Z.jsxs)(`div`,{className:`oc-bridge-config__actions`,children:[x&&(0,Z.jsxs)(k,{variant:`outline`,size:`sm`,onClick:()=>void S(),disabled:h,children:[h?(0,Z.jsx)(St,{className:`size-4 animate-spin`,"aria-hidden":!0}):null,h?p():d()]}),(0,Z.jsx)(k,{size:`sm`,onClick:()=>void C(),disabled:f,children:He()})]})]})})}function En({versions:e}){if(e.length===0)return null;let t=[...e].reverse();return(0,Z.jsxs)(Ft,{children:[(0,Z.jsx)(Et,{asChild:!0,children:(0,Z.jsxs)(`button`,{type:`button`,className:`oc-compat__versions-btn`,children:[e.length===1?st():ve({count:e.length}),(0,Z.jsx)(D,{size:13,"aria-hidden":!0})]})}),(0,Z.jsxs)(jt,{className:`oc-compat__versions-pop`,align:`start`,children:[(0,Z.jsx)(`p`,{className:`oc-compat__versions-title`,children:lt()}),(0,Z.jsx)(`div`,{className:`oc-compat__versions-list`,children:t.map(e=>(0,Z.jsx)(F,{variant:`secondary`,children:e},e))})]})]})}export{yn as BridgeTab,wn as InstanceConfigDialog};
@@ -1 +0,0 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$u as r,Fl as i,Il as a,JF as o,Ku as s,Ll as c,Ml as l,Nl as u,Pl as d,Rl as f,T as p,Zu as m,ao as h,co as g,do as _,dv as v,eI as y,hu as b,io as x,jl as S,lo as C,lr as w,nI as T,no as E,oo as D,qu as O,rI as k,ro as A,so as j,uo as M,zl as N}from"./dist-CNZ9o3sc.js";import{t as P}from"./button-BtQwDeC7.js";import{Pt as F,X as I,b as L,ct as R,f as z,lt as B,m as V,ot as H,p as U,st as W,ut as G}from"./index-9R1hg_pA.js";import{i as K}from"./compatView-BvZyYwOM.js";/* empty css */var q=t(e(),1),J=[`off`,`minimal`,`low`,`medium`,`high`,`xhigh`];function Y(e){let t=typeof e==`object`&&e?e:{},n=t.defaults!==null&&typeof t.defaults==`object`?t.defaults:{},r=n.thinkingDefault??t.thinkingDefault,i=n.fastModeDefault??t.fastModeDefault;return{thinkingDefault:typeof r==`string`?r:null,fastModeDefault:typeof i==`boolean`?i:null}}var X=n();function Z({instance:e}){let t=T(p.admin.upsertInstanceConfig),n=k(p.agents.listAgentsForInstance,{instanceName:e.name}),i=typeof e.config?.converterAgentId==`string`?e.config.converterAgentId:``,[a,o]=(0,q.useState)(i),[s,c]=(0,q.useState)(`idle`);(0,q.useEffect)(()=>{o(i),c(`idle`)},[e._id,i]);let d=`__none__`,f=a!==i;async function m(){c(`saving`);try{let n={...e.config??{}};a===``||a===d?delete n.converterAgentId:n.converterAgentId=a,await t({instanceId:e._id,config:n}),c(`done`)}catch{c(`error`)}}let h=n?.agents??[];return(0,X.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,X.jsx)(`span`,{className:`oc-cdefaults__label`,children:g()}),(0,X.jsx)(`p`,{className:`oc-admin__hint`,children:j()}),(0,X.jsxs)(`div`,{className:`oc-cdefaults__inline`,children:[(0,X.jsxs)(H,{value:a===``?d:a,onValueChange:e=>o(e===d?``:e),children:[(0,X.jsx)(B,{className:`oc-cdefaults__select`,"aria-label":g(),children:(0,X.jsx)(G,{placeholder:D()})}),(0,X.jsxs)(W,{children:[(0,X.jsx)(R,{value:d,children:D()}),h.map(e=>(0,X.jsx)(R,{value:e.agentId,children:e.displayName?`${e.displayName} (${e.agentId})`:e.agentId},e.agentId))]})]}),(0,X.jsx)(P,{size:`sm`,disabled:!f||s===`saving`,onClick:()=>void m(),children:s===`saving`?r():u()})]}),s===`done`?(0,X.jsx)(`p`,{className:`oc-admin__hint`,role:`status`,children:l()}):null,s===`error`?(0,X.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:S()}):null]})}function Q({instance:e}){let t=T(p.admin.upsertInstanceConfig),n=e.config?.curationEnabled===!0,i=typeof e.config?.curationBudgetChars==`number`?e.config.curationBudgetChars:null,[a,o]=(0,q.useState)(n),[s,c]=(0,q.useState)(i===null?``:String(i)),[d,f]=(0,q.useState)(`idle`);(0,q.useEffect)(()=>{o(n),c(i===null?``:String(i)),f(`idle`)},[e._id,n,i]);let m=s.trim(),g=m===``?null:/^\d+$/.test(m)?Number.parseInt(m,10):NaN,_=!a||g===null||Number.isInteger(g)&&g>=4e3&&g<=6e4,v=a!==n||(g??null)!==i;async function y(){f(`saving`);try{let n={...e.config??{}};n.curationEnabled=a,!a||g===null||Number.isNaN(g)?delete n.curationBudgetChars:n.curationBudgetChars=g,await t({instanceId:e._id,config:n}),f(`done`)}catch{f(`error`)}}return(0,X.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,X.jsxs)(`label`,{className:`oc-cdefaults__inline`,style:{cursor:`pointer`},children:[(0,X.jsx)(V,{checked:a,onCheckedChange:e=>o(e===!0),"aria-label":C()}),(0,X.jsx)(`span`,{className:`oc-cdefaults__label`,children:C()})]}),(0,X.jsxs)(`div`,{className:`oc-cdefaults__inline`,children:[(0,X.jsx)(I,{type:`number`,min:4e3,max:6e4,step:1e3,placeholder:`20000`,value:s,onChange:e=>c(e.target.value),className:`oc-cdefaults__number`,"aria-invalid":!_,"aria-label":h(),disabled:!a}),(0,X.jsx)(P,{size:`sm`,disabled:!v||!_||d===`saving`,onClick:()=>void y(),children:d===`saving`?r():u()})]}),_?null:(0,X.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:x()}),d===`done`?(0,X.jsx)(`p`,{className:`oc-admin__hint`,role:`status`,children:l()}):null,d===`error`?(0,X.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:S()}):null,(0,X.jsx)(`p`,{className:`oc-cdefaults__help`,children:A()})]})}function $({instance:e}){let t=T(p.admin.upsertInstanceConfig),n=typeof e.config?.summarizeThresholdChars==`number`?e.config.summarizeThresholdChars:null,[i,a]=(0,q.useState)(n===null?``:String(n)),[o,s]=(0,q.useState)(`idle`);(0,q.useEffect)(()=>{a(n===null?``:String(n)),s(`idle`)},[e._id,n]);let c=i.trim(),d=c===``?null:/^\d+$/.test(c)?Number.parseInt(c,10):NaN,f=d===null||Number.isInteger(d)&&d>=1e3&&d<=2e5,m=(d??null)!==n;async function h(){s(`saving`);try{let n={...e.config??{}};d===null?delete n.summarizeThresholdChars:n.summarizeThresholdChars=d,await t({instanceId:e._id,config:n}),s(`done`)}catch{s(`error`)}}return(0,X.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,X.jsx)(`span`,{className:`oc-cdefaults__label`,children:_()}),(0,X.jsxs)(`div`,{className:`oc-cdefaults__inline`,children:[(0,X.jsx)(I,{type:`number`,min:1e3,max:2e5,step:1e3,placeholder:`8000`,value:i,onChange:e=>a(e.target.value),className:`oc-cdefaults__number`,"aria-invalid":!f}),(0,X.jsx)(P,{size:`sm`,disabled:!m||!f||o===`saving`,onClick:()=>void h(),children:o===`saving`?r():u()})]}),f?null:(0,X.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:E()}),o===`done`?(0,X.jsx)(`p`,{className:`oc-admin__hint`,role:`status`,children:l()}):null,o===`error`?(0,X.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:S()}):null,(0,X.jsx)(`p`,{className:`oc-cdefaults__help`,children:M()})]})}function ee(){let e=y(p.agentFiles.getChatDefaults),[t,n]=(0,q.useState)({status:`loading`}),r=k(p.admin.listInstances,{}),[l,u]=(0,q.useState)(null);(0,q.useEffect)(()=>{!r||r.length===0||(!l||!r.some(e=>e.name===l))&&u(r[0].name)},[r,l]);let h=(r?.length??0)>1,g=r!==void 0&&r.length===0,_=k(p.compat.forInstance,l?{instanceName:l}:`skip`),x=l?L(_,`configDefaults`):`loading`,S=x===`loading`?null:x.blocked,C=(0,q.useMemo)(()=>h&&l?{instanceName:l}:{},[h,l]),T=(0,q.useRef)(0),E=(0,q.useCallback)(async()=>{let t=++T.current;n({status:`loading`});try{let r=Y(await e(C));if(T.current!==t)return;n({status:`done`,current:r})}catch{if(T.current!==t)return;n({status:`error`})}},[e,C]);(0,q.useEffect)(()=>{S===!1&&(h&&!l||E())},[E,S,h,l]);let D=t.status===`done`?t.current:null,A=(0,q.useMemo)(()=>J.map(e=>({id:e,label:U(e)})),[]),j=(0,q.useMemo)(()=>[{id:`fast`,label:O()},{id:`standard`,label:s()}],[]);return(0,X.jsxs)(`div`,{className:`oc-cdefaults`,children:[(0,X.jsx)(`p`,{className:`oc-admin__hint`,children:N()}),h&&l?(0,X.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,X.jsx)(`span`,{className:`oc-cdefaults__label`,children:b()}),(0,X.jsxs)(H,{value:l,onValueChange:e=>u(e),children:[(0,X.jsx)(B,{size:`sm`,"aria-label":b(),children:(0,X.jsx)(G,{})}),(0,X.jsx)(W,{children:(r??[]).map(e=>(0,X.jsx)(R,{value:e.name,children:e.name},e.name))})]})]}):null,g?(0,X.jsx)(`p`,{className:`oc-admin__hint`,role:`status`,children:v()}):x===`loading`?(0,X.jsx)(`p`,{className:`oc-admin__hint`,children:o()}):x.blocked?(0,X.jsxs)(`p`,{className:`oc-compat__blocked`,role:`status`,children:[(0,X.jsx)(F,{size:14,"aria-hidden":!0}),` `,K(x.gatewayVersion,x.provider)]}):t.status===`loading`?(0,X.jsx)(`p`,{className:`oc-admin__hint`,children:o()}):t.status===`error`?(0,X.jsxs)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:[d(),` `,(0,X.jsx)(P,{variant:`outline`,size:`sm`,onClick:()=>void E(),children:m()})]}):(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,X.jsx)(`span`,{className:`oc-cdefaults__label`,children:f()}),(0,X.jsx)(z,{options:A,value:D?.thinkingDefault??null,onChange:()=>{},disabled:!0}),(0,X.jsx)(`p`,{className:`oc-cdefaults__help`,children:c()})]}),(0,X.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,X.jsx)(`span`,{className:`oc-cdefaults__label`,children:a()}),(0,X.jsx)(z,{options:j,value:D===null||D.fastModeDefault===null?null:D.fastModeDefault?`fast`:`standard`,onChange:()=>{},disabled:!0}),(0,X.jsx)(`p`,{className:`oc-cdefaults__help`,children:i()})]}),(0,X.jsx)(`p`,{className:`oc-cdefaults__note`,children:w()})]}),(()=>{let e=r?.find(e=>e.name===(l??r[0]?.name));return e?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)($,{instance:e}),(0,X.jsx)(Q,{instance:e}),(0,X.jsx)(Z,{instance:e})]}):null})()]})}export{ee as ChatDefaultsTab};
@@ -1 +0,0 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{am as r,em as i,im as a,nm as o,om as s,rm as c,tm as l}from"./dist-CNZ9o3sc.js";import{i as u,r as d}from"./dist-VGy3W8j2.js";import{t as f}from"./chevrons-up-down-ImFHIr_N.js";import{t as p}from"./button-BtQwDeC7.js";import{Bt as m,Ft as h,G as g,J as _,U as v,W as y,Yt as b,m as x,q as S}from"./index-9R1hg_pA.js";import{a as C,i as w,n as T,o as E,r as D,t as O}from"./table-C9PafBK9.js";var k=t(e(),1);function A(e,t){return typeof e==`number`&&typeof t==`number`?e-t:typeof e==`boolean`&&typeof t==`boolean`?!!e-+!!t:String(e).localeCompare(String(t),void 0,{numeric:!0,sensitivity:`base`})}function j(e,t,n){return[...e].sort((e,r)=>{let i=t(e),a=t(r),o=i==null,s=a==null;if(o||s)return o&&s?0:o?1:-1;let c=A(i,a);return n===`asc`?c:-c})}var M=n();function N({title:e,rows:t,columns:n,rowActions:A,onAdd:N,addLabel:P=s(),bulkActions:F,emptyHint:I=r(),isExpanded:L,renderExpanded:R}){let[z,B]=(0,k.useState)(new Set),[V,H]=(0,k.useState)(null),U=t??[],W=V?n[V.index]:void 0,G=V&&W?.sort?j(U,W.sort,V.dir):U;function K(e){H(t=>!t||t.index!==e?{index:e,dir:`asc`}:t.dir===`asc`?{index:e,dir:`desc`}:null)}let q=+!!F+n.length+ +!!A,J=U.length>0&&z.size===U.length,Y=z.size>0&&!J;function X(){B(J?new Set:new Set(U.map(e=>e._id)))}function Z(e){B(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})}return(0,M.jsxs)(`div`,{className:`oc-dt`,children:[(0,M.jsxs)(`div`,{className:`oc-dt__bar`,children:[(0,M.jsx)(`h2`,{className:`oc-dt__title`,children:e}),(0,M.jsxs)(`div`,{className:`oc-dt__bar-actions`,children:[z.size>0&&F?F.map(e=>(0,M.jsxs)(p,{size:`sm`,variant:e.variant===`destructive`?`destructive`:`outline`,onClick:()=>{e.onSelect([...z]),B(new Set)},children:[e.variant===`destructive`?(0,M.jsx)(h,{}):null,e.label,` (`,z.size,`)`]},e.label)):null,N?(0,M.jsxs)(p,{size:`sm`,onClick:N,children:[(0,M.jsx)(m,{}),` `,P]}):null]})]}),t===void 0?(0,M.jsx)(`p`,{className:`oc-admin__hint`,children:a()}):U.length===0?(0,M.jsx)(`p`,{className:`oc-admin__hint`,children:I}):(0,M.jsxs)(O,{children:[(0,M.jsx)(C,{children:(0,M.jsxs)(E,{children:[F?(0,M.jsx)(w,{className:`w-8`,children:(0,M.jsx)(x,{"aria-label":c(),checked:J?!0:Y?`indeterminate`:!1,onCheckedChange:X})}):null,n.map((e,t)=>{let n=V?.index===t;return e.sort?(0,M.jsx)(w,{className:e.className,"aria-sort":n?V.dir===`asc`?`ascending`:`descending`:`none`,children:(0,M.jsxs)(`button`,{type:`button`,className:`oc-dt__sort`,onClick:()=>K(t),"aria-label":i({column:e.header}),children:[e.header,n?V.dir===`asc`?(0,M.jsx)(d,{className:`oc-dt__sort-icon`,"aria-hidden":!0}):(0,M.jsx)(u,{className:`oc-dt__sort-icon`,"aria-hidden":!0}):(0,M.jsx)(f,{className:`oc-dt__sort-icon oc-dt__sort-icon--idle`,"aria-hidden":!0})]})},e.header):(0,M.jsx)(w,{className:e.className,children:e.header},e.header)}),A?(0,M.jsx)(w,{className:`w-8`}):null]})}),(0,M.jsx)(T,{children:G.map(e=>{let t=A?.(e)??[],r=L?.(e)??!1;return(0,M.jsxs)(k.Fragment,{children:[(0,M.jsxs)(E,{className:`group/row`,children:[F?(0,M.jsx)(D,{children:(0,M.jsx)(x,{"aria-label":o(),checked:z.has(e._id),onCheckedChange:()=>Z(e._id)})}):null,n.map(t=>(0,M.jsx)(D,{className:t.className,children:t.cell(e)},t.header)),A?(0,M.jsx)(D,{children:t.length>0?(0,M.jsxs)(v,{children:[(0,M.jsx)(_,{asChild:!0,children:(0,M.jsx)(p,{variant:`ghost`,size:`icon-sm`,"aria-label":l(),className:`opacity-0 transition-opacity group-hover/row:opacity-100 group-focus-within/row:opacity-100 aria-expanded:opacity-100`,children:(0,M.jsx)(b,{})})}),(0,M.jsx)(y,{align:`end`,children:t.map((t,n)=>(0,M.jsxs)(`div`,{children:[t.variant===`destructive`&&n>0?(0,M.jsx)(S,{}):null,(0,M.jsx)(g,{variant:t.variant,onSelect:()=>t.onSelect(e),children:t.label})]},t.label))})]}):null}):null]}),r&&R?(0,M.jsx)(E,{className:`oc-dt__expansion`,children:(0,M.jsx)(D,{colSpan:q,className:`oc-dt__expansion-cell`,children:R(e)})}):null]},e._id)})})]})]})}export{N as t};
@@ -1 +0,0 @@
1
- import{r as e}from"./bundle-mjs-C73ZY4La.js";import{Y as t}from"./index-9R1hg_pA.js";var n=e();function r({icon:e,total:r,items:i}){if(r===0)return(0,n.jsxs)(t,{variant:`outline`,className:`oc-group-chip oc-group-chip--empty gap-1`,children:[e,`0`]});let a=r-i.length;return(0,n.jsxs)(`div`,{className:`oc-group-detail`,children:[i.map((e,r)=>(0,n.jsxs)(t,{variant:e.highlight?`secondary`:`outline`,className:`oc-group-chip gap-1`,title:e.label,children:[e.marker,(0,n.jsx)(`span`,{className:`oc-group-chip__txt`,children:e.label})]},r)),a>0?(0,n.jsxs)(t,{variant:`outline`,className:`oc-group-chip`,children:[`+`,a]}):null]})}export{r as t};
@@ -1 +0,0 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$w as r,Aw as i,Bw as a,CT as o,Ca as s,DT as c,Dw as l,ET as u,Fw as d,Gw as f,Hw as p,Iw as m,Jw as ee,Kw as te,Lw as h,Mw as g,Nw as _,OT as v,Ow as ne,Pw as re,Qw as ie,Rw as ae,ST as y,T as b,TT as x,Uw as S,Vw as C,Ww as w,Xw as T,Yw as E,Zw as D,_T as O,aT as k,bT as A,cT as j,dT as M,eT as N,fT as P,gT as F,hT as I,iT as L,jw as R,kT as z,kw as B,lT as V,mT as H,nI as U,nT as W,oT as G,pT as K,qw as q,rI as J,rT as oe,sT as se,tT as ce,uT as le,vT as ue,wT as de,xT as fe,xa as pe,yT as me,zw as he}from"./dist-CNZ9o3sc.js";import{t as ge}from"./button-BtQwDeC7.js";import{A as _e,V as Y}from"./index-9R1hg_pA.js";import{t as ve}from"./DataTableShell-zzaGmfMk.js";var X=t(e(),1),Z=n(),ye={altered_words:()=>z(),incorrect:()=>v(),incoherence:()=>c(),formatting:()=>u(),latency:()=>x(),api_error:()=>de(),other:()=>o()},Q=e=>ye[e]?.()??e;function $({matches:e,sourceWasOpen:t}){return t?e===!0?(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-ok`,children:fe()}):e===!1?(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-warn`,children:A()}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill`,children:`—`}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill`,children:y()})}function be({data:e,reference:t,closeReason:n}){let i=e.snapshot,a=U(b.feedback.respondToFeedback),[o,c]=(0,X.useState)(e.thread),[l,u]=(0,X.useState)(``),[d,f]=(0,X.useState)(!1);async function p(){let t=l.trim();if(!(!t||d)){f(!0);try{await a({feedbackId:e._id,text:t}),c(e=>[...e,{authorRole:`admin`,text:t,at:Date.now()}]),u(``)}finally{f(!1)}}}let m=[];try{m=i.contextJson?JSON.parse(i.contextJson):[]}catch{m=[]}return(0,Z.jsxs)(`div`,{className:`oc-fbadmin__detail`,children:[(0,Z.jsxs)(`div`,{className:`oc-fbadmin__row`,children:[(0,Z.jsx)($,{matches:i.displayedMatchesStored,sourceWasOpen:i.clientInfo?.sourceWasOpen??!1}),(0,Z.jsxs)(`span`,{className:`oc-fbadmin__meta`,children:[Q(e.category),` · `,i.messageRole,i.isRegeneration?` · ${me()}`:``,i.openclawModel?` · ${i.openclawModel}`:``,i.openclawRuntime?` (${i.openclawRuntime})`:``]}),t?(0,Z.jsx)(`code`,{className:`oc-fbadmin__ref`,style:{userSelect:`all`,marginLeft:`auto`},title:q(),children:t}):null]}),e.comment?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:ue()}),(0,Z.jsx)(`p`,{className:`oc-fbadmin__comment`,children:e.comment})]}):null,n?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:_()}),(0,Z.jsx)(`p`,{className:`oc-fbadmin__comment`,children:n})]}):null,(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:O()}),o.length>0?(0,Z.jsx)(`div`,{className:`oc-fbadmin__thread`,children:o.map((e,t)=>(0,Z.jsxs)(`div`,{className:`oc-notif__msg oc-notif__msg--${e.authorRole}`,children:[(0,Z.jsx)(`span`,{className:`oc-notif__msg-who`,children:e.authorRole===`admin`?F():e.authorRole===`agent`?e.authorLabel??s():I()}),(0,Z.jsx)(`span`,{className:`oc-notif__msg-text`,children:e.text})]},t))}):(0,Z.jsx)(`p`,{className:`oc-fbadmin__meta`,children:H()}),(0,Z.jsx)(`textarea`,{className:`oc-feedback__textarea`,placeholder:K(),value:l,maxLength:2e3,rows:3,onChange:e=>u(e.target.value.slice(0,2e3))}),(0,Z.jsx)(`div`,{className:`oc-fbadmin__row`,style:{justifyContent:`flex-end`},children:(0,Z.jsx)(ge,{size:`sm`,onClick:()=>void p(),disabled:!l.trim()||d,children:d?P():M()})})]}),(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:le()}),(0,Z.jsx)(`pre`,{className:`oc-msg__source-pre`,children:i.messageText||V()})]}),i.clientInfo?.sourceWasOpen&&i.displayedText!==void 0?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:j()}),(0,Z.jsx)(`pre`,{className:`oc-msg__source-pre`,children:i.displayedText||V()})]}):null,i.promptText?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:se()}),(0,Z.jsx)(`pre`,{className:`oc-msg__source-pre`,children:i.promptText})]}):null,m.length>0?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:G({count:i.contextCount??m.length,truncated:i.contextTruncated?k():``})}),(0,Z.jsx)(`div`,{className:`oc-fbadmin__ctx`,children:m.map((e,t)=>(0,Z.jsxs)(`div`,{className:`oc-fbadmin__ctx-turn`,children:[(0,Z.jsx)(`span`,{className:`oc-fbadmin__ctx-role`,children:e.role}),(0,Z.jsx)(`span`,{className:`oc-fbadmin__ctx-text`,children:e.text})]},t))})]}):null,i.outboxAvailable?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:L()}),(0,Z.jsxs)(`pre`,{className:`oc-msg__source-pre`,children:[i.outboxText??``,i.outboxStatus?`\n[status: ${i.outboxStatus}]`:``]})]}):null,i.clientInfo?.extensionsDetected&&i.clientInfo.extensionsDetected.length>0?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:oe()}),(0,Z.jsx)(`div`,{className:`oc-fbadmin__row`,children:i.clientInfo.extensionsDetected.map(e=>(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-warn`,children:e},e))})]}):null,(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:W()}),(0,Z.jsxs)(`p`,{className:`oc-fbadmin__env`,children:[[i.clientInfo?.language,i.clientInfo?.timezone,i.clientInfo?.theme?ce({theme:i.clientInfo.theme}):null,i.runId?`run ${i.runId.slice(0,12)}…`:null].filter(Boolean).join(` · `)||`—`,i.clientInfo?.plugins&&i.clientInfo.plugins.length>0?(0,Z.jsxs)(`span`,{className:`oc-fbadmin__plugins`,children:[N(),` `,i.clientInfo.plugins.join(`, `),(0,Z.jsxs)(`span`,{className:`oc-fbadmin__note`,children:[` `,r()]})]}):null,i.clientInfo?.userAgent?(0,Z.jsx)(`span`,{className:`oc-fbadmin__ua`,children:i.clientInfo.userAgent}):null]})]})]})}function xe(){let e=J(b.feedback.listForAdmin,{}),t=U(b.feedback.readSnapshot),n=U(b.feedback.deleteFeedback),r=_e(),[o,s]=(0,X.useState)(null),[c,u]=(0,X.useState)({});async function _(e){if(o===e._id){s(null);return}if(!c[e._id]){let n=await t({feedbackId:e._id});u(t=>({...t,[e._id]:n}))}s(e._id)}async function v(e){await r({title:B(),description:ne(),confirmLabel:l(),destructive:!0})&&(await n({feedbackId:e._id}),o===e._id&&s(null))}return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`p`,{className:`oc-admin__hint`,children:[ie(),` `,(0,Z.jsx)(`strong`,{children:D()}),` `,T()]}),(0,Z.jsx)(ve,{title:E(),rows:e,emptyHint:ee(),isExpanded:e=>o===e._id&&!!c[e._id],renderExpanded:e=>c[e._id]?(0,Z.jsx)(be,{data:c[e._id],reference:e.reference,closeReason:e.userCloseReason}):null,columns:[{header:te(),cell:e=>Y(e.at),sort:e=>e.at},{header:f(),cell:e=>Q(e.category),sort:e=>Q(e.category)},{header:w(),cell:e=>e.messageRole===`user`?S():p(),sort:e=>e.messageRole},{header:C(),cell:e=>(e.reporterEmail||e.reporterName||`—`)+(e.impersonated&&e.realOperatorEmail?` ${a({operator:e.realOperatorEmail})}`:``),sort:e=>e.reporterEmail||e.reporterName||null},{header:he(),cell:e=>(0,Z.jsx)($,{matches:e.displayedMatchesStored,sourceWasOpen:e.sourceWasOpen}),sort:e=>e.displayedMatchesStored===!1?0:e.displayedMatchesStored===!0?1:2},{header:ae(),cell:e=>e.hasComment?`✎`:`—`,sort:e=>+!!e.hasComment},{header:h(),cell:e=>e.userClosedAt==null?e.resolvedAt==null?e.answered?(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-ok`,children:m()}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill`,children:d()}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-ok`,title:e.resolvedBy??void 0,children:pe()}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-closed`,children:re()}),sort:e=>e.userClosedAt==null?e.resolvedAt==null?+!!e.answered:2:3}],rowActions:e=>[{label:o===e._id?g():R(),onSelect:()=>void _(e)},{label:i(),onSelect:()=>void v(e),variant:`destructive`}]})]})}export{xe as FeedbacksTab};
@@ -1 +0,0 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$P as r,BP as ee,Da as i,Ea as te,GP as ne,HP as re,JF as ie,JP as a,KP as ae,QP as o,T as s,UP as c,VP as l,WP as u,XF as d,XP as oe,YP as se,ZP as ce,_F as f,aF as p,bF as le,cF as m,dF as ue,eF as de,fF as fe,gF as pe,hF as me,iF as h,kO as he,lF as g,mF as ge,nF as _e,nI as ve,oF as _,pF as ye,qP as be,rF as xe,rI as v,sF as y,tF as b,uF as x,vF as S,xF as C,yF as w}from"./dist-CNZ9o3sc.js";import{t as T}from"./button-BtQwDeC7.js";import{F as E,Ft as D,G as O,I as k,J as A,L as j,M,N as Se,P as Ce,R as we,U as Te,W as Ee,Xt as N,Y as P,Yt as De,ct as F,lt as I,m as Oe,ot as L,st as R,ut as z,wt as ke,z as Ae,zt as je}from"./index-9R1hg_pA.js";import{a as Me,i as B,n as Ne,o as V,r as H,t as Pe}from"./table-C9PafBK9.js";var U=t(e(),1),W=n(),G=`all`;function K(e){switch(e){case`image`:return x();case`audio`:return g();case`video`:return m();case`pdf`:return y();case`document`:return _();case`archive`:return p();default:return h()}}function q(){let[e,t]=(0,U.useState)(G),[n,p]=(0,U.useState)(G),[m,h]=(0,U.useState)(G),[g,_]=(0,U.useState)(G),[y,x]=(0,U.useState)(!1),[q,J]=(0,U.useState)(null),Fe=ve(s.files.softDelete),Y=ke();function Ie(){t(G),p(G),h(G),_(G)}async function Le(){let e=q;if(J(null),e)try{await Fe({fileId:e.id}),Y.success(be())}catch(e){Y.error(ae(),e)}}let X=v(s.files.listMine,{direction:e===G?void 0:e,chatId:n===G?void 0:n,instanceName:m===G?void 0:m,category:g===G?void 0:g,includeAutoGenerated:y||void 0}),Re=(0,U.useMemo)(()=>new Intl.DateTimeFormat(d(),{dateStyle:`medium`,timeStyle:`short`}),[]);if(X===void 0)return(0,W.jsx)(`p`,{className:`oc-admin__hint`,children:ie()});let{files:Z,facets:Q,truncated:ze,cap:Be}=X,$=e!==G||n!==G||m!==G||g!==G;return(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`p`,{className:`oc-admin__hint`,children:C()}),(0,W.jsxs)(`div`,{className:`oc-files__filters`,style:{display:`flex`,flexWrap:`wrap`,gap:8,margin:`12px 0`},children:[(0,W.jsxs)(L,{value:e,onValueChange:t,children:[(0,W.jsx)(I,{size:`sm`,"aria-label":le(),children:(0,W.jsx)(z,{})}),(0,W.jsxs)(R,{children:[(0,W.jsx)(F,{value:G,children:w()}),(0,W.jsx)(F,{value:`inbound`,children:S()}),(0,W.jsx)(F,{value:`outbound`,children:f()})]})]}),(0,W.jsxs)(L,{value:n,onValueChange:p,children:[(0,W.jsx)(I,{size:`sm`,"aria-label":pe(),children:(0,W.jsx)(z,{})}),(0,W.jsxs)(R,{children:[(0,W.jsx)(F,{value:G,children:me()}),Q.chats.map(e=>(0,W.jsx)(F,{value:e.id,children:e.title},e.id))]})]}),Q.multiProvider?(0,W.jsxs)(L,{value:m,onValueChange:h,children:[(0,W.jsx)(I,{size:`sm`,"aria-label":ge(),children:(0,W.jsx)(z,{})}),(0,W.jsxs)(R,{children:[(0,W.jsx)(F,{value:G,children:ye()}),Q.instances.map(e=>(0,W.jsx)(F,{value:e,children:e},e))]})]}):null,(0,W.jsxs)(L,{value:g,onValueChange:_,children:[(0,W.jsx)(I,{size:`sm`,"aria-label":fe(),children:(0,W.jsx)(z,{})}),(0,W.jsxs)(R,{children:[(0,W.jsx)(F,{value:G,children:ue()}),Q.categories.map(e=>(0,W.jsx)(F,{value:e,children:K(e)},e))]})]}),(0,W.jsxs)(`label`,{className:`oc-files__autogen`,children:[(0,W.jsx)(Oe,{checked:y,onCheckedChange:e=>x(e===!0),"aria-label":i()}),(0,W.jsx)(`span`,{children:i()})]}),$?(0,W.jsxs)(T,{variant:`ghost`,size:`sm`,onClick:Ie,style:{display:`inline-flex`,alignItems:`center`,gap:4,marginLeft:`auto`},children:[(0,W.jsx)(je,{size:14,"aria-hidden":!0}),oe()]}):null]}),Z.length===0?(0,W.jsx)(`p`,{className:`oc-admin__hint`,children:$?l():re()}):(0,W.jsxs)(W.Fragment,{children:[(0,W.jsxs)(Pe,{children:[(0,W.jsx)(Me,{children:(0,W.jsxs)(V,{children:[(0,W.jsx)(B,{children:xe()}),(0,W.jsx)(B,{children:_e()}),(0,W.jsx)(B,{children:b()}),(0,W.jsx)(B,{children:de()}),(0,W.jsx)(B,{children:r()}),(0,W.jsx)(B,{className:`text-right`,children:o()})]})}),(0,W.jsx)(Ne,{children:Z.map(e=>(0,W.jsxs)(V,{children:[(0,W.jsxs)(H,{className:`font-medium`,style:{maxWidth:280,overflow:`hidden`,textOverflow:`ellipsis`},title:e.filename,children:[e.filename,e.origin===`pasted`?(0,W.jsx)(P,{variant:`outline`,style:{marginLeft:6},children:te()}):null]}),(0,W.jsx)(H,{title:e.mimeType,children:K(e.category)}),(0,W.jsx)(H,{children:(0,W.jsx)(P,{variant:`secondary`,children:e.direction===`inbound`?S():f()})}),(0,W.jsx)(H,{style:{maxWidth:220,overflow:`hidden`,textOverflow:`ellipsis`},title:e.chatTitle,children:e.chatTitle}),(0,W.jsx)(H,{className:`whitespace-nowrap text-muted-foreground`,children:Re.format(e.createdAt)}),(0,W.jsx)(H,{className:`text-right`,children:(0,W.jsxs)(Te,{children:[(0,W.jsx)(A,{asChild:!0,children:(0,W.jsx)(T,{variant:`ghost`,size:`icon`,"aria-label":se(),children:(0,W.jsx)(De,{size:16})})}),(0,W.jsxs)(Ee,{align:`end`,children:[e.url?(0,W.jsx)(O,{asChild:!0,children:(0,W.jsxs)(`a`,{href:e.url,download:e.filename,target:`_blank`,rel:`noopener noreferrer`,children:[(0,W.jsx)(N,{size:14}),ce()]})}):(0,W.jsxs)(O,{disabled:!0,children:[(0,W.jsx)(N,{size:14}),c()]}),(0,W.jsxs)(O,{variant:`destructive`,onSelect:()=>J({id:e._id,filename:e.filename}),children:[(0,W.jsx)(D,{size:14}),a()]})]})]})})]},e._id))})]}),ze?(0,W.jsx)(`p`,{className:`oc-admin__hint`,style:{marginTop:8},children:ee({cap:Be})}):null]}),(0,W.jsx)(M,{open:q!==null,onOpenChange:e=>!e&&J(null),children:(0,W.jsxs)(E,{children:[(0,W.jsxs)(we,{children:[(0,W.jsx)(Ae,{children:ne()}),(0,W.jsx)(k,{children:u()})]}),(0,W.jsxs)(j,{children:[(0,W.jsx)(Ce,{children:he()}),(0,W.jsx)(Se,{onClick:()=>void Le(),children:a()})]})]})})]})}export{q as FilesTab};
@@ -1 +0,0 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{cm as r,sm as i}from"./dist-CNZ9o3sc.js";import{t as a}from"./button-BtQwDeC7.js";import{Rt as o,X as s,zt as c}from"./index-9R1hg_pA.js";import{t as l}from"./TimeRangePicker-BPVkrNZN.js";var u=t(e(),1),d=n(),f=250;function p({q:e,onQChange:t,searchPlaceholder:n=r(),children:p,timeRange:m,onTimeRangeChange:h,onReset:g,canReset:_=!0}){let[v,y]=(0,u.useState)(e);(0,u.useEffect)(()=>{y(e)},[e]);let b=(0,u.useRef)(null);function x(e){y(e),b.current!==null&&window.clearTimeout(b.current),b.current=window.setTimeout(()=>t(e),f)}(0,u.useEffect)(()=>()=>{b.current!==null&&window.clearTimeout(b.current)},[]);function S(){b.current!==null&&window.clearTimeout(b.current),g()}return(0,d.jsxs)(`div`,{className:`oc-filterbar`,children:[(0,d.jsxs)(`div`,{className:`oc-filterbar__search`,children:[(0,d.jsx)(o,{className:`oc-filterbar__search-icon`,"aria-hidden":!0}),(0,d.jsx)(s,{value:v,onChange:e=>x(e.target.value),placeholder:n,"aria-label":n})]}),p?(0,d.jsx)(`div`,{className:`oc-filterbar__quick`,children:p}):null,m&&h?(0,d.jsx)(l,{value:m,onChange:h}):null,(0,d.jsxs)(a,{variant:`ghost`,size:`sm`,className:`oc-filterbar__reset`,onClick:S,disabled:!_,children:[(0,d.jsx)(c,{}),i()]})]})}export{p as t};
@@ -1 +0,0 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$d as r,Ad as i,Bd as a,Cd as o,D as s,Dd as c,Ed as l,Fd as u,Gd as d,Hd as f,Id as p,Jd as m,Kd as h,Ld as g,Md as _,Nd as v,Od as y,Pd as b,Qd as x,Rd as S,Sd as C,T as w,Td as T,Ud as ee,Vd as E,Wd as te,Xd as ne,Yd as re,Zd as ie,_d as ae,_f as D,af as O,bd as oe,bf as k,cf as A,dd as j,df as M,ef as N,fd as se,ff as P,gd as ce,gf as le,hd as F,hf as I,if as ue,jd as L,kd as de,lf as fe,md as pe,mf as me,nI as R,nf as he,of as ge,pd as _e,pf as ve,qd as ye,rI as z,rf as be,sf as xe,tf as Se,uf as Ce,vd as we,vf as Te,wd as Ee,xd as De,yd as Oe,yf as ke,zd as Ae}from"./dist-CNZ9o3sc.js";import{t as je}from"./x-BR1chqO3.js";import{i as B,n as V,r as Me,t as Ne}from"./tabs-CQ2rDwF5.js";import{t as H}from"./button-BtQwDeC7.js";import{$ as Pe,A as Fe,It as U,Lt as W,Q as Ie,X as G,Y as K,Z as Le,ct as Re,d as ze,en as Be,gt as Ve,lt as He,m as q,nt as Ue,ot as We,st as Ge,tn as Ke,tt as qe,ut as Je,wt as J}from"./index-9R1hg_pA.js";import{t as Ye}from"./FilterBar-DRRfKRTQ.js";import{t as Xe}from"./DataTableShell-zzaGmfMk.js";import{t as Y}from"./DetailChips-DNNrvZqq.js";var Ze=s(`palette`,[[`path`,{d:`M12 22a1 1 0 0 1 0-20 10 9 0 0 1 10 9 5 5 0 0 1-5 5h-2.25a1.75 1.75 0 0 0-1.4 2.8l.3.4a1.75 1.75 0 0 1-1.4 2.8z`,key:`e79jfc`}],[`circle`,{cx:`13.5`,cy:`6.5`,r:`.5`,fill:`currentColor`,key:`1okk4w`}],[`circle`,{cx:`17.5`,cy:`10.5`,r:`.5`,fill:`currentColor`,key:`f64h9f`}],[`circle`,{cx:`6.5`,cy:`12.5`,r:`.5`,fill:`currentColor`,key:`qy21gx`}],[`circle`,{cx:`8.5`,cy:`7.5`,r:`.5`,fill:`currentColor`,key:`fotxhn`}]]),X=s(`shield-check`,[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`,key:`oel41y`}],[`path`,{d:`m9 12 2 2 4-4`,key:`dzmm74`}]]),Qe=s(`users`,[[`path`,{d:`M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2`,key:`1yyitq`}],[`path`,{d:`M16 3.128a4 4 0 0 1 0 7.744`,key:`16gr8j`}],[`path`,{d:`M22 21v-2a4 4 0 0 0-3-3.87`,key:`kshegd`}],[`circle`,{cx:`9`,cy:`7`,r:`4`,key:`nufk8`}]]),Z=t(e(),1);function $e(e,t,n){let r=t.trim().toLowerCase();return[...r?e.filter(e=>[e.email,e.name,e.canonical].some(e=>e!=null&&e.toLowerCase().includes(r))):e.slice()].sort((e,t)=>!n.has(e.userId)-+!n.has(t.userId))}function et(e,t){let n=e.filter(e=>e.source===`discovered`),r=t.trim().toLowerCase();return r?n.filter(e=>(e.displayName??e.agentId).toLowerCase().includes(r)||e.agentId.toLowerCase().includes(r)):n}function tt(e){let t=e.name?.trim()??``,n=e.email?.trim()??``,r=e.canonical?.trim()||`u-${e.userId.slice(0,8)}`;return t?{primary:t,secondary:n||`@${r}`}:n?{primary:n,secondary:null}:{primary:`@${r}`,secondary:null}}function nt(e){switch(e){case`admin`:return E();case`user`:return a();case`pending`:return Ae();default:return e}}function rt(e,t){if(e.length===0)return`none`;let n=0;for(let r of e)t(r)&&n++;return n===0?`none`:n===e.length?`all`:`some`}function it(e,t,n){let r=Math.max(1,Math.ceil(e.length/n)),i=Math.min(Math.max(1,Math.floor(t)),r),a=(i-1)*n;return{pageItems:e.slice(a,a+n),page:i,pageCount:r}}var Q=n(),$={name:``,description:``};function at(){let e=z(w.groups.listGroups,{}),t=z(w.me.getMe,{host:Ve})?.role===`admin`,n=R(w.groups.createGroup),i=R(w.groups.updateGroup),a=R(w.groups.deleteGroup),o=Fe(),s=J(),[c,l]=(0,Z.useState)(!1),[u,d]=(0,Z.useState)(null),[f,p]=(0,Z.useState)($),[m,h]=(0,Z.useState)(null),[g,_]=(0,Z.useState)(``),v=(0,Z.useMemo)(()=>{if(!e)return e;let t=g.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,g]);function y(){d(null),p($),l(!0)}function b(e){d(e),p({name:e.name,description:e.description??``}),l(!0)}async function x(){try{u?await i({groupId:u._id,name:f.name,description:f.description}):await n({name:f.name,description:f.description||void 0}),p($),d(null),l(!1)}catch(e){s.error(pe(),e)}}async function S(e){if(await o({title:Se({name:e.name}),description:N(),confirmWord:e.name,confirmLabel:r(),cancelLabel:xe(),destructive:!0}))try{await a({groupId:e._id})}catch(e){s.error(_e(),e)}}return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:ke()}),(0,Q.jsx)(Ye,{q:g,onQChange:_,onReset:()=>_(``),canReset:g!==``,searchPlaceholder:P()}),(0,Q.jsx)(Xe,{title:k(),rows:v,addLabel:Te(),onAdd:t?y:void 0,emptyHint:D(),columns:[{header:le(),cell:e=>e.name,sort:e=>e.name},{header:I(),cell:e=>(0,Q.jsx)(Y,{icon:(0,Q.jsx)(Qe,{size:12,"aria-hidden":!0}),total:e.memberCount,items:e.members.map(e=>({label:e.label,marker:e.manager?(0,Q.jsx)(X,{size:11,"aria-hidden":!0}):null,highlight:e.manager}))}),sort:e=>e.memberCount},{header:me(),cell:e=>(0,Q.jsx)(Y,{icon:(0,Q.jsx)(W,{size:12,"aria-hidden":!0}),total:e.agentCount,items:e.agents.map(e=>({label:e}))}),sort:e=>e.agentCount},{header:ve(),cell:e=>(0,Q.jsx)(Y,{icon:(0,Q.jsx)(Ze,{size:12,"aria-hidden":!0}),total:e.chartCount,items:e.charts.map(e=>({label:e.name,marker:e.isDefault?(0,Q.jsx)(U,{size:11,fill:`currentColor`,"aria-hidden":!0}):null,highlight:e.isDefault}))}),sort:e=>e.chartCount}],rowActions:e=>[{label:M(),onSelect:()=>h({groupId:e._id,name:e.name})},...t?[{label:Ce(),onSelect:()=>b(e)},{label:fe(),variant:`destructive`,onSelect:()=>void S(e)}]:[]]}),(0,Q.jsx)(ze,{open:c,onOpenChange:l,title:u?O():ge(),description:ue(),canSubmit:!!f.name.trim(),onSubmit:x,submitLabel:A(),children:(0,Q.jsxs)(`div`,{className:`oc-form`,children:[(0,Q.jsxs)(`label`,{className:`oc-field`,children:[(0,Q.jsx)(`span`,{className:`oc-field__label`,children:be()}),(0,Q.jsx)(G,{value:f.name,onChange:e=>p({...f,name:e.target.value})})]}),(0,Q.jsxs)(`label`,{className:`oc-field`,children:[(0,Q.jsx)(`span`,{className:`oc-field__label`,children:he()}),(0,Q.jsx)(G,{value:f.description,onChange:e=>p({...f,description:e.target.value})})]})]})}),(0,Q.jsx)(ct,{groupId:m?.groupId??null,groupName:m?.name??``,open:m!==null,onOpenChange:e=>{e||h(null)}})]})}var ot=8;function st({page:e,pageCount:t,onPage:n}){return t<=1?null:(0,Q.jsxs)(`div`,{className:`oc-access__pager`,children:[(0,Q.jsxs)(H,{type:`button`,variant:`ghost`,size:`sm`,disabled:e<=1,onClick:()=>n(e-1),children:[(0,Q.jsx)(Ke,{size:14,"aria-hidden":!0}),te()]}),(0,Q.jsxs)(`span`,{className:`oc-access__pageinfo`,"aria-label":f({page:e,pages:t}),children:[e,` / `,t]}),(0,Q.jsxs)(H,{type:`button`,variant:`ghost`,size:`sm`,disabled:e>=t,onClick:()=>n(e+1),children:[ee(),(0,Q.jsx)(Be,{size:14,"aria-hidden":!0})]})]})}function ct({groupId:e,groupName:t,open:n,onOpenChange:r}){let i=z(w.groups.getGroup,n&&e?{groupId:e}:`skip`),a=z(w.groups.listAssignableInstances,n?{}:`skip`),o=z(w.groups.listAssignableUsers,n?{}:`skip`),s=R(w.groups.addMember),l=R(w.groups.removeMember),u=R(w.groups.bulkSetMembers),f=R(w.groups.setGroupManager),g=J(),[_,y]=(0,Z.useState)(``),[C,T]=(0,Z.useState)(``),[ee,E]=(0,Z.useState)(`members`),[te,D]=(0,Z.useState)(1),[O,oe]=(0,Z.useState)(new Set),k=(0,Z.useRef)(null),A=(0,Z.useMemo)(()=>new Set((i?.members??[]).map(e=>e.userId)),[i]),j=(0,Z.useMemo)(()=>new Set((i?.members??[]).filter(e=>e.manager).map(e=>e.userId)),[i]),M=i?.viewerIsAdmin===!0,N=(0,Z.useMemo)(()=>new Set((i?.agents??[]).map(e=>`${e.instanceName}/${e.agentId}`)),[i]);(0,Z.useEffect)(()=>{y(``),T(``),E(`members`),D(1),k.current=null},[n,e]),(0,Z.useEffect)(()=>{D(1)},[_]),(0,Z.useEffect)(()=>{n&&i&&e&&k.current!==e&&(k.current=e,oe(new Set((i.members??[]).map(e=>e.userId))))},[n,i,e]);let P=(0,Z.useMemo)(()=>o?$e(o,_,O):[],[o,_,O]);async function le(t,n){if(e)try{n?await l({groupId:e,userId:t}):await s({groupId:e,userId:t})}catch(e){g.error(se(),e)}}async function F(t,n){if(e)try{await f({groupId:e,userId:t,manager:!n})}catch(e){g.error(ce(),e)}}let I=rt(P,e=>A.has(e.userId)),ue=P.filter(e=>A.has(e.userId)).length,L=it(P,te,ot);async function de(){if(!e||P.length===0)return;let t=P.map(e=>e.userId);try{await u({groupId:e,userIds:t,member:I!==`all`})}catch(e){g.error(se(),e)}}return(0,Q.jsx)(Le,{open:n,onOpenChange:r,children:(0,Q.jsxs)(Ie,{className:`oc-access`,children:[(0,Q.jsxs)(qe,{children:[(0,Q.jsx)(Ue,{children:x({name:t})}),(0,Q.jsx)(Pe,{children:ie()})]}),(0,Q.jsxs)(Ne,{value:ee,onValueChange:E,className:`oc-access__tabs`,children:[(0,Q.jsxs)(Me,{className:`w-full`,children:[(0,Q.jsxs)(B,{value:`members`,className:`flex-1 gap-1.5`,children:[(0,Q.jsx)(Qe,{size:13,"aria-hidden":!0}),ne(),i?(0,Q.jsx)(K,{variant:`secondary`,className:`oc-access__tabcount`,children:A.size}):null]}),(0,Q.jsxs)(B,{value:`agents`,className:`flex-1 gap-1.5`,children:[(0,Q.jsx)(W,{size:13,"aria-hidden":!0}),m(),i?(0,Q.jsx)(K,{variant:`secondary`,className:`oc-access__tabcount`,children:N.size}):null]}),(0,Q.jsxs)(B,{value:`charts`,className:`flex-1 gap-1.5`,children:[(0,Q.jsx)(Ze,{size:13,"aria-hidden":!0}),c(),i?(0,Q.jsx)(K,{variant:`secondary`,className:`oc-access__tabcount`,children:i.chartCount}):null]})]}),(0,Q.jsx)(V,{value:`members`,children:o===void 0||i===void 0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:p()}):o.length===0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:b()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(G,{value:_,onChange:e=>y(e.target.value),placeholder:re(),className:`oc-access__search`}),P.length===0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:h()}):(0,Q.jsxs)(Q.Fragment,{children:[P.length>1?(0,Q.jsxs)(`div`,{className:`oc-access__row oc-access__selectall`,children:[(0,Q.jsx)(q,{checked:I===`all`?!0:I===`some`?`indeterminate`:!1,onCheckedChange:()=>void de(),"aria-label":d()}),(0,Q.jsx)(`span`,{className:`oc-access__label`,children:d()}),(0,Q.jsxs)(K,{variant:`outline`,className:`oc-access__count`,children:[ue,` / `,P.length]})]}):null,(0,Q.jsx)(`div`,{className:`oc-access__list`,children:L.pageItems.map(e=>{let t=A.has(e.userId),n=tt(e),r=j.has(e.userId);return(0,Q.jsxs)(`div`,{className:`oc-access__row`,children:[(0,Q.jsx)(q,{checked:t,onCheckedChange:()=>void le(e.userId,t),"aria-label":S({user:n.primary})}),(0,Q.jsxs)(`span`,{className:`oc-access__who`,children:[(0,Q.jsx)(`span`,{className:`oc-access__label`,title:n.primary,children:n.primary}),n.secondary?(0,Q.jsx)(`span`,{className:`oc-access__sub`,title:n.secondary,children:n.secondary}):null]}),(0,Q.jsx)(K,{variant:`outline`,className:`oc-access__role`,children:nt(e.role)}),(0,Q.jsx)(`span`,{className:`oc-access__mgrslot`,children:t&&M?(0,Q.jsx)(H,{type:`button`,variant:`ghost`,size:`icon`,className:`shrink-0 oc-access__mgr${r?` oc-access__mgr--on`:``}`,"aria-pressed":r,"aria-label":r?ae():we(),title:r?ae():we(),onClick:()=>void F(e.userId,r),children:(0,Q.jsx)(X,{size:15,"aria-hidden":!0})}):t&&r?(0,Q.jsx)(`span`,{className:`oc-access__mgr oc-access__mgr--on`,role:`img`,"aria-label":Oe(),title:Oe(),children:(0,Q.jsx)(X,{size:15,"aria-hidden":!0})}):null})]},e._id)})}),(0,Q.jsx)(st,{page:L.page,pageCount:L.pageCount,onPage:D})]})]})}),(0,Q.jsx)(V,{value:`agents`,children:a===void 0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:p()}):a.length===0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:v()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(G,{value:C,onChange:e=>T(e.target.value),placeholder:ye(),className:`oc-access__search`}),(0,Q.jsx)(`div`,{className:`oc-access__list`,children:a.map(t=>(0,Q.jsx)(lt,{groupId:e,instanceName:t.name,kind:t.kind??`openclaw`,assigned:N,query:C},`${e}-${t._id}`))})]})}),(0,Q.jsx)(V,{value:`charts`,children:(0,Q.jsx)(ut,{groupId:e})})]})]})})}function lt({groupId:e,instanceName:t,kind:n,assigned:r,query:a}){let o=z(w.groups.listAssignableAgents,{instanceName:t}),s=R(w.groups.assignAgentToGroup),c=R(w.groups.removeAgentFromGroup),l=R(w.groups.bulkSetGroupAgents),f=J(),[p,m]=(0,Z.useState)(1);if((0,Z.useEffect)(()=>{m(1)},[a]),!e)return null;let h=et(o?.agents??[],a),v=o?.discovery&&!o.discovery.lastPollOk;if(a.trim()&&h.length===0)return null;let b=h.filter(e=>e.presentInLastOk!==!1&&e.enabled!==!1),x=rt(b,e=>r.has(`${t}/${e.agentId}`)),S=it(h,p,ot);async function C(n,r){try{r?await c({groupId:e,instanceName:t,agentId:n}):await s({groupId:e,instanceName:t,agentId:n})}catch(e){f.error(j(),e)}}async function T(){if(b.length===0)return;let n=b.map(e=>e.agentId);try{await l({groupId:e,instanceName:t,agentIds:n,assigned:x!==`all`})}catch(e){f.error(j(),e)}}return(0,Q.jsxs)(`div`,{className:`oc-access__group`,children:[(0,Q.jsxs)(`div`,{className:`oc-access__instance`,children:[(0,Q.jsx)(W,{size:13,"aria-hidden":!0}),(0,Q.jsx)(`span`,{children:t}),(0,Q.jsx)(K,{variant:`outline`,className:`oc-access__kind`,children:n}),v?(0,Q.jsx)(K,{variant:`outline`,className:`oc-access__stale`,children:i()}):null]}),o===void 0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:u()}):h.length===0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:v?L():_()}):(0,Q.jsxs)(Q.Fragment,{children:[b.length>1?(0,Q.jsxs)(`div`,{className:`oc-access__row oc-access__selectall`,children:[(0,Q.jsx)(q,{checked:x===`all`?!0:x===`some`?`indeterminate`:!1,onCheckedChange:()=>void T(),"aria-label":d()}),(0,Q.jsx)(`span`,{className:`oc-access__label`,children:d()})]}):null,S.pageItems.map(e=>{let n=`${t}/${e.agentId}`,i=r.has(n),a=e.presentInLastOk===!1,o=!e.enabled;return(0,Q.jsxs)(`div`,{className:`oc-access__row${o?` is-disabled`:``}`,children:[(0,Q.jsx)(q,{checked:i,disabled:(a||o)&&!i,onCheckedChange:()=>void C(e.agentId,i),"aria-label":g({name:e.displayName??e.agentId})}),(0,Q.jsxs)(`span`,{className:`oc-access__label`,title:e.displayName??e.agentId,children:[e.emoji?`${e.emoji} `:``,e.displayName??e.agentId]}),e.model?(0,Q.jsx)(`span`,{className:`oc-access__model`,children:e.model}):null,e.isDefaultOnInstance?(0,Q.jsx)(`span`,{className:`oc-access__fav`,role:`img`,"aria-label":y(),title:y(),children:(0,Q.jsx)(U,{size:14,fill:`currentColor`})}):null,a?(0,Q.jsx)(K,{variant:`outline`,className:`oc-access__gone`,children:de()}):null]},e.agentId)}),(0,Q.jsx)(st,{page:S.page,pageCount:S.pageCount,onPage:m})]})]})}function ut({groupId:e}){let t=z(w.charts.listGroupChartSelection,e?{groupId:e}:`skip`),n=R(w.charts.assignChartToGroup),r=R(w.charts.removeChartFromGroup),i=R(w.charts.setGroupDefaultChart),a=R(w.charts.addChartToGroupPool),s=R(w.charts.removeChartFromGroupPool),c=J();if(!e)return null;if(t===void 0)return(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:p()});let{pool:u,addable:d,canManagePool:f}=t;if(u.length===0&&!f)return(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:l()});async function m(t,i){try{i?await r({groupId:e,chartKey:t}):await n({groupId:e,chartKey:t})}catch(e){c.error(F(),e)}}async function h(t){try{await i({groupId:e,chartKey:t})}catch(e){c.error(F(),e)}}async function g(t){try{await a({groupId:e,chartKey:t})}catch(e){c.error(F(),e)}}async function _(t){try{await s({groupId:e,chartKey:t})}catch(e){c.error(F(),e)}}return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`div`,{className:`oc-access__list`,children:u.map(e=>(0,Q.jsxs)(`div`,{className:`oc-access__row`,children:[(0,Q.jsx)(q,{checked:e.selected,onCheckedChange:()=>void m(e.chartKey,e.selected),"aria-label":C({name:e.name})}),(0,Q.jsx)(`span`,{className:`oc-access__label`,title:e.name,children:e.name}),e.selected?e.isDefault?(0,Q.jsx)(`span`,{className:`oc-access__fav`,role:`img`,"aria-label":De(),title:De(),children:(0,Q.jsx)(U,{size:14,fill:`currentColor`})}):(0,Q.jsx)(H,{type:`button`,variant:`ghost`,size:`sm`,onClick:()=>void h(e.chartKey),children:oe()}):null,f?(0,Q.jsx)(H,{type:`button`,variant:`ghost`,size:`sm`,"aria-label":o({name:e.name}),title:o({name:e.name}),onClick:()=>void _(e.chartKey),children:(0,Q.jsx)(je,{size:14,"aria-hidden":!0})}):null]},e.chartKey))}),f?d.length>0?(0,Q.jsxs)(We,{value:``,onValueChange:e=>void g(e),children:[(0,Q.jsx)(He,{size:`sm`,className:`oc-access__search`,children:(0,Q.jsx)(Je,{placeholder:Ee()})}),(0,Q.jsx)(Ge,{children:d.map(e=>(0,Q.jsx)(Re,{value:e.chartKey,children:e.name},e.chartKey))})]}):u.length===0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:T()}):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{$C as r,$S as i,AC as a,AS as o,BC as s,BS as c,CC as l,CS as u,DC as d,DS as f,Do as p,EC as m,ES as h,Eo as g,FC as ee,FS as _,GC as v,GS as y,HC as b,HS as x,IC as te,IS as S,JC as ne,JS as C,KC as re,KS as w,LC as ie,LS as T,MC as ae,MS as oe,NC as se,OC as ce,OS as le,Oo as ue,PC as de,PS as E,QC as fe,QS as pe,RC as me,RS as he,SC as ge,SS as _e,Sk as D,T as O,TC as ve,TS as ye,UC as be,US as xe,VC as Se,VS as Ce,WC as we,WS as Te,XC as Ee,XS as De,YC as Oe,YS as ke,ZC as Ae,ZS as je,_C as Me,_S as Ne,aC as Pe,bC as Fe,bS as Ie,cC as Le,dC as Re,dS as k,eC as ze,eI as A,fC as Be,fS as Ve,fr as He,gC as j,gS as Ue,hC as We,hS as Ge,iC as Ke,jC as qe,jS as Je,kC as Ye,kS as Xe,ko as Ze,lC as Qe,mC as $e,mS as et,mr as tt,nC as nt,nI as M,nv as rt,oC as it,pC as at,pS as ot,pr as st,qC as ct,qS as lt,rC as ut,rI as N,sC as dt,tC as ft,tv as pt,uC as mt,uS as ht,vC as gt,vS as _t,wC as vt,wS as yt,xC as bt,xS as xt,xk as P,yC as St,yS as Ct,zC as F,zS as I}from"./dist-CNZ9o3sc.js";import{a as wt,c as Tt}from"./FieldLabel-z7bxzKHq.js";import{t as L}from"./button-BtQwDeC7.js";import{$ as R,A as Et,Q as z,X as B,Y as V,Z as H,at as Dt,ct as U,d as Ot,it as kt,lt as W,m as At,nt as jt,ot as G,rt as Mt,st as K,tt as Nt,ut as q,wt as J}from"./index-9R1hg_pA.js";import{t as Pt}from"./DataTableShell-zzaGmfMk.js";import{InstanceConfigDialog as Ft}from"./BridgeTab-BURazhGl.js";var Y=t(e(),1),X=[`conversational`,`documentary`,`summarizer`,`curator`],It=new Set(X),Lt=`conversational`;function Rt(e){let t=new Set((e??[]).filter(e=>It.has(e)));return t.size===0?[Lt]:X.filter(e=>t.has(e))}var Z=n(),Q={name:``,gatewayUrl:``,bridgeUrl:``,displayName:``,kind:`openclaw`,transport:`ws`,gatewayVersion:``,gatewayHttpUrl:``,streamTransport:wt},zt={openclaw:[`token`,`deviceIdentity`],hermes:[`apiKey`]};function Bt(e){return{name:e.name,gatewayUrl:e.gatewayUrl,bridgeUrl:e.bridgeUrl??``,displayName:e.displayName??``,kind:e.kind??`openclaw`,transport:e.transport??`ws`,gatewayVersion:e.gatewayVersion??``,gatewayHttpUrl:e.gatewayHttpUrl??``,streamTransport:e.streamTransport??`reactive`}}function Vt(){let e=N(O.admin.listInstances,{}),t=N(O.agents.listAllInstanceAgents,{}),n=M(O.admin.upsertInstance),i=M(O.admin.deleteInstance),o=J(),[c,u]=(0,Y.useState)(!1),[f,p]=(0,Y.useState)(Q),[h,g]=(0,Y.useState)(null),[_,y]=(0,Y.useState)(null),[x,S]=(0,Y.useState)(null),[C,w]=(0,Y.useState)(null);async function T(){try{await n({instanceId:C??void 0,name:f.name,gatewayUrl:f.gatewayUrl,bridgeUrl:f.bridgeUrl||void 0,displayName:f.displayName||void 0,kind:f.kind,transport:f.kind===`hermes`?f.transport:void 0,gatewayVersion:f.gatewayVersion||void 0,gatewayHttpUrl:f.gatewayHttpUrl||void 0,streamTransport:f.streamTransport}),p(Q),w(null),u(!1)}catch(e){o.error(Ae(),e)}}return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`p`,{className:`oc-admin__hint`,children:[Ee(),(0,Z.jsx)(`strong`,{children:Oe()}),ne()]}),(0,Z.jsx)(Pt,{title:ct(),rows:e,addLabel:re(),onAdd:()=>{w(null),p(Q),u(!0)},emptyHint:v(),columns:[{header:we(),cell:e=>e.name,sort:e=>e.name},{header:be(),cell:e=>(0,Z.jsx)(V,{variant:`outline`,children:e.kind??`openclaw`}),sort:e=>e.kind??`openclaw`},{header:b(),cell:e=>e.gatewayUrl,sort:e=>e.gatewayUrl},{header:Se(),cell:e=>e.displayName??`—`,sort:e=>e.displayName??null},{header:r(),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)(V,{variant:r(e.agentId)?`default`:`outline`,title:r(e.agentId)?k():void 0,children:[e.emoji?`${e.emoji} `:``,e.displayName??e.agentId]},e.agentId))})}}],rowActions:e=>[{label:ie(),onSelect:()=>{w(e._id),p(Bt(e)),u(!0)}},{label:fe(),onSelect:()=>g(e.name)},{label:ge(),onSelect:()=>S(e)},{label:s(),onSelect:()=>y(e)},{label:F(),variant:`destructive`,onSelect:()=>void i({instanceId:e._id})}],bulkActions:[{label:F(),variant:`destructive`,onSelect:e=>e.forEach(e=>void i({instanceId:e}))}]}),(0,Z.jsx)(Ot,{open:c,onOpenChange:u,title:C?te():me(),description:de(),canSubmit:!!(f.name&&f.gatewayUrl),onSubmit:T,submitLabel:se(),children:(0,Z.jsxs)(`div`,{className:`oc-form`,children:[(0,Z.jsxs)($,{label:ae(),children:[(0,Z.jsx)(B,{value:f.name,disabled:C!==null,onChange:e=>p({...f,name:e.target.value})}),C?(0,Z.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:ee()}):null]}),(0,Z.jsx)($,{label:qe(),children:(0,Z.jsxs)(G,{value:f.kind,onValueChange:e=>p({...f,kind:e}),children:[(0,Z.jsx)(W,{size:`sm`,className:`w-40`,children:(0,Z.jsx)(q,{})}),(0,Z.jsxs)(K,{children:[(0,Z.jsx)(U,{value:`openclaw`,children:`OpenClaw`}),(0,Z.jsx)(U,{value:`hermes`,children:`Hermes`})]})]})}),f.kind===`hermes`?(0,Z.jsx)($,{label:tt(),children:(0,Z.jsxs)(G,{value:f.transport,onValueChange:e=>p({...f,transport:e}),children:[(0,Z.jsx)(W,{size:`sm`,className:`w-56`,children:(0,Z.jsx)(q,{})}),(0,Z.jsxs)(K,{children:[(0,Z.jsx)(U,{value:`ws`,children:st()}),(0,Z.jsx)(U,{value:`rest`,children:He()})]})]})}):null,(0,Z.jsx)($,{label:a(),children:(0,Z.jsx)(B,{value:f.gatewayUrl,onChange:e=>p({...f,gatewayUrl:e.target.value})})}),(0,Z.jsx)($,{label:Ye(),children:(0,Z.jsx)(B,{value:f.bridgeUrl,placeholder:ce(),onChange:e=>p({...f,bridgeUrl:e.target.value})})}),(0,Z.jsx)($,{label:d(),children:(0,Z.jsx)(B,{value:f.displayName,onChange:e=>p({...f,displayName:e.target.value})})}),(0,Z.jsxs)($,{label:rt(),children:[(0,Z.jsxs)(G,{value:f.streamTransport,onValueChange:e=>p({...f,streamTransport:e}),children:[(0,Z.jsx)(W,{size:`sm`,className:`w-40`,children:(0,Z.jsx)(q,{})}),(0,Z.jsx)(K,{children:Tt.map(e=>(0,Z.jsx)(U,{value:e,children:e},e))})]}),(0,Z.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:pt()})]}),(0,Z.jsx)($,{label:m(),children:(0,Z.jsx)(B,{value:f.gatewayVersion,placeholder:ve(),onChange:e=>p({...f,gatewayVersion:e.target.value})})}),(0,Z.jsx)($,{label:vt(),children:(0,Z.jsx)(B,{value:f.gatewayHttpUrl,placeholder:l(),onChange:e=>p({...f,gatewayHttpUrl:e.target.value})})})]})}),(0,Z.jsx)(Zt,{instanceName:h,open:h!==null,onOpenChange:e=>{e||g(null)}}),_?(0,Z.jsx)(Ft,{instance:_,onClose:()=>y(null)},_._id):null,x?(0,Z.jsx)(Ht,{instance:x,onClose:()=>S(null)},x._id):null]})}function Ht({instance:e,onClose:t}){let n=N(O.instanceSecrets.listInstanceSecretStatus,{}),r=zt[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)(Nt,{children:[(0,Z.jsx)(jt,{children:bt({instance:e.displayName??e.name})}),(0,Z.jsx)(R,{children:Fe()})]}),(0,Z.jsx)(`div`,{className:`oc-form`,children:r.map(t=>(0,Z.jsx)(Gt,{instanceId:e._id,field:t,updatedAt:i[t]??null},t))}),(0,Z.jsx)(`div`,{className:`oc-bridgesecret`,children:(0,Z.jsx)(Wt,{instance:e})}),(0,Z.jsx)(Ut,{instance:e})]})})}function Ut({instance:e}){let t=A(O.instanceSync.forceInstanceSync),n=J(),[r,a]=(0,Y.useState)(!1);async function o(){if(!r){a(!0);try{switch((await t({instanceId:e._id})).status){case`synced`:n.success(ze());break;case`no_agents`:n.success(pe());break;case`no_bridge_url`:n.error(je());break;case`deploy_misconfigured`:n.error(De());break;case`unauthorized`:n.error(C());break;case`not_served`:n.error(lt());break;default:n.error(ke());break}}catch(e){n.error(i(),e)}finally{a(!1)}}}return(0,Z.jsxs)(`div`,{className:`oc-form`,children:[(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:w()}),(0,Z.jsx)(`div`,{className:`flex items-center gap-2`,children:(0,Z.jsx)(L,{size:`sm`,variant:`outline`,onClick:()=>void o(),disabled:r,children:r?ft():nt()})})]})}function Wt({instance:e}){let t=N(O.bridgeAuth.listBridgeAuthStatus,{}),n=A(O.bridgeAuth.mintBridgeSecret),r=M(O.bridgeAuth.revokeBridgeSecret),i=J(),[a,o]=(0,Y.useState)(!1),[s,l]=(0,Y.useState)(null),[u,d]=(0,Y.useState)(!1),f=(t??[]).find(t=>t.instanceId===e._id),p=f!==void 0;async function m(){if(!a){o(!0);try{l((await n({instanceId:e._id})).plaintext),d(!1)}catch(e){i.error(I(),e)}finally{o(!1)}}}async function h(){if(!a){o(!0);try{await r({instanceId:e._id}),l(null),i.success(c())}catch(e){i.error(I(),e)}finally{o(!1)}}}async function g(){if(s)try{await navigator.clipboard.writeText(s),d(!0)}catch{}}return(0,Z.jsxs)($,{label:y(),children:[(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:Te()}),(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Z.jsx)(V,{variant:p?`outline`:`secondary`,children:p?`${j()} · ${f.prefix}…${f.lastFour}`:We()}),(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(L,{size:`sm`,onClick:()=>void m(),disabled:a,children:p?x():xe()}),p?(0,Z.jsx)(L,{size:`sm`,variant:`destructive`,onClick:()=>void h(),disabled:a,children:Ce()}):null]})]}),s?(0,Z.jsxs)(`div`,{className:`oc-bridgesecret__reveal`,children:[(0,Z.jsx)(`p`,{className:`oc-sa__minted-warning`,children:he()}),(0,Z.jsxs)(`div`,{className:`oc-sa__minted-box`,children:[(0,Z.jsx)(`code`,{className:`oc-sa__minted-plain`,children:s}),(0,Z.jsx)(L,{variant:`outline`,size:`sm`,onClick:()=>void g(),children:u?D():P()})]}),(0,Z.jsx)(L,{size:`sm`,variant:`ghost`,onClick:()=>{l(null),d(!1)},children:T()})]}):null]})}function Gt({instanceId:e,field:t,updatedAt:n}){let r=A(O.instanceSecrets.setInstanceSecret),i=M(O.instanceSecrets.clearInstanceSecret),a=A(O.deviceIdentity.generateDeviceIdentity),o=J(),[s,c]=(0,Y.useState)(``),[l,u]=(0,Y.useState)(!1),[d,f]=(0,Y.useState)(null),[p,m]=(0,Y.useState)(!1),h=n!==null,g=t===`deviceIdentity`,ee=t===`token`?St():t===`deviceIdentity`?gt():Me();async function _(){if(!(!s.trim()||l)){u(!0);try{await r({instanceId:e,field:t,plaintext:s}),c(``),f(null),m(!1),o.success(mt())}catch(e){o.error(Qe(),e)}finally{u(!1)}}}async function v(){if(!l){u(!0);try{await i({instanceId:e,field:t}),f(null),m(!1),o.success(Le())}catch(e){o.error(Qe(),e)}finally{u(!1)}}}async function y(){if(!l){u(!0);try{f(await a({instanceId:e})),m(!1),o.success(Pe())}catch(e){o.error(ut(),e)}finally{u(!1)}}}let b=d?`openclaw devices approve ${d.id}`:``;async function x(){if(b)try{await navigator.clipboard.writeText(b),m(!0)}catch{}}return(0,Z.jsxs)($,{label:ee,children:[g?(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)(V,{variant:h?`outline`:`secondary`,children:h?j():We()}),(0,Z.jsx)(B,{type:`password`,autoComplete:`off`,className:`flex-1 min-w-32`,value:s,placeholder:h?at():$e(),onChange:e=>c(e.target.value)}),(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(L,{size:`sm`,onClick:()=>void _(),disabled:l||s.trim().length===0,children:Be()}),g?(0,Z.jsx)(L,{size:`sm`,variant:`outline`,onClick:()=>void y(),disabled:l,children:dt()}):null,h?(0,Z.jsx)(L,{size:`sm`,variant:`destructive`,onClick:()=>void v(),disabled:l,children:Re()}):null]})]}),d?(0,Z.jsxs)(`div`,{className:`oc-bridgesecret__reveal`,children:[(0,Z.jsx)(`p`,{className:`text-sm font-medium`,children:Pe()}),(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:Ke()}),(0,Z.jsxs)(`div`,{className:`oc-sa__minted-box`,children:[(0,Z.jsx)(`code`,{className:`oc-sa__minted-plain`,children:b}),(0,Z.jsx)(L,{variant:`outline`,size:`sm`,onClick:()=>void x(),children:p?D():P()})]}),(0,Z.jsx)(L,{size:`sm`,variant:`ghost`,onClick:()=>{f(null),m(!1)},children:T()})]}):null]})}var Kt={conversational:h,documentary:yt,summarizer:Ze,curator:p},qt={conversational:ye,documentary:u,summarizer:ue,curator:g},Jt=e=>(Kt[e]??(()=>e))(),Yt=e=>(qt[e]??(()=>``))();function Xt({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:o()}),t.map(e=>(0,Z.jsx)(V,{variant:`secondary`,className:`oc-agenttype__chip`,title:Yt(e),children:Jt(e)},e)),(0,Z.jsxs)(Mt,{children:[(0,Z.jsx)(Dt,{asChild:!0,children:(0,Z.jsx)(L,{type:`button`,variant:`outline`,size:`sm`,className:`h-7`,children:Xe()})}),(0,Z.jsxs)(kt,{align:`start`,className:`oc-agenttypes-pop`,children:[(0,Z.jsx)(`p`,{className:`oc-agenttypes-pop__title`,children:le()}),(0,Z.jsx)(`p`,{className:`oc-agenttypes-pop__hint`,children:f()}),(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)(At,{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:Jt(r)}),(0,Z.jsx)(`span`,{className:`oc-agenttypes-pop__desc`,children:Yt(r)})]})]},r)})})]})]})]})}function Zt({instanceName:e,open:t,onOpenChange:n}){let r=N(O.agents.listAgentsForInstance,t&&e?{instanceName:e}:`skip`),i=M(O.agents.setAgentEnabled).withOptimisticUpdate((e,{instanceName:t,agentId:n,enabled:r})=>{let i=e.getQuery(O.agents.listAgentsForInstance,{instanceName:t});i&&e.setQuery(O.agents.listAgentsForInstance,{instanceName:t},{...i,agents:i.agents.map(e=>e.agentId===n?{...e,enabled:r}:e)})}),a=M(O.agents.setInstanceDefaultAgent).withOptimisticUpdate((e,{instanceName:t,agentId:n})=>{let r=e.getQuery(O.agents.listAgentsForInstance,{instanceName:t});r&&e.setQuery(O.agents.listAgentsForInstance,{instanceName:t},{...r,defaultAgentId:n})}),o=M(O.agents.setAgentTypes).withOptimisticUpdate((e,{instanceName:t,agentId:n,types:r})=>{let i=e.getQuery(O.agents.listAgentsForInstance,{instanceName:t});if(!i)return;let a=Rt(r);e.setQuery(O.agents.listAgentsForInstance,{instanceName:t},{...i,agents:i.agents.map(e=>e.agentId===n?{...e,types:a}:e)})}),s=M(O.agents.setAgentDescription).withOptimisticUpdate((e,{instanceName:t,agentId:n,description:r})=>{let i=e.getQuery(O.agents.listAgentsForInstance,{instanceName:t});if(!i)return;let a=r.trim();e.setQuery(O.agents.listAgentsForInstance,{instanceName:t},{...i,agents:i.agents.map(e=>e.agentId===n?{...e,description:a.length===0?null:a}:e)})}),c=M(O.agents.removeInstanceAgent),l=Et(),u=J();async function d(t,n){if(e)try{await i({instanceName:e,agentId:t,enabled:n})}catch(e){u.error(E(),e)}}async function f(t){if(e)try{await a({instanceName:e,agentId:t})}catch(e){u.error(E(),e)}}async function p(t,n,r){if(!e)return;let i=r.includes(n)?r.filter(e=>e!==n):[...r,n];try{await o({instanceName:e,agentId:t,types:i})}catch(e){u.error(E(),e)}}async function m(t,n){if(e&&await l({title:Ie({name:n}),description:Ct(),confirmLabel:_t(),destructive:!0}))try{await c({instanceName:e,agentId:t}),u.success(Ne())}catch(e){u.error(E(),e)}}return(0,Z.jsx)(H,{open:t,onOpenChange:n,children:(0,Z.jsxs)(z,{className:`oc-access`,children:[(0,Z.jsxs)(Nt,{children:[(0,Z.jsx)(jt,{children:S({name:e??``})}),(0,Z.jsx)(R,{children:_()})]}),r===void 0?(0,Z.jsx)(`p`,{className:`oc-access__hint`,children:Ue()}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`div`,{className:`oc-access__poll`,children:r.discovery===null?Ge():r.discovery.lastPollOk?et():ot({error:r.discovery.error??`?`})}),r.agents.length===0?(0,Z.jsx)(`p`,{className:`oc-access__hint`,children:Ve()}):(0,Z.jsx)(`div`,{className:`oc-access__list`,children:r.agents.map(t=>{let n=t.presentInLastOk===!1,i=r.defaultAgentId===t.agentId,a=t.displayName??t.agentId,o=t.types??[];return(0,Z.jsxs)(`div`,{className:`oc-agentcard`+(t.enabled?``:` oc-agentcard--off`),children:[(0,Z.jsxs)(`div`,{className:`oc-agentcard__head`,children:[(0,Z.jsx)(At,{checked:t.enabled,disabled:n,"aria-label":a,onCheckedChange:e=>void d(t.agentId,e===!0)}),(0,Z.jsxs)(`span`,{className:`oc-agentcard__name`,title:a,children:[t.emoji?`${t.emoji} `:``,a]}),t.model?(0,Z.jsx)(`span`,{className:`oc-access__model`,children:t.model}):null,n?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(V,{variant:`outline`,className:`oc-access__gone`,children:ht()}),(0,Z.jsx)(L,{size:`sm`,variant:`ghost`,className:`h-7 text-destructive`,onClick:()=>void m(t.agentId,a),children:xt()})]}):i?(0,Z.jsx)(V,{variant:`default`,children:k()}):(0,Z.jsx)(L,{size:`sm`,variant:`outline`,className:`h-7`,disabled:!t.enabled,onClick:()=>void f(t.agentId),children:_e()})]}),t.enabled?(0,Z.jsx)(Xt,{agentId:t.agentId,types:o,onToggle:e=>void p(t.agentId,e,o)}):null,t.enabled?(0,Z.jsx)(Qt,{value:t.description??``,onSave:async n=>{if(e)try{await s({instanceName:e,agentId:t.agentId,description:n})}catch(e){u.error(E(),e)}}}):null]},t.agentId)})})]})]})})}function Qt({value:e,onSave:t}){let[n,r]=(0,Y.useState)(e);(0,Y.useEffect)(()=>{r(e)},[e]);let i=()=>{n.trim()!==e.trim()&&t(n)};return(0,Z.jsx)(B,{className:`oc-agentcard__desc`,value:n,maxLength:280,placeholder:oe(),"aria-label":Je(),onChange:e=>r(e.target.value),onBlur:i,onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),i())}})}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{Vt as InstancesTab};
@@ -1 +0,0 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{BT as r,FT as i,Gs as a,HT as o,Hs as s,IT as c,Js as l,Ks as u,LT as d,MT as f,NT as p,PT as m,RT as h,T as g,UT as _,Us as v,VT as y,WT as b,Ws as x,Xs as S,Ys as C,eI as w,jT as T,nI as E,qs as D,rI as O,zT as k}from"./dist-CNZ9o3sc.js";import{t as A}from"./button-BtQwDeC7.js";import{X as j,Y as M,m as N}from"./index-9R1hg_pA.js";var P=t(e(),1),F=n();function I(){let e=O(g.integrations.status.status,{}),t=E(g.admin.setIntegrationConfig),[n,a]=(0,P.useState)(null);if((0,P.useEffect)(()=>{e&&n===null&&a(e.config)},[e,n]),!e||!n)return(0,F.jsx)(`p`,{className:`oc-admin__hint`,children:b()});let s=n,u=(e,t,n)=>a({...s,[e]:{...s[e],[t]:n}}),v=(e,n)=>void t({[e]:n});return(0,F.jsxs)(F.Fragment,{children:[(0,F.jsxs)(`p`,{className:`oc-admin__hint`,children:[_(),` `,(0,F.jsx)(`strong`,{children:o()}),` `,y()]}),(0,F.jsxs)(L,{title:`Langfuse`,status:e.langfuse.configured?e.langfuse.enabled?(0,F.jsx)(M,{variant:`secondary`,children:r()}):(0,F.jsx)(M,{variant:`outline`,children:k()}):(0,F.jsx)(M,{variant:`outline`,children:h()}),note:d(),children:[(0,F.jsx)(R,{label:i(),children:(0,F.jsx)(j,{value:s.langfuse.host??``,placeholder:e.langfuse.effectiveHost,onChange:e=>u(`langfuse`,`host`,e.target.value),onBlur:()=>v(`langfuse`,{host:s.langfuse.host??``})})}),(0,F.jsx)(z,{label:T(),checked:s.langfuse.enabled??!0,onChange:e=>{u(`langfuse`,`enabled`,e),v(`langfuse`,{enabled:e})}})]}),(0,F.jsxs)(L,{title:`Opik`,status:e.opik.configured?e.opik.enabled?(0,F.jsx)(M,{variant:`secondary`,children:r()}):(0,F.jsx)(M,{variant:`outline`,children:k()}):(0,F.jsx)(M,{variant:`outline`,children:h()}),note:c(),children:[(0,F.jsx)(R,{label:m(),children:(0,F.jsx)(j,{value:s.opik.baseUrl??``,placeholder:e.opik.effectiveBaseUrl,onChange:e=>u(`opik`,`baseUrl`,e.target.value),onBlur:()=>v(`opik`,{baseUrl:s.opik.baseUrl??``})})}),(0,F.jsx)(R,{label:p(),children:(0,F.jsx)(j,{value:s.opik.workspace??``,placeholder:e.opik.effectiveWorkspace||f(),onChange:e=>u(`opik`,`workspace`,e.target.value),onBlur:()=>v(`opik`,{workspace:s.opik.workspace??``})})}),(0,F.jsx)(z,{label:T(),checked:s.opik.enabled??!0,onChange:e=>{u(`opik`,`enabled`,e),v(`opik`,{enabled:e})}})]}),(0,F.jsxs)(L,{title:`OpenTelemetry (OTLP)`,status:e.otlp.configured?e.otlp.enabled?(0,F.jsx)(M,{variant:`secondary`,children:r()}):(0,F.jsx)(M,{variant:`outline`,children:k()}):(0,F.jsx)(M,{variant:`outline`,children:S()}),note:C(),children:[(0,F.jsx)(R,{label:l(),children:(0,F.jsx)(j,{value:s.otlp.endpoint??``,placeholder:e.otlp.effectiveEndpoint||`https://otlp.example.com/v1/traces`,onChange:e=>u(`otlp`,`endpoint`,e.target.value),onBlur:()=>v(`otlp`,{endpoint:s.otlp.endpoint??``})})}),(0,F.jsx)(B,{headersSet:e.otlp.headersSet}),(0,F.jsx)(z,{label:T(),checked:s.otlp.enabled??!0,onChange:e=>{u(`otlp`,`enabled`,e),v(`otlp`,{enabled:e})}})]})]})}function L({title:e,status:t,note:n,children:r}){return(0,F.jsxs)(`section`,{className:`oc-int__section`,children:[(0,F.jsxs)(`div`,{className:`oc-int__section-head`,children:[(0,F.jsx)(`h3`,{className:`oc-uipa__h`,children:e}),t]}),n?(0,F.jsx)(`p`,{className:`oc-uipa__note`,children:n}):null,(0,F.jsx)(`div`,{className:`oc-int__fields`,children:r})]})}function R({label:e,children:t}){return(0,F.jsxs)(`label`,{className:`oc-int__field`,children:[(0,F.jsx)(`span`,{className:`oc-int__field-label`,children:e}),t]})}function z({label:e,checked:t,onChange:n}){return(0,F.jsxs)(`label`,{className:`oc-int__toggle`,children:[(0,F.jsx)(N,{checked:t,onCheckedChange:e=>n(e===!0)}),(0,F.jsx)(`span`,{children:e})]})}function B({headersSet:e}){let t=w(g.integrations.otlpSecret.setOtlpHeaders),n=E(g.integrations.otlpSecret.clearOtlpHeaders),[r,i]=(0,P.useState)(``),[o,c]=(0,P.useState)(null),[l,d]=(0,P.useState)(!1),f=async()=>{d(!0),c(null);try{await t({headersJson:r}),i(``)}catch(e){c(e instanceof Error?e.message:String(e))}finally{d(!1)}};return(0,F.jsxs)(R,{label:D(),children:[(0,F.jsx)(j,{value:r,placeholder:e?u():a(),onChange:e=>i(e.target.value)}),(0,F.jsxs)(`div`,{className:`oc-int__otlp-headers-actions`,children:[(0,F.jsx)(A,{size:`sm`,disabled:l||r.trim().length===0,onClick:()=>void f(),children:x()}),e?(0,F.jsx)(A,{variant:`ghost`,size:`sm`,disabled:l,onClick:()=>void n({}),children:v()}):null]}),o?(0,F.jsx)(`p`,{className:`oc-int__otlp-headers-error`,children:o}):null,(0,F.jsx)(`p`,{className:`oc-uipa__note`,children:s()})]})}export{I as IntegrationsTab};
@@ -1 +0,0 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{DE as r,EE as i,QE as a,T as o,TE as s,_E as c,_g as l,bg as u,cg as d,dg as f,fg as p,gE as m,gg as h,hg as g,lg as _,mg as v,pg as y,rI as b,sg as x,ug as S,vg as C,wE as w,yg as ee}from"./dist-CNZ9o3sc.js";import{gt as te,i as ne,in as re,o as T,r as E,rn as D}from"./index-9R1hg_pA.js";import{a as O,n as k,o as A,r as j,t as M}from"./card-BbBjwTkQ.js";import{n as N,t as P}from"./TimeRangePicker-BPVkrNZN.js";var F=t(e(),1),I=n(),L=15,R=e=>String(Math.round(e));function z(){let e=b(o.me.getMe,{host:te})?.permissions?.includes(`traces.read`)??!1,t=b(o.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:a()}),(0,I.jsxs)(M,{children:[(0,I.jsxs)(O,{children:[(0,I.jsx)(A,{children:r()}),(0,I.jsx)(j,{children:s()})]}),(0,I.jsx)(k,{children:n.length<2?(0,I.jsx)(`p`,{className:`oc-admin__hint`,children:w()}):(0,I.jsx)(B,{series:n})})]})]})}function B({series:e}){let t=e.map(e=>e.cP50),n=e.map(e=>e.aP50),a=Math.max(1,...t,...n),o=t=>6+t*468/(e.length-1),s=e=>74-e*68/a,l=e=>e.map((e,t)=>`${t===0?`M`:`L`}${o(t).toFixed(1)},${s(e).toFixed(1)}`).join(` `),u=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:[m(),` p50 `,R(u.cP50),` `,i()]}),(0,I.jsxs)(`span`,{children:[c(),` p50 `,R(u.aP50),` `,i()]})]}),(0,I.jsxs)(`svg`,{viewBox:`0 0 480 80`,className:`h-20 w-full`,preserveAspectRatio:`none`,role:`img`,"aria-label":r(),children:[(0,I.jsx)(`path`,{d:l(n),fill:`none`,style:{stroke:`var(--muted-foreground)`},strokeWidth:1.5}),(0,I.jsx)(`path`,{d:l(t),fill:`none`,style:{stroke:`var(--primary)`},strokeWidth:1.5})]})]})}var V=[{metric:`api.calls`,label:u(),unit:`/h`,group:`API`,isError:!1},{metric:`api.errors`,label:ee(),unit:`/h`,group:`API`,isError:!0},{metric:`api.latency.avg_ms`,label:C(),unit:`ms`,group:`API`,isError:!1},{metric:`openclaw.ingest`,label:l(),unit:`/h`,group:`OpenClaw`,isError:!1},{metric:`chat.send`,label:h(),unit:`/h`,group:`Chat`,isError:!1},{metric:`assistant.stream.errors`,label:g(),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=re({from:`/settings/kpi`}),t=D({from:`/settings/kpi`}),n=ne(e.from,e.to,E,`now`),r=e=>void t({search:t=>({...t,...T(e)})}),{from:i,to:a}=N(n),{rowLimit:s,buckets:c}=K(i,a),l=b(o.kpi.listKpis,{limit:s,filter:{from:i,to:a}}),u=(0,F.useMemo)(()=>{let e=new Map;for(let t of l??[]){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>c&&e.set(t,n.slice(n.length-c));return e},[l,c]),d=(0,I.jsxs)(I.Fragment,{children:[(0,I.jsxs)(`p`,{className:`oc-admin__hint`,children:[v(),` `,(0,I.jsx)(`span`,{className:`oc-filter__window`,children:y()})]}),(0,I.jsx)(J,{value:n,onChange:r})]});return l===void 0?(0,I.jsxs)(I.Fragment,{children:[d,(0,I.jsx)(z,{}),(0,I.jsx)(`p`,{className:`oc-admin__hint`,children:p()})]}):l.length===0?(0,I.jsxs)(I.Fragment,{children:[d,(0,I.jsx)(z,{}),(0,I.jsx)(`p`,{className:`oc-admin__hint`,children:f()})]}):(0,I.jsxs)(I.Fragment,{children:[d,(0,I.jsx)(z,{}),U.map(e=>{let t=V.filter(t=>t.group===e);return t.some(e=>(u.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:u.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:S({value:$(n.bucket)})}):(0,I.jsx)(`span`,{className:`oc-kpi__muted`,children:_()}),(0,I.jsx)(`span`,{className:`oc-kpi__muted`,children:d({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":x({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{$A as r,AF as i,BA as a,BF as o,CF as s,DF as c,E as l,EF as u,Et as d,FA as f,FF as ee,GA as p,HA as m,IA as h,IF as g,JA as te,JF as ne,KA as re,LA as ie,LF as ae,MF as oe,Mt as se,NC as ce,NF as le,OF as ue,PA as de,PF as fe,QA as pe,RA as me,RF as he,T as _,TF as ge,UA as v,UF as y,VA as b,WA as x,XA as S,YA as C,ZA as w,_j as T,_t as E,aj as D,cj as O,dj as k,dt as A,ej as j,fj as M,ft as N,gj as P,gt as F,hj as I,ht as L,ij as _e,jF as ve,jt as ye,kF as be,lj as xe,mj as Se,mt as Ce,nI as R,nj as we,oj as Te,pj as Ee,pt as De,qA as z,rI as B,rj as Oe,sj as ke,tj as Ae,uj as je,vj as Me,vt as Ne,wF as Pe,yj as Fe,zA as Ie,zF as Le}from"./dist-CNZ9o3sc.js";import{t as V}from"./button-BtQwDeC7.js";import{E as Re,X as H,Y as U,ct as W,gt as G,ht as ze,lt as Be,m as K,mt as Ve,ot as He,pt as Ue,st as We,t as Ge,ut as Ke,wt as qe}from"./index-9R1hg_pA.js";import{t as Je}from"./localePickerView-C2RmOS86.js";var q=t(e(),1),J=n();function Ye({className:e,checked:t,onCheckedChange:n,disabled:r,...i}){return(0,J.jsx)(`button`,{type:`button`,role:`switch`,"aria-checked":t,"data-state":t?`checked`:`unchecked`,disabled:r,onClick:()=>n(!t),className:l(`peer inline-flex h-5 w-9 shrink-0 items-center rounded-full border border-transparent transition-colors outline-none`,`focus-visible:ring-2 focus-visible:ring-ring/50`,`disabled:cursor-not-allowed disabled:opacity-50`,t?`bg-primary`:`bg-input`,e),...i,children:(0,J.jsx)(`span`,{className:l(`pointer-events-none block size-4 rounded-full bg-background shadow transition-transform`,t?`translate-x-[18px]`:`translate-x-[2px]`)})})}var Y=[{id:`messages`,label:()=>Fe()},{id:`composer`,label:()=>Me()},{id:`sidebar`,label:()=>T()},{id:`notifications`,label:()=>j()},{id:`other`,label:()=>P()}],X={showSource:{category:`messages`,label:()=>I(),help:()=>Se()},showReport:{category:`messages`,label:()=>Ee(),help:()=>M()},copyAssistant:{category:`messages`,label:()=>k()},copyUser:{category:`messages`,label:()=>je()},showDelete:{category:`messages`,label:()=>xe()},showTools:{category:`messages`,label:()=>O(),help:()=>ke()},voiceInput:{category:`composer`,label:()=>Te(),help:()=>D()},showUsage:{category:`composer`,label:()=>_e(),help:()=>Oe()},autoReadAloud:{category:`composer`,label:()=>se(),help:()=>ye()},showChatAge:{category:`sidebar`,label:()=>we(),help:()=>Ae()},notifSound:{category:`notifications`,label:()=>r(),help:()=>pe()},notifSystem:{category:`notifications`,label:()=>w(),help:()=>S()},replySound:{category:`notifications`,label:()=>C(),help:()=>te()}};function Z(e){return e.toLowerCase().normalize(`NFD`).replace(/\p{Diacritic}/gu,``)}function Q(e,t){let n=Z(t.trim()),r=new Map(Y.map(e=>[e.id,e.label()])),i=new Map(Y.map(e=>[e.id,[]]));for(let t of e){let e=X[t],a=e?.category??`other`;n&&!Z(`${e?e.label():t} ${e?.help?e.help():``} ${t} ${r.get(a)??``}`).includes(n)||i.get(a).push(t)}return Y.map(e=>({id:e.id,label:r.get(e.id),keys:i.get(e.id)})).filter(e=>e.keys.length>0)}var Xe=[`showSource`,`showReport`,`copyAssistant`,`copyUser`,`showDelete`,`showTools`,`voiceInput`,`showChatAge`,`showUsage`,`autoReadAloud`,`notifSound`,`notifSystem`,`replySound`],Ze={voiceInput:`voiceInput`};function Qe(e){return Xe.includes(e)}function $(e){return e===`admin`}function $e(e){return e===!0?`on`:e===!1?`off`:`inherit`}function et(e){return e===`on`?!0:e===`off`?!1:null}function tt(e){return Qe(e)?Ze[e]:void 0}var nt={voiceInput:()=>me()};function rt({prefKey:e,ui:t}){let n=R(_.admin.setUiPrefDefault),r=R(_.admin.setFeatureEnabled),i=tt(e),a=i?nt[e]?.():void 0;return(0,J.jsxs)(`div`,{className:`oc-prefs__gov`,children:[(0,J.jsxs)(`div`,{className:`oc-prefs__gov-row`,children:[(0,J.jsx)(`span`,{className:`oc-prefs__gov-label`,children:m()}),(0,J.jsxs)(He,{value:$e(t.defaults[e]),onValueChange:t=>void n({key:e,value:et(t)}),children:[(0,J.jsx)(Be,{size:`sm`,className:`w-36`,children:(0,J.jsx)(Ke,{})}),(0,J.jsxs)(We,{children:[(0,J.jsx)(W,{value:`on`,children:h()}),(0,J.jsx)(W,{value:`off`,children:f()}),(0,J.jsx)(W,{value:`inherit`,children:de()})]})]}),i?(0,J.jsxs)(`span`,{className:`oc-prefs__gov-gate`,children:[(0,J.jsx)(K,{checked:t.featuresEnabled[i]===!0,onCheckedChange:e=>void r({key:i,enabled:e===!0}),"aria-label":b()}),b()]}):null]}),a?(0,J.jsx)(`span`,{className:`oc-prefs__gov-help`,children:a}):null]})}function it({current:e,enabled:t}){let n=R(_.me.setDictationShortcut),[r,i]=(0,q.useState)(!1),[a,o]=(0,q.useState)(!1);return(0,q.useEffect)(()=>{if(!r)return;let e=e=>{if(e.preventDefault(),e.stopPropagation(),e.key===`Escape`){i(!1);return}let t=Ve(e);if(t===null){[`Shift`,`Control`,`Meta`,`Alt`].includes(e.key)||(o(!0),window.setTimeout(()=>o(!1),1800));return}i(!1),n({shortcut:t})};return window.addEventListener(`keydown`,e,!0),()=>window.removeEventListener(`keydown`,e,!0)},[r,n]),(0,J.jsxs)(`div`,{className:`oc-prefs__row${t?``:` is-locked`}`,children:[(0,J.jsxs)(`div`,{className:`oc-prefs__info`,children:[(0,J.jsxs)(`span`,{className:`oc-prefs__label`,children:[Ne(),e?(0,J.jsx)(U,{variant:`secondary`,children:ze(e,Ue())}):null]}),(0,J.jsx)(`span`,{className:`oc-prefs__help`,children:a?L():r?F():E()})]}),(0,J.jsxs)(`div`,{className:`oc-prefs__ctl`,children:[e&&!r?(0,J.jsx)(`button`,{type:`button`,className:`oc-prefs__reset`,onClick:()=>void n({shortcut:null}),children:A()}):null,(0,J.jsx)(`button`,{type:`button`,className:`oc-prefs__reset`,disabled:!t,"aria-pressed":r,onClick:()=>i(e=>!e),children:r?N():e?De():Ce()})]})]})}function at(){let[e,t]=(0,q.useState)(``),[n,r]=(0,q.useState)(!1),i=B(_.me.getMe,{host:G}),o=i?.ui,s=$(i?.role)&&n,c=R(_.me.setUiPref).withOptimisticUpdate(Re),l=(0,q.useMemo)(()=>o?Q(Object.keys(o.effective),e):[],[o,e]);return o?(0,J.jsxs)(`div`,{className:`oc-prefs-panel`,children:[$(i?.role)?(0,J.jsxs)(`label`,{className:`oc-prefs__gov-toggle`,children:[(0,J.jsx)(K,{checked:n,onCheckedChange:e=>r(e===!0),"aria-label":v()}),v()]}):null,s?(0,J.jsxs)(`div`,{className:`oc-prefs__gov-head`,children:[(0,J.jsx)(`p`,{children:a()}),(0,J.jsx)(`p`,{children:Ie()}),(0,J.jsx)(`p`,{children:ie()})]}):null,(0,J.jsx)(H,{value:e,onChange:e=>t(e.target.value),placeholder:z(),"aria-label":z(),className:`mb-2`}),l.length===0?(0,J.jsx)(`div`,{className:`oc-prefs__empty`,children:re()}):(0,J.jsx)(`div`,{className:`oc-prefs`,children:l.map(e=>(0,J.jsxs)(`section`,{className:`oc-prefs__card`,children:[(0,J.jsx)(`h4`,{className:`oc-prefs__cat`,children:e.label}),e.keys.map(e=>{let t=X[e],n=t?t.label():e,r=t?.help?.(),i=o.locked[e],a=o.effective[e],l=o.userOverrides[e]!==void 0;return(0,J.jsxs)(`div`,{className:`oc-prefs__row${i?` is-locked`:``}`,children:[(0,J.jsxs)(`div`,{className:`oc-prefs__info`,children:[(0,J.jsxs)(`span`,{className:`oc-prefs__label`,children:[n,i?(0,J.jsx)(U,{variant:`outline`,children:p()}):l?(0,J.jsx)(U,{variant:`secondary`,children:d()}):null]}),r?(0,J.jsx)(`span`,{className:`oc-prefs__help`,children:r}):null]}),(0,J.jsxs)(`div`,{className:`oc-prefs__ctl`,children:[!i&&l?(0,J.jsx)(`button`,{type:`button`,className:`oc-prefs__reset`,onClick:()=>void c({key:e,value:null}),children:x()}):null,(0,J.jsx)(Ye,{checked:a,disabled:i,onCheckedChange:t=>{e===`notifSystem`&&t&&typeof Notification<`u`&&Notification.permission==="default"&&Notification.requestPermission(),c({key:e,value:t})},"aria-label":n})]}),s?(0,J.jsx)(rt,{prefKey:e,ui:o}):null]},e)})]},e.id))}),(0,J.jsx)(it,{current:i?.dictationShortcut??null,enabled:o.effective.voiceInput===!0})]}):(0,J.jsx)(`div`,{className:`oc-prefs__empty`,children:ne()})}var ot={sm:()=>ue(),md:()=>c(),lg:()=>u(),xl:()=>ge()};function st(){let e=B(_.me.getMe,{host:G}),t=R(_.me.setLocale),n=R(_.me.setFontScale).withOptimisticUpdate((e,{scale:t})=>{let n=e.getQuery(_.me.getMe,{host:G});n&&e.setQuery(_.me.getMe,{host:G},{...n,fontScale:t,resolvedFontScale:t??`md`})}),r=R(_.me.setMyName),a=qe(),c=e?.locale??`default`,l=e?.name??``,[u,d]=(0,q.useState)(null),f=u??l,p=f.trim()!==l.trim();async function m(){try{await r({name:f}),d(null),a.success(g())}catch(e){a.error(ee(),e)}}return(0,J.jsxs)(`div`,{className:`oc-appearance`,children:[(0,J.jsxs)(`section`,{className:`oc-show__section`,children:[(0,J.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,J.jsx)(`h2`,{className:`oc-show__title`,children:o()}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:Le()})]}),(0,J.jsxs)(`div`,{className:`oc-show__row`,children:[(0,J.jsx)(H,{className:`max-w-xs`,value:f,maxLength:120,placeholder:he(),onChange:e=>d(e.target.value),onKeyDown:e=>{e.key===`Enter`&&p&&(e.preventDefault(),m())}}),(0,J.jsx)(V,{size:`sm`,disabled:!p,onClick:()=>void m(),children:ce()})]}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:ae()})]}),(0,J.jsxs)(`section`,{className:`oc-show__section`,children:[(0,J.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,J.jsx)(`h2`,{className:`oc-show__title`,children:fe()}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:le()})]}),(0,J.jsxs)(`div`,{className:`oc-show__row`,children:[Je().map(e=>(0,J.jsx)(V,{variant:c===e.value?`default`:`outline`,size:`sm`,onClick:()=>void t({locale:e.value}),children:e.label},e.value)),(0,J.jsx)(V,{variant:c==="default"?`default`:`outline`,size:`sm`,onClick:()=>void t({locale:null}),children:y()})]}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:oe()})]}),(0,J.jsxs)(`section`,{className:`oc-show__section`,children:[(0,J.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,J.jsx)(`h2`,{className:`oc-show__title`,children:ve()}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:i()})]}),(0,J.jsx)(`div`,{className:`oc-show__row`,children:Ge.map(t=>(0,J.jsx)(V,{variant:(e?.fontScale??`md`)===t?`default`:`outline`,size:`sm`,onClick:()=>void n({scale:t}),children:ot[t]()},t))}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:be()})]}),(0,J.jsxs)(`section`,{className:`oc-show__section`,children:[(0,J.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,J.jsx)(`h2`,{className:`oc-show__title`,children:Pe()}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:s()})]}),(0,J.jsx)(at,{})]})]})}export{st as PreferencesTab};
@@ -1,4 +0,0 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Ao as r,B_ as i,F_ as a,G_ as o,Gi as s,H_ as c,I_ as l,J_ as u,Ji as d,K_ as f,Ki as p,L_ as m,Mo as h,N_ as g,No as _,P_ as v,Po as ee,Q_ as te,R_ as ne,T as y,U_ as b,V_ as re,W_ as x,X_ as S,Xi as C,Y_ as w,Yi as ie,Z_ as ae,_r as oe,av as T,gr as E,hr as D,jo as O,nI as k,ov as A,q_ as j,qi as M,rI as N,z_ as P}from"./dist-CNZ9o3sc.js";import{d as F,f as I,i as L,l as R,n as z,r as B,t as se,u as V}from"./FieldLabel-z7bxzKHq.js";import{t as H}from"./button-BtQwDeC7.js";import{ct as U,gt as W,lt as G,m as K,ot as q,st as J,ut as Y,wt as ce}from"./index-9R1hg_pA.js";import{r as X,t as le}from"./locales-CPjguROj.js";import{t as ue}from"./localePickerView-C2RmOS86.js";/* empty css */var Z=t(e(),1),Q=n(),$={media_delivery:{label:j,help:f},documentary_fetch:{label:o,help:x},inbound_files:{label:b,help:c},history_summary:{label:ee,help:_},file_curation:{label:C,help:ie}},de={outboundDir:`/home/node/.openclaw/media/outbound`,references:`- gdrive/1a2b3c4d5e6f7890abcd
2
- - gdrive/0f9e8d7c6b5a4321dcba`,files:`- /home/node/.openclaw/media/inbound/rapport.pdf (124800 o, application/pdf)`,previous_summary:`Projet Alpha : budget 40 000 EUR ; choix du serveur en cours.`,new_messages:`Utilisateur : Compare OVH et Scaleway.
3
- Assistant : Comparaison en cours.`,max_chars:`6000`,file_name:`MEMORY.md`,budget_chars:`20000`,feedback:`Trop de suppressions dans la section des liens, garde-les.`,content:`# Memory index
4
- - [Fait 1](fait-1.md) - note du projet`},fe={outboundDir:a,references:v,files:g,previous_summary:h,new_messages:O,max_chars:r,file_name:d,budget_chars:M,feedback:p,content:s};function pe(){let e=N(y.admin.listInstances,{}),[t,n]=(0,Z.useState)(null);if(e===void 0)return(0,Q.jsx)(`div`,{className:`oc-settings__tab-loading`,"aria-busy":`true`});if(e.length===0)return(0,Q.jsx)(`div`,{className:`oc-injtab`,children:(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:i()})});let r=e.find(e=>e._id===t)??e[0];return(0,Q.jsxs)(`div`,{className:`oc-injtab`,children:[(0,Q.jsxs)(`div`,{className:`oc-injtab__head`,children:[(0,Q.jsx)(z,{label:te(),help:ae()}),(0,Q.jsxs)(`label`,{className:`oc-injtab__picker`,children:[(0,Q.jsx)(`span`,{children:re()}),(0,Q.jsxs)(q,{value:r._id,onValueChange:e=>n(e),children:[(0,Q.jsx)(G,{size:`sm`,className:`min-w-44`,children:(0,Q.jsx)(Y,{})}),(0,Q.jsx)(J,{children:e.map(e=>(0,Q.jsx)(U,{value:e._id,children:e.displayName??e.name},e._id))})]})]})]}),(0,Q.jsx)(me,{instance:r},r._id)]})}function me({instance:e}){let t=k(y.admin.upsertInstanceConfig),n=ce(),r=N(y.me.getMe,{host:W}),i=e.config??{},a=X(e.config?.contentLocale,r?.defaultLocale??void 0),[o,s]=(0,Z.useState)(()=>L(i,a));(0,Z.useEffect)(()=>{s(L(i,a))},[a,e._id]);let[c,l]=(0,Z.useState)(!1),u=o.promptInjections,d=(e,t)=>s({...o,promptInjections:{...u,[e]:{...u[e],...t}}});async function f(){l(!0);try{await t({instanceId:e._id,config:B(o,i,a)})}catch(e){n.error(T(),e)}finally{l(!1)}}async function p(r){let i={...e.config??{}};r==="default"?delete i.contentLocale:i.contentLocale=r;try{await t({instanceId:e._id,config:i})}catch(e){n.error(T(),e)}}let m=e.config?.contentLocale??`default`,h=le[X(void 0,r?.defaultLocale??void 0)];return(0,Q.jsxs)(`div`,{className:`oc-injtab__body`,children:[(0,Q.jsxs)(`div`,{className:`oc-injtab__content-locale`,children:[(0,Q.jsx)(`span`,{children:oe()}),(0,Q.jsxs)(q,{value:m,onValueChange:e=>void p(e),children:[(0,Q.jsx)(G,{size:`sm`,className:`min-w-44`,children:(0,Q.jsx)(Y,{})}),(0,Q.jsxs)(J,{children:[(0,Q.jsx)(U,{value:`default`,children:D({locale:h})}),ue().map(e=>(0,Q.jsx)(U,{value:e.value,children:e.label},e.value))]})]}),(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:E()})]}),V.map(e=>(0,Q.jsx)(he,{injKey:e,def:R[e],i18n:$[e],row:u[e]??{enabled:!0,template:R[e].defaultTemplate[a]},contentLocale:a,onChange:t=>d(e,t)},e)),(0,Q.jsx)(`div`,{className:`oc-injtab__actions`,children:(0,Q.jsx)(H,{size:`sm`,onClick:()=>void f(),disabled:c,children:A()})})]})}function he({injKey:e,def:t,i18n:n,row:r,contentLocale:i,onChange:a}){let[o,s]=(0,Z.useState)(!1),c=r.template.trim()!==t.defaultTemplate[i],d=t.togglable&&!r.enabled,f=Object.fromEntries(t.placeholders.map(e=>[e,de[e]??`{${e}}`])),p=F(e,r,i),h=p?I(p,f):``;return(0,Q.jsxs)(`section`,{className:`oc-injcard`,children:[(0,Q.jsxs)(`div`,{className:`oc-injcard__head`,children:[t.togglable?(0,Q.jsxs)(`label`,{className:`oc-field--row`,children:[(0,Q.jsx)(K,{checked:r.enabled,onCheckedChange:e=>a({enabled:e===!0})}),(0,Q.jsx)(z,{label:n.label(),help:n.help()})]}):(0,Q.jsx)(z,{label:n.label(),help:n.help()}),c&&(0,Q.jsx)(`span`,{className:`oc-injection__badge`,children:w()})]}),(0,Q.jsx)(`textarea`,{className:`oc-injcard__text`,value:r.template,disabled:d,rows:8,spellCheck:!1,onChange:e=>a({template:e.target.value})}),(0,Q.jsxs)(`div`,{className:`oc-injection__foot`,children:[(0,Q.jsxs)(`div`,{className:`oc-injcard__phs`,children:[(0,Q.jsx)(`span`,{className:`oc-injection__ph`,children:u()}),t.placeholders.map(e=>(0,Q.jsxs)(`span`,{className:`oc-injcard__ph-chip`,children:[(0,Q.jsx)(`code`,{children:`{${e}}`}),(0,Q.jsx)(se,{text:(fe[e]??(()=>e))()})]},e))]}),(0,Q.jsxs)(`div`,{className:`oc-injcard__btns`,children:[(0,Q.jsx)(H,{variant:`ghost`,size:`sm`,onClick:()=>s(e=>!e),children:o?ne():P()}),c&&(0,Q.jsx)(H,{variant:`ghost`,size:`sm`,onClick:()=>a({template:t.defaultTemplate[i]}),children:S()})]})]}),o&&(0,Q.jsx)(`div`,{className:`oc-injcard__preview`,children:h?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`pre`,{className:`oc-injcard__previewtext`,children:h}),(0,Q.jsx)(`span`,{className:`oc-injection__ph`,children:m()})]}):(0,Q.jsx)(`span`,{className:`oc-injection__ph`,children:l()})})]})}export{pe as PromptInjectionsTab};
@@ -1 +0,0 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Ax as r,Bx as i,Cx as ee,Dx as a,Ex as te,Fx as o,Gx as s,Hx as c,Ix as l,Jx as u,Kx as d,Lx as f,Mx as p,Nx as m,Ox as ne,Px as h,Rx as g,Sx as re,T as _,Tx as v,Ux as y,Vx as b,Wx as x,ax as S,ba as C,bx as ie,cx as ae,dx as w,fx as T,jx as E,kx as D,lx as O,nI as k,ox as A,px as j,qx as M,rI as N,sx as P,ux as F,wx as I,xx as L,yx as R,zx as z}from"./dist-CNZ9o3sc.js";import{t as B}from"./button-BtQwDeC7.js";import{A as V,Gt as H,X as U,Y as W,d as G,m as K,wt as q}from"./index-9R1hg_pA.js";import{t as J}from"./roleDescriptions-DGSYA21e.js";var Y=t(e(),1),X=n(),Z=[{group:()=>u(),keys:[{key:`traces.read`,label:()=>y()},{key:`traces.read.content`,label:()=>c(),phi:!0},{key:`traces.write`,label:()=>b()}]},{group:()=>M(),keys:[{key:`kpi.read`,label:()=>y()},{key:`kpi.write`,label:()=>b()}]},{group:()=>d(),keys:[{key:`openclaw.query`,label:()=>i()},{key:`anomalies.read`,label:()=>z()},{key:`anomalies.report`,label:()=>g()}]},{group:()=>s(),keys:[{key:`chats.read`,label:()=>y()},{key:`selfheal`,label:()=>l()},{key:`feedback.respond`,label:()=>C()}]},{group:()=>x(),keys:[{key:`admin.manage`,label:()=>f()}]}],oe=Z.flatMap(e=>e.keys.map(e=>e.key));function Q(e){return e.includes(`*`)}var $={key:``,name:``,description:``};function se(){let e=N(_.apiKeys.listRoles,{}),t=k(_.apiKeys.createRole),n=k(_.apiKeys.ensureRolesSeeded),i=k(_.apiKeys.updateRolePermissions).withOptimisticUpdate((e,{roleId:t,permissions:n})=>{let r=e.getQuery(_.apiKeys.listRoles,{});r&&e.setQuery(_.apiKeys.listRoles,{},r.map(e=>e._id===t?{...e,permissions:n}:e))}),s=V(),c=q(),[l,u]=(0,Y.useState)(!1),[d,f]=(0,Y.useState)($),[g,y]=(0,Y.useState)(new Set);(0,Y.useEffect)(()=>{n({}).catch(e=>{c.error(h(),e)})},[n,c]);let b=e??[];async function x(e,t){if(Q(e.permissions))return;if(e.builtin){await s({title:m({name:e.name}),description:p(),confirmLabel:E()});return}if(g.has(e._id))return;let n=e.permissions.includes(t)?e.permissions.filter(e=>e!==t):[...e.permissions,t];y(t=>new Set(t).add(e._id));try{await i({roleId:e._id,permissions:n})}catch(e){c.error(r(),e)}finally{y(t=>{let n=new Set(t);return n.delete(e._id),n})}}async function C(){try{await t({key:d.key,name:d.name,description:d.description||void 0,permissions:[]}),f($),u(!1)}catch(e){c.error(D(),e)}}let M=e===void 0,z=!M&&b.length===0;return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`p`,{className:`oc-admin__hint`,children:[ne(),` `,(0,X.jsx)(`code`,{children:`admin`}),` `,a(),` `,(0,X.jsx)(`code`,{children:`traces.read.content`}),` `,te()]}),(0,X.jsxs)(`div`,{className:`oc-dt`,children:[(0,X.jsxs)(`div`,{className:`oc-dt__bar`,children:[(0,X.jsx)(`h2`,{className:`oc-dt__title`,children:v()}),(0,X.jsx)(`div`,{className:`oc-dt__bar-actions`,children:(0,X.jsx)(B,{size:`sm`,onClick:()=>{f($),u(!0)},children:I()})})]}),M?(0,X.jsx)(`p`,{className:`oc-admin__hint`,children:ee()}):z?(0,X.jsx)(`p`,{className:`oc-admin__hint`,children:re()}):(0,X.jsx)(`div`,{className:`oc-matrix__scroll`,children:(0,X.jsxs)(`table`,{className:`oc-matrix`,children:[(0,X.jsxs)(`thead`,{children:[(0,X.jsxs)(`tr`,{children:[(0,X.jsx)(`th`,{className:`oc-matrix__corner`,rowSpan:2,children:L()}),Z.map(e=>(0,X.jsx)(`th`,{className:`oc-matrix__group`,colSpan:e.keys.length,children:e.group()},e.group()))]}),(0,X.jsx)(`tr`,{children:Z.flatMap(e=>e.keys.map(e=>(0,X.jsxs)(`th`,{className:`oc-matrix__perm`,title:e.phi?o({key:e.key}):e.key,children:[e.label(),e.phi?(0,X.jsx)(`span`,{className:`oc-matrix__phi`,children:` ⚠`}):null]},e.key)))})]}),(0,X.jsx)(`tbody`,{children:b.map(e=>{let t=Q(e.permissions),n=g.has(e._id);return(0,X.jsxs)(`tr`,{children:[(0,X.jsxs)(`th`,{className:`oc-matrix__rolecell`,children:[(0,X.jsxs)(`div`,{className:`oc-matrix__rolename`,children:[(0,X.jsx)(`span`,{children:e.name}),(0,X.jsx)(`code`,{className:`oc-matrix__rolekey`,children:e.key}),e.builtin?(0,X.jsxs)(W,{variant:`outline`,className:`gap-1`,children:[(0,X.jsx)(H,{}),` `,ie()]}):(0,X.jsx)(W,{variant:`secondary`,children:R()})]}),J(e)?(0,X.jsx)(`p`,{className:`oc-matrix__roledesc`,children:J(e)}):null]}),oe.map(r=>(0,X.jsx)(`td`,{className:`oc-matrix__cell`,children:(0,X.jsx)(K,{checked:t||e.permissions.includes(r),disabled:t||n,"aria-label":`${e.key} · ${r}`,title:t?j():n?T():r,onCheckedChange:()=>void x(e,r)})},r))]},e.key)})})]})})]}),(0,X.jsx)(G,{open:l,onOpenChange:u,title:w(),description:F(),canSubmit:!!(d.key&&d.name),onSubmit:C,submitLabel:O(),children:(0,X.jsxs)(`div`,{className:`oc-form`,children:[(0,X.jsxs)(`label`,{className:`oc-field`,children:[(0,X.jsx)(`span`,{className:`oc-field__label`,children:ae()}),(0,X.jsx)(U,{value:d.key,placeholder:P(),onChange:e=>f({...d,key:e.target.value})})]}),(0,X.jsxs)(`label`,{className:`oc-field`,children:[(0,X.jsx)(`span`,{className:`oc-field__label`,children:A()}),(0,X.jsx)(U,{value:d.name,onChange:e=>f({...d,name:e.target.value})})]}),(0,X.jsxs)(`label`,{className:`oc-field`,children:[(0,X.jsx)(`span`,{className:`oc-field__label`,children:S()}),(0,X.jsx)(U,{value:d.description,onChange:e=>f({...d,description:e.target.value})})]})]})})]})}export{se as RolesTab};
@@ -1 +0,0 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$M as r,$N as i,AN as a,AP as o,BN as s,D as c,DN as ee,DP as te,EN as l,EP as ne,FN as re,FP as ie,HN as u,IN as d,IP as f,JF as p,JN as m,KM as ae,LN as oe,LP as se,MN as h,MP as ce,NN as le,NP as ue,ON as g,OP as de,PN as fe,PP as pe,QM as me,QN as he,RN as ge,RP as _e,T as _,TN as ve,TP as ye,UN as be,VN as xe,XF as v,XN as Se,YN as Ce,ZN as we,aN as Te,aP as Ee,cN as De,dN as Oe,eI as y,eN as ke,eP as Ae,fN as je,hN as Me,iN as Ne,iP as Pe,jN as b,jP as Fe,kN as x,kP as Ie,lN as Le,mN as Re,nN as ze,oN as Be,oP as Ve,pN as He,qN as Ue,rN as We,rP as Ge,sN as Ke,sP as qe,tN as Je,tP as S,uN as Ye,wP as Xe,zN as Ze}from"./dist-CNZ9o3sc.js";import{n as C}from"./dist-BCNlHm__.js";import{t as w}from"./chevrons-up-down-ImFHIr_N.js";import{t as T}from"./button-BtQwDeC7.js";import{$ as Qe,F as $e,Ft as et,Ht as tt,I as nt,Kt as rt,L as it,M as at,Mt as ot,N as st,O as ct,P as lt,Q as ut,R as dt,Ut as ft,Vt as pt,X as E,Y as D,Z as mt,at as O,ct as k,en as A,et as ht,it as j,k as gt,lt as M,nt as _t,ot as N,rt as P,st as F,tn as I,tt as vt,ut as L,wt as yt,z as bt,zt as xt}from"./index-9R1hg_pA.js";import{a as St,i as R,n as Ct,o as wt,r as z,t as Tt}from"./table-C9PafBK9.js";import{t as Et}from"./FilterBar-DRRfKRTQ.js";var Dt=c(`calendar-days`,[[`path`,{d:`M8 2v4`,key:`1cmpym`}],[`path`,{d:`M16 2v4`,key:`4m81vk`}],[`rect`,{width:`18`,height:`18`,x:`3`,y:`4`,rx:`2`,key:`1hopcy`}],[`path`,{d:`M3 10h18`,key:`8toen8`}],[`path`,{d:`M8 14h.01`,key:`6423bh`}],[`path`,{d:`M12 14h.01`,key:`1etili`}],[`path`,{d:`M16 14h.01`,key:`1gbofw`}],[`path`,{d:`M8 18h.01`,key:`lrp35t`}],[`path`,{d:`M12 18h.01`,key:`mhygvu`}],[`path`,{d:`M16 18h.01`,key:`kzsmim`}]]),Ot=c(`history`,[[`path`,{d:`M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`,key:`1357e3`}],[`path`,{d:`M3 3v5h5`,key:`1xhq8a`}],[`path`,{d:`M12 7v5l4 2`,key:`1fdv2h`}]]),B=t(e(),1);function V(e){if(e==null||e===``)return`none`;let t=e.trim().toLowerCase();return t===`ok`||t===`success`||t===`completed`?`ok`:t===`error`||t===`failed`||t===`failure`?`error`:t===`running`||t===`in_progress`||t===`pending`?`running`:`other`}function kt(e){return e===!0?`active`:e===!1?`paused`:`unknown`}var At={q:``,state:`all`,result:`all`};function jt(e){return e.q.trim()!==``||e.state!==`all`||e.result!==`all`}function Mt(e,t){let n=t.q.trim().toLowerCase();return!(n!==``&&!`${e.name??``} ${e.agentId}`.toLowerCase().includes(n)||t.state!==`all`&&kt(e.enabled)!==t.state||t.result!==`all`&&V(e.lastRunStatus)!==t.result)}function H(){try{let e=Intl.supportedValuesOf;return typeof e==`function`?e(`timeZone`):[]}catch{return[]}}function U(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone??``}catch{return``}}function W(e,t,n=50,r){let i=e=>e.toLowerCase().replace(/[_/]+/g,` `),a=i(t.trim()),o=(a===``?e:e.filter(e=>i(e).includes(a))).slice(0,n);return r&&r!==``&&!o.includes(r)?[r,...o].slice(0,n):o}function G(e,t){let n=(new Date(e,t,1).getDay()+6)%7,r=new Date(e,t,1-n),i=[];for(let e=0;e<42;e++){let n=new Date(r.getFullYear(),r.getMonth(),r.getDate()+e);i.push({year:n.getFullYear(),month:n.getMonth(),day:n.getDate(),inMonth:n.getMonth()===t})}return i}function K(e,t,n,r,i){let a=(e,t=2)=>String(e).padStart(t,`0`);return`${a(e,4)}-${a(t+1)}-${a(n)}T${a(r)}:${a(i)}`}function q(e){let t=/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2})$/.exec(e);if(t===null)return null;let[,n,r,i,a,o]=t;return{year:Number(n),month:Number(r)-1,day:Number(i),hour:Number(a),minute:Number(o)}}var J=n();function Nt({value:e,onChange:t,className:n}){let r=(0,B.useMemo)(()=>H(),[]),[i,a]=(0,B.useState)(!1),[o,s]=(0,B.useState)(``);if(r.length===0)return(0,J.jsx)(E,{value:e,onChange:e=>t(e.target.value),placeholder:U()||`America/Toronto`,className:n});let c=W(r,o,60,e||void 0),ee=e===``?U()||b():e;return(0,J.jsxs)(P,{open:i,onOpenChange:e=>{a(e),e||s(``)},children:[(0,J.jsx)(O,{asChild:!0,children:(0,J.jsxs)(`button`,{type:`button`,className:`oc-tzcombo__trigger${n?` ${n}`:``}`,"aria-label":fe(),children:[(0,J.jsx)(`span`,{className:`oc-tzcombo__value`,children:ee}),(0,J.jsx)(w,{size:14,"aria-hidden":!0,className:`oc-tzcombo__chev`})]})}),(0,J.jsxs)(j,{align:`start`,className:`oc-tzcombo__pop p-0`,children:[(0,J.jsx)(E,{autoFocus:!0,value:o,onChange:e=>s(e.target.value),placeholder:le(),className:`oc-tzcombo__search`}),(0,J.jsx)(`div`,{className:`oc-tzcombo__list`,role:`listbox`,children:c.length===0?(0,J.jsx)(`p`,{className:`oc-tzcombo__empty`,children:h()}):c.map(n=>(0,J.jsxs)(`button`,{type:`button`,role:`option`,"aria-selected":n===e,className:`oc-tzcombo__opt`,onClick:()=>{t(n),a(!1),s(``)},children:[(0,J.jsx)(C,{size:13,"aria-hidden":!0,className:`oc-tzcombo__check`,style:{opacity:+(n===e)}}),(0,J.jsx)(`span`,{children:n})]},n))})]})]})}function Y(e){try{let t=new Intl.DateTimeFormat(e,{weekday:`narrow`});return Array.from({length:7},(e,n)=>t.format(new Date(2024,0,1+n)))}catch{return[`M`,`T`,`W`,`T`,`F`,`S`,`S`]}}function Pt({value:e,onChange:t}){let n=q(e),r=(0,B.useMemo)(()=>new Date,[]),[i,o]=(0,B.useState)(()=>({year:n?.year??r.getFullYear(),month:n?.month??r.getMonth()})),[s,c]=(0,B.useState)(!1),te=(0,B.useMemo)(()=>Y(v()),[]),ne=(0,B.useMemo)(()=>new Intl.DateTimeFormat(v(),{month:`long`,year:`numeric`}),[]),re=(0,B.useMemo)(()=>new Intl.DateTimeFormat(v(),{dateStyle:`medium`,timeStyle:`short`}),[]),ie=G(i.year,i.month),u=n?.hour??9,d=n?.minute??0,f=(e,n,r,i,a)=>t(K(e,n,r,i,a)),p=(e,t,n)=>{o({year:e,month:t}),f(e,t,n,u,d)},m=e=>{let t=new Date(i.year,i.month+e,1);o({year:t.getFullYear(),month:t.getMonth()})},ae=n===null?x():re.format(new Date(n.year,n.month,n.day,n.hour,n.minute));return(0,J.jsxs)(P,{open:s,onOpenChange:c,children:[(0,J.jsx)(O,{asChild:!0,children:(0,J.jsxs)(`button`,{type:`button`,className:`oc-dtp__trigger`,"aria-label":a(),children:[(0,J.jsx)(Dt,{size:14,"aria-hidden":!0,className:`oc-dtp__icon`}),(0,J.jsx)(`span`,{className:n===null?`oc-dtp__placeholder`:void 0,children:ae})]})}),(0,J.jsxs)(j,{align:`start`,className:`oc-dtp__pop`,children:[(0,J.jsxs)(`div`,{className:`oc-dtp__head`,children:[(0,J.jsx)(`button`,{type:`button`,className:`oc-dtp__nav`,"aria-label":g(),onClick:()=>m(-1),children:(0,J.jsx)(I,{size:15,"aria-hidden":!0})}),(0,J.jsx)(`span`,{className:`oc-dtp__month`,children:ne.format(new Date(i.year,i.month,1))}),(0,J.jsx)(`button`,{type:`button`,className:`oc-dtp__nav`,"aria-label":ee(),onClick:()=>m(1),children:(0,J.jsx)(A,{size:15,"aria-hidden":!0})})]}),(0,J.jsxs)(`div`,{className:`oc-dtp__grid`,children:[te.map((e,t)=>(0,J.jsx)(`span`,{className:`oc-dtp__wd`,children:e},t)),ie.map((e,t)=>{let i=n!==null&&n.year===e.year&&n.month===e.month&&n.day===e.day,a=r.getFullYear()===e.year&&r.getMonth()===e.month&&r.getDate()===e.day;return(0,J.jsx)(`button`,{type:`button`,className:`oc-dtp__day`+(e.inMonth?``:` oc-dtp__day--out`)+(i?` oc-dtp__day--sel`:``)+(a&&!i?` oc-dtp__day--today`:``),onClick:()=>p(e.year,e.month,e.day),children:e.day},t)})]}),(0,J.jsxs)(`div`,{className:`oc-dtp__time`,children:[(0,J.jsxs)(N,{value:String(u),onValueChange:e=>f(i.year,i.month,n?.day??r.getDate(),Number(e),d),children:[(0,J.jsx)(M,{size:`sm`,"aria-label":l(),children:(0,J.jsx)(L,{})}),(0,J.jsx)(F,{className:`oc-dtp__timeopts`,children:Array.from({length:24},(e,t)=>(0,J.jsx)(k,{value:String(t),children:String(t).padStart(2,`0`)},t))})]}),(0,J.jsx)(`span`,{className:`oc-dtp__colon`,children:`:`}),(0,J.jsxs)(N,{value:String(d),onValueChange:e=>f(i.year,i.month,n?.day??r.getDate(),u,Number(e)),children:[(0,J.jsx)(M,{size:`sm`,"aria-label":ve(),children:(0,J.jsx)(L,{})}),(0,J.jsx)(F,{className:`oc-dtp__timeopts`,children:Array.from({length:60},(e,t)=>(0,J.jsx)(k,{value:String(t),children:String(t).padStart(2,`0`)},t))})]})]})]})]})}var X={minutes:6e4,hours:36e5,days:864e5};function Z(e){return e?.data?.code??`unknown`}function Ft({status:e}){switch(V(e)){case`ok`:return(0,J.jsx)(D,{variant:`secondary`,children:u()});case`error`:return(0,J.jsx)(D,{variant:`destructive`,children:xe()});case`running`:return(0,J.jsx)(D,{variant:`outline`,children:s()});case`other`:return(0,J.jsx)(D,{variant:`outline`,children:e});case`none`:return(0,J.jsx)(`span`,{className:`text-muted-foreground`,children:`—`})}}function Q(){let e=y(_.scheduled.listMyCrons),t=y(_.scheduled.getCronDetail),n=y(_.scheduled.listCronRuns),a=y(_.scheduled.updateCron),c=y(_.scheduled.removeCron),ee=y(_.scheduled.runCronNow),l=yt(),[h,le]=(0,B.useState)(null),[g,fe]=(0,B.useState)(!1),[ve,b]=(0,B.useState)(!1),[x,C]=(0,B.useState)(null),[w,O]=(0,B.useState)(null),[A,j]=(0,B.useState)(null),[P,I]=(0,B.useState)(null),[Dt,V]=(0,B.useState)(!1),[H,U]=(0,B.useState)(At),W=(0,B.useCallback)(async()=>{fe(!0),b(!1);try{le(await e({}))}catch{b(!0)}finally{fe(!1)}},[e]);(0,B.useEffect)(()=>{W()},[W]);let G=(0,B.useMemo)(()=>new URLSearchParams(window.location.search).get(`job`),[]),K=(0,B.useRef)(null);(0,B.useEffect)(()=>{h!==null&&K.current!==null&&K.current.scrollIntoView({block:`center`})},[h]);let q=(0,B.useMemo)(()=>new Intl.DateTimeFormat(v(),{dateStyle:`medium`,timeStyle:`short`}),[]),Y=async(e,t,n)=>{C(e);try{await t(),l.success(n),await W()}catch(e){l.toast({variant:`error`,title:S({code:Z(e)})})}finally{C(null)}},Q=(0,B.useRef)(0),$=(0,B.useRef)(0),It=async(e,t)=>{if(t.id===null)return;let r=++Q.current;j({name:t.name??t.id,entries:null});try{let i=await n({instanceName:e,jobId:t.id,limit:20});if(r!==Q.current)return;j({name:t.name??t.id,entries:i})}catch(e){if(r!==Q.current)return;j(null),l.toast({variant:`error`,title:S({code:Z(e)})})}},Lt=async(e,n)=>{if(n.id===null)return;let r=++$.current;I({instanceName:e,jobId:n.id,loading:!0,name:n.name??``,scheduleKind:`cron`,cronExpr:``,tz:``,everyValue:`1`,everyUnit:`hours`,at:``,message:``,hasMessage:!1,scheduleDirty:!1,messageDirty:!1,nameDirty:!1});try{let i=(await t({instanceName:e,jobId:n.id})).job,a=i.scheduleKind===`every`||i.scheduleKind===`at`?i.scheduleKind:`cron`,o=``;if(a===`at`&&i.scheduleExpr!==null){let e=Date.parse(i.scheduleExpr);Number.isFinite(e)&&(o=new Date(e-new Date(e).getTimezoneOffset()*6e4).toISOString().slice(0,16))}let s=`1`,c=`hours`;if(a===`every`&&i.scheduleExpr!==null){let e=Number(i.scheduleExpr);Number.isFinite(e)&&e>0&&(e%X.days===0?(s=String(e/X.days),c=`days`):e%X.hours===0?(s=String(e/X.hours),c=`hours`):(s=String(Math.max(1,Math.round(e/X.minutes))),c=`minutes`))}if(r!==$.current)return;I(e=>e===null||e.jobId!==n.id?e:{...e,loading:!1,name:i.name??e.name,scheduleKind:a,cronExpr:a===`cron`?i.scheduleExpr??``:``,tz:i.tz??``,everyValue:s,everyUnit:c,at:o,message:i.message??``,hasMessage:i.message!==null&&!i.messageTruncated})}catch(e){if(r!==$.current)return;I(null),l.toast({variant:`error`,title:S({code:Z(e)})})}},Rt=async()=>{if(P===null)return;let e={};if(P.nameDirty&&P.name.trim()===``||P.messageDirty&&P.hasMessage&&P.message.trim()===``){l.toast({variant:`error`,title:me()});return}if(P.nameDirty&&P.name.trim()!==``&&(e.name=P.name.trim()),P.scheduleDirty){if(P.scheduleKind===`cron`&&P.cronExpr.trim()!==``)e.schedule={kind:`cron`,expr:P.cronExpr.trim(),...P.tz.trim()===``?{}:{tz:P.tz.trim()}};else if(P.scheduleKind===`every`){let t=Number(P.everyValue);Number.isFinite(t)&&t>=1&&(e.schedule={kind:`every`,everyMs:Math.round(t*X[P.everyUnit])})}else if(P.scheduleKind===`at`&&P.at!==``){let t=Date.parse(P.at);Number.isFinite(t)&&(e.schedule={kind:`at`,at:new Date(t).toISOString()})}}if(P.scheduleDirty&&e.schedule===void 0){l.toast({variant:`error`,title:r()});return}if(P.messageDirty&&P.hasMessage&&P.message.trim()!==``&&(e.message=P.message.trim()),Object.keys(e).length===0){I(null);return}let t=$.current;V(!0);try{await a({instanceName:P.instanceName,jobId:P.jobId,patch:e}),l.success(je()),t===$.current&&I(null),await W()}catch(e){l.toast({variant:`error`,title:S({code:Z(e)})})}finally{V(!1)}},zt=h?.reduce((e,t)=>e+t.jobs.length,0)??0;return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(`div`,{style:{display:`flex`,alignItems:`flex-start`,gap:8,marginBottom:12},children:[(0,J.jsx)(`p`,{className:`oc-admin__hint`,style:{flex:1,margin:0},children:_e()}),(0,J.jsxs)(T,{variant:`ghost`,size:`sm`,onClick:()=>void W(),disabled:g,style:{display:`inline-flex`,alignItems:`center`,gap:4},children:[(0,J.jsx)(xt,{size:14,"aria-hidden":!0}),se()]})]}),h!==null&&zt>0?(0,J.jsxs)(Et,{q:H.q,onQChange:e=>U(t=>({...t,q:e})),searchPlaceholder:ge(),onReset:()=>U(At),canReset:jt(H),children:[(0,J.jsxs)(N,{value:H.state,onValueChange:e=>U(t=>({...t,state:e})),children:[(0,J.jsx)(M,{size:`sm`,className:`w-40`,children:(0,J.jsx)(L,{})}),(0,J.jsxs)(F,{children:[(0,J.jsx)(k,{value:`all`,children:oe()}),(0,J.jsx)(k,{value:`active`,children:Xe()}),(0,J.jsx)(k,{value:`paused`,children:ye()})]})]}),(0,J.jsxs)(N,{value:H.result,onValueChange:e=>U(t=>({...t,result:e})),children:[(0,J.jsx)(M,{size:`sm`,className:`w-40`,children:(0,J.jsx)(L,{})}),(0,J.jsxs)(F,{children:[(0,J.jsx)(k,{value:`all`,children:d()}),(0,J.jsx)(k,{value:`ok`,children:u()}),(0,J.jsx)(k,{value:`error`,children:xe()}),(0,J.jsx)(k,{value:`running`,children:s()}),(0,J.jsx)(k,{value:`none`,children:Ze()})]})]})]}):null,h===null?(0,J.jsx)(`p`,{className:`oc-admin__hint`,"aria-busy":g,children:ve?f():p()}):(0,J.jsxs)(J.Fragment,{children:[ve?(0,J.jsx)(`p`,{className:`oc-admin__hint`,children:f()}):null,h.length===0?(0,J.jsx)(`p`,{className:`oc-admin__hint`,children:ie()}):null,h.map(e=>{let t=e.jobs.filter(e=>Mt(e,H)),n=jt(H)&&e.jobs.length>0&&t.length===0;return(0,J.jsxs)(`section`,{style:{marginBottom:20},children:[h.length>1||e.error||!e.supported?(0,J.jsxs)(`h3`,{style:{display:`flex`,alignItems:`center`,gap:8,fontSize:`0.85rem`,fontWeight:600,margin:`0 0 6px`},children:[e.instanceName,(0,J.jsx)(D,{variant:`outline`,children:e.kind})]}):null,e.supported?e.error?(0,J.jsx)(`p`,{className:`oc-admin__hint`,children:ue({code:e.error})}):e.jobs.length===0?(0,J.jsx)(`p`,{className:`oc-admin__hint`,children:ce()}):n?(0,J.jsx)(`p`,{className:`oc-admin__hint`,children:re()}):(0,J.jsxs)(Tt,{children:[(0,J.jsx)(St,{children:(0,J.jsxs)(wt,{children:[(0,J.jsx)(R,{children:Fe()}),(0,J.jsx)(R,{children:o()}),(0,J.jsx)(R,{children:Ie()}),(0,J.jsx)(R,{children:de()}),(0,J.jsx)(R,{children:te()}),(0,J.jsx)(R,{children:be()}),(0,J.jsx)(R,{children:Me()})]})}),(0,J.jsx)(Ct,{children:t.map((t,n)=>{let r=`${e.instanceName}:${t.id??n}`,o=x===r,s=e.manageSupported,c=e.kind===`openclaw`&&s;return(0,J.jsxs)(wt,{ref:t.id!==null&&t.id===G?K:void 0,"data-state":t.id!==null&&t.id===G?`selected`:void 0,children:[(0,J.jsx)(z,{className:`font-medium`,style:{maxWidth:280,overflow:`hidden`,textOverflow:`ellipsis`},title:t.name??void 0,children:t.name??ne()}),(0,J.jsx)(z,{children:(0,J.jsx)(D,{variant:`secondary`,children:t.agentId})}),(0,J.jsxs)(z,{className:`whitespace-nowrap`,children:[(0,J.jsx)(`span`,{style:{fontFamily:`var(--font-mono, monospace)`},children:t.schedule??`—`}),(()=>{let e=ct(t.schedule),n=e===null?null:gt(e);return n===null?null:(0,J.jsx)(`span`,{className:`text-muted-foreground`,style:{display:`block`,fontSize:`0.78rem`},children:n})})()]}),(0,J.jsx)(z,{className:`whitespace-nowrap text-muted-foreground`,children:t.nextRunAtMs===null?`—`:q.format(t.nextRunAtMs)}),(0,J.jsx)(z,{children:kt(t.enabled)===`active`?(0,J.jsx)(D,{variant:`secondary`,children:Xe()}):kt(t.enabled)===`paused`?(0,J.jsx)(D,{variant:`outline`,children:ye()}):(0,J.jsx)(`span`,{className:`text-muted-foreground`,children:`—`})}),(0,J.jsx)(z,{children:(0,J.jsx)(Ft,{status:t.lastRunStatus})}),(0,J.jsx)(z,{className:`whitespace-nowrap`,children:t.id===null?(0,J.jsx)(`span`,{className:`text-muted-foreground`,children:`—`}):o?(0,J.jsx)(rt,{size:14,className:`oc-actrow__spin`,"aria-hidden":!0}):(0,J.jsxs)(`span`,{className:`oc-cronactions`,children:[c?(0,J.jsx)(T,{variant:`ghost`,size:`icon-sm`,title:Ve(),"aria-label":Ve(),disabled:x!==null,onClick:()=>void Y(r,async()=>{let n=await ee({instanceName:e.instanceName,jobId:t.id});if(n.ran!==!0&&n.runId===null)throw{data:{code:n.reason??`run_not_started`}}},Ae()),children:(0,J.jsx)(ot,{size:14,"aria-hidden":!0})}):null,c&&t.enabled!==null?(0,J.jsx)(T,{variant:`ghost`,size:`icon-sm`,title:t.enabled?Ee():Pe(),"aria-label":t.enabled?Ee():Pe(),disabled:x!==null,onClick:()=>void Y(r,()=>a({instanceName:e.instanceName,jobId:t.id,patch:{enabled:!t.enabled}}),t.enabled?i():he()),children:t.enabled?(0,J.jsx)(ft,{size:14,"aria-hidden":!0}):(0,J.jsx)(pt,{size:14,"aria-hidden":!0})}):null,c?(0,J.jsx)(T,{variant:`ghost`,size:`icon-sm`,title:Re(),"aria-label":Re(),disabled:x!==null,onClick:()=>void Lt(e.instanceName,t),children:(0,J.jsx)(tt,{size:14,"aria-hidden":!0})}):null,c?(0,J.jsx)(T,{variant:`ghost`,size:`icon-sm`,title:He(),"aria-label":He(),disabled:x!==null,onClick:()=>void It(e.instanceName,t),children:(0,J.jsx)(Ot,{size:14,"aria-hidden":!0})}):null,s?(0,J.jsx)(T,{variant:`ghost`,size:`icon-sm`,title:Ge(),"aria-label":Ge(),disabled:x!==null,onClick:()=>O({instanceName:e.instanceName,jobId:t.id,name:t.name??t.id}),children:(0,J.jsx)(et,{size:14,"aria-hidden":!0})}):null]})})]},t.id??`${e.instanceName}-${n}`)})})]}):(0,J.jsx)(`p`,{className:`oc-admin__hint`,children:pe()})]},e.instanceName)}),zt>0?(0,J.jsx)(`p`,{className:`oc-admin__hint`,style:{marginTop:4},children:ae()}):null]}),(0,J.jsx)(at,{open:w!==null,onOpenChange:e=>{e||O(null)},children:(0,J.jsxs)($e,{children:[(0,J.jsxs)(dt,{children:[(0,J.jsx)(bt,{children:Se()}),(0,J.jsx)(nt,{children:Ce({name:w?.name??``})})]}),(0,J.jsxs)(it,{children:[(0,J.jsx)(lt,{children:m()}),(0,J.jsx)(st,{onClick:()=>{let e=w;O(null),e!==null&&Y(`${e.instanceName}:${e.jobId}`,()=>c({instanceName:e.instanceName,jobId:e.jobId}),we())},children:Ue()})]})]})}),(0,J.jsx)(mt,{open:A!==null,onOpenChange:e=>{e||(Q.current++,j(null))},children:(0,J.jsxs)(ut,{style:{maxWidth:640},children:[(0,J.jsx)(vt,{children:(0,J.jsx)(_t,{children:Oe({name:A?.name??``})})}),A?.entries===null?(0,J.jsx)(`p`,{className:`oc-admin__hint`,children:p()}):A!==null&&A.entries.length===0?(0,J.jsx)(`p`,{className:`oc-admin__hint`,children:Ye()}):A===null?null:(0,J.jsx)(`div`,{className:`oc-cronpanel__runs`,style:{maxHeight:420,overflowY:`auto`},children:A.entries.map((e,t)=>(0,J.jsxs)(`div`,{className:`oc-cronpanel__run`,children:[(0,J.jsxs)(`div`,{className:`oc-cronpanel__run-head`,children:[(0,J.jsx)(Ft,{status:e.status}),(0,J.jsx)(`span`,{children:typeof(e.runAtMs??e.ts)==`number`?q.format(e.runAtMs??e.ts):`—`}),typeof e.durationMs==`number`?(0,J.jsxs)(`span`,{className:`oc-cronpanel__run-dur`,children:[Math.round(e.durationMs/1e3),`s`]}):null]}),e.summary===null?null:(0,J.jsx)(`div`,{className:`oc-cronpanel__run-summary`,children:e.summary}),e.error===null?null:(0,J.jsx)(`div`,{className:`oc-cronpanel__run-error`,children:e.error})]},t))})]})}),(0,J.jsx)(mt,{open:P!==null,onOpenChange:e=>{e||($.current++,I(null))},children:(0,J.jsxs)(ut,{className:`oc-cronedit`,children:[(0,J.jsxs)(vt,{children:[(0,J.jsx)(_t,{children:Le()}),(0,J.jsx)(Qe,{children:De()})]}),P===null?null:P.loading?(0,J.jsx)(`p`,{className:`oc-admin__hint`,children:p()}):(0,J.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:12},children:[(0,J.jsxs)(`label`,{style:{display:`flex`,flexDirection:`column`,gap:4},children:[(0,J.jsx)(`span`,{className:`oc-admin__hint`,style:{margin:0},children:Fe()}),(0,J.jsx)(E,{value:P.name,maxLength:200,onChange:e=>I({...P,name:e.target.value,nameDirty:!0})})]}),(0,J.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:4},children:[(0,J.jsx)(`span`,{className:`oc-admin__hint`,style:{margin:0},children:Ke()}),(0,J.jsxs)(N,{value:P.scheduleKind,onValueChange:e=>I({...P,scheduleKind:e,scheduleDirty:!0}),children:[(0,J.jsx)(M,{children:(0,J.jsx)(L,{})}),(0,J.jsxs)(F,{children:[(0,J.jsx)(k,{value:`cron`,children:Be()}),(0,J.jsx)(k,{value:`every`,children:Te()}),(0,J.jsx)(k,{value:`at`,children:Ne()})]})]}),P.scheduleKind===`cron`?(0,J.jsxs)(`div`,{style:{display:`flex`,gap:8},children:[(0,J.jsx)(E,{value:P.cronExpr,onChange:e=>I({...P,cronExpr:e.target.value,scheduleDirty:!0}),placeholder:`30 9 * * *`,style:{fontFamily:`var(--font-mono, monospace)`}}),(0,J.jsx)(Nt,{value:P.tz,onChange:e=>I({...P,tz:e,scheduleDirty:!0})})]}):P.scheduleKind===`every`?(0,J.jsxs)(`div`,{style:{display:`flex`,gap:8},children:[(0,J.jsx)(E,{type:`number`,min:1,value:P.everyValue,onChange:e=>I({...P,everyValue:e.target.value,scheduleDirty:!0}),style:{maxWidth:120}}),(0,J.jsxs)(N,{value:P.everyUnit,onValueChange:e=>I({...P,everyUnit:e,scheduleDirty:!0}),children:[(0,J.jsx)(M,{style:{maxWidth:160},children:(0,J.jsx)(L,{})}),(0,J.jsxs)(F,{children:[(0,J.jsx)(k,{value:`minutes`,children:We()}),(0,J.jsx)(k,{value:`hours`,children:ze()}),(0,J.jsx)(k,{value:`days`,children:Je()})]})]})]}):(0,J.jsx)(Pt,{value:P.at,onChange:e=>I({...P,at:e,scheduleDirty:!0})})]}),P.hasMessage?(0,J.jsxs)(`label`,{style:{display:`flex`,flexDirection:`column`,gap:4},children:[(0,J.jsx)(`span`,{className:`oc-admin__hint`,style:{margin:0},children:qe()}),(0,J.jsx)(`textarea`,{className:`oc-cronedit__textarea`,rows:4,value:P.message,onChange:e=>I({...P,message:e.target.value,messageDirty:!0})})]}):null]}),(0,J.jsxs)(ht,{children:[(0,J.jsx)(T,{variant:`ghost`,onClick:()=>I(null),children:m()}),(0,J.jsxs)(T,{onClick:()=>void Rt(),disabled:P===null||P.loading||Dt,children:[Dt?(0,J.jsx)(rt,{size:14,className:`oc-actrow__spin`,"aria-hidden":!0}):null,ke()]})]})]})})]})}export{Q as ScheduledTab};
@@ -1 +0,0 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$k as r,AA as i,Ak as a,Bk as ee,CA as te,Ck as o,DA as s,Dk as c,EA as ne,Ek as l,Fk as u,Gk as re,Hk as ie,Ik as d,Jk as ae,Kk as oe,Lk as se,MA as ce,Mk as f,NA as le,Nk as p,OA as m,Ok as h,Pk as g,Qk as ue,Rk as de,SA as fe,Sk as pe,T as _,TA as me,Tk as he,Uk as ge,Vk as _e,Wk as ve,Xk as ye,Yk as be,Zk as xe,_A as Se,_k as v,aA as Ce,bA as we,bk as y,cA as Te,dA as Ee,eA as De,eI as Oe,fA as ke,gA as Ae,gk as b,hA as je,hk as x,iA as Me,jA as Ne,jk as S,kA as Pe,kk as C,lA as Fe,mA as Ie,mk as w,nA as Le,nI as T,oA as Re,pA as ze,pk as E,qk as Be,rA as Ve,rI as D,sA as He,tA as Ue,uA as We,vA as Ge,vk as O,wA as Ke,wk as k,xA as qe,xk as A,yA as Je,yk as j,zk as Ye}from"./dist-CNZ9o3sc.js";import{n as M}from"./dist-BCNlHm__.js";import{i as Xe}from"./dist-VGy3W8j2.js";import{t as N}from"./button-BtQwDeC7.js";import{$ as P,A as Ze,B as F,Q as I,V as L,X as R,Y as z,Z as B,Zt as V,ct as H,d as Qe,en as $e,et,in as tt,lt as U,nt,ot as W,rn as rt,st as G,tt as K,ut as q,wt as it}from"./index-9R1hg_pA.js";import{t as at}from"./FilterBar-DRRfKRTQ.js";import{t as ot}from"./DataTableShell-zzaGmfMk.js";import{t as st}from"./roleDescriptions-DGSYA21e.js";var J=t(e(),1),Y=n(),ct=[{value:`never`,label:()=>j(),days:null},{value:`30`,label:()=>O(),days:30},{value:`90`,label:()=>v(),days:90}],X=720*60*60*1e3,Z=`__all__`,Q={name:``,roleKey:``,description:``};function $(){let e=tt({from:`/settings/serviceAccounts`}),t=rt({from:`/settings/serviceAccounts`}),n=e.q??``,a=e.status??Z,[o,c]=(0,J.useState)(Z),l=e=>void t({search:t=>({...t,q:e||void 0}),replace:!0}),u=e=>void t({search:t=>({...t,status:e===Z?void 0:e})}),d=D(_.apiKeys.listServiceAccounts,{filter:{q:n||void 0,role:o===Z?void 0:o,disabled:a===Z?void 0:a===`disabled`}}),f=D(_.apiKeys.listKeys,{}),p=D(_.apiKeys.listRoles,{}),h=T(_.apiKeys.createServiceAccount),g=T(_.apiKeys.updateServiceAccount),pe=T(_.apiKeys.deleteServiceAccount),he=Oe(_.apiKeys.mintApiKey),v=T(_.apiKeys.revokeApiKey),y=Ze(),b=it(),x=n!==``||o!==Z||a!==Z;function S(){c(Z),t({search:{},replace:!0})}let[C,w]=(0,J.useState)(!1),[E,O]=(0,J.useState)(Q),[k,A]=(0,J.useState)(null),[j,M]=(0,J.useState)(new Set),[P,F]=(0,J.useState)(null),I=(0,J.useRef)(!1),[L,B]=(0,J.useState)(new Set),[V,et]=(0,J.useState)({}),[nt,K]=(0,J.useState)(null),X=(0,J.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){M(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})}async function dt(){try{k?(await g({serviceAccountId:k,name:E.name,roleKey:E.roleKey,description:E.description}),b.success(xe())):await h({name:E.name,roleKey:E.roleKey,description:E.description||void 0}),O(Q),A(null),w(!1)}catch(e){b.error(k?ue():r(),e)}}function ft(e){O({name:e.name,roleKey:e.roleKey,description:e.description??``}),A(e._id),w(!0)}async function pt(e){if(I.current)return;I.current=!0;let t=V[e._id]??`never`,n=ct.find(e=>e.value===t)?.days??null,r=n?Date.now()+n*24*60*60*1e3:void 0;F(e._id);try{let t=await he({serviceAccountId:e._id,expiresAt:r});K({accountName:e.name,plaintext:t.plaintext,prefix:t.prefix,lastFour:t.lastFour})}catch(e){b.error(ye(),e)}finally{I.current=!1,F(null)}}async function mt(e){if(await y({title:be(),description:(0,Y.jsxs)(Y.Fragment,{children:[ae(),` `,(0,Y.jsx)(`span`,{className:`font-mono`,children:e.name}),` `,Be(),` `,(0,Y.jsx)(`strong`,{children:oe()}),` `,re()]}),confirmWord:e.name,confirmLabel:ve(),destructive:!0}))try{await pe({serviceAccountId:e._id}),b.success(ge(),e.name)}catch(e){b.error(ie(),e)}}async function ht(e){if(await y({title:_e(),description:(0,Y.jsxs)(Y.Fragment,{children:[ee(),` `,(0,Y.jsxs)(`span`,{className:`font-mono`,children:[e.prefix,`…`,e.lastFour]}),` `,Ye()]}),confirmLabel:de(),destructive:!0})&&!L.has(e._id)){B(t=>new Set(t).add(e._id));try{await v({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,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`p`,{className:`oc-admin__hint`,children:le()}),(0,Y.jsxs)(at,{q:n,onQChange:l,searchPlaceholder:ce(),onReset:S,canReset:x,children:[(0,Y.jsxs)(W,{value:o,onValueChange:c,children:[(0,Y.jsx)(U,{size:`sm`,className:`w-40`,children:(0,Y.jsx)(q,{placeholder:Ne()})}),(0,Y.jsxs)(G,{children:[(0,Y.jsx)(H,{value:Z,children:i()}),(p??[]).map(e=>(0,Y.jsx)(H,{value:e.key,children:e.key},e._id))]})]}),(0,Y.jsxs)(W,{value:a,onValueChange:u,children:[(0,Y.jsx)(U,{size:`sm`,className:`w-36`,children:(0,Y.jsx)(q,{})}),(0,Y.jsxs)(G,{children:[(0,Y.jsx)(H,{value:Z,children:Pe()}),(0,Y.jsx)(H,{value:`active`,children:m()}),(0,Y.jsx)(H,{value:`disabled`,children:s()})]})]})]}),(0,Y.jsx)(ot,{title:ne(),rows:d,addLabel:me(),onAdd:()=>{O(Q),A(null),w(!0)},emptyHint:Ke(),isExpanded:e=>j.has(e._id),renderExpanded:e=>(0,Y.jsx)(lt,{account:e,keys:X.get(e._id)??[],onRevoke:ht,revoking:L}),rowActions:e=>[{label:we(),onSelect:()=>ft(e)},{label:te(),onSelect:()=>void pt(e)},{label:j.has(e._id)?fe():qe(),onSelect:()=>$(e._id)},{label:Je(),variant:`destructive`,onSelect:()=>void mt(e)}],columns:[{header:``,className:`w-8`,cell:e=>(0,Y.jsx)(N,{variant:`ghost`,size:`icon-sm`,"aria-label":j.has(e._id)?Ge():Se(),onClick:()=>$(e._id),children:j.has(e._id)?(0,Y.jsx)(Xe,{}):(0,Y.jsx)($e,{})})},{header:Ae(),sort:e=>e.name,cell:e=>(0,Y.jsxs)(`div`,{className:`flex flex-col`,children:[(0,Y.jsx)(`span`,{children:e.name}),e.description?(0,Y.jsx)(`span`,{className:`text-muted-foreground text-xs`,children:e.description}):null]})},{header:je(),sort:e=>e.roleKey,cell:e=>(0,Y.jsx)(z,{variant:`secondary`,children:e.roleKey})},{header:Ie(),sort:e=>+!!e.disabled,cell:e=>e.disabled?(0,Y.jsx)(z,{variant:`destructive`,children:s()}):(0,Y.jsx)(z,{variant:`outline`,children:m()})},{header:ze(),cell:e=>(0,Y.jsxs)(W,{value:V[e._id]??`never`,onValueChange:t=>et(n=>({...n,[e._id]:t})),children:[(0,Y.jsx)(U,{size:`sm`,className:`w-32`,children:(0,Y.jsx)(q,{})}),(0,Y.jsx)(G,{children:ct.map(e=>(0,Y.jsx)(H,{value:e.value,children:e.label()},e.value))})]})},{header:ke(),sort:e=>(X.get(e._id)??[]).filter(e=>!e.disabled).length,cell:e=>{let t=(X.get(e._id)??[]).filter(e=>!e.disabled).length;return(0,Y.jsx)(`span`,{className:`oc-sa__keycount`,children:P===e._id?Ee():We({count:t})})}}]}),(0,Y.jsx)(Qe,{open:C,onOpenChange:e=>{w(e),e||A(null)},title:k?Fe():Re(),description:k?Te():Ce(),canSubmit:!!(E.name&&E.roleKey),onSubmit:dt,submitLabel:k?He():Me(),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:Ve()}),(0,Y.jsx)(R,{value:E.name,onChange:e=>O({...E,name:e.target.value})})]}),(0,Y.jsxs)(`label`,{className:`oc-field`,children:[(0,Y.jsx)(`span`,{className:`oc-field__label`,children:Le()}),(0,Y.jsxs)(W,{value:E.roleKey||void 0,onValueChange:e=>O({...E,roleKey:e}),children:[(0,Y.jsx)(U,{className:`w-full`,children:(0,Y.jsx)(q,{placeholder:Ue()})}),(0,Y.jsx)(G,{children:(p??[]).map(e=>(0,Y.jsxs)(H,{value:e.key,children:[e.name,` (`,e.key,`)`]},e._id))})]}),(()=>{let e=(p??[]).find(e=>e.key===E.roleKey),t=e?st(e):null;return t?(0,Y.jsx)(`span`,{className:`text-muted-foreground text-xs`,children:t}):null})()]}),(0,Y.jsxs)(`label`,{className:`oc-field`,children:[(0,Y.jsx)(`span`,{className:`oc-field__label`,children:De()}),(0,Y.jsx)(R,{value:E.description,onChange:e=>O({...E,description:e.target.value})})]})]})}),(0,Y.jsx)(ut,{minted:nt,onClose:()=>K(null)})]})}function lt({account:e,keys:t,onRevoke:n,revoking:r}){return(0,Y.jsxs)(`div`,{className:`oc-sa__keys`,children:[(0,Y.jsxs)(`div`,{className:`oc-sa__keys-head`,children:[d(),` `,(0,Y.jsx)(`span`,{className:`font-medium`,children:e.name})]}),t.length===0?(0,Y.jsx)(`p`,{className:`oc-admin__hint`,children:u()}):(0,Y.jsxs)(`table`,{className:`oc-sa__keytable`,children:[(0,Y.jsx)(`thead`,{children:(0,Y.jsxs)(`tr`,{children:[(0,Y.jsx)(`th`,{children:g()}),(0,Y.jsx)(`th`,{children:p()}),(0,Y.jsx)(`th`,{children:f()}),(0,Y.jsx)(`th`,{children:S()}),(0,Y.jsx)(`th`,{children:a()}),(0,Y.jsx)(`th`,{children:C()}),(0,Y.jsx)(`th`,{})]})}),(0,Y.jsx)(`tbody`,{children:t.map(t=>(0,Y.jsxs)(`tr`,{children:[(0,Y.jsx)(`td`,{children:(0,Y.jsxs)(`code`,{className:`oc-sa__keyid`,children:[t.prefix,`…`,t.lastFour]})}),(0,Y.jsx)(`td`,{children:(0,Y.jsx)(z,{variant:`secondary`,children:e.roleKey})}),(0,Y.jsx)(`td`,{children:L(t.createdAt)}),(0,Y.jsx)(`td`,{className:dt(t.lastUsedAt)?`oc-sa__stale`:``,children:ft(t.lastUsedAt)}),(0,Y.jsx)(`td`,{children:pt(t.expiresAt)}),(0,Y.jsx)(`td`,{children:mt(t)}),(0,Y.jsx)(`td`,{className:`text-right`,children:t.disabled?null:(0,Y.jsx)(N,{variant:`destructive`,size:`sm`,disabled:r.has(t._id),onClick:()=>n(t),children:r.has(t._id)?h():c()})})]},t._id))})]})]})}function ut({minted:e,onClose:t}){let[n,r]=(0,J.useState)(!1);async function i(){if(e)try{await navigator.clipboard.writeText(e.plaintext),r(!0),window.setTimeout(()=>r(!1),2e3)}catch{}}return(0,Y.jsx)(B,{open:e!==null,onOpenChange:e=>{e||(r(!1),t())},children:e?(0,Y.jsxs)(I,{className:`max-w-lg`,showCloseButton:!1,onInteractOutside:e=>e.preventDefault(),onEscapeKeyDown:e=>e.preventDefault(),children:[(0,Y.jsxs)(K,{children:[(0,Y.jsx)(nt,{children:l()}),(0,Y.jsx)(P,{children:he({name:e.accountName})})]}),(0,Y.jsx)(`div`,{className:`oc-sa__minted-warning`,children:k()}),(0,Y.jsxs)(`div`,{className:`oc-sa__minted-box`,children:[(0,Y.jsx)(`code`,{className:`oc-sa__minted-plain`,children:e.plaintext}),(0,Y.jsxs)(N,{variant:`outline`,size:`sm`,onClick:()=>void i(),"aria-label":o(),children:[n?(0,Y.jsx)(M,{}):(0,Y.jsx)(V,{}),n?pe():A()]})]}),(0,Y.jsx)(et,{children:(0,Y.jsx)(N,{onClick:()=>{r(!1),t()},children:y()})})]}):null})}function dt(e){return e===null?!1:Date.now()-e>X}function ft(e){return e===null?b():L(e)}function pt(e){return e===null?`—`:F(e)}function mt(e){return e.disabled?(0,Y.jsx)(z,{variant:`destructive`,children:x()}):e.expiresAt!==null&&e.expiresAt<Date.now()?(0,Y.jsx)(z,{variant:`outline`,children:w()}):(0,Y.jsx)(z,{variant:`outline`,children:E()})}export{$ as ServiceAccountsTab};