@lacneu/atrium 0.61.0 → 0.62.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/AccessTab-DY7s2nUA.js +1 -0
- package/dist/assets/{AdvancedFilter-B6eiX7Zx.js → AdvancedFilter-BbljBL_5.js} +1 -1
- package/dist/assets/AgentFilesTab-BtY1O3co.js +3 -0
- package/dist/assets/AnomaliesTab-Dc1BWkpz.js +1 -0
- package/dist/assets/AuditTab-BDH_c5SQ.js +1 -0
- package/dist/assets/BridgeTab-BpMpD4Gm.js +1 -0
- package/dist/assets/ChatDefaultsTab-B2vDY2FL.js +1 -0
- package/dist/assets/{DataTableShell-D-RklOZj.js → DataTableShell-Bo9JdV4-.js} +1 -1
- package/dist/assets/{DetailChips-DdVat1KM.js → DetailChips-stIZjuDW.js} +1 -1
- package/dist/assets/FeedbacksTab-CxQJT8RQ.js +1 -0
- package/dist/assets/{FieldLabel-HlyBnXo4.js → FieldLabel-DVIaWFle.js} +1 -1
- package/dist/assets/FilesTab-COkLn-3m.js +1 -0
- package/dist/assets/{FilterBar-UyunwEZF.js → FilterBar-XGMlTH00.js} +1 -1
- package/dist/assets/GroupsTab-DahUEKfi.js +1 -0
- package/dist/assets/InstancesTab-CdxmyjKD.js +1 -0
- package/dist/assets/IntegrationsTab-DcTQI2LV.js +1 -0
- package/dist/assets/{KpiTab-h0NlewDJ.js → KpiTab-CRHncLGM.js} +1 -1
- package/dist/assets/PreferencesTab-CMQIXTo8.js +1 -0
- package/dist/assets/PromptInjectionsTab-RUWYcoYK.js +4 -0
- package/dist/assets/RolesTab-CTWsWK9B.js +1 -0
- package/dist/assets/ScheduledTab-BR6mWCfc.js +1 -0
- package/dist/assets/ServiceAccountsTab-BTyR_9ZB.js +1 -0
- package/dist/assets/SubAgentReportsTab-L2Dsfn4x.js +1 -0
- package/dist/assets/ThemeShowroom-CUXWYVrF.js +1 -0
- package/dist/assets/{TimeRangePicker-fvvxJ7HC.js → TimeRangePicker-DGb-YJj5.js} +1 -1
- package/dist/assets/TracesTab-Cbp7BSkH.js +1 -0
- package/dist/assets/UsersTab-NHhJ0saL.js +1 -0
- package/dist/assets/VoiceTab-sjryLTED.js +1 -0
- package/dist/assets/{button-BCAsV4-2.js → button-DRguy6Hz.js} +1 -1
- package/dist/assets/{card-BwAm8Ufs.js → card-BTuOmZr0.js} +1 -1
- package/dist/assets/chevrons-up-down-BFfHriX4.js +1 -0
- package/dist/assets/{compatView-CKSMKOA6.js → compatView-BHorgRif.js} +1 -1
- package/dist/assets/dispatchErrorInfo-CJWXIZnL.js +1 -0
- package/dist/assets/{dist-CRven8ef.js → dist-3KrBDl5H.js} +1 -1
- package/dist/assets/dist-CAP0mn60.js +44 -0
- package/dist/assets/{dist-Bw4s22TB.js → dist-DH6cB1zr.js} +1 -1
- package/dist/assets/{dist-CT4mrpPz.js → dist-h58Lj6DX.js} +1 -1
- package/dist/assets/{highlighted-body-OFNGDK62-DlBa16Mr.js → highlighted-body-OFNGDK62-INR9Ztt5.js} +1 -1
- package/dist/assets/{index-DPQr8euK.css → index-Ba5lBN_I.css} +1 -1
- package/dist/assets/index-DcPINOh1.js +238 -0
- package/dist/assets/mermaid-GHXKKRXX-Dnmq3zax.js +1 -0
- package/dist/assets/{pdf-ctspKy12.js → pdf-bkWuoknj.js} +1 -1
- package/dist/assets/roleDescriptions-B6dQdyoM.js +1 -0
- package/dist/assets/{table-DckOsZQY.js → table-1vsq56Zt.js} +1 -1
- package/dist/assets/{tabs-DKk4J439.js → tabs-IFDKEY73.js} +1 -1
- package/dist/assets/x-ChVRoy_h.js +1 -0
- package/dist/index.html +8 -8
- package/package.json +1 -1
- package/dist/assets/AccessTab-DBXKZGgf.js +0 -1
- package/dist/assets/AgentFilesTab-CUMkUFY0.js +0 -3
- package/dist/assets/AnomaliesTab-DU5uZOg-.js +0 -1
- package/dist/assets/AuditTab-nLpz-KoA.js +0 -1
- package/dist/assets/BridgeTab-Bno_F96W.js +0 -1
- package/dist/assets/ChatDefaultsTab-CwRGLZ4Z.js +0 -1
- package/dist/assets/FeedbacksTab-ejc0BNCp.js +0 -1
- package/dist/assets/FilesTab-xKmAhsXC.js +0 -1
- package/dist/assets/GroupsTab-DkaxUE-L.js +0 -1
- package/dist/assets/InstancesTab-BnSYWxfp.js +0 -1
- package/dist/assets/IntegrationsTab-BOQYLTZE.js +0 -1
- package/dist/assets/PreferencesTab-CcGguucO.js +0 -1
- package/dist/assets/PromptInjectionsTab-y-Gf5MXQ.js +0 -4
- package/dist/assets/RolesTab-lwOfl6N5.js +0 -1
- package/dist/assets/ScheduledTab-BntpA-Zo.js +0 -1
- package/dist/assets/ServiceAccountsTab-CQDS8dvg.js +0 -1
- package/dist/assets/SubAgentReportsTab-BKX-g9sQ.js +0 -1
- package/dist/assets/ThemeShowroom-CdO9EEFA.js +0 -1
- package/dist/assets/TracesTab-C2GNUs6y.js +0 -1
- package/dist/assets/UsersTab-BRdWHZOu.js +0 -1
- package/dist/assets/VoiceTab-RC5QjSW2.js +0 -1
- package/dist/assets/chevrons-up-down-C82Hxi1c.js +0 -1
- package/dist/assets/dispatchErrorInfo-BMHBocZy.js +0 -1
- package/dist/assets/dist-B1qnlN7I.js +0 -44
- package/dist/assets/index-rCasMjHB.js +0 -238
- package/dist/assets/mermaid-GHXKKRXX-BQnxJzgK.js +0 -1
- package/dist/assets/roleDescriptions-Bb_m4cgS.js +0 -1
- package/dist/assets/x-8-3cz0V6.js +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{cx as e,lx as t,ox as n,sx as r,ux as i}from"./dist-CAP0mn60.js";var a={pending:i,user:t,admin:e,observer:r,agent:n};function o(e){if(e.builtin){let t=a[e.key];if(t)return t()}return e.description}export{o as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e,r as t}from"./bundle-mjs-C73ZY4La.js";import{E as n}from"./dist-
|
|
1
|
+
import{a as e,r as t}from"./bundle-mjs-C73ZY4La.js";import{E as n}from"./dist-CAP0mn60.js";e();var r=t();function i({className:e,...t}){return(0,r.jsx)(`div`,{"data-slot":`table-container`,className:`relative w-full overflow-x-auto`,children:(0,r.jsx)(`table`,{"data-slot":`table`,className:n(`w-full caption-bottom text-sm`,e),...t})})}function a({className:e,...t}){return(0,r.jsx)(`thead`,{"data-slot":`table-header`,className:n(`[&_tr]:border-b`,e),...t})}function o({className:e,...t}){return(0,r.jsx)(`tbody`,{"data-slot":`table-body`,className:n(`[&_tr:last-child]:border-0`,e),...t})}function s({className:e,...t}){return(0,r.jsx)(`tr`,{"data-slot":`table-row`,className:n(`border-b transition-colors hover:bg-muted/50 has-aria-expanded:bg-muted/50 data-[state=selected]:bg-muted`,e),...t})}function c({className:e,...t}){return(0,r.jsx)(`th`,{"data-slot":`table-head`,className:n(`h-10 px-2 text-left align-middle font-medium whitespace-nowrap text-foreground [&:has([role=checkbox])]:pr-0`,e),...t})}function l({className:e,...t}){return(0,r.jsx)(`td`,{"data-slot":`table-cell`,className:n(`p-2 align-middle whitespace-nowrap [&:has([role=checkbox])]:pr-0`,e),...t})}export{a,c as i,o as n,s as o,l as r,i as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{E as r,_ as i,d as a,l as o,m as s,t as c,u as l,v as u}from"./dist-
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{E as r,_ as i,d as a,l as o,m as s,t as c,u as l,v as u}from"./dist-CAP0mn60.js";import{t as d}from"./dist-3KrBDl5H.js";import{Ct as f,St as p,xt as m}from"./index-DcPINOh1.js";var h=t(e(),1),g=n(),_=`Tabs`,[v,y]=s(_,[f]),b=f(),[x,S]=v(_),C=h.forwardRef((e,t)=>{let{__scopeTabs:n,value:r,onValueChange:i,defaultValue:s,orientation:c=`horizontal`,dir:l,activationMode:f=`automatic`,...p}=e,m=d(l),[h,v]=a({prop:r,onChange:i,defaultProp:s??``,caller:_});return(0,g.jsx)(x,{scope:n,baseId:o(),value:h,onValueChange:v,orientation:c,dir:m,activationMode:f,children:(0,g.jsx)(u.div,{dir:m,"data-orientation":c,...p,ref:t})})});C.displayName=_;var w=`TabsList`,T=h.forwardRef((e,t)=>{let{__scopeTabs:n,loop:r=!0,...i}=e,a=S(w,n),o=b(n);return(0,g.jsx)(p,{asChild:!0,...o,orientation:a.orientation,dir:a.dir,loop:r,children:(0,g.jsx)(u.div,{role:`tablist`,"aria-orientation":a.orientation,...i,ref:t})})});T.displayName=w;var E=`TabsTrigger`,D=h.forwardRef((e,t)=>{let{__scopeTabs:n,value:r,disabled:a=!1,...o}=e,s=S(E,n),c=b(n),l=A(s.baseId,r),d=j(s.baseId,r),f=r===s.value;return(0,g.jsx)(m,{asChild:!0,...c,focusable:!a,active:f,children:(0,g.jsx)(u.button,{type:`button`,role:`tab`,"aria-selected":f,"aria-controls":d,"data-state":f?`active`:`inactive`,"data-disabled":a?``:void 0,disabled:a,id:l,...o,ref:t,onMouseDown:i(e.onMouseDown,e=>{!a&&e.button===0&&e.ctrlKey===!1?s.onValueChange(r):e.preventDefault()}),onKeyDown:i(e.onKeyDown,e=>{[` `,`Enter`].includes(e.key)&&s.onValueChange(r)}),onFocus:i(e.onFocus,()=>{let e=s.activationMode!==`manual`;!f&&!a&&e&&s.onValueChange(r)})})})});D.displayName=E;var O=`TabsContent`,k=h.forwardRef((e,t)=>{let{__scopeTabs:n,value:r,forceMount:i,children:a,...o}=e,s=S(O,n),c=A(s.baseId,r),d=j(s.baseId,r),f=r===s.value,p=h.useRef(f);return h.useEffect(()=>{let e=requestAnimationFrame(()=>p.current=!1);return()=>cancelAnimationFrame(e)},[]),(0,g.jsx)(l,{present:i||f,children:({present:n})=>(0,g.jsx)(u.div,{"data-state":f?`active`:`inactive`,"data-orientation":s.orientation,role:`tabpanel`,"aria-labelledby":c,hidden:!n,id:d,tabIndex:0,...o,ref:t,style:{...e.style,animationDuration:p.current?`0s`:void 0},children:n&&a})})});k.displayName=O;function A(e,t){return`${e}-trigger-${t}`}function j(e,t){return`${e}-content-${t}`}var M=C,N=T,P=D,F=k;function I({className:e,orientation:t=`horizontal`,...n}){return(0,g.jsx)(M,{"data-slot":`tabs`,"data-orientation":t,className:r(`group/tabs flex gap-2 data-horizontal:flex-col`,e),...n})}var L=c(`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{D as e}from"./dist-CAP0mn60.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
|
@@ -62,15 +62,15 @@
|
|
|
62
62
|
document.documentElement.dataset.motion = "static";
|
|
63
63
|
})();
|
|
64
64
|
</script>
|
|
65
|
-
<script type="module" crossorigin src="/assets/index-
|
|
65
|
+
<script type="module" crossorigin src="/assets/index-DcPINOh1.js"></script>
|
|
66
66
|
<link rel="modulepreload" crossorigin href="/assets/bundle-mjs-C73ZY4La.js">
|
|
67
|
-
<link rel="modulepreload" crossorigin href="/assets/dist-
|
|
68
|
-
<link rel="modulepreload" crossorigin href="/assets/dist-
|
|
69
|
-
<link rel="modulepreload" crossorigin href="/assets/dist-
|
|
70
|
-
<link rel="modulepreload" crossorigin href="/assets/dist-
|
|
71
|
-
<link rel="modulepreload" crossorigin href="/assets/x-
|
|
72
|
-
<link rel="modulepreload" crossorigin href="/assets/button-
|
|
73
|
-
<link rel="stylesheet" crossorigin href="/assets/index-
|
|
67
|
+
<link rel="modulepreload" crossorigin href="/assets/dist-CAP0mn60.js">
|
|
68
|
+
<link rel="modulepreload" crossorigin href="/assets/dist-3KrBDl5H.js">
|
|
69
|
+
<link rel="modulepreload" crossorigin href="/assets/dist-h58Lj6DX.js">
|
|
70
|
+
<link rel="modulepreload" crossorigin href="/assets/dist-DH6cB1zr.js">
|
|
71
|
+
<link rel="modulepreload" crossorigin href="/assets/x-ChVRoy_h.js">
|
|
72
|
+
<link rel="modulepreload" crossorigin href="/assets/button-DRguy6Hz.js">
|
|
73
|
+
<link rel="stylesheet" crossorigin href="/assets/index-Ba5lBN_I.css">
|
|
74
74
|
</head>
|
|
75
75
|
<body>
|
|
76
76
|
<div id="root"></div>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lacneu/atrium",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.62.0",
|
|
4
4
|
"description": "Atrium — public, self-hostable, Convex-backed web chat UI for AI agent gateways (OpenClaw today, Hermes next). Ships an origin-agnostic static bundle (Convex URL injected at runtime via /config.json).",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{T as r,_f as i,af as a,cf as o,df as s,ff as c,gf as l,hf as u,if as d,lf as f,mf as p,of as m,pf as h,rf as g,sf as _,uF as v,uf as y,yF as b}from"./dist-B1qnlN7I.js";import{C as x,S,T as C,rt as w,w as T,x as E}from"./index-rCasMjHB.js";var D=t(e(),1);function O(e){return e===`user`?_():e===`all`?m():a({group:e.group})}function k(e){return e===`common`?d():e===`owner`?g():a({group:e.group})}var A=n();function j(e){return e.name||e.email||e.userId.slice(0,8)}function M(){let e=b(r.admin.listUsers,{}),[t,n]=(0,D.useState)(``),a=b(r.introspect.introspectUser,t?{userId:t}:`skip`);return(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:i()}),(0,A.jsxs)(E,{value:t,onValueChange:n,children:[(0,A.jsx)(T,{size:`sm`,"aria-label":l(),children:(0,A.jsx)(C,{placeholder:l()})}),(0,A.jsx)(S,{children:(e??[]).map(e=>(0,A.jsx)(x,{value:e.userId,children:j(e)},e._id))})]}),t===``?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:u()}):a===void 0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:v()}):(0,A.jsxs)(`div`,{className:`oc-introspect`,children:[(0,A.jsxs)(`section`,{className:`oc-introspect__section`,children:[(0,A.jsx)(`h3`,{className:`oc-introspect__title`,children:p()}),(0,A.jsxs)(`div`,{className:`oc-introspect__id`,children:[(0,A.jsx)(`strong`,{children:a.user.label}),(0,A.jsx)(w,{variant:`secondary`,children:a.role})]})]}),(0,A.jsxs)(`section`,{className:`oc-introspect__section`,children:[(0,A.jsx)(`h3`,{className:`oc-introspect__title`,children:h()}),a.groups.length===0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:f()}):(0,A.jsx)(`div`,{className:`oc-introspect__chips`,children:a.groups.map(e=>(0,A.jsx)(w,{variant:`secondary`,children:e.name},e.groupId))})]}),(0,A.jsxs)(`section`,{className:`oc-introspect__section`,children:[(0,A.jsx)(`h3`,{className:`oc-introspect__title`,children:c()}),a.agents.length===0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:f()}):(0,A.jsx)(`ul`,{className:`oc-introspect__list`,children:a.agents.map(e=>(0,A.jsxs)(`li`,{className:`oc-introspect__row`,children:[(0,A.jsx)(`span`,{className:`oc-introspect__name`,children:e.displayName||e.agentId}),e.isDefault?(0,A.jsx)(w,{variant:`default`,children:o()}):null,(0,A.jsx)(w,{variant:`outline`,children:O(e.via)}),(0,A.jsx)(w,{variant:`secondary`,children:e.state})]},`${e.instanceName} ${e.agentId}`))})]}),(0,A.jsxs)(`section`,{className:`oc-introspect__section`,children:[(0,A.jsx)(`h3`,{className:`oc-introspect__title`,children:s()}),a.charts.length===0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:f()}):(0,A.jsx)(`ul`,{className:`oc-introspect__list`,children:a.charts.map(e=>(0,A.jsxs)(`li`,{className:`oc-introspect__row`,children:[(0,A.jsx)(`span`,{className:`oc-introspect__name`,children:e.name}),(0,A.jsx)(w,{variant:`outline`,children:k(e.via)})]},e.key))})]}),(0,A.jsxs)(`section`,{className:`oc-introspect__section`,children:[(0,A.jsx)(`h3`,{className:`oc-introspect__title`,children:y()}),a.permissions.length===0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:f()}):(0,A.jsx)(`div`,{className:`oc-introspect__chips`,children:a.permissions.map(e=>(0,A.jsx)(w,{variant:`secondary`,children:e},e))})]})]})]})}export{M as AccessTab};
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$i as r,Al as i,Bi as a,Bl as o,Ci as s,Cl as c,Dl as l,Ei as u,El as d,Fi as f,Fl as p,Fu as m,Gi as h,Gl as g,Hi as _,Hl as v,Ii as y,Il as b,Ji as x,Jl as S,Ki as C,Kl as w,Li as T,Ll as E,Ml as D,Ni as O,Nl as k,Nu as ee,Ol as A,Pi as j,Pl as te,Qi as M,Ql as N,Ri as P,Rl as F,Si as I,T as L,Ti as R,Tl as ne,Ui as z,Ul as re,Vi as B,Vl as V,Wi as ie,Wl as ae,Xi as oe,Xl as se,Yi as ce,Yl as le,Zi as ue,Zl as de,bi as fe,fF as H,gF as U,jl as pe,kl as me,qi as he,ql as ge,uF as W,uO as _e,vF as ve,wi as ye,wl as be,xi as xe,yF as G,zi as Se,zl as Ce}from"./dist-B1qnlN7I.js";import{t as K}from"./button-BCAsV4-2.js";import{B as we,C as Te,H as Ee,L as De,Pt as q,R as Oe,S as ke,T as Ae,U as je,V as Me,W as Ne,at as Pe,b as Fe,gt as Ie,lt as Le,ot as Re,rt as ze,st as Be,ut as Ve,w as He,wt as J,x as Ue,z as We}from"./index-rCasMjHB.js";import{n as Ge,t as Ke}from"./curation-CQksaIbm.js";import{i as qe}from"./compatView-CKSMKOA6.js";/* empty css */var Y=t(e(),1),X=2e4,Je=6e4;function Ye(e){return typeof e!=`number`||e<=0?0:Math.round(e/X*100)}function Xe(e){return e<=0?0:Math.round(e/Je*100)}function Z(e,t){let n=(typeof e==`number`&&e>0?e:0)/1e3;return new Intl.NumberFormat(t,{minimumFractionDigits:1,maximumFractionDigits:1}).format(n)}function Ze(e){return e.reduce((e,t)=>e+(typeof t.size==`number`&&t.size>0?t.size:0),0)}var Qe=3;function $e(e,t){let n=new Map;for(let t of e.split(`
|
|
2
|
-
`))n.set(t,(n.get(t)??0)+1);for(let e of t.split(`
|
|
3
|
-
`))n.set(e,(n.get(e)??0)-1);let r=0,i=0,a=[],o=[];for(let[e,t]of n)t<0?(r+=-t,a.length<Qe&&a.push(e)):t>0&&(i+=t,o.length<Qe&&o.push(e));return{added:r,removed:i,sampleAdded:a,sampleRemoved:o}}function et(e){return e instanceof Error?e.message.includes(`conflict:`):String(e).includes(`conflict:`)}var Q=n(),$=e=>`${e.instanceName}::${e.agentId}`;function tt(){let e=G(L.me.getMe,{host:Ie}),t=e?.role===`admin`,n=(e?.permissions??[]).includes(`bridge.read`),r=G(L.admin.listInstances,e!==void 0&&t?{}:`skip`),[i,a]=(0,Y.useState)(null);(0,Y.useEffect)(()=>{!t||!r||r.length===0||(!i||!r.some(e=>e.name===i))&&a(r[0].name)},[t,r,i]);let s=G(L.agents.listAgentsForInstance,t&&i?{instanceName:i}:`skip`),c=G(L.agents.listMyAgents,e!==void 0&&!t?{}:`skip`),l=(0,Y.useMemo)(()=>{if(e!==void 0){if(t)return i===null||s===void 0?r!==void 0&&r.length===0?[]:void 0:s.agents.map(e=>({instanceName:i,agentId:e.agentId,label:`${e.emoji?`${e.emoji} `:``}${e.displayName??e.agentId}`}));if(c!==void 0)return c.map(e=>({instanceName:e.instanceName,agentId:e.agentId,label:`${e.emoji?`${e.emoji} `:``}${e.displayName??e.agentId}`}))}},[e,t,i,s,r,c]),[u,d]=(0,Y.useState)(null);(0,Y.useEffect)(()=>{!l||l.length===0||(!u||!l.some(e=>$(e)===u))&&d($(l[0]))},[l,u]);let f=l?.find(e=>$(e)===u)??null,p=U(L.agentFiles.listAgentFiles),[m,h]=(0,Y.useState)({status:`idle`}),_=f?.instanceName??null,y=f?.agentId??null,b=G(L.compat.forInstance,n&&_!==null?{instanceName:_}:`skip`),C=n&&_!==null?Fe(b,`agentFiles`):null,T=C===null?!1:C===`loading`?null:C.blocked,E=(0,Y.useCallback)(async()=>{if(!(_===null||y===null)){h({status:`loading`});try{h({status:`done`,files:(await p({instanceName:_,agentId:y})).files})}catch{h({status:`error`})}}},[p,_,y]);(0,Y.useEffect)(()=>{T===!1&&E()},[E,T]);let[D,O]=(0,Y.useState)(null),k=G(L.agentFileCuration.listCurations,t&&_!==null&&y!==null?{instanceName:_,agentId:y}:`skip`),A=G(L.agentFileCuration.curationSettings,t&&_!==null?{instanceName:_}:`skip`),j=U(L.agentFileCuration.requestCuration),[te,M]=(0,Y.useState)(null),[P,F]=(0,Y.useState)(null),{toast:I}=J(),R=(0,Y.useMemo)(()=>{let e=new Map;for(let t of k??[])e.has(t.name)||e.set(t.name,t);return e},[k]),ne=(0,Y.useCallback)(async e=>{if(!(_===null||y===null)){M(e);try{let t=await j({instanceName:_,agentId:y,name:e,trigger:`manual`});t.ok?I({title:oe(),variant:`success`}):I({title:ce({reason:t.reason??`unknown`}),variant:`error`})}catch{I({title:x(),variant:`error`})}finally{M(null)}}},[j,_,y,I]),z=H(),B=(0,Y.useMemo)(()=>new Intl.NumberFormat(z,{maximumFractionDigits:0}),[z]);return e===void 0||l===void 0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:W()}):(0,Q.jsxs)(`div`,{className:`oc-afiles`,children:[(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:N()}),(0,Q.jsxs)(`div`,{className:`oc-afiles__picker`,children:[t&&(r?.length??0)>1?(0,Q.jsxs)(Ue,{value:i??``,onValueChange:e=>a(e),children:[(0,Q.jsx)(He,{size:`sm`,"aria-label":de(),children:(0,Q.jsx)(Ae,{})}),(0,Q.jsx)(ke,{children:(r??[]).map(e=>(0,Q.jsx)(Te,{value:e.name,children:e.name},e.name))})]}):null,l.length>0?(0,Q.jsxs)(Ue,{value:u??``,onValueChange:e=>d(e),children:[(0,Q.jsx)(He,{size:`sm`,"aria-label":se(),children:(0,Q.jsx)(Ae,{})}),(0,Q.jsx)(ke,{children:l.map(e=>(0,Q.jsx)(Te,{value:$(e),children:e.label},$(e)))})]}):(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:le()})]}),f===null?null:C===`loading`?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:W()}):C!==null&&C.blocked?(0,Q.jsxs)(`p`,{className:`oc-compat__blocked`,role:`status`,children:[(0,Q.jsx)(q,{size:14,"aria-hidden":!0}),` `,qe(C.gatewayVersion,C.provider)]}):m.status===`loading`||m.status===`idle`?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:W()}):m.status===`error`?(0,Q.jsxs)(`p`,{className:`oc-afiles__error`,role:`alert`,children:[ge(),` `,(0,Q.jsx)(K,{variant:`outline`,size:`sm`,onClick:()=>void E(),children:ee()})]}):m.files.length===0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:S()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`div`,{className:`oc-afiles__list`,children:m.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)(ze,{variant:`outline`,children:w()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`span`,{className:`oc-afiles__size`,children:g({size:Z(e.size,z)})}),(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:ae({pct:B.format(n)})}),r?(0,Q.jsx)(q,{size:14,className:`oc-afiles__warn`,"aria-label":re()}):(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:()=>O(e),children:t?V():o()}),t&&!e.missing?(0,Q.jsx)(nt,{curatable:Ke.includes(e.name),size:e.size??0,budget:A?.budgetChars??null,enabled:A?.enabled??!1,curation:R.get(e.name)??null,inFlight:te===e.name,onCurate:()=>void ne(e.name),onReview:e=>F(e)}):null]},e.name)})}),(0,Q.jsx)(`p`,{className:`oc-afiles__budget`,children:v({used:Z(Ze(m.files),z),total:Z(Je,z),pct:B.format(Xe(Ze(m.files)))})})]}),D&&f?(0,Q.jsx)(rt,{instanceName:f.instanceName,agentId:f.agentId,name:D.name,isAdmin:t,onClose:()=>O(null),onSaved:()=>void E()}):null,P?(0,Q.jsx)(it,{curationId:P,onClose:()=>F(null),onApplied:()=>{F(null),E()}}):null]})}function nt({curatable:e,size:t,budget:n,enabled:i,curation:a,inFlight:o,onCurate:s,onReview:c}){return a?.status===`proposed`?(0,Q.jsx)(K,{variant:`default`,size:`sm`,className:`oc-afiles__curate`,onClick:()=>c(a._id),children:M()}):o||a?.status===`dispatched`||a?.status===`applying`?(0,Q.jsx)(ze,{variant:`outline`,className:`oc-afiles__curate-status`,children:ue()}):e&&i&&n!==null&&Ge(t,n)?(0,Q.jsx)(K,{variant:`outline`,size:`sm`,className:`oc-afiles__curate`,onClick:s,children:r()}):null}function rt({instanceName:e,agentId:t,name:n,isAdmin:r,onClose:a,onSaved:o}){let s=U(L.agentFiles.getAgentFile),u=U(L.agentFiles.setAgentFile),f=J(),[h,g]=(0,Y.useState)(null),[_,v]=(0,Y.useState)(!1),[y,x]=(0,Y.useState)(``),[S,C]=(0,Y.useState)(!1),[w,T]=(0,Y.useState)(!1),[O,j]=(0,Y.useState)(!1),[M,N]=(0,Y.useState)(!1),P=(0,Y.useCallback)(async r=>{v(!1);try{let i=await s({instanceName:e,agentId:t,name:n});g({content:i.content,updatedAtMs:i.updatedAtMs}),r||x(i.content),j(!1)}catch{v(!0)}},[s,e,t,n]);(0,Y.useEffect)(()=>{P(!1)},[P]);async function I(){if(h!==null){T(!0),N(!1);try{await u({instanceName:e,agentId:t,name:n,content:y,baseUpdatedAtMs:h.updatedAtMs??void 0}),f.success(k({name:n})),o(),await P(!1)}catch(e){et(e)?j(!0):N(!0)}finally{T(!1)}}}let R=h!==null&&y!==h.content,z=(0,Y.useMemo)(()=>h===null?null:$e(h.content,y),[h,y]),re=y.length>X,B=H(),V=(0,Y.useMemo)(()=>new Intl.NumberFormat(B),[B]);return(0,Q.jsx)(Pe,{open:!0,onOpenChange:e=>!e&&a(),children:(0,Q.jsxs)(Re,{className:`oc-afiles__editor`,children:[(0,Q.jsxs)(Le,{children:[(0,Q.jsx)(Ve,{children:Ce({name:n})}),(0,Q.jsxs)(Be,{children:[F({agent:t,instance:e}),r?null:(0,Q.jsxs)(Q.Fragment,{children:[` · `,E()]})]})]}),_?(0,Q.jsxs)(`p`,{className:`oc-afiles__error`,role:`alert`,children:[pe(),` `,(0,Q.jsx)(K,{variant:`outline`,size:`sm`,onClick:()=>void P(!1),children:ee()})]}):h===null?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:W()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`textarea`,{className:`oc-afiles__source`,value:y,readOnly:!r,spellCheck:!1,onChange:e=>x(e.target.value),"aria-label":Ce({name:n})}),(0,Q.jsx)(`p`,{className:`oc-afiles__hint`,children:b()}),O?(0,Q.jsxs)(`p`,{className:`oc-afiles__error`,role:`alert`,children:[i(),` `,(0,Q.jsx)(K,{variant:`outline`,size:`sm`,onClick:()=>void P(!0),children:me()})]}):null,M?(0,Q.jsx)(`p`,{className:`oc-afiles__error`,role:`alert`,children:D()}):null,(0,Q.jsxs)(`div`,{className:`oc-afiles__editor-foot`,children:[(0,Q.jsx)(`span`,{className:`oc-afiles__count${re?` is-over`:``}`,children:p({count:V.format(y.length),max:V.format(X)})}),r?(0,Q.jsx)(K,{size:`sm`,disabled:!R||w||O,onClick:()=>C(!0),children:w?m():te()}):null]})]}),(0,Q.jsx)(De,{open:S,onOpenChange:C,children:(0,Q.jsxs)(we,{children:[(0,Q.jsxs)(je,{children:[(0,Q.jsx)(Ne,{children:A({name:n})}),(0,Q.jsx)(Me,{children:l({agent:t})})]}),z?(0,Q.jsxs)(`div`,{className:`oc-afiles__diff`,children:[(0,Q.jsx)(`p`,{className:`oc-afiles__diff-counts`,children:d({added:z.added,removed:z.removed})}),z.sampleAdded.length>0?(0,Q.jsxs)(`div`,{className:`oc-afiles__diff-block`,children:[(0,Q.jsx)(`span`,{className:`oc-afiles__diff-label`,children:ne()}),z.sampleAdded.map((e,t)=>(0,Q.jsx)(`code`,{className:`oc-afiles__diff-line is-add`,children:e||` `},t))]}):null,z.sampleRemoved.length>0?(0,Q.jsxs)(`div`,{className:`oc-afiles__diff-block`,children:[(0,Q.jsx)(`span`,{className:`oc-afiles__diff-label`,children:be()}),z.sampleRemoved.map((e,t)=>(0,Q.jsx)(`code`,{className:`oc-afiles__diff-line is-del`,children:e||` `},t))]}):null]}):null,(0,Q.jsxs)(Ee,{children:[(0,Q.jsx)(We,{children:_e()}),(0,Q.jsx)(Oe,{onClick:()=>void I(),children:c()})]})]})})]})})}function it({curationId:e,onClose:t,onApplied:n}){let r=G(L.agentFileCuration.getProposal,{curationId:e}),i=U(L.agentFileCuration.approveCuration),o=ve(L.agentFileCuration.rejectCuration),{toast:c}=J(),[l,d]=(0,Y.useState)(null),[p,g]=(0,Y.useState)(!1),[v,b]=(0,Y.useState)(``),S=H(),w=(0,Y.useMemo)(()=>r?$e(r.beforeContent,r.proposedContent):null,[r]);async function E(){d(`approve`);try{let t=await i({curationId:e});t.ok?(c({title:he(),variant:`success`}),n()):c({title:t.reason===`conflict`?h():ie({reason:t.reason??`unknown`}),variant:`error`})}catch{c({title:x(),variant:`error`})}finally{d(null)}}async function D(n){d(`reject`);try{let r=v.trim();(await o({curationId:e,...r?{comment:r}:{},relaunch:n})).ok?c({title:n?xe():C(),variant:`success`}):c({title:B(),variant:`error`}),t()}catch{c({title:x(),variant:`error`})}finally{d(null)}}return(0,Q.jsx)(Pe,{open:!0,onOpenChange:e=>e?void 0:t(),children:(0,Q.jsxs)(Re,{className:`oc-afiles__review`,children:[(0,Q.jsxs)(Le,{children:[(0,Q.jsx)(Ve,{children:r?z({name:r.name}):W()}),(0,Q.jsx)(Be,{children:_()})]}),r===void 0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:W()}):r===null?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:B()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`p`,{className:`oc-afiles__review-sizes`,children:[a({before:Z(r.beforeSize,S),after:Z(r.proposedSize,S)}),r.overBudget?(0,Q.jsxs)(Q.Fragment,{children:[` `,(0,Q.jsx)(q,{size:13,"aria-hidden":!0}),` `,Se()]}):null]}),w?(0,Q.jsx)(`p`,{className:`oc-afiles__review-diff`,children:P({added:w.added,removed:w.removed})}):null,r.feedback?(0,Q.jsx)(`p`,{className:`oc-afiles__review-feedback`,children:fe({feedback:r.feedback})}):null,w&&w.sampleRemoved.length>0?(0,Q.jsxs)(`div`,{className:`oc-afiles__review-removed`,children:[(0,Q.jsx)(`p`,{className:`oc-afiles__review-label`,children:O()}),(0,Q.jsx)(`ul`,{children:w.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:j()}),(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:T()}),(0,Q.jsx)(`pre`,{className:`oc-afiles__review-pre`,children:r.proposedContent})]})]})]}),p?(0,Q.jsxs)(`div`,{className:`oc-afiles__reject-form`,children:[(0,Q.jsx)(`label`,{className:`oc-afiles__review-label`,htmlFor:`curation-reject-comment`,children:u()}),(0,Q.jsx)(`textarea`,{id:`curation-reject-comment`,className:`oc-afiles__reject-textarea`,rows:3,placeholder:R(),value:v,onChange:e=>b(e.target.value)}),(0,Q.jsxs)(`div`,{className:`oc-afiles__review-actions`,children:[(0,Q.jsx)(K,{variant:`ghost`,onClick:()=>g(!1),disabled:l!==null,children:ye()}),(0,Q.jsx)(K,{variant:`outline`,onClick:()=>void D(!1),disabled:l!==null,children:l===`reject`?m():s()}),(0,Q.jsx)(K,{variant:`default`,onClick:()=>void D(!0),disabled:l!==null,children:l===`reject`?m():I()})]})]}):(0,Q.jsxs)(`div`,{className:`oc-afiles__review-actions`,children:[(0,Q.jsx)(K,{variant:`outline`,onClick:()=>g(!0),disabled:l!==null||r==null,children:y()}),(0,Q.jsx)(K,{variant:`default`,onClick:()=>void E(),disabled:l!==null||r==null,children:l===`approve`?m():f()})]})]})})}export{tt as AgentFilesTab};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$y as r,Ab as i,Bb as a,Cb as o,Db as ee,Eb as s,Fb as te,Ib as ne,Jy as c,Lb as l,Mb as u,Nb as d,Ob as re,Pb as ie,Qy as f,Rb as p,Sb as ae,T as m,Tb as oe,Xy as h,Yy as g,Zy as _,_b as v,ab as se,bb as ce,cb as le,db as y,eb as b,fb as ue,gb as de,hb as x,ib as fe,jb as pe,kb as me,lb as he,mb as ge,nb as _e,ob as ve,pb as S,rb as C,sb as w,tb as T,ub as E,vF as D,vb as O,wb as k,xb as A,yF as j,yb as M,zb as N}from"./dist-B1qnlN7I.js";import{C as P,F,S as I,T as L,Y as ye,at as R,gt as be,i as xe,lt as z,nn as B,o as Se,ot as V,rn as Ce,rt as H,ut as U,w as W,wt as we,x as G}from"./index-rCasMjHB.js";import{n as Te}from"./TimeRangePicker-fvvxJ7HC.js";import{t as Ee}from"./FilterBar-UyunwEZF.js";import{t as De}from"./DataTableShell-D-RklOZj.js";import{t as K}from"./dispatchErrorInfo-BMHBocZy.js";var q=t(e(),1),J=n(),Y=`__all__`,Oe=[{value:`open`},{value:`acknowledged`},{value:`resolved`}];function ke(e){return e===`open`?a():e===`acknowledged`?N():p()}var Ae=[`info`,`warn`,`critical`],je=[`detector`,`agent`,`user`],Me={kind:`relative`,from:`now-30d`,to:`now`},Ne=200,X=`all`;function Z(){let e=Ce({from:`/settings/anomalies`}),t=B({from:`/settings/anomalies`}),n=e.q??``,r=e.status===X?Y:e.status,a=e.severity??Y,c=e.kind??Y,[f,p]=(0,q.useState)(Y),h=xe(e.from,e.to),{from:g,to:_}=Te(h),b=e=>void t({search:t=>({...t,q:e||void 0}),replace:!0}),T=e=>void t({search:t=>({...t,status:e===Y?X:e})}),N=e=>void t({search:t=>({...t,severity:e===Y?void 0:e})}),R=e=>void t({search:t=>({...t,kind:e===Y?void 0:e})}),z=e=>void t({search:t=>({...t,...Se(e)})}),V=F(),U=we(),K=D(m.anomalies.resolveAnomaly),Z=(j(m.me.getMe,{host:be})?.permissions??[]).includes(`admin.manage`),Q=j(m.anomalies.listAnomalies,{limit:Ne,filter:{q:n||void 0,from:g,to:_,anomalyStatus:r===Y?void 0:r,severity:a===Y?void 0:a,source:f===Y?void 0:f,kind:c===Y?void 0:c}}),$=(0,q.useMemo)(()=>{let e=new Set;for(let t of Q??[])e.add(t.kind);return[...e].sort()},[Q]),ze=n!==``||r!==`open`||a!==Y||f!==Y||c!==Y||h.kind!==`relative`||h.from!==Me.from;function Be(){p(Y),t({search:{status:`open`},replace:!0})}async function Ve(e){if(await V({title:l(),description:(0,J.jsxs)(J.Fragment,{children:[ne(),` `,(0,J.jsx)(`span`,{className:`font-mono`,children:e.kind}),` `,te(),` `,(0,J.jsx)(`strong`,{children:ie()}),`.`,` `,d()]}),confirmLabel:u()}))try{await K({anomalyId:e._id,status:`resolved`}),U.success(pe(),e.kind)}catch(e){U.error(i(),e)}}async function He(e){try{await K({anomalyId:e._id,status:`acknowledged`}),U.success(me(),e.kind)}catch(e){U.error(re(),e)}}return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(`p`,{className:`oc-admin__hint`,children:[ee(),` `,(0,J.jsx)(`strong`,{children:s()}),` `,oe(),` `,(0,J.jsx)(`strong`,{children:k()}),` `,o(),` `,(0,J.jsx)(`strong`,{children:ae()}),` `,A(),` `,(0,J.jsx)(`span`,{className:`oc-filter__window`,children:ce()})]}),(0,J.jsxs)(Ee,{q:n,onQChange:b,searchPlaceholder:M(),timeRange:h,onTimeRangeChange:z,onReset:Be,canReset:ze,children:[(0,J.jsxs)(G,{value:r,onValueChange:T,children:[(0,J.jsx)(W,{size:`sm`,className:`w-36`,children:(0,J.jsx)(L,{})}),(0,J.jsxs)(I,{children:[(0,J.jsx)(P,{value:Y,children:O()}),Oe.map(e=>(0,J.jsx)(P,{value:e.value,children:ke(e.value)},e.value))]})]}),(0,J.jsxs)(G,{value:a,onValueChange:N,children:[(0,J.jsx)(W,{size:`sm`,className:`w-36`,children:(0,J.jsx)(L,{placeholder:v()})}),(0,J.jsxs)(I,{children:[(0,J.jsx)(P,{value:Y,children:de()}),Ae.map(e=>(0,J.jsx)(P,{value:e,children:e},e))]})]}),(0,J.jsxs)(G,{value:f,onValueChange:p,children:[(0,J.jsx)(W,{size:`sm`,className:`w-32`,children:(0,J.jsx)(L,{placeholder:x()})}),(0,J.jsxs)(I,{children:[(0,J.jsx)(P,{value:Y,children:ge()}),je.map(e=>(0,J.jsx)(P,{value:e,children:e},e))]})]}),(0,J.jsxs)(G,{value:c,onValueChange:R,children:[(0,J.jsx)(W,{size:`sm`,className:`w-36`,children:(0,J.jsx)(L,{placeholder:S()})}),(0,J.jsxs)(I,{children:[(0,J.jsx)(P,{value:Y,children:ue()}),$.map(e=>(0,J.jsx)(P,{value:e,children:e},e))]})]})]}),(0,J.jsx)(De,{title:y(),rows:Q,emptyHint:r===`open`?E():he(),rowActions:e=>Z&&e.status===`open`?[{label:le(),onSelect:()=>void Ve(e)},{label:w(),onSelect:()=>void He(e)}]:[],columns:[{header:ve(),cell:e=>(0,J.jsx)(`span`,{className:`oc-traces__time`,children:ye(e.at)}),sort:e=>e.at},{header:S(),cell:e=>(0,J.jsx)(`code`,{className:`oc-traces__mono`,children:e.kind}),sort:e=>e.kind},{header:v(),cell:e=>(0,J.jsx)(Ie,{severity:e.severity}),sort:e=>e.severity===`critical`?2:+(e.severity===`warn`)},{header:se(),cell:e=>(0,J.jsx)(Le,{status:e.status}),sort:e=>e.status===`resolved`?2:+(e.status===`acknowledged`)},{header:x(),cell:e=>(0,J.jsx)(H,{variant:`outline`,children:e.source}),sort:e=>e.source},{header:fe(),cell:e=>(0,J.jsxs)(`div`,{className:`oc-anomaly__msgcell`,children:[(0,J.jsx)(`span`,{className:`oc-anomaly__msg`,children:e.message}),(0,J.jsx)(Fe,{row:e})]}),sort:e=>e.message},{header:C(),cell:e=>(0,J.jsx)(Pe,{row:e}),sort:e=>e.evidence??null},{header:_e(),cell:e=>e.correlationId?(0,J.jsx)(`code`,{className:`oc-traces__mono`,children:Re(e.correlationId)}):(0,J.jsx)(`span`,{className:`oc-traces__muted`,children:`—`}),sort:e=>e.correlationId}]})]})}function Q(e){if(e.kind!==`openclaw.dispatch_failures`||!e.evidence)return{};try{let t=JSON.parse(e.evidence);return{dominantCode:t.dominantCode,sampleCorrelationId:t.sampleCorrelationId}}catch{return{}}}function $(e){if(e.kind!==`subagent.failure`||!e.evidence)return{};try{let t=JSON.parse(e.evidence);return{failedCount:t.failedCount,totalCount:t.totalCount,errorCategories:t.errorCategories}}catch{return{}}}function Pe({row:e}){let t=B();if(e.kind===`subagent.failure`){let n=$(e);return(0,J.jsxs)(`div`,{className:`oc-anomaly__cause`,children:[(0,J.jsx)(`div`,{className:`oc-anomaly__cause-head`,children:[...new Set(n.errorCategories??[])].map(e=>(0,J.jsx)(`code`,{className:`oc-traces__mono`,children:e},e))}),e.correlationId?(0,J.jsxs)(`button`,{type:`button`,className:`oc-anomaly__drill`,onClick:()=>void t({to:`/settings/traces`,search:{q:e.correlationId,limit:100}}),children:[`↗ `,T()]}):null]})}let n=Q(e);if(!n.dominantCode)return(0,J.jsx)(`span`,{className:`oc-traces__muted`,children:`—`});let r=K(n.dominantCode),i=n.sampleCorrelationId;return(0,J.jsxs)(`div`,{className:`oc-anomaly__cause`,children:[(0,J.jsxs)(`div`,{className:`oc-anomaly__cause-head`,children:[(0,J.jsx)(`span`,{className:`oc-anomaly__cause-label`,children:r.label}),(0,J.jsx)(`code`,{className:`oc-traces__mono`,children:n.dominantCode})]}),(0,J.jsx)(`p`,{className:`oc-anomaly__cause-hint`,children:r.hint}),i?(0,J.jsxs)(`button`,{type:`button`,className:`oc-anomaly__drill`,onClick:()=>void t({to:`/settings/traces`,search:{q:i,limit:100}}),children:[`↗ `,T()]}):null]})}function Fe({row:e}){let[t,n]=(0,q.useState)(!1),i=j(m.anomalies.getAnomalyAttachments,t?{anomalyId:e._id}:`skip`);return!e.attachments||e.attachments.length===0?null:(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(`button`,{type:`button`,className:`oc-anomaly__drill`,onClick:()=>n(!0),children:[b(),e.attachments.length>1?` (${e.attachments.length})`:``]}),(0,J.jsx)(R,{open:t,onOpenChange:n,children:(0,J.jsxs)(V,{className:`oc-anomaly__attachments-dialog`,children:[(0,J.jsx)(z,{children:(0,J.jsx)(U,{children:r()})}),i===void 0?(0,J.jsx)(`p`,{className:`oc-traces__muted`,children:f()}):i.length===0?(0,J.jsx)(`p`,{className:`oc-traces__muted`,children:_()}):(0,J.jsx)(`div`,{className:`oc-anomaly__attachments`,children:i.map(e=>(0,J.jsxs)(`section`,{className:`oc-anomaly__attachment`,children:[(0,J.jsx)(`h4`,{className:`oc-anomaly__attachment-name`,children:(0,J.jsx)(`code`,{className:`oc-traces__mono`,children:e.name})}),(0,J.jsx)(`pre`,{className:`oc-anomaly__attachment-content`,children:e.content})]},e.name))})]})})]})}function Ie({severity:e}){return(0,J.jsx)(`span`,{className:`oc-anomaly__sev oc-anomaly__sev--${e}`,children:e})}function Le({status:e}){return e===`open`?(0,J.jsx)(H,{variant:`destructive`,children:h()}):e===`acknowledged`?(0,J.jsx)(H,{variant:`secondary`,children:g()}):(0,J.jsx)(H,{variant:`outline`,children:c()})}function Re(e){return e.length>8?e.slice(0,8):e}export{Z as AnomaliesTab};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Bx as r,Fx as i,Gx as a,Hx as o,Ix as s,Lx as c,Mx as l,Nx as u,Px as d,Rx as f,Sr as p,T as m,Ux as h,Vx as g,Wx as _,_r as v,br as y,jx as b,vr as x,xr as S,yF as C,yr as w,zx as T}from"./dist-B1qnlN7I.js";import{C as E,S as D,T as O,Y as k,a as A,i as j,n as M,nn as N,o as P,rn as F,s as I,w as L,x as R}from"./index-rCasMjHB.js";import{n as ee}from"./TimeRangePicker-fvvxJ7HC.js";import{t as z}from"./FilterBar-UyunwEZF.js";import{t as B}from"./AdvancedFilter-B6eiX7Zx.js";import{t as V}from"./DataTableShell-D-RklOZj.js";var H=t(e(),1),U=n(),W={kind:`relative`,from:M,to:`now`},G=`__all__`,K=[{value:`action`,label:p()},{value:`realLabel`,label:S()},{value:`targetLabel`,label:y()},{value:`impersonated`,label:w()},{value:`resource`,label:x()},{value:`resourceId`,label:v()}];function q(){let e=F({from:`/settings/audit`}),t=N({from:`/settings/audit`}),n=e.q??``,p=e.action??G,v=e.impersonated??G,y=e.resource??G,x=j(e.from,e.to),S=(0,H.useMemo)(()=>I(e.adv),[e.adv]),{from:w,to:M}=ee(x),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,...P(e)})}),Q=e=>void t({search:t=>({...t,adv:A(e)}),replace:!0}),$=C(m.admin.listAudit,{filter:{q:n||void 0,from:w,to:M,action:p===G?void 0:p,resource:y===G?void 0:y,impersonated:v===G?void 0:v===`yes`,advanced:S.length>0?S: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!==``||p!==G||v!==G||y!==G||S.length>0||x.kind!==`relative`||x.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:_()})]}),(0,U.jsxs)(z,{q:n,onQChange:q,searchPlaceholder:h(),timeRange:x,onTimeRangeChange:Z,onReset:ie,canReset:re,children:[(0,U.jsxs)(R,{value:p,onValueChange:J,children:[(0,U.jsx)(L,{size:`sm`,className:`w-40`,children:(0,U.jsx)(O,{placeholder:o()})}),(0,U.jsxs)(D,{children:[(0,U.jsx)(E,{value:G,children:g()}),te.map(e=>(0,U.jsx)(E,{value:e,children:e},e))]})]}),(0,U.jsxs)(R,{value:v,onValueChange:Y,children:[(0,U.jsx)(L,{size:`sm`,className:`w-40`,children:(0,U.jsx)(O,{})}),(0,U.jsxs)(D,{children:[(0,U.jsx)(E,{value:G,children:r()}),(0,U.jsx)(E,{value:`yes`,children:T()}),(0,U.jsx)(E,{value:`no`,children:f()})]})]}),(0,U.jsxs)(R,{value:y,onValueChange:X,children:[(0,U.jsx)(L,{size:`sm`,className:`w-40`,children:(0,U.jsx)(O,{placeholder:c()})}),(0,U.jsxs)(D,{children:[(0,U.jsx)(E,{value:G,children:s()}),ne.map(e=>(0,U.jsx)(E,{value:e,children:e},e))]})]})]}),(0,U.jsx)(B,{fields:K,seed:S,onChange:Q}),(0,U.jsx)(V,{title:i(),rows:$,emptyHint:d(),columns:[{header:u(),cell:e=>k(e.at),sort:e=>e.at},{header:o(),cell:e=>e.action,sort:e=>e.action},{header:l(),cell:e=>e.realLabel,sort:e=>e.realLabel},{header:b(),cell:e=>e.targetLabel??`—`,sort:e=>e.targetLabel??null},{header:c(),cell:e=>e.resource?e.resource+(e.resourceId?` · ${e.resourceId.slice(0,8)}`:``):`—`,sort:e=>e.resource??null}]})]})}export{q as AuditTab};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$g as r,Ag as i,B_ as a,Bg as o,Bn as s,Cg as c,D as l,Dg as u,Eg as d,F_ as f,Fg as p,G_ as m,Gg as h,H_ as ee,Hg as g,Hn as _,I_ as te,Ig as v,J_ as y,Jg as b,K_ as ne,Kg as x,Kn as re,Lg as ie,Mg as ae,Ng as oe,Og as se,Pg as ce,Qg as le,Rg as ue,Sg as de,T as S,Tg as fe,U_ as pe,Ug as me,Un as he,V_ as ge,Vg as _e,Vn as ve,W_ as ye,Wg as be,Xc as xe,Xg as Se,Y_ as Ce,Yg as we,Zg as Te,_g as C,a_ as Ee,al as De,bg as Oe,c_ as ke,cl as Ae,d_ as je,dl as Me,e_ as Ne,el as Pe,f_ as Fe,fl as Ie,gF as Le,gg as Re,i_ as ze,il as Be,jg as Ve,kg as He,l_ as Ue,ll as We,n_ as Ge,nl as Ke,o_ as qe,ol as Je,p_ as Ye,qg as Xe,r_ as Ze,rl as Qe,s_ as $e,sl as et,t_ as tt,tl as nt,u_ as rt,ul as it,vF as at,vg as ot,wg as st,xg as ct,yF as w,yg as lt,z_ as ut,zg as dt,zn as ft}from"./dist-B1qnlN7I.js";import{i as T,r as pt}from"./dist-CRven8ef.js";import{t as mt}from"./chevrons-up-down-C82Hxi1c.js";import{i as ht,n as E,o as gt,r as _t,s as vt}from"./FieldLabel-HlyBnXo4.js";import{i as yt,n as bt,r as xt,t as St}from"./tabs-DKk4J439.js";import{t as D}from"./button-BCAsV4-2.js";import{$t as O,C as k,G as Ct,K as wt,Kt as Tt,Lt as Et,Pt as A,S as j,T as M,X as N,Y as P,at as Dt,en as F,gt as Ot,h as kt,it as I,lt as At,m as jt,nn as L,ot as Mt,q as Nt,rn as Pt,rt as R,st as Ft,ut as It,w as z,wt as Lt,x as B}from"./index-rCasMjHB.js";import{r as Rt}from"./locales-CPjguROj.js";import{a as zt,i as V,n as Bt,o as H,r as U,t as Vt}from"./table-DckOsZQY.js";import{t as Ht}from"./FilterBar-UyunwEZF.js";import{a as Ut,n as Wt,o as Gt,r as Kt,s as qt,t as Jt}from"./compatView-CKSMKOA6.js";import{t as W}from"./dispatchErrorInfo-BMHBocZy.js";var Yt=l(`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`}]]),Xt=l(`wifi-off`,[[`path`,{d:`M12 20h.01`,key:`zekei9`}],[`path`,{d:`M8.5 16.429a5 5 0 0 1 7 0`,key:`1bycff`}],[`path`,{d:`M5 12.859a10 10 0 0 1 5.17-2.69`,key:`1dl1wf`}],[`path`,{d:`M19 12.859a10 10 0 0 0-2.007-1.523`,key:`4k23kn`}],[`path`,{d:`M2 8.82a15 15 0 0 1 4.177-2.643`,key:`1grhjp`}],[`path`,{d:`M22 8.82a15 15 0 0 0-11.288-3.764`,key:`z3jwby`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}]]),G=t(e(),1);function Zt(e){return e.filter(e=>e.state===`error`)}function Qt(e){return e.reachable&&Zt(e.targets).length===0}function $t(e){return Qt(e)?(e.unreachableInstances??[]).length>0?`gateways_unreachable`:`ok`:`error`}function en(e){return e.state===`error`&&e.lastErrorCode!==null}function tn(e){return!!e.lastDownstreamRejectCode}function K(e){return e.kind??`openclaw`}function nn(e){return[...e].sort((e,t)=>e===`openclaw`?-1:t===`openclaw`?1:e.localeCompare(t))}function rn(e,t,n){let r=new Map;for(let e of t)e.instanceName&&r.set(e.instanceName,e.provider);for(let e of n)r.set(e.name,K(e));let i=e=>(e.instanceName?r.get(e.instanceName):void 0)??`openclaw`,a=new Set;for(let e of n)a.add(K(e));for(let e of t)a.add(e.provider);for(let t of e)a.add(i(t));return nn(a).map(r=>({key:r,connections:e.filter(e=>i(e)===r),compatTargets:t.filter(e=>e.provider===r),instances:n.filter(e=>K(e)===r)}))}function q(e){return e===`openclaw`?`OpenClaw`:e===`hermes`?`Hermes`:e.charAt(0).toUpperCase()+e.slice(1)}var J=`__all__`,an={q:``,state:J,instance:J,version:J},Y={connected:0,error:1,idle:2};function on(e){return e.q.trim()!==``||e.state!==`__all__`||e.instance!==`__all__`||e.version!==`__all__`}function sn(e,t){let n=t.q.trim().toLowerCase();return e.filter(e=>!(n&&!`${e.targetLabel} ${e.gatewayHost}`.toLowerCase().includes(n)||t.state!==`__all__`&&e.state!==t.state||t.instance!==`__all__`&&(e.instanceName??``)!==t.instance||t.version!==`__all__`&&(e.gatewayVersion??``)!==t.version))}function X(e,t){return e.localeCompare(t,void 0,{numeric:!0,sensitivity:`base`})}function cn(e,t){return e===`version`?t.gatewayVersion===null:e===`lastOk`?t.lastOkAt===null:!1}function ln(e,t,n){switch(e){case`state`:return(Y[t.state]??99)-(Y[n.state]??99);case`instance`:return X(t.instanceLabel??t.instanceName??``,n.instanceLabel??n.instanceName??``);case`host`:return X(t.gatewayHost,n.gatewayHost);case`version`:{let e=t.gatewayVersion,r=n.gatewayVersion;return Gt(e,r)??X(e,r)}case`lastOk`:return t.lastOkAt-n.lastOkAt;default:return X(t.targetLabel,n.targetLabel)}}function un(e,t){if(!t)return e;let n=t.dir===`asc`?1:-1;return[...e].sort((e,r)=>{let i=cn(t.key,e),a=cn(t.key,r);return i&&a?0:i?1:a?-1:n*ln(t.key,e,r)})}function dn(e){let t=new Set;for(let n of e)t.add(n.state);return[...t].sort((e,t)=>(Y[e]??99)-(Y[t]??99))}function fn(e){let t=new Map;for(let n of e)n.instanceName!==null&&(t.has(n.instanceName)||t.set(n.instanceName,n.instanceLabel??n.instanceName));return[...t.entries()].map(([e,t])=>({name:e,label:t})).sort((e,t)=>X(e.label,t.label))}function pn(e){let t=new Set;for(let n of e)n.gatewayVersion!==null&&t.add(n.gatewayVersion);return[...t].sort((e,t)=>Gt(e,t)??X(e,t))}var Z=n();function mn({connections:e,displayByInstance:t}){let[n,r]=(0,G.useState)(an),[a,o]=(0,G.useState)(null),s=(0,G.useMemo)(()=>e.map((e,n)=>({_id:`${e.key}:${e.canonical}/${e.agentId}:${n}`,targetLabel:`${e.canonical}/${e.agentId}`,state:e.state,instanceName:e.instanceName??null,instanceLabel:e.instanceName?t.get(e.instanceName)??e.instanceName:null,gatewayHost:e.gatewayHost,gatewayVersion:e.gatewayVersion??null,okCount:e.okCount,errorCount:e.errorCount+(e.downstreamRejectCount??0),attempts:e.attempts,lastOkAt:e.lastOkAt??null,lastErrorCode:e.lastErrorCode??null,lastErrorAt:e.lastErrorAt??null,lastDownstreamRejectCode:e.lastDownstreamRejectCode??null,lastDownstreamRejectAt:e.lastDownstreamRejectAt??null})),[e,t]),l=(0,G.useMemo)(()=>dn(s),[s]),f=(0,G.useMemo)(()=>fn(s),[s]),p=(0,G.useMemo)(()=>pn(s),[s]),m=(0,G.useMemo)(()=>un(sn(s,n),a),[s,n,a]);function h(e){o(t=>t?.key===e?t.dir===`asc`?{key:e,dir:`desc`}:null:{key:e,dir:`asc`})}return e.length===0?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:ce()}):(0,Z.jsxs)(`div`,{className:`oc-conn`,children:[(0,Z.jsxs)(Ht,{q:n.q,onQChange:e=>r(t=>({...t,q:e})),searchPlaceholder:Ve(),onReset:()=>r(an),canReset:on(n),children:[(0,Z.jsxs)(B,{value:n.state,onValueChange:e=>r(t=>({...t,state:e})),children:[(0,Z.jsx)(z,{size:`sm`,className:`w-36`,children:(0,Z.jsx)(M,{placeholder:He()})}),(0,Z.jsxs)(j,{children:[(0,Z.jsx)(k,{value:J,children:i()}),l.map(e=>(0,Z.jsx)(k,{value:e,children:gn(e)},e))]})]}),(0,Z.jsxs)(B,{value:n.instance,onValueChange:e=>r(t=>({...t,instance:e})),children:[(0,Z.jsx)(z,{size:`sm`,className:`w-40`,children:(0,Z.jsx)(M,{placeholder:se()})}),(0,Z.jsxs)(j,{children:[(0,Z.jsx)(k,{value:J,children:i()}),f.map(e=>(0,Z.jsx)(k,{value:e.name,children:e.label},e.name))]})]}),(0,Z.jsxs)(B,{value:n.version,onValueChange:e=>r(t=>({...t,version:e})),children:[(0,Z.jsx)(z,{size:`sm`,className:`w-36`,children:(0,Z.jsx)(M,{placeholder:u()})}),(0,Z.jsxs)(j,{children:[(0,Z.jsx)(k,{value:J,children:i()}),p.map(e=>(0,Z.jsx)(k,{value:e,children:e},e))]})]})]}),m.length===0?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:d()}):(0,Z.jsxs)(Vt,{className:`oc-conn__table`,children:[(0,Z.jsx)(zt,{children:(0,Z.jsxs)(H,{children:[(0,Z.jsx)(Q,{label:fe(),sortKey:`target`,sort:a,onSort:h}),(0,Z.jsx)(Q,{label:st(),sortKey:`state`,sort:a,onSort:h}),(0,Z.jsx)(Q,{label:c(),sortKey:`instance`,sort:a,onSort:h}),(0,Z.jsx)(Q,{label:de(),sortKey:`host`,sort:a,onSort:h}),(0,Z.jsx)(Q,{label:ct(),sortKey:`version`,sort:a,onSort:h}),(0,Z.jsx)(V,{children:Oe()}),(0,Z.jsx)(Q,{label:lt(),sortKey:`lastOk`,sort:a,onSort:h})]})}),(0,Z.jsx)(Bt,{children:m.map(e=>(0,Z.jsx)(hn,{r:e},e._id))})]})]})}function Q({label:e,sortKey:t,sort:n,onSort:r}){let i=n?.key===t,a=i?n.dir:null;return(0,Z.jsx)(V,{"aria-sort":i?a===`asc`?`ascending`:`descending`:`none`,children:(0,Z.jsxs)(`button`,{type:`button`,className:`oc-conn__sort`,onClick:()=>r(t),children:[e,i?a===`asc`?(0,Z.jsx)(pt,{size:13,"aria-hidden":!0}):(0,Z.jsx)(T,{size:13,"aria-hidden":!0}):(0,Z.jsx)(mt,{size:13,"aria-hidden":!0,className:`oc-conn__sort-idle`})]})})}function hn({r:e}){let t=en(e)?W(e.lastErrorCode):null,n=tn(e)?W(e.lastDownstreamRejectCode):null;return(0,Z.jsxs)(G.Fragment,{children:[(0,Z.jsxs)(H,{className:`oc-conn__row oc-conn__row--${e.state}`,children:[(0,Z.jsx)(U,{children:(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:e.targetLabel})}),(0,Z.jsx)(U,{children:(0,Z.jsx)(_n,{state:e.state})}),(0,Z.jsx)(U,{children:e.instanceLabel?(0,Z.jsx)(`span`,{className:`oc-bridge-target__instance`,children:e.instanceLabel}):(0,Z.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})}),(0,Z.jsx)(U,{children:(0,Z.jsx)(`span`,{className:`oc-bridge-target__host`,children:e.gatewayHost})}),(0,Z.jsx)(U,{children:e.gatewayVersion?(0,Z.jsx)(`span`,{className:`oc-bridge-target__version`,children:e.gatewayVersion}):(0,Z.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})}),(0,Z.jsx)(U,{children:(0,Z.jsx)(`span`,{className:`oc-conn__stats`,children:oe({ok:e.okCount,errors:e.errorCount,attempts:e.attempts})})}),(0,Z.jsx)(U,{children:e.lastOkAt?(0,Z.jsx)(`span`,{className:`oc-traces__mono`,children:N(e.lastOkAt)}):(0,Z.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})})]}),t||n?(0,Z.jsx)(H,{className:`oc-conn__detail-row`,children:(0,Z.jsxs)(U,{colSpan:7,className:`oc-conn__detail-cell`,children:[t?(0,Z.jsxs)(`div`,{className:`oc-bridge-target__error`,children:[(0,Z.jsx)(`strong`,{children:t.label}),` `,(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:e.lastErrorCode}),e.lastErrorAt?` · ${N(e.lastErrorAt)}`:``,(0,Z.jsx)(`p`,{className:`oc-bridge-card__hint`,children:t.hint})]}):null,n?(0,Z.jsxs)(`div`,{className:`oc-bridge-target__downstream`,children:[ae({label:n.label}),` `,(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:e.lastDownstreamRejectCode}),e.lastDownstreamRejectAt?` · ${N(e.lastDownstreamRejectAt)}`:``]}):null]})}):null]})}function gn(e){return e===`connected`?ot():e===`error`?C():Re()}function _n({state:e}){return e===`connected`?(0,Z.jsx)(R,{variant:`secondary`,children:ot()}):e===`error`?(0,Z.jsx)(R,{variant:`destructive`,children:C()}):(0,Z.jsx)(R,{variant:`outline`,children:Re()})}function vn(){return w(S.bridgeHealth.getBridgeHealth,{})}function yn(){let e=vn(),t=w(S.compat.getBridgeCompat,{}),n=w(S.me.getMe,{host:Ot})?.role===`admin`,i=w(S.admin.listInstances,n?{}:`skip`),a=w(S.agents.usageForInstances,n?{}:`skip`),o=L(),c=()=>void o({to:`/settings/anomalies`,search:{status:`open`}}),l=rn(e?e.targets:[],t?t.targets:[],i??[]),{section:u}=Pt({from:`/settings/bridge`}),d=L({from:`/settings/bridge`}),f=t?.compat??null,p=t===void 0?`loading`:t===null?`nodata`:`ready`,m=f!==null&&Wt(f,`hermes`)&&!l.some(e=>e.key===`hermes`);return(0,Z.jsxs)(`div`,{className:`oc-bridge`,children:[(0,Z.jsx)(bn,{health:e,compat:t,onSeeAnomalies:c}),(0,Z.jsx)(`p`,{className:`oc-admin__hint oc-bridge__caption`,children:r()}),a&&a.length>0?(0,Z.jsxs)(`section`,{className:`oc-bridge__usage`,children:[(0,Z.jsx)(`h3`,{className:`oc-bridge__usage-title`,children:le()}),(0,Z.jsxs)(Vt,{children:[(0,Z.jsx)(zt,{children:(0,Z.jsxs)(H,{children:[(0,Z.jsx)(V,{children:he()}),(0,Z.jsx)(V,{children:_()}),(0,Z.jsx)(V,{children:ve()}),(0,Z.jsx)(V,{children:s()}),(0,Z.jsx)(V,{children:ft()})]})}),(0,Z.jsx)(Bt,{children:a.flatMap(e=>{let t=kt(e.usage,Date.now());return t?t.windows.map((t,n)=>(0,Z.jsxs)(H,{children:[(0,Z.jsx)(U,{className:`font-medium`,children:n===0?e.instanceName:``}),(0,Z.jsx)(U,{children:t.provider}),(0,Z.jsx)(U,{children:t.label}),(0,Z.jsx)(U,{children:(0,Z.jsxs)(R,{variant:t.percentLeft<=10?`destructive`:t.percentLeft<=25?`outline`:`secondary`,children:[t.percentLeft,`%`]})}),(0,Z.jsx)(U,{className:`text-muted-foreground`,children:t.resetText??`—`})]},`${e.instanceName}:${t.provider}:${t.label}`)):[]})})]})]}):null,l.length>0?(0,Z.jsxs)(St,{value:l.some(e=>e.key===u)?u:l[0]?.key??`openclaw`,onValueChange:e=>void d({search:{section:e},replace:!0}),children:[(0,Z.jsx)(xt,{className:`w-full`,children:l.map(e=>(0,Z.jsxs)(yt,{value:e.key,className:`flex-1 gap-1.5`,children:[(0,Z.jsx)(Et,{size:13,"aria-hidden":!0}),q(e.key)]},e.key))}),l.map(e=>(0,Z.jsx)(bt,{value:e.key,children:(0,Z.jsx)(xn,{providerKey:e.key,connections:e.connections,instances:e.instances,manifest:f,compatStatus:p,compatReachable:t?.reachable??!0,protocol:e.key===`openclaw`?t?.protocol??null:null})},e.key))]}):null,m?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:xe()}):null]})}function bn({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,Z.jsxs)(`span`,{className:`oc-bridge-card__ver`,children:[(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:Ut(t.bridgeVersion)}),i?(0,Z.jsxs)(Z.Fragment,{children:[` `,(0,Z.jsxs)(`code`,{className:`oc-traces__mono`,title:it(),children:[`(`,i,`)`]})]}):null,r?(0,Z.jsxs)(`strong`,{className:`oc-bridge-card__mismatch`,children:[` `,We({build:t.buildVersion??`?`})]}):null,` · `,Ae(),` `,(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:t.protocolVersion===null?et():String(t.protocolVersion)})]}):null;if(e===void 0)return(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:h()});if(e===null)return(0,Z.jsx)(`div`,{className:`oc-bridge-card oc-bridge-card--idle`,children:be()});let s=Zt(e.targets),c=!e.reachable,l=$t(e),u=e.unreachableInstances??[],d=l===`ok`?`ok`:l===`gateways_unreachable`?`warn`:`error`,f=P(e.checkedAt),p=e.startedAt==null?null:P(e.startedAt);return(0,Z.jsxs)(`div`,{className:`oc-bridge-card oc-bridge-card--${d}`,children:[(0,Z.jsx)(`div`,{className:`oc-bridge-card__icon`,"aria-hidden":!0,children:l===`ok`?(0,Z.jsx)(O,{size:22}):c||l===`gateways_unreachable`?(0,Z.jsx)(Xt,{size:22}):(0,Z.jsx)(A,{size:22})}),(0,Z.jsxs)(`div`,{className:`oc-bridge-card__body`,children:[(0,Z.jsx)(`div`,{className:`oc-bridge-card__title`,children:l===`ok`?me():l===`gateways_unreachable`?dt({count:u.length}):c?g():_e({count:s.length})}),(0,Z.jsxs)(`div`,{className:`oc-bridge-card__meta`,children:[(0,Z.jsxs)(`span`,{children:[(0,Z.jsx)(Yt,{size:12,"aria-hidden":!0}),` `,o({time:f})]}),p?(0,Z.jsx)(`span`,{children:ie({time:p})}):null,a]}),l===`gateways_unreachable`?(0,Z.jsx)(`p`,{className:`oc-bridge-card__hint`,children:ue({names:u.join(`, `)})}):null,c?(0,Z.jsx)(`p`,{className:`oc-bridge-card__hint`,children:W(e.lastError===`not_configured`?`NOT_CONFIGURED`:`BRIDGE_UNREACHABLE`).hint}):null]}),(0,Z.jsx)(`button`,{type:`button`,className:`oc-bridgebar__drill`,onClick:n,children:v()})]})}function xn({providerKey:e,connections:t,instances:n,manifest:r,compatStatus:i,compatReachable:a,protocol:o}){let s=r?qt(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:Jt(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,[m,h]=(0,G.useState)(!1);return(0,Z.jsxs)(`section`,{className:`oc-bridge-provider`,children:[(0,Z.jsxs)(`header`,{className:`oc-bridge-provider__head`,children:[(0,Z.jsx)(Et,{size:15,"aria-hidden":!0,className:`oc-bridge-provider__icon`}),(0,Z.jsx)(`span`,{className:`oc-bridge-provider__name`,children:q(e)}),f?(0,Z.jsx)(R,{variant:f===`beyond`?`destructive`:`secondary`,children:Kt(f)}):null]}),(0,Z.jsx)(`h4`,{className:`oc-bridge-provider__sub`,children:Ie()}),(0,Z.jsx)(Cn,{providerName:q(e),support:s,compatStatus:i,compatReachable:a,manifest:r,instanceRows:l}),o?(0,Z.jsx)(Sn,{protocol:o}):null,(0,Z.jsxs)(`button`,{type:`button`,className:`oc-bridge-provider__sub oc-bridge-provider__sub--toggle`,"aria-expanded":m,onClick:()=>h(e=>!e),children:[m?(0,Z.jsx)(T,{size:13,"aria-hidden":!0}):(0,Z.jsx)(F,{size:13,"aria-hidden":!0}),p({count:t.length})]}),m?(0,Z.jsx)(mn,{connections:t,displayByInstance:c}):null]})}function Sn({protocol:e}){let[t,n]=(0,G.useState)(!1),r=e.coverage,i=e.drift??[];return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`h4`,{className:`oc-bridge-provider__sub`,children:[Te(),i.length>0?(0,Z.jsx)(R,{variant:`destructive`,children:we({count:i.length})}):(0,Z.jsx)(R,{variant:`secondary`,children:Se()})]}),(0,Z.jsxs)(`p`,{className:`oc-admin__hint`,children:[b({version:e.vendoredVersion}),r?` · `+Xe({handled:r.handled,ignored:r.ignored,gaps:r.gaps}):null]}),i.length>0?(0,Z.jsx)(`ul`,{className:`oc-bridge-protocol__list`,role:`list`,children:i.map(e=>(0,Z.jsxs)(`li`,{children:[(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:e.shape}),` × `,e.count]},e.shape))}):null,r&&r.gapList.length>0?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`button`,{type:`button`,className:`oc-bridge-provider__sub oc-bridge-provider__sub--toggle`,"aria-expanded":t,onClick:()=>n(e=>!e),children:[t?(0,Z.jsx)(T,{size:13,"aria-hidden":!0}):(0,Z.jsx)(F,{size:13,"aria-hidden":!0}),x({count:r.gapList.length})]}),t?(0,Z.jsx)(`ul`,{className:`oc-bridge-protocol__list`,role:`list`,children:r.gapList.map(e=>(0,Z.jsx)(`li`,{children:(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:e})},e))}):null]}):null]})}function Cn({support:e,compatStatus:t,compatReachable:n,manifest:r,instanceRows:i,providerName:a}){return t===`loading`?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:h()}):t===`nodata`?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:Me()}):(0,Z.jsxs)(`div`,{className:`oc-compat`,children:[n?null:(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:Je()}),r===null?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:De()}):(0,Z.jsxs)(`div`,{className:`oc-compat__support`,children:[(0,Z.jsx)(`span`,{className:`oc-compat__label`,children:re({provider:a})}),e&&e.range!==null?(0,Z.jsx)(`span`,{children:Be({min:e.range.min,max:e.range.maxValidated})}):(0,Z.jsx)(`span`,{children:et()}),e?(0,Z.jsx)(En,{versions:e.validatedVersions}):null]}),i.length===0?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:Pe()}):(0,Z.jsx)(`div`,{className:`oc-compat__targets`,children:i.map(e=>(0,Z.jsxs)(`div`,{className:`oc-compat__target`,children:[(0,Z.jsx)(`span`,{className:`oc-compat__instance`,children:e.displayName}),(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:Ut(e.version)}),(0,Z.jsx)(R,{variant:e.state===`supported`?`secondary`:e.state===`beyond`?`destructive`:`outline`,children:Kt(e.state)})]},e.instanceName))})]})}function wn({instance:e,onClose:t}){return(0,Z.jsx)(Dt,{open:!0,onOpenChange:e=>!e&&t(),children:(0,Z.jsxs)(Mt,{className:`oc-bridge-config-dialog`,onOpenAutoFocus:e=>e.preventDefault(),children:[(0,Z.jsxs)(At,{children:[(0,Z.jsx)(It,{children:Ce({instance:e.displayName??e.name})}),(0,Z.jsx)(Ft,{children:y()})]}),(0,Z.jsx)(Tn,{instance:e,onClose:t})]})})}function $({label:e,result:t}){return t?t.checked?(0,Z.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,Z.jsx)(O,{"aria-hidden":!0}):(0,Z.jsx)(A,{"aria-hidden":!0}),(0,Z.jsxs)(`span`,{children:[e,` — `,t.ok?Ze():t.detail]})]}):(0,Z.jsxs)(`p`,{className:`oc-bridge-config__check-row oc-bridge-config__check-row--skip`,children:[e,` — `,Ge()]}):null}function Tn({instance:e,onClose:t}){let n=at(S.admin.upsertInstanceConfig),r=Le(S.bridge.validateMediaPaths),i=Lt(),o=Rt(e.config?.contentLocale,void 0),[s,c]=(0,G.useState)(()=>ht(e.config??{},o)),[l,u]=(0,G.useState)(!1),[d,p]=(0,G.useState)(!1),[h,g]=(0,G.useState)(null),_=s.inboundMediaMode===`shared-fs`,v=s.mediaMode===`shared-fs`,y=_||v;async function b(){p(!0),g(null);try{g(await r({instanceName:e.name,inboundMediaMode:s.inboundMediaMode,mediaMode:s.mediaMode}))}catch(e){i.error($e(),e)}finally{p(!1)}}async function x(){u(!0);try{let r=e.config??{};await n({instanceId:e._id,config:_t(s,r,o)}),t()}catch(e){i.error(ge(),e)}finally{u(!1)}}return(0,Z.jsx)(`div`,{className:`oc-bridge-config`,children:(0,Z.jsxs)(`div`,{className:`oc-bridge-config__form`,children:[(0,Z.jsxs)(`div`,{className:`oc-bridge-config__grid`,children:[(0,Z.jsxs)(`label`,{className:`oc-field`,children:[(0,Z.jsx)(E,{label:ne(),help:a()}),(0,Z.jsxs)(B,{value:s.mediaMode,onValueChange:e=>c({...s,mediaMode:e}),children:[(0,Z.jsx)(z,{size:`sm`,className:`w-full`,children:(0,Z.jsx)(M,{})}),(0,Z.jsx)(j,{children:vt.map(e=>(0,Z.jsx)(k,{value:e,children:e},e))})]})]}),(0,Z.jsxs)(`label`,{className:`oc-field`,children:[(0,Z.jsx)(E,{label:m(),help:ut()}),(0,Z.jsxs)(B,{value:s.inboundMediaMode,onValueChange:e=>c({...s,inboundMediaMode:e}),children:[(0,Z.jsx)(z,{size:`sm`,className:`w-full`,children:(0,Z.jsx)(M,{})}),(0,Z.jsx)(j,{children:gt.map(e=>(0,Z.jsx)(k,{value:e,children:e},e))})]})]}),(0,Z.jsxs)(`label`,{className:`oc-field`,children:[(0,Z.jsx)(E,{label:ye(),help:te()}),(0,Z.jsx)(I,{type:`number`,min:1,max:4096,className:`w-full`,value:s.mediaMaxMb,onChange:e=>c({...s,mediaMaxMb:Math.trunc(Number(e.target.value)||0)})})]})]}),y&&(0,Z.jsxs)(`div`,{className:`oc-bridge-config__grid`,children:[_&&(0,Z.jsxs)(`label`,{className:`oc-field`,children:[(0,Z.jsx)(E,{label:Ye(),help:Fe()}),(0,Z.jsx)(I,{className:`w-full`,spellCheck:!1,value:s.inboundAgentMount,onChange:e=>c({...s,inboundAgentMount:e.target.value})})]}),v&&(0,Z.jsxs)(`label`,{className:`oc-field`,children:[(0,Z.jsx)(E,{label:je(),help:rt()}),(0,Z.jsx)(I,{className:`w-full`,spellCheck:!1,value:s.outboundAgentMount,onChange:e=>c({...s,outboundAgentMount:e.target.value})})]})]}),(0,Z.jsxs)(`label`,{className:`oc-field--row`,children:[(0,Z.jsx)(jt,{checked:s.rehydration,onCheckedChange:e=>c({...s,rehydration:e===!0})}),(0,Z.jsx)(E,{label:pe(),help:f()})]}),y&&h!==null&&(0,Z.jsx)(`div`,{className:`oc-bridge-config__check`,children:h.reachable?!h.inbound&&!h.outbound?(0,Z.jsxs)(`p`,{className:`oc-bridge-config__check-row oc-bridge-config__check-row--err`,children:[(0,Z.jsx)(A,{"aria-hidden":!0}),Ne({reason:h.reason??`?`})]}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)($,{label:Ee(),result:h.inbound}),(0,Z.jsx)($,{label:ze(),result:h.outbound}),(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:qe()})]}):(0,Z.jsxs)(`p`,{className:`oc-bridge-config__check-row oc-bridge-config__check-row--err`,children:[(0,Z.jsx)(A,{"aria-hidden":!0}),tt()]})}),(0,Z.jsxs)(`div`,{className:`oc-bridge-config__actions`,children:[y&&(0,Z.jsxs)(D,{variant:`outline`,size:`sm`,onClick:()=>void b(),disabled:d,children:[d?(0,Z.jsx)(Tt,{className:`size-4 animate-spin`,"aria-hidden":!0}):null,d?ke():Ue()]}),(0,Z.jsx)(D,{size:`sm`,onClick:()=>void x(),disabled:l,children:ee()})]})]})})}function En({versions:e}){if(e.length===0)return null;let t=[...e].reverse();return(0,Z.jsxs)(Ct,{children:[(0,Z.jsx)(Nt,{asChild:!0,children:(0,Z.jsxs)(`button`,{type:`button`,className:`oc-compat__versions-btn`,children:[e.length===1?Qe():Ke({count:e.length}),(0,Z.jsx)(T,{size:13,"aria-hidden":!0})]})}),(0,Z.jsxs)(wt,{className:`oc-compat__versions-pop`,align:`start`,children:[(0,Z.jsx)(`p`,{className:`oc-compat__versions-title`,children:nt()}),(0,Z.jsx)(`div`,{className:`oc-compat__versions-list`,children:t.map(e=>(0,Z.jsx)(R,{variant:`secondary`,children:e},e))})]})]})}export{yn as BridgeTab,wn as InstanceConfigDialog};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Ba as r,Fu as i,Ga as a,Gn as o,Ha as s,Ka as c,Nu as l,Ou as u,Ra as d,T as f,Ua as p,Va as m,Wa as h,Zl as g,_l as _,bl as v,gF as y,gl as b,hl as x,ku as S,ml as C,pl as w,q_ as T,qa as E,uF as D,vF as O,vl as k,xl as A,yF as j,yl as M,za as N}from"./dist-B1qnlN7I.js";import{t as P}from"./button-BCAsV4-2.js";import{C as F,Pt as I,S as L,T as R,b as z,f as B,it as V,m as H,p as U,w as W,x as G}from"./index-rCasMjHB.js";import{i as K}from"./compatView-CKSMKOA6.js";/* empty css */var q=t(e(),1),J=[`off`,`minimal`,`low`,`medium`,`high`,`xhigh`];function Y(e){let t=typeof e==`object`&&e?e:{},n=t.defaults!==null&&typeof t.defaults==`object`?t.defaults:{},r=n.thinkingDefault??t.thinkingDefault,i=n.fastModeDefault??t.fastModeDefault;return{thinkingDefault:typeof r==`string`?r:null,fastModeDefault:typeof i==`boolean`?i:null}}var X=n();function Z({instance:e}){let t=O(f.admin.upsertInstanceConfig),n=j(f.agents.listAgentsForInstance,{instanceName:e.name}),r=typeof e.config?.converterAgentId==`string`?e.config.converterAgentId:``,[a,o]=(0,q.useState)(r),[c,l]=(0,q.useState)(`idle`);(0,q.useEffect)(()=>{o(r),l(`idle`)},[e._id,r]);let u=`__none__`,d=a!==r;async function m(){l(`saving`);try{let n={...e.config??{}};a===``||a===u?delete n.converterAgentId:n.converterAgentId=a,await t({instanceId:e._id,config:n}),l(`done`)}catch{l(`error`)}}let g=n?.agents??[];return(0,X.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,X.jsx)(`span`,{className:`oc-cdefaults__label`,children:h()}),(0,X.jsx)(`p`,{className:`oc-admin__hint`,children:p()}),(0,X.jsxs)(`div`,{className:`oc-cdefaults__inline`,children:[(0,X.jsxs)(G,{value:a===``?u:a,onValueChange:e=>o(e===u?``:e),children:[(0,X.jsx)(W,{className:`oc-cdefaults__select`,"aria-label":h(),children:(0,X.jsx)(R,{placeholder:s()})}),(0,X.jsxs)(L,{children:[(0,X.jsx)(F,{value:u,children:s()}),g.map(e=>(0,X.jsx)(F,{value:e.agentId,children:e.displayName?`${e.displayName} (${e.agentId})`:e.agentId},e.agentId))]})]}),(0,X.jsx)(P,{size:`sm`,disabled:!d||c===`saving`,onClick:()=>void m(),children:c===`saving`?i():x()})]}),c===`done`?(0,X.jsx)(`p`,{className:`oc-admin__hint`,role:`status`,children:C()}):null,c===`error`?(0,X.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:w()}):null]})}function Q({instance:e}){let t=O(f.admin.upsertInstanceConfig),n=e.config?.curationEnabled===!0,o=typeof e.config?.curationBudgetChars==`number`?e.config.curationBudgetChars:null,[s,c]=(0,q.useState)(n),[l,u]=(0,q.useState)(o===null?``:String(o)),[d,p]=(0,q.useState)(`idle`);(0,q.useEffect)(()=>{c(n),u(o===null?``:String(o)),p(`idle`)},[e._id,n,o]);let h=l.trim(),g=h===``?null:/^\d+$/.test(h)?Number.parseInt(h,10):NaN,_=!s||g===null||Number.isInteger(g)&&g>=4e3&&g<=6e4,v=s!==n||(g??null)!==o;async function y(){p(`saving`);try{let n={...e.config??{}};n.curationEnabled=s,!s||g===null||Number.isNaN(g)?delete n.curationBudgetChars:n.curationBudgetChars=g,await t({instanceId:e._id,config:n}),p(`done`)}catch{p(`error`)}}return(0,X.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,X.jsxs)(`label`,{className:`oc-cdefaults__inline`,style:{cursor:`pointer`},children:[(0,X.jsx)(H,{checked:s,onCheckedChange:e=>c(e===!0),"aria-label":a()}),(0,X.jsx)(`span`,{className:`oc-cdefaults__label`,children:a()})]}),(0,X.jsxs)(`div`,{className:`oc-cdefaults__inline`,children:[(0,X.jsx)(V,{type:`number`,min:4e3,max:6e4,step:1e3,placeholder:`20000`,value:l,onChange:e=>u(e.target.value),className:`oc-cdefaults__number`,"aria-invalid":!_,"aria-label":m(),disabled:!s}),(0,X.jsx)(P,{size:`sm`,disabled:!v||!_||d===`saving`,onClick:()=>void y(),children:d===`saving`?i():x()})]}),_?null:(0,X.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:r()}),d===`done`?(0,X.jsx)(`p`,{className:`oc-admin__hint`,role:`status`,children:C()}):null,d===`error`?(0,X.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:w()}):null,(0,X.jsx)(`p`,{className:`oc-cdefaults__help`,children:N()})]})}function $({instance:e}){let t=O(f.admin.upsertInstanceConfig),n=typeof e.config?.summarizeThresholdChars==`number`?e.config.summarizeThresholdChars:null,[r,a]=(0,q.useState)(n===null?``:String(n)),[o,s]=(0,q.useState)(`idle`);(0,q.useEffect)(()=>{a(n===null?``:String(n)),s(`idle`)},[e._id,n]);let l=r.trim(),u=l===``?null:/^\d+$/.test(l)?Number.parseInt(l,10):NaN,p=u===null||Number.isInteger(u)&&u>=1e3&&u<=2e5,m=(u??null)!==n;async function h(){s(`saving`);try{let n={...e.config??{}};u===null?delete n.summarizeThresholdChars:n.summarizeThresholdChars=u,await t({instanceId:e._id,config:n}),s(`done`)}catch{s(`error`)}}return(0,X.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,X.jsx)(`span`,{className:`oc-cdefaults__label`,children:E()}),(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=>a(e.target.value),className:`oc-cdefaults__number`,"aria-invalid":!p}),(0,X.jsx)(P,{size:`sm`,disabled:!m||!p||o===`saving`,onClick:()=>void h(),children:o===`saving`?i():x()})]}),p?null:(0,X.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:d()}),o===`done`?(0,X.jsx)(`p`,{className:`oc-admin__hint`,role:`status`,children:C()}):null,o===`error`?(0,X.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:w()}):null,(0,X.jsx)(`p`,{className:`oc-cdefaults__help`,children:c()})]})}function ee(){let e=y(f.agentFiles.getChatDefaults),[t,n]=(0,q.useState)({status:`loading`}),r=j(f.admin.listInstances,{}),[i,a]=(0,q.useState)(null);(0,q.useEffect)(()=>{!r||r.length===0||(!i||!r.some(e=>e.name===i))&&a(r[0].name)},[r,i]);let s=(r?.length??0)>1,c=r!==void 0&&r.length===0,d=j(f.compat.forInstance,i?{instanceName:i}:`skip`),p=i?z(d,`configDefaults`):`loading`,m=p===`loading`?null:p.blocked,h=(0,q.useMemo)(()=>s&&i?{instanceName:i}:{},[s,i]),x=(0,q.useRef)(0),C=(0,q.useCallback)(async()=>{let t=++x.current;n({status:`loading`});try{let r=Y(await e(h));if(x.current!==t)return;n({status:`done`,current:r})}catch{if(x.current!==t)return;n({status:`error`})}},[e,h]);(0,q.useEffect)(()=>{m===!1&&(s&&!i||C())},[C,m,s,i]);let w=t.status===`done`?t.current:null,E=(0,q.useMemo)(()=>J.map(e=>({id:e,label:U(e)})),[]),O=(0,q.useMemo)(()=>[{id:`fast`,label:S()},{id:`standard`,label:u()}],[]);return(0,X.jsxs)(`div`,{className:`oc-cdefaults`,children:[(0,X.jsx)(`p`,{className:`oc-admin__hint`,children:A()}),s&&i?(0,X.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,X.jsx)(`span`,{className:`oc-cdefaults__label`,children:g()}),(0,X.jsxs)(G,{value:i,onValueChange:e=>a(e),children:[(0,X.jsx)(W,{size:`sm`,"aria-label":g(),children:(0,X.jsx)(R,{})}),(0,X.jsx)(L,{children:(r??[]).map(e=>(0,X.jsx)(F,{value:e.name,children:e.name},e.name))})]})]}):null,c?(0,X.jsx)(`p`,{className:`oc-admin__hint`,role:`status`,children:T()}):p===`loading`?(0,X.jsx)(`p`,{className:`oc-admin__hint`,children:D()}):p.blocked?(0,X.jsxs)(`p`,{className:`oc-compat__blocked`,role:`status`,children:[(0,X.jsx)(I,{size:14,"aria-hidden":!0}),` `,K(p.gatewayVersion,p.provider)]}):t.status===`loading`?(0,X.jsx)(`p`,{className:`oc-admin__hint`,children:D()}):t.status===`error`?(0,X.jsxs)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:[b(),` `,(0,X.jsx)(P,{variant:`outline`,size:`sm`,onClick:()=>void C(),children:l()})]}):(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,X.jsx)(`span`,{className:`oc-cdefaults__label`,children:v()}),(0,X.jsx)(B,{options:E,value:w?.thinkingDefault??null,onChange:()=>{},disabled:!0}),(0,X.jsx)(`p`,{className:`oc-cdefaults__help`,children:M()})]}),(0,X.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,X.jsx)(`span`,{className:`oc-cdefaults__label`,children:k()}),(0,X.jsx)(B,{options:O,value:w===null||w.fastModeDefault===null?null:w.fastModeDefault?`fast`:`standard`,onChange:()=>{},disabled:!0}),(0,X.jsx)(`p`,{className:`oc-cdefaults__help`,children:_()})]}),(0,X.jsx)(`p`,{className:`oc-cdefaults__note`,children:o()})]}),(()=>{let e=r?.find(e=>e.name===(i??r[0]?.name));return e?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)($,{instance:e}),(0,X.jsx)(Q,{instance:e}),(0,X.jsx)(Z,{instance:e})]}):null})()]})}export{ee as ChatDefaultsTab};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$w as r,Aw as i,Bw as a,Cw as o,Dw as s,Ew as c,Fw as l,Gw as u,Hw as d,Iw as f,Jw as p,Kw as ee,Lw as te,Mw as m,Nw as h,Ow as g,Pw as _,Qw as ne,Rw as re,Sw as v,T as y,Tw as b,Uw as ie,Vw as ae,Ww as x,Xw as S,Yw as C,Zw as w,_w as T,aT as E,aa as D,bw as O,cT as k,dT as A,dw as j,eT as M,fw as N,gw as P,hw as F,iT as I,jw as L,kw as R,lT as z,lw as B,mw as V,nT as H,oT as U,pw as W,qw as oe,rT as G,ra as K,sT as q,tT as se,uT as ce,uw as le,vF as J,vw as ue,ww as de,xw as fe,yF as pe,yw as me,zw as he}from"./dist-B1qnlN7I.js";import{t as ge}from"./button-BCAsV4-2.js";import{F as _e,Y}from"./index-rCasMjHB.js";import{t as ve}from"./DataTableShell-D-RklOZj.js";var X=t(e(),1),Z=n(),ye={altered_words:()=>A(),incorrect:()=>ce(),incoherence:()=>z(),formatting:()=>k(),latency:()=>q(),api_error:()=>U(),other:()=>E()},Q=e=>ye[e]?.()??e;function $({matches:e,sourceWasOpen:t}){return t?e===!0?(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-ok`,children:G()}):e===!1?(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-warn`,children:H()}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill`,children:`—`}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill`,children:I()})}function be({data:e,reference:t,closeReason:n}){let i=e.snapshot,o=J(y.feedback.respondToFeedback),[s,c]=(0,X.useState)(e.thread),[m,h]=(0,X.useState)(``),[g,_]=(0,X.useState)(!1);async function v(){let t=m.trim();if(!(!t||g)){_(!0);try{await o({feedbackId:e._id,text:t}),c(e=>[...e,{authorRole:`admin`,text:t,at:Date.now()}]),h(``)}finally{_(!1)}}}let b=[];try{b=i.contextJson?JSON.parse(i.contextJson):[]}catch{b=[]}return(0,Z.jsxs)(`div`,{className:`oc-fbadmin__detail`,children:[(0,Z.jsxs)(`div`,{className:`oc-fbadmin__row`,children:[(0,Z.jsx)($,{matches:i.displayedMatchesStored,sourceWasOpen:i.clientInfo?.sourceWasOpen??!1}),(0,Z.jsxs)(`span`,{className:`oc-fbadmin__meta`,children:[Q(e.category),` · `,i.messageRole,i.isRegeneration?` · ${se()}`:``,i.openclawModel?` · ${i.openclawModel}`:``,i.openclawRuntime?` (${i.openclawRuntime})`:``]}),t?(0,Z.jsx)(`code`,{className:`oc-fbadmin__ref`,style:{userSelect:`all`,marginLeft:`auto`},title:R(),children:t}):null]}),e.comment?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:M()}),(0,Z.jsx)(`p`,{className:`oc-fbadmin__comment`,children:e.comment})]}):null,n?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:F()}),(0,Z.jsx)(`p`,{className:`oc-fbadmin__comment`,children:n})]}):null,(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:r()}),s.length>0?(0,Z.jsx)(`div`,{className:`oc-fbadmin__thread`,children:s.map((e,t)=>(0,Z.jsxs)(`div`,{className:`oc-notif__msg oc-notif__msg--${e.authorRole}`,children:[(0,Z.jsx)(`span`,{className:`oc-notif__msg-who`,children:e.authorRole===`admin`?ne():e.authorRole===`agent`?e.authorLabel??D():w()}),(0,Z.jsx)(`span`,{className:`oc-notif__msg-text`,children:e.text})]},t))}):(0,Z.jsx)(`p`,{className:`oc-fbadmin__meta`,children:S()}),(0,Z.jsx)(`textarea`,{className:`oc-feedback__textarea`,placeholder:C(),value:m,maxLength:2e3,rows:3,onChange:e=>h(e.target.value.slice(0,2e3))}),(0,Z.jsx)(`div`,{className:`oc-fbadmin__row`,style:{justifyContent:`flex-end`},children:(0,Z.jsx)(ge,{size:`sm`,onClick:()=>void v(),disabled:!m.trim()||g,children:g?p():oe()})})]}),(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:ee()}),(0,Z.jsx)(`pre`,{className:`oc-msg__source-pre`,children:i.messageText||u()})]}),i.clientInfo?.sourceWasOpen&&i.displayedText!==void 0?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:x()}),(0,Z.jsx)(`pre`,{className:`oc-msg__source-pre`,children:i.displayedText||u()})]}):null,i.promptText?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:ie()}),(0,Z.jsx)(`pre`,{className:`oc-msg__source-pre`,children:i.promptText})]}):null,b.length>0?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:d({count:i.contextCount??b.length,truncated:i.contextTruncated?ae():``})}),(0,Z.jsx)(`div`,{className:`oc-fbadmin__ctx`,children:b.map((e,t)=>(0,Z.jsxs)(`div`,{className:`oc-fbadmin__ctx-turn`,children:[(0,Z.jsx)(`span`,{className:`oc-fbadmin__ctx-role`,children:e.role}),(0,Z.jsx)(`span`,{className:`oc-fbadmin__ctx-text`,children:e.text})]},t))})]}):null,i.outboxAvailable?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:a()}),(0,Z.jsxs)(`pre`,{className:`oc-msg__source-pre`,children:[i.outboxText??``,i.outboxStatus?`\n[status: ${i.outboxStatus}]`:``]})]}):null,i.clientInfo?.extensionsDetected&&i.clientInfo.extensionsDetected.length>0?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:he()}),(0,Z.jsx)(`div`,{className:`oc-fbadmin__row`,children:i.clientInfo.extensionsDetected.map(e=>(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-warn`,children:e},e))})]}):null,(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:re()}),(0,Z.jsxs)(`p`,{className:`oc-fbadmin__env`,children:[[i.clientInfo?.language,i.clientInfo?.timezone,i.clientInfo?.theme?te({theme:i.clientInfo.theme}):null,i.runId?`run ${i.runId.slice(0,12)}…`:null].filter(Boolean).join(` · `)||`—`,i.clientInfo?.plugins&&i.clientInfo.plugins.length>0?(0,Z.jsxs)(`span`,{className:`oc-fbadmin__plugins`,children:[f(),` `,i.clientInfo.plugins.join(`, `),(0,Z.jsxs)(`span`,{className:`oc-fbadmin__note`,children:[` `,l()]})]}):null,i.clientInfo?.userAgent?(0,Z.jsx)(`span`,{className:`oc-fbadmin__ua`,children:i.clientInfo.userAgent}):null]})]})]})}function xe(){let e=pe(y.feedback.listForAdmin,{}),t=J(y.feedback.readSnapshot),n=J(y.feedback.deleteFeedback),r=_e(),[a,l]=(0,X.useState)(null),[u,d]=(0,X.useState)({});async function f(e){if(a===e._id){l(null);return}if(!u[e._id]){let n=await t({feedbackId:e._id});d(t=>({...t,[e._id]:n}))}l(e._id)}async function p(e){await r({title:j(),description:le(),confirmLabel:B(),destructive:!0})&&(await n({feedbackId:e._id}),a===e._id&&l(null))}return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`p`,{className:`oc-admin__hint`,children:[_(),` `,(0,Z.jsx)(`strong`,{children:h()}),` `,m()]}),(0,Z.jsx)(ve,{title:L(),rows:e,emptyHint:i(),isExpanded:e=>a===e._id&&!!u[e._id],renderExpanded:e=>u[e._id]?(0,Z.jsx)(be,{data:u[e._id],reference:e.reference,closeReason:e.userCloseReason}):null,columns:[{header:g(),cell:e=>Y(e.at),sort:e=>e.at},{header:s(),cell:e=>Q(e.category),sort:e=>Q(e.category)},{header:c(),cell:e=>e.messageRole===`user`?b():de(),sort:e=>e.messageRole},{header:o(),cell:e=>(e.reporterEmail||e.reporterName||`—`)+(e.impersonated&&e.realOperatorEmail?` ${v({operator:e.realOperatorEmail})}`:``),sort:e=>e.reporterEmail||e.reporterName||null},{header:fe(),cell:e=>(0,Z.jsx)($,{matches:e.displayedMatchesStored,sourceWasOpen:e.sourceWasOpen}),sort:e=>e.displayedMatchesStored===!1?0:e.displayedMatchesStored===!0?1:2},{header:O(),cell:e=>e.hasComment?`✎`:`—`,sort:e=>+!!e.hasComment},{header:me(),cell:e=>e.userClosedAt==null?e.resolvedAt==null?e.answered?(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-ok`,children:ue()}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill`,children:T()}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-ok`,title:e.resolvedBy??void 0,children:K()}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-closed`,children:P()}),sort:e=>e.userClosedAt==null?e.resolvedAt==null?+!!e.answered:2:3}],rowActions:e=>[{label:a===e._id?V():W(),onSelect:()=>void f(e)},{label:N(),onSelect:()=>void p(e),variant:`destructive`}]})]})}export{xe as FeedbacksTab};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{AP as ee,CP as r,DP as te,EP as i,FP as ne,IP as a,LP as o,MP as s,NP as c,OP as re,PP as l,SP as u,T as d,TP as f,_P as ie,aP as ae,bP as p,cP as oe,ca as se,dP as ce,fF as le,fP as ue,gP as de,hP as fe,iP as m,jP as h,kP as g,lP as pe,la as _,mP as me,nP as he,oP as ge,pP as _e,rP as ve,sP as ye,uF as be,uO as xe,uP as v,vF as y,vP as b,wP as x,xP as S,yF as C,yP as w}from"./dist-B1qnlN7I.js";import{t as T}from"./button-BCAsV4-2.js";import{$ as E,B as D,C as O,Ft as k,H as A,L as j,Q as M,R as Se,S as N,T as P,U as Ce,V as we,W as F,Xt as I,Yt as Te,Z as Ee,m as De,nt as Oe,rt as L,w as R,wt as ke,x as z,z as Ae,zt as je}from"./index-rCasMjHB.js";import{a as Me,i as B,n as Ne,o as V,r as H,t as Pe}from"./table-DckOsZQY.js";var U=t(e(),1),W=n(),G=`all`;function K(e){switch(e){case`image`:return i();case`audio`:return f();case`video`:return x();case`pdf`:return r();case`document`:return u();case`archive`:return S();default:return p()}}function q(){let[e,t]=(0,U.useState)(G),[n,r]=(0,U.useState)(G),[i,u]=(0,U.useState)(G),[f,p]=(0,U.useState)(G),[x,S]=(0,U.useState)(!1),[q,J]=(0,U.useState)(null),Fe=y(d.files.softDelete),Y=ke();function Ie(){t(G),r(G),u(G),p(G)}async function Le(){let e=q;if(J(null),e)try{await Fe({fileId:e.id}),Y.success(pe())}catch(e){Y.error(oe(),e)}}let X=C(d.files.listMine,{direction:e===G?void 0:e,chatId:n===G?void 0:n,instanceName:i===G?void 0:i,category:f===G?void 0:f,includeAutoGenerated:x||void 0}),Re=(0,U.useMemo)(()=>new Intl.DateTimeFormat(le(),{dateStyle:`medium`,timeStyle:`short`}),[]);if(X===void 0)return(0,W.jsx)(`p`,{className:`oc-admin__hint`,children:be()});let{files:Z,facets:Q,truncated:ze,cap:Be}=X,$=e!==G||n!==G||i!==G||f!==G;return(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`p`,{className:`oc-admin__hint`,children:o()}),(0,W.jsxs)(`div`,{className:`oc-files__filters`,style:{display:`flex`,flexWrap:`wrap`,gap:8,margin:`12px 0`},children:[(0,W.jsxs)(z,{value:e,onValueChange:t,children:[(0,W.jsx)(R,{size:`sm`,"aria-label":a(),children:(0,W.jsx)(P,{})}),(0,W.jsxs)(N,{children:[(0,W.jsx)(O,{value:G,children:ne()}),(0,W.jsx)(O,{value:`inbound`,children:l()}),(0,W.jsx)(O,{value:`outbound`,children:c()})]})]}),(0,W.jsxs)(z,{value:n,onValueChange:r,children:[(0,W.jsx)(R,{size:`sm`,"aria-label":s(),children:(0,W.jsx)(P,{})}),(0,W.jsxs)(N,{children:[(0,W.jsx)(O,{value:G,children:h()}),Q.chats.map(e=>(0,W.jsx)(O,{value:e.id,children:e.title},e.id))]})]}),Q.multiProvider?(0,W.jsxs)(z,{value:i,onValueChange:u,children:[(0,W.jsx)(R,{size:`sm`,"aria-label":ee(),children:(0,W.jsx)(P,{})}),(0,W.jsxs)(N,{children:[(0,W.jsx)(O,{value:G,children:g()}),Q.instances.map(e=>(0,W.jsx)(O,{value:e,children:e},e))]})]}):null,(0,W.jsxs)(z,{value:f,onValueChange:p,children:[(0,W.jsx)(R,{size:`sm`,"aria-label":re(),children:(0,W.jsx)(P,{})}),(0,W.jsxs)(N,{children:[(0,W.jsx)(O,{value:G,children:te()}),Q.categories.map(e=>(0,W.jsx)(O,{value:e,children:K(e)},e))]})]}),(0,W.jsxs)(`label`,{className:`oc-files__autogen`,children:[(0,W.jsx)(De,{checked:x,onCheckedChange:e=>S(e===!0),"aria-label":_()}),(0,W.jsx)(`span`,{children:_()})]}),$?(0,W.jsxs)(T,{variant:`ghost`,size:`sm`,onClick:Ie,style:{display:`inline-flex`,alignItems:`center`,gap:4,marginLeft:`auto`},children:[(0,W.jsx)(je,{size:14,"aria-hidden":!0}),ue()]}):null]}),Z.length===0?(0,W.jsx)(`p`,{className:`oc-admin__hint`,children:$?ve():m()}):(0,W.jsxs)(W.Fragment,{children:[(0,W.jsxs)(Pe,{children:[(0,W.jsx)(Me,{children:(0,W.jsxs)(V,{children:[(0,W.jsx)(B,{children:w()}),(0,W.jsx)(B,{children:b()}),(0,W.jsx)(B,{children:ie()}),(0,W.jsx)(B,{children:de()}),(0,W.jsx)(B,{children:fe()}),(0,W.jsx)(B,{className:`text-right`,children:me()})]})}),(0,W.jsx)(Ne,{children:Z.map(e=>(0,W.jsxs)(V,{children:[(0,W.jsxs)(H,{className:`font-medium`,style:{maxWidth:280,overflow:`hidden`,textOverflow:`ellipsis`},title:e.filename,children:[e.filename,e.origin===`pasted`?(0,W.jsx)(L,{variant:`outline`,style:{marginLeft:6},children:se()}):null]}),(0,W.jsx)(H,{title:e.mimeType,children:K(e.category)}),(0,W.jsx)(H,{children:(0,W.jsx)(L,{variant:`secondary`,children:e.direction===`inbound`?l():c()})}),(0,W.jsx)(H,{style:{maxWidth:220,overflow:`hidden`,textOverflow:`ellipsis`},title:e.chatTitle,children:e.chatTitle}),(0,W.jsx)(H,{className:`whitespace-nowrap text-muted-foreground`,children:Re.format(e.createdAt)}),(0,W.jsx)(H,{className:`text-right`,children:(0,W.jsxs)(Ee,{children:[(0,W.jsx)(Oe,{asChild:!0,children:(0,W.jsx)(T,{variant:`ghost`,size:`icon`,"aria-label":ce(),children:(0,W.jsx)(Te,{size:16})})}),(0,W.jsxs)(M,{align:`end`,children:[e.url?(0,W.jsx)(E,{asChild:!0,children:(0,W.jsxs)(`a`,{href:e.url,download:e.filename,target:`_blank`,rel:`noopener noreferrer`,children:[(0,W.jsx)(I,{size:14}),_e()]})}):(0,W.jsxs)(E,{disabled:!0,children:[(0,W.jsx)(I,{size:14}),ae()]}),(0,W.jsxs)(E,{variant:`destructive`,onSelect:()=>J({id:e._id,filename:e.filename}),children:[(0,W.jsx)(k,{size:14}),v()]})]})]})})]},e._id))})]}),ze?(0,W.jsx)(`p`,{className:`oc-admin__hint`,style:{marginTop:8},children:he({cap:Be})}):null]}),(0,W.jsx)(j,{open:q!==null,onOpenChange:e=>!e&&J(null),children:(0,W.jsxs)(D,{children:[(0,W.jsxs)(Ce,{children:[(0,W.jsx)(F,{children:ye()}),(0,W.jsx)(we,{children:ge()})]}),(0,W.jsxs)(A,{children:[(0,W.jsx)(Ae,{children:xe()}),(0,W.jsx)(Se,{onClick:()=>void Le(),children:v()})]})]})})]})}export{q as FilesTab};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$d as r,$u as i,Ad as a,Bd as o,Cd as s,D as c,Dd as l,Ed as u,Fd as d,Gd as f,Hd as p,Id as m,Jd as h,Ju as g,Kd as _,Ld as v,Md as y,Nd as b,Od as x,Pd as S,Qd as C,Qu as w,Rd as ee,Sd as T,T as E,Td as D,Ud as O,Vd as k,Wd as te,Xd as A,Xu as j,Yd as ne,Yu as re,Zd as M,Zu as N,_d as P,ad as F,bd as ie,cd as I,dd as ae,ed as oe,ef as L,fd as se,gd as ce,hd as le,id as ue,jd as de,kd as fe,ld as pe,md as me,nd as he,nf as ge,od as _e,pd as ve,qd as ye,qu as be,rd as xe,sd as Se,td as Ce,tf as we,ud as Te,vF as R,vd as z,wd as Ee,xd as De,yF as B,yd as Oe,zd as ke}from"./dist-B1qnlN7I.js";import{t as Ae}from"./x-8-3cz0V6.js";import{i as V,n as H,r as je,t as Me}from"./tabs-DKk4J439.js";import{t as U}from"./button-BCAsV4-2.js";import{C as Ne,F as Pe,It as W,Lt as G,S as Fe,T as Ie,at as Le,d as Re,en as ze,gt as Be,it as K,lt as Ve,m as q,ot as He,rt as J,st as Ue,tn as We,ut as Ge,w as Ke,wt as Y,x as qe}from"./index-rCasMjHB.js";import{t as Je}from"./FilterBar-UyunwEZF.js";import{t as Ye}from"./DataTableShell-D-RklOZj.js";import{t as X}from"./DetailChips-DdVat1KM.js";var Xe=c(`palette`,[[`path`,{d:`M12 22a1 1 0 0 1 0-20 10 9 0 0 1 10 9 5 5 0 0 1-5 5h-2.25a1.75 1.75 0 0 0-1.4 2.8l.3.4a1.75 1.75 0 0 1-1.4 2.8z`,key:`e79jfc`}],[`circle`,{cx:`13.5`,cy:`6.5`,r:`.5`,fill:`currentColor`,key:`1okk4w`}],[`circle`,{cx:`17.5`,cy:`10.5`,r:`.5`,fill:`currentColor`,key:`f64h9f`}],[`circle`,{cx:`6.5`,cy:`12.5`,r:`.5`,fill:`currentColor`,key:`qy21gx`}],[`circle`,{cx:`8.5`,cy:`7.5`,r:`.5`,fill:`currentColor`,key:`fotxhn`}]]),Z=c(`shield-check`,[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`,key:`oel41y`}],[`path`,{d:`m9 12 2 2 4-4`,key:`dzmm74`}]]),Ze=c(`users`,[[`path`,{d:`M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2`,key:`1yyitq`}],[`path`,{d:`M16 3.128a4 4 0 0 1 0 7.744`,key:`16gr8j`}],[`path`,{d:`M22 21v-2a4 4 0 0 0-3-3.87`,key:`kshegd`}],[`circle`,{cx:`9`,cy:`7`,r:`4`,key:`nufk8`}]]),Q=t(e(),1);function Qe(e,t,n){let r=t.trim().toLowerCase();return[...r?e.filter(e=>[e.email,e.name,e.canonical].some(e=>e!=null&&e.toLowerCase().includes(r))):e.slice()].sort((e,t)=>!n.has(e.userId)-+!n.has(t.userId))}function $e(e,t){let n=e.filter(e=>e.source===`discovered`),r=t.trim().toLowerCase();return r?n.filter(e=>(e.displayName??e.agentId).toLowerCase().includes(r)||e.agentId.toLowerCase().includes(r)):n}function et(e){let t=e.name?.trim()??``,n=e.email?.trim()??``,r=e.canonical?.trim()||`u-${e.userId.slice(0,8)}`;return t?{primary:t,secondary:n||`@${r}`}:n?{primary:n,secondary:null}:{primary:`@${r}`,secondary:null}}function tt(e){switch(e){case`admin`:return s();case`user`:return T();case`pending`:return De();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(E.groups.listGroups,{}),t=B(E.me.getMe,{host:Be})?.role===`admin`,n=R(E.groups.createGroup),i=R(E.groups.updateGroup),a=R(E.groups.deleteGroup),s=Pe(),c=Y(),[l,u]=(0,Q.useState)(!1),[g,y]=(0,Q.useState)(null),[b,x]=(0,Q.useState)(it),[S,w]=(0,Q.useState)(null),[T,D]=(0,Q.useState)(``),N=(0,Q.useMemo)(()=>{if(!e)return e;let t=T.trim().toLowerCase();return t?e.filter(e=>e.name.toLowerCase().includes(t)||(e.description??``).toLowerCase().includes(t)||e.members.some(e=>e.label.toLowerCase().includes(t))||e.agents.some(e=>e.toLowerCase().includes(t))||e.charts.some(e=>e.name.toLowerCase().includes(t))):e},[e,T]);function P(){y(null),x(it),u(!0)}function F(e){y(e),x({name:e.name,description:e.description??``}),u(!0)}async function ie(){try{g?await i({groupId:g._id,name:b.name,description:b.description}):await n({name:b.name,description:b.description||void 0}),x(it),y(null),u(!1)}catch(e){c.error(j(),e)}}async function I(e){if(await s({title:v({name:e.name}),description:m(),confirmWord:e.name,confirmLabel:d(),cancelLabel:O(),destructive:!0}))try{await a({groupId:e._id})}catch(e){c.error(re(),e)}}return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`p`,{className:`oc-admin__hint`,children:we()}),(0,$.jsx)(Je,{q:T,onQChange:D,onReset:()=>D(``),canReset:T!==``,searchPlaceholder:h()}),(0,$.jsx)(Ye,{title:ge(),rows:N,addLabel:L(),onAdd:t?P:void 0,emptyHint:r(),columns:[{header:C(),cell:e=>e.name,sort:e=>e.name},{header:M(),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:A(),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:ne(),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:ye(),onSelect:()=>w({groupId:e._id,name:e.name})},...t?[{label:_(),onSelect:()=>F(e)},{label:f(),variant:`destructive`,onSelect:()=>void I(e)}]:[]]}),(0,$.jsx)(Re,{open:l,onOpenChange:u,title:g?k():p(),description:o(),canSubmit:!!b.name.trim(),onSubmit:ie,submitLabel:te(),children:(0,$.jsxs)(`div`,{className:`oc-form`,children:[(0,$.jsxs)(`label`,{className:`oc-field`,children:[(0,$.jsx)(`span`,{className:`oc-field__label`,children:ke()}),(0,$.jsx)(K,{value:b.name,onChange:e=>x({...b,name:e.target.value})})]}),(0,$.jsxs)(`label`,{className:`oc-field`,children:[(0,$.jsx)(`span`,{className:`oc-field__label`,children:ee()}),(0,$.jsx)(K,{value:b.description,onChange:e=>x({...b,description:e.target.value})})]})]})}),(0,$.jsx)(ct,{groupId:S?.groupId??null,groupName:S?.name??``,open:S!==null,onOpenChange:e=>{e||w(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)(We,{size:14,"aria-hidden":!0}),u()]}),(0,$.jsxs)(`span`,{className:`oc-access__pageinfo`,"aria-label":Ee({page:e,pages:t}),children:[e,` / `,t]}),(0,$.jsxs)(U,{type:`button`,variant:`ghost`,size:`sm`,disabled:e>=t,onClick:()=>n(e+1),children:[D(),(0,$.jsx)(ze,{size:14,"aria-hidden":!0})]})]})}function ct({groupId:e,groupName:t,open:n,onOpenChange:r}){let o=B(E.groups.getGroup,n&&e?{groupId:e}:`skip`),s=B(E.groups.listAssignableInstances,n?{}:`skip`),c=B(E.groups.listAssignableUsers,n?{}:`skip`),u=R(E.groups.addMember),d=R(E.groups.removeMember),f=R(E.groups.bulkSetMembers),p=R(E.groups.setGroupManager),m=Y(),[h,_]=(0,Q.useState)(``),[v,C]=(0,Q.useState)(``),[ee,T]=(0,Q.useState)(`members`),[D,O]=(0,Q.useState)(1),[k,te]=(0,Q.useState)(new Set),A=(0,Q.useRef)(null),j=(0,Q.useMemo)(()=>new Set((o?.members??[]).map(e=>e.userId)),[o]),ne=(0,Q.useMemo)(()=>new Set((o?.members??[]).filter(e=>e.manager).map(e=>e.userId)),[o]),re=o?.viewerIsAdmin===!0,M=(0,Q.useMemo)(()=>new Set((o?.agents??[]).map(e=>`${e.instanceName}/${e.agentId}`)),[o]);(0,Q.useEffect)(()=>{_(``),C(``),T(`members`),O(1),A.current=null},[n,e]),(0,Q.useEffect)(()=>{O(1)},[h]),(0,Q.useEffect)(()=>{n&&o&&e&&A.current!==e&&(A.current=e,te(new Set((o.members??[]).map(e=>e.userId))))},[n,o,e]);let N=(0,Q.useMemo)(()=>c?Qe(c,h,k):[],[c,h,k]);async function P(t,n){if(e)try{n?await d({groupId:e,userId:t}):await u({groupId:e,userId:t})}catch(e){m.error(g(),e)}}async function F(t,n){if(e)try{await p({groupId:e,userId:t,manager:!n})}catch(e){m.error(w(),e)}}let I=nt(N,e=>j.has(e.userId)),ae=N.filter(e=>j.has(e.userId)).length,L=rt(N,D,ot);async function se(){if(!e||N.length===0)return;let t=N.map(e=>e.userId);try{await f({groupId:e,userIds:t,member:I!==`all`})}catch(e){m.error(g(),e)}}return(0,$.jsx)(Le,{open:n,onOpenChange:r,children:(0,$.jsxs)(He,{className:`oc-access`,children:[(0,$.jsxs)(Ve,{children:[(0,$.jsx)(Ge,{children:S({name:t})}),(0,$.jsx)(Ue,{children:b()})]}),(0,$.jsxs)(Me,{value:ee,onValueChange:T,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}),y(),o?(0,$.jsx)(J,{variant:`secondary`,className:`oc-access__tabcount`,children:j.size}):null]}),(0,$.jsxs)(V,{value:`agents`,className:`flex-1 gap-1.5`,children:[(0,$.jsx)(G,{size:13,"aria-hidden":!0}),a(),o?(0,$.jsx)(J,{variant:`secondary`,className:`oc-access__tabcount`,children:M.size}):null]}),(0,$.jsxs)(V,{value:`charts`,className:`flex-1 gap-1.5`,children:[(0,$.jsx)(Xe,{size:13,"aria-hidden":!0}),pe(),o?(0,$.jsx)(J,{variant:`secondary`,className:`oc-access__tabcount`,children:o.chartCount}):null]})]}),(0,$.jsx)(H,{value:`members`,children:c===void 0||o===void 0?(0,$.jsx)(`p`,{className:`oc-access__hint`,children:z()}):c.length===0?(0,$.jsx)(`p`,{className:`oc-access__hint`,children:ce()}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(K,{value:h,onChange:e=>_(e.target.value),placeholder:de(),className:`oc-access__search`}),N.length===0?(0,$.jsx)(`p`,{className:`oc-access__hint`,children:x()}):(0,$.jsxs)($.Fragment,{children:[N.length>1?(0,$.jsxs)(`div`,{className:`oc-access__row oc-access__selectall`,children:[(0,$.jsx)(q,{checked:I===`all`?!0:I===`some`?`indeterminate`:!1,onCheckedChange:()=>void se(),"aria-label":l()}),(0,$.jsx)(`span`,{className:`oc-access__label`,children:l()}),(0,$.jsxs)(J,{variant:`outline`,className:`oc-access__count`,children:[ae,` / `,N.length]})]}):null,(0,$.jsx)(`div`,{className:`oc-access__list`,children:L.pageItems.map(e=>{let t=j.has(e.userId),n=et(e),r=ne.has(e.userId);return(0,$.jsxs)(`div`,{className:`oc-access__row`,children:[(0,$.jsx)(q,{checked:t,onCheckedChange:()=>void P(e.userId,t),"aria-label":ie({user:n.primary})}),(0,$.jsxs)(`span`,{className:`oc-access__who`,children:[(0,$.jsx)(`span`,{className:`oc-access__label`,title:n.primary,children:n.primary}),n.secondary?(0,$.jsx)(`span`,{className:`oc-access__sub`,title:n.secondary,children:n.secondary}):null]}),(0,$.jsx)(J,{variant:`outline`,className:`oc-access__role`,children:tt(e.role)}),(0,$.jsx)(`span`,{className:`oc-access__mgrslot`,children:t&&re?(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?i():oe(),title:r?i():oe(),onClick:()=>void F(e.userId,r),children:(0,$.jsx)(Z,{size:15,"aria-hidden":!0})}):t&&r?(0,$.jsx)(`span`,{className:`oc-access__mgr oc-access__mgr--on`,role:`img`,"aria-label":Ce(),title:Ce(),children:(0,$.jsx)(Z,{size:15,"aria-hidden":!0})}):null})]},e._id)})}),(0,$.jsx)(st,{page:L.page,pageCount:L.pageCount,onPage:O})]})]})}),(0,$.jsx)(H,{value:`agents`,children:s===void 0?(0,$.jsx)(`p`,{className:`oc-access__hint`,children:z()}):s.length===0?(0,$.jsx)(`p`,{className:`oc-access__hint`,children:le()}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(K,{value:v,onChange:e=>C(e.target.value),placeholder:fe(),className:`oc-access__search`}),(0,$.jsx)(`div`,{className:`oc-access__list`,children:s.map(t=>(0,$.jsx)(lt,{groupId:e,instanceName:t.name,kind:t.kind??`openclaw`,assigned:M,query:v},`${e}-${t._id}`))})]})}),(0,$.jsx)(H,{value:`charts`,children:(0,$.jsx)(ut,{groupId:e})})]})]})})}function lt({groupId:e,instanceName:t,kind:n,assigned:r,query:i}){let a=B(E.groups.listAssignableAgents,{instanceName:t}),o=R(E.groups.assignAgentToGroup),s=R(E.groups.removeAgentFromGroup),c=R(E.groups.bulkSetGroupAgents),u=Y(),[d,f]=(0,Q.useState)(1);if((0,Q.useEffect)(()=>{f(1)},[i]),!e)return null;let p=$e(a?.agents??[],i),m=a?.discovery&&!a.discovery.lastPollOk;if(i.trim()&&p.length===0)return null;let h=p.filter(e=>e.presentInLastOk!==!1&&e.enabled!==!1),g=nt(h,e=>r.has(`${t}/${e.agentId}`)),_=rt(p,d,ot);async function v(n,r){try{r?await s({groupId:e,instanceName:t,agentId:n}):await o({groupId:e,instanceName:t,agentId:n})}catch(e){u.error(be(),e)}}async function y(){if(h.length===0)return;let n=h.map(e=>e.agentId);try{await c({groupId:e,instanceName:t,agentIds:n,assigned:g!==`all`})}catch(e){u.error(be(),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)(J,{variant:`outline`,className:`oc-access__kind`,children:n}),m?(0,$.jsx)(J,{variant:`outline`,className:`oc-access__stale`,children:se()}):null]}),a===void 0?(0,$.jsx)(`p`,{className:`oc-access__hint`,children:P()}):p.length===0?(0,$.jsx)(`p`,{className:`oc-access__hint`,children:m?ve():me()}):(0,$.jsxs)($.Fragment,{children:[h.length>1?(0,$.jsxs)(`div`,{className:`oc-access__row oc-access__selectall`,children:[(0,$.jsx)(q,{checked:g===`all`?!0:g===`some`?`indeterminate`:!1,onCheckedChange:()=>void y(),"aria-label":l()}),(0,$.jsx)(`span`,{className:`oc-access__label`,children:l()})]}):null,_.pageItems.map(e=>{let n=`${t}/${e.agentId}`,i=r.has(n),a=e.presentInLastOk===!1,o=!e.enabled;return(0,$.jsxs)(`div`,{className:`oc-access__row${o?` is-disabled`:``}`,children:[(0,$.jsx)(q,{checked:i,disabled:(a||o)&&!i,onCheckedChange:()=>void v(e.agentId,i),"aria-label":Oe({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":Te(),title:Te(),children:(0,$.jsx)(W,{size:14,fill:`currentColor`})}):null,a?(0,$.jsx)(J,{variant:`outline`,className:`oc-access__gone`,children:ae()}):null]},e.agentId)}),(0,$.jsx)(st,{page:_.page,pageCount:_.pageCount,onPage:f})]})]})}function ut({groupId:e}){let t=B(E.charts.listGroupChartSelection,e?{groupId:e}:`skip`),n=R(E.charts.assignChartToGroup),r=R(E.charts.removeChartFromGroup),i=R(E.charts.setGroupDefaultChart),a=R(E.charts.addChartToGroupPool),o=R(E.charts.removeChartFromGroupPool),s=Y();if(!e)return null;if(t===void 0)return(0,$.jsx)(`p`,{className:`oc-access__hint`,children:z()});let{pool:c,addable:l,canManagePool:u}=t;if(c.length===0&&!u)return(0,$.jsx)(`p`,{className:`oc-access__hint`,children:I()});async function d(t,i){try{i?await r({groupId:e,chartKey:t}):await n({groupId:e,chartKey:t})}catch(e){s.error(N(),e)}}async function f(t){try{await i({groupId:e,chartKey:t})}catch(e){s.error(N(),e)}}async function p(t){try{await a({groupId:e,chartKey:t})}catch(e){s.error(N(),e)}}async function m(t){try{await o({groupId:e,chartKey:t})}catch(e){s.error(N(),e)}}return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`div`,{className:`oc-access__list`,children:c.map(e=>(0,$.jsxs)(`div`,{className:`oc-access__row`,children:[(0,$.jsx)(q,{checked:e.selected,onCheckedChange:()=>void d(e.chartKey,e.selected),"aria-label":ue({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":xe(),title:xe(),children:(0,$.jsx)(W,{size:14,fill:`currentColor`})}):(0,$.jsx)(U,{type:`button`,variant:`ghost`,size:`sm`,onClick:()=>void f(e.chartKey),children:he()}):null,u?(0,$.jsx)(U,{type:`button`,variant:`ghost`,size:`sm`,"aria-label":F({name:e.name}),title:F({name:e.name}),onClick:()=>void m(e.chartKey),children:(0,$.jsx)(Ae,{size:14,"aria-hidden":!0})}):null]},e.chartKey))}),u?l.length>0?(0,$.jsxs)(qe,{value:``,onValueChange:e=>void p(e),children:[(0,$.jsx)(Ke,{size:`sm`,className:`oc-access__search`,children:(0,$.jsx)(Ie,{placeholder:_e()})}),(0,$.jsx)(Fe,{children:l.map(e=>(0,$.jsx)(Ne,{value:e.chartKey,children:e.name},e.chartKey))})]}):c.length===0?(0,$.jsx)(`p`,{className:`oc-access__hint`,children:Se()}):null:null]})}export{at as GroupsTab};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$S as r,$x as i,AC as a,AS as o,BS as s,CC as c,CS as l,DC as u,DS as d,EC as f,ES as p,FC as m,FS as h,GS as g,HS as _,IS as v,JS as y,Jn as b,Jx as x,KS as S,Kx as C,LS as ee,L_ as te,MC as w,MS as T,NC as E,NS as ne,OC as re,OS as ie,PC as ae,PS as oe,QS as D,Qx as se,RS as ce,R_ as le,SC as ue,SS as de,T as O,TC as fe,TS as pe,US as me,VS as he,WS as ge,XS as _e,Xn as ve,Xx as ye,YS as be,Yn as xe,Yx as Se,ZS as Ce,Zx as we,_C as Te,_S as Ee,aC as De,aS as Oe,bC as ke,bS as Ae,cC as je,cS as Me,co as Ne,dC as Pe,dS as Fe,do as Ie,eC as Le,eS as Re,fC as ze,fS as Be,gC as Ve,gF as k,gS as A,hC as He,iC as Ue,iS as We,jC as Ge,jS as Ke,kC as qe,kS as Je,lC as Ye,lS as Xe,lo as Ze,mC as Qe,mS as $e,nC as et,nS as tt,nk as nt,oC as rt,oS as it,pC as at,pS as ot,qS as st,qx as ct,rC as lt,rS as ut,rk as dt,sC as ft,sS as pt,tC as mt,tS as ht,uC as gt,uS as _t,uo as vt,vC as yt,vF as j,vS as bt,wC as xt,wS as St,xC as M,xS as N,yC as Ct,yF as P,yS as F,zS as wt}from"./dist-B1qnlN7I.js";import{a as Tt,c as Et}from"./FieldLabel-HlyBnXo4.js";import{t as I}from"./button-BCAsV4-2.js";import{C as L,F as Dt,G as Ot,K as kt,S as R,T as z,at as B,d as At,it as V,lt as H,m as U,ot as W,q as jt,rt as G,st as Mt,ut as Nt,w as K,wt as q,x as J}from"./index-rCasMjHB.js";import{t as Pt}from"./DataTableShell-D-RklOZj.js";import{InstanceConfigDialog as Ft}from"./BridgeTab-Bno_F96W.js";var Y=t(e(),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=P(O.admin.listInstances,{}),t=P(O.agents.listAllInstanceAgents,{}),n=j(O.admin.upsertInstance),r=j(O.admin.deleteInstance),i=q(),[o,s]=(0,Y.useState)(!1),[l,d]=(0,Y.useState)(Q),[p,h]=(0,Y.useState)(null),[g,_]=(0,Y.useState)(null),[v,y]=(0,Y.useState)(null),[x,S]=(0,Y.useState)(null);async function C(){try{await n({instanceId:x??void 0,name:l.name,gatewayUrl:l.gatewayUrl,bridgeUrl:l.bridgeUrl||void 0,displayName:l.displayName||void 0,kind:l.kind,transport:l.kind===`hermes`?l.transport:void 0,gatewayVersion:l.gatewayVersion||void 0,gatewayHttpUrl:l.gatewayHttpUrl||void 0,streamTransport:l.streamTransport}),d(Q),S(null),s(!1)}catch(e){i.error(E(),e)}}return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`p`,{className:`oc-admin__hint`,children:[w(),(0,Z.jsx)(`strong`,{children:Ge()}),a()]}),(0,Z.jsx)(Pt,{title:qe(),rows:e,addLabel:re(),onAdd:()=>{S(null),d(Q),s(!0)},emptyHint:u(),columns:[{header:f(),cell:e=>e.name,sort:e=>e.name},{header:fe(),cell:e=>(0,Z.jsx)(G,{variant:`outline`,children:e.kind??`openclaw`}),sort:e=>e.kind??`openclaw`},{header:xt(),cell:e=>e.gatewayUrl,sort:e=>e.gatewayUrl},{header:c(),cell:e=>e.displayName??`—`,sort:e=>e.displayName??null},{header:m(),cell:e=>{let n=(t?.[e.name]??[]).filter(e=>e.presentInLastOk!==!1&&e.enabled);if(n.length===0)return(0,Z.jsx)(`span`,{className:`text-muted-foreground`,children:`—`});let r=t=>e.defaultAgentId===t;return(0,Z.jsx)(`div`,{className:`flex flex-wrap gap-1`,children:[...n].sort((e,t)=>Number(r(t.agentId))-Number(r(e.agentId))).map(e=>(0,Z.jsxs)(G,{variant:r(e.agentId)?`default`:`outline`,title:r(e.agentId)?ct():void 0,children:[e.emoji?`${e.emoji} `:``,e.displayName??e.agentId]},e.agentId))})}}],rowActions:e=>[{label:Ct(),onSelect:()=>{S(e._id),d(Bt(e)),s(!0)}},{label:ae(),onSelect:()=>h(e.name)},{label:Ue(),onSelect:()=>y(e)},{label:ue(),onSelect:()=>_(e)},{label:M(),variant:`destructive`,onSelect:()=>void r({instanceId:e._id})}],bulkActions:[{label:M(),variant:`destructive`,onSelect:e=>e.forEach(e=>void r({instanceId:e}))}]}),(0,Z.jsx)(At,{open:o,onOpenChange:s,title:x?yt():ke(),description:Ve(),canSubmit:!!(l.name&&l.gatewayUrl),onSubmit:C,submitLabel:He(),children:(0,Z.jsxs)(`div`,{className:`oc-form`,children:[(0,Z.jsxs)($,{label:Qe(),children:[(0,Z.jsx)(V,{value:l.name,disabled:x!==null,onChange:e=>d({...l,name:e.target.value})}),x?(0,Z.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:Te()}):null]}),(0,Z.jsx)($,{label:at(),children:(0,Z.jsxs)(J,{value:l.kind,onValueChange:e=>d({...l,kind:e}),children:[(0,Z.jsx)(K,{size:`sm`,className:`w-40`,children:(0,Z.jsx)(z,{})}),(0,Z.jsxs)(R,{children:[(0,Z.jsx)(L,{value:`openclaw`,children:`OpenClaw`}),(0,Z.jsx)(L,{value:`hermes`,children:`Hermes`})]})]})}),l.kind===`hermes`?(0,Z.jsx)($,{label:ve(),children:(0,Z.jsxs)(J,{value:l.transport,onValueChange:e=>d({...l,transport:e}),children:[(0,Z.jsx)(K,{size:`sm`,className:`w-56`,children:(0,Z.jsx)(z,{})}),(0,Z.jsxs)(R,{children:[(0,Z.jsx)(L,{value:`ws`,children:xe()}),(0,Z.jsx)(L,{value:`rest`,children:b()})]})]})}):null,(0,Z.jsx)($,{label:ze(),children:(0,Z.jsx)(V,{value:l.gatewayUrl,onChange:e=>d({...l,gatewayUrl:e.target.value})})}),(0,Z.jsx)($,{label:Pe(),children:(0,Z.jsx)(V,{value:l.bridgeUrl,placeholder:gt(),onChange:e=>d({...l,bridgeUrl:e.target.value})})}),(0,Z.jsx)($,{label:Ye(),children:(0,Z.jsx)(V,{value:l.displayName,onChange:e=>d({...l,displayName:e.target.value})})}),(0,Z.jsxs)($,{label:le(),children:[(0,Z.jsxs)(J,{value:l.streamTransport,onValueChange:e=>d({...l,streamTransport:e}),children:[(0,Z.jsx)(K,{size:`sm`,className:`w-40`,children:(0,Z.jsx)(z,{})}),(0,Z.jsx)(R,{children:Et.map(e=>(0,Z.jsx)(L,{value:e,children:e},e))})]}),(0,Z.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:te()})]}),(0,Z.jsx)($,{label:je(),children:(0,Z.jsx)(V,{value:l.gatewayVersion,placeholder:ft(),onChange:e=>d({...l,gatewayVersion:e.target.value})})}),(0,Z.jsx)($,{label:rt(),children:(0,Z.jsx)(V,{value:l.gatewayHttpUrl,placeholder:De(),onChange:e=>d({...l,gatewayHttpUrl:e.target.value})})})]})}),(0,Z.jsx)(Zt,{instanceName:p,open:p!==null,onOpenChange:e=>{e||h(null)}}),g?(0,Z.jsx)(Ft,{instance:g,onClose:()=>_(null)},g._id):null,v?(0,Z.jsx)(Ht,{instance:v,onClose:()=>y(null)},v._id):null]})}function Ht({instance:e,onClose:t}){let n=P(O.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)(B,{open:!0,onOpenChange:e=>!e&&t(),children:(0,Z.jsxs)(W,{onOpenAutoFocus:e=>e.preventDefault(),children:[(0,Z.jsxs)(H,{children:[(0,Z.jsx)(Nt,{children:lt({instance:e.displayName??e.name})}),(0,Z.jsx)(Mt,{children:et()})]}),(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=k(O.instanceSync.forceInstanceSync),n=q(),[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(v());break;case`no_agents`:n.success(oe());break;case`no_bridge_url`:n.error(ne());break;case`deploy_misconfigured`:n.error(T());break;case`unauthorized`:n.error(o());break;case`not_served`:n.error(Je());break;default:n.error(Ke());break}}catch(e){n.error(h(),e)}finally{i(!1)}}}return(0,Z.jsxs)(`div`,{className:`oc-form`,children:[(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:ie()}),(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?ee():ce()})})]})}function Wt({instance:e}){let t=P(O.bridgeAuth.listBridgeAuthStatus,{}),n=k(O.bridgeAuth.mintBridgeSecret),r=j(O.bridgeAuth.revokeBridgeSecret),i=q(),[a,o]=(0,Y.useState)(!1),[s,c]=(0,Y.useState)(null),[u,f]=(0,Y.useState)(!1),m=(t??[]).find(t=>t.instanceId===e._id),h=m!==void 0;async function g(){if(!a){o(!0);try{c((await n({instanceId:e._id})).plaintext),f(!1)}catch(e){i.error(N(),e)}finally{o(!1)}}}async function _(){if(!a){o(!0);try{await r({instanceId:e._id}),c(null),i.success(de())}catch(e){i.error(N(),e)}finally{o(!1)}}}async function v(){if(s)try{await navigator.clipboard.writeText(s),f(!0)}catch{}}return(0,Z.jsxs)($,{label:d(),children:[(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:p()}),(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Z.jsx)(G,{variant:h?`outline`:`secondary`,children:h?`${D()} · ${m.prefix}…${m.lastFour}`:Ce()}),(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(I,{size:`sm`,onClick:()=>void g(),disabled:a,children:h?St():pe()}),h?(0,Z.jsx)(I,{size:`sm`,variant:`destructive`,onClick:()=>void _(),disabled:a,children:l()}):null]})]}),s?(0,Z.jsxs)(`div`,{className:`oc-bridgesecret__reveal`,children:[(0,Z.jsx)(`p`,{className:`oc-sa__minted-warning`,children:Ae()}),(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 v(),children:u?dt():nt()})]}),(0,Z.jsx)(I,{size:`sm`,variant:`ghost`,onClick:()=>{c(null),f(!1)},children:F()})]}):null]})}function Gt({instanceId:e,field:t,updatedAt:n}){let i=k(O.instanceSecrets.setInstanceSecret),a=j(O.instanceSecrets.clearInstanceSecret),o=k(O.deviceIdentity.generateDeviceIdentity),c=q(),[l,u]=(0,Y.useState)(``),[d,f]=(0,Y.useState)(!1),[p,m]=(0,Y.useState)(null),[h,v]=(0,Y.useState)(!1),b=n!==null,x=t===`deviceIdentity`,C=t===`token`?mt():t===`deviceIdentity`?Le():r();async function ee(){if(!(!l.trim()||d)){f(!0);try{await i({instanceId:e,field:t,plaintext:l}),u(``),m(null),v(!1),c.success(S())}catch(e){c.error(g(),e)}finally{f(!1)}}}async function te(){if(!d){f(!0);try{await a({instanceId:e,field:t}),m(null),v(!1),c.success(ge())}catch(e){c.error(g(),e)}finally{f(!1)}}}async function w(){if(!d){f(!0);try{m(await o({instanceId:e})),v(!1),c.success(he())}catch(e){c.error(wt(),e)}finally{f(!1)}}}let T=p?`openclaw devices approve ${p.id}`:``;async function E(){if(T)try{await navigator.clipboard.writeText(T),v(!0)}catch{}}return(0,Z.jsxs)($,{label:C,children:[x?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:_()}):null,(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Z.jsx)(G,{variant:b?`outline`:`secondary`,children:b?D():Ce()}),(0,Z.jsx)(V,{type:`password`,autoComplete:`off`,className:`flex-1 min-w-32`,value:l,placeholder:b?be():_e(),onChange:e=>u(e.target.value)}),(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(I,{size:`sm`,onClick:()=>void ee(),disabled:d||l.trim().length===0,children:y()}),x?(0,Z.jsx)(I,{size:`sm`,variant:`outline`,onClick:()=>void w(),disabled:d,children:me()}):null,b?(0,Z.jsx)(I,{size:`sm`,variant:`destructive`,onClick:()=>void te(),disabled:d,children:st()}):null]})]}),p?(0,Z.jsxs)(`div`,{className:`oc-bridgesecret__reveal`,children:[(0,Z.jsx)(`p`,{className:`text-sm font-medium`,children:he()}),(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:s()}),(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 E(),children:h?dt():nt()})]}),(0,Z.jsx)(I,{size:`sm`,variant:`ghost`,onClick:()=>{m(null),v(!1)},children:F()})]}):null]})}var Kt={conversational:Me,documentary:it,summarizer:Ie,curator:Ze},qt={conversational:pt,documentary:Oe,summarizer:vt,curator:Ne},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:Be()}),t.map(e=>(0,Z.jsx)(G,{variant:`secondary`,className:`oc-agenttype__chip`,title:Yt(e),children:Jt(e)},e)),(0,Z.jsxs)(Ot,{children:[(0,Z.jsx)(jt,{asChild:!0,children:(0,Z.jsx)(I,{type:`button`,variant:`outline`,size:`sm`,className:`h-7`,children:Fe()})}),(0,Z.jsxs)(kt,{align:`start`,className:`oc-agenttypes-pop`,children:[(0,Z.jsx)(`p`,{className:`oc-agenttypes-pop__title`,children:_t()}),(0,Z.jsx)(`p`,{className:`oc-agenttypes-pop__hint`,children:Xe()}),(0,Z.jsx)(`div`,{className:`oc-agenttypes-pop__list`,children:X.map(r=>{let i=`agtype-${e}-${r}`;return(0,Z.jsxs)(`div`,{className:`oc-agenttypes-pop__item`,children:[(0,Z.jsx)(U,{id:i,checked:t.includes(r),onCheckedChange:()=>n(r)}),(0,Z.jsxs)(`label`,{htmlFor:i,className:`oc-agenttypes-pop__text`,children:[(0,Z.jsx)(`span`,{className:`oc-agenttypes-pop__name`,children:Jt(r)}),(0,Z.jsx)(`span`,{className:`oc-agenttypes-pop__desc`,children:Yt(r)})]})]},r)})})]})]})]})}function Zt({instanceName:e,open:t,onOpenChange:n}){let r=P(O.agents.listAgentsForInstance,t&&e?{instanceName:e}:`skip`),a=j(O.agents.setAgentEnabled).withOptimisticUpdate((e,{instanceName:t,agentId:n,enabled:r})=>{let i=e.getQuery(O.agents.listAgentsForInstance,{instanceName:t});i&&e.setQuery(O.agents.listAgentsForInstance,{instanceName:t},{...i,agents:i.agents.map(e=>e.agentId===n?{...e,enabled:r}:e)})}),o=j(O.agents.setInstanceDefaultAgent).withOptimisticUpdate((e,{instanceName:t,agentId:n})=>{let r=e.getQuery(O.agents.listAgentsForInstance,{instanceName:t});r&&e.setQuery(O.agents.listAgentsForInstance,{instanceName:t},{...r,defaultAgentId:n})}),s=j(O.agents.setAgentTypes).withOptimisticUpdate((e,{instanceName:t,agentId:n,types:r})=>{let i=e.getQuery(O.agents.listAgentsForInstance,{instanceName:t});if(!i)return;let a=Rt(r);e.setQuery(O.agents.listAgentsForInstance,{instanceName:t},{...i,agents:i.agents.map(e=>e.agentId===n?{...e,types:a}:e)})}),c=j(O.agents.setAgentDescription).withOptimisticUpdate((e,{instanceName:t,agentId:n,description:r})=>{let i=e.getQuery(O.agents.listAgentsForInstance,{instanceName:t});if(!i)return;let a=r.trim();e.setQuery(O.agents.listAgentsForInstance,{instanceName:t},{...i,agents:i.agents.map(e=>e.agentId===n?{...e,description:a.length===0?null:a}:e)})}),l=j(O.agents.removeInstanceAgent),u=Dt(),d=q();async function f(t,n){if(e)try{await a({instanceName:e,agentId:t,enabled:n})}catch(e){d.error(A(),e)}}async function p(t){if(e)try{await o({instanceName:e,agentId:t})}catch(e){d.error(A(),e)}}async function m(t,n,r){if(!e)return;let i=r.includes(n)?r.filter(e=>e!==n):[...r,n];try{await s({instanceName:e,agentId:t,types:i})}catch(e){d.error(A(),e)}}async function h(t,n){if(e&&await u({title:tt({name:n}),description:ht(),confirmLabel:Re(),destructive:!0}))try{await l({instanceName:e,agentId:t}),d.success(i())}catch(e){d.error(A(),e)}}return(0,Z.jsx)(B,{open:t,onOpenChange:n,children:(0,Z.jsxs)(W,{className:`oc-access`,children:[(0,Z.jsxs)(H,{children:[(0,Z.jsx)(Nt,{children:bt({name:e??``})}),(0,Z.jsx)(Mt,{children:Ee()})]}),r===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:r.discovery===null?we():r.discovery.lastPollOk?ye():Se({error:r.discovery.error??`?`})}),r.agents.length===0?(0,Z.jsx)(`p`,{className:`oc-access__hint`,children:x()}):(0,Z.jsx)(`div`,{className:`oc-access__list`,children:r.agents.map(t=>{let n=t.presentInLastOk===!1,i=r.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)(U,{checked:t.enabled,disabled:n,"aria-label":a,onCheckedChange:e=>void f(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)(G,{variant:`outline`,className:`oc-access__gone`,children:C()}),(0,Z.jsx)(I,{size:`sm`,variant:`ghost`,className:`h-7 text-destructive`,onClick:()=>void h(t.agentId,a),children:ut()})]}):i?(0,Z.jsx)(G,{variant:`default`,children:ct()}):(0,Z.jsx)(I,{size:`sm`,variant:`outline`,className:`h-7`,disabled:!t.enabled,onClick:()=>void p(t.agentId),children:We()})]}),t.enabled?(0,Z.jsx)(Xt,{agentId:t.agentId,types:o,onToggle:e=>void m(t.agentId,e,o)}):null,t.enabled?(0,Z.jsx)(Qt,{value:t.description??``,onSave:async n=>{if(e)try{await c({instanceName:e,agentId:t.agentId,description:n})}catch(e){d.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)(V,{className:`oc-agentcard__desc`,value:n,maxLength:280,placeholder:$e(),"aria-label":ot(),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{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{As as r,CT as i,Ds as a,Es as o,Ms as s,Os as c,ST as l,T as u,TT as d,Ts as f,_T as p,bT as m,fT as h,gF as g,gT as _,hT as v,js as y,ks as b,mT as x,pT as S,vF as C,vT as w,wT as T,ws as E,xT as D,yF as O,yT as k}from"./dist-B1qnlN7I.js";import{t as A}from"./button-BCAsV4-2.js";import{it as j,m as M,rt as N}from"./index-rCasMjHB.js";var P=t(e(),1),F=n();function I(){let e=O(u.integrations.status.status,{}),t=C(u.admin.setIntegrationConfig),[n,a]=(0,P.useState)(null);if((0,P.useEffect)(()=>{e&&n===null&&a(e.config)},[e,n]),!e||!n)return(0,F.jsx)(`p`,{className:`oc-admin__hint`,children:d()});let o=n,c=(e,t,n)=>a({...o,[e]:{...o[e],[t]:n}}),f=(e,n)=>void t({[e]:n});return(0,F.jsxs)(F.Fragment,{children:[(0,F.jsxs)(`p`,{className:`oc-admin__hint`,children:[T(),` `,(0,F.jsx)(`strong`,{children:i()}),` `,l()]}),(0,F.jsxs)(L,{title:`Langfuse`,status:e.langfuse.configured?e.langfuse.enabled?(0,F.jsx)(N,{variant:`secondary`,children:D()}):(0,F.jsx)(N,{variant:`outline`,children:m()}):(0,F.jsx)(N,{variant:`outline`,children:k()}),note:w(),children:[(0,F.jsx)(R,{label:_(),children:(0,F.jsx)(j,{value:o.langfuse.host??``,placeholder:e.langfuse.effectiveHost,onChange:e=>c(`langfuse`,`host`,e.target.value),onBlur:()=>f(`langfuse`,{host:o.langfuse.host??``})})}),(0,F.jsx)(z,{label:h(),checked:o.langfuse.enabled??!0,onChange:e=>{c(`langfuse`,`enabled`,e),f(`langfuse`,{enabled:e})}})]}),(0,F.jsxs)(L,{title:`Opik`,status:e.opik.configured?e.opik.enabled?(0,F.jsx)(N,{variant:`secondary`,children:D()}):(0,F.jsx)(N,{variant:`outline`,children:m()}):(0,F.jsx)(N,{variant:`outline`,children:k()}),note:p(),children:[(0,F.jsx)(R,{label:v(),children:(0,F.jsx)(j,{value:o.opik.baseUrl??``,placeholder:e.opik.effectiveBaseUrl,onChange:e=>c(`opik`,`baseUrl`,e.target.value),onBlur:()=>f(`opik`,{baseUrl:o.opik.baseUrl??``})})}),(0,F.jsx)(R,{label:x(),children:(0,F.jsx)(j,{value:o.opik.workspace??``,placeholder:e.opik.effectiveWorkspace||S(),onChange:e=>c(`opik`,`workspace`,e.target.value),onBlur:()=>f(`opik`,{workspace:o.opik.workspace??``})})}),(0,F.jsx)(z,{label:h(),checked:o.opik.enabled??!0,onChange:e=>{c(`opik`,`enabled`,e),f(`opik`,{enabled:e})}})]}),(0,F.jsxs)(L,{title:`OpenTelemetry (OTLP)`,status:e.otlp.configured?e.otlp.enabled?(0,F.jsx)(N,{variant:`secondary`,children:D()}):(0,F.jsx)(N,{variant:`outline`,children:m()}):(0,F.jsx)(N,{variant:`outline`,children:s()}),note:y(),children:[(0,F.jsx)(R,{label:r(),children:(0,F.jsx)(j,{value:o.otlp.endpoint??``,placeholder:e.otlp.effectiveEndpoint||`https://otlp.example.com/v1/traces`,onChange:e=>c(`otlp`,`endpoint`,e.target.value),onBlur:()=>f(`otlp`,{endpoint:o.otlp.endpoint??``})})}),(0,F.jsx)(B,{headersSet:e.otlp.headersSet}),(0,F.jsx)(z,{label:h(),checked:o.otlp.enabled??!0,onChange:e=>{c(`otlp`,`enabled`,e),f(`otlp`,{enabled:e})}})]})]})}function L({title:e,status:t,note:n,children:r}){return(0,F.jsxs)(`section`,{className:`oc-int__section`,children:[(0,F.jsxs)(`div`,{className:`oc-int__section-head`,children:[(0,F.jsx)(`h3`,{className:`oc-uipa__h`,children:e}),t]}),n?(0,F.jsx)(`p`,{className:`oc-uipa__note`,children:n}):null,(0,F.jsx)(`div`,{className:`oc-int__fields`,children:r})]})}function R({label:e,children:t}){return(0,F.jsxs)(`label`,{className:`oc-int__field`,children:[(0,F.jsx)(`span`,{className:`oc-int__field-label`,children:e}),t]})}function z({label:e,checked:t,onChange:n}){return(0,F.jsxs)(`label`,{className:`oc-int__toggle`,children:[(0,F.jsx)(M,{checked:t,onCheckedChange:e=>n(e===!0)}),(0,F.jsx)(`span`,{children:e})]})}function B({headersSet:e}){let t=g(u.integrations.otlpSecret.setOtlpHeaders),n=C(u.integrations.otlpSecret.clearOtlpHeaders),[r,i]=(0,P.useState)(``),[s,l]=(0,P.useState)(null),[d,p]=(0,P.useState)(!1),m=async()=>{p(!0),l(null);try{await t({headersJson:r}),i(``)}catch(e){l(e instanceof Error?e.message:String(e))}finally{p(!1)}};return(0,F.jsxs)(R,{label:b(),children:[(0,F.jsx)(j,{value:r,placeholder:e?c():a(),onChange:e=>i(e.target.value)}),(0,F.jsxs)(`div`,{className:`oc-int__otlp-headers-actions`,children:[(0,F.jsx)(A,{size:`sm`,disabled:d||r.trim().length===0,onClick:()=>void m(),children:o()}),e?(0,F.jsx)(A,{variant:`ghost`,size:`sm`,disabled:d,onClick:()=>void n({}),children:f()}):null]}),s?(0,F.jsx)(`p`,{className:`oc-int__otlp-headers-error`,children:s}):null,(0,F.jsx)(`p`,{className:`oc-uipa__note`,children:E()})]})}export{I as IntegrationsTab};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$A as r,$P as i,AA as a,BA as o,BP as s,CA as c,DA as l,E as u,EA as d,Et as f,FA as p,GA as ee,GP as te,HA as ne,HP as re,IA as ie,JA as ae,JP as oe,KA as se,KP as ce,LA as le,MA as ue,Mt as de,NA as fe,OA as m,PA as pe,QA as me,QP as he,RA as ge,SA as h,T as g,TA as _,UA as v,UP as y,VA as b,VP as x,WA as S,WP as C,XA as w,XP as T,YA as E,YP as D,ZA as O,ZP as k,_A as A,_t as j,aF as M,bA as N,dt as P,eF as F,ej as I,ft as L,gA as _e,gt as ve,hA as ye,hC as be,ht as xe,jA as Se,jt as Ce,kA as we,mt as Te,nF as Ee,pt as De,qA as Oe,qP as ke,tF as Ae,uF as je,vA as Me,vF as R,vt as Ne,wA as z,xA as Pe,yA as Fe,yF as B,zA as Ie,zP as Le}from"./dist-B1qnlN7I.js";import{t as V}from"./button-BCAsV4-2.js";import{C as H,S as Re,T as ze,gt as U,ht as Be,it as W,j as Ve,m as G,mt as He,pt as Ue,rt as K,t as We,w as Ge,wt as Ke,x as qe}from"./index-rCasMjHB.js";import{t as Je}from"./localePickerView-C2RmOS86.js";var q=t(e(),1),J=n();function Ye({className:e,checked:t,onCheckedChange:n,disabled:r,...i}){return(0,J.jsx)(`button`,{type:`button`,role:`switch`,"aria-checked":t,"data-state":t?`checked`:`unchecked`,disabled:r,onClick:()=>n(!t),className:u(`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,J.jsx)(`span`,{className:u(`pointer-events-none block size-4 rounded-full bg-background shadow transition-transform`,t?`translate-x-[18px]`:`translate-x-[2px]`)})})}var Y=[{id:`messages`,label:()=>I()},{id:`composer`,label:()=>r()},{id:`sidebar`,label:()=>me()},{id:`notifications`,label:()=>p()},{id:`other`,label:()=>O()}],X={showSource:{category:`messages`,label:()=>w(),help:()=>E()},showReport:{category:`messages`,label:()=>ae(),help:()=>Oe()},copyAssistant:{category:`messages`,label:()=>se()},copyUser:{category:`messages`,label:()=>ee()},showDelete:{category:`messages`,label:()=>S()},showTools:{category:`messages`,label:()=>v(),help:()=>ne()},voiceInput:{category:`composer`,label:()=>b(),help:()=>o()},showUsage:{category:`composer`,label:()=>Ie(),help:()=>ge()},autoReadAloud:{category:`composer`,label:()=>de(),help:()=>Ce()},showChatAge:{category:`sidebar`,label:()=>le(),help:()=>ie()},notifSound:{category:`notifications`,label:()=>pe(),help:()=>fe()},notifSystem:{category:`notifications`,label:()=>ue(),help:()=>Se()},replySound:{category:`notifications`,label:()=>a(),help:()=>we()}};function Z(e){return e.toLowerCase().normalize(`NFD`).replace(/\p{Diacritic}/gu,``)}function Q(e,t){let n=Z(t.trim()),r=new Map(Y.map(e=>[e.id,e.label()])),i=new Map(Y.map(e=>[e.id,[]]));for(let t of e){let e=X[t],a=e?.category??`other`;n&&!Z(`${e?e.label():t} ${e?.help?e.help():``} ${t} ${r.get(a)??``}`).includes(n)||i.get(a).push(t)}return Y.map(e=>({id:e.id,label:r.get(e.id),keys:i.get(e.id)})).filter(e=>e.keys.length>0)}var Xe=[`showSource`,`showReport`,`copyAssistant`,`copyUser`,`showDelete`,`showTools`,`voiceInput`,`showChatAge`,`showUsage`,`autoReadAloud`,`notifSound`,`notifSystem`,`replySound`],Ze={voiceInput:`voiceInput`};function Qe(e){return Xe.includes(e)}function $(e){return e===`admin`}function $e(e){return e===!0?`on`:e===!1?`off`:`inherit`}function et(e){return e===`on`?!0:e===`off`?!1:null}function tt(e){return Qe(e)?Ze[e]:void 0}var nt={voiceInput:()=>Fe()};function rt({prefKey:e,ui:t}){let n=R(g.admin.setUiPrefDefault),r=R(g.admin.setFeatureEnabled),i=tt(e),a=i?nt[e]?.():void 0;return(0,J.jsxs)(`div`,{className:`oc-prefs__gov`,children:[(0,J.jsxs)(`div`,{className:`oc-prefs__gov-row`,children:[(0,J.jsx)(`span`,{className:`oc-prefs__gov-label`,children:c()}),(0,J.jsxs)(qe,{value:$e(t.defaults[e]),onValueChange:t=>void n({key:e,value:et(t)}),children:[(0,J.jsx)(Ge,{size:`sm`,className:`w-36`,children:(0,J.jsx)(ze,{})}),(0,J.jsxs)(Re,{children:[(0,J.jsx)(H,{value:`on`,children:A()}),(0,J.jsx)(H,{value:`off`,children:_e()}),(0,J.jsx)(H,{value:`inherit`,children:ye()})]})]}),i?(0,J.jsxs)(`span`,{className:`oc-prefs__gov-gate`,children:[(0,J.jsx)(G,{checked:t.featuresEnabled[i]===!0,onCheckedChange:e=>void r({key:i,enabled:e===!0}),"aria-label":h()}),h()]}):null]}),a?(0,J.jsx)(`span`,{className:`oc-prefs__gov-help`,children:a}):null]})}function it({current:e,enabled:t}){let n=R(g.me.setDictationShortcut),[r,i]=(0,q.useState)(!1),[a,o]=(0,q.useState)(!1);return(0,q.useEffect)(()=>{if(!r)return;let e=e=>{if(e.preventDefault(),e.stopPropagation(),e.key===`Escape`){i(!1);return}let t=He(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,J.jsxs)(`div`,{className:`oc-prefs__row${t?``:` is-locked`}`,children:[(0,J.jsxs)(`div`,{className:`oc-prefs__info`,children:[(0,J.jsxs)(`span`,{className:`oc-prefs__label`,children:[Ne(),e?(0,J.jsx)(K,{variant:`secondary`,children:Be(e,Ue())}):null]}),(0,J.jsx)(`span`,{className:`oc-prefs__help`,children:a?xe():r?ve():j()})]}),(0,J.jsxs)(`div`,{className:`oc-prefs__ctl`,children:[e&&!r?(0,J.jsx)(`button`,{type:`button`,className:`oc-prefs__reset`,onClick:()=>void n({shortcut:null}),children:P()}):null,(0,J.jsx)(`button`,{type:`button`,className:`oc-prefs__reset`,disabled:!t,"aria-pressed":r,onClick:()=>i(e=>!e),children:r?L():e?De():Te()})]})]})}function at(){let[e,t]=(0,q.useState)(``),[n,r]=(0,q.useState)(!1),i=B(g.me.getMe,{host:U}),a=i?.ui,o=$(i?.role)&&n,s=R(g.me.setUiPref).withOptimisticUpdate(Ve),c=(0,q.useMemo)(()=>a?Q(Object.keys(a.effective),e):[],[a,e]);return a?(0,J.jsxs)(`div`,{className:`oc-prefs-panel`,children:[$(i?.role)?(0,J.jsxs)(`label`,{className:`oc-prefs__gov-toggle`,children:[(0,J.jsx)(G,{checked:n,onCheckedChange:e=>r(e===!0),"aria-label":z()}),z()]}):null,o?(0,J.jsxs)(`div`,{className:`oc-prefs__gov-head`,children:[(0,J.jsx)(`p`,{children:Pe()}),(0,J.jsx)(`p`,{children:N()}),(0,J.jsx)(`p`,{children:Me()})]}):null,(0,J.jsx)(W,{value:e,onChange:e=>t(e.target.value),placeholder:m(),"aria-label":m(),className:`mb-2`}),c.length===0?(0,J.jsx)(`div`,{className:`oc-prefs__empty`,children:l()}):(0,J.jsx)(`div`,{className:`oc-prefs`,children:c.map(e=>(0,J.jsxs)(`section`,{className:`oc-prefs__card`,children:[(0,J.jsx)(`h4`,{className:`oc-prefs__cat`,children:e.label}),e.keys.map(e=>{let t=X[e],n=t?t.label():e,r=t?.help?.(),i=a.locked[e],c=a.effective[e],l=a.userOverrides[e]!==void 0;return(0,J.jsxs)(`div`,{className:`oc-prefs__row${i?` is-locked`:``}`,children:[(0,J.jsxs)(`div`,{className:`oc-prefs__info`,children:[(0,J.jsxs)(`span`,{className:`oc-prefs__label`,children:[n,i?(0,J.jsx)(K,{variant:`outline`,children:d()}):l?(0,J.jsx)(K,{variant:`secondary`,children:f()}):null]}),r?(0,J.jsx)(`span`,{className:`oc-prefs__help`,children:r}):null]}),(0,J.jsxs)(`div`,{className:`oc-prefs__ctl`,children:[!i&&l?(0,J.jsx)(`button`,{type:`button`,className:`oc-prefs__reset`,onClick:()=>void s({key:e,value:null}),children:_()}):null,(0,J.jsx)(Ye,{checked:c,disabled:i,onCheckedChange:t=>{e===`notifSystem`&&t&&typeof Notification<`u`&&Notification.permission==="default"&&Notification.requestPermission(),s({key:e,value:t})},"aria-label":n})]}),o?(0,J.jsx)(rt,{prefKey:e,ui:a}):null]},e)})]},e.id))}),(0,J.jsx)(it,{current:i?.dictationShortcut??null,enabled:a.effective.voiceInput===!0})]}):(0,J.jsx)(`div`,{className:`oc-prefs__empty`,children:je()})}var ot={sm:()=>C(),md:()=>y(),lg:()=>re(),xl:()=>x()};function st(){let e=B(g.me.getMe,{host:U}),t=R(g.me.setLocale),n=R(g.me.setFontScale).withOptimisticUpdate((e,{scale:t})=>{let n=e.getQuery(g.me.getMe,{host:U});n&&e.setQuery(g.me.getMe,{host:U},{...n,fontScale:t,resolvedFontScale:t??`md`})}),r=R(g.me.setMyName),a=Ke(),o=e?.locale??`default`,c=e?.name??``,[l,u]=(0,q.useState)(null),d=l??c,f=d.trim()!==c.trim();async function p(){try{await r({name:d}),u(null),a.success(he())}catch(e){a.error(k(),e)}}return(0,J.jsxs)(`div`,{className:`oc-appearance`,children:[(0,J.jsxs)(`section`,{className:`oc-show__section`,children:[(0,J.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,J.jsx)(`h2`,{className:`oc-show__title`,children:Ee()}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:Ae()})]}),(0,J.jsxs)(`div`,{className:`oc-show__row`,children:[(0,J.jsx)(W,{className:`max-w-xs`,value:d,maxLength:120,placeholder:F(),onChange:e=>u(e.target.value),onKeyDown:e=>{e.key===`Enter`&&f&&(e.preventDefault(),p())}}),(0,J.jsx)(V,{size:`sm`,disabled:!f,onClick:()=>void p(),children:be()})]}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:i()})]}),(0,J.jsxs)(`section`,{className:`oc-show__section`,children:[(0,J.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,J.jsx)(`h2`,{className:`oc-show__title`,children:T()}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:D()})]}),(0,J.jsxs)(`div`,{className:`oc-show__row`,children:[Je().map(e=>(0,J.jsx)(V,{variant:o===e.value?`default`:`outline`,size:`sm`,onClick:()=>void t({locale:e.value}),children:e.label},e.value)),(0,J.jsx)(V,{variant:o==="default"?`default`:`outline`,size:`sm`,onClick:()=>void t({locale:null}),children:M()})]}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:oe()})]}),(0,J.jsxs)(`section`,{className:`oc-show__section`,children:[(0,J.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,J.jsx)(`h2`,{className:`oc-show__title`,children:ke()}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:ce()})]}),(0,J.jsx)(`div`,{className:`oc-show__row`,children:We.map(t=>(0,J.jsx)(V,{variant:(e?.fontScale??`md`)===t?`default`:`outline`,size:`sm`,onClick:()=>void n({scale:t}),children:ot[t]()},t))}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:te()})]}),(0,J.jsxs)(`section`,{className:`oc-show__section`,children:[(0,J.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,J.jsx)(`h2`,{className:`oc-show__title`,children:s()}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:Le()})]}),(0,J.jsx)(at,{})]})]})}export{st as PreferencesTab};
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$n as r,A_ as i,Ai as a,C_ as o,D_ as s,Di as c,E_ as l,H_ as u,M_ as d,Mi as f,N_ as p,O_ as m,Oi as h,P_ as g,Qn as _,S_ as v,T as y,T_ as ee,V_ as b,Zn as x,__ as S,b_ as C,fo as w,g_ as T,go as te,h_ as E,ho as D,j_ as ne,ji as re,k_ as ie,ki as ae,mo as O,po as k,vF as A,v_ as j,w_ as M,x_ as N,yF as P,y_ as F}from"./dist-B1qnlN7I.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-HlyBnXo4.js";import{t as W}from"./button-BCAsV4-2.js";import{C as G,S as K,T as q,gt as J,m as oe,w as Y,wt as se,x as X}from"./index-rCasMjHB.js";import{r as Z,t as ce}from"./locales-CPjguROj.js";import{t as le}from"./localePickerView-C2RmOS86.js";/* empty css */var Q=t(e(),1),$=n(),ue={media_delivery:{label:ie,help:m},documentary_fetch:{label:s,help:l},inbound_files:{label:ee,help:M},history_summary:{label:te,help:D},file_curation:{label:f,help:re}},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:S,references:T,files:E,previous_summary:O,new_messages:k,max_chars:w,file_name:a,budget_chars:ae,feedback:h,content:c};function pe(){let e=P(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:v()})});let r=e.find(e=>e._id===t)??e[0];return(0,$.jsxs)(`div`,{className:`oc-injtab`,children:[(0,$.jsxs)(`div`,{className:`oc-injtab__head`,children:[(0,$.jsx)(B,{label:g(),help:p()}),(0,$.jsxs)(`label`,{className:`oc-injtab__picker`,children:[(0,$.jsx)(`span`,{children:o()}),(0,$.jsxs)(X,{value:r._id,onValueChange:e=>n(e),children:[(0,$.jsx)(Y,{size:`sm`,className:`min-w-44`,children:(0,$.jsx)(q,{})}),(0,$.jsx)(K,{children:e.map(e=>(0,$.jsx)(G,{value:e._id,children:e.displayName??e.name},e._id))})]})]})]}),(0,$.jsx)(me,{instance:r},r._id)]})}function me({instance:e}){let t=A(y.admin.upsertInstanceConfig),n=se(),i=P(y.me.getMe,{host:J}),a=e.config??{},o=Z(e.config?.contentLocale,i?.defaultLocale??void 0),[s,c]=(0,Q.useState)(()=>R(a,o));(0,Q.useEffect)(()=>{c(R(a,o))},[o,e._id]);let[l,d]=(0,Q.useState)(!1),f=s.promptInjections,p=(e,t)=>c({...s,promptInjections:{...f,[e]:{...f[e],...t}}});async function m(){d(!0);try{await t({instanceId:e._id,config:V(s,a,o)})}catch(e){n.error(b(),e)}finally{d(!1)}}async function h(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(b(),e)}}let g=e.config?.contentLocale??`default`,v=ce[Z(void 0,i?.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:r()}),(0,$.jsxs)(X,{value:g,onValueChange:e=>void h(e),children:[(0,$.jsx)(Y,{size:`sm`,className:`min-w-44`,children:(0,$.jsx)(q,{})}),(0,$.jsxs)(K,{children:[(0,$.jsx)(G,{value:`default`,children:x({locale:v})}),le().map(e=>(0,$.jsx)(G,{value:e.value,children:e.label},e.value))]})]}),(0,$.jsx)(`p`,{className:`oc-admin__hint`,children:_()})]}),U.map(e=>(0,$.jsx)(he,{injKey:e,def:z[e],i18n:ue[e],row:f[e]??{enabled:!0,template:z[e].defaultTemplate[o]},contentLocale:o,onChange:t=>p(e,t)},e)),(0,$.jsx)(`div`,{className:`oc-injtab__actions`,children:(0,$.jsx)(W,{size:`sm`,onClick:()=>void m(),disabled:l,children:u()})})]})}function he({injKey:e,def:t,i18n:n,row:r,contentLocale:a,onChange:o}){let[s,c]=(0,Q.useState)(!1),l=r.template.trim()!==t.defaultTemplate[a],u=t.togglable&&!r.enabled,f=Object.fromEntries(t.placeholders.map(e=>[e,de[e]??`{${e}}`])),p=I(e,r,a),m=p?L(p,f):``;return(0,$.jsxs)(`section`,{className:`oc-injcard`,children:[(0,$.jsxs)(`div`,{className:`oc-injcard__head`,children:[t.togglable?(0,$.jsxs)(`label`,{className:`oc-field--row`,children:[(0,$.jsx)(oe,{checked:r.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:ne()})]}),(0,$.jsx)(`textarea`,{className:`oc-injcard__text`,value:r.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:i()}),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?C():N()}),l&&(0,$.jsx)(W,{variant:`ghost`,size:`sm`,onClick:()=>o({template:t.defaultTemplate[a]}),children:d()})]})]}),s&&(0,$.jsx)(`div`,{className:`oc-injcard__preview`,children:m?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`pre`,{className:`oc-injcard__previewtext`,children:m}),(0,$.jsx)(`span`,{className:`oc-injection__ph`,children:F()})]}):(0,$.jsx)(`span`,{className:`oc-injection__ph`,children:j()})})]})}export{pe as PromptInjectionsTab};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Ax as r,Cx as i,Dx as a,Ex as o,Gb as ee,Hb as te,Jb as ne,Kb as re,Ox as s,Sx as c,T as l,Tx as u,Ub as d,Vb as f,Wb as p,Yb as m,_x as h,ax as ie,bx as g,cx as _,dx as v,fx as y,gx as b,hx as x,ix as S,kx as C,lx as w,mx as T,na as E,nx as D,ox as O,px as k,qb as A,rx as j,sx as M,tx as N,ux as P,vF as F,vx as I,wx as L,xx as R,yF as ae,yx as z}from"./dist-B1qnlN7I.js";import{t as B}from"./button-BCAsV4-2.js";import{F as V,Gt as H,d as U,it as W,m as G,rt as K,wt as q}from"./index-rCasMjHB.js";import{t as J}from"./roleDescriptions-Bb_m4cgS.js";var Y=t(e(),1),X=n(),Z=[{group:()=>r(),keys:[{key:`traces.read`,label:()=>u()},{key:`traces.read.content`,label:()=>L(),phi:!0},{key:`traces.write`,label:()=>i()}]},{group:()=>C(),keys:[{key:`kpi.read`,label:()=>u()},{key:`kpi.write`,label:()=>i()}]},{group:()=>s(),keys:[{key:`openclaw.query`,label:()=>c()},{key:`anomalies.read`,label:()=>R()},{key:`anomalies.report`,label:()=>g()}]},{group:()=>a(),keys:[{key:`chats.read`,label:()=>u()},{key:`selfheal`,label:()=>I()},{key:`feedback.respond`,label:()=>E()}]},{group:()=>o(),keys:[{key:`admin.manage`,label:()=>z()}]}],oe=Z.flatMap(e=>e.keys.map(e=>e.key));function Q(e){return e.includes(`*`)}var $={key:``,name:``,description:``};function se(){let e=ae(l.apiKeys.listRoles,{}),t=F(l.apiKeys.createRole),n=F(l.apiKeys.ensureRolesSeeded),r=F(l.apiKeys.updateRolePermissions).withOptimisticUpdate((e,{roleId:t,permissions:n})=>{let r=e.getQuery(l.apiKeys.listRoles,{});r&&e.setQuery(l.apiKeys.listRoles,{},r.map(e=>e._id===t?{...e,permissions:n}:e))}),i=V(),a=q(),[o,s]=(0,Y.useState)(!1),[c,u]=(0,Y.useState)($),[g,C]=(0,Y.useState)(new Set);(0,Y.useEffect)(()=>{n({}).catch(e=>{a.error(b(),e)})},[n,a]);let E=e??[];async function I(e,t){if(Q(e.permissions))return;if(e.builtin){await i({title:x({name:e.name}),description:T(),confirmLabel:k()});return}if(g.has(e._id))return;let n=e.permissions.includes(t)?e.permissions.filter(e=>e!==t):[...e.permissions,t];C(t=>new Set(t).add(e._id));try{await r({roleId:e._id,permissions:n})}catch(e){a.error(y(),e)}finally{C(t=>{let n=new Set(t);return n.delete(e._id),n})}}async function L(){try{await t({key:c.key,name:c.name,description:c.description||void 0,permissions:[]}),u($),s(!1)}catch(e){a.error(v(),e)}}let R=e===void 0,z=!R&&E.length===0;return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`p`,{className:`oc-admin__hint`,children:[P(),` `,(0,X.jsx)(`code`,{children:`admin`}),` `,w(),` `,(0,X.jsx)(`code`,{children:`traces.read.content`}),` `,_()]}),(0,X.jsxs)(`div`,{className:`oc-dt`,children:[(0,X.jsxs)(`div`,{className:`oc-dt__bar`,children:[(0,X.jsx)(`h2`,{className:`oc-dt__title`,children:M()}),(0,X.jsx)(`div`,{className:`oc-dt__bar-actions`,children:(0,X.jsx)(B,{size:`sm`,onClick:()=>{u($),s(!0)},children:O()})})]}),R?(0,X.jsx)(`p`,{className:`oc-admin__hint`,children:ie()}):z?(0,X.jsx)(`p`,{className:`oc-admin__hint`,children:S()}):(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:j()}),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:E.map(e=>{let t=Q(e.permissions),n=g.has(e._id);return(0,X.jsxs)(`tr`,{children:[(0,X.jsxs)(`th`,{className:`oc-matrix__rolecell`,children:[(0,X.jsxs)(`div`,{className:`oc-matrix__rolename`,children:[(0,X.jsx)(`span`,{children:e.name}),(0,X.jsx)(`code`,{className:`oc-matrix__rolekey`,children:e.key}),e.builtin?(0,X.jsxs)(K,{variant:`outline`,className:`gap-1`,children:[(0,X.jsx)(H,{}),` `,D()]}):(0,X.jsx)(K,{variant:`secondary`,children:N()})]}),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?m():n?ne():r,onCheckedChange:()=>void I(e,r)})},r))]},e.key)})})]})})]}),(0,X.jsx)(U,{open:o,onOpenChange:s,title:A(),description:re(),canSubmit:!!(c.key&&c.name),onSubmit:L,submitLabel:ee(),children:(0,X.jsxs)(`div`,{className:`oc-form`,children:[(0,X.jsxs)(`label`,{className:`oc-field`,children:[(0,X.jsx)(`span`,{className:`oc-field__label`,children:p()}),(0,X.jsx)(W,{value:c.key,placeholder:d(),onChange:e=>u({...c,key:e.target.value})})]}),(0,X.jsxs)(`label`,{className:`oc-field`,children:[(0,X.jsx)(`span`,{className:`oc-field__label`,children:te()}),(0,X.jsx)(W,{value:c.name,onChange:e=>u({...c,name:e.target.value})})]}),(0,X.jsxs)(`label`,{className:`oc-field`,children:[(0,X.jsx)(`span`,{className:`oc-field__label`,children:f()}),(0,X.jsx)(W,{value:c.description,onChange:e=>u({...c,description:e.target.value})})]})]})})]})}export{se as RolesTab};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$N as r,BM as i,BN as a,CN as o,D as s,DM as c,FM as ee,GM as te,GN as ne,HM as re,HN as ie,IM as ae,JM as l,JN as oe,KM as se,KN as ce,LM as le,NM as ue,PM as de,QN as fe,RM as pe,SN as u,T as d,UM as me,UN as he,VM as ge,VN as _e,WM as ve,WN as ye,XM as be,XN as xe,YM as f,YN as Se,ZN as Ce,_N as p,bN as m,dN as we,eP as Te,fF as Ee,fN as De,gF as h,gN as Oe,hN as ke,lN as Ae,mN as je,oN as Me,pN as Ne,qM as Pe,qN as g,sN as Fe,uF as _,uN as Ie,xN as Le,yN as Re,zM as ze}from"./dist-B1qnlN7I.js";import{t as v}from"./button-BCAsV4-2.js";import{B as Be,C as y,Ft as Ve,H as He,Ht as Ue,Kt as We,L as Ge,Mt as Ke,N as qe,P as Je,R as Ye,S as Xe,T as Ze,U as Qe,Ut as $e,V as et,Vt as tt,W as nt,at as rt,ct as it,it as b,lt as x,ot as S,rt as C,st as at,ut as w,w as T,wt as ot,x as E,z as st,zt as ct}from"./index-rCasMjHB.js";import{a as lt,i as D,n as ut,o as O,r as k,t as dt}from"./table-DckOsZQY.js";var ft=s(`history`,[[`path`,{d:`M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`,key:`1357e3`}],[`path`,{d:`M3 3v5h5`,key:`1xhq8a`}],[`path`,{d:`M12 7v5l4 2`,key:`1fdv2h`}]]),A=t(e(),1),j=n(),M={minutes:6e4,hours:36e5,days:864e5};function N(e){return e?.data?.code??`unknown`}function P(){let e=h(d.scheduled.listMyCrons),t=h(d.scheduled.getCronDetail),n=h(d.scheduled.listCronRuns),s=h(d.scheduled.updateCron),P=h(d.scheduled.removeCron),pt=h(d.scheduled.runCronNow),F=ot(),[I,mt]=(0,A.useState)(null),[L,R]=(0,A.useState)(!1),[z,B]=(0,A.useState)(!1),[V,H]=(0,A.useState)(null),[U,W]=(0,A.useState)(null),[G,K]=(0,A.useState)(null),[q,J]=(0,A.useState)(null),[ht,gt]=(0,A.useState)(!1),Y=(0,A.useCallback)(async()=>{R(!0),B(!1);try{mt(await e({}))}catch{B(!0)}finally{R(!1)}},[e]);(0,A.useEffect)(()=>{Y()},[Y]);let _t=(0,A.useMemo)(()=>new URLSearchParams(window.location.search).get(`job`),[]),X=(0,A.useRef)(null);(0,A.useEffect)(()=>{I!==null&&X.current!==null&&X.current.scrollIntoView({block:`center`})},[I]);let vt=(0,A.useMemo)(()=>new Intl.DateTimeFormat(Ee(),{dateStyle:`medium`,timeStyle:`short`}),[]),Z=async(e,t,n)=>{H(e);try{await t(),F.success(n),await Y()}catch(e){F.toast({variant:`error`,title:p({code:N(e)})})}finally{H(null)}},Q=(0,A.useRef)(0),$=(0,A.useRef)(0),yt=async(e,t)=>{if(t.id===null)return;let r=++Q.current;K({name:t.name??t.id,entries:null});try{let i=await n({instanceName:e,jobId:t.id,limit:20});if(r!==Q.current)return;K({name:t.name??t.id,entries:i})}catch(e){if(r!==Q.current)return;K(null),F.toast({variant:`error`,title:p({code:N(e)})})}},bt=async(e,n)=>{if(n.id===null)return;let r=++$.current;J({instanceName:e,jobId:n.id,loading:!0,name:n.name??``,scheduleKind:`cron`,cronExpr:``,tz:``,everyValue:`1`,everyUnit:`hours`,at:``,message:``,hasMessage:!1,scheduleDirty:!1,messageDirty:!1,nameDirty:!1});try{let i=(await t({instanceName:e,jobId:n.id})).job,a=i.scheduleKind===`every`||i.scheduleKind===`at`?i.scheduleKind:`cron`,o=``;if(a===`at`&&i.scheduleExpr!==null){let e=Date.parse(i.scheduleExpr);Number.isFinite(e)&&(o=new Date(e-new Date(e).getTimezoneOffset()*6e4).toISOString().slice(0,16))}let s=`1`,c=`hours`;if(a===`every`&&i.scheduleExpr!==null){let e=Number(i.scheduleExpr);Number.isFinite(e)&&e>0&&(e%M.days===0?(s=String(e/M.days),c=`days`):e%M.hours===0?(s=String(e/M.hours),c=`hours`):(s=String(Math.max(1,Math.round(e/M.minutes))),c=`minutes`))}if(r!==$.current)return;J(e=>e===null||e.jobId!==n.id?e:{...e,loading:!1,name:i.name??e.name,scheduleKind:a,cronExpr:a===`cron`?i.scheduleExpr??``:``,tz:i.tz??``,everyValue:s,everyUnit:c,at:o,message:i.message??``,hasMessage:i.message!==null&&!i.messageTruncated})}catch(e){if(r!==$.current)return;J(null),F.toast({variant:`error`,title:p({code:N(e)})})}},xt=async()=>{if(q===null)return;let e={};if(q.nameDirty&&q.name.trim()===``||q.messageDirty&&q.hasMessage&&q.message.trim()===``){F.toast({variant:`error`,title:ue()});return}if(q.nameDirty&&q.name.trim()!==``&&(e.name=q.name.trim()),q.scheduleDirty){if(q.scheduleKind===`cron`&&q.cronExpr.trim()!==``)e.schedule={kind:`cron`,expr:q.cronExpr.trim(),...q.tz.trim()===``?{}:{tz:q.tz.trim()}};else if(q.scheduleKind===`every`){let t=Number(q.everyValue);Number.isFinite(t)&&t>=1&&(e.schedule={kind:`every`,everyMs:Math.round(t*M[q.everyUnit])})}else if(q.scheduleKind===`at`&&q.at!==``){let t=Date.parse(q.at);Number.isFinite(t)&&(e.schedule={kind:`at`,at:new Date(t).toISOString()})}}if(q.scheduleDirty&&e.schedule===void 0){F.toast({variant:`error`,title:de()});return}if(q.messageDirty&&q.hasMessage&&q.message.trim()!==``&&(e.message=q.message.trim()),Object.keys(e).length===0){J(null);return}let t=$.current;gt(!0);try{await s({instanceName:q.instanceName,jobId:q.jobId,patch:e}),F.success(Pe()),t===$.current&&J(null),await Y()}catch(e){F.toast({variant:`error`,title:p({code:N(e)})})}finally{gt(!1)}},St=I?.reduce((e,t)=>e+t.jobs.length,0)??0;return(0,j.jsxs)(j.Fragment,{children:[(0,j.jsxs)(`div`,{style:{display:`flex`,alignItems:`flex-start`,gap:8,marginBottom:12},children:[(0,j.jsx)(`p`,{className:`oc-admin__hint`,style:{flex:1,margin:0},children:Te()}),(0,j.jsxs)(v,{variant:`ghost`,size:`sm`,onClick:()=>void Y(),disabled:L,style:{display:`inline-flex`,alignItems:`center`,gap:4},children:[(0,j.jsx)(ct,{size:14,"aria-hidden":!0}),r()]})]}),I===null?(0,j.jsx)(`p`,{className:`oc-admin__hint`,"aria-busy":L,children:z?fe():_()}):(0,j.jsxs)(j.Fragment,{children:[z?(0,j.jsx)(`p`,{className:`oc-admin__hint`,children:fe()}):null,I.length===0?(0,j.jsx)(`p`,{className:`oc-admin__hint`,children:Ce()}):null,I.map(e=>(0,j.jsxs)(`section`,{style:{marginBottom:20},children:[I.length>1||e.error||!e.supported?(0,j.jsxs)(`h3`,{style:{display:`flex`,alignItems:`center`,gap:8,fontSize:`0.85rem`,fontWeight:600,margin:`0 0 6px`},children:[e.instanceName,(0,j.jsx)(C,{variant:`outline`,children:e.kind})]}):null,e.supported?e.error?(0,j.jsx)(`p`,{className:`oc-admin__hint`,children:Se({code:e.error})}):e.jobs.length===0?(0,j.jsx)(`p`,{className:`oc-admin__hint`,children:oe()}):(0,j.jsxs)(dt,{children:[(0,j.jsx)(lt,{children:(0,j.jsxs)(O,{children:[(0,j.jsx)(D,{children:g()}),(0,j.jsx)(D,{children:ce()}),(0,j.jsx)(D,{children:ne()}),(0,j.jsx)(D,{children:ye()}),(0,j.jsx)(D,{children:he()}),(0,j.jsx)(D,{children:be()})]})}),(0,j.jsx)(ut,{children:e.jobs.map((t,n)=>{let r=`${e.instanceName}:${t.id??n}`,i=V===r,o=e.manageSupported,c=e.kind===`openclaw`&&o;return(0,j.jsxs)(O,{ref:t.id!==null&&t.id===_t?X:void 0,"data-state":t.id!==null&&t.id===_t?`selected`:void 0,children:[(0,j.jsx)(k,{className:`font-medium`,style:{maxWidth:280,overflow:`hidden`,textOverflow:`ellipsis`},title:t.name??void 0,children:t.name??ie()}),(0,j.jsx)(k,{children:(0,j.jsx)(C,{variant:`secondary`,children:t.agentId})}),(0,j.jsxs)(k,{className:`whitespace-nowrap`,children:[(0,j.jsx)(`span`,{style:{fontFamily:`var(--font-mono, monospace)`},children:t.schedule??`—`}),(()=>{let e=qe(t.schedule),n=e===null?null:Je(e);return n===null?null:(0,j.jsx)(`span`,{className:`text-muted-foreground`,style:{display:`block`,fontSize:`0.78rem`},children:n})})()]}),(0,j.jsx)(k,{className:`whitespace-nowrap text-muted-foreground`,children:t.nextRunAtMs===null?`—`:vt.format(t.nextRunAtMs)}),(0,j.jsxs)(k,{children:[t.enabled===!0?(0,j.jsx)(C,{variant:`secondary`,children:a()}):t.enabled===!1?(0,j.jsx)(C,{variant:`outline`,children:_e()}):(0,j.jsx)(`span`,{className:`text-muted-foreground`,children:`—`}),t.lastRunStatus?(0,j.jsx)(`span`,{className:`text-muted-foreground`,style:{marginLeft:8,fontSize:`0.8rem`},children:t.lastRunStatus}):null]}),(0,j.jsx)(k,{className:`whitespace-nowrap`,children:t.id===null?(0,j.jsx)(`span`,{className:`text-muted-foreground`,children:`—`}):i?(0,j.jsx)(We,{size:14,className:`oc-actrow__spin`,"aria-hidden":!0}):(0,j.jsxs)(`span`,{style:{display:`inline-flex`,gap:2},children:[c?(0,j.jsx)(v,{variant:`ghost`,size:`icon-sm`,title:u(),"aria-label":u(),disabled:V!==null,onClick:()=>void Z(r,async()=>{let n=await pt({instanceName:e.instanceName,jobId:t.id});if(n.ran!==!0&&n.runId===null)throw{data:{code:n.reason??`run_not_started`}}},Oe()),children:(0,j.jsx)(Ke,{size:14,"aria-hidden":!0})}):null,c&&t.enabled!==null?(0,j.jsx)(v,{variant:`ghost`,size:`icon-sm`,title:t.enabled?Le():m(),"aria-label":t.enabled?Le():m(),disabled:V!==null,onClick:()=>void Z(r,()=>s({instanceName:e.instanceName,jobId:t.id,patch:{enabled:!t.enabled}}),t.enabled?ke():je()),children:t.enabled?(0,j.jsx)($e,{size:14,"aria-hidden":!0}):(0,j.jsx)(tt,{size:14,"aria-hidden":!0})}):null,c?(0,j.jsx)(v,{variant:`ghost`,size:`icon-sm`,title:f(),"aria-label":f(),disabled:V!==null,onClick:()=>void bt(e.instanceName,t),children:(0,j.jsx)(Ue,{size:14,"aria-hidden":!0})}):null,c?(0,j.jsx)(v,{variant:`ghost`,size:`icon-sm`,title:l(),"aria-label":l(),disabled:V!==null,onClick:()=>void yt(e.instanceName,t),children:(0,j.jsx)(ft,{size:14,"aria-hidden":!0})}):null,o?(0,j.jsx)(v,{variant:`ghost`,size:`icon-sm`,title:Re(),"aria-label":Re(),disabled:V!==null,onClick:()=>W({instanceName:e.instanceName,jobId:t.id,name:t.name??t.id}),children:(0,j.jsx)(Ve,{size:14,"aria-hidden":!0})}):null]})})]},t.id??`${e.instanceName}-${n}`)})})]}):(0,j.jsx)(`p`,{className:`oc-admin__hint`,children:xe()})]},e.instanceName)),St>0?(0,j.jsx)(`p`,{className:`oc-admin__hint`,style:{marginTop:4},children:c()}):null]}),(0,j.jsx)(Ge,{open:U!==null,onOpenChange:e=>{e||W(null)},children:(0,j.jsxs)(Be,{children:[(0,j.jsxs)(Qe,{children:[(0,j.jsx)(nt,{children:De()}),(0,j.jsx)(et,{children:we({name:U?.name??``})})]}),(0,j.jsxs)(He,{children:[(0,j.jsx)(st,{children:Ie()}),(0,j.jsx)(Ye,{onClick:()=>{let e=U;W(null),e!==null&&Z(`${e.instanceName}:${e.jobId}`,()=>P({instanceName:e.instanceName,jobId:e.jobId}),Ne())},children:Ae()})]})]})}),(0,j.jsx)(rt,{open:G!==null,onOpenChange:e=>{e||(Q.current++,K(null))},children:(0,j.jsxs)(S,{style:{maxWidth:640},children:[(0,j.jsx)(x,{children:(0,j.jsx)(w,{children:se({name:G?.name??``})})}),G?.entries===null?(0,j.jsx)(`p`,{className:`oc-admin__hint`,children:_()}):G!==null&&G.entries.length===0?(0,j.jsx)(`p`,{className:`oc-admin__hint`,children:te()}):G===null?null:(0,j.jsx)(`div`,{className:`oc-cronpanel__runs`,style:{maxHeight:420,overflowY:`auto`},children:G.entries.map((e,t)=>(0,j.jsxs)(`div`,{className:`oc-cronpanel__run`,children:[(0,j.jsxs)(`div`,{className:`oc-cronpanel__run-head`,children:[e.status===`ok`?(0,j.jsx)(C,{variant:`secondary`,children:Fe()}):e.status===`error`?(0,j.jsx)(C,{variant:`destructive`,children:Me()}):(0,j.jsx)(C,{variant:`outline`,children:e.status??`—`}),(0,j.jsx)(`span`,{children:typeof(e.runAtMs??e.ts)==`number`?vt.format(e.runAtMs??e.ts):`—`}),typeof e.durationMs==`number`?(0,j.jsxs)(`span`,{className:`oc-cronpanel__run-dur`,children:[Math.round(e.durationMs/1e3),`s`]}):null]}),e.summary===null?null:(0,j.jsx)(`div`,{className:`oc-cronpanel__run-summary`,children:e.summary}),e.error===null?null:(0,j.jsx)(`div`,{className:`oc-cronpanel__run-error`,children:e.error})]},t))})]})}),(0,j.jsx)(rt,{open:q!==null,onOpenChange:e=>{e||($.current++,J(null))},children:(0,j.jsxs)(S,{children:[(0,j.jsxs)(x,{children:[(0,j.jsx)(w,{children:ve()}),(0,j.jsx)(at,{children:me()})]}),q===null?null:q.loading?(0,j.jsx)(`p`,{className:`oc-admin__hint`,children:_()}):(0,j.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:12},children:[(0,j.jsxs)(`label`,{style:{display:`flex`,flexDirection:`column`,gap:4},children:[(0,j.jsx)(`span`,{className:`oc-admin__hint`,style:{margin:0},children:g()}),(0,j.jsx)(b,{value:q.name,maxLength:200,onChange:e=>J({...q,name:e.target.value,nameDirty:!0})})]}),(0,j.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:4},children:[(0,j.jsx)(`span`,{className:`oc-admin__hint`,style:{margin:0},children:re()}),(0,j.jsxs)(E,{value:q.scheduleKind,onValueChange:e=>J({...q,scheduleKind:e,scheduleDirty:!0}),children:[(0,j.jsx)(T,{children:(0,j.jsx)(Ze,{})}),(0,j.jsxs)(Xe,{children:[(0,j.jsx)(y,{value:`cron`,children:ge()}),(0,j.jsx)(y,{value:`every`,children:i()}),(0,j.jsx)(y,{value:`at`,children:ze()})]})]}),q.scheduleKind===`cron`?(0,j.jsxs)(`div`,{style:{display:`flex`,gap:8},children:[(0,j.jsx)(b,{value:q.cronExpr,onChange:e=>J({...q,cronExpr:e.target.value,scheduleDirty:!0}),placeholder:`30 9 * * *`,style:{fontFamily:`var(--font-mono, monospace)`}}),(0,j.jsx)(b,{value:q.tz,onChange:e=>J({...q,tz:e.target.value,scheduleDirty:!0}),placeholder:`America/Toronto`,style:{maxWidth:180}})]}):q.scheduleKind===`every`?(0,j.jsxs)(`div`,{style:{display:`flex`,gap:8},children:[(0,j.jsx)(b,{type:`number`,min:1,value:q.everyValue,onChange:e=>J({...q,everyValue:e.target.value,scheduleDirty:!0}),style:{maxWidth:120}}),(0,j.jsxs)(E,{value:q.everyUnit,onValueChange:e=>J({...q,everyUnit:e,scheduleDirty:!0}),children:[(0,j.jsx)(T,{style:{maxWidth:160},children:(0,j.jsx)(Ze,{})}),(0,j.jsxs)(Xe,{children:[(0,j.jsx)(y,{value:`minutes`,children:pe()}),(0,j.jsx)(y,{value:`hours`,children:le()}),(0,j.jsx)(y,{value:`days`,children:ae()})]})]})]}):(0,j.jsx)(b,{type:`datetime-local`,value:q.at,onChange:e=>J({...q,at:e.target.value,scheduleDirty:!0})})]}),q.hasMessage?(0,j.jsxs)(`label`,{style:{display:`flex`,flexDirection:`column`,gap:4},children:[(0,j.jsx)(`span`,{className:`oc-admin__hint`,style:{margin:0},children:o()}),(0,j.jsx)(`textarea`,{className:`oc-cronedit__textarea`,rows:4,value:q.message,onChange:e=>J({...q,message:e.target.value,messageDirty:!0})})]}):null]}),(0,j.jsxs)(it,{children:[(0,j.jsx)(v,{variant:`ghost`,onClick:()=>J(null),children:Ie()}),(0,j.jsxs)(v,{onClick:()=>void xt(),disabled:q===null||q.loading||ht,children:[ht?(0,j.jsx)(We,{size:14,className:`oc-actrow__spin`,"aria-hidden":!0}):null,ee()]})]})]})})]})}export{P as ScheduledTab};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$O as r,$k as ee,Ak as te,Bk as ne,Ck as re,Dk as ie,Ek as ae,Fk as oe,Gk as se,Hk as ce,Ik as le,JO as i,Jk as ue,Kk as de,Lk as fe,Mk as pe,Nk as me,Ok as he,Pk as ge,QO as a,Qk as _e,Rk as ve,Sk as ye,T as o,Tk as be,Uk as xe,Vk as Se,Wk as Ce,XO as we,Xk as Te,YO as Ee,Yk as De,ZO as s,Zk as Oe,_k as c,aA as ke,ak as l,bk as Ae,cA as u,ck as d,dA as je,dk as Me,eA as Ne,ek as f,fA as Pe,fk as p,gF as Fe,gk as m,hk as h,iA as Ie,ik as g,jk as Le,kk as Re,lA as _,lk as v,mA as ze,mk as y,nA as Be,nk as b,oA as Ve,ok as x,pA as He,pk as S,qk as Ue,rA as We,rk as C,sA as Ge,sk as w,tA as Ke,tk as T,uA as qe,uk as E,vF as D,vk as Je,wk as Ye,xk as Xe,yF as O,yk as Ze,zk as Qe}from"./dist-B1qnlN7I.js";import{n as k}from"./dist-Bw4s22TB.js";import{i as $e}from"./dist-CRven8ef.js";import{t as A}from"./button-BCAsV4-2.js";import{C as j,F as et,J as M,S as N,T as P,Y as F,Zt as I,at as L,ct as R,d as tt,en as nt,it as z,lt as B,nn as rt,ot as V,rn as it,rt as H,st as U,ut as W,w as G,wt as at,x as K}from"./index-rCasMjHB.js";import{t as ot}from"./FilterBar-UyunwEZF.js";import{t as st}from"./DataTableShell-D-RklOZj.js";import{t as ct}from"./roleDescriptions-Bb_m4cgS.js";var q=t(e(),1),J=n(),Y=[{value:`never`,label:()=>f(),days:null},{value:`30`,label:()=>r(),days:30},{value:`90`,label:()=>a(),days:90}],X=720*60*60*1e3,Z=`__all__`,Q={name:``,roleKey:``,description:``};function $(){let e=it({from:`/settings/serviceAccounts`}),t=rt({from:`/settings/serviceAccounts`}),n=e.q??``,r=e.status??Z,[i,a]=(0,q.useState)(Z),we=e=>void t({search:t=>({...t,q:e||void 0}),replace:!0}),Ee=e=>void t({search:t=>({...t,status:e===Z?void 0:e})}),s=O(o.apiKeys.listServiceAccounts,{filter:{q:n||void 0,role:i===Z?void 0:i,disabled:r===Z?void 0:r===`disabled`}}),c=O(o.apiKeys.listKeys,{}),l=O(o.apiKeys.listRoles,{}),d=D(o.apiKeys.createServiceAccount),Me=D(o.apiKeys.updateServiceAccount),f=D(o.apiKeys.deleteServiceAccount),p=Fe(o.apiKeys.mintApiKey),m=D(o.apiKeys.revokeApiKey),h=et(),g=at(),v=n!==``||i!==Z||r!==Z;function y(){a(Z),t({search:{},replace:!0})}let[b,x]=(0,q.useState)(!1),[S,C]=(0,q.useState)(Q),[w,T]=(0,q.useState)(null),[E,k]=(0,q.useState)(new Set),[M,F]=(0,q.useState)(null),I=(0,q.useRef)(!1),[L,R]=(0,q.useState)(new Set),[B,V]=(0,q.useState)({}),[U,W]=(0,q.useState)(null),X=(0,q.useMemo)(()=>{let e=new Map;for(let t of c??[]){let n=e.get(t.serviceAccountId)??[];n.push(t),e.set(t.serviceAccountId,n)}return e},[c]);function $(e){k(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})}async function dt(){try{w?(await Me({serviceAccountId:w,name:S.name,roleKey:S.roleKey,description:S.description}),g.success(pe())):await d({name:S.name,roleKey:S.roleKey,description:S.description||void 0}),C(Q),T(null),x(!1)}catch(e){g.error(w?me():ge(),e)}}function ft(e){C({name:e.name,roleKey:e.roleKey,description:e.description??``}),T(e._id),x(!0)}async function pt(e){if(I.current)return;I.current=!0;let t=B[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 p({serviceAccountId:e._id,expiresAt:r});W({accountName:e.name,plaintext:t.plaintext,prefix:t.prefix,lastFour:t.lastFour})}catch(e){g.error(Le(),e)}finally{I.current=!1,F(null)}}async function mt(e){if(await h({title:te(),description:(0,J.jsxs)(J.Fragment,{children:[Re(),` `,(0,J.jsx)(`span`,{className:`font-mono`,children:e.name}),` `,he(),` `,(0,J.jsx)(`strong`,{children:ie()}),` `,ae()]}),confirmWord:e.name,confirmLabel:be(),destructive:!0}))try{await f({serviceAccountId:e._id}),g.success(Ye(),e.name)}catch(e){g.error(re(),e)}}async function ht(e){if(await h({title:ye(),description:(0,J.jsxs)(J.Fragment,{children:[Xe(),` `,(0,J.jsxs)(`span`,{className:`font-mono`,children:[e.prefix,`…`,e.lastFour]}),` `,Ae()]}),confirmLabel:Ze(),destructive:!0})&&!L.has(e._id)){R(t=>new Set(t).add(e._id));try{await m({keyId:e._id})}catch(e){g.error(Je(),e)}finally{R(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:ze()}),(0,J.jsxs)(ot,{q:n,onQChange:we,searchPlaceholder:He(),onReset:y,canReset:v,children:[(0,J.jsxs)(K,{value:i,onValueChange:a,children:[(0,J.jsx)(G,{size:`sm`,className:`w-40`,children:(0,J.jsx)(P,{placeholder:Pe()})}),(0,J.jsxs)(N,{children:[(0,J.jsx)(j,{value:Z,children:je()}),(l??[]).map(e=>(0,J.jsx)(j,{value:e.key,children:e.key},e._id))]})]}),(0,J.jsxs)(K,{value:r,onValueChange:Ee,children:[(0,J.jsx)(G,{size:`sm`,className:`w-36`,children:(0,J.jsx)(P,{})}),(0,J.jsxs)(N,{children:[(0,J.jsx)(j,{value:Z,children:qe()}),(0,J.jsx)(j,{value:`active`,children:_()}),(0,J.jsx)(j,{value:`disabled`,children:u()})]})]})]}),(0,J.jsx)(st,{title:Ge(),rows:s,addLabel:Ve(),onAdd:()=>{C(Q),T(null),x(!0)},emptyHint:ke(),isExpanded:e=>E.has(e._id),renderExpanded:e=>(0,J.jsx)(lt,{account:e,keys:X.get(e._id)??[],onRevoke:ht,revoking:L}),rowActions:e=>[{label:Ke(),onSelect:()=>ft(e)},{label:Ie(),onSelect:()=>void pt(e)},{label:E.has(e._id)?We():Be(),onSelect:()=>$(e._id)},{label:Ne(),variant:`destructive`,onSelect:()=>void mt(e)}],columns:[{header:``,className:`w-8`,cell:e=>(0,J.jsx)(A,{variant:`ghost`,size:`icon-sm`,"aria-label":E.has(e._id)?ee():_e(),onClick:()=>$(e._id),children:E.has(e._id)?(0,J.jsx)($e,{}):(0,J.jsx)(nt,{})})},{header:Oe(),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:Te(),sort:e=>e.roleKey,cell:e=>(0,J.jsx)(H,{variant:`secondary`,children:e.roleKey})},{header:De(),sort:e=>+!!e.disabled,cell:e=>e.disabled?(0,J.jsx)(H,{variant:`destructive`,children:u()}):(0,J.jsx)(H,{variant:`outline`,children:_()})},{header:ue(),cell:e=>(0,J.jsxs)(K,{value:B[e._id]??`never`,onValueChange:t=>V(n=>({...n,[e._id]:t})),children:[(0,J.jsx)(G,{size:`sm`,className:`w-32`,children:(0,J.jsx)(P,{})}),(0,J.jsx)(N,{children:Y.map(e=>(0,J.jsx)(j,{value:e.value,children:e.label()},e.value))})]})},{header:Ue(),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?de():se({count:t})})}}]}),(0,J.jsx)(tt,{open:b,onOpenChange:e=>{x(e),e||T(null)},title:w?Ce():Se(),description:w?xe():ne(),canSubmit:!!(S.name&&S.roleKey),onSubmit:dt,submitLabel:w?ce():Qe(),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:ve()}),(0,J.jsx)(z,{value:S.name,onChange:e=>C({...S,name:e.target.value})})]}),(0,J.jsxs)(`label`,{className:`oc-field`,children:[(0,J.jsx)(`span`,{className:`oc-field__label`,children:fe()}),(0,J.jsxs)(K,{value:S.roleKey||void 0,onValueChange:e=>C({...S,roleKey:e}),children:[(0,J.jsx)(G,{className:`w-full`,children:(0,J.jsx)(P,{placeholder:le()})}),(0,J.jsx)(N,{children:(l??[]).map(e=>(0,J.jsxs)(j,{value:e.key,children:[e.name,` (`,e.key,`)`]},e._id))})]}),(()=>{let e=(l??[]).find(e=>e.key===S.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:oe()}),(0,J.jsx)(z,{value:S.description,onChange:e=>C({...S,description:e.target.value})})]})]})}),(0,J.jsx)(ut,{minted:U,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:m()}):(0,J.jsxs)(`table`,{className:`oc-sa__keytable`,children:[(0,J.jsx)(`thead`,{children:(0,J.jsxs)(`tr`,{children:[(0,J.jsx)(`th`,{children:h()}),(0,J.jsx)(`th`,{children:y()}),(0,J.jsx)(`th`,{children:S()}),(0,J.jsx)(`th`,{children:p()}),(0,J.jsx)(`th`,{children:Me()}),(0,J.jsx)(`th`,{children:E()}),(0,J.jsx)(`th`,{})]})}),(0,J.jsx)(`tbody`,{children:t.map(t=>(0,J.jsxs)(`tr`,{children:[(0,J.jsx)(`td`,{children:(0,J.jsxs)(`code`,{className:`oc-sa__keyid`,children:[t.prefix,`…`,t.lastFour]})}),(0,J.jsx)(`td`,{children:(0,J.jsx)(H,{variant:`secondary`,children:e.roleKey})}),(0,J.jsx)(`td`,{children:F(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)(A,{variant:`destructive`,size:`sm`,disabled:r.has(t._id),onClick:()=>n(t),children:r.has(t._id)?v():d()})})]},t._id))})]})]})}function ut({minted:e,onClose:t}){let[n,r]=(0,q.useState)(!1);async function ee(){if(e)try{await navigator.clipboard.writeText(e.plaintext),r(!0),window.setTimeout(()=>r(!1),2e3)}catch{}}return(0,J.jsx)(L,{open:e!==null,onOpenChange:e=>{e||(r(!1),t())},children:e?(0,J.jsxs)(V,{className:`max-w-lg`,showCloseButton:!1,onInteractOutside:e=>e.preventDefault(),onEscapeKeyDown:e=>e.preventDefault(),children:[(0,J.jsxs)(B,{children:[(0,J.jsx)(W,{children:w()}),(0,J.jsx)(U,{children:x({name:e.accountName})})]}),(0,J.jsx)(`div`,{className:`oc-sa__minted-warning`,children:l()}),(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)(A,{variant:`outline`,size:`sm`,onClick:()=>void ee(),"aria-label":g(),children:[n?(0,J.jsx)(k,{}):(0,J.jsx)(I,{}),n?C():b()]})]}),(0,J.jsx)(R,{children:(0,J.jsx)(A,{onClick:()=>{r(!1),t()},children:T()})})]}):null})}function dt(e){return e===null?!1:Date.now()-e>X}function ft(e){return e===null?s():F(e)}function pt(e){return e===null?`—`:M(e)}function mt(e){return e.disabled?(0,J.jsx)(H,{variant:`destructive`,children:we()}):e.expiresAt!==null&&e.expiresAt<Date.now()?(0,J.jsx)(H,{variant:`outline`,children:Ee()}):(0,J.jsx)(H,{variant:`outline`,children:i()})}export{$ as ServiceAccountsTab};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$o as r,Ao as i,Bo as a,Co as o,Do as s,Eo as c,Fo as l,Go as u,Ho as d,Io as f,Jo as p,Ko as m,Lo as h,Mo as g,No as _,Oo as v,Po as y,Qo as b,Ro as x,So as S,T as C,To as w,Uo as T,Vo as E,Wo as D,Xo as O,Yo as k,Zo as A,as as j,es as M,is as N,jo as P,ko as F,ns as I,qo as ee,rs as L,ts as R,vF as z,wo as B,xo as V,yF as H,zo as U}from"./dist-B1qnlN7I.js";import{t as W}from"./button-BCAsV4-2.js";import{F as G,Y as K}from"./index-rCasMjHB.js";import{t as q}from"./DataTableShell-D-RklOZj.js";var J=t(e(),1),Y=n(),X={hung:()=>d(),wrong_result:()=>E(),error:()=>a(),other:()=>U()},Z=e=>(e&&X[e]?.())??e??`—`;function Q(e){let t=e.slice(e.lastIndexOf(`:`)+1)||e;return t.length>12?`${t.slice(0,12)}…`:t}function $({data:e}){let t=e.snapshot,n=z(C.subAgentReports.respondToReport),[r,a]=(0,J.useState)(e.thread),[o,u]=(0,J.useState)(``),[d,p]=(0,J.useState)(!1);async function m(){let t=o.trim();if(!(!t||d)){p(!0);try{await n({reportId:e._id,text:t}),a(e=>[...e,{authorRole:`admin`,text:t,at:Date.now()}]),u(``)}finally{p(!1)}}}return(0,Y.jsxs)(`div`,{className:`oc-fbadmin__detail`,children:[(0,Y.jsx)(`div`,{className:`oc-fbadmin__row`,children:(0,Y.jsxs)(`span`,{className:`oc-fbadmin__meta`,children:[Z(e.category),` · `,x({failed:t.failedCount,total:t.totalCount}),t.openclawModel?` · ${t.openclawModel}`:``,t.openclawRuntime?` (${t.openclawRuntime})`:``]})}),e.comment?(0,Y.jsxs)(`section`,{children:[(0,Y.jsx)(`h4`,{className:`oc-fbadmin__h`,children:h()}),(0,Y.jsx)(`p`,{className:`oc-fbadmin__comment`,children:e.comment})]}):null,(0,Y.jsxs)(`section`,{children:[(0,Y.jsx)(`h4`,{className:`oc-fbadmin__h`,children:f()}),r.length>0?(0,Y.jsx)(`div`,{className:`oc-fbadmin__thread`,children:r.map((e,t)=>(0,Y.jsxs)(`div`,{className:`oc-notif__msg oc-notif__msg--${e.authorRole}`,children:[(0,Y.jsx)(`span`,{className:`oc-notif__msg-who`,children:e.authorRole===`admin`?l():y()}),(0,Y.jsx)(`span`,{className:`oc-notif__msg-text`,children:e.text})]},t))}):(0,Y.jsx)(`p`,{className:`oc-fbadmin__meta`,children:_()}),(0,Y.jsx)(`textarea`,{className:`oc-feedback__textarea`,placeholder:g(),value:o,maxLength:2e3,rows:3,onChange:e=>u(e.target.value.slice(0,2e3))}),(0,Y.jsx)(`div`,{className:`oc-fbadmin__row`,style:{justifyContent:`flex-end`},children:(0,Y.jsx)(W,{size:`sm`,onClick:()=>void m(),disabled:!o.trim()||d,children:d?i():P()})})]}),(0,Y.jsxs)(`section`,{children:[(0,Y.jsxs)(`h4`,{className:`oc-fbadmin__h`,children:[F({count:t.children.length}),t.childrenTruncated?` ${v()}`:``,t.textTruncated?` ${s()}`:``]}),(0,Y.jsx)(`div`,{className:`oc-fbadmin__ctx`,children:t.children.map((e,n)=>(0,Y.jsxs)(`div`,{className:`oc-fbadmin__ctx-turn`,children:[(0,Y.jsxs)(`span`,{className:`oc-fbadmin__ctx-role`,children:[(e.taskName?.trim()||Q(e.childSessionKey))+` · ${e.status}`,e.phase?` · ${e.phase}`:``,e.childSessionKey===t.flaggedChildSessionKey?` · ${c()}`:``]}),e.errorMessage?(0,Y.jsx)(`pre`,{className:`oc-msg__source-pre`,children:e.errorMessage}):null,e.resultText?(0,Y.jsx)(`pre`,{className:`oc-msg__source-pre`,children:e.resultText}):null]},n))})]}),t.parentText?(0,Y.jsxs)(`section`,{children:[(0,Y.jsx)(`h4`,{className:`oc-fbadmin__h`,children:w()}),(0,Y.jsx)(`pre`,{className:`oc-msg__source-pre`,children:t.parentText})]}):null,(0,Y.jsxs)(`section`,{children:[(0,Y.jsx)(`h4`,{className:`oc-fbadmin__h`,children:B()}),(0,Y.jsx)(`p`,{className:`oc-fbadmin__env`,children:[t.parentStatus?`status: ${t.parentStatus}`:null,t.parentErrorCode?`code: ${t.parentErrorCode}`:null,t.parentRunId?`run ${t.parentRunId.slice(0,12)}…`:null,e.correlationId?`corr ${e.correlationId.slice(0,16)}…`:null,t.openclawProvider].filter(Boolean).join(` · `)||`—`})]})]})}function te(){let e=H(C.subAgentReports.listForAdmin,{}),t=z(C.subAgentReports.readReport),n=z(C.subAgentReports.deleteReport),i=G(),[a,s]=(0,J.useState)(null),[c,l]=(0,J.useState)({});async function d(e){if(a===e._id){s(null);return}if(!c[e._id]){let n=await t({reportId:e._id});l(t=>({...t,[e._id]:n}))}s(e._id)}async function f(e){await i({title:o(),description:S(),confirmLabel:V(),destructive:!0})&&(await n({reportId:e._id}),a===e._id&&s(null))}return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(`p`,{className:`oc-admin__hint`,children:[L(),` `,(0,Y.jsx)(`strong`,{children:I()}),` `,R()]}),(0,Y.jsx)(q,{title:j(),rows:e,emptyHint:N(),isExpanded:e=>a===e._id&&!!c[e._id],renderExpanded:e=>c[e._id]?(0,Y.jsx)($,{data:c[e._id]}):null,columns:[{header:M(),cell:e=>K(e.at),sort:e=>e.at},{header:r(),cell:e=>Z(e.category),sort:e=>Z(e.category)},{header:b(),cell:e=>`${e.failedCount}/${e.totalCount}`,sort:e=>e.failedCount},{header:A(),cell:e=>(e.reporterEmail||e.reporterName||`—`)+(e.impersonated&&e.realOperatorEmail?` ${p({operator:e.realOperatorEmail})}`:``),sort:e=>e.reporterEmail||e.reporterName||null},{header:O(),cell:e=>e.hasComment?`✎`:`—`,sort:e=>+!!e.hasComment},{header:k(),cell:e=>e.answered?(0,Y.jsx)(`span`,{className:`oc-fbadmin__pill is-ok`,children:ee()}):(0,Y.jsx)(`span`,{className:`oc-fbadmin__pill`,children:m()}),sort:e=>+!!e.answered}],rowActions:e=>[{label:a===e._id?D():u(),onSelect:()=>void d(e)},{label:T(),onSelect:()=>void f(e),variant:`destructive`}]})]})}export{te as SubAgentReportsTab};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$j as r,Aj as i,Bj as a,CM as o,Cj as s,D as c,Dj as l,E as u,Ej as d,Fj as f,Gj as p,Hj as m,Ij as h,Jj as g,Kj as _,Lj as v,Mj as ee,Nj as te,Oj as ne,Pj as re,Qj as ie,Rj as ae,SM as oe,Sj as se,T as y,Tj as ce,Uj as le,Vj as ue,Wj as de,Xj as fe,Yj as pe,Zj as me,_M as he,_j as ge,_o as _e,aM as ve,aj as b,bM as ye,bj as be,bo as x,cF as xe,cM as Se,cj as Ce,dM as we,dj as Te,eM as Ee,fM as De,fj as Oe,gF as ke,gM as Ae,gj as je,hM as Me,hj as Ne,iM as Pe,ij as Fe,jj as Ie,kj as Le,lM as Re,lj as S,mM as ze,mj as Be,nM as Ve,nj as He,oF as Ue,oM as We,oj as Ge,pM as C,pj as Ke,qj as qe,rM as Je,rj as Ye,sF as Xe,sM as Ze,sj as Qe,tM as $e,tj as et,uM as tt,uj as nt,vF as w,vM as rt,vj as it,vo as at,wj as ot,xM as st,xj as ct,yF as T,yM as lt,yj as ut,yo as E,zj as dt}from"./dist-B1qnlN7I.js";import{n as D}from"./dist-Bw4s22TB.js";import{t as O}from"./x-8-3cz0V6.js";import{t as k}from"./button-BCAsV4-2.js";import{$ as A,C as j,Q as ft,S as M,T as N,Xt as pt,Yt as P,Z as mt,dt as ht,et as gt,ft as _t,gt as F,it as I,m as L,nt as vt,rt as R,tt as z,w as B,x as V}from"./index-rCasMjHB.js";import{t as yt}from"./localePickerView-C2RmOS86.js";import{a as bt,i as xt,n as St,o as Ct,r as wt,t as Tt}from"./card-BwAm8Ufs.js";import{a as Et,i as H,n as Dt,o as U,r as W,t as Ot}from"./table-DckOsZQY.js";import{t as kt}from"./TimeRangePicker-fvvxJ7HC.js";import{t as At}from"./FilterBar-UyunwEZF.js";import{t as jt}from"./AdvancedFilter-B6eiX7Zx.js";var G=c(`upload`,[[`path`,{d:`M12 3v12`,key:`1x0j5s`}],[`path`,{d:`m17 8-5-5-5 5`,key:`7q97r8`}],[`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`,key:`ih7n3h`}]]),K=t(e(),1),Mt=.1,Nt=[248,248,248],Pt=[24,24,24];function Ft(e,t,n){let r=t,i=n,a=-1,o=-1;for(let s=0;s<n;s++)for(let n=0;n<t;n++)e[(s*t+n)*4+3]>8&&(n<r&&(r=n),n>a&&(a=n),s<i&&(i=s),s>o&&(o=s));return a<0?null:{x:r,y:i,width:a-r+1,height:o-i+1}}function It(e,t,n){let r=t*n;if(r===0)return 0;let i=0;for(let t=3;t<e.length;t+=4)e[t]<=8&&i++;return i/r}function q(e,t,n){return It(e,t,n)>=Mt}function Lt(e,t){for(let n=0;n<e.length;n+=4)e[n]=t[0],e[n+1]=t[1],e[n+2]=t[2]}function Rt(e){for(let t=0;t<e.length;t+=4)e[t]=255-e[t],e[t+1]=255-e[t+1],e[t+2]=255-e[t+2]}var zt=12*1024*1024,Bt=480,Vt=160,Ht=.92;async function Ut(e,t={}){if(!e.type.startsWith(`image/`))throw Error(ot());if(e.size>zt)throw Error(s());let{source:n,width:r,height:i,cleanup:a}=await Wt(e);try{let a=e.type===`image/svg+xml`,o=Math.min(Bt/r,Vt/i,a?1/0:1),s=Math.max(1,Math.round(r*o)),c=Math.max(1,Math.round(i*o)),l=document.createElement(`canvas`);l.width=s,l.height=c;let u=l.getContext(`2d`);if(!u)throw Error(ct());u.imageSmoothingEnabled=!0,u.imageSmoothingQuality=`high`,u.drawImage(n,0,0,s,c);let d=Ft(u.getImageData(0,0,s,c).data,s,c)??{x:0,y:0,width:s,height:c},f=document.createElement(`canvas`);f.width=d.width,f.height=d.height;let p=f.getContext(`2d`);if(!p)throw Error(ct());if(p.drawImage(l,d.x,d.y,d.width,d.height,0,0,d.width,d.height),t.variantFor){let e=p.getImageData(0,0,d.width,d.height);q(e.data,d.width,d.height)?Lt(e.data,t.variantFor===`dark`?Nt:Pt):Rt(e.data),p.putImageData(e,0,0)}let m=q(p.getImageData(0,0,d.width,d.height).data,d.width,d.height),h=await Y(f,`image/webp`,Ht)??await Y(f,`image/png`);if(!h)throw Error(be());return{blob:h,hasAlpha:m}}finally{a()}}async function Wt(e){if(e.type===`image/svg+xml`)return J(e);if(typeof createImageBitmap==`function`)try{let t=await createImageBitmap(e);return{source:t,width:t.width,height:t.height,cleanup:()=>t.close()}}catch{}return J(e)}async function J(e){let t=URL.createObjectURL(e);try{let e=new Image;return e.decoding=`async`,await new Promise((n,r)=>{e.onload=()=>n(),e.onerror=()=>r(Error(se())),e.src=t}),{source:e,width:e.naturalWidth||300,height:e.naturalHeight||150,cleanup:()=>URL.revokeObjectURL(t)}}catch(e){throw URL.revokeObjectURL(t),e}}function Y(e,t,n){return new Promise(r=>e.toBlob(e=>r(e),t,n))}var X=n();function Gt(e,t){let n=e.trim().replace(/[^A-Za-z0-9_.-]+/g,`-`).replace(/^-+|-+$/g,``)||`chart`,r=new Blob([JSON.stringify(t,null,2)],{type:`application/json`}),i=URL.createObjectURL(r),a=document.createElement(`a`);a.href=i,a.download=`${n}.chart.json`,document.body.appendChild(a),a.click(),a.remove(),URL.revokeObjectURL(i)}var Z=`__all__`,Q={kind:`relative`,from:`now-24h`,to:`now`},Kt=[{value:`status`,label:`Statut`},{value:`latencyMs`,label:`Latence (ms)`},{value:`route`,label:`Route`},{value:`roleKey`,label:`Rôle`},{value:`correlationId`,label:`Corrélation`}];function $({title:e,description:t,children:n}){return(0,X.jsxs)(`section`,{className:`oc-show__section`,children:[(0,X.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,X.jsx)(`h2`,{className:`oc-show__title`,children:e}),t?(0,X.jsx)(`p`,{className:`oc-show__desc`,children:t}):null]}),(0,X.jsx)(`div`,{className:`oc-show__demo`,children:n})]})}function qt(e){return e===`light`?xe():e===`dark`?Xe():Ue()}var Jt=[`primary`,`secondary`,`accent`,`muted`,`chart-1`,`chart-2`];function Yt({tokens:e,mode:t}){let n=e.colors[t];return(0,X.jsx)(`div`,{className:`oc-chart-swatches`,"aria-hidden":!0,children:Jt.map(e=>{let t=n[e];return(0,X.jsx)(`span`,{className:`oc-chart-swatch`,style:t?{background:t}:void 0},e)})})}function Xt({selected:e,title:t,subtitle:n,tokens:r,mode:i,onSelect:a,onExport:o}){return(0,X.jsxs)(`div`,{className:`oc-chart-card-wrap`,children:[(0,X.jsxs)(`button`,{type:`button`,className:u(`oc-chart-card`,e&&`oc-chart-card--selected`),"aria-pressed":e,onClick:a,children:[(0,X.jsxs)(`div`,{className:`oc-chart-card__head`,children:[(0,X.jsx)(`span`,{className:`oc-chart-card__title`,children:t}),e?(0,X.jsx)(D,{className:`size-4 text-primary`,"aria-hidden":!0}):null]}),r?(0,X.jsx)(Yt,{tokens:r,mode:i}):(0,X.jsx)(`div`,{className:`oc-chart-swatches oc-chart-swatches--native`,"aria-hidden":!0}),(0,X.jsx)(`div`,{className:`oc-chart-card__meta`,children:(0,X.jsx)(`span`,{className:`oc-chart-card__subtitle`,children:n})})]}),o?(0,X.jsx)(k,{type:`button`,variant:`ghost`,size:`icon`,className:`oc-chart-card__export`,onClick:o,"aria-label":x(),title:x(),children:(0,X.jsx)(pt,{className:`size-4`})}):null]})}function Zt({selectedKey:e,resolvedMode:t}){let n=T(y.charts.listMyCharts),r=w(y.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:Me()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:ze()})]}),(0,X.jsxs)(`div`,{className:`oc-chart-grid`,children:[(0,X.jsx)(Xt,{selected:e===null,title:C(),subtitle:De(),tokens:null,mode:t,onSelect:()=>void i(null)}),(n??[]).map(n=>{let r=n.via===`common`?we():n.via===`owner`?tt():Re({group:n.via.group});return(0,X.jsx)(Xt,{selected:e===n.key,title:n.name,subtitle:r,tokens:n.tokens,mode:t,onSelect:()=>void i(n.key),onExport:()=>Gt(n.name,n.tokens)},n.key)})]}),n!==void 0&&n.length===0?(0,X.jsx)(`p`,{className:`oc-show__desc`,children:Se()}):null]})}function Qt(){let e=w(y.charts.importChart),[t,n]=(0,K.useState)(``),[r,i]=(0,K.useState)(``),[o,s]=(0,K.useState)(null),[c,l]=(0,K.useState)(!1),[u,d]=(0,K.useState)(!1);async function f(e){let t=e.target.files?.[0];if(e.target.value=``,t){s(null),l(!1);try{i(await t.text())}catch{s(a())}}}async function h(){if(s(null),l(!1),t.trim()===``){s(ae());return}let o;try{o=JSON.parse(r)}catch{s(a());return}d(!0);try{await e({name:t.trim(),tokens:o}),l(!0),n(``),i(``)}catch(e){s(e instanceof Error?e.message:String(e))}finally{d(!1)}}return(0,X.jsxs)(`section`,{className:`oc-show__section`,children:[(0,X.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,X.jsx)(`h2`,{className:`oc-show__title`,children:g()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:qe()})]}),(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:_()}),(0,X.jsx)(I,{value:t,onChange:e=>n(e.target.value),placeholder:p(),maxLength:60})]}),(0,X.jsxs)(`label`,{className:`oc-chart-import__field`,children:[(0,X.jsx)(`span`,{className:`oc-chart-import__label`,children:de()}),(0,X.jsx)(`textarea`,{className:`oc-chart-import__textarea`,value:r,onChange:e=>i(e.target.value),placeholder:le(),rows:8,spellCheck:!1})]}),(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsx)(k,{variant:`outline`,size:`sm`,asChild:!0,children:(0,X.jsxs)(`label`,{className:`oc-chart-import__file`,children:[(0,X.jsx)(G,{className:`size-4`}),m(),(0,X.jsx)(`input`,{type:`file`,accept:`application/json,.json`,className:`oc-chart-import__file-input`,onChange:e=>void f(e)})]})}),(0,X.jsx)(k,{size:`sm`,disabled:u,onClick:()=>void h(),children:ue()})]}),o?(0,X.jsx)(`p`,{className:`oc-chart-import__error`,children:o}):null,c?(0,X.jsx)(`p`,{className:`oc-chart-import__ok`,children:dt()}):null]})]})}function $t({chart:e}){let t=ke(y.charts.setChartLogo),n=w(y.charts.removeChartLogo),[r,a]=(0,K.useState)(!1),[o,s]=(0,K.useState)(null),c=t=>t===`light`?e.logoLightUrl:e.logoDarkUrl;async function u(n,r,i){if(e.chartId!==void 0){s(null),a(!0);try{let{blob:a,hasAlpha:o}=await Ut(r,i?{variantFor:i}:{}),s=await a.arrayBuffer();await t({chartId:e.chartId,bytes:s,mode:n,hasAlpha:o})}catch(e){s(e instanceof Error?e.message:String(e))}finally{a(!1)}}}async function f(e,t){let n=t.target.files?.[0];t.target.value=``,n&&await u(e,n)}async function p(t){if(e.chartId!==void 0){s(null),a(!0);try{await n({chartId:e.chartId,mode:t})}catch(e){s(e instanceof Error?e.message:String(e))}finally{a(!1)}}}async function m(e){let t=c(e===`light`?`dark`:`light`);if(t){s(null),a(!0);try{await u(e,await(await fetch(t)).blob(),e)}catch(e){s(e instanceof Error?e.message:String(e))}finally{a(!1)}}}function h({mode:e}){let t=c(e),n=c(e===`light`?`dark`:`light`);return(0,X.jsxs)(`div`,{className:`oc-chart-mine__logo-slot`,children:[(0,X.jsx)(`span`,{className:`oc-chart-mine__logo-mode`,children:e===`light`?Ie():i()}),(0,X.jsx)(`span`,{className:`oc-chart-mine__logo-preview`,"data-mode":e,"data-empty":t?void 0:`1`,children:t?(0,X.jsx)(`img`,{src:t,alt:``}):null}),(0,X.jsx)(k,{variant:`outline`,size:`sm`,asChild:!0,children:(0,X.jsxs)(`label`,{className:`oc-chart-import__file`,children:[(0,X.jsx)(G,{className:`size-4`}),t?ne():Le(),(0,X.jsx)(`input`,{type:`file`,accept:`image/*`,className:`oc-chart-import__file-input`,onChange:t=>void f(e,t)})]})}),!t&&n?(0,X.jsx)(k,{variant:`ghost`,size:`sm`,disabled:r,onClick:()=>void m(e),children:d()}):null,t?(0,X.jsx)(k,{variant:`ghost`,size:`sm`,disabled:r,onClick:()=>void p(e),children:l()}):null]})}return(0,X.jsxs)(`div`,{className:`oc-chart-mine__logo`,children:[(0,X.jsx)(`span`,{className:`oc-chart-mine__groups-label`,children:ee()}),(0,X.jsxs)(`div`,{className:`oc-chart-mine__logo-slots`,children:[(0,X.jsx)(h,{mode:`light`}),(0,X.jsx)(h,{mode:`dark`})]}),r?(0,X.jsx)(`span`,{className:`oc-show__desc`,children:ce()}):null,o?(0,X.jsx)(`p`,{className:`oc-chart-import__error`,children:o}):null]})}function en({chart:e}){let t=T(y.me.getMe,{host:F}),n=w(y.charts.addChartDomain),r=w(y.charts.removeChartDomain),[i,a]=(0,K.useState)(``),[o,s]=(0,K.useState)(null),[c,l]=(0,K.useState)(!1);if(t?.role!==`admin`)return null;let u=e.domains??[];async function d(){let t=i.trim();if(t!==``){s(null),l(!0);try{await n({chartKey:e.key,domain:t}),a(``)}catch(e){s(e instanceof Error?e.message:String(e))}finally{l(!1)}}}async function f(t){s(null);try{await r({chartKey:e.key,domain:t})}catch{}}return(0,X.jsxs)(`div`,{className:`oc-chart-mine__domains`,children:[(0,X.jsx)(`span`,{className:`oc-chart-mine__groups-label`,children:ut()}),(0,X.jsxs)(`div`,{className:`oc-chart-mine__domains-body`,children:[(0,X.jsx)(`div`,{className:`oc-chart-avail__groups`,children:u.length===0?(0,X.jsx)(`span`,{className:`oc-show__desc`,children:Ne()}):u.map(e=>(0,X.jsxs)(R,{variant:`secondary`,className:`oc-chart-avail__chip`,children:[e,(0,X.jsx)(`button`,{type:`button`,className:`oc-chart-avail__chip-x`,"aria-label":Be({domain:e}),onClick:()=>void f(e),children:(0,X.jsx)(O,{className:`size-3`})})]},e))}),(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsx)(I,{value:i,onChange:e=>a(e.target.value),placeholder:ge(),className:`oc-chart-mine__domains-input`,onKeyDown:e=>{e.key===`Enter`&&d()}}),(0,X.jsx)(k,{variant:`outline`,size:`sm`,disabled:c,onClick:()=>void d(),children:je()})]}),(0,X.jsx)(`span`,{className:`oc-show__desc`,children:it()}),o?(0,X.jsx)(`p`,{className:`oc-chart-import__error`,children:o}):null]})]})}function tn(e){let t={...e};return delete t.bpm,JSON.stringify(t,null,2)}function nn({chart:e}){let t=w(y.charts.updateChart),n=w(y.charts.deleteChart),[r,i]=(0,K.useState)(!1),[o,s]=(0,K.useState)(e.name),[c,l]=(0,K.useState)(()=>tn(e.tokens)),[u,d]=(0,K.useState)(e.tokens.bpm??0),[f,p]=(0,K.useState)(null),[m,h]=(0,K.useState)(!1);function g(){s(e.name),l(tn(e.tokens)),d(e.tokens.bpm??0),p(null),i(!0)}async function _(){if(e.chartId===void 0)return;p(null);let n;try{n=JSON.parse(c)}catch{p(a());return}if(n&&typeof n==`object`&&!Array.isArray(n)){let e=n;u>0?e.bpm=u:delete e.bpm}h(!0);try{await t({chartId:e.chartId,name:o.trim(),tokens:n}),i(!1)}catch(e){p(e instanceof Error?e.message:String(e))}finally{h(!1)}}async function v(){if(e.chartId!==void 0&&window.confirm(S()))try{await n({chartId:e.chartId})}catch{}}return(0,X.jsxs)(`div`,{className:`oc-chart-mine__row`,children:[(0,X.jsxs)(`div`,{className:`oc-chart-mine__head`,children:[(0,X.jsx)(`span`,{className:`oc-chart-mine__name`,children:e.name}),(0,X.jsx)(`div`,{className:`oc-show__row`,children:r?null:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(k,{variant:`outline`,size:`sm`,onClick:g,children:re()}),(0,X.jsx)(k,{variant:`ghost`,size:`sm`,onClick:()=>void v(),children:te()})]})})]}),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:Te()}),(0,X.jsx)(I,{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:E()}),(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":E()}),(0,X.jsx)(`span`,{className:`oc-chart-bpm__value`,children:u===0?at():`${u} BPM`})]}),(0,X.jsx)(`span`,{className:`oc-show__desc`,children:_e()})]}),(0,X.jsxs)(`label`,{className:`oc-chart-import__field`,children:[(0,X.jsx)(`span`,{className:`oc-chart-import__label`,children:nt()}),(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)(k,{size:`sm`,disabled:m,onClick:()=>void _(),children:Ke()}),(0,X.jsx)(k,{variant:`ghost`,size:`sm`,onClick:()=>i(!1),children:Oe()})]})]}):null,(0,X.jsx)($t,{chart:e}),(0,X.jsx)(en,{chart:e})]})}function rn(){let e=T(y.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:v()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:h()})]}),e!==void 0&&t.length===0?(0,X.jsx)(`p`,{className:`oc-show__desc`,children:f()}):(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=w(y.charts.addChartToGroupPool),i=w(y.charts.removeChartFromGroupPool),a=e.restrictedToGroups,o=e.poolGroups,s=new Set((o??[]).map(e=>e.groupId)),c=t.filter(e=>!s.has(e._id));async function l(t){try{await n({groupId:t,chartKey:e.key})}catch{}}async function u(t){try{await i({groupId:t,chartKey:e.key})}catch{}}return(0,X.jsxs)(`div`,{className:`oc-chart-avail`,children:[(0,X.jsxs)(`div`,{className:`oc-chart-avail__head`,children:[(0,X.jsx)(`span`,{className:`oc-chart-avail__name`,children:e.name}),(0,X.jsx)(R,{variant:a?`secondary`:`outline`,className:`oc-chart-avail__state`,children:a?Ee():e.kind===`custom`&&e.scope===`personal`?b():$e()}),e.isGlobalDefault?(0,X.jsx)(R,{variant:`default`,children:r()}):null]}),(0,X.jsxs)(`div`,{className:`oc-chart-avail__groups`,children:[(0,X.jsx)(`span`,{className:`oc-chart-mine__groups-label`,children:me()}),(o??[]).map(e=>(0,X.jsxs)(R,{variant:`secondary`,className:`oc-chart-avail__chip`,children:[e.name,(0,X.jsx)(`button`,{type:`button`,className:`oc-chart-avail__chip-x`,"aria-label":pe({group:e.name}),onClick:()=>void u(e.groupId),children:(0,X.jsx)(O,{className:`size-3`})})]},e.groupId)),c.length>0?(0,X.jsxs)(V,{value:``,onValueChange:e=>void l(e),children:[(0,X.jsx)(B,{size:`sm`,className:`w-56`,children:(0,X.jsx)(N,{placeholder:fe()})}),(0,X.jsx)(M,{children:c.map(e=>(0,X.jsx)(j,{value:e._id,children:e.name},e._id))})]}):t.length===0?(0,X.jsx)(`span`,{className:`oc-show__desc`,children:ie()}):null]})]})}function on({chart:e}){let t=w(y.charts.promoteChartToCommon),n=w(y.charts.deleteChart);async function r(){if(e.chartId!==void 0)try{await t({chartId:e.chartId})}catch{}}async function i(){if(e.chartId!==void 0&&window.confirm(S()))try{await n({chartId:e.chartId})}catch{}}return(0,X.jsxs)(`div`,{className:`oc-chart-avail`,children:[(0,X.jsxs)(`div`,{className:`oc-chart-avail__head`,children:[(0,X.jsx)(`span`,{className:`oc-chart-avail__name`,children:e.name}),(0,X.jsx)(R,{variant:e.scope===`common`?`outline`:`secondary`,children:e.scope===`common`?Fe():b()}),e.ownerLabel?(0,X.jsx)(`span`,{className:`oc-show__desc`,children:Ge({owner:e.ownerLabel})}):null]}),(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[e.scope===`personal`?(0,X.jsx)(k,{variant:`outline`,size:`sm`,onClick:()=>void r(),children:Ye()}):null,(0,X.jsx)(k,{variant:`ghost`,size:`sm`,onClick:()=>void i(),children:He()})]})]})}function sn({defaultThemeMode:e,defaultLocale:t,defaultChartKey:n}){let r=w(y.admin.setDefaultThemeMode),i=w(y.admin.setDefaultLocale),a=w(y.charts.setDefaultChart),s=T(y.charts.listChartsAdmin),c=T(y.groups.listGroups,{}),l=e??`system`,u=t??`fr`;return(0,X.jsxs)(`div`,{className:`oc-appearance-admin`,children:[(0,X.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,X.jsx)(`h2`,{className:`oc-show__title`,children:he()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:Ae()})]}),(0,X.jsxs)(`section`,{className:`oc-show__section`,children:[(0,X.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,X.jsx)(`h3`,{className:`oc-show__title`,children:Ze()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:We()})]}),(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsx)(k,{variant:n===null?`default`:`outline`,size:`sm`,onClick:()=>void a({name:null}),children:C()}),_t.map(e=>(0,X.jsx)(k,{variant:n===e.key?`default`:`outline`,size:`sm`,onClick:()=>void a({name:e.key}),children:e.name},e.key)),(s??[]).filter(e=>e.kind===`custom`&&e.scope===`common`).map(e=>(0,X.jsx)(k,{variant:n===e.key?`default`:`outline`,size:`sm`,onClick:()=>void a({name:e.key}),children:e.name},e.key))]})]}),(0,X.jsxs)(`section`,{className:`oc-show__section`,children:[(0,X.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,X.jsx)(`h3`,{className:`oc-show__title`,children:ve()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:Pe()})]}),(0,X.jsx)(`div`,{className:`oc-chart-avail-list`,children:(s??[]).filter(e=>!(e.kind===`custom`&&e.scope===`common`)).map(e=>(0,X.jsx)(an,{chart:e,groups:c??[]},e.key))})]}),(0,X.jsxs)(`section`,{className:`oc-show__section`,children:[(0,X.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,X.jsx)(`h3`,{className:`oc-show__title`,children:Je()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:Ve()})]}),(0,X.jsx)(`div`,{className:`oc-chart-avail-list`,children:(s??[]).filter(e=>e.kind===`builtin`||e.scope===`common`).map(e=>(0,X.jsxs)(`div`,{className:`oc-chart-avail`,children:[(0,X.jsx)(`div`,{className:`oc-chart-avail__head`,children:(0,X.jsx)(`span`,{className:`oc-chart-avail__name`,children:e.name})}),(0,X.jsx)(en,{chart:e})]},e.key))})]}),(0,X.jsxs)(`section`,{className:`oc-show__section`,children:[(0,X.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,X.jsx)(`h3`,{className:`oc-show__title`,children:Ce()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:Qe()})]}),(()=>{let e=(s??[]).filter(e=>e.kind===`custom`);return e.length===0?(0,X.jsx)(`p`,{className:`oc-show__desc`,children:et()}):(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:o()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:oe()})]}),(0,X.jsx)(`div`,{className:`oc-show__row`,children:[`light`,`dark`,`system`].map(e=>(0,X.jsx)(k,{variant:l===e?`default`:`outline`,size:`sm`,onClick:()=>void r({mode:e}),children:qt(e)},e))})]}),(0,X.jsxs)(`section`,{className:`oc-show__section`,children:[(0,X.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,X.jsx)(`h3`,{className:`oc-show__title`,children:st()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:ye()})]}),(0,X.jsx)(`div`,{className:`oc-show__row`,children:yt().map(e=>(0,X.jsx)(k,{variant:u===e.value?`default`:`outline`,size:`sm`,onClick:()=>void i({locale:e.value}),children:e.label},e.value))}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:lt()})]})]})}function cn(){let e=T(y.me.getMe,{host:F}),t=ht(e?.resolvedThemeMode);return(0,X.jsxs)(`div`,{className:`oc-appearance`,children:[(0,X.jsx)(Zt,{selectedKey:e?.chartKey??null,resolvedMode:t}),(0,X.jsx)(Qt,{}),(0,X.jsx)(rn,{}),e?.role===`admin`?(0,X.jsx)(sn,{defaultThemeMode:e.defaultThemeMode,defaultLocale:e.defaultLocale,defaultChartKey:e.defaultChartKey}):null]})}function ln(){let[e,t]=(0,K.useState)(!0),[n,r]=(0,K.useState)(`per-user`),[i,a]=(0,K.useState)(``),[o,s]=(0,K.useState)(Z),[c,l]=(0,K.useState)(Z),[u,d]=(0,K.useState)(Q),f=i!==``||o!==Z||c!==Z;function p(){a(``),s(Z),l(Z),d(Q)}return(0,X.jsxs)(`div`,{className:`oc-show`,children:[(0,X.jsx)(cn,{}),(0,X.jsxs)(`details`,{className:`oc-show__ref`,children:[(0,X.jsx)(`summary`,{className:`oc-show__title`,children:rt()}),(0,X.jsxs)($,{title:`Buttons`,description:`Variants`,children:[(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsx)(k,{children:`Default`}),(0,X.jsx)(k,{variant:`secondary`,children:`Secondary`}),(0,X.jsx)(k,{variant:`outline`,children:`Outline`}),(0,X.jsx)(k,{variant:`ghost`,children:`Ghost`}),(0,X.jsx)(k,{variant:`destructive`,children:`Destructive`}),(0,X.jsx)(k,{variant:`link`,children:`Link`})]}),(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsx)(k,{size:`sm`,children:`Small`}),(0,X.jsx)(k,{children:`Default`}),(0,X.jsx)(k,{size:`lg`,children:`Large`}),(0,X.jsx)(k,{size:`icon`,"aria-label":`more`,children:(0,X.jsx)(P,{})}),(0,X.jsx)(k,{disabled:!0,children:`Disabled`})]})]}),(0,X.jsx)($,{title:`Badges`,children:(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsx)(R,{children:`Default`}),(0,X.jsx)(R,{variant:`secondary`,children:`Secondary`}),(0,X.jsx)(R,{variant:`outline`,children:`Outline`}),(0,X.jsx)(R,{variant:`destructive`,children:`Destructive`})]})}),(0,X.jsx)($,{title:`Inputs & selection`,children:(0,X.jsxs)(`div`,{className:`oc-show__row oc-show__row--col`,children:[(0,X.jsx)(I,{placeholder:`Text input…`}),(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsxs)(V,{value:n,onValueChange:r,children:[(0,X.jsx)(B,{className:`w-56`,children:(0,X.jsx)(N,{placeholder:`Select…`})}),(0,X.jsxs)(M,{children:[(0,X.jsx)(j,{value:`per-user`,children:`per-user (chacun son agent)`}),(0,X.jsx)(j,{value:`shared`,children:`shared (agent commun)`})]})]}),(0,X.jsxs)(`label`,{className:`oc-show__check`,children:[(0,X.jsx)(L,{checked:e,onCheckedChange:e=>t(!!e)}),`Checkbox`]})]})]})}),(0,X.jsx)($,{title:`Filtres & plage temporelle`,description:`Barre réutilisable (recherche debouncée + selects rapides à largeur auto + plage façon Grafana) et constructeur de filtre avancé. Câblée dans Users, Groups, Comptes de service, Traces, Anomalies, Audit et KPI.`,children:(0,X.jsxs)(`div`,{className:`oc-show__row oc-show__row--col`,children:[(0,X.jsxs)(At,{q:i,onQChange:a,searchPlaceholder:`Rechercher (kind, principal, rôle, route…)`,timeRange:u,onTimeRangeChange:d,onReset:p,canReset:f,children:[(0,X.jsxs)(V,{value:o,onValueChange:s,children:[(0,X.jsx)(B,{size:`sm`,children:(0,X.jsx)(N,{})}),(0,X.jsxs)(M,{children:[(0,X.jsx)(j,{value:Z,children:`Toutes directions`}),(0,X.jsx)(j,{value:`inbound`,children:`inbound`}),(0,X.jsx)(j,{value:`outbound`,children:`outbound`}),(0,X.jsx)(j,{value:`internal`,children:`internal`})]})]}),(0,X.jsxs)(V,{value:c,onValueChange:l,children:[(0,X.jsx)(B,{size:`sm`,children:(0,X.jsx)(N,{})}),(0,X.jsxs)(M,{children:[(0,X.jsx)(j,{value:Z,children:`Toutes sévérités`}),(0,X.jsx)(j,{value:`info`,children:`info`}),(0,X.jsx)(j,{value:`warn`,children:`warn`}),(0,X.jsx)(j,{value:`critical`,children:`critical`})]})]})]}),(0,X.jsx)(jt,{fields:Kt,onChange:()=>{}}),(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsx)(`span`,{className:`oc-show__desc`,children:`Sélecteur de plage seul :`}),(0,X.jsx)(kt,{value:u,onChange:d})]})]})}),(0,X.jsx)($,{title:`Dropdown menu`,description:`Row actions / kebab`,children:(0,X.jsxs)(mt,{children:[(0,X.jsx)(vt,{asChild:!0,children:(0,X.jsx)(k,{variant:`outline`,size:`icon`,"aria-label":`Open menu`,children:(0,X.jsx)(P,{})})}),(0,X.jsxs)(ft,{align:`start`,children:[(0,X.jsx)(gt,{children:`Actions`}),(0,X.jsx)(z,{}),(0,X.jsx)(A,{children:`Edit`}),(0,X.jsx)(A,{children:`Duplicate`}),(0,X.jsx)(z,{}),(0,X.jsx)(A,{variant:`destructive`,children:`Delete`})]})]})}),(0,X.jsx)($,{title:`Card`,children:(0,X.jsxs)(Tt,{className:`w-80`,children:[(0,X.jsxs)(bt,{children:[(0,X.jsx)(Ct,{children:`Instance`}),(0,X.jsx)(wt,{children:`Non-secret metadata only.`})]}),(0,X.jsx)(St,{className:`text-sm text-muted-foreground`,children:`ws://gateway.example.org:18789`}),(0,X.jsxs)(xt,{className:`gap-2`,children:[(0,X.jsx)(k,{size:`sm`,children:`Save`}),(0,X.jsx)(k,{size:`sm`,variant:`ghost`,children:`Cancel`})]})]})}),(0,X.jsx)($,{title:`Table`,children:(0,X.jsxs)(Ot,{children:[(0,X.jsx)(Et,{children:(0,X.jsxs)(U,{children:[(0,X.jsx)(H,{className:`w-8`,children:(0,X.jsx)(L,{"aria-label":`select all`})}),(0,X.jsx)(H,{children:`Name`}),(0,X.jsx)(H,{children:`Mode`}),(0,X.jsx)(H,{className:`text-right`,children:`Status`}),(0,X.jsx)(H,{className:`w-8`})]})}),(0,X.jsx)(Dt,{children:[{n:`admins`,m:`per-user`,s:`active`},{n:`family`,m:`shared`,s:`active`}].map(e=>(0,X.jsxs)(U,{children:[(0,X.jsx)(W,{children:(0,X.jsx)(L,{"aria-label":`select ${e.n}`})}),(0,X.jsx)(W,{className:`font-medium`,children:e.n}),(0,X.jsx)(W,{children:(0,X.jsx)(R,{variant:`secondary`,children:e.m})}),(0,X.jsx)(W,{className:`text-right`,children:(0,X.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-muted-foreground`,children:[(0,X.jsx)(D,{className:`size-3.5`}),` `,e.s]})}),(0,X.jsx)(W,{children:(0,X.jsx)(k,{variant:`ghost`,size:`icon`,"aria-label":`row actions`,children:(0,X.jsx)(P,{})})})]},e.n))})]})}),(0,X.jsx)($,{title:`App fragments`,description:`Chat-specific components`,children:(0,X.jsxs)(`div`,{className:`oc-show__row oc-show__row--col`,children:[(0,X.jsx)(`div`,{className:`oc-msg oc-msg--assistant`,children:(0,X.jsx)(`div`,{className:`oc-msg__body`,children:`Assistant message bubble.`})}),(0,X.jsx)(`div`,{className:`oc-tool oc-tool--completed`,children:(0,X.jsxs)(`div`,{className:`oc-tool__header`,children:[(0,X.jsx)(`span`,{className:`oc-tool__icon`,children:`✓`}),(0,X.jsx)(`span`,{className:`oc-tool__name`,children:`write-file`}),(0,X.jsx)(`span`,{className:`oc-tool__phase`,children:`completed`})]})}),(0,X.jsxs)(`div`,{className:`oc-run-status oc-run-status--streaming`,children:[(0,X.jsx)(`span`,{className:`oc-run-status__dot`}),(0,X.jsx)(`span`,{className:`oc-run-status__label`,children:`Running`})]})]})})]})]})}export{ln as ThemeShowroom};
|