@lacneu/atrium 0.21.0 → 0.22.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-BpmHOH2b.js → AccessTab-CJcKd-bd.js} +1 -1
- package/dist/assets/{AdvancedFilter-BOBkqtk6.js → AdvancedFilter-BL2m0s1O.js} +1 -1
- package/dist/assets/AgentFilesTab-CD068nL5.js +3 -0
- package/dist/assets/AnomaliesTab-Bc7-utkr.js +1 -0
- package/dist/assets/{AuditTab-CGfU9rSl.js → AuditTab-rp3o9ni_.js} +1 -1
- package/dist/assets/BridgeTab-D9M2Jvdh.js +1 -0
- package/dist/assets/ChatDefaultsTab-TAcdFRwg.js +1 -0
- package/dist/assets/{DataTableShell-DRaoMzdi.js → DataTableShell-ezCmCHde.js} +1 -1
- package/dist/assets/{DetailChips-BJRTpKvv.js → DetailChips-DZl7SJAQ.js} +1 -1
- package/dist/assets/FeedbacksTab-DlqnH300.js +1 -0
- package/dist/assets/{FieldLabel-DG-U2yJD.js → FieldLabel-P7nCb2ED.js} +2 -2
- package/dist/assets/FilesTab-BRjvjI3H.js +1 -0
- package/dist/assets/{FilterBar-BBJk4kP8.js → FilterBar-NyP0u16q.js} +1 -1
- package/dist/assets/GroupsTab-By5diDc0.js +1 -0
- package/dist/assets/InstancesTab-GL7a4Nh0.js +1 -0
- package/dist/assets/IntegrationsTab-HG2z67bd.js +1 -0
- package/dist/assets/KpiTab-eRc73EfH.js +1 -0
- package/dist/assets/PreferencesTab-CzxxuXHQ.js +1 -0
- package/dist/assets/PromptInjectionsTab-Ca3Wtw06.js +3 -0
- package/dist/assets/RolesTab-ZtdhQkki.js +1 -0
- package/dist/assets/ServiceAccountsTab-BmBwTFtH.js +1 -0
- package/dist/assets/{SubAgentReportsTab-CzaVSPFb.js → SubAgentReportsTab-Dx2BdaRA.js} +1 -1
- package/dist/assets/ThemeShowroom-ljIrzkNU.js +1 -0
- package/dist/assets/{TimeRangePicker-CAhWZBEI.js → TimeRangePicker-JtLvHr3a.js} +1 -1
- package/dist/assets/TracesTab-Bi8G8ogN.js +1 -0
- package/dist/assets/UsersTab-CJboXvTd.js +1 -0
- package/dist/assets/button-Chsl3hJr.js +1 -0
- package/dist/assets/{card-4N7N5yEr.js → card-BUOYrB8s.js} +1 -1
- package/dist/assets/chevrons-up-down-BxjTVcP-.js +1 -0
- package/dist/assets/{compatView-5hziRv_l.js → compatView-B-SErG8a.js} +1 -1
- package/dist/assets/{dispatchErrorInfo-DsgZO0if.js → dispatchErrorInfo-DY4Xsf5c.js} +1 -1
- package/dist/assets/{dist-C_wXViAC.js → dist-CEWcFkOy.js} +1 -1
- package/dist/assets/{dist-B-U7A_Kp.js → dist-CcSJxYOw.js} +1 -1
- package/dist/assets/{dist-BNEZtSYw.js → dist-ClJFgNZb.js} +1 -1
- package/dist/assets/dist-CnMhrvCU.js +5 -0
- package/dist/assets/{highlighted-body-OFNGDK62-ClkcrmUm.js → highlighted-body-OFNGDK62-DzEhHpM8.js} +1 -1
- package/dist/assets/index-Dld_NfaR.js +227 -0
- package/dist/assets/{index-Baso9Ryo.css → index-f9NGvYte.css} +1 -1
- package/dist/assets/mermaid-GHXKKRXX-D5fTxsHz.js +1 -0
- package/dist/assets/roleDescriptions-s8ifW_os.js +1 -0
- package/dist/assets/{table-CEVcfIlY.js → table-CKAkPBqh.js} +1 -1
- package/dist/assets/{tabs-DTsAt8vZ.js → tabs-0mZb1m9H.js} +1 -1
- package/dist/assets/x-CfhV2nwo.js +1 -0
- package/dist/index.html +8 -8
- package/package.json +1 -1
- package/dist/assets/AgentFilesTab-A7KIKZuy.js +0 -3
- package/dist/assets/AnomaliesTab-D1oMEdo7.js +0 -1
- package/dist/assets/BridgeTab-wIiXQVx4.js +0 -1
- package/dist/assets/ChatDefaultsTab-BiAi9i7q.js +0 -1
- package/dist/assets/FeedbacksTab-DXt9vggG.js +0 -1
- package/dist/assets/FilesTab-D6N2e-YF.js +0 -1
- package/dist/assets/GroupsTab-Bd8LlkxI.js +0 -1
- package/dist/assets/InstancesTab-0V2J2Qtq.js +0 -1
- package/dist/assets/IntegrationsTab-pGZl_dNY.js +0 -1
- package/dist/assets/KpiTab-B3XVJcNt.js +0 -1
- package/dist/assets/PreferencesTab-Cj6tC2ZE.js +0 -1
- package/dist/assets/PromptInjectionsTab-_BUqUmC6.js +0 -3
- package/dist/assets/RolesTab-PbMAqWrZ.js +0 -1
- package/dist/assets/ServiceAccountsTab-Bau7cms3.js +0 -1
- package/dist/assets/ThemeShowroom-COaylZ2W.js +0 -1
- package/dist/assets/TracesTab-B0uGrcLJ.js +0 -1
- package/dist/assets/UsersTab-C6Ulyvwq.js +0 -1
- package/dist/assets/button-CoB18od4.js +0 -1
- package/dist/assets/chevrons-up-down-CaKfHJNA.js +0 -1
- package/dist/assets/dist-BN_-yUvA.js +0 -5
- package/dist/assets/index-B6IXWbc8.js +0 -227
- package/dist/assets/mermaid-GHXKKRXX-BnwtjR3q.js +0 -1
- package/dist/assets/roleDescriptions-C3lIPjqc.js +0 -1
- package/dist/assets/x-Dl0sHEar.js +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{D as e}from"./index-Dld_NfaR.js";export{e as Mermaid};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{$m as e,Qm as t,Zm as n,eh as r,th as i}from"./dist-CcSJxYOw.js";var a={pending:i,user:r,admin:e,observer:t,agent:n};function o(e){if(e.builtin){let t=a[e.key];if(t)return t()}return e.description}export{o as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e,r as t}from"./bundle-mjs-C73ZY4La.js";import{n}from"./dist-
|
|
1
|
+
import{a as e,r as t}from"./bundle-mjs-C73ZY4La.js";import{n}from"./dist-CcSJxYOw.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{
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{JD as r,KD as i,ZD as a,eO as o,n as s,qD as c,t as l,tO as u}from"./dist-CcSJxYOw.js";import{t as d}from"./dist-ClJFgNZb.js";import{dt as f,ft as p,pt as m}from"./index-Dld_NfaR.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:a,onValueChange:o,defaultValue:s,orientation:c=`horizontal`,dir:l,activationMode:f=`automatic`,...p}=e,m=d(l),[h,v]=r({prop:a,onChange:o,defaultProp:s??``,caller:_});return(0,g.jsx)(x,{scope:n,baseId:i(),value:h,onValueChange:v,orientation:c,dir:m,activationMode:f,children:(0,g.jsx)(u.div,{dir:m,"data-orientation":c,...p,ref:t})})});C.displayName=_;var w=`TabsList`,T=h.forwardRef((e,t)=>{let{__scopeTabs:n,loop:r=!0,...i}=e,a=S(w,n),o=b(n);return(0,g.jsx)(p,{asChild:!0,...o,orientation:a.orientation,dir:a.dir,loop:r,children:(0,g.jsx)(u.div,{role:`tablist`,"aria-orientation":a.orientation,...i,ref:t})})});T.displayName=w;var E=`TabsTrigger`,D=h.forwardRef((e,t)=>{let{__scopeTabs:n,value:r,disabled:i=!1,...a}=e,s=S(E,n),c=b(n),l=A(s.baseId,r),d=j(s.baseId,r),p=r===s.value;return(0,g.jsx)(f,{asChild:!0,...c,focusable:!i,active:p,children:(0,g.jsx)(u.button,{type:`button`,role:`tab`,"aria-selected":p,"aria-controls":d,"data-state":p?`active`:`inactive`,"data-disabled":i?``:void 0,disabled:i,id:l,...a,ref:t,onMouseDown:o(e.onMouseDown,e=>{!i&&e.button===0&&e.ctrlKey===!1?s.onValueChange(r):e.preventDefault()}),onKeyDown:o(e.onKeyDown,e=>{[` `,`Enter`].includes(e.key)&&s.onValueChange(r)}),onFocus:o(e.onFocus,()=>{let e=s.activationMode!==`manual`;!p&&!i&&e&&s.onValueChange(r)})})})});D.displayName=E;var O=`TabsContent`,k=h.forwardRef((e,t)=>{let{__scopeTabs:n,value:r,forceMount:i,children:a,...o}=e,s=S(O,n),l=A(s.baseId,r),d=j(s.baseId,r),f=r===s.value,p=h.useRef(f);return h.useEffect(()=>{let e=requestAnimationFrame(()=>p.current=!1);return()=>cancelAnimationFrame(e)},[]),(0,g.jsx)(c,{present:i||f,children:({present:n})=>(0,g.jsx)(u.div,{"data-state":f?`active`:`inactive`,"data-orientation":s.orientation,role:`tabpanel`,"aria-labelledby":l,hidden:!n,id:d,tabIndex:0,...o,ref:t,style:{...e.style,animationDuration:p.current?`0s`:void 0},children:n&&a})})});k.displayName=O;function A(e,t){return`${e}-trigger-${t}`}function j(e,t){return`${e}-content-${t}`}var M=C,N=T,P=D,F=k;function I({className:e,orientation:t=`horizontal`,...n}){return(0,g.jsx)(M,{"data-slot":`tabs`,"data-orientation":t,className:s(`group/tabs flex gap-2 data-horizontal:flex-col`,e),...n})}var L=l(`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:s(L({variant:t}),e),...n})}function z({className:e,...t}){return(0,g.jsx)(P,{"data-slot":`tabs-trigger`,className:s(`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:s(`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{lO as e}from"./dist-CcSJxYOw.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
|
@@ -38,15 +38,15 @@
|
|
|
38
38
|
document.documentElement.dataset.ambiance = a === "off" ? "off" : "on";
|
|
39
39
|
})();
|
|
40
40
|
</script>
|
|
41
|
-
<script type="module" crossorigin src="/assets/index-
|
|
41
|
+
<script type="module" crossorigin src="/assets/index-Dld_NfaR.js"></script>
|
|
42
42
|
<link rel="modulepreload" crossorigin href="/assets/bundle-mjs-C73ZY4La.js">
|
|
43
|
-
<link rel="modulepreload" crossorigin href="/assets/dist-
|
|
44
|
-
<link rel="modulepreload" crossorigin href="/assets/dist-
|
|
45
|
-
<link rel="modulepreload" crossorigin href="/assets/dist-
|
|
46
|
-
<link rel="modulepreload" crossorigin href="/assets/dist-
|
|
47
|
-
<link rel="modulepreload" crossorigin href="/assets/x-
|
|
48
|
-
<link rel="modulepreload" crossorigin href="/assets/button-
|
|
49
|
-
<link rel="stylesheet" crossorigin href="/assets/index-
|
|
43
|
+
<link rel="modulepreload" crossorigin href="/assets/dist-CcSJxYOw.js">
|
|
44
|
+
<link rel="modulepreload" crossorigin href="/assets/dist-ClJFgNZb.js">
|
|
45
|
+
<link rel="modulepreload" crossorigin href="/assets/dist-CnMhrvCU.js">
|
|
46
|
+
<link rel="modulepreload" crossorigin href="/assets/dist-CEWcFkOy.js">
|
|
47
|
+
<link rel="modulepreload" crossorigin href="/assets/x-CfhV2nwo.js">
|
|
48
|
+
<link rel="modulepreload" crossorigin href="/assets/button-Chsl3hJr.js">
|
|
49
|
+
<link rel="stylesheet" crossorigin href="/assets/index-f9NGvYte.css">
|
|
50
50
|
</head>
|
|
51
51
|
<body>
|
|
52
52
|
<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.22.0",
|
|
4
4
|
"description": "Atrium — public, self-hostable, Convex-backed web chat UI for AI agent gateways (OpenClaw today, Hermes next). Ships an origin-agnostic static bundle (Convex URL injected at runtime via /config.json).",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Ci as r,Di as i,Ei as a,ND as o,Oi as s,SS as c,Si as ee,Ti as te,_i as l,ai as u,bi as ne,cO as d,ci as f,dO as p,di as m,ei as h,fa as g,fi as _,gi as v,hi as y,iO as b,ii as re,jD as x,ki as S,li as C,mi as w,ni as T,oi as E,pi as ie,ri as D,si as O,ti as k,ua as ae,ui as oe,vi as A,wi as j,xi as se,yi as M}from"./dist-B-U7A_Kp.js";import{t as N}from"./button-CoB18od4.js";import{$ as P,A as F,B as I,C as L,F as ce,I as le,L as ue,N as de,P as fe,Q as pe,R as me,S as R,X as z,b as B,et as he,mt as V,nt as ge,ot as H,rt as _e,v as U,x as W,y as G,z as ve}from"./index-B6IXWbc8.js";import{i as K}from"./compatView-5hziRv_l.js";/* empty css */var q=t(e(),1),J=2e4,Y=6e4;function X(e){return typeof e!=`number`||e<=0?0:Math.round(e/J*100)}function Z(e){return e<=0?0:Math.round(e/Y*100)}function ye(e,t){let n=(typeof e==`number`&&e>0?e:0)/1e3;return new Intl.NumberFormat(t,{minimumFractionDigits:1,maximumFractionDigits:1}).format(n)}function be(e){return e.reduce((e,t)=>e+(typeof t.size==`number`&&t.size>0?t.size:0),0)}var xe=3;function Se(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<xe&&a.push(e)):t>0&&(i+=t,o.length<xe&&o.push(e));return{added:r,removed:i,sampleAdded:a,sampleRemoved:o}}function Ce(e){return e instanceof Error?e.message.includes(`conflict:`):String(e).includes(`conflict:`)}var Q=n(),$=e=>`${e.instanceName}::${e.agentId}`;function we(){let e=p(b.me.getMe,{host:H}),t=e?.role===`admin`,n=(e?.permissions??[]).includes(`bridge.read`),c=p(b.admin.listInstances,e!==void 0&&t?{}:`skip`),[u,f]=(0,q.useState)(null);(0,q.useEffect)(()=>{!t||!c||c.length===0||(!u||!c.some(e=>e.name===u))&&f(c[0].name)},[t,c,u]);let m=p(b.agents.listAgentsForInstance,t&&u?{instanceName:u}:`skip`),h=p(b.agents.listMyAgents,e!==void 0&&!t?{}:`skip`),g=(0,q.useMemo)(()=>{if(e!==void 0){if(t)return u===null||m===void 0?c!==void 0&&c.length===0?[]:void 0:m.agents.map(e=>({instanceName:u,agentId:e.agentId,label:`${e.emoji?`${e.emoji} `:``}${e.displayName??e.agentId}`}));if(h!==void 0)return h.map(e=>({instanceName:e.instanceName,agentId:e.agentId,label:`${e.emoji?`${e.emoji} `:``}${e.displayName??e.agentId}`}))}},[e,t,u,m,c,h]),[_,v]=(0,q.useState)(null);(0,q.useEffect)(()=>{!g||g.length===0||(!_||!g.some(e=>$(e)===_))&&v($(g[0]))},[g,_]);let y=g?.find(e=>$(e)===_)??null,re=d(b.agentFiles.listAgentFiles),[C,w]=(0,q.useState)({status:`idle`}),T=y?.instanceName??null,E=y?.agentId??null,ie=p(b.compat.forInstance,n&&T!==null?{instanceName:T}:`skip`),D=n&&T!==null?U(ie,`agentFiles`):null,O=D===null?!1:D===`loading`?null:D.blocked,k=(0,q.useCallback)(async()=>{if(!(T===null||E===null)){w({status:`loading`});try{w({status:`done`,files:(await re({instanceName:T,agentId:E})).files})}catch{w({status:`error`})}}},[re,T,E]);(0,q.useEffect)(()=>{O===!1&&k()},[k,O]);let[oe,P]=(0,q.useState)(null),F=o(),I=(0,q.useMemo)(()=>new Intl.NumberFormat(F,{maximumFractionDigits:0}),[F]);return e===void 0||g===void 0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:x()}):(0,Q.jsxs)(`div`,{className:`oc-afiles`,children:[(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:S()}),(0,Q.jsxs)(`div`,{className:`oc-afiles__picker`,children:[t&&(c?.length??0)>1?(0,Q.jsxs)(G,{value:u??``,onValueChange:e=>f(e),children:[(0,Q.jsx)(R,{size:`sm`,"aria-label":s(),children:(0,Q.jsx)(L,{})}),(0,Q.jsx)(B,{children:(c??[]).map(e=>(0,Q.jsx)(W,{value:e.name,children:e.name},e.name))})]}):null,g.length>0?(0,Q.jsxs)(G,{value:_??``,onValueChange:e=>v(e),children:[(0,Q.jsx)(R,{size:`sm`,"aria-label":i(),children:(0,Q.jsx)(L,{})}),(0,Q.jsx)(B,{children:g.map(e=>(0,Q.jsx)(W,{value:$(e),children:e.label},$(e)))})]}):(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:a()})]}),y===null?null:D===`loading`?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:x()}):D!==null&&D.blocked?(0,Q.jsxs)(`p`,{className:`oc-compat__blocked`,role:`status`,children:[(0,Q.jsx)(V,{size:14,"aria-hidden":!0}),` `,K(D.gatewayVersion)]}):C.status===`loading`||C.status===`idle`?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:x()}):C.status===`error`?(0,Q.jsxs)(`p`,{className:`oc-afiles__error`,role:`alert`,children:[j(),` `,(0,Q.jsx)(N,{variant:`outline`,size:`sm`,onClick:()=>void k(),children:ae()})]}):C.files.length===0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:te()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`div`,{className:`oc-afiles__list`,children:C.files.map(e=>{let n=X(e.size),i=n>=80;return(0,Q.jsxs)(`div`,{className:`oc-afiles__row`,children:[(0,Q.jsx)(`span`,{className:`oc-afiles__name`,title:e.name,children:e.name}),e.missing?(0,Q.jsx)(z,{variant:`outline`,children:r()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`span`,{className:`oc-afiles__size`,children:ee({size:ye(e.size,F)})}),(0,Q.jsx)(`span`,{className:`oc-afiles__gauge${i?` is-warn`:``}`,"aria-hidden":!0,children:(0,Q.jsx)(`span`,{className:`oc-afiles__gauge-fill`,style:{width:`${Math.min(n,100)}%`}})}),(0,Q.jsx)(`span`,{className:`oc-afiles__pct`,children:se({pct:I.format(n)})}),i?(0,Q.jsx)(V,{size:14,className:`oc-afiles__warn`,"aria-label":ne()}):(0,Q.jsx)(`span`,{className:`oc-afiles__warn-slot`,"aria-hidden":!0})]}),(0,Q.jsx)(N,{variant:`outline`,size:`sm`,className:`oc-afiles__open`,onClick:()=>P(e),children:t?A():l()})]},e.name)})}),(0,Q.jsx)(`p`,{className:`oc-afiles__budget`,children:M({used:ye(be(C.files),F),total:ye(Y,F),pct:I.format(Z(be(C.files)))})})]}),oe&&y?(0,Q.jsx)(Te,{instanceName:y.instanceName,agentId:y.agentId,name:oe.name,isAdmin:t,onClose:()=>P(null),onSaved:()=>void k()}):null]})}function Te({instanceName:e,agentId:t,name:n,isAdmin:r,onClose:i,onSaved:a}){let s=d(b.agentFiles.getAgentFile),ee=d(b.agentFiles.setAgentFile),te=F(),[l,ne]=(0,q.useState)(null),[p,S]=(0,q.useState)(!1),[A,j]=(0,q.useState)(``),[se,M]=(0,q.useState)(!1),[L,R]=(0,q.useState)(!1),[z,B]=(0,q.useState)(!1),[V,H]=(0,q.useState)(!1),U=(0,q.useCallback)(async r=>{S(!1);try{let i=await s({instanceName:e,agentId:t,name:n});ne({content:i.content,updatedAtMs:i.updatedAtMs}),r||j(i.content),B(!1)}catch{S(!0)}},[s,e,t,n]);(0,q.useEffect)(()=>{U(!1)},[U]);async function W(){if(l!==null){R(!0),H(!1);try{await ee({instanceName:e,agentId:t,name:n,content:A,baseUpdatedAtMs:l.updatedAtMs??void 0}),te.success(oe({name:n})),a(),await U(!1)}catch(e){Ce(e)?B(!0):H(!0)}finally{R(!1)}}}let G=l!==null&&A!==l.content,K=(0,q.useMemo)(()=>l===null?null:Se(l.content,A),[l,A]),Y=A.length>J,X=o(),Z=(0,q.useMemo)(()=>new Intl.NumberFormat(X),[X]);return(0,Q.jsx)(pe,{open:!0,onOpenChange:e=>!e&&i(),children:(0,Q.jsxs)(P,{className:`oc-afiles__editor`,children:[(0,Q.jsxs)(ge,{children:[(0,Q.jsx)(_e,{children:v({name:n})}),(0,Q.jsxs)(he,{children:[y({agent:t,instance:e}),r?null:(0,Q.jsxs)(Q.Fragment,{children:[` · `,w()]})]})]}),p?(0,Q.jsxs)(`p`,{className:`oc-afiles__error`,role:`alert`,children:[f(),` `,(0,Q.jsx)(N,{variant:`outline`,size:`sm`,onClick:()=>void U(!1),children:ae()})]}):l===null?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:x()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`textarea`,{className:`oc-afiles__source`,value:A,readOnly:!r,spellCheck:!1,onChange:e=>j(e.target.value),"aria-label":v({name:n})}),(0,Q.jsx)(`p`,{className:`oc-afiles__hint`,children:ie()}),z?(0,Q.jsxs)(`p`,{className:`oc-afiles__error`,role:`alert`,children:[O(),` `,(0,Q.jsx)(N,{variant:`outline`,size:`sm`,onClick:()=>void U(!0),children:E()})]}):null,V?(0,Q.jsx)(`p`,{className:`oc-afiles__error`,role:`alert`,children:C()}):null,(0,Q.jsxs)(`div`,{className:`oc-afiles__editor-foot`,children:[(0,Q.jsx)(`span`,{className:`oc-afiles__count${Y?` is-over`:``}`,children:_({count:Z.format(A.length),max:Z.format(J)})}),r?(0,Q.jsx)(N,{size:`sm`,disabled:!G||L||z,onClick:()=>M(!0),children:L?g():m()}):null]})]}),(0,Q.jsx)(de,{open:se,onOpenChange:M,children:(0,Q.jsxs)(le,{children:[(0,Q.jsxs)(ve,{children:[(0,Q.jsx)(I,{children:u({name:n})}),(0,Q.jsx)(ue,{children:re({agent:t})})]}),K?(0,Q.jsxs)(`div`,{className:`oc-afiles__diff`,children:[(0,Q.jsx)(`p`,{className:`oc-afiles__diff-counts`,children:D({added:K.added,removed:K.removed})}),K.sampleAdded.length>0?(0,Q.jsxs)(`div`,{className:`oc-afiles__diff-block`,children:[(0,Q.jsx)(`span`,{className:`oc-afiles__diff-label`,children:T()}),K.sampleAdded.map((e,t)=>(0,Q.jsx)(`code`,{className:`oc-afiles__diff-line is-add`,children:e||` `},t))]}):null,K.sampleRemoved.length>0?(0,Q.jsxs)(`div`,{className:`oc-afiles__diff-block`,children:[(0,Q.jsx)(`span`,{className:`oc-afiles__diff-label`,children:k()}),K.sampleRemoved.map((e,t)=>(0,Q.jsx)(`code`,{className:`oc-afiles__diff-line is-del`,children:e||` `},t))]}):null]}):null,(0,Q.jsxs)(me,{children:[(0,Q.jsx)(ce,{children:c()}),(0,Q.jsx)(fe,{onClick:()=>void W(),children:h()})]})]})})]})})}export{we as AgentFilesTab};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$p as r,Am as i,Cm as ee,Dm as a,Em as o,Fm as s,Im as c,Lm as l,Mm as te,Nm as ne,Om as re,Pm as ie,Qp as u,Sm as d,Tm as f,Xp as p,Yp as m,Zp as h,_m as ae,am as oe,bm as se,cm as ce,dO as g,dm as le,em as ue,fm as _,gm as de,hm as fe,iO as v,im as pe,jm as me,km as he,lm as ge,mm as y,nm as b,om as x,pm as S,rm as C,sm as w,tm as T,uO as E,um as D,vm as O,wm as k,xm as A,ym as j}from"./dist-B-U7A_Kp.js";import{A as M,C as N,Mt as P,S as F,X as I,a as L,b as R,j as _e,jt as z,ot as ve,r as ye,x as B,y as V}from"./index-B6IXWbc8.js";import{n as be}from"./TimeRangePicker-CAhWZBEI.js";import{t as xe}from"./FilterBar-BBJk4kP8.js";import{t as Se}from"./DataTableShell-DRaoMzdi.js";import{t as H}from"./dispatchErrorInfo-DsgZO0if.js";var U=t(e(),1),W=n(),G=`__all__`,Ce=[{value:`open`},{value:`acknowledged`},{value:`resolved`}];function we(e){return e===`open`?l():e===`acknowledged`?c():s()}var Te=[`info`,`warn`,`critical`],Ee=[`detector`,`agent`,`user`],De={kind:`relative`,from:`now-30d`,to:`now`},Oe=200,K=`all`;function q(){let e=P({from:`/settings/anomalies`}),t=z({from:`/settings/anomalies`}),n=e.q??``,s=e.status===K?G:e.status,c=e.severity??G,l=e.kind??G,[u,p]=(0,U.useState)(G),m=ye(e.from,e.to),{from:h,to:H}=be(m),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})}),Ne=e=>void t({search:t=>({...t,kind:e===G?void 0:e})}),X=e=>void t({search:t=>({...t,...L(e)})}),Pe=_e(),Z=M(),Q=E(v.anomalies.resolveAnomaly),Fe=(g(v.me.getMe,{host:ve})?.permissions??[]).includes(`admin.manage`),$=g(v.anomalies.listAnomalies,{limit:Oe,filter:{q:n||void 0,from:h,to:H,anomalyStatus:s===G?void 0:s,severity:c===G?void 0:c,source:u===G?void 0:u,kind:l===G?void 0:l}}),Ie=(0,U.useMemo)(()=>{let e=new Set;for(let t of $??[])e.add(t.kind);return[...e].sort()},[$]),Le=n!==``||s!==`open`||c!==G||u!==G||l!==G||m.kind!==`relative`||m.from!==De.from;function Re(){p(G),t({search:{status:`open`},replace:!0})}async function ze(e){if(await Pe({title:ie(),description:(0,W.jsxs)(W.Fragment,{children:[ne(),` `,(0,W.jsx)(`span`,{className:`font-mono`,children:e.kind}),` `,te(),` `,(0,W.jsx)(`strong`,{children:me()}),`.`,` `,i()]}),confirmLabel:he()}))try{await Q({anomalyId:e._id,status:`resolved`}),Z.success(re(),e.kind)}catch(e){Z.error(a(),e)}}async function Be(e){try{await Q({anomalyId:e._id,status:`acknowledged`}),Z.success(o(),e.kind)}catch(e){Z.error(f(),e)}}return(0,W.jsxs)(W.Fragment,{children:[(0,W.jsxs)(`p`,{className:`oc-admin__hint`,children:[k(),` `,(0,W.jsx)(`strong`,{children:ee()}),` `,d(),` `,(0,W.jsx)(`strong`,{children:A()}),` `,se(),` `,(0,W.jsx)(`strong`,{children:j()}),` `,O(),` `,(0,W.jsx)(`span`,{className:`oc-filter__window`,children:ae()})]}),(0,W.jsxs)(xe,{q:n,onQChange:q,searchPlaceholder:de(),timeRange:m,onTimeRangeChange:X,onReset:Re,canReset:Le,children:[(0,W.jsxs)(V,{value:s,onValueChange:J,children:[(0,W.jsx)(F,{size:`sm`,className:`w-36`,children:(0,W.jsx)(N,{})}),(0,W.jsxs)(R,{children:[(0,W.jsx)(B,{value:G,children:fe()}),Ce.map(e=>(0,W.jsx)(B,{value:e.value,children:we(e.value)},e.value))]})]}),(0,W.jsxs)(V,{value:c,onValueChange:Y,children:[(0,W.jsx)(F,{size:`sm`,className:`w-36`,children:(0,W.jsx)(N,{placeholder:y()})}),(0,W.jsxs)(R,{children:[(0,W.jsx)(B,{value:G,children:S()}),Te.map(e=>(0,W.jsx)(B,{value:e,children:e},e))]})]}),(0,W.jsxs)(V,{value:u,onValueChange:p,children:[(0,W.jsx)(F,{size:`sm`,className:`w-32`,children:(0,W.jsx)(N,{placeholder:_()})}),(0,W.jsxs)(R,{children:[(0,W.jsx)(B,{value:G,children:le()}),Ee.map(e=>(0,W.jsx)(B,{value:e,children:e},e))]})]}),(0,W.jsxs)(V,{value:l,onValueChange:Ne,children:[(0,W.jsx)(F,{size:`sm`,className:`w-36`,children:(0,W.jsx)(N,{placeholder:D()})}),(0,W.jsxs)(R,{children:[(0,W.jsx)(B,{value:G,children:ge()}),Ie.map(e=>(0,W.jsx)(B,{value:e,children:e},e))]})]})]}),(0,W.jsx)(Se,{title:ce(),rows:$,emptyHint:s===`open`?w():x(),rowActions:e=>Fe&&e.status===`open`?[{label:oe(),onSelect:()=>void ze(e)},{label:pe(),onSelect:()=>void Be(e)}]:[],columns:[{header:C(),cell:e=>(0,W.jsx)(`span`,{className:`oc-traces__time`,children:new Date(e.at).toLocaleString(`fr-FR`)}),sort:e=>e.at},{header:D(),cell:e=>(0,W.jsx)(`code`,{className:`oc-traces__mono`,children:e.kind}),sort:e=>e.kind},{header:y(),cell:e=>(0,W.jsx)(Ae,{severity:e.severity}),sort:e=>e.severity===`critical`?2:+(e.severity===`warn`)},{header:b(),cell:e=>(0,W.jsx)(je,{status:e.status}),sort:e=>e.status===`resolved`?2:+(e.status===`acknowledged`)},{header:_(),cell:e=>(0,W.jsx)(I,{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:ue(),cell:e=>(0,W.jsx)(ke,{row:e}),sort:e=>e.evidence??null},{header:r(),cell:e=>e.correlationId?(0,W.jsx)(`code`,{className:`oc-traces__mono`,children:Me(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 ke({row:e}){let t=z();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:[`↗ `,u()]}):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:[`↗ `,u()]}):null]})}function Ae({severity:e}){return(0,W.jsx)(`span`,{className:`oc-anomaly__sev oc-anomaly__sev--${e}`,children:e})}function je({status:e}){return e===`open`?(0,W.jsx)(I,{variant:`destructive`,children:h()}):e===`acknowledged`?(0,W.jsx)(I,{variant:`secondary`,children:p()}):(0,W.jsx)(I,{variant:`outline`,children:m()})}function Me(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{$u as r,Ar as i,Au as a,Bd as o,Bu as s,Dr as c,Du as l,Er as u,Eu as d,Fr as f,Fu as p,Gd as m,Gu as h,Hd as ee,Hu as g,Id as te,Ir as _,Iu as v,Ju as y,Kd as ne,Ku as re,Ld as ie,Lr as ae,Lu as oe,Mr as se,Mu as ce,Nr as le,Nu as ue,Or as de,Ou as b,Pr as x,Pu as fe,Qu as pe,Rr as me,Ru as he,Sr as ge,Ud as _e,Uu as ve,Vd as ye,Vu as be,Wd as xe,Wu as Se,Xd as Ce,Xu as we,Yd as Te,Yu as Ee,Zu as De,aO as S,ad as Oe,cO as ke,cd as Ae,dO as C,dd as je,ed as Me,fd as Ne,iO as w,id as Pe,jr as Fe,ju as Ie,kr as Le,ku as Re,ld as ze,md as Be,nd as Ve,od as He,pd as Ue,qd as We,qu as Ge,rd as Ke,sd as qe,td as Je,uO as Ye,ud as Xe,zr as Ze,zu as Qe}from"./dist-B-U7A_Kp.js";import{i as T,r as $e}from"./dist-BNEZtSYw.js";import{t as et}from"./chevrons-up-down-CaKfHJNA.js";import{i as tt,n as E,o as nt,r as rt,s as it}from"./FieldLabel-DG-U2yJD.js";import{t as D}from"./button-CoB18od4.js";import{$ as at,A as ot,At as st,C as O,H as ct,Q as lt,S as k,St as ut,U as dt,V as ft,X as A,Z as j,_ as pt,_t as mt,b as M,et as ht,jt as gt,kt as N,mt as P,nt as _t,ot as vt,rt as yt,x as F,y as I}from"./index-B6IXWbc8.js";import{a as bt,i as L,n as xt,o as R,r as z,t as St}from"./table-CEVcfIlY.js";import{t as Ct}from"./FilterBar-BBJk4kP8.js";import{a as B,n as wt,o as V,r as H,s as Tt,t as Et}from"./compatView-5hziRv_l.js";import{t as U}from"./dispatchErrorInfo-DsgZO0if.js";var Dt=S(`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`}]]),Ot=S(`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`}]]),W=t(e(),1);function G(e){return e.filter(e=>e.state===`error`)}function kt(e){return e.reachable&&G(e.targets).length===0}function At(e){return e.state===`error`&&e.lastErrorCode!==null}function jt(e){return!!e.lastDownstreamRejectCode}function K(e){return e.kind??`openclaw`}function Mt(e){return[...e].sort((e,t)=>e===`openclaw`?-1:t===`openclaw`?1:e.localeCompare(t))}function Nt(e,t,n){let r=new Map;for(let e of t)e.instanceName&&r.set(e.instanceName,e.provider);for(let e of n)r.set(e.name,K(e));let i=e=>(e.instanceName?r.get(e.instanceName):void 0)??`openclaw`,a=new Set;for(let e of n)a.add(K(e));for(let e of t)a.add(e.provider);for(let t of e)a.add(i(t));return Mt(a).map(r=>({key:r,connections:e.filter(e=>i(e)===r),compatTargets:t.filter(e=>e.provider===r),instances:n.filter(e=>K(e)===r)}))}function Pt(e){return e===`openclaw`?`OpenClaw`:e===`hermes`?`Hermes`:e.charAt(0).toUpperCase()+e.slice(1)}var q=`__all__`,J={q:``,state:q,instance:q,version:q},Y={connected:0,error:1,idle:2};function Ft(e){return e.q.trim()!==``||e.state!==`__all__`||e.instance!==`__all__`||e.version!==`__all__`}function It(e,t){let n=t.q.trim().toLowerCase();return e.filter(e=>!(n&&!`${e.targetLabel} ${e.gatewayHost}`.toLowerCase().includes(n)||t.state!==`__all__`&&e.state!==t.state||t.instance!==`__all__`&&(e.instanceName??``)!==t.instance||t.version!==`__all__`&&(e.gatewayVersion??``)!==t.version))}function X(e,t){return e.localeCompare(t,void 0,{numeric:!0,sensitivity:`base`})}function Z(e,t){return e===`version`?t.gatewayVersion===null:e===`lastOk`?t.lastOkAt===null:!1}function Lt(e,t,n){switch(e){case`state`:return(Y[t.state]??99)-(Y[n.state]??99);case`instance`:return X(t.instanceLabel??t.instanceName??``,n.instanceLabel??n.instanceName??``);case`host`:return X(t.gatewayHost,n.gatewayHost);case`version`:{let e=t.gatewayVersion,r=n.gatewayVersion;return V(e,r)??X(e,r)}case`lastOk`:return t.lastOkAt-n.lastOkAt;default:return X(t.targetLabel,n.targetLabel)}}function Rt(e,t){if(!t)return e;let n=t.dir===`asc`?1:-1;return[...e].sort((e,r)=>{let i=Z(t.key,e),a=Z(t.key,r);return i&&a?0:i?1:a?-1:n*Lt(t.key,e,r)})}function zt(e){let t=new Set;for(let n of e)t.add(n.state);return[...t].sort((e,t)=>(Y[e]??99)-(Y[t]??99))}function Bt(e){let t=new Map;for(let n of e)n.instanceName!==null&&(t.has(n.instanceName)||t.set(n.instanceName,n.instanceLabel??n.instanceName));return[...t.entries()].map(([e,t])=>({name:e,label:t})).sort((e,t)=>X(e.label,t.label))}function Vt(e){let t=new Set;for(let n of e)n.gatewayVersion!==null&&t.add(n.gatewayVersion);return[...t].sort((e,t)=>V(e,t)??X(e,t))}var Q=n();function Ht({connections:e,displayByInstance:t}){let[n,r]=(0,W.useState)(J),[i,o]=(0,W.useState)(null),c=(0,W.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,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]),l=(0,W.useMemo)(()=>zt(c),[c]),u=(0,W.useMemo)(()=>Bt(c),[c]),d=(0,W.useMemo)(()=>Vt(c),[c]),f=(0,W.useMemo)(()=>Rt(It(c,n),i),[c,n,i]);function m(e){o(t=>t?.key===e?t.dir===`asc`?{key:e,dir:`desc`}:null:{key:e,dir:`asc`})}return e.length===0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:Se()}):(0,Q.jsxs)(`div`,{className:`oc-conn`,children:[(0,Q.jsxs)(Ct,{q:n.q,onQChange:e=>r(t=>({...t,q:e})),searchPlaceholder:be(),onReset:()=>r(J),canReset:Ft(n),children:[(0,Q.jsxs)(I,{value:n.state,onValueChange:e=>r(t=>({...t,state:e})),children:[(0,Q.jsx)(k,{size:`sm`,className:`w-36`,children:(0,Q.jsx)(O,{placeholder:Qe()})}),(0,Q.jsxs)(M,{children:[(0,Q.jsx)(F,{value:q,children:s()}),l.map(e=>(0,Q.jsx)(F,{value:e,children:Wt(e)},e))]})]}),(0,Q.jsxs)(I,{value:n.instance,onValueChange:e=>r(t=>({...t,instance:e})),children:[(0,Q.jsx)(k,{size:`sm`,className:`w-40`,children:(0,Q.jsx)(O,{placeholder:he()})}),(0,Q.jsxs)(M,{children:[(0,Q.jsx)(F,{value:q,children:s()}),u.map(e=>(0,Q.jsx)(F,{value:e.name,children:e.label},e.name))]})]}),(0,Q.jsxs)(I,{value:n.version,onValueChange:e=>r(t=>({...t,version:e})),children:[(0,Q.jsx)(k,{size:`sm`,className:`w-36`,children:(0,Q.jsx)(O,{placeholder:oe()})}),(0,Q.jsxs)(M,{children:[(0,Q.jsx)(F,{value:q,children:s()}),d.map(e=>(0,Q.jsx)(F,{value:e,children:e},e))]})]})]}),f.length===0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:v()}):(0,Q.jsxs)(St,{className:`oc-conn__table`,children:[(0,Q.jsx)(bt,{children:(0,Q.jsxs)(R,{children:[(0,Q.jsx)($,{label:p(),sortKey:`target`,sort:i,onSort:m}),(0,Q.jsx)($,{label:fe(),sortKey:`state`,sort:i,onSort:m}),(0,Q.jsx)($,{label:ue(),sortKey:`instance`,sort:i,onSort:m}),(0,Q.jsx)($,{label:ce(),sortKey:`host`,sort:i,onSort:m}),(0,Q.jsx)($,{label:Ie(),sortKey:`version`,sort:i,onSort:m}),(0,Q.jsx)(L,{children:a()}),(0,Q.jsx)($,{label:Re(),sortKey:`lastOk`,sort:i,onSort:m})]})}),(0,Q.jsx)(xt,{children:f.map(e=>(0,Q.jsx)(Ut,{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)(L,{"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)($e,{size:13,"aria-hidden":!0}):(0,Q.jsx)(T,{size:13,"aria-hidden":!0}):(0,Q.jsx)(et,{size:13,"aria-hidden":!0,className:`oc-conn__sort-idle`})]})})}function Ut({r:e}){let t=At(e)?U(e.lastErrorCode):null,n=jt(e)?U(e.lastDownstreamRejectCode):null;return(0,Q.jsxs)(W.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)(Gt,{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:ve({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:new Date(e.lastOkAt).toLocaleTimeString(`fr-FR`)}):(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?` · ${new Date(e.lastErrorAt).toLocaleTimeString(`fr-FR`)}`:``,(0,Q.jsx)(`p`,{className:`oc-bridge-card__hint`,children:t.hint})]}):null,n?(0,Q.jsxs)(`div`,{className:`oc-bridge-target__downstream`,children:[g({label:n.label}),` `,(0,Q.jsx)(`code`,{className:`oc-traces__mono`,children:e.lastDownstreamRejectCode}),e.lastDownstreamRejectAt?` · ${new Date(e.lastDownstreamRejectAt).toLocaleTimeString(`fr-FR`)}`:``]}):null]})}):null]})}function Wt(e){return e===`connected`?b():e===`error`?l():d()}function Gt({state:e}){return e===`connected`?(0,Q.jsx)(A,{variant:`secondary`,children:b()}):e===`error`?(0,Q.jsx)(A,{variant:`destructive`,children:l()}):(0,Q.jsx)(A,{variant:`outline`,children:d()})}function Kt(){return C(w.bridgeHealth.getBridgeHealth,{})}function qt(){let e=Kt(),t=C(w.compat.getBridgeCompat,{}),n=C(w.me.getMe,{host:vt})?.role===`admin`,r=C(w.admin.listInstances,n?{}:`skip`),i=gt(),a=()=>void i({to:`/settings/anomalies`,search:{status:`open`}}),o=Nt(e?e.targets:[],t?t.targets:[],r??[]),s=t?.compat??null,c=t===void 0?`loading`:t===null?`nodata`:`ready`,l=s!==null&&wt(s,`hermes`)&&!o.some(e=>e.key===`hermes`);return(0,Q.jsxs)(`div`,{className:`oc-bridge`,children:[(0,Q.jsx)(Jt,{health:e,compat:t,onSeeAnomalies:a}),(0,Q.jsx)(`p`,{className:`oc-admin__hint oc-bridge__caption`,children:Me()}),o.map(e=>(0,Q.jsx)(Yt,{providerKey:e.key,connections:e.connections,instances:e.instances,manifest:s,compatStatus:c,compatReachable:t?.reachable??!0},e.key)),l?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:ge()}):null]})}function Jt({health:e,compat:t,onSeeAnomalies:n}){let i=t!=null&&t.buildVersion!=null&&t.bridgeVersion!=null&&t.buildVersion!==t.bridgeVersion,a=t?.buildRevision&&t.buildRevision!==`unknown`?t.buildRevision.slice(0,7):null,o=t&&t!==null?(0,Q.jsxs)(`span`,{className:`oc-bridge-card__ver`,children:[(0,Q.jsx)(`code`,{className:`oc-traces__mono`,children:B(t.bridgeVersion)}),a?(0,Q.jsxs)(Q.Fragment,{children:[` `,(0,Q.jsxs)(`code`,{className:`oc-traces__mono`,title:ae(),children:[`(`,a,`)`]})]}):null,i?(0,Q.jsxs)(`strong`,{className:`oc-bridge-card__mismatch`,children:[` `,_({build:t.buildVersion??`?`})]}):null,` · `,f(),` `,(0,Q.jsx)(`code`,{className:`oc-traces__mono`,children:t.protocolVersion===null?x():String(t.protocolVersion)})]}):null;if(e===void 0)return(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:r()});if(e===null)return(0,Q.jsx)(`div`,{className:`oc-bridge-card oc-bridge-card--idle`,children:pe()});let s=G(e.targets),c=!e.reachable,l=kt(e),u=l?`ok`:`error`,d=new Date(e.checkedAt).toLocaleString(`fr-FR`),p=e.startedAt==null?null:new Date(e.startedAt).toLocaleString(`fr-FR`);return(0,Q.jsxs)(`div`,{className:`oc-bridge-card oc-bridge-card--${u}`,children:[(0,Q.jsx)(`div`,{className:`oc-bridge-card__icon`,"aria-hidden":!0,children:l?(0,Q.jsx)(N,{size:22}):c?(0,Q.jsx)(Ot,{size:22}):(0,Q.jsx)(P,{size:22})}),(0,Q.jsxs)(`div`,{className:`oc-bridge-card__body`,children:[(0,Q.jsx)(`div`,{className:`oc-bridge-card__title`,children:l?De():c?we():Ee({count:s.length})}),(0,Q.jsxs)(`div`,{className:`oc-bridge-card__meta`,children:[(0,Q.jsxs)(`span`,{children:[(0,Q.jsx)(Dt,{size:12,"aria-hidden":!0}),` `,y({time:d})]}),p?(0,Q.jsx)(`span`,{children:Ge({time:p})}):null,o]}),c?(0,Q.jsx)(`p`,{className:`oc-bridge-card__hint`,children:U(e.lastError===`not_configured`?`NOT_CONFIGURED`:`BRIDGE_UNREACHABLE`).hint}):null]}),(0,Q.jsx)(`button`,{type:`button`,className:`oc-bridgebar__drill`,onClick:n,children:re()})]})}function Yt({providerKey:e,connections:t,instances:n,manifest:r,compatStatus:i,compatReachable:a}){let o=r?Tt(r,e):null,s=new Map;for(let e of n)s.set(e.name,e.displayName??e.name);let c=[],l=new Set;for(let n of t){if(!n.instanceName||l.has(n.instanceName))continue;l.add(n.instanceName);let t=n.gatewayVersion??null;c.push({instanceName:n.instanceName,displayName:s.get(n.instanceName)??n.instanceName,version:t,state:Et(t,e,r)})}let u=c.map(e=>e.state),d=u.includes(`beyond`)?`beyond`:u.length>0&&u.every(e=>e===`supported`)?`supported`:null,[f,p]=(0,W.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)(mt,{size:15,"aria-hidden":!0,className:`oc-bridge-provider__icon`}),(0,Q.jsx)(`span`,{className:`oc-bridge-provider__name`,children:Pt(e)}),d?(0,Q.jsx)(A,{variant:d===`beyond`?`destructive`:`secondary`,children:H(d)}):null]}),(0,Q.jsx)(`h4`,{className:`oc-bridge-provider__sub`,children:Ze()}),(0,Q.jsx)(Xt,{support:o,compatStatus:i,compatReachable:a,manifest:r,instanceRows:c}),(0,Q.jsxs)(`button`,{type:`button`,className:`oc-bridge-provider__sub oc-bridge-provider__sub--toggle`,"aria-expanded":f,onClick:()=>p(e=>!e),children:[f?(0,Q.jsx)(T,{size:13,"aria-hidden":!0}):(0,Q.jsx)(st,{size:13,"aria-hidden":!0}),h({count:t.length})]}),f?(0,Q.jsx)(Ht,{connections:t,displayByInstance:s}):null]})}function Xt({support:e,compatStatus:t,compatReachable:n,manifest:a,instanceRows:o}){return t===`loading`?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:r()}):t===`nodata`?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:me()}):(0,Q.jsxs)(`div`,{className:`oc-compat`,children:[n?null:(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:le()}),a===null?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:se()}):(0,Q.jsxs)(`div`,{className:`oc-compat__support`,children:[(0,Q.jsx)(`span`,{className:`oc-compat__label`,children:Fe()}),e&&e.range!==null?(0,Q.jsx)(`span`,{children:i({min:e.range.min,max:e.range.maxValidated})}):(0,Q.jsx)(`span`,{children:x()}),e?(0,Q.jsx)(en,{versions:e.validatedVersions}):null]}),o.length===0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:u()}):(0,Q.jsx)(`div`,{className:`oc-compat__targets`,children:o.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:B(e.version)}),(0,Q.jsx)(A,{variant:e.state===`supported`?`secondary`:e.state===`beyond`?`destructive`:`outline`,children:H(e.state)})]},e.instanceName))})]})}function Zt({instance:e,onClose:t}){return(0,Q.jsx)(lt,{open:!0,onOpenChange:e=>!e&&t(),children:(0,Q.jsxs)(at,{className:`oc-bridge-config-dialog`,onOpenAutoFocus:e=>e.preventDefault(),children:[(0,Q.jsxs)(_t,{children:[(0,Q.jsx)(yt,{children:Ce({instance:e.displayName??e.name})}),(0,Q.jsx)(ht,{children:Te()})]}),(0,Q.jsx)($t,{instance:e,onClose:t})]})})}function Qt({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)(N,{"aria-hidden":!0}):(0,Q.jsx)(P,{"aria-hidden":!0}),(0,Q.jsxs)(`span`,{children:[e,` — `,t.ok?Pe():t.detail]})]}):(0,Q.jsxs)(`p`,{className:`oc-bridge-config__check-row oc-bridge-config__check-row--skip`,children:[e,` — `,Ke()]}):null}function $t({instance:e,onClose:t}){let n=Ye(w.admin.upsertInstanceConfig),r=ke(w.bridge.validateMediaPaths),i=ot(),[a,s]=(0,W.useState)(()=>tt(e.config??{})),[c,l]=(0,W.useState)(!1),[u,d]=(0,W.useState)(!1),[f,p]=(0,W.useState)(null),h=a.inboundMediaMode===`shared-fs`,g=a.mediaMode===`shared-fs`,_=h||g;async function v(){d(!0),p(null);try{p(await r({instanceName:e.name,inboundMediaMode:a.inboundMediaMode,mediaMode:a.mediaMode}))}catch(e){i.error(Ae(),e)}finally{d(!1)}}async function y(){l(!0);try{let r=e.config??{};await n({instanceId:e._id,config:rt(a,r)}),t()}catch(e){i.error(ee(),e)}finally{l(!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)(E,{label:We(),help:ye()}),(0,Q.jsxs)(I,{value:a.mediaMode,onValueChange:e=>s({...a,mediaMode:e}),children:[(0,Q.jsx)(k,{size:`sm`,className:`w-full`,children:(0,Q.jsx)(O,{})}),(0,Q.jsx)(M,{children:it.map(e=>(0,Q.jsx)(F,{value:e,children:e},e))})]})]}),(0,Q.jsxs)(`label`,{className:`oc-field`,children:[(0,Q.jsx)(E,{label:ne(),help:o()}),(0,Q.jsxs)(I,{value:a.inboundMediaMode,onValueChange:e=>s({...a,inboundMediaMode:e}),children:[(0,Q.jsx)(k,{size:`sm`,className:`w-full`,children:(0,Q.jsx)(O,{})}),(0,Q.jsx)(M,{children:nt.map(e=>(0,Q.jsx)(F,{value:e,children:e},e))})]})]}),(0,Q.jsxs)(`label`,{className:`oc-field`,children:[(0,Q.jsx)(E,{label:m(),help:ie()}),(0,Q.jsx)(j,{type:`number`,min:1,max:4096,className:`w-full`,value:a.mediaMaxMb,onChange:e=>s({...a,mediaMaxMb:Math.trunc(Number(e.target.value)||0)})})]})]}),_&&(0,Q.jsxs)(`div`,{className:`oc-bridge-config__grid`,children:[h&&(0,Q.jsxs)(`label`,{className:`oc-field`,children:[(0,Q.jsx)(E,{label:Be(),help:Ue()}),(0,Q.jsx)(j,{className:`w-full`,spellCheck:!1,value:a.inboundAgentMount,onChange:e=>s({...a,inboundAgentMount:e.target.value})})]}),g&&(0,Q.jsxs)(`label`,{className:`oc-field`,children:[(0,Q.jsx)(E,{label:Ne(),help:je()}),(0,Q.jsx)(j,{className:`w-full`,spellCheck:!1,value:a.outboundAgentMount,onChange:e=>s({...a,outboundAgentMount:e.target.value})})]})]}),(0,Q.jsxs)(`label`,{className:`oc-field--row`,children:[(0,Q.jsx)(pt,{checked:a.rehydration,onCheckedChange:e=>s({...a,rehydration:e===!0})}),(0,Q.jsx)(E,{label:xe(),help:te()})]}),_&&f!==null&&(0,Q.jsx)(`div`,{className:`oc-bridge-config__check`,children:f.reachable?!f.inbound&&!f.outbound?(0,Q.jsxs)(`p`,{className:`oc-bridge-config__check-row oc-bridge-config__check-row--err`,children:[(0,Q.jsx)(P,{"aria-hidden":!0}),Je({reason:f.reason??`?`})]}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(Qt,{label:He(),result:f.inbound}),(0,Q.jsx)(Qt,{label:Oe(),result:f.outbound}),(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:qe()})]}):(0,Q.jsxs)(`p`,{className:`oc-bridge-config__check-row oc-bridge-config__check-row--err`,children:[(0,Q.jsx)(P,{"aria-hidden":!0}),Ve()]})}),(0,Q.jsxs)(`div`,{className:`oc-bridge-config__actions`,children:[_&&(0,Q.jsxs)(D,{variant:`outline`,size:`sm`,onClick:()=>void v(),disabled:u,children:[u?(0,Q.jsx)(ut,{className:`size-4 animate-spin`,"aria-hidden":!0}):null,u?ze():Xe()]}),(0,Q.jsx)(D,{size:`sm`,onClick:()=>void y(),disabled:c,children:_e()})]})]})})}function en({versions:e}){if(e.length===0)return null;let t=[...e].reverse();return(0,Q.jsxs)(ft,{children:[(0,Q.jsx)(dt,{asChild:!0,children:(0,Q.jsxs)(`button`,{type:`button`,className:`oc-compat__versions-btn`,children:[e.length===1?Le():de({count:e.length}),(0,Q.jsx)(T,{size:13,"aria-hidden":!0})]})}),(0,Q.jsxs)(ct,{className:`oc-compat__versions-pop`,align:`start`,children:[(0,Q.jsx)(`p`,{className:`oc-compat__versions-title`,children:c()}),(0,Q.jsx)(`div`,{className:`oc-compat__versions-list`,children:t.map(e=>(0,Q.jsx)(A,{variant:`secondary`,children:e},e))})]})]})}export{qt as BridgeTab,Zt as InstanceConfigDialog};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Br as r,Gr as i,Hr as a,Jd as o,Jr as s,Kr as c,Oi as l,Qr as u,S as d,SS as f,Ur as p,Vr as m,Wr as h,Xr as ee,Yr as te,Zr as ne,aa as g,b as _,cO as v,dO as y,fa as b,iO as x,jD as S,oa as C,qr as re,uO as w,ua as ie,x as T}from"./dist-B-U7A_Kp.js";import{t as E}from"./button-CoB18od4.js";import{A as ae,B as oe,C as se,F as ce,I as le,L as ue,N as de,P as fe,R as pe,S as me,Z as D,b as he,g as ge,h as O,mt as k,v as A,x as j,y as M,z as N}from"./index-B6IXWbc8.js";import{i as P}from"./compatView-5hziRv_l.js";/* empty css */var F=t(e(),1),I=[`off`,`minimal`,`low`,`medium`,`high`,`xhigh`];function L(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 R=n();function _e({instance:e}){let t=w(x.admin.upsertInstanceConfig),n=typeof e.config?.summarizeThresholdChars==`number`?e.config.summarizeThresholdChars:null,[r,a]=(0,F.useState)(n===null?``:String(n)),[o,s]=(0,F.useState)(`idle`);(0,F.useEffect)(()=>{a(n===null?``:String(n)),s(`idle`)},[e._id,n]);let l=r.trim(),u=l===``?null:/^\d+$/.test(l)?Number.parseInt(l,10):NaN,f=u===null||Number.isInteger(u)&&u>=1e3&&u<=2e5,p=(u??null)!==n;async function m(){s(`saving`);try{let n={...e.config??{}};u===null?delete n.summarizeThresholdChars:n.summarizeThresholdChars=u,await t({instanceId:e._id,config:n}),s(`done`)}catch{s(`error`)}}return(0,R.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,R.jsx)(`span`,{className:`oc-cdefaults__label`,children:d()}),(0,R.jsxs)(`div`,{className:`oc-cdefaults__inline`,children:[(0,R.jsx)(D,{type:`number`,min:1e3,max:2e5,step:1e3,placeholder:`8000`,value:r,onChange:e=>a(e.target.value),className:`oc-cdefaults__number`,"aria-invalid":!f}),(0,R.jsx)(E,{size:`sm`,disabled:!p||!f||o===`saving`,onClick:()=>void m(),children:o===`saving`?b():c()})]}),f?null:(0,R.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:_()}),o===`done`?(0,R.jsx)(`p`,{className:`oc-admin__hint`,role:`status`,children:i()}):null,o===`error`?(0,R.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:h()}):null,(0,R.jsx)(`p`,{className:`oc-cdefaults__help`,children:T()})]})}function z(){let e=v(x.agentFiles.getChatDefaults),t=v(x.agentFiles.setChatDefaults),n=ae(),[d,_]=(0,F.useState)({status:`loading`}),[w,T]=(0,F.useState)({thinkingDefault:null,fastModeDefault:null}),[D,z]=(0,F.useState)(!1),[B,V]=(0,F.useState)(!1),H=y(x.admin.listInstances,{}),[U,W]=(0,F.useState)(null);(0,F.useEffect)(()=>{!H||H.length===0||(!U||!H.some(e=>e.name===U))&&W(H[0].name)},[H,U]);let G=(H?.length??0)>1,ve=H!==void 0&&H.length===0,ye=y(x.compat.forInstance,U?{instanceName:U}:`skip`),K=U?A(ye,`configDefaults`):`loading`,q=K===`loading`?null:K.blocked,J=(0,F.useMemo)(()=>G&&U?{instanceName:U}:{},[G,U]),Y=(0,F.useRef)(0),X=(0,F.useCallback)(async()=>{let t=++Y.current;_({status:`loading`});try{let n=L(await e(J));if(Y.current!==t)return;_({status:`done`,current:n}),T(n)}catch{if(Y.current!==t)return;_({status:`error`})}},[e,J]);(0,F.useEffect)(()=>{q===!1&&(G&&!U||X())},[X,q,G,U]);let Z=d.status===`done`?d.current:null,Q=Z!==null&&w.thinkingDefault!==null&&w.thinkingDefault!==Z.thinkingDefault,$=Z!==null&&w.fastModeDefault!==null&&w.fastModeDefault!==Z.fastModeDefault,be=Q||$;async function xe(){V(!0);try{await t({...J,...Q?{thinkingDefault:w.thinkingDefault}:{},...$?{fastModeDefault:w.fastModeDefault}:{}}),n.success(i()),await X()}catch(e){n.error(h(),e)}finally{V(!1)}}let Se=(0,F.useMemo)(()=>I.map(e=>({id:e,label:ge(e)})),[]),Ce=(0,F.useMemo)(()=>[{id:`fast`,label:C()},{id:`standard`,label:g()}],[]);return(0,R.jsxs)(`div`,{className:`oc-cdefaults`,children:[(0,R.jsx)(`p`,{className:`oc-admin__hint`,children:u()}),G&&U?(0,R.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,R.jsx)(`span`,{className:`oc-cdefaults__label`,children:l()}),(0,R.jsxs)(M,{value:U,onValueChange:e=>W(e),disabled:B,children:[(0,R.jsx)(me,{size:`sm`,"aria-label":l(),children:(0,R.jsx)(se,{})}),(0,R.jsx)(he,{children:(H??[]).map(e=>(0,R.jsx)(j,{value:e.name,children:e.name},e.name))})]})]}):null,ve?(0,R.jsx)(`p`,{className:`oc-admin__hint`,role:`status`,children:o()}):K===`loading`?(0,R.jsx)(`p`,{className:`oc-admin__hint`,children:S()}):K.blocked?(0,R.jsxs)(`p`,{className:`oc-compat__blocked`,role:`status`,children:[(0,R.jsx)(k,{size:14,"aria-hidden":!0}),` `,P(K.gatewayVersion)]}):d.status===`loading`?(0,R.jsx)(`p`,{className:`oc-admin__hint`,children:S()}):d.status===`error`?(0,R.jsxs)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:[re(),` `,(0,R.jsx)(E,{variant:`outline`,size:`sm`,onClick:()=>void X(),children:ie()})]}):(0,R.jsxs)(R.Fragment,{children:[(0,R.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,R.jsx)(`span`,{className:`oc-cdefaults__label`,children:ne()}),(0,R.jsx)(O,{options:Se,value:w.thinkingDefault,onChange:e=>T({...w,thinkingDefault:e}),disabled:B}),(0,R.jsx)(`p`,{className:`oc-cdefaults__help`,children:ee()})]}),(0,R.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,R.jsx)(`span`,{className:`oc-cdefaults__label`,children:te()}),(0,R.jsx)(O,{options:Ce,value:w.fastModeDefault===null?null:w.fastModeDefault?`fast`:`standard`,onChange:e=>T({...w,fastModeDefault:e===`fast`}),disabled:B}),(0,R.jsx)(`p`,{className:`oc-cdefaults__help`,children:s()})]}),(0,R.jsx)(`div`,{className:`oc-cdefaults__actions`,children:(0,R.jsx)(E,{size:`sm`,disabled:!be||B,onClick:()=>z(!0),children:B?b():c()})}),(0,R.jsx)(`p`,{className:`oc-cdefaults__note`,children:p()})]}),(()=>{let e=H?.find(e=>e.name===(U??H[0]?.name));return e?(0,R.jsx)(_e,{instance:e}):null})(),(0,R.jsx)(de,{open:D,onOpenChange:z,children:(0,R.jsxs)(le,{children:[(0,R.jsxs)(N,{children:[(0,R.jsx)(oe,{children:a()}),(0,R.jsx)(ue,{children:m()})]}),(0,R.jsxs)(pe,{children:[(0,R.jsx)(ce,{children:f()}),(0,R.jsx)(fe,{onClick:()=>void xe(),children:r()})]})]})})]})}export{z as ChatDefaultsTab};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$v as r,Av as i,Bv as a,Cv as o,Dv as s,Ev as c,Fv as l,Gv as u,Hv as d,Iv as f,Jv as ee,Kv as te,Lv as ne,Mv as re,Nv as p,Ov as m,Pv as h,Qv as g,Rv as _,Sv as v,Tv as y,Uv as ie,Vv as ae,Wv as b,Xv as x,Yv as S,Zv as C,_v as w,av as T,bv as E,cv as D,dO as O,dv as k,ey as A,fv as j,gv as M,hv as N,iO as P,iv as F,iy as I,jv as L,kv as R,lv as z,mv as oe,ny as B,ov as V,pv as H,qv as U,rv as W,ry as G,sv as K,ty as q,uO as J,uv as se,vv as ce,wv as le,xv as ue,yv as de,zv as fe}from"./dist-B-U7A_Kp.js";import{t as pe}from"./button-CoB18od4.js";import{j as me}from"./index-B6IXWbc8.js";import{t as he}from"./DataTableShell-DRaoMzdi.js";var Y=t(e(),1),X=n(),Z={altered_words:()=>I(),incorrect:()=>G(),incoherence:()=>B(),formatting:()=>q(),latency:()=>A(),api_error:()=>r(),other:()=>g()},Q=e=>Z[e]?.()??e;function $({matches:e,sourceWasOpen:t}){return t?e===!0?(0,X.jsx)(`span`,{className:`oc-fbadmin__pill is-ok`,children:x()}):e===!1?(0,X.jsx)(`span`,{className:`oc-fbadmin__pill is-warn`,children:S()}):(0,X.jsx)(`span`,{className:`oc-fbadmin__pill`,children:`—`}):(0,X.jsx)(`span`,{className:`oc-fbadmin__pill`,children:C()})}function ge({data:e,closeReason:t}){let n=e.snapshot,r=J(P.feedback.respondToFeedback),[o,s]=(0,Y.useState)(e.thread),[c,g]=(0,Y.useState)(``),[v,y]=(0,Y.useState)(!1);async function x(){let t=c.trim();if(!(!t||v)){y(!0);try{await r({feedbackId:e._id,text:t}),s(e=>[...e,{authorRole:`admin`,text:t,at:Date.now()}]),g(``)}finally{y(!1)}}}let S=[];try{S=n.contextJson?JSON.parse(n.contextJson):[]}catch{S=[]}return(0,X.jsxs)(`div`,{className:`oc-fbadmin__detail`,children:[(0,X.jsxs)(`div`,{className:`oc-fbadmin__row`,children:[(0,X.jsx)($,{matches:n.displayedMatchesStored,sourceWasOpen:n.clientInfo?.sourceWasOpen??!1}),(0,X.jsxs)(`span`,{className:`oc-fbadmin__meta`,children:[Q(e.category),` · `,n.messageRole,n.isRegeneration?` · ${ee()}`:``,n.openclawModel?` · ${n.openclawModel}`:``,n.openclawRuntime?` (${n.openclawRuntime})`:``]})]}),e.comment?(0,X.jsxs)(`section`,{children:[(0,X.jsx)(`h4`,{className:`oc-fbadmin__h`,children:U()}),(0,X.jsx)(`p`,{className:`oc-fbadmin__comment`,children:e.comment})]}):null,t?(0,X.jsxs)(`section`,{children:[(0,X.jsx)(`h4`,{className:`oc-fbadmin__h`,children:z()}),(0,X.jsx)(`p`,{className:`oc-fbadmin__comment`,children:t})]}):null,(0,X.jsxs)(`section`,{children:[(0,X.jsx)(`h4`,{className:`oc-fbadmin__h`,children:te()}),o.length>0?(0,X.jsx)(`div`,{className:`oc-fbadmin__thread`,children:o.map((e,t)=>(0,X.jsxs)(`div`,{className:`oc-notif__msg oc-notif__msg--${e.authorRole}`,children:[(0,X.jsx)(`span`,{className:`oc-notif__msg-who`,children:e.authorRole===`admin`?u():b()}),(0,X.jsx)(`span`,{className:`oc-notif__msg-text`,children:e.text})]},t))}):(0,X.jsx)(`p`,{className:`oc-fbadmin__meta`,children:ie()}),(0,X.jsx)(`textarea`,{className:`oc-feedback__textarea`,placeholder:d(),value:c,maxLength:2e3,rows:3,onChange:e=>g(e.target.value.slice(0,2e3))}),(0,X.jsx)(`div`,{className:`oc-fbadmin__row`,style:{justifyContent:`flex-end`},children:(0,X.jsx)(pe,{size:`sm`,onClick:()=>void x(),disabled:!c.trim()||v,children:v?ae():a()})})]}),(0,X.jsxs)(`section`,{children:[(0,X.jsx)(`h4`,{className:`oc-fbadmin__h`,children:fe()}),(0,X.jsx)(`pre`,{className:`oc-msg__source-pre`,children:n.messageText||_()})]}),n.clientInfo?.sourceWasOpen&&n.displayedText!==void 0?(0,X.jsxs)(`section`,{children:[(0,X.jsx)(`h4`,{className:`oc-fbadmin__h`,children:ne()}),(0,X.jsx)(`pre`,{className:`oc-msg__source-pre`,children:n.displayedText||_()})]}):null,n.promptText?(0,X.jsxs)(`section`,{children:[(0,X.jsx)(`h4`,{className:`oc-fbadmin__h`,children:f()}),(0,X.jsx)(`pre`,{className:`oc-msg__source-pre`,children:n.promptText})]}):null,S.length>0?(0,X.jsxs)(`section`,{children:[(0,X.jsx)(`h4`,{className:`oc-fbadmin__h`,children:l({count:n.contextCount??S.length,truncated:n.contextTruncated?h():``})}),(0,X.jsx)(`div`,{className:`oc-fbadmin__ctx`,children:S.map((e,t)=>(0,X.jsxs)(`div`,{className:`oc-fbadmin__ctx-turn`,children:[(0,X.jsx)(`span`,{className:`oc-fbadmin__ctx-role`,children:e.role}),(0,X.jsx)(`span`,{className:`oc-fbadmin__ctx-text`,children:e.text})]},t))})]}):null,n.outboxAvailable?(0,X.jsxs)(`section`,{children:[(0,X.jsx)(`h4`,{className:`oc-fbadmin__h`,children:p()}),(0,X.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,X.jsxs)(`section`,{children:[(0,X.jsx)(`h4`,{className:`oc-fbadmin__h`,children:re()}),(0,X.jsx)(`div`,{className:`oc-fbadmin__row`,children:n.clientInfo.extensionsDetected.map(e=>(0,X.jsx)(`span`,{className:`oc-fbadmin__pill is-warn`,children:e},e))})]}):null,(0,X.jsxs)(`section`,{children:[(0,X.jsx)(`h4`,{className:`oc-fbadmin__h`,children:L()}),(0,X.jsxs)(`p`,{className:`oc-fbadmin__env`,children:[[n.clientInfo?.language,n.clientInfo?.timezone,n.clientInfo?.theme?i({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,X.jsxs)(`span`,{className:`oc-fbadmin__plugins`,children:[R(),` `,n.clientInfo.plugins.join(`, `),(0,X.jsxs)(`span`,{className:`oc-fbadmin__note`,children:[` `,m()]})]}):null,n.clientInfo?.userAgent?(0,X.jsx)(`span`,{className:`oc-fbadmin__ua`,children:n.clientInfo.userAgent}):null]})]})]})}function _e(){let e=O(P.feedback.listForAdmin,{}),t=J(P.feedback.readSnapshot),n=J(P.feedback.deleteFeedback),r=me(),[i,a]=(0,Y.useState)(null),[l,u]=(0,Y.useState)({});async function d(e){if(i===e._id){a(null);return}if(!l[e._id]){let n=await t({feedbackId:e._id});u(t=>({...t,[e._id]:n}))}a(e._id)}async function f(e){await r({title:T(),description:F(),confirmLabel:W(),destructive:!0})&&(await n({feedbackId:e._id}),i===e._id&&a(null))}return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`p`,{className:`oc-admin__hint`,children:[s(),` `,(0,X.jsx)(`strong`,{children:c()}),` `,y()]}),(0,X.jsx)(he,{title:le(),rows:e,emptyHint:o(),isExpanded:e=>i===e._id&&!!l[e._id],renderExpanded:e=>l[e._id]?(0,X.jsx)(ge,{data:l[e._id],closeReason:e.userCloseReason}):null,columns:[{header:v(),cell:e=>new Date(e.at).toLocaleString(`fr-FR`),sort:e=>e.at},{header:ue(),cell:e=>Q(e.category),sort:e=>Q(e.category)},{header:E(),cell:e=>e.messageRole===`user`?de():ce(),sort:e=>e.messageRole},{header:w(),cell:e=>(e.reporterEmail||e.reporterName||`—`)+(e.impersonated&&e.realOperatorEmail?` ${M({operator:e.realOperatorEmail})}`:``),sort:e=>e.reporterEmail||e.reporterName||null},{header:N(),cell:e=>(0,X.jsx)($,{matches:e.displayedMatchesStored,sourceWasOpen:e.sourceWasOpen}),sort:e=>e.displayedMatchesStored===!1?0:e.displayedMatchesStored===!0?1:2},{header:oe(),cell:e=>e.hasComment?`✎`:`—`,sort:e=>+!!e.hasComment},{header:H(),cell:e=>e.userClosedAt==null?e.answered?(0,X.jsx)(`span`,{className:`oc-fbadmin__pill is-ok`,children:j()}):(0,X.jsx)(`span`,{className:`oc-fbadmin__pill`,children:k()}):(0,X.jsx)(`span`,{className:`oc-fbadmin__pill is-closed`,children:se()}),sort:e=>e.userClosedAt==null?+!!e.answered:2}],rowActions:e=>[{label:i===e._id?D():K(),onSelect:()=>void d(e)},{label:V(),onSelect:()=>void f(e),variant:`destructive`}]})]})}export{_e as FeedbacksTab};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$E as ee,AE as te,BE as ne,FE as r,GE as re,HE as ie,IE as i,JE as a,KE as o,LE as s,ME as c,ND as l,NE as u,OE as d,PE as f,QE as p,RE as ae,SS as oe,UE as se,VE as ce,WE as le,XE as m,YE as h,ZE as g,aD as _,cD as ue,dO as de,eD as fe,iD as pe,iO as v,jD as me,jE as he,kE as ge,lD as _e,nD as y,oD as b,qE as x,rD as S,sD as C,tD as w,uO as T,zE as E}from"./dist-B-U7A_Kp.js";import{t as D}from"./button-CoB18od4.js";import{A as O,B as k,C as A,Et as j,F as M,G as N,I as P,K as F,L as I,N as ve,P as ye,R as be,S as L,Tt as xe,W as Se,X as Ce,Y as we,b as R,ht as Te,x as z,y as B,yt as Ee,z as De}from"./index-B6IXWbc8.js";import{a as Oe,i as V,n as ke,o as H,r as U,t as Ae}from"./table-CEVcfIlY.js";var W=t(e(),1),G=n(),K=`all`;function q(e){switch(e){case`image`:return p();case`audio`:return g();case`video`:return m();case`pdf`:return h();case`document`:return a();case`archive`:return x();default:return o()}}function J(){let[e,t]=(0,W.useState)(K),[n,a]=(0,W.useState)(K),[o,p]=(0,W.useState)(K),[m,h]=(0,W.useState)(K),[g,x]=(0,W.useState)(null),J=T(v.files.softDelete),Y=O();function je(){t(K),a(K),p(K),h(K)}async function Me(){let e=g;if(x(null),e)try{await J({fileId:e.id}),Y.success(r())}catch(e){Y.error(f(),e)}}let X=de(v.files.listMine,{direction:e===K?void 0:e,chatId:n===K?void 0:n,instanceName:o===K?void 0:o,category:m===K?void 0:m}),Ne=(0,W.useMemo)(()=>new Intl.DateTimeFormat(l(),{dateStyle:`medium`,timeStyle:`short`}),[]);if(X===void 0)return(0,G.jsx)(`p`,{className:`oc-admin__hint`,children:me()});let{files:Z,facets:Q,truncated:Pe,cap:Fe}=X,$=e!==K||n!==K||o!==K||m!==K;return(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`p`,{className:`oc-admin__hint`,children:_e()}),(0,G.jsxs)(`div`,{className:`oc-files__filters`,style:{display:`flex`,flexWrap:`wrap`,gap:8,margin:`12px 0`},children:[(0,G.jsxs)(B,{value:e,onValueChange:t,children:[(0,G.jsx)(L,{size:`sm`,"aria-label":ue(),children:(0,G.jsx)(A,{})}),(0,G.jsxs)(R,{children:[(0,G.jsx)(z,{value:K,children:C()}),(0,G.jsx)(z,{value:`inbound`,children:b()}),(0,G.jsx)(z,{value:`outbound`,children:_()})]})]}),(0,G.jsxs)(B,{value:n,onValueChange:a,children:[(0,G.jsx)(L,{size:`sm`,"aria-label":pe(),children:(0,G.jsx)(A,{})}),(0,G.jsxs)(R,{children:[(0,G.jsx)(z,{value:K,children:S()}),Q.chats.map(e=>(0,G.jsx)(z,{value:e.id,children:e.title},e.id))]})]}),Q.multiProvider?(0,G.jsxs)(B,{value:o,onValueChange:p,children:[(0,G.jsx)(L,{size:`sm`,"aria-label":y(),children:(0,G.jsx)(A,{})}),(0,G.jsxs)(R,{children:[(0,G.jsx)(z,{value:K,children:w()}),Q.instances.map(e=>(0,G.jsx)(z,{value:e,children:e},e))]})]}):null,(0,G.jsxs)(B,{value:m,onValueChange:h,children:[(0,G.jsx)(L,{size:`sm`,"aria-label":fe(),children:(0,G.jsx)(A,{})}),(0,G.jsxs)(R,{children:[(0,G.jsx)(z,{value:K,children:ee()}),Q.categories.map(e=>(0,G.jsx)(z,{value:e,children:q(e)},e))]})]}),$?(0,G.jsxs)(D,{variant:`ghost`,size:`sm`,onClick:je,style:{display:`inline-flex`,alignItems:`center`,gap:4,marginLeft:`auto`},children:[(0,G.jsx)(Ee,{size:14,"aria-hidden":!0}),ae()]}):null]}),Z.length===0?(0,G.jsx)(`p`,{className:`oc-admin__hint`,children:$?ge():te()}):(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(Ae,{children:[(0,G.jsx)(Oe,{children:(0,G.jsxs)(H,{children:[(0,G.jsx)(V,{children:re()}),(0,G.jsx)(V,{children:le()}),(0,G.jsx)(V,{children:se()}),(0,G.jsx)(V,{children:ie()}),(0,G.jsx)(V,{children:ce()}),(0,G.jsx)(V,{className:`text-right`,children:ne()})]})}),(0,G.jsx)(ke,{children:Z.map(e=>(0,G.jsxs)(H,{children:[(0,G.jsx)(U,{className:`font-medium`,style:{maxWidth:280,overflow:`hidden`,textOverflow:`ellipsis`},title:e.filename,children:e.filename}),(0,G.jsx)(U,{title:e.mimeType,children:q(e.category)}),(0,G.jsx)(U,{children:(0,G.jsx)(Ce,{variant:`secondary`,children:e.direction===`inbound`?b():_()})}),(0,G.jsx)(U,{style:{maxWidth:220,overflow:`hidden`,textOverflow:`ellipsis`},title:e.chatTitle,children:e.chatTitle}),(0,G.jsx)(U,{className:`whitespace-nowrap text-muted-foreground`,children:Ne.format(e.createdAt)}),(0,G.jsx)(U,{className:`text-right`,children:(0,G.jsxs)(Se,{children:[(0,G.jsx)(we,{asChild:!0,children:(0,G.jsx)(D,{variant:`ghost`,size:`icon`,"aria-label":s(),children:(0,G.jsx)(xe,{size:16})})}),(0,G.jsxs)(N,{align:`end`,children:[e.url?(0,G.jsx)(F,{asChild:!0,children:(0,G.jsxs)(`a`,{href:e.url,download:e.filename,target:`_blank`,rel:`noopener noreferrer`,children:[(0,G.jsx)(j,{size:14}),E()]})}):(0,G.jsxs)(F,{disabled:!0,children:[(0,G.jsx)(j,{size:14}),he()]}),(0,G.jsxs)(F,{variant:`destructive`,onSelect:()=>x({id:e._id,filename:e.filename}),children:[(0,G.jsx)(Te,{size:14}),i()]})]})]})})]},e._id))})]}),Pe?(0,G.jsx)(`p`,{className:`oc-admin__hint`,style:{marginTop:8},children:d({cap:Fe})}):null]}),(0,G.jsx)(ve,{open:g!==null,onOpenChange:e=>!e&&x(null),children:(0,G.jsxs)(P,{children:[(0,G.jsxs)(De,{children:[(0,G.jsx)(k,{children:u()}),(0,G.jsx)(I,{children:c()})]}),(0,G.jsxs)(be,{children:[(0,G.jsx)(M,{children:oe()}),(0,G.jsx)(ye,{onClick:()=>void Me(),children:i()})]})]})})]})}export{J as FilesTab};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$a as r,Aa as i,Ao as a,Ba as o,Co as s,Da as c,Do as l,Ea as u,Eo as d,Fa as f,Ga as p,Ha as m,Ia as h,Ja as g,Ka as _,La as v,Ma as y,Mo as b,Na as x,No as ee,Oa as S,Oo as C,Pa as w,Qa as T,Ra as E,So as te,Ta as D,To as ne,Ua as O,Va as k,Wa as A,Xa as re,Ya as j,Za as ie,_o as M,aO as N,ao as ae,bo as P,co as oe,dO as F,do as se,eo as ce,fo as le,go as ue,ho as de,iO as I,io as L,ja as R,jo as fe,ka as pe,ko as me,lo as he,mo as ge,no as _e,oo as ve,po as ye,qa as be,ro as xe,so as Se,to as Ce,uO as z,uo as we,vo as Te,wa as Ee,wo as De,xo as Oe,yo as ke,za as Ae}from"./dist-B-U7A_Kp.js";import{t as je}from"./x-Dl0sHEar.js";import{i as B,n as V,r as Me,t as Ne}from"./tabs-DTsAt8vZ.js";import{t as H}from"./button-CoB18od4.js";import{$ as Pe,A as U,At as Fe,C as Ie,Q as Le,S as Re,X as W,Z as G,_ as K,_t as q,b as ze,et as Be,gt as J,j as Ve,m as He,nt as Ue,ot as We,rt as Ge,x as Ke,y as qe}from"./index-B6IXWbc8.js";import{t as Je}from"./FilterBar-BBJk4kP8.js";import{t as Ye}from"./DataTableShell-DRaoMzdi.js";import{t as Y}from"./DetailChips-BJRTpKvv.js";var Xe=N(`chevron-left`,[[`path`,{d:`m15 18-6-6 6-6`,key:`1wnfg3`}]]),Ze=N(`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=N(`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=N(`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 ce();case`user`:return r();case`pending`:return T();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=F(I.groups.listGroups,{}),t=F(I.me.getMe,{host:We})?.role===`admin`,n=z(I.groups.createGroup),r=z(I.groups.updateGroup),i=z(I.groups.deleteGroup),o=Ve(),f=U(),[p,m]=(0,Z.useState)(!1),[h,g]=(0,Z.useState)(null),[_,v]=(0,Z.useState)($),[y,x]=(0,Z.useState)(null),[S,w]=(0,Z.useState)(``),T=(0,Z.useMemo)(()=>{if(!e)return e;let t=S.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,S]);function E(){g(null),v($),m(!0)}function D(e){g(e),v({name:e.name,description:e.description??``}),m(!0)}async function O(){try{h?await r({groupId:h._id,name:_.name,description:_.description}):await n({name:_.name,description:_.description||void 0}),v($),g(null),m(!1)}catch(e){f.error(c(),e)}}async function k(e){if(await o({title:ge({name:e.name}),description:ye(),confirmWord:e.name,confirmLabel:le(),cancelLabel:P(),destructive:!0}))try{await i({groupId:e._id})}catch(e){f.error(u(),e)}}return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:b()}),(0,Q.jsx)(Je,{q:S,onQChange:w,onReset:()=>w(``),canReset:S!==``,searchPlaceholder:ne()}),(0,Q.jsx)(Ye,{title:ee(),rows:T,addLabel:fe(),onAdd:t?E:void 0,emptyHint:a(),columns:[{header:me(),cell:e=>e.name,sort:e=>e.name},{header:C(),cell:e=>(0,Q.jsx)(Y,{icon:(0,Q.jsx)(Qe,{size:12,"aria-hidden":!0}),total:e.memberCount,items:e.members.map(e=>({label:e.label,marker:e.manager?(0,Q.jsx)(X,{size:11,"aria-hidden":!0}):null,highlight:e.manager}))}),sort:e=>e.memberCount},{header:l(),cell:e=>(0,Q.jsx)(Y,{icon:(0,Q.jsx)(q,{size:12,"aria-hidden":!0}),total:e.agentCount,items:e.agents.map(e=>({label:e}))}),sort:e=>e.agentCount},{header:d(),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)(J,{size:11,fill:`currentColor`,"aria-hidden":!0}):null,highlight:e.isDefault}))}),sort:e=>e.chartCount}],rowActions:e=>[{label:De(),onSelect:()=>x({groupId:e._id,name:e.name})},...t?[{label:s(),onSelect:()=>D(e)},{label:te(),variant:`destructive`,onSelect:()=>void k(e)}]:[]]}),(0,Q.jsx)(He,{open:p,onOpenChange:m,title:h?Te():ke(),description:M(),canSubmit:!!_.name.trim(),onSubmit:O,submitLabel:Oe(),children:(0,Q.jsxs)(`div`,{className:`oc-form`,children:[(0,Q.jsxs)(`label`,{className:`oc-field`,children:[(0,Q.jsx)(`span`,{className:`oc-field__label`,children:ue()}),(0,Q.jsx)(G,{value:_.name,onChange:e=>v({..._,name:e.target.value})})]}),(0,Q.jsxs)(`label`,{className:`oc-field`,children:[(0,Q.jsx)(`span`,{className:`oc-field__label`,children:de()}),(0,Q.jsx)(G,{value:_.description,onChange:e=>v({..._,description:e.target.value})})]})]})}),(0,Q.jsx)(ct,{groupId:y?.groupId??null,groupName:y?.name??``,open:y!==null,onOpenChange:e=>{e||x(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}),xe()]}),(0,Q.jsxs)(`span`,{className:`oc-access__pageinfo`,"aria-label":Ce({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:[_e(),(0,Q.jsx)(Fe,{size:14,"aria-hidden":!0})]})]})}function ct({groupId:e,groupName:t,open:n,onOpenChange:r}){let a=F(I.groups.getGroup,n&&e?{groupId:e}:`skip`),s=F(I.groups.listAssignableInstances,n?{}:`skip`),c=F(I.groups.listAssignableUsers,n?{}:`skip`),l=z(I.groups.addMember),u=z(I.groups.removeMember),d=z(I.groups.bulkSetMembers),f=z(I.groups.setGroupManager),p=U(),[m,h]=(0,Z.useState)(``),[g,v]=(0,Z.useState)(``),[b,x]=(0,Z.useState)(`members`),[ee,S]=(0,Z.useState)(1),[C,w]=(0,Z.useState)(new Set),T=(0,Z.useRef)(null),E=(0,Z.useMemo)(()=>new Set((a?.members??[]).map(e=>e.userId)),[a]),te=(0,Z.useMemo)(()=>new Set((a?.members??[]).filter(e=>e.manager).map(e=>e.userId)),[a]),ne=a?.viewerIsAdmin===!0,O=(0,Z.useMemo)(()=>new Set((a?.agents??[]).map(e=>`${e.instanceName}/${e.agentId}`)),[a]);(0,Z.useEffect)(()=>{h(``),v(``),x(`members`),S(1),T.current=null},[n,e]),(0,Z.useEffect)(()=>{S(1)},[m]),(0,Z.useEffect)(()=>{n&&a&&e&&T.current!==e&&(T.current=e,w(new Set((a.members??[]).map(e=>e.userId))))},[n,a,e]);let k=(0,Z.useMemo)(()=>c?$e(c,m,C):[],[c,m,C]);async function A(t,n){if(e)try{n?await u({groupId:e,userId:t}):await l({groupId:e,userId:t})}catch(e){p.error(D(),e)}}async function re(t,n){if(e)try{await f({groupId:e,userId:t,manager:!n})}catch(e){p.error(pe(),e)}}let M=rt(k,e=>E.has(e.userId)),N=k.filter(e=>E.has(e.userId)).length,P=it(k,ee,ot);async function ce(){if(!e||k.length===0)return;let t=k.map(e=>e.userId);try{await d({groupId:e,userIds:t,member:M!==`all`})}catch(e){p.error(D(),e)}}return(0,Q.jsx)(Le,{open:n,onOpenChange:r,children:(0,Q.jsxs)(Pe,{className:`oc-access`,children:[(0,Q.jsxs)(Ue,{children:[(0,Q.jsx)(Ge,{children:se({name:t})}),(0,Q.jsx)(Be,{children:we()})]}),(0,Q.jsxs)(Ne,{value:b,onValueChange:x,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}),he(),a?(0,Q.jsx)(W,{variant:`secondary`,className:`oc-access__tabcount`,children:E.size}):null]}),(0,Q.jsxs)(B,{value:`agents`,className:`flex-1 gap-1.5`,children:[(0,Q.jsx)(q,{size:13,"aria-hidden":!0}),Se(),a?(0,Q.jsx)(W,{variant:`secondary`,className:`oc-access__tabcount`,children:O.size}):null]}),(0,Q.jsxs)(B,{value:`charts`,className:`flex-1 gap-1.5`,children:[(0,Q.jsx)(Ze,{size:13,"aria-hidden":!0}),o(),a?(0,Q.jsx)(W,{variant:`secondary`,className:`oc-access__tabcount`,children:a.chartCount}):null]})]}),(0,Q.jsx)(V,{value:`members`,children:c===void 0||a===void 0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:j()}):c.length===0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:be()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(G,{value:m,onChange:e=>h(e.target.value),placeholder:oe(),className:`oc-access__search`}),k.length===0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:ae()}):(0,Q.jsxs)(Q.Fragment,{children:[k.length>1?(0,Q.jsxs)(`div`,{className:`oc-access__row oc-access__selectall`,children:[(0,Q.jsx)(K,{checked:M===`all`?!0:M===`some`?`indeterminate`:!1,onCheckedChange:()=>void ce(),"aria-label":L()}),(0,Q.jsx)(`span`,{className:`oc-access__label`,children:L()}),(0,Q.jsxs)(W,{variant:`outline`,className:`oc-access__count`,children:[N,` / `,k.length]})]}):null,(0,Q.jsx)(`div`,{className:`oc-access__list`,children:P.pageItems.map(e=>{let t=E.has(e.userId),n=tt(e),r=te.has(e.userId);return(0,Q.jsxs)(`div`,{className:`oc-access__row`,children:[(0,Q.jsx)(K,{checked:t,onCheckedChange:()=>void A(e.userId,t),"aria-label":ie({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)(W,{variant:`outline`,className:`oc-access__role`,children:nt(e.role)}),(0,Q.jsx)(`span`,{className:`oc-access__mgrslot`,children:t&&ne?(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?i():R(),title:r?i():R(),onClick:()=>void re(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":y(),title:y(),children:(0,Q.jsx)(X,{size:15,"aria-hidden":!0})}):null})]},e._id)})}),(0,Q.jsx)(st,{page:P.page,pageCount:P.pageCount,onPage:S})]})]})}),(0,Q.jsx)(V,{value:`agents`,children:s===void 0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:j()}):s.length===0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:_()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(G,{value:g,onChange:e=>v(e.target.value),placeholder:ve(),className:`oc-access__search`}),(0,Q.jsx)(`div`,{className:`oc-access__list`,children:s.map(t=>(0,Q.jsx)(lt,{groupId:e,instanceName:t.name,kind:t.kind??`openclaw`,assigned:O,query:g},`${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:i}){let a=F(I.groups.listAssignableAgents,{instanceName:t}),o=z(I.groups.assignAgentToGroup),s=z(I.groups.removeAgentFromGroup),c=z(I.groups.bulkSetGroupAgents),l=U(),[u,d]=(0,Z.useState)(1);if((0,Z.useEffect)(()=>{d(1)},[i]),!e)return null;let f=et(a?.agents??[],i),h=a?.discovery&&!a.discovery.lastPollOk;if(i.trim()&&f.length===0)return null;let _=f.filter(e=>e.presentInLastOk!==!1),v=rt(_,e=>r.has(`${t}/${e.agentId}`)),y=it(f,u,ot);async function b(n,r){try{r?await s({groupId:e,instanceName:t,agentId:n}):await o({groupId:e,instanceName:t,agentId:n})}catch(e){l.error(Ee(),e)}}async function x(){if(_.length===0)return;let n=_.map(e=>e.agentId);try{await c({groupId:e,instanceName:t,agentIds:n,assigned:v!==`all`})}catch(e){l.error(Ee(),e)}}return(0,Q.jsxs)(`div`,{className:`oc-access__group`,children:[(0,Q.jsxs)(`div`,{className:`oc-access__instance`,children:[(0,Q.jsx)(q,{size:13,"aria-hidden":!0}),(0,Q.jsx)(`span`,{children:t}),(0,Q.jsx)(W,{variant:`outline`,className:`oc-access__kind`,children:n}),h?(0,Q.jsx)(W,{variant:`outline`,className:`oc-access__stale`,children:O()}):null]}),a===void 0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:g()}):f.length===0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:h?A():p()}):(0,Q.jsxs)(Q.Fragment,{children:[_.length>1?(0,Q.jsxs)(`div`,{className:`oc-access__row oc-access__selectall`,children:[(0,Q.jsx)(K,{checked:v===`all`?!0:v===`some`?`indeterminate`:!1,onCheckedChange:()=>void x(),"aria-label":L()}),(0,Q.jsx)(`span`,{className:`oc-access__label`,children:L()})]}):null,y.pageItems.map(e=>{let n=`${t}/${e.agentId}`,i=r.has(n),a=e.presentInLastOk===!1;return(0,Q.jsxs)(`div`,{className:`oc-access__row`,children:[(0,Q.jsx)(K,{checked:i,disabled:a&&!i,onCheckedChange:()=>void b(e.agentId,i),"aria-label":re({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":k(),title:k(),children:(0,Q.jsx)(J,{size:14,fill:`currentColor`})}):null,a?(0,Q.jsx)(W,{variant:`outline`,className:`oc-access__gone`,children:m()}):null]},e.agentId)}),(0,Q.jsx)(st,{page:y.page,pageCount:y.pageCount,onPage:d})]})]})}function ut({groupId:e}){let t=F(I.charts.listGroupChartSelection,e?{groupId:e}:`skip`),n=z(I.charts.assignChartToGroup),r=z(I.charts.removeChartFromGroup),i=z(I.charts.setGroupDefaultChart),a=z(I.charts.addChartToGroupPool),o=z(I.charts.removeChartFromGroupPool),s=U();if(!e)return null;if(t===void 0)return(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:j()});let{pool:c,addable:l,canManagePool:u}=t;if(c.length===0&&!u)return(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:Ae()});async function d(t,i){try{i?await r({groupId:e,chartKey:t}):await n({groupId:e,chartKey:t})}catch(e){s.error(S(),e)}}async function p(t){try{await i({groupId:e,chartKey:t})}catch(e){s.error(S(),e)}}async function m(t){try{await a({groupId:e,chartKey:t})}catch(e){s.error(S(),e)}}async function g(t){try{await o({groupId:e,chartKey:t})}catch(e){s.error(S(),e)}}return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`div`,{className:`oc-access__list`,children:c.map(e=>(0,Q.jsxs)(`div`,{className:`oc-access__row`,children:[(0,Q.jsx)(K,{checked:e.selected,onCheckedChange:()=>void d(e.chartKey,e.selected),"aria-label":f({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":w(),title:w(),children:(0,Q.jsx)(J,{size:14,fill:`currentColor`})}):(0,Q.jsx)(H,{type:`button`,variant:`ghost`,size:`sm`,onClick:()=>void p(e.chartKey),children:x()}):null,u?(0,Q.jsx)(H,{type:`button`,variant:`ghost`,size:`sm`,"aria-label":h({name:e.name}),title:h({name:e.name}),onClick:()=>void g(e.chartKey),children:(0,Q.jsx)(je,{size:14,"aria-hidden":!0})}):null]},e.chartKey))}),u?l.length>0?(0,Q.jsxs)(qe,{value:``,onValueChange:e=>void m(e),children:[(0,Q.jsx)(Re,{size:`sm`,className:`oc-access__search`,children:(0,Q.jsx)(Ie,{placeholder:v()})}),(0,Q.jsx)(ze,{children:l.map(e=>(0,Q.jsx)(Ke,{value:e.chartKey,children:e.name},e.chartKey))})]}):c.length===0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:E()}):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{$g as r,$h as i,Ag as a,Bg as o,C_ as s,Cg as c,D_ as l,Dg as u,E_ as d,Eg as f,Fg as p,Gg as m,Gh as h,Hg as g,Ig as _,Jg as v,Jh as y,Kg as b,Kh as x,L as S,Lg as ee,Mg as C,Ng as te,O_ as ne,Og as w,Pg as re,Qg as T,Qh as ie,R as E,Rd as ae,Rg as oe,S_ as se,Sg as ce,T_ as le,Tg as ue,Ug as de,Uh as fe,Vg as pe,Wg as me,Wh as D,Xg as he,Xh as ge,Yg as _e,Yh as ve,Zg as ye,Zh as be,__ as xe,_g as Se,a_ as Ce,ag as we,b_ as Te,bg as Ee,cO as O,c_ as De,cg as Oe,dC as k,dO as A,d_ as ke,dg as Ae,e_ as je,eg as Me,fC as j,f_ as Ne,fg as Pe,g_ as Fe,gg as Ie,h_ as Le,hg as Re,iO as M,i_ as ze,ig as Be,jg as Ve,k_ as He,kg as Ue,l_ as We,lg as Ge,m_ as Ke,mg as qe,n_ as Je,ng as Ye,o_ as Xe,og as Ze,p_ as Qe,pg as $e,qg as et,qh as tt,r_ as nt,rg as rt,s_ as it,sg as at,t_ as ot,tg as st,uO as N,u_ as ct,ug as P,v_ as lt,vg as ut,w_ as dt,wg as ft,x_ as pt,xg as mt,y_ as ht,yg as gt,zd as _t,zg as vt}from"./dist-B-U7A_Kp.js";import{a as yt,c as bt}from"./FieldLabel-DG-U2yJD.js";import{t as F}from"./button-CoB18od4.js";import{$ as I,A as L,C as R,H as xt,Q as z,S as B,U as St,V as Ct,X as V,Z as H,_ as U,b as W,et as G,j as wt,m as Tt,nt as K,rt as q,x as J,y as Et}from"./index-B6IXWbc8.js";import{t as Dt}from"./DataTableShell-DRaoMzdi.js";import{InstanceConfigDialog as Ot}from"./BridgeTab-wIiXQVx4.js";var Y=t(e(),1),X=[`conversational`,`documentary`,`summarizer`],kt=new Set(X),At=`conversational`;function jt(e){let t=new Set((e??[]).filter(e=>kt.has(e)));return t.size===0?[At]:X.filter(e=>t.has(e))}var Z=n(),Q={name:``,gatewayUrl:``,bridgeUrl:``,displayName:``,kind:`openclaw`,gatewayVersion:``,gatewayHttpUrl:``,streamTransport:yt},Mt={openclaw:[`token`,`deviceIdentity`],hermes:[`apiKey`]};function Nt(e){return{name:e.name,gatewayUrl:e.gatewayUrl,bridgeUrl:e.bridgeUrl??``,displayName:e.displayName??``,kind:e.kind??`openclaw`,gatewayVersion:e.gatewayVersion??``,gatewayHttpUrl:e.gatewayHttpUrl??``,streamTransport:e.streamTransport??`reactive`}}function Pt(){let e=A(M.admin.listInstances,{}),t=A(M.agents.listAllInstanceAgents,{}),n=N(M.admin.upsertInstance),i=N(M.admin.deleteInstance),a=L(),[o,c]=(0,Y.useState)(!1),[u,f]=(0,Y.useState)(Q),[p,m]=(0,Y.useState)(null),[h,g]=(0,Y.useState)(null),[_,v]=(0,Y.useState)(null),[y,b]=(0,Y.useState)(null);async function x(){try{await n({instanceId:y??void 0,name:u.name,gatewayUrl:u.gatewayUrl,bridgeUrl:u.bridgeUrl||void 0,displayName:u.displayName||void 0,kind:u.kind,gatewayVersion:u.gatewayVersion||void 0,gatewayHttpUrl:u.gatewayHttpUrl||void 0,streamTransport:u.streamTransport}),f(Q),b(null),c(!1)}catch(e){a.error(l(),e)}}return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`p`,{className:`oc-admin__hint`,children:[d(),(0,Z.jsx)(`strong`,{children:le()}),dt()]}),(0,Z.jsx)(Dt,{title:s(),rows:e,addLabel:se(),onAdd:()=>{b(null),f(Q),c(!0)},emptyHint:pt(),columns:[{header:Te(),cell:e=>e.name,sort:e=>e.name},{header:ht(),cell:e=>(0,Z.jsx)(V,{variant:`outline`,children:e.kind??`openclaw`}),sort:e=>e.kind??`openclaw`},{header:lt(),cell:e=>e.gatewayUrl,sort:e=>e.gatewayUrl},{header:xe(),cell:e=>e.displayName??`—`,sort:e=>e.displayName??null},{header:He(),cell:e=>{let n=(t?.[e.name]??[]).filter(e=>e.presentInLastOk!==!1&&e.enabled);if(n.length===0)return(0,Z.jsx)(`span`,{className:`text-muted-foreground`,children:`—`});let r=t=>e.defaultAgentId===t;return(0,Z.jsx)(`div`,{className:`flex flex-wrap gap-1`,children:[...n].sort((e,t)=>Number(r(t.agentId))-Number(r(e.agentId))).map(e=>(0,Z.jsxs)(V,{variant:r(e.agentId)?`default`:`outline`,title:r(e.agentId)?D():void 0,children:[e.emoji?`${e.emoji} `:``,e.displayName??e.agentId]},e.agentId))})}}],rowActions:e=>[{label:Qe(),onSelect:()=>{b(e._id),f(Nt(e)),c(!0)}},{label:ne(),onSelect:()=>m(e.name)},{label:T(),onSelect:()=>v(e)},{label:Fe(),onSelect:()=>g(e)},{label:Le(),variant:`destructive`,onSelect:()=>void i({instanceId:e._id})}],bulkActions:[{label:Le(),variant:`destructive`,onSelect:e=>e.forEach(e=>void i({instanceId:e}))}]}),(0,Z.jsx)(Tt,{open:o,onOpenChange:c,title:y?Ne():Ke(),description:ct(),canSubmit:!!(u.name&&u.gatewayUrl),onSubmit:x,submitLabel:We(),children:(0,Z.jsxs)(`div`,{className:`oc-form`,children:[(0,Z.jsxs)($,{label:De(),children:[(0,Z.jsx)(H,{value:u.name,disabled:y!==null,onChange:e=>f({...u,name:e.target.value})}),y?(0,Z.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:ke()}):null]}),(0,Z.jsx)($,{label:it(),children:(0,Z.jsxs)(Et,{value:u.kind,onValueChange:e=>f({...u,kind:e}),children:[(0,Z.jsx)(B,{size:`sm`,className:`w-40`,children:(0,Z.jsx)(R,{})}),(0,Z.jsxs)(W,{children:[(0,Z.jsx)(J,{value:`openclaw`,children:`OpenClaw`}),(0,Z.jsx)(J,{value:`hermes`,children:`Hermes`})]})]})}),(0,Z.jsx)($,{label:Xe(),children:(0,Z.jsx)(H,{value:u.gatewayUrl,onChange:e=>f({...u,gatewayUrl:e.target.value})})}),(0,Z.jsx)($,{label:Ce(),children:(0,Z.jsx)(H,{value:u.bridgeUrl,placeholder:ze(),onChange:e=>f({...u,bridgeUrl:e.target.value})})}),(0,Z.jsx)($,{label:nt(),children:(0,Z.jsx)(H,{value:u.displayName,onChange:e=>f({...u,displayName:e.target.value})})}),(0,Z.jsxs)($,{label:_t(),children:[(0,Z.jsxs)(Et,{value:u.streamTransport,onValueChange:e=>f({...u,streamTransport:e}),children:[(0,Z.jsx)(B,{size:`sm`,className:`w-40`,children:(0,Z.jsx)(R,{})}),(0,Z.jsx)(W,{children:bt.map(e=>(0,Z.jsx)(J,{value:e,children:e},e))})]}),(0,Z.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:ae()})]}),(0,Z.jsx)($,{label:Je(),children:(0,Z.jsx)(H,{value:u.gatewayVersion,placeholder:ot(),onChange:e=>f({...u,gatewayVersion:e.target.value})})}),(0,Z.jsx)($,{label:je(),children:(0,Z.jsx)(H,{value:u.gatewayHttpUrl,placeholder:r(),onChange:e=>f({...u,gatewayHttpUrl:e.target.value})})})]})}),(0,Z.jsx)(Wt,{instanceName:p,open:p!==null,onOpenChange:e=>{e||m(null)}}),h?(0,Z.jsx)(Ot,{instance:h,onClose:()=>g(null)},h._id):null,_?(0,Z.jsx)(Ft,{instance:_,onClose:()=>v(null)},_._id):null]})}function Ft({instance:e,onClose:t}){let n=A(M.instanceSecrets.listInstanceSecretStatus,{}),r=Mt[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)(z,{open:!0,onOpenChange:e=>!e&&t(),children:(0,Z.jsxs)(I,{onOpenAutoFocus:e=>e.preventDefault(),children:[(0,Z.jsxs)(K,{children:[(0,Z.jsx)(q,{children:ye({instance:e.displayName??e.name})}),(0,Z.jsx)(G,{children:he()})]}),(0,Z.jsx)(`div`,{className:`oc-form`,children:r.map(t=>(0,Z.jsx)(Rt,{instanceId:e._id,field:t,updatedAt:i[t]??null},t))}),(0,Z.jsx)(`div`,{className:`oc-bridgesecret`,children:(0,Z.jsx)(Lt,{instance:e})}),(0,Z.jsx)(It,{instance:e})]})})}function It({instance:e}){let t=O(M.instanceSync.forceInstanceSync),n=L(),[r,i]=(0,Y.useState)(!1);async function o(){if(!r){i(!0);try{switch((await t({instanceId:e._id})).status){case`synced`:n.success(a());break;case`no_agents`:n.success(w());break;case`no_bridge_url`:n.error(u());break;case`deploy_misconfigured`:n.error(f());break;case`unauthorized`:n.error(ft());break;case`not_served`:n.error(c());break;default:n.error(ue());break}}catch(e){n.error(Ue(),e)}finally{i(!1)}}}return(0,Z.jsxs)(`div`,{className:`oc-form`,children:[(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:ce()}),(0,Z.jsx)(`div`,{className:`flex items-center gap-2`,children:(0,Z.jsx)(F,{size:`sm`,variant:`outline`,onClick:()=>void o(),disabled:r,children:r?Ve():C()})})]})}function Lt({instance:e}){let t=A(M.bridgeAuth.listBridgeAuthStatus,{}),n=O(M.bridgeAuth.mintBridgeSecret),r=N(M.bridgeAuth.revokeBridgeSecret),i=L(),[a,o]=(0,Y.useState)(!1),[s,c]=(0,Y.useState)(null),[l,u]=(0,Y.useState)(!1),d=(t??[]).find(t=>t.instanceId===e._id),f=d!==void 0;async function p(){if(!a){o(!0);try{c((await n({instanceId:e._id})).plaintext),u(!1)}catch(e){i.error(Re(),e)}finally{o(!1)}}}async function h(){if(!a){o(!0);try{await r({instanceId:e._id}),c(null),i.success(Ie())}catch(e){i.error(Re(),e)}finally{o(!1)}}}async function g(){if(s)try{await navigator.clipboard.writeText(s),u(!0)}catch{}}return(0,Z.jsxs)($,{label:mt(),children:[(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:Ee()}),(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Z.jsx)(V,{variant:f?`outline`:`secondary`,children:f?`${b()} · ${d.prefix}…${d.lastFour}`:m()}),(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(F,{size:`sm`,onClick:()=>void p(),disabled:a,children:f?ut():gt()}),f?(0,Z.jsx)(F,{size:`sm`,variant:`destructive`,onClick:()=>void h(),disabled:a,children:Se()}):null]})]}),s?(0,Z.jsxs)(`div`,{className:`oc-bridgesecret__reveal`,children:[(0,Z.jsx)(`p`,{className:`oc-sa__minted-warning`,children:qe()}),(0,Z.jsxs)(`div`,{className:`oc-sa__minted-box`,children:[(0,Z.jsx)(`code`,{className:`oc-sa__minted-plain`,children:s}),(0,Z.jsx)(F,{variant:`outline`,size:`sm`,onClick:()=>void g(),children:l?j():k()})]}),(0,Z.jsx)(F,{size:`sm`,variant:`ghost`,onClick:()=>{c(null),u(!1)},children:$e()})]}):null]})}function Rt({instanceId:e,field:t,updatedAt:n}){let r=O(M.instanceSecrets.setInstanceSecret),i=N(M.instanceSecrets.clearInstanceSecret),a=O(M.deviceIdentity.generateDeviceIdentity),s=L(),[c,l]=(0,Y.useState)(``),[u,d]=(0,Y.useState)(!1),[f,h]=(0,Y.useState)(null),[y,x]=(0,Y.useState)(!1),S=n!==null,C=t===`deviceIdentity`,ne=t===`token`?_e():t===`deviceIdentity`?v():et();async function w(){if(!(!c.trim()||u)){d(!0);try{await r({instanceId:e,field:t,plaintext:c}),l(``),h(null),x(!1),s.success(o())}catch(e){s.error(vt(),e)}finally{d(!1)}}}async function T(){if(!u){d(!0);try{await i({instanceId:e,field:t}),h(null),x(!1),s.success(oe())}catch(e){s.error(vt(),e)}finally{d(!1)}}}async function ie(){if(!u){d(!0);try{h(await a({instanceId:e})),x(!1),s.success(p())}catch(e){s.error(te(),e)}finally{d(!1)}}}let E=f?`openclaw devices approve ${f.id}`:``;async function ae(){if(E)try{await navigator.clipboard.writeText(E),x(!0)}catch{}}return(0,Z.jsxs)($,{label:ne,children:[C?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:_()}):null,(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Z.jsx)(V,{variant:S?`outline`:`secondary`,children:S?b():m()}),(0,Z.jsx)(H,{type:`password`,autoComplete:`off`,className:`flex-1 min-w-32`,value:c,placeholder:S?de():me(),onChange:e=>l(e.target.value)}),(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(F,{size:`sm`,onClick:()=>void w(),disabled:u||c.trim().length===0,children:g()}),C?(0,Z.jsx)(F,{size:`sm`,variant:`outline`,onClick:()=>void ie(),disabled:u,children:ee()}):null,S?(0,Z.jsx)(F,{size:`sm`,variant:`destructive`,onClick:()=>void T(),disabled:u,children:pe()}):null]})]}),f?(0,Z.jsxs)(`div`,{className:`oc-bridgesecret__reveal`,children:[(0,Z.jsx)(`p`,{className:`text-sm font-medium`,children:p()}),(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:re()}),(0,Z.jsxs)(`div`,{className:`oc-sa__minted-box`,children:[(0,Z.jsx)(`code`,{className:`oc-sa__minted-plain`,children:E}),(0,Z.jsx)(F,{variant:`outline`,size:`sm`,onClick:()=>void ae(),children:y?j():k()})]}),(0,Z.jsx)(F,{size:`sm`,variant:`ghost`,onClick:()=>{h(null),x(!1)},children:$e()})]}):null]})}var zt={conversational:we,documentary:rt,summarizer:E},Bt={conversational:Be,documentary:Ye,summarizer:S},Vt=e=>(zt[e]??(()=>e))(),Ht=e=>(Bt[e]??(()=>``))();function Ut({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:Ge()}),t.map(e=>(0,Z.jsx)(V,{variant:`secondary`,className:`oc-agenttype__chip`,title:Ht(e),children:Vt(e)},e)),(0,Z.jsxs)(Ct,{children:[(0,Z.jsx)(St,{asChild:!0,children:(0,Z.jsx)(F,{type:`button`,variant:`outline`,size:`sm`,className:`h-7`,children:Oe()})}),(0,Z.jsxs)(xt,{align:`start`,className:`oc-agenttypes-pop`,children:[(0,Z.jsx)(`p`,{className:`oc-agenttypes-pop__title`,children:at()}),(0,Z.jsx)(`p`,{className:`oc-agenttypes-pop__hint`,children:Ze()}),(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:Vt(r)}),(0,Z.jsx)(`span`,{className:`oc-agenttypes-pop__desc`,children:Ht(r)})]})]},r)})})]})]})]})}function Wt({instanceName:e,open:t,onOpenChange:n}){let r=A(M.agents.listAgentsForInstance,t&&e?{instanceName:e}:`skip`),a=N(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=N(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=N(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=jt(r);e.setQuery(M.agents.listAgentsForInstance,{instanceName:t},{...i,agents:i.agents.map(e=>e.agentId===n?{...e,types:a}:e)})}),c=N(M.agents.removeInstanceAgent),l=wt(),u=L();async function d(t,n){if(e)try{await a({instanceName:e,agentId:t,enabled:n})}catch(e){u.error(P(),e)}}async function f(t){if(e)try{await o({instanceName:e,agentId:t})}catch(e){u.error(P(),e)}}async function p(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){u.error(P(),e)}}async function m(t,n){if(e&&await l({title:i({name:n}),description:ie(),confirmLabel:be(),destructive:!0}))try{await c({instanceName:e,agentId:t}),u.success(ge())}catch(e){u.error(P(),e)}}return(0,Z.jsx)(z,{open:t,onOpenChange:n,children:(0,Z.jsxs)(I,{className:`oc-access`,children:[(0,Z.jsxs)(K,{children:[(0,Z.jsx)(q,{children:Pe({name:e??``})}),(0,Z.jsx)(G,{children:Ae()})]}),r===void 0?(0,Z.jsx)(`p`,{className:`oc-access__hint`,children:ve()}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`div`,{className:`oc-access__poll`,children:r.discovery===null?y():r.discovery.lastPollOk?tt():x({error:r.discovery.error??`?`})}),r.agents.length===0?(0,Z.jsx)(`p`,{className:`oc-access__hint`,children:h()}):(0,Z.jsx)(`div`,{className:`oc-access__list`,children:r.agents.map(e=>{let t=e.presentInLastOk===!1,n=r.defaultAgentId===e.agentId,i=e.displayName??e.agentId,a=e.types??[];return(0,Z.jsxs)(`div`,{className:`oc-agentcard`+(e.enabled?``:` oc-agentcard--off`),children:[(0,Z.jsxs)(`div`,{className:`oc-agentcard__head`,children:[(0,Z.jsx)(U,{checked:e.enabled,disabled:t,"aria-label":i,onCheckedChange:t=>void d(e.agentId,t===!0)}),(0,Z.jsxs)(`span`,{className:`oc-agentcard__name`,title:i,children:[e.emoji?`${e.emoji} `:``,i]}),e.model?(0,Z.jsx)(`span`,{className:`oc-access__model`,children:e.model}):null,t?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(V,{variant:`outline`,className:`oc-access__gone`,children:fe()}),(0,Z.jsx)(F,{size:`sm`,variant:`ghost`,className:`h-7 text-destructive`,onClick:()=>void m(e.agentId,i),children:Me()})]}):n?(0,Z.jsx)(V,{variant:`default`,children:D()}):(0,Z.jsx)(F,{size:`sm`,variant:`outline`,className:`h-7`,disabled:!e.enabled,onClick:()=>void f(e.agentId),children:st()})]}),e.enabled?(0,Z.jsx)(Ut,{agentId:e.agentId,types:a,onToggle:t=>void p(e.agentId,t,a)}):null]},e.agentId)})})]})]})})}function $({label:e,children:t}){return(0,Z.jsxs)(`label`,{className:`oc-field`,children:[(0,Z.jsx)(`span`,{className:`oc-field__label`,children:e}),t]})}export{Pt as InstancesTab};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$t as r,Ay as i,By as a,Cy as o,Dy as s,Ey as c,Fy as l,Gy as u,Hy as ee,Iy as te,Jy as ne,Ky as d,Ly as f,My as p,Ny as re,Oy as ie,Py as m,Qt as h,Ry as g,Sy as _,Ty as ae,Uy as oe,Vy as se,Wy as v,Xy as ce,Yy as le,Zt as y,Zy as b,_y as x,an as S,ay as C,by as w,cO as T,cy as E,dO as D,dy as O,en as k,fy as A,gy as j,hy as M,iO as N,in as P,jy as F,ky as I,ly as L,my as R,nn as z,oy as B,py as V,qy as H,rn as U,sy as ue,tn as de,uO as W,uy as fe,vy as pe,wy as me,xy as he,yy as ge,zy as _e}from"./dist-B-U7A_Kp.js";import{t as G}from"./button-CoB18od4.js";import{C as ve,S as ye,X as K,Z as q,_ as be,b as xe,x as Se,y as Ce}from"./index-B6IXWbc8.js";import{t as we}from"./DataTableShell-DRaoMzdi.js";var J=t(e(),1),Y=n();function Te(){let e=D(N.integrations.status.status,{}),t=W(N.admin.setIntegrationConfig),[n,r]=(0,J.useState)(null);if((0,J.useEffect)(()=>{e&&n===null&&r(e.config)},[e,n]),!e||!n)return(0,Y.jsx)(`p`,{className:`oc-admin__hint`,children:b()});let h=n,y=(e,t,n)=>r({...h,[e]:{...h[e],[t]:n}}),T=(e,n)=>void t({[e]:n});return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(`p`,{className:`oc-admin__hint`,children:[ce(),` `,(0,Y.jsx)(`strong`,{children:le()}),` `,ne()]}),(0,Y.jsxs)(X,{title:`Langfuse`,status:e.langfuse.configured?e.langfuse.enabled?(0,Y.jsx)(K,{variant:`secondary`,children:H()}):(0,Y.jsx)(K,{variant:`outline`,children:d()}):(0,Y.jsx)(K,{variant:`outline`,children:u()}),note:oe(),children:[(0,Y.jsx)(Z,{label:se(),children:(0,Y.jsx)(q,{value:h.langfuse.host??``,placeholder:e.langfuse.effectiveHost,onChange:e=>y(`langfuse`,`host`,e.target.value),onBlur:()=>T(`langfuse`,{host:h.langfuse.host??``})})}),(0,Y.jsx)(Q,{label:f(),checked:h.langfuse.enabled??!0,onChange:e=>{y(`langfuse`,`enabled`,e),T(`langfuse`,{enabled:e})}})]}),(0,Y.jsxs)(X,{title:`Opik`,status:e.opik.configured?e.opik.enabled?(0,Y.jsx)(K,{variant:`secondary`,children:H()}):(0,Y.jsx)(K,{variant:`outline`,children:d()}):(0,Y.jsx)(K,{variant:`outline`,children:u()}),note:ee(),children:[(0,Y.jsx)(Z,{label:a(),children:(0,Y.jsx)(q,{value:h.opik.baseUrl??``,placeholder:e.opik.effectiveBaseUrl,onChange:e=>y(`opik`,`baseUrl`,e.target.value),onBlur:()=>T(`opik`,{baseUrl:h.opik.baseUrl??``})})}),(0,Y.jsx)(Z,{label:_e(),children:(0,Y.jsx)(q,{value:h.opik.workspace??``,placeholder:e.opik.effectiveWorkspace||g(),onChange:e=>y(`opik`,`workspace`,e.target.value),onBlur:()=>T(`opik`,{workspace:h.opik.workspace??``})})}),(0,Y.jsx)(Q,{label:f(),checked:h.opik.enabled??!0,onChange:e=>{y(`opik`,`enabled`,e),T(`opik`,{enabled:e})}})]}),(0,Y.jsxs)(X,{title:`OpenTelemetry (OTLP)`,status:e.otlp.configured?e.otlp.enabled?(0,Y.jsx)(K,{variant:`secondary`,children:H()}):(0,Y.jsx)(K,{variant:`outline`,children:d()}):(0,Y.jsx)(K,{variant:`outline`,children:S()}),note:P(),children:[(0,Y.jsx)(Z,{label:U(),children:(0,Y.jsx)(q,{value:h.otlp.endpoint??``,placeholder:e.otlp.effectiveEndpoint||`https://otlp.example.com/v1/traces`,onChange:e=>y(`otlp`,`endpoint`,e.target.value),onBlur:()=>T(`otlp`,{endpoint:h.otlp.endpoint??``})})}),(0,Y.jsx)(Ee,{headersSet:e.otlp.headersSet}),(0,Y.jsx)(Q,{label:f(),checked:h.otlp.enabled??!0,onChange:e=>{y(`otlp`,`enabled`,e),T(`otlp`,{enabled:e})}})]}),(0,Y.jsxs)(X,{title:te(),status:(0,Y.jsx)(K,{variant:`outline`,children:v()}),note:l(),children:[(0,Y.jsx)(Z,{label:m(),children:(0,Y.jsx)($,{value:h.tts.auto??`off`,options:[[`off`,re()],[`always`,p()],[`inbound`,F()],[`tagged`,i()]],onChange:e=>{y(`tts`,`auto`,e),T(`tts`,{auto:e})}})}),(0,Y.jsx)(Z,{label:I(),children:(0,Y.jsx)($,{value:h.tts.provider??`openai`,options:[[`openai`,`OpenAI`],[`elevenlabs`,`ElevenLabs`],[`microsoft`,ie()],[`azure`,`Azure Speech`],[`google`,`Google Gemini`]],onChange:e=>{y(`tts`,`provider`,e),T(`tts`,{provider:e})}})}),(0,Y.jsx)(Z,{label:s(),children:(0,Y.jsx)(q,{value:h.tts.model??``,placeholder:`eleven_multilingual_v2`,onChange:e=>y(`tts`,`model`,e.target.value),onBlur:()=>T(`tts`,{model:h.tts.model??``})})}),(0,Y.jsx)(Z,{label:c(),children:(0,Y.jsx)(q,{value:h.tts.voice??``,placeholder:ae(),onChange:e=>y(`tts`,`voice`,e.target.value),onBlur:()=>T(`tts`,{voice:h.tts.voice??``})})})]}),(0,Y.jsxs)(X,{title:me(),status:(0,Y.jsx)(K,{variant:`outline`,children:v()}),note:e.secrets.openai?o():_(),children:[(0,Y.jsx)(Q,{label:he(),checked:h.talk.enabled??!1,onChange:e=>{y(`talk`,`enabled`,e),T(`talk`,{enabled:e})}}),(0,Y.jsx)(Z,{label:w(),children:(0,Y.jsx)($,{value:h.talk.realtimeProvider??`openai`,options:[[`openai`,`OpenAI (gpt-realtime)`],[`google`,`Google`]],onChange:e=>{y(`talk`,`realtimeProvider`,e),T(`talk`,{realtimeProvider:e})}})}),(0,Y.jsx)(Z,{label:ge(),children:(0,Y.jsx)(q,{value:h.talk.realtimeModel??``,placeholder:`gpt-realtime-2`,onChange:e=>y(`talk`,`realtimeModel`,e.target.value),onBlur:()=>T(`talk`,{realtimeModel:h.talk.realtimeModel??``})})}),(0,Y.jsx)(Z,{label:c(),children:(0,Y.jsx)(q,{value:h.talk.voice??``,placeholder:`cedar / marin`,onChange:e=>y(`talk`,`voice`,e.target.value),onBlur:()=>T(`talk`,{voice:h.talk.voice??``})})}),(0,Y.jsx)(Z,{label:pe(),children:(0,Y.jsx)($,{value:h.talk.transport??`webrtc`,options:[[`webrtc`,x()],[`provider-websocket`,`Provider WebSocket`],[`gateway-relay`,`Gateway relay`]],onChange:e=>{y(`talk`,`transport`,e),T(`talk`,{transport:e})}})}),(0,Y.jsx)(Z,{label:j(),children:(0,Y.jsx)(q,{value:h.talk.speechLocale??``,placeholder:`fr-CA`,onChange:e=>y(`talk`,`speechLocale`,e.target.value),onBlur:()=>T(`talk`,{speechLocale:h.talk.speechLocale??``})})}),(0,Y.jsx)(Q,{label:M(),checked:h.talk.interruptOnSpeech??!0,onChange:e=>{y(`talk`,`interruptOnSpeech`,e),T(`talk`,{interruptOnSpeech:e})}})]}),(0,Y.jsxs)(`section`,{className:`oc-int__section`,children:[(0,Y.jsxs)(`div`,{className:`oc-int__section-head`,children:[(0,Y.jsx)(`h3`,{className:`oc-uipa__h`,children:R()}),(0,Y.jsx)(K,{variant:`outline`,children:V()})]}),(0,Y.jsxs)(`p`,{className:`oc-uipa__note`,children:[A(),(0,Y.jsx)(`code`,{children:` voicewake.get/set`}),`.`]})]}),(0,Y.jsx)(we,{title:O(),rows:e.cursors.map(e=>({...e,_id:e.vendor})),emptyHint:fe(),columns:[{header:L(),cell:e=>(0,Y.jsx)(K,{variant:`secondary`,children:e.vendor}),sort:e=>e.vendor},{header:E(),cell:e=>e.lastAt>0?new Date(e.lastAt).toLocaleString(`fr-FR`):`—`,sort:e=>e.lastAt>0?e.lastAt:null},{header:ue(),cell:e=>String(e.failureCount),sort:e=>e.failureCount},{header:B(),cell:e=>e.lastErrorStatus??`—`,sort:e=>e.lastErrorStatus??null},{header:C(),cell:e=>e.lastError??`—`,sort:e=>e.lastError??null}]})]})}function X({title:e,status:t,note:n,children:r}){return(0,Y.jsxs)(`section`,{className:`oc-int__section`,children:[(0,Y.jsxs)(`div`,{className:`oc-int__section-head`,children:[(0,Y.jsx)(`h3`,{className:`oc-uipa__h`,children:e}),t]}),n?(0,Y.jsx)(`p`,{className:`oc-uipa__note`,children:n}):null,(0,Y.jsx)(`div`,{className:`oc-int__fields`,children:r})]})}function Z({label:e,children:t}){return(0,Y.jsxs)(`label`,{className:`oc-int__field`,children:[(0,Y.jsx)(`span`,{className:`oc-int__field-label`,children:e}),t]})}function Q({label:e,checked:t,onChange:n}){return(0,Y.jsxs)(`label`,{className:`oc-int__toggle`,children:[(0,Y.jsx)(be,{checked:t,onCheckedChange:e=>n(e===!0)}),(0,Y.jsx)(`span`,{children:e})]})}function $({value:e,options:t,onChange:n}){return(0,Y.jsxs)(Ce,{value:e,onValueChange:n,children:[(0,Y.jsx)(ye,{size:`sm`,className:`w-full`,children:(0,Y.jsx)(ve,{})}),(0,Y.jsx)(xe,{children:t.map(([e,t])=>(0,Y.jsx)(Se,{value:e,children:t},e))})]})}function Ee({headersSet:e}){let t=T(N.integrations.otlpSecret.setOtlpHeaders),n=W(N.integrations.otlpSecret.clearOtlpHeaders),[i,a]=(0,J.useState)(``),[o,s]=(0,J.useState)(null),[c,l]=(0,J.useState)(!1),u=async()=>{l(!0),s(null);try{await t({headersJson:i}),a(``)}catch(e){s(e instanceof Error?e.message:String(e))}finally{l(!1)}};return(0,Y.jsxs)(Z,{label:z(),children:[(0,Y.jsx)(q,{value:i,placeholder:e?de():k(),onChange:e=>a(e.target.value)}),(0,Y.jsxs)(`div`,{className:`oc-int__otlp-headers-actions`,children:[(0,Y.jsx)(G,{size:`sm`,disabled:c||i.trim().length===0,onClick:()=>void u(),children:r()}),e?(0,Y.jsx)(G,{variant:`ghost`,size:`sm`,disabled:c,onClick:()=>void n({}),children:h()}):null]}),o?(0,Y.jsx)(`p`,{className:`oc-int__otlp-headers-error`,children:o}):null,(0,Y.jsx)(`p`,{className:`oc-uipa__note`,children:y()})]})}export{Te as IntegrationsTab};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$l as r,Ab as i,Mb as a,Sb as o,au as s,cu as c,dO as l,du as u,eu as d,fu as f,iO as p,iu as m,jb as h,kb as g,lu as _,nu as v,ou as y,ru as b,rx as x,su as S,tu as C,uu as w,xb as T}from"./dist-B-U7A_Kp.js";import{Mt as E,a as ee,jt as te,n as ne,ot as re,r as D}from"./index-B6IXWbc8.js";import{a as O,n as k,o as A,r as j,t as M}from"./card-4N7N5yEr.js";import{n as N,t as P}from"./TimeRangePicker-CAhWZBEI.js";var F=t(e(),1),I=n(),L=15,R=e=>String(Math.round(e));function z(){let e=l(p.me.getMe,{host:re})?.permissions?.includes(`traces.read`)??!1,t=l(p.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:x()}),(0,I.jsxs)(M,{children:[(0,I.jsxs)(O,{children:[(0,I.jsx)(A,{children:a()}),(0,I.jsx)(j,{children:i()})]}),(0,I.jsx)(k,{children:n.length<2?(0,I.jsx)(`p`,{className:`oc-admin__hint`,children:g()}):(0,I.jsx)(B,{series:n})})]})]})}function B({series:e}){let t=e.map(e=>e.cP50),n=e.map(e=>e.aP50),r=Math.max(1,...t,...n),i=t=>6+t*468/(e.length-1),s=e=>74-e*68/r,c=e=>e.map((e,t)=>`${t===0?`M`:`L`}${i(t).toFixed(1)},${s(e).toFixed(1)}`).join(` `),l=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:[T(),` p50 `,R(l.cP50),` `,h()]}),(0,I.jsxs)(`span`,{children:[o(),` p50 `,R(l.aP50),` `,h()]})]}),(0,I.jsxs)(`svg`,{viewBox:`0 0 480 80`,className:`h-20 w-full`,preserveAspectRatio:`none`,role:`img`,"aria-label":a(),children:[(0,I.jsx)(`path`,{d:c(n),fill:`none`,style:{stroke:`var(--muted-foreground)`},strokeWidth:1.5}),(0,I.jsx)(`path`,{d:c(t),fill:`none`,style:{stroke:`var(--primary)`},strokeWidth:1.5})]})]})}var V=[{metric:`api.calls`,label:f(),unit:`/h`,group:`API`,isError:!1},{metric:`api.errors`,label:u(),unit:`/h`,group:`API`,isError:!0},{metric:`api.latency.avg_ms`,label:w(),unit:`ms`,group:`API`,isError:!1},{metric:`openclaw.ingest`,label:_(),unit:`/h`,group:`OpenClaw`,isError:!1},{metric:`chat.send`,label:c(),unit:`/h`,group:`Chat`,isError:!1},{metric:`assistant.stream.errors`,label:S(),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=E({from:`/settings/kpi`}),t=te({from:`/settings/kpi`}),n=D(e.from,e.to,ne,`now`),r=e=>void t({search:t=>({...t,...ee(e)})}),{from:i,to:a}=N(n),{rowLimit:o,buckets:c}=K(i,a),u=l(p.kpi.listKpis,{limit:o,filter:{from:i,to:a}}),d=(0,F.useMemo)(()=>{let e=new Map;for(let t of u??[]){let n=e.get(t.metric)??[];n.push({bucket:t.bucket,value:t.value}),e.set(t.metric,n)}for(let[t,n]of e)n.sort((e,t)=>e.bucket<t.bucket?-1:+(e.bucket>t.bucket)),n.length>c&&e.set(t,n.slice(n.length-c));return e},[u,c]),f=(0,I.jsxs)(I.Fragment,{children:[(0,I.jsxs)(`p`,{className:`oc-admin__hint`,children:[y(),` `,(0,I.jsx)(`span`,{className:`oc-filter__window`,children:s()})]}),(0,I.jsx)(J,{value:n,onChange:r})]});return u===void 0?(0,I.jsxs)(I.Fragment,{children:[f,(0,I.jsx)(z,{}),(0,I.jsx)(`p`,{className:`oc-admin__hint`,children:m()})]}):u.length===0?(0,I.jsxs)(I.Fragment,{children:[f,(0,I.jsx)(z,{}),(0,I.jsx)(`p`,{className:`oc-admin__hint`,children:b()})]}):(0,I.jsxs)(I.Fragment,{children:[f,(0,I.jsx)(z,{}),U.map(e=>{let t=V.filter(t=>t.group===e);return t.some(e=>(d.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:d.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:v({value:$(n.bucket)})}):(0,I.jsx)(`span`,{className:`oc-kpi__muted`,children:C()}),(0,I.jsx)(`span`,{className:`oc-kpi__muted`,children:d({count:t.length})})]})]})]})}var X=240,Z=48,ie=1;function ae({series:e,isError:t,unit:n}){if(e.length===0)return(0,I.jsx)(`div`,{className:`oc-kpi__chart oc-kpi__chart--empty`,"aria-hidden":!0});let i=e.reduce((e,t)=>t.value>e?t.value:e,0),a=X/e.length,o=Math.max(a-ie,1);return(0,I.jsx)(`svg`,{className:`oc-kpi__chart`,viewBox:`0 0 ${X} ${Z}`,preserveAspectRatio:`none`,role:`img`,"aria-label":r({max:Q(i),unit:n}),children:e.map((e,r)=>{let s=i>0?e.value/i*(Z-1):0,c=r*a,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:o,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{$w as r,Aw as i,Bw as a,CD as o,Dw as s,ED as c,Ew as l,Fw as u,Gw as d,Hw as f,Iw as p,Jw as ee,Kw as m,Lw as h,Mw as g,Nw as _,Ow as te,Pw as ne,Qw as re,Rw as v,SD as ie,Tw as ae,Uw as oe,Vw as se,Ww as ce,Xw as le,Yw as ue,Zw as de,_D as fe,bD as y,dD as b,dO as x,eT as S,fD as C,gD as w,hD as T,iO as E,jD as D,jw as O,kw as k,l_ as A,mD as j,nT as M,pD as N,qw as P,rT as F,tT as I,uO as L,vD as R,ww as z,xD as B,yD as V,zw as pe}from"./dist-B-U7A_Kp.js";import{t as H}from"./button-CoB18od4.js";import{A as me,C as he,O as ge,S as _e,Z as U,_ as W,b as ve,ot as G,x as K,y as ye}from"./index-B6IXWbc8.js";var q=t(e(),1),J=[{id:`messages`,label:()=>F()},{id:`composer`,label:()=>M()},{id:`sidebar`,label:()=>I()},{id:`other`,label:()=>S()}],Y={showSource:{category:`messages`,label:()=>r(),help:()=>re()},showReport:{category:`messages`,label:()=>de(),help:()=>le()},copyAssistant:{category:`messages`,label:()=>ue()},copyUser:{category:`messages`,label:()=>ee()},showDelete:{category:`messages`,label:()=>P()},showTools:{category:`messages`,label:()=>m(),help:()=>d()},voiceInput:{category:`composer`,label:()=>ce(),help:()=>oe()},showChatAge:{category:`sidebar`,label:()=>f(),help:()=>se()},showChatProvider:{category:`sidebar`,label:()=>a(),help:()=>pe()}};function X(e){return e.toLowerCase().normalize(`NFD`).replace(/\p{Diacritic}/gu,``)}function be(e,t){let n=X(t.trim()),r=new Map(J.map(e=>[e.id,e.label()])),i=new Map(J.map(e=>[e.id,[]]));for(let t of e){let e=Y[t],a=e?.category??`other`;n&&!X(`${e?e.label():t} ${e?.help?e.help():``} ${t} ${r.get(a)??``}`).includes(n)||i.get(a).push(t)}return J.map(e=>({id:e.id,label:r.get(e.id),keys:i.get(e.id)})).filter(e=>e.keys.length>0)}var xe=[`showSource`,`showReport`,`copyAssistant`,`copyUser`,`showDelete`,`showTools`,`voiceInput`,`showChatAge`,`showChatProvider`],Se={voiceInput:`voiceInput`};function Ce(e){return xe.includes(e)}function Z(e){return e===`admin`}function we(e){return e===!0?`on`:e===!1?`off`:`inherit`}function Q(e){return e===`on`?!0:e===`off`?!1:null}function Te(e){return Ce(e)?Se[e]:void 0}var $=n(),Ee={voiceInput:()=>te()};function De({prefKey:e,ui:t}){let n=L(E.admin.setUiPrefDefault),r=L(E.admin.setFeatureEnabled),i=Te(e),a=i?Ee[e]?.():void 0;return(0,$.jsxs)(`div`,{className:`oc-prefs__gov`,children:[(0,$.jsxs)(`div`,{className:`oc-prefs__gov-row`,children:[(0,$.jsx)(`span`,{className:`oc-prefs__gov-label`,children:g()}),(0,$.jsxs)(ye,{value:we(t.defaults[e]),onValueChange:t=>void n({key:e,value:Q(t)}),children:[(0,$.jsx)(_e,{size:`sm`,className:`w-36`,children:(0,$.jsx)(he,{})}),(0,$.jsxs)(ve,{children:[(0,$.jsx)(K,{value:`on`,children:l()}),(0,$.jsx)(K,{value:`off`,children:ae()}),(0,$.jsx)(K,{value:`inherit`,children:z()})]})]}),i?(0,$.jsxs)(`span`,{className:`oc-prefs__gov-gate`,children:[(0,$.jsx)(W,{checked:t.featuresEnabled[i]===!0,onCheckedChange:e=>void r({key:i,enabled:e===!0}),"aria-label":O()}),O()]}):null]}),a?(0,$.jsx)(`span`,{className:`oc-prefs__gov-help`,children:a}):null]})}function Oe(){let[e,t]=(0,q.useState)(``),[n,r]=(0,q.useState)(!1),a=x(E.me.getMe,{host:G}),o=a?.ui,c=Z(a?.role)&&n,l=L(E.me.setUiPref).withOptimisticUpdate(ge),d=(0,q.useMemo)(()=>o?be(Object.keys(o.effective),e):[],[o,e]);return o?(0,$.jsxs)(`div`,{className:`oc-prefs-panel`,children:[Z(a?.role)?(0,$.jsxs)(`label`,{className:`oc-prefs__gov-toggle`,children:[(0,$.jsx)(W,{checked:n,onCheckedChange:e=>r(e===!0),"aria-label":_()}),_()]}):null,c?(0,$.jsxs)(`div`,{className:`oc-prefs__gov-head`,children:[(0,$.jsx)(`p`,{children:i()}),(0,$.jsx)(`p`,{children:k()}),(0,$.jsx)(`p`,{children:s()})]}):null,(0,$.jsx)(U,{value:e,onChange:e=>t(e.target.value),placeholder:v(),"aria-label":v(),className:`mb-2`}),d.length===0?(0,$.jsx)(`div`,{className:`oc-prefs__empty`,children:h()}):(0,$.jsx)(`div`,{className:`oc-prefs`,children:d.map(e=>(0,$.jsxs)(`div`,{className:`oc-prefs__group`,children:[(0,$.jsx)(`h4`,{className:`oc-prefs__cat`,children:e.label}),e.keys.map(e=>{let t=Y[e],n=t?t.label():e,r=t?.help?.(),i=o.locked[e],a=o.effective[e],s=o.userOverrides[e]!==void 0;return(0,$.jsxs)(`div`,{className:`oc-prefs__row${i?` is-locked`:``}${s&&!i?` is-overridden`:``}`,children:[(0,$.jsxs)(`div`,{className:`oc-prefs__info`,children:[(0,$.jsxs)(`span`,{className:`oc-prefs__label`,children:[n,i?(0,$.jsx)(`span`,{className:`oc-prefs__lock`,children:p()}):s?null:(0,$.jsx)(`span`,{className:`oc-prefs__def`,children:u()})]}),r?(0,$.jsx)(`span`,{className:`oc-prefs__help`,children:r}):null]}),(0,$.jsxs)(`div`,{className:`oc-prefs__ctl`,children:[!i&&s?(0,$.jsx)(`button`,{type:`button`,className:`oc-prefs__reset`,onClick:()=>void l({key:e,value:null}),children:ne()}):null,(0,$.jsx)(W,{checked:a,disabled:i,onCheckedChange:t=>void l({key:e,value:t===!0}),"aria-label":n})]}),c?(0,$.jsx)(De,{prefKey:e,ui:o}):null]},e)})]},e.id))})]}):(0,$.jsx)(`div`,{className:`oc-prefs__empty`,children:D()})}function ke(){let e=x(E.me.getMe,{host:G}),t=L(E.me.setLocale),n=L(E.me.setMyName),r=me(),i=e?.locale??`default`,a=e?.name??``,[s,l]=(0,q.useState)(null),u=s??a,d=u.trim()!==a.trim();async function f(){try{await n({name:u}),l(null),r.success(V())}catch(e){r.error(R(),e)}}return(0,$.jsxs)(`div`,{className:`oc-appearance`,children:[(0,$.jsxs)(`section`,{className:`oc-show__section`,children:[(0,$.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,$.jsx)(`h2`,{className:`oc-show__title`,children:o()}),(0,$.jsx)(`p`,{className:`oc-show__desc`,children:ie()})]}),(0,$.jsxs)(`div`,{className:`oc-show__row`,children:[(0,$.jsx)(U,{className:`max-w-xs`,value:u,maxLength:120,placeholder:B(),onChange:e=>l(e.target.value),onKeyDown:e=>{e.key===`Enter`&&d&&(e.preventDefault(),f())}}),(0,$.jsx)(H,{size:`sm`,disabled:!d,onClick:()=>void f(),children:A()})]}),(0,$.jsx)(`p`,{className:`oc-show__desc`,children:y()})]}),(0,$.jsxs)(`section`,{className:`oc-show__section`,children:[(0,$.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,$.jsx)(`h2`,{className:`oc-show__title`,children:fe()}),(0,$.jsx)(`p`,{className:`oc-show__desc`,children:w()})]}),(0,$.jsx)(`div`,{className:`oc-show__row`,children:[`fr`,`en`,`default`].map(e=>(0,$.jsx)(H,{variant:i===e?`default`:`outline`,size:`sm`,onClick:()=>void t({locale:e==="default"?null:e}),children:e===`fr`?C():e===`en`?b():c()},e))}),(0,$.jsx)(`p`,{className:`oc-show__desc`,children:T()})]}),(0,$.jsxs)(`section`,{className:`oc-show__section`,children:[(0,$.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,$.jsx)(`h2`,{className:`oc-show__title`,children:j()}),(0,$.jsx)(`p`,{className:`oc-show__desc`,children:N()})]}),(0,$.jsx)(Oe,{})]})]})}export{ke as PreferencesTab};
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Ad as r,B as i,Cd as a,Dd as o,Ed as s,Fd as c,H as l,Hd as u,Md as d,Nd as f,Od as p,Pd as ee,Sd as m,Td as h,U as g,Ud as _,V as v,_d as y,bd as b,dO as x,gd as S,iO as C,jd as w,kd as T,uO as E,vd as D,wd as O,xd as k,yd as A,z as j}from"./dist-B-U7A_Kp.js";import{d as M,f as N,i as P,l as F,n as I,r as L,t as R,u as z}from"./FieldLabel-DG-U2yJD.js";import{t as B}from"./button-CoB18od4.js";import{A as V,C as H,S as U,_ as W,b as G,x as K,y as q}from"./index-B6IXWbc8.js";/* empty css */var J=t(e(),1),Y=n(),X={media_delivery:{label:r,help:T},documentary_fetch:{label:p,help:o},inbound_files:{label:s,help:h},history_summary:{label:g,help:l}},Z={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`},Q={outboundDir:D,references:y,files:S,previous_summary:v,new_messages:i,max_chars:j};function $(){let e=x(C.admin.listInstances,{}),[t,n]=(0,J.useState)(null);if(e===void 0)return(0,Y.jsx)(`div`,{className:`oc-settings__tab-loading`,"aria-busy":`true`});if(e.length===0)return(0,Y.jsx)(`div`,{className:`oc-injtab`,children:(0,Y.jsx)(`p`,{className:`oc-admin__hint`,children:a()})});let r=e.find(e=>e._id===t)??e[0];return(0,Y.jsxs)(`div`,{className:`oc-injtab`,children:[(0,Y.jsxs)(`div`,{className:`oc-injtab__head`,children:[(0,Y.jsx)(I,{label:c(),help:ee()}),(0,Y.jsxs)(`label`,{className:`oc-injtab__picker`,children:[(0,Y.jsx)(`span`,{children:O()}),(0,Y.jsxs)(q,{value:r._id,onValueChange:e=>n(e),children:[(0,Y.jsx)(U,{size:`sm`,className:`min-w-44`,children:(0,Y.jsx)(H,{})}),(0,Y.jsx)(G,{children:e.map(e=>(0,Y.jsx)(K,{value:e._id,children:e.displayName??e.name},e._id))})]})]})]}),(0,Y.jsx)(te,{instance:r},r._id)]})}function te({instance:e}){let t=E(C.admin.upsertInstanceConfig),n=V(),r=e.config??{},[i,a]=(0,J.useState)(()=>P(r)),[o,s]=(0,J.useState)(!1),c=i.promptInjections,l=(e,t)=>a({...i,promptInjections:{...c,[e]:{...c[e],...t}}});async function d(){s(!0);try{await t({instanceId:e._id,config:L(i,r)})}catch(e){n.error(u(),e)}finally{s(!1)}}return(0,Y.jsxs)(`div`,{className:`oc-injtab__body`,children:[z.map(e=>(0,Y.jsx)(ne,{injKey:e,def:F[e],i18n:X[e],row:c[e]??{enabled:!0,template:F[e].defaultTemplate},onChange:t=>l(e,t)},e)),(0,Y.jsx)(`div`,{className:`oc-injtab__actions`,children:(0,Y.jsx)(B,{size:`sm`,onClick:()=>void d(),disabled:o,children:_()})})]})}function ne({injKey:e,def:t,i18n:n,row:r,onChange:i}){let[a,o]=(0,J.useState)(!1),s=r.template.trim()!==t.defaultTemplate,c=t.togglable&&!r.enabled,l=Object.fromEntries(t.placeholders.map(e=>[e,Z[e]??`{${e}}`])),u=M(e,r),p=u?N(u,l):``;return(0,Y.jsxs)(`section`,{className:`oc-injcard`,children:[(0,Y.jsxs)(`div`,{className:`oc-injcard__head`,children:[t.togglable?(0,Y.jsxs)(`label`,{className:`oc-field--row`,children:[(0,Y.jsx)(W,{checked:r.enabled,onCheckedChange:e=>i({enabled:e===!0})}),(0,Y.jsx)(I,{label:n.label(),help:n.help()})]}):(0,Y.jsx)(I,{label:n.label(),help:n.help()}),s&&(0,Y.jsx)(`span`,{className:`oc-injection__badge`,children:d()})]}),(0,Y.jsx)(`textarea`,{className:`oc-injcard__text`,value:r.template,disabled:c,rows:8,spellCheck:!1,onChange:e=>i({template:e.target.value})}),(0,Y.jsxs)(`div`,{className:`oc-injection__foot`,children:[(0,Y.jsxs)(`div`,{className:`oc-injcard__phs`,children:[(0,Y.jsx)(`span`,{className:`oc-injection__ph`,children:w()}),t.placeholders.map(e=>(0,Y.jsxs)(`span`,{className:`oc-injcard__ph-chip`,children:[(0,Y.jsx)(`code`,{children:`{${e}}`}),(0,Y.jsx)(R,{text:(Q[e]??(()=>e))()})]},e))]}),(0,Y.jsxs)(`div`,{className:`oc-injcard__btns`,children:[(0,Y.jsx)(B,{variant:`ghost`,size:`sm`,onClick:()=>o(e=>!e),children:a?k():m()}),s&&(0,Y.jsx)(B,{variant:`ghost`,size:`sm`,onClick:()=>i({template:t.defaultTemplate}),children:f()})]})]}),a&&(0,Y.jsx)(`div`,{className:`oc-injcard__preview`,children:p?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`pre`,{className:`oc-injcard__previewtext`,children:p}),(0,Y.jsx)(`span`,{className:`oc-injection__ph`,children:b()})]}):(0,Y.jsx)(`span`,{className:`oc-injection__ph`,children:A()})})]})}export{$ as PromptInjectionsTab};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$m as r,Bm as i,Ch as a,Dh as o,Eh as s,Gm as c,Hm as l,Km as ee,Qm as te,Rm as u,Sh as d,Th as f,Um as ne,Vm as p,Wm as m,_h as h,ah as g,bh as _,ch as v,dO as y,dh as b,eh as re,fh as ie,gh as x,hh as S,iO as C,ih as ae,lh as w,mh as T,nh as E,oh as D,ph as O,rh as k,sh as A,th as j,uO as M,uh as N,vh as P,wh as F,xh as I,yh as L,zm as R}from"./dist-B-U7A_Kp.js";import{t as z}from"./button-CoB18od4.js";import{A as B,X as V,Z as H,_ as U,j as W,m as G,xt as K}from"./index-B6IXWbc8.js";import{t as q}from"./roleDescriptions-C3lIPjqc.js";var J=t(e(),1),Y=n(),X=[{group:()=>o(),keys:[{key:`traces.read`,label:()=>d()},{key:`traces.read.content`,label:()=>I(),phi:!0},{key:`traces.write`,label:()=>_()}]},{group:()=>s(),keys:[{key:`kpi.read`,label:()=>d()},{key:`kpi.write`,label:()=>_()}]},{group:()=>f(),keys:[{key:`openclaw.query`,label:()=>L()},{key:`anomalies.read`,label:()=>P()},{key:`anomalies.report`,label:()=>h()}]},{group:()=>F(),keys:[{key:`chats.read`,label:()=>d()},{key:`selfheal`,label:()=>S()}]},{group:()=>a(),keys:[{key:`admin.manage`,label:()=>x()}]}],oe=X.flatMap(e=>e.keys.map(e=>e.key));function Z(e){return e.includes(`*`)}var Q={key:``,name:``,description:``};function $(){let e=y(C.apiKeys.listRoles,{}),t=M(C.apiKeys.createRole),n=M(C.apiKeys.ensureRolesSeeded),a=M(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))}),o=W(),s=B(),[d,f]=(0,J.useState)(!1),[h,_]=(0,J.useState)(Q),[x,S]=(0,J.useState)(new Set);(0,J.useEffect)(()=>{n({}).catch(e=>{s.error(O(),e)})},[n,s]);let P=e??[];async function F(e,t){if(Z(e.permissions)||x.has(e._id))return;let n=e.permissions.includes(t)?e.permissions.filter(e=>e!==t):[...e.permissions,t];if(!(e.builtin&&!await o({title:ie({name:e.name}),description:b(),confirmLabel:N()}))){S(t=>new Set(t).add(e._id));try{await a({roleId:e._id,permissions:n})}catch(e){s.error(w(),e)}finally{S(t=>{let n=new Set(t);return n.delete(e._id),n})}}}async function I(){try{await t({key:h.key,name:h.name,description:h.description||void 0,permissions:[]}),_(Q),f(!1)}catch(e){s.error(v(),e)}}let L=e===void 0,$=!L&&P.length===0;return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(`p`,{className:`oc-admin__hint`,children:[A(),` `,(0,Y.jsx)(`code`,{children:`admin`}),` `,D(),` `,(0,Y.jsx)(`code`,{children:`traces.read.content`}),` `,g()]}),(0,Y.jsxs)(`div`,{className:`oc-dt`,children:[(0,Y.jsxs)(`div`,{className:`oc-dt__bar`,children:[(0,Y.jsx)(`h2`,{className:`oc-dt__title`,children:ae()}),(0,Y.jsx)(`div`,{className:`oc-dt__bar-actions`,children:(0,Y.jsx)(z,{size:`sm`,onClick:()=>{_(Q),f(!0)},children:k()})})]}),L?(0,Y.jsx)(`p`,{className:`oc-admin__hint`,children:E()}):$?(0,Y.jsx)(`p`,{className:`oc-admin__hint`,children:j()}):(0,Y.jsx)(`div`,{className:`oc-matrix__scroll`,children:(0,Y.jsxs)(`table`,{className:`oc-matrix`,children:[(0,Y.jsxs)(`thead`,{children:[(0,Y.jsxs)(`tr`,{children:[(0,Y.jsx)(`th`,{className:`oc-matrix__corner`,rowSpan:2,children:re()}),X.map(e=>(0,Y.jsx)(`th`,{className:`oc-matrix__group`,colSpan:e.keys.length,children:e.group()},e.group()))]}),(0,Y.jsx)(`tr`,{children:X.flatMap(e=>e.keys.map(e=>(0,Y.jsxs)(`th`,{className:`oc-matrix__perm`,title:e.phi?T({key:e.key}):e.key,children:[e.label(),e.phi?(0,Y.jsx)(`span`,{className:`oc-matrix__phi`,children:` ⚠`}):null]},e.key)))})]}),(0,Y.jsx)(`tbody`,{children:P.map(e=>{let t=Z(e.permissions),n=x.has(e._id);return(0,Y.jsxs)(`tr`,{children:[(0,Y.jsxs)(`th`,{className:`oc-matrix__rolecell`,children:[(0,Y.jsxs)(`div`,{className:`oc-matrix__rolename`,children:[(0,Y.jsx)(`span`,{children:e.name}),(0,Y.jsx)(`code`,{className:`oc-matrix__rolekey`,children:e.key}),e.builtin?(0,Y.jsxs)(V,{variant:`outline`,className:`gap-1`,children:[(0,Y.jsx)(K,{}),` `,r()]}):(0,Y.jsx)(V,{variant:`secondary`,children:te()})]}),q(e)?(0,Y.jsx)(`p`,{className:`oc-matrix__roledesc`,children:q(e)}):null]}),oe.map(r=>(0,Y.jsx)(`td`,{className:`oc-matrix__cell`,children:(0,Y.jsx)(U,{checked:t||e.permissions.includes(r),disabled:t||n,"aria-label":`${e.key} · ${r}`,title:t?ee():n?c():r,onCheckedChange:()=>void F(e,r)})},r))]},e.key)})})]})})]}),(0,Y.jsx)(G,{open:d,onOpenChange:f,title:m(),description:ne(),canSubmit:!!(h.key&&h.name),onSubmit:I,submitLabel:l(),children:(0,Y.jsxs)(`div`,{className:`oc-form`,children:[(0,Y.jsxs)(`label`,{className:`oc-field`,children:[(0,Y.jsx)(`span`,{className:`oc-field__label`,children:p()}),(0,Y.jsx)(H,{value:h.key,placeholder:i(),onChange:e=>_({...h,key:e.target.value})})]}),(0,Y.jsxs)(`label`,{className:`oc-field`,children:[(0,Y.jsx)(`span`,{className:`oc-field__label`,children:R()}),(0,Y.jsx)(H,{value:h.name,onChange:e=>_({...h,name:e.target.value})})]}),(0,Y.jsxs)(`label`,{className:`oc-field`,children:[(0,Y.jsx)(`span`,{className:`oc-field__label`,children:u()}),(0,Y.jsx)(H,{value:h.description,onChange:e=>_({...h,description:e.target.value})})]})]})})]})}export{$ as RolesTab};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$C as r,AC as i,BC as ee,CC as a,Cw as te,DC as ne,EC as o,FC as re,GC as ie,HC as ae,IC as oe,JC as se,KC as ce,LC as le,MC as ue,NC as de,OC as fe,PC as pe,QC as me,RC as he,SC as s,Sw as ge,TC as c,UC as _e,VC as ve,WC as ye,XC as be,YC as xe,ZC as Se,_C as Ce,_w as we,aC as Te,aw as Ee,bC as l,bw as De,cC as u,cO as Oe,cw as ke,dC as d,dO as f,dw as Ae,ew as je,fC as p,fw as Me,gC as m,gw as Ne,hC as h,hw as Pe,iC as g,iO as _,iw as Fe,jC as Ie,kC as Le,lC as v,lw as Re,mC as y,mw as ze,nw as Be,oC as b,ow as Ve,pC as x,pw as He,qC as Ue,rC as S,rw as We,sC as C,sw as Ge,tw as Ke,uC as w,uO as T,uw as qe,vC as E,vw as D,wC as O,xC as k,xw as Je,yC as A,yw as Ye,zC as Xe}from"./dist-B-U7A_Kp.js";import{n as j}from"./dist-C_wXViAC.js";import{i as Ze}from"./dist-BNEZtSYw.js";import{t as M}from"./button-CoB18od4.js";import{$ as N,A as Qe,At as $e,C as P,Dt as F,Mt as et,Q as I,S as L,X as R,Z as z,b as B,et as V,j as tt,jt as nt,m as rt,nt as H,rt as U,tt as W,x as G,y as K}from"./index-B6IXWbc8.js";import{t as it}from"./FilterBar-BBJk4kP8.js";import{t as at}from"./DataTableShell-DRaoMzdi.js";import{t as ot}from"./roleDescriptions-C3lIPjqc.js";var q=t(e(),1),J=n(),st=[{value:`never`,label:()=>v(),days:null},{value:`30`,label:()=>u(),days:30},{value:`90`,label:()=>C(),days:90}],ct=720*60*60*1e3,Y=`__all__`,X={name:``,roleKey:``,description:``};function Z(){let e=et({from:`/settings/serviceAccounts`}),t=nt({from:`/settings/serviceAccounts`}),n=e.q??``,a=e.status??Y,[o,s]=(0,q.useState)(Y),c=e=>void t({search:t=>({...t,q:e||void 0}),replace:!0}),Ce=e=>void t({search:t=>({...t,status:e===Y?void 0:e})}),Te=f(_.apiKeys.listServiceAccounts,{filter:{q:n||void 0,role:o===Y?void 0:o,disabled:a===Y?void 0:a===`disabled`}}),l=f(_.apiKeys.listKeys,{}),u=f(_.apiKeys.listRoles,{}),d=T(_.apiKeys.createServiceAccount),p=T(_.apiKeys.updateServiceAccount),m=T(_.apiKeys.deleteServiceAccount),h=Oe(_.apiKeys.mintApiKey),g=T(_.apiKeys.revokeApiKey),v=tt(),y=Qe(),b=n!==``||o!==Y||a!==Y;function x(){s(Y),t({search:{},replace:!0})}let[S,C]=(0,q.useState)(!1),[w,E]=(0,q.useState)(X),[O,k]=(0,q.useState)(null),[A,j]=(0,q.useState)(new Set),[N,F]=(0,q.useState)(null),I=(0,q.useRef)(!1),[V,H]=(0,q.useState)(new Set),[U,W]=(0,q.useState)({}),[ct,Z]=(0,q.useState)(null),Q=(0,q.useMemo)(()=>{let e=new Map;for(let t of l??[]){let n=e.get(t.serviceAccountId)??[];n.push(t),e.set(t.serviceAccountId,n)}return e},[l]);function $(e){j(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})}async function dt(){try{O?(await p({serviceAccountId:O,name:w.name,roleKey:w.roleKey,description:w.description}),y.success(ve())):await d({name:w.name,roleKey:w.roleKey,description:w.description||void 0}),E(X),k(null),C(!1)}catch(e){y.error(O?ae():_e(),e)}}function ft(e){E({name:e.name,roleKey:e.roleKey,description:e.description??``}),k(e._id),C(!0)}async function pt(e){if(I.current)return;I.current=!0;let t=U[e._id]??`never`,n=st.find(e=>e.value===t)?.days??null,r=n?Date.now()+n*24*60*60*1e3:void 0;F(e._id);try{let t=await h({serviceAccountId:e._id,expiresAt:r});Z({accountName:e.name,plaintext:t.plaintext,prefix:t.prefix,lastFour:t.lastFour})}catch(e){y.error(ee(),e)}finally{I.current=!1,F(null)}}async function mt(e){if(await v({title:Xe(),description:(0,J.jsxs)(J.Fragment,{children:[he(),` `,(0,J.jsx)(`span`,{className:`font-mono`,children:e.name}),` `,le(),` `,(0,J.jsx)(`strong`,{children:oe()}),` `,re()]}),confirmWord:e.name,confirmLabel:pe(),destructive:!0}))try{await m({serviceAccountId:e._id}),y.success(de(),e.name)}catch(e){y.error(ue(),e)}}async function ht(e){if(await v({title:Ie(),description:(0,J.jsxs)(J.Fragment,{children:[i(),` `,(0,J.jsxs)(`span`,{className:`font-mono`,children:[e.prefix,`…`,e.lastFour]}),` `,Le()]}),confirmLabel:fe(),destructive:!0})&&!V.has(e._id)){H(t=>new Set(t).add(e._id));try{await g({keyId:e._id})}catch(e){y.error(ne(),e)}finally{H(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:te()}),(0,J.jsxs)(it,{q:n,onQChange:c,searchPlaceholder:ge(),onReset:x,canReset:b,children:[(0,J.jsxs)(K,{value:o,onValueChange:s,children:[(0,J.jsx)(L,{size:`sm`,className:`w-40`,children:(0,J.jsx)(P,{placeholder:Je()})}),(0,J.jsxs)(B,{children:[(0,J.jsx)(G,{value:Y,children:De()}),(u??[]).map(e=>(0,J.jsx)(G,{value:e.key,children:e.key},e._id))]})]}),(0,J.jsxs)(K,{value:a,onValueChange:Ce,children:[(0,J.jsx)(L,{size:`sm`,className:`w-36`,children:(0,J.jsx)(P,{})}),(0,J.jsxs)(B,{children:[(0,J.jsx)(G,{value:Y,children:Ye()}),(0,J.jsx)(G,{value:`active`,children:D()}),(0,J.jsx)(G,{value:`disabled`,children:we()})]})]})]}),(0,J.jsx)(at,{title:Ne(),rows:Te,addLabel:Pe(),onAdd:()=>{E(X),k(null),C(!0)},emptyHint:ze(),isExpanded:e=>A.has(e._id),renderExpanded:e=>(0,J.jsx)(lt,{account:e,keys:Q.get(e._id)??[],onRevoke:ht,revoking:V}),rowActions:e=>[{label:qe(),onSelect:()=>ft(e)},{label:He(),onSelect:()=>void pt(e)},{label:A.has(e._id)?Me():Ae(),onSelect:()=>$(e._id)},{label:Re(),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)?ke():Ge(),onClick:()=>$(e._id),children:A.has(e._id)?(0,J.jsx)(Ze,{}):(0,J.jsx)($e,{})})},{header:Ve(),sort:e=>e.name,cell:e=>(0,J.jsxs)(`div`,{className:`flex flex-col`,children:[(0,J.jsx)(`span`,{children:e.name}),e.description?(0,J.jsx)(`span`,{className:`text-muted-foreground text-xs`,children:e.description}):null]})},{header:Ee(),sort:e=>e.roleKey,cell:e=>(0,J.jsx)(R,{variant:`secondary`,children:e.roleKey})},{header:Fe(),sort:e=>+!!e.disabled,cell:e=>e.disabled?(0,J.jsx)(R,{variant:`destructive`,children:we()}):(0,J.jsx)(R,{variant:`outline`,children:D()})},{header:We(),cell:e=>(0,J.jsxs)(K,{value:U[e._id]??`never`,onValueChange:t=>W(n=>({...n,[e._id]:t})),children:[(0,J.jsx)(L,{size:`sm`,className:`w-32`,children:(0,J.jsx)(P,{})}),(0,J.jsx)(B,{children:st.map(e=>(0,J.jsx)(G,{value:e.value,children:e.label()},e.value))})]})},{header:Be(),sort:e=>(Q.get(e._id)??[]).filter(e=>!e.disabled).length,cell:e=>{let t=(Q.get(e._id)??[]).filter(e=>!e.disabled).length;return(0,J.jsx)(`span`,{className:`oc-sa__keycount`,children:N===e._id?Ke():je({count:t})})}}]}),(0,J.jsx)(rt,{open:S,onOpenChange:e=>{C(e),e||k(null)},title:O?r():be(),description:O?me():xe(),canSubmit:!!(w.name&&w.roleKey),onSubmit:dt,submitLabel:O?Se():se(),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:Ue()}),(0,J.jsx)(z,{value:w.name,onChange:e=>E({...w,name:e.target.value})})]}),(0,J.jsxs)(`label`,{className:`oc-field`,children:[(0,J.jsx)(`span`,{className:`oc-field__label`,children:ce()}),(0,J.jsxs)(K,{value:w.roleKey||void 0,onValueChange:e=>E({...w,roleKey:e}),children:[(0,J.jsx)(L,{className:`w-full`,children:(0,J.jsx)(P,{placeholder:ie()})}),(0,J.jsx)(B,{children:(u??[]).map(e=>(0,J.jsxs)(G,{value:e.key,children:[e.name,` (`,e.key,`)`]},e._id))})]}),(()=>{let e=(u??[]).find(e=>e.key===w.roleKey),t=e?ot(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:ye()}),(0,J.jsx)(z,{value:w.description,onChange:e=>E({...w,description:e.target.value})})]})]})}),(0,J.jsx)(ut,{minted:ct,onClose:()=>Z(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:[o(),` `,(0,J.jsx)(`span`,{className:`font-medium`,children:e.name})]}),t.length===0?(0,J.jsx)(`p`,{className:`oc-admin__hint`,children:c()}):(0,J.jsxs)(`table`,{className:`oc-sa__keytable`,children:[(0,J.jsx)(`thead`,{children:(0,J.jsxs)(`tr`,{children:[(0,J.jsx)(`th`,{children:O()}),(0,J.jsx)(`th`,{children:a()}),(0,J.jsx)(`th`,{children:s()}),(0,J.jsx)(`th`,{children:k()}),(0,J.jsx)(`th`,{children:l()}),(0,J.jsx)(`th`,{children:A()}),(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)(R,{variant:`secondary`,children:e.roleKey})}),(0,J.jsx)(`td`,{children:Q(t.createdAt)}),(0,J.jsx)(`td`,{className:$(t.lastUsedAt)?`oc-sa__stale`:``,children:dt(t.lastUsedAt)}),(0,J.jsx)(`td`,{children:ft(t.expiresAt)}),(0,J.jsx)(`td`,{children:pt(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)?E():Ce()})})]},t._id))})]})]})}function ut({minted:e,onClose:t}){let[n,r]=(0,q.useState)(!1);async function i(){if(e)try{await navigator.clipboard.writeText(e.plaintext),r(!0),window.setTimeout(()=>r(!1),2e3)}catch{}}return(0,J.jsx)(I,{open:e!==null,onOpenChange:e=>{e||(r(!1),t())},children:e?(0,J.jsxs)(N,{className:`max-w-lg`,showCloseButton:!1,onInteractOutside:e=>e.preventDefault(),onEscapeKeyDown:e=>e.preventDefault(),children:[(0,J.jsxs)(H,{children:[(0,J.jsx)(U,{children:m()}),(0,J.jsx)(V,{children:h({name:e.accountName})})]}),(0,J.jsx)(`div`,{className:`oc-sa__minted-warning`,children:y()}),(0,J.jsxs)(`div`,{className:`oc-sa__minted-box`,children:[(0,J.jsx)(`code`,{className:`oc-sa__minted-plain`,children:e.plaintext}),(0,J.jsxs)(M,{variant:`outline`,size:`sm`,onClick:()=>void i(),"aria-label":x(),children:[n?(0,J.jsx)(j,{}):(0,J.jsx)(F,{}),n?p():d()]})]}),(0,J.jsx)(W,{children:(0,J.jsx)(M,{onClick:()=>{r(!1),t()},children:w()})})]}):null})}function Q(e){return new Date(e).toLocaleString(`fr-FR`)}function $(e){return e===null?!1:Date.now()-e>ct}function dt(e){return e===null?b():new Date(e).toLocaleString(`fr-FR`)}function ft(e){return e===null?`—`:new Date(e).toLocaleDateString(`fr-FR`)}function pt(e){return e.disabled?(0,J.jsx)(R,{variant:`destructive`,children:Te()}):e.expiresAt!==null&&e.expiresAt<Date.now()?(0,J.jsx)(R,{variant:`outline`,children:g()}):(0,J.jsx)(R,{variant:`outline`,children:S()})}export{Z as ServiceAccountsTab};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$T as r,AT as i,BT as a,CE as o,CT as s,DD as c,DT as l,EE as u,ET as d,FT as f,G as p,GT as m,HT as h,IT as g,JT as _,K as v,KT as y,LT as ee,MT as b,NT as te,OD as ne,OT as re,PT as ie,QT as ae,RT as oe,SE as se,ST as ce,TE as le,TT as ue,UT as x,VT as de,W as fe,WT as pe,XT as me,YT as he,ZT as ge,_E as _e,_T as ve,aE as ye,aO as be,aT as xe,bE as Se,bT as Ce,cE as we,cO as Te,cT as S,dD as Ee,dE as De,dO as C,dT as Oe,eE as ke,fD as Ae,fE as je,fT as w,gE as T,gT as Me,hE as Ne,hT as Pe,iE as Fe,iO as E,iT as Ie,jT as Le,kD as Re,kT as ze,lE as Be,lT as Ve,mE as He,mT as Ue,n as We,nE as Ge,oE as Ke,oT as qe,pE as Je,pT as Ye,q as D,qT as Xe,rE as Ze,sE as Qe,sT as $e,tE as et,uE as tt,uO as O,uT as nt,vE as rt,vT as it,wE as at,wT as k,xE as ot,xT as st,yE as ct,yT as lt,zT as ut}from"./dist-B-U7A_Kp.js";import{n as A}from"./dist-C_wXViAC.js";import{t as j}from"./x-Dl0sHEar.js";import{t as M}from"./button-CoB18od4.js";import{C as N,Et as dt,G as ft,J as P,K as F,S as I,Tt as L,W as pt,X as R,Y as mt,Z as z,_ as B,at as ht,b as V,it as gt,ot as H,q as _t,x as U,y as W}from"./index-B6IXWbc8.js";import{a as vt,i as yt,n as bt,o as xt,r as St,t as Ct}from"./card-4N7N5yEr.js";import{a as wt,i as G,n as Tt,o as K,r as q,t as Et}from"./table-CEVcfIlY.js";import{t as Dt}from"./TimeRangePicker-CAhWZBEI.js";import{t as Ot}from"./FilterBar-BBJk4kP8.js";import{t as kt}from"./AdvancedFilter-BOBkqtk6.js";var J=be(`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`}]]),Y=t(e(),1),At=.1,jt=[248,248,248],Mt=[24,24,24];function Nt(e,t,n){let r=t,i=n,a=-1,o=-1;for(let s=0;s<n;s++)for(let n=0;n<t;n++)e[(s*t+n)*4+3]>8&&(n<r&&(r=n),n>a&&(a=n),s<i&&(i=s),s>o&&(o=s));return a<0?null:{x:r,y:i,width:a-r+1,height:o-i+1}}function Pt(e,t,n){let r=t*n;if(r===0)return 0;let i=0;for(let t=3;t<e.length;t+=4)e[t]<=8&&i++;return i/r}function Ft(e,t,n){return Pt(e,t,n)>=At}function It(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 Lt(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 Rt=12*1024*1024,zt=480,Bt=160,Vt=.92;async function Ht(e,t={}){if(!e.type.startsWith(`image/`))throw Error(l());if(e.size>Rt)throw Error(d());let{source:n,width:r,height:i,cleanup:a}=await Ut(e);try{let a=e.type===`image/svg+xml`,o=Math.min(zt/r,Bt/i,a?1/0:1),c=Math.max(1,Math.round(r*o)),l=Math.max(1,Math.round(i*o)),u=document.createElement(`canvas`);u.width=c,u.height=l;let d=u.getContext(`2d`);if(!d)throw Error(k());d.imageSmoothingEnabled=!0,d.imageSmoothingQuality=`high`,d.drawImage(n,0,0,c,l);let f=Nt(d.getImageData(0,0,c,l).data,c,l)??{x:0,y:0,width:c,height:l},p=document.createElement(`canvas`);p.width=f.width,p.height=f.height;let m=p.getContext(`2d`);if(!m)throw Error(k());if(m.drawImage(u,f.x,f.y,f.width,f.height,0,0,f.width,f.height),t.variantFor){let e=m.getImageData(0,0,f.width,f.height);Ft(e.data,f.width,f.height)?It(e.data,t.variantFor===`dark`?jt:Mt):Lt(e.data),m.putImageData(e,0,0)}let h=Ft(m.getImageData(0,0,f.width,f.height).data,f.width,f.height),g=await Gt(p,`image/webp`,Vt)??await Gt(p,`image/png`);if(!g)throw Error(s());return{blob:g,hasAlpha:h}}finally{a()}}async function Ut(e){if(e.type===`image/svg+xml`)return Wt(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 Wt(e)}async function Wt(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(ue())),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 Gt(e,t,n){return new Promise(r=>e.toBlob(e=>r(e),t,n))}var X=n();function Kt(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__`,qt={kind:`relative`,from:`now-24h`,to:`now`},Jt=[{value:`status`,label:`Statut`},{value:`latencyMs`,label:`Latence (ms)`},{value:`route`,label:`Route`},{value:`roleKey`,label:`Rôle`},{value:`correlationId`,label:`Corrélation`}];function Q({title:e,description:t,children:n}){return(0,X.jsxs)(`section`,{className:`oc-show__section`,children:[(0,X.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,X.jsx)(`h2`,{className:`oc-show__title`,children:e}),t?(0,X.jsx)(`p`,{className:`oc-show__desc`,children:t}):null]}),(0,X.jsx)(`div`,{className:`oc-show__demo`,children:n})]})}function Yt(e){return e===`light`?Re():e===`dark`?ne():c()}var Xt=[`primary`,`secondary`,`accent`,`muted`,`chart-1`,`chart-2`];function Zt({tokens:e,mode:t}){let n=e.colors[t];return(0,X.jsx)(`div`,{className:`oc-chart-swatches`,"aria-hidden":!0,children:Xt.map(e=>{let t=n[e];return(0,X.jsx)(`span`,{className:`oc-chart-swatch`,style:t?{background:t}:void 0},e)})})}function Qt({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)(A,{className:`size-4 text-primary`,"aria-hidden":!0}):null]}),r?(0,X.jsx)(Zt,{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)(M,{type:`button`,variant:`ghost`,size:`icon`,className:`oc-chart-card__export`,onClick:o,"aria-label":D(),title:D(),children:(0,X.jsx)(dt,{className:`size-4`})}):null]})}function $t({selectedKey:e,resolvedMode:t}){let n=C(E.charts.listMyCharts),r=O(E.charts.setMyChart);async function i(e){try{await r({name:e})}catch{}}return(0,X.jsxs)(`section`,{className:`oc-show__section`,children:[(0,X.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,X.jsx)(`h2`,{className:`oc-show__title`,children:rt()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:_e()})]}),(0,X.jsxs)(`div`,{className:`oc-chart-grid`,children:[(0,X.jsx)(Qt,{selected:e===null,title:T(),subtitle:Ne(),tokens:null,mode:t,onSelect:()=>void i(null)}),(n??[]).map(n=>{let r=n.via===`common`?He():n.via===`owner`?Je():je({group:n.via.group});return(0,X.jsx)(Qt,{selected:e===n.key,title:n.name,subtitle:r,tokens:n.tokens,mode:t,onSelect:()=>void i(n.key),onExport:()=>Kt(n.name,n.tokens)},n.key)})]}),n!==void 0&&n.length===0?(0,X.jsx)(`p`,{className:`oc-show__desc`,children:De()}):null]})}function en(){let e=O(E.charts.importChart),[t,n]=(0,Y.useState)(``),[r,i]=(0,Y.useState)(``),[a,o]=(0,Y.useState)(null),[s,c]=(0,Y.useState)(!1),[l,u]=(0,Y.useState)(!1);async function d(e){let t=e.target.files?.[0];if(e.target.value=``,t){o(null),c(!1);try{i(await t.text())}catch{o(x())}}}async function f(){if(o(null),c(!1),t.trim()===``){o(de());return}let a;try{a=JSON.parse(r)}catch{o(x());return}u(!0);try{await e({name:t.trim(),tokens:a}),c(!0),n(``),i(``)}catch(e){o(e instanceof Error?e.message:String(e))}finally{u(!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:ge()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:me()})]}),(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:he()}),(0,X.jsx)(z,{value:t,onChange:e=>n(e.target.value),placeholder:_(),maxLength:60})]}),(0,X.jsxs)(`label`,{className:`oc-chart-import__field`,children:[(0,X.jsx)(`span`,{className:`oc-chart-import__label`,children:Xe()}),(0,X.jsx)(`textarea`,{className:`oc-chart-import__textarea`,value:r,onChange:e=>i(e.target.value),placeholder:y(),rows:8,spellCheck:!1})]}),(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsx)(M,{variant:`outline`,size:`sm`,asChild:!0,children:(0,X.jsxs)(`label`,{className:`oc-chart-import__file`,children:[(0,X.jsx)(J,{className:`size-4`}),m(),(0,X.jsx)(`input`,{type:`file`,accept:`application/json,.json`,className:`oc-chart-import__file-input`,onChange:e=>void d(e)})]})}),(0,X.jsx)(M,{size:`sm`,disabled:l,onClick:()=>void f(),children:pe()})]}),a?(0,X.jsx)(`p`,{className:`oc-chart-import__error`,children:a}):null,s?(0,X.jsx)(`p`,{className:`oc-chart-import__ok`,children:h()}):null]})]})}function tn({chart:e}){let t=Te(E.charts.setChartLogo),n=O(E.charts.removeChartLogo),[r,a]=(0,Y.useState)(!1),[o,s]=(0,Y.useState)(null),c=t=>t===`light`?e.logoLightUrl:e.logoDarkUrl;async function l(n,r,i){if(e.chartId!==void 0){s(null),a(!0);try{let{blob:a,hasAlpha:o}=await Ht(r,i?{variantFor:i}:{}),s=await a.arrayBuffer();await t({chartId:e.chartId,bytes:s,mode:n,hasAlpha:o})}catch(e){s(e instanceof Error?e.message:String(e))}finally{a(!1)}}}async function u(e,t){let n=t.target.files?.[0];t.target.value=``,n&&await l(e,n)}async function d(t){if(e.chartId!==void 0){s(null),a(!0);try{await n({chartId:e.chartId,mode:t})}catch(e){s(e instanceof Error?e.message:String(e))}finally{a(!1)}}}async function p(e){let t=c(e===`light`?`dark`:`light`);if(t){s(null),a(!0);try{await l(e,await(await fetch(t)).blob(),e)}catch(e){s(e instanceof Error?e.message:String(e))}finally{a(!1)}}}function m({mode:e}){let t=c(e),n=c(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`?ie():te()}),(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)(M,{variant:`outline`,size:`sm`,asChild:!0,children:(0,X.jsxs)(`label`,{className:`oc-chart-import__file`,children:[(0,X.jsx)(J,{className:`size-4`}),t?Le():b(),(0,X.jsx)(`input`,{type:`file`,accept:`image/*`,className:`oc-chart-import__file-input`,onChange:t=>void u(e,t)})]})}),!t&&n?(0,X.jsx)(M,{variant:`ghost`,size:`sm`,disabled:r,onClick:()=>void p(e),children:ze()}):null,t?(0,X.jsx)(M,{variant:`ghost`,size:`sm`,disabled:r,onClick:()=>void d(e),children:i()}):null]})}return(0,X.jsxs)(`div`,{className:`oc-chart-mine__logo`,children:[(0,X.jsx)(`span`,{className:`oc-chart-mine__groups-label`,children:f()}),(0,X.jsxs)(`div`,{className:`oc-chart-mine__logo-slots`,children:[(0,X.jsx)(m,{mode:`light`}),(0,X.jsx)(m,{mode:`dark`})]}),r?(0,X.jsx)(`span`,{className:`oc-show__desc`,children:re()}):null,o?(0,X.jsx)(`p`,{className:`oc-chart-import__error`,children:o}):null]})}function nn({chart:e}){let t=C(E.me.getMe,{host:H}),n=O(E.charts.addChartDomain),r=O(E.charts.removeChartDomain),[i,a]=(0,Y.useState)(``),[o,s]=(0,Y.useState)(null),[c,l]=(0,Y.useState)(!1);if(t?.role!==`admin`)return null;let u=e.domains??[];async function d(){let t=i.trim();if(t!==``){s(null),l(!0);try{await n({chartKey:e.key,domain:t}),a(``)}catch(e){s(e instanceof Error?e.message:String(e))}finally{l(!1)}}}async function f(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:ce()}),(0,X.jsxs)(`div`,{className:`oc-chart-mine__domains-body`,children:[(0,X.jsx)(`div`,{className:`oc-chart-avail__groups`,children:u.length===0?(0,X.jsx)(`span`,{className:`oc-show__desc`,children:it()}):u.map(e=>(0,X.jsxs)(R,{variant:`secondary`,className:`oc-chart-avail__chip`,children:[e,(0,X.jsx)(`button`,{type:`button`,className:`oc-chart-avail__chip-x`,"aria-label":ve({domain:e}),onClick:()=>void f(e),children:(0,X.jsx)(j,{className:`size-3`})})]},e))}),(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsx)(z,{value:i,onChange:e=>a(e.target.value),placeholder:Ce(),className:`oc-chart-mine__domains-input`,onKeyDown:e=>{e.key===`Enter`&&d()}}),(0,X.jsx)(M,{variant:`outline`,size:`sm`,disabled:c,onClick:()=>void d(),children:lt()})]}),(0,X.jsx)(`span`,{className:`oc-show__desc`,children:st()}),o?(0,X.jsx)(`p`,{className:`oc-chart-import__error`,children:o}):null]})]})}function $(e){let t={...e};return delete t.bpm,JSON.stringify(t,null,2)}function rn({chart:e}){let t=O(E.charts.updateChart),n=O(E.charts.deleteChart),[r,i]=(0,Y.useState)(!1),[a,o]=(0,Y.useState)(e.name),[s,c]=(0,Y.useState)(()=>$(e.tokens)),[l,u]=(0,Y.useState)(e.tokens.bpm??0),[d,f]=(0,Y.useState)(null),[m,h]=(0,Y.useState)(!1);function _(){o(e.name),c($(e.tokens)),u(e.tokens.bpm??0),f(null),i(!0)}async function y(){if(e.chartId===void 0)return;f(null);let n;try{n=JSON.parse(s)}catch{f(x());return}if(n&&typeof n==`object`&&!Array.isArray(n)){let e=n;l>0?e.bpm=l:delete e.bpm}h(!0);try{await t({chartId:e.chartId,name:a.trim(),tokens:n}),i(!1)}catch(e){f(e instanceof Error?e.message:String(e))}finally{h(!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:r?null:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(M,{variant:`outline`,size:`sm`,onClick:_,children:ee()}),(0,X.jsx)(M,{variant:`ghost`,size:`sm`,onClick:()=>void b(),children:g()})]})})]}),r?(0,X.jsxs)(`div`,{className:`oc-chart-mine__editor`,children:[(0,X.jsxs)(`label`,{className:`oc-chart-import__field`,children:[(0,X.jsx)(`span`,{className:`oc-chart-import__label`,children:Ue()}),(0,X.jsx)(z,{value:a,onChange:e=>o(e.target.value),maxLength:60})]}),(0,X.jsxs)(`div`,{className:`oc-chart-import__field`,children:[(0,X.jsx)(`span`,{className:`oc-chart-import__label`,children:v()}),(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:l,onChange:e=>u(Number(e.target.value)),"aria-label":v()}),(0,X.jsx)(`span`,{className:`oc-chart-bpm__value`,children:l===0?p():`${l} BPM`})]}),(0,X.jsx)(`span`,{className:`oc-show__desc`,children:fe()})]}),(0,X.jsxs)(`label`,{className:`oc-chart-import__field`,children:[(0,X.jsx)(`span`,{className:`oc-chart-import__label`,children:Ye()}),(0,X.jsx)(`textarea`,{className:`oc-chart-import__textarea`,value:s,onChange:e=>c(e.target.value),rows:10,spellCheck:!1})]}),d?(0,X.jsx)(`p`,{className:`oc-chart-import__error`,children:d}):null,(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsx)(M,{size:`sm`,disabled:m,onClick:()=>void y(),children:Me()}),(0,X.jsx)(M,{variant:`ghost`,size:`sm`,onClick:()=>i(!1),children:Pe()})]})]}):null,(0,X.jsx)(tn,{chart:e}),(0,X.jsx)(nn,{chart:e})]})}function an(){let e=C(E.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:a()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:ut()})]}),e!==void 0&&t.length===0?(0,X.jsx)(`p`,{className:`oc-show__desc`,children:oe()}):(0,X.jsx)(`div`,{className:`oc-chart-mine-list`,children:t.map(e=>(0,X.jsx)(rn,{chart:e},e.key))})]})}function on({chart:e,groups:t}){let n=O(E.charts.addChartToGroupPool),i=O(E.charts.removeChartFromGroupPool),a=e.restrictedToGroups,o=e.poolGroups,s=new Set((o??[]).map(e=>e.groupId)),c=t.filter(e=>!s.has(e._id));async function l(t){try{await n({groupId:t,chartKey:e.key})}catch{}}async function u(t){try{await i({groupId:t,chartKey:e.key})}catch{}}return(0,X.jsxs)(`div`,{className:`oc-chart-avail`,children:[(0,X.jsxs)(`div`,{className:`oc-chart-avail__head`,children:[(0,X.jsx)(`span`,{className:`oc-chart-avail__name`,children:e.name}),(0,X.jsx)(R,{variant:a?`secondary`:`outline`,className:`oc-chart-avail__state`,children:a?Ze():e.kind===`custom`&&e.scope===`personal`?S():Fe()}),e.isGlobalDefault?(0,X.jsx)(R,{variant:`default`,children:Ge()}):null]}),(0,X.jsxs)(`div`,{className:`oc-chart-avail__groups`,children:[(0,X.jsx)(`span`,{className:`oc-chart-mine__groups-label`,children:ke()}),(o??[]).map(e=>(0,X.jsxs)(R,{variant:`secondary`,className:`oc-chart-avail__chip`,children:[e.name,(0,X.jsx)(`button`,{type:`button`,className:`oc-chart-avail__chip-x`,"aria-label":ae({group:e.name}),onClick:()=>void u(e.groupId),children:(0,X.jsx)(j,{className:`size-3`})})]},e.groupId)),c.length>0?(0,X.jsxs)(W,{value:``,onValueChange:e=>void l(e),children:[(0,X.jsx)(I,{size:`sm`,className:`w-56`,children:(0,X.jsx)(N,{placeholder:r()})}),(0,X.jsx)(V,{children:c.map(e=>(0,X.jsx)(U,{value:e._id,children:e.name},e._id))})]}):t.length===0?(0,X.jsx)(`span`,{className:`oc-show__desc`,children:et()}):null]})]})}function sn({chart:e}){let t=O(E.charts.promoteChartToCommon),n=O(E.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)(R,{variant:e.scope===`common`?`outline`:`secondary`,children:e.scope===`common`?$e():S()}),e.ownerLabel?(0,X.jsx)(`span`,{className:`oc-show__desc`,children:Ve({owner:e.ownerLabel})}):null]}),(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[e.scope===`personal`?(0,X.jsx)(M,{variant:`outline`,size:`sm`,onClick:()=>void r(),children:qe()}):null,(0,X.jsx)(M,{variant:`ghost`,size:`sm`,onClick:()=>void i(),children:xe()})]})]})}function cn({defaultThemeMode:e,defaultLocale:t,defaultChartKey:n}){let r=O(E.admin.setDefaultThemeMode),i=O(E.admin.setDefaultLocale),a=O(E.charts.setDefaultChart),s=C(E.charts.listChartsAdmin),c=C(E.groups.listGroups,{}),l=e??`system`,d=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:Se()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:ct()})]}),(0,X.jsxs)(`section`,{className:`oc-show__section`,children:[(0,X.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,X.jsx)(`h3`,{className:`oc-show__title`,children:tt()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:Be()})]}),(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsx)(M,{variant:n===null?`default`:`outline`,size:`sm`,onClick:()=>void a({name:null}),children:T()}),ht.map(e=>(0,X.jsx)(M,{variant:n===e.key?`default`:`outline`,size:`sm`,onClick:()=>void a({name:e.key}),children:e.name},e.key)),(s??[]).filter(e=>e.kind===`custom`&&e.scope===`common`).map(e=>(0,X.jsx)(M,{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:we()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:Qe()})]}),(0,X.jsx)(`div`,{className:`oc-chart-avail-list`,children:(s??[]).filter(e=>!(e.kind===`custom`&&e.scope===`common`)).map(e=>(0,X.jsx)(on,{chart:e,groups:c??[]},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:ye()})]}),(0,X.jsx)(`div`,{className:`oc-chart-avail-list`,children:(s??[]).filter(e=>e.kind===`builtin`||e.scope===`common`).map(e=>(0,X.jsxs)(`div`,{className:`oc-chart-avail`,children:[(0,X.jsx)(`div`,{className:`oc-chart-avail__head`,children:(0,X.jsx)(`span`,{className:`oc-chart-avail__name`,children:e.name})}),(0,X.jsx)(nn,{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:Oe()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:nt()})]}),(()=>{let e=(s??[]).filter(e=>e.kind===`custom`);return e.length===0?(0,X.jsx)(`p`,{className:`oc-show__desc`,children:Ie()}):(0,X.jsx)(`div`,{className:`oc-chart-avail-list`,children:e.map(e=>(0,X.jsx)(sn,{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:u()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:le()})]}),(0,X.jsx)(`div`,{className:`oc-show__row`,children:[`light`,`dark`,`system`].map(e=>(0,X.jsx)(M,{variant:l===e?`default`:`outline`,size:`sm`,onClick:()=>void r({mode:e}),children:Yt(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:at()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:o()})]}),(0,X.jsx)(`div`,{className:`oc-show__row`,children:[`fr`,`en`].map(e=>(0,X.jsx)(M,{variant:d===e?`default`:`outline`,size:`sm`,onClick:()=>void i({locale:e}),children:e===`fr`?Ae():Ee()},e))}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:se()})]})]})}function ln(){let e=C(E.me.getMe,{host:H}),t=gt(e?.resolvedThemeMode);return(0,X.jsxs)(`div`,{className:`oc-appearance`,children:[(0,X.jsx)($t,{selectedKey:e?.chartKey??null,resolvedMode:t}),(0,X.jsx)(en,{}),(0,X.jsx)(an,{}),e?.role===`admin`?(0,X.jsx)(cn,{defaultThemeMode:e.defaultThemeMode,defaultLocale:e.defaultLocale,defaultChartKey:e.defaultChartKey}):null]})}function un(){let[e,t]=(0,Y.useState)(!0),[n,r]=(0,Y.useState)(`per-user`),[i,a]=(0,Y.useState)(``),[o,s]=(0,Y.useState)(Z),[c,l]=(0,Y.useState)(Z),[u,d]=(0,Y.useState)(qt),f=i!==``||o!==Z||c!==Z;function p(){a(``),s(Z),l(Z),d(qt)}return(0,X.jsxs)(`div`,{className:`oc-show`,children:[(0,X.jsx)(ln,{}),(0,X.jsxs)(`details`,{className:`oc-show__ref`,children:[(0,X.jsx)(`summary`,{className:`oc-show__title`,children:ot()}),(0,X.jsxs)(Q,{title:`Buttons`,description:`Variants`,children:[(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsx)(M,{children:`Default`}),(0,X.jsx)(M,{variant:`secondary`,children:`Secondary`}),(0,X.jsx)(M,{variant:`outline`,children:`Outline`}),(0,X.jsx)(M,{variant:`ghost`,children:`Ghost`}),(0,X.jsx)(M,{variant:`destructive`,children:`Destructive`}),(0,X.jsx)(M,{variant:`link`,children:`Link`})]}),(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsx)(M,{size:`sm`,children:`Small`}),(0,X.jsx)(M,{children:`Default`}),(0,X.jsx)(M,{size:`lg`,children:`Large`}),(0,X.jsx)(M,{size:`icon`,"aria-label":`more`,children:(0,X.jsx)(L,{})}),(0,X.jsx)(M,{disabled:!0,children:`Disabled`})]})]}),(0,X.jsx)(Q,{title:`Badges`,children:(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsx)(R,{children:`Default`}),(0,X.jsx)(R,{variant:`secondary`,children:`Secondary`}),(0,X.jsx)(R,{variant:`outline`,children:`Outline`}),(0,X.jsx)(R,{variant:`destructive`,children:`Destructive`})]})}),(0,X.jsx)(Q,{title:`Inputs & selection`,children:(0,X.jsxs)(`div`,{className:`oc-show__row oc-show__row--col`,children:[(0,X.jsx)(z,{placeholder:`Text input…`}),(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsxs)(W,{value:n,onValueChange:r,children:[(0,X.jsx)(I,{className:`w-56`,children:(0,X.jsx)(N,{placeholder:`Select…`})}),(0,X.jsxs)(V,{children:[(0,X.jsx)(U,{value:`per-user`,children:`per-user (chacun son agent)`}),(0,X.jsx)(U,{value:`shared`,children:`shared (agent commun)`})]})]}),(0,X.jsxs)(`label`,{className:`oc-show__check`,children:[(0,X.jsx)(B,{checked:e,onCheckedChange:e=>t(!!e)}),`Checkbox`]})]})]})}),(0,X.jsx)(Q,{title:`Filtres & plage temporelle`,description:`Barre réutilisable (recherche debouncée + selects rapides à largeur auto + plage façon Grafana) et constructeur de filtre avancé. Câblée dans Users, Groups, Comptes de service, Traces, Anomalies, Audit et KPI.`,children:(0,X.jsxs)(`div`,{className:`oc-show__row oc-show__row--col`,children:[(0,X.jsxs)(Ot,{q:i,onQChange:a,searchPlaceholder:`Rechercher (kind, principal, rôle, route…)`,timeRange:u,onTimeRangeChange:d,onReset:p,canReset:f,children:[(0,X.jsxs)(W,{value:o,onValueChange:s,children:[(0,X.jsx)(I,{size:`sm`,children:(0,X.jsx)(N,{})}),(0,X.jsxs)(V,{children:[(0,X.jsx)(U,{value:Z,children:`Toutes directions`}),(0,X.jsx)(U,{value:`inbound`,children:`inbound`}),(0,X.jsx)(U,{value:`outbound`,children:`outbound`}),(0,X.jsx)(U,{value:`internal`,children:`internal`})]})]}),(0,X.jsxs)(W,{value:c,onValueChange:l,children:[(0,X.jsx)(I,{size:`sm`,children:(0,X.jsx)(N,{})}),(0,X.jsxs)(V,{children:[(0,X.jsx)(U,{value:Z,children:`Toutes sévérités`}),(0,X.jsx)(U,{value:`info`,children:`info`}),(0,X.jsx)(U,{value:`warn`,children:`warn`}),(0,X.jsx)(U,{value:`critical`,children:`critical`})]})]})]}),(0,X.jsx)(kt,{fields:Jt,onChange:()=>{}}),(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsx)(`span`,{className:`oc-show__desc`,children:`Sélecteur de plage seul :`}),(0,X.jsx)(Dt,{value:u,onChange:d})]})]})}),(0,X.jsx)(Q,{title:`Dropdown menu`,description:`Row actions / kebab`,children:(0,X.jsxs)(pt,{children:[(0,X.jsx)(mt,{asChild:!0,children:(0,X.jsx)(M,{variant:`outline`,size:`icon`,"aria-label":`Open menu`,children:(0,X.jsx)(L,{})})}),(0,X.jsxs)(ft,{align:`start`,children:[(0,X.jsx)(_t,{children:`Actions`}),(0,X.jsx)(P,{}),(0,X.jsx)(F,{children:`Edit`}),(0,X.jsx)(F,{children:`Duplicate`}),(0,X.jsx)(P,{}),(0,X.jsx)(F,{variant:`destructive`,children:`Delete`})]})]})}),(0,X.jsx)(Q,{title:`Card`,children:(0,X.jsxs)(Ct,{className:`w-80`,children:[(0,X.jsxs)(vt,{children:[(0,X.jsx)(xt,{children:`Instance`}),(0,X.jsx)(St,{children:`Non-secret metadata only.`})]}),(0,X.jsx)(bt,{className:`text-sm text-muted-foreground`,children:`ws://gateway.example.org:18789`}),(0,X.jsxs)(yt,{className:`gap-2`,children:[(0,X.jsx)(M,{size:`sm`,children:`Save`}),(0,X.jsx)(M,{size:`sm`,variant:`ghost`,children:`Cancel`})]})]})}),(0,X.jsx)(Q,{title:`Table`,children:(0,X.jsxs)(Et,{children:[(0,X.jsx)(wt,{children:(0,X.jsxs)(K,{children:[(0,X.jsx)(G,{className:`w-8`,children:(0,X.jsx)(B,{"aria-label":`select all`})}),(0,X.jsx)(G,{children:`Name`}),(0,X.jsx)(G,{children:`Mode`}),(0,X.jsx)(G,{className:`text-right`,children:`Status`}),(0,X.jsx)(G,{className:`w-8`})]})}),(0,X.jsx)(Tt,{children:[{n:`admins`,m:`per-user`,s:`active`},{n:`family`,m:`shared`,s:`active`}].map(e=>(0,X.jsxs)(K,{children:[(0,X.jsx)(q,{children:(0,X.jsx)(B,{"aria-label":`select ${e.n}`})}),(0,X.jsx)(q,{className:`font-medium`,children:e.n}),(0,X.jsx)(q,{children:(0,X.jsx)(R,{variant:`secondary`,children:e.m})}),(0,X.jsx)(q,{className:`text-right`,children:(0,X.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-muted-foreground`,children:[(0,X.jsx)(A,{className:`size-3.5`}),` `,e.s]})}),(0,X.jsx)(q,{children:(0,X.jsx)(M,{variant:`ghost`,size:`icon`,"aria-label":`row actions`,children:(0,X.jsx)(L,{})})})]},e.n))})]})}),(0,X.jsx)(Q,{title:`App fragments`,description:`Chat-specific components`,children:(0,X.jsxs)(`div`,{className:`oc-show__row oc-show__row--col`,children:[(0,X.jsx)(`div`,{className:`oc-msg oc-msg--assistant`,children:(0,X.jsx)(`div`,{className:`oc-msg__body`,children:`Assistant message bubble.`})}),(0,X.jsx)(`div`,{className:`oc-tool oc-tool--completed`,children:(0,X.jsxs)(`div`,{className:`oc-tool__header`,children:[(0,X.jsx)(`span`,{className:`oc-tool__icon`,children:`✓`}),(0,X.jsx)(`span`,{className:`oc-tool__name`,children:`write-file`}),(0,X.jsx)(`span`,{className:`oc-tool__phase`,children:`completed`})]})}),(0,X.jsxs)(`div`,{className:`oc-run-status oc-run-status--streaming`,children:[(0,X.jsx)(`span`,{className:`oc-run-status__dot`}),(0,X.jsx)(`span`,{className:`oc-run-status__label`,children:`Running`})]})]})})]})]})}export{un as ThemeShowroom};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$b as r,$f as i,Bb as a,Bf as o,Cb as s,Db as c,Eb as l,Fb as u,Gb as d,Gf as f,Hb as p,Hf as m,Ib as h,Jb as g,Jf as _,Kb as ee,Kf as v,Lb as y,Lf as b,Nb as x,Ob as S,Pb as C,Qb as w,Qf as te,Rb as ne,Rf as re,Sb as ie,Tb as ae,Ub as oe,Uf as se,Vb as T,Vf as ce,Wb as E,Wf as le,Xb as D,Xf as ue,Yb as O,Yf as de,Zb as k,Zf as fe,_b as A,_p as pe,aO as j,ap as me,bb as M,bp as he,cp as ge,dO as N,dp as _e,ep as ve,ex as P,fp as ye,gb as F,gp as be,hb as xe,hp as Se,iO as I,ip as Ce,lp as we,mb as L,mp as Te,np as Ee,nx as De,op as Oe,pp as ke,qb as Ae,qf as je,rp as Me,rx as Ne,sp as Pe,tp as Fe,tx as Ie,uO as R,up as Le,vb as Re,vp as ze,wb as Be,xb as Ve,xp as He,yb as Ue,yp as We,zb as Ge,zf as Ke}from"./dist-B-U7A_Kp.js";import{n as qe}from"./dist-C_wXViAC.js";import{t as Je}from"./x-Dl0sHEar.js";import{i as z,n as B,r as Ye,t as Xe}from"./tabs-DTsAt8vZ.js";import{t as V}from"./button-CoB18od4.js";import{$ as Ze,C as H,Ct as Qe,Dt as $e,Mt as et,Q as tt,S as U,X as W,a as nt,b as G,et as rt,i as it,jt as at,k as ot,nt as st,o as ct,ot as lt,r as ut,rt as dt,wt as ft,x as K,y as q}from"./index-B6IXWbc8.js";import{n as pt}from"./TimeRangePicker-CAhWZBEI.js";import{t as mt}from"./FilterBar-BBJk4kP8.js";import{t as ht}from"./AdvancedFilter-BOBkqtk6.js";import{t as gt}from"./DataTableShell-DRaoMzdi.js";var _t=j(`eye-off`,[[`path`,{d:`M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49`,key:`ct8e1f`}],[`path`,{d:`M14.084 14.158a3 3 0 0 1-4.242-4.242`,key:`151rxh`}],[`path`,{d:`M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143`,key:`13bj9a`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}]]),vt=j(`scroll-text`,[[`path`,{d:`M15 12h-5`,key:`r7krc0`}],[`path`,{d:`M15 8h-5`,key:`1khuty`}],[`path`,{d:`M19 17V5a2 2 0 0 0-2-2H4`,key:`zz82l3`}],[`path`,{d:`M8 21h12a2 2 0 0 0 2-2v-1a1 1 0 0 0-1-1H11a1 1 0 0 0-1 1v1a2 2 0 1 1-4 0V5a2 2 0 1 0-4 0v2a1 1 0 0 0 1 1h3`,key:`1ph1d7`}]]),J=t(e(),1),Y=n(),X={kind:`relative`,from:`now-520w`,to:`now`},Z=e=>e===null?`-`:String(Math.round(e));function yt(e){let t=e.indexOf(`:`);if(t<0)return e;let n=e.slice(0,t),r=e.slice(t+1);return n===`admin`?ne():n===`agent`?`${y()} - ${r}`:e}function bt(){let e=N(I.me.getMe,{host:lt})?.role===`admin`,t=N(I.deliveryTiming.getDeliveryStatus,{}),n=R(I.deliveryTiming.startDeliveryRecord),i=R(I.deliveryTiming.stopDeliveryRecord),[a,o]=(0,J.useState)(!1),[s,c]=(0,J.useState)(!1),l=t?.recording??!1,u=async()=>{c(!0);try{l?await i({}):await n({})}finally{c(!1)}};return(0,Y.jsxs)(`section`,{className:`mb-4 flex flex-col gap-3 rounded-lg border border-border p-4`,children:[(0,Y.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`h3`,{className:`text-sm font-semibold`,children:Ne()}),(0,Y.jsx)(`p`,{className:`oc-admin__hint`,children:De()})]}),e?(0,Y.jsx)(V,{variant:l?`destructive`:`default`,size:`sm`,disabled:s||t===void 0,onClick:()=>void u(),children:l?P():Ie()}):null]}),l?(0,Y.jsxs)(`p`,{className:`flex items-center gap-2 text-sm`,children:[(0,Y.jsx)(W,{variant:`secondary`,children:r()}),t?.startedAt?(0,Y.jsx)(`span`,{className:`text-muted-foreground`,children:w({time:new Date(t.startedAt).toLocaleTimeString()})}):null]}):null,(0,Y.jsx)(`div`,{children:(0,Y.jsx)(V,{variant:`outline`,size:`sm`,onClick:()=>o(e=>!e),children:a?O():D()})}),a?(0,Y.jsx)(xt,{isAdmin:e}):null]})}function xt({isAdmin:e}){let t=N(I.deliveryTiming.listDeliverySessions,{}),n=R(I.deliveryTiming.deleteDeliverySessions),[r,i]=(0,J.useState)(``),[o,s]=(0,J.useState)(`all`),[c,l]=(0,J.useState)(X),[f,m]=(0,J.useState)(null),{from:_,to:v}=pt(c),y=c.to===`now`?1/0:v,b=r.trim()!==``||o!==`all`||c!==X,x=()=>{i(``),s(`all`),l(X)},S=(0,J.useMemo)(()=>{if(t===void 0)return;let e=r.trim().toLowerCase();return t.filter(t=>(e===``||t.startedBy.toLowerCase().includes(e))&&(o===`all`||(o===`active`?t.active:!t.active))&&t.startedAt>=_&&t.startedAt<=y).map(e=>({...e,_id:e.sessionId}))},[t,r,o,_,y]),w=e=>{let t=new Set((S??[]).map(e=>e.sessionId)),r=e.filter(e=>t.has(e));r.length!==0&&(n({sessionIds:r}),f!==null&&r.includes(f)&&m(null))};return(0,Y.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Y.jsx)(mt,{q:r,onQChange:i,searchPlaceholder:Ae(),timeRange:c,onTimeRangeChange:l,onReset:x,canReset:b,children:(0,Y.jsxs)(q,{value:o,onValueChange:e=>s(e),children:[(0,Y.jsx)(U,{size:`sm`,className:`w-36`,children:(0,Y.jsx)(H,{})}),(0,Y.jsxs)(G,{children:[(0,Y.jsx)(K,{value:`all`,children:ee()}),(0,Y.jsx)(K,{value:`active`,children:d()}),(0,Y.jsx)(K,{value:`stopped`,children:E()})]})]})}),(0,Y.jsx)(gt,{title:g(),rows:S,emptyHint:xe(),columns:[{header:``,className:`w-8`,cell:e=>(0,Y.jsx)(V,{variant:`ghost`,size:`icon`,"aria-label":f===e.sessionId?u():h(),onClick:()=>m(t=>t===e.sessionId?null:e.sessionId),children:f===e.sessionId?(0,Y.jsx)(_t,{size:15,"aria-hidden":!0}):(0,Y.jsx)(ft,{size:15,"aria-hidden":!0})})},{header:oe(),sort:e=>e.startedAt,cell:e=>(0,Y.jsx)(`span`,{className:`tabular-nums`,children:new Date(e.startedAt).toLocaleString()})},{header:p(),sort:e=>e.stoppedAt,cell:e=>e.stoppedAt===null?(0,Y.jsx)(`span`,{className:`text-muted-foreground`,children:`-`}):(0,Y.jsx)(`span`,{className:`tabular-nums`,children:new Date(e.stoppedAt).toLocaleString()})},{header:T(),sort:e=>e.count,cell:e=>(0,Y.jsx)(`span`,{className:`tabular-nums`,children:Z(e.count)})},{header:a(),sort:e=>e.startedBy,cell:e=>yt(e.startedBy)},{header:Ge(),sort:e=>e.active,cell:e=>e.active?(0,Y.jsx)(W,{variant:`secondary`,children:d()}):(0,Y.jsx)(`span`,{className:`text-muted-foreground`,children:E()})}],rowActions:e?e=>[{label:C(),variant:`destructive`,onSelect:()=>w([e.sessionId])}]:void 0,bulkActions:e?[{label:C(),variant:`destructive`,onSelect:e=>w(e)}]:void 0,isExpanded:e=>e.sessionId===f,renderExpanded:e=>(0,Y.jsx)(St,{sessionId:e.sessionId})})]})}function St({sessionId:e}){let t=N(I.deliveryTiming.getDeliveryReport,{sessionId:e}),[n,r]=(0,J.useState)(!1);return(0,Y.jsx)(Ct,{report:t,copied:n,onCopy:()=>{t&&navigator.clipboard?.writeText(ot(t)).then(()=>{r(!0),window.setTimeout(()=>r(!1),1200)}).catch(()=>{})}})}function Ct({report:e,copied:t,onCopy:n}){if(!e)return(0,Y.jsx)(`p`,{className:`oc-admin__hint`,children:x()});if(e.count===0||e.segments===null)return(0,Y.jsx)(`p`,{className:`oc-admin__hint`,children:k()});let r=e.segments,i=(e,t)=>(0,Y.jsxs)(`tr`,{className:`border-t border-border`,children:[(0,Y.jsx)(`td`,{className:`py-1`,children:e}),(0,Y.jsx)(`td`,{className:`py-1 text-right tabular-nums`,children:t.count}),(0,Y.jsxs)(`td`,{className:`py-1 text-right tabular-nums`,children:[Z(t.p50),` / `,Z(t.p95),` / `,Z(t.max)]})]});return(0,Y.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,Y.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[e.count,` `,L()]}),(0,Y.jsxs)(V,{variant:`outline`,size:`sm`,onClick:n,children:[t?(0,Y.jsx)(qe,{size:13,"aria-hidden":!0}):(0,Y.jsx)($e,{size:13,"aria-hidden":!0}),t?F():A()]})]}),(0,Y.jsxs)(`table`,{className:`w-full text-sm`,children:[(0,Y.jsx)(`thead`,{children:(0,Y.jsxs)(`tr`,{className:`text-left text-muted-foreground`,children:[(0,Y.jsx)(`th`,{className:`py-1 font-medium`,children:l()}),(0,Y.jsx)(`th`,{className:`py-1 text-right font-medium`,children:ae()}),(0,Y.jsx)(`th`,{className:`py-1 text-right font-medium`,children:Be()})]})}),(0,Y.jsxs)(`tbody`,{children:[i(s(),r.bridge),i(ie(),r.A),i(Ve(),r.C)]})]}),(0,Y.jsx)(`p`,{className:`oc-admin__hint`,children:M()}),e.truncated?(0,Y.jsx)(`p`,{className:`oc-admin__hint`,children:Re()}):null,(0,Y.jsx)(`p`,{className:`oc-admin__hint`,children:Ue()})]})}var wt=[50,100,200,500],Tt=`all`,Q=`__all__`,Et=[`2xx`,`4xx`,`5xx`],Dt=[`user`,`service`,`system`],Ot=[`inbound`,`outbound`,`internal`],kt={kind:`relative`,from:`now-30d`,to:`now`},At=[{value:`kind`,label:`kind`},{value:`status`,label:`status`},{value:`latencyMs`,label:`latence (ms)`},{value:`principalType`,label:`principal`},{value:`direction`,label:`direction`},{value:`roleKey`,label:`rôle`},{value:`route`,label:`route`},{value:`correlationId`,label:`correlationId`}];function jt(){let e=et({from:`/settings/traces`}),t=at({from:`/settings/traces`}),n=e.limit,r=e.kind,a=e.statusClass??Q,s=e.principalType??Q,l=e.direction??Q,u=e.roleKey??Q,d=e.q??``,p=ut(e.from,e.to),h=(0,J.useMemo)(()=>ct(e.adv),[e.adv]),{from:g,to:ee}=pt(p),[y,b]=(0,J.useState)(null),[x,C]=(0,J.useState)(null),w=e=>void t({search:t=>({...t,limit:e})}),ne=e=>void t({search:t=>({...t,kind:e})}),re=e=>void t({search:t=>({...t,q:e||void 0}),replace:!0}),ie=e=>void t({search:t=>({...t,statusClass:e===Q?void 0:e})}),ae=e=>void t({search:t=>({...t,principalType:e===Q?void 0:e})}),oe=e=>void t({search:t=>({...t,direction:e===Q?void 0:e})}),T=e=>void t({search:t=>({...t,roleKey:e===Q?void 0:e})}),E=e=>void t({search:t=>({...t,...nt(e)})}),D=e=>void t({search:t=>({...t,adv:it(e)}),replace:!0}),O=N(I.observability.listEvents,{limit:n}),k=N(I.observability.listEvents,{limit:n,kind:r===Tt?void 0:r,filter:{q:d||void 0,from:g,to:ee,statusClass:a===Q?void 0:a,principalType:s===Q?void 0:s,direction:l===Q?void 0:l,roleKey:u===Q?void 0:u,advanced:h.length>0?h:void 0}}),A=(0,J.useMemo)(()=>{let e=new Set;for(let t of O??[])e.add(t.kind);return[...e].sort()},[O]),j=(0,J.useMemo)(()=>{let e=new Set;for(let t of O??[])t.roleKey&&e.add(t.roleKey);return[...e].sort()},[O]),M=d!==``||a!==Q||s!==Q||l!==Q||u!==Q||h.length>0||p.kind!==`relative`||p.from!==kt.from;function P(){t({search:{limit:100,kind:`all`},replace:!0})}let F=y?O?.filter(e=>e.correlationId===y):k,[xe,L]=(0,J.useState)(`events`);return(0,Y.jsxs)(Xe,{value:xe,onValueChange:e=>L(e),children:[(0,Y.jsxs)(Ye,{className:`w-full`,children:[(0,Y.jsxs)(z,{value:`latency`,className:`flex-1 gap-1.5`,children:[(0,Y.jsx)(Qe,{size:13,"aria-hidden":!0}),S()]}),(0,Y.jsxs)(z,{value:`events`,className:`flex-1 gap-1.5`,children:[(0,Y.jsx)(vt,{size:13,"aria-hidden":!0}),c()]})]}),(0,Y.jsx)(B,{value:`latency`,children:(0,Y.jsx)(bt,{})}),(0,Y.jsxs)(B,{value:`events`,className:`flex flex-col gap-3`,children:[(0,Y.jsxs)(`p`,{className:`oc-admin__hint`,children:[He(),(0,Y.jsx)(`strong`,{children:he()}),We(),` `,(0,Y.jsx)(`span`,{className:`oc-filter__window`,children:ze()})]}),(0,Y.jsxs)(mt,{q:d,onQChange:re,searchPlaceholder:pe(),timeRange:p,onTimeRangeChange:E,onReset:P,canReset:M,children:[(0,Y.jsxs)(q,{value:a,onValueChange:ie,children:[(0,Y.jsx)(U,{size:`sm`,className:`w-32`,children:(0,Y.jsx)(H,{placeholder:be()})}),(0,Y.jsxs)(G,{children:[(0,Y.jsx)(K,{value:Q,children:Se()}),Et.map(e=>(0,Y.jsx)(K,{value:e,children:e},e))]})]}),(0,Y.jsxs)(q,{value:s,onValueChange:ae,children:[(0,Y.jsx)(U,{size:`sm`,className:`w-32`,children:(0,Y.jsx)(H,{placeholder:Te()})}),(0,Y.jsxs)(G,{children:[(0,Y.jsx)(K,{value:Q,children:ke()}),Dt.map(e=>(0,Y.jsx)(K,{value:e,children:e},e))]})]}),(0,Y.jsxs)(q,{value:l,onValueChange:oe,children:[(0,Y.jsx)(U,{size:`sm`,className:`w-32`,children:(0,Y.jsx)(H,{placeholder:ye()})}),(0,Y.jsxs)(G,{children:[(0,Y.jsx)(K,{value:Q,children:_e()}),Ot.map(e=>(0,Y.jsx)(K,{value:e,children:e},e))]})]}),(0,Y.jsxs)(q,{value:u,onValueChange:T,children:[(0,Y.jsx)(U,{size:`sm`,className:`w-36`,children:(0,Y.jsx)(H,{placeholder:Le()})}),(0,Y.jsxs)(G,{children:[(0,Y.jsx)(K,{value:Q,children:we()}),j.map(e=>(0,Y.jsx)(K,{value:e,children:e},e))]})]}),(0,Y.jsxs)(q,{value:r,onValueChange:ne,children:[(0,Y.jsx)(U,{size:`sm`,className:`w-44`,children:(0,Y.jsx)(H,{placeholder:ge()})}),(0,Y.jsxs)(G,{children:[(0,Y.jsx)(K,{value:Tt,children:Pe()}),A.map(e=>(0,Y.jsx)(K,{value:e,children:e},e))]})]}),(0,Y.jsxs)(q,{value:String(n),onValueChange:e=>w(Number(e)),children:[(0,Y.jsx)(U,{size:`sm`,className:`w-28`,children:(0,Y.jsx)(H,{})}),(0,Y.jsx)(G,{children:wt.map(e=>(0,Y.jsx)(K,{value:String(e),children:Oe({count:e})},e))})]})]}),(0,Y.jsx)(ht,{fields:At,seed:h,onChange:D}),y?(0,Y.jsx)(`div`,{className:`oc-traces__followline`,children:(0,Y.jsxs)(`button`,{type:`button`,className:`oc-traces__chip`,onClick:()=>b(null),title:me(),children:[(0,Y.jsxs)(`span`,{className:`oc-traces__chip-label`,children:[Ce(),(0,Y.jsx)(`code`,{children:$(y)})]}),(0,Y.jsx)(Je,{className:`oc-traces__chip-x`,"aria-hidden":!0}),(0,Y.jsx)(`span`,{className:`sr-only`,children:Me()})]})}):null,(0,Y.jsx)(gt,{title:Ee(),rows:F,emptyHint:y?Fe():ve(),columns:[{header:i(),sort:e=>e.at,cell:e=>(0,Y.jsx)(`span`,{className:`oc-traces__time`,children:new Date(e.at).toLocaleString(`fr-FR`)})},{header:te(),sort:e=>e.kind,cell:e=>(0,Y.jsx)(W,{variant:`secondary`,children:e.kind})},{header:fe(),sort:e=>Nt(e)??null,cell:e=>{let t=Nt(e);return t?(0,Y.jsxs)(`span`,{className:`oc-traces__fail`,title:t,children:[`✕ `,t]}):(0,Y.jsx)(`span`,{className:`oc-traces__ok`,"aria-label":ue(),children:`✓`})}},{header:de(),sort:e=>e.direction,cell:e=>e.direction?(0,Y.jsx)(W,{variant:`outline`,children:e.direction}):(0,Y.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})},{header:_(),sort:e=>e.principalType,cell:e=>(0,Y.jsxs)(`span`,{className:`oc-traces__principal`,children:[(0,Y.jsx)(W,{variant:`outline`,children:e.principalType}),e.principalId?(0,Y.jsx)(`code`,{className:`oc-traces__mono`,children:$(e.principalId)}):null]})},{header:je(),sort:e=>e.roleKey,cell:e=>e.roleKey?(0,Y.jsx)(W,{variant:`secondary`,children:e.roleKey}):(0,Y.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})},{header:v(),sort:e=>e.route,cell:e=>e.route?(0,Y.jsxs)(`span`,{className:`oc-traces__route`,children:[e.method?(0,Y.jsx)(`span`,{className:`oc-traces__method`,children:e.method}):null,(0,Y.jsx)(`code`,{className:`oc-traces__mono`,children:e.route})]}):(0,Y.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})},{header:f(),sort:e=>e.status,cell:e=>e.status===null?(0,Y.jsx)(`span`,{className:`oc-traces__muted`,children:`—`}):(0,Y.jsx)(`span`,{className:`oc-traces__status ${Mt(e.status)}`,children:e.status})},{header:le(),sort:e=>e.latencyMs,cell:e=>e.latencyMs===null?(0,Y.jsx)(`span`,{className:`oc-traces__muted`,children:`—`}):(0,Y.jsxs)(`span`,{className:`oc-traces__mono`,children:[e.latencyMs,` ms`]})},{header:se(),sort:e=>e.correlationId,cell:e=>e.correlationId?(0,Y.jsx)(`button`,{type:`button`,className:`oc-traces__corr`,title:m(),onClick:()=>b(e.correlationId),children:$(e.correlationId)}):(0,Y.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})},{header:ce(),sort:e=>+!!e.meta,cell:e=>e.meta?(0,Y.jsx)(V,{variant:`outline`,size:`sm`,onClick:()=>C(e),children:o()}):(0,Y.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})}]}),(0,Y.jsx)(Pt,{row:x,onClose:()=>C(null)})]})]})}function Mt(e){return e>=500?`oc-traces__status--5xx`:e>=400?`oc-traces__status--4xx`:e>=200&&e<300?`oc-traces__status--2xx`:`oc-traces__status--other`}function $(e){return e.length>8?e.slice(0,8):e}function Nt(e){if(typeof e.status==`number`&&e.status>=400)return String(e.status);if(!e.meta)return null;try{let t=JSON.parse(e.meta);if(e.kind===`openclaw.dispatch`&&t.dispatchStatus===`failed`)return t.errorCode??`failed`;if(e.kind===`assistant.stream`&&t.phase===`finalize`&&(t.streamStatus===`error`||t.streamStatus===`aborted`))return t.streamStatus;if(e.kind===`openclaw.ingest.denied`)return`denied`}catch{}return null}function Pt({row:e,onClose:t}){let n=(0,J.useMemo)(()=>{if(!e?.meta)return``;try{return JSON.stringify(JSON.parse(e.meta),null,2)}catch{return e.meta}},[e]);return(0,Y.jsx)(tt,{open:e!==null,onOpenChange:e=>{e||t()},children:e?(0,Y.jsxs)(Ze,{className:`max-w-lg`,children:[(0,Y.jsxs)(st,{children:[(0,Y.jsxs)(dt,{className:`oc-traces__meta-title`,children:[Ke(),` `,(0,Y.jsx)(`code`,{children:e.kind}),(0,Y.jsx)(W,{variant:`outline`,children:re()})]}),(0,Y.jsx)(rt,{children:b()})]}),(0,Y.jsx)(`pre`,{className:`oc-traces__meta-json`,children:n})]}):null})}export{jt as TracesTab};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$_ as r,$d as i,A_ as a,B_ as o,F_ as s,G_ as c,H_ as l,I_ as u,J_ as d,K_ as f,L_ as ee,M_ as te,N_ as ne,O_ as re,P_ as p,Q_ as ie,Qd as m,R_ as ae,U_ as oe,V_ as se,W_ as ce,X_ as le,Y_ as ue,Z_ as de,Zd as h,af as g,cf as _,dO as v,ef as y,ev as b,iO as x,if as S,j_ as fe,k_ as pe,l_ as me,lf as C,nf as w,nv as T,of as E,q_ as he,rf as D,sf as O,tf as k,tv as A,uO as j,z_ as ge}from"./dist-B-U7A_Kp.js";import{t as M}from"./button-CoB18od4.js";import{$ as N,A as P,C as F,G as I,K as L,M as R,Mt as _e,Q as z,S as B,W as V,X as H,Y as ve,_ as U,_t as W,b as G,d as K,et as ye,f as be,gt as q,j as xe,jt as Se,nt as Ce,ot as we,p as J,q as Te,rt as Ee,x as Y,y as X}from"./index-B6IXWbc8.js";import{t as De}from"./FilterBar-BBJk4kP8.js";import{t as Oe}from"./DataTableShell-DRaoMzdi.js";import{t as ke}from"./DetailChips-BJRTpKvv.js";var Z=t(e(),1),Q=n();function Ae({profileId:e,userLabel:t,open:n,onOpenChange:r}){let i=v(x.agents.listAgentPoolForUser,n&&e?{profileId:e}:`skip`),a=v(x.agents.listUserAgents,n&&e?{profileId:e}:`skip`),o=new Set((a??[]).map(e=>`${e.instanceName}/${e.agentId}`)),s=(a??[]).find(e=>e.isDefault)??null,c=s?`${s.instanceName}/${s.agentId}`:null,l=new Set((i?.agents??[]).map(e=>`${e.instanceName}/${e.agentId}`)),u=[...(i?.agents??[]).map(e=>({...e,outOfPool:!1})),...(a??[]).filter(e=>!l.has(`${e.instanceName}/${e.agentId}`)).map(e=>({instanceName:e.instanceName,agentId:e.agentId,displayName:e.displayName,emoji:e.emoji,model:e.model,kind:e.kind,state:e.state,outOfPool:!0}))],d=new Map;for(let e of u){let t=d.get(e.instanceName)??[];t.push(e),d.set(e.instanceName,t)}return(0,Q.jsx)(z,{open:n,onOpenChange:r,children:(0,Q.jsxs)(N,{className:`oc-access`,children:[(0,Q.jsxs)(Ce,{children:[(0,Q.jsx)(Ee,{children:C({user:t})}),(0,Q.jsx)(ye,{children:_()})]}),i?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:i.inGroup?O():E()}):null,(0,Q.jsx)(`div`,{className:`oc-access__list`,children:i===void 0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:g()}):u.length===0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:w()}):[...d.entries()].map(([t,n])=>(0,Q.jsx)(je,{profileId:e,instanceName:t,kind:n[0].kind,agents:n,assigned:o,defaultKey:c},t))})]})})}function je({profileId:e,instanceName:t,kind:n,agents:r,assigned:a,defaultKey:o}){let s=j(x.agents.assignAgent),c=j(x.agents.removeAgent),l=j(x.agents.setDefaultAgent),u=P();if(!e)return null;async function d(n,r){try{r?await c({profileId:e,instanceName:t,agentId:n}):await s({profileId:e,instanceName:t,agentId:n})}catch(e){u.error(S(),e)}}async function f(n){try{await l({profileId:e,instanceName:t,agentId:n})}catch(e){u.error(D(),e)}}return(0,Q.jsxs)(`div`,{className:`oc-access__group`,children:[(0,Q.jsxs)(`div`,{className:`oc-access__instance`,children:[(0,Q.jsx)(W,{size:13,"aria-hidden":!0}),(0,Q.jsx)(`span`,{children:t}),(0,Q.jsx)(H,{variant:`outline`,className:`oc-access__kind`,children:n})]}),r.map(e=>{let n=`${t}/${e.agentId}`,r=a.has(n),s=o===n,c=e.state===`deleted`;return(0,Q.jsxs)(`div`,{className:`oc-access__row`,children:[(0,Q.jsx)(U,{checked:r,disabled:c&&!r,onCheckedChange:()=>void d(e.agentId,r),"aria-label":k({name:e.displayName??e.agentId})}),(0,Q.jsxs)(`span`,{className:`oc-access__label`,children:[e.emoji?`${e.emoji} `:``,e.displayName??e.agentId]}),e.model?(0,Q.jsx)(`span`,{className:`oc-access__model`,children:e.model}):null,c?(0,Q.jsx)(H,{variant:`outline`,className:`oc-access__gone`,children:y()}):null,e.outOfPool?(0,Q.jsx)(H,{variant:`outline`,className:`oc-access__gone`,children:i()}):null,r?s?(0,Q.jsx)(`span`,{className:`oc-access__fav`,role:`img`,"aria-label":m(),title:m(),children:(0,Q.jsx)(q,{size:14,fill:`currentColor`})}):(0,Q.jsx)(M,{type:`button`,size:`icon-sm`,variant:`ghost`,className:`oc-access__setdefault`,"aria-label":h(),title:h(),onClick:()=>void f(e.agentId),children:(0,Q.jsx)(q,{size:14})}):null]},e.agentId)})]})}var $=`__all__`;function Me({granted:e,onToggle:t}){let n=new Set(e),r=K.filter(e=>n.has(J[e])).length;return(0,Q.jsxs)(V,{children:[(0,Q.jsx)(ve,{asChild:!0,children:(0,Q.jsx)(M,{variant:`outline`,size:`sm`,className:`h-8 w-36 justify-start font-normal`,children:r===0?T():A({count:r})})}),(0,Q.jsxs)(I,{align:`start`,className:`w-52`,children:[(0,Q.jsx)(Te,{children:b()}),K.map(e=>{let r=J[e];return(0,Q.jsxs)(L,{className:`gap-2`,onSelect:e=>{e.preventDefault(),t(r)},children:[(0,Q.jsx)(U,{checked:n.has(r),"aria-hidden":!0,tabIndex:-1,className:`pointer-events-none`}),(0,Q.jsx)(`span`,{children:be[e]??e})]},e)})]})]})}function Ne(){let e=_e({from:`/settings/users`}),t=Se({from:`/settings/users`}),n=e.q??``,i=e.role??$,m=e=>void t({search:t=>({...t,q:e||void 0}),replace:!0}),h=e=>void t({search:t=>({...t,role:e===$?void 0:e})}),g=v(x.admin.listUsers,{filter:{q:n||void 0,role:i===$?void 0:i},withAgents:!0}),_=v(x.me.getMe,{host:we}),y=j(x.admin.setRole),b=j(x.admin.setUserPermissions),S=j(x.admin.startImpersonation),C=j(x.admin.deleteUser),w=j(x.admin.setUserName),T=xe(),E=R(),D=P(),[O,k]=(0,Z.useState)(null),A=(0,Z.useMemo)(()=>{let e=new Set([`pending`,`user`,`admin`]);for(let t of g??[])e.add(t.role);return[...e]},[g]),M=n!==``||i!==$;function N(){t({search:{},replace:!0})}async function I(e){try{await y(e)}catch(e){D.error(r(),e)}}async function L(e){try{await b(e)}catch(e){D.error(ie(),e)}}async function z(e){let t=e.email||e.name||e.canonical||e.userId.slice(0,8);if(await T({title:c(),description:ce({user:t}),confirmWord:oe(),confirmLabel:l(),destructive:!0}))try{await C({profileId:e._id}),D.success(o({user:t}))}catch(e){D.error(se(),e)}}async function V(e){let t=e.email||e.name||e.userId.slice(0,8),n=await E({title:ae(),label:ee({user:t}),placeholder:u(),defaultValue:e.name??``,confirmLabel:me()});if(n!==null)try{await w({profileId:e._id,name:n}),D.success(s())}catch(e){D.error(p(),e)}}return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(De,{q:n,onQChange:m,searchPlaceholder:de(),onReset:N,canReset:M,children:(0,Q.jsxs)(X,{value:i,onValueChange:h,children:[(0,Q.jsx)(B,{size:`sm`,className:`w-36`,children:(0,Q.jsx)(F,{})}),(0,Q.jsxs)(G,{children:[(0,Q.jsx)(Y,{value:$,children:le()}),A.map(e=>(0,Q.jsx)(Y,{value:e,children:e},e))]})]})}),(0,Q.jsx)(Oe,{title:ue(),rows:g,emptyHint:d(),rowActions:e=>{let t=[{label:re(),onSelect:()=>k({profileId:e._id,label:e.email||e.name||e.canonical||e.userId.slice(0,8)})},{label:ge(),onSelect:()=>void V(e)}];return e.userId!==_?.userId&&t.push({label:he(),onSelect:()=>void S({profileId:e._id})},{label:f(),variant:`destructive`,onSelect:()=>void z(e)}),t},columns:[{header:ne(),cell:e=>{let t=e.email||e.name||e.canonical||e.userId.slice(0,8),n=e.email&&e.name&&e.name!==e.email?e.name:null;return(0,Q.jsxs)(`div`,{className:`flex flex-col`,children:[(0,Q.jsx)(`span`,{children:t}),n?(0,Q.jsx)(`span`,{className:`text-muted-foreground text-xs`,children:n}):null]})},sort:e=>e.email||e.name||e.canonical||e.userId},{header:te(),sort:e=>e.role===`admin`?2:+(e.role===`user`),cell:e=>(0,Q.jsxs)(X,{value:e.role,onValueChange:t=>void I({profileId:e._id,role:t}),children:[(0,Q.jsx)(B,{size:`sm`,className:`w-28`,children:(0,Q.jsx)(F,{})}),(0,Q.jsxs)(G,{children:[(0,Q.jsx)(Y,{value:`pending`,children:`pending`}),(0,Q.jsx)(Y,{value:`user`,children:`user`}),(0,Q.jsx)(Y,{value:`admin`,children:`admin`})]})]})},{header:fe(),sort:e=>e.role===`admin`?9999:e.extraPermissions?.length??0,cell:e=>e.role===`admin`?(0,Q.jsx)(`span`,{className:`text-muted-foreground text-xs`,children:a()}):(0,Q.jsx)(Me,{granted:e.extraPermissions??[],onToggle:t=>{let n=new Set(e.extraPermissions??[]);n.has(t)?n.delete(t):n.add(t),L({profileId:e._id,permissions:[...n]})}})},{header:pe(),cell:e=>(0,Q.jsx)(ke,{icon:(0,Q.jsx)(W,{size:12,"aria-hidden":!0}),total:e.agentCount??0,items:e.agents.map(e=>({label:e}))}),sort:e=>e.agentCount??0}]}),(0,Q.jsx)(Ae,{profileId:O?.profileId??null,userLabel:O?.label??``,open:O!==null,onOpenChange:e=>{e||k(null)}})]})}export{Ne as UsersTab};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as e,r as t}from"./bundle-mjs-C73ZY4La.js";import{$D as n,n as r,t as i}from"./dist-B-U7A_Kp.js";e();var a=t(),o=i(`group/button inline-flex shrink-0 items-center justify-center rounded-lg border border-transparent bg-clip-padding text-sm font-medium whitespace-nowrap transition-all outline-none select-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 active:not-aria-[haspopup]:translate-y-px disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,{variants:{variant:{default:`bg-primary text-primary-foreground hover:bg-primary/80`,outline:`border-border bg-background hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:border-input dark:bg-input/30 dark:hover:bg-input/50`,secondary:`bg-secondary text-secondary-foreground hover:bg-[color-mix(in_oklch,var(--secondary),var(--foreground)_5%)] aria-expanded:bg-secondary aria-expanded:text-secondary-foreground`,ghost:`hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:hover:bg-muted/50`,destructive:`bg-destructive/10 text-destructive hover:bg-destructive/20 focus-visible:border-destructive/40 focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:hover:bg-destructive/30 dark:focus-visible:ring-destructive/40`,link:`text-primary underline-offset-4 hover:underline`},size:{default:`h-8 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2`,xs:`h-6 gap-1 rounded-[min(var(--radius-md),10px)] px-2 text-xs in-data-[slot=button-group]:rounded-lg has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3`,sm:`h-7 gap-1 rounded-[min(var(--radius-md),12px)] px-2.5 text-[0.8rem] in-data-[slot=button-group]:rounded-lg has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3.5`,lg:`h-9 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2`,icon:`size-8`,"icon-xs":`size-6 rounded-[min(var(--radius-md),10px)] in-data-[slot=button-group]:rounded-lg [&_svg:not([class*='size-'])]:size-3`,"icon-sm":`size-7 rounded-[min(var(--radius-md),12px)] in-data-[slot=button-group]:rounded-lg`,"icon-lg":`size-9`}},defaultVariants:{variant:`default`,size:`default`}});function s({className:e,variant:t=`default`,size:i=`default`,asChild:s=!1,...c}){return(0,a.jsx)(s?n:`button`,{"data-slot":`button`,"data-variant":t,"data-size":i,className:r(o({variant:t,size:i,className:e})),...c})}export{o as n,s as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{aO as e}from"./dist-B-U7A_Kp.js";var t=e(`chevrons-up-down`,[[`path`,{d:`m7 15 5 5 5-5`,key:`1hf1tw`}],[`path`,{d:`m7 9 5-5 5 5`,key:`sgt6xg`}]]);export{t};
|