@lacneu/atrium 0.45.0 → 0.46.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/AccessTab-CnqowIoW.js +1 -0
- package/dist/assets/{AdvancedFilter-DTbUf7Uh.js → AdvancedFilter-BwM0tgcf.js} +1 -1
- package/dist/assets/AgentFilesTab-DDg4ICzb.js +3 -0
- package/dist/assets/AnomaliesTab-CGcJ3wmF.js +1 -0
- package/dist/assets/AuditTab-zCOZM2TR.js +1 -0
- package/dist/assets/BridgeTab-CNu53hNw.js +1 -0
- package/dist/assets/ChatDefaultsTab-B46jHJ28.js +1 -0
- package/dist/assets/{DataTableShell-Cu3JqhO0.js → DataTableShell-q5ZC3kNL.js} +1 -1
- package/dist/assets/{DetailChips-DsU6cc30.js → DetailChips-BI5FFFCD.js} +1 -1
- package/dist/assets/FeedbacksTab-CBcmw16u.js +1 -0
- package/dist/assets/{FieldLabel-CK9i2-CR.js → FieldLabel--ykPvwgz.js} +1 -1
- package/dist/assets/FilesTab-D3HsZ9ry.js +1 -0
- package/dist/assets/{FilterBar-BIebILEF.js → FilterBar-Bjp3W3-O.js} +1 -1
- package/dist/assets/GroupsTab-VfM-4Ecl.js +1 -0
- package/dist/assets/InstancesTab-F3IfZLE3.js +1 -0
- package/dist/assets/IntegrationsTab-DJxr_XK1.js +1 -0
- package/dist/assets/{KpiTab-CUvEA1Vs.js → KpiTab-D6fmcfqo.js} +1 -1
- package/dist/assets/PreferencesTab-B41aNAtO.js +1 -0
- package/dist/assets/PromptInjectionsTab-C5r10hCQ.js +4 -0
- package/dist/assets/RolesTab-CYEWa_KN.js +1 -0
- package/dist/assets/ServiceAccountsTab-BszQMvl9.js +1 -0
- package/dist/assets/{SubAgentReportsTab-VpnYYzS8.js → SubAgentReportsTab-thWzL8aO.js} +1 -1
- package/dist/assets/ThemeShowroom-DpP1Qhwh.js +1 -0
- package/dist/assets/{TimeRangePicker-NNSu8mCt.js → TimeRangePicker-DyTyIIGL.js} +1 -1
- package/dist/assets/TracesTab-DeyNQxGK.js +1 -0
- package/dist/assets/UsersTab-BLqkvz9t.js +1 -0
- package/dist/assets/VoiceTab-Bd-wwhq_.js +1 -0
- package/dist/assets/{button-DK1qmYDJ.js → button-BZ2ghM2f.js} +1 -1
- package/dist/assets/{card-D0s3oDw3.js → card-CDvtHf5l.js} +1 -1
- package/dist/assets/chevrons-up-down-DVUxe1j7.js +1 -0
- package/dist/assets/{compatView-D2caU8vq.js → compatView-e2VbQwBf.js} +1 -1
- package/dist/assets/dispatchErrorInfo-DDqhw8fE.js +1 -0
- package/dist/assets/{dist-Ciwp9Ovi.js → dist-C6Q7qHg4.js} +1 -1
- package/dist/assets/{dist-DCABHmKq.js → dist-C6Yu7C_m.js} +1 -1
- package/dist/assets/dist-CQKky_Rh.js +44 -0
- package/dist/assets/{dist-8uYlaw3Q.js → dist-Dp0-U7Ca.js} +1 -1
- package/dist/assets/{highlighted-body-OFNGDK62-DSUwEB_f.js → highlighted-body-OFNGDK62-BAwLXCoD.js} +1 -1
- package/dist/assets/index-BuqxeAUW.js +233 -0
- package/dist/assets/mermaid-GHXKKRXX-ruH5qf7k.js +1 -0
- package/dist/assets/{pdf-Bkk0DZGy.js → pdf-CalEjQAS.js} +1 -1
- package/dist/assets/roleDescriptions-Bkj7WtCA.js +1 -0
- package/dist/assets/{table-EwCph6eW.js → table-IXupQ5w1.js} +1 -1
- package/dist/assets/{tabs-oKL6bnDA.js → tabs-e0oOoEId.js} +1 -1
- package/dist/assets/x-Do-PZuRM.js +1 -0
- package/dist/index.html +7 -7
- package/package.json +1 -1
- package/dist/assets/AccessTab-CeM6DU3j.js +0 -1
- package/dist/assets/AgentFilesTab-CMkpQWSX.js +0 -3
- package/dist/assets/AnomaliesTab-D0i-H1F-.js +0 -1
- package/dist/assets/AuditTab-BGkuzfTz.js +0 -1
- package/dist/assets/BridgeTab-RQWxNBYu.js +0 -1
- package/dist/assets/ChatDefaultsTab-CsSF3H0g.js +0 -1
- package/dist/assets/FeedbacksTab-BjSu8m8B.js +0 -1
- package/dist/assets/FilesTab-VunHJ3Lm.js +0 -1
- package/dist/assets/GroupsTab-CdZIVswx.js +0 -1
- package/dist/assets/InstancesTab-CTiBjGZm.js +0 -1
- package/dist/assets/IntegrationsTab-BFgO7Lv0.js +0 -1
- package/dist/assets/PreferencesTab-B4SJqQ6Q.js +0 -1
- package/dist/assets/PromptInjectionsTab-iWFE9MNO.js +0 -4
- package/dist/assets/RolesTab-BBIaufnh.js +0 -1
- package/dist/assets/ServiceAccountsTab-JBIFWSDh.js +0 -1
- package/dist/assets/ThemeShowroom-3hLnrfvP.js +0 -1
- package/dist/assets/TracesTab-pFMHb6OV.js +0 -1
- package/dist/assets/UsersTab-CQyH6-vc.js +0 -1
- package/dist/assets/VoiceTab-CPXr9SEe.js +0 -1
- package/dist/assets/chevrons-up-down-DOso-2c4.js +0 -1
- package/dist/assets/dispatchErrorInfo-evHHi1jG.js +0 -1
- package/dist/assets/dist-TE9n7zkZ.js +0 -44
- package/dist/assets/index-ctX_-fgr.js +0 -233
- package/dist/assets/mermaid-GHXKKRXX-DWoP8Llb.js +0 -1
- package/dist/assets/roleDescriptions-CCsDWcXg.js +0 -1
- package/dist/assets/x-C-AIvdVt.js +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{Cy as e,Ey as t,Sy as n,Ty as r,wy as i}from"./dist-CQKky_Rh.js";var a={pending:t,user:r,admin:i,observer:e,agent:n};function o(e){if(e.builtin){let t=a[e.key];if(t)return t()}return e.description}export{o as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e,r as t}from"./bundle-mjs-C73ZY4La.js";import{n}from"./dist-
|
|
1
|
+
import{a as e,r as t}from"./bundle-mjs-C73ZY4La.js";import{n}from"./dist-CQKky_Rh.js";e();var r=t();function i({className:e,...t}){return(0,r.jsx)(`div`,{"data-slot":`table-container`,className:`relative w-full overflow-x-auto`,children:(0,r.jsx)(`table`,{"data-slot":`table`,className:n(`w-full caption-bottom text-sm`,e),...t})})}function a({className:e,...t}){return(0,r.jsx)(`thead`,{"data-slot":`table-header`,className:n(`[&_tr]:border-b`,e),...t})}function o({className:e,...t}){return(0,r.jsx)(`tbody`,{"data-slot":`table-body`,className:n(`[&_tr:last-child]:border-0`,e),...t})}function s({className:e,...t}){return(0,r.jsx)(`tr`,{"data-slot":`table-row`,className:n(`border-b transition-colors hover:bg-muted/50 has-aria-expanded:bg-muted/50 data-[state=selected]:bg-muted`,e),...t})}function c({className:e,...t}){return(0,r.jsx)(`th`,{"data-slot":`table-head`,className:n(`h-10 px-2 text-left align-middle font-medium whitespace-nowrap text-foreground [&:has([role=checkbox])]:pr-0`,e),...t})}function l({className:e,...t}){return(0,r.jsx)(`td`,{"data-slot":`table-cell`,className:n(`p-2 align-middle whitespace-nowrap [&:has([role=checkbox])]:pr-0`,e),...t})}export{a,c as i,o as n,s as o,l as r,i as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{d as r,f as i,h as a,n as o,t as s,u as c,v as l,y as u}from"./dist-
|
|
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-CQKky_Rh.js";import{t as d}from"./dist-C6Yu7C_m.js";import{Dt as f,Et as p,Ot as m}from"./index-BuqxeAUW.js";var h=t(e(),1),g=n(),_=`Tabs`,[v,y]=a(_,[m]),b=m(),[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)(p,{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-CQKky_Rh.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
|
@@ -53,14 +53,14 @@
|
|
|
53
53
|
document.documentElement.dataset.motion = "static";
|
|
54
54
|
})();
|
|
55
55
|
</script>
|
|
56
|
-
<script type="module" crossorigin src="/assets/index-
|
|
56
|
+
<script type="module" crossorigin src="/assets/index-BuqxeAUW.js"></script>
|
|
57
57
|
<link rel="modulepreload" crossorigin href="/assets/bundle-mjs-C73ZY4La.js">
|
|
58
|
-
<link rel="modulepreload" crossorigin href="/assets/dist-
|
|
59
|
-
<link rel="modulepreload" crossorigin href="/assets/dist-
|
|
60
|
-
<link rel="modulepreload" crossorigin href="/assets/dist-
|
|
61
|
-
<link rel="modulepreload" crossorigin href="/assets/dist-
|
|
62
|
-
<link rel="modulepreload" crossorigin href="/assets/x-
|
|
63
|
-
<link rel="modulepreload" crossorigin href="/assets/button-
|
|
58
|
+
<link rel="modulepreload" crossorigin href="/assets/dist-CQKky_Rh.js">
|
|
59
|
+
<link rel="modulepreload" crossorigin href="/assets/dist-C6Yu7C_m.js">
|
|
60
|
+
<link rel="modulepreload" crossorigin href="/assets/dist-C6Q7qHg4.js">
|
|
61
|
+
<link rel="modulepreload" crossorigin href="/assets/dist-Dp0-U7Ca.js">
|
|
62
|
+
<link rel="modulepreload" crossorigin href="/assets/x-Do-PZuRM.js">
|
|
63
|
+
<link rel="modulepreload" crossorigin href="/assets/button-BZ2ghM2f.js">
|
|
64
64
|
<link rel="stylesheet" crossorigin href="/assets/index-BdrBbL7i.css">
|
|
65
65
|
</head>
|
|
66
66
|
<body>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lacneu/atrium",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.46.0",
|
|
4
4
|
"description": "Atrium — public, self-hostable, Convex-backed web chat UI for AI agent gateways (OpenClaw today, Hermes next). Ships an origin-agnostic static bundle (Convex URL injected at runtime via /config.json).",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$u as r,E as i,Gu as a,Hj as o,Hu as s,Ju as c,Ku as l,Nj as u,Qu as d,Uu as f,Wu as p,Xu as m,Yu as h,Zu as g,ed as _,nd as v,qu as y,td as b}from"./dist-TE9n7zkZ.js";import{C as x,S,b as C,ct as w,w as T,x as E}from"./index-ctX_-fgr.js";var D=t(e(),1);function O(e){return e===`user`?l():e===`all`?a():p({group:e.group})}function k(e){return e===`common`?f():e===`owner`?s():p({group:e.group})}var A=n();function j(e){return e.name||e.email||e.userId.slice(0,8)}function M(){let e=o(i.admin.listUsers,{}),[t,n]=(0,D.useState)(``),a=o(i.introspect.introspectUser,t?{userId:t}:`skip`);return(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:v()}),(0,A.jsxs)(C,{value:t,onValueChange:n,children:[(0,A.jsx)(x,{size:`sm`,"aria-label":b(),children:(0,A.jsx)(T,{placeholder:b()})}),(0,A.jsx)(E,{children:(e??[]).map(e=>(0,A.jsx)(S,{value:e.userId,children:j(e)},e._id))})]}),t===``?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:_()}):a===void 0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:u()}):(0,A.jsxs)(`div`,{className:`oc-introspect`,children:[(0,A.jsxs)(`section`,{className:`oc-introspect__section`,children:[(0,A.jsx)(`h3`,{className:`oc-introspect__title`,children:r()}),(0,A.jsxs)(`div`,{className:`oc-introspect__id`,children:[(0,A.jsx)(`strong`,{children:a.user.label}),(0,A.jsx)(w,{variant:`secondary`,children:a.role})]})]}),(0,A.jsxs)(`section`,{className:`oc-introspect__section`,children:[(0,A.jsx)(`h3`,{className:`oc-introspect__title`,children:d()}),a.groups.length===0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:c()}):(0,A.jsx)(`div`,{className:`oc-introspect__chips`,children:a.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:g()}),a.agents.length===0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:c()}):(0,A.jsx)(`ul`,{className:`oc-introspect__list`,children:a.agents.map(e=>(0,A.jsxs)(`li`,{className:`oc-introspect__row`,children:[(0,A.jsx)(`span`,{className:`oc-introspect__name`,children:e.displayName||e.agentId}),e.isDefault?(0,A.jsx)(w,{variant:`default`,children:y()}):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:m()}),a.charts.length===0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:c()}):(0,A.jsx)(`ul`,{className:`oc-introspect__list`,children:a.charts.map(e=>(0,A.jsxs)(`li`,{className:`oc-introspect__row`,children:[(0,A.jsx)(`span`,{className:`oc-introspect__name`,children:e.name}),(0,A.jsx)(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:h()}),a.permissions.length===0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:c()}):(0,A.jsx)(`div`,{className:`oc-introspect__chips`,children:a.permissions.map(e=>(0,A.jsx)(w,{variant:`secondary`,children:e},e))})]})]})]})}export{M as AccessTab};
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Ac as r,Ar as i,Cc as a,Cr as o,Dc as s,Dr as c,E as l,Ec as u,Er as d,Fc as f,Fj as p,Fr as m,Hj as h,Ic as g,Ir as _,Lc as v,Lr as y,Mc as b,Mr as x,Nc as S,Nj as C,Nr as w,Oc as T,Or as E,Pc as D,Pr as O,Rr as k,SE as A,Sc as j,Sr as M,Tc as ee,Tr as N,Vj as P,_c as F,bc as I,bl as L,br as R,cc as te,cr as ne,dc as re,dr as ie,fc as ae,fr as z,gc as B,hc as V,jc as oe,jr as H,kc as se,kr as ce,lc as le,lr as U,mc as W,or as ue,pc as de,sr as fe,uc as pe,ur as me,vc as he,vl as ge,wc as _e,wr as ve,xc as ye,xr as be,yc as xe,yr as Se,zj as G,zr as Ce}from"./dist-TE9n7zkZ.js";import{t as K}from"./button-DK1qmYDJ.js";import{At as q,C as we,G as Te,H as J,J as Ee,K as De,Q as Oe,S as ke,X as Ae,Y as je,Z as Me,b as Ne,ct as Pe,dt as Fe,ft as Ie,ht as Le,mt as Re,q as ze,ut as Be,w as Ve,x as He,xt as Ue,y as We}from"./index-ctX_-fgr.js";import{n as Ge,t as Ke}from"./curation-CQksaIbm.js";import{i as qe}from"./compatView-D2caU8vq.js";/* empty css */var Y=t(e(),1),X=2e4,Je=6e4;function Ye(e){return typeof e!=`number`||e<=0?0:Math.round(e/X*100)}function Xe(e){return e<=0?0:Math.round(e/Je*100)}function Z(e,t){let n=(typeof e==`number`&&e>0?e:0)/1e3;return new Intl.NumberFormat(t,{minimumFractionDigits:1,maximumFractionDigits:1}).format(n)}function Ze(e){return e.reduce((e,t)=>e+(typeof t.size==`number`&&t.size>0?t.size:0),0)}var Qe=3;function $e(e,t){let n=new Map;for(let t of e.split(`
|
|
2
|
-
`))n.set(t,(n.get(t)??0)+1);for(let e of t.split(`
|
|
3
|
-
`))n.set(e,(n.get(e)??0)-1);let r=0,i=0,a=[],o=[];for(let[e,t]of n)t<0?(r+=-t,a.length<Qe&&a.push(e)):t>0&&(i+=t,o.length<Qe&&o.push(e));return{added:r,removed:i,sampleAdded:a,sampleRemoved:o}}function et(e){return e instanceof Error?e.message.includes(`conflict:`):String(e).includes(`conflict:`)}var Q=n(),$=e=>`${e.instanceName}::${e.agentId}`;function tt(){let e=h(l.me.getMe,{host:Ue}),t=e?.role===`admin`,n=(e?.permissions??[]).includes(`bridge.read`),i=h(l.admin.listInstances,e!==void 0&&t?{}:`skip`),[a,o]=(0,Y.useState)(null);(0,Y.useEffect)(()=>{!t||!i||i.length===0||(!a||!i.some(e=>e.name===a))&&o(i[0].name)},[t,i,a]);let c=h(l.agents.listAgentsForInstance,t&&a?{instanceName:a}:`skip`),d=h(l.agents.listMyAgents,e!==void 0&&!t?{}:`skip`),y=(0,Y.useMemo)(()=>{if(e!==void 0){if(t)return a===null||c===void 0?i!==void 0&&i.length===0?[]:void 0:c.agents.map(e=>({instanceName:a,agentId:e.agentId,label:`${e.emoji?`${e.emoji} `:``}${e.displayName??e.agentId}`}));if(d!==void 0)return d.map(e=>({instanceName:e.instanceName,agentId:e.agentId,label:`${e.emoji?`${e.emoji} `:``}${e.displayName??e.agentId}`}))}},[e,t,a,c,i,d]),[x,w]=(0,Y.useState)(null);(0,Y.useEffect)(()=>{!y||y.length===0||(!x||!y.some(e=>$(e)===x))&&w($(y[0]))},[y,x]);let E=y?.find(e=>$(e)===x)??null,k=G(l.agentFiles.listAgentFiles),[A,j]=(0,Y.useState)({status:`idle`}),M=E?.instanceName??null,N=E?.agentId??null,P=h(l.compat.forInstance,n&&M!==null?{instanceName:M}:`skip`),F=n&&M!==null?We(P,`agentFiles`):null,I=F===null?!1:F===`loading`?null:F.blocked,L=(0,Y.useCallback)(async()=>{if(!(M===null||N===null)){j({status:`loading`});try{j({status:`done`,files:(await k({instanceName:M,agentId:N})).files})}catch{j({status:`error`})}}},[k,M,N]);(0,Y.useEffect)(()=>{I===!1&&L()},[L,I]);let[R,te]=(0,Y.useState)(null),ne=h(l.agentFileCuration.listCurations,t&&M!==null&&N!==null?{instanceName:M,agentId:N}:`skip`),re=h(l.agentFileCuration.curationSettings,t&&M!==null?{instanceName:M}:`skip`),ie=G(l.agentFileCuration.requestCuration),[ae,z]=(0,Y.useState)(null),[B,V]=(0,Y.useState)(null),{toast:H}=J(),ce=(0,Y.useMemo)(()=>{let e=new Map;for(let t of ne??[])e.has(t.name)||e.set(t.name,t);return e},[ne]),le=(0,Y.useCallback)(async e=>{if(!(M===null||N===null)){z(e);try{let t=await ie({instanceName:M,agentId:N,name:e,trigger:`manual`});t.ok?H({title:_(),variant:`success`}):H({title:m({reason:t.reason??`unknown`}),variant:`error`})}catch{H({title:O(),variant:`error`})}finally{z(null)}}},[ie,M,N,H]),U=p(),W=(0,Y.useMemo)(()=>new Intl.NumberFormat(U,{maximumFractionDigits:0}),[U]);return e===void 0||y===void 0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:C()}):(0,Q.jsxs)(`div`,{className:`oc-afiles`,children:[(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:v()}),(0,Q.jsxs)(`div`,{className:`oc-afiles__picker`,children:[t&&(i?.length??0)>1?(0,Q.jsxs)(Ne,{value:a??``,onValueChange:e=>o(e),children:[(0,Q.jsx)(we,{size:`sm`,"aria-label":g(),children:(0,Q.jsx)(Ve,{})}),(0,Q.jsx)(He,{children:(i??[]).map(e=>(0,Q.jsx)(ke,{value:e.name,children:e.name},e.name))})]}):null,y.length>0?(0,Q.jsxs)(Ne,{value:x??``,onValueChange:e=>w(e),children:[(0,Q.jsx)(we,{size:`sm`,"aria-label":f(),children:(0,Q.jsx)(Ve,{})}),(0,Q.jsx)(He,{children:y.map(e=>(0,Q.jsx)(ke,{value:$(e),children:e.label},$(e)))})]}):(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:D()})]}),E===null?null:F===`loading`?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:C()}):F!==null&&F.blocked?(0,Q.jsxs)(`p`,{className:`oc-compat__blocked`,role:`status`,children:[(0,Q.jsx)(q,{size:14,"aria-hidden":!0}),` `,qe(F.gatewayVersion,F.provider)]}):A.status===`loading`||A.status===`idle`?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:C()}):A.status===`error`?(0,Q.jsxs)(`p`,{className:`oc-afiles__error`,role:`alert`,children:[b(),` `,(0,Q.jsx)(K,{variant:`outline`,size:`sm`,onClick:()=>void L(),children:ge()})]}):A.files.length===0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:S()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`div`,{className:`oc-afiles__list`,children:A.files.map(e=>{let n=Ye(e.size),i=n>=80;return(0,Q.jsxs)(`div`,{className:`oc-afiles__row`,children:[(0,Q.jsx)(`span`,{className:`oc-afiles__name`,title:e.name,children:e.name}),e.missing?(0,Q.jsx)(Pe,{variant:`outline`,children:oe()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`span`,{className:`oc-afiles__size`,children:r({size:Z(e.size,U)})}),(0,Q.jsx)(`span`,{className:`oc-afiles__gauge${i?` is-warn`:``}`,"aria-hidden":!0,children:(0,Q.jsx)(`span`,{className:`oc-afiles__gauge-fill`,style:{width:`${Math.min(n,100)}%`}})}),(0,Q.jsx)(`span`,{className:`oc-afiles__pct`,children:se({pct:W.format(n)})}),i?(0,Q.jsx)(q,{size:14,className:`oc-afiles__warn`,"aria-label":T()}):(0,Q.jsx)(`span`,{className:`oc-afiles__warn-slot`,"aria-hidden":!0})]}),(0,Q.jsx)(K,{variant:`outline`,size:`sm`,className:`oc-afiles__open`,onClick:()=>te(e),children:t?u():ee()}),t&&!e.missing?(0,Q.jsx)(nt,{curatable:Ke.includes(e.name),size:e.size??0,budget:re?.budgetChars??null,enabled:re?.enabled??!1,curation:ce.get(e.name)??null,inFlight:ae===e.name,onCurate:()=>void le(e.name),onReview:e=>V(e)}):null]},e.name)})}),(0,Q.jsx)(`p`,{className:`oc-afiles__budget`,children:s({used:Z(Ze(A.files),U),total:Z(Je,U),pct:W.format(Xe(Ze(A.files)))})})]}),R&&E?(0,Q.jsx)(rt,{instanceName:E.instanceName,agentId:E.agentId,name:R.name,isAdmin:t,onClose:()=>te(null),onSaved:()=>void L()}):null,B?(0,Q.jsx)(it,{curationId:B,onClose:()=>V(null),onApplied:()=>{V(null),L()}}):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:k()}):a||i?.status===`dispatched`||i?.status===`applying`?(0,Q.jsx)(Pe,{variant:`outline`,className:`oc-afiles__curate-status`,children:y()}):e&&r&&n!==null&&Ge(t,n)?(0,Q.jsx)(K,{variant:`outline`,size:`sm`,className:`oc-afiles__curate`,onClick:o,children:Ce()}):null}function rt({instanceName:e,agentId:t,name:n,isAdmin:r,onClose:i,onSaved:o}){let s=G(l.agentFiles.getAgentFile),c=G(l.agentFiles.setAgentFile),u=J(),[d,f]=(0,Y.useState)(null),[m,h]=(0,Y.useState)(!1),[g,_]=(0,Y.useState)(``),[v,y]=(0,Y.useState)(!1),[b,x]=(0,Y.useState)(!1),[S,w]=(0,Y.useState)(!1),[T,E]=(0,Y.useState)(!1),D=(0,Y.useCallback)(async r=>{h(!1);try{let i=await s({instanceName:e,agentId:t,name:n});f({content:i.content,updatedAtMs:i.updatedAtMs}),r||_(i.content),w(!1)}catch{h(!0)}},[s,e,t,n]);(0,Y.useEffect)(()=>{D(!1)},[D]);async function O(){if(d!==null){x(!0),E(!1);try{await c({instanceName:e,agentId:t,name:n,content:g,baseUpdatedAtMs:d.updatedAtMs??void 0}),u.success(he({name:n})),o(),await D(!1)}catch(e){et(e)?w(!0):E(!0)}finally{x(!1)}}}let k=d!==null&&g!==d.content,M=(0,Y.useMemo)(()=>d===null?null:$e(d.content,g),[d,g]),ee=g.length>X,N=p(),P=(0,Y.useMemo)(()=>new Intl.NumberFormat(N),[N]);return(0,Q.jsx)(Be,{open:!0,onOpenChange:e=>!e&&i(),children:(0,Q.jsxs)(Fe,{className:`oc-afiles__editor`,children:[(0,Q.jsxs)(Re,{children:[(0,Q.jsx)(Le,{children:_e({name:n})}),(0,Q.jsxs)(Ie,{children:[a({agent:t,instance:e}),r?null:(0,Q.jsxs)(Q.Fragment,{children:[` · `,j()]})]})]}),m?(0,Q.jsxs)(`p`,{className:`oc-afiles__error`,role:`alert`,children:[B(),` `,(0,Q.jsx)(K,{variant:`outline`,size:`sm`,onClick:()=>void D(!1),children:ge()})]}):d===null?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:C()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`textarea`,{className:`oc-afiles__source`,value:g,readOnly:!r,spellCheck:!1,onChange:e=>_(e.target.value),"aria-label":_e({name:n})}),(0,Q.jsx)(`p`,{className:`oc-afiles__hint`,children:ye()}),S?(0,Q.jsxs)(`p`,{className:`oc-afiles__error`,role:`alert`,children:[V(),` `,(0,Q.jsx)(K,{variant:`outline`,size:`sm`,onClick:()=>void D(!0),children:W()})]}):null,T?(0,Q.jsx)(`p`,{className:`oc-afiles__error`,role:`alert`,children:F()}):null,(0,Q.jsxs)(`div`,{className:`oc-afiles__editor-foot`,children:[(0,Q.jsx)(`span`,{className:`oc-afiles__count${ee?` is-over`:``}`,children:I({count:P.format(g.length),max:P.format(X)})}),r?(0,Q.jsx)(K,{size:`sm`,disabled:!k||b||S,onClick:()=>y(!0),children:b?L():xe()}):null]})]}),(0,Q.jsx)(Te,{open:v,onOpenChange:y,children:(0,Q.jsxs)(Ee,{children:[(0,Q.jsxs)(Me,{children:[(0,Q.jsx)(Oe,{children:de({name:n})}),(0,Q.jsx)(je,{children:ae({agent:t})})]}),M?(0,Q.jsxs)(`div`,{className:`oc-afiles__diff`,children:[(0,Q.jsx)(`p`,{className:`oc-afiles__diff-counts`,children:re({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:le()}),M.sampleRemoved.map((e,t)=>(0,Q.jsx)(`code`,{className:`oc-afiles__diff-line is-del`,children:e||` `},t))]}):null]}):null,(0,Q.jsxs)(Ae,{children:[(0,Q.jsx)(ze,{children:A()}),(0,Q.jsx)(De,{onClick:()=>void O(),children:te()})]})]})})]})})}function it({curationId:e,onClose:t,onApplied:n}){let r=h(l.agentFileCuration.getProposal,{curationId:e}),a=G(l.agentFileCuration.approveCuration),s=P(l.agentFileCuration.rejectCuration),{toast:u}=J(),[f,m]=(0,Y.useState)(null),[g,_]=(0,Y.useState)(!1),[v,y]=(0,Y.useState)(``),b=p(),S=(0,Y.useMemo)(()=>r?$e(r.beforeContent,r.proposedContent):null,[r]);async function T(){m(`approve`);try{let t=await a({curationId:e});t.ok?(u({title:w(),variant:`success`}),n()):u({title:t.reason===`conflict`?H():i({reason:t.reason??`unknown`}),variant:`error`})}catch{u({title:O(),variant:`error`})}finally{m(null)}}async function D(n){m(`reject`);try{let r=v.trim();(await s({curationId:e,...r?{comment:r}:{},relaunch:n})).ok?u({title:n?fe():x(),variant:`success`}):u({title:c(),variant:`error`}),t()}catch{u({title:O(),variant:`error`})}finally{m(null)}}return(0,Q.jsx)(Be,{open:!0,onOpenChange:e=>e?void 0:t(),children:(0,Q.jsxs)(Fe,{className:`oc-afiles__review`,children:[(0,Q.jsxs)(Re,{children:[(0,Q.jsx)(Le,{children:r?ce({name:r.name}):C()}),(0,Q.jsx)(Ie,{children:E()})]}),r===void 0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:C()}):r===null?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:c()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`p`,{className:`oc-afiles__review-sizes`,children:[d({before:Z(r.beforeSize,b),after:Z(r.proposedSize,b)}),r.overBudget?(0,Q.jsxs)(Q.Fragment,{children:[` `,(0,Q.jsx)(q,{size:13,"aria-hidden":!0}),` `,N()]}):null]}),S?(0,Q.jsx)(`p`,{className:`oc-afiles__review-diff`,children:ve({added:S.added,removed:S.removed})}):null,r.feedback?(0,Q.jsx)(`p`,{className:`oc-afiles__review-feedback`,children:ue({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:Se()}),(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:R()}),(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:o()}),(0,Q.jsx)(`pre`,{className:`oc-afiles__review-pre`,children:r.proposedContent})]})]})]}),g?(0,Q.jsxs)(`div`,{className:`oc-afiles__reject-form`,children:[(0,Q.jsx)(`label`,{className:`oc-afiles__review-label`,htmlFor:`curation-reject-comment`,children:z()}),(0,Q.jsx)(`textarea`,{id:`curation-reject-comment`,className:`oc-afiles__reject-textarea`,rows:3,placeholder:ie(),value:v,onChange:e=>y(e.target.value)}),(0,Q.jsxs)(`div`,{className:`oc-afiles__review-actions`,children:[(0,Q.jsx)(K,{variant:`ghost`,onClick:()=>_(!1),disabled:f!==null,children:me()}),(0,Q.jsx)(K,{variant:`outline`,onClick:()=>void D(!1),disabled:f!==null,children:f===`reject`?L():U()}),(0,Q.jsx)(K,{variant:`default`,onClick:()=>void D(!0),disabled:f!==null,children:f===`reject`?L():ne()})]})]}):(0,Q.jsxs)(`div`,{className:`oc-afiles__review-actions`,children:[(0,Q.jsx)(K,{variant:`outline`,onClick:()=>_(!0),disabled:f!==null||r==null,children:M()}),(0,Q.jsx)(K,{variant:`default`,onClick:()=>void T(),disabled:f!==null||r==null,children:f===`approve`?L():be()})]})]})})}export{tt as AgentFilesTab};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$v as r,Av as i,Bv as a,Cv as o,Dv as ee,E as s,Ev as c,Fv as te,Gv as ne,Hj as l,Hv as u,Iv as d,Jv as f,Kv as p,Lv as m,Mv as h,Nv as g,Ov as re,Pv as ie,Qv as ae,Rv as _,Tv as v,Uv as oe,Vj as se,Vv as ce,Wv as le,Xv as ue,Yv as de,Zv as fe,ay as pe,cy as me,dy as y,ey as he,iy as ge,jv as b,kv as x,ly as S,ny as C,oy as w,qv as T,ry as E,sy as D,ty as O,uy as k,wv as A,zv as j}from"./dist-TE9n7zkZ.js";import{C as M,H as N,S as P,U as F,Xt as I,Yt as L,a as _e,b as R,ct as z,j as ve,r as ye,w as B,x as V,xt as be}from"./index-ctX_-fgr.js";import{n as xe}from"./TimeRangePicker-NNSu8mCt.js";import{t as Se}from"./FilterBar-BIebILEF.js";import{t as Ce}from"./DataTableShell-Cu3JqhO0.js";import{t as H}from"./dispatchErrorInfo-evHHi1jG.js";var U=t(e(),1),W=n(),G=`__all__`,we=[{value:`open`},{value:`acknowledged`},{value:`resolved`}];function Te(e){return e===`open`?y():e===`acknowledged`?k():S()}var Ee=[`info`,`warn`,`critical`],De=[`detector`,`agent`,`user`],Oe={kind:`relative`,from:`now-30d`,to:`now`},ke=200,K=`all`;function q(){let e=I({from:`/settings/anomalies`}),t=L({from:`/settings/anomalies`}),n=e.q??``,o=e.status===K?G:e.status,c=e.severity??G,v=e.kind??G,[y,S]=(0,U.useState)(G),k=ye(e.from,e.to),{from:A,to:H}=xe(k),q=e=>void t({search:t=>({...t,q:e||void 0}),replace:!0}),J=e=>void t({search:t=>({...t,status:e===G?K:e})}),Y=e=>void t({search:t=>({...t,severity:e===G?void 0:e})}),Pe=e=>void t({search:t=>({...t,kind:e===G?void 0:e})}),Fe=e=>void t({search:t=>({...t,..._e(e)})}),Ie=F(),X=N(),Z=se(s.anomalies.resolveAnomaly),Le=(l(s.me.getMe,{host:be})?.permissions??[]).includes(`admin.manage`),Q=l(s.anomalies.listAnomalies,{limit:ke,filter:{q:n||void 0,from:A,to:H,anomalyStatus:o===G?void 0:o,severity:c===G?void 0:c,source:y===G?void 0:y,kind:v===G?void 0:v}}),$=(0,U.useMemo)(()=>{let e=new Set;for(let t of Q??[])e.add(t.kind);return[...e].sort()},[Q]),Re=n!==``||o!==`open`||c!==G||y!==G||v!==G||k.kind!==`relative`||k.from!==Oe.from;function ze(){S(G),t({search:{status:`open`},replace:!0})}async function Be(e){if(await Ie({title:me(),description:(0,W.jsxs)(W.Fragment,{children:[D(),` `,(0,W.jsx)(`span`,{className:`font-mono`,children:e.kind}),` `,w(),` `,(0,W.jsx)(`strong`,{children:pe()}),`.`,` `,ge()]}),confirmLabel:E()}))try{await Z({anomalyId:e._id,status:`resolved`}),X.success(C(),e.kind)}catch(e){X.error(O(),e)}}async function Ve(e){try{await Z({anomalyId:e._id,status:`acknowledged`}),X.success(he(),e.kind)}catch(e){X.error(r(),e)}}return(0,W.jsxs)(W.Fragment,{children:[(0,W.jsxs)(`p`,{className:`oc-admin__hint`,children:[ae(),` `,(0,W.jsx)(`strong`,{children:fe()}),` `,ue(),` `,(0,W.jsx)(`strong`,{children:de()}),` `,f(),` `,(0,W.jsx)(`strong`,{children:T()}),` `,p(),` `,(0,W.jsx)(`span`,{className:`oc-filter__window`,children:ne()})]}),(0,W.jsxs)(Se,{q:n,onQChange:q,searchPlaceholder:le(),timeRange:k,onTimeRangeChange:Fe,onReset:ze,canReset:Re,children:[(0,W.jsxs)(R,{value:o,onValueChange:J,children:[(0,W.jsx)(M,{size:`sm`,className:`w-36`,children:(0,W.jsx)(B,{})}),(0,W.jsxs)(V,{children:[(0,W.jsx)(P,{value:G,children:oe()}),we.map(e=>(0,W.jsx)(P,{value:e.value,children:Te(e.value)},e.value))]})]}),(0,W.jsxs)(R,{value:c,onValueChange:Y,children:[(0,W.jsx)(M,{size:`sm`,className:`w-36`,children:(0,W.jsx)(B,{placeholder:u()})}),(0,W.jsxs)(V,{children:[(0,W.jsx)(P,{value:G,children:ce()}),Ee.map(e=>(0,W.jsx)(P,{value:e,children:e},e))]})]}),(0,W.jsxs)(R,{value:y,onValueChange:S,children:[(0,W.jsx)(M,{size:`sm`,className:`w-32`,children:(0,W.jsx)(B,{placeholder:a()})}),(0,W.jsxs)(V,{children:[(0,W.jsx)(P,{value:G,children:j()}),De.map(e=>(0,W.jsx)(P,{value:e,children:e},e))]})]}),(0,W.jsxs)(R,{value:v,onValueChange:Pe,children:[(0,W.jsx)(M,{size:`sm`,className:`w-36`,children:(0,W.jsx)(B,{placeholder:_()})}),(0,W.jsxs)(V,{children:[(0,W.jsx)(P,{value:G,children:m()}),$.map(e=>(0,W.jsx)(P,{value:e,children:e},e))]})]})]}),(0,W.jsx)(Ce,{title:d(),rows:Q,emptyHint:o===`open`?te():ie(),rowActions:e=>Le&&e.status===`open`?[{label:g(),onSelect:()=>void Be(e)},{label:h(),onSelect:()=>void Ve(e)}]:[],columns:[{header:b(),cell:e=>(0,W.jsx)(`span`,{className:`oc-traces__time`,children:ve(e.at)}),sort:e=>e.at},{header:_(),cell:e=>(0,W.jsx)(`code`,{className:`oc-traces__mono`,children:e.kind}),sort:e=>e.kind},{header:u(),cell:e=>(0,W.jsx)(je,{severity:e.severity}),sort:e=>e.severity===`critical`?2:+(e.severity===`warn`)},{header:i(),cell:e=>(0,W.jsx)(Me,{status:e.status}),sort:e=>e.status===`resolved`?2:+(e.status===`acknowledged`)},{header:a(),cell:e=>(0,W.jsx)(z,{variant:`outline`,children:e.source}),sort:e=>e.source},{header:x(),cell:e=>(0,W.jsx)(`span`,{className:`oc-anomaly__msg`,children:e.message}),sort:e=>e.message},{header:re(),cell:e=>(0,W.jsx)(Ae,{row:e}),sort:e=>e.evidence??null},{header:ee(),cell:e=>e.correlationId?(0,W.jsx)(`code`,{className:`oc-traces__mono`,children:Ne(e.correlationId)}):(0,W.jsx)(`span`,{className:`oc-traces__muted`,children:`—`}),sort:e=>e.correlationId}]})]})}function J(e){if(e.kind!==`openclaw.dispatch_failures`||!e.evidence)return{};try{let t=JSON.parse(e.evidence);return{dominantCode:t.dominantCode,sampleCorrelationId:t.sampleCorrelationId}}catch{return{}}}function Y(e){if(e.kind!==`subagent.failure`||!e.evidence)return{};try{let t=JSON.parse(e.evidence);return{failedCount:t.failedCount,totalCount:t.totalCount,errorCategories:t.errorCategories}}catch{return{}}}function Ae({row:e}){let t=L();if(e.kind===`subagent.failure`){let n=Y(e);return(0,W.jsxs)(`div`,{className:`oc-anomaly__cause`,children:[(0,W.jsx)(`div`,{className:`oc-anomaly__cause-head`,children:[...new Set(n.errorCategories??[])].map(e=>(0,W.jsx)(`code`,{className:`oc-traces__mono`,children:e},e))}),e.correlationId?(0,W.jsxs)(`button`,{type:`button`,className:`oc-anomaly__drill`,onClick:()=>void t({to:`/settings/traces`,search:{q:e.correlationId,limit:100}}),children:[`↗ `,c()]}):null]})}let n=J(e);if(!n.dominantCode)return(0,W.jsx)(`span`,{className:`oc-traces__muted`,children:`—`});let r=H(n.dominantCode),i=n.sampleCorrelationId;return(0,W.jsxs)(`div`,{className:`oc-anomaly__cause`,children:[(0,W.jsxs)(`div`,{className:`oc-anomaly__cause-head`,children:[(0,W.jsx)(`span`,{className:`oc-anomaly__cause-label`,children:r.label}),(0,W.jsx)(`code`,{className:`oc-traces__mono`,children:n.dominantCode})]}),(0,W.jsx)(`p`,{className:`oc-anomaly__cause-hint`,children:r.hint}),i?(0,W.jsxs)(`button`,{type:`button`,className:`oc-anomaly__drill`,onClick:()=>void t({to:`/settings/traces`,search:{q:i,limit:100}}),children:[`↗ `,c()]}):null]})}function je({severity:e}){return(0,W.jsx)(`span`,{className:`oc-anomaly__sev oc-anomaly__sev--${e}`,children:e})}function Me({status:e}){return e===`open`?(0,W.jsx)(z,{variant:`destructive`,children:v()}):e===`acknowledged`?(0,W.jsx)(z,{variant:`secondary`,children:A()}):(0,W.jsx)(z,{variant:`outline`,children:o()})}function Ne(e){return e.length>8?e.slice(0,8):e}export{q as AnomaliesTab};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{E as r,Hj as i,Sn as a,_n as o,ab as s,bn as c,cb as l,db as u,fb as d,gb as f,hb as p,ib as m,lb as h,mb as g,nb as _,ob as v,pb as y,rb as b,sb as x,ub as S,vn as C,xn as w,yn as T}from"./dist-TE9n7zkZ.js";import{C as E,S as D,Xt as O,Yt as k,a as A,b as j,i as M,j as N,o as P,r as F,t as I,w as L,x as R}from"./index-ctX_-fgr.js";import{n as ee}from"./TimeRangePicker-NNSu8mCt.js";import{t as z}from"./FilterBar-BIebILEF.js";import{t as B}from"./AdvancedFilter-DTbUf7Uh.js";import{t as V}from"./DataTableShell-Cu3JqhO0.js";var H=t(e(),1),U=n(),W={kind:`relative`,from:I,to:`now`},G=`__all__`,K=[{value:`action`,label:a()},{value:`realLabel`,label:w()},{value:`targetLabel`,label:c()},{value:`impersonated`,label:T()},{value:`resource`,label:C()},{value:`resourceId`,label:o()}];function q(){let e=O({from:`/settings/audit`}),t=k({from:`/settings/audit`}),n=e.q??``,a=e.action??G,o=e.impersonated??G,c=e.resource??G,C=F(e.from,e.to),w=(0,H.useMemo)(()=>P(e.adv),[e.adv]),{from:T,to:I}=ee(C),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,...A(e)})}),Q=e=>void t({search:t=>({...t,adv:M(e)}),replace:!0}),$=i(r.admin.listAudit,{filter:{q:n||void 0,from:T,to:I,action:a===G?void 0:a,resource:c===G?void 0:c,impersonated:o===G?void 0:o===`yes`,advanced:w.length>0?w: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!==``||a!==G||o!==G||c!==G||w.length>0||C.kind!==`relative`||C.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:[f(),` `,(0,U.jsx)(`span`,{className:`oc-filter__window`,children:p()})]}),(0,U.jsxs)(z,{q:n,onQChange:q,searchPlaceholder:g(),timeRange:C,onTimeRangeChange:Z,onReset:ie,canReset:re,children:[(0,U.jsxs)(j,{value:a,onValueChange:J,children:[(0,U.jsx)(E,{size:`sm`,className:`w-40`,children:(0,U.jsx)(L,{placeholder:y()})}),(0,U.jsxs)(R,{children:[(0,U.jsx)(D,{value:G,children:d()}),te.map(e=>(0,U.jsx)(D,{value:e,children:e},e))]})]}),(0,U.jsxs)(j,{value:o,onValueChange:Y,children:[(0,U.jsx)(E,{size:`sm`,className:`w-40`,children:(0,U.jsx)(L,{})}),(0,U.jsxs)(R,{children:[(0,U.jsx)(D,{value:G,children:u()}),(0,U.jsx)(D,{value:`yes`,children:S()}),(0,U.jsx)(D,{value:`no`,children:h()})]})]}),(0,U.jsxs)(j,{value:c,onValueChange:X,children:[(0,U.jsx)(E,{size:`sm`,className:`w-40`,children:(0,U.jsx)(L,{placeholder:l()})}),(0,U.jsxs)(R,{children:[(0,U.jsx)(D,{value:G,children:x()}),ne.map(e=>(0,U.jsx)(D,{value:e,children:e},e))]})]})]}),(0,U.jsx)(B,{fields:K,seed:w,onChange:Q}),(0,U.jsx)(V,{title:v(),rows:$,emptyHint:s(),columns:[{header:m(),cell:e=>N(e.at),sort:e=>e.at},{header:y(),cell:e=>e.action,sort:e=>e.action},{header:b(),cell:e=>e.realLabel,sort:e=>e.realLabel},{header:_(),cell:e=>e.targetLabel??`—`,sort:e=>e.targetLabel??null},{header:l(),cell:e=>e.resource?e.resource+(e.resourceId?` · ${e.resourceId.slice(0,8)}`:``):`—`,sort:e=>e.resource??null}]})]})}export{q as AuditTab};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$m as r,Ah as i,Bh as a,Bs as o,Bt as s,Cg as c,Ch as l,D as u,Dh as d,E as f,Eh as p,Fh as m,Fs as h,Gs as g,Hh as ee,Hj as _,Hs as v,Ht as y,Ih as te,Jm as b,Js as ne,Ks as x,Kt as re,Lh as ie,Mh as ae,Nh as oe,Oh as se,Ph as ce,Qm as le,Rh as ue,Sh as de,Th as fe,Us as pe,Ut as me,Vh as he,Vj as ge,Vs as _e,Vt as ve,Ws as ye,Xm as be,Xs as xe,Ym as Se,Ys as Ce,Zm as we,Zs as Te,_g as Ee,_h as De,ah as Oe,bg as ke,bh as Ae,ch as je,dg as Me,dh as Ne,eh as Pe,fh as Fe,gg as Ie,gh as Le,hg as Re,hh as ze,ih as Be,jh as Ve,kh as He,lh as Ue,mg as We,mh as Ge,nh as Ke,oh as qe,ph as Je,qm as S,qs as Ye,rh as Xe,sh as C,th as Ze,ug as Qe,uh as $e,vg as et,vh as tt,wg as nt,wh as rt,xg as it,xh as at,yg as ot,yh as st,zh as ct,zj as lt,zs as ut,zt as dt}from"./dist-TE9n7zkZ.js";import{i as w,r as ft}from"./dist-DCABHmKq.js";import{t as pt}from"./chevrons-up-down-DOso-2c4.js";import{i as mt,n as T,o as ht,r as gt,s as _t}from"./FieldLabel-CK9i2-CR.js";import{i as vt,n as yt,r as bt,t as xt}from"./tabs-oKL6bnDA.js";import{t as St}from"./button-DK1qmYDJ.js";import{$ as Ct,At as E,C as D,H as wt,Kt as Tt,M as O,Nt as Et,S as k,Xt as Dt,Yt as A,b as j,ct as M,dt as Ot,et as kt,ft as At,ht as jt,j as Mt,lt as N,m as Nt,mt as Pt,p as Ft,qt as P,tt as It,ut as Lt,w as F,x as I,xt as Rt,zt}from"./index-ctX_-fgr.js";import{r as Bt}from"./locales-CPjguROj.js";import{a as L,i as R,n as Vt,o as z,r as B,t as V}from"./table-EwCph6eW.js";import{t as Ht}from"./FilterBar-BIebILEF.js";import{a as H,n as Ut,o as U,r as W,s as Wt,t as Gt}from"./compatView-D2caU8vq.js";import{t as G}from"./dispatchErrorInfo-evHHi1jG.js";var Kt=u(`refresh-cw`,[[`path`,{d:`M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8`,key:`v9h5vc`}],[`path`,{d:`M21 3v5h-5`,key:`1q7to0`}],[`path`,{d:`M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16`,key:`3uifl3`}],[`path`,{d:`M8 16H3v5`,key:`1cv678`}]]),qt=u(`wifi-off`,[[`path`,{d:`M12 20h.01`,key:`zekei9`}],[`path`,{d:`M8.5 16.429a5 5 0 0 1 7 0`,key:`1bycff`}],[`path`,{d:`M5 12.859a10 10 0 0 1 5.17-2.69`,key:`1dl1wf`}],[`path`,{d:`M19 12.859a10 10 0 0 0-2.007-1.523`,key:`4k23kn`}],[`path`,{d:`M2 8.82a15 15 0 0 1 4.177-2.643`,key:`1grhjp`}],[`path`,{d:`M22 8.82a15 15 0 0 0-11.288-3.764`,key:`z3jwby`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}]]),K=t(e(),1);function Jt(e){return e.filter(e=>e.state===`error`)}function Yt(e){return e.reachable&&Jt(e.targets).length===0}function Xt(e){return e.state===`error`&&e.lastErrorCode!==null}function Zt(e){return!!e.lastDownstreamRejectCode}function q(e){return e.kind??`openclaw`}function Qt(e){return[...e].sort((e,t)=>e===`openclaw`?-1:t===`openclaw`?1:e.localeCompare(t))}function $t(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 Qt(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__`,en={q:``,state:Y,instance:Y,version:Y},X={connected:0,error:1,idle:2};function tn(e){return e.q.trim()!==``||e.state!==`__all__`||e.instance!==`__all__`||e.version!==`__all__`}function nn(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 rn(e,t){return e===`version`?t.gatewayVersion===null:e===`lastOk`?t.lastOkAt===null:!1}function an(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 U(e,r)??Z(e,r)}case`lastOk`:return t.lastOkAt-n.lastOkAt;default:return Z(t.targetLabel,n.targetLabel)}}function on(e,t){if(!t)return e;let n=t.dir===`asc`?1:-1;return[...e].sort((e,r)=>{let i=rn(t.key,e),a=rn(t.key,r);return i&&a?0:i?1:a?-1:n*an(t.key,e,r)})}function sn(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 cn(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 ln(e){let t=new Set;for(let n of e)n.gatewayVersion!==null&&t.add(n.gatewayVersion);return[...t].sort((e,t)=>U(e,t)??Z(e,t))}var Q=n();function un({connections:e,displayByInstance:t}){let[n,i]=(0,K.useState)(en),[a,o]=(0,K.useState)(null),s=(0,K.useMemo)(()=>e.map((e,n)=>({_id:`${e.key}:${e.canonical}/${e.agentId}:${n}`,targetLabel:`${e.canonical}/${e.agentId}`,state:e.state,instanceName:e.instanceName??null,instanceLabel:e.instanceName?t.get(e.instanceName)??e.instanceName:null,gatewayHost:e.gatewayHost,gatewayVersion:e.gatewayVersion??null,okCount:e.okCount,errorCount:e.errorCount+(e.downstreamRejectCount??0),attempts:e.attempts,lastOkAt:e.lastOkAt??null,lastErrorCode:e.lastErrorCode??null,lastErrorAt:e.lastErrorAt??null,lastDownstreamRejectCode:e.lastDownstreamRejectCode??null,lastDownstreamRejectAt:e.lastDownstreamRejectAt??null})),[e,t]),c=(0,K.useMemo)(()=>sn(s),[s]),l=(0,K.useMemo)(()=>cn(s),[s]),u=(0,K.useMemo)(()=>ln(s),[s]),d=(0,K.useMemo)(()=>on(nn(s,n),a),[s,n,a]);function f(e){o(t=>t?.key===e?t.dir===`asc`?{key:e,dir:`desc`}:null:{key:e,dir:`asc`})}return e.length===0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:Ne()}):(0,Q.jsxs)(`div`,{className:`oc-conn`,children:[(0,Q.jsxs)(Ht,{q:n.q,onQChange:e=>i(t=>({...t,q:e})),searchPlaceholder:je(),onReset:()=>i(en),canReset:tn(n),children:[(0,Q.jsxs)(j,{value:n.state,onValueChange:e=>i(t=>({...t,state:e})),children:[(0,Q.jsx)(D,{size:`sm`,className:`w-36`,children:(0,Q.jsx)(F,{placeholder:qe()})}),(0,Q.jsxs)(I,{children:[(0,Q.jsx)(k,{value:Y,children:C()}),c.map(e=>(0,Q.jsx)(k,{value:e,children:fn(e)},e))]})]}),(0,Q.jsxs)(j,{value:n.instance,onValueChange:e=>i(t=>({...t,instance:e})),children:[(0,Q.jsx)(D,{size:`sm`,className:`w-40`,children:(0,Q.jsx)(F,{placeholder:Oe()})}),(0,Q.jsxs)(I,{children:[(0,Q.jsx)(k,{value:Y,children:C()}),l.map(e=>(0,Q.jsx)(k,{value:e.name,children:e.label},e.name))]})]}),(0,Q.jsxs)(j,{value:n.version,onValueChange:e=>i(t=>({...t,version:e})),children:[(0,Q.jsx)(D,{size:`sm`,className:`w-36`,children:(0,Q.jsx)(F,{placeholder:Be()})}),(0,Q.jsxs)(I,{children:[(0,Q.jsx)(k,{value:Y,children:C()}),u.map(e=>(0,Q.jsx)(k,{value:e,children:e},e))]})]})]}),d.length===0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:Xe()}):(0,Q.jsxs)(V,{className:`oc-conn__table`,children:[(0,Q.jsx)(L,{children:(0,Q.jsxs)(z,{children:[(0,Q.jsx)($,{label:Ke(),sortKey:`target`,sort:a,onSort:f}),(0,Q.jsx)($,{label:Ze(),sortKey:`state`,sort:a,onSort:f}),(0,Q.jsx)($,{label:Pe(),sortKey:`instance`,sort:a,onSort:f}),(0,Q.jsx)($,{label:r(),sortKey:`host`,sort:a,onSort:f}),(0,Q.jsx)($,{label:le(),sortKey:`version`,sort:a,onSort:f}),(0,Q.jsx)(R,{children:we()}),(0,Q.jsx)($,{label:be(),sortKey:`lastOk`,sort:a,onSort:f})]})}),(0,Q.jsx)(Vt,{children:d.map(e=>(0,Q.jsx)(dn,{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)(R,{"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)(w,{size:13,"aria-hidden":!0}):(0,Q.jsx)(pt,{size:13,"aria-hidden":!0,className:`oc-conn__sort-idle`})]})})}function dn({r:e}){let t=Xt(e)?G(e.lastErrorCode):null,n=Zt(e)?G(e.lastDownstreamRejectCode):null;return(0,Q.jsxs)(K.Fragment,{children:[(0,Q.jsxs)(z,{className:`oc-conn__row oc-conn__row--${e.state}`,children:[(0,Q.jsx)(B,{children:(0,Q.jsx)(`code`,{className:`oc-traces__mono`,children:e.targetLabel})}),(0,Q.jsx)(B,{children:(0,Q.jsx)(pn,{state:e.state})}),(0,Q.jsx)(B,{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)(B,{children:(0,Q.jsx)(`span`,{className:`oc-bridge-target__host`,children:e.gatewayHost})}),(0,Q.jsx)(B,{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)(B,{children:(0,Q.jsx)(`span`,{className:`oc-conn__stats`,children:$e({ok:e.okCount,errors:e.errorCount,attempts:e.attempts})})}),(0,Q.jsx)(B,{children:e.lastOkAt?(0,Q.jsx)(`span`,{className:`oc-traces__mono`,children:O(e.lastOkAt)}):(0,Q.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})})]}),t||n?(0,Q.jsx)(z,{className:`oc-conn__detail-row`,children:(0,Q.jsxs)(B,{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?` · ${O(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:[Ue({label:n.label}),` `,(0,Q.jsx)(`code`,{className:`oc-traces__mono`,children:e.lastDownstreamRejectCode}),e.lastDownstreamRejectAt?` · ${O(e.lastDownstreamRejectAt)}`:``]}):null]})}):null]})}function fn(e){return e===`connected`?Se():e===`error`?b():S()}function pn({state:e}){return e===`connected`?(0,Q.jsx)(M,{variant:`secondary`,children:Se()}):e===`error`?(0,Q.jsx)(M,{variant:`destructive`,children:b()}):(0,Q.jsx)(M,{variant:`outline`,children:S()})}function mn(){return _(f.bridgeHealth.getBridgeHealth,{})}function hn(){let e=mn(),t=_(f.compat.getBridgeCompat,{}),n=_(f.me.getMe,{host:Rt})?.role===`admin`,r=_(f.admin.listInstances,n?{}:`skip`),i=_(f.agents.usageForInstances,n?{}:`skip`),a=A(),o=()=>void a({to:`/settings/anomalies`,search:{status:`open`}}),c=$t(e?e.targets:[],t?t.targets:[],r??[]),{section:l}=Dt({from:`/settings/bridge`}),u=A({from:`/settings/bridge`}),p=t?.compat??null,m=t===void 0?`loading`:t===null?`nodata`:`ready`,g=p!==null&&Ut(p,`hermes`)&&!c.some(e=>e.key===`hermes`);return(0,Q.jsxs)(`div`,{className:`oc-bridge`,children:[(0,Q.jsx)(gn,{health:e,compat:t,onSeeAnomalies:o}),(0,Q.jsx)(`p`,{className:`oc-admin__hint oc-bridge__caption`,children:se()}),i&&i.length>0?(0,Q.jsxs)(`section`,{className:`oc-bridge__usage`,children:[(0,Q.jsx)(`h3`,{className:`oc-bridge__usage-title`,children:d()}),(0,Q.jsxs)(V,{children:[(0,Q.jsx)(L,{children:(0,Q.jsxs)(z,{children:[(0,Q.jsx)(R,{children:me()}),(0,Q.jsx)(R,{children:y()}),(0,Q.jsx)(R,{children:ve()}),(0,Q.jsx)(R,{children:s()}),(0,Q.jsx)(R,{children:dt()})]})}),(0,Q.jsx)(Vt,{children:i.flatMap(e=>{let t=Nt(e.usage,Date.now());return t?t.windows.map((t,n)=>(0,Q.jsxs)(z,{children:[(0,Q.jsx)(B,{className:`font-medium`,children:n===0?e.instanceName:``}),(0,Q.jsx)(B,{children:t.provider}),(0,Q.jsx)(B,{children:t.label}),(0,Q.jsx)(B,{children:(0,Q.jsxs)(M,{variant:t.percentLeft<=10?`destructive`:t.percentLeft<=25?`outline`:`secondary`,children:[t.percentLeft,`%`]})}),(0,Q.jsx)(B,{className:`text-muted-foreground`,children:t.resetText??`—`})]},`${e.instanceName}:${t.provider}:${t.label}`)):[]})})]})]}):null,c.length>0?(0,Q.jsxs)(xt,{value:c.some(e=>e.key===l)?l:c[0]?.key??`openclaw`,onValueChange:e=>void u({search:{section:e},replace:!0}),children:[(0,Q.jsx)(bt,{className:`w-full`,children:c.map(e=>(0,Q.jsxs)(vt,{value:e.key,className:`flex-1 gap-1.5`,children:[(0,Q.jsx)(Et,{size:13,"aria-hidden":!0}),J(e.key)]},e.key))}),c.map(e=>(0,Q.jsx)(yt,{value:e.key,children:(0,Q.jsx)(_n,{providerKey:e.key,connections:e.connections,instances:e.instances,manifest:p,compatStatus:m,compatReachable:t?.reachable??!0,protocol:e.key===`openclaw`?t?.protocol??null:null})},e.key))]}):null,g?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:h()}):null]})}function gn({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:H(t.bridgeVersion)}),i?(0,Q.jsxs)(Q.Fragment,{children:[` `,(0,Q.jsxs)(`code`,{className:`oc-traces__mono`,title:Ce(),children:[`(`,i,`)`]})]}):null,r?(0,Q.jsxs)(`strong`,{className:`oc-bridge-card__mismatch`,children:[` `,ne({build:t.buildVersion??`?`})]}):null,` · `,Ye(),` `,(0,Q.jsx)(`code`,{className:`oc-traces__mono`,children:t.protocolVersion===null?x():String(t.protocolVersion)})]}):null;if(e===void 0)return(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:Ae()});if(e===null)return(0,Q.jsx)(`div`,{className:`oc-bridge-card oc-bridge-card--idle`,children:st()});let o=Jt(e.targets),s=!e.reachable,c=Yt(e),l=c?`ok`:`error`,u=Mt(e.checkedAt),d=e.startedAt==null?null:Mt(e.startedAt);return(0,Q.jsxs)(`div`,{className:`oc-bridge-card oc-bridge-card--${l}`,children:[(0,Q.jsx)(`div`,{className:`oc-bridge-card__icon`,"aria-hidden":!0,children:c?(0,Q.jsx)(Tt,{size:22}):s?(0,Q.jsx)(qt,{size:22}):(0,Q.jsx)(E,{size:22})}),(0,Q.jsxs)(`div`,{className:`oc-bridge-card__body`,children:[(0,Q.jsx)(`div`,{className:`oc-bridge-card__title`,children:c?tt():s?De():Le({count:o.length})}),(0,Q.jsxs)(`div`,{className:`oc-bridge-card__meta`,children:[(0,Q.jsxs)(`span`,{children:[(0,Q.jsx)(Kt,{size:12,"aria-hidden":!0}),` `,ze({time:u})]}),d?(0,Q.jsx)(`span`,{children:Ge({time:d})}):null,a]}),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:Je()})]})}function _n({providerKey:e,connections:t,instances:n,manifest:r,compatStatus:i,compatReachable:a,protocol:o}){let s=r?Wt(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:Gt(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)(Et,{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)(M,{variant:f===`beyond`?`destructive`:`secondary`,children:W(f)}):null]}),(0,Q.jsx)(`h4`,{className:`oc-bridge-provider__sub`,children:Te()}),(0,Q.jsx)(yn,{providerName:J(e),support:s,compatStatus:i,compatReachable:a,manifest:r,instanceRows:l}),o?(0,Q.jsx)(vn,{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)(w,{size:13,"aria-hidden":!0}):(0,Q.jsx)(P,{size:13,"aria-hidden":!0}),Fe({count:t.length})]}),p?(0,Q.jsx)(un,{connections:t,displayByInstance:c}):null]})}function vn({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:[p(),i.length>0?(0,Q.jsx)(M,{variant:`destructive`,children:rt({count:i.length})}):(0,Q.jsx)(M,{variant:`secondary`,children:fe()})]}),(0,Q.jsxs)(`p`,{className:`oc-admin__hint`,children:[l({version:e.vendoredVersion}),r?` · `+de({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)(w,{size:13,"aria-hidden":!0}):(0,Q.jsx)(P,{size:13,"aria-hidden":!0}),at({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 yn({support:e,compatStatus:t,compatReachable:n,manifest:r,instanceRows:i,providerName:a}){return t===`loading`?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:Ae()}):t===`nodata`?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:xe()}):(0,Q.jsxs)(`div`,{className:`oc-compat`,children:[n?null:(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:g()}),r===null?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:ye()}):(0,Q.jsxs)(`div`,{className:`oc-compat__support`,children:[(0,Q.jsx)(`span`,{className:`oc-compat__label`,children:re({provider:a})}),e&&e.range!==null?(0,Q.jsx)(`span`,{children:pe({min:e.range.min,max:e.range.maxValidated})}):(0,Q.jsx)(`span`,{children:x()}),e?(0,Q.jsx)(Cn,{versions:e.validatedVersions}):null]}),i.length===0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:ut()}):(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:H(e.version)}),(0,Q.jsx)(M,{variant:e.state===`supported`?`secondary`:e.state===`beyond`?`destructive`:`outline`,children:W(e.state)})]},e.instanceName))})]})}function bn({instance:e,onClose:t}){return(0,Q.jsx)(Lt,{open:!0,onOpenChange:e=>!e&&t(),children:(0,Q.jsxs)(Ot,{className:`oc-bridge-config-dialog`,onOpenAutoFocus:e=>e.preventDefault(),children:[(0,Q.jsxs)(Pt,{children:[(0,Q.jsx)(jt,{children:nt({instance:e.displayName??e.name})}),(0,Q.jsx)(At,{children:c()})]}),(0,Q.jsx)(Sn,{instance:e,onClose:t})]})})}function xn({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)(Tt,{"aria-hidden":!0}):(0,Q.jsx)(E,{"aria-hidden":!0}),(0,Q.jsxs)(`span`,{children:[e,` — `,t.ok?ae():t.detail]})]}):(0,Q.jsxs)(`p`,{className:`oc-bridge-config__check-row oc-bridge-config__check-row--skip`,children:[e,` — `,Ve()]}):null}function Sn({instance:e,onClose:t}){let n=ge(f.admin.upsertInstanceConfig),r=lt(f.bridge.validateMediaPaths),o=wt(),s=Bt(e.config?.contentLocale,void 0),[c,l]=(0,K.useState)(()=>mt(e.config??{},s)),[u,d]=(0,K.useState)(!1),[p,h]=(0,K.useState)(!1),[g,_]=(0,K.useState)(null),v=c.inboundMediaMode===`shared-fs`,y=c.mediaMode===`shared-fs`,b=v||y;async function ne(){h(!0),_(null);try{_(await r({instanceName:e.name,inboundMediaMode:c.inboundMediaMode,mediaMode:c.mediaMode}))}catch(e){o.error(te(),e)}finally{h(!1)}}async function x(){d(!0);try{let r=e.config??{};await n({instanceId:e._id,config:gt(c,r,s)}),t()}catch(e){o.error(Ie(),e)}finally{d(!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)(T,{label:it(),help:Re()}),(0,Q.jsxs)(j,{value:c.mediaMode,onValueChange:e=>l({...c,mediaMode:e}),children:[(0,Q.jsx)(D,{size:`sm`,className:`w-full`,children:(0,Q.jsx)(F,{})}),(0,Q.jsx)(I,{children:_t.map(e=>(0,Q.jsx)(k,{value:e,children:e},e))})]})]}),(0,Q.jsxs)(`label`,{className:`oc-field`,children:[(0,Q.jsx)(T,{label:ke(),help:We()}),(0,Q.jsxs)(j,{value:c.inboundMediaMode,onValueChange:e=>l({...c,inboundMediaMode:e}),children:[(0,Q.jsx)(D,{size:`sm`,className:`w-full`,children:(0,Q.jsx)(F,{})}),(0,Q.jsx)(I,{children:ht.map(e=>(0,Q.jsx)(k,{value:e,children:e},e))})]})]}),(0,Q.jsxs)(`label`,{className:`oc-field`,children:[(0,Q.jsx)(T,{label:ot(),help:Me()}),(0,Q.jsx)(N,{type:`number`,min:1,max:4096,className:`w-full`,value:c.mediaMaxMb,onChange:e=>l({...c,mediaMaxMb:Math.trunc(Number(e.target.value)||0)})})]})]}),b&&(0,Q.jsxs)(`div`,{className:`oc-bridge-config__grid`,children:[v&&(0,Q.jsxs)(`label`,{className:`oc-field`,children:[(0,Q.jsx)(T,{label:ee(),help:he()}),(0,Q.jsx)(N,{className:`w-full`,spellCheck:!1,value:c.inboundAgentMount,onChange:e=>l({...c,inboundAgentMount:e.target.value})})]}),y&&(0,Q.jsxs)(`label`,{className:`oc-field`,children:[(0,Q.jsx)(T,{label:a(),help:ct()}),(0,Q.jsx)(N,{className:`w-full`,spellCheck:!1,value:c.outboundAgentMount,onChange:e=>l({...c,outboundAgentMount:e.target.value})})]})]}),(0,Q.jsxs)(`label`,{className:`oc-field--row`,children:[(0,Q.jsx)(Ft,{checked:c.rehydration,onCheckedChange:e=>l({...c,rehydration:e===!0})}),(0,Q.jsx)(T,{label:et(),help:Qe()})]}),b&&g!==null&&(0,Q.jsx)(`div`,{className:`oc-bridge-config__check`,children:g.reachable?!g.inbound&&!g.outbound?(0,Q.jsxs)(`p`,{className:`oc-bridge-config__check-row oc-bridge-config__check-row--err`,children:[(0,Q.jsx)(E,{"aria-hidden":!0}),He({reason:g.reason??`?`})]}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(xn,{label:ce(),result:g.inbound}),(0,Q.jsx)(xn,{label:oe(),result:g.outbound}),(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:m()})]}):(0,Q.jsxs)(`p`,{className:`oc-bridge-config__check-row oc-bridge-config__check-row--err`,children:[(0,Q.jsx)(E,{"aria-hidden":!0}),i()]})}),(0,Q.jsxs)(`div`,{className:`oc-bridge-config__actions`,children:[b&&(0,Q.jsxs)(St,{variant:`outline`,size:`sm`,onClick:()=>void ne(),disabled:p,children:[p?(0,Q.jsx)(zt,{className:`size-4 animate-spin`,"aria-hidden":!0}):null,p?ie():ue()]}),(0,Q.jsx)(St,{size:`sm`,onClick:()=>void x(),disabled:u,children:Ee()})]})]})})}function Cn({versions:e}){if(e.length===0)return null;let t=[...e].reverse();return(0,Q.jsxs)(Ct,{children:[(0,Q.jsx)(It,{asChild:!0,children:(0,Q.jsxs)(`button`,{type:`button`,className:`oc-compat__versions-btn`,children:[e.length===1?v():_e({count:e.length}),(0,Q.jsx)(w,{size:13,"aria-hidden":!0})]})}),(0,Q.jsxs)(kt,{className:`oc-compat__versions-pop`,align:`start`,children:[(0,Q.jsx)(`p`,{className:`oc-compat__versions-title`,children:o()}),(0,Q.jsx)(`div`,{className:`oc-compat__versions-list`,children:t.map(e=>(0,Q.jsx)(M,{variant:`secondary`,children:e},e))})]})]})}export{hn as BridgeTab,bn as InstanceConfigDialog};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$s as r,Ai as i,Di as a,E as o,Ei as s,Gt as c,Hj as l,Ic as u,Mi as d,Ni as f,Nj as p,Oi as m,Qs as h,Sg as g,Ti as _,Vj as v,ac as y,bl as b,ec as x,ic as S,ji as C,ki as w,ml as T,nc as E,oc as D,pl as O,rc as k,tc as A,vl as j,wi as M,zj as N}from"./dist-TE9n7zkZ.js";import{t as P}from"./button-DK1qmYDJ.js";import{At as F,C as I,S as L,b as R,d as z,f as B,lt as V,p as H,w as U,x as W,y as G}from"./index-ctX_-fgr.js";import{i as K}from"./compatView-D2caU8vq.js";/* empty css */var q=t(e(),1),J=[`off`,`minimal`,`low`,`medium`,`high`,`xhigh`];function Y(e){let t=typeof e==`object`&&e?e:{},n=t.defaults!==null&&typeof t.defaults==`object`?t.defaults:{},r=n.thinkingDefault??t.thinkingDefault,i=n.fastModeDefault??t.fastModeDefault;return{thinkingDefault:typeof r==`string`?r:null,fastModeDefault:typeof i==`boolean`?i:null}}var X=n();function Z({instance:e}){let t=v(o.admin.upsertInstanceConfig),n=l(o.agents.listAgentsForInstance,{instanceName:e.name}),a=typeof e.config?.converterAgentId==`string`?e.config.converterAgentId:``,[s,c]=(0,q.useState)(a),[u,d]=(0,q.useState)(`idle`);(0,q.useEffect)(()=>{c(a),d(`idle`)},[e._id,a]);let f=`__none__`,p=s!==a;async function g(){d(`saving`);try{let n={...e.config??{}};s===``||s===f?delete n.converterAgentId:n.converterAgentId=s,await t({instanceId:e._id,config:n}),d(`done`)}catch{d(`error`)}}let _=n?.agents??[];return(0,X.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,X.jsx)(`span`,{className:`oc-cdefaults__label`,children:i()}),(0,X.jsx)(`p`,{className:`oc-admin__hint`,children:w()}),(0,X.jsxs)(`div`,{className:`oc-cdefaults__inline`,children:[(0,X.jsxs)(R,{value:s===``?f:s,onValueChange:e=>c(e===f?``:e),children:[(0,X.jsx)(I,{className:`oc-cdefaults__select`,"aria-label":i(),children:(0,X.jsx)(U,{placeholder:m()})}),(0,X.jsxs)(W,{children:[(0,X.jsx)(L,{value:f,children:m()}),_.map(e=>(0,X.jsx)(L,{value:e.agentId,children:e.displayName?`${e.displayName} (${e.agentId})`:e.agentId},e.agentId))]})]}),(0,X.jsx)(P,{size:`sm`,disabled:!p||u===`saving`,onClick:()=>void g(),children:u===`saving`?b():x()})]}),u===`done`?(0,X.jsx)(`p`,{className:`oc-admin__hint`,role:`status`,children:r()}):null,u===`error`?(0,X.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:h()}):null]})}function Q({instance:e}){let t=v(o.admin.upsertInstanceConfig),n=e.config?.curationEnabled===!0,i=typeof e.config?.curationBudgetChars==`number`?e.config.curationBudgetChars:null,[c,l]=(0,q.useState)(n),[u,d]=(0,q.useState)(i===null?``:String(i)),[f,p]=(0,q.useState)(`idle`);(0,q.useEffect)(()=>{l(n),d(i===null?``:String(i)),p(`idle`)},[e._id,n,i]);let m=u.trim(),g=m===``?null:/^\d+$/.test(m)?Number.parseInt(m,10):NaN,y=!c||g===null||Number.isInteger(g)&&g>=4e3&&g<=6e4,S=c!==n||(g??null)!==i;async function w(){p(`saving`);try{let n={...e.config??{}};n.curationEnabled=c,!c||g===null||Number.isNaN(g)?delete n.curationBudgetChars:n.curationBudgetChars=g,await t({instanceId:e._id,config:n}),p(`done`)}catch{p(`error`)}}return(0,X.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,X.jsxs)(`label`,{className:`oc-cdefaults__inline`,style:{cursor:`pointer`},children:[(0,X.jsx)(H,{checked:c,onCheckedChange:e=>l(e===!0),"aria-label":C()}),(0,X.jsx)(`span`,{className:`oc-cdefaults__label`,children:C()})]}),(0,X.jsxs)(`div`,{className:`oc-cdefaults__inline`,children:[(0,X.jsx)(V,{type:`number`,min:4e3,max:6e4,step:1e3,placeholder:`20000`,value:u,onChange:e=>d(e.target.value),className:`oc-cdefaults__number`,"aria-invalid":!y,"aria-label":a(),disabled:!c}),(0,X.jsx)(P,{size:`sm`,disabled:!S||!y||f===`saving`,onClick:()=>void w(),children:f===`saving`?b():x()})]}),y?null:(0,X.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:s()}),f===`done`?(0,X.jsx)(`p`,{className:`oc-admin__hint`,role:`status`,children:r()}):null,f===`error`?(0,X.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:h()}):null,(0,X.jsx)(`p`,{className:`oc-cdefaults__help`,children:_()})]})}function $({instance:e}){let t=v(o.admin.upsertInstanceConfig),n=typeof e.config?.summarizeThresholdChars==`number`?e.config.summarizeThresholdChars:null,[i,a]=(0,q.useState)(n===null?``:String(n)),[s,c]=(0,q.useState)(`idle`);(0,q.useEffect)(()=>{a(n===null?``:String(n)),c(`idle`)},[e._id,n]);let l=i.trim(),u=l===``?null:/^\d+$/.test(l)?Number.parseInt(l,10):NaN,p=u===null||Number.isInteger(u)&&u>=1e3&&u<=2e5,m=(u??null)!==n;async function g(){c(`saving`);try{let n={...e.config??{}};u===null?delete n.summarizeThresholdChars:n.summarizeThresholdChars=u,await t({instanceId:e._id,config:n}),c(`done`)}catch{c(`error`)}}return(0,X.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,X.jsx)(`span`,{className:`oc-cdefaults__label`,children:f()}),(0,X.jsxs)(`div`,{className:`oc-cdefaults__inline`,children:[(0,X.jsx)(V,{type:`number`,min:1e3,max:2e5,step:1e3,placeholder:`8000`,value:i,onChange:e=>a(e.target.value),className:`oc-cdefaults__number`,"aria-invalid":!p}),(0,X.jsx)(P,{size:`sm`,disabled:!m||!p||s===`saving`,onClick:()=>void g(),children:s===`saving`?b():x()})]}),p?null:(0,X.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:M()}),s===`done`?(0,X.jsx)(`p`,{className:`oc-admin__hint`,role:`status`,children:r()}):null,s===`error`?(0,X.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:h()}):null,(0,X.jsx)(`p`,{className:`oc-cdefaults__help`,children:d()})]})}function ee(){let e=N(o.agentFiles.getChatDefaults),[t,n]=(0,q.useState)({status:`loading`}),r=l(o.admin.listInstances,{}),[i,a]=(0,q.useState)(null);(0,q.useEffect)(()=>{!r||r.length===0||(!i||!r.some(e=>e.name===i))&&a(r[0].name)},[r,i]);let s=(r?.length??0)>1,d=r!==void 0&&r.length===0,f=l(o.compat.forInstance,i?{instanceName:i}:`skip`),m=i?G(f,`configDefaults`):`loading`,h=m===`loading`?null:m.blocked,_=(0,q.useMemo)(()=>s&&i?{instanceName:i}:{},[s,i]),v=(0,q.useRef)(0),b=(0,q.useCallback)(async()=>{let t=++v.current;n({status:`loading`});try{let r=Y(await e(_));if(v.current!==t)return;n({status:`done`,current:r})}catch{if(v.current!==t)return;n({status:`error`})}},[e,_]);(0,q.useEffect)(()=>{h===!1&&(s&&!i||b())},[b,h,s,i]);let x=t.status===`done`?t.current:null,C=(0,q.useMemo)(()=>J.map(e=>({id:e,label:B(e)})),[]),w=(0,q.useMemo)(()=>[{id:`fast`,label:T()},{id:`standard`,label:O()}],[]);return(0,X.jsxs)(`div`,{className:`oc-cdefaults`,children:[(0,X.jsx)(`p`,{className:`oc-admin__hint`,children:D()}),s&&i?(0,X.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,X.jsx)(`span`,{className:`oc-cdefaults__label`,children:u()}),(0,X.jsxs)(R,{value:i,onValueChange:e=>a(e),children:[(0,X.jsx)(I,{size:`sm`,"aria-label":u(),children:(0,X.jsx)(U,{})}),(0,X.jsx)(W,{children:(r??[]).map(e=>(0,X.jsx)(L,{value:e.name,children:e.name},e.name))})]})]}):null,d?(0,X.jsx)(`p`,{className:`oc-admin__hint`,role:`status`,children:g()}):m===`loading`?(0,X.jsx)(`p`,{className:`oc-admin__hint`,children:p()}):m.blocked?(0,X.jsxs)(`p`,{className:`oc-compat__blocked`,role:`status`,children:[(0,X.jsx)(F,{size:14,"aria-hidden":!0}),` `,K(m.gatewayVersion,m.provider)]}):t.status===`loading`?(0,X.jsx)(`p`,{className:`oc-admin__hint`,children:p()}):t.status===`error`?(0,X.jsxs)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:[A(),` `,(0,X.jsx)(P,{variant:`outline`,size:`sm`,onClick:()=>void b(),children:j()})]}):(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,X.jsx)(`span`,{className:`oc-cdefaults__label`,children:y()}),(0,X.jsx)(z,{options:C,value:x?.thinkingDefault??null,onChange:()=>{},disabled:!0}),(0,X.jsx)(`p`,{className:`oc-cdefaults__help`,children:S()})]}),(0,X.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,X.jsx)(`span`,{className:`oc-cdefaults__label`,children:k()}),(0,X.jsx)(z,{options:w,value:x===null||x.fastModeDefault===null?null:x.fastModeDefault?`fast`:`standard`,onChange:()=>{},disabled:!0}),(0,X.jsx)(`p`,{className:`oc-cdefaults__help`,children:E()})]}),(0,X.jsx)(`p`,{className:`oc-cdefaults__note`,children:c()})]}),(()=>{let e=r?.find(e=>e.name===(i??r[0]?.name));return e?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)($,{instance:e}),(0,X.jsx)(Q,{instance:e}),(0,X.jsx)(Z,{instance:e})]}):null})()]})}export{ee as ChatDefaultsTab};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$S as r,AC as i,BS as a,CC as o,DC as s,E as c,EC as l,FS as u,GS as d,Gr as f,HS as p,Hj as ee,IS as te,JS as m,KS as h,LS as g,MC as _,MS as ne,NS as re,OC as ie,PS as v,QS as y,RS as b,SC as x,TC as S,US as C,Ur as w,VS as T,Vj as E,WS as D,XS as O,YS as k,ZS as A,_C as j,aC as M,bC 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,jS as ae,kC as H,lC as U,mC as W,nC as G,oC as K,pC as q,qS as J,rC as oe,sC as se,tC as ce,uC as le,vC as ue,wC as de,xC as fe,yC as pe,zS as me}from"./dist-TE9n7zkZ.js";import{t as he}from"./button-DK1qmYDJ.js";import{U as ge,j as _e}from"./index-ctX_-fgr.js";import{t as Y}from"./DataTableShell-Cu3JqhO0.js";var X=t(e(),1),Z=n(),ve={altered_words:()=>_(),incorrect:()=>V(),incoherence:()=>i(),formatting:()=>H(),latency:()=>ie(),api_error:()=>s(),other:()=>l()},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:de()}):e===!1?(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-warn`,children:o()}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill`,children:`—`}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill`,children:S()})}function ye({data:e,closeReason:t}){let n=e.snapshot,r=E(c.feedback.respondToFeedback),[i,a]=(0,X.useState)(e.thread),[o,s]=(0,X.useState)(``),[l,u]=(0,X.useState)(!1);async function d(){let t=o.trim();if(!(!t||l)){u(!0);try{await r({feedbackId:e._id,text:t}),a(e=>[...e,{authorRole:`admin`,text:t,at:Date.now()}]),s(``)}finally{u(!1)}}}let p=[];try{p=n.contextJson?JSON.parse(n.contextJson):[]}catch{p=[]}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?` · ${x()}`:``,n.openclawModel?` · ${n.openclawModel}`:``,n.openclawRuntime?` (${n.openclawRuntime})`:``]})]}),e.comment?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:fe()}),(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:g()}),(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:N()}),i.length>0?(0,Z.jsx)(`div`,{className:`oc-fbadmin__thread`,children:i.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`?pe():e.authorRole===`agent`?e.authorLabel??f():ue()}),(0,Z.jsx)(`span`,{className:`oc-notif__msg-text`,children:e.text})]},t))}):(0,Z.jsx)(`p`,{className:`oc-fbadmin__meta`,children:j()}),(0,Z.jsx)(`textarea`,{className:`oc-feedback__textarea`,placeholder:R(),value:o,maxLength:2e3,rows:3,onChange:e=>s(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 d(),disabled:!o.trim()||l,children:l?z():W()})})]}),(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:q()}),(0,Z.jsx)(`pre`,{className:`oc-msg__source-pre`,children:n.messageText||L()})]}),n.clientInfo?.sourceWasOpen&&n.displayedText!==void 0?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:F()}),(0,Z.jsx)(`pre`,{className:`oc-msg__source-pre`,children:n.displayedText||L()})]}):null,n.promptText?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:le()}),(0,Z.jsx)(`pre`,{className:`oc-msg__source-pre`,children:n.promptText})]}):null,p.length>0?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:U({count:n.contextCount??p.length,truncated:n.contextTruncated?P():``})}),(0,Z.jsx)(`div`,{className:`oc-fbadmin__ctx`,children:p.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:se()}),(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:K()}),(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:M()}),(0,Z.jsxs)(`p`,{className:`oc-fbadmin__env`,children:[[n.clientInfo?.language,n.clientInfo?.timezone,n.clientInfo?.theme?B({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:[oe(),` `,n.clientInfo.plugins.join(`, `),(0,Z.jsxs)(`span`,{className:`oc-fbadmin__note`,children:[` `,G()]})]}):null,n.clientInfo?.userAgent?(0,Z.jsx)(`span`,{className:`oc-fbadmin__ua`,children:n.clientInfo.userAgent}):null]})]})]})}function be(){let e=ee(c.feedback.listForAdmin,{}),t=E(c.feedback.readSnapshot),n=E(c.feedback.deleteFeedback),i=ge(),[o,s]=(0,X.useState)(null),[l,f]=(0,X.useState)({});async function g(e){if(o===e._id){s(null);return}if(!l[e._id]){let n=await t({feedbackId:e._id});f(t=>({...t,[e._id]:n}))}s(e._id)}async function _(e){await i({title:re(),description:ne(),confirmLabel:ae(),destructive:!0})&&(await n({feedbackId:e._id}),o===e._id&&s(null))}return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`p`,{className:`oc-admin__hint`,children:[ce(),` `,(0,Z.jsx)(`strong`,{children:I()}),` `,r()]}),(0,Z.jsx)(Y,{title:y(),rows:e,emptyHint:A(),isExpanded:e=>o===e._id&&!!l[e._id],renderExpanded:e=>l[e._id]?(0,Z.jsx)(ye,{data:l[e._id],closeReason:e.userCloseReason}):null,columns:[{header:O(),cell:e=>_e(e.at),sort:e=>e.at},{header:k(),cell:e=>Q(e.category),sort:e=>Q(e.category)},{header:m(),cell:e=>e.messageRole===`user`?J():h(),sort:e=>e.messageRole},{header:d(),cell:e=>(e.reporterEmail||e.reporterName||`—`)+(e.impersonated&&e.realOperatorEmail?` ${D({operator:e.realOperatorEmail})}`:``),sort:e=>e.reporterEmail||e.reporterName||null},{header:C(),cell:e=>(0,Z.jsx)($,{matches:e.displayedMatchesStored,sourceWasOpen:e.sourceWasOpen}),sort:e=>e.displayedMatchesStored===!1?0:e.displayedMatchesStored===!0?1:2},{header:p(),cell:e=>e.hasComment?`✎`:`—`,sort:e=>+!!e.hasComment},{header:T(),cell:e=>e.userClosedAt==null?e.resolvedAt==null?e.answered?(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-ok`,children:a()}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill`,children:me()}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-ok`,title:e.resolvedBy??void 0,children:w()}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-closed`,children:b()}),sort:e=>e.userClosedAt==null?e.resolvedAt==null?+!!e.answered:2:3}],rowActions:e=>[{label:o===e._id?te():u(),onSelect:()=>void g(e)},{label:v(),onSelect:()=>void _(e),variant:`destructive`}]})]})}export{be as FeedbacksTab};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$A as r,BA as i,E as a,FA as ee,Fj as o,GA as te,HA as ne,Hj as s,IA as re,JA as ie,Jr as ae,KA as oe,LA as se,MA as ce,NA as le,Nj as ue,PA as de,QA as c,RA as fe,SE as pe,UA as me,VA as he,Vj as ge,WA as l,XA as u,YA as d,Yr as f,ZA as p,aj as _e,cj as ve,dj as ye,ej as m,fj as be,ij as xe,lj as h,nj as g,oj as Se,pj as _,qA as v,rj as y,sj as b,tj as x,uj as S,zA as C}from"./dist-TE9n7zkZ.js";import{t as w}from"./button-DK1qmYDJ.js";import{C as T,Ft as E,G as D,H as O,Ht as k,J as A,K as j,Q as Ce,S as M,Ut as N,X as we,Y as Te,Z as P,b as F,ct as I,it as L,jt as Ee,nt as De,p as Oe,q as ke,rt as Ae,st as je,w as R,x as z}from"./index-ctX_-fgr.js";import{a as Me,i as B,n as Ne,o as V,r as H,t as Pe}from"./table-EwCph6eW.js";var U=t(e(),1),W=n(),G=`all`;function K(e){switch(e){case`image`:return g();case`audio`:return x();case`video`:return m();case`pdf`:return r();case`document`:return c();case`archive`:return p();default:return u()}}function q(){let[e,t]=(0,U.useState)(G),[n,r]=(0,U.useState)(G),[c,u]=(0,U.useState)(G),[p,m]=(0,U.useState)(G),[g,x]=(0,U.useState)(!1),[q,J]=(0,U.useState)(null),Fe=ge(a.files.softDelete),Y=O();function Ie(){t(G),r(G),u(G),m(G)}async function Le(){let e=q;if(J(null),e)try{await Fe({fileId:e.id}),Y.success(C())}catch(e){Y.error(fe(),e)}}let X=s(a.files.listMine,{direction:e===G?void 0:e,chatId:n===G?void 0:n,instanceName:c===G?void 0:c,category:p===G?void 0:p,includeAutoGenerated:g||void 0}),Re=(0,U.useMemo)(()=>new Intl.DateTimeFormat(o(),{dateStyle:`medium`,timeStyle:`short`}),[]);if(X===void 0)return(0,W.jsx)(`p`,{className:`oc-admin__hint`,children:ue()});let{files:Z,facets:Q,truncated:ze,cap:Be}=X,$=e!==G||n!==G||c!==G||p!==G;return(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`p`,{className:`oc-admin__hint`,children:_()}),(0,W.jsxs)(`div`,{className:`oc-files__filters`,style:{display:`flex`,flexWrap:`wrap`,gap:8,margin:`12px 0`},children:[(0,W.jsxs)(F,{value:e,onValueChange:t,children:[(0,W.jsx)(T,{size:`sm`,"aria-label":be(),children:(0,W.jsx)(R,{})}),(0,W.jsxs)(z,{children:[(0,W.jsx)(M,{value:G,children:ye()}),(0,W.jsx)(M,{value:`inbound`,children:S()}),(0,W.jsx)(M,{value:`outbound`,children:h()})]})]}),(0,W.jsxs)(F,{value:n,onValueChange:r,children:[(0,W.jsx)(T,{size:`sm`,"aria-label":ve(),children:(0,W.jsx)(R,{})}),(0,W.jsxs)(z,{children:[(0,W.jsx)(M,{value:G,children:b()}),Q.chats.map(e=>(0,W.jsx)(M,{value:e.id,children:e.title},e.id))]})]}),Q.multiProvider?(0,W.jsxs)(F,{value:c,onValueChange:u,children:[(0,W.jsx)(T,{size:`sm`,"aria-label":Se(),children:(0,W.jsx)(R,{})}),(0,W.jsxs)(z,{children:[(0,W.jsx)(M,{value:G,children:_e()}),Q.instances.map(e=>(0,W.jsx)(M,{value:e,children:e},e))]})]}):null,(0,W.jsxs)(F,{value:p,onValueChange:m,children:[(0,W.jsx)(T,{size:`sm`,"aria-label":xe(),children:(0,W.jsx)(R,{})}),(0,W.jsxs)(z,{children:[(0,W.jsx)(M,{value:G,children:y()}),Q.categories.map(e=>(0,W.jsx)(M,{value:e,children:K(e)},e))]})]}),(0,W.jsxs)(`label`,{className:`oc-files__autogen`,children:[(0,W.jsx)(Oe,{checked:g,onCheckedChange:e=>x(e===!0),"aria-label":f()}),(0,W.jsx)(`span`,{children:f()})]}),$?(0,W.jsxs)(w,{variant:`ghost`,size:`sm`,onClick:Ie,style:{display:`inline-flex`,alignItems:`center`,gap:4,marginLeft:`auto`},children:[(0,W.jsx)(E,{size:14,"aria-hidden":!0}),ne()]}):null]}),Z.length===0?(0,W.jsx)(`p`,{className:`oc-admin__hint`,children:$?le():de()}):(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:d()}),(0,W.jsx)(B,{children:ie()}),(0,W.jsx)(B,{children:v()}),(0,W.jsx)(B,{children:oe()}),(0,W.jsx)(B,{children:te()}),(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)(I,{variant:`outline`,style:{marginLeft:6},children:ae()}):null]}),(0,W.jsx)(H,{title:e.mimeType,children:K(e.category)}),(0,W.jsx)(H,{children:(0,W.jsx)(I,{variant:`secondary`,children:e.direction===`inbound`?S():h()})}),(0,W.jsx)(H,{style:{maxWidth:220,overflow:`hidden`,textOverflow:`ellipsis`},title:e.chatTitle,children:e.chatTitle}),(0,W.jsx)(H,{className:`whitespace-nowrap text-muted-foreground`,children:Re.format(e.createdAt)}),(0,W.jsx)(H,{className:`text-right`,children:(0,W.jsxs)(De,{children:[(0,W.jsx)(je,{asChild:!0,children:(0,W.jsx)(w,{variant:`ghost`,size:`icon`,"aria-label":he(),children:(0,W.jsx)(k,{size:16})})}),(0,W.jsxs)(Ae,{align:`end`,children:[e.url?(0,W.jsx)(L,{asChild:!0,children:(0,W.jsxs)(`a`,{href:e.url,download:e.filename,target:`_blank`,rel:`noopener noreferrer`,children:[(0,W.jsx)(N,{size:14}),me()]})}):(0,W.jsxs)(L,{disabled:!0,children:[(0,W.jsx)(N,{size:14}),ee()]}),(0,W.jsxs)(L,{variant:`destructive`,onSelect:()=>J({id:e._id,filename:e.filename}),children:[(0,W.jsx)(Ee,{size:14}),i()]})]})]})})]},e._id))})]}),ze?(0,W.jsx)(`p`,{className:`oc-admin__hint`,style:{marginTop:8},children:ce({cap:Be})}):null]}),(0,W.jsx)(D,{open:q!==null,onOpenChange:e=>!e&&J(null),children:(0,W.jsxs)(A,{children:[(0,W.jsxs)(P,{children:[(0,W.jsx)(Ce,{children:se()}),(0,W.jsx)(Te,{children:re()})]}),(0,W.jsxs)(we,{children:[(0,W.jsx)(ke,{children:pe()}),(0,W.jsx)(j,{onClick:()=>void Le(),children:i()})]})]})})]})}export{q as FilesTab};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$l as r,Au as i,Bl as a,Bu as o,Cu as s,D as c,Du as l,E as u,Eu as d,Fl as f,Fu as p,Gl as m,Hj as h,Hl as g,Il as _,Iu as v,Jl as y,Kl as b,Ll as x,Lu as S,Ml as C,Mu as w,Nl as T,Nu as E,Ou as ee,Pl as D,Pu as O,Ql as k,Rl as A,Ru as te,Su as j,Tu as M,Ul as N,Vj as P,Vl as F,Vu as I,Wl as L,Xl as R,Yl as z,Zl as ne,_u as re,au as ie,bu as ae,cu as oe,du as se,eu as ce,fu as B,gu as le,hu as ue,iu as de,ju as fe,ku as pe,lu as me,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,zu as ke}from"./dist-TE9n7zkZ.js";import{t as Ae}from"./x-C-AIvdVt.js";import{i as V,n as H,r as je,t as Me}from"./tabs-oKL6bnDA.js";import{t as U}from"./button-DK1qmYDJ.js";import{C as Ne,H as W,Jt as Pe,Mt as G,Nt as K,S as Fe,U as Ie,b as Le,ct as q,dt as Re,ft as ze,ht as Be,lt as J,mt as Ve,p as Y,qt as He,u as Ue,ut as We,w as Ge,x as Ke,xt as qe}from"./index-ctX_-fgr.js";import{t as Je}from"./FilterBar-BIebILEF.js";import{t as Ye}from"./DataTableShell-Cu3JqhO0.js";import{t as X}from"./DetailChips-DsU6cc30.js";var Xe=c(`palette`,[[`path`,{d:`M12 22a1 1 0 0 1 0-20 10 9 0 0 1 10 9 5 5 0 0 1-5 5h-2.25a1.75 1.75 0 0 0-1.4 2.8l.3.4a1.75 1.75 0 0 1-1.4 2.8z`,key:`e79jfc`}],[`circle`,{cx:`13.5`,cy:`6.5`,r:`.5`,fill:`currentColor`,key:`1okk4w`}],[`circle`,{cx:`17.5`,cy:`10.5`,r:`.5`,fill:`currentColor`,key:`f64h9f`}],[`circle`,{cx:`6.5`,cy:`12.5`,r:`.5`,fill:`currentColor`,key:`qy21gx`}],[`circle`,{cx:`8.5`,cy:`7.5`,r:`.5`,fill:`currentColor`,key:`fotxhn`}]]),Z=c(`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=c(`users`,[[`path`,{d:`M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2`,key:`1yyitq`}],[`path`,{d:`M16 3.128a4 4 0 0 1 0 7.744`,key:`16gr8j`}],[`path`,{d:`M22 21v-2a4 4 0 0 0-3-3.87`,key:`kshegd`}],[`circle`,{cx:`9`,cy:`7`,r:`4`,key:`nufk8`}]]),Q=t(e(),1);function Qe(e,t,n){let r=t.trim().toLowerCase();return[...r?e.filter(e=>[e.email,e.name,e.canonical].some(e=>e!=null&&e.toLowerCase().includes(r))):e.slice()].sort((e,t)=>!n.has(e.userId)-+!n.has(t.userId))}function $e(e,t){let n=e.filter(e=>e.source===`discovered`),r=t.trim().toLowerCase();return r?n.filter(e=>(e.displayName??e.agentId).toLowerCase().includes(r)||e.agentId.toLowerCase().includes(r)):n}function et(e){let t=e.name?.trim()??``,n=e.email?.trim()??``,r=e.canonical?.trim()||`u-${e.userId.slice(0,8)}`;return t?{primary:t,secondary:n||`@${r}`}:n?{primary:n,secondary:null}:{primary:`@${r}`,secondary:null}}function tt(e){switch(e){case`admin`:return oe();case`user`:return xe();case`pending`:return _e();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=h(u.groups.listGroups,{}),t=h(u.me.getMe,{host:qe})?.role===`admin`,n=P(u.groups.createGroup),r=P(u.groups.updateGroup),a=P(u.groups.deleteGroup),c=Ie(),m=W(),[g,_]=(0,Q.useState)(!1),[y,b]=(0,Q.useState)(null),[x,C]=(0,Q.useState)(it),[T,k]=(0,Q.useState)(null),[A,N]=(0,Q.useState)(``),F=(0,Q.useMemo)(()=>{if(!e)return e;let t=A.trim().toLowerCase();return t?e.filter(e=>e.name.toLowerCase().includes(t)||(e.description??``).toLowerCase().includes(t)||e.members.some(e=>e.label.toLowerCase().includes(t))||e.agents.some(e=>e.toLowerCase().includes(t))||e.charts.some(e=>e.name.toLowerCase().includes(t))):e},[e,A]);function L(){b(null),C(it),_(!0)}function R(e){b(e),C({name:e.name,description:e.description??``}),_(!0)}async function z(){try{y?await r({groupId:y._id,name:x.name,description:x.description}):await n({name:x.name,description:x.description||void 0}),C(it),b(null),_(!1)}catch(e){m.error(f(),e)}}async function ne(e){if(await c({title:j({name:e.name}),description:Ee(),confirmWord:e.name,confirmLabel:ae(),cancelLabel:ee(),destructive:!0}))try{await a({groupId:e._id})}catch(e){m.error(D(),e)}}return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`p`,{className:`oc-admin__hint`,children:o()}),(0,$.jsx)(Je,{q:A,onQChange:N,onReset:()=>N(``),canReset:A!==``,searchPlaceholder:E()}),(0,$.jsx)(Ye,{title:I(),rows:F,addLabel:ke(),onAdd:t?L:void 0,emptyHint:te(),columns:[{header:S(),cell:e=>e.name,sort:e=>e.name},{header:v(),cell:e=>(0,$.jsx)(X,{icon:(0,$.jsx)(Ze,{size:12,"aria-hidden":!0}),total:e.memberCount,items:e.members.map(e=>({label:e.label,marker:e.manager?(0,$.jsx)(Z,{size:11,"aria-hidden":!0}):null,highlight:e.manager}))}),sort:e=>e.memberCount},{header:p(),cell:e=>(0,$.jsx)(X,{icon:(0,$.jsx)(K,{size:12,"aria-hidden":!0}),total:e.agentCount,items:e.agents.map(e=>({label:e}))}),sort:e=>e.agentCount},{header:O(),cell:e=>(0,$.jsx)(X,{icon:(0,$.jsx)(Xe,{size:12,"aria-hidden":!0}),total:e.chartCount,items:e.charts.map(e=>({label:e.name,marker:e.isDefault?(0,$.jsx)(G,{size:11,fill:`currentColor`,"aria-hidden":!0}):null,highlight:e.isDefault}))}),sort:e=>e.chartCount}],rowActions:e=>[{label:w(),onSelect:()=>k({groupId:e._id,name:e.name})},...t?[{label:fe(),onSelect:()=>R(e)},{label:i(),variant:`destructive`,onSelect:()=>void ne(e)}]:[]]}),(0,$.jsx)(Ue,{open:g,onOpenChange:_,title:y?d():l(),description:M(),canSubmit:!!x.name.trim(),onSubmit:z,submitLabel:pe(),children:(0,$.jsxs)(`div`,{className:`oc-form`,children:[(0,$.jsxs)(`label`,{className:`oc-field`,children:[(0,$.jsx)(`span`,{className:`oc-field__label`,children:Te()}),(0,$.jsx)(J,{value:x.name,onChange:e=>C({...x,name:e.target.value})})]}),(0,$.jsxs)(`label`,{className:`oc-field`,children:[(0,$.jsx)(`span`,{className:`oc-field__label`,children:s()}),(0,$.jsx)(J,{value:x.description,onChange:e=>C({...x,description:e.target.value})})]})]})}),(0,$.jsx)(ct,{groupId:T?.groupId??null,groupName:T?.name??``,open:T!==null,onOpenChange:e=>{e||k(null)}})]})}var ot=8;function st({page:e,pageCount:t,onPage:n}){return t<=1?null:(0,$.jsxs)(`div`,{className:`oc-access__pager`,children:[(0,$.jsxs)(U,{type:`button`,variant:`ghost`,size:`sm`,disabled:e<=1,onClick:()=>n(e-1),children:[(0,$.jsx)(Pe,{size:14,"aria-hidden":!0}),se()]}),(0,$.jsxs)(`span`,{className:`oc-access__pageinfo`,"aria-label":me({page:e,pages:t}),children:[e,` / `,t]}),(0,$.jsxs)(U,{type:`button`,variant:`ghost`,size:`sm`,disabled:e>=t,onClick:()=>n(e+1),children:[Ce(),(0,$.jsx)(He,{size:14,"aria-hidden":!0})]})]})}function ct({groupId:e,groupName:t,open:n,onOpenChange:r}){let i=h(u.groups.getGroup,n&&e?{groupId:e}:`skip`),o=h(u.groups.listAssignableInstances,n?{}:`skip`),s=h(u.groups.listAssignableUsers,n?{}:`skip`),c=P(u.groups.addMember),l=P(u.groups.removeMember),d=P(u.groups.bulkSetMembers),f=P(u.groups.setGroupManager),p=W(),[m,g]=(0,Q.useState)(``),[_,v]=(0,Q.useState)(``),[b,S]=(0,Q.useState)(`members`),[C,w]=(0,Q.useState)(1),[E,ee]=(0,Q.useState)(new Set),D=(0,Q.useRef)(null),O=(0,Q.useMemo)(()=>new Set((i?.members??[]).map(e=>e.userId)),[i]),k=(0,Q.useMemo)(()=>new Set((i?.members??[]).filter(e=>e.manager).map(e=>e.userId)),[i]),te=i?.viewerIsAdmin===!0,j=(0,Q.useMemo)(()=>new Set((i?.agents??[]).map(e=>`${e.instanceName}/${e.agentId}`)),[i]);(0,Q.useEffect)(()=>{g(``),v(``),S(`members`),w(1),D.current=null},[n,e]),(0,Q.useEffect)(()=>{w(1)},[m]),(0,Q.useEffect)(()=>{n&&i&&e&&D.current!==e&&(D.current=e,ee(new Set((i.members??[]).map(e=>e.userId))))},[n,i,e]);let M=(0,Q.useMemo)(()=>s?Qe(s,m,E):[],[s,m,E]);async function N(t,n){if(e)try{n?await l({groupId:e,userId:t}):await c({groupId:e,userId:t})}catch(e){p.error(T(),e)}}async function F(t,n){if(e)try{await f({groupId:e,userId:t,manager:!n})}catch(e){p.error(x(),e)}}let I=nt(M,e=>O.has(e.userId)),L=M.filter(e=>O.has(e.userId)).length,R=rt(M,C,ot);async function z(){if(!e||M.length===0)return;let t=M.map(e=>e.userId);try{await d({groupId:e,userIds:t,member:I!==`all`})}catch(e){p.error(T(),e)}}return(0,$.jsx)(We,{open:n,onOpenChange:r,children:(0,$.jsxs)(Re,{className:`oc-access`,children:[(0,$.jsxs)(Ve,{children:[(0,$.jsx)(Be,{children:De({name:t})}),(0,$.jsx)(ze,{children:we()})]}),(0,$.jsxs)(Me,{value:b,onValueChange:S,className:`oc-access__tabs`,children:[(0,$.jsxs)(je,{className:`w-full`,children:[(0,$.jsxs)(V,{value:`members`,className:`flex-1 gap-1.5`,children:[(0,$.jsx)(Ze,{size:13,"aria-hidden":!0}),re(),i?(0,$.jsx)(q,{variant:`secondary`,className:`oc-access__tabcount`,children:O.size}):null]}),(0,$.jsxs)(V,{value:`agents`,className:`flex-1 gap-1.5`,children:[(0,$.jsx)(K,{size:13,"aria-hidden":!0}),ue(),i?(0,$.jsx)(q,{variant:`secondary`,className:`oc-access__tabcount`,children:j.size}):null]}),(0,$.jsxs)(V,{value:`charts`,className:`flex-1 gap-1.5`,children:[(0,$.jsx)(Xe,{size:13,"aria-hidden":!0}),y(),i?(0,$.jsx)(q,{variant:`secondary`,className:`oc-access__tabcount`,children:i.chartCount}):null]})]}),(0,$.jsx)(H,{value:`members`,children:s===void 0||i===void 0?(0,$.jsx)(`p`,{className:`oc-access__hint`,children:be()}):s.length===0?(0,$.jsx)(`p`,{className:`oc-access__hint`,children:Se()}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(J,{value:m,onChange:e=>g(e.target.value),placeholder:le(),className:`oc-access__search`}),M.length===0?(0,$.jsx)(`p`,{className:`oc-access__hint`,children:ve()}):(0,$.jsxs)($.Fragment,{children:[M.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 z(),"aria-label":B()}),(0,$.jsx)(`span`,{className:`oc-access__label`,children:B()}),(0,$.jsxs)(q,{variant:`outline`,className:`oc-access__count`,children:[L,` / `,M.length]})]}):null,(0,$.jsx)(`div`,{className:`oc-access__list`,children:R.pageItems.map(e=>{let t=O.has(e.userId),n=et(e),r=k.has(e.userId);return(0,$.jsxs)(`div`,{className:`oc-access__row`,children:[(0,$.jsx)(Y,{checked:t,onCheckedChange:()=>void N(e.userId,t),"aria-label":ie({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)(q,{variant:`outline`,className:`oc-access__role`,children:tt(e.role)}),(0,$.jsx)(`span`,{className:`oc-access__mgrslot`,children:t&&te?(0,$.jsx)(U,{type:`button`,variant:`ghost`,size:`icon`,className:`shrink-0 oc-access__mgr${r?` oc-access__mgr--on`:``}`,"aria-pressed":r,"aria-label":r?A():Oe(),title:r?A():Oe(),onClick:()=>void F(e.userId,r),children:(0,$.jsx)(Z,{size:15,"aria-hidden":!0})}):t&&r?(0,$.jsx)(`span`,{className:`oc-access__mgr oc-access__mgr--on`,role:`img`,"aria-label":a(),title:a(),children:(0,$.jsx)(Z,{size:15,"aria-hidden":!0})}):null})]},e._id)})}),(0,$.jsx)(st,{page:R.page,pageCount:R.pageCount,onPage:w})]})]})}),(0,$.jsx)(H,{value:`agents`,children:o===void 0?(0,$.jsx)(`p`,{className:`oc-access__hint`,children:be()}):o.length===0?(0,$.jsx)(`p`,{className:`oc-access__hint`,children:ce()}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(J,{value:_,onChange:e=>v(e.target.value),placeholder:he(),className:`oc-access__search`}),(0,$.jsx)(`div`,{className:`oc-access__list`,children:o.map(t=>(0,$.jsx)(lt,{groupId:e,instanceName:t.name,kind:t.kind??`openclaw`,assigned:j,query:_},`${e}-${t._id}`))})]})}),(0,$.jsx)(H,{value:`charts`,children:(0,$.jsx)(ut,{groupId:e})})]})]})})}function lt({groupId:e,instanceName:t,kind:n,assigned:i,query:a}){let o=h(u.groups.listAssignableAgents,{instanceName:t}),s=P(u.groups.assignAgentToGroup),c=P(u.groups.removeAgentFromGroup),l=P(u.groups.bulkSetGroupAgents),d=W(),[f,p]=(0,Q.useState)(1);if((0,Q.useEffect)(()=>{p(1)},[a]),!e)return null;let m=$e(o?.agents??[],a),g=o?.discovery&&!o.discovery.lastPollOk;if(a.trim()&&m.length===0)return null;let _=m.filter(e=>e.presentInLastOk!==!1&&e.enabled!==!1),v=nt(_,e=>i.has(`${t}/${e.agentId}`)),y=rt(m,f,ot);async function b(n,r){try{r?await c({groupId:e,instanceName:t,agentId:n}):await s({groupId:e,instanceName:t,agentId:n})}catch(e){d.error(C(),e)}}async function x(){if(_.length===0)return;let n=_.map(e=>e.agentId);try{await l({groupId:e,instanceName:t,agentIds:n,assigned:v!==`all`})}catch(e){d.error(C(),e)}}return(0,$.jsxs)(`div`,{className:`oc-access__group`,children:[(0,$.jsxs)(`div`,{className:`oc-access__instance`,children:[(0,$.jsx)(K,{size:13,"aria-hidden":!0}),(0,$.jsx)(`span`,{children:t}),(0,$.jsx)(q,{variant:`outline`,className:`oc-access__kind`,children:n}),g?(0,$.jsx)(q,{variant:`outline`,className:`oc-access__stale`,children:ne()}):null]}),o===void 0?(0,$.jsx)(`p`,{className:`oc-access__hint`,children:ge()}):m.length===0?(0,$.jsx)(`p`,{className:`oc-access__hint`,children:g?k():r()}):(0,$.jsxs)($.Fragment,{children:[_.length>1?(0,$.jsxs)(`div`,{className:`oc-access__row oc-access__selectall`,children:[(0,$.jsx)(Y,{checked:v===`all`?!0:v===`some`?`indeterminate`:!1,onCheckedChange:()=>void x(),"aria-label":B()}),(0,$.jsx)(`span`,{className:`oc-access__label`,children:B()})]}):null,y.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 b(e.agentId,r),"aria-label":de({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":z(),title:z(),children:(0,$.jsx)(G,{size:14,fill:`currentColor`})}):null,a?(0,$.jsx)(q,{variant:`outline`,className:`oc-access__gone`,children:R()}):null]},e.agentId)}),(0,$.jsx)(st,{page:y.page,pageCount:y.pageCount,onPage:p})]})]})}function ut({groupId:e}){let t=h(u.charts.listGroupChartSelection,e?{groupId:e}:`skip`),n=P(u.charts.assignChartToGroup),r=P(u.charts.removeChartFromGroup),i=P(u.charts.setGroupDefaultChart),a=P(u.charts.addChartToGroupPool),o=P(u.charts.removeChartFromGroupPool),s=W();if(!e)return null;if(t===void 0)return(0,$.jsx)(`p`,{className:`oc-access__hint`,children:be()});let{pool:c,addable:l,canManagePool:d}=t;if(c.length===0&&!d)return(0,$.jsx)(`p`,{className:`oc-access__hint`,children:ye()});async function f(t,i){try{i?await r({groupId:e,chartKey:t}):await n({groupId:e,chartKey:t})}catch(e){s.error(_(),e)}}async function p(t){try{await i({groupId:e,chartKey:t})}catch(e){s.error(_(),e)}}async function v(t){try{await a({groupId:e,chartKey:t})}catch(e){s.error(_(),e)}}async function y(t){try{await o({groupId:e,chartKey:t})}catch(e){s.error(_(),e)}}return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`div`,{className:`oc-access__list`,children:c.map(e=>(0,$.jsxs)(`div`,{className:`oc-access__row`,children:[(0,$.jsx)(Y,{checked:e.selected,onCheckedChange:()=>void f(e.chartKey,e.selected),"aria-label":N({name:e.name})}),(0,$.jsx)(`span`,{className:`oc-access__label`,title:e.name,children:e.name}),e.selected?e.isDefault?(0,$.jsx)(`span`,{className:`oc-access__fav`,role:`img`,"aria-label":g(),title:g(),children:(0,$.jsx)(G,{size:14,fill:`currentColor`})}):(0,$.jsx)(U,{type:`button`,variant:`ghost`,size:`sm`,onClick:()=>void p(e.chartKey),children:F()}):null,d?(0,$.jsx)(U,{type:`button`,variant:`ghost`,size:`sm`,"aria-label":L({name:e.name}),title:L({name:e.name}),onClick:()=>void y(e.chartKey),children:(0,$.jsx)(Ae,{size:14,"aria-hidden":!0})}):null]},e.chartKey))}),d?l.length>0?(0,$.jsxs)(Le,{value:``,onValueChange:e=>void v(e),children:[(0,$.jsx)(Ne,{size:`sm`,className:`oc-access__search`,children:(0,$.jsx)(Ge,{placeholder:m()})}),(0,$.jsx)(Ke,{children:l.map(e=>(0,$.jsx)(Fe,{value:e.chartKey,children:e.name},e.chartKey))})]}):c.length===0?(0,$.jsx)(`p`,{className:`oc-access__hint`,children:b()}):null:null]})}export{at as GroupsTab};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$b as r,$x as i,Ab as a,Ax as o,Bb as s,Bx as c,Cb as l,Cx as u,Db as d,Dx as f,E as p,Eb as m,Ex as h,Fb as g,Fx as _,Gb as v,Gx as y,Hb as b,Hj as x,Hx as ee,Ib as S,Ix as te,Jb as C,Ji as w,Jt as ne,Jx as re,Kb as T,Kx as ie,Lb as ae,Lx as oe,Mb as se,Mx as ce,Nb as le,Nx as ue,Ob as de,Ox as fe,Pb as pe,Px as me,Qb as he,Qx as ge,Rb as E,Rx as _e,Sb as ve,Sx as ye,Tb as be,Tx as xe,Ub as D,Ux as O,Vb as k,Vj as A,Vx as Se,Wb as Ce,Wx as we,Xb as Te,Xi as Ee,Xt as De,Xx as Oe,Yb as ke,Yi as Ae,Yt as je,Yx as Me,Zb as Ne,Zi as Pe,Zx as Fe,_b as Ie,_x as Le,ax as Re,bb as ze,bx as j,cx as Be,dx as Ve,eS as He,ex as Ue,fg as We,fx as Ge,gx as Ke,hD as M,hx as qe,ix as Je,jb as Ye,jx as Xe,kb as Ze,kx as Qe,lx as $e,mD as et,mx as tt,nS as nt,nx as rt,ox as it,pg as at,px as ot,qb as st,qx as ct,rS as lt,rx as ut,sx as dt,tS as ft,tx as pt,ux as mt,vb as ht,vx as gt,wb as _t,wx as vt,xb as yt,xx as bt,yb as xt,yx as St,zb as Ct,zj as N,zx as wt}from"./dist-TE9n7zkZ.js";import{a as Tt,c as Et}from"./FieldLabel-CK9i2-CR.js";import{t as P}from"./button-DK1qmYDJ.js";import{$ as Dt,C as F,H as I,S as L,U as Ot,b as R,ct as z,dt as B,et as kt,ft as V,ht as H,lt as U,mt as W,p as G,tt as At,u as jt,ut as K,w as q,x as J}from"./index-ctX_-fgr.js";import{t as Mt}from"./DataTableShell-Cu3JqhO0.js";import{InstanceConfigDialog as Nt}from"./BridgeTab-RQWxNBYu.js";var Y=t(e(),1),X=[`conversational`,`documentary`,`summarizer`,`curator`],Pt=new Set(X),Ft=`conversational`;function It(e){let t=new Set((e??[]).filter(e=>Pt.has(e)));return t.size===0?[Ft]:X.filter(e=>t.has(e))}var Z=n(),Q={name:``,gatewayUrl:``,bridgeUrl:``,displayName:``,kind:`openclaw`,transport:`ws`,gatewayVersion:``,gatewayHttpUrl:``,streamTransport:Tt},Lt={openclaw:[`token`,`deviceIdentity`],hermes:[`apiKey`]};function Rt(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 zt(){let e=x(p.admin.listInstances,{}),t=x(p.agents.listAllInstanceAgents,{}),n=A(p.admin.upsertInstance),r=A(p.admin.deleteInstance),a=I(),[s,l]=(0,Y.useState)(!1),[u,d]=(0,Y.useState)(Q),[m,g]=(0,Y.useState)(null),[v,b]=(0,Y.useState)(null),[S,C]=(0,Y.useState)(null),[w,T]=(0,Y.useState)(null);async function ae(){try{await n({instanceId:w??void 0,name:u.name,gatewayUrl:u.gatewayUrl,bridgeUrl:u.bridgeUrl||void 0,displayName:u.displayName||void 0,kind:u.kind,transport:u.kind===`hermes`?u.transport:void 0,gatewayVersion:u.gatewayVersion||void 0,gatewayHttpUrl:u.gatewayHttpUrl||void 0,streamTransport:u.streamTransport}),d(Q),T(null),l(!1)}catch(e){a.error(ft(),e)}}return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`p`,{className:`oc-admin__hint`,children:[He(),(0,Z.jsx)(`strong`,{children:i()}),ge()]}),(0,Z.jsx)(Mt,{title:Fe(),rows:e,addLabel:Oe(),onAdd:()=>{T(null),d(Q),l(!0)},emptyHint:Me(),columns:[{header:re(),cell:e=>e.name,sort:e=>e.name},{header:ct(),cell:e=>(0,Z.jsx)(z,{variant:`outline`,children:e.kind??`openclaw`}),sort:e=>e.kind??`openclaw`},{header:ie(),cell:e=>e.gatewayUrl,sort:e=>e.gatewayUrl},{header:y(),cell:e=>e.displayName??`—`,sort:e=>e.displayName??null},{header:lt(),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)(z,{variant:r(e.agentId)?`default`:`outline`,title:r(e.agentId)?ht():void 0,children:[e.emoji?`${e.emoji} `:``,e.displayName??e.agentId]},e.agentId))})}}],rowActions:e=>[{label:Se(),onSelect:()=>{T(e._id),d(Rt(e)),l(!0)}},{label:nt(),onSelect:()=>g(e.name)},{label:h(),onSelect:()=>C(e)},{label:we(),onSelect:()=>b(e)},{label:O(),variant:`destructive`,onSelect:()=>void r({instanceId:e._id})}],bulkActions:[{label:O(),variant:`destructive`,onSelect:e=>e.forEach(e=>void r({instanceId:e}))}]}),(0,Z.jsx)(jt,{open:s,onOpenChange:l,title:w?c():ee(),description:_e(),canSubmit:!!(u.name&&u.gatewayUrl),onSubmit:ae,submitLabel:oe(),children:(0,Z.jsxs)(`div`,{className:`oc-form`,children:[(0,Z.jsxs)($,{label:te(),children:[(0,Z.jsx)(U,{value:u.name,disabled:w!==null,onChange:e=>d({...u,name:e.target.value})}),w?(0,Z.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:wt()}):null]}),(0,Z.jsx)($,{label:_(),children:(0,Z.jsxs)(R,{value:u.kind,onValueChange:e=>d({...u,kind:e}),children:[(0,Z.jsx)(F,{size:`sm`,className:`w-40`,children:(0,Z.jsx)(q,{})}),(0,Z.jsxs)(J,{children:[(0,Z.jsx)(L,{value:`openclaw`,children:`OpenClaw`}),(0,Z.jsx)(L,{value:`hermes`,children:`Hermes`})]})]})}),u.kind===`hermes`?(0,Z.jsx)($,{label:De(),children:(0,Z.jsxs)(R,{value:u.transport,onValueChange:e=>d({...u,transport:e}),children:[(0,Z.jsx)(F,{size:`sm`,className:`w-56`,children:(0,Z.jsx)(q,{})}),(0,Z.jsxs)(J,{children:[(0,Z.jsx)(L,{value:`ws`,children:je()}),(0,Z.jsx)(L,{value:`rest`,children:ne()})]})]})}):null,(0,Z.jsx)($,{label:me(),children:(0,Z.jsx)(U,{value:u.gatewayUrl,onChange:e=>d({...u,gatewayUrl:e.target.value})})}),(0,Z.jsx)($,{label:ue(),children:(0,Z.jsx)(U,{value:u.bridgeUrl,placeholder:ce(),onChange:e=>d({...u,bridgeUrl:e.target.value})})}),(0,Z.jsx)($,{label:Xe(),children:(0,Z.jsx)(U,{value:u.displayName,onChange:e=>d({...u,displayName:e.target.value})})}),(0,Z.jsxs)($,{label:at(),children:[(0,Z.jsxs)(R,{value:u.streamTransport,onValueChange:e=>d({...u,streamTransport:e}),children:[(0,Z.jsx)(F,{size:`sm`,className:`w-40`,children:(0,Z.jsx)(q,{})}),(0,Z.jsx)(J,{children:Et.map(e=>(0,Z.jsx)(L,{value:e,children:e},e))})]}),(0,Z.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:We()})]}),(0,Z.jsx)($,{label:o(),children:(0,Z.jsx)(U,{value:u.gatewayVersion,placeholder:Qe(),onChange:e=>d({...u,gatewayVersion:e.target.value})})}),(0,Z.jsx)($,{label:fe(),children:(0,Z.jsx)(U,{value:u.gatewayHttpUrl,placeholder:f(),onChange:e=>d({...u,gatewayHttpUrl:e.target.value})})})]})}),(0,Z.jsx)(Yt,{instanceName:m,open:m!==null,onOpenChange:e=>{e||g(null)}}),v?(0,Z.jsx)(Nt,{instance:v,onClose:()=>b(null)},v._id):null,S?(0,Z.jsx)(Bt,{instance:S,onClose:()=>C(null)},S._id):null]})}function Bt({instance:e,onClose:t}){let n=x(p.instanceSecrets.listInstanceSecretStatus,{}),r=Lt[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)(K,{open:!0,onOpenChange:e=>!e&&t(),children:(0,Z.jsxs)(B,{onOpenAutoFocus:e=>e.preventDefault(),children:[(0,Z.jsxs)(W,{children:[(0,Z.jsx)(H,{children:xe({instance:e.displayName??e.name})}),(0,Z.jsx)(V,{children:vt()})]}),(0,Z.jsx)(`div`,{className:`oc-form`,children:r.map(t=>(0,Z.jsx)(Ut,{instanceId:e._id,field:t,updatedAt:i[t]??null},t))}),(0,Z.jsx)(`div`,{className:`oc-bridgesecret`,children:(0,Z.jsx)(Ht,{instance:e})}),(0,Z.jsx)(Vt,{instance:e})]})})}function Vt({instance:e}){let t=N(p.instanceSync.forceInstanceSync),n=I(),[i,a]=(0,Y.useState)(!1);async function o(){if(!i){a(!0);try{switch((await t({instanceId:e._id})).status){case`synced`:n.success(Je());break;case`no_agents`:n.success(rt());break;case`no_bridge_url`:n.error(pt());break;case`deploy_misconfigured`:n.error(Ue());break;case`unauthorized`:n.error(he());break;case`not_served`:n.error(Ne());break;default:n.error(r());break}}catch(e){n.error(ut(),e)}finally{a(!1)}}}return(0,Z.jsxs)(`div`,{className:`oc-form`,children:[(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:Te()}),(0,Z.jsx)(`div`,{className:`flex items-center gap-2`,children:(0,Z.jsx)(P,{size:`sm`,variant:`outline`,onClick:()=>void o(),disabled:i,children:i?Re():it()})})]})}function Ht({instance:e}){let t=x(p.bridgeAuth.listBridgeAuthStatus,{}),n=N(p.bridgeAuth.mintBridgeSecret),r=A(p.bridgeAuth.revokeBridgeSecret),i=I(),[a,o]=(0,Y.useState)(!1),[s,c]=(0,Y.useState)(null),[l,u]=(0,Y.useState)(!1),d=(t??[]).find(t=>t.instanceId===e._id),f=d!==void 0;async function m(){if(!a){o(!0);try{c((await n({instanceId:e._id})).plaintext),u(!1)}catch(e){i.error(D(),e)}finally{o(!1)}}}async function h(){if(!a){o(!0);try{await r({instanceId:e._id}),c(null),i.success(Ce())}catch(e){i.error(D(),e)}finally{o(!1)}}}async function g(){if(s)try{await navigator.clipboard.writeText(s),u(!0)}catch{}}return(0,Z.jsxs)($,{label:ke(),children:[(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:C()}),(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Z.jsx)(z,{variant:f?`outline`:`secondary`,children:f?`${j()} · ${d.prefix}…${d.lastFour}`:St()}),(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(P,{size:`sm`,onClick:()=>void m(),disabled:a,children:f?T():st()}),f?(0,Z.jsx)(P,{size:`sm`,variant:`destructive`,onClick:()=>void h(),disabled:a,children:v()}):null]})]}),s?(0,Z.jsxs)(`div`,{className:`oc-bridgesecret__reveal`,children:[(0,Z.jsx)(`p`,{className:`oc-sa__minted-warning`,children:b()}),(0,Z.jsxs)(`div`,{className:`oc-sa__minted-box`,children:[(0,Z.jsx)(`code`,{className:`oc-sa__minted-plain`,children:s}),(0,Z.jsx)(P,{variant:`outline`,size:`sm`,onClick:()=>void g(),children:l?M():et()})]}),(0,Z.jsx)(P,{size:`sm`,variant:`ghost`,onClick:()=>{c(null),u(!1)},children:k()})]}):null]})}function Ut({instanceId:e,field:t,updatedAt:n}){let r=N(p.instanceSecrets.setInstanceSecret),i=A(p.instanceSecrets.clearInstanceSecret),a=N(p.deviceIdentity.generateDeviceIdentity),o=I(),[s,c]=(0,Y.useState)(``),[l,d]=(0,Y.useState)(!1),[f,m]=(0,Y.useState)(null),[h,g]=(0,Y.useState)(!1),_=n!==null,v=t===`deviceIdentity`,y=t===`token`?u():t===`deviceIdentity`?ye():bt();async function b(){if(!(!s.trim()||l)){d(!0);try{await r({instanceId:e,field:t,plaintext:s}),c(``),m(null),g(!1),o.success(tt())}catch(e){o.error(ot(),e)}finally{d(!1)}}}async function x(){if(!l){d(!0);try{await i({instanceId:e,field:t}),m(null),g(!1),o.success(Ge())}catch(e){o.error(ot(),e)}finally{d(!1)}}}async function ee(){if(!l){d(!0);try{m(await a({instanceId:e})),g(!1),o.success($e())}catch(e){o.error(dt(),e)}finally{d(!1)}}}let S=f?`openclaw devices approve ${f.id}`:``;async function te(){if(S)try{await navigator.clipboard.writeText(S),g(!0)}catch{}}return(0,Z.jsxs)($,{label:y,children:[v?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:mt()}):null,(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Z.jsx)(z,{variant:_?`outline`:`secondary`,children:_?j():St()}),(0,Z.jsx)(U,{type:`password`,autoComplete:`off`,className:`flex-1 min-w-32`,value:s,placeholder:_?Le():gt(),onChange:e=>c(e.target.value)}),(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(P,{size:`sm`,onClick:()=>void b(),disabled:l||s.trim().length===0,children:Ke()}),v?(0,Z.jsx)(P,{size:`sm`,variant:`outline`,onClick:()=>void ee(),disabled:l,children:Ve()}):null,_?(0,Z.jsx)(P,{size:`sm`,variant:`destructive`,onClick:()=>void x(),disabled:l,children:qe()}):null]})]}),f?(0,Z.jsxs)(`div`,{className:`oc-bridgesecret__reveal`,children:[(0,Z.jsx)(`p`,{className:`text-sm font-medium`,children:$e()}),(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:Be()}),(0,Z.jsxs)(`div`,{className:`oc-sa__minted-box`,children:[(0,Z.jsx)(`code`,{className:`oc-sa__minted-plain`,children:S}),(0,Z.jsx)(P,{variant:`outline`,size:`sm`,onClick:()=>void te(),children:h?M():et()})]}),(0,Z.jsx)(P,{size:`sm`,variant:`ghost`,onClick:()=>{m(null),g(!1)},children:k()})]}):null]})}var Wt={conversational:le,documentary:Ye,summarizer:Pe,curator:Ae},Gt={conversational:se,documentary:a,summarizer:Ee,curator:w},Kt=e=>(Wt[e]??(()=>e))(),qt=e=>(Gt[e]??(()=>``))();function Jt({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:ae()}),t.map(e=>(0,Z.jsx)(z,{variant:`secondary`,className:`oc-agenttype__chip`,title:qt(e),children:Kt(e)},e)),(0,Z.jsxs)(Dt,{children:[(0,Z.jsx)(At,{asChild:!0,children:(0,Z.jsx)(P,{type:`button`,variant:`outline`,size:`sm`,className:`h-7`,children:S()})}),(0,Z.jsxs)(kt,{align:`start`,className:`oc-agenttypes-pop`,children:[(0,Z.jsx)(`p`,{className:`oc-agenttypes-pop__title`,children:g()}),(0,Z.jsx)(`p`,{className:`oc-agenttypes-pop__hint`,children:pe()}),(0,Z.jsx)(`div`,{className:`oc-agenttypes-pop__list`,children:X.map(r=>{let i=`agtype-${e}-${r}`;return(0,Z.jsxs)(`div`,{className:`oc-agenttypes-pop__item`,children:[(0,Z.jsx)(G,{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:Kt(r)}),(0,Z.jsx)(`span`,{className:`oc-agenttypes-pop__desc`,children:qt(r)})]})]},r)})})]})]})]})}function Yt({instanceName:e,open:t,onOpenChange:n}){let r=x(p.agents.listAgentsForInstance,t&&e?{instanceName:e}:`skip`),i=A(p.agents.setAgentEnabled).withOptimisticUpdate((e,{instanceName:t,agentId:n,enabled:r})=>{let i=e.getQuery(p.agents.listAgentsForInstance,{instanceName:t});i&&e.setQuery(p.agents.listAgentsForInstance,{instanceName:t},{...i,agents:i.agents.map(e=>e.agentId===n?{...e,enabled:r}:e)})}),a=A(p.agents.setInstanceDefaultAgent).withOptimisticUpdate((e,{instanceName:t,agentId:n})=>{let r=e.getQuery(p.agents.listAgentsForInstance,{instanceName:t});r&&e.setQuery(p.agents.listAgentsForInstance,{instanceName:t},{...r,defaultAgentId:n})}),o=A(p.agents.setAgentTypes).withOptimisticUpdate((e,{instanceName:t,agentId:n,types:r})=>{let i=e.getQuery(p.agents.listAgentsForInstance,{instanceName:t});if(!i)return;let a=It(r);e.setQuery(p.agents.listAgentsForInstance,{instanceName:t},{...i,agents:i.agents.map(e=>e.agentId===n?{...e,types:a}:e)})}),c=A(p.agents.removeInstanceAgent),u=Ot(),f=I();async function h(t,n){if(e)try{await i({instanceName:e,agentId:t,enabled:n})}catch(e){f.error(E(),e)}}async function g(t){if(e)try{await a({instanceName:e,agentId:t})}catch(e){f.error(E(),e)}}async function _(t,n,r){if(!e)return;let i=r.includes(n)?r.filter(e=>e!==n):[...r,n];try{await o({instanceName:e,agentId:t,types:i})}catch(e){f.error(E(),e)}}async function v(t,n){if(e&&await u({title:d({name:n}),description:m(),confirmLabel:be(),destructive:!0}))try{await c({instanceName:e,agentId:t}),f.success(_t())}catch(e){f.error(E(),e)}}return(0,Z.jsx)(K,{open:t,onOpenChange:n,children:(0,Z.jsxs)(B,{className:`oc-access`,children:[(0,Z.jsxs)(W,{children:[(0,Z.jsx)(H,{children:s({name:e??``})}),(0,Z.jsx)(V,{children:Ct()})]}),r===void 0?(0,Z.jsx)(`p`,{className:`oc-access__hint`,children:l()}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`div`,{className:`oc-access__poll`,children:r.discovery===null?ve():r.discovery.lastPollOk?yt():ze({error:r.discovery.error??`?`})}),r.agents.length===0?(0,Z.jsx)(`p`,{className:`oc-access__hint`,children:xt()}):(0,Z.jsx)(`div`,{className:`oc-access__list`,children:r.agents.map(e=>{let t=e.presentInLastOk===!1,n=r.defaultAgentId===e.agentId,i=e.displayName??e.agentId,a=e.types??[];return(0,Z.jsxs)(`div`,{className:`oc-agentcard`+(e.enabled?``:` oc-agentcard--off`),children:[(0,Z.jsxs)(`div`,{className:`oc-agentcard__head`,children:[(0,Z.jsx)(G,{checked:e.enabled,disabled:t,"aria-label":i,onCheckedChange:t=>void h(e.agentId,t===!0)}),(0,Z.jsxs)(`span`,{className:`oc-agentcard__name`,title:i,children:[e.emoji?`${e.emoji} `:``,i]}),e.model?(0,Z.jsx)(`span`,{className:`oc-access__model`,children:e.model}):null,t?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(z,{variant:`outline`,className:`oc-access__gone`,children:Ie()}),(0,Z.jsx)(P,{size:`sm`,variant:`ghost`,className:`h-7 text-destructive`,onClick:()=>void v(e.agentId,i),children:de()})]}):n?(0,Z.jsx)(z,{variant:`default`,children:ht()}):(0,Z.jsx)(P,{size:`sm`,variant:`outline`,className:`h-7`,disabled:!e.enabled,onClick:()=>void g(e.agentId),children:Ze()})]}),e.enabled?(0,Z.jsx)(Jt,{agentId:e.agentId,types:a,onToggle:t=>void _(e.agentId,t,a)}):null]},e.agentId)})})]})]})})}function $({label:e,children:t}){return(0,Z.jsxs)(`label`,{className:`oc-field`,children:[(0,Z.jsx)(`span`,{className:`oc-field__label`,children:e}),t]})}export{zt as InstancesTab};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{BC as r,E as i,FC as a,GC as o,HC as s,Hj as c,IC as l,KC as u,LC as d,NC as f,PC as p,RC as m,UC as h,VC as g,Vj as _,WC as v,_o as y,do as b,fo as x,go as S,ho as C,mo as w,po as T,uo as E,vo as D,zC as O,zj as k}from"./dist-TE9n7zkZ.js";import{t as A}from"./button-DK1qmYDJ.js";import{ct as j,lt as M,p as N}from"./index-ctX_-fgr.js";var P=t(e(),1),F=n();function I(){let e=c(i.integrations.status.status,{}),t=_(i.admin.setIntegrationConfig),[n,b]=(0,P.useState)(null);if((0,P.useEffect)(()=>{e&&n===null&&b(e.config)},[e,n]),!e||!n)return(0,F.jsx)(`p`,{className:`oc-admin__hint`,children:u()});let x=n,C=(e,t,n)=>b({...x,[e]:{...x[e],[t]:n}}),w=(e,n)=>void t({[e]:n});return(0,F.jsxs)(F.Fragment,{children:[(0,F.jsxs)(`p`,{className:`oc-admin__hint`,children:[o(),` `,(0,F.jsx)(`strong`,{children:v()}),` `,h()]}),(0,F.jsxs)(L,{title:`Langfuse`,status:e.langfuse.configured?e.langfuse.enabled?(0,F.jsx)(j,{variant:`secondary`,children:s()}):(0,F.jsx)(j,{variant:`outline`,children:g()}):(0,F.jsx)(j,{variant:`outline`,children:r()}),note:O(),children:[(0,F.jsx)(R,{label:d(),children:(0,F.jsx)(M,{value:x.langfuse.host??``,placeholder:e.langfuse.effectiveHost,onChange:e=>C(`langfuse`,`host`,e.target.value),onBlur:()=>w(`langfuse`,{host:x.langfuse.host??``})})}),(0,F.jsx)(z,{label:f(),checked:x.langfuse.enabled??!0,onChange:e=>{C(`langfuse`,`enabled`,e),w(`langfuse`,{enabled:e})}})]}),(0,F.jsxs)(L,{title:`Opik`,status:e.opik.configured?e.opik.enabled?(0,F.jsx)(j,{variant:`secondary`,children:s()}):(0,F.jsx)(j,{variant:`outline`,children:g()}):(0,F.jsx)(j,{variant:`outline`,children:r()}),note:m(),children:[(0,F.jsx)(R,{label:l(),children:(0,F.jsx)(M,{value:x.opik.baseUrl??``,placeholder:e.opik.effectiveBaseUrl,onChange:e=>C(`opik`,`baseUrl`,e.target.value),onBlur:()=>w(`opik`,{baseUrl:x.opik.baseUrl??``})})}),(0,F.jsx)(R,{label:a(),children:(0,F.jsx)(M,{value:x.opik.workspace??``,placeholder:e.opik.effectiveWorkspace||p(),onChange:e=>C(`opik`,`workspace`,e.target.value),onBlur:()=>w(`opik`,{workspace:x.opik.workspace??``})})}),(0,F.jsx)(z,{label:f(),checked:x.opik.enabled??!0,onChange:e=>{C(`opik`,`enabled`,e),w(`opik`,{enabled:e})}})]}),(0,F.jsxs)(L,{title:`OpenTelemetry (OTLP)`,status:e.otlp.configured?e.otlp.enabled?(0,F.jsx)(j,{variant:`secondary`,children:s()}):(0,F.jsx)(j,{variant:`outline`,children:g()}):(0,F.jsx)(j,{variant:`outline`,children:D()}),note:y(),children:[(0,F.jsx)(R,{label:S(),children:(0,F.jsx)(M,{value:x.otlp.endpoint??``,placeholder:e.otlp.effectiveEndpoint||`https://otlp.example.com/v1/traces`,onChange:e=>C(`otlp`,`endpoint`,e.target.value),onBlur:()=>w(`otlp`,{endpoint:x.otlp.endpoint??``})})}),(0,F.jsx)(B,{headersSet:e.otlp.headersSet}),(0,F.jsx)(z,{label:f(),checked:x.otlp.enabled??!0,onChange:e=>{C(`otlp`,`enabled`,e),w(`otlp`,{enabled:e})}})]})]})}function L({title:e,status:t,note:n,children:r}){return(0,F.jsxs)(`section`,{className:`oc-int__section`,children:[(0,F.jsxs)(`div`,{className:`oc-int__section-head`,children:[(0,F.jsx)(`h3`,{className:`oc-uipa__h`,children:e}),t]}),n?(0,F.jsx)(`p`,{className:`oc-uipa__note`,children:n}):null,(0,F.jsx)(`div`,{className:`oc-int__fields`,children:r})]})}function R({label:e,children:t}){return(0,F.jsxs)(`label`,{className:`oc-int__field`,children:[(0,F.jsx)(`span`,{className:`oc-int__field-label`,children:e}),t]})}function z({label:e,checked:t,onChange:n}){return(0,F.jsxs)(`label`,{className:`oc-int__toggle`,children:[(0,F.jsx)(N,{checked:t,onCheckedChange:e=>n(e===!0)}),(0,F.jsx)(`span`,{children:e})]})}function B({headersSet:e}){let t=k(i.integrations.otlpSecret.setOtlpHeaders),n=_(i.integrations.otlpSecret.clearOtlpHeaders),[r,a]=(0,P.useState)(``),[o,s]=(0,P.useState)(null),[c,l]=(0,P.useState)(!1),u=async()=>{l(!0),s(null);try{await t({headersJson:r}),a(``)}catch(e){s(e instanceof Error?e.message:String(e))}finally{l(!1)}};return(0,F.jsxs)(R,{label:C(),children:[(0,F.jsx)(M,{value:r,placeholder:e?w():T(),onChange:e=>a(e.target.value)}),(0,F.jsxs)(`div`,{className:`oc-int__otlp-headers-actions`,children:[(0,F.jsx)(A,{size:`sm`,disabled:c||r.trim().length===0,onClick:()=>void u(),children:x()}),e?(0,F.jsx)(A,{variant:`ghost`,size:`sm`,disabled:c,onClick:()=>void n({}),children:b()}):null]}),o?(0,F.jsx)(`p`,{className:`oc-int__otlp-headers-error`,children:o}):null,(0,F.jsx)(`p`,{className:`oc-uipa__note`,children:E()})]})}export{I as IntegrationsTab};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$O as r,A as i,AO as a,BO as o,Cj as s,DO as c,E as l,F as u,FO as d,G as f,GO as p,HO as ee,Hj as m,I as te,IO as h,JO as ne,KO as re,L as ie,LO as ae,Lx as oe,M as se,MO as ce,N as le,NO as ue,Nj as de,OO as fe,Oj as pe,P as me,PO as g,QO as _,RO as v,Sj as y,Tj as b,UO as x,VO as S,Vj as C,WO as w,X as T,XO as E,YO as D,Z as O,ZO as k,_j as A,ak as j,bj as M,ek as N,gj as P,hj as F,ik as I,j as L,jO as R,kO as z,n as B,nk as he,ok as ge,qO as _e,rk as ve,sk as ye,tk as be,vj as xe,wj as Se,xj as Ce,yj as V,zO as we}from"./dist-TE9n7zkZ.js";import{t as H}from"./button-DK1qmYDJ.js";import{C as Te,H as Ee,N as De,S as U,b as Oe,bt as ke,ct as W,lt as G,p as K,vt as Ae,w as je,x as Me,xt as q,yt as Ne}from"./index-ctX_-fgr.js";import{t as Pe}from"./localePickerView-C2RmOS86.js";var J=t(e(),1),Y=n();function Fe({className:e,checked:t,onCheckedChange:n,disabled:r,...i}){return(0,Y.jsx)(`button`,{type:`button`,role:`switch`,"aria-checked":t,"data-state":t?`checked`:`unchecked`,disabled:r,onClick:()=>n(!t),className:B(`peer inline-flex h-5 w-9 shrink-0 items-center rounded-full border border-transparent transition-colors outline-none`,`focus-visible:ring-2 focus-visible:ring-ring/50`,`disabled:cursor-not-allowed disabled:opacity-50`,t?`bg-primary`:`bg-input`,e),...i,children:(0,Y.jsx)(`span`,{className:B(`pointer-events-none block size-4 rounded-full bg-background shadow transition-transform`,t?`translate-x-[18px]`:`translate-x-[2px]`)})})}var X=[{id:`messages`,label:()=>ye()},{id:`composer`,label:()=>ge()},{id:`sidebar`,label:()=>j()},{id:`other`,label:()=>I()}],Z={showSource:{category:`messages`,label:()=>ve(),help:()=>he()},showReport:{category:`messages`,label:()=>be(),help:()=>N()},copyAssistant:{category:`messages`,label:()=>r()},copyUser:{category:`messages`,label:()=>_()},showDelete:{category:`messages`,label:()=>k()},showTools:{category:`messages`,label:()=>E(),help:()=>D()},voiceInput:{category:`composer`,label:()=>ne(),help:()=>_e()},showUsage:{category:`composer`,label:()=>re(),help:()=>p()},autoReadAloud:{category:`composer`,label:()=>O(),help:()=>T()},showChatAge:{category:`sidebar`,label:()=>w(),help:()=>x()},showChatProvider:{category:`sidebar`,label:()=>ee(),help:()=>S()}};function Q(e){return e.toLowerCase().normalize(`NFD`).replace(/\p{Diacritic}/gu,``)}function Ie(e,t){let n=Q(t.trim()),r=new Map(X.map(e=>[e.id,e.label()])),i=new Map(X.map(e=>[e.id,[]]));for(let t of e){let e=Z[t],a=e?.category??`other`;n&&!Q(`${e?e.label():t} ${e?.help?e.help():``} ${t} ${r.get(a)??``}`).includes(n)||i.get(a).push(t)}return X.map(e=>({id:e.id,label:r.get(e.id),keys:i.get(e.id)})).filter(e=>e.keys.length>0)}var Le=[`showSource`,`showReport`,`copyAssistant`,`copyUser`,`showDelete`,`showTools`,`voiceInput`,`showChatAge`,`showChatProvider`,`showUsage`,`autoReadAloud`],Re={voiceInput:`voiceInput`};function ze(e){return Le.includes(e)}function $(e){return e===`admin`}function Be(e){return e===!0?`on`:e===!1?`off`:`inherit`}function Ve(e){return e===`on`?!0:e===`off`?!1:null}function He(e){return ze(e)?Re[e]:void 0}var Ue={voiceInput:()=>R()};function We({prefKey:e,ui:t}){let n=C(l.admin.setUiPrefDefault),r=C(l.admin.setFeatureEnabled),i=He(e),a=i?Ue[e]?.():void 0;return(0,Y.jsxs)(`div`,{className:`oc-prefs__gov`,children:[(0,Y.jsxs)(`div`,{className:`oc-prefs__gov-row`,children:[(0,Y.jsx)(`span`,{className:`oc-prefs__gov-label`,children:d()}),(0,Y.jsxs)(Oe,{value:Be(t.defaults[e]),onValueChange:t=>void n({key:e,value:Ve(t)}),children:[(0,Y.jsx)(Te,{size:`sm`,className:`w-36`,children:(0,Y.jsx)(je,{})}),(0,Y.jsxs)(Me,{children:[(0,Y.jsx)(U,{value:`on`,children:z()}),(0,Y.jsx)(U,{value:`off`,children:fe()}),(0,Y.jsx)(U,{value:`inherit`,children:c()})]})]}),i?(0,Y.jsxs)(`span`,{className:`oc-prefs__gov-gate`,children:[(0,Y.jsx)(K,{checked:t.featuresEnabled[i]===!0,onCheckedChange:e=>void r({key:i,enabled:e===!0}),"aria-label":g()}),g()]}):null]}),a?(0,Y.jsx)(`span`,{className:`oc-prefs__gov-help`,children:a}):null]})}function Ge({current:e,enabled:t}){let n=C(l.me.setDictationShortcut),[r,a]=(0,J.useState)(!1),[o,s]=(0,J.useState)(!1);return(0,J.useEffect)(()=>{if(!r)return;let e=e=>{if(e.preventDefault(),e.stopPropagation(),e.key===`Escape`){a(!1);return}let t=Ne(e);if(t===null){[`Shift`,`Control`,`Meta`,`Alt`].includes(e.key)||(s(!0),window.setTimeout(()=>s(!1),1800));return}a(!1),n({shortcut:t})};return window.addEventListener(`keydown`,e,!0),()=>window.removeEventListener(`keydown`,e,!0)},[r,n]),(0,Y.jsxs)(`div`,{className:`oc-prefs__row${t?``:` is-locked`}`,children:[(0,Y.jsxs)(`div`,{className:`oc-prefs__info`,children:[(0,Y.jsxs)(`span`,{className:`oc-prefs__label`,children:[ie(),e?(0,Y.jsx)(W,{variant:`secondary`,children:ke(e,Ae())}):null]}),(0,Y.jsx)(`span`,{className:`oc-prefs__help`,children:o?me():r?u():te()})]}),(0,Y.jsxs)(`div`,{className:`oc-prefs__ctl`,children:[e&&!r?(0,Y.jsx)(`button`,{type:`button`,className:`oc-prefs__reset`,onClick:()=>void n({shortcut:null}),children:i()}):null,(0,Y.jsx)(`button`,{type:`button`,className:`oc-prefs__reset`,disabled:!t,"aria-pressed":r,onClick:()=>a(e=>!e),children:r?L():e?se():le()})]})]})}function Ke(){let[e,t]=(0,J.useState)(``),[n,r]=(0,J.useState)(!1),i=m(l.me.getMe,{host:q}),s=i?.ui,c=$(i?.role)&&n,u=C(l.me.setUiPref).withOptimisticUpdate(De),d=(0,J.useMemo)(()=>s?Ie(Object.keys(s.effective),e):[],[s,e]);return s?(0,Y.jsxs)(`div`,{className:`oc-prefs-panel`,children:[$(i?.role)?(0,Y.jsxs)(`label`,{className:`oc-prefs__gov-toggle`,children:[(0,Y.jsx)(K,{checked:n,onCheckedChange:e=>r(e===!0),"aria-label":h()}),h()]}):null,c?(0,Y.jsxs)(`div`,{className:`oc-prefs__gov-head`,children:[(0,Y.jsx)(`p`,{children:ue()}),(0,Y.jsx)(`p`,{children:ce()}),(0,Y.jsx)(`p`,{children:a()})]}):null,(0,Y.jsx)(G,{value:e,onChange:e=>t(e.target.value),placeholder:o(),"aria-label":o(),className:`mb-2`}),d.length===0?(0,Y.jsx)(`div`,{className:`oc-prefs__empty`,children:we()}):(0,Y.jsx)(`div`,{className:`oc-prefs`,children:d.map(e=>(0,Y.jsxs)(`section`,{className:`oc-prefs__card`,children:[(0,Y.jsx)(`h4`,{className:`oc-prefs__cat`,children:e.label}),e.keys.map(e=>{let t=Z[e],n=t?t.label():e,r=t?.help?.(),i=s.locked[e],a=s.effective[e],o=s.userOverrides[e]!==void 0;return(0,Y.jsxs)(`div`,{className:`oc-prefs__row${i?` is-locked`:``}`,children:[(0,Y.jsxs)(`div`,{className:`oc-prefs__info`,children:[(0,Y.jsxs)(`span`,{className:`oc-prefs__label`,children:[n,i?(0,Y.jsx)(W,{variant:`outline`,children:v()}):o?(0,Y.jsx)(W,{variant:`secondary`,children:f()}):null]}),r?(0,Y.jsx)(`span`,{className:`oc-prefs__help`,children:r}):null]}),(0,Y.jsxs)(`div`,{className:`oc-prefs__ctl`,children:[!i&&o?(0,Y.jsx)(`button`,{type:`button`,className:`oc-prefs__reset`,onClick:()=>void u({key:e,value:null}),children:ae()}):null,(0,Y.jsx)(Fe,{checked:a,disabled:i,onCheckedChange:t=>void u({key:e,value:t}),"aria-label":n})]}),c?(0,Y.jsx)(We,{prefKey:e,ui:s}):null]},e)})]},e.id))}),(0,Y.jsx)(Ge,{current:i?.dictationShortcut??null,enabled:s.effective.voiceInput===!0})]}):(0,Y.jsx)(`div`,{className:`oc-prefs__empty`,children:de()})}function qe(){let e=m(l.me.getMe,{host:q}),t=C(l.me.setLocale),n=C(l.me.setMyName),r=Ee(),i=e?.locale??`default`,a=e?.name??``,[o,c]=(0,J.useState)(null),u=o??a,d=u.trim()!==a.trim();async function f(){try{await n({name:u}),c(null),r.success(Ce())}catch(e){r.error(M(),e)}}return(0,Y.jsxs)(`div`,{className:`oc-appearance`,children:[(0,Y.jsxs)(`section`,{className:`oc-show__section`,children:[(0,Y.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,Y.jsx)(`h2`,{className:`oc-show__title`,children:b()}),(0,Y.jsx)(`p`,{className:`oc-show__desc`,children:Se()})]}),(0,Y.jsxs)(`div`,{className:`oc-show__row`,children:[(0,Y.jsx)(G,{className:`max-w-xs`,value:u,maxLength:120,placeholder:s(),onChange:e=>c(e.target.value),onKeyDown:e=>{e.key===`Enter`&&d&&(e.preventDefault(),f())}}),(0,Y.jsx)(H,{size:`sm`,disabled:!d,onClick:()=>void f(),children:oe()})]}),(0,Y.jsx)(`p`,{className:`oc-show__desc`,children:y()})]}),(0,Y.jsxs)(`section`,{className:`oc-show__section`,children:[(0,Y.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,Y.jsx)(`h2`,{className:`oc-show__title`,children:V()}),(0,Y.jsx)(`p`,{className:`oc-show__desc`,children:xe()})]}),(0,Y.jsxs)(`div`,{className:`oc-show__row`,children:[Pe().map(e=>(0,Y.jsx)(H,{variant:i===e.value?`default`:`outline`,size:`sm`,onClick:()=>void t({locale:e.value}),children:e.label},e.value)),(0,Y.jsx)(H,{variant:i==="default"?`default`:`outline`,size:`sm`,onClick:()=>void t({locale:null}),children:pe()})]}),(0,Y.jsx)(`p`,{className:`oc-show__desc`,children:A()})]}),(0,Y.jsxs)(`section`,{className:`oc-show__section`,children:[(0,Y.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,Y.jsx)(`h2`,{className:`oc-show__title`,children:P()}),(0,Y.jsx)(`p`,{className:`oc-show__desc`,children:F()})]}),(0,Y.jsx)(Ke,{})]})]})}export{qe as PreferencesTab};
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$h as r,$i as i,$t as a,E as o,Gh as s,Hj as c,Jh as l,Kh as u,Qh as d,Qi as f,Qt as p,Vj as m,Wh as h,Xh as g,Yh as _,Zh as v,Zt as ee,_g as te,_r as y,ag as b,cg as ne,ea as x,eg as S,gg as C,gr as w,hr as T,ig as E,lg as re,mr as ie,na as ae,ng as D,og as O,pr as k,qh as A,rg as j,sg as M,ta as N,tg as P,vr as F}from"./dist-TE9n7zkZ.js";import{d as I,f as L,i as R,l as z,n as B,r as V,t as H,u as U}from"./FieldLabel-CK9i2-CR.js";import{t as W}from"./button-DK1qmYDJ.js";import{C as G,H as K,S as q,b as J,p as oe,w as Y,x as X,xt as se}from"./index-ctX_-fgr.js";import{r as Z,t as ce}from"./locales-CPjguROj.js";import{t as le}from"./localePickerView-C2RmOS86.js";/* empty css */var Q=t(e(),1),$=n(),ue={media_delivery:{label:E,help:j},documentary_fetch:{label:D,help:P},inbound_files:{label:S,help:r},history_summary:{label:ae,help:N},file_curation:{label:F,help:y}},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:s,files:h,previous_summary:x,new_messages:i,max_chars:f,file_name:w,budget_chars:T,feedback:ie,content:k};function pe(){let e=c(o.admin.listInstances,{}),[t,n]=(0,Q.useState)(null);if(e===void 0)return(0,$.jsx)(`div`,{className:`oc-settings__tab-loading`,"aria-busy":`true`});if(e.length===0)return(0,$.jsx)(`div`,{className:`oc-injtab`,children:(0,$.jsx)(`p`,{className:`oc-admin__hint`,children:v()})});let r=e.find(e=>e._id===t)??e[0];return(0,$.jsxs)(`div`,{className:`oc-injtab`,children:[(0,$.jsxs)(`div`,{className:`oc-injtab__head`,children:[(0,$.jsx)(B,{label:re(),help:ne()}),(0,$.jsxs)(`label`,{className:`oc-injtab__picker`,children:[(0,$.jsx)(`span`,{children:d()}),(0,$.jsxs)(J,{value:r._id,onValueChange:e=>n(e),children:[(0,$.jsx)(G,{size:`sm`,className:`min-w-44`,children:(0,$.jsx)(Y,{})}),(0,$.jsx)(X,{children:e.map(e=>(0,$.jsx)(q,{value:e._id,children:e.displayName??e.name},e._id))})]})]})]}),(0,$.jsx)(me,{instance:r},r._id)]})}function me({instance:e}){let t=m(o.admin.upsertInstanceConfig),n=K(),r=c(o.me.getMe,{host:se}),i=e.config??{},s=Z(e.config?.contentLocale,r?.defaultLocale??void 0),[l,u]=(0,Q.useState)(()=>R(i,s));(0,Q.useEffect)(()=>{u(R(i,s))},[s,e._id]);let[d,f]=(0,Q.useState)(!1),h=l.promptInjections,g=(e,t)=>u({...l,promptInjections:{...h,[e]:{...h[e],...t}}});async function _(){f(!0);try{await t({instanceId:e._id,config:V(l,i,s)})}catch(e){n.error(C(),e)}finally{f(!1)}}async function v(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(C(),e)}}let y=e.config?.contentLocale??`default`,b=ce[Z(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:a()}),(0,$.jsxs)(J,{value:y,onValueChange:e=>void v(e),children:[(0,$.jsx)(G,{size:`sm`,className:`min-w-44`,children:(0,$.jsx)(Y,{})}),(0,$.jsxs)(X,{children:[(0,$.jsx)(q,{value:`default`,children:ee({locale:b})}),le().map(e=>(0,$.jsx)(q,{value:e.value,children:e.label},e.value))]})]}),(0,$.jsx)(`p`,{className:`oc-admin__hint`,children:p()})]}),U.map(e=>(0,$.jsx)(he,{injKey:e,def:z[e],i18n:ue[e],row:h[e]??{enabled:!0,template:z[e].defaultTemplate[s]},contentLocale:s,onChange:t=>g(e,t)},e)),(0,$.jsx)(`div`,{className:`oc-injtab__actions`,children:(0,$.jsx)(W,{size:`sm`,onClick:()=>void _(),disabled:d,children:te()})})]})}function he({injKey:e,def:t,i18n:n,row:r,contentLocale:i,onChange:a}){let[o,s]=(0,Q.useState)(!1),c=r.template.trim()!==t.defaultTemplate[i],u=t.togglable&&!r.enabled,d=Object.fromEntries(t.placeholders.map(e=>[e,de[e]??`{${e}}`])),f=I(e,r,i),p=f?L(f,d):``;return(0,$.jsxs)(`section`,{className:`oc-injcard`,children:[(0,$.jsxs)(`div`,{className:`oc-injcard__head`,children:[t.togglable?(0,$.jsxs)(`label`,{className:`oc-field--row`,children:[(0,$.jsx)(oe,{checked:r.enabled,onCheckedChange:e=>a({enabled:e===!0})}),(0,$.jsx)(B,{label:n.label(),help:n.help()})]}):(0,$.jsx)(B,{label:n.label(),help:n.help()}),c&&(0,$.jsx)(`span`,{className:`oc-injection__badge`,children:O()})]}),(0,$.jsx)(`textarea`,{className:`oc-injcard__text`,value:r.template,disabled:u,rows:8,spellCheck:!1,onChange:e=>a({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:b()}),t.placeholders.map(e=>(0,$.jsxs)(`span`,{className:`oc-injcard__ph-chip`,children:[(0,$.jsx)(`code`,{children:`{${e}}`}),(0,$.jsx)(H,{text:(fe[e]??(()=>e))()})]},e))]}),(0,$.jsxs)(`div`,{className:`oc-injcard__btns`,children:[(0,$.jsx)(W,{variant:`ghost`,size:`sm`,onClick:()=>s(e=>!e),children:o?_():g()}),c&&(0,$.jsx)(W,{variant:`ghost`,size:`sm`,onClick:()=>a({template:t.defaultTemplate[i]}),children:M()})]})]}),o&&(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:l()})]}):(0,$.jsx)(`span`,{className:`oc-injection__ph`,children:A()})})]})}export{pe as PromptInjectionsTab};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$y as r,Ay as ee,By as i,Dy as a,E as o,Ey as s,Fy as c,Gy as l,Hj as te,Hr as u,Hy as d,Iy as f,Jy as p,Ky as m,Ly as h,My as g,Ny as ne,Oy as re,Py as ie,Qy as _,Ry as v,Uy as y,Vj as b,Vy as x,Wy as S,Xy as C,Yy as w,Zy as T,_y as E,by as D,eb as O,fy as k,gy as A,hy as j,jy as M,ky as N,my as P,py as F,qy as I,tb as L,vy as R,yy as ae,zy as z}from"./dist-TE9n7zkZ.js";import{t as B}from"./button-DK1qmYDJ.js";import{H as V,Rt as H,U,ct as W,lt as G,p as K,u as q}from"./index-ctX_-fgr.js";import{t as J}from"./roleDescriptions-CCsDWcXg.js";var Y=t(e(),1),X=n(),Z=[{group:()=>L(),keys:[{key:`traces.read`,label:()=>C()},{key:`traces.read.content`,label:()=>w(),phi:!0},{key:`traces.write`,label:()=>p()}]},{group:()=>O(),keys:[{key:`kpi.read`,label:()=>C()},{key:`kpi.write`,label:()=>p()}]},{group:()=>r(),keys:[{key:`openclaw.query`,label:()=>I()},{key:`anomalies.read`,label:()=>m()},{key:`anomalies.report`,label:()=>l()}]},{group:()=>_(),keys:[{key:`chats.read`,label:()=>C()},{key:`selfheal`,label:()=>y()},{key:`feedback.respond`,label:()=>u()}]},{group:()=>T(),keys:[{key:`admin.manage`,label:()=>S()}]}],oe=Z.flatMap(e=>e.keys.map(e=>e.key));function Q(e){return e.includes(`*`)}var $={key:``,name:``,description:``};function se(){let e=te(o.apiKeys.listRoles,{}),t=b(o.apiKeys.createRole),n=b(o.apiKeys.ensureRolesSeeded),r=b(o.apiKeys.updateRolePermissions).withOptimisticUpdate((e,{roleId:t,permissions:n})=>{let r=e.getQuery(o.apiKeys.listRoles,{});r&&e.setQuery(o.apiKeys.listRoles,{},r.map(e=>e._id===t?{...e,permissions:n}:e))}),l=U(),u=V(),[p,m]=(0,Y.useState)(!1),[_,y]=(0,Y.useState)($),[S,C]=(0,Y.useState)(new Set);(0,Y.useEffect)(()=>{n({}).catch(e=>{u.error(x(),e)})},[n,u]);let w=e??[];async function T(e,t){if(Q(e.permissions)||S.has(e._id))return;let n=e.permissions.includes(t)?e.permissions.filter(e=>e!==t):[...e.permissions,t];if(!(e.builtin&&!await l({title:i({name:e.name}),description:z(),confirmLabel:v()}))){C(t=>new Set(t).add(e._id));try{await r({roleId:e._id,permissions:n})}catch(e){u.error(h(),e)}finally{C(t=>{let n=new Set(t);return n.delete(e._id),n})}}}async function O(){try{await t({key:_.key,name:_.name,description:_.description||void 0,permissions:[]}),y($),m(!1)}catch(e){u.error(f(),e)}}let I=e===void 0,L=!I&&w.length===0;return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`p`,{className:`oc-admin__hint`,children:[c(),` `,(0,X.jsx)(`code`,{children:`admin`}),` `,ie(),` `,(0,X.jsx)(`code`,{children:`traces.read.content`}),` `,ne()]}),(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:g()}),(0,X.jsx)(`div`,{className:`oc-dt__bar-actions`,children:(0,X.jsx)(B,{size:`sm`,onClick:()=>{y($),m(!0)},children:M()})})]}),I?(0,X.jsx)(`p`,{className:`oc-admin__hint`,children:ee()}):L?(0,X.jsx)(`p`,{className:`oc-admin__hint`,children:N()}):(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:re()}),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?d({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:w.map(e=>{let t=Q(e.permissions),n=S.has(e._id);return(0,X.jsxs)(`tr`,{children:[(0,X.jsxs)(`th`,{className:`oc-matrix__rolecell`,children:[(0,X.jsxs)(`div`,{className:`oc-matrix__rolename`,children:[(0,X.jsx)(`span`,{children:e.name}),(0,X.jsx)(`code`,{className:`oc-matrix__rolekey`,children:e.key}),e.builtin?(0,X.jsxs)(W,{variant:`outline`,className:`gap-1`,children:[(0,X.jsx)(H,{}),` `,a()]}):(0,X.jsx)(W,{variant:`secondary`,children:s()})]}),J(e)?(0,X.jsx)(`p`,{className:`oc-matrix__roledesc`,children:J(e)}):null]}),oe.map(r=>(0,X.jsx)(`td`,{className:`oc-matrix__cell`,children:(0,X.jsx)(K,{checked:t||e.permissions.includes(r),disabled:t||n,"aria-label":`${e.key} · ${r}`,title:t?D():n?ae():r,onCheckedChange:()=>void T(e,r)})},r))]},e.key)})})]})})]}),(0,X.jsx)(q,{open:p,onOpenChange:m,title:R(),description:E(),canSubmit:!!(_.key&&_.name),onSubmit:O,submitLabel:A(),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:j()}),(0,X.jsx)(G,{value:_.key,placeholder:P(),onChange:e=>y({..._,key:e.target.value})})]}),(0,X.jsxs)(`label`,{className:`oc-field`,children:[(0,X.jsx)(`span`,{className:`oc-field__label`,children:F()}),(0,X.jsx)(G,{value:_.name,onChange:e=>y({..._,name:e.target.value})})]}),(0,X.jsxs)(`label`,{className:`oc-field`,children:[(0,X.jsx)(`span`,{className:`oc-field__label`,children:k()}),(0,X.jsx)(G,{value:_.description,onChange:e=>y({..._,description:e.target.value})})]})]})})]})}export{se as RolesTab};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$D as r,AD as i,BD as ee,CD as a,CO as te,DD as o,E as s,ED as c,EO as ne,FD as re,GD as ie,HD as ae,Hj as l,ID as oe,JD as se,KD as ce,LD as le,MD as ue,ND as de,OD as u,PD as fe,QD as pe,RD as me,SD as d,SO as he,TD as ge,TO as _e,UD as ve,VD as ye,Vj as f,WD as be,XD as xe,YD as Se,ZD as Ce,_D as p,_O as we,aO as Te,bD as m,bO as h,cD as g,cO as Ee,dD as _,dO as De,eO as Oe,fD as v,fO as ke,gD as y,gO as Ae,hD as b,hO as je,iO as Me,jD as Ne,kD as x,lD as S,lO as Pe,mD as C,mO as Fe,nO as Ie,oD as w,oO as Le,pD as T,pO as Re,qD as ze,rO as Be,sD as E,sO as Ve,tO as He,uD as D,uO as Ue,vD as O,vO as We,wD as k,wO as Ge,xD as A,xO as j,yD as M,yO as Ke,zD as qe,zj as Je}from"./dist-TE9n7zkZ.js";import{n as N}from"./dist-8uYlaw3Q.js";import{i as Ye}from"./dist-DCABHmKq.js";import{t as P}from"./button-DK1qmYDJ.js";import{A as F,C as I,H as Xe,S as L,U as Ze,Wt as R,Xt as Qe,Yt as $e,b as z,ct as B,dt as V,ft as H,ht as U,j as W,lt as et,mt as tt,pt as nt,qt as rt,u as it,ut as G,w as K,x as q}from"./index-ctX_-fgr.js";import{t as at}from"./FilterBar-BIebILEF.js";import{t as ot}from"./DataTableShell-Cu3JqhO0.js";import{t as st}from"./roleDescriptions-CCsDWcXg.js";var J=t(e(),1),Y=n(),ct=[{value:`never`,label:()=>v(),days:null},{value:`30`,label:()=>_(),days:30},{value:`90`,label:()=>D(),days:90}],X=720*60*60*1e3,Z=`__all__`,Q={name:``,roleKey:``,description:``};function $(){let e=Qe({from:`/settings/serviceAccounts`}),t=$e({from:`/settings/serviceAccounts`}),n=e.q??``,a=e.status??Z,[o,c]=(0,J.useState)(Z),u=e=>void t({search:t=>({...t,q:e||void 0}),replace:!0}),d=e=>void t({search:t=>({...t,status:e===Z?void 0:e})}),ge=l(s.apiKeys.listServiceAccounts,{filter:{q:n||void 0,role:o===Z?void 0:o,disabled:a===Z?void 0:a===`disabled`}}),p=l(s.apiKeys.listKeys,{}),m=l(s.apiKeys.listRoles,{}),g=f(s.apiKeys.createServiceAccount),_=f(s.apiKeys.updateServiceAccount),v=f(s.apiKeys.deleteServiceAccount),y=Je(s.apiKeys.mintApiKey),b=f(s.apiKeys.revokeApiKey),x=Ze(),S=Xe(),C=n!==``||o!==Z||a!==Z;function w(){c(Z),t({search:{},replace:!0})}let[T,E]=(0,J.useState)(!1),[D,O]=(0,J.useState)(Q),[k,A]=(0,J.useState)(null),[M,N]=(0,J.useState)(new Set),[F,R]=(0,J.useState)(null),V=(0,J.useRef)(!1),[H,U]=(0,J.useState)(new Set),[W,tt]=(0,J.useState)({}),[nt,G]=(0,J.useState)(null),X=(0,J.useMemo)(()=>{let e=new Map;for(let t of p??[]){let n=e.get(t.serviceAccountId)??[];n.push(t),e.set(t.serviceAccountId,n)}return e},[p]);function $(e){N(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})}async function dt(){try{k?(await _({serviceAccountId:k,name:D.name,roleKey:D.roleKey,description:D.description}),S.success(be())):await g({name:D.name,roleKey:D.roleKey,description:D.description||void 0}),O(Q),A(null),E(!1)}catch(e){S.error(k?ie():ce(),e)}}function ft(e){O({name:e.name,roleKey:e.roleKey,description:e.description??``}),A(e._id),E(!0)}async function pt(e){if(V.current)return;V.current=!0;let t=W[e._id]??`never`,n=ct.find(e=>e.value===t)?.days??null,r=n?Date.now()+n*24*60*60*1e3:void 0;R(e._id);try{let t=await y({serviceAccountId:e._id,expiresAt:r});G({accountName:e.name,plaintext:t.plaintext,prefix:t.prefix,lastFour:t.lastFour})}catch(e){S.error(ve(),e)}finally{V.current=!1,R(null)}}async function mt(e){if(await x({title:ae(),description:(0,Y.jsxs)(Y.Fragment,{children:[ye(),` `,(0,Y.jsx)(`span`,{className:`font-mono`,children:e.name}),` `,ee(),` `,(0,Y.jsx)(`strong`,{children:qe()}),` `,me()]}),confirmWord:e.name,confirmLabel:le(),destructive:!0}))try{await v({serviceAccountId:e._id}),S.success(oe(),e.name)}catch(e){S.error(re(),e)}}async function ht(e){if(await x({title:fe(),description:(0,Y.jsxs)(Y.Fragment,{children:[de(),` `,(0,Y.jsxs)(`span`,{className:`font-mono`,children:[e.prefix,`…`,e.lastFour]}),` `,ue()]}),confirmLabel:Ne(),destructive:!0})&&!H.has(e._id)){U(t=>new Set(t).add(e._id));try{await b({keyId:e._id})}catch(e){S.error(i(),e)}finally{U(t=>{let n=new Set(t);return n.delete(e._id),n})}}}return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`p`,{className:`oc-admin__hint`,children:ne()}),(0,Y.jsxs)(at,{q:n,onQChange:u,searchPlaceholder:_e(),onReset:w,canReset:C,children:[(0,Y.jsxs)(z,{value:o,onValueChange:c,children:[(0,Y.jsx)(I,{size:`sm`,className:`w-40`,children:(0,Y.jsx)(K,{placeholder:Ge()})}),(0,Y.jsxs)(q,{children:[(0,Y.jsx)(L,{value:Z,children:te()}),(m??[]).map(e=>(0,Y.jsx)(L,{value:e.key,children:e.key},e._id))]})]}),(0,Y.jsxs)(z,{value:a,onValueChange:d,children:[(0,Y.jsx)(I,{size:`sm`,className:`w-36`,children:(0,Y.jsx)(K,{})}),(0,Y.jsxs)(q,{children:[(0,Y.jsx)(L,{value:Z,children:he()}),(0,Y.jsx)(L,{value:`active`,children:j()}),(0,Y.jsx)(L,{value:`disabled`,children:h()})]})]})]}),(0,Y.jsx)(ot,{title:Ke(),rows:ge,addLabel:We(),onAdd:()=>{O(Q),A(null),E(!0)},emptyHint:we(),isExpanded:e=>M.has(e._id),renderExpanded:e=>(0,Y.jsx)(lt,{account:e,keys:X.get(e._id)??[],onRevoke:ht,revoking:H}),rowActions:e=>[{label:Re(),onSelect:()=>ft(e)},{label:Ae(),onSelect:()=>void pt(e)},{label:M.has(e._id)?je():Fe(),onSelect:()=>$(e._id)},{label:ke(),variant:`destructive`,onSelect:()=>void mt(e)}],columns:[{header:``,className:`w-8`,cell:e=>(0,Y.jsx)(P,{variant:`ghost`,size:`icon-sm`,"aria-label":M.has(e._id)?De():Ue(),onClick:()=>$(e._id),children:M.has(e._id)?(0,Y.jsx)(Ye,{}):(0,Y.jsx)(rt,{})})},{header:Pe(),sort:e=>e.name,cell:e=>(0,Y.jsxs)(`div`,{className:`flex flex-col`,children:[(0,Y.jsx)(`span`,{children:e.name}),e.description?(0,Y.jsx)(`span`,{className:`text-muted-foreground text-xs`,children:e.description}):null]})},{header:Ee(),sort:e=>e.roleKey,cell:e=>(0,Y.jsx)(B,{variant:`secondary`,children:e.roleKey})},{header:Ve(),sort:e=>+!!e.disabled,cell:e=>e.disabled?(0,Y.jsx)(B,{variant:`destructive`,children:h()}):(0,Y.jsx)(B,{variant:`outline`,children:j()})},{header:Le(),cell:e=>(0,Y.jsxs)(z,{value:W[e._id]??`never`,onValueChange:t=>tt(n=>({...n,[e._id]:t})),children:[(0,Y.jsx)(I,{size:`sm`,className:`w-32`,children:(0,Y.jsx)(K,{})}),(0,Y.jsx)(q,{children:ct.map(e=>(0,Y.jsx)(L,{value:e.value,children:e.label()},e.value))})]})},{header:Te(),sort:e=>(X.get(e._id)??[]).filter(e=>!e.disabled).length,cell:e=>{let t=(X.get(e._id)??[]).filter(e=>!e.disabled).length;return(0,Y.jsx)(`span`,{className:`oc-sa__keycount`,children:F===e._id?Me():Be({count:t})})}}]}),(0,Y.jsx)(it,{open:T,onOpenChange:e=>{E(e),e||A(null)},title:k?Ie():r(),description:k?He():pe(),canSubmit:!!(D.name&&D.roleKey),onSubmit:dt,submitLabel:k?Oe():Ce(),children:(0,Y.jsxs)(`div`,{className:`oc-form`,children:[(0,Y.jsxs)(`label`,{className:`oc-field`,children:[(0,Y.jsx)(`span`,{className:`oc-field__label`,children:xe()}),(0,Y.jsx)(et,{value:D.name,onChange:e=>O({...D,name:e.target.value})})]}),(0,Y.jsxs)(`label`,{className:`oc-field`,children:[(0,Y.jsx)(`span`,{className:`oc-field__label`,children:Se()}),(0,Y.jsxs)(z,{value:D.roleKey||void 0,onValueChange:e=>O({...D,roleKey:e}),children:[(0,Y.jsx)(I,{className:`w-full`,children:(0,Y.jsx)(K,{placeholder:se()})}),(0,Y.jsx)(q,{children:(m??[]).map(e=>(0,Y.jsxs)(L,{value:e.key,children:[e.name,` (`,e.key,`)`]},e._id))})]}),(()=>{let e=(m??[]).find(e=>e.key===D.roleKey),t=e?st(e):null;return t?(0,Y.jsx)(`span`,{className:`text-muted-foreground text-xs`,children:t}):null})()]}),(0,Y.jsxs)(`label`,{className:`oc-field`,children:[(0,Y.jsx)(`span`,{className:`oc-field__label`,children:ze()}),(0,Y.jsx)(et,{value:D.description,onChange:e=>O({...D,description:e.target.value})})]})]})}),(0,Y.jsx)(ut,{minted:nt,onClose:()=>G(null)})]})}function lt({account:e,keys:t,onRevoke:n,revoking:r}){return(0,Y.jsxs)(`div`,{className:`oc-sa__keys`,children:[(0,Y.jsxs)(`div`,{className:`oc-sa__keys-head`,children:[x(),` `,(0,Y.jsx)(`span`,{className:`font-medium`,children:e.name})]}),t.length===0?(0,Y.jsx)(`p`,{className:`oc-admin__hint`,children:u()}):(0,Y.jsxs)(`table`,{className:`oc-sa__keytable`,children:[(0,Y.jsx)(`thead`,{children:(0,Y.jsxs)(`tr`,{children:[(0,Y.jsx)(`th`,{children:o()}),(0,Y.jsx)(`th`,{children:c()}),(0,Y.jsx)(`th`,{children:ge()}),(0,Y.jsx)(`th`,{children:k()}),(0,Y.jsx)(`th`,{children:a()}),(0,Y.jsx)(`th`,{children:d()}),(0,Y.jsx)(`th`,{})]})}),(0,Y.jsx)(`tbody`,{children:t.map(t=>(0,Y.jsxs)(`tr`,{children:[(0,Y.jsx)(`td`,{children:(0,Y.jsxs)(`code`,{className:`oc-sa__keyid`,children:[t.prefix,`…`,t.lastFour]})}),(0,Y.jsx)(`td`,{children:(0,Y.jsx)(B,{variant:`secondary`,children:e.roleKey})}),(0,Y.jsx)(`td`,{children:W(t.createdAt)}),(0,Y.jsx)(`td`,{className:dt(t.lastUsedAt)?`oc-sa__stale`:``,children:ft(t.lastUsedAt)}),(0,Y.jsx)(`td`,{children:pt(t.expiresAt)}),(0,Y.jsx)(`td`,{children:mt(t)}),(0,Y.jsx)(`td`,{className:`text-right`,children:t.disabled?null:(0,Y.jsx)(P,{variant:`destructive`,size:`sm`,disabled:r.has(t._id),onClick:()=>n(t),children:r.has(t._id)?A():m()})})]},t._id))})]})]})}function ut({minted:e,onClose:t}){let[n,r]=(0,J.useState)(!1);async function i(){if(e)try{await navigator.clipboard.writeText(e.plaintext),r(!0),window.setTimeout(()=>r(!1),2e3)}catch{}}return(0,Y.jsx)(G,{open:e!==null,onOpenChange:e=>{e||(r(!1),t())},children:e?(0,Y.jsxs)(V,{className:`max-w-lg`,showCloseButton:!1,onInteractOutside:e=>e.preventDefault(),onEscapeKeyDown:e=>e.preventDefault(),children:[(0,Y.jsxs)(tt,{children:[(0,Y.jsx)(U,{children:M()}),(0,Y.jsx)(H,{children:O({name:e.accountName})})]}),(0,Y.jsx)(`div`,{className:`oc-sa__minted-warning`,children:p()}),(0,Y.jsxs)(`div`,{className:`oc-sa__minted-box`,children:[(0,Y.jsx)(`code`,{className:`oc-sa__minted-plain`,children:e.plaintext}),(0,Y.jsxs)(P,{variant:`outline`,size:`sm`,onClick:()=>void i(),"aria-label":y(),children:[n?(0,Y.jsx)(N,{}):(0,Y.jsx)(R,{}),n?b():C()]})]}),(0,Y.jsx)(nt,{children:(0,Y.jsx)(P,{onClick:()=>{r(!1),t()},children:T()})})]}):null})}function dt(e){return e===null?!1:Date.now()-e>X}function ft(e){return e===null?S():W(e)}function pt(e){return e===null?`—`:F(e)}function mt(e){return e.disabled?(0,Y.jsx)(B,{variant:`destructive`,children:g()}):e.expiresAt!==null&&e.expiresAt<Date.now()?(0,Y.jsx)(B,{variant:`outline`,children:E()}):(0,Y.jsx)(B,{variant:`outline`,children:w()})}export{$ as ServiceAccountsTab};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$k as r,AA as i,Aj as a,Ak as o,Bk as s,CA as c,Ck as l,D as u,DA as d,Dk as f,E as p,EA as m,Ek as h,Fk as g,Gk as _,Hj as v,Hk as y,Ik as ee,Jk as te,Kk as ne,Lk as re,Mk as ie,Nk as ae,OA as oe,Ok as b,Pk as se,Qk as ce,Rk as le,SA as ue,Sk as de,TA as fe,Tk as pe,Uk as me,Vj as x,Vk as he,Wk as ge,Xk as _e,Yk as ve,Zk as ye,_A as be,_k as xe,aA as Se,aa as S,bA as C,bk as Ce,cA as we,ck as Te,dA as Ee,dk as De,eA as Oe,fA as ke,fk as w,gA as Ae,gk as T,hA as je,hk as Me,iA as Ne,ia as Pe,jj as Fe,jk as Ie,kA as Le,kj as Re,kk as ze,lA as Be,lk as Ve,mA as He,mk as Ue,n as We,nA as Ge,oA as Ke,oa as E,pA as qe,pk as Je,qk as D,rA as Ye,ra as Xe,sA as Ze,tA as Qe,uA as $e,uk as et,vA as tt,vk as nt,wA as rt,wk as it,xA as at,xk as ot,yA as st,yk as ct,zj as lt,zk as ut}from"./dist-TE9n7zkZ.js";import{n as O}from"./dist-8uYlaw3Q.js";import{t as k}from"./x-C-AIvdVt.js";import{t as A}from"./button-DK1qmYDJ.js";import{C as j,Ht as M,S as N,Ut as dt,_t as ft,at as pt,b as P,ct as F,gt as mt,it as I,lt as L,nt as ht,ot as gt,p as R,rt as _t,st as vt,w as z,x as B,xt as V}from"./index-ctX_-fgr.js";import{t as yt}from"./localePickerView-C2RmOS86.js";import{a as bt,i as xt,n as St,o as Ct,r as wt,t as Tt}from"./card-D0s3oDw3.js";import{a as Et,i as H,n as Dt,o as U,r as W,t as Ot}from"./table-EwCph6eW.js";import{t as kt}from"./TimeRangePicker-NNSu8mCt.js";import{t as At}from"./FilterBar-BIebILEF.js";import{t as jt}from"./AdvancedFilter-DTbUf7Uh.js";var G=u(`upload`,[[`path`,{d:`M12 3v12`,key:`1x0j5s`}],[`path`,{d:`m17 8-5-5-5 5`,key:`7q97r8`}],[`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`,key:`ih7n3h`}]]),K=t(e(),1),Mt=.1,Nt=[248,248,248],Pt=[24,24,24];function Ft(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 It(e,t,n){let r=t*n;if(r===0)return 0;let i=0;for(let t=3;t<e.length;t+=4)e[t]<=8&&i++;return i/r}function q(e,t,n){return It(e,t,n)>=Mt}function Lt(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 Rt(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 zt=12*1024*1024,Bt=480,Vt=160,Ht=.92;async function Ut(e,t={}){if(!e.type.startsWith(`image/`))throw Error(Ie());if(e.size>zt)throw Error(o());let{source:n,width:r,height:i,cleanup:a}=await Wt(e);try{let a=e.type===`image/svg+xml`,o=Math.min(Bt/r,Vt/i,a?1/0:1),s=Math.max(1,Math.round(r*o)),c=Math.max(1,Math.round(i*o)),l=document.createElement(`canvas`);l.width=s,l.height=c;let u=l.getContext(`2d`);if(!u)throw Error(b());u.imageSmoothingEnabled=!0,u.imageSmoothingQuality=`high`,u.drawImage(n,0,0,s,c);let d=Ft(u.getImageData(0,0,s,c).data,s,c)??{x:0,y:0,width:s,height:c},p=document.createElement(`canvas`);p.width=d.width,p.height=d.height;let m=p.getContext(`2d`);if(!m)throw Error(b());if(m.drawImage(l,d.x,d.y,d.width,d.height,0,0,d.width,d.height),t.variantFor){let e=m.getImageData(0,0,d.width,d.height);q(e.data,d.width,d.height)?Lt(e.data,t.variantFor===`dark`?Nt:Pt):Rt(e.data),m.putImageData(e,0,0)}let h=q(m.getImageData(0,0,d.width,d.height).data,d.width,d.height),g=await Y(p,`image/webp`,Ht)??await Y(p,`image/png`);if(!g)throw Error(f());return{blob:g,hasAlpha:h}}finally{a()}}async function Wt(e){if(e.type===`image/svg+xml`)return J(e);if(typeof createImageBitmap==`function`)try{let t=await createImageBitmap(e);return{source:t,width:t.width,height:t.height,cleanup:()=>t.close()}}catch{}return J(e)}async function J(e){let t=URL.createObjectURL(e);try{let e=new Image;return e.decoding=`async`,await new Promise((n,r)=>{e.onload=()=>n(),e.onerror=()=>r(Error(ze())),e.src=t}),{source:e,width:e.naturalWidth||300,height:e.naturalHeight||150,cleanup:()=>URL.revokeObjectURL(t)}}catch(e){throw URL.revokeObjectURL(t),e}}function Y(e,t,n){return new Promise(r=>e.toBlob(e=>r(e),t,n))}var X=n();function 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__`,Q={kind:`relative`,from:`now-24h`,to:`now`},Kt=[{value:`status`,label:`Statut`},{value:`latencyMs`,label:`Latence (ms)`},{value:`route`,label:`Route`},{value:`roleKey`,label:`Rôle`},{value:`correlationId`,label:`Corrélation`}];function $({title:e,description:t,children:n}){return(0,X.jsxs)(`section`,{className:`oc-show__section`,children:[(0,X.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,X.jsx)(`h2`,{className:`oc-show__title`,children:e}),t?(0,X.jsx)(`p`,{className:`oc-show__desc`,children:t}):null]}),(0,X.jsx)(`div`,{className:`oc-show__demo`,children:n})]})}function qt(e){return e===`light`?Fe():e===`dark`?a():Re()}var Jt=[`primary`,`secondary`,`accent`,`muted`,`chart-1`,`chart-2`];function Yt({tokens:e,mode:t}){let n=e.colors[t];return(0,X.jsx)(`div`,{className:`oc-chart-swatches`,"aria-hidden":!0,children:Jt.map(e=>{let t=n[e];return(0,X.jsx)(`span`,{className:`oc-chart-swatch`,style:t?{background:t}:void 0},e)})})}function Xt({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:We(`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)(O,{className:`size-4 text-primary`,"aria-hidden":!0}):null]}),r?(0,X.jsx)(Yt,{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)(A,{type:`button`,variant:`ghost`,size:`icon`,className:`oc-chart-card__export`,onClick:o,"aria-label":E(),title:E(),children:(0,X.jsx)(dt,{className:`size-4`})}):null]})}function Zt({selectedKey:e,resolvedMode:t}){let n=v(p.charts.listMyCharts),r=x(p.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:ue()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:at()})]}),(0,X.jsxs)(`div`,{className:`oc-chart-grid`,children:[(0,X.jsx)(Xt,{selected:e===null,title:C(),subtitle:st(),tokens:null,mode:t,onSelect:()=>void i(null)}),(n??[]).map(n=>{let r=n.via===`common`?tt():n.via===`owner`?be():Ae({group:n.via.group});return(0,X.jsx)(Xt,{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:je()}):null]})}function Qt(){let e=x(p.charts.importChart),[t,n]=(0,K.useState)(``),[i,a]=(0,K.useState)(``),[o,s]=(0,K.useState)(null),[c,l]=(0,K.useState)(!1),[u,d]=(0,K.useState)(!1);async function f(e){let t=e.target.files?.[0];if(e.target.value=``,t){s(null),l(!1);try{a(await t.text())}catch{s(D())}}}async function m(){if(s(null),l(!1),t.trim()===``){s(_());return}let r;try{r=JSON.parse(i)}catch{s(D());return}d(!0);try{await e({name:t.trim(),tokens:r}),l(!0),n(``),a(``)}catch(e){s(e instanceof Error?e.message:String(e))}finally{d(!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:Qe()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:Oe()})]}),(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:r()}),(0,X.jsx)(L,{value:t,onChange:e=>n(e.target.value),placeholder:ce(),maxLength:60})]}),(0,X.jsxs)(`label`,{className:`oc-chart-import__field`,children:[(0,X.jsx)(`span`,{className:`oc-chart-import__label`,children:ye()}),(0,X.jsx)(`textarea`,{className:`oc-chart-import__textarea`,value:i,onChange:e=>a(e.target.value),placeholder:_e(),rows:8,spellCheck:!1})]}),(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsx)(A,{variant:`outline`,size:`sm`,asChild:!0,children:(0,X.jsxs)(`label`,{className:`oc-chart-import__file`,children:[(0,X.jsx)(G,{className:`size-4`}),ve(),(0,X.jsx)(`input`,{type:`file`,accept:`application/json,.json`,className:`oc-chart-import__file-input`,onChange:e=>void f(e)})]})}),(0,X.jsx)(A,{size:`sm`,disabled:u,onClick:()=>void m(),children:te()})]}),o?(0,X.jsx)(`p`,{className:`oc-chart-import__error`,children:o}):null,c?(0,X.jsx)(`p`,{className:`oc-chart-import__ok`,children:ne()}):null]})]})}function $t({chart:e}){let t=lt(p.charts.setChartLogo),n=x(p.charts.removeChartLogo),[r,i]=(0,K.useState)(!1),[a,o]=(0,K.useState)(null),s=t=>t===`light`?e.logoLightUrl:e.logoDarkUrl;async function c(n,r,a){if(e.chartId!==void 0){o(null),i(!0);try{let{blob:i,hasAlpha:o}=await Ut(r,a?{variantFor:a}:{}),s=await i.arrayBuffer();await t({chartId:e.chartId,bytes:s,mode:n,hasAlpha:o})}catch(e){o(e instanceof Error?e.message:String(e))}finally{i(!1)}}}async function l(e,t){let n=t.target.files?.[0];t.target.value=``,n&&await c(e,n)}async function u(t){if(e.chartId!==void 0){o(null),i(!0);try{await n({chartId:e.chartId,mode:t})}catch(e){o(e instanceof Error?e.message:String(e))}finally{i(!1)}}}async function d(e){let t=s(e===`light`?`dark`:`light`);if(t){o(null),i(!0);try{await c(e,await(await fetch(t)).blob(),e)}catch(e){o(e instanceof Error?e.message:String(e))}finally{i(!1)}}}function f({mode:e}){let t=s(e),n=s(e===`light`?`dark`:`light`);return(0,X.jsxs)(`div`,{className:`oc-chart-mine__logo-slot`,children:[(0,X.jsx)(`span`,{className:`oc-chart-mine__logo-mode`,children:e===`light`?le():re()}),(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)(A,{variant:`outline`,size:`sm`,asChild:!0,children:(0,X.jsxs)(`label`,{className:`oc-chart-import__file`,children:[(0,X.jsx)(G,{className:`size-4`}),t?g():ee(),(0,X.jsx)(`input`,{type:`file`,accept:`image/*`,className:`oc-chart-import__file-input`,onChange:t=>void l(e,t)})]})}),!t&&n?(0,X.jsx)(A,{variant:`ghost`,size:`sm`,disabled:r,onClick:()=>void d(e),children:ae()}):null,t?(0,X.jsx)(A,{variant:`ghost`,size:`sm`,disabled:r,onClick:()=>void u(e),children:se()}):null]})}return(0,X.jsxs)(`div`,{className:`oc-chart-mine__logo`,children:[(0,X.jsx)(`span`,{className:`oc-chart-mine__groups-label`,children:ut()}),(0,X.jsxs)(`div`,{className:`oc-chart-mine__logo-slots`,children:[(0,X.jsx)(f,{mode:`light`}),(0,X.jsx)(f,{mode:`dark`})]}),r?(0,X.jsx)(`span`,{className:`oc-show__desc`,children:ie()}):null,a?(0,X.jsx)(`p`,{className:`oc-chart-import__error`,children:a}):null]})}function en({chart:e}){let t=v(p.me.getMe,{host:V}),n=x(p.charts.addChartDomain),r=x(p.charts.removeChartDomain),[i,a]=(0,K.useState)(``),[o,s]=(0,K.useState)(null),[c,u]=(0,K.useState)(!1);if(t?.role!==`admin`)return null;let d=e.domains??[];async function f(){let t=i.trim();if(t!==``){s(null),u(!0);try{await n({chartKey:e.key,domain:t}),a(``)}catch(e){s(e instanceof Error?e.message:String(e))}finally{u(!1)}}}async function m(t){s(null);try{await r({chartKey:e.key,domain:t})}catch{}}return(0,X.jsxs)(`div`,{className:`oc-chart-mine__domains`,children:[(0,X.jsx)(`span`,{className:`oc-chart-mine__groups-label`,children:h()}),(0,X.jsxs)(`div`,{className:`oc-chart-mine__domains-body`,children:[(0,X.jsx)(`div`,{className:`oc-chart-avail__groups`,children:d.length===0?(0,X.jsx)(`span`,{className:`oc-show__desc`,children:de()}):d.map(e=>(0,X.jsxs)(F,{variant:`secondary`,className:`oc-chart-avail__chip`,children:[e,(0,X.jsx)(`button`,{type:`button`,className:`oc-chart-avail__chip-x`,"aria-label":ot({domain:e}),onClick:()=>void m(e),children:(0,X.jsx)(k,{className:`size-3`})})]},e))}),(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsx)(L,{value:i,onChange:e=>a(e.target.value),placeholder:it(),className:`oc-chart-mine__domains-input`,onKeyDown:e=>{e.key===`Enter`&&f()}}),(0,X.jsx)(A,{variant:`outline`,size:`sm`,disabled:c,onClick:()=>void f(),children:l()})]}),(0,X.jsx)(`span`,{className:`oc-show__desc`,children:pe()}),o?(0,X.jsx)(`p`,{className:`oc-chart-import__error`,children:o}):null]})]})}function tn(e){let t={...e};return delete t.bpm,JSON.stringify(t,null,2)}function nn({chart:e}){let t=x(p.charts.updateChart),n=x(p.charts.deleteChart),[r,i]=(0,K.useState)(!1),[a,o]=(0,K.useState)(e.name),[c,l]=(0,K.useState)(()=>tn(e.tokens)),[u,d]=(0,K.useState)(e.tokens.bpm??0),[f,m]=(0,K.useState)(null),[h,g]=(0,K.useState)(!1);function _(){o(e.name),l(tn(e.tokens)),d(e.tokens.bpm??0),m(null),i(!0)}async function v(){if(e.chartId===void 0)return;m(null);let n;try{n=JSON.parse(c)}catch{m(D());return}if(n&&typeof n==`object`&&!Array.isArray(n)){let e=n;u>0?e.bpm=u:delete e.bpm}g(!0);try{await t({chartId:e.chartId,name:a.trim(),tokens:n}),i(!1)}catch(e){m(e instanceof Error?e.message:String(e))}finally{g(!1)}}async function y(){if(e.chartId!==void 0&&window.confirm(T()))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)(A,{variant:`outline`,size:`sm`,onClick:_,children:he()}),(0,X.jsx)(A,{variant:`ghost`,size:`sm`,onClick:()=>void y(),children:s()})]})})]}),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:nt()}),(0,X.jsx)(L,{value:a,onChange:e=>o(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:S()}),(0,X.jsxs)(`div`,{className:`oc-chart-bpm`,children:[(0,X.jsx)(`input`,{type:`range`,className:`oc-chart-bpm__slider`,min:0,max:90,step:5,value:u,onChange:e=>d(Number(e.target.value)),"aria-label":S()}),(0,X.jsx)(`span`,{className:`oc-chart-bpm__value`,children:u===0?Pe():`${u} BPM`})]}),(0,X.jsx)(`span`,{className:`oc-show__desc`,children:Xe()})]}),(0,X.jsxs)(`label`,{className:`oc-chart-import__field`,children:[(0,X.jsx)(`span`,{className:`oc-chart-import__label`,children:xe()}),(0,X.jsx)(`textarea`,{className:`oc-chart-import__textarea`,value:c,onChange:e=>l(e.target.value),rows:10,spellCheck:!1})]}),f?(0,X.jsx)(`p`,{className:`oc-chart-import__error`,children:f}):null,(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsx)(A,{size:`sm`,disabled:h,onClick:()=>void v(),children:Ce()}),(0,X.jsx)(A,{variant:`ghost`,size:`sm`,onClick:()=>i(!1),children:ct()})]})]}):null,(0,X.jsx)($t,{chart:e}),(0,X.jsx)(en,{chart:e})]})}function rn(){let e=v(p.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:ge()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:me()})]}),e!==void 0&&t.length===0?(0,X.jsx)(`p`,{className:`oc-show__desc`,children:y()}):(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=x(p.charts.addChartToGroupPool),r=x(p.charts.removeChartFromGroupPool),i=e.restrictedToGroups,a=e.poolGroups,o=new Set((a??[]).map(e=>e.groupId)),s=t.filter(e=>!o.has(e._id));async function c(t){try{await n({groupId:t,chartKey:e.key})}catch{}}async function l(t){try{await r({groupId:t,chartKey:e.key})}catch{}}return(0,X.jsxs)(`div`,{className:`oc-chart-avail`,children:[(0,X.jsxs)(`div`,{className:`oc-chart-avail__head`,children:[(0,X.jsx)(`span`,{className:`oc-chart-avail__name`,children:e.name}),(0,X.jsx)(F,{variant:i?`secondary`:`outline`,className:`oc-chart-avail__state`,children:i?Ze():e.kind===`custom`&&e.scope===`personal`?w():we()}),e.isGlobalDefault?(0,X.jsx)(F,{variant:`default`,children:Ke()}):null]}),(0,X.jsxs)(`div`,{className:`oc-chart-avail__groups`,children:[(0,X.jsx)(`span`,{className:`oc-chart-mine__groups-label`,children:Ne()}),(a??[]).map(e=>(0,X.jsxs)(F,{variant:`secondary`,className:`oc-chart-avail__chip`,children:[e.name,(0,X.jsx)(`button`,{type:`button`,className:`oc-chart-avail__chip-x`,"aria-label":Ge({group:e.name}),onClick:()=>void l(e.groupId),children:(0,X.jsx)(k,{className:`size-3`})})]},e.groupId)),s.length>0?(0,X.jsxs)(P,{value:``,onValueChange:e=>void c(e),children:[(0,X.jsx)(j,{size:`sm`,className:`w-56`,children:(0,X.jsx)(z,{placeholder:Ye()})}),(0,X.jsx)(B,{children:s.map(e=>(0,X.jsx)(N,{value:e._id,children:e.name},e._id))})]}):t.length===0?(0,X.jsx)(`span`,{className:`oc-show__desc`,children:Se()}):null]})]})}function on({chart:e}){let t=x(p.charts.promoteChartToCommon),n=x(p.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(T()))try{await n({chartId:e.chartId})}catch{}}return(0,X.jsxs)(`div`,{className:`oc-chart-avail`,children:[(0,X.jsxs)(`div`,{className:`oc-chart-avail__head`,children:[(0,X.jsx)(`span`,{className:`oc-chart-avail__name`,children:e.name}),(0,X.jsx)(F,{variant:e.scope===`common`?`outline`:`secondary`,children:e.scope===`common`?De():w()}),e.ownerLabel?(0,X.jsx)(`span`,{className:`oc-show__desc`,children:Je({owner:e.ownerLabel})}):null]}),(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[e.scope===`personal`?(0,X.jsx)(A,{variant:`outline`,size:`sm`,onClick:()=>void r(),children:et()}):null,(0,X.jsx)(A,{variant:`ghost`,size:`sm`,onClick:()=>void i(),children:Ve()})]})]})}function sn({defaultThemeMode:e,defaultLocale:t,defaultChartKey:n}){let r=x(p.admin.setDefaultThemeMode),a=x(p.admin.setDefaultLocale),o=x(p.charts.setDefaultChart),s=v(p.charts.listChartsAdmin),l=v(p.groups.listGroups,{}),u=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:rt()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:c()})]}),(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:He()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:qe()})]}),(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsx)(A,{variant:n===null?`default`:`outline`,size:`sm`,onClick:()=>void o({name:null}),children:C()}),ft.map(e=>(0,X.jsx)(A,{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)(A,{variant:n===e.key?`default`:`outline`,size:`sm`,onClick:()=>void o({name:e.key}),children:e.name},e.key))]})]}),(0,X.jsxs)(`section`,{className:`oc-show__section`,children:[(0,X.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,X.jsx)(`h3`,{className:`oc-show__title`,children:ke()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:Ee()})]}),(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:l??[]},e.key))})]}),(0,X.jsxs)(`section`,{className:`oc-show__section`,children:[(0,X.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,X.jsx)(`h3`,{className:`oc-show__title`,children:$e()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:Be()})]}),(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)(en,{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:Me()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:Ue()})]}),(()=>{let e=(s??[]).filter(e=>e.kind===`custom`);return e.length===0?(0,X.jsx)(`p`,{className:`oc-show__desc`,children:Te()}):(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:i()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:Le()})]}),(0,X.jsx)(`div`,{className:`oc-show__row`,children:[`light`,`dark`,`system`].map(e=>(0,X.jsx)(A,{variant:u===e?`default`:`outline`,size:`sm`,onClick:()=>void r({mode:e}),children:qt(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:oe()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:d()})]}),(0,X.jsx)(`div`,{className:`oc-show__row`,children:yt().map(e=>(0,X.jsx)(A,{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:m()})]})]})}function cn(){let e=v(p.me.getMe,{host:V}),t=mt(e?.resolvedThemeMode);return(0,X.jsxs)(`div`,{className:`oc-appearance`,children:[(0,X.jsx)(Zt,{selectedKey:e?.chartKey??null,resolvedMode:t}),(0,X.jsx)(Qt,{}),(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,K.useState)(!0),[n,r]=(0,K.useState)(`per-user`),[i,a]=(0,K.useState)(``),[o,s]=(0,K.useState)(Z),[c,l]=(0,K.useState)(Z),[u,d]=(0,K.useState)(Q),f=i!==``||o!==Z||c!==Z;function p(){a(``),s(Z),l(Z),d(Q)}return(0,X.jsxs)(`div`,{className:`oc-show`,children:[(0,X.jsx)(cn,{}),(0,X.jsxs)(`details`,{className:`oc-show__ref`,children:[(0,X.jsx)(`summary`,{className:`oc-show__title`,children:fe()}),(0,X.jsxs)($,{title:`Buttons`,description:`Variants`,children:[(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsx)(A,{children:`Default`}),(0,X.jsx)(A,{variant:`secondary`,children:`Secondary`}),(0,X.jsx)(A,{variant:`outline`,children:`Outline`}),(0,X.jsx)(A,{variant:`ghost`,children:`Ghost`}),(0,X.jsx)(A,{variant:`destructive`,children:`Destructive`}),(0,X.jsx)(A,{variant:`link`,children:`Link`})]}),(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsx)(A,{size:`sm`,children:`Small`}),(0,X.jsx)(A,{children:`Default`}),(0,X.jsx)(A,{size:`lg`,children:`Large`}),(0,X.jsx)(A,{size:`icon`,"aria-label":`more`,children:(0,X.jsx)(M,{})}),(0,X.jsx)(A,{disabled:!0,children:`Disabled`})]})]}),(0,X.jsx)($,{title:`Badges`,children:(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsx)(F,{children:`Default`}),(0,X.jsx)(F,{variant:`secondary`,children:`Secondary`}),(0,X.jsx)(F,{variant:`outline`,children:`Outline`}),(0,X.jsx)(F,{variant:`destructive`,children:`Destructive`})]})}),(0,X.jsx)($,{title:`Inputs & selection`,children:(0,X.jsxs)(`div`,{className:`oc-show__row oc-show__row--col`,children:[(0,X.jsx)(L,{placeholder:`Text input…`}),(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsxs)(P,{value:n,onValueChange:r,children:[(0,X.jsx)(j,{className:`w-56`,children:(0,X.jsx)(z,{placeholder:`Select…`})}),(0,X.jsxs)(B,{children:[(0,X.jsx)(N,{value:`per-user`,children:`per-user (chacun son agent)`}),(0,X.jsx)(N,{value:`shared`,children:`shared (agent commun)`})]})]}),(0,X.jsxs)(`label`,{className:`oc-show__check`,children:[(0,X.jsx)(R,{checked:e,onCheckedChange:e=>t(!!e)}),`Checkbox`]})]})]})}),(0,X.jsx)($,{title:`Filtres & plage temporelle`,description:`Barre réutilisable (recherche debouncée + selects rapides à largeur auto + plage façon Grafana) et constructeur de filtre avancé. Câblée dans Users, Groups, Comptes de service, Traces, Anomalies, Audit et KPI.`,children:(0,X.jsxs)(`div`,{className:`oc-show__row oc-show__row--col`,children:[(0,X.jsxs)(At,{q:i,onQChange:a,searchPlaceholder:`Rechercher (kind, principal, rôle, route…)`,timeRange:u,onTimeRangeChange:d,onReset:p,canReset:f,children:[(0,X.jsxs)(P,{value:o,onValueChange:s,children:[(0,X.jsx)(j,{size:`sm`,children:(0,X.jsx)(z,{})}),(0,X.jsxs)(B,{children:[(0,X.jsx)(N,{value:Z,children:`Toutes directions`}),(0,X.jsx)(N,{value:`inbound`,children:`inbound`}),(0,X.jsx)(N,{value:`outbound`,children:`outbound`}),(0,X.jsx)(N,{value:`internal`,children:`internal`})]})]}),(0,X.jsxs)(P,{value:c,onValueChange:l,children:[(0,X.jsx)(j,{size:`sm`,children:(0,X.jsx)(z,{})}),(0,X.jsxs)(B,{children:[(0,X.jsx)(N,{value:Z,children:`Toutes sévérités`}),(0,X.jsx)(N,{value:`info`,children:`info`}),(0,X.jsx)(N,{value:`warn`,children:`warn`}),(0,X.jsx)(N,{value:`critical`,children:`critical`})]})]})]}),(0,X.jsx)(jt,{fields:Kt,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)(kt,{value:u,onChange:d})]})]})}),(0,X.jsx)($,{title:`Dropdown menu`,description:`Row actions / kebab`,children:(0,X.jsxs)(ht,{children:[(0,X.jsx)(vt,{asChild:!0,children:(0,X.jsx)(A,{variant:`outline`,size:`icon`,"aria-label":`Open menu`,children:(0,X.jsx)(M,{})})}),(0,X.jsxs)(_t,{align:`start`,children:[(0,X.jsx)(pt,{children:`Actions`}),(0,X.jsx)(gt,{}),(0,X.jsx)(I,{children:`Edit`}),(0,X.jsx)(I,{children:`Duplicate`}),(0,X.jsx)(gt,{}),(0,X.jsx)(I,{variant:`destructive`,children:`Delete`})]})]})}),(0,X.jsx)($,{title:`Card`,children:(0,X.jsxs)(Tt,{className:`w-80`,children:[(0,X.jsxs)(bt,{children:[(0,X.jsx)(Ct,{children:`Instance`}),(0,X.jsx)(wt,{children:`Non-secret metadata only.`})]}),(0,X.jsx)(St,{className:`text-sm text-muted-foreground`,children:`ws://gateway.example.org:18789`}),(0,X.jsxs)(xt,{className:`gap-2`,children:[(0,X.jsx)(A,{size:`sm`,children:`Save`}),(0,X.jsx)(A,{size:`sm`,variant:`ghost`,children:`Cancel`})]})]})}),(0,X.jsx)($,{title:`Table`,children:(0,X.jsxs)(Ot,{children:[(0,X.jsx)(Et,{children:(0,X.jsxs)(U,{children:[(0,X.jsx)(H,{className:`w-8`,children:(0,X.jsx)(R,{"aria-label":`select all`})}),(0,X.jsx)(H,{children:`Name`}),(0,X.jsx)(H,{children:`Mode`}),(0,X.jsx)(H,{className:`text-right`,children:`Status`}),(0,X.jsx)(H,{className:`w-8`})]})}),(0,X.jsx)(Dt,{children:[{n:`admins`,m:`per-user`,s:`active`},{n:`family`,m:`shared`,s:`active`}].map(e=>(0,X.jsxs)(U,{children:[(0,X.jsx)(W,{children:(0,X.jsx)(R,{"aria-label":`select ${e.n}`})}),(0,X.jsx)(W,{className:`font-medium`,children:e.n}),(0,X.jsx)(W,{children:(0,X.jsx)(F,{variant:`secondary`,children:e.m})}),(0,X.jsx)(W,{className:`text-right`,children:(0,X.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-muted-foreground`,children:[(0,X.jsx)(O,{className:`size-3.5`}),` `,e.s]})}),(0,X.jsx)(W,{children:(0,X.jsx)(A,{variant:`ghost`,size:`icon`,"aria-label":`row actions`,children:(0,X.jsx)(M,{})})})]},e.n))})]})}),(0,X.jsx)($,{title:`App fragments`,description:`Chat-specific components`,children:(0,X.jsxs)(`div`,{className:`oc-show__row oc-show__row--col`,children:[(0,X.jsx)(`div`,{className:`oc-msg oc-msg--assistant`,children:(0,X.jsx)(`div`,{className:`oc-msg__body`,children:`Assistant message bubble.`})}),(0,X.jsx)(`div`,{className:`oc-tool oc-tool--completed`,children:(0,X.jsxs)(`div`,{className:`oc-tool__header`,children:[(0,X.jsx)(`span`,{className:`oc-tool__icon`,children:`✓`}),(0,X.jsx)(`span`,{className:`oc-tool__name`,children:`write-file`}),(0,X.jsx)(`span`,{className:`oc-tool__phase`,children:`completed`})]})}),(0,X.jsxs)(`div`,{className:`oc-run-status oc-run-status--streaming`,children:[(0,X.jsx)(`span`,{className:`oc-run-status__dot`}),(0,X.jsx)(`span`,{className:`oc-run-status__label`,children:`Running`})]})]})})]})]})}export{ln as ThemeShowroom};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$w as r,A_ as i,Aw as a,B_ as o,Bw as s,C_ as c,Cw as l,D as u,D_ as d,E as f,E_ as p,F_ as m,Fw as h,G_ as ee,Gw as g,H_ as _,Hj as v,Hw as y,I_ as b,Iw as te,J_ as x,Jw as ne,K_ as re,Kw as S,L_ as ie,Lw as C,M_ as ae,Mw as w,N_ as oe,Nw as T,O_ as se,P_ as ce,Pw as E,Qw as D,R_ as le,Rw as O,S_ as ue,Sw as de,T_ as fe,Tw as pe,U_ as me,Uw as he,V_ as ge,Vj as k,Vw as A,W_ as _e,Ww as ve,Xw as ye,Y_ as be,Yw as j,Zw as xe,__ as Se,_w as Ce,b_ as we,bw as Te,d_ as M,dw as N,eT as P,f_ as F,fw as I,g_ as Ee,gn as De,gw as Oe,h_ as ke,hn as Ae,hw as je,j_ as Me,jw as L,k_ as Ne,m_ as Pe,mn as Fe,mw as Ie,p_ as Le,pw as Re,q_ as ze,qw as Be,v_ as Ve,vw as He,w_ as Ue,ww as We,x_ as Ge,xw as Ke,y_ as qe,yw as Je,z_ as Ye,zw as Xe}from"./dist-TE9n7zkZ.js";import{n as Ze}from"./dist-8uYlaw3Q.js";import{t as Qe}from"./x-C-AIvdVt.js";import{i as R,n as z,r as $e,t as et}from"./tabs-oKL6bnDA.js";import{t as B}from"./button-DK1qmYDJ.js";import{Bt as tt,C as V,M as nt,P as rt,S as H,Vt as it,Wt as at,Xt as ot,Yt as st,a as ct,b as U,ct as W,dt as lt,ft as ut,ht as dt,i as ft,j as G,mt as pt,o as mt,r as ht,ut as gt,w as K,x as q,xt as _t}from"./index-ctX_-fgr.js";import{n as vt}from"./TimeRangePicker-NNSu8mCt.js";import{t as yt}from"./FilterBar-BIebILEF.js";import{t as bt}from"./AdvancedFilter-DTbUf7Uh.js";import{t as xt}from"./DataTableShell-Cu3JqhO0.js";var St=u(`eye-off`,[[`path`,{d:`M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49`,key:`ct8e1f`}],[`path`,{d:`M14.084 14.158a3 3 0 0 1-4.242-4.242`,key:`151rxh`}],[`path`,{d:`M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143`,key:`13bj9a`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}]]),Ct=u(`scroll-text`,[[`path`,{d:`M15 12h-5`,key:`r7krc0`}],[`path`,{d:`M15 8h-5`,key:`1khuty`}],[`path`,{d:`M19 17V5a2 2 0 0 0-2-2H4`,key:`zz82l3`}],[`path`,{d:`M8 21h12a2 2 0 0 0 2-2v-1a1 1 0 0 0-1-1H11a1 1 0 0 0-1 1v1a2 2 0 1 1-4 0V5a2 2 0 1 0-4 0v2a1 1 0 0 0 1 1h3`,key:`1ph1d7`}]]),J=t(e(),1),Y=n(),X={kind:`relative`,from:`now-520w`,to:`now`},Z=e=>e===null?`-`:String(Math.round(e));function wt(e){let t=e.indexOf(`:`);if(t<0)return e;let n=e.slice(0,t),r=e.slice(t+1);return n===`admin`?h():n===`agent`?`${E()} - ${r}`:e}function Tt(){let e=v(f.me.getMe,{host:_t})?.role===`admin`,t=v(f.deliveryTiming.getDeliveryStatus,{}),n=k(f.deliveryTiming.startDeliveryRecord),i=k(f.deliveryTiming.stopDeliveryRecord),[a,o]=(0,J.useState)(!1),[s,c]=(0,J.useState)(!1),l=t?.recording??!1,u=async()=>{c(!0);try{l?await i({}):await n({})}finally{c(!1)}};return(0,Y.jsxs)(`section`,{className:`mb-4 flex flex-col gap-3 rounded-lg border border-border p-4`,children:[(0,Y.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`h3`,{className:`text-sm font-semibold`,children:P()}),(0,Y.jsx)(`p`,{className:`oc-admin__hint`,children:r()})]}),e?(0,Y.jsx)(B,{variant:l?`destructive`:`default`,size:`sm`,disabled:s||t===void 0,onClick:()=>void u(),children:l?xe():D()}):null]}),l?(0,Y.jsxs)(`p`,{className:`flex items-center gap-2 text-sm`,children:[(0,Y.jsx)(W,{variant:`secondary`,children:ye()}),t?.startedAt?(0,Y.jsx)(`span`,{className:`text-muted-foreground`,children:j({time:nt(t.startedAt)})}):null]}):null,(0,Y.jsx)(`div`,{children:(0,Y.jsx)(B,{variant:`outline`,size:`sm`,onClick:()=>o(e=>!e),children:a?S():Be()})}),a?(0,Y.jsx)(Et,{isAdmin:e}):null]})}function Et({isAdmin:e}){let t=v(f.deliveryTiming.listDeliverySessions,{}),n=k(f.deliveryTiming.deleteDeliverySessions),[r,i]=(0,J.useState)(``),[a,o]=(0,J.useState)(`all`),[c,l]=(0,J.useState)(X),[u,d]=(0,J.useState)(null),{from:p,to:m}=vt(c),h=c.to===`now`?1/0:m,ee=r.trim()!==``||a!==`all`||c!==X,_=()=>{i(``),o(`all`),l(X)},b=(0,J.useMemo)(()=>{if(t===void 0)return;let e=r.trim().toLowerCase();return t.filter(t=>(e===``||t.startedBy.toLowerCase().includes(e))&&(a===`all`||(a===`active`?t.active:!t.active))&&t.startedAt>=p&&t.startedAt<=h).map(e=>({...e,_id:e.sessionId}))},[t,r,a,p,h]),x=e=>{let t=new Set((b??[]).map(e=>e.sessionId)),r=e.filter(e=>t.has(e));r.length!==0&&(n({sessionIds:r}),u!==null&&r.includes(u)&&d(null))};return(0,Y.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Y.jsx)(yt,{q:r,onQChange:i,searchPlaceholder:ve(),timeRange:c,onTimeRangeChange:l,onReset:_,canReset:ee,children:(0,Y.jsxs)(U,{value:a,onValueChange:e=>o(e),children:[(0,Y.jsx)(V,{size:`sm`,className:`w-36`,children:(0,Y.jsx)(K,{})}),(0,Y.jsxs)(q,{children:[(0,Y.jsx)(H,{value:`all`,children:he()}),(0,Y.jsx)(H,{value:`active`,children:y()}),(0,Y.jsx)(H,{value:`stopped`,children:A()})]})]})}),(0,Y.jsx)(xt,{title:g(),rows:b,emptyHint:I(),columns:[{header:``,className:`w-8`,cell:e=>(0,Y.jsx)(B,{variant:`ghost`,size:`icon`,"aria-label":u===e.sessionId?w():T(),onClick:()=>d(t=>t===e.sessionId?null:e.sessionId),children:u===e.sessionId?(0,Y.jsx)(St,{size:15,"aria-hidden":!0}):(0,Y.jsx)(it,{size:15,"aria-hidden":!0})})},{header:s(),sort:e=>e.startedAt,cell:e=>(0,Y.jsx)(`span`,{className:`tabular-nums`,children:G(e.startedAt)})},{header:Xe(),sort:e=>e.stoppedAt,cell:e=>e.stoppedAt===null?(0,Y.jsx)(`span`,{className:`text-muted-foreground`,children:`-`}):(0,Y.jsx)(`span`,{className:`tabular-nums`,children:G(e.stoppedAt)})},{header:O(),sort:e=>e.count,cell:e=>(0,Y.jsx)(`span`,{className:`tabular-nums`,children:Z(e.count)})},{header:C(),sort:e=>e.startedBy,cell:e=>wt(e.startedBy)},{header:te(),sort:e=>e.active,cell:e=>e.active?(0,Y.jsx)(W,{variant:`secondary`,children:y()}):(0,Y.jsx)(`span`,{className:`text-muted-foreground`,children:A()})}],rowActions:e?e=>[{label:L(),variant:`destructive`,onSelect:()=>x([e.sessionId])}]:void 0,bulkActions:e?[{label:L(),variant:`destructive`,onSelect:e=>x(e)}]:void 0,isExpanded:e=>e.sessionId===u,renderExpanded:e=>(0,Y.jsx)(Dt,{sessionId:e.sessionId})})]})}function Dt({sessionId:e}){let t=v(f.deliveryTiming.getDeliveryReport,{sessionId:e}),[n,r]=(0,J.useState)(!1);return(0,Y.jsx)(Ot,{report:t,copied:n,onCopy:()=>{t&&navigator.clipboard?.writeText(rt(t)).then(()=>{r(!0),window.setTimeout(()=>r(!1),1200)}).catch(()=>{})}})}function Ot({report:e,copied:t,onCopy:n}){if(!e)return(0,Y.jsx)(`p`,{className:`oc-admin__hint`,children:a()});if(e.count===0||e.segments===null)return(0,Y.jsx)(`p`,{className:`oc-admin__hint`,children:ne()});let r=e.segments,i=(e,t)=>(0,Y.jsxs)(`tr`,{className:`border-t border-border`,children:[(0,Y.jsx)(`td`,{className:`py-1`,children:e}),(0,Y.jsx)(`td`,{className:`py-1 text-right tabular-nums`,children:t.count}),(0,Y.jsxs)(`td`,{className:`py-1 text-right tabular-nums`,children:[Z(t.p50),` / `,Z(t.p95),` / `,Z(t.max)]})]});return(0,Y.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,Y.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[e.count,` `,N()]}),(0,Y.jsxs)(B,{variant:`outline`,size:`sm`,onClick:n,children:[t?(0,Y.jsx)(Ze,{size:13,"aria-hidden":!0}):(0,Y.jsx)(at,{size:13,"aria-hidden":!0}),t?Re():Ie()]})]}),(0,Y.jsxs)(`table`,{className:`w-full text-sm`,children:[(0,Y.jsx)(`thead`,{children:(0,Y.jsxs)(`tr`,{className:`text-left text-muted-foreground`,children:[(0,Y.jsx)(`th`,{className:`py-1 font-medium`,children:l()}),(0,Y.jsx)(`th`,{className:`py-1 text-right font-medium`,children:de()}),(0,Y.jsx)(`th`,{className:`py-1 text-right font-medium`,children:Ke()})]})}),(0,Y.jsxs)(`tbody`,{children:[i(Te(),r.bridge),i(Je(),r.A),i(He(),r.C)]})]}),(0,Y.jsx)(`p`,{className:`oc-admin__hint`,children:Ce()}),e.truncated?(0,Y.jsx)(`p`,{className:`oc-admin__hint`,children:je()}):null,(0,Y.jsx)(`p`,{className:`oc-admin__hint`,children:Oe()})]})}var kt=[50,100,200,500],At=`all`,Q=`__all__`,jt=[`2xx`,`4xx`,`5xx`],Mt=[`user`,`service`,`system`],Nt=[`inbound`,`outbound`,`internal`],Pt={kind:`relative`,from:`now-30d`,to:`now`},Ft=[{value:`kind`,label:`kind`},{value:`status`,label:`status`},{value:`latencyMs`,label:De()},{value:`principalType`,label:Ae()},{value:`direction`,label:`direction`},{value:`roleKey`,label:Fe()},{value:`route`,label:`route`},{value:`correlationId`,label:`correlationId`}];function It(){let e=ot({from:`/settings/traces`}),t=st({from:`/settings/traces`}),n=e.limit,r=e.kind,a=e.statusClass??Q,s=e.principalType??Q,l=e.direction??Q,u=e.roleKey??Q,h=e.q??``,g=ht(e.from,e.to),y=(0,J.useMemo)(()=>mt(e.adv),[e.adv]),{from:te,to:ne}=vt(g),[S,C]=(0,J.useState)(null),[w,T]=(0,J.useState)(null),E=e=>void t({search:t=>({...t,limit:e})}),D=e=>void t({search:t=>({...t,kind:e})}),O=e=>void t({search:t=>({...t,q:e||void 0}),replace:!0}),de=e=>void t({search:t=>({...t,statusClass:e===Q?void 0:e})}),he=e=>void t({search:t=>({...t,principalType:e===Q?void 0:e})}),k=e=>void t({search:t=>({...t,direction:e===Q?void 0:e})}),A=e=>void t({search:t=>({...t,roleKey:e===Q?void 0:e})}),ve=e=>void t({search:t=>({...t,...ct(e)})}),ye=e=>void t({search:t=>({...t,adv:ft(e)}),replace:!0}),j=v(f.observability.listEvents,{limit:n}),xe=v(f.observability.listEvents,{limit:n,kind:r===At?void 0:r,filter:{q:h||void 0,from:te,to:ne,statusClass:a===Q?void 0:a,principalType:s===Q?void 0:s,direction:l===Q?void 0:l,roleKey:u===Q?void 0:u,advanced:y.length>0?y:void 0}}),Ce=(0,J.useMemo)(()=>{let e=new Set;for(let t of j??[])e.add(t.kind);return[...e].sort()},[j]),Te=(0,J.useMemo)(()=>{let e=new Set;for(let t of j??[])t.roleKey&&e.add(t.roleKey);return[...e].sort()},[j]),M=h!==``||a!==Q||s!==Q||l!==Q||u!==Q||y.length>0||g.kind!==`relative`||g.from!==Pt.from;function N(){t({search:{limit:100,kind:`all`},replace:!0})}let P=S?j?.filter(e=>e.correlationId===S):xe,F=e.section,I=e=>void t({search:t=>({...t,section:e}),replace:!0});return(0,Y.jsxs)(et,{value:F,onValueChange:e=>I(e),children:[(0,Y.jsxs)($e,{className:`w-full`,children:[(0,Y.jsxs)(R,{value:`latency`,className:`flex-1 gap-1.5`,children:[(0,Y.jsx)(tt,{size:13,"aria-hidden":!0}),pe()]}),(0,Y.jsxs)(R,{value:`events`,className:`flex-1 gap-1.5`,children:[(0,Y.jsx)(Ct,{size:13,"aria-hidden":!0}),We()]})]}),(0,Y.jsx)(z,{value:`latency`,children:(0,Y.jsx)(Tt,{})}),(0,Y.jsxs)(z,{value:`events`,className:`flex flex-col gap-3`,children:[(0,Y.jsxs)(`p`,{className:`oc-admin__hint`,children:[be(),(0,Y.jsx)(`strong`,{children:x()}),ze(),` `,(0,Y.jsx)(`span`,{className:`oc-filter__window`,children:re()})]}),(0,Y.jsxs)(yt,{q:h,onQChange:O,searchPlaceholder:ee(),timeRange:g,onTimeRangeChange:ve,onReset:N,canReset:M,children:[(0,Y.jsxs)(U,{value:a,onValueChange:de,children:[(0,Y.jsx)(V,{size:`sm`,className:`w-32`,children:(0,Y.jsx)(K,{placeholder:_e()})}),(0,Y.jsxs)(q,{children:[(0,Y.jsx)(H,{value:Q,children:me()}),jt.map(e=>(0,Y.jsx)(H,{value:e,children:e},e))]})]}),(0,Y.jsxs)(U,{value:s,onValueChange:he,children:[(0,Y.jsx)(V,{size:`sm`,className:`w-32`,children:(0,Y.jsx)(K,{placeholder:_()})}),(0,Y.jsxs)(q,{children:[(0,Y.jsx)(H,{value:Q,children:ge()}),Mt.map(e=>(0,Y.jsx)(H,{value:e,children:e},e))]})]}),(0,Y.jsxs)(U,{value:l,onValueChange:k,children:[(0,Y.jsx)(V,{size:`sm`,className:`w-32`,children:(0,Y.jsx)(K,{placeholder:o()})}),(0,Y.jsxs)(q,{children:[(0,Y.jsx)(H,{value:Q,children:Ye()}),Nt.map(e=>(0,Y.jsx)(H,{value:e,children:e},e))]})]}),(0,Y.jsxs)(U,{value:u,onValueChange:A,children:[(0,Y.jsx)(V,{size:`sm`,className:`w-36`,children:(0,Y.jsx)(K,{placeholder:le()})}),(0,Y.jsxs)(q,{children:[(0,Y.jsx)(H,{value:Q,children:ie()}),Te.map(e=>(0,Y.jsx)(H,{value:e,children:e},e))]})]}),(0,Y.jsxs)(U,{value:r,onValueChange:D,children:[(0,Y.jsx)(V,{size:`sm`,className:`w-44`,children:(0,Y.jsx)(K,{placeholder:b()})}),(0,Y.jsxs)(q,{children:[(0,Y.jsx)(H,{value:At,children:m()}),Ce.map(e=>(0,Y.jsx)(H,{value:e,children:e},e))]})]}),(0,Y.jsxs)(U,{value:String(n),onValueChange:e=>E(Number(e)),children:[(0,Y.jsx)(V,{size:`sm`,className:`w-28`,children:(0,Y.jsx)(K,{})}),(0,Y.jsx)(q,{children:kt.map(e=>(0,Y.jsx)(H,{value:String(e),children:ce({count:e})},e))})]})]}),(0,Y.jsx)(bt,{fields:Ft,seed:y,onChange:ye}),S?(0,Y.jsx)(`div`,{className:`oc-traces__followline`,children:(0,Y.jsxs)(`button`,{type:`button`,className:`oc-traces__chip`,onClick:()=>C(null),title:oe(),children:[(0,Y.jsxs)(`span`,{className:`oc-traces__chip-label`,children:[ae(),(0,Y.jsx)(`code`,{children:$(S)})]}),(0,Y.jsx)(Qe,{className:`oc-traces__chip-x`,"aria-hidden":!0}),(0,Y.jsx)(`span`,{className:`sr-only`,children:Me()})]})}):null,(0,Y.jsx)(xt,{title:i(),rows:P,emptyHint:S?Ne():se(),columns:[{header:d(),sort:e=>e.at,cell:e=>(0,Y.jsx)(`span`,{className:`oc-traces__time`,children:G(e.at)})},{header:p(),sort:e=>e.kind,cell:e=>(0,Y.jsx)(W,{variant:`secondary`,children:e.kind})},{header:fe(),sort:e=>Rt(e)??null,cell:e=>{let t=Rt(e);return t?(0,Y.jsxs)(`span`,{className:`oc-traces__fail`,title:t,children:[`✕ `,t]}):(0,Y.jsx)(`span`,{className:`oc-traces__ok`,"aria-label":Ue(),children:`✓`})}},{header:c(),sort:e=>e.direction,cell:e=>e.direction?(0,Y.jsx)(W,{variant:`outline`,children:e.direction}):(0,Y.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})},{header:ue(),sort:e=>e.principalType,cell:e=>(0,Y.jsxs)(`span`,{className:`oc-traces__principal`,children:[(0,Y.jsx)(W,{variant:`outline`,children:e.principalType}),e.principalId?(0,Y.jsx)(`code`,{className:`oc-traces__mono`,children:$(e.principalId)}):null]})},{header:Ge(),sort:e=>e.roleKey,cell:e=>e.roleKey?(0,Y.jsx)(W,{variant:`secondary`,children:e.roleKey}):(0,Y.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})},{header:we(),sort:e=>e.route,cell:e=>e.route?(0,Y.jsxs)(`span`,{className:`oc-traces__route`,children:[e.method?(0,Y.jsx)(`span`,{className:`oc-traces__method`,children:e.method}):null,(0,Y.jsx)(`code`,{className:`oc-traces__mono`,children:e.route})]}):(0,Y.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})},{header:qe(),sort:e=>e.status,cell:e=>e.status===null?(0,Y.jsx)(`span`,{className:`oc-traces__muted`,children:`—`}):(0,Y.jsx)(`span`,{className:`oc-traces__status ${Lt(e.status)}`,children:e.status})},{header:Ve(),sort:e=>e.latencyMs,cell:e=>e.latencyMs===null?(0,Y.jsx)(`span`,{className:`oc-traces__muted`,children:`—`}):(0,Y.jsxs)(`span`,{className:`oc-traces__mono`,children:[e.latencyMs,` ms`]})},{header:Se(),sort:e=>e.correlationId,cell:e=>e.correlationId?(0,Y.jsx)(`button`,{type:`button`,className:`oc-traces__corr`,title:Ee(),onClick:()=>C(e.correlationId),children:$(e.correlationId)}):(0,Y.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})},{header:ke(),sort:e=>+!!e.meta,cell:e=>e.meta?(0,Y.jsx)(B,{variant:`outline`,size:`sm`,onClick:()=>T(e),children:Pe()}):(0,Y.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})}]}),(0,Y.jsx)(zt,{row:w,onClose:()=>T(null)})]})]})}function Lt(e){return e>=500?`oc-traces__status--5xx`:e>=400?`oc-traces__status--4xx`:e>=200&&e<300?`oc-traces__status--2xx`:`oc-traces__status--other`}function $(e){return e.length>8?e.slice(0,8):e}function Rt(e){if(typeof e.status==`number`&&e.status>=400)return String(e.status);if(!e.meta)return null;try{let t=JSON.parse(e.meta);if(e.kind===`openclaw.dispatch`&&t.dispatchStatus===`failed`)return t.errorCode??`failed`;if(e.kind===`assistant.stream`&&t.phase===`finalize`&&(t.streamStatus===`error`||t.streamStatus===`aborted`))return t.streamStatus;if(e.kind===`openclaw.ingest.denied`)return`denied`}catch{}return null}function zt({row:e,onClose:t}){let n=(0,J.useMemo)(()=>{if(!e?.meta)return``;try{return JSON.stringify(JSON.parse(e.meta),null,2)}catch{return e.meta}},[e]);return(0,Y.jsx)(gt,{open:e!==null,onOpenChange:e=>{e||t()},children:e?(0,Y.jsxs)(lt,{className:`max-w-lg`,children:[(0,Y.jsxs)(pt,{children:[(0,Y.jsxs)(dt,{className:`oc-traces__meta-title`,children:[Le(),` `,(0,Y.jsx)(`code`,{children:e.kind}),(0,Y.jsx)(W,{variant:`outline`,children:F()})]}),(0,Y.jsx)(ut,{children:M()})]}),(0,Y.jsx)(`pre`,{className:`oc-traces__meta-json`,children:n})]}):null})}export{It as TracesTab};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{AS as r,Ag as i,CS as a,DS as o,Dg as s,E as c,ES as l,Eg as u,Fg as d,Hj as f,Ig as p,Lg as m,Lx as h,Mg as g,Ng as _,OS as v,Og as y,Pg as b,SS as x,TS as ee,Tg as S,Vj as C,_S as te,aS as ne,bS as re,cS as ie,cu as w,dS as T,fS as E,gS as ae,hS as oe,iS as se,jg as D,kS as O,kg as k,lS as ce,mS as le,nS as ue,oS as de,ou as A,pS as fe,rS as pe,sS as me,su as j,uS as he,vS as ge,wS as M,xS as N,yS as P}from"./dist-TE9n7zkZ.js";import{t as F}from"./button-DK1qmYDJ.js";import{C as I,H as L,Mt as R,Nt as z,S as B,U as _e,W as ve,Xt as ye,Yt as be,at as V,b as H,c as xe,ct as U,dt as Se,ft as Ce,ht as we,it as Te,l as W,mt as Ee,nt as De,p as G,rt as Oe,s as K,st as ke,ut as Ae,w as q,x as J,xt as je}from"./index-ctX_-fgr.js";import{t as Y}from"./FilterBar-BIebILEF.js";import{t as Me}from"./DataTableShell-Cu3JqhO0.js";import{t as Ne}from"./DetailChips-DsU6cc30.js";var X=t(e(),1),Z=n();function Pe({profileId:e,userLabel:t,open:n,onOpenChange:r}){let a=f(c.agents.listAgentPoolForUser,n&&e?{profileId:e}:`skip`),o=f(c.agents.listUserAgents,n&&e?{profileId:e}:`skip`),s=new Set((o??[]).map(e=>`${e.instanceName}/${e.agentId}`)),l=(o??[]).find(e=>e.isDefault)??null,u=l?`${l.instanceName}/${l.agentId}`:null,h=new Set((a?.agents??[]).map(e=>`${e.instanceName}/${e.agentId}`)),g=[...(a?.agents??[]).map(e=>({...e,outOfPool:!1})),...(o??[]).filter(e=>!h.has(`${e.instanceName}/${e.agentId}`)).map(e=>({instanceName:e.instanceName,agentId:e.agentId,displayName:e.displayName,emoji:e.emoji,model:e.model,kind:e.kind,enabled:e.enabled,state:e.state,outOfPool:!0}))],v=new Map;for(let e of g){let t=v.get(e.instanceName)??[];t.push(e),v.set(e.instanceName,t)}return(0,Z.jsx)(Ae,{open:n,onOpenChange:r,children:(0,Z.jsxs)(Se,{className:`oc-access`,children:[(0,Z.jsxs)(Ee,{children:[(0,Z.jsx)(we,{children:m({user:t})}),(0,Z.jsx)(Ce,{children:p()})]}),a?(0,Z.jsx)(`p`,{className:`oc-access__hint`,children:a.inGroup?d():b()}):null,(0,Z.jsx)(`div`,{className:`oc-access__list`,children:a===void 0?(0,Z.jsx)(`p`,{className:`oc-access__hint`,children:_()}):g.length===0?(0,Z.jsx)(`p`,{className:`oc-access__hint`,children:i()}):[...v.entries()].map(([t,n])=>(0,Z.jsx)(Fe,{profileId:e,instanceName:t,kind:n[0].kind,agents:n,assigned:s,defaultKey:u},t))})]})})}function Fe({profileId:e,instanceName:t,kind:n,agents:r,assigned:i,defaultKey:a}){let o=C(c.agents.assignAgent),l=C(c.agents.removeAgent),d=C(c.agents.setDefaultAgent),f=L();if(!e)return null;async function p(n,r){try{r?await l({profileId:e,instanceName:t,agentId:n}):await o({profileId:e,instanceName:t,agentId:n})}catch(e){f.error(g(),e)}}async function m(n){try{await d({profileId:e,instanceName:t,agentId:n})}catch(e){f.error(D(),e)}}return(0,Z.jsxs)(`div`,{className:`oc-access__group`,children:[(0,Z.jsxs)(`div`,{className:`oc-access__instance`,children:[(0,Z.jsx)(z,{size:13,"aria-hidden":!0}),(0,Z.jsx)(`span`,{children:t}),(0,Z.jsx)(U,{variant:`outline`,className:`oc-access__kind`,children:n})]}),r.map(e=>{let n=`${t}/${e.agentId}`,r=i.has(n),o=a===n,c=e.state===`deleted`,l=!e.enabled;return(0,Z.jsxs)(`div`,{className:`oc-access__row${l?` is-disabled`:``}`,children:[(0,Z.jsx)(G,{checked:r,disabled:(c||l)&&!r,onCheckedChange:()=>void p(e.agentId,r),"aria-label":k({name:e.displayName??e.agentId})}),(0,Z.jsxs)(`span`,{className:`oc-access__label`,children:[e.emoji?`${e.emoji} `:``,e.displayName??e.agentId]}),e.model?(0,Z.jsx)(`span`,{className:`oc-access__model`,children:e.model}):null,c?(0,Z.jsx)(U,{variant:`outline`,className:`oc-access__gone`,children:y()}):null,e.outOfPool?(0,Z.jsx)(U,{variant:`outline`,className:`oc-access__gone`,children:s()}):null,r?o?(0,Z.jsx)(`span`,{className:`oc-access__fav`,role:`img`,"aria-label":u(),title:u(),children:(0,Z.jsx)(R,{size:14,fill:`currentColor`})}):(0,Z.jsx)(F,{type:`button`,size:`icon-sm`,variant:`ghost`,className:`oc-access__setdefault`,"aria-label":S(),title:S(),disabled:l,onClick:()=>void m(e.agentId),children:(0,Z.jsx)(R,{size:14})}):null]},e.agentId)})]})}var Q=`__all__`;function $(e){switch(e){case`pending`:return A();case`user`:return j();case`admin`:return w();default:return e}}function Ie({granted:e,onToggle:t}){let n=new Set(e),i=K.filter(e=>n.has(W[e])).length;return(0,Z.jsxs)(De,{children:[(0,Z.jsx)(ke,{asChild:!0,children:(0,Z.jsx)(F,{variant:`outline`,size:`sm`,className:`h-8 w-36 justify-start font-normal`,children:i===0?r():O({count:i})})}),(0,Z.jsxs)(Oe,{align:`start`,className:`w-52`,children:[(0,Z.jsx)(V,{children:v()}),K.map(e=>{let r=W[e];return(0,Z.jsxs)(Te,{className:`gap-2`,onSelect:e=>{e.preventDefault(),t(r)},children:[(0,Z.jsx)(G,{checked:n.has(r),"aria-hidden":!0,tabIndex:-1,className:`pointer-events-none`}),(0,Z.jsx)(`span`,{children:xe[e]()})]},e)})]})]})}function Le(){let e=ye({from:`/settings/users`}),t=be({from:`/settings/users`}),n=e.q??``,r=e.role??Q,i=e=>void t({search:t=>({...t,q:e||void 0}),replace:!0}),s=e=>void t({search:t=>({...t,role:e===Q?void 0:e})}),u=f(c.admin.listUsers,{filter:{q:n||void 0,role:r===Q?void 0:r},withAgents:!0}),d=f(c.me.getMe,{host:je}),p=C(c.admin.setRole),m=C(c.admin.setUserPermissions),g=C(c.admin.startImpersonation),_=C(c.admin.deleteUser),v=C(c.admin.setUserName),y=_e(),b=ve(),S=L(),[w,D]=(0,X.useState)(null),O=(0,X.useMemo)(()=>{let e=new Set([`pending`,`user`,`admin`]);for(let t of u??[])e.add(t.role);return[...e]},[u]),k=n!==``||r!==Q;function A(){t({search:{},replace:!0})}async function j(e){try{await p(e)}catch(e){S.error(o(),e)}}async function F(e){try{await m(e)}catch(e){S.error(l(),e)}}async function R(e){let t=e.email||e.name||e.canonical||e.userId.slice(0,8);if(await y({title:P(),description:ge({user:t}),confirmWord:te(),confirmLabel:ae(),destructive:!0}))try{await _({profileId:e._id}),S.success(le({user:t}))}catch(e){S.error(oe(),e)}}async function V(e){let t=e.email||e.name||e.userId.slice(0,8),n=await b({title:E(),label:T({user:t}),placeholder:he(),defaultValue:e.name??``,confirmLabel:h()});if(n!==null)try{await v({profileId:e._id,name:n}),S.success(ce())}catch(e){S.error(ie(),e)}}return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(Y,{q:n,onQChange:i,searchPlaceholder:ee(),onReset:A,canReset:k,children:(0,Z.jsxs)(H,{value:r,onValueChange:s,children:[(0,Z.jsx)(I,{size:`sm`,className:`w-36`,children:(0,Z.jsx)(q,{})}),(0,Z.jsxs)(J,{children:[(0,Z.jsx)(B,{value:Q,children:M()}),O.map(e=>(0,Z.jsx)(B,{value:e,children:$(e)},e))]})]})}),(0,Z.jsx)(Me,{title:a(),rows:u,emptyHint:x(),rowActions:e=>{let t=[{label:ue(),onSelect:()=>D({profileId:e._id,label:e.email||e.name||e.canonical||e.userId.slice(0,8)})},{label:fe(),onSelect:()=>void V(e)}];return e.userId!==d?.userId&&t.push({label:N(),onSelect:()=>void g({profileId:e._id})},{label:re(),variant:`destructive`,onSelect:()=>void R(e)}),t},columns:[{header:me(),cell:e=>{let t=e.email||e.name||e.canonical||e.userId.slice(0,8),n=e.email&&e.name&&e.name!==e.email?e.name:null;return(0,Z.jsxs)(`div`,{className:`flex flex-col`,children:[(0,Z.jsx)(`span`,{children:t}),n?(0,Z.jsx)(`span`,{className:`text-muted-foreground text-xs`,children:n}):null]})},sort:e=>e.email||e.name||e.canonical||e.userId},{header:de(),sort:e=>e.role===`admin`?2:+(e.role===`user`),cell:e=>(0,Z.jsxs)(H,{value:e.role,onValueChange:t=>void j({profileId:e._id,role:t}),children:[(0,Z.jsx)(I,{size:`sm`,className:`w-28`,children:(0,Z.jsx)(q,{})}),(0,Z.jsxs)(J,{children:[(0,Z.jsx)(B,{value:`pending`,children:$(`pending`)}),(0,Z.jsx)(B,{value:`user`,children:$(`user`)}),(0,Z.jsx)(B,{value:`admin`,children:$(`admin`)})]})]})},{header:ne(),sort:e=>e.role===`admin`?9999:e.extraPermissions?.length??0,cell:e=>e.role===`admin`?(0,Z.jsx)(`span`,{className:`text-muted-foreground text-xs`,children:se()}):(0,Z.jsx)(Ie,{granted:e.extraPermissions??[],onToggle:t=>{let n=new Set(e.extraPermissions??[]);n.has(t)?n.delete(t):n.add(t),F({profileId:e._id,permissions:[...n]})}})},{header:pe(),cell:e=>(0,Z.jsx)(Ne,{icon:(0,Z.jsx)(z,{size:12,"aria-hidden":!0}),total:e.agentCount??0,items:e.agents.map(e=>({label:e}))}),sort:e=>e.agentCount??0}]}),(0,Z.jsx)(Pe,{profileId:w?.profileId??null,userLabel:w?.label??``,open:w!==null,onOpenChange:e=>{e||D(null)}})]})}export{Le as UsersTab};
|