@lacneu/atrium 0.44.2 → 0.45.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-BddH78dE.js → AccessTab-CeM6DU3j.js} +1 -1
- package/dist/assets/{AdvancedFilter-BtBFrOvl.js → AdvancedFilter-DTbUf7Uh.js} +1 -1
- package/dist/assets/AgentFilesTab-CMkpQWSX.js +3 -0
- package/dist/assets/AnomaliesTab-D0i-H1F-.js +1 -0
- package/dist/assets/AuditTab-BGkuzfTz.js +1 -0
- package/dist/assets/BridgeTab-RQWxNBYu.js +1 -0
- package/dist/assets/ChatDefaultsTab-CsSF3H0g.js +1 -0
- package/dist/assets/{DataTableShell-CKQRa8xi.js → DataTableShell-Cu3JqhO0.js} +1 -1
- package/dist/assets/{DetailChips-d1Fs61TW.js → DetailChips-DsU6cc30.js} +1 -1
- package/dist/assets/FeedbacksTab-BjSu8m8B.js +1 -0
- package/dist/assets/{FieldLabel-BPj-rFdV.js → FieldLabel-CK9i2-CR.js} +2 -2
- package/dist/assets/FilesTab-VunHJ3Lm.js +1 -0
- package/dist/assets/{FilterBar-Bub5nUxA.js → FilterBar-BIebILEF.js} +1 -1
- package/dist/assets/GroupsTab-CdZIVswx.js +1 -0
- package/dist/assets/InstancesTab-CTiBjGZm.js +1 -0
- package/dist/assets/IntegrationsTab-BFgO7Lv0.js +1 -0
- package/dist/assets/KpiTab-CUvEA1Vs.js +1 -0
- package/dist/assets/PreferencesTab-B4SJqQ6Q.js +1 -0
- package/dist/assets/PromptInjectionsTab-iWFE9MNO.js +4 -0
- package/dist/assets/RolesTab-BBIaufnh.js +1 -0
- package/dist/assets/ServiceAccountsTab-JBIFWSDh.js +1 -0
- package/dist/assets/SubAgentReportsTab-VpnYYzS8.js +1 -0
- package/dist/assets/ThemeShowroom-3hLnrfvP.js +1 -0
- package/dist/assets/{TimeRangePicker-CbbfR2tN.js → TimeRangePicker-NNSu8mCt.js} +1 -1
- package/dist/assets/TracesTab-pFMHb6OV.js +1 -0
- package/dist/assets/UsersTab-CQyH6-vc.js +1 -0
- package/dist/assets/VoiceTab-CPXr9SEe.js +1 -0
- package/dist/assets/{button-CtB6NRj2.js → button-DK1qmYDJ.js} +1 -1
- package/dist/assets/{card-CsumpaGg.js → card-D0s3oDw3.js} +1 -1
- package/dist/assets/chevrons-up-down-DOso-2c4.js +1 -0
- package/dist/assets/{compatView-BA0_AW-d.js → compatView-D2caU8vq.js} +1 -1
- package/dist/assets/dispatchErrorInfo-evHHi1jG.js +1 -0
- package/dist/assets/{dist-9jdLReLO.js → dist-8uYlaw3Q.js} +1 -1
- package/dist/assets/{dist-qHCi9114.js → dist-Ciwp9Ovi.js} +1 -1
- package/dist/assets/{dist-DEMXTO86.js → dist-DCABHmKq.js} +1 -1
- package/dist/assets/{dist-tr7LmvAR.js → dist-TE9n7zkZ.js} +5 -5
- package/dist/assets/{highlighted-body-OFNGDK62-DwZl6YUf.js → highlighted-body-OFNGDK62-DSUwEB_f.js} +1 -1
- package/dist/assets/{index-DOTJd3Hv.css → index-BdrBbL7i.css} +1 -1
- package/dist/assets/index-ctX_-fgr.js +233 -0
- package/dist/assets/mermaid-GHXKKRXX-DWoP8Llb.js +1 -0
- package/dist/assets/pdf-Bkk0DZGy.js +54 -0
- package/dist/assets/pdf.worker.min-DEtVeC4l.mjs +29 -0
- package/dist/assets/roleDescriptions-CCsDWcXg.js +1 -0
- package/dist/assets/{table-CFZX8hqf.js → table-EwCph6eW.js} +1 -1
- package/dist/assets/{tabs-CtMWQedT.js → tabs-oKL6bnDA.js} +1 -1
- package/dist/assets/x-C-AIvdVt.js +1 -0
- package/dist/index.html +8 -8
- package/package.json +2 -1
- package/dist/assets/AgentFilesTab-BjHjDtke.js +0 -3
- package/dist/assets/AnomaliesTab-DAN7LLc6.js +0 -1
- package/dist/assets/AuditTab-DU5zjRhf.js +0 -1
- package/dist/assets/BridgeTab-DcrewE6Z.js +0 -1
- package/dist/assets/ChatDefaultsTab-DSKzve06.js +0 -1
- package/dist/assets/FeedbacksTab-DwGLKFXT.js +0 -1
- package/dist/assets/FilesTab-DxfG8nYK.js +0 -1
- package/dist/assets/GroupsTab-Dsx_XQEy.js +0 -1
- package/dist/assets/InstancesTab-BXqrC-D1.js +0 -1
- package/dist/assets/IntegrationsTab-BIAS3k_T.js +0 -1
- package/dist/assets/KpiTab-CdCLnM_D.js +0 -1
- package/dist/assets/PreferencesTab-DWr9Jyo2.js +0 -1
- package/dist/assets/PromptInjectionsTab-CF4hweHp.js +0 -4
- package/dist/assets/RolesTab-Bxgrordg.js +0 -1
- package/dist/assets/ServiceAccountsTab-i2yfZcVV.js +0 -1
- package/dist/assets/SubAgentReportsTab-D7F5pCxg.js +0 -1
- package/dist/assets/ThemeShowroom-BKUg_qk5.js +0 -1
- package/dist/assets/TracesTab-DUUin7PU.js +0 -1
- package/dist/assets/UsersTab-BTlChquo.js +0 -1
- package/dist/assets/VoiceTab-Dh3iSyb5.js +0 -1
- package/dist/assets/chevrons-up-down-B1FpM2AK.js +0 -1
- package/dist/assets/dispatchErrorInfo-BuUObQq-.js +0 -1
- package/dist/assets/index-D3n1_9Fa.js +0 -233
- package/dist/assets/mermaid-GHXKKRXX-TX3_lP0K.js +0 -1
- package/dist/assets/roleDescriptions-BzNYOzCY.js +0 -1
- package/dist/assets/x-BsTPtFiQ.js +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{Cy as e,Sy as t,Ty as n,wy as r,xy as i}from"./dist-TE9n7zkZ.js";var a={pending:n,user:r,admin:e,observer:t,agent:i};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-TE9n7zkZ.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-TE9n7zkZ.js";import{t as d}from"./dist-DCABHmKq.js";import{Dt as f,Et as p,Ot as m}from"./index-ctX_-fgr.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-TE9n7zkZ.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,15 +53,15 @@
|
|
|
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-ctX_-fgr.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-
|
|
64
|
-
<link rel="stylesheet" crossorigin href="/assets/index-
|
|
58
|
+
<link rel="modulepreload" crossorigin href="/assets/dist-TE9n7zkZ.js">
|
|
59
|
+
<link rel="modulepreload" crossorigin href="/assets/dist-DCABHmKq.js">
|
|
60
|
+
<link rel="modulepreload" crossorigin href="/assets/dist-Ciwp9Ovi.js">
|
|
61
|
+
<link rel="modulepreload" crossorigin href="/assets/dist-8uYlaw3Q.js">
|
|
62
|
+
<link rel="modulepreload" crossorigin href="/assets/x-C-AIvdVt.js">
|
|
63
|
+
<link rel="modulepreload" crossorigin href="/assets/button-DK1qmYDJ.js">
|
|
64
|
+
<link rel="stylesheet" crossorigin href="/assets/index-BdrBbL7i.css">
|
|
65
65
|
</head>
|
|
66
66
|
<body>
|
|
67
67
|
<div id="root"></div>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lacneu/atrium",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.45.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",
|
|
@@ -47,6 +47,7 @@
|
|
|
47
47
|
"clsx": "^2.1.1",
|
|
48
48
|
"convex": "^1.39.1",
|
|
49
49
|
"lucide-react": "^1.17.0",
|
|
50
|
+
"pdfjs-dist": "^6.1.200",
|
|
50
51
|
"radix-ui": "^1.4.3",
|
|
51
52
|
"react": "^19.2.6",
|
|
52
53
|
"react-dom": "^19.2.6",
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$c as r,$s as i,Cj as a,Cr as o,E as s,Gn as c,Gs as l,Jn as u,Js as d,Kn as f,Ks as p,Qs as m,Sj as h,Sr as g,Us as _,Wn as v,Ws as y,Xn as b,Xs as x,Yn as S,Ys as C,Zs as w,_c as T,_r as E,ac as D,ar as O,bj as k,br as ee,cc as A,cr as j,dc as te,dr as M,ec as N,fc as ne,fr as P,gc as F,gj as I,gr as L,hc as re,hr as R,ic as ie,ir as z,lc as B,lr as V,mc as ae,mj as H,mr as U,nc as oe,oc as se,or as ce,pc as le,pr as ue,qn as de,qs as fe,rE as pe,rc as me,rr as he,sc as ge,sr as _e,tc as ve,tl as W,uc as ye,ur as be,vc as xe,vr as G,xr as Se,yr as Ce}from"./dist-tr7LmvAR.js";import{t as K}from"./button-CtB6NRj2.js";import{C as we,G as Te,J as Ee,K as De,S as Oe,V as q,W as ke,X as Ae,Y as je,Z as Me,b as Ne,bt as Pe,dt as Fe,kt as J,lt as Ie,mt as Le,pt as Re,q as ze,st as Be,ut as Ve,w as He,x as Ue,y as We}from"./index-D3n1_9Fa.js";import{n as Ge,t as Ke}from"./curation-CQksaIbm.js";import{i as qe}from"./compatView-BA0_AW-d.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=a(s.me.getMe,{host:Pe}),t=e?.role===`admin`,n=(e?.permissions??[]).includes(`bridge.read`),i=a(s.admin.listInstances,e!==void 0&&t?{}:`skip`),[o,c]=(0,Y.useState)(null);(0,Y.useEffect)(()=>{!t||!i||i.length===0||(!o||!i.some(e=>e.name===o))&&c(i[0].name)},[t,i,o]);let l=a(s.agents.listAgentsForInstance,t&&o?{instanceName:o}:`skip`),u=a(s.agents.listMyAgents,e!==void 0&&!t?{}:`skip`),d=(0,Y.useMemo)(()=>{if(e!==void 0){if(t)return o===null||l===void 0?i!==void 0&&i.length===0?[]:void 0:l.agents.map(e=>({instanceName:o,agentId:e.agentId,label:`${e.emoji?`${e.emoji} `:``}${e.displayName??e.agentId}`}));if(u!==void 0)return u.map(e=>({instanceName:e.instanceName,agentId:e.agentId,label:`${e.emoji?`${e.emoji} `:``}${e.displayName??e.agentId}`}))}},[e,t,o,l,i,u]),[f,p]=(0,Y.useState)(null);(0,Y.useEffect)(()=>{!d||d.length===0||(!f||!d.some(e=>$(e)===f))&&p($(d[0]))},[d,f]);let m=d?.find(e=>$(e)===f)??null,h=k(s.agentFiles.listAgentFiles),[g,_]=(0,Y.useState)({status:`idle`}),v=m?.instanceName??null,y=m?.agentId??null,b=a(s.compat.forInstance,n&&v!==null?{instanceName:v}:`skip`),x=n&&v!==null?We(b,`agentFiles`):null,S=x===null?!1:x===`loading`?null:x.blocked,C=(0,Y.useCallback)(async()=>{if(!(v===null||y===null)){_({status:`loading`});try{_({status:`done`,files:(await h({instanceName:v,agentId:y})).files})}catch{_({status:`error`})}}},[h,v,y]);(0,Y.useEffect)(()=>{S===!1&&C()},[C,S]);let[w,E]=(0,Y.useState)(null),D=a(s.agentFileCuration.listCurations,t&&v!==null&&y!==null?{instanceName:v,agentId:y}:`skip`),O=a(s.agentFileCuration.curationSettings,t&&v!==null?{instanceName:v}:`skip`),j=k(s.agentFileCuration.requestCuration),[M,N]=(0,Y.useState)(null),[P,L]=(0,Y.useState)(null),{toast:R}=q(),ie=(0,Y.useMemo)(()=>{let e=new Map;for(let t of D??[])e.has(t.name)||e.set(t.name,t);return e},[D]),z=(0,Y.useCallback)(async e=>{if(!(v===null||y===null)){N(e);try{let t=await j({instanceName:v,agentId:y,name:e,trigger:`manual`});t.ok?R({title:ee(),variant:`success`}):R({title:Ce({reason:t.reason??`unknown`}),variant:`error`})}catch{R({title:G(),variant:`error`})}finally{N(null)}}},[j,v,y,R]),V=I(),U=(0,Y.useMemo)(()=>new Intl.NumberFormat(V,{maximumFractionDigits:0}),[V]);return e===void 0||d===void 0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:H()}):(0,Q.jsxs)(`div`,{className:`oc-afiles`,children:[(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:xe()}),(0,Q.jsxs)(`div`,{className:`oc-afiles__picker`,children:[t&&(i?.length??0)>1?(0,Q.jsxs)(Ne,{value:o??``,onValueChange:e=>c(e),children:[(0,Q.jsx)(we,{size:`sm`,"aria-label":T(),children:(0,Q.jsx)(He,{})}),(0,Q.jsx)(Ue,{children:(i??[]).map(e=>(0,Q.jsx)(Oe,{value:e.name,children:e.name},e.name))})]}):null,d.length>0?(0,Q.jsxs)(Ne,{value:f??``,onValueChange:e=>p(e),children:[(0,Q.jsx)(we,{size:`sm`,"aria-label":F(),children:(0,Q.jsx)(He,{})}),(0,Q.jsx)(Ue,{children:d.map(e=>(0,Q.jsx)(Oe,{value:$(e),children:e.label},$(e)))})]}):(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:re()})]}),m===null?null:x===`loading`?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:H()}):x!==null&&x.blocked?(0,Q.jsxs)(`p`,{className:`oc-compat__blocked`,role:`status`,children:[(0,Q.jsx)(J,{size:14,"aria-hidden":!0}),` `,qe(x.gatewayVersion,x.provider)]}):g.status===`loading`||g.status===`idle`?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:H()}):g.status===`error`?(0,Q.jsxs)(`p`,{className:`oc-afiles__error`,role:`alert`,children:[le(),` `,(0,Q.jsx)(K,{variant:`outline`,size:`sm`,onClick:()=>void C(),children:r()})]}):g.files.length===0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:ae()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`div`,{className:`oc-afiles__list`,children:g.files.map(e=>{let n=Ye(e.size),r=n>=80;return(0,Q.jsxs)(`div`,{className:`oc-afiles__row`,children:[(0,Q.jsx)(`span`,{className:`oc-afiles__name`,title:e.name,children:e.name}),e.missing?(0,Q.jsx)(Be,{variant:`outline`,children:ne()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`span`,{className:`oc-afiles__size`,children:te({size:Z(e.size,V)})}),(0,Q.jsx)(`span`,{className:`oc-afiles__gauge${r?` is-warn`:``}`,"aria-hidden":!0,children:(0,Q.jsx)(`span`,{className:`oc-afiles__gauge-fill`,style:{width:`${Math.min(n,100)}%`}})}),(0,Q.jsx)(`span`,{className:`oc-afiles__pct`,children:ye({pct:U.format(n)})}),r?(0,Q.jsx)(J,{size:14,className:`oc-afiles__warn`,"aria-label":B()}):(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:()=>E(e),children:t?ge():se()}),t&&!e.missing?(0,Q.jsx)(nt,{curatable:Ke.includes(e.name),size:e.size??0,budget:O?.budgetChars??null,enabled:O?.enabled??!1,curation:ie.get(e.name)??null,inFlight:M===e.name,onCurate:()=>void z(e.name),onReview:e=>L(e)}):null]},e.name)})}),(0,Q.jsx)(`p`,{className:`oc-afiles__budget`,children:A({used:Z(Ze(g.files),V),total:Z(Je,V),pct:U.format(Xe(Ze(g.files)))})})]}),w&&m?(0,Q.jsx)(rt,{instanceName:m.instanceName,agentId:m.agentId,name:w.name,isAdmin:t,onClose:()=>E(null),onSaved:()=>void C()}):null,P?(0,Q.jsx)(it,{curationId:P,onClose:()=>L(null),onApplied:()=>{L(null),C()}}):null]})}function nt({curatable:e,size:t,budget:n,enabled:r,curation:i,inFlight:a,onCurate:s,onReview:c}){return i?.status===`proposed`?(0,Q.jsx)(K,{variant:`default`,size:`sm`,className:`oc-afiles__curate`,onClick:()=>c(i._id),children:g()}):a||i?.status===`dispatched`||i?.status===`applying`?(0,Q.jsx)(Be,{variant:`outline`,className:`oc-afiles__curate-status`,children:Se()}):e&&r&&n!==null&&Ge(t,n)?(0,Q.jsx)(K,{variant:`outline`,size:`sm`,className:`oc-afiles__curate`,onClick:s,children:o()}):null}function rt({instanceName:e,agentId:t,name:n,isAdmin:a,onClose:o,onSaved:c}){let u=k(s.agentFiles.getAgentFile),f=k(s.agentFiles.setAgentFile),h=q(),[g,v]=(0,Y.useState)(null),[b,S]=(0,Y.useState)(!1),[T,E]=(0,Y.useState)(``),[O,ee]=(0,Y.useState)(!1),[A,j]=(0,Y.useState)(!1),[te,M]=(0,Y.useState)(!1),[ne,P]=(0,Y.useState)(!1),F=(0,Y.useCallback)(async r=>{S(!1);try{let i=await u({instanceName:e,agentId:t,name:n});v({content:i.content,updatedAtMs:i.updatedAtMs}),r||E(i.content),M(!1)}catch{S(!0)}},[u,e,t,n]);(0,Y.useEffect)(()=>{F(!1)},[F]);async function L(){if(g!==null){j(!0),P(!1);try{await f({instanceName:e,agentId:t,name:n,content:T,baseUpdatedAtMs:g.updatedAtMs??void 0}),h.success(i({name:n})),c(),await F(!1)}catch(e){et(e)?M(!0):P(!0)}finally{j(!1)}}}let re=g!==null&&T!==g.content,R=(0,Y.useMemo)(()=>g===null?null:$e(g.content,T),[g,T]),z=T.length>X,B=I(),V=(0,Y.useMemo)(()=>new Intl.NumberFormat(B),[B]);return(0,Q.jsx)(Ie,{open:!0,onOpenChange:e=>!e&&o(),children:(0,Q.jsxs)(Ve,{className:`oc-afiles__editor`,children:[(0,Q.jsxs)(Re,{children:[(0,Q.jsx)(Le,{children:D({name:n})}),(0,Q.jsxs)(Fe,{children:[ie({agent:t,instance:e}),a?null:(0,Q.jsxs)(Q.Fragment,{children:[` · `,me()]})]})]}),b?(0,Q.jsxs)(`p`,{className:`oc-afiles__error`,role:`alert`,children:[w(),` `,(0,Q.jsx)(K,{variant:`outline`,size:`sm`,onClick:()=>void F(!1),children:r()})]}):g===null?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:H()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`textarea`,{className:`oc-afiles__source`,value:T,readOnly:!a,spellCheck:!1,onChange:e=>E(e.target.value),"aria-label":D({name:n})}),(0,Q.jsx)(`p`,{className:`oc-afiles__hint`,children:oe()}),te?(0,Q.jsxs)(`p`,{className:`oc-afiles__error`,role:`alert`,children:[x(),` `,(0,Q.jsx)(K,{variant:`outline`,size:`sm`,onClick:()=>void F(!0),children:C()})]}):null,ne?(0,Q.jsx)(`p`,{className:`oc-afiles__error`,role:`alert`,children:m()}):null,(0,Q.jsxs)(`div`,{className:`oc-afiles__editor-foot`,children:[(0,Q.jsx)(`span`,{className:`oc-afiles__count${z?` is-over`:``}`,children:ve({count:V.format(T.length),max:V.format(X)})}),a?(0,Q.jsx)(K,{size:`sm`,disabled:!re||A||te,onClick:()=>ee(!0),children:A?W():N()}):null]})]}),(0,Q.jsx)(ke,{open:O,onOpenChange:ee,children:(0,Q.jsxs)(ze,{children:[(0,Q.jsxs)(Ae,{children:[(0,Q.jsx)(Me,{children:d({name:n})}),(0,Q.jsx)(Ee,{children:fe({agent:t})})]}),R?(0,Q.jsxs)(`div`,{className:`oc-afiles__diff`,children:[(0,Q.jsx)(`p`,{className:`oc-afiles__diff-counts`,children:p({added:R.added,removed:R.removed})}),R.sampleAdded.length>0?(0,Q.jsxs)(`div`,{className:`oc-afiles__diff-block`,children:[(0,Q.jsx)(`span`,{className:`oc-afiles__diff-label`,children:l()}),R.sampleAdded.map((e,t)=>(0,Q.jsx)(`code`,{className:`oc-afiles__diff-line is-add`,children:e||` `},t))]}):null,R.sampleRemoved.length>0?(0,Q.jsxs)(`div`,{className:`oc-afiles__diff-block`,children:[(0,Q.jsx)(`span`,{className:`oc-afiles__diff-label`,children:y()}),R.sampleRemoved.map((e,t)=>(0,Q.jsx)(`code`,{className:`oc-afiles__diff-line is-del`,children:e||` `},t))]}):null]}):null,(0,Q.jsxs)(je,{children:[(0,Q.jsx)(De,{children:pe()}),(0,Q.jsx)(Te,{onClick:()=>void L(),children:_()})]})]})})]})})}function it({curationId:e,onClose:t,onApplied:n}){let r=a(s.agentFileCuration.getProposal,{curationId:e}),i=k(s.agentFileCuration.approveCuration),o=h(s.agentFileCuration.rejectCuration),{toast:l}=q(),[d,p]=(0,Y.useState)(null),[m,g]=(0,Y.useState)(!1),[_,y]=(0,Y.useState)(``),x=I(),C=(0,Y.useMemo)(()=>r?$e(r.beforeContent,r.proposedContent):null,[r]);async function w(){p(`approve`);try{let t=await i({curationId:e});t.ok?(l({title:E(),variant:`success`}),n()):l({title:t.reason===`conflict`?R():U({reason:t.reason??`unknown`}),variant:`error`})}catch{l({title:G(),variant:`error`})}finally{p(null)}}async function T(n){p(`reject`);try{let r=_.trim();(await o({curationId:e,...r?{comment:r}:{},relaunch:n})).ok?l({title:n?c():L(),variant:`success`}):l({title:M(),variant:`error`}),t()}catch{l({title:G(),variant:`error`})}finally{p(null)}}return(0,Q.jsx)(Ie,{open:!0,onOpenChange:e=>e?void 0:t(),children:(0,Q.jsxs)(Ve,{className:`oc-afiles__review`,children:[(0,Q.jsxs)(Re,{children:[(0,Q.jsx)(Le,{children:r?ue({name:r.name}):H()}),(0,Q.jsx)(Fe,{children:P()})]}),r===void 0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:H()}):r===null?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:M()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`p`,{className:`oc-afiles__review-sizes`,children:[be({before:Z(r.beforeSize,x),after:Z(r.proposedSize,x)}),r.overBudget?(0,Q.jsxs)(Q.Fragment,{children:[` `,(0,Q.jsx)(J,{size:13,"aria-hidden":!0}),` `,V()]}):null]}),C?(0,Q.jsx)(`p`,{className:`oc-afiles__review-diff`,children:j({added:C.added,removed:C.removed})}):null,r.feedback?(0,Q.jsx)(`p`,{className:`oc-afiles__review-feedback`,children:v({feedback:r.feedback})}):null,C&&C.sampleRemoved.length>0?(0,Q.jsxs)(`div`,{className:`oc-afiles__review-removed`,children:[(0,Q.jsx)(`p`,{className:`oc-afiles__review-label`,children:he()}),(0,Q.jsx)(`ul`,{children:C.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:z()}),(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:_e()}),(0,Q.jsx)(`pre`,{className:`oc-afiles__review-pre`,children:r.proposedContent})]})]})]}),m?(0,Q.jsxs)(`div`,{className:`oc-afiles__reject-form`,children:[(0,Q.jsx)(`label`,{className:`oc-afiles__review-label`,htmlFor:`curation-reject-comment`,children:b()}),(0,Q.jsx)(`textarea`,{id:`curation-reject-comment`,className:`oc-afiles__reject-textarea`,rows:3,placeholder:S(),value:_,onChange:e=>y(e.target.value)}),(0,Q.jsxs)(`div`,{className:`oc-afiles__review-actions`,children:[(0,Q.jsx)(K,{variant:`ghost`,onClick:()=>g(!1),disabled:d!==null,children:u()}),(0,Q.jsx)(K,{variant:`outline`,onClick:()=>void T(!1),disabled:d!==null,children:d===`reject`?W():de()}),(0,Q.jsx)(K,{variant:`default`,onClick:()=>void T(!0),disabled:d!==null,children:d===`reject`?W():f()})]})]}):(0,Q.jsxs)(`div`,{className:`oc-afiles__review-actions`,children:[(0,Q.jsx)(K,{variant:`outline`,onClick:()=>g(!0),disabled:d!==null||r==null,children:ce()}),(0,Q.jsx)(K,{variant:`default`,onClick:()=>void w(),disabled:d!==null||r==null,children:d===`approve`?W():O()})]})]})})}export{tt as AgentFilesTab};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Av as r,Bv as i,Cj as a,Cv as o,Dv as ee,E as s,Ev as c,Fv as te,Gv as l,Hv as ne,Iv as u,Kv as d,Lv as f,Mv as p,Nv as m,Ov as h,Pv as re,Rv as ie,Sj as ae,Sv as oe,Tv as se,Uv as ce,Vv as le,Wv as g,_v as ue,av as _,bv as de,cv as fe,dv as pe,fv as me,gv as he,hv as ge,iv as v,jv as _e,kv as y,lv as b,mv as x,ov as S,pv as C,sv as w,uv as T,vv as E,wv as D,xv as O,yv as k,zv as A}from"./dist-tr7LmvAR.js";import{A as j,C as M,H as N,Jt as P,S as F,V as I,a as ve,b as L,bt as ye,qt as R,r as be,st as z,w as B,x as V}from"./index-D3n1_9Fa.js";import{n as xe}from"./TimeRangePicker-CbbfR2tN.js";import{t as Se}from"./FilterBar-Bub5nUxA.js";import{t as Ce}from"./DataTableShell-CKQRa8xi.js";import{t as H}from"./dispatchErrorInfo-BuUObQq-.js";var U=t(e(),1),W=n(),G=`__all__`,we=[{value:`open`},{value:`acknowledged`},{value:`resolved`}];function Te(e){return e===`open`?d():e===`acknowledged`?l():g()}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=P({from:`/settings/anomalies`}),t=R({from:`/settings/anomalies`}),n=e.q??``,l=e.status===K?G:e.status,d=e.severity??G,g=e.kind??G,[_,v]=(0,U.useState)(G),S=be(e.from,e.to),{from:w,to:H}=xe(S),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,...ve(e)})}),Ie=N(),X=I(),Z=ae(s.anomalies.resolveAnomaly),Le=(a(s.me.getMe,{host:ye})?.permissions??[]).includes(`admin.manage`),Q=a(s.anomalies.listAnomalies,{limit:ke,filter:{q:n||void 0,from:w,to:H,anomalyStatus:l===G?void 0:l,severity:d===G?void 0:d,source:_===G?void 0:_,kind:g===G?void 0:g}}),$=(0,U.useMemo)(()=>{let e=new Set;for(let t of Q??[])e.add(t.kind);return[...e].sort()},[Q]),Re=n!==``||l!==`open`||d!==G||_!==G||g!==G||S.kind!==`relative`||S.from!==Oe.from;function ze(){v(G),t({search:{status:`open`},replace:!0})}async function Be(e){if(await Ie({title:ce(),description:(0,W.jsxs)(W.Fragment,{children:[ne(),` `,(0,W.jsx)(`span`,{className:`font-mono`,children:e.kind}),` `,le(),` `,(0,W.jsx)(`strong`,{children:i()}),`.`,` `,A()]}),confirmLabel:ie()}))try{await Z({anomalyId:e._id,status:`resolved`}),X.success(f(),e.kind)}catch(e){X.error(u(),e)}}async function Ve(e){try{await Z({anomalyId:e._id,status:`acknowledged`}),X.success(te(),e.kind)}catch(e){X.error(re(),e)}}return(0,W.jsxs)(W.Fragment,{children:[(0,W.jsxs)(`p`,{className:`oc-admin__hint`,children:[m(),` `,(0,W.jsx)(`strong`,{children:p()}),` `,_e(),` `,(0,W.jsx)(`strong`,{children:r()}),` `,y(),` `,(0,W.jsx)(`strong`,{children:h()}),` `,ee(),` `,(0,W.jsx)(`span`,{className:`oc-filter__window`,children:c()})]}),(0,W.jsxs)(Se,{q:n,onQChange:q,searchPlaceholder:se(),timeRange:S,onTimeRangeChange:Fe,onReset:ze,canReset:Re,children:[(0,W.jsxs)(L,{value:l,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)(F,{value:G,children:D()}),we.map(e=>(0,W.jsx)(F,{value:e.value,children:Te(e.value)},e.value))]})]}),(0,W.jsxs)(L,{value:d,onValueChange:Y,children:[(0,W.jsx)(M,{size:`sm`,className:`w-36`,children:(0,W.jsx)(B,{placeholder:o()})}),(0,W.jsxs)(V,{children:[(0,W.jsx)(F,{value:G,children:oe()}),Ee.map(e=>(0,W.jsx)(F,{value:e,children:e},e))]})]}),(0,W.jsxs)(L,{value:_,onValueChange:v,children:[(0,W.jsx)(M,{size:`sm`,className:`w-32`,children:(0,W.jsx)(B,{placeholder:O()})}),(0,W.jsxs)(V,{children:[(0,W.jsx)(F,{value:G,children:de()}),De.map(e=>(0,W.jsx)(F,{value:e,children:e},e))]})]}),(0,W.jsxs)(L,{value:g,onValueChange:Pe,children:[(0,W.jsx)(M,{size:`sm`,className:`w-36`,children:(0,W.jsx)(B,{placeholder:k()})}),(0,W.jsxs)(V,{children:[(0,W.jsx)(F,{value:G,children:E()}),$.map(e=>(0,W.jsx)(F,{value:e,children:e},e))]})]})]}),(0,W.jsx)(Ce,{title:ue(),rows:Q,emptyHint:l===`open`?he():ge(),rowActions:e=>Le&&e.status===`open`?[{label:x(),onSelect:()=>void Be(e)},{label:C(),onSelect:()=>void Ve(e)}]:[],columns:[{header:me(),cell:e=>(0,W.jsx)(`span`,{className:`oc-traces__time`,children:j(e.at)}),sort:e=>e.at},{header:k(),cell:e=>(0,W.jsx)(`code`,{className:`oc-traces__mono`,children:e.kind}),sort:e=>e.kind},{header:o(),cell:e=>(0,W.jsx)(je,{severity:e.severity}),sort:e=>e.severity===`critical`?2:+(e.severity===`warn`)},{header:pe(),cell:e=>(0,W.jsx)(Me,{status:e.status}),sort:e=>e.status===`resolved`?2:+(e.status===`acknowledged`)},{header:O(),cell:e=>(0,W.jsx)(z,{variant:`outline`,children:e.source}),sort:e=>e.source},{header:T(),cell:e=>(0,W.jsx)(`span`,{className:`oc-anomaly__msg`,children:e.message}),sort:e=>e.message},{header:b(),cell:e=>(0,W.jsx)(Ae,{row:e}),sort:e=>e.evidence??null},{header:fe(),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=R();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:[`↗ `,w()]}):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:[`↗ `,w()]}):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:S()}):e===`acknowledged`?(0,W.jsx)(z,{variant:`secondary`,children:_()}):(0,W.jsx)(z,{variant:`outline`,children:v()})}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{By as r,Cj as i,E as a,Gy as o,Hy as s,Jy as c,Ky as l,Ly as u,Ry as d,Sn as f,Uy as p,Vy as m,Wy as h,Xy as g,Yy as _,Zy as v,_n as y,bn as b,qy as x,vn as S,xn as C,yn as w,zy as T}from"./dist-tr7LmvAR.js";import{A as E,C as D,Jt as O,S as k,a as A,b as j,i as M,o as N,qt as P,r as F,t as I,w as L,x as R}from"./index-D3n1_9Fa.js";import{n as ee}from"./TimeRangePicker-CbbfR2tN.js";import{t as z}from"./FilterBar-Bub5nUxA.js";import{t as B}from"./AdvancedFilter-BtBFrOvl.js";import{t as V}from"./DataTableShell-CKQRa8xi.js";var H=t(e(),1),U=n(),W={kind:`relative`,from:I,to:`now`},G=`__all__`,K=[{value:`action`,label:f()},{value:`realLabel`,label:C()},{value:`targetLabel`,label:b()},{value:`impersonated`,label:w()},{value:`resource`,label:S()},{value:`resourceId`,label:y()}];function q(){let e=O({from:`/settings/audit`}),t=P({from:`/settings/audit`}),n=e.q??``,f=e.action??G,y=e.impersonated??G,b=e.resource??G,S=F(e.from,e.to),C=(0,H.useMemo)(()=>N(e.adv),[e.adv]),{from:w,to:I}=ee(S),q=e=>void t({search:t=>({...t,q:e||void 0}),replace:!0}),J=e=>void t({search:t=>({...t,action:e===G?void 0:e})}),Y=e=>void t({search:t=>({...t,impersonated:e===G?void 0:e})}),X=e=>void t({search:t=>({...t,resource:e===G?void 0:e})}),Z=e=>void t({search:t=>({...t,...A(e)})}),Q=e=>void t({search:t=>({...t,adv:M(e)}),replace:!0}),$=i(a.admin.listAudit,{filter:{q:n||void 0,from:w,to:I,action:f===G?void 0:f,resource:b===G?void 0:b,impersonated:y===G?void 0:y===`yes`,advanced:C.length>0?C: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!==``||f!==G||y!==G||b!==G||C.length>0||S.kind!==`relative`||S.from!==W.from;function ie(){t({search:{},replace:!0})}return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(`p`,{className:`oc-admin__hint`,children:[v(),` `,(0,U.jsx)(`span`,{className:`oc-filter__window`,children:g()})]}),(0,U.jsxs)(z,{q:n,onQChange:q,searchPlaceholder:_(),timeRange:S,onTimeRangeChange:Z,onReset:ie,canReset:re,children:[(0,U.jsxs)(j,{value:f,onValueChange:J,children:[(0,U.jsx)(D,{size:`sm`,className:`w-40`,children:(0,U.jsx)(L,{placeholder:c()})}),(0,U.jsxs)(R,{children:[(0,U.jsx)(k,{value:G,children:x()}),te.map(e=>(0,U.jsx)(k,{value:e,children:e},e))]})]}),(0,U.jsxs)(j,{value:y,onValueChange:Y,children:[(0,U.jsx)(D,{size:`sm`,className:`w-40`,children:(0,U.jsx)(L,{})}),(0,U.jsxs)(R,{children:[(0,U.jsx)(k,{value:G,children:l()}),(0,U.jsx)(k,{value:`yes`,children:o()}),(0,U.jsx)(k,{value:`no`,children:h()})]})]}),(0,U.jsxs)(j,{value:b,onValueChange:X,children:[(0,U.jsx)(D,{size:`sm`,className:`w-40`,children:(0,U.jsx)(L,{placeholder:p()})}),(0,U.jsxs)(R,{children:[(0,U.jsx)(k,{value:G,children:s()}),ne.map(e=>(0,U.jsx)(k,{value:e,children:e},e))]})]})]}),(0,U.jsx)(B,{fields:K,seed:C,onChange:Q}),(0,U.jsx)(V,{title:m(),rows:$,emptyHint:r(),columns:[{header:T(),cell:e=>E(e.at),sort:e=>e.at},{header:c(),cell:e=>e.action,sort:e=>e.action},{header:d(),cell:e=>e.realLabel,sort:e=>e.realLabel},{header:u(),cell:e=>e.targetLabel??`—`,sort:e=>e.targetLabel??null},{header:p(),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{$h as r,$m as i,Am as a,As as o,Bm as s,Bt as c,Ch as l,Cj as u,Cs as d,D as f,Ds as p,E as m,Es as h,Fm as g,Gh as ee,Gm as _,Hm as v,Ht as y,Im as te,Jm as b,Kh as ne,Km as re,Kt as ie,Lm as ae,Mm as oe,Ms as se,Nm as ce,Om as x,Os as le,Pm as ue,Qh as de,Qm as fe,Rm as pe,Sh as me,Sj as he,Ss as ge,Ts as _e,Um as ve,Ut as ye,Vm as be,Vt as xe,Wm as Se,Xh as Ce,Xm as we,Yh as Te,Ym as Ee,Zh as De,Zm as Oe,_h as ke,ag as Ae,ah as je,bh as Me,bj as Ne,bs as Pe,ch as Fe,dh as Ie,eg as Le,eh as Re,fh as ze,gh as Be,gs as Ve,hh as He,ig as Ue,ih as We,jm as Ge,js as Ke,km as qe,ks as Je,lh as Ye,mh as Xe,ng as Ze,nh as Qe,oh as $e,ph as et,qm as tt,rh as nt,sh as rt,tg as it,th as at,uh as ot,vh as st,ws as ct,xh as lt,xs as ut,yh as dt,zm as ft,zt as pt}from"./dist-tr7LmvAR.js";import{i as S,r as mt}from"./dist-DEMXTO86.js";import{t as ht}from"./chevrons-up-down-B1FpM2AK.js";import{i as gt,n as C,o as _t,r as vt,s as yt}from"./FieldLabel-BPj-rFdV.js";import{i as bt,n as xt,r as St,t as Ct}from"./tabs-CtMWQedT.js";import{t as wt}from"./button-CtB6NRj2.js";import{$ as Tt,A as Et,C as w,Gt as T,Jt as Dt,Kt as Ot,Mt as E,Q as kt,Rt as At,S as D,V as jt,b as O,bt as Mt,ct as k,dt as Nt,et as Pt,j as A,kt as j,lt as Ft,m as It,mt as Lt,p as Rt,pt as zt,qt as M,st as N,ut as Bt,w as P,x as F}from"./index-D3n1_9Fa.js";import{r as Vt}from"./locales-CPjguROj.js";import{a as Ht,i as I,n as L,o as R,r as z,t as B}from"./table-CFZX8hqf.js";import{t as Ut}from"./FilterBar-Bub5nUxA.js";import{a as V,n as Wt,o as H,r as U,s as Gt,t as Kt}from"./compatView-BA0_AW-d.js";import{t as W}from"./dispatchErrorInfo-BuUObQq-.js";var qt=f(`refresh-cw`,[[`path`,{d:`M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8`,key:`v9h5vc`}],[`path`,{d:`M21 3v5h-5`,key:`1q7to0`}],[`path`,{d:`M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16`,key:`3uifl3`}],[`path`,{d:`M8 16H3v5`,key:`1cv678`}]]),Jt=f(`wifi-off`,[[`path`,{d:`M12 20h.01`,key:`zekei9`}],[`path`,{d:`M8.5 16.429a5 5 0 0 1 7 0`,key:`1bycff`}],[`path`,{d:`M5 12.859a10 10 0 0 1 5.17-2.69`,key:`1dl1wf`}],[`path`,{d:`M19 12.859a10 10 0 0 0-2.007-1.523`,key:`4k23kn`}],[`path`,{d:`M2 8.82a15 15 0 0 1 4.177-2.643`,key:`1grhjp`}],[`path`,{d:`M22 8.82a15 15 0 0 0-11.288-3.764`,key:`z3jwby`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}]]),G=t(e(),1);function K(e){return e.filter(e=>e.state===`error`)}function Yt(e){return e.reachable&&K(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 H(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)=>H(e,t)??Z(e,t))}var Q=n();function un({connections:e,displayByInstance:t}){let[n,r]=(0,G.useState)(en),[i,a]=(0,G.useState)(null),o=(0,G.useMemo)(()=>e.map((e,n)=>({_id:`${e.key}:${e.canonical}/${e.agentId}:${n}`,targetLabel:`${e.canonical}/${e.agentId}`,state:e.state,instanceName:e.instanceName??null,instanceLabel:e.instanceName?t.get(e.instanceName)??e.instanceName:null,gatewayHost:e.gatewayHost,gatewayVersion:e.gatewayVersion??null,okCount:e.okCount,errorCount:e.errorCount+(e.downstreamRejectCount??0),attempts:e.attempts,lastOkAt:e.lastOkAt??null,lastErrorCode:e.lastErrorCode??null,lastErrorAt:e.lastErrorAt??null,lastDownstreamRejectCode:e.lastDownstreamRejectCode??null,lastDownstreamRejectAt:e.lastDownstreamRejectAt??null})),[e,t]),c=(0,G.useMemo)(()=>sn(o),[o]),l=(0,G.useMemo)(()=>cn(o),[o]),u=(0,G.useMemo)(()=>ln(o),[o]),d=(0,G.useMemo)(()=>on(nn(o,n),i),[o,n,i]);function f(e){a(t=>t?.key===e?t.dir===`asc`?{key:e,dir:`desc`}:null:{key:e,dir:`asc`})}return e.length===0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:re()}):(0,Q.jsxs)(`div`,{className:`oc-conn`,children:[(0,Q.jsxs)(Ut,{q:n.q,onQChange:e=>r(t=>({...t,q:e})),searchPlaceholder:ve(),onReset:()=>r(en),canReset:tn(n),children:[(0,Q.jsxs)(O,{value:n.state,onValueChange:e=>r(t=>({...t,state:e})),children:[(0,Q.jsx)(w,{size:`sm`,className:`w-36`,children:(0,Q.jsx)(P,{placeholder:be()})}),(0,Q.jsxs)(F,{children:[(0,Q.jsx)(D,{value:Y,children:v()}),c.map(e=>(0,Q.jsx)(D,{value:e,children:fn(e)},e))]})]}),(0,Q.jsxs)(O,{value:n.instance,onValueChange:e=>r(t=>({...t,instance:e})),children:[(0,Q.jsx)(w,{size:`sm`,className:`w-40`,children:(0,Q.jsx)(P,{placeholder:s()})}),(0,Q.jsxs)(F,{children:[(0,Q.jsx)(D,{value:Y,children:v()}),l.map(e=>(0,Q.jsx)(D,{value:e.name,children:e.label},e.name))]})]}),(0,Q.jsxs)(O,{value:n.version,onValueChange:e=>r(t=>({...t,version:e})),children:[(0,Q.jsx)(w,{size:`sm`,className:`w-36`,children:(0,Q.jsx)(P,{placeholder:ft()})}),(0,Q.jsxs)(F,{children:[(0,Q.jsx)(D,{value:Y,children:v()}),u.map(e=>(0,Q.jsx)(D,{value:e,children:e},e))]})]})]}),d.length===0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:pe()}):(0,Q.jsxs)(B,{className:`oc-conn__table`,children:[(0,Q.jsx)(Ht,{children:(0,Q.jsxs)(R,{children:[(0,Q.jsx)($,{label:ae(),sortKey:`target`,sort:i,onSort:f}),(0,Q.jsx)($,{label:te(),sortKey:`state`,sort:i,onSort:f}),(0,Q.jsx)($,{label:g(),sortKey:`instance`,sort:i,onSort:f}),(0,Q.jsx)($,{label:ue(),sortKey:`host`,sort:i,onSort:f}),(0,Q.jsx)($,{label:ce(),sortKey:`version`,sort:i,onSort:f}),(0,Q.jsx)(I,{children:oe()}),(0,Q.jsx)($,{label:Ge(),sortKey:`lastOk`,sort:i,onSort:f})]})}),(0,Q.jsx)(L,{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)(I,{"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)(mt,{size:13,"aria-hidden":!0}):(0,Q.jsx)(S,{size:13,"aria-hidden":!0}):(0,Q.jsx)(ht,{size:13,"aria-hidden":!0,className:`oc-conn__sort-idle`})]})})}function dn({r:e}){let t=Xt(e)?W(e.lastErrorCode):null,n=Zt(e)?W(e.lastDownstreamRejectCode):null;return(0,Q.jsxs)(G.Fragment,{children:[(0,Q.jsxs)(R,{className:`oc-conn__row oc-conn__row--${e.state}`,children:[(0,Q.jsx)(z,{children:(0,Q.jsx)(`code`,{className:`oc-traces__mono`,children:e.targetLabel})}),(0,Q.jsx)(z,{children:(0,Q.jsx)(pn,{state:e.state})}),(0,Q.jsx)(z,{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)(z,{children:(0,Q.jsx)(`span`,{className:`oc-bridge-target__host`,children:e.gatewayHost})}),(0,Q.jsx)(z,{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)(z,{children:(0,Q.jsx)(`span`,{className:`oc-conn__stats`,children:_({ok:e.okCount,errors:e.errorCount,attempts:e.attempts})})}),(0,Q.jsx)(z,{children:e.lastOkAt?(0,Q.jsx)(`span`,{className:`oc-traces__mono`,children:A(e.lastOkAt)}):(0,Q.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})})]}),t||n?(0,Q.jsx)(R,{className:`oc-conn__detail-row`,children:(0,Q.jsxs)(z,{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?` · ${A(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:[Se({label:n.label}),` `,(0,Q.jsx)(`code`,{className:`oc-traces__mono`,children:e.lastDownstreamRejectCode}),e.lastDownstreamRejectAt?` · ${A(e.lastDownstreamRejectAt)}`:``]}):null]})}):null]})}function fn(e){return e===`connected`?a():e===`error`?qe():x()}function pn({state:e}){return e===`connected`?(0,Q.jsx)(N,{variant:`secondary`,children:a()}):e===`error`?(0,Q.jsx)(N,{variant:`destructive`,children:qe()}):(0,Q.jsx)(N,{variant:`outline`,children:x()})}function mn(){return u(m.bridgeHealth.getBridgeHealth,{})}function hn(){let e=mn(),t=u(m.compat.getBridgeCompat,{}),n=u(m.me.getMe,{host:Mt})?.role===`admin`,r=u(m.admin.listInstances,n?{}:`skip`),i=u(m.agents.usageForInstances,n?{}:`skip`),a=M(),o=()=>void a({to:`/settings/anomalies`,search:{status:`open`}}),s=$t(e?e.targets:[],t?t.targets:[],r??[]),{section:l}=Dt({from:`/settings/bridge`}),d=M({from:`/settings/bridge`}),f=t?.compat??null,p=t===void 0?`loading`:t===null?`nodata`:`ready`,h=f!==null&&Wt(f,`hermes`)&&!s.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:Ye()}),i&&i.length>0?(0,Q.jsxs)(`section`,{className:`oc-bridge__usage`,children:[(0,Q.jsx)(`h3`,{className:`oc-bridge__usage-title`,children:Fe()}),(0,Q.jsxs)(B,{children:[(0,Q.jsx)(Ht,{children:(0,Q.jsxs)(R,{children:[(0,Q.jsx)(I,{children:ye()}),(0,Q.jsx)(I,{children:y()}),(0,Q.jsx)(I,{children:xe()}),(0,Q.jsx)(I,{children:c()}),(0,Q.jsx)(I,{children:pt()})]})}),(0,Q.jsx)(L,{children:i.flatMap(e=>{let t=It(e.usage,Date.now());return t?t.windows.map((t,n)=>(0,Q.jsxs)(R,{children:[(0,Q.jsx)(z,{className:`font-medium`,children:n===0?e.instanceName:``}),(0,Q.jsx)(z,{children:t.provider}),(0,Q.jsx)(z,{children:t.label}),(0,Q.jsx)(z,{children:(0,Q.jsxs)(N,{variant:t.percentLeft<=10?`destructive`:t.percentLeft<=25?`outline`:`secondary`,children:[t.percentLeft,`%`]})}),(0,Q.jsx)(z,{className:`text-muted-foreground`,children:t.resetText??`—`})]},`${e.instanceName}:${t.provider}:${t.label}`)):[]})})]})]}):null,s.length>0?(0,Q.jsxs)(Ct,{value:s.some(e=>e.key===l)?l:s[0]?.key??`openclaw`,onValueChange:e=>void d({search:{section:e},replace:!0}),children:[(0,Q.jsx)(St,{className:`w-full`,children:s.map(e=>(0,Q.jsxs)(bt,{value:e.key,className:`flex-1 gap-1.5`,children:[(0,Q.jsx)(E,{size:13,"aria-hidden":!0}),J(e.key)]},e.key))}),s.map(e=>(0,Q.jsx)(xt,{value:e.key,children:(0,Q.jsx)(_n,{providerKey:e.key,connections:e.connections,instances:e.instances,manifest:f,compatStatus:p,compatReachable:t?.reachable??!0,protocol:e.key===`openclaw`?t?.protocol??null:null})},e.key))]}):null,h?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:Ve()}):null]})}function gn({health:e,compat:t,onSeeAnomalies:n}){let r=t!=null&&t.buildVersion!=null&&t.bridgeVersion!=null&&t.buildVersion!==t.bridgeVersion,a=t?.buildRevision&&t.buildRevision!==`unknown`?t.buildRevision.slice(0,7):null,s=t&&t!==null?(0,Q.jsxs)(`span`,{className:`oc-bridge-card__ver`,children:[(0,Q.jsx)(`code`,{className:`oc-traces__mono`,children:V(t.bridgeVersion)}),a?(0,Q.jsxs)(Q.Fragment,{children:[` `,(0,Q.jsxs)(`code`,{className:`oc-traces__mono`,title:o(),children:[`(`,a,`)`]})]}):null,r?(0,Q.jsxs)(`strong`,{className:`oc-bridge-card__mismatch`,children:[` `,Je({build:t.buildVersion??`?`})]}):null,` · `,le(),` `,(0,Q.jsx)(`code`,{className:`oc-traces__mono`,children:t.protocolVersion===null?p():String(t.protocolVersion)})]}):null;if(e===void 0)return(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:at()});if(e===null)return(0,Q.jsx)(`div`,{className:`oc-bridge-card oc-bridge-card--idle`,children:Re()});let c=K(e.targets),l=!e.reachable,u=Yt(e),d=u?`ok`:`error`,f=Et(e.checkedAt),m=e.startedAt==null?null:Et(e.startedAt);return(0,Q.jsxs)(`div`,{className:`oc-bridge-card oc-bridge-card--${d}`,children:[(0,Q.jsx)(`div`,{className:`oc-bridge-card__icon`,"aria-hidden":!0,children:u?(0,Q.jsx)(T,{size:22}):l?(0,Q.jsx)(Jt,{size:22}):(0,Q.jsx)(j,{size:22})}),(0,Q.jsxs)(`div`,{className:`oc-bridge-card__body`,children:[(0,Q.jsx)(`div`,{className:`oc-bridge-card__title`,children:u?i():l?fe():Oe({count:c.length})}),(0,Q.jsxs)(`div`,{className:`oc-bridge-card__meta`,children:[(0,Q.jsxs)(`span`,{children:[(0,Q.jsx)(qt,{size:12,"aria-hidden":!0}),` `,we({time:f})]}),m?(0,Q.jsx)(`span`,{children:Ee({time:m})}):null,s]}),l?(0,Q.jsx)(`p`,{className:`oc-bridge-card__hint`,children:W(e.lastError===`not_configured`?`NOT_CONFIGURED`:`BRIDGE_UNREACHABLE`).hint}):null]}),(0,Q.jsx)(`button`,{type:`button`,className:`oc-bridgebar__drill`,onClick:n,children:b()})]})}function _n({providerKey:e,connections:t,instances:n,manifest:r,compatStatus:i,compatReachable:a,protocol:o}){let s=r?Gt(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:Kt(t,e,r)})}let d=l.map(e=>e.state),f=d.includes(`beyond`)?`beyond`:d.length>0&&d.every(e=>e===`supported`)?`supported`:null,[p,m]=(0,G.useState)(!1);return(0,Q.jsxs)(`section`,{className:`oc-bridge-provider`,children:[(0,Q.jsxs)(`header`,{className:`oc-bridge-provider__head`,children:[(0,Q.jsx)(E,{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)(N,{variant:f===`beyond`?`destructive`:`secondary`,children:U(f)}):null]}),(0,Q.jsx)(`h4`,{className:`oc-bridge-provider__sub`,children:se()}),(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)(S,{size:13,"aria-hidden":!0}):(0,Q.jsx)(Ot,{size:13,"aria-hidden":!0}),tt({count:t.length})]}),p?(0,Q.jsx)(un,{connections:t,displayByInstance:c}):null]})}function vn({protocol:e}){let[t,n]=(0,G.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:[rt(),i.length>0?(0,Q.jsx)(N,{variant:`destructive`,children:je({count:i.length})}):(0,Q.jsx)(N,{variant:`secondary`,children:$e()})]}),(0,Q.jsxs)(`p`,{className:`oc-admin__hint`,children:[We({version:e.vendoredVersion}),r?` · `+nt({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)(S,{size:13,"aria-hidden":!0}):(0,Q.jsx)(Ot,{size:13,"aria-hidden":!0}),Qe({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:at()}):t===`nodata`?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:Ke()}):(0,Q.jsxs)(`div`,{className:`oc-compat`,children:[n?null:(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:h()}),r===null?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:_e()}):(0,Q.jsxs)(`div`,{className:`oc-compat__support`,children:[(0,Q.jsx)(`span`,{className:`oc-compat__label`,children:ie({provider:a})}),e&&e.range!==null?(0,Q.jsx)(`span`,{children:ct({min:e.range.min,max:e.range.maxValidated})}):(0,Q.jsx)(`span`,{children:p()}),e?(0,Q.jsx)(Cn,{versions:e.validatedVersions}):null]}),i.length===0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:Pe()}):(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:V(e.version)}),(0,Q.jsx)(N,{variant:e.state===`supported`?`secondary`:e.state===`beyond`?`destructive`:`outline`,children:U(e.state)})]},e.instanceName))})]})}function bn({instance:e,onClose:t}){return(0,Q.jsx)(Ft,{open:!0,onOpenChange:e=>!e&&t(),children:(0,Q.jsxs)(Bt,{className:`oc-bridge-config-dialog`,onOpenAutoFocus:e=>e.preventDefault(),children:[(0,Q.jsxs)(zt,{children:[(0,Q.jsx)(Lt,{children:Ae({instance:e.displayName??e.name})}),(0,Q.jsx)(Nt,{children:Ue()})]}),(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)(T,{"aria-hidden":!0}):(0,Q.jsx)(j,{"aria-hidden":!0}),(0,Q.jsxs)(`span`,{children:[e,` — `,t.ok?et():t.detail]})]}):(0,Q.jsxs)(`p`,{className:`oc-bridge-config__check-row oc-bridge-config__check-row--skip`,children:[e,` — `,ze()]}):null}function Sn({instance:e,onClose:t}){let n=he(m.admin.upsertInstanceConfig),i=Ne(m.bridge.validateMediaPaths),a=jt(),o=Vt(e.config?.contentLocale,void 0),[s,c]=(0,G.useState)(()=>gt(e.config??{},o)),[u,d]=(0,G.useState)(!1),[f,p]=(0,G.useState)(!1),[h,g]=(0,G.useState)(null),_=s.inboundMediaMode===`shared-fs`,v=s.mediaMode===`shared-fs`,y=_||v;async function te(){p(!0),g(null);try{g(await i({instanceName:e.name,inboundMediaMode:s.inboundMediaMode,mediaMode:s.mediaMode}))}catch(e){a.error(ke(),e)}finally{p(!1)}}async function b(){d(!0);try{let r=e.config??{};await n({instanceId:e._id,config:vt(s,r,o)}),t()}catch(e){a.error(De(),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)(C,{label:Ze(),help:Ce()}),(0,Q.jsxs)(O,{value:s.mediaMode,onValueChange:e=>c({...s,mediaMode:e}),children:[(0,Q.jsx)(w,{size:`sm`,className:`w-full`,children:(0,Q.jsx)(P,{})}),(0,Q.jsx)(F,{children:yt.map(e=>(0,Q.jsx)(D,{value:e,children:e},e))})]})]}),(0,Q.jsxs)(`label`,{className:`oc-field`,children:[(0,Q.jsx)(C,{label:it(),help:Te()}),(0,Q.jsxs)(O,{value:s.inboundMediaMode,onValueChange:e=>c({...s,inboundMediaMode:e}),children:[(0,Q.jsx)(w,{size:`sm`,className:`w-full`,children:(0,Q.jsx)(P,{})}),(0,Q.jsx)(F,{children:_t.map(e=>(0,Q.jsx)(D,{value:e,children:e},e))})]})]}),(0,Q.jsxs)(`label`,{className:`oc-field`,children:[(0,Q.jsx)(C,{label:Le(),help:ne()}),(0,Q.jsx)(k,{type:`number`,min:1,max:4096,className:`w-full`,value:s.mediaMaxMb,onChange:e=>c({...s,mediaMaxMb:Math.trunc(Number(e.target.value)||0)})})]})]}),y&&(0,Q.jsxs)(`div`,{className:`oc-bridge-config__grid`,children:[_&&(0,Q.jsxs)(`label`,{className:`oc-field`,children:[(0,Q.jsx)(C,{label:l(),help:me()}),(0,Q.jsx)(k,{className:`w-full`,spellCheck:!1,value:s.inboundAgentMount,onChange:e=>c({...s,inboundAgentMount:e.target.value})})]}),v&&(0,Q.jsxs)(`label`,{className:`oc-field`,children:[(0,Q.jsx)(C,{label:lt(),help:Me()}),(0,Q.jsx)(k,{className:`w-full`,spellCheck:!1,value:s.outboundAgentMount,onChange:e=>c({...s,outboundAgentMount:e.target.value})})]})]}),(0,Q.jsxs)(`label`,{className:`oc-field--row`,children:[(0,Q.jsx)(Rt,{checked:s.rehydration,onCheckedChange:e=>c({...s,rehydration:e===!0})}),(0,Q.jsx)(C,{label:r(),help:ee()})]}),y&&h!==null&&(0,Q.jsx)(`div`,{className:`oc-bridge-config__check`,children:h.reachable?!h.inbound&&!h.outbound?(0,Q.jsxs)(`p`,{className:`oc-bridge-config__check-row oc-bridge-config__check-row--err`,children:[(0,Q.jsx)(j,{"aria-hidden":!0}),ot({reason:h.reason??`?`})]}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(xn,{label:He(),result:h.inbound}),(0,Q.jsx)(xn,{label:Xe(),result:h.outbound}),(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:Be()})]}):(0,Q.jsxs)(`p`,{className:`oc-bridge-config__check-row oc-bridge-config__check-row--err`,children:[(0,Q.jsx)(j,{"aria-hidden":!0}),Ie()]})}),(0,Q.jsxs)(`div`,{className:`oc-bridge-config__actions`,children:[y&&(0,Q.jsxs)(wt,{variant:`outline`,size:`sm`,onClick:()=>void te(),disabled:f,children:[f?(0,Q.jsx)(At,{className:`size-4 animate-spin`,"aria-hidden":!0}):null,f?st():dt()]}),(0,Q.jsx)(wt,{size:`sm`,onClick:()=>void b(),disabled:u,children:de()})]})]})})}function Cn({versions:e}){if(e.length===0)return null;let t=[...e].reverse();return(0,Q.jsxs)(kt,{children:[(0,Q.jsx)(Pt,{asChild:!0,children:(0,Q.jsxs)(`button`,{type:`button`,className:`oc-compat__versions-btn`,children:[e.length===1?d():ge({count:e.length}),(0,Q.jsx)(S,{size:13,"aria-hidden":!0})]})}),(0,Q.jsxs)(Tt,{className:`oc-compat__versions-pop`,align:`start`,children:[(0,Q.jsx)(`p`,{className:`oc-compat__versions-title`,children:ut()}),(0,Q.jsx)(`div`,{className:`oc-compat__versions-list`,children:t.map(e=>(0,Q.jsx)(N,{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{$c as r,Bs as i,Cj as a,E as o,Fs as s,Gt as c,Is as l,Jc as u,Ls as d,Ns as f,Ps as p,Rs as m,Sj as h,Vs as g,Yc as _,_c as v,bj as y,ci as b,di as x,fi as S,li as C,mi as w,mj as T,pi as E,rg as D,tl as O,ui as k,zs as A}from"./dist-tr7LmvAR.js";import{t as j}from"./button-CtB6NRj2.js";import{C as M,S as N,b as P,ct as F,d as I,f as L,kt as R,p as z,w as B,x as V,y as H}from"./index-D3n1_9Fa.js";import{i as U}from"./compatView-BA0_AW-d.js";/* empty css */var W=t(e(),1),G=[`off`,`minimal`,`low`,`medium`,`high`,`xhigh`];function K(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 q=n();function J({instance:e}){let t=h(o.admin.upsertInstanceConfig),n=e.config?.curationEnabled===!0,r=typeof e.config?.curationBudgetChars==`number`?e.config.curationBudgetChars:null,[i,a]=(0,W.useState)(n),[c,l]=(0,W.useState)(r===null?``:String(r)),[u,d]=(0,W.useState)(`idle`);(0,W.useEffect)(()=>{a(n),l(r===null?``:String(r)),d(`idle`)},[e._id,n,r]);let m=c.trim(),g=m===``?null:/^\d+$/.test(m)?Number.parseInt(m,10):NaN,_=!i||g===null||Number.isInteger(g)&&g>=4e3&&g<=6e4,v=i!==n||(g??null)!==r;async function y(){d(`saving`);try{let n={...e.config??{}};n.curationEnabled=i,!i||g===null||Number.isNaN(g)?delete n.curationBudgetChars:n.curationBudgetChars=g,await t({instanceId:e._id,config:n}),d(`done`)}catch{d(`error`)}}return(0,q.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,q.jsxs)(`label`,{className:`oc-cdefaults__inline`,style:{cursor:`pointer`},children:[(0,q.jsx)(z,{checked:i,onCheckedChange:e=>a(e===!0),"aria-label":S()}),(0,q.jsx)(`span`,{className:`oc-cdefaults__label`,children:S()})]}),(0,q.jsxs)(`div`,{className:`oc-cdefaults__inline`,children:[(0,q.jsx)(F,{type:`number`,min:4e3,max:6e4,step:1e3,placeholder:`20000`,value:c,onChange:e=>l(e.target.value),className:`oc-cdefaults__number`,"aria-invalid":!_,"aria-label":x(),disabled:!i}),(0,q.jsx)(j,{size:`sm`,disabled:!v||!_||u===`saving`,onClick:()=>void y(),children:u===`saving`?O():s()})]}),_?null:(0,q.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:k()}),u===`done`?(0,q.jsx)(`p`,{className:`oc-admin__hint`,role:`status`,children:p()}):null,u===`error`?(0,q.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:f()}):null,(0,q.jsx)(`p`,{className:`oc-cdefaults__help`,children:C()})]})}function Y({instance:e}){let t=h(o.admin.upsertInstanceConfig),n=typeof e.config?.summarizeThresholdChars==`number`?e.config.summarizeThresholdChars:null,[r,i]=(0,W.useState)(n===null?``:String(n)),[a,c]=(0,W.useState)(`idle`);(0,W.useEffect)(()=>{i(n===null?``:String(n)),c(`idle`)},[e._id,n]);let l=r.trim(),u=l===``?null:/^\d+$/.test(l)?Number.parseInt(l,10):NaN,d=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,q.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,q.jsx)(`span`,{className:`oc-cdefaults__label`,children:w()}),(0,q.jsxs)(`div`,{className:`oc-cdefaults__inline`,children:[(0,q.jsx)(F,{type:`number`,min:1e3,max:2e5,step:1e3,placeholder:`8000`,value:r,onChange:e=>i(e.target.value),className:`oc-cdefaults__number`,"aria-invalid":!d}),(0,q.jsx)(j,{size:`sm`,disabled:!m||!d||a===`saving`,onClick:()=>void g(),children:a===`saving`?O():s()})]}),d?null:(0,q.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:b()}),a===`done`?(0,q.jsx)(`p`,{className:`oc-admin__hint`,role:`status`,children:p()}):null,a===`error`?(0,q.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:f()}):null,(0,q.jsx)(`p`,{className:`oc-cdefaults__help`,children:E()})]})}function X(){let e=y(o.agentFiles.getChatDefaults),[t,n]=(0,W.useState)({status:`loading`}),s=a(o.admin.listInstances,{}),[f,p]=(0,W.useState)(null);(0,W.useEffect)(()=>{!s||s.length===0||(!f||!s.some(e=>e.name===f))&&p(s[0].name)},[s,f]);let h=(s?.length??0)>1,b=s!==void 0&&s.length===0,x=a(o.compat.forInstance,f?{instanceName:f}:`skip`),S=f?H(x,`configDefaults`):`loading`,C=S===`loading`?null:S.blocked,w=(0,W.useMemo)(()=>h&&f?{instanceName:f}:{},[h,f]),E=(0,W.useRef)(0),O=(0,W.useCallback)(async()=>{let t=++E.current;n({status:`loading`});try{let r=K(await e(w));if(E.current!==t)return;n({status:`done`,current:r})}catch{if(E.current!==t)return;n({status:`error`})}},[e,w]);(0,W.useEffect)(()=>{C===!1&&(h&&!f||O())},[O,C,h,f]);let k=t.status===`done`?t.current:null,F=(0,W.useMemo)(()=>G.map(e=>({id:e,label:L(e)})),[]),z=(0,W.useMemo)(()=>[{id:`fast`,label:_()},{id:`standard`,label:u()}],[]);return(0,q.jsxs)(`div`,{className:`oc-cdefaults`,children:[(0,q.jsx)(`p`,{className:`oc-admin__hint`,children:g()}),h&&f?(0,q.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,q.jsx)(`span`,{className:`oc-cdefaults__label`,children:v()}),(0,q.jsxs)(P,{value:f,onValueChange:e=>p(e),children:[(0,q.jsx)(M,{size:`sm`,"aria-label":v(),children:(0,q.jsx)(B,{})}),(0,q.jsx)(V,{children:(s??[]).map(e=>(0,q.jsx)(N,{value:e.name,children:e.name},e.name))})]})]}):null,b?(0,q.jsx)(`p`,{className:`oc-admin__hint`,role:`status`,children:D()}):S===`loading`?(0,q.jsx)(`p`,{className:`oc-admin__hint`,children:T()}):S.blocked?(0,q.jsxs)(`p`,{className:`oc-compat__blocked`,role:`status`,children:[(0,q.jsx)(R,{size:14,"aria-hidden":!0}),` `,U(S.gatewayVersion,S.provider)]}):t.status===`loading`?(0,q.jsx)(`p`,{className:`oc-admin__hint`,children:T()}):t.status===`error`?(0,q.jsxs)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:[l(),` `,(0,q.jsx)(j,{variant:`outline`,size:`sm`,onClick:()=>void O(),children:r()})]}):(0,q.jsxs)(q.Fragment,{children:[(0,q.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,q.jsx)(`span`,{className:`oc-cdefaults__label`,children:i()}),(0,q.jsx)(I,{options:F,value:k?.thinkingDefault??null,onChange:()=>{},disabled:!0}),(0,q.jsx)(`p`,{className:`oc-cdefaults__help`,children:A()})]}),(0,q.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,q.jsx)(`span`,{className:`oc-cdefaults__label`,children:m()}),(0,q.jsx)(I,{options:z,value:k===null||k.fastModeDefault===null?null:k.fastModeDefault?`fast`:`standard`,onChange:()=>{},disabled:!0}),(0,q.jsx)(`p`,{className:`oc-cdefaults__help`,children:d()})]}),(0,q.jsx)(`p`,{className:`oc-cdefaults__note`,children:c()})]}),(()=>{let e=s?.find(e=>e.name===(f??s[0]?.name));return e?(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(Y,{instance:e}),(0,q.jsx)(J,{instance:e})]}):null})()]})}export{X 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,AS as i,BS as a,CS as o,Cj as s,DS as c,Dr as l,E as u,ES as d,FS as f,GS as p,HS as m,IS as h,JS as g,KS as _,LS as v,MS as y,NS as ee,OS as b,PS as te,QS as ne,RS as re,SS as ie,Sj as x,TS as S,US as C,VS as w,WS as T,XS as E,YS as D,ZS as O,_S as k,aC as A,bS as j,cC as M,dC as N,eC as P,fC as F,fS as I,gS as L,hS as R,iC as z,jS as B,kS as V,kr as H,lC as U,mS as W,nC as G,oC as ae,pC as K,pS as q,qS as J,rC as oe,sC as se,tC as ce,uC as le,vS as ue,wS as de,xS as fe,yS as pe,zS as me}from"./dist-tr7LmvAR.js";import{t as he}from"./button-CtB6NRj2.js";import{A as ge,H as _e}from"./index-D3n1_9Fa.js";import{t as Y}from"./DataTableShell-CKQRa8xi.js";var X=t(e(),1),Z=n(),ve={altered_words:()=>K(),incorrect:()=>F(),incoherence:()=>N(),formatting:()=>le(),latency:()=>U(),api_error:()=>M(),other:()=>se()},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:A()}):e===!1?(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-warn`,children:z()}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill`,children:`—`}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill`,children:ae()})}function ye({data:e,closeReason:t}){let n=e.snapshot,i=x(u.feedback.respondToFeedback),[o,s]=(0,X.useState)(e.thread),[c,l]=(0,X.useState)(``),[d,f]=(0,X.useState)(!1);async function h(){let t=c.trim();if(!(!t||d)){f(!0);try{await i({feedbackId:e._id,text:t}),s(e=>[...e,{authorRole:`admin`,text:t,at:Date.now()}]),l(``)}finally{f(!1)}}}let y=[];try{y=n.contextJson?JSON.parse(n.contextJson):[]}catch{y=[]}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?` · ${oe()}`:``,n.openclawModel?` · ${n.openclawModel}`:``,n.openclawRuntime?` (${n.openclawRuntime})`:``]})]}),e.comment?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:G()}),(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:ue()}),(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:ce()}),o.length>0?(0,Z.jsx)(`div`,{className:`oc-fbadmin__thread`,children:o.map((e,t)=>(0,Z.jsxs)(`div`,{className:`oc-notif__msg oc-notif__msg--${e.authorRole}`,children:[(0,Z.jsx)(`span`,{className:`oc-notif__msg-who`,children:e.authorRole===`admin`?P():e.authorRole===`agent`?e.authorLabel??H():r()}),(0,Z.jsx)(`span`,{className:`oc-notif__msg-text`,children:e.text})]},t))}):(0,Z.jsx)(`p`,{className:`oc-fbadmin__meta`,children:ne()}),(0,Z.jsx)(`textarea`,{className:`oc-feedback__textarea`,placeholder:O(),value:c,maxLength:2e3,rows:3,onChange:e=>l(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 h(),disabled:!c.trim()||d,children:d?E():D()})})]}),(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:g()}),(0,Z.jsx)(`pre`,{className:`oc-msg__source-pre`,children:n.messageText||J()})]}),n.clientInfo?.sourceWasOpen&&n.displayedText!==void 0?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:_()}),(0,Z.jsx)(`pre`,{className:`oc-msg__source-pre`,children:n.displayedText||J()})]}):null,n.promptText?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:p()}),(0,Z.jsx)(`pre`,{className:`oc-msg__source-pre`,children:n.promptText})]}):null,y.length>0?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:T({count:n.contextCount??y.length,truncated:n.contextTruncated?C():``})}),(0,Z.jsx)(`div`,{className:`oc-fbadmin__ctx`,children:y.map((e,t)=>(0,Z.jsxs)(`div`,{className:`oc-fbadmin__ctx-turn`,children:[(0,Z.jsx)(`span`,{className:`oc-fbadmin__ctx-role`,children:e.role}),(0,Z.jsx)(`span`,{className:`oc-fbadmin__ctx-text`,children:e.text})]},t))})]}):null,n.outboxAvailable?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:m()}),(0,Z.jsxs)(`pre`,{className:`oc-msg__source-pre`,children:[n.outboxText??``,n.outboxStatus?`\n[status: ${n.outboxStatus}]`:``]})]}):null,n.clientInfo?.extensionsDetected&&n.clientInfo.extensionsDetected.length>0?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:w()}),(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:a()}),(0,Z.jsxs)(`p`,{className:`oc-fbadmin__env`,children:[[n.clientInfo?.language,n.clientInfo?.timezone,n.clientInfo?.theme?me({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:[re(),` `,n.clientInfo.plugins.join(`, `),(0,Z.jsxs)(`span`,{className:`oc-fbadmin__note`,children:[` `,v()]})]}):null,n.clientInfo?.userAgent?(0,Z.jsx)(`span`,{className:`oc-fbadmin__ua`,children:n.clientInfo.userAgent}):null]})]})]})}function be(){let e=s(u.feedback.listForAdmin,{}),t=x(u.feedback.readSnapshot),n=x(u.feedback.deleteFeedback),r=_e(),[a,p]=(0,X.useState)(null),[m,g]=(0,X.useState)({});async function _(e){if(a===e._id){p(null);return}if(!m[e._id]){let n=await t({feedbackId:e._id});g(t=>({...t,[e._id]:n}))}p(e._id)}async function v(e){await r({title:W(),description:q(),confirmLabel:I(),destructive:!0})&&(await n({feedbackId:e._id}),a===e._id&&p(null))}return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`p`,{className:`oc-admin__hint`,children:[h(),` `,(0,Z.jsx)(`strong`,{children:f()}),` `,te()]}),(0,Z.jsx)(Y,{title:ee(),rows:e,emptyHint:y(),isExpanded:e=>a===e._id&&!!m[e._id],renderExpanded:e=>m[e._id]?(0,Z.jsx)(ye,{data:m[e._id],closeReason:e.userCloseReason}):null,columns:[{header:B(),cell:e=>ge(e.at),sort:e=>e.at},{header:i(),cell:e=>Q(e.category),sort:e=>Q(e.category)},{header:V(),cell:e=>e.messageRole===`user`?b():c(),sort:e=>e.messageRole},{header:d(),cell:e=>(e.reporterEmail||e.reporterName||`—`)+(e.impersonated&&e.realOperatorEmail?` ${S({operator:e.realOperatorEmail})}`:``),sort:e=>e.reporterEmail||e.reporterName||null},{header:de(),cell:e=>(0,Z.jsx)($,{matches:e.displayedMatchesStored,sourceWasOpen:e.sourceWasOpen}),sort:e=>e.displayedMatchesStored===!1?0:e.displayedMatchesStored===!0?1:2},{header:o(),cell:e=>e.hasComment?`✎`:`—`,sort:e=>+!!e.hasComment},{header:ie(),cell:e=>e.userClosedAt==null?e.resolvedAt==null?e.answered?(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-ok`,children:fe()}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill`,children:j()}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-ok`,title:e.resolvedBy??void 0,children:l()}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-closed`,children:pe()}),sort:e=>e.userClosedAt==null?e.resolvedAt==null?+!!e.answered:2:3}],rowActions:e=>[{label:a===e._id?k():L(),onSelect:()=>void _(e)},{label:R(),onSelect:()=>void v(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{AA as r,BA as ee,CA as te,Cj as ne,DA as i,E as a,EA as re,FA as o,GA as s,HA as ie,IA as c,JA as l,KA as u,LA as d,MA as f,Mr as ae,NA as p,Nr as m,OA as oe,PA as h,RA as se,SA as ce,Sj as le,TA as ue,UA as de,VA as fe,WA as g,_A as pe,bA as me,gA as he,gj as ge,hA as _e,jA as _,kA as ve,mA as ye,mj as be,pA as xe,qA as v,rE as y,vA as b,wA as x,xA as S,yA as C,zA as w}from"./dist-tr7LmvAR.js";import{t as T}from"./button-CtB6NRj2.js";import{At as E,C as D,G as O,Ht as k,J as A,K as j,Pt as M,S as N,V as Se,Vt as Ce,W as we,X as Te,Y as Ee,Z as De,b as P,nt as Oe,ot as ke,p as Ae,q as je,rt as F,st as I,tt as Me,w as L,x as R}from"./index-D3n1_9Fa.js";import{a as Ne,i as z,n as Pe,o as B,r as V,t as Fe}from"./table-CFZX8hqf.js";var H=t(e(),1),U=n(),W=`all`;function G(e){switch(e){case`image`:return d();case`audio`:return c();case`video`:return o();case`pdf`:return h();case`document`:return p();case`archive`:return f();default:return _()}}function K(){let[e,t]=(0,H.useState)(W),[n,o]=(0,H.useState)(W),[c,d]=(0,H.useState)(W),[f,p]=(0,H.useState)(W),[h,_]=(0,H.useState)(!1),[K,q]=(0,H.useState)(null),J=le(a.files.softDelete),Y=Se();function Ie(){t(W),o(W),d(W),p(W)}async function Le(){let e=K;if(q(null),e)try{await J({fileId:e.id}),Y.success(me())}catch(e){Y.error(C(),e)}}let X=ne(a.files.listMine,{direction:e===W?void 0:e,chatId:n===W?void 0:n,instanceName:c===W?void 0:c,category:f===W?void 0:f,includeAutoGenerated:h||void 0}),Re=(0,H.useMemo)(()=>new Intl.DateTimeFormat(ge(),{dateStyle:`medium`,timeStyle:`short`}),[]);if(X===void 0)return(0,U.jsx)(`p`,{className:`oc-admin__hint`,children:be()});let{files:Z,facets:Q,truncated:ze,cap:Be}=X,$=e!==W||n!==W||c!==W||f!==W;return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`p`,{className:`oc-admin__hint`,children:l()}),(0,U.jsxs)(`div`,{className:`oc-files__filters`,style:{display:`flex`,flexWrap:`wrap`,gap:8,margin:`12px 0`},children:[(0,U.jsxs)(P,{value:e,onValueChange:t,children:[(0,U.jsx)(D,{size:`sm`,"aria-label":v(),children:(0,U.jsx)(L,{})}),(0,U.jsxs)(R,{children:[(0,U.jsx)(N,{value:W,children:u()}),(0,U.jsx)(N,{value:`inbound`,children:s()}),(0,U.jsx)(N,{value:`outbound`,children:g()})]})]}),(0,U.jsxs)(P,{value:n,onValueChange:o,children:[(0,U.jsx)(D,{size:`sm`,"aria-label":de(),children:(0,U.jsx)(L,{})}),(0,U.jsxs)(R,{children:[(0,U.jsx)(N,{value:W,children:ie()}),Q.chats.map(e=>(0,U.jsx)(N,{value:e.id,children:e.title},e.id))]})]}),Q.multiProvider?(0,U.jsxs)(P,{value:c,onValueChange:d,children:[(0,U.jsx)(D,{size:`sm`,"aria-label":fe(),children:(0,U.jsx)(L,{})}),(0,U.jsxs)(R,{children:[(0,U.jsx)(N,{value:W,children:ee()}),Q.instances.map(e=>(0,U.jsx)(N,{value:e,children:e},e))]})]}):null,(0,U.jsxs)(P,{value:f,onValueChange:p,children:[(0,U.jsx)(D,{size:`sm`,"aria-label":w(),children:(0,U.jsx)(L,{})}),(0,U.jsxs)(R,{children:[(0,U.jsx)(N,{value:W,children:se()}),Q.categories.map(e=>(0,U.jsx)(N,{value:e,children:G(e)},e))]})]}),(0,U.jsxs)(`label`,{className:`oc-files__autogen`,children:[(0,U.jsx)(Ae,{checked:h,onCheckedChange:e=>_(e===!0),"aria-label":m()}),(0,U.jsx)(`span`,{children:m()})]}),$?(0,U.jsxs)(T,{variant:`ghost`,size:`sm`,onClick:Ie,style:{display:`inline-flex`,alignItems:`center`,gap:4,marginLeft:`auto`},children:[(0,U.jsx)(M,{size:14,"aria-hidden":!0}),te()]}):null]}),Z.length===0?(0,U.jsx)(`p`,{className:`oc-admin__hint`,children:$?ye():_e()}):(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(Fe,{children:[(0,U.jsx)(Ne,{children:(0,U.jsxs)(B,{children:[(0,U.jsx)(z,{children:r()}),(0,U.jsx)(z,{children:ve()}),(0,U.jsx)(z,{children:oe()}),(0,U.jsx)(z,{children:i()}),(0,U.jsx)(z,{children:re()}),(0,U.jsx)(z,{className:`text-right`,children:ue()})]})}),(0,U.jsx)(Pe,{children:Z.map(e=>(0,U.jsxs)(B,{children:[(0,U.jsxs)(V,{className:`font-medium`,style:{maxWidth:280,overflow:`hidden`,textOverflow:`ellipsis`},title:e.filename,children:[e.filename,e.origin===`pasted`?(0,U.jsx)(I,{variant:`outline`,style:{marginLeft:6},children:ae()}):null]}),(0,U.jsx)(V,{title:e.mimeType,children:G(e.category)}),(0,U.jsx)(V,{children:(0,U.jsx)(I,{variant:`secondary`,children:e.direction===`inbound`?s():g()})}),(0,U.jsx)(V,{style:{maxWidth:220,overflow:`hidden`,textOverflow:`ellipsis`},title:e.chatTitle,children:e.chatTitle}),(0,U.jsx)(V,{className:`whitespace-nowrap text-muted-foreground`,children:Re.format(e.createdAt)}),(0,U.jsx)(V,{className:`text-right`,children:(0,U.jsxs)(Me,{children:[(0,U.jsx)(ke,{asChild:!0,children:(0,U.jsx)(T,{variant:`ghost`,size:`icon`,"aria-label":ce(),children:(0,U.jsx)(Ce,{size:16})})}),(0,U.jsxs)(Oe,{align:`end`,children:[e.url?(0,U.jsx)(F,{asChild:!0,children:(0,U.jsxs)(`a`,{href:e.url,download:e.filename,target:`_blank`,rel:`noopener noreferrer`,children:[(0,U.jsx)(k,{size:14}),x()]})}):(0,U.jsxs)(F,{disabled:!0,children:[(0,U.jsx)(k,{size:14}),he()]}),(0,U.jsxs)(F,{variant:`destructive`,onSelect:()=>q({id:e._id,filename:e.filename}),children:[(0,U.jsx)(E,{size:14}),S()]})]})]})})]},e._id))})]}),ze?(0,U.jsx)(`p`,{className:`oc-admin__hint`,style:{marginTop:8},children:xe({cap:Be})}):null]}),(0,U.jsx)(we,{open:K!==null,onOpenChange:e=>!e&&q(null),children:(0,U.jsxs)(je,{children:[(0,U.jsxs)(Te,{children:[(0,U.jsx)(De,{children:b()}),(0,U.jsx)(A,{children:pe()})]}),(0,U.jsxs)(Ee,{children:[(0,U.jsx)(j,{children:y()}),(0,U.jsx)(O,{onClick:()=>void Le(),children:S()})]})]})})]})}export{K 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,Al as i,Bl as a,Cj as o,Cl as s,D as c,Dl as l,E as u,El as d,Fl as f,Gl as p,Hl as m,Il as h,Jl as g,Kl as _,Ll as v,Ml as y,Nl as b,Ol as x,Pl as S,Ql as C,Rl as w,Sj as T,Sl as E,Su as D,Tl as O,Ul as k,Vl as A,Wl as ee,Xl as te,Yl as ne,Zl as re,_l as j,_u as M,au as ie,bl as N,bu as ae,cu as P,du as F,eu as oe,fu as se,gl as ce,gu as I,hl as le,hu as L,iu as R,jl as ue,kl as de,lu as fe,ml as pe,mu as me,nu as he,ou as ge,pl as _e,pu as ve,ql as z,ru as ye,su as be,tu as xe,uu as Se,vl as Ce,vu as we,wl as Te,xl as Ee,xu as De,yl as Oe,yu as ke,zl as Ae}from"./dist-tr7LmvAR.js";import{t as je}from"./x-BsTPtFiQ.js";import{i as B,n as V,r as Me,t as Ne}from"./tabs-CtMWQedT.js";import{t as H}from"./button-CtB6NRj2.js";import{C as Pe,H as Fe,Kt as Ie,Mt as U,S as Le,V as W,b as Re,bt as ze,ct as G,dt as Be,jt as K,lt as Ve,mt as He,p as q,pt as Ue,st as J,u as We,ut as Ge,w as Ke,x as qe}from"./index-D3n1_9Fa.js";import{t as Je}from"./FilterBar-Bub5nUxA.js";import{t as Ye}from"./DataTableShell-CKQRa8xi.js";import{t as Y}from"./DetailChips-d1Fs61TW.js";var Xe=c(`chevron-left`,[[`path`,{d:`m15 18-6-6 6-6`,key:`1wnfg3`}]]),Ze=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`}]]),X=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`}]]),Qe=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`}]]),Z=t(e(),1);function $e(e,t,n){let r=t.trim().toLowerCase();return[...r?e.filter(e=>[e.email,e.name,e.canonical].some(e=>e!=null&&e.toLowerCase().includes(r))):e.slice()].sort((e,t)=>!n.has(e.userId)-+!n.has(t.userId))}function et(e,t){let n=e.filter(e=>e.source===`discovered`),r=t.trim().toLowerCase();return r?n.filter(e=>(e.displayName??e.agentId).toLowerCase().includes(r)||e.agentId.toLowerCase().includes(r)):n}function tt(e){let t=e.name?.trim()??``,n=e.email?.trim()??``,r=e.canonical?.trim()||`u-${e.userId.slice(0,8)}`;return t?{primary:t,secondary:n||`@${r}`}:n?{primary:n,secondary:null}:{primary:`@${r}`,secondary:null}}function nt(e){switch(e){case`admin`:return k();case`user`:return m();case`pending`:return A();default:return e}}function rt(e,t){if(e.length===0)return`none`;let n=0;for(let r of e)t(r)&&n++;return n===0?`none`:n===e.length?`all`:`some`}function it(e,t,n){let r=Math.max(1,Math.ceil(e.length/n)),i=Math.min(Math.max(1,Math.floor(t)),r),a=(i-1)*n;return{pageItems:e.slice(a,a+n),page:i,pageCount:r}}var Q=n(),$={name:``,description:``};function at(){let e=o(u.groups.listGroups,{}),t=o(u.me.getMe,{host:ze})?.role===`admin`,n=T(u.groups.createGroup),r=T(u.groups.updateGroup),i=T(u.groups.deleteGroup),a=Fe(),s=W(),[c,l]=(0,Z.useState)(!1),[d,f]=(0,Z.useState)(null),[p,m]=(0,Z.useState)($),[h,g]=(0,Z.useState)(null),[_,v]=(0,Z.useState)(``),y=(0,Z.useMemo)(()=>{if(!e)return e;let t=_.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,_]);function b(){f(null),m($),l(!0)}function x(e){f(e),m({name:e.name,description:e.description??``}),l(!0)}async function S(){try{d?await r({groupId:d._id,name:p.name,description:p.description}):await n({name:p.name,description:p.description||void 0}),m($),f(null),l(!1)}catch(e){s.error(ce(),e)}}async function C(e){if(await a({title:ye({name:e.name}),description:he(),confirmWord:e.name,confirmLabel:xe(),cancelLabel:fe(),destructive:!0}))try{await i({groupId:e._id})}catch(e){s.error(le(),e)}}return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:De()}),(0,Q.jsx)(Je,{q:_,onQChange:v,onReset:()=>v(``),canReset:_!==``,searchPlaceholder:me()}),(0,Q.jsx)(Ye,{title:D(),rows:y,addLabel:ae(),onAdd:t?b:void 0,emptyHint:ke(),columns:[{header:we(),cell:e=>e.name,sort:e=>e.name},{header:M(),cell:e=>(0,Q.jsx)(Y,{icon:(0,Q.jsx)(Qe,{size:12,"aria-hidden":!0}),total:e.memberCount,items:e.members.map(e=>({label:e.label,marker:e.manager?(0,Q.jsx)(X,{size:11,"aria-hidden":!0}):null,highlight:e.manager}))}),sort:e=>e.memberCount},{header:I(),cell:e=>(0,Q.jsx)(Y,{icon:(0,Q.jsx)(U,{size:12,"aria-hidden":!0}),total:e.agentCount,items:e.agents.map(e=>({label:e}))}),sort:e=>e.agentCount},{header:L(),cell:e=>(0,Q.jsx)(Y,{icon:(0,Q.jsx)(Ze,{size:12,"aria-hidden":!0}),total:e.chartCount,items:e.charts.map(e=>({label:e.name,marker:e.isDefault?(0,Q.jsx)(K,{size:11,fill:`currentColor`,"aria-hidden":!0}):null,highlight:e.isDefault}))}),sort:e=>e.chartCount}],rowActions:e=>[{label:ve(),onSelect:()=>g({groupId:e._id,name:e.name})},...t?[{label:se(),onSelect:()=>x(e)},{label:F(),variant:`destructive`,onSelect:()=>void C(e)}]:[]]}),(0,Q.jsx)(We,{open:c,onOpenChange:l,title:d?be():P(),description:ge(),canSubmit:!!p.name.trim(),onSubmit:S,submitLabel:Se(),children:(0,Q.jsxs)(`div`,{className:`oc-form`,children:[(0,Q.jsxs)(`label`,{className:`oc-field`,children:[(0,Q.jsx)(`span`,{className:`oc-field__label`,children:ie()}),(0,Q.jsx)(G,{value:p.name,onChange:e=>m({...p,name:e.target.value})})]}),(0,Q.jsxs)(`label`,{className:`oc-field`,children:[(0,Q.jsx)(`span`,{className:`oc-field__label`,children:R()}),(0,Q.jsx)(G,{value:p.description,onChange:e=>m({...p,description:e.target.value})})]})]})}),(0,Q.jsx)(ct,{groupId:h?.groupId??null,groupName:h?.name??``,open:h!==null,onOpenChange:e=>{e||g(null)}})]})}var ot=8;function st({page:e,pageCount:t,onPage:n}){return t<=1?null:(0,Q.jsxs)(`div`,{className:`oc-access__pager`,children:[(0,Q.jsxs)(H,{type:`button`,variant:`ghost`,size:`sm`,disabled:e<=1,onClick:()=>n(e-1),children:[(0,Q.jsx)(Xe,{size:14,"aria-hidden":!0}),_()]}),(0,Q.jsxs)(`span`,{className:`oc-access__pageinfo`,"aria-label":ee({page:e,pages:t}),children:[e,` / `,t]}),(0,Q.jsxs)(H,{type:`button`,variant:`ghost`,size:`sm`,disabled:e>=t,onClick:()=>n(e+1),children:[p(),(0,Q.jsx)(Ie,{size:14,"aria-hidden":!0})]})]})}function ct({groupId:e,groupName:t,open:n,onOpenChange:i}){let s=o(u.groups.getGroup,n&&e?{groupId:e}:`skip`),c=o(u.groups.listAssignableInstances,n?{}:`skip`),l=o(u.groups.listAssignableUsers,n?{}:`skip`),d=T(u.groups.addMember),p=T(u.groups.removeMember),m=T(u.groups.bulkSetMembers),_=T(u.groups.setGroupManager),v=W(),[y,b]=(0,Z.useState)(``),[x,S]=(0,Z.useState)(``),[E,D]=(0,Z.useState)(`members`),[O,k]=(0,Z.useState)(1),[A,ee]=(0,Z.useState)(new Set),j=(0,Z.useRef)(null),M=(0,Z.useMemo)(()=>new Set((s?.members??[]).map(e=>e.userId)),[s]),ie=(0,Z.useMemo)(()=>new Set((s?.members??[]).filter(e=>e.manager).map(e=>e.userId)),[s]),ae=s?.viewerIsAdmin===!0,P=(0,Z.useMemo)(()=>new Set((s?.agents??[]).map(e=>`${e.instanceName}/${e.agentId}`)),[s]);(0,Z.useEffect)(()=>{b(``),S(``),D(`members`),k(1),j.current=null},[n,e]),(0,Z.useEffect)(()=>{k(1)},[y]),(0,Z.useEffect)(()=>{n&&s&&e&&j.current!==e&&(j.current=e,ee(new Set((s.members??[]).map(e=>e.userId))))},[n,s,e]);let F=(0,Z.useMemo)(()=>l?$e(l,y,A):[],[l,y,A]);async function se(t,n){if(e)try{n?await p({groupId:e,userId:t}):await d({groupId:e,userId:t})}catch(e){v.error(pe(),e)}}async function ce(t,n){if(e)try{await _({groupId:e,userId:t,manager:!n})}catch(e){v.error(Ce(),e)}}let I=rt(F,e=>M.has(e.userId)),le=F.filter(e=>M.has(e.userId)).length,L=it(F,O,ot);async function R(){if(!e||F.length===0)return;let t=F.map(e=>e.userId);try{await m({groupId:e,userIds:t,member:I!==`all`})}catch(e){v.error(pe(),e)}}return(0,Q.jsx)(Ve,{open:n,onOpenChange:i,children:(0,Q.jsxs)(Ge,{className:`oc-access`,children:[(0,Q.jsxs)(Ue,{children:[(0,Q.jsx)(He,{children:oe({name:t})}),(0,Q.jsx)(Be,{children:r()})]}),(0,Q.jsxs)(Ne,{value:E,onValueChange:D,className:`oc-access__tabs`,children:[(0,Q.jsxs)(Me,{className:`w-full`,children:[(0,Q.jsxs)(B,{value:`members`,className:`flex-1 gap-1.5`,children:[(0,Q.jsx)(Qe,{size:13,"aria-hidden":!0}),C(),s?(0,Q.jsx)(J,{variant:`secondary`,className:`oc-access__tabcount`,children:M.size}):null]}),(0,Q.jsxs)(B,{value:`agents`,className:`flex-1 gap-1.5`,children:[(0,Q.jsx)(U,{size:13,"aria-hidden":!0}),te(),s?(0,Q.jsx)(J,{variant:`secondary`,className:`oc-access__tabcount`,children:P.size}):null]}),(0,Q.jsxs)(B,{value:`charts`,className:`flex-1 gap-1.5`,children:[(0,Q.jsx)(Ze,{size:13,"aria-hidden":!0}),de(),s?(0,Q.jsx)(J,{variant:`secondary`,className:`oc-access__tabcount`,children:s.chartCount}):null]})]}),(0,Q.jsx)(V,{value:`members`,children:l===void 0||s===void 0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:w()}):l.length===0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:h()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(G,{value:y,onChange:e=>b(e.target.value),placeholder:re(),className:`oc-access__search`}),F.length===0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:g()}):(0,Q.jsxs)(Q.Fragment,{children:[F.length>1?(0,Q.jsxs)(`div`,{className:`oc-access__row oc-access__selectall`,children:[(0,Q.jsx)(q,{checked:I===`all`?!0:I===`some`?`indeterminate`:!1,onCheckedChange:()=>void R(),"aria-label":z()}),(0,Q.jsx)(`span`,{className:`oc-access__label`,children:z()}),(0,Q.jsxs)(J,{variant:`outline`,className:`oc-access__count`,children:[le,` / `,F.length]})]}):null,(0,Q.jsx)(`div`,{className:`oc-access__list`,children:L.pageItems.map(e=>{let t=M.has(e.userId),n=tt(e),r=ie.has(e.userId);return(0,Q.jsxs)(`div`,{className:`oc-access__row`,children:[(0,Q.jsx)(q,{checked:t,onCheckedChange:()=>void se(e.userId,t),"aria-label":a({user:n.primary})}),(0,Q.jsxs)(`span`,{className:`oc-access__who`,children:[(0,Q.jsx)(`span`,{className:`oc-access__label`,title:n.primary,children:n.primary}),n.secondary?(0,Q.jsx)(`span`,{className:`oc-access__sub`,title:n.secondary,children:n.secondary}):null]}),(0,Q.jsx)(J,{variant:`outline`,className:`oc-access__role`,children:nt(e.role)}),(0,Q.jsx)(`span`,{className:`oc-access__mgrslot`,children:t&&ae?(0,Q.jsx)(H,{type:`button`,variant:`ghost`,size:`icon`,className:`shrink-0 oc-access__mgr${r?` oc-access__mgr--on`:``}`,"aria-pressed":r,"aria-label":r?Oe():N(),title:r?Oe():N(),onClick:()=>void ce(e.userId,r),children:(0,Q.jsx)(X,{size:15,"aria-hidden":!0})}):t&&r?(0,Q.jsx)(`span`,{className:`oc-access__mgr oc-access__mgr--on`,role:`img`,"aria-label":Ee(),title:Ee(),children:(0,Q.jsx)(X,{size:15,"aria-hidden":!0})}):null})]},e._id)})}),(0,Q.jsx)(st,{page:L.page,pageCount:L.pageCount,onPage:k})]})]})}),(0,Q.jsx)(V,{value:`agents`,children:c===void 0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:w()}):c.length===0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:f()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(G,{value:x,onChange:e=>S(e.target.value),placeholder:ne(),className:`oc-access__search`}),(0,Q.jsx)(`div`,{className:`oc-access__list`,children:c.map(t=>(0,Q.jsx)(lt,{groupId:e,instanceName:t.name,kind:t.kind??`openclaw`,assigned:P,query:x},`${e}-${t._id}`))})]})}),(0,Q.jsx)(V,{value:`charts`,children:(0,Q.jsx)(ut,{groupId:e})})]})]})})}function lt({groupId:e,instanceName:t,kind:n,assigned:r,query:a}){let s=o(u.groups.listAssignableAgents,{instanceName:t}),c=T(u.groups.assignAgentToGroup),l=T(u.groups.removeAgentFromGroup),d=T(u.groups.bulkSetGroupAgents),f=W(),[p,m]=(0,Z.useState)(1);if((0,Z.useEffect)(()=>{m(1)},[a]),!e)return null;let h=et(s?.agents??[],a),g=s?.discovery&&!s.discovery.lastPollOk;if(a.trim()&&h.length===0)return null;let _=h.filter(e=>e.presentInLastOk!==!1&&e.enabled!==!1),x=rt(_,e=>r.has(`${t}/${e.agentId}`)),C=it(h,p,ot);async function w(n,r){try{r?await l({groupId:e,instanceName:t,agentId:n}):await c({groupId:e,instanceName:t,agentId:n})}catch(e){f.error(_e(),e)}}async function E(){if(_.length===0)return;let n=_.map(e=>e.agentId);try{await d({groupId:e,instanceName:t,agentIds:n,assigned:x!==`all`})}catch(e){f.error(_e(),e)}}return(0,Q.jsxs)(`div`,{className:`oc-access__group`,children:[(0,Q.jsxs)(`div`,{className:`oc-access__instance`,children:[(0,Q.jsx)(U,{size:13,"aria-hidden":!0}),(0,Q.jsx)(`span`,{children:t}),(0,Q.jsx)(J,{variant:`outline`,className:`oc-access__kind`,children:n}),g?(0,Q.jsx)(J,{variant:`outline`,className:`oc-access__stale`,children:y()}):null]}),s===void 0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:v()}):h.length===0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:g?b():S()}):(0,Q.jsxs)(Q.Fragment,{children:[_.length>1?(0,Q.jsxs)(`div`,{className:`oc-access__row oc-access__selectall`,children:[(0,Q.jsx)(q,{checked:x===`all`?!0:x===`some`?`indeterminate`:!1,onCheckedChange:()=>void E(),"aria-label":z()}),(0,Q.jsx)(`span`,{className:`oc-access__label`,children:z()})]}):null,C.pageItems.map(e=>{let n=`${t}/${e.agentId}`,a=r.has(n),o=e.presentInLastOk===!1,s=!e.enabled;return(0,Q.jsxs)(`div`,{className:`oc-access__row${s?` is-disabled`:``}`,children:[(0,Q.jsx)(q,{checked:a,disabled:(o||s)&&!a,onCheckedChange:()=>void w(e.agentId,a),"aria-label":Ae({name:e.displayName??e.agentId})}),(0,Q.jsxs)(`span`,{className:`oc-access__label`,title:e.displayName??e.agentId,children:[e.emoji?`${e.emoji} `:``,e.displayName??e.agentId]}),e.model?(0,Q.jsx)(`span`,{className:`oc-access__model`,children:e.model}):null,e.isDefaultOnInstance?(0,Q.jsx)(`span`,{className:`oc-access__fav`,role:`img`,"aria-label":i(),title:i(),children:(0,Q.jsx)(K,{size:14,fill:`currentColor`})}):null,o?(0,Q.jsx)(J,{variant:`outline`,className:`oc-access__gone`,children:ue()}):null]},e.agentId)}),(0,Q.jsx)(st,{page:C.page,pageCount:C.pageCount,onPage:m})]})]})}function ut({groupId:e}){let t=o(u.charts.listGroupChartSelection,e?{groupId:e}:`skip`),n=T(u.charts.assignChartToGroup),r=T(u.charts.removeChartFromGroup),i=T(u.charts.setGroupDefaultChart),a=T(u.charts.addChartToGroupPool),c=T(u.charts.removeChartFromGroupPool),f=W();if(!e)return null;if(t===void 0)return(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:w()});let{pool:p,addable:m,canManagePool:h}=t;if(p.length===0&&!h)return(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:x()});async function g(t,i){try{i?await r({groupId:e,chartKey:t}):await n({groupId:e,chartKey:t})}catch(e){f.error(j(),e)}}async function _(t){try{await i({groupId:e,chartKey:t})}catch(e){f.error(j(),e)}}async function v(t){try{await a({groupId:e,chartKey:t})}catch(e){f.error(j(),e)}}async function y(t){try{await c({groupId:e,chartKey:t})}catch(e){f.error(j(),e)}}return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`div`,{className:`oc-access__list`,children:p.map(e=>(0,Q.jsxs)(`div`,{className:`oc-access__row`,children:[(0,Q.jsx)(q,{checked:e.selected,onCheckedChange:()=>void g(e.chartKey,e.selected),"aria-label":Te({name:e.name})}),(0,Q.jsx)(`span`,{className:`oc-access__label`,title:e.name,children:e.name}),e.selected?e.isDefault?(0,Q.jsx)(`span`,{className:`oc-access__fav`,role:`img`,"aria-label":s(),title:s(),children:(0,Q.jsx)(K,{size:14,fill:`currentColor`})}):(0,Q.jsx)(H,{type:`button`,variant:`ghost`,size:`sm`,onClick:()=>void _(e.chartKey),children:E()}):null,h?(0,Q.jsx)(H,{type:`button`,variant:`ghost`,size:`sm`,"aria-label":O({name:e.name}),title:O({name:e.name}),onClick:()=>void y(e.chartKey),children:(0,Q.jsx)(je,{size:14,"aria-hidden":!0})}):null]},e.chartKey))}),h?m.length>0?(0,Q.jsxs)(Re,{value:``,onValueChange:e=>void v(e),children:[(0,Q.jsx)(Pe,{size:`sm`,className:`oc-access__search`,children:(0,Q.jsx)(Ke,{placeholder:d()})}),(0,Q.jsx)(qe,{children:m.map(e=>(0,Q.jsx)(Le,{value:e.chartKey,children:e.name},e.chartKey))})]}):p.length===0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:l()}):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,$y as i,Ab as a,Ai as o,Ax as s,Bb as c,Cb as l,Cj as u,Cx as d,Db as f,Dx as p,E as m,Eb as h,Ex as g,Fb as _,Fx as v,Gb as y,Hb as b,Ib as x,Ix as S,Jb as C,Jh as ee,Jt as w,Kb as T,Lb as E,Lx as te,Mb as ne,Mi as re,Mx as ie,Nb as ae,Nx as oe,Ob as se,Ox as ce,Pb as le,Px as ue,Qb as de,Qy as fe,Rb as pe,Rx as me,Sb as he,Sj as D,Sx as ge,Tb as _e,Tx as ve,Ub as ye,Vb as be,Wb as O,XE as k,Xb as xe,Xt as Se,YE as A,Yb as Ce,Yt as we,Zb as Te,_b as Ee,_x as De,ab as Oe,ax as ke,bb as Ae,bj as j,bx as je,cb as Me,cx as Ne,db as Pe,dx as Fe,eb as Ie,ex as M,fb as Le,fx as Re,gb as ze,gx as Be,hb as Ve,hx as He,ib as Ue,ix as We,jb as Ge,ji as Ke,jx as qe,kb as Je,ki as Ye,kx as Xe,lb as Ze,lx as Qe,mb as $e,mx as et,nb as tt,nx as nt,ob as rt,ox as it,pb as at,px as ot,qb as st,qh as ct,rb as lt,rx as ut,sb as dt,sx as ft,tb as pt,tx as mt,ub as ht,ux as gt,vb as _t,vx as vt,wb as yt,wx as bt,xb as xt,xx as St,yb as N,yx as Ct,zb as wt}from"./dist-tr7LmvAR.js";import{a as Tt,c as Et}from"./FieldLabel-BPj-rFdV.js";import{t as P}from"./button-CtB6NRj2.js";import{$ as Dt,C as F,H as Ot,Q as kt,S as I,V as L,b as R,ct as z,dt as B,et as At,lt as V,mt as H,p as U,pt as W,st as G,u as jt,ut as K,w as q,x as J}from"./index-D3n1_9Fa.js";import{t as Mt}from"./DataTableShell-CKQRa8xi.js";import{InstanceConfigDialog as Nt}from"./BridgeTab-DcrewE6Z.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=u(m.admin.listInstances,{}),t=u(m.agents.listAllInstanceAgents,{}),n=D(m.admin.upsertInstance),r=D(m.admin.deleteInstance),a=L(),[o,c]=(0,Y.useState)(!1),[l,f]=(0,Y.useState)(Q),[h,_]=(0,Y.useState)(null),[y,b]=(0,Y.useState)(null),[x,C]=(0,Y.useState)(null),[T,E]=(0,Y.useState)(null);async function ne(){try{await n({instanceId:T??void 0,name:l.name,gatewayUrl:l.gatewayUrl,bridgeUrl:l.bridgeUrl||void 0,displayName:l.displayName||void 0,kind:l.kind,transport:l.kind===`hermes`?l.transport:void 0,gatewayVersion:l.gatewayVersion||void 0,gatewayHttpUrl:l.gatewayHttpUrl||void 0,streamTransport:l.streamTransport}),f(Q),E(null),c(!1)}catch(e){a.error(S(),e)}}return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`p`,{className:`oc-admin__hint`,children:[v(),(0,Z.jsx)(`strong`,{children:ue()}),oe()]}),(0,Z.jsx)(Mt,{title:ie(),rows:e,addLabel:qe(),onAdd:()=>{E(null),f(Q),c(!0)},emptyHint:s(),columns:[{header:Xe(),cell:e=>e.name,sort:e=>e.name},{header:ce(),cell:e=>(0,Z.jsx)(G,{variant:`outline`,children:e.kind??`openclaw`}),sort:e=>e.kind??`openclaw`},{header:p(),cell:e=>e.gatewayUrl,sort:e=>e.gatewayUrl},{header:g(),cell:e=>e.displayName??`—`,sort:e=>e.displayName??null},{header:me(),cell:e=>{let n=(t?.[e.name]??[]).filter(e=>e.presentInLastOk!==!1&&e.enabled);if(n.length===0)return(0,Z.jsx)(`span`,{className:`text-muted-foreground`,children:`—`});let r=t=>e.defaultAgentId===t;return(0,Z.jsx)(`div`,{className:`flex flex-wrap gap-1`,children:[...n].sort((e,t)=>Number(r(t.agentId))-Number(r(e.agentId))).map(e=>(0,Z.jsxs)(G,{variant:r(e.agentId)?`default`:`outline`,title:r(e.agentId)?i():void 0,children:[e.emoji?`${e.emoji} `:``,e.displayName??e.agentId]},e.agentId))})}}],rowActions:e=>[{label:ge(),onSelect:()=>{E(e._id),f(Rt(e)),c(!0)}},{label:te(),onSelect:()=>_(e.name)},{label:ft(),onSelect:()=>C(e)},{label:ve(),onSelect:()=>b(e)},{label:bt(),variant:`destructive`,onSelect:()=>void r({instanceId:e._id})}],bulkActions:[{label:bt(),variant:`destructive`,onSelect:e=>e.forEach(e=>void r({instanceId:e}))}]}),(0,Z.jsx)(jt,{open:o,onOpenChange:c,title:T?St():d(),description:Ct(),canSubmit:!!(l.name&&l.gatewayUrl),onSubmit:ne,submitLabel:vt(),children:(0,Z.jsxs)(`div`,{className:`oc-form`,children:[(0,Z.jsxs)($,{label:De(),children:[(0,Z.jsx)(z,{value:l.name,disabled:T!==null,onChange:e=>f({...l,name:e.target.value})}),T?(0,Z.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:je()}):null]}),(0,Z.jsx)($,{label:Be(),children:(0,Z.jsxs)(R,{value:l.kind,onValueChange:e=>f({...l,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)(I,{value:`openclaw`,children:`OpenClaw`}),(0,Z.jsx)(I,{value:`hermes`,children:`Hermes`})]})]})}),l.kind===`hermes`?(0,Z.jsx)($,{label:Se(),children:(0,Z.jsxs)(R,{value:l.transport,onValueChange:e=>f({...l,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)(I,{value:`ws`,children:we()}),(0,Z.jsx)(I,{value:`rest`,children:w()})]})]})}):null,(0,Z.jsx)($,{label:He(),children:(0,Z.jsx)(z,{value:l.gatewayUrl,onChange:e=>f({...l,gatewayUrl:e.target.value})})}),(0,Z.jsx)($,{label:et(),children:(0,Z.jsx)(z,{value:l.bridgeUrl,placeholder:ot(),onChange:e=>f({...l,bridgeUrl:e.target.value})})}),(0,Z.jsx)($,{label:Re(),children:(0,Z.jsx)(z,{value:l.displayName,onChange:e=>f({...l,displayName:e.target.value})})}),(0,Z.jsxs)($,{label:ee(),children:[(0,Z.jsxs)(R,{value:l.streamTransport,onValueChange:e=>f({...l,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)(I,{value:e,children:e},e))})]}),(0,Z.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:ct()})]}),(0,Z.jsx)($,{label:Fe(),children:(0,Z.jsx)(z,{value:l.gatewayVersion,placeholder:gt(),onChange:e=>f({...l,gatewayVersion:e.target.value})})}),(0,Z.jsx)($,{label:Qe(),children:(0,Z.jsx)(z,{value:l.gatewayHttpUrl,placeholder:Ne(),onChange:e=>f({...l,gatewayHttpUrl:e.target.value})})})]})}),(0,Z.jsx)(Yt,{instanceName:h,open:h!==null,onOpenChange:e=>{e||_(null)}}),y?(0,Z.jsx)(Nt,{instance:y,onClose:()=>b(null)},y._id):null,x?(0,Z.jsx)(Bt,{instance:x,onClose:()=>C(null)},x._id):null]})}function Bt({instance:e,onClose:t}){let n=u(m.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)(V,{open:!0,onOpenChange:e=>!e&&t(),children:(0,Z.jsxs)(K,{onOpenAutoFocus:e=>e.preventDefault(),children:[(0,Z.jsxs)(W,{children:[(0,Z.jsx)(H,{children:it({instance:e.displayName??e.name})}),(0,Z.jsx)(B,{children:ke()})]}),(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=j(m.instanceSync.forceInstanceSync),n=L(),[r,i]=(0,Y.useState)(!1);async function a(){if(!r){i(!0);try{switch((await t({instanceId:e._id})).status){case`synced`:n.success(wt());break;case`no_agents`:n.success(E());break;case`no_bridge_url`:n.error(x());break;case`deploy_misconfigured`:n.error(_());break;case`unauthorized`:n.error(ae());break;case`not_served`:n.error(ne());break;default:n.error(le());break}}catch(e){n.error(pe(),e)}finally{i(!1)}}}return(0,Z.jsxs)(`div`,{className:`oc-form`,children:[(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:Ge()}),(0,Z.jsx)(`div`,{className:`flex items-center gap-2`,children:(0,Z.jsx)(P,{size:`sm`,variant:`outline`,onClick:()=>void a(),disabled:r,children:r?c():be()})})]})}function Ht({instance:e}){let t=u(m.bridgeAuth.listBridgeAuthStatus,{}),n=j(m.bridgeAuth.mintBridgeSecret),r=D(m.bridgeAuth.revokeBridgeSecret),i=L(),[o,s]=(0,Y.useState)(!1),[c,d]=(0,Y.useState)(null),[p,g]=(0,Y.useState)(!1),_=(t??[]).find(t=>t.instanceId===e._id),v=_!==void 0;async function y(){if(!o){s(!0);try{d((await n({instanceId:e._id})).plaintext),g(!1)}catch(e){i.error(yt(),e)}finally{s(!1)}}}async function b(){if(!o){s(!0);try{await r({instanceId:e._id}),d(null),i.success(_e())}catch(e){i.error(yt(),e)}finally{s(!1)}}}async function x(){if(c)try{await navigator.clipboard.writeText(c),g(!0)}catch{}}return(0,Z.jsxs)($,{label:a(),children:[(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:Je()}),(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Z.jsx)(G,{variant:v?`outline`:`secondary`,children:v?`${mt()} · ${_.prefix}…${_.lastFour}`:M()}),(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(P,{size:`sm`,onClick:()=>void y(),disabled:o,children:v?f():se()}),v?(0,Z.jsx)(P,{size:`sm`,variant:`destructive`,onClick:()=>void b(),disabled:o,children:h()}):null]})]}),c?(0,Z.jsxs)(`div`,{className:`oc-bridgesecret__reveal`,children:[(0,Z.jsx)(`p`,{className:`oc-sa__minted-warning`,children:l()}),(0,Z.jsxs)(`div`,{className:`oc-sa__minted-box`,children:[(0,Z.jsx)(`code`,{className:`oc-sa__minted-plain`,children:c}),(0,Z.jsx)(P,{variant:`outline`,size:`sm`,onClick:()=>void x(),children:p?k():A()})]}),(0,Z.jsx)(P,{size:`sm`,variant:`ghost`,onClick:()=>{d(null),g(!1)},children:he()})]}):null]})}function Ut({instanceId:e,field:t,updatedAt:n}){let i=j(m.instanceSecrets.setInstanceSecret),a=D(m.instanceSecrets.clearInstanceSecret),o=j(m.deviceIdentity.generateDeviceIdentity),s=L(),[c,l]=(0,Y.useState)(``),[u,d]=(0,Y.useState)(!1),[f,p]=(0,Y.useState)(null),[h,g]=(0,Y.useState)(!1),_=n!==null,v=t===`deviceIdentity`,x=t===`token`?We():t===`deviceIdentity`?ut():nt();async function S(){if(!(!c.trim()||u)){d(!0);try{await i({instanceId:e,field:t,plaintext:c}),l(``),p(null),g(!1),s.success(Ce())}catch(e){s.error(C(),e)}finally{d(!1)}}}async function ee(){if(!u){d(!0);try{await a({instanceId:e,field:t}),p(null),g(!1),s.success(st())}catch(e){s.error(C(),e)}finally{d(!1)}}}async function w(){if(!u){d(!0);try{p(await o({instanceId:e})),g(!1),s.success(O())}catch(e){s.error(b(),e)}finally{d(!1)}}}let E=f?`openclaw devices approve ${f.id}`:``;async function te(){if(E)try{await navigator.clipboard.writeText(E),g(!0)}catch{}}return(0,Z.jsxs)($,{label:x,children:[v?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:y()}):null,(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Z.jsx)(G,{variant:_?`outline`:`secondary`,children:_?mt():M()}),(0,Z.jsx)(z,{type:`password`,autoComplete:`off`,className:`flex-1 min-w-32`,value:c,placeholder:_?de():r(),onChange:e=>l(e.target.value)}),(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(P,{size:`sm`,onClick:()=>void S(),disabled:u||c.trim().length===0,children:Te()}),v?(0,Z.jsx)(P,{size:`sm`,variant:`outline`,onClick:()=>void w(),disabled:u,children:T()}):null,_?(0,Z.jsx)(P,{size:`sm`,variant:`destructive`,onClick:()=>void ee(),disabled:u,children:xe()}):null]})]}),f?(0,Z.jsxs)(`div`,{className:`oc-bridgesecret__reveal`,children:[(0,Z.jsx)(`p`,{className:`text-sm font-medium`,children:O()}),(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:ye()}),(0,Z.jsxs)(`div`,{className:`oc-sa__minted-box`,children:[(0,Z.jsx)(`code`,{className:`oc-sa__minted-plain`,children:E}),(0,Z.jsx)(P,{variant:`outline`,size:`sm`,onClick:()=>void te(),children:h?k():A()})]}),(0,Z.jsx)(P,{size:`sm`,variant:`ghost`,onClick:()=>{p(null),g(!1)},children:he()})]}):null]})}var Wt={conversational:$e,documentary:Le,summarizer:re,curator:o},Gt={conversational:at,documentary:Pe,summarizer:Ke,curator:Ye},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:_t()}),t.map(e=>(0,Z.jsx)(G,{variant:`secondary`,className:`oc-agenttype__chip`,title:qt(e),children:Kt(e)},e)),(0,Z.jsxs)(kt,{children:[(0,Z.jsx)(At,{asChild:!0,children:(0,Z.jsx)(P,{type:`button`,variant:`outline`,size:`sm`,className:`h-7`,children:Ee()})}),(0,Z.jsxs)(Dt,{align:`start`,className:`oc-agenttypes-pop`,children:[(0,Z.jsx)(`p`,{className:`oc-agenttypes-pop__title`,children:ze()}),(0,Z.jsx)(`p`,{className:`oc-agenttypes-pop__hint`,children:Ve()}),(0,Z.jsx)(`div`,{className:`oc-agenttypes-pop__list`,children:X.map(r=>{let i=`agtype-${e}-${r}`;return(0,Z.jsxs)(`div`,{className:`oc-agenttypes-pop__item`,children:[(0,Z.jsx)(U,{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=u(m.agents.listAgentsForInstance,t&&e?{instanceName:e}:`skip`),a=D(m.agents.setAgentEnabled).withOptimisticUpdate((e,{instanceName:t,agentId:n,enabled:r})=>{let i=e.getQuery(m.agents.listAgentsForInstance,{instanceName:t});i&&e.setQuery(m.agents.listAgentsForInstance,{instanceName:t},{...i,agents:i.agents.map(e=>e.agentId===n?{...e,enabled:r}:e)})}),o=D(m.agents.setInstanceDefaultAgent).withOptimisticUpdate((e,{instanceName:t,agentId:n})=>{let r=e.getQuery(m.agents.listAgentsForInstance,{instanceName:t});r&&e.setQuery(m.agents.listAgentsForInstance,{instanceName:t},{...r,defaultAgentId:n})}),s=D(m.agents.setAgentTypes).withOptimisticUpdate((e,{instanceName:t,agentId:n,types:r})=>{let i=e.getQuery(m.agents.listAgentsForInstance,{instanceName:t});if(!i)return;let a=It(r);e.setQuery(m.agents.listAgentsForInstance,{instanceName:t},{...i,agents:i.agents.map(e=>e.agentId===n?{...e,types:a}:e)})}),c=D(m.agents.removeInstanceAgent),l=Ot(),d=L();async function f(t,n){if(e)try{await a({instanceName:e,agentId:t,enabled:n})}catch(e){d.error(N(),e)}}async function p(t){if(e)try{await o({instanceName:e,agentId:t})}catch(e){d.error(N(),e)}}async function h(t,n,r){if(!e)return;let i=r.includes(n)?r.filter(e=>e!==n):[...r,n];try{await s({instanceName:e,agentId:t,types:i})}catch(e){d.error(N(),e)}}async function g(t,n){if(e&&await l({title:Me({name:n}),description:dt(),confirmLabel:rt(),destructive:!0}))try{await c({instanceName:e,agentId:t}),d.success(Oe())}catch(e){d.error(N(),e)}}return(0,Z.jsx)(V,{open:t,onOpenChange:n,children:(0,Z.jsxs)(K,{className:`oc-access`,children:[(0,Z.jsxs)(W,{children:[(0,Z.jsx)(H,{children:xt({name:e??``})}),(0,Z.jsx)(B,{children:Ae()})]}),r===void 0?(0,Z.jsx)(`p`,{className:`oc-access__hint`,children:Ue()}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`div`,{className:`oc-access__poll`,children:r.discovery===null?lt():r.discovery.lastPollOk?tt():pt({error:r.discovery.error??`?`})}),r.agents.length===0?(0,Z.jsx)(`p`,{className:`oc-access__hint`,children:Ie()}):(0,Z.jsx)(`div`,{className:`oc-access__list`,children:r.agents.map(e=>{let t=e.presentInLastOk===!1,n=r.defaultAgentId===e.agentId,a=e.displayName??e.agentId,o=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)(U,{checked:e.enabled,disabled:t,"aria-label":a,onCheckedChange:t=>void f(e.agentId,t===!0)}),(0,Z.jsxs)(`span`,{className:`oc-agentcard__name`,title:a,children:[e.emoji?`${e.emoji} `:``,a]}),e.model?(0,Z.jsx)(`span`,{className:`oc-access__model`,children:e.model}):null,t?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(G,{variant:`outline`,className:`oc-access__gone`,children:fe()}),(0,Z.jsx)(P,{size:`sm`,variant:`ghost`,className:`h-7 text-destructive`,onClick:()=>void g(e.agentId,a),children:Ze()})]}):n?(0,Z.jsx)(G,{variant:`default`,children:i()}):(0,Z.jsx)(P,{size:`sm`,variant:`outline`,className:`h-7`,disabled:!e.enabled,onClick:()=>void p(e.agentId),children:ht()})]}),e.enabled?(0,Z.jsx)(Jt,{agentId:e.agentId,types:o,onToggle:t=>void h(e.agentId,t,o)}):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{$a as r,CC as i,Cj as a,DC as o,E as s,EC as c,Ga as l,Ja as u,Ka as d,Qa as f,SC as p,Sj as m,TC as h,Xa as g,Ya as _,Za as v,_C as y,bC as b,bj as x,gC as S,hC as C,mC as w,qa as T,vC as E,wC as D,xC as O,yC as k}from"./dist-tr7LmvAR.js";import{t as A}from"./button-CtB6NRj2.js";import{ct as j,p as M,st as N}from"./index-D3n1_9Fa.js";var P=t(e(),1),F=n();function I(){let e=a(s.integrations.status.status,{}),t=m(s.admin.setIntegrationConfig),[n,l]=(0,P.useState)(null);if((0,P.useEffect)(()=>{e&&n===null&&l(e.config)},[e,n]),!e||!n)return(0,F.jsx)(`p`,{className:`oc-admin__hint`,children:o()});let u=n,d=(e,t,n)=>l({...u,[e]:{...u[e],[t]:n}}),g=(e,n)=>void t({[e]:n});return(0,F.jsxs)(F.Fragment,{children:[(0,F.jsxs)(`p`,{className:`oc-admin__hint`,children:[c(),` `,(0,F.jsx)(`strong`,{children:h()}),` `,D()]}),(0,F.jsxs)(L,{title:`Langfuse`,status:e.langfuse.configured?e.langfuse.enabled?(0,F.jsx)(N,{variant:`secondary`,children:i()}):(0,F.jsx)(N,{variant:`outline`,children:p()}):(0,F.jsx)(N,{variant:`outline`,children:O()}),note:b(),children:[(0,F.jsx)(R,{label:E(),children:(0,F.jsx)(j,{value:u.langfuse.host??``,placeholder:e.langfuse.effectiveHost,onChange:e=>d(`langfuse`,`host`,e.target.value),onBlur:()=>g(`langfuse`,{host:u.langfuse.host??``})})}),(0,F.jsx)(z,{label:w(),checked:u.langfuse.enabled??!0,onChange:e=>{d(`langfuse`,`enabled`,e),g(`langfuse`,{enabled:e})}})]}),(0,F.jsxs)(L,{title:`Opik`,status:e.opik.configured?e.opik.enabled?(0,F.jsx)(N,{variant:`secondary`,children:i()}):(0,F.jsx)(N,{variant:`outline`,children:p()}):(0,F.jsx)(N,{variant:`outline`,children:O()}),note:k(),children:[(0,F.jsx)(R,{label:y(),children:(0,F.jsx)(j,{value:u.opik.baseUrl??``,placeholder:e.opik.effectiveBaseUrl,onChange:e=>d(`opik`,`baseUrl`,e.target.value),onBlur:()=>g(`opik`,{baseUrl:u.opik.baseUrl??``})})}),(0,F.jsx)(R,{label:S(),children:(0,F.jsx)(j,{value:u.opik.workspace??``,placeholder:e.opik.effectiveWorkspace||C(),onChange:e=>d(`opik`,`workspace`,e.target.value),onBlur:()=>g(`opik`,{workspace:u.opik.workspace??``})})}),(0,F.jsx)(z,{label:w(),checked:u.opik.enabled??!0,onChange:e=>{d(`opik`,`enabled`,e),g(`opik`,{enabled:e})}})]}),(0,F.jsxs)(L,{title:`OpenTelemetry (OTLP)`,status:e.otlp.configured?e.otlp.enabled?(0,F.jsx)(N,{variant:`secondary`,children:i()}):(0,F.jsx)(N,{variant:`outline`,children:p()}):(0,F.jsx)(N,{variant:`outline`,children:r()}),note:f(),children:[(0,F.jsx)(R,{label:v(),children:(0,F.jsx)(j,{value:u.otlp.endpoint??``,placeholder:e.otlp.effectiveEndpoint||`https://otlp.example.com/v1/traces`,onChange:e=>d(`otlp`,`endpoint`,e.target.value),onBlur:()=>g(`otlp`,{endpoint:u.otlp.endpoint??``})})}),(0,F.jsx)(B,{headersSet:e.otlp.headersSet}),(0,F.jsx)(z,{label:w(),checked:u.otlp.enabled??!0,onChange:e=>{d(`otlp`,`enabled`,e),g(`otlp`,{enabled:e})}})]})]})}function L({title:e,status:t,note:n,children:r}){return(0,F.jsxs)(`section`,{className:`oc-int__section`,children:[(0,F.jsxs)(`div`,{className:`oc-int__section-head`,children:[(0,F.jsx)(`h3`,{className:`oc-uipa__h`,children:e}),t]}),n?(0,F.jsx)(`p`,{className:`oc-uipa__note`,children:n}):null,(0,F.jsx)(`div`,{className:`oc-int__fields`,children:r})]})}function R({label:e,children:t}){return(0,F.jsxs)(`label`,{className:`oc-int__field`,children:[(0,F.jsx)(`span`,{className:`oc-int__field-label`,children:e}),t]})}function z({label:e,checked:t,onChange:n}){return(0,F.jsxs)(`label`,{className:`oc-int__toggle`,children:[(0,F.jsx)(M,{checked:t,onCheckedChange:e=>n(e===!0)}),(0,F.jsx)(`span`,{children:e})]})}function B({headersSet:e}){let t=x(s.integrations.otlpSecret.setOtlpHeaders),n=m(s.integrations.otlpSecret.clearOtlpHeaders),[r,i]=(0,P.useState)(``),[a,o]=(0,P.useState)(null),[c,f]=(0,P.useState)(!1),p=async()=>{f(!0),o(null);try{await t({headersJson:r}),i(``)}catch(e){o(e instanceof Error?e.message:String(e))}finally{f(!1)}};return(0,F.jsxs)(R,{label:g(),children:[(0,F.jsx)(j,{value:r,placeholder:e?_():u(),onChange:e=>i(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 p(),children:T()}),e?(0,F.jsx)(A,{variant:`ghost`,size:`sm`,disabled:c,onClick:()=>void n({}),children:d()}):null]}),a?(0,F.jsx)(`p`,{className:`oc-int__otlp-headers-error`,children:a}):null,(0,F.jsx)(`p`,{className:`oc-uipa__note`,children:l()})]})}export{I as IntegrationsTab};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$C as r,Cj as i,E as a,Fw as o,am as s,cm as c,cw as l,dm as u,ew as d,fm as f,im as p,lm as m,lw as h,mm as g,nm as ee,om as _,pm as v,rm as y,sm as b,sw as x,tm as S,um as C,uw as w}from"./dist-tr7LmvAR.js";import{Jt as T,a as E,bt as D,n as te,qt as ne,r as re}from"./index-D3n1_9Fa.js";import{a as O,n as k,o as A,r as j,t as M}from"./card-CsumpaGg.js";import{n as N,t as P}from"./TimeRangePicker-CbbfR2tN.js";var F=t(e(),1),I=n(),L=15,R=e=>String(Math.round(e));function z(){let e=i(a.me.getMe,{host:D})?.permissions?.includes(`traces.read`)??!1,t=i(a.deliveryTiming.listDeliverySessions,e?{}:`skip`),n=(0,F.useMemo)(()=>t?t.filter(e=>!e.active&&e.rollup!==null&&e.rollup.cP50!==null&&e.rollup.aP50!==null).slice(0,L).reverse().map(e=>({startedAt:e.startedAt,cP50:e.rollup?.cP50,aP50:e.rollup?.aP50})):[],[t]);return t===void 0?null:(0,I.jsxs)(`section`,{className:`oc-kpi__group`,children:[(0,I.jsx)(`h2`,{className:`oc-kpi__group-title`,children:o()}),(0,I.jsxs)(M,{children:[(0,I.jsxs)(O,{children:[(0,I.jsx)(A,{children:w()}),(0,I.jsx)(j,{children:l()})]}),(0,I.jsx)(k,{children:n.length<2?(0,I.jsx)(`p`,{className:`oc-admin__hint`,children:x()}):(0,I.jsx)(B,{series:n})})]})]})}function B({series:e}){let t=e.map(e=>e.cP50),n=e.map(e=>e.aP50),i=Math.max(1,...t,...n),a=t=>6+t*468/(e.length-1),o=e=>74-e*68/i,s=e=>e.map((e,t)=>`${t===0?`M`:`L`}${a(t).toFixed(1)},${o(e).toFixed(1)}`).join(` `),c=e[e.length-1];return(0,I.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,I.jsxs)(`div`,{className:`flex gap-3 text-xs text-muted-foreground`,children:[(0,I.jsxs)(`span`,{style:{color:`var(--primary)`},children:[r(),` p50 `,R(c.cP50),` `,h()]}),(0,I.jsxs)(`span`,{children:[d(),` p50 `,R(c.aP50),` `,h()]})]}),(0,I.jsxs)(`svg`,{viewBox:`0 0 480 80`,className:`h-20 w-full`,preserveAspectRatio:`none`,role:`img`,"aria-label":w(),children:[(0,I.jsx)(`path`,{d:s(n),fill:`none`,style:{stroke:`var(--muted-foreground)`},strokeWidth:1.5}),(0,I.jsx)(`path`,{d:s(t),fill:`none`,style:{stroke:`var(--primary)`},strokeWidth:1.5})]})]})}var V=[{metric:`api.calls`,label:g(),unit:`/h`,group:`API`,isError:!1},{metric:`api.errors`,label:v(),unit:`/h`,group:`API`,isError:!0},{metric:`api.latency.avg_ms`,label:f(),unit:`ms`,group:`API`,isError:!1},{metric:`openclaw.ingest`,label:u(),unit:`/h`,group:`OpenClaw`,isError:!1},{metric:`chat.send`,label:C(),unit:`/h`,group:`Chat`,isError:!1},{metric:`assistant.stream.errors`,label:m(),unit:`/h`,group:`Assistant`,isError:!0}],H=V.length,U=[`API`,`OpenClaw`,`Chat`,`Assistant`],W=1e3,G=36e5;function K(e,t){let n=Math.max(1,Math.ceil((t-e)/G)),r=Math.min(n*H,W);return{rowLimit:r,buckets:Math.max(1,Math.floor(r/H))}}function q(){let e=T({from:`/settings/kpi`}),t=ne({from:`/settings/kpi`}),n=re(e.from,e.to,te,`now`),r=e=>void t({search:t=>({...t,...E(e)})}),{from:o,to:l}=N(n),{rowLimit:u,buckets:d}=K(o,l),f=i(a.kpi.listKpis,{limit:u,filter:{from:o,to:l}}),p=(0,F.useMemo)(()=>{let e=new Map;for(let t of f??[]){let n=e.get(t.metric)??[];n.push({bucket:t.bucket,value:t.value}),e.set(t.metric,n)}for(let[t,n]of e)n.sort((e,t)=>e.bucket<t.bucket?-1:+(e.bucket>t.bucket)),n.length>d&&e.set(t,n.slice(n.length-d));return e},[f,d]),m=(0,I.jsxs)(I.Fragment,{children:[(0,I.jsxs)(`p`,{className:`oc-admin__hint`,children:[c(),` `,(0,I.jsx)(`span`,{className:`oc-filter__window`,children:b()})]}),(0,I.jsx)(J,{value:n,onChange:r})]});return f===void 0?(0,I.jsxs)(I.Fragment,{children:[m,(0,I.jsx)(z,{}),(0,I.jsx)(`p`,{className:`oc-admin__hint`,children:_()})]}):f.length===0?(0,I.jsxs)(I.Fragment,{children:[m,(0,I.jsx)(z,{}),(0,I.jsx)(`p`,{className:`oc-admin__hint`,children:s()})]}):(0,I.jsxs)(I.Fragment,{children:[m,(0,I.jsx)(z,{}),U.map(e=>{let t=V.filter(t=>t.group===e);return t.some(e=>(p.get(e.metric)??[]).length>0)?(0,I.jsxs)(`section`,{className:`oc-kpi__group`,children:[(0,I.jsx)(`h2`,{className:`oc-kpi__group-title`,children:e}),(0,I.jsx)(`div`,{className:`oc-kpi__grid`,children:t.map(e=>(0,I.jsx)(Y,{config:e,series:p.get(e.metric)??[]},e.metric))})]},e):null})]})}function J({value:e,onChange:t}){return(0,I.jsx)(`div`,{className:`oc-kpi__toolbar`,children:(0,I.jsx)(P,{value:e,onChange:t})})}function Y({config:e,series:t}){let n=t.length>0?t[t.length-1]:null,r=n?n.value:0;return(0,I.jsxs)(M,{size:`sm`,className:`oc-kpi__card`,children:[(0,I.jsxs)(O,{children:[(0,I.jsx)(A,{className:`oc-kpi__card-title`,children:e.label}),(0,I.jsx)(j,{className:`oc-kpi__card-metric`,children:(0,I.jsx)(`code`,{children:e.metric})})]}),(0,I.jsxs)(k,{className:`oc-kpi__card-body`,children:[(0,I.jsxs)(`div`,{className:`oc-kpi__value-row`,children:[(0,I.jsx)(`span`,{className:`oc-kpi__value`+(e.isError&&r>0?` oc-kpi__value--error`:``),children:Q(r)}),(0,I.jsx)(`span`,{className:`oc-kpi__unit`,children:e.unit})]}),(0,I.jsx)(ae,{series:t,isError:e.isError,unit:e.unit}),(0,I.jsxs)(`div`,{className:`oc-kpi__axis`,children:[n?(0,I.jsx)(`span`,{className:`oc-kpi__axis-latest`,children:p({value:$(n.bucket)})}):(0,I.jsx)(`span`,{className:`oc-kpi__muted`,children:y()}),(0,I.jsx)(`span`,{className:`oc-kpi__muted`,children:ee({count:t.length})})]})]})]})}var X=240,Z=48,ie=1;function ae({series:e,isError:t,unit:n}){if(e.length===0)return(0,I.jsx)(`div`,{className:`oc-kpi__chart oc-kpi__chart--empty`,"aria-hidden":!0});let r=e.reduce((e,t)=>t.value>e?t.value:e,0),i=X/e.length,a=Math.max(i-ie,1);return(0,I.jsx)(`svg`,{className:`oc-kpi__chart`,viewBox:`0 0 ${X} ${Z}`,preserveAspectRatio:`none`,role:`img`,"aria-label":S({max:Q(r),unit:n}),children:e.map((e,o)=>{let s=r>0?e.value/r*(Z-1):0,c=o*i,l=Z-s;return(0,I.jsx)(`rect`,{className:`oc-kpi__bar`+(t&&e.value>0?` oc-kpi__bar--error`:``),x:c,y:l,width:a,height:s,children:(0,I.jsxs)(`title`,{children:[$(e.bucket),` · `,Q(e.value),` `,n]})},e.bucket)})})}function Q(e){return Number.isFinite(e)?Math.abs(e)>=1e3?(e/1e3).toFixed(e%1e3==0?0:1)+`k`:String(e):`0`}function $(e){let t=new Date(`${e}:00:00Z`);return Number.isNaN(t.getTime())?e:`${String(t.getUTCDate()).padStart(2,`0`)}/${String(t.getUTCMonth()+1).padStart(2,`0`)} ${String(t.getUTCHours()).padStart(2,`0`)}h`}export{q as KpiTab};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$A as r,A as i,AO as a,BO as o,CO as s,Cj as c,DO as l,E as u,EO as d,F as f,FO as p,G as ee,HO as te,I as ne,IO as re,L as ie,LO as ae,M as oe,MO as se,N as ce,NO as le,OO as m,P as h,PO as g,QA as ue,RO as de,SO as fe,Sj as _,TO as pe,VO as me,X as v,XA as y,Z as b,ZA as x,_O as S,aj as C,bO as w,cO as T,dO as E,ej as D,fO as O,gO as k,hO as A,ij as j,j as M,jO as N,kO as P,lO as F,lj as I,mO as L,mj as R,n as z,nj as he,oj as ge,pO as _e,rj as ve,tj as ye,uO as be,vO as xe,vx as Se,wO as Ce,xO as B,yO as we,zO as V}from"./dist-tr7LmvAR.js";import{t as H}from"./button-CtB6NRj2.js";import{C as Te,M as Ee,S as U,V as De,_t as Oe,b as ke,bt as W,ct as G,p as K,st as q,vt as Ae,w as je,x as Me,yt as Ne}from"./index-D3n1_9Fa.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:z(`peer inline-flex h-5 w-9 shrink-0 items-center rounded-full border border-transparent transition-colors outline-none`,`focus-visible:ring-2 focus-visible:ring-ring/50`,`disabled:cursor-not-allowed disabled:opacity-50`,t?`bg-primary`:`bg-input`,e),...i,children:(0,Y.jsx)(`span`,{className:z(`pointer-events-none block size-4 rounded-full bg-background shadow transition-transform`,t?`translate-x-[18px]`:`translate-x-[2px]`)})})}var X=[{id:`messages`,label:()=>te()},{id:`composer`,label:()=>me()},{id:`sidebar`,label:()=>o()},{id:`other`,label:()=>V()}],Z={showSource:{category:`messages`,label:()=>de(),help:()=>ae()},showReport:{category:`messages`,label:()=>re(),help:()=>p()},copyAssistant:{category:`messages`,label:()=>g()},copyUser:{category:`messages`,label:()=>le()},showDelete:{category:`messages`,label:()=>se()},showTools:{category:`messages`,label:()=>N(),help:()=>a()},voiceInput:{category:`composer`,label:()=>P(),help:()=>m()},showUsage:{category:`composer`,label:()=>l(),help:()=>d()},autoReadAloud:{category:`composer`,label:()=>b(),help:()=>v()},showChatAge:{category:`sidebar`,label:()=>pe(),help:()=>Ce()},showChatProvider:{category:`sidebar`,label:()=>s(),help:()=>fe()}};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:()=>O()};function We({prefKey:e,ui:t}){let n=_(u.admin.setUiPrefDefault),r=_(u.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:k()}),(0,Y.jsxs)(ke,{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:be()}),(0,Y.jsx)(U,{value:`off`,children:F()}),(0,Y.jsx)(U,{value:`inherit`,children:T()})]})]}),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":A()}),A()]}):null]}),a?(0,Y.jsx)(`span`,{className:`oc-prefs__gov-help`,children:a}):null]})}function Ge({current:e,enabled:t}){let n=_(u.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=Ae(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)(q,{variant:`secondary`,children:Ne(e,Oe())}):null]}),(0,Y.jsx)(`span`,{className:`oc-prefs__help`,children:o?h():r?f():ne()})]}),(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?M():e?oe():ce()})]})]})}function Ke(){let[e,t]=(0,J.useState)(``),[n,r]=(0,J.useState)(!1),i=c(u.me.getMe,{host:W}),a=i?.ui,o=$(i?.role)&&n,s=_(u.me.setUiPref).withOptimisticUpdate(Ee),l=(0,J.useMemo)(()=>a?Ie(Object.keys(a.effective),e):[],[a,e]);return a?(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":S()}),S()]}):null,o?(0,Y.jsxs)(`div`,{className:`oc-prefs__gov-head`,children:[(0,Y.jsx)(`p`,{children:L()}),(0,Y.jsx)(`p`,{children:_e()}),(0,Y.jsx)(`p`,{children:E()})]}):null,(0,Y.jsx)(G,{value:e,onChange:e=>t(e.target.value),placeholder:B(),"aria-label":B(),className:`mb-2`}),l.length===0?(0,Y.jsx)(`div`,{className:`oc-prefs__empty`,children:w()}):(0,Y.jsx)(`div`,{className:`oc-prefs`,children:l.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=a.locked[e],c=a.effective[e],l=a.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)(q,{variant:`outline`,children:we()}):l?(0,Y.jsx)(q,{variant:`secondary`,children:ee()}):null]}),r?(0,Y.jsx)(`span`,{className:`oc-prefs__help`,children:r}):null]}),(0,Y.jsxs)(`div`,{className:`oc-prefs__ctl`,children:[!i&&l?(0,Y.jsx)(`button`,{type:`button`,className:`oc-prefs__reset`,onClick:()=>void s({key:e,value:null}),children:xe()}):null,(0,Y.jsx)(Fe,{checked:c,disabled:i,onCheckedChange:t=>void s({key:e,value:t}),"aria-label":n})]}),o?(0,Y.jsx)(We,{prefKey:e,ui:a}):null]},e)})]},e.id))}),(0,Y.jsx)(Ge,{current:i?.dictationShortcut??null,enabled:a.effective.voiceInput===!0})]}):(0,Y.jsx)(`div`,{className:`oc-prefs__empty`,children:R()})}function qe(){let e=c(u.me.getMe,{host:W}),t=_(u.me.setLocale),n=_(u.me.setMyName),i=De(),a=e?.locale??`default`,o=e?.name??``,[s,l]=(0,J.useState)(null),d=s??o,f=d.trim()!==o.trim();async function p(){try{await n({name:d}),l(null),i.success(he())}catch(e){i.error(ye(),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:ge()}),(0,Y.jsx)(`p`,{className:`oc-show__desc`,children:C()})]}),(0,Y.jsxs)(`div`,{className:`oc-show__row`,children:[(0,Y.jsx)(G,{className:`max-w-xs`,value:d,maxLength:120,placeholder:j(),onChange:e=>l(e.target.value),onKeyDown:e=>{e.key===`Enter`&&f&&(e.preventDefault(),p())}}),(0,Y.jsx)(H,{size:`sm`,disabled:!f,onClick:()=>void p(),children:Se()})]}),(0,Y.jsx)(`p`,{className:`oc-show__desc`,children:ve()})]}),(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:D()}),(0,Y.jsx)(`p`,{className:`oc-show__desc`,children:r()})]}),(0,Y.jsxs)(`div`,{className:`oc-show__row`,children:[Pe().map(e=>(0,Y.jsx)(H,{variant:a===e.value?`default`:`outline`,size:`sm`,onClick:()=>void t({locale:e.value}),children:e.label},e.value)),(0,Y.jsx)(H,{variant:a==="default"?`default`:`outline`,size:`sm`,onClick:()=>void t({locale:null}),children:I()})]}),(0,Y.jsx)(`p`,{className:`oc-show__desc`,children:ue()})]}),(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:x()}),(0,Y.jsx)(`p`,{className:`oc-show__desc`,children:y()})]}),(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{$n as r,$t as i,Ah as a,Bh as o,Cj as s,Dh as c,E as l,Eh as u,Fh as d,Fi as f,Hh as p,Ih as m,Ii as h,Lh as g,Li as _,Mh as v,Nh as y,Ni as b,Oh as x,Ph as S,Pi as C,Qh as w,Qn as T,Qt as E,Rh as ee,Sj as te,Th as ne,Uh as re,Vh as ie,Wh as ae,Zh as D,Zn as O,Zt as k,er as A,jh as j,kh as M,nr as N,tr as P,zh as F}from"./dist-tr7LmvAR.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 oe}from"./FieldLabel-BPj-rFdV.js";import{t as U}from"./button-CtB6NRj2.js";import{C as W,S as G,V as K,b as q,bt as se,p as ce,w as J,x as Y}from"./index-D3n1_9Fa.js";import{r as X,t as Z}from"./locales-CPjguROj.js";import{t as le}from"./localePickerView-C2RmOS86.js";/* empty css */var Q=t(e(),1),$=n(),ue={media_delivery:{label:F,help:ee},documentary_fetch:{label:g,help:m},inbound_files:{label:d,help:S},history_summary:{label:_,help:h},file_curation:{label:N,help:P}},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:c,references:u,files:ne,previous_summary:f,new_messages:C,max_chars:b,file_name:A,budget_chars:r,feedback:T,content:O};function pe(){let e=s(l.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:ae(),help:re()}),(0,$.jsxs)(`label`,{className:`oc-injtab__picker`,children:[(0,$.jsx)(`span`,{children:y()}),(0,$.jsxs)(q,{value:r._id,onValueChange:e=>n(e),children:[(0,$.jsx)(W,{size:`sm`,className:`min-w-44`,children:(0,$.jsx)(J,{})}),(0,$.jsx)(Y,{children:e.map(e=>(0,$.jsx)(G,{value:e._id,children:e.displayName??e.name},e._id))})]})]})]}),(0,$.jsx)(me,{instance:r},r._id)]})}function me({instance:e}){let t=te(l.admin.upsertInstanceConfig),n=K(),r=s(l.me.getMe,{host:se}),a=e.config??{},o=X(e.config?.contentLocale,r?.defaultLocale??void 0),[c,u]=(0,Q.useState)(()=>R(a,o));(0,Q.useEffect)(()=>{u(R(a,o))},[o,e._id]);let[d,f]=(0,Q.useState)(!1),p=c.promptInjections,m=(e,t)=>u({...c,promptInjections:{...p,[e]:{...p[e],...t}}});async function h(){f(!0);try{await t({instanceId:e._id,config:V(c,a,o)})}catch(e){n.error(D(),e)}finally{f(!1)}}async function g(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(D(),e)}}let _=e.config?.contentLocale??`default`,v=Z[X(void 0,r?.defaultLocale??void 0)];return(0,$.jsxs)(`div`,{className:`oc-injtab__body`,children:[(0,$.jsxs)(`div`,{className:`oc-injtab__content-locale`,children:[(0,$.jsx)(`span`,{children:i()}),(0,$.jsxs)(q,{value:_,onValueChange:e=>void g(e),children:[(0,$.jsx)(W,{size:`sm`,className:`min-w-44`,children:(0,$.jsx)(J,{})}),(0,$.jsxs)(Y,{children:[(0,$.jsx)(G,{value:`default`,children:k({locale:v})}),le().map(e=>(0,$.jsx)(G,{value:e.value,children:e.label},e.value))]})]}),(0,$.jsx)(`p`,{className:`oc-admin__hint`,children:E()})]}),oe.map(e=>(0,$.jsx)(he,{injKey:e,def:z[e],i18n:ue[e],row:p[e]??{enabled:!0,template:z[e].defaultTemplate[o]},contentLocale:o,onChange:t=>m(e,t)},e)),(0,$.jsx)(`div`,{className:`oc-injtab__actions`,children:(0,$.jsx)(U,{size:`sm`,onClick:()=>void h(),disabled:d,children:w()})})]})}function he({injKey:e,def:t,i18n:n,row:r,contentLocale:i,onChange:s}){let[c,l]=(0,Q.useState)(!1),u=r.template.trim()!==t.defaultTemplate[i],d=t.togglable&&!r.enabled,f=Object.fromEntries(t.placeholders.map(e=>[e,de[e]??`{${e}}`])),m=I(e,r,i),h=m?L(m,f):``;return(0,$.jsxs)(`section`,{className:`oc-injcard`,children:[(0,$.jsxs)(`div`,{className:`oc-injcard__head`,children:[t.togglable?(0,$.jsxs)(`label`,{className:`oc-field--row`,children:[(0,$.jsx)(ce,{checked:r.enabled,onCheckedChange:e=>s({enabled:e===!0})}),(0,$.jsx)(B,{label:n.label(),help:n.help()})]}):(0,$.jsx)(B,{label:n.label(),help:n.help()}),u&&(0,$.jsx)(`span`,{className:`oc-injection__badge`,children:ie()})]}),(0,$.jsx)(`textarea`,{className:`oc-injcard__text`,value:r.template,disabled:d,rows:8,spellCheck:!1,onChange:e=>s({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:o()}),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)(U,{variant:`ghost`,size:`sm`,onClick:()=>l(e=>!e),children:c?a():j()}),u&&(0,$.jsx)(U,{variant:`ghost`,size:`sm`,onClick:()=>s({template:t.defaultTemplate[i]}),children:p()})]})]}),c&&(0,$.jsx)(`div`,{className:`oc-injcard__preview`,children:h?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`pre`,{className:`oc-injcard__previewtext`,children:h}),(0,$.jsx)(`span`,{className:`oc-injection__ph`,children:M()})]}):(0,$.jsx)(`span`,{className:`oc-injection__ph`,children:x()})})]})}export{pe as PromptInjectionsTab};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$v as r,Ay as i,Cj as a,Cy as o,Dy as s,E as c,Er as l,Ey as u,Fy as d,Iy as f,Jv as p,My as m,Ny as h,Oy as g,Py as _,Qv as v,Sj as y,Sy as b,Ty as x,Xv as S,Yv as C,Zv as ee,_y as te,by as ne,cy as re,dy as ie,ey as w,fy as T,gy as E,hy as D,jy as O,ky as k,ly as A,my as j,py as M,qv as N,sy as P,ty as F,uy as I,vy as L,wy as R,xy as z,yy as ae}from"./dist-tr7LmvAR.js";import{t as B}from"./button-CtB6NRj2.js";import{H as V,Lt as H,V as U,ct as W,p as G,st as K,u as q}from"./index-D3n1_9Fa.js";import{t as J}from"./roleDescriptions-BzNYOzCY.js";var Y=t(e(),1),X=n(),Z=[{group:()=>f(),keys:[{key:`traces.read`,label:()=>O()},{key:`traces.read.content`,label:()=>i(),phi:!0},{key:`traces.write`,label:()=>k()}]},{group:()=>d(),keys:[{key:`kpi.read`,label:()=>O()},{key:`kpi.write`,label:()=>k()}]},{group:()=>_(),keys:[{key:`openclaw.query`,label:()=>g()},{key:`anomalies.read`,label:()=>s()},{key:`anomalies.report`,label:()=>u()}]},{group:()=>h(),keys:[{key:`chats.read`,label:()=>O()},{key:`selfheal`,label:()=>R()},{key:`feedback.respond`,label:()=>l()}]},{group:()=>m(),keys:[{key:`admin.manage`,label:()=>x()}]}],oe=Z.flatMap(e=>e.keys.map(e=>e.key));function Q(e){return e.includes(`*`)}var $={key:``,name:``,description:``};function se(){let e=a(c.apiKeys.listRoles,{}),t=y(c.apiKeys.createRole),n=y(c.apiKeys.ensureRolesSeeded),i=y(c.apiKeys.updateRolePermissions).withOptimisticUpdate((e,{roleId:t,permissions:n})=>{let r=e.getQuery(c.apiKeys.listRoles,{});r&&e.setQuery(c.apiKeys.listRoles,{},r.map(e=>e._id===t?{...e,permissions:n}:e))}),s=V(),l=U(),[u,d]=(0,Y.useState)(!1),[f,m]=(0,Y.useState)($),[h,g]=(0,Y.useState)(new Set);(0,Y.useEffect)(()=>{n({}).catch(e=>{l.error(b(),e)})},[n,l]);let _=e??[];async function x(e,t){if(Q(e.permissions)||h.has(e._id))return;let n=e.permissions.includes(t)?e.permissions.filter(e=>e!==t):[...e.permissions,t];if(!(e.builtin&&!await s({title:z({name:e.name}),description:ne(),confirmLabel:ae()}))){g(t=>new Set(t).add(e._id));try{await i({roleId:e._id,permissions:n})}catch(e){l.error(L(),e)}finally{g(t=>{let n=new Set(t);return n.delete(e._id),n})}}}async function O(){try{await t({key:f.key,name:f.name,description:f.description||void 0,permissions:[]}),m($),d(!1)}catch(e){l.error(te(),e)}}let k=e===void 0,R=!k&&_.length===0;return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`p`,{className:`oc-admin__hint`,children:[E(),` `,(0,X.jsx)(`code`,{children:`admin`}),` `,D(),` `,(0,X.jsx)(`code`,{children:`traces.read.content`}),` `,j()]}),(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:M()}),(0,X.jsx)(`div`,{className:`oc-dt__bar-actions`,children:(0,X.jsx)(B,{size:`sm`,onClick:()=>{m($),d(!0)},children:T()})})]}),k?(0,X.jsx)(`p`,{className:`oc-admin__hint`,children:ie()}):R?(0,X.jsx)(`p`,{className:`oc-admin__hint`,children:I()}):(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:A()}),Z.map(e=>(0,X.jsx)(`th`,{className:`oc-matrix__group`,colSpan:e.keys.length,children:e.group()},e.group()))]}),(0,X.jsx)(`tr`,{children:Z.flatMap(e=>e.keys.map(e=>(0,X.jsxs)(`th`,{className:`oc-matrix__perm`,title:e.phi?o({key:e.key}):e.key,children:[e.label(),e.phi?(0,X.jsx)(`span`,{className:`oc-matrix__phi`,children:` ⚠`}):null]},e.key)))})]}),(0,X.jsx)(`tbody`,{children:_.map(e=>{let t=Q(e.permissions),n=h.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)(K,{variant:`outline`,className:`gap-1`,children:[(0,X.jsx)(H,{}),` `,re()]}):(0,X.jsx)(K,{variant:`secondary`,children:P()})]}),J(e)?(0,X.jsx)(`p`,{className:`oc-matrix__roledesc`,children:J(e)}):null]}),oe.map(r=>(0,X.jsx)(`td`,{className:`oc-matrix__cell`,children:(0,X.jsx)(G,{checked:t||e.permissions.includes(r),disabled:t||n,"aria-label":`${e.key} · ${r}`,title:t?F():n?w():r,onCheckedChange:()=>void x(e,r)})},r))]},e.key)})})]})})]}),(0,X.jsx)(q,{open:u,onOpenChange:d,title:r(),description:v(),canSubmit:!!(f.key&&f.name),onSubmit:O,submitLabel:ee(),children:(0,X.jsxs)(`div`,{className:`oc-form`,children:[(0,X.jsxs)(`label`,{className:`oc-field`,children:[(0,X.jsx)(`span`,{className:`oc-field__label`,children:S()}),(0,X.jsx)(W,{value:f.key,placeholder:C(),onChange:e=>m({...f,key:e.target.value})})]}),(0,X.jsxs)(`label`,{className:`oc-field`,children:[(0,X.jsx)(`span`,{className:`oc-field__label`,children:p()}),(0,X.jsx)(W,{value:f.name,onChange:e=>m({...f,name:e.target.value})})]}),(0,X.jsxs)(`label`,{className:`oc-field`,children:[(0,X.jsx)(`span`,{className:`oc-field__label`,children:N()}),(0,X.jsx)(W,{value:f.description,onChange:e=>m({...f,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,$E as i,AD as a,BD as ee,CD as te,Cj as o,DD as ne,E as s,ED as re,FD as ie,GD as ae,GE as c,HD as oe,HE as l,ID as se,JD as ce,JE as u,KD as le,KE as d,LD as ue,MD as de,ND as fe,OD as pe,PD as me,QD as he,QE as ge,RD as _e,SD as ve,Sj as f,TD as ye,UD as be,UE as p,VD as xe,VE as m,WD as Se,WE as Ce,XD as we,XE as Te,YD as Ee,YE as h,ZD as De,ZE as g,_D as Oe,aD as _,aO as ke,bD as Ae,bj as je,cD as v,dD as Me,eD as y,eO as Ne,fD as Pe,gD as Fe,hD as Ie,iD as b,iO as Le,jD as Re,kD as ze,lD as x,mD as Be,nD as S,nO as C,oD as w,oO as Ve,pD as He,qD as Ue,qE as T,rD as E,rO as We,sD as D,sO as Ge,tD as O,tO as k,uD as A,vD as Ke,wD as qe,xD as Je,yD as Ye,zD as Xe}from"./dist-tr7LmvAR.js";import{n as j}from"./dist-9jdLReLO.js";import{i as Ze}from"./dist-DEMXTO86.js";import{t as M}from"./button-CtB6NRj2.js";import{A as N,C as P,H as Qe,Jt as $e,Kt as et,S as F,Ut as I,V as tt,b as L,ct as R,dt as z,ft as B,k as V,lt as H,mt as nt,pt as rt,qt as it,st as U,u as at,ut as W,w as G,x as K}from"./index-D3n1_9Fa.js";import{t as ot}from"./FilterBar-Bub5nUxA.js";import{t as st}from"./DataTableShell-CKQRa8xi.js";import{t as ct}from"./roleDescriptions-BzNYOzCY.js";var q=t(e(),1),J=n(),Y=[{value:`never`,label:()=>T(),days:null},{value:`30`,label:()=>d(),days:30},{value:`90`,label:()=>c(),days:90}],X=720*60*60*1e3,Z=`__all__`,Q={name:``,roleKey:``,description:``};function $(){let e=$e({from:`/settings/serviceAccounts`}),t=it({from:`/settings/serviceAccounts`}),n=e.q??``,i=e.status??Z,[c,l]=(0,q.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=o(s.apiKeys.listServiceAccounts,{filter:{q:n||void 0,role:c===Z?void 0:c,disabled:i===Z?void 0:i===`disabled`}}),p=o(s.apiKeys.listKeys,{}),m=o(s.apiKeys.listRoles,{}),Ce=f(s.apiKeys.createServiceAccount),Te=f(s.apiKeys.updateServiceAccount),h=f(s.apiKeys.deleteServiceAccount),g=je(s.apiKeys.mintApiKey),_=f(s.apiKeys.revokeApiKey),v=Qe(),y=tt(),b=n!==``||c!==Z||i!==Z;function x(){l(Z),t({search:{},replace:!0})}let[S,w]=(0,q.useState)(!1),[T,E]=(0,q.useState)(Q),[D,O]=(0,q.useState)(null),[A,j]=(0,q.useState)(new Set),[N,I]=(0,q.useState)(null),z=(0,q.useRef)(!1),[B,V]=(0,q.useState)(new Set),[H,nt]=(0,q.useState)({}),[rt,W]=(0,q.useState)(null),X=(0,q.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){j(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})}async function dt(){try{D?(await Te({serviceAccountId:D,name:T.name,roleKey:T.roleKey,description:T.description}),y.success(ye())):await Ce({name:T.name,roleKey:T.roleKey,description:T.description||void 0}),E(Q),O(null),w(!1)}catch(e){y.error(D?re():ne(),e)}}function ft(e){E({name:e.name,roleKey:e.roleKey,description:e.description??``}),O(e._id),w(!0)}async function pt(e){if(z.current)return;z.current=!0;let t=H[e._id]??`never`,n=Y.find(e=>e.value===t)?.days??null,r=n?Date.now()+n*24*60*60*1e3:void 0;I(e._id);try{let t=await g({serviceAccountId:e._id,expiresAt:r});W({accountName:e.name,plaintext:t.plaintext,prefix:t.prefix,lastFour:t.lastFour})}catch(e){y.error(qe(),e)}finally{z.current=!1,I(null)}}async function mt(e){if(await v({title:te(),description:(0,J.jsxs)(J.Fragment,{children:[ve(),` `,(0,J.jsx)(`span`,{className:`font-mono`,children:e.name}),` `,Je(),` `,(0,J.jsx)(`strong`,{children:Ae()}),` `,Ye()]}),confirmWord:e.name,confirmLabel:Ke(),destructive:!0}))try{await h({serviceAccountId:e._id}),y.success(Oe(),e.name)}catch(e){y.error(Fe(),e)}}async function ht(e){if(await v({title:Ie(),description:(0,J.jsxs)(J.Fragment,{children:[Be(),` `,(0,J.jsxs)(`span`,{className:`font-mono`,children:[e.prefix,`…`,e.lastFour]}),` `,He()]}),confirmLabel:Pe(),destructive:!0})&&!B.has(e._id)){V(t=>new Set(t).add(e._id));try{await _({keyId:e._id})}catch(e){y.error(Me(),e)}finally{V(t=>{let n=new Set(t);return n.delete(e._id),n})}}}return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(`p`,{className:`oc-admin__hint`,children:Ge()}),(0,J.jsxs)(ot,{q:n,onQChange:u,searchPlaceholder:Ve(),onReset:x,canReset:b,children:[(0,J.jsxs)(L,{value:c,onValueChange:l,children:[(0,J.jsx)(P,{size:`sm`,className:`w-40`,children:(0,J.jsx)(G,{placeholder:ke()})}),(0,J.jsxs)(K,{children:[(0,J.jsx)(F,{value:Z,children:Le()}),(m??[]).map(e=>(0,J.jsx)(F,{value:e.key,children:e.key},e._id))]})]}),(0,J.jsxs)(L,{value:i,onValueChange:d,children:[(0,J.jsx)(P,{size:`sm`,className:`w-36`,children:(0,J.jsx)(G,{})}),(0,J.jsxs)(K,{children:[(0,J.jsx)(F,{value:Z,children:We()}),(0,J.jsx)(F,{value:`active`,children:C()}),(0,J.jsx)(F,{value:`disabled`,children:k()})]})]})]}),(0,J.jsx)(st,{title:Ne(),rows:ge,addLabel:r(),onAdd:()=>{E(Q),O(null),w(!0)},emptyHint:he(),isExpanded:e=>A.has(e._id),renderExpanded:e=>(0,J.jsx)(lt,{account:e,keys:X.get(e._id)??[],onRevoke:ht,revoking:B}),rowActions:e=>[{label:ce(),onSelect:()=>ft(e)},{label:De(),onSelect:()=>void pt(e)},{label:A.has(e._id)?we():Ee(),onSelect:()=>$(e._id)},{label:Ue(),variant:`destructive`,onSelect:()=>void mt(e)}],columns:[{header:``,className:`w-8`,cell:e=>(0,J.jsx)(M,{variant:`ghost`,size:`icon-sm`,"aria-label":A.has(e._id)?le():ae(),onClick:()=>$(e._id),children:A.has(e._id)?(0,J.jsx)(Ze,{}):(0,J.jsx)(et,{})})},{header:Se(),sort:e=>e.name,cell:e=>(0,J.jsxs)(`div`,{className:`flex flex-col`,children:[(0,J.jsx)(`span`,{children:e.name}),e.description?(0,J.jsx)(`span`,{className:`text-muted-foreground text-xs`,children:e.description}):null]})},{header:be(),sort:e=>e.roleKey,cell:e=>(0,J.jsx)(U,{variant:`secondary`,children:e.roleKey})},{header:oe(),sort:e=>+!!e.disabled,cell:e=>e.disabled?(0,J.jsx)(U,{variant:`destructive`,children:k()}):(0,J.jsx)(U,{variant:`outline`,children:C()})},{header:xe(),cell:e=>(0,J.jsxs)(L,{value:H[e._id]??`never`,onValueChange:t=>nt(n=>({...n,[e._id]:t})),children:[(0,J.jsx)(P,{size:`sm`,className:`w-32`,children:(0,J.jsx)(G,{})}),(0,J.jsx)(K,{children:Y.map(e=>(0,J.jsx)(F,{value:e.value,children:e.label()},e.value))})]})},{header:ee(),sort:e=>(X.get(e._id)??[]).filter(e=>!e.disabled).length,cell:e=>{let t=(X.get(e._id)??[]).filter(e=>!e.disabled).length;return(0,J.jsx)(`span`,{className:`oc-sa__keycount`,children:N===e._id?Xe():_e({count:t})})}}]}),(0,J.jsx)(at,{open:S,onOpenChange:e=>{w(e),e||O(null)},title:D?ue():me(),description:D?se():fe(),canSubmit:!!(T.name&&T.roleKey),onSubmit:dt,submitLabel:D?ie():de(),children:(0,J.jsxs)(`div`,{className:`oc-form`,children:[(0,J.jsxs)(`label`,{className:`oc-field`,children:[(0,J.jsx)(`span`,{className:`oc-field__label`,children:Re()}),(0,J.jsx)(R,{value:T.name,onChange:e=>E({...T,name:e.target.value})})]}),(0,J.jsxs)(`label`,{className:`oc-field`,children:[(0,J.jsx)(`span`,{className:`oc-field__label`,children:a()}),(0,J.jsxs)(L,{value:T.roleKey||void 0,onValueChange:e=>E({...T,roleKey:e}),children:[(0,J.jsx)(P,{className:`w-full`,children:(0,J.jsx)(G,{placeholder:ze()})}),(0,J.jsx)(K,{children:(m??[]).map(e=>(0,J.jsxs)(F,{value:e.key,children:[e.name,` (`,e.key,`)`]},e._id))})]}),(()=>{let e=(m??[]).find(e=>e.key===T.roleKey),t=e?ct(e):null;return t?(0,J.jsx)(`span`,{className:`text-muted-foreground text-xs`,children:t}):null})()]}),(0,J.jsxs)(`label`,{className:`oc-field`,children:[(0,J.jsx)(`span`,{className:`oc-field__label`,children:pe()}),(0,J.jsx)(R,{value:T.description,onChange:e=>E({...T,description:e.target.value})})]})]})}),(0,J.jsx)(ut,{minted:rt,onClose:()=>W(null)})]})}function lt({account:e,keys:t,onRevoke:n,revoking:r}){return(0,J.jsxs)(`div`,{className:`oc-sa__keys`,children:[(0,J.jsxs)(`div`,{className:`oc-sa__keys-head`,children:[A(),` `,(0,J.jsx)(`span`,{className:`font-medium`,children:e.name})]}),t.length===0?(0,J.jsx)(`p`,{className:`oc-admin__hint`,children:x()}):(0,J.jsxs)(`table`,{className:`oc-sa__keytable`,children:[(0,J.jsx)(`thead`,{children:(0,J.jsxs)(`tr`,{children:[(0,J.jsx)(`th`,{children:v()}),(0,J.jsx)(`th`,{children:D()}),(0,J.jsx)(`th`,{children:w()}),(0,J.jsx)(`th`,{children:_()}),(0,J.jsx)(`th`,{children:b()}),(0,J.jsx)(`th`,{children:E()}),(0,J.jsx)(`th`,{})]})}),(0,J.jsx)(`tbody`,{children:t.map(t=>(0,J.jsxs)(`tr`,{children:[(0,J.jsx)(`td`,{children:(0,J.jsxs)(`code`,{className:`oc-sa__keyid`,children:[t.prefix,`…`,t.lastFour]})}),(0,J.jsx)(`td`,{children:(0,J.jsx)(U,{variant:`secondary`,children:e.roleKey})}),(0,J.jsx)(`td`,{children:N(t.createdAt)}),(0,J.jsx)(`td`,{className:dt(t.lastUsedAt)?`oc-sa__stale`:``,children:ft(t.lastUsedAt)}),(0,J.jsx)(`td`,{children:pt(t.expiresAt)}),(0,J.jsx)(`td`,{children:mt(t)}),(0,J.jsx)(`td`,{className:`text-right`,children:t.disabled?null:(0,J.jsx)(M,{variant:`destructive`,size:`sm`,disabled:r.has(t._id),onClick:()=>n(t),children:r.has(t._id)?S():O()})})]},t._id))})]})]})}function ut({minted:e,onClose:t}){let[n,r]=(0,q.useState)(!1);async function a(){if(e)try{await navigator.clipboard.writeText(e.plaintext),r(!0),window.setTimeout(()=>r(!1),2e3)}catch{}}return(0,J.jsx)(H,{open:e!==null,onOpenChange:e=>{e||(r(!1),t())},children:e?(0,J.jsxs)(W,{className:`max-w-lg`,showCloseButton:!1,onInteractOutside:e=>e.preventDefault(),onEscapeKeyDown:e=>e.preventDefault(),children:[(0,J.jsxs)(rt,{children:[(0,J.jsx)(nt,{children:y()}),(0,J.jsx)(z,{children:i({name:e.accountName})})]}),(0,J.jsx)(`div`,{className:`oc-sa__minted-warning`,children:ge()}),(0,J.jsxs)(`div`,{className:`oc-sa__minted-box`,children:[(0,J.jsx)(`code`,{className:`oc-sa__minted-plain`,children:e.plaintext}),(0,J.jsxs)(M,{variant:`outline`,size:`sm`,onClick:()=>void a(),"aria-label":g(),children:[n?(0,J.jsx)(j,{}):(0,J.jsx)(I,{}),n?Te():h()]})]}),(0,J.jsx)(B,{children:(0,J.jsx)(M,{onClick:()=>{r(!1),t()},children:u()})})]}):null})}function dt(e){return e===null?!1:Date.now()-e>X}function ft(e){return e===null?Ce():N(e)}function pt(e){return e===null?`—`:V(e)}function mt(e){return e.disabled?(0,J.jsx)(U,{variant:`destructive`,children:p()}):e.expiresAt!==null&&e.expiresAt<Date.now()?(0,J.jsx)(U,{variant:`outline`,children:l()}):(0,J.jsx)(U,{variant:`outline`,children:m()})}export{$ as ServiceAccountsTab};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$i as r,Ca as i,Cj as a,E as o,Ea as s,Gi as c,Hi as l,Ji as u,Ki as d,Qi as f,Sa as p,Sj as m,Ta as h,Ui as g,Wi as _,Xi as v,Yi as y,Zi as b,_a as x,aa as S,ba as C,ca as w,da as T,ea as E,fa as D,ga as O,ha as k,ia as A,la as j,ma as M,na as N,oa as P,pa as F,qi as I,ra as L,sa as R,ta as ee,ua as z,va as B,wa as V,xa as H,ya as U}from"./dist-tr7LmvAR.js";import{t as W}from"./button-CtB6NRj2.js";import{A as G,H as K}from"./index-D3n1_9Fa.js";import{t as q}from"./DataTableShell-CKQRa8xi.js";var J=t(e(),1),Y=n(),X={hung:()=>j(),wrong_result:()=>w(),error:()=>R(),other:()=>P()},Z=e=>(e&&X[e]?.())??e??`—`;function Q(e){let t=e.slice(e.lastIndexOf(`:`)+1)||e;return t.length>12?`${t.slice(0,12)}…`:t}function $({data:e}){let t=e.snapshot,n=m(o.subAgentReports.respondToReport),[i,a]=(0,J.useState)(e.thread),[s,l]=(0,J.useState)(``),[p,h]=(0,J.useState)(!1);async function g(){let t=s.trim();if(!(!t||p)){h(!0);try{await n({reportId:e._id,text:t}),a(e=>[...e,{authorRole:`admin`,text:t,at:Date.now()}]),l(``)}finally{h(!1)}}}return(0,Y.jsxs)(`div`,{className:`oc-fbadmin__detail`,children:[(0,Y.jsx)(`div`,{className:`oc-fbadmin__row`,children:(0,Y.jsxs)(`span`,{className:`oc-fbadmin__meta`,children:[Z(e.category),` · `,S({failed:t.failedCount,total:t.totalCount}),t.openclawModel?` · ${t.openclawModel}`:``,t.openclawRuntime?` (${t.openclawRuntime})`:``]})}),e.comment?(0,Y.jsxs)(`section`,{children:[(0,Y.jsx)(`h4`,{className:`oc-fbadmin__h`,children:A()}),(0,Y.jsx)(`p`,{className:`oc-fbadmin__comment`,children:e.comment})]}):null,(0,Y.jsxs)(`section`,{children:[(0,Y.jsx)(`h4`,{className:`oc-fbadmin__h`,children:L()}),i.length>0?(0,Y.jsx)(`div`,{className:`oc-fbadmin__thread`,children:i.map((e,t)=>(0,Y.jsxs)(`div`,{className:`oc-notif__msg oc-notif__msg--${e.authorRole}`,children:[(0,Y.jsx)(`span`,{className:`oc-notif__msg-who`,children:e.authorRole===`admin`?N():ee()}),(0,Y.jsx)(`span`,{className:`oc-notif__msg-text`,children:e.text})]},t))}):(0,Y.jsx)(`p`,{className:`oc-fbadmin__meta`,children:E()}),(0,Y.jsx)(`textarea`,{className:`oc-feedback__textarea`,placeholder:r(),value:s,maxLength:2e3,rows:3,onChange:e=>l(e.target.value.slice(0,2e3))}),(0,Y.jsx)(`div`,{className:`oc-fbadmin__row`,style:{justifyContent:`flex-end`},children:(0,Y.jsx)(W,{size:`sm`,onClick:()=>void g(),disabled:!s.trim()||p,children:p?b():f()})})]}),(0,Y.jsxs)(`section`,{children:[(0,Y.jsxs)(`h4`,{className:`oc-fbadmin__h`,children:[v({count:t.children.length}),t.childrenTruncated?` ${y()}`:``,t.textTruncated?` ${u()}`:``]}),(0,Y.jsx)(`div`,{className:`oc-fbadmin__ctx`,children:t.children.map((e,n)=>(0,Y.jsxs)(`div`,{className:`oc-fbadmin__ctx-turn`,children:[(0,Y.jsxs)(`span`,{className:`oc-fbadmin__ctx-role`,children:[(e.taskName?.trim()||Q(e.childSessionKey))+` · ${e.status}`,e.phase?` · ${e.phase}`:``,e.childSessionKey===t.flaggedChildSessionKey?` · ${I()}`:``]}),e.errorMessage?(0,Y.jsx)(`pre`,{className:`oc-msg__source-pre`,children:e.errorMessage}):null,e.resultText?(0,Y.jsx)(`pre`,{className:`oc-msg__source-pre`,children:e.resultText}):null]},n))})]}),t.parentText?(0,Y.jsxs)(`section`,{children:[(0,Y.jsx)(`h4`,{className:`oc-fbadmin__h`,children:d()}),(0,Y.jsx)(`pre`,{className:`oc-msg__source-pre`,children:t.parentText})]}):null,(0,Y.jsxs)(`section`,{children:[(0,Y.jsx)(`h4`,{className:`oc-fbadmin__h`,children:c()}),(0,Y.jsx)(`p`,{className:`oc-fbadmin__env`,children:[t.parentStatus?`status: ${t.parentStatus}`:null,t.parentErrorCode?`code: ${t.parentErrorCode}`:null,t.parentRunId?`run ${t.parentRunId.slice(0,12)}…`:null,e.correlationId?`corr ${e.correlationId.slice(0,16)}…`:null,t.openclawProvider].filter(Boolean).join(` · `)||`—`})]})]})}function te(){let e=a(o.subAgentReports.listForAdmin,{}),t=m(o.subAgentReports.readReport),n=m(o.subAgentReports.deleteReport),r=K(),[c,u]=(0,J.useState)(null),[d,f]=(0,J.useState)({});async function v(e){if(c===e._id){u(null);return}if(!d[e._id]){let n=await t({reportId:e._id});f(t=>({...t,[e._id]:n}))}u(e._id)}async function y(e){await r({title:_(),description:g(),confirmLabel:l(),destructive:!0})&&(await n({reportId:e._id}),c===e._id&&u(null))}return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(`p`,{className:`oc-admin__hint`,children:[V(),` `,(0,Y.jsx)(`strong`,{children:i()}),` `,p()]}),(0,Y.jsx)(q,{title:s(),rows:e,emptyHint:h(),isExpanded:e=>c===e._id&&!!d[e._id],renderExpanded:e=>d[e._id]?(0,Y.jsx)($,{data:d[e._id]}):null,columns:[{header:H(),cell:e=>G(e.at),sort:e=>e.at},{header:C(),cell:e=>Z(e.category),sort:e=>Z(e.category)},{header:U(),cell:e=>`${e.failedCount}/${e.totalCount}`,sort:e=>e.failedCount},{header:B(),cell:e=>(e.reporterEmail||e.reporterName||`—`)+(e.impersonated&&e.realOperatorEmail?` ${k({operator:e.realOperatorEmail})}`:``),sort:e=>e.reporterEmail||e.reporterName||null},{header:x(),cell:e=>e.hasComment?`✎`:`—`,sort:e=>+!!e.hasComment},{header:O(),cell:e=>e.answered?(0,Y.jsx)(`span`,{className:`oc-fbadmin__pill is-ok`,children:M()}):(0,Y.jsx)(`span`,{className:`oc-fbadmin__pill`,children:F()}),sort:e=>+!!e.answered}],rowActions:e=>[{label:c===e._id?T():D(),onSelect:()=>void v(e)},{label:z(),onSelect:()=>void y(e),variant:`destructive`}]})]})}export{te as SubAgentReportsTab};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$O as r,$k as i,Ak as a,Bi as o,Bk as s,Cj as c,Ck as l,D as u,Dk as d,E as f,Ek as p,Fk as m,GO as h,Gk as g,Hk as _,Ik as v,JO as y,Jk as b,KO as ee,Kk as te,Lk as ne,Mk as re,Nk as ie,Ok as x,Pk as ae,QO as oe,Qk as se,Ri as ce,Rk as le,Sj as S,Sk as ue,Tk as de,UO as fe,Uk as pe,Vi as C,Vk as me,WO as he,Wk as ge,XO as _e,Xk as ve,YO as ye,Yk as be,ZO as w,Zk as xe,_k as Se,aA as Ce,ak as we,bj as Te,bk as Ee,cA as De,ck as Oe,dA as ke,dj as Ae,dk as je,eA as Me,ek as Ne,fj as Pe,fk as Fe,gk as Ie,hk as Le,iA as Re,ik as ze,jk as Be,kk as Ve,lA as He,lk as T,mk as Ue,n as We,nA as Ge,nk as Ke,oA as qe,ok as Je,pk as Ye,qO as Xe,qk as Ze,rA as Qe,rk as $e,sA as et,sk as tt,tA as E,tk as nt,uA as rt,uj as it,uk as at,vk as ot,wk as st,xk as ct,yk as lt,zi as ut,zk as dt}from"./dist-tr7LmvAR.js";import{n as D}from"./dist-9jdLReLO.js";import{t as O}from"./x-BsTPtFiQ.js";import{t as k}from"./button-CtB6NRj2.js";import{C as A,Ht as ft,S as j,Vt as M,at as N,b as P,bt as F,ct as I,gt as pt,ht as mt,it as ht,nt as gt,ot as _t,p as L,rt as R,st as z,tt as vt,w as B,x as V}from"./index-D3n1_9Fa.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-CsumpaGg.js";import{a as Et,i as H,n as Dt,o as U,r as W,t as Ot}from"./table-CFZX8hqf.js";import{t as kt}from"./TimeRangePicker-CbbfR2tN.js";import{t as At}from"./FilterBar-Bub5nUxA.js";import{t as jt}from"./AdvancedFilter-BtBFrOvl.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(Fe());if(e.size>zt)throw Error(je());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(T());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},f=document.createElement(`canvas`);f.width=d.width,f.height=d.height;let p=f.getContext(`2d`);if(!p)throw Error(T());if(p.drawImage(l,d.x,d.y,d.width,d.height,0,0,d.width,d.height),t.variantFor){let e=p.getImageData(0,0,d.width,d.height);q(e.data,d.width,d.height)?Lt(e.data,t.variantFor===`dark`?Nt:Pt):Rt(e.data),p.putImageData(e,0,0)}let m=q(p.getImageData(0,0,d.width,d.height).data,d.width,d.height),h=await Y(f,`image/webp`,Ht)??await Y(f,`image/png`);if(!h)throw Error(Oe());return{blob:h,hasAlpha:m}}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(at())),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`?Pe():e===`dark`?Ae():it()}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)(D,{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)(k,{type:`button`,variant:`ghost`,size:`icon`,className:`oc-chart-card__export`,onClick:o,"aria-label":C(),title:C(),children:(0,X.jsx)(ft,{className:`size-4`})}):null]})}function Zt({selectedKey:e,resolvedMode:t}){let n=c(f.charts.listMyCharts),r=S(f.charts.setMyChart);async function a(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:Qe()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:Ge()})]}),(0,X.jsxs)(`div`,{className:`oc-chart-grid`,children:[(0,X.jsx)(Xt,{selected:e===null,title:E(),subtitle:Me(),tokens:null,mode:t,onSelect:()=>void a(null)}),(n??[]).map(n=>{let r=n.via===`common`?i():n.via===`owner`?se():xe({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 a(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:ve()}):null]})}function Qt(){let e=S(f.charts.importChart),[t,n]=(0,K.useState)(``),[r,i]=(0,K.useState)(``),[o,s]=(0,K.useState)(null),[c,l]=(0,K.useState)(!1),[u,h]=(0,K.useState)(!1);async function g(e){let t=e.target.files?.[0];if(e.target.value=``,t){s(null),l(!1);try{i(await t.text())}catch{s(x())}}}async function _(){if(s(null),l(!1),t.trim()===``){s(p());return}let a;try{a=JSON.parse(r)}catch{s(x());return}h(!0);try{await e({name:t.trim(),tokens:a}),l(!0),n(``),i(``)}catch(e){s(e instanceof Error?e.message:String(e))}finally{h(!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:v()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:m()})]}),(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:ae()}),(0,X.jsx)(I,{value:t,onChange:e=>n(e.target.value),placeholder:ie(),maxLength:60})]}),(0,X.jsxs)(`label`,{className:`oc-chart-import__field`,children:[(0,X.jsx)(`span`,{className:`oc-chart-import__label`,children:re()}),(0,X.jsx)(`textarea`,{className:`oc-chart-import__textarea`,value:r,onChange:e=>i(e.target.value),placeholder:Be(),rows:8,spellCheck:!1})]}),(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsx)(k,{variant:`outline`,size:`sm`,asChild:!0,children:(0,X.jsxs)(`label`,{className:`oc-chart-import__file`,children:[(0,X.jsx)(G,{className:`size-4`}),a(),(0,X.jsx)(`input`,{type:`file`,accept:`application/json,.json`,className:`oc-chart-import__file-input`,onChange:e=>void g(e)})]})}),(0,X.jsx)(k,{size:`sm`,disabled:u,onClick:()=>void _(),children:Ve()})]}),o?(0,X.jsx)(`p`,{className:`oc-chart-import__error`,children:o}):null,c?(0,X.jsx)(`p`,{className:`oc-chart-import__ok`,children:d()}):null]})]})}function $t({chart:e}){let t=Te(f.charts.setChartLogo),n=S(f.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 p({mode:e}){let t=s(e),n=s(e===`light`?`dark`:`light`);return(0,X.jsxs)(`div`,{className:`oc-chart-mine__logo-slot`,children:[(0,X.jsx)(`span`,{className:`oc-chart-mine__logo-mode`,children:e===`light`?lt():ot()}),(0,X.jsx)(`span`,{className:`oc-chart-mine__logo-preview`,"data-mode":e,"data-empty":t?void 0:`1`,children:t?(0,X.jsx)(`img`,{src:t,alt:``}):null}),(0,X.jsx)(k,{variant:`outline`,size:`sm`,asChild:!0,children:(0,X.jsxs)(`label`,{className:`oc-chart-import__file`,children:[(0,X.jsx)(G,{className:`size-4`}),t?Ie():Se(),(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)(k,{variant:`ghost`,size:`sm`,disabled:r,onClick:()=>void d(e),children:Ue()}):null,t?(0,X.jsx)(k,{variant:`ghost`,size:`sm`,disabled:r,onClick:()=>void u(e),children:Le()}):null]})}return(0,X.jsxs)(`div`,{className:`oc-chart-mine__logo`,children:[(0,X.jsx)(`span`,{className:`oc-chart-mine__groups-label`,children:Ee()}),(0,X.jsxs)(`div`,{className:`oc-chart-mine__logo-slots`,children:[(0,X.jsx)(p,{mode:`light`}),(0,X.jsx)(p,{mode:`dark`})]}),r?(0,X.jsx)(`span`,{className:`oc-show__desc`,children:Ye()}):null,a?(0,X.jsx)(`p`,{className:`oc-chart-import__error`,children:a}):null]})}function en({chart:e}){let t=c(f.me.getMe,{host:F}),n=S(f.charts.addChartDomain),r=S(f.charts.removeChartDomain),[i,a]=(0,K.useState)(``),[o,s]=(0,K.useState)(null),[l,u]=(0,K.useState)(!1);if(t?.role!==`admin`)return null;let d=e.domains??[];async function p(){let t=i.trim();if(t!==``){s(null),u(!0);try{await n({chartKey:e.key,domain:t}),a(``)}catch(e){s(e instanceof Error?e.message:String(e))}finally{u(!1)}}}async function m(t){s(null);try{await r({chartKey:e.key,domain:t})}catch{}}return(0,X.jsxs)(`div`,{className:`oc-chart-mine__domains`,children:[(0,X.jsx)(`span`,{className:`oc-chart-mine__groups-label`,children:tt()}),(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:$e()}):d.map(e=>(0,X.jsxs)(z,{variant:`secondary`,className:`oc-chart-avail__chip`,children:[e,(0,X.jsx)(`button`,{type:`button`,className:`oc-chart-avail__chip-x`,"aria-label":Ke({domain:e}),onClick:()=>void m(e),children:(0,X.jsx)(O,{className:`size-3`})})]},e))}),(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsx)(I,{value:i,onChange:e=>a(e.target.value),placeholder:we(),className:`oc-chart-mine__domains-input`,onKeyDown:e=>{e.key===`Enter`&&p()}}),(0,X.jsx)(k,{variant:`outline`,size:`sm`,disabled:l,onClick:()=>void p(),children:ze()})]}),(0,X.jsx)(`span`,{className:`oc-show__desc`,children:Je()}),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=S(f.charts.updateChart),n=S(f.charts.deleteChart),[i,a]=(0,K.useState)(!1),[s,c]=(0,K.useState)(e.name),[l,u]=(0,K.useState)(()=>tn(e.tokens)),[d,p]=(0,K.useState)(e.tokens.bpm??0),[m,h]=(0,K.useState)(null),[g,_]=(0,K.useState)(!1);function v(){c(e.name),u(tn(e.tokens)),p(e.tokens.bpm??0),h(null),a(!0)}async function y(){if(e.chartId===void 0)return;h(null);let n;try{n=JSON.parse(l)}catch{h(x());return}if(n&&typeof n==`object`&&!Array.isArray(n)){let e=n;d>0?e.bpm=d:delete e.bpm}_(!0);try{await t({chartId:e.chartId,name:s.trim(),tokens:n}),a(!1)}catch(e){h(e instanceof Error?e.message:String(e))}finally{_(!1)}}async function b(){if(e.chartId!==void 0&&window.confirm(w()))try{await n({chartId:e.chartId})}catch{}}return(0,X.jsxs)(`div`,{className:`oc-chart-mine__row`,children:[(0,X.jsxs)(`div`,{className:`oc-chart-mine__head`,children:[(0,X.jsx)(`span`,{className:`oc-chart-mine__name`,children:e.name}),(0,X.jsx)(`div`,{className:`oc-show__row`,children:i?null:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(k,{variant:`outline`,size:`sm`,onClick:v,children:ue()}),(0,X.jsx)(k,{variant:`ghost`,size:`sm`,onClick:()=>void b(),children:ct()})]})})]}),i?(0,X.jsxs)(`div`,{className:`oc-chart-mine__editor`,children:[(0,X.jsxs)(`label`,{className:`oc-chart-import__field`,children:[(0,X.jsx)(`span`,{className:`oc-chart-import__label`,children:r()}),(0,X.jsx)(I,{value:s,onChange:e=>c(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:o()}),(0,X.jsxs)(`div`,{className:`oc-chart-bpm`,children:[(0,X.jsx)(`input`,{type:`range`,className:`oc-chart-bpm__slider`,min:0,max:90,step:5,value:d,onChange:e=>p(Number(e.target.value)),"aria-label":o()}),(0,X.jsx)(`span`,{className:`oc-chart-bpm__value`,children:d===0?ut():`${d} BPM`})]}),(0,X.jsx)(`span`,{className:`oc-show__desc`,children:ce()})]}),(0,X.jsxs)(`label`,{className:`oc-chart-import__field`,children:[(0,X.jsx)(`span`,{className:`oc-chart-import__label`,children:oe()}),(0,X.jsx)(`textarea`,{className:`oc-chart-import__textarea`,value:l,onChange:e=>u(e.target.value),rows:10,spellCheck:!1})]}),m?(0,X.jsx)(`p`,{className:`oc-chart-import__error`,children:m}):null,(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsx)(k,{size:`sm`,disabled:g,onClick:()=>void y(),children:nt()}),(0,X.jsx)(k,{variant:`ghost`,size:`sm`,onClick:()=>a(!1),children:Ne()})]})]}):null,(0,X.jsx)($t,{chart:e}),(0,X.jsx)(en,{chart:e})]})}function rn(){let e=c(f.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:de()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:st()})]}),e!==void 0&&t.length===0?(0,X.jsx)(`p`,{className:`oc-show__desc`,children:l()}):(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=S(f.charts.addChartToGroupPool),r=S(f.charts.removeChartFromGroupPool),i=e.restrictedToGroups,a=e.poolGroups,o=new Set((a??[]).map(e=>e.groupId)),c=t.filter(e=>!o.has(e._id));async function l(t){try{await n({groupId:t,chartKey:e.key})}catch{}}async function u(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)(z,{variant:i?`secondary`:`outline`,className:`oc-chart-avail__state`,children:i?_():e.kind===`custom`&&e.scope===`personal`?Xe():pe()}),e.isGlobalDefault?(0,X.jsx)(z,{variant:`default`,children:me()}):null]}),(0,X.jsxs)(`div`,{className:`oc-chart-avail__groups`,children:[(0,X.jsx)(`span`,{className:`oc-chart-mine__groups-label`,children:dt()}),(a??[]).map(e=>(0,X.jsxs)(z,{variant:`secondary`,className:`oc-chart-avail__chip`,children:[e.name,(0,X.jsx)(`button`,{type:`button`,className:`oc-chart-avail__chip-x`,"aria-label":ne({group:e.name}),onClick:()=>void u(e.groupId),children:(0,X.jsx)(O,{className:`size-3`})})]},e.groupId)),c.length>0?(0,X.jsxs)(P,{value:``,onValueChange:e=>void l(e),children:[(0,X.jsx)(A,{size:`sm`,className:`w-56`,children:(0,X.jsx)(B,{placeholder:le()})}),(0,X.jsx)(V,{children:c.map(e=>(0,X.jsx)(j,{value:e._id,children:e.name},e._id))})]}):t.length===0?(0,X.jsx)(`span`,{className:`oc-show__desc`,children:s()}):null]})]})}function on({chart:e}){let t=S(f.charts.promoteChartToCommon),n=S(f.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(w()))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)(z,{variant:e.scope===`common`?`outline`:`secondary`,children:e.scope===`common`?ee():Xe()}),e.ownerLabel?(0,X.jsx)(`span`,{className:`oc-show__desc`,children:y({owner:e.ownerLabel})}):null]}),(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[e.scope===`personal`?(0,X.jsx)(k,{variant:`outline`,size:`sm`,onClick:()=>void r(),children:h()}):null,(0,X.jsx)(k,{variant:`ghost`,size:`sm`,onClick:()=>void i(),children:he()})]})]})}function sn({defaultThemeMode:e,defaultLocale:t,defaultChartKey:n}){let r=S(f.admin.setDefaultThemeMode),i=S(f.admin.setDefaultLocale),a=S(f.charts.setDefaultChart),o=c(f.charts.listChartsAdmin),s=c(f.groups.listGroups,{}),l=e??`system`,u=t??`fr`;return(0,X.jsxs)(`div`,{className:`oc-appearance-admin`,children:[(0,X.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,X.jsx)(`h2`,{className:`oc-show__title`,children:Ce()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:Re()})]}),(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:be()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:b()})]}),(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsx)(k,{variant:n===null?`default`:`outline`,size:`sm`,onClick:()=>void a({name:null}),children:E()}),pt.map(e=>(0,X.jsx)(k,{variant:n===e.key?`default`:`outline`,size:`sm`,onClick:()=>void a({name:e.key}),children:e.name},e.key)),(o??[]).filter(e=>e.kind===`custom`&&e.scope===`common`).map(e=>(0,X.jsx)(k,{variant:n===e.key?`default`:`outline`,size:`sm`,onClick:()=>void a({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:Ze()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:te()})]}),(0,X.jsx)(`div`,{className:`oc-chart-avail-list`,children:(o??[]).filter(e=>!(e.kind===`custom`&&e.scope===`common`)).map(e=>(0,X.jsx)(an,{chart:e,groups:s??[]},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:g()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:ge()})]}),(0,X.jsx)(`div`,{className:`oc-chart-avail-list`,children:(o??[]).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:_e()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:ye()})]}),(()=>{let e=(o??[]).filter(e=>e.kind===`custom`);return e.length===0?(0,X.jsx)(`p`,{className:`oc-show__desc`,children:fe()}):(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:ke()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:rt()})]}),(0,X.jsx)(`div`,{className:`oc-show__row`,children:[`light`,`dark`,`system`].map(e=>(0,X.jsx)(k,{variant:l===e?`default`:`outline`,size:`sm`,onClick:()=>void r({mode:e}),children: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:He()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:De()})]}),(0,X.jsx)(`div`,{className:`oc-show__row`,children:yt().map(e=>(0,X.jsx)(k,{variant:u===e.value?`default`:`outline`,size:`sm`,onClick:()=>void i({locale:e.value}),children:e.label},e.value))}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:et()})]})]})}function cn(){let e=c(f.me.getMe,{host:F}),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:qe()}),(0,X.jsxs)($,{title:`Buttons`,description:`Variants`,children:[(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsx)(k,{children:`Default`}),(0,X.jsx)(k,{variant:`secondary`,children:`Secondary`}),(0,X.jsx)(k,{variant:`outline`,children:`Outline`}),(0,X.jsx)(k,{variant:`ghost`,children:`Ghost`}),(0,X.jsx)(k,{variant:`destructive`,children:`Destructive`}),(0,X.jsx)(k,{variant:`link`,children:`Link`})]}),(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsx)(k,{size:`sm`,children:`Small`}),(0,X.jsx)(k,{children:`Default`}),(0,X.jsx)(k,{size:`lg`,children:`Large`}),(0,X.jsx)(k,{size:`icon`,"aria-label":`more`,children:(0,X.jsx)(M,{})}),(0,X.jsx)(k,{disabled:!0,children:`Disabled`})]})]}),(0,X.jsx)($,{title:`Badges`,children:(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsx)(z,{children:`Default`}),(0,X.jsx)(z,{variant:`secondary`,children:`Secondary`}),(0,X.jsx)(z,{variant:`outline`,children:`Outline`}),(0,X.jsx)(z,{variant:`destructive`,children:`Destructive`})]})}),(0,X.jsx)($,{title:`Inputs & selection`,children:(0,X.jsxs)(`div`,{className:`oc-show__row oc-show__row--col`,children:[(0,X.jsx)(I,{placeholder:`Text input…`}),(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsxs)(P,{value:n,onValueChange:r,children:[(0,X.jsx)(A,{className:`w-56`,children:(0,X.jsx)(B,{placeholder:`Select…`})}),(0,X.jsxs)(V,{children:[(0,X.jsx)(j,{value:`per-user`,children:`per-user (chacun son agent)`}),(0,X.jsx)(j,{value:`shared`,children:`shared (agent commun)`})]})]}),(0,X.jsxs)(`label`,{className:`oc-show__check`,children:[(0,X.jsx)(L,{checked:e,onCheckedChange:e=>t(!!e)}),`Checkbox`]})]})]})}),(0,X.jsx)($,{title:`Filtres & plage temporelle`,description:`Barre réutilisable (recherche debouncée + selects rapides à largeur auto + plage façon Grafana) et constructeur de filtre avancé. Câblée dans Users, Groups, Comptes de service, Traces, Anomalies, Audit et KPI.`,children:(0,X.jsxs)(`div`,{className:`oc-show__row oc-show__row--col`,children:[(0,X.jsxs)(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)(A,{size:`sm`,children:(0,X.jsx)(B,{})}),(0,X.jsxs)(V,{children:[(0,X.jsx)(j,{value:Z,children:`Toutes directions`}),(0,X.jsx)(j,{value:`inbound`,children:`inbound`}),(0,X.jsx)(j,{value:`outbound`,children:`outbound`}),(0,X.jsx)(j,{value:`internal`,children:`internal`})]})]}),(0,X.jsxs)(P,{value:c,onValueChange:l,children:[(0,X.jsx)(A,{size:`sm`,children:(0,X.jsx)(B,{})}),(0,X.jsxs)(V,{children:[(0,X.jsx)(j,{value:Z,children:`Toutes sévérités`}),(0,X.jsx)(j,{value:`info`,children:`info`}),(0,X.jsx)(j,{value:`warn`,children:`warn`}),(0,X.jsx)(j,{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)(vt,{children:[(0,X.jsx)(_t,{asChild:!0,children:(0,X.jsx)(k,{variant:`outline`,size:`icon`,"aria-label":`Open menu`,children:(0,X.jsx)(M,{})})}),(0,X.jsxs)(gt,{align:`start`,children:[(0,X.jsx)(ht,{children:`Actions`}),(0,X.jsx)(N,{}),(0,X.jsx)(R,{children:`Edit`}),(0,X.jsx)(R,{children:`Duplicate`}),(0,X.jsx)(N,{}),(0,X.jsx)(R,{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)(k,{size:`sm`,children:`Save`}),(0,X.jsx)(k,{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)(L,{"aria-label":`select all`})}),(0,X.jsx)(H,{children:`Name`}),(0,X.jsx)(H,{children:`Mode`}),(0,X.jsx)(H,{className:`text-right`,children:`Status`}),(0,X.jsx)(H,{className:`w-8`})]})}),(0,X.jsx)(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)(L,{"aria-label":`select ${e.n}`})}),(0,X.jsx)(W,{className:`font-medium`,children:e.n}),(0,X.jsx)(W,{children:(0,X.jsx)(z,{variant:`secondary`,children:e.m})}),(0,X.jsx)(W,{className:`text-right`,children:(0,X.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-muted-foreground`,children:[(0,X.jsx)(D,{className:`size-3.5`}),` `,e.s]})}),(0,X.jsx)(W,{children:(0,X.jsx)(k,{variant:`ghost`,size:`icon`,"aria-label":`row actions`,children:(0,X.jsx)(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};
|