@lacneu/atrium 0.54.1 → 0.54.2
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-Bra1w9mI.js → AccessTab-G-WLKUVf.js} +1 -1
- package/dist/assets/{AdvancedFilter-CXI70fDB.js → AdvancedFilter-BTHZYRGc.js} +1 -1
- package/dist/assets/AgentFilesTab-BHpBAsFA.js +3 -0
- package/dist/assets/{AnomaliesTab-lkmO_g5K.js → AnomaliesTab-B2_Mpyfy.js} +1 -1
- package/dist/assets/AuditTab-yjH9M1bm.js +1 -0
- package/dist/assets/BridgeTab-Ckx_hfwW.js +1 -0
- package/dist/assets/ChatDefaultsTab-BwmUmJ1r.js +1 -0
- package/dist/assets/{DataTableShell-DTw-rOw3.js → DataTableShell-DvxbPdB7.js} +1 -1
- package/dist/assets/{DetailChips-BviEGC5c.js → DetailChips-BCCxug5L.js} +1 -1
- package/dist/assets/{FeedbacksTab-6qgIgk4h.js → FeedbacksTab-C-VNml-X.js} +1 -1
- package/dist/assets/{FieldLabel-B-ZBXJZE.js → FieldLabel-C15_DFF2.js} +2 -2
- package/dist/assets/FilesTab-D7tFoAQG.js +1 -0
- package/dist/assets/{FilterBar-CTBZM__z.js → FilterBar-88imPMtz.js} +1 -1
- package/dist/assets/GroupsTab-D3OhxLQa.js +1 -0
- package/dist/assets/InstancesTab-DMIyLh8S.js +1 -0
- package/dist/assets/IntegrationsTab--rnPdlv6.js +1 -0
- package/dist/assets/{KpiTab-Gr9INsJ6.js → KpiTab-hcMGhqd7.js} +1 -1
- package/dist/assets/PreferencesTab-BhVrGd8f.js +1 -0
- package/dist/assets/PromptInjectionsTab-B_OULbil.js +4 -0
- package/dist/assets/RolesTab-Yf7per9y.js +1 -0
- package/dist/assets/ScheduledTab-OMmoZ0A0.js +1 -0
- package/dist/assets/ServiceAccountsTab-Bf3EVNkc.js +1 -0
- package/dist/assets/{SubAgentReportsTab-B8lPe9Yy.js → SubAgentReportsTab-EinUEcrI.js} +1 -1
- package/dist/assets/ThemeShowroom-CVkQPbiJ.js +1 -0
- package/dist/assets/{TimeRangePicker-C3vWWVJs.js → TimeRangePicker-D2BzLnpx.js} +1 -1
- package/dist/assets/TracesTab-Cn_fSlMk.js +1 -0
- package/dist/assets/UsersTab-C8K6rWGr.js +1 -0
- package/dist/assets/VoiceTab-D_yJlUnJ.js +1 -0
- package/dist/assets/{button-BWtKy7q6.js → button-DgrHAwnL.js} +1 -1
- package/dist/assets/{card-DXiwL4WM.js → card-Dq94Pad-.js} +1 -1
- package/dist/assets/chevrons-up-down-CPbErSVv.js +1 -0
- package/dist/assets/{compatView-Cr1GOQAx.js → compatView-CmR9qhhp.js} +1 -1
- package/dist/assets/{dispatchErrorInfo-CmzXtnuL.js → dispatchErrorInfo-BCoejmqa.js} +1 -1
- package/dist/assets/dist--_yEYc8n.js +4 -0
- package/dist/assets/{dist-Cj3AsyfP.js → dist-CktYgUtY.js} +1 -1
- package/dist/assets/{dist-CY9tmHrN.js → dist-DilWdU0c.js} +1 -1
- package/dist/assets/{dist-Dym84Yph.js → dist-DpG5aN5U.js} +1 -1
- package/dist/assets/{dist-Cjr8oS0T.js → dist-vBGNB0Dh.js} +1 -1
- package/dist/assets/{highlighted-body-OFNGDK62-DoH8U-bo.js → highlighted-body-OFNGDK62-DCyGQxrv.js} +1 -1
- package/dist/assets/{index-e-AWNSrb.css → index-B0ZKEJwL.css} +1 -1
- package/dist/assets/index-CMhwTTOU.js +238 -0
- package/dist/assets/mermaid-GHXKKRXX-DbugQhCl.js +1 -0
- package/dist/assets/{pdf-DgVAKiaL.js → pdf-CaIDXBex.js} +1 -1
- package/dist/assets/roleDescriptions-D0TCU7rm.js +1 -0
- package/dist/assets/{table-EVqhs7Hw.js → table-B58636RR.js} +1 -1
- package/dist/assets/{tabs-BQAkx85P.js → tabs-HTb97o34.js} +1 -1
- package/dist/assets/x-CJvE-xbb.js +1 -0
- package/dist/index.html +18 -9
- package/package.json +1 -1
- package/dist/assets/AgentFilesTab--eTTThOy.js +0 -3
- package/dist/assets/AuditTab-BJSOjXf5.js +0 -1
- package/dist/assets/BridgeTab-DSY7hdDk.js +0 -1
- package/dist/assets/ChatDefaultsTab-vjRy3Av7.js +0 -1
- package/dist/assets/FilesTab-DDPMBYeS.js +0 -1
- package/dist/assets/GroupsTab-DMuGAp-1.js +0 -1
- package/dist/assets/InstancesTab-HXTzTikJ.js +0 -1
- package/dist/assets/IntegrationsTab-C1dCcfJI.js +0 -1
- package/dist/assets/PreferencesTab-BBWh7JJ_.js +0 -1
- package/dist/assets/PromptInjectionsTab-DPW4ZK_F.js +0 -4
- package/dist/assets/RolesTab-C4CjCfXQ.js +0 -1
- package/dist/assets/ScheduledTab-iq39kp5Z.js +0 -1
- package/dist/assets/ServiceAccountsTab-Bg5IYwHt.js +0 -1
- package/dist/assets/ThemeShowroom-CmvPT6pZ.js +0 -1
- package/dist/assets/TracesTab-BX1G_6or.js +0 -1
- package/dist/assets/UsersTab-B2gKsvUO.js +0 -1
- package/dist/assets/VoiceTab-RHH5sbcg.js +0 -1
- package/dist/assets/chevrons-up-down-DWBiHBws.js +0 -1
- package/dist/assets/dist-Bh78J5oj.js +0 -4
- package/dist/assets/index-BoGVkzmD.js +0 -238
- package/dist/assets/mermaid-GHXKKRXX-Cox7MkSV.js +0 -1
- package/dist/assets/roleDescriptions-BU7PB8ly.js +0 -1
- package/dist/assets/x-Dj2c0suA.js +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{Fy as e,My as t,Ny as n,Py as r,jy as i}from"./dist--_yEYc8n.js";var a={pending:e,user:r,admin:n,observer:t,agent:i};function o(e){if(e.builtin){let t=a[e.key];if(t)return t()}return e.description}export{o as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{i as e,r as t}from"./bundle-mjs-BJq7W7j9.js";import{n}from"./dist
|
|
1
|
+
import{i as e,r as t}from"./bundle-mjs-BJq7W7j9.js";import{n}from"./dist--_yEYc8n.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{c as e,i as t,r as n}from"./bundle-mjs-BJq7W7j9.js";import{n as r,t as i}from"./dist
|
|
1
|
+
import{c as e,i as t,r as n}from"./bundle-mjs-BJq7W7j9.js";import{n as r,t as i}from"./dist--_yEYc8n.js";import{t as a}from"./dist-CktYgUtY.js";import{_ as o,c as s,g as c,l,p as u,u as d}from"./dist-vBGNB0Dh.js";import{Dt as f,Ot as p,kt as m}from"./index-CMhwTTOU.js";var h=e(t(),1),g=n(),_=`Tabs`,[v,y]=u(_,[m]),b=m(),[x,S]=v(_),C=h.forwardRef((e,t)=>{let{__scopeTabs:n,value:r,onValueChange:i,defaultValue:c,orientation:l=`horizontal`,dir:u,activationMode:f=`automatic`,...p}=e,m=a(u),[h,v]=d({prop:r,onChange:i,defaultProp:c??``,caller:_});return(0,g.jsx)(x,{scope:n,baseId:s(),value:h,onValueChange:v,orientation:l,dir:m,activationMode:f,children:(0,g.jsx)(o.div,{dir:m,"data-orientation":l,...p,ref:t})})});C.displayName=_;var w=`TabsList`,T=h.forwardRef((e,t)=>{let{__scopeTabs:n,loop:r=!0,...i}=e,a=S(w,n),s=b(n);return(0,g.jsx)(p,{asChild:!0,...s,orientation:a.orientation,dir:a.dir,loop:r,children:(0,g.jsx)(o.div,{role:`tablist`,"aria-orientation":a.orientation,...i,ref:t})})});T.displayName=w;var E=`TabsTrigger`,D=h.forwardRef((e,t)=>{let{__scopeTabs:n,value:r,disabled:i=!1,...a}=e,s=S(E,n),l=b(n),u=A(s.baseId,r),d=j(s.baseId,r),p=r===s.value;return(0,g.jsx)(f,{asChild:!0,...l,focusable:!i,active:p,children:(0,g.jsx)(o.button,{type:`button`,role:`tab`,"aria-selected":p,"aria-controls":d,"data-state":p?`active`:`inactive`,"data-disabled":i?``:void 0,disabled:i,id:u,...a,ref:t,onMouseDown:c(e.onMouseDown,e=>{!i&&e.button===0&&e.ctrlKey===!1?s.onValueChange(r):e.preventDefault()}),onKeyDown:c(e.onKeyDown,e=>{[` `,`Enter`].includes(e.key)&&s.onValueChange(r)}),onFocus:c(e.onFocus,()=>{let e=s.activationMode!==`manual`;!p&&!i&&e&&s.onValueChange(r)})})})});D.displayName=E;var O=`TabsContent`,k=h.forwardRef((e,t)=>{let{__scopeTabs:n,value:r,forceMount:i,children:a,...s}=e,c=S(O,n),u=A(c.baseId,r),d=j(c.baseId,r),f=r===c.value,p=h.useRef(f);return h.useEffect(()=>{let e=requestAnimationFrame(()=>p.current=!1);return()=>cancelAnimationFrame(e)},[]),(0,g.jsx)(l,{present:i||f,children:({present:n})=>(0,g.jsx)(o.div,{"data-state":f?`active`:`inactive`,"data-orientation":c.orientation,role:`tabpanel`,"aria-labelledby":u,hidden:!n,id:d,tabIndex:0,...s,ref:t,style:{...e.style,animationDuration:p.current?`0s`:void 0},children:n&&a})})});k.displayName=O;function A(e,t){return`${e}-trigger-${t}`}function j(e,t){return`${e}-content-${t}`}var M=C,N=T,P=D,F=k;function I({className:e,orientation:t=`horizontal`,...n}){return(0,g.jsx)(M,{"data-slot":`tabs`,"data-orientation":t,className:r(`group/tabs flex gap-2 data-horizontal:flex-col`,e),...n})}var L=i(`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:r(L({variant:t}),e),...n})}function z({className:e,...t}){return(0,g.jsx)(P,{"data-slot":`tabs-trigger`,className:r(`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:r(`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{l as e}from"./dist--_yEYc8n.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
|
@@ -20,6 +20,15 @@
|
|
|
20
20
|
window.matchMedia("(prefers-color-scheme: dark)").matches);
|
|
21
21
|
document.documentElement.classList.toggle("dark", dark);
|
|
22
22
|
})();
|
|
23
|
+
// Apply the saved text-size scale before first paint (mirror of the theme
|
|
24
|
+
// script): a late size jump is as jarring as a theme flash. The map MUST
|
|
25
|
+
// match src/lib/useFontScale.FONT_SCALE_CSS; useApplyFontScale reconciles
|
|
26
|
+
// with the Convex-resolved value right after hydration.
|
|
27
|
+
(function () {
|
|
28
|
+
var s = localStorage.getItem("oc.fontScale");
|
|
29
|
+
var map = { sm: "87.5%", lg: "112.5%", xl: "125%" };
|
|
30
|
+
if (s && map[s]) document.documentElement.style.fontSize = map[s];
|
|
31
|
+
})();
|
|
23
32
|
// Reflect the saved UI locale on <html lang> before first paint (a11y),
|
|
24
33
|
// mirror of the theme script above. Paraglide's localStorage strategy
|
|
25
34
|
// persists the locale under PARAGLIDE_LOCALE; useApplyLocale then keeps it
|
|
@@ -53,17 +62,17 @@
|
|
|
53
62
|
document.documentElement.dataset.motion = "static";
|
|
54
63
|
})();
|
|
55
64
|
</script>
|
|
56
|
-
<script type="module" crossorigin src="/assets/index-
|
|
65
|
+
<script type="module" crossorigin src="/assets/index-CMhwTTOU.js"></script>
|
|
57
66
|
<link rel="modulepreload" crossorigin href="/assets/bundle-mjs-BJq7W7j9.js">
|
|
58
|
-
<link rel="modulepreload" crossorigin href="/assets/dist
|
|
67
|
+
<link rel="modulepreload" crossorigin href="/assets/dist--_yEYc8n.js">
|
|
59
68
|
<link rel="modulepreload" crossorigin href="/assets/react-dom-DdTRmCHB.js">
|
|
60
|
-
<link rel="modulepreload" crossorigin href="/assets/dist-
|
|
61
|
-
<link rel="modulepreload" crossorigin href="/assets/dist-
|
|
62
|
-
<link rel="modulepreload" crossorigin href="/assets/dist-
|
|
63
|
-
<link rel="modulepreload" crossorigin href="/assets/dist-
|
|
64
|
-
<link rel="modulepreload" crossorigin href="/assets/x-
|
|
65
|
-
<link rel="modulepreload" crossorigin href="/assets/button-
|
|
66
|
-
<link rel="stylesheet" crossorigin href="/assets/index-
|
|
69
|
+
<link rel="modulepreload" crossorigin href="/assets/dist-vBGNB0Dh.js">
|
|
70
|
+
<link rel="modulepreload" crossorigin href="/assets/dist-CktYgUtY.js">
|
|
71
|
+
<link rel="modulepreload" crossorigin href="/assets/dist-DpG5aN5U.js">
|
|
72
|
+
<link rel="modulepreload" crossorigin href="/assets/dist-DilWdU0c.js">
|
|
73
|
+
<link rel="modulepreload" crossorigin href="/assets/x-CJvE-xbb.js">
|
|
74
|
+
<link rel="modulepreload" crossorigin href="/assets/button-DgrHAwnL.js">
|
|
75
|
+
<link rel="stylesheet" crossorigin href="/assets/index-B0ZKEJwL.css">
|
|
67
76
|
</head>
|
|
68
77
|
<body>
|
|
69
78
|
<div id="root"></div>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lacneu/atrium",
|
|
3
|
-
"version": "0.54.
|
|
3
|
+
"version": "0.54.2",
|
|
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{c as e,i as t,r as n}from"./bundle-mjs-BJq7W7j9.js";import{Ac as r,Ar as i,CM as a,Cc as o,Cr as s,Dc as ee,Dr as c,Ec as l,Er as u,Fr as d,MM as f,Mc as p,Mr as m,Nc as h,Nr as g,Oc as _,Or as v,Pc as y,Pr as b,Sc as x,Sr as S,TM as C,Tc as w,Tr as T,WE as E,_c as D,_l as O,_r as k,ac as A,ar as j,bc as M,br as N,c as P,cc as F,cr as I,dc as L,fc as R,gc as z,gr as B,hc as te,hl as ne,hr as re,ir as ie,jM as V,jc as ae,jr as oe,kM as H,kc as se,kr as U,lc as ce,mc as le,nr as W,oc as G,or as ue,pc as de,rr as fe,sc as pe,sr as me,uc as he,vc as ge,vr as _e,wc as ve,wr as ye,xc as be,xr as xe,yc as Se,yr as Ce}from"./dist-Bh78J5oj.js";import{t as K}from"./button-BWtKy7q6.js";import{At as q,C as we,G as Te,H as Ee,J as De,K as Oe,S as ke,U as Ae,W as je,Y as Me,b as Ne,ct as Pe,dt as Fe,ft as Ie,ht as Le,mt as Re,q as ze,ut as Be,w as Ve,x as He,xt as Ue,y as We,z as J}from"./index-BoGVkzmD.js";import{n as Ge,t as Ke}from"./curation-CQksaIbm.js";import{i as qe}from"./compatView-Cr1GOQAx.js";/* empty css */var Y=e(t(),1),X=2e4,Je=6e4;function Ye(e){return typeof e!=`number`||e<=0?0:Math.round(e/X*100)}function Xe(e){return e<=0?0:Math.round(e/Je*100)}function Z(e,t){let n=(typeof e==`number`&&e>0?e:0)/1e3;return new Intl.NumberFormat(t,{minimumFractionDigits:1,maximumFractionDigits:1}).format(n)}function Ze(e){return e.reduce((e,t)=>e+(typeof t.size==`number`&&t.size>0?t.size:0),0)}var Qe=3;function $e(e,t){let n=new Map;for(let t of e.split(`
|
|
2
|
-
`))n.set(t,(n.get(t)??0)+1);for(let e of t.split(`
|
|
3
|
-
`))n.set(e,(n.get(e)??0)-1);let r=0,i=0,a=[],o=[];for(let[e,t]of n)t<0?(r+=-t,a.length<Qe&&a.push(e)):t>0&&(i+=t,o.length<Qe&&o.push(e));return{added:r,removed:i,sampleAdded:a,sampleRemoved:o}}function et(e){return e instanceof Error?e.message.includes(`conflict:`):String(e).includes(`conflict:`)}var Q=n(),$=e=>`${e.instanceName}::${e.agentId}`;function tt(){let e=f(P.me.getMe,{host:Ue}),t=e?.role===`admin`,n=(e?.permissions??[]).includes(`bridge.read`),s=f(P.admin.listInstances,e!==void 0&&t?{}:`skip`),[c,u]=(0,Y.useState)(null);(0,Y.useEffect)(()=>{!t||!s||s.length===0||(!c||!s.some(e=>e.name===c))&&u(s[0].name)},[t,s,c]);let d=f(P.agents.listAgentsForInstance,t&&c?{instanceName:c}:`skip`),g=f(P.agents.listMyAgents,e!==void 0&&!t?{}:`skip`),v=(0,Y.useMemo)(()=>{if(e!==void 0){if(t)return c===null||d===void 0?s!==void 0&&s.length===0?[]:void 0:d.agents.map(e=>({instanceName:c,agentId:e.agentId,label:`${e.emoji?`${e.emoji} `:``}${e.displayName??e.agentId}`}));if(g!==void 0)return g.map(e=>({instanceName:e.instanceName,agentId:e.agentId,label:`${e.emoji?`${e.emoji} `:``}${e.displayName??e.agentId}`}))}},[e,t,c,d,s,g]),[b,S]=(0,Y.useState)(null);(0,Y.useEffect)(()=>{!v||v.length===0||(!b||!v.some(e=>$(e)===b))&&S($(v[0]))},[v,b]);let T=v?.find(e=>$(e)===b)??null,E=H(P.agentFiles.listAgentFiles),[D,O]=(0,Y.useState)({status:`idle`}),k=T?.instanceName??null,A=T?.agentId??null,j=f(P.compat.forInstance,n&&k!==null?{instanceName:k}:`skip`),M=n&&k!==null?We(j,`agentFiles`):null,N=M===null?!1:M===`loading`?null:M.blocked,F=(0,Y.useCallback)(async()=>{if(!(k===null||A===null)){O({status:`loading`});try{O({status:`done`,files:(await E({instanceName:k,agentId:A})).files})}catch{O({status:`error`})}}},[E,k,A]);(0,Y.useEffect)(()=>{N===!1&&F()},[F,N]);let[I,L]=(0,Y.useState)(null),R=f(P.agentFileCuration.listCurations,t&&k!==null&&A!==null?{instanceName:k,agentId:A}:`skip`),z=f(P.agentFileCuration.curationSettings,t&&k!==null?{instanceName:k}:`skip`),B=H(P.agentFileCuration.requestCuration),[te,re]=(0,Y.useState)(null),[ie,V]=(0,Y.useState)(null),{toast:U}=J(),ce=(0,Y.useMemo)(()=>{let e=new Map;for(let t of R??[])e.has(t.name)||e.set(t.name,t);return e},[R]),le=(0,Y.useCallback)(async e=>{if(!(k===null||A===null)){re(e);try{let t=await B({instanceName:k,agentId:A,name:e,trigger:`manual`});t.ok?U({title:m(),variant:`success`}):U({title:oe({reason:t.reason??`unknown`}),variant:`error`})}catch{U({title:i(),variant:`error`})}finally{re(null)}}},[B,k,A,U]),W=C(),G=(0,Y.useMemo)(()=>new Intl.NumberFormat(W,{maximumFractionDigits:0}),[W]);return e===void 0||v===void 0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:a()}):(0,Q.jsxs)(`div`,{className:`oc-afiles`,children:[(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:y()}),(0,Q.jsxs)(`div`,{className:`oc-afiles__picker`,children:[t&&(s?.length??0)>1?(0,Q.jsxs)(Ne,{value:c??``,onValueChange:e=>u(e),children:[(0,Q.jsx)(we,{size:`sm`,"aria-label":h(),children:(0,Q.jsx)(Ve,{})}),(0,Q.jsx)(He,{children:(s??[]).map(e=>(0,Q.jsx)(ke,{value:e.name,children:e.name},e.name))})]}):null,v.length>0?(0,Q.jsxs)(Ne,{value:b??``,onValueChange:e=>S(e),children:[(0,Q.jsx)(we,{size:`sm`,"aria-label":p(),children:(0,Q.jsx)(Ve,{})}),(0,Q.jsx)(He,{children:v.map(e=>(0,Q.jsx)(ke,{value:$(e),children:e.label},$(e)))})]}):(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:ae()})]}),T===null?null:M===`loading`?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:a()}):M!==null&&M.blocked?(0,Q.jsxs)(`p`,{className:`oc-compat__blocked`,role:`status`,children:[(0,Q.jsx)(q,{size:14,"aria-hidden":!0}),` `,qe(M.gatewayVersion,M.provider)]}):D.status===`loading`||D.status===`idle`?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:a()}):D.status===`error`?(0,Q.jsxs)(`p`,{className:`oc-afiles__error`,role:`alert`,children:[se(),` `,(0,Q.jsx)(K,{variant:`outline`,size:`sm`,onClick:()=>void F(),children:ne()})]}):D.files.length===0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:r()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`div`,{className:`oc-afiles__list`,children:D.files.map(e=>{let n=Ye(e.size),r=n>=80;return(0,Q.jsxs)(`div`,{className:`oc-afiles__row`,children:[(0,Q.jsx)(`span`,{className:`oc-afiles__name`,title:e.name,children:e.name}),e.missing?(0,Q.jsx)(Pe,{variant:`outline`,children:_()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`span`,{className:`oc-afiles__size`,children:ee({size:Z(e.size,W)})}),(0,Q.jsx)(`span`,{className:`oc-afiles__gauge${r?` is-warn`:``}`,"aria-hidden":!0,children:(0,Q.jsx)(`span`,{className:`oc-afiles__gauge-fill`,style:{width:`${Math.min(n,100)}%`}})}),(0,Q.jsx)(`span`,{className:`oc-afiles__pct`,children:l({pct:G.format(n)})}),r?(0,Q.jsx)(q,{size:14,className:`oc-afiles__warn`,"aria-label":w()}):(0,Q.jsx)(`span`,{className:`oc-afiles__warn-slot`,"aria-hidden":!0})]}),(0,Q.jsx)(K,{variant:`outline`,size:`sm`,className:`oc-afiles__open`,onClick:()=>L(e),children:t?o():x()}),t&&!e.missing?(0,Q.jsx)(nt,{curatable:Ke.includes(e.name),size:e.size??0,budget:z?.budgetChars??null,enabled:z?.enabled??!1,curation:ce.get(e.name)??null,inFlight:te===e.name,onCurate:()=>void le(e.name),onReview:e=>V(e)}):null]},e.name)})}),(0,Q.jsx)(`p`,{className:`oc-afiles__budget`,children:ve({used:Z(Ze(D.files),W),total:Z(Je,W),pct:G.format(Xe(Ze(D.files)))})})]}),I&&T?(0,Q.jsx)(rt,{instanceName:T.instanceName,agentId:T.agentId,name:I.name,isAdmin:t,onClose:()=>L(null),onSaved:()=>void F()}):null,ie?(0,Q.jsx)(it,{curationId:ie,onClose:()=>V(null),onApplied:()=>{V(null),F()}}):null]})}function nt({curatable:e,size:t,budget:n,enabled:r,curation:i,inFlight:a,onCurate:o,onReview:s}){return i?.status===`proposed`?(0,Q.jsx)(K,{variant:`default`,size:`sm`,className:`oc-afiles__curate`,onClick:()=>s(i._id),children:b()}):a||i?.status===`dispatched`||i?.status===`applying`?(0,Q.jsx)(Pe,{variant:`outline`,className:`oc-afiles__curate-status`,children:g()}):e&&r&&n!==null&&Ge(t,n)?(0,Q.jsx)(K,{variant:`outline`,size:`sm`,className:`oc-afiles__curate`,onClick:o,children:d()}):null}function rt({instanceName:e,agentId:t,name:n,isAdmin:r,onClose:i,onSaved:o}){let s=H(P.agentFiles.getAgentFile),ee=H(P.agentFiles.setAgentFile),c=J(),[l,u]=(0,Y.useState)(null),[d,f]=(0,Y.useState)(!1),[p,m]=(0,Y.useState)(``),[h,g]=(0,Y.useState)(!1),[_,v]=(0,Y.useState)(!1),[y,b]=(0,Y.useState)(!1),[x,S]=(0,Y.useState)(!1),w=(0,Y.useCallback)(async r=>{f(!1);try{let i=await s({instanceName:e,agentId:t,name:n});u({content:i.content,updatedAtMs:i.updatedAtMs}),r||m(i.content),b(!1)}catch{f(!0)}},[s,e,t,n]);(0,Y.useEffect)(()=>{w(!1)},[w]);async function T(){if(l!==null){v(!0),S(!1);try{await ee({instanceName:e,agentId:t,name:n,content:p,baseUpdatedAtMs:l.updatedAtMs??void 0}),c.success(te({name:n})),o(),await w(!1)}catch(e){et(e)?b(!0):S(!0)}finally{v(!1)}}}let k=l!==null&&p!==l.content,j=(0,Y.useMemo)(()=>l===null?null:$e(l.content,p),[l,p]),N=p.length>X,I=C(),B=(0,Y.useMemo)(()=>new Intl.NumberFormat(I),[I]);return(0,Q.jsx)(Be,{open:!0,onOpenChange:e=>!e&&i(),children:(0,Q.jsxs)(Fe,{className:`oc-afiles__editor`,children:[(0,Q.jsxs)(Re,{children:[(0,Q.jsx)(Le,{children:be({name:n})}),(0,Q.jsxs)(Ie,{children:[M({agent:t,instance:e}),r?null:(0,Q.jsxs)(Q.Fragment,{children:[` · `,Se()]})]})]}),d?(0,Q.jsxs)(`p`,{className:`oc-afiles__error`,role:`alert`,children:[de(),` `,(0,Q.jsx)(K,{variant:`outline`,size:`sm`,onClick:()=>void w(!1),children:ne()})]}):l===null?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:a()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`textarea`,{className:`oc-afiles__source`,value:p,readOnly:!r,spellCheck:!1,onChange:e=>m(e.target.value),"aria-label":be({name:n})}),(0,Q.jsx)(`p`,{className:`oc-afiles__hint`,children:ge()}),y?(0,Q.jsxs)(`p`,{className:`oc-afiles__error`,role:`alert`,children:[R(),` `,(0,Q.jsx)(K,{variant:`outline`,size:`sm`,onClick:()=>void w(!0),children:L()})]}):null,x?(0,Q.jsx)(`p`,{className:`oc-afiles__error`,role:`alert`,children:le()}):null,(0,Q.jsxs)(`div`,{className:`oc-afiles__editor-foot`,children:[(0,Q.jsx)(`span`,{className:`oc-afiles__count${N?` is-over`:``}`,children:D({count:B.format(p.length),max:B.format(X)})}),r?(0,Q.jsx)(K,{size:`sm`,disabled:!k||_||y,onClick:()=>g(!0),children:_?O():z()}):null]})]}),(0,Q.jsx)(Ee,{open:h,onOpenChange:g,children:(0,Q.jsxs)(Te,{children:[(0,Q.jsxs)(De,{children:[(0,Q.jsx)(Me,{children:he({name:n})}),(0,Q.jsx)(Oe,{children:ce({agent:t})})]}),j?(0,Q.jsxs)(`div`,{className:`oc-afiles__diff`,children:[(0,Q.jsx)(`p`,{className:`oc-afiles__diff-counts`,children:F({added:j.added,removed:j.removed})}),j.sampleAdded.length>0?(0,Q.jsxs)(`div`,{className:`oc-afiles__diff-block`,children:[(0,Q.jsx)(`span`,{className:`oc-afiles__diff-label`,children:pe()}),j.sampleAdded.map((e,t)=>(0,Q.jsx)(`code`,{className:`oc-afiles__diff-line is-add`,children:e||` `},t))]}):null,j.sampleRemoved.length>0?(0,Q.jsxs)(`div`,{className:`oc-afiles__diff-block`,children:[(0,Q.jsx)(`span`,{className:`oc-afiles__diff-label`,children:G()}),j.sampleRemoved.map((e,t)=>(0,Q.jsx)(`code`,{className:`oc-afiles__diff-line is-del`,children:e||` `},t))]}):null]}):null,(0,Q.jsxs)(ze,{children:[(0,Q.jsx)(je,{children:E()}),(0,Q.jsx)(Ae,{onClick:()=>void T(),children:A()})]})]})})]})})}function it({curationId:e,onClose:t,onApplied:n}){let r=f(P.agentFileCuration.getProposal,{curationId:e}),o=H(P.agentFileCuration.approveCuration),ee=V(P.agentFileCuration.rejectCuration),{toast:l}=J(),[d,p]=(0,Y.useState)(null),[m,h]=(0,Y.useState)(!1),[g,_]=(0,Y.useState)(``),y=C(),b=(0,Y.useMemo)(()=>r?$e(r.beforeContent,r.proposedContent):null,[r]);async function x(){p(`approve`);try{let t=await o({curationId:e});t.ok?(l({title:U(),variant:`success`}),n()):l({title:t.reason===`conflict`?c():u({reason:t.reason??`unknown`}),variant:`error`})}catch{l({title:i(),variant:`error`})}finally{p(null)}}async function w(n){p(`reject`);try{let r=g.trim();(await ee({curationId:e,...r?{comment:r}:{},relaunch:n})).ok?l({title:n?fe():v(),variant:`success`}):l({title:s(),variant:`error`}),t()}catch{l({title:i(),variant:`error`})}finally{p(null)}}return(0,Q.jsx)(Be,{open:!0,onOpenChange:e=>e?void 0:t(),children:(0,Q.jsxs)(Fe,{className:`oc-afiles__review`,children:[(0,Q.jsxs)(Re,{children:[(0,Q.jsx)(Le,{children:r?T({name:r.name}):a()}),(0,Q.jsx)(Ie,{children:ye()})]}),r===void 0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:a()}):r===null?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:s()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`p`,{className:`oc-afiles__review-sizes`,children:[S({before:Z(r.beforeSize,y),after:Z(r.proposedSize,y)}),r.overBudget?(0,Q.jsxs)(Q.Fragment,{children:[` `,(0,Q.jsx)(q,{size:13,"aria-hidden":!0}),` `,xe()]}):null]}),b?(0,Q.jsx)(`p`,{className:`oc-afiles__review-diff`,children:N({added:b.added,removed:b.removed})}):null,r.feedback?(0,Q.jsx)(`p`,{className:`oc-afiles__review-feedback`,children:W({feedback:r.feedback})}):null,b&&b.sampleRemoved.length>0?(0,Q.jsxs)(`div`,{className:`oc-afiles__review-removed`,children:[(0,Q.jsx)(`p`,{className:`oc-afiles__review-label`,children:re()}),(0,Q.jsx)(`ul`,{children:b.sampleRemoved.map((e,t)=>(0,Q.jsx)(`li`,{children:e||`\xA0`},t))})]}):null,(0,Q.jsxs)(`div`,{className:`oc-afiles__review-panes oc-afiles__review-panes--2`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`p`,{className:`oc-afiles__review-label`,children:B()}),(0,Q.jsx)(`pre`,{className:`oc-afiles__review-pre`,children:r.beforeContent})]}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`p`,{className:`oc-afiles__review-label`,children:Ce()}),(0,Q.jsx)(`pre`,{className:`oc-afiles__review-pre`,children:r.proposedContent})]})]})]}),m?(0,Q.jsxs)(`div`,{className:`oc-afiles__reject-form`,children:[(0,Q.jsx)(`label`,{className:`oc-afiles__review-label`,htmlFor:`curation-reject-comment`,children:I()}),(0,Q.jsx)(`textarea`,{id:`curation-reject-comment`,className:`oc-afiles__reject-textarea`,rows:3,placeholder:me(),value:g,onChange:e=>_(e.target.value)}),(0,Q.jsxs)(`div`,{className:`oc-afiles__review-actions`,children:[(0,Q.jsx)(K,{variant:`ghost`,onClick:()=>h(!1),disabled:d!==null,children:ue()}),(0,Q.jsx)(K,{variant:`outline`,onClick:()=>void w(!1),disabled:d!==null,children:d===`reject`?O():j()}),(0,Q.jsx)(K,{variant:`default`,onClick:()=>void w(!0),disabled:d!==null,children:d===`reject`?O():ie()})]})]}):(0,Q.jsxs)(`div`,{className:`oc-afiles__review-actions`,children:[(0,Q.jsx)(K,{variant:`outline`,onClick:()=>h(!0),disabled:d!==null||r==null,children:_e()}),(0,Q.jsx)(K,{variant:`default`,onClick:()=>void x(),disabled:d!==null||r==null,children:d===`approve`?O():k()})]})]})})}export{tt as AgentFilesTab};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{c as e,i as t,r as n}from"./bundle-mjs-BJq7W7j9.js";import{$t as r,Cb as i,Eb as a,MM as o,Sb as s,Tb as c,_b as l,bb as u,c as d,en as f,fb as p,gb as m,hb as h,in as g,mb as _,nn as v,pb as y,rn as b,tn as x,vb as S,wb as C,xb as w,yb as T}from"./dist-Bh78J5oj.js";import{C as E,S as D,Xt as O,Yt as k,a as A,b as j,et as M,i as N,o as P,r as F,t as I,w as L,x as R}from"./index-BoGVkzmD.js";import{n as ee}from"./TimeRangePicker-C3vWWVJs.js";import{t as z}from"./FilterBar-CTBZM__z.js";import{t as B}from"./AdvancedFilter-CXI70fDB.js";import{t as V}from"./DataTableShell-DTw-rOw3.js";var H=e(t(),1),U=n(),W={kind:`relative`,from:I,to:`now`},G=`__all__`,K=[{value:`action`,label:g()},{value:`realLabel`,label:b()},{value:`targetLabel`,label:v()},{value:`impersonated`,label:x()},{value:`resource`,label:f()},{value:`resourceId`,label:r()}];function q(){let e=O({from:`/settings/audit`}),t=k({from:`/settings/audit`}),n=e.q??``,r=e.action??G,f=e.impersonated??G,g=e.resource??G,v=F(e.from,e.to),b=(0,H.useMemo)(()=>P(e.adv),[e.adv]),{from:x,to:I}=ee(v),q=e=>void t({search:t=>({...t,q:e||void 0}),replace:!0}),J=e=>void t({search:t=>({...t,action:e===G?void 0:e})}),Y=e=>void t({search:t=>({...t,impersonated:e===G?void 0:e})}),X=e=>void t({search:t=>({...t,resource:e===G?void 0:e})}),Z=e=>void t({search:t=>({...t,...A(e)})}),Q=e=>void t({search:t=>({...t,adv:N(e)}),replace:!0}),$=o(d.admin.listAudit,{filter:{q:n||void 0,from:x,to:I,action:r===G?void 0:r,resource:g===G?void 0:g,impersonated:f===G?void 0:f===`yes`,advanced:b.length>0?b:void 0}}),te=(0,H.useMemo)(()=>{let e=new Set;for(let t of $??[])e.add(t.action);return[...e].sort()},[$]),ne=(0,H.useMemo)(()=>{let e=new Set;for(let t of $??[])t.resource&&e.add(t.resource);return[...e].sort()},[$]),re=n!==``||r!==G||f!==G||g!==G||b.length>0||v.kind!==`relative`||v.from!==W.from;function ie(){t({search:{},replace:!0})}return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(`p`,{className:`oc-admin__hint`,children:[a(),` `,(0,U.jsx)(`span`,{className:`oc-filter__window`,children:c()})]}),(0,U.jsxs)(z,{q:n,onQChange:q,searchPlaceholder:C(),timeRange:v,onTimeRangeChange:Z,onReset:ie,canReset:re,children:[(0,U.jsxs)(j,{value:r,onValueChange:J,children:[(0,U.jsx)(E,{size:`sm`,className:`w-40`,children:(0,U.jsx)(L,{placeholder:i()})}),(0,U.jsxs)(R,{children:[(0,U.jsx)(D,{value:G,children:s()}),te.map(e=>(0,U.jsx)(D,{value:e,children:e},e))]})]}),(0,U.jsxs)(j,{value:f,onValueChange:Y,children:[(0,U.jsx)(E,{size:`sm`,className:`w-40`,children:(0,U.jsx)(L,{})}),(0,U.jsxs)(R,{children:[(0,U.jsx)(D,{value:G,children:w()}),(0,U.jsx)(D,{value:`yes`,children:u()}),(0,U.jsx)(D,{value:`no`,children:T()})]})]}),(0,U.jsxs)(j,{value:g,onValueChange:X,children:[(0,U.jsx)(E,{size:`sm`,className:`w-40`,children:(0,U.jsx)(L,{placeholder:S()})}),(0,U.jsxs)(R,{children:[(0,U.jsx)(D,{value:G,children:l()}),ne.map(e=>(0,U.jsx)(D,{value:e,children:e},e))]})]})]}),(0,U.jsx)(B,{fields:K,seed:b,onChange:Q}),(0,U.jsx)(V,{title:m(),rows:$,emptyHint:h(),columns:[{header:_(),cell:e=>M(e.at),sort:e=>e.at},{header:i(),cell:e=>e.action,sort:e=>e.action},{header:y(),cell:e=>e.realLabel,sort:e=>e.realLabel},{header:p(),cell:e=>e.targetLabel??`—`,sort:e=>e.targetLabel??null},{header:S(),cell:e=>e.resource?e.resource+(e.resourceId?` · ${e.resourceId.slice(0,8)}`:``):`—`,sort:e=>e.resource??null}]})]})}export{q as AuditTab};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{c as e,i as t,r as n}from"./bundle-mjs-BJq7W7j9.js";import{$m as r,Ag as i,Ah as a,Bh as o,Bs as s,Cg as c,Ch as l,Ct as u,Dg as d,Dh as f,Eg as p,Eh as m,Fh as ee,Gh as te,Gs as h,Hh as ne,Hs as g,Ih as re,Is as _,Jh as ie,Js as v,Kh as ae,Ks as y,Lh as b,Ls as oe,MM as x,Mh as se,Ms as ce,Nh as le,Oh as ue,Ot as de,Ph as fe,Qm as pe,Rh as me,Rs as he,Sg as ge,Sh as _e,St as ve,Tg as ye,Th as be,Tt as xe,Uh as Se,Us as S,Vh as Ce,Vs as we,Wh as Te,Ws as Ee,Zm as C,_g as De,_h as Oe,ah as ke,bg as Ae,bh as je,c as w,ch as Me,dh as T,eh as Ne,fh as Pe,gg as Fe,gh as Ie,hh as Le,ih as Re,jM as ze,jh as Be,kM as Ve,kg as He,kh as Ue,l as E,lh as We,mh as Ge,nh as Ke,oh as qe,ph as Je,qh as Ye,qs as Xe,rh as Ze,sh as Qe,th as $e,uh as et,vh as tt,wg as nt,wh as rt,wt as it,xg as at,xh as ot,xt as st,yh as ct,zh as lt,zs as ut}from"./dist-Bh78J5oj.js";import{i as D,r as dt}from"./dist-Cj3AsyfP.js";import{t as ft}from"./chevrons-up-down-DWBiHBws.js";import{i as pt,n as O,o as mt,r as ht,s as gt}from"./FieldLabel-B-ZBXJZE.js";import{i as _t,n as vt,r as yt,t as bt}from"./tabs-BQAkx85P.js";import{t as k}from"./button-BWtKy7q6.js";import{At as A,C as j,Kt as M,Nt as N,Q as xt,S as P,X as St,Xt as Ct,Yt as F,Z as wt,b as I,ct as L,dt as Tt,et as Et,ft as Dt,ht as Ot,lt as R,m as kt,mt as At,p as jt,qt as Mt,tt as z,ut as Nt,w as B,x as V,xt as Pt,z as Ft,zt as It}from"./index-BoGVkzmD.js";import{r as Lt}from"./locales-CPjguROj.js";import{a as Rt,i as H,n as zt,o as U,r as W,t as Bt}from"./table-EVqhs7Hw.js";import{t as Vt}from"./FilterBar-CTBZM__z.js";import{a as Ht,n as Ut,o as Wt,r as Gt,s as Kt,t as qt}from"./compatView-Cr1GOQAx.js";import{t as G}from"./dispatchErrorInfo-CmzXtnuL.js";var Jt=E(`refresh-cw`,[[`path`,{d:`M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8`,key:`v9h5vc`}],[`path`,{d:`M21 3v5h-5`,key:`1q7to0`}],[`path`,{d:`M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16`,key:`3uifl3`}],[`path`,{d:`M8 16H3v5`,key:`1cv678`}]]),Yt=E(`wifi-off`,[[`path`,{d:`M12 20h.01`,key:`zekei9`}],[`path`,{d:`M8.5 16.429a5 5 0 0 1 7 0`,key:`1bycff`}],[`path`,{d:`M5 12.859a10 10 0 0 1 5.17-2.69`,key:`1dl1wf`}],[`path`,{d:`M19 12.859a10 10 0 0 0-2.007-1.523`,key:`4k23kn`}],[`path`,{d:`M2 8.82a15 15 0 0 1 4.177-2.643`,key:`1grhjp`}],[`path`,{d:`M22 8.82a15 15 0 0 0-11.288-3.764`,key:`z3jwby`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}]]),K=e(t(),1);function Xt(e){return e.filter(e=>e.state===`error`)}function Zt(e){return e.reachable&&Xt(e.targets).length===0}function Qt(e){return Zt(e)?(e.unreachableInstances??[]).length>0?`gateways_unreachable`:`ok`:`error`}function $t(e){return e.state===`error`&&e.lastErrorCode!==null}function en(e){return!!e.lastDownstreamRejectCode}function q(e){return e.kind??`openclaw`}function tn(e){return[...e].sort((e,t)=>e===`openclaw`?-1:t===`openclaw`?1:e.localeCompare(t))}function nn(e,t,n){let r=new Map;for(let e of t)e.instanceName&&r.set(e.instanceName,e.provider);for(let e of n)r.set(e.name,q(e));let i=e=>(e.instanceName?r.get(e.instanceName):void 0)??`openclaw`,a=new Set;for(let e of n)a.add(q(e));for(let e of t)a.add(e.provider);for(let t of e)a.add(i(t));return tn(a).map(r=>({key:r,connections:e.filter(e=>i(e)===r),compatTargets:t.filter(e=>e.provider===r),instances:n.filter(e=>q(e)===r)}))}function J(e){return e===`openclaw`?`OpenClaw`:e===`hermes`?`Hermes`:e.charAt(0).toUpperCase()+e.slice(1)}var Y=`__all__`,rn={q:``,state:Y,instance:Y,version:Y},X={connected:0,error:1,idle:2};function an(e){return e.q.trim()!==``||e.state!==`__all__`||e.instance!==`__all__`||e.version!==`__all__`}function on(e,t){let n=t.q.trim().toLowerCase();return e.filter(e=>!(n&&!`${e.targetLabel} ${e.gatewayHost}`.toLowerCase().includes(n)||t.state!==`__all__`&&e.state!==t.state||t.instance!==`__all__`&&(e.instanceName??``)!==t.instance||t.version!==`__all__`&&(e.gatewayVersion??``)!==t.version))}function Z(e,t){return e.localeCompare(t,void 0,{numeric:!0,sensitivity:`base`})}function sn(e,t){return e===`version`?t.gatewayVersion===null:e===`lastOk`?t.lastOkAt===null:!1}function cn(e,t,n){switch(e){case`state`:return(X[t.state]??99)-(X[n.state]??99);case`instance`:return Z(t.instanceLabel??t.instanceName??``,n.instanceLabel??n.instanceName??``);case`host`:return Z(t.gatewayHost,n.gatewayHost);case`version`:{let e=t.gatewayVersion,r=n.gatewayVersion;return Wt(e,r)??Z(e,r)}case`lastOk`:return t.lastOkAt-n.lastOkAt;default:return Z(t.targetLabel,n.targetLabel)}}function ln(e,t){if(!t)return e;let n=t.dir===`asc`?1:-1;return[...e].sort((e,r)=>{let i=sn(t.key,e),a=sn(t.key,r);return i&&a?0:i?1:a?-1:n*cn(t.key,e,r)})}function un(e){let t=new Set;for(let n of e)t.add(n.state);return[...t].sort((e,t)=>(X[e]??99)-(X[t]??99))}function dn(e){let t=new Map;for(let n of e)n.instanceName!==null&&(t.has(n.instanceName)||t.set(n.instanceName,n.instanceLabel??n.instanceName));return[...t.entries()].map(([e,t])=>({name:e,label:t})).sort((e,t)=>Z(e.label,t.label))}function fn(e){let t=new Set;for(let n of e)n.gatewayVersion!==null&&t.add(n.gatewayVersion);return[...t].sort((e,t)=>Wt(e,t)??Z(e,t))}var Q=n();function pn({connections:e,displayByInstance:t}){let[n,r]=(0,K.useState)(rn),[i,a]=(0,K.useState)(null),o=(0,K.useMemo)(()=>e.map((e,n)=>({_id:`${e.key}:${e.canonical}/${e.agentId}:${n}`,targetLabel:`${e.canonical}/${e.agentId}`,state:e.state,instanceName:e.instanceName??null,instanceLabel:e.instanceName?t.get(e.instanceName)??e.instanceName:null,gatewayHost:e.gatewayHost,gatewayVersion:e.gatewayVersion??null,okCount:e.okCount,errorCount:e.errorCount+(e.downstreamRejectCount??0),attempts:e.attempts,lastOkAt:e.lastOkAt??null,lastErrorCode:e.lastErrorCode??null,lastErrorAt:e.lastErrorAt??null,lastDownstreamRejectCode:e.lastDownstreamRejectCode??null,lastDownstreamRejectAt:e.lastDownstreamRejectAt??null})),[e,t]),s=(0,K.useMemo)(()=>un(o),[o]),c=(0,K.useMemo)(()=>dn(o),[o]),l=(0,K.useMemo)(()=>fn(o),[o]),u=(0,K.useMemo)(()=>ln(on(o,n),i),[o,n,i]);function d(e){a(t=>t?.key===e?t.dir===`asc`?{key:e,dir:`desc`}:null:{key:e,dir:`asc`})}return e.length===0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:Le()}):(0,Q.jsxs)(`div`,{className:`oc-conn`,children:[(0,Q.jsxs)(Vt,{q:n.q,onQChange:e=>r(t=>({...t,q:e})),searchPlaceholder:Pe(),onReset:()=>r(rn),canReset:an(n),children:[(0,Q.jsxs)(I,{value:n.state,onValueChange:e=>r(t=>({...t,state:e})),children:[(0,Q.jsx)(j,{size:`sm`,className:`w-36`,children:(0,Q.jsx)(B,{placeholder:et()})}),(0,Q.jsxs)(V,{children:[(0,Q.jsx)(P,{value:Y,children:T()}),s.map(e=>(0,Q.jsx)(P,{value:e,children:hn(e)},e))]})]}),(0,Q.jsxs)(I,{value:n.instance,onValueChange:e=>r(t=>({...t,instance:e})),children:[(0,Q.jsx)(j,{size:`sm`,className:`w-40`,children:(0,Q.jsx)(B,{placeholder:We()})}),(0,Q.jsxs)(V,{children:[(0,Q.jsx)(P,{value:Y,children:T()}),c.map(e=>(0,Q.jsx)(P,{value:e.name,children:e.label},e.name))]})]}),(0,Q.jsxs)(I,{value:n.version,onValueChange:e=>r(t=>({...t,version:e})),children:[(0,Q.jsx)(j,{size:`sm`,className:`w-36`,children:(0,Q.jsx)(B,{placeholder:Me()})}),(0,Q.jsxs)(V,{children:[(0,Q.jsx)(P,{value:Y,children:T()}),l.map(e=>(0,Q.jsx)(P,{value:e,children:e},e))]})]})]}),u.length===0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:Qe()}):(0,Q.jsxs)(Bt,{className:`oc-conn__table`,children:[(0,Q.jsx)(Rt,{children:(0,Q.jsxs)(U,{children:[(0,Q.jsx)($,{label:qe(),sortKey:`target`,sort:i,onSort:d}),(0,Q.jsx)($,{label:ke(),sortKey:`state`,sort:i,onSort:d}),(0,Q.jsx)($,{label:Re(),sortKey:`instance`,sort:i,onSort:d}),(0,Q.jsx)($,{label:Ze(),sortKey:`host`,sort:i,onSort:d}),(0,Q.jsx)($,{label:Ke(),sortKey:`version`,sort:i,onSort:d}),(0,Q.jsx)(H,{children:$e()}),(0,Q.jsx)($,{label:Ne(),sortKey:`lastOk`,sort:i,onSort:d})]})}),(0,Q.jsx)(zt,{children:u.map(e=>(0,Q.jsx)(mn,{r:e},e._id))})]})]})}function $({label:e,sortKey:t,sort:n,onSort:r}){let i=n?.key===t,a=i?n.dir:null;return(0,Q.jsx)(H,{"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)(dt,{size:13,"aria-hidden":!0}):(0,Q.jsx)(D,{size:13,"aria-hidden":!0}):(0,Q.jsx)(ft,{size:13,"aria-hidden":!0,className:`oc-conn__sort-idle`})]})})}function mn({r:e}){let t=$t(e)?G(e.lastErrorCode):null,n=en(e)?G(e.lastDownstreamRejectCode):null;return(0,Q.jsxs)(K.Fragment,{children:[(0,Q.jsxs)(U,{className:`oc-conn__row oc-conn__row--${e.state}`,children:[(0,Q.jsx)(W,{children:(0,Q.jsx)(`code`,{className:`oc-traces__mono`,children:e.targetLabel})}),(0,Q.jsx)(W,{children:(0,Q.jsx)(gn,{state:e.state})}),(0,Q.jsx)(W,{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)(W,{children:(0,Q.jsx)(`span`,{className:`oc-bridge-target__host`,children:e.gatewayHost})}),(0,Q.jsx)(W,{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)(W,{children:(0,Q.jsx)(`span`,{className:`oc-conn__stats`,children:Ge({ok:e.okCount,errors:e.errorCount,attempts:e.attempts})})}),(0,Q.jsx)(W,{children:e.lastOkAt?(0,Q.jsx)(`span`,{className:`oc-traces__mono`,children:z(e.lastOkAt)}):(0,Q.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})})]}),t||n?(0,Q.jsx)(U,{className:`oc-conn__detail-row`,children:(0,Q.jsxs)(W,{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?` · ${z(e.lastErrorAt)}`:``,(0,Q.jsx)(`p`,{className:`oc-bridge-card__hint`,children:t.hint})]}):null,n?(0,Q.jsxs)(`div`,{className:`oc-bridge-target__downstream`,children:[Je({label:n.label}),` `,(0,Q.jsx)(`code`,{className:`oc-traces__mono`,children:e.lastDownstreamRejectCode}),e.lastDownstreamRejectAt?` · ${z(e.lastDownstreamRejectAt)}`:``]}):null]})}):null]})}function hn(e){return e===`connected`?r():e===`error`?pe():C()}function gn({state:e}){return e===`connected`?(0,Q.jsx)(L,{variant:`secondary`,children:r()}):e===`error`?(0,Q.jsx)(L,{variant:`destructive`,children:pe()}):(0,Q.jsx)(L,{variant:`outline`,children:C()})}function _n(){return x(w.bridgeHealth.getBridgeHealth,{})}function vn(){let e=_n(),t=x(w.compat.getBridgeCompat,{}),n=x(w.me.getMe,{host:Pt})?.role===`admin`,r=x(w.admin.listInstances,n?{}:`skip`),i=x(w.agents.usageForInstances,n?{}:`skip`),a=F(),o=()=>void a({to:`/settings/anomalies`,search:{status:`open`}}),s=nn(e?e.targets:[],t?t.targets:[],r??[]),{section:c}=Ct({from:`/settings/bridge`}),l=F({from:`/settings/bridge`}),d=t?.compat??null,f=t===void 0?`loading`:t===null?`nodata`:`ready`,p=d!==null&&Ut(d,`hermes`)&&!s.some(e=>e.key===`hermes`);return(0,Q.jsxs)(`div`,{className:`oc-bridge`,children:[(0,Q.jsx)(yn,{health:e,compat:t,onSeeAnomalies:o}),(0,Q.jsx)(`p`,{className:`oc-admin__hint oc-bridge__caption`,children:fe()}),i&&i.length>0?(0,Q.jsxs)(`section`,{className:`oc-bridge__usage`,children:[(0,Q.jsx)(`h3`,{className:`oc-bridge__usage-title`,children:le()}),(0,Q.jsxs)(Bt,{children:[(0,Q.jsx)(Rt,{children:(0,Q.jsxs)(U,{children:[(0,Q.jsx)(H,{children:xe()}),(0,Q.jsx)(H,{children:it()}),(0,Q.jsx)(H,{children:u()}),(0,Q.jsx)(H,{children:ve()}),(0,Q.jsx)(H,{children:st()})]})}),(0,Q.jsx)(zt,{children:i.flatMap(e=>{let t=kt(e.usage,Date.now());return t?t.windows.map((t,n)=>(0,Q.jsxs)(U,{children:[(0,Q.jsx)(W,{className:`font-medium`,children:n===0?e.instanceName:``}),(0,Q.jsx)(W,{children:t.provider}),(0,Q.jsx)(W,{children:t.label}),(0,Q.jsx)(W,{children:(0,Q.jsxs)(L,{variant:t.percentLeft<=10?`destructive`:t.percentLeft<=25?`outline`:`secondary`,children:[t.percentLeft,`%`]})}),(0,Q.jsx)(W,{className:`text-muted-foreground`,children:t.resetText??`—`})]},`${e.instanceName}:${t.provider}:${t.label}`)):[]})})]})]}):null,s.length>0?(0,Q.jsxs)(bt,{value:s.some(e=>e.key===c)?c:s[0]?.key??`openclaw`,onValueChange:e=>void l({search:{section:e},replace:!0}),children:[(0,Q.jsx)(yt,{className:`w-full`,children:s.map(e=>(0,Q.jsxs)(_t,{value:e.key,className:`flex-1 gap-1.5`,children:[(0,Q.jsx)(N,{size:13,"aria-hidden":!0}),J(e.key)]},e.key))}),s.map(e=>(0,Q.jsx)(vt,{value:e.key,children:(0,Q.jsx)(bn,{providerKey:e.key,connections:e.connections,instances:e.instances,manifest:d,compatStatus:f,compatReachable:t?.reachable??!0,protocol:e.key===`openclaw`?t?.protocol??null:null})},e.key))]}):null,p?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:ce()}):null]})}function yn({health:e,compat:t,onSeeAnomalies:n}){let r=t!=null&&t.buildVersion!=null&&t.bridgeVersion!=null&&t.buildVersion!==t.bridgeVersion,i=t?.buildRevision&&t.buildRevision!==`unknown`?t.buildRevision.slice(0,7):null,a=t&&t!==null?(0,Q.jsxs)(`span`,{className:`oc-bridge-card__ver`,children:[(0,Q.jsx)(`code`,{className:`oc-traces__mono`,children:Ht(t.bridgeVersion)}),i?(0,Q.jsxs)(Q.Fragment,{children:[` `,(0,Q.jsxs)(`code`,{className:`oc-traces__mono`,title:y(),children:[`(`,i,`)`]})]}):null,r?(0,Q.jsxs)(`strong`,{className:`oc-bridge-card__mismatch`,children:[` `,h({build:t.buildVersion??`?`})]}):null,` · `,Ee(),` `,(0,Q.jsx)(`code`,{className:`oc-traces__mono`,children:t.protocolVersion===null?S():String(t.protocolVersion)})]}):null;if(e===void 0)return(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:m()});if(e===null)return(0,Q.jsx)(`div`,{className:`oc-bridge-card oc-bridge-card--idle`,children:be()});let o=Xt(e.targets),s=!e.reachable,c=Qt(e),u=e.unreachableInstances??[],d=c===`ok`?`ok`:c===`gateways_unreachable`?`warn`:`error`,f=Et(e.checkedAt),p=e.startedAt==null?null:Et(e.startedAt);return(0,Q.jsxs)(`div`,{className:`oc-bridge-card oc-bridge-card--${d}`,children:[(0,Q.jsx)(`div`,{className:`oc-bridge-card__icon`,"aria-hidden":!0,children:c===`ok`?(0,Q.jsx)(M,{size:22}):s||c===`gateways_unreachable`?(0,Q.jsx)(Yt,{size:22}):(0,Q.jsx)(A,{size:22})}),(0,Q.jsxs)(`div`,{className:`oc-bridge-card__body`,children:[(0,Q.jsx)(`div`,{className:`oc-bridge-card__title`,children:c===`ok`?rt():c===`gateways_unreachable`?je({count:u.length}):s?l():_e({count:o.length})}),(0,Q.jsxs)(`div`,{className:`oc-bridge-card__meta`,children:[(0,Q.jsxs)(`span`,{children:[(0,Q.jsx)(Jt,{size:12,"aria-hidden":!0}),` `,ot({time:f})]}),p?(0,Q.jsx)(`span`,{children:tt({time:p})}):null,a]}),c===`gateways_unreachable`?(0,Q.jsx)(`p`,{className:`oc-bridge-card__hint`,children:ct({names:u.join(`, `)})}):null,s?(0,Q.jsx)(`p`,{className:`oc-bridge-card__hint`,children:G(e.lastError===`not_configured`?`NOT_CONFIGURED`:`BRIDGE_UNREACHABLE`).hint}):null]}),(0,Q.jsx)(`button`,{type:`button`,className:`oc-bridgebar__drill`,onClick:n,children:Oe()})]})}function bn({providerKey:e,connections:t,instances:n,manifest:r,compatStatus:i,compatReachable:a,protocol:o}){let s=r?Kt(r,e):null,c=new Map;for(let e of n)c.set(e.name,e.displayName??e.name);let l=[],u=new Set;for(let n of t){if(!n.instanceName||u.has(n.instanceName))continue;u.add(n.instanceName);let t=n.gatewayVersion??null;l.push({instanceName:n.instanceName,displayName:c.get(n.instanceName)??n.instanceName,version:t,state:qt(t,e,r)})}let d=l.map(e=>e.state),f=d.includes(`beyond`)?`beyond`:d.length>0&&d.every(e=>e===`supported`)?`supported`:null,[p,m]=(0,K.useState)(!1);return(0,Q.jsxs)(`section`,{className:`oc-bridge-provider`,children:[(0,Q.jsxs)(`header`,{className:`oc-bridge-provider__head`,children:[(0,Q.jsx)(N,{size:15,"aria-hidden":!0,className:`oc-bridge-provider__icon`}),(0,Q.jsx)(`span`,{className:`oc-bridge-provider__name`,children:J(e)}),f?(0,Q.jsx)(L,{variant:f===`beyond`?`destructive`:`secondary`,children:Gt(f)}):null]}),(0,Q.jsx)(`h4`,{className:`oc-bridge-provider__sub`,children:v()}),(0,Q.jsx)(Sn,{providerName:J(e),support:s,compatStatus:i,compatReachable:a,manifest:r,instanceRows:l}),o?(0,Q.jsx)(xn,{protocol:o}):null,(0,Q.jsxs)(`button`,{type:`button`,className:`oc-bridge-provider__sub oc-bridge-provider__sub--toggle`,"aria-expanded":p,onClick:()=>m(e=>!e),children:[p?(0,Q.jsx)(D,{size:13,"aria-hidden":!0}):(0,Q.jsx)(Mt,{size:13,"aria-hidden":!0}),Ie({count:t.length})]}),p?(0,Q.jsx)(pn,{connections:t,displayByInstance:c}):null]})}function xn({protocol:e}){let[t,n]=(0,K.useState)(!1),r=e.coverage,i=e.drift??[];return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`h4`,{className:`oc-bridge-provider__sub`,children:[se(),i.length>0?(0,Q.jsx)(L,{variant:`destructive`,children:a({count:i.length})}):(0,Q.jsx)(L,{variant:`secondary`,children:Be()})]}),(0,Q.jsxs)(`p`,{className:`oc-admin__hint`,children:[Ue({version:e.vendoredVersion}),r?` · `+ue({handled:r.handled,ignored:r.ignored,gaps:r.gaps}):null]}),i.length>0?(0,Q.jsx)(`ul`,{className:`oc-bridge-protocol__list`,role:`list`,children:i.map(e=>(0,Q.jsxs)(`li`,{children:[(0,Q.jsx)(`code`,{className:`oc-traces__mono`,children:e.shape}),` × `,e.count]},e.shape))}):null,r&&r.gapList.length>0?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`button`,{type:`button`,className:`oc-bridge-provider__sub oc-bridge-provider__sub--toggle`,"aria-expanded":t,onClick:()=>n(e=>!e),children:[t?(0,Q.jsx)(D,{size:13,"aria-hidden":!0}):(0,Q.jsx)(Mt,{size:13,"aria-hidden":!0}),f({count:r.gapList.length})]}),t?(0,Q.jsx)(`ul`,{className:`oc-bridge-protocol__list`,role:`list`,children:r.gapList.map(e=>(0,Q.jsx)(`li`,{children:(0,Q.jsx)(`code`,{className:`oc-traces__mono`,children:e})},e))}):null]}):null]})}function Sn({support:e,compatStatus:t,compatReachable:n,manifest:r,instanceRows:i,providerName:a}){return t===`loading`?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:m()}):t===`nodata`?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:Xe()}):(0,Q.jsxs)(`div`,{className:`oc-compat`,children:[n?null:(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:g()}),r===null?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:we()}):(0,Q.jsxs)(`div`,{className:`oc-compat__support`,children:[(0,Q.jsx)(`span`,{className:`oc-compat__label`,children:de({provider:a})}),e&&e.range!==null?(0,Q.jsx)(`span`,{children:s({min:e.range.min,max:e.range.maxValidated})}):(0,Q.jsx)(`span`,{children:S()}),e?(0,Q.jsx)(En,{versions:e.validatedVersions}):null]}),i.length===0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:_()}):(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:Ht(e.version)}),(0,Q.jsx)(L,{variant:e.state===`supported`?`secondary`:e.state===`beyond`?`destructive`:`outline`,children:Gt(e.state)})]},e.instanceName))})]})}function Cn({instance:e,onClose:t}){return(0,Q.jsx)(Nt,{open:!0,onOpenChange:e=>!e&&t(),children:(0,Q.jsxs)(Tt,{className:`oc-bridge-config-dialog`,onOpenAutoFocus:e=>e.preventDefault(),children:[(0,Q.jsxs)(At,{children:[(0,Q.jsx)(Ot,{children:i({instance:e.displayName??e.name})}),(0,Q.jsx)(Dt,{children:He()})]}),(0,Q.jsx)(Tn,{instance:e,onClose:t})]})})}function wn({label:e,result:t}){return t?t.checked?(0,Q.jsxs)(`p`,{className:`oc-bridge-config__check-row `+(t.ok?`oc-bridge-config__check-row--ok`:`oc-bridge-config__check-row--err`),children:[t.ok?(0,Q.jsx)(M,{"aria-hidden":!0}):(0,Q.jsx)(A,{"aria-hidden":!0}),(0,Q.jsxs)(`span`,{children:[e,` — `,t.ok?me():t.detail]})]}):(0,Q.jsxs)(`p`,{className:`oc-bridge-config__check-row oc-bridge-config__check-row--skip`,children:[e,` — `,b()]}):null}function Tn({instance:e,onClose:t}){let n=ze(w.admin.upsertInstanceConfig),r=Ve(w.bridge.validateMediaPaths),i=Ft(),a=Lt(e.config?.contentLocale,void 0),[s,l]=(0,K.useState)(()=>pt(e.config??{},a)),[u,f]=(0,K.useState)(!1),[m,h]=(0,K.useState)(!1),[g,_]=(0,K.useState)(null),v=s.inboundMediaMode===`shared-fs`,y=s.mediaMode===`shared-fs`,b=v||y;async function oe(){h(!0),_(null);try{_(await r({instanceName:e.name,inboundMediaMode:s.inboundMediaMode,mediaMode:s.mediaMode}))}catch(e){i.error(ne(),e)}finally{h(!1)}}async function x(){f(!0);try{let r=e.config??{};await n({instanceId:e._id,config:ht(s,r,a)}),t()}catch(e){i.error(ge(),e)}finally{f(!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)(O,{label:d(),help:at()}),(0,Q.jsxs)(I,{value:s.mediaMode,onValueChange:e=>l({...s,mediaMode:e}),children:[(0,Q.jsx)(j,{size:`sm`,className:`w-full`,children:(0,Q.jsx)(B,{})}),(0,Q.jsx)(V,{children:gt.map(e=>(0,Q.jsx)(P,{value:e,children:e},e))})]})]}),(0,Q.jsxs)(`label`,{className:`oc-field`,children:[(0,Q.jsx)(O,{label:p(),help:Ae()}),(0,Q.jsxs)(I,{value:s.inboundMediaMode,onValueChange:e=>l({...s,inboundMediaMode:e}),children:[(0,Q.jsx)(j,{size:`sm`,className:`w-full`,children:(0,Q.jsx)(B,{})}),(0,Q.jsx)(V,{children:mt.map(e=>(0,Q.jsx)(P,{value:e,children:e},e))})]})]}),(0,Q.jsxs)(`label`,{className:`oc-field`,children:[(0,Q.jsx)(O,{label:ye(),help:De()}),(0,Q.jsx)(R,{type:`number`,min:1,max:4096,className:`w-full`,value:s.mediaMaxMb,onChange:e=>l({...s,mediaMaxMb:Math.trunc(Number(e.target.value)||0)})})]})]}),b&&(0,Q.jsxs)(`div`,{className:`oc-bridge-config__grid`,children:[v&&(0,Q.jsxs)(`label`,{className:`oc-field`,children:[(0,Q.jsx)(O,{label:ie(),help:Ye()}),(0,Q.jsx)(R,{className:`w-full`,spellCheck:!1,value:s.inboundAgentMount,onChange:e=>l({...s,inboundAgentMount:e.target.value})})]}),y&&(0,Q.jsxs)(`label`,{className:`oc-field`,children:[(0,Q.jsx)(O,{label:ae(),help:te()}),(0,Q.jsx)(R,{className:`w-full`,spellCheck:!1,value:s.outboundAgentMount,onChange:e=>l({...s,outboundAgentMount:e.target.value})})]})]}),(0,Q.jsxs)(`label`,{className:`oc-field--row`,children:[(0,Q.jsx)(jt,{checked:s.rehydration,onCheckedChange:e=>l({...s,rehydration:e===!0})}),(0,Q.jsx)(O,{label:nt(),help:Fe()})]}),b&&g!==null&&(0,Q.jsx)(`div`,{className:`oc-bridge-config__check`,children:g.reachable?!g.inbound&&!g.outbound?(0,Q.jsxs)(`p`,{className:`oc-bridge-config__check-row oc-bridge-config__check-row--err`,children:[(0,Q.jsx)(A,{"aria-hidden":!0}),ee({reason:g.reason??`?`})]}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(wn,{label:o(),result:g.inbound}),(0,Q.jsx)(wn,{label:lt(),result:g.outbound}),(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:Ce()})]}):(0,Q.jsxs)(`p`,{className:`oc-bridge-config__check-row oc-bridge-config__check-row--err`,children:[(0,Q.jsx)(A,{"aria-hidden":!0}),re()]})}),(0,Q.jsxs)(`div`,{className:`oc-bridge-config__actions`,children:[b&&(0,Q.jsxs)(k,{variant:`outline`,size:`sm`,onClick:()=>void oe(),disabled:m,children:[m?(0,Q.jsx)(It,{className:`size-4 animate-spin`,"aria-hidden":!0}):null,m?Se():Te()]}),(0,Q.jsx)(k,{size:`sm`,onClick:()=>void x(),disabled:u,children:c()})]})]})})}function En({versions:e}){if(e.length===0)return null;let t=[...e].reverse();return(0,Q.jsxs)(St,{children:[(0,Q.jsx)(xt,{asChild:!0,children:(0,Q.jsxs)(`button`,{type:`button`,className:`oc-compat__versions-btn`,children:[e.length===1?ut():he({count:e.length}),(0,Q.jsx)(D,{size:13,"aria-hidden":!0})]})}),(0,Q.jsxs)(wt,{className:`oc-compat__versions-pop`,align:`start`,children:[(0,Q.jsx)(`p`,{className:`oc-compat__versions-title`,children:oe()}),(0,Q.jsx)(`div`,{className:`oc-compat__versions-list`,children:t.map(e=>(0,Q.jsx)(L,{variant:`secondary`,children:e},e))})]})]})}export{vn as BridgeTab,Cn as InstanceConfigDialog};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{c as e,i as t,r as n}from"./bundle-mjs-BJq7W7j9.js";import{$s as r,CM as i,Ci as a,Di as o,Dt as s,Ei as c,MM as l,Nc as u,Og as d,Oi as f,Qs as p,Si as m,Ti as h,Xs as g,Ys as _,Zs as v,_l as y,bi as b,c as x,dl as S,ec as C,hl as w,jM as T,kM as E,ki as D,nc as O,rc as k,tc as A,ul as j,wi as M,xi as N}from"./dist-Bh78J5oj.js";import{t as P}from"./button-BWtKy7q6.js";import{At as F,C as I,S as L,b as R,d as z,f as B,lt as V,p as H,w as U,x as W,y as G}from"./index-BoGVkzmD.js";import{i as K}from"./compatView-Cr1GOQAx.js";/* empty css */var q=e(t(),1),J=[`off`,`minimal`,`low`,`medium`,`high`,`xhigh`];function Y(e){let t=typeof e==`object`&&e?e:{},n=t.defaults!==null&&typeof t.defaults==`object`?t.defaults:{},r=n.thinkingDefault??t.thinkingDefault,i=n.fastModeDefault??t.fastModeDefault;return{thinkingDefault:typeof r==`string`?r:null,fastModeDefault:typeof i==`boolean`?i:null}}var X=n();function Z({instance:e}){let t=T(x.admin.upsertInstanceConfig),n=l(x.agents.listAgentsForInstance,{instanceName:e.name}),r=typeof e.config?.converterAgentId==`string`?e.config.converterAgentId:``,[i,a]=(0,q.useState)(r),[o,s]=(0,q.useState)(`idle`);(0,q.useEffect)(()=>{a(r),s(`idle`)},[e._id,r]);let u=`__none__`,d=i!==r;async function f(){s(`saving`);try{let n={...e.config??{}};i===``||i===u?delete n.converterAgentId:n.converterAgentId=i,await t({instanceId:e._id,config:n}),s(`done`)}catch{s(`error`)}}let p=n?.agents??[];return(0,X.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,X.jsx)(`span`,{className:`oc-cdefaults__label`,children:c()}),(0,X.jsx)(`p`,{className:`oc-admin__hint`,children:h()}),(0,X.jsxs)(`div`,{className:`oc-cdefaults__inline`,children:[(0,X.jsxs)(R,{value:i===``?u:i,onValueChange:e=>a(e===u?``:e),children:[(0,X.jsx)(I,{className:`oc-cdefaults__select`,"aria-label":c(),children:(0,X.jsx)(U,{placeholder:M()})}),(0,X.jsxs)(W,{children:[(0,X.jsx)(L,{value:u,children:M()}),p.map(e=>(0,X.jsx)(L,{value:e.agentId,children:e.displayName?`${e.displayName} (${e.agentId})`:e.agentId},e.agentId))]})]}),(0,X.jsx)(P,{size:`sm`,disabled:!d||o===`saving`,onClick:()=>void f(),children:o===`saving`?y():v()})]}),o===`done`?(0,X.jsx)(`p`,{className:`oc-admin__hint`,role:`status`,children:g()}):null,o===`error`?(0,X.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:_()}):null]})}function Q({instance:e}){let t=T(x.admin.upsertInstanceConfig),n=e.config?.curationEnabled===!0,r=typeof e.config?.curationBudgetChars==`number`?e.config.curationBudgetChars:null,[i,s]=(0,q.useState)(n),[c,l]=(0,q.useState)(r===null?``:String(r)),[u,d]=(0,q.useState)(`idle`);(0,q.useEffect)(()=>{s(n),l(r===null?``:String(r)),d(`idle`)},[e._id,n,r]);let f=c.trim(),p=f===``?null:/^\d+$/.test(f)?Number.parseInt(f,10):NaN,h=!i||p===null||Number.isInteger(p)&&p>=4e3&&p<=6e4,b=i!==n||(p??null)!==r;async function S(){d(`saving`);try{let n={...e.config??{}};n.curationEnabled=i,!i||p===null||Number.isNaN(p)?delete n.curationBudgetChars:n.curationBudgetChars=p,await t({instanceId:e._id,config:n}),d(`done`)}catch{d(`error`)}}return(0,X.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,X.jsxs)(`label`,{className:`oc-cdefaults__inline`,style:{cursor:`pointer`},children:[(0,X.jsx)(H,{checked:i,onCheckedChange:e=>s(e===!0),"aria-label":o()}),(0,X.jsx)(`span`,{className:`oc-cdefaults__label`,children:o()})]}),(0,X.jsxs)(`div`,{className:`oc-cdefaults__inline`,children:[(0,X.jsx)(V,{type:`number`,min:4e3,max:6e4,step:1e3,placeholder:`20000`,value:c,onChange:e=>l(e.target.value),className:`oc-cdefaults__number`,"aria-invalid":!h,"aria-label":a(),disabled:!i}),(0,X.jsx)(P,{size:`sm`,disabled:!b||!h||u===`saving`,onClick:()=>void S(),children:u===`saving`?y():v()})]}),h?null:(0,X.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:m()}),u===`done`?(0,X.jsx)(`p`,{className:`oc-admin__hint`,role:`status`,children:g()}):null,u===`error`?(0,X.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:_()}):null,(0,X.jsx)(`p`,{className:`oc-cdefaults__help`,children:N()})]})}function $({instance:e}){let t=T(x.admin.upsertInstanceConfig),n=typeof e.config?.summarizeThresholdChars==`number`?e.config.summarizeThresholdChars:null,[r,i]=(0,q.useState)(n===null?``:String(n)),[a,o]=(0,q.useState)(`idle`);(0,q.useEffect)(()=>{i(n===null?``:String(n)),o(`idle`)},[e._id,n]);let s=r.trim(),c=s===``?null:/^\d+$/.test(s)?Number.parseInt(s,10):NaN,l=c===null||Number.isInteger(c)&&c>=1e3&&c<=2e5,u=(c??null)!==n;async function d(){o(`saving`);try{let n={...e.config??{}};c===null?delete n.summarizeThresholdChars:n.summarizeThresholdChars=c,await t({instanceId:e._id,config:n}),o(`done`)}catch{o(`error`)}}return(0,X.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,X.jsx)(`span`,{className:`oc-cdefaults__label`,children:D()}),(0,X.jsxs)(`div`,{className:`oc-cdefaults__inline`,children:[(0,X.jsx)(V,{type:`number`,min:1e3,max:2e5,step:1e3,placeholder:`8000`,value:r,onChange:e=>i(e.target.value),className:`oc-cdefaults__number`,"aria-invalid":!l}),(0,X.jsx)(P,{size:`sm`,disabled:!u||!l||a===`saving`,onClick:()=>void d(),children:a===`saving`?y():v()})]}),l?null:(0,X.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:b()}),a===`done`?(0,X.jsx)(`p`,{className:`oc-admin__hint`,role:`status`,children:g()}):null,a===`error`?(0,X.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:_()}):null,(0,X.jsx)(`p`,{className:`oc-cdefaults__help`,children:f()})]})}function ee(){let e=E(x.agentFiles.getChatDefaults),[t,n]=(0,q.useState)({status:`loading`}),a=l(x.admin.listInstances,{}),[o,c]=(0,q.useState)(null);(0,q.useEffect)(()=>{!a||a.length===0||(!o||!a.some(e=>e.name===o))&&c(a[0].name)},[a,o]);let f=(a?.length??0)>1,m=a!==void 0&&a.length===0,h=l(x.compat.forInstance,o?{instanceName:o}:`skip`),g=o?G(h,`configDefaults`):`loading`,_=g===`loading`?null:g.blocked,v=(0,q.useMemo)(()=>f&&o?{instanceName:o}:{},[f,o]),y=(0,q.useRef)(0),b=(0,q.useCallback)(async()=>{let t=++y.current;n({status:`loading`});try{let r=Y(await e(v));if(y.current!==t)return;n({status:`done`,current:r})}catch{if(y.current!==t)return;n({status:`error`})}},[e,v]);(0,q.useEffect)(()=>{_===!1&&(f&&!o||b())},[b,_,f,o]);let T=t.status===`done`?t.current:null,D=(0,q.useMemo)(()=>J.map(e=>({id:e,label:B(e)})),[]),M=(0,q.useMemo)(()=>[{id:`fast`,label:S()},{id:`standard`,label:j()}],[]);return(0,X.jsxs)(`div`,{className:`oc-cdefaults`,children:[(0,X.jsx)(`p`,{className:`oc-admin__hint`,children:k()}),f&&o?(0,X.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,X.jsx)(`span`,{className:`oc-cdefaults__label`,children:u()}),(0,X.jsxs)(R,{value:o,onValueChange:e=>c(e),children:[(0,X.jsx)(I,{size:`sm`,"aria-label":u(),children:(0,X.jsx)(U,{})}),(0,X.jsx)(W,{children:(a??[]).map(e=>(0,X.jsx)(L,{value:e.name,children:e.name},e.name))})]})]}):null,m?(0,X.jsx)(`p`,{className:`oc-admin__hint`,role:`status`,children:d()}):g===`loading`?(0,X.jsx)(`p`,{className:`oc-admin__hint`,children:i()}):g.blocked?(0,X.jsxs)(`p`,{className:`oc-compat__blocked`,role:`status`,children:[(0,X.jsx)(F,{size:14,"aria-hidden":!0}),` `,K(g.gatewayVersion,g.provider)]}):t.status===`loading`?(0,X.jsx)(`p`,{className:`oc-admin__hint`,children:i()}):t.status===`error`?(0,X.jsxs)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:[p(),` `,(0,X.jsx)(P,{variant:`outline`,size:`sm`,onClick:()=>void b(),children:w()})]}):(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,X.jsx)(`span`,{className:`oc-cdefaults__label`,children:O()}),(0,X.jsx)(z,{options:D,value:T?.thinkingDefault??null,onChange:()=>{},disabled:!0}),(0,X.jsx)(`p`,{className:`oc-cdefaults__help`,children:A()})]}),(0,X.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,X.jsx)(`span`,{className:`oc-cdefaults__label`,children:C()}),(0,X.jsx)(z,{options:M,value:T===null||T.fastModeDefault===null?null:T.fastModeDefault?`fast`:`standard`,onChange:()=>{},disabled:!0}),(0,X.jsx)(`p`,{className:`oc-cdefaults__help`,children:r()})]}),(0,X.jsx)(`p`,{className:`oc-cdefaults__note`,children:s()})]}),(()=>{let e=a?.find(e=>e.name===(o??a[0]?.name));return e?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)($,{instance:e}),(0,X.jsx)(Q,{instance:e}),(0,X.jsx)(Z,{instance:e})]}):null})()]})}export{ee as ChatDefaultsTab};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{c as e,i as t,r as n}from"./bundle-mjs-BJq7W7j9.js";import{$j as r,Aj as i,Bj as a,CM as ee,Cj as te,Dj as ne,Ej as o,Fj as re,Gj as s,Gr as c,Hj as l,Ij as ie,Jj as u,Kj as d,Lj as ae,MM as oe,Mj as se,Nj as ce,Oj as le,Pj as ue,Qj as de,Rj as fe,Sj as pe,TM as me,Tj as he,Uj as f,Vj as p,WE as ge,Wj as m,Wr as _e,Xj as ve,Yj as ye,Zj as be,c as h,eM as g,jM as xe,jj as Se,kj as _,nM as v,qj as y,rM as b,tM as x,wj as S,zj as C}from"./dist-Bh78J5oj.js";import{t as w}from"./button-BWtKy7q6.js";import{C as T,Ft as E,G as D,H as O,Ht as k,J as A,K as j,S as M,U as Ce,Ut as N,W as we,Y as Te,b as P,ct as F,it as I,jt as Ee,nt as De,p as Oe,q as ke,rt as Ae,st as je,w as L,x as R,z as Me}from"./index-BoGVkzmD.js";import{a as Ne,i as z,n as Pe,o as B,r as V,t as Fe}from"./table-EVqhs7Hw.js";var H=e(t(),1),U=n(),W=`all`;function G(e){switch(e){case`image`:return d();case`audio`:return s();case`video`:return m();case`pdf`:return f();case`document`:return l();case`archive`:return p();default:return a()}}function K(){let[e,t]=(0,H.useState)(W),[n,a]=(0,H.useState)(W),[s,l]=(0,H.useState)(W),[d,f]=(0,H.useState)(W),[p,m]=(0,H.useState)(!1),[K,q]=(0,H.useState)(null),J=xe(h.files.softDelete),Y=Me();function Ie(){t(W),a(W),l(W),f(W)}async function Le(){let e=K;if(q(null),e)try{await J({fileId:e.id}),Y.success(_())}catch(e){Y.error(le(),e)}}let X=oe(h.files.listMine,{direction:e===W?void 0:e,chatId:n===W?void 0:n,instanceName:s===W?void 0:s,category:d===W?void 0:d,includeAutoGenerated:p||void 0}),Re=(0,H.useMemo)(()=>new Intl.DateTimeFormat(me(),{dateStyle:`medium`,timeStyle:`short`}),[]);if(X===void 0)return(0,U.jsx)(`p`,{className:`oc-admin__hint`,children:ee()});let{files:Z,facets:Q,truncated:ze,cap:Be}=X,$=e!==W||n!==W||s!==W||d!==W;return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`p`,{className:`oc-admin__hint`,children:b()}),(0,U.jsxs)(`div`,{className:`oc-files__filters`,style:{display:`flex`,flexWrap:`wrap`,gap:8,margin:`12px 0`},children:[(0,U.jsxs)(P,{value:e,onValueChange:t,children:[(0,U.jsx)(T,{size:`sm`,"aria-label":v(),children:(0,U.jsx)(L,{})}),(0,U.jsxs)(R,{children:[(0,U.jsx)(M,{value:W,children:x()}),(0,U.jsx)(M,{value:`inbound`,children:g()}),(0,U.jsx)(M,{value:`outbound`,children:r()})]})]}),(0,U.jsxs)(P,{value:n,onValueChange:a,children:[(0,U.jsx)(T,{size:`sm`,"aria-label":de(),children:(0,U.jsx)(L,{})}),(0,U.jsxs)(R,{children:[(0,U.jsx)(M,{value:W,children:be()}),Q.chats.map(e=>(0,U.jsx)(M,{value:e.id,children:e.title},e.id))]})]}),Q.multiProvider?(0,U.jsxs)(P,{value:s,onValueChange:l,children:[(0,U.jsx)(T,{size:`sm`,"aria-label":ve(),children:(0,U.jsx)(L,{})}),(0,U.jsxs)(R,{children:[(0,U.jsx)(M,{value:W,children:ye()}),Q.instances.map(e=>(0,U.jsx)(M,{value:e,children:e},e))]})]}):null,(0,U.jsxs)(P,{value:d,onValueChange:f,children:[(0,U.jsx)(T,{size:`sm`,"aria-label":u(),children:(0,U.jsx)(L,{})}),(0,U.jsxs)(R,{children:[(0,U.jsx)(M,{value:W,children:y()}),Q.categories.map(e=>(0,U.jsx)(M,{value:e,children:G(e)},e))]})]}),(0,U.jsxs)(`label`,{className:`oc-files__autogen`,children:[(0,U.jsx)(Oe,{checked:p,onCheckedChange:e=>m(e===!0),"aria-label":c()}),(0,U.jsx)(`span`,{children:c()})]}),$?(0,U.jsxs)(w,{variant:`ghost`,size:`sm`,onClick:Ie,style:{display:`inline-flex`,alignItems:`center`,gap:4,marginLeft:`auto`},children:[(0,U.jsx)(E,{size:14,"aria-hidden":!0}),se()]}):null]}),Z.length===0?(0,U.jsx)(`p`,{className:`oc-admin__hint`,children:$?te():S()}):(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(Fe,{children:[(0,U.jsx)(Ne,{children:(0,U.jsxs)(B,{children:[(0,U.jsx)(z,{children:C()}),(0,U.jsx)(z,{children:fe()}),(0,U.jsx)(z,{children:ae()}),(0,U.jsx)(z,{children:ie()}),(0,U.jsx)(z,{children:re()}),(0,U.jsx)(z,{className:`text-right`,children:ue()})]})}),(0,U.jsx)(Pe,{children:Z.map(e=>(0,U.jsxs)(B,{children:[(0,U.jsxs)(V,{className:`font-medium`,style:{maxWidth:280,overflow:`hidden`,textOverflow:`ellipsis`},title:e.filename,children:[e.filename,e.origin===`pasted`?(0,U.jsx)(F,{variant:`outline`,style:{marginLeft:6},children:_e()}):null]}),(0,U.jsx)(V,{title:e.mimeType,children:G(e.category)}),(0,U.jsx)(V,{children:(0,U.jsx)(F,{variant:`secondary`,children:e.direction===`inbound`?g():r()})}),(0,U.jsx)(V,{style:{maxWidth:220,overflow:`hidden`,textOverflow:`ellipsis`},title:e.chatTitle,children:e.chatTitle}),(0,U.jsx)(V,{className:`whitespace-nowrap text-muted-foreground`,children:Re.format(e.createdAt)}),(0,U.jsx)(V,{className:`text-right`,children:(0,U.jsxs)(De,{children:[(0,U.jsx)(je,{asChild:!0,children:(0,U.jsx)(w,{variant:`ghost`,size:`icon`,"aria-label":Se(),children:(0,U.jsx)(k,{size:16})})}),(0,U.jsxs)(Ae,{align:`end`,children:[e.url?(0,U.jsx)(I,{asChild:!0,children:(0,U.jsxs)(`a`,{href:e.url,download:e.filename,target:`_blank`,rel:`noopener noreferrer`,children:[(0,U.jsx)(N,{size:14}),ce()]})}):(0,U.jsxs)(I,{disabled:!0,children:[(0,U.jsx)(N,{size:14}),he()]}),(0,U.jsxs)(I,{variant:`destructive`,onSelect:()=>q({id:e._id,filename:e.filename}),children:[(0,U.jsx)(Ee,{size:14}),i()]})]})]})})]},e._id))})]}),ze?(0,U.jsx)(`p`,{className:`oc-admin__hint`,style:{marginTop:8},children:pe({cap:Be})}):null]}),(0,U.jsx)(O,{open:K!==null,onOpenChange:e=>!e&&q(null),children:(0,U.jsxs)(D,{children:[(0,U.jsxs)(A,{children:[(0,U.jsx)(Te,{children:ne()}),(0,U.jsx)(j,{children:o()})]}),(0,U.jsxs)(ke,{children:[(0,U.jsx)(we,{children:ge()}),(0,U.jsx)(Ce,{onClick:()=>void Le(),children:i()})]})]})})]})}export{K as FilesTab};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{c as e,i as t,r as n}from"./bundle-mjs-BJq7W7j9.js";import{$l as r,Al as i,Au as a,Bl as o,Cu as s,Du as c,Eu as l,Fl as u,Fu as d,Gl as f,Hl as p,Il as m,Iu as h,Jl as g,Kl as _,Ll as v,Lu as y,MM as b,Ml as x,Mu as S,Nl as C,Nu as ee,Ou as w,Pl as T,Pu as E,Ql as D,Rl as O,Ru as k,Su as A,Tu as te,Ul as ne,Vl as j,Wl as M,Xl as N,Yl as P,Zl as re,_u as F,au as ie,bu as I,c as L,cu as ae,du as oe,eu as se,fu as ce,gu as le,hu as ue,iu as de,jM as R,jl as fe,ju as pe,kl as me,ku as he,l as z,lu as B,mu as ge,nu as _e,ou as ve,pu as ye,ql as be,ru as xe,su as Se,tu as Ce,uu as we,vu as Te,wu as Ee,xu as De,yu as Oe,zl as ke}from"./dist-Bh78J5oj.js";import{t as Ae}from"./x-Dj2c0suA.js";import{i as V,n as H,r as je,t as Me}from"./tabs-BQAkx85P.js";import{t as U}from"./button-BWtKy7q6.js";import{B as Ne,C as Pe,Jt as Fe,Mt as W,Nt as G,S as Ie,b as Le,ct as K,dt as Re,ft as ze,ht as Be,lt as q,mt as Ve,p as J,qt as He,u as Ue,ut as We,w as Ge,x as Ke,xt as qe,z as Y}from"./index-BoGVkzmD.js";import{t as Je}from"./FilterBar-CTBZM__z.js";import{t as Ye}from"./DataTableShell-DTw-rOw3.js";import{t as X}from"./DetailChips-BviEGC5c.js";var Xe=z(`palette`,[[`path`,{d:`M12 22a1 1 0 0 1 0-20 10 9 0 0 1 10 9 5 5 0 0 1-5 5h-2.25a1.75 1.75 0 0 0-1.4 2.8l.3.4a1.75 1.75 0 0 1-1.4 2.8z`,key:`e79jfc`}],[`circle`,{cx:`13.5`,cy:`6.5`,r:`.5`,fill:`currentColor`,key:`1okk4w`}],[`circle`,{cx:`17.5`,cy:`10.5`,r:`.5`,fill:`currentColor`,key:`f64h9f`}],[`circle`,{cx:`6.5`,cy:`12.5`,r:`.5`,fill:`currentColor`,key:`qy21gx`}],[`circle`,{cx:`8.5`,cy:`7.5`,r:`.5`,fill:`currentColor`,key:`fotxhn`}]]),Z=z(`shield-check`,[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`,key:`oel41y`}],[`path`,{d:`m9 12 2 2 4-4`,key:`dzmm74`}]]),Ze=z(`users`,[[`path`,{d:`M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2`,key:`1yyitq`}],[`path`,{d:`M16 3.128a4 4 0 0 1 0 7.744`,key:`16gr8j`}],[`path`,{d:`M22 21v-2a4 4 0 0 0-3-3.87`,key:`kshegd`}],[`circle`,{cx:`9`,cy:`7`,r:`4`,key:`nufk8`}]]),Q=e(t(),1);function Qe(e,t,n){let r=t.trim().toLowerCase();return[...r?e.filter(e=>[e.email,e.name,e.canonical].some(e=>e!=null&&e.toLowerCase().includes(r))):e.slice()].sort((e,t)=>!n.has(e.userId)-+!n.has(t.userId))}function $e(e,t){let n=e.filter(e=>e.source===`discovered`),r=t.trim().toLowerCase();return r?n.filter(e=>(e.displayName??e.agentId).toLowerCase().includes(r)||e.agentId.toLowerCase().includes(r)):n}function et(e){let t=e.name?.trim()??``,n=e.email?.trim()??``,r=e.canonical?.trim()||`u-${e.userId.slice(0,8)}`;return t?{primary:t,secondary:n||`@${r}`}:n?{primary:n,secondary:null}:{primary:`@${r}`,secondary:null}}function tt(e){switch(e){case`admin`:return ie();case`user`:return de();case`pending`:return xe();default:return e}}function nt(e,t){if(e.length===0)return`none`;let n=0;for(let r of e)t(r)&&n++;return n===0?`none`:n===e.length?`all`:`some`}function rt(e,t,n){let r=Math.max(1,Math.ceil(e.length/n)),i=Math.min(Math.max(1,Math.floor(t)),r),a=(i-1)*n;return{pageItems:e.slice(a,a+n),page:i,pageCount:r}}var $=n(),it={name:``,description:``};function at(){let e=b(L.groups.listGroups,{}),t=b(L.me.getMe,{host:qe})?.role===`admin`,n=R(L.groups.createGroup),r=R(L.groups.updateGroup),i=R(L.groups.deleteGroup),o=Ne(),u=Y(),[f,p]=(0,Q.useState)(!1),[m,g]=(0,Q.useState)(null),[_,v]=(0,Q.useState)(it),[C,T]=(0,Q.useState)(null),[D,O]=(0,Q.useState)(``),ne=(0,Q.useMemo)(()=>{if(!e)return e;let t=D.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,D]);function j(){g(null),v(it),p(!0)}function M(e){g(e),v({name:e.name,description:e.description??``}),p(!0)}async function N(){try{m?await r({groupId:m._id,name:_.name,description:_.description}):await n({name:_.name,description:_.description||void 0}),v(it),g(null),p(!1)}catch(e){u.error(x(),e)}}async function P(e){if(await o({title:Oe({name:e.name}),description:Te(),confirmWord:e.name,confirmLabel:F(),cancelLabel:te(),destructive:!0}))try{await i({groupId:e._id})}catch(e){u.error(fe(),e)}}return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`p`,{className:`oc-admin__hint`,children:y()}),(0,$.jsx)(Je,{q:D,onQChange:O,onReset:()=>O(``),canReset:D!==``,searchPlaceholder:a()}),(0,$.jsx)(Ye,{title:k(),rows:ne,addLabel:h(),onAdd:t?j:void 0,emptyHint:d(),columns:[{header:E(),cell:e=>e.name,sort:e=>e.name},{header:ee(),cell:e=>(0,$.jsx)(X,{icon:(0,$.jsx)(Ze,{size:12,"aria-hidden":!0}),total:e.memberCount,items:e.members.map(e=>({label:e.label,marker:e.manager?(0,$.jsx)(Z,{size:11,"aria-hidden":!0}):null,highlight:e.manager}))}),sort:e=>e.memberCount},{header:S(),cell:e=>(0,$.jsx)(X,{icon:(0,$.jsx)(G,{size:12,"aria-hidden":!0}),total:e.agentCount,items:e.agents.map(e=>({label:e}))}),sort:e=>e.agentCount},{header:pe(),cell:e=>(0,$.jsx)(X,{icon:(0,$.jsx)(Xe,{size:12,"aria-hidden":!0}),total:e.chartCount,items:e.charts.map(e=>({label:e.name,marker:e.isDefault?(0,$.jsx)(W,{size:11,fill:`currentColor`,"aria-hidden":!0}):null,highlight:e.isDefault}))}),sort:e=>e.chartCount}],rowActions:e=>[{label:he(),onSelect:()=>T({groupId:e._id,name:e.name})},...t?[{label:w(),onSelect:()=>M(e)},{label:c(),variant:`destructive`,onSelect:()=>void P(e)}]:[]]}),(0,$.jsx)(Ue,{open:f,onOpenChange:p,title:m?s():Ee(),description:A(),canSubmit:!!_.name.trim(),onSubmit:N,submitLabel:l(),children:(0,$.jsxs)(`div`,{className:`oc-form`,children:[(0,$.jsxs)(`label`,{className:`oc-field`,children:[(0,$.jsx)(`span`,{className:`oc-field__label`,children:De()}),(0,$.jsx)(q,{value:_.name,onChange:e=>v({..._,name:e.target.value})})]}),(0,$.jsxs)(`label`,{className:`oc-field`,children:[(0,$.jsx)(`span`,{className:`oc-field__label`,children:I()}),(0,$.jsx)(q,{value:_.description,onChange:e=>v({..._,description:e.target.value})})]})]})}),(0,$.jsx)(ct,{groupId:C?.groupId??null,groupName:C?.name??``,open:C!==null,onOpenChange:e=>{e||T(null)}})]})}var ot=8;function st({page:e,pageCount:t,onPage:n}){return t<=1?null:(0,$.jsxs)(`div`,{className:`oc-access__pager`,children:[(0,$.jsxs)(U,{type:`button`,variant:`ghost`,size:`sm`,disabled:e<=1,onClick:()=>n(e-1),children:[(0,$.jsx)(Fe,{size:14,"aria-hidden":!0}),ae()]}),(0,$.jsxs)(`span`,{className:`oc-access__pageinfo`,"aria-label":ve({page:e,pages:t}),children:[e,` / `,t]}),(0,$.jsxs)(U,{type:`button`,variant:`ghost`,size:`sm`,disabled:e>=t,onClick:()=>n(e+1),children:[Se(),(0,$.jsx)(He,{size:14,"aria-hidden":!0})]})]})}function ct({groupId:e,groupName:t,open:n,onOpenChange:r}){let a=b(L.groups.getGroup,n&&e?{groupId:e}:`skip`),o=b(L.groups.listAssignableInstances,n?{}:`skip`),s=b(L.groups.listAssignableUsers,n?{}:`skip`),c=R(L.groups.addMember),l=R(L.groups.removeMember),d=R(L.groups.bulkSetMembers),p=R(L.groups.setGroupManager),h=Y(),[g,_]=(0,Q.useState)(``),[y,x]=(0,Q.useState)(``),[S,C]=(0,Q.useState)(`members`),[ee,w]=(0,Q.useState)(1),[E,O]=(0,Q.useState)(new Set),k=(0,Q.useRef)(null),A=(0,Q.useMemo)(()=>new Set((a?.members??[]).map(e=>e.userId)),[a]),te=(0,Q.useMemo)(()=>new Set((a?.members??[]).filter(e=>e.manager).map(e=>e.userId)),[a]),ne=a?.viewerIsAdmin===!0,j=(0,Q.useMemo)(()=>new Set((a?.agents??[]).map(e=>`${e.instanceName}/${e.agentId}`)),[a]);(0,Q.useEffect)(()=>{_(``),x(``),C(`members`),w(1),k.current=null},[n,e]),(0,Q.useEffect)(()=>{w(1)},[g]),(0,Q.useEffect)(()=>{n&&a&&e&&k.current!==e&&(k.current=e,O(new Set((a.members??[]).map(e=>e.userId))))},[n,a,e]);let M=(0,Q.useMemo)(()=>s?Qe(s,g,E):[],[s,g,E]);async function N(t,n){if(e)try{n?await l({groupId:e,userId:t}):await c({groupId:e,userId:t})}catch(e){h.error(i(),e)}}async function P(t,n){if(e)try{await p({groupId:e,userId:t,manager:!n})}catch(e){h.error(T(),e)}}let F=nt(M,e=>A.has(e.userId)),ie=M.filter(e=>A.has(e.userId)).length,I=rt(M,ee,ot);async function ae(){if(!e||M.length===0)return;let t=M.map(e=>e.userId);try{await d({groupId:e,userIds:t,member:F!==`all`})}catch(e){h.error(i(),e)}}return(0,$.jsx)(We,{open:n,onOpenChange:r,children:(0,$.jsxs)(Re,{className:`oc-access`,children:[(0,$.jsxs)(Ve,{children:[(0,$.jsx)(Be,{children:le({name:t})}),(0,$.jsx)(ze,{children:ue()})]}),(0,$.jsxs)(Me,{value:S,onValueChange:C,className:`oc-access__tabs`,children:[(0,$.jsxs)(je,{className:`w-full`,children:[(0,$.jsxs)(V,{value:`members`,className:`flex-1 gap-1.5`,children:[(0,$.jsx)(Ze,{size:13,"aria-hidden":!0}),ge(),a?(0,$.jsx)(K,{variant:`secondary`,className:`oc-access__tabcount`,children:A.size}):null]}),(0,$.jsxs)(V,{value:`agents`,className:`flex-1 gap-1.5`,children:[(0,$.jsx)(G,{size:13,"aria-hidden":!0}),ce(),a?(0,$.jsx)(K,{variant:`secondary`,className:`oc-access__tabcount`,children:j.size}):null]}),(0,$.jsxs)(V,{value:`charts`,className:`flex-1 gap-1.5`,children:[(0,$.jsx)(Xe,{size:13,"aria-hidden":!0}),f(),a?(0,$.jsx)(K,{variant:`secondary`,className:`oc-access__tabcount`,children:a.chartCount}):null]})]}),(0,$.jsx)(H,{value:`members`,children:s===void 0||a===void 0?(0,$.jsx)(`p`,{className:`oc-access__hint`,children:se()}):s.length===0?(0,$.jsx)(`p`,{className:`oc-access__hint`,children:D()}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(q,{value:g,onChange:e=>_(e.target.value),placeholder:ye(),className:`oc-access__search`}),M.length===0?(0,$.jsx)(`p`,{className:`oc-access__hint`,children:we()}):(0,$.jsxs)($.Fragment,{children:[M.length>1?(0,$.jsxs)(`div`,{className:`oc-access__row oc-access__selectall`,children:[(0,$.jsx)(J,{checked:F===`all`?!0:F===`some`?`indeterminate`:!1,onCheckedChange:()=>void ae(),"aria-label":B()}),(0,$.jsx)(`span`,{className:`oc-access__label`,children:B()}),(0,$.jsxs)(K,{variant:`outline`,className:`oc-access__count`,children:[ie,` / `,M.length]})]}):null,(0,$.jsx)(`div`,{className:`oc-access__list`,children:I.pageItems.map(e=>{let t=A.has(e.userId),n=et(e),r=te.has(e.userId);return(0,$.jsxs)(`div`,{className:`oc-access__row`,children:[(0,$.jsx)(J,{checked:t,onCheckedChange:()=>void N(e.userId,t),"aria-label":_e({user:n.primary})}),(0,$.jsxs)(`span`,{className:`oc-access__who`,children:[(0,$.jsx)(`span`,{className:`oc-access__label`,title:n.primary,children:n.primary}),n.secondary?(0,$.jsx)(`span`,{className:`oc-access__sub`,title:n.secondary,children:n.secondary}):null]}),(0,$.jsx)(K,{variant:`outline`,className:`oc-access__role`,children:tt(e.role)}),(0,$.jsx)(`span`,{className:`oc-access__mgrslot`,children:t&&ne?(0,$.jsx)(U,{type:`button`,variant:`ghost`,size:`icon`,className:`shrink-0 oc-access__mgr${r?` oc-access__mgr--on`:``}`,"aria-pressed":r,"aria-label":r?u():m(),title:r?u():m(),onClick:()=>void P(e.userId,r),children:(0,$.jsx)(Z,{size:15,"aria-hidden":!0})}):t&&r?(0,$.jsx)(`span`,{className:`oc-access__mgr oc-access__mgr--on`,role:`img`,"aria-label":v(),title:v(),children:(0,$.jsx)(Z,{size:15,"aria-hidden":!0})}):null})]},e._id)})}),(0,$.jsx)(st,{page:I.page,pageCount:I.pageCount,onPage:w})]})]})}),(0,$.jsx)(H,{value:`agents`,children:o===void 0?(0,$.jsx)(`p`,{className:`oc-access__hint`,children:se()}):o.length===0?(0,$.jsx)(`p`,{className:`oc-access__hint`,children:re()}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(q,{value:y,onChange:e=>x(e.target.value),placeholder:oe(),className:`oc-access__search`}),(0,$.jsx)(`div`,{className:`oc-access__list`,children:o.map(t=>(0,$.jsx)(lt,{groupId:e,instanceName:t.name,kind:t.kind??`openclaw`,assigned:j,query:y},`${e}-${t._id}`))})]})}),(0,$.jsx)(H,{value:`charts`,children:(0,$.jsx)(ut,{groupId:e})})]})]})})}function lt({groupId:e,instanceName:t,kind:n,assigned:i,query:a}){let o=b(L.groups.listAssignableAgents,{instanceName:t}),s=R(L.groups.assignAgentToGroup),c=R(L.groups.removeAgentFromGroup),l=R(L.groups.bulkSetGroupAgents),u=Y(),[d,f]=(0,Q.useState)(1);if((0,Q.useEffect)(()=>{f(1)},[a]),!e)return null;let p=$e(o?.agents??[],a),m=o?.discovery&&!o.discovery.lastPollOk;if(a.trim()&&p.length===0)return null;let h=p.filter(e=>e.presentInLastOk!==!1&&e.enabled!==!1),v=nt(h,e=>i.has(`${t}/${e.agentId}`)),y=rt(p,d,ot);async function x(n,r){try{r?await c({groupId:e,instanceName:t,agentId:n}):await s({groupId:e,instanceName:t,agentId:n})}catch(e){u.error(me(),e)}}async function S(){if(h.length===0)return;let n=h.map(e=>e.agentId);try{await l({groupId:e,instanceName:t,agentIds:n,assigned:v!==`all`})}catch(e){u.error(me(),e)}}return(0,$.jsxs)(`div`,{className:`oc-access__group`,children:[(0,$.jsxs)(`div`,{className:`oc-access__instance`,children:[(0,$.jsx)(G,{size:13,"aria-hidden":!0}),(0,$.jsx)(`span`,{children:t}),(0,$.jsx)(K,{variant:`outline`,className:`oc-access__kind`,children:n}),m?(0,$.jsx)(K,{variant:`outline`,className:`oc-access__stale`,children:g()}):null]}),o===void 0?(0,$.jsx)(`p`,{className:`oc-access__hint`,children:r()}):p.length===0?(0,$.jsx)(`p`,{className:`oc-access__hint`,children:m?P():N()}):(0,$.jsxs)($.Fragment,{children:[h.length>1?(0,$.jsxs)(`div`,{className:`oc-access__row oc-access__selectall`,children:[(0,$.jsx)(J,{checked:v===`all`?!0:v===`some`?`indeterminate`:!1,onCheckedChange:()=>void S(),"aria-label":B()}),(0,$.jsx)(`span`,{className:`oc-access__label`,children:B()})]}):null,y.pageItems.map(e=>{let n=`${t}/${e.agentId}`,r=i.has(n),a=e.presentInLastOk===!1,o=!e.enabled;return(0,$.jsxs)(`div`,{className:`oc-access__row${o?` is-disabled`:``}`,children:[(0,$.jsx)(J,{checked:r,disabled:(a||o)&&!r,onCheckedChange:()=>void x(e.agentId,r),"aria-label":Ce({name:e.displayName??e.agentId})}),(0,$.jsxs)(`span`,{className:`oc-access__label`,title:e.displayName??e.agentId,children:[e.emoji?`${e.emoji} `:``,e.displayName??e.agentId]}),e.model?(0,$.jsx)(`span`,{className:`oc-access__model`,children:e.model}):null,e.isDefaultOnInstance?(0,$.jsx)(`span`,{className:`oc-access__fav`,role:`img`,"aria-label":_(),title:_(),children:(0,$.jsx)(W,{size:14,fill:`currentColor`})}):null,a?(0,$.jsx)(K,{variant:`outline`,className:`oc-access__gone`,children:be()}):null]},e.agentId)}),(0,$.jsx)(st,{page:y.page,pageCount:y.pageCount,onPage:f})]})]})}function ut({groupId:e}){let t=b(L.charts.listGroupChartSelection,e?{groupId:e}:`skip`),n=R(L.charts.assignChartToGroup),r=R(L.charts.removeChartFromGroup),i=R(L.charts.setGroupDefaultChart),a=R(L.charts.addChartToGroupPool),s=R(L.charts.removeChartFromGroupPool),c=Y();if(!e)return null;if(t===void 0)return(0,$.jsx)(`p`,{className:`oc-access__hint`,children:se()});let{pool:l,addable:u,canManagePool:d}=t;if(l.length===0&&!d)return(0,$.jsx)(`p`,{className:`oc-access__hint`,children:M()});async function f(t,i){try{i?await r({groupId:e,chartKey:t}):await n({groupId:e,chartKey:t})}catch(e){c.error(C(),e)}}async function m(t){try{await i({groupId:e,chartKey:t})}catch(e){c.error(C(),e)}}async function h(t){try{await a({groupId:e,chartKey:t})}catch(e){c.error(C(),e)}}async function g(t){try{await s({groupId:e,chartKey:t})}catch(e){c.error(C(),e)}}return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`div`,{className:`oc-access__list`,children:l.map(e=>(0,$.jsxs)(`div`,{className:`oc-access__row`,children:[(0,$.jsx)(J,{checked:e.selected,onCheckedChange:()=>void f(e.chartKey,e.selected),"aria-label":o({name:e.name})}),(0,$.jsx)(`span`,{className:`oc-access__label`,title:e.name,children:e.name}),e.selected?e.isDefault?(0,$.jsx)(`span`,{className:`oc-access__fav`,role:`img`,"aria-label":ke(),title:ke(),children:(0,$.jsx)(W,{size:14,fill:`currentColor`})}):(0,$.jsx)(U,{type:`button`,variant:`ghost`,size:`sm`,onClick:()=>void m(e.chartKey),children:O()}):null,d?(0,$.jsx)(U,{type:`button`,variant:`ghost`,size:`sm`,"aria-label":j({name:e.name}),title:j({name:e.name}),onClick:()=>void g(e.chartKey),children:(0,$.jsx)(Ae,{size:14,"aria-hidden":!0})}):null]},e.chartKey))}),d?u.length>0?(0,$.jsxs)(Le,{value:``,onValueChange:e=>void h(e),children:[(0,$.jsx)(Pe,{size:`sm`,className:`oc-access__search`,children:(0,$.jsx)(Ge,{placeholder:p()})}),(0,$.jsx)(Ke,{children:u.map(e=>(0,$.jsx)(Ie,{value:e.chartKey,children:e.name},e.chartKey))})]}):l.length===0?(0,$.jsx)(`p`,{className:`oc-access__hint`,children:ne()}):null:null]})}export{at as GroupsTab};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{c as e,i as t,r as n}from"./bundle-mjs-BJq7W7j9.js";import{$b as r,$x as i,Ab as a,At as o,Ax as s,Bb as c,Bx as l,Cx as u,Db as d,Dx as f,Ex as p,Fb as m,Fx as h,Gb as g,Gi as _,Gx as v,Hb as y,Hx as b,ID as x,Ib as S,Ix as ee,Jb as te,Jx as ne,Kb as C,Ki as w,Kx as T,LD as E,Lb as re,Lx as ie,MM as D,Mb as ae,Mt as oe,Mx as O,Nb as se,Nx as k,Ob as ce,Ox as le,Pb as ue,Px as de,Qb as fe,Qx as pe,Rb as me,Rx as he,Sx as ge,Tx as _e,Ub as ve,Ux as ye,Vb as be,Vx as xe,Wb as Se,Wi as Ce,Wx as we,Xx as Te,Yb as Ee,Yx as De,Zb as A,Zx as Oe,_x as ke,aS as Ae,ax as je,bx as Me,c as j,cS as Ne,cx as Pe,dS as Fe,dx as Ie,eS as Le,ex as Re,fS as ze,fx as Be,gS as Ve,gx as He,hS as Ue,hx as We,iS as Ge,ix as Ke,jM as M,jb as qe,jt as Je,jx as Ye,kM as N,kb as Xe,kx as Ze,lS as Qe,lx as $e,mS as et,mx as tt,nS as P,nx as F,oS as nt,ox as rt,pS as it,px as at,qb as ot,qi as st,qx as ct,rS as lt,rx as ut,sS as dt,sx as ft,tS as pt,tx as mt,uS as ht,ux as gt,vg as _t,vx as vt,wx as yt,xx as bt,yg as xt,yx as St,zb as Ct,zx as wt}from"./dist-Bh78J5oj.js";import{a as Tt,c as Et}from"./FieldLabel-B-ZBXJZE.js";import{t as I}from"./button-BWtKy7q6.js";import{B as Dt,C as L,Q as Ot,S as R,X as kt,Z as At,b as z,ct as B,dt as V,ft as H,ht as U,lt as W,mt as G,p as jt,u as Mt,ut as Nt,w as K,x as q,z as J}from"./index-BoGVkzmD.js";import{t as Pt}from"./DataTableShell-DTw-rOw3.js";import{InstanceConfigDialog as Ft}from"./BridgeTab-DSY7hdDk.js";var Y=e(t(),1),X=[`conversational`,`documentary`,`summarizer`,`curator`],It=new Set(X),Lt=`conversational`;function Rt(e){let t=new Set((e??[]).filter(e=>It.has(e)));return t.size===0?[Lt]:X.filter(e=>t.has(e))}var Z=n(),Q={name:``,gatewayUrl:``,bridgeUrl:``,displayName:``,kind:`openclaw`,transport:`ws`,gatewayVersion:``,gatewayHttpUrl:``,streamTransport:Tt},zt={openclaw:[`token`,`deviceIdentity`],hermes:[`apiKey`]};function Bt(e){return{name:e.name,gatewayUrl:e.gatewayUrl,bridgeUrl:e.bridgeUrl??``,displayName:e.displayName??``,kind:e.kind??`openclaw`,transport:e.transport??`ws`,gatewayVersion:e.gatewayVersion??``,gatewayHttpUrl:e.gatewayHttpUrl??``,streamTransport:e.streamTransport??`reactive`}}function Vt(){let e=D(j.admin.listInstances,{}),t=D(j.agents.listAllInstanceAgents,{}),n=M(j.admin.upsertInstance),r=M(j.admin.deleteInstance),a=J(),[s,c]=(0,Y.useState)(!1),[u,d]=(0,Y.useState)(Q),[f,p]=(0,Y.useState)(null),[m,h]=(0,Y.useState)(null),[g,_]=(0,Y.useState)(null),[y,x]=(0,Y.useState)(null);async function S(){try{await n({instanceId:y??void 0,name:u.name,gatewayUrl:u.gatewayUrl,bridgeUrl:u.bridgeUrl||void 0,displayName:u.displayName||void 0,kind:u.kind,transport:u.kind===`hermes`?u.transport:void 0,gatewayVersion:u.gatewayVersion||void 0,gatewayHttpUrl:u.gatewayHttpUrl||void 0,streamTransport:u.streamTransport}),d(Q),x(null),c(!1)}catch(e){a.error(et(),e)}}return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`p`,{className:`oc-admin__hint`,children:[it(),(0,Z.jsx)(`strong`,{children:ze()}),Fe()]}),(0,Z.jsx)(Pt,{title:ht(),rows:e,addLabel:Qe(),onAdd:()=>{x(null),d(Q),c(!0)},emptyHint:Ne(),columns:[{header:dt(),cell:e=>e.name,sort:e=>e.name},{header:nt(),cell:e=>(0,Z.jsx)(B,{variant:`outline`,children:e.kind??`openclaw`}),sort:e=>e.kind??`openclaw`},{header:Ae(),cell:e=>e.gatewayUrl,sort:e=>e.gatewayUrl},{header:Ge(),cell:e=>e.displayName??`—`,sort:e=>e.displayName??null},{header:Ve(),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)(B,{variant:r(e.agentId)?`default`:`outline`,title:r(e.agentId)?ce():void 0,children:[e.emoji?`${e.emoji} `:``,e.displayName??e.agentId]},e.agentId))})}}],rowActions:e=>[{label:Le(),onSelect:()=>{x(e._id),d(Bt(e)),c(!0)}},{label:Ue(),onSelect:()=>p(e.name)},{label:wt(),onSelect:()=>_(e)},{label:lt(),onSelect:()=>h(e)},{label:P(),variant:`destructive`,onSelect:()=>void r({instanceId:e._id})}],bulkActions:[{label:P(),variant:`destructive`,onSelect:e=>e.forEach(e=>void r({instanceId:e}))}]}),(0,Z.jsx)(Mt,{open:s,onOpenChange:c,title:y?i():pt(),description:Oe(),canSubmit:!!(u.name&&u.gatewayUrl),onSubmit:S,submitLabel:Te(),children:(0,Z.jsxs)(`div`,{className:`oc-form`,children:[(0,Z.jsxs)($,{label:De(),children:[(0,Z.jsx)(W,{value:u.name,disabled:y!==null,onChange:e=>d({...u,name:e.target.value})}),y?(0,Z.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:pe()}):null]}),(0,Z.jsx)($,{label:ne(),children:(0,Z.jsxs)(z,{value:u.kind,onValueChange:e=>d({...u,kind:e}),children:[(0,Z.jsx)(L,{size:`sm`,className:`w-40`,children:(0,Z.jsx)(K,{})}),(0,Z.jsxs)(q,{children:[(0,Z.jsx)(R,{value:`openclaw`,children:`OpenClaw`}),(0,Z.jsx)(R,{value:`hermes`,children:`Hermes`})]})]})}),u.kind===`hermes`?(0,Z.jsx)($,{label:oe(),children:(0,Z.jsxs)(z,{value:u.transport,onValueChange:e=>d({...u,transport:e}),children:[(0,Z.jsx)(L,{size:`sm`,className:`w-56`,children:(0,Z.jsx)(K,{})}),(0,Z.jsxs)(q,{children:[(0,Z.jsx)(R,{value:`ws`,children:Je()}),(0,Z.jsx)(R,{value:`rest`,children:o()})]})]})}):null,(0,Z.jsx)($,{label:ct(),children:(0,Z.jsx)(W,{value:u.gatewayUrl,onChange:e=>d({...u,gatewayUrl:e.target.value})})}),(0,Z.jsx)($,{label:T(),children:(0,Z.jsx)(W,{value:u.bridgeUrl,placeholder:v(),onChange:e=>d({...u,bridgeUrl:e.target.value})})}),(0,Z.jsx)($,{label:we(),children:(0,Z.jsx)(W,{value:u.displayName,onChange:e=>d({...u,displayName:e.target.value})})}),(0,Z.jsxs)($,{label:xt(),children:[(0,Z.jsxs)(z,{value:u.streamTransport,onValueChange:e=>d({...u,streamTransport:e}),children:[(0,Z.jsx)(L,{size:`sm`,className:`w-40`,children:(0,Z.jsx)(K,{})}),(0,Z.jsx)(q,{children:Et.map(e=>(0,Z.jsx)(R,{value:e,children:e},e))})]}),(0,Z.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:_t()})]}),(0,Z.jsx)($,{label:ye(),children:(0,Z.jsx)(W,{value:u.gatewayVersion,placeholder:b(),onChange:e=>d({...u,gatewayVersion:e.target.value})})}),(0,Z.jsx)($,{label:xe(),children:(0,Z.jsx)(W,{value:u.gatewayHttpUrl,placeholder:l(),onChange:e=>d({...u,gatewayHttpUrl:e.target.value})})})]})}),(0,Z.jsx)(Zt,{instanceName:f,open:f!==null,onOpenChange:e=>{e||p(null)}}),m?(0,Z.jsx)(Ft,{instance:m,onClose:()=>h(null)},m._id):null,g?(0,Z.jsx)(Ht,{instance:g,onClose:()=>_(null)},g._id):null]})}function Ht({instance:e,onClose:t}){let n=D(j.instanceSecrets.listInstanceSecretStatus,{}),r=zt[e.kind??`openclaw`],i=(0,Y.useMemo)(()=>{let t={};for(let r of n??[])r.instanceId===e._id&&(t[r.field]=r.updatedAt);return t},[n,e._id]);return(0,Z.jsx)(Nt,{open:!0,onOpenChange:e=>!e&&t(),children:(0,Z.jsxs)(V,{onOpenAutoFocus:e=>e.preventDefault(),children:[(0,Z.jsxs)(G,{children:[(0,Z.jsx)(U,{children:he({instance:e.displayName??e.name})}),(0,Z.jsx)(H,{children:ie()})]}),(0,Z.jsx)(`div`,{className:`oc-form`,children:r.map(t=>(0,Z.jsx)(Gt,{instanceId:e._id,field:t,updatedAt:i[t]??null},t))}),(0,Z.jsx)(`div`,{className:`oc-bridgesecret`,children:(0,Z.jsx)(Wt,{instance:e})}),(0,Z.jsx)(Ut,{instance:e})]})})}function Ut({instance:e}){let t=N(j.instanceSync.forceInstanceSync),n=J(),[r,i]=(0,Y.useState)(!1);async function a(){if(!r){i(!0);try{switch((await t({instanceId:e._id})).status){case`synced`:n.success(ke());break;case`no_agents`:n.success(We());break;case`no_bridge_url`:n.error(tt());break;case`deploy_misconfigured`:n.error(at());break;case`unauthorized`:n.error(Ie());break;case`not_served`:n.error(gt());break;default:n.error(Be());break}}catch(e){n.error(He(),e)}finally{i(!1)}}}return(0,Z.jsxs)(`div`,{className:`oc-form`,children:[(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:$e()}),(0,Z.jsx)(`div`,{className:`flex items-center gap-2`,children:(0,Z.jsx)(I,{size:`sm`,variant:`outline`,onClick:()=>void a(),disabled:r,children:r?vt():St()})})]})}function Wt({instance:e}){let t=D(j.bridgeAuth.listBridgeAuthStatus,{}),n=N(j.bridgeAuth.mintBridgeSecret),r=M(j.bridgeAuth.revokeBridgeSecret),i=J(),[a,o]=(0,Y.useState)(!1),[s,c]=(0,Y.useState)(null),[l,u]=(0,Y.useState)(!1),d=(t??[]).find(t=>t.instanceId===e._id),f=d!==void 0;async function p(){if(!a){o(!0);try{c((await n({instanceId:e._id})).plaintext),u(!1)}catch(e){i.error(F(),e)}finally{o(!1)}}}async function m(){if(!a){o(!0);try{await r({instanceId:e._id}),c(null),i.success(ut())}catch(e){i.error(F(),e)}finally{o(!1)}}}async function h(){if(s)try{await navigator.clipboard.writeText(s),u(!0)}catch{}}return(0,Z.jsxs)($,{label:Pe(),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)(B,{variant:f?`outline`:`secondary`,children:f?`${k()} · ${d.prefix}…${d.lastFour}`:O()}),(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(I,{size:`sm`,onClick:()=>void p(),disabled:a,children:f?je():rt()}),f?(0,Z.jsx)(I,{size:`sm`,variant:`destructive`,onClick:()=>void m(),disabled:a,children:Ke()}):null]})]}),s?(0,Z.jsxs)(`div`,{className:`oc-bridgesecret__reveal`,children:[(0,Z.jsx)(`p`,{className:`oc-sa__minted-warning`,children:mt()}),(0,Z.jsxs)(`div`,{className:`oc-sa__minted-box`,children:[(0,Z.jsx)(`code`,{className:`oc-sa__minted-plain`,children:s}),(0,Z.jsx)(I,{variant:`outline`,size:`sm`,onClick:()=>void h(),children:l?E():x()})]}),(0,Z.jsx)(I,{size:`sm`,variant:`ghost`,onClick:()=>{c(null),u(!1)},children:Re()})]}):null]})}function Gt({instanceId:e,field:t,updatedAt:n}){let r=N(j.instanceSecrets.setInstanceSecret),i=M(j.instanceSecrets.clearInstanceSecret),a=N(j.deviceIdentity.generateDeviceIdentity),o=J(),[c,l]=(0,Y.useState)(``),[d,m]=(0,Y.useState)(!1),[g,_]=(0,Y.useState)(null),[v,y]=(0,Y.useState)(!1),b=n!==null,S=t===`deviceIdentity`,te=t===`token`?ee():t===`deviceIdentity`?h():de();async function ne(){if(!(!c.trim()||d)){m(!0);try{await r({instanceId:e,field:t,plaintext:c}),l(``),_(null),y(!1),o.success(f())}catch(e){o.error(p(),e)}finally{m(!1)}}}async function C(){if(!d){m(!0);try{await i({instanceId:e,field:t}),_(null),y(!1),o.success(_e())}catch(e){o.error(p(),e)}finally{m(!1)}}}async function w(){if(!d){m(!0);try{_(await a({instanceId:e})),y(!1),o.success(ge())}catch(e){o.error(Me(),e)}finally{m(!1)}}}let T=g?`openclaw devices approve ${g.id}`:``;async function re(){if(T)try{await navigator.clipboard.writeText(T),y(!0)}catch{}}return(0,Z.jsxs)($,{label:te,children:[S?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:u()}):null,(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Z.jsx)(B,{variant:b?`outline`:`secondary`,children:b?k():O()}),(0,Z.jsx)(W,{type:`password`,autoComplete:`off`,className:`flex-1 min-w-32`,value:c,placeholder:b?s():Ye(),onChange:e=>l(e.target.value)}),(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(I,{size:`sm`,onClick:()=>void ne(),disabled:d||c.trim().length===0,children:Ze()}),S?(0,Z.jsx)(I,{size:`sm`,variant:`outline`,onClick:()=>void w(),disabled:d,children:yt()}):null,b?(0,Z.jsx)(I,{size:`sm`,variant:`destructive`,onClick:()=>void C(),disabled:d,children:le()}):null]})]}),g?(0,Z.jsxs)(`div`,{className:`oc-bridgesecret__reveal`,children:[(0,Z.jsx)(`p`,{className:`text-sm font-medium`,children:ge()}),(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:bt()}),(0,Z.jsxs)(`div`,{className:`oc-sa__minted-box`,children:[(0,Z.jsx)(`code`,{className:`oc-sa__minted-plain`,children:T}),(0,Z.jsx)(I,{variant:`outline`,size:`sm`,onClick:()=>void re(),children:v?E():x()})]}),(0,Z.jsx)(I,{size:`sm`,variant:`ghost`,onClick:()=>{_(null),y(!1)},children:Re()})]}):null]})}var Kt={conversational:ve,documentary:be,summarizer:st,curator:_},qt={conversational:y,documentary:c,summarizer:w,curator:Ce},Jt=e=>(Kt[e]??(()=>e))(),Yt=e=>(qt[e]??(()=>``))();function Xt({agentId:e,types:t,onToggle:n}){return(0,Z.jsxs)(`div`,{className:`oc-agentcard__types`,children:[(0,Z.jsx)(`span`,{className:`oc-agentcard__types-label`,children:ot()}),t.map(e=>(0,Z.jsx)(B,{variant:`secondary`,className:`oc-agenttype__chip`,title:Yt(e),children:Jt(e)},e)),(0,Z.jsxs)(kt,{children:[(0,Z.jsx)(Ot,{asChild:!0,children:(0,Z.jsx)(I,{type:`button`,variant:`outline`,size:`sm`,className:`h-7`,children:C()})}),(0,Z.jsxs)(At,{align:`start`,className:`oc-agenttypes-pop`,children:[(0,Z.jsx)(`p`,{className:`oc-agenttypes-pop__title`,children:g()}),(0,Z.jsx)(`p`,{className:`oc-agenttypes-pop__hint`,children:Se()}),(0,Z.jsx)(`div`,{className:`oc-agenttypes-pop__list`,children:X.map(r=>{let i=`agtype-${e}-${r}`;return(0,Z.jsxs)(`div`,{className:`oc-agenttypes-pop__item`,children:[(0,Z.jsx)(jt,{id:i,checked:t.includes(r),onCheckedChange:()=>n(r)}),(0,Z.jsxs)(`label`,{htmlFor:i,className:`oc-agenttypes-pop__text`,children:[(0,Z.jsx)(`span`,{className:`oc-agenttypes-pop__name`,children:Jt(r)}),(0,Z.jsx)(`span`,{className:`oc-agenttypes-pop__desc`,children:Yt(r)})]})]},r)})})]})]})]})}function Zt({instanceName:e,open:t,onOpenChange:n}){let i=D(j.agents.listAgentsForInstance,t&&e?{instanceName:e}:`skip`),o=M(j.agents.setAgentEnabled).withOptimisticUpdate((e,{instanceName:t,agentId:n,enabled:r})=>{let i=e.getQuery(j.agents.listAgentsForInstance,{instanceName:t});i&&e.setQuery(j.agents.listAgentsForInstance,{instanceName:t},{...i,agents:i.agents.map(e=>e.agentId===n?{...e,enabled:r}:e)})}),s=M(j.agents.setInstanceDefaultAgent).withOptimisticUpdate((e,{instanceName:t,agentId:n})=>{let r=e.getQuery(j.agents.listAgentsForInstance,{instanceName:t});r&&e.setQuery(j.agents.listAgentsForInstance,{instanceName:t},{...r,defaultAgentId:n})}),c=M(j.agents.setAgentTypes).withOptimisticUpdate((e,{instanceName:t,agentId:n,types:r})=>{let i=e.getQuery(j.agents.listAgentsForInstance,{instanceName:t});if(!i)return;let a=Rt(r);e.setQuery(j.agents.listAgentsForInstance,{instanceName:t},{...i,agents:i.agents.map(e=>e.agentId===n?{...e,types:a}:e)})}),l=M(j.agents.setAgentDescription).withOptimisticUpdate((e,{instanceName:t,agentId:n,description:r})=>{let i=e.getQuery(j.agents.listAgentsForInstance,{instanceName:t});if(!i)return;let a=r.trim();e.setQuery(j.agents.listAgentsForInstance,{instanceName:t},{...i,agents:i.agents.map(e=>e.agentId===n?{...e,description:a.length===0?null:a}:e)})}),u=M(j.agents.removeInstanceAgent),f=Dt(),p=J();async function h(t,n){if(e)try{await o({instanceName:e,agentId:t,enabled:n})}catch(e){p.error(A(),e)}}async function g(t){if(e)try{await s({instanceName:e,agentId:t})}catch(e){p.error(A(),e)}}async function _(t,n,r){if(!e)return;let i=r.includes(n)?r.filter(e=>e!==n):[...r,n];try{await c({instanceName:e,agentId:t,types:i})}catch(e){p.error(A(),e)}}async function v(t,n){if(e&&await f({title:re({name:n}),description:S(),confirmLabel:m(),destructive:!0}))try{await u({instanceName:e,agentId:t}),p.success(ue())}catch(e){p.error(A(),e)}}return(0,Z.jsx)(Nt,{open:t,onOpenChange:n,children:(0,Z.jsxs)(V,{className:`oc-access`,children:[(0,Z.jsxs)(G,{children:[(0,Z.jsx)(U,{children:r({name:e??``})}),(0,Z.jsx)(H,{children:fe()})]}),i===void 0?(0,Z.jsx)(`p`,{className:`oc-access__hint`,children:se()}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`div`,{className:`oc-access__poll`,children:i.discovery===null?ae():i.discovery.lastPollOk?qe():a({error:i.discovery.error??`?`})}),i.agents.length===0?(0,Z.jsx)(`p`,{className:`oc-access__hint`,children:Xe()}):(0,Z.jsx)(`div`,{className:`oc-access__list`,children:i.agents.map(t=>{let n=t.presentInLastOk===!1,r=i.defaultAgentId===t.agentId,a=t.displayName??t.agentId,o=t.types??[];return(0,Z.jsxs)(`div`,{className:`oc-agentcard`+(t.enabled?``:` oc-agentcard--off`),children:[(0,Z.jsxs)(`div`,{className:`oc-agentcard__head`,children:[(0,Z.jsx)(jt,{checked:t.enabled,disabled:n,"aria-label":a,onCheckedChange:e=>void h(t.agentId,e===!0)}),(0,Z.jsxs)(`span`,{className:`oc-agentcard__name`,title:a,children:[t.emoji?`${t.emoji} `:``,a]}),t.model?(0,Z.jsx)(`span`,{className:`oc-access__model`,children:t.model}):null,n?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(B,{variant:`outline`,className:`oc-access__gone`,children:d()}),(0,Z.jsx)(I,{size:`sm`,variant:`ghost`,className:`h-7 text-destructive`,onClick:()=>void v(t.agentId,a),children:me()})]}):r?(0,Z.jsx)(B,{variant:`default`,children:ce()}):(0,Z.jsx)(I,{size:`sm`,variant:`outline`,className:`h-7`,disabled:!t.enabled,onClick:()=>void g(t.agentId),children:Ct()})]}),t.enabled?(0,Z.jsx)(Xt,{agentId:t.agentId,types:o,onToggle:e=>void _(t.agentId,e,o)}):null,t.enabled?(0,Z.jsx)(Qt,{value:t.description??``,onSave:async n=>{if(e)try{await l({instanceName:e,agentId:t.agentId,description:n})}catch(e){p.error(A(),e)}}}):null]},t.agentId)})})]})]})})}function Qt({value:e,onSave:t}){let[n,r]=(0,Y.useState)(e);(0,Y.useEffect)(()=>{r(e)},[e]);let i=()=>{n.trim()!==e.trim()&&t(n)};return(0,Z.jsx)(W,{className:`oc-agentcard__desc`,value:n,maxLength:280,placeholder:Ee(),"aria-label":te(),onChange:e=>r(e.target.value),onBlur:i,onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),i())}})}function $({label:e,children:t}){return(0,Z.jsxs)(`label`,{className:`oc-field`,children:[(0,Z.jsx)(`span`,{className:`oc-field__label`,children:e}),t]})}export{Vt as InstancesTab};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{c as e,i as t,r as n}from"./bundle-mjs-BJq7W7j9.js";import{$C as r,JC as i,KC as a,MM as o,QC as s,XC as c,YC as l,ZC as u,aw as d,c as f,co as p,do as m,ew as h,fo as g,iw as _,jM as v,kM as y,lo as b,mo as x,nw as S,oo as C,po as w,qC as T,rw as E,so as D,tw as O,uo as k}from"./dist-Bh78J5oj.js";import{t as A}from"./button-BWtKy7q6.js";import{ct as j,lt as M,p as N}from"./index-BoGVkzmD.js";var P=e(t(),1),F=n();function I(){let e=o(f.integrations.status.status,{}),t=v(f.admin.setIntegrationConfig),[n,p]=(0,P.useState)(null);if((0,P.useEffect)(()=>{e&&n===null&&p(e.config)},[e,n]),!e||!n)return(0,F.jsx)(`p`,{className:`oc-admin__hint`,children:d()});let m=n,y=(e,t,n)=>p({...m,[e]:{...m[e],[t]:n}}),b=(e,n)=>void t({[e]:n});return(0,F.jsxs)(F.Fragment,{children:[(0,F.jsxs)(`p`,{className:`oc-admin__hint`,children:[_(),` `,(0,F.jsx)(`strong`,{children:E()}),` `,S()]}),(0,F.jsxs)(L,{title:`Langfuse`,status:e.langfuse.configured?e.langfuse.enabled?(0,F.jsx)(j,{variant:`secondary`,children:O()}):(0,F.jsx)(j,{variant:`outline`,children:h()}):(0,F.jsx)(j,{variant:`outline`,children:r()}),note:s(),children:[(0,F.jsx)(R,{label:c(),children:(0,F.jsx)(M,{value:m.langfuse.host??``,placeholder:e.langfuse.effectiveHost,onChange:e=>y(`langfuse`,`host`,e.target.value),onBlur:()=>b(`langfuse`,{host:m.langfuse.host??``})})}),(0,F.jsx)(z,{label:a(),checked:m.langfuse.enabled??!0,onChange:e=>{y(`langfuse`,`enabled`,e),b(`langfuse`,{enabled:e})}})]}),(0,F.jsxs)(L,{title:`Opik`,status:e.opik.configured?e.opik.enabled?(0,F.jsx)(j,{variant:`secondary`,children:O()}):(0,F.jsx)(j,{variant:`outline`,children:h()}):(0,F.jsx)(j,{variant:`outline`,children:r()}),note:u(),children:[(0,F.jsx)(R,{label:l(),children:(0,F.jsx)(M,{value:m.opik.baseUrl??``,placeholder:e.opik.effectiveBaseUrl,onChange:e=>y(`opik`,`baseUrl`,e.target.value),onBlur:()=>b(`opik`,{baseUrl:m.opik.baseUrl??``})})}),(0,F.jsx)(R,{label:i(),children:(0,F.jsx)(M,{value:m.opik.workspace??``,placeholder:e.opik.effectiveWorkspace||T(),onChange:e=>y(`opik`,`workspace`,e.target.value),onBlur:()=>b(`opik`,{workspace:m.opik.workspace??``})})}),(0,F.jsx)(z,{label:a(),checked:m.opik.enabled??!0,onChange:e=>{y(`opik`,`enabled`,e),b(`opik`,{enabled:e})}})]}),(0,F.jsxs)(L,{title:`OpenTelemetry (OTLP)`,status:e.otlp.configured?e.otlp.enabled?(0,F.jsx)(j,{variant:`secondary`,children:O()}):(0,F.jsx)(j,{variant:`outline`,children:h()}):(0,F.jsx)(j,{variant:`outline`,children:x()}),note:w(),children:[(0,F.jsx)(R,{label:g(),children:(0,F.jsx)(M,{value:m.otlp.endpoint??``,placeholder:e.otlp.effectiveEndpoint||`https://otlp.example.com/v1/traces`,onChange:e=>y(`otlp`,`endpoint`,e.target.value),onBlur:()=>b(`otlp`,{endpoint:m.otlp.endpoint??``})})}),(0,F.jsx)(B,{headersSet:e.otlp.headersSet}),(0,F.jsx)(z,{label:a(),checked:m.otlp.enabled??!0,onChange:e=>{y(`otlp`,`enabled`,e),b(`otlp`,{enabled:e})}})]})]})}function L({title:e,status:t,note:n,children:r}){return(0,F.jsxs)(`section`,{className:`oc-int__section`,children:[(0,F.jsxs)(`div`,{className:`oc-int__section-head`,children:[(0,F.jsx)(`h3`,{className:`oc-uipa__h`,children:e}),t]}),n?(0,F.jsx)(`p`,{className:`oc-uipa__note`,children:n}):null,(0,F.jsx)(`div`,{className:`oc-int__fields`,children:r})]})}function R({label:e,children:t}){return(0,F.jsxs)(`label`,{className:`oc-int__field`,children:[(0,F.jsx)(`span`,{className:`oc-int__field-label`,children:e}),t]})}function z({label:e,checked:t,onChange:n}){return(0,F.jsxs)(`label`,{className:`oc-int__toggle`,children:[(0,F.jsx)(N,{checked:t,onCheckedChange:e=>n(e===!0)}),(0,F.jsx)(`span`,{children:e})]})}function B({headersSet:e}){let t=y(f.integrations.otlpSecret.setOtlpHeaders),n=v(f.integrations.otlpSecret.clearOtlpHeaders),[r,i]=(0,P.useState)(``),[a,o]=(0,P.useState)(null),[s,c]=(0,P.useState)(!1),l=async()=>{c(!0),o(null);try{await t({headersJson:r}),i(``)}catch(e){o(e instanceof Error?e.message:String(e))}finally{c(!1)}};return(0,F.jsxs)(R,{label:m(),children:[(0,F.jsx)(M,{value:r,placeholder:e?k():b(),onChange:e=>i(e.target.value)}),(0,F.jsxs)(`div`,{className:`oc-int__otlp-headers-actions`,children:[(0,F.jsx)(A,{size:`sm`,disabled:s||r.trim().length===0,onClick:()=>void l(),children:p()}),e?(0,F.jsx)(A,{variant:`ghost`,size:`sm`,disabled:s,onClick:()=>void n({}),children:D()}):null]}),a?(0,F.jsx)(`p`,{className:`oc-int__otlp-headers-error`,children:a}):null,(0,F.jsx)(`p`,{className:`oc-uipa__note`,children:C()})]})}export{I as IntegrationsTab};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{c as e,i as t,r as n}from"./bundle-mjs-BJq7W7j9.js";import{$O as r,Ak as i,CM as a,Ck as o,D as s,Dk as c,Ek as l,M as u,MM as d,Mk as f,N as ee,Nk as te,Ok as ne,Pk as re,QO as ie,Sk as ae,Tk as oe,XO as se,Xx as ce,YO as le,ZO as ue,_ as p,_k as m,aM as h,ak as de,bk as fe,c as g,cM as pe,ck as _,dM as v,dk as y,ek as b,f as x,fM as S,fk as C,g as w,gk as T,h as E,hM as D,hk as O,ik as k,jM as A,jk as j,kk as M,lM as N,lk as P,m as F,mM as I,mk as L,n as R,nk as z,oM as B,ok as me,p as he,pM as ge,pk as _e,rk as ve,sM as ye,sk as be,tk as xe,uM as Se,uk as V,v as Ce,vM as we,vk as Te,wk as Ee,xk as De,y as Oe,yk as ke}from"./dist-Bh78J5oj.js";import{t as H}from"./button-BWtKy7q6.js";import{A as Ae,C as je,S as U,b as Me,bt as Ne,ct as W,lt as G,p as K,vt as Pe,w as Fe,x as Ie,xt as q,yt as Le,z as Re}from"./index-BoGVkzmD.js";import{t as ze}from"./localePickerView-C2RmOS86.js";var J=e(t(),1),Y=n();function Be({className:e,checked:t,onCheckedChange:n,disabled:r,...i}){return(0,Y.jsx)(`button`,{type:`button`,role:`switch`,"aria-checked":t,"data-state":t?`checked`:`unchecked`,disabled:r,onClick:()=>n(!t),className:R(`peer inline-flex h-5 w-9 shrink-0 items-center rounded-full border border-transparent transition-colors outline-none`,`focus-visible:ring-2 focus-visible:ring-ring/50`,`disabled:cursor-not-allowed disabled:opacity-50`,t?`bg-primary`:`bg-input`,e),...i,children:(0,Y.jsx)(`span`,{className:R(`pointer-events-none block size-4 rounded-full bg-background shadow transition-transform`,t?`translate-x-[18px]`:`translate-x-[2px]`)})})}var X=[{id:`messages`,label:()=>re()},{id:`composer`,label:()=>te()},{id:`sidebar`,label:()=>f()},{id:`notifications`,label:()=>O()},{id:`other`,label:()=>j()}],Z={showSource:{category:`messages`,label:()=>i(),help:()=>M()},showReport:{category:`messages`,label:()=>ne(),help:()=>c()},copyAssistant:{category:`messages`,label:()=>l()},copyUser:{category:`messages`,label:()=>oe()},showDelete:{category:`messages`,label:()=>Ee()},showTools:{category:`messages`,label:()=>o(),help:()=>ae()},voiceInput:{category:`composer`,label:()=>De(),help:()=>fe()},showUsage:{category:`composer`,label:()=>ke(),help:()=>Te()},autoReadAloud:{category:`composer`,label:()=>ee(),help:()=>u()},showChatAge:{category:`sidebar`,label:()=>m(),help:()=>T()},notifSound:{category:`notifications`,label:()=>L(),help:()=>_e()},notifSystem:{category:`notifications`,label:()=>C(),help:()=>y()},replySound:{category:`notifications`,label:()=>V(),help:()=>P()}};function Q(e){return e.toLowerCase().normalize(`NFD`).replace(/\p{Diacritic}/gu,``)}function Ve(e,t){let n=Q(t.trim()),r=new Map(X.map(e=>[e.id,e.label()])),i=new Map(X.map(e=>[e.id,[]]));for(let t of e){let e=Z[t],a=e?.category??`other`;n&&!Q(`${e?e.label():t} ${e?.help?e.help():``} ${t} ${r.get(a)??``}`).includes(n)||i.get(a).push(t)}return X.map(e=>({id:e.id,label:r.get(e.id),keys:i.get(e.id)})).filter(e=>e.keys.length>0)}var He=[`showSource`,`showReport`,`copyAssistant`,`copyUser`,`showDelete`,`showTools`,`voiceInput`,`showChatAge`,`showUsage`,`autoReadAloud`,`notifSound`,`notifSystem`,`replySound`],Ue={voiceInput:`voiceInput`};function We(e){return He.includes(e)}function $(e){return e===`admin`}function Ge(e){return e===!0?`on`:e===!1?`off`:`inherit`}function Ke(e){return e===`on`?!0:e===`off`?!1:null}function qe(e){return We(e)?Ue[e]:void 0}var Je={voiceInput:()=>r()};function Ye({prefKey:e,ui:t}){let n=A(g.admin.setUiPrefDefault),r=A(g.admin.setFeatureEnabled),i=qe(e),a=i?Je[e]?.():void 0;return(0,Y.jsxs)(`div`,{className:`oc-prefs__gov`,children:[(0,Y.jsxs)(`div`,{className:`oc-prefs__gov-row`,children:[(0,Y.jsx)(`span`,{className:`oc-prefs__gov-label`,children:ve()}),(0,Y.jsxs)(Me,{value:Ge(t.defaults[e]),onValueChange:t=>void n({key:e,value:Ke(t)}),children:[(0,Y.jsx)(je,{size:`sm`,className:`w-36`,children:(0,Y.jsx)(Fe,{})}),(0,Y.jsxs)(Ie,{children:[(0,Y.jsx)(U,{value:`on`,children:ue()}),(0,Y.jsx)(U,{value:`off`,children:se()}),(0,Y.jsx)(U,{value:`inherit`,children:le()})]})]}),i?(0,Y.jsxs)(`span`,{className:`oc-prefs__gov-gate`,children:[(0,Y.jsx)(K,{checked:t.featuresEnabled[i]===!0,onCheckedChange:e=>void r({key:i,enabled:e===!0}),"aria-label":z()}),z()]}):null]}),a?(0,Y.jsx)(`span`,{className:`oc-prefs__gov-help`,children:a}):null]})}function Xe({current:e,enabled:t}){let n=A(g.me.setDictationShortcut),[r,i]=(0,J.useState)(!1),[a,o]=(0,J.useState)(!1);return(0,J.useEffect)(()=>{if(!r)return;let e=e=>{if(e.preventDefault(),e.stopPropagation(),e.key===`Escape`){i(!1);return}let t=Le(e);if(t===null){[`Shift`,`Control`,`Meta`,`Alt`].includes(e.key)||(o(!0),window.setTimeout(()=>o(!1),1800));return}i(!1),n({shortcut:t})};return window.addEventListener(`keydown`,e,!0),()=>window.removeEventListener(`keydown`,e,!0)},[r,n]),(0,Y.jsxs)(`div`,{className:`oc-prefs__row${t?``:` is-locked`}`,children:[(0,Y.jsxs)(`div`,{className:`oc-prefs__info`,children:[(0,Y.jsxs)(`span`,{className:`oc-prefs__label`,children:[Oe(),e?(0,Y.jsx)(W,{variant:`secondary`,children:Ne(e,Pe())}):null]}),(0,Y.jsx)(`span`,{className:`oc-prefs__help`,children:a?w():r?p():Ce()})]}),(0,Y.jsxs)(`div`,{className:`oc-prefs__ctl`,children:[e&&!r?(0,Y.jsx)(`button`,{type:`button`,className:`oc-prefs__reset`,onClick:()=>void n({shortcut:null}),children:x()}):null,(0,Y.jsx)(`button`,{type:`button`,className:`oc-prefs__reset`,disabled:!t,"aria-pressed":r,onClick:()=>i(e=>!e),children:r?he():e?F():E()})]})]})}function Ze(){let[e,t]=(0,J.useState)(``),[n,r]=(0,J.useState)(!1),i=d(g.me.getMe,{host:q}),o=i?.ui,c=$(i?.role)&&n,l=A(g.me.setUiPref).withOptimisticUpdate(Ae),u=(0,J.useMemo)(()=>o?Ve(Object.keys(o.effective),e):[],[o,e]);return o?(0,Y.jsxs)(`div`,{className:`oc-prefs-panel`,children:[$(i?.role)?(0,Y.jsxs)(`label`,{className:`oc-prefs__gov-toggle`,children:[(0,Y.jsx)(K,{checked:n,onCheckedChange:e=>r(e===!0),"aria-label":k()}),k()]}):null,c?(0,Y.jsxs)(`div`,{className:`oc-prefs__gov-head`,children:[(0,Y.jsx)(`p`,{children:xe()}),(0,Y.jsx)(`p`,{children:b()}),(0,Y.jsx)(`p`,{children:ie()})]}):null,(0,Y.jsx)(G,{value:e,onChange:e=>t(e.target.value),placeholder:_(),"aria-label":_(),className:`mb-2`}),u.length===0?(0,Y.jsx)(`div`,{className:`oc-prefs__empty`,children:be()}):(0,Y.jsx)(`div`,{className:`oc-prefs`,children:u.map(e=>(0,Y.jsxs)(`section`,{className:`oc-prefs__card`,children:[(0,Y.jsx)(`h4`,{className:`oc-prefs__cat`,children:e.label}),e.keys.map(e=>{let t=Z[e],n=t?t.label():e,r=t?.help?.(),i=o.locked[e],a=o.effective[e],u=o.userOverrides[e]!==void 0;return(0,Y.jsxs)(`div`,{className:`oc-prefs__row${i?` is-locked`:``}`,children:[(0,Y.jsxs)(`div`,{className:`oc-prefs__info`,children:[(0,Y.jsxs)(`span`,{className:`oc-prefs__label`,children:[n,i?(0,Y.jsx)(W,{variant:`outline`,children:me()}):u?(0,Y.jsx)(W,{variant:`secondary`,children:s()}):null]}),r?(0,Y.jsx)(`span`,{className:`oc-prefs__help`,children:r}):null]}),(0,Y.jsxs)(`div`,{className:`oc-prefs__ctl`,children:[!i&&u?(0,Y.jsx)(`button`,{type:`button`,className:`oc-prefs__reset`,onClick:()=>void l({key:e,value:null}),children:de()}):null,(0,Y.jsx)(Be,{checked:a,disabled:i,onCheckedChange:t=>{e===`notifSystem`&&t&&typeof Notification<`u`&&Notification.permission==="default"&&Notification.requestPermission(),l({key:e,value:t})},"aria-label":n})]}),c?(0,Y.jsx)(Ye,{prefKey:e,ui:o}):null]},e)})]},e.id))}),(0,Y.jsx)(Xe,{current:i?.dictationShortcut??null,enabled:o.effective.voiceInput===!0})]}):(0,Y.jsx)(`div`,{className:`oc-prefs__empty`,children:a()})}function Qe(){let e=d(g.me.getMe,{host:q}),t=A(g.me.setLocale),n=A(g.me.setMyName),r=Re(),i=e?.locale??`default`,a=e?.name??``,[o,s]=(0,J.useState)(null),c=o??a,l=c.trim()!==a.trim();async function u(){try{await n({name:c}),s(null),r.success(v())}catch(e){r.error(Se(),e)}}return(0,Y.jsxs)(`div`,{className:`oc-appearance`,children:[(0,Y.jsxs)(`section`,{className:`oc-show__section`,children:[(0,Y.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,Y.jsx)(`h2`,{className:`oc-show__title`,children:D()}),(0,Y.jsx)(`p`,{className:`oc-show__desc`,children:I()})]}),(0,Y.jsxs)(`div`,{className:`oc-show__row`,children:[(0,Y.jsx)(G,{className:`max-w-xs`,value:c,maxLength:120,placeholder:ge(),onChange:e=>s(e.target.value),onKeyDown:e=>{e.key===`Enter`&&l&&(e.preventDefault(),u())}}),(0,Y.jsx)(H,{size:`sm`,disabled:!l,onClick:()=>void u(),children:ce()})]}),(0,Y.jsx)(`p`,{className:`oc-show__desc`,children:S()})]}),(0,Y.jsxs)(`section`,{className:`oc-show__section`,children:[(0,Y.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,Y.jsx)(`h2`,{className:`oc-show__title`,children:N()}),(0,Y.jsx)(`p`,{className:`oc-show__desc`,children:pe()})]}),(0,Y.jsxs)(`div`,{className:`oc-show__row`,children:[ze().map(e=>(0,Y.jsx)(H,{variant:i===e.value?`default`:`outline`,size:`sm`,onClick:()=>void t({locale:e.value}),children:e.label},e.value)),(0,Y.jsx)(H,{variant:i==="default"?`default`:`outline`,size:`sm`,onClick:()=>void t({locale:null}),children:we()})]}),(0,Y.jsx)(`p`,{className:`oc-show__desc`,children:ye()})]}),(0,Y.jsxs)(`section`,{className:`oc-show__section`,children:[(0,Y.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,Y.jsx)(`h2`,{className:`oc-show__title`,children:B()}),(0,Y.jsx)(`p`,{className:`oc-show__desc`,children:h()})]}),(0,Y.jsx)(Ze,{})]})]})}export{Qe as PreferencesTab};
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import{c as e,i as t,r as n}from"./bundle-mjs-BJq7W7j9.js";import{$h as r,Cg as i,Ft as a,Ji as o,MM as s,Nt as c,Pt as l,Qh as u,Qi as d,Sg as f,Xh as p,Xi as m,Yi as h,Zh as g,Zi as _,ag as v,c as y,cg as b,dg as x,dr as S,eg as C,fg as w,fr as T,hg as E,ig as D,jM as O,lg as ee,lr as k,mg as te,mr as ne,ng as re,og as ie,pg as ae,pr as A,rg as j,sg as M,tg as N,ug as P,ur as F}from"./dist-Bh78J5oj.js";import{d as I,f as L,i as R,l as z,n as B,r as V,t as H,u as U}from"./FieldLabel-B-ZBXJZE.js";import{t as W}from"./button-BWtKy7q6.js";import{C as G,S as K,b as q,p as J,w as Y,x as X,xt as oe,z as se}from"./index-BoGVkzmD.js";import{r as Z,t as ce}from"./locales-CPjguROj.js";import{t as le}from"./localePickerView-C2RmOS86.js";/* empty css */var Q=e(t(),1),$=n(),ue={media_delivery:{label:P,help:ee},documentary_fetch:{label:b,help:M},inbound_files:{label:ie,help:v},history_summary:{label:d,help:_},file_curation:{label:ne,help:A}},de={outboundDir:`/home/node/.openclaw/media/outbound`,references:`- gdrive/1a2b3c4d5e6f7890abcd
|
|
2
|
-
- gdrive/0f9e8d7c6b5a4321dcba`,files:`- /home/node/.openclaw/media/inbound/rapport.pdf (124800 o, application/pdf)`,previous_summary:`Projet Alpha : budget 40 000 EUR ; choix du serveur en cours.`,new_messages:`Utilisateur : Compare OVH et Scaleway.
|
|
3
|
-
Assistant : Comparaison en cours.`,max_chars:`6000`,file_name:`MEMORY.md`,budget_chars:`20000`,feedback:`Trop de suppressions dans la section des liens, garde-les.`,content:`# Memory index
|
|
4
|
-
- [Fait 1](fait-1.md) - note du projet`},fe={outboundDir:u,references:g,files:p,previous_summary:m,new_messages:h,max_chars:o,file_name:T,budget_chars:S,feedback:F,content:k};function pe(){let e=s(y.admin.listInstances,{}),[t,n]=(0,Q.useState)(null);if(e===void 0)return(0,$.jsx)(`div`,{className:`oc-settings__tab-loading`,"aria-busy":`true`});if(e.length===0)return(0,$.jsx)(`div`,{className:`oc-injtab`,children:(0,$.jsx)(`p`,{className:`oc-admin__hint`,children:j()})});let r=e.find(e=>e._id===t)??e[0];return(0,$.jsxs)(`div`,{className:`oc-injtab`,children:[(0,$.jsxs)(`div`,{className:`oc-injtab__head`,children:[(0,$.jsx)(B,{label:E(),help:te()}),(0,$.jsxs)(`label`,{className:`oc-injtab__picker`,children:[(0,$.jsx)(`span`,{children:D()}),(0,$.jsxs)(q,{value:r._id,onValueChange:e=>n(e),children:[(0,$.jsx)(G,{size:`sm`,className:`min-w-44`,children:(0,$.jsx)(Y,{})}),(0,$.jsx)(X,{children:e.map(e=>(0,$.jsx)(K,{value:e._id,children:e.displayName??e.name},e._id))})]})]})]}),(0,$.jsx)(me,{instance:r},r._id)]})}function me({instance:e}){let t=O(y.admin.upsertInstanceConfig),n=se(),r=s(y.me.getMe,{host:oe}),o=e.config??{},u=Z(e.config?.contentLocale,r?.defaultLocale??void 0),[d,p]=(0,Q.useState)(()=>R(o,u));(0,Q.useEffect)(()=>{p(R(o,u))},[u,e._id]);let[m,h]=(0,Q.useState)(!1),g=d.promptInjections,_=(e,t)=>p({...d,promptInjections:{...g,[e]:{...g[e],...t}}});async function v(){h(!0);try{await t({instanceId:e._id,config:V(d,o,u)})}catch(e){n.error(f(),e)}finally{h(!1)}}async function b(r){let i={...e.config??{}};r==="default"?delete i.contentLocale:i.contentLocale=r;try{await t({instanceId:e._id,config:i})}catch(e){n.error(f(),e)}}let x=e.config?.contentLocale??`default`,S=ce[Z(void 0,r?.defaultLocale??void 0)];return(0,$.jsxs)(`div`,{className:`oc-injtab__body`,children:[(0,$.jsxs)(`div`,{className:`oc-injtab__content-locale`,children:[(0,$.jsx)(`span`,{children:a()}),(0,$.jsxs)(q,{value:x,onValueChange:e=>void b(e),children:[(0,$.jsx)(G,{size:`sm`,className:`min-w-44`,children:(0,$.jsx)(Y,{})}),(0,$.jsxs)(X,{children:[(0,$.jsx)(K,{value:`default`,children:c({locale:S})}),le().map(e=>(0,$.jsx)(K,{value:e.value,children:e.label},e.value))]})]}),(0,$.jsx)(`p`,{className:`oc-admin__hint`,children:l()})]}),U.map(e=>(0,$.jsx)(he,{injKey:e,def:z[e],i18n:ue[e],row:g[e]??{enabled:!0,template:z[e].defaultTemplate[u]},contentLocale:u,onChange:t=>_(e,t)},e)),(0,$.jsx)(`div`,{className:`oc-injtab__actions`,children:(0,$.jsx)(W,{size:`sm`,onClick:()=>void v(),disabled:m,children:i()})})]})}function he({injKey:e,def:t,i18n:n,row:i,contentLocale:a,onChange:o}){let[s,c]=(0,Q.useState)(!1),l=i.template.trim()!==t.defaultTemplate[a],u=t.togglable&&!i.enabled,d=Object.fromEntries(t.placeholders.map(e=>[e,de[e]??`{${e}}`])),f=I(e,i,a),p=f?L(f,d):``;return(0,$.jsxs)(`section`,{className:`oc-injcard`,children:[(0,$.jsxs)(`div`,{className:`oc-injcard__head`,children:[t.togglable?(0,$.jsxs)(`label`,{className:`oc-field--row`,children:[(0,$.jsx)(J,{checked:i.enabled,onCheckedChange:e=>o({enabled:e===!0})}),(0,$.jsx)(B,{label:n.label(),help:n.help()})]}):(0,$.jsx)(B,{label:n.label(),help:n.help()}),l&&(0,$.jsx)(`span`,{className:`oc-injection__badge`,children:w()})]}),(0,$.jsx)(`textarea`,{className:`oc-injcard__text`,value:i.template,disabled:u,rows:8,spellCheck:!1,onChange:e=>o({template:e.target.value})}),(0,$.jsxs)(`div`,{className:`oc-injection__foot`,children:[(0,$.jsxs)(`div`,{className:`oc-injcard__phs`,children:[(0,$.jsx)(`span`,{className:`oc-injection__ph`,children:x()}),t.placeholders.map(e=>(0,$.jsxs)(`span`,{className:`oc-injcard__ph-chip`,children:[(0,$.jsx)(`code`,{children:`{${e}}`}),(0,$.jsx)(H,{text:(fe[e]??(()=>e))()})]},e))]}),(0,$.jsxs)(`div`,{className:`oc-injcard__btns`,children:[(0,$.jsx)(W,{variant:`ghost`,size:`sm`,onClick:()=>c(e=>!e),children:s?N():re()}),l&&(0,$.jsx)(W,{variant:`ghost`,size:`sm`,onClick:()=>o({template:t.defaultTemplate[a]}),children:ae()})]})]}),s&&(0,$.jsx)(`div`,{className:`oc-injcard__preview`,children:p?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`pre`,{className:`oc-injcard__previewtext`,children:p}),(0,$.jsx)(`span`,{className:`oc-injection__ph`,children:C()})]}):(0,$.jsx)(`span`,{className:`oc-injection__ph`,children:r()})})]})}export{pe as PromptInjectionsTab};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{c as e,i as t,r as n}from"./bundle-mjs-BJq7W7j9.js";import{$y as r,Ay as ee,By as i,Cy as a,Dy as o,Ey as te,Gy as s,Hy as c,Iy as l,Jy as u,Ky as d,Ly as f,MM as p,Oy as m,Qy as h,Rr as g,Ry as _,Sy as v,Ty as y,Uy as b,Vy as x,Wy as S,Xy as ne,Yy as re,Zy as ie,ab as C,c as w,cb as T,db as E,eb as D,ib as O,jM as k,ky as A,lb as j,nb as M,ob as N,qy as P,rb as F,sb as I,tb as L,ub as R,wy as ae,zy as z}from"./dist-Bh78J5oj.js";import{t as B}from"./button-BWtKy7q6.js";import{B as V,Rt as H,ct as U,lt as W,p as G,u as K,z as q}from"./index-BoGVkzmD.js";import{t as J}from"./roleDescriptions-BU7PB8ly.js";var Y=e(t(),1),X=n(),Z=[{group:()=>E(),keys:[{key:`traces.read`,label:()=>N()},{key:`traces.read.content`,label:()=>C(),phi:!0},{key:`traces.write`,label:()=>O()}]},{group:()=>R(),keys:[{key:`kpi.read`,label:()=>N()},{key:`kpi.write`,label:()=>O()}]},{group:()=>j(),keys:[{key:`openclaw.query`,label:()=>F()},{key:`anomalies.read`,label:()=>M()},{key:`anomalies.report`,label:()=>L()}]},{group:()=>T(),keys:[{key:`chats.read`,label:()=>N()},{key:`selfheal`,label:()=>r()},{key:`feedback.respond`,label:()=>g()}]},{group:()=>I(),keys:[{key:`admin.manage`,label:()=>D()}]}],oe=Z.flatMap(e=>e.keys.map(e=>e.key));function Q(e){return e.includes(`*`)}var $={key:``,name:``,description:``};function se(){let e=p(w.apiKeys.listRoles,{}),t=k(w.apiKeys.createRole),n=k(w.apiKeys.ensureRolesSeeded),r=k(w.apiKeys.updateRolePermissions).withOptimisticUpdate((e,{roleId:t,permissions:n})=>{let r=e.getQuery(w.apiKeys.listRoles,{});r&&e.setQuery(w.apiKeys.listRoles,{},r.map(e=>e._id===t?{...e,permissions:n}:e))}),g=V(),C=q(),[T,E]=(0,Y.useState)(!1),[D,O]=(0,Y.useState)($),[j,M]=(0,Y.useState)(new Set);(0,Y.useEffect)(()=>{n({}).catch(e=>{C.error(ie(),e)})},[n,C]);let N=e??[];async function F(e,t){if(Q(e.permissions)||j.has(e._id))return;let n=e.permissions.includes(t)?e.permissions.filter(e=>e!==t):[...e.permissions,t];if(!(e.builtin&&!await g({title:ne({name:e.name}),description:re(),confirmLabel:u()}))){M(t=>new Set(t).add(e._id));try{await r({roleId:e._id,permissions:n})}catch(e){C.error(P(),e)}finally{M(t=>{let n=new Set(t);return n.delete(e._id),n})}}}async function I(){try{await t({key:D.key,name:D.name,description:D.description||void 0,permissions:[]}),O($),E(!1)}catch(e){C.error(d(),e)}}let L=e===void 0,R=!L&&N.length===0;return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`p`,{className:`oc-admin__hint`,children:[s(),` `,(0,X.jsx)(`code`,{children:`admin`}),` `,S(),` `,(0,X.jsx)(`code`,{children:`traces.read.content`}),` `,b()]}),(0,X.jsxs)(`div`,{className:`oc-dt`,children:[(0,X.jsxs)(`div`,{className:`oc-dt__bar`,children:[(0,X.jsx)(`h2`,{className:`oc-dt__title`,children:c()}),(0,X.jsx)(`div`,{className:`oc-dt__bar-actions`,children:(0,X.jsx)(B,{size:`sm`,onClick:()=>{O($),E(!0)},children:x()})})]}),L?(0,X.jsx)(`p`,{className:`oc-admin__hint`,children:i()}):R?(0,X.jsx)(`p`,{className:`oc-admin__hint`,children:z()}):(0,X.jsx)(`div`,{className:`oc-matrix__scroll`,children:(0,X.jsxs)(`table`,{className:`oc-matrix`,children:[(0,X.jsxs)(`thead`,{children:[(0,X.jsxs)(`tr`,{children:[(0,X.jsx)(`th`,{className:`oc-matrix__corner`,rowSpan:2,children:_()}),Z.map(e=>(0,X.jsx)(`th`,{className:`oc-matrix__group`,colSpan:e.keys.length,children:e.group()},e.group()))]}),(0,X.jsx)(`tr`,{children:Z.flatMap(e=>e.keys.map(e=>(0,X.jsxs)(`th`,{className:`oc-matrix__perm`,title:e.phi?h({key:e.key}):e.key,children:[e.label(),e.phi?(0,X.jsx)(`span`,{className:`oc-matrix__phi`,children:` ⚠`}):null]},e.key)))})]}),(0,X.jsx)(`tbody`,{children:N.map(e=>{let t=Q(e.permissions),n=j.has(e._id);return(0,X.jsxs)(`tr`,{children:[(0,X.jsxs)(`th`,{className:`oc-matrix__rolecell`,children:[(0,X.jsxs)(`div`,{className:`oc-matrix__rolename`,children:[(0,X.jsx)(`span`,{children:e.name}),(0,X.jsx)(`code`,{className:`oc-matrix__rolekey`,children:e.key}),e.builtin?(0,X.jsxs)(U,{variant:`outline`,className:`gap-1`,children:[(0,X.jsx)(H,{}),` `,f()]}):(0,X.jsx)(U,{variant:`secondary`,children:l()})]}),J(e)?(0,X.jsx)(`p`,{className:`oc-matrix__roledesc`,children:J(e)}):null]}),oe.map(r=>(0,X.jsx)(`td`,{className:`oc-matrix__cell`,children:(0,X.jsx)(G,{checked:t||e.permissions.includes(r),disabled:t||n,"aria-label":`${e.key} · ${r}`,title:t?ee():n?A():r,onCheckedChange:()=>void F(e,r)})},r))]},e.key)})})]})})]}),(0,X.jsx)(K,{open:T,onOpenChange:E,title:m(),description:o(),canSubmit:!!(D.key&&D.name),onSubmit:I,submitLabel:te(),children:(0,X.jsxs)(`div`,{className:`oc-form`,children:[(0,X.jsxs)(`label`,{className:`oc-field`,children:[(0,X.jsx)(`span`,{className:`oc-field__label`,children:y()}),(0,X.jsx)(W,{value:D.key,placeholder:ae(),onChange:e=>O({...D,key:e.target.value})})]}),(0,X.jsxs)(`label`,{className:`oc-field`,children:[(0,X.jsx)(`span`,{className:`oc-field__label`,children:a()}),(0,X.jsx)(W,{value:D.name,onChange:e=>O({...D,name:e.target.value})})]}),(0,X.jsxs)(`label`,{className:`oc-field`,children:[(0,X.jsx)(`span`,{className:`oc-field__label`,children:v()}),(0,X.jsx)(W,{value:D.description,onChange:e=>O({...D,description:e.target.value})})]})]})})]})}export{se as RolesTab};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{c as e,i as t,r as n}from"./bundle-mjs-BJq7W7j9.js";import{CM as r,TM as i,_j as a,aj as o,bj as s,c,cj as l,dj as u,fj as d,gj as f,hj as p,kM as m,lj as h,mj as g,oj as _,pj as v,sj as y,uj as b,vj as x,yj as S}from"./dist-Bh78J5oj.js";import{t as C}from"./button-BWtKy7q6.js";import{Ft as w,ct as T}from"./index-BoGVkzmD.js";import{a as E,i as D,n as O,o as k,r as A,t as j}from"./table-EVqhs7Hw.js";var M=e(t(),1),N=n();function P(){let e=m(c.scheduled.listMyCrons),[t,n]=(0,M.useState)(null),[P,F]=(0,M.useState)(!1),[I,L]=(0,M.useState)(!1),R=(0,M.useCallback)(async()=>{F(!0),L(!1);try{n(await e({}))}catch{L(!0)}finally{F(!1)}},[e]);(0,M.useEffect)(()=>{R()},[R]);let z=(0,M.useMemo)(()=>new Intl.DateTimeFormat(i(),{dateStyle:`medium`,timeStyle:`short`}),[]),B=t?.reduce((e,t)=>e+t.jobs.length,0)??0;return(0,N.jsxs)(N.Fragment,{children:[(0,N.jsxs)(`div`,{style:{display:`flex`,alignItems:`flex-start`,gap:8,marginBottom:12},children:[(0,N.jsx)(`p`,{className:`oc-admin__hint`,style:{flex:1,margin:0},children:s()}),(0,N.jsxs)(C,{variant:`ghost`,size:`sm`,onClick:()=>void R(),disabled:P,style:{display:`inline-flex`,alignItems:`center`,gap:4},children:[(0,N.jsx)(w,{size:14,"aria-hidden":!0}),S()]})]}),t===null?(0,N.jsx)(`p`,{className:`oc-admin__hint`,"aria-busy":P,children:I?x():r()}):(0,N.jsxs)(N.Fragment,{children:[I?(0,N.jsx)(`p`,{className:`oc-admin__hint`,children:x()}):null,t.length===0?(0,N.jsx)(`p`,{className:`oc-admin__hint`,children:a()}):null,t.map(e=>(0,N.jsxs)(`section`,{style:{marginBottom:20},children:[t.length>1||e.error||!e.supported?(0,N.jsxs)(`h3`,{style:{display:`flex`,alignItems:`center`,gap:8,fontSize:`0.85rem`,fontWeight:600,margin:`0 0 6px`},children:[e.instanceName,(0,N.jsx)(T,{variant:`outline`,children:e.kind})]}):null,e.supported?e.error?(0,N.jsx)(`p`,{className:`oc-admin__hint`,children:p({code:e.error})}):e.jobs.length===0?(0,N.jsx)(`p`,{className:`oc-admin__hint`,children:g()}):(0,N.jsxs)(j,{children:[(0,N.jsx)(E,{children:(0,N.jsxs)(k,{children:[(0,N.jsx)(D,{children:v()}),(0,N.jsx)(D,{children:d()}),(0,N.jsx)(D,{children:u()}),(0,N.jsx)(D,{children:b()}),(0,N.jsx)(D,{children:h()})]})}),(0,N.jsx)(O,{children:e.jobs.map((t,n)=>(0,N.jsxs)(k,{children:[(0,N.jsx)(A,{className:`font-medium`,style:{maxWidth:280,overflow:`hidden`,textOverflow:`ellipsis`},title:t.name??void 0,children:t.name??l()}),(0,N.jsx)(A,{children:(0,N.jsx)(T,{variant:`secondary`,children:t.agentId})}),(0,N.jsx)(A,{className:`whitespace-nowrap`,style:{fontFamily:`var(--font-mono, monospace)`},children:t.schedule??`—`}),(0,N.jsx)(A,{className:`whitespace-nowrap text-muted-foreground`,children:t.nextRunAtMs===null?`—`:z.format(t.nextRunAtMs)}),(0,N.jsxs)(A,{children:[t.enabled===!0?(0,N.jsx)(T,{variant:`secondary`,children:_()}):t.enabled===!1?(0,N.jsx)(T,{variant:`outline`,children:y()}):(0,N.jsx)(`span`,{className:`text-muted-foreground`,children:`—`}),t.lastRunStatus?(0,N.jsx)(`span`,{className:`text-muted-foreground`,style:{marginLeft:8,fontSize:`0.8rem`},children:t.lastRunStatus}):null]})]},t.id??`${e.instanceName}-${n}`))})]}):(0,N.jsx)(`p`,{className:`oc-admin__hint`,children:f()})]},e.instanceName)),B>0?(0,N.jsx)(`p`,{className:`oc-admin__hint`,style:{marginTop:4},children:o()}):null]})]})}export{P as ScheduledTab};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{c as e,i as t,r as n}from"./bundle-mjs-BJq7W7j9.js";import{$D as r,AD as i,AO as ee,BD as a,BO as te,CO as ne,DO as re,EO as ie,FD as o,FO as ae,GD as s,GO as oe,HD as c,HO as l,ID as u,IO as se,JD as d,JO as ce,KD as f,KO as le,LD as p,LO as ue,MD as m,MM as h,MO as de,ND as g,NO as fe,OD as pe,OO as me,PD as he,PO as ge,QD as _e,RD as _,RO as ve,SO as ye,TO as be,UD as v,UO as xe,VD as y,VO as Se,WD as b,WO as Ce,XD as x,YD as S,ZD as C,_O as we,aO as Te,bO as Ee,c as w,cO as De,dO as Oe,eO as ke,fO as Ae,gO as je,hO as Me,iO as Ne,jD as T,jM as E,jO as Pe,kD as D,kM as Fe,kO as Ie,lO as Le,mO as Re,nO as ze,oO as Be,pO as Ve,qD as O,qO as He,rO as Ue,sO as We,tO as Ge,uO as Ke,vO as qe,wO as Je,xO as Ye,yO as Xe,zD as k,zO as Ze}from"./dist-Bh78J5oj.js";import{n as A}from"./dist-CY9tmHrN.js";import{i as Qe}from"./dist-Cj3AsyfP.js";import{t as j}from"./button-BWtKy7q6.js";import{$ as M,B as $e,C as N,S as P,Wt as F,Xt as et,Yt as tt,b as I,ct as L,dt as R,et as z,ft as B,ht as V,lt as H,mt as U,pt as nt,qt as rt,u as it,ut as W,w as G,x as K,z as at}from"./index-BoGVkzmD.js";import{t as ot}from"./FilterBar-CTBZM__z.js";import{t as st}from"./DataTableShell-DTw-rOw3.js";import{t as ct}from"./roleDescriptions-BU7PB8ly.js";var q=e(t(),1),J=n(),Y=[{value:`never`,label:()=>he(),days:null},{value:`30`,label:()=>g(),days:30},{value:`90`,label:()=>m(),days:90}],X=720*60*60*1e3,Z=`__all__`,Q={name:``,roleKey:``,description:``};function $(){let e=et({from:`/settings/serviceAccounts`}),t=tt({from:`/settings/serviceAccounts`}),n=e.q??``,i=e.status??Z,[a,o]=(0,q.useState)(Z),s=e=>void t({search:t=>({...t,q:e||void 0}),replace:!0}),c=e=>void t({search:t=>({...t,status:e===Z?void 0:e})}),u=h(w.apiKeys.listServiceAccounts,{filter:{q:n||void 0,role:a===Z?void 0:a,disabled:i===Z?void 0:i===`disabled`}}),d=h(w.apiKeys.listKeys,{}),f=h(w.apiKeys.listRoles,{}),p=E(w.apiKeys.createServiceAccount),m=E(w.apiKeys.updateServiceAccount),g=E(w.apiKeys.deleteServiceAccount),pe=Fe(w.apiKeys.mintApiKey),he=E(w.apiKeys.revokeApiKey),_=$e(),v=at(),y=n!==``||a!==Z||i!==Z;function b(){o(Z),t({search:{},replace:!0})}let[x,S]=(0,q.useState)(!1),[C,T]=(0,q.useState)(Q),[D,O]=(0,q.useState)(null),[k,A]=(0,q.useState)(new Set),[M,F]=(0,q.useState)(null),R=(0,q.useRef)(!1),[z,B]=(0,q.useState)(new Set),[V,U]=(0,q.useState)({}),[nt,W]=(0,q.useState)(null),X=(0,q.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 $(e){A(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})}async function dt(){try{D?(await m({serviceAccountId:D,name:C.name,roleKey:C.roleKey,description:C.description}),v.success(Ae())):await p({name:C.name,roleKey:C.roleKey,description:C.description||void 0}),T(Q),O(null),S(!1)}catch(e){v.error(D?Ve():Re(),e)}}function ft(e){T({name:e.name,roleKey:e.roleKey,description:e.description??``}),O(e._id),S(!0)}async function pt(e){if(R.current)return;R.current=!0;let t=V[e._id]??`never`,n=Y.find(e=>e.value===t)?.days??null,r=n?Date.now()+n*24*60*60*1e3:void 0;F(e._id);try{let t=await pe({serviceAccountId:e._id,expiresAt:r});W({accountName:e.name,plaintext:t.plaintext,prefix:t.prefix,lastFour:t.lastFour})}catch(e){v.error(Oe(),e)}finally{R.current=!1,F(null)}}async function mt(e){if(await _({title:Ke(),description:(0,J.jsxs)(J.Fragment,{children:[Le(),` `,(0,J.jsx)(`span`,{className:`font-mono`,children:e.name}),` `,De(),` `,(0,J.jsx)(`strong`,{children:We()}),` `,Be()]}),confirmWord:e.name,confirmLabel:Te(),destructive:!0}))try{await g({serviceAccountId:e._id}),v.success(Ne(),e.name)}catch(e){v.error(Ue(),e)}}async function ht(e){if(await _({title:ze(),description:(0,J.jsxs)(J.Fragment,{children:[Ge(),` `,(0,J.jsxs)(`span`,{className:`font-mono`,children:[e.prefix,`…`,e.lastFour]}),` `,ke()]}),confirmLabel:r(),destructive:!0})&&!z.has(e._id)){B(t=>new Set(t).add(e._id));try{await he({keyId:e._id})}catch(e){v.error(_e(),e)}finally{B(t=>{let n=new Set(t);return n.delete(e._id),n})}}}return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(`p`,{className:`oc-admin__hint`,children:ce()}),(0,J.jsxs)(ot,{q:n,onQChange:s,searchPlaceholder:He(),onReset:b,canReset:y,children:[(0,J.jsxs)(I,{value:a,onValueChange:o,children:[(0,J.jsx)(N,{size:`sm`,className:`w-40`,children:(0,J.jsx)(G,{placeholder:le()})}),(0,J.jsxs)(K,{children:[(0,J.jsx)(P,{value:Z,children:oe()}),(f??[]).map(e=>(0,J.jsx)(P,{value:e.key,children:e.key},e._id))]})]}),(0,J.jsxs)(I,{value:i,onValueChange:c,children:[(0,J.jsx)(N,{size:`sm`,className:`w-36`,children:(0,J.jsx)(G,{})}),(0,J.jsxs)(K,{children:[(0,J.jsx)(P,{value:Z,children:Ce()}),(0,J.jsx)(P,{value:`active`,children:xe()}),(0,J.jsx)(P,{value:`disabled`,children:l()})]})]})]}),(0,J.jsx)(st,{title:Se(),rows:u,addLabel:te(),onAdd:()=>{T(Q),O(null),S(!0)},emptyHint:Ze(),isExpanded:e=>k.has(e._id),renderExpanded:e=>(0,J.jsx)(lt,{account:e,keys:X.get(e._id)??[],onRevoke:ht,revoking:z}),rowActions:e=>[{label:ae(),onSelect:()=>ft(e)},{label:ve(),onSelect:()=>void pt(e)},{label:k.has(e._id)?ue():se(),onSelect:()=>$(e._id)},{label:ge(),variant:`destructive`,onSelect:()=>void mt(e)}],columns:[{header:``,className:`w-8`,cell:e=>(0,J.jsx)(j,{variant:`ghost`,size:`icon-sm`,"aria-label":k.has(e._id)?fe():de(),onClick:()=>$(e._id),children:k.has(e._id)?(0,J.jsx)(Qe,{}):(0,J.jsx)(rt,{})})},{header:Pe(),sort:e=>e.name,cell:e=>(0,J.jsxs)(`div`,{className:`flex flex-col`,children:[(0,J.jsx)(`span`,{children:e.name}),e.description?(0,J.jsx)(`span`,{className:`text-muted-foreground text-xs`,children:e.description}):null]})},{header:ee(),sort:e=>e.roleKey,cell:e=>(0,J.jsx)(L,{variant:`secondary`,children:e.roleKey})},{header:Ie(),sort:e=>+!!e.disabled,cell:e=>e.disabled?(0,J.jsx)(L,{variant:`destructive`,children:l()}):(0,J.jsx)(L,{variant:`outline`,children:xe()})},{header:me(),cell:e=>(0,J.jsxs)(I,{value:V[e._id]??`never`,onValueChange:t=>U(n=>({...n,[e._id]:t})),children:[(0,J.jsx)(N,{size:`sm`,className:`w-32`,children:(0,J.jsx)(G,{})}),(0,J.jsx)(K,{children:Y.map(e=>(0,J.jsx)(P,{value:e.value,children:e.label()},e.value))})]})},{header:re(),sort:e=>(X.get(e._id)??[]).filter(e=>!e.disabled).length,cell:e=>{let t=(X.get(e._id)??[]).filter(e=>!e.disabled).length;return(0,J.jsx)(`span`,{className:`oc-sa__keycount`,children:M===e._id?ie():be({count:t})})}}]}),(0,J.jsx)(it,{open:x,onOpenChange:e=>{S(e),e||O(null)},title:D?Je():Ye(),description:D?ne():Ee(),canSubmit:!!(C.name&&C.roleKey),onSubmit:dt,submitLabel:D?ye():Xe(),children:(0,J.jsxs)(`div`,{className:`oc-form`,children:[(0,J.jsxs)(`label`,{className:`oc-field`,children:[(0,J.jsx)(`span`,{className:`oc-field__label`,children:qe()}),(0,J.jsx)(H,{value:C.name,onChange:e=>T({...C,name:e.target.value})})]}),(0,J.jsxs)(`label`,{className:`oc-field`,children:[(0,J.jsx)(`span`,{className:`oc-field__label`,children:we()}),(0,J.jsxs)(I,{value:C.roleKey||void 0,onValueChange:e=>T({...C,roleKey:e}),children:[(0,J.jsx)(N,{className:`w-full`,children:(0,J.jsx)(G,{placeholder:je()})}),(0,J.jsx)(K,{children:(f??[]).map(e=>(0,J.jsxs)(P,{value:e.key,children:[e.name,` (`,e.key,`)`]},e._id))})]}),(()=>{let e=(f??[]).find(e=>e.key===C.roleKey),t=e?ct(e):null;return t?(0,J.jsx)(`span`,{className:`text-muted-foreground text-xs`,children:t}):null})()]}),(0,J.jsxs)(`label`,{className:`oc-field`,children:[(0,J.jsx)(`span`,{className:`oc-field__label`,children:Me()}),(0,J.jsx)(H,{value:C.description,onChange:e=>T({...C,description:e.target.value})})]})]})}),(0,J.jsx)(ut,{minted:nt,onClose:()=>W(null)})]})}function lt({account:e,keys:t,onRevoke:n,revoking:r}){return(0,J.jsxs)(`div`,{className:`oc-sa__keys`,children:[(0,J.jsxs)(`div`,{className:`oc-sa__keys-head`,children:[C(),` `,(0,J.jsx)(`span`,{className:`font-medium`,children:e.name})]}),t.length===0?(0,J.jsx)(`p`,{className:`oc-admin__hint`,children:x()}):(0,J.jsxs)(`table`,{className:`oc-sa__keytable`,children:[(0,J.jsx)(`thead`,{children:(0,J.jsxs)(`tr`,{children:[(0,J.jsx)(`th`,{children:S()}),(0,J.jsx)(`th`,{children:d()}),(0,J.jsx)(`th`,{children:O()}),(0,J.jsx)(`th`,{children:f()}),(0,J.jsx)(`th`,{children:s()}),(0,J.jsx)(`th`,{children:b()}),(0,J.jsx)(`th`,{})]})}),(0,J.jsx)(`tbody`,{children:t.map(t=>(0,J.jsxs)(`tr`,{children:[(0,J.jsx)(`td`,{children:(0,J.jsxs)(`code`,{className:`oc-sa__keyid`,children:[t.prefix,`…`,t.lastFour]})}),(0,J.jsx)(`td`,{children:(0,J.jsx)(L,{variant:`secondary`,children:e.roleKey})}),(0,J.jsx)(`td`,{children:z(t.createdAt)}),(0,J.jsx)(`td`,{className:dt(t.lastUsedAt)?`oc-sa__stale`:``,children:ft(t.lastUsedAt)}),(0,J.jsx)(`td`,{children:pt(t.expiresAt)}),(0,J.jsx)(`td`,{children:mt(t)}),(0,J.jsx)(`td`,{className:`text-right`,children:t.disabled?null:(0,J.jsx)(j,{variant:`destructive`,size:`sm`,disabled:r.has(t._id),onClick:()=>n(t),children:r.has(t._id)?v():c()})})]},t._id))})]})]})}function ut({minted:e,onClose:t}){let[n,r]=(0,q.useState)(!1);async function i(){if(e)try{await navigator.clipboard.writeText(e.plaintext),r(!0),window.setTimeout(()=>r(!1),2e3)}catch{}}return(0,J.jsx)(W,{open:e!==null,onOpenChange:e=>{e||(r(!1),t())},children:e?(0,J.jsxs)(R,{className:`max-w-lg`,showCloseButton:!1,onInteractOutside:e=>e.preventDefault(),onEscapeKeyDown:e=>e.preventDefault(),children:[(0,J.jsxs)(U,{children:[(0,J.jsx)(V,{children:y()}),(0,J.jsx)(B,{children:a({name:e.accountName})})]}),(0,J.jsx)(`div`,{className:`oc-sa__minted-warning`,children:k()}),(0,J.jsxs)(`div`,{className:`oc-sa__minted-box`,children:[(0,J.jsx)(`code`,{className:`oc-sa__minted-plain`,children:e.plaintext}),(0,J.jsxs)(j,{variant:`outline`,size:`sm`,onClick:()=>void i(),"aria-label":_(),children:[n?(0,J.jsx)(A,{}):(0,J.jsx)(F,{}),n?p():u()]})]}),(0,J.jsx)(nt,{children:(0,J.jsx)(j,{onClick:()=>{r(!1),t()},children:o()})})]}):null})}function dt(e){return e===null?!1:Date.now()-e>X}function ft(e){return e===null?T():z(e)}function pt(e){return e===null?`—`:M(e)}function mt(e){return e.disabled?(0,J.jsx)(L,{variant:`destructive`,children:i()}):e.expiresAt!==null&&e.expiresAt<Date.now()?(0,J.jsx)(L,{variant:`outline`,children:D()}):(0,J.jsx)(L,{variant:`outline`,children:pe()})}export{$ as ServiceAccountsTab};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{c as e,i as t,r as n}from"./bundle-mjs-BJq7W7j9.js";import{$A as r,$i as i,$k as a,AA as o,BA as s,Bk as c,CA as l,DA as u,EA as d,FA as f,Fk as p,GA as m,Gk as h,HA as g,Hk as _,IA as v,Ik as y,JA as ee,Jk as te,KA as ne,Kk as re,LA as ie,Lk as ae,MA as oe,MM as b,NA as se,OA as ce,PA as le,QA as ue,Qk as de,RA as fe,Rk as pe,SA as me,TA as he,UA as ge,Uk as _e,VA as ve,Vk as ye,WA as be,Wk as xe,XA as Se,Xk as Ce,YA as we,Yk as Te,ZA as Ee,Zk as De,_A as Oe,aA as ke,bA as x,bM as Ae,c as S,cA as je,dA as Me,eA as Ne,ea as Pe,ej as Fe,fA as Ie,gA as Le,hA as Re,iA as ze,jA as Be,jM as C,kA as Ve,kM as He,l as Ue,lA as We,mA as Ge,n as Ke,nA as qe,na as w,nj as Je,oA as Ye,pA as Xe,qA as T,qk as Ze,rA as Qe,rj as $e,sA as et,tA as E,ta as D,tj as tt,uA as nt,vA as rt,wA as it,xA as at,xM as ot,yA as st,yM as ct,zA as lt,zk as O}from"./dist-Bh78J5oj.js";import{n as k}from"./dist-CY9tmHrN.js";import{t as A}from"./x-Dj2c0suA.js";import{t as j}from"./button-BWtKy7q6.js";import{C as M,Ht as N,S as P,Ut as ut,_t as dt,at as ft,b as F,ct as I,gt as pt,it as L,lt as R,nt as mt,ot as z,p as B,rt as ht,st as gt,w as V,x as H,xt as U}from"./index-BoGVkzmD.js";import{t as _t}from"./localePickerView-C2RmOS86.js";import{a as vt,i as yt,n as bt,o as xt,r as St,t as Ct}from"./card-DXiwL4WM.js";import{a as wt,i as W,n as Tt,o as G,r as K,t as Et}from"./table-EVqhs7Hw.js";import{t as Dt}from"./TimeRangePicker-C3vWWVJs.js";import{t as Ot}from"./FilterBar-CTBZM__z.js";import{t as kt}from"./AdvancedFilter-CXI70fDB.js";var q=Ue(`upload`,[[`path`,{d:`M12 3v12`,key:`1x0j5s`}],[`path`,{d:`m17 8-5-5-5 5`,key:`7q97r8`}],[`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`,key:`ih7n3h`}]]),J=e(t(),1),At=.1,jt=[248,248,248],Mt=[24,24,24];function Nt(e,t,n){let r=t,i=n,a=-1,o=-1;for(let s=0;s<n;s++)for(let n=0;n<t;n++)e[(s*t+n)*4+3]>8&&(n<r&&(r=n),n>a&&(a=n),s<i&&(i=s),s>o&&(o=s));return a<0?null:{x:r,y:i,width:a-r+1,height:o-i+1}}function Pt(e,t,n){let r=t*n;if(r===0)return 0;let i=0;for(let t=3;t<e.length;t+=4)e[t]<=8&&i++;return i/r}function Y(e,t,n){return Pt(e,t,n)>=At}function Ft(e,t){for(let n=0;n<e.length;n+=4)e[n]=t[0],e[n+1]=t[1],e[n+2]=t[2]}function It(e){for(let t=0;t<e.length;t+=4)e[t]=255-e[t],e[t+1]=255-e[t+1],e[t+2]=255-e[t+2]}var Lt=12*1024*1024,Rt=480,zt=160,Bt=.92;async function Vt(e,t={}){if(!e.type.startsWith(`image/`))throw Error(ze());if(e.size>Lt)throw Error(Qe());let{source:n,width:r,height:i,cleanup:a}=await Ht(e);try{let a=e.type===`image/svg+xml`,o=Math.min(Rt/r,zt/i,a?1/0:1),s=Math.max(1,Math.round(r*o)),c=Math.max(1,Math.round(i*o)),l=document.createElement(`canvas`);l.width=s,l.height=c;let u=l.getContext(`2d`);if(!u)throw Error(E());u.imageSmoothingEnabled=!0,u.imageSmoothingQuality=`high`,u.drawImage(n,0,0,s,c);let d=Nt(u.getImageData(0,0,s,c).data,s,c)??{x:0,y:0,width:s,height:c},f=document.createElement(`canvas`);f.width=d.width,f.height=d.height;let p=f.getContext(`2d`);if(!p)throw Error(E());if(p.drawImage(l,d.x,d.y,d.width,d.height,0,0,d.width,d.height),t.variantFor){let e=p.getImageData(0,0,d.width,d.height);Y(e.data,d.width,d.height)?Ft(e.data,t.variantFor===`dark`?jt:Mt):It(e.data),p.putImageData(e,0,0)}let m=Y(p.getImageData(0,0,d.width,d.height).data,d.width,d.height),h=await Wt(f,`image/webp`,Bt)??await Wt(f,`image/png`);if(!h)throw Error(Ne());return{blob:h,hasAlpha:m}}finally{a()}}async function Ht(e){if(e.type===`image/svg+xml`)return Ut(e);if(typeof createImageBitmap==`function`)try{let t=await createImageBitmap(e);return{source:t,width:t.width,height:t.height,cleanup:()=>t.close()}}catch{}return Ut(e)}async function Ut(e){let t=URL.createObjectURL(e);try{let e=new Image;return e.decoding=`async`,await new Promise((n,r)=>{e.onload=()=>n(),e.onerror=()=>r(Error(qe())),e.src=t}),{source:e,width:e.naturalWidth||300,height:e.naturalHeight||150,cleanup:()=>URL.revokeObjectURL(t)}}catch(e){throw URL.revokeObjectURL(t),e}}function Wt(e,t,n){return new Promise(r=>e.toBlob(e=>r(e),t,n))}var X=n();function Gt(e,t){let n=e.trim().replace(/[^A-Za-z0-9_.-]+/g,`-`).replace(/^-+|-+$/g,``)||`chart`,r=new Blob([JSON.stringify(t,null,2)],{type:`application/json`}),i=URL.createObjectURL(r),a=document.createElement(`a`);a.href=i,a.download=`${n}.chart.json`,document.body.appendChild(a),a.click(),a.remove(),URL.revokeObjectURL(i)}var Z=`__all__`,Kt={kind:`relative`,from:`now-24h`,to:`now`},qt=[{value:`status`,label:`Statut`},{value:`latencyMs`,label:`Latence (ms)`},{value:`route`,label:`Route`},{value:`roleKey`,label:`Rôle`},{value:`correlationId`,label:`Corrélation`}];function Q({title:e,description:t,children:n}){return(0,X.jsxs)(`section`,{className:`oc-show__section`,children:[(0,X.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,X.jsx)(`h2`,{className:`oc-show__title`,children:e}),t?(0,X.jsx)(`p`,{className:`oc-show__desc`,children:t}):null]}),(0,X.jsx)(`div`,{className:`oc-show__demo`,children:n})]})}function Jt(e){return e===`light`?ot():e===`dark`?Ae():ct()}var Yt=[`primary`,`secondary`,`accent`,`muted`,`chart-1`,`chart-2`];function Xt({tokens:e,mode:t}){let n=e.colors[t];return(0,X.jsx)(`div`,{className:`oc-chart-swatches`,"aria-hidden":!0,children:Yt.map(e=>{let t=n[e];return(0,X.jsx)(`span`,{className:`oc-chart-swatch`,style:t?{background:t}:void 0},e)})})}function Zt({selected:e,title:t,subtitle:n,tokens:r,mode:i,onSelect:a,onExport:o}){return(0,X.jsxs)(`div`,{className:`oc-chart-card-wrap`,children:[(0,X.jsxs)(`button`,{type:`button`,className: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)(Xt,{tokens:r,mode:i}):(0,X.jsx)(`div`,{className:`oc-chart-swatches oc-chart-swatches--native`,"aria-hidden":!0}),(0,X.jsx)(`div`,{className:`oc-chart-card__meta`,children:(0,X.jsx)(`span`,{className:`oc-chart-card__subtitle`,children:n})})]}),o?(0,X.jsx)(j,{type:`button`,variant:`ghost`,size:`icon`,className:`oc-chart-card__export`,onClick:o,"aria-label":w(),title:w(),children:(0,X.jsx)(ut,{className:`size-4`})}):null]})}function Qt({selectedKey:e,resolvedMode:t}){let n=b(S.charts.listMyCharts),r=C(S.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:we()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:ee()})]}),(0,X.jsxs)(`div`,{className:`oc-chart-grid`,children:[(0,X.jsx)(Zt,{selected:e===null,title:T(),subtitle:ne(),tokens:null,mode:t,onSelect:()=>void i(null)}),(n??[]).map(n=>{let r=n.via===`common`?m():n.via===`owner`?be():ge({group:n.via.group});return(0,X.jsx)(Zt,{selected:e===n.key,title:n.name,subtitle:r,tokens:n.tokens,mode:t,onSelect:()=>void i(n.key),onExport:()=>Gt(n.name,n.tokens)},n.key)})]}),n!==void 0&&n.length===0?(0,X.jsx)(`p`,{className:`oc-show__desc`,children:g()}):null]})}function $t(){let e=C(S.charts.importChart),[t,n]=(0,J.useState)(``),[r,i]=(0,J.useState)(``),[a,o]=(0,J.useState)(null),[s,c]=(0,J.useState)(!1),[f,p]=(0,J.useState)(!1);async function m(e){let t=e.target.files?.[0];if(e.target.value=``,t){o(null),c(!1);try{i(await t.text())}catch{o(x())}}}async function h(){if(o(null),c(!1),t.trim()===``){o(rt());return}let a;try{a=JSON.parse(r)}catch{o(x());return}p(!0);try{await e({name:t.trim(),tokens:a}),c(!0),n(``),i(``)}catch(e){o(e instanceof Error?e.message:String(e))}finally{p(!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:ce()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:u()})]}),(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:d()}),(0,X.jsx)(R,{value:t,onChange:e=>n(e.target.value),placeholder:he(),maxLength:60})]}),(0,X.jsxs)(`label`,{className:`oc-chart-import__field`,children:[(0,X.jsx)(`span`,{className:`oc-chart-import__label`,children:it()}),(0,X.jsx)(`textarea`,{className:`oc-chart-import__textarea`,value:r,onChange:e=>i(e.target.value),placeholder:l(),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`}),me(),(0,X.jsx)(`input`,{type:`file`,accept:`application/json,.json`,className:`oc-chart-import__file-input`,onChange:e=>void m(e)})]})}),(0,X.jsx)(j,{size:`sm`,disabled:f,onClick:()=>void h(),children:at()})]}),a?(0,X.jsx)(`p`,{className:`oc-chart-import__error`,children:a}):null,s?(0,X.jsx)(`p`,{className:`oc-chart-import__ok`,children:st()}):null]})]})}function en({chart:e}){let t=He(S.charts.setChartLogo),n=C(S.charts.removeChartLogo),[r,i]=(0,J.useState)(!1),[a,o]=(0,J.useState)(null),s=t=>t===`light`?e.logoLightUrl:e.logoDarkUrl;async function c(n,r,a){if(e.chartId!==void 0){o(null),i(!0);try{let{blob:i,hasAlpha:o}=await Vt(r,a?{variantFor:a}:{}),s=await i.arrayBuffer();await t({chartId:e.chartId,bytes:s,mode:n,hasAlpha:o})}catch(e){o(e instanceof Error?e.message:String(e))}finally{i(!1)}}}async function l(e,t){let n=t.target.files?.[0];t.target.value=``,n&&await c(e,n)}async function u(t){if(e.chartId!==void 0){o(null),i(!0);try{await n({chartId:e.chartId,mode:t})}catch(e){o(e instanceof Error?e.message:String(e))}finally{i(!1)}}}async function d(e){let t=s(e===`light`?`dark`:`light`);if(t){o(null),i(!0);try{await c(e,await(await fetch(t)).blob(),e)}catch(e){o(e instanceof Error?e.message:String(e))}finally{i(!1)}}}function f({mode:e}){let t=s(e),n=s(e===`light`?`dark`:`light`);return(0,X.jsxs)(`div`,{className:`oc-chart-mine__logo-slot`,children:[(0,X.jsx)(`span`,{className:`oc-chart-mine__logo-mode`,children:e===`light`?Me():nt()}),(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?je():We(),(0,X.jsx)(`input`,{type:`file`,accept:`image/*`,className:`oc-chart-import__file-input`,onChange:t=>void l(e,t)})]})}),!t&&n?(0,X.jsx)(j,{variant:`ghost`,size:`sm`,disabled:r,onClick:()=>void d(e),children:Ye()}):null,t?(0,X.jsx)(j,{variant:`ghost`,size:`sm`,disabled:r,onClick:()=>void u(e),children:et()}):null]})}return(0,X.jsxs)(`div`,{className:`oc-chart-mine__logo`,children:[(0,X.jsx)(`span`,{className:`oc-chart-mine__groups-label`,children:Ie()}),(0,X.jsxs)(`div`,{className:`oc-chart-mine__logo-slots`,children:[(0,X.jsx)(f,{mode:`light`}),(0,X.jsx)(f,{mode:`dark`})]}),r?(0,X.jsx)(`span`,{className:`oc-show__desc`,children:ke()}):null,a?(0,X.jsx)(`p`,{className:`oc-chart-import__error`,children:a}):null]})}function tn({chart:e}){let t=b(S.me.getMe,{host:U}),n=C(S.charts.addChartDomain),r=C(S.charts.removeChartDomain),[i,o]=(0,J.useState)(``),[s,c]=(0,J.useState)(null),[l,u]=(0,J.useState)(!1);if(t?.role!==`admin`)return null;let d=e.domains??[];async function f(){let t=i.trim();if(t!==``){c(null),u(!0);try{await n({chartKey:e.key,domain:t}),o(``)}catch(e){c(e instanceof Error?e.message:String(e))}finally{u(!1)}}}async function p(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:d.length===0?(0,X.jsx)(`span`,{className:`oc-show__desc`,children:Te()}):d.map(e=>(0,X.jsxs)(I,{variant:`secondary`,className:`oc-chart-avail__chip`,children:[e,(0,X.jsx)(`button`,{type:`button`,className:`oc-chart-avail__chip-x`,"aria-label":te({domain:e}),onClick:()=>void p(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:De(),className:`oc-chart-mine__domains-input`,onKeyDown:e=>{e.key===`Enter`&&f()}}),(0,X.jsx)(j,{variant:`outline`,size:`sm`,disabled:l,onClick:()=>void f(),children:Ce()})]}),(0,X.jsx)(`span`,{className:`oc-show__desc`,children:de()}),s?(0,X.jsx)(`p`,{className:`oc-chart-import__error`,children:s}):null]})]})}function $(e){let t={...e};return delete t.bpm,JSON.stringify(t,null,2)}function nn({chart:e}){let t=C(S.charts.updateChart),n=C(S.charts.deleteChart),[r,a]=(0,J.useState)(!1),[o,s]=(0,J.useState)(e.name),[c,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 _(){s(e.name),l($(e.tokens)),d(e.tokens.bpm??0),p(null),a(!0)}async function v(){if(e.chartId===void 0)return;p(null);let n;try{n=JSON.parse(c)}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:o.trim(),tokens:n}),a(!1)}catch(e){p(e instanceof Error?e.message:String(e))}finally{g(!1)}}async function y(){if(e.chartId!==void 0&&window.confirm(_e()))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:Ge()}),(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:h()}),(0,X.jsx)(R,{value:o,onChange:e=>s(e.target.value),maxLength:60})]}),(0,X.jsxs)(`div`,{className:`oc-chart-import__field`,children:[(0,X.jsx)(`span`,{className:`oc-chart-import__label`,children:D()}),(0,X.jsxs)(`div`,{className:`oc-chart-bpm`,children:[(0,X.jsx)(`input`,{type:`range`,className:`oc-chart-bpm__slider`,min:0,max:90,step:5,value:u,onChange:e=>d(Number(e.target.value)),"aria-label":D()}),(0,X.jsx)(`span`,{className:`oc-chart-bpm__value`,children:u===0?Pe():`${u} BPM`})]}),(0,X.jsx)(`span`,{className:`oc-show__desc`,children:i()})]}),(0,X.jsxs)(`label`,{className:`oc-chart-import__field`,children:[(0,X.jsx)(`span`,{className:`oc-chart-import__label`,children:xe()}),(0,X.jsx)(`textarea`,{className:`oc-chart-import__textarea`,value:c,onChange:e=>l(e.target.value),rows:10,spellCheck:!1})]}),f?(0,X.jsx)(`p`,{className:`oc-chart-import__error`,children:f}):null,(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsx)(j,{size:`sm`,disabled:m,onClick:()=>void v(),children:Ze()}),(0,X.jsx)(j,{variant:`ghost`,size:`sm`,onClick:()=>a(!1),children:re()})]})]}):null,(0,X.jsx)(en,{chart:e}),(0,X.jsx)(tn,{chart:e})]})}function rn(){let e=b(S.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:Oe()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:Le()})]}),e!==void 0&&t.length===0?(0,X.jsx)(`p`,{className:`oc-show__desc`,children:Re()}):(0,X.jsx)(`div`,{className:`oc-chart-mine-list`,children:t.map(e=>(0,X.jsx)(nn,{chart:e},e.key))})]})}function an({chart:e,groups:t}){let n=C(S.charts.addChartToGroupPool),r=C(S.charts.removeChartFromGroupPool),i=e.restrictedToGroups,a=e.poolGroups,s=new Set((a??[]).map(e=>e.groupId)),c=t.filter(e=>!s.has(e._id));async function l(t){try{await n({groupId:t,chartKey:e.key})}catch{}}async function u(t){try{await r({groupId:t,chartKey:e.key})}catch{}}return(0,X.jsxs)(`div`,{className:`oc-chart-avail`,children:[(0,X.jsxs)(`div`,{className:`oc-chart-avail__head`,children:[(0,X.jsx)(`span`,{className:`oc-chart-avail__name`,children:e.name}),(0,X.jsx)(I,{variant:i?`secondary`:`outline`,className:`oc-chart-avail__state`,children:i?le():e.kind===`custom`&&e.scope===`personal`?O():f()}),e.isGlobalDefault?(0,X.jsx)(I,{variant:`default`,children:se()}):null]}),(0,X.jsxs)(`div`,{className:`oc-chart-avail__groups`,children:[(0,X.jsx)(`span`,{className:`oc-chart-mine__groups-label`,children:Be()}),(a??[]).map(e=>(0,X.jsxs)(I,{variant:`secondary`,className:`oc-chart-avail__chip`,children:[e.name,(0,X.jsx)(`button`,{type:`button`,className:`oc-chart-avail__chip-x`,"aria-label":Ve({group:e.name}),onClick:()=>void u(e.groupId),children:(0,X.jsx)(A,{className:`size-3`})})]},e.groupId)),c.length>0?(0,X.jsxs)(F,{value:``,onValueChange:e=>void l(e),children:[(0,X.jsx)(M,{size:`sm`,className:`w-56`,children:(0,X.jsx)(V,{placeholder:o()})}),(0,X.jsx)(H,{children:c.map(e=>(0,X.jsx)(P,{value:e._id,children:e.name},e._id))})]}):t.length===0?(0,X.jsx)(`span`,{className:`oc-show__desc`,children:oe()}):null]})]})}function on({chart:e}){let t=C(S.charts.promoteChartToCommon),n=C(S.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(_e()))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)(I,{variant:e.scope===`common`?`outline`:`secondary`,children:e.scope===`common`?pe():O()}),e.ownerLabel?(0,X.jsx)(`span`,{className:`oc-show__desc`,children:c({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:ae()}):null,(0,X.jsx)(j,{variant:`ghost`,size:`sm`,onClick:()=>void i(),children:y()})]})]})}function sn({defaultThemeMode:e,defaultLocale:t,defaultChartKey:n}){let i=C(S.admin.setDefaultThemeMode),a=C(S.admin.setDefaultLocale),o=C(S.charts.setDefaultChart),c=b(S.charts.listChartsAdmin),l=b(S.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:Ee()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:Se()})]}),(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:ve()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:s()})]}),(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsx)(j,{variant:n===null?`default`:`outline`,size:`sm`,onClick:()=>void o({name:null}),children:T()}),dt.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)),(c??[]).filter(e=>e.kind===`custom`&&e.scope===`common`).map(e=>(0,X.jsx)(j,{variant:n===e.key?`default`:`outline`,size:`sm`,onClick:()=>void o({name:e.key}),children:e.name},e.key))]})]}),(0,X.jsxs)(`section`,{className:`oc-show__section`,children:[(0,X.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,X.jsx)(`h3`,{className:`oc-show__title`,children:lt()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:fe()})]}),(0,X.jsx)(`div`,{className:`oc-chart-avail-list`,children:(c??[]).filter(e=>!(e.kind===`custom`&&e.scope===`common`)).map(e=>(0,X.jsx)(an,{chart:e,groups:l??[]},e.key))})]}),(0,X.jsxs)(`section`,{className:`oc-show__section`,children:[(0,X.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,X.jsx)(`h3`,{className:`oc-show__title`,children:ie()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:v()})]}),(0,X.jsx)(`div`,{className:`oc-chart-avail-list`,children:(c??[]).filter(e=>e.kind===`builtin`||e.scope===`common`).map(e=>(0,X.jsxs)(`div`,{className:`oc-chart-avail`,children:[(0,X.jsx)(`div`,{className:`oc-chart-avail__head`,children:(0,X.jsx)(`span`,{className:`oc-chart-avail__name`,children:e.name})}),(0,X.jsx)(tn,{chart:e})]},e.key))})]}),(0,X.jsxs)(`section`,{className:`oc-show__section`,children:[(0,X.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,X.jsx)(`h3`,{className:`oc-show__title`,children:_()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:ye()})]}),(()=>{let e=(c??[]).filter(e=>e.kind===`custom`);return e.length===0?(0,X.jsx)(`p`,{className:`oc-show__desc`,children:p()}):(0,X.jsx)(`div`,{className:`oc-chart-avail-list`,children:e.map(e=>(0,X.jsx)(on,{chart:e},e.key))})})()]}),(0,X.jsxs)(`section`,{className:`oc-show__section`,children:[(0,X.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,X.jsx)(`h3`,{className:`oc-show__title`,children:$e()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:Je()})]}),(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 i({mode:e}),children:Jt(e)},e))})]}),(0,X.jsxs)(`section`,{className:`oc-show__section`,children:[(0,X.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,X.jsx)(`h3`,{className:`oc-show__title`,children:tt()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:Fe()})]}),(0,X.jsx)(`div`,{className:`oc-show__row`,children:_t().map(e=>(0,X.jsx)(j,{variant:d===e.value?`default`:`outline`,size:`sm`,onClick:()=>void a({locale:e.value}),children:e.label},e.value))}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:r()})]})]})}function cn(){let e=b(S.me.getMe,{host:U}),t=pt(e?.resolvedThemeMode);return(0,X.jsxs)(`div`,{className:`oc-appearance`,children:[(0,X.jsx)(Qt,{selectedKey:e?.chartKey??null,resolvedMode:t}),(0,X.jsx)($t,{}),(0,X.jsx)(rn,{}),e?.role===`admin`?(0,X.jsx)(sn,{defaultThemeMode:e.defaultThemeMode,defaultLocale:e.defaultLocale,defaultChartKey:e.defaultChartKey}):null]})}function ln(){let[e,t]=(0,J.useState)(!0),[n,r]=(0,J.useState)(`per-user`),[i,a]=(0,J.useState)(``),[o,s]=(0,J.useState)(Z),[c,l]=(0,J.useState)(Z),[u,d]=(0,J.useState)(Kt),f=i!==``||o!==Z||c!==Z;function p(){a(``),s(Z),l(Z),d(Kt)}return(0,X.jsxs)(`div`,{className:`oc-show`,children:[(0,X.jsx)(cn,{}),(0,X.jsxs)(`details`,{className:`oc-show__ref`,children:[(0,X.jsx)(`summary`,{className:`oc-show__title`,children:ue()}),(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)(N,{})}),(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)(I,{children:`Default`}),(0,X.jsx)(I,{variant:`secondary`,children:`Secondary`}),(0,X.jsx)(I,{variant:`outline`,children:`Outline`}),(0,X.jsx)(I,{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)(F,{value:n,onValueChange:r,children:[(0,X.jsx)(M,{className:`w-56`,children:(0,X.jsx)(V,{placeholder:`Select…`})}),(0,X.jsxs)(H,{children:[(0,X.jsx)(P,{value:`per-user`,children:`per-user (chacun son agent)`}),(0,X.jsx)(P,{value:`shared`,children:`shared (agent commun)`})]})]}),(0,X.jsxs)(`label`,{className:`oc-show__check`,children:[(0,X.jsx)(B,{checked:e,onCheckedChange:e=>t(!!e)}),`Checkbox`]})]})]})}),(0,X.jsx)(Q,{title:`Filtres & plage temporelle`,description:`Barre réutilisable (recherche debouncée + selects rapides à largeur auto + plage façon Grafana) et constructeur de filtre avancé. Câblée dans Users, Groups, Comptes de service, Traces, Anomalies, Audit et KPI.`,children:(0,X.jsxs)(`div`,{className:`oc-show__row oc-show__row--col`,children:[(0,X.jsxs)(Ot,{q:i,onQChange:a,searchPlaceholder:`Rechercher (kind, principal, rôle, route…)`,timeRange:u,onTimeRangeChange:d,onReset:p,canReset:f,children:[(0,X.jsxs)(F,{value:o,onValueChange:s,children:[(0,X.jsx)(M,{size:`sm`,children:(0,X.jsx)(V,{})}),(0,X.jsxs)(H,{children:[(0,X.jsx)(P,{value:Z,children:`Toutes directions`}),(0,X.jsx)(P,{value:`inbound`,children:`inbound`}),(0,X.jsx)(P,{value:`outbound`,children:`outbound`}),(0,X.jsx)(P,{value:`internal`,children:`internal`})]})]}),(0,X.jsxs)(F,{value:c,onValueChange:l,children:[(0,X.jsx)(M,{size:`sm`,children:(0,X.jsx)(V,{})}),(0,X.jsxs)(H,{children:[(0,X.jsx)(P,{value:Z,children:`Toutes sévérités`}),(0,X.jsx)(P,{value:`info`,children:`info`}),(0,X.jsx)(P,{value:`warn`,children:`warn`}),(0,X.jsx)(P,{value:`critical`,children:`critical`})]})]})]}),(0,X.jsx)(kt,{fields:qt,onChange:()=>{}}),(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsx)(`span`,{className:`oc-show__desc`,children:`Sélecteur de plage seul :`}),(0,X.jsx)(Dt,{value:u,onChange:d})]})]})}),(0,X.jsx)(Q,{title:`Dropdown menu`,description:`Row actions / kebab`,children:(0,X.jsxs)(mt,{children:[(0,X.jsx)(gt,{asChild:!0,children:(0,X.jsx)(j,{variant:`outline`,size:`icon`,"aria-label":`Open menu`,children:(0,X.jsx)(N,{})})}),(0,X.jsxs)(ht,{align:`start`,children:[(0,X.jsx)(ft,{children:`Actions`}),(0,X.jsx)(z,{}),(0,X.jsx)(L,{children:`Edit`}),(0,X.jsx)(L,{children:`Duplicate`}),(0,X.jsx)(z,{}),(0,X.jsx)(L,{variant:`destructive`,children:`Delete`})]})]})}),(0,X.jsx)(Q,{title:`Card`,children:(0,X.jsxs)(Ct,{className:`w-80`,children:[(0,X.jsxs)(vt,{children:[(0,X.jsx)(xt,{children:`Instance`}),(0,X.jsx)(St,{children:`Non-secret metadata only.`})]}),(0,X.jsx)(bt,{className:`text-sm text-muted-foreground`,children:`ws://gateway.example.org:18789`}),(0,X.jsxs)(yt,{className:`gap-2`,children:[(0,X.jsx)(j,{size:`sm`,children:`Save`}),(0,X.jsx)(j,{size:`sm`,variant:`ghost`,children:`Cancel`})]})]})}),(0,X.jsx)(Q,{title:`Table`,children:(0,X.jsxs)(Et,{children:[(0,X.jsx)(wt,{children:(0,X.jsxs)(G,{children:[(0,X.jsx)(W,{className:`w-8`,children:(0,X.jsx)(B,{"aria-label":`select all`})}),(0,X.jsx)(W,{children:`Name`}),(0,X.jsx)(W,{children:`Mode`}),(0,X.jsx)(W,{className:`text-right`,children:`Status`}),(0,X.jsx)(W,{className:`w-8`})]})}),(0,X.jsx)(Tt,{children:[{n:`admins`,m:`per-user`,s:`active`},{n:`family`,m:`shared`,s:`active`}].map(e=>(0,X.jsxs)(G,{children:[(0,X.jsx)(K,{children:(0,X.jsx)(B,{"aria-label":`select ${e.n}`})}),(0,X.jsx)(K,{className:`font-medium`,children:e.n}),(0,X.jsx)(K,{children:(0,X.jsx)(I,{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)(N,{})})})]},e.n))})]})}),(0,X.jsx)(Q,{title:`App fragments`,description:`Chat-specific components`,children:(0,X.jsxs)(`div`,{className:`oc-show__row oc-show__row--col`,children:[(0,X.jsx)(`div`,{className:`oc-msg oc-msg--assistant`,children:(0,X.jsx)(`div`,{className:`oc-msg__body`,children:`Assistant message bubble.`})}),(0,X.jsx)(`div`,{className:`oc-tool oc-tool--completed`,children:(0,X.jsxs)(`div`,{className:`oc-tool__header`,children:[(0,X.jsx)(`span`,{className:`oc-tool__icon`,children:`✓`}),(0,X.jsx)(`span`,{className:`oc-tool__name`,children:`write-file`}),(0,X.jsx)(`span`,{className:`oc-tool__phase`,children:`completed`})]})}),(0,X.jsxs)(`div`,{className:`oc-run-status oc-run-status--streaming`,children:[(0,X.jsx)(`span`,{className:`oc-run-status__dot`}),(0,X.jsx)(`span`,{className:`oc-run-status__label`,children:`Running`})]})]})})]})]})}export{ln as ThemeShowroom};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{c as e,i as t,r as n}from"./bundle-mjs-BJq7W7j9.js";import{$_ as r,$w as i,A_ as a,Aw as o,B_ as s,C_ as c,D_ as l,Dw as u,E_ as d,Ew as f,F_ as p,Fw as m,G_ as h,Gw as g,H_ as _,I_ as v,Iw as y,J_ as ee,Jw as b,K_ as te,Kw as x,L_ as ne,Lw as re,MM as S,M_ as ie,Mw as C,N_ as ae,Nw as w,O_ as oe,Ow as T,P_ as se,Pw as ce,Q_ as le,Qt as E,Qw as ue,R_ as de,Rw as fe,S_ as pe,T_ as me,Tw as he,U_ as ge,Uw as _e,V_ as ve,W_ as ye,Ww as D,X_ as be,Xt as xe,Xw as Se,Y_ as Ce,Yw as O,Z_ as we,Zt as k,Zw as Te,__ as A,aT as Ee,b_ as De,c as j,cT as Oe,dT as ke,eT as M,ev as Ae,fT as je,iT as N,jM as P,j_ as Me,jw as F,k_ as Ne,kw as Pe,l as I,lT as Fe,nT as Ie,oT as Le,pT as Re,q_ as ze,qw as Be,rT as Ve,sT as He,tT as L,tv as Ue,uT as We,v_ as Ge,w_ as Ke,ww as qe,x_ as Je,y_ as Ye,z_ as Xe}from"./dist-Bh78J5oj.js";import{n as Ze}from"./dist-CY9tmHrN.js";import{t as Qe}from"./x-Dj2c0suA.js";import{i as R,n as z,r as $e,t as et}from"./tabs-BQAkx85P.js";import{t as B}from"./button-BWtKy7q6.js";import{Bt as tt,C as V,S as H,Vt as nt,Wt as rt,Xt as it,Yt as at,a as ot,b as U,ct as W,dt as st,et as G,ft as ct,ht as lt,i as ut,j as dt,mt as ft,o as pt,r as mt,tt as ht,ut as gt,w as K,x as q,xt as _t}from"./index-BoGVkzmD.js";import{n as vt}from"./TimeRangePicker-C3vWWVJs.js";import{t as yt}from"./FilterBar-CTBZM__z.js";import{t as bt}from"./AdvancedFilter-CXI70fDB.js";import{t as xt}from"./DataTableShell-DTw-rOw3.js";var St=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`}]]),Ct=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=e(t(),1),Y=n(),X={kind:`relative`,from:`now-520w`,to:`now`},Z=e=>e===null?`-`:String(Math.round(e));function wt(e){let t=e.indexOf(`:`);if(t<0)return e;let n=e.slice(0,t),r=e.slice(t+1);return n===`admin`?b():n===`agent`?`${Be()} - ${r}`:e}function Tt(){let e=S(j.me.getMe,{host:_t})?.role===`admin`,t=S(j.deliveryTiming.getDeliveryStatus,{}),n=P(j.deliveryTiming.startDeliveryRecord),r=P(j.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:Re()}),(0,Y.jsx)(`p`,{className:`oc-admin__hint`,children:je()})]}),e?(0,Y.jsx)(B,{variant:c?`destructive`:`default`,size:`sm`,disabled:o||t===void 0,onClick:()=>void l(),children:c?We():ke()}):null]}),c?(0,Y.jsxs)(`p`,{className:`flex items-center gap-2 text-sm`,children:[(0,Y.jsx)(W,{variant:`secondary`,children:Fe()}),t?.startedAt?(0,Y.jsx)(`span`,{className:`text-muted-foreground`,children:Oe({time:ht(t.startedAt)})}):null]}):null,(0,Y.jsx)(`div`,{children:(0,Y.jsx)(B,{variant:`outline`,size:`sm`,onClick:()=>a(e=>!e),children:i?Ee():Le()})}),i?(0,Y.jsx)(Et,{isAdmin:e}):null]})}function Et({isAdmin:e}){let t=S(j.deliveryTiming.listDeliverySessions,{}),n=P(j.deliveryTiming.deleteDeliverySessions),[r,a]=(0,J.useState)(``),[o,s]=(0,J.useState)(`all`),[c,l]=(0,J.useState)(X),[u,d]=(0,J.useState)(null),{from:f,to:p}=vt(c),m=c.to===`now`?1/0:p,h=r.trim()!==``||o!==`all`||c!==X,_=()=>{a(``),s(`all`),l(X)},v=(0,J.useMemo)(()=>{if(t===void 0)return;let e=r.trim().toLowerCase();return t.filter(t=>(e===``||t.startedBy.toLowerCase().includes(e))&&(o===`all`||(o===`active`?t.active:!t.active))&&t.startedAt>=f&&t.startedAt<=m).map(e=>({...e,_id:e.sessionId}))},[t,r,o,f,m]),y=e=>{let t=new Set((v??[]).map(e=>e.sessionId)),r=e.filter(e=>t.has(e));r.length!==0&&(n({sessionIds:r}),u!==null&&r.includes(u)&&d(null))};return(0,Y.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Y.jsx)(yt,{q:r,onQChange:a,searchPlaceholder:Ve(),timeRange:c,onTimeRangeChange:l,onReset:_,canReset:h,children:(0,Y.jsxs)(U,{value:o,onValueChange:e=>s(e),children:[(0,Y.jsx)(V,{size:`sm`,className:`w-36`,children:(0,Y.jsx)(K,{})}),(0,Y.jsxs)(q,{children:[(0,Y.jsx)(H,{value:`all`,children:Ie()}),(0,Y.jsx)(H,{value:`active`,children:L()}),(0,Y.jsx)(H,{value:`stopped`,children:M()})]})]})}),(0,Y.jsx)(xt,{title:N(),rows:v,emptyHint:he(),columns:[{header:``,className:`w-8`,cell:e=>(0,Y.jsx)(B,{variant:`ghost`,size:`icon`,"aria-label":u===e.sessionId?g():x(),onClick:()=>d(t=>t===e.sessionId?null:e.sessionId),children:u===e.sessionId?(0,Y.jsx)(St,{size:15,"aria-hidden":!0}):(0,Y.jsx)(nt,{size:15,"aria-hidden":!0})})},{header:i(),sort:e=>e.startedAt,cell:e=>(0,Y.jsx)(`span`,{className:`tabular-nums`,children:G(e.startedAt)})},{header:ue(),sort:e=>e.stoppedAt,cell:e=>e.stoppedAt===null?(0,Y.jsx)(`span`,{className:`text-muted-foreground`,children:`-`}):(0,Y.jsx)(`span`,{className:`tabular-nums`,children:G(e.stoppedAt)})},{header:Te(),sort:e=>e.count,cell:e=>(0,Y.jsx)(`span`,{className:`tabular-nums`,children:Z(e.count)})},{header:Se(),sort:e=>e.startedBy,cell:e=>wt(e.startedBy)},{header:O(),sort:e=>e.active,cell:e=>e.active?(0,Y.jsx)(W,{variant:`secondary`,children:L()}):(0,Y.jsx)(`span`,{className:`text-muted-foreground`,children:M()})}],rowActions:e?e=>[{label:D(),variant:`destructive`,onSelect:()=>y([e.sessionId])}]:void 0,bulkActions:e?[{label:D(),variant:`destructive`,onSelect:e=>y(e)}]:void 0,isExpanded:e=>e.sessionId===u,renderExpanded:e=>(0,Y.jsx)(Dt,{sessionId:e.sessionId})})]})}function Dt({sessionId:e}){let t=S(j.deliveryTiming.getDeliveryReport,{sessionId:e}),[n,r]=(0,J.useState)(!1);return(0,Y.jsx)(Ot,{report:t,copied:n,onCopy:()=>{t&&navigator.clipboard?.writeText(dt(t)).then(()=>{r(!0),window.setTimeout(()=>r(!1),1200)}).catch(()=>{})}})}function Ot({report:e,copied:t,onCopy:n}){if(!e)return(0,Y.jsx)(`p`,{className:`oc-admin__hint`,children:_e()});if(e.count===0||e.segments===null)return(0,Y.jsx)(`p`,{className:`oc-admin__hint`,children:He()});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,` `,qe()]}),(0,Y.jsxs)(B,{variant:`outline`,size:`sm`,onClick:n,children:[t?(0,Y.jsx)(Ze,{size:13,"aria-hidden":!0}):(0,Y.jsx)(rt,{size:13,"aria-hidden":!0}),t?f():u()]})]}),(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:y()}),(0,Y.jsx)(`th`,{className:`py-1 text-right font-medium`,children:m()}),(0,Y.jsx)(`th`,{className:`py-1 text-right font-medium`,children:ce()})]})}),(0,Y.jsxs)(`tbody`,{children:[i(w(),r.bridge),i(C(),r.A),i(F(),r.C)]})]}),(0,Y.jsx)(`p`,{className:`oc-admin__hint`,children:o()}),e.truncated?(0,Y.jsx)(`p`,{className:`oc-admin__hint`,children:T()}):null,(0,Y.jsx)(`p`,{className:`oc-admin__hint`,children:Pe()})]})}var kt=[50,100,200,500],At=`all`,Q=`__all__`,jt=[`2xx`,`4xx`,`5xx`],Mt=[`user`,`service`,`system`],Nt=[`inbound`,`outbound`,`internal`],Pt={kind:`relative`,from:`now-30d`,to:`now`},Ft=[{value:`kind`,label:`kind`},{value:`status`,label:`status`},{value:`latencyMs`,label:E()},{value:`principalType`,label:k()},{value:`direction`,label:`direction`},{value:`roleKey`,label:xe()},{value:`route`,label:`route`},{value:`correlationId`,label:`correlationId`}];function It(){let e=it({from:`/settings/traces`}),t=at({from:`/settings/traces`}),n=e.limit,i=e.kind,o=e.statusClass??Q,u=e.principalType??Q,f=e.direction??Q,m=e.roleKey??Q,g=e.q??``,y=mt(e.from,e.to),b=(0,J.useMemo)(()=>pt(e.adv),[e.adv]),{from:x,to:C}=vt(y),[w,T]=(0,J.useState)(null),[ce,E]=(0,J.useState)(null),ue=e=>void t({search:t=>({...t,limit:e})}),he=e=>void t({search:t=>({...t,kind:e})}),_e=e=>void t({search:t=>({...t,q:e||void 0}),replace:!0}),D=e=>void t({search:t=>({...t,statusClass:e===Q?void 0:e})}),xe=e=>void t({search:t=>({...t,principalType:e===Q?void 0:e})}),Se=e=>void t({search:t=>({...t,direction:e===Q?void 0:e})}),O=e=>void t({search:t=>({...t,roleKey:e===Q?void 0:e})}),k=e=>void t({search:t=>({...t,...ot(e)})}),Te=e=>void t({search:t=>({...t,adv:ut(e)}),replace:!0}),A=S(j.observability.listEvents,{limit:n}),Ee=S(j.observability.listEvents,{limit:n,kind:i===At?void 0:i,filter:{q:g||void 0,from:x,to:C,statusClass:o===Q?void 0:o,principalType:u===Q?void 0:u,direction:f===Q?void 0:f,roleKey:m===Q?void 0:m,advanced:b.length>0?b:void 0}}),Oe=(0,J.useMemo)(()=>{let e=new Set;for(let t of A??[])e.add(t.kind);return[...e].sort()},[A]),ke=(0,J.useMemo)(()=>{let e=new Set;for(let t of A??[])t.roleKey&&e.add(t.roleKey);return[...e].sort()},[A]),M=g!==``||o!==Q||u!==Q||f!==Q||m!==Q||b.length>0||y.kind!==`relative`||y.from!==Pt.from;function je(){t({search:{limit:100,kind:`all`},replace:!0})}let N=w?A?.filter(e=>e.correlationId===w):Ee,P=e.section,F=e=>void t({search:t=>({...t,section:e}),replace:!0});return(0,Y.jsxs)(et,{value:P,onValueChange:e=>F(e),children:[(0,Y.jsxs)($e,{className:`w-full`,children:[(0,Y.jsxs)(R,{value:`latency`,className:`flex-1 gap-1.5`,children:[(0,Y.jsx)(tt,{size:13,"aria-hidden":!0}),fe()]}),(0,Y.jsxs)(R,{value:`events`,className:`flex-1 gap-1.5`,children:[(0,Y.jsx)(Ct,{size:13,"aria-hidden":!0}),re()]})]}),(0,Y.jsx)(z,{value:`latency`,children:(0,Y.jsx)(Tt,{})}),(0,Y.jsxs)(z,{value:`events`,className:`flex flex-col gap-3`,children:[(0,Y.jsxs)(`p`,{className:`oc-admin__hint`,children:[Ue(),(0,Y.jsx)(`strong`,{children:Ae()}),r(),` `,(0,Y.jsx)(`span`,{className:`oc-filter__window`,children:le()})]}),(0,Y.jsxs)(yt,{q:g,onQChange:_e,searchPlaceholder:we(),timeRange:y,onTimeRangeChange:k,onReset:je,canReset:M,children:[(0,Y.jsxs)(U,{value:o,onValueChange:D,children:[(0,Y.jsx)(V,{size:`sm`,className:`w-32`,children:(0,Y.jsx)(K,{placeholder:be()})}),(0,Y.jsxs)(q,{children:[(0,Y.jsx)(H,{value:Q,children:Ce()}),jt.map(e=>(0,Y.jsx)(H,{value:e,children:e},e))]})]}),(0,Y.jsxs)(U,{value:u,onValueChange:xe,children:[(0,Y.jsx)(V,{size:`sm`,className:`w-32`,children:(0,Y.jsx)(K,{placeholder:ee()})}),(0,Y.jsxs)(q,{children:[(0,Y.jsx)(H,{value:Q,children:ze()}),Mt.map(e=>(0,Y.jsx)(H,{value:e,children:e},e))]})]}),(0,Y.jsxs)(U,{value:f,onValueChange:Se,children:[(0,Y.jsx)(V,{size:`sm`,className:`w-32`,children:(0,Y.jsx)(K,{placeholder:te()})}),(0,Y.jsxs)(q,{children:[(0,Y.jsx)(H,{value:Q,children:h()}),Nt.map(e=>(0,Y.jsx)(H,{value:e,children:e},e))]})]}),(0,Y.jsxs)(U,{value:m,onValueChange:O,children:[(0,Y.jsx)(V,{size:`sm`,className:`w-36`,children:(0,Y.jsx)(K,{placeholder:ye()})}),(0,Y.jsxs)(q,{children:[(0,Y.jsx)(H,{value:Q,children:ge()}),ke.map(e=>(0,Y.jsx)(H,{value:e,children:e},e))]})]}),(0,Y.jsxs)(U,{value:i,onValueChange:he,children:[(0,Y.jsx)(V,{size:`sm`,className:`w-44`,children:(0,Y.jsx)(K,{placeholder:_()})}),(0,Y.jsxs)(q,{children:[(0,Y.jsx)(H,{value:At,children:ve()}),Oe.map(e=>(0,Y.jsx)(H,{value:e,children:e},e))]})]}),(0,Y.jsxs)(U,{value:String(n),onValueChange:e=>ue(Number(e)),children:[(0,Y.jsx)(V,{size:`sm`,className:`w-28`,children:(0,Y.jsx)(K,{})}),(0,Y.jsx)(q,{children:kt.map(e=>(0,Y.jsx)(H,{value:String(e),children:s({count:e})},e))})]})]}),(0,Y.jsx)(bt,{fields:Ft,seed:b,onChange:Te}),w?(0,Y.jsx)(`div`,{className:`oc-traces__followline`,children:(0,Y.jsxs)(`button`,{type:`button`,className:`oc-traces__chip`,onClick:()=>T(null),title:Xe(),children:[(0,Y.jsxs)(`span`,{className:`oc-traces__chip-label`,children:[de(),(0,Y.jsx)(`code`,{children:$(w)})]}),(0,Y.jsx)(Qe,{className:`oc-traces__chip-x`,"aria-hidden":!0}),(0,Y.jsx)(`span`,{className:`sr-only`,children:ne()})]})}):null,(0,Y.jsx)(xt,{title:v(),rows:N,emptyHint:w?p():se(),columns:[{header:ae(),sort:e=>e.at,cell:e=>(0,Y.jsx)(`span`,{className:`oc-traces__time`,children:G(e.at)})},{header:ie(),sort:e=>e.kind,cell:e=>(0,Y.jsx)(W,{variant:`secondary`,children:e.kind})},{header:Me(),sort:e=>Rt(e)??null,cell:e=>{let t=Rt(e);return t?(0,Y.jsxs)(`span`,{className:`oc-traces__fail`,title:t,children:[`✕ `,t]}):(0,Y.jsx)(`span`,{className:`oc-traces__ok`,"aria-label":a(),children:`✓`})}},{header:Ne(),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:oe(),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:l(),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:d(),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:me(),sort:e=>e.status,cell:e=>e.status===null?(0,Y.jsx)(`span`,{className:`oc-traces__muted`,children:`—`}):(0,Y.jsx)(`span`,{className:`oc-traces__status ${Lt(e.status)}`,children:e.status})},{header:Ke(),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:c(),sort:e=>e.correlationId,cell:e=>e.correlationId?(0,Y.jsx)(`button`,{type:`button`,className:`oc-traces__corr`,title:pe(),onClick:()=>T(e.correlationId),children:$(e.correlationId)}):(0,Y.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})},{header:Je(),sort:e=>+!!e.meta,cell:e=>e.meta?(0,Y.jsx)(B,{variant:`outline`,size:`sm`,onClick:()=>E(e),children:De()}):(0,Y.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})}]}),(0,Y.jsx)(zt,{row:ce,onClose:()=>E(null)})]})]})}function Lt(e){return e>=500?`oc-traces__status--5xx`:e>=400?`oc-traces__status--4xx`:e>=200&&e<300?`oc-traces__status--2xx`:`oc-traces__status--other`}function $(e){return e.length>8?e.slice(0,8):e}function Rt(e){if(typeof e.status==`number`&&e.status>=400)return String(e.status);if(!e.meta)return null;try{let t=JSON.parse(e.meta);if(e.kind===`openclaw.dispatch`&&t.dispatchStatus===`failed`)return t.errorCode??`failed`;if(e.kind===`assistant.stream`&&t.phase===`finalize`&&(t.streamStatus===`error`||t.streamStatus===`aborted`))return t.streamStatus;if(e.kind===`openclaw.ingest.denied`)return`denied`}catch{}return null}function zt({row:e,onClose:t}){let n=(0,J.useMemo)(()=>{if(!e?.meta)return``;try{return JSON.stringify(JSON.parse(e.meta),null,2)}catch{return e.meta}},[e]);return(0,Y.jsx)(gt,{open:e!==null,onOpenChange:e=>{e||t()},children:e?(0,Y.jsxs)(st,{className:`max-w-lg`,children:[(0,Y.jsxs)(ft,{children:[(0,Y.jsxs)(lt,{className:`oc-traces__meta-title`,children:[Ye(),` `,(0,Y.jsx)(`code`,{children:e.kind}),(0,Y.jsx)(W,{variant:`outline`,children:Ge()})]}),(0,Y.jsx)(ct,{children:A()})]}),(0,Y.jsx)(`pre`,{className:`oc-traces__meta-json`,children:n})]}):null})}export{It as TracesTab};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{c as e,i as t,r as n}from"./bundle-mjs-BJq7W7j9.js";import{AS as r,BS as i,Bg as a,CS as o,DS as s,ES as c,FS as l,Fg as u,HS as d,Hg as f,IS as p,Ig as m,LS as h,Lg as g,MM as _,MS as ee,Mg as v,NS as te,Ng as y,OS as b,PS as ne,Pg as x,RS as re,Rg as S,SS as ie,TS as ae,US as C,Ug as w,VS as T,Vg as E,Xx as oe,_S as se,au as D,bS as ce,c as O,gS as le,hS as ue,iu as k,jM as A,jS as de,jg as j,kS as fe,ru as M,vS as pe,wS as me,xS as he,yS as ge,zS as _e,zg as N}from"./dist-Bh78J5oj.js";import{t as P}from"./button-BWtKy7q6.js";import{B as F,C as I,Mt as L,Nt as R,S as z,V as ve,Xt as ye,Yt as be,at as B,b as V,c as xe,ct as H,dt as Se,ft as Ce,ht as we,it as Te,l as U,mt as Ee,nt as De,p as W,rt as Oe,s as G,st as ke,ut as Ae,w as K,x as q,xt as J,z as Y}from"./index-BoGVkzmD.js";import{t as je}from"./FilterBar-CTBZM__z.js";import{t as Me}from"./DataTableShell-DTw-rOw3.js";import{t as Ne}from"./DetailChips-BviEGC5c.js";var X=e(t(),1),Z=n();function Pe({profileId:e,userLabel:t,open:n,onOpenChange:r}){let i=_(O.agents.listAgentPoolForUser,n&&e?{profileId:e}:`skip`),o=_(O.agents.listUserAgents,n&&e?{profileId:e}:`skip`),s=new Set((o??[]).map(e=>`${e.instanceName}/${e.agentId}`)),c=(o??[]).find(e=>e.isDefault)??null,l=c?`${c.instanceName}/${c.agentId}`:null,u=new Set((i?.agents??[]).map(e=>`${e.instanceName}/${e.agentId}`)),d=[...(i?.agents??[]).map(e=>({...e,outOfPool:!1})),...(o??[]).filter(e=>!u.has(`${e.instanceName}/${e.agentId}`)).map(e=>({instanceName:e.instanceName,agentId:e.agentId,displayName:e.displayName,emoji:e.emoji,model:e.model,kind:e.kind,enabled:e.enabled,state:e.state,outOfPool:!0}))],p=new Map;for(let e of d){let t=p.get(e.instanceName)??[];t.push(e),p.set(e.instanceName,t)}return(0,Z.jsx)(Ae,{open:n,onOpenChange:r,children:(0,Z.jsxs)(Se,{className:`oc-access`,children:[(0,Z.jsxs)(Ee,{children:[(0,Z.jsx)(we,{children:w({user:t})}),(0,Z.jsx)(Ce,{children:f()})]}),i?(0,Z.jsx)(`p`,{className:`oc-access__hint`,children:i.inGroup?E():a()}):null,(0,Z.jsx)(`div`,{className:`oc-access__list`,children:i===void 0?(0,Z.jsx)(`p`,{className:`oc-access__hint`,children:N()}):d.length===0?(0,Z.jsx)(`p`,{className:`oc-access__hint`,children:m()}):[...p.entries()].map(([t,n])=>(0,Z.jsx)(Fe,{profileId:e,instanceName:t,kind:n[0].kind,agents:n,assigned:s,defaultKey:l},t))})]})})}function Fe({profileId:e,instanceName:t,kind:n,agents:r,assigned:i,defaultKey:a}){let o=A(O.agents.assignAgent),s=A(O.agents.removeAgent),c=A(O.agents.setDefaultAgent),l=Y();if(!e)return null;async function d(n,r){try{r?await s({profileId:e,instanceName:t,agentId:n}):await o({profileId:e,instanceName:t,agentId:n})}catch(e){l.error(S(),e)}}async function f(n){try{await c({profileId:e,instanceName:t,agentId:n})}catch(e){l.error(g(),e)}}return(0,Z.jsxs)(`div`,{className:`oc-access__group`,children:[(0,Z.jsxs)(`div`,{className:`oc-access__instance`,children:[(0,Z.jsx)(R,{size:13,"aria-hidden":!0}),(0,Z.jsx)(`span`,{children:t}),(0,Z.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`,c=!e.enabled;return(0,Z.jsxs)(`div`,{className:`oc-access__row${c?` is-disabled`:``}`,children:[(0,Z.jsx)(W,{checked:r,disabled:(s||c)&&!r,onCheckedChange:()=>void d(e.agentId,r),"aria-label":u({name:e.displayName??e.agentId})}),(0,Z.jsxs)(`span`,{className:`oc-access__label`,children:[e.emoji?`${e.emoji} `:``,e.displayName??e.agentId]}),e.model?(0,Z.jsx)(`span`,{className:`oc-access__model`,children:e.model}):null,s?(0,Z.jsx)(H,{variant:`outline`,className:`oc-access__gone`,children:x()}):null,e.outOfPool?(0,Z.jsx)(H,{variant:`outline`,className:`oc-access__gone`,children:y()}):null,r?o?(0,Z.jsx)(`span`,{className:`oc-access__fav`,role:`img`,"aria-label":v(),title:v(),children:(0,Z.jsx)(L,{size:14,fill:`currentColor`})}):(0,Z.jsx)(P,{type:`button`,size:`icon-sm`,variant:`ghost`,className:`oc-access__setdefault`,"aria-label":j(),title:j(),disabled:c,onClick:()=>void f(e.agentId),children:(0,Z.jsx)(L,{size:14})}):null]},e.agentId)})]})}var Q=`__all__`;function $(e){switch(e){case`pending`:return M();case`user`:return k();case`admin`:return D();default:return e}}function Ie({granted:e,onToggle:t}){let n=new Set(e),r=G.filter(e=>n.has(U[e])).length;return(0,Z.jsxs)(De,{children:[(0,Z.jsx)(ke,{asChild:!0,children:(0,Z.jsx)(P,{variant:`outline`,size:`sm`,className:`h-8 w-36 justify-start font-normal`,children:r===0?C():d({count:r})})}),(0,Z.jsxs)(Oe,{align:`start`,className:`w-52`,children:[(0,Z.jsx)(B,{children:T()}),G.map(e=>{let r=U[e];return(0,Z.jsxs)(Te,{className:`gap-2`,onSelect:e=>{e.preventDefault(),t(r)},children:[(0,Z.jsx)(W,{checked:n.has(r),"aria-hidden":!0,tabIndex:-1,className:`pointer-events-none`}),(0,Z.jsx)(`span`,{children:xe[e]()})]},e)})]})]})}function Le(){let e=ye({from:`/settings/users`}),t=be({from:`/settings/users`}),n=e.q??``,a=e.role??Q,u=e=>void t({search:t=>({...t,q:e||void 0}),replace:!0}),d=e=>void t({search:t=>({...t,role:e===Q?void 0:e})}),f=_(O.admin.listUsers,{filter:{q:n||void 0,role:a===Q?void 0:a},withAgents:!0}),m=_(O.me.getMe,{host:J}),g=A(O.admin.setRole),v=A(O.admin.setUserPermissions),y=A(O.admin.startImpersonation),x=A(O.admin.deleteUser),S=A(O.admin.setUserName),C=F(),w=ve(),T=Y(),[E,D]=(0,X.useState)(null),k=(0,X.useMemo)(()=>{let e=new Set([`pending`,`user`,`admin`]);for(let t of f??[])e.add(t.role);return[...e]},[f]),j=n!==``||a!==Q;function M(){t({search:{},replace:!0})}async function N(e){try{await g(e)}catch(e){T.error(i(),e)}}async function P(e){try{await v(e)}catch(e){T.error(_e(),e)}}async function L(e){let t=e.email||e.name||e.canonical||e.userId.slice(0,8);if(await C({title:ee(),description:de({user:t}),confirmWord:r(),confirmLabel:fe(),destructive:!0}))try{await x({profileId:e._id}),T.success(s({user:t}))}catch(e){T.error(b(),e)}}async function B(e){let t=e.email||e.name||e.userId.slice(0,8),n=await w({title:ae(),label:me({user:t}),placeholder:o(),defaultValue:e.name??``,confirmLabel:oe()});if(n!==null)try{await S({profileId:e._id,name:n}),T.success(ie())}catch(e){T.error(he(),e)}}return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(je,{q:n,onQChange:u,searchPlaceholder:re(),onReset:M,canReset:j,children:(0,Z.jsxs)(V,{value:a,onValueChange:d,children:[(0,Z.jsx)(I,{size:`sm`,className:`w-36`,children:(0,Z.jsx)(K,{})}),(0,Z.jsxs)(q,{children:[(0,Z.jsx)(z,{value:Q,children:h()}),k.map(e=>(0,Z.jsx)(z,{value:e,children:$(e)},e))]})]})}),(0,Z.jsx)(Me,{title:p(),rows:f,emptyHint:l(),rowActions:e=>{let t=[{label:ue(),onSelect:()=>D({profileId:e._id,label:e.email||e.name||e.canonical||e.userId.slice(0,8)})},{label:c(),onSelect:()=>void B(e)}];return e.userId!==m?.userId&&t.push({label:ne(),onSelect:()=>void y({profileId:e._id})},{label:te(),variant:`destructive`,onSelect:()=>void L(e)}),t},columns:[{header:ce(),cell:e=>{let t=e.email||e.name||e.canonical||e.userId.slice(0,8),n=e.email&&e.name&&e.name!==e.email?e.name:null;return(0,Z.jsxs)(`div`,{className:`flex flex-col`,children:[(0,Z.jsx)(`span`,{children:t}),n?(0,Z.jsx)(`span`,{className:`text-muted-foreground text-xs`,children:n}):null]})},sort:e=>e.email||e.name||e.canonical||e.userId},{header:ge(),sort:e=>e.role===`admin`?2:+(e.role===`user`),cell:e=>(0,Z.jsxs)(V,{value:e.role,onValueChange:t=>void N({profileId:e._id,role:t}),children:[(0,Z.jsx)(I,{size:`sm`,className:`w-28`,children:(0,Z.jsx)(K,{})}),(0,Z.jsxs)(q,{children:[(0,Z.jsx)(z,{value:`pending`,children:$(`pending`)}),(0,Z.jsx)(z,{value:`user`,children:$(`user`)}),(0,Z.jsx)(z,{value:`admin`,children:$(`admin`)})]})]})},{header:pe(),sort:e=>e.role===`admin`?9999:e.extraPermissions?.length??0,cell:e=>e.role===`admin`?(0,Z.jsx)(`span`,{className:`text-muted-foreground text-xs`,children:se()}):(0,Z.jsx)(Ie,{granted:e.extraPermissions??[],onToggle:t=>{let n=new Set(e.extraPermissions??[]);n.has(t)?n.delete(t):n.add(t),P({profileId:e._id,permissions:[...n]})}})},{header:le(),cell:e=>(0,Z.jsx)(Ne,{icon:(0,Z.jsx)(R,{size:12,"aria-hidden":!0}),total:e.agentCount??0,items:e.agents.map(e=>({label:e}))}),sort:e=>e.agentCount??0}]}),(0,Z.jsx)(Pe,{profileId:E?.profileId??null,userLabel:E?.label??``,open:E!==null,onOpenChange:e=>{e||D(null)}})]})}export{Le as UsersTab};
|