@lacneu/atrium 0.54.2 → 0.55.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/AccessTab-gIcazyyd.js +1 -0
- package/dist/assets/{AdvancedFilter-BTHZYRGc.js → AdvancedFilter-Da3KTeHW.js} +1 -1
- package/dist/assets/AgentFilesTab-zUyuhhPC.js +3 -0
- package/dist/assets/AnomaliesTab-Xzr68-lj.js +1 -0
- package/dist/assets/AuditTab-DhZziBmc.js +1 -0
- package/dist/assets/BridgeTab-CBfGV3MJ.js +1 -0
- package/dist/assets/ChatDefaultsTab-CPHvONN5.js +1 -0
- package/dist/assets/{DataTableShell-DvxbPdB7.js → DataTableShell-CRhep8-q.js} +1 -1
- package/dist/assets/{DetailChips-BCCxug5L.js → DetailChips-DU6aRrkw.js} +1 -1
- package/dist/assets/FeedbacksTab-B5AD5fns.js +1 -0
- package/dist/assets/{FieldLabel-C15_DFF2.js → FieldLabel-Cam2yQ_L.js} +2 -2
- package/dist/assets/FilesTab-2LXlwGbm.js +1 -0
- package/dist/assets/{FilterBar-88imPMtz.js → FilterBar-D6zZSKoR.js} +1 -1
- package/dist/assets/GroupsTab-BbXkqBwR.js +1 -0
- package/dist/assets/InstancesTab-efmqJkiF.js +1 -0
- package/dist/assets/IntegrationsTab-gnKR_uar.js +1 -0
- package/dist/assets/KpiTab-C1faYNw_.js +1 -0
- package/dist/assets/PreferencesTab-Bntqbb3v.js +1 -0
- package/dist/assets/PromptInjectionsTab-rzjPaDqW.js +4 -0
- package/dist/assets/RolesTab-Dur_DWik.js +1 -0
- package/dist/assets/ScheduledTab-vr9ejIr6.js +1 -0
- package/dist/assets/ServiceAccountsTab-CDRsanZ2.js +1 -0
- package/dist/assets/SubAgentReportsTab-DlOkF8VH.js +1 -0
- package/dist/assets/ThemeShowroom-CIz45LkB.js +1 -0
- package/dist/assets/{TimeRangePicker-D2BzLnpx.js → TimeRangePicker-5EYfNRUQ.js} +1 -1
- package/dist/assets/TracesTab-Drz4v12P.js +1 -0
- package/dist/assets/UsersTab-BM5wnZH4.js +1 -0
- package/dist/assets/VoiceTab-dC1OIeva.js +1 -0
- package/dist/assets/bundle-mjs-C73ZY4La.js +1 -0
- package/dist/assets/button-CJcuK3wk.js +1 -0
- package/dist/assets/{card-Dq94Pad-.js → card-CVCuPx_Y.js} +1 -1
- package/dist/assets/chevrons-up-down-QpMWDm41.js +1 -0
- package/dist/assets/{compatView-CmR9qhhp.js → compatView-B7k06dFl.js} +1 -1
- package/dist/assets/dispatchErrorInfo-CGkgIKQB.js +1 -0
- package/dist/assets/dist-B7glRJ6t.js +5 -0
- package/dist/assets/dist-Czk9m5q_.js +1 -0
- package/dist/assets/dist-DDmOEYQC.js +1 -0
- package/dist/assets/dist-Dw05q7xL.js +44 -0
- package/dist/assets/{highlighted-body-OFNGDK62-DCyGQxrv.js → highlighted-body-OFNGDK62-CIIdpJOV.js} +1 -1
- package/dist/assets/{index-B0ZKEJwL.css → index-C6zNVqw_.css} +1 -1
- package/dist/assets/index-CVElkIyB.js +238 -0
- package/dist/assets/mermaid-GHXKKRXX-B05YFZFp.js +1 -0
- package/dist/assets/{pdf-CaIDXBex.js → pdf-DYyorNYM.js} +1 -1
- package/dist/assets/roleDescriptions-5T4_7YgE.js +1 -0
- package/dist/assets/{table-B58636RR.js → table-HcdAROEr.js} +1 -1
- package/dist/assets/tabs--02lZ4zx.js +1 -0
- package/dist/assets/x-DiDC_TeC.js +1 -0
- package/dist/index.html +9 -11
- package/package.json +1 -1
- package/dist/assets/AccessTab-G-WLKUVf.js +0 -1
- package/dist/assets/AgentFilesTab-BHpBAsFA.js +0 -3
- package/dist/assets/AnomaliesTab-B2_Mpyfy.js +0 -1
- package/dist/assets/AuditTab-yjH9M1bm.js +0 -1
- package/dist/assets/BridgeTab-Ckx_hfwW.js +0 -1
- package/dist/assets/ChatDefaultsTab-BwmUmJ1r.js +0 -1
- package/dist/assets/FeedbacksTab-C-VNml-X.js +0 -1
- package/dist/assets/FilesTab-D7tFoAQG.js +0 -1
- package/dist/assets/GroupsTab-D3OhxLQa.js +0 -1
- package/dist/assets/InstancesTab-DMIyLh8S.js +0 -1
- package/dist/assets/IntegrationsTab--rnPdlv6.js +0 -1
- package/dist/assets/KpiTab-hcMGhqd7.js +0 -1
- package/dist/assets/PreferencesTab-BhVrGd8f.js +0 -1
- package/dist/assets/PromptInjectionsTab-B_OULbil.js +0 -4
- package/dist/assets/RolesTab-Yf7per9y.js +0 -1
- package/dist/assets/ScheduledTab-OMmoZ0A0.js +0 -1
- package/dist/assets/ServiceAccountsTab-Bf3EVNkc.js +0 -1
- package/dist/assets/SubAgentReportsTab-EinUEcrI.js +0 -1
- package/dist/assets/ThemeShowroom-CVkQPbiJ.js +0 -1
- package/dist/assets/TracesTab-Cn_fSlMk.js +0 -1
- package/dist/assets/UsersTab-C8K6rWGr.js +0 -1
- package/dist/assets/VoiceTab-D_yJlUnJ.js +0 -1
- package/dist/assets/bundle-mjs-BJq7W7j9.js +0 -1
- package/dist/assets/button-DgrHAwnL.js +0 -1
- package/dist/assets/chevrons-up-down-CPbErSVv.js +0 -1
- package/dist/assets/dispatchErrorInfo-BCoejmqa.js +0 -1
- package/dist/assets/dist--_yEYc8n.js +0 -4
- package/dist/assets/dist-CktYgUtY.js +0 -1
- package/dist/assets/dist-DilWdU0c.js +0 -1
- package/dist/assets/dist-DpG5aN5U.js +0 -5
- package/dist/assets/dist-vBGNB0Dh.js +0 -41
- package/dist/assets/index-CMhwTTOU.js +0 -238
- package/dist/assets/mermaid-GHXKKRXX-DbugQhCl.js +0 -1
- package/dist/assets/react-dom-DdTRmCHB.js +0 -1
- package/dist/assets/roleDescriptions-D0TCU7rm.js +0 -1
- package/dist/assets/tabs-HTb97o34.js +0 -1
- package/dist/assets/x-CJvE-xbb.js +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{$y as e,Qy as t,Xy as n,Zy as r,eb as i}from"./dist-Dw05q7xL.js";var a={pending:i,user:e,admin:t,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};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{a as e,r as t}from"./bundle-mjs-C73ZY4La.js";import{n}from"./dist-Dw05q7xL.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};
|
|
@@ -0,0 +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-Dw05q7xL.js";import{t as d}from"./dist-Czk9m5q_.js";import{At as f,jt as p,kt as m}from"./index-CVElkIyB.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};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{D as e}from"./dist-Dw05q7xL.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,17 +62,15 @@
|
|
|
62
62
|
document.documentElement.dataset.motion = "static";
|
|
63
63
|
})();
|
|
64
64
|
</script>
|
|
65
|
-
<script type="module" crossorigin src="/assets/index-
|
|
66
|
-
<link rel="modulepreload" crossorigin href="/assets/bundle-mjs-
|
|
67
|
-
<link rel="modulepreload" crossorigin href="/assets/dist
|
|
68
|
-
<link rel="modulepreload" crossorigin href="/assets/
|
|
69
|
-
<link rel="modulepreload" crossorigin href="/assets/dist-
|
|
70
|
-
<link rel="modulepreload" crossorigin href="/assets/dist-
|
|
71
|
-
<link rel="modulepreload" crossorigin href="/assets/
|
|
72
|
-
<link rel="modulepreload" crossorigin href="/assets/
|
|
73
|
-
<link rel="
|
|
74
|
-
<link rel="modulepreload" crossorigin href="/assets/button-DgrHAwnL.js">
|
|
75
|
-
<link rel="stylesheet" crossorigin href="/assets/index-B0ZKEJwL.css">
|
|
65
|
+
<script type="module" crossorigin src="/assets/index-CVElkIyB.js"></script>
|
|
66
|
+
<link rel="modulepreload" crossorigin href="/assets/bundle-mjs-C73ZY4La.js">
|
|
67
|
+
<link rel="modulepreload" crossorigin href="/assets/dist-Dw05q7xL.js">
|
|
68
|
+
<link rel="modulepreload" crossorigin href="/assets/dist-Czk9m5q_.js">
|
|
69
|
+
<link rel="modulepreload" crossorigin href="/assets/dist-B7glRJ6t.js">
|
|
70
|
+
<link rel="modulepreload" crossorigin href="/assets/dist-DDmOEYQC.js">
|
|
71
|
+
<link rel="modulepreload" crossorigin href="/assets/x-DiDC_TeC.js">
|
|
72
|
+
<link rel="modulepreload" crossorigin href="/assets/button-CJcuK3wk.js">
|
|
73
|
+
<link rel="stylesheet" crossorigin href="/assets/index-C6zNVqw_.css">
|
|
76
74
|
</head>
|
|
77
75
|
<body>
|
|
78
76
|
<div id="root"></div>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lacneu/atrium",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.55.1",
|
|
4
4
|
"description": "Atrium — public, self-hostable, Convex-backed web chat UI for AI agent gateways (OpenClaw today, Hermes next). Ships an origin-agnostic static bundle (Convex URL injected at runtime via /config.json).",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{c as e,i as t,r as n}from"./bundle-mjs-BJq7W7j9.js";import{$u as r,Bu as i,Gu as a,Hu as o,Ju as s,Ku as c,MM as l,Qu as u,Uu as d,VM as f,Vu as p,Wu as m,Xu as h,Yu as g,Zu as _,c as v,qu as y,zu as b}from"./dist--_yEYc8n.js";import{C as x,S,T as C,lt as w,w as T,x as E}from"./index-CMhwTTOU.js";var D=e(t(),1);function O(e){return e===`user`?d():e===`all`?o():p({group:e.group})}function k(e){return e===`common`?i():e===`owner`?b():p({group:e.group})}var A=n();function j(e){return e.name||e.email||e.userId.slice(0,8)}function M(){let e=f(v.admin.listUsers,{}),[t,n]=(0,D.useState)(``),i=f(v.introspect.introspectUser,t?{userId:t}:`skip`);return(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:r()}),(0,A.jsxs)(E,{value:t,onValueChange:n,children:[(0,A.jsx)(T,{size:`sm`,"aria-label":u(),children:(0,A.jsx)(C,{placeholder:u()})}),(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:_()}):i===void 0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:l()}):(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:h()}),(0,A.jsxs)(`div`,{className:`oc-introspect__id`,children:[(0,A.jsx)(`strong`,{children:i.user.label}),(0,A.jsx)(w,{variant:`secondary`,children:i.role})]})]}),(0,A.jsxs)(`section`,{className:`oc-introspect__section`,children:[(0,A.jsx)(`h3`,{className:`oc-introspect__title`,children:g()}),i.groups.length===0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:a()}):(0,A.jsx)(`div`,{className:`oc-introspect__chips`,children:i.groups.map(e=>(0,A.jsx)(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:s()}),i.agents.length===0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:a()}):(0,A.jsx)(`ul`,{className:`oc-introspect__list`,children:i.agents.map(e=>(0,A.jsxs)(`li`,{className:`oc-introspect__row`,children:[(0,A.jsx)(`span`,{className:`oc-introspect__name`,children:e.displayName||e.agentId}),e.isDefault?(0,A.jsx)(w,{variant:`default`,children:m()}):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:y()}),i.charts.length===0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:a()}):(0,A.jsx)(`ul`,{className:`oc-introspect__list`,children:i.charts.map(e=>(0,A.jsxs)(`li`,{className:`oc-introspect__row`,children:[(0,A.jsx)(`span`,{className:`oc-introspect__name`,children:e.name}),(0,A.jsx)(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:c()}),i.permissions.length===0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:a()}):(0,A.jsx)(`div`,{className:`oc-introspect__chips`,children:i.permissions.map(e=>(0,A.jsx)(w,{variant:`secondary`,children:e},e))})]})]})]})}export{M as AccessTab};
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import{c as e,i as t,r as n}from"./bundle-mjs-BJq7W7j9.js";import{Ac as r,Ar as i,BM as a,Cc as o,Cr as s,Dc as c,Dr as l,Ec as u,Er as d,Fr as f,MM as p,Mc as m,Mr as h,Nc as g,Nr as _,Oc as v,Or as y,PM as b,Pc as x,Pr as S,RM as C,Sc as w,Sr as T,Tc as E,Tr as D,VM as O,WE as k,_c as A,_l as j,_r as M,ac as ee,ar as N,bc as P,br as F,c as I,cc as L,cr as R,dc as z,fc as te,gc as ne,gr as re,hc as B,hl as ie,hr as V,ir as H,jc as ae,jr as oe,kc as se,kr as U,lc as ce,mc as le,nr as W,oc as G,or as ue,pc as de,rr as fe,sc as pe,sr as me,uc as he,vc as ge,vr as _e,wc as ve,wr as ye,xc as be,xr as xe,yc as Se,yr as Ce}from"./dist--_yEYc8n.js";import{t as K}from"./button-DgrHAwnL.js";import{B as q,C as we,G as Te,J as Ee,K as De,S as Oe,St as ke,T as Ae,U as je,W as Me,X as Ne,Y as Pe,b as Fe,dt as Ie,ft as Le,gt as Re,ht as ze,jt as J,lt as Be,pt as Ve,q as He,w as Ue,x as We}from"./index-CMhwTTOU.js";import{n as Ge,t as Ke}from"./curation-CQksaIbm.js";import{i as qe}from"./compatView-CmR9qhhp.js";/* empty css */var Y=e(t(),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=O(I.me.getMe,{host:ke}),t=e?.role===`admin`,n=(e?.permissions??[]).includes(`bridge.read`),a=O(I.admin.listInstances,e!==void 0&&t?{}:`skip`),[s,l]=(0,Y.useState)(null);(0,Y.useEffect)(()=>{!t||!a||a.length===0||(!s||!a.some(e=>e.name===s))&&l(a[0].name)},[t,a,s]);let d=O(I.agents.listAgentsForInstance,t&&s?{instanceName:s}:`skip`),f=O(I.agents.listMyAgents,e!==void 0&&!t?{}:`skip`),_=(0,Y.useMemo)(()=>{if(e!==void 0){if(t)return s===null||d===void 0?a!==void 0&&a.length===0?[]:void 0:d.agents.map(e=>({instanceName:s,agentId:e.agentId,label:`${e.emoji?`${e.emoji} `:``}${e.displayName??e.agentId}`}));if(f!==void 0)return f.map(e=>({instanceName:e.instanceName,agentId:e.agentId,label:`${e.emoji?`${e.emoji} `:``}${e.displayName??e.agentId}`}))}},[e,t,s,d,a,f]),[y,S]=(0,Y.useState)(null);(0,Y.useEffect)(()=>{!_||_.length===0||(!y||!_.some(e=>$(e)===y))&&S($(_[0]))},[_,y]);let T=_?.find(e=>$(e)===y)??null,D=C(I.agentFiles.listAgentFiles),[k,A]=(0,Y.useState)({status:`idle`}),j=T?.instanceName??null,M=T?.agentId??null,ee=O(I.compat.forInstance,n&&j!==null?{instanceName:j}:`skip`),N=n&&j!==null?Fe(ee,`agentFiles`):null,P=N===null?!1:N===`loading`?null:N.blocked,F=(0,Y.useCallback)(async()=>{if(!(j===null||M===null)){A({status:`loading`});try{A({status:`done`,files:(await D({instanceName:j,agentId:M})).files})}catch{A({status:`error`})}}},[D,j,M]);(0,Y.useEffect)(()=>{P===!1&&F()},[F,P]);let[L,R]=(0,Y.useState)(null),z=O(I.agentFileCuration.listCurations,t&&j!==null&&M!==null?{instanceName:j,agentId:M}:`skip`),te=O(I.agentFileCuration.curationSettings,t&&j!==null?{instanceName:j}:`skip`),ne=C(I.agentFileCuration.requestCuration),[re,B]=(0,Y.useState)(null),[V,H]=(0,Y.useState)(null),{toast:U}=q(),ce=(0,Y.useMemo)(()=>{let e=new Map;for(let t of z??[])e.has(t.name)||e.set(t.name,t);return e},[z]),le=(0,Y.useCallback)(async e=>{if(!(j===null||M===null)){B(e);try{let t=await ne({instanceName:j,agentId:M,name:e,trigger:`manual`});t.ok?U({title:h(),variant:`success`}):U({title:oe({reason:t.reason??`unknown`}),variant:`error`})}catch{U({title:i(),variant:`error`})}finally{B(null)}}},[ne,j,M,U]),W=b(),G=(0,Y.useMemo)(()=>new Intl.NumberFormat(W,{maximumFractionDigits:0}),[W]);return e===void 0||_===void 0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:p()}):(0,Q.jsxs)(`div`,{className:`oc-afiles`,children:[(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:x()}),(0,Q.jsxs)(`div`,{className:`oc-afiles__picker`,children:[t&&(a?.length??0)>1?(0,Q.jsxs)(We,{value:s??``,onValueChange:e=>l(e),children:[(0,Q.jsx)(Ue,{size:`sm`,"aria-label":g(),children:(0,Q.jsx)(Ae,{})}),(0,Q.jsx)(Oe,{children:(a??[]).map(e=>(0,Q.jsx)(we,{value:e.name,children:e.name},e.name))})]}):null,_.length>0?(0,Q.jsxs)(We,{value:y??``,onValueChange:e=>S(e),children:[(0,Q.jsx)(Ue,{size:`sm`,"aria-label":m(),children:(0,Q.jsx)(Ae,{})}),(0,Q.jsx)(Oe,{children:_.map(e=>(0,Q.jsx)(we,{value:$(e),children:e.label},$(e)))})]}):(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:ae()})]}),T===null?null:N===`loading`?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:p()}):N!==null&&N.blocked?(0,Q.jsxs)(`p`,{className:`oc-compat__blocked`,role:`status`,children:[(0,Q.jsx)(J,{size:14,"aria-hidden":!0}),` `,qe(N.gatewayVersion,N.provider)]}):k.status===`loading`||k.status===`idle`?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:p()}):k.status===`error`?(0,Q.jsxs)(`p`,{className:`oc-afiles__error`,role:`alert`,children:[se(),` `,(0,Q.jsx)(K,{variant:`outline`,size:`sm`,onClick:()=>void F(),children:ie()})]}):k.files.length===0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:r()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`div`,{className:`oc-afiles__list`,children:k.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)(Be,{variant:`outline`,children:v()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`span`,{className:`oc-afiles__size`,children:c({size:Z(e.size,W)})}),(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:u({pct:G.format(n)})}),r?(0,Q.jsx)(J,{size:14,className:`oc-afiles__warn`,"aria-label":E()}):(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:()=>R(e),children:t?o():w()}),t&&!e.missing?(0,Q.jsx)(nt,{curatable:Ke.includes(e.name),size:e.size??0,budget:te?.budgetChars??null,enabled:te?.enabled??!1,curation:ce.get(e.name)??null,inFlight:re===e.name,onCurate:()=>void le(e.name),onReview:e=>H(e)}):null]},e.name)})}),(0,Q.jsx)(`p`,{className:`oc-afiles__budget`,children:ve({used:Z(Ze(k.files),W),total:Z(Je,W),pct:G.format(Xe(Ze(k.files)))})})]}),L&&T?(0,Q.jsx)(rt,{instanceName:T.instanceName,agentId:T.agentId,name:L.name,isAdmin:t,onClose:()=>R(null),onSaved:()=>void F()}):null,V?(0,Q.jsx)(it,{curationId:V,onClose:()=>H(null),onApplied:()=>{H(null),F()}}):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:S()}):a||i?.status===`dispatched`||i?.status===`applying`?(0,Q.jsx)(Be,{variant:`outline`,className:`oc-afiles__curate-status`,children:_()}):e&&r&&n!==null&&Ge(t,n)?(0,Q.jsx)(K,{variant:`outline`,size:`sm`,className:`oc-afiles__curate`,onClick:o,children:f()}):null}function rt({instanceName:e,agentId:t,name:n,isAdmin:r,onClose:i,onSaved:a}){let o=C(I.agentFiles.getAgentFile),s=C(I.agentFiles.setAgentFile),c=q(),[l,u]=(0,Y.useState)(null),[d,f]=(0,Y.useState)(!1),[m,h]=(0,Y.useState)(``),[g,_]=(0,Y.useState)(!1),[v,y]=(0,Y.useState)(!1),[x,S]=(0,Y.useState)(!1),[w,T]=(0,Y.useState)(!1),E=(0,Y.useCallback)(async r=>{f(!1);try{let i=await o({instanceName:e,agentId:t,name:n});u({content:i.content,updatedAtMs:i.updatedAtMs}),r||h(i.content),S(!1)}catch{f(!0)}},[o,e,t,n]);(0,Y.useEffect)(()=>{E(!1)},[E]);async function D(){if(l!==null){y(!0),T(!1);try{await s({instanceName:e,agentId:t,name:n,content:m,baseUpdatedAtMs:l.updatedAtMs??void 0}),c.success(B({name:n})),a(),await E(!1)}catch(e){et(e)?S(!0):T(!0)}finally{y(!1)}}}let O=l!==null&&m!==l.content,M=(0,Y.useMemo)(()=>l===null?null:$e(l.content,m),[l,m]),N=m.length>X,F=b(),R=(0,Y.useMemo)(()=>new Intl.NumberFormat(F),[F]);return(0,Q.jsx)(Ie,{open:!0,onOpenChange:e=>!e&&i(),children:(0,Q.jsxs)(Le,{className:`oc-afiles__editor`,children:[(0,Q.jsxs)(ze,{children:[(0,Q.jsx)(Re,{children:be({name:n})}),(0,Q.jsxs)(Ve,{children:[P({agent:t,instance:e}),r?null:(0,Q.jsxs)(Q.Fragment,{children:[` · `,Se()]})]})]}),d?(0,Q.jsxs)(`p`,{className:`oc-afiles__error`,role:`alert`,children:[de(),` `,(0,Q.jsx)(K,{variant:`outline`,size:`sm`,onClick:()=>void E(!1),children:ie()})]}):l===null?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:p()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`textarea`,{className:`oc-afiles__source`,value:m,readOnly:!r,spellCheck:!1,onChange:e=>h(e.target.value),"aria-label":be({name:n})}),(0,Q.jsx)(`p`,{className:`oc-afiles__hint`,children:ge()}),x?(0,Q.jsxs)(`p`,{className:`oc-afiles__error`,role:`alert`,children:[te(),` `,(0,Q.jsx)(K,{variant:`outline`,size:`sm`,onClick:()=>void E(!0),children:z()})]}):null,w?(0,Q.jsx)(`p`,{className:`oc-afiles__error`,role:`alert`,children:le()}):null,(0,Q.jsxs)(`div`,{className:`oc-afiles__editor-foot`,children:[(0,Q.jsx)(`span`,{className:`oc-afiles__count${N?` is-over`:``}`,children:A({count:R.format(m.length),max:R.format(X)})}),r?(0,Q.jsx)(K,{size:`sm`,disabled:!O||v||x,onClick:()=>_(!0),children:v?j():ne()}):null]})]}),(0,Q.jsx)(je,{open:g,onOpenChange:_,children:(0,Q.jsxs)(De,{children:[(0,Q.jsxs)(Pe,{children:[(0,Q.jsx)(Ne,{children:he({name:n})}),(0,Q.jsx)(He,{children:ce({agent:t})})]}),M?(0,Q.jsxs)(`div`,{className:`oc-afiles__diff`,children:[(0,Q.jsx)(`p`,{className:`oc-afiles__diff-counts`,children:L({added:M.added,removed:M.removed})}),M.sampleAdded.length>0?(0,Q.jsxs)(`div`,{className:`oc-afiles__diff-block`,children:[(0,Q.jsx)(`span`,{className:`oc-afiles__diff-label`,children:pe()}),M.sampleAdded.map((e,t)=>(0,Q.jsx)(`code`,{className:`oc-afiles__diff-line is-add`,children:e||` `},t))]}):null,M.sampleRemoved.length>0?(0,Q.jsxs)(`div`,{className:`oc-afiles__diff-block`,children:[(0,Q.jsx)(`span`,{className:`oc-afiles__diff-label`,children:G()}),M.sampleRemoved.map((e,t)=>(0,Q.jsx)(`code`,{className:`oc-afiles__diff-line is-del`,children:e||` `},t))]}):null]}):null,(0,Q.jsxs)(Ee,{children:[(0,Q.jsx)(Te,{children:k()}),(0,Q.jsx)(Me,{onClick:()=>void D(),children:ee()})]})]})})]})})}function it({curationId:e,onClose:t,onApplied:n}){let r=O(I.agentFileCuration.getProposal,{curationId:e}),o=C(I.agentFileCuration.approveCuration),c=a(I.agentFileCuration.rejectCuration),{toast:u}=q(),[f,m]=(0,Y.useState)(null),[h,g]=(0,Y.useState)(!1),[_,v]=(0,Y.useState)(``),x=b(),S=(0,Y.useMemo)(()=>r?$e(r.beforeContent,r.proposedContent):null,[r]);async function w(){m(`approve`);try{let t=await o({curationId:e});t.ok?(u({title:U(),variant:`success`}),n()):u({title:t.reason===`conflict`?l():d({reason:t.reason??`unknown`}),variant:`error`})}catch{u({title:i(),variant:`error`})}finally{m(null)}}async function E(n){m(`reject`);try{let r=_.trim();(await c({curationId:e,...r?{comment:r}:{},relaunch:n})).ok?u({title:n?fe():y(),variant:`success`}):u({title:s(),variant:`error`}),t()}catch{u({title:i(),variant:`error`})}finally{m(null)}}return(0,Q.jsx)(Ie,{open:!0,onOpenChange:e=>e?void 0:t(),children:(0,Q.jsxs)(Le,{className:`oc-afiles__review`,children:[(0,Q.jsxs)(ze,{children:[(0,Q.jsx)(Re,{children:r?D({name:r.name}):p()}),(0,Q.jsx)(Ve,{children:ye()})]}),r===void 0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:p()}):r===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:[T({before:Z(r.beforeSize,x),after:Z(r.proposedSize,x)}),r.overBudget?(0,Q.jsxs)(Q.Fragment,{children:[` `,(0,Q.jsx)(J,{size:13,"aria-hidden":!0}),` `,xe()]}):null]}),S?(0,Q.jsx)(`p`,{className:`oc-afiles__review-diff`,children:F({added:S.added,removed:S.removed})}):null,r.feedback?(0,Q.jsx)(`p`,{className:`oc-afiles__review-feedback`,children:W({feedback:r.feedback})}):null,S&&S.sampleRemoved.length>0?(0,Q.jsxs)(`div`,{className:`oc-afiles__review-removed`,children:[(0,Q.jsx)(`p`,{className:`oc-afiles__review-label`,children:V()}),(0,Q.jsx)(`ul`,{children:S.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:re()}),(0,Q.jsx)(`pre`,{className:`oc-afiles__review-pre`,children:r.beforeContent})]}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`p`,{className:`oc-afiles__review-label`,children:Ce()}),(0,Q.jsx)(`pre`,{className:`oc-afiles__review-pre`,children:r.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:R()}),(0,Q.jsx)(`textarea`,{id:`curation-reject-comment`,className:`oc-afiles__reject-textarea`,rows:3,placeholder:me(),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:ue()}),(0,Q.jsx)(K,{variant:`outline`,onClick:()=>void E(!1),disabled:f!==null,children:f===`reject`?j():N()}),(0,Q.jsx)(K,{variant:`default`,onClick:()=>void E(!0),disabled:f!==null,children:f===`reject`?j():H()})]})]}):(0,Q.jsxs)(`div`,{className:`oc-afiles__review-actions`,children:[(0,Q.jsx)(K,{variant:`outline`,onClick:()=>g(!0),disabled:f!==null||r==null,children:_e()}),(0,Q.jsx)(K,{variant:`default`,onClick:()=>void w(),disabled:f!==null||r==null,children:f===`approve`?j():M()})]})]})})}export{tt as AgentFilesTab};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{c as e,i as t,r as n}from"./bundle-mjs-BJq7W7j9.js";import{$v as r,Av as i,BM as ee,Bv as te,Fv as a,Gv as ne,Hv as re,Iv as o,Jv as s,Kv as c,Lv as ie,Mv as l,Nv as u,Pv as d,Qv as f,Rv as p,Uv as m,VM as h,Vv as ae,Wv as oe,Xv as g,Yv as se,Zv as ce,_y as le,ay as ue,by as _,c as v,cy as de,dy as fe,ey as pe,fy as me,gy as he,hy as ge,iy as _e,jv as y,kv as b,ly as ve,my as ye,ny as x,oy as S,py as C,qv as w,ry as T,sy as E,ty as D,uy as O,vy as k,xy as A,yy as j,zv as M}from"./dist--_yEYc8n.js";import{B as N,C as P,S as F,St as be,T as I,V as xe,Xt as L,Zt as Se,dt as R,ft as z,gt as B,ht as V,i as Ce,lt as H,o as we,tt as Te,w as U,x as W}from"./index-CMhwTTOU.js";import{n as Ee}from"./TimeRangePicker-D2BzLnpx.js";import{t as De}from"./FilterBar-88imPMtz.js";import{t as Oe}from"./DataTableShell-DvxbPdB7.js";import{t as G}from"./dispatchErrorInfo-BCoejmqa.js";var K=e(t(),1),q=n(),J=`__all__`,ke=[{value:`open`},{value:`acknowledged`},{value:`resolved`}];function Ae(e){return e===`open`?A():e===`acknowledged`?_():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=Se({from:`/settings/anomalies`}),t=L({from:`/settings/anomalies`}),n=e.q??``,i=e.status===Y?J:e.status,a=e.severity??J,o=e.kind??J,[l,u]=(0,K.useState)(J),d=Ce(e.from,e.to),{from:_,to:y}=Ee(d),b=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})}),R=e=>void t({search:t=>({...t,kind:e===J?void 0:e})}),z=e=>void t({search:t=>({...t,...we(e)})}),B=xe(),V=N(),G=ee(v.anomalies.resolveAnomaly),X=(h(v.me.getMe,{host:be})?.permissions??[]).includes(`admin.manage`),Z=h(v.anomalies.listAnomalies,{limit:Pe,filter:{q:n||void 0,from:_,to:y,anomalyStatus:i===J?void 0:i,severity:a===J?void 0:a,source:l===J?void 0:l,kind:o===J?void 0:o}}),Q=(0,K.useMemo)(()=>{let e=new Set;for(let t of Z??[])e.add(t.kind);return[...e].sort()},[Z]),ze=n!==``||i!==`open`||a!==J||l!==J||o!==J||d.kind!==`relative`||d.from!==Ne.from;function Be(){u(J),t({search:{status:`open`},replace:!0})}async function Ve(e){if(await B({title:k(),description:(0,q.jsxs)(q.Fragment,{children:[le(),` `,(0,q.jsx)(`span`,{className:`font-mono`,children:e.kind}),` `,he(),` `,(0,q.jsx)(`strong`,{children:ge()}),`.`,` `,ye()]}),confirmLabel:C()}))try{await G({anomalyId:e._id,status:`resolved`}),V.success(me(),e.kind)}catch(e){V.error(fe(),e)}}async function He(e){try{await G({anomalyId:e._id,status:`acknowledged`}),V.success(O(),e.kind)}catch(e){V.error(ve(),e)}}return(0,q.jsxs)(q.Fragment,{children:[(0,q.jsxs)(`p`,{className:`oc-admin__hint`,children:[de(),` `,(0,q.jsx)(`strong`,{children:E()}),` `,S(),` `,(0,q.jsx)(`strong`,{children:ue()}),` `,_e(),` `,(0,q.jsx)(`strong`,{children:T()}),` `,x(),` `,(0,q.jsx)(`span`,{className:`oc-filter__window`,children:D()})]}),(0,q.jsxs)(De,{q:n,onQChange:b,searchPlaceholder:pe(),timeRange:d,onTimeRangeChange:z,onReset:Be,canReset:ze,children:[(0,q.jsxs)(W,{value:i,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)(P,{value:J,children:r()}),ke.map(e=>(0,q.jsx)(P,{value:e.value,children:Ae(e.value)},e.value))]})]}),(0,q.jsxs)(W,{value:a,onValueChange:j,children:[(0,q.jsx)(U,{size:`sm`,className:`w-36`,children:(0,q.jsx)(I,{placeholder:f()})}),(0,q.jsxs)(F,{children:[(0,q.jsx)(P,{value:J,children:ce()}),je.map(e=>(0,q.jsx)(P,{value:e,children:e},e))]})]}),(0,q.jsxs)(W,{value:l,onValueChange:u,children:[(0,q.jsx)(U,{size:`sm`,className:`w-32`,children:(0,q.jsx)(I,{placeholder:g()})}),(0,q.jsxs)(F,{children:[(0,q.jsx)(P,{value:J,children:se()}),Me.map(e=>(0,q.jsx)(P,{value:e,children:e},e))]})]}),(0,q.jsxs)(W,{value:o,onValueChange:R,children:[(0,q.jsx)(U,{size:`sm`,className:`w-36`,children:(0,q.jsx)(I,{placeholder:s()})}),(0,q.jsxs)(F,{children:[(0,q.jsx)(P,{value:J,children:w()}),Q.map(e=>(0,q.jsx)(P,{value:e,children:e},e))]})]})]}),(0,q.jsx)(Oe,{title:c(),rows:Z,emptyHint:i===`open`?ne():oe(),rowActions:e=>X&&e.status===`open`?[{label:m(),onSelect:()=>void Ve(e)},{label:re(),onSelect:()=>void He(e)}]:[],columns:[{header:ae(),cell:e=>(0,q.jsx)(`span`,{className:`oc-traces__time`,children:Te(e.at)}),sort:e=>e.at},{header:s(),cell:e=>(0,q.jsx)(`code`,{className:`oc-traces__mono`,children:e.kind}),sort:e=>e.kind},{header:f(),cell:e=>(0,q.jsx)(Le,{severity:e.severity}),sort:e=>e.severity===`critical`?2:+(e.severity===`warn`)},{header:te(),cell:e=>(0,q.jsx)($,{status:e.status}),sort:e=>e.status===`resolved`?2:+(e.status===`acknowledged`)},{header:g(),cell:e=>(0,q.jsx)(H,{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:p(),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=L();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:[`↗ `,o()]}):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:[`↗ `,o()]}):null]})}function Ie({row:e}){let[t,n]=(0,K.useState)(!1),r=h(v.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:[a(),e.attachments.length>1?` (${e.attachments.length})`:``]}),(0,q.jsx)(R,{open:t,onOpenChange:n,children:(0,q.jsxs)(z,{className:`oc-anomaly__attachments-dialog`,children:[(0,q.jsx)(V,{children:(0,q.jsx)(B,{children:d()})}),r===void 0?(0,q.jsx)(`p`,{className:`oc-traces__muted`,children:u()}):r.length===0?(0,q.jsx)(`p`,{className:`oc-traces__muted`,children:l()}):(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)(H,{variant:`destructive`,children:y()}):e===`acknowledged`?(0,q.jsx)(H,{variant:`secondary`,children:i()}):(0,q.jsx)(H,{variant:`outline`,children:b()})}function Re(e){return e.length>8?e.slice(0,8):e}export{X as AnomaliesTab};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{c as e,i as t,r as n}from"./bundle-mjs-BJq7W7j9.js";import{$t as r,Cb as i,Eb as a,Sb as o,Tb as s,VM as c,_b as l,bb as u,c as d,en as f,fb as p,gb as m,hb as h,in as g,mb as _,nn as v,pb as y,rn as b,tn as x,vb as S,wb as C,xb as w,yb as T}from"./dist--_yEYc8n.js";import{C as E,S as D,T as O,Xt as k,Zt as A,a as j,i as M,n as N,o as P,s as F,tt as I,w as L,x as R}from"./index-CMhwTTOU.js";import{n as ee}from"./TimeRangePicker-D2BzLnpx.js";import{t as z}from"./FilterBar-88imPMtz.js";import{t as B}from"./AdvancedFilter-BTHZYRGc.js";import{t as V}from"./DataTableShell-DvxbPdB7.js";var H=e(t(),1),U=n(),W={kind:`relative`,from:N,to:`now`},G=`__all__`,K=[{value:`action`,label:g()},{value:`realLabel`,label:b()},{value:`targetLabel`,label:v()},{value:`impersonated`,label:x()},{value:`resource`,label:f()},{value:`resourceId`,label:r()}];function q(){let e=A({from:`/settings/audit`}),t=k({from:`/settings/audit`}),n=e.q??``,r=e.action??G,f=e.impersonated??G,g=e.resource??G,v=M(e.from,e.to),b=(0,H.useMemo)(()=>F(e.adv),[e.adv]),{from:x,to:N}=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,...P(e)})}),Q=e=>void t({search:t=>({...t,adv:j(e)}),replace:!0}),$=c(d.admin.listAudit,{filter:{q:n||void 0,from:x,to:N,action:r===G?void 0:r,resource:g===G?void 0:g,impersonated:f===G?void 0:f===`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||f!==G||g!==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:[a(),` `,(0,U.jsx)(`span`,{className:`oc-filter__window`,children:s()})]}),(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:o()}),te.map(e=>(0,U.jsx)(E,{value:e,children:e},e))]})]}),(0,U.jsxs)(R,{value:f,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:u()}),(0,U.jsx)(E,{value:`no`,children:T()})]})]}),(0,U.jsxs)(R,{value:g,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:l()}),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:m(),rows:$,emptyHint:h(),columns:[{header:_(),cell:e=>I(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:p(),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{c as e,i as t,r as n}from"./bundle-mjs-BJq7W7j9.js";import{$m as r,Ag as i,Ah as a,BM as o,Bh as s,Bs as c,Cg as l,Ch as u,Ct as d,Dg as f,Dh as p,Eg as m,Eh as h,Fh as ee,Gh as te,Gs as g,Hh as ne,Hs as _,Ih as re,Is as v,Jh as ie,Js as y,Kh as ae,Ks as b,Lh as x,Ls as oe,Mh as se,Ms as ce,Nh as le,Oh as ue,Ot as de,Ph as fe,Qm as pe,RM as me,Rh as he,Rs as ge,Sg as _e,Sh as ve,St as ye,Tg as be,Th as xe,Tt as Se,Uh as Ce,Us as we,VM as S,Vh as Te,Vs as Ee,Wh as De,Ws as Oe,Zm as C,_g as ke,_h as Ae,ah as je,bg as Me,bh as Ne,c as w,ch as Pe,dh as T,eh as Fe,fh as Ie,gg as Le,gh as Re,hh as ze,ih as Be,jh as Ve,kg as He,kh as Ue,l as We,lh as Ge,mh as Ke,nh as qe,oh as Je,ph as Ye,qh as Xe,qs as Ze,rh as Qe,sh as $e,th as et,uh as tt,vh as nt,wg as rt,wh as it,wt as at,xg as ot,xh as st,xt as ct,yh as lt,zh as ut,zs as dt}from"./dist--_yEYc8n.js";import{i as E,r as ft}from"./dist-CktYgUtY.js";import{t as pt}from"./chevrons-up-down-CPbErSVv.js";import{i as mt,n as D,o as ht,r as gt,s as _t}from"./FieldLabel-C15_DFF2.js";import{i as vt,n as yt,r as bt,t as xt}from"./tabs-HTb97o34.js";import{t as St}from"./button-DgrHAwnL.js";import{$ as Ct,B as wt,Bt as Tt,C as O,Jt as k,Pt as A,Q as Et,S as j,St as Dt,T as M,Xt as Ot,Z as kt,Zt as At,dt as jt,ft as Mt,gt as Nt,h as Pt,ht as Ft,jt as N,lt as P,m as It,nt as F,pt as Lt,qt as Rt,tt as zt,ut as I,w as L,x as R}from"./index-CMhwTTOU.js";import{r as Bt}from"./locales-CPjguROj.js";import{a as Vt,i as z,n as B,o as V,r as H,t as U}from"./table-B58636RR.js";import{t as Ht}from"./FilterBar-88imPMtz.js";import{a as W,n as Ut,o as Wt,r as Gt,s as Kt,t as qt}from"./compatView-CmR9qhhp.js";import{t as G}from"./dispatchErrorInfo-BCoejmqa.js";var Jt=We(`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`}]]),Yt=We(`wifi-off`,[[`path`,{d:`M12 20h.01`,key:`zekei9`}],[`path`,{d:`M8.5 16.429a5 5 0 0 1 7 0`,key:`1bycff`}],[`path`,{d:`M5 12.859a10 10 0 0 1 5.17-2.69`,key:`1dl1wf`}],[`path`,{d:`M19 12.859a10 10 0 0 0-2.007-1.523`,key:`4k23kn`}],[`path`,{d:`M2 8.82a15 15 0 0 1 4.177-2.643`,key:`1grhjp`}],[`path`,{d:`M22 8.82a15 15 0 0 0-11.288-3.764`,key:`z3jwby`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}]]),K=e(t(),1);function Xt(e){return e.filter(e=>e.state===`error`)}function Zt(e){return e.reachable&&Xt(e.targets).length===0}function Qt(e){return Zt(e)?(e.unreachableInstances??[]).length>0?`gateways_unreachable`:`ok`:`error`}function $t(e){return e.state===`error`&&e.lastErrorCode!==null}function en(e){return!!e.lastDownstreamRejectCode}function q(e){return e.kind??`openclaw`}function tn(e){return[...e].sort((e,t)=>e===`openclaw`?-1:t===`openclaw`?1:e.localeCompare(t))}function nn(e,t,n){let r=new Map;for(let e of t)e.instanceName&&r.set(e.instanceName,e.provider);for(let e of n)r.set(e.name,q(e));let i=e=>(e.instanceName?r.get(e.instanceName):void 0)??`openclaw`,a=new Set;for(let e of n)a.add(q(e));for(let e of t)a.add(e.provider);for(let t of e)a.add(i(t));return tn(a).map(r=>({key:r,connections:e.filter(e=>i(e)===r),compatTargets:t.filter(e=>e.provider===r),instances:n.filter(e=>q(e)===r)}))}function J(e){return e===`openclaw`?`OpenClaw`:e===`hermes`?`Hermes`:e.charAt(0).toUpperCase()+e.slice(1)}var Y=`__all__`,rn={q:``,state:Y,instance:Y,version:Y},X={connected:0,error:1,idle:2};function an(e){return e.q.trim()!==``||e.state!==`__all__`||e.instance!==`__all__`||e.version!==`__all__`}function on(e,t){let n=t.q.trim().toLowerCase();return e.filter(e=>!(n&&!`${e.targetLabel} ${e.gatewayHost}`.toLowerCase().includes(n)||t.state!==`__all__`&&e.state!==t.state||t.instance!==`__all__`&&(e.instanceName??``)!==t.instance||t.version!==`__all__`&&(e.gatewayVersion??``)!==t.version))}function Z(e,t){return e.localeCompare(t,void 0,{numeric:!0,sensitivity:`base`})}function sn(e,t){return e===`version`?t.gatewayVersion===null:e===`lastOk`?t.lastOkAt===null:!1}function cn(e,t,n){switch(e){case`state`:return(X[t.state]??99)-(X[n.state]??99);case`instance`:return Z(t.instanceLabel??t.instanceName??``,n.instanceLabel??n.instanceName??``);case`host`:return Z(t.gatewayHost,n.gatewayHost);case`version`:{let e=t.gatewayVersion,r=n.gatewayVersion;return Wt(e,r)??Z(e,r)}case`lastOk`:return t.lastOkAt-n.lastOkAt;default:return Z(t.targetLabel,n.targetLabel)}}function ln(e,t){if(!t)return e;let n=t.dir===`asc`?1:-1;return[...e].sort((e,r)=>{let i=sn(t.key,e),a=sn(t.key,r);return i&&a?0:i?1:a?-1:n*cn(t.key,e,r)})}function un(e){let t=new Set;for(let n of e)t.add(n.state);return[...t].sort((e,t)=>(X[e]??99)-(X[t]??99))}function dn(e){let t=new Map;for(let n of e)n.instanceName!==null&&(t.has(n.instanceName)||t.set(n.instanceName,n.instanceLabel??n.instanceName));return[...t.entries()].map(([e,t])=>({name:e,label:t})).sort((e,t)=>Z(e.label,t.label))}function fn(e){let t=new Set;for(let n of e)n.gatewayVersion!==null&&t.add(n.gatewayVersion);return[...t].sort((e,t)=>Wt(e,t)??Z(e,t))}var Q=n();function pn({connections:e,displayByInstance:t}){let[n,r]=(0,K.useState)(rn),[i,a]=(0,K.useState)(null),o=(0,K.useMemo)(()=>e.map((e,n)=>({_id:`${e.key}:${e.canonical}/${e.agentId}:${n}`,targetLabel:`${e.canonical}/${e.agentId}`,state:e.state,instanceName:e.instanceName??null,instanceLabel:e.instanceName?t.get(e.instanceName)??e.instanceName:null,gatewayHost:e.gatewayHost,gatewayVersion:e.gatewayVersion??null,okCount:e.okCount,errorCount:e.errorCount+(e.downstreamRejectCount??0),attempts:e.attempts,lastOkAt:e.lastOkAt??null,lastErrorCode:e.lastErrorCode??null,lastErrorAt:e.lastErrorAt??null,lastDownstreamRejectCode:e.lastDownstreamRejectCode??null,lastDownstreamRejectAt:e.lastDownstreamRejectAt??null})),[e,t]),s=(0,K.useMemo)(()=>un(o),[o]),c=(0,K.useMemo)(()=>dn(o),[o]),l=(0,K.useMemo)(()=>fn(o),[o]),u=(0,K.useMemo)(()=>ln(on(o,n),i),[o,n,i]);function d(e){a(t=>t?.key===e?t.dir===`asc`?{key:e,dir:`desc`}:null:{key:e,dir:`asc`})}return e.length===0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:ze()}):(0,Q.jsxs)(`div`,{className:`oc-conn`,children:[(0,Q.jsxs)(Ht,{q:n.q,onQChange:e=>r(t=>({...t,q:e})),searchPlaceholder:Ie(),onReset:()=>r(rn),canReset:an(n),children:[(0,Q.jsxs)(R,{value:n.state,onValueChange:e=>r(t=>({...t,state:e})),children:[(0,Q.jsx)(L,{size:`sm`,className:`w-36`,children:(0,Q.jsx)(M,{placeholder:tt()})}),(0,Q.jsxs)(j,{children:[(0,Q.jsx)(O,{value:Y,children:T()}),s.map(e=>(0,Q.jsx)(O,{value:e,children:hn(e)},e))]})]}),(0,Q.jsxs)(R,{value:n.instance,onValueChange:e=>r(t=>({...t,instance:e})),children:[(0,Q.jsx)(L,{size:`sm`,className:`w-40`,children:(0,Q.jsx)(M,{placeholder:Ge()})}),(0,Q.jsxs)(j,{children:[(0,Q.jsx)(O,{value:Y,children:T()}),c.map(e=>(0,Q.jsx)(O,{value:e.name,children:e.label},e.name))]})]}),(0,Q.jsxs)(R,{value:n.version,onValueChange:e=>r(t=>({...t,version:e})),children:[(0,Q.jsx)(L,{size:`sm`,className:`w-36`,children:(0,Q.jsx)(M,{placeholder:Pe()})}),(0,Q.jsxs)(j,{children:[(0,Q.jsx)(O,{value:Y,children:T()}),l.map(e=>(0,Q.jsx)(O,{value:e,children:e},e))]})]})]}),u.length===0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:$e()}):(0,Q.jsxs)(U,{className:`oc-conn__table`,children:[(0,Q.jsx)(Vt,{children:(0,Q.jsxs)(V,{children:[(0,Q.jsx)($,{label:Je(),sortKey:`target`,sort:i,onSort:d}),(0,Q.jsx)($,{label:je(),sortKey:`state`,sort:i,onSort:d}),(0,Q.jsx)($,{label:Be(),sortKey:`instance`,sort:i,onSort:d}),(0,Q.jsx)($,{label:Qe(),sortKey:`host`,sort:i,onSort:d}),(0,Q.jsx)($,{label:qe(),sortKey:`version`,sort:i,onSort:d}),(0,Q.jsx)(z,{children:et()}),(0,Q.jsx)($,{label:Fe(),sortKey:`lastOk`,sort:i,onSort:d})]})}),(0,Q.jsx)(B,{children:u.map(e=>(0,Q.jsx)(mn,{r:e},e._id))})]})]})}function $({label:e,sortKey:t,sort:n,onSort:r}){let i=n?.key===t,a=i?n.dir:null;return(0,Q.jsx)(z,{"aria-sort":i?a===`asc`?`ascending`:`descending`:`none`,children:(0,Q.jsxs)(`button`,{type:`button`,className:`oc-conn__sort`,onClick:()=>r(t),children:[e,i?a===`asc`?(0,Q.jsx)(ft,{size:13,"aria-hidden":!0}):(0,Q.jsx)(E,{size:13,"aria-hidden":!0}):(0,Q.jsx)(pt,{size:13,"aria-hidden":!0,className:`oc-conn__sort-idle`})]})})}function mn({r:e}){let t=$t(e)?G(e.lastErrorCode):null,n=en(e)?G(e.lastDownstreamRejectCode):null;return(0,Q.jsxs)(K.Fragment,{children:[(0,Q.jsxs)(V,{className:`oc-conn__row oc-conn__row--${e.state}`,children:[(0,Q.jsx)(H,{children:(0,Q.jsx)(`code`,{className:`oc-traces__mono`,children:e.targetLabel})}),(0,Q.jsx)(H,{children:(0,Q.jsx)(gn,{state:e.state})}),(0,Q.jsx)(H,{children:e.instanceLabel?(0,Q.jsx)(`span`,{className:`oc-bridge-target__instance`,children:e.instanceLabel}):(0,Q.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})}),(0,Q.jsx)(H,{children:(0,Q.jsx)(`span`,{className:`oc-bridge-target__host`,children:e.gatewayHost})}),(0,Q.jsx)(H,{children:e.gatewayVersion?(0,Q.jsx)(`span`,{className:`oc-bridge-target__version`,children:e.gatewayVersion}):(0,Q.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})}),(0,Q.jsx)(H,{children:(0,Q.jsx)(`span`,{className:`oc-conn__stats`,children:Ke({ok:e.okCount,errors:e.errorCount,attempts:e.attempts})})}),(0,Q.jsx)(H,{children:e.lastOkAt?(0,Q.jsx)(`span`,{className:`oc-traces__mono`,children:F(e.lastOkAt)}):(0,Q.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})})]}),t||n?(0,Q.jsx)(V,{className:`oc-conn__detail-row`,children:(0,Q.jsxs)(H,{colSpan:7,className:`oc-conn__detail-cell`,children:[t?(0,Q.jsxs)(`div`,{className:`oc-bridge-target__error`,children:[(0,Q.jsx)(`strong`,{children:t.label}),` `,(0,Q.jsx)(`code`,{className:`oc-traces__mono`,children:e.lastErrorCode}),e.lastErrorAt?` · ${F(e.lastErrorAt)}`:``,(0,Q.jsx)(`p`,{className:`oc-bridge-card__hint`,children:t.hint})]}):null,n?(0,Q.jsxs)(`div`,{className:`oc-bridge-target__downstream`,children:[Ye({label:n.label}),` `,(0,Q.jsx)(`code`,{className:`oc-traces__mono`,children:e.lastDownstreamRejectCode}),e.lastDownstreamRejectAt?` · ${F(e.lastDownstreamRejectAt)}`:``]}):null]})}):null]})}function hn(e){return e===`connected`?r():e===`error`?pe():C()}function gn({state:e}){return e===`connected`?(0,Q.jsx)(P,{variant:`secondary`,children:r()}):e===`error`?(0,Q.jsx)(P,{variant:`destructive`,children:pe()}):(0,Q.jsx)(P,{variant:`outline`,children:C()})}function _n(){return S(w.bridgeHealth.getBridgeHealth,{})}function vn(){let e=_n(),t=S(w.compat.getBridgeCompat,{}),n=S(w.me.getMe,{host:Dt})?.role===`admin`,r=S(w.admin.listInstances,n?{}:`skip`),i=S(w.agents.usageForInstances,n?{}:`skip`),a=Ot(),o=()=>void a({to:`/settings/anomalies`,search:{status:`open`}}),s=nn(e?e.targets:[],t?t.targets:[],r??[]),{section:c}=At({from:`/settings/bridge`}),l=Ot({from:`/settings/bridge`}),u=t?.compat??null,f=t===void 0?`loading`:t===null?`nodata`:`ready`,p=u!==null&&Ut(u,`hermes`)&&!s.some(e=>e.key===`hermes`);return(0,Q.jsxs)(`div`,{className:`oc-bridge`,children:[(0,Q.jsx)(yn,{health:e,compat:t,onSeeAnomalies:o}),(0,Q.jsx)(`p`,{className:`oc-admin__hint oc-bridge__caption`,children:fe()}),i&&i.length>0?(0,Q.jsxs)(`section`,{className:`oc-bridge__usage`,children:[(0,Q.jsx)(`h3`,{className:`oc-bridge__usage-title`,children:le()}),(0,Q.jsxs)(U,{children:[(0,Q.jsx)(Vt,{children:(0,Q.jsxs)(V,{children:[(0,Q.jsx)(z,{children:Se()}),(0,Q.jsx)(z,{children:at()}),(0,Q.jsx)(z,{children:d()}),(0,Q.jsx)(z,{children:ye()}),(0,Q.jsx)(z,{children:ct()})]})}),(0,Q.jsx)(B,{children:i.flatMap(e=>{let t=Pt(e.usage,Date.now());return t?t.windows.map((t,n)=>(0,Q.jsxs)(V,{children:[(0,Q.jsx)(H,{className:`font-medium`,children:n===0?e.instanceName:``}),(0,Q.jsx)(H,{children:t.provider}),(0,Q.jsx)(H,{children:t.label}),(0,Q.jsx)(H,{children:(0,Q.jsxs)(P,{variant:t.percentLeft<=10?`destructive`:t.percentLeft<=25?`outline`:`secondary`,children:[t.percentLeft,`%`]})}),(0,Q.jsx)(H,{className:`text-muted-foreground`,children:t.resetText??`—`})]},`${e.instanceName}:${t.provider}:${t.label}`)):[]})})]})]}):null,s.length>0?(0,Q.jsxs)(xt,{value:s.some(e=>e.key===c)?c:s[0]?.key??`openclaw`,onValueChange:e=>void l({search:{section:e},replace:!0}),children:[(0,Q.jsx)(bt,{className:`w-full`,children:s.map(e=>(0,Q.jsxs)(vt,{value:e.key,className:`flex-1 gap-1.5`,children:[(0,Q.jsx)(A,{size:13,"aria-hidden":!0}),J(e.key)]},e.key))}),s.map(e=>(0,Q.jsx)(yt,{value:e.key,children:(0,Q.jsx)(bn,{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,Q.jsx)(`p`,{className:`oc-admin__hint`,children:ce()}):null]})}function yn({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,Q.jsxs)(`span`,{className:`oc-bridge-card__ver`,children:[(0,Q.jsx)(`code`,{className:`oc-traces__mono`,children:W(t.bridgeVersion)}),i?(0,Q.jsxs)(Q.Fragment,{children:[` `,(0,Q.jsxs)(`code`,{className:`oc-traces__mono`,title:b(),children:[`(`,i,`)`]})]}):null,r?(0,Q.jsxs)(`strong`,{className:`oc-bridge-card__mismatch`,children:[` `,g({build:t.buildVersion??`?`})]}):null,` · `,Oe(),` `,(0,Q.jsx)(`code`,{className:`oc-traces__mono`,children:t.protocolVersion===null?we():String(t.protocolVersion)})]}):null;if(e===void 0)return(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:h()});if(e===null)return(0,Q.jsx)(`div`,{className:`oc-bridge-card oc-bridge-card--idle`,children:xe()});let o=Xt(e.targets),s=!e.reachable,c=Qt(e),l=e.unreachableInstances??[],d=c===`ok`?`ok`:c===`gateways_unreachable`?`warn`:`error`,f=zt(e.checkedAt),p=e.startedAt==null?null:zt(e.startedAt);return(0,Q.jsxs)(`div`,{className:`oc-bridge-card oc-bridge-card--${d}`,children:[(0,Q.jsx)(`div`,{className:`oc-bridge-card__icon`,"aria-hidden":!0,children:c===`ok`?(0,Q.jsx)(Rt,{size:22}):s||c===`gateways_unreachable`?(0,Q.jsx)(Yt,{size:22}):(0,Q.jsx)(N,{size:22})}),(0,Q.jsxs)(`div`,{className:`oc-bridge-card__body`,children:[(0,Q.jsx)(`div`,{className:`oc-bridge-card__title`,children:c===`ok`?it():c===`gateways_unreachable`?Ne({count:l.length}):s?u():ve({count:o.length})}),(0,Q.jsxs)(`div`,{className:`oc-bridge-card__meta`,children:[(0,Q.jsxs)(`span`,{children:[(0,Q.jsx)(Jt,{size:12,"aria-hidden":!0}),` `,st({time:f})]}),p?(0,Q.jsx)(`span`,{children:nt({time:p})}):null,a]}),c===`gateways_unreachable`?(0,Q.jsx)(`p`,{className:`oc-bridge-card__hint`,children:lt({names:l.join(`, `)})}):null,s?(0,Q.jsx)(`p`,{className:`oc-bridge-card__hint`,children:G(e.lastError===`not_configured`?`NOT_CONFIGURED`:`BRIDGE_UNREACHABLE`).hint}):null]}),(0,Q.jsx)(`button`,{type:`button`,className:`oc-bridgebar__drill`,onClick:n,children:Ae()})]})}function bn({providerKey:e,connections:t,instances:n,manifest:r,compatStatus:i,compatReachable:a,protocol:o}){let s=r?Kt(r,e):null,c=new Map;for(let e of n)c.set(e.name,e.displayName??e.name);let l=[],u=new Set;for(let n of t){if(!n.instanceName||u.has(n.instanceName))continue;u.add(n.instanceName);let t=n.gatewayVersion??null;l.push({instanceName:n.instanceName,displayName:c.get(n.instanceName)??n.instanceName,version:t,state:qt(t,e,r)})}let d=l.map(e=>e.state),f=d.includes(`beyond`)?`beyond`:d.length>0&&d.every(e=>e===`supported`)?`supported`:null,[p,m]=(0,K.useState)(!1);return(0,Q.jsxs)(`section`,{className:`oc-bridge-provider`,children:[(0,Q.jsxs)(`header`,{className:`oc-bridge-provider__head`,children:[(0,Q.jsx)(A,{size:15,"aria-hidden":!0,className:`oc-bridge-provider__icon`}),(0,Q.jsx)(`span`,{className:`oc-bridge-provider__name`,children:J(e)}),f?(0,Q.jsx)(P,{variant:f===`beyond`?`destructive`:`secondary`,children:Gt(f)}):null]}),(0,Q.jsx)(`h4`,{className:`oc-bridge-provider__sub`,children:y()}),(0,Q.jsx)(Sn,{providerName:J(e),support:s,compatStatus:i,compatReachable:a,manifest:r,instanceRows:l}),o?(0,Q.jsx)(xn,{protocol:o}):null,(0,Q.jsxs)(`button`,{type:`button`,className:`oc-bridge-provider__sub oc-bridge-provider__sub--toggle`,"aria-expanded":p,onClick:()=>m(e=>!e),children:[p?(0,Q.jsx)(E,{size:13,"aria-hidden":!0}):(0,Q.jsx)(k,{size:13,"aria-hidden":!0}),Re({count:t.length})]}),p?(0,Q.jsx)(pn,{connections:t,displayByInstance:c}):null]})}function xn({protocol:e}){let[t,n]=(0,K.useState)(!1),r=e.coverage,i=e.drift??[];return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`h4`,{className:`oc-bridge-provider__sub`,children:[se(),i.length>0?(0,Q.jsx)(P,{variant:`destructive`,children:a({count:i.length})}):(0,Q.jsx)(P,{variant:`secondary`,children:Ve()})]}),(0,Q.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,Q.jsx)(`ul`,{className:`oc-bridge-protocol__list`,role:`list`,children:i.map(e=>(0,Q.jsxs)(`li`,{children:[(0,Q.jsx)(`code`,{className:`oc-traces__mono`,children:e.shape}),` × `,e.count]},e.shape))}):null,r&&r.gapList.length>0?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`button`,{type:`button`,className:`oc-bridge-provider__sub oc-bridge-provider__sub--toggle`,"aria-expanded":t,onClick:()=>n(e=>!e),children:[t?(0,Q.jsx)(E,{size:13,"aria-hidden":!0}):(0,Q.jsx)(k,{size:13,"aria-hidden":!0}),p({count:r.gapList.length})]}),t?(0,Q.jsx)(`ul`,{className:`oc-bridge-protocol__list`,role:`list`,children:r.gapList.map(e=>(0,Q.jsx)(`li`,{children:(0,Q.jsx)(`code`,{className:`oc-traces__mono`,children:e})},e))}):null]}):null]})}function Sn({support:e,compatStatus:t,compatReachable:n,manifest:r,instanceRows:i,providerName:a}){return t===`loading`?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:h()}):t===`nodata`?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:Ze()}):(0,Q.jsxs)(`div`,{className:`oc-compat`,children:[n?null:(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:_()}),r===null?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:Ee()}):(0,Q.jsxs)(`div`,{className:`oc-compat__support`,children:[(0,Q.jsx)(`span`,{className:`oc-compat__label`,children:de({provider:a})}),e&&e.range!==null?(0,Q.jsx)(`span`,{children:c({min:e.range.min,max:e.range.maxValidated})}):(0,Q.jsx)(`span`,{children:we()}),e?(0,Q.jsx)(En,{versions:e.validatedVersions}):null]}),i.length===0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:v()}):(0,Q.jsx)(`div`,{className:`oc-compat__targets`,children:i.map(e=>(0,Q.jsxs)(`div`,{className:`oc-compat__target`,children:[(0,Q.jsx)(`span`,{className:`oc-compat__instance`,children:e.displayName}),(0,Q.jsx)(`code`,{className:`oc-traces__mono`,children:W(e.version)}),(0,Q.jsx)(P,{variant:e.state===`supported`?`secondary`:e.state===`beyond`?`destructive`:`outline`,children:Gt(e.state)})]},e.instanceName))})]})}function Cn({instance:e,onClose:t}){return(0,Q.jsx)(jt,{open:!0,onOpenChange:e=>!e&&t(),children:(0,Q.jsxs)(Mt,{className:`oc-bridge-config-dialog`,onOpenAutoFocus:e=>e.preventDefault(),children:[(0,Q.jsxs)(Ft,{children:[(0,Q.jsx)(Nt,{children:i({instance:e.displayName??e.name})}),(0,Q.jsx)(Lt,{children:He()})]}),(0,Q.jsx)(Tn,{instance:e,onClose:t})]})})}function wn({label:e,result:t}){return t?t.checked?(0,Q.jsxs)(`p`,{className:`oc-bridge-config__check-row `+(t.ok?`oc-bridge-config__check-row--ok`:`oc-bridge-config__check-row--err`),children:[t.ok?(0,Q.jsx)(Rt,{"aria-hidden":!0}):(0,Q.jsx)(N,{"aria-hidden":!0}),(0,Q.jsxs)(`span`,{children:[e,` — `,t.ok?he():t.detail]})]}):(0,Q.jsxs)(`p`,{className:`oc-bridge-config__check-row oc-bridge-config__check-row--skip`,children:[e,` — `,x()]}):null}function Tn({instance:e,onClose:t}){let n=o(w.admin.upsertInstanceConfig),r=me(w.bridge.validateMediaPaths),i=wt(),a=Bt(e.config?.contentLocale,void 0),[c,u]=(0,K.useState)(()=>mt(e.config??{},a)),[d,p]=(0,K.useState)(!1),[h,g]=(0,K.useState)(!1),[_,v]=(0,K.useState)(null),y=c.inboundMediaMode===`shared-fs`,b=c.mediaMode===`shared-fs`,x=y||b;async function oe(){g(!0),v(null);try{v(await r({instanceName:e.name,inboundMediaMode:c.inboundMediaMode,mediaMode:c.mediaMode}))}catch(e){i.error(ne(),e)}finally{g(!1)}}async function se(){p(!0);try{let r=e.config??{};await n({instanceId:e._id,config:gt(c,r,a)}),t()}catch(e){i.error(_e(),e)}finally{p(!1)}}return(0,Q.jsx)(`div`,{className:`oc-bridge-config`,children:(0,Q.jsxs)(`div`,{className:`oc-bridge-config__form`,children:[(0,Q.jsxs)(`div`,{className:`oc-bridge-config__grid`,children:[(0,Q.jsxs)(`label`,{className:`oc-field`,children:[(0,Q.jsx)(D,{label:f(),help:ot()}),(0,Q.jsxs)(R,{value:c.mediaMode,onValueChange:e=>u({...c,mediaMode:e}),children:[(0,Q.jsx)(L,{size:`sm`,className:`w-full`,children:(0,Q.jsx)(M,{})}),(0,Q.jsx)(j,{children:_t.map(e=>(0,Q.jsx)(O,{value:e,children:e},e))})]})]}),(0,Q.jsxs)(`label`,{className:`oc-field`,children:[(0,Q.jsx)(D,{label:m(),help:Me()}),(0,Q.jsxs)(R,{value:c.inboundMediaMode,onValueChange:e=>u({...c,inboundMediaMode:e}),children:[(0,Q.jsx)(L,{size:`sm`,className:`w-full`,children:(0,Q.jsx)(M,{})}),(0,Q.jsx)(j,{children:ht.map(e=>(0,Q.jsx)(O,{value:e,children:e},e))})]})]}),(0,Q.jsxs)(`label`,{className:`oc-field`,children:[(0,Q.jsx)(D,{label:be(),help:ke()}),(0,Q.jsx)(I,{type:`number`,min:1,max:4096,className:`w-full`,value:c.mediaMaxMb,onChange:e=>u({...c,mediaMaxMb:Math.trunc(Number(e.target.value)||0)})})]})]}),x&&(0,Q.jsxs)(`div`,{className:`oc-bridge-config__grid`,children:[y&&(0,Q.jsxs)(`label`,{className:`oc-field`,children:[(0,Q.jsx)(D,{label:ie(),help:Xe()}),(0,Q.jsx)(I,{className:`w-full`,spellCheck:!1,value:c.inboundAgentMount,onChange:e=>u({...c,inboundAgentMount:e.target.value})})]}),b&&(0,Q.jsxs)(`label`,{className:`oc-field`,children:[(0,Q.jsx)(D,{label:ae(),help:te()}),(0,Q.jsx)(I,{className:`w-full`,spellCheck:!1,value:c.outboundAgentMount,onChange:e=>u({...c,outboundAgentMount:e.target.value})})]})]}),(0,Q.jsxs)(`label`,{className:`oc-field--row`,children:[(0,Q.jsx)(It,{checked:c.rehydration,onCheckedChange:e=>u({...c,rehydration:e===!0})}),(0,Q.jsx)(D,{label:rt(),help:Le()})]}),x&&_!==null&&(0,Q.jsx)(`div`,{className:`oc-bridge-config__check`,children:_.reachable?!_.inbound&&!_.outbound?(0,Q.jsxs)(`p`,{className:`oc-bridge-config__check-row oc-bridge-config__check-row--err`,children:[(0,Q.jsx)(N,{"aria-hidden":!0}),ee({reason:_.reason??`?`})]}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(wn,{label:s(),result:_.inbound}),(0,Q.jsx)(wn,{label:ut(),result:_.outbound}),(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:Te()})]}):(0,Q.jsxs)(`p`,{className:`oc-bridge-config__check-row oc-bridge-config__check-row--err`,children:[(0,Q.jsx)(N,{"aria-hidden":!0}),re()]})}),(0,Q.jsxs)(`div`,{className:`oc-bridge-config__actions`,children:[x&&(0,Q.jsxs)(St,{variant:`outline`,size:`sm`,onClick:()=>void oe(),disabled:h,children:[h?(0,Q.jsx)(Tt,{className:`size-4 animate-spin`,"aria-hidden":!0}):null,h?Ce():De()]}),(0,Q.jsx)(St,{size:`sm`,onClick:()=>void se(),disabled:d,children:l()})]})]})})}function En({versions:e}){if(e.length===0)return null;let t=[...e].reverse();return(0,Q.jsxs)(kt,{children:[(0,Q.jsx)(Ct,{asChild:!0,children:(0,Q.jsxs)(`button`,{type:`button`,className:`oc-compat__versions-btn`,children:[e.length===1?dt():ge({count:e.length}),(0,Q.jsx)(E,{size:13,"aria-hidden":!0})]})}),(0,Q.jsxs)(Et,{className:`oc-compat__versions-pop`,align:`start`,children:[(0,Q.jsx)(`p`,{className:`oc-compat__versions-title`,children:oe()}),(0,Q.jsx)(`div`,{className:`oc-compat__versions-list`,children:t.map(e=>(0,Q.jsx)(P,{variant:`secondary`,children:e},e))})]})]})}export{vn as BridgeTab,Cn as InstanceConfigDialog};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{c as e,i as t,r as n}from"./bundle-mjs-BJq7W7j9.js";import{$s as r,BM as i,Ci as a,Di as o,Dt as s,Ei as c,MM as l,Nc as u,Og as d,Oi as f,Qs as p,RM as m,Si as h,Ti as g,VM as _,Xs as v,Ys as y,Zs as b,_l as x,bi as S,c as C,dl as w,ec as T,hl as E,ki as D,nc as O,rc as k,tc as A,ul as j,wi as M,xi as N}from"./dist--_yEYc8n.js";import{t as P}from"./button-DgrHAwnL.js";import{C as F,S as I,T as L,b as R,f as z,jt as B,m as V,p as H,ut as U,w as W,x as G}from"./index-CMhwTTOU.js";import{i as K}from"./compatView-CmR9qhhp.js";/* empty css */var q=e(t(),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=i(C.admin.upsertInstanceConfig),n=_(C.agents.listAgentsForInstance,{instanceName:e.name}),r=typeof e.config?.converterAgentId==`string`?e.config.converterAgentId:``,[a,o]=(0,q.useState)(r),[s,l]=(0,q.useState)(`idle`);(0,q.useEffect)(()=>{o(r),l(`idle`)},[e._id,r]);let u=`__none__`,d=a!==r;async function f(){l(`saving`);try{let n={...e.config??{}};a===``||a===u?delete n.converterAgentId:n.converterAgentId=a,await t({instanceId:e._id,config:n}),l(`done`)}catch{l(`error`)}}let p=n?.agents??[];return(0,X.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,X.jsx)(`span`,{className:`oc-cdefaults__label`,children:c()}),(0,X.jsx)(`p`,{className:`oc-admin__hint`,children:g()}),(0,X.jsxs)(`div`,{className:`oc-cdefaults__inline`,children:[(0,X.jsxs)(G,{value:a===``?u:a,onValueChange:e=>o(e===u?``:e),children:[(0,X.jsx)(W,{className:`oc-cdefaults__select`,"aria-label":c(),children:(0,X.jsx)(L,{placeholder:M()})}),(0,X.jsxs)(I,{children:[(0,X.jsx)(F,{value:u,children:M()}),p.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:!d||s===`saving`,onClick:()=>void f(),children:s===`saving`?x():b()})]}),s===`done`?(0,X.jsx)(`p`,{className:`oc-admin__hint`,role:`status`,children:v()}):null,s===`error`?(0,X.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:y()}):null]})}function Q({instance:e}){let t=i(C.admin.upsertInstanceConfig),n=e.config?.curationEnabled===!0,r=typeof e.config?.curationBudgetChars==`number`?e.config.curationBudgetChars:null,[s,c]=(0,q.useState)(n),[l,u]=(0,q.useState)(r===null?``:String(r)),[d,f]=(0,q.useState)(`idle`);(0,q.useEffect)(()=>{c(n),u(r===null?``:String(r)),f(`idle`)},[e._id,n,r]);let p=l.trim(),m=p===``?null:/^\d+$/.test(p)?Number.parseInt(p,10):NaN,g=!s||m===null||Number.isInteger(m)&&m>=4e3&&m<=6e4,_=s!==n||(m??null)!==r;async function S(){f(`saving`);try{let n={...e.config??{}};n.curationEnabled=s,!s||m===null||Number.isNaN(m)?delete n.curationBudgetChars:n.curationBudgetChars=m,await t({instanceId:e._id,config:n}),f(`done`)}catch{f(`error`)}}return(0,X.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,X.jsxs)(`label`,{className:`oc-cdefaults__inline`,style:{cursor:`pointer`},children:[(0,X.jsx)(V,{checked:s,onCheckedChange:e=>c(e===!0),"aria-label":o()}),(0,X.jsx)(`span`,{className:`oc-cdefaults__label`,children:o()})]}),(0,X.jsxs)(`div`,{className:`oc-cdefaults__inline`,children:[(0,X.jsx)(U,{type:`number`,min:4e3,max:6e4,step:1e3,placeholder:`20000`,value:l,onChange:e=>u(e.target.value),className:`oc-cdefaults__number`,"aria-invalid":!g,"aria-label":a(),disabled:!s}),(0,X.jsx)(P,{size:`sm`,disabled:!_||!g||d===`saving`,onClick:()=>void S(),children:d===`saving`?x():b()})]}),g?null:(0,X.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:h()}),d===`done`?(0,X.jsx)(`p`,{className:`oc-admin__hint`,role:`status`,children:v()}):null,d===`error`?(0,X.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:y()}):null,(0,X.jsx)(`p`,{className:`oc-cdefaults__help`,children:N()})]})}function $({instance:e}){let t=i(C.admin.upsertInstanceConfig),n=typeof e.config?.summarizeThresholdChars==`number`?e.config.summarizeThresholdChars:null,[r,a]=(0,q.useState)(n===null?``:String(n)),[o,s]=(0,q.useState)(`idle`);(0,q.useEffect)(()=>{a(n===null?``:String(n)),s(`idle`)},[e._id,n]);let c=r.trim(),l=c===``?null:/^\d+$/.test(c)?Number.parseInt(c,10):NaN,u=l===null||Number.isInteger(l)&&l>=1e3&&l<=2e5,d=(l??null)!==n;async function p(){s(`saving`);try{let n={...e.config??{}};l===null?delete n.summarizeThresholdChars:n.summarizeThresholdChars=l,await t({instanceId:e._id,config:n}),s(`done`)}catch{s(`error`)}}return(0,X.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,X.jsx)(`span`,{className:`oc-cdefaults__label`,children:D()}),(0,X.jsxs)(`div`,{className:`oc-cdefaults__inline`,children:[(0,X.jsx)(U,{type:`number`,min:1e3,max:2e5,step:1e3,placeholder:`8000`,value:r,onChange:e=>a(e.target.value),className:`oc-cdefaults__number`,"aria-invalid":!u}),(0,X.jsx)(P,{size:`sm`,disabled:!d||!u||o===`saving`,onClick:()=>void p(),children:o===`saving`?x():b()})]}),u?null:(0,X.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:S()}),o===`done`?(0,X.jsx)(`p`,{className:`oc-admin__hint`,role:`status`,children:v()}):null,o===`error`?(0,X.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:y()}):null,(0,X.jsx)(`p`,{className:`oc-cdefaults__help`,children:f()})]})}function ee(){let e=m(C.agentFiles.getChatDefaults),[t,n]=(0,q.useState)({status:`loading`}),i=_(C.admin.listInstances,{}),[a,o]=(0,q.useState)(null);(0,q.useEffect)(()=>{!i||i.length===0||(!a||!i.some(e=>e.name===a))&&o(i[0].name)},[i,a]);let c=(i?.length??0)>1,f=i!==void 0&&i.length===0,h=_(C.compat.forInstance,a?{instanceName:a}:`skip`),g=a?R(h,`configDefaults`):`loading`,v=g===`loading`?null:g.blocked,y=(0,q.useMemo)(()=>c&&a?{instanceName:a}:{},[c,a]),b=(0,q.useRef)(0),x=(0,q.useCallback)(async()=>{let t=++b.current;n({status:`loading`});try{let r=Y(await e(y));if(b.current!==t)return;n({status:`done`,current:r})}catch{if(b.current!==t)return;n({status:`error`})}},[e,y]);(0,q.useEffect)(()=>{v===!1&&(c&&!a||x())},[x,v,c,a]);let S=t.status===`done`?t.current:null,D=(0,q.useMemo)(()=>J.map(e=>({id:e,label:H(e)})),[]),M=(0,q.useMemo)(()=>[{id:`fast`,label:w()},{id:`standard`,label:j()}],[]);return(0,X.jsxs)(`div`,{className:`oc-cdefaults`,children:[(0,X.jsx)(`p`,{className:`oc-admin__hint`,children:k()}),c&&a?(0,X.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,X.jsx)(`span`,{className:`oc-cdefaults__label`,children:u()}),(0,X.jsxs)(G,{value:a,onValueChange:e=>o(e),children:[(0,X.jsx)(W,{size:`sm`,"aria-label":u(),children:(0,X.jsx)(L,{})}),(0,X.jsx)(I,{children:(i??[]).map(e=>(0,X.jsx)(F,{value:e.name,children:e.name},e.name))})]})]}):null,f?(0,X.jsx)(`p`,{className:`oc-admin__hint`,role:`status`,children:d()}):g===`loading`?(0,X.jsx)(`p`,{className:`oc-admin__hint`,children:l()}):g.blocked?(0,X.jsxs)(`p`,{className:`oc-compat__blocked`,role:`status`,children:[(0,X.jsx)(B,{size:14,"aria-hidden":!0}),` `,K(g.gatewayVersion,g.provider)]}):t.status===`loading`?(0,X.jsx)(`p`,{className:`oc-admin__hint`,children:l()}):t.status===`error`?(0,X.jsxs)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:[p(),` `,(0,X.jsx)(P,{variant:`outline`,size:`sm`,onClick:()=>void x(),children:E()})]}):(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,X.jsx)(`span`,{className:`oc-cdefaults__label`,children:O()}),(0,X.jsx)(z,{options:D,value:S?.thinkingDefault??null,onChange:()=>{},disabled:!0}),(0,X.jsx)(`p`,{className:`oc-cdefaults__help`,children:A()})]}),(0,X.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,X.jsx)(`span`,{className:`oc-cdefaults__label`,children:T()}),(0,X.jsx)(z,{options:M,value:S===null||S.fastModeDefault===null?null:S.fastModeDefault?`fast`:`standard`,onChange:()=>{},disabled:!0}),(0,X.jsx)(`p`,{className:`oc-cdefaults__help`,children:r()})]}),(0,X.jsx)(`p`,{className:`oc-cdefaults__note`,children:s()})]}),(()=>{let e=i?.find(e=>e.name===(a??i[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{c as e,i as t,r as n}from"./bundle-mjs-BJq7W7j9.js";import{$S as r,AC as i,BC as a,BM as o,CC as s,DC as c,EC as l,FC as u,GC as d,GS as f,HC as p,IC as m,JS as h,KS as g,LC as _,MC as v,NC as y,OC as ee,PC as te,QS as ne,RC as re,SC as ie,TC as b,UC as x,VC as S,VM as C,Vr as w,WC as T,WS as E,XS as D,YS as O,ZS as k,_C as A,aC as j,bC as M,c as N,cC as P,dC as F,eC as I,fC as L,gC as R,hC as z,iC as B,jC as V,kC as H,lC as U,mC as ae,nC as W,oC as G,pC as K,qS as q,rC as J,sC as oe,tC as se,uC as ce,vC as le,wC as ue,xC as de,yC as fe,zC as pe,zr as me}from"./dist--_yEYc8n.js";import{t as he}from"./button-DgrHAwnL.js";import{V as ge,tt as _e}from"./index-CMhwTTOU.js";import{t as Y}from"./DataTableShell-DvxbPdB7.js";var X=e(t(),1),Z=n(),ve={altered_words:()=>d(),incorrect:()=>T(),incoherence:()=>x(),formatting:()=>p(),latency:()=>S(),api_error:()=>a(),other:()=>pe()},Q=e=>ve[e]?.()??e;function $({matches:e,sourceWasOpen:t}){return t?e===!0?(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-ok`,children:_()}):e===!1?(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-warn`,children:m()}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill`,children:`—`}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill`,children:re()})}function ye({data:e,closeReason:t}){let n=e.snapshot,r=o(N.feedback.respondToFeedback),[a,d]=(0,X.useState)(e.thread),[f,p]=(0,X.useState)(``),[m,h]=(0,X.useState)(!1);async function g(){let t=f.trim();if(!(!t||m)){h(!0);try{await r({feedbackId:e._id,text:t}),d(e=>[...e,{authorRole:`admin`,text:t,at:Date.now()}]),p(``)}finally{h(!1)}}}let _=[];try{_=n.contextJson?JSON.parse(n.contextJson):[]}catch{_=[]}return(0,Z.jsxs)(`div`,{className:`oc-fbadmin__detail`,children:[(0,Z.jsxs)(`div`,{className:`oc-fbadmin__row`,children:[(0,Z.jsx)($,{matches:n.displayedMatchesStored,sourceWasOpen:n.clientInfo?.sourceWasOpen??!1}),(0,Z.jsxs)(`span`,{className:`oc-fbadmin__meta`,children:[Q(e.category),` · `,n.messageRole,n.isRegeneration?` · ${u()}`:``,n.openclawModel?` · ${n.openclawModel}`:``,n.openclawRuntime?` (${n.openclawRuntime})`:``]})]}),e.comment?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:te()}),(0,Z.jsx)(`p`,{className:`oc-fbadmin__comment`,children:e.comment})]}):null,t?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:D()}),(0,Z.jsx)(`p`,{className:`oc-fbadmin__comment`,children:t})]}):null,(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:y()}),a.length>0?(0,Z.jsx)(`div`,{className:`oc-fbadmin__thread`,children:a.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`?v():e.authorRole===`agent`?e.authorLabel??w():V()}),(0,Z.jsx)(`span`,{className:`oc-notif__msg-text`,children:e.text})]},t))}):(0,Z.jsx)(`p`,{className:`oc-fbadmin__meta`,children:i()}),(0,Z.jsx)(`textarea`,{className:`oc-feedback__textarea`,placeholder:H(),value:f,maxLength:2e3,rows:3,onChange:e=>p(e.target.value.slice(0,2e3))}),(0,Z.jsx)(`div`,{className:`oc-fbadmin__row`,style:{justifyContent:`flex-end`},children:(0,Z.jsx)(he,{size:`sm`,onClick:()=>void g(),disabled:!f.trim()||m,children:m?ee():c()})})]}),(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:n.messageText||b()})]}),n.clientInfo?.sourceWasOpen&&n.displayedText!==void 0?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:ue()}),(0,Z.jsx)(`pre`,{className:`oc-msg__source-pre`,children:n.displayedText||b()})]}):null,n.promptText?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:s()}),(0,Z.jsx)(`pre`,{className:`oc-msg__source-pre`,children:n.promptText})]}):null,_.length>0?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:ie({count:n.contextCount??_.length,truncated:n.contextTruncated?de():``})}),(0,Z.jsx)(`div`,{className:`oc-fbadmin__ctx`,children:_.map((e,t)=>(0,Z.jsxs)(`div`,{className:`oc-fbadmin__ctx-turn`,children:[(0,Z.jsx)(`span`,{className:`oc-fbadmin__ctx-role`,children:e.role}),(0,Z.jsx)(`span`,{className:`oc-fbadmin__ctx-text`,children:e.text})]},t))})]}):null,n.outboxAvailable?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:M()}),(0,Z.jsxs)(`pre`,{className:`oc-msg__source-pre`,children:[n.outboxText??``,n.outboxStatus?`\n[status: ${n.outboxStatus}]`:``]})]}):null,n.clientInfo?.extensionsDetected&&n.clientInfo.extensionsDetected.length>0?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:fe()}),(0,Z.jsx)(`div`,{className:`oc-fbadmin__row`,children:n.clientInfo.extensionsDetected.map(e=>(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-warn`,children:e},e))})]}):null,(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:le()}),(0,Z.jsxs)(`p`,{className:`oc-fbadmin__env`,children:[[n.clientInfo?.language,n.clientInfo?.timezone,n.clientInfo?.theme?A({theme:n.clientInfo.theme}):null,n.runId?`run ${n.runId.slice(0,12)}…`:null].filter(Boolean).join(` · `)||`—`,n.clientInfo?.plugins&&n.clientInfo.plugins.length>0?(0,Z.jsxs)(`span`,{className:`oc-fbadmin__plugins`,children:[R(),` `,n.clientInfo.plugins.join(`, `),(0,Z.jsxs)(`span`,{className:`oc-fbadmin__note`,children:[` `,z()]})]}):null,n.clientInfo?.userAgent?(0,Z.jsx)(`span`,{className:`oc-fbadmin__ua`,children:n.clientInfo.userAgent}):null]})]})]})}function be(){let e=C(N.feedback.listForAdmin,{}),t=o(N.feedback.readSnapshot),n=o(N.feedback.deleteFeedback),i=ge(),[a,s]=(0,X.useState)(null),[c,l]=(0,X.useState)({});async function u(e){if(a===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 d(e){await i({title:g(),description:f(),confirmLabel:E(),destructive:!0})&&(await n({feedbackId:e._id}),a===e._id&&s(null))}return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`p`,{className:`oc-admin__hint`,children:[ae(),` `,(0,Z.jsx)(`strong`,{children:K()}),` `,L()]}),(0,Z.jsx)(Y,{title:F(),rows:e,emptyHint:ce(),isExpanded:e=>a===e._id&&!!c[e._id],renderExpanded:e=>c[e._id]?(0,Z.jsx)(ye,{data:c[e._id],closeReason:e.userCloseReason}):null,columns:[{header:U(),cell:e=>_e(e.at),sort:e=>e.at},{header:P(),cell:e=>Q(e.category),sort:e=>Q(e.category)},{header:oe(),cell:e=>e.messageRole===`user`?G():j(),sort:e=>e.messageRole},{header:B(),cell:e=>(e.reporterEmail||e.reporterName||`—`)+(e.impersonated&&e.realOperatorEmail?` ${J({operator:e.realOperatorEmail})}`:``),sort:e=>e.reporterEmail||e.reporterName||null},{header:W(),cell:e=>(0,Z.jsx)($,{matches:e.displayedMatchesStored,sourceWasOpen:e.sourceWasOpen}),sort:e=>e.displayedMatchesStored===!1?0:e.displayedMatchesStored===!0?1:2},{header:se(),cell:e=>e.hasComment?`✎`:`—`,sort:e=>+!!e.hasComment},{header:I(),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:ne()}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-ok`,title:e.resolvedBy??void 0,children:me()}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-closed`,children:k()}),sort:e=>e.userClosedAt==null?e.resolvedAt==null?+!!e.answered:2:3}],rowActions:e=>[{label:a===e._id?O():h(),onSelect:()=>void u(e)},{label:q(),onSelect:()=>void d(e),variant:`destructive`}]})]})}export{be as FeedbacksTab};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{c as e,i as t,r as n}from"./bundle-mjs-BJq7W7j9.js";import{$j as ee,Aj as te,BM as r,Bj as i,Dj as a,Ej as ne,Fj as re,Gj as o,Gr as s,Hj as c,Ij as l,Jj as u,Kj as d,Lj as f,MM as p,Mj as m,Nj as ie,Oj as ae,PM as oe,Pj as se,Qj as ce,Rj as le,Tj as ue,Uj as h,VM as de,Vj as fe,WE as pe,Wj as g,Wr as me,Xj as he,Yj as ge,Zj as _e,aM as ve,c as _,eM as ye,iM as be,jj as xe,kj as v,nM as y,qj as b,rM as x,tM as S,wj as C,zj as w}from"./dist--_yEYc8n.js";import{t as T}from"./button-DgrHAwnL.js";import{B as E,C as D,G as O,It as k,J as A,K as j,Mt as M,S as N,T as P,U as Se,Ut as Ce,W as we,Wt as F,X as Te,Y as Ee,at as I,ct as De,it as Oe,lt as L,m as ke,q as Ae,rt as je,w as R,x as z}from"./index-CMhwTTOU.js";import{a as Me,i as B,n as Ne,o as V,r as H,t as Pe}from"./table-B58636RR.js";var U=e(t(),1),W=n(),G=`all`;function K(e){switch(e){case`image`:return u();case`audio`:return b();case`video`:return d();case`pdf`:return o();case`document`:return g();case`archive`:return h();default:return c()}}function q(){let[e,t]=(0,U.useState)(G),[n,o]=(0,U.useState)(G),[c,u]=(0,U.useState)(G),[d,h]=(0,U.useState)(G),[g,b]=(0,U.useState)(!1),[q,J]=(0,U.useState)(null),Fe=r(_.files.softDelete),Y=E();function Ie(){t(G),o(G),u(G),h(G)}async function Le(){let e=q;if(J(null),e)try{await Fe({fileId:e.id}),Y.success(xe())}catch(e){Y.error(te(),e)}}let X=de(_.files.listMine,{direction:e===G?void 0:e,chatId:n===G?void 0:n,instanceName:c===G?void 0:c,category:d===G?void 0:d,includeAutoGenerated:g||void 0}),Re=(0,U.useMemo)(()=>new Intl.DateTimeFormat(oe(),{dateStyle:`medium`,timeStyle:`short`}),[]);if(X===void 0)return(0,W.jsx)(`p`,{className:`oc-admin__hint`,children:p()});let{files:Z,facets:Q,truncated:ze,cap:Be}=X,$=e!==G||n!==G||c!==G||d!==G;return(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`p`,{className:`oc-admin__hint`,children:ve()}),(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":be(),children:(0,W.jsx)(P,{})}),(0,W.jsxs)(N,{children:[(0,W.jsx)(D,{value:G,children:x()}),(0,W.jsx)(D,{value:`inbound`,children:y()}),(0,W.jsx)(D,{value:`outbound`,children:S()})]})]}),(0,W.jsxs)(z,{value:n,onValueChange:o,children:[(0,W.jsx)(R,{size:`sm`,"aria-label":ye(),children:(0,W.jsx)(P,{})}),(0,W.jsxs)(N,{children:[(0,W.jsx)(D,{value:G,children:ee()}),Q.chats.map(e=>(0,W.jsx)(D,{value:e.id,children:e.title},e.id))]})]}),Q.multiProvider?(0,W.jsxs)(z,{value:c,onValueChange:u,children:[(0,W.jsx)(R,{size:`sm`,"aria-label":ce(),children:(0,W.jsx)(P,{})}),(0,W.jsxs)(N,{children:[(0,W.jsx)(D,{value:G,children:_e()}),Q.instances.map(e=>(0,W.jsx)(D,{value:e,children:e},e))]})]}):null,(0,W.jsxs)(z,{value:d,onValueChange:h,children:[(0,W.jsx)(R,{size:`sm`,"aria-label":he(),children:(0,W.jsx)(P,{})}),(0,W.jsxs)(N,{children:[(0,W.jsx)(D,{value:G,children:ge()}),Q.categories.map(e=>(0,W.jsx)(D,{value:e,children:K(e)},e))]})]}),(0,W.jsxs)(`label`,{className:`oc-files__autogen`,children:[(0,W.jsx)(ke,{checked:g,onCheckedChange:e=>b(e===!0),"aria-label":s()}),(0,W.jsx)(`span`,{children:s()})]}),$?(0,W.jsxs)(T,{variant:`ghost`,size:`sm`,onClick:Ie,style:{display:`inline-flex`,alignItems:`center`,gap:4,marginLeft:`auto`},children:[(0,W.jsx)(k,{size:14,"aria-hidden":!0}),se()]}):null]}),Z.length===0?(0,W.jsx)(`p`,{className:`oc-admin__hint`,children:$?ue():ne()}):(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:fe()}),(0,W.jsx)(B,{children:i()}),(0,W.jsx)(B,{children:w()}),(0,W.jsx)(B,{children:le()}),(0,W.jsx)(B,{children:f()}),(0,W.jsx)(B,{className:`text-right`,children:l()})]})}),(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)(L,{variant:`outline`,style:{marginLeft:6},children:me()}):null]}),(0,W.jsx)(H,{title:e.mimeType,children:K(e.category)}),(0,W.jsx)(H,{children:(0,W.jsx)(L,{variant:`secondary`,children:e.direction===`inbound`?y():S()})}),(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)(je,{children:[(0,W.jsx)(De,{asChild:!0,children:(0,W.jsx)(T,{variant:`ghost`,size:`icon`,"aria-label":ie(),children:(0,W.jsx)(Ce,{size:16})})}),(0,W.jsxs)(Oe,{align:`end`,children:[e.url?(0,W.jsx)(I,{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}),re()]})}):(0,W.jsxs)(I,{disabled:!0,children:[(0,W.jsx)(F,{size:14}),a()]}),(0,W.jsxs)(I,{variant:`destructive`,onSelect:()=>J({id:e._id,filename:e.filename}),children:[(0,W.jsx)(M,{size:14}),m()]})]})]})})]},e._id))})]}),ze?(0,W.jsx)(`p`,{className:`oc-admin__hint`,style:{marginTop:8},children:C({cap:Be})}):null]}),(0,W.jsx)(Se,{open:q!==null,onOpenChange:e=>!e&&J(null),children:(0,W.jsxs)(j,{children:[(0,W.jsxs)(Ee,{children:[(0,W.jsx)(Te,{children:v()}),(0,W.jsx)(Ae,{children:ae()})]}),(0,W.jsxs)(A,{children:[(0,W.jsx)(O,{children:pe()}),(0,W.jsx)(we,{onClick:()=>void Le(),children:m()})]})]})})]})}export{q as FilesTab};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{c as e,i as t,r as n}from"./bundle-mjs-BJq7W7j9.js";import{$l as r,Al as i,Au as a,BM as o,Bl as s,Cu as c,Du as l,Eu as u,Fl as d,Fu as f,Gl as p,Hl as m,Il as h,Iu as g,Jl as _,Kl as v,Ll as y,Lu as b,Ml as x,Mu as ee,Nl as S,Nu as te,Ou as C,Pl as w,Pu as T,Ql as E,Rl as D,Ru as O,Su as k,Tu as ne,Ul as A,VM as j,Vl as M,Wl as N,Xl as P,Yl as F,Zl as re,_u as I,au as ie,bu as L,c as R,cu as ae,du as oe,eu as z,fu as se,gu as ce,hu as le,iu as ue,jl as de,ju as fe,kl as pe,ku as me,l as B,lu as V,mu as he,nu as ge,ou as _e,pu as ve,ql as ye,ru as be,su as xe,tu as Se,uu as Ce,vu as we,wu as Te,xu as Ee,yu as De,zl as Oe}from"./dist--_yEYc8n.js";import{t as ke}from"./x-CJvE-xbb.js";import{i as H,n as U,r as Ae,t as je}from"./tabs-HTb97o34.js";import{t as W}from"./button-DgrHAwnL.js";import{B as G,C as Me,Jt as Ne,Nt as K,Pt as q,S as Pe,St as Fe,T as Ie,V as Le,Yt as Re,d as ze,dt as Be,ft as Ve,gt as He,ht as Ue,lt as J,m as Y,pt as We,ut as X,w as Ge,x as Ke}from"./index-CMhwTTOU.js";import{t as qe}from"./FilterBar-88imPMtz.js";import{t as Je}from"./DataTableShell-DvxbPdB7.js";import{t as Z}from"./DetailChips-BCCxug5L.js";var Ye=B(`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`}]]),Xe=B(`shield-check`,[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`,key:`oel41y`}],[`path`,{d:`m9 12 2 2 4-4`,key:`dzmm74`}]]),Ze=B(`users`,[[`path`,{d:`M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2`,key:`1yyitq`}],[`path`,{d:`M16 3.128a4 4 0 0 1 0 7.744`,key:`16gr8j`}],[`path`,{d:`M22 21v-2a4 4 0 0 0-3-3.87`,key:`kshegd`}],[`circle`,{cx:`9`,cy:`7`,r:`4`,key:`nufk8`}]]),Q=e(t(),1);function Qe(e,t,n){let r=t.trim().toLowerCase();return[...r?e.filter(e=>[e.email,e.name,e.canonical].some(e=>e!=null&&e.toLowerCase().includes(r))):e.slice()].sort((e,t)=>!n.has(e.userId)-+!n.has(t.userId))}function $e(e,t){let n=e.filter(e=>e.source===`discovered`),r=t.trim().toLowerCase();return r?n.filter(e=>(e.displayName??e.agentId).toLowerCase().includes(r)||e.agentId.toLowerCase().includes(r)):n}function et(e){let t=e.name?.trim()??``,n=e.email?.trim()??``,r=e.canonical?.trim()||`u-${e.userId.slice(0,8)}`;return t?{primary:t,secondary:n||`@${r}`}:n?{primary:n,secondary:null}:{primary:`@${r}`,secondary:null}}function tt(e){switch(e){case`admin`:return ie();case`user`:return ue();case`pending`:return be();default:return e}}function nt(e,t){if(e.length===0)return`none`;let n=0;for(let r of e)t(r)&&n++;return n===0?`none`:n===e.length?`all`:`some`}function rt(e,t,n){let r=Math.max(1,Math.ceil(e.length/n)),i=Math.min(Math.max(1,Math.floor(t)),r),a=(i-1)*n;return{pageItems:e.slice(a,a+n),page:i,pageCount:r}}var $=n(),it={name:``,description:``};function at(){let e=j(R.groups.listGroups,{}),t=j(R.me.getMe,{host:Fe})?.role===`admin`,n=o(R.groups.createGroup),r=o(R.groups.updateGroup),i=o(R.groups.deleteGroup),s=Le(),d=G(),[p,m]=(0,Q.useState)(!1),[h,_]=(0,Q.useState)(null),[v,y]=(0,Q.useState)(it),[S,w]=(0,Q.useState)(null),[E,D]=(0,Q.useState)(``),A=(0,Q.useMemo)(()=>{if(!e)return e;let t=E.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,E]);function M(){_(null),y(it),m(!0)}function N(e){_(e),y({name:e.name,description:e.description??``}),m(!0)}async function P(){try{h?await r({groupId:h._id,name:v.name,description:v.description}):await n({name:v.name,description:v.description||void 0}),y(it),_(null),m(!1)}catch(e){d.error(x(),e)}}async function F(e){if(await s({title:De({name:e.name}),description:we(),confirmWord:e.name,confirmLabel:I(),cancelLabel:ne(),destructive:!0}))try{await i({groupId:e._id})}catch(e){d.error(de(),e)}}return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`p`,{className:`oc-admin__hint`,children:b()}),(0,$.jsx)(qe,{q:E,onQChange:D,onReset:()=>D(``),canReset:E!==``,searchPlaceholder:a()}),(0,$.jsx)(Je,{title:O(),rows:A,addLabel:g(),onAdd:t?M:void 0,emptyHint:f(),columns:[{header:T(),cell:e=>e.name,sort:e=>e.name},{header:te(),cell:e=>(0,$.jsx)(Z,{icon:(0,$.jsx)(Ze,{size:12,"aria-hidden":!0}),total:e.memberCount,items:e.members.map(e=>({label:e.label,marker:e.manager?(0,$.jsx)(Xe,{size:11,"aria-hidden":!0}):null,highlight:e.manager}))}),sort:e=>e.memberCount},{header:ee(),cell:e=>(0,$.jsx)(Z,{icon:(0,$.jsx)(q,{size:12,"aria-hidden":!0}),total:e.agentCount,items:e.agents.map(e=>({label:e}))}),sort:e=>e.agentCount},{header:fe(),cell:e=>(0,$.jsx)(Z,{icon:(0,$.jsx)(Ye,{size:12,"aria-hidden":!0}),total:e.chartCount,items:e.charts.map(e=>({label:e.name,marker:e.isDefault?(0,$.jsx)(K,{size:11,fill:`currentColor`,"aria-hidden":!0}):null,highlight:e.isDefault}))}),sort:e=>e.chartCount}],rowActions:e=>[{label:me(),onSelect:()=>w({groupId:e._id,name:e.name})},...t?[{label:C(),onSelect:()=>N(e)},{label:l(),variant:`destructive`,onSelect:()=>void F(e)}]:[]]}),(0,$.jsx)(ze,{open:p,onOpenChange:m,title:h?c():Te(),description:k(),canSubmit:!!v.name.trim(),onSubmit:P,submitLabel:u(),children:(0,$.jsxs)(`div`,{className:`oc-form`,children:[(0,$.jsxs)(`label`,{className:`oc-field`,children:[(0,$.jsx)(`span`,{className:`oc-field__label`,children:Ee()}),(0,$.jsx)(X,{value:v.name,onChange:e=>y({...v,name:e.target.value})})]}),(0,$.jsxs)(`label`,{className:`oc-field`,children:[(0,$.jsx)(`span`,{className:`oc-field__label`,children:L()}),(0,$.jsx)(X,{value:v.description,onChange:e=>y({...v,description:e.target.value})})]})]})}),(0,$.jsx)(ct,{groupId:S?.groupId??null,groupName:S?.name??``,open:S!==null,onOpenChange:e=>{e||w(null)}})]})}var ot=8;function st({page:e,pageCount:t,onPage:n}){return t<=1?null:(0,$.jsxs)(`div`,{className:`oc-access__pager`,children:[(0,$.jsxs)(W,{type:`button`,variant:`ghost`,size:`sm`,disabled:e<=1,onClick:()=>n(e-1),children:[(0,$.jsx)(Re,{size:14,"aria-hidden":!0}),ae()]}),(0,$.jsxs)(`span`,{className:`oc-access__pageinfo`,"aria-label":_e({page:e,pages:t}),children:[e,` / `,t]}),(0,$.jsxs)(W,{type:`button`,variant:`ghost`,size:`sm`,disabled:e>=t,onClick:()=>n(e+1),children:[xe(),(0,$.jsx)(Ne,{size:14,"aria-hidden":!0})]})]})}function ct({groupId:e,groupName:t,open:n,onOpenChange:r}){let a=j(R.groups.getGroup,n&&e?{groupId:e}:`skip`),s=j(R.groups.listAssignableInstances,n?{}:`skip`),c=j(R.groups.listAssignableUsers,n?{}:`skip`),l=o(R.groups.addMember),u=o(R.groups.removeMember),f=o(R.groups.bulkSetMembers),m=o(R.groups.setGroupManager),g=G(),[_,v]=(0,Q.useState)(``),[b,x]=(0,Q.useState)(``),[ee,S]=(0,Q.useState)(`members`),[te,C]=(0,Q.useState)(1),[T,D]=(0,Q.useState)(new Set),O=(0,Q.useRef)(null),k=(0,Q.useMemo)(()=>new Set((a?.members??[]).map(e=>e.userId)),[a]),ne=(0,Q.useMemo)(()=>new Set((a?.members??[]).filter(e=>e.manager).map(e=>e.userId)),[a]),A=a?.viewerIsAdmin===!0,M=(0,Q.useMemo)(()=>new Set((a?.agents??[]).map(e=>`${e.instanceName}/${e.agentId}`)),[a]);(0,Q.useEffect)(()=>{v(``),x(``),S(`members`),C(1),O.current=null},[n,e]),(0,Q.useEffect)(()=>{C(1)},[_]),(0,Q.useEffect)(()=>{n&&a&&e&&O.current!==e&&(O.current=e,D(new Set((a.members??[]).map(e=>e.userId))))},[n,a,e]);let N=(0,Q.useMemo)(()=>c?Qe(c,_,T):[],[c,_,T]);async function P(t,n){if(e)try{n?await u({groupId:e,userId:t}):await l({groupId:e,userId:t})}catch(e){g.error(i(),e)}}async function F(t,n){if(e)try{await m({groupId:e,userId:t,manager:!n})}catch(e){g.error(w(),e)}}let I=nt(N,e=>k.has(e.userId)),ie=N.filter(e=>k.has(e.userId)).length,L=rt(N,te,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){g.error(i(),e)}}return(0,$.jsx)(Be,{open:n,onOpenChange:r,children:(0,$.jsxs)(Ve,{className:`oc-access`,children:[(0,$.jsxs)(Ue,{children:[(0,$.jsx)(He,{children:ce({name:t})}),(0,$.jsx)(We,{children:le()})]}),(0,$.jsxs)(je,{value:ee,onValueChange:S,className:`oc-access__tabs`,children:[(0,$.jsxs)(Ae,{className:`w-full`,children:[(0,$.jsxs)(H,{value:`members`,className:`flex-1 gap-1.5`,children:[(0,$.jsx)(Ze,{size:13,"aria-hidden":!0}),he(),a?(0,$.jsx)(J,{variant:`secondary`,className:`oc-access__tabcount`,children:k.size}):null]}),(0,$.jsxs)(H,{value:`agents`,className:`flex-1 gap-1.5`,children:[(0,$.jsx)(q,{size:13,"aria-hidden":!0}),se(),a?(0,$.jsx)(J,{variant:`secondary`,className:`oc-access__tabcount`,children:M.size}):null]}),(0,$.jsxs)(H,{value:`charts`,className:`flex-1 gap-1.5`,children:[(0,$.jsx)(Ye,{size:13,"aria-hidden":!0}),p(),a?(0,$.jsx)(J,{variant:`secondary`,className:`oc-access__tabcount`,children:a.chartCount}):null]})]}),(0,$.jsx)(U,{value:`members`,children:c===void 0||a===void 0?(0,$.jsx)(`p`,{className:`oc-access__hint`,children:z()}):c.length===0?(0,$.jsx)(`p`,{className:`oc-access__hint`,children:E()}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(X,{value:_,onChange:e=>v(e.target.value),placeholder:ve(),className:`oc-access__search`}),N.length===0?(0,$.jsx)(`p`,{className:`oc-access__hint`,children:Ce()}):(0,$.jsxs)($.Fragment,{children:[N.length>1?(0,$.jsxs)(`div`,{className:`oc-access__row oc-access__selectall`,children:[(0,$.jsx)(Y,{checked:I===`all`?!0:I===`some`?`indeterminate`:!1,onCheckedChange:()=>void ae(),"aria-label":V()}),(0,$.jsx)(`span`,{className:`oc-access__label`,children:V()}),(0,$.jsxs)(J,{variant:`outline`,className:`oc-access__count`,children:[ie,` / `,N.length]})]}):null,(0,$.jsx)(`div`,{className:`oc-access__list`,children:L.pageItems.map(e=>{let t=k.has(e.userId),n=et(e),r=ne.has(e.userId);return(0,$.jsxs)(`div`,{className:`oc-access__row`,children:[(0,$.jsx)(Y,{checked:t,onCheckedChange:()=>void P(e.userId,t),"aria-label":ge({user:n.primary})}),(0,$.jsxs)(`span`,{className:`oc-access__who`,children:[(0,$.jsx)(`span`,{className:`oc-access__label`,title:n.primary,children:n.primary}),n.secondary?(0,$.jsx)(`span`,{className:`oc-access__sub`,title:n.secondary,children:n.secondary}):null]}),(0,$.jsx)(J,{variant:`outline`,className:`oc-access__role`,children:tt(e.role)}),(0,$.jsx)(`span`,{className:`oc-access__mgrslot`,children:t&&A?(0,$.jsx)(W,{type:`button`,variant:`ghost`,size:`icon`,className:`shrink-0 oc-access__mgr${r?` oc-access__mgr--on`:``}`,"aria-pressed":r,"aria-label":r?d():h(),title:r?d():h(),onClick:()=>void F(e.userId,r),children:(0,$.jsx)(Xe,{size:15,"aria-hidden":!0})}):t&&r?(0,$.jsx)(`span`,{className:`oc-access__mgr oc-access__mgr--on`,role:`img`,"aria-label":y(),title:y(),children:(0,$.jsx)(Xe,{size:15,"aria-hidden":!0})}):null})]},e._id)})}),(0,$.jsx)(st,{page:L.page,pageCount:L.pageCount,onPage:C})]})]})}),(0,$.jsx)(U,{value:`agents`,children:s===void 0?(0,$.jsx)(`p`,{className:`oc-access__hint`,children:z()}):s.length===0?(0,$.jsx)(`p`,{className:`oc-access__hint`,children:re()}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(X,{value:b,onChange:e=>x(e.target.value),placeholder:oe(),className:`oc-access__search`}),(0,$.jsx)(`div`,{className:`oc-access__list`,children:s.map(t=>(0,$.jsx)(lt,{groupId:e,instanceName:t.name,kind:t.kind??`openclaw`,assigned:M,query:b},`${e}-${t._id}`))})]})}),(0,$.jsx)(U,{value:`charts`,children:(0,$.jsx)(ut,{groupId:e})})]})]})})}function lt({groupId:e,instanceName:t,kind:n,assigned:i,query:a}){let s=j(R.groups.listAssignableAgents,{instanceName:t}),c=o(R.groups.assignAgentToGroup),l=o(R.groups.removeAgentFromGroup),u=o(R.groups.bulkSetGroupAgents),d=G(),[f,p]=(0,Q.useState)(1);if((0,Q.useEffect)(()=>{p(1)},[a]),!e)return null;let m=$e(s?.agents??[],a),h=s?.discovery&&!s.discovery.lastPollOk;if(a.trim()&&m.length===0)return null;let g=m.filter(e=>e.presentInLastOk!==!1&&e.enabled!==!1),y=nt(g,e=>i.has(`${t}/${e.agentId}`)),b=rt(m,f,ot);async function x(n,r){try{r?await l({groupId:e,instanceName:t,agentId:n}):await c({groupId:e,instanceName:t,agentId:n})}catch(e){d.error(pe(),e)}}async function ee(){if(g.length===0)return;let n=g.map(e=>e.agentId);try{await u({groupId:e,instanceName:t,agentIds:n,assigned:y!==`all`})}catch(e){d.error(pe(),e)}}return(0,$.jsxs)(`div`,{className:`oc-access__group`,children:[(0,$.jsxs)(`div`,{className:`oc-access__instance`,children:[(0,$.jsx)(q,{size:13,"aria-hidden":!0}),(0,$.jsx)(`span`,{children:t}),(0,$.jsx)(J,{variant:`outline`,className:`oc-access__kind`,children:n}),h?(0,$.jsx)(J,{variant:`outline`,className:`oc-access__stale`,children:_()}):null]}),s===void 0?(0,$.jsx)(`p`,{className:`oc-access__hint`,children:r()}):m.length===0?(0,$.jsx)(`p`,{className:`oc-access__hint`,children:h?F():P()}):(0,$.jsxs)($.Fragment,{children:[g.length>1?(0,$.jsxs)(`div`,{className:`oc-access__row oc-access__selectall`,children:[(0,$.jsx)(Y,{checked:y===`all`?!0:y===`some`?`indeterminate`:!1,onCheckedChange:()=>void ee(),"aria-label":V()}),(0,$.jsx)(`span`,{className:`oc-access__label`,children:V()})]}):null,b.pageItems.map(e=>{let n=`${t}/${e.agentId}`,r=i.has(n),a=e.presentInLastOk===!1,o=!e.enabled;return(0,$.jsxs)(`div`,{className:`oc-access__row${o?` is-disabled`:``}`,children:[(0,$.jsx)(Y,{checked:r,disabled:(a||o)&&!r,onCheckedChange:()=>void x(e.agentId,r),"aria-label":Se({name:e.displayName??e.agentId})}),(0,$.jsxs)(`span`,{className:`oc-access__label`,title:e.displayName??e.agentId,children:[e.emoji?`${e.emoji} `:``,e.displayName??e.agentId]}),e.model?(0,$.jsx)(`span`,{className:`oc-access__model`,children:e.model}):null,e.isDefaultOnInstance?(0,$.jsx)(`span`,{className:`oc-access__fav`,role:`img`,"aria-label":v(),title:v(),children:(0,$.jsx)(K,{size:14,fill:`currentColor`})}):null,a?(0,$.jsx)(J,{variant:`outline`,className:`oc-access__gone`,children:ye()}):null]},e.agentId)}),(0,$.jsx)(st,{page:b.page,pageCount:b.pageCount,onPage:p})]})]})}function ut({groupId:e}){let t=j(R.charts.listGroupChartSelection,e?{groupId:e}:`skip`),n=o(R.charts.assignChartToGroup),r=o(R.charts.removeChartFromGroup),i=o(R.charts.setGroupDefaultChart),a=o(R.charts.addChartToGroupPool),c=o(R.charts.removeChartFromGroupPool),l=G();if(!e)return null;if(t===void 0)return(0,$.jsx)(`p`,{className:`oc-access__hint`,children:z()});let{pool:u,addable:d,canManagePool:f}=t;if(u.length===0&&!f)return(0,$.jsx)(`p`,{className:`oc-access__hint`,children:N()});async function p(t,i){try{i?await r({groupId:e,chartKey:t}):await n({groupId:e,chartKey:t})}catch(e){l.error(S(),e)}}async function h(t){try{await i({groupId:e,chartKey:t})}catch(e){l.error(S(),e)}}async function g(t){try{await a({groupId:e,chartKey:t})}catch(e){l.error(S(),e)}}async function _(t){try{await c({groupId:e,chartKey:t})}catch(e){l.error(S(),e)}}return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`div`,{className:`oc-access__list`,children:u.map(e=>(0,$.jsxs)(`div`,{className:`oc-access__row`,children:[(0,$.jsx)(Y,{checked:e.selected,onCheckedChange:()=>void p(e.chartKey,e.selected),"aria-label":s({name:e.name})}),(0,$.jsx)(`span`,{className:`oc-access__label`,title:e.name,children:e.name}),e.selected?e.isDefault?(0,$.jsx)(`span`,{className:`oc-access__fav`,role:`img`,"aria-label":Oe(),title:Oe(),children:(0,$.jsx)(K,{size:14,fill:`currentColor`})}):(0,$.jsx)(W,{type:`button`,variant:`ghost`,size:`sm`,onClick:()=>void h(e.chartKey),children:D()}):null,f?(0,$.jsx)(W,{type:`button`,variant:`ghost`,size:`sm`,"aria-label":M({name:e.name}),title:M({name:e.name}),onClick:()=>void _(e.chartKey),children:(0,$.jsx)(ke,{size:14,"aria-hidden":!0})}):null]},e.chartKey))}),f?d.length>0?(0,$.jsxs)(Ke,{value:``,onValueChange:e=>void g(e),children:[(0,$.jsx)(Ge,{size:`sm`,className:`oc-access__search`,children:(0,$.jsx)(Ie,{placeholder:m()})}),(0,$.jsx)(Pe,{children:d.map(e=>(0,$.jsx)(Me,{value:e.chartKey,children:e.name},e.chartKey))})]}):u.length===0?(0,$.jsx)(`p`,{className:`oc-access__hint`,children:A()}):null:null]})}export{at as GroupsTab};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{c as e,i as t,r as n}from"./bundle-mjs-BJq7W7j9.js";import{$b as r,$x as i,Ab as a,At as o,Ax as s,BM as c,Bb as l,Bx as u,Cx as d,Db as f,Dx as p,Ex as m,Fb as h,Fx as g,Gb as _,Gi as v,Gx as y,Hb as b,Hx as x,ID as S,Ib as C,Ix as ee,Jb as te,Jx as w,Kb as T,Ki as ne,Kx as E,LD as re,Lb as ie,Lx as ae,Mb as oe,Mt as se,Mx as D,Nb as ce,Nx as O,Ob as k,Ox as le,Pb as ue,Px as de,Qb as fe,Qx as pe,RM as A,Rb as me,Rx as he,Sx as ge,Tx as _e,Ub as ve,Ux as ye,VM as j,Vb as be,Vx as xe,Wb as Se,Wi as Ce,Wx as we,Xx as Te,Yb as Ee,Yx as De,Zb as M,Zx as Oe,_x as ke,aS as Ae,ax as je,bx as Me,c as N,cS as Ne,cx as Pe,dS as Fe,dx as Ie,eS as Le,ex as P,fS as Re,fx as ze,gS as Be,gx as Ve,hS as He,hx as Ue,iS as We,ix as Ge,jb as Ke,jt as qe,jx as Je,kb as Ye,kx as Xe,lS as Ze,lx as Qe,mS as $e,mx as et,nS as F,nx as I,oS as tt,ox as nt,pS as rt,px as it,qb as at,qi as ot,qx as st,rS as ct,rx as lt,sS as ut,sx as dt,tS as ft,tx as pt,uS as mt,ux as ht,vg as gt,vx as _t,wx as vt,xx as yt,yg as bt,yx as xt,zb as St,zx as Ct}from"./dist--_yEYc8n.js";import{a as wt,c as Tt}from"./FieldLabel-C15_DFF2.js";import{t as L}from"./button-DgrHAwnL.js";import{$ as Et,B as R,C as z,Q as Dt,S as B,T as V,V as Ot,Z as kt,d as At,dt as H,ft as U,gt as W,ht as jt,lt as G,m as Mt,pt as Nt,ut as K,w as q,x as J}from"./index-CMhwTTOU.js";import{t as Pt}from"./DataTableShell-DvxbPdB7.js";import{InstanceConfigDialog as Ft}from"./BridgeTab-Ckx_hfwW.js";var Y=e(t(),1),X=[`conversational`,`documentary`,`summarizer`,`curator`],It=new Set(X),Lt=`conversational`;function Rt(e){let t=new Set((e??[]).filter(e=>It.has(e)));return t.size===0?[Lt]:X.filter(e=>t.has(e))}var Z=n(),Q={name:``,gatewayUrl:``,bridgeUrl:``,displayName:``,kind:`openclaw`,transport:`ws`,gatewayVersion:``,gatewayHttpUrl:``,streamTransport:wt},zt={openclaw:[`token`,`deviceIdentity`],hermes:[`apiKey`]};function Bt(e){return{name:e.name,gatewayUrl:e.gatewayUrl,bridgeUrl:e.bridgeUrl??``,displayName:e.displayName??``,kind:e.kind??`openclaw`,transport:e.transport??`ws`,gatewayVersion:e.gatewayVersion??``,gatewayHttpUrl:e.gatewayHttpUrl??``,streamTransport:e.streamTransport??`reactive`}}function Vt(){let e=j(N.admin.listInstances,{}),t=j(N.agents.listAllInstanceAgents,{}),n=c(N.admin.upsertInstance),r=c(N.admin.deleteInstance),a=R(),[s,l]=(0,Y.useState)(!1),[d,f]=(0,Y.useState)(Q),[p,m]=(0,Y.useState)(null),[h,g]=(0,Y.useState)(null),[_,v]=(0,Y.useState)(null),[b,S]=(0,Y.useState)(null);async function C(){try{await n({instanceId:b??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),S(null),l(!1)}catch(e){a.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:Re()}),Fe()]}),(0,Z.jsx)(Pt,{title:mt(),rows:e,addLabel:Ze(),onAdd:()=>{S(null),f(Q),l(!0)},emptyHint:Ne(),columns:[{header:ut(),cell:e=>e.name,sort:e=>e.name},{header:tt(),cell:e=>(0,Z.jsx)(G,{variant:`outline`,children:e.kind??`openclaw`}),sort:e=>e.kind??`openclaw`},{header:Ae(),cell:e=>e.gatewayUrl,sort:e=>e.gatewayUrl},{header:We(),cell:e=>e.displayName??`—`,sort:e=>e.displayName??null},{header:Be(),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)(G,{variant:r(e.agentId)?`default`:`outline`,title:r(e.agentId)?k():void 0,children:[e.emoji?`${e.emoji} `:``,e.displayName??e.agentId]},e.agentId))})}}],rowActions:e=>[{label:Le(),onSelect:()=>{S(e._id),f(Bt(e)),l(!0)}},{label:He(),onSelect:()=>m(e.name)},{label:Ct(),onSelect:()=>v(e)},{label:ct(),onSelect:()=>g(e)},{label:F(),variant:`destructive`,onSelect:()=>void r({instanceId:e._id})}],bulkActions:[{label:F(),variant:`destructive`,onSelect:e=>e.forEach(e=>void r({instanceId:e}))}]}),(0,Z.jsx)(At,{open:s,onOpenChange:l,title:b?i():ft(),description:Oe(),canSubmit:!!(d.name&&d.gatewayUrl),onSubmit:C,submitLabel:Te(),children:(0,Z.jsxs)(`div`,{className:`oc-form`,children:[(0,Z.jsxs)($,{label:De(),children:[(0,Z.jsx)(K,{value:d.name,disabled:b!==null,onChange:e=>f({...d,name:e.target.value})}),b?(0,Z.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:pe()}):null]}),(0,Z.jsx)($,{label:w(),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)(V,{})}),(0,Z.jsxs)(B,{children:[(0,Z.jsx)(z,{value:`openclaw`,children:`OpenClaw`}),(0,Z.jsx)(z,{value:`hermes`,children:`Hermes`})]})]})}),d.kind===`hermes`?(0,Z.jsx)($,{label:se(),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)(V,{})}),(0,Z.jsxs)(B,{children:[(0,Z.jsx)(z,{value:`ws`,children:qe()}),(0,Z.jsx)(z,{value:`rest`,children:o()})]})]})}):null,(0,Z.jsx)($,{label:st(),children:(0,Z.jsx)(K,{value:d.gatewayUrl,onChange:e=>f({...d,gatewayUrl:e.target.value})})}),(0,Z.jsx)($,{label:E(),children:(0,Z.jsx)(K,{value:d.bridgeUrl,placeholder:y(),onChange:e=>f({...d,bridgeUrl:e.target.value})})}),(0,Z.jsx)($,{label:we(),children:(0,Z.jsx)(K,{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)(V,{})}),(0,Z.jsx)(B,{children:Tt.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:ye(),children:(0,Z.jsx)(K,{value:d.gatewayVersion,placeholder:x(),onChange:e=>f({...d,gatewayVersion:e.target.value})})}),(0,Z.jsx)($,{label:xe(),children:(0,Z.jsx)(K,{value:d.gatewayHttpUrl,placeholder:u(),onChange:e=>f({...d,gatewayHttpUrl:e.target.value})})})]})}),(0,Z.jsx)(Zt,{instanceName:p,open:p!==null,onOpenChange:e=>{e||m(null)}}),h?(0,Z.jsx)(Ft,{instance:h,onClose:()=>g(null)},h._id):null,_?(0,Z.jsx)(Ht,{instance:_,onClose:()=>v(null)},_._id):null]})}function Ht({instance:e,onClose:t}){let n=j(N.instanceSecrets.listInstanceSecretStatus,{}),r=zt[e.kind??`openclaw`],i=(0,Y.useMemo)(()=>{let t={};for(let r of n??[])r.instanceId===e._id&&(t[r.field]=r.updatedAt);return t},[n,e._id]);return(0,Z.jsx)(H,{open:!0,onOpenChange:e=>!e&&t(),children:(0,Z.jsxs)(U,{onOpenAutoFocus:e=>e.preventDefault(),children:[(0,Z.jsxs)(jt,{children:[(0,Z.jsx)(W,{children:he({instance:e.displayName??e.name})}),(0,Z.jsx)(Nt,{children:ae()})]}),(0,Z.jsx)(`div`,{className:`oc-form`,children:r.map(t=>(0,Z.jsx)(Gt,{instanceId:e._id,field:t,updatedAt:i[t]??null},t))}),(0,Z.jsx)(`div`,{className:`oc-bridgesecret`,children:(0,Z.jsx)(Wt,{instance:e})}),(0,Z.jsx)(Ut,{instance:e})]})})}function Ut({instance:e}){let t=A(N.instanceSync.forceInstanceSync),n=R(),[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(ke());break;case`no_agents`:n.success(Ue());break;case`no_bridge_url`:n.error(et());break;case`deploy_misconfigured`:n.error(it());break;case`unauthorized`:n.error(Ie());break;case`not_served`:n.error(ht());break;default:n.error(ze());break}}catch(e){n.error(Ve(),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)(L,{size:`sm`,variant:`outline`,onClick:()=>void a(),disabled:r,children:r?_t():xt()})})]})}function Wt({instance:e}){let t=j(N.bridgeAuth.listBridgeAuthStatus,{}),n=A(N.bridgeAuth.mintBridgeSecret),r=c(N.bridgeAuth.revokeBridgeSecret),i=R(),[a,o]=(0,Y.useState)(!1),[s,l]=(0,Y.useState)(null),[u,d]=(0,Y.useState)(!1),f=(t??[]).find(t=>t.instanceId===e._id),p=f!==void 0;async function m(){if(!a){o(!0);try{l((await n({instanceId:e._id})).plaintext),d(!1)}catch(e){i.error(I(),e)}finally{o(!1)}}}async function h(){if(!a){o(!0);try{await r({instanceId:e._id}),l(null),i.success(lt())}catch(e){i.error(I(),e)}finally{o(!1)}}}async function g(){if(s)try{await navigator.clipboard.writeText(s),d(!0)}catch{}}return(0,Z.jsxs)($,{label:Pe(),children:[(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:dt()}),(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Z.jsx)(G,{variant:p?`outline`:`secondary`,children:p?`${O()} · ${f.prefix}…${f.lastFour}`:D()}),(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(L,{size:`sm`,onClick:()=>void m(),disabled:a,children:p?je():nt()}),p?(0,Z.jsx)(L,{size:`sm`,variant:`destructive`,onClick:()=>void h(),disabled:a,children:Ge()}):null]})]}),s?(0,Z.jsxs)(`div`,{className:`oc-bridgesecret__reveal`,children:[(0,Z.jsx)(`p`,{className:`oc-sa__minted-warning`,children:pt()}),(0,Z.jsxs)(`div`,{className:`oc-sa__minted-box`,children:[(0,Z.jsx)(`code`,{className:`oc-sa__minted-plain`,children:s}),(0,Z.jsx)(L,{variant:`outline`,size:`sm`,onClick:()=>void g(),children:u?re():S()})]}),(0,Z.jsx)(L,{size:`sm`,variant:`ghost`,onClick:()=>{l(null),d(!1)},children:P()})]}):null]})}function Gt({instanceId:e,field:t,updatedAt:n}){let r=A(N.instanceSecrets.setInstanceSecret),i=c(N.instanceSecrets.clearInstanceSecret),a=A(N.deviceIdentity.generateDeviceIdentity),o=R(),[l,u]=(0,Y.useState)(``),[f,h]=(0,Y.useState)(!1),[_,v]=(0,Y.useState)(null),[y,b]=(0,Y.useState)(!1),x=n!==null,C=t===`deviceIdentity`,te=t===`token`?ee():t===`deviceIdentity`?g():de();async function w(){if(!(!l.trim()||f)){h(!0);try{await r({instanceId:e,field:t,plaintext:l}),u(``),v(null),b(!1),o.success(p())}catch(e){o.error(m(),e)}finally{h(!1)}}}async function T(){if(!f){h(!0);try{await i({instanceId:e,field:t}),v(null),b(!1),o.success(_e())}catch(e){o.error(m(),e)}finally{h(!1)}}}async function ne(){if(!f){h(!0);try{v(await a({instanceId:e})),b(!1),o.success(ge())}catch(e){o.error(Me(),e)}finally{h(!1)}}}let E=_?`openclaw devices approve ${_.id}`:``;async function ie(){if(E)try{await navigator.clipboard.writeText(E),b(!0)}catch{}}return(0,Z.jsxs)($,{label:te,children:[C?(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)(G,{variant:x?`outline`:`secondary`,children:x?O():D()}),(0,Z.jsx)(K,{type:`password`,autoComplete:`off`,className:`flex-1 min-w-32`,value:l,placeholder:x?s():Je(),onChange:e=>u(e.target.value)}),(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(L,{size:`sm`,onClick:()=>void w(),disabled:f||l.trim().length===0,children:Xe()}),C?(0,Z.jsx)(L,{size:`sm`,variant:`outline`,onClick:()=>void ne(),disabled:f,children:vt()}):null,x?(0,Z.jsx)(L,{size:`sm`,variant:`destructive`,onClick:()=>void T(),disabled:f,children:le()}):null]})]}),_?(0,Z.jsxs)(`div`,{className:`oc-bridgesecret__reveal`,children:[(0,Z.jsx)(`p`,{className:`text-sm font-medium`,children:ge()}),(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:yt()}),(0,Z.jsxs)(`div`,{className:`oc-sa__minted-box`,children:[(0,Z.jsx)(`code`,{className:`oc-sa__minted-plain`,children:E}),(0,Z.jsx)(L,{variant:`outline`,size:`sm`,onClick:()=>void ie(),children:y?re():S()})]}),(0,Z.jsx)(L,{size:`sm`,variant:`ghost`,onClick:()=>{v(null),b(!1)},children:P()})]}):null]})}var Kt={conversational:ve,documentary:be,summarizer:ot,curator:v},qt={conversational:b,documentary:l,summarizer:ne,curator:Ce},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:at()}),t.map(e=>(0,Z.jsx)(G,{variant:`secondary`,className:`oc-agenttype__chip`,title:Yt(e),children:Jt(e)},e)),(0,Z.jsxs)(kt,{children:[(0,Z.jsx)(Et,{asChild:!0,children:(0,Z.jsx)(L,{type:`button`,variant:`outline`,size:`sm`,className:`h-7`,children:T()})}),(0,Z.jsxs)(Dt,{align:`start`,className:`oc-agenttypes-pop`,children:[(0,Z.jsx)(`p`,{className:`oc-agenttypes-pop__title`,children:_()}),(0,Z.jsx)(`p`,{className:`oc-agenttypes-pop__hint`,children:Se()}),(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)(Mt,{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=j(N.agents.listAgentsForInstance,t&&e?{instanceName:e}:`skip`),o=c(N.agents.setAgentEnabled).withOptimisticUpdate((e,{instanceName:t,agentId:n,enabled:r})=>{let i=e.getQuery(N.agents.listAgentsForInstance,{instanceName:t});i&&e.setQuery(N.agents.listAgentsForInstance,{instanceName:t},{...i,agents:i.agents.map(e=>e.agentId===n?{...e,enabled:r}:e)})}),s=c(N.agents.setInstanceDefaultAgent).withOptimisticUpdate((e,{instanceName:t,agentId:n})=>{let r=e.getQuery(N.agents.listAgentsForInstance,{instanceName:t});r&&e.setQuery(N.agents.listAgentsForInstance,{instanceName:t},{...r,defaultAgentId:n})}),l=c(N.agents.setAgentTypes).withOptimisticUpdate((e,{instanceName:t,agentId:n,types:r})=>{let i=e.getQuery(N.agents.listAgentsForInstance,{instanceName:t});if(!i)return;let a=Rt(r);e.setQuery(N.agents.listAgentsForInstance,{instanceName:t},{...i,agents:i.agents.map(e=>e.agentId===n?{...e,types:a}:e)})}),u=c(N.agents.setAgentDescription).withOptimisticUpdate((e,{instanceName:t,agentId:n,description:r})=>{let i=e.getQuery(N.agents.listAgentsForInstance,{instanceName:t});if(!i)return;let a=r.trim();e.setQuery(N.agents.listAgentsForInstance,{instanceName:t},{...i,agents:i.agents.map(e=>e.agentId===n?{...e,description:a.length===0?null:a}:e)})}),d=c(N.agents.removeInstanceAgent),p=Ot(),m=R();async function g(t,n){if(e)try{await o({instanceName:e,agentId:t,enabled:n})}catch(e){m.error(M(),e)}}async function _(t){if(e)try{await s({instanceName:e,agentId:t})}catch(e){m.error(M(),e)}}async function v(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){m.error(M(),e)}}async function y(t,n){if(e&&await p({title:ie({name:n}),description:C(),confirmLabel:h(),destructive:!0}))try{await d({instanceName:e,agentId:t}),m.success(ue())}catch(e){m.error(M(),e)}}return(0,Z.jsx)(H,{open:t,onOpenChange:n,children:(0,Z.jsxs)(U,{className:`oc-access`,children:[(0,Z.jsxs)(jt,{children:[(0,Z.jsx)(W,{children:r({name:e??``})}),(0,Z.jsx)(Nt,{children:fe()})]}),i===void 0?(0,Z.jsx)(`p`,{className:`oc-access__hint`,children:ce()}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`div`,{className:`oc-access__poll`,children:i.discovery===null?oe():i.discovery.lastPollOk?Ke():a({error:i.discovery.error??`?`})}),i.agents.length===0?(0,Z.jsx)(`p`,{className:`oc-access__hint`,children:Ye()}):(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)(Mt,{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)(G,{variant:`outline`,className:`oc-access__gone`,children:f()}),(0,Z.jsx)(L,{size:`sm`,variant:`ghost`,className:`h-7 text-destructive`,onClick:()=>void y(t.agentId,a),children:me()})]}):r?(0,Z.jsx)(G,{variant:`default`,children:k()}):(0,Z.jsx)(L,{size:`sm`,variant:`outline`,className:`h-7`,disabled:!t.enabled,onClick:()=>void _(t.agentId),children:St()})]}),t.enabled?(0,Z.jsx)(Xt,{agentId:t.agentId,types:o,onToggle:e=>void v(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){m.error(M(),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)(K,{className:`oc-agentcard__desc`,value:n,maxLength:280,placeholder:Ee(),"aria-label":te(),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{c as e,i as t,r as n}from"./bundle-mjs-BJq7W7j9.js";import{$C as r,BM as i,JC as a,KC as o,QC as s,RM as c,VM as l,XC as u,YC as d,ZC as f,aw as p,c as m,co as h,do as g,ew as _,fo as v,iw as y,lo as b,mo as x,nw as S,oo as C,po as w,qC as T,rw as E,so as D,tw as O,uo as k}from"./dist--_yEYc8n.js";import{t as A}from"./button-DgrHAwnL.js";import{lt as j,m as M,ut as N}from"./index-CMhwTTOU.js";var P=e(t(),1),F=n();function I(){let e=l(m.integrations.status.status,{}),t=i(m.admin.setIntegrationConfig),[n,c]=(0,P.useState)(null);if((0,P.useEffect)(()=>{e&&n===null&&c(e.config)},[e,n]),!e||!n)return(0,F.jsx)(`p`,{className:`oc-admin__hint`,children:p()});let h=n,g=(e,t,n)=>c({...h,[e]:{...h[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:[y(),` `,(0,F.jsx)(`strong`,{children:E()}),` `,S()]}),(0,F.jsxs)(L,{title:`Langfuse`,status:e.langfuse.configured?e.langfuse.enabled?(0,F.jsx)(j,{variant:`secondary`,children:O()}):(0,F.jsx)(j,{variant:`outline`,children:_()}):(0,F.jsx)(j,{variant:`outline`,children:r()}),note:s(),children:[(0,F.jsx)(R,{label:u(),children:(0,F.jsx)(N,{value:h.langfuse.host??``,placeholder:e.langfuse.effectiveHost,onChange:e=>g(`langfuse`,`host`,e.target.value),onBlur:()=>b(`langfuse`,{host:h.langfuse.host??``})})}),(0,F.jsx)(z,{label:o(),checked:h.langfuse.enabled??!0,onChange:e=>{g(`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:O()}):(0,F.jsx)(j,{variant:`outline`,children:_()}):(0,F.jsx)(j,{variant:`outline`,children:r()}),note:f(),children:[(0,F.jsx)(R,{label:d(),children:(0,F.jsx)(N,{value:h.opik.baseUrl??``,placeholder:e.opik.effectiveBaseUrl,onChange:e=>g(`opik`,`baseUrl`,e.target.value),onBlur:()=>b(`opik`,{baseUrl:h.opik.baseUrl??``})})}),(0,F.jsx)(R,{label:a(),children:(0,F.jsx)(N,{value:h.opik.workspace??``,placeholder:e.opik.effectiveWorkspace||T(),onChange:e=>g(`opik`,`workspace`,e.target.value),onBlur:()=>b(`opik`,{workspace:h.opik.workspace??``})})}),(0,F.jsx)(z,{label:o(),checked:h.opik.enabled??!0,onChange:e=>{g(`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:O()}):(0,F.jsx)(j,{variant:`outline`,children:_()}):(0,F.jsx)(j,{variant:`outline`,children:x()}),note:w(),children:[(0,F.jsx)(R,{label:v(),children:(0,F.jsx)(N,{value:h.otlp.endpoint??``,placeholder:e.otlp.effectiveEndpoint||`https://otlp.example.com/v1/traces`,onChange:e=>g(`otlp`,`endpoint`,e.target.value),onBlur:()=>b(`otlp`,{endpoint:h.otlp.endpoint??``})})}),(0,F.jsx)(B,{headersSet:e.otlp.headersSet}),(0,F.jsx)(z,{label:o(),checked:h.otlp.enabled??!0,onChange:e=>{g(`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)(M,{checked:t,onCheckedChange:e=>n(e===!0)}),(0,F.jsx)(`span`,{children:e})]})}function B({headersSet:e}){let t=c(m.integrations.otlpSecret.setOtlpHeaders),n=i(m.integrations.otlpSecret.clearOtlpHeaders),[r,a]=(0,P.useState)(``),[o,s]=(0,P.useState)(null),[l,u]=(0,P.useState)(!1),d=async()=>{u(!0),s(null);try{await t({headersJson:r}),a(``)}catch(e){s(e instanceof Error?e.message:String(e))}finally{u(!1)}};return(0,F.jsxs)(R,{label:g(),children:[(0,F.jsx)(N,{value:r,placeholder:e?k():b(),onChange:e=>a(e.target.value)}),(0,F.jsxs)(`div`,{className:`oc-int__otlp-headers-actions`,children:[(0,F.jsx)(A,{size:`sm`,disabled:l||r.trim().length===0,onClick:()=>void d(),children:h()}),e?(0,F.jsx)(A,{variant:`ghost`,size:`sm`,disabled:l,onClick:()=>void n({}),children:D()}):null]}),o?(0,F.jsx)(`p`,{className:`oc-int__otlp-headers-error`,children:o}):null,(0,F.jsx)(`p`,{className:`oc-uipa__note`,children:C()})]})}export{I as IntegrationsTab};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{c as e,i as t,r as n}from"./bundle-mjs-BJq7W7j9.js";import{Am as r,Bw as i,Dm as a,Em as o,Fm as s,Hw as c,Im as l,Lm as u,Mm as d,Mw as f,Nm as p,Om as m,Pm as h,Tm as g,VM as _,Vw as v,c as y,jm as b,jw as x,km as S,pT as C,wm as w,zw as T}from"./dist--_yEYc8n.js";import{St as E,Xt as ee,Zt as te,i as ne,o as re,r as D}from"./index-CMhwTTOU.js";import{a as O,n as k,o as A,r as j,t as M}from"./card-Dq94Pad-.js";import{n as N,t as P}from"./TimeRangePicker-D2BzLnpx.js";var F=e(t(),1),I=n(),L=15,R=e=>String(Math.round(e));function z(){let e=_(y.me.getMe,{host:E})?.permissions?.includes(`traces.read`)??!1,t=_(y.deliveryTiming.listDeliverySessions,e?{}:`skip`),n=(0,F.useMemo)(()=>t?t.filter(e=>!e.active&&e.rollup!==null&&e.rollup.cP50!==null&&e.rollup.aP50!==null).slice(0,L).reverse().map(e=>({startedAt:e.startedAt,cP50:e.rollup?.cP50,aP50:e.rollup?.aP50})):[],[t]);return t===void 0?null:(0,I.jsxs)(`section`,{className:`oc-kpi__group`,children:[(0,I.jsx)(`h2`,{className:`oc-kpi__group-title`,children:C()}),(0,I.jsxs)(M,{children:[(0,I.jsxs)(O,{children:[(0,I.jsx)(A,{children:c()}),(0,I.jsx)(j,{children:i()})]}),(0,I.jsx)(k,{children:n.length<2?(0,I.jsx)(`p`,{className:`oc-admin__hint`,children:T()}):(0,I.jsx)(B,{series:n})})]})]})}function B({series:e}){let t=e.map(e=>e.cP50),n=e.map(e=>e.aP50),r=Math.max(1,...t,...n),i=t=>6+t*468/(e.length-1),a=e=>74-e*68/r,o=e=>e.map((e,t)=>`${t===0?`M`:`L`}${i(t).toFixed(1)},${a(e).toFixed(1)}`).join(` `),s=e[e.length-1];return(0,I.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,I.jsxs)(`div`,{className:`flex gap-3 text-xs text-muted-foreground`,children:[(0,I.jsxs)(`span`,{style:{color:`var(--primary)`},children:[x(),` p50 `,R(s.cP50),` `,v()]}),(0,I.jsxs)(`span`,{children:[f(),` p50 `,R(s.aP50),` `,v()]})]}),(0,I.jsxs)(`svg`,{viewBox:`0 0 480 80`,className:`h-20 w-full`,preserveAspectRatio:`none`,role:`img`,"aria-label":c(),children:[(0,I.jsx)(`path`,{d:o(n),fill:`none`,style:{stroke:`var(--muted-foreground)`},strokeWidth:1.5}),(0,I.jsx)(`path`,{d:o(t),fill:`none`,style:{stroke:`var(--primary)`},strokeWidth:1.5})]})]})}var V=[{metric:`api.calls`,label:u(),unit:`/h`,group:`API`,isError:!1},{metric:`api.errors`,label:l(),unit:`/h`,group:`API`,isError:!0},{metric:`api.latency.avg_ms`,label:s(),unit:`ms`,group:`API`,isError:!1},{metric:`openclaw.ingest`,label:h(),unit:`/h`,group:`OpenClaw`,isError:!1},{metric:`chat.send`,label:p(),unit:`/h`,group:`Chat`,isError:!1},{metric:`assistant.stream.errors`,label:d(),unit:`/h`,group:`Assistant`,isError:!0}],H=V.length,U=[`API`,`OpenClaw`,`Chat`,`Assistant`],W=1e3,G=36e5;function K(e,t){let n=Math.max(1,Math.ceil((t-e)/G)),r=Math.min(n*H,W);return{rowLimit:r,buckets:Math.max(1,Math.floor(r/H))}}function q(){let e=te({from:`/settings/kpi`}),t=ee({from:`/settings/kpi`}),n=ne(e.from,e.to,D,`now`),i=e=>void t({search:t=>({...t,...re(e)})}),{from:a,to:o}=N(n),{rowLimit:s,buckets:c}=K(a,o),l=_(y.kpi.listKpis,{limit:s,filter:{from:a,to:o}}),u=(0,F.useMemo)(()=>{let e=new Map;for(let t of l??[]){let n=e.get(t.metric)??[];n.push({bucket:t.bucket,value:t.value}),e.set(t.metric,n)}for(let[t,n]of e)n.sort((e,t)=>e.bucket<t.bucket?-1:+(e.bucket>t.bucket)),n.length>c&&e.set(t,n.slice(n.length-c));return e},[l,c]),d=(0,I.jsxs)(I.Fragment,{children:[(0,I.jsxs)(`p`,{className:`oc-admin__hint`,children:[b(),` `,(0,I.jsx)(`span`,{className:`oc-filter__window`,children:r()})]}),(0,I.jsx)(J,{value:n,onChange:i})]});return l===void 0?(0,I.jsxs)(I.Fragment,{children:[d,(0,I.jsx)(z,{}),(0,I.jsx)(`p`,{className:`oc-admin__hint`,children:S()})]}):l.length===0?(0,I.jsxs)(I.Fragment,{children:[d,(0,I.jsx)(z,{}),(0,I.jsx)(`p`,{className:`oc-admin__hint`,children:m()})]}):(0,I.jsxs)(I.Fragment,{children:[d,(0,I.jsx)(z,{}),U.map(e=>{let t=V.filter(t=>t.group===e);return t.some(e=>(u.get(e.metric)??[]).length>0)?(0,I.jsxs)(`section`,{className:`oc-kpi__group`,children:[(0,I.jsx)(`h2`,{className:`oc-kpi__group-title`,children:e}),(0,I.jsx)(`div`,{className:`oc-kpi__grid`,children:t.map(e=>(0,I.jsx)(Y,{config:e,series:u.get(e.metric)??[]},e.metric))})]},e):null})]})}function J({value:e,onChange:t}){return(0,I.jsx)(`div`,{className:`oc-kpi__toolbar`,children:(0,I.jsx)(P,{value:e,onChange:t})})}function Y({config:e,series:t}){let n=t.length>0?t[t.length-1]:null,r=n?n.value:0;return(0,I.jsxs)(M,{size:`sm`,className:`oc-kpi__card`,children:[(0,I.jsxs)(O,{children:[(0,I.jsx)(A,{className:`oc-kpi__card-title`,children:e.label}),(0,I.jsx)(j,{className:`oc-kpi__card-metric`,children:(0,I.jsx)(`code`,{children:e.metric})})]}),(0,I.jsxs)(k,{className:`oc-kpi__card-body`,children:[(0,I.jsxs)(`div`,{className:`oc-kpi__value-row`,children:[(0,I.jsx)(`span`,{className:`oc-kpi__value`+(e.isError&&r>0?` oc-kpi__value--error`:``),children:Q(r)}),(0,I.jsx)(`span`,{className:`oc-kpi__unit`,children:e.unit})]}),(0,I.jsx)(ae,{series:t,isError:e.isError,unit:e.unit}),(0,I.jsxs)(`div`,{className:`oc-kpi__axis`,children:[n?(0,I.jsx)(`span`,{className:`oc-kpi__axis-latest`,children:a({value:$(n.bucket)})}):(0,I.jsx)(`span`,{className:`oc-kpi__muted`,children:o()}),(0,I.jsx)(`span`,{className:`oc-kpi__muted`,children:g({count:t.length})})]})]})]})}var X=240,Z=48,ie=1;function ae({series:e,isError:t,unit:n}){if(e.length===0)return(0,I.jsx)(`div`,{className:`oc-kpi__chart oc-kpi__chart--empty`,"aria-hidden":!0});let r=e.reduce((e,t)=>t.value>e?t.value:e,0),i=X/e.length,a=Math.max(i-ie,1);return(0,I.jsx)(`svg`,{className:`oc-kpi__chart`,viewBox:`0 0 ${X} ${Z}`,preserveAspectRatio:`none`,role:`img`,"aria-label":w({max:Q(r),unit:n}),children:e.map((e,o)=>{let s=r>0?e.value/r*(Z-1):0,c=o*i,l=Z-s;return(0,I.jsx)(`rect`,{className:`oc-kpi__bar`+(t&&e.value>0?` oc-kpi__bar--error`:``),x:c,y:l,width:a,height:s,children:(0,I.jsxs)(`title`,{children:[$(e.bucket),` · `,Q(e.value),` `,n]})},e.bucket)})})}function Q(e){return Number.isFinite(e)?Math.abs(e)>=1e3?(e/1e3).toFixed(e%1e3==0?0:1)+`k`:String(e):`0`}function $(e){let t=new Date(`${e}:00:00Z`);return Number.isNaN(t.getTime())?e:`${String(t.getUTCDate()).padStart(2,`0`)}/${String(t.getUTCMonth()+1).padStart(2,`0`)} ${String(t.getUTCHours()).padStart(2,`0`)}h`}export{q as KpiTab};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{c as e,i as t,r as n}from"./bundle-mjs-BJq7W7j9.js";import{$O as r,Ak as i,BM as a,CM as o,Ck as s,D as c,DM as l,Dk as u,Ek as d,M as f,MM as p,Mk as m,N as ee,Nk as te,Ok as h,Pk as g,QO as ne,SM as re,Sk as ie,Tk as ae,VM as _,XO as oe,Xx as se,YO as ce,ZO as le,_ as ue,_M as de,_k as fe,ak as pe,bM as me,bk as he,c as v,cM as y,ck as b,dM as x,dk as S,ek as C,f as w,fM as T,fk as E,g as D,gM as O,gk as k,h as A,hM as j,hk as M,ik as N,jk as P,kk as F,lM as I,lk as L,m as R,mM as ge,mk as _e,n as z,nk as B,ok as ve,p as ye,pM as be,pk as xe,rk as Se,sM as Ce,sk as we,tk as Te,uM as Ee,uk as De,v as Oe,vM as ke,vk as Ae,wM as je,wk as Me,xM as Ne,xk as Pe,y as Fe,yM as Ie,yk as Le}from"./dist--_yEYc8n.js";import{t as V}from"./button-DgrHAwnL.js";import{B as Re,C as H,S as ze,St as U,T as Be,bt as Ve,j as He,lt as W,m as G,t as Ue,ut as K,w as We,x as Ge,xt as Ke,yt as qe}from"./index-CMhwTTOU.js";import{t as Je}from"./localePickerView-C2RmOS86.js";var q=e(t(),1),J=n();function Ye({className:e,checked:t,onCheckedChange:n,disabled:r,...i}){return(0,J.jsx)(`button`,{type:`button`,role:`switch`,"aria-checked":t,"data-state":t?`checked`:`unchecked`,disabled:r,onClick:()=>n(!t),className: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,J.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 Y=[{id:`messages`,label:()=>g()},{id:`composer`,label:()=>te()},{id:`sidebar`,label:()=>m()},{id:`notifications`,label:()=>M()},{id:`other`,label:()=>P()}],X={showSource:{category:`messages`,label:()=>i(),help:()=>F()},showReport:{category:`messages`,label:()=>h(),help:()=>u()},copyAssistant:{category:`messages`,label:()=>d()},copyUser:{category:`messages`,label:()=>ae()},showDelete:{category:`messages`,label:()=>Me()},showTools:{category:`messages`,label:()=>s(),help:()=>ie()},voiceInput:{category:`composer`,label:()=>Pe(),help:()=>he()},showUsage:{category:`composer`,label:()=>Le(),help:()=>Ae()},autoReadAloud:{category:`composer`,label:()=>ee(),help:()=>f()},showChatAge:{category:`sidebar`,label:()=>fe(),help:()=>k()},notifSound:{category:`notifications`,label:()=>_e(),help:()=>xe()},notifSystem:{category:`notifications`,label:()=>E(),help:()=>S()},replySound:{category:`notifications`,label:()=>De(),help:()=>L()}};function Z(e){return e.toLowerCase().normalize(`NFD`).replace(/\p{Diacritic}/gu,``)}function Q(e,t){let n=Z(t.trim()),r=new Map(Y.map(e=>[e.id,e.label()])),i=new Map(Y.map(e=>[e.id,[]]));for(let t of e){let e=X[t],a=e?.category??`other`;n&&!Z(`${e?e.label():t} ${e?.help?e.help():``} ${t} ${r.get(a)??``}`).includes(n)||i.get(a).push(t)}return Y.map(e=>({id:e.id,label:r.get(e.id),keys:i.get(e.id)})).filter(e=>e.keys.length>0)}var Xe=[`showSource`,`showReport`,`copyAssistant`,`copyUser`,`showDelete`,`showTools`,`voiceInput`,`showChatAge`,`showUsage`,`autoReadAloud`,`notifSound`,`notifSystem`,`replySound`],Ze={voiceInput:`voiceInput`};function Qe(e){return Xe.includes(e)}function $(e){return e===`admin`}function $e(e){return e===!0?`on`:e===!1?`off`:`inherit`}function et(e){return e===`on`?!0:e===`off`?!1:null}function tt(e){return Qe(e)?Ze[e]:void 0}var nt={voiceInput:()=>r()};function rt({prefKey:e,ui:t}){let n=a(v.admin.setUiPrefDefault),r=a(v.admin.setFeatureEnabled),i=tt(e),o=i?nt[e]?.():void 0;return(0,J.jsxs)(`div`,{className:`oc-prefs__gov`,children:[(0,J.jsxs)(`div`,{className:`oc-prefs__gov-row`,children:[(0,J.jsx)(`span`,{className:`oc-prefs__gov-label`,children:Se()}),(0,J.jsxs)(Ge,{value:$e(t.defaults[e]),onValueChange:t=>void n({key:e,value:et(t)}),children:[(0,J.jsx)(We,{size:`sm`,className:`w-36`,children:(0,J.jsx)(Be,{})}),(0,J.jsxs)(ze,{children:[(0,J.jsx)(H,{value:`on`,children:le()}),(0,J.jsx)(H,{value:`off`,children:oe()}),(0,J.jsx)(H,{value:`inherit`,children:ce()})]})]}),i?(0,J.jsxs)(`span`,{className:`oc-prefs__gov-gate`,children:[(0,J.jsx)(G,{checked:t.featuresEnabled[i]===!0,onCheckedChange:e=>void r({key:i,enabled:e===!0}),"aria-label":B()}),B()]}):null]}),o?(0,J.jsx)(`span`,{className:`oc-prefs__gov-help`,children:o}):null]})}function it({current:e,enabled:t}){let n=a(v.me.setDictationShortcut),[r,i]=(0,q.useState)(!1),[o,s]=(0,q.useState)(!1);return(0,q.useEffect)(()=>{if(!r)return;let e=e=>{if(e.preventDefault(),e.stopPropagation(),e.key===`Escape`){i(!1);return}let t=Ve(e);if(t===null){[`Shift`,`Control`,`Meta`,`Alt`].includes(e.key)||(s(!0),window.setTimeout(()=>s(!1),1800));return}i(!1),n({shortcut:t})};return window.addEventListener(`keydown`,e,!0),()=>window.removeEventListener(`keydown`,e,!0)},[r,n]),(0,J.jsxs)(`div`,{className:`oc-prefs__row${t?``:` is-locked`}`,children:[(0,J.jsxs)(`div`,{className:`oc-prefs__info`,children:[(0,J.jsxs)(`span`,{className:`oc-prefs__label`,children:[Fe(),e?(0,J.jsx)(W,{variant:`secondary`,children:Ke(e,qe())}):null]}),(0,J.jsx)(`span`,{className:`oc-prefs__help`,children:o?D():r?ue():Oe()})]}),(0,J.jsxs)(`div`,{className:`oc-prefs__ctl`,children:[e&&!r?(0,J.jsx)(`button`,{type:`button`,className:`oc-prefs__reset`,onClick:()=>void n({shortcut:null}),children:w()}):null,(0,J.jsx)(`button`,{type:`button`,className:`oc-prefs__reset`,disabled:!t,"aria-pressed":r,onClick:()=>i(e=>!e),children:r?ye():e?R():A()})]})]})}function at(){let[e,t]=(0,q.useState)(``),[n,r]=(0,q.useState)(!1),i=_(v.me.getMe,{host:U}),o=i?.ui,s=$(i?.role)&&n,l=a(v.me.setUiPref).withOptimisticUpdate(He),u=(0,q.useMemo)(()=>o?Q(Object.keys(o.effective),e):[],[o,e]);return o?(0,J.jsxs)(`div`,{className:`oc-prefs-panel`,children:[$(i?.role)?(0,J.jsxs)(`label`,{className:`oc-prefs__gov-toggle`,children:[(0,J.jsx)(G,{checked:n,onCheckedChange:e=>r(e===!0),"aria-label":N()}),N()]}):null,s?(0,J.jsxs)(`div`,{className:`oc-prefs__gov-head`,children:[(0,J.jsx)(`p`,{children:Te()}),(0,J.jsx)(`p`,{children:C()}),(0,J.jsx)(`p`,{children:ne()})]}):null,(0,J.jsx)(K,{value:e,onChange:e=>t(e.target.value),placeholder:b(),"aria-label":b(),className:`mb-2`}),u.length===0?(0,J.jsx)(`div`,{className:`oc-prefs__empty`,children:we()}):(0,J.jsx)(`div`,{className:`oc-prefs`,children:u.map(e=>(0,J.jsxs)(`section`,{className:`oc-prefs__card`,children:[(0,J.jsx)(`h4`,{className:`oc-prefs__cat`,children:e.label}),e.keys.map(e=>{let t=X[e],n=t?t.label():e,r=t?.help?.(),i=o.locked[e],a=o.effective[e],u=o.userOverrides[e]!==void 0;return(0,J.jsxs)(`div`,{className:`oc-prefs__row${i?` is-locked`:``}`,children:[(0,J.jsxs)(`div`,{className:`oc-prefs__info`,children:[(0,J.jsxs)(`span`,{className:`oc-prefs__label`,children:[n,i?(0,J.jsx)(W,{variant:`outline`,children:ve()}):u?(0,J.jsx)(W,{variant:`secondary`,children:c()}):null]}),r?(0,J.jsx)(`span`,{className:`oc-prefs__help`,children:r}):null]}),(0,J.jsxs)(`div`,{className:`oc-prefs__ctl`,children:[!i&&u?(0,J.jsx)(`button`,{type:`button`,className:`oc-prefs__reset`,onClick:()=>void l({key:e,value:null}),children:pe()}):null,(0,J.jsx)(Ye,{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})]}),s?(0,J.jsx)(rt,{prefKey:e,ui:o}):null]},e)})]},e.id))}),(0,J.jsx)(it,{current:i?.dictationShortcut??null,enabled:o.effective.voiceInput===!0})]}):(0,J.jsx)(`div`,{className:`oc-prefs__empty`,children:p()})}var ot={sm:()=>T(),md:()=>x(),lg:()=>Ee(),xl:()=>I()};function st(){let e=_(v.me.getMe,{host:U}),t=a(v.me.setLocale),n=a(v.me.setFontScale).withOptimisticUpdate((e,{scale:t})=>{let n=e.getQuery(v.me.getMe,{host:U});n&&e.setQuery(v.me.getMe,{host:U},{...n,fontScale:t,resolvedFontScale:t??`md`})}),r=a(v.me.setMyName),i=Re(),s=e?.locale??`default`,c=e?.name??``,[u,d]=(0,q.useState)(null),f=u??c,p=f.trim()!==c.trim();async function m(){try{await r({name:f}),d(null),i.success(me())}catch(e){i.error(Ie(),e)}}return(0,J.jsxs)(`div`,{className:`oc-appearance`,children:[(0,J.jsxs)(`section`,{className:`oc-show__section`,children:[(0,J.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,J.jsx)(`h2`,{className:`oc-show__title`,children:je()}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:o()})]}),(0,J.jsxs)(`div`,{className:`oc-show__row`,children:[(0,J.jsx)(K,{className:`max-w-xs`,value:f,maxLength:120,placeholder:re(),onChange:e=>d(e.target.value),onKeyDown:e=>{e.key===`Enter`&&p&&(e.preventDefault(),m())}}),(0,J.jsx)(V,{size:`sm`,disabled:!p,onClick:()=>void m(),children:se()})]}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:Ne()})]}),(0,J.jsxs)(`section`,{className:`oc-show__section`,children:[(0,J.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,J.jsx)(`h2`,{className:`oc-show__title`,children:ke()}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:de()})]}),(0,J.jsxs)(`div`,{className:`oc-show__row`,children:[Je().map(e=>(0,J.jsx)(V,{variant:s===e.value?`default`:`outline`,size:`sm`,onClick:()=>void t({locale:e.value}),children:e.label},e.value)),(0,J.jsx)(V,{variant:s==="default"?`default`:`outline`,size:`sm`,onClick:()=>void t({locale:null}),children:l()})]}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:O()})]}),(0,J.jsxs)(`section`,{className:`oc-show__section`,children:[(0,J.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,J.jsx)(`h2`,{className:`oc-show__title`,children:j()}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:ge()})]}),(0,J.jsx)(`div`,{className:`oc-show__row`,children:Ue.map(t=>(0,J.jsx)(V,{variant:(e?.fontScale??`md`)===t?`default`:`outline`,size:`sm`,onClick:()=>void n({scale:t}),children:ot[t]()},t))}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:be()})]}),(0,J.jsxs)(`section`,{className:`oc-show__section`,children:[(0,J.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,J.jsx)(`h2`,{className:`oc-show__title`,children:y()}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:Ce()})]}),(0,J.jsx)(at,{})]})]})}export{st as PreferencesTab};
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import{c as e,i as t,r as n}from"./bundle-mjs-BJq7W7j9.js";import{$h as r,BM as i,Cg as a,Ft as o,Ji as s,Nt as c,Pt as l,Qh as u,Qi as d,Sg as f,VM as p,Xh as m,Xi as h,Yi as g,Zh as _,Zi as v,ag as y,c as b,cg as x,dg as S,dr as C,eg as w,fg as T,fr as E,hg as D,ig as O,lg as ee,lr as te,mg as ne,mr as re,ng as ie,og as ae,pg as oe,pr as se,rg as k,sg as A,tg as j,ug as M,ur as N}from"./dist--_yEYc8n.js";import{d as P,f as F,i as I,l as L,n as R,r as z,t as B,u as V}from"./FieldLabel-C15_DFF2.js";import{t as H}from"./button-DgrHAwnL.js";import{B as U,C as W,S as G,St as K,T as q,m as ce,w as J,x as Y}from"./index-CMhwTTOU.js";import{r as X,t as Z}from"./locales-CPjguROj.js";import{t as le}from"./localePickerView-C2RmOS86.js";/* empty css */var Q=e(t(),1),$=n(),ue={media_delivery:{label:M,help:ee},documentary_fetch:{label:x,help:A},inbound_files:{label:ae,help:y},history_summary:{label:d,help:v},file_curation:{label:re,help:se}},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:u,references:_,files:m,previous_summary:h,new_messages:g,max_chars:s,file_name:E,budget_chars:C,feedback:N,content:te};function pe(){let e=p(b.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:k()})});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)(R,{label:D(),help:ne()}),(0,$.jsxs)(`label`,{className:`oc-injtab__picker`,children:[(0,$.jsx)(`span`,{children:O()}),(0,$.jsxs)(Y,{value:r._id,onValueChange:e=>n(e),children:[(0,$.jsx)(J,{size:`sm`,className:`min-w-44`,children:(0,$.jsx)(q,{})}),(0,$.jsx)(G,{children:e.map(e=>(0,$.jsx)(W,{value:e._id,children:e.displayName??e.name},e._id))})]})]})]}),(0,$.jsx)(me,{instance:r},r._id)]})}function me({instance:e}){let t=i(b.admin.upsertInstanceConfig),n=U(),r=p(b.me.getMe,{host:K}),s=e.config??{},u=X(e.config?.contentLocale,r?.defaultLocale??void 0),[d,m]=(0,Q.useState)(()=>I(s,u));(0,Q.useEffect)(()=>{m(I(s,u))},[u,e._id]);let[h,g]=(0,Q.useState)(!1),_=d.promptInjections,v=(e,t)=>m({...d,promptInjections:{..._,[e]:{..._[e],...t}}});async function y(){g(!0);try{await t({instanceId:e._id,config:z(d,s,u)})}catch(e){n.error(f(),e)}finally{g(!1)}}async function x(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 S=e.config?.contentLocale??`default`,C=Z[X(void 0,r?.defaultLocale??void 0)];return(0,$.jsxs)(`div`,{className:`oc-injtab__body`,children:[(0,$.jsxs)(`div`,{className:`oc-injtab__content-locale`,children:[(0,$.jsx)(`span`,{children:o()}),(0,$.jsxs)(Y,{value:S,onValueChange:e=>void x(e),children:[(0,$.jsx)(J,{size:`sm`,className:`min-w-44`,children:(0,$.jsx)(q,{})}),(0,$.jsxs)(G,{children:[(0,$.jsx)(W,{value:`default`,children:c({locale:C})}),le().map(e=>(0,$.jsx)(W,{value:e.value,children:e.label},e.value))]})]}),(0,$.jsx)(`p`,{className:`oc-admin__hint`,children:l()})]}),V.map(e=>(0,$.jsx)(he,{injKey:e,def:L[e],i18n:ue[e],row:_[e]??{enabled:!0,template:L[e].defaultTemplate[u]},contentLocale:u,onChange:t=>v(e,t)},e)),(0,$.jsx)(`div`,{className:`oc-injtab__actions`,children:(0,$.jsx)(H,{size:`sm`,onClick:()=>void y(),disabled:h,children:a()})})]})}function he({injKey:e,def:t,i18n:n,row:i,contentLocale:a,onChange:o}){let[s,c]=(0,Q.useState)(!1),l=i.template.trim()!==t.defaultTemplate[a],u=t.togglable&&!i.enabled,d=Object.fromEntries(t.placeholders.map(e=>[e,de[e]??`{${e}}`])),f=P(e,i,a),p=f?F(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)(ce,{checked:i.enabled,onCheckedChange:e=>o({enabled:e===!0})}),(0,$.jsx)(R,{label:n.label(),help:n.help()})]}):(0,$.jsx)(R,{label:n.label(),help:n.help()}),l&&(0,$.jsx)(`span`,{className:`oc-injection__badge`,children:T()})]}),(0,$.jsx)(`textarea`,{className:`oc-injcard__text`,value:i.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:S()}),t.placeholders.map(e=>(0,$.jsxs)(`span`,{className:`oc-injcard__ph-chip`,children:[(0,$.jsx)(`code`,{children:`{${e}}`}),(0,$.jsx)(B,{text:(fe[e]??(()=>e))()})]},e))]}),(0,$.jsxs)(`div`,{className:`oc-injcard__btns`,children:[(0,$.jsx)(H,{variant:`ghost`,size:`sm`,onClick:()=>c(e=>!e),children:s?j():ie()}),l&&(0,$.jsx)(H,{variant:`ghost`,size:`sm`,onClick:()=>o({template:t.defaultTemplate[a]}),children:oe()})]})]}),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:r()})})]})}export{pe as PromptInjectionsTab};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{c as e,i as t,r as n}from"./bundle-mjs-BJq7W7j9.js";import{$y as r,Ay as i,BM as a,By as o,Cy as s,Dy as c,Ey as l,Gy as u,Hy as d,Iy as f,Jy as p,Ky as m,Ly as h,Oy as g,Qy as _,Rr as v,Ry as y,Sy as b,Ty as x,Uy as S,VM as ee,Vy as te,Wy as ne,Xy as re,Yy as ie,Zy as C,ab as w,c as T,cb as E,db as D,eb as O,ib as k,ky as A,lb as j,nb as M,ob as N,qy as P,rb as F,sb as I,tb as L,ub as R,wy as ae,zy as z}from"./dist--_yEYc8n.js";import{t as B}from"./button-DgrHAwnL.js";import{B as V,V as H,d as U,lt as W,m as G,ut as K,zt as q}from"./index-CMhwTTOU.js";import{t as J}from"./roleDescriptions-D0TCU7rm.js";var Y=e(t(),1),X=n(),Z=[{group:()=>D(),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:()=>E(),keys:[{key:`chats.read`,label:()=>N()},{key:`selfheal`,label:()=>r()},{key:`feedback.respond`,label:()=>v()}]},{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=ee(T.apiKeys.listRoles,{}),t=a(T.apiKeys.createRole),n=a(T.apiKeys.ensureRolesSeeded),r=a(T.apiKeys.updateRolePermissions).withOptimisticUpdate((e,{roleId:t,permissions:n})=>{let r=e.getQuery(T.apiKeys.listRoles,{});r&&e.setQuery(T.apiKeys.listRoles,{},r.map(e=>e._id===t?{...e,permissions:n}:e))}),v=H(),w=V(),[E,D]=(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)||j.has(e._id))return;let n=e.permissions.includes(t)?e.permissions.filter(e=>e!==t):[...e.permissions,t];if(!(e.builtin&&!await v({title:re({name:e.name}),description:ie(),confirmLabel:p()}))){M(t=>new Set(t).add(e._id));try{await r({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($),D(!1)}catch(e){w.error(m(),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:[u(),` `,(0,X.jsx)(`code`,{children:`admin`}),` `,ne(),` `,(0,X.jsx)(`code`,{children:`traces.read.content`}),` `,S()]}),(0,X.jsxs)(`div`,{className:`oc-dt`,children:[(0,X.jsxs)(`div`,{className:`oc-dt__bar`,children:[(0,X.jsx)(`h2`,{className:`oc-dt__title`,children:d()}),(0,X.jsx)(`div`,{className:`oc-dt__bar-actions`,children:(0,X.jsx)(B,{size:`sm`,onClick:()=>{k($),D(!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:y()}),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?_({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)(W,{variant:`outline`,className:`gap-1`,children:[(0,X.jsx)(q,{}),` `,h()]}):(0,X.jsx)(W,{variant:`secondary`,children:f()})]}),J(e)?(0,X.jsx)(`p`,{className:`oc-matrix__roledesc`,children:J(e)}):null]}),oe.map(r=>(0,X.jsx)(`td`,{className:`oc-matrix__cell`,children:(0,X.jsx)(G,{checked:t||e.permissions.includes(r),disabled:t||n,"aria-label":`${e.key} · ${r}`,title:t?i():n?A():r,onCheckedChange:()=>void F(e,r)})},r))]},e.key)})})]})})]}),(0,X.jsx)(U,{open:E,onOpenChange:D,title:g(),description:c(),canSubmit:!!(O.key&&O.name),onSubmit:I,submitLabel:l(),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:x()}),(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:b()}),(0,X.jsx)(K,{value:O.description,onChange:e=>k({...O,description:e.target.value})})]})]})})]})}export{se as RolesTab};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{c as e,i as t,r as n}from"./bundle-mjs-BJq7W7j9.js";import{MM as r,PM as i,RM as a,Sj as o,_j as s,bj as c,c as l,cj as u,dj as d,fj as f,gj as p,hj as m,lj as h,mj as g,pj as _,sj as v,uj as y,vj as b,xj as x,yj as S}from"./dist--_yEYc8n.js";import{t as C}from"./button-DgrHAwnL.js";import{It as w,lt as T}from"./index-CMhwTTOU.js";import{a as E,i as D,n as O,o as k,r as A,t as j}from"./table-B58636RR.js";var M=e(t(),1),N=n();function P(){let e=a(l.scheduled.listMyCrons),[t,n]=(0,M.useState)(null),[P,F]=(0,M.useState)(!1),[I,L]=(0,M.useState)(!1),R=(0,M.useCallback)(async()=>{F(!0),L(!1);try{n(await e({}))}catch{L(!0)}finally{F(!1)}},[e]);(0,M.useEffect)(()=>{R()},[R]);let z=(0,M.useMemo)(()=>new Intl.DateTimeFormat(i(),{dateStyle:`medium`,timeStyle:`short`}),[]),B=t?.reduce((e,t)=>e+t.jobs.length,0)??0;return(0,N.jsxs)(N.Fragment,{children:[(0,N.jsxs)(`div`,{style:{display:`flex`,alignItems:`flex-start`,gap:8,marginBottom:12},children:[(0,N.jsx)(`p`,{className:`oc-admin__hint`,style:{flex:1,margin:0},children:o()}),(0,N.jsxs)(C,{variant:`ghost`,size:`sm`,onClick:()=>void R(),disabled:P,style:{display:`inline-flex`,alignItems:`center`,gap:4},children:[(0,N.jsx)(w,{size:14,"aria-hidden":!0}),x()]})]}),t===null?(0,N.jsx)(`p`,{className:`oc-admin__hint`,"aria-busy":P,children:I?c():r()}):(0,N.jsxs)(N.Fragment,{children:[I?(0,N.jsx)(`p`,{className:`oc-admin__hint`,children:c()}):null,t.length===0?(0,N.jsx)(`p`,{className:`oc-admin__hint`,children:S()}):null,t.map(e=>(0,N.jsxs)(`section`,{style:{marginBottom:20},children:[t.length>1||e.error||!e.supported?(0,N.jsxs)(`h3`,{style:{display:`flex`,alignItems:`center`,gap:8,fontSize:`0.85rem`,fontWeight:600,margin:`0 0 6px`},children:[e.instanceName,(0,N.jsx)(T,{variant:`outline`,children:e.kind})]}):null,e.supported?e.error?(0,N.jsx)(`p`,{className:`oc-admin__hint`,children:s({code:e.error})}):e.jobs.length===0?(0,N.jsx)(`p`,{className:`oc-admin__hint`,children:p()}):(0,N.jsxs)(j,{children:[(0,N.jsx)(E,{children:(0,N.jsxs)(k,{children:[(0,N.jsx)(D,{children:m()}),(0,N.jsx)(D,{children:g()}),(0,N.jsx)(D,{children:_()}),(0,N.jsx)(D,{children:f()}),(0,N.jsx)(D,{children:d()})]})}),(0,N.jsx)(O,{children:e.jobs.map((t,n)=>(0,N.jsxs)(k,{children:[(0,N.jsx)(A,{className:`font-medium`,style:{maxWidth:280,overflow:`hidden`,textOverflow:`ellipsis`},title:t.name??void 0,children:t.name??y()}),(0,N.jsx)(A,{children:(0,N.jsx)(T,{variant:`secondary`,children:t.agentId})}),(0,N.jsx)(A,{className:`whitespace-nowrap`,style:{fontFamily:`var(--font-mono, monospace)`},children:t.schedule??`—`}),(0,N.jsx)(A,{className:`whitespace-nowrap text-muted-foreground`,children:t.nextRunAtMs===null?`—`:z.format(t.nextRunAtMs)}),(0,N.jsxs)(A,{children:[t.enabled===!0?(0,N.jsx)(T,{variant:`secondary`,children:u()}):t.enabled===!1?(0,N.jsx)(T,{variant:`outline`,children:h()}):(0,N.jsx)(`span`,{className:`text-muted-foreground`,children:`—`}),t.lastRunStatus?(0,N.jsx)(`span`,{className:`text-muted-foreground`,style:{marginLeft:8,fontSize:`0.8rem`},children:t.lastRunStatus}):null]})]},t.id??`${e.instanceName}-${n}`))})]}):(0,N.jsx)(`p`,{className:`oc-admin__hint`,children:b()})]},e.instanceName)),B>0?(0,N.jsx)(`p`,{className:`oc-admin__hint`,style:{marginTop:4},children:v()}):null]})]})}export{P as ScheduledTab};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{c as e,i as t,r as n}from"./bundle-mjs-BJq7W7j9.js";import{$D as r,AD as i,AO as ee,BD as a,BM as o,BO as te,CO as ne,DO as re,EO as ie,FD as s,FO as ae,GD as c,GO as oe,HD as l,HO as u,ID as d,IO as se,JD as f,JO as ce,KD as p,KO as le,LD as m,LO as ue,MD as h,MO as de,ND as g,NO as fe,OD as pe,OO as me,PD as he,PO as ge,QD as _e,RD as _,RM as ve,RO as ye,SO as be,TO as xe,UD as v,UO as y,VD as b,VM as x,VO as Se,WD as S,WO as Ce,XD as C,YD as w,ZD as T,_O as we,aO as Te,bO as Ee,c as E,cO as De,dO as Oe,eO as ke,fO as Ae,gO as je,hO as Me,iO as Ne,jD as D,jO as Pe,kD as O,kO as Fe,lO as Ie,mO as Le,nO as Re,oO as ze,pO as Be,qD as k,qO as Ve,rO as He,sO as Ue,tO as We,uO as Ge,vO as Ke,wO as qe,xO as Je,yO as Ye,zD as A,zO as Xe}from"./dist--_yEYc8n.js";import{n as j}from"./dist-DilWdU0c.js";import{i as Ze}from"./dist-CktYgUtY.js";import{t as M}from"./button-DgrHAwnL.js";import{B as Qe,C as N,Gt as P,Jt as $e,S as F,T as I,V as et,Xt as tt,Zt as nt,d as rt,dt as L,et as R,ft as z,gt as B,ht as V,lt as H,mt as U,pt as it,tt as W,ut as at,w as G,x as K}from"./index-CMhwTTOU.js";import{t as ot}from"./FilterBar-88imPMtz.js";import{t as st}from"./DataTableShell-DvxbPdB7.js";import{t as ct}from"./roleDescriptions-D0TCU7rm.js";var q=e(t(),1),J=n(),Y=[{value:`never`,label:()=>he(),days:null},{value:`30`,label:()=>g(),days:30},{value:`90`,label:()=>h(),days:90}],X=720*60*60*1e3,Z=`__all__`,Q={name:``,roleKey:``,description:``};function $(){let e=nt({from:`/settings/serviceAccounts`}),t=tt({from:`/settings/serviceAccounts`}),n=e.q??``,i=e.status??Z,[a,s]=(0,q.useState)(Z),c=e=>void t({search:t=>({...t,q:e||void 0}),replace:!0}),l=e=>void t({search:t=>({...t,status:e===Z?void 0:e})}),d=x(E.apiKeys.listServiceAccounts,{filter:{q:n||void 0,role:a===Z?void 0:a,disabled:i===Z?void 0:i===`disabled`}}),f=x(E.apiKeys.listKeys,{}),p=x(E.apiKeys.listRoles,{}),m=o(E.apiKeys.createServiceAccount),h=o(E.apiKeys.updateServiceAccount),g=o(E.apiKeys.deleteServiceAccount),pe=ve(E.apiKeys.mintApiKey),he=o(E.apiKeys.revokeApiKey),_=et(),v=Qe(),b=n!==``||a!==Z||i!==Z;function S(){s(Z),t({search:{},replace:!0})}let[C,w]=(0,q.useState)(!1),[T,D]=(0,q.useState)(Q),[O,k]=(0,q.useState)(null),[A,j]=(0,q.useState)(new Set),[P,L]=(0,q.useState)(null),R=(0,q.useRef)(!1),[z,B]=(0,q.useState)(new Set),[V,U]=(0,q.useState)({}),[it,W]=(0,q.useState)(null),X=(0,q.useMemo)(()=>{let e=new Map;for(let t of f??[]){let n=e.get(t.serviceAccountId)??[];n.push(t),e.set(t.serviceAccountId,n)}return e},[f]);function $(e){j(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})}async function dt(){try{O?(await h({serviceAccountId:O,name:T.name,roleKey:T.roleKey,description:T.description}),v.success(Ae())):await m({name:T.name,roleKey:T.roleKey,description:T.description||void 0}),D(Q),k(null),w(!1)}catch(e){v.error(O?Be():Le(),e)}}function ft(e){D({name:e.name,roleKey:e.roleKey,description:e.description??``}),k(e._id),w(!0)}async function pt(e){if(R.current)return;R.current=!0;let t=V[e._id]??`never`,n=Y.find(e=>e.value===t)?.days??null,r=n?Date.now()+n*24*60*60*1e3:void 0;L(e._id);try{let t=await pe({serviceAccountId:e._id,expiresAt:r});W({accountName:e.name,plaintext:t.plaintext,prefix:t.prefix,lastFour:t.lastFour})}catch(e){v.error(Oe(),e)}finally{R.current=!1,L(null)}}async function mt(e){if(await _({title:Ge(),description:(0,J.jsxs)(J.Fragment,{children:[Ie(),` `,(0,J.jsx)(`span`,{className:`font-mono`,children:e.name}),` `,De(),` `,(0,J.jsx)(`strong`,{children:Ue()}),` `,ze()]}),confirmWord:e.name,confirmLabel:Te(),destructive:!0}))try{await g({serviceAccountId:e._id}),v.success(Ne(),e.name)}catch(e){v.error(He(),e)}}async function ht(e){if(await _({title:Re(),description:(0,J.jsxs)(J.Fragment,{children:[We(),` `,(0,J.jsxs)(`span`,{className:`font-mono`,children:[e.prefix,`…`,e.lastFour]}),` `,ke()]}),confirmLabel:r(),destructive:!0})&&!z.has(e._id)){B(t=>new Set(t).add(e._id));try{await he({keyId:e._id})}catch(e){v.error(_e(),e)}finally{B(t=>{let n=new Set(t);return n.delete(e._id),n})}}}return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(`p`,{className:`oc-admin__hint`,children:ce()}),(0,J.jsxs)(ot,{q:n,onQChange:c,searchPlaceholder:Ve(),onReset:S,canReset:b,children:[(0,J.jsxs)(K,{value:a,onValueChange:s,children:[(0,J.jsx)(G,{size:`sm`,className:`w-40`,children:(0,J.jsx)(I,{placeholder:le()})}),(0,J.jsxs)(F,{children:[(0,J.jsx)(N,{value:Z,children:oe()}),(p??[]).map(e=>(0,J.jsx)(N,{value:e.key,children:e.key},e._id))]})]}),(0,J.jsxs)(K,{value:i,onValueChange:l,children:[(0,J.jsx)(G,{size:`sm`,className:`w-36`,children:(0,J.jsx)(I,{})}),(0,J.jsxs)(F,{children:[(0,J.jsx)(N,{value:Z,children:Ce()}),(0,J.jsx)(N,{value:`active`,children:y()}),(0,J.jsx)(N,{value:`disabled`,children:u()})]})]})]}),(0,J.jsx)(st,{title:Se(),rows:d,addLabel:te(),onAdd:()=>{D(Q),k(null),w(!0)},emptyHint:Xe(),isExpanded:e=>A.has(e._id),renderExpanded:e=>(0,J.jsx)(lt,{account:e,keys:X.get(e._id)??[],onRevoke:ht,revoking:z}),rowActions:e=>[{label:ae(),onSelect:()=>ft(e)},{label:ye(),onSelect:()=>void pt(e)},{label:A.has(e._id)?ue():se(),onSelect:()=>$(e._id)},{label:ge(),variant:`destructive`,onSelect:()=>void mt(e)}],columns:[{header:``,className:`w-8`,cell:e=>(0,J.jsx)(M,{variant:`ghost`,size:`icon-sm`,"aria-label":A.has(e._id)?fe():de(),onClick:()=>$(e._id),children:A.has(e._id)?(0,J.jsx)(Ze,{}):(0,J.jsx)($e,{})})},{header:Pe(),sort:e=>e.name,cell:e=>(0,J.jsxs)(`div`,{className:`flex flex-col`,children:[(0,J.jsx)(`span`,{children:e.name}),e.description?(0,J.jsx)(`span`,{className:`text-muted-foreground text-xs`,children:e.description}):null]})},{header:ee(),sort:e=>e.roleKey,cell:e=>(0,J.jsx)(H,{variant:`secondary`,children:e.roleKey})},{header:Fe(),sort:e=>+!!e.disabled,cell:e=>e.disabled?(0,J.jsx)(H,{variant:`destructive`,children:u()}):(0,J.jsx)(H,{variant:`outline`,children:y()})},{header:me(),cell:e=>(0,J.jsxs)(K,{value:V[e._id]??`never`,onValueChange:t=>U(n=>({...n,[e._id]:t})),children:[(0,J.jsx)(G,{size:`sm`,className:`w-32`,children:(0,J.jsx)(I,{})}),(0,J.jsx)(F,{children:Y.map(e=>(0,J.jsx)(N,{value:e.value,children:e.label()},e.value))})]})},{header:re(),sort:e=>(X.get(e._id)??[]).filter(e=>!e.disabled).length,cell:e=>{let t=(X.get(e._id)??[]).filter(e=>!e.disabled).length;return(0,J.jsx)(`span`,{className:`oc-sa__keycount`,children:P===e._id?ie():xe({count:t})})}}]}),(0,J.jsx)(rt,{open:C,onOpenChange:e=>{w(e),e||k(null)},title:O?qe():Je(),description:O?ne():Ee(),canSubmit:!!(T.name&&T.roleKey),onSubmit:dt,submitLabel:O?be():Ye(),children:(0,J.jsxs)(`div`,{className:`oc-form`,children:[(0,J.jsxs)(`label`,{className:`oc-field`,children:[(0,J.jsx)(`span`,{className:`oc-field__label`,children:Ke()}),(0,J.jsx)(at,{value:T.name,onChange:e=>D({...T,name:e.target.value})})]}),(0,J.jsxs)(`label`,{className:`oc-field`,children:[(0,J.jsx)(`span`,{className:`oc-field__label`,children:we()}),(0,J.jsxs)(K,{value:T.roleKey||void 0,onValueChange:e=>D({...T,roleKey:e}),children:[(0,J.jsx)(G,{className:`w-full`,children:(0,J.jsx)(I,{placeholder:je()})}),(0,J.jsx)(F,{children:(p??[]).map(e=>(0,J.jsxs)(N,{value:e.key,children:[e.name,` (`,e.key,`)`]},e._id))})]}),(()=>{let e=(p??[]).find(e=>e.key===T.roleKey),t=e?ct(e):null;return t?(0,J.jsx)(`span`,{className:`text-muted-foreground text-xs`,children:t}):null})()]}),(0,J.jsxs)(`label`,{className:`oc-field`,children:[(0,J.jsx)(`span`,{className:`oc-field__label`,children:Me()}),(0,J.jsx)(at,{value:T.description,onChange:e=>D({...T,description:e.target.value})})]})]})}),(0,J.jsx)(ut,{minted:it,onClose:()=>W(null)})]})}function lt({account:e,keys:t,onRevoke:n,revoking:r}){return(0,J.jsxs)(`div`,{className:`oc-sa__keys`,children:[(0,J.jsxs)(`div`,{className:`oc-sa__keys-head`,children:[T(),` `,(0,J.jsx)(`span`,{className:`font-medium`,children:e.name})]}),t.length===0?(0,J.jsx)(`p`,{className:`oc-admin__hint`,children:C()}):(0,J.jsxs)(`table`,{className:`oc-sa__keytable`,children:[(0,J.jsx)(`thead`,{children:(0,J.jsxs)(`tr`,{children:[(0,J.jsx)(`th`,{children:w()}),(0,J.jsx)(`th`,{children:f()}),(0,J.jsx)(`th`,{children:k()}),(0,J.jsx)(`th`,{children:p()}),(0,J.jsx)(`th`,{children:c()}),(0,J.jsx)(`th`,{children:S()}),(0,J.jsx)(`th`,{})]})}),(0,J.jsx)(`tbody`,{children:t.map(t=>(0,J.jsxs)(`tr`,{children:[(0,J.jsx)(`td`,{children:(0,J.jsxs)(`code`,{className:`oc-sa__keyid`,children:[t.prefix,`…`,t.lastFour]})}),(0,J.jsx)(`td`,{children:(0,J.jsx)(H,{variant:`secondary`,children:e.roleKey})}),(0,J.jsx)(`td`,{children:W(t.createdAt)}),(0,J.jsx)(`td`,{className:dt(t.lastUsedAt)?`oc-sa__stale`:``,children:ft(t.lastUsedAt)}),(0,J.jsx)(`td`,{children:pt(t.expiresAt)}),(0,J.jsx)(`td`,{children:mt(t)}),(0,J.jsx)(`td`,{className:`text-right`,children:t.disabled?null:(0,J.jsx)(M,{variant:`destructive`,size:`sm`,disabled:r.has(t._id),onClick:()=>n(t),children:r.has(t._id)?v():l()})})]},t._id))})]})]})}function ut({minted:e,onClose:t}){let[n,r]=(0,q.useState)(!1);async function i(){if(e)try{await navigator.clipboard.writeText(e.plaintext),r(!0),window.setTimeout(()=>r(!1),2e3)}catch{}}return(0,J.jsx)(L,{open:e!==null,onOpenChange:e=>{e||(r(!1),t())},children:e?(0,J.jsxs)(z,{className:`max-w-lg`,showCloseButton:!1,onInteractOutside:e=>e.preventDefault(),onEscapeKeyDown:e=>e.preventDefault(),children:[(0,J.jsxs)(V,{children:[(0,J.jsx)(B,{children:b()}),(0,J.jsx)(it,{children:a({name:e.accountName})})]}),(0,J.jsx)(`div`,{className:`oc-sa__minted-warning`,children:A()}),(0,J.jsxs)(`div`,{className:`oc-sa__minted-box`,children:[(0,J.jsx)(`code`,{className:`oc-sa__minted-plain`,children:e.plaintext}),(0,J.jsxs)(M,{variant:`outline`,size:`sm`,onClick:()=>void i(),"aria-label":_(),children:[n?(0,J.jsx)(j,{}):(0,J.jsx)(P,{}),n?m():d()]})]}),(0,J.jsx)(U,{children:(0,J.jsx)(M,{onClick:()=>{r(!1),t()},children:s()})})]}):null})}function dt(e){return e===null?!1:Date.now()-e>X}function ft(e){return e===null?D():W(e)}function pt(e){return e===null?`—`:R(e)}function mt(e){return e.disabled?(0,J.jsx)(H,{variant:`destructive`,children:i()}):e.expiresAt!==null&&e.expiresAt<Date.now()?(0,J.jsx)(H,{variant:`outline`,children:O()}):(0,J.jsx)(H,{variant:`outline`,children:pe()})}export{$ as ServiceAccountsTab};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{c as e,i as t,r as n}from"./bundle-mjs-BJq7W7j9.js";import{Aa as r,BM as i,Ba as a,Ca as o,Da as s,Ea as c,Fa as l,Ia as u,La as d,Ma as f,Na as p,Oa as m,Pa as h,Ra as g,Sa as _,Ta as v,VM as y,Va as b,_a as x,aa as S,ba as C,c as w,ca as T,da as E,fa as D,ga as O,ha as k,ia as A,ja as j,ka as M,la as N,ma as P,oa as F,pa as I,ra as L,sa as ee,ua as R,va as z,wa as B,xa as V,ya as H,za as U}from"./dist--_yEYc8n.js";import{t as W}from"./button-DgrHAwnL.js";import{V as G,tt as K}from"./index-CMhwTTOU.js";import{t as q}from"./DataTableShell-DvxbPdB7.js";var J=e(t(),1),Y=n(),X={hung:()=>B(),wrong_result:()=>o(),error:()=>_(),other:()=>V()},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=i(w.subAgentReports.respondToReport),[r,a]=(0,J.useState)(e.thread),[o,s]=(0,J.useState)(``),[c,l]=(0,J.useState)(!1);async function u(){let t=o.trim();if(!(!t||c)){l(!0);try{await n({reportId:e._id,text:t}),a(e=>[...e,{authorRole:`admin`,text:t,at:Date.now()}]),s(``)}finally{l(!1)}}}return(0,Y.jsxs)(`div`,{className:`oc-fbadmin__detail`,children:[(0,Y.jsx)(`div`,{className:`oc-fbadmin__row`,children:(0,Y.jsxs)(`span`,{className:`oc-fbadmin__meta`,children:[Z(e.category),` · `,C({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:H()}),(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:z()}),r.length>0?(0,Y.jsx)(`div`,{className:`oc-fbadmin__thread`,children:r.map((e,t)=>(0,Y.jsxs)(`div`,{className:`oc-notif__msg oc-notif__msg--${e.authorRole}`,children:[(0,Y.jsx)(`span`,{className:`oc-notif__msg-who`,children:e.authorRole===`admin`?x():O()}),(0,Y.jsx)(`span`,{className:`oc-notif__msg-text`,children:e.text})]},t))}):(0,Y.jsx)(`p`,{className:`oc-fbadmin__meta`,children:k()}),(0,Y.jsx)(`textarea`,{className:`oc-feedback__textarea`,placeholder:P(),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 u(),disabled:!o.trim()||c,children:c?D():I()})})]}),(0,Y.jsxs)(`section`,{children:[(0,Y.jsxs)(`h4`,{className:`oc-fbadmin__h`,children:[E({count:t.children.length}),t.childrenTruncated?` ${R()}`:``,t.textTruncated?` ${N()}`:``]}),(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?` · ${T()}`:``]}),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:ee()}),(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:F()}),(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=y(w.subAgentReports.listForAdmin,{}),t=i(w.subAgentReports.readReport),n=i(w.subAgentReports.deleteReport),o=G(),[_,x]=(0,J.useState)(null),[C,T]=(0,J.useState)({});async function E(e){if(_===e._id){x(null);return}if(!C[e._id]){let n=await t({reportId:e._id});T(t=>({...t,[e._id]:n}))}x(e._id)}async function D(e){await o({title:S(),description:A(),confirmLabel:L(),destructive:!0})&&(await n({reportId:e._id}),_===e._id&&x(null))}return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(`p`,{className:`oc-admin__hint`,children:[U(),` `,(0,Y.jsx)(`strong`,{children:g()}),` `,d()]}),(0,Y.jsx)(q,{title:b(),rows:e,emptyHint:a(),isExpanded:e=>_===e._id&&!!C[e._id],renderExpanded:e=>C[e._id]?(0,Y.jsx)($,{data:C[e._id]}):null,columns:[{header:u(),cell:e=>K(e.at),sort:e=>e.at},{header:l(),cell:e=>Z(e.category),sort:e=>Z(e.category)},{header:h(),cell:e=>`${e.failedCount}/${e.totalCount}`,sort:e=>e.failedCount},{header:p(),cell:e=>(e.reporterEmail||e.reporterName||`—`)+(e.impersonated&&e.realOperatorEmail?` ${r({operator:e.realOperatorEmail})}`:``),sort:e=>e.reporterEmail||e.reporterName||null},{header:f(),cell:e=>e.hasComment?`✎`:`—`,sort:e=>+!!e.hasComment},{header:j(),cell:e=>e.answered?(0,Y.jsx)(`span`,{className:`oc-fbadmin__pill is-ok`,children:M()}):(0,Y.jsx)(`span`,{className:`oc-fbadmin__pill`,children:m()}),sort:e=>+!!e.answered}],rowActions:e=>[{label:_===e._id?c():s(),onSelect:()=>void E(e)},{label:v(),onSelect:()=>void D(e),variant:`destructive`}]})]})}export{te as SubAgentReportsTab};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{c as e,i as t,r as n}from"./bundle-mjs-BJq7W7j9.js";import{$A as r,$i as i,$k as a,AA as o,AM as s,BA as c,BM as l,Bk as u,CA as d,DA as f,EA as p,FA as m,Fk as h,GA as g,Gk as ee,HA as _,Hk as v,IA as y,Ik as te,JA as ne,Jk as re,KA as ie,Kk as ae,LA as oe,Lk as se,MA as ce,NA as le,OA as ue,OM as de,PA as fe,QA as pe,Qk as me,RA as he,RM as ge,Rk as _e,SA as ve,TA as ye,UA as be,Uk as b,VA as xe,VM as x,Vk as Se,WA as Ce,Wk as we,XA as Te,Xk as Ee,YA as De,Yk as Oe,ZA as ke,Zk as Ae,_A as je,aA as Me,bA as S,c as C,cA as Ne,dA as Pe,eA as Fe,ea as Ie,ej as Le,fA as Re,gA as ze,hA as Be,iA as Ve,jA as He,kA as Ue,kM as We,l as Ge,lA as Ke,mA as qe,n as Je,nA as Ye,na as w,nj as Xe,oA as Ze,pA as Qe,qA as T,qk as $e,rA as et,rj as tt,sA as nt,tA as E,ta as D,tj as rt,uA as it,vA as at,wA as ot,xA as st,yA as ct,zA as lt,zk as O}from"./dist--_yEYc8n.js";import{n as k}from"./dist-DilWdU0c.js";import{t as A}from"./x-CJvE-xbb.js";import{t as j}from"./button-DgrHAwnL.js";import{C as M,S as N,St as P,T as F,Ut as I,Wt as ut,_t as dt,at as L,ct as ft,it as pt,lt as R,m as z,ot as mt,rt as ht,st as B,ut as V,vt as gt,w as H,x as U}from"./index-CMhwTTOU.js";import{t as _t}from"./localePickerView-C2RmOS86.js";import{a as vt,i as yt,n as bt,o as xt,r as St,t as Ct}from"./card-Dq94Pad-.js";import{a as wt,i as W,n as Tt,o as G,r as K,t as Et}from"./table-B58636RR.js";import{t as Dt}from"./TimeRangePicker-D2BzLnpx.js";import{t as Ot}from"./FilterBar-88imPMtz.js";import{t as kt}from"./AdvancedFilter-BTHZYRGc.js";var q=Ge(`upload`,[[`path`,{d:`M12 3v12`,key:`1x0j5s`}],[`path`,{d:`m17 8-5-5-5 5`,key:`7q97r8`}],[`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`,key:`ih7n3h`}]]),J=e(t(),1),At=.1,jt=[248,248,248],Mt=[24,24,24];function Nt(e,t,n){let r=t,i=n,a=-1,o=-1;for(let s=0;s<n;s++)for(let n=0;n<t;n++)e[(s*t+n)*4+3]>8&&(n<r&&(r=n),n>a&&(a=n),s<i&&(i=s),s>o&&(o=s));return a<0?null:{x:r,y:i,width:a-r+1,height:o-i+1}}function Pt(e,t,n){let r=t*n;if(r===0)return 0;let i=0;for(let t=3;t<e.length;t+=4)e[t]<=8&&i++;return i/r}function Y(e,t,n){return Pt(e,t,n)>=At}function Ft(e,t){for(let n=0;n<e.length;n+=4)e[n]=t[0],e[n+1]=t[1],e[n+2]=t[2]}function It(e){for(let t=0;t<e.length;t+=4)e[t]=255-e[t],e[t+1]=255-e[t+1],e[t+2]=255-e[t+2]}var Lt=12*1024*1024,Rt=480,zt=160,Bt=.92;async function Vt(e,t={}){if(!e.type.startsWith(`image/`))throw Error(Ve());if(e.size>Lt)throw Error(et());let{source:n,width:r,height:i,cleanup:a}=await Ht(e);try{let a=e.type===`image/svg+xml`,o=Math.min(Rt/r,zt/i,a?1/0:1),s=Math.max(1,Math.round(r*o)),c=Math.max(1,Math.round(i*o)),l=document.createElement(`canvas`);l.width=s,l.height=c;let u=l.getContext(`2d`);if(!u)throw Error(E());u.imageSmoothingEnabled=!0,u.imageSmoothingQuality=`high`,u.drawImage(n,0,0,s,c);let d=Nt(u.getImageData(0,0,s,c).data,s,c)??{x:0,y:0,width:s,height:c},f=document.createElement(`canvas`);f.width=d.width,f.height=d.height;let p=f.getContext(`2d`);if(!p)throw Error(E());if(p.drawImage(l,d.x,d.y,d.width,d.height,0,0,d.width,d.height),t.variantFor){let e=p.getImageData(0,0,d.width,d.height);Y(e.data,d.width,d.height)?Ft(e.data,t.variantFor===`dark`?jt:Mt):It(e.data),p.putImageData(e,0,0)}let m=Y(p.getImageData(0,0,d.width,d.height).data,d.width,d.height),h=await Wt(f,`image/webp`,Bt)??await Wt(f,`image/png`);if(!h)throw Error(Fe());return{blob:h,hasAlpha:m}}finally{a()}}async function Ht(e){if(e.type===`image/svg+xml`)return Ut(e);if(typeof createImageBitmap==`function`)try{let t=await createImageBitmap(e);return{source:t,width:t.width,height:t.height,cleanup:()=>t.close()}}catch{}return Ut(e)}async function Ut(e){let t=URL.createObjectURL(e);try{let e=new Image;return e.decoding=`async`,await new Promise((n,r)=>{e.onload=()=>n(),e.onerror=()=>r(Error(Ye())),e.src=t}),{source:e,width:e.naturalWidth||300,height:e.naturalHeight||150,cleanup:()=>URL.revokeObjectURL(t)}}catch(e){throw URL.revokeObjectURL(t),e}}function Wt(e,t,n){return new Promise(r=>e.toBlob(e=>r(e),t,n))}var X=n();function Gt(e,t){let n=e.trim().replace(/[^A-Za-z0-9_.-]+/g,`-`).replace(/^-+|-+$/g,``)||`chart`,r=new Blob([JSON.stringify(t,null,2)],{type:`application/json`}),i=URL.createObjectURL(r),a=document.createElement(`a`);a.href=i,a.download=`${n}.chart.json`,document.body.appendChild(a),a.click(),a.remove(),URL.revokeObjectURL(i)}var Z=`__all__`,Kt={kind:`relative`,from:`now-24h`,to:`now`},qt=[{value:`status`,label:`Statut`},{value:`latencyMs`,label:`Latence (ms)`},{value:`route`,label:`Route`},{value:`roleKey`,label:`Rôle`},{value:`correlationId`,label:`Corrélation`}];function Q({title:e,description:t,children:n}){return(0,X.jsxs)(`section`,{className:`oc-show__section`,children:[(0,X.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,X.jsx)(`h2`,{className:`oc-show__title`,children:e}),t?(0,X.jsx)(`p`,{className:`oc-show__desc`,children:t}):null]}),(0,X.jsx)(`div`,{className:`oc-show__demo`,children:n})]})}function Jt(e){return e===`light`?s():e===`dark`?We():de()}var Yt=[`primary`,`secondary`,`accent`,`muted`,`chart-1`,`chart-2`];function Xt({tokens:e,mode:t}){let n=e.colors[t];return(0,X.jsx)(`div`,{className:`oc-chart-swatches`,"aria-hidden":!0,children:Yt.map(e=>{let t=n[e];return(0,X.jsx)(`span`,{className:`oc-chart-swatch`,style:t?{background:t}:void 0},e)})})}function Zt({selected:e,title:t,subtitle:n,tokens:r,mode:i,onSelect:a,onExport:o}){return(0,X.jsxs)(`div`,{className:`oc-chart-card-wrap`,children:[(0,X.jsxs)(`button`,{type:`button`,className:Je(`oc-chart-card`,e&&`oc-chart-card--selected`),"aria-pressed":e,onClick:a,children:[(0,X.jsxs)(`div`,{className:`oc-chart-card__head`,children:[(0,X.jsx)(`span`,{className:`oc-chart-card__title`,children:t}),e?(0,X.jsx)(k,{className:`size-4 text-primary`,"aria-hidden":!0}):null]}),r?(0,X.jsx)(Xt,{tokens:r,mode:i}):(0,X.jsx)(`div`,{className:`oc-chart-swatches oc-chart-swatches--native`,"aria-hidden":!0}),(0,X.jsx)(`div`,{className:`oc-chart-card__meta`,children:(0,X.jsx)(`span`,{className:`oc-chart-card__subtitle`,children:n})})]}),o?(0,X.jsx)(j,{type:`button`,variant:`ghost`,size:`icon`,className:`oc-chart-card__export`,onClick:o,"aria-label":w(),title:w(),children:(0,X.jsx)(ut,{className:`size-4`})}):null]})}function Qt({selectedKey:e,resolvedMode:t}){let n=x(C.charts.listMyCharts),r=l(C.charts.setMyChart);async function i(e){try{await r({name:e})}catch{}}return(0,X.jsxs)(`section`,{className:`oc-show__section`,children:[(0,X.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,X.jsx)(`h2`,{className:`oc-show__title`,children:De()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:ne()})]}),(0,X.jsxs)(`div`,{className:`oc-chart-grid`,children:[(0,X.jsx)(Zt,{selected:e===null,title:T(),subtitle:ie(),tokens:null,mode:t,onSelect:()=>void i(null)}),(n??[]).map(n=>{let r=n.via===`common`?g():n.via===`owner`?Ce():be({group:n.via.group});return(0,X.jsx)(Zt,{selected:e===n.key,title:n.name,subtitle:r,tokens:n.tokens,mode:t,onSelect:()=>void i(n.key),onExport:()=>Gt(n.name,n.tokens)},n.key)})]}),n!==void 0&&n.length===0?(0,X.jsx)(`p`,{className:`oc-show__desc`,children:_()}):null]})}function $t(){let e=l(C.charts.importChart),[t,n]=(0,J.useState)(``),[r,i]=(0,J.useState)(``),[a,o]=(0,J.useState)(null),[s,c]=(0,J.useState)(!1),[u,m]=(0,J.useState)(!1);async function h(e){let t=e.target.files?.[0];if(e.target.value=``,t){o(null),c(!1);try{i(await t.text())}catch{o(S())}}}async function g(){if(o(null),c(!1),t.trim()===``){o(at());return}let a;try{a=JSON.parse(r)}catch{o(S());return}m(!0);try{await e({name:t.trim(),tokens:a}),c(!0),n(``),i(``)}catch(e){o(e instanceof Error?e.message:String(e))}finally{m(!1)}}return(0,X.jsxs)(`section`,{className:`oc-show__section`,children:[(0,X.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,X.jsx)(`h2`,{className:`oc-show__title`,children:ue()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:f()})]}),(0,X.jsxs)(`div`,{className:`oc-chart-import`,children:[(0,X.jsxs)(`label`,{className:`oc-chart-import__field`,children:[(0,X.jsx)(`span`,{className:`oc-chart-import__label`,children:p()}),(0,X.jsx)(V,{value:t,onChange:e=>n(e.target.value),placeholder:ye(),maxLength:60})]}),(0,X.jsxs)(`label`,{className:`oc-chart-import__field`,children:[(0,X.jsx)(`span`,{className:`oc-chart-import__label`,children:ot()}),(0,X.jsx)(`textarea`,{className:`oc-chart-import__textarea`,value:r,onChange:e=>i(e.target.value),placeholder:d(),rows:8,spellCheck:!1})]}),(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsx)(j,{variant:`outline`,size:`sm`,asChild:!0,children:(0,X.jsxs)(`label`,{className:`oc-chart-import__file`,children:[(0,X.jsx)(q,{className:`size-4`}),ve(),(0,X.jsx)(`input`,{type:`file`,accept:`application/json,.json`,className:`oc-chart-import__file-input`,onChange:e=>void h(e)})]})}),(0,X.jsx)(j,{size:`sm`,disabled:u,onClick:()=>void g(),children:st()})]}),a?(0,X.jsx)(`p`,{className:`oc-chart-import__error`,children:a}):null,s?(0,X.jsx)(`p`,{className:`oc-chart-import__ok`,children:ct()}):null]})]})}function en({chart:e}){let t=ge(C.charts.setChartLogo),n=l(C.charts.removeChartLogo),[r,i]=(0,J.useState)(!1),[a,o]=(0,J.useState)(null),s=t=>t===`light`?e.logoLightUrl:e.logoDarkUrl;async function c(n,r,a){if(e.chartId!==void 0){o(null),i(!0);try{let{blob:i,hasAlpha:o}=await Vt(r,a?{variantFor:a}:{}),s=await i.arrayBuffer();await t({chartId:e.chartId,bytes:s,mode:n,hasAlpha:o})}catch(e){o(e instanceof Error?e.message:String(e))}finally{i(!1)}}}async function u(e,t){let n=t.target.files?.[0];t.target.value=``,n&&await c(e,n)}async function d(t){if(e.chartId!==void 0){o(null),i(!0);try{await n({chartId:e.chartId,mode:t})}catch(e){o(e instanceof Error?e.message:String(e))}finally{i(!1)}}}async function f(e){let t=s(e===`light`?`dark`:`light`);if(t){o(null),i(!0);try{await c(e,await(await fetch(t)).blob(),e)}catch(e){o(e instanceof Error?e.message:String(e))}finally{i(!1)}}}function p({mode:e}){let t=s(e),n=s(e===`light`?`dark`:`light`);return(0,X.jsxs)(`div`,{className:`oc-chart-mine__logo-slot`,children:[(0,X.jsx)(`span`,{className:`oc-chart-mine__logo-mode`,children:e===`light`?Pe():it()}),(0,X.jsx)(`span`,{className:`oc-chart-mine__logo-preview`,"data-mode":e,"data-empty":t?void 0:`1`,children:t?(0,X.jsx)(`img`,{src:t,alt:``}):null}),(0,X.jsx)(j,{variant:`outline`,size:`sm`,asChild:!0,children:(0,X.jsxs)(`label`,{className:`oc-chart-import__file`,children:[(0,X.jsx)(q,{className:`size-4`}),t?Ne():Ke(),(0,X.jsx)(`input`,{type:`file`,accept:`image/*`,className:`oc-chart-import__file-input`,onChange:t=>void u(e,t)})]})}),!t&&n?(0,X.jsx)(j,{variant:`ghost`,size:`sm`,disabled:r,onClick:()=>void f(e),children:Ze()}):null,t?(0,X.jsx)(j,{variant:`ghost`,size:`sm`,disabled:r,onClick:()=>void d(e),children:nt()}):null]})}return(0,X.jsxs)(`div`,{className:`oc-chart-mine__logo`,children:[(0,X.jsx)(`span`,{className:`oc-chart-mine__groups-label`,children:Re()}),(0,X.jsxs)(`div`,{className:`oc-chart-mine__logo-slots`,children:[(0,X.jsx)(p,{mode:`light`}),(0,X.jsx)(p,{mode:`dark`})]}),r?(0,X.jsx)(`span`,{className:`oc-show__desc`,children:Me()}):null,a?(0,X.jsx)(`p`,{className:`oc-chart-import__error`,children:a}):null]})}function tn({chart:e}){let t=x(C.me.getMe,{host:P}),n=l(C.charts.addChartDomain),r=l(C.charts.removeChartDomain),[i,o]=(0,J.useState)(``),[s,c]=(0,J.useState)(null),[u,d]=(0,J.useState)(!1);if(t?.role!==`admin`)return null;let f=e.domains??[];async function p(){let t=i.trim();if(t!==``){c(null),d(!0);try{await n({chartKey:e.key,domain:t}),o(``)}catch(e){c(e instanceof Error?e.message:String(e))}finally{d(!1)}}}async function m(t){c(null);try{await r({chartKey:e.key,domain:t})}catch{}}return(0,X.jsxs)(`div`,{className:`oc-chart-mine__domains`,children:[(0,X.jsx)(`span`,{className:`oc-chart-mine__groups-label`,children:a()}),(0,X.jsxs)(`div`,{className:`oc-chart-mine__domains-body`,children:[(0,X.jsx)(`div`,{className:`oc-chart-avail__groups`,children:f.length===0?(0,X.jsx)(`span`,{className:`oc-show__desc`,children:Oe()}):f.map(e=>(0,X.jsxs)(R,{variant:`secondary`,className:`oc-chart-avail__chip`,children:[e,(0,X.jsx)(`button`,{type:`button`,className:`oc-chart-avail__chip-x`,"aria-label":re({domain:e}),onClick:()=>void m(e),children:(0,X.jsx)(A,{className:`size-3`})})]},e))}),(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsx)(V,{value:i,onChange:e=>o(e.target.value),placeholder:Ae(),className:`oc-chart-mine__domains-input`,onKeyDown:e=>{e.key===`Enter`&&p()}}),(0,X.jsx)(j,{variant:`outline`,size:`sm`,disabled:u,onClick:()=>void p(),children:Ee()})]}),(0,X.jsx)(`span`,{className:`oc-show__desc`,children:me()}),s?(0,X.jsx)(`p`,{className:`oc-chart-import__error`,children:s}):null]})]})}function $(e){let t={...e};return delete t.bpm,JSON.stringify(t,null,2)}function nn({chart:e}){let t=l(C.charts.updateChart),n=l(C.charts.deleteChart),[r,a]=(0,J.useState)(!1),[o,s]=(0,J.useState)(e.name),[c,u]=(0,J.useState)(()=>$(e.tokens)),[d,f]=(0,J.useState)(e.tokens.bpm??0),[p,m]=(0,J.useState)(null),[h,g]=(0,J.useState)(!1);function _(){s(e.name),u($(e.tokens)),f(e.tokens.bpm??0),m(null),a(!0)}async function v(){if(e.chartId===void 0)return;m(null);let n;try{n=JSON.parse(c)}catch{m(S());return}if(n&&typeof n==`object`&&!Array.isArray(n)){let e=n;d>0?e.bpm=d:delete e.bpm}g(!0);try{await t({chartId:e.chartId,name:o.trim(),tokens:n}),a(!1)}catch(e){m(e instanceof Error?e.message:String(e))}finally{g(!1)}}async function y(){if(e.chartId!==void 0&&window.confirm(b()))try{await n({chartId:e.chartId})}catch{}}return(0,X.jsxs)(`div`,{className:`oc-chart-mine__row`,children:[(0,X.jsxs)(`div`,{className:`oc-chart-mine__head`,children:[(0,X.jsx)(`span`,{className:`oc-chart-mine__name`,children:e.name}),(0,X.jsx)(`div`,{className:`oc-show__row`,children:r?null:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(j,{variant:`outline`,size:`sm`,onClick:_,children:qe()}),(0,X.jsx)(j,{variant:`ghost`,size:`sm`,onClick:()=>void y(),children:Qe()})]})})]}),r?(0,X.jsxs)(`div`,{className:`oc-chart-mine__editor`,children:[(0,X.jsxs)(`label`,{className:`oc-chart-import__field`,children:[(0,X.jsx)(`span`,{className:`oc-chart-import__label`,children:ee()}),(0,X.jsx)(V,{value:o,onChange:e=>s(e.target.value),maxLength:60})]}),(0,X.jsxs)(`div`,{className:`oc-chart-import__field`,children:[(0,X.jsx)(`span`,{className:`oc-chart-import__label`,children:D()}),(0,X.jsxs)(`div`,{className:`oc-chart-bpm`,children:[(0,X.jsx)(`input`,{type:`range`,className:`oc-chart-bpm__slider`,min:0,max:90,step:5,value:d,onChange:e=>f(Number(e.target.value)),"aria-label":D()}),(0,X.jsx)(`span`,{className:`oc-chart-bpm__value`,children:d===0?Ie():`${d} BPM`})]}),(0,X.jsx)(`span`,{className:`oc-show__desc`,children:i()})]}),(0,X.jsxs)(`label`,{className:`oc-chart-import__field`,children:[(0,X.jsx)(`span`,{className:`oc-chart-import__label`,children:we()}),(0,X.jsx)(`textarea`,{className:`oc-chart-import__textarea`,value:c,onChange:e=>u(e.target.value),rows:10,spellCheck:!1})]}),p?(0,X.jsx)(`p`,{className:`oc-chart-import__error`,children:p}):null,(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsx)(j,{size:`sm`,disabled:h,onClick:()=>void v(),children:$e()}),(0,X.jsx)(j,{variant:`ghost`,size:`sm`,onClick:()=>a(!1),children:ae()})]})]}):null,(0,X.jsx)(en,{chart:e}),(0,X.jsx)(tn,{chart:e})]})}function rn(){let e=x(C.charts.listMyCharts),t=(e??[]).filter(e=>e.via===`owner`);return(0,X.jsxs)(`section`,{className:`oc-show__section`,children:[(0,X.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,X.jsx)(`h2`,{className:`oc-show__title`,children:je()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:ze()})]}),e!==void 0&&t.length===0?(0,X.jsx)(`p`,{className:`oc-show__desc`,children:Be()}):(0,X.jsx)(`div`,{className:`oc-chart-mine-list`,children:t.map(e=>(0,X.jsx)(nn,{chart:e},e.key))})]})}function an({chart:e,groups:t}){let n=l(C.charts.addChartToGroupPool),r=l(C.charts.removeChartFromGroupPool),i=e.restrictedToGroups,a=e.poolGroups,s=new Set((a??[]).map(e=>e.groupId)),c=t.filter(e=>!s.has(e._id));async function u(t){try{await n({groupId:t,chartKey:e.key})}catch{}}async function d(t){try{await r({groupId:t,chartKey:e.key})}catch{}}return(0,X.jsxs)(`div`,{className:`oc-chart-avail`,children:[(0,X.jsxs)(`div`,{className:`oc-chart-avail__head`,children:[(0,X.jsx)(`span`,{className:`oc-chart-avail__name`,children:e.name}),(0,X.jsx)(R,{variant:i?`secondary`:`outline`,className:`oc-chart-avail__state`,children:i?fe():e.kind===`custom`&&e.scope===`personal`?O():m()}),e.isGlobalDefault?(0,X.jsx)(R,{variant:`default`,children:le()}):null]}),(0,X.jsxs)(`div`,{className:`oc-chart-avail__groups`,children:[(0,X.jsx)(`span`,{className:`oc-chart-mine__groups-label`,children:He()}),(a??[]).map(e=>(0,X.jsxs)(R,{variant:`secondary`,className:`oc-chart-avail__chip`,children:[e.name,(0,X.jsx)(`button`,{type:`button`,className:`oc-chart-avail__chip-x`,"aria-label":Ue({group:e.name}),onClick:()=>void d(e.groupId),children:(0,X.jsx)(A,{className:`size-3`})})]},e.groupId)),c.length>0?(0,X.jsxs)(U,{value:``,onValueChange:e=>void u(e),children:[(0,X.jsx)(H,{size:`sm`,className:`w-56`,children:(0,X.jsx)(F,{placeholder:o()})}),(0,X.jsx)(N,{children:c.map(e=>(0,X.jsx)(M,{value:e._id,children:e.name},e._id))})]}):t.length===0?(0,X.jsx)(`span`,{className:`oc-show__desc`,children:ce()}):null]})]})}function on({chart:e}){let t=l(C.charts.promoteChartToCommon),n=l(C.charts.deleteChart);async function r(){if(e.chartId!==void 0)try{await t({chartId:e.chartId})}catch{}}async function i(){if(e.chartId!==void 0&&window.confirm(b()))try{await n({chartId:e.chartId})}catch{}}return(0,X.jsxs)(`div`,{className:`oc-chart-avail`,children:[(0,X.jsxs)(`div`,{className:`oc-chart-avail__head`,children:[(0,X.jsx)(`span`,{className:`oc-chart-avail__name`,children:e.name}),(0,X.jsx)(R,{variant:e.scope===`common`?`outline`:`secondary`,children:e.scope===`common`?_e():O()}),e.ownerLabel?(0,X.jsx)(`span`,{className:`oc-show__desc`,children:u({owner:e.ownerLabel})}):null]}),(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[e.scope===`personal`?(0,X.jsx)(j,{variant:`outline`,size:`sm`,onClick:()=>void r(),children:se()}):null,(0,X.jsx)(j,{variant:`ghost`,size:`sm`,onClick:()=>void i(),children:te()})]})]})}function sn({defaultThemeMode:e,defaultLocale:t,defaultChartKey:n}){let i=l(C.admin.setDefaultThemeMode),a=l(C.admin.setDefaultLocale),o=l(C.charts.setDefaultChart),s=x(C.charts.listChartsAdmin),u=x(C.groups.listGroups,{}),d=e??`system`,f=t??`fr`;return(0,X.jsxs)(`div`,{className:`oc-appearance-admin`,children:[(0,X.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,X.jsx)(`h2`,{className:`oc-show__title`,children:ke()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:Te()})]}),(0,X.jsxs)(`section`,{className:`oc-show__section`,children:[(0,X.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,X.jsx)(`h3`,{className:`oc-show__title`,children:xe()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:c()})]}),(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsx)(j,{variant:n===null?`default`:`outline`,size:`sm`,onClick:()=>void o({name:null}),children:T()}),gt.map(e=>(0,X.jsx)(j,{variant:n===e.key?`default`:`outline`,size:`sm`,onClick:()=>void o({name:e.key}),children:e.name},e.key)),(s??[]).filter(e=>e.kind===`custom`&&e.scope===`common`).map(e=>(0,X.jsx)(j,{variant:n===e.key?`default`:`outline`,size:`sm`,onClick:()=>void o({name:e.key}),children:e.name},e.key))]})]}),(0,X.jsxs)(`section`,{className:`oc-show__section`,children:[(0,X.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,X.jsx)(`h3`,{className:`oc-show__title`,children:lt()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:he()})]}),(0,X.jsx)(`div`,{className:`oc-chart-avail-list`,children:(s??[]).filter(e=>!(e.kind===`custom`&&e.scope===`common`)).map(e=>(0,X.jsx)(an,{chart:e,groups:u??[]},e.key))})]}),(0,X.jsxs)(`section`,{className:`oc-show__section`,children:[(0,X.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,X.jsx)(`h3`,{className:`oc-show__title`,children:oe()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:y()})]}),(0,X.jsx)(`div`,{className:`oc-chart-avail-list`,children:(s??[]).filter(e=>e.kind===`builtin`||e.scope===`common`).map(e=>(0,X.jsxs)(`div`,{className:`oc-chart-avail`,children:[(0,X.jsx)(`div`,{className:`oc-chart-avail__head`,children:(0,X.jsx)(`span`,{className:`oc-chart-avail__name`,children:e.name})}),(0,X.jsx)(tn,{chart:e})]},e.key))})]}),(0,X.jsxs)(`section`,{className:`oc-show__section`,children:[(0,X.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,X.jsx)(`h3`,{className:`oc-show__title`,children:v()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:Se()})]}),(()=>{let e=(s??[]).filter(e=>e.kind===`custom`);return e.length===0?(0,X.jsx)(`p`,{className:`oc-show__desc`,children:h()}):(0,X.jsx)(`div`,{className:`oc-chart-avail-list`,children:e.map(e=>(0,X.jsx)(on,{chart:e},e.key))})})()]}),(0,X.jsxs)(`section`,{className:`oc-show__section`,children:[(0,X.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,X.jsx)(`h3`,{className:`oc-show__title`,children:tt()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:Xe()})]}),(0,X.jsx)(`div`,{className:`oc-show__row`,children:[`light`,`dark`,`system`].map(e=>(0,X.jsx)(j,{variant:d===e?`default`:`outline`,size:`sm`,onClick:()=>void i({mode:e}),children:Jt(e)},e))})]}),(0,X.jsxs)(`section`,{className:`oc-show__section`,children:[(0,X.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,X.jsx)(`h3`,{className:`oc-show__title`,children:rt()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:Le()})]}),(0,X.jsx)(`div`,{className:`oc-show__row`,children:_t().map(e=>(0,X.jsx)(j,{variant:f===e.value?`default`:`outline`,size:`sm`,onClick:()=>void a({locale:e.value}),children:e.label},e.value))}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:r()})]})]})}function cn(){let e=x(C.me.getMe,{host:P}),t=dt(e?.resolvedThemeMode);return(0,X.jsxs)(`div`,{className:`oc-appearance`,children:[(0,X.jsx)(Qt,{selectedKey:e?.chartKey??null,resolvedMode:t}),(0,X.jsx)($t,{}),(0,X.jsx)(rn,{}),e?.role===`admin`?(0,X.jsx)(sn,{defaultThemeMode:e.defaultThemeMode,defaultLocale:e.defaultLocale,defaultChartKey:e.defaultChartKey}):null]})}function ln(){let[e,t]=(0,J.useState)(!0),[n,r]=(0,J.useState)(`per-user`),[i,a]=(0,J.useState)(``),[o,s]=(0,J.useState)(Z),[c,l]=(0,J.useState)(Z),[u,d]=(0,J.useState)(Kt),f=i!==``||o!==Z||c!==Z;function p(){a(``),s(Z),l(Z),d(Kt)}return(0,X.jsxs)(`div`,{className:`oc-show`,children:[(0,X.jsx)(cn,{}),(0,X.jsxs)(`details`,{className:`oc-show__ref`,children:[(0,X.jsx)(`summary`,{className:`oc-show__title`,children:pe()}),(0,X.jsxs)(Q,{title:`Buttons`,description:`Variants`,children:[(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsx)(j,{children:`Default`}),(0,X.jsx)(j,{variant:`secondary`,children:`Secondary`}),(0,X.jsx)(j,{variant:`outline`,children:`Outline`}),(0,X.jsx)(j,{variant:`ghost`,children:`Ghost`}),(0,X.jsx)(j,{variant:`destructive`,children:`Destructive`}),(0,X.jsx)(j,{variant:`link`,children:`Link`})]}),(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsx)(j,{size:`sm`,children:`Small`}),(0,X.jsx)(j,{children:`Default`}),(0,X.jsx)(j,{size:`lg`,children:`Large`}),(0,X.jsx)(j,{size:`icon`,"aria-label":`more`,children:(0,X.jsx)(I,{})}),(0,X.jsx)(j,{disabled:!0,children:`Disabled`})]})]}),(0,X.jsx)(Q,{title:`Badges`,children:(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsx)(R,{children:`Default`}),(0,X.jsx)(R,{variant:`secondary`,children:`Secondary`}),(0,X.jsx)(R,{variant:`outline`,children:`Outline`}),(0,X.jsx)(R,{variant:`destructive`,children:`Destructive`})]})}),(0,X.jsx)(Q,{title:`Inputs & selection`,children:(0,X.jsxs)(`div`,{className:`oc-show__row oc-show__row--col`,children:[(0,X.jsx)(V,{placeholder:`Text input…`}),(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsxs)(U,{value:n,onValueChange:r,children:[(0,X.jsx)(H,{className:`w-56`,children:(0,X.jsx)(F,{placeholder:`Select…`})}),(0,X.jsxs)(N,{children:[(0,X.jsx)(M,{value:`per-user`,children:`per-user (chacun son agent)`}),(0,X.jsx)(M,{value:`shared`,children:`shared (agent commun)`})]})]}),(0,X.jsxs)(`label`,{className:`oc-show__check`,children:[(0,X.jsx)(z,{checked:e,onCheckedChange:e=>t(!!e)}),`Checkbox`]})]})]})}),(0,X.jsx)(Q,{title:`Filtres & plage temporelle`,description:`Barre réutilisable (recherche debouncée + selects rapides à largeur auto + plage façon Grafana) et constructeur de filtre avancé. Câblée dans Users, Groups, Comptes de service, Traces, Anomalies, Audit et KPI.`,children:(0,X.jsxs)(`div`,{className:`oc-show__row oc-show__row--col`,children:[(0,X.jsxs)(Ot,{q:i,onQChange:a,searchPlaceholder:`Rechercher (kind, principal, rôle, route…)`,timeRange:u,onTimeRangeChange:d,onReset:p,canReset:f,children:[(0,X.jsxs)(U,{value:o,onValueChange:s,children:[(0,X.jsx)(H,{size:`sm`,children:(0,X.jsx)(F,{})}),(0,X.jsxs)(N,{children:[(0,X.jsx)(M,{value:Z,children:`Toutes directions`}),(0,X.jsx)(M,{value:`inbound`,children:`inbound`}),(0,X.jsx)(M,{value:`outbound`,children:`outbound`}),(0,X.jsx)(M,{value:`internal`,children:`internal`})]})]}),(0,X.jsxs)(U,{value:c,onValueChange:l,children:[(0,X.jsx)(H,{size:`sm`,children:(0,X.jsx)(F,{})}),(0,X.jsxs)(N,{children:[(0,X.jsx)(M,{value:Z,children:`Toutes sévérités`}),(0,X.jsx)(M,{value:`info`,children:`info`}),(0,X.jsx)(M,{value:`warn`,children:`warn`}),(0,X.jsx)(M,{value:`critical`,children:`critical`})]})]})]}),(0,X.jsx)(kt,{fields:qt,onChange:()=>{}}),(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsx)(`span`,{className:`oc-show__desc`,children:`Sélecteur de plage seul :`}),(0,X.jsx)(Dt,{value:u,onChange:d})]})]})}),(0,X.jsx)(Q,{title:`Dropdown menu`,description:`Row actions / kebab`,children:(0,X.jsxs)(ht,{children:[(0,X.jsx)(ft,{asChild:!0,children:(0,X.jsx)(j,{variant:`outline`,size:`icon`,"aria-label":`Open menu`,children:(0,X.jsx)(I,{})})}),(0,X.jsxs)(pt,{align:`start`,children:[(0,X.jsx)(mt,{children:`Actions`}),(0,X.jsx)(B,{}),(0,X.jsx)(L,{children:`Edit`}),(0,X.jsx)(L,{children:`Duplicate`}),(0,X.jsx)(B,{}),(0,X.jsx)(L,{variant:`destructive`,children:`Delete`})]})]})}),(0,X.jsx)(Q,{title:`Card`,children:(0,X.jsxs)(Ct,{className:`w-80`,children:[(0,X.jsxs)(vt,{children:[(0,X.jsx)(xt,{children:`Instance`}),(0,X.jsx)(St,{children:`Non-secret metadata only.`})]}),(0,X.jsx)(bt,{className:`text-sm text-muted-foreground`,children:`ws://gateway.example.org:18789`}),(0,X.jsxs)(yt,{className:`gap-2`,children:[(0,X.jsx)(j,{size:`sm`,children:`Save`}),(0,X.jsx)(j,{size:`sm`,variant:`ghost`,children:`Cancel`})]})]})}),(0,X.jsx)(Q,{title:`Table`,children:(0,X.jsxs)(Et,{children:[(0,X.jsx)(wt,{children:(0,X.jsxs)(G,{children:[(0,X.jsx)(W,{className:`w-8`,children:(0,X.jsx)(z,{"aria-label":`select all`})}),(0,X.jsx)(W,{children:`Name`}),(0,X.jsx)(W,{children:`Mode`}),(0,X.jsx)(W,{className:`text-right`,children:`Status`}),(0,X.jsx)(W,{className:`w-8`})]})}),(0,X.jsx)(Tt,{children:[{n:`admins`,m:`per-user`,s:`active`},{n:`family`,m:`shared`,s:`active`}].map(e=>(0,X.jsxs)(G,{children:[(0,X.jsx)(K,{children:(0,X.jsx)(z,{"aria-label":`select ${e.n}`})}),(0,X.jsx)(K,{className:`font-medium`,children:e.n}),(0,X.jsx)(K,{children:(0,X.jsx)(R,{variant:`secondary`,children:e.m})}),(0,X.jsx)(K,{className:`text-right`,children:(0,X.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-muted-foreground`,children:[(0,X.jsx)(k,{className:`size-3.5`}),` `,e.s]})}),(0,X.jsx)(K,{children:(0,X.jsx)(j,{variant:`ghost`,size:`icon`,"aria-label":`row actions`,children:(0,X.jsx)(I,{})})})]},e.n))})]})}),(0,X.jsx)(Q,{title:`App fragments`,description:`Chat-specific components`,children:(0,X.jsxs)(`div`,{className:`oc-show__row oc-show__row--col`,children:[(0,X.jsx)(`div`,{className:`oc-msg oc-msg--assistant`,children:(0,X.jsx)(`div`,{className:`oc-msg__body`,children:`Assistant message bubble.`})}),(0,X.jsx)(`div`,{className:`oc-tool oc-tool--completed`,children:(0,X.jsxs)(`div`,{className:`oc-tool__header`,children:[(0,X.jsx)(`span`,{className:`oc-tool__icon`,children:`✓`}),(0,X.jsx)(`span`,{className:`oc-tool__name`,children:`write-file`}),(0,X.jsx)(`span`,{className:`oc-tool__phase`,children:`completed`})]})}),(0,X.jsxs)(`div`,{className:`oc-run-status oc-run-status--streaming`,children:[(0,X.jsx)(`span`,{className:`oc-run-status__dot`}),(0,X.jsx)(`span`,{className:`oc-run-status__label`,children:`Running`})]})]})})]})]})}export{ln as ThemeShowroom};
|