@lacneu/atrium 0.84.17 → 0.84.19
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-CoFRPa-e.js +1 -0
- package/dist/assets/{AdvancedFilter-DhMwg7nB.js → AdvancedFilter-CZnbykZe.js} +1 -1
- package/dist/assets/AgentFilesTab-Bcz9V6fH.js +3 -0
- package/dist/assets/AnomaliesTab-YUjA4XnE.js +1 -0
- package/dist/assets/AuditTab-Jes9HRNk.js +1 -0
- package/dist/assets/BridgeTab-CWbabhHl.js +1 -0
- package/dist/assets/ChatDefaultsTab-DT3gBozQ.js +1 -0
- package/dist/assets/{DataTableShell-C0MSDiic.js → DataTableShell-CDmo0isC.js} +1 -1
- package/dist/assets/{DetailChips-V2Qp_G9Y.js → DetailChips-Csi8ao-5.js} +1 -1
- package/dist/assets/FeedbacksTab-9go4R--0.js +1 -0
- package/dist/assets/{FieldLabel-CrPuHD7O.js → FieldLabel-4AzJbj-7.js} +1 -1
- package/dist/assets/FilesTab-CRGP9jbn.js +1 -0
- package/dist/assets/{FilterBar-Of8GWz2N.js → FilterBar-CK5Wsnof.js} +1 -1
- package/dist/assets/{GroupsTab-JG0ZRFjT.js → GroupsTab-HBoCEQWy.js} +1 -1
- package/dist/assets/InstancesTab-CMEb9hT6.js +1 -0
- package/dist/assets/IntegrationsTab-hlpMleFu.js +1 -0
- package/dist/assets/KpiTab-Dqb9g4zO.js +1 -0
- package/dist/assets/PreferencesTab-Bdlwezal.js +1 -0
- package/dist/assets/ProjectPage-DWMUaSn7.js +1 -0
- package/dist/assets/{PromptInjectionsTab-netn591W.js → PromptInjectionsTab-DAajt_Z1.js} +2 -2
- package/dist/assets/RolesTab-DHifxhw3.js +1 -0
- package/dist/assets/ScheduledTab-CeVs9uJe.js +1 -0
- package/dist/assets/ServiceAccountsTab-Bl7nm8Ph.js +1 -0
- package/dist/assets/{SubAgentReportsTab-Z3ozWsvu.js → SubAgentReportsTab-O1q9pZe2.js} +1 -1
- package/dist/assets/{ThemeShowroom-CJH5AUOa.js → ThemeShowroom-BSjPrQxB.js} +1 -1
- package/dist/assets/{TimeRangePicker-Cq_PGNzt.js → TimeRangePicker-DOkbYJPt.js} +1 -1
- package/dist/assets/{TimezoneCombobox-n6rUGOTZ.js → TimezoneCombobox-DeJ3e50i.js} +1 -1
- package/dist/assets/TracesTab-M7MbrfPE.js +1 -0
- package/dist/assets/UsersTab-DW6GasiH.js +1 -0
- package/dist/assets/VoiceTab-CLMSu_Kx.js +1 -0
- package/dist/assets/api-B1lq0pb-.js +44 -0
- package/dist/assets/{button-CTuIl1H-.js → button-Ds98Pj53.js} +1 -1
- package/dist/assets/{card-Bf8slN_1.js → card-C2GdBOIp.js} +1 -1
- package/dist/assets/chevrons-up-down-Du-SfIms.js +1 -0
- package/dist/assets/{compatView-DGV2AVAR.js → compatView-Dxc5HuRO.js} +1 -1
- package/dist/assets/{dispatchErrorInfo-ZyhGCDRg.js → dispatchErrorInfo-BGvs3mZA.js} +1 -1
- package/dist/assets/{dist-BA_3OmOa.js → dist-DaQlSKRt.js} +1 -1
- package/dist/assets/{dist-uRF7WBqM.js → dist-rn-1MvzJ.js} +1 -1
- package/dist/assets/{highlighted-body-OFNGDK62-PQt_lrzL.js → highlighted-body-OFNGDK62-CYEBDkYv.js} +1 -1
- package/dist/assets/index-DMM3fags.js +324 -0
- package/dist/assets/{list-CntaIhDp.js → list-DhABairq.js} +1 -1
- package/dist/assets/mermaid-GHXKKRXX-DDdByclK.js +1 -0
- package/dist/assets/{pdf-BpJ-W-U1.js → pdf-CNbyQJnG.js} +1 -1
- package/dist/assets/roleDescriptions-BV5RwGCx.js +1 -0
- package/dist/assets/{table-D0yilGWI.js → table-B15ESmxP.js} +1 -1
- package/dist/assets/{tabs-KQ0HdNTL.js → tabs-vdU2pkw5.js} +1 -1
- package/dist/assets/x-CHx4ismM.js +1 -0
- package/dist/index.html +6 -6
- package/package.json +1 -1
- package/dist/assets/AccessTab-DhFQZGzx.js +0 -1
- package/dist/assets/AgentFilesTab-4sCRfaeL.js +0 -3
- package/dist/assets/AnomaliesTab-DRPqd0B0.js +0 -1
- package/dist/assets/AuditTab-CoJzgU4A.js +0 -1
- package/dist/assets/BridgeTab-Cyq6ii7O.js +0 -1
- package/dist/assets/ChatDefaultsTab-ffTdOd77.js +0 -1
- package/dist/assets/FeedbacksTab-4P7NTQHQ.js +0 -1
- package/dist/assets/FilesTab-DhNYdwv6.js +0 -1
- package/dist/assets/InstancesTab-Z4FtEPKO.js +0 -1
- package/dist/assets/IntegrationsTab-Cwaeqx7m.js +0 -1
- package/dist/assets/KpiTab-CW4PL5Q2.js +0 -1
- package/dist/assets/PreferencesTab-CWPxzO4u.js +0 -1
- package/dist/assets/ProjectPage-DMyEKLjd.js +0 -1
- package/dist/assets/RolesTab-BEQu-Exi.js +0 -1
- package/dist/assets/ScheduledTab-DwU5L2Il.js +0 -1
- package/dist/assets/ServiceAccountsTab-CfyqKLAB.js +0 -1
- package/dist/assets/TracesTab-DNfS8ryM.js +0 -1
- package/dist/assets/UsersTab-B3TSVToM.js +0 -1
- package/dist/assets/VoiceTab-DiKi0oXO.js +0 -1
- package/dist/assets/api-DRlXTl06.js +0 -44
- package/dist/assets/chevrons-up-down-BCCw67LL.js +0 -1
- package/dist/assets/index-D48cFy6f.js +0 -324
- package/dist/assets/mermaid-GHXKKRXX-CiGFgQis.js +0 -1
- package/dist/assets/roleDescriptions-CoFSIkRg.js +0 -1
- package/dist/assets/x-BM-3QiyY.js +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{ST as e,bT as t,vT as n,xT as r,yT as i}from"./api-B1lq0pb-.js";var a={pending:e,user:r,admin:t,observer:i,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{r as n}from"./api-
|
|
1
|
+
import{a as e,r as t}from"./bundle-mjs-C73ZY4La.js";import{r as n}from"./api-B1lq0pb-.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{b as r,d as i,f as a,g as o,n as s,p as c,r as l,y as u}from"./api-
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{b as r,d as i,f as a,g as o,n as s,p as c,r as l,y as u}from"./api-B1lq0pb-.js";import{Gt as d,Jt as f,Kt as p,qt as m}from"./index-DMM3fags.js";var h=t(e(),1),g=n(),_=`Tabs`,[v,y]=o(_,[m]),b=m(),[x,S]=v(_),C=h.forwardRef((e,t)=>{let{__scopeTabs:n,value:a,onValueChange:o,defaultValue:s,orientation:l=`horizontal`,dir:u,activationMode:d=`automatic`,...p}=e,m=f(u),[h,v]=c({prop:a,onChange:o,defaultProp:s??``,caller:_});return(0,g.jsx)(x,{scope:n,baseId:i(),value:h,onValueChange:v,orientation:l,dir:m,activationMode:d,children:(0,g.jsx)(r.div,{dir:m,"data-orientation":l,...p,ref:t})})});C.displayName=_;var w=`TabsList`,T=h.forwardRef((e,t)=>{let{__scopeTabs:n,loop:i=!0,...a}=e,o=S(w,n),s=b(n);return(0,g.jsx)(p,{asChild:!0,...s,orientation:o.orientation,dir:o.dir,loop:i,children:(0,g.jsx)(r.div,{role:`tablist`,"aria-orientation":o.orientation,...a,ref:t})})});T.displayName=w;var E=`TabsTrigger`,D=h.forwardRef((e,t)=>{let{__scopeTabs:n,value:i,disabled:a=!1,...o}=e,s=S(E,n),c=b(n),l=A(s.baseId,i),f=j(s.baseId,i),p=i===s.value;return(0,g.jsx)(d,{asChild:!0,...c,focusable:!a,active:p,children:(0,g.jsx)(r.button,{type:`button`,role:`tab`,"aria-selected":p,"aria-controls":f,"data-state":p?`active`:`inactive`,"data-disabled":a?``:void 0,disabled:a,id:l,...o,ref:t,onMouseDown:u(e.onMouseDown,e=>{!a&&e.button===0&&e.ctrlKey===!1?s.onValueChange(i):e.preventDefault()}),onKeyDown:u(e.onKeyDown,e=>{[` `,`Enter`].includes(e.key)&&s.onValueChange(i)}),onFocus:u(e.onFocus,()=>{let e=s.activationMode!==`manual`;!p&&!a&&e&&s.onValueChange(i)})})})});D.displayName=E;var O=`TabsContent`,k=h.forwardRef((e,t)=>{let{__scopeTabs:n,value:i,forceMount:o,children:s,...c}=e,l=S(O,n),u=A(l.baseId,i),d=j(l.baseId,i),f=i===l.value,p=h.useRef(f);return h.useEffect(()=>{let e=requestAnimationFrame(()=>p.current=!1);return()=>cancelAnimationFrame(e)},[]),(0,g.jsx)(a,{present:o||f,children:({present:n})=>(0,g.jsx)(r.div,{"data-state":f?`active`:`inactive`,"data-orientation":l.orientation,role:`tabpanel`,"aria-labelledby":u,hidden:!n,id:d,tabIndex:0,...c,ref:t,style:{...e.style,animationDuration:p.current?`0s`:void 0},children:n&&s})})});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:l(`group/tabs flex gap-2 data-horizontal:flex-col`,e),...n})}var L=s(`group/tabs-list inline-flex w-fit items-center justify-center rounded-lg p-[3px] text-muted-foreground group-data-horizontal/tabs:h-8 group-data-vertical/tabs:h-fit group-data-vertical/tabs:flex-col data-[variant=line]:rounded-none`,{variants:{variant:{default:`bg-muted`,line:`gap-1 bg-transparent`}},defaultVariants:{variant:`default`}});function R({className:e,variant:t=`default`,...n}){return(0,g.jsx)(N,{"data-slot":`tabs-list`,"data-variant":t,className:l(L({variant:t}),e),...n})}function z({className:e,...t}){return(0,g.jsx)(P,{"data-slot":`tabs-trigger`,className:l(`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:l(`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"./api-B1lq0pb-.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,13 +62,13 @@
|
|
|
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-DMM3fags.js"></script>
|
|
66
66
|
<link rel="modulepreload" crossorigin href="/assets/bundle-mjs-C73ZY4La.js">
|
|
67
|
-
<link rel="modulepreload" crossorigin href="/assets/api-
|
|
68
|
-
<link rel="modulepreload" crossorigin href="/assets/dist-
|
|
69
|
-
<link rel="modulepreload" crossorigin href="/assets/dist-
|
|
70
|
-
<link rel="modulepreload" crossorigin href="/assets/x-
|
|
71
|
-
<link rel="modulepreload" crossorigin href="/assets/button-
|
|
67
|
+
<link rel="modulepreload" crossorigin href="/assets/api-B1lq0pb-.js">
|
|
68
|
+
<link rel="modulepreload" crossorigin href="/assets/dist-rn-1MvzJ.js">
|
|
69
|
+
<link rel="modulepreload" crossorigin href="/assets/dist-DaQlSKRt.js">
|
|
70
|
+
<link rel="modulepreload" crossorigin href="/assets/x-CHx4ismM.js">
|
|
71
|
+
<link rel="modulepreload" crossorigin href="/assets/button-Ds98Pj53.js">
|
|
72
72
|
<link rel="stylesheet" crossorigin href="/assets/index-9JURmeVM.css">
|
|
73
73
|
</head>
|
|
74
74
|
<body>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lacneu/atrium",
|
|
3
|
-
"version": "0.84.
|
|
3
|
+
"version": "0.84.19",
|
|
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{Am as r,Bm as i,Fm as a,Hm as o,Im as s,Lm as c,Mm as l,Nm as u,Pm as d,Rm as f,Um as p,Vm as m,Wm as h,ZB as g,jm as _,oV as v,t as y,zm as b}from"./api-DRlXTl06.js";import{$ as x,Et as S,Q as C,X as w,Z as T,et as E}from"./index-D48cFy6f.js";var D=t(e(),1);function O(e){return e===`user`?d():e===`all`?u():l({group:e.group})}function k(e){return e===`common`?_():e===`owner`?r():l({group:e.group})}var A=n();function j(e){return e.name||e.email||e.userId.slice(0,8)}function M(){let e=v(y.admin.listUsers,{}),[t,n]=(0,D.useState)(``),r=v(y.introspect.introspectUser,t?{userId:t}:`skip`);return(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:h()}),(0,A.jsxs)(w,{value:t,onValueChange:n,children:[(0,A.jsx)(x,{size:`sm`,"aria-label":p(),children:(0,A.jsx)(E,{placeholder:p()})}),(0,A.jsx)(T,{children:(e??[]).map(e=>(0,A.jsx)(C,{value:e.userId,children:j(e)},e._id))})]}),t===``?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:o()}):r===void 0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:g()}):(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:m()}),(0,A.jsxs)(`div`,{className:`oc-introspect__id`,children:[(0,A.jsx)(`strong`,{children:r.user.label}),(0,A.jsx)(S,{variant:`secondary`,children:r.role})]})]}),(0,A.jsxs)(`section`,{className:`oc-introspect__section`,children:[(0,A.jsx)(`h3`,{className:`oc-introspect__title`,children:i()}),r.groups.length===0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:s()}):(0,A.jsx)(`div`,{className:`oc-introspect__chips`,children:r.groups.map(e=>(0,A.jsx)(S,{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:b()}),r.agents.length===0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:s()}):(0,A.jsx)(`ul`,{className:`oc-introspect__list`,children:r.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)(S,{variant:`default`,children:a()}):null,(0,A.jsx)(S,{variant:`outline`,children:O(e.via)}),(0,A.jsx)(S,{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:f()}),r.charts.length===0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:s()}):(0,A.jsx)(`ul`,{className:`oc-introspect__list`,children:r.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)(S,{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:c()}),r.permissions.length===0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:s()}):(0,A.jsx)(`div`,{className:`oc-introspect__chips`,children:r.permissions.map(e=>(0,A.jsx)(S,{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{$B as r,$d as i,$o as a,Ao as o,Do as s,Eo as c,Jd as l,Jo as u,Oo as d,Qd as f,Qo as p,Sf as m,To as h,Xd as g,Xo as _,Yd as v,Yo as y,ZB as b,Zd as x,Zo as S,_f as C,aV as w,af as T,an as E,as as D,bf as O,cf as k,cp as A,cs as j,df as M,ds as N,ef as ee,es as P,ff as te,fs as F,gf as I,hf as ne,if as L,is as R,jo as z,ko as re,lf as B,ls as ie,mf as ae,nf as V,ns as oe,oV as H,of as se,op as ce,os as le,pf as ue,ps as de,qd as fe,qo as pe,rV as U,rf as me,rs as he,sf as ge,ss as _e,t as W,tN as ve,tf as ye,ts as be,uf as xe,us as Se,vf as Ce,xf as we,yf as Te}from"./api-DRlXTl06.js";import{t as G}from"./button-CTuIl1H-.js";import{$ as Ee,B as De,Ct as Oe,Dt as K,Et as ke,Q as Ae,St as je,Tt as Me,X as Ne,Z as Pe,at as Fe,bt as Ie,et as Le,nt as Re,ot as ze,q as Be,rt as Ve,tt as He,un as q,vt as Ue,wt as We,xt as Ge,yt as Ke}from"./index-D48cFy6f.js";import{n as qe,t as Je}from"./curation-CQksaIbm.js";import{a as Ye}from"./compatView-DGV2AVAR.js";/* empty css */var J=t(e(),1),Y=2e4,Xe=6e4;function Ze(e){return typeof e!=`number`||e<=0?0:Math.round(e/Y*100)}function Qe(e){return e<=0?0:Math.round(e/Xe*100)}function X(e,t){let n=(typeof e==`number`&&e>0?e:0)/1e3;return new Intl.NumberFormat(t,{minimumFractionDigits:1,maximumFractionDigits:1}).format(n)}function $e(e){return e.reduce((e,t)=>e+(typeof t.size==`number`&&t.size>0?t.size:0),0)}var Z=3;function et(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<Z&&a.push(e)):t>0&&(i+=t,o.length<Z&&o.push(e));return{added:r,removed:i,sampleAdded:a,sampleRemoved:o}}function tt(e){return(e instanceof Error?e.message:String(e)).includes(`DASHBOARD_NOT_DEPLOYED`)}function nt(e){return e instanceof Error?e.message.includes(`conflict:`):String(e).includes(`conflict:`)}var Q=n(),$=e=>`${e.instanceName}::${e.agentId}`;function rt(){let e=H(W.me.getMe,{host:Be}),t=e?.role===`admin`,n=(e?.permissions??[]).includes(`bridge.read`),i=H(W.admin.listInstances,e!==void 0&&t?{}:`skip`),[a,o]=(0,J.useState)(null);(0,J.useEffect)(()=>{!t||!i||i.length===0||(!a||!i.some(e=>e.name===a))&&o(i[0].name)},[t,i,a]);let s=H(W.agents.listAgentsForInstance,t&&a?{instanceName:a}:`skip`),c=H(W.agents.listMyAgents,e!==void 0&&!t?{}:`skip`),l=(0,J.useMemo)(()=>{if(e!==void 0){if(t)return a===null||s===void 0?i!==void 0&&i.length===0?[]:void 0:s.agents.map(e=>({instanceName:a,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,a,s,i,c]),[u,d]=(0,J.useState)(null);(0,J.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(W.agentFiles.listAgentFiles),[h,g]=(0,J.useState)({status:`idle`}),_=f?.instanceName??null,v=f?.agentId??null,y=H(W.compat.forInstance,n&&_!==null?{instanceName:_}:`skip`),x=n&&_!==null?De(y,`agentFiles`):null,S=x===null?!1:x===`loading`?null:x.blocked,w=(0,J.useCallback)(async()=>{if(!(_===null||v===null)){g({status:`loading`});try{g({status:`done`,files:(await p({instanceName:_,agentId:v})).files})}catch(e){g({status:`error`,dashboardAbsent:tt(e)})}}},[p,_,v]);(0,J.useEffect)(()=>{S===!1&&w()},[w,S]);let[T,D]=(0,J.useState)(null),k=H(W.agentFileCuration.listCurations,t&&_!==null&&v!==null?{instanceName:_,agentId:v}:`skip`),A=H(W.agentFileCuration.curationSettings,t&&_!==null?{instanceName:_}:`skip`),N=U(W.agentFileCuration.requestCuration),[ee,P]=(0,J.useState)(null),[F,L]=(0,J.useState)(null),{toast:R}=K(),z=(0,J.useMemo)(()=>{let e=new Map;for(let t of k??[])e.has(t.name)||e.set(t.name,t);return e},[k]),re=(0,J.useCallback)(async e=>{if(!(_===null||v===null)){P(e);try{let t=await N({instanceName:_,agentId:v,name:e,trigger:`manual`});t.ok?R({title:Se(),variant:`success`}):R({title:ie({reason:t.reason??`unknown`}),variant:`error`})}catch{R({title:j(),variant:`error`})}finally{P(null)}}},[N,_,v,R]),B=r(),V=(0,J.useMemo)(()=>new Intl.NumberFormat(B,{maximumFractionDigits:0}),[B]);return e===void 0||l===void 0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:b()}):(0,Q.jsxs)(`div`,{className:`oc-afiles`,children:[(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:m()}),(0,Q.jsxs)(`div`,{className:`oc-afiles__picker`,children:[t&&(i?.length??0)>1?(0,Q.jsxs)(Ne,{value:a??``,onValueChange:e=>o(e),children:[(0,Q.jsx)(Ee,{size:`sm`,"aria-label":we(),children:(0,Q.jsx)(Le,{})}),(0,Q.jsx)(Pe,{children:(i??[]).map(e=>(0,Q.jsx)(Ae,{value:e.name,children:e.name},e.name))})]}):null,l.length>0?(0,Q.jsxs)(Ne,{value:u??``,onValueChange:e=>d(e),children:[(0,Q.jsx)(Ee,{size:`sm`,"aria-label":O(),children:(0,Q.jsx)(Le,{})}),(0,Q.jsx)(Pe,{children:l.map(e=>(0,Q.jsx)(Ae,{value:$(e),children:e.label},$(e)))})]}):(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:Te()})]}),f===null?null:x===`loading`?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:b()}):x!==null&&x.blocked?(0,Q.jsxs)(`p`,{className:`oc-compat__blocked`,role:`status`,children:[(0,Q.jsx)(q,{size:14,"aria-hidden":!0}),` `,Ye(x.gatewayVersion,x.provider)]}):h.status===`loading`||h.status===`idle`?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:b()}):h.status===`error`?(0,Q.jsxs)(`p`,{className:`oc-afiles__error`,role:`alert`,children:[h.dashboardAbsent?E():C(),` `,!h.dashboardAbsent&&(0,Q.jsx)(G,{variant:`outline`,size:`sm`,onClick:()=>void w(),children:ce()})]}):h.files.length===0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:Ce()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`div`,{className:`oc-afiles__list`,children:h.files.map(e=>{let n=Ze(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)(ke,{variant:`outline`,children:I()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`span`,{className:`oc-afiles__size`,children:ne({size:X(e.size,B)})}),(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:V.format(n)})}),r?(0,Q.jsx)(q,{size:14,className:`oc-afiles__warn`,"aria-label":ue()}):(0,Q.jsx)(`span`,{className:`oc-afiles__warn-slot`,"aria-hidden":!0})]}),(0,Q.jsx)(G,{variant:`outline`,size:`sm`,className:`oc-afiles__open`,onClick:()=>D(e),children:t?M():xe()}),t&&!e.missing?(0,Q.jsx)(it,{curatable:Je.includes(e.name),size:e.size??0,budget:A?.budgetChars??null,enabled:A?.enabled??!1,curation:z.get(e.name)??null,inFlight:ee===e.name,onCurate:()=>void re(e.name),onReview:e=>L(e)}):null]},e.name)})}),(0,Q.jsx)(`p`,{className:`oc-afiles__budget`,children:te({used:X($e(h.files),B),total:X(Xe,B),pct:V.format(Qe($e(h.files)))})})]}),T&&f?(0,Q.jsx)(at,{instanceName:f.instanceName,agentId:f.agentId,name:T.name,isAdmin:t,onClose:()=>D(null),onSaved:()=>void w()}):null,F?(0,Q.jsx)(ot,{curationId:F,onClose:()=>L(null),onApplied:()=>{L(null),w()}}):null]})}function it({curatable:e,size:t,budget:n,enabled:r,curation:i,inFlight:a,onCurate:o,onReview:s}){return i?.status===`proposed`?(0,Q.jsx)(G,{variant:`default`,size:`sm`,className:`oc-afiles__curate`,onClick:()=>s(i._id),children:F()}):a||i?.status===`dispatched`||i?.status===`applying`?(0,Q.jsx)(ke,{variant:`outline`,className:`oc-afiles__curate-status`,children:N()}):e&&r&&n!==null&&qe(t,n)?(0,Q.jsx)(G,{variant:`outline`,size:`sm`,className:`oc-afiles__curate`,onClick:o,children:de()}):null}function at({instanceName:e,agentId:t,name:n,isAdmin:a,onClose:o,onSaved:s}){let c=U(W.agentFiles.getAgentFile),u=U(W.agentFiles.setAgentFile),d=K(),[p,m]=(0,J.useState)(null),[h,_]=(0,J.useState)(!1),[y,S]=(0,J.useState)(``),[C,w]=(0,J.useState)(!1),[E,D]=(0,J.useState)(!1),[O,j]=(0,J.useState)(!1),[M,N]=(0,J.useState)(!1),P=(0,J.useCallback)(async r=>{_(!1);try{let i=await c({instanceName:e,agentId:t,name:n});m({content:i.content,updatedAtMs:i.updatedAtMs}),r||S(i.content),j(!1)}catch{_(!0)}},[c,e,t,n]);(0,J.useEffect)(()=>{P(!1)},[P]);async function te(){if(p!==null){D(!0),N(!1);try{await u({instanceName:e,agentId:t,name:n,content:y,baseUpdatedAtMs:p.updatedAtMs??void 0}),d.success(me({name:n})),s(),await P(!1)}catch(e){nt(e)?j(!0):N(!0)}finally{D(!1)}}}let F=p!==null&&y!==p.content,I=(0,J.useMemo)(()=>p===null?null:et(p.content,y),[p,y]),ne=y.length>Y,R=r(),z=(0,J.useMemo)(()=>new Intl.NumberFormat(R),[R]);return(0,Q.jsx)(He,{open:!0,onOpenChange:e=>!e&&o(),children:(0,Q.jsxs)(Re,{className:`oc-afiles__editor`,children:[(0,Q.jsxs)(Fe,{children:[(0,Q.jsx)(ze,{children:B({name:n})}),(0,Q.jsxs)(Ve,{children:[k({agent:t,instance:e}),a?null:(0,Q.jsxs)(Q.Fragment,{children:[` · `,ge()]})]})]}),h?(0,Q.jsxs)(`p`,{className:`oc-afiles__error`,role:`alert`,children:[ye(),` `,(0,Q.jsx)(G,{variant:`outline`,size:`sm`,onClick:()=>void P(!1),children:ce()})]}):p===null?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:b()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`textarea`,{className:`oc-afiles__source`,value:y,readOnly:!a,spellCheck:!1,onChange:e=>S(e.target.value),"aria-label":B({name:n})}),(0,Q.jsx)(`p`,{className:`oc-afiles__hint`,children:se()}),O?(0,Q.jsxs)(`p`,{className:`oc-afiles__error`,role:`alert`,children:[ee(),` `,(0,Q.jsx)(G,{variant:`outline`,size:`sm`,onClick:()=>void P(!0),children:i()})]}):null,M?(0,Q.jsx)(`p`,{className:`oc-afiles__error`,role:`alert`,children:V()}):null,(0,Q.jsxs)(`div`,{className:`oc-afiles__editor-foot`,children:[(0,Q.jsx)(`span`,{className:`oc-afiles__count${ne?` is-over`:``}`,children:T({count:z.format(y.length),max:z.format(Y)})}),a?(0,Q.jsx)(G,{size:`sm`,disabled:!F||E||O,onClick:()=>w(!0),children:E?A():L()}):null]})]}),(0,Q.jsx)(Ue,{open:C,onOpenChange:w,children:(0,Q.jsxs)(Ge,{children:[(0,Q.jsxs)(We,{children:[(0,Q.jsx)(Me,{children:f({name:n})}),(0,Q.jsx)(je,{children:x({agent:t})})]}),I?(0,Q.jsxs)(`div`,{className:`oc-afiles__diff`,children:[(0,Q.jsx)(`p`,{className:`oc-afiles__diff-counts`,children:g({added:I.added,removed:I.removed})}),I.sampleAdded.length>0?(0,Q.jsxs)(`div`,{className:`oc-afiles__diff-block`,children:[(0,Q.jsx)(`span`,{className:`oc-afiles__diff-label`,children:v()}),I.sampleAdded.map((e,t)=>(0,Q.jsx)(`code`,{className:`oc-afiles__diff-line is-add`,children:e||` `},t))]}):null,I.sampleRemoved.length>0?(0,Q.jsxs)(`div`,{className:`oc-afiles__diff-block`,children:[(0,Q.jsx)(`span`,{className:`oc-afiles__diff-label`,children:l()}),I.sampleRemoved.map((e,t)=>(0,Q.jsx)(`code`,{className:`oc-afiles__diff-line is-del`,children:e||` `},t))]}):null]}):null,(0,Q.jsxs)(Oe,{children:[(0,Q.jsx)(Ie,{children:ve()}),(0,Q.jsx)(Ke,{onClick:()=>void te(),children:fe()})]})]})})]})})}function ot({curationId:e,onClose:t,onApplied:n}){let i=H(W.agentFileCuration.getProposal,{curationId:e}),l=U(W.agentFileCuration.approveCuration),f=w(W.agentFileCuration.rejectCuration),{toast:m}=K(),[g,v]=(0,J.useState)(null),[x,C]=(0,J.useState)(!1),[T,E]=(0,J.useState)(``),O=r(),k=(0,J.useMemo)(()=>i?et(i.beforeContent,i.proposedContent):null,[i]);async function M(){v(`approve`);try{let t=await l({curationId:e});t.ok?(m({title:_e(),variant:`success`}),n()):m({title:t.reason===`conflict`?D():R({reason:t.reason??`unknown`}),variant:`error`})}catch{m({title:j(),variant:`error`})}finally{v(null)}}async function N(n){v(`reject`);try{let r=T.trim();(await f({curationId:e,...r?{comment:r}:{},relaunch:n})).ok?m({title:n?c():le(),variant:`success`}):m({title:be(),variant:`error`}),t()}catch{m({title:j(),variant:`error`})}finally{v(null)}}return(0,Q.jsx)(He,{open:!0,onOpenChange:e=>e?void 0:t(),children:(0,Q.jsxs)(Re,{className:`oc-afiles__review`,children:[(0,Q.jsxs)(Fe,{children:[(0,Q.jsx)(ze,{children:i?he({name:i.name}):b()}),(0,Q.jsx)(Ve,{children:oe()})]}),i===void 0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:b()}):i===null?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:be()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`p`,{className:`oc-afiles__review-sizes`,children:[P({before:X(i.beforeSize,O),after:X(i.proposedSize,O)}),i.overBudget?(0,Q.jsxs)(Q.Fragment,{children:[` `,(0,Q.jsx)(q,{size:13,"aria-hidden":!0}),` `,a()]}):null]}),k?(0,Q.jsx)(`p`,{className:`oc-afiles__review-diff`,children:p({added:k.added,removed:k.removed})}):null,i.feedback?(0,Q.jsx)(`p`,{className:`oc-afiles__review-feedback`,children:h({feedback:i.feedback})}):null,k&&k.sampleRemoved.length>0?(0,Q.jsxs)(`div`,{className:`oc-afiles__review-removed`,children:[(0,Q.jsx)(`p`,{className:`oc-afiles__review-label`,children:pe()}),(0,Q.jsx)(`ul`,{children:k.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:u()}),(0,Q.jsx)(`pre`,{className:`oc-afiles__review-pre`,children:i.beforeContent})]}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`p`,{className:`oc-afiles__review-label`,children:S()}),(0,Q.jsx)(`pre`,{className:`oc-afiles__review-pre`,children:i.proposedContent})]})]})]}),x?(0,Q.jsxs)(`div`,{className:`oc-afiles__reject-form`,children:[(0,Q.jsx)(`label`,{className:`oc-afiles__review-label`,htmlFor:`curation-reject-comment`,children:z()}),(0,Q.jsx)(`textarea`,{id:`curation-reject-comment`,className:`oc-afiles__reject-textarea`,rows:3,placeholder:o(),value:T,onChange:e=>E(e.target.value)}),(0,Q.jsxs)(`div`,{className:`oc-afiles__review-actions`,children:[(0,Q.jsx)(G,{variant:`ghost`,onClick:()=>C(!1),disabled:g!==null,children:re()}),(0,Q.jsx)(G,{variant:`outline`,onClick:()=>void N(!1),disabled:g!==null,children:g===`reject`?A():d()}),(0,Q.jsx)(G,{variant:`default`,onClick:()=>void N(!0),disabled:g!==null,children:g===`reject`?A():s()})]})]}):(0,Q.jsxs)(`div`,{className:`oc-afiles__review-actions`,children:[(0,Q.jsx)(G,{variant:`outline`,onClick:()=>C(!0),disabled:g!==null||i==null,children:_()}),(0,Q.jsx)(G,{variant:`default`,onClick:()=>void M(),disabled:g!==null||i==null,children:g===`approve`?A():y()})]})]})})}export{rt as AgentFilesTab};
|
|
@@ -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 ee,Cw as a,Dw as te,Ew as ne,Fw as re,Gw as ie,Hw as o,Iw as s,Jw as c,Kw as ae,Lw as oe,Mw as se,Nw as l,Ow as ce,Pw as le,Qw as ue,Rw as u,Sw as de,Tw as fe,Uw as pe,Vw as me,Ww as he,Xw as ge,Yw as _e,Zw as ve,_w as d,aT as f,aV as p,bw as m,eT as ye,fw as h,gw as g,hw as _,iT as be,jw as v,kw as xe,mw as y,nT as Se,oT as b,oV as x,pw as S,qw as C,rT as w,sT as T,t as E,tT as D,vw as O,ww as k,xw as A,yw as j,zw as Ce}from"./api-DRlXTl06.js";import{$ as M,Dt as we,Et as N,Gn as P,Kn as Te,Q as F,U as Ee,X as I,Z as L,at as R,ct as z,et as B,i as De,nt as V,o as H,ot as U,q as Oe,tt as W}from"./index-D48cFy6f.js";import{n as ke}from"./TimeRangePicker-Cq_PGNzt.js";import{t as Ae}from"./FilterBar-Of8GWz2N.js";import{t as je}from"./DataTableShell-C0MSDiic.js";import{t as G}from"./dispatchErrorInfo-ZyhGCDRg.js";var K=t(e(),1),q=n(),J=`__all__`,Me=[{value:`open`},{value:`acknowledged`},{value:`resolved`}];function Ne(e){return e===`open`?T():e===`acknowledged`?b():f()}var Pe=[`info`,`warn`,`critical`],Fe=[`detector`,`agent`,`user`],Ie={kind:`relative`,from:`now-30d`,to:`now`},Le=200,Y=`all`;function X(){let e=Te({from:`/settings/anomalies`}),t=P({from:`/settings/anomalies`}),n=e.q??``,d=e.status===Y?J:e.status,f=e.severity??J,h=e.kind??J,[g,_]=(0,K.useState)(J),y=De(e.from,e.to),{from:b,to:S}=ke(y),T=e=>void t({search:t=>({...t,q:e||void 0}),replace:!0}),O=e=>void t({search:t=>({...t,status:e===J?Y:e})}),j=e=>void t({search:t=>({...t,severity:e===J?void 0:e})}),R=e=>void t({search:t=>({...t,kind:e===J?void 0:e})}),V=e=>void t({search:t=>({...t,...H(e)})}),U=Ee(),W=we(),G=p(E.anomalies.resolveAnomaly),X=(x(E.me.getMe,{host:Oe})?.permissions??[]).includes(`admin.manage`),Z=x(E.anomalies.listAnomalies,{limit:Le,filter:{q:n||void 0,from:b,to:S,anomalyStatus:d===J?void 0:d,severity:f===J?void 0:f,source:g===J?void 0:g,kind:h===J?void 0:h}}),Q=(0,K.useMemo)(()=>{let e=new Set;for(let t of Z??[])e.add(t.kind);return[...e].sort()},[Z]),$=n!==``||d!==`open`||f!==J||g!==J||h!==J||y.kind!==`relative`||y.from!==Ie.from;function Ue(){_(J),t({search:{status:`open`},replace:!0})}async function We(e){if(await U({title:be(),description:(0,q.jsxs)(q.Fragment,{children:[w(),` `,(0,q.jsx)(`span`,{className:`font-mono`,children:e.kind}),` `,Se(),` `,(0,q.jsx)(`strong`,{children:D()}),`.`,` `,ye()]}),confirmLabel:r()}))try{await G({anomalyId:e._id,status:`resolved`}),W.success(ue(),e.kind)}catch(e){W.error(ve(),e)}}async function Ge(e){try{await G({anomalyId:e._id,status:`acknowledged`}),W.success(ge(),e.kind)}catch(e){W.error(_e(),e)}}return(0,q.jsxs)(q.Fragment,{children:[(0,q.jsxs)(`p`,{className:`oc-admin__hint`,children:[c(),` `,(0,q.jsx)(`strong`,{children:C()}),` `,ae(),` `,(0,q.jsx)(`strong`,{children:ie()}),` `,he(),` `,(0,q.jsx)(`strong`,{children:pe()}),` `,o(),` `,(0,q.jsx)(`span`,{className:`oc-filter__window`,children:me()})]}),(0,q.jsxs)(Ae,{q:n,onQChange:T,searchPlaceholder:ee(),timeRange:y,onTimeRangeChange:V,onReset:Ue,canReset:$,children:[(0,q.jsxs)(I,{value:d,onValueChange:O,children:[(0,q.jsx)(M,{size:`sm`,className:`w-36`,children:(0,q.jsx)(B,{})}),(0,q.jsxs)(L,{children:[(0,q.jsx)(F,{value:J,children:Ce()}),Me.map(e=>(0,q.jsx)(F,{value:e.value,children:Ne(e.value)},e.value))]})]}),(0,q.jsxs)(I,{value:f,onValueChange:j,children:[(0,q.jsx)(M,{size:`sm`,className:`w-36`,children:(0,q.jsx)(B,{placeholder:u()})}),(0,q.jsxs)(L,{children:[(0,q.jsx)(F,{value:J,children:le()}),Pe.map(e=>(0,q.jsx)(F,{value:e,children:e},e))]})]}),(0,q.jsxs)(I,{value:g,onValueChange:_,children:[(0,q.jsx)(M,{size:`sm`,className:`w-32`,children:(0,q.jsx)(B,{placeholder:l()})}),(0,q.jsxs)(L,{children:[(0,q.jsx)(F,{value:J,children:se()}),Fe.map(e=>(0,q.jsx)(F,{value:e,children:e},e))]})]}),(0,q.jsxs)(I,{value:h,onValueChange:R,children:[(0,q.jsx)(M,{size:`sm`,className:`w-36`,children:(0,q.jsx)(B,{placeholder:v()})}),(0,q.jsxs)(L,{children:[(0,q.jsx)(F,{value:J,children:i()}),Q.map(e=>(0,q.jsx)(F,{value:e,children:e},e))]})]})]}),(0,q.jsx)(je,{title:xe(),rows:Z,emptyHint:d===`open`?ce():te(),rowActions:e=>X&&e.status===`open`?[{label:ne(),onSelect:()=>void We(e)},{label:fe(),onSelect:()=>void Ge(e)}]:[],columns:[{header:k(),cell:e=>(0,q.jsx)(`span`,{className:`oc-traces__time`,children:z(e.at)}),sort:e=>e.at},{header:v(),cell:e=>(0,q.jsx)(`code`,{className:`oc-traces__mono`,children:e.kind}),sort:e=>e.kind},{header:oe(),cell:e=>e.occurrenceCount!==null&&e.occurrenceCount>1?(0,q.jsx)(`span`,{className:`oc-traces__time`,title:e.firstAt===null?void 0:re({when:z(e.firstAt)}),children:s({count:String(e.occurrenceCount)})}):(0,q.jsx)(`span`,{className:`oc-traces__time`,children:`—`}),sort:e=>e.occurrenceCount??0},{header:u(),cell:e=>(0,q.jsx)(Be,{severity:e.severity}),sort:e=>e.severity===`critical`?2:+(e.severity===`warn`)},{header:a(),cell:e=>(0,q.jsx)(Ve,{status:e.status}),sort:e=>e.status===`resolved`?2:+(e.status===`acknowledged`)},{header:l(),cell:e=>(0,q.jsx)(N,{variant:`outline`,children:e.source}),sort:e=>e.source},{header:de(),cell:e=>(0,q.jsxs)(`div`,{className:`oc-anomaly__msgcell`,children:[(0,q.jsx)(`span`,{className:`oc-anomaly__msg`,children:e.message}),(0,q.jsx)(ze,{row:e})]}),sort:e=>e.message},{header:A(),cell:e=>(0,q.jsx)(Re,{row:e}),sort:e=>e.evidence??null},{header:m(),cell:e=>e.correlationId?(0,q.jsx)(`code`,{className:`oc-traces__mono`,children:He(e.correlationId)}):(0,q.jsx)(`span`,{className:`oc-traces__muted`,children:`—`}),sort:e=>e.correlationId}]})]})}var Z=new Set([`openclaw.dispatch_failures`,`assistant.announce_errors`]);function Q(e){if(!Z.has(e.kind)||!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 Re({row:e}){let t=P();if(e.kind===`subagent.failure`){let n=$(e);return(0,q.jsxs)(`div`,{className:`oc-anomaly__cause`,children:[(0,q.jsx)(`div`,{className:`oc-anomaly__cause-head`,children:[...new Set(n.errorCategories??[])].map(e=>(0,q.jsx)(`code`,{className:`oc-traces__mono`,children:e},e))}),e.correlationId?(0,q.jsxs)(`button`,{type:`button`,className:`oc-anomaly__drill`,onClick:()=>void t({to:`/settings/traces`,search:{q:e.correlationId,limit:100}}),children:[`↗ `,j()]}):null]})}let n=Q(e);if(!n.dominantCode){let e=n.sampleCorrelationId;return e?(0,q.jsx)(`div`,{className:`oc-anomaly__cause`,children:(0,q.jsxs)(`button`,{type:`button`,className:`oc-anomaly__drill`,onClick:()=>void t({to:`/settings/traces`,search:{correlationId:e,limit:100}}),children:[`↗ `,j()]})}):(0,q.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})}let r=G(n.dominantCode),i=n.sampleCorrelationId;return(0,q.jsxs)(`div`,{className:`oc-anomaly__cause`,children:[(0,q.jsxs)(`div`,{className:`oc-anomaly__cause-head`,children:[(0,q.jsx)(`span`,{className:`oc-anomaly__cause-label`,children:r.label}),(0,q.jsx)(`code`,{className:`oc-traces__mono`,children:n.dominantCode})]}),(0,q.jsx)(`p`,{className:`oc-anomaly__cause-hint`,children:r.hint}),i?(0,q.jsxs)(`button`,{type:`button`,className:`oc-anomaly__drill`,onClick:()=>void t({to:`/settings/traces`,search:{correlationId:i,limit:100}}),children:[`↗ `,j()]}):null]})}function ze({row:e}){let[t,n]=(0,K.useState)(!1),r=x(E.anomalies.getAnomalyAttachments,t?{anomalyId:e._id}:`skip`);return!e.attachments||e.attachments.length===0?null:(0,q.jsxs)(q.Fragment,{children:[(0,q.jsxs)(`button`,{type:`button`,className:`oc-anomaly__drill`,onClick:()=>n(!0),children:[O(),e.attachments.length>1?` (${e.attachments.length})`:``]}),(0,q.jsx)(W,{open:t,onOpenChange:n,children:(0,q.jsxs)(V,{className:`oc-anomaly__attachments-dialog`,children:[(0,q.jsx)(R,{children:(0,q.jsx)(U,{children:d()})}),r===void 0?(0,q.jsx)(`p`,{className:`oc-traces__muted`,children:g()}):r.length===0?(0,q.jsx)(`p`,{className:`oc-traces__muted`,children:_()}):(0,q.jsx)(`div`,{className:`oc-anomaly__attachments`,children:r.map(e=>(0,q.jsxs)(`section`,{className:`oc-anomaly__attachment`,children:[(0,q.jsx)(`h4`,{className:`oc-anomaly__attachment-name`,children:(0,q.jsx)(`code`,{className:`oc-traces__mono`,children:e.name})}),(0,q.jsx)(`pre`,{className:`oc-anomaly__attachment-content`,children:e.content})]},e.name))})]})})]})}function Be({severity:e}){return(0,q.jsx)(`span`,{className:`oc-anomaly__sev oc-anomaly__sev--${e}`,children:e})}function Ve({status:e}){return e===`open`?(0,q.jsx)(N,{variant:`destructive`,children:y()}):e===`acknowledged`?(0,q.jsx)(N,{variant:`secondary`,children:S()}):(0,q.jsx)(N,{variant:`outline`,children:h()})}function He(e){return e.length>8?e.slice(0,8):e}export{X as AnomaliesTab};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$T as r,Ca as i,Da as a,Ea as o,Sa as s,Ta as c,aE as l,cE as u,dE as d,eE as f,fE as p,iE as m,lE as h,nE as g,oE as _,oV as v,pE as y,rE as b,sE as x,t as S,tE as C,uE as w,wa as T}from"./api-DRlXTl06.js";import{$ as E,Gn as D,Kn as O,Q as k,X as A,Z as j,a as M,ct as N,et as P,i as F,n as I,o as L,s as R}from"./index-D48cFy6f.js";import{n as ee}from"./TimeRangePicker-Cq_PGNzt.js";import{t as z}from"./FilterBar-Of8GWz2N.js";import{t as B}from"./AdvancedFilter-DhMwg7nB.js";import{t as V}from"./DataTableShell-C0MSDiic.js";var H=t(e(),1),U=n(),W={kind:`relative`,from:I,to:`now`},G=`__all__`,K=[{value:`action`,label:a()},{value:`realLabel`,label:o()},{value:`targetLabel`,label:c()},{value:`impersonated`,label:T()},{value:`resource`,label:i()},{value:`resourceId`,label:s()}];function q(){let e=O({from:`/settings/audit`}),t=D({from:`/settings/audit`}),n=e.q??``,i=e.action??G,a=e.impersonated??G,o=e.resource??G,s=F(e.from,e.to),c=(0,H.useMemo)(()=>R(e.adv),[e.adv]),{from:T,to:I}=ee(s),q=e=>void t({search:t=>({...t,q:e||void 0}),replace:!0}),J=e=>void t({search:t=>({...t,action:e===G?void 0:e})}),Y=e=>void t({search:t=>({...t,impersonated:e===G?void 0:e})}),X=e=>void t({search:t=>({...t,resource:e===G?void 0:e})}),Z=e=>void t({search:t=>({...t,...L(e)})}),Q=e=>void t({search:t=>({...t,adv:M(e)}),replace:!0}),$=v(S.admin.listAudit,{filter:{q:n||void 0,from:T,to:I,action:i===G?void 0:i,resource:o===G?void 0:o,impersonated:a===G?void 0:a===`yes`,advanced:c.length>0?c:void 0}}),te=(0,H.useMemo)(()=>{let e=new Set;for(let t of $??[])e.add(t.action);return[...e].sort()},[$]),ne=(0,H.useMemo)(()=>{let e=new Set;for(let t of $??[])t.resource&&e.add(t.resource);return[...e].sort()},[$]),re=n!==``||i!==G||a!==G||o!==G||c.length>0||s.kind!==`relative`||s.from!==W.from;function ie(){t({search:{},replace:!0})}return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(`p`,{className:`oc-admin__hint`,children:[y(),` `,(0,U.jsx)(`span`,{className:`oc-filter__window`,children:p()})]}),(0,U.jsxs)(z,{q:n,onQChange:q,searchPlaceholder:d(),timeRange:s,onTimeRangeChange:Z,onReset:ie,canReset:re,children:[(0,U.jsxs)(A,{value:i,onValueChange:J,children:[(0,U.jsx)(E,{size:`sm`,className:`w-40`,children:(0,U.jsx)(P,{placeholder:w()})}),(0,U.jsxs)(j,{children:[(0,U.jsx)(k,{value:G,children:h()}),te.map(e=>(0,U.jsx)(k,{value:e,children:e},e))]})]}),(0,U.jsxs)(A,{value:a,onValueChange:Y,children:[(0,U.jsx)(E,{size:`sm`,className:`w-40`,children:(0,U.jsx)(P,{})}),(0,U.jsxs)(j,{children:[(0,U.jsx)(k,{value:G,children:u()}),(0,U.jsx)(k,{value:`yes`,children:x()}),(0,U.jsx)(k,{value:`no`,children:_()})]})]}),(0,U.jsxs)(A,{value:o,onValueChange:X,children:[(0,U.jsx)(E,{size:`sm`,className:`w-40`,children:(0,U.jsx)(P,{placeholder:l()})}),(0,U.jsxs)(j,{children:[(0,U.jsx)(k,{value:G,children:m()}),ne.map(e=>(0,U.jsx)(k,{value:e,children:e},e))]})]})]}),(0,U.jsx)(B,{fields:K,seed:c,onChange:Q}),(0,U.jsx)(V,{title:b(),rows:$,emptyHint:g(),columns:[{header:C(),cell:e=>N(e.at),sort:e=>e.at},{header:w(),cell:e=>e.action,sort:e=>e.action},{header:f(),cell:e=>e.realLabel,sort:e=>e.realLabel},{header:r(),cell:e=>e.targetLabel??`—`,sort:e=>e.targetLabel??null},{header:l(),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{$b as r,$x as i,Ad as a,Ax as o,Bb as s,Cx as c,D as l,Dd as u,Dx as d,Ed as f,Ex as p,Fb as m,Fd as h,Gb as g,Gi as _,Hb as v,Ib as y,Id as b,Jb as x,Ji as ee,Kb as S,Ki as te,Lb as ne,Mb as re,Md as ie,Nb as ae,Nd as oe,Od as se,Ox as ce,Pb as C,Pd as le,Qb as ue,Qx as de,Rb as fe,Sx as pe,Td as me,Tx as he,Ub as ge,Vb as _e,Wb as ve,Wi as ye,Xb as be,Yb as xe,Zb as Se,Zi as Ce,_x as we,aS as Te,aV as Ee,ax as De,bx as Oe,cS as ke,cx as Ae,dS as je,dx as Me,ex as Ne,fS as Pe,fx as Fe,gx as Ie,hx as Le,iS as Re,ix as ze,j as Be,jd as w,kd as Ve,kx as He,lS as Ue,lx as We,mx as Ge,nS as Ke,nx as qe,oS as Je,oV as T,on as Ye,ox as Xe,px as Ze,qb as Qe,qi as $e,rS as et,rV as tt,rx as nt,sS as rt,sx as E,t as D,tx as it,ux as at,vx as ot,wd as st,wx as ct,xx as lt,yd as ut,yx as dt,zb as ft}from"./api-DRlXTl06.js";import{t as pt}from"./chevrons-up-down-BCCw67LL.js";import{i as mt,n as O,o as ht,r as gt,s as _t}from"./FieldLabel-CrPuHD7O.js";import{i as vt,n as yt,r as bt,t as xt}from"./tabs-KQ0HdNTL.js";import{t as St}from"./button-CTuIl1H-.js";import{$ as k,Bn as A,Bt as Ct,Dn as wt,Dt as Tt,Et as j,F as Et,Gn as Dt,Hn as M,Kn as Ot,Q as N,Rn as kt,Rt as At,X as P,Z as F,at as jt,ct as Mt,et as I,jt as L,lt as R,nt as Nt,ot as Pt,pn as z,q as Ft,rt as It,tt as Lt,un as B,ut as Rt,zn as zt,zt as Bt}from"./index-D48cFy6f.js";import{r as Vt}from"./locales-CPjguROj.js";import{a as Ht,i as V,n as Ut,o as H,r as U,t as Wt}from"./table-D0yilGWI.js";import{t as Gt}from"./FilterBar-Of8GWz2N.js";import{c as Kt,i as qt,n as Jt,o as Yt,r as Xt,s as Zt,t as Qt}from"./compatView-DGV2AVAR.js";import{t as W}from"./dispatchErrorInfo-ZyhGCDRg.js";var $t=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`}]]),en=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 tn(e){return e.filter(e=>e.state===`error`)}function nn(e){return e.reachable&&tn(e.targets).length===0}function rn(e){return nn(e)?(e.unreachableInstances??[]).length>0?`gateways_unreachable`:`ok`:`error`}function an(e){return e.state===`error`&&e.lastErrorCode!==null}function on(e){return!!e.lastDownstreamRejectCode}function sn(e){return!!e.lastLocalRefusalCode}function cn(e){return an(e)||on(e)||sn(e)}function K(e){return e.kind??`openclaw`}function ln(e){return[...e].sort((e,t)=>e===`openclaw`?-1:t===`openclaw`?1:e.localeCompare(t))}function un(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 ln(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__`,dn={q:``,state:J,instance:J,version:J},Y={connected:0,error:1,idle:2};function fn(e){return e.q.trim()!==``||e.state!==`__all__`||e.instance!==`__all__`||e.version!==`__all__`}function pn(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 mn(e,t){return e===`version`?t.gatewayVersion===null:e===`lastOk`?t.lastOkAt===null:!1}function hn(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 Zt(e,r)??X(e,r)}case`lastOk`:return t.lastOkAt-n.lastOkAt;default:return X(t.targetLabel,n.targetLabel)}}function gn(e,t){if(!t)return e;let n=t.dir===`asc`?1:-1;return[...e].sort((e,r)=>{let i=mn(t.key,e),a=mn(t.key,r);return i&&a?0:i?1:a?-1:n*hn(t.key,e,r)})}function _n(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 vn(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 yn(e){let t=new Set;for(let n of e)n.gatewayVersion!==null&&t.add(n.gatewayVersion);return[...t].sort((e,t)=>Zt(e,t)??X(e,t))}var Z=n();function bn({connections:e,displayByInstance:t}){let[n,r]=(0,G.useState)(dn),[i,a]=(0,G.useState)(null),o=(0,G.useMemo)(()=>e.map((e,n)=>({_id:`${e.key}:${e.canonical}/${e.agentId}:${n}`,targetLabel:`${e.canonical}/${e.agentId}`,state:e.state,instanceName:e.instanceName??null,instanceLabel:e.instanceName?t.get(e.instanceName)??e.instanceName:null,gatewayHost:e.gatewayHost,gatewayVersion:e.gatewayVersion??null,okCount:e.okCount,errorCount:e.errorCount+(e.downstreamRejectCount??0)+(e.localRefusalCount??0),attempts:e.attempts,lastOkAt:e.lastOkAt??null,lastErrorCode:e.lastErrorCode??null,lastErrorAt:e.lastErrorAt??null,lastDownstreamRejectCode:e.lastDownstreamRejectCode??null,lastDownstreamRejectAt:e.lastDownstreamRejectAt??null,lastLocalRefusalCode:e.lastLocalRefusalCode??null,lastLocalRefusalAt:e.lastLocalRefusalAt??null})),[e,t]),c=(0,G.useMemo)(()=>_n(o),[o]),l=(0,G.useMemo)(()=>vn(o),[o]),u=(0,G.useMemo)(()=>yn(o),[o]),d=(0,G.useMemo)(()=>gn(pn(o,n),i),[o,n,i]);function f(e){a(t=>t?.key===e?t.dir===`asc`?{key:e,dir:`desc`}:null:{key:e,dir:`asc`})}return e.length===0?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:be()}):(0,Z.jsxs)(`div`,{className:`oc-conn`,children:[(0,Z.jsxs)(Gt,{q:n.q,onQChange:e=>r(t=>({...t,q:e})),searchPlaceholder:Qe(),onReset:()=>r(dn),canReset:fn(n),children:[(0,Z.jsxs)(P,{value:n.state,onValueChange:e=>r(t=>({...t,state:e})),children:[(0,Z.jsx)(k,{size:`sm`,className:`w-36`,children:(0,Z.jsx)(I,{placeholder:g()})}),(0,Z.jsxs)(F,{children:[(0,Z.jsx)(N,{value:J,children:S()}),c.map(e=>(0,Z.jsx)(N,{value:e,children:Sn(e)},e))]})]}),(0,Z.jsxs)(P,{value:n.instance,onValueChange:e=>r(t=>({...t,instance:e})),children:[(0,Z.jsx)(k,{size:`sm`,className:`w-40`,children:(0,Z.jsx)(I,{placeholder:ve()})}),(0,Z.jsxs)(F,{children:[(0,Z.jsx)(N,{value:J,children:S()}),l.map(e=>(0,Z.jsx)(N,{value:e.name,children:e.label},e.name))]})]}),(0,Z.jsxs)(P,{value:n.version,onValueChange:e=>r(t=>({...t,version:e})),children:[(0,Z.jsx)(k,{size:`sm`,className:`w-36`,children:(0,Z.jsx)(I,{placeholder:ge()})}),(0,Z.jsxs)(F,{children:[(0,Z.jsx)(N,{value:J,children:S()}),u.map(e=>(0,Z.jsx)(N,{value:e,children:e},e))]})]})]}),d.length===0?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:v()}):(0,Z.jsxs)(Wt,{className:`oc-conn__table`,children:[(0,Z.jsx)(Ht,{children:(0,Z.jsxs)(H,{children:[(0,Z.jsx)(Q,{label:_e(),sortKey:`target`,sort:i,onSort:f}),(0,Z.jsx)(Q,{label:s(),sortKey:`state`,sort:i,onSort:f}),(0,Z.jsx)(Q,{label:ft(),sortKey:`instance`,sort:i,onSort:f}),(0,Z.jsx)(Q,{label:fe(),sortKey:`host`,sort:i,onSort:f}),(0,Z.jsx)(Q,{label:ne(),sortKey:`version`,sort:i,onSort:f}),(0,Z.jsx)(V,{children:y()}),(0,Z.jsx)(Q,{label:m(),sortKey:`lastOk`,sort:i,onSort:f})]})}),(0,Z.jsx)(Ut,{children:d.map(e=>(0,Z.jsx)(xn,{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)(zt,{size:13,"aria-hidden":!0}):(0,Z.jsx)(M,{size:13,"aria-hidden":!0}):(0,Z.jsx)(pt,{size:13,"aria-hidden":!0,className:`oc-conn__sort-idle`})]})})}function xn({r:e}){let t=an(e)?W(e.lastErrorCode):null,n=on(e)?W(e.lastDownstreamRejectCode):null,r=sn(e)?W(e.lastLocalRefusalCode):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)(Cn,{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:xe({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:R(e.lastOkAt)}):(0,Z.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})})]}),cn(e)?(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?` · ${R(e.lastErrorAt)}`:``,(0,Z.jsx)(`p`,{className:`oc-bridge-card__hint`,children:t.hint})]}):null,r?(0,Z.jsxs)(`div`,{className:`oc-bridge-target__downstream`,children:[Be({label:r.label}),` `,(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:e.lastLocalRefusalCode}),e.lastLocalRefusalAt?` · ${R(e.lastLocalRefusalAt)}`:``,(0,Z.jsx)(`p`,{className:`oc-bridge-card__hint`,children:r.hint})]}):null,n?(0,Z.jsxs)(`div`,{className:`oc-bridge-target__downstream`,children:[x({label:n.label}),` `,(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:e.lastDownstreamRejectCode}),e.lastDownstreamRejectAt?` · ${R(e.lastDownstreamRejectAt)}`:``]}):null]})}):null]})}function Sn(e){return e===`connected`?C():e===`error`?ae():re()}function Cn({state:e}){return e===`connected`?(0,Z.jsx)(j,{variant:`secondary`,children:C()}):e===`error`?(0,Z.jsx)(j,{variant:`destructive`,children:ae()}):(0,Z.jsx)(j,{variant:`outline`,children:re()})}function wn(){return T(D.bridgeHealth.getBridgeHealth,{})}function Tn(){let e=wn(),t=T(D.compat.getBridgeCompat,{}),n=T(D.me.getMe,{host:Ft})?.role===`admin`,r=T(D.admin.listInstances,n?{}:`skip`),i=T(D.agents.usageForInstances,n?{}:`skip`),a=Dt(),o=()=>void a({to:`/settings/anomalies`,search:{status:`open`}}),s=un(e?e.targets:[],t?t.targets:[],r??[]),{section:c}=Ot({from:`/settings/bridge`}),l=Dt({from:`/settings/bridge`}),u=t?.compat??null,d=t===void 0?`loading`:t===null?`nodata`:`ready`,f=u!==null&&Xt(u,`hermes`)&&!s.some(e=>e.key===`hermes`);return(0,Z.jsxs)(`div`,{className:`oc-bridge`,children:[(0,Z.jsx)(En,{health:e,compat:t,onSeeAnomalies:o}),(0,Z.jsx)(`p`,{className:`oc-admin__hint oc-bridge__caption`,children:Ie()}),i&&i.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)(Wt,{children:[(0,Z.jsx)(Ht,{children:(0,Z.jsxs)(H,{children:[(0,Z.jsx)(V,{children:ee()}),(0,Z.jsx)(V,{children:$e()}),(0,Z.jsx)(V,{children:te()}),(0,Z.jsx)(V,{children:_()}),(0,Z.jsx)(V,{children:ye()})]})}),(0,Z.jsx)(Ut,{children:i.flatMap(e=>{let t=Et(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)(j,{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,s.length>0?(0,Z.jsxs)(xt,{value:s.some(e=>e.key===c)?c:s[0]?.key??`openclaw`,onValueChange:e=>void l({search:{section:e},replace:!0}),children:[(0,Z.jsx)(bt,{className:`w-full`,children:s.map(e=>(0,Z.jsxs)(vt,{value:e.key,className:`flex-1 gap-1.5`,children:[(0,Z.jsx)(z,{size:13,"aria-hidden":!0}),q(e.key)]},e.key))}),s.map(e=>(0,Z.jsx)(yt,{value:e.key,children:(0,Z.jsx)(Dn,{providerKey:e.key,connections:e.connections,instances:e.instances,manifest:u,compatStatus:d,compatReachable:t?.reachable??!0,protocol:e.key===`openclaw`?t?.protocol??null:null})},e.key))]}):null,f?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:ut()}):null]})}function En({health:e,compat:t,onSeeAnomalies:n}){let i=t!=null&&t.buildVersion!=null&&t.bridgeVersion!=null&&t.buildVersion!==t.bridgeVersion,a=t?.buildRevision&&t.buildRevision!==`unknown`?t.buildRevision.slice(0,7):null,o=t&&t!==null?(0,Z.jsxs)(`span`,{className:`oc-bridge-card__ver`,children:[(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:Yt(t.bridgeVersion)}),a?(0,Z.jsxs)(Z.Fragment,{children:[` `,(0,Z.jsxs)(`code`,{className:`oc-traces__mono`,title:le(),children:[`(`,a,`)`]})]}):null,i?(0,Z.jsxs)(`strong`,{className:`oc-bridge-card__mismatch`,children:[` `,oe({build:t.buildVersion??`?`})]}):null,` · `,ie(),` `,(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:t.protocolVersion===null?w():String(t.protocolVersion)})]}):null;if(e===void 0)return(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:E()});if(e===null)return(0,Z.jsx)(`div`,{className:`oc-bridge-card oc-bridge-card--idle`,children:Xe()});let s=tn(e.targets),c=!e.reachable,l=rn(e),u=e.unreachableInstances??[],d=l===`ok`?`ok`:l===`gateways_unreachable`?`warn`:`error`,f=Mt(e.checkedAt),p=e.startedAt==null?null:Mt(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)(kt,{size:22}):c||l===`gateways_unreachable`?(0,Z.jsx)(en,{size:22}):(0,Z.jsx)(B,{size:22})}),(0,Z.jsxs)(`div`,{className:`oc-bridge-card__body`,children:[(0,Z.jsx)(`div`,{className:`oc-bridge-card__title`,children:l===`ok`?De():l===`gateways_unreachable`?it({count:u.length}):c?ze():nt({count:s.length})}),(0,Z.jsxs)(`div`,{className:`oc-bridge-card__meta`,children:[(0,Z.jsxs)(`span`,{children:[(0,Z.jsx)($t,{size:12,"aria-hidden":!0}),` `,qe({time:f})]}),p?(0,Z.jsx)(`span`,{children:r({time:p})}):null,o]}),l===`gateways_unreachable`?(0,Z.jsx)(`p`,{className:`oc-bridge-card__hint`,children:Ne({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:ue()})]})}function Dn({providerKey:e,connections:t,instances:n,manifest:r,compatStatus:i,compatReachable:a,protocol:o}){let s=r?Kt(r,e):null,c=new Map;for(let e of n)c.set(e.name,e.displayName??e.name);let l=[],u=new Set;for(let n of t){if(!n.instanceName||u.has(n.instanceName))continue;u.add(n.instanceName);let t=n.gatewayVersion??null;l.push({instanceName:n.instanceName,displayName:c.get(n.instanceName)??n.instanceName,version:t,state:Jt(t,e,r)})}let d=Qt(l.map(e=>e.state)),[f,p]=(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)(z,{size:15,"aria-hidden":!0,className:`oc-bridge-provider__icon`}),(0,Z.jsx)(`span`,{className:`oc-bridge-provider__name`,children:q(e)}),d?(0,Z.jsx)(j,{variant:d===`beyond`||d===`defective`?`destructive`:`secondary`,children:qt(d)}):null]}),(0,Z.jsx)(`h4`,{className:`oc-bridge-provider__sub`,children:b()}),(0,Z.jsx)(kn,{providerName:q(e),support:s,compatStatus:i,compatReachable:a,manifest:r,instanceRows:l}),o?(0,Z.jsx)(On,{protocol:o}):null,(0,Z.jsxs)(`button`,{type:`button`,className:`oc-bridge-provider__sub oc-bridge-provider__sub--toggle`,"aria-expanded":f,onClick:()=>p(e=>!e),children:[f?(0,Z.jsx)(M,{size:13,"aria-hidden":!0}):(0,Z.jsx)(A,{size:13,"aria-hidden":!0}),Se({count:t.length})]}),f?(0,Z.jsx)(bn,{connections:t,displayByInstance:c}):null]})}function On({protocol:e}){let[t,n]=(0,G.useState)(!1),r=e.coverage,i=e.drift??[],a=(e.driftOverflow??0)+(e.driftTruncated??0);return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`h4`,{className:`oc-bridge-provider__sub`,children:[Ge(),i.length>0?(0,Z.jsx)(j,{variant:`destructive`,children:Fe({count:i.length})}):a>0?(0,Z.jsx)(j,{variant:`destructive`,children:Me()}):(0,Z.jsx)(j,{variant:`secondary`,children:Ze()})]}),(0,Z.jsxs)(`p`,{className:`oc-admin__hint`,children:[at({version:e.vendoredVersion}),r?` · `+We({handled:r.handled,ignored:r.ignored,gaps:r.gaps}):null]}),a>0?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:Ye({overflow:e.driftOverflow??0,truncated:e.driftTruncated??0})}):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)(M,{size:13,"aria-hidden":!0}):(0,Z.jsx)(A,{size:13,"aria-hidden":!0}),Ae({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 kn({support:e,compatStatus:t,compatReachable:n,manifest:r,instanceRows:i,providerName:o}){return t===`loading`?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:E()}):t===`nodata`?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:h()}):(0,Z.jsxs)(`div`,{className:`oc-compat`,children:[n?null:(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:a()}),r===null?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:Ve()}):(0,Z.jsxs)(`div`,{className:`oc-compat__support`,children:[(0,Z.jsx)(`span`,{className:`oc-compat__label`,children:Ce({provider:o})}),e&&e.range!==null?(0,Z.jsx)(`span`,{children:se({min:e.range.min,max:e.range.maxValidated})}):(0,Z.jsx)(`span`,{children:w()}),e?(0,Z.jsx)(Mn,{versions:e.validatedVersions}):null]}),i.length===0?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:st()}):(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:Yt(e.version)}),(0,Z.jsx)(j,{variant:e.state===`supported`?`secondary`:e.state===`beyond`||e.state===`defective`?`destructive`:`outline`,children:qt(e.state)})]},e.instanceName))})]})}function An({instance:e,onClose:t}){return(0,Z.jsx)(Lt,{open:!0,onOpenChange:e=>!e&&t(),children:(0,Z.jsxs)(Nt,{className:`oc-bridge-config-dialog`,onOpenAutoFocus:e=>e.preventDefault(),children:[(0,Z.jsxs)(jt,{children:[(0,Z.jsx)(Pt,{children:Pe({instance:e.displayName??e.name})}),(0,Z.jsx)(It,{children:je()})]}),(0,Z.jsx)(jn,{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)(kt,{"aria-hidden":!0}):(0,Z.jsx)(B,{"aria-hidden":!0}),(0,Z.jsxs)(`span`,{children:[e,` — `,t.ok?Oe():t.detail]})]}):(0,Z.jsxs)(`p`,{className:`oc-bridge-config__check-row oc-bridge-config__check-row--skip`,children:[e,` — `,dt()]}):null}function jn({instance:e,onClose:t}){let n=Ee(D.admin.upsertInstanceConfig),r=tt(D.bridge.validateMediaPaths),a=Tt(),s=Vt(e.config?.contentLocale,void 0),[l,u]=(0,G.useState)(()=>mt(e.config??{},s)),[f,m]=(0,G.useState)(!1),[h,g]=(0,G.useState)(!1),[_,v]=(0,G.useState)(null),y=l.inboundMediaMode===`shared-fs`,b=l.mediaMode===`shared-fs`,x=y||b;async function ee(){g(!0),v(null);try{v(await r({instanceName:e.name,inboundMediaMode:l.inboundMediaMode,mediaMode:l.mediaMode}))}catch(e){a.error(ct(),e)}finally{g(!1)}}async function S(){m(!0);try{let r=e.config??{};await n({instanceId:e._id,config:gt(l,r,s)}),t()}catch(e){a.error(Re(),e)}finally{m(!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)(O,{label:Ue(),help:et()}),(0,Z.jsxs)(P,{value:l.mediaMode,onValueChange:e=>u({...l,mediaMode:e}),children:[(0,Z.jsx)(k,{size:`sm`,className:`w-full`,children:(0,Z.jsx)(I,{})}),(0,Z.jsx)(F,{children:_t.map(e=>(0,Z.jsx)(N,{value:e,children:e},e))})]})]}),(0,Z.jsxs)(`label`,{className:`oc-field`,children:[(0,Z.jsx)(O,{label:ke(),help:Ke()}),(0,Z.jsxs)(P,{value:l.inboundMediaMode,onValueChange:e=>u({...l,inboundMediaMode:e}),children:[(0,Z.jsx)(k,{size:`sm`,className:`w-full`,children:(0,Z.jsx)(I,{})}),(0,Z.jsx)(F,{children:ht.map(e=>(0,Z.jsx)(N,{value:e,children:e},e))})]})]}),(0,Z.jsxs)(`label`,{className:`oc-field`,children:[(0,Z.jsx)(O,{label:rt(),help:i()}),(0,Z.jsx)(L,{type:`number`,min:1,max:4096,className:`w-full`,value:l.mediaMaxMb,onChange:e=>u({...l,mediaMaxMb:Math.trunc(Number(e.target.value)||0)})})]})]}),x&&(0,Z.jsxs)(`div`,{className:`oc-bridge-config__grid`,children:[y&&(0,Z.jsxs)(`label`,{className:`oc-field`,children:[(0,Z.jsx)(O,{label:o(),help:He()}),(0,Z.jsx)(L,{className:`w-full`,spellCheck:!1,value:l.inboundAgentMount,onChange:e=>u({...l,inboundAgentMount:e.target.value})})]}),b&&(0,Z.jsxs)(`label`,{className:`oc-field`,children:[(0,Z.jsx)(O,{label:ce(),help:d()}),(0,Z.jsx)(L,{className:`w-full`,spellCheck:!1,value:l.outboundAgentMount,onChange:e=>u({...l,outboundAgentMount:e.target.value})})]})]}),(0,Z.jsxs)(`label`,{className:`oc-field--row`,children:[(0,Z.jsx)(Rt,{checked:l.rehydration,onCheckedChange:e=>u({...l,rehydration:e===!0})}),(0,Z.jsx)(O,{label:Je(),help:de()})]}),x&&_!==null&&(0,Z.jsx)(`div`,{className:`oc-bridge-config__check`,children:_.reachable?!_.inbound&&!_.outbound?(0,Z.jsxs)(`p`,{className:`oc-bridge-config__check-row oc-bridge-config__check-row--err`,children:[(0,Z.jsx)(B,{"aria-hidden":!0}),we({reason:_.reason??`?`})]}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)($,{label:pe(),result:_.inbound}),(0,Z.jsx)($,{label:lt(),result:_.outbound}),(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:c()})]}):(0,Z.jsxs)(`p`,{className:`oc-bridge-config__check-row oc-bridge-config__check-row--err`,children:[(0,Z.jsx)(B,{"aria-hidden":!0}),ot()]})}),(0,Z.jsxs)(`div`,{className:`oc-bridge-config__actions`,children:[x&&(0,Z.jsxs)(St,{variant:`outline`,size:`sm`,onClick:()=>void ee(),disabled:h,children:[h?(0,Z.jsx)(wt,{className:`size-4 animate-spin`,"aria-hidden":!0}):null,h?he():p()]}),(0,Z.jsx)(St,{size:`sm`,onClick:()=>void S(),disabled:f,children:Te()})]})]})})}function Mn({versions:e}){if(e.length===0)return null;let t=[...e].reverse();return(0,Z.jsxs)(At,{children:[(0,Z.jsx)(Ct,{asChild:!0,children:(0,Z.jsxs)(`button`,{type:`button`,className:`oc-compat__versions-btn`,children:[e.length===1?u():f({count:e.length}),(0,Z.jsx)(M,{size:13,"aria-hidden":!0})]})}),(0,Z.jsxs)(Bt,{className:`oc-compat__versions-pop`,align:`start`,children:[(0,Z.jsx)(`p`,{className:`oc-compat__versions-title`,children:me()}),(0,Z.jsx)(`div`,{className:`oc-compat__versions-list`,children:t.map(e=>(0,Z.jsx)(j,{variant:`secondary`,children:e},e))})]})]})}export{Tn as BridgeTab,An as InstanceConfigDialog};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Bd as r,Gd as i,Hd as a,Ld as o,Rd as s,Ud as c,Vd as l,Wd as u,Xi as d,ZB as f,aV as p,ac as m,cc as h,cp as g,dc as _,fc as v,ic as y,lc as b,np as x,oV as S,oc as C,op as w,pc as T,rV as E,sc as D,t as O,tp as k,uS as A,uc as j,xf as M,zd as N}from"./api-DRlXTl06.js";import{t as P}from"./button-CTuIl1H-.js";import{$ as F,B as I,M as L,N as R,Q as z,X as B,Z as V,et as H,jt as U,un as W,ut as G}from"./index-D48cFy6f.js";import{a as K}from"./compatView-DGV2AVAR.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=p(O.admin.upsertInstanceConfig),n=S(O.agents.listAgentsForInstance,{instanceName:e.name}),r=typeof e.config?.converterAgentId==`string`?e.config.converterAgentId:``,[i,a]=(0,q.useState)(r),[c,l]=(0,q.useState)(`idle`);(0,q.useEffect)(()=>{a(r),l(`idle`)},[e._id,r]);let u=`__none__`,d=i!==r;async function f(){l(`saving`);try{let n={...e.config??{}};i===``||i===u?delete n.converterAgentId:n.converterAgentId=i,await t({instanceId:e._id,config:n}),l(`done`)}catch{l(`error`)}}let m=n?.agents??[];return(0,X.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,X.jsx)(`span`,{className:`oc-cdefaults__label`,children:j()}),(0,X.jsx)(`p`,{className:`oc-admin__hint`,children:b()}),(0,X.jsxs)(`div`,{className:`oc-cdefaults__inline`,children:[(0,X.jsxs)(B,{value:i===``?u:i,onValueChange:e=>a(e===u?``:e),children:[(0,X.jsx)(F,{className:`oc-cdefaults__select`,"aria-label":j(),children:(0,X.jsx)(H,{placeholder:h()})}),(0,X.jsxs)(V,{children:[(0,X.jsx)(z,{value:u,children:h()}),m.map(e=>(0,X.jsx)(z,{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 f(),children:c===`saving`?g():N()})]}),c===`done`?(0,X.jsx)(`p`,{className:`oc-admin__hint`,role:`status`,children:s()}):null,c===`error`?(0,X.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:o()}):null]})}function Q({instance:e}){let t=p(O.admin.upsertInstanceConfig),n=e.config?.curationEnabled===!0,r=typeof e.config?.curationBudgetChars==`number`?e.config.curationBudgetChars:null,[i,a]=(0,q.useState)(n),[c,l]=(0,q.useState)(r===null?``:String(r)),[u,d]=(0,q.useState)(`idle`);(0,q.useEffect)(()=>{a(n),l(r===null?``:String(r)),d(`idle`)},[e._id,n,r]);let f=c.trim(),h=f===``?null:/^\d+$/.test(f)?Number.parseInt(f,10):NaN,v=!i||h===null||Number.isInteger(h)&&h>=4e3&&h<=6e4,y=i!==n||(h??null)!==r;async function b(){d(`saving`);try{let n={...e.config??{}};n.curationEnabled=i,!i||h===null||Number.isNaN(h)?delete n.curationBudgetChars:n.curationBudgetChars=h,await t({instanceId:e._id,config:n}),d(`done`)}catch{d(`error`)}}return(0,X.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,X.jsxs)(`label`,{className:`oc-cdefaults__inline`,style:{cursor:`pointer`},children:[(0,X.jsx)(G,{checked:i,onCheckedChange:e=>a(e===!0),"aria-label":_()}),(0,X.jsx)(`span`,{className:`oc-cdefaults__label`,children:_()})]}),(0,X.jsxs)(`div`,{className:`oc-cdefaults__inline`,children:[(0,X.jsx)(U,{type:`number`,min:4e3,max:6e4,step:1e3,placeholder:`20000`,value:c,onChange:e=>l(e.target.value),className:`oc-cdefaults__number`,"aria-invalid":!v,"aria-label":D(),disabled:!i}),(0,X.jsx)(P,{size:`sm`,disabled:!y||!v||u===`saving`,onClick:()=>void b(),children:u===`saving`?g():N()})]}),v?null:(0,X.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:C()}),u===`done`?(0,X.jsx)(`p`,{className:`oc-admin__hint`,role:`status`,children:s()}):null,u===`error`?(0,X.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:o()}):null,(0,X.jsx)(`p`,{className:`oc-cdefaults__help`,children:m()})]})}function $({instance:e}){let t=p(O.admin.upsertInstanceConfig),n=typeof e.config?.summarizeThresholdChars==`number`?e.config.summarizeThresholdChars:null,[r,i]=(0,q.useState)(n===null?``:String(n)),[a,c]=(0,q.useState)(`idle`);(0,q.useEffect)(()=>{i(n===null?``:String(n)),c(`idle`)},[e._id,n]);let l=r.trim(),u=l===``?null:/^\d+$/.test(l)?Number.parseInt(l,10):NaN,d=u===null||Number.isInteger(u)&&u>=1e3&&u<=2e5,f=(u??null)!==n;async function m(){c(`saving`);try{let n={...e.config??{}};u===null?delete n.summarizeThresholdChars:n.summarizeThresholdChars=u,await t({instanceId:e._id,config:n}),c(`done`)}catch{c(`error`)}}return(0,X.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,X.jsx)(`span`,{className:`oc-cdefaults__label`,children:T()}),(0,X.jsxs)(`div`,{className:`oc-cdefaults__inline`,children:[(0,X.jsx)(U,{type:`number`,min:1e3,max:2e5,step:1e3,placeholder:`8000`,value:r,onChange:e=>i(e.target.value),className:`oc-cdefaults__number`,"aria-invalid":!d}),(0,X.jsx)(P,{size:`sm`,disabled:!f||!d||a===`saving`,onClick:()=>void m(),children:a===`saving`?g():N()})]}),d?null:(0,X.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:y()}),a===`done`?(0,X.jsx)(`p`,{className:`oc-admin__hint`,role:`status`,children:s()}):null,a===`error`?(0,X.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:o()}):null,(0,X.jsx)(`p`,{className:`oc-cdefaults__help`,children:v()})]})}function ee(){let e=E(O.agentFiles.getChatDefaults),[t,n]=(0,q.useState)({status:`loading`}),o=S(O.admin.listInstances,{}),[s,p]=(0,q.useState)(null);(0,q.useEffect)(()=>{!o||o.length===0||(!s||!o.some(e=>e.name===s))&&p(o[0].name)},[o,s]);let m=(o?.length??0)>1,h=o!==void 0&&o.length===0,g=S(O.compat.forInstance,s?{instanceName:s}:`skip`),_=s?I(g,`configDefaults`):`loading`,v=_===`loading`?null:_.blocked,y=(0,q.useMemo)(()=>m&&s?{instanceName:s}:{},[m,s]),b=(0,q.useRef)(0),C=(0,q.useCallback)(async()=>{let t=++b.current;n({status:`loading`});try{let r=Y(await e(y));if(b.current!==t)return;n({status:`done`,current:r})}catch{if(b.current!==t)return;n({status:`error`})}},[e,y]);(0,q.useEffect)(()=>{v===!1&&(m&&!s||C())},[C,v,m,s]);let T=t.status===`done`?t.current:null,D=(0,q.useMemo)(()=>J.map(e=>({id:e,label:R(e)})),[]),j=(0,q.useMemo)(()=>[{id:`fast`,label:x()},{id:`standard`,label:k()}],[]);return(0,X.jsxs)(`div`,{className:`oc-cdefaults`,children:[(0,X.jsx)(`p`,{className:`oc-admin__hint`,children:i()}),m&&s?(0,X.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,X.jsx)(`span`,{className:`oc-cdefaults__label`,children:M()}),(0,X.jsxs)(B,{value:s,onValueChange:e=>p(e),children:[(0,X.jsx)(F,{size:`sm`,"aria-label":M(),children:(0,X.jsx)(H,{})}),(0,X.jsx)(V,{children:(o??[]).map(e=>(0,X.jsx)(z,{value:e.name,children:e.name},e.name))})]})]}):null,h?(0,X.jsx)(`p`,{className:`oc-admin__hint`,role:`status`,children:A()}):_===`loading`?(0,X.jsx)(`p`,{className:`oc-admin__hint`,children:f()}):_.blocked?(0,X.jsxs)(`p`,{className:`oc-compat__blocked`,role:`status`,children:[(0,X.jsx)(W,{size:14,"aria-hidden":!0}),` `,K(_.gatewayVersion,_.provider)]}):t.status===`loading`?(0,X.jsx)(`p`,{className:`oc-admin__hint`,children:f()}):t.status===`error`?(0,X.jsxs)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:[r(),` `,(0,X.jsx)(P,{variant:`outline`,size:`sm`,onClick:()=>void C(),children:w()})]}):(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,X.jsx)(`span`,{className:`oc-cdefaults__label`,children:u()}),(0,X.jsx)(L,{field:`thinkingLevel`,options:D,value:T?.thinkingDefault??null,onChange:()=>{},disabled:!0,ariaLabel:u()}),(0,X.jsx)(`p`,{className:`oc-cdefaults__help`,children:c()})]}),(0,X.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,X.jsx)(`span`,{className:`oc-cdefaults__label`,children:a()}),(0,X.jsx)(L,{field:`fastMode`,options:j,value:T===null||T.fastModeDefault===null?null:T.fastModeDefault?`fast`:`standard`,onChange:()=>{},disabled:!0,ariaLabel:a()}),(0,X.jsx)(`p`,{className:`oc-cdefaults__help`,children:l()})]}),(0,X.jsx)(`p`,{className:`oc-cdefaults__note`,children:d()})]}),(()=>{let e=o?.find(e=>e.name===(s??o[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{$O as r,Ak as i,BO as a,Ck as o,Dk as s,Ek 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 ee,Mk as g,NO as _,Nk as v,Ok as te,PO as ne,QO as re,RO as ie,Sk as ae,Tk as y,UO as b,VO as x,WO as S,XO as C,YO as w,ZO as T,_k as E,_s as D,aV as O,ak as k,bk as A,ck as j,dk as M,ek as N,fk as P,gk as F,hk as I,ik as L,jO as R,jk as z,kk as B,lk as V,mk as H,nk as oe,oV as U,ok as W,pk as G,qO as K,rk as q,sk as se,t as J,tk as ce,uk as le,vk as ue,wk as de,xk as fe,yk as pe,ys as me,zO as he}from"./api-DRlXTl06.js";import{t as ge}from"./button-CTuIl1H-.js";import{U as _e,ct as Y}from"./index-D48cFy6f.js";import{t as ve}from"./DataTableShell-C0MSDiic.js";var X=t(e(),1),Z=n(),ye={altered_words:()=>v(),incorrect:()=>g(),incoherence:()=>z(),formatting:()=>i(),latency:()=>B(),api_error:()=>te(),other:()=>s()},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:y()}):e===!1?(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-warn`,children:de()}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill`,children:`—`}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill`,children:c()})}function be({data:e,reference:t,closeReason:n}){let r=e.snapshot,i=O(J.feedback.respondToFeedback),[a,s]=(0,X.useState)(e.thread),[c,l]=(0,X.useState)(``),[u,d]=(0,X.useState)(!1);async function f(){let t=c.trim();if(!(!t||u)){d(!0);try{await i({feedbackId:e._id,text:t}),s(e=>[...e,{authorRole:`admin`,text:t,at:Date.now()}]),l(``)}finally{d(!1)}}}let p=[];try{p=r.contextJson?JSON.parse(r.contextJson):[]}catch{p=[]}return(0,Z.jsxs)(`div`,{className:`oc-fbadmin__detail`,children:[(0,Z.jsxs)(`div`,{className:`oc-fbadmin__row`,children:[(0,Z.jsx)($,{matches:r.displayedMatchesStored,sourceWasOpen:r.clientInfo?.sourceWasOpen??!1}),(0,Z.jsxs)(`span`,{className:`oc-fbadmin__meta`,children:[Q(e.category),` · `,r.messageRole,r.isRegeneration?` · ${o()}`:``,r.openclawModel?` · ${r.openclawModel}`:``,r.openclawRuntime?` (${r.openclawRuntime})`:``]}),t?(0,Z.jsx)(`code`,{className:`oc-fbadmin__ref`,style:{userSelect:`all`,marginLeft:`auto`},title:T(),children:t}):null]}),e.comment?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:ae()}),(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:h()}),(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:fe()}),a.length>0?(0,Z.jsx)(`div`,{className:`oc-fbadmin__thread`,children:a.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`?A():e.authorRole===`agent`?e.authorLabel??me():pe()}),(0,Z.jsx)(`span`,{className:`oc-notif__msg-text`,children:e.text})]},t))}):(0,Z.jsx)(`p`,{className:`oc-fbadmin__meta`,children:ue()}),(0,Z.jsx)(`textarea`,{className:`oc-feedback__textarea`,placeholder:E(),value:c,maxLength:2e3,rows:3,onChange:e=>l(e.target.value.slice(0,2e3))}),(0,Z.jsx)(`div`,{className:`oc-fbadmin__row`,style:{justifyContent:`flex-end`},children:(0,Z.jsx)(ge,{size:`sm`,onClick:()=>void f(),disabled:!c.trim()||u,children:u?F():I()})})]}),(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:H()}),(0,Z.jsx)(`pre`,{className:`oc-msg__source-pre`,children:r.messageText||G()})]}),r.clientInfo?.sourceWasOpen&&r.displayedText!==void 0?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:P()}),(0,Z.jsx)(`pre`,{className:`oc-msg__source-pre`,children:r.displayedText||G()})]}):null,r.promptText?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:M()}),(0,Z.jsx)(`pre`,{className:`oc-msg__source-pre`,children:r.promptText})]}):null,p.length>0?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:le({count:r.contextCount??p.length,truncated:r.contextTruncated?V():``})}),(0,Z.jsx)(`div`,{className:`oc-fbadmin__ctx`,children:p.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,r.outboxAvailable?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:j()}),(0,Z.jsxs)(`pre`,{className:`oc-msg__source-pre`,children:[r.outboxText??``,r.outboxStatus?`\n[status: ${r.outboxStatus}]`:``]})]}):null,r.clientInfo?.extensionsDetected&&r.clientInfo.extensionsDetected.length>0?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:se()}),(0,Z.jsx)(`div`,{className:`oc-fbadmin__row`,children:r.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:W()}),(0,Z.jsxs)(`p`,{className:`oc-fbadmin__env`,children:[[r.clientInfo?.language,r.clientInfo?.timezone,r.clientInfo?.theme?k({theme:r.clientInfo.theme}):null,r.runId?`run ${r.runId.slice(0,12)}…`:null].filter(Boolean).join(` · `)||`—`,r.clientInfo?.plugins&&r.clientInfo.plugins.length>0?(0,Z.jsxs)(`span`,{className:`oc-fbadmin__plugins`,children:[L(),` `,r.clientInfo.plugins.join(`, `),(0,Z.jsxs)(`span`,{className:`oc-fbadmin__note`,children:[` `,q()]})]}):null,r.clientInfo?.userAgent?(0,Z.jsx)(`span`,{className:`oc-fbadmin__ua`,children:r.clientInfo.userAgent}):null]})]})]})}function xe(){let e=U(J.feedback.listForAdmin,{}),t=O(J.feedback.readSnapshot),n=O(J.feedback.deleteFeedback),i=_e(),[o,s]=(0,X.useState)(null),[c,h]=(0,X.useState)({});async function g(e){if(o===e._id){s(null);return}if(!c[e._id]){let n=await t({feedbackId:e._id});h(t=>({...t,[e._id]:n}))}s(e._id)}async function v(e){await i({title:_(),description:ee(),confirmLabel:R(),destructive:!0})&&(await n({feedbackId:e._id}),o===e._id&&s(null))}return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`p`,{className:`oc-admin__hint`,children:[oe(),` `,(0,Z.jsx)(`strong`,{children:ce()}),` `,N()]}),(0,Z.jsx)(ve,{title:r(),rows:e,emptyHint:re(),isExpanded:e=>o===e._id&&!!c[e._id],renderExpanded:e=>c[e._id]?(0,Z.jsx)(be,{data:c[e._id],reference:e.reference,closeReason:e.userCloseReason}):null,columns:[{header:C(),cell:e=>Y(e.at),sort:e=>e.at},{header:w(),cell:e=>Q(e.category),sort:e=>Q(e.category)},{header:p(),cell:e=>e.messageRole===`user`?K():m(),sort:e=>e.messageRole},{header:u(),cell:e=>(e.reporterEmail||e.reporterName||`—`)+(e.impersonated&&e.realOperatorEmail?` ${S({operator:e.realOperatorEmail})}`:``),sort:e=>e.reporterEmail||e.reporterName||null},{header:b(),cell:e=>(0,Z.jsx)($,{matches:e.displayedMatchesStored,sourceWasOpen:e.sourceWasOpen}),sort:e=>e.displayedMatchesStored===!1?0:e.displayedMatchesStored===!0?1:2},{header:d(),cell:e=>e.hasComment?`✎`:`—`,sort:e=>+!!e.hasComment},{header:x(),cell:e=>e.userClosedAt==null?e.resolvedAt==null?e.answered?(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-ok`,children:a()}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill`,children:he()}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-ok`,title:e.resolvedBy??void 0,children:D()}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-closed`,children:ie()}),sort:e=>e.userClosedAt==null?e.resolvedAt==null?+!!e.answered:2:3}],rowActions:e=>[{label:o===e._id?f():l(),onSelect:()=>void g(e)},{label:ne(),onSelect:()=>void v(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{$B as ee,$z as te,Bz as r,Cs as i,Gz as a,Hz as ne,Jz as o,Kz as s,Lz as re,Qz as ie,Rz as ae,Ss as oe,Uz as se,Vz as ce,Wz as le,Xz as ue,Yz as de,ZB as fe,Zz as pe,_B as me,aB as c,aV as he,cB as ge,dB as l,eB as u,fB as _e,gB as d,hB as f,iB as p,lB as m,mB as h,nB as g,oB as _,oV as ve,pB as ye,qz as be,rB as v,sB as y,t as b,tB as x,tN as S,uB as C,vB as w,zz as T}from"./api-DRlXTl06.js";import{t as E}from"./button-CTuIl1H-.js";import{$ as D,Ct as O,Dt as k,Et as A,Fn as j,Lt as M,Mt as N,Nt as xe,Pn as Se,Pt as P,Q as F,St as Ce,Tt as I,X as L,Z as R,bt as we,dn as Te,et as z,hn as Ee,ut as De,vt as Oe,wt as ke,xt as Ae,yt as je}from"./index-D48cFy6f.js";import{a as Me,i as B,n as Ne,o as V,r as H,t as Pe}from"./table-D0yilGWI.js";var U=t(e(),1),W=n(),G=`all`;function K(e){switch(e){case`image`:return y();case`audio`:return _();case`video`:return c();case`pdf`:return p();case`document`:return v();case`archive`:return g();default:return x()}}function q(){let[e,t]=(0,U.useState)(G),[n,c]=(0,U.useState)(G),[p,g]=(0,U.useState)(G),[_,v]=(0,U.useState)(G),[y,x]=(0,U.useState)(!1),[q,J]=(0,U.useState)(null),Fe=he(b.files.softDelete),Y=k();function Ie(){t(G),c(G),g(G),v(G)}async function Le(){let e=q;if(J(null),e)try{await Fe({fileId:e.id}),Y.success(le())}catch(e){Y.error(se(),e)}}let X=ve(b.files.listMine,{direction:e===G?void 0:e,chatId:n===G?void 0:n,instanceName:p===G?void 0:p,category:_===G?void 0:_,includeAutoGenerated:y||void 0}),Re=(0,U.useMemo)(()=>new Intl.DateTimeFormat(ee(),{dateStyle:`medium`,timeStyle:`short`}),[]);if(X===void 0)return(0,W.jsx)(`p`,{className:`oc-admin__hint`,children:fe()});let{files:Z,facets:Q,truncated:ze,cap:Be}=X,$=e!==G||n!==G||p!==G||_!==G;return(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`p`,{className:`oc-admin__hint`,children:w()}),(0,W.jsxs)(`div`,{className:`oc-files__filters`,style:{display:`flex`,flexWrap:`wrap`,gap:8,margin:`12px 0`},children:[(0,W.jsxs)(L,{value:e,onValueChange:t,children:[(0,W.jsx)(D,{size:`sm`,"aria-label":me(),children:(0,W.jsx)(z,{})}),(0,W.jsxs)(R,{children:[(0,W.jsx)(F,{value:G,children:d()}),(0,W.jsx)(F,{value:`inbound`,children:f()}),(0,W.jsx)(F,{value:`outbound`,children:h()})]})]}),(0,W.jsxs)(L,{value:n,onValueChange:c,children:[(0,W.jsx)(D,{size:`sm`,"aria-label":ye(),children:(0,W.jsx)(z,{})}),(0,W.jsxs)(R,{children:[(0,W.jsx)(F,{value:G,children:_e()}),Q.chats.map(e=>(0,W.jsx)(F,{value:e.id,children:e.title},e.id))]})]}),Q.multiProvider?(0,W.jsxs)(L,{value:p,onValueChange:g,children:[(0,W.jsx)(D,{size:`sm`,"aria-label":l(),children:(0,W.jsx)(z,{})}),(0,W.jsxs)(R,{children:[(0,W.jsx)(F,{value:G,children:C()}),Q.instances.map(e=>(0,W.jsx)(F,{value:e,children:e},e))]})]}):null,(0,W.jsxs)(L,{value:_,onValueChange:v,children:[(0,W.jsx)(D,{size:`sm`,"aria-label":m(),children:(0,W.jsx)(z,{})}),(0,W.jsxs)(R,{children:[(0,W.jsx)(F,{value:G,children:ge()}),Q.categories.map(e=>(0,W.jsx)(F,{value:e,children:K(e)},e))]})]}),(0,W.jsxs)(`label`,{className:`oc-files__autogen`,children:[(0,W.jsx)(De,{checked:y,onCheckedChange:e=>x(e===!0),"aria-label":i()}),(0,W.jsx)(`span`,{children:i()})]}),$?(0,W.jsxs)(E,{variant:`ghost`,size:`sm`,onClick:Ie,style:{display:`inline-flex`,alignItems:`center`,gap:4,marginLeft:`auto`},children:[(0,W.jsx)(Ee,{size:14,"aria-hidden":!0}),be()]}):null]}),Z.length===0?(0,W.jsx)(`p`,{className:`oc-admin__hint`,children:$?ae():T()}):(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:u()}),(0,W.jsx)(B,{children:te()}),(0,W.jsx)(B,{children:ie()}),(0,W.jsx)(B,{children:pe()}),(0,W.jsx)(B,{children:ue()}),(0,W.jsx)(B,{className:`text-right`,children:de()})]})}),(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)(A,{variant:`outline`,style:{marginLeft:6},children:oe()}):null]}),(0,W.jsx)(H,{title:e.mimeType,children:K(e.category)}),(0,W.jsx)(H,{children:(0,W.jsx)(A,{variant:`secondary`,children:e.direction===`inbound`?f():h()})}),(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)(N,{children:[(0,W.jsx)(M,{asChild:!0,children:(0,W.jsx)(E,{variant:`ghost`,size:`icon`,"aria-label":s(),children:(0,W.jsx)(Se,{size:16})})}),(0,W.jsxs)(xe,{align:`end`,children:[e.url?(0,W.jsx)(P,{asChild:!0,children:(0,W.jsxs)(`a`,{href:e.url,download:e.filename,target:`_blank`,rel:`noopener noreferrer`,children:[(0,W.jsx)(j,{size:14}),o()]})}):(0,W.jsxs)(P,{disabled:!0,children:[(0,W.jsx)(j,{size:14}),r()]}),(0,W.jsxs)(P,{variant:`destructive`,onSelect:()=>J({id:e._id,filename:e.filename}),children:[(0,W.jsx)(Te,{size:14}),a()]})]})]})})]},e._id))})]}),ze?(0,W.jsx)(`p`,{className:`oc-admin__hint`,style:{marginTop:8},children:re({cap:Be})}):null]}),(0,W.jsx)(Oe,{open:q!==null,onOpenChange:e=>!e&&J(null),children:(0,W.jsxs)(Ae,{children:[(0,W.jsxs)(ke,{children:[(0,W.jsx)(I,{children:ne()}),(0,W.jsx)(Ce,{children:ce()})]}),(0,W.jsxs)(O,{children:[(0,W.jsx)(we,{children:S()}),(0,W.jsx)(je,{onClick:()=>void Le(),children:a()})]})]})})]})}export{q as FilesTab};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$ as r,$D as i,$E as a,$i as o,AD as s,AE as c,Ac as l,BD as u,BE as d,CD as f,CE as p,DD as m,DE as h,ED as g,EE as _,FD as ee,FE as v,G as te,GD as y,GE as b,H as ne,HD as re,HE as x,ID as ie,IE as S,J as ae,JD as oe,JE as C,K as se,KD as ce,KE as w,LD as le,MD as ue,ME as de,ND as fe,NE as pe,OD as me,OE as he,Oc as ge,PD as _e,PE as ve,Q as ye,QD as be,QE as xe,RD as Se,RE as T,SD as Ce,SE as we,TD as Te,TE as Ee,U as De,UD as E,UE as D,VD as Oe,VE as O,W as ke,WD as Ae,WE as je,X as Me,XD as Ne,XE as Pe,Y as Fe,YD as Ie,YE as Le,Z as Re,ZD as ze,ZE as Be,_D as Ve,_E as He,aD as Ue,aV as k,bD as A,bE as We,cD as Ge,dD as Ke,eD as qe,eO as Je,eS as Ye,ea as Xe,et as Ze,fD as Qe,gD as $e,gE as et,hD as tt,hE as j,iD as nt,iP as M,it as rt,jD as it,jE as at,jc as ot,kD as st,kE as ct,kc as lt,lD as N,mD as ut,mE as dt,nD as ft,nO as pt,nt as mt,oD as ht,oV as P,pD as gt,q as _t,qD as vt,qE as yt,rD as bt,rO as xt,rP as St,rV as F,rt as Ct,sD as wt,t as I,tD as Tt,tO as Et,tS as Dt,ta as Ot,tt as kt,uD as At,vD as jt,vE as Mt,wD as Nt,wE as Pt,xD as Ft,xE as It,yD as Lt,yE as Rt,zD as zt,zE as Bt}from"./api-DRlXTl06.js";import{a as Vt,c as Ht}from"./FieldLabel-CrPuHD7O.js";import{t as L}from"./button-CTuIl1H-.js";import{$ as R,Bt as Ut,Dt as z,Et as B,Q as V,Rt as Wt,U as Gt,X as H,Z as U,_ as Kt,at as W,et as G,jt as K,nt as q,ot as qt,rt as Jt,tt as Yt,ut as Xt,zt as Zt}from"./index-D48cFy6f.js";import{t as Qt}from"./DataTableShell-C0MSDiic.js";import{InstanceConfigDialog as $t}from"./BridgeTab-Cyq6ii7O.js";var J=t(e(),1),Y=[`conversational`,`documentary`,`summarizer`,`curator`],en=new Set(Y),tn=`conversational`;function nn(e){let t=new Set((e??[]).filter(e=>en.has(e)));return t.size===0?[tn]:Y.filter(e=>t.has(e))}var X=n(),Z={name:``,gatewayUrl:``,bridgeUrl:``,displayName:``,kind:`openclaw`,transport:`ws`,gatewayVersion:``,gatewayHttpUrl:``,authMode:`token`,personScopes:`capped`,identitySource:`canonical`,systemIdentity:``,streamTransport:Vt},rn={openclaw:[`token`,`deviceIdentity`],hermes:[`apiKey`]};function an(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??``,authMode:e.authMode??`token`,personScopes:e.personScopes??`capped`,identitySource:e.identitySource??`canonical`,systemIdentity:e.systemIdentity??``,streamTransport:e.streamTransport??`reactive`}}function on(){let e=P(I.admin.listInstances,{}),t=P(I.agents.listAllInstanceAgents,{}),n=k(I.admin.upsertInstance),a=k(I.admin.deleteInstance),c=z(),[l,d]=(0,J.useState)(!1),[f,p]=(0,J.useState)(Z),[h,_]=(0,J.useState)(null),[v,b]=(0,J.useState)(null),[x,S]=(0,J.useState)(null),[C,w]=(0,J.useState)(null);async function de(){try{await n({instanceId:C??void 0,name:f.name,gatewayUrl:f.gatewayUrl,bridgeUrl:f.bridgeUrl||void 0,displayName:f.displayName||void 0,kind:f.kind,transport:f.kind===`hermes`?f.transport:void 0,gatewayVersion:f.gatewayVersion||void 0,gatewayHttpUrl:f.gatewayHttpUrl||void 0,...f.kind===`openclaw`?{authMode:f.authMode,personScopes:f.personScopes,identitySource:f.identitySource,systemIdentity:f.systemIdentity||void 0}:{},streamTransport:f.streamTransport}),p(Z),w(null),d(!1)}catch(e){c.error(Et(),e)}}return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`p`,{className:`oc-admin__hint`,children:[Je(),(0,X.jsx)(`strong`,{children:i()}),be()]}),(0,X.jsx)(Qt,{title:ze(),rows:e,addLabel:Ne(),onAdd:()=>{w(null),p(Z),d(!0)},emptyHint:Ie(),columns:[{header:oe(),cell:e=>e.name,sort:e=>e.name},{header:vt(),cell:e=>(0,X.jsx)(B,{variant:`outline`,children:e.kind??`openclaw`}),sort:e=>e.kind??`openclaw`},{header:ce(),cell:e=>e.gatewayUrl,sort:e=>e.gatewayUrl},{header:y(),cell:e=>e.displayName??`—`,sort:e=>e.displayName??null},{header:xt(),cell:e=>{let n=(t?.[e.name]??[]).filter(e=>e.presentInLastOk!==!1&&e.enabled);if(n.length===0)return(0,X.jsx)(`span`,{className:`text-muted-foreground`,children:`—`});let r=t=>e.defaultAgentId===t;return(0,X.jsx)(`div`,{className:`flex flex-wrap gap-1`,children:[...n].sort((e,t)=>Number(r(t.agentId))-Number(r(e.agentId))).map(e=>(0,X.jsxs)(B,{variant:r(e.agentId)?`default`:`outline`,title:r(e.agentId)?j():void 0,children:[e.emoji?`${e.emoji} `:``,e.displayName??e.agentId]},e.agentId))})}}],rowActions:e=>[{label:Oe(),onSelect:()=>{w(e._id),p(an(e)),d(!0)}},{label:pt(),onSelect:()=>_(e.name)},{label:g(),onSelect:()=>S(e)},{label:Ae(),onSelect:()=>b(e)},{label:E(),variant:`destructive`,onSelect:()=>void a({instanceId:e._id})}],bulkActions:[{label:E(),variant:`destructive`,onSelect:e=>e.forEach(e=>void a({instanceId:e}))}]}),(0,X.jsx)(Kt,{open:l,onOpenChange:d,title:C?u():re(),description:Se(),canSubmit:!!(f.name&&f.gatewayUrl),onSubmit:de,submitLabel:le(),children:(0,X.jsxs)(`div`,{className:`oc-form`,children:[(0,X.jsxs)($,{label:ie(),children:[(0,X.jsx)(K,{value:f.name,disabled:C!==null,onChange:e=>p({...f,name:e.target.value})}),C?(0,X.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:zt()}):null]}),(0,X.jsx)($,{label:ee(),children:(0,X.jsxs)(H,{value:f.kind,onValueChange:e=>p({...f,kind:e}),children:[(0,X.jsx)(R,{size:`sm`,className:`w-full`,children:(0,X.jsx)(G,{})}),(0,X.jsxs)(U,{children:[(0,X.jsx)(V,{value:`openclaw`,children:`OpenClaw`}),(0,X.jsx)(V,{value:`hermes`,children:`Hermes`})]})]})}),f.kind===`hermes`?(0,X.jsx)($,{label:Ot(),children:(0,X.jsxs)(H,{value:f.transport,onValueChange:e=>p({...f,transport:e}),children:[(0,X.jsx)(R,{size:`sm`,className:`w-full`,children:(0,X.jsx)(G,{})}),(0,X.jsxs)(U,{children:[(0,X.jsx)(V,{value:`ws`,children:Xe()}),(0,X.jsx)(V,{value:`rest`,children:o()})]})]})}):null,(0,X.jsx)($,{label:_e(),children:(0,X.jsx)(K,{value:f.gatewayUrl,onChange:e=>p({...f,gatewayUrl:e.target.value})})}),(0,X.jsx)($,{label:fe(),children:(0,X.jsx)(K,{value:f.bridgeUrl,placeholder:ue(),onChange:e=>p({...f,bridgeUrl:e.target.value})})}),(0,X.jsx)($,{label:it(),children:(0,X.jsx)(K,{value:f.displayName,onChange:e=>p({...f,displayName:e.target.value})})}),(0,X.jsxs)($,{label:Dt(),children:[(0,X.jsxs)(H,{value:f.streamTransport,onValueChange:e=>p({...f,streamTransport:e}),children:[(0,X.jsx)(R,{size:`sm`,className:`w-full`,children:(0,X.jsx)(G,{})}),(0,X.jsx)(U,{children:Ht.map(e=>(0,X.jsx)(V,{value:e,children:e},e))})]}),(0,X.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:Ye()})]}),(0,X.jsx)($,{label:s(),children:(0,X.jsx)(K,{value:f.gatewayVersion,placeholder:st(),onChange:e=>p({...f,gatewayVersion:e.target.value})})}),f.kind===`openclaw`?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)($,{label:ae(),children:[(0,X.jsxs)(H,{value:f.authMode,onValueChange:e=>p({...f,authMode:e}),children:[(0,X.jsx)(R,{size:`sm`,className:`w-full`,children:(0,X.jsx)(G,{})}),(0,X.jsxs)(U,{children:[(0,X.jsx)(V,{value:`token`,children:_t()}),(0,X.jsx)(V,{value:`trusted-proxy`,children:se()})]})]}),(0,X.jsx)(`p`,{className:`oc-field__hint`,children:f.authMode===`trusted-proxy`?ke():te()})]}),f.authMode===`trusted-proxy`?(0,X.jsxs)($,{label:rt(),children:[(0,X.jsxs)(H,{value:f.personScopes,onValueChange:e=>p({...f,personScopes:e}),children:[(0,X.jsx)(R,{size:`sm`,className:`w-full`,children:(0,X.jsx)(G,{})}),(0,X.jsxs)(U,{children:[(0,X.jsx)(V,{value:`capped`,children:Ct()}),(0,X.jsx)(V,{value:`full`,children:mt()})]})]}),(0,X.jsx)(`p`,{className:`oc-field__hint`,children:f.personScopes===`full`?Ze():kt()})]}):null,f.authMode===`trusted-proxy`?(0,X.jsxs)($,{label:r(),children:[(0,X.jsxs)(H,{value:f.identitySource,onValueChange:e=>p({...f,identitySource:e}),children:[(0,X.jsx)(R,{size:`sm`,className:`w-full`,children:(0,X.jsx)(G,{})}),(0,X.jsxs)(U,{children:[(0,X.jsx)(V,{value:`canonical`,children:ye()}),(0,X.jsx)(V,{value:`email`,children:Re()})]})]}),(0,X.jsx)(`p`,{className:`oc-field__hint`,children:f.identitySource===`email`?Fe():Me()})]}):null,f.authMode===`trusted-proxy`?(0,X.jsx)($,{label:De(),children:(0,X.jsx)(K,{value:f.systemIdentity,placeholder:ne(),onChange:e=>p({...f,systemIdentity:e.target.value})})}):null]}):null,(0,X.jsx)($,{label:me(),children:(0,X.jsx)(K,{value:f.gatewayHttpUrl,placeholder:m(),onChange:e=>p({...f,gatewayHttpUrl:e.target.value})})})]})}),(0,X.jsx)(hn,{instanceName:h,open:h!==null,onOpenChange:e=>{e||_(null)}}),v?(0,X.jsx)($t,{instance:v,onClose:()=>b(null)},v._id):null,x?(0,X.jsx)(sn,{instance:x,onClose:()=>S(null)},x._id):null]})}function sn({instance:e,onClose:t}){let n=P(I.instanceSecrets.listInstanceSecretStatus,{}),r=rn[e.kind??`openclaw`],i=(0,J.useMemo)(()=>{let t={};for(let r of n??[])r.instanceId===e._id&&(t[r.field]=r.updatedAt);return t},[n,e._id]);return(0,X.jsx)(Yt,{open:!0,onOpenChange:e=>!e&&t(),children:(0,X.jsxs)(q,{onOpenAutoFocus:e=>e.preventDefault(),children:[(0,X.jsxs)(W,{children:[(0,X.jsx)(qt,{children:Te({instance:e.displayName??e.name})}),(0,X.jsx)(Jt,{children:Nt()})]}),(0,X.jsx)(`div`,{className:`oc-form`,children:r.map(t=>(0,X.jsx)(un,{instanceId:e._id,field:t,updatedAt:i[t]??null},t))}),(0,X.jsx)(`div`,{className:`oc-bridgesecret`,children:(0,X.jsx)(ln,{instance:e})}),(0,X.jsx)(cn,{instance:e})]})})}function cn({instance:e}){let t=F(I.instanceSync.forceInstanceSync),n=z(),[r,i]=(0,J.useState)(!1);async function o(){if(!r){i(!0);try{switch((await t({instanceId:e._id})).status){case`synced`:n.success(nt());break;case`no_agents`:n.success(ft());break;case`no_bridge_url`:n.error(Tt());break;case`deploy_misconfigured`:n.error(qe());break;case`unauthorized`:n.error(xe());break;case`not_served`:n.error(Be());break;default:n.error(a());break}}catch(e){n.error(bt(),e)}finally{i(!1)}}}return(0,X.jsxs)(`div`,{className:`oc-form`,children:[(0,X.jsx)(`p`,{className:`oc-admin__hint`,children:Pe()}),(0,X.jsx)(`div`,{className:`flex items-center gap-2`,children:(0,X.jsx)(L,{size:`sm`,variant:`outline`,onClick:()=>void o(),disabled:r,children:r?Ue():ht()})})]})}function ln({instance:e}){let t=P(I.bridgeAuth.listBridgeAuthStatus,{}),n=F(I.bridgeAuth.mintBridgeSecret),r=k(I.bridgeAuth.revokeBridgeSecret),i=z(),[a,o]=(0,J.useState)(!1),[s,c]=(0,J.useState)(null),[l,u]=(0,J.useState)(!1),d=(t??[]).find(t=>t.instanceId===e._id),f=d!==void 0;async function p(){if(!a){o(!0);try{c((await n({instanceId:e._id})).plaintext),u(!1)}catch(e){i.error(D(),e)}finally{o(!1)}}}async function m(){if(!a){o(!0);try{await r({instanceId:e._id}),c(null),i.success(je())}catch(e){i.error(D(),e)}finally{o(!1)}}}async function h(){if(s)try{await navigator.clipboard.writeText(s),u(!0)}catch{}}return(0,X.jsxs)($,{label:Le(),children:[(0,X.jsx)(`p`,{className:`oc-admin__hint`,children:C()}),(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,X.jsx)(B,{variant:f?`outline`:`secondary`,children:f?`${A()} · ${d.prefix}…${d.lastFour}`:Lt()}),(0,X.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,X.jsx)(L,{size:`sm`,onClick:()=>void p(),disabled:a,children:f?w():yt()}),f?(0,X.jsx)(L,{size:`sm`,variant:`destructive`,onClick:()=>void m(),disabled:a,children:b()}):null]})]}),s?(0,X.jsxs)(`div`,{className:`oc-bridgesecret__reveal`,children:[(0,X.jsx)(`p`,{className:`oc-sa__minted-warning`,children:x()}),(0,X.jsxs)(`div`,{className:`oc-sa__minted-box`,children:[(0,X.jsx)(`code`,{className:`oc-sa__minted-plain`,children:s}),(0,X.jsx)(L,{variant:`outline`,size:`sm`,onClick:()=>void h(),children:l?M():St()})]}),(0,X.jsx)(L,{size:`sm`,variant:`ghost`,onClick:()=>{c(null),u(!1)},children:O()})]}):null]})}function un({instanceId:e,field:t,updatedAt:n}){let r=F(I.instanceSecrets.setInstanceSecret),i=k(I.instanceSecrets.clearInstanceSecret),a=F(I.deviceIdentity.generateDeviceIdentity),o=z(),[s,c]=(0,J.useState)(``),[l,u]=(0,J.useState)(!1),[d,p]=(0,J.useState)(null),[m,h]=(0,J.useState)(!1),g=n!==null,_=t===`deviceIdentity`,ee=t===`token`?f():t===`deviceIdentity`?Ce():Ft();async function v(){if(!(!s.trim()||l)){u(!0);try{await r({instanceId:e,field:t,plaintext:s}),c(``),p(null),h(!1),o.success(ut())}catch(e){o.error(gt(),e)}finally{u(!1)}}}async function te(){if(!l){u(!0);try{await i({instanceId:e,field:t}),p(null),h(!1),o.success(Qe())}catch(e){o.error(gt(),e)}finally{u(!1)}}}async function y(){if(!l){u(!0);try{p(await a({instanceId:e})),h(!1),o.success(N())}catch(e){o.error(wt(),e)}finally{u(!1)}}}let b=d?`openclaw devices approve ${d.id}`:``;async function ne(){if(b)try{await navigator.clipboard.writeText(b),h(!0)}catch{}}return(0,X.jsxs)($,{label:ee,children:[_?(0,X.jsx)(`p`,{className:`oc-admin__hint`,children:At()}):null,(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,X.jsx)(B,{variant:g?`outline`:`secondary`,children:g?A():Lt()}),(0,X.jsx)(K,{type:`password`,autoComplete:`off`,className:`flex-1 min-w-32`,value:s,placeholder:g?Ve():jt(),onChange:e=>c(e.target.value)}),(0,X.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,X.jsx)(L,{size:`sm`,onClick:()=>void v(),disabled:l||s.trim().length===0,children:$e()}),_?(0,X.jsx)(L,{size:`sm`,variant:`outline`,onClick:()=>void y(),disabled:l,children:Ke()}):null,g?(0,X.jsx)(L,{size:`sm`,variant:`destructive`,onClick:()=>void te(),disabled:l,children:tt()}):null]})]}),d?(0,X.jsxs)(`div`,{className:`oc-bridgesecret__reveal`,children:[(0,X.jsx)(`p`,{className:`text-sm font-medium`,children:N()}),(0,X.jsx)(`p`,{className:`oc-admin__hint`,children:Ge()}),(0,X.jsxs)(`div`,{className:`oc-sa__minted-box`,children:[(0,X.jsx)(`code`,{className:`oc-sa__minted-plain`,children:b}),(0,X.jsx)(L,{variant:`outline`,size:`sm`,onClick:()=>void ne(),children:m?M():St()})]}),(0,X.jsx)(L,{size:`sm`,variant:`ghost`,onClick:()=>{p(null),h(!1)},children:O()})]}):null]})}var dn={conversational:c,documentary:he,summarizer:ot,curator:lt},fn={conversational:ct,documentary:h,summarizer:l,curator:ge},Q=e=>(dn[e]??(()=>e))(),pn=e=>(fn[e]??(()=>``))();function mn({agentId:e,types:t,onToggle:n}){return(0,X.jsxs)(`div`,{className:`oc-agentcard__types`,children:[(0,X.jsx)(`span`,{className:`oc-agentcard__types-label`,children:ve()}),t.map(e=>(0,X.jsx)(B,{variant:`secondary`,className:`oc-agenttype__chip`,title:pn(e),children:Q(e)},e)),(0,X.jsxs)(Wt,{children:[(0,X.jsx)(Ut,{asChild:!0,children:(0,X.jsx)(L,{type:`button`,variant:`outline`,size:`sm`,className:`h-7`,children:pe()})}),(0,X.jsxs)(Zt,{align:`start`,className:`oc-agenttypes-pop`,children:[(0,X.jsx)(`p`,{className:`oc-agenttypes-pop__title`,children:de()}),(0,X.jsx)(`p`,{className:`oc-agenttypes-pop__hint`,children:at()}),(0,X.jsx)(`div`,{className:`oc-agenttypes-pop__list`,children:Y.map(r=>{let i=`agtype-${e}-${r}`;return(0,X.jsxs)(`div`,{className:`oc-agenttypes-pop__item`,children:[(0,X.jsx)(Xt,{id:i,checked:t.includes(r),onCheckedChange:()=>n(r)}),(0,X.jsxs)(`label`,{htmlFor:i,className:`oc-agenttypes-pop__text`,children:[(0,X.jsx)(`span`,{className:`oc-agenttypes-pop__name`,children:Q(r)}),(0,X.jsx)(`span`,{className:`oc-agenttypes-pop__desc`,children:pn(r)})]})]},r)})})]})]})]})}function hn({instanceName:e,open:t,onOpenChange:n}){let r=P(I.agents.listAgentsForInstance,t&&e?{instanceName:e}:`skip`),i=k(I.agents.setAgentEnabled).withOptimisticUpdate((e,{instanceName:t,agentId:n,enabled:r})=>{let i=e.getQuery(I.agents.listAgentsForInstance,{instanceName:t});i&&e.setQuery(I.agents.listAgentsForInstance,{instanceName:t},{...i,agents:i.agents.map(e=>e.agentId===n?{...e,enabled:r}:e)})}),a=k(I.agents.setInstanceDefaultAgent).withOptimisticUpdate((e,{instanceName:t,agentId:n})=>{let r=e.getQuery(I.agents.listAgentsForInstance,{instanceName:t});r&&e.setQuery(I.agents.listAgentsForInstance,{instanceName:t},{...r,defaultAgentId:n})}),o=k(I.agents.setAgentTypes).withOptimisticUpdate((e,{instanceName:t,agentId:n,types:r})=>{let i=e.getQuery(I.agents.listAgentsForInstance,{instanceName:t});if(!i)return;let a=nn(r);e.setQuery(I.agents.listAgentsForInstance,{instanceName:t},{...i,agents:i.agents.map(e=>e.agentId===n?{...e,types:a}:e)})}),s=k(I.agents.setAgentDescription).withOptimisticUpdate((e,{instanceName:t,agentId:n,description:r})=>{let i=e.getQuery(I.agents.listAgentsForInstance,{instanceName:t});if(!i)return;let a=r.trim();e.setQuery(I.agents.listAgentsForInstance,{instanceName:t},{...i,agents:i.agents.map(e=>e.agentId===n?{...e,description:a.length===0?null:a}:e)})}),c=k(I.agents.removeInstanceAgent),l=Gt(),u=z();async function f(t,n){if(e)try{await i({instanceName:e,agentId:t,enabled:n})}catch(e){u.error(T(),e)}}async function m(t){if(e)try{await a({instanceName:e,agentId:t})}catch(e){u.error(T(),e)}}async function h(t,n,r){if(!e)return;let i=r.includes(n)?r.filter(e=>e!==n):[...r,n];try{await o({instanceName:e,agentId:t,types:i})}catch(e){u.error(T(),e)}}async function g(t,n){if(e&&await l({title:Pt({name:n}),description:p(),confirmLabel:we(),destructive:!0}))try{await c({instanceName:e,agentId:t}),u.success(It())}catch(e){u.error(T(),e)}}return(0,X.jsx)(Yt,{open:t,onOpenChange:n,children:(0,X.jsxs)(q,{className:`oc-access`,children:[(0,X.jsxs)(W,{children:[(0,X.jsx)(qt,{children:d({name:e??``})}),(0,X.jsx)(Jt,{children:Bt()})]}),r===void 0?(0,X.jsx)(`p`,{className:`oc-access__hint`,children:We()}):(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`div`,{className:`oc-access__poll`,children:r.discovery===null?Rt():r.discovery.lastPollOk?Mt():He({error:r.discovery.error??`?`})}),r.agents.length===0?(0,X.jsx)(`p`,{className:`oc-access__hint`,children:et()}):(0,X.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,X.jsxs)(`div`,{className:`oc-agentcard`+(t.enabled?``:` oc-agentcard--off`),children:[(0,X.jsxs)(`div`,{className:`oc-agentcard__head`,children:[(0,X.jsx)(Xt,{checked:t.enabled,disabled:n,"aria-label":a,onCheckedChange:e=>void f(t.agentId,e===!0)}),(0,X.jsxs)(`span`,{className:`oc-agentcard__name`,title:a,children:[t.emoji?`${t.emoji} `:``,a]}),t.model?(0,X.jsx)(`span`,{className:`oc-access__model`,children:t.model}):null,n?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(B,{variant:`outline`,className:`oc-access__gone`,children:dt()}),(0,X.jsx)(L,{size:`sm`,variant:`ghost`,className:`h-7 text-destructive`,onClick:()=>void g(t.agentId,a),children:Ee()})]}):i?(0,X.jsx)(B,{variant:`default`,children:j()}):(0,X.jsx)(L,{size:`sm`,variant:`outline`,className:`h-7`,disabled:!t.enabled,onClick:()=>void m(t.agentId),children:_()})]}),t.enabled?(0,X.jsx)(mn,{agentId:t.agentId,types:o,onToggle:e=>void h(t.agentId,e,o)}):null,t.enabled?(0,X.jsx)(gn,{value:t.description??``,onSave:async n=>{if(e)try{await s({instanceName:e,agentId:t.agentId,description:n})}catch(e){u.error(T(),e)}}}):null]},t.agentId)})})]})]})})}function gn({value:e,onSave:t}){let[n,r]=(0,J.useState)(e);(0,J.useEffect)(()=>{r(e)},[e]);let i=()=>{n.trim()!==e.trim()&&t(n)};return(0,X.jsx)(K,{className:`oc-agentcard__desc`,value:n,maxLength:280,placeholder:S(),"aria-label":v(),onChange:e=>r(e.target.value),onBlur:i,onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),i())}})}function $({label:e,children:t}){return(0,X.jsxs)(`label`,{className:`oc-field`,children:[(0,X.jsx)(`span`,{className:`oc-field__label`,children:e}),t]})}export{on as InstancesTab};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Bk as r,Fk as i,Gk as a,Gl as o,Hk as s,Ik as c,Jk as l,Jl as u,Kk as d,Kl as f,Lk as p,Ql as m,Rk as h,Uk as g,Vk as _,Wk as v,Wl as y,Xl as b,Yl as x,Zl as S,aV as C,oV as w,qk as T,ql as E,rV as D,t as O,zk as k}from"./api-DRlXTl06.js";import{t as A}from"./button-CTuIl1H-.js";import{Et as j,jt as M,ut as N}from"./index-D48cFy6f.js";var P=t(e(),1),F=n();function I(){let e=w(O.integrations.status.status,{}),t=C(O.admin.setIntegrationConfig),[n,o]=(0,P.useState)(null);if((0,P.useEffect)(()=>{e&&n===null&&o(e.config)},[e,n]),!e||!n)return(0,F.jsx)(`p`,{className:`oc-admin__hint`,children:l()});let u=n,f=(e,t,n)=>o({...u,[e]:{...u[e],[t]:n}}),y=(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:d()}),` `,a()]}),(0,F.jsxs)(L,{title:`Langfuse`,status:e.langfuse.configured?e.langfuse.enabled?(0,F.jsx)(j,{variant:`secondary`,children:v()}):(0,F.jsx)(j,{variant:`outline`,children:g()}):(0,F.jsx)(j,{variant:`outline`,children:s()}),note:_(),children:[(0,F.jsx)(R,{label:k(),children:(0,F.jsx)(M,{value:u.langfuse.host??``,placeholder:e.langfuse.effectiveHost,onChange:e=>f(`langfuse`,`host`,e.target.value),onBlur:()=>y(`langfuse`,{host:u.langfuse.host??``})})}),(0,F.jsx)(z,{label:i(),checked:u.langfuse.enabled??!0,onChange:e=>{f(`langfuse`,`enabled`,e),y(`langfuse`,{enabled:e})}})]}),(0,F.jsxs)(L,{title:`Opik`,status:e.opik.configured?e.opik.enabled?(0,F.jsx)(j,{variant:`secondary`,children:v()}):(0,F.jsx)(j,{variant:`outline`,children:g()}):(0,F.jsx)(j,{variant:`outline`,children:s()}),note:r(),children:[(0,F.jsx)(R,{label:h(),children:(0,F.jsx)(M,{value:u.opik.baseUrl??``,placeholder:e.opik.effectiveBaseUrl,onChange:e=>f(`opik`,`baseUrl`,e.target.value),onBlur:()=>y(`opik`,{baseUrl:u.opik.baseUrl??``})})}),(0,F.jsx)(R,{label:p(),children:(0,F.jsx)(M,{value:u.opik.workspace??``,placeholder:e.opik.effectiveWorkspace||c(),onChange:e=>f(`opik`,`workspace`,e.target.value),onBlur:()=>y(`opik`,{workspace:u.opik.workspace??``})})}),(0,F.jsx)(z,{label:i(),checked:u.opik.enabled??!0,onChange:e=>{f(`opik`,`enabled`,e),y(`opik`,{enabled:e})}})]}),(0,F.jsxs)(L,{title:`OpenTelemetry (OTLP)`,status:e.otlp.configured?e.otlp.enabled?(0,F.jsx)(j,{variant:`secondary`,children:v()}):(0,F.jsx)(j,{variant:`outline`,children:g()}):(0,F.jsx)(j,{variant:`outline`,children:m()}),note:S(),children:[(0,F.jsx)(R,{label:b(),children:(0,F.jsx)(M,{value:u.otlp.endpoint??``,placeholder:e.otlp.effectiveEndpoint||`https://otlp.example.com/v1/traces`,onChange:e=>f(`otlp`,`endpoint`,e.target.value),onBlur:()=>y(`otlp`,{endpoint:u.otlp.endpoint??``})})}),(0,F.jsx)(B,{headersSet:e.otlp.headersSet}),(0,F.jsx)(z,{label:i(),checked:u.otlp.enabled??!0,onChange:e=>{f(`otlp`,`enabled`,e),y(`otlp`,{enabled:e})}})]})]})}function L({title:e,status:t,note:n,children:r}){return(0,F.jsxs)(`section`,{className:`oc-int__section`,children:[(0,F.jsxs)(`div`,{className:`oc-int__section-head`,children:[(0,F.jsx)(`h3`,{className:`oc-uipa__h`,children:e}),t]}),n?(0,F.jsx)(`p`,{className:`oc-uipa__note`,children:n}):null,(0,F.jsx)(`div`,{className:`oc-int__fields`,children:r})]})}function R({label:e,children:t}){return(0,F.jsxs)(`label`,{className:`oc-int__field`,children:[(0,F.jsx)(`span`,{className:`oc-int__field-label`,children:e}),t]})}function z({label:e,checked:t,onChange:n}){return(0,F.jsxs)(`label`,{className:`oc-int__toggle`,children:[(0,F.jsx)(N,{checked:t,onCheckedChange:e=>n(e===!0)}),(0,F.jsx)(`span`,{children:e})]})}function B({headersSet:e}){let t=D(O.integrations.otlpSecret.setOtlpHeaders),n=C(O.integrations.otlpSecret.clearOtlpHeaders),[r,i]=(0,P.useState)(``),[a,s]=(0,P.useState)(null),[c,l]=(0,P.useState)(!1),d=async()=>{l(!0),s(null);try{await t({headersJson:r}),i(``)}catch(e){s(e instanceof Error?e.message:String(e))}finally{l(!1)}};return(0,F.jsxs)(R,{label:x(),children:[(0,F.jsx)(M,{value:r,placeholder:e?u():E(),onChange:e=>i(e.target.value)}),(0,F.jsxs)(`div`,{className:`oc-int__otlp-headers-actions`,children:[(0,F.jsx)(A,{size:`sm`,disabled:c||r.trim().length===0,onClick:()=>void d(),children:f()}),e?(0,F.jsx)(A,{variant:`ghost`,size:`sm`,disabled:c,onClick:()=>void n({}),children:o()}):null]}),a?(0,F.jsx)(`p`,{className:`oc-int__otlp-headers-error`,children:a}):null,(0,F.jsx)(`p`,{className:`oc-uipa__note`,children:y()})]})}export{I as IntegrationsTab};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{AA as r,MA as i,SA as a,_b as o,ab as s,cb as c,db as l,fb as u,gb as d,hb as f,ib as p,jA as m,kA as h,lb as g,mb as _,oV as v,ob as ee,pb as te,rj as y,sb as b,t as x,ub as S,vb as C,xA as w}from"./api-DRlXTl06.js";import{Gn as T,Kn as E,i as D,o as O,q as ne,r as re}from"./index-D48cFy6f.js";import{a as k,n as A,o as j,r as M,t as N}from"./card-Bf8slN_1.js";import{n as P,t as F}from"./TimeRangePicker-Cq_PGNzt.js";var I=t(e(),1),L={API_CALLS:`api.calls`,API_ERRORS:`api.errors`,API_LATENCY_AVG_MS:`api.latency.avg_ms`,OPENCLAW_INGEST:`openclaw.ingest`,CHAT_SEND:`chat.send`,ASSISTANT_STREAM_ERRORS:`assistant.stream.errors`,ASSISTANT_ANNOUNCE_ERRORS:`assistant.announce.errors`,CONVEX_PROBE_LATENCY_AVG_MS:`convex.probe.latency.avg_ms`},R=Object.keys(L).length,z=n(),B=15,V=e=>String(Math.round(e));function H(){let e=v(x.me.getMe,{host:ne})?.permissions?.includes(`traces.read`)??!1,t=v(x.deliveryTiming.listDeliverySessions,e?{}:`skip`),n=(0,I.useMemo)(()=>t?t.filter(e=>!e.active&&e.rollup!==null&&e.rollup.cP50!==null&&e.rollup.aP50!==null).slice(0,B).reverse().map(e=>({startedAt:e.startedAt,cP50:e.rollup?.cP50,aP50:e.rollup?.aP50})):[],[t]);return t===void 0?null:(0,z.jsxs)(`section`,{className:`oc-kpi__group`,children:[(0,z.jsx)(`h2`,{className:`oc-kpi__group-title`,children:y()}),(0,z.jsxs)(N,{children:[(0,z.jsxs)(k,{children:[(0,z.jsx)(j,{children:i()}),(0,z.jsx)(M,{children:r()})]}),(0,z.jsx)(A,{children:n.length<2?(0,z.jsx)(`p`,{className:`oc-admin__hint`,children:h()}):(0,z.jsx)(U,{series:n})})]})]})}function U({series:e}){let t=e.map(e=>e.cP50),n=e.map(e=>e.aP50),r=Math.max(1,...t,...n),o=t=>6+t*468/(e.length-1),s=e=>74-e*68/r,c=e=>e.map((e,t)=>`${t===0?`M`:`L`}${o(t).toFixed(1)},${s(e).toFixed(1)}`).join(` `),l=e[e.length-1];return(0,z.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,z.jsxs)(`div`,{className:`flex gap-3 text-xs text-muted-foreground`,children:[(0,z.jsxs)(`span`,{style:{color:`var(--primary)`},children:[w(),` p50 `,V(l.cP50),` `,m()]}),(0,z.jsxs)(`span`,{children:[a(),` p50 `,V(l.aP50),` `,m()]})]}),(0,z.jsxs)(`svg`,{viewBox:`0 0 480 80`,className:`h-20 w-full`,preserveAspectRatio:`none`,role:`img`,"aria-label":i(),children:[(0,z.jsx)(`path`,{d:c(n),fill:`none`,style:{stroke:`var(--muted-foreground)`},strokeWidth:1.5}),(0,z.jsx)(`path`,{d:c(t),fill:`none`,style:{stroke:`var(--primary)`},strokeWidth:1.5})]})]})}var W=[{metric:`api.calls`,label:C(),unit:`/h`,group:`API`,isError:!1},{metric:`api.errors`,label:o(),unit:`/h`,group:`API`,isError:!0},{metric:`api.latency.avg_ms`,label:d(),unit:`ms`,group:`API`,isError:!1},{metric:`openclaw.ingest`,label:f(),unit:`/h`,group:`OpenClaw`,isError:!1},{metric:`chat.send`,label:_(),unit:`/h`,group:`Chat`,isError:!1},{metric:L.ASSISTANT_STREAM_ERRORS,label:te(),unit:`/h`,group:`Assistant`,isError:!0},{metric:L.ASSISTANT_ANNOUNCE_ERRORS,label:u(),unit:`/h`,group:`Assistant`,isError:!0}],G=R,K=[`API`,`OpenClaw`,`Chat`,`Assistant`],q=1e3,J=36e5;function Y(e,t){let n=Math.max(1,Math.ceil((t-e)/J)),r=Math.min(n*G,q);return{rowLimit:r,buckets:Math.max(1,Math.floor(r/G))}}function ie(){let e=E({from:`/settings/kpi`}),t=T({from:`/settings/kpi`}),n=D(e.from,e.to,re,`now`),r=e=>void t({search:t=>({...t,...O(e)})}),{from:i,to:a}=P(n),{rowLimit:o,buckets:s}=Y(i,a),u=v(x.kpi.listKpis,{limit:o,filter:{from:i,to:a}}),d=(0,I.useMemo)(()=>{let e=new Map;for(let t of u??[]){let n=e.get(t.metric)??[];n.push({bucket:t.bucket,value:t.value}),e.set(t.metric,n)}for(let[t,n]of e)n.sort((e,t)=>e.bucket<t.bucket?-1:+(e.bucket>t.bucket)),n.length>s&&e.set(t,n.slice(n.length-s));return e},[u,s]),f=(0,z.jsxs)(z.Fragment,{children:[(0,z.jsxs)(`p`,{className:`oc-admin__hint`,children:[l(),` `,(0,z.jsx)(`span`,{className:`oc-filter__window`,children:S()})]}),(0,z.jsx)(ae,{value:n,onChange:r})]});return u===void 0?(0,z.jsxs)(z.Fragment,{children:[f,(0,z.jsx)(H,{}),(0,z.jsx)(`p`,{className:`oc-admin__hint`,children:g()})]}):u.length===0?(0,z.jsxs)(z.Fragment,{children:[f,(0,z.jsx)(H,{}),(0,z.jsx)(`p`,{className:`oc-admin__hint`,children:c()})]}):(0,z.jsxs)(z.Fragment,{children:[f,(0,z.jsx)(H,{}),K.map(e=>{let t=W.filter(t=>t.group===e);return t.some(e=>(d.get(e.metric)??[]).length>0)?(0,z.jsxs)(`section`,{className:`oc-kpi__group`,children:[(0,z.jsx)(`h2`,{className:`oc-kpi__group-title`,children:e}),(0,z.jsx)(`div`,{className:`oc-kpi__grid`,children:t.map(e=>(0,z.jsx)(oe,{config:e,series:d.get(e.metric)??[]},e.metric))})]},e):null})]})}function ae({value:e,onChange:t}){return(0,z.jsx)(`div`,{className:`oc-kpi__toolbar`,children:(0,z.jsx)(F,{value:e,onChange:t})})}function oe({config:e,series:t}){let n=t.length>0?t[t.length-1]:null,r=n?n.value:0;return(0,z.jsxs)(N,{size:`sm`,className:`oc-kpi__card`,children:[(0,z.jsxs)(k,{children:[(0,z.jsx)(j,{className:`oc-kpi__card-title`,children:e.label}),(0,z.jsx)(M,{className:`oc-kpi__card-metric`,children:(0,z.jsx)(`code`,{children:e.metric})})]}),(0,z.jsxs)(A,{className:`oc-kpi__card-body`,children:[(0,z.jsxs)(`div`,{className:`oc-kpi__value-row`,children:[(0,z.jsx)(`span`,{className:`oc-kpi__value`+(e.isError&&r>0?` oc-kpi__value--error`:``),children:Q(r)}),(0,z.jsx)(`span`,{className:`oc-kpi__unit`,children:e.unit})]}),(0,z.jsx)(ce,{series:t,isError:e.isError,unit:e.unit}),(0,z.jsxs)(`div`,{className:`oc-kpi__axis`,children:[n?(0,z.jsx)(`span`,{className:`oc-kpi__axis-latest`,children:b({value:$(n.bucket)})}):(0,z.jsx)(`span`,{className:`oc-kpi__muted`,children:ee()}),(0,z.jsx)(`span`,{className:`oc-kpi__muted`,children:s({count:t.length})})]})]})]})}var X=240,Z=48,se=1;function ce({series:e,isError:t,unit:n}){if(e.length===0)return(0,z.jsx)(`div`,{className:`oc-kpi__chart oc-kpi__chart--empty`,"aria-hidden":!0});let r=e.reduce((e,t)=>t.value>e?t.value:e,0),i=X/e.length,a=Math.max(i-se,1);return(0,z.jsx)(`svg`,{className:`oc-kpi__chart`,viewBox:`0 0 ${X} ${Z}`,preserveAspectRatio:`none`,role:`img`,"aria-label":p({max:Q(r),unit:n}),children:e.map((e,o)=>{let s=r>0?e.value/r*(Z-1):0,c=o*i,l=Z-s;return(0,z.jsx)(`rect`,{className:`oc-kpi__bar`+(t&&e.value>0?` oc-kpi__bar--error`:``),x:c,y:l,width:a,height:s,children:(0,z.jsxs)(`title`,{children:[$(e.bucket),` · `,Q(e.value),` `,n]})},e.bucket)})})}function Q(e){return Number.isFinite(e)?Math.abs(e)>=1e3?(e/1e3).toFixed(e%1e3==0?0:1)+`k`:String(e):`0`}function $(e){let t=new Date(`${e}:00:00Z`);return Number.isNaN(t.getTime())?e:`${String(t.getUTCDate()).padStart(2,`0`)}/${String(t.getUTCMonth()+1).padStart(2,`0`)} ${String(t.getUTCHours()).padStart(2,`0`)}h`}export{ie as KpiTab};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$F as r,$n as i,AB as a,AF as o,BB as s,BF as c,CB as l,CF as u,DB as d,DF as f,EB as p,EF as m,FB as h,FF as ee,GF as te,HB as ne,HF as re,IB as ie,IF as ae,JF as oe,Jn as se,KB as ce,KF as le,LB as ue,LD as de,LF as fe,MB as pe,MF as me,NB as he,NF as ge,OB as _e,OF as ve,PB as g,PF as _,QF as v,Qn as y,RB as b,RF as x,SB as S,SF as C,TB as w,TF as T,UB as E,UF as D,VB as O,VF as k,WF as A,XF as j,Xn as M,YF as N,Yn as P,ZB as F,ZF as ye,Zn as be,_F as xe,aV as I,bB as Se,bF as Ce,eI as we,er as Te,gF as Ee,hr as De,jB as Oe,jF as ke,kB as Ae,kF as L,lr as je,mr as Me,oV as R,qF as Ne,r as z,t as B,tI as Pe,tr as Fe,vF as Ie,wB as Le,wF as Re,xB as ze,xF as Be,yF as Ve,zB as He,zF as Ue}from"./api-DRlXTl06.js";import{t as V}from"./button-CTuIl1H-.js";import{$ as We,At as Ge,Dt as Ke,Et as H,Ot as qe,Q as U,V as Je,X as Ye,Z as Xe,et as Ze,jt as W,kt as Qe,q as G,t as $e,ut as K}from"./index-D48cFy6f.js";import{t as et}from"./localePickerView-C2RmOS86.js";import{t as tt}from"./TimezoneCombobox-n6rUGOTZ.js";var q=t(e(),1),J=n();function nt({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:z(`peer inline-flex h-5 w-9 shrink-0 items-center rounded-full border border-transparent transition-colors outline-none`,`focus-visible:ring-2 focus-visible:ring-ring/50`,`disabled:cursor-not-allowed disabled:opacity-50`,t?`bg-primary`:`bg-input`,e),...i,children:(0,J.jsx)(`span`,{className:z(`pointer-events-none block size-4 rounded-full bg-background shadow transition-transform`,t?`translate-x-[18px]`:`translate-x-[2px]`)})})}var Y=[{id:`messages`,label:()=>Pe()},{id:`composer`,label:()=>we()},{id:`sidebar`,label:()=>r()},{id:`notifications`,label:()=>ae()},{id:`other`,label:()=>v()}],X={showSource:{category:`messages`,label:()=>ye(),help:()=>j()},showReport:{category:`messages`,label:()=>N(),help:()=>oe()},copyAssistant:{category:`messages`,label:()=>Ne()},copyUser:{category:`messages`,label:()=>le()},showDelete:{category:`messages`,label:()=>te()},showTools:{category:`messages`,label:()=>A(),help:()=>D()},voiceInput:{category:`composer`,label:()=>re(),help:()=>k()},showUsage:{category:`composer`,label:()=>c(),help:()=>Ue()},autoReadAloud:{category:`composer`,label:()=>De(),help:()=>Me()},showChatAge:{category:`sidebar`,label:()=>x(),help:()=>fe()},notifSound:{category:`notifications`,label:()=>ee(),help:()=>_()},notifSystem:{category:`notifications`,label:()=>ge(),help:()=>me()},replySound:{category:`notifications`,label:()=>ke(),help:()=>o()}};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 rt=[`showSource`,`showReport`,`copyAssistant`,`copyUser`,`showDelete`,`showTools`,`voiceInput`,`showChatAge`,`showUsage`,`autoReadAloud`,`notifSound`,`notifSystem`,`replySound`],it={voiceInput:`voiceInput`};function at(e){return rt.includes(e)}function $(e){return e===`admin`}function ot(e){return e===!0?`on`:e===!1?`off`:`inherit`}function st(e){return e===`on`?!0:e===`off`?!1:null}function ct(e){return at(e)?it[e]:void 0}var lt={voiceInput:()=>Ce()};function ut({prefKey:e,ui:t}){let n=I(B.admin.setUiPrefDefault),r=I(B.admin.setFeatureEnabled),i=ct(e),a=i?lt[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:Re()}),(0,J.jsxs)(Ye,{value:ot(t.defaults[e]),onValueChange:t=>void n({key:e,value:st(t)}),children:[(0,J.jsx)(We,{size:`sm`,className:`w-36`,children:(0,J.jsx)(Ze,{})}),(0,J.jsxs)(Xe,{children:[(0,J.jsx)(U,{value:`on`,children:Ie()}),(0,J.jsx)(U,{value:`off`,children:xe()}),(0,J.jsx)(U,{value:`inherit`,children:Ee()})]})]}),i?(0,J.jsxs)(`span`,{className:`oc-prefs__gov-gate`,children:[(0,J.jsx)(K,{checked:t.featuresEnabled[i]===!0,onCheckedChange:e=>void r({key:i,enabled:e===!0}),"aria-label":u()}),u()]}):null]}),a?(0,J.jsx)(`span`,{className:`oc-prefs__gov-help`,children:a}):null]})}function dt({current:e,enabled:t}){let n=I(B.me.setDictationShortcut),[r,a]=(0,q.useState)(!1),[o,s]=(0,q.useState)(!1);return(0,q.useEffect)(()=>{if(!r)return;let e=e=>{if(e.preventDefault(),e.stopPropagation(),e.key===`Escape`){a(!1);return}let t=Qe(e);if(t===null){[`Shift`,`Control`,`Meta`,`Alt`].includes(e.key)||(s(!0),window.setTimeout(()=>s(!1),1800));return}a(!1),n({shortcut:t})};return window.addEventListener(`keydown`,e,!0),()=>window.removeEventListener(`keydown`,e,!0)},[r,n]),(0,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:[Fe(),e?(0,J.jsx)(H,{variant:`secondary`,children:Ge(e,qe())}):null]}),(0,J.jsx)(`span`,{className:`oc-prefs__help`,children:o?y():r?i():Te()})]}),(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:se()}):null,(0,J.jsx)(`button`,{type:`button`,className:`oc-prefs__reset`,disabled:!t,"aria-pressed":r,onClick:()=>a(e=>!e),children:r?P():e?M():be()})]})]})}function ft(){let[e,t]=(0,q.useState)(``),[n,r]=(0,q.useState)(!1),i=R(B.me.getMe,{host:G}),a=i?.ui,o=$(i?.role)&&n,s=I(B.me.setUiPref).withOptimisticUpdate(Je),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)(K,{checked:n,onCheckedChange:e=>r(e===!0),"aria-label":T()}),T()]}):null,o?(0,J.jsxs)(`div`,{className:`oc-prefs__gov-head`,children:[(0,J.jsx)(`p`,{children:C()}),(0,J.jsx)(`p`,{children:Be()}),(0,J.jsx)(`p`,{children:Ve()})]}):null,(0,J.jsx)(W,{value:e,onChange:e=>t(e.target.value),placeholder:L(),"aria-label":L(),className:`mb-2`}),c.length===0?(0,J.jsx)(`div`,{className:`oc-prefs__empty`,children:ve()}):(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)(H,{variant:`outline`,children:f()}):l?(0,J.jsx)(H,{variant:`secondary`,children:je()}):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:m()}):null,(0,J.jsx)(nt,{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)(ut,{prefKey:e,ui:a}):null]},e)})]},e.id))}),(0,J.jsx)(dt,{current:i?.dictationShortcut??null,enabled:a.effective.voiceInput===!0})]}):(0,J.jsx)(`div`,{className:`oc-prefs__empty`,children:F()})}var pt={sm:()=>Oe(),md:()=>a(),lg:()=>Ae(),xl:()=>_e(),"2xl":()=>d(),"3xl":()=>p()};function mt(){let e=R(B.me.getMe,{host:G}),t=I(B.me.setLocale),n=I(B.me.setTimezone),r=I(B.me.setFontScale).withOptimisticUpdate((e,{scale:t})=>{let n=e.getQuery(B.me.getMe,{host:G});n&&e.setQuery(B.me.getMe,{host:G},{...n,fontScale:t,resolvedFontScale:t??`md`})}),i=I(B.me.setMyName),a=Ke(),o=e?.locale??`default`,c=e?.name??``,[u,d]=(0,q.useState)(null),f=u??c,p=f.trim()!==c.trim();async function m(){try{await i({name:f}),d(null),a.success(He())}catch(e){a.error(b(),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:E()}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:ne()})]}),(0,J.jsxs)(`div`,{className:`oc-show__row`,children:[(0,J.jsx)(W,{className:`max-w-xs`,value:f,maxLength:120,placeholder:O(),onChange:e=>d(e.target.value),onKeyDown:e=>{e.key===`Enter`&&p&&(e.preventDefault(),m())}}),(0,J.jsx)(V,{size:`sm`,disabled:!p,onClick:()=>void m(),children:de()})]}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:s()})]}),(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:ue()}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:ie()})]}),(0,J.jsxs)(`div`,{className:`oc-show__row`,children:[et().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:ce()})]}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:h()})]}),(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:w()}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:Le()})]}),(0,J.jsxs)(`div`,{className:`oc-show__row`,children:[(0,J.jsx)(tt,{value:e?.timezone??``,onChange:e=>void n({timezone:e})}),(0,J.jsx)(V,{variant:e?.timezone===null||e?.timezone===void 0?`default`:`outline`,size:`sm`,onClick:()=>void n({timezone:null}),children:l()})]}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:S()})]}),(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:g()}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:he()})]}),(0,J.jsx)(`div`,{className:`oc-show__row`,children:$e.map(t=>(0,J.jsx)(V,{variant:(e?.fontScale??`md`)===t?`default`:`outline`,size:`sm`,onClick:()=>void r({scale:t}),children:pt[t]()},t))}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:pe()})]}),(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:ze()}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:Se()})]}),(0,J.jsx)(ft,{})]})]})}export{mt as PreferencesTab};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$v as r,By as i,Ct as a,Cy as o,D as s,Ey as c,Fv as l,Fy as u,Hv as d,Iv as f,Jv as p,Lv as ee,My as m,Nv as te,Oy as h,Pv as g,Py as _,Qv as v,Rg as y,Rv as b,St as ne,Sy as re,Ty as ie,Uv as ae,Vv as x,Vy as oe,Xv as se,Yv as ce,ZB as S,_y as le,aV as C,ay as ue,by as de,cy as fe,dy as w,ey as pe,fy as T,gy as me,iy as he,jv as E,jy as ge,ly as _e,my as ve,ny as ye,oV as D,oy as O,py as k,qv as be,ry as xe,sy as A,t as j,ty as M,uy as Se,vy as Ce,wy as we,yy as N,zv as Te,zy as Ee}from"./api-DRlXTl06.js";import{t as De}from"./list-CntaIhDp.js";import{t as P}from"./button-CTuIl1H-.js";import{A as Oe,An as ke,Bn as Ae,C as je,D as Me,Dt as Ne,E as Pe,Ft as Fe,Gn as F,Hn as Ie,It as Le,J as Re,Kn as ze,Lt as Be,Mn as Ve,Mt as He,Nn as Ue,Nt as We,O as I,P as Ge,Pn as Ke,Pt as L,S as qe,Sn as Je,T as Ye,Tn as Xe,U as Ze,W as Qe,Y as $e,_ as et,b as R,bn as tt,d as nt,dn as rt,f as it,g as z,h as B,j as V,jn as H,jt as U,k as at,kn as W,m as ot,p as st,qn as ct,v as G,vn as lt,w as ut,wn as dt,x as K,y as ft,yn as q}from"./index-D48cFy6f.js";var pt=s(`columns-3`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M9 3v18`,key:`fh3hqa`}],[`path`,{d:`M15 3v18`,key:`14nvp0`}]]),mt=s(`folder-input`,[[`path`,{d:`M2 9V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2v-1`,key:`fm4g5t`}],[`path`,{d:`M2 13h10`,key:`pgb2dq`}],[`path`,{d:`m9 16 3-3-3-3`,key:`6m91ic`}]]),ht=s(`layout-grid`,[[`rect`,{width:`7`,height:`7`,x:`3`,y:`3`,rx:`1`,key:`1g98yp`}],[`rect`,{width:`7`,height:`7`,x:`14`,y:`3`,rx:`1`,key:`6d4xhi`}],[`rect`,{width:`7`,height:`7`,x:`14`,y:`14`,rx:`1`,key:`nxv5o0`}],[`rect`,{width:`7`,height:`7`,x:`3`,y:`14`,rx:`1`,key:`1bb6yr`}]]),J=s(`panel-left`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M9 3v18`,key:`fh3hqa`}]]),Y=t(e(),1),X=n();function gt({className:e}){return(0,X.jsx)(Be,{asChild:!0,children:(0,X.jsx)(P,{variant:`ghost`,size:`icon-xs`,"aria-label":Te(),className:e,onClick:e=>e.stopPropagation(),onMouseDown:e=>e.stopPropagation(),onTouchStart:e=>e.stopPropagation(),onPointerDown:e=>e.stopPropagation(),children:(0,X.jsx)(Ke,{})})})}function Z({folderId:e,name:t,color:n,currentParentId:r,className:a,onOpen:s}){let u=C(j.projects.renameProject),f=C(j.projects.setProjectColor),p=C(j.projects.moveProject),ee=C(j.projects.deleteProject),m=C(j.projects.createProject),te=Ze(),h=Qe(),[_,v]=(0,Y.useState)(!1),[y,ne]=(0,Y.useState)(t),[ae,se]=(0,Y.useState)(!1),[S,le]=(0,Y.useState)(!1),ue=D(j.projects.projectTreeCount,S?{projectId:e}:`skip`);return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(He,{onOpenChange:e=>e&&le(!0),children:[(0,X.jsx)(gt,{className:a}),(0,X.jsxs)(We,{align:`end`,className:`w-48`,onClick:e=>e.stopPropagation(),children:[(0,X.jsxs)(L,{onSelect:()=>s(),children:[(0,X.jsx)(H,{}),` `,re()]}),(0,X.jsxs)(L,{onSelect:()=>{ne(t),v(!0)},children:[(0,X.jsx)(tt,{}),` `,b()]}),(0,X.jsxs)(L,{onSelect:()=>{requestAnimationFrame(async()=>{let t=await h({title:k(),label:oe(),placeholder:i(),confirmLabel:Ee()});t&&await m({name:t,parentId:e})})},children:[(0,X.jsx)(ke,{}),` `,k()]}),(0,X.jsxs)(L,{onSelect:()=>se(!0),children:[(0,X.jsx)(mt,{}),` `,ce()]}),(0,X.jsx)(Fe,{children:l()}),(0,X.jsxs)(`div`,{className:`oc-colorgrid`,onClick:e=>e.stopPropagation(),children:[(0,X.jsx)(`button`,{className:`oc-colorgrid__none`,onClick:()=>void f({projectId:e,color:null}),"aria-label":g(),children:`✕`}),ot.map(t=>(0,X.jsx)(`button`,{className:`oc-colorgrid__dot`+(n===t.value?` is-selected`:``),style:{background:t.hue},"aria-label":t.value,onClick:()=>void f({projectId:e,color:t.value})},t.value))]}),(0,X.jsx)(Le,{}),(0,X.jsxs)(L,{variant:`destructive`,onSelect:()=>{requestAnimationFrame(async()=>{let n=ue?.folders??0,r=ue?.chats??0;await te({title:ie({name:t}),description:n>0?o({folders:n,chats:r}):r>0?we({count:r}):d(),confirmWord:x(),confirmLabel:c(),destructive:!0})&&await ee({projectId:e})})},children:[(0,X.jsx)(rt,{}),` `,x()]})]})]}),(0,X.jsx)(et,{open:_,onOpenChange:v,title:ge(),canSubmit:y.trim().length>0,onSubmit:async()=>{await u({projectId:e,name:y.trim()}),v(!1)},submitLabel:b(),children:(0,X.jsx)(U,{value:y,onChange:e=>ne(e.target.value),autoFocus:!0})}),ae?(0,X.jsx)(st,{open:ae,onOpenChange:se,title:be(),movingFolderId:e,currentId:r,onPick:t=>void p({projectId:e,parentId:t})}):null]})}function Q({chat:e,currentFolderId:t,className:n}){let r=C(j.chats.pinChat),i=C(j.chats.deleteChat),a=C(j.chats.renameChat),o=C(j.chats.setChatSidebar),s=C(j.chats.moveChatToProject),c=Ze(),[l,u]=(0,Y.useState)(!1),[m,h]=(0,Y.useState)(e.title??``),[g,_]=(0,Y.useState)(!1);return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(He,{children:[(0,X.jsx)(gt,{className:n}),(0,X.jsxs)(We,{align:`end`,className:`w-52`,onClick:e=>e.stopPropagation(),children:[(0,X.jsxs)(L,{onSelect:()=>{h(e.title??``),u(!0)},children:[(0,X.jsx)(tt,{}),` `,b()]}),(0,X.jsxs)(L,{onSelect:()=>void r({chatId:e._id,pinned:!e.pinned}),children:[e.pinned?(0,X.jsx)(lt,{}):(0,X.jsx)(q,{}),e.pinned?ee():f()]}),(0,X.jsxs)(L,{onSelect:()=>_(!0),children:[(0,X.jsx)(mt,{}),` `,se()]}),e.pinned&&e.inSidebar?null:(0,X.jsxs)(L,{onSelect:()=>void o({chatId:e._id,hidden:e.inSidebar}),children:[e.inSidebar?(0,X.jsx)(Je,{}):(0,X.jsx)(J,{}),e.inSidebar?N():de()]}),(0,X.jsx)(Le,{}),(0,X.jsxs)(L,{variant:`destructive`,onSelect:()=>{requestAnimationFrame(async()=>{await c({title:te(),description:d(),confirmLabel:x(),destructive:!0})&&await i({chatId:e._id})})},children:[(0,X.jsx)(rt,{}),` `,x()]})]})]}),(0,X.jsx)(et,{open:l,onOpenChange:u,title:E(),canSubmit:m.trim().length>0,onSubmit:async()=>{await a({chatId:e._id,title:m.trim()}),u(!1)},submitLabel:b(),children:(0,X.jsx)(U,{value:m,onChange:e=>h(e.target.value),autoFocus:!0})}),g?(0,X.jsx)(st,{open:g,onOpenChange:_,title:p(),currentId:t,onPick:t=>void s({chatId:e._id,projectId:t})}):null]})}function _t(e,t){let n=t.trim().toLowerCase();return n===``?e:e.filter(e=>(e.title??``).toLowerCase().includes(n))}function vt(e,t,n,r,i){let a=e.map(t),o=a.indexOf(i);if(o<0)return null;let s=a.indexOf(r);if(s>=0){let t=[...e],[r]=t.splice(s,1);t.splice(o,0,r);let i=t[o-1],a=t[o+1];return{prevKey:i===void 0?null:n(i),nextKey:a===void 0?null:n(a)}}let c=e[o-1];return{prevKey:c===void 0?null:n(c),nextKey:n(e[o])}}function yt(e,t){let n=new Map(t.map(e=>[e.chatId,e.lastSeenAt])),r=new Set;for(let t of e){let e=n.get(t._id);e!==void 0&&t.lastAssistantAt!==null&&t.lastAssistantAt>e&&r.add(t._id)}return r}var bt=`oc.projpage.view`;function xt(){let e=localStorage.getItem(bt);return e===`cards`||e===`list`?e:`columns`}var $=e=>`into:${e}`,St=e=>`col:${e??`null`}`,Ct=e=>`crumb:${e}`;function wt(e){if(e.startsWith(`into:`))return e.slice(5);if(e.startsWith(`crumb:`))return e.slice(6);if(e.startsWith(`col:`)){let t=e.slice(4);return t===`null`?null:t}}function Tt(){let{projectId:e}=ct({from:`/project/$projectId`}),t=F(),n=D(j.projects.projectPage,{projectId:e});return(0,X.jsx)(`div`,{className:`oc-projpage`,children:n===void 0?(0,X.jsx)(`p`,{className:`oc-projpage__hint`,children:S()}):n===null?(0,X.jsxs)(`div`,{className:`oc-projpage__notfound`,children:[(0,X.jsx)(`h2`,{children:M()}),(0,X.jsx)(`p`,{className:`oc-projpage__hint`,children:pe()}),(0,X.jsx)(P,{variant:`outline`,onClick:()=>void t({to:`/`}),children:r()})]}):(0,X.jsx)(Et,{page:n})})}function Et({page:e}){let t=F(),n=Ze(),r=Qe(),s=Ne(),f=C(j.projects.renameProject),p=C(j.projects.setProjectColor),ee=C(j.projects.deleteProject),te=C(j.projects.createProject),h=C(j.projects.moveProject),_=C(j.projects.setProjectSidebar),re=C(j.chats.moveChatToProject),se=C(j.chats.reorderChat),S=C(j.projects.reorderProject),de=D(j.projects.projectTreeCount,{projectId:e.project._id}),[w,pe]=(0,Y.useState)(xt),T=e=>{localStorage.setItem(bt,e),pe(e)},E=D(j.projects.folderColumns,w===`columns`?{projectId:e.project._id}:`skip`),O=D(j.projects.projectTreeList,w===`list`?{projectId:e.project._id}:`skip`),{c:A}=ze({from:`/project/$projectId`}),M=D(j.projects.listProjects,{}),N=D(j.chatReads.myBusyChats,{}),Te=(0,Y.useMemo)(()=>new Set(N??[]),[N]),Ae=D(j.chatReads.myChatReads,{}),Ie=(0,Y.useMemo)(()=>yt(e.chats,Ae??[]),[e.chats,Ae]),{startNewChat:I,picker:Je}=nt(e=>void t({to:`/chat/$chatId`,params:{chatId:e}})),[R,it]=(0,Y.useState)(``),[B,V]=(0,Y.useState)(!1),[H,ct]=(0,Y.useState)(e.project.name),[lt,q]=(0,Y.useState)(!1),[J,gt]=(0,Y.useState)(``);(0,Y.useEffect)(()=>{let e=setTimeout(()=>gt(R.trim()),180);return()=>clearTimeout(e)},[R]);let Z=D(j.search.searchConversations,J.length>=2?{query:J,projectId:e.project._id}:`skip`),Q=Oe(at(ut,{activationConstraint:{distance:4}}),at(Ye,{activationConstraint:{delay:250,tolerance:8}})),$=(0,Y.useRef)(!1),St=()=>{$.current=!0,setTimeout(()=>{$.current=!1},0)},[Ct,Tt]=(0,Y.useState)(null),Et=t=>{if(t.startsWith(`chat:`)){let n=t.slice(5),r=e.chats.find(e=>e._id===n),i=E?.columns.flatMap(e=>e.chats).find(e=>e._id===n);return{kind:`chat`,label:(r??i)?.title||u()}}if(t.startsWith(`folder:`)){let e=t.slice(7);return{kind:`folder`,label:(M??[]).find(t=>t._id===e)?.name??``}}return null},kt=e=>Tt(Et(String(e.active.id))),jt=(0,Y.useCallback)(e=>{let t=String(e.active.id).startsWith(`folder:`),n=t=>({...e,droppableContainers:e.droppableContainers.filter(e=>String(e.id).startsWith(t))}),r=Me(n(`into:`));if(r.length>0){if(!t)return r;let n=r[0],i=e.droppableRects.get(n.id),a=e.pointerCoordinates?.y;if(i&&a!=null){let e=i.height*.3;if(a>i.top+e&&a<i.top+i.height-e)return r}}let i=Me(n(t?`folder:`:`chat:`));if(i.length>0)return i;let a=Me(n(`crumb:`));if(a.length>0)return a;let o=Me(n(`col:`));return o.length>0?o:Pe(n(t?`folder:`:`chat:`))},[]),Nt=t=>{if(w===`columns`){for(let e of E?.columns??[])if(e.chats.some(e=>e._id===t))return{list:e.chats,folderId:e.folderId};return null}if(w===`list`){let e=O?.chats.find(e=>e._id===t);return e?{list:O.chats.filter(t=>t.folderId===e.folderId),folderId:e.folderId}:null}return e.chats.some(e=>e._id===t)?{list:e.chats,folderId:e.project._id}:null},Pt=t=>{if(w===`columns`){for(let e of E?.columns??[])if(e.folders.some(e=>e._id===t))return{list:e.folders,parentId:e.folderId};return null}if(w===`list`){let e=O?.folders.find(e=>e._id===t);if(!e||!O)return null;let n=e.parentId??O.rootId;return{list:$e(O.folders,e.parentId),parentId:n}}return e.children.some(e=>e._id===t)?{list:e.children,parentId:e.project._id}:null},It=async e=>{Tt(null),St();let{active:t,over:n}=e;if(!n)return;let r=String(n.id),i=String(t.id),a=i.startsWith(`chat:`);try{let e=wt(r);if(e!==void 0){if(a)await re({chatId:i.slice(5),projectId:e});else{let t=i.slice(7);if(t===e)return;if(!Re(M??[],t,e)){s.error(ve());return}await h({projectId:t,parentId:e})}return}if(a&&r.startsWith(`chat:`)){let e=i.slice(5),t=r.slice(5);if(e===t)return;let n=Nt(t);if(!n)return;n.list.some(t=>t._id===e)||await re({chatId:e,projectId:n.folderId});let a=vt(n.list,e=>e._id,e=>e.sortKey,e,t);a&&await se({chatId:e,...a});return}if(!a&&r.startsWith(`folder:`)){let e=i.slice(7),t=r.slice(7);if(e===t)return;let n=Pt(t);if(!n)return;if(!n.list.some(t=>t._id===e)){if(!Re(M??[],e,n.parentId)){s.error(ve());return}await h({projectId:e,parentId:n.parentId})}let a=vt(n.list,e=>e._id,e=>e.sortKey,e,t);a&&await S({projectId:e,...a});return}}catch{s.error(ve())}},[,Lt]=(0,Y.useState)(0);(0,Y.useEffect)(()=>{let e=window.setInterval(()=>Lt(e=>e+1),6e4);return()=>window.clearInterval(e)},[]);let Rt=Date.now(),zt=z(e.project),Bt=_t(e.chats,R),Vt=e.breadcrumb.slice(0,-1),Ht=e=>()=>{$.current||e()};return(0,X.jsxs)(qe,{sensors:Q,collisionDetection:jt,onDragStart:kt,onDragEnd:It,children:[(0,X.jsxs)(`div`,{className:`oc-projpage__body`,style:{"--proj-hue":zt},children:[(0,X.jsxs)(`nav`,{className:`oc-projpage__crumbs`,"aria-label":v(),children:[Vt.map(e=>(0,X.jsxs)(`span`,{className:`oc-projpage__crumb`,children:[(0,X.jsx)(Dt,{folderId:e._id,children:(0,X.jsx)(`button`,{type:`button`,className:`oc-projpage__crumblink`,onClick:Ht(()=>void t({to:`/project/$projectId`,params:{projectId:e._id}})),children:e.name})}),(0,X.jsx)(`span`,{className:`oc-projpage__crumbsep`,"aria-hidden":!0,children:`›`})]},e._id)),(0,X.jsx)(`span`,{className:`oc-projpage__crumbcur`,children:e.project.name})]}),(0,X.jsxs)(`header`,{className:`oc-projpage__head`,children:[(0,X.jsx)(`span`,{className:`oc-projpage__dot`,"aria-hidden":!0}),(0,X.jsx)(`h1`,{className:`oc-projpage__title`,children:e.project.name}),e.project.sidebarHidden?(0,X.jsxs)(P,{variant:`ghost`,size:`sm`,className:`oc-projpage__hiddenbadge`,title:a(),onClick:()=>{_({projectId:e.project._id,hidden:!1})},children:[(0,X.jsx)(Ue,{"aria-hidden":!0}),(0,X.jsx)(`span`,{children:ne()}),(0,X.jsx)(Ve,{"aria-hidden":!0})]}):null,(0,X.jsxs)(`div`,{className:`oc-projpage__actions`,children:[(0,X.jsxs)(`div`,{className:`oc-projpage__viewtoggle`,role:`group`,"aria-label":Ce(),children:[(0,X.jsx)(P,{variant:w===`cards`?`secondary`:`ghost`,size:`icon-sm`,"aria-label":Ce(),title:Ce(),"aria-pressed":w===`cards`,onClick:()=>T(`cards`),children:(0,X.jsx)(ht,{})}),(0,X.jsx)(P,{variant:w===`columns`?`secondary`:`ghost`,size:`icon-sm`,"aria-label":le(),title:le(),"aria-pressed":w===`columns`,onClick:()=>T(`columns`),children:(0,X.jsx)(pt,{})}),(0,X.jsx)(P,{variant:w===`list`?`secondary`:`ghost`,size:`icon-sm`,"aria-label":me(),title:me(),"aria-pressed":w===`list`,onClick:()=>T(`list`),children:(0,X.jsx)(De,{})})]}),(0,X.jsxs)(P,{variant:`outline`,size:`sm`,onClick:()=>void I({projectId:e.project._id}),children:[(0,X.jsx)(Xe,{}),fe()]}),(0,X.jsxs)(P,{variant:`outline`,size:`sm`,onClick:async()=>{let t=await r({title:k(),label:oe(),placeholder:i(),confirmLabel:Ee()});t&&await te({name:t,parentId:e.project._id})},children:[(0,X.jsx)(ke,{}),k()]}),(0,X.jsxs)(He,{children:[(0,X.jsx)(Be,{asChild:!0,children:(0,X.jsx)(P,{variant:`ghost`,size:`icon-sm`,"aria-label":m(),children:(0,X.jsx)(Ke,{})})}),(0,X.jsxs)(We,{align:`end`,className:`w-48`,children:[(0,X.jsxs)(L,{onSelect:()=>{ct(e.project.name),V(!0)},children:[(0,X.jsx)(tt,{}),` `,b()]}),(0,X.jsxs)(L,{onSelect:()=>q(!0),children:[(0,X.jsx)(mt,{}),` `,ce()]}),(0,X.jsx)(Fe,{children:l()}),(0,X.jsxs)(`div`,{className:`oc-colorgrid`,children:[(0,X.jsx)(`button`,{className:`oc-colorgrid__none`,onClick:()=>void p({projectId:e.project._id,color:null}),"aria-label":g(),children:`✕`}),ot.map(t=>(0,X.jsx)(`button`,{className:`oc-colorgrid__dot`+(e.project.color===t.value?` is-selected`:``),style:{background:t.hue},"aria-label":t.value,onClick:()=>void p({projectId:e.project._id,color:t.value})},t.value))]}),(0,X.jsx)(Le,{}),(0,X.jsxs)(L,{variant:`destructive`,onSelect:()=>{let r=e.project.parentId;requestAnimationFrame(async()=>{let i=de?.folders??0,a=de?.chats??0;await n({title:ie({name:e.project.name}),description:i>0?o({folders:i,chats:a}):a>0?we({count:a}):d(),confirmWord:x(),confirmLabel:c(),destructive:!0})&&(await ee({projectId:e.project._id}),t(r===null?{to:`/`}:{to:`/project/$projectId`,params:{projectId:r}}))})},children:[(0,X.jsx)(rt,{}),` `,x()]})]})]})]})]}),w===`columns`?(0,X.jsx)(Ft,{data:E,currentId:e.project._id,busyIds:Te,suppressClick:$,locateChatId:A??null}):w===`list`?(0,X.jsx)(Mt,{data:O,busyIds:Te,suppressClick:$,locateChatId:A??null}):(0,X.jsxs)(X.Fragment,{children:[e.children.length>0?(0,X.jsxs)(`section`,{className:`oc-projpage__section`,children:[(0,X.jsx)(`h2`,{className:`oc-projpage__subtitle`,children:Se()}),(0,X.jsx)(`div`,{className:`oc-projpage__cards`,children:(0,X.jsx)(G,{items:e.children.map(e=>`folder:${e._id}`),strategy:ft,children:e.children.map(t=>(0,X.jsx)(Ot,{child:t,parentId:e.project._id,now:Rt,suppressClick:$},t._id))})})]}):null,(0,X.jsxs)(`section`,{className:`oc-projpage__section`,children:[(0,X.jsxs)(`div`,{className:`oc-projpage__convhead`,children:[(0,X.jsx)(`h2`,{className:`oc-projpage__subtitle`,children:_e()}),e.chats.length>0?(0,X.jsx)(U,{value:R,onChange:e=>it(e.target.value),placeholder:ue(),className:`oc-projpage__filter`}):null]}),e.chats.length===0?(0,X.jsx)(`p`,{className:`oc-projpage__hint`,children:e.children.length===0?xe():ye()}):Bt.length===0&&(Z??[]).length===0?(0,X.jsx)(`p`,{className:`oc-projpage__hint`,children:he({term:R.trim()})}):(0,X.jsx)(`ul`,{className:`oc-projpage__chats`,children:(0,X.jsx)(G,{items:Bt.map(e=>`chat:${e._id}`),strategy:K,children:Bt.map(t=>(0,X.jsx)(At,{chat:t,currentFolderId:e.project._id,now:Rt,busy:Te.has(t._id),unread:Ie.has(t._id),locate:t._id===A,suppressClick:$},t._id))})})]}),J.length>=2&&Z!==void 0?(0,X.jsxs)(`section`,{className:`oc-projpage__section`,children:[(0,X.jsx)(`h2`,{className:`oc-projpage__subtitle`,children:ae()}),Z.length===0?(0,X.jsx)(`p`,{className:`oc-projpage__hint`,children:he({term:J})}):(0,X.jsx)(`ul`,{className:`oc-projpage__chats`,children:Z.map(e=>(0,X.jsx)(`li`,{className:`oc-projpage__chatrow`,children:(0,X.jsxs)(`button`,{type:`button`,className:`oc-projpage__chatbtn`,onClick:()=>{e.messageId&&J&&Ge(e.messageId,J),t({to:`/chat/$chatId`,params:{chatId:e.chatId},...e.messageId?{search:{m:e.messageId}}:{}})},children:[(0,X.jsx)(dt,{size:13,"aria-hidden":!0,className:`oc-projpage__hitico`}),(0,X.jsxs)(`span`,{className:`oc-projpage__hitbody`,children:[(0,X.jsx)(`span`,{className:`oc-projpage__chattitle`,children:e.title||y()}),e.projectPath&&e.projectPath.length>1?(0,X.jsx)(`span`,{className:`oc-projpage__hitpath`,children:e.projectPath.join(` › `)}):null,e.snippet?(0,X.jsx)(`span`,{className:`oc-projpage__hitsnippet`,children:e.snippet}):null]})]})},`${e.chatId}:${e.messageId??`t`}`))})]}):null]}),(0,X.jsx)(et,{open:B,onOpenChange:V,title:ge(),canSubmit:H.trim().length>0,onSubmit:async()=>{await f({projectId:e.project._id,name:H.trim()}),V(!1)},submitLabel:b(),children:(0,X.jsx)(U,{value:H,onChange:e=>ct(e.target.value),autoFocus:!0})}),lt?(0,X.jsx)(st,{open:lt,onOpenChange:q,title:be(),movingFolderId:e.project._id,currentId:e.project.parentId,onPick:t=>void h({projectId:e.project._id,parentId:t})}):null,Je]}),(0,X.jsx)(je,{children:Ct?(0,X.jsxs)(`div`,{className:`oc-projpage__dragghost`,children:[Ct.kind===`folder`?(0,X.jsx)(W,{size:13,"aria-hidden":!0}):(0,X.jsx)(dt,{size:13,"aria-hidden":!0}),(0,X.jsx)(`span`,{children:Ct.label})]}):null})]})}function Dt({folderId:e,children:t}){let{setNodeRef:n,isOver:r}=I({id:Ct(e)});return(0,X.jsx)(`span`,{ref:n,className:r?`oc-projpage__cdrop is-over`:`oc-projpage__cdrop`,children:t})}function Ot({child:e,parentId:t,now:n,suppressClick:r}){let i=F(),a=R({id:`folder:${e._id}`}),o=I({id:$(e._id)});return(0,X.jsxs)(`div`,{ref:e=>{a.setNodeRef(e),o.setNodeRef(e)},className:`oc-projpage__card`+(o.isOver?` is-over`:``)+(a.isDragging?` is-dragging`:``),style:{"--proj-hue":z(e),transform:V.Transform.toString(a.transform),transition:a.transition},onClick:()=>{r.current||i({to:`/project/$projectId`,params:{projectId:e._id}})},onKeyDown:t=>{t.key===`Enter`&&i({to:`/project/$projectId`,params:{projectId:e._id}})},...a.listeners,...a.attributes,role:`link`,tabIndex:0,children:[(0,X.jsxs)(`span`,{className:`oc-projpage__cardhead`,children:[(0,X.jsx)(W,{size:15,"aria-hidden":!0,className:`oc-projpage__cardico`}),(0,X.jsx)(`span`,{className:`oc-projpage__cardname`,children:e.name}),(0,X.jsx)(Z,{folderId:e._id,name:e.name,color:e.color,currentParentId:t,className:`oc-projpage__cardmenu`,onOpen:()=>void i({to:`/project/$projectId`,params:{projectId:e._id}})})]}),(0,X.jsxs)(`span`,{className:`oc-projpage__cardmeta`,children:[e.folderCount>0?A({count:e.folderCount})+` · `:``,O({count:e.recursiveChatCount})]}),e.lastActivityAt===null?null:(0,X.jsx)(`span`,{className:`oc-projpage__cardage`,children:it(e.lastActivityAt,n)})]})}function kt({chat:e}){let t=C(j.chats.setChatSidebar),n=e.inSidebar?N():de();return(0,X.jsx)(P,{variant:`ghost`,size:`icon-xs`,"aria-label":n,title:n,className:`oc-projpage__barbtn`+(e.inSidebar?` is-on`:``),disabled:e.pinned&&e.inSidebar,onClick:n=>{n.stopPropagation(),t({chatId:e._id,hidden:e.inSidebar})},children:e.inSidebar?(0,X.jsx)(Je,{}):(0,X.jsx)(J,{})})}function At({chat:e,currentFolderId:t,now:n,busy:r,unread:i,locate:a,suppressClick:o}){let s=F(),c=B(e.color),l=R({id:`chat:${e._id}`}),d=jt(a);return(0,X.jsxs)(`li`,{ref:e=>{l.setNodeRef(e),d.current=e},className:`oc-projpage__chatrow`+(l.isDragging?` is-dragging`:``)+(a?` is-locate`:``),style:{transform:V.Transform.toString(l.transform),transition:l.transition},children:[(0,X.jsxs)(`button`,{type:`button`,className:`oc-projpage__chatbtn`,onClick:()=>{o.current||s({to:`/chat/$chatId`,params:{chatId:e._id}})},...l.listeners,...l.attributes,children:[c?(0,X.jsx)(`span`,{className:`oc-chatitem__dot`,style:{background:c}}):(0,X.jsx)(`span`,{className:`oc-chatitem__dot oc-chatitem__dot--empty`}),(0,X.jsx)(`span`,{className:`oc-projpage__chattitle`,children:e.title||u()}),e.pinned?(0,X.jsx)(q,{size:12,"aria-hidden":!0,className:`oc-projpage__chatpin`}):null,(0,X.jsx)(`span`,{className:`oc-projpage__chatage`,children:it(e.updatedAt,n)}),r?(0,X.jsx)(`span`,{className:`oc-chatitem__busy`,title:_(),"aria-label":_()}):null,i&&!r?(0,X.jsx)(`span`,{className:`oc-chatitem__unread`,title:h(),"aria-label":h()}):null]}),(0,X.jsx)(kt,{chat:e}),(0,X.jsx)(Q,{chat:e,currentFolderId:t,className:`oc-projpage__chatmenu`})]})}function jt(e){let t=(0,Y.useRef)(null);return(0,Y.useEffect)(()=>{e&&t.current&&t.current.scrollIntoView({block:`center`})},[e]),t}function Mt({data:e,busyIds:t,suppressClick:n,locateChatId:r}){let[i,a]=(0,Y.useState)(new Set),o=(0,Y.useMemo)(()=>{let t=new Map;for(let n of e?.chats??[]){let e=t.get(n.folderId);e===void 0?t.set(n.folderId,[n]):e.push(n)}return t},[e]);if(e===void 0)return(0,X.jsx)(`p`,{className:`oc-projpage__hint`,children:S()});if(e===null)return null;let s=e=>a(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n}),c=(a,l)=>{let u=o.get(a??e.rootId)??[],d=$e(e.folders,a);return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(G,{items:u.map(e=>`chat:${e._id}`),strategy:K,children:u.map(e=>(0,X.jsx)(Pt,{chat:e,depth:l,busy:t.has(e._id),locate:e._id===r,suppressClick:n},e._id))}),(0,X.jsx)(G,{items:d.map(e=>`folder:${e._id}`),strategy:K,children:d.map(t=>(0,X.jsx)(Nt,{folder:t,parentId:a??e.rootId,depth:l,folded:i.has(t._id),onToggle:()=>s(t._id),suppressClick:n,children:i.has(t._id)?null:c(t._id,l+1)},t._id))})]})};return(0,X.jsx)(`div`,{className:`oc-projpage__tree`,children:(o.get(e.rootId)??[]).length===0&&$e(e.folders,null).length===0?(0,X.jsx)(`p`,{className:`oc-projpage__hint`,children:xe()}):c(null,0)})}function Nt({folder:e,parentId:t,depth:n,folded:r,onToggle:i,suppressClick:a,children:o}){let s=F(),c=R({id:`folder:${e._id}`}),l=I({id:$(e._id)});return(0,X.jsxs)(`div`,{className:`oc-projpage__treegroup`,children:[(0,X.jsxs)(`div`,{ref:e=>{c.setNodeRef(e),l.setNodeRef(e)},className:`oc-projpage__treerow oc-projpage__treerow--folder`+(l.isOver?` is-over`:``)+(c.isDragging?` is-dragging`:``),style:{"--tree-depth":n,"--proj-hue":z(e),transform:V.Transform.toString(c.transform),transition:c.transition},...c.listeners,...c.attributes,role:`button`,tabIndex:0,onClick:()=>{a.current||s({to:`/project/$projectId`,params:{projectId:e._id}})},onKeyDown:t=>{t.key===`Enter`&&s({to:`/project/$projectId`,params:{projectId:e._id}})},children:[(0,X.jsx)(`button`,{type:`button`,className:`oc-projpage__treechev`,"aria-label":r?T():w(),"aria-expanded":!r,onClick:e=>{e.stopPropagation(),!a.current&&i()},onMouseDown:e=>e.stopPropagation(),onTouchStart:e=>e.stopPropagation(),children:r?(0,X.jsx)(Ae,{size:13}):(0,X.jsx)(Ie,{size:13})}),(0,X.jsx)(W,{size:13,"aria-hidden":!0,className:`oc-projpage__colico`}),(0,X.jsx)(`span`,{className:`oc-projpage__colname`,children:e.name}),(0,X.jsx)(Z,{folderId:e._id,name:e.name,color:e.color,currentParentId:t,className:`oc-projpage__treemenu`,onOpen:()=>void s({to:`/project/$projectId`,params:{projectId:e._id}})})]}),o]})}function Pt({chat:e,depth:t,busy:n,locate:r,suppressClick:i}){let a=F(),o=R({id:`chat:${e._id}`}),s=jt(r),c=B(e.color);return(0,X.jsxs)(`div`,{ref:e=>{o.setNodeRef(e),s.current=e},className:`oc-projpage__treerow oc-projpage__treerow--chat`+(o.isDragging?` is-dragging`:``)+(r?` is-locate`:``),style:{"--tree-depth":t,transform:V.Transform.toString(o.transform),transition:o.transition},children:[(0,X.jsxs)(`button`,{type:`button`,className:`oc-projpage__colchatbtn`,onClick:()=>{i.current||a({to:`/chat/$chatId`,params:{chatId:e._id}})},...o.listeners,...o.attributes,children:[c?(0,X.jsx)(`span`,{className:`oc-chatitem__dot`,style:{background:c}}):(0,X.jsx)(`span`,{className:`oc-chatitem__dot oc-chatitem__dot--empty`}),(0,X.jsx)(`span`,{className:`oc-projpage__colname`,children:e.title||u()}),n?(0,X.jsx)(`span`,{className:`oc-chatitem__busy`,"aria-hidden":!0}):null]}),(0,X.jsx)(Q,{chat:e,currentFolderId:e.folderId,className:`oc-projpage__treemenu`}),(0,X.jsx)(kt,{chat:e})]})}function Ft({data:e,currentId:t,busyIds:n,suppressClick:r,locateChatId:i}){let a=(0,Y.useRef)(null);return(0,Y.useEffect)(()=>{let e=a.current;e&&(e.scrollLeft=e.scrollWidth)},[e?.columns.length??0,t]),e===void 0?(0,X.jsx)(`p`,{className:`oc-projpage__hint`,children:S()}):(0,X.jsx)(`div`,{className:`oc-projpage__cols`,ref:a,children:e.columns.map((a,o)=>(0,X.jsx)(It,{col:a,isLast:o===e.columns.length-1,currentId:t,busyIds:n,suppressClick:r,locateChatId:i},a.folderId??`root`))})}function It({col:e,isLast:t,currentId:n,busyIds:r,suppressClick:i,locateChatId:a}){let o=F(),s=I({id:St(e.folderId)});return(0,X.jsxs)(`div`,{ref:s.setNodeRef,className:`oc-projpage__col`+(s.isOver?` is-over`:``)+(t?` is-last`:``),children:[(0,X.jsx)(G,{items:e.folders.map(e=>`folder:${e._id}`),strategy:K,children:e.folders.map(t=>(0,X.jsx)(Lt,{folder:t,parentId:e.folderId,isCurrent:t._id===n,suppressClick:i,onOpen:()=>void o({to:`/project/$projectId`,params:{projectId:t._id}})},t._id))}),(0,X.jsx)(G,{items:e.chats.map(e=>`chat:${e._id}`),strategy:K,children:e.chats.map(t=>(0,X.jsx)(Rt,{chat:t,folderId:e.folderId,busy:r.has(t._id),locate:t._id===a,suppressClick:i,onOpen:()=>void o({to:`/chat/$chatId`,params:{chatId:t._id}})},t._id))}),e.folders.length===0&&e.chats.length===0?(0,X.jsx)(`p`,{className:`oc-projpage__colempty`,children:ye()}):null]})}function Lt({folder:e,parentId:t,isCurrent:n,suppressClick:r,onOpen:i}){let a=R({id:`folder:${e._id}`}),o=I({id:$(e._id)});return(0,X.jsxs)(`div`,{ref:e=>{a.setNodeRef(e),o.setNodeRef(e)},className:`oc-projpage__colentry oc-projpage__colentry--folder`+(e.selected||n?` is-selected`:``)+(o.isOver?` is-over`:``)+(a.isDragging?` is-dragging`:``),style:{"--proj-hue":z(e),transform:V.Transform.toString(a.transform),transition:a.transition},onClick:()=>{r.current||i()},onKeyDown:e=>{e.key===`Enter`&&e.target===e.currentTarget&&i()},...a.listeners,...a.attributes,role:`button`,tabIndex:0,children:[(0,X.jsx)(W,{size:13,"aria-hidden":!0,className:`oc-projpage__colico`}),(0,X.jsx)(`span`,{className:`oc-projpage__colname`,children:e.name}),(0,X.jsx)(`span`,{className:`oc-projpage__colchev`,"aria-hidden":!0,children:`›`}),(0,X.jsx)(Z,{folderId:e._id,name:e.name,color:e.color,currentParentId:t,className:`oc-projpage__colmenu`,onOpen:i})]})}function Rt({chat:e,folderId:t,busy:n,locate:r,suppressClick:i,onOpen:a}){let o=R({id:`chat:${e._id}`}),s=jt(r),c=B(e.color);return(0,X.jsxs)(`div`,{ref:e=>{o.setNodeRef(e),s.current=e},className:`oc-projpage__colentry oc-projpage__colentry--chat`+(o.isDragging?` is-dragging`:``)+(r?` is-locate`:``),style:{transform:V.Transform.toString(o.transform),transition:o.transition},children:[(0,X.jsxs)(`button`,{type:`button`,className:`oc-projpage__colchatbtn`,onClick:()=>{i.current||a()},...o.listeners,...o.attributes,children:[c?(0,X.jsx)(`span`,{className:`oc-chatitem__dot`,style:{background:c}}):(0,X.jsx)(`span`,{className:`oc-chatitem__dot oc-chatitem__dot--empty`}),(0,X.jsx)(`span`,{className:`oc-projpage__colname`,children:e.title||u()}),n?(0,X.jsx)(`span`,{className:`oc-chatitem__busy`,"aria-hidden":!0}):null]}),(0,X.jsx)(Q,{chat:e,currentFolderId:t,className:`oc-projpage__colmenu oc-projpage__colmenu--chat`}),(0,X.jsx)(kt,{chat:e})]})}export{Tt as ProjectPage};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{AT as r,BT as i,CT as a,DT as ee,ET as te,FT as o,GT as s,HT as c,IT as ne,JT as l,KT as u,LT as d,MT as f,NT as p,OT as m,PT as re,QT as h,RT as ie,ST as ae,TT as g,UT as _,VT as v,WT as y,XT as b,YT as x,ZT as S,aV as C,cT as w,dT as T,fT as E,gT as D,gs as O,hT as k,jT as A,kT as j,lT as M,mT as N,oV as P,pT as F,qT as I,t as L,uT as R,wT as oe,zT as z}from"./api-DRlXTl06.js";import{t as B}from"./button-CTuIl1H-.js";import{Dt as V,En as H,Et as U,U as W,_ as G,jt as K,ut as q}from"./index-D48cFy6f.js";import{t as J}from"./roleDescriptions-CoFSIkRg.js";var Y=t(e(),1),X=n(),Z=[{group:()=>h(),keys:[{key:`traces.read`,label:()=>I()},{key:`traces.read.content`,label:()=>u(),phi:!0},{key:`traces.write`,label:()=>s()}]},{group:()=>S(),keys:[{key:`kpi.read`,label:()=>I()},{key:`kpi.write`,label:()=>s()}]},{group:()=>b(),keys:[{key:`openclaw.query`,label:()=>y()},{key:`anomalies.read`,label:()=>_()},{key:`anomalies.report`,label:()=>c()}]},{group:()=>x(),keys:[{key:`chats.read`,label:()=>I()},{key:`selfheal`,label:()=>i()},{key:`media.repair`,label:()=>z()},{key:`feedback.respond`,label:()=>O()}]},{group:()=>l(),keys:[{key:`admin.manage`,label:()=>v()}]}],se=Z.flatMap(e=>e.keys.map(e=>e.key));function Q(e){return e.includes(`*`)}var $={key:``,name:``,description:``};function ce(){let e=P(L.apiKeys.listRoles,{}),t=C(L.apiKeys.createRole),n=C(L.apiKeys.ensureRolesSeeded),i=C(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))}),s=W(),c=V(),[l,u]=(0,Y.useState)(!1),[h,_]=(0,Y.useState)($),[v,y]=(0,Y.useState)(new Set);(0,Y.useEffect)(()=>{n({}).catch(e=>{c.error(d(),e)})},[n,c]);let b=e??[];async function x(e,t){if(Q(e.permissions))return;if(e.builtin){await s({title:ne({name:e.name}),description:o(),confirmLabel:re()});return}if(v.has(e._id))return;let n=e.permissions.includes(t)?e.permissions.filter(e=>e!==t):[...e.permissions,t];y(t=>new Set(t).add(e._id));try{await i({roleId:e._id,permissions:n})}catch(e){c.error(p(),e)}finally{y(t=>{let n=new Set(t);return n.delete(e._id),n})}}async function S(){try{await t({key:h.key,name:h.name,description:h.description||void 0,permissions:[]}),_($),u(!1)}catch(e){c.error(f(),e)}}let O=e===void 0,I=!O&&b.length===0;return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`p`,{className:`oc-admin__hint`,children:[A(),` `,(0,X.jsx)(`code`,{children:`admin`}),` `,r(),` `,(0,X.jsx)(`code`,{children:`traces.read.content`}),` `,j()]}),(0,X.jsxs)(`div`,{className:`oc-dt`,children:[(0,X.jsxs)(`div`,{className:`oc-dt__bar`,children:[(0,X.jsx)(`h2`,{className:`oc-dt__title`,children:m()}),(0,X.jsx)(`div`,{className:`oc-dt__bar-actions`,children:(0,X.jsx)(B,{size:`sm`,onClick:()=>{_($),u(!0)},children:ee()})})]}),O?(0,X.jsx)(`p`,{className:`oc-admin__hint`,children:te()}):I?(0,X.jsx)(`p`,{className:`oc-admin__hint`,children:g()}):(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:oe()}),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?ie({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:b.map(e=>{let t=Q(e.permissions),n=v.has(e._id);return(0,X.jsxs)(`tr`,{children:[(0,X.jsxs)(`th`,{className:`oc-matrix__rolecell`,children:[(0,X.jsxs)(`div`,{className:`oc-matrix__rolename`,children:[(0,X.jsx)(`span`,{children:e.name}),(0,X.jsx)(`code`,{className:`oc-matrix__rolekey`,children:e.key}),e.builtin?(0,X.jsxs)(U,{variant:`outline`,className:`gap-1`,children:[(0,X.jsx)(H,{}),` `,a()]}):(0,X.jsx)(U,{variant:`secondary`,children:ae()})]}),J(e)?(0,X.jsx)(`p`,{className:`oc-matrix__roledesc`,children:J(e)}):null]}),se.map(r=>(0,X.jsx)(`td`,{className:`oc-matrix__cell`,children:(0,X.jsx)(q,{checked:t||e.permissions.includes(r),disabled:t||n,"aria-label":`${e.key} · ${r}`,title:t?D():n?k():r,onCheckedChange:()=>void x(e,r)})},r))]},e.key)})})]})})]}),(0,X.jsx)(G,{open:l,onOpenChange:u,title:N(),description:F(),canSubmit:!!(h.key&&h.name),onSubmit:S,submitLabel:E(),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:T()}),(0,X.jsx)(K,{value:h.key,placeholder:R(),onChange:e=>_({...h,key:e.target.value})})]}),(0,X.jsxs)(`label`,{className:`oc-field`,children:[(0,X.jsx)(`span`,{className:`oc-field__label`,children:M()}),(0,X.jsx)(K,{value:h.name,onChange:e=>_({...h,name:e.target.value})})]}),(0,X.jsxs)(`label`,{className:`oc-field`,children:[(0,X.jsx)(`span`,{className:`oc-field__label`,children:w()}),(0,X.jsx)(K,{value:h.description,onChange:e=>_({...h,description:e.target.value})})]})]})})]})}export{ce as RolesTab};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$B as r,$R as i,AR as a,Az as o,BL as s,Cz as c,D as l,DR as u,Dz as ee,Ez as te,FL as d,FR as f,Fz as p,GL as ne,GR as re,HL as ie,HR as ae,IL as oe,IR as se,JL as ce,JR as le,KL as ue,KR as de,LL as fe,MR as pe,Mz as me,NR as he,Nz as ge,OL as _e,OR as ve,Oz as ye,PL as be,PR as xe,Pz as Se,QR as Ce,RL as we,RR as Te,SR as Ee,Sz as De,Tz as Oe,UL as ke,UR as Ae,VL as je,VR as Me,WL as Ne,WR as Pe,XL as Fe,YL as Ie,YR as m,ZB as Le,ZL as Re,ZR as ze,_R as Be,bR as h,bz as Ve,cR as He,dR as g,ez as Ue,fR as We,gR as Ge,hR as Ke,jR as qe,jz as Je,kR as Ye,kz as Xe,lR as Ze,mR as Qe,nz as $e,oV as et,pR as tt,qL as nt,qR as rt,rV as _,sR as it,t as v,tz as at,uR as y,vR as ot,wz as st,xR as b,xz as ct,yR as lt,zL as ut}from"./api-DRlXTl06.js";import{t as dt}from"./list-CntaIhDp.js";import{t as x}from"./button-CTuIl1H-.js";import{$ as S,Bn as C,Bt as w,Ct as ft,Dn as pt,Dt as mt,Et as T,Q as E,Rt as D,St as ht,Tt as gt,Vn as O,X as k,Z as A,_n as _t,_t as vt,at as yt,bn as bt,bt as xt,dn as St,et as j,gt as Ct,hn as wt,it as Tt,jt as Et,nt as Dt,on as Ot,ot as kt,q as At,rt as jt,tt as Mt,vt as Nt,wt as Pt,xn as Ft,xt as It,yt as Lt,zt as M}from"./index-D48cFy6f.js";import{a as Rt,i as N,n as zt,o as Bt,r as P,t as Vt}from"./table-D0yilGWI.js";import{t as Ht}from"./FilterBar-Of8GWz2N.js";/* empty css */import{a as Ut,c as F,i as I,l as Wt,n as Gt,o as L,r as Kt,s as qt,t as Jt,u as R}from"./TimezoneCombobox-n6rUGOTZ.js";var Yt=l(`calendar-days`,[[`path`,{d:`M8 2v4`,key:`1cmpym`}],[`path`,{d:`M16 2v4`,key:`4m81vk`}],[`rect`,{width:`18`,height:`18`,x:`3`,y:`4`,rx:`2`,key:`1hopcy`}],[`path`,{d:`M3 10h18`,key:`8toen8`}],[`path`,{d:`M8 14h.01`,key:`6423bh`}],[`path`,{d:`M12 14h.01`,key:`1etili`}],[`path`,{d:`M16 14h.01`,key:`1gbofw`}],[`path`,{d:`M8 18h.01`,key:`lrp35t`}],[`path`,{d:`M12 18h.01`,key:`mhygvu`}],[`path`,{d:`M16 18h.01`,key:`kzsmim`}]]),Xt=l(`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`}]]),z=t(e(),1),B=n();function V(e){try{let t=new Intl.DateTimeFormat(e,{weekday:`narrow`});return Array.from({length:7},(e,n)=>t.format(new Date(2024,0,1+n)))}catch{return[`M`,`T`,`W`,`T`,`F`,`S`,`S`]}}function Zt({value:e,onChange:t}){let n=Wt(e),i=(0,z.useMemo)(()=>new Date,[]),[a,o]=(0,z.useState)(()=>({year:n?.year??i.getFullYear(),month:n?.month??i.getMonth()})),[s,c]=(0,z.useState)(!1),l=(0,z.useMemo)(()=>V(r()),[]),u=(0,z.useMemo)(()=>new Intl.DateTimeFormat(r(),{month:`long`,year:`numeric`}),[]),ee=(0,z.useMemo)(()=>new Intl.DateTimeFormat(r(),{dateStyle:`medium`,timeStyle:`short`}),[]),te=F(a.year,a.month),d=n?.hour??9,f=n?.minute??0,p=(e,n,r,i,a)=>t(R(e,n,r,i,a)),ne=(e,t,n)=>{o({year:e,month:t}),p(e,t,n,d,f)},re=e=>{let t=new Date(a.year,a.month+e,1);o({year:t.getFullYear(),month:t.getMonth()})},ie=n===null?b():ee.format(new Date(n.year,n.month,n.day,n.hour,n.minute));return(0,B.jsxs)(D,{modal:!0,open:s,onOpenChange:c,children:[(0,B.jsx)(w,{asChild:!0,children:(0,B.jsxs)(`button`,{type:`button`,className:`oc-dtp__trigger`,"aria-label":Ee(),children:[(0,B.jsx)(Yt,{size:14,"aria-hidden":!0,className:`oc-dtp__icon`}),(0,B.jsx)(`span`,{className:n===null?`oc-dtp__placeholder`:void 0,children:ie})]})}),(0,B.jsxs)(M,{align:`start`,className:`oc-dtp__pop`,children:[(0,B.jsxs)(`div`,{className:`oc-dtp__head`,children:[(0,B.jsx)(`button`,{type:`button`,className:`oc-dtp__nav`,"aria-label":h(),onClick:()=>re(-1),children:(0,B.jsx)(O,{size:15,"aria-hidden":!0})}),(0,B.jsx)(`span`,{className:`oc-dtp__month`,children:u.format(new Date(a.year,a.month,1))}),(0,B.jsx)(`button`,{type:`button`,className:`oc-dtp__nav`,"aria-label":lt(),onClick:()=>re(1),children:(0,B.jsx)(C,{size:15,"aria-hidden":!0})})]}),(0,B.jsxs)(`div`,{className:`oc-dtp__grid`,children:[l.map((e,t)=>(0,B.jsx)(`span`,{className:`oc-dtp__wd`,children:e},t)),te.map((e,t)=>{let r=n!==null&&n.year===e.year&&n.month===e.month&&n.day===e.day,a=i.getFullYear()===e.year&&i.getMonth()===e.month&&i.getDate()===e.day;return(0,B.jsx)(`button`,{type:`button`,className:`oc-dtp__day`+(e.inMonth?``:` oc-dtp__day--out`)+(r?` oc-dtp__day--sel`:``)+(a&&!r?` oc-dtp__day--today`:``),onClick:()=>ne(e.year,e.month,e.day),children:e.day},t)})]}),(0,B.jsxs)(`div`,{className:`oc-dtp__time`,children:[(0,B.jsxs)(k,{value:String(d),onValueChange:e=>p(a.year,a.month,n?.day??i.getDate(),Number(e),f),children:[(0,B.jsx)(S,{size:`sm`,"aria-label":ot(),children:(0,B.jsx)(j,{})}),(0,B.jsx)(A,{className:`oc-dtp__timeopts`,children:Array.from({length:24},(e,t)=>(0,B.jsx)(E,{value:String(t),children:String(t).padStart(2,`0`)},t))})]}),(0,B.jsx)(`span`,{className:`oc-dtp__colon`,children:`:`}),(0,B.jsxs)(k,{value:String(f),onValueChange:e=>p(a.year,a.month,n?.day??i.getDate(),d,Number(e)),children:[(0,B.jsx)(S,{size:`sm`,"aria-label":Be(),children:(0,B.jsx)(j,{})}),(0,B.jsx)(A,{className:`oc-dtp__timeopts`,children:Array.from({length:60},(e,t)=>(0,B.jsx)(E,{value:String(t),children:String(t).padStart(2,`0`)},t))})]})]})]})]})}function H(e){let t=new Date(e),n=e=>String(e).padStart(2,`0`);return`${t.getFullYear()}-${n(t.getMonth()+1)}-${n(t.getDate())}`}function Qt(e,t,n){let r=e=>String(e).padStart(2,`0`);return`${e}-${r(t+1)}-${r(n)}`}function $t(e){let t=new Map;for(let n of e){let e=H(n.atMs),r=t.get(e);r===void 0?t.set(e,[n]):r.push(n)}for(let e of t.values())e.sort((e,t)=>e.atMs-t.atMs);return t}function U(e,t,n){let r=new Map,i=new Date(t,n+1,0).getDate();for(let a=1;a<=i;a++){let i=e.get(Qt(t,n,a));i!==void 0&&i.length>0&&r.set(a,i.length)}return r}function en(e){try{let t=new Intl.DateTimeFormat(e,{weekday:`narrow`});return Array.from({length:7},(e,n)=>t.format(new Date(2024,0,1+n)))}catch{return[`M`,`T`,`W`,`T`,`F`,`S`,`S`]}}function tn(e,t){let n=(new Date(e,t,1).getDay()+6)%7,r=new Date(e,t,1-n),i=new Date(r.getFullYear(),r.getMonth(),r.getDate()+42);return{startMs:r.getTime(),endMs:i.getTime()}}function nn(e){return{startMs:new Date(e,0,1).getTime(),endMs:new Date(e+1,0,1).getTime()}}var W=3;function rn({events:e,mode:t,cursor:n,onModeChange:i,onCursorChange:a,onEventClick:o,footnote:s}){let c=r(),l=(0,z.useMemo)(()=>$t(e),[e]),u=(0,z.useMemo)(()=>en(c),[c]),ee=(0,z.useMemo)(()=>new Intl.DateTimeFormat(c,{month:`long`,year:`numeric`}),[c]),te=(0,z.useMemo)(()=>new Intl.DateTimeFormat(c,{month:`long`}),[c]),d=(0,z.useMemo)(()=>new Intl.DateTimeFormat(c,{hour:`2-digit`,minute:`2-digit`}),[c]),f=new Date,p=e=>{if(t===`year`){a({year:n.year+e,month:n.month});return}let r=new Date(n.year,n.month+e,1);a({year:r.getFullYear(),month:r.getMonth()})},ne=t===`year`?String(n.year):ee.format(new Date(n.year,n.month,1));return(0,B.jsxs)(`div`,{className:`oc-cal`,children:[(0,B.jsxs)(`div`,{className:`oc-cal__head`,children:[(0,B.jsxs)(`div`,{className:`oc-cal__nav`,children:[(0,B.jsx)(x,{variant:`ghost`,size:`icon-sm`,"aria-label":y(),onClick:()=>p(-1),children:(0,B.jsx)(O,{})}),(0,B.jsx)(x,{variant:`ghost`,size:`icon-sm`,"aria-label":Ze(),onClick:()=>p(1),children:(0,B.jsx)(C,{})}),(0,B.jsx)(x,{variant:`ghost`,size:`sm`,onClick:()=>a({year:f.getFullYear(),month:f.getMonth()}),children:g()})]}),(0,B.jsx)(`span`,{className:`oc-cal__title`,children:ne}),(0,B.jsxs)(`div`,{className:`oc-cal__modes`,role:`group`,children:[(0,B.jsx)(x,{variant:t===`month`?`secondary`:`ghost`,size:`sm`,"aria-pressed":t===`month`,onClick:()=>i(`month`),children:tt()}),(0,B.jsx)(x,{variant:t===`year`?`secondary`:`ghost`,size:`sm`,"aria-pressed":t===`year`,onClick:()=>i(`year`),children:We()})]})]}),t===`month`?(0,B.jsx)(an,{cursor:n,byDay:l,weekdays:u,timeFmt:d,now:f,onEventClick:o}):(0,B.jsx)(on,{year:n.year,byDay:l,monthShortFmt:te,now:f,onOpenMonth:e=>{a({year:n.year,month:e}),i(`month`)}}),s?(0,B.jsx)(`p`,{className:`oc-cal__footnote`,children:s}):null]})}function an({cursor:e,byDay:t,weekdays:n,timeFmt:r,now:i,onEventClick:a}){let o=F(e.year,e.month);return(0,B.jsxs)(`div`,{className:`oc-cal__month`,children:[n.map((e,t)=>(0,B.jsx)(`span`,{className:`oc-cal__wd`,children:e},t)),o.map((e,n)=>{let o=t.get(Qt(e.year,e.month,e.day))??[],s=i.getFullYear()===e.year&&i.getMonth()===e.month&&i.getDate()===e.day;return(0,B.jsxs)(`div`,{className:`oc-cal__day`+(e.inMonth?``:` oc-cal__day--out`)+(s?` oc-cal__day--today`:``),children:[(0,B.jsx)(`span`,{className:`oc-cal__daynum`,children:e.day}),o.slice(0,W).map(e=>(0,B.jsxs)(`button`,{type:`button`,className:`oc-cal__event`+(e.muted?` oc-cal__event--muted`:``)+(e.exact?` oc-cal__event--exact`:``),style:e.color?{"--cal-ev":e.color}:void 0,title:`${r.format(e.atMs)} ${e.title}`,onClick:a?()=>a(e):void 0,children:[(0,B.jsx)(`span`,{className:`oc-cal__evdot`,"aria-hidden":!0}),(0,B.jsx)(`span`,{className:`oc-cal__evtime`,children:r.format(e.atMs)}),(0,B.jsx)(`span`,{className:`oc-cal__evtitle`,children:e.title})]},e.id)),o.length>W?(0,B.jsx)(`span`,{className:`oc-cal__more`,children:He({count:o.length-W})}):null]},n)})]})}function on({year:e,byDay:t,monthShortFmt:n,now:r,onOpenMonth:i}){return(0,B.jsx)(`div`,{className:`oc-cal__year`,children:Array.from({length:12},(a,o)=>{let s=U(t,e,o),c=F(e,o);return(0,B.jsxs)(`button`,{type:`button`,className:`oc-cal__mini`,onClick:()=>i(o),children:[(0,B.jsx)(`span`,{className:`oc-cal__mininame`,children:n.format(new Date(e,o,1))}),(0,B.jsx)(`span`,{className:`oc-cal__minigrid`,"aria-hidden":!0,children:c.map((e,t)=>{let n=e.inMonth?s.get(e.day)??0:0,i=e.inMonth&&r.getFullYear()===e.year&&r.getMonth()===e.month&&r.getDate()===e.day;return(0,B.jsx)(`span`,{className:`oc-cal__minidot`+(e.inMonth?``:` is-out`)+(n===1?` has-one`:``)+(n>1?` has-many`:``)+(i?` is-today`:``)},t)})})]},o)})})}var G={h:36e5,min:6e4,s:1e3,ms:1};function sn(e){if(e===null)return null;let t=e.trim(),n=/^every\s+(\d+(?:\.\d+)?)(h|min|s|ms)$/.exec(t);if(n!==null){let e=Number(n[1])*G[n[2]];return Number.isFinite(e)&&e>0?{kind:`every`,everyMs:e}:null}let r=/^(?:cron\s+)?([\d*,/-]+(?:\s+[\d*,/-]+){4})(?:\s*\(([^)]+)\))?$/.exec(t);if(r!==null)return{kind:`cron`,expr:r[1],tz:r[2]??null};let i=Date.parse(t);return Number.isFinite(i)?{kind:`at`,atMs:i}:null}function K(e,t,n){let r=new Set;for(let i of e.split(`,`)){let e=i,a=1,o=/^(.+)\/(\d{1,3})$/.exec(i);if(o!==null&&(e=o[1],a=Number(o[2]),a<1))return null;let s,c;if(e===`*`)s=t,c=n;else{let r=/^(\d{1,3})(?:-(\d{1,3}))?$/.exec(e);if(r===null||(s=Number(r[1]),c=r[2]===void 0?s:Number(r[2]),r[2]===void 0&&o!==null&&(c=n),s<t||c>n||s>c))return null}for(let e=s;e<=c;e+=a)r.add(e)}return r.size>0?[...r].sort((e,t)=>e-t):null}function q(e){let t=e.trim().split(/\s+/);if(t.length!==5)return null;let n=K(t[0],0,59),r=K(t[1],0,23),i=K(t[2],1,31),a=K(t[3],1,12),o=K(t[4],0,7);if(!n||!r||!i||!a||!o)return null;let s=new Set(o.map(e=>e%7));return{minutes:n,hours:r,dom:new Set(i),months:new Set(a),dow:s,domRestricted:t[2]!==`*`,dowRestricted:t[4]!==`*`}}var cn=new Map;function J(e){let t=cn.get(e);if(t!==void 0)return t;let n=null;try{n=new Intl.DateTimeFormat(`en-US`,{timeZone:e,year:`numeric`,month:`2-digit`,day:`2-digit`,hour:`2-digit`,minute:`2-digit`,second:`2-digit`,hour12:!1})}catch{n=null}return cn.set(e,n),n}function Y(e,t){if(t!==null){let n=J(t);if(n!==null){let t={};for(let r of n.formatToParts(e))r.type!==`literal`&&(t[r.type]=Number(r.value));return{y:t.year,mo:t.month-1,d:t.day,h:t.hour===24?0:t.hour,mi:t.minute}}}let n=new Date(e);return{y:n.getFullYear(),mo:n.getMonth(),d:n.getDate(),h:n.getHours(),mi:n.getMinutes()}}function X(e,t,n,r,i,a){if(a===null||J(a)===null)return new Date(e,t,n,r,i).getTime();let o=Date.UTC(e,t,n,r,i),s=e=>{let t=Y(e,a);return Date.UTC(t.y,t.mo,t.d,t.h,t.mi)-e},c=s(o),l=o-c,u=s(l);return u!==c&&(l=o-u),l}function Z(e,t,n,r){let i=new Map,a=(e,t)=>{e<n||e>=r||i.set(e,t||(i.get(e)??!1))};if(e?.kind===`at`)a(e.atMs,!0);else if(e?.kind===`every`){if(t!==null){let i=e.everyMs,o=Math.ceil((n-t)/i);for(let e=t+o*i,n=0;e<r&&n<400;e+=i,n++)a(e,e===t)}}else if(e?.kind===`cron`){let t=q(e.expr);if(t!==null&&t.hours.length*t.minutes.length<=400){let i=0,o=n-864e5;for(;o<r+864e5&&i<400;){let s=Y(o,e.tz);if(t.months.has(s.mo+1)){let o=new Date(Date.UTC(s.y,s.mo,s.d)).getUTCDay(),c=t.dom.has(s.d),l=t.dow.has(o);if(t.domRestricted&&t.dowRestricted?c||l:c&&l)for(let o of t.hours)for(let c of t.minutes){if(i>=400)break;let t=X(s.y,s.mo,s.d,o,c,e.tz);t>=n&&t<r&&(a(t,!1),i++)}}o=X(s.y,s.mo,s.d,12,0,e.tz)+864e5}}}return t!==null&&a(t,!0),[...i.entries()].map(([e,t])=>({atMs:e,exact:t})).sort((e,t)=>e.atMs-t.atMs).slice(0,400)}var Q=`crons`;function ln(e,t){return`${e}\u0000${t}`}function un(e,t,n){let r=[],i=new Map;for(let a of e){let{job:e}=a;if(e.id===null)continue;let o=ln(a.instanceName,e.id);i.set(o,a);let s=L(e)!==`active`,c=Z(s?null:sn(e.schedule),e.nextRunAtMs,t,n);for(let t of c)r.push({id:`${o}:${t.atMs}`,sourceId:Q,itemId:o,atMs:t.atMs,title:e.name??e.id,muted:s,exact:t.exact})}return{events:r,byItemId:i}}var $={minutes:6e4,hours:36e5,days:864e5};function dn(e){return e?.data?.code??`unknown`}function fn({status:e}){switch(qt(e)){case`ok`:return(0,B.jsx)(T,{variant:`secondary`,children:f()});case`error`:return(0,B.jsx)(T,{variant:`destructive`,children:he()});case`running`:return(0,B.jsx)(T,{variant:`outline`,children:pe()});case`other`:return(0,B.jsx)(T,{variant:`outline`,children:e});case`none`:return(0,B.jsx)(`span`,{className:`text-muted-foreground`,children:`—`})}}function pn(){let e=_(v.scheduled.listMyCrons),t=_(v.scheduled.getCronDetail),n=_(v.scheduled.listCronRuns),l=_(v.scheduled.updateCron),Ee=_(v.scheduled.removeCron),Be=_(v.scheduled.runCronNow),h=mt(),He=et(v.me.getMe,{host:At})?.timezone,[g,We]=(0,z.useState)(null),[Ze,tt]=(0,z.useState)(!1),[y,ot]=(0,z.useState)(!1),[b,lt]=(0,z.useState)(null),[C,w]=(0,z.useState)(null),[D,O]=(0,z.useState)(null),[M,F]=(0,z.useState)(null),[Wt,qt]=(0,z.useState)(!1),[R,V]=(0,z.useState)(Gt),[H,Qt]=(0,z.useState)(()=>new URLSearchParams(window.location.search).get(`job`)===null&&localStorage.getItem(`oc.sched.view`)===`calendar`?`calendar`:`list`),$t=e=>{localStorage.setItem(`oc.sched.view`,e),Qt(e)},[U,en]=(0,z.useState)(`month`),[W,an]=(0,z.useState)(()=>{let e=new Date;return{year:e.getFullYear(),month:e.getMonth()}}),on=(0,z.useMemo)(()=>{let e=[];for(let t of g??[]){if(!t.supported||t.error!==null)continue;let n=t.kind===`openclaw`&&t.manageSupported;for(let r of t.jobs)Ut(r,R)&&e.push({instanceName:t.instanceName,canEdit:n,job:r})}return e},[g,R]),G=(0,z.useMemo)(()=>U===`year`?nn(W.year):tn(W.year,W.month),[U,W]),sn=(0,z.useMemo)(()=>un(on,G.startMs,G.endMs),[on,G]),K=e=>{let t=sn.byItemId.get(e.itemId);t===void 0||!t.canEdit||t.job.id===null||pn(t.instanceName,t.job)},q=(0,z.useCallback)(async()=>{tt(!0),ot(!1);try{We(await e({}))}catch{ot(!0)}finally{tt(!1)}},[e]);(0,z.useEffect)(()=>{q()},[q]);let cn=(0,z.useMemo)(()=>new URLSearchParams(window.location.search).get(`job`),[]),J=(0,z.useRef)(null);(0,z.useEffect)(()=>{g!==null&&J.current!==null&&J.current.scrollIntoView({block:`center`})},[g]);let Y=(0,z.useMemo)(()=>new Intl.DateTimeFormat(r(),{dateStyle:`medium`,timeStyle:`short`}),[]),X=async(e,t,n)=>{lt(e);try{await t(),h.success(n),await q()}catch(e){h.toast({variant:`error`,title:m({code:dn(e)})})}finally{lt(null)}},Z=(0,z.useRef)(0),Q=(0,z.useRef)(0),ln=async(e,t)=>{if(t.id===null)return;let r=++Z.current;O({name:t.name??t.id,entries:null});try{let i=await n({instanceName:e,jobId:t.id,limit:20});if(r!==Z.current)return;O({name:t.name??t.id,entries:i})}catch(e){if(r!==Z.current)return;O(null),h.toast({variant:`error`,title:m({code:dn(e)})})}},pn=async(e,n)=>{if(n.id===null)return;let r=++Q.current;F({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%$.days===0?(s=String(e/$.days),c=`days`):e%$.hours===0?(s=String(e/$.hours),c=`hours`):(s=String(Math.max(1,Math.round(e/$.minutes))),c=`minutes`))}if(r!==Q.current)return;F(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!==Q.current)return;F(null),h.toast({variant:`error`,title:m({code:dn(e)})})}},mn=async()=>{if(M===null)return;let e={};if(M.nameDirty&&M.name.trim()===``||M.messageDirty&&M.hasMessage&&M.message.trim()===``){h.toast({variant:`error`,title:be()});return}if(M.nameDirty&&M.name.trim()!==``&&(e.name=M.name.trim()),M.scheduleDirty){if(M.scheduleKind===`cron`&&M.cronExpr.trim()!==``)e.schedule={kind:`cron`,expr:M.cronExpr.trim(),...M.tz.trim()===``?{}:{tz:M.tz.trim()}};else if(M.scheduleKind===`every`){let t=Number(M.everyValue);Number.isFinite(t)&&t>=1&&(e.schedule={kind:`every`,everyMs:Math.round(t*$[M.everyUnit])})}else if(M.scheduleKind===`at`&&M.at!==``){let t=Date.parse(M.at);Number.isFinite(t)&&(e.schedule={kind:`at`,at:new Date(t).toISOString()})}}if(M.scheduleDirty&&e.schedule===void 0){h.toast({variant:`error`,title:d()});return}if(M.messageDirty&&M.hasMessage&&M.message.trim()!==``&&(e.message=M.message.trim()),Object.keys(e).length===0){F(null);return}let t=Q.current;qt(!0);try{await l({instanceName:M.instanceName,jobId:M.jobId,patch:e}),h.success(ce()),t===Q.current&&F(null),await q()}catch(e){h.toast({variant:`error`,title:m({code:dn(e)})})}finally{qt(!1)}},hn=g?.reduce((e,t)=>e+t.jobs.length,0)??0;return(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(`div`,{style:{display:`flex`,alignItems:`flex-start`,gap:8,marginBottom:12},children:[(0,B.jsx)(`p`,{className:`oc-admin__hint`,style:{flex:1,margin:0},children:p()}),(0,B.jsxs)(`div`,{className:`oc-sched__viewtoggle`,role:`group`,"aria-label":Ge(),children:[(0,B.jsx)(x,{variant:H===`list`?`secondary`:`ghost`,size:`icon-sm`,"aria-label":Ke(),title:Ke(),"aria-pressed":H===`list`,onClick:()=>$t(`list`),children:(0,B.jsx)(dt,{})}),(0,B.jsx)(x,{variant:H===`calendar`?`secondary`:`ghost`,size:`icon-sm`,"aria-label":Qe(),title:Qe(),"aria-pressed":H===`calendar`,onClick:()=>$t(`calendar`),children:(0,B.jsx)(Yt,{})})]}),(0,B.jsxs)(x,{variant:`ghost`,size:`sm`,onClick:()=>void q(),disabled:Ze,style:{display:`inline-flex`,alignItems:`center`,gap:4},children:[(0,B.jsx)(wt,{size:14,"aria-hidden":!0}),Se()]})]}),g!==null&&hn>0?(0,B.jsxs)(Ht,{q:R.q,onQChange:e=>V(t=>({...t,q:e})),searchPlaceholder:a(),onReset:()=>V(Gt),canReset:Kt(R),children:[(0,B.jsxs)(k,{value:R.state,onValueChange:e=>V(t=>({...t,state:e})),children:[(0,B.jsx)(S,{size:`sm`,className:`w-40`,children:(0,B.jsx)(j,{})}),(0,B.jsxs)(A,{children:[(0,B.jsx)(E,{value:`all`,children:Ye()}),(0,B.jsx)(E,{value:`active`,children:ct()}),(0,B.jsx)(E,{value:`paused`,children:De()}),(0,B.jsx)(E,{value:`auto-disabled`,children:Ve()})]})]}),(0,B.jsxs)(k,{value:R.result,onValueChange:e=>V(t=>({...t,result:e})),children:[(0,B.jsx)(S,{size:`sm`,className:`w-40`,children:(0,B.jsx)(j,{})}),(0,B.jsxs)(A,{children:[(0,B.jsx)(E,{value:`all`,children:ve()}),(0,B.jsx)(E,{value:`ok`,children:f()}),(0,B.jsx)(E,{value:`error`,children:he()}),(0,B.jsx)(E,{value:`running`,children:pe()}),(0,B.jsx)(E,{value:`none`,children:qe()})]})]})]}):null,g===null?(0,B.jsx)(`p`,{className:`oc-admin__hint`,"aria-busy":Ze,children:y?ge():Le()}):H===`calendar`?(0,B.jsxs)(B.Fragment,{children:[y?(0,B.jsx)(`p`,{className:`oc-admin__hint`,children:ge()}):null,g.length===0?(0,B.jsx)(`p`,{className:`oc-admin__hint`,children:me()}):(0,B.jsx)(rn,{events:sn.events,mode:U,cursor:W,onModeChange:en,onCursorChange:an,onEventClick:K,footnote:it()})]}):(0,B.jsxs)(B.Fragment,{children:[y?(0,B.jsx)(`p`,{className:`oc-admin__hint`,children:ge()}):null,g.length===0?(0,B.jsx)(`p`,{className:`oc-admin__hint`,children:me()}):null,g.map(e=>{let t=e.jobs.filter(e=>Ut(e,R)),n=Kt(R)&&e.jobs.length>0&&t.length===0;return(0,B.jsxs)(`section`,{style:{marginBottom:20},children:[g.length>1||e.error||!e.supported?(0,B.jsxs)(`h3`,{style:{display:`flex`,alignItems:`center`,gap:8,fontSize:`0.85rem`,fontWeight:600,margin:`0 0 6px`},children:[e.instanceName,(0,B.jsx)(T,{variant:`outline`,children:e.kind})]}):null,e.supported?e.error?(0,B.jsx)(`p`,{className:`oc-admin__hint`,children:o({code:e.error})}):e.jobs.length===0?(0,B.jsx)(`p`,{className:`oc-admin__hint`,children:Xe()}):n?(0,B.jsx)(`p`,{className:`oc-admin__hint`,children:u()}):(0,B.jsxs)(Vt,{children:[(0,B.jsx)(Rt,{children:(0,B.jsxs)(Bt,{children:[(0,B.jsx)(N,{children:ye()}),(0,B.jsx)(N,{children:ee()}),(0,B.jsx)(N,{children:te()}),(0,B.jsx)(N,{children:Oe()}),(0,B.jsx)(N,{children:st()}),(0,B.jsx)(N,{children:se()}),(0,B.jsx)(N,{children:Re()})]})}),(0,B.jsx)(zt,{children:t.map((t,n)=>{let r=`${e.instanceName}:${t.id??n}`,a=b===r,o=e.manageSupported,s=e.kind===`openclaw`&&o;return(0,B.jsxs)(Bt,{ref:t.id!==null&&t.id===cn?J:void 0,"data-state":t.id!==null&&t.id===cn?`selected`:void 0,children:[(0,B.jsx)(P,{className:`font-medium`,style:{maxWidth:280,overflow:`hidden`,textOverflow:`ellipsis`},title:t.name??void 0,children:t.name??c()}),(0,B.jsx)(P,{children:(0,B.jsx)(T,{variant:`secondary`,children:t.agentId})}),(0,B.jsxs)(P,{className:`whitespace-nowrap`,children:[(0,B.jsx)(`span`,{style:{fontFamily:`var(--font-mono, monospace)`},children:t.schedule??`—`}),(()=>{let e=Ct(t.schedule),n=e===null?null:vt(e);return n===null?null:(0,B.jsx)(`span`,{className:`text-muted-foreground`,style:{display:`block`,fontSize:`0.78rem`},children:n})})()]}),(0,B.jsx)(P,{className:`whitespace-nowrap text-muted-foreground`,children:t.nextRunAtMs===null?`—`:Y.format(t.nextRunAtMs)}),(0,B.jsx)(P,{children:L(t)===`auto-disabled`?(0,B.jsx)(T,{variant:`destructive`,title:`${t.autoDisabledReason??``}${t.autoDisabledAtMs===null?``:` · ${Y.format(t.autoDisabledAtMs)}`}`,children:Ve()}):L(t)===`active`?(0,B.jsx)(T,{variant:`secondary`,children:ct()}):L(t)===`paused`?(0,B.jsx)(T,{variant:`outline`,children:De()}):(0,B.jsx)(`span`,{className:`text-muted-foreground`,children:`—`})}),(0,B.jsxs)(P,{children:[(0,B.jsx)(fn,{status:t.lastRunStatus}),t.lastDelivered===!1?(0,B.jsx)(T,{variant:`destructive`,title:t.lastDeliveryError??$e(),children:xe()}):null]}),(0,B.jsx)(P,{className:`whitespace-nowrap`,children:t.id===null?(0,B.jsx)(`span`,{className:`text-muted-foreground`,children:`—`}):a?(0,B.jsx)(pt,{size:14,className:`oc-actrow__spin`,"aria-hidden":!0}):(0,B.jsxs)(`span`,{className:`oc-cronactions`,children:[s?(0,B.jsx)(x,{variant:`ghost`,size:`icon-sm`,title:Ue(),"aria-label":Ue(),disabled:b!==null,onClick:()=>void X(r,async()=>{let n=await Be({instanceName:e.instanceName,jobId:t.id});if(n.ran!==!0&&n.runId===null)throw{data:{code:n.reason??`run_not_started`}}},le()),children:(0,B.jsx)(Ot,{size:14,"aria-hidden":!0})}):null,s&&t.enabled!==null?(0,B.jsx)(x,{variant:`ghost`,size:`icon-sm`,title:I(t)===`pause`?i():Ce(),"aria-label":I(t)===`pause`?i():Ce(),disabled:b!==null,onClick:()=>void X(r,()=>l({instanceName:e.instanceName,jobId:t.id,patch:{enabled:I(t)===`resume`}}),I(t)===`pause`?rt():de()),children:I(t)===`pause`?(0,B.jsx)(Ft,{size:14,"aria-hidden":!0}):(0,B.jsx)(_t,{size:14,"aria-hidden":!0})}):null,s?(0,B.jsx)(x,{variant:`ghost`,size:`icon-sm`,title:Fe(),"aria-label":Fe(),disabled:b!==null,onClick:()=>void pn(e.instanceName,t),children:(0,B.jsx)(bt,{size:14,"aria-hidden":!0})}):null,s?(0,B.jsx)(x,{variant:`ghost`,size:`icon-sm`,title:Ie(),"aria-label":Ie(),disabled:b!==null,onClick:()=>void ln(e.instanceName,t),children:(0,B.jsx)(Xt,{size:14,"aria-hidden":!0})}):null,o?(0,B.jsx)(x,{variant:`ghost`,size:`icon-sm`,title:ze(),"aria-label":ze(),disabled:b!==null,onClick:()=>w({instanceName:e.instanceName,jobId:t.id,name:t.name??t.id}),children:(0,B.jsx)(St,{size:14,"aria-hidden":!0})}):null]})})]},t.id??`${e.instanceName}-${n}`)})})]}):(0,B.jsx)(`p`,{className:`oc-admin__hint`,children:Je()})]},e.instanceName)}),hn>0?(0,B.jsx)(`p`,{className:`oc-admin__hint`,style:{marginTop:4},children:_e()}):null]}),(0,B.jsx)(Nt,{open:C!==null,onOpenChange:e=>{e||w(null)},children:(0,B.jsxs)(It,{children:[(0,B.jsxs)(Pt,{children:[(0,B.jsx)(gt,{children:Pe()}),(0,B.jsx)(ht,{children:Ae({name:C?.name??``})})]}),(0,B.jsxs)(ft,{children:[(0,B.jsx)(xt,{children:ae()}),(0,B.jsx)(Lt,{onClick:()=>{let e=C;w(null),e!==null&&X(`${e.instanceName}:${e.jobId}`,()=>Ee({instanceName:e.instanceName,jobId:e.jobId}),re())},children:Me()})]})]})}),(0,B.jsx)(Mt,{open:D!==null,onOpenChange:e=>{e||(Z.current++,O(null))},children:(0,B.jsxs)(Dt,{style:{maxWidth:640},children:[(0,B.jsx)(yt,{children:(0,B.jsx)(kt,{children:nt({name:D?.name??``})})}),D?.entries===null?(0,B.jsx)(`p`,{className:`oc-admin__hint`,children:Le()}):D!==null&&D.entries.length===0?(0,B.jsx)(`p`,{className:`oc-admin__hint`,children:ue()}):D===null?null:(0,B.jsx)(`div`,{className:`oc-cronpanel__runs`,style:{maxHeight:420,overflowY:`auto`},children:D.entries.map((e,t)=>(0,B.jsxs)(`div`,{className:`oc-cronpanel__run`,children:[(0,B.jsxs)(`div`,{className:`oc-cronpanel__run-head`,children:[(0,B.jsx)(fn,{status:e.status}),(0,B.jsx)(`span`,{children:typeof(e.runAtMs??e.ts)==`number`?Y.format(e.runAtMs??e.ts):`—`}),typeof e.durationMs==`number`?(0,B.jsxs)(`span`,{className:`oc-cronpanel__run-dur`,children:[Math.round(e.durationMs/1e3),`s`]}):null]}),e.summary===null?null:(0,B.jsx)(`div`,{className:`oc-cronpanel__run-summary`,children:e.summary}),e.error===null?null:(0,B.jsx)(`div`,{className:`oc-cronpanel__run-error`,children:e.error}),e.delivered===!1?(0,B.jsxs)(`div`,{className:`oc-cronpanel__run-undelivered`,children:[Te({channel:e.deliveryChannel??`—`}),e.deliveryError===null?null:(0,B.jsx)(`span`,{className:`oc-cronpanel__plain`,children:e.deliveryError})]}):null]},t))})]})}),(0,B.jsx)(Mt,{open:M!==null,onOpenChange:e=>{e||(Q.current++,F(null))},children:(0,B.jsxs)(Dt,{className:`oc-cronedit`,children:[(0,B.jsxs)(yt,{children:[(0,B.jsx)(kt,{children:ne()}),(0,B.jsx)(jt,{children:Ne()})]}),M===null?null:M.loading?(0,B.jsx)(`p`,{className:`oc-admin__hint`,children:Le()}):(0,B.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:12},children:[(0,B.jsxs)(`label`,{style:{display:`flex`,flexDirection:`column`,gap:4},children:[(0,B.jsx)(`span`,{className:`oc-admin__hint`,style:{margin:0},children:ye()}),(0,B.jsx)(Et,{value:M.name,maxLength:200,onChange:e=>F({...M,name:e.target.value,nameDirty:!0})})]}),(0,B.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:4},children:[(0,B.jsx)(`span`,{className:`oc-admin__hint`,style:{margin:0},children:ke()}),(0,B.jsxs)(k,{value:M.scheduleKind,onValueChange:e=>F({...M,scheduleKind:e,scheduleDirty:!0}),children:[(0,B.jsx)(S,{children:(0,B.jsx)(j,{})}),(0,B.jsxs)(A,{children:[(0,B.jsx)(E,{value:`cron`,children:ie()}),(0,B.jsx)(E,{value:`every`,children:je()}),(0,B.jsx)(E,{value:`at`,children:s()})]})]}),M.scheduleKind===`cron`?(0,B.jsxs)(`div`,{style:{display:`flex`,gap:8},children:[(0,B.jsx)(Et,{value:M.cronExpr,onChange:e=>F({...M,cronExpr:e.target.value,scheduleDirty:!0}),placeholder:`30 9 * * *`,style:{fontFamily:`var(--font-mono, monospace)`}}),(0,B.jsx)(Jt,{value:M.tz,onChange:e=>F({...M,tz:e,scheduleDirty:!0}),fallbackTz:He??void 0})]}):M.scheduleKind===`every`?(0,B.jsxs)(`div`,{style:{display:`flex`,gap:8},children:[(0,B.jsx)(Et,{type:`number`,min:1,value:M.everyValue,onChange:e=>F({...M,everyValue:e.target.value,scheduleDirty:!0}),style:{maxWidth:120}}),(0,B.jsxs)(k,{value:M.everyUnit,onValueChange:e=>F({...M,everyUnit:e,scheduleDirty:!0}),children:[(0,B.jsx)(S,{style:{maxWidth:160},children:(0,B.jsx)(j,{})}),(0,B.jsxs)(A,{children:[(0,B.jsx)(E,{value:`minutes`,children:ut()}),(0,B.jsx)(E,{value:`hours`,children:we()}),(0,B.jsx)(E,{value:`days`,children:fe()})]})]})]}):(0,B.jsx)(Zt,{value:M.at,onChange:e=>F({...M,at:e,scheduleDirty:!0})})]}),M.hasMessage?(0,B.jsxs)(`label`,{style:{display:`flex`,flexDirection:`column`,gap:4},children:[(0,B.jsx)(`span`,{className:`oc-admin__hint`,style:{margin:0},children:at()}),(0,B.jsx)(`textarea`,{className:`oc-cronedit__textarea`,rows:4,value:M.message,onChange:e=>F({...M,message:e.target.value,messageDirty:!0})})]}):null]}),(0,B.jsxs)(Tt,{children:[(0,B.jsx)(x,{variant:`ghost`,onClick:()=>F(null),children:ae()}),(0,B.jsxs)(x,{onClick:()=>void mn(),disabled:M===null||M.loading||Wt,children:[Wt?(0,B.jsx)(pt,{size:14,className:`oc-actrow__spin`,"aria-hidden":!0}):null,oe()]})]})]})})]})}export{pn as ScheduledTab};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$N as r,$P as i,AP as ee,BP as te,CP as ne,DP as re,EP as ie,FP as ae,GP as oe,HP as se,IP as ce,JP as le,KP as ue,LP as de,MP as fe,NP as pe,OP as me,PP as he,QN as a,QP as ge,RP as _e,SP as ve,TP as ye,UP as be,VP as xe,WP as Se,XN as o,XP as Ce,YN as s,YP as we,ZN as Te,ZP as Ee,_P as De,aF as Oe,aP as c,aV as l,bP as ke,cF as Ae,cP as u,dF as je,dP as d,eF as Me,eP as f,fF as Ne,fP as p,gP as m,hF as Pe,hP as h,iF as Fe,iP as g,jP as Ie,kP as Le,lF as _,lP as v,mF as Re,mP as y,nF as ze,nP as b,oF as Be,oP as x,oV as S,pF as Ve,pP as C,qP as He,rF as Ue,rP as w,rV as We,sF as Ge,sP as T,t as E,tF as Ke,tP as D,uF as O,uP as k,vP as A,wP as qe,xP as Je,yP as Ye,zP as Xe}from"./api-DRlXTl06.js";import{t as j}from"./button-CTuIl1H-.js";import{$ as M,Bn as Ze,Dt as Qe,Et as N,Gn as $e,Hn as et,In as P,Kn as tt,Q as F,U as nt,Un as I,X as L,Z as R,_ as rt,at as z,ct as B,et as V,it as H,jt as U,nt as W,ot as G,rt as it,st as at,tt as K}from"./index-D48cFy6f.js";import{t as ot}from"./FilterBar-Of8GWz2N.js";import{t as st}from"./DataTableShell-C0MSDiic.js";import{t as ct}from"./roleDescriptions-CoFSIkRg.js";var q=t(e(),1),J=n(),lt=[{value:`never`,label:()=>D(),days:null},{value:`30`,label:()=>f(),days:30},{value:`90`,label:()=>r(),days:90}],Y=720*60*60*1e3,X=`__all__`,Z={name:``,roleKey:``,description:``};function Q(){let e=tt({from:`/settings/serviceAccounts`}),t=$e({from:`/settings/serviceAccounts`}),n=e.q??``,r=e.status??X,[a,o]=(0,q.useState)(X),s=e=>void t({search:t=>({...t,q:e||void 0}),replace:!0}),Te=e=>void t({search:t=>({...t,status:e===X?void 0:e})}),De=S(E.apiKeys.listServiceAccounts,{filter:{q:n||void 0,role:a===X?void 0:a,disabled:r===X?void 0:r===`disabled`}}),c=S(E.apiKeys.listKeys,{}),u=S(E.apiKeys.listRoles,{}),d=l(E.apiKeys.createServiceAccount),f=l(E.apiKeys.updateServiceAccount),p=l(E.apiKeys.deleteServiceAccount),m=We(E.apiKeys.mintApiKey),h=l(E.apiKeys.revokeApiKey),g=nt(),v=Qe(),y=n!==``||a!==X||r!==X;function b(){o(X),t({search:{},replace:!0})}let[x,C]=(0,q.useState)(!1),[w,T]=(0,q.useState)(Z),[D,k]=(0,q.useState)(null),[A,P]=(0,q.useState)(new Set),[I,z]=(0,q.useState)(null),B=(0,q.useRef)(!1),[H,W]=(0,q.useState)(new Set),[G,it]=(0,q.useState)({}),[at,K]=(0,q.useState)(null),Y=(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 Q(e){P(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})}async function ft(){try{D?(await f({serviceAccountId:D,name:w.name,roleKey:w.roleKey,description:w.description}),v.success(pe())):await d({name:w.name,roleKey:w.roleKey,description:w.description||void 0}),T(Z),k(null),C(!1)}catch(e){v.error(D?he():ae(),e)}}function pt(e){T({name:e.name,roleKey:e.roleKey,description:e.description??``}),k(e._id),C(!0)}async function mt(e){if(B.current)return;B.current=!0;let t=G[e._id]??`never`,n=lt.find(e=>e.value===t)?.days??null,r=n?Date.now()+n*24*60*60*1e3:void 0;z(e._id);try{let t=await m({serviceAccountId:e._id,expiresAt:r});K({accountName:e.name,plaintext:t.plaintext,prefix:t.prefix,lastFour:t.lastFour})}catch(e){v.error(fe(),e)}finally{B.current=!1,z(null)}}async function $(e){if(await g({title:Ie(),description:(0,J.jsxs)(J.Fragment,{children:[ee(),` `,(0,J.jsx)(`span`,{className:`font-mono`,children:e.name}),` `,Le(),` `,(0,J.jsx)(`strong`,{children:me()}),` `,re()]}),confirmWord:e.name,confirmLabel:ie(),destructive:!0}))try{await p({serviceAccountId:e._id}),v.success(ye(),e.name)}catch(e){v.error(qe(),e)}}async function ht(e){if(await g({title:ne(),description:(0,J.jsxs)(J.Fragment,{children:[ve(),` `,(0,J.jsxs)(`span`,{className:`font-mono`,children:[e.prefix,`…`,e.lastFour]}),` `,Je()]}),confirmLabel:ke(),destructive:!0})&&!H.has(e._id)){W(t=>new Set(t).add(e._id));try{await h({keyId:e._id})}catch(e){v.error(Ye(),e)}finally{W(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:Pe()}),(0,J.jsxs)(ot,{q:n,onQChange:s,searchPlaceholder:Re(),onReset:b,canReset:y,children:[(0,J.jsxs)(L,{value:a,onValueChange:o,children:[(0,J.jsx)(M,{size:`sm`,className:`w-40`,children:(0,J.jsx)(V,{placeholder:Ve()})}),(0,J.jsxs)(R,{children:[(0,J.jsx)(F,{value:X,children:Ne()}),(u??[]).map(e=>(0,J.jsx)(F,{value:e.key,children:e.key},e._id))]})]}),(0,J.jsxs)(L,{value:r,onValueChange:Te,children:[(0,J.jsx)(M,{size:`sm`,className:`w-36`,children:(0,J.jsx)(V,{})}),(0,J.jsxs)(R,{children:[(0,J.jsx)(F,{value:X,children:je()}),(0,J.jsx)(F,{value:`active`,children:O()}),(0,J.jsx)(F,{value:`disabled`,children:_()})]})]})]}),(0,J.jsx)(st,{title:Ae(),rows:De,addLabel:Ge(),onAdd:()=>{T(Z),k(null),C(!0)},emptyHint:Be(),isExpanded:e=>A.has(e._id),renderExpanded:e=>(0,J.jsx)(ut,{account:e,keys:Y.get(e._id)??[],onRevoke:ht,revoking:H}),rowActions:e=>[...(e.managedBy??null)===null?[{label:ze(),onSelect:()=>pt(e)},{label:Oe(),onSelect:()=>void mt(e)}]:[],{label:A.has(e._id)?Fe():Ue(),onSelect:()=>Q(e._id)},...(e.managedBy??null)===null?[{label:Ke(),variant:`destructive`,onSelect:()=>void $(e)}]:[]],columns:[{header:``,className:`w-8`,cell:e=>(0,J.jsx)(j,{variant:`ghost`,size:`icon-sm`,"aria-label":A.has(e._id)?Me():i(),onClick:()=>Q(e._id),children:A.has(e._id)?(0,J.jsx)(et,{}):(0,J.jsx)(Ze,{})})},{header:ge(),sort:e=>e.name,cell:e=>(0,J.jsxs)(`div`,{className:`flex flex-col`,children:[(0,J.jsx)(`span`,{children:e.name}),e.description?(0,J.jsx)(`span`,{className:`text-muted-foreground text-xs`,children:e.description}):null]})},{header:Ee(),sort:e=>e.roleKey,cell:e=>(0,J.jsx)(N,{variant:`secondary`,children:e.roleKey})},{header:Ce(),sort:e=>+!!e.disabled,cell:e=>e.disabled?(0,J.jsx)(N,{variant:`destructive`,children:_()}):(0,J.jsx)(N,{variant:`outline`,children:O()})},{header:we(),cell:e=>(0,J.jsxs)(L,{value:G[e._id]??`never`,onValueChange:t=>it(n=>({...n,[e._id]:t})),children:[(0,J.jsx)(M,{size:`sm`,className:`w-32`,children:(0,J.jsx)(V,{})}),(0,J.jsx)(R,{children:lt.map(e=>(0,J.jsx)(F,{value:e.value,children:e.label()},e.value))})]})},{header:le(),sort:e=>(Y.get(e._id)??[]).filter(e=>!e.disabled).length,cell:e=>{let t=(Y.get(e._id)??[]).filter(e=>!e.disabled).length;return(0,J.jsx)(`span`,{className:`oc-sa__keycount`,children:I===e._id?He():ue({count:t})})}}]}),(0,J.jsx)(rt,{open:x,onOpenChange:e=>{C(e),e||k(null)},title:D?oe():se(),description:D?Se():xe(),canSubmit:!!(w.name&&w.roleKey),onSubmit:ft,submitLabel:D?be():te(),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:Xe()}),(0,J.jsx)(U,{value:w.name,onChange:e=>T({...w,name:e.target.value})})]}),(0,J.jsxs)(`label`,{className:`oc-field`,children:[(0,J.jsx)(`span`,{className:`oc-field__label`,children:_e()}),(0,J.jsxs)(L,{value:w.roleKey||void 0,onValueChange:e=>T({...w,roleKey:e}),children:[(0,J.jsx)(M,{className:`w-full`,children:(0,J.jsx)(V,{placeholder:de()})}),(0,J.jsx)(R,{children:(u??[]).map(e=>(0,J.jsxs)(F,{value:e.key,children:[e.name,` (`,e.key,`)`]},e._id))})]}),(()=>{let e=(u??[]).find(e=>e.key===w.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:ce()}),(0,J.jsx)(U,{value:w.description,onChange:e=>T({...w,description:e.target.value})})]})]})}),(0,J.jsx)(dt,{minted:at,onClose:()=>K(null)})]})}function ut({account:e,keys:t,onRevoke:n,revoking:r}){return(0,J.jsxs)(`div`,{className:`oc-sa__keys`,children:[(0,J.jsxs)(`div`,{className:`oc-sa__keys-head`,children:[A(),` `,(0,J.jsx)(`span`,{className:`font-medium`,children:e.name})]}),t.length===0?(0,J.jsx)(`p`,{className:`oc-admin__hint`,children:De()}):(0,J.jsxs)(`table`,{className:`oc-sa__keytable`,children:[(0,J.jsx)(`thead`,{children:(0,J.jsxs)(`tr`,{children:[(0,J.jsx)(`th`,{children:m()}),(0,J.jsx)(`th`,{children:h()}),(0,J.jsx)(`th`,{children:y()}),(0,J.jsx)(`th`,{children:C()}),(0,J.jsx)(`th`,{children:p()}),(0,J.jsx)(`th`,{children:d()}),(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)(N,{variant:`secondary`,children:e.roleKey})}),(0,J.jsx)(`td`,{children:B(t.createdAt)}),(0,J.jsx)(`td`,{className:ft(t.lastUsedAt)?`oc-sa__stale`:``,children:pt(t.lastUsedAt)}),(0,J.jsx)(`td`,{children:mt(t.expiresAt)}),(0,J.jsx)(`td`,{children:$(t)}),(0,J.jsx)(`td`,{className:`text-right`,children:!t.disabled&&(e.managedBy??null)===null?(0,J.jsx)(j,{variant:`destructive`,size:`sm`,disabled:r.has(t._id),onClick:()=>n(t),children:r.has(t._id)?k():v()}):null})]},t._id))})]})]})}function dt({minted:e,onClose:t}){let[n,r]=(0,q.useState)(!1);async function i(){if(e)try{await navigator.clipboard.writeText(e.plaintext),r(!0),window.setTimeout(()=>r(!1),2e3)}catch{}}return(0,J.jsx)(K,{open:e!==null,onOpenChange:e=>{e||(r(!1),t())},children:e?(0,J.jsxs)(W,{className:`max-w-lg`,showCloseButton:!1,onInteractOutside:e=>e.preventDefault(),onEscapeKeyDown:e=>e.preventDefault(),children:[(0,J.jsxs)(z,{children:[(0,J.jsx)(G,{children:u()}),(0,J.jsx)(it,{children:T({name:e.accountName})})]}),(0,J.jsx)(`div`,{className:`oc-sa__minted-warning`,children:x()}),(0,J.jsxs)(`div`,{className:`oc-sa__minted-box`,children:[(0,J.jsx)(`code`,{className:`oc-sa__minted-plain`,children:e.plaintext}),(0,J.jsxs)(j,{variant:`outline`,size:`sm`,onClick:()=>void i(),"aria-label":c(),children:[n?(0,J.jsx)(I,{}):(0,J.jsx)(P,{}),n?g():w()]})]}),(0,J.jsx)(H,{children:(0,J.jsx)(j,{onClick:()=>{r(!1),t()},children:b()})})]}):null})}function ft(e){return e===null?!1:Date.now()-e>Y}function pt(e){return e===null?a():B(e)}function mt(e){return e===null?`—`:at(e)}function $(e){return e.disabled?(0,J.jsx)(N,{variant:`destructive`,children:Te()}):e.expiresAt!==null&&e.expiresAt<Date.now()?(0,J.jsx)(N,{variant:`outline`,children:o()}):(0,J.jsx)(N,{variant:`outline`,children:s()})}export{Q as ServiceAccountsTab};
|