@lacneu/atrium 0.60.3 → 0.62.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 (83) hide show
  1. package/dist/assets/AccessTab-DY7s2nUA.js +1 -0
  2. package/dist/assets/{AdvancedFilter-C5pnO4fi.js → AdvancedFilter-BbljBL_5.js} +1 -1
  3. package/dist/assets/AgentFilesTab-BtY1O3co.js +3 -0
  4. package/dist/assets/AnomaliesTab-Dc1BWkpz.js +1 -0
  5. package/dist/assets/AuditTab-BDH_c5SQ.js +1 -0
  6. package/dist/assets/BridgeTab-BpMpD4Gm.js +1 -0
  7. package/dist/assets/ChatDefaultsTab-B2vDY2FL.js +1 -0
  8. package/dist/assets/DataTableShell-Bo9JdV4-.js +1 -0
  9. package/dist/assets/{DetailChips-8ZpH5ZXE.js → DetailChips-stIZjuDW.js} +1 -1
  10. package/dist/assets/FeedbacksTab-CxQJT8RQ.js +1 -0
  11. package/dist/assets/{FieldLabel-hLNtge_D.js → FieldLabel-DVIaWFle.js} +1 -1
  12. package/dist/assets/FilesTab-COkLn-3m.js +1 -0
  13. package/dist/assets/{FilterBar-CY1WfFDB.js → FilterBar-XGMlTH00.js} +1 -1
  14. package/dist/assets/GroupsTab-DahUEKfi.js +1 -0
  15. package/dist/assets/InstancesTab-CdxmyjKD.js +1 -0
  16. package/dist/assets/IntegrationsTab-DcTQI2LV.js +1 -0
  17. package/dist/assets/{KpiTab-qUWozfhc.js → KpiTab-CRHncLGM.js} +1 -1
  18. package/dist/assets/PreferencesTab-CMQIXTo8.js +1 -0
  19. package/dist/assets/PromptInjectionsTab-RUWYcoYK.js +4 -0
  20. package/dist/assets/RolesTab-CTWsWK9B.js +1 -0
  21. package/dist/assets/ScheduledTab-BR6mWCfc.js +1 -0
  22. package/dist/assets/ServiceAccountsTab-BTyR_9ZB.js +1 -0
  23. package/dist/assets/SubAgentReportsTab-L2Dsfn4x.js +1 -0
  24. package/dist/assets/ThemeShowroom-CUXWYVrF.js +1 -0
  25. package/dist/assets/TimeRangePicker-DGb-YJj5.js +1 -0
  26. package/dist/assets/TracesTab-Cbp7BSkH.js +1 -0
  27. package/dist/assets/UsersTab-NHhJ0saL.js +1 -0
  28. package/dist/assets/VoiceTab-sjryLTED.js +1 -0
  29. package/dist/assets/button-DRguy6Hz.js +1 -0
  30. package/dist/assets/card-BTuOmZr0.js +1 -0
  31. package/dist/assets/chevrons-up-down-BFfHriX4.js +1 -0
  32. package/dist/assets/{compatView-B2BXfBvC.js → compatView-BHorgRif.js} +1 -1
  33. package/dist/assets/dispatchErrorInfo-CJWXIZnL.js +1 -0
  34. package/dist/assets/{dist-CXJY_tYD.js → dist-3KrBDl5H.js} +1 -1
  35. package/dist/assets/dist-CAP0mn60.js +44 -0
  36. package/dist/assets/{dist-Du1hJWyV.js → dist-DH6cB1zr.js} +1 -1
  37. package/dist/assets/dist-h58Lj6DX.js +5 -0
  38. package/dist/assets/{highlighted-body-OFNGDK62-xjw7PDBM.js → highlighted-body-OFNGDK62-INR9Ztt5.js} +1 -1
  39. package/dist/assets/index-Ba5lBN_I.css +2 -0
  40. package/dist/assets/index-DcPINOh1.js +238 -0
  41. package/dist/assets/mermaid-GHXKKRXX-Dnmq3zax.js +1 -0
  42. package/dist/assets/{pdf-CLjbM27Z.js → pdf-bkWuoknj.js} +1 -1
  43. package/dist/assets/roleDescriptions-B6dQdyoM.js +1 -0
  44. package/dist/assets/table-1vsq56Zt.js +1 -0
  45. package/dist/assets/{tabs-fDXC7itk.js → tabs-IFDKEY73.js} +1 -1
  46. package/dist/assets/x-ChVRoy_h.js +1 -0
  47. package/dist/index.html +8 -8
  48. package/package.json +1 -1
  49. package/dist/assets/AccessTab-BlTwl2Uk.js +0 -1
  50. package/dist/assets/AgentFilesTab-tYeG81Bo.js +0 -3
  51. package/dist/assets/AnomaliesTab-C94n-0pQ.js +0 -1
  52. package/dist/assets/AuditTab-D_mhJO5w.js +0 -1
  53. package/dist/assets/BridgeTab-s6Ggg8Zu.js +0 -1
  54. package/dist/assets/ChatDefaultsTab-DYVQXktp.js +0 -1
  55. package/dist/assets/DataTableShell-COEwE2Hv.js +0 -1
  56. package/dist/assets/FeedbacksTab-CqJ8NDLb.js +0 -1
  57. package/dist/assets/FilesTab-lytzpFwp.js +0 -1
  58. package/dist/assets/GroupsTab-BjjiPSDY.js +0 -1
  59. package/dist/assets/InstancesTab-bbthnf8h.js +0 -1
  60. package/dist/assets/IntegrationsTab-DQt4Kllc.js +0 -1
  61. package/dist/assets/PreferencesTab-B1JSLFVE.js +0 -1
  62. package/dist/assets/PromptInjectionsTab-Df6PKtxv.js +0 -4
  63. package/dist/assets/RolesTab-DbSxOWRh.js +0 -1
  64. package/dist/assets/ScheduledTab-km3Zx4dq.js +0 -1
  65. package/dist/assets/ServiceAccountsTab-Bcd88LfG.js +0 -1
  66. package/dist/assets/SubAgentReportsTab-xgRtphLV.js +0 -1
  67. package/dist/assets/ThemeShowroom-DxcANzhZ.js +0 -1
  68. package/dist/assets/TimeRangePicker-BYCcnF0a.js +0 -1
  69. package/dist/assets/TracesTab-ColoY1Nx.js +0 -1
  70. package/dist/assets/UsersTab-B0IdN_hl.js +0 -1
  71. package/dist/assets/VoiceTab-qZ5tMxmC.js +0 -1
  72. package/dist/assets/button-Bd43O_sm.js +0 -1
  73. package/dist/assets/card-Bkvykfxh.js +0 -1
  74. package/dist/assets/chevrons-up-down-DIXCqs3W.js +0 -1
  75. package/dist/assets/dispatchErrorInfo-DKMvYSfG.js +0 -1
  76. package/dist/assets/dist-De2K23IB.js +0 -44
  77. package/dist/assets/dist-DfildYj4.js +0 -5
  78. package/dist/assets/index-BlYUA3DJ.css +0 -2
  79. package/dist/assets/index-CNwjY680.js +0 -238
  80. package/dist/assets/mermaid-GHXKKRXX-DxPFrHWq.js +0 -1
  81. package/dist/assets/roleDescriptions-zLFA4zEm.js +0 -1
  82. package/dist/assets/table-BRilRxUj.js +0 -1
  83. package/dist/assets/x-DXaZHGzl.js +0 -1
@@ -0,0 +1 @@
1
+ import{cx as e,lx as t,ox as n,sx as r,ux as i}from"./dist-CAP0mn60.js";var a={pending:i,user:t,admin:e,observer:r,agent:n};function o(e){if(e.builtin){let t=a[e.key];if(t)return t()}return e.description}export{o as t};
@@ -0,0 +1 @@
1
+ import{a as e,r as t}from"./bundle-mjs-C73ZY4La.js";import{E as n}from"./dist-CAP0mn60.js";e();var r=t();function i({className:e,...t}){return(0,r.jsx)(`div`,{"data-slot":`table-container`,className:`relative w-full overflow-x-auto`,children:(0,r.jsx)(`table`,{"data-slot":`table`,className:n(`w-full caption-bottom text-sm`,e),...t})})}function a({className:e,...t}){return(0,r.jsx)(`thead`,{"data-slot":`table-header`,className:n(`[&_tr]:border-b`,e),...t})}function o({className:e,...t}){return(0,r.jsx)(`tbody`,{"data-slot":`table-body`,className:n(`[&_tr:last-child]:border-0`,e),...t})}function s({className:e,...t}){return(0,r.jsx)(`tr`,{"data-slot":`table-row`,className:n(`border-b transition-colors hover:bg-muted/50 has-aria-expanded:bg-muted/50 data-[state=selected]:bg-muted`,e),...t})}function c({className:e,...t}){return(0,r.jsx)(`th`,{"data-slot":`table-head`,className:n(`h-10 px-2 text-left align-middle font-medium whitespace-nowrap text-foreground [&:has([role=checkbox])]:pr-0`,e),...t})}function l({className:e,...t}){return(0,r.jsx)(`td`,{"data-slot":`table-cell`,className:n(`p-2 align-middle whitespace-nowrap [&:has([role=checkbox])]:pr-0`,e),...t})}export{a,c as i,o as n,s as o,l as r,i as t};
@@ -1 +1 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{d as r,f as i,h as a,n as o,t as s,u as c,v as l,y as u}from"./dist-De2K23IB.js";import{t as d}from"./dist-CXJY_tYD.js";import{At as f,jt as p,kt as m}from"./index-CNwjY680.js";var h=t(e(),1),g=n(),_=`Tabs`,[v,y]=a(_,[p]),b=p(),[x,S]=v(_),C=h.forwardRef((e,t)=>{let{__scopeTabs:n,value:r,onValueChange:a,defaultValue:o,orientation:s=`horizontal`,dir:l,activationMode:f=`automatic`,...p}=e,m=d(l),[h,v]=i({prop:r,onChange:a,defaultProp:o??``,caller:_});return(0,g.jsx)(x,{scope:n,baseId:c(),value:h,onValueChange:v,orientation:s,dir:m,activationMode:f,children:(0,g.jsx)(u.div,{dir:m,"data-orientation":s,...p,ref:t})})});C.displayName=_;var w=`TabsList`,T=h.forwardRef((e,t)=>{let{__scopeTabs:n,loop:r=!0,...i}=e,a=S(w,n),o=b(n);return(0,g.jsx)(f,{asChild:!0,...o,orientation:a.orientation,dir:a.dir,loop:r,children:(0,g.jsx)(u.div,{role:`tablist`,"aria-orientation":a.orientation,...i,ref:t})})});T.displayName=w;var E=`TabsTrigger`,D=h.forwardRef((e,t)=>{let{__scopeTabs:n,value:r,disabled:i=!1,...a}=e,o=S(E,n),s=b(n),c=A(o.baseId,r),d=j(o.baseId,r),f=r===o.value;return(0,g.jsx)(m,{asChild:!0,...s,focusable:!i,active:f,children:(0,g.jsx)(u.button,{type:`button`,role:`tab`,"aria-selected":f,"aria-controls":d,"data-state":f?`active`:`inactive`,"data-disabled":i?``:void 0,disabled:i,id:c,...a,ref:t,onMouseDown:l(e.onMouseDown,e=>{!i&&e.button===0&&e.ctrlKey===!1?o.onValueChange(r):e.preventDefault()}),onKeyDown:l(e.onKeyDown,e=>{[` `,`Enter`].includes(e.key)&&o.onValueChange(r)}),onFocus:l(e.onFocus,()=>{let e=o.activationMode!==`manual`;!f&&!i&&e&&o.onValueChange(r)})})})});D.displayName=E;var O=`TabsContent`,k=h.forwardRef((e,t)=>{let{__scopeTabs:n,value:i,forceMount:a,children:o,...s}=e,c=S(O,n),l=A(c.baseId,i),d=j(c.baseId,i),f=i===c.value,p=h.useRef(f);return h.useEffect(()=>{let e=requestAnimationFrame(()=>p.current=!1);return()=>cancelAnimationFrame(e)},[]),(0,g.jsx)(r,{present:a||f,children:({present:n})=>(0,g.jsx)(u.div,{"data-state":f?`active`:`inactive`,"data-orientation":c.orientation,role:`tabpanel`,"aria-labelledby":l,hidden:!n,id:d,tabIndex:0,...s,ref:t,style:{...e.style,animationDuration:p.current?`0s`:void 0},children:n&&o})})});k.displayName=O;function A(e,t){return`${e}-trigger-${t}`}function j(e,t){return`${e}-content-${t}`}var M=C,N=T,P=D,F=k;function I({className:e,orientation:t=`horizontal`,...n}){return(0,g.jsx)(M,{"data-slot":`tabs`,"data-orientation":t,className:o(`group/tabs flex gap-2 data-horizontal:flex-col`,e),...n})}var L=s(`group/tabs-list inline-flex w-fit items-center justify-center rounded-lg p-[3px] text-muted-foreground group-data-horizontal/tabs:h-8 group-data-vertical/tabs:h-fit group-data-vertical/tabs:flex-col data-[variant=line]:rounded-none`,{variants:{variant:{default:`bg-muted`,line:`gap-1 bg-transparent`}},defaultVariants:{variant:`default`}});function R({className:e,variant:t=`default`,...n}){return(0,g.jsx)(N,{"data-slot":`tabs-list`,"data-variant":t,className:o(L({variant:t}),e),...n})}function z({className:e,...t}){return(0,g.jsx)(P,{"data-slot":`tabs-trigger`,className:o(`relative inline-flex h-[calc(100%-1px)] flex-1 items-center justify-center gap-1.5 rounded-md border border-transparent px-1.5 py-0.5 text-sm font-medium whitespace-nowrap text-foreground/60 transition-all group-data-vertical/tabs:w-full group-data-vertical/tabs:justify-start hover:text-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-1 focus-visible:outline-ring disabled:pointer-events-none disabled:opacity-50 has-data-[icon=inline-end]:pr-1 has-data-[icon=inline-start]:pl-1 dark:text-muted-foreground dark:hover:text-foreground group-data-[variant=default]/tabs-list:data-active:shadow-sm group-data-[variant=line]/tabs-list:data-active:shadow-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,`group-data-[variant=line]/tabs-list:bg-transparent group-data-[variant=line]/tabs-list:data-active:bg-transparent dark:group-data-[variant=line]/tabs-list:data-active:border-transparent dark:group-data-[variant=line]/tabs-list:data-active:bg-transparent`,`data-active:bg-background data-active:text-foreground dark:data-active:border-input dark:data-active:bg-input/30 dark:data-active:text-foreground`,`after:absolute after:bg-foreground after:opacity-0 after:transition-opacity group-data-horizontal/tabs:after:inset-x-0 group-data-horizontal/tabs:after:bottom-[-5px] group-data-horizontal/tabs:after:h-0.5 group-data-vertical/tabs:after:inset-y-0 group-data-vertical/tabs:after:-right-1 group-data-vertical/tabs:after:w-0.5 group-data-[variant=line]/tabs-list:data-active:after:opacity-100`,e),...t})}function B({className:e,...t}){return(0,g.jsx)(F,{"data-slot":`tabs-content`,className:o(`flex-1 text-sm outline-none`,e),...t})}export{z as i,B as n,R as r,I as t};
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{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-CAP0mn60.js";import{t as d}from"./dist-3KrBDl5H.js";import{Ct as f,St as p,xt as m}from"./index-DcPINOh1.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};
@@ -0,0 +1 @@
1
+ import{D as e}from"./dist-CAP0mn60.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,15 @@
62
62
  document.documentElement.dataset.motion = "static";
63
63
  })();
64
64
  </script>
65
- <script type="module" crossorigin src="/assets/index-CNwjY680.js"></script>
65
+ <script type="module" crossorigin src="/assets/index-DcPINOh1.js"></script>
66
66
  <link rel="modulepreload" crossorigin href="/assets/bundle-mjs-C73ZY4La.js">
67
- <link rel="modulepreload" crossorigin href="/assets/dist-De2K23IB.js">
68
- <link rel="modulepreload" crossorigin href="/assets/dist-CXJY_tYD.js">
69
- <link rel="modulepreload" crossorigin href="/assets/dist-DfildYj4.js">
70
- <link rel="modulepreload" crossorigin href="/assets/dist-Du1hJWyV.js">
71
- <link rel="modulepreload" crossorigin href="/assets/x-DXaZHGzl.js">
72
- <link rel="modulepreload" crossorigin href="/assets/button-Bd43O_sm.js">
73
- <link rel="stylesheet" crossorigin href="/assets/index-BlYUA3DJ.css">
67
+ <link rel="modulepreload" crossorigin href="/assets/dist-CAP0mn60.js">
68
+ <link rel="modulepreload" crossorigin href="/assets/dist-3KrBDl5H.js">
69
+ <link rel="modulepreload" crossorigin href="/assets/dist-h58Lj6DX.js">
70
+ <link rel="modulepreload" crossorigin href="/assets/dist-DH6cB1zr.js">
71
+ <link rel="modulepreload" crossorigin href="/assets/x-ChVRoy_h.js">
72
+ <link rel="modulepreload" crossorigin href="/assets/button-DRguy6Hz.js">
73
+ <link rel="stylesheet" crossorigin href="/assets/index-Ba5lBN_I.css">
74
74
  </head>
75
75
  <body>
76
76
  <div id="root"></div>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lacneu/atrium",
3
- "version": "0.60.3",
3
+ "version": "0.62.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{Bd as r,E as i,GP as a,Gd as o,Hd as s,Jd as c,Kd as l,Qd as u,Rd as d,Ud as f,Vd as p,Wd as m,Xd as h,Yd as g,Zd as _,eF as v,qd as y,zd as b}from"./dist-De2K23IB.js";import{C as x,S,T as C,dt as w,w as T,x as E}from"./index-CNwjY680.js";var D=t(e(),1);function O(e){return e===`user`?s():e===`all`?p():r({group:e.group})}function k(e){return e===`common`?b():e===`owner`?d():r({group:e.group})}var A=n();function j(e){return e.name||e.email||e.userId.slice(0,8)}function M(){let e=v(i.admin.listUsers,{}),[t,n]=(0,D.useState)(``),r=v(i.introspect.introspectUser,t?{userId:t}:`skip`);return(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:u()}),(0,A.jsxs)(E,{value:t,onValueChange:n,children:[(0,A.jsx)(T,{size:`sm`,"aria-label":_(),children:(0,A.jsx)(C,{placeholder:_()})}),(0,A.jsx)(S,{children:(e??[]).map(e=>(0,A.jsx)(x,{value:e.userId,children:j(e)},e._id))})]}),t===``?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:h()}):r===void 0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:a()}):(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:g()}),(0,A.jsxs)(`div`,{className:`oc-introspect__id`,children:[(0,A.jsx)(`strong`,{children:r.user.label}),(0,A.jsx)(w,{variant:`secondary`,children:r.role})]})]}),(0,A.jsxs)(`section`,{className:`oc-introspect__section`,children:[(0,A.jsx)(`h3`,{className:`oc-introspect__title`,children:c()}),r.groups.length===0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:m()}):(0,A.jsx)(`div`,{className:`oc-introspect__chips`,children:r.groups.map(e=>(0,A.jsx)(w,{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:y()}),r.agents.length===0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:m()}):(0,A.jsx)(`ul`,{className:`oc-introspect__list`,children:r.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)(w,{variant:`default`,children:f()}):null,(0,A.jsx)(w,{variant:`outline`,children:O(e.via)}),(0,A.jsx)(w,{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:l()}),r.charts.length===0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:m()}):(0,A.jsx)(`ul`,{className:`oc-introspect__list`,children:r.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)(w,{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:o()}),r.permissions.length===0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:m()}):(0,A.jsx)(`div`,{className:`oc-introspect__chips`,children:r.permissions.map(e=>(0,A.jsx)(w,{variant:`secondary`,children:e},e))})]})]})]})}export{M as AccessTab};
@@ -1,3 +0,0 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$P as r,Ai as i,Al as a,Ci as o,Cl as s,Di as c,Dl as l,E as u,Ei as d,El as f,GD as p,GP as m,Mi as h,Ml as g,Ni as _,Nl as v,Oi as y,Ol as b,Pi as x,Si as S,Sl as C,Ti as w,Tl as T,ZP as E,_i as D,_l as O,ai as k,al as ee,bi as A,bl as j,cl as M,dl as N,eF as P,fl as te,gi as F,gl as I,gu as L,hi as R,hl as ne,ii as z,il as B,ji as re,jl as ie,ki as V,kl as ae,ll as H,mi as oe,ml as se,mu as ce,ni as U,oi as W,ol as le,pl as ue,qP as G,ri as de,si as fe,sl as pe,ti as me,ul as he,vi as ge,vl as _e,wi as ve,wl as ye,xi as be,xl as xe,yi as Se,yl as Ce}from"./dist-De2K23IB.js";import{t as K}from"./button-Bd43O_sm.js";import{C as we,G as Te,H as q,J as Ee,K as De,Pt as J,Q as Oe,S as ke,T as Ae,X as je,Y as Me,Z as Ne,_t as Pe,b as Fe,dt as Ie,ht as Le,mt as Re,pt as ze,q as Be,vt as Ve,w as He,wt as Ue,x as We}from"./index-CNwjY680.js";import{n as Ge,t as Ke}from"./curation-CQksaIbm.js";import{i as qe}from"./compatView-B2BXfBvC.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=P(u.me.getMe,{host:Ue}),t=e?.role===`admin`,n=(e?.permissions??[]).includes(`bridge.read`),r=P(u.admin.listInstances,e!==void 0&&t?{}:`skip`),[o,c]=(0,Y.useState)(null);(0,Y.useEffect)(()=>{!t||!r||r.length===0||(!o||!r.some(e=>e.name===o))&&c(r[0].name)},[t,r,o]);let d=P(u.agents.listAgentsForInstance,t&&o?{instanceName:o}:`skip`),p=P(u.agents.listMyAgents,e!==void 0&&!t?{}:`skip`),h=(0,Y.useMemo)(()=>{if(e!==void 0){if(t)return o===null||d===void 0?r!==void 0&&r.length===0?[]:void 0:d.agents.map(e=>({instanceName:o,agentId:e.agentId,label:`${e.emoji?`${e.emoji} `:``}${e.displayName??e.agentId}`}));if(p!==void 0)return p.map(e=>({instanceName:e.instanceName,agentId:e.agentId,label:`${e.emoji?`${e.emoji} `:``}${e.displayName??e.agentId}`}))}},[e,t,o,d,r,p]),[_,y]=(0,Y.useState)(null);(0,Y.useEffect)(()=>{!h||h.length===0||(!_||!h.some(e=>$(e)===_))&&y($(h[0]))},[h,_]);let x=h?.find(e=>$(e)===_)??null,S=E(u.agentFiles.listAgentFiles),[w,D]=(0,Y.useState)({status:`idle`}),O=x?.instanceName??null,k=x?.agentId??null,ee=P(u.compat.forInstance,n&&O!==null?{instanceName:O}:`skip`),A=n&&O!==null?Fe(ee,`agentFiles`):null,j=A===null?!1:A===`loading`?null:A.blocked,M=(0,Y.useCallback)(async()=>{if(!(O===null||k===null)){D({status:`loading`});try{D({status:`done`,files:(await S({instanceName:O,agentId:k})).files})}catch{D({status:`error`})}}},[S,O,k]);(0,Y.useEffect)(()=>{j===!1&&M()},[M,j]);let[N,te]=(0,Y.useState)(null),F=P(u.agentFileCuration.listCurations,t&&O!==null&&k!==null?{instanceName:O,agentId:k}:`skip`),I=P(u.agentFileCuration.curationSettings,t&&O!==null?{instanceName:O}:`skip`),L=E(u.agentFileCuration.requestCuration),[R,ne]=(0,Y.useState)(null),[z,B]=(0,Y.useState)(null),{toast:H}=q(),oe=(0,Y.useMemo)(()=>{let e=new Map;for(let t of F??[])e.has(t.name)||e.set(t.name,t);return e},[F]),se=(0,Y.useCallback)(async e=>{if(!(O===null||k===null)){ne(e);try{let t=await L({instanceName:O,agentId:k,name:e,trigger:`manual`});t.ok?H({title:re(),variant:`success`}):H({title:i({reason:t.reason??`unknown`}),variant:`error`})}catch{H({title:V(),variant:`error`})}finally{ne(null)}}},[L,O,k,H]),U=G(),W=(0,Y.useMemo)(()=>new Intl.NumberFormat(U,{maximumFractionDigits:0}),[U]);return e===void 0||h===void 0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:m()}):(0,Q.jsxs)(`div`,{className:`oc-afiles`,children:[(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:v()}),(0,Q.jsxs)(`div`,{className:`oc-afiles__picker`,children:[t&&(r?.length??0)>1?(0,Q.jsxs)(We,{value:o??``,onValueChange:e=>c(e),children:[(0,Q.jsx)(He,{size:`sm`,"aria-label":g(),children:(0,Q.jsx)(Ae,{})}),(0,Q.jsx)(ke,{children:(r??[]).map(e=>(0,Q.jsx)(we,{value:e.name,children:e.name},e.name))})]}):null,h.length>0?(0,Q.jsxs)(We,{value:_??``,onValueChange:e=>y(e),children:[(0,Q.jsx)(He,{size:`sm`,"aria-label":ie(),children:(0,Q.jsx)(Ae,{})}),(0,Q.jsx)(ke,{children:h.map(e=>(0,Q.jsx)(we,{value:$(e),children:e.label},$(e)))})]}):(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:a()})]}),x===null?null:A===`loading`?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:m()}):A!==null&&A.blocked?(0,Q.jsxs)(`p`,{className:`oc-compat__blocked`,role:`status`,children:[(0,Q.jsx)(J,{size:14,"aria-hidden":!0}),` `,qe(A.gatewayVersion,A.provider)]}):w.status===`loading`||w.status===`idle`?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:m()}):w.status===`error`?(0,Q.jsxs)(`p`,{className:`oc-afiles__error`,role:`alert`,children:[b(),` `,(0,Q.jsx)(K,{variant:`outline`,size:`sm`,onClick:()=>void M(),children:ce()})]}):w.files.length===0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:ae()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`div`,{className:`oc-afiles__list`,children:w.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)(Ie,{variant:`outline`,children:l()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`span`,{className:`oc-afiles__size`,children:f({size:Z(e.size,U)})}),(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:T({pct:W.format(n)})}),r?(0,Q.jsx)(J,{size:14,className:`oc-afiles__warn`,"aria-label":ye()}):(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:()=>te(e),children:t?C():xe()}),t&&!e.missing?(0,Q.jsx)(nt,{curatable:Ke.includes(e.name),size:e.size??0,budget:I?.budgetChars??null,enabled:I?.enabled??!1,curation:oe.get(e.name)??null,inFlight:R===e.name,onCurate:()=>void se(e.name),onReview:e=>B(e)}):null]},e.name)})}),(0,Q.jsx)(`p`,{className:`oc-afiles__budget`,children:s({used:Z(Ze(w.files),U),total:Z(Je,U),pct:W.format(Xe(Ze(w.files)))})})]}),N&&x?(0,Q.jsx)(rt,{instanceName:x.instanceName,agentId:x.agentId,name:N.name,isAdmin:t,onClose:()=>te(null),onSaved:()=>void M()}):null,z?(0,Q.jsx)(it,{curationId:z,onClose:()=>B(null),onApplied:()=>{B(null),M()}}):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:_()}):a||i?.status===`dispatched`||i?.status===`applying`?(0,Q.jsx)(Ie,{variant:`outline`,className:`oc-afiles__curate-status`,children:h()}):e&&r&&n!==null&&Ge(t,n)?(0,Q.jsx)(K,{variant:`outline`,size:`sm`,className:`oc-afiles__curate`,onClick:o,children:x()}):null}function rt({instanceName:e,agentId:t,name:n,isAdmin:r,onClose:i,onSaved:a}){let o=E(u.agentFiles.getAgentFile),s=E(u.agentFiles.setAgentFile),c=q(),[l,d]=(0,Y.useState)(null),[f,h]=(0,Y.useState)(!1),[g,_]=(0,Y.useState)(``),[v,y]=(0,Y.useState)(!1),[b,x]=(0,Y.useState)(!1),[S,C]=(0,Y.useState)(!1),[w,T]=(0,Y.useState)(!1),D=(0,Y.useCallback)(async r=>{h(!1);try{let i=await o({instanceName:e,agentId:t,name:n});d({content:i.content,updatedAtMs:i.updatedAtMs}),r||_(i.content),C(!1)}catch{h(!0)}},[o,e,t,n]);(0,Y.useEffect)(()=>{D(!1)},[D]);async function k(){if(l!==null){x(!0),T(!1);try{await s({instanceName:e,agentId:t,name:n,content:g,baseUpdatedAtMs:l.updatedAtMs??void 0}),c.success(se({name:n})),a(),await D(!1)}catch(e){et(e)?C(!0):T(!0)}finally{x(!1)}}}let A=l!==null&&g!==l.content,P=(0,Y.useMemo)(()=>l===null?null:$e(l.content,g),[l,g]),F=g.length>X,R=G(),z=(0,Y.useMemo)(()=>new Intl.NumberFormat(R),[R]);return(0,Q.jsx)(ze,{open:!0,onOpenChange:e=>!e&&i(),children:(0,Q.jsxs)(Re,{className:`oc-afiles__editor`,children:[(0,Q.jsxs)(Pe,{children:[(0,Q.jsx)(Ve,{children:j({name:n})}),(0,Q.jsxs)(Le,{children:[Ce({agent:t,instance:e}),r?null:(0,Q.jsxs)(Q.Fragment,{children:[` · `,_e()]})]})]}),f?(0,Q.jsxs)(`p`,{className:`oc-afiles__error`,role:`alert`,children:[te(),` `,(0,Q.jsx)(K,{variant:`outline`,size:`sm`,onClick:()=>void D(!1),children:ce()})]}):l===null?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:m()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`textarea`,{className:`oc-afiles__source`,value:g,readOnly:!r,spellCheck:!1,onChange:e=>_(e.target.value),"aria-label":j({name:n})}),(0,Q.jsx)(`p`,{className:`oc-afiles__hint`,children:O()}),S?(0,Q.jsxs)(`p`,{className:`oc-afiles__error`,role:`alert`,children:[N(),` `,(0,Q.jsx)(K,{variant:`outline`,size:`sm`,onClick:()=>void D(!0),children:he()})]}):null,w?(0,Q.jsx)(`p`,{className:`oc-afiles__error`,role:`alert`,children:ue()}):null,(0,Q.jsxs)(`div`,{className:`oc-afiles__editor-foot`,children:[(0,Q.jsx)(`span`,{className:`oc-afiles__count${F?` is-over`:``}`,children:I({count:z.format(g.length),max:z.format(X)})}),r?(0,Q.jsx)(K,{size:`sm`,disabled:!A||b||S,onClick:()=>y(!0),children:b?L():ne()}):null]})]}),(0,Q.jsx)(Te,{open:v,onOpenChange:y,children:(0,Q.jsxs)(Ee,{children:[(0,Q.jsxs)(Ne,{children:[(0,Q.jsx)(Oe,{children:H({name:n})}),(0,Q.jsx)(Me,{children:M({agent:t})})]}),P?(0,Q.jsxs)(`div`,{className:`oc-afiles__diff`,children:[(0,Q.jsx)(`p`,{className:`oc-afiles__diff-counts`,children:pe({added:P.added,removed:P.removed})}),P.sampleAdded.length>0?(0,Q.jsxs)(`div`,{className:`oc-afiles__diff-block`,children:[(0,Q.jsx)(`span`,{className:`oc-afiles__diff-label`,children:le()}),P.sampleAdded.map((e,t)=>(0,Q.jsx)(`code`,{className:`oc-afiles__diff-line is-add`,children:e||` `},t))]}):null,P.sampleRemoved.length>0?(0,Q.jsxs)(`div`,{className:`oc-afiles__diff-block`,children:[(0,Q.jsx)(`span`,{className:`oc-afiles__diff-label`,children:ee()}),P.sampleRemoved.map((e,t)=>(0,Q.jsx)(`code`,{className:`oc-afiles__diff-line is-del`,children:e||` `},t))]}):null]}):null,(0,Q.jsxs)(je,{children:[(0,Q.jsx)(Be,{children:p()}),(0,Q.jsx)(De,{onClick:()=>void k(),children:B()})]})]})})]})})}function it({curationId:e,onClose:t,onApplied:n}){let i=P(u.agentFileCuration.getProposal,{curationId:e}),a=E(u.agentFileCuration.approveCuration),s=r(u.agentFileCuration.rejectCuration),{toast:l}=q(),[f,p]=(0,Y.useState)(null),[h,g]=(0,Y.useState)(!1),[_,v]=(0,Y.useState)(``),b=G(),x=(0,Y.useMemo)(()=>i?$e(i.beforeContent,i.proposedContent):null,[i]);async function C(){p(`approve`);try{let t=await a({curationId:e});t.ok?(l({title:y(),variant:`success`}),n()):l({title:t.reason===`conflict`?d():w({reason:t.reason??`unknown`}),variant:`error`})}catch{l({title:V(),variant:`error`})}finally{p(null)}}async function T(n){p(`reject`);try{let r=_.trim();(await s({curationId:e,...r?{comment:r}:{},relaunch:n})).ok?l({title:n?U():c(),variant:`success`}):l({title:S(),variant:`error`}),t()}catch{l({title:V(),variant:`error`})}finally{p(null)}}return(0,Q.jsx)(ze,{open:!0,onOpenChange:e=>e?void 0:t(),children:(0,Q.jsxs)(Re,{className:`oc-afiles__review`,children:[(0,Q.jsxs)(Pe,{children:[(0,Q.jsx)(Ve,{children:i?ve({name:i.name}):m()}),(0,Q.jsx)(Le,{children:o()})]}),i===void 0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:m()}):i===null?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:S()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`p`,{className:`oc-afiles__review-sizes`,children:[be({before:Z(i.beforeSize,b),after:Z(i.proposedSize,b)}),i.overBudget?(0,Q.jsxs)(Q.Fragment,{children:[` `,(0,Q.jsx)(J,{size:13,"aria-hidden":!0}),` `,A()]}):null]}),x?(0,Q.jsx)(`p`,{className:`oc-afiles__review-diff`,children:Se({added:x.added,removed:x.removed})}):null,i.feedback?(0,Q.jsx)(`p`,{className:`oc-afiles__review-feedback`,children:me({feedback:i.feedback})}):null,x&&x.sampleRemoved.length>0?(0,Q.jsxs)(`div`,{className:`oc-afiles__review-removed`,children:[(0,Q.jsx)(`p`,{className:`oc-afiles__review-label`,children:oe()}),(0,Q.jsx)(`ul`,{children:x.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:R()}),(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:ge()}),(0,Q.jsx)(`pre`,{className:`oc-afiles__review-pre`,children:i.proposedContent})]})]})]}),h?(0,Q.jsxs)(`div`,{className:`oc-afiles__reject-form`,children:[(0,Q.jsx)(`label`,{className:`oc-afiles__review-label`,htmlFor:`curation-reject-comment`,children:fe()}),(0,Q.jsx)(`textarea`,{id:`curation-reject-comment`,className:`oc-afiles__reject-textarea`,rows:3,placeholder:W(),value:_,onChange:e=>v(e.target.value)}),(0,Q.jsxs)(`div`,{className:`oc-afiles__review-actions`,children:[(0,Q.jsx)(K,{variant:`ghost`,onClick:()=>g(!1),disabled:f!==null,children:k()}),(0,Q.jsx)(K,{variant:`outline`,onClick:()=>void T(!1),disabled:f!==null,children:f===`reject`?L():z()}),(0,Q.jsx)(K,{variant:`default`,onClick:()=>void T(!0),disabled:f!==null,children:f===`reject`?L():de()})]})]}):(0,Q.jsxs)(`div`,{className:`oc-afiles__review-actions`,children:[(0,Q.jsx)(K,{variant:`outline`,onClick:()=>g(!0),disabled:f!==null||i==null,children:D()}),(0,Q.jsx)(K,{variant:`default`,onClick:()=>void C(),disabled:f!==null||i==null,children:f===`approve`?L():F()})]})]})})}export{tt as AgentFilesTab};
@@ -1 +0,0 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$P as r,$y as i,Ay as a,By as ee,E as o,Fy as s,Gy as te,Hy as ne,Iy as c,Jy as l,Ky as re,Ly as ie,My as u,Ny as d,Py as f,Qy as p,Ry as m,Uy as h,Vy as g,Wy as ae,Xy as _,Yy as oe,Zy as se,_b as ce,ab as le,bb as v,cb as ue,db as de,eF as y,eb as fe,fb as pe,gb as me,hb as he,ib as ge,jy as b,ky as x,lb as _e,mb as ve,nb as ye,ob as S,pb as C,qy as w,rb as T,sb as E,tb as D,ub as O,vb as k,xb as A,yb as j,zy as M}from"./dist-De2K23IB.js";import{C as N,H as P,S as F,T as I,U as be,_t as L,dt as R,i as xe,mt as z,nn as B,o as Se,pt as V,rn as Ce,rt as we,vt as H,w as U,wt as Te,x as W}from"./index-CNwjY680.js";import{n as Ee}from"./TimeRangePicker-BYCcnF0a.js";import{t as De}from"./FilterBar-CY1WfFDB.js";import{t as Oe}from"./DataTableShell-COEwE2Hv.js";import{t as G}from"./dispatchErrorInfo-DKMvYSfG.js";var K=t(e(),1),q=n(),J=`__all__`,ke=[{value:`open`},{value:`acknowledged`},{value:`resolved`}];function Ae(e){return e===`open`?A():e===`acknowledged`?v():j()}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=B({from:`/settings/anomalies`}),n=e.q??``,a=e.status===Y?J:e.status,s=e.severity??J,c=e.kind??J,[u,d]=(0,K.useState)(J),f=xe(e.from,e.to),{from:v,to:b}=Ee(f),x=e=>void t({search:t=>({...t,q:e||void 0}),replace:!0}),A=e=>void t({search:t=>({...t,status:e===J?Y:e})}),j=e=>void t({search:t=>({...t,severity:e===J?void 0:e})}),L=e=>void t({search:t=>({...t,kind:e===J?void 0:e})}),z=e=>void t({search:t=>({...t,...Se(e)})}),V=be(),H=P(),G=r(o.anomalies.resolveAnomaly),X=(y(o.me.getMe,{host:Te})?.permissions??[]).includes(`admin.manage`),Z=y(o.anomalies.listAnomalies,{limit:Pe,filter:{q:n||void 0,from:v,to:b,anomalyStatus:a===J?void 0:a,severity:s===J?void 0:s,source:u===J?void 0:u,kind:c===J?void 0:c}}),Q=(0,K.useMemo)(()=>{let e=new Set;for(let t of Z??[])e.add(t.kind);return[...e].sort()},[Z]),ze=n!==``||a!==`open`||s!==J||u!==J||c!==J||f.kind!==`relative`||f.from!==Ne.from;function Be(){d(J),t({search:{status:`open`},replace:!0})}async function Ve(e){if(await V({title:k(),description:(0,q.jsxs)(q.Fragment,{children:[ce(),` `,(0,q.jsx)(`span`,{className:`font-mono`,children:e.kind}),` `,me(),` `,(0,q.jsx)(`strong`,{children:he()}),`.`,` `,ve()]}),confirmLabel:C()}))try{await G({anomalyId:e._id,status:`resolved`}),H.success(pe(),e.kind)}catch(e){H.error(de(),e)}}async function He(e){try{await G({anomalyId:e._id,status:`acknowledged`}),H.success(O(),e.kind)}catch(e){H.error(_e(),e)}}return(0,q.jsxs)(q.Fragment,{children:[(0,q.jsxs)(`p`,{className:`oc-admin__hint`,children:[ue(),` `,(0,q.jsx)(`strong`,{children:E()}),` `,S(),` `,(0,q.jsx)(`strong`,{children:le()}),` `,ge(),` `,(0,q.jsx)(`strong`,{children:T()}),` `,ye(),` `,(0,q.jsx)(`span`,{className:`oc-filter__window`,children:D()})]}),(0,q.jsxs)(De,{q:n,onQChange:x,searchPlaceholder:fe(),timeRange:f,onTimeRangeChange:z,onReset:Be,canReset:ze,children:[(0,q.jsxs)(W,{value:a,onValueChange:A,children:[(0,q.jsx)(U,{size:`sm`,className:`w-36`,children:(0,q.jsx)(I,{})}),(0,q.jsxs)(F,{children:[(0,q.jsx)(N,{value:J,children:i()}),ke.map(e=>(0,q.jsx)(N,{value:e.value,children:Ae(e.value)},e.value))]})]}),(0,q.jsxs)(W,{value:s,onValueChange:j,children:[(0,q.jsx)(U,{size:`sm`,className:`w-36`,children:(0,q.jsx)(I,{placeholder:p()})}),(0,q.jsxs)(F,{children:[(0,q.jsx)(N,{value:J,children:se()}),je.map(e=>(0,q.jsx)(N,{value:e,children:e},e))]})]}),(0,q.jsxs)(W,{value:u,onValueChange:d,children:[(0,q.jsx)(U,{size:`sm`,className:`w-32`,children:(0,q.jsx)(I,{placeholder:_()})}),(0,q.jsxs)(F,{children:[(0,q.jsx)(N,{value:J,children:oe()}),Me.map(e=>(0,q.jsx)(N,{value:e,children:e},e))]})]}),(0,q.jsxs)(W,{value:c,onValueChange:L,children:[(0,q.jsx)(U,{size:`sm`,className:`w-36`,children:(0,q.jsx)(I,{placeholder:l()})}),(0,q.jsxs)(F,{children:[(0,q.jsx)(N,{value:J,children:w()}),Q.map(e=>(0,q.jsx)(N,{value:e,children:e},e))]})]})]}),(0,q.jsx)(Oe,{title:re(),rows:Z,emptyHint:a===`open`?te():ae(),rowActions:e=>X&&e.status===`open`?[{label:h(),onSelect:()=>void Ve(e)},{label:ne(),onSelect:()=>void He(e)}]:[],columns:[{header:g(),cell:e=>(0,q.jsx)(`span`,{className:`oc-traces__time`,children:we(e.at)}),sort:e=>e.at},{header:l(),cell:e=>(0,q.jsx)(`code`,{className:`oc-traces__mono`,children:e.kind}),sort:e=>e.kind},{header:p(),cell:e=>(0,q.jsx)(Le,{severity:e.severity}),sort:e=>e.severity===`critical`?2:+(e.severity===`warn`)},{header:ee(),cell:e=>(0,q.jsx)($,{status:e.status}),sort:e=>e.status===`resolved`?2:+(e.status===`acknowledged`)},{header:_(),cell:e=>(0,q.jsx)(R,{variant:`outline`,children:e.source}),sort:e=>e.source},{header:M(),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:m(),cell:e=>(0,q.jsx)(Fe,{row:e}),sort:e=>e.evidence??null},{header:ie(),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=B();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:[`↗ `,c()]}):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:[`↗ `,c()]}):null]})}function Ie({row:e}){let[t,n]=(0,K.useState)(!1),r=y(o.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:[s(),e.attachments.length>1?` (${e.attachments.length})`:``]}),(0,q.jsx)(V,{open:t,onOpenChange:n,children:(0,q.jsxs)(z,{className:`oc-anomaly__attachments-dialog`,children:[(0,q.jsx)(L,{children:(0,q.jsx)(H,{children:f()})}),r===void 0?(0,q.jsx)(`p`,{className:`oc-traces__muted`,children:d()}):r.length===0?(0,q.jsx)(`p`,{className:`oc-traces__muted`,children:u()}):(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)(R,{variant:`destructive`,children:b()}):e===`acknowledged`?(0,q.jsx)(R,{variant:`secondary`,children:a()}):(0,q.jsx)(R,{variant:`outline`,children:x()})}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{$n as r,Cx as i,E as a,Ex as o,Qn as s,Sx as c,Tx as l,_x as u,bx as d,eF as f,er as p,fx as m,gx as h,hx as g,mx as _,nr as v,px as y,rr as b,tr as x,vx as S,wx as C,xx as w,yx as T}from"./dist-De2K23IB.js";import{C as E,S as D,T as O,a as k,i as A,n as j,nn as M,o as N,rn as P,rt as F,s as I,w as L,x as R}from"./index-CNwjY680.js";import{n as ee}from"./TimeRangePicker-BYCcnF0a.js";import{t as z}from"./FilterBar-CY1WfFDB.js";import{t as B}from"./AdvancedFilter-C5pnO4fi.js";import{t as V}from"./DataTableShell-COEwE2Hv.js";var H=t(e(),1),U=n(),W={kind:`relative`,from:j,to:`now`},G=`__all__`,K=[{value:`action`,label:b()},{value:`realLabel`,label:v()},{value:`targetLabel`,label:x()},{value:`impersonated`,label:p()},{value:`resource`,label:r()},{value:`resourceId`,label:s()}];function q(){let e=P({from:`/settings/audit`}),t=M({from:`/settings/audit`}),n=e.q??``,r=e.action??G,s=e.impersonated??G,p=e.resource??G,v=A(e.from,e.to),b=(0,H.useMemo)(()=>I(e.adv),[e.adv]),{from:x,to:j}=ee(v),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:k(e)}),replace:!0}),$=f(a.admin.listAudit,{filter:{q:n||void 0,from:x,to:j,action:r===G?void 0:r,resource:p===G?void 0:p,impersonated:s===G?void 0:s===`yes`,advanced:b.length>0?b: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!==``||r!==G||s!==G||p!==G||b.length>0||v.kind!==`relative`||v.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:[o(),` `,(0,U.jsx)(`span`,{className:`oc-filter__window`,children:l()})]}),(0,U.jsxs)(z,{q:n,onQChange:q,searchPlaceholder:C(),timeRange:v,onTimeRangeChange:Z,onReset:ie,canReset:re,children:[(0,U.jsxs)(R,{value:r,onValueChange:J,children:[(0,U.jsx)(L,{size:`sm`,className:`w-40`,children:(0,U.jsx)(O,{placeholder:i()})}),(0,U.jsxs)(D,{children:[(0,U.jsx)(E,{value:G,children:c()}),te.map(e=>(0,U.jsx)(E,{value:e,children:e},e))]})]}),(0,U.jsxs)(R,{value:s,onValueChange:Y,children:[(0,U.jsx)(L,{size:`sm`,className:`w-40`,children:(0,U.jsx)(O,{})}),(0,U.jsxs)(D,{children:[(0,U.jsx)(E,{value:G,children:w()}),(0,U.jsx)(E,{value:`yes`,children:d()}),(0,U.jsx)(E,{value:`no`,children:T()})]})]}),(0,U.jsxs)(R,{value:p,onValueChange:X,children:[(0,U.jsx)(L,{size:`sm`,className:`w-40`,children:(0,U.jsx)(O,{placeholder:S()})}),(0,U.jsxs)(D,{children:[(0,U.jsx)(E,{value:G,children:u()}),ne.map(e=>(0,U.jsx)(E,{value:e,children:e},e))]})]})]}),(0,U.jsx)(B,{fields:K,seed:b,onChange:Q}),(0,U.jsx)(V,{title:h(),rows:$,emptyHint:g(),columns:[{header:_(),cell:e=>F(e.at),sort:e=>e.at},{header:i(),cell:e=>e.action,sort:e=>e.action},{header:y(),cell:e=>e.realLabel,sort:e=>e.realLabel},{header:m(),cell:e=>e.targetLabel??`—`,sort:e=>e.targetLabel??null},{header:S(),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{$P as r,$h as i,A_ as a,Ag as o,Bc as s,Bg as c,C_ as l,Cg as u,Cn as d,D as f,D_ as p,Dg as m,Dn as h,E as g,E_ as ee,Eg as _,Fc as v,Fg as te,Gc as y,Gg as ne,Hc as b,Hg as re,Ic as x,Ig as ie,Jg as ae,Kc as S,Kg as oe,Lc as C,Lg as se,Mg as ce,Ng as le,Og as ue,Pg as de,Qh as fe,Rc as pe,Rg as me,S_ as he,Sg as ge,Sn as _e,T_ as ve,Tg as ye,Uc as be,Ug as xe,Vc as Se,Vg as Ce,Wc as we,Wg as Te,ZP as Ee,Zh as w,__ as De,_g as Oe,ag as ke,b_ as Ae,bg as je,bn as Me,cg as Ne,dg as T,eF as E,eg as Pe,fg as Fe,g_ as Ie,gg as Le,hg as Re,ig as ze,jc as Be,jg as Ve,k_ as He,kg as Ue,lg as We,mg as Ge,ng as Ke,og as qe,pg as Je,qc as Ye,qg as Xe,rg as Ze,sg as Qe,tg as $e,ug as et,vg as tt,w_ as nt,wg as rt,wn as it,x_ as at,xg as ot,xn as st,yg as ct,zc as lt,zg as ut}from"./dist-De2K23IB.js";import{i as D,r as dt}from"./dist-CXJY_tYD.js";import{t as ft}from"./chevrons-up-down-DIXCqs3W.js";import{i as pt,n as O,o as mt,r as ht,s as gt}from"./FieldLabel-hLNtge_D.js";import{i as _t,n as vt,r as yt,t as bt}from"./tabs-fDXC7itk.js";import{t as k}from"./button-Bd43O_sm.js";import{$ as xt,$t as A,C as j,H as St,Kt as Ct,Lt as M,Pt as N,S as P,T as F,_t as wt,dt as I,en as Tt,et as Et,ft as L,h as Dt,ht as Ot,it as R,m as kt,mt as At,nn as jt,pt as Mt,rn as Nt,rt as Pt,tt as Ft,vt as It,w as z,wt as Lt,x as B}from"./index-CNwjY680.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-BRilRxUj.js";import{t as Ht}from"./FilterBar-CY1WfFDB.js";import{a as Ut,n as Wt,o as Gt,r as Kt,s as qt,t as Jt}from"./compatView-B2BXfBvC.js";import{t as W}from"./dispatchErrorInfo-DKMvYSfG.js";var Yt=f(`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=f(`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]),s=(0,G.useMemo)(()=>dn(o),[o]),c=(0,G.useMemo)(()=>fn(o),[o]),l=(0,G.useMemo)(()=>pn(o),[o]),u=(0,G.useMemo)(()=>un(sn(o,n),i),[o,n,i]);function d(e){a(t=>t?.key===e?t.dir===`asc`?{key:e,dir:`desc`}:null:{key:e,dir:`asc`})}return e.length===0?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:Re()}):(0,Z.jsxs)(`div`,{className:`oc-conn`,children:[(0,Z.jsxs)(Ht,{q:n.q,onQChange:e=>r(t=>({...t,q:e})),searchPlaceholder:Fe(),onReset:()=>r(an),canReset:on(n),children:[(0,Z.jsxs)(B,{value:n.state,onValueChange:e=>r(t=>({...t,state:e})),children:[(0,Z.jsx)(z,{size:`sm`,className:`w-36`,children:(0,Z.jsx)(F,{placeholder:et()})}),(0,Z.jsxs)(P,{children:[(0,Z.jsx)(j,{value:J,children:T()}),s.map(e=>(0,Z.jsx)(j,{value:e,children:gn(e)},e))]})]}),(0,Z.jsxs)(B,{value:n.instance,onValueChange:e=>r(t=>({...t,instance:e})),children:[(0,Z.jsx)(z,{size:`sm`,className:`w-40`,children:(0,Z.jsx)(F,{placeholder:We()})}),(0,Z.jsxs)(P,{children:[(0,Z.jsx)(j,{value:J,children:T()}),c.map(e=>(0,Z.jsx)(j,{value:e.name,children:e.label},e.name))]})]}),(0,Z.jsxs)(B,{value:n.version,onValueChange:e=>r(t=>({...t,version:e})),children:[(0,Z.jsx)(z,{size:`sm`,className:`w-36`,children:(0,Z.jsx)(F,{placeholder:Ne()})}),(0,Z.jsxs)(P,{children:[(0,Z.jsx)(j,{value:J,children:T()}),l.map(e=>(0,Z.jsx)(j,{value:e,children:e},e))]})]})]}),u.length===0?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:Qe()}):(0,Z.jsxs)(Vt,{className:`oc-conn__table`,children:[(0,Z.jsx)(zt,{children:(0,Z.jsxs)(H,{children:[(0,Z.jsx)(Q,{label:qe(),sortKey:`target`,sort:i,onSort:d}),(0,Z.jsx)(Q,{label:ke(),sortKey:`state`,sort:i,onSort:d}),(0,Z.jsx)(Q,{label:ze(),sortKey:`instance`,sort:i,onSort:d}),(0,Z.jsx)(Q,{label:Ze(),sortKey:`host`,sort:i,onSort:d}),(0,Z.jsx)(Q,{label:Ke(),sortKey:`version`,sort:i,onSort:d}),(0,Z.jsx)(V,{children:$e()}),(0,Z.jsx)(Q,{label:Pe(),sortKey:`lastOk`,sort:i,onSort:d})]})}),(0,Z.jsx)(Bt,{children:u.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:Ge({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:R(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?` · ${R(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:[Je({label:n.label}),` `,(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:e.lastDownstreamRejectCode}),e.lastDownstreamRejectAt?` · ${R(e.lastDownstreamRejectAt)}`:``]}):null]})}):null]})}function gn(e){return e===`connected`?i():e===`error`?fe():w()}function _n({state:e}){return e===`connected`?(0,Z.jsx)(I,{variant:`secondary`,children:i()}):e===`error`?(0,Z.jsx)(I,{variant:`destructive`,children:fe()}):(0,Z.jsx)(I,{variant:`outline`,children:w()})}function vn(){return E(g.bridgeHealth.getBridgeHealth,{})}function yn(){let e=vn(),t=E(g.compat.getBridgeCompat,{}),n=E(g.me.getMe,{host:Lt})?.role===`admin`,r=E(g.admin.listInstances,n?{}:`skip`),i=E(g.agents.usageForInstances,n?{}:`skip`),a=jt(),o=()=>void a({to:`/settings/anomalies`,search:{status:`open`}}),s=rn(e?e.targets:[],t?t.targets:[],r??[]),{section:c}=Nt({from:`/settings/bridge`}),l=jt({from:`/settings/bridge`}),u=t?.compat??null,f=t===void 0?`loading`:t===null?`nodata`:`ready`,p=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:de()}),i&&i.length>0?(0,Z.jsxs)(`section`,{className:`oc-bridge__usage`,children:[(0,Z.jsx)(`h3`,{className:`oc-bridge__usage-title`,children:le()}),(0,Z.jsxs)(Vt,{children:[(0,Z.jsx)(zt,{children:(0,Z.jsxs)(H,{children:[(0,Z.jsx)(V,{children:it()}),(0,Z.jsx)(V,{children:d()}),(0,Z.jsx)(V,{children:_e()}),(0,Z.jsx)(V,{children:st()}),(0,Z.jsx)(V,{children:Me()})]})}),(0,Z.jsx)(Bt,{children:i.flatMap(e=>{let t=Dt(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)(I,{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:f,compatReachable:t?.reachable??!0,protocol:e.key===`openclaw`?t?.protocol??null:null})},e.key))]}):null,p?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:Be()}):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:y(),children:[`(`,i,`)`]})]}):null,r?(0,Z.jsxs)(`strong`,{className:`oc-bridge-card__mismatch`,children:[` `,we({build:t.buildVersion??`?`})]}):null,` · `,be(),` `,(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:t.protocolVersion===null?b():String(t.protocolVersion)})]}):null;if(e===void 0)return(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:_()});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??[],d=c===`ok`?`ok`:c===`gateways_unreachable`?`warn`:`error`,f=Pt(e.checkedAt),p=e.startedAt==null?null:Pt(e.startedAt);return(0,Z.jsxs)(`div`,{className:`oc-bridge-card oc-bridge-card--${d}`,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`?rt():c===`gateways_unreachable`?je({count:l.length}):s?u():ge({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}),` `,ot({time:f})]}),p?(0,Z.jsx)(`span`,{children:tt({time:p})}):null,a]}),c===`gateways_unreachable`?(0,Z.jsx)(`p`,{className:`oc-bridge-card__hint`,children:ct({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:Oe()})]})}function xn({providerKey:e,connections:t,instances:n,manifest:r,compatStatus:i,compatReachable:a,protocol:o}){let s=r?qt(r,e):null,c=new Map;for(let e of n)c.set(e.name,e.displayName??e.name);let l=[],u=new Set;for(let n of t){if(!n.instanceName||u.has(n.instanceName))continue;u.add(n.instanceName);let t=n.gatewayVersion??null;l.push({instanceName:n.instanceName,displayName:c.get(n.instanceName)??n.instanceName,version:t,state:Jt(t,e,r)})}let d=l.map(e=>e.state),f=d.includes(`beyond`)?`beyond`:d.length>0&&d.every(e=>e===`supported`)?`supported`:null,[p,m]=(0,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)}),f?(0,Z.jsx)(I,{variant:f===`beyond`?`destructive`:`secondary`,children:Kt(f)}):null]}),(0,Z.jsx)(`h4`,{className:`oc-bridge-provider__sub`,children:Ye()}),(0,Z.jsx)(Cn,{providerName:q(e),support:s,compatStatus:i,compatReachable:a,manifest:r,instanceRows:l}),o?(0,Z.jsx)(Sn,{protocol:o}):null,(0,Z.jsxs)(`button`,{type:`button`,className:`oc-bridge-provider__sub oc-bridge-provider__sub--toggle`,"aria-expanded":p,onClick:()=>m(e=>!e),children:[p?(0,Z.jsx)(D,{size:13,"aria-hidden":!0}):(0,Z.jsx)(Tt,{size:13,"aria-hidden":!0}),Le({count:t.length})]}),p?(0,Z.jsx)(mn,{connections:t,displayByInstance:c}):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:[ce(),i.length>0?(0,Z.jsx)(I,{variant:`destructive`,children:o({count:i.length})}):(0,Z.jsx)(I,{variant:`secondary`,children:Ve()})]}),(0,Z.jsxs)(`p`,{className:`oc-admin__hint`,children:[Ue({version:e.vendoredVersion}),r?` · `+ue({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)(Tt,{size:13,"aria-hidden":!0}),m({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===`nodata`?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:S()}):(0,Z.jsxs)(`div`,{className:`oc-compat`,children:[n?null:(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:Se()}),r===null?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:s()}):(0,Z.jsxs)(`div`,{className:`oc-compat__support`,children:[(0,Z.jsx)(`span`,{className:`oc-compat__label`,children:h({provider:a})}),e&&e.range!==null?(0,Z.jsx)(`span`,{children:lt({min:e.range.min,max:e.range.maxValidated})}):(0,Z.jsx)(`span`,{children:b()}),e?(0,Z.jsx)(En,{versions:e.validatedVersions}):null]}),i.length===0?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:v()}):(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)(I,{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)(Mt,{open:!0,onOpenChange:e=>!e&&t(),children:(0,Z.jsxs)(At,{className:`oc-bridge-config-dialog`,onOpenAutoFocus:e=>e.preventDefault(),children:[(0,Z.jsxs)(wt,{children:[(0,Z.jsx)(It,{children:a({instance:e.displayName??e.name})}),(0,Z.jsx)(Ot,{children:He()})]}),(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?me():t.detail]})]}):(0,Z.jsxs)(`p`,{className:`oc-bridge-config__check-row oc-bridge-config__check-row--skip`,children:[e,` — `,se()]}):null}function Tn({instance:e,onClose:t}){let n=r(g.admin.upsertInstanceConfig),i=Ee(g.bridge.validateMediaPaths),a=St(),o=Rt(e.config?.contentLocale,void 0),[s,u]=(0,G.useState)(()=>pt(e.config??{},o)),[d,f]=(0,G.useState)(!1),[m,h]=(0,G.useState)(!1),[_,v]=(0,G.useState)(null),y=s.inboundMediaMode===`shared-fs`,b=s.mediaMode===`shared-fs`,x=y||b;async function S(){h(!0),v(null);try{v(await i({instanceName:e.name,inboundMediaMode:s.inboundMediaMode,mediaMode:s.mediaMode}))}catch(e){a.error(re(),e)}finally{h(!1)}}async function C(){f(!0);try{let r=e.config??{};await n({instanceId:e._id,config:ht(s,r,o)}),t()}catch(e){a.error(he(),e)}finally{f(!1)}}return(0,Z.jsx)(`div`,{className:`oc-bridge-config`,children:(0,Z.jsxs)(`div`,{className:`oc-bridge-config__form`,children:[(0,Z.jsxs)(`div`,{className:`oc-bridge-config__grid`,children:[(0,Z.jsxs)(`label`,{className:`oc-field`,children:[(0,Z.jsx)(O,{label:p(),help:at()}),(0,Z.jsxs)(B,{value:s.mediaMode,onValueChange:e=>u({...s,mediaMode:e}),children:[(0,Z.jsx)(z,{size:`sm`,className:`w-full`,children:(0,Z.jsx)(F,{})}),(0,Z.jsx)(P,{children:gt.map(e=>(0,Z.jsx)(j,{value:e,children:e},e))})]})]}),(0,Z.jsxs)(`label`,{className:`oc-field`,children:[(0,Z.jsx)(O,{label:ee(),help:Ae()}),(0,Z.jsxs)(B,{value:s.inboundMediaMode,onValueChange:e=>u({...s,inboundMediaMode:e}),children:[(0,Z.jsx)(z,{size:`sm`,className:`w-full`,children:(0,Z.jsx)(F,{})}),(0,Z.jsx)(P,{children:mt.map(e=>(0,Z.jsx)(j,{value:e,children:e},e))})]})]}),(0,Z.jsxs)(`label`,{className:`oc-field`,children:[(0,Z.jsx)(O,{label:ve(),help:De()}),(0,Z.jsx)(L,{type:`number`,min:1,max:4096,className:`w-full`,value:s.mediaMaxMb,onChange:e=>u({...s,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:ae(),help:Xe()}),(0,Z.jsx)(L,{className:`w-full`,spellCheck:!1,value:s.inboundAgentMount,onChange:e=>u({...s,inboundAgentMount:e.target.value})})]}),b&&(0,Z.jsxs)(`label`,{className:`oc-field`,children:[(0,Z.jsx)(O,{label:oe(),help:ne()}),(0,Z.jsx)(L,{className:`w-full`,spellCheck:!1,value:s.outboundAgentMount,onChange:e=>u({...s,outboundAgentMount:e.target.value})})]})]}),(0,Z.jsxs)(`label`,{className:`oc-field--row`,children:[(0,Z.jsx)(kt,{checked:s.rehydration,onCheckedChange:e=>u({...s,rehydration:e===!0})}),(0,Z.jsx)(O,{label:nt(),help:Ie()})]}),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}),te({reason:_.reason??`?`})]}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)($,{label:c(),result:_.inbound}),(0,Z.jsx)($,{label:ut(),result:_.outbound}),(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:Ce()})]}):(0,Z.jsxs)(`p`,{className:`oc-bridge-config__check-row oc-bridge-config__check-row--err`,children:[(0,Z.jsx)(N,{"aria-hidden":!0}),ie()]})}),(0,Z.jsxs)(`div`,{className:`oc-bridge-config__actions`,children:[x&&(0,Z.jsxs)(k,{variant:`outline`,size:`sm`,onClick:()=>void S(),disabled:m,children:[m?(0,Z.jsx)(Ct,{className:`size-4 animate-spin`,"aria-hidden":!0}):null,m?xe():Te()]}),(0,Z.jsx)(k,{size:`sm`,onClick:()=>void C(),disabled:d,children:l()})]})]})})}function En({versions:e}){if(e.length===0)return null;let t=[...e].reverse();return(0,Z.jsxs)(xt,{children:[(0,Z.jsx)(Ft,{asChild:!0,children:(0,Z.jsxs)(`button`,{type:`button`,className:`oc-compat__versions-btn`,children:[e.length===1?pe():C({count:e.length}),(0,Z.jsx)(D,{size:13,"aria-hidden":!0})]})}),(0,Z.jsxs)(Et,{className:`oc-compat__versions-pop`,align:`start`,children:[(0,Z.jsx)(`p`,{className:`oc-compat__versions-title`,children:x()}),(0,Z.jsx)(`div`,{className:`oc-compat__versions-list`,children:t.map(e=>(0,Z.jsx)(I,{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{$P as r,$c as i,Ca as a,Da as o,E as s,Ea as c,En as l,GP as u,Jc as d,Ml as f,O_ as p,Oa as m,Qc as h,Sa as g,Ta as _,Xc as v,Yc as y,ZP as b,Zc as x,ba as S,eF as C,el as w,gu as T,lu as E,mu as D,nl as O,tl as k,uu as A,wa as j,xa as M,ya as N}from"./dist-De2K23IB.js";import{t as P}from"./button-Bd43O_sm.js";import{C as F,Pt as I,S as L,T as R,b as z,f as B,ft as V,m as H,p as U,w as W,x as G}from"./index-CNwjY680.js";import{i as K}from"./compatView-B2BXfBvC.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=r(s.admin.upsertInstanceConfig),n=C(s.agents.listAgentsForInstance,{instanceName:e.name}),i=typeof e.config?.converterAgentId==`string`?e.config.converterAgentId:``,[o,c]=(0,q.useState)(i),[l,u]=(0,q.useState)(`idle`);(0,q.useEffect)(()=>{c(i),u(`idle`)},[e._id,i]);let f=`__none__`,p=o!==i;async function m(){u(`saving`);try{let n={...e.config??{}};o===``||o===f?delete n.converterAgentId:n.converterAgentId=o,await t({instanceId:e._id,config:n}),u(`done`)}catch{u(`error`)}}let h=n?.agents??[];return(0,X.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,X.jsx)(`span`,{className:`oc-cdefaults__label`,children:_()}),(0,X.jsx)(`p`,{className:`oc-admin__hint`,children:j()}),(0,X.jsxs)(`div`,{className:`oc-cdefaults__inline`,children:[(0,X.jsxs)(G,{value:o===``?f:o,onValueChange:e=>c(e===f?``:e),children:[(0,X.jsx)(W,{className:`oc-cdefaults__select`,"aria-label":_(),children:(0,X.jsx)(R,{placeholder:a()})}),(0,X.jsxs)(L,{children:[(0,X.jsx)(F,{value:f,children:a()}),h.map(e=>(0,X.jsx)(F,{value:e.agentId,children:e.displayName?`${e.displayName} (${e.agentId})`:e.agentId},e.agentId))]})]}),(0,X.jsx)(P,{size:`sm`,disabled:!p||l===`saving`,onClick:()=>void m(),children:l===`saving`?T():v()})]}),l===`done`?(0,X.jsx)(`p`,{className:`oc-admin__hint`,role:`status`,children:y()}):null,l===`error`?(0,X.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:d()}):null]})}function Q({instance:e}){let t=r(s.admin.upsertInstanceConfig),n=e.config?.curationEnabled===!0,i=typeof e.config?.curationBudgetChars==`number`?e.config.curationBudgetChars:null,[a,o]=(0,q.useState)(n),[l,u]=(0,q.useState)(i===null?``:String(i)),[f,p]=(0,q.useState)(`idle`);(0,q.useEffect)(()=>{o(n),u(i===null?``:String(i)),p(`idle`)},[e._id,n,i]);let m=l.trim(),h=m===``?null:/^\d+$/.test(m)?Number.parseInt(m,10):NaN,_=!a||h===null||Number.isInteger(h)&&h>=4e3&&h<=6e4,b=a!==n||(h??null)!==i;async function x(){p(`saving`);try{let n={...e.config??{}};n.curationEnabled=a,!a||h===null||Number.isNaN(h)?delete n.curationBudgetChars:n.curationBudgetChars=h,await t({instanceId:e._id,config:n}),p(`done`)}catch{p(`error`)}}return(0,X.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,X.jsxs)(`label`,{className:`oc-cdefaults__inline`,style:{cursor:`pointer`},children:[(0,X.jsx)(H,{checked:a,onCheckedChange:e=>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)(V,{type:`number`,min:4e3,max:6e4,step:1e3,placeholder:`20000`,value:l,onChange:e=>u(e.target.value),className:`oc-cdefaults__number`,"aria-invalid":!_,"aria-label":g(),disabled:!a}),(0,X.jsx)(P,{size:`sm`,disabled:!b||!_||f===`saving`,onClick:()=>void x(),children:f===`saving`?T():v()})]}),_?null:(0,X.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:M()}),f===`done`?(0,X.jsx)(`p`,{className:`oc-admin__hint`,role:`status`,children:y()}):null,f===`error`?(0,X.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:d()}):null,(0,X.jsx)(`p`,{className:`oc-cdefaults__help`,children:S()})]})}function $({instance:e}){let t=r(s.admin.upsertInstanceConfig),n=typeof e.config?.summarizeThresholdChars==`number`?e.config.summarizeThresholdChars:null,[i,a]=(0,q.useState)(n===null?``:String(n)),[c,l]=(0,q.useState)(`idle`);(0,q.useEffect)(()=>{a(n===null?``:String(n)),l(`idle`)},[e._id,n]);let u=i.trim(),f=u===``?null:/^\d+$/.test(u)?Number.parseInt(u,10):NaN,p=f===null||Number.isInteger(f)&&f>=1e3&&f<=2e5,h=(f??null)!==n;async function g(){l(`saving`);try{let n={...e.config??{}};f===null?delete n.summarizeThresholdChars:n.summarizeThresholdChars=f,await t({instanceId:e._id,config:n}),l(`done`)}catch{l(`error`)}}return(0,X.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,X.jsx)(`span`,{className:`oc-cdefaults__label`,children:m()}),(0,X.jsxs)(`div`,{className:`oc-cdefaults__inline`,children:[(0,X.jsx)(V,{type:`number`,min:1e3,max:2e5,step:1e3,placeholder:`8000`,value:i,onChange:e=>a(e.target.value),className:`oc-cdefaults__number`,"aria-invalid":!p}),(0,X.jsx)(P,{size:`sm`,disabled:!h||!p||c===`saving`,onClick:()=>void g(),children:c===`saving`?T():v()})]}),p?null:(0,X.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:N()}),c===`done`?(0,X.jsx)(`p`,{className:`oc-admin__hint`,role:`status`,children:y()}):null,c===`error`?(0,X.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:d()}):null,(0,X.jsx)(`p`,{className:`oc-cdefaults__help`,children:o()})]})}function ee(){let e=b(s.agentFiles.getChatDefaults),[t,n]=(0,q.useState)({status:`loading`}),r=C(s.admin.listInstances,{}),[a,o]=(0,q.useState)(null);(0,q.useEffect)(()=>{!r||r.length===0||(!a||!r.some(e=>e.name===a))&&o(r[0].name)},[r,a]);let c=(r?.length??0)>1,d=r!==void 0&&r.length===0,m=C(s.compat.forInstance,a?{instanceName:a}:`skip`),g=a?z(m,`configDefaults`):`loading`,_=g===`loading`?null:g.blocked,v=(0,q.useMemo)(()=>c&&a?{instanceName:a}:{},[c,a]),y=(0,q.useRef)(0),S=(0,q.useCallback)(async()=>{let t=++y.current;n({status:`loading`});try{let r=Y(await e(v));if(y.current!==t)return;n({status:`done`,current:r})}catch{if(y.current!==t)return;n({status:`error`})}},[e,v]);(0,q.useEffect)(()=>{_===!1&&(c&&!a||S())},[S,_,c,a]);let T=t.status===`done`?t.current:null,j=(0,q.useMemo)(()=>J.map(e=>({id:e,label:U(e)})),[]),M=(0,q.useMemo)(()=>[{id:`fast`,label:A()},{id:`standard`,label:E()}],[]);return(0,X.jsxs)(`div`,{className:`oc-cdefaults`,children:[(0,X.jsx)(`p`,{className:`oc-admin__hint`,children:O()}),c&&a?(0,X.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,X.jsx)(`span`,{className:`oc-cdefaults__label`,children:f()}),(0,X.jsxs)(G,{value:a,onValueChange:e=>o(e),children:[(0,X.jsx)(W,{size:`sm`,"aria-label":f(),children:(0,X.jsx)(R,{})}),(0,X.jsx)(L,{children:(r??[]).map(e=>(0,X.jsx)(F,{value:e.name,children:e.name},e.name))})]})]}):null,d?(0,X.jsx)(`p`,{className:`oc-admin__hint`,role:`status`,children:p()}):g===`loading`?(0,X.jsx)(`p`,{className:`oc-admin__hint`,children:u()}):g.blocked?(0,X.jsxs)(`p`,{className:`oc-compat__blocked`,role:`status`,children:[(0,X.jsx)(I,{size:14,"aria-hidden":!0}),` `,K(g.gatewayVersion,g.provider)]}):t.status===`loading`?(0,X.jsx)(`p`,{className:`oc-admin__hint`,children:u()}):t.status===`error`?(0,X.jsxs)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:[x(),` `,(0,X.jsx)(P,{variant:`outline`,size:`sm`,onClick:()=>void S(),children:D()})]}):(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,X.jsx)(`span`,{className:`oc-cdefaults__label`,children:k()}),(0,X.jsx)(B,{options:j,value:T?.thinkingDefault??null,onChange:()=>{},disabled:!0}),(0,X.jsx)(`p`,{className:`oc-cdefaults__help`,children:w()})]}),(0,X.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,X.jsx)(`span`,{className:`oc-cdefaults__label`,children:i()}),(0,X.jsx)(B,{options:M,value:T===null||T.fastModeDefault===null?null:T.fastModeDefault?`fast`:`standard`,onChange:()=>{},disabled:!0}),(0,X.jsx)(`p`,{className:`oc-cdefaults__help`,children:h()})]}),(0,X.jsx)(`p`,{className:`oc-cdefaults__note`,children:l()})]}),(()=>{let e=r?.find(e=>e.name===(a??r[0]?.name));return e?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)($,{instance:e}),(0,X.jsx)(Q,{instance:e}),(0,X.jsx)(Z,{instance:e})]}):null})()]})}export{ee as ChatDefaultsTab};
@@ -1 +0,0 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Cp as r,Sp as i,_p as a,bp as o,vp as s,xp as c,yp as l}from"./dist-De2K23IB.js";import{i as u,r as d}from"./dist-CXJY_tYD.js";import{t as f}from"./chevrons-up-down-DIXCqs3W.js";import{t as p}from"./button-Bd43O_sm.js";import{Bt as m,Ft as h,Yt as g,at as _,lt as v,m as y,ot as b,st as x,ut as S}from"./index-CNwjY680.js";import{a as C,i as w,n as T,o as E,r as D,t as O}from"./table-BRilRxUj.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=r(),bulkActions:F,emptyHint:I=i(),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:c()}):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)(y,{"aria-label":o(),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":a({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)(y,{"aria-label":l(),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)(_,{children:[(0,M.jsx)(S,{asChild:!0,children:(0,M.jsx)(p,{variant:`ghost`,size:`icon-sm`,"aria-label":s(),className:`opacity-0 transition-opacity group-hover/row:opacity-100 group-focus-within/row:opacity-100 aria-expanded:opacity-100`,children:(0,M.jsx)(g,{})})}),(0,M.jsx)(b,{align:`end`,children:t.map((t,n)=>(0,M.jsxs)(`div`,{children:[t.variant===`destructive`&&n>0?(0,M.jsx)(v,{}):null,(0,M.jsx)(x,{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{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$C as r,$P as i,Aw as a,Bi as o,Bw as s,Cw as c,Dw as l,E as u,Ew as d,Fw as f,GC as p,Gw as m,Hw as h,Iw as ee,JC as g,KC as _,Kw as v,Lw as y,Mw as te,Nw as ne,Ow as re,Pw as ie,QC as b,Ri as x,Rw as S,Sw as C,Tw as w,Uw as T,Vw as E,WC as D,Ww as O,XC as k,YC as A,ZC as j,_w as M,aw as N,bw as P,cw as F,dw as I,eF as L,ew as R,fw as z,gw as B,hw as V,iw as H,jw as U,kw as W,lw as ae,mw as G,nw as K,ow as q,pw as J,qC as oe,rw as se,sw as ce,tw as le,uw as ue,vw as de,ww as fe,xw as pe,yw as me,zw as he}from"./dist-De2K23IB.js";import{t as ge}from"./button-Bd43O_sm.js";import{U as _e,rt as Y}from"./index-CNwjY680.js";import{t as ve}from"./DataTableShell-COEwE2Hv.js";var X=t(e(),1),Z=n(),ye={altered_words:()=>v(),incorrect:()=>m(),incoherence:()=>O(),formatting:()=>T(),latency:()=>h(),api_error:()=>E(),other:()=>s()},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:S()}):e===!1?(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-warn`,children:y()}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill`,children:`—`}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill`,children:he()})}function be({data:e,reference:t,closeReason:n}){let r=e.snapshot,s=i(u.feedback.respondToFeedback),[p,m]=(0,X.useState)(e.thread),[h,g]=(0,X.useState)(``),[_,v]=(0,X.useState)(!1);async function y(){let t=h.trim();if(!(!t||_)){v(!0);try{await s({feedbackId:e._id,text:t}),m(e=>[...e,{authorRole:`admin`,text:t,at:Date.now()}]),g(``)}finally{v(!1)}}}let b=[];try{b=r.contextJson?JSON.parse(r.contextJson):[]}catch{b=[]}return(0,Z.jsxs)(`div`,{className:`oc-fbadmin__detail`,children:[(0,Z.jsxs)(`div`,{className:`oc-fbadmin__row`,children:[(0,Z.jsx)($,{matches:r.displayedMatchesStored,sourceWasOpen:r.clientInfo?.sourceWasOpen??!1}),(0,Z.jsxs)(`span`,{className:`oc-fbadmin__meta`,children:[Q(e.category),` · `,r.messageRole,r.isRegeneration?` · ${ee()}`:``,r.openclawModel?` · ${r.openclawModel}`:``,r.openclawRuntime?` (${r.openclawRuntime})`:``]}),t?(0,Z.jsx)(`code`,{className:`oc-fbadmin__ref`,style:{userSelect:`all`,marginLeft:`auto`},title:ue(),children:t}):null]}),e.comment?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:f()}),(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:k()}),(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:ie()}),p.length>0?(0,Z.jsx)(`div`,{className:`oc-fbadmin__thread`,children:p.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`?ne():e.authorRole===`agent`?e.authorLabel??o():te()}),(0,Z.jsx)(`span`,{className:`oc-notif__msg-text`,children:e.text})]},t))}):(0,Z.jsx)(`p`,{className:`oc-fbadmin__meta`,children:U()}),(0,Z.jsx)(`textarea`,{className:`oc-feedback__textarea`,placeholder:a(),value:h,maxLength:2e3,rows:3,onChange:e=>g(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 y(),disabled:!h.trim()||_,children:_?W():re()})})]}),(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:l()}),(0,Z.jsx)(`pre`,{className:`oc-msg__source-pre`,children:r.messageText||d()})]}),r.clientInfo?.sourceWasOpen&&r.displayedText!==void 0?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:w()}),(0,Z.jsx)(`pre`,{className:`oc-msg__source-pre`,children:r.displayedText||d()})]}):null,r.promptText?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:fe()}),(0,Z.jsx)(`pre`,{className:`oc-msg__source-pre`,children:r.promptText})]}):null,b.length>0?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:c({count:r.contextCount??b.length,truncated:r.contextTruncated?C():``})}),(0,Z.jsx)(`div`,{className:`oc-fbadmin__ctx`,children:b.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,r.outboxAvailable?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:pe()}),(0,Z.jsxs)(`pre`,{className:`oc-msg__source-pre`,children:[r.outboxText??``,r.outboxStatus?`\n[status: ${r.outboxStatus}]`:``]})]}):null,r.clientInfo?.extensionsDetected&&r.clientInfo.extensionsDetected.length>0?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:P()}),(0,Z.jsx)(`div`,{className:`oc-fbadmin__row`,children:r.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:me()}),(0,Z.jsxs)(`p`,{className:`oc-fbadmin__env`,children:[[r.clientInfo?.language,r.clientInfo?.timezone,r.clientInfo?.theme?de({theme:r.clientInfo.theme}):null,r.runId?`run ${r.runId.slice(0,12)}…`:null].filter(Boolean).join(` · `)||`—`,r.clientInfo?.plugins&&r.clientInfo.plugins.length>0?(0,Z.jsxs)(`span`,{className:`oc-fbadmin__plugins`,children:[M(),` `,r.clientInfo.plugins.join(`, `),(0,Z.jsxs)(`span`,{className:`oc-fbadmin__note`,children:[` `,B()]})]}):null,r.clientInfo?.userAgent?(0,Z.jsx)(`span`,{className:`oc-fbadmin__ua`,children:r.clientInfo.userAgent}):null]})]})]})}function xe(){let e=L(u.feedback.listForAdmin,{}),t=i(u.feedback.readSnapshot),n=i(u.feedback.deleteFeedback),a=_e(),[o,s]=(0,X.useState)(null),[c,l]=(0,X.useState)({});async function d(e){if(o===e._id){s(null);return}if(!c[e._id]){let n=await t({feedbackId:e._id});l(t=>({...t,[e._id]:n}))}s(e._id)}async function f(e){await a({title:_(),description:p(),confirmLabel:D(),destructive:!0})&&(await n({feedbackId:e._id}),o===e._id&&s(null))}return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`p`,{className:`oc-admin__hint`,children:[V(),` `,(0,Z.jsx)(`strong`,{children:G()}),` `,J()]}),(0,Z.jsx)(ve,{title:z(),rows:e,emptyHint:I(),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:ae(),cell:e=>Y(e.at),sort:e=>e.at},{header:F(),cell:e=>Q(e.category),sort:e=>Q(e.category)},{header:ce(),cell:e=>e.messageRole===`user`?q():N(),sort:e=>e.messageRole},{header:H(),cell:e=>(e.reporterEmail||e.reporterName||`—`)+(e.impersonated&&e.realOperatorEmail?` ${se({operator:e.realOperatorEmail})}`:``),sort:e=>e.reporterEmail||e.reporterName||null},{header:K(),cell:e=>(0,Z.jsx)($,{matches:e.displayedMatchesStored,sourceWasOpen:e.sourceWasOpen}),sort:e=>e.displayedMatchesStored===!1?0:e.displayedMatchesStored===!0?1:2},{header:le(),cell:e=>e.hasComment?`✎`:`—`,sort:e=>+!!e.hasComment},{header:R(),cell:e=>e.userClosedAt==null?e.resolvedAt==null?e.answered?(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-ok`,children:r()}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill`,children:b()}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-ok`,title:e.resolvedBy??void 0,children:x()}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-closed`,children:j()}),sort:e=>e.userClosedAt==null?e.resolvedAt==null?+!!e.answered:2:3}],rowActions:e=>[{label:o===e._id?A():g(),onSelect:()=>void d(e)},{label:oe(),onSelect:()=>void f(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{$N as ee,$P as te,BN as ne,E as r,GD as re,GN as i,GP as ie,HN as ae,JN as oe,KN as a,LN as o,QN as s,RN as c,UN as l,Ui as u,VN as se,WN as ce,Wi as d,XN as le,YN as ue,ZN as de,_P as fe,aP as f,cP as pe,dP as me,eF as he,eP as ge,fP as _e,gP as ve,hP as p,iP as m,lP as ye,mP as h,nP as g,oP as _,pP as be,qN as xe,qP as v,rP as y,sP as b,tP as x,uP as S,vP as C,zN as w}from"./dist-De2K23IB.js";import{t as T}from"./button-Bd43O_sm.js";import{C as E,Ft as D,G as O,H as k,J as A,K as j,Q as M,S as N,T as P,X as Se,Xt as F,Y as Ce,Yt as we,Z as Te,at as Ee,dt as I,m as De,ot as Oe,q as ke,st as L,ut as Ae,w as R,x as z,zt as je}from"./index-CNwjY680.js";import{a as Me,i as B,n as Ne,o as V,r as H,t as Pe}from"./table-BRilRxUj.js";var U=t(e(),1),W=n(),G=`all`;function K(e){switch(e){case`image`:return b();case`audio`:return _();case`video`:return f();case`pdf`:return m();case`document`:return y();case`archive`:return g();default:return x()}}function q(){let[e,t]=(0,U.useState)(G),[n,f]=(0,U.useState)(G),[m,g]=(0,U.useState)(G),[_,y]=(0,U.useState)(G),[b,x]=(0,U.useState)(!1),[q,J]=(0,U.useState)(null),Fe=te(r.files.softDelete),Y=k();function Ie(){t(G),f(G),g(G),y(G)}async function Le(){let e=q;if(J(null),e)try{await Fe({fileId:e.id}),Y.success(ce())}catch(e){Y.error(l(),e)}}let X=he(r.files.listMine,{direction:e===G?void 0:e,chatId:n===G?void 0:n,instanceName:m===G?void 0:m,category:_===G?void 0:_,includeAutoGenerated:b||void 0}),Re=(0,U.useMemo)(()=>new Intl.DateTimeFormat(v(),{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;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)(z,{value:e,onValueChange:t,children:[(0,W.jsx)(R,{size:`sm`,"aria-label":fe(),children:(0,W.jsx)(P,{})}),(0,W.jsxs)(N,{children:[(0,W.jsx)(E,{value:G,children:ve()}),(0,W.jsx)(E,{value:`inbound`,children:p()}),(0,W.jsx)(E,{value:`outbound`,children:h()})]})]}),(0,W.jsxs)(z,{value:n,onValueChange:f,children:[(0,W.jsx)(R,{size:`sm`,"aria-label":be(),children:(0,W.jsx)(P,{})}),(0,W.jsxs)(N,{children:[(0,W.jsx)(E,{value:G,children:_e()}),Q.chats.map(e=>(0,W.jsx)(E,{value:e.id,children:e.title},e.id))]})]}),Q.multiProvider?(0,W.jsxs)(z,{value:m,onValueChange:g,children:[(0,W.jsx)(R,{size:`sm`,"aria-label":me(),children:(0,W.jsx)(P,{})}),(0,W.jsxs)(N,{children:[(0,W.jsx)(E,{value:G,children:S()}),Q.instances.map(e=>(0,W.jsx)(E,{value:e,children:e},e))]})]}):null,(0,W.jsxs)(z,{value:_,onValueChange:y,children:[(0,W.jsx)(R,{size:`sm`,"aria-label":ye(),children:(0,W.jsx)(P,{})}),(0,W.jsxs)(N,{children:[(0,W.jsx)(E,{value:G,children:pe()}),Q.categories.map(e=>(0,W.jsx)(E,{value:e,children:K(e)},e))]})]}),(0,W.jsxs)(`label`,{className:`oc-files__autogen`,children:[(0,W.jsx)(De,{checked:b,onCheckedChange:e=>x(e===!0),"aria-label":d()}),(0,W.jsx)(`span`,{children:d()})]}),$?(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}),xe()]}):null]}),Z.length===0?(0,W.jsx)(`p`,{className:`oc-admin__hint`,children:$?c():w()}):(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:ge()}),(0,W.jsx)(B,{children:ee()}),(0,W.jsx)(B,{children:s()}),(0,W.jsx)(B,{children:de()}),(0,W.jsx)(B,{children:le()}),(0,W.jsx)(B,{className:`text-right`,children:ue()})]})}),(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)(I,{variant:`outline`,style:{marginLeft:6},children:u()}):null]}),(0,W.jsx)(H,{title:e.mimeType,children:K(e.category)}),(0,W.jsx)(H,{children:(0,W.jsx)(I,{variant:`secondary`,children:e.direction===`inbound`?p():h()})}),(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)(Ee,{children:[(0,W.jsx)(Ae,{asChild:!0,children:(0,W.jsx)(T,{variant:`ghost`,size:`icon`,"aria-label":a(),children:(0,W.jsx)(we,{size:16})})}),(0,W.jsxs)(Oe,{align:`end`,children:[e.url?(0,W.jsx)(L,{asChild:!0,children:(0,W.jsxs)(`a`,{href:e.url,download:e.filename,target:`_blank`,rel:`noopener noreferrer`,children:[(0,W.jsx)(F,{size:14}),oe()]})}):(0,W.jsxs)(L,{disabled:!0,children:[(0,W.jsx)(F,{size:14}),ne()]}),(0,W.jsxs)(L,{variant:`destructive`,onSelect:()=>J({id:e._id,filename:e.filename}),children:[(0,W.jsx)(D,{size:14}),i()]})]})]})})]},e._id))})]}),ze?(0,W.jsx)(`p`,{className:`oc-admin__hint`,style:{marginTop:8},children:o({cap:Be})}):null]}),(0,W.jsx)(O,{open:q!==null,onOpenChange:e=>!e&&J(null),children:(0,W.jsxs)(A,{children:[(0,W.jsxs)(Te,{children:[(0,W.jsx)(M,{children:ae()}),(0,W.jsx)(Ce,{children:se()})]}),(0,W.jsxs)(Se,{children:[(0,W.jsx)(ke,{children:re()}),(0,W.jsx)(j,{onClick:()=>void Le(),children:i()})]})]})})]})}export{q as FilesTab};
@@ -1 +0,0 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$P as r,$u as i,Ad as a,Au as o,Bu as s,Cd as c,D as l,Dd as u,E as d,Ed as f,Fd as p,Fu as m,Gu as h,Hu as g,Id as _,Iu as v,Ju as y,Ku as b,Ld as x,Lu as S,Md as C,Mu as w,Nd as T,Nu as E,Od as ee,Ou as D,Pd as O,Pu as k,Qu as A,Ru as j,Sd as M,Td as N,Uu as P,Vu as F,Wu as te,Xu as ne,Yu as I,Zu as re,_d as ie,ad as L,bd as ae,cd as R,dd as oe,eF as z,ed as se,fd as ce,gd as le,hd as ue,id as de,jd as fe,ju as pe,kd as me,ku as he,ld as ge,md as _e,nd as ve,od as ye,pd as be,qu as xe,rd as Se,sd as Ce,td as we,ud as Te,vd as Ee,wd as De,xd as Oe,yd as ke,zu as Ae}from"./dist-De2K23IB.js";import{t as je}from"./x-DXaZHGzl.js";import{i as B,n as V,r as Me,t as Ne}from"./tabs-fDXC7itk.js";import{t as H}from"./button-Bd43O_sm.js";import{C as Pe,H as U,It as W,Lt as G,S as Fe,T as Ie,U as Le,_t as Re,d as ze,dt as K,en as Be,ft as q,ht as Ve,m as J,mt as He,pt as Ue,tn as We,vt as Ge,w as Ke,wt as qe,x as Je}from"./index-CNwjY680.js";import{t as Ye}from"./FilterBar-CY1WfFDB.js";import{t as Xe}from"./DataTableShell-COEwE2Hv.js";import{t as Y}from"./DetailChips-8ZpH5ZXE.js";var Ze=l(`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=l(`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=l(`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 de();case`user`:return Se();case`pending`:return ve();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(d.groups.listGroups,{}),t=z(d.me.getMe,{host:qe})?.role===`admin`,n=r(d.groups.createGroup),i=r(d.groups.updateGroup),s=r(d.groups.deleteGroup),l=Le(),m=U(),[h,g]=(0,Z.useState)(!1),[v,y]=(0,Z.useState)(null),[b,S]=(0,Z.useState)($),[w,E]=(0,Z.useState)(null),[D,k]=(0,Z.useState)(``),A=(0,Z.useMemo)(()=>{if(!e)return e;let t=D.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,D]);function j(){y(null),S($),g(!0)}function P(e){y(e),S({name:e.name,description:e.description??``}),g(!0)}async function F(){try{v?await i({groupId:v._id,name:b.name,description:b.description}):await n({name:b.name,description:b.description||void 0}),S($),y(null),g(!1)}catch(e){m.error(pe(),e)}}async function te(e){if(await l({title:Ee({name:e.name}),description:ie(),confirmWord:e.name,confirmLabel:le(),cancelLabel:De(),destructive:!0}))try{await s({groupId:e._id})}catch(e){m.error(o(),e)}}return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:_()}),(0,Q.jsx)(Ye,{q:D,onQChange:k,onReset:()=>k(``),canReset:D!==``,searchPlaceholder:me()}),(0,Q.jsx)(Xe,{title:x(),rows:A,addLabel:p(),onAdd:t?j:void 0,emptyHint:O(),columns:[{header:T(),cell:e=>e.name,sort:e=>e.name},{header:C(),cell:e=>(0,Q.jsx)(Y,{icon:(0,Q.jsx)(Qe,{size:12,"aria-hidden":!0}),total:e.memberCount,items:e.members.map(e=>({label:e.label,marker:e.manager?(0,Q.jsx)(X,{size:11,"aria-hidden":!0}):null,highlight:e.manager}))}),sort:e=>e.memberCount},{header:fe(),cell:e=>(0,Q.jsx)(Y,{icon:(0,Q.jsx)(G,{size:12,"aria-hidden":!0}),total:e.agentCount,items:e.agents.map(e=>({label:e}))}),sort:e=>e.agentCount},{header:a(),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)(W,{size:11,fill:`currentColor`,"aria-hidden":!0}):null,highlight:e.isDefault}))}),sort:e=>e.chartCount}],rowActions:e=>[{label:ee(),onSelect:()=>E({groupId:e._id,name:e.name})},...t?[{label:u(),onSelect:()=>P(e)},{label:f(),variant:`destructive`,onSelect:()=>void te(e)}]:[]]}),(0,Q.jsx)(ze,{open:h,onOpenChange:g,title:v?M():c(),description:Oe(),canSubmit:!!b.name.trim(),onSubmit:F,submitLabel:N(),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:ae()}),(0,Q.jsx)(q,{value:b.name,onChange:e=>S({...b,name:e.target.value})})]}),(0,Q.jsxs)(`label`,{className:`oc-field`,children:[(0,Q.jsx)(`span`,{className:`oc-field__label`,children:ke()}),(0,Q.jsx)(q,{value:b.description,onChange:e=>S({...b,description:e.target.value})})]})]})}),(0,Q.jsx)(ct,{groupId:w?.groupId??null,groupName:w?.name??``,open:w!==null,onOpenChange:e=>{e||E(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)(We,{size:14,"aria-hidden":!0}),Ce()]}),(0,Q.jsxs)(`span`,{className:`oc-access__pageinfo`,"aria-label":L({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:[ye(),(0,Q.jsx)(Be,{size:14,"aria-hidden":!0})]})]})}function ct({groupId:e,groupName:t,open:n,onOpenChange:a}){let o=z(d.groups.getGroup,n&&e?{groupId:e}:`skip`),s=z(d.groups.listAssignableInstances,n?{}:`skip`),c=z(d.groups.listAssignableUsers,n?{}:`skip`),l=r(d.groups.addMember),u=r(d.groups.removeMember),f=r(d.groups.bulkSetMembers),p=r(d.groups.setGroupManager),h=U(),[g,_]=(0,Z.useState)(``),[y,b]=(0,Z.useState)(``),[x,S]=(0,Z.useState)(`members`),[C,w]=(0,Z.useState)(1),[T,ee]=(0,Z.useState)(new Set),D=(0,Z.useRef)(null),O=(0,Z.useMemo)(()=>new Set((o?.members??[]).map(e=>e.userId)),[o]),A=(0,Z.useMemo)(()=>new Set((o?.members??[]).filter(e=>e.manager).map(e=>e.userId)),[o]),j=o?.viewerIsAdmin===!0,M=(0,Z.useMemo)(()=>new Set((o?.agents??[]).map(e=>`${e.instanceName}/${e.agentId}`)),[o]);(0,Z.useEffect)(()=>{_(``),b(``),S(`members`),w(1),D.current=null},[n,e]),(0,Z.useEffect)(()=>{w(1)},[g]),(0,Z.useEffect)(()=>{n&&o&&e&&D.current!==e&&(D.current=e,ee(new Set((o.members??[]).map(e=>e.userId))))},[n,o,e]);let N=(0,Z.useMemo)(()=>c?$e(c,g,T):[],[c,g,T]);async function P(t,n){if(e)try{n?await u({groupId:e,userId:t}):await l({groupId:e,userId:t})}catch(e){h.error(he(),e)}}async function F(t,n){if(e)try{await p({groupId:e,userId:t,manager:!n})}catch(e){h.error(E(),e)}}let I=rt(N,e=>O.has(e.userId)),ie=N.filter(e=>O.has(e.userId)).length,L=it(N,C,ot);async function ae(){if(!e||N.length===0)return;let t=N.map(e=>e.userId);try{await f({groupId:e,userIds:t,member:I!==`all`})}catch(e){h.error(he(),e)}}return(0,Q.jsx)(Ue,{open:n,onOpenChange:a,children:(0,Q.jsxs)(He,{className:`oc-access`,children:[(0,Q.jsxs)(Re,{children:[(0,Q.jsx)(Ge,{children:ue({name:t})}),(0,Q.jsx)(Ve,{children:_e()})]}),(0,Q.jsxs)(Ne,{value:x,onValueChange:S,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}),be(),o?(0,Q.jsx)(K,{variant:`secondary`,className:`oc-access__tabcount`,children:O.size}):null]}),(0,Q.jsxs)(B,{value:`agents`,className:`flex-1 gap-1.5`,children:[(0,Q.jsx)(G,{size:13,"aria-hidden":!0}),oe(),o?(0,Q.jsx)(K,{variant:`secondary`,className:`oc-access__tabcount`,children:M.size}):null]}),(0,Q.jsxs)(B,{value:`charts`,className:`flex-1 gap-1.5`,children:[(0,Q.jsx)(Ze,{size:13,"aria-hidden":!0}),te(),o?(0,Q.jsx)(K,{variant:`secondary`,className:`oc-access__tabcount`,children:o.chartCount}):null]})]}),(0,Q.jsx)(V,{value:`members`,children:c===void 0||o===void 0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:i()}):c.length===0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:re()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(q,{value:g,onChange:e=>_(e.target.value),placeholder:ce(),className:`oc-access__search`}),N.length===0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:ge()}):(0,Q.jsxs)(Q.Fragment,{children:[N.length>1?(0,Q.jsxs)(`div`,{className:`oc-access__row oc-access__selectall`,children:[(0,Q.jsx)(J,{checked:I===`all`?!0:I===`some`?`indeterminate`:!1,onCheckedChange:()=>void ae(),"aria-label":R()}),(0,Q.jsx)(`span`,{className:`oc-access__label`,children:R()}),(0,Q.jsxs)(K,{variant:`outline`,className:`oc-access__count`,children:[ie,` / `,N.length]})]}):null,(0,Q.jsx)(`div`,{className:`oc-access__list`,children:L.pageItems.map(e=>{let t=O.has(e.userId),n=tt(e),r=A.has(e.userId);return(0,Q.jsxs)(`div`,{className:`oc-access__row`,children:[(0,Q.jsx)(J,{checked:t,onCheckedChange:()=>void P(e.userId,t),"aria-label":we({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&&j?(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?k():m(),title:r?k():m(),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":v(),title:v(),children:(0,Q.jsx)(X,{size:15,"aria-hidden":!0})}):null})]},e._id)})}),(0,Q.jsx)(st,{page:L.page,pageCount:L.pageCount,onPage:w})]})]})}),(0,Q.jsx)(V,{value:`agents`,children:s===void 0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:i()}):s.length===0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:ne()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(q,{value:y,onChange:e=>b(e.target.value),placeholder:Te(),className:`oc-access__search`}),(0,Q.jsx)(`div`,{className:`oc-access__list`,children:s.map(t=>(0,Q.jsx)(lt,{groupId:e,instanceName:t.name,kind:t.kind??`openclaw`,assigned:M,query:y},`${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:i,query:a}){let o=z(d.groups.listAssignableAgents,{instanceName:t}),s=r(d.groups.assignAgentToGroup),c=r(d.groups.removeAgentFromGroup),l=r(d.groups.bulkSetGroupAgents),u=U(),[f,p]=(0,Z.useState)(1);if((0,Z.useEffect)(()=>{p(1)},[a]),!e)return null;let m=et(o?.agents??[],a),g=o?.discovery&&!o.discovery.lastPollOk;if(a.trim()&&m.length===0)return null;let _=m.filter(e=>e.presentInLastOk!==!1&&e.enabled!==!1),v=rt(_,e=>i.has(`${t}/${e.agentId}`)),x=it(m,f,ot);async function S(n,r){try{r?await c({groupId:e,instanceName:t,agentId:n}):await s({groupId:e,instanceName:t,agentId:n})}catch(e){u.error(D(),e)}}async function C(){if(_.length===0)return;let n=_.map(e=>e.agentId);try{await l({groupId:e,instanceName:t,agentIds:n,assigned:v!==`all`})}catch(e){u.error(D(),e)}}return(0,Q.jsxs)(`div`,{className:`oc-access__group`,children:[(0,Q.jsxs)(`div`,{className:`oc-access__instance`,children:[(0,Q.jsx)(G,{size:13,"aria-hidden":!0}),(0,Q.jsx)(`span`,{children:t}),(0,Q.jsx)(K,{variant:`outline`,className:`oc-access__kind`,children:n}),g?(0,Q.jsx)(K,{variant:`outline`,className:`oc-access__stale`,children:xe()}):null]}),o===void 0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:A()}):m.length===0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:g?y():I()}):(0,Q.jsxs)(Q.Fragment,{children:[_.length>1?(0,Q.jsxs)(`div`,{className:`oc-access__row oc-access__selectall`,children:[(0,Q.jsx)(J,{checked:v===`all`?!0:v===`some`?`indeterminate`:!1,onCheckedChange:()=>void C(),"aria-label":R()}),(0,Q.jsx)(`span`,{className:`oc-access__label`,children:R()})]}):null,x.pageItems.map(e=>{let n=`${t}/${e.agentId}`,r=i.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)(J,{checked:r,disabled:(a||o)&&!r,onCheckedChange:()=>void S(e.agentId,r),"aria-label":se({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":h(),title:h(),children:(0,Q.jsx)(W,{size:14,fill:`currentColor`})}):null,a?(0,Q.jsx)(K,{variant:`outline`,className:`oc-access__gone`,children:b()}):null]},e.agentId)}),(0,Q.jsx)(st,{page:x.page,pageCount:x.pageCount,onPage:p})]})]})}function ut({groupId:e}){let t=z(d.charts.listGroupChartSelection,e?{groupId:e}:`skip`),n=r(d.charts.assignChartToGroup),a=r(d.charts.removeChartFromGroup),o=r(d.charts.setGroupDefaultChart),c=r(d.charts.addChartToGroupPool),l=r(d.charts.removeChartFromGroupPool),u=U();if(!e)return null;if(t===void 0)return(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:i()});let{pool:f,addable:p,canManagePool:m}=t;if(f.length===0&&!m)return(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:P()});async function h(t,r){try{r?await a({groupId:e,chartKey:t}):await n({groupId:e,chartKey:t})}catch(e){u.error(w(),e)}}async function _(t){try{await o({groupId:e,chartKey:t})}catch(e){u.error(w(),e)}}async function v(t){try{await c({groupId:e,chartKey:t})}catch(e){u.error(w(),e)}}async function y(t){try{await l({groupId:e,chartKey:t})}catch(e){u.error(w(),e)}}return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`div`,{className:`oc-access__list`,children:f.map(e=>(0,Q.jsxs)(`div`,{className:`oc-access__row`,children:[(0,Q.jsx)(J,{checked:e.selected,onCheckedChange:()=>void h(e.chartKey,e.selected),"aria-label":Ae({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":j(),title:j(),children:(0,Q.jsx)(W,{size:14,fill:`currentColor`})}):(0,Q.jsx)(H,{type:`button`,variant:`ghost`,size:`sm`,onClick:()=>void _(e.chartKey),children:S()}):null,m?(0,Q.jsx)(H,{type:`button`,variant:`ghost`,size:`sm`,"aria-label":s({name:e.name}),title:s({name:e.name}),onClick:()=>void y(e.chartKey),children:(0,Q.jsx)(je,{size:14,"aria-hidden":!0})}):null]},e.chartKey))}),m?p.length>0?(0,Q.jsxs)(Je,{value:``,onValueChange:e=>void v(e),children:[(0,Q.jsx)(Ke,{size:`sm`,className:`oc-access__search`,children:(0,Q.jsx)(Ie,{placeholder:F()})}),(0,Q.jsx)(Fe,{children:p.map(e=>(0,Q.jsx)(Pe,{value:e.chartKey,children:e.name},e.chartKey))})]}):f.length===0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:g()}):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{$P as r,$S as i,$x as a,AS as o,An as s,Ax as c,BS as l,Bx as u,CS as d,DS as f,Dx as p,E as m,ES as h,FS as g,Fx as _,GS as v,Ga as y,Gx as b,HS as x,Hx as S,IS as C,Ix as w,JS as T,Jx as ee,KS as te,Ka as E,Kx as D,LO as O,LS as k,Lx as ne,MS as A,Mx as re,NS as j,Nx as ie,OS as ae,Ox as oe,PS as se,Px as ce,QS as le,Qx as ue,RO as de,RS as fe,Rx as pe,SS as me,TS as he,US as ge,Ua as _e,Ux as ve,VS as ye,Vx as be,WS as xe,Wa as Se,Wx as Ce,XS as we,YS as Te,Yx as Ee,ZP as M,ZS as De,Zx as N,_S as Oe,aC as ke,aS as Ae,bS as je,cC as Me,cS as Ne,dC as Pe,dS as Fe,eC as Ie,eF as P,eS as F,fC as Le,fS as Re,gC as ze,gS as Be,hC as Ve,hS as He,iC as Ue,iS as We,jS as Ge,jn as Ke,jx as qe,kS as Je,kn as Ye,kx as Xe,lC as Ze,lS as Qe,mC as $e,mS as et,nC as I,nS as L,oC as tt,oS as nt,pC as rt,pS as it,qS as at,qx as ot,rC as st,rS as ct,sC as lt,sS as ut,tC as dt,tS as ft,uC as pt,uS as mt,vS as ht,v_ as gt,wS as _t,xS as vt,yS as yt,y_ as bt,zS as xt,zx as St}from"./dist-De2K23IB.js";import{a as Ct,c as wt}from"./FieldLabel-hLNtge_D.js";import{t as R}from"./button-Bd43O_sm.js";import{$ as Tt,C as z,H as B,S as V,T as H,U as Et,_t as U,d as Dt,dt as W,et as Ot,ft as G,ht as K,m as kt,mt as At,pt as jt,tt as Mt,vt as Nt,w as q,x as J}from"./index-CNwjY680.js";import{t as Pt}from"./DataTableShell-COEwE2Hv.js";import{InstanceConfigDialog as Ft}from"./BridgeTab-s6Ggg8Zu.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:Ct},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=P(m.admin.listInstances,{}),t=P(m.agents.listAllInstanceAgents,{}),n=r(m.admin.upsertInstance),a=r(m.admin.deleteInstance),o=B(),[c,u]=(0,Y.useState)(!1),[d,f]=(0,Y.useState)(Q),[p,h]=(0,Y.useState)(null),[g,_]=(0,Y.useState)(null),[y,b]=(0,Y.useState)(null),[S,C]=(0,Y.useState)(null);async function w(){try{await n({instanceId:S??void 0,name:d.name,gatewayUrl:d.gatewayUrl,bridgeUrl:d.bridgeUrl||void 0,displayName:d.displayName||void 0,kind:d.kind,transport:d.kind===`hermes`?d.transport:void 0,gatewayVersion:d.gatewayVersion||void 0,gatewayHttpUrl:d.gatewayHttpUrl||void 0,streamTransport:d.streamTransport}),f(Q),C(null),u(!1)}catch(e){o.error($e(),e)}}return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`p`,{className:`oc-admin__hint`,children:[rt(),(0,Z.jsx)(`strong`,{children:Le()}),Pe()]}),(0,Z.jsx)(Pt,{title:pt(),rows:e,addLabel:Ze(),onAdd:()=>{C(null),f(Q),u(!0)},emptyHint:Me(),columns:[{header:lt(),cell:e=>e.name,sort:e=>e.name},{header:tt(),cell:e=>(0,Z.jsx)(W,{variant:`outline`,children:e.kind??`openclaw`}),sort:e=>e.kind??`openclaw`},{header:ke(),cell:e=>e.gatewayUrl,sort:e=>e.gatewayUrl},{header:Ue(),cell:e=>e.displayName??`—`,sort:e=>e.displayName??null},{header:ze(),cell:e=>{let n=(t?.[e.name]??[]).filter(e=>e.presentInLastOk!==!1&&e.enabled);if(n.length===0)return(0,Z.jsx)(`span`,{className:`text-muted-foreground`,children:`—`});let r=t=>e.defaultAgentId===t;return(0,Z.jsx)(`div`,{className:`flex flex-wrap gap-1`,children:[...n].sort((e,t)=>Number(r(t.agentId))-Number(r(e.agentId))).map(e=>(0,Z.jsxs)(W,{variant:r(e.agentId)?`default`:`outline`,title:r(e.agentId)?oe():void 0,children:[e.emoji?`${e.emoji} `:``,e.displayName??e.agentId]},e.agentId))})}}],rowActions:e=>[{label:Ie(),onSelect:()=>{C(e._id),f(Bt(e)),u(!0)}},{label:Ve(),onSelect:()=>h(e.name)},{label:xt(),onSelect:()=>b(e)},{label:st(),onSelect:()=>_(e)},{label:I(),variant:`destructive`,onSelect:()=>void a({instanceId:e._id})}],bulkActions:[{label:I(),variant:`destructive`,onSelect:e=>e.forEach(e=>void a({instanceId:e}))}]}),(0,Z.jsx)(Dt,{open:c,onOpenChange:u,title:S?i():dt(),description:De(),canSubmit:!!(d.name&&d.gatewayUrl),onSubmit:w,submitLabel:we(),children:(0,Z.jsxs)(`div`,{className:`oc-form`,children:[(0,Z.jsxs)($,{label:Te(),children:[(0,Z.jsx)(G,{value:d.name,disabled:S!==null,onChange:e=>f({...d,name:e.target.value})}),S?(0,Z.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:le()}):null]}),(0,Z.jsx)($,{label:T(),children:(0,Z.jsxs)(J,{value:d.kind,onValueChange:e=>f({...d,kind:e}),children:[(0,Z.jsx)(q,{size:`sm`,className:`w-40`,children:(0,Z.jsx)(H,{})}),(0,Z.jsxs)(V,{children:[(0,Z.jsx)(z,{value:`openclaw`,children:`OpenClaw`}),(0,Z.jsx)(z,{value:`hermes`,children:`Hermes`})]})]})}),d.kind===`hermes`?(0,Z.jsx)($,{label:Ke(),children:(0,Z.jsxs)(J,{value:d.transport,onValueChange:e=>f({...d,transport:e}),children:[(0,Z.jsx)(q,{size:`sm`,className:`w-56`,children:(0,Z.jsx)(H,{})}),(0,Z.jsxs)(V,{children:[(0,Z.jsx)(z,{value:`ws`,children:s()}),(0,Z.jsx)(z,{value:`rest`,children:Ye()})]})]})}):null,(0,Z.jsx)($,{label:at(),children:(0,Z.jsx)(G,{value:d.gatewayUrl,onChange:e=>f({...d,gatewayUrl:e.target.value})})}),(0,Z.jsx)($,{label:te(),children:(0,Z.jsx)(G,{value:d.bridgeUrl,placeholder:v(),onChange:e=>f({...d,bridgeUrl:e.target.value})})}),(0,Z.jsx)($,{label:xe(),children:(0,Z.jsx)(G,{value:d.displayName,onChange:e=>f({...d,displayName:e.target.value})})}),(0,Z.jsxs)($,{label:bt(),children:[(0,Z.jsxs)(J,{value:d.streamTransport,onValueChange:e=>f({...d,streamTransport:e}),children:[(0,Z.jsx)(q,{size:`sm`,className:`w-40`,children:(0,Z.jsx)(H,{})}),(0,Z.jsx)(V,{children:wt.map(e=>(0,Z.jsx)(z,{value:e,children:e},e))})]}),(0,Z.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:gt()})]}),(0,Z.jsx)($,{label:ge(),children:(0,Z.jsx)(G,{value:d.gatewayVersion,placeholder:x(),onChange:e=>f({...d,gatewayVersion:e.target.value})})}),(0,Z.jsx)($,{label:ye(),children:(0,Z.jsx)(G,{value:d.gatewayHttpUrl,placeholder:l(),onChange:e=>f({...d,gatewayHttpUrl:e.target.value})})})]})}),(0,Z.jsx)(Zt,{instanceName:p,open:p!==null,onOpenChange:e=>{e||h(null)}}),g?(0,Z.jsx)(Ft,{instance:g,onClose:()=>_(null)},g._id):null,y?(0,Z.jsx)(Ht,{instance:y,onClose:()=>b(null)},y._id):null]})}function Ht({instance:e,onClose:t}){let n=P(m.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)(jt,{open:!0,onOpenChange:e=>!e&&t(),children:(0,Z.jsxs)(At,{onOpenAutoFocus:e=>e.preventDefault(),children:[(0,Z.jsxs)(U,{children:[(0,Z.jsx)(Nt,{children:fe({instance:e.displayName??e.name})}),(0,Z.jsx)(K,{children:k()})]}),(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=M(m.instanceSync.forceInstanceSync),n=B(),[r,i]=(0,Y.useState)(!1);async function a(){if(!r){i(!0);try{switch((await t({instanceId:e._id})).status){case`synced`:n.success(Oe());break;case`no_agents`:n.success(He());break;case`no_bridge_url`:n.error(et());break;case`deploy_misconfigured`:n.error(it());break;case`unauthorized`:n.error(Fe());break;case`not_served`:n.error(mt());break;default:n.error(Re());break}}catch(e){n.error(Be(),e)}finally{i(!1)}}}return(0,Z.jsxs)(`div`,{className:`oc-form`,children:[(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:Qe()}),(0,Z.jsx)(`div`,{className:`flex items-center gap-2`,children:(0,Z.jsx)(R,{size:`sm`,variant:`outline`,onClick:()=>void a(),disabled:r,children:r?ht():yt()})})]})}function Wt({instance:e}){let t=P(m.bridgeAuth.listBridgeAuthStatus,{}),n=M(m.bridgeAuth.mintBridgeSecret),i=r(m.bridgeAuth.revokeBridgeSecret),a=B(),[o,s]=(0,Y.useState)(!1),[c,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 h(){if(!o){s(!0);try{l((await n({instanceId:e._id})).plaintext),d(!1)}catch(e){a.error(L(),e)}finally{s(!1)}}}async function g(){if(!o){s(!0);try{await i({instanceId:e._id}),l(null),a.success(ct())}catch(e){a.error(L(),e)}finally{s(!1)}}}async function _(){if(c)try{await navigator.clipboard.writeText(c),d(!0)}catch{}}return(0,Z.jsxs)($,{label:Ne(),children:[(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:ut()}),(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Z.jsx)(W,{variant:p?`outline`:`secondary`,children:p?`${j()} · ${f.prefix}…${f.lastFour}`:A()}),(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(R,{size:`sm`,onClick:()=>void h(),disabled:o,children:p?Ae():nt()}),p?(0,Z.jsx)(R,{size:`sm`,variant:`destructive`,onClick:()=>void g(),disabled:o,children:We()}):null]})]}),c?(0,Z.jsxs)(`div`,{className:`oc-bridgesecret__reveal`,children:[(0,Z.jsx)(`p`,{className:`oc-sa__minted-warning`,children:ft()}),(0,Z.jsxs)(`div`,{className:`oc-sa__minted-box`,children:[(0,Z.jsx)(`code`,{className:`oc-sa__minted-plain`,children:c}),(0,Z.jsx)(R,{variant:`outline`,size:`sm`,onClick:()=>void _(),children:u?de():O()})]}),(0,Z.jsx)(R,{size:`sm`,variant:`ghost`,onClick:()=>{l(null),d(!1)},children:F()})]}):null]})}function Gt({instanceId:e,field:t,updatedAt:n}){let i=M(m.instanceSecrets.setInstanceSecret),a=r(m.instanceSecrets.clearInstanceSecret),s=M(m.deviceIdentity.generateDeviceIdentity),c=B(),[l,u]=(0,Y.useState)(``),[p,_]=(0,Y.useState)(!1),[v,y]=(0,Y.useState)(null),[b,x]=(0,Y.useState)(!1),S=n!==null,w=t===`deviceIdentity`,T=t===`token`?C():t===`deviceIdentity`?g():se();async function ee(){if(!(!l.trim()||p)){_(!0);try{await i({instanceId:e,field:t,plaintext:l}),u(``),y(null),x(!1),c.success(f())}catch(e){c.error(h(),e)}finally{_(!1)}}}async function te(){if(!p){_(!0);try{await a({instanceId:e,field:t}),y(null),x(!1),c.success(he())}catch(e){c.error(h(),e)}finally{_(!1)}}}async function E(){if(!p){_(!0);try{y(await s({instanceId:e})),x(!1),c.success(me())}catch(e){c.error(je(),e)}finally{_(!1)}}}let D=v?`openclaw devices approve ${v.id}`:``;async function k(){if(D)try{await navigator.clipboard.writeText(D),x(!0)}catch{}}return(0,Z.jsxs)($,{label:T,children:[w?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:d()}):null,(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Z.jsx)(W,{variant:S?`outline`:`secondary`,children:S?j():A()}),(0,Z.jsx)(G,{type:`password`,autoComplete:`off`,className:`flex-1 min-w-32`,value:l,placeholder:S?o():Ge(),onChange:e=>u(e.target.value)}),(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(R,{size:`sm`,onClick:()=>void ee(),disabled:p||l.trim().length===0,children:Je()}),w?(0,Z.jsx)(R,{size:`sm`,variant:`outline`,onClick:()=>void E(),disabled:p,children:_t()}):null,S?(0,Z.jsx)(R,{size:`sm`,variant:`destructive`,onClick:()=>void te(),disabled:p,children:ae()}):null]})]}),v?(0,Z.jsxs)(`div`,{className:`oc-bridgesecret__reveal`,children:[(0,Z.jsx)(`p`,{className:`text-sm font-medium`,children:me()}),(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:vt()}),(0,Z.jsxs)(`div`,{className:`oc-sa__minted-box`,children:[(0,Z.jsx)(`code`,{className:`oc-sa__minted-plain`,children:D}),(0,Z.jsx)(R,{variant:`outline`,size:`sm`,onClick:()=>void k(),children:b?de():O()})]}),(0,Z.jsx)(R,{size:`sm`,variant:`ghost`,onClick:()=>{y(null),x(!1)},children:F()})]}):null]})}var Kt={conversational:ve,documentary:be,summarizer:E,curator:Se},qt={conversational:S,documentary:u,summarizer:y,curator:_e},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:ot()}),t.map(e=>(0,Z.jsx)(W,{variant:`secondary`,className:`oc-agenttype__chip`,title:Yt(e),children:Jt(e)},e)),(0,Z.jsxs)(Tt,{children:[(0,Z.jsx)(Mt,{asChild:!0,children:(0,Z.jsx)(R,{type:`button`,variant:`outline`,size:`sm`,className:`h-7`,children:D()})}),(0,Z.jsxs)(Ot,{align:`start`,className:`oc-agenttypes-pop`,children:[(0,Z.jsx)(`p`,{className:`oc-agenttypes-pop__title`,children:b()}),(0,Z.jsx)(`p`,{className:`oc-agenttypes-pop__hint`,children:Ce()}),(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)(kt,{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 i=P(m.agents.listAgentsForInstance,t&&e?{instanceName:e}:`skip`),o=r(m.agents.setAgentEnabled).withOptimisticUpdate((e,{instanceName:t,agentId:n,enabled:r})=>{let i=e.getQuery(m.agents.listAgentsForInstance,{instanceName:t});i&&e.setQuery(m.agents.listAgentsForInstance,{instanceName:t},{...i,agents:i.agents.map(e=>e.agentId===n?{...e,enabled:r}:e)})}),s=r(m.agents.setInstanceDefaultAgent).withOptimisticUpdate((e,{instanceName:t,agentId:n})=>{let r=e.getQuery(m.agents.listAgentsForInstance,{instanceName:t});r&&e.setQuery(m.agents.listAgentsForInstance,{instanceName:t},{...r,defaultAgentId:n})}),l=r(m.agents.setAgentTypes).withOptimisticUpdate((e,{instanceName:t,agentId:n,types:r})=>{let i=e.getQuery(m.agents.listAgentsForInstance,{instanceName:t});if(!i)return;let a=Rt(r);e.setQuery(m.agents.listAgentsForInstance,{instanceName:t},{...i,agents:i.agents.map(e=>e.agentId===n?{...e,types:a}:e)})}),u=r(m.agents.setAgentDescription).withOptimisticUpdate((e,{instanceName:t,agentId:n,description:r})=>{let i=e.getQuery(m.agents.listAgentsForInstance,{instanceName:t});if(!i)return;let a=r.trim();e.setQuery(m.agents.listAgentsForInstance,{instanceName:t},{...i,agents:i.agents.map(e=>e.agentId===n?{...e,description:a.length===0?null:a}:e)})}),d=r(m.agents.removeInstanceAgent),f=Et(),h=B();async function g(t,n){if(e)try{await o({instanceName:e,agentId:t,enabled:n})}catch(e){h.error(N(),e)}}async function v(t){if(e)try{await s({instanceName:e,agentId:t})}catch(e){h.error(N(),e)}}async function y(t,n,r){if(!e)return;let i=r.includes(n)?r.filter(e=>e!==n):[...r,n];try{await l({instanceName:e,agentId:t,types:i})}catch(e){h.error(N(),e)}}async function b(t,n){if(e&&await f({title:ne({name:n}),description:w(),confirmLabel:_(),destructive:!0}))try{await d({instanceName:e,agentId:t}),h.success(ce())}catch(e){h.error(N(),e)}}return(0,Z.jsx)(jt,{open:t,onOpenChange:n,children:(0,Z.jsxs)(At,{className:`oc-access`,children:[(0,Z.jsxs)(U,{children:[(0,Z.jsx)(Nt,{children:a({name:e??``})}),(0,Z.jsx)(K,{children:ue()})]}),i===void 0?(0,Z.jsx)(`p`,{className:`oc-access__hint`,children:ie()}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`div`,{className:`oc-access__poll`,children:i.discovery===null?re():i.discovery.lastPollOk?qe():c({error:i.discovery.error??`?`})}),i.agents.length===0?(0,Z.jsx)(`p`,{className:`oc-access__hint`,children:Xe()}):(0,Z.jsx)(`div`,{className:`oc-access__list`,children:i.agents.map(t=>{let n=t.presentInLastOk===!1,r=i.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)(kt,{checked:t.enabled,disabled:n,"aria-label":a,onCheckedChange:e=>void g(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)(W,{variant:`outline`,className:`oc-access__gone`,children:p()}),(0,Z.jsx)(R,{size:`sm`,variant:`ghost`,className:`h-7 text-destructive`,onClick:()=>void b(t.agentId,a),children:pe()})]}):r?(0,Z.jsx)(W,{variant:`default`,children:oe()}):(0,Z.jsx)(R,{size:`sm`,variant:`outline`,className:`h-7`,disabled:!t.enabled,onClick:()=>void v(t.agentId),children:St()})]}),t.enabled?(0,Z.jsx)(Xt,{agentId:t.agentId,types:o,onToggle:e=>void y(t.agentId,e,o)}):null,t.enabled?(0,Z.jsx)(Qt,{value:t.description??``,onSave:async n=>{if(e)try{await u({instanceName:e,agentId:t.agentId,description:n})}catch(e){h.error(N(),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)(G,{className:`oc-agentcard__desc`,value:n,maxLength:280,placeholder:Ee(),"aria-label":ee(),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{$P as r,$w as i,E as a,Jw as o,Qw as s,Xw as c,Yw as l,ZP as u,Zw as d,aT as f,as as p,cs as m,ds as h,eF as g,eT as _,fs as v,iT as y,ls as b,nT as x,oT as S,os as C,ps as w,qw as T,rT as E,ss as D,tT as O,us as k}from"./dist-De2K23IB.js";import{t as A}from"./button-Bd43O_sm.js";import{dt as j,ft as M,m as N}from"./index-CNwjY680.js";var P=t(e(),1),F=n();function I(){let e=g(a.integrations.status.status,{}),t=r(a.admin.setIntegrationConfig),[n,u]=(0,P.useState)(null);if((0,P.useEffect)(()=>{e&&n===null&&u(e.config)},[e,n]),!e||!n)return(0,F.jsx)(`p`,{className:`oc-admin__hint`,children:S()});let p=n,m=(e,t,n)=>u({...p,[e]:{...p[e],[t]:n}}),b=(e,n)=>void t({[e]:n});return(0,F.jsxs)(F.Fragment,{children:[(0,F.jsxs)(`p`,{className:`oc-admin__hint`,children:[f(),` `,(0,F.jsx)(`strong`,{children:y()}),` `,E()]}),(0,F.jsxs)(L,{title:`Langfuse`,status:e.langfuse.configured?e.langfuse.enabled?(0,F.jsx)(j,{variant:`secondary`,children:x()}):(0,F.jsx)(j,{variant:`outline`,children:O()}):(0,F.jsx)(j,{variant:`outline`,children:_()}),note:i(),children:[(0,F.jsx)(R,{label:d(),children:(0,F.jsx)(M,{value:p.langfuse.host??``,placeholder:e.langfuse.effectiveHost,onChange:e=>m(`langfuse`,`host`,e.target.value),onBlur:()=>b(`langfuse`,{host:p.langfuse.host??``})})}),(0,F.jsx)(z,{label:T(),checked:p.langfuse.enabled??!0,onChange:e=>{m(`langfuse`,`enabled`,e),b(`langfuse`,{enabled:e})}})]}),(0,F.jsxs)(L,{title:`Opik`,status:e.opik.configured?e.opik.enabled?(0,F.jsx)(j,{variant:`secondary`,children:x()}):(0,F.jsx)(j,{variant:`outline`,children:O()}):(0,F.jsx)(j,{variant:`outline`,children:_()}),note:s(),children:[(0,F.jsx)(R,{label:c(),children:(0,F.jsx)(M,{value:p.opik.baseUrl??``,placeholder:e.opik.effectiveBaseUrl,onChange:e=>m(`opik`,`baseUrl`,e.target.value),onBlur:()=>b(`opik`,{baseUrl:p.opik.baseUrl??``})})}),(0,F.jsx)(R,{label:l(),children:(0,F.jsx)(M,{value:p.opik.workspace??``,placeholder:e.opik.effectiveWorkspace||o(),onChange:e=>m(`opik`,`workspace`,e.target.value),onBlur:()=>b(`opik`,{workspace:p.opik.workspace??``})})}),(0,F.jsx)(z,{label:T(),checked:p.opik.enabled??!0,onChange:e=>{m(`opik`,`enabled`,e),b(`opik`,{enabled:e})}})]}),(0,F.jsxs)(L,{title:`OpenTelemetry (OTLP)`,status:e.otlp.configured?e.otlp.enabled?(0,F.jsx)(j,{variant:`secondary`,children:x()}):(0,F.jsx)(j,{variant:`outline`,children:O()}):(0,F.jsx)(j,{variant:`outline`,children:w()}),note:v(),children:[(0,F.jsx)(R,{label:h(),children:(0,F.jsx)(M,{value:p.otlp.endpoint??``,placeholder:e.otlp.effectiveEndpoint||`https://otlp.example.com/v1/traces`,onChange:e=>m(`otlp`,`endpoint`,e.target.value),onBlur:()=>b(`otlp`,{endpoint:p.otlp.endpoint??``})})}),(0,F.jsx)(B,{headersSet:e.otlp.headersSet}),(0,F.jsx)(z,{label:T(),checked:p.otlp.enabled??!0,onChange:e=>{m(`otlp`,`enabled`,e),b(`otlp`,{enabled:e})}})]})]})}function L({title:e,status:t,note:n,children:r}){return(0,F.jsxs)(`section`,{className:`oc-int__section`,children:[(0,F.jsxs)(`div`,{className:`oc-int__section-head`,children:[(0,F.jsx)(`h3`,{className:`oc-uipa__h`,children:e}),t]}),n?(0,F.jsx)(`p`,{className:`oc-uipa__note`,children:n}):null,(0,F.jsx)(`div`,{className:`oc-int__fields`,children:r})]})}function R({label:e,children:t}){return(0,F.jsxs)(`label`,{className:`oc-int__field`,children:[(0,F.jsx)(`span`,{className:`oc-int__field-label`,children:e}),t]})}function z({label:e,checked:t,onChange:n}){return(0,F.jsxs)(`label`,{className:`oc-int__toggle`,children:[(0,F.jsx)(N,{checked:t,onCheckedChange:e=>n(e===!0)}),(0,F.jsx)(`span`,{children:e})]})}function B({headersSet:e}){let t=u(a.integrations.otlpSecret.setOtlpHeaders),n=r(a.integrations.otlpSecret.clearOtlpHeaders),[i,o]=(0,P.useState)(``),[s,c]=(0,P.useState)(null),[l,d]=(0,P.useState)(!1),f=async()=>{d(!0),c(null);try{await t({headersJson:i}),o(``)}catch(e){c(e instanceof Error?e.message:String(e))}finally{d(!1)}};return(0,F.jsxs)(R,{label:k(),children:[(0,F.jsx)(M,{value:i,placeholder:e?b():m(),onChange:e=>o(e.target.value)}),(0,F.jsxs)(`div`,{className:`oc-int__otlp-headers-actions`,children:[(0,F.jsx)(A,{size:`sm`,disabled:l||i.trim().length===0,onClick:()=>void f(),children:D()}),e?(0,F.jsx)(A,{variant:`ghost`,size:`sm`,disabled:l,onClick:()=>void n({}),children:C()}):null]}),s?(0,F.jsx)(`p`,{className:`oc-int__otlp-headers-error`,children:s}):null,(0,F.jsx)(`p`,{className:`oc-uipa__note`,children:p()})]})}export{I as IntegrationsTab};
@@ -1 +0,0 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$P as r,$k as i,AA as a,AP as o,BP as s,CA as c,CP as l,DA as u,DP as ee,E as d,EA as f,EP as te,Et as p,FA as m,FP as ne,GP as h,IP as re,LP as ie,MA as ae,MP as oe,Mt as se,NA as ce,NP as le,OA as g,OP as _,PA as ue,PP as de,Qk as fe,SA as pe,SP as me,TA as he,TP as ge,XS as v,Xk as y,Zk as b,_A as x,_t as S,aA as C,bA as w,bP as T,cA as E,dA as D,dt as O,eA as k,eF as A,fA as j,ft as M,gA as N,gt as P,hA as F,ht as I,iA as L,jA as _e,jP as ve,jt as ye,kA as be,kP as xe,lA as R,mA as Se,mt as Ce,n as z,nA as we,oA as Te,pA as Ee,pt as De,rA as B,sA as Oe,tA as ke,uA as Ae,vA as je,vt as Me,wA as Ne,wP as V,xA as Pe,xP as Fe,yA as Ie}from"./dist-De2K23IB.js";import{t as H}from"./button-Bd43O_sm.js";import{C as U,Ct as Le,H as Re,S as ze,St as Be,T as Ve,dt as W,ft as G,j as He,m as K,t as Ue,w as We,wt as q,x as Ge,xt as Ke}from"./index-CNwjY680.js";import{t as qe}from"./localePickerView-C2RmOS86.js";var J=t(e(),1),Y=n();function Je({className:e,checked:t,onCheckedChange:n,disabled:r,...i}){return(0,Y.jsx)(`button`,{type:`button`,role:`switch`,"aria-checked":t,"data-state":t?`checked`:`unchecked`,disabled:r,onClick:()=>n(!t),className:z(`peer inline-flex h-5 w-9 shrink-0 items-center rounded-full border border-transparent transition-colors outline-none`,`focus-visible:ring-2 focus-visible:ring-ring/50`,`disabled:cursor-not-allowed disabled:opacity-50`,t?`bg-primary`:`bg-input`,e),...i,children:(0,Y.jsx)(`span`,{className:z(`pointer-events-none block size-4 rounded-full bg-background shadow transition-transform`,t?`translate-x-[18px]`:`translate-x-[2px]`)})})}var X=[{id:`messages`,label:()=>m()},{id:`composer`,label:()=>ue()},{id:`sidebar`,label:()=>ce()},{id:`notifications`,label:()=>N()},{id:`other`,label:()=>ae()}],Z={showSource:{category:`messages`,label:()=>_e(),help:()=>a()},showReport:{category:`messages`,label:()=>be(),help:()=>g()},copyAssistant:{category:`messages`,label:()=>u()},copyUser:{category:`messages`,label:()=>f()},showDelete:{category:`messages`,label:()=>he()},showTools:{category:`messages`,label:()=>Ne(),help:()=>c()},voiceInput:{category:`composer`,label:()=>pe(),help:()=>Pe()},showUsage:{category:`composer`,label:()=>w(),help:()=>Ie()},autoReadAloud:{category:`composer`,label:()=>se(),help:()=>ye()},showChatAge:{category:`sidebar`,label:()=>je(),help:()=>x()},notifSound:{category:`notifications`,label:()=>F(),help:()=>Se()},notifSystem:{category:`notifications`,label:()=>Ee(),help:()=>j()},replySound:{category:`notifications`,label:()=>D(),help:()=>Ae()}};function Q(e){return e.toLowerCase().normalize(`NFD`).replace(/\p{Diacritic}/gu,``)}function Ye(e,t){let n=Q(t.trim()),r=new Map(X.map(e=>[e.id,e.label()])),i=new Map(X.map(e=>[e.id,[]]));for(let t of e){let e=Z[t],a=e?.category??`other`;n&&!Q(`${e?e.label():t} ${e?.help?e.help():``} ${t} ${r.get(a)??``}`).includes(n)||i.get(a).push(t)}return X.map(e=>({id:e.id,label:r.get(e.id),keys:i.get(e.id)})).filter(e=>e.keys.length>0)}var 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:()=>k()};function rt({prefKey:e,ui:t}){let n=r(d.admin.setUiPrefDefault),i=r(d.admin.setFeatureEnabled),a=tt(e),o=a?nt[e]?.():void 0;return(0,Y.jsxs)(`div`,{className:`oc-prefs__gov`,children:[(0,Y.jsxs)(`div`,{className:`oc-prefs__gov-row`,children:[(0,Y.jsx)(`span`,{className:`oc-prefs__gov-label`,children:L()}),(0,Y.jsxs)(Ge,{value:$e(t.defaults[e]),onValueChange:t=>void n({key:e,value:et(t)}),children:[(0,Y.jsx)(We,{size:`sm`,className:`w-36`,children:(0,Y.jsx)(Ve,{})}),(0,Y.jsxs)(ze,{children:[(0,Y.jsx)(U,{value:`on`,children:fe()}),(0,Y.jsx)(U,{value:`off`,children:b()}),(0,Y.jsx)(U,{value:`inherit`,children:y()})]})]}),a?(0,Y.jsxs)(`span`,{className:`oc-prefs__gov-gate`,children:[(0,Y.jsx)(K,{checked:t.featuresEnabled[a]===!0,onCheckedChange:e=>void i({key:a,enabled:e===!0}),"aria-label":B()}),B()]}):null]}),o?(0,Y.jsx)(`span`,{className:`oc-prefs__gov-help`,children:o}):null]})}function it({current:e,enabled:t}){let n=r(d.me.setDictationShortcut),[i,a]=(0,J.useState)(!1),[o,s]=(0,J.useState)(!1);return(0,J.useEffect)(()=>{if(!i)return;let e=e=>{if(e.preventDefault(),e.stopPropagation(),e.key===`Escape`){a(!1);return}let t=Be(e);if(t===null){[`Shift`,`Control`,`Meta`,`Alt`].includes(e.key)||(s(!0),window.setTimeout(()=>s(!1),1800));return}a(!1),n({shortcut:t})};return window.addEventListener(`keydown`,e,!0),()=>window.removeEventListener(`keydown`,e,!0)},[i,n]),(0,Y.jsxs)(`div`,{className:`oc-prefs__row${t?``:` is-locked`}`,children:[(0,Y.jsxs)(`div`,{className:`oc-prefs__info`,children:[(0,Y.jsxs)(`span`,{className:`oc-prefs__label`,children:[Me(),e?(0,Y.jsx)(W,{variant:`secondary`,children:Le(e,Ke())}):null]}),(0,Y.jsx)(`span`,{className:`oc-prefs__help`,children:o?I():i?P():S()})]}),(0,Y.jsxs)(`div`,{className:`oc-prefs__ctl`,children:[e&&!i?(0,Y.jsx)(`button`,{type:`button`,className:`oc-prefs__reset`,onClick:()=>void n({shortcut:null}),children:O()}):null,(0,Y.jsx)(`button`,{type:`button`,className:`oc-prefs__reset`,disabled:!t,"aria-pressed":i,onClick:()=>a(e=>!e),children:i?M():e?De():Ce()})]})]})}function at(){let[e,t]=(0,J.useState)(``),[n,a]=(0,J.useState)(!1),o=A(d.me.getMe,{host:q}),s=o?.ui,c=$(o?.role)&&n,l=r(d.me.setUiPref).withOptimisticUpdate(He),u=(0,J.useMemo)(()=>s?Ye(Object.keys(s.effective),e):[],[s,e]);return s?(0,Y.jsxs)(`div`,{className:`oc-prefs-panel`,children:[$(o?.role)?(0,Y.jsxs)(`label`,{className:`oc-prefs__gov-toggle`,children:[(0,Y.jsx)(K,{checked:n,onCheckedChange:e=>a(e===!0),"aria-label":C()}),C()]}):null,c?(0,Y.jsxs)(`div`,{className:`oc-prefs__gov-head`,children:[(0,Y.jsx)(`p`,{children:we()}),(0,Y.jsx)(`p`,{children:ke()}),(0,Y.jsx)(`p`,{children:i()})]}):null,(0,Y.jsx)(G,{value:e,onChange:e=>t(e.target.value),placeholder:R(),"aria-label":R(),className:`mb-2`}),u.length===0?(0,Y.jsx)(`div`,{className:`oc-prefs__empty`,children:E()}):(0,Y.jsx)(`div`,{className:`oc-prefs`,children:u.map(e=>(0,Y.jsxs)(`section`,{className:`oc-prefs__card`,children:[(0,Y.jsx)(`h4`,{className:`oc-prefs__cat`,children:e.label}),e.keys.map(e=>{let t=Z[e],n=t?t.label():e,r=t?.help?.(),i=s.locked[e],a=s.effective[e],o=s.userOverrides[e]!==void 0;return(0,Y.jsxs)(`div`,{className:`oc-prefs__row${i?` is-locked`:``}`,children:[(0,Y.jsxs)(`div`,{className:`oc-prefs__info`,children:[(0,Y.jsxs)(`span`,{className:`oc-prefs__label`,children:[n,i?(0,Y.jsx)(W,{variant:`outline`,children:Oe()}):o?(0,Y.jsx)(W,{variant:`secondary`,children:p()}):null]}),r?(0,Y.jsx)(`span`,{className:`oc-prefs__help`,children:r}):null]}),(0,Y.jsxs)(`div`,{className:`oc-prefs__ctl`,children:[!i&&o?(0,Y.jsx)(`button`,{type:`button`,className:`oc-prefs__reset`,onClick:()=>void l({key:e,value:null}),children:Te()}):null,(0,Y.jsx)(Je,{checked:a,disabled:i,onCheckedChange:t=>{e===`notifSystem`&&t&&typeof Notification<`u`&&Notification.permission==="default"&&Notification.requestPermission(),l({key:e,value:t})},"aria-label":n})]}),c?(0,Y.jsx)(rt,{prefKey:e,ui:s}):null]},e)})]},e.id))}),(0,Y.jsx)(it,{current:o?.dictationShortcut??null,enabled:s.effective.voiceInput===!0})]}):(0,Y.jsx)(`div`,{className:`oc-prefs__empty`,children:h()})}var ot={sm:()=>ge(),md:()=>V(),lg:()=>l(),xl:()=>me()};function st(){let e=A(d.me.getMe,{host:q}),t=r(d.me.setLocale),n=r(d.me.setFontScale).withOptimisticUpdate((e,{scale:t})=>{let n=e.getQuery(d.me.getMe,{host:q});n&&e.setQuery(d.me.getMe,{host:q},{...n,fontScale:t,resolvedFontScale:t??`md`})}),i=r(d.me.setMyName),a=Re(),c=e?.locale??`default`,l=e?.name??``,[u,f]=(0,J.useState)(null),p=u??l,m=p.trim()!==l.trim();async function h(){try{await i({name:p}),f(null),a.success(le())}catch(e){a.error(oe(),e)}}return(0,Y.jsxs)(`div`,{className:`oc-appearance`,children:[(0,Y.jsxs)(`section`,{className:`oc-show__section`,children:[(0,Y.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,Y.jsx)(`h2`,{className:`oc-show__title`,children:ie()}),(0,Y.jsx)(`p`,{className:`oc-show__desc`,children:re()})]}),(0,Y.jsxs)(`div`,{className:`oc-show__row`,children:[(0,Y.jsx)(G,{className:`max-w-xs`,value:p,maxLength:120,placeholder:ne(),onChange:e=>f(e.target.value),onKeyDown:e=>{e.key===`Enter`&&m&&(e.preventDefault(),h())}}),(0,Y.jsx)(H,{size:`sm`,disabled:!m,onClick:()=>void h(),children:v()})]}),(0,Y.jsx)(`p`,{className:`oc-show__desc`,children:de()})]}),(0,Y.jsxs)(`section`,{className:`oc-show__section`,children:[(0,Y.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,Y.jsx)(`h2`,{className:`oc-show__title`,children:ve()}),(0,Y.jsx)(`p`,{className:`oc-show__desc`,children:o()})]}),(0,Y.jsxs)(`div`,{className:`oc-show__row`,children:[qe().map(e=>(0,Y.jsx)(H,{variant:c===e.value?`default`:`outline`,size:`sm`,onClick:()=>void t({locale:e.value}),children:e.label},e.value)),(0,Y.jsx)(H,{variant:c==="default"?`default`:`outline`,size:`sm`,onClick:()=>void t({locale:null}),children:s()})]}),(0,Y.jsx)(`p`,{className:`oc-show__desc`,children:xe()})]}),(0,Y.jsxs)(`section`,{className:`oc-show__section`,children:[(0,Y.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,Y.jsx)(`h2`,{className:`oc-show__title`,children:_()}),(0,Y.jsx)(`p`,{className:`oc-show__desc`,children:ee()})]}),(0,Y.jsx)(`div`,{className:`oc-show__row`,children:Ue.map(t=>(0,Y.jsx)(H,{variant:(e?.fontScale??`md`)===t?`default`:`outline`,size:`sm`,onClick:()=>void n({scale:t}),children:ot[t]()},t))}),(0,Y.jsx)(`p`,{className:`oc-show__desc`,children:te()})]}),(0,Y.jsxs)(`section`,{className:`oc-show__section`,children:[(0,Y.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,Y.jsx)(`h2`,{className:`oc-show__title`,children:Fe()}),(0,Y.jsx)(`p`,{className:`oc-show__desc`,children:T()})]}),(0,Y.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{$P as r,$g as i,C_ as a,E as o,Ja as s,Mn as c,Nn as l,Pn as u,Qg as d,S_ as f,Xa as p,Xg as m,Ya as h,Za as g,Zg as _,a_ as v,c_ as y,ci as b,d_ as x,di as S,eF as C,e_ as w,f_ as T,fi as E,h_ as D,i_ as O,l_ as ee,li as k,m_ as te,n_ as ne,o_ as re,p_ as ie,pi as ae,qa as A,r_ as j,s_ as M,t_ as N,u_ as P,ui as F}from"./dist-De2K23IB.js";import{d as I,f as L,i as R,l as z,n as B,r as V,t as H,u as U}from"./FieldLabel-hLNtge_D.js";import{t as W}from"./button-Bd43O_sm.js";import{C as G,H as K,S as q,T as J,m as oe,w as Y,wt as se,x as X}from"./index-CNwjY680.js";import{r as Z,t as ce}from"./locales-CPjguROj.js";import{t as le}from"./localePickerView-C2RmOS86.js";/* empty css */var Q=t(e(),1),$=n(),ue={media_delivery:{label:P,help:ee},documentary_fetch:{label:y,help:M},inbound_files:{label:re,help:v},history_summary:{label:g,help:p},file_curation:{label:ae,help:E}},de={outboundDir:`/home/node/.openclaw/media/outbound`,references:`- gdrive/1a2b3c4d5e6f7890abcd
2
- - gdrive/0f9e8d7c6b5a4321dcba`,files:`- /home/node/.openclaw/media/inbound/rapport.pdf (124800 o, application/pdf)`,previous_summary:`Projet Alpha : budget 40 000 EUR ; choix du serveur en cours.`,new_messages:`Utilisateur : Compare OVH et Scaleway.
3
- Assistant : Comparaison en cours.`,max_chars:`6000`,file_name:`MEMORY.md`,budget_chars:`20000`,feedback:`Trop de suppressions dans la section des liens, garde-les.`,content:`# Memory index
4
- - [Fait 1](fait-1.md) - note du projet`},fe={outboundDir:d,references:_,files:m,previous_summary:h,new_messages:s,max_chars:A,file_name:S,budget_chars:F,feedback:k,content:b};function pe(){let e=C(o.admin.listInstances,{}),[t,n]=(0,Q.useState)(null);if(e===void 0)return(0,$.jsx)(`div`,{className:`oc-settings__tab-loading`,"aria-busy":`true`});if(e.length===0)return(0,$.jsx)(`div`,{className:`oc-injtab`,children:(0,$.jsx)(`p`,{className:`oc-admin__hint`,children:j()})});let r=e.find(e=>e._id===t)??e[0];return(0,$.jsxs)(`div`,{className:`oc-injtab`,children:[(0,$.jsxs)(`div`,{className:`oc-injtab__head`,children:[(0,$.jsx)(B,{label:D(),help:te()}),(0,$.jsxs)(`label`,{className:`oc-injtab__picker`,children:[(0,$.jsx)(`span`,{children:O()}),(0,$.jsxs)(X,{value:r._id,onValueChange:e=>n(e),children:[(0,$.jsx)(Y,{size:`sm`,className:`min-w-44`,children:(0,$.jsx)(J,{})}),(0,$.jsx)(q,{children:e.map(e=>(0,$.jsx)(G,{value:e._id,children:e.displayName??e.name},e._id))})]})]})]}),(0,$.jsx)(me,{instance:r},r._id)]})}function me({instance:e}){let t=r(o.admin.upsertInstanceConfig),n=K(),i=C(o.me.getMe,{host:se}),s=e.config??{},d=Z(e.config?.contentLocale,i?.defaultLocale??void 0),[p,m]=(0,Q.useState)(()=>R(s,d));(0,Q.useEffect)(()=>{m(R(s,d))},[d,e._id]);let[h,g]=(0,Q.useState)(!1),_=p.promptInjections,v=(e,t)=>m({...p,promptInjections:{..._,[e]:{..._[e],...t}}});async function y(){g(!0);try{await t({instanceId:e._id,config:V(p,s,d)})}catch(e){n.error(f(),e)}finally{g(!1)}}async function b(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(f(),e)}}let x=e.config?.contentLocale??`default`,S=ce[Z(void 0,i?.defaultLocale??void 0)];return(0,$.jsxs)(`div`,{className:`oc-injtab__body`,children:[(0,$.jsxs)(`div`,{className:`oc-injtab__content-locale`,children:[(0,$.jsx)(`span`,{children:u()}),(0,$.jsxs)(X,{value:x,onValueChange:e=>void b(e),children:[(0,$.jsx)(Y,{size:`sm`,className:`min-w-44`,children:(0,$.jsx)(J,{})}),(0,$.jsxs)(q,{children:[(0,$.jsx)(G,{value:`default`,children:c({locale:S})}),le().map(e=>(0,$.jsx)(G,{value:e.value,children:e.label},e.value))]})]}),(0,$.jsx)(`p`,{className:`oc-admin__hint`,children:l()})]}),U.map(e=>(0,$.jsx)(he,{injKey:e,def:z[e],i18n:ue[e],row:_[e]??{enabled:!0,template:z[e].defaultTemplate[d]},contentLocale:d,onChange:t=>v(e,t)},e)),(0,$.jsx)(`div`,{className:`oc-injtab__actions`,children:(0,$.jsx)(W,{size:`sm`,onClick:()=>void y(),disabled:h,children:a()})})]})}function he({injKey:e,def:t,i18n:n,row:r,contentLocale:a,onChange:o}){let[s,c]=(0,Q.useState)(!1),l=r.template.trim()!==t.defaultTemplate[a],u=t.togglable&&!r.enabled,d=Object.fromEntries(t.placeholders.map(e=>[e,de[e]??`{${e}}`])),f=I(e,r,a),p=f?L(f,d):``;return(0,$.jsxs)(`section`,{className:`oc-injcard`,children:[(0,$.jsxs)(`div`,{className:`oc-injcard__head`,children:[t.togglable?(0,$.jsxs)(`label`,{className:`oc-field--row`,children:[(0,$.jsx)(oe,{checked:r.enabled,onCheckedChange:e=>o({enabled:e===!0})}),(0,$.jsx)(B,{label:n.label(),help:n.help()})]}):(0,$.jsx)(B,{label:n.label(),help:n.help()}),l&&(0,$.jsx)(`span`,{className:`oc-injection__badge`,children:T()})]}),(0,$.jsx)(`textarea`,{className:`oc-injcard__text`,value:r.template,disabled:u,rows:8,spellCheck:!1,onChange:e=>o({template:e.target.value})}),(0,$.jsxs)(`div`,{className:`oc-injection__foot`,children:[(0,$.jsxs)(`div`,{className:`oc-injcard__phs`,children:[(0,$.jsx)(`span`,{className:`oc-injection__ph`,children:x()}),t.placeholders.map(e=>(0,$.jsxs)(`span`,{className:`oc-injcard__ph-chip`,children:[(0,$.jsx)(`code`,{children:`{${e}}`}),(0,$.jsx)(H,{text:(fe[e]??(()=>e))()})]},e))]}),(0,$.jsxs)(`div`,{className:`oc-injcard__btns`,children:[(0,$.jsx)(W,{variant:`ghost`,size:`sm`,onClick:()=>c(e=>!e),children:s?N():ne()}),l&&(0,$.jsx)(W,{variant:`ghost`,size:`sm`,onClick:()=>o({template:t.defaultTemplate[a]}),children:ie()})]})]}),s&&(0,$.jsx)(`div`,{className:`oc-injcard__preview`,children:p?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`pre`,{className:`oc-injcard__previewtext`,children:p}),(0,$.jsx)(`span`,{className:`oc-injection__ph`,children:w()})]}):(0,$.jsx)(`span`,{className:`oc-injection__ph`,children:i()})})]})}export{pe as PromptInjectionsTab};
@@ -1 +0,0 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$P as r,$b as i,Ab as a,Bb as o,Cb as s,Db as c,E as l,Eb as u,Gb as d,Hb as f,Ib as p,Jb as m,Kb as h,Lb as g,Li as _,Ob as v,Qb as y,Rb as b,Sb as x,Tb as S,Ub as ee,Vb as te,Wb as ne,Xb as re,Yb as ie,Zb as C,ax as w,cx as T,dx as E,eF as D,ex as O,ix as k,kb as A,lx as j,nx as M,ox as N,qb as P,rx as F,sx as I,tx as L,ux as R,wb as ae,zb as z}from"./dist-De2K23IB.js";import{t as B}from"./button-Bd43O_sm.js";import{Gt as V,H,U,d as W,dt as G,ft as K,m as q}from"./index-CNwjY680.js";import{t as J}from"./roleDescriptions-zLFA4zEm.js";var Y=t(e(),1),X=n(),Z=[{group:()=>E(),keys:[{key:`traces.read`,label:()=>N()},{key:`traces.read.content`,label:()=>w(),phi:!0},{key:`traces.write`,label:()=>k()}]},{group:()=>R(),keys:[{key:`kpi.read`,label:()=>N()},{key:`kpi.write`,label:()=>k()}]},{group:()=>j(),keys:[{key:`openclaw.query`,label:()=>F()},{key:`anomalies.read`,label:()=>M()},{key:`anomalies.report`,label:()=>L()}]},{group:()=>T(),keys:[{key:`chats.read`,label:()=>N()},{key:`selfheal`,label:()=>i()},{key:`feedback.respond`,label:()=>_()}]},{group:()=>I(),keys:[{key:`admin.manage`,label:()=>O()}]}],oe=Z.flatMap(e=>e.keys.map(e=>e.key));function Q(e){return e.includes(`*`)}var $={key:``,name:``,description:``};function se(){let e=D(l.apiKeys.listRoles,{}),t=r(l.apiKeys.createRole),n=r(l.apiKeys.ensureRolesSeeded),i=r(l.apiKeys.updateRolePermissions).withOptimisticUpdate((e,{roleId:t,permissions:n})=>{let r=e.getQuery(l.apiKeys.listRoles,{});r&&e.setQuery(l.apiKeys.listRoles,{},r.map(e=>e._id===t?{...e,permissions:n}:e))}),_=U(),w=H(),[T,E]=(0,Y.useState)(!1),[O,k]=(0,Y.useState)($),[j,M]=(0,Y.useState)(new Set);(0,Y.useEffect)(()=>{n({}).catch(e=>{w.error(C(),e)})},[n,w]);let N=e??[];async function F(e,t){if(Q(e.permissions))return;if(e.builtin){await _({title:re({name:e.name}),description:ie(),confirmLabel:m()});return}if(j.has(e._id))return;let n=e.permissions.includes(t)?e.permissions.filter(e=>e!==t):[...e.permissions,t];M(t=>new Set(t).add(e._id));try{await i({roleId:e._id,permissions:n})}catch(e){w.error(P(),e)}finally{M(t=>{let n=new Set(t);return n.delete(e._id),n})}}async function I(){try{await t({key:O.key,name:O.name,description:O.description||void 0,permissions:[]}),k($),E(!1)}catch(e){w.error(h(),e)}}let L=e===void 0,R=!L&&N.length===0;return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`p`,{className:`oc-admin__hint`,children:[d(),` `,(0,X.jsx)(`code`,{children:`admin`}),` `,ne(),` `,(0,X.jsx)(`code`,{children:`traces.read.content`}),` `,ee()]}),(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:f()}),(0,X.jsx)(`div`,{className:`oc-dt__bar-actions`,children:(0,X.jsx)(B,{size:`sm`,onClick:()=>{k($),E(!0)},children:te()})})]}),L?(0,X.jsx)(`p`,{className:`oc-admin__hint`,children:o()}):R?(0,X.jsx)(`p`,{className:`oc-admin__hint`,children:z()}):(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:b()}),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?y({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:N.map(e=>{let t=Q(e.permissions),n=j.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)(G,{variant:`outline`,className:`gap-1`,children:[(0,X.jsx)(V,{}),` `,g()]}):(0,X.jsx)(G,{variant:`secondary`,children:p()})]}),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)(q,{checked:t||e.permissions.includes(r),disabled:t||n,"aria-label":`${e.key} · ${r}`,title:t?a():n?A():r,onCheckedChange:()=>void F(e,r)})},r))]},e.key)})})]})})]}),(0,X.jsx)(W,{open:T,onOpenChange:E,title:v(),description:c(),canSubmit:!!(O.key&&O.name),onSubmit:I,submitLabel:u(),children:(0,X.jsxs)(`div`,{className:`oc-form`,children:[(0,X.jsxs)(`label`,{className:`oc-field`,children:[(0,X.jsx)(`span`,{className:`oc-field__label`,children:S()}),(0,X.jsx)(K,{value:O.key,placeholder:ae(),onChange:e=>k({...O,key:e.target.value})})]}),(0,X.jsxs)(`label`,{className:`oc-field`,children:[(0,X.jsx)(`span`,{className:`oc-field__label`,children:s()}),(0,X.jsx)(K,{value:O.name,onChange:e=>k({...O,name:e.target.value})})]}),(0,X.jsxs)(`label`,{className:`oc-field`,children:[(0,X.jsx)(`span`,{className:`oc-field__label`,children:x()}),(0,X.jsx)(K,{value:O.description,onChange:e=>k({...O,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{AM as r,AN as i,CM as a,CN as o,D as s,DM as c,DN as l,E as u,EM as ee,EN as te,FN as ne,GM as d,GP as f,HM as re,JM as ie,KM as ae,MN as oe,NN as p,OM as se,ON as ce,PN as le,QM as m,SM as ue,SN as de,TM as fe,TN as pe,VM as me,WM as he,XM as ge,YM as _e,ZM as ve,ZP as h,_M as ye,bM as be,cM as xe,eN as Se,gM as Ce,hM as we,iN as Te,jM as Ee,jN as De,kM as g,kN as Oe,mM as ke,nN as _,qM as Ae,qP as je,rN as v,tN as y,vM as Me,wM as Ne,wN as Pe,xM as Fe,xN as Ie,yM as Le}from"./dist-De2K23IB.js";import{t as b}from"./button-Bd43O_sm.js";import{B as Re,C as x,Ft as ze,G as Be,H as Ve,Ht as He,J as Ue,K as We,Kt as Ge,Mt as Ke,Q as qe,S as Je,T as Ye,Ut as Xe,V as Ze,Vt as Qe,X as $e,Y as et,Z as tt,_t as nt,dt as S,ft as C,gt as rt,ht as it,mt as at,pt as w,q as ot,vt as T,w as E,x as D,zt as st}from"./index-CNwjY680.js";import{a as ct,i as O,n as lt,o as k,r as A,t as ut}from"./table-BRilRxUj.js";var dt=s(`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`}]]),j=t(e(),1),M=n(),N={minutes:6e4,hours:36e5,days:864e5};function P(e){return e?.data?.code??`unknown`}function F(){let e=h(u.scheduled.listMyCrons),t=h(u.scheduled.getCronDetail),n=h(u.scheduled.listCronRuns),s=h(u.scheduled.updateCron),F=h(u.scheduled.removeCron),ft=h(u.scheduled.runCronNow),I=Ve(),[L,pt]=(0,j.useState)(null),[R,z]=(0,j.useState)(!1),[B,V]=(0,j.useState)(!1),[H,mt]=(0,j.useState)(null),[U,W]=(0,j.useState)(null),[G,K]=(0,j.useState)(null),[q,J]=(0,j.useState)(null),[ht,gt]=(0,j.useState)(!1),Y=(0,j.useCallback)(async()=>{z(!0),V(!1);try{pt(await e({}))}catch{V(!0)}finally{z(!1)}},[e]);(0,j.useEffect)(()=>{Y()},[Y]);let _t=(0,j.useMemo)(()=>new URLSearchParams(window.location.search).get(`job`),[]),X=(0,j.useRef)(null);(0,j.useEffect)(()=>{L!==null&&X.current!==null&&X.current.scrollIntoView({block:`center`})},[L]);let vt=(0,j.useMemo)(()=>new Intl.DateTimeFormat(je(),{dateStyle:`medium`,timeStyle:`short`}),[]),Z=async(e,t,n)=>{mt(e);try{await t(),I.success(n),await Y()}catch(e){I.toast({variant:`error`,title:m({code:P(e)})})}finally{mt(null)}},Q=(0,j.useRef)(0),$=(0,j.useRef)(0),yt=async(e,t)=>{if(t.id===null)return;let r=++Q.current;K({name:t.name??t.id,entries:null});try{let i=await n({instanceName:e,jobId:t.id,limit:20});if(r!==Q.current)return;K({name:t.name??t.id,entries:i})}catch(e){if(r!==Q.current)return;K(null),I.toast({variant:`error`,title:m({code:P(e)})})}},bt=async(e,n)=>{if(n.id===null)return;let r=++$.current;J({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%N.days===0?(s=String(e/N.days),c=`days`):e%N.hours===0?(s=String(e/N.hours),c=`hours`):(s=String(Math.max(1,Math.round(e/N.minutes))),c=`minutes`))}if(r!==$.current)return;J(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;J(null),I.toast({variant:`error`,title:m({code:P(e)})})}},xt=async()=>{if(q===null)return;let e={};if(q.nameDirty&&q.name.trim()===``||q.messageDirty&&q.hasMessage&&q.message.trim()===``){I.toast({variant:`error`,title:ke()});return}if(q.nameDirty&&q.name.trim()!==``&&(e.name=q.name.trim()),q.scheduleDirty){if(q.scheduleKind===`cron`&&q.cronExpr.trim()!==``)e.schedule={kind:`cron`,expr:q.cronExpr.trim(),...q.tz.trim()===``?{}:{tz:q.tz.trim()}};else if(q.scheduleKind===`every`){let t=Number(q.everyValue);Number.isFinite(t)&&t>=1&&(e.schedule={kind:`every`,everyMs:Math.round(t*N[q.everyUnit])})}else if(q.scheduleKind===`at`&&q.at!==``){let t=Date.parse(q.at);Number.isFinite(t)&&(e.schedule={kind:`at`,at:new Date(t).toISOString()})}}if(q.scheduleDirty&&e.schedule===void 0){I.toast({variant:`error`,title:we()});return}if(q.messageDirty&&q.hasMessage&&q.message.trim()!==``&&(e.message=q.message.trim()),Object.keys(e).length===0){J(null);return}let t=$.current;gt(!0);try{await s({instanceName:q.instanceName,jobId:q.jobId,patch:e}),I.success(se()),t===$.current&&J(null),await Y()}catch(e){I.toast({variant:`error`,title:m({code:P(e)})})}finally{gt(!1)}},St=L?.reduce((e,t)=>e+t.jobs.length,0)??0;return(0,M.jsxs)(M.Fragment,{children:[(0,M.jsxs)(`div`,{style:{display:`flex`,alignItems:`flex-start`,gap:8,marginBottom:12},children:[(0,M.jsx)(`p`,{className:`oc-admin__hint`,style:{flex:1,margin:0},children:ne()}),(0,M.jsxs)(b,{variant:`ghost`,size:`sm`,onClick:()=>void Y(),disabled:R,style:{display:`inline-flex`,alignItems:`center`,gap:4},children:[(0,M.jsx)(st,{size:14,"aria-hidden":!0}),le()]})]}),L===null?(0,M.jsx)(`p`,{className:`oc-admin__hint`,"aria-busy":R,children:B?p():f()}):(0,M.jsxs)(M.Fragment,{children:[B?(0,M.jsx)(`p`,{className:`oc-admin__hint`,children:p()}):null,L.length===0?(0,M.jsx)(`p`,{className:`oc-admin__hint`,children:oe()}):null,L.map(e=>(0,M.jsxs)(`section`,{style:{marginBottom:20},children:[L.length>1||e.error||!e.supported?(0,M.jsxs)(`h3`,{style:{display:`flex`,alignItems:`center`,gap:8,fontSize:`0.85rem`,fontWeight:600,margin:`0 0 6px`},children:[e.instanceName,(0,M.jsx)(S,{variant:`outline`,children:e.kind})]}):null,e.supported?e.error?(0,M.jsx)(`p`,{className:`oc-admin__hint`,children:i({code:e.error})}):e.jobs.length===0?(0,M.jsx)(`p`,{className:`oc-admin__hint`,children:Oe()}):(0,M.jsxs)(ut,{children:[(0,M.jsx)(ct,{children:(0,M.jsxs)(k,{children:[(0,M.jsx)(O,{children:ce()}),(0,M.jsx)(O,{children:l()}),(0,M.jsx)(O,{children:te()}),(0,M.jsx)(O,{children:pe()}),(0,M.jsx)(O,{children:Pe()}),(0,M.jsx)(O,{children:Ee()})]})}),(0,M.jsx)(lt,{children:e.jobs.map((t,n)=>{let i=`${e.instanceName}:${t.id??n}`,a=H===i,c=e.manageSupported,l=e.kind===`openclaw`&&c;return(0,M.jsxs)(k,{ref:t.id!==null&&t.id===_t?X:void 0,"data-state":t.id!==null&&t.id===_t?`selected`:void 0,children:[(0,M.jsx)(A,{className:`font-medium`,style:{maxWidth:280,overflow:`hidden`,textOverflow:`ellipsis`},title:t.name??void 0,children:t.name??o()}),(0,M.jsx)(A,{children:(0,M.jsx)(S,{variant:`secondary`,children:t.agentId})}),(0,M.jsxs)(A,{className:`whitespace-nowrap`,children:[(0,M.jsx)(`span`,{style:{fontFamily:`var(--font-mono, monospace)`},children:t.schedule??`—`}),(()=>{let e=Re(t.schedule),n=e===null?null:Ze(e);return n===null?null:(0,M.jsx)(`span`,{className:`text-muted-foreground`,style:{display:`block`,fontSize:`0.78rem`},children:n})})()]}),(0,M.jsx)(A,{className:`whitespace-nowrap text-muted-foreground`,children:t.nextRunAtMs===null?`—`:vt.format(t.nextRunAtMs)}),(0,M.jsxs)(A,{children:[t.enabled===!0?(0,M.jsx)(S,{variant:`secondary`,children:Ie()}):t.enabled===!1?(0,M.jsx)(S,{variant:`outline`,children:de()}):(0,M.jsx)(`span`,{className:`text-muted-foreground`,children:`—`}),t.lastRunStatus?(0,M.jsx)(`span`,{className:`text-muted-foreground`,style:{marginLeft:8,fontSize:`0.8rem`},children:t.lastRunStatus}):null]}),(0,M.jsx)(A,{className:`whitespace-nowrap`,children:t.id===null?(0,M.jsx)(`span`,{className:`text-muted-foreground`,children:`—`}):a?(0,M.jsx)(Ge,{size:14,className:`oc-actrow__spin`,"aria-hidden":!0}):(0,M.jsxs)(`span`,{style:{display:`inline-flex`,gap:2},children:[l?(0,M.jsx)(b,{variant:`ghost`,size:`icon-sm`,title:v(),"aria-label":v(),disabled:H!==null,onClick:()=>void Z(i,async()=>{let n=await ft({instanceName:e.instanceName,jobId:t.id});if(n.ran!==!0&&n.runId===null)throw{data:{code:n.reason??`run_not_started`}}},ve()),children:(0,M.jsx)(Ke,{size:14,"aria-hidden":!0})}):null,l&&t.enabled!==null?(0,M.jsx)(b,{variant:`ghost`,size:`icon-sm`,title:t.enabled?_():y(),"aria-label":t.enabled?_():y(),disabled:H!==null,onClick:()=>void Z(i,()=>s({instanceName:e.instanceName,jobId:t.id,patch:{enabled:!t.enabled}}),t.enabled?ge():_e()),children:t.enabled?(0,M.jsx)(Xe,{size:14,"aria-hidden":!0}):(0,M.jsx)(Qe,{size:14,"aria-hidden":!0})}):null,l?(0,M.jsx)(b,{variant:`ghost`,size:`icon-sm`,title:r(),"aria-label":r(),disabled:H!==null,onClick:()=>void bt(e.instanceName,t),children:(0,M.jsx)(He,{size:14,"aria-hidden":!0})}):null,l?(0,M.jsx)(b,{variant:`ghost`,size:`icon-sm`,title:g(),"aria-label":g(),disabled:H!==null,onClick:()=>void yt(e.instanceName,t),children:(0,M.jsx)(dt,{size:14,"aria-hidden":!0})}):null,c?(0,M.jsx)(b,{variant:`ghost`,size:`icon-sm`,title:Se(),"aria-label":Se(),disabled:H!==null,onClick:()=>W({instanceName:e.instanceName,jobId:t.id,name:t.name??t.id}),children:(0,M.jsx)(ze,{size:14,"aria-hidden":!0})}):null]})})]},t.id??`${e.instanceName}-${n}`)})})]}):(0,M.jsx)(`p`,{className:`oc-admin__hint`,children:De()})]},e.instanceName)),St>0?(0,M.jsx)(`p`,{className:`oc-admin__hint`,style:{marginTop:4},children:xe()}):null]}),(0,M.jsx)(Be,{open:U!==null,onOpenChange:e=>{e||W(null)},children:(0,M.jsxs)(Ue,{children:[(0,M.jsxs)(tt,{children:[(0,M.jsx)(qe,{children:Ae()}),(0,M.jsx)(et,{children:ae({name:U?.name??``})})]}),(0,M.jsxs)($e,{children:[(0,M.jsx)(ot,{children:d()}),(0,M.jsx)(We,{onClick:()=>{let e=U;W(null),e!==null&&Z(`${e.instanceName}:${e.jobId}`,()=>F({instanceName:e.instanceName,jobId:e.jobId}),ie())},children:he()})]})]})}),(0,M.jsx)(w,{open:G!==null,onOpenChange:e=>{e||(Q.current++,K(null))},children:(0,M.jsxs)(at,{style:{maxWidth:640},children:[(0,M.jsx)(nt,{children:(0,M.jsx)(T,{children:c({name:G?.name??``})})}),G?.entries===null?(0,M.jsx)(`p`,{className:`oc-admin__hint`,children:f()}):G!==null&&G.entries.length===0?(0,M.jsx)(`p`,{className:`oc-admin__hint`,children:ee()}):G===null?null:(0,M.jsx)(`div`,{className:`oc-cronpanel__runs`,style:{maxHeight:420,overflowY:`auto`},children:G.entries.map((e,t)=>(0,M.jsxs)(`div`,{className:`oc-cronpanel__run`,children:[(0,M.jsxs)(`div`,{className:`oc-cronpanel__run-head`,children:[e.status===`ok`?(0,M.jsx)(S,{variant:`secondary`,children:re()}):e.status===`error`?(0,M.jsx)(S,{variant:`destructive`,children:me()}):(0,M.jsx)(S,{variant:`outline`,children:e.status??`—`}),(0,M.jsx)(`span`,{children:typeof(e.runAtMs??e.ts)==`number`?vt.format(e.runAtMs??e.ts):`—`}),typeof e.durationMs==`number`?(0,M.jsxs)(`span`,{className:`oc-cronpanel__run-dur`,children:[Math.round(e.durationMs/1e3),`s`]}):null]}),e.summary===null?null:(0,M.jsx)(`div`,{className:`oc-cronpanel__run-summary`,children:e.summary}),e.error===null?null:(0,M.jsx)(`div`,{className:`oc-cronpanel__run-error`,children:e.error})]},t))})]})}),(0,M.jsx)(w,{open:q!==null,onOpenChange:e=>{e||($.current++,J(null))},children:(0,M.jsxs)(at,{children:[(0,M.jsxs)(nt,{children:[(0,M.jsx)(T,{children:fe()}),(0,M.jsx)(it,{children:Ne()})]}),q===null?null:q.loading?(0,M.jsx)(`p`,{className:`oc-admin__hint`,children:f()}):(0,M.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:12},children:[(0,M.jsxs)(`label`,{style:{display:`flex`,flexDirection:`column`,gap:4},children:[(0,M.jsx)(`span`,{className:`oc-admin__hint`,style:{margin:0},children:ce()}),(0,M.jsx)(C,{value:q.name,maxLength:200,onChange:e=>J({...q,name:e.target.value,nameDirty:!0})})]}),(0,M.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:4},children:[(0,M.jsx)(`span`,{className:`oc-admin__hint`,style:{margin:0},children:a()}),(0,M.jsxs)(D,{value:q.scheduleKind,onValueChange:e=>J({...q,scheduleKind:e,scheduleDirty:!0}),children:[(0,M.jsx)(E,{children:(0,M.jsx)(Ye,{})}),(0,M.jsxs)(Je,{children:[(0,M.jsx)(x,{value:`cron`,children:ue()}),(0,M.jsx)(x,{value:`every`,children:Fe()}),(0,M.jsx)(x,{value:`at`,children:be()})]})]}),q.scheduleKind===`cron`?(0,M.jsxs)(`div`,{style:{display:`flex`,gap:8},children:[(0,M.jsx)(C,{value:q.cronExpr,onChange:e=>J({...q,cronExpr:e.target.value,scheduleDirty:!0}),placeholder:`30 9 * * *`,style:{fontFamily:`var(--font-mono, monospace)`}}),(0,M.jsx)(C,{value:q.tz,onChange:e=>J({...q,tz:e.target.value,scheduleDirty:!0}),placeholder:`America/Toronto`,style:{maxWidth:180}})]}):q.scheduleKind===`every`?(0,M.jsxs)(`div`,{style:{display:`flex`,gap:8},children:[(0,M.jsx)(C,{type:`number`,min:1,value:q.everyValue,onChange:e=>J({...q,everyValue:e.target.value,scheduleDirty:!0}),style:{maxWidth:120}}),(0,M.jsxs)(D,{value:q.everyUnit,onValueChange:e=>J({...q,everyUnit:e,scheduleDirty:!0}),children:[(0,M.jsx)(E,{style:{maxWidth:160},children:(0,M.jsx)(Ye,{})}),(0,M.jsxs)(Je,{children:[(0,M.jsx)(x,{value:`minutes`,children:Le()}),(0,M.jsx)(x,{value:`hours`,children:Me()}),(0,M.jsx)(x,{value:`days`,children:ye()})]})]})]}):(0,M.jsx)(C,{type:`datetime-local`,value:q.at,onChange:e=>J({...q,at:e.target.value,scheduleDirty:!0})})]}),q.hasMessage?(0,M.jsxs)(`label`,{style:{display:`flex`,flexDirection:`column`,gap:4},children:[(0,M.jsx)(`span`,{className:`oc-admin__hint`,style:{margin:0},children:Te()}),(0,M.jsx)(`textarea`,{className:`oc-cronedit__textarea`,rows:4,value:q.message,onChange:e=>J({...q,message:e.target.value,messageDirty:!0})})]}):null]}),(0,M.jsxs)(rt,{children:[(0,M.jsx)(b,{variant:`ghost`,onClick:()=>J(null),children:d()}),(0,M.jsxs)(b,{onClick:()=>void xt(),disabled:q===null||q.loading||ht,children:[ht?(0,M.jsx)(Ge,{size:14,className:`oc-actrow__spin`,"aria-hidden":!0}):null,Ce()]})]})]})})]})}export{F as ScheduledTab};
@@ -1 +0,0 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$O as r,$P as i,AO as a,Ak as ee,BO as o,Bk as te,Ck as ne,Dk as re,E as s,Ek as ie,FO as c,Fk as ae,GO as l,Gk as oe,HO as u,Hk as se,IO as d,Ik as ce,JO as f,Jk as le,KO as p,Kk as ue,LO as m,Lk as de,MO as h,Mk as fe,NO as g,Nk as pe,Ok as me,PO as he,Pk as ge,QO as _e,RO as _,Rk as ve,Sk as ye,Tk as be,UO as v,Uk as xe,VO as Se,Vk as Ce,WO as y,Wk as b,XO as x,YO as S,Yk as we,ZO as C,ZP as Te,_k as Ee,ak as De,bk as Oe,ck as ke,dk as Ae,eF as w,ek as je,fk as Me,gk as Ne,hk as Pe,ik as Fe,jO as T,jk as Ie,kO as E,kk as Le,lk as Re,mk as ze,nk as Be,ok as Ve,pk as He,qO as D,qk as Ue,rk as We,sk as Ge,tk as Ke,uk as qe,vk as Je,wk as Ye,xk as Xe,yk as Ze,zO as O,zk as Qe}from"./dist-De2K23IB.js";import{n as k}from"./dist-Du1hJWyV.js";import{i as $e}from"./dist-CXJY_tYD.js";import{t as A}from"./button-Bd43O_sm.js";import{C as j,H as et,S as M,T as N,U as tt,Zt as P,_t as F,d as nt,dt as I,en as rt,ft as L,gt as R,ht as z,mt as B,nn as it,nt as V,pt as at,rn as ot,rt as H,vt as U,w as W,x as G}from"./index-CNwjY680.js";import{t as st}from"./FilterBar-CY1WfFDB.js";import{t as ct}from"./DataTableShell-COEwE2Hv.js";import{t as lt}from"./roleDescriptions-zLFA4zEm.js";var K=t(e(),1),q=n(),J=[{value:`never`,label:()=>c(),days:null},{value:`30`,label:()=>he(),days:30},{value:`90`,label:()=>g(),days:90}],Y=720*60*60*1e3,X=`__all__`,Z={name:``,roleKey:``,description:``};function Q(){let e=ot({from:`/settings/serviceAccounts`}),t=it({from:`/settings/serviceAccounts`}),n=e.q??``,a=e.status??X,[o,c]=(0,K.useState)(X),l=e=>void t({search:t=>({...t,q:e||void 0}),replace:!0}),u=e=>void t({search:t=>({...t,status:e===X?void 0:e})}),d=w(s.apiKeys.listServiceAccounts,{filter:{q:n||void 0,role:o===X?void 0:o,disabled:a===X?void 0:a===`disabled`}}),f=w(s.apiKeys.listKeys,{}),p=w(s.apiKeys.listRoles,{}),m=i(s.apiKeys.createServiceAccount),h=i(s.apiKeys.updateServiceAccount),g=i(s.apiKeys.deleteServiceAccount),he=Te(s.apiKeys.mintApiKey),_e=i(s.apiKeys.revokeApiKey),_=tt(),v=et(),Se=n!==``||o!==X||a!==X;function y(){c(X),t({search:{},replace:!0})}let[x,S]=(0,K.useState)(!1),[C,T]=(0,K.useState)(Z),[E,D]=(0,K.useState)(null),[O,k]=(0,K.useState)(new Set),[P,F]=(0,K.useState)(null),R=(0,K.useRef)(!1),[z,B]=(0,K.useState)(new Set),[V,at]=(0,K.useState)({}),[H,U]=(0,K.useState)(null),Y=(0,K.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 Q(e){k(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})}async function ft(){try{E?(await h({serviceAccountId:E,name:C.name,roleKey:C.roleKey,description:C.description}),v.success(He())):await m({name:C.name,roleKey:C.roleKey,description:C.description||void 0}),T(Z),D(null),S(!1)}catch(e){v.error(E?ze():Pe(),e)}}function pt(e){T({name:e.name,roleKey:e.roleKey,description:e.description??``}),D(e._id),S(!0)}async function mt(e){if(R.current)return;R.current=!0;let t=V[e._id]??`never`,n=J.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});U({accountName:e.name,plaintext:t.plaintext,prefix:t.prefix,lastFour:t.lastFour})}catch(e){v.error(Me(),e)}finally{R.current=!1,F(null)}}async function $(e){if(await _({title:Ae(),description:(0,q.jsxs)(q.Fragment,{children:[qe(),` `,(0,q.jsx)(`span`,{className:`font-mono`,children:e.name}),` `,Re(),` `,(0,q.jsx)(`strong`,{children:ke()}),` `,Ge()]}),confirmWord:e.name,confirmLabel:Ve(),destructive:!0}))try{await g({serviceAccountId:e._id}),v.success(De(),e.name)}catch(e){v.error(Fe(),e)}}async function ht(e){if(await _({title:We(),description:(0,q.jsxs)(q.Fragment,{children:[Be(),` `,(0,q.jsxs)(`span`,{className:`font-mono`,children:[e.prefix,`…`,e.lastFour]}),` `,Ke()]}),confirmLabel:je(),destructive:!0})&&!z.has(e._id)){B(t=>new Set(t).add(e._id));try{await _e({keyId:e._id})}catch(e){v.error(r(),e)}finally{B(t=>{let n=new Set(t);return n.delete(e._id),n})}}}return(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(`p`,{className:`oc-admin__hint`,children:we()}),(0,q.jsxs)(st,{q:n,onQChange:l,searchPlaceholder:le(),onReset:y,canReset:Se,children:[(0,q.jsxs)(G,{value:o,onValueChange:c,children:[(0,q.jsx)(W,{size:`sm`,className:`w-40`,children:(0,q.jsx)(N,{placeholder:Ue()})}),(0,q.jsxs)(M,{children:[(0,q.jsx)(j,{value:X,children:ue()}),(p??[]).map(e=>(0,q.jsx)(j,{value:e.key,children:e.key},e._id))]})]}),(0,q.jsxs)(G,{value:a,onValueChange:u,children:[(0,q.jsx)(W,{size:`sm`,className:`w-36`,children:(0,q.jsx)(N,{})}),(0,q.jsxs)(M,{children:[(0,q.jsx)(j,{value:X,children:oe()}),(0,q.jsx)(j,{value:`active`,children:b()}),(0,q.jsx)(j,{value:`disabled`,children:xe()})]})]})]}),(0,q.jsx)(ct,{title:se(),rows:d,addLabel:Ce(),onAdd:()=>{T(Z),D(null),S(!0)},emptyHint:te(),isExpanded:e=>O.has(e._id),renderExpanded:e=>(0,q.jsx)(ut,{account:e,keys:Y.get(e._id)??[],onRevoke:ht,revoking:z}),rowActions:e=>[{label:ce(),onSelect:()=>pt(e)},{label:Qe(),onSelect:()=>void mt(e)},{label:O.has(e._id)?ve():de(),onSelect:()=>Q(e._id)},{label:ae(),variant:`destructive`,onSelect:()=>void $(e)}],columns:[{header:``,className:`w-8`,cell:e=>(0,q.jsx)(A,{variant:`ghost`,size:`icon-sm`,"aria-label":O.has(e._id)?ge():pe(),onClick:()=>Q(e._id),children:O.has(e._id)?(0,q.jsx)($e,{}):(0,q.jsx)(rt,{})})},{header:fe(),sort:e=>e.name,cell:e=>(0,q.jsxs)(`div`,{className:`flex flex-col`,children:[(0,q.jsx)(`span`,{children:e.name}),e.description?(0,q.jsx)(`span`,{className:`text-muted-foreground text-xs`,children:e.description}):null]})},{header:Ie(),sort:e=>e.roleKey,cell:e=>(0,q.jsx)(I,{variant:`secondary`,children:e.roleKey})},{header:ee(),sort:e=>+!!e.disabled,cell:e=>e.disabled?(0,q.jsx)(I,{variant:`destructive`,children:xe()}):(0,q.jsx)(I,{variant:`outline`,children:b()})},{header:Le(),cell:e=>(0,q.jsxs)(G,{value:V[e._id]??`never`,onValueChange:t=>at(n=>({...n,[e._id]:t})),children:[(0,q.jsx)(W,{size:`sm`,className:`w-32`,children:(0,q.jsx)(N,{})}),(0,q.jsx)(M,{children:J.map(e=>(0,q.jsx)(j,{value:e.value,children:e.label()},e.value))})]})},{header:me(),sort:e=>(Y.get(e._id)??[]).filter(e=>!e.disabled).length,cell:e=>{let t=(Y.get(e._id)??[]).filter(e=>!e.disabled).length;return(0,q.jsx)(`span`,{className:`oc-sa__keycount`,children:P===e._id?re():ie({count:t})})}}]}),(0,q.jsx)(nt,{open:x,onOpenChange:e=>{S(e),e||D(null)},title:E?be():ye(),description:E?Ye():Xe(),canSubmit:!!(C.name&&C.roleKey),onSubmit:ft,submitLabel:E?ne():Oe(),children:(0,q.jsxs)(`div`,{className:`oc-form`,children:[(0,q.jsxs)(`label`,{className:`oc-field`,children:[(0,q.jsx)(`span`,{className:`oc-field__label`,children:Ze()}),(0,q.jsx)(L,{value:C.name,onChange:e=>T({...C,name:e.target.value})})]}),(0,q.jsxs)(`label`,{className:`oc-field`,children:[(0,q.jsx)(`span`,{className:`oc-field__label`,children:Je()}),(0,q.jsxs)(G,{value:C.roleKey||void 0,onValueChange:e=>T({...C,roleKey:e}),children:[(0,q.jsx)(W,{className:`w-full`,children:(0,q.jsx)(N,{placeholder:Ee()})}),(0,q.jsx)(M,{children:(p??[]).map(e=>(0,q.jsxs)(j,{value:e.key,children:[e.name,` (`,e.key,`)`]},e._id))})]}),(()=>{let e=(p??[]).find(e=>e.key===C.roleKey),t=e?lt(e):null;return t?(0,q.jsx)(`span`,{className:`text-muted-foreground text-xs`,children:t}):null})()]}),(0,q.jsxs)(`label`,{className:`oc-field`,children:[(0,q.jsx)(`span`,{className:`oc-field__label`,children:Ne()}),(0,q.jsx)(L,{value:C.description,onChange:e=>T({...C,description:e.target.value})})]})]})}),(0,q.jsx)(dt,{minted:H,onClose:()=>U(null)})]})}function ut({account:e,keys:t,onRevoke:n,revoking:r}){return(0,q.jsxs)(`div`,{className:`oc-sa__keys`,children:[(0,q.jsxs)(`div`,{className:`oc-sa__keys-head`,children:[_e(),` `,(0,q.jsx)(`span`,{className:`font-medium`,children:e.name})]}),t.length===0?(0,q.jsx)(`p`,{className:`oc-admin__hint`,children:C()}):(0,q.jsxs)(`table`,{className:`oc-sa__keytable`,children:[(0,q.jsx)(`thead`,{children:(0,q.jsxs)(`tr`,{children:[(0,q.jsx)(`th`,{children:x()}),(0,q.jsx)(`th`,{children:S()}),(0,q.jsx)(`th`,{children:f()}),(0,q.jsx)(`th`,{children:D()}),(0,q.jsx)(`th`,{children:p()}),(0,q.jsx)(`th`,{children:l()}),(0,q.jsx)(`th`,{})]})}),(0,q.jsx)(`tbody`,{children:t.map(t=>(0,q.jsxs)(`tr`,{children:[(0,q.jsx)(`td`,{children:(0,q.jsxs)(`code`,{className:`oc-sa__keyid`,children:[t.prefix,`…`,t.lastFour]})}),(0,q.jsx)(`td`,{children:(0,q.jsx)(I,{variant:`secondary`,children:e.roleKey})}),(0,q.jsx)(`td`,{children:H(t.createdAt)}),(0,q.jsx)(`td`,{className:ft(t.lastUsedAt)?`oc-sa__stale`:``,children:pt(t.lastUsedAt)}),(0,q.jsx)(`td`,{children:mt(t.expiresAt)}),(0,q.jsx)(`td`,{children:$(t)}),(0,q.jsx)(`td`,{className:`text-right`,children:t.disabled?null:(0,q.jsx)(A,{variant:`destructive`,size:`sm`,disabled:r.has(t._id),onClick:()=>n(t),children:r.has(t._id)?y():v()})})]},t._id))})]})]})}function dt({minted:e,onClose:t}){let[n,r]=(0,K.useState)(!1);async function i(){if(e)try{await navigator.clipboard.writeText(e.plaintext),r(!0),window.setTimeout(()=>r(!1),2e3)}catch{}}return(0,q.jsx)(at,{open:e!==null,onOpenChange:e=>{e||(r(!1),t())},children:e?(0,q.jsxs)(B,{className:`max-w-lg`,showCloseButton:!1,onInteractOutside:e=>e.preventDefault(),onEscapeKeyDown:e=>e.preventDefault(),children:[(0,q.jsxs)(F,{children:[(0,q.jsx)(U,{children:u()}),(0,q.jsx)(z,{children:Se({name:e.accountName})})]}),(0,q.jsx)(`div`,{className:`oc-sa__minted-warning`,children:o()}),(0,q.jsxs)(`div`,{className:`oc-sa__minted-box`,children:[(0,q.jsx)(`code`,{className:`oc-sa__minted-plain`,children:e.plaintext}),(0,q.jsxs)(A,{variant:`outline`,size:`sm`,onClick:()=>void i(),"aria-label":O(),children:[n?(0,q.jsx)(k,{}):(0,q.jsx)(P,{}),n?_():m()]})]}),(0,q.jsx)(R,{children:(0,q.jsx)(A,{onClick:()=>{r(!1),t()},children:d()})})]}):null})}function ft(e){return e===null?!1:Date.now()-e>Y}function pt(e){return e===null?h():H(e)}function mt(e){return e===null?`—`:V(e)}function $(e){return e.disabled?(0,q.jsx)(I,{variant:`destructive`,children:T()}):e.expiresAt!==null&&e.expiresAt<Date.now()?(0,q.jsx)(I,{variant:`outline`,children:a()}):(0,q.jsx)(I,{variant:`outline`,children:E()})}export{Q as ServiceAccountsTab};
@@ -1 +0,0 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$P as r,Ao as i,Bo as a,Co as o,Do as s,E as c,Eo as l,Fo as u,Io as d,Lo as f,Mo as p,No as m,Oo as h,Po as g,Ro as _,So as v,To as y,_o as b,ao as x,bo as S,co as C,do as w,eF as T,fo as E,go as D,ho as O,io as k,jo as A,ko as j,lo as M,mo as N,no as P,oo as F,po as I,ro as L,so as ee,uo as R,vo as z,wo as B,xo as V,yo as H,zo as U}from"./dist-De2K23IB.js";import{t as W}from"./button-Bd43O_sm.js";import{U as G,rt as K}from"./index-CNwjY680.js";import{t as q}from"./DataTableShell-COEwE2Hv.js";var J=t(e(),1),Y=n(),X={hung:()=>o(),wrong_result:()=>v(),error:()=>V(),other:()=>S()},Z=e=>(e&&X[e]?.())??e??`—`;function Q(e){let t=e.slice(e.lastIndexOf(`:`)+1)||e;return t.length>12?`${t.slice(0,12)}…`:t}function $({data:e}){let t=e.snapshot,n=r(c.subAgentReports.respondToReport),[i,a]=(0,J.useState)(e.thread),[o,s]=(0,J.useState)(``),[l,u]=(0,J.useState)(!1);async function d(){let t=o.trim();if(!(!t||l)){u(!0);try{await n({reportId:e._id,text:t}),a(e=>[...e,{authorRole:`admin`,text:t,at:Date.now()}]),s(``)}finally{u(!1)}}}return(0,Y.jsxs)(`div`,{className:`oc-fbadmin__detail`,children:[(0,Y.jsx)(`div`,{className:`oc-fbadmin__row`,children:(0,Y.jsxs)(`span`,{className:`oc-fbadmin__meta`,children:[Z(e.category),` · `,H({failed:t.failedCount,total:t.totalCount}),t.openclawModel?` · ${t.openclawModel}`:``,t.openclawRuntime?` (${t.openclawRuntime})`:``]})}),e.comment?(0,Y.jsxs)(`section`,{children:[(0,Y.jsx)(`h4`,{className:`oc-fbadmin__h`,children:z()}),(0,Y.jsx)(`p`,{className:`oc-fbadmin__comment`,children:e.comment})]}):null,(0,Y.jsxs)(`section`,{children:[(0,Y.jsx)(`h4`,{className:`oc-fbadmin__h`,children:b()}),i.length>0?(0,Y.jsx)(`div`,{className:`oc-fbadmin__thread`,children:i.map((e,t)=>(0,Y.jsxs)(`div`,{className:`oc-notif__msg oc-notif__msg--${e.authorRole}`,children:[(0,Y.jsx)(`span`,{className:`oc-notif__msg-who`,children:e.authorRole===`admin`?D():O()}),(0,Y.jsx)(`span`,{className:`oc-notif__msg-text`,children:e.text})]},t))}):(0,Y.jsx)(`p`,{className:`oc-fbadmin__meta`,children:N()}),(0,Y.jsx)(`textarea`,{className:`oc-feedback__textarea`,placeholder:I(),value:o,maxLength:2e3,rows:3,onChange:e=>s(e.target.value.slice(0,2e3))}),(0,Y.jsx)(`div`,{className:`oc-fbadmin__row`,style:{justifyContent:`flex-end`},children:(0,Y.jsx)(W,{size:`sm`,onClick:()=>void d(),disabled:!o.trim()||l,children:l?w():E()})})]}),(0,Y.jsxs)(`section`,{children:[(0,Y.jsxs)(`h4`,{className:`oc-fbadmin__h`,children:[R({count:t.children.length}),t.childrenTruncated?` ${M()}`:``,t.textTruncated?` ${C()}`:``]}),(0,Y.jsx)(`div`,{className:`oc-fbadmin__ctx`,children:t.children.map((e,n)=>(0,Y.jsxs)(`div`,{className:`oc-fbadmin__ctx-turn`,children:[(0,Y.jsxs)(`span`,{className:`oc-fbadmin__ctx-role`,children:[(e.taskName?.trim()||Q(e.childSessionKey))+` · ${e.status}`,e.phase?` · ${e.phase}`:``,e.childSessionKey===t.flaggedChildSessionKey?` · ${ee()}`:``]}),e.errorMessage?(0,Y.jsx)(`pre`,{className:`oc-msg__source-pre`,children:e.errorMessage}):null,e.resultText?(0,Y.jsx)(`pre`,{className:`oc-msg__source-pre`,children:e.resultText}):null]},n))})]}),t.parentText?(0,Y.jsxs)(`section`,{children:[(0,Y.jsx)(`h4`,{className:`oc-fbadmin__h`,children:F()}),(0,Y.jsx)(`pre`,{className:`oc-msg__source-pre`,children:t.parentText})]}):null,(0,Y.jsxs)(`section`,{children:[(0,Y.jsx)(`h4`,{className:`oc-fbadmin__h`,children:x()}),(0,Y.jsx)(`p`,{className:`oc-fbadmin__env`,children:[t.parentStatus?`status: ${t.parentStatus}`:null,t.parentErrorCode?`code: ${t.parentErrorCode}`:null,t.parentRunId?`run ${t.parentRunId.slice(0,12)}…`:null,e.correlationId?`corr ${e.correlationId.slice(0,16)}…`:null,t.openclawProvider].filter(Boolean).join(` · `)||`—`})]})]})}function te(){let e=T(c.subAgentReports.listForAdmin,{}),t=r(c.subAgentReports.readReport),n=r(c.subAgentReports.deleteReport),o=G(),[v,b]=(0,J.useState)(null),[x,S]=(0,J.useState)({});async function C(e){if(v===e._id){b(null);return}if(!x[e._id]){let n=await t({reportId:e._id});S(t=>({...t,[e._id]:n}))}b(e._id)}async function w(e){await o({title:k(),description:L(),confirmLabel:P(),destructive:!0})&&(await n({reportId:e._id}),v===e._id&&b(null))}return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(`p`,{className:`oc-admin__hint`,children:[_(),` `,(0,Y.jsx)(`strong`,{children:f()}),` `,d()]}),(0,Y.jsx)(q,{title:a(),rows:e,emptyHint:U(),isExpanded:e=>v===e._id&&!!x[e._id],renderExpanded:e=>x[e._id]?(0,Y.jsx)($,{data:x[e._id]}):null,columns:[{header:u(),cell:e=>K(e.at),sort:e=>e.at},{header:g(),cell:e=>Z(e.category),sort:e=>Z(e.category)},{header:m(),cell:e=>`${e.failedCount}/${e.totalCount}`,sort:e=>e.failedCount},{header:p(),cell:e=>(e.reporterEmail||e.reporterName||`—`)+(e.impersonated&&e.realOperatorEmail?` ${j({operator:e.realOperatorEmail})}`:``),sort:e=>e.reporterEmail||e.reporterName||null},{header:A(),cell:e=>e.hasComment?`✎`:`—`,sort:e=>+!!e.hasComment},{header:i(),cell:e=>e.answered?(0,Y.jsx)(`span`,{className:`oc-fbadmin__pill is-ok`,children:h()}):(0,Y.jsx)(`span`,{className:`oc-fbadmin__pill`,children:s()}),sort:e=>+!!e.answered}],rowActions:e=>[{label:v===e._id?y():l(),onSelect:()=>void C(e)},{label:B(),onSelect:()=>void w(e),variant:`destructive`}]})]})}export{te as SubAgentReportsTab};