@lacneu/atrium 0.84.8 → 0.84.10
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-DwOIkqjh.js → AccessTab-DA0B2-p1.js} +1 -1
- package/dist/assets/{AdvancedFilter-DvEmlwDx.js → AdvancedFilter-TKc5grsW.js} +1 -1
- package/dist/assets/AgentFilesTab-B7OQrX4y.js +3 -0
- package/dist/assets/AnomaliesTab-xrQ-RmQj.js +1 -0
- package/dist/assets/{AuditTab-dIKTcJjh.js → AuditTab-B7Y6vAGn.js} +1 -1
- package/dist/assets/BridgeTab-CElygnvP.js +1 -0
- package/dist/assets/ChatDefaultsTab-CU3DO9zW.js +1 -0
- package/dist/assets/{DataTableShell-DxLu0zon.js → DataTableShell-ZFLiEEJc.js} +1 -1
- package/dist/assets/{DetailChips-DtjFz3Cl.js → DetailChips-CXHSZGlV.js} +1 -1
- package/dist/assets/FeedbacksTab-BObjhOqW.js +1 -0
- package/dist/assets/{FieldLabel-CK8GT8Ed.js → FieldLabel-B2Cpweim.js} +1 -1
- package/dist/assets/FilesTab-DutDuSET.js +1 -0
- package/dist/assets/{FilterBar-9-13ggzv.js → FilterBar-CZR_Q6w9.js} +1 -1
- package/dist/assets/GroupsTab-Dn6LQlsN.js +1 -0
- package/dist/assets/InstancesTab-qAgwQenE.js +1 -0
- package/dist/assets/{IntegrationsTab-Cy1MeBH4.js → IntegrationsTab-C7v8lU2L.js} +1 -1
- package/dist/assets/KpiTab-BEvyAWVG.js +1 -0
- package/dist/assets/PreferencesTab-qwZas6rf.js +1 -0
- package/dist/assets/ProjectPage-24r59q5D.js +1 -0
- package/dist/assets/PromptInjectionsTab-BMU1fYMR.js +4 -0
- package/dist/assets/RolesTab-gIkLk6mJ.js +1 -0
- package/dist/assets/ScheduledTab-BPLk_u9g.js +1 -0
- package/dist/assets/ServiceAccountsTab-C8IY-pED.js +1 -0
- package/dist/assets/SubAgentReportsTab-CY_hrkty.js +1 -0
- package/dist/assets/ThemeShowroom-Cz9y9i26.js +1 -0
- package/dist/assets/{TimeRangePicker-Ciowmz1T.js → TimeRangePicker-BP7h0CVq.js} +1 -1
- package/dist/assets/{TimezoneCombobox-BuMVLp5O.js → TimezoneCombobox-C4DaLRiF.js} +1 -1
- package/dist/assets/TracesTab-B--MBX2_.js +1 -0
- package/dist/assets/UsersTab-C1YpbiKb.js +1 -0
- package/dist/assets/VoiceTab-CsZOvDMt.js +1 -0
- package/dist/assets/{api-B9t7A61E.js → api-g4fLRqcn.js} +5 -5
- package/dist/assets/{button-0XSqjZXP.js → button-9Map2_Mq.js} +1 -1
- package/dist/assets/{card-CYCPCZHb.js → card-vmDTx_Sz.js} +1 -1
- package/dist/assets/chevrons-up-down-BGmwuF4V.js +1 -0
- package/dist/assets/{compatView-D1MumhGe.js → compatView-Bybh2x5J.js} +1 -1
- package/dist/assets/{dispatchErrorInfo-D1xpxBzx.js → dispatchErrorInfo-PBD8xjR8.js} +1 -1
- package/dist/assets/{dist-Oj4yphsZ.js → dist-Cr7Kt6Vr.js} +1 -1
- package/dist/assets/{dist-C4d8uVQm.js → dist-DSemkDpT.js} +1 -1
- package/dist/assets/{highlighted-body-OFNGDK62-BrVwiJIR.js → highlighted-body-OFNGDK62-BiIN4hqA.js} +1 -1
- package/dist/assets/index-En2P3pYV.js +324 -0
- package/dist/assets/{list-CyLAzYcK.js → list-D3DZqopJ.js} +1 -1
- package/dist/assets/mermaid-GHXKKRXX-Uv2y4Chs.js +1 -0
- package/dist/assets/{pdf-COwXX1vG.js → pdf-Cpu1irfm.js} +1 -1
- package/dist/assets/roleDescriptions-R6x2FbmB.js +1 -0
- package/dist/assets/{table-CmKoxbAD.js → table-bInarL4h.js} +1 -1
- package/dist/assets/{tabs-BC9QRLg2.js → tabs-Cr9M-Ay4.js} +1 -1
- package/dist/assets/x-BMi_TSTa.js +1 -0
- package/dist/index.html +6 -6
- package/package.json +1 -1
- package/dist/assets/AgentFilesTab-BdJoW_B3.js +0 -3
- package/dist/assets/AnomaliesTab-DcBUy-Iv.js +0 -1
- package/dist/assets/BridgeTab-zSreXnvo.js +0 -1
- package/dist/assets/ChatDefaultsTab-DM6oDppQ.js +0 -1
- package/dist/assets/FeedbacksTab-Dadkmk36.js +0 -1
- package/dist/assets/FilesTab-C9iAwEHd.js +0 -1
- package/dist/assets/GroupsTab-Ci0S4Ogz.js +0 -1
- package/dist/assets/InstancesTab-DAJbdWAN.js +0 -1
- package/dist/assets/KpiTab-BirIJa9l.js +0 -1
- package/dist/assets/PreferencesTab-CQUv8BYH.js +0 -1
- package/dist/assets/ProjectPage-DBCUAO0Q.js +0 -1
- package/dist/assets/PromptInjectionsTab-CSqvxWfZ.js +0 -4
- package/dist/assets/RolesTab-C_LMKg-r.js +0 -1
- package/dist/assets/ScheduledTab-CLTLVvmv.js +0 -1
- package/dist/assets/ServiceAccountsTab-Cey5If4a.js +0 -1
- package/dist/assets/SubAgentReportsTab-CX0Z6Ypv.js +0 -1
- package/dist/assets/ThemeShowroom-DXyP61WS.js +0 -1
- package/dist/assets/TracesTab-NYwTT5zR.js +0 -1
- package/dist/assets/UsersTab-DHNEp3ZU.js +0 -1
- package/dist/assets/VoiceTab-C2pYNrss.js +0 -1
- package/dist/assets/chevrons-up-down-B8AMH6vo.js +0 -1
- package/dist/assets/index-CqHFDZOR.js +0 -324
- package/dist/assets/mermaid-GHXKKRXX-Cc4ompYC.js +0 -1
- package/dist/assets/roleDescriptions-I0nZMu-C.js +0 -1
- package/dist/assets/x-YGyI1mI9.js +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{$w as e,eT as t,nT as n,rT as r,tT as i}from"./api-g4fLRqcn.js";var a={pending:r,user:n,admin:i,observer:t,agent:e};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-g4fLRqcn.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-g4fLRqcn.js";import{Gt as d,Jt as f,Kt as p,qt as m}from"./index-En2P3pYV.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-g4fLRqcn.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-En2P3pYV.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-g4fLRqcn.js">
|
|
68
|
+
<link rel="modulepreload" crossorigin href="/assets/dist-Cr7Kt6Vr.js">
|
|
69
|
+
<link rel="modulepreload" crossorigin href="/assets/dist-DSemkDpT.js">
|
|
70
|
+
<link rel="modulepreload" crossorigin href="/assets/x-BMi_TSTa.js">
|
|
71
|
+
<link rel="modulepreload" crossorigin href="/assets/button-9Map2_Mq.js">
|
|
72
72
|
<link rel="stylesheet" crossorigin href="/assets/index-BpLlUFfO.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.10",
|
|
4
4
|
"description": "Atrium — public, self-hostable, Convex-backed web chat UI for AI agent gateways (OpenClaw today, Hermes next). Ships an origin-agnostic static bundle (Convex URL injected at runtime via /config.json).",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$d as r,Bd as i,Bo as a,CB as o,Fd as s,Fo as c,Gd as l,Gf as u,Go as d,Hd as f,Ho as p,Id as m,Io as h,Jd as g,Jo as _,Jt as ee,Kd as v,Ko as y,Ld as b,Lo as x,Md as S,Mo as C,Nd as w,No as T,Pd as E,Po as D,Qd as te,Qo as O,Rd as k,Ro as A,SB as j,Ud as M,Uo as N,Vd as P,Vo as F,Wd as ne,Wo as I,Xd as re,Xo as L,Yd as R,Yo as ie,Zd as z,Zo as B,af as ae,bB as V,do as oe,ef as se,fo as ce,gB as le,go as ue,ho as de,if as fe,mB as H,mo as pe,nf as me,of as he,po as ge,qd as _e,qf as U,qo as W,rf as ve,sf as ye,t as G,tf as be,uo as xe,yM as Se,zd as Ce,zo as we}from"./api-B9t7A61E.js";import{t as K}from"./button-0XSqjZXP.js";import{$ as Te,B as Ee,Ct as De,Dt as q,Et as Oe,Q as ke,St as Ae,Tt as je,X as Me,Z as Ne,at as Pe,bt as Fe,et as Ie,nt as Le,ot as Re,q as ze,rt as Be,tt as Ve,un as J,vt as He,wt as Ue,xt as We,yt as Ge}from"./index-CqHFDZOR.js";import{n as Ke,t as qe}from"./curation-CQksaIbm.js";import{a as Je}from"./compatView-D1MumhGe.js";/* empty css */var Y=t(e(),1),X=2e4,Ye=6e4;function Xe(e){return typeof e!=`number`||e<=0?0:Math.round(e/X*100)}function Ze(e){return e<=0?0:Math.round(e/Ye*100)}function Z(e,t){let n=(typeof e==`number`&&e>0?e:0)/1e3;return new Intl.NumberFormat(t,{minimumFractionDigits:1,maximumFractionDigits:1}).format(n)}function Qe(e){return e.reduce((e,t)=>e+(typeof t.size==`number`&&t.size>0?t.size:0),0)}var $e=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<$e&&a.push(e)):t>0&&(i+=t,o.length<$e&&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=o(G.me.getMe,{host:ze}),t=e?.role===`admin`,n=(e?.permissions??[]).includes(`bridge.read`),i=o(G.admin.listInstances,e!==void 0&&t?{}:`skip`),[a,s]=(0,Y.useState)(null);(0,Y.useEffect)(()=>{!t||!i||i.length===0||(!a||!i.some(e=>e.name===a))&&s(i[0].name)},[t,i,a]);let c=o(G.agents.listAgentsForInstance,t&&a?{instanceName:a}:`skip`),l=o(G.agents.listMyAgents,e!==void 0&&!t?{}:`skip`),d=(0,Y.useMemo)(()=>{if(e!==void 0){if(t)return a===null||c===void 0?i!==void 0&&i.length===0?[]:void 0:c.agents.map(e=>({instanceName:a,agentId:e.agentId,label:`${e.emoji?`${e.emoji} `:``}${e.displayName??e.agentId}`}));if(l!==void 0)return l.map(e=>({instanceName:e.instanceName,agentId:e.agentId,label:`${e.emoji?`${e.emoji} `:``}${e.displayName??e.agentId}`}))}},[e,t,a,c,i,l]),[f,p]=(0,Y.useState)(null);(0,Y.useEffect)(()=>{!d||d.length===0||(!f||!d.some(e=>$(e)===f))&&p($(d[0]))},[d,f]);let m=d?.find(e=>$(e)===f)??null,h=V(G.agentFiles.listAgentFiles),[g,v]=(0,Y.useState)({status:`idle`}),y=m?.instanceName??null,b=m?.agentId??null,x=o(G.compat.forInstance,n&&y!==null?{instanceName:y}:`skip`),S=n&&y!==null?Ee(x,`agentFiles`):null,C=S===null?!1:S===`loading`?null:S.blocked,w=(0,Y.useCallback)(async()=>{if(!(y===null||b===null)){v({status:`loading`});try{v({status:`done`,files:(await h({instanceName:y,agentId:b})).files})}catch(e){v({status:`error`,dashboardAbsent:tt(e)})}}},[h,y,b]);(0,Y.useEffect)(()=>{C===!1&&w()},[w,C]);let[T,E]=(0,Y.useState)(null),D=o(G.agentFileCuration.listCurations,t&&y!==null&&b!==null?{instanceName:y,agentId:b}:`skip`),O=o(G.agentFileCuration.curationSettings,t&&y!==null?{instanceName:y}:`skip`),k=V(G.agentFileCuration.requestCuration),[A,j]=(0,Y.useState)(null),[M,N]=(0,Y.useState)(null),{toast:P}=q(),F=(0,Y.useMemo)(()=>{let e=new Map;for(let t of D??[])e.has(t.name)||e.set(t.name,t);return e},[D]),ne=(0,Y.useCallback)(async e=>{if(!(y===null||b===null)){j(e);try{let t=await k({instanceName:y,agentId:b,name:e,trigger:`manual`});t.ok?P({title:ie(),variant:`success`}):P({title:_({reason:t.reason??`unknown`}),variant:`error`})}catch{P({title:W(),variant:`error`})}finally{j(null)}}},[k,y,b,P]),I=le(),L=(0,Y.useMemo)(()=>new Intl.NumberFormat(I,{maximumFractionDigits:0}),[I]);return e===void 0||d===void 0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:H()}):(0,Q.jsxs)(`div`,{className:`oc-afiles`,children:[(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:ye()}),(0,Q.jsxs)(`div`,{className:`oc-afiles__picker`,children:[t&&(i?.length??0)>1?(0,Q.jsxs)(Me,{value:a??``,onValueChange:e=>s(e),children:[(0,Q.jsx)(Te,{size:`sm`,"aria-label":he(),children:(0,Q.jsx)(Ie,{})}),(0,Q.jsx)(Ne,{children:(i??[]).map(e=>(0,Q.jsx)(ke,{value:e.name,children:e.name},e.name))})]}):null,d.length>0?(0,Q.jsxs)(Me,{value:f??``,onValueChange:e=>p(e),children:[(0,Q.jsx)(Te,{size:`sm`,"aria-label":ae(),children:(0,Q.jsx)(Ie,{})}),(0,Q.jsx)(Ne,{children:d.map(e=>(0,Q.jsx)(ke,{value:$(e),children:e.label},$(e)))})]}):(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:fe()})]}),m===null?null:S===`loading`?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:H()}):S!==null&&S.blocked?(0,Q.jsxs)(`p`,{className:`oc-compat__blocked`,role:`status`,children:[(0,Q.jsx)(J,{size:14,"aria-hidden":!0}),` `,Je(S.gatewayVersion,S.provider)]}):g.status===`loading`||g.status===`idle`?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:H()}):g.status===`error`?(0,Q.jsxs)(`p`,{className:`oc-afiles__error`,role:`alert`,children:[g.dashboardAbsent?ee():me(),` `,!g.dashboardAbsent&&(0,Q.jsx)(K,{variant:`outline`,size:`sm`,onClick:()=>void w(),children:u()})]}):g.files.length===0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:ve()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`div`,{className:`oc-afiles__list`,children:g.files.map(e=>{let n=Xe(e.size),i=n>=80;return(0,Q.jsxs)(`div`,{className:`oc-afiles__row`,children:[(0,Q.jsx)(`span`,{className:`oc-afiles__name`,title:e.name,children:e.name}),e.missing?(0,Q.jsx)(Oe,{variant:`outline`,children:be()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`span`,{className:`oc-afiles__size`,children:se({size:Z(e.size,I)})}),(0,Q.jsx)(`span`,{className:`oc-afiles__gauge${i?` is-warn`:``}`,"aria-hidden":!0,children:(0,Q.jsx)(`span`,{className:`oc-afiles__gauge-fill`,style:{width:`${Math.min(n,100)}%`}})}),(0,Q.jsx)(`span`,{className:`oc-afiles__pct`,children:r({pct:L.format(n)})}),i?(0,Q.jsx)(J,{size:14,className:`oc-afiles__warn`,"aria-label":te()}):(0,Q.jsx)(`span`,{className:`oc-afiles__warn-slot`,"aria-hidden":!0})]}),(0,Q.jsx)(K,{variant:`outline`,size:`sm`,className:`oc-afiles__open`,onClick:()=>E(e),children:t?re():R()}),t&&!e.missing?(0,Q.jsx)(it,{curatable:qe.includes(e.name),size:e.size??0,budget:O?.budgetChars??null,enabled:O?.enabled??!1,curation:F.get(e.name)??null,inFlight:A===e.name,onCurate:()=>void ne(e.name),onReview:e=>N(e)}):null]},e.name)})}),(0,Q.jsx)(`p`,{className:`oc-afiles__budget`,children:z({used:Z(Qe(g.files),I),total:Z(Ye,I),pct:L.format(Ze(Qe(g.files)))})})]}),T&&m?(0,Q.jsx)(at,{instanceName:m.instanceName,agentId:m.agentId,name:T.name,isAdmin:t,onClose:()=>E(null),onSaved:()=>void w()}):null,M?(0,Q.jsx)(ot,{curationId:M,onClose:()=>N(null),onApplied:()=>{N(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)(K,{variant:`default`,size:`sm`,className:`oc-afiles__curate`,onClick:()=>s(i._id),children:B()}):a||i?.status===`dispatched`||i?.status===`applying`?(0,Q.jsx)(Oe,{variant:`outline`,className:`oc-afiles__curate-status`,children:L()}):e&&r&&n!==null&&Ke(t,n)?(0,Q.jsx)(K,{variant:`outline`,size:`sm`,className:`oc-afiles__curate`,onClick:o,children:O()}):null}function at({instanceName:e,agentId:t,name:n,isAdmin:r,onClose:a,onSaved:o}){let c=V(G.agentFiles.getAgentFile),d=V(G.agentFiles.setAgentFile),p=q(),[h,_]=(0,Y.useState)(null),[ee,y]=(0,Y.useState)(!1),[x,C]=(0,Y.useState)(``),[T,D]=(0,Y.useState)(!1),[te,O]=(0,Y.useState)(!1),[A,j]=(0,Y.useState)(!1),[N,F]=(0,Y.useState)(!1),I=(0,Y.useCallback)(async r=>{y(!1);try{let i=await c({instanceName:e,agentId:t,name:n});_({content:i.content,updatedAtMs:i.updatedAtMs}),r||C(i.content),j(!1)}catch{y(!0)}},[c,e,t,n]);(0,Y.useEffect)(()=>{I(!1)},[I]);async function re(){if(h!==null){O(!0),F(!1);try{await d({instanceName:e,agentId:t,name:n,content:x,baseUpdatedAtMs:h.updatedAtMs??void 0}),p.success(f({name:n})),o(),await I(!1)}catch(e){nt(e)?j(!0):F(!0)}finally{O(!1)}}}let L=h!==null&&x!==h.content,R=(0,Y.useMemo)(()=>h===null?null:et(h.content,x),[h,x]),ie=x.length>X,z=le(),B=(0,Y.useMemo)(()=>new Intl.NumberFormat(z),[z]);return(0,Q.jsx)(Ve,{open:!0,onOpenChange:e=>!e&&a(),children:(0,Q.jsxs)(Le,{className:`oc-afiles__editor`,children:[(0,Q.jsxs)(Pe,{children:[(0,Q.jsx)(Re,{children:g({name:n})}),(0,Q.jsxs)(Be,{children:[_e({agent:t,instance:e}),r?null:(0,Q.jsxs)(Q.Fragment,{children:[` · `,v()]})]})]}),ee?(0,Q.jsxs)(`p`,{className:`oc-afiles__error`,role:`alert`,children:[i(),` `,(0,Q.jsx)(K,{variant:`outline`,size:`sm`,onClick:()=>void I(!1),children:u()})]}):h===null?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:H()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`textarea`,{className:`oc-afiles__source`,value:x,readOnly:!r,spellCheck:!1,onChange:e=>C(e.target.value),"aria-label":g({name:n})}),(0,Q.jsx)(`p`,{className:`oc-afiles__hint`,children:l()}),A?(0,Q.jsxs)(`p`,{className:`oc-afiles__error`,role:`alert`,children:[Ce(),` `,(0,Q.jsx)(K,{variant:`outline`,size:`sm`,onClick:()=>void I(!0),children:k()})]}):null,N?(0,Q.jsx)(`p`,{className:`oc-afiles__error`,role:`alert`,children:P()}):null,(0,Q.jsxs)(`div`,{className:`oc-afiles__editor-foot`,children:[(0,Q.jsx)(`span`,{className:`oc-afiles__count${ie?` is-over`:``}`,children:ne({count:B.format(x.length),max:B.format(X)})}),r?(0,Q.jsx)(K,{size:`sm`,disabled:!L||te||A,onClick:()=>D(!0),children:te?U():M()}):null]})]}),(0,Q.jsx)(He,{open:T,onOpenChange:D,children:(0,Q.jsxs)(We,{children:[(0,Q.jsxs)(Ue,{children:[(0,Q.jsx)(je,{children:b({name:n})}),(0,Q.jsx)(Ae,{children:m({agent:t})})]}),R?(0,Q.jsxs)(`div`,{className:`oc-afiles__diff`,children:[(0,Q.jsx)(`p`,{className:`oc-afiles__diff-counts`,children:s({added:R.added,removed:R.removed})}),R.sampleAdded.length>0?(0,Q.jsxs)(`div`,{className:`oc-afiles__diff-block`,children:[(0,Q.jsx)(`span`,{className:`oc-afiles__diff-label`,children:E()}),R.sampleAdded.map((e,t)=>(0,Q.jsx)(`code`,{className:`oc-afiles__diff-line is-add`,children:e||` `},t))]}):null,R.sampleRemoved.length>0?(0,Q.jsxs)(`div`,{className:`oc-afiles__diff-block`,children:[(0,Q.jsx)(`span`,{className:`oc-afiles__diff-label`,children:w()}),R.sampleRemoved.map((e,t)=>(0,Q.jsx)(`code`,{className:`oc-afiles__diff-line is-del`,children:e||` `},t))]}):null]}):null,(0,Q.jsxs)(De,{children:[(0,Q.jsx)(Fe,{children:Se()}),(0,Q.jsx)(Ge,{onClick:()=>void re(),children:S()})]})]})})]})})}function ot({curationId:e,onClose:t,onApplied:n}){let r=o(G.agentFileCuration.getProposal,{curationId:e}),i=V(G.agentFileCuration.approveCuration),s=j(G.agentFileCuration.rejectCuration),{toast:l}=q(),[u,f]=(0,Y.useState)(null),[m,g]=(0,Y.useState)(!1),[_,ee]=(0,Y.useState)(``),v=le(),b=(0,Y.useMemo)(()=>r?et(r.beforeContent,r.proposedContent):null,[r]);async function S(){f(`approve`);try{let t=await i({curationId:e});t.ok?(l({title:y(),variant:`success`}),n()):l({title:t.reason===`conflict`?I():N({reason:t.reason??`unknown`}),variant:`error`})}catch{l({title:W(),variant:`error`})}finally{f(null)}}async function w(n){f(`reject`);try{let r=_.trim();(await s({curationId:e,...r?{comment:r}:{},relaunch:n})).ok?l({title:n?oe():d(),variant:`success`}):l({title:a(),variant:`error`}),t()}catch{l({title:W(),variant:`error`})}finally{f(null)}}return(0,Q.jsx)(Ve,{open:!0,onOpenChange:e=>e?void 0:t(),children:(0,Q.jsxs)(Le,{className:`oc-afiles__review`,children:[(0,Q.jsxs)(Pe,{children:[(0,Q.jsx)(Re,{children:r?p({name:r.name}):H()}),(0,Q.jsx)(Be,{children:F()})]}),r===void 0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:H()}):r===null?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:a()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`p`,{className:`oc-afiles__review-sizes`,children:[we({before:Z(r.beforeSize,v),after:Z(r.proposedSize,v)}),r.overBudget?(0,Q.jsxs)(Q.Fragment,{children:[` `,(0,Q.jsx)(J,{size:13,"aria-hidden":!0}),` `,A()]}):null]}),b?(0,Q.jsx)(`p`,{className:`oc-afiles__review-diff`,children:x({added:b.added,removed:b.removed})}):null,r.feedback?(0,Q.jsx)(`p`,{className:`oc-afiles__review-feedback`,children:xe({feedback:r.feedback})}):null,b&&b.sampleRemoved.length>0?(0,Q.jsxs)(`div`,{className:`oc-afiles__review-removed`,children:[(0,Q.jsx)(`p`,{className:`oc-afiles__review-label`,children:C()}),(0,Q.jsx)(`ul`,{children:b.sampleRemoved.map((e,t)=>(0,Q.jsx)(`li`,{children:e||`\xA0`},t))})]}):null,(0,Q.jsxs)(`div`,{className:`oc-afiles__review-panes oc-afiles__review-panes--2`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`p`,{className:`oc-afiles__review-label`,children:T()}),(0,Q.jsx)(`pre`,{className:`oc-afiles__review-pre`,children:r.beforeContent})]}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`p`,{className:`oc-afiles__review-label`,children:h()}),(0,Q.jsx)(`pre`,{className:`oc-afiles__review-pre`,children:r.proposedContent})]})]})]}),m?(0,Q.jsxs)(`div`,{className:`oc-afiles__reject-form`,children:[(0,Q.jsx)(`label`,{className:`oc-afiles__review-label`,htmlFor:`curation-reject-comment`,children:ue()}),(0,Q.jsx)(`textarea`,{id:`curation-reject-comment`,className:`oc-afiles__reject-textarea`,rows:3,placeholder:de(),value:_,onChange:e=>ee(e.target.value)}),(0,Q.jsxs)(`div`,{className:`oc-afiles__review-actions`,children:[(0,Q.jsx)(K,{variant:`ghost`,onClick:()=>g(!1),disabled:u!==null,children:pe()}),(0,Q.jsx)(K,{variant:`outline`,onClick:()=>void w(!1),disabled:u!==null,children:u===`reject`?U():ge()}),(0,Q.jsx)(K,{variant:`default`,onClick:()=>void w(!0),disabled:u!==null,children:u===`reject`?U():ce()})]})]}):(0,Q.jsxs)(`div`,{className:`oc-afiles__review-actions`,children:[(0,Q.jsx)(K,{variant:`outline`,onClick:()=>g(!0),disabled:u!==null||r==null,children:c()}),(0,Q.jsx)(K,{variant:`default`,onClick:()=>void S(),disabled:u!==null||r==null,children:u===`approve`?U():D()})]})]})})}export{rt as AgentFilesTab};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$C as r,Aw as i,Bw as a,CB as o,Cw as ee,Dw as te,Ew as ne,Fw as re,Iw as s,JC as c,KC as l,Lw as ie,Mw as ae,Nw as oe,Ow as se,Pw as ce,QC as u,Rw as le,SB as ue,Sw as de,Tw as fe,Vw as d,XC as f,YC as p,ZC as m,_w as pe,aw as h,bw as g,cw as _,dw as v,ew as me,fw as he,gw as ge,hw as _e,iw as ve,jw as ye,kw as be,lw as xe,mw as Se,nw as Ce,ow as y,pw as b,qC as x,rw as S,sw as C,t as w,tw as T,uw as E,vw as D,ww as O,xw as k,yw as A,zw as j}from"./api-B9t7A61E.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 Oe,ot as H,q as ke,tt as U}from"./index-CqHFDZOR.js";import{n as Ae}from"./TimeRangePicker-Ciowmz1T.js";import{t as je}from"./FilterBar-9-13ggzv.js";import{t as Me}from"./DataTableShell-DxLu0zon.js";import{t as W}from"./dispatchErrorInfo-D1xpxBzx.js";var G=t(e(),1),K=n(),q=`__all__`,Ne=[{value:`open`},{value:`acknowledged`},{value:`resolved`}];function Pe(e){return e===`open`?d():e===`acknowledged`?a():j()}var Fe=[`info`,`warn`,`critical`],Ie=[`detector`,`agent`,`user`],Le={kind:`relative`,from:`now-30d`,to:`now`},Re=200,J=`all`;function Y(){let e=Te({from:`/settings/anomalies`}),t=P({from:`/settings/anomalies`}),n=e.q??``,r=e.status===J?q:e.status,a=e.severity??q,c=e.kind??q,[l,u]=(0,G.useState)(q),d=De(e.from,e.to),{from:f,to:p}=Ae(d),m=e=>void t({search:t=>({...t,q:e||void 0}),replace:!0}),x=e=>void t({search:t=>({...t,status:e===q?J:e})}),j=e=>void t({search:t=>({...t,severity:e===q?void 0:e})}),R=e=>void t({search:t=>({...t,kind:e===q?void 0:e})}),V=e=>void t({search:t=>({...t,...Oe(e)})}),H=Ee(),U=we(),W=ue(w.anomalies.resolveAnomaly),Y=(o(w.me.getMe,{host:ke})?.permissions??[]).includes(`admin.manage`),X=o(w.anomalies.listAnomalies,{limit:Re,filter:{q:n||void 0,from:f,to:p,anomalyStatus:r===q?void 0:r,severity:a===q?void 0:a,source:l===q?void 0:l,kind:c===q?void 0:c}}),Z=(0,G.useMemo)(()=>{let e=new Set;for(let t of X??[])e.add(t.kind);return[...e].sort()},[X]),Q=n!==``||r!==`open`||a!==q||l!==q||c!==q||d.kind!==`relative`||d.from!==Le.from;function Ue(){u(q),t({search:{status:`open`},replace:!0})}async function We(e){if(await H({title:le(),description:(0,K.jsxs)(K.Fragment,{children:[ie(),` `,(0,K.jsx)(`span`,{className:`font-mono`,children:e.kind}),` `,s(),` `,(0,K.jsx)(`strong`,{children:re()}),`.`,` `,ce()]}),confirmLabel:oe()}))try{await W({anomalyId:e._id,status:`resolved`}),U.success(ae(),e.kind)}catch(e){U.error(ye(),e)}}async function Ge(e){try{await W({anomalyId:e._id,status:`acknowledged`}),U.success(i(),e.kind)}catch(e){U.error(be(),e)}}return(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)(`p`,{className:`oc-admin__hint`,children:[se(),` `,(0,K.jsx)(`strong`,{children:te()}),` `,ne(),` `,(0,K.jsx)(`strong`,{children:fe()}),` `,O(),` `,(0,K.jsx)(`strong`,{children:ee()}),` `,de(),` `,(0,K.jsx)(`span`,{className:`oc-filter__window`,children:k()})]}),(0,K.jsxs)(je,{q:n,onQChange:m,searchPlaceholder:g(),timeRange:d,onTimeRangeChange:V,onReset:Ue,canReset:Q,children:[(0,K.jsxs)(I,{value:r,onValueChange:x,children:[(0,K.jsx)(M,{size:`sm`,className:`w-36`,children:(0,K.jsx)(B,{})}),(0,K.jsxs)(L,{children:[(0,K.jsx)(F,{value:q,children:A()}),Ne.map(e=>(0,K.jsx)(F,{value:e.value,children:Pe(e.value)},e.value))]})]}),(0,K.jsxs)(I,{value:a,onValueChange:j,children:[(0,K.jsx)(M,{size:`sm`,className:`w-36`,children:(0,K.jsx)(B,{placeholder:D()})}),(0,K.jsxs)(L,{children:[(0,K.jsx)(F,{value:q,children:Se()}),Fe.map(e=>(0,K.jsx)(F,{value:e,children:e},e))]})]}),(0,K.jsxs)(I,{value:l,onValueChange:u,children:[(0,K.jsx)(M,{size:`sm`,className:`w-32`,children:(0,K.jsx)(B,{placeholder:b()})}),(0,K.jsxs)(L,{children:[(0,K.jsx)(F,{value:q,children:he()}),Ie.map(e=>(0,K.jsx)(F,{value:e,children:e},e))]})]}),(0,K.jsxs)(I,{value:c,onValueChange:R,children:[(0,K.jsx)(M,{size:`sm`,className:`w-36`,children:(0,K.jsx)(B,{placeholder:v()})}),(0,K.jsxs)(L,{children:[(0,K.jsx)(F,{value:q,children:E()}),Z.map(e=>(0,K.jsx)(F,{value:e,children:e},e))]})]})]}),(0,K.jsx)(Me,{title:xe(),rows:X,emptyHint:r===`open`?_():C(),rowActions:e=>Y&&e.status===`open`?[{label:y(),onSelect:()=>void We(e)},{label:h(),onSelect:()=>void Ge(e)}]:[],columns:[{header:ve(),cell:e=>(0,K.jsx)(`span`,{className:`oc-traces__time`,children:z(e.at)}),sort:e=>e.at},{header:v(),cell:e=>(0,K.jsx)(`code`,{className:`oc-traces__mono`,children:e.kind}),sort:e=>e.kind},{header:pe(),cell:e=>e.occurrenceCount!==null&&e.occurrenceCount>1?(0,K.jsx)(`span`,{className:`oc-traces__time`,title:e.firstAt===null?void 0:_e({when:z(e.firstAt)}),children:ge({count:String(e.occurrenceCount)})}):(0,K.jsx)(`span`,{className:`oc-traces__time`,children:`—`}),sort:e=>e.occurrenceCount??0},{header:D(),cell:e=>(0,K.jsx)(Be,{severity:e.severity}),sort:e=>e.severity===`critical`?2:+(e.severity===`warn`)},{header:S(),cell:e=>(0,K.jsx)(Ve,{status:e.status}),sort:e=>e.status===`resolved`?2:+(e.status===`acknowledged`)},{header:b(),cell:e=>(0,K.jsx)(N,{variant:`outline`,children:e.source}),sort:e=>e.source},{header:Ce(),cell:e=>(0,K.jsxs)(`div`,{className:`oc-anomaly__msgcell`,children:[(0,K.jsx)(`span`,{className:`oc-anomaly__msg`,children:e.message}),(0,K.jsx)(ze,{row:e})]}),sort:e=>e.message},{header:T(),cell:e=>(0,K.jsx)($,{row:e}),sort:e=>e.evidence??null},{header:me(),cell:e=>e.correlationId?(0,K.jsx)(`code`,{className:`oc-traces__mono`,children:He(e.correlationId)}):(0,K.jsx)(`span`,{className:`oc-traces__muted`,children:`—`}),sort:e=>e.correlationId}]})]})}var X=new Set([`openclaw.dispatch_failures`,`assistant.announce_errors`]);function Z(e){if(!X.has(e.kind)||!e.evidence)return{};try{let t=JSON.parse(e.evidence);return{dominantCode:t.dominantCode,sampleCorrelationId:t.sampleCorrelationId}}catch{return{}}}function Q(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 $({row:e}){let t=P();if(e.kind===`subagent.failure`){let n=Q(e);return(0,K.jsxs)(`div`,{className:`oc-anomaly__cause`,children:[(0,K.jsx)(`div`,{className:`oc-anomaly__cause-head`,children:[...new Set(n.errorCategories??[])].map(e=>(0,K.jsx)(`code`,{className:`oc-traces__mono`,children:e},e))}),e.correlationId?(0,K.jsxs)(`button`,{type:`button`,className:`oc-anomaly__drill`,onClick:()=>void t({to:`/settings/traces`,search:{q:e.correlationId,limit:100}}),children:[`↗ `,r()]}):null]})}let n=Z(e);if(!n.dominantCode){let e=n.sampleCorrelationId;return e?(0,K.jsx)(`div`,{className:`oc-anomaly__cause`,children:(0,K.jsxs)(`button`,{type:`button`,className:`oc-anomaly__drill`,onClick:()=>void t({to:`/settings/traces`,search:{correlationId:e,limit:100}}),children:[`↗ `,r()]})}):(0,K.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})}let i=W(n.dominantCode),a=n.sampleCorrelationId;return(0,K.jsxs)(`div`,{className:`oc-anomaly__cause`,children:[(0,K.jsxs)(`div`,{className:`oc-anomaly__cause-head`,children:[(0,K.jsx)(`span`,{className:`oc-anomaly__cause-label`,children:i.label}),(0,K.jsx)(`code`,{className:`oc-traces__mono`,children:n.dominantCode})]}),(0,K.jsx)(`p`,{className:`oc-anomaly__cause-hint`,children:i.hint}),a?(0,K.jsxs)(`button`,{type:`button`,className:`oc-anomaly__drill`,onClick:()=>void t({to:`/settings/traces`,search:{correlationId:a,limit:100}}),children:[`↗ `,r()]}):null]})}function ze({row:e}){let[t,n]=(0,G.useState)(!1),r=o(w.anomalies.getAnomalyAttachments,t?{anomalyId:e._id}:`skip`);return!e.attachments||e.attachments.length===0?null:(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)(`button`,{type:`button`,className:`oc-anomaly__drill`,onClick:()=>n(!0),children:[u(),e.attachments.length>1?` (${e.attachments.length})`:``]}),(0,K.jsx)(U,{open:t,onOpenChange:n,children:(0,K.jsxs)(V,{className:`oc-anomaly__attachments-dialog`,children:[(0,K.jsx)(R,{children:(0,K.jsx)(H,{children:m()})}),r===void 0?(0,K.jsx)(`p`,{className:`oc-traces__muted`,children:f()}):r.length===0?(0,K.jsx)(`p`,{className:`oc-traces__muted`,children:p()}):(0,K.jsx)(`div`,{className:`oc-anomaly__attachments`,children:r.map(e=>(0,K.jsxs)(`section`,{className:`oc-anomaly__attachment`,children:[(0,K.jsx)(`h4`,{className:`oc-anomaly__attachment-name`,children:(0,K.jsx)(`code`,{className:`oc-traces__mono`,children:e.name})}),(0,K.jsx)(`pre`,{className:`oc-anomaly__attachment-content`,children:e.content})]},e.name))})]})})]})}function Be({severity:e}){return(0,K.jsx)(`span`,{className:`oc-anomaly__sev oc-anomaly__sev--${e}`,children:e})}function Ve({status:e}){return e===`open`?(0,K.jsx)(N,{variant:`destructive`,children:c()}):e===`acknowledged`?(0,K.jsx)(N,{variant:`secondary`,children:x()}):(0,K.jsx)(N,{variant:`outline`,children:l()})}function He(e){return e.length>8?e.slice(0,8):e}export{Y as AnomaliesTab};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$b as r,Ab as i,Ai as a,Bb as o,Bx as s,CB as c,Cb as l,D as u,Db as d,Eb as f,Fb as p,Gb as m,Gx as h,Hb as g,Hx as ee,Ib as _,Ii as v,Ix as te,Jb as y,Kb as ne,Kx as re,Lb as ie,Lx as ae,Mb as oe,Mi as se,Mx as ce,Nb as le,Ni as ue,Nx as de,Ob as fe,Pb as pe,Qb as me,Rb as he,Rx as ge,SB as _e,Sb as ve,Tb as ye,Ub as be,Ux as xe,Vb as Se,Vx as Ce,Wb as we,Xb as Te,Yb as Ee,Yt as De,Zb as Oe,_b as ke,_d as Ae,ax as je,bB as Me,bb as Ne,bd as Pe,cx as Fe,dd as Ie,ex as Le,fb as b,fd as Re,gb as ze,gd as x,hb as Be,hd as Ve,id as He,ix as Ue,jb as We,ji as Ge,kb as Ke,ki as qe,ld as Je,lx as Ye,mb as S,md as Xe,nx as Ze,ox as Qe,pb as C,pd as $e,qb as et,rx as tt,sx as nt,t as w,tx as rt,ud as it,ux as at,vb as ot,vd as st,wb as ct,xb as lt,xd as ut,yb as dt,yd as ft,zb as pt,zx as mt}from"./api-B9t7A61E.js";import{t as ht}from"./chevrons-up-down-B8AMH6vo.js";import{i as gt,n as T,o as _t,r as vt,s as yt}from"./FieldLabel-CK8GT8Ed.js";import{i as bt,n as xt,r as St,t as Ct}from"./tabs-BC9QRLg2.js";import{t as E}from"./button-0XSqjZXP.js";import{$ as D,Bn as O,Bt as wt,Dn as Tt,Dt as Et,Et as k,F as Dt,Gn as A,Hn as j,Kn as Ot,Q as M,Rn as N,Rt as kt,X as P,Z as F,at as At,ct as jt,et as I,jt as L,lt as R,nt as Mt,ot as Nt,pn as Pt,q as Ft,rt as It,tt as Lt,un as z,ut as Rt,zn as zt,zt as Bt}from"./index-CqHFDZOR.js";import{r as Vt}from"./locales-CPjguROj.js";import{a as Ht,i as B,n as Ut,o as V,r as H,t as Wt}from"./table-CmKoxbAD.js";import{t as Gt}from"./FilterBar-9-13ggzv.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-D1MumhGe.js";import{t as U}from"./dispatchErrorInfo-D1xpxBzx.js";var $t=u(`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=u(`wifi-off`,[[`path`,{d:`M12 20h.01`,key:`zekei9`}],[`path`,{d:`M8.5 16.429a5 5 0 0 1 7 0`,key:`1bycff`}],[`path`,{d:`M5 12.859a10 10 0 0 1 5.17-2.69`,key:`1dl1wf`}],[`path`,{d:`M19 12.859a10 10 0 0 0-2.007-1.523`,key:`4k23kn`}],[`path`,{d:`M2 8.82a15 15 0 0 1 4.177-2.643`,key:`1grhjp`}],[`path`,{d:`M22 8.82a15 15 0 0 0-11.288-3.764`,key:`z3jwby`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}]]),W=t(e(),1);function 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 G(e){return e.kind??`openclaw`}function sn(e){return[...e].sort((e,t)=>e===`openclaw`?-1:t===`openclaw`?1:e.localeCompare(t))}function cn(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,G(e));let i=e=>(e.instanceName?r.get(e.instanceName):void 0)??`openclaw`,a=new Set;for(let e of n)a.add(G(e));for(let e of t)a.add(e.provider);for(let t of e)a.add(i(t));return sn(a).map(r=>({key:r,connections:e.filter(e=>i(e)===r),compatTargets:t.filter(e=>e.provider===r),instances:n.filter(e=>G(e)===r)}))}function K(e){return e===`openclaw`?`OpenClaw`:e===`hermes`?`Hermes`:e.charAt(0).toUpperCase()+e.slice(1)}var q=`__all__`,ln={q:``,state:q,instance:q,version:q},J={connected:0,error:1,idle:2};function un(e){return e.q.trim()!==``||e.state!==`__all__`||e.instance!==`__all__`||e.version!==`__all__`}function dn(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 Y(e,t){return e.localeCompare(t,void 0,{numeric:!0,sensitivity:`base`})}function X(e,t){return e===`version`?t.gatewayVersion===null:e===`lastOk`?t.lastOkAt===null:!1}function fn(e,t,n){switch(e){case`state`:return(J[t.state]??99)-(J[n.state]??99);case`instance`:return Y(t.instanceLabel??t.instanceName??``,n.instanceLabel??n.instanceName??``);case`host`:return Y(t.gatewayHost,n.gatewayHost);case`version`:{let e=t.gatewayVersion,r=n.gatewayVersion;return Zt(e,r)??Y(e,r)}case`lastOk`:return t.lastOkAt-n.lastOkAt;default:return Y(t.targetLabel,n.targetLabel)}}function pn(e,t){if(!t)return e;let n=t.dir===`asc`?1:-1;return[...e].sort((e,r)=>{let i=X(t.key,e),a=X(t.key,r);return i&&a?0:i?1:a?-1:n*fn(t.key,e,r)})}function mn(e){let t=new Set;for(let n of e)t.add(n.state);return[...t].sort((e,t)=>(J[e]??99)-(J[t]??99))}function hn(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)=>Y(e.label,t.label))}function gn(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)??Y(e,t))}var Z=n();function _n({connections:e,displayByInstance:t}){let[n,r]=(0,W.useState)(ln),[a,o]=(0,W.useState)(null),s=(0,W.useMemo)(()=>e.map((e,n)=>({_id:`${e.key}:${e.canonical}/${e.agentId}:${n}`,targetLabel:`${e.canonical}/${e.agentId}`,state:e.state,instanceName:e.instanceName??null,instanceLabel:e.instanceName?t.get(e.instanceName)??e.instanceName:null,gatewayHost:e.gatewayHost,gatewayVersion:e.gatewayVersion??null,okCount:e.okCount,errorCount:e.errorCount+(e.downstreamRejectCount??0),attempts:e.attempts,lastOkAt:e.lastOkAt??null,lastErrorCode:e.lastErrorCode??null,lastErrorAt:e.lastErrorAt??null,lastDownstreamRejectCode:e.lastDownstreamRejectCode??null,lastDownstreamRejectAt:e.lastDownstreamRejectAt??null})),[e,t]),c=(0,W.useMemo)(()=>mn(s),[s]),u=(0,W.useMemo)(()=>hn(s),[s]),p=(0,W.useMemo)(()=>gn(s),[s]),m=(0,W.useMemo)(()=>pn(dn(s,n),a),[s,n,a]);function h(e){o(t=>t?.key===e?t.dir===`asc`?{key:e,dir:`desc`}:null:{key:e,dir:`asc`})}return e.length===0?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:i()}):(0,Z.jsxs)(`div`,{className:`oc-conn`,children:[(0,Z.jsxs)(Gt,{q:n.q,onQChange:e=>r(t=>({...t,q:e})),searchPlaceholder:d(),onReset:()=>r(ln),canReset:un(n),children:[(0,Z.jsxs)(P,{value:n.state,onValueChange:e=>r(t=>({...t,state:e})),children:[(0,Z.jsx)(D,{size:`sm`,className:`w-36`,children:(0,Z.jsx)(I,{placeholder:ye()})}),(0,Z.jsxs)(F,{children:[(0,Z.jsx)(M,{value:q,children:f()}),c.map(e=>(0,Z.jsx)(M,{value:e,children:yn(e)},e))]})]}),(0,Z.jsxs)(P,{value:n.instance,onValueChange:e=>r(t=>({...t,instance:e})),children:[(0,Z.jsx)(D,{size:`sm`,className:`w-40`,children:(0,Z.jsx)(I,{placeholder:ct()})}),(0,Z.jsxs)(F,{children:[(0,Z.jsx)(M,{value:q,children:f()}),u.map(e=>(0,Z.jsx)(M,{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)(D,{size:`sm`,className:`w-36`,children:(0,Z.jsx)(I,{placeholder:l()})}),(0,Z.jsxs)(F,{children:[(0,Z.jsx)(M,{value:q,children:f()}),p.map(e=>(0,Z.jsx)(M,{value:e,children:e},e))]})]})]}),m.length===0?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:ve()}):(0,Z.jsxs)(Wt,{className:`oc-conn__table`,children:[(0,Z.jsx)(Ht,{children:(0,Z.jsxs)(V,{children:[(0,Z.jsx)(Q,{label:lt(),sortKey:`target`,sort:a,onSort:h}),(0,Z.jsx)(Q,{label:Ne(),sortKey:`state`,sort:a,onSort:h}),(0,Z.jsx)(Q,{label:dt(),sortKey:`instance`,sort:a,onSort:h}),(0,Z.jsx)(Q,{label:ot(),sortKey:`host`,sort:a,onSort:h}),(0,Z.jsx)(Q,{label:ke(),sortKey:`version`,sort:a,onSort:h}),(0,Z.jsx)(B,{children:ze()}),(0,Z.jsx)(Q,{label:Be(),sortKey:`lastOk`,sort:a,onSort:h})]})}),(0,Z.jsx)(Ut,{children:m.map(e=>(0,Z.jsx)(vn,{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)(B,{"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)(j,{size:13,"aria-hidden":!0}):(0,Z.jsx)(ht,{size:13,"aria-hidden":!0,className:`oc-conn__sort-idle`})]})})}function vn({r:e}){let t=an(e)?U(e.lastErrorCode):null,n=on(e)?U(e.lastDownstreamRejectCode):null;return(0,Z.jsxs)(W.Fragment,{children:[(0,Z.jsxs)(V,{className:`oc-conn__row oc-conn__row--${e.state}`,children:[(0,Z.jsx)(H,{children:(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:e.targetLabel})}),(0,Z.jsx)(H,{children:(0,Z.jsx)(bn,{state:e.state})}),(0,Z.jsx)(H,{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)(H,{children:(0,Z.jsx)(`span`,{className:`oc-bridge-target__host`,children:e.gatewayHost})}),(0,Z.jsx)(H,{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)(H,{children:(0,Z.jsx)(`span`,{className:`oc-conn__stats`,children:Ke({ok:e.okCount,errors:e.errorCount,attempts:e.attempts})})}),(0,Z.jsx)(H,{children:e.lastOkAt?(0,Z.jsx)(`span`,{className:`oc-traces__mono`,children:R(e.lastOkAt)}):(0,Z.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})})]}),t||n?(0,Z.jsx)(V,{className:`oc-conn__detail-row`,children:(0,Z.jsxs)(H,{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,n?(0,Z.jsxs)(`div`,{className:`oc-bridge-target__downstream`,children:[fe({label:n.label}),` `,(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:e.lastDownstreamRejectCode}),e.lastDownstreamRejectAt?` · ${R(e.lastDownstreamRejectAt)}`:``]}):null]})}):null]})}function yn(e){return e===`connected`?S():e===`error`?C():b()}function bn({state:e}){return e===`connected`?(0,Z.jsx)(k,{variant:`secondary`,children:S()}):e===`error`?(0,Z.jsx)(k,{variant:`destructive`,children:C()}):(0,Z.jsx)(k,{variant:`outline`,children:b()})}function xn(){return c(w.bridgeHealth.getBridgeHealth,{})}function Sn(){let e=xn(),t=c(w.compat.getBridgeCompat,{}),n=c(w.me.getMe,{host:Ft})?.role===`admin`,r=c(w.admin.listInstances,n?{}:`skip`),i=c(w.agents.usageForInstances,n?{}:`skip`),o=A(),s=()=>void o({to:`/settings/anomalies`,search:{status:`open`}}),l=cn(e?e.targets:[],t?t.targets:[],r??[]),{section:u}=Ot({from:`/settings/bridge`}),d=A({from:`/settings/bridge`}),f=t?.compat??null,p=t===void 0?`loading`:t===null?`nodata`:`ready`,m=f!==null&&Xt(f,`hermes`)&&!l.some(e=>e.key===`hermes`);return(0,Z.jsxs)(`div`,{className:`oc-bridge`,children:[(0,Z.jsx)(Cn,{health:e,compat:t,onSeeAnomalies:s}),(0,Z.jsx)(`p`,{className:`oc-admin__hint oc-bridge__caption`,children:Te()}),i&&i.length>0?(0,Z.jsxs)(`section`,{className:`oc-bridge__usage`,children:[(0,Z.jsx)(`h3`,{className:`oc-bridge__usage-title`,children:Ee()}),(0,Z.jsxs)(Wt,{children:[(0,Z.jsx)(Ht,{children:(0,Z.jsxs)(V,{children:[(0,Z.jsx)(B,{children:ue()}),(0,Z.jsx)(B,{children:se()}),(0,Z.jsx)(B,{children:Ge()}),(0,Z.jsx)(B,{children:a()}),(0,Z.jsx)(B,{children:qe()})]})}),(0,Z.jsx)(Ut,{children:i.flatMap(e=>{let t=Dt(e.usage,Date.now());return t?t.windows.map((t,n)=>(0,Z.jsxs)(V,{children:[(0,Z.jsx)(H,{className:`font-medium`,children:n===0?e.instanceName:``}),(0,Z.jsx)(H,{children:t.provider}),(0,Z.jsx)(H,{children:t.label}),(0,Z.jsx)(H,{children:(0,Z.jsxs)(k,{variant:t.percentLeft<=10?`destructive`:t.percentLeft<=25?`outline`:`secondary`,children:[t.percentLeft,`%`]})}),(0,Z.jsx)(H,{className:`text-muted-foreground`,children:t.resetText??`—`})]},`${e.instanceName}:${t.provider}:${t.label}`)):[]})})]})]}):null,l.length>0?(0,Z.jsxs)(Ct,{value:l.some(e=>e.key===u)?u:l[0]?.key??`openclaw`,onValueChange:e=>void d({search:{section:e},replace:!0}),children:[(0,Z.jsx)(St,{className:`w-full`,children:l.map(e=>(0,Z.jsxs)(bt,{value:e.key,className:`flex-1 gap-1.5`,children:[(0,Z.jsx)(Pt,{size:13,"aria-hidden":!0}),K(e.key)]},e.key))}),l.map(e=>(0,Z.jsx)(xt,{value:e.key,children:(0,Z.jsx)(wn,{providerKey:e.key,connections:e.connections,instances:e.instances,manifest:f,compatStatus:p,compatReachable:t?.reachable??!0,protocol:e.key===`openclaw`?t?.protocol??null:null})},e.key))]}):null,m?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:He()}):null]})}function Cn({health:e,compat:t,onSeeAnomalies:n}){let r=t!=null&&t.buildVersion!=null&&t.bridgeVersion!=null&&t.buildVersion!==t.bridgeVersion,i=t?.buildRevision&&t.buildRevision!==`unknown`?t.buildRevision.slice(0,7):null,a=t&&t!==null?(0,Z.jsxs)(`span`,{className:`oc-bridge-card__ver`,children:[(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:Yt(t.bridgeVersion)}),i?(0,Z.jsxs)(Z.Fragment,{children:[` `,(0,Z.jsxs)(`code`,{className:`oc-traces__mono`,title:ft(),children:[`(`,i,`)`]})]}):null,r?(0,Z.jsxs)(`strong`,{className:`oc-bridge-card__mismatch`,children:[` `,st({build:t.buildVersion??`?`})]}):null,` · `,Ae(),` `,(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:t.protocolVersion===null?x():String(t.protocolVersion)})]}):null;if(e===void 0)return(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:Se()});if(e===null)return(0,Z.jsx)(`div`,{className:`oc-bridge-card oc-bridge-card--idle`,children:o()});let s=tn(e.targets),c=!e.reachable,l=rn(e),u=e.unreachableInstances??[],d=l===`ok`?`ok`:l===`gateways_unreachable`?`warn`:`error`,f=jt(e.checkedAt),m=e.startedAt==null?null:jt(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)(N,{size:22}):c||l===`gateways_unreachable`?(0,Z.jsx)(en,{size:22}):(0,Z.jsx)(z,{size:22})}),(0,Z.jsxs)(`div`,{className:`oc-bridge-card__body`,children:[(0,Z.jsx)(`div`,{className:`oc-bridge-card__title`,children:l===`ok`?pt():l===`gateways_unreachable`?p({count:u.length}):c?he():ie({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}),` `,_({time:f})]}),m?(0,Z.jsx)(`span`,{children:le({time:m})}):null,a]}),l===`gateways_unreachable`?(0,Z.jsx)(`p`,{className:`oc-bridge-card__hint`,children:pe({names:u.join(`, `)})}):null,c?(0,Z.jsx)(`p`,{className:`oc-bridge-card__hint`,children:U(e.lastError===`not_configured`?`NOT_CONFIGURED`:`BRIDGE_UNREACHABLE`).hint}):null]}),(0,Z.jsx)(`button`,{type:`button`,className:`oc-bridgebar__drill`,onClick:n,children:oe()})]})}function wn({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,W.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)(Pt,{size:15,"aria-hidden":!0,className:`oc-bridge-provider__icon`}),(0,Z.jsx)(`span`,{className:`oc-bridge-provider__name`,children:K(e)}),d?(0,Z.jsx)(k,{variant:d===`beyond`||d===`defective`?`destructive`:`secondary`,children:qt(d)}):null]}),(0,Z.jsx)(`h4`,{className:`oc-bridge-provider__sub`,children:ut()}),(0,Z.jsx)(En,{providerName:K(e),support:s,compatStatus:i,compatReachable:a,manifest:r,instanceRows:l}),o?(0,Z.jsx)(Tn,{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)(j,{size:13,"aria-hidden":!0}):(0,Z.jsx)(O,{size:13,"aria-hidden":!0}),We({count:t.length})]}),f?(0,Z.jsx)(_n,{connections:t,displayByInstance:c}):null]})}function Tn({protocol:e}){let[t,n]=(0,W.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:[y(),i.length>0?(0,Z.jsx)(k,{variant:`destructive`,children:ne({count:i.length})}):a>0?(0,Z.jsx)(k,{variant:`destructive`,children:m()}):(0,Z.jsx)(k,{variant:`secondary`,children:et()})]}),(0,Z.jsxs)(`p`,{className:`oc-admin__hint`,children:[we({version:e.vendoredVersion}),r?` · `+be({handled:r.handled,ignored:r.ignored,gaps:r.gaps}):null]}),a>0?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:De({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)(j,{size:13,"aria-hidden":!0}):(0,Z.jsx)(O,{size:13,"aria-hidden":!0}),g({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 En({support:e,compatStatus:t,compatReachable:n,manifest:r,instanceRows:i,providerName:a}){return t===`loading`?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:Se()}):t===`nodata`?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:Pe()}):(0,Z.jsxs)(`div`,{className:`oc-compat`,children:[n?null:(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:Ve()}),r===null?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:Xe()}):(0,Z.jsxs)(`div`,{className:`oc-compat__support`,children:[(0,Z.jsx)(`span`,{className:`oc-compat__label`,children:v({provider:a})}),e&&e.range!==null?(0,Z.jsx)(`span`,{children:$e({min:e.range.min,max:e.range.maxValidated})}):(0,Z.jsx)(`span`,{children:x()}),e?(0,Z.jsx)(kn,{versions:e.validatedVersions}):null]}),i.length===0?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:Je()}):(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)(k,{variant:e.state===`supported`?`secondary`:e.state===`beyond`||e.state===`defective`?`destructive`:`outline`,children:qt(e.state)})]},e.instanceName))})]})}function Dn({instance:e,onClose:t}){return(0,Z.jsx)(Lt,{open:!0,onOpenChange:e=>!e&&t(),children:(0,Z.jsxs)(Mt,{className:`oc-bridge-config-dialog`,onOpenAutoFocus:e=>e.preventDefault(),children:[(0,Z.jsxs)(At,{children:[(0,Z.jsx)(Nt,{children:re({instance:e.displayName??e.name})}),(0,Z.jsx)(It,{children:h()})]}),(0,Z.jsx)(On,{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)(N,{"aria-hidden":!0}):(0,Z.jsx)(z,{"aria-hidden":!0}),(0,Z.jsxs)(`span`,{children:[e,` — `,t.ok?Le():t.detail]})]}):(0,Z.jsxs)(`p`,{className:`oc-bridge-config__check-row oc-bridge-config__check-row--skip`,children:[e,` — `,r()]}):null}function On({instance:e,onClose:t}){let n=_e(w.admin.upsertInstanceConfig),r=Me(w.bridge.validateMediaPaths),i=Et(),a=Vt(e.config?.contentLocale,void 0),[o,c]=(0,W.useState)(()=>gt(e.config??{},a)),[l,u]=(0,W.useState)(!1),[d,f]=(0,W.useState)(!1),[p,m]=(0,W.useState)(null),h=o.inboundMediaMode===`shared-fs`,g=o.mediaMode===`shared-fs`,_=h||g;async function v(){f(!0),m(null);try{m(await r({instanceName:e.name,inboundMediaMode:o.inboundMediaMode,mediaMode:o.mediaMode}))}catch(e){i.error(Ue(),e)}finally{f(!1)}}async function y(){u(!0);try{let r=e.config??{};await n({instanceId:e._id,config:vt(o,r,a)}),t()}catch(e){i.error(ge(),e)}finally{u(!1)}}return(0,Z.jsx)(`div`,{className:`oc-bridge-config`,children:(0,Z.jsxs)(`div`,{className:`oc-bridge-config__form`,children:[(0,Z.jsxs)(`div`,{className:`oc-bridge-config__grid`,children:[(0,Z.jsxs)(`label`,{className:`oc-field`,children:[(0,Z.jsx)(T,{label:xe(),help:ae()}),(0,Z.jsxs)(P,{value:o.mediaMode,onValueChange:e=>c({...o,mediaMode:e}),children:[(0,Z.jsx)(D,{size:`sm`,className:`w-full`,children:(0,Z.jsx)(I,{})}),(0,Z.jsx)(F,{children:yt.map(e=>(0,Z.jsx)(M,{value:e,children:e},e))})]})]}),(0,Z.jsxs)(`label`,{className:`oc-field`,children:[(0,Z.jsx)(T,{label:ee(),help:te()}),(0,Z.jsxs)(P,{value:o.inboundMediaMode,onValueChange:e=>c({...o,inboundMediaMode:e}),children:[(0,Z.jsx)(D,{size:`sm`,className:`w-full`,children:(0,Z.jsx)(I,{})}),(0,Z.jsx)(F,{children:_t.map(e=>(0,Z.jsx)(M,{value:e,children:e},e))})]})]}),(0,Z.jsxs)(`label`,{className:`oc-field`,children:[(0,Z.jsx)(T,{label:Ce(),help:de()}),(0,Z.jsx)(L,{type:`number`,min:1,max:4096,className:`w-full`,value:o.mediaMaxMb,onChange:e=>c({...o,mediaMaxMb:Math.trunc(Number(e.target.value)||0)})})]})]}),_&&(0,Z.jsxs)(`div`,{className:`oc-bridge-config__grid`,children:[h&&(0,Z.jsxs)(`label`,{className:`oc-field`,children:[(0,Z.jsx)(T,{label:at(),help:Ye()}),(0,Z.jsx)(L,{className:`w-full`,spellCheck:!1,value:o.inboundAgentMount,onChange:e=>c({...o,inboundAgentMount:e.target.value})})]}),g&&(0,Z.jsxs)(`label`,{className:`oc-field`,children:[(0,Z.jsx)(T,{label:Fe(),help:nt()}),(0,Z.jsx)(L,{className:`w-full`,spellCheck:!1,value:o.outboundAgentMount,onChange:e=>c({...o,outboundAgentMount:e.target.value})})]})]}),(0,Z.jsxs)(`label`,{className:`oc-field--row`,children:[(0,Z.jsx)(Rt,{checked:o.rehydration,onCheckedChange:e=>c({...o,rehydration:e===!0})}),(0,Z.jsx)(T,{label:s(),help:ce()})]}),_&&p!==null&&(0,Z.jsx)(`div`,{className:`oc-bridge-config__check`,children:p.reachable?!p.inbound&&!p.outbound?(0,Z.jsxs)(`p`,{className:`oc-bridge-config__check-row oc-bridge-config__check-row--err`,children:[(0,Z.jsx)(z,{"aria-hidden":!0}),Oe({reason:p.reason??`?`})]}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)($,{label:Ze(),result:p.inbound}),(0,Z.jsx)($,{label:rt(),result:p.outbound}),(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:tt()})]}):(0,Z.jsxs)(`p`,{className:`oc-bridge-config__check-row oc-bridge-config__check-row--err`,children:[(0,Z.jsx)(z,{"aria-hidden":!0}),me()]})}),(0,Z.jsxs)(`div`,{className:`oc-bridge-config__actions`,children:[_&&(0,Z.jsxs)(E,{variant:`outline`,size:`sm`,onClick:()=>void v(),disabled:d,children:[d?(0,Z.jsx)(Tt,{className:`size-4 animate-spin`,"aria-hidden":!0}):null,d?je():Qe()]}),(0,Z.jsx)(E,{size:`sm`,onClick:()=>void y(),disabled:l,children:mt()})]})]})})}function kn({versions:e}){if(e.length===0)return null;let t=[...e].reverse();return(0,Z.jsxs)(kt,{children:[(0,Z.jsx)(wt,{asChild:!0,children:(0,Z.jsxs)(`button`,{type:`button`,className:`oc-compat__versions-btn`,children:[e.length===1?Re():Ie({count:e.length}),(0,Z.jsx)(j,{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:it()}),(0,Z.jsx)(`div`,{className:`oc-compat__versions-list`,children:t.map(e=>(0,Z.jsx)(k,{variant:`secondary`,children:e},e))})]})]})}export{Sn as BridgeTab,Dn as InstanceConfigDialog};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Ad as r,Bf as i,CB as a,Cd as o,Dd as s,Ed as c,Fi as l,Gf as u,Gs as d,Js as f,Ks as p,Od as m,Qs as h,SB as g,Sd as _,Td as v,Us as y,Vf as b,Ws as x,Wx as S,Xs as C,Ys as w,Zs as T,bB as E,kd as D,mB as O,of as k,qf as A,qs as j,t as M,wd as N}from"./api-B9t7A61E.js";import{t as P}from"./button-0XSqjZXP.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-CqHFDZOR.js";import{a as K}from"./compatView-D1MumhGe.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=g(M.admin.upsertInstanceConfig),n=a(M.agents.listAgentsForInstance,{instanceName:e.name}),r=typeof e.config?.converterAgentId==`string`?e.config.converterAgentId:``,[i,s]=(0,q.useState)(r),[c,l]=(0,q.useState)(`idle`);(0,q.useEffect)(()=>{s(r),l(`idle`)},[e._id,r]);let u=`__none__`,d=i!==r;async function p(){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:w()}),(0,X.jsx)(`p`,{className:`oc-admin__hint`,children:f()}),(0,X.jsxs)(`div`,{className:`oc-cdefaults__inline`,children:[(0,X.jsxs)(B,{value:i===``?u:i,onValueChange:e=>s(e===u?``:e),children:[(0,X.jsx)(F,{className:`oc-cdefaults__select`,"aria-label":w(),children:(0,X.jsx)(H,{placeholder:j()})}),(0,X.jsxs)(V,{children:[(0,X.jsx)(z,{value:u,children:j()}),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 p(),children:c===`saving`?A():N()})]}),c===`done`?(0,X.jsx)(`p`,{className:`oc-admin__hint`,role:`status`,children:o()}):null,c===`error`?(0,X.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:_()}):null]})}function Q({instance:e}){let t=g(M.admin.upsertInstanceConfig),n=e.config?.curationEnabled===!0,r=typeof e.config?.curationBudgetChars==`number`?e.config.curationBudgetChars:null,[i,a]=(0,q.useState)(n),[s,c]=(0,q.useState)(r===null?``:String(r)),[l,u]=(0,q.useState)(`idle`);(0,q.useEffect)(()=>{a(n),c(r===null?``:String(r)),u(`idle`)},[e._id,n,r]);let f=s.trim(),m=f===``?null:/^\d+$/.test(f)?Number.parseInt(f,10):NaN,h=!i||m===null||Number.isInteger(m)&&m>=4e3&&m<=6e4,v=i!==n||(m??null)!==r;async function y(){u(`saving`);try{let n={...e.config??{}};n.curationEnabled=i,!i||m===null||Number.isNaN(m)?delete n.curationBudgetChars:n.curationBudgetChars=m,await t({instanceId:e._id,config:n}),u(`done`)}catch{u(`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":C()}),(0,X.jsx)(`span`,{className:`oc-cdefaults__label`,children:C()})]}),(0,X.jsxs)(`div`,{className:`oc-cdefaults__inline`,children:[(0,X.jsx)(U,{type:`number`,min:4e3,max:6e4,step:1e3,placeholder:`20000`,value:s,onChange:e=>c(e.target.value),className:`oc-cdefaults__number`,"aria-invalid":!h,"aria-label":p(),disabled:!i}),(0,X.jsx)(P,{size:`sm`,disabled:!v||!h||l===`saving`,onClick:()=>void y(),children:l===`saving`?A():N()})]}),h?null:(0,X.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:d()}),l===`done`?(0,X.jsx)(`p`,{className:`oc-admin__hint`,role:`status`,children:o()}):null,l===`error`?(0,X.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:_()}):null,(0,X.jsx)(`p`,{className:`oc-cdefaults__help`,children:x()})]})}function $({instance:e}){let t=g(M.admin.upsertInstanceConfig),n=typeof e.config?.summarizeThresholdChars==`number`?e.config.summarizeThresholdChars:null,[r,i]=(0,q.useState)(n===null?``:String(n)),[a,s]=(0,q.useState)(`idle`);(0,q.useEffect)(()=>{i(n===null?``:String(n)),s(`idle`)},[e._id,n]);let c=r.trim(),l=c===``?null:/^\d+$/.test(c)?Number.parseInt(c,10):NaN,u=l===null||Number.isInteger(l)&&l>=1e3&&l<=2e5,d=(l??null)!==n;async function f(){s(`saving`);try{let n={...e.config??{}};l===null?delete n.summarizeThresholdChars:n.summarizeThresholdChars=l,await t({instanceId:e._id,config:n}),s(`done`)}catch{s(`error`)}}return(0,X.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,X.jsx)(`span`,{className:`oc-cdefaults__label`,children:h()}),(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":!u}),(0,X.jsx)(P,{size:`sm`,disabled:!d||!u||a===`saving`,onClick:()=>void f(),children:a===`saving`?A():N()})]}),u?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:o()}):null,a===`error`?(0,X.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:_()}):null,(0,X.jsx)(`p`,{className:`oc-cdefaults__help`,children:T()})]})}function ee(){let e=E(M.agentFiles.getChatDefaults),[t,n]=(0,q.useState)({status:`loading`}),o=a(M.admin.listInstances,{}),[d,f]=(0,q.useState)(null);(0,q.useEffect)(()=>{!o||o.length===0||(!d||!o.some(e=>e.name===d))&&f(o[0].name)},[o,d]);let p=(o?.length??0)>1,h=o!==void 0&&o.length===0,g=a(M.compat.forInstance,d?{instanceName:d}:`skip`),_=d?I(g,`configDefaults`):`loading`,y=_===`loading`?null:_.blocked,x=(0,q.useMemo)(()=>p&&d?{instanceName:d}:{},[p,d]),C=(0,q.useRef)(0),w=(0,q.useCallback)(async()=>{let t=++C.current;n({status:`loading`});try{let r=Y(await e(x));if(C.current!==t)return;n({status:`done`,current:r})}catch{if(C.current!==t)return;n({status:`error`})}},[e,x]);(0,q.useEffect)(()=>{y===!1&&(p&&!d||w())},[w,y,p,d]);let T=t.status===`done`?t.current:null,A=(0,q.useMemo)(()=>J.map(e=>({id:e,label:R(e)})),[]),j=(0,q.useMemo)(()=>[{id:`fast`,label:b()},{id:`standard`,label:i()}],[]);return(0,X.jsxs)(`div`,{className:`oc-cdefaults`,children:[(0,X.jsx)(`p`,{className:`oc-admin__hint`,children:r()}),p&&d?(0,X.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,X.jsx)(`span`,{className:`oc-cdefaults__label`,children:k()}),(0,X.jsxs)(B,{value:d,onValueChange:e=>f(e),children:[(0,X.jsx)(F,{size:`sm`,"aria-label":k(),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:S()}):_===`loading`?(0,X.jsx)(`p`,{className:`oc-admin__hint`,children:O()}):_.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:O()}):t.status===`error`?(0,X.jsxs)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:[v(),` `,(0,X.jsx)(P,{variant:`outline`,size:`sm`,onClick:()=>void w(),children:u()})]}):(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,X.jsx)(`span`,{className:`oc-cdefaults__label`,children:D()}),(0,X.jsx)(L,{field:`thinkingLevel`,options:A,value:T?.thinkingDefault??null,onChange:()=>{},disabled:!0,ariaLabel:D()}),(0,X.jsx)(`p`,{className:`oc-cdefaults__help`,children:m()})]}),(0,X.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,X.jsx)(`span`,{className:`oc-cdefaults__label`,children:s()}),(0,X.jsx)(L,{field:`fastMode`,options:j,value:T===null||T.fastModeDefault===null?null:T.fastModeDefault?`fast`:`standard`,onChange:()=>{},disabled:!0,ariaLabel:s()}),(0,X.jsx)(`p`,{className:`oc-cdefaults__help`,children:c()})]}),(0,X.jsx)(`p`,{className:`oc-cdefaults__note`,children:l()})]}),(()=>{let e=o?.find(e=>e.name===(d??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,AO as i,BO as a,CB as o,CO as s,DO as c,EO as l,FO as u,GO as d,HO as f,IO as p,JO as m,KO as h,LO as g,MO as _,NO as v,OO as y,PO as ee,QO as b,RO as te,SB as x,SO as ne,TO as re,UO as ie,VO as ae,WO as S,XO as C,YO as w,ZO as T,_O as E,ak as D,bO as O,ck as k,dO as A,dk as j,ek as M,fO as N,fk as P,gO as F,hO as I,ik as L,is as R,jO as z,kO as B,lk as V,mO as H,nk as U,ns as W,ok as G,pO as oe,pk as K,qO as q,rk as se,sk as ce,t as J,tk as le,uk as ue,vO as de,wO as fe,xO as pe,yO as me,zO as he}from"./api-B9t7A61E.js";import{t as ge}from"./button-0XSqjZXP.js";import{U as _e,ct as Y}from"./index-CqHFDZOR.js";import{t as ve}from"./DataTableShell-DxLu0zon.js";var X=t(e(),1),Z=n(),ye={altered_words:()=>K(),incorrect:()=>P(),incoherence:()=>j(),formatting:()=>ue(),latency:()=>V(),api_error:()=>k(),other:()=>ce()},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:D()}):e===!1?(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-warn`,children:L()}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill`,children:`—`}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill`,children:G()})}function be({data:e,reference:t,closeReason:n}){let i=e.snapshot,o=x(J.feedback.respondToFeedback),[s,c]=(0,X.useState)(e.thread),[l,u]=(0,X.useState)(``),[p,_]=(0,X.useState)(!1);async function v(){let t=l.trim();if(!(!t||p)){_(!0);try{await o({feedbackId:e._id,text:t}),c(e=>[...e,{authorRole:`admin`,text:t,at:Date.now()}]),u(``)}finally{_(!1)}}}let y=[];try{y=i.contextJson?JSON.parse(i.contextJson):[]}catch{y=[]}return(0,Z.jsxs)(`div`,{className:`oc-fbadmin__detail`,children:[(0,Z.jsxs)(`div`,{className:`oc-fbadmin__row`,children:[(0,Z.jsx)($,{matches:i.displayedMatchesStored,sourceWasOpen:i.clientInfo?.sourceWasOpen??!1}),(0,Z.jsxs)(`span`,{className:`oc-fbadmin__meta`,children:[Q(e.category),` · `,i.messageRole,i.isRegeneration?` · ${se()}`:``,i.openclawModel?` · ${i.openclawModel}`:``,i.openclawRuntime?` (${i.openclawRuntime})`:``]}),t?(0,Z.jsx)(`code`,{className:`oc-fbadmin__ref`,style:{userSelect:`all`,marginLeft:`auto`},title:z(),children:t}):null]}),e.comment?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:U()}),(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:E()}),(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:le()}),s.length>0?(0,Z.jsx)(`div`,{className:`oc-fbadmin__thread`,children:s.map((e,t)=>(0,Z.jsxs)(`div`,{className:`oc-notif__msg oc-notif__msg--${e.authorRole}`,children:[(0,Z.jsx)(`span`,{className:`oc-notif__msg-who`,children:e.authorRole===`admin`?M():e.authorRole===`agent`?e.authorLabel??R():r()}),(0,Z.jsx)(`span`,{className:`oc-notif__msg-text`,children:e.text})]},t))}):(0,Z.jsx)(`p`,{className:`oc-fbadmin__meta`,children:b()}),(0,Z.jsx)(`textarea`,{className:`oc-feedback__textarea`,placeholder:T(),value:l,maxLength:2e3,rows:3,onChange:e=>u(e.target.value.slice(0,2e3))}),(0,Z.jsx)(`div`,{className:`oc-fbadmin__row`,style:{justifyContent:`flex-end`},children:(0,Z.jsx)(ge,{size:`sm`,onClick:()=>void v(),disabled:!l.trim()||p,children:p?C():w()})})]}),(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:i.messageText||q()})]}),i.clientInfo?.sourceWasOpen&&i.displayedText!==void 0?(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:i.displayedText||q()})]}):null,i.promptText?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:d()}),(0,Z.jsx)(`pre`,{className:`oc-msg__source-pre`,children:i.promptText})]}):null,y.length>0?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:S({count:i.contextCount??y.length,truncated:i.contextTruncated?ie():``})}),(0,Z.jsx)(`div`,{className:`oc-fbadmin__ctx`,children:y.map((e,t)=>(0,Z.jsxs)(`div`,{className:`oc-fbadmin__ctx-turn`,children:[(0,Z.jsx)(`span`,{className:`oc-fbadmin__ctx-role`,children:e.role}),(0,Z.jsx)(`span`,{className:`oc-fbadmin__ctx-text`,children:e.text})]},t))})]}):null,i.outboxAvailable?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:f()}),(0,Z.jsxs)(`pre`,{className:`oc-msg__source-pre`,children:[i.outboxText??``,i.outboxStatus?`\n[status: ${i.outboxStatus}]`:``]})]}):null,i.clientInfo?.extensionsDetected&&i.clientInfo.extensionsDetected.length>0?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:ae()}),(0,Z.jsx)(`div`,{className:`oc-fbadmin__row`,children:i.clientInfo.extensionsDetected.map(e=>(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-warn`,children:e},e))})]}):null,(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:a()}),(0,Z.jsxs)(`p`,{className:`oc-fbadmin__env`,children:[[i.clientInfo?.language,i.clientInfo?.timezone,i.clientInfo?.theme?he({theme:i.clientInfo.theme}):null,i.runId?`run ${i.runId.slice(0,12)}…`:null].filter(Boolean).join(` · `)||`—`,i.clientInfo?.plugins&&i.clientInfo.plugins.length>0?(0,Z.jsxs)(`span`,{className:`oc-fbadmin__plugins`,children:[te(),` `,i.clientInfo.plugins.join(`, `),(0,Z.jsxs)(`span`,{className:`oc-fbadmin__note`,children:[` `,g()]})]}):null,i.clientInfo?.userAgent?(0,Z.jsx)(`span`,{className:`oc-fbadmin__ua`,children:i.clientInfo.userAgent}):null]})]})]})}function xe(){let e=o(J.feedback.listForAdmin,{}),t=x(J.feedback.readSnapshot),n=x(J.feedback.deleteFeedback),r=_e(),[a,d]=(0,X.useState)(null),[f,m]=(0,X.useState)({});async function h(e){if(a===e._id){d(null);return}if(!f[e._id]){let n=await t({feedbackId:e._id});m(t=>({...t,[e._id]:n}))}d(e._id)}async function g(e){await r({title:oe(),description:N(),confirmLabel:A(),destructive:!0})&&(await n({feedbackId:e._id}),a===e._id&&d(null))}return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`p`,{className:`oc-admin__hint`,children:[p(),` `,(0,Z.jsx)(`strong`,{children:u()}),` `,ee()]}),(0,Z.jsx)(ve,{title:v(),rows:e,emptyHint:_(),isExpanded:e=>a===e._id&&!!f[e._id],renderExpanded:e=>f[e._id]?(0,Z.jsx)(be,{data:f[e._id],reference:e.reference,closeReason:e.userCloseReason}):null,columns:[{header:i(),cell:e=>Y(e.at),sort:e=>e.at},{header:B(),cell:e=>Q(e.category),sort:e=>Q(e.category)},{header:y(),cell:e=>e.messageRole===`user`?c():l(),sort:e=>e.messageRole},{header:re(),cell:e=>(e.reporterEmail||e.reporterName||`—`)+(e.impersonated&&e.realOperatorEmail?` ${fe({operator:e.realOperatorEmail})}`:``),sort:e=>e.reporterEmail||e.reporterName||null},{header:s(),cell:e=>(0,Z.jsx)($,{matches:e.displayedMatchesStored,sourceWasOpen:e.sourceWasOpen}),sort:e=>e.displayedMatchesStored===!1?0:e.displayedMatchesStored===!0?1:2},{header:ne(),cell:e=>e.hasComment?`✎`:`—`,sort:e=>+!!e.hasComment},{header:pe(),cell:e=>e.userClosedAt==null?e.resolvedAt==null?e.answered?(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-ok`,children:O()}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill`,children:me()}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-ok`,title:e.resolvedBy??void 0,children:W()}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-closed`,children:de()}),sort:e=>e.userClosedAt==null?e.resolvedAt==null?+!!e.answered:2:3}],rowActions:e=>[{label:a===e._id?F():I(),onSelect:()=>void h(e)},{label:H(),onSelect:()=>void g(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{Az as r,CB as ee,Cz as i,Dz as a,Ez as te,Fz as ne,Mz as o,Nz as re,Oz as s,Pz as c,SB as l,Sz as u,Tz as d,_z as f,az as p,bz as m,cs as h,cz as g,dz as ie,ez as ae,fz as oe,gB as se,gz as ce,hz as le,iz as ue,jz as _,kz as de,lz as fe,mB as pe,mz as me,nz as he,oz as ge,pz as _e,rz as ve,ss as ye,sz as be,t as v,tz as y,uz as b,vz as x,wz as S,xz as C,yM as w,yz as T}from"./api-B9t7A61E.js";import{t as E}from"./button-0XSqjZXP.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 we,X as I,Z as L,bt as Te,dn as Ee,et as R,hn as De,ut as Oe,vt as ke,wt as Ae,xt as je,yt as Me}from"./index-CqHFDZOR.js";import{a as Ne,i as z,n as Pe,o as B,r as V,t as Fe}from"./table-CmKoxbAD.js";var H=t(e(),1),U=n(),W=`all`;function G(e){switch(e){case`image`:return S();case`audio`:return i();case`video`:return u();case`pdf`:return C();case`document`:return m();case`archive`:return T();default:return x()}}function K(){let[e,t]=(0,H.useState)(W),[n,i]=(0,H.useState)(W),[u,m]=(0,H.useState)(W),[x,S]=(0,H.useState)(W),[C,T]=(0,H.useState)(!1),[K,q]=(0,H.useState)(null),J=l(v.files.softDelete),Y=k();function Ie(){t(W),i(W),m(W),S(W)}async function Le(){let e=K;if(q(null),e)try{await J({fileId:e.id}),Y.success(be())}catch(e){Y.error(ge(),e)}}let X=ee(v.files.listMine,{direction:e===W?void 0:e,chatId:n===W?void 0:n,instanceName:u===W?void 0:u,category:x===W?void 0:x,includeAutoGenerated:C||void 0}),Re=(0,H.useMemo)(()=>new Intl.DateTimeFormat(se(),{dateStyle:`medium`,timeStyle:`short`}),[]);if(X===void 0)return(0,U.jsx)(`p`,{className:`oc-admin__hint`,children:pe()});let{files:Z,facets:Q,truncated:ze,cap:Be}=X,$=e!==W||n!==W||u!==W||x!==W;return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`p`,{className:`oc-admin__hint`,children:ne()}),(0,U.jsxs)(`div`,{className:`oc-files__filters`,style:{display:`flex`,flexWrap:`wrap`,gap:8,margin:`12px 0`},children:[(0,U.jsxs)(I,{value:e,onValueChange:t,children:[(0,U.jsx)(D,{size:`sm`,"aria-label":c(),children:(0,U.jsx)(R,{})}),(0,U.jsxs)(L,{children:[(0,U.jsx)(F,{value:W,children:re()}),(0,U.jsx)(F,{value:`inbound`,children:o()}),(0,U.jsx)(F,{value:`outbound`,children:_()})]})]}),(0,U.jsxs)(I,{value:n,onValueChange:i,children:[(0,U.jsx)(D,{size:`sm`,"aria-label":r(),children:(0,U.jsx)(R,{})}),(0,U.jsxs)(L,{children:[(0,U.jsx)(F,{value:W,children:de()}),Q.chats.map(e=>(0,U.jsx)(F,{value:e.id,children:e.title},e.id))]})]}),Q.multiProvider?(0,U.jsxs)(I,{value:u,onValueChange:m,children:[(0,U.jsx)(D,{size:`sm`,"aria-label":s(),children:(0,U.jsx)(R,{})}),(0,U.jsxs)(L,{children:[(0,U.jsx)(F,{value:W,children:a()}),Q.instances.map(e=>(0,U.jsx)(F,{value:e,children:e},e))]})]}):null,(0,U.jsxs)(I,{value:x,onValueChange:S,children:[(0,U.jsx)(D,{size:`sm`,"aria-label":te(),children:(0,U.jsx)(R,{})}),(0,U.jsxs)(L,{children:[(0,U.jsx)(F,{value:W,children:d()}),Q.categories.map(e=>(0,U.jsx)(F,{value:e,children:G(e)},e))]})]}),(0,U.jsxs)(`label`,{className:`oc-files__autogen`,children:[(0,U.jsx)(Oe,{checked:C,onCheckedChange:e=>T(e===!0),"aria-label":h()}),(0,U.jsx)(`span`,{children:h()})]}),$?(0,U.jsxs)(E,{variant:`ghost`,size:`sm`,onClick:Ie,style:{display:`inline-flex`,alignItems:`center`,gap:4,marginLeft:`auto`},children:[(0,U.jsx)(De,{size:14,"aria-hidden":!0}),b()]}):null]}),Z.length===0?(0,U.jsx)(`p`,{className:`oc-admin__hint`,children:$?y():he()}):(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(Fe,{children:[(0,U.jsx)(Ne,{children:(0,U.jsxs)(B,{children:[(0,U.jsx)(z,{children:f()}),(0,U.jsx)(z,{children:ce()}),(0,U.jsx)(z,{children:le()}),(0,U.jsx)(z,{children:me()}),(0,U.jsx)(z,{children:_e()}),(0,U.jsx)(z,{className:`text-right`,children:oe()})]})}),(0,U.jsx)(Pe,{children:Z.map(e=>(0,U.jsxs)(B,{children:[(0,U.jsxs)(V,{className:`font-medium`,style:{maxWidth:280,overflow:`hidden`,textOverflow:`ellipsis`},title:e.filename,children:[e.filename,e.origin===`pasted`?(0,U.jsx)(A,{variant:`outline`,style:{marginLeft:6},children:ye()}):null]}),(0,U.jsx)(V,{title:e.mimeType,children:G(e.category)}),(0,U.jsx)(V,{children:(0,U.jsx)(A,{variant:`secondary`,children:e.direction===`inbound`?o():_()})}),(0,U.jsx)(V,{style:{maxWidth:220,overflow:`hidden`,textOverflow:`ellipsis`},title:e.chatTitle,children:e.chatTitle}),(0,U.jsx)(V,{className:`whitespace-nowrap text-muted-foreground`,children:Re.format(e.createdAt)}),(0,U.jsx)(V,{className:`text-right`,children:(0,U.jsxs)(N,{children:[(0,U.jsx)(M,{asChild:!0,children:(0,U.jsx)(E,{variant:`ghost`,size:`icon`,"aria-label":fe(),children:(0,U.jsx)(Se,{size:16})})}),(0,U.jsxs)(xe,{align:`end`,children:[e.url?(0,U.jsx)(P,{asChild:!0,children:(0,U.jsxs)(`a`,{href:e.url,download:e.filename,target:`_blank`,rel:`noopener noreferrer`,children:[(0,U.jsx)(j,{size:14}),ie()]})}):(0,U.jsxs)(P,{disabled:!0,children:[(0,U.jsx)(j,{size:14}),ve()]}),(0,U.jsxs)(P,{variant:`destructive`,onSelect:()=>q({id:e._id,filename:e.filename}),children:[(0,U.jsx)(Ee,{size:14}),g()]})]})]})})]},e._id))})]}),ze?(0,U.jsx)(`p`,{className:`oc-admin__hint`,style:{marginTop:8},children:ae({cap:Be})}):null]}),(0,U.jsx)(ke,{open:K!==null,onOpenChange:e=>!e&&q(null),children:(0,U.jsxs)(je,{children:[(0,U.jsxs)(Ae,{children:[(0,U.jsx)(we,{children:p()}),(0,U.jsx)(Ce,{children:ue()})]}),(0,U.jsxs)(O,{children:[(0,U.jsx)(Te,{children:w()}),(0,U.jsx)(Me,{onClick:()=>void Le(),children:g()})]})]})})]})}export{K as FilesTab};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$p as r,Ap as i,Bp as a,CB as o,Cp as s,D as c,Dp as l,Ep as u,Fp as d,Gp as f,Hp as p,Ip as m,Jp as h,Kp as g,Lp as _,Mp as v,Np as y,Op as b,Pp as x,Qp as S,Rp as C,SB as w,Sp as T,Tp as E,Up as ee,Vp as te,Wp as ne,Xp as D,Yp as re,Zp as O,_p as k,am as ie,ap as A,bp as j,cm as ae,cp as oe,dm as M,dp as se,em as N,fm as ce,fp as le,gp as ue,hp as P,im as de,jp as F,kp as fe,lm as pe,lp as I,mm as me,mp as he,nm as ge,om as _e,op as ve,pm as ye,pp as be,qp as xe,rm as Se,sm as Ce,sp as we,t as L,tm as Te,um as Ee,up as De,vp as Oe,wp as ke,xp as Ae,yp as je,zp as R}from"./api-B9t7A61E.js";import{t as Me}from"./x-YGyI1mI9.js";import{i as z,n as B,r as Ne,t as Pe}from"./tabs-BC9QRLg2.js";import{t as V}from"./button-0XSqjZXP.js";import{$ as Fe,Bn as Ie,Dt as H,Et as U,Q as Le,U as Re,Vn as ze,X as Be,Z as Ve,_ as He,at as Ue,cn as We,et as Ge,fn as W,jt as G,nt as Ke,ot as qe,pn as K,q as Je,rt as Ye,tt as Xe,ut as q}from"./index-CqHFDZOR.js";import{t as Ze}from"./FilterBar-9-13ggzv.js";import{t as Qe}from"./DataTableShell-DxLu0zon.js";import{t as J}from"./DetailChips-DtjFz3Cl.js";var Y=c(`palette`,[[`path`,{d:`M12 22a1 1 0 0 1 0-20 10 9 0 0 1 10 9 5 5 0 0 1-5 5h-2.25a1.75 1.75 0 0 0-1.4 2.8l.3.4a1.75 1.75 0 0 1-1.4 2.8z`,key:`e79jfc`}],[`circle`,{cx:`13.5`,cy:`6.5`,r:`.5`,fill:`currentColor`,key:`1okk4w`}],[`circle`,{cx:`17.5`,cy:`10.5`,r:`.5`,fill:`currentColor`,key:`f64h9f`}],[`circle`,{cx:`6.5`,cy:`12.5`,r:`.5`,fill:`currentColor`,key:`qy21gx`}],[`circle`,{cx:`8.5`,cy:`7.5`,r:`.5`,fill:`currentColor`,key:`fotxhn`}]]),X=c(`shield-check`,[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`,key:`oel41y`}],[`path`,{d:`m9 12 2 2 4-4`,key:`dzmm74`}]]),Z=t(e(),1);function $e(e,t,n){let r=t.trim().toLowerCase();return[...r?e.filter(e=>[e.email,e.name,e.canonical].some(e=>e!=null&&e.toLowerCase().includes(r))):e.slice()].sort((e,t)=>!n.has(e.userId)-+!n.has(t.userId))}function et(e,t){let n=e.filter(e=>e.source===`discovered`),r=t.trim().toLowerCase();return r?n.filter(e=>(e.displayName??e.agentId).toLowerCase().includes(r)||e.agentId.toLowerCase().includes(r)):n}function tt(e){let t=e.name?.trim()??``,n=e.email?.trim()??``,r=e.canonical?.trim()||`u-${e.userId.slice(0,8)}`;return t?{primary:t,secondary:n||`@${r}`}:n?{primary:n,secondary:null}:{primary:`@${r}`,secondary:null}}function nt(e){switch(e){case`admin`:return d();case`user`:return x();case`pending`:return y();default:return e}}function rt(e,t){if(e.length===0)return`none`;let n=0;for(let r of e)t(r)&&n++;return n===0?`none`:n===e.length?`all`:`some`}function it(e,t,n){let r=Math.max(1,Math.ceil(e.length/n)),i=Math.min(Math.max(1,Math.floor(t)),r),a=(i-1)*n;return{pageItems:e.slice(a,a+n),page:i,pageCount:r}}var Q=n(),$={name:``,description:``};function at(){let e=o(L.groups.listGroups,{}),t=o(L.me.getMe,{host:Je})?.role===`admin`,n=w(L.groups.createGroup),i=w(L.groups.updateGroup),a=w(L.groups.deleteGroup),s=Re(),c=H(),[l,u]=(0,Z.useState)(!1),[d,f]=(0,Z.useState)(null),[p,m]=(0,Z.useState)($),[g,_]=(0,Z.useState)(null),[v,y]=(0,Z.useState)(``),b=(0,Z.useMemo)(()=>{if(!e)return e;let t=v.trim().toLowerCase();return t?e.filter(e=>e.name.toLowerCase().includes(t)||(e.description??``).toLowerCase().includes(t)||e.members.some(e=>e.label.toLowerCase().includes(t))||e.agents.some(e=>e.toLowerCase().includes(t))||e.charts.some(e=>e.name.toLowerCase().includes(t))):e},[e,v]);function x(){f(null),m($),u(!0)}function C(e){f(e),m({name:e.name,description:e.description??``}),u(!0)}async function T(){try{d?await i({groupId:d._id,name:p.name,description:p.description}):await n({name:p.name,description:p.description||void 0}),m($),f(null),u(!1)}catch(e){c.error(oe(),e)}}async function E(e){if(await s({title:re({name:e.name}),description:h(),confirmWord:e.name,confirmLabel:xe(),cancelLabel:Te(),destructive:!0}))try{await a({groupId:e._id})}catch(e){c.error(we(),e)}}return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:ye()}),(0,Q.jsx)(Ze,{q:v,onQChange:y,onReset:()=>y(``),canReset:v!==``,searchPlaceholder:_e()}),(0,Q.jsx)(Qe,{title:me(),rows:b,addLabel:ce(),onAdd:t?x:void 0,emptyHint:M(),columns:[{header:Ee(),cell:e=>e.name,sort:e=>e.name},{header:pe(),cell:e=>(0,Q.jsx)(J,{icon:(0,Q.jsx)(We,{size:12,"aria-hidden":!0}),total:e.memberCount,items:e.members.map(e=>({label:e.label,marker:e.manager?(0,Q.jsx)(X,{size:11,"aria-hidden":!0}):null,highlight:e.manager}))}),sort:e=>e.memberCount},{header:ae(),cell:e=>(0,Q.jsx)(J,{icon:(0,Q.jsx)(K,{size:12,"aria-hidden":!0}),total:e.agentCount,items:e.agents.map(e=>({label:e}))}),sort:e=>e.agentCount},{header:Ce(),cell:e=>(0,Q.jsx)(J,{icon:(0,Q.jsx)(Y,{size:12,"aria-hidden":!0}),total:e.chartCount,items:e.charts.map(e=>({label:e.name,marker:e.isDefault?(0,Q.jsx)(W,{size:11,fill:`currentColor`,"aria-hidden":!0}):null,highlight:e.isDefault}))}),sort:e=>e.chartCount}],rowActions:e=>[{label:ie(),onSelect:()=>_({groupId:e._id,name:e.name})},...t?[{label:de(),onSelect:()=>C(e)},{label:Se(),variant:`destructive`,onSelect:()=>void E(e)}]:[]]}),(0,Q.jsx)(He,{open:l,onOpenChange:u,title:d?r():N(),description:S(),canSubmit:!!p.name.trim(),onSubmit:T,submitLabel:ge(),children:(0,Q.jsxs)(`div`,{className:`oc-form`,children:[(0,Q.jsxs)(`label`,{className:`oc-field`,children:[(0,Q.jsx)(`span`,{className:`oc-field__label`,children:O()}),(0,Q.jsx)(G,{value:p.name,onChange:e=>m({...p,name:e.target.value})})]}),(0,Q.jsxs)(`label`,{className:`oc-field`,children:[(0,Q.jsx)(`span`,{className:`oc-field__label`,children:D()}),(0,Q.jsx)(G,{value:p.description,onChange:e=>m({...p,description:e.target.value})})]})]})}),(0,Q.jsx)(ct,{groupId:g?.groupId??null,groupName:g?.name??``,open:g!==null,onOpenChange:e=>{e||_(null)}})]})}var ot=8;function st({page:e,pageCount:t,onPage:n}){return t<=1?null:(0,Q.jsxs)(`div`,{className:`oc-access__pager`,children:[(0,Q.jsxs)(V,{type:`button`,variant:`ghost`,size:`sm`,disabled:e<=1,onClick:()=>n(e-1),children:[(0,Q.jsx)(ze,{size:14,"aria-hidden":!0}),C()]}),(0,Q.jsxs)(`span`,{className:`oc-access__pageinfo`,"aria-label":m({page:e,pages:t}),children:[e,` / `,t]}),(0,Q.jsxs)(V,{type:`button`,variant:`ghost`,size:`sm`,disabled:e>=t,onClick:()=>n(e+1),children:[_(),(0,Q.jsx)(Ie,{size:14,"aria-hidden":!0})]})]})}function ct({groupId:e,groupName:t,open:n,onOpenChange:r}){let s=o(L.groups.getGroup,n&&e?{groupId:e}:`skip`),c=o(L.groups.listAssignableInstances,n?{}:`skip`),u=o(L.groups.listAssignableUsers,n?{}:`skip`),d=w(L.groups.addMember),m=w(L.groups.removeMember),h=w(L.groups.bulkSetMembers),_=w(L.groups.setGroupManager),y=H(),[x,S]=(0,Z.useState)(``),[C,T]=(0,Z.useState)(``),[E,D]=(0,Z.useState)(`members`),[re,O]=(0,Z.useState)(1),[k,ie]=(0,Z.useState)(new Set),A=(0,Z.useRef)(null),j=(0,Z.useMemo)(()=>new Set((s?.members??[]).map(e=>e.userId)),[s]),ae=(0,Z.useMemo)(()=>new Set((s?.members??[]).filter(e=>e.manager).map(e=>e.userId)),[s]),oe=s?.viewerIsAdmin===!0,M=(0,Z.useMemo)(()=>new Set((s?.agents??[]).map(e=>`${e.instanceName}/${e.agentId}`)),[s]);(0,Z.useEffect)(()=>{S(``),T(``),D(`members`),O(1),A.current=null},[n,e]),(0,Z.useEffect)(()=>{O(1)},[x]),(0,Z.useEffect)(()=>{n&&s&&e&&A.current!==e&&(A.current=e,ie(new Set((s.members??[]).map(e=>e.userId))))},[n,s,e]);let N=(0,Z.useMemo)(()=>u?$e(u,x,k):[],[u,x,k]);async function ce(t,n){if(e)try{n?await m({groupId:e,userId:t}):await d({groupId:e,userId:t})}catch(e){y.error(ve(),e)}}async function ue(t,n){if(e)try{await _({groupId:e,userId:t,manager:!n})}catch(e){y.error(De(),e)}}let P=rt(N,e=>j.has(e.userId)),de=N.filter(e=>j.has(e.userId)).length,F=it(N,re,ot);async function fe(){if(!e||N.length===0)return;let t=N.map(e=>e.userId);try{await h({groupId:e,userIds:t,member:P!==`all`})}catch(e){y.error(ve(),e)}}return(0,Q.jsx)(Xe,{open:n,onOpenChange:r,children:(0,Q.jsxs)(Ke,{className:`oc-access`,children:[(0,Q.jsxs)(Ue,{children:[(0,Q.jsx)(qe,{children:g({name:t})}),(0,Q.jsx)(Ye,{children:f()})]}),(0,Q.jsxs)(Pe,{value:E,onValueChange:D,className:`oc-access__tabs`,children:[(0,Q.jsxs)(Ne,{className:`w-full`,children:[(0,Q.jsxs)(z,{value:`members`,className:`flex-1 gap-1.5`,children:[(0,Q.jsx)(We,{size:13,"aria-hidden":!0}),ne(),s?(0,Q.jsx)(U,{variant:`secondary`,className:`oc-access__tabcount`,children:j.size}):null]}),(0,Q.jsxs)(z,{value:`agents`,className:`flex-1 gap-1.5`,children:[(0,Q.jsx)(K,{size:13,"aria-hidden":!0}),p(),s?(0,Q.jsx)(U,{variant:`secondary`,className:`oc-access__tabcount`,children:M.size}):null]}),(0,Q.jsxs)(z,{value:`charts`,className:`flex-1 gap-1.5`,children:[(0,Q.jsx)(Y,{size:13,"aria-hidden":!0}),Ae(),s?(0,Q.jsx)(U,{variant:`secondary`,className:`oc-access__tabcount`,children:s.chartCount}):null]})]}),(0,Q.jsx)(B,{value:`members`,children:u===void 0||s===void 0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:i()}):u.length===0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:b()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(G,{value:x,onChange:e=>S(e.target.value),placeholder:ee(),className:`oc-access__search`}),N.length===0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:a()}):(0,Q.jsxs)(Q.Fragment,{children:[N.length>1?(0,Q.jsxs)(`div`,{className:`oc-access__row oc-access__selectall`,children:[(0,Q.jsx)(q,{checked:P===`all`?!0:P===`some`?`indeterminate`:!1,onCheckedChange:()=>void fe(),"aria-label":R()}),(0,Q.jsx)(`span`,{className:`oc-access__label`,children:R()}),(0,Q.jsxs)(U,{variant:`outline`,className:`oc-access__count`,children:[de,` / `,N.length]})]}):null,(0,Q.jsx)(`div`,{className:`oc-access__list`,children:F.pageItems.map(e=>{let t=j.has(e.userId),n=tt(e),r=ae.has(e.userId);return(0,Q.jsxs)(`div`,{className:`oc-access__row`,children:[(0,Q.jsx)(q,{checked:t,onCheckedChange:()=>void ce(e.userId,t),"aria-label":v({user:n.primary})}),(0,Q.jsxs)(`span`,{className:`oc-access__who`,children:[(0,Q.jsx)(`span`,{className:`oc-access__label`,title:n.primary,children:n.primary}),n.secondary?(0,Q.jsx)(`span`,{className:`oc-access__sub`,title:n.secondary,children:n.secondary}):null]}),(0,Q.jsx)(U,{variant:`outline`,className:`oc-access__role`,children:nt(e.role)}),(0,Q.jsx)(`span`,{className:`oc-access__mgrslot`,children:t&&oe?(0,Q.jsx)(V,{type:`button`,variant:`ghost`,size:`icon`,className:`shrink-0 oc-access__mgr${r?` oc-access__mgr--on`:``}`,"aria-pressed":r,"aria-label":r?se():le(),title:r?se():le(),onClick:()=>void ue(e.userId,r),children:(0,Q.jsx)(X,{size:15,"aria-hidden":!0})}):t&&r?(0,Q.jsx)(`span`,{className:`oc-access__mgr oc-access__mgr--on`,role:`img`,"aria-label":be(),title:be(),children:(0,Q.jsx)(X,{size:15,"aria-hidden":!0})}):null})]},e._id)})}),(0,Q.jsx)(st,{page:F.page,pageCount:F.pageCount,onPage:O})]})]})}),(0,Q.jsx)(B,{value:`agents`,children:c===void 0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:i()}):c.length===0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:l()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(G,{value:C,onChange:e=>T(e.target.value),placeholder:te(),className:`oc-access__search`}),(0,Q.jsx)(`div`,{className:`oc-access__list`,children:c.map(t=>(0,Q.jsx)(lt,{groupId:e,instanceName:t.name,kind:t.kind??`openclaw`,assigned:M,query:C},`${e}-${t._id}`))})]})}),(0,Q.jsx)(B,{value:`charts`,children:(0,Q.jsx)(ut,{groupId:e})})]})]})})}function lt({groupId:e,instanceName:t,kind:n,assigned:r,query:i}){let a=o(L.groups.listAssignableAgents,{instanceName:t}),c=w(L.groups.assignAgentToGroup),l=w(L.groups.removeAgentFromGroup),d=w(L.groups.bulkSetGroupAgents),f=H(),[p,m]=(0,Z.useState)(1);if((0,Z.useEffect)(()=>{m(1)},[i]),!e)return null;let h=et(a?.agents??[],i),g=a?.discovery&&!a.discovery.lastPollOk;if(i.trim()&&h.length===0)return null;let _=h.filter(e=>e.presentInLastOk!==!1&&e.enabled!==!1),v=rt(_,e=>r.has(`${t}/${e.agentId}`)),y=it(h,p,ot);async function b(n,r){try{r?await l({groupId:e,instanceName:t,agentId:n}):await c({groupId:e,instanceName:t,agentId:n})}catch(e){f.error(A(),e)}}async function x(){if(_.length===0)return;let n=_.map(e=>e.agentId);try{await d({groupId:e,instanceName:t,agentIds:n,assigned:v!==`all`})}catch(e){f.error(A(),e)}}return(0,Q.jsxs)(`div`,{className:`oc-access__group`,children:[(0,Q.jsxs)(`div`,{className:`oc-access__instance`,children:[(0,Q.jsx)(K,{size:13,"aria-hidden":!0}),(0,Q.jsx)(`span`,{children:t}),(0,Q.jsx)(U,{variant:`outline`,className:`oc-access__kind`,children:n}),g?(0,Q.jsx)(U,{variant:`outline`,className:`oc-access__stale`,children:ke()}):null]}),a===void 0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:fe()}):h.length===0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:g?E():u()}):(0,Q.jsxs)(Q.Fragment,{children:[_.length>1?(0,Q.jsxs)(`div`,{className:`oc-access__row oc-access__selectall`,children:[(0,Q.jsx)(q,{checked:v===`all`?!0:v===`some`?`indeterminate`:!1,onCheckedChange:()=>void x(),"aria-label":R()}),(0,Q.jsx)(`span`,{className:`oc-access__label`,children:R()})]}):null,y.pageItems.map(e=>{let n=`${t}/${e.agentId}`,i=r.has(n),a=e.presentInLastOk===!1,o=!e.enabled;return(0,Q.jsxs)(`div`,{className:`oc-access__row${o?` is-disabled`:``}`,children:[(0,Q.jsx)(q,{checked:i,disabled:(a||o)&&!i,onCheckedChange:()=>void b(e.agentId,i),"aria-label":F({name:e.displayName??e.agentId})}),(0,Q.jsxs)(`span`,{className:`oc-access__label`,title:e.displayName??e.agentId,children:[e.emoji?`${e.emoji} `:``,e.displayName??e.agentId]}),e.model?(0,Q.jsx)(`span`,{className:`oc-access__model`,children:e.model}):null,e.isDefaultOnInstance?(0,Q.jsx)(`span`,{className:`oc-access__fav`,role:`img`,"aria-label":T(),title:T(),children:(0,Q.jsx)(W,{size:14,fill:`currentColor`})}):null,a?(0,Q.jsx)(U,{variant:`outline`,className:`oc-access__gone`,children:s()}):null]},e.agentId)}),(0,Q.jsx)(st,{page:y.page,pageCount:y.pageCount,onPage:m})]})]})}function ut({groupId:e}){let t=o(L.charts.listGroupChartSelection,e?{groupId:e}:`skip`),n=w(L.charts.assignChartToGroup),r=w(L.charts.removeChartFromGroup),a=w(L.charts.setGroupDefaultChart),s=w(L.charts.addChartToGroupPool),c=w(L.charts.removeChartFromGroupPool),l=H();if(!e)return null;if(t===void 0)return(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:i()});let{pool:u,addable:d,canManagePool:f}=t;if(u.length===0&&!f)return(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:j()});async function p(t,i){try{i?await r({groupId:e,chartKey:t}):await n({groupId:e,chartKey:t})}catch(e){l.error(I(),e)}}async function m(t){try{await a({groupId:e,chartKey:t})}catch(e){l.error(I(),e)}}async function h(t){try{await s({groupId:e,chartKey:t})}catch(e){l.error(I(),e)}}async function g(t){try{await c({groupId:e,chartKey:t})}catch(e){l.error(I(),e)}}return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`div`,{className:`oc-access__list`,children:u.map(e=>(0,Q.jsxs)(`div`,{className:`oc-access__row`,children:[(0,Q.jsx)(q,{checked:e.selected,onCheckedChange:()=>void p(e.chartKey,e.selected),"aria-label":ue({name:e.name})}),(0,Q.jsx)(`span`,{className:`oc-access__label`,title:e.name,children:e.name}),e.selected?e.isDefault?(0,Q.jsx)(`span`,{className:`oc-access__fav`,role:`img`,"aria-label":P(),title:P(),children:(0,Q.jsx)(W,{size:14,fill:`currentColor`})}):(0,Q.jsx)(V,{type:`button`,variant:`ghost`,size:`sm`,onClick:()=>void m(e.chartKey),children:he()}):null,f?(0,Q.jsx)(V,{type:`button`,variant:`ghost`,size:`sm`,"aria-label":k({name:e.name}),title:k({name:e.name}),onClick:()=>void g(e.chartKey),children:(0,Q.jsx)(Me,{size:14,"aria-hidden":!0})}):null]},e.chartKey))}),f?d.length>0?(0,Q.jsxs)(Be,{value:``,onValueChange:e=>void h(e),children:[(0,Q.jsx)(Fe,{size:`sm`,className:`oc-access__search`,children:(0,Q.jsx)(Ge,{placeholder:Oe()})}),(0,Q.jsx)(Ve,{children:d.map(e=>(0,Q.jsx)(Le,{value:e.chartKey,children:e.name},e.chartKey))})]}):u.length===0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:je()}):null:null]})}export{at as GroupsTab};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$E as r,$T as i,AD as a,AE as o,B as s,BE as c,Bi as l,CB as u,CD as d,CE as f,DD as p,DE as m,ED as h,EE as g,F as _,FD as v,FE as y,Fx as b,G as x,GE as S,H as C,HE as w,I as ee,ID as te,IE as T,JE as E,JT as D,K as ne,KE as O,L as re,LD as ie,LE as k,M as ae,MD as oe,ME as se,N as ce,ND as le,NE as ue,OD as de,OE as fe,P as pe,PD as me,PE as he,Px as ge,QE as _e,QT as ve,R as ye,RE as be,Ri as xe,SB as A,SD as Se,SE as Ce,TD as we,TE as Te,U as Ee,UE as De,V as Oe,VE as ke,W as Ae,WE as je,XE as Me,XT as Ne,YE as Pe,YT as Fe,ZE as Ie,ZT as Le,_D as Re,aD as ze,aE as Be,bB as j,bD as Ve,bE as He,bN as Ue,cD as We,cE as Ge,dD as Ke,dE as qe,eD as Je,eE as Ye,fD as Xe,fE as Ze,gD as Qe,gE as $e,gc as et,hD as tt,hE as nt,hc as rt,iD as it,iE as at,j as ot,jD as st,jE as ct,kD as lt,kE as ut,lD as dt,lE as ft,mD as pt,mE as mt,mc as ht,nD as gt,nE as _t,oD as vt,oE as yt,pD as bt,pE as xt,pc as St,q as Ct,qE as wt,rD as Tt,rE as Et,sD as Dt,sE as Ot,t as M,tD as kt,tE as At,uD as jt,uE as Mt,vD as Nt,vE as N,wD as Pt,wE as Ft,xD as It,xE as P,xN as Lt,yD as Rt,yE as zt,z as Bt,zE as Vt,zi as Ht}from"./api-B9t7A61E.js";import{a as Ut,c as Wt}from"./FieldLabel-CK8GT8Ed.js";import{t as F}from"./button-0XSqjZXP.js";import{$ as I,Bt as Gt,Dt as L,Et as R,Q as z,Rt as Kt,U as qt,X as B,Z as V,_ as Jt,at as H,et as U,jt as W,nt as G,ot as K,rt as q,tt as J,ut as Yt,zt as Xt}from"./index-CqHFDZOR.js";import{t as Zt}from"./DataTableShell-DxLu0zon.js";import{InstanceConfigDialog as Qt}from"./BridgeTab-zSreXnvo.js";var Y=t(e(),1),X=[`conversational`,`documentary`,`summarizer`,`curator`],$t=new Set(X),en=`conversational`;function tn(e){let t=new Set((e??[]).filter(e=>$t.has(e)));return t.size===0?[en]:X.filter(e=>t.has(e))}var Z=n(),Q={name:``,gatewayUrl:``,bridgeUrl:``,displayName:``,kind:`openclaw`,transport:`ws`,gatewayVersion:``,gatewayHttpUrl:``,authMode:`token`,personScopes:`capped`,identitySource:`canonical`,systemIdentity:``,streamTransport:Ut},nn={openclaw:[`token`,`deviceIdentity`],hermes:[`apiKey`]};function rn(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 an(){let e=u(M.admin.listInstances,{}),t=u(M.agents.listAllInstanceAgents,{}),n=A(M.admin.upsertInstance),r=A(M.admin.deleteInstance),i=L(),[o,c]=(0,Y.useState)(!1),[f,m]=(0,Y.useState)(Q),[g,y]=(0,Y.useState)(null),[S,w]=(0,Y.useState)(null),[T,E]=(0,Y.useState)(null),[D,O]=(0,Y.useState)(null);async function k(){try{await n({instanceId:D??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}),m(Q),O(null),c(!1)}catch(e){i.error(v(),e)}}return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`p`,{className:`oc-admin__hint`,children:[me(),(0,Z.jsx)(`strong`,{children:le()}),oe()]}),(0,Z.jsx)(Zt,{title:st(),rows:e,addLabel:a(),onAdd:()=>{O(null),m(Q),c(!0)},emptyHint:lt(),columns:[{header:de(),cell:e=>e.name,sort:e=>e.name},{header:p(),cell:e=>(0,Z.jsx)(R,{variant:`outline`,children:e.kind??`openclaw`}),sort:e=>e.kind??`openclaw`},{header:h(),cell:e=>e.gatewayUrl,sort:e=>e.gatewayUrl},{header:we(),cell:e=>e.displayName??`—`,sort:e=>e.displayName??null},{header:ie(),cell:e=>{let n=(t?.[e.name]??[]).filter(e=>e.presentInLastOk!==!1&&e.enabled);if(n.length===0)return(0,Z.jsx)(`span`,{className:`text-muted-foreground`,children:`—`});let r=t=>e.defaultAgentId===t;return(0,Z.jsx)(`div`,{className:`flex flex-wrap gap-1`,children:[...n].sort((e,t)=>Number(r(t.agentId))-Number(r(e.agentId))).map(e=>(0,Z.jsxs)(R,{variant:r(e.agentId)?`default`:`outline`,title:r(e.agentId)?Fe():void 0,children:[e.emoji?`${e.emoji} `:``,e.displayName??e.agentId]},e.agentId))})}}],rowActions:e=>[{label:It(),onSelect:()=>{O(e._id),m(rn(e)),c(!0)}},{label:te(),onSelect:()=>y(e.name)},{label:vt(),onSelect:()=>E(e)},{label:Pt(),onSelect:()=>w(e)},{label:d(),variant:`destructive`,onSelect:()=>void r({instanceId:e._id})}],bulkActions:[{label:d(),variant:`destructive`,onSelect:e=>e.forEach(e=>void r({instanceId:e}))}]}),(0,Z.jsx)(Jt,{open:o,onOpenChange:c,title:D?Ve():Se(),description:Nt(),canSubmit:!!(f.name&&f.gatewayUrl),onSubmit:k,submitLabel:Re(),children:(0,Z.jsxs)(`div`,{className:`oc-form`,children:[(0,Z.jsxs)($,{label:Qe(),children:[(0,Z.jsx)(W,{value:f.name,disabled:D!==null,onChange:e=>m({...f,name:e.target.value})}),D?(0,Z.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:Rt()}):null]}),(0,Z.jsx)($,{label:tt(),children:(0,Z.jsxs)(B,{value:f.kind,onValueChange:e=>m({...f,kind:e}),children:[(0,Z.jsx)(I,{size:`sm`,className:`w-full`,children:(0,Z.jsx)(U,{})}),(0,Z.jsxs)(V,{children:[(0,Z.jsx)(z,{value:`openclaw`,children:`OpenClaw`}),(0,Z.jsx)(z,{value:`hermes`,children:`Hermes`})]})]})}),f.kind===`hermes`?(0,Z.jsx)($,{label:l(),children:(0,Z.jsxs)(B,{value:f.transport,onValueChange:e=>m({...f,transport:e}),children:[(0,Z.jsx)(I,{size:`sm`,className:`w-full`,children:(0,Z.jsx)(U,{})}),(0,Z.jsxs)(V,{children:[(0,Z.jsx)(z,{value:`ws`,children:Ht()}),(0,Z.jsx)(z,{value:`rest`,children:xe()})]})]})}):null,(0,Z.jsx)($,{label:pt(),children:(0,Z.jsx)(W,{value:f.gatewayUrl,onChange:e=>m({...f,gatewayUrl:e.target.value})})}),(0,Z.jsx)($,{label:bt(),children:(0,Z.jsx)(W,{value:f.bridgeUrl,placeholder:Xe(),onChange:e=>m({...f,bridgeUrl:e.target.value})})}),(0,Z.jsx)($,{label:Ke(),children:(0,Z.jsx)(W,{value:f.displayName,onChange:e=>m({...f,displayName:e.target.value})})}),(0,Z.jsxs)($,{label:b(),children:[(0,Z.jsxs)(B,{value:f.streamTransport,onValueChange:e=>m({...f,streamTransport:e}),children:[(0,Z.jsx)(I,{size:`sm`,className:`w-full`,children:(0,Z.jsx)(U,{})}),(0,Z.jsx)(V,{children:Wt.map(e=>(0,Z.jsx)(z,{value:e,children:e},e))})]}),(0,Z.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:ge()})]}),(0,Z.jsx)($,{label:jt(),children:(0,Z.jsx)(W,{value:f.gatewayVersion,placeholder:dt(),onChange:e=>m({...f,gatewayVersion:e.target.value})})}),f.kind===`openclaw`?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)($,{label:re(),children:[(0,Z.jsxs)(B,{value:f.authMode,onValueChange:e=>m({...f,authMode:e}),children:[(0,Z.jsx)(I,{size:`sm`,className:`w-full`,children:(0,Z.jsx)(U,{})}),(0,Z.jsxs)(V,{children:[(0,Z.jsx)(z,{value:`token`,children:ee()}),(0,Z.jsx)(z,{value:`trusted-proxy`,children:_()})]})]}),(0,Z.jsx)(`p`,{className:`oc-field__hint`,children:f.authMode===`trusted-proxy`?ce():pe()})]}),f.authMode===`trusted-proxy`?(0,Z.jsxs)($,{label:Ct(),children:[(0,Z.jsxs)(B,{value:f.personScopes,onValueChange:e=>m({...f,personScopes:e}),children:[(0,Z.jsx)(I,{size:`sm`,className:`w-full`,children:(0,Z.jsx)(U,{})}),(0,Z.jsxs)(V,{children:[(0,Z.jsx)(z,{value:`capped`,children:ne()}),(0,Z.jsx)(z,{value:`full`,children:x()})]})]}),(0,Z.jsx)(`p`,{className:`oc-field__hint`,children:f.personScopes===`full`?Ee():Ae()})]}):null,f.authMode===`trusted-proxy`?(0,Z.jsxs)($,{label:C(),children:[(0,Z.jsxs)(B,{value:f.identitySource,onValueChange:e=>m({...f,identitySource:e}),children:[(0,Z.jsx)(I,{size:`sm`,className:`w-full`,children:(0,Z.jsx)(U,{})}),(0,Z.jsxs)(V,{children:[(0,Z.jsx)(z,{value:`canonical`,children:Oe()}),(0,Z.jsx)(z,{value:`email`,children:s()})]})]}),(0,Z.jsx)(`p`,{className:`oc-field__hint`,children:f.identitySource===`email`?ye():Bt()})]}):null,f.authMode===`trusted-proxy`?(0,Z.jsx)($,{label:ae(),children:(0,Z.jsx)(W,{value:f.systemIdentity,placeholder:ot(),onChange:e=>m({...f,systemIdentity:e.target.value})})}):null]}):null,(0,Z.jsx)($,{label:We(),children:(0,Z.jsx)(W,{value:f.gatewayHttpUrl,placeholder:Dt(),onChange:e=>m({...f,gatewayHttpUrl:e.target.value})})})]})}),(0,Z.jsx)(hn,{instanceName:g,open:g!==null,onOpenChange:e=>{e||y(null)}}),S?(0,Z.jsx)(Qt,{instance:S,onClose:()=>w(null)},S._id):null,T?(0,Z.jsx)(on,{instance:T,onClose:()=>E(null)},T._id):null]})}function on({instance:e,onClose:t}){let n=u(M.instanceSecrets.listInstanceSecretStatus,{}),r=nn[e.kind??`openclaw`],i=(0,Y.useMemo)(()=>{let t={};for(let r of n??[])r.instanceId===e._id&&(t[r.field]=r.updatedAt);return t},[n,e._id]);return(0,Z.jsx)(J,{open:!0,onOpenChange:e=>!e&&t(),children:(0,Z.jsxs)(G,{onOpenAutoFocus:e=>e.preventDefault(),children:[(0,Z.jsxs)(H,{children:[(0,Z.jsx)(K,{children:ze({instance:e.displayName??e.name})}),(0,Z.jsx)(q,{children:it()})]}),(0,Z.jsx)(`div`,{className:`oc-form`,children:r.map(t=>(0,Z.jsx)(ln,{instanceId:e._id,field:t,updatedAt:i[t]??null},t))}),(0,Z.jsx)(`div`,{className:`oc-bridgesecret`,children:(0,Z.jsx)(cn,{instance:e})}),(0,Z.jsx)(sn,{instance:e})]})})}function sn({instance:e}){let t=j(M.instanceSync.forceInstanceSync),n=L(),[r,i]=(0,Y.useState)(!1);async function a(){if(!r){i(!0);try{switch((await t({instanceId:e._id})).status){case`synced`:n.success(be());break;case`no_agents`:n.success(T());break;case`no_bridge_url`:n.error(y());break;case`deploy_misconfigured`:n.error(he());break;case`unauthorized`:n.error(se());break;case`not_served`:n.error(ct());break;default:n.error(ue());break}}catch(e){n.error(k(),e)}finally{i(!1)}}}return(0,Z.jsxs)(`div`,{className:`oc-form`,children:[(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:o()}),(0,Z.jsx)(`div`,{className:`flex items-center gap-2`,children:(0,Z.jsx)(F,{size:`sm`,variant:`outline`,onClick:()=>void a(),disabled:r,children:r?Vt():c()})})]})}function cn({instance:e}){let t=u(M.bridgeAuth.listBridgeAuthStatus,{}),n=j(M.bridgeAuth.mintBridgeSecret),i=A(M.bridgeAuth.revokeBridgeSecret),a=L(),[o,s]=(0,Y.useState)(!1),[c,l]=(0,Y.useState)(null),[d,p]=(0,Y.useState)(!1),h=(t??[]).find(t=>t.instanceId===e._id),_=h!==void 0;async function v(){if(!o){s(!0);try{l((await n({instanceId:e._id})).plaintext),p(!1)}catch(e){a.error(f(),e)}finally{s(!1)}}}async function y(){if(!o){s(!0);try{await i({instanceId:e._id}),l(null),a.success(Ft())}catch(e){a.error(f(),e)}finally{s(!1)}}}async function b(){if(c)try{await navigator.clipboard.writeText(c),p(!0)}catch{}}return(0,Z.jsxs)($,{label:ut(),children:[(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:fe()}),(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Z.jsx)(R,{variant:_?`outline`:`secondary`,children:_?`${Je()} · ${h.prefix}…${h.lastFour}`:r()}),(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(F,{size:`sm`,onClick:()=>void v(),disabled:o,children:_?g():m()}),_?(0,Z.jsx)(F,{size:`sm`,variant:`destructive`,onClick:()=>void y(),disabled:o,children:Te()}):null]})]}),c?(0,Z.jsxs)(`div`,{className:`oc-bridgesecret__reveal`,children:[(0,Z.jsx)(`p`,{className:`oc-sa__minted-warning`,children:Ce()}),(0,Z.jsxs)(`div`,{className:`oc-sa__minted-box`,children:[(0,Z.jsx)(`code`,{className:`oc-sa__minted-plain`,children:c}),(0,Z.jsx)(F,{variant:`outline`,size:`sm`,onClick:()=>void b(),children:d?Lt():Ue()})]}),(0,Z.jsx)(F,{size:`sm`,variant:`ghost`,onClick:()=>{l(null),p(!1)},children:P()})]}):null]})}function ln({instanceId:e,field:t,updatedAt:n}){let i=j(M.instanceSecrets.setInstanceSecret),a=A(M.instanceSecrets.clearInstanceSecret),o=j(M.deviceIdentity.generateDeviceIdentity),s=L(),[c,l]=(0,Y.useState)(``),[u,d]=(0,Y.useState)(!1),[f,p]=(0,Y.useState)(null),[m,h]=(0,Y.useState)(!1),g=n!==null,_=t===`deviceIdentity`,v=t===`token`?Tt():t===`deviceIdentity`?gt():kt();async function y(){if(!(!c.trim()||u)){d(!0);try{await i({instanceId:e,field:t,plaintext:c}),l(``),p(null),h(!1),s.success(E())}catch(e){s.error(wt(),e)}finally{d(!1)}}}async function b(){if(!u){d(!0);try{await a({instanceId:e,field:t}),p(null),h(!1),s.success(O())}catch(e){s.error(wt(),e)}finally{d(!1)}}}async function x(){if(!u){d(!0);try{p(await o({instanceId:e})),h(!1),s.success(De())}catch(e){s.error(ke(),e)}finally{d(!1)}}}let C=f?`openclaw devices approve ${f.id}`:``;async function ee(){if(C)try{await navigator.clipboard.writeText(C),h(!0)}catch{}}return(0,Z.jsxs)($,{label:v,children:[_?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:je()}):null,(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Z.jsx)(R,{variant:g?`outline`:`secondary`,children:g?Je():r()}),(0,Z.jsx)(W,{type:`password`,autoComplete:`off`,className:`flex-1 min-w-32`,value:c,placeholder:g?Ie():_e(),onChange:e=>l(e.target.value)}),(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(F,{size:`sm`,onClick:()=>void y(),disabled:u||c.trim().length===0,children:Me()}),_?(0,Z.jsx)(F,{size:`sm`,variant:`outline`,onClick:()=>void x(),disabled:u,children:S()}):null,g?(0,Z.jsx)(F,{size:`sm`,variant:`destructive`,onClick:()=>void b(),disabled:u,children:Pe()}):null]})]}),f?(0,Z.jsxs)(`div`,{className:`oc-bridgesecret__reveal`,children:[(0,Z.jsx)(`p`,{className:`text-sm font-medium`,children:De()}),(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:w()}),(0,Z.jsxs)(`div`,{className:`oc-sa__minted-box`,children:[(0,Z.jsx)(`code`,{className:`oc-sa__minted-plain`,children:C}),(0,Z.jsx)(F,{variant:`outline`,size:`sm`,onClick:()=>void ee(),children:m?Lt():Ue()})]}),(0,Z.jsx)(F,{size:`sm`,variant:`ghost`,onClick:()=>{p(null),h(!1)},children:P()})]}):null]})}var un={conversational:Mt,documentary:Ge,summarizer:et,curator:ht},dn={conversational:ft,documentary:Ot,summarizer:rt,curator:St},fn=e=>(un[e]??(()=>e))(),pn=e=>(dn[e]??(()=>``))();function mn({agentId:e,types:t,onToggle:n}){return(0,Z.jsxs)(`div`,{className:`oc-agentcard__types`,children:[(0,Z.jsx)(`span`,{className:`oc-agentcard__types-label`,children:mt()}),t.map(e=>(0,Z.jsx)(R,{variant:`secondary`,className:`oc-agenttype__chip`,title:pn(e),children:fn(e)},e)),(0,Z.jsxs)(Kt,{children:[(0,Z.jsx)(Gt,{asChild:!0,children:(0,Z.jsx)(F,{type:`button`,variant:`outline`,size:`sm`,className:`h-7`,children:xt()})}),(0,Z.jsxs)(Xt,{align:`start`,className:`oc-agenttypes-pop`,children:[(0,Z.jsx)(`p`,{className:`oc-agenttypes-pop__title`,children:Ze()}),(0,Z.jsx)(`p`,{className:`oc-agenttypes-pop__hint`,children:qe()}),(0,Z.jsx)(`div`,{className:`oc-agenttypes-pop__list`,children:X.map(r=>{let i=`agtype-${e}-${r}`;return(0,Z.jsxs)(`div`,{className:`oc-agenttypes-pop__item`,children:[(0,Z.jsx)(Yt,{id:i,checked:t.includes(r),onCheckedChange:()=>n(r)}),(0,Z.jsxs)(`label`,{htmlFor:i,className:`oc-agenttypes-pop__text`,children:[(0,Z.jsx)(`span`,{className:`oc-agenttypes-pop__name`,children:fn(r)}),(0,Z.jsx)(`span`,{className:`oc-agenttypes-pop__desc`,children:pn(r)})]})]},r)})})]})]})]})}function hn({instanceName:e,open:t,onOpenChange:n}){let r=u(M.agents.listAgentsForInstance,t&&e?{instanceName:e}:`skip`),a=A(M.agents.setAgentEnabled).withOptimisticUpdate((e,{instanceName:t,agentId:n,enabled:r})=>{let i=e.getQuery(M.agents.listAgentsForInstance,{instanceName:t});i&&e.setQuery(M.agents.listAgentsForInstance,{instanceName:t},{...i,agents:i.agents.map(e=>e.agentId===n?{...e,enabled:r}:e)})}),o=A(M.agents.setInstanceDefaultAgent).withOptimisticUpdate((e,{instanceName:t,agentId:n})=>{let r=e.getQuery(M.agents.listAgentsForInstance,{instanceName:t});r&&e.setQuery(M.agents.listAgentsForInstance,{instanceName:t},{...r,defaultAgentId:n})}),s=A(M.agents.setAgentTypes).withOptimisticUpdate((e,{instanceName:t,agentId:n,types:r})=>{let i=e.getQuery(M.agents.listAgentsForInstance,{instanceName:t});if(!i)return;let a=tn(r);e.setQuery(M.agents.listAgentsForInstance,{instanceName:t},{...i,agents:i.agents.map(e=>e.agentId===n?{...e,types:a}:e)})}),c=A(M.agents.setAgentDescription).withOptimisticUpdate((e,{instanceName:t,agentId:n,description:r})=>{let i=e.getQuery(M.agents.listAgentsForInstance,{instanceName:t});if(!i)return;let a=r.trim();e.setQuery(M.agents.listAgentsForInstance,{instanceName:t},{...i,agents:i.agents.map(e=>e.agentId===n?{...e,description:a.length===0?null:a}:e)})}),l=A(M.agents.removeInstanceAgent),d=qt(),f=L();async function p(t,n){if(e)try{await a({instanceName:e,agentId:t,enabled:n})}catch(e){f.error(N(),e)}}async function m(t){if(e)try{await o({instanceName:e,agentId:t})}catch(e){f.error(N(),e)}}async function h(t,n,r){if(!e)return;let i=r.includes(n)?r.filter(e=>e!==n):[...r,n];try{await s({instanceName:e,agentId:t,types:i})}catch(e){f.error(N(),e)}}async function g(t,n){if(e&&await d({title:at({name:n}),description:Et(),confirmLabel:_t(),destructive:!0}))try{await l({instanceName:e,agentId:t}),f.success(At())}catch(e){f.error(N(),e)}}return(0,Z.jsx)(J,{open:t,onOpenChange:n,children:(0,Z.jsxs)(G,{className:`oc-access`,children:[(0,Z.jsxs)(H,{children:[(0,Z.jsx)(K,{children:He({name:e??``})}),(0,Z.jsx)(q,{children:zt()})]}),r===void 0?(0,Z.jsx)(`p`,{className:`oc-access__hint`,children:Ye()}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`div`,{className:`oc-access__poll`,children:r.discovery===null?i():r.discovery.lastPollOk?ve():Le({error:r.discovery.error??`?`})}),r.agents.length===0?(0,Z.jsx)(`p`,{className:`oc-access__hint`,children:Ne()}):(0,Z.jsx)(`div`,{className:`oc-access__list`,children:r.agents.map(t=>{let n=t.presentInLastOk===!1,i=r.defaultAgentId===t.agentId,a=t.displayName??t.agentId,o=t.types??[];return(0,Z.jsxs)(`div`,{className:`oc-agentcard`+(t.enabled?``:` oc-agentcard--off`),children:[(0,Z.jsxs)(`div`,{className:`oc-agentcard__head`,children:[(0,Z.jsx)(Yt,{checked:t.enabled,disabled:n,"aria-label":a,onCheckedChange:e=>void p(t.agentId,e===!0)}),(0,Z.jsxs)(`span`,{className:`oc-agentcard__name`,title:a,children:[t.emoji?`${t.emoji} `:``,a]}),t.model?(0,Z.jsx)(`span`,{className:`oc-access__model`,children:t.model}):null,n?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(R,{variant:`outline`,className:`oc-access__gone`,children:D()}),(0,Z.jsx)(F,{size:`sm`,variant:`ghost`,className:`h-7 text-destructive`,onClick:()=>void g(t.agentId,a),children:Be()})]}):i?(0,Z.jsx)(R,{variant:`default`,children:Fe()}):(0,Z.jsx)(F,{size:`sm`,variant:`outline`,className:`h-7`,disabled:!t.enabled,onClick:()=>void m(t.agentId),children:yt()})]}),t.enabled?(0,Z.jsx)(mn,{agentId:t.agentId,types:o,onToggle:e=>void h(t.agentId,e,o)}):null,t.enabled?(0,Z.jsx)(gn,{value:t.description??``,onSave:async n=>{if(e)try{await c({instanceName:e,agentId:t.agentId,description:n})}catch(e){f.error(N(),e)}}}):null]},t.agentId)})})]})]})})}function gn({value:e,onSave:t}){let[n,r]=(0,Y.useState)(e);(0,Y.useEffect)(()=>{r(e)},[e]);let i=()=>{n.trim()!==e.trim()&&t(n)};return(0,Z.jsx)(W,{className:`oc-agentcard__desc`,value:n,maxLength:280,placeholder:$e(),"aria-label":nt(),onChange:e=>r(e.target.value),onBlur:i,onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),i())}})}function $({label:e,children:t}){return(0,Z.jsxs)(`label`,{className:`oc-field`,children:[(0,Z.jsx)(`span`,{className:`oc-field__label`,children:e}),t]})}export{an as InstancesTab};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{By as r,CB as i,Gy as a,Hy as o,IA as s,Jy as c,Ky as l,Qy as u,Ry as d,Uy as f,Vy as p,Wy as m,Xy as h,Yy as g,Zy as _,cA as v,dA as y,eA as ee,lA as b,qy as x,t as S,tA as te,uA as C,zy as w}from"./api-B9t7A61E.js";import{Gn as T,Kn as E,i as D,o as O,q as ne,r as re}from"./index-CqHFDZOR.js";import{a as k,n as A,o as j,r as M,t as N}from"./card-CYCPCZHb.js";import{n as P,t as F}from"./TimeRangePicker-Ciowmz1T.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=i(S.me.getMe,{host:ne})?.permissions?.includes(`traces.read`)??!1,t=i(S.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:s()}),(0,z.jsxs)(N,{children:[(0,z.jsxs)(k,{children:[(0,z.jsx)(j,{children:y()}),(0,z.jsx)(M,{children:b()})]}),(0,z.jsx)(A,{children:n.length<2?(0,z.jsx)(`p`,{className:`oc-admin__hint`,children:v()}):(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),i=t=>6+t*468/(e.length-1),a=e=>74-e*68/r,o=e=>e.map((e,t)=>`${t===0?`M`:`L`}${i(t).toFixed(1)},${a(e).toFixed(1)}`).join(` `),s=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:[ee(),` p50 `,V(s.cP50),` `,C()]}),(0,z.jsxs)(`span`,{children:[te(),` p50 `,V(s.aP50),` `,C()]})]}),(0,z.jsxs)(`svg`,{viewBox:`0 0 480 80`,className:`h-20 w-full`,preserveAspectRatio:`none`,role:`img`,"aria-label":y(),children:[(0,z.jsx)(`path`,{d:o(n),fill:`none`,style:{stroke:`var(--muted-foreground)`},strokeWidth:1.5}),(0,z.jsx)(`path`,{d:o(t),fill:`none`,style:{stroke:`var(--primary)`},strokeWidth:1.5})]})]})}var W=[{metric:`api.calls`,label:u(),unit:`/h`,group:`API`,isError:!1},{metric:`api.errors`,label:_(),unit:`/h`,group:`API`,isError:!0},{metric:`api.latency.avg_ms`,label:h(),unit:`ms`,group:`API`,isError:!1},{metric:`openclaw.ingest`,label:g(),unit:`/h`,group:`OpenClaw`,isError:!1},{metric:`chat.send`,label:c(),unit:`/h`,group:`Chat`,isError:!1},{metric:L.ASSISTANT_STREAM_ERRORS,label:x(),unit:`/h`,group:`Assistant`,isError:!0},{metric:L.ASSISTANT_ANNOUNCE_ERRORS,label:l(),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:s,to:c}=P(n),{rowLimit:l,buckets:u}=Y(s,c),d=i(S.kpi.listKpis,{limit:l,filter:{from:s,to:c}}),p=(0,I.useMemo)(()=>{let e=new Map;for(let t of d??[]){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>u&&e.set(t,n.slice(n.length-u));return e},[d,u]),h=(0,z.jsxs)(z.Fragment,{children:[(0,z.jsxs)(`p`,{className:`oc-admin__hint`,children:[a(),` `,(0,z.jsx)(`span`,{className:`oc-filter__window`,children:m()})]}),(0,z.jsx)(ae,{value:n,onChange:r})]});return d===void 0?(0,z.jsxs)(z.Fragment,{children:[h,(0,z.jsx)(H,{}),(0,z.jsx)(`p`,{className:`oc-admin__hint`,children:f()})]}):d.length===0?(0,z.jsxs)(z.Fragment,{children:[h,(0,z.jsx)(H,{}),(0,z.jsx)(`p`,{className:`oc-admin__hint`,children:o()})]}):(0,z.jsxs)(z.Fragment,{children:[h,(0,z.jsx)(H,{}),K.map(e=>{let t=W.filter(t=>t.group===e);return t.some(e=>(p.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:p.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,i=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&&i>0?` oc-kpi__value--error`:``),children:Q(i)}),(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:p({value:$(n.bucket)})}):(0,z.jsx)(`span`,{className:`oc-kpi__muted`,children:r()}),(0,z.jsx)(`span`,{className:`oc-kpi__muted`,children:w({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":d({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{$P as r,$z as i,BP as a,Bn as o,Bz as s,CB as c,FP as l,GP as u,Gz as d,HP as f,Hn as p,Hz as ee,IP as m,JP as h,Jz as te,KP as g,Kz as ne,LP as re,Ln as ie,Lz as ae,NP as oe,PP as se,QP as ce,Qn as le,Qz as ue,RP as de,Rn as fe,Rz as pe,SB as _,UP as me,Un as he,Uz as v,VP as y,Vn as b,Vz as x,WP as S,Wn as C,Wz as w,XP as T,Xz as E,YP as D,Yz as O,ZP as k,Zz as A,_D as j,_F as M,aB as N,aF as P,cF as F,dF as I,eB as L,eF as R,fF as ge,gF as _e,hF as ve,iB as ye,iF as be,ir as xe,lB as Se,lF as Ce,mB as we,mF as Te,nB as Ee,nF as De,oB as Oe,oF as ke,pF as Ae,qP as je,qz as Me,r as z,rB as Ne,rF as Pe,rr as Fe,sF as Ie,t as B,tB as Le,tF as Re,uF as ze,vF as Be,zP as Ve,zn as He,zz as Ue}from"./api-B9t7A61E.js";import{t as V}from"./button-0XSqjZXP.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-CqHFDZOR.js";import{t as et}from"./localePickerView-C2RmOS86.js";import{t as tt}from"./TimezoneCombobox-BuMVLp5O.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:()=>Be()},{id:`composer`,label:()=>M()},{id:`sidebar`,label:()=>_e()},{id:`notifications`,label:()=>r()},{id:`other`,label:()=>ve()}],X={showSource:{category:`messages`,label:()=>Te(),help:()=>Ae()},showReport:{category:`messages`,label:()=>ge(),help:()=>I()},copyAssistant:{category:`messages`,label:()=>ze()},copyUser:{category:`messages`,label:()=>Ce()},showDelete:{category:`messages`,label:()=>F()},showTools:{category:`messages`,label:()=>Ie(),help:()=>ke()},voiceInput:{category:`composer`,label:()=>P(),help:()=>be()},showUsage:{category:`composer`,label:()=>Pe(),help:()=>De()},autoReadAloud:{category:`composer`,label:()=>xe(),help:()=>Fe()},showChatAge:{category:`sidebar`,label:()=>Re(),help:()=>R()},notifSound:{category:`notifications`,label:()=>ce(),help:()=>k()},notifSystem:{category:`notifications`,label:()=>T(),help:()=>D()},replySound:{category:`notifications`,label:()=>h(),help:()=>je()}};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:()=>re()};function ut({prefKey:e,ui:t}){let n=_(B.admin.setUiPrefDefault),r=_(B.admin.setFeatureEnabled),i=ct(e),o=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:y()}),(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:l()}),(0,J.jsx)(U,{value:`off`,children:se()}),(0,J.jsx)(U,{value:`inherit`,children:oe()})]})]}),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":a()}),a()]}):null]}),o?(0,J.jsx)(`span`,{className:`oc-prefs__gov-help`,children:o}):null]})}function dt({current:e,enabled:t}){let n=_(B.me.setDictationShortcut),[r,i]=(0,q.useState)(!1),[a,s]=(0,q.useState)(!1);return(0,q.useEffect)(()=>{if(!r)return;let e=e=>{if(e.preventDefault(),e.stopPropagation(),e.key===`Escape`){i(!1);return}let t=Qe(e);if(t===null){[`Shift`,`Control`,`Meta`,`Alt`].includes(e.key)||(s(!0),window.setTimeout(()=>s(!1),1800));return}i(!1),n({shortcut:t})};return window.addEventListener(`keydown`,e,!0),()=>window.removeEventListener(`keydown`,e,!0)},[r,n]),(0,J.jsxs)(`div`,{className:`oc-prefs__row${t?``:` is-locked`}`,children:[(0,J.jsxs)(`div`,{className:`oc-prefs__info`,children:[(0,J.jsxs)(`span`,{className:`oc-prefs__label`,children:[C(),e?(0,J.jsx)(H,{variant:`secondary`,children:Ge(e,qe())}):null]}),(0,J.jsx)(`span`,{className:`oc-prefs__help`,children:a?b():r?p():he()})]}),(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:ie()}):null,(0,J.jsx)(`button`,{type:`button`,className:`oc-prefs__reset`,disabled:!t,"aria-pressed":r,onClick:()=>i(e=>!e),children:r?fe():e?He():o()})]})]})}function ft(){let[e,t]=(0,q.useState)(``),[n,r]=(0,q.useState)(!1),i=c(B.me.getMe,{host:G}),a=i?.ui,o=$(i?.role)&&n,s=_(B.me.setUiPref).withOptimisticUpdate(Je),l=(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":f()}),f()]}):null,o?(0,J.jsxs)(`div`,{className:`oc-prefs__gov-head`,children:[(0,J.jsx)(`p`,{children:Ve()}),(0,J.jsx)(`p`,{children:de()}),(0,J.jsx)(`p`,{children:m()})]}):null,(0,J.jsx)(W,{value:e,onChange:e=>t(e.target.value),placeholder:g(),"aria-label":g(),className:`mb-2`}),l.length===0?(0,J.jsx)(`div`,{className:`oc-prefs__empty`,children:u()}):(0,J.jsx)(`div`,{className:`oc-prefs`,children:l.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:S()}):l?(0,J.jsx)(H,{variant:`secondary`,children:le()}):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:me()}):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:we()})}var pt={sm:()=>te(),md:()=>Me(),lg:()=>ne(),xl:()=>d(),"2xl":()=>w(),"3xl":()=>v()};function mt(){let e=c(B.me.getMe,{host:G}),t=_(B.me.setLocale),n=_(B.me.setTimezone),r=_(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`})}),a=_(B.me.setMyName),o=Ke(),l=e?.locale??`default`,u=e?.name??``,[d,f]=(0,q.useState)(null),p=d??u,m=p.trim()!==u.trim();async function h(){try{await a({name:p}),f(null),o.success(Ee())}catch(e){o.error(Le(),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:Oe()}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:N()})]}),(0,J.jsxs)(`div`,{className:`oc-show__row`,children:[(0,J.jsx)(W,{className:`max-w-xs`,value:p,maxLength:120,placeholder:ye(),onChange:e=>f(e.target.value),onKeyDown:e=>{e.key===`Enter`&&m&&(e.preventDefault(),h())}}),(0,J.jsx)(V,{size:`sm`,disabled:!m,onClick:()=>void h(),children:j()})]}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:Ne()})]}),(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:L()}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:i()})]}),(0,J.jsxs)(`div`,{className:`oc-show__row`,children:[et().map(e=>(0,J.jsx)(V,{variant:l===e.value?`default`:`outline`,size:`sm`,onClick:()=>void t({locale:e.value}),children:e.label},e.value)),(0,J.jsx)(V,{variant:l==="default"?`default`:`outline`,size:`sm`,onClick:()=>void t({locale:null}),children:Se()})]}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:ue()})]}),(0,J.jsxs)(`section`,{className:`oc-show__section`,children:[(0,J.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,J.jsx)(`h2`,{className:`oc-show__title`,children:ee()}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:x()})]}),(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:s()})]}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:Ue()})]}),(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:A()}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:E()})]}),(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:O()})]}),(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:pe()}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:ae()})]}),(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,Av as i,Bv as a,CB as o,Cg as s,Cv as c,D as l,Dv as u,Fv as d,Gv as f,Hv as p,Iv as m,Jv as h,Kv as g,Lv as _,Mv as ee,Nv as v,Ov as y,Pv as te,Qv as b,Rv as x,SB as S,Sv as ne,Uv as re,Vv as ie,Wv as ae,Xv as oe,Zv as se,_v as ce,ay as le,by as ue,cy as C,dt as de,dv as fe,dy as pe,ey as w,ft as me,fy as he,gv as T,hv as ge,hy as E,iy as _e,kv as ve,mB as D,mv as ye,my as O,ny as k,oy as be,pv as xe,qv as A,ry as Se,t as j,vv as M,xv as N,xy as Ce,yv as P,yy as we,zv as Te}from"./api-B9t7A61E.js";import{t as Ee}from"./list-CyLAzYcK.js";import{t as F}from"./button-0XSqjZXP.js";import{A as De,An as Oe,Bn as ke,C as Ae,D as I,Dt as je,E as Me,Ft as Ne,Gn as L,Hn as Pe,It as Fe,J as Ie,Kn as Le,Lt as Re,Mn as ze,Mt as Be,Nn as Ve,Nt as He,O as R,P as Ue,Pn as We,Pt as z,S as Ge,Sn as Ke,T as qe,Tn as Je,U as Ye,W as Xe,Y as Ze,_ as Qe,b as B,bn as $e,d as et,dn as tt,f as nt,g as rt,h as V,j as H,jn as U,jt as W,k as it,kn as G,m as at,p as ot,qn as st,v as K,vn as ct,w as lt,wn as ut,x as q,y as dt,yn as J}from"./index-CqHFDZOR.js";var ft=l(`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`}]]),pt=l(`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`}]]),mt=l(`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`}]]),Y=l(`panel-left`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M9 3v18`,key:`fh3hqa`}]]),X=t(e(),1),Z=n();function ht({className:e}){return(0,Z.jsx)(Re,{asChild:!0,children:(0,Z.jsx)(F,{variant:`ghost`,size:`icon-xs`,"aria-label":P(),className:e,onClick:e=>e.stopPropagation(),onMouseDown:e=>e.stopPropagation(),onTouchStart:e=>e.stopPropagation(),onPointerDown:e=>e.stopPropagation(),children:(0,Z.jsx)(We,{})})})}function Q({folderId:e,name:t,color:n,currentParentId:r,className:i,onOpen:a}){let s=S(j.projects.renameProject),c=S(j.projects.setProjectColor),l=S(j.projects.moveProject),d=S(j.projects.deleteProject),f=S(j.projects.createProject),p=Ye(),m=Xe(),[h,g]=(0,X.useState)(!1),[_,ee]=(0,X.useState)(t),[v,y]=(0,X.useState)(!1),[te,b]=(0,X.useState)(!1),x=o(j.projects.projectTreeCount,te?{projectId:e}:`skip`);return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(Be,{onOpenChange:e=>e&&b(!0),children:[(0,Z.jsx)(ht,{className:i}),(0,Z.jsxs)(He,{align:`end`,className:`w-48`,onClick:e=>e.stopPropagation(),children:[(0,Z.jsxs)(z,{onSelect:()=>a(),children:[(0,Z.jsx)(U,{}),` `,k()]}),(0,Z.jsxs)(z,{onSelect:()=>{ee(t),g(!0)},children:[(0,Z.jsx)($e,{}),` `,M()]}),(0,Z.jsxs)(z,{onSelect:()=>{requestAnimationFrame(async()=>{let t=await m({title:A(),label:Ce(),placeholder:ue(),confirmLabel:we()});t&&await f({name:t,parentId:e})})},children:[(0,Z.jsx)(Oe,{}),` `,A()]}),(0,Z.jsxs)(z,{onSelect:()=>y(!0),children:[(0,Z.jsx)(pt,{}),` `,ve()]}),(0,Z.jsx)(Ne,{children:ge()}),(0,Z.jsxs)(`div`,{className:`oc-colorgrid`,onClick:e=>e.stopPropagation(),children:[(0,Z.jsx)(`button`,{className:`oc-colorgrid__none`,onClick:()=>void c({projectId:e,color:null}),"aria-label":ye(),children:`✕`}),at.map(t=>(0,Z.jsx)(`button`,{className:`oc-colorgrid__dot`+(n===t.value?` is-selected`:``),style:{background:t.hue},"aria-label":t.value,onClick:()=>void c({projectId:e,color:t.value})},t.value))]}),(0,Z.jsx)(Fe,{}),(0,Z.jsxs)(z,{variant:`destructive`,onSelect:()=>{requestAnimationFrame(async()=>{let n=x?.folders??0,r=x?.chats??0;await p({title:le({name:t}),description:n>0?Se({folders:n,chats:r}):r>0?_e({count:r}):ne(),confirmWord:N(),confirmLabel:be(),destructive:!0})&&await d({projectId:e})})},children:[(0,Z.jsx)(tt,{}),` `,N()]})]})]}),(0,Z.jsx)(Qe,{open:h,onOpenChange:g,title:pe(),canSubmit:_.trim().length>0,onSubmit:async()=>{await s({projectId:e,name:_.trim()}),g(!1)},submitLabel:M(),children:(0,Z.jsx)(W,{value:_,onChange:e=>ee(e.target.value),autoFocus:!0})}),v?(0,Z.jsx)(ot,{open:v,onOpenChange:y,title:u(),movingFolderId:e,currentId:r,onPick:t=>void l({projectId:e,parentId:t})}):null]})}function gt({chat:e,currentFolderId:t,className:n}){let a=S(j.chats.pinChat),o=S(j.chats.deleteChat),s=S(j.chats.renameChat),c=S(j.chats.setChatSidebar),l=S(j.chats.moveChatToProject),u=Ye(),[d,f]=(0,X.useState)(!1),[p,m]=(0,X.useState)(e.title??``),[h,g]=(0,X.useState)(!1);return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(Be,{children:[(0,Z.jsx)(ht,{className:n}),(0,Z.jsxs)(He,{align:`end`,className:`w-52`,onClick:e=>e.stopPropagation(),children:[(0,Z.jsxs)(z,{onSelect:()=>{m(e.title??``),f(!0)},children:[(0,Z.jsx)($e,{}),` `,M()]}),(0,Z.jsxs)(z,{onSelect:()=>void a({chatId:e._id,pinned:!e.pinned}),children:[e.pinned?(0,Z.jsx)(ct,{}):(0,Z.jsx)(J,{}),e.pinned?ce():T()]}),(0,Z.jsxs)(z,{onSelect:()=>g(!0),children:[(0,Z.jsx)(pt,{}),` `,i()]}),e.pinned&&e.inSidebar?null:(0,Z.jsxs)(z,{onSelect:()=>void c({chatId:e._id,hidden:e.inSidebar}),children:[e.inSidebar?(0,Z.jsx)(Ke,{}):(0,Z.jsx)(Y,{}),e.inSidebar?r():w()]}),(0,Z.jsx)(Fe,{}),(0,Z.jsxs)(z,{variant:`destructive`,onSelect:()=>{requestAnimationFrame(async()=>{await u({title:xe(),description:ne(),confirmLabel:N(),destructive:!0})&&await o({chatId:e._id})})},children:[(0,Z.jsx)(tt,{}),` `,N()]})]})]}),(0,Z.jsx)(Qe,{open:d,onOpenChange:f,title:fe(),canSubmit:p.trim().length>0,onSubmit:async()=>{await s({chatId:e._id,title:p.trim()}),f(!1)},submitLabel:M(),children:(0,Z.jsx)(W,{value:p,onChange:e=>m(e.target.value),autoFocus:!0})}),h?(0,Z.jsx)(ot,{open:h,onOpenChange:g,title:y(),currentId:t,onPick:t=>void l({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}=st({from:`/project/$projectId`}),t=L(),n=o(j.projects.projectPage,{projectId:e});return(0,Z.jsx)(`div`,{className:`oc-projpage`,children:n===void 0?(0,Z.jsx)(`p`,{className:`oc-projpage__hint`,children:D()}):n===null?(0,Z.jsxs)(`div`,{className:`oc-projpage__notfound`,children:[(0,Z.jsx)(`h2`,{children:d()}),(0,Z.jsx)(`p`,{className:`oc-projpage__hint`,children:te()}),(0,Z.jsx)(F,{variant:`outline`,onClick:()=>void t({to:`/`}),children:v()})]}):(0,Z.jsx)(Et,{page:n})})}function Et({page:e}){let t=L(),n=Ye(),r=Xe(),i=je(),a=S(j.projects.renameProject),l=S(j.projects.setProjectColor),d=S(j.projects.deleteProject),f=S(j.projects.createProject),g=S(j.projects.moveProject),v=S(j.projects.setProjectSidebar),y=S(j.chats.moveChatToProject),te=S(j.chats.reorderChat),ie=S(j.projects.reorderProject),ce=o(j.projects.projectTreeCount,{projectId:e.project._id}),[C,fe]=(0,X.useState)(xt),w=e=>{localStorage.setItem(bt,e),fe(e)},T=o(j.projects.folderColumns,C===`columns`?{projectId:e.project._id}:`skip`),D=o(j.projects.projectTreeList,C===`list`?{projectId:e.project._id}:`skip`),{c:O}=Le({from:`/project/$projectId`}),k=o(j.projects.listProjects,{}),xe=o(j.chatReads.myBusyChats,{}),P=(0,X.useMemo)(()=>new Set(xe??[]),[xe]),ke=o(j.chatReads.myChatReads,{}),Pe=(0,X.useMemo)(()=>yt(e.chats,ke??[]),[e.chats,ke]),{startNewChat:R,picker:Ke}=et(e=>void t({to:`/chat/$chatId`,params:{chatId:e}})),[B,nt]=(0,X.useState)(``),[V,H]=(0,X.useState)(!1),[U,st]=(0,X.useState)(e.project.name),[ct,J]=(0,X.useState)(!1),[Y,ht]=(0,X.useState)(``);(0,X.useEffect)(()=>{let e=setTimeout(()=>ht(B.trim()),180);return()=>clearTimeout(e)},[B]);let Q=o(j.search.searchConversations,Y.length>=2?{query:Y,projectId:e.project._id}:`skip`),gt=De(it(lt,{activationConstraint:{distance:4}}),it(qe,{activationConstraint:{delay:250,tolerance:8}})),$=(0,X.useRef)(!1),St=()=>{$.current=!0,setTimeout(()=>{$.current=!1},0)},[Ct,Tt]=(0,X.useState)(null),Et=t=>{if(t.startsWith(`chat:`)){let n=t.slice(5),r=e.chats.find(e=>e._id===n),i=T?.columns.flatMap(e=>e.chats).find(e=>e._id===n);return{kind:`chat`,label:(r??i)?.title||E()}}if(t.startsWith(`folder:`)){let e=t.slice(7);return{kind:`folder`,label:(k??[]).find(t=>t._id===e)?.name??``}}return null},kt=e=>Tt(Et(String(e.active.id))),jt=(0,X.useCallback)(e=>{let t=String(e.active.id).startsWith(`folder:`),n=t=>({...e,droppableContainers:e.droppableContainers.filter(e=>String(e.id).startsWith(t))}),r=I(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=I(n(t?`folder:`:`chat:`));if(i.length>0)return i;let a=I(n(`crumb:`));if(a.length>0)return a;let o=I(n(`col:`));return o.length>0?o:Me(n(t?`folder:`:`chat:`))},[]),Nt=t=>{if(C===`columns`){for(let e of T?.columns??[])if(e.chats.some(e=>e._id===t))return{list:e.chats,folderId:e.folderId};return null}if(C===`list`){let e=D?.chats.find(e=>e._id===t);return e?{list:D.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(C===`columns`){for(let e of T?.columns??[])if(e.folders.some(e=>e._id===t))return{list:e.folders,parentId:e.folderId};return null}if(C===`list`){let e=D?.folders.find(e=>e._id===t);if(!e||!D)return null;let n=e.parentId??D.rootId;return{list:Ze(D.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),a=String(t.id),o=a.startsWith(`chat:`);try{let e=wt(r);if(e!==void 0){if(o)await y({chatId:a.slice(5),projectId:e});else{let t=a.slice(7);if(t===e)return;if(!Ie(k??[],t,e)){i.error(h());return}await g({projectId:t,parentId:e})}return}if(o&&r.startsWith(`chat:`)){let e=a.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 y({chatId:e,projectId:n.folderId});let i=vt(n.list,e=>e._id,e=>e.sortKey,e,t);i&&await te({chatId:e,...i});return}if(!o&&r.startsWith(`folder:`)){let e=a.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(!Ie(k??[],e,n.parentId)){i.error(h());return}await g({projectId:e,parentId:n.parentId})}let o=vt(n.list,e=>e._id,e=>e.sortKey,e,t);o&&await ie({projectId:e,...o});return}}catch{i.error(h())}},[,Lt]=(0,X.useState)(0);(0,X.useEffect)(()=>{let e=window.setInterval(()=>Lt(e=>e+1),6e4);return()=>window.clearInterval(e)},[]);let Rt=Date.now(),zt=rt(e.project),Bt=_t(e.chats,B),Vt=e.breadcrumb.slice(0,-1),Ht=e=>()=>{$.current||e()};return(0,Z.jsxs)(Ge,{sensors:gt,collisionDetection:jt,onDragStart:kt,onDragEnd:It,children:[(0,Z.jsxs)(`div`,{className:`oc-projpage__body`,style:{"--proj-hue":zt},children:[(0,Z.jsxs)(`nav`,{className:`oc-projpage__crumbs`,"aria-label":ee(),children:[Vt.map(e=>(0,Z.jsxs)(`span`,{className:`oc-projpage__crumb`,children:[(0,Z.jsx)(Dt,{folderId:e._id,children:(0,Z.jsx)(`button`,{type:`button`,className:`oc-projpage__crumblink`,onClick:Ht(()=>void t({to:`/project/$projectId`,params:{projectId:e._id}})),children:e.name})}),(0,Z.jsx)(`span`,{className:`oc-projpage__crumbsep`,"aria-hidden":!0,children:`›`})]},e._id)),(0,Z.jsx)(`span`,{className:`oc-projpage__crumbcur`,children:e.project.name})]}),(0,Z.jsxs)(`header`,{className:`oc-projpage__head`,children:[(0,Z.jsx)(`span`,{className:`oc-projpage__dot`,"aria-hidden":!0}),(0,Z.jsx)(`h1`,{className:`oc-projpage__title`,children:e.project.name}),e.project.sidebarHidden?(0,Z.jsxs)(F,{variant:`ghost`,size:`sm`,className:`oc-projpage__hiddenbadge`,title:me(),onClick:()=>{v({projectId:e.project._id,hidden:!1})},children:[(0,Z.jsx)(Ve,{"aria-hidden":!0}),(0,Z.jsx)(`span`,{children:de()}),(0,Z.jsx)(ze,{"aria-hidden":!0})]}):null,(0,Z.jsxs)(`div`,{className:`oc-projpage__actions`,children:[(0,Z.jsxs)(`div`,{className:`oc-projpage__viewtoggle`,role:`group`,"aria-label":b(),children:[(0,Z.jsx)(F,{variant:C===`cards`?`secondary`:`ghost`,size:`icon-sm`,"aria-label":b(),title:b(),"aria-pressed":C===`cards`,onClick:()=>w(`cards`),children:(0,Z.jsx)(mt,{})}),(0,Z.jsx)(F,{variant:C===`columns`?`secondary`:`ghost`,size:`icon-sm`,"aria-label":se(),title:se(),"aria-pressed":C===`columns`,onClick:()=>w(`columns`),children:(0,Z.jsx)(ft,{})}),(0,Z.jsx)(F,{variant:C===`list`?`secondary`:`ghost`,size:`icon-sm`,"aria-label":oe(),title:oe(),"aria-pressed":C===`list`,onClick:()=>w(`list`),children:(0,Z.jsx)(Ee,{})})]}),(0,Z.jsxs)(F,{variant:`outline`,size:`sm`,onClick:()=>void R({projectId:e.project._id}),children:[(0,Z.jsx)(Je,{}),p()]}),(0,Z.jsxs)(F,{variant:`outline`,size:`sm`,onClick:async()=>{let t=await r({title:A(),label:Ce(),placeholder:ue(),confirmLabel:we()});t&&await f({name:t,parentId:e.project._id})},children:[(0,Z.jsx)(Oe,{}),A()]}),(0,Z.jsxs)(Be,{children:[(0,Z.jsx)(Re,{asChild:!0,children:(0,Z.jsx)(F,{variant:`ghost`,size:`icon-sm`,"aria-label":he(),children:(0,Z.jsx)(We,{})})}),(0,Z.jsxs)(He,{align:`end`,className:`w-48`,children:[(0,Z.jsxs)(z,{onSelect:()=>{st(e.project.name),H(!0)},children:[(0,Z.jsx)($e,{}),` `,M()]}),(0,Z.jsxs)(z,{onSelect:()=>J(!0),children:[(0,Z.jsx)(pt,{}),` `,ve()]}),(0,Z.jsx)(Ne,{children:ge()}),(0,Z.jsxs)(`div`,{className:`oc-colorgrid`,children:[(0,Z.jsx)(`button`,{className:`oc-colorgrid__none`,onClick:()=>void l({projectId:e.project._id,color:null}),"aria-label":ye(),children:`✕`}),at.map(t=>(0,Z.jsx)(`button`,{className:`oc-colorgrid__dot`+(e.project.color===t.value?` is-selected`:``),style:{background:t.hue},"aria-label":t.value,onClick:()=>void l({projectId:e.project._id,color:t.value})},t.value))]}),(0,Z.jsx)(Fe,{}),(0,Z.jsxs)(z,{variant:`destructive`,onSelect:()=>{let r=e.project.parentId;requestAnimationFrame(async()=>{let i=ce?.folders??0,a=ce?.chats??0;await n({title:le({name:e.project.name}),description:i>0?Se({folders:i,chats:a}):a>0?_e({count:a}):ne(),confirmWord:N(),confirmLabel:be(),destructive:!0})&&(await d({projectId:e.project._id}),t(r===null?{to:`/`}:{to:`/project/$projectId`,params:{projectId:r}}))})},children:[(0,Z.jsx)(tt,{}),` `,N()]})]})]})]})]}),C===`columns`?(0,Z.jsx)(Ft,{data:T,currentId:e.project._id,busyIds:P,suppressClick:$,locateChatId:O??null}):C===`list`?(0,Z.jsx)(Mt,{data:D,busyIds:P,suppressClick:$,locateChatId:O??null}):(0,Z.jsxs)(Z.Fragment,{children:[e.children.length>0?(0,Z.jsxs)(`section`,{className:`oc-projpage__section`,children:[(0,Z.jsx)(`h2`,{className:`oc-projpage__subtitle`,children:ae()}),(0,Z.jsx)(`div`,{className:`oc-projpage__cards`,children:(0,Z.jsx)(K,{items:e.children.map(e=>`folder:${e._id}`),strategy:dt,children:e.children.map(t=>(0,Z.jsx)(Ot,{child:t,parentId:e.project._id,now:Rt,suppressClick:$},t._id))})})]}):null,(0,Z.jsxs)(`section`,{className:`oc-projpage__section`,children:[(0,Z.jsxs)(`div`,{className:`oc-projpage__convhead`,children:[(0,Z.jsx)(`h2`,{className:`oc-projpage__subtitle`,children:re()}),e.chats.length>0?(0,Z.jsx)(W,{value:B,onChange:e=>nt(e.target.value),placeholder:Te(),className:`oc-projpage__filter`}):null]}),e.chats.length===0?(0,Z.jsx)(`p`,{className:`oc-projpage__hint`,children:e.children.length===0?_():m()}):Bt.length===0&&(Q??[]).length===0?(0,Z.jsx)(`p`,{className:`oc-projpage__hint`,children:x({term:B.trim()})}):(0,Z.jsx)(`ul`,{className:`oc-projpage__chats`,children:(0,Z.jsx)(K,{items:Bt.map(e=>`chat:${e._id}`),strategy:q,children:Bt.map(t=>(0,Z.jsx)(At,{chat:t,currentFolderId:e.project._id,now:Rt,busy:P.has(t._id),unread:Pe.has(t._id),locate:t._id===O,suppressClick:$},t._id))})})]}),Y.length>=2&&Q!==void 0?(0,Z.jsxs)(`section`,{className:`oc-projpage__section`,children:[(0,Z.jsx)(`h2`,{className:`oc-projpage__subtitle`,children:c()}),Q.length===0?(0,Z.jsx)(`p`,{className:`oc-projpage__hint`,children:x({term:Y})}):(0,Z.jsx)(`ul`,{className:`oc-projpage__chats`,children:Q.map(e=>(0,Z.jsx)(`li`,{className:`oc-projpage__chatrow`,children:(0,Z.jsxs)(`button`,{type:`button`,className:`oc-projpage__chatbtn`,onClick:()=>{e.messageId&&Y&&Ue(e.messageId,Y),t({to:`/chat/$chatId`,params:{chatId:e.chatId},...e.messageId?{search:{m:e.messageId}}:{}})},children:[(0,Z.jsx)(ut,{size:13,"aria-hidden":!0,className:`oc-projpage__hitico`}),(0,Z.jsxs)(`span`,{className:`oc-projpage__hitbody`,children:[(0,Z.jsx)(`span`,{className:`oc-projpage__chattitle`,children:e.title||s()}),e.projectPath&&e.projectPath.length>1?(0,Z.jsx)(`span`,{className:`oc-projpage__hitpath`,children:e.projectPath.join(` › `)}):null,e.snippet?(0,Z.jsx)(`span`,{className:`oc-projpage__hitsnippet`,children:e.snippet}):null]})]})},`${e.chatId}:${e.messageId??`t`}`))})]}):null]}),(0,Z.jsx)(Qe,{open:V,onOpenChange:H,title:pe(),canSubmit:U.trim().length>0,onSubmit:async()=>{await a({projectId:e.project._id,name:U.trim()}),H(!1)},submitLabel:M(),children:(0,Z.jsx)(W,{value:U,onChange:e=>st(e.target.value),autoFocus:!0})}),ct?(0,Z.jsx)(ot,{open:ct,onOpenChange:J,title:u(),movingFolderId:e.project._id,currentId:e.project.parentId,onPick:t=>void g({projectId:e.project._id,parentId:t})}):null,Ke]}),(0,Z.jsx)(Ae,{children:Ct?(0,Z.jsxs)(`div`,{className:`oc-projpage__dragghost`,children:[Ct.kind===`folder`?(0,Z.jsx)(G,{size:13,"aria-hidden":!0}):(0,Z.jsx)(ut,{size:13,"aria-hidden":!0}),(0,Z.jsx)(`span`,{children:Ct.label})]}):null})]})}function Dt({folderId:e,children:t}){let{setNodeRef:n,isOver:r}=R({id:Ct(e)});return(0,Z.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=L(),o=B({id:`folder:${e._id}`}),s=R({id:$(e._id)});return(0,Z.jsxs)(`div`,{ref:e=>{o.setNodeRef(e),s.setNodeRef(e)},className:`oc-projpage__card`+(s.isOver?` is-over`:``)+(o.isDragging?` is-dragging`:``),style:{"--proj-hue":rt(e),transform:H.Transform.toString(o.transform),transition:o.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}})},...o.listeners,...o.attributes,role:`link`,tabIndex:0,children:[(0,Z.jsxs)(`span`,{className:`oc-projpage__cardhead`,children:[(0,Z.jsx)(G,{size:15,"aria-hidden":!0,className:`oc-projpage__cardico`}),(0,Z.jsx)(`span`,{className:`oc-projpage__cardname`,children:e.name}),(0,Z.jsx)(Q,{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,Z.jsxs)(`span`,{className:`oc-projpage__cardmeta`,children:[e.folderCount>0?ie({count:e.folderCount})+` · `:``,a({count:e.recursiveChatCount})]}),e.lastActivityAt===null?null:(0,Z.jsx)(`span`,{className:`oc-projpage__cardage`,children:nt(e.lastActivityAt,n)})]})}function kt({chat:e}){let t=S(j.chats.setChatSidebar),n=e.inSidebar?r():w();return(0,Z.jsx)(F,{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,Z.jsx)(Ke,{}):(0,Z.jsx)(Y,{})})}function At({chat:e,currentFolderId:t,now:n,busy:r,unread:i,locate:a,suppressClick:o}){let s=L(),c=V(e.color),l=B({id:`chat:${e._id}`}),u=jt(a);return(0,Z.jsxs)(`li`,{ref:e=>{l.setNodeRef(e),u.current=e},className:`oc-projpage__chatrow`+(l.isDragging?` is-dragging`:``)+(a?` is-locate`:``),style:{transform:H.Transform.toString(l.transform),transition:l.transition},children:[(0,Z.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,Z.jsx)(`span`,{className:`oc-chatitem__dot`,style:{background:c}}):(0,Z.jsx)(`span`,{className:`oc-chatitem__dot oc-chatitem__dot--empty`}),(0,Z.jsx)(`span`,{className:`oc-projpage__chattitle`,children:e.title||E()}),e.pinned?(0,Z.jsx)(J,{size:12,"aria-hidden":!0,className:`oc-projpage__chatpin`}):null,(0,Z.jsx)(`span`,{className:`oc-projpage__chatage`,children:nt(e.updatedAt,n)}),r?(0,Z.jsx)(`span`,{className:`oc-chatitem__busy`,title:O(),"aria-label":O()}):null,i&&!r?(0,Z.jsx)(`span`,{className:`oc-chatitem__unread`,title:C(),"aria-label":C()}):null]}),(0,Z.jsx)(kt,{chat:e}),(0,Z.jsx)(gt,{chat:e,currentFolderId:t,className:`oc-projpage__chatmenu`})]})}function jt(e){let t=(0,X.useRef)(null);return(0,X.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,X.useState)(new Set),o=(0,X.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,Z.jsx)(`p`,{className:`oc-projpage__hint`,children:D()});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=Ze(e.folders,a);return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(K,{items:u.map(e=>`chat:${e._id}`),strategy:q,children:u.map(e=>(0,Z.jsx)(Pt,{chat:e,depth:l,busy:t.has(e._id),locate:e._id===r,suppressClick:n},e._id))}),(0,Z.jsx)(K,{items:d.map(e=>`folder:${e._id}`),strategy:q,children:d.map(t=>(0,Z.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,Z.jsx)(`div`,{className:`oc-projpage__tree`,children:(o.get(e.rootId)??[]).length===0&&Ze(e.folders,null).length===0?(0,Z.jsx)(`p`,{className:`oc-projpage__hint`,children:_()}):c(null,0)})}function Nt({folder:e,parentId:t,depth:n,folded:r,onToggle:i,suppressClick:a,children:o}){let s=L(),c=B({id:`folder:${e._id}`}),l=R({id:$(e._id)});return(0,Z.jsxs)(`div`,{className:`oc-projpage__treegroup`,children:[(0,Z.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":rt(e),transform:H.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,Z.jsx)(`button`,{type:`button`,className:`oc-projpage__treechev`,"aria-label":r?g():f(),"aria-expanded":!r,onClick:e=>{e.stopPropagation(),!a.current&&i()},onMouseDown:e=>e.stopPropagation(),onTouchStart:e=>e.stopPropagation(),children:r?(0,Z.jsx)(ke,{size:13}):(0,Z.jsx)(Pe,{size:13})}),(0,Z.jsx)(G,{size:13,"aria-hidden":!0,className:`oc-projpage__colico`}),(0,Z.jsx)(`span`,{className:`oc-projpage__colname`,children:e.name}),(0,Z.jsx)(Q,{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=L(),o=B({id:`chat:${e._id}`}),s=jt(r),c=V(e.color);return(0,Z.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:H.Transform.toString(o.transform),transition:o.transition},children:[(0,Z.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,Z.jsx)(`span`,{className:`oc-chatitem__dot`,style:{background:c}}):(0,Z.jsx)(`span`,{className:`oc-chatitem__dot oc-chatitem__dot--empty`}),(0,Z.jsx)(`span`,{className:`oc-projpage__colname`,children:e.title||E()}),n?(0,Z.jsx)(`span`,{className:`oc-chatitem__busy`,"aria-hidden":!0}):null]}),(0,Z.jsx)(gt,{chat:e,currentFolderId:e.folderId,className:`oc-projpage__treemenu`}),(0,Z.jsx)(kt,{chat:e})]})}function Ft({data:e,currentId:t,busyIds:n,suppressClick:r,locateChatId:i}){let a=(0,X.useRef)(null);return(0,X.useEffect)(()=>{let e=a.current;e&&(e.scrollLeft=e.scrollWidth)},[e?.columns.length??0,t]),e===void 0?(0,Z.jsx)(`p`,{className:`oc-projpage__hint`,children:D()}):(0,Z.jsx)(`div`,{className:`oc-projpage__cols`,ref:a,children:e.columns.map((a,o)=>(0,Z.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=L(),s=R({id:St(e.folderId)});return(0,Z.jsxs)(`div`,{ref:s.setNodeRef,className:`oc-projpage__col`+(s.isOver?` is-over`:``)+(t?` is-last`:``),children:[(0,Z.jsx)(K,{items:e.folders.map(e=>`folder:${e._id}`),strategy:q,children:e.folders.map(t=>(0,Z.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,Z.jsx)(K,{items:e.chats.map(e=>`chat:${e._id}`),strategy:q,children:e.chats.map(t=>(0,Z.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,Z.jsx)(`p`,{className:`oc-projpage__colempty`,children:m()}):null]})}function Lt({folder:e,parentId:t,isCurrent:n,suppressClick:r,onOpen:i}){let a=B({id:`folder:${e._id}`}),o=R({id:$(e._id)});return(0,Z.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":rt(e),transform:H.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,Z.jsx)(G,{size:13,"aria-hidden":!0,className:`oc-projpage__colico`}),(0,Z.jsx)(`span`,{className:`oc-projpage__colname`,children:e.name}),(0,Z.jsx)(`span`,{className:`oc-projpage__colchev`,"aria-hidden":!0,children:`›`}),(0,Z.jsx)(Q,{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=B({id:`chat:${e._id}`}),s=jt(r),c=V(e.color);return(0,Z.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:H.Transform.toString(o.transform),transition:o.transition},children:[(0,Z.jsxs)(`button`,{type:`button`,className:`oc-projpage__colchatbtn`,onClick:()=>{i.current||a()},...o.listeners,...o.attributes,children:[c?(0,Z.jsx)(`span`,{className:`oc-chatitem__dot`,style:{background:c}}):(0,Z.jsx)(`span`,{className:`oc-chatitem__dot oc-chatitem__dot--empty`}),(0,Z.jsx)(`span`,{className:`oc-projpage__colname`,children:e.title||E()}),n?(0,Z.jsx)(`span`,{className:`oc-chatitem__busy`,"aria-hidden":!0}):null]}),(0,Z.jsx)(gt,{chat:e,currentFolderId:t,className:`oc-projpage__colmenu oc-projpage__colmenu--chat`}),(0,Z.jsx)(kt,{chat:e})]})}export{Tt as ProjectPage};
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Ao as r,Ax as i,CB as a,Cx as o,Dx as s,Ex as c,Hi as l,Oo as u,Ox as d,Rx as f,SB as p,Sx as m,Tx as h,Ui as g,Vi as _,_c as v,_o as y,_x as b,bc as x,bo as ee,bx as S,ct as te,fx as C,gx as w,hx as T,jo as ne,jx as re,ko as ie,kx as ae,mx as oe,px as se,t as E,vc as D,vo as O,vx as k,wx as A,xc as j,xo as M,xx as N,yc as P,yo as F,yx as I,zx as L}from"./api-B9t7A61E.js";import{i as R,n as z,r as B,t as V}from"./FieldLabel-CK8GT8Ed.js";import{t as H}from"./button-0XSqjZXP.js";import{$ as U,Dt as W,Q as G,Qt as ce,X as K,Xt as le,Yt as q,Z as J,Zt as ue,et as Y,q as de,ut as fe}from"./index-CqHFDZOR.js";import{r as X,t as Z}from"./locales-CPjguROj.js";import{t as pe}from"./localePickerView-C2RmOS86.js";/* empty css */var Q=t(e(),1),$=n(),me={media_delivery:{label:c,help:h},documentary_fetch:{label:A,help:o},inbound_files:{label:m,help:N},history_summary:{label:j,help:x},file_curation:{label:ne,help:M},quote_reply:{label:r,help:ie}},he={outboundDir:`/home/node/.openclaw/media/outbound`,references:`- gdrive/1a2b3c4d5e6f7890abcd
|
|
2
|
-
- gdrive/0f9e8d7c6b5a4321dcba`,files:`- /home/node/.openclaw/media/inbound/rapport.pdf (124800 o, application/pdf)`,previous_summary:`Projet Alpha : budget 40 000 EUR ; choix du serveur en cours.`,new_messages:`Utilisateur : Compare OVH et Scaleway.
|
|
3
|
-
Assistant : Comparaison en cours.`,max_chars:`6000`,file_name:`MEMORY.md`,budget_chars:`20000`,feedback:`Trop de suppressions dans la section des liens, garde-les.`,content:`# Memory index
|
|
4
|
-
- [Fait 1](fait-1.md) - note du projet`,excerpt:`Le classement propose trois dossiers : Clients, Fournisseurs, Interne.`},ge={outboundDir:oe,references:se,files:C,previous_summary:P,new_messages:D,max_chars:v,file_name:ee,budget_chars:F,feedback:O,content:y,excerpt:u};function _e(){let e=a(E.admin.listInstances,{}),[t,n]=(0,Q.useState)(null);if(e===void 0)return(0,$.jsx)(`div`,{className:`oc-settings__tab-loading`,"aria-busy":`true`});if(e.length===0)return(0,$.jsx)(`div`,{className:`oc-injtab`,children:(0,$.jsx)(`p`,{className:`oc-admin__hint`,children:I()})});let r=e.find(e=>e._id===t)??e[0];return(0,$.jsxs)(`div`,{className:`oc-injtab`,children:[(0,$.jsxs)(`div`,{className:`oc-injtab__head`,children:[(0,$.jsx)(z,{label:re(),help:i()}),(0,$.jsxs)(`label`,{className:`oc-injtab__picker`,children:[(0,$.jsx)(`span`,{children:S()}),(0,$.jsxs)(K,{value:r._id,onValueChange:e=>n(e),children:[(0,$.jsx)(U,{size:`sm`,className:`min-w-44`,children:(0,$.jsx)(Y,{})}),(0,$.jsx)(J,{children:e.map(e=>(0,$.jsx)(G,{value:e._id,children:e.displayName??e.name},e._id))})]})]})]}),(0,$.jsx)(ve,{instance:r},r._id)]})}function ve({instance:e}){let t=p(E.admin.upsertInstanceConfig),n=W(),r=a(E.me.getMe,{host:de}),i=e.config??{},o=X(e.config?.contentLocale,r?.defaultLocale??void 0),[s,c]=(0,Q.useState)(()=>R(i,o));(0,Q.useEffect)(()=>{c(R(i,o))},[o,e._id]);let[u,d]=(0,Q.useState)(!1),m=s.promptInjections,h=(e,t)=>c({...s,promptInjections:{...m,[e]:{...m[e],...t}}});async function v(){d(!0);try{await t({instanceId:e._id,config:B(s,i,o)})}catch(e){n.error(f(),e)}finally{d(!1)}}async function y(r){let i={...e.config??{}};r==="default"?delete i.contentLocale:i.contentLocale=r;try{await t({instanceId:e._id,config:i})}catch(e){n.error(f(),e)}}let b=e.config?.contentLocale??`default`,x=Z[X(void 0,r?.defaultLocale??void 0)];return(0,$.jsxs)(`div`,{className:`oc-injtab__body`,children:[(0,$.jsxs)(`div`,{className:`oc-injtab__content-locale`,children:[(0,$.jsx)(`span`,{children:g()}),(0,$.jsxs)(K,{value:b,onValueChange:e=>void y(e),children:[(0,$.jsx)(U,{size:`sm`,className:`min-w-44`,children:(0,$.jsx)(Y,{})}),(0,$.jsxs)(J,{children:[(0,$.jsx)(G,{value:`default`,children:_({locale:x})}),pe().map(e=>(0,$.jsx)(G,{value:e.value,children:e.label},e.value))]})]}),(0,$.jsx)(`p`,{className:`oc-admin__hint`,children:l()})]}),le.map(e=>(0,$.jsx)(ye,{injKey:e,def:q[e],i18n:me[e],row:m[e]??{enabled:!0,template:q[e].defaultTemplate[o]},contentLocale:o,onChange:t=>h(e,t)},e)),(0,$.jsx)(`div`,{className:`oc-injtab__actions`,children:(0,$.jsx)(H,{size:`sm`,onClick:()=>void v(),disabled:u,children:L()})})]})}function ye({injKey:e,def:t,i18n:n,row:r,contentLocale:i,onChange:a}){let[o,c]=(0,Q.useState)(!1),l=r.template.trim()!==t.defaultTemplate[i],u=t.togglable&&!r.enabled,f=Object.fromEntries(t.placeholders.map(e=>[e,he[e]??`{${e}}`])),p=ue(e,r,i),m=p?ce(p,f):``;return(0,$.jsxs)(`section`,{className:`oc-injcard`,children:[(0,$.jsxs)(`div`,{className:`oc-injcard__head`,children:[t.togglable?(0,$.jsxs)(`label`,{className:`oc-field--row`,children:[(0,$.jsx)(fe,{checked:r.enabled,onCheckedChange:e=>a({enabled:e===!0})}),(0,$.jsx)(z,{label:n.label(),help:n.help()})]}):(0,$.jsx)(z,{label:n.label(),help:n.help()}),l&&(0,$.jsx)(`span`,{className:`oc-injection__badge`,children:d()})]}),(0,$.jsx)(`textarea`,{className:`oc-injcard__text`,value:r.template,disabled:u,rows:8,spellCheck:!1,onChange:e=>a({template:e.target.value})}),(0,$.jsxs)(`div`,{className:`oc-injection__foot`,children:[(0,$.jsxs)(`div`,{className:`oc-injcard__phs`,children:[(0,$.jsx)(`span`,{className:`oc-injection__ph`,children:s()}),t.placeholders.map(e=>(0,$.jsxs)(`span`,{className:`oc-injcard__ph-chip`,children:[(0,$.jsx)(`code`,{children:`{${e}}`}),(0,$.jsx)(V,{text:(ge[e]??(()=>e))()})]},e))]}),(0,$.jsxs)(`div`,{className:`oc-injcard__btns`,children:[(0,$.jsx)(H,{variant:`ghost`,size:`sm`,onClick:()=>c(e=>!e),children:o?b():k()}),l&&(0,$.jsx)(H,{variant:`ghost`,size:`sm`,onClick:()=>a({template:t.defaultTemplate[i]}),children:ae()})]})]}),o&&(0,$.jsx)(`div`,{className:`oc-injcard__preview`,children:m?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`pre`,{className:`oc-injcard__previewtext`,children:m}),(0,$.jsx)(`span`,{className:`oc-injection__ph`,children:w()}),t.pluralDefaultTemplate!==void 0&&!u?(0,$.jsx)(`span`,{className:`oc-injection__ph`,children:te()}):null]}):(0,$.jsx)(`span`,{className:`oc-injection__ph`,children:T()})})]})}export{_e as PromptInjectionsTab};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{AT as r,CB as ee,CT as i,DT as a,ET as o,Gw as s,Hw as c,Jw as l,Kw as u,MT as d,OT as f,SB as p,ST as m,TT as h,Uw as te,Ww as g,Xw as _,Yw as v,_T as y,aT as ne,bT as b,cT as re,dT as ie,fT as ae,gT as oe,hT as x,iT as S,jT as C,kT as w,lT as T,mT as E,nT as D,oT as O,pT as k,qw as A,rT as j,sT as M,t as N,ts as P,uT as F,vT as I,wT as L,xT as R,yT as z}from"./api-B9t7A61E.js";import{t as B}from"./button-0XSqjZXP.js";import{Dt as V,En as H,Et as U,U as W,_ as G,jt as K,ut as q}from"./index-CqHFDZOR.js";import{t as J}from"./roleDescriptions-I0nZMu-C.js";var Y=t(e(),1),X=n(),Z=[{group:()=>d(),keys:[{key:`traces.read`,label:()=>a()},{key:`traces.read.content`,label:()=>o(),phi:!0},{key:`traces.write`,label:()=>h()}]},{group:()=>C(),keys:[{key:`kpi.read`,label:()=>a()},{key:`kpi.write`,label:()=>h()}]},{group:()=>r(),keys:[{key:`openclaw.query`,label:()=>L()},{key:`anomalies.read`,label:()=>i()},{key:`anomalies.report`,label:()=>m()}]},{group:()=>w(),keys:[{key:`chats.read`,label:()=>a()},{key:`selfheal`,label:()=>b()},{key:`media.repair`,label:()=>z()},{key:`feedback.respond`,label:()=>P()}]},{group:()=>f(),keys:[{key:`admin.manage`,label:()=>R()}]}],se=Z.flatMap(e=>e.keys.map(e=>e.key));function Q(e){return e.includes(`*`)}var $={key:``,name:``,description:``};function ce(){let e=ee(N.apiKeys.listRoles,{}),t=p(N.apiKeys.createRole),n=p(N.apiKeys.ensureRolesSeeded),r=p(N.apiKeys.updateRolePermissions).withOptimisticUpdate((e,{roleId:t,permissions:n})=>{let r=e.getQuery(N.apiKeys.listRoles,{});r&&e.setQuery(N.apiKeys.listRoles,{},r.map(e=>e._id===t?{...e,permissions:n}:e))}),i=W(),a=V(),[o,d]=(0,Y.useState)(!1),[f,m]=(0,Y.useState)($),[h,b]=(0,Y.useState)(new Set);(0,Y.useEffect)(()=>{n({}).catch(e=>{a.error(y(),e)})},[n,a]);let C=e??[];async function w(e,t){if(Q(e.permissions))return;if(e.builtin){await i({title:oe({name:e.name}),description:x(),confirmLabel:E()});return}if(h.has(e._id))return;let n=e.permissions.includes(t)?e.permissions.filter(e=>e!==t):[...e.permissions,t];b(t=>new Set(t).add(e._id));try{await r({roleId:e._id,permissions:n})}catch(e){a.error(k(),e)}finally{b(t=>{let n=new Set(t);return n.delete(e._id),n})}}async function P(){try{await t({key:f.key,name:f.name,description:f.description||void 0,permissions:[]}),m($),d(!1)}catch(e){a.error(ae(),e)}}let L=e===void 0,R=!L&&C.length===0;return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`p`,{className:`oc-admin__hint`,children:[ie(),` `,(0,X.jsx)(`code`,{children:`admin`}),` `,F(),` `,(0,X.jsx)(`code`,{children:`traces.read.content`}),` `,T()]}),(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:re()}),(0,X.jsx)(`div`,{className:`oc-dt__bar-actions`,children:(0,X.jsx)(B,{size:`sm`,onClick:()=>{m($),d(!0)},children:M()})})]}),L?(0,X.jsx)(`p`,{className:`oc-admin__hint`,children:O()}):R?(0,X.jsx)(`p`,{className:`oc-admin__hint`,children:ne()}):(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:S()}),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?I({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:C.map(e=>{let t=Q(e.permissions),n=h.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,{}),` `,j()]}):(0,X.jsx)(U,{variant:`secondary`,children:D()})]}),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?_():n?v():r,onCheckedChange:()=>void w(e,r)})},r))]},e.key)})})]})})]}),(0,X.jsx)(G,{open:o,onOpenChange:d,title:l(),description:A(),canSubmit:!!(f.key&&f.name),onSubmit:P,submitLabel:u(),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:s()}),(0,X.jsx)(K,{value:f.key,placeholder:g(),onChange:e=>m({...f,key:e.target.value})})]}),(0,X.jsxs)(`label`,{className:`oc-field`,children:[(0,X.jsx)(`span`,{className:`oc-field__label`,children:te()}),(0,X.jsx)(K,{value:f.name,onChange:e=>m({...f,name:e.target.value})})]}),(0,X.jsxs)(`label`,{className:`oc-field`,children:[(0,X.jsx)(`span`,{className:`oc-field__label`,children:c()}),(0,X.jsx)(K,{value:f.description,onChange:e=>m({...f,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{$I as r,$L as i,AL as a,BR as o,CB as s,D as c,DL as l,EL as u,FL as d,GI as ee,GL as f,GR as p,HR as m,IL as h,JL as te,JR as g,KL as ne,KR as re,LL as ie,LR as ae,ML as oe,NL as se,OL as ce,PL as le,QI as ue,QL as de,QR as fe,RL as _,RR as pe,TL as me,UR as he,VR as ge,WL as _e,WR as ve,XL as ye,XR as be,YL as xe,YR as Se,ZI as Ce,ZL as we,ZR as Te,_R as Ee,aL as De,aR as Oe,bB as v,cL as ke,cR as Ae,dL as je,dR as Me,eL as Ne,fL as Pe,fR as y,gB as b,gR as Fe,hR as Ie,iL as Le,iR as Re,jL as ze,kL as x,lL as Be,lR as Ve,mB as He,mL as Ue,mR as We,nL as Ge,oL as Ke,oR as qe,pL as Je,qL as Ye,qR as Xe,rL as Ze,sL as Qe,sR as $e,t as S,tL as et,tR as tt,uL as nt,uR as rt,vR as it,wL as at,yR as ot,zL as st,zR as ct}from"./api-B9t7A61E.js";import{t as lt}from"./list-CyLAzYcK.js";import{t as C}from"./button-0XSqjZXP.js";import{$ as w,Bn as T,Bt as E,Ct as ut,Dn as dt,Dt as ft,Et as D,Q as O,Rt as k,St as pt,Tt as mt,Vn as A,X as j,Z as M,_n as ht,_t as gt,at as _t,bn as vt,bt as yt,dn as bt,et as N,gt as xt,hn as St,it as Ct,jt as wt,nt as Tt,on as Et,ot as Dt,q as Ot,rt as kt,tt as At,vt as jt,wt as Mt,xn as Nt,xt as Pt,yt as Ft,zt as P}from"./index-CqHFDZOR.js";import{a as It,i as F,n as Lt,o as Rt,r as I,t as zt}from"./table-CmKoxbAD.js";import{t as Bt}from"./FilterBar-9-13ggzv.js";/* empty css */import{a as Vt,c as L,i as R,l as Ht,n as Ut,o as z,r as Wt,s as Gt,t as Kt,u as B}from"./TimezoneCombobox-BuMVLp5O.js";var qt=c(`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`}]]),Jt=c(`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`}]]),V=t(e(),1),H=n();function U(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 Yt({value:e,onChange:t}){let n=Ht(e),r=(0,V.useMemo)(()=>new Date,[]),[i,a]=(0,V.useState)(()=>({year:n?.year??r.getFullYear(),month:n?.month??r.getMonth()})),[o,s]=(0,V.useState)(!1),c=(0,V.useMemo)(()=>U(b()),[]),l=(0,V.useMemo)(()=>new Intl.DateTimeFormat(b(),{month:`long`,year:`numeric`}),[]),u=(0,V.useMemo)(()=>new Intl.DateTimeFormat(b(),{dateStyle:`medium`,timeStyle:`short`}),[]),ee=L(i.year,i.month),f=n?.hour??9,p=n?.minute??0,m=(e,n,r,i,a)=>t(B(e,n,r,i,a)),te=(e,t,n)=>{a({year:e,month:t}),m(e,t,n,f,p)},g=e=>{let t=new Date(i.year,i.month+e,1);a({year:t.getFullYear(),month:t.getMonth()})},ne=n===null?_():u.format(new Date(n.year,n.month,n.day,n.hour,n.minute));return(0,H.jsxs)(k,{modal:!0,open:o,onOpenChange:s,children:[(0,H.jsx)(E,{asChild:!0,children:(0,H.jsxs)(`button`,{type:`button`,className:`oc-dtp__trigger`,"aria-label":st(),children:[(0,H.jsx)(qt,{size:14,"aria-hidden":!0,className:`oc-dtp__icon`}),(0,H.jsx)(`span`,{className:n===null?`oc-dtp__placeholder`:void 0,children:ne})]})}),(0,H.jsxs)(P,{align:`start`,className:`oc-dtp__pop`,children:[(0,H.jsxs)(`div`,{className:`oc-dtp__head`,children:[(0,H.jsx)(`button`,{type:`button`,className:`oc-dtp__nav`,"aria-label":ie(),onClick:()=>g(-1),children:(0,H.jsx)(A,{size:15,"aria-hidden":!0})}),(0,H.jsx)(`span`,{className:`oc-dtp__month`,children:l.format(new Date(i.year,i.month,1))}),(0,H.jsx)(`button`,{type:`button`,className:`oc-dtp__nav`,"aria-label":h(),onClick:()=>g(1),children:(0,H.jsx)(T,{size:15,"aria-hidden":!0})})]}),(0,H.jsxs)(`div`,{className:`oc-dtp__grid`,children:[c.map((e,t)=>(0,H.jsx)(`span`,{className:`oc-dtp__wd`,children:e},t)),ee.map((e,t)=>{let i=n!==null&&n.year===e.year&&n.month===e.month&&n.day===e.day,a=r.getFullYear()===e.year&&r.getMonth()===e.month&&r.getDate()===e.day;return(0,H.jsx)(`button`,{type:`button`,className:`oc-dtp__day`+(e.inMonth?``:` oc-dtp__day--out`)+(i?` oc-dtp__day--sel`:``)+(a&&!i?` oc-dtp__day--today`:``),onClick:()=>te(e.year,e.month,e.day),children:e.day},t)})]}),(0,H.jsxs)(`div`,{className:`oc-dtp__time`,children:[(0,H.jsxs)(j,{value:String(f),onValueChange:e=>m(i.year,i.month,n?.day??r.getDate(),Number(e),p),children:[(0,H.jsx)(w,{size:`sm`,"aria-label":d(),children:(0,H.jsx)(N,{})}),(0,H.jsx)(M,{className:`oc-dtp__timeopts`,children:Array.from({length:24},(e,t)=>(0,H.jsx)(O,{value:String(t),children:String(t).padStart(2,`0`)},t))})]}),(0,H.jsx)(`span`,{className:`oc-dtp__colon`,children:`:`}),(0,H.jsxs)(j,{value:String(p),onValueChange:e=>m(i.year,i.month,n?.day??r.getDate(),f,Number(e)),children:[(0,H.jsx)(w,{size:`sm`,"aria-label":le(),children:(0,H.jsx)(N,{})}),(0,H.jsx)(M,{className:`oc-dtp__timeopts`,children:Array.from({length:60},(e,t)=>(0,H.jsx)(O,{value:String(t),children:String(t).padStart(2,`0`)},t))})]})]})]})]})}function W(e){let t=new Date(e),n=e=>String(e).padStart(2,`0`);return`${t.getFullYear()}-${n(t.getMonth()+1)}-${n(t.getDate())}`}function Xt(e,t,n){let r=e=>String(e).padStart(2,`0`);return`${e}-${r(t+1)}-${r(n)}`}function Zt(e){let t=new Map;for(let n of e){let e=W(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 Qt(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(Xt(t,n,a));i!==void 0&&i.length>0&&r.set(a,i.length)}return r}function $t(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 en(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 tn(e){return{startMs:new Date(e,0,1).getTime(),endMs:new Date(e+1,0,1).getTime()}}var G=3;function nn({events:e,mode:t,cursor:n,onModeChange:r,onCursorChange:i,onEventClick:o,footnote:s}){let c=b(),d=(0,V.useMemo)(()=>Zt(e),[e]),ee=(0,V.useMemo)(()=>$t(c),[c]),f=(0,V.useMemo)(()=>new Intl.DateTimeFormat(c,{month:`long`,year:`numeric`}),[c]),p=(0,V.useMemo)(()=>new Intl.DateTimeFormat(c,{month:`long`}),[c]),m=(0,V.useMemo)(()=>new Intl.DateTimeFormat(c,{hour:`2-digit`,minute:`2-digit`}),[c]),h=new Date,te=e=>{if(t===`year`){i({year:n.year+e,month:n.month});return}let r=new Date(n.year,n.month+e,1);i({year:r.getFullYear(),month:r.getMonth()})},g=t===`year`?String(n.year):f.format(new Date(n.year,n.month,1));return(0,H.jsxs)(`div`,{className:`oc-cal`,children:[(0,H.jsxs)(`div`,{className:`oc-cal__head`,children:[(0,H.jsxs)(`div`,{className:`oc-cal__nav`,children:[(0,H.jsx)(C,{variant:`ghost`,size:`icon-sm`,"aria-label":l(),onClick:()=>te(-1),children:(0,H.jsx)(A,{})}),(0,H.jsx)(C,{variant:`ghost`,size:`icon-sm`,"aria-label":u(),onClick:()=>te(1),children:(0,H.jsx)(T,{})}),(0,H.jsx)(C,{variant:`ghost`,size:`sm`,onClick:()=>i({year:h.getFullYear(),month:h.getMonth()}),children:ce()})]}),(0,H.jsx)(`span`,{className:`oc-cal__title`,children:g}),(0,H.jsxs)(`div`,{className:`oc-cal__modes`,role:`group`,children:[(0,H.jsx)(C,{variant:t===`month`?`secondary`:`ghost`,size:`sm`,"aria-pressed":t===`month`,onClick:()=>r(`month`),children:a()}),(0,H.jsx)(C,{variant:t===`year`?`secondary`:`ghost`,size:`sm`,"aria-pressed":t===`year`,onClick:()=>r(`year`),children:x()})]})]}),t===`month`?(0,H.jsx)(rn,{cursor:n,byDay:d,weekdays:ee,timeFmt:m,now:h,onEventClick:o}):(0,H.jsx)(an,{year:n.year,byDay:d,monthShortFmt:p,now:h,onOpenMonth:e=>{i({year:n.year,month:e}),r(`month`)}}),s?(0,H.jsx)(`p`,{className:`oc-cal__footnote`,children:s}):null]})}function rn({cursor:e,byDay:t,weekdays:n,timeFmt:r,now:i,onEventClick:a}){let o=L(e.year,e.month);return(0,H.jsxs)(`div`,{className:`oc-cal__month`,children:[n.map((e,t)=>(0,H.jsx)(`span`,{className:`oc-cal__wd`,children:e},t)),o.map((e,n)=>{let o=t.get(Xt(e.year,e.month,e.day))??[],s=i.getFullYear()===e.year&&i.getMonth()===e.month&&i.getDate()===e.day;return(0,H.jsxs)(`div`,{className:`oc-cal__day`+(e.inMonth?``:` oc-cal__day--out`)+(s?` oc-cal__day--today`:``),children:[(0,H.jsx)(`span`,{className:`oc-cal__daynum`,children:e.day}),o.slice(0,G).map(e=>(0,H.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,H.jsx)(`span`,{className:`oc-cal__evdot`,"aria-hidden":!0}),(0,H.jsx)(`span`,{className:`oc-cal__evtime`,children:r.format(e.atMs)}),(0,H.jsx)(`span`,{className:`oc-cal__evtitle`,children:e.title})]},e.id)),o.length>G?(0,H.jsx)(`span`,{className:`oc-cal__more`,children:me({count:o.length-G})}):null]},n)})]})}function an({year:e,byDay:t,monthShortFmt:n,now:r,onOpenMonth:i}){return(0,H.jsx)(`div`,{className:`oc-cal__year`,children:Array.from({length:12},(a,o)=>{let s=Qt(t,e,o),c=L(e,o);return(0,H.jsxs)(`button`,{type:`button`,className:`oc-cal__mini`,onClick:()=>i(o),children:[(0,H.jsx)(`span`,{className:`oc-cal__mininame`,children:n.format(new Date(e,o,1))}),(0,H.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,H.jsx)(`span`,{className:`oc-cal__minidot`+(e.inMonth?``:` is-out`)+(n===1?` has-one`:``)+(n>1?` has-many`:``)+(i?` is-today`:``)},t)})})]},o)})})}var on={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])*on[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=z(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(Gt(e)){case`ok`:return(0,H.jsx)(D,{variant:`secondary`,children:de()});case`error`:return(0,H.jsx)(D,{variant:`destructive`,children:ye()});case`running`:return(0,H.jsx)(D,{variant:`outline`,children:xe()});case`other`:return(0,H.jsx)(D,{variant:`outline`,children:e});case`none`:return(0,H.jsx)(`span`,{className:`text-muted-foreground`,children:`—`})}}function pn(){let e=v(S.scheduled.listMyCrons),t=v(S.scheduled.getCronDetail),n=v(S.scheduled.listCronRuns),a=v(S.scheduled.updateCron),c=v(S.scheduled.removeCron),l=v(S.scheduled.runCronNow),u=ft(),d=s(S.me.getMe,{host:Ot})?.timezone,[h,ie]=(0,V.useState)(null),[ce,le]=(0,V.useState)(!1),[_,me]=(0,V.useState)(!1),[x,st]=(0,V.useState)(null),[T,E]=(0,V.useState)(null),[k,A]=(0,V.useState)(null),[P,L]=(0,V.useState)(null),[Ht,Gt]=(0,V.useState)(!1),[B,U]=(0,V.useState)(Ut),[W,Xt]=(0,V.useState)(()=>new URLSearchParams(window.location.search).get(`job`)===null&&localStorage.getItem(`oc.sched.view`)===`calendar`?`calendar`:`list`),Zt=e=>{localStorage.setItem(`oc.sched.view`,e),Xt(e)},[Qt,$t]=(0,V.useState)(`month`),[G,rn]=(0,V.useState)(()=>{let e=new Date;return{year:e.getFullYear(),month:e.getMonth()}}),an=(0,V.useMemo)(()=>{let e=[];for(let t of h??[]){if(!t.supported||t.error!==null)continue;let n=t.kind===`openclaw`&&t.manageSupported;for(let r of t.jobs)Vt(r,B)&&e.push({instanceName:t.instanceName,canEdit:n,job:r})}return e},[h,B]),on=(0,V.useMemo)(()=>Qt===`year`?tn(G.year):en(G.year,G.month),[Qt,G]),sn=(0,V.useMemo)(()=>un(an,on.startMs,on.endMs),[an,on]),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,V.useCallback)(async()=>{le(!0),me(!1);try{ie(await e({}))}catch{me(!0)}finally{le(!1)}},[e]);(0,V.useEffect)(()=>{q()},[q]);let cn=(0,V.useMemo)(()=>new URLSearchParams(window.location.search).get(`job`),[]),J=(0,V.useRef)(null);(0,V.useEffect)(()=>{h!==null&&J.current!==null&&J.current.scrollIntoView({block:`center`})},[h]);let Y=(0,V.useMemo)(()=>new Intl.DateTimeFormat(b(),{dateStyle:`medium`,timeStyle:`short`}),[]),X=async(e,t,n)=>{st(e);try{await t(),u.success(n),await q()}catch(e){u.toast({variant:`error`,title:y({code:dn(e)})})}finally{st(null)}},Z=(0,V.useRef)(0),Q=(0,V.useRef)(0),ln=async(e,t)=>{if(t.id===null)return;let r=++Z.current;A({name:t.name??t.id,entries:null});try{let i=await n({instanceName:e,jobId:t.id,limit:20});if(r!==Z.current)return;A({name:t.name??t.id,entries:i})}catch(e){if(r!==Z.current)return;A(null),u.toast({variant:`error`,title:y({code:dn(e)})})}},pn=async(e,n)=>{if(n.id===null)return;let r=++Q.current;L({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;L(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;L(null),u.toast({variant:`error`,title:y({code:dn(e)})})}},mn=async()=>{if(P===null)return;let e={};if(P.nameDirty&&P.name.trim()===``||P.messageDirty&&P.hasMessage&&P.message.trim()===``){u.toast({variant:`error`,title:Ce()});return}if(P.nameDirty&&P.name.trim()!==``&&(e.name=P.name.trim()),P.scheduleDirty){if(P.scheduleKind===`cron`&&P.cronExpr.trim()!==``)e.schedule={kind:`cron`,expr:P.cronExpr.trim(),...P.tz.trim()===``?{}:{tz:P.tz.trim()}};else if(P.scheduleKind===`every`){let t=Number(P.everyValue);Number.isFinite(t)&&t>=1&&(e.schedule={kind:`every`,everyMs:Math.round(t*$[P.everyUnit])})}else if(P.scheduleKind===`at`&&P.at!==``){let t=Date.parse(P.at);Number.isFinite(t)&&(e.schedule={kind:`at`,at:new Date(t).toISOString()})}}if(P.scheduleDirty&&e.schedule===void 0){u.toast({variant:`error`,title:ue()});return}if(P.messageDirty&&P.hasMessage&&P.message.trim()!==``&&(e.message=P.message.trim()),Object.keys(e).length===0){L(null);return}let t=Q.current;Gt(!0);try{await a({instanceName:P.instanceName,jobId:P.jobId,patch:e}),u.success(je()),t===Q.current&&L(null),await q()}catch(e){u.toast({variant:`error`,title:y({code:dn(e)})})}finally{Gt(!1)}},hn=h?.reduce((e,t)=>e+t.jobs.length,0)??0;return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`div`,{style:{display:`flex`,alignItems:`flex-start`,gap:8,marginBottom:12},children:[(0,H.jsx)(`p`,{className:`oc-admin__hint`,style:{flex:1,margin:0},children:fe()}),(0,H.jsxs)(`div`,{className:`oc-sched__viewtoggle`,role:`group`,"aria-label":se(),children:[(0,H.jsx)(C,{variant:W===`list`?`secondary`:`ghost`,size:`icon-sm`,"aria-label":oe(),title:oe(),"aria-pressed":W===`list`,onClick:()=>Zt(`list`),children:(0,H.jsx)(lt,{})}),(0,H.jsx)(C,{variant:W===`calendar`?`secondary`:`ghost`,size:`icon-sm`,"aria-label":ze(),title:ze(),"aria-pressed":W===`calendar`,onClick:()=>Zt(`calendar`),children:(0,H.jsx)(qt,{})})]}),(0,H.jsxs)(C,{variant:`ghost`,size:`sm`,onClick:()=>void q(),disabled:ce,style:{display:`inline-flex`,alignItems:`center`,gap:4},children:[(0,H.jsx)(St,{size:14,"aria-hidden":!0}),Te()]})]}),h!==null&&hn>0?(0,H.jsxs)(Bt,{q:B.q,onQChange:e=>U(t=>({...t,q:e})),searchPlaceholder:Ye(),onReset:()=>U(Ut),canReset:Wt(B),children:[(0,H.jsxs)(j,{value:B.state,onValueChange:e=>U(t=>({...t,state:e})),children:[(0,H.jsx)(w,{size:`sm`,className:`w-40`,children:(0,H.jsx)(N,{})}),(0,H.jsxs)(M,{children:[(0,H.jsx)(O,{value:`all`,children:ne()}),(0,H.jsx)(O,{value:`active`,children:pe()}),(0,H.jsx)(O,{value:`paused`,children:ct()}),(0,H.jsx)(O,{value:`auto-disabled`,children:ae()})]})]}),(0,H.jsxs)(j,{value:B.result,onValueChange:e=>U(t=>({...t,result:e})),children:[(0,H.jsx)(w,{size:`sm`,className:`w-40`,children:(0,H.jsx)(N,{})}),(0,H.jsxs)(M,{children:[(0,H.jsx)(O,{value:`all`,children:f()}),(0,H.jsx)(O,{value:`ok`,children:de()}),(0,H.jsx)(O,{value:`error`,children:ye()}),(0,H.jsx)(O,{value:`running`,children:xe()}),(0,H.jsx)(O,{value:`none`,children:te()})]})]})]}):null,h===null?(0,H.jsx)(`p`,{className:`oc-admin__hint`,"aria-busy":ce,children:_?be():He()}):W===`calendar`?(0,H.jsxs)(H.Fragment,{children:[_?(0,H.jsx)(`p`,{className:`oc-admin__hint`,children:be()}):null,h.length===0?(0,H.jsx)(`p`,{className:`oc-admin__hint`,children:Se()}):(0,H.jsx)(nn,{events:sn.events,mode:Qt,cursor:G,onModeChange:$t,onCursorChange:rn,onEventClick:K,footnote:at()})]}):(0,H.jsxs)(H.Fragment,{children:[_?(0,H.jsx)(`p`,{className:`oc-admin__hint`,children:be()}):null,h.length===0?(0,H.jsx)(`p`,{className:`oc-admin__hint`,children:Se()}):null,h.map(e=>{let t=e.jobs.filter(e=>Vt(e,B)),n=Wt(B)&&e.jobs.length>0&&t.length===0;return(0,H.jsxs)(`section`,{style:{marginBottom:20},children:[h.length>1||e.error||!e.supported?(0,H.jsxs)(`h3`,{style:{display:`flex`,alignItems:`center`,gap:8,fontSize:`0.85rem`,fontWeight:600,margin:`0 0 6px`},children:[e.instanceName,(0,H.jsx)(D,{variant:`outline`,children:e.kind})]}):null,e.supported?e.error?(0,H.jsx)(`p`,{className:`oc-admin__hint`,children:Xe({code:e.error})}):e.jobs.length===0?(0,H.jsx)(`p`,{className:`oc-admin__hint`,children:re()}):n?(0,H.jsx)(`p`,{className:`oc-admin__hint`,children:_e()}):(0,H.jsxs)(zt,{children:[(0,H.jsx)(It,{children:(0,H.jsxs)(Rt,{children:[(0,H.jsx)(F,{children:p()}),(0,H.jsx)(F,{children:ve()}),(0,H.jsx)(F,{children:he()}),(0,H.jsx)(F,{children:m()}),(0,H.jsx)(F,{children:ge()}),(0,H.jsx)(F,{children:i()}),(0,H.jsx)(F,{children:Ue()})]})}),(0,H.jsx)(Lt,{children:t.map((t,n)=>{let r=`${e.instanceName}:${t.id??n}`,i=x===r,s=e.manageSupported,c=e.kind===`openclaw`&&s;return(0,H.jsxs)(Rt,{ref:t.id!==null&&t.id===cn?J:void 0,"data-state":t.id!==null&&t.id===cn?`selected`:void 0,children:[(0,H.jsx)(I,{className:`font-medium`,style:{maxWidth:280,overflow:`hidden`,textOverflow:`ellipsis`},title:t.name??void 0,children:t.name??o()}),(0,H.jsx)(I,{children:(0,H.jsx)(D,{variant:`secondary`,children:t.agentId})}),(0,H.jsxs)(I,{className:`whitespace-nowrap`,children:[(0,H.jsx)(`span`,{style:{fontFamily:`var(--font-mono, monospace)`},children:t.schedule??`—`}),(()=>{let e=xt(t.schedule),n=e===null?null:gt(e);return n===null?null:(0,H.jsx)(`span`,{className:`text-muted-foreground`,style:{display:`block`,fontSize:`0.78rem`},children:n})})()]}),(0,H.jsx)(I,{className:`whitespace-nowrap text-muted-foreground`,children:t.nextRunAtMs===null?`—`:Y.format(t.nextRunAtMs)}),(0,H.jsx)(I,{children:z(t)===`auto-disabled`?(0,H.jsx)(D,{variant:`destructive`,title:`${t.autoDisabledReason??``}${t.autoDisabledAtMs===null?``:` · ${Y.format(t.autoDisabledAtMs)}`}`,children:ae()}):z(t)===`active`?(0,H.jsx)(D,{variant:`secondary`,children:pe()}):z(t)===`paused`?(0,H.jsx)(D,{variant:`outline`,children:ct()}):(0,H.jsx)(`span`,{className:`text-muted-foreground`,children:`—`})}),(0,H.jsxs)(I,{children:[(0,H.jsx)(fn,{status:t.lastRunStatus}),t.lastDelivered===!1?(0,H.jsx)(D,{variant:`destructive`,title:t.lastDeliveryError??ot(),children:we()}):null]}),(0,H.jsx)(I,{className:`whitespace-nowrap`,children:t.id===null?(0,H.jsx)(`span`,{className:`text-muted-foreground`,children:`—`}):i?(0,H.jsx)(dt,{size:14,className:`oc-actrow__spin`,"aria-hidden":!0}):(0,H.jsxs)(`span`,{className:`oc-cronactions`,children:[c?(0,H.jsx)(C,{variant:`ghost`,size:`icon-sm`,title:Ee(),"aria-label":Ee(),disabled:x!==null,onClick:()=>void X(r,async()=>{let n=await l({instanceName:e.instanceName,jobId:t.id});if(n.ran!==!0&&n.runId===null)throw{data:{code:n.reason??`run_not_started`}}},Me()),children:(0,H.jsx)(Et,{size:14,"aria-hidden":!0})}):null,c&&t.enabled!==null?(0,H.jsx)(C,{variant:`ghost`,size:`icon-sm`,title:R(t)===`pause`?Fe():Ie(),"aria-label":R(t)===`pause`?Fe():Ie(),disabled:x!==null,onClick:()=>void X(r,()=>a({instanceName:e.instanceName,jobId:t.id,patch:{enabled:R(t)===`resume`}}),R(t)===`pause`?rt():Ve()),children:R(t)===`pause`?(0,H.jsx)(Nt,{size:14,"aria-hidden":!0}):(0,H.jsx)(ht,{size:14,"aria-hidden":!0})}):null,c?(0,H.jsx)(C,{variant:`ghost`,size:`icon-sm`,title:Je(),"aria-label":Je(),disabled:x!==null,onClick:()=>void pn(e.instanceName,t),children:(0,H.jsx)(vt,{size:14,"aria-hidden":!0})}):null,c?(0,H.jsx)(C,{variant:`ghost`,size:`icon-sm`,title:Pe(),"aria-label":Pe(),disabled:x!==null,onClick:()=>void ln(e.instanceName,t),children:(0,H.jsx)(Jt,{size:14,"aria-hidden":!0})}):null,s?(0,H.jsx)(C,{variant:`ghost`,size:`icon-sm`,title:We(),"aria-label":We(),disabled:x!==null,onClick:()=>E({instanceName:e.instanceName,jobId:t.id,name:t.name??t.id}),children:(0,H.jsx)(bt,{size:14,"aria-hidden":!0})}):null]})})]},t.id??`${e.instanceName}-${n}`)})})]}):(0,H.jsx)(`p`,{className:`oc-admin__hint`,children:g()})]},e.instanceName)}),hn>0?(0,H.jsx)(`p`,{className:`oc-admin__hint`,style:{marginTop:4},children:ee()}):null]}),(0,H.jsx)(jt,{open:T!==null,onOpenChange:e=>{e||E(null)},children:(0,H.jsxs)(Pt,{children:[(0,H.jsxs)(Mt,{children:[(0,H.jsx)(mt,{children:$e()}),(0,H.jsx)(pt,{children:qe({name:T?.name??``})})]}),(0,H.jsxs)(ut,{children:[(0,H.jsx)(yt,{children:Oe()}),(0,H.jsx)(Ft,{onClick:()=>{let e=T;E(null),e!==null&&X(`${e.instanceName}:${e.jobId}`,()=>c({instanceName:e.instanceName,jobId:e.jobId}),Ae())},children:Re()})]})]})}),(0,H.jsx)(At,{open:k!==null,onOpenChange:e=>{e||(Z.current++,A(null))},children:(0,H.jsxs)(Tt,{style:{maxWidth:640},children:[(0,H.jsx)(_t,{children:(0,H.jsx)(Dt,{children:nt({name:k?.name??``})})}),k?.entries===null?(0,H.jsx)(`p`,{className:`oc-admin__hint`,children:He()}):k!==null&&k.entries.length===0?(0,H.jsx)(`p`,{className:`oc-admin__hint`,children:Be()}):k===null?null:(0,H.jsx)(`div`,{className:`oc-cronpanel__runs`,style:{maxHeight:420,overflowY:`auto`},children:k.entries.map((e,t)=>(0,H.jsxs)(`div`,{className:`oc-cronpanel__run`,children:[(0,H.jsxs)(`div`,{className:`oc-cronpanel__run-head`,children:[(0,H.jsx)(fn,{status:e.status}),(0,H.jsx)(`span`,{children:typeof(e.runAtMs??e.ts)==`number`?Y.format(e.runAtMs??e.ts):`—`}),typeof e.durationMs==`number`?(0,H.jsxs)(`span`,{className:`oc-cronpanel__run-dur`,children:[Math.round(e.durationMs/1e3),`s`]}):null]}),e.summary===null?null:(0,H.jsx)(`div`,{className:`oc-cronpanel__run-summary`,children:e.summary}),e.error===null?null:(0,H.jsx)(`div`,{className:`oc-cronpanel__run-error`,children:e.error}),e.delivered===!1?(0,H.jsxs)(`div`,{className:`oc-cronpanel__run-undelivered`,children:[tt({channel:e.deliveryChannel??`—`}),e.deliveryError===null?null:(0,H.jsx)(`span`,{className:`oc-cronpanel__plain`,children:e.deliveryError})]}):null]},t))})]})}),(0,H.jsx)(At,{open:P!==null,onOpenChange:e=>{e||(Q.current++,L(null))},children:(0,H.jsxs)(Tt,{className:`oc-cronedit`,children:[(0,H.jsxs)(_t,{children:[(0,H.jsx)(Dt,{children:ke()}),(0,H.jsx)(kt,{children:Qe()})]}),P===null?null:P.loading?(0,H.jsx)(`p`,{className:`oc-admin__hint`,children:He()}):(0,H.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:12},children:[(0,H.jsxs)(`label`,{style:{display:`flex`,flexDirection:`column`,gap:4},children:[(0,H.jsx)(`span`,{className:`oc-admin__hint`,style:{margin:0},children:p()}),(0,H.jsx)(wt,{value:P.name,maxLength:200,onChange:e=>L({...P,name:e.target.value,nameDirty:!0})})]}),(0,H.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:4},children:[(0,H.jsx)(`span`,{className:`oc-admin__hint`,style:{margin:0},children:Ke()}),(0,H.jsxs)(j,{value:P.scheduleKind,onValueChange:e=>L({...P,scheduleKind:e,scheduleDirty:!0}),children:[(0,H.jsx)(w,{children:(0,H.jsx)(N,{})}),(0,H.jsxs)(M,{children:[(0,H.jsx)(O,{value:`cron`,children:De()}),(0,H.jsx)(O,{value:`every`,children:Le()}),(0,H.jsx)(O,{value:`at`,children:Ze()})]})]}),P.scheduleKind===`cron`?(0,H.jsxs)(`div`,{style:{display:`flex`,gap:8},children:[(0,H.jsx)(wt,{value:P.cronExpr,onChange:e=>L({...P,cronExpr:e.target.value,scheduleDirty:!0}),placeholder:`30 9 * * *`,style:{fontFamily:`var(--font-mono, monospace)`}}),(0,H.jsx)(Kt,{value:P.tz,onChange:e=>L({...P,tz:e,scheduleDirty:!0}),fallbackTz:d??void 0})]}):P.scheduleKind===`every`?(0,H.jsxs)(`div`,{style:{display:`flex`,gap:8},children:[(0,H.jsx)(wt,{type:`number`,min:1,value:P.everyValue,onChange:e=>L({...P,everyValue:e.target.value,scheduleDirty:!0}),style:{maxWidth:120}}),(0,H.jsxs)(j,{value:P.everyUnit,onValueChange:e=>L({...P,everyUnit:e,scheduleDirty:!0}),children:[(0,H.jsx)(w,{style:{maxWidth:160},children:(0,H.jsx)(N,{})}),(0,H.jsxs)(M,{children:[(0,H.jsx)(O,{value:`minutes`,children:Ge()}),(0,H.jsx)(O,{value:`hours`,children:et()}),(0,H.jsx)(O,{value:`days`,children:Ne()})]})]})]}):(0,H.jsx)(Yt,{value:P.at,onChange:e=>L({...P,at:e,scheduleDirty:!0})})]}),P.hasMessage?(0,H.jsxs)(`label`,{style:{display:`flex`,flexDirection:`column`,gap:4},children:[(0,H.jsx)(`span`,{className:`oc-admin__hint`,style:{margin:0},children:it()}),(0,H.jsx)(`textarea`,{className:`oc-cronedit__textarea`,rows:4,value:P.message,onChange:e=>L({...P,message:e.target.value,messageDirty:!0})})]}):null]}),(0,H.jsxs)(Ct,{children:[(0,H.jsx)(C,{variant:`ghost`,onClick:()=>L(null),children:Oe()}),(0,H.jsxs)(C,{onClick:()=>void mn(),disabled:P===null||P.loading||Ht,children:[Ht?(0,H.jsx)(dt,{size:14,className:`oc-actrow__spin`,"aria-hidden":!0}):null,r()]})]})]})})]})}export{pn as ScheduledTab};
|