@lacneu/atrium 0.23.0 → 0.25.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-D0FPRjwL.js → AccessTab-DPObL362.js} +1 -1
- package/dist/assets/{AdvancedFilter-CtaYuy-W.js → AdvancedFilter-SyUsoxag.js} +1 -1
- package/dist/assets/AgentFilesTab-BGD4kAbk.js +3 -0
- package/dist/assets/AnomaliesTab-D_GHz68q.js +1 -0
- package/dist/assets/{AuditTab-CeHLEJ6L.js → AuditTab-7VH_0ygv.js} +1 -1
- package/dist/assets/BridgeTab-BFCNmd2S.js +1 -0
- package/dist/assets/ChatDefaultsTab-CgnQ1mjk.js +1 -0
- package/dist/assets/{DataTableShell-VIRQvS8e.js → DataTableShell-CJHDSNd8.js} +1 -1
- package/dist/assets/{DetailChips-YKc12Z-i.js → DetailChips-DZXcy4x8.js} +1 -1
- package/dist/assets/FeedbacksTab-COwyJW_S.js +1 -0
- package/dist/assets/{FieldLabel-BYZOkwDx.js → FieldLabel-DbxkeyLF.js} +1 -1
- package/dist/assets/FilesTab-DT_ugZ6O.js +1 -0
- package/dist/assets/{FilterBar-DWv8wqqC.js → FilterBar-DR1-M_rz.js} +1 -1
- package/dist/assets/GroupsTab-C0p3i-xP.js +1 -0
- package/dist/assets/InstancesTab-CqW60gW6.js +1 -0
- package/dist/assets/IntegrationsTab-CG7skUYX.js +1 -0
- package/dist/assets/KpiTab-CG_InEj6.js +1 -0
- package/dist/assets/PreferencesTab-CKs4bId7.js +1 -0
- package/dist/assets/PromptInjectionsTab-CWVt4aOU.js +3 -0
- package/dist/assets/RolesTab-BOO72Gkp.js +1 -0
- package/dist/assets/ServiceAccountsTab-RXAbUgIh.js +1 -0
- package/dist/assets/{SubAgentReportsTab-24-Vy2sZ.js → SubAgentReportsTab-C4E3BFxa.js} +1 -1
- package/dist/assets/ThemeShowroom-Bow6souM.js +1 -0
- package/dist/assets/{TimeRangePicker-CPM9eoXo.js → TimeRangePicker-DQjAXG44.js} +1 -1
- package/dist/assets/TracesTab-CV0hVN5Z.js +1 -0
- package/dist/assets/UsersTab-DMNjo9il.js +1 -0
- package/dist/assets/{button-9c1aLUeO.js → button-CrkRjd-T.js} +1 -1
- package/dist/assets/{card-DNbBWwxH.js → card-DlAKM9gH.js} +1 -1
- package/dist/assets/chevrons-up-down-BUZg64Ip.js +1 -0
- package/dist/assets/{compatView-DI9WOWM-.js → compatView-BiLj8anr.js} +1 -1
- package/dist/assets/{dispatchErrorInfo-DO5jqFw-.js → dispatchErrorInfo-B8AArkw7.js} +1 -1
- package/dist/assets/dist-BDdbnJdn.js +5 -0
- package/dist/assets/{dist-DsBcH2-2.js → dist-DRXIQewX.js} +1 -1
- package/dist/assets/{dist-DM5LkQcA.js → dist-DS_sZFhE.js} +1 -1
- package/dist/assets/dist-H7gCiaFZ.js +1 -0
- package/dist/assets/{highlighted-body-OFNGDK62-BVpyilpM.js → highlighted-body-OFNGDK62-DodvFtaI.js} +1 -1
- package/dist/assets/{index-CZJySt8-.css → index-DbRDkkXU.css} +1 -1
- package/dist/assets/index-DcMWPy01.js +227 -0
- package/dist/assets/mermaid-GHXKKRXX-COYwG8Lj.js +1 -0
- package/dist/assets/roleDescriptions-n6KA5Mb1.js +1 -0
- package/dist/assets/{table-C2kpo1_K.js → table-3aSLasBW.js} +1 -1
- package/dist/assets/{tabs-D7vYdFs6.js → tabs-JwsMaDCr.js} +1 -1
- package/dist/assets/x-1RyayDYu.js +1 -0
- package/dist/index.html +8 -8
- package/package.json +1 -1
- package/dist/assets/AgentFilesTab-BnrDFGg2.js +0 -3
- package/dist/assets/AnomaliesTab-DbJTYrA3.js +0 -1
- package/dist/assets/BridgeTab-DNaXjHu5.js +0 -1
- package/dist/assets/ChatDefaultsTab-BhhumrcM.js +0 -1
- package/dist/assets/FeedbacksTab-BLyfs_L4.js +0 -1
- package/dist/assets/FilesTab-DYGvOehC.js +0 -1
- package/dist/assets/GroupsTab-BOkc2jks.js +0 -1
- package/dist/assets/InstancesTab-WCkAX_gl.js +0 -1
- package/dist/assets/IntegrationsTab-Bwd59JJJ.js +0 -1
- package/dist/assets/KpiTab-flOR56nE.js +0 -1
- package/dist/assets/PreferencesTab-Ddm8m8BL.js +0 -1
- package/dist/assets/PromptInjectionsTab-CuooI8Zy.js +0 -3
- package/dist/assets/RolesTab-BnF_qq0d.js +0 -1
- package/dist/assets/ServiceAccountsTab-DAeKxzUx.js +0 -1
- package/dist/assets/ThemeShowroom-CaoO1IiG.js +0 -1
- package/dist/assets/TracesTab-C9cfYiBZ.js +0 -1
- package/dist/assets/UsersTab-CtD0iELd.js +0 -1
- package/dist/assets/chevrons-up-down-D_kGoxSO.js +0 -1
- package/dist/assets/dist-BMI7wyIc.js +0 -1
- package/dist/assets/dist-bcnGL3nu.js +0 -5
- package/dist/assets/index-DsOZBPOX.js +0 -227
- package/dist/assets/mermaid-GHXKKRXX-Bf3eJ2-p.js +0 -1
- package/dist/assets/roleDescriptions-eZmrq1l0.js +0 -1
- package/dist/assets/x-CyUGhZ48.js +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{D as e}from"./index-DcMWPy01.js";export{e as Mermaid};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{ah as e,ih as t,oh as n,rh as r,sh as i}from"./dist-DRXIQewX.js";var a={pending:i,user:n,admin:e,observer:t,agent:r};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-DRXIQewX.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{dO as r,iO as i,n as a,nO as o,rO as s,sO as c,t as l,uO as u}from"./dist-DRXIQewX.js";import{t as d}from"./dist-H7gCiaFZ.js";import{dt as f,ft as p,pt as m}from"./index-DcMWPy01.js";var h=t(e(),1),g=n(),_=`Tabs`,[v,y]=c(_,[m]),b=m(),[x,S]=v(_),C=h.forwardRef((e,t)=>{let{__scopeTabs:n,value:a,onValueChange:s,defaultValue:c,orientation:l=`horizontal`,dir:u,activationMode:f=`automatic`,...p}=e,m=d(u),[h,v]=i({prop:a,onChange:s,defaultProp:c??``,caller:_});return(0,g.jsx)(x,{scope:n,baseId:o(),value:h,onValueChange:v,orientation:l,dir:m,activationMode:f,children:(0,g.jsx)(r.div,{dir:m,"data-orientation":l,...p,ref:t})})});C.displayName=_;var w=`TabsList`,T=h.forwardRef((e,t)=>{let{__scopeTabs:n,loop:i=!0,...a}=e,o=S(w,n),s=b(n);return(0,g.jsx)(p,{asChild:!0,...s,orientation:o.orientation,dir:o.dir,loop:i,children:(0,g.jsx)(r.div,{role:`tablist`,"aria-orientation":o.orientation,...a,ref:t})})});T.displayName=w;var E=`TabsTrigger`,D=h.forwardRef((e,t)=>{let{__scopeTabs:n,value:i,disabled:a=!1,...o}=e,s=S(E,n),c=b(n),l=A(s.baseId,i),d=j(s.baseId,i),p=i===s.value;return(0,g.jsx)(f,{asChild:!0,...c,focusable:!a,active:p,children:(0,g.jsx)(r.button,{type:`button`,role:`tab`,"aria-selected":p,"aria-controls":d,"data-state":p?`active`:`inactive`,"data-disabled":a?``:void 0,disabled:a,id:l,...o,ref:t,onMouseDown:u(e.onMouseDown,e=>{!a&&e.button===0&&e.ctrlKey===!1?s.onValueChange(i):e.preventDefault()}),onKeyDown:u(e.onKeyDown,e=>{[` `,`Enter`].includes(e.key)&&s.onValueChange(i)}),onFocus:u(e.onFocus,()=>{let e=s.activationMode!==`manual`;!p&&!a&&e&&s.onValueChange(i)})})})});D.displayName=E;var O=`TabsContent`,k=h.forwardRef((e,t)=>{let{__scopeTabs:n,value:i,forceMount:a,children:o,...c}=e,l=S(O,n),u=A(l.baseId,i),d=j(l.baseId,i),f=i===l.value,p=h.useRef(f);return h.useEffect(()=>{let e=requestAnimationFrame(()=>p.current=!1);return()=>cancelAnimationFrame(e)},[]),(0,g.jsx)(s,{present:a||f,children:({present:n})=>(0,g.jsx)(r.div,{"data-state":f?`active`:`inactive`,"data-orientation":l.orientation,role:`tabpanel`,"aria-labelledby":u,hidden:!n,id:d,tabIndex:0,...c,ref:t,style:{...e.style,animationDuration:p.current?`0s`:void 0},children:n&&o})})});k.displayName=O;function A(e,t){return`${e}-trigger-${t}`}function j(e,t){return`${e}-content-${t}`}var M=C,N=T,P=D,F=k;function I({className:e,orientation:t=`horizontal`,...n}){return(0,g.jsx)(M,{"data-slot":`tabs`,"data-orientation":t,className:a(`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:a(L({variant:t}),e),...n})}function z({className:e,...t}){return(0,g.jsx)(P,{"data-slot":`tabs-trigger`,className:a(`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:a(`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{yO as e}from"./dist-DRXIQewX.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-DcMWPy01.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-DRXIQewX.js">
|
|
44
|
+
<link rel="modulepreload" crossorigin href="/assets/dist-H7gCiaFZ.js">
|
|
45
|
+
<link rel="modulepreload" crossorigin href="/assets/dist-BDdbnJdn.js">
|
|
46
|
+
<link rel="modulepreload" crossorigin href="/assets/dist-DS_sZFhE.js">
|
|
47
|
+
<link rel="modulepreload" crossorigin href="/assets/x-1RyayDYu.js">
|
|
48
|
+
<link rel="modulepreload" crossorigin href="/assets/button-CrkRjd-T.js">
|
|
49
|
+
<link rel="stylesheet" crossorigin href="/assets/index-DbRDkkXU.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.25.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{AS as r,Ci as i,Di as a,Ei as o,Oi as s,Si as ee,Ti as te,VD as ne,_i as c,ai as l,bi as re,ci as u,di as d,ei as f,fO as p,fa as m,fi as h,gO as g,gi as _,hi as v,ii as y,ki as ie,li as b,mi as x,ni as S,oi as C,pi as ae,ri as w,si as T,ti as E,ua as oe,ui as se,vi as ce,wi as D,xi as O,yO as k,yi as A,zD as j}from"./dist-DsBcH2-2.js";import{t as M}from"./button-9c1aLUeO.js";import{$ as N,A as P,B as F,C as I,F as le,I as ue,L as de,N as fe,P as pe,Q as me,R as he,S as L,X as R,b as z,et as ge,mt as B,nt as _e,ot as V,rt as ve,v as H,x as U,y as W,z as ye}from"./index-DsOZBPOX.js";import{i as G}from"./compatView-DI9WOWM-.js";/* empty css */var K=t(e(),1),q=2e4,J=6e4;function Y(e){return typeof e!=`number`||e<=0?0:Math.round(e/q*100)}function X(e){return e<=0?0:Math.round(e/J*100)}function Z(e,t){let n=(typeof e==`number`&&e>0?e:0)/1e3;return new Intl.NumberFormat(t,{minimumFractionDigits:1,maximumFractionDigits:1}).format(n)}function 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=k(p.me.getMe,{host:V}),t=e?.role===`admin`,n=(e?.permissions??[]).includes(`bridge.read`),r=k(p.admin.listInstances,e!==void 0&&t?{}:`skip`),[l,u]=(0,K.useState)(null);(0,K.useEffect)(()=>{!t||!r||r.length===0||(!l||!r.some(e=>e.name===l))&&u(r[0].name)},[t,r,l]);let d=k(p.agents.listAgentsForInstance,t&&l?{instanceName:l}:`skip`),f=k(p.agents.listMyAgents,e!==void 0&&!t?{}:`skip`),m=(0,K.useMemo)(()=>{if(e!==void 0){if(t)return l===null||d===void 0?r!==void 0&&r.length===0?[]:void 0:d.agents.map(e=>({instanceName:l,agentId:e.agentId,label:`${e.emoji?`${e.emoji} `:``}${e.displayName??e.agentId}`}));if(f!==void 0)return f.map(e=>({instanceName:e.instanceName,agentId:e.agentId,label:`${e.emoji?`${e.emoji} `:``}${e.displayName??e.agentId}`}))}},[e,t,l,d,r,f]),[h,_]=(0,K.useState)(null);(0,K.useEffect)(()=>{!m||m.length===0||(!h||!m.some(e=>$(e)===h))&&_($(m[0]))},[m,h]);let v=m?.find(e=>$(e)===h)??null,y=g(p.agentFiles.listAgentFiles),[b,x]=(0,K.useState)({status:`idle`}),S=v?.instanceName??null,C=v?.agentId??null,ae=k(p.compat.forInstance,n&&S!==null?{instanceName:S}:`skip`),w=n&&S!==null?H(ae,`agentFiles`):null,T=w===null?!1:w===`loading`?null:w.blocked,E=(0,K.useCallback)(async()=>{if(!(S===null||C===null)){x({status:`loading`});try{x({status:`done`,files:(await y({instanceName:S,agentId:C})).files})}catch{x({status:`error`})}}},[y,S,C]);(0,K.useEffect)(()=>{T===!1&&E()},[E,T]);let[se,N]=(0,K.useState)(null),P=ne(),F=(0,K.useMemo)(()=>new Intl.NumberFormat(P,{maximumFractionDigits:0}),[P]);return e===void 0||m===void 0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:j()}):(0,Q.jsxs)(`div`,{className:`oc-afiles`,children:[(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:ie()}),(0,Q.jsxs)(`div`,{className:`oc-afiles__picker`,children:[t&&(r?.length??0)>1?(0,Q.jsxs)(W,{value:l??``,onValueChange:e=>u(e),children:[(0,Q.jsx)(L,{size:`sm`,"aria-label":s(),children:(0,Q.jsx)(I,{})}),(0,Q.jsx)(z,{children:(r??[]).map(e=>(0,Q.jsx)(U,{value:e.name,children:e.name},e.name))})]}):null,m.length>0?(0,Q.jsxs)(W,{value:h??``,onValueChange:e=>_(e),children:[(0,Q.jsx)(L,{size:`sm`,"aria-label":a(),children:(0,Q.jsx)(I,{})}),(0,Q.jsx)(z,{children:m.map(e=>(0,Q.jsx)(U,{value:$(e),children:e.label},$(e)))})]}):(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:o()})]}),v===null?null:w===`loading`?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:j()}):w!==null&&w.blocked?(0,Q.jsxs)(`p`,{className:`oc-compat__blocked`,role:`status`,children:[(0,Q.jsx)(B,{size:14,"aria-hidden":!0}),` `,G(w.gatewayVersion)]}):b.status===`loading`||b.status===`idle`?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:j()}):b.status===`error`?(0,Q.jsxs)(`p`,{className:`oc-afiles__error`,role:`alert`,children:[D(),` `,(0,Q.jsx)(M,{variant:`outline`,size:`sm`,onClick:()=>void E(),children:oe()})]}):b.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:b.files.map(e=>{let n=Y(e.size),r=n>=80;return(0,Q.jsxs)(`div`,{className:`oc-afiles__row`,children:[(0,Q.jsx)(`span`,{className:`oc-afiles__name`,title:e.name,children:e.name}),e.missing?(0,Q.jsx)(R,{variant:`outline`,children:i()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`span`,{className:`oc-afiles__size`,children:ee({size:Z(e.size,P)})}),(0,Q.jsx)(`span`,{className:`oc-afiles__gauge${r?` is-warn`:``}`,"aria-hidden":!0,children:(0,Q.jsx)(`span`,{className:`oc-afiles__gauge-fill`,style:{width:`${Math.min(n,100)}%`}})}),(0,Q.jsx)(`span`,{className:`oc-afiles__pct`,children:O({pct:F.format(n)})}),r?(0,Q.jsx)(B,{size:14,className:`oc-afiles__warn`,"aria-label":re()}):(0,Q.jsx)(`span`,{className:`oc-afiles__warn-slot`,"aria-hidden":!0})]}),(0,Q.jsx)(M,{variant:`outline`,size:`sm`,className:`oc-afiles__open`,onClick:()=>N(e),children:t?ce():c()})]},e.name)})}),(0,Q.jsx)(`p`,{className:`oc-afiles__budget`,children:A({used:Z(be(b.files),P),total:Z(J,P),pct:F.format(X(be(b.files)))})})]}),se&&v?(0,Q.jsx)(Te,{instanceName:v.instanceName,agentId:v.agentId,name:se.name,isAdmin:t,onClose:()=>N(null),onSaved:()=>void E()}):null]})}function Te({instanceName:e,agentId:t,name:n,isAdmin:i,onClose:a,onSaved:o}){let s=g(p.agentFiles.getAgentFile),ee=g(p.agentFiles.setAgentFile),te=P(),[c,re]=(0,K.useState)(null),[ie,ce]=(0,K.useState)(!1),[D,O]=(0,K.useState)(``),[k,A]=(0,K.useState)(!1),[I,L]=(0,K.useState)(!1),[R,z]=(0,K.useState)(!1),[B,V]=(0,K.useState)(!1),H=(0,K.useCallback)(async r=>{ce(!1);try{let i=await s({instanceName:e,agentId:t,name:n});re({content:i.content,updatedAtMs:i.updatedAtMs}),r||O(i.content),z(!1)}catch{ce(!0)}},[s,e,t,n]);(0,K.useEffect)(()=>{H(!1)},[H]);async function U(){if(c!==null){L(!0),V(!1);try{await ee({instanceName:e,agentId:t,name:n,content:D,baseUpdatedAtMs:c.updatedAtMs??void 0}),te.success(se({name:n})),o(),await H(!1)}catch(e){Ce(e)?z(!0):V(!0)}finally{L(!1)}}}let W=c!==null&&D!==c.content,G=(0,K.useMemo)(()=>c===null?null:Se(c.content,D),[c,D]),J=D.length>q,Y=ne(),X=(0,K.useMemo)(()=>new Intl.NumberFormat(Y),[Y]);return(0,Q.jsx)(me,{open:!0,onOpenChange:e=>!e&&a(),children:(0,Q.jsxs)(N,{className:`oc-afiles__editor`,children:[(0,Q.jsxs)(_e,{children:[(0,Q.jsx)(ve,{children:_({name:n})}),(0,Q.jsxs)(ge,{children:[v({agent:t,instance:e}),i?null:(0,Q.jsxs)(Q.Fragment,{children:[` · `,x()]})]})]}),ie?(0,Q.jsxs)(`p`,{className:`oc-afiles__error`,role:`alert`,children:[u(),` `,(0,Q.jsx)(M,{variant:`outline`,size:`sm`,onClick:()=>void H(!1),children:oe()})]}):c===null?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:j()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`textarea`,{className:`oc-afiles__source`,value:D,readOnly:!i,spellCheck:!1,onChange:e=>O(e.target.value),"aria-label":_({name:n})}),(0,Q.jsx)(`p`,{className:`oc-afiles__hint`,children:ae()}),R?(0,Q.jsxs)(`p`,{className:`oc-afiles__error`,role:`alert`,children:[T(),` `,(0,Q.jsx)(M,{variant:`outline`,size:`sm`,onClick:()=>void H(!0),children:C()})]}):null,B?(0,Q.jsx)(`p`,{className:`oc-afiles__error`,role:`alert`,children:b()}):null,(0,Q.jsxs)(`div`,{className:`oc-afiles__editor-foot`,children:[(0,Q.jsx)(`span`,{className:`oc-afiles__count${J?` is-over`:``}`,children:h({count:X.format(D.length),max:X.format(q)})}),i?(0,Q.jsx)(M,{size:`sm`,disabled:!W||I||R,onClick:()=>A(!0),children:I?m():d()}):null]})]}),(0,Q.jsx)(fe,{open:k,onOpenChange:A,children:(0,Q.jsxs)(ue,{children:[(0,Q.jsxs)(ye,{children:[(0,Q.jsx)(F,{children:l({name:n})}),(0,Q.jsx)(de,{children:y({agent:t})})]}),G?(0,Q.jsxs)(`div`,{className:`oc-afiles__diff`,children:[(0,Q.jsx)(`p`,{className:`oc-afiles__diff-counts`,children:w({added:G.added,removed:G.removed})}),G.sampleAdded.length>0?(0,Q.jsxs)(`div`,{className:`oc-afiles__diff-block`,children:[(0,Q.jsx)(`span`,{className:`oc-afiles__diff-label`,children:S()}),G.sampleAdded.map((e,t)=>(0,Q.jsx)(`code`,{className:`oc-afiles__diff-line is-add`,children:e||` `},t))]}):null,G.sampleRemoved.length>0?(0,Q.jsxs)(`div`,{className:`oc-afiles__diff-block`,children:[(0,Q.jsx)(`span`,{className:`oc-afiles__diff-label`,children:E()}),G.sampleRemoved.map((e,t)=>(0,Q.jsx)(`code`,{className:`oc-afiles__diff-line is-del`,children:e||` `},t))]}):null]}):null,(0,Q.jsxs)(he,{children:[(0,Q.jsx)(le,{children:r()}),(0,Q.jsx)(pe,{onClick:()=>void U(),children:f()})]})]})})]})})}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,Bm as a,Cm as ee,Dm as te,Em as ne,Fm as re,Im as ie,Lm as ae,Mm as o,Nm as s,Om as c,Pm as l,Rm as u,Sm as d,Tm as f,Vm as p,_m as oe,am as se,bm as ce,cm as le,dm as ue,em as m,fO as h,fm as de,gm as g,hm as fe,im as pe,jm as me,km as he,lm as ge,mm as _,nm as v,om as y,pm as b,rm as x,sm as S,tm as C,um as w,vO as T,vm as E,wm as D,xm as O,yO as k,ym as A,zm as j}from"./dist-DsBcH2-2.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-DsOZBPOX.js";import{n as be}from"./TimeRangePicker-CPM9eoXo.js";import{t as xe}from"./FilterBar-DWv8wqqC.js";import{t as Se}from"./DataTableShell-VIRQvS8e.js";import{t as H}from"./dispatchErrorInfo-DO5jqFw-.js";var U=t(e(),1),W=n(),G=`__all__`,Ce=[{value:`open`},{value:`acknowledged`},{value:`resolved`}];function we(e){return e===`open`?p():e===`acknowledged`?a():j()}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??``,r=e.status===K?G:e.status,a=e.severity??G,p=e.kind??G,[m,v]=(0,U.useState)(G),C=ye(e.from,e.to),{from:j,to:H}=be(C),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=T(h.anomalies.resolveAnomaly),Fe=(k(h.me.getMe,{host:ve})?.permissions??[]).includes(`admin.manage`),$=k(h.anomalies.listAnomalies,{limit:Oe,filter:{q:n||void 0,from:j,to:H,anomalyStatus:r===G?void 0:r,severity:a===G?void 0:a,source:m===G?void 0:m,kind:p===G?void 0:p}}),Ie=(0,U.useMemo)(()=>{let e=new Set;for(let t of $??[])e.add(t.kind);return[...e].sort()},[$]),Le=n!==``||r!==`open`||a!==G||m!==G||p!==G||C.kind!==`relative`||C.from!==De.from;function Re(){v(G),t({search:{status:`open`},replace:!0})}async function ze(e){if(await Pe({title:u(),description:(0,W.jsxs)(W.Fragment,{children:[ae(),` `,(0,W.jsx)(`span`,{className:`font-mono`,children:e.kind}),` `,ie(),` `,(0,W.jsx)(`strong`,{children:re()}),`.`,` `,l()]}),confirmLabel:s()}))try{await Q({anomalyId:e._id,status:`resolved`}),Z.success(o(),e.kind)}catch(e){Z.error(me(),e)}}async function Be(e){try{await Q({anomalyId:e._id,status:`acknowledged`}),Z.success(i(),e.kind)}catch(e){Z.error(he(),e)}}return(0,W.jsxs)(W.Fragment,{children:[(0,W.jsxs)(`p`,{className:`oc-admin__hint`,children:[c(),` `,(0,W.jsx)(`strong`,{children:te()}),` `,ne(),` `,(0,W.jsx)(`strong`,{children:f()}),` `,D(),` `,(0,W.jsx)(`strong`,{children:ee()}),` `,d(),` `,(0,W.jsx)(`span`,{className:`oc-filter__window`,children:O()})]}),(0,W.jsxs)(xe,{q:n,onQChange:q,searchPlaceholder:ce(),timeRange:C,onTimeRangeChange:X,onReset:Re,canReset:Le,children:[(0,W.jsxs)(V,{value:r,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:A()}),Ce.map(e=>(0,W.jsx)(B,{value:e.value,children:we(e.value)},e.value))]})]}),(0,W.jsxs)(V,{value:a,onValueChange:Y,children:[(0,W.jsx)(F,{size:`sm`,className:`w-36`,children:(0,W.jsx)(N,{placeholder:E()})}),(0,W.jsxs)(R,{children:[(0,W.jsx)(B,{value:G,children:oe()}),Te.map(e=>(0,W.jsx)(B,{value:e,children:e},e))]})]}),(0,W.jsxs)(V,{value:m,onValueChange:v,children:[(0,W.jsx)(F,{size:`sm`,className:`w-32`,children:(0,W.jsx)(N,{placeholder:g()})}),(0,W.jsxs)(R,{children:[(0,W.jsx)(B,{value:G,children:fe()}),Ee.map(e=>(0,W.jsx)(B,{value:e,children:e},e))]})]}),(0,W.jsxs)(V,{value:p,onValueChange:Ne,children:[(0,W.jsx)(F,{size:`sm`,className:`w-36`,children:(0,W.jsx)(N,{placeholder:_()})}),(0,W.jsxs)(R,{children:[(0,W.jsx)(B,{value:G,children:b()}),Ie.map(e=>(0,W.jsx)(B,{value:e,children:e},e))]})]})]}),(0,W.jsx)(Se,{title:de(),rows:$,emptyHint:r===`open`?ue():w(),rowActions:e=>Fe&&e.status===`open`?[{label:ge(),onSelect:()=>void ze(e)},{label:le(),onSelect:()=>void Be(e)}]:[],columns:[{header:S(),cell:e=>(0,W.jsx)(`span`,{className:`oc-traces__time`,children:new Date(e.at).toLocaleString(`fr-FR`)}),sort:e=>e.at},{header:_(),cell:e=>(0,W.jsx)(`code`,{className:`oc-traces__mono`,children:e.kind}),sort:e=>e.kind},{header:E(),cell:e=>(0,W.jsx)(Ae,{severity:e.severity}),sort:e=>e.severity===`critical`?2:+(e.severity===`warn`)},{header:y(),cell:e=>(0,W.jsx)(je,{status:e.status}),sort:e=>e.status===`resolved`?2:+(e.status===`acknowledged`)},{header:g(),cell:e=>(0,W.jsx)(I,{variant:`outline`,children:e.source}),sort:e=>e.source},{header:se(),cell:e=>(0,W.jsx)(`span`,{className:`oc-anomaly__msg`,children:e.message}),sort:e=>e.message},{header:pe(),cell:e=>(0,W.jsx)(ke,{row:e}),sort:e=>e.evidence??null},{header:x(),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:[`↗ `,v()]}):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:[`↗ `,v()]}):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:C()}):e===`acknowledged`?(0,W.jsx)(I,{variant:`secondary`,children:m()}):(0,W.jsx)(I,{variant:`outline`,children:r()})}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{$d as r,$u as i,Ar as a,Au as o,Bd as s,Bu as c,Dr as l,Er as u,Fr as d,Fu as f,Gd as p,Gu as m,Hu as h,Ir as g,Iu as _,Jd as ee,Ju as te,Kd as ne,Ku as re,Lr as ie,Lu as ae,Mr as oe,Mu as v,Nr as se,Nu as ce,Or as le,Pr as y,Pu as ue,Qu as de,Rr as fe,Ru as pe,Sr as me,Uu as he,Vd as ge,Vu as _e,Wd as ve,Wu as b,Xd as ye,Xu as be,Yd as xe,Yu as Se,Zd as Ce,Zu as we,_d as Te,ad as Ee,cd as De,dd as Oe,ed as ke,ef as Ae,fO as x,fd as je,gO as Me,gd as Ne,hd as Pe,id as Fe,jr as Ie,ju as S,kr as Le,ld as Re,md as ze,nd as Be,od as Ve,pO as C,pd as He,qd as Ue,qu as We,rd as w,sd as Ge,td as Ke,ud as qe,vO as Je,vd as Ye,yO as T,zr as Xe,zu as Ze}from"./dist-DsBcH2-2.js";import{i as E,r as Qe}from"./dist-BMI7wyIc.js";import{t as $e}from"./chevrons-up-down-D_kGoxSO.js";import{i as et,n as D,o as tt,r as nt,s as rt}from"./FieldLabel-BYZOkwDx.js";import{t as O}from"./button-9c1aLUeO.js";import{$ as it,A as at,At as ot,C as k,H as st,Q as ct,S as A,St as lt,U as ut,V as dt,X as j,Z as M,_ as ft,_t as pt,b as N,et as mt,jt as ht,kt as P,mt as F,nt as gt,ot as _t,rt as vt,x as I,y as L}from"./index-DsOZBPOX.js";import{a as yt,i as R,n as bt,o as z,r as B,t as xt}from"./table-C2kpo1_K.js";import{t as St}from"./FilterBar-DWv8wqqC.js";import{a as Ct,n as wt,o as V,r as H,s as Tt,t as Et}from"./compatView-DI9WOWM-.js";import{t as U}from"./dispatchErrorInfo-DO5jqFw-.js";var Dt=C(`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=C(`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,a]=(0,W.useState)(null),o=(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]),s=(0,W.useMemo)(()=>zt(o),[o]),l=(0,W.useMemo)(()=>Bt(o),[o]),u=(0,W.useMemo)(()=>Vt(o),[o]),d=(0,W.useMemo)(()=>Rt(It(o,n),i),[o,n,i]);function p(e){a(t=>t?.key===e?t.dir===`asc`?{key:e,dir:`desc`}:null:{key:e,dir:`asc`})}return e.length===0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:te()}):(0,Q.jsxs)(`div`,{className:`oc-conn`,children:[(0,Q.jsxs)(St,{q:n.q,onQChange:e=>r(t=>({...t,q:e})),searchPlaceholder:m(),onReset:()=>r(J),canReset:Ft(n),children:[(0,Q.jsxs)(L,{value:n.state,onValueChange:e=>r(t=>({...t,state:e})),children:[(0,Q.jsx)(A,{size:`sm`,className:`w-36`,children:(0,Q.jsx)(k,{placeholder:he()})}),(0,Q.jsxs)(N,{children:[(0,Q.jsx)(I,{value:q,children:b()}),s.map(e=>(0,Q.jsx)(I,{value:e,children:Wt(e)},e))]})]}),(0,Q.jsxs)(L,{value:n.instance,onValueChange:e=>r(t=>({...t,instance:e})),children:[(0,Q.jsx)(A,{size:`sm`,className:`w-40`,children:(0,Q.jsx)(k,{placeholder:h()})}),(0,Q.jsxs)(N,{children:[(0,Q.jsx)(I,{value:q,children:b()}),l.map(e=>(0,Q.jsx)(I,{value:e.name,children:e.label},e.name))]})]}),(0,Q.jsxs)(L,{value:n.version,onValueChange:e=>r(t=>({...t,version:e})),children:[(0,Q.jsx)(A,{size:`sm`,className:`w-36`,children:(0,Q.jsx)(k,{placeholder:_e()})}),(0,Q.jsxs)(N,{children:[(0,Q.jsx)(I,{value:q,children:b()}),u.map(e=>(0,Q.jsx)(I,{value:e,children:e},e))]})]})]}),d.length===0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:c()}):(0,Q.jsxs)(xt,{className:`oc-conn__table`,children:[(0,Q.jsx)(yt,{children:(0,Q.jsxs)(z,{children:[(0,Q.jsx)($,{label:Ze(),sortKey:`target`,sort:i,onSort:p}),(0,Q.jsx)($,{label:pe(),sortKey:`state`,sort:i,onSort:p}),(0,Q.jsx)($,{label:ae(),sortKey:`instance`,sort:i,onSort:p}),(0,Q.jsx)($,{label:_(),sortKey:`host`,sort:i,onSort:p}),(0,Q.jsx)($,{label:f(),sortKey:`version`,sort:i,onSort:p}),(0,Q.jsx)(R,{children:ue()}),(0,Q.jsx)($,{label:ce(),sortKey:`lastOk`,sort:i,onSort:p})]})}),(0,Q.jsx)(bt,{children:d.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)(R,{"aria-sort":i?a===`asc`?`ascending`:`descending`:`none`,children:(0,Q.jsxs)(`button`,{type:`button`,className:`oc-conn__sort`,onClick:()=>r(t),children:[e,i?a===`asc`?(0,Q.jsx)(Qe,{size:13,"aria-hidden":!0}):(0,Q.jsx)(E,{size:13,"aria-hidden":!0}):(0,Q.jsx)($e,{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)(z,{className:`oc-conn__row oc-conn__row--${e.state}`,children:[(0,Q.jsx)(B,{children:(0,Q.jsx)(`code`,{className:`oc-traces__mono`,children:e.targetLabel})}),(0,Q.jsx)(B,{children:(0,Q.jsx)(Gt,{state:e.state})}),(0,Q.jsx)(B,{children:e.instanceLabel?(0,Q.jsx)(`span`,{className:`oc-bridge-target__instance`,children:e.instanceLabel}):(0,Q.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})}),(0,Q.jsx)(B,{children:(0,Q.jsx)(`span`,{className:`oc-bridge-target__host`,children:e.gatewayHost})}),(0,Q.jsx)(B,{children:e.gatewayVersion?(0,Q.jsx)(`span`,{className:`oc-bridge-target__version`,children:e.gatewayVersion}):(0,Q.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})}),(0,Q.jsx)(B,{children:(0,Q.jsx)(`span`,{className:`oc-conn__stats`,children:We({ok:e.okCount,errors:e.errorCount,attempts:e.attempts})})}),(0,Q.jsx)(B,{children:e.lastOkAt?(0,Q.jsx)(`span`,{className:`oc-traces__mono`,children:new Date(e.lastOkAt).toLocaleTimeString(`fr-FR`)}):(0,Q.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})})]}),t||n?(0,Q.jsx)(z,{className:`oc-conn__detail-row`,children:(0,Q.jsxs)(B,{colSpan:7,className:`oc-conn__detail-cell`,children:[t?(0,Q.jsxs)(`div`,{className:`oc-bridge-target__error`,children:[(0,Q.jsx)(`strong`,{children:t.label}),` `,(0,Q.jsx)(`code`,{className:`oc-traces__mono`,children:e.lastErrorCode}),e.lastErrorAt?` · ${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:[re({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`?v():e===`error`?S():o()}function Gt({state:e}){return e===`connected`?(0,Q.jsx)(j,{variant:`secondary`,children:v()}):e===`error`?(0,Q.jsx)(j,{variant:`destructive`,children:S()}):(0,Q.jsx)(j,{variant:`outline`,children:o()})}function Kt(){return T(x.bridgeHealth.getBridgeHealth,{})}function qt(){let e=Kt(),t=T(x.compat.getBridgeCompat,{}),n=T(x.me.getMe,{host:_t})?.role===`admin`,r=T(x.admin.listInstances,n?{}:`skip`),i=ht(),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:Fe()}),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:me()}):null]})}function Jt({health:e,compat:t,onSeeAnomalies:n}){let r=t!=null&&t.buildVersion!=null&&t.bridgeVersion!=null&&t.buildVersion!==t.bridgeVersion,a=t?.buildRevision&&t.buildRevision!==`unknown`?t.buildRevision.slice(0,7):null,o=t&&t!==null?(0,Q.jsxs)(`span`,{className:`oc-bridge-card__ver`,children:[(0,Q.jsx)(`code`,{className:`oc-traces__mono`,children:Ct(t.bridgeVersion)}),a?(0,Q.jsxs)(Q.Fragment,{children:[` `,(0,Q.jsxs)(`code`,{className:`oc-traces__mono`,title:ie(),children:[`(`,a,`)`]})]}):null,r?(0,Q.jsxs)(`strong`,{className:`oc-bridge-card__mismatch`,children:[` `,g({build:t.buildVersion??`?`})]}):null,` · `,d(),` `,(0,Q.jsx)(`code`,{className:`oc-traces__mono`,children:t.protocolVersion===null?y():String(t.protocolVersion)})]}):null;if(e===void 0)return(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:w()});if(e===null)return(0,Q.jsx)(`div`,{className:`oc-bridge-card oc-bridge-card--idle`,children:Be()});let s=G(e.targets),c=!e.reachable,l=kt(e),u=l?`ok`:`error`,f=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)(P,{size:22}):c?(0,Q.jsx)(Ot,{size:22}):(0,Q.jsx)(F,{size:22})}),(0,Q.jsxs)(`div`,{className:`oc-bridge-card__body`,children:[(0,Q.jsx)(`div`,{className:`oc-bridge-card__title`,children:l?Ke():c?ke():i({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}),` `,de({time:f})]}),p?(0,Q.jsx)(`span`,{children:we({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:be()})]})}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)(pt,{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)(j,{variant:d===`beyond`?`destructive`:`secondary`,children:H(d)}):null]}),(0,Q.jsx)(`h4`,{className:`oc-bridge-provider__sub`,children:Xe()}),(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)(E,{size:13,"aria-hidden":!0}):(0,Q.jsx)(ot,{size:13,"aria-hidden":!0}),Se({count:t.length})]}),f?(0,Q.jsx)(Ht,{connections:t,displayByInstance:s}):null]})}function Xt({support:e,compatStatus:t,compatReachable:n,manifest:r,instanceRows:i}){return t===`loading`?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:w()}):t===`nodata`?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:fe()}):(0,Q.jsxs)(`div`,{className:`oc-compat`,children:[n?null:(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:se()}),r===null?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:oe()}):(0,Q.jsxs)(`div`,{className:`oc-compat__support`,children:[(0,Q.jsx)(`span`,{className:`oc-compat__label`,children:Ie()}),e&&e.range!==null?(0,Q.jsx)(`span`,{children:a({min:e.range.min,max:e.range.maxValidated})}):(0,Q.jsx)(`span`,{children:y()}),e?(0,Q.jsx)(en,{versions:e.validatedVersions}):null]}),i.length===0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:u()}):(0,Q.jsx)(`div`,{className:`oc-compat__targets`,children:i.map(e=>(0,Q.jsxs)(`div`,{className:`oc-compat__target`,children:[(0,Q.jsx)(`span`,{className:`oc-compat__instance`,children:e.displayName}),(0,Q.jsx)(`code`,{className:`oc-traces__mono`,children:Ct(e.version)}),(0,Q.jsx)(j,{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)(ct,{open:!0,onOpenChange:e=>!e&&t(),children:(0,Q.jsxs)(it,{className:`oc-bridge-config-dialog`,onOpenAutoFocus:e=>e.preventDefault(),children:[(0,Q.jsxs)(gt,{children:[(0,Q.jsx)(vt,{children:Ae({instance:e.displayName??e.name})}),(0,Q.jsx)(mt,{children:r()})]}),(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)(P,{"aria-hidden":!0}):(0,Q.jsx)(F,{"aria-hidden":!0}),(0,Q.jsxs)(`span`,{children:[e,` — `,t.ok?De():t.detail]})]}):(0,Q.jsxs)(`p`,{className:`oc-bridge-config__check-row oc-bridge-config__check-row--skip`,children:[e,` — `,Ge()]}):null}function $t({instance:e,onClose:t}){let n=Je(x.admin.upsertInstanceConfig),r=Me(x.bridge.validateMediaPaths),i=at(),[a,o]=(0,W.useState)(()=>et(e.config??{})),[c,l]=(0,W.useState)(!1),[u,d]=(0,W.useState)(!1),[f,m]=(0,W.useState)(null),h=a.inboundMediaMode===`shared-fs`,g=a.mediaMode===`shared-fs`,_=h||g;async function te(){d(!0),m(null);try{m(await r({instanceName:e.name,inboundMediaMode:a.inboundMediaMode,mediaMode:a.mediaMode}))}catch(e){i.error(je(),e)}finally{d(!1)}}async function re(){l(!0);try{let r=e.config??{};await n({instanceId:e._id,config:nt(a,r)}),t()}catch(e){i.error(ne(),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)(D,{label:Ce(),help:p()}),(0,Q.jsxs)(L,{value:a.mediaMode,onValueChange:e=>o({...a,mediaMode:e}),children:[(0,Q.jsx)(A,{size:`sm`,className:`w-full`,children:(0,Q.jsx)(k,{})}),(0,Q.jsx)(N,{children:rt.map(e=>(0,Q.jsx)(I,{value:e,children:e},e))})]})]}),(0,Q.jsxs)(`label`,{className:`oc-field`,children:[(0,Q.jsx)(D,{label:ye(),help:ve()}),(0,Q.jsxs)(L,{value:a.inboundMediaMode,onValueChange:e=>o({...a,inboundMediaMode:e}),children:[(0,Q.jsx)(A,{size:`sm`,className:`w-full`,children:(0,Q.jsx)(k,{})}),(0,Q.jsx)(N,{children:tt.map(e=>(0,Q.jsx)(I,{value:e,children:e},e))})]})]}),(0,Q.jsxs)(`label`,{className:`oc-field`,children:[(0,Q.jsx)(D,{label:xe(),help:ge()}),(0,Q.jsx)(M,{type:`number`,min:1,max:4096,className:`w-full`,value:a.mediaMaxMb,onChange:e=>o({...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)(D,{label:Ye(),help:Te()}),(0,Q.jsx)(M,{className:`w-full`,spellCheck:!1,value:a.inboundAgentMount,onChange:e=>o({...a,inboundAgentMount:e.target.value})})]}),g&&(0,Q.jsxs)(`label`,{className:`oc-field`,children:[(0,Q.jsx)(D,{label:Ne(),help:Pe()}),(0,Q.jsx)(M,{className:`w-full`,spellCheck:!1,value:a.outboundAgentMount,onChange:e=>o({...a,outboundAgentMount:e.target.value})})]})]}),(0,Q.jsxs)(`label`,{className:`oc-field--row`,children:[(0,Q.jsx)(ft,{checked:a.rehydration,onCheckedChange:e=>o({...a,rehydration:e===!0})}),(0,Q.jsx)(D,{label:ee(),help:s()})]}),_&&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)(F,{"aria-hidden":!0}),Ee({reason:f.reason??`?`})]}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(Qt,{label:qe(),result:f.inbound}),(0,Q.jsx)(Qt,{label:Re(),result:f.outbound}),(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:Oe()})]}):(0,Q.jsxs)(`p`,{className:`oc-bridge-config__check-row oc-bridge-config__check-row--err`,children:[(0,Q.jsx)(F,{"aria-hidden":!0}),Ve()]})}),(0,Q.jsxs)(`div`,{className:`oc-bridge-config__actions`,children:[_&&(0,Q.jsxs)(O,{variant:`outline`,size:`sm`,onClick:()=>void te(),disabled:u,children:[u?(0,Q.jsx)(lt,{className:`size-4 animate-spin`,"aria-hidden":!0}):null,u?He():ze()]}),(0,Q.jsx)(O,{size:`sm`,onClick:()=>void re(),disabled:c,children:Ue()})]})]})})}function en({versions:e}){if(e.length===0)return null;let t=[...e].reverse();return(0,Q.jsxs)(dt,{children:[(0,Q.jsx)(ut,{asChild:!0,children:(0,Q.jsxs)(`button`,{type:`button`,className:`oc-compat__versions-btn`,children:[e.length===1?Le():le({count:e.length}),(0,Q.jsx)(E,{size:13,"aria-hidden":!0})]})}),(0,Q.jsxs)(st,{className:`oc-compat__versions-pop`,align:`start`,children:[(0,Q.jsx)(`p`,{className:`oc-compat__versions-title`,children:l()}),(0,Q.jsx)(`div`,{className:`oc-compat__versions-list`,children:t.map(e=>(0,Q.jsx)(j,{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{AS as r,Br as i,Gr as a,Hr as o,Jr as s,Kr as c,Oi as l,Qd as u,Qr as d,S as f,Ur as p,Vr as m,Wr as h,Xr as ee,Yr as te,Zr as ne,aa as re,b as g,fO as _,fa as v,gO as y,oa as ie,qr as ae,ua as b,vO as x,x as S,yO as C,zD as w}from"./dist-DsBcH2-2.js";import{t as T}from"./button-9c1aLUeO.js";import{A as oe,B as se,C as E,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-DsOZBPOX.js";import{i as P}from"./compatView-DI9WOWM-.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=x(_.admin.upsertInstanceConfig),n=typeof e.config?.summarizeThresholdChars==`number`?e.config.summarizeThresholdChars:null,[r,i]=(0,F.useState)(n===null?``:String(n)),[o,s]=(0,F.useState)(`idle`);(0,F.useEffect)(()=>{i(n===null?``:String(n)),s(`idle`)},[e._id,n]);let l=r.trim(),u=l===``?null:/^\d+$/.test(l)?Number.parseInt(l,10):NaN,d=u===null||Number.isInteger(u)&&u>=1e3&&u<=2e5,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:f()}),(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=>i(e.target.value),className:`oc-cdefaults__number`,"aria-invalid":!d}),(0,R.jsx)(T,{size:`sm`,disabled:!p||!d||o===`saving`,onClick:()=>void m(),children:o===`saving`?v():c()})]}),d?null:(0,R.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:g()}),o===`done`?(0,R.jsx)(`p`,{className:`oc-admin__hint`,role:`status`,children:a()}):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:S()})]})}function z(){let e=y(_.agentFiles.getChatDefaults),t=y(_.agentFiles.setChatDefaults),n=oe(),[f,g]=(0,F.useState)({status:`loading`}),[x,S]=(0,F.useState)({thinkingDefault:null,fastModeDefault:null}),[D,z]=(0,F.useState)(!1),[B,V]=(0,F.useState)(!1),H=C(_.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=C(_.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;g({status:`loading`});try{let n=L(await e(J));if(Y.current!==t)return;g({status:`done`,current:n}),S(n)}catch{if(Y.current!==t)return;g({status:`error`})}},[e,J]);(0,F.useEffect)(()=>{q===!1&&(G&&!U||X())},[X,q,G,U]);let Z=f.status===`done`?f.current:null,Q=Z!==null&&x.thinkingDefault!==null&&x.thinkingDefault!==Z.thinkingDefault,$=Z!==null&&x.fastModeDefault!==null&&x.fastModeDefault!==Z.fastModeDefault,be=Q||$;async function xe(){V(!0);try{await t({...J,...Q?{thinkingDefault:x.thinkingDefault}:{},...$?{fastModeDefault:x.fastModeDefault}:{}}),n.success(a()),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:ie()},{id:`standard`,label:re()}],[]);return(0,R.jsxs)(`div`,{className:`oc-cdefaults`,children:[(0,R.jsx)(`p`,{className:`oc-admin__hint`,children:d()}),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)(E,{})}),(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:u()}):K===`loading`?(0,R.jsx)(`p`,{className:`oc-admin__hint`,children:w()}):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)]}):f.status===`loading`?(0,R.jsx)(`p`,{className:`oc-admin__hint`,children:w()}):f.status===`error`?(0,R.jsxs)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:[ae(),` `,(0,R.jsx)(T,{variant:`outline`,size:`sm`,onClick:()=>void X(),children:b()})]}):(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:x.thinkingDefault,onChange:e=>S({...x,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:x.fastModeDefault===null?null:x.fastModeDefault?`fast`:`standard`,onChange:e=>S({...x,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)(T,{size:`sm`,disabled:!be||B,onClick:()=>z(!0),children:B?v():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)(se,{children:o()}),(0,R.jsx)(ue,{children:m()})]}),(0,R.jsxs)(pe,{children:[(0,R.jsx)(ce,{children:r()}),(0,R.jsx)(fe,{onClick:()=>void xe(),children:i()})]})]})})]})}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 p,Kv as m,Lv as ee,Mv as te,Nv as h,Ov as g,Pv as ne,Qv as re,Rv as ie,Sv as _,Tv as v,Uv as ae,Vv as y,Wv as b,Xv as x,Yv as S,Zv as C,_v as w,ay as T,bv as E,cv as D,cy as O,dv as k,ey as A,fO as j,fv as M,gv as N,hv as P,iy as F,jv as I,kv as L,lv as R,mv as oe,ny as z,oy as B,pv as V,qv as H,ry as U,sv as W,sy as G,ty as K,uv as q,vO as J,vv as se,wv as ce,xv as le,yO as ue,yv as de,zv as fe}from"./dist-DsBcH2-2.js";import{t as pe}from"./button-9c1aLUeO.js";import{j as me}from"./index-DsOZBPOX.js";import{t as he}from"./DataTableShell-VIRQvS8e.js";var Y=t(e(),1),X=n(),Z={altered_words:()=>O(),incorrect:()=>G(),incoherence:()=>B(),formatting:()=>T(),latency:()=>F(),api_error:()=>U(),other:()=>z()},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:A()}):e===!1?(0,X.jsx)(`span`,{className:`oc-fbadmin__pill is-warn`,children:r()}):(0,X.jsx)(`span`,{className:`oc-fbadmin__pill`,children:`—`}):(0,X.jsx)(`span`,{className:`oc-fbadmin__pill`,children:K()})}function ge({data:e,closeReason:t}){let n=e.snapshot,r=J(j.feedback.respondToFeedback),[i,o]=(0,Y.useState)(e.thread),[s,c]=(0,Y.useState)(``),[g,_]=(0,Y.useState)(!1);async function v(){let t=s.trim();if(!(!t||g)){_(!0);try{await r({feedbackId:e._id,text:t}),o(e=>[...e,{authorRole:`admin`,text:t,at:Date.now()}]),c(``)}finally{_(!1)}}}let w=[];try{w=n.contextJson?JSON.parse(n.contextJson):[]}catch{w=[]}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?` · ${re()}`:``,n.openclawModel?` · ${n.openclawModel}`:``,n.openclawRuntime?` (${n.openclawRuntime})`:``]})]}),e.comment?(0,X.jsxs)(`section`,{children:[(0,X.jsx)(`h4`,{className:`oc-fbadmin__h`,children:C()}),(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:V()}),(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:x()}),i.length>0?(0,X.jsx)(`div`,{className:`oc-fbadmin__thread`,children:i.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`?S():p()}),(0,X.jsx)(`span`,{className:`oc-notif__msg-text`,children:e.text})]},t))}):(0,X.jsx)(`p`,{className:`oc-fbadmin__meta`,children:H()}),(0,X.jsx)(`textarea`,{className:`oc-feedback__textarea`,placeholder:m(),value:s,maxLength:2e3,rows:3,onChange:e=>c(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 v(),disabled:!s.trim()||g,children:g?u():b()})})]}),(0,X.jsxs)(`section`,{children:[(0,X.jsx)(`h4`,{className:`oc-fbadmin__h`,children:ae()}),(0,X.jsx)(`pre`,{className:`oc-msg__source-pre`,children:n.messageText||d()})]}),n.clientInfo?.sourceWasOpen&&n.displayedText!==void 0?(0,X.jsxs)(`section`,{children:[(0,X.jsx)(`h4`,{className:`oc-fbadmin__h`,children:y()}),(0,X.jsx)(`pre`,{className:`oc-msg__source-pre`,children:n.displayedText||d()})]}):null,n.promptText?(0,X.jsxs)(`section`,{children:[(0,X.jsx)(`h4`,{className:`oc-fbadmin__h`,children:a()}),(0,X.jsx)(`pre`,{className:`oc-msg__source-pre`,children:n.promptText})]}):null,w.length>0?(0,X.jsxs)(`section`,{children:[(0,X.jsx)(`h4`,{className:`oc-fbadmin__h`,children:fe({count:n.contextCount??w.length,truncated:n.contextTruncated?ie():``})}),(0,X.jsx)(`div`,{className:`oc-fbadmin__ctx`,children:w.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:ee()}),(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:f()}),(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?ne({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:[h(),` `,n.clientInfo.plugins.join(`, `),(0,X.jsxs)(`span`,{className:`oc-fbadmin__note`,children:[` `,te()]})]}):null,n.clientInfo?.userAgent?(0,X.jsx)(`span`,{className:`oc-fbadmin__ua`,children:n.clientInfo.userAgent}):null]})]})]})}function _e(){let e=ue(j.feedback.listForAdmin,{}),t=J(j.feedback.readSnapshot),n=J(j.feedback.deleteFeedback),r=me(),[a,l]=(0,Y.useState)(null),[u,d]=(0,Y.useState)({});async function f(e){if(a===e._id){l(null);return}if(!u[e._id]){let n=await t({feedbackId:e._id});d(t=>({...t,[e._id]:n}))}l(e._id)}async function p(e){await r({title:R(),description:D(),confirmLabel:W(),destructive:!0})&&(await n({feedbackId:e._id}),a===e._id&&l(null))}return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`p`,{className:`oc-admin__hint`,children:[I(),` `,(0,X.jsx)(`strong`,{children:i()}),` `,L()]}),(0,X.jsx)(he,{title:g(),rows:e,emptyHint:s(),isExpanded:e=>a===e._id&&!!u[e._id],renderExpanded:e=>u[e._id]?(0,X.jsx)(ge,{data:u[e._id],closeReason:e.userCloseReason}):null,columns:[{header:c(),cell:e=>new Date(e.at).toLocaleString(`fr-FR`),sort:e=>e.at},{header:v(),cell:e=>Q(e.category),sort:e=>Q(e.category)},{header:ce(),cell:e=>e.messageRole===`user`?o():_(),sort:e=>e.messageRole},{header:le(),cell:e=>(e.reporterEmail||e.reporterName||`—`)+(e.impersonated&&e.realOperatorEmail?` ${E({operator:e.realOperatorEmail})}`:``),sort:e=>e.reporterEmail||e.reporterName||null},{header:de(),cell:e=>(0,X.jsx)($,{matches:e.displayedMatchesStored,sourceWasOpen:e.sourceWasOpen}),sort:e=>e.displayedMatchesStored===!1?0:e.displayedMatchesStored===!0?1:2},{header:se(),cell:e=>e.hasComment?`✎`:`—`,sort:e=>+!!e.hasComment},{header:w(),cell:e=>e.userClosedAt==null?e.answered?(0,X.jsx)(`span`,{className:`oc-fbadmin__pill is-ok`,children:N()}):(0,X.jsx)(`span`,{className:`oc-fbadmin__pill`,children:P()}):(0,X.jsx)(`span`,{className:`oc-fbadmin__pill is-closed`,children:oe()}),sort:e=>e.userClosedAt==null?+!!e.answered:2}],rowActions:e=>[{label:a===e._id?M():k(),onSelect:()=>void f(e)},{label:q(),onSelect:()=>void p(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 r,AS as ee,BE as te,GE as ne,HE as re,IE as ie,JE as ae,KE as oe,LE as se,QE as i,RE as a,UE as o,VD as s,VE as c,WE as l,XE as u,YE as ce,ZE as le,_D as ue,aD as d,cD as de,dD as fe,eD as f,fD as pe,fO as p,gD as me,hD as he,iD as m,lD as ge,mD as h,nD as g,oD as _,pD as v,qE as _e,rD as y,sD as b,tD as x,uD as S,vO as C,yO as w,zD as T,zE as E}from"./dist-DsBcH2-2.js";import{t as D}from"./button-9c1aLUeO.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-DsOZBPOX.js";import{a as Oe,i as V,n as ke,o as H,r as U,t as Ae}from"./table-C2kpo1_K.js";var W=t(e(),1),G=n(),K=`all`;function q(e){switch(e){case`image`:return _();case`audio`:return d();case`video`:return m();case`pdf`:return y();case`document`:return g();case`archive`:return x();default:return f()}}function J(){let[e,t]=(0,W.useState)(K),[n,d]=(0,W.useState)(K),[f,m]=(0,W.useState)(K),[g,_]=(0,W.useState)(K),[y,x]=(0,W.useState)(null),J=C(p.files.softDelete),Y=O();function je(){t(K),d(K),m(K),_(K)}async function Me(){let e=y;if(x(null),e)try{await J({fileId:e.id}),Y.success(o())}catch(e){Y.error(re(),e)}}let X=w(p.files.listMine,{direction:e===K?void 0:e,chatId:n===K?void 0:n,instanceName:f===K?void 0:f,category:g===K?void 0:g}),Ne=(0,W.useMemo)(()=>new Intl.DateTimeFormat(s(),{dateStyle:`medium`,timeStyle:`short`}),[]);if(X===void 0)return(0,G.jsx)(`p`,{className:`oc-admin__hint`,children:T()});let{files:Z,facets:Q,truncated:Pe,cap:Fe}=X,$=e!==K||n!==K||f!==K||g!==K;return(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`p`,{className:`oc-admin__hint`,children:ue()}),(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":me(),children:(0,G.jsx)(A,{})}),(0,G.jsxs)(R,{children:[(0,G.jsx)(z,{value:K,children:he()}),(0,G.jsx)(z,{value:`inbound`,children:h()}),(0,G.jsx)(z,{value:`outbound`,children:v()})]})]}),(0,G.jsxs)(B,{value:n,onValueChange:d,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:fe()}),Q.chats.map(e=>(0,G.jsx)(z,{value:e.id,children:e.title},e.id))]})]}),Q.multiProvider?(0,G.jsxs)(B,{value:f,onValueChange:m,children:[(0,G.jsx)(L,{size:`sm`,"aria-label":S(),children:(0,G.jsx)(A,{})}),(0,G.jsxs)(R,{children:[(0,G.jsx)(z,{value:K,children:ge()}),Q.instances.map(e=>(0,G.jsx)(z,{value:e,children:e},e))]})]}):null,(0,G.jsxs)(B,{value:g,onValueChange:_,children:[(0,G.jsx)(L,{size:`sm`,"aria-label":de(),children:(0,G.jsx)(A,{})}),(0,G.jsxs)(R,{children:[(0,G.jsx)(z,{value:K,children:b()}),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}),oe()]}):null]}),Z.length===0?(0,G.jsx)(`p`,{className:`oc-admin__hint`,children:$?se():a()}):(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:r()}),(0,G.jsx)(V,{children:i()}),(0,G.jsx)(V,{children:le()}),(0,G.jsx)(V,{children:u()}),(0,G.jsx)(V,{children:ce()}),(0,G.jsx)(V,{className:`text-right`,children:ae()})]})}),(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`?h():v()})}),(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":ne(),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}),E()]}),(0,G.jsxs)(F,{variant:`destructive`,onSelect:()=>x({id:e._id,filename:e.filename}),children:[(0,G.jsx)(Te,{size:14}),l()]})]})]})})]},e._id))})]}),Pe?(0,G.jsx)(`p`,{className:`oc-admin__hint`,style:{marginTop:8},children:ie({cap:Fe})}):null]}),(0,G.jsx)(ve,{open:y!==null,onOpenChange:e=>!e&&x(null),children:(0,G.jsxs)(P,{children:[(0,G.jsxs)(De,{children:[(0,G.jsx)(k,{children:c()}),(0,G.jsx)(I,{children:te()})]}),(0,G.jsxs)(be,{children:[(0,G.jsx)(M,{children:ee()}),(0,G.jsx)(ye,{onClick:()=>void Me(),children:l()})]})]})})]})}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 D,Ta as O,To as te,Ua as k,Va as A,Wa as ne,Xa as re,Ya as j,Za as ie,_o as M,ao as ae,bo as oe,co as se,do as ce,eo as N,fO as P,fo as le,go as ue,ho as de,io as F,ja as fe,jo as pe,ka as me,ko as he,lo as ge,mo as _e,no as ve,oo as ye,pO as I,po as be,qa as xe,ro as Se,so as Ce,to as we,uo as Te,vO as L,vo as Ee,wa as De,wo as Oe,xo as ke,yO as R,yo as Ae,za as je}from"./dist-DsBcH2-2.js";import{t as Me}from"./x-CyUGhZ48.js";import{i as z,n as B,r as Ne,t as Pe}from"./tabs-D7vYdFs6.js";import{t as V}from"./button-9c1aLUeO.js";import{$ as Fe,A as H,At as Ie,C as Le,Q as Re,S as ze,X as U,Z as W,_ as G,_t as K,b as Be,et as Ve,gt as q,j as He,m as Ue,nt as We,ot as Ge,rt as Ke,x as qe,y as Je}from"./index-DsOZBPOX.js";import{t as Ye}from"./FilterBar-DWv8wqqC.js";import{t as Xe}from"./DataTableShell-VIRQvS8e.js";import{t as J}from"./DetailChips-YKc12Z-i.js";var Ze=I(`chevron-left`,[[`path`,{d:`m15 18-6-6 6-6`,key:`1wnfg3`}]]),Qe=I(`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`}]]),Y=I(`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`}]]),$e=I(`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`}]]),X=t(e(),1);function et(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 tt(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 nt(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 rt(e){switch(e){case`admin`:return N();case`user`:return r();case`pending`:return T();default:return e}}function it(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 Z(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=R(P.groups.listGroups,{}),t=R(P.me.getMe,{host:Ge})?.role===`admin`,n=L(P.groups.createGroup),r=L(P.groups.updateGroup),i=L(P.groups.deleteGroup),o=He(),f=H(),[p,m]=(0,X.useState)(!1),[h,g]=(0,X.useState)(null),[_,v]=(0,X.useState)($),[y,x]=(0,X.useState)(null),[S,w]=(0,X.useState)(``),T=(0,X.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 O(e){g(e),v({name:e.name,description:e.description??``}),m(!0)}async function k(){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 A(e){if(await o({title:_e({name:e.name}),description:be(),confirmWord:e.name,confirmLabel:le(),cancelLabel:oe(),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)(Ye,{q:S,onQChange:w,onReset:()=>w(``),canReset:S!==``,searchPlaceholder:te()}),(0,Q.jsx)(Xe,{title:ee(),rows:T,addLabel:pe(),onAdd:t?E:void 0,emptyHint:a(),columns:[{header:he(),cell:e=>e.name,sort:e=>e.name},{header:C(),cell:e=>(0,Q.jsx)(J,{icon:(0,Q.jsx)($e,{size:12,"aria-hidden":!0}),total:e.memberCount,items:e.members.map(e=>({label:e.label,marker:e.manager?(0,Q.jsx)(Y,{size:11,"aria-hidden":!0}):null,highlight:e.manager}))}),sort:e=>e.memberCount},{header:l(),cell:e=>(0,Q.jsx)(J,{icon:(0,Q.jsx)(K,{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)(J,{icon:(0,Q.jsx)(Qe,{size:12,"aria-hidden":!0}),total:e.chartCount,items:e.charts.map(e=>({label:e.name,marker:e.isDefault?(0,Q.jsx)(q,{size:11,fill:`currentColor`,"aria-hidden":!0}):null,highlight:e.isDefault}))}),sort:e=>e.chartCount}],rowActions:e=>[{label:Oe(),onSelect:()=>x({groupId:e._id,name:e.name})},...t?[{label:s(),onSelect:()=>O(e)},{label:D(),variant:`destructive`,onSelect:()=>void A(e)}]:[]]}),(0,Q.jsx)(Ue,{open:p,onOpenChange:m,title:h?Ee():Ae(),description:M(),canSubmit:!!_.name.trim(),onSubmit:k,submitLabel:ke(),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)(W,{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)(W,{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)(V,{type:`button`,variant:`ghost`,size:`sm`,disabled:e<=1,onClick:()=>n(e-1),children:[(0,Q.jsx)(Ze,{size:14,"aria-hidden":!0}),Se()]}),(0,Q.jsxs)(`span`,{className:`oc-access__pageinfo`,"aria-label":we({page:e,pages:t}),children:[e,` / `,t]}),(0,Q.jsxs)(V,{type:`button`,variant:`ghost`,size:`sm`,disabled:e>=t,onClick:()=>n(e+1),children:[ve(),(0,Q.jsx)(Ie,{size:14,"aria-hidden":!0})]})]})}function ct({groupId:e,groupName:t,open:n,onOpenChange:r}){let a=R(P.groups.getGroup,n&&e?{groupId:e}:`skip`),s=R(P.groups.listAssignableInstances,n?{}:`skip`),c=R(P.groups.listAssignableUsers,n?{}:`skip`),l=L(P.groups.addMember),u=L(P.groups.removeMember),d=L(P.groups.bulkSetMembers),f=L(P.groups.setGroupManager),p=H(),[m,h]=(0,X.useState)(``),[g,v]=(0,X.useState)(``),[b,x]=(0,X.useState)(`members`),[ee,S]=(0,X.useState)(1),[C,w]=(0,X.useState)(new Set),T=(0,X.useRef)(null),E=(0,X.useMemo)(()=>new Set((a?.members??[]).map(e=>e.userId)),[a]),D=(0,X.useMemo)(()=>new Set((a?.members??[]).filter(e=>e.manager).map(e=>e.userId)),[a]),te=a?.viewerIsAdmin===!0,k=(0,X.useMemo)(()=>new Set((a?.agents??[]).map(e=>`${e.instanceName}/${e.agentId}`)),[a]);(0,X.useEffect)(()=>{h(``),v(``),x(`members`),S(1),T.current=null},[n,e]),(0,X.useEffect)(()=>{S(1)},[m]),(0,X.useEffect)(()=>{n&&a&&e&&T.current!==e&&(T.current=e,w(new Set((a.members??[]).map(e=>e.userId))))},[n,a,e]);let A=(0,X.useMemo)(()=>c?et(c,m,C):[],[c,m,C]);async function ne(t,n){if(e)try{n?await u({groupId:e,userId:t}):await l({groupId:e,userId:t})}catch(e){p.error(O(),e)}}async function re(t,n){if(e)try{await f({groupId:e,userId:t,manager:!n})}catch(e){p.error(me(),e)}}let M=it(A,e=>E.has(e.userId)),oe=A.filter(e=>E.has(e.userId)).length,N=Z(A,ee,ot);async function le(){if(!e||A.length===0)return;let t=A.map(e=>e.userId);try{await d({groupId:e,userIds:t,member:M!==`all`})}catch(e){p.error(O(),e)}}return(0,Q.jsx)(Re,{open:n,onOpenChange:r,children:(0,Q.jsxs)(Fe,{className:`oc-access`,children:[(0,Q.jsxs)(We,{children:[(0,Q.jsx)(Ke,{children:ce({name:t})}),(0,Q.jsx)(Ve,{children:Te()})]}),(0,Q.jsxs)(Pe,{value:b,onValueChange:x,className:`oc-access__tabs`,children:[(0,Q.jsxs)(Ne,{className:`w-full`,children:[(0,Q.jsxs)(z,{value:`members`,className:`flex-1 gap-1.5`,children:[(0,Q.jsx)($e,{size:13,"aria-hidden":!0}),ge(),a?(0,Q.jsx)(U,{variant:`secondary`,className:`oc-access__tabcount`,children:E.size}):null]}),(0,Q.jsxs)(z,{value:`agents`,className:`flex-1 gap-1.5`,children:[(0,Q.jsx)(K,{size:13,"aria-hidden":!0}),Ce(),a?(0,Q.jsx)(U,{variant:`secondary`,className:`oc-access__tabcount`,children:k.size}):null]}),(0,Q.jsxs)(z,{value:`charts`,className:`flex-1 gap-1.5`,children:[(0,Q.jsx)(Qe,{size:13,"aria-hidden":!0}),o(),a?(0,Q.jsx)(U,{variant:`secondary`,className:`oc-access__tabcount`,children:a.chartCount}):null]})]}),(0,Q.jsx)(B,{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:xe()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(W,{value:m,onChange:e=>h(e.target.value),placeholder:se(),className:`oc-access__search`}),A.length===0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:ae()}):(0,Q.jsxs)(Q.Fragment,{children:[A.length>1?(0,Q.jsxs)(`div`,{className:`oc-access__row oc-access__selectall`,children:[(0,Q.jsx)(G,{checked:M===`all`?!0:M===`some`?`indeterminate`:!1,onCheckedChange:()=>void le(),"aria-label":F()}),(0,Q.jsx)(`span`,{className:`oc-access__label`,children:F()}),(0,Q.jsxs)(U,{variant:`outline`,className:`oc-access__count`,children:[oe,` / `,A.length]})]}):null,(0,Q.jsx)(`div`,{className:`oc-access__list`,children:N.pageItems.map(e=>{let t=E.has(e.userId),n=nt(e),r=D.has(e.userId);return(0,Q.jsxs)(`div`,{className:`oc-access__row`,children:[(0,Q.jsx)(G,{checked:t,onCheckedChange:()=>void ne(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)(U,{variant:`outline`,className:`oc-access__role`,children:rt(e.role)}),(0,Q.jsx)(`span`,{className:`oc-access__mgrslot`,children:t&&te?(0,Q.jsx)(V,{type:`button`,variant:`ghost`,size:`icon`,className:`shrink-0 oc-access__mgr${r?` oc-access__mgr--on`:``}`,"aria-pressed":r,"aria-label":r?i():fe(),title:r?i():fe(),onClick:()=>void re(e.userId,r),children:(0,Q.jsx)(Y,{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)(Y,{size:15,"aria-hidden":!0})}):null})]},e._id)})}),(0,Q.jsx)(st,{page:N.page,pageCount:N.pageCount,onPage:S})]})]})}),(0,Q.jsx)(B,{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)(W,{value:g,onChange:e=>v(e.target.value),placeholder:ye(),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:k,query:g},`${e}-${t._id}`))})]})}),(0,Q.jsx)(B,{value:`charts`,children:(0,Q.jsx)(ut,{groupId:e})})]})]})})}function lt({groupId:e,instanceName:t,kind:n,assigned:r,query:i}){let a=R(P.groups.listAssignableAgents,{instanceName:t}),o=L(P.groups.assignAgentToGroup),s=L(P.groups.removeAgentFromGroup),c=L(P.groups.bulkSetGroupAgents),l=H(),[u,d]=(0,X.useState)(1);if((0,X.useEffect)(()=>{d(1)},[i]),!e)return null;let f=tt(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=it(_,e=>r.has(`${t}/${e.agentId}`)),y=Z(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(De(),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(De(),e)}}return(0,Q.jsxs)(`div`,{className:`oc-access__group`,children:[(0,Q.jsxs)(`div`,{className:`oc-access__instance`,children:[(0,Q.jsx)(K,{size:13,"aria-hidden":!0}),(0,Q.jsx)(`span`,{children:t}),(0,Q.jsx)(U,{variant:`outline`,className:`oc-access__kind`,children:n}),h?(0,Q.jsx)(U,{variant:`outline`,className:`oc-access__stale`,children:k()}):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?ne():p()}):(0,Q.jsxs)(Q.Fragment,{children:[_.length>1?(0,Q.jsxs)(`div`,{className:`oc-access__row oc-access__selectall`,children:[(0,Q.jsx)(G,{checked:v===`all`?!0:v===`some`?`indeterminate`:!1,onCheckedChange:()=>void x(),"aria-label":F()}),(0,Q.jsx)(`span`,{className:`oc-access__label`,children:F()})]}):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)(G,{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":A(),title:A(),children:(0,Q.jsx)(q,{size:14,fill:`currentColor`})}):null,a?(0,Q.jsx)(U,{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=R(P.charts.listGroupChartSelection,e?{groupId:e}:`skip`),n=L(P.charts.assignChartToGroup),r=L(P.charts.removeChartFromGroup),i=L(P.charts.setGroupDefaultChart),a=L(P.charts.addChartToGroupPool),o=L(P.charts.removeChartFromGroupPool),s=H();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:je()});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)(G,{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)(q,{size:14,fill:`currentColor`})}):(0,Q.jsx)(V,{type:`button`,variant:`ghost`,size:`sm`,onClick:()=>void p(e.chartKey),children:x()}):null,u?(0,Q.jsx)(V,{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)(Me,{size:14,"aria-hidden":!0})}):null]},e.chartKey))}),u?l.length>0?(0,Q.jsxs)(Je,{value:``,onValueChange:e=>void m(e),children:[(0,Q.jsx)(ze,{size:`sm`,className:`oc-access__search`,children:(0,Q.jsx)(Le,{placeholder:v()})}),(0,Q.jsx)(Be,{children:l.map(e=>(0,Q.jsx)(qe,{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,A_ as a,Ag as o,Bg as s,C_ as c,Cg as l,D_ as u,Dg as d,E_ as f,Eg as p,Fg as m,Gg as h,Hd as g,Hg as _,Ig as v,Jg as y,Jh as b,Kg as x,L as S,Lg as ee,M_ as C,Mg as w,N_ as T,Ng as E,O_ as D,Og as te,Pg as ne,Qg as re,Qh as ie,R as ae,Rg as oe,S_ as se,Sg as ce,T_ as le,Tg as ue,Ud as de,Ug as fe,Vg as pe,Wg as me,Xg as he,Xh as ge,Yg as O,Yh as _e,Zg as ve,Zh as ye,__ as be,_g as k,a_ as xe,ag as Se,bC as Ce,b_ as we,bg as Te,c_ as Ee,cg as De,d_ as Oe,dg as ke,e_ as Ae,eg as je,fO as A,f_ as Me,fg as Ne,gO as j,g_ as Pe,gg as Fe,h_ as Ie,hg as Le,i_ as Re,ig as ze,j_ as Be,jg as Ve,k_ as He,kg as Ue,l_ as We,lg as Ge,m_ as Ke,mg as M,n_ as qe,ng as Je,o_ as Ye,og as Xe,p_ as Ze,pg as Qe,qg as $e,qh as et,r_ as tt,rg as nt,s_ as rt,sg as it,t_ as at,tg as ot,u_ as st,ug as ct,vO as N,v_ as lt,vg as ut,w_ as dt,wg as ft,x_ as pt,xg as mt,yC as ht,yO as P,y_ as gt,yg as F,zg as I}from"./dist-DsBcH2-2.js";import{a as _t,c as vt}from"./FieldLabel-BYZOkwDx.js";import{t as L}from"./button-9c1aLUeO.js";import{$ as R,A as z,C as B,H as yt,Q as V,S as H,U as bt,V as xt,X as U,Z as W,_ as G,b as K,et as q,j as St,m as Ct,nt as wt,rt as Tt,x as J,y as Et}from"./index-DsOZBPOX.js";import{t as Dt}from"./DataTableShell-VIRQvS8e.js";import{InstanceConfigDialog as Ot}from"./BridgeTab-DNaXjHu5.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:_t},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=P(A.admin.listInstances,{}),t=P(A.agents.listAllInstanceAgents,{}),n=N(A.admin.upsertInstance),r=N(A.admin.deleteInstance),i=z(),[o,s]=(0,Y.useState)(!1),[l,d]=(0,Y.useState)(Q),[p,m]=(0,Y.useState)(null),[h,_]=(0,Y.useState)(null),[v,y]=(0,Y.useState)(null),[x,S]=(0,Y.useState)(null);async function ee(){try{await n({instanceId:x??void 0,name:l.name,gatewayUrl:l.gatewayUrl,bridgeUrl:l.bridgeUrl||void 0,displayName:l.displayName||void 0,kind:l.kind,gatewayVersion:l.gatewayVersion||void 0,gatewayHttpUrl:l.gatewayHttpUrl||void 0,streamTransport:l.streamTransport}),d(Q),S(null),s(!1)}catch(e){i.error(Be(),e)}}return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`p`,{className:`oc-admin__hint`,children:[a(),(0,Z.jsx)(`strong`,{children:He()}),D()]}),(0,Z.jsx)(Dt,{title:u(),rows:e,addLabel:f(),onAdd:()=>{S(null),d(Q),s(!0)},emptyHint:le(),columns:[{header:dt(),cell:e=>e.name,sort:e=>e.name},{header:c(),cell:e=>(0,Z.jsx)(U,{variant:`outline`,children:e.kind??`openclaw`}),sort:e=>e.kind??`openclaw`},{header:se(),cell:e=>e.gatewayUrl,sort:e=>e.gatewayUrl},{header:pt(),cell:e=>e.displayName??`—`,sort:e=>e.displayName??null},{header:T(),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)(U,{variant:r(e.agentId)?`default`:`outline`,title:r(e.agentId)?b():void 0,children:[e.emoji?`${e.emoji} `:``,e.displayName??e.agentId]},e.agentId))})}}],rowActions:e=>[{label:be(),onSelect:()=>{S(e._id),d(Nt(e)),s(!0)}},{label:C(),onSelect:()=>m(e.name)},{label:qe(),onSelect:()=>y(e)},{label:we(),onSelect:()=>_(e)},{label:gt(),variant:`destructive`,onSelect:()=>void r({instanceId:e._id})}],bulkActions:[{label:gt(),variant:`destructive`,onSelect:e=>e.forEach(e=>void r({instanceId:e}))}]}),(0,Z.jsx)(Ct,{open:o,onOpenChange:s,title:x?Pe():lt(),description:Ke(),canSubmit:!!(l.name&&l.gatewayUrl),onSubmit:ee,submitLabel:Ze(),children:(0,Z.jsxs)(`div`,{className:`oc-form`,children:[(0,Z.jsxs)($,{label:Me(),children:[(0,Z.jsx)(W,{value:l.name,disabled:x!==null,onChange:e=>d({...l,name:e.target.value})}),x?(0,Z.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:Ie()}):null]}),(0,Z.jsx)($,{label:Oe(),children:(0,Z.jsxs)(Et,{value:l.kind,onValueChange:e=>d({...l,kind:e}),children:[(0,Z.jsx)(H,{size:`sm`,className:`w-40`,children:(0,Z.jsx)(B,{})}),(0,Z.jsxs)(K,{children:[(0,Z.jsx)(J,{value:`openclaw`,children:`OpenClaw`}),(0,Z.jsx)(J,{value:`hermes`,children:`Hermes`})]})]})}),(0,Z.jsx)($,{label:st(),children:(0,Z.jsx)(W,{value:l.gatewayUrl,onChange:e=>d({...l,gatewayUrl:e.target.value})})}),(0,Z.jsx)($,{label:We(),children:(0,Z.jsx)(W,{value:l.bridgeUrl,placeholder:Ee(),onChange:e=>d({...l,bridgeUrl:e.target.value})})}),(0,Z.jsx)($,{label:rt(),children:(0,Z.jsx)(W,{value:l.displayName,onChange:e=>d({...l,displayName:e.target.value})})}),(0,Z.jsxs)($,{label:de(),children:[(0,Z.jsxs)(Et,{value:l.streamTransport,onValueChange:e=>d({...l,streamTransport:e}),children:[(0,Z.jsx)(H,{size:`sm`,className:`w-40`,children:(0,Z.jsx)(B,{})}),(0,Z.jsx)(K,{children:vt.map(e=>(0,Z.jsx)(J,{value:e,children:e},e))})]}),(0,Z.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:g()})]}),(0,Z.jsx)($,{label:Ye(),children:(0,Z.jsx)(W,{value:l.gatewayVersion,placeholder:xe(),onChange:e=>d({...l,gatewayVersion:e.target.value})})}),(0,Z.jsx)($,{label:Re(),children:(0,Z.jsx)(W,{value:l.gatewayHttpUrl,placeholder:tt(),onChange:e=>d({...l,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:()=>_(null)},h._id):null,v?(0,Z.jsx)(Ft,{instance:v,onClose:()=>y(null)},v._id):null]})}function Ft({instance:e,onClose:t}){let n=P(A.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)(V,{open:!0,onOpenChange:e=>!e&&t(),children:(0,Z.jsxs)(R,{onOpenAutoFocus:e=>e.preventDefault(),children:[(0,Z.jsxs)(wt,{children:[(0,Z.jsx)(Tt,{children:at({instance:e.displayName??e.name})}),(0,Z.jsx)(q,{children:Ae()})]}),(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=j(A.instanceSync.forceInstanceSync),n=z(),[r,i]=(0,Y.useState)(!1);async function a(){if(!r){i(!0);try{switch((await t({instanceId:e._id})).status){case`synced`:n.success(ne());break;case`no_agents`:n.success(w());break;case`no_bridge_url`:n.error(Ve());break;case`deploy_misconfigured`:n.error(o());break;case`unauthorized`:n.error(te());break;case`not_served`:n.error(d());break;default:n.error(Ue());break}}catch(e){n.error(E(),e)}finally{i(!1)}}}return(0,Z.jsxs)(`div`,{className:`oc-form`,children:[(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:p()}),(0,Z.jsx)(`div`,{className:`flex items-center gap-2`,children:(0,Z.jsx)(L,{size:`sm`,variant:`outline`,onClick:()=>void a(),disabled:r,children:r?m():v()})})]})}function Lt({instance:e}){let t=P(A.bridgeAuth.listBridgeAuthStatus,{}),n=j(A.bridgeAuth.mintBridgeSecret),r=N(A.bridgeAuth.revokeBridgeSecret),i=z(),[a,o]=(0,Y.useState)(!1),[s,c]=(0,Y.useState)(null),[u,d]=(0,Y.useState)(!1),f=(t??[]).find(t=>t.instanceId===e._id),p=f!==void 0;async function m(){if(!a){o(!0);try{c((await n({instanceId:e._id})).plaintext),d(!1)}catch(e){i.error(F(),e)}finally{o(!1)}}}async function h(){if(!a){o(!0);try{await r({instanceId:e._id}),c(null),i.success(Te())}catch(e){i.error(F(),e)}finally{o(!1)}}}async function g(){if(s)try{await navigator.clipboard.writeText(s),d(!0)}catch{}}return(0,Z.jsxs)($,{label:ue(),children:[(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:ft()}),(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Z.jsx)(U,{variant:p?`outline`:`secondary`,children:p?`${he()} · ${f.prefix}…${f.lastFour}`:O()}),(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(L,{size:`sm`,onClick:()=>void m(),disabled:a,children:p?ce():l()}),p?(0,Z.jsx)(L,{size:`sm`,variant:`destructive`,onClick:()=>void h(),disabled:a,children:mt()}):null]})]}),s?(0,Z.jsxs)(`div`,{className:`oc-bridgesecret__reveal`,children:[(0,Z.jsx)(`p`,{className:`oc-sa__minted-warning`,children:ut()}),(0,Z.jsxs)(`div`,{className:`oc-sa__minted-box`,children:[(0,Z.jsx)(`code`,{className:`oc-sa__minted-plain`,children:s}),(0,Z.jsx)(L,{variant:`outline`,size:`sm`,onClick:()=>void g(),children:u?Ce():ht()})]}),(0,Z.jsx)(L,{size:`sm`,variant:`ghost`,onClick:()=>{c(null),d(!1)},children:k()})]}):null]})}function Rt({instanceId:e,field:t,updatedAt:n}){let i=j(A.instanceSecrets.setInstanceSecret),a=N(A.instanceSecrets.clearInstanceSecret),o=j(A.deviceIdentity.generateDeviceIdentity),c=z(),[l,u]=(0,Y.useState)(``),[d,f]=(0,Y.useState)(!1),[p,m]=(0,Y.useState)(null),[g,v]=(0,Y.useState)(!1),b=n!==null,S=t===`deviceIdentity`,C=t===`token`?r():t===`deviceIdentity`?re():ve();async function w(){if(!(!l.trim()||d)){f(!0);try{await i({instanceId:e,field:t,plaintext:l}),u(``),m(null),v(!1),c.success(me())}catch(e){c.error(fe(),e)}finally{f(!1)}}}async function T(){if(!d){f(!0);try{await a({instanceId:e,field:t}),m(null),v(!1),c.success(_())}catch(e){c.error(fe(),e)}finally{f(!1)}}}async function E(){if(!d){f(!0);try{m(await o({instanceId:e})),v(!1),c.success(I())}catch(e){c.error(ee(),e)}finally{f(!1)}}}let D=p?`openclaw devices approve ${p.id}`:``;async function te(){if(D)try{await navigator.clipboard.writeText(D),v(!0)}catch{}}return(0,Z.jsxs)($,{label:C,children:[S?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:s()}):null,(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Z.jsx)(U,{variant:b?`outline`:`secondary`,children:b?he():O()}),(0,Z.jsx)(W,{type:`password`,autoComplete:`off`,className:`flex-1 min-w-32`,value:l,placeholder:b?$e():y(),onChange:e=>u(e.target.value)}),(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(L,{size:`sm`,onClick:()=>void w(),disabled:d||l.trim().length===0,children:x()}),S?(0,Z.jsx)(L,{size:`sm`,variant:`outline`,onClick:()=>void E(),disabled:d,children:pe()}):null,b?(0,Z.jsx)(L,{size:`sm`,variant:`destructive`,onClick:()=>void T(),disabled:d,children:h()}):null]})]}),p?(0,Z.jsxs)(`div`,{className:`oc-bridgesecret__reveal`,children:[(0,Z.jsx)(`p`,{className:`text-sm font-medium`,children:I()}),(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:oe()}),(0,Z.jsxs)(`div`,{className:`oc-sa__minted-box`,children:[(0,Z.jsx)(`code`,{className:`oc-sa__minted-plain`,children:D}),(0,Z.jsx)(L,{variant:`outline`,size:`sm`,onClick:()=>void te(),children:g?Ce():ht()})]}),(0,Z.jsx)(L,{size:`sm`,variant:`ghost`,onClick:()=>{m(null),v(!1)},children:k()})]}):null]})}var zt={conversational:Ge,documentary:it,summarizer:ae},Bt={conversational:De,documentary:Xe,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:Qe()}),t.map(e=>(0,Z.jsx)(U,{variant:`secondary`,className:`oc-agenttype__chip`,title:Ht(e),children:Vt(e)},e)),(0,Z.jsxs)(xt,{children:[(0,Z.jsx)(bt,{asChild:!0,children:(0,Z.jsx)(L,{type:`button`,variant:`outline`,size:`sm`,className:`h-7`,children:Ne()})}),(0,Z.jsxs)(yt,{align:`start`,className:`oc-agenttypes-pop`,children:[(0,Z.jsx)(`p`,{className:`oc-agenttypes-pop__title`,children:ke()}),(0,Z.jsx)(`p`,{className:`oc-agenttypes-pop__hint`,children:ct()}),(0,Z.jsx)(`div`,{className:`oc-agenttypes-pop__list`,children:X.map(r=>{let i=`agtype-${e}-${r}`;return(0,Z.jsxs)(`div`,{className:`oc-agenttypes-pop__item`,children:[(0,Z.jsx)(G,{id:i,checked:t.includes(r),onCheckedChange:()=>n(r)}),(0,Z.jsxs)(`label`,{htmlFor:i,className:`oc-agenttypes-pop__text`,children:[(0,Z.jsx)(`span`,{className:`oc-agenttypes-pop__name`,children: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=P(A.agents.listAgentsForInstance,t&&e?{instanceName:e}:`skip`),a=N(A.agents.setAgentEnabled).withOptimisticUpdate((e,{instanceName:t,agentId:n,enabled:r})=>{let i=e.getQuery(A.agents.listAgentsForInstance,{instanceName:t});i&&e.setQuery(A.agents.listAgentsForInstance,{instanceName:t},{...i,agents:i.agents.map(e=>e.agentId===n?{...e,enabled:r}:e)})}),o=N(A.agents.setInstanceDefaultAgent).withOptimisticUpdate((e,{instanceName:t,agentId:n})=>{let r=e.getQuery(A.agents.listAgentsForInstance,{instanceName:t});r&&e.setQuery(A.agents.listAgentsForInstance,{instanceName:t},{...r,defaultAgentId:n})}),s=N(A.agents.setAgentTypes).withOptimisticUpdate((e,{instanceName:t,agentId:n,types:r})=>{let i=e.getQuery(A.agents.listAgentsForInstance,{instanceName:t});if(!i)return;let a=jt(r);e.setQuery(A.agents.listAgentsForInstance,{instanceName:t},{...i,agents:i.agents.map(e=>e.agentId===n?{...e,types:a}:e)})}),c=N(A.agents.removeInstanceAgent),l=St(),u=z();async function d(t,n){if(e)try{await a({instanceName:e,agentId:t,enabled:n})}catch(e){u.error(M(),e)}}async function f(t){if(e)try{await o({instanceName:e,agentId:t})}catch(e){u.error(M(),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(M(),e)}}async function m(t,n){if(e&&await l({title:nt({name:n}),description:Je(),confirmLabel:ot(),destructive:!0}))try{await c({instanceName:e,agentId:t}),u.success(je())}catch(e){u.error(M(),e)}}return(0,Z.jsx)(V,{open:t,onOpenChange:n,children:(0,Z.jsxs)(R,{className:`oc-access`,children:[(0,Z.jsxs)(wt,{children:[(0,Z.jsx)(Tt,{children:Fe({name:e??``})}),(0,Z.jsx)(q,{children:Le()})]}),r===void 0?(0,Z.jsx)(`p`,{className:`oc-access__hint`,children:i()}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`div`,{className:`oc-access__poll`,children:r.discovery===null?ie():r.discovery.lastPollOk?ye():ge({error:r.discovery.error??`?`})}),r.agents.length===0?(0,Z.jsx)(`p`,{className:`oc-access__hint`,children:_e()}):(0,Z.jsx)(`div`,{className:`oc-access__list`,children:r.agents.map(e=>{let t=e.presentInLastOk===!1,n=r.defaultAgentId===e.agentId,i=e.displayName??e.agentId,a=e.types??[];return(0,Z.jsxs)(`div`,{className:`oc-agentcard`+(e.enabled?``:` oc-agentcard--off`),children:[(0,Z.jsxs)(`div`,{className:`oc-agentcard__head`,children:[(0,Z.jsx)(G,{checked:e.enabled,disabled:t,"aria-label":i,onCheckedChange:t=>void 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)(U,{variant:`outline`,className:`oc-access__gone`,children:et()}),(0,Z.jsx)(L,{size:`sm`,variant:`ghost`,className:`h-7 text-destructive`,onClick:()=>void m(e.agentId,i),children:ze()})]}):n?(0,Z.jsx)(U,{variant:`default`,children:b()}):(0,Z.jsx)(L,{size:`sm`,variant:`outline`,className:`h-7`,disabled:!e.enabled,onClick:()=>void f(e.agentId),children:Se()})]}),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,$y as i,Ay as a,By as o,Cy as s,Dy as c,Ey as l,Fy as u,Gy as ee,Hy as d,Iy as te,Jy as f,Ky as ne,Ly as p,My as re,Ny as ie,Oy as ae,Py as oe,Qt as m,Qy as h,Ry as g,Sy as se,Ty as ce,Uy as le,Vy as _,Wy as ue,Xy as v,Yy as y,Zt as b,Zy as x,_y as S,an as C,by as w,dy as T,eb as E,en as D,fO as O,fy as k,gO as A,gy as j,hy as M,in as N,jy as P,ky as F,ly as I,my as L,nn as R,py as z,qy as B,rn as V,tb as H,tn as U,uy as de,vO as W,vy as fe,wy as pe,xy as me,yO as he,yy as ge,zy as _e}from"./dist-DsBcH2-2.js";import{t as G}from"./button-9c1aLUeO.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-DsOZBPOX.js";import{t as we}from"./DataTableShell-VIRQvS8e.js";var J=t(e(),1),Y=n();function Te(){let e=he(O.integrations.status.status,{}),t=W(O.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:H()});let m=n,b=(e,t,n)=>r({...m,[e]:{...m[e],[t]:n}}),D=(e,n)=>void t({[e]:n});return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(`p`,{className:`oc-admin__hint`,children:[E(),` `,(0,Y.jsx)(`strong`,{children:i()}),` `,h()]}),(0,Y.jsxs)(X,{title:`Langfuse`,status:e.langfuse.configured?e.langfuse.enabled?(0,Y.jsx)(K,{variant:`secondary`,children:x()}):(0,Y.jsx)(K,{variant:`outline`,children:v()}):(0,Y.jsx)(K,{variant:`outline`,children:y()}),note:B(),children:[(0,Y.jsx)(Z,{label:ee(),children:(0,Y.jsx)(q,{value:m.langfuse.host??``,placeholder:e.langfuse.effectiveHost,onChange:e=>b(`langfuse`,`host`,e.target.value),onBlur:()=>D(`langfuse`,{host:m.langfuse.host??``})})}),(0,Y.jsx)(Q,{label:_(),checked:m.langfuse.enabled??!0,onChange:e=>{b(`langfuse`,`enabled`,e),D(`langfuse`,{enabled:e})}})]}),(0,Y.jsxs)(X,{title:`Opik`,status:e.opik.configured?e.opik.enabled?(0,Y.jsx)(K,{variant:`secondary`,children:x()}):(0,Y.jsx)(K,{variant:`outline`,children:v()}):(0,Y.jsx)(K,{variant:`outline`,children:y()}),note:ne(),children:[(0,Y.jsx)(Z,{label:ue(),children:(0,Y.jsx)(q,{value:m.opik.baseUrl??``,placeholder:e.opik.effectiveBaseUrl,onChange:e=>b(`opik`,`baseUrl`,e.target.value),onBlur:()=>D(`opik`,{baseUrl:m.opik.baseUrl??``})})}),(0,Y.jsx)(Z,{label:le(),children:(0,Y.jsx)(q,{value:m.opik.workspace??``,placeholder:e.opik.effectiveWorkspace||d(),onChange:e=>b(`opik`,`workspace`,e.target.value),onBlur:()=>D(`opik`,{workspace:m.opik.workspace??``})})}),(0,Y.jsx)(Q,{label:_(),checked:m.opik.enabled??!0,onChange:e=>{b(`opik`,`enabled`,e),D(`opik`,{enabled:e})}})]}),(0,Y.jsxs)(X,{title:`OpenTelemetry (OTLP)`,status:e.otlp.configured?e.otlp.enabled?(0,Y.jsx)(K,{variant:`secondary`,children:x()}):(0,Y.jsx)(K,{variant:`outline`,children:v()}):(0,Y.jsx)(K,{variant:`outline`,children:C()}),note:N(),children:[(0,Y.jsx)(Z,{label:V(),children:(0,Y.jsx)(q,{value:m.otlp.endpoint??``,placeholder:e.otlp.effectiveEndpoint||`https://otlp.example.com/v1/traces`,onChange:e=>b(`otlp`,`endpoint`,e.target.value),onBlur:()=>D(`otlp`,{endpoint:m.otlp.endpoint??``})})}),(0,Y.jsx)(Ee,{headersSet:e.otlp.headersSet}),(0,Y.jsx)(Q,{label:_(),checked:m.otlp.enabled??!0,onChange:e=>{b(`otlp`,`enabled`,e),D(`otlp`,{enabled:e})}})]}),(0,Y.jsxs)(X,{title:o(),status:(0,Y.jsx)(K,{variant:`outline`,children:f()}),note:_e(),children:[(0,Y.jsx)(Z,{label:g(),children:(0,Y.jsx)($,{value:m.tts.auto??`off`,options:[[`off`,p()],[`always`,te()],[`inbound`,u()],[`tagged`,oe()]],onChange:e=>{b(`tts`,`auto`,e),D(`tts`,{auto:e})}})}),(0,Y.jsx)(Z,{label:ie(),children:(0,Y.jsx)($,{value:m.tts.provider??`openai`,options:[[`openai`,`OpenAI`],[`elevenlabs`,`ElevenLabs`],[`microsoft`,re()],[`azure`,`Azure Speech`],[`google`,`Google Gemini`]],onChange:e=>{b(`tts`,`provider`,e),D(`tts`,{provider:e})}})}),(0,Y.jsx)(Z,{label:P(),children:(0,Y.jsx)(q,{value:m.tts.model??``,placeholder:`eleven_multilingual_v2`,onChange:e=>b(`tts`,`model`,e.target.value),onBlur:()=>D(`tts`,{model:m.tts.model??``})})}),(0,Y.jsx)(Z,{label:a(),children:(0,Y.jsx)(q,{value:m.tts.voice??``,placeholder:F(),onChange:e=>b(`tts`,`voice`,e.target.value),onBlur:()=>D(`tts`,{voice:m.tts.voice??``})})})]}),(0,Y.jsxs)(X,{title:ae(),status:(0,Y.jsx)(K,{variant:`outline`,children:f()}),note:e.secrets.openai?c():l(),children:[(0,Y.jsx)(Q,{label:ce(),checked:m.talk.enabled??!1,onChange:e=>{b(`talk`,`enabled`,e),D(`talk`,{enabled:e})}}),(0,Y.jsx)(Z,{label:pe(),children:(0,Y.jsx)($,{value:m.talk.realtimeProvider??`openai`,options:[[`openai`,`OpenAI (gpt-realtime)`],[`google`,`Google`]],onChange:e=>{b(`talk`,`realtimeProvider`,e),D(`talk`,{realtimeProvider:e})}})}),(0,Y.jsx)(Z,{label:s(),children:(0,Y.jsx)(q,{value:m.talk.realtimeModel??``,placeholder:`gpt-realtime-2`,onChange:e=>b(`talk`,`realtimeModel`,e.target.value),onBlur:()=>D(`talk`,{realtimeModel:m.talk.realtimeModel??``})})}),(0,Y.jsx)(Z,{label:a(),children:(0,Y.jsx)(q,{value:m.talk.voice??``,placeholder:`cedar / marin`,onChange:e=>b(`talk`,`voice`,e.target.value),onBlur:()=>D(`talk`,{voice:m.talk.voice??``})})}),(0,Y.jsx)(Z,{label:se(),children:(0,Y.jsx)($,{value:m.talk.transport??`webrtc`,options:[[`webrtc`,me()],[`provider-websocket`,`Provider WebSocket`],[`gateway-relay`,`Gateway relay`]],onChange:e=>{b(`talk`,`transport`,e),D(`talk`,{transport:e})}})}),(0,Y.jsx)(Z,{label:w(),children:(0,Y.jsx)(q,{value:m.talk.speechLocale??``,placeholder:`fr-CA`,onChange:e=>b(`talk`,`speechLocale`,e.target.value),onBlur:()=>D(`talk`,{speechLocale:m.talk.speechLocale??``})})}),(0,Y.jsx)(Q,{label:ge(),checked:m.talk.interruptOnSpeech??!0,onChange:e=>{b(`talk`,`interruptOnSpeech`,e),D(`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:fe()}),(0,Y.jsx)(K,{variant:`outline`,children:S()})]}),(0,Y.jsxs)(`p`,{className:`oc-uipa__note`,children:[j(),(0,Y.jsx)(`code`,{children:` voicewake.get/set`}),`.`]})]}),(0,Y.jsx)(we,{title:M(),rows:e.cursors.map(e=>({...e,_id:e.vendor})),emptyHint:L(),columns:[{header:z(),cell:e=>(0,Y.jsx)(K,{variant:`secondary`,children:e.vendor}),sort:e=>e.vendor},{header:k(),cell:e=>e.lastAt>0?new Date(e.lastAt).toLocaleString(`fr-FR`):`—`,sort:e=>e.lastAt>0?e.lastAt:null},{header:T(),cell:e=>String(e.failureCount),sort:e=>e.failureCount},{header:de(),cell:e=>e.lastErrorStatus??`—`,sort:e=>e.lastErrorStatus??null},{header:I(),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=A(O.integrations.otlpSecret.setOtlpHeaders),n=W(O.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:R(),children:[(0,Y.jsx)(q,{value:i,placeholder:e?U():D(),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:m()}):null]}),o?(0,Y.jsx)(`p`,{className:`oc-int__otlp-headers-error`,children:o}):null,(0,Y.jsx)(`p`,{className:`oc-uipa__note`,children:b()})]})}export{Te as IntegrationsTab};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Ab as r,Bb as i,Lb as a,Rb as o,au as s,cu as c,du as l,dx as u,fO as d,fu as f,gu as p,hu as m,iu as h,kb as g,lu as _,mu as v,ou as y,pu as b,ru as x,su as S,uu as C,yO as w,zb as T}from"./dist-DsBcH2-2.js";import{Mt as E,a as ee,jt as te,n as ne,ot as re,r as D}from"./index-DsOZBPOX.js";import{a as O,n as k,o as A,r as j,t as M}from"./card-DNbBWwxH.js";import{n as N,t as P}from"./TimeRangePicker-CPM9eoXo.js";var F=t(e(),1),I=n(),L=15,R=e=>String(Math.round(e));function z(){let e=w(d.me.getMe,{host:re})?.permissions?.includes(`traces.read`)??!1,t=w(d.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:u()}),(0,I.jsxs)(M,{children:[(0,I.jsxs)(O,{children:[(0,I.jsx)(A,{children:i()}),(0,I.jsx)(j,{children:o()})]}),(0,I.jsx)(k,{children:n.length<2?(0,I.jsx)(`p`,{className:`oc-admin__hint`,children:a()}):(0,I.jsx)(B,{series:n})})]})]})}function B({series:e}){let t=e.map(e=>e.cP50),n=e.map(e=>e.aP50),a=Math.max(1,...t,...n),o=t=>6+t*468/(e.length-1),s=e=>74-e*68/a,c=e=>e.map((e,t)=>`${t===0?`M`:`L`}${o(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:[g(),` p50 `,R(l.cP50),` `,T()]}),(0,I.jsxs)(`span`,{children:[r(),` p50 `,R(l.aP50),` `,T()]})]}),(0,I.jsxs)(`svg`,{viewBox:`0 0 480 80`,className:`h-20 w-full`,preserveAspectRatio:`none`,role:`img`,"aria-label":i(),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:p(),unit:`/h`,group:`API`,isError:!1},{metric:`api.errors`,label:m(),unit:`/h`,group:`API`,isError:!0},{metric:`api.latency.avg_ms`,label:v(),unit:`ms`,group:`API`,isError:!1},{metric:`openclaw.ingest`,label:b(),unit:`/h`,group:`OpenClaw`,isError:!1},{metric:`chat.send`,label:f(),unit:`/h`,group:`Chat`,isError:!1},{metric:`assistant.stream.errors`,label:l(),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:s}=K(i,a),l=w(d.kpi.listKpis,{limit:o,filter:{from:i,to:a}}),u=(0,F.useMemo)(()=>{let e=new Map;for(let t of l??[]){let n=e.get(t.metric)??[];n.push({bucket:t.bucket,value:t.value}),e.set(t.metric,n)}for(let[t,n]of e)n.sort((e,t)=>e.bucket<t.bucket?-1:+(e.bucket>t.bucket)),n.length>s&&e.set(t,n.slice(n.length-s));return e},[l,s]),f=(0,I.jsxs)(I.Fragment,{children:[(0,I.jsxs)(`p`,{className:`oc-admin__hint`,children:[C(),` `,(0,I.jsx)(`span`,{className:`oc-filter__window`,children:_()})]}),(0,I.jsx)(J,{value:n,onChange:r})]});return l===void 0?(0,I.jsxs)(I.Fragment,{children:[f,(0,I.jsx)(z,{}),(0,I.jsx)(`p`,{className:`oc-admin__hint`,children:c()})]}):l.length===0?(0,I.jsxs)(I.Fragment,{children:[f,(0,I.jsx)(z,{}),(0,I.jsx)(`p`,{className:`oc-admin__hint`,children:S()})]}):(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=>(u.get(e.metric)??[]).length>0)?(0,I.jsxs)(`section`,{className:`oc-kpi__group`,children:[(0,I.jsx)(`h2`,{className:`oc-kpi__group-title`,children:e}),(0,I.jsx)(`div`,{className:`oc-kpi__grid`,children:t.map(e=>(0,I.jsx)(Y,{config:e,series:u.get(e.metric)??[]},e.metric))})]},e):null})]})}function J({value:e,onChange:t}){return(0,I.jsx)(`div`,{className:`oc-kpi__toolbar`,children:(0,I.jsx)(P,{value:e,onChange:t})})}function Y({config:e,series:t}){let n=t.length>0?t[t.length-1]:null,r=n?n.value:0;return(0,I.jsxs)(M,{size:`sm`,className:`oc-kpi__card`,children:[(0,I.jsxs)(O,{children:[(0,I.jsx)(A,{className:`oc-kpi__card-title`,children:e.label}),(0,I.jsx)(j,{className:`oc-kpi__card-metric`,children:(0,I.jsx)(`code`,{children:e.metric})})]}),(0,I.jsxs)(k,{className:`oc-kpi__card-body`,children:[(0,I.jsxs)(`div`,{className:`oc-kpi__value-row`,children:[(0,I.jsx)(`span`,{className:`oc-kpi__value`+(e.isError&&r>0?` oc-kpi__value--error`:``),children:Q(r)}),(0,I.jsx)(`span`,{className:`oc-kpi__unit`,children:e.unit})]}),(0,I.jsx)(ae,{series:t,isError:e.isError,unit:e.unit}),(0,I.jsxs)(`div`,{className:`oc-kpi__axis`,children:[n?(0,I.jsx)(`span`,{className:`oc-kpi__axis-latest`,children:y({value:$(n.bucket)})}):(0,I.jsx)(`span`,{className:`oc-kpi__muted`,children:s()}),(0,I.jsx)(`span`,{className:`oc-kpi__muted`,children:h({count:t.length})})]})]})]})}var X=240,Z=48,ie=1;function ae({series:e,isError:t,unit:n}){if(e.length===0)return(0,I.jsx)(`div`,{className:`oc-kpi__chart oc-kpi__chart--empty`,"aria-hidden":!0});let r=e.reduce((e,t)=>t.value>e?t.value:e,0),i=X/e.length,a=Math.max(i-ie,1);return(0,I.jsx)(`svg`,{className:`oc-kpi__chart`,viewBox:`0 0 ${X} ${Z}`,preserveAspectRatio:`none`,role:`img`,"aria-label":x({max:Q(r),unit:n}),children:e.map((e,o)=>{let s=r>0?e.value/r*(Z-1):0,c=o*i,l=Z-s;return(0,I.jsx)(`rect`,{className:`oc-kpi__bar`+(t&&e.value>0?` oc-kpi__bar--error`:``),x:c,y:l,width:a,height:s,children:(0,I.jsxs)(`title`,{children:[$(e.bucket),` · `,Q(e.value),` `,n]})},e.bucket)})})}function Q(e){return Number.isFinite(e)?Math.abs(e)>=1e3?(e/1e3).toFixed(e%1e3==0?0:1)+`k`:String(e):`0`}function $(e){let t=new Date(`${e}:00:00Z`);return Number.isNaN(t.getTime())?e:`${String(t.getUTCDate()).padStart(2,`0`)}/${String(t.getUTCMonth()+1).padStart(2,`0`)} ${String(t.getUTCHours()).padStart(2,`0`)}h`}export{q as KpiTab};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$w as r,AD as i,Bw as a,CD as o,DD as s,ED as c,Fw as l,Gw as u,Hw as d,Iw as f,Jw as p,Kw as m,Lw as ee,Mw as h,Nw as g,OD as _,PD as te,Pw as ne,Qw as re,Rw as ie,SD as ae,TD as oe,Uw as se,Vw as v,Ww as ce,Xw as le,Yw as ue,Zw as de,aT as fe,bD as pe,cT as y,dT as b,eT as x,fO as S,iT as C,jD as w,kD as T,lT as E,nT as D,oT as O,p_ as k,qw as A,rT as j,sT as M,tT as N,uT as P,vO as F,wD as I,xD as L,yD as R,yO as z,zD as B,zw as V}from"./dist-DsBcH2-2.js";import{t as H}from"./button-9c1aLUeO.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-DsOZBPOX.js";var q=t(e(),1),J=[{id:`messages`,label:()=>b()},{id:`composer`,label:()=>P()},{id:`sidebar`,label:()=>E()},{id:`other`,label:()=>y()}],Y={showSource:{category:`messages`,label:()=>M(),help:()=>O()},showReport:{category:`messages`,label:()=>fe(),help:()=>C()},copyAssistant:{category:`messages`,label:()=>j()},copyUser:{category:`messages`,label:()=>D()},showDelete:{category:`messages`,label:()=>N()},showTools:{category:`messages`,label:()=>x(),help:()=>r()},voiceInput:{category:`composer`,label:()=>re(),help:()=>de()},showChatAge:{category:`sidebar`,label:()=>le(),help:()=>ue()},showChatProvider:{category:`sidebar`,label:()=>p(),help:()=>A()}};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:()=>f()};function De({prefKey:e,ui:t}){let n=F(S.admin.setUiPrefDefault),r=F(S.admin.setFeatureEnabled),i=Te(e),o=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:a()}),(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:ne()}),(0,$.jsx)(K,{value:`off`,children:g()}),(0,$.jsx)(K,{value:`inherit`,children:h()})]})]}),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":V()}),V()]}):null]}),o?(0,$.jsx)(`span`,{className:`oc-prefs__gov-help`,children:o}):null]})}function Oe(){let[e,t]=(0,q.useState)(``),[n,r]=(0,q.useState)(!1),i=z(S.me.getMe,{host:G}),a=i?.ui,o=Z(i?.role)&&n,s=F(S.me.setUiPref).withOptimisticUpdate(ge),c=(0,q.useMemo)(()=>a?be(Object.keys(a.effective),e):[],[a,e]);return a?(0,$.jsxs)(`div`,{className:`oc-prefs-panel`,children:[Z(i?.role)?(0,$.jsxs)(`label`,{className:`oc-prefs__gov-toggle`,children:[(0,$.jsx)(W,{checked:n,onCheckedChange:e=>r(e===!0),"aria-label":v()}),v()]}):null,o?(0,$.jsxs)(`div`,{className:`oc-prefs__gov-head`,children:[(0,$.jsx)(`p`,{children:ie()}),(0,$.jsx)(`p`,{children:ee()}),(0,$.jsx)(`p`,{children:l()})]}):null,(0,$.jsx)(U,{value:e,onChange:e=>t(e.target.value),placeholder:m(),"aria-label":m(),className:`mb-2`}),c.length===0?(0,$.jsx)(`div`,{className:`oc-prefs__empty`,children:u()}):(0,$.jsx)(`div`,{className:`oc-prefs`,children:c.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=a.locked[e],c=a.effective[e],l=a.userOverrides[e]!==void 0;return(0,$.jsxs)(`div`,{className:`oc-prefs__row${i?` is-locked`:``}${l&&!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:ce()}):l?null:(0,$.jsx)(`span`,{className:`oc-prefs__def`,children:se()})]}),r?(0,$.jsx)(`span`,{className:`oc-prefs__help`,children:r}):null]}),(0,$.jsxs)(`div`,{className:`oc-prefs__ctl`,children:[!i&&l?(0,$.jsx)(`button`,{type:`button`,className:`oc-prefs__reset`,onClick:()=>void s({key:e,value:null}),children:d()}):null,(0,$.jsx)(W,{checked:c,disabled:i,onCheckedChange:t=>void s({key:e,value:t===!0}),"aria-label":n})]}),o?(0,$.jsx)(De,{prefKey:e,ui:a}):null]},e)})]},e.id))})]}):(0,$.jsx)(`div`,{className:`oc-prefs__empty`,children:B()})}function ke(){let e=z(S.me.getMe,{host:G}),t=F(S.me.setLocale),n=F(S.me.setMyName),r=me(),a=e?.locale??`default`,l=e?.name??``,[u,d]=(0,q.useState)(null),f=u??l,p=f.trim()!==l.trim();async function m(){try{await n({name:f}),d(null),r.success(s())}catch(e){r.error(c(),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:w()}),(0,$.jsx)(`p`,{className:`oc-show__desc`,children:i()})]}),(0,$.jsxs)(`div`,{className:`oc-show__row`,children:[(0,$.jsx)(U,{className:`max-w-xs`,value:f,maxLength:120,placeholder:T(),onChange:e=>d(e.target.value),onKeyDown:e=>{e.key===`Enter`&&p&&(e.preventDefault(),m())}}),(0,$.jsx)(H,{size:`sm`,disabled:!p,onClick:()=>void m(),children:k()})]}),(0,$.jsx)(`p`,{className:`oc-show__desc`,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:oe()}),(0,$.jsx)(`p`,{className:`oc-show__desc`,children:I()})]}),(0,$.jsx)(`div`,{className:`oc-show__row`,children:[`fr`,`en`,`default`].map(e=>(0,$.jsx)(H,{variant:a===e?`default`:`outline`,size:`sm`,onClick:()=>void t({locale:e==="default"?null:e}),children:e===`fr`?pe():e===`en`?R():te()},e))}),(0,$.jsx)(`p`,{className:`oc-show__desc`,children:o()})]}),(0,$.jsxs)(`section`,{className:`oc-show__section`,children:[(0,$.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,$.jsx)(`h2`,{className:`oc-show__title`,children:ae()}),(0,$.jsx)(`p`,{className:`oc-show__desc`,children:L()})]}),(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,Id as u,Kd as d,Ld as f,Md as p,Nd as m,Od as h,Pd as g,Rd as _,Sd as v,Td as y,U as b,V as x,bd as S,fO as C,jd as w,kd as T,qd as E,vO as D,wd as O,xd as k,yO as A,z as j,zd as M}from"./dist-DsBcH2-2.js";import{d as N,f as P,i as F,l as I,n as L,r as R,t as ee,u as z}from"./FieldLabel-BYZOkwDx.js";import{t as B}from"./button-9c1aLUeO.js";import{A as V,C as H,S as U,_ as W,b as G,x as K,y as q}from"./index-DsOZBPOX.js";/* empty css */var J=t(e(),1),Y=n(),X={media_delivery:{label:g,help:m},documentary_fetch:{label:p,help:w},inbound_files:{label:r,help:T},history_summary:{label:b,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:v,references:k,files:S,previous_summary:x,new_messages:i,max_chars:j};function $(){let e=A(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:o()})});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)(L,{label:M(),help:_()}),(0,Y.jsxs)(`label`,{className:`oc-injtab__picker`,children:[(0,Y.jsx)(`span`,{children:h()}),(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=D(C.admin.upsertInstanceConfig),n=V(),r=e.config??{},[i,a]=(0,J.useState)(()=>F(r)),[o,s]=(0,J.useState)(!1),c=i.promptInjections,l=(e,t)=>a({...i,promptInjections:{...c,[e]:{...c[e],...t}}});async function u(){s(!0);try{await t({instanceId:e._id,config:R(i,r)})}catch(e){n.error(d(),e)}finally{s(!1)}}return(0,Y.jsxs)(`div`,{className:`oc-injtab__body`,children:[z.map(e=>(0,Y.jsx)(ne,{injKey:e,def:I[e],i18n:X[e],row:c[e]??{enabled:!0,template:I[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 u(),disabled:o,children:E()})})]})}function ne({injKey:e,def:t,i18n:n,row:r,onChange:i}){let[o,l]=(0,J.useState)(!1),d=r.template.trim()!==t.defaultTemplate,p=t.togglable&&!r.enabled,m=Object.fromEntries(t.placeholders.map(e=>[e,Z[e]??`{${e}}`])),h=N(e,r),g=h?P(h,m):``;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)(L,{label:n.label(),help:n.help()})]}):(0,Y.jsx)(L,{label:n.label(),help:n.help()}),d&&(0,Y.jsx)(`span`,{className:`oc-injection__badge`,children:u()})]}),(0,Y.jsx)(`textarea`,{className:`oc-injcard__text`,value:r.template,disabled:p,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:c()}),t.placeholders.map(e=>(0,Y.jsxs)(`span`,{className:`oc-injcard__ph-chip`,children:[(0,Y.jsx)(`code`,{children:`{${e}}`}),(0,Y.jsx)(ee,{text:(Q[e]??(()=>e))()})]},e))]}),(0,Y.jsxs)(`div`,{className:`oc-injcard__btns`,children:[(0,Y.jsx)(B,{variant:`ghost`,size:`sm`,onClick:()=>l(e=>!e),children:o?y():s()}),d&&(0,Y.jsx)(B,{variant:`ghost`,size:`sm`,onClick:()=>i({template:t.defaultTemplate}),children:f()})]})]}),o&&(0,Y.jsx)(`div`,{className:`oc-injcard__preview`,children:g?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`pre`,{className:`oc-injcard__previewtext`,children:g}),(0,Y.jsx)(`span`,{className:`oc-injection__ph`,children:O()})]}):(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{Ah as r,Ch as i,Dh as a,Eh as o,Gm as ee,Hm as s,Jm as c,Km as te,Oh as l,Sh as u,Th as d,Um as f,Wm as ne,Xm as p,Ym as m,_h as h,ah as g,bh as _,ch as v,dh as y,fO as b,fh as x,gh as re,hh as ie,ih as ae,jh as S,kh as C,lh as w,mh as T,nh as E,oh as D,ph as O,qm as k,rh as A,sh as j,uh as M,vO as N,vh as P,wh as F,xh as I,yO as L,yh as R}from"./dist-DsBcH2-2.js";import{t as z}from"./button-9c1aLUeO.js";import{A as B,X as V,Z as H,_ as U,j as W,m as G,xt as K}from"./index-DsOZBPOX.js";import{t as q}from"./roleDescriptions-eZmrq1l0.js";var J=t(e(),1),Y=n(),X=[{group:()=>S(),keys:[{key:`traces.read`,label:()=>o()},{key:`traces.read.content`,label:()=>d(),phi:!0},{key:`traces.write`,label:()=>F()}]},{group:()=>r(),keys:[{key:`kpi.read`,label:()=>o()},{key:`kpi.write`,label:()=>F()}]},{group:()=>C(),keys:[{key:`openclaw.query`,label:()=>i()},{key:`anomalies.read`,label:()=>u()},{key:`anomalies.report`,label:()=>I()}]},{group:()=>l(),keys:[{key:`chats.read`,label:()=>o()},{key:`selfheal`,label:()=>R()}]},{group:()=>a(),keys:[{key:`admin.manage`,label:()=>_()}]}],oe=X.flatMap(e=>e.keys.map(e=>e.key));function Z(e){return e.includes(`*`)}var Q={key:``,name:``,description:``};function $(){let e=L(b.apiKeys.listRoles,{}),t=N(b.apiKeys.createRole),n=N(b.apiKeys.ensureRolesSeeded),r=N(b.apiKeys.updateRolePermissions).withOptimisticUpdate((e,{roleId:t,permissions:n})=>{let r=e.getQuery(b.apiKeys.listRoles,{});r&&e.setQuery(b.apiKeys.listRoles,{},r.map(e=>e._id===t?{...e,permissions:n}:e))}),i=W(),a=B(),[o,l]=(0,J.useState)(!1),[u,d]=(0,J.useState)(Q),[_,S]=(0,J.useState)(new Set);(0,J.useEffect)(()=>{n({}).catch(e=>{a.error(h(),e)})},[n,a]);let C=e??[];async function F(e,t){if(Z(e.permissions)||_.has(e._id))return;let n=e.permissions.includes(t)?e.permissions.filter(e=>e!==t):[...e.permissions,t];if(!(e.builtin&&!await i({title:re({name:e.name}),description:ie(),confirmLabel:T()}))){S(t=>new Set(t).add(e._id));try{await r({roleId:e._id,permissions:n})}catch(e){a.error(O(),e)}finally{S(t=>{let n=new Set(t);return n.delete(e._id),n})}}}async function I(){try{await t({key:u.key,name:u.name,description:u.description||void 0,permissions:[]}),d(Q),l(!1)}catch(e){a.error(x(),e)}}let R=e===void 0,$=!R&&C.length===0;return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(`p`,{className:`oc-admin__hint`,children:[y(),` `,(0,Y.jsx)(`code`,{children:`admin`}),` `,M(),` `,(0,Y.jsx)(`code`,{children:`traces.read.content`}),` `,w()]}),(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:v()}),(0,Y.jsx)(`div`,{className:`oc-dt__bar-actions`,children:(0,Y.jsx)(z,{size:`sm`,onClick:()=>{d(Q),l(!0)},children:j()})})]}),R?(0,Y.jsx)(`p`,{className:`oc-admin__hint`,children:D()}):$?(0,Y.jsx)(`p`,{className:`oc-admin__hint`,children:g()}):(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:ae()}),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?P({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:C.map(e=>{let t=Z(e.permissions),n=_.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,{}),` `,A()]}):(0,Y.jsx)(V,{variant:`secondary`,children:E()})]}),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?p():n?m():r,onCheckedChange:()=>void F(e,r)})},r))]},e.key)})})]})})]}),(0,Y.jsx)(G,{open:o,onOpenChange:l,title:c(),description:k(),canSubmit:!!(u.key&&u.name),onSubmit:I,submitLabel:te(),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:ee()}),(0,Y.jsx)(H,{value:u.key,placeholder:ne(),onChange:e=>d({...u,key:e.target.value})})]}),(0,Y.jsxs)(`label`,{className:`oc-field`,children:[(0,Y.jsx)(`span`,{className:`oc-field__label`,children:f()}),(0,Y.jsx)(H,{value:u.name,onChange:e=>d({...u,name:e.target.value})})]}),(0,Y.jsxs)(`label`,{className:`oc-field`,children:[(0,Y.jsx)(`span`,{className:`oc-field__label`,children:s()}),(0,Y.jsx)(H,{value:u.description,onChange:e=>d({...u,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,Aw as ee,BC as te,CC as a,Cw as ne,DC as o,Dw as re,EC as s,Ew as c,FC as ie,GC as ae,HC as oe,IC as se,JC as ce,KC as le,LC as ue,MC as l,NC as u,OC as d,Ow as de,PC as f,QC as fe,RC as pe,SC as p,Sw as me,TC as m,Tw as h,UC as he,VC as ge,WC as _e,XC as ve,YC as ye,ZC as be,_C as g,_w as xe,aw as Se,bC as _,bw as Ce,cw as we,dC as v,dw as Te,ew as Ee,fC as y,fO as b,fw as De,gC as x,gO as Oe,gw as ke,hC as Ae,hw as je,iw as Me,jC as Ne,jw as Pe,kC as S,kw as Fe,lw as Ie,mC as C,mw as Le,nw as Re,ow as ze,pC as w,pw as Be,qC as Ve,rw as He,sw as Ue,tw as We,uw as Ge,vC as T,vO as E,vw as Ke,wC as D,ww as qe,xC as O,xw as Je,yC as k,yO as A,yw as Ye,zC as Xe}from"./dist-DsBcH2-2.js";import{n as Ze}from"./dist-DM5LkQcA.js";import{i as Qe}from"./dist-BMI7wyIc.js";import{t as j}from"./button-9c1aLUeO.js";import{$ as $e,A as et,At as tt,C as M,Dt as N,Mt as nt,Q as P,S as F,X as I,Z as L,b as R,et as z,j as rt,jt as it,m as at,nt as B,rt as V,tt as H,x as U,y as W}from"./index-DsOZBPOX.js";import{t as ot}from"./FilterBar-DWv8wqqC.js";import{t as st}from"./DataTableShell-VIRQvS8e.js";import{t as ct}from"./roleDescriptions-eZmrq1l0.js";var G=t(e(),1),K=n(),q=[{value:`never`,label:()=>g(),days:null},{value:`30`,label:()=>x(),days:30},{value:`90`,label:()=>Ae(),days:90}],lt=720*60*60*1e3,J=`__all__`,Y={name:``,roleKey:``,description:``};function X(){let e=nt({from:`/settings/serviceAccounts`}),t=it({from:`/settings/serviceAccounts`}),n=e.q??``,i=e.status??J,[a,o]=(0,G.useState)(J),s=e=>void t({search:t=>({...t,q:e||void 0}),replace:!0}),l=e=>void t({search:t=>({...t,status:e===J?void 0:e})}),u=A(b.apiKeys.listServiceAccounts,{filter:{q:n||void 0,role:a===J?void 0:a,disabled:i===J?void 0:i===`disabled`}}),d=A(b.apiKeys.listKeys,{}),f=A(b.apiKeys.listRoles,{}),p=E(b.apiKeys.createServiceAccount),m=E(b.apiKeys.updateServiceAccount),g=E(b.apiKeys.deleteServiceAccount),_=Oe(b.apiKeys.mintApiKey),v=E(b.apiKeys.revokeApiKey),y=rt(),x=et(),Ae=n!==``||a!==J||i!==J;function Ne(){o(J),t({search:{},replace:!0})}let[S,C]=(0,G.useState)(!1),[w,T]=(0,G.useState)(Y),[D,O]=(0,G.useState)(null),[k,Ze]=(0,G.useState)(new Set),[$e,N]=(0,G.useState)(null),P=(0,G.useRef)(!1),[z,B]=(0,G.useState)(new Set),[V,H]=(0,G.useState)({}),[lt,X]=(0,G.useState)(null),Z=(0,G.useMemo)(()=>{let e=new Map;for(let t of d??[]){let n=e.get(t.serviceAccountId)??[];n.push(t),e.set(t.serviceAccountId,n)}return e},[d]);function Q(e){Ze(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})}async function ft(){try{D?(await m({serviceAccountId:D,name:w.name,roleKey:w.roleKey,description:w.description}),x.success(ye())):await p({name:w.name,roleKey:w.roleKey,description:w.description||void 0}),T(Y),O(null),C(!1)}catch(e){x.error(D?ve():be(),e)}}function pt(e){T({name:e.name,roleKey:e.roleKey,description:e.description??``}),O(e._id),C(!0)}async function $(e){if(P.current)return;P.current=!0;let t=V[e._id]??`never`,n=q.find(e=>e.value===t)?.days??null,r=n?Date.now()+n*24*60*60*1e3:void 0;N(e._id);try{let t=await _({serviceAccountId:e._id,expiresAt:r});X({accountName:e.name,plaintext:t.plaintext,prefix:t.prefix,lastFour:t.lastFour})}catch(e){x.error(ce(),e)}finally{P.current=!1,N(null)}}async function mt(e){if(await y({title:Ve(),description:(0,K.jsxs)(K.Fragment,{children:[le(),` `,(0,K.jsx)(`span`,{className:`font-mono`,children:e.name}),` `,ae(),` `,(0,K.jsx)(`strong`,{children:_e()}),` `,he()]}),confirmWord:e.name,confirmLabel:oe(),destructive:!0}))try{await g({serviceAccountId:e._id}),x.success(ge(),e.name)}catch(e){x.error(te(),e)}}async function ht(e){if(await y({title:Xe(),description:(0,K.jsxs)(K.Fragment,{children:[pe(),` `,(0,K.jsxs)(`span`,{className:`font-mono`,children:[e.prefix,`…`,e.lastFour]}),` `,ue()]}),confirmLabel:se(),destructive:!0})&&!z.has(e._id)){B(t=>new Set(t).add(e._id));try{await v({keyId:e._id})}catch(e){x.error(ie(),e)}finally{B(t=>{let n=new Set(t);return n.delete(e._id),n})}}}return(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`p`,{className:`oc-admin__hint`,children:Pe()}),(0,K.jsxs)(ot,{q:n,onQChange:s,searchPlaceholder:ee(),onReset:Ne,canReset:Ae,children:[(0,K.jsxs)(W,{value:a,onValueChange:o,children:[(0,K.jsx)(F,{size:`sm`,className:`w-40`,children:(0,K.jsx)(M,{placeholder:Fe()})}),(0,K.jsxs)(R,{children:[(0,K.jsx)(U,{value:J,children:de()}),(f??[]).map(e=>(0,K.jsx)(U,{value:e.key,children:e.key},e._id))]})]}),(0,K.jsxs)(W,{value:i,onValueChange:l,children:[(0,K.jsx)(F,{size:`sm`,className:`w-36`,children:(0,K.jsx)(M,{})}),(0,K.jsxs)(R,{children:[(0,K.jsx)(U,{value:J,children:re()}),(0,K.jsx)(U,{value:`active`,children:c()}),(0,K.jsx)(U,{value:`disabled`,children:h()})]})]})]}),(0,K.jsx)(st,{title:qe(),rows:u,addLabel:ne(),onAdd:()=>{T(Y),O(null),C(!0)},emptyHint:me(),isExpanded:e=>k.has(e._id),renderExpanded:e=>(0,K.jsx)(ut,{account:e,keys:Z.get(e._id)??[],onRevoke:ht,revoking:z}),rowActions:e=>[{label:Ke(),onSelect:()=>pt(e)},{label:Je(),onSelect:()=>void $(e)},{label:k.has(e._id)?Ce():Ye(),onSelect:()=>Q(e._id)},{label:xe(),variant:`destructive`,onSelect:()=>void mt(e)}],columns:[{header:``,className:`w-8`,cell:e=>(0,K.jsx)(j,{variant:`ghost`,size:`icon-sm`,"aria-label":k.has(e._id)?ke():je(),onClick:()=>Q(e._id),children:k.has(e._id)?(0,K.jsx)(Qe,{}):(0,K.jsx)(tt,{})})},{header:Le(),sort:e=>e.name,cell:e=>(0,K.jsxs)(`div`,{className:`flex flex-col`,children:[(0,K.jsx)(`span`,{children:e.name}),e.description?(0,K.jsx)(`span`,{className:`text-muted-foreground text-xs`,children:e.description}):null]})},{header:Be(),sort:e=>e.roleKey,cell:e=>(0,K.jsx)(I,{variant:`secondary`,children:e.roleKey})},{header:De(),sort:e=>+!!e.disabled,cell:e=>e.disabled?(0,K.jsx)(I,{variant:`destructive`,children:h()}):(0,K.jsx)(I,{variant:`outline`,children:c()})},{header:Te(),cell:e=>(0,K.jsxs)(W,{value:V[e._id]??`never`,onValueChange:t=>H(n=>({...n,[e._id]:t})),children:[(0,K.jsx)(F,{size:`sm`,className:`w-32`,children:(0,K.jsx)(M,{})}),(0,K.jsx)(R,{children:q.map(e=>(0,K.jsx)(U,{value:e.value,children:e.label()},e.value))})]})},{header:Ge(),sort:e=>(Z.get(e._id)??[]).filter(e=>!e.disabled).length,cell:e=>{let t=(Z.get(e._id)??[]).filter(e=>!e.disabled).length;return(0,K.jsx)(`span`,{className:`oc-sa__keycount`,children:$e===e._id?Ie():we({count:t})})}}]}),(0,K.jsx)(at,{open:S,onOpenChange:e=>{C(e),e||O(null)},title:D?Ue():Me(),description:D?ze():He(),canSubmit:!!(w.name&&w.roleKey),onSubmit:ft,submitLabel:D?Se():Re(),children:(0,K.jsxs)(`div`,{className:`oc-form`,children:[(0,K.jsxs)(`label`,{className:`oc-field`,children:[(0,K.jsx)(`span`,{className:`oc-field__label`,children:We()}),(0,K.jsx)(L,{value:w.name,onChange:e=>T({...w,name:e.target.value})})]}),(0,K.jsxs)(`label`,{className:`oc-field`,children:[(0,K.jsx)(`span`,{className:`oc-field__label`,children:Ee()}),(0,K.jsxs)(W,{value:w.roleKey||void 0,onValueChange:e=>T({...w,roleKey:e}),children:[(0,K.jsx)(F,{className:`w-full`,children:(0,K.jsx)(M,{placeholder:r()})}),(0,K.jsx)(R,{children:(f??[]).map(e=>(0,K.jsxs)(U,{value:e.key,children:[e.name,` (`,e.key,`)`]},e._id))})]}),(()=>{let e=(f??[]).find(e=>e.key===w.roleKey),t=e?ct(e):null;return t?(0,K.jsx)(`span`,{className:`text-muted-foreground text-xs`,children:t}):null})()]}),(0,K.jsxs)(`label`,{className:`oc-field`,children:[(0,K.jsx)(`span`,{className:`oc-field__label`,children:fe()}),(0,K.jsx)(L,{value:w.description,onChange:e=>T({...w,description:e.target.value})})]})]})}),(0,K.jsx)(dt,{minted:lt,onClose:()=>X(null)})]})}function ut({account:e,keys:t,onRevoke:n,revoking:r}){return(0,K.jsxs)(`div`,{className:`oc-sa__keys`,children:[(0,K.jsxs)(`div`,{className:`oc-sa__keys-head`,children:[f(),` `,(0,K.jsx)(`span`,{className:`font-medium`,children:e.name})]}),t.length===0?(0,K.jsx)(`p`,{className:`oc-admin__hint`,children:u()}):(0,K.jsxs)(`table`,{className:`oc-sa__keytable`,children:[(0,K.jsx)(`thead`,{children:(0,K.jsxs)(`tr`,{children:[(0,K.jsx)(`th`,{children:l()}),(0,K.jsx)(`th`,{children:Ne()}),(0,K.jsx)(`th`,{children:i()}),(0,K.jsx)(`th`,{children:S()}),(0,K.jsx)(`th`,{children:d()}),(0,K.jsx)(`th`,{children:o()}),(0,K.jsx)(`th`,{})]})}),(0,K.jsx)(`tbody`,{children:t.map(t=>(0,K.jsxs)(`tr`,{children:[(0,K.jsx)(`td`,{children:(0,K.jsxs)(`code`,{className:`oc-sa__keyid`,children:[t.prefix,`…`,t.lastFour]})}),(0,K.jsx)(`td`,{children:(0,K.jsx)(I,{variant:`secondary`,children:e.roleKey})}),(0,K.jsx)(`td`,{children:Z(t.createdAt)}),(0,K.jsx)(`td`,{className:Q(t.lastUsedAt)?`oc-sa__stale`:``,children:ft(t.lastUsedAt)}),(0,K.jsx)(`td`,{children:pt(t.expiresAt)}),(0,K.jsx)(`td`,{children:$(t)}),(0,K.jsx)(`td`,{className:`text-right`,children:t.disabled?null:(0,K.jsx)(j,{variant:`destructive`,size:`sm`,disabled:r.has(t._id),onClick:()=>n(t),children:r.has(t._id)?s():m()})})]},t._id))})]})]})}function dt({minted:e,onClose:t}){let[n,r]=(0,G.useState)(!1);async function i(){if(e)try{await navigator.clipboard.writeText(e.plaintext),r(!0),window.setTimeout(()=>r(!1),2e3)}catch{}}return(0,K.jsx)(P,{open:e!==null,onOpenChange:e=>{e||(r(!1),t())},children:e?(0,K.jsxs)($e,{className:`max-w-lg`,showCloseButton:!1,onInteractOutside:e=>e.preventDefault(),onEscapeKeyDown:e=>e.preventDefault(),children:[(0,K.jsxs)(B,{children:[(0,K.jsx)(V,{children:D()}),(0,K.jsx)(z,{children:a({name:e.accountName})})]}),(0,K.jsx)(`div`,{className:`oc-sa__minted-warning`,children:p()}),(0,K.jsxs)(`div`,{className:`oc-sa__minted-box`,children:[(0,K.jsx)(`code`,{className:`oc-sa__minted-plain`,children:e.plaintext}),(0,K.jsxs)(j,{variant:`outline`,size:`sm`,onClick:()=>void i(),"aria-label":O(),children:[n?(0,K.jsx)(Ze,{}):(0,K.jsx)(N,{}),n?_():k()]})]}),(0,K.jsx)(H,{children:(0,K.jsx)(j,{onClick:()=>{r(!1),t()},children:T()})})]}):null})}function Z(e){return new Date(e).toLocaleString(`fr-FR`)}function Q(e){return e===null?!1:Date.now()-e>lt}function ft(e){return e===null?C():new Date(e).toLocaleString(`fr-FR`)}function pt(e){return e===null?`—`:new Date(e).toLocaleDateString(`fr-FR`)}function $(e){return e.disabled?(0,K.jsx)(I,{variant:`destructive`,children:w()}):e.expiresAt!==null&&e.expiresAt<Date.now()?(0,K.jsx)(I,{variant:`outline`,children:y()}):(0,K.jsx)(I,{variant:`outline`,children:v()})}export{X 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,AE as i,AT as a,BT as o,CE as s,CT as c,DE as l,DT as u,EE as d,ET as f,FD as p,FT as m,G as h,GT as ee,HT as g,ID as _,IT as v,JT as y,K as te,KT as ne,LD as re,LT as ie,ME as ae,MT as b,NE as oe,NT as se,OE as ce,OT as le,PE as ue,PT as de,QT as fe,RT as pe,SE as me,ST as he,TE as ge,TT as _e,UT as ve,VT as ye,W as be,WT as xe,XT as Se,YT as Ce,ZT as x,_E as we,_T as Te,aE as Ee,bD as De,bE as Oe,bT as S,cE as ke,dE as Ae,eE as je,fE as Me,fO as C,fT as Ne,gE as Pe,gO as Fe,gT as w,hE as Ie,hT as Le,iE as Re,jE as ze,jT as Be,kE as Ve,kT as He,lE as Ue,mE as We,mT as Ge,n as Ke,nE as qe,oE as Je,pE as Ye,pO as Xe,pT as Ze,q as T,qT as Qe,rE as $e,sE as et,tE as tt,uE as nt,vE as rt,vO as E,vT as it,wE as D,wT as at,xE as ot,xT as st,yD as ct,yE as lt,yO as O,yT as ut,zT as dt}from"./dist-DsBcH2-2.js";import{n as k}from"./dist-DM5LkQcA.js";import{t as A}from"./x-CyUGhZ48.js";import{t as j}from"./button-9c1aLUeO.js";import{C as M,Et as ft,G as pt,J as N,K as P,S as F,Tt as I,W as mt,X as L,Y as ht,Z as R,_ as z,at as gt,b as B,it as _t,ot as V,q as vt,x as H,y as U}from"./index-DsOZBPOX.js";import{a as yt,i as bt,n as xt,o as St,r as Ct,t as wt}from"./card-DNbBWwxH.js";import{a as Tt,i as W,n as Et,o as G,r as K,t as Dt}from"./table-C2kpo1_K.js";import{t as Ot}from"./TimeRangePicker-CPM9eoXo.js";import{t as kt}from"./FilterBar-DWv8wqqC.js";import{t as At}from"./AdvancedFilter-CtaYuy-W.js";var q=Xe(`upload`,[[`path`,{d:`M12 3v12`,key:`1x0j5s`}],[`path`,{d:`m17 8-5-5-5 5`,key:`7q97r8`}],[`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`,key:`ih7n3h`}]]),J=t(e(),1),jt=.1,Mt=[248,248,248],Nt=[24,24,24];function Pt(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 Ft(e,t,n){let r=t*n;if(r===0)return 0;let i=0;for(let t=3;t<e.length;t+=4)e[t]<=8&&i++;return i/r}function Y(e,t,n){return Ft(e,t,n)>=jt}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(m());if(e.size>Rt)throw Error(de());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),s=Math.max(1,Math.round(r*o)),c=Math.max(1,Math.round(i*o)),l=document.createElement(`canvas`);l.width=s,l.height=c;let u=l.getContext(`2d`);if(!u)throw Error(b());u.imageSmoothingEnabled=!0,u.imageSmoothingQuality=`high`,u.drawImage(n,0,0,s,c);let d=Pt(u.getImageData(0,0,s,c).data,s,c)??{x:0,y:0,width:s,height:c},f=document.createElement(`canvas`);f.width=d.width,f.height=d.height;let p=f.getContext(`2d`);if(!p)throw Error(b());if(p.drawImage(l,d.x,d.y,d.width,d.height,0,0,d.width,d.height),t.variantFor){let e=p.getImageData(0,0,d.width,d.height);Y(e.data,d.width,d.height)?It(e.data,t.variantFor===`dark`?Mt:Nt):Lt(e.data),p.putImageData(e,0,0)}let m=Y(p.getImageData(0,0,d.width,d.height).data,d.width,d.height),h=await Gt(f,`image/webp`,Vt)??await Gt(f,`image/png`);if(!h)throw Error(Be());return{blob:h,hasAlpha:m}}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(se())),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`?_():p()}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:Ke(`oc-chart-card`,e&&`oc-chart-card--selected`),"aria-pressed":e,onClick:a,children:[(0,X.jsxs)(`div`,{className:`oc-chart-card__head`,children:[(0,X.jsx)(`span`,{className:`oc-chart-card__title`,children:t}),e?(0,X.jsx)(k,{className:`size-4 text-primary`,"aria-hidden":!0}):null]}),r?(0,X.jsx)(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)(j,{type:`button`,variant:`ghost`,size:`icon`,className:`oc-chart-card__export`,onClick:o,"aria-label":T(),title:T(),children:(0,X.jsx)(ft,{className:`size-4`})}):null]})}function $t({selectedKey:e,resolvedMode:t}){let n=O(C.charts.listMyCharts),r=E(C.charts.setMyChart);async function i(e){try{await r({name:e})}catch{}}return(0,X.jsxs)(`section`,{className:`oc-show__section`,children:[(0,X.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,X.jsx)(`h2`,{className:`oc-show__title`,children:d()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:ge()})]}),(0,X.jsxs)(`div`,{className:`oc-chart-grid`,children:[(0,X.jsx)(Qt,{selected:e===null,title:D(),subtitle:s(),tokens:null,mode:t,onSelect:()=>void i(null)}),(n??[]).map(n=>{let r=n.via===`common`?me():n.via===`owner`?ot():Oe({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:lt()}):null]})}function en(){let e=E(C.charts.importChart),[t,n]=(0,J.useState)(``),[i,a]=(0,J.useState)(``),[o,s]=(0,J.useState)(null),[c,l]=(0,J.useState)(!1),[u,d]=(0,J.useState)(!1);async function f(e){let t=e.target.files?.[0];if(e.target.value=``,t){s(null),l(!1);try{a(await t.text())}catch{s(x())}}}async function p(){if(s(null),l(!1),t.trim()===``){s(Ce());return}let r;try{r=JSON.parse(i)}catch{s(x());return}d(!0);try{await e({name:t.trim(),tokens:r}),l(!0),n(``),a(``)}catch(e){s(e instanceof Error?e.message:String(e))}finally{d(!1)}}return(0,X.jsxs)(`section`,{className:`oc-show__section`,children:[(0,X.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,X.jsx)(`h2`,{className:`oc-show__title`,children:Ee()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:Re()})]}),(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:$e()}),(0,X.jsx)(R,{value:t,onChange:e=>n(e.target.value),placeholder:qe(),maxLength:60})]}),(0,X.jsxs)(`label`,{className:`oc-chart-import__field`,children:[(0,X.jsx)(`span`,{className:`oc-chart-import__label`,children:tt()}),(0,X.jsx)(`textarea`,{className:`oc-chart-import__textarea`,value:i,onChange:e=>a(e.target.value),placeholder:je(),rows:8,spellCheck:!1})]}),(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsx)(j,{variant:`outline`,size:`sm`,asChild:!0,children:(0,X.jsxs)(`label`,{className:`oc-chart-import__file`,children:[(0,X.jsx)(q,{className:`size-4`}),r(),(0,X.jsx)(`input`,{type:`file`,accept:`application/json,.json`,className:`oc-chart-import__file-input`,onChange:e=>void f(e)})]})}),(0,X.jsx)(j,{size:`sm`,disabled:u,onClick:()=>void p(),children:fe()})]}),o?(0,X.jsx)(`p`,{className:`oc-chart-import__error`,children:o}):null,c?(0,X.jsx)(`p`,{className:`oc-chart-import__ok`,children:Se()}):null]})]})}function tn({chart:e}){let t=Fe(C.charts.setChartLogo),n=E(C.charts.removeChartLogo),[r,i]=(0,J.useState)(!1),[a,s]=(0,J.useState)(null),c=t=>t===`light`?e.logoLightUrl:e.logoDarkUrl;async function l(n,r,a){if(e.chartId!==void 0){s(null),i(!0);try{let{blob:i,hasAlpha:o}=await Ht(r,a?{variantFor:a}:{}),s=await i.arrayBuffer();await t({chartId:e.chartId,bytes:s,mode:n,hasAlpha:o})}catch(e){s(e instanceof Error?e.message:String(e))}finally{i(!1)}}}async function u(e,t){let n=t.target.files?.[0];t.target.value=``,n&&await l(e,n)}async function d(t){if(e.chartId!==void 0){s(null),i(!0);try{await n({chartId:e.chartId,mode:t})}catch(e){s(e instanceof Error?e.message:String(e))}finally{i(!1)}}}async function f(e){let t=c(e===`light`?`dark`:`light`);if(t){s(null),i(!0);try{await l(e,await(await fetch(t)).blob(),e)}catch(e){s(e instanceof Error?e.message:String(e))}finally{i(!1)}}}function p({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`?g():ye()}),(0,X.jsx)(`span`,{className:`oc-chart-mine__logo-preview`,"data-mode":e,"data-empty":t?void 0:`1`,children:t?(0,X.jsx)(`img`,{src:t,alt:``}):null}),(0,X.jsx)(j,{variant:`outline`,size:`sm`,asChild:!0,children:(0,X.jsxs)(`label`,{className:`oc-chart-import__file`,children:[(0,X.jsx)(q,{className:`size-4`}),t?dt():o(),(0,X.jsx)(`input`,{type:`file`,accept:`image/*`,className:`oc-chart-import__file-input`,onChange:t=>void u(e,t)})]})}),!t&&n?(0,X.jsx)(j,{variant:`ghost`,size:`sm`,disabled:r,onClick:()=>void f(e),children:ie()}):null,t?(0,X.jsx)(j,{variant:`ghost`,size:`sm`,disabled:r,onClick:()=>void d(e),children:pe()}):null]})}return(0,X.jsxs)(`div`,{className:`oc-chart-mine__logo`,children:[(0,X.jsx)(`span`,{className:`oc-chart-mine__groups-label`,children:ve()}),(0,X.jsxs)(`div`,{className:`oc-chart-mine__logo-slots`,children:[(0,X.jsx)(p,{mode:`light`}),(0,X.jsx)(p,{mode:`dark`})]}),r?(0,X.jsx)(`span`,{className:`oc-show__desc`,children:v()}):null,a?(0,X.jsx)(`p`,{className:`oc-chart-import__error`,children:a}):null]})}function nn({chart:e}){let t=O(C.me.getMe,{host:V}),n=E(C.charts.addChartDomain),r=E(C.charts.removeChartDomain),[i,o]=(0,J.useState)(``),[s,c]=(0,J.useState)(null),[l,d]=(0,J.useState)(!1);if(t?.role!==`admin`)return null;let p=e.domains??[];async function m(){let t=i.trim();if(t!==``){c(null),d(!0);try{await n({chartKey:e.key,domain:t}),o(``)}catch(e){c(e instanceof Error?e.message:String(e))}finally{d(!1)}}}async function h(t){c(null);try{await r({chartKey:e.key,domain:t})}catch{}}return(0,X.jsxs)(`div`,{className:`oc-chart-mine__domains`,children:[(0,X.jsx)(`span`,{className:`oc-chart-mine__groups-label`,children:a()}),(0,X.jsxs)(`div`,{className:`oc-chart-mine__domains-body`,children:[(0,X.jsx)(`div`,{className:`oc-chart-avail__groups`,children:p.length===0?(0,X.jsx)(`span`,{className:`oc-show__desc`,children:f()}):p.map(e=>(0,X.jsxs)(L,{variant:`secondary`,className:`oc-chart-avail__chip`,children:[e,(0,X.jsx)(`button`,{type:`button`,className:`oc-chart-avail__chip-x`,"aria-label":_e({domain:e}),onClick:()=>void h(e),children:(0,X.jsx)(A,{className:`size-3`})})]},e))}),(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsx)(R,{value:i,onChange:e=>o(e.target.value),placeholder:le(),className:`oc-chart-mine__domains-input`,onKeyDown:e=>{e.key===`Enter`&&m()}}),(0,X.jsx)(j,{variant:`outline`,size:`sm`,disabled:l,onClick:()=>void m(),children:u()})]}),(0,X.jsx)(`span`,{className:`oc-show__desc`,children:He()}),s?(0,X.jsx)(`p`,{className:`oc-chart-import__error`,children:s}):null]})]})}function $(e){let t={...e};return delete t.bpm,JSON.stringify(t,null,2)}function rn({chart:e}){let t=E(C.charts.updateChart),n=E(C.charts.deleteChart),[r,i]=(0,J.useState)(!1),[a,o]=(0,J.useState)(e.name),[s,l]=(0,J.useState)(()=>$(e.tokens)),[u,d]=(0,J.useState)(e.tokens.bpm??0),[f,p]=(0,J.useState)(null),[m,g]=(0,J.useState)(!1);function _(){o(e.name),l($(e.tokens)),d(e.tokens.bpm??0),p(null),i(!0)}async function v(){if(e.chartId===void 0)return;p(null);let n;try{n=JSON.parse(s)}catch{p(x());return}if(n&&typeof n==`object`&&!Array.isArray(n)){let e=n;u>0?e.bpm=u:delete e.bpm}g(!0);try{await t({chartId:e.chartId,name:a.trim(),tokens:n}),i(!1)}catch(e){p(e instanceof Error?e.message:String(e))}finally{g(!1)}}async function y(){if(e.chartId!==void 0&&window.confirm(S()))try{await n({chartId:e.chartId})}catch{}}return(0,X.jsxs)(`div`,{className:`oc-chart-mine__row`,children:[(0,X.jsxs)(`div`,{className:`oc-chart-mine__head`,children:[(0,X.jsx)(`span`,{className:`oc-chart-mine__name`,children:e.name}),(0,X.jsx)(`div`,{className:`oc-show__row`,children:r?null:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(j,{variant:`outline`,size:`sm`,onClick:_,children:ee()}),(0,X.jsx)(j,{variant:`ghost`,size:`sm`,onClick:()=>void y(),children:xe()})]})})]}),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:he()}),(0,X.jsx)(R,{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:te()}),(0,X.jsxs)(`div`,{className:`oc-chart-bpm`,children:[(0,X.jsx)(`input`,{type:`range`,className:`oc-chart-bpm__slider`,min:0,max:90,step:5,value:u,onChange:e=>d(Number(e.target.value)),"aria-label":te()}),(0,X.jsx)(`span`,{className:`oc-chart-bpm__value`,children:u===0?h():`${u} BPM`})]}),(0,X.jsx)(`span`,{className:`oc-show__desc`,children:be()})]}),(0,X.jsxs)(`label`,{className:`oc-chart-import__field`,children:[(0,X.jsx)(`span`,{className:`oc-chart-import__label`,children:st()}),(0,X.jsx)(`textarea`,{className:`oc-chart-import__textarea`,value:s,onChange:e=>l(e.target.value),rows:10,spellCheck:!1})]}),f?(0,X.jsx)(`p`,{className:`oc-chart-import__error`,children:f}):null,(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsx)(j,{size:`sm`,disabled:m,onClick:()=>void v(),children:at()}),(0,X.jsx)(j,{variant:`ghost`,size:`sm`,onClick:()=>i(!1),children:c()})]})]}):null,(0,X.jsx)(tn,{chart:e}),(0,X.jsx)(nn,{chart:e})]})}function an(){let e=O(C.charts.listMyCharts),t=(e??[]).filter(e=>e.via===`owner`);return(0,X.jsxs)(`section`,{className:`oc-show__section`,children:[(0,X.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,X.jsx)(`h2`,{className:`oc-show__title`,children:y()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:Qe()})]}),e!==void 0&&t.length===0?(0,X.jsx)(`p`,{className:`oc-show__desc`,children:ne()}):(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=E(C.charts.addChartToGroupPool),r=E(C.charts.removeChartFromGroupPool),i=e.restrictedToGroups,a=e.poolGroups,o=new Set((a??[]).map(e=>e.groupId)),s=t.filter(e=>!o.has(e._id));async function c(t){try{await n({groupId:t,chartKey:e.key})}catch{}}async function l(t){try{await r({groupId:t,chartKey:e.key})}catch{}}return(0,X.jsxs)(`div`,{className:`oc-chart-avail`,children:[(0,X.jsxs)(`div`,{className:`oc-chart-avail__head`,children:[(0,X.jsx)(`span`,{className:`oc-chart-avail__name`,children:e.name}),(0,X.jsx)(L,{variant:i?`secondary`:`outline`,className:`oc-chart-avail__state`,children:i?Ae():e.kind===`custom`&&e.scope===`personal`?w():Me()}),e.isGlobalDefault?(0,X.jsx)(L,{variant:`default`,children:nt()}):null]}),(0,X.jsxs)(`div`,{className:`oc-chart-avail__groups`,children:[(0,X.jsx)(`span`,{className:`oc-chart-mine__groups-label`,children:ke()}),(a??[]).map(e=>(0,X.jsxs)(L,{variant:`secondary`,className:`oc-chart-avail__chip`,children:[e.name,(0,X.jsx)(`button`,{type:`button`,className:`oc-chart-avail__chip-x`,"aria-label":Je({group:e.name}),onClick:()=>void l(e.groupId),children:(0,X.jsx)(A,{className:`size-3`})})]},e.groupId)),s.length>0?(0,X.jsxs)(U,{value:``,onValueChange:e=>void c(e),children:[(0,X.jsx)(F,{size:`sm`,className:`w-56`,children:(0,X.jsx)(M,{placeholder:et()})}),(0,X.jsx)(B,{children:s.map(e=>(0,X.jsx)(H,{value:e._id,children:e.name},e._id))})]}):t.length===0?(0,X.jsx)(`span`,{className:`oc-show__desc`,children:Ue()}):null]})]})}function sn({chart:e}){let t=E(C.charts.promoteChartToCommon),n=E(C.charts.deleteChart);async function r(){if(e.chartId!==void 0)try{await t({chartId:e.chartId})}catch{}}async function i(){if(e.chartId!==void 0&&window.confirm(S()))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)(L,{variant:e.scope===`common`?`outline`:`secondary`,children:e.scope===`common`?Le():w()}),e.ownerLabel?(0,X.jsx)(`span`,{className:`oc-show__desc`,children:Te({owner:e.ownerLabel})}):null]}),(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[e.scope===`personal`?(0,X.jsx)(j,{variant:`outline`,size:`sm`,onClick:()=>void r(),children:Ge()}):null,(0,X.jsx)(j,{variant:`ghost`,size:`sm`,onClick:()=>void i(),children:Ze()})]})]})}function cn({defaultThemeMode:e,defaultLocale:t,defaultChartKey:n}){let r=E(C.admin.setDefaultThemeMode),a=E(C.admin.setDefaultLocale),o=E(C.charts.setDefaultChart),s=O(C.charts.listChartsAdmin),c=O(C.groups.listGroups,{}),u=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:ce()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:l()})]}),(0,X.jsxs)(`section`,{className:`oc-show__section`,children:[(0,X.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,X.jsx)(`h3`,{className:`oc-show__title`,children:rt()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:we()})]}),(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsx)(j,{variant:n===null?`default`:`outline`,size:`sm`,onClick:()=>void o({name:null}),children:D()}),gt.map(e=>(0,X.jsx)(j,{variant:n===e.key?`default`:`outline`,size:`sm`,onClick:()=>void o({name:e.key}),children:e.name},e.key)),(s??[]).filter(e=>e.kind===`custom`&&e.scope===`common`).map(e=>(0,X.jsx)(j,{variant:n===e.key?`default`:`outline`,size:`sm`,onClick:()=>void o({name:e.key}),children:e.name},e.key))]})]}),(0,X.jsxs)(`section`,{className:`oc-show__section`,children:[(0,X.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,X.jsx)(`h3`,{className:`oc-show__title`,children:Pe()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:Ie()})]}),(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:We()}),(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:ut()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:it()})]}),(()=>{let e=(s??[]).filter(e=>e.kind===`custom`);return e.length===0?(0,X.jsx)(`p`,{className:`oc-show__desc`,children:Ne()}):(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:ue()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:oe()})]}),(0,X.jsx)(`div`,{className:`oc-show__row`,children:[`light`,`dark`,`system`].map(e=>(0,X.jsx)(j,{variant:u===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:ae()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:ze()})]}),(0,X.jsx)(`div`,{className:`oc-show__row`,children:[`fr`,`en`].map(e=>(0,X.jsx)(j,{variant:d===e?`default`:`outline`,size:`sm`,onClick:()=>void a({locale:e}),children:e===`fr`?De():ct()},e))}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:i()})]})]})}function ln(){let e=O(C.me.getMe,{host:V}),t=_t(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,J.useState)(!0),[n,r]=(0,J.useState)(`per-user`),[i,a]=(0,J.useState)(``),[o,s]=(0,J.useState)(Z),[c,l]=(0,J.useState)(Z),[u,d]=(0,J.useState)(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:Ve()}),(0,X.jsxs)(Q,{title:`Buttons`,description:`Variants`,children:[(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsx)(j,{children:`Default`}),(0,X.jsx)(j,{variant:`secondary`,children:`Secondary`}),(0,X.jsx)(j,{variant:`outline`,children:`Outline`}),(0,X.jsx)(j,{variant:`ghost`,children:`Ghost`}),(0,X.jsx)(j,{variant:`destructive`,children:`Destructive`}),(0,X.jsx)(j,{variant:`link`,children:`Link`})]}),(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsx)(j,{size:`sm`,children:`Small`}),(0,X.jsx)(j,{children:`Default`}),(0,X.jsx)(j,{size:`lg`,children:`Large`}),(0,X.jsx)(j,{size:`icon`,"aria-label":`more`,children:(0,X.jsx)(I,{})}),(0,X.jsx)(j,{disabled:!0,children:`Disabled`})]})]}),(0,X.jsx)(Q,{title:`Badges`,children:(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsx)(L,{children:`Default`}),(0,X.jsx)(L,{variant:`secondary`,children:`Secondary`}),(0,X.jsx)(L,{variant:`outline`,children:`Outline`}),(0,X.jsx)(L,{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)(R,{placeholder:`Text input…`}),(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsxs)(U,{value:n,onValueChange:r,children:[(0,X.jsx)(F,{className:`w-56`,children:(0,X.jsx)(M,{placeholder:`Select…`})}),(0,X.jsxs)(B,{children:[(0,X.jsx)(H,{value:`per-user`,children:`per-user (chacun son agent)`}),(0,X.jsx)(H,{value:`shared`,children:`shared (agent commun)`})]})]}),(0,X.jsxs)(`label`,{className:`oc-show__check`,children:[(0,X.jsx)(z,{checked:e,onCheckedChange:e=>t(!!e)}),`Checkbox`]})]})]})}),(0,X.jsx)(Q,{title:`Filtres & plage temporelle`,description:`Barre réutilisable (recherche debouncée + selects rapides à largeur auto + plage façon Grafana) et constructeur de filtre avancé. Câblée dans Users, Groups, Comptes de service, Traces, Anomalies, Audit et KPI.`,children:(0,X.jsxs)(`div`,{className:`oc-show__row oc-show__row--col`,children:[(0,X.jsxs)(kt,{q:i,onQChange:a,searchPlaceholder:`Rechercher (kind, principal, rôle, route…)`,timeRange:u,onTimeRangeChange:d,onReset:p,canReset:f,children:[(0,X.jsxs)(U,{value:o,onValueChange:s,children:[(0,X.jsx)(F,{size:`sm`,children:(0,X.jsx)(M,{})}),(0,X.jsxs)(B,{children:[(0,X.jsx)(H,{value:Z,children:`Toutes directions`}),(0,X.jsx)(H,{value:`inbound`,children:`inbound`}),(0,X.jsx)(H,{value:`outbound`,children:`outbound`}),(0,X.jsx)(H,{value:`internal`,children:`internal`})]})]}),(0,X.jsxs)(U,{value:c,onValueChange:l,children:[(0,X.jsx)(F,{size:`sm`,children:(0,X.jsx)(M,{})}),(0,X.jsxs)(B,{children:[(0,X.jsx)(H,{value:Z,children:`Toutes sévérités`}),(0,X.jsx)(H,{value:`info`,children:`info`}),(0,X.jsx)(H,{value:`warn`,children:`warn`}),(0,X.jsx)(H,{value:`critical`,children:`critical`})]})]})]}),(0,X.jsx)(At,{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)(Ot,{value:u,onChange:d})]})]})}),(0,X.jsx)(Q,{title:`Dropdown menu`,description:`Row actions / kebab`,children:(0,X.jsxs)(mt,{children:[(0,X.jsx)(ht,{asChild:!0,children:(0,X.jsx)(j,{variant:`outline`,size:`icon`,"aria-label":`Open menu`,children:(0,X.jsx)(I,{})})}),(0,X.jsxs)(pt,{align:`start`,children:[(0,X.jsx)(vt,{children:`Actions`}),(0,X.jsx)(N,{}),(0,X.jsx)(P,{children:`Edit`}),(0,X.jsx)(P,{children:`Duplicate`}),(0,X.jsx)(N,{}),(0,X.jsx)(P,{variant:`destructive`,children:`Delete`})]})]})}),(0,X.jsx)(Q,{title:`Card`,children:(0,X.jsxs)(wt,{className:`w-80`,children:[(0,X.jsxs)(yt,{children:[(0,X.jsx)(St,{children:`Instance`}),(0,X.jsx)(Ct,{children:`Non-secret metadata only.`})]}),(0,X.jsx)(xt,{className:`text-sm text-muted-foreground`,children:`ws://gateway.example.org:18789`}),(0,X.jsxs)(bt,{className:`gap-2`,children:[(0,X.jsx)(j,{size:`sm`,children:`Save`}),(0,X.jsx)(j,{size:`sm`,variant:`ghost`,children:`Cancel`})]})]})}),(0,X.jsx)(Q,{title:`Table`,children:(0,X.jsxs)(Dt,{children:[(0,X.jsx)(Tt,{children:(0,X.jsxs)(G,{children:[(0,X.jsx)(W,{className:`w-8`,children:(0,X.jsx)(z,{"aria-label":`select all`})}),(0,X.jsx)(W,{children:`Name`}),(0,X.jsx)(W,{children:`Mode`}),(0,X.jsx)(W,{className:`text-right`,children:`Status`}),(0,X.jsx)(W,{className:`w-8`})]})}),(0,X.jsx)(Et,{children:[{n:`admins`,m:`per-user`,s:`active`},{n:`family`,m:`shared`,s:`active`}].map(e=>(0,X.jsxs)(G,{children:[(0,X.jsx)(K,{children:(0,X.jsx)(z,{"aria-label":`select ${e.n}`})}),(0,X.jsx)(K,{className:`font-medium`,children:e.n}),(0,X.jsx)(K,{children:(0,X.jsx)(L,{variant:`secondary`,children:e.m})}),(0,X.jsx)(K,{className:`text-right`,children:(0,X.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-muted-foreground`,children:[(0,X.jsx)(k,{className:`size-3.5`}),` `,e.s]})}),(0,X.jsx)(K,{children:(0,X.jsx)(j,{variant:`ghost`,size:`icon`,"aria-label":`row actions`,children:(0,X.jsx)(I,{})})})]},e.n))})]})}),(0,X.jsx)(Q,{title:`App fragments`,description:`Chat-specific components`,children:(0,X.jsxs)(`div`,{className:`oc-show__row oc-show__row--col`,children:[(0,X.jsx)(`div`,{className:`oc-msg oc-msg--assistant`,children:(0,X.jsx)(`div`,{className:`oc-msg__body`,children:`Assistant message bubble.`})}),(0,X.jsx)(`div`,{className:`oc-tool oc-tool--completed`,children:(0,X.jsxs)(`div`,{className:`oc-tool__header`,children:[(0,X.jsx)(`span`,{className:`oc-tool__icon`,children:`✓`}),(0,X.jsx)(`span`,{className:`oc-tool__name`,children:`write-file`}),(0,X.jsx)(`span`,{className:`oc-tool__phase`,children:`completed`})]})}),(0,X.jsxs)(`div`,{className:`oc-run-status oc-run-status--streaming`,children:[(0,X.jsx)(`span`,{className:`oc-run-status__dot`}),(0,X.jsx)(`span`,{className:`oc-run-status__label`,children:`Running`})]})]})})]})]})}export{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,Ab as a,Cb as o,Cp 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 ee,Jf as g,Kb as _,Kf as v,Mb as y,Nb as b,Ob as x,Pb as S,Qb as C,Qf as te,Sb as ne,Sp as re,Tb as ie,Tp as ae,Ub as oe,Uf as se,Vb as ce,Vf as w,Wb as T,Wf as le,Xb as E,Xf as ue,Yb as D,Yf as de,Zb as O,Zf as fe,_p as pe,ap as me,ax as k,bp as he,cp as ge,cx as A,dp as _e,dx as j,ep as ve,ex as M,fO as N,fp as ye,gp as be,hp as xe,ip as Se,ix as Ce,jb as P,kb as F,lp as we,lx as Te,mp as Ee,np as De,nx as Oe,op as ke,ox as Ae,pO as I,pp as je,qb as Me,qf as Ne,rp as Pe,rx as Fe,sp as Ie,sx as Le,tp as Re,tx as ze,up as Be,ux as Ve,vO as L,vp as He,wb as Ue,wp as We,xp as Ge,yO as R,yp as Ke}from"./dist-DsBcH2-2.js";import{n as qe}from"./dist-DM5LkQcA.js";import{t as Je}from"./x-CyUGhZ48.js";import{i as z,n as B,r as Ye,t as Xe}from"./tabs-D7vYdFs6.js";import{t as V}from"./button-9c1aLUeO.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-DsOZBPOX.js";import{n as pt}from"./TimeRangePicker-CPM9eoXo.js";import{t as mt}from"./FilterBar-DWv8wqqC.js";import{t as ht}from"./AdvancedFilter-CtaYuy-W.js";import{t as gt}from"./DataTableShell-VIRQvS8e.js";var _t=I(`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=I(`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`?_():n===`agent`?`${d()} - ${r}`:e}function bt(){let e=R(N.me.getMe,{host:lt})?.role===`admin`,t=R(N.deliveryTiming.getDeliveryStatus,{}),n=L(N.deliveryTiming.startDeliveryRecord),r=L(N.deliveryTiming.stopDeliveryRecord),[i,a]=(0,J.useState)(!1),[o,s]=(0,J.useState)(!1),c=t?.recording??!1,l=async()=>{s(!0);try{c?await r({}):await n({})}finally{s(!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:j()}),(0,Y.jsx)(`p`,{className:`oc-admin__hint`,children:Ve()})]}),e?(0,Y.jsx)(V,{variant:c?`destructive`:`default`,size:`sm`,disabled:o||t===void 0,onClick:()=>void l(),children:c?A():Te()}):null]}),c?(0,Y.jsxs)(`p`,{className:`flex items-center gap-2 text-sm`,children:[(0,Y.jsx)(W,{variant:`secondary`,children:Le()}),t?.startedAt?(0,Y.jsx)(`span`,{className:`text-muted-foreground`,children:Ae({time:new Date(t.startedAt).toLocaleTimeString()})}):null]}):null,(0,Y.jsx)(`div`,{children:(0,Y.jsx)(V,{variant:`outline`,size:`sm`,onClick:()=>a(e=>!e),children:i?Fe():Ce()})}),i?(0,Y.jsx)(xt,{isAdmin:e}):null]})}function xt({isAdmin:e}){let t=R(N.deliveryTiming.listDeliverySessions,{}),n=L(N.deliveryTiming.deleteDeliverySessions),[i,a]=(0,J.useState)(``),[s,c]=(0,J.useState)(`all`),[l,u]=(0,J.useState)(X),[d,f]=(0,J.useState)(null),{from:m,to:h}=pt(l),g=l.to===`now`?1/0:h,_=i.trim()!==``||s!==`all`||l!==X,v=()=>{a(``),c(`all`),u(X)},y=(0,J.useMemo)(()=>{if(t===void 0)return;let e=i.trim().toLowerCase();return t.filter(t=>(e===``||t.startedBy.toLowerCase().includes(e))&&(s===`all`||(s===`active`?t.active:!t.active))&&t.startedAt>=m&&t.startedAt<=g).map(e=>({...e,_id:e.sessionId}))},[t,i,s,m,g]),b=e=>{let t=new Set((y??[]).map(e=>e.sessionId)),r=e.filter(e=>t.has(e));r.length!==0&&(n({sessionIds:r}),d!==null&&r.includes(d)&&f(null))};return(0,Y.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Y.jsx)(mt,{q:i,onQChange:a,searchPlaceholder:ze(),timeRange:l,onTimeRangeChange:u,onReset:v,canReset:_,children:(0,Y.jsxs)(q,{value:s,onValueChange:e=>c(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:M()}),(0,Y.jsx)(K,{value:`active`,children:r()}),(0,Y.jsx)(K,{value:`stopped`,children:C()})]})]})}),(0,Y.jsx)(gt,{title:Oe(),rows:y,emptyHint:o(),columns:[{header:``,className:`w-8`,cell:e=>(0,Y.jsx)(V,{variant:`ghost`,size:`icon`,"aria-label":d===e.sessionId?oe():T(),onClick:()=>f(t=>t===e.sessionId?null:e.sessionId),children:d===e.sessionId?(0,Y.jsx)(_t,{size:15,"aria-hidden":!0}):(0,Y.jsx)(ft,{size:15,"aria-hidden":!0})})},{header:O(),sort:e=>e.startedAt,cell:e=>(0,Y.jsx)(`span`,{className:`tabular-nums`,children:new Date(e.startedAt).toLocaleString()})},{header:E(),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:D(),sort:e=>e.count,cell:e=>(0,Y.jsx)(`span`,{className:`tabular-nums`,children:Z(e.count)})},{header:ee(),sort:e=>e.startedBy,cell:e=>yt(e.startedBy)},{header:Me(),sort:e=>e.active,cell:e=>e.active?(0,Y.jsx)(W,{variant:`secondary`,children:r()}):(0,Y.jsx)(`span`,{className:`text-muted-foreground`,children:C()})}],rowActions:e?e=>[{label:p(),variant:`destructive`,onSelect:()=>b([e.sessionId])}]:void 0,bulkActions:e?[{label:p(),variant:`destructive`,onSelect:e=>b(e)}]:void 0,isExpanded:e=>e.sessionId===d,renderExpanded:e=>(0,Y.jsx)(St,{sessionId:e.sessionId})})]})}function St({sessionId:e}){let t=R(N.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:ce()});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,` `,ne()]}),(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?Ue():ie()]})]}),(0,Y.jsxs)(`table`,{className:`w-full text-sm`,children:[(0,Y.jsx)(`thead`,{children:(0,Y.jsxs)(`tr`,{className:`text-left text-muted-foreground`,children:[(0,Y.jsx)(`th`,{className:`py-1 font-medium`,children:S()}),(0,Y.jsx)(`th`,{className:`py-1 text-right font-medium`,children:b()}),(0,Y.jsx)(`th`,{className:`py-1 text-right font-medium`,children:y()})]})}),(0,Y.jsxs)(`tbody`,{children:[i(P(),r.bridge),i(a(),r.A),i(F(),r.C)]})]}),(0,Y.jsx)(`p`,{className:`oc-admin__hint`,children:x()}),e.truncated?(0,Y.jsx)(`p`,{className:`oc-admin__hint`,children:l()}):null,(0,Y.jsx)(`p`,{className:`oc-admin__hint`,children:c()})]})}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,o=e.principalType??Q,c=e.direction??Q,l=e.roleKey??Q,d=e.q??``,p=ut(e.from,e.to),m=(0,J.useMemo)(()=>ct(e.adv),[e.adv]),{from:ee,to:_}=pt(p),[y,b]=(0,J.useState)(null),[x,S]=(0,J.useState)(null),C=e=>void t({search:t=>({...t,limit:e})}),ne=e=>void t({search:t=>({...t,kind:e})}),ie=e=>void t({search:t=>({...t,q:e||void 0}),replace:!0}),oe=e=>void t({search:t=>({...t,statusClass:e===Q?void 0:e})}),se=e=>void t({search:t=>({...t,principalType:e===Q?void 0:e})}),ce=e=>void t({search:t=>({...t,direction:e===Q?void 0:e})}),w=e=>void t({search:t=>({...t,roleKey:e===Q?void 0:e})}),T=e=>void t({search:t=>({...t,...nt(e)})}),E=e=>void t({search:t=>({...t,adv:it(e)}),replace:!0}),D=R(N.observability.listEvents,{limit:n}),O=R(N.observability.listEvents,{limit:n,kind:r===Tt?void 0:r,filter:{q:d||void 0,from:ee,to:_,statusClass:a===Q?void 0:a,principalType:o===Q?void 0:o,direction:c===Q?void 0:c,roleKey:l===Q?void 0:l,advanced:m.length>0?m:void 0}}),k=(0,J.useMemo)(()=>{let e=new Set;for(let t of D??[])e.add(t.kind);return[...e].sort()},[D]),A=(0,J.useMemo)(()=>{let e=new Set;for(let t of D??[])t.roleKey&&e.add(t.roleKey);return[...e].sort()},[D]),j=d!==``||a!==Q||o!==Q||c!==Q||l!==Q||m.length>0||p.kind!==`relative`||p.from!==kt.from;function M(){t({search:{limit:100,kind:`all`},replace:!0})}let Ce=y?D?.filter(e=>e.correlationId===y):O,[P,F]=(0,J.useState)(`events`);return(0,Y.jsxs)(Xe,{value:P,onValueChange:e=>F(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}),h()]}),(0,Y.jsxs)(z,{value:`events`,className:`flex-1 gap-1.5`,children:[(0,Y.jsx)(vt,{size:13,"aria-hidden":!0}),u()]})]}),(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:[ae(),(0,Y.jsx)(`strong`,{children:We()}),s(),` `,(0,Y.jsx)(`span`,{className:`oc-filter__window`,children:re()})]}),(0,Y.jsxs)(mt,{q:d,onQChange:ie,searchPlaceholder:Ge(),timeRange:p,onTimeRangeChange:T,onReset:M,canReset:j,children:[(0,Y.jsxs)(q,{value:a,onValueChange:oe,children:[(0,Y.jsx)(U,{size:`sm`,className:`w-32`,children:(0,Y.jsx)(H,{placeholder:he()})}),(0,Y.jsxs)(G,{children:[(0,Y.jsx)(K,{value:Q,children:Ke()}),Et.map(e=>(0,Y.jsx)(K,{value:e,children:e},e))]})]}),(0,Y.jsxs)(q,{value:o,onValueChange:se,children:[(0,Y.jsx)(U,{size:`sm`,className:`w-32`,children:(0,Y.jsx)(H,{placeholder:He()})}),(0,Y.jsxs)(G,{children:[(0,Y.jsx)(K,{value:Q,children:pe()}),Dt.map(e=>(0,Y.jsx)(K,{value:e,children:e},e))]})]}),(0,Y.jsxs)(q,{value:c,onValueChange:ce,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:xe()}),Ot.map(e=>(0,Y.jsx)(K,{value:e,children:e},e))]})]}),(0,Y.jsxs)(q,{value:l,onValueChange:w,children:[(0,Y.jsx)(U,{size:`sm`,className:`w-36`,children:(0,Y.jsx)(H,{placeholder:Ee()})}),(0,Y.jsxs)(G,{children:[(0,Y.jsx)(K,{value:Q,children:je()}),A.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:ye()})}),(0,Y.jsxs)(G,{children:[(0,Y.jsx)(K,{value:Tt,children:_e()}),k.map(e=>(0,Y.jsx)(K,{value:e,children:e},e))]})]}),(0,Y.jsxs)(q,{value:String(n),onValueChange:e=>C(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:Be({count:e})},e))})]})]}),(0,Y.jsx)(ht,{fields:At,seed:m,onChange:E}),y?(0,Y.jsx)(`div`,{className:`oc-traces__followline`,children:(0,Y.jsxs)(`button`,{type:`button`,className:`oc-traces__chip`,onClick:()=>b(null),title:we(),children:[(0,Y.jsxs)(`span`,{className:`oc-traces__chip-label`,children:[ge(),(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:Ie()})]})}):null,(0,Y.jsx)(gt,{title:ke(),rows:Ce,emptyHint:y?me():Se(),columns:[{header:Pe(),sort:e=>e.at,cell:e=>(0,Y.jsx)(`span`,{className:`oc-traces__time`,children:new Date(e.at).toLocaleString(`fr-FR`)})},{header:De(),sort:e=>e.kind,cell:e=>(0,Y.jsx)(W,{variant:`secondary`,children:e.kind})},{header:Re(),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":ve(),children:`✓`})}},{header:i(),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:te(),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:fe(),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:ue(),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:de(),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:g(),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:Ne(),sort:e=>e.correlationId,cell:e=>e.correlationId?(0,Y.jsx)(`button`,{type:`button`,className:`oc-traces__corr`,title:v(),onClick:()=>b(e.correlationId),children:$(e.correlationId)}):(0,Y.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})},{header:f(),sort:e=>+!!e.meta,cell:e=>e.meta?(0,Y.jsx)(V,{variant:`outline`,size:`sm`,onClick:()=>S(e),children:le()}):(0,Y.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})}]}),(0,Y.jsx)(Pt,{row:x,onClose:()=>S(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:[se(),` `,(0,Y.jsx)(`code`,{children:e.kind}),(0,Y.jsx)(W,{variant:`outline`,children:m()})]}),(0,Y.jsx)(rt,{children:w()})]}),(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,B_ as i,F_ as a,G_ as o,H_ as s,I_ as c,J_ as l,K_ as u,L_ as d,M_ as ee,N_ as te,P_ as ne,Q_ as re,R_ as ie,U_ as ae,V_ as oe,W_ as se,X_ as ce,Y_ as le,Z_ as ue,af as f,av as p,cf as m,df as h,ev as de,fO as g,ff as _,if as v,iv as y,lf as b,nf as x,nv as fe,of as S,ov as C,p_ as pe,pf as w,q_ as me,rf as T,rv as E,sf as D,tf as O,tv as he,uf as k,vO as A,yO as j,z_ as ge}from"./dist-DsBcH2-2.js";import{t as M}from"./button-9c1aLUeO.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-DsOZBPOX.js";import{t as De}from"./FilterBar-DWv8wqqC.js";import{t as Oe}from"./DataTableShell-VIRQvS8e.js";import{t as ke}from"./DetailChips-YKc12Z-i.js";var Z=t(e(),1),Q=n();function Ae({profileId:e,userLabel:t,open:n,onOpenChange:r}){let i=j(g.agents.listAgentPoolForUser,n&&e?{profileId:e}:`skip`),a=j(g.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:w({user:t})}),(0,Q.jsx)(ye,{children:_()})]}),i?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:i.inGroup?h():k()}):null,(0,Q.jsx)(`div`,{className:`oc-access__list`,children:i===void 0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:b()}):u.length===0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:S()}):[...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:i,defaultKey:a}){let o=A(g.agents.assignAgent),s=A(g.agents.removeAgent),c=A(g.agents.setDefaultAgent),l=P();if(!e)return null;async function u(n,r){try{r?await s({profileId:e,instanceName:t,agentId:n}):await o({profileId:e,instanceName:t,agentId:n})}catch(e){l.error(m(),e)}}async function d(n){try{await c({profileId:e,instanceName:t,agentId:n})}catch(e){l.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=i.has(n),o=a===n,s=e.state===`deleted`;return(0,Q.jsxs)(`div`,{className:`oc-access__row`,children:[(0,Q.jsx)(U,{checked:r,disabled:s&&!r,onCheckedChange:()=>void u(e.agentId,r),"aria-label":f({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,s?(0,Q.jsx)(H,{variant:`outline`,className:`oc-access__gone`,children:v()}):null,e.outOfPool?(0,Q.jsx)(H,{variant:`outline`,className:`oc-access__gone`,children:T()}):null,r?o?(0,Q.jsx)(`span`,{className:`oc-access__fav`,role:`img`,"aria-label":x(),title:x(),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":O(),title:O(),onClick:()=>void d(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?C():p({count:r})})}),(0,Q.jsxs)(I,{align:`start`,className:`w-52`,children:[(0,Q.jsx)(Te,{children:y()}),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??``,f=e.role??$,p=e=>void t({search:t=>({...t,q:e||void 0}),replace:!0}),m=e=>void t({search:t=>({...t,role:e===$?void 0:e})}),h=j(g.admin.listUsers,{filter:{q:n||void 0,role:f===$?void 0:f},withAgents:!0}),_=j(g.me.getMe,{host:we}),v=A(g.admin.setRole),y=A(g.admin.setUserPermissions),b=A(g.admin.startImpersonation),x=A(g.admin.deleteUser),S=A(g.admin.setUserName),C=xe(),w=R(),T=P(),[D,O]=(0,Z.useState)(null),k=(0,Z.useMemo)(()=>{let e=new Set([`pending`,`user`,`admin`]);for(let t of h??[])e.add(t.role);return[...e]},[h]),M=n!==``||f!==$;function N(){t({search:{},replace:!0})}async function I(e){try{await v(e)}catch(e){T.error(E(),e)}}async function L(e){try{await y(e)}catch(e){T.error(fe(),e)}}async function z(e){let t=e.email||e.name||e.canonical||e.userId.slice(0,8);if(await C({title:le(),description:l({user:t}),confirmWord:me(),confirmLabel:u(),destructive:!0}))try{await x({profileId:e._id}),T.success(se({user:t}))}catch(e){T.error(o(),e)}}async function V(e){let t=e.email||e.name||e.userId.slice(0,8),n=await w({title:s(),label:oe({user:t}),placeholder:i(),defaultValue:e.name??``,confirmLabel:pe()});if(n!==null)try{await S({profileId:e._id,name:n}),T.success(ge())}catch(e){T.error(ie(),e)}}return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(De,{q:n,onQChange:p,searchPlaceholder:he(),onReset:N,canReset:M,children:(0,Q.jsxs)(X,{value:f,onValueChange:m,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:de()}),k.map(e=>(0,Q.jsx)(Y,{value:e,children:e},e))]})]})}),(0,Q.jsx)(Oe,{title:r(),rows:h,emptyHint:re(),rowActions:e=>{let t=[{label:ee(),onSelect:()=>O({profileId:e._id,label:e.email||e.name||e.canonical||e.userId.slice(0,8)})},{label:ae(),onSelect:()=>void V(e)}];return e.userId!==_?.userId&&t.push({label:ue(),onSelect:()=>void b({profileId:e._id})},{label:ce(),variant:`destructive`,onSelect:()=>void z(e)}),t},columns:[{header:d(),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:c(),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:a(),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:ne()}):(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:te(),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:D?.profileId??null,userLabel:D?.label??``,open:D!==null,onOpenChange:e=>{e||O(null)}})]})}export{Ne as UsersTab};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{pO as e}from"./dist-DsBcH2-2.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};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{cO as r,dO as i,pO as a,tO as o}from"./dist-DsBcH2-2.js";var s=a(`chevron-down`,[[`path`,{d:`m6 9 6 6 6-6`,key:`qrunsl`}]]),c=a(`chevron-up`,[[`path`,{d:`m18 15-6-6-6 6`,key:`153udz`}]]),l=t(e(),1),u=n();function d(e){let t=e+`CollectionProvider`,[n,a]=o(t),[s,c]=n(t,{collectionRef:{current:null},itemMap:new Map}),d=e=>{let{scope:t,children:n}=e,r=l.useRef(null),i=l.useRef(new Map).current;return(0,u.jsx)(s,{scope:t,itemMap:i,collectionRef:r,children:n})};d.displayName=t;let f=e+`CollectionSlot`,p=r(f),m=l.forwardRef((e,t)=>{let{scope:n,children:r}=e;return(0,u.jsx)(p,{ref:i(t,c(f,n).collectionRef),children:r})});m.displayName=f;let h=e+`CollectionItemSlot`,g=`data-radix-collection-item`,_=r(h),v=l.forwardRef((e,t)=>{let{scope:n,children:r,...a}=e,o=l.useRef(null),s=i(t,o),d=c(h,n);return l.useEffect(()=>(d.itemMap.set(o,{ref:o,...a}),()=>void d.itemMap.delete(o))),(0,u.jsx)(_,{[g]:``,ref:s,children:r})});v.displayName=h;function y(t){let n=c(e+`CollectionConsumer`,t);return l.useCallback(()=>{let e=n.collectionRef.current;if(!e)return[];let t=Array.from(e.querySelectorAll(`[${g}]`));return Array.from(n.itemMap.values()).sort((e,n)=>t.indexOf(e.ref.current)-t.indexOf(n.ref.current))},[n.collectionRef,n.itemMap])}return[{Provider:d,Slot:m,ItemSlot:v},y,a]}var f=l.createContext(void 0);function p(e){let t=l.useContext(f);return e||t||`ltr`}export{s as i,d as n,c as r,p as t};
|