@lacneu/atrium 0.84.17 → 0.84.18
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-DhFQZGzx.js → AccessTab-C4qktb9N.js} +1 -1
- package/dist/assets/{AdvancedFilter-DhMwg7nB.js → AdvancedFilter-DzABuYe4.js} +1 -1
- package/dist/assets/AgentFilesTab-tv2KHmyO.js +3 -0
- package/dist/assets/{AnomaliesTab-DRPqd0B0.js → AnomaliesTab-POfetzRk.js} +1 -1
- package/dist/assets/{AuditTab-CoJzgU4A.js → AuditTab-DNtJSFCG.js} +1 -1
- package/dist/assets/{BridgeTab-Cyq6ii7O.js → BridgeTab-CzyyKpM3.js} +1 -1
- package/dist/assets/{ChatDefaultsTab-ffTdOd77.js → ChatDefaultsTab-B0YNJjM5.js} +1 -1
- package/dist/assets/{DataTableShell-C0MSDiic.js → DataTableShell-DGGSIwCx.js} +1 -1
- package/dist/assets/{DetailChips-V2Qp_G9Y.js → DetailChips-DTzXBtIX.js} +1 -1
- package/dist/assets/{FeedbacksTab-4P7NTQHQ.js → FeedbacksTab-BJvVbEdR.js} +1 -1
- package/dist/assets/{FieldLabel-CrPuHD7O.js → FieldLabel-CEa671vG.js} +1 -1
- package/dist/assets/FilesTab-B79u5xo1.js +1 -0
- package/dist/assets/{FilterBar-Of8GWz2N.js → FilterBar-D_6ObXjr.js} +1 -1
- package/dist/assets/{GroupsTab-JG0ZRFjT.js → GroupsTab-FU1hfvWY.js} +1 -1
- package/dist/assets/{InstancesTab-Z4FtEPKO.js → InstancesTab-D0YmHvV-.js} +1 -1
- package/dist/assets/{IntegrationsTab-Cwaeqx7m.js → IntegrationsTab-BEVGWeVW.js} +1 -1
- package/dist/assets/KpiTab-BLkA1s66.js +1 -0
- package/dist/assets/PreferencesTab-D56grf46.js +1 -0
- package/dist/assets/ProjectPage-C9wOIZOD.js +1 -0
- package/dist/assets/{PromptInjectionsTab-netn591W.js → PromptInjectionsTab-X6VRyQUy.js} +2 -2
- package/dist/assets/RolesTab-Dunonnsb.js +1 -0
- package/dist/assets/ScheduledTab-DCpRYvbc.js +1 -0
- package/dist/assets/{ServiceAccountsTab-CfyqKLAB.js → ServiceAccountsTab-D2TjT-Y0.js} +1 -1
- package/dist/assets/{SubAgentReportsTab-Z3ozWsvu.js → SubAgentReportsTab-C0O27eOL.js} +1 -1
- package/dist/assets/{ThemeShowroom-CJH5AUOa.js → ThemeShowroom-CbWueTmW.js} +1 -1
- package/dist/assets/{TimeRangePicker-Cq_PGNzt.js → TimeRangePicker-DVMsYipt.js} +1 -1
- package/dist/assets/{TimezoneCombobox-n6rUGOTZ.js → TimezoneCombobox-D1Wotasq.js} +1 -1
- package/dist/assets/TracesTab-CHxsnBQk.js +1 -0
- package/dist/assets/{UsersTab-B3TSVToM.js → UsersTab-OinNV3dC.js} +1 -1
- package/dist/assets/VoiceTab-C-4Z4mUZ.js +1 -0
- package/dist/assets/api-Dawxt_aS.js +44 -0
- package/dist/assets/{button-CTuIl1H-.js → button-alklyZ2M.js} +1 -1
- package/dist/assets/{card-Bf8slN_1.js → card-CDvn9R5v.js} +1 -1
- package/dist/assets/chevrons-up-down-CFK9IaHn.js +1 -0
- package/dist/assets/{compatView-DGV2AVAR.js → compatView-C9_KgDNH.js} +1 -1
- package/dist/assets/{dispatchErrorInfo-ZyhGCDRg.js → dispatchErrorInfo-d7ehNfS4.js} +1 -1
- package/dist/assets/{dist-BA_3OmOa.js → dist-C3BrQPF_.js} +1 -1
- package/dist/assets/{dist-uRF7WBqM.js → dist-DlDq3K4D.js} +1 -1
- package/dist/assets/{highlighted-body-OFNGDK62-PQt_lrzL.js → highlighted-body-OFNGDK62-BytsI_cI.js} +1 -1
- package/dist/assets/{index-D48cFy6f.js → index-C-ySA5Hs.js} +61 -61
- package/dist/assets/{list-CntaIhDp.js → list-Bs_wfimY.js} +1 -1
- package/dist/assets/mermaid-GHXKKRXX-CBJEr4Xn.js +1 -0
- package/dist/assets/{pdf-BpJ-W-U1.js → pdf-DRZjZEuv.js} +1 -1
- package/dist/assets/roleDescriptions-C21oVyp7.js +1 -0
- package/dist/assets/{table-D0yilGWI.js → table-CJ3_5RvQ.js} +1 -1
- package/dist/assets/{tabs-KQ0HdNTL.js → tabs-D-3HavQe.js} +1 -1
- package/dist/assets/x-BSVAMcNy.js +1 -0
- package/dist/index.html +6 -6
- package/package.json +1 -1
- package/dist/assets/AgentFilesTab-4sCRfaeL.js +0 -3
- package/dist/assets/FilesTab-DhNYdwv6.js +0 -1
- package/dist/assets/KpiTab-CW4PL5Q2.js +0 -1
- package/dist/assets/PreferencesTab-CWPxzO4u.js +0 -1
- package/dist/assets/ProjectPage-DMyEKLjd.js +0 -1
- package/dist/assets/RolesTab-BEQu-Exi.js +0 -1
- package/dist/assets/ScheduledTab-DwU5L2Il.js +0 -1
- package/dist/assets/TracesTab-DNfS8ryM.js +0 -1
- package/dist/assets/VoiceTab-DiKi0oXO.js +0 -1
- package/dist/assets/api-DRlXTl06.js +0 -44
- package/dist/assets/chevrons-up-down-BCCw67LL.js +0 -1
- package/dist/assets/mermaid-GHXKKRXX-CiGFgQis.js +0 -1
- package/dist/assets/roleDescriptions-CoFSIkRg.js +0 -1
- package/dist/assets/x-BM-3QiyY.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Am as r,Bm as i,Fm as a,Hm as o,Im as s,Lm as c,Mm as l,Nm as u,Pm as d,
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Am as r,Bm as i,Fm as a,Hm as o,Im as s,Lm as c,Mm as l,Nm as u,Pm as d,QB as f,Rm as p,Um as m,Vm as h,Wm as g,jm as _,sV as v,t as y,zm as b}from"./api-Dawxt_aS.js";import{$ as x,Et as S,Q as C,X as w,Z as T,et as E}from"./index-C-ySA5Hs.js";var D=t(e(),1);function O(e){return e===`user`?d():e===`all`?u():l({group:e.group})}function k(e){return e===`common`?_():e===`owner`?r():l({group:e.group})}var A=n();function j(e){return e.name||e.email||e.userId.slice(0,8)}function M(){let e=v(y.admin.listUsers,{}),[t,n]=(0,D.useState)(``),r=v(y.introspect.introspectUser,t?{userId:t}:`skip`);return(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:g()}),(0,A.jsxs)(w,{value:t,onValueChange:n,children:[(0,A.jsx)(x,{size:`sm`,"aria-label":m(),children:(0,A.jsx)(E,{placeholder:m()})}),(0,A.jsx)(T,{children:(e??[]).map(e=>(0,A.jsx)(C,{value:e.userId,children:j(e)},e._id))})]}),t===``?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:o()}):r===void 0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:f()}):(0,A.jsxs)(`div`,{className:`oc-introspect`,children:[(0,A.jsxs)(`section`,{className:`oc-introspect__section`,children:[(0,A.jsx)(`h3`,{className:`oc-introspect__title`,children:h()}),(0,A.jsxs)(`div`,{className:`oc-introspect__id`,children:[(0,A.jsx)(`strong`,{children:r.user.label}),(0,A.jsx)(S,{variant:`secondary`,children:r.role})]})]}),(0,A.jsxs)(`section`,{className:`oc-introspect__section`,children:[(0,A.jsx)(`h3`,{className:`oc-introspect__title`,children:i()}),r.groups.length===0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:s()}):(0,A.jsx)(`div`,{className:`oc-introspect__chips`,children:r.groups.map(e=>(0,A.jsx)(S,{variant:`secondary`,children:e.name},e.groupId))})]}),(0,A.jsxs)(`section`,{className:`oc-introspect__section`,children:[(0,A.jsx)(`h3`,{className:`oc-introspect__title`,children:b()}),r.agents.length===0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:s()}):(0,A.jsx)(`ul`,{className:`oc-introspect__list`,children:r.agents.map(e=>(0,A.jsxs)(`li`,{className:`oc-introspect__row`,children:[(0,A.jsx)(`span`,{className:`oc-introspect__name`,children:e.displayName||e.agentId}),e.isDefault?(0,A.jsx)(S,{variant:`default`,children:a()}):null,(0,A.jsx)(S,{variant:`outline`,children:O(e.via)}),(0,A.jsx)(S,{variant:`secondary`,children:e.state})]},`${e.instanceName} ${e.agentId}`))})]}),(0,A.jsxs)(`section`,{className:`oc-introspect__section`,children:[(0,A.jsx)(`h3`,{className:`oc-introspect__title`,children:p()}),r.charts.length===0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:s()}):(0,A.jsx)(`ul`,{className:`oc-introspect__list`,children:r.charts.map(e=>(0,A.jsxs)(`li`,{className:`oc-introspect__row`,children:[(0,A.jsx)(`span`,{className:`oc-introspect__name`,children:e.name}),(0,A.jsx)(S,{variant:`outline`,children:k(e.via)})]},e.key))})]}),(0,A.jsxs)(`section`,{className:`oc-introspect__section`,children:[(0,A.jsx)(`h3`,{className:`oc-introspect__title`,children:c()}),r.permissions.length===0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:s()}):(0,A.jsx)(`div`,{className:`oc-introspect__chips`,children:r.permissions.map(e=>(0,A.jsx)(S,{variant:`secondary`,children:e},e))})]})]})]})}export{M as AccessTab};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{a_ as r,c_ as i,i_ as a,l_ as o,o_ as s,r_ as c,s_ as l}from"./api-
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{a_ as r,c_ as i,i_ as a,l_ as o,o_ as s,r_ as c,s_ as l}from"./api-Dawxt_aS.js";import{t as u}from"./x-BSVAMcNy.js";import{t as d}from"./button-alklyZ2M.js";import{$ as f,Hn as p,Q as m,X as h,Z as g,et as _,gn as v,jt as y}from"./index-C-ySA5Hs.js";import{r as b}from"./TimeRangePicker-DVMsYipt.js";var x=t(e(),1),S=n(),C=[{value:`eq`,label:`=`},{value:`neq`,label:`≠`},{value:`contains`,label:o()},{value:`gt`,label:`>`},{value:`gte`,label:`≥`},{value:`lt`,label:`<`},{value:`lte`,label:`≤`}],w=1;function T(){return{id:w++,field:``,op:`eq`,value:``}}function E(e){return e.map(e=>({id:w++,field:e.field,op:e.op,value:String(e.value)}))}function D({fields:e,seed:t,onChange:n}){let o=(0,x.useRef)(t),w=!!(o.current&&o.current.length>0),[D,O]=(0,x.useState)(w),[k,A]=(0,x.useState)(()=>w?E(o.current):[]);function j(e){n(e.filter(e=>e.field!==``&&e.value!==``).map(e=>({field:e.field,op:e.op,value:b(e.value)})))}function M(e,t){let n=k.map(n=>n.id===e?{...n,...t}:n);A(n),j(n)}function N(){A(e=>[...e,T()])}function P(e){let t=k.filter(t=>t.id!==e);A(t),j(t)}let F=k.filter(e=>e.field!==``&&e.value!==``).length;return(0,S.jsxs)(`div`,{className:`oc-advfilter`,children:[(0,S.jsxs)(`button`,{type:`button`,className:`oc-advfilter__toggle`,"aria-expanded":D,onClick:()=>O(e=>!e),children:[(0,S.jsx)(p,{className:`oc-advfilter__chevron`+(D?` is-open`:``),"aria-hidden":!0}),i(),F>0?(0,S.jsx)(`span`,{className:`oc-advfilter__count`,children:F}):null]}),D?(0,S.jsxs)(`div`,{className:`oc-advfilter__body`,children:[k.length===0?(0,S.jsx)(`p`,{className:`oc-admin__hint`,children:l()}):(0,S.jsx)(`ul`,{className:`oc-advfilter__rows`,children:k.map(t=>(0,S.jsxs)(`li`,{className:`oc-advfilter__row`,children:[(0,S.jsxs)(h,{value:t.field||void 0,onValueChange:e=>M(t.id,{field:e}),children:[(0,S.jsx)(f,{size:`sm`,className:`w-40`,children:(0,S.jsx)(_,{placeholder:s()})}),(0,S.jsx)(g,{children:e.map(e=>(0,S.jsx)(m,{value:e.value,children:e.label},e.value))})]}),(0,S.jsxs)(h,{value:t.op,onValueChange:e=>M(t.id,{op:e}),children:[(0,S.jsx)(f,{size:`sm`,className:`w-28`,children:(0,S.jsx)(_,{})}),(0,S.jsx)(g,{children:C.map(e=>(0,S.jsx)(m,{value:e.value,children:e.label},e.value))})]}),(0,S.jsx)(y,{className:`oc-advfilter__value`,value:t.value,onChange:e=>M(t.id,{value:e.target.value}),placeholder:r()}),(0,S.jsx)(d,{variant:`ghost`,size:`icon-sm`,"aria-label":a(),onClick:()=>P(t.id),children:(0,S.jsx)(u,{})})]},t.id))}),(0,S.jsxs)(d,{variant:`outline`,size:`sm`,className:`oc-advfilter__add`,onClick:N,children:[(0,S.jsx)(v,{}),c()]})]}):null]})}export{D as t};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$d as r,$o as i,Ao as a,Do as o,Eo as s,Jd as c,Jo as l,Oo as u,QB as d,Qd as f,Qo as p,Sf as m,To as h,Xd as g,Xo as _,Yd as v,Yo as y,Zd as b,Zo as x,_f as S,af as C,an as w,as as T,bf as E,cf as D,cp as O,cs as k,df as A,ds as j,eV as M,ef as ee,es as N,ff as P,fs as F,gf as te,hf as I,iV as L,if as R,is as z,jo as B,ko as V,lf as H,ls as ne,mf as re,nf as U,ns as W,oV as ie,of as ae,op as oe,os as se,pf as ce,ps as le,qd as ue,qo as de,rf as fe,rs as pe,sV as G,sf as me,ss as he,t as K,tN as ge,tf as _e,ts as ve,uf as ye,us as be,vf as xe,xf as Se,yf as Ce}from"./api-Dawxt_aS.js";import{t as q}from"./button-alklyZ2M.js";import{$ as we,B as Te,Ct as Ee,Dt as J,Et as De,Q as Oe,St as ke,Tt as Ae,X as je,Z as Me,at as Ne,bt as Pe,et as Fe,nt as Ie,ot as Le,q as Re,rt as ze,tt as Be,un as Y,vt as Ve,wt as He,xt as Ue,yt as We}from"./index-C-ySA5Hs.js";import{n as Ge,t as Ke}from"./curation-CQksaIbm.js";import{a as qe}from"./compatView-C9_KgDNH.js";/* empty css */var X=t(e(),1),Je=2e4,Ye=6e4;function Xe(e){return typeof e!=`number`||e<=0?0:Math.round(e/Je*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=G(K.me.getMe,{host:Re}),t=e?.role===`admin`,n=(e?.permissions??[]).includes(`bridge.read`),r=G(K.admin.listInstances,e!==void 0&&t?{}:`skip`),[i,a]=(0,X.useState)(null);(0,X.useEffect)(()=>{!t||!r||r.length===0||(!i||!r.some(e=>e.name===i))&&a(r[0].name)},[t,r,i]);let o=G(K.agents.listAgentsForInstance,t&&i?{instanceName:i}:`skip`),s=G(K.agents.listMyAgents,e!==void 0&&!t?{}:`skip`),c=(0,X.useMemo)(()=>{if(e!==void 0){if(t)return i===null||o===void 0?r!==void 0&&r.length===0?[]:void 0:o.agents.map(e=>({instanceName:i,agentId:e.agentId,label:`${e.emoji?`${e.emoji} `:``}${e.displayName??e.agentId}`}));if(s!==void 0)return s.map(e=>({instanceName:e.instanceName,agentId:e.agentId,label:`${e.emoji?`${e.emoji} `:``}${e.displayName??e.agentId}`}))}},[e,t,i,o,r,s]),[l,u]=(0,X.useState)(null);(0,X.useEffect)(()=>{!c||c.length===0||(!l||!c.some(e=>$(e)===l))&&u($(c[0]))},[c,l]);let f=c?.find(e=>$(e)===l)??null,p=L(K.agentFiles.listAgentFiles),[h,g]=(0,X.useState)({status:`idle`}),_=f?.instanceName??null,v=f?.agentId??null,y=G(K.compat.forInstance,n&&_!==null?{instanceName:_}:`skip`),b=n&&_!==null?Te(y,`agentFiles`):null,x=b===null?!1:b===`loading`?null:b.blocked,C=(0,X.useCallback)(async()=>{if(!(_===null||v===null)){g({status:`loading`});try{g({status:`done`,files:(await p({instanceName:_,agentId:v})).files})}catch(e){g({status:`error`,dashboardAbsent:tt(e)})}}},[p,_,v]);(0,X.useEffect)(()=>{x===!1&&C()},[C,x]);let[T,D]=(0,X.useState)(null),O=G(K.agentFileCuration.listCurations,t&&_!==null&&v!==null?{instanceName:_,agentId:v}:`skip`),j=G(K.agentFileCuration.curationSettings,t&&_!==null?{instanceName:_}:`skip`),ee=L(K.agentFileCuration.requestCuration),[N,F]=(0,X.useState)(null),[R,z]=(0,X.useState)(null),{toast:B}=J(),V=(0,X.useMemo)(()=>{let e=new Map;for(let t of O??[])e.has(t.name)||e.set(t.name,t);return e},[O]),H=(0,X.useCallback)(async e=>{if(!(_===null||v===null)){F(e);try{let t=await ee({instanceName:_,agentId:v,name:e,trigger:`manual`});t.ok?B({title:be(),variant:`success`}):B({title:ne({reason:t.reason??`unknown`}),variant:`error`})}catch{B({title:k(),variant:`error`})}finally{F(null)}}},[ee,_,v,B]),U=M(),W=(0,X.useMemo)(()=>new Intl.NumberFormat(U,{maximumFractionDigits:0}),[U]);return e===void 0||c===void 0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:d()}):(0,Q.jsxs)(`div`,{className:`oc-afiles`,children:[(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:m()}),(0,Q.jsxs)(`div`,{className:`oc-afiles__picker`,children:[t&&(r?.length??0)>1?(0,Q.jsxs)(je,{value:i??``,onValueChange:e=>a(e),children:[(0,Q.jsx)(we,{size:`sm`,"aria-label":Se(),children:(0,Q.jsx)(Fe,{})}),(0,Q.jsx)(Me,{children:(r??[]).map(e=>(0,Q.jsx)(Oe,{value:e.name,children:e.name},e.name))})]}):null,c.length>0?(0,Q.jsxs)(je,{value:l??``,onValueChange:e=>u(e),children:[(0,Q.jsx)(we,{size:`sm`,"aria-label":E(),children:(0,Q.jsx)(Fe,{})}),(0,Q.jsx)(Me,{children:c.map(e=>(0,Q.jsx)(Oe,{value:$(e),children:e.label},$(e)))})]}):(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:Ce()})]}),f===null?null:b===`loading`?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:d()}):b!==null&&b.blocked?(0,Q.jsxs)(`p`,{className:`oc-compat__blocked`,role:`status`,children:[(0,Q.jsx)(Y,{size:14,"aria-hidden":!0}),` `,qe(b.gatewayVersion,b.provider)]}):h.status===`loading`||h.status===`idle`?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:d()}):h.status===`error`?(0,Q.jsxs)(`p`,{className:`oc-afiles__error`,role:`alert`,children:[h.dashboardAbsent?w():S(),` `,!h.dashboardAbsent&&(0,Q.jsx)(q,{variant:`outline`,size:`sm`,onClick:()=>void C(),children:oe()})]}):h.files.length===0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:xe()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`div`,{className:`oc-afiles__list`,children:h.files.map(e=>{let n=Xe(e.size),r=n>=80;return(0,Q.jsxs)(`div`,{className:`oc-afiles__row`,children:[(0,Q.jsx)(`span`,{className:`oc-afiles__name`,title:e.name,children:e.name}),e.missing?(0,Q.jsx)(De,{variant:`outline`,children:te()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`span`,{className:`oc-afiles__size`,children:I({size:Z(e.size,U)})}),(0,Q.jsx)(`span`,{className:`oc-afiles__gauge${r?` is-warn`:``}`,"aria-hidden":!0,children:(0,Q.jsx)(`span`,{className:`oc-afiles__gauge-fill`,style:{width:`${Math.min(n,100)}%`}})}),(0,Q.jsx)(`span`,{className:`oc-afiles__pct`,children:re({pct:W.format(n)})}),r?(0,Q.jsx)(Y,{size:14,className:`oc-afiles__warn`,"aria-label":ce()}):(0,Q.jsx)(`span`,{className:`oc-afiles__warn-slot`,"aria-hidden":!0})]}),(0,Q.jsx)(q,{variant:`outline`,size:`sm`,className:`oc-afiles__open`,onClick:()=>D(e),children:t?A():ye()}),t&&!e.missing?(0,Q.jsx)(it,{curatable:Ke.includes(e.name),size:e.size??0,budget:j?.budgetChars??null,enabled:j?.enabled??!1,curation:V.get(e.name)??null,inFlight:N===e.name,onCurate:()=>void H(e.name),onReview:e=>z(e)}):null]},e.name)})}),(0,Q.jsx)(`p`,{className:`oc-afiles__budget`,children:P({used:Z(Qe(h.files),U),total:Z(Ye,U),pct:W.format(Ze(Qe(h.files)))})})]}),T&&f?(0,Q.jsx)(at,{instanceName:f.instanceName,agentId:f.agentId,name:T.name,isAdmin:t,onClose:()=>D(null),onSaved:()=>void C()}):null,R?(0,Q.jsx)(ot,{curationId:R,onClose:()=>z(null),onApplied:()=>{z(null),C()}}):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)(q,{variant:`default`,size:`sm`,className:`oc-afiles__curate`,onClick:()=>s(i._id),children:F()}):a||i?.status===`dispatched`||i?.status===`applying`?(0,Q.jsx)(De,{variant:`outline`,className:`oc-afiles__curate-status`,children:j()}):e&&r&&n!==null&&Ge(t,n)?(0,Q.jsx)(q,{variant:`outline`,size:`sm`,className:`oc-afiles__curate`,onClick:o,children:le()}):null}function at({instanceName:e,agentId:t,name:n,isAdmin:i,onClose:a,onSaved:o}){let s=L(K.agentFiles.getAgentFile),l=L(K.agentFiles.setAgentFile),u=J(),[p,m]=(0,X.useState)(null),[h,_]=(0,X.useState)(!1),[y,x]=(0,X.useState)(``),[S,w]=(0,X.useState)(!1),[T,E]=(0,X.useState)(!1),[k,A]=(0,X.useState)(!1),[j,N]=(0,X.useState)(!1),P=(0,X.useCallback)(async r=>{_(!1);try{let i=await s({instanceName:e,agentId:t,name:n});m({content:i.content,updatedAtMs:i.updatedAtMs}),r||x(i.content),A(!1)}catch{_(!0)}},[s,e,t,n]);(0,X.useEffect)(()=>{P(!1)},[P]);async function F(){if(p!==null){E(!0),N(!1);try{await l({instanceName:e,agentId:t,name:n,content:y,baseUpdatedAtMs:p.updatedAtMs??void 0}),u.success(fe({name:n})),o(),await P(!1)}catch(e){nt(e)?A(!0):N(!0)}finally{E(!1)}}}let te=p!==null&&y!==p.content,I=(0,X.useMemo)(()=>p===null?null:et(p.content,y),[p,y]),z=y.length>Je,B=M(),V=(0,X.useMemo)(()=>new Intl.NumberFormat(B),[B]);return(0,Q.jsx)(Be,{open:!0,onOpenChange:e=>!e&&a(),children:(0,Q.jsxs)(Ie,{className:`oc-afiles__editor`,children:[(0,Q.jsxs)(Ne,{children:[(0,Q.jsx)(Le,{children:H({name:n})}),(0,Q.jsxs)(ze,{children:[D({agent:t,instance:e}),i?null:(0,Q.jsxs)(Q.Fragment,{children:[` · `,me()]})]})]}),h?(0,Q.jsxs)(`p`,{className:`oc-afiles__error`,role:`alert`,children:[_e(),` `,(0,Q.jsx)(q,{variant:`outline`,size:`sm`,onClick:()=>void P(!1),children:oe()})]}):p===null?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:d()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`textarea`,{className:`oc-afiles__source`,value:y,readOnly:!i,spellCheck:!1,onChange:e=>x(e.target.value),"aria-label":H({name:n})}),(0,Q.jsx)(`p`,{className:`oc-afiles__hint`,children:ae()}),k?(0,Q.jsxs)(`p`,{className:`oc-afiles__error`,role:`alert`,children:[ee(),` `,(0,Q.jsx)(q,{variant:`outline`,size:`sm`,onClick:()=>void P(!0),children:r()})]}):null,j?(0,Q.jsx)(`p`,{className:`oc-afiles__error`,role:`alert`,children:U()}):null,(0,Q.jsxs)(`div`,{className:`oc-afiles__editor-foot`,children:[(0,Q.jsx)(`span`,{className:`oc-afiles__count${z?` is-over`:``}`,children:C({count:V.format(y.length),max:V.format(Je)})}),i?(0,Q.jsx)(q,{size:`sm`,disabled:!te||T||k,onClick:()=>w(!0),children:T?O():R()}):null]})]}),(0,Q.jsx)(Ve,{open:S,onOpenChange:w,children:(0,Q.jsxs)(Ue,{children:[(0,Q.jsxs)(He,{children:[(0,Q.jsx)(Ae,{children:f({name:n})}),(0,Q.jsx)(ke,{children:b({agent:t})})]}),I?(0,Q.jsxs)(`div`,{className:`oc-afiles__diff`,children:[(0,Q.jsx)(`p`,{className:`oc-afiles__diff-counts`,children:g({added:I.added,removed:I.removed})}),I.sampleAdded.length>0?(0,Q.jsxs)(`div`,{className:`oc-afiles__diff-block`,children:[(0,Q.jsx)(`span`,{className:`oc-afiles__diff-label`,children:v()}),I.sampleAdded.map((e,t)=>(0,Q.jsx)(`code`,{className:`oc-afiles__diff-line is-add`,children:e||` `},t))]}):null,I.sampleRemoved.length>0?(0,Q.jsxs)(`div`,{className:`oc-afiles__diff-block`,children:[(0,Q.jsx)(`span`,{className:`oc-afiles__diff-label`,children:c()}),I.sampleRemoved.map((e,t)=>(0,Q.jsx)(`code`,{className:`oc-afiles__diff-line is-del`,children:e||` `},t))]}):null]}):null,(0,Q.jsxs)(Ee,{children:[(0,Q.jsx)(Pe,{children:ge()}),(0,Q.jsx)(We,{onClick:()=>void F(),children:ue()})]})]})})]})})}function ot({curationId:e,onClose:t,onApplied:n}){let r=G(K.agentFileCuration.getProposal,{curationId:e}),c=L(K.agentFileCuration.approveCuration),f=ie(K.agentFileCuration.rejectCuration),{toast:m}=J(),[g,v]=(0,X.useState)(null),[b,S]=(0,X.useState)(!1),[C,w]=(0,X.useState)(``),E=M(),D=(0,X.useMemo)(()=>r?et(r.beforeContent,r.proposedContent):null,[r]);async function A(){v(`approve`);try{let t=await c({curationId:e});t.ok?(m({title:he(),variant:`success`}),n()):m({title:t.reason===`conflict`?T():z({reason:t.reason??`unknown`}),variant:`error`})}catch{m({title:k(),variant:`error`})}finally{v(null)}}async function j(n){v(`reject`);try{let r=C.trim();(await f({curationId:e,...r?{comment:r}:{},relaunch:n})).ok?m({title:n?s():se(),variant:`success`}):m({title:ve(),variant:`error`}),t()}catch{m({title:k(),variant:`error`})}finally{v(null)}}return(0,Q.jsx)(Be,{open:!0,onOpenChange:e=>e?void 0:t(),children:(0,Q.jsxs)(Ie,{className:`oc-afiles__review`,children:[(0,Q.jsxs)(Ne,{children:[(0,Q.jsx)(Le,{children:r?pe({name:r.name}):d()}),(0,Q.jsx)(ze,{children:W()})]}),r===void 0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:d()}):r===null?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:ve()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`p`,{className:`oc-afiles__review-sizes`,children:[N({before:Z(r.beforeSize,E),after:Z(r.proposedSize,E)}),r.overBudget?(0,Q.jsxs)(Q.Fragment,{children:[` `,(0,Q.jsx)(Y,{size:13,"aria-hidden":!0}),` `,i()]}):null]}),D?(0,Q.jsx)(`p`,{className:`oc-afiles__review-diff`,children:p({added:D.added,removed:D.removed})}):null,r.feedback?(0,Q.jsx)(`p`,{className:`oc-afiles__review-feedback`,children:h({feedback:r.feedback})}):null,D&&D.sampleRemoved.length>0?(0,Q.jsxs)(`div`,{className:`oc-afiles__review-removed`,children:[(0,Q.jsx)(`p`,{className:`oc-afiles__review-label`,children:de()}),(0,Q.jsx)(`ul`,{children:D.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:l()}),(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:x()}),(0,Q.jsx)(`pre`,{className:`oc-afiles__review-pre`,children:r.proposedContent})]})]})]}),b?(0,Q.jsxs)(`div`,{className:`oc-afiles__reject-form`,children:[(0,Q.jsx)(`label`,{className:`oc-afiles__review-label`,htmlFor:`curation-reject-comment`,children:B()}),(0,Q.jsx)(`textarea`,{id:`curation-reject-comment`,className:`oc-afiles__reject-textarea`,rows:3,placeholder:a(),value:C,onChange:e=>w(e.target.value)}),(0,Q.jsxs)(`div`,{className:`oc-afiles__review-actions`,children:[(0,Q.jsx)(q,{variant:`ghost`,onClick:()=>S(!1),disabled:g!==null,children:V()}),(0,Q.jsx)(q,{variant:`outline`,onClick:()=>void j(!1),disabled:g!==null,children:g===`reject`?O():u()}),(0,Q.jsx)(q,{variant:`default`,onClick:()=>void j(!0),disabled:g!==null,children:g===`reject`?O():o()})]})]}):(0,Q.jsxs)(`div`,{className:`oc-afiles__review-actions`,children:[(0,Q.jsx)(q,{variant:`outline`,onClick:()=>S(!0),disabled:g!==null||r==null,children:_()}),(0,Q.jsx)(q,{variant:`default`,onClick:()=>void A(),disabled:g!==null||r==null,children:g===`approve`?O():y()})]})]})})}export{rt as AgentFilesTab};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$w as r,Aw as i,Bw as ee,Cw as a,Dw as te,Ew as ne,Fw as re,Gw as ie,Hw as o,Iw as s,Jw as c,Kw as ae,Lw as oe,Mw as se,Nw as l,Ow as ce,Pw as le,Qw as ue,Rw as u,Sw as de,Tw as fe,Uw as pe,Vw as me,Ww as he,Xw as ge,Yw as _e,Zw as ve,_w as d,aT as f,
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$w as r,Aw as i,Bw as ee,Cw as a,Dw as te,Ew as ne,Fw as re,Gw as ie,Hw as o,Iw as s,Jw as c,Kw as ae,Lw as oe,Mw as se,Nw as l,Ow as ce,Pw as le,Qw as ue,Rw as u,Sw as de,Tw as fe,Uw as pe,Vw as me,Ww as he,Xw as ge,Yw as _e,Zw as ve,_w as d,aT as f,bw as p,eT as m,fw as h,gw as g,hw as _,iT as ye,jw as v,kw as be,mw as y,nT as xe,oT as b,oV as Se,pw as x,qw as S,rT as C,sT as w,sV as T,t as E,tT as D,vw as O,ww as k,xw as A,yw as j,zw as Ce}from"./api-Dawxt_aS.js";import{$ as M,Dt as we,Et as N,Gn as P,Kn as Te,Q as F,U as Ee,X as I,Z as L,at as R,ct as z,et as B,i as De,nt as V,o as H,ot as U,q as Oe,tt as W}from"./index-C-ySA5Hs.js";import{n as ke}from"./TimeRangePicker-DVMsYipt.js";import{t as Ae}from"./FilterBar-D_6ObXjr.js";import{t as je}from"./DataTableShell-DGGSIwCx.js";import{t as G}from"./dispatchErrorInfo-d7ehNfS4.js";var K=t(e(),1),q=n(),J=`__all__`,Me=[{value:`open`},{value:`acknowledged`},{value:`resolved`}];function Ne(e){return e===`open`?w():e===`acknowledged`?b():f()}var Pe=[`info`,`warn`,`critical`],Fe=[`detector`,`agent`,`user`],Ie={kind:`relative`,from:`now-30d`,to:`now`},Le=200,Y=`all`;function X(){let e=Te({from:`/settings/anomalies`}),t=P({from:`/settings/anomalies`}),n=e.q??``,d=e.status===Y?J:e.status,f=e.severity??J,h=e.kind??J,[g,_]=(0,K.useState)(J),y=De(e.from,e.to),{from:b,to:x}=ke(y),w=e=>void t({search:t=>({...t,q:e||void 0}),replace:!0}),O=e=>void t({search:t=>({...t,status:e===J?Y:e})}),j=e=>void t({search:t=>({...t,severity:e===J?void 0:e})}),R=e=>void t({search:t=>({...t,kind:e===J?void 0:e})}),V=e=>void t({search:t=>({...t,...H(e)})}),U=Ee(),W=we(),G=Se(E.anomalies.resolveAnomaly),X=(T(E.me.getMe,{host:Oe})?.permissions??[]).includes(`admin.manage`),Z=T(E.anomalies.listAnomalies,{limit:Le,filter:{q:n||void 0,from:b,to:x,anomalyStatus:d===J?void 0:d,severity:f===J?void 0:f,source:g===J?void 0:g,kind:h===J?void 0:h}}),Q=(0,K.useMemo)(()=>{let e=new Set;for(let t of Z??[])e.add(t.kind);return[...e].sort()},[Z]),$=n!==``||d!==`open`||f!==J||g!==J||h!==J||y.kind!==`relative`||y.from!==Ie.from;function Ue(){_(J),t({search:{status:`open`},replace:!0})}async function We(e){if(await U({title:ye(),description:(0,q.jsxs)(q.Fragment,{children:[C(),` `,(0,q.jsx)(`span`,{className:`font-mono`,children:e.kind}),` `,xe(),` `,(0,q.jsx)(`strong`,{children:D()}),`.`,` `,m()]}),confirmLabel:r()}))try{await G({anomalyId:e._id,status:`resolved`}),W.success(ue(),e.kind)}catch(e){W.error(ve(),e)}}async function Ge(e){try{await G({anomalyId:e._id,status:`acknowledged`}),W.success(ge(),e.kind)}catch(e){W.error(_e(),e)}}return(0,q.jsxs)(q.Fragment,{children:[(0,q.jsxs)(`p`,{className:`oc-admin__hint`,children:[c(),` `,(0,q.jsx)(`strong`,{children:S()}),` `,ae(),` `,(0,q.jsx)(`strong`,{children:ie()}),` `,he(),` `,(0,q.jsx)(`strong`,{children:pe()}),` `,o(),` `,(0,q.jsx)(`span`,{className:`oc-filter__window`,children:me()})]}),(0,q.jsxs)(Ae,{q:n,onQChange:w,searchPlaceholder:ee(),timeRange:y,onTimeRangeChange:V,onReset:Ue,canReset:$,children:[(0,q.jsxs)(I,{value:d,onValueChange:O,children:[(0,q.jsx)(M,{size:`sm`,className:`w-36`,children:(0,q.jsx)(B,{})}),(0,q.jsxs)(L,{children:[(0,q.jsx)(F,{value:J,children:Ce()}),Me.map(e=>(0,q.jsx)(F,{value:e.value,children:Ne(e.value)},e.value))]})]}),(0,q.jsxs)(I,{value:f,onValueChange:j,children:[(0,q.jsx)(M,{size:`sm`,className:`w-36`,children:(0,q.jsx)(B,{placeholder:u()})}),(0,q.jsxs)(L,{children:[(0,q.jsx)(F,{value:J,children:le()}),Pe.map(e=>(0,q.jsx)(F,{value:e,children:e},e))]})]}),(0,q.jsxs)(I,{value:g,onValueChange:_,children:[(0,q.jsx)(M,{size:`sm`,className:`w-32`,children:(0,q.jsx)(B,{placeholder:l()})}),(0,q.jsxs)(L,{children:[(0,q.jsx)(F,{value:J,children:se()}),Fe.map(e=>(0,q.jsx)(F,{value:e,children:e},e))]})]}),(0,q.jsxs)(I,{value:h,onValueChange:R,children:[(0,q.jsx)(M,{size:`sm`,className:`w-36`,children:(0,q.jsx)(B,{placeholder:v()})}),(0,q.jsxs)(L,{children:[(0,q.jsx)(F,{value:J,children:i()}),Q.map(e=>(0,q.jsx)(F,{value:e,children:e},e))]})]})]}),(0,q.jsx)(je,{title:be(),rows:Z,emptyHint:d===`open`?ce():te(),rowActions:e=>X&&e.status===`open`?[{label:ne(),onSelect:()=>void We(e)},{label:fe(),onSelect:()=>void Ge(e)}]:[],columns:[{header:k(),cell:e=>(0,q.jsx)(`span`,{className:`oc-traces__time`,children:z(e.at)}),sort:e=>e.at},{header:v(),cell:e=>(0,q.jsx)(`code`,{className:`oc-traces__mono`,children:e.kind}),sort:e=>e.kind},{header:oe(),cell:e=>e.occurrenceCount!==null&&e.occurrenceCount>1?(0,q.jsx)(`span`,{className:`oc-traces__time`,title:e.firstAt===null?void 0:re({when:z(e.firstAt)}),children:s({count:String(e.occurrenceCount)})}):(0,q.jsx)(`span`,{className:`oc-traces__time`,children:`—`}),sort:e=>e.occurrenceCount??0},{header:u(),cell:e=>(0,q.jsx)(Be,{severity:e.severity}),sort:e=>e.severity===`critical`?2:+(e.severity===`warn`)},{header:a(),cell:e=>(0,q.jsx)(Ve,{status:e.status}),sort:e=>e.status===`resolved`?2:+(e.status===`acknowledged`)},{header:l(),cell:e=>(0,q.jsx)(N,{variant:`outline`,children:e.source}),sort:e=>e.source},{header:de(),cell:e=>(0,q.jsxs)(`div`,{className:`oc-anomaly__msgcell`,children:[(0,q.jsx)(`span`,{className:`oc-anomaly__msg`,children:e.message}),(0,q.jsx)(ze,{row:e})]}),sort:e=>e.message},{header:A(),cell:e=>(0,q.jsx)(Re,{row:e}),sort:e=>e.evidence??null},{header:p(),cell:e=>e.correlationId?(0,q.jsx)(`code`,{className:`oc-traces__mono`,children:He(e.correlationId)}):(0,q.jsx)(`span`,{className:`oc-traces__muted`,children:`—`}),sort:e=>e.correlationId}]})]})}var Z=new Set([`openclaw.dispatch_failures`,`assistant.announce_errors`]);function Q(e){if(!Z.has(e.kind)||!e.evidence)return{};try{let t=JSON.parse(e.evidence);return{dominantCode:t.dominantCode,sampleCorrelationId:t.sampleCorrelationId}}catch{return{}}}function $(e){if(e.kind!==`subagent.failure`||!e.evidence)return{};try{let t=JSON.parse(e.evidence);return{failedCount:t.failedCount,totalCount:t.totalCount,errorCategories:t.errorCategories}}catch{return{}}}function Re({row:e}){let t=P();if(e.kind===`subagent.failure`){let n=$(e);return(0,q.jsxs)(`div`,{className:`oc-anomaly__cause`,children:[(0,q.jsx)(`div`,{className:`oc-anomaly__cause-head`,children:[...new Set(n.errorCategories??[])].map(e=>(0,q.jsx)(`code`,{className:`oc-traces__mono`,children:e},e))}),e.correlationId?(0,q.jsxs)(`button`,{type:`button`,className:`oc-anomaly__drill`,onClick:()=>void t({to:`/settings/traces`,search:{q:e.correlationId,limit:100}}),children:[`↗ `,j()]}):null]})}let n=Q(e);if(!n.dominantCode){let e=n.sampleCorrelationId;return e?(0,q.jsx)(`div`,{className:`oc-anomaly__cause`,children:(0,q.jsxs)(`button`,{type:`button`,className:`oc-anomaly__drill`,onClick:()=>void t({to:`/settings/traces`,search:{correlationId:e,limit:100}}),children:[`↗ `,j()]})}):(0,q.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})}let r=G(n.dominantCode),i=n.sampleCorrelationId;return(0,q.jsxs)(`div`,{className:`oc-anomaly__cause`,children:[(0,q.jsxs)(`div`,{className:`oc-anomaly__cause-head`,children:[(0,q.jsx)(`span`,{className:`oc-anomaly__cause-label`,children:r.label}),(0,q.jsx)(`code`,{className:`oc-traces__mono`,children:n.dominantCode})]}),(0,q.jsx)(`p`,{className:`oc-anomaly__cause-hint`,children:r.hint}),i?(0,q.jsxs)(`button`,{type:`button`,className:`oc-anomaly__drill`,onClick:()=>void t({to:`/settings/traces`,search:{correlationId:i,limit:100}}),children:[`↗ `,j()]}):null]})}function ze({row:e}){let[t,n]=(0,K.useState)(!1),r=T(E.anomalies.getAnomalyAttachments,t?{anomalyId:e._id}:`skip`);return!e.attachments||e.attachments.length===0?null:(0,q.jsxs)(q.Fragment,{children:[(0,q.jsxs)(`button`,{type:`button`,className:`oc-anomaly__drill`,onClick:()=>n(!0),children:[O(),e.attachments.length>1?` (${e.attachments.length})`:``]}),(0,q.jsx)(W,{open:t,onOpenChange:n,children:(0,q.jsxs)(V,{className:`oc-anomaly__attachments-dialog`,children:[(0,q.jsx)(R,{children:(0,q.jsx)(U,{children:d()})}),r===void 0?(0,q.jsx)(`p`,{className:`oc-traces__muted`,children:g()}):r.length===0?(0,q.jsx)(`p`,{className:`oc-traces__muted`,children:_()}):(0,q.jsx)(`div`,{className:`oc-anomaly__attachments`,children:r.map(e=>(0,q.jsxs)(`section`,{className:`oc-anomaly__attachment`,children:[(0,q.jsx)(`h4`,{className:`oc-anomaly__attachment-name`,children:(0,q.jsx)(`code`,{className:`oc-traces__mono`,children:e.name})}),(0,q.jsx)(`pre`,{className:`oc-anomaly__attachment-content`,children:e.content})]},e.name))})]})})]})}function Be({severity:e}){return(0,q.jsx)(`span`,{className:`oc-anomaly__sev oc-anomaly__sev--${e}`,children:e})}function Ve({status:e}){return e===`open`?(0,q.jsx)(N,{variant:`destructive`,children:y()}):e===`acknowledged`?(0,q.jsx)(N,{variant:`secondary`,children:x()}):(0,q.jsx)(N,{variant:`outline`,children:h()})}function He(e){return e.length>8?e.slice(0,8):e}export{X as AnomaliesTab};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$T as r,Ca as i,Da as a,Ea as o,Sa as s,Ta as c,aE as l,cE as u,dE as d,eE as f,fE as p,iE as m,lE as h,nE as g,oE as _,
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$T as r,Ca as i,Da as a,Ea as o,Sa as s,Ta as c,aE as l,cE as u,dE as d,eE as f,fE as p,iE as m,lE as h,nE as g,oE as _,pE as v,rE as y,sE as b,sV as x,t as S,tE as C,uE as w,wa as T}from"./api-Dawxt_aS.js";import{$ as E,Gn as D,Kn as O,Q as k,X as A,Z as j,a as M,ct as N,et as P,i as F,n as I,o as L,s as R}from"./index-C-ySA5Hs.js";import{n as ee}from"./TimeRangePicker-DVMsYipt.js";import{t as z}from"./FilterBar-D_6ObXjr.js";import{t as B}from"./AdvancedFilter-DzABuYe4.js";import{t as V}from"./DataTableShell-DGGSIwCx.js";var H=t(e(),1),U=n(),W={kind:`relative`,from:I,to:`now`},G=`__all__`,K=[{value:`action`,label:a()},{value:`realLabel`,label:o()},{value:`targetLabel`,label:c()},{value:`impersonated`,label:T()},{value:`resource`,label:i()},{value:`resourceId`,label:s()}];function q(){let e=O({from:`/settings/audit`}),t=D({from:`/settings/audit`}),n=e.q??``,i=e.action??G,a=e.impersonated??G,o=e.resource??G,s=F(e.from,e.to),c=(0,H.useMemo)(()=>R(e.adv),[e.adv]),{from:T,to:I}=ee(s),q=e=>void t({search:t=>({...t,q:e||void 0}),replace:!0}),J=e=>void t({search:t=>({...t,action:e===G?void 0:e})}),Y=e=>void t({search:t=>({...t,impersonated:e===G?void 0:e})}),X=e=>void t({search:t=>({...t,resource:e===G?void 0:e})}),Z=e=>void t({search:t=>({...t,...L(e)})}),Q=e=>void t({search:t=>({...t,adv:M(e)}),replace:!0}),$=x(S.admin.listAudit,{filter:{q:n||void 0,from:T,to:I,action:i===G?void 0:i,resource:o===G?void 0:o,impersonated:a===G?void 0:a===`yes`,advanced:c.length>0?c:void 0}}),te=(0,H.useMemo)(()=>{let e=new Set;for(let t of $??[])e.add(t.action);return[...e].sort()},[$]),ne=(0,H.useMemo)(()=>{let e=new Set;for(let t of $??[])t.resource&&e.add(t.resource);return[...e].sort()},[$]),re=n!==``||i!==G||a!==G||o!==G||c.length>0||s.kind!==`relative`||s.from!==W.from;function ie(){t({search:{},replace:!0})}return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(`p`,{className:`oc-admin__hint`,children:[v(),` `,(0,U.jsx)(`span`,{className:`oc-filter__window`,children:p()})]}),(0,U.jsxs)(z,{q:n,onQChange:q,searchPlaceholder:d(),timeRange:s,onTimeRangeChange:Z,onReset:ie,canReset:re,children:[(0,U.jsxs)(A,{value:i,onValueChange:J,children:[(0,U.jsx)(E,{size:`sm`,className:`w-40`,children:(0,U.jsx)(P,{placeholder:w()})}),(0,U.jsxs)(j,{children:[(0,U.jsx)(k,{value:G,children:h()}),te.map(e=>(0,U.jsx)(k,{value:e,children:e},e))]})]}),(0,U.jsxs)(A,{value:a,onValueChange:Y,children:[(0,U.jsx)(E,{size:`sm`,className:`w-40`,children:(0,U.jsx)(P,{})}),(0,U.jsxs)(j,{children:[(0,U.jsx)(k,{value:G,children:u()}),(0,U.jsx)(k,{value:`yes`,children:b()}),(0,U.jsx)(k,{value:`no`,children:_()})]})]}),(0,U.jsxs)(A,{value:o,onValueChange:X,children:[(0,U.jsx)(E,{size:`sm`,className:`w-40`,children:(0,U.jsx)(P,{placeholder:l()})}),(0,U.jsxs)(j,{children:[(0,U.jsx)(k,{value:G,children:m()}),ne.map(e=>(0,U.jsx)(k,{value:e,children:e},e))]})]})]}),(0,U.jsx)(B,{fields:K,seed:c,onChange:Q}),(0,U.jsx)(V,{title:y(),rows:$,emptyHint:g(),columns:[{header:C(),cell:e=>N(e.at),sort:e=>e.at},{header:w(),cell:e=>e.action,sort:e=>e.action},{header:f(),cell:e=>e.realLabel,sort:e=>e.realLabel},{header:r(),cell:e=>e.targetLabel??`—`,sort:e=>e.targetLabel??null},{header:l(),cell:e=>e.resource?e.resource+(e.resourceId?` · ${e.resourceId.slice(0,8)}`:``):`—`,sort:e=>e.resource??null}]})]})}export{q as AuditTab};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$b as r,$x as i,Ad as a,Ax as o,Bb as s,Cx as c,D as l,Dd as u,Dx as d,Ed as f,Ex as p,Fb as m,Fd as h,Gb as g,Gi as _,Hb as v,Ib as y,Id as b,Jb as x,Ji as ee,Kb as S,Ki as te,Lb as ne,Mb as re,Md as ie,Nb as ae,Nd as oe,Od as se,Ox as ce,Pb as C,Pd as le,Qb as ue,Qx as de,Rb as fe,Sx as pe,Td as me,Tx as he,Ub as ge,Vb as _e,Wb as ve,Wi as ye,Xb as be,Yb as xe,Zb as Se,Zi as Ce,_x as we,aS as Te,aV as Ee,ax as De,bx as Oe,cS as ke,cx as Ae,dS as je,dx as Me,ex as Ne,fS as Pe,fx as Fe,gx as Ie,hx as Le,iS as Re,ix as ze,j as Be,jd as w,kd as Ve,kx as He,lS as Ue,lx as We,mx as Ge,nS as Ke,nx as qe,oS as Je,oV as T,on as Ye,ox as Xe,px as Ze,qb as Qe,qi as $e,rS as et,rV as tt,rx as nt,sS as rt,sx as E,t as D,tx as it,ux as at,vx as ot,wd as st,wx as ct,xx as lt,yd as ut,yx as dt,zb as ft}from"./api-DRlXTl06.js";import{t as pt}from"./chevrons-up-down-BCCw67LL.js";import{i as mt,n as O,o as ht,r as gt,s as _t}from"./FieldLabel-CrPuHD7O.js";import{i as vt,n as yt,r as bt,t as xt}from"./tabs-KQ0HdNTL.js";import{t as St}from"./button-CTuIl1H-.js";import{$ as k,Bn as A,Bt as Ct,Dn as wt,Dt as Tt,Et as j,F as Et,Gn as Dt,Hn as M,Kn as Ot,Q as N,Rn as kt,Rt as At,X as P,Z as F,at as jt,ct as Mt,et as I,jt as L,lt as R,nt as Nt,ot as Pt,pn as z,q as Ft,rt as It,tt as Lt,un as B,ut as Rt,zn as zt,zt as Bt}from"./index-D48cFy6f.js";import{r as Vt}from"./locales-CPjguROj.js";import{a as Ht,i as V,n as Ut,o as H,r as U,t as Wt}from"./table-D0yilGWI.js";import{t as Gt}from"./FilterBar-Of8GWz2N.js";import{c as Kt,i as qt,n as Jt,o as Yt,r as Xt,s as Zt,t as Qt}from"./compatView-DGV2AVAR.js";import{t as W}from"./dispatchErrorInfo-ZyhGCDRg.js";var $t=l(`refresh-cw`,[[`path`,{d:`M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8`,key:`v9h5vc`}],[`path`,{d:`M21 3v5h-5`,key:`1q7to0`}],[`path`,{d:`M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16`,key:`3uifl3`}],[`path`,{d:`M8 16H3v5`,key:`1cv678`}]]),en=l(`wifi-off`,[[`path`,{d:`M12 20h.01`,key:`zekei9`}],[`path`,{d:`M8.5 16.429a5 5 0 0 1 7 0`,key:`1bycff`}],[`path`,{d:`M5 12.859a10 10 0 0 1 5.17-2.69`,key:`1dl1wf`}],[`path`,{d:`M19 12.859a10 10 0 0 0-2.007-1.523`,key:`4k23kn`}],[`path`,{d:`M2 8.82a15 15 0 0 1 4.177-2.643`,key:`1grhjp`}],[`path`,{d:`M22 8.82a15 15 0 0 0-11.288-3.764`,key:`z3jwby`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}]]),G=t(e(),1);function tn(e){return e.filter(e=>e.state===`error`)}function nn(e){return e.reachable&&tn(e.targets).length===0}function rn(e){return nn(e)?(e.unreachableInstances??[]).length>0?`gateways_unreachable`:`ok`:`error`}function an(e){return e.state===`error`&&e.lastErrorCode!==null}function on(e){return!!e.lastDownstreamRejectCode}function sn(e){return!!e.lastLocalRefusalCode}function cn(e){return an(e)||on(e)||sn(e)}function K(e){return e.kind??`openclaw`}function ln(e){return[...e].sort((e,t)=>e===`openclaw`?-1:t===`openclaw`?1:e.localeCompare(t))}function un(e,t,n){let r=new Map;for(let e of t)e.instanceName&&r.set(e.instanceName,e.provider);for(let e of n)r.set(e.name,K(e));let i=e=>(e.instanceName?r.get(e.instanceName):void 0)??`openclaw`,a=new Set;for(let e of n)a.add(K(e));for(let e of t)a.add(e.provider);for(let t of e)a.add(i(t));return ln(a).map(r=>({key:r,connections:e.filter(e=>i(e)===r),compatTargets:t.filter(e=>e.provider===r),instances:n.filter(e=>K(e)===r)}))}function q(e){return e===`openclaw`?`OpenClaw`:e===`hermes`?`Hermes`:e.charAt(0).toUpperCase()+e.slice(1)}var J=`__all__`,dn={q:``,state:J,instance:J,version:J},Y={connected:0,error:1,idle:2};function fn(e){return e.q.trim()!==``||e.state!==`__all__`||e.instance!==`__all__`||e.version!==`__all__`}function pn(e,t){let n=t.q.trim().toLowerCase();return e.filter(e=>!(n&&!`${e.targetLabel} ${e.gatewayHost}`.toLowerCase().includes(n)||t.state!==`__all__`&&e.state!==t.state||t.instance!==`__all__`&&(e.instanceName??``)!==t.instance||t.version!==`__all__`&&(e.gatewayVersion??``)!==t.version))}function X(e,t){return e.localeCompare(t,void 0,{numeric:!0,sensitivity:`base`})}function mn(e,t){return e===`version`?t.gatewayVersion===null:e===`lastOk`?t.lastOkAt===null:!1}function hn(e,t,n){switch(e){case`state`:return(Y[t.state]??99)-(Y[n.state]??99);case`instance`:return X(t.instanceLabel??t.instanceName??``,n.instanceLabel??n.instanceName??``);case`host`:return X(t.gatewayHost,n.gatewayHost);case`version`:{let e=t.gatewayVersion,r=n.gatewayVersion;return Zt(e,r)??X(e,r)}case`lastOk`:return t.lastOkAt-n.lastOkAt;default:return X(t.targetLabel,n.targetLabel)}}function gn(e,t){if(!t)return e;let n=t.dir===`asc`?1:-1;return[...e].sort((e,r)=>{let i=mn(t.key,e),a=mn(t.key,r);return i&&a?0:i?1:a?-1:n*hn(t.key,e,r)})}function _n(e){let t=new Set;for(let n of e)t.add(n.state);return[...t].sort((e,t)=>(Y[e]??99)-(Y[t]??99))}function vn(e){let t=new Map;for(let n of e)n.instanceName!==null&&(t.has(n.instanceName)||t.set(n.instanceName,n.instanceLabel??n.instanceName));return[...t.entries()].map(([e,t])=>({name:e,label:t})).sort((e,t)=>X(e.label,t.label))}function yn(e){let t=new Set;for(let n of e)n.gatewayVersion!==null&&t.add(n.gatewayVersion);return[...t].sort((e,t)=>Zt(e,t)??X(e,t))}var Z=n();function bn({connections:e,displayByInstance:t}){let[n,r]=(0,G.useState)(dn),[i,a]=(0,G.useState)(null),o=(0,G.useMemo)(()=>e.map((e,n)=>({_id:`${e.key}:${e.canonical}/${e.agentId}:${n}`,targetLabel:`${e.canonical}/${e.agentId}`,state:e.state,instanceName:e.instanceName??null,instanceLabel:e.instanceName?t.get(e.instanceName)??e.instanceName:null,gatewayHost:e.gatewayHost,gatewayVersion:e.gatewayVersion??null,okCount:e.okCount,errorCount:e.errorCount+(e.downstreamRejectCount??0)+(e.localRefusalCount??0),attempts:e.attempts,lastOkAt:e.lastOkAt??null,lastErrorCode:e.lastErrorCode??null,lastErrorAt:e.lastErrorAt??null,lastDownstreamRejectCode:e.lastDownstreamRejectCode??null,lastDownstreamRejectAt:e.lastDownstreamRejectAt??null,lastLocalRefusalCode:e.lastLocalRefusalCode??null,lastLocalRefusalAt:e.lastLocalRefusalAt??null})),[e,t]),c=(0,G.useMemo)(()=>_n(o),[o]),l=(0,G.useMemo)(()=>vn(o),[o]),u=(0,G.useMemo)(()=>yn(o),[o]),d=(0,G.useMemo)(()=>gn(pn(o,n),i),[o,n,i]);function f(e){a(t=>t?.key===e?t.dir===`asc`?{key:e,dir:`desc`}:null:{key:e,dir:`asc`})}return e.length===0?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:be()}):(0,Z.jsxs)(`div`,{className:`oc-conn`,children:[(0,Z.jsxs)(Gt,{q:n.q,onQChange:e=>r(t=>({...t,q:e})),searchPlaceholder:Qe(),onReset:()=>r(dn),canReset:fn(n),children:[(0,Z.jsxs)(P,{value:n.state,onValueChange:e=>r(t=>({...t,state:e})),children:[(0,Z.jsx)(k,{size:`sm`,className:`w-36`,children:(0,Z.jsx)(I,{placeholder:g()})}),(0,Z.jsxs)(F,{children:[(0,Z.jsx)(N,{value:J,children:S()}),c.map(e=>(0,Z.jsx)(N,{value:e,children:Sn(e)},e))]})]}),(0,Z.jsxs)(P,{value:n.instance,onValueChange:e=>r(t=>({...t,instance:e})),children:[(0,Z.jsx)(k,{size:`sm`,className:`w-40`,children:(0,Z.jsx)(I,{placeholder:ve()})}),(0,Z.jsxs)(F,{children:[(0,Z.jsx)(N,{value:J,children:S()}),l.map(e=>(0,Z.jsx)(N,{value:e.name,children:e.label},e.name))]})]}),(0,Z.jsxs)(P,{value:n.version,onValueChange:e=>r(t=>({...t,version:e})),children:[(0,Z.jsx)(k,{size:`sm`,className:`w-36`,children:(0,Z.jsx)(I,{placeholder:ge()})}),(0,Z.jsxs)(F,{children:[(0,Z.jsx)(N,{value:J,children:S()}),u.map(e=>(0,Z.jsx)(N,{value:e,children:e},e))]})]})]}),d.length===0?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:v()}):(0,Z.jsxs)(Wt,{className:`oc-conn__table`,children:[(0,Z.jsx)(Ht,{children:(0,Z.jsxs)(H,{children:[(0,Z.jsx)(Q,{label:_e(),sortKey:`target`,sort:i,onSort:f}),(0,Z.jsx)(Q,{label:s(),sortKey:`state`,sort:i,onSort:f}),(0,Z.jsx)(Q,{label:ft(),sortKey:`instance`,sort:i,onSort:f}),(0,Z.jsx)(Q,{label:fe(),sortKey:`host`,sort:i,onSort:f}),(0,Z.jsx)(Q,{label:ne(),sortKey:`version`,sort:i,onSort:f}),(0,Z.jsx)(V,{children:y()}),(0,Z.jsx)(Q,{label:m(),sortKey:`lastOk`,sort:i,onSort:f})]})}),(0,Z.jsx)(Ut,{children:d.map(e=>(0,Z.jsx)(xn,{r:e},e._id))})]})]})}function Q({label:e,sortKey:t,sort:n,onSort:r}){let i=n?.key===t,a=i?n.dir:null;return(0,Z.jsx)(V,{"aria-sort":i?a===`asc`?`ascending`:`descending`:`none`,children:(0,Z.jsxs)(`button`,{type:`button`,className:`oc-conn__sort`,onClick:()=>r(t),children:[e,i?a===`asc`?(0,Z.jsx)(zt,{size:13,"aria-hidden":!0}):(0,Z.jsx)(M,{size:13,"aria-hidden":!0}):(0,Z.jsx)(pt,{size:13,"aria-hidden":!0,className:`oc-conn__sort-idle`})]})})}function xn({r:e}){let t=an(e)?W(e.lastErrorCode):null,n=on(e)?W(e.lastDownstreamRejectCode):null,r=sn(e)?W(e.lastLocalRefusalCode):null;return(0,Z.jsxs)(G.Fragment,{children:[(0,Z.jsxs)(H,{className:`oc-conn__row oc-conn__row--${e.state}`,children:[(0,Z.jsx)(U,{children:(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:e.targetLabel})}),(0,Z.jsx)(U,{children:(0,Z.jsx)(Cn,{state:e.state})}),(0,Z.jsx)(U,{children:e.instanceLabel?(0,Z.jsx)(`span`,{className:`oc-bridge-target__instance`,children:e.instanceLabel}):(0,Z.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})}),(0,Z.jsx)(U,{children:(0,Z.jsx)(`span`,{className:`oc-bridge-target__host`,children:e.gatewayHost})}),(0,Z.jsx)(U,{children:e.gatewayVersion?(0,Z.jsx)(`span`,{className:`oc-bridge-target__version`,children:e.gatewayVersion}):(0,Z.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})}),(0,Z.jsx)(U,{children:(0,Z.jsx)(`span`,{className:`oc-conn__stats`,children:xe({ok:e.okCount,errors:e.errorCount,attempts:e.attempts})})}),(0,Z.jsx)(U,{children:e.lastOkAt?(0,Z.jsx)(`span`,{className:`oc-traces__mono`,children:R(e.lastOkAt)}):(0,Z.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})})]}),cn(e)?(0,Z.jsx)(H,{className:`oc-conn__detail-row`,children:(0,Z.jsxs)(U,{colSpan:7,className:`oc-conn__detail-cell`,children:[t?(0,Z.jsxs)(`div`,{className:`oc-bridge-target__error`,children:[(0,Z.jsx)(`strong`,{children:t.label}),` `,(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:e.lastErrorCode}),e.lastErrorAt?` · ${R(e.lastErrorAt)}`:``,(0,Z.jsx)(`p`,{className:`oc-bridge-card__hint`,children:t.hint})]}):null,r?(0,Z.jsxs)(`div`,{className:`oc-bridge-target__downstream`,children:[Be({label:r.label}),` `,(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:e.lastLocalRefusalCode}),e.lastLocalRefusalAt?` · ${R(e.lastLocalRefusalAt)}`:``,(0,Z.jsx)(`p`,{className:`oc-bridge-card__hint`,children:r.hint})]}):null,n?(0,Z.jsxs)(`div`,{className:`oc-bridge-target__downstream`,children:[x({label:n.label}),` `,(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:e.lastDownstreamRejectCode}),e.lastDownstreamRejectAt?` · ${R(e.lastDownstreamRejectAt)}`:``]}):null]})}):null]})}function Sn(e){return e===`connected`?C():e===`error`?ae():re()}function Cn({state:e}){return e===`connected`?(0,Z.jsx)(j,{variant:`secondary`,children:C()}):e===`error`?(0,Z.jsx)(j,{variant:`destructive`,children:ae()}):(0,Z.jsx)(j,{variant:`outline`,children:re()})}function wn(){return T(D.bridgeHealth.getBridgeHealth,{})}function Tn(){let e=wn(),t=T(D.compat.getBridgeCompat,{}),n=T(D.me.getMe,{host:Ft})?.role===`admin`,r=T(D.admin.listInstances,n?{}:`skip`),i=T(D.agents.usageForInstances,n?{}:`skip`),a=Dt(),o=()=>void a({to:`/settings/anomalies`,search:{status:`open`}}),s=un(e?e.targets:[],t?t.targets:[],r??[]),{section:c}=Ot({from:`/settings/bridge`}),l=Dt({from:`/settings/bridge`}),u=t?.compat??null,d=t===void 0?`loading`:t===null?`nodata`:`ready`,f=u!==null&&Xt(u,`hermes`)&&!s.some(e=>e.key===`hermes`);return(0,Z.jsxs)(`div`,{className:`oc-bridge`,children:[(0,Z.jsx)(En,{health:e,compat:t,onSeeAnomalies:o}),(0,Z.jsx)(`p`,{className:`oc-admin__hint oc-bridge__caption`,children:Ie()}),i&&i.length>0?(0,Z.jsxs)(`section`,{className:`oc-bridge__usage`,children:[(0,Z.jsx)(`h3`,{className:`oc-bridge__usage-title`,children:Le()}),(0,Z.jsxs)(Wt,{children:[(0,Z.jsx)(Ht,{children:(0,Z.jsxs)(H,{children:[(0,Z.jsx)(V,{children:ee()}),(0,Z.jsx)(V,{children:$e()}),(0,Z.jsx)(V,{children:te()}),(0,Z.jsx)(V,{children:_()}),(0,Z.jsx)(V,{children:ye()})]})}),(0,Z.jsx)(Ut,{children:i.flatMap(e=>{let t=Et(e.usage,Date.now());return t?t.windows.map((t,n)=>(0,Z.jsxs)(H,{children:[(0,Z.jsx)(U,{className:`font-medium`,children:n===0?e.instanceName:``}),(0,Z.jsx)(U,{children:t.provider}),(0,Z.jsx)(U,{children:t.label}),(0,Z.jsx)(U,{children:(0,Z.jsxs)(j,{variant:t.percentLeft<=10?`destructive`:t.percentLeft<=25?`outline`:`secondary`,children:[t.percentLeft,`%`]})}),(0,Z.jsx)(U,{className:`text-muted-foreground`,children:t.resetText??`—`})]},`${e.instanceName}:${t.provider}:${t.label}`)):[]})})]})]}):null,s.length>0?(0,Z.jsxs)(xt,{value:s.some(e=>e.key===c)?c:s[0]?.key??`openclaw`,onValueChange:e=>void l({search:{section:e},replace:!0}),children:[(0,Z.jsx)(bt,{className:`w-full`,children:s.map(e=>(0,Z.jsxs)(vt,{value:e.key,className:`flex-1 gap-1.5`,children:[(0,Z.jsx)(z,{size:13,"aria-hidden":!0}),q(e.key)]},e.key))}),s.map(e=>(0,Z.jsx)(yt,{value:e.key,children:(0,Z.jsx)(Dn,{providerKey:e.key,connections:e.connections,instances:e.instances,manifest:u,compatStatus:d,compatReachable:t?.reachable??!0,protocol:e.key===`openclaw`?t?.protocol??null:null})},e.key))]}):null,f?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:ut()}):null]})}function En({health:e,compat:t,onSeeAnomalies:n}){let i=t!=null&&t.buildVersion!=null&&t.bridgeVersion!=null&&t.buildVersion!==t.bridgeVersion,a=t?.buildRevision&&t.buildRevision!==`unknown`?t.buildRevision.slice(0,7):null,o=t&&t!==null?(0,Z.jsxs)(`span`,{className:`oc-bridge-card__ver`,children:[(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:Yt(t.bridgeVersion)}),a?(0,Z.jsxs)(Z.Fragment,{children:[` `,(0,Z.jsxs)(`code`,{className:`oc-traces__mono`,title:le(),children:[`(`,a,`)`]})]}):null,i?(0,Z.jsxs)(`strong`,{className:`oc-bridge-card__mismatch`,children:[` `,oe({build:t.buildVersion??`?`})]}):null,` · `,ie(),` `,(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:t.protocolVersion===null?w():String(t.protocolVersion)})]}):null;if(e===void 0)return(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:E()});if(e===null)return(0,Z.jsx)(`div`,{className:`oc-bridge-card oc-bridge-card--idle`,children:Xe()});let s=tn(e.targets),c=!e.reachable,l=rn(e),u=e.unreachableInstances??[],d=l===`ok`?`ok`:l===`gateways_unreachable`?`warn`:`error`,f=Mt(e.checkedAt),p=e.startedAt==null?null:Mt(e.startedAt);return(0,Z.jsxs)(`div`,{className:`oc-bridge-card oc-bridge-card--${d}`,children:[(0,Z.jsx)(`div`,{className:`oc-bridge-card__icon`,"aria-hidden":!0,children:l===`ok`?(0,Z.jsx)(kt,{size:22}):c||l===`gateways_unreachable`?(0,Z.jsx)(en,{size:22}):(0,Z.jsx)(B,{size:22})}),(0,Z.jsxs)(`div`,{className:`oc-bridge-card__body`,children:[(0,Z.jsx)(`div`,{className:`oc-bridge-card__title`,children:l===`ok`?De():l===`gateways_unreachable`?it({count:u.length}):c?ze():nt({count:s.length})}),(0,Z.jsxs)(`div`,{className:`oc-bridge-card__meta`,children:[(0,Z.jsxs)(`span`,{children:[(0,Z.jsx)($t,{size:12,"aria-hidden":!0}),` `,qe({time:f})]}),p?(0,Z.jsx)(`span`,{children:r({time:p})}):null,o]}),l===`gateways_unreachable`?(0,Z.jsx)(`p`,{className:`oc-bridge-card__hint`,children:Ne({names:u.join(`, `)})}):null,c?(0,Z.jsx)(`p`,{className:`oc-bridge-card__hint`,children:W(e.lastError===`not_configured`?`NOT_CONFIGURED`:`BRIDGE_UNREACHABLE`).hint}):null]}),(0,Z.jsx)(`button`,{type:`button`,className:`oc-bridgebar__drill`,onClick:n,children:ue()})]})}function Dn({providerKey:e,connections:t,instances:n,manifest:r,compatStatus:i,compatReachable:a,protocol:o}){let s=r?Kt(r,e):null,c=new Map;for(let e of n)c.set(e.name,e.displayName??e.name);let l=[],u=new Set;for(let n of t){if(!n.instanceName||u.has(n.instanceName))continue;u.add(n.instanceName);let t=n.gatewayVersion??null;l.push({instanceName:n.instanceName,displayName:c.get(n.instanceName)??n.instanceName,version:t,state:Jt(t,e,r)})}let d=Qt(l.map(e=>e.state)),[f,p]=(0,G.useState)(!1);return(0,Z.jsxs)(`section`,{className:`oc-bridge-provider`,children:[(0,Z.jsxs)(`header`,{className:`oc-bridge-provider__head`,children:[(0,Z.jsx)(z,{size:15,"aria-hidden":!0,className:`oc-bridge-provider__icon`}),(0,Z.jsx)(`span`,{className:`oc-bridge-provider__name`,children:q(e)}),d?(0,Z.jsx)(j,{variant:d===`beyond`||d===`defective`?`destructive`:`secondary`,children:qt(d)}):null]}),(0,Z.jsx)(`h4`,{className:`oc-bridge-provider__sub`,children:b()}),(0,Z.jsx)(kn,{providerName:q(e),support:s,compatStatus:i,compatReachable:a,manifest:r,instanceRows:l}),o?(0,Z.jsx)(On,{protocol:o}):null,(0,Z.jsxs)(`button`,{type:`button`,className:`oc-bridge-provider__sub oc-bridge-provider__sub--toggle`,"aria-expanded":f,onClick:()=>p(e=>!e),children:[f?(0,Z.jsx)(M,{size:13,"aria-hidden":!0}):(0,Z.jsx)(A,{size:13,"aria-hidden":!0}),Se({count:t.length})]}),f?(0,Z.jsx)(bn,{connections:t,displayByInstance:c}):null]})}function On({protocol:e}){let[t,n]=(0,G.useState)(!1),r=e.coverage,i=e.drift??[],a=(e.driftOverflow??0)+(e.driftTruncated??0);return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`h4`,{className:`oc-bridge-provider__sub`,children:[Ge(),i.length>0?(0,Z.jsx)(j,{variant:`destructive`,children:Fe({count:i.length})}):a>0?(0,Z.jsx)(j,{variant:`destructive`,children:Me()}):(0,Z.jsx)(j,{variant:`secondary`,children:Ze()})]}),(0,Z.jsxs)(`p`,{className:`oc-admin__hint`,children:[at({version:e.vendoredVersion}),r?` · `+We({handled:r.handled,ignored:r.ignored,gaps:r.gaps}):null]}),a>0?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:Ye({overflow:e.driftOverflow??0,truncated:e.driftTruncated??0})}):null,i.length>0?(0,Z.jsx)(`ul`,{className:`oc-bridge-protocol__list`,role:`list`,children:i.map(e=>(0,Z.jsxs)(`li`,{children:[(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:e.shape}),` × `,e.count]},e.shape))}):null,r&&r.gapList.length>0?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`button`,{type:`button`,className:`oc-bridge-provider__sub oc-bridge-provider__sub--toggle`,"aria-expanded":t,onClick:()=>n(e=>!e),children:[t?(0,Z.jsx)(M,{size:13,"aria-hidden":!0}):(0,Z.jsx)(A,{size:13,"aria-hidden":!0}),Ae({count:r.gapList.length})]}),t?(0,Z.jsx)(`ul`,{className:`oc-bridge-protocol__list`,role:`list`,children:r.gapList.map(e=>(0,Z.jsx)(`li`,{children:(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:e})},e))}):null]}):null]})}function kn({support:e,compatStatus:t,compatReachable:n,manifest:r,instanceRows:i,providerName:o}){return t===`loading`?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:E()}):t===`nodata`?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:h()}):(0,Z.jsxs)(`div`,{className:`oc-compat`,children:[n?null:(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:a()}),r===null?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:Ve()}):(0,Z.jsxs)(`div`,{className:`oc-compat__support`,children:[(0,Z.jsx)(`span`,{className:`oc-compat__label`,children:Ce({provider:o})}),e&&e.range!==null?(0,Z.jsx)(`span`,{children:se({min:e.range.min,max:e.range.maxValidated})}):(0,Z.jsx)(`span`,{children:w()}),e?(0,Z.jsx)(Mn,{versions:e.validatedVersions}):null]}),i.length===0?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:st()}):(0,Z.jsx)(`div`,{className:`oc-compat__targets`,children:i.map(e=>(0,Z.jsxs)(`div`,{className:`oc-compat__target`,children:[(0,Z.jsx)(`span`,{className:`oc-compat__instance`,children:e.displayName}),(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:Yt(e.version)}),(0,Z.jsx)(j,{variant:e.state===`supported`?`secondary`:e.state===`beyond`||e.state===`defective`?`destructive`:`outline`,children:qt(e.state)})]},e.instanceName))})]})}function An({instance:e,onClose:t}){return(0,Z.jsx)(Lt,{open:!0,onOpenChange:e=>!e&&t(),children:(0,Z.jsxs)(Nt,{className:`oc-bridge-config-dialog`,onOpenAutoFocus:e=>e.preventDefault(),children:[(0,Z.jsxs)(jt,{children:[(0,Z.jsx)(Pt,{children:Pe({instance:e.displayName??e.name})}),(0,Z.jsx)(It,{children:je()})]}),(0,Z.jsx)(jn,{instance:e,onClose:t})]})})}function $({label:e,result:t}){return t?t.checked?(0,Z.jsxs)(`p`,{className:`oc-bridge-config__check-row `+(t.ok?`oc-bridge-config__check-row--ok`:`oc-bridge-config__check-row--err`),children:[t.ok?(0,Z.jsx)(kt,{"aria-hidden":!0}):(0,Z.jsx)(B,{"aria-hidden":!0}),(0,Z.jsxs)(`span`,{children:[e,` — `,t.ok?Oe():t.detail]})]}):(0,Z.jsxs)(`p`,{className:`oc-bridge-config__check-row oc-bridge-config__check-row--skip`,children:[e,` — `,dt()]}):null}function jn({instance:e,onClose:t}){let n=Ee(D.admin.upsertInstanceConfig),r=tt(D.bridge.validateMediaPaths),a=Tt(),s=Vt(e.config?.contentLocale,void 0),[l,u]=(0,G.useState)(()=>mt(e.config??{},s)),[f,m]=(0,G.useState)(!1),[h,g]=(0,G.useState)(!1),[_,v]=(0,G.useState)(null),y=l.inboundMediaMode===`shared-fs`,b=l.mediaMode===`shared-fs`,x=y||b;async function ee(){g(!0),v(null);try{v(await r({instanceName:e.name,inboundMediaMode:l.inboundMediaMode,mediaMode:l.mediaMode}))}catch(e){a.error(ct(),e)}finally{g(!1)}}async function S(){m(!0);try{let r=e.config??{};await n({instanceId:e._id,config:gt(l,r,s)}),t()}catch(e){a.error(Re(),e)}finally{m(!1)}}return(0,Z.jsx)(`div`,{className:`oc-bridge-config`,children:(0,Z.jsxs)(`div`,{className:`oc-bridge-config__form`,children:[(0,Z.jsxs)(`div`,{className:`oc-bridge-config__grid`,children:[(0,Z.jsxs)(`label`,{className:`oc-field`,children:[(0,Z.jsx)(O,{label:Ue(),help:et()}),(0,Z.jsxs)(P,{value:l.mediaMode,onValueChange:e=>u({...l,mediaMode:e}),children:[(0,Z.jsx)(k,{size:`sm`,className:`w-full`,children:(0,Z.jsx)(I,{})}),(0,Z.jsx)(F,{children:_t.map(e=>(0,Z.jsx)(N,{value:e,children:e},e))})]})]}),(0,Z.jsxs)(`label`,{className:`oc-field`,children:[(0,Z.jsx)(O,{label:ke(),help:Ke()}),(0,Z.jsxs)(P,{value:l.inboundMediaMode,onValueChange:e=>u({...l,inboundMediaMode:e}),children:[(0,Z.jsx)(k,{size:`sm`,className:`w-full`,children:(0,Z.jsx)(I,{})}),(0,Z.jsx)(F,{children:ht.map(e=>(0,Z.jsx)(N,{value:e,children:e},e))})]})]}),(0,Z.jsxs)(`label`,{className:`oc-field`,children:[(0,Z.jsx)(O,{label:rt(),help:i()}),(0,Z.jsx)(L,{type:`number`,min:1,max:4096,className:`w-full`,value:l.mediaMaxMb,onChange:e=>u({...l,mediaMaxMb:Math.trunc(Number(e.target.value)||0)})})]})]}),x&&(0,Z.jsxs)(`div`,{className:`oc-bridge-config__grid`,children:[y&&(0,Z.jsxs)(`label`,{className:`oc-field`,children:[(0,Z.jsx)(O,{label:o(),help:He()}),(0,Z.jsx)(L,{className:`w-full`,spellCheck:!1,value:l.inboundAgentMount,onChange:e=>u({...l,inboundAgentMount:e.target.value})})]}),b&&(0,Z.jsxs)(`label`,{className:`oc-field`,children:[(0,Z.jsx)(O,{label:ce(),help:d()}),(0,Z.jsx)(L,{className:`w-full`,spellCheck:!1,value:l.outboundAgentMount,onChange:e=>u({...l,outboundAgentMount:e.target.value})})]})]}),(0,Z.jsxs)(`label`,{className:`oc-field--row`,children:[(0,Z.jsx)(Rt,{checked:l.rehydration,onCheckedChange:e=>u({...l,rehydration:e===!0})}),(0,Z.jsx)(O,{label:Je(),help:de()})]}),x&&_!==null&&(0,Z.jsx)(`div`,{className:`oc-bridge-config__check`,children:_.reachable?!_.inbound&&!_.outbound?(0,Z.jsxs)(`p`,{className:`oc-bridge-config__check-row oc-bridge-config__check-row--err`,children:[(0,Z.jsx)(B,{"aria-hidden":!0}),we({reason:_.reason??`?`})]}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)($,{label:pe(),result:_.inbound}),(0,Z.jsx)($,{label:lt(),result:_.outbound}),(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:c()})]}):(0,Z.jsxs)(`p`,{className:`oc-bridge-config__check-row oc-bridge-config__check-row--err`,children:[(0,Z.jsx)(B,{"aria-hidden":!0}),ot()]})}),(0,Z.jsxs)(`div`,{className:`oc-bridge-config__actions`,children:[x&&(0,Z.jsxs)(St,{variant:`outline`,size:`sm`,onClick:()=>void ee(),disabled:h,children:[h?(0,Z.jsx)(wt,{className:`size-4 animate-spin`,"aria-hidden":!0}):null,h?he():p()]}),(0,Z.jsx)(St,{size:`sm`,onClick:()=>void S(),disabled:f,children:Te()})]})]})})}function Mn({versions:e}){if(e.length===0)return null;let t=[...e].reverse();return(0,Z.jsxs)(At,{children:[(0,Z.jsx)(Ct,{asChild:!0,children:(0,Z.jsxs)(`button`,{type:`button`,className:`oc-compat__versions-btn`,children:[e.length===1?u():f({count:e.length}),(0,Z.jsx)(M,{size:13,"aria-hidden":!0})]})}),(0,Z.jsxs)(Bt,{className:`oc-compat__versions-pop`,align:`start`,children:[(0,Z.jsx)(`p`,{className:`oc-compat__versions-title`,children:me()}),(0,Z.jsx)(`div`,{className:`oc-compat__versions-list`,children:t.map(e=>(0,Z.jsx)(j,{variant:`secondary`,children:e},e))})]})]})}export{Tn as BridgeTab,An as InstanceConfigDialog};
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$b as r,$x as i,Ad as a,Ax as o,Bb as s,Cx as c,D as l,Dd as u,Dx as d,Ed as f,Ex as p,Fb as m,Fd as h,Gb as g,Gi as _,Hb as v,Ib as y,Id as b,Jb as x,Ji as ee,Kb as S,Ki as te,Lb as ne,Mb as re,Md as ie,Nb as ae,Nd as oe,Od as se,Ox as ce,Pb as C,Pd as le,Qb as ue,Qx as de,Rb as fe,Sx as pe,Td as me,Tx as he,Ub as ge,Vb as _e,Wb as ve,Wi as ye,Xb as be,Yb as xe,Zb as Se,Zi as Ce,_x as we,aS as Te,ax as Ee,bx as De,cS as Oe,cx as ke,dS as Ae,dx as je,ex as Me,fS as Ne,fx as Pe,gx as Fe,hx as Ie,iS as Le,iV as Re,ix as ze,j as Be,jd as w,kd as Ve,kx as He,lS as Ue,lx as We,mx as Ge,nS as Ke,nx as qe,oS as Je,oV as Ye,on as Xe,ox as Ze,px as Qe,qb as $e,qi as et,rS as tt,rx as nt,sS as rt,sV as T,sx as E,t as D,tx as it,ux as at,vx as ot,wd as st,wx as ct,xx as lt,yd as ut,yx as dt,zb as ft}from"./api-Dawxt_aS.js";import{t as pt}from"./chevrons-up-down-CFK9IaHn.js";import{i as mt,n as O,o as ht,r as gt,s as _t}from"./FieldLabel-CEa671vG.js";import{i as vt,n as yt,r as bt,t as xt}from"./tabs-D-3HavQe.js";import{t as St}from"./button-alklyZ2M.js";import{$ as k,Bn as A,Bt as Ct,Dn as wt,Dt as Tt,Et as j,F as Et,Gn as Dt,Hn as M,Kn as Ot,Q as N,Rn as kt,Rt as At,X as P,Z as F,at as jt,ct as Mt,et as I,jt as L,lt as R,nt as Nt,ot as Pt,pn as z,q as Ft,rt as It,tt as Lt,un as B,ut as Rt,zn as zt,zt as Bt}from"./index-C-ySA5Hs.js";import{r as Vt}from"./locales-CPjguROj.js";import{a as Ht,i as V,n as Ut,o as H,r as U,t as Wt}from"./table-CJ3_5RvQ.js";import{t as Gt}from"./FilterBar-D_6ObXjr.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-C9_KgDNH.js";import{t as W}from"./dispatchErrorInfo-d7ehNfS4.js";var $t=l(`refresh-cw`,[[`path`,{d:`M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8`,key:`v9h5vc`}],[`path`,{d:`M21 3v5h-5`,key:`1q7to0`}],[`path`,{d:`M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16`,key:`3uifl3`}],[`path`,{d:`M8 16H3v5`,key:`1cv678`}]]),en=l(`wifi-off`,[[`path`,{d:`M12 20h.01`,key:`zekei9`}],[`path`,{d:`M8.5 16.429a5 5 0 0 1 7 0`,key:`1bycff`}],[`path`,{d:`M5 12.859a10 10 0 0 1 5.17-2.69`,key:`1dl1wf`}],[`path`,{d:`M19 12.859a10 10 0 0 0-2.007-1.523`,key:`4k23kn`}],[`path`,{d:`M2 8.82a15 15 0 0 1 4.177-2.643`,key:`1grhjp`}],[`path`,{d:`M22 8.82a15 15 0 0 0-11.288-3.764`,key:`z3jwby`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}]]),G=t(e(),1);function tn(e){return e.filter(e=>e.state===`error`)}function nn(e){return e.reachable&&tn(e.targets).length===0}function rn(e){return nn(e)?(e.unreachableInstances??[]).length>0?`gateways_unreachable`:`ok`:`error`}function an(e){return e.state===`error`&&e.lastErrorCode!==null}function on(e){return!!e.lastDownstreamRejectCode}function sn(e){return!!e.lastLocalRefusalCode}function cn(e){return an(e)||on(e)||sn(e)}function K(e){return e.kind??`openclaw`}function ln(e){return[...e].sort((e,t)=>e===`openclaw`?-1:t===`openclaw`?1:e.localeCompare(t))}function un(e,t,n){let r=new Map;for(let e of t)e.instanceName&&r.set(e.instanceName,e.provider);for(let e of n)r.set(e.name,K(e));let i=e=>(e.instanceName?r.get(e.instanceName):void 0)??`openclaw`,a=new Set;for(let e of n)a.add(K(e));for(let e of t)a.add(e.provider);for(let t of e)a.add(i(t));return ln(a).map(r=>({key:r,connections:e.filter(e=>i(e)===r),compatTargets:t.filter(e=>e.provider===r),instances:n.filter(e=>K(e)===r)}))}function q(e){return e===`openclaw`?`OpenClaw`:e===`hermes`?`Hermes`:e.charAt(0).toUpperCase()+e.slice(1)}var J=`__all__`,dn={q:``,state:J,instance:J,version:J},Y={connected:0,error:1,idle:2};function fn(e){return e.q.trim()!==``||e.state!==`__all__`||e.instance!==`__all__`||e.version!==`__all__`}function pn(e,t){let n=t.q.trim().toLowerCase();return e.filter(e=>!(n&&!`${e.targetLabel} ${e.gatewayHost}`.toLowerCase().includes(n)||t.state!==`__all__`&&e.state!==t.state||t.instance!==`__all__`&&(e.instanceName??``)!==t.instance||t.version!==`__all__`&&(e.gatewayVersion??``)!==t.version))}function X(e,t){return e.localeCompare(t,void 0,{numeric:!0,sensitivity:`base`})}function mn(e,t){return e===`version`?t.gatewayVersion===null:e===`lastOk`?t.lastOkAt===null:!1}function hn(e,t,n){switch(e){case`state`:return(Y[t.state]??99)-(Y[n.state]??99);case`instance`:return X(t.instanceLabel??t.instanceName??``,n.instanceLabel??n.instanceName??``);case`host`:return X(t.gatewayHost,n.gatewayHost);case`version`:{let e=t.gatewayVersion,r=n.gatewayVersion;return Zt(e,r)??X(e,r)}case`lastOk`:return t.lastOkAt-n.lastOkAt;default:return X(t.targetLabel,n.targetLabel)}}function gn(e,t){if(!t)return e;let n=t.dir===`asc`?1:-1;return[...e].sort((e,r)=>{let i=mn(t.key,e),a=mn(t.key,r);return i&&a?0:i?1:a?-1:n*hn(t.key,e,r)})}function _n(e){let t=new Set;for(let n of e)t.add(n.state);return[...t].sort((e,t)=>(Y[e]??99)-(Y[t]??99))}function vn(e){let t=new Map;for(let n of e)n.instanceName!==null&&(t.has(n.instanceName)||t.set(n.instanceName,n.instanceLabel??n.instanceName));return[...t.entries()].map(([e,t])=>({name:e,label:t})).sort((e,t)=>X(e.label,t.label))}function yn(e){let t=new Set;for(let n of e)n.gatewayVersion!==null&&t.add(n.gatewayVersion);return[...t].sort((e,t)=>Zt(e,t)??X(e,t))}var Z=n();function bn({connections:e,displayByInstance:t}){let[n,r]=(0,G.useState)(dn),[i,a]=(0,G.useState)(null),o=(0,G.useMemo)(()=>e.map((e,n)=>({_id:`${e.key}:${e.canonical}/${e.agentId}:${n}`,targetLabel:`${e.canonical}/${e.agentId}`,state:e.state,instanceName:e.instanceName??null,instanceLabel:e.instanceName?t.get(e.instanceName)??e.instanceName:null,gatewayHost:e.gatewayHost,gatewayVersion:e.gatewayVersion??null,okCount:e.okCount,errorCount:e.errorCount+(e.downstreamRejectCount??0)+(e.localRefusalCount??0),attempts:e.attempts,lastOkAt:e.lastOkAt??null,lastErrorCode:e.lastErrorCode??null,lastErrorAt:e.lastErrorAt??null,lastDownstreamRejectCode:e.lastDownstreamRejectCode??null,lastDownstreamRejectAt:e.lastDownstreamRejectAt??null,lastLocalRefusalCode:e.lastLocalRefusalCode??null,lastLocalRefusalAt:e.lastLocalRefusalAt??null})),[e,t]),c=(0,G.useMemo)(()=>_n(o),[o]),l=(0,G.useMemo)(()=>vn(o),[o]),u=(0,G.useMemo)(()=>yn(o),[o]),d=(0,G.useMemo)(()=>gn(pn(o,n),i),[o,n,i]);function f(e){a(t=>t?.key===e?t.dir===`asc`?{key:e,dir:`desc`}:null:{key:e,dir:`asc`})}return e.length===0?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:be()}):(0,Z.jsxs)(`div`,{className:`oc-conn`,children:[(0,Z.jsxs)(Gt,{q:n.q,onQChange:e=>r(t=>({...t,q:e})),searchPlaceholder:$e(),onReset:()=>r(dn),canReset:fn(n),children:[(0,Z.jsxs)(P,{value:n.state,onValueChange:e=>r(t=>({...t,state:e})),children:[(0,Z.jsx)(k,{size:`sm`,className:`w-36`,children:(0,Z.jsx)(I,{placeholder:g()})}),(0,Z.jsxs)(F,{children:[(0,Z.jsx)(N,{value:J,children:S()}),c.map(e=>(0,Z.jsx)(N,{value:e,children:Sn(e)},e))]})]}),(0,Z.jsxs)(P,{value:n.instance,onValueChange:e=>r(t=>({...t,instance:e})),children:[(0,Z.jsx)(k,{size:`sm`,className:`w-40`,children:(0,Z.jsx)(I,{placeholder:ve()})}),(0,Z.jsxs)(F,{children:[(0,Z.jsx)(N,{value:J,children:S()}),l.map(e=>(0,Z.jsx)(N,{value:e.name,children:e.label},e.name))]})]}),(0,Z.jsxs)(P,{value:n.version,onValueChange:e=>r(t=>({...t,version:e})),children:[(0,Z.jsx)(k,{size:`sm`,className:`w-36`,children:(0,Z.jsx)(I,{placeholder:ge()})}),(0,Z.jsxs)(F,{children:[(0,Z.jsx)(N,{value:J,children:S()}),u.map(e=>(0,Z.jsx)(N,{value:e,children:e},e))]})]})]}),d.length===0?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:v()}):(0,Z.jsxs)(Wt,{className:`oc-conn__table`,children:[(0,Z.jsx)(Ht,{children:(0,Z.jsxs)(H,{children:[(0,Z.jsx)(Q,{label:_e(),sortKey:`target`,sort:i,onSort:f}),(0,Z.jsx)(Q,{label:s(),sortKey:`state`,sort:i,onSort:f}),(0,Z.jsx)(Q,{label:ft(),sortKey:`instance`,sort:i,onSort:f}),(0,Z.jsx)(Q,{label:fe(),sortKey:`host`,sort:i,onSort:f}),(0,Z.jsx)(Q,{label:ne(),sortKey:`version`,sort:i,onSort:f}),(0,Z.jsx)(V,{children:y()}),(0,Z.jsx)(Q,{label:m(),sortKey:`lastOk`,sort:i,onSort:f})]})}),(0,Z.jsx)(Ut,{children:d.map(e=>(0,Z.jsx)(xn,{r:e},e._id))})]})]})}function Q({label:e,sortKey:t,sort:n,onSort:r}){let i=n?.key===t,a=i?n.dir:null;return(0,Z.jsx)(V,{"aria-sort":i?a===`asc`?`ascending`:`descending`:`none`,children:(0,Z.jsxs)(`button`,{type:`button`,className:`oc-conn__sort`,onClick:()=>r(t),children:[e,i?a===`asc`?(0,Z.jsx)(zt,{size:13,"aria-hidden":!0}):(0,Z.jsx)(M,{size:13,"aria-hidden":!0}):(0,Z.jsx)(pt,{size:13,"aria-hidden":!0,className:`oc-conn__sort-idle`})]})})}function xn({r:e}){let t=an(e)?W(e.lastErrorCode):null,n=on(e)?W(e.lastDownstreamRejectCode):null,r=sn(e)?W(e.lastLocalRefusalCode):null;return(0,Z.jsxs)(G.Fragment,{children:[(0,Z.jsxs)(H,{className:`oc-conn__row oc-conn__row--${e.state}`,children:[(0,Z.jsx)(U,{children:(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:e.targetLabel})}),(0,Z.jsx)(U,{children:(0,Z.jsx)(Cn,{state:e.state})}),(0,Z.jsx)(U,{children:e.instanceLabel?(0,Z.jsx)(`span`,{className:`oc-bridge-target__instance`,children:e.instanceLabel}):(0,Z.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})}),(0,Z.jsx)(U,{children:(0,Z.jsx)(`span`,{className:`oc-bridge-target__host`,children:e.gatewayHost})}),(0,Z.jsx)(U,{children:e.gatewayVersion?(0,Z.jsx)(`span`,{className:`oc-bridge-target__version`,children:e.gatewayVersion}):(0,Z.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})}),(0,Z.jsx)(U,{children:(0,Z.jsx)(`span`,{className:`oc-conn__stats`,children:xe({ok:e.okCount,errors:e.errorCount,attempts:e.attempts})})}),(0,Z.jsx)(U,{children:e.lastOkAt?(0,Z.jsx)(`span`,{className:`oc-traces__mono`,children:R(e.lastOkAt)}):(0,Z.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})})]}),cn(e)?(0,Z.jsx)(H,{className:`oc-conn__detail-row`,children:(0,Z.jsxs)(U,{colSpan:7,className:`oc-conn__detail-cell`,children:[t?(0,Z.jsxs)(`div`,{className:`oc-bridge-target__error`,children:[(0,Z.jsx)(`strong`,{children:t.label}),` `,(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:e.lastErrorCode}),e.lastErrorAt?` · ${R(e.lastErrorAt)}`:``,(0,Z.jsx)(`p`,{className:`oc-bridge-card__hint`,children:t.hint})]}):null,r?(0,Z.jsxs)(`div`,{className:`oc-bridge-target__downstream`,children:[Be({label:r.label}),` `,(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:e.lastLocalRefusalCode}),e.lastLocalRefusalAt?` · ${R(e.lastLocalRefusalAt)}`:``,(0,Z.jsx)(`p`,{className:`oc-bridge-card__hint`,children:r.hint})]}):null,n?(0,Z.jsxs)(`div`,{className:`oc-bridge-target__downstream`,children:[x({label:n.label}),` `,(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:e.lastDownstreamRejectCode}),e.lastDownstreamRejectAt?` · ${R(e.lastDownstreamRejectAt)}`:``]}):null]})}):null]})}function Sn(e){return e===`connected`?C():e===`error`?ae():re()}function Cn({state:e}){return e===`connected`?(0,Z.jsx)(j,{variant:`secondary`,children:C()}):e===`error`?(0,Z.jsx)(j,{variant:`destructive`,children:ae()}):(0,Z.jsx)(j,{variant:`outline`,children:re()})}function wn(){return T(D.bridgeHealth.getBridgeHealth,{})}function Tn(){let e=wn(),t=T(D.compat.getBridgeCompat,{}),n=T(D.me.getMe,{host:Ft})?.role===`admin`,r=T(D.admin.listInstances,n?{}:`skip`),i=T(D.agents.usageForInstances,n?{}:`skip`),a=Dt(),o=()=>void a({to:`/settings/anomalies`,search:{status:`open`}}),s=un(e?e.targets:[],t?t.targets:[],r??[]),{section:c}=Ot({from:`/settings/bridge`}),l=Dt({from:`/settings/bridge`}),u=t?.compat??null,d=t===void 0?`loading`:t===null?`nodata`:`ready`,f=u!==null&&Xt(u,`hermes`)&&!s.some(e=>e.key===`hermes`);return(0,Z.jsxs)(`div`,{className:`oc-bridge`,children:[(0,Z.jsx)(En,{health:e,compat:t,onSeeAnomalies:o}),(0,Z.jsx)(`p`,{className:`oc-admin__hint oc-bridge__caption`,children:Fe()}),i&&i.length>0?(0,Z.jsxs)(`section`,{className:`oc-bridge__usage`,children:[(0,Z.jsx)(`h3`,{className:`oc-bridge__usage-title`,children:Ie()}),(0,Z.jsxs)(Wt,{children:[(0,Z.jsx)(Ht,{children:(0,Z.jsxs)(H,{children:[(0,Z.jsx)(V,{children:ee()}),(0,Z.jsx)(V,{children:et()}),(0,Z.jsx)(V,{children:te()}),(0,Z.jsx)(V,{children:_()}),(0,Z.jsx)(V,{children:ye()})]})}),(0,Z.jsx)(Ut,{children:i.flatMap(e=>{let t=Et(e.usage,Date.now());return t?t.windows.map((t,n)=>(0,Z.jsxs)(H,{children:[(0,Z.jsx)(U,{className:`font-medium`,children:n===0?e.instanceName:``}),(0,Z.jsx)(U,{children:t.provider}),(0,Z.jsx)(U,{children:t.label}),(0,Z.jsx)(U,{children:(0,Z.jsxs)(j,{variant:t.percentLeft<=10?`destructive`:t.percentLeft<=25?`outline`:`secondary`,children:[t.percentLeft,`%`]})}),(0,Z.jsx)(U,{className:`text-muted-foreground`,children:t.resetText??`—`})]},`${e.instanceName}:${t.provider}:${t.label}`)):[]})})]})]}):null,s.length>0?(0,Z.jsxs)(xt,{value:s.some(e=>e.key===c)?c:s[0]?.key??`openclaw`,onValueChange:e=>void l({search:{section:e},replace:!0}),children:[(0,Z.jsx)(bt,{className:`w-full`,children:s.map(e=>(0,Z.jsxs)(vt,{value:e.key,className:`flex-1 gap-1.5`,children:[(0,Z.jsx)(z,{size:13,"aria-hidden":!0}),q(e.key)]},e.key))}),s.map(e=>(0,Z.jsx)(yt,{value:e.key,children:(0,Z.jsx)(Dn,{providerKey:e.key,connections:e.connections,instances:e.instances,manifest:u,compatStatus:d,compatReachable:t?.reachable??!0,protocol:e.key===`openclaw`?t?.protocol??null:null})},e.key))]}):null,f?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:ut()}):null]})}function En({health:e,compat:t,onSeeAnomalies:n}){let i=t!=null&&t.buildVersion!=null&&t.bridgeVersion!=null&&t.buildVersion!==t.bridgeVersion,a=t?.buildRevision&&t.buildRevision!==`unknown`?t.buildRevision.slice(0,7):null,o=t&&t!==null?(0,Z.jsxs)(`span`,{className:`oc-bridge-card__ver`,children:[(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:Yt(t.bridgeVersion)}),a?(0,Z.jsxs)(Z.Fragment,{children:[` `,(0,Z.jsxs)(`code`,{className:`oc-traces__mono`,title:le(),children:[`(`,a,`)`]})]}):null,i?(0,Z.jsxs)(`strong`,{className:`oc-bridge-card__mismatch`,children:[` `,oe({build:t.buildVersion??`?`})]}):null,` · `,ie(),` `,(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:t.protocolVersion===null?w():String(t.protocolVersion)})]}):null;if(e===void 0)return(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:E()});if(e===null)return(0,Z.jsx)(`div`,{className:`oc-bridge-card oc-bridge-card--idle`,children:Ze()});let s=tn(e.targets),c=!e.reachable,l=rn(e),u=e.unreachableInstances??[],d=l===`ok`?`ok`:l===`gateways_unreachable`?`warn`:`error`,f=Mt(e.checkedAt),p=e.startedAt==null?null:Mt(e.startedAt);return(0,Z.jsxs)(`div`,{className:`oc-bridge-card oc-bridge-card--${d}`,children:[(0,Z.jsx)(`div`,{className:`oc-bridge-card__icon`,"aria-hidden":!0,children:l===`ok`?(0,Z.jsx)(kt,{size:22}):c||l===`gateways_unreachable`?(0,Z.jsx)(en,{size:22}):(0,Z.jsx)(B,{size:22})}),(0,Z.jsxs)(`div`,{className:`oc-bridge-card__body`,children:[(0,Z.jsx)(`div`,{className:`oc-bridge-card__title`,children:l===`ok`?Ee():l===`gateways_unreachable`?it({count:u.length}):c?ze():nt({count:s.length})}),(0,Z.jsxs)(`div`,{className:`oc-bridge-card__meta`,children:[(0,Z.jsxs)(`span`,{children:[(0,Z.jsx)($t,{size:12,"aria-hidden":!0}),` `,qe({time:f})]}),p?(0,Z.jsx)(`span`,{children:r({time:p})}):null,o]}),l===`gateways_unreachable`?(0,Z.jsx)(`p`,{className:`oc-bridge-card__hint`,children:Me({names:u.join(`, `)})}):null,c?(0,Z.jsx)(`p`,{className:`oc-bridge-card__hint`,children:W(e.lastError===`not_configured`?`NOT_CONFIGURED`:`BRIDGE_UNREACHABLE`).hint}):null]}),(0,Z.jsx)(`button`,{type:`button`,className:`oc-bridgebar__drill`,onClick:n,children:ue()})]})}function Dn({providerKey:e,connections:t,instances:n,manifest:r,compatStatus:i,compatReachable:a,protocol:o}){let s=r?Kt(r,e):null,c=new Map;for(let e of n)c.set(e.name,e.displayName??e.name);let l=[],u=new Set;for(let n of t){if(!n.instanceName||u.has(n.instanceName))continue;u.add(n.instanceName);let t=n.gatewayVersion??null;l.push({instanceName:n.instanceName,displayName:c.get(n.instanceName)??n.instanceName,version:t,state:Jt(t,e,r)})}let d=Qt(l.map(e=>e.state)),[f,p]=(0,G.useState)(!1);return(0,Z.jsxs)(`section`,{className:`oc-bridge-provider`,children:[(0,Z.jsxs)(`header`,{className:`oc-bridge-provider__head`,children:[(0,Z.jsx)(z,{size:15,"aria-hidden":!0,className:`oc-bridge-provider__icon`}),(0,Z.jsx)(`span`,{className:`oc-bridge-provider__name`,children:q(e)}),d?(0,Z.jsx)(j,{variant:d===`beyond`||d===`defective`?`destructive`:`secondary`,children:qt(d)}):null]}),(0,Z.jsx)(`h4`,{className:`oc-bridge-provider__sub`,children:b()}),(0,Z.jsx)(kn,{providerName:q(e),support:s,compatStatus:i,compatReachable:a,manifest:r,instanceRows:l}),o?(0,Z.jsx)(On,{protocol:o}):null,(0,Z.jsxs)(`button`,{type:`button`,className:`oc-bridge-provider__sub oc-bridge-provider__sub--toggle`,"aria-expanded":f,onClick:()=>p(e=>!e),children:[f?(0,Z.jsx)(M,{size:13,"aria-hidden":!0}):(0,Z.jsx)(A,{size:13,"aria-hidden":!0}),Se({count:t.length})]}),f?(0,Z.jsx)(bn,{connections:t,displayByInstance:c}):null]})}function On({protocol:e}){let[t,n]=(0,G.useState)(!1),r=e.coverage,i=e.drift??[],a=(e.driftOverflow??0)+(e.driftTruncated??0);return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`h4`,{className:`oc-bridge-provider__sub`,children:[Ge(),i.length>0?(0,Z.jsx)(j,{variant:`destructive`,children:Pe({count:i.length})}):a>0?(0,Z.jsx)(j,{variant:`destructive`,children:je()}):(0,Z.jsx)(j,{variant:`secondary`,children:Qe()})]}),(0,Z.jsxs)(`p`,{className:`oc-admin__hint`,children:[at({version:e.vendoredVersion}),r?` · `+We({handled:r.handled,ignored:r.ignored,gaps:r.gaps}):null]}),a>0?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:Xe({overflow:e.driftOverflow??0,truncated:e.driftTruncated??0})}):null,i.length>0?(0,Z.jsx)(`ul`,{className:`oc-bridge-protocol__list`,role:`list`,children:i.map(e=>(0,Z.jsxs)(`li`,{children:[(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:e.shape}),` × `,e.count]},e.shape))}):null,r&&r.gapList.length>0?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`button`,{type:`button`,className:`oc-bridge-provider__sub oc-bridge-provider__sub--toggle`,"aria-expanded":t,onClick:()=>n(e=>!e),children:[t?(0,Z.jsx)(M,{size:13,"aria-hidden":!0}):(0,Z.jsx)(A,{size:13,"aria-hidden":!0}),ke({count:r.gapList.length})]}),t?(0,Z.jsx)(`ul`,{className:`oc-bridge-protocol__list`,role:`list`,children:r.gapList.map(e=>(0,Z.jsx)(`li`,{children:(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:e})},e))}):null]}):null]})}function kn({support:e,compatStatus:t,compatReachable:n,manifest:r,instanceRows:i,providerName:o}){return t===`loading`?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:E()}):t===`nodata`?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:h()}):(0,Z.jsxs)(`div`,{className:`oc-compat`,children:[n?null:(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:a()}),r===null?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:Ve()}):(0,Z.jsxs)(`div`,{className:`oc-compat__support`,children:[(0,Z.jsx)(`span`,{className:`oc-compat__label`,children:Ce({provider:o})}),e&&e.range!==null?(0,Z.jsx)(`span`,{children:se({min:e.range.min,max:e.range.maxValidated})}):(0,Z.jsx)(`span`,{children:w()}),e?(0,Z.jsx)(Mn,{versions:e.validatedVersions}):null]}),i.length===0?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:st()}):(0,Z.jsx)(`div`,{className:`oc-compat__targets`,children:i.map(e=>(0,Z.jsxs)(`div`,{className:`oc-compat__target`,children:[(0,Z.jsx)(`span`,{className:`oc-compat__instance`,children:e.displayName}),(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:Yt(e.version)}),(0,Z.jsx)(j,{variant:e.state===`supported`?`secondary`:e.state===`beyond`||e.state===`defective`?`destructive`:`outline`,children:qt(e.state)})]},e.instanceName))})]})}function An({instance:e,onClose:t}){return(0,Z.jsx)(Lt,{open:!0,onOpenChange:e=>!e&&t(),children:(0,Z.jsxs)(Nt,{className:`oc-bridge-config-dialog`,onOpenAutoFocus:e=>e.preventDefault(),children:[(0,Z.jsxs)(jt,{children:[(0,Z.jsx)(Pt,{children:Ne({instance:e.displayName??e.name})}),(0,Z.jsx)(It,{children:Ae()})]}),(0,Z.jsx)(jn,{instance:e,onClose:t})]})})}function $({label:e,result:t}){return t?t.checked?(0,Z.jsxs)(`p`,{className:`oc-bridge-config__check-row `+(t.ok?`oc-bridge-config__check-row--ok`:`oc-bridge-config__check-row--err`),children:[t.ok?(0,Z.jsx)(kt,{"aria-hidden":!0}):(0,Z.jsx)(B,{"aria-hidden":!0}),(0,Z.jsxs)(`span`,{children:[e,` — `,t.ok?De():t.detail]})]}):(0,Z.jsxs)(`p`,{className:`oc-bridge-config__check-row oc-bridge-config__check-row--skip`,children:[e,` — `,dt()]}):null}function jn({instance:e,onClose:t}){let n=Ye(D.admin.upsertInstanceConfig),r=Re(D.bridge.validateMediaPaths),a=Tt(),s=Vt(e.config?.contentLocale,void 0),[l,u]=(0,G.useState)(()=>mt(e.config??{},s)),[f,m]=(0,G.useState)(!1),[h,g]=(0,G.useState)(!1),[_,v]=(0,G.useState)(null),y=l.inboundMediaMode===`shared-fs`,b=l.mediaMode===`shared-fs`,x=y||b;async function ee(){g(!0),v(null);try{v(await r({instanceName:e.name,inboundMediaMode:l.inboundMediaMode,mediaMode:l.mediaMode}))}catch(e){a.error(ct(),e)}finally{g(!1)}}async function S(){m(!0);try{let r=e.config??{};await n({instanceId:e._id,config:gt(l,r,s)}),t()}catch(e){a.error(Le(),e)}finally{m(!1)}}return(0,Z.jsx)(`div`,{className:`oc-bridge-config`,children:(0,Z.jsxs)(`div`,{className:`oc-bridge-config__form`,children:[(0,Z.jsxs)(`div`,{className:`oc-bridge-config__grid`,children:[(0,Z.jsxs)(`label`,{className:`oc-field`,children:[(0,Z.jsx)(O,{label:Ue(),help:tt()}),(0,Z.jsxs)(P,{value:l.mediaMode,onValueChange:e=>u({...l,mediaMode:e}),children:[(0,Z.jsx)(k,{size:`sm`,className:`w-full`,children:(0,Z.jsx)(I,{})}),(0,Z.jsx)(F,{children:_t.map(e=>(0,Z.jsx)(N,{value:e,children:e},e))})]})]}),(0,Z.jsxs)(`label`,{className:`oc-field`,children:[(0,Z.jsx)(O,{label:Oe(),help:Ke()}),(0,Z.jsxs)(P,{value:l.inboundMediaMode,onValueChange:e=>u({...l,inboundMediaMode:e}),children:[(0,Z.jsx)(k,{size:`sm`,className:`w-full`,children:(0,Z.jsx)(I,{})}),(0,Z.jsx)(F,{children:ht.map(e=>(0,Z.jsx)(N,{value:e,children:e},e))})]})]}),(0,Z.jsxs)(`label`,{className:`oc-field`,children:[(0,Z.jsx)(O,{label:rt(),help:i()}),(0,Z.jsx)(L,{type:`number`,min:1,max:4096,className:`w-full`,value:l.mediaMaxMb,onChange:e=>u({...l,mediaMaxMb:Math.trunc(Number(e.target.value)||0)})})]})]}),x&&(0,Z.jsxs)(`div`,{className:`oc-bridge-config__grid`,children:[y&&(0,Z.jsxs)(`label`,{className:`oc-field`,children:[(0,Z.jsx)(O,{label:o(),help:He()}),(0,Z.jsx)(L,{className:`w-full`,spellCheck:!1,value:l.inboundAgentMount,onChange:e=>u({...l,inboundAgentMount:e.target.value})})]}),b&&(0,Z.jsxs)(`label`,{className:`oc-field`,children:[(0,Z.jsx)(O,{label:ce(),help:d()}),(0,Z.jsx)(L,{className:`w-full`,spellCheck:!1,value:l.outboundAgentMount,onChange:e=>u({...l,outboundAgentMount:e.target.value})})]})]}),(0,Z.jsxs)(`label`,{className:`oc-field--row`,children:[(0,Z.jsx)(Rt,{checked:l.rehydration,onCheckedChange:e=>u({...l,rehydration:e===!0})}),(0,Z.jsx)(O,{label:Je(),help:de()})]}),x&&_!==null&&(0,Z.jsx)(`div`,{className:`oc-bridge-config__check`,children:_.reachable?!_.inbound&&!_.outbound?(0,Z.jsxs)(`p`,{className:`oc-bridge-config__check-row oc-bridge-config__check-row--err`,children:[(0,Z.jsx)(B,{"aria-hidden":!0}),we({reason:_.reason??`?`})]}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)($,{label:pe(),result:_.inbound}),(0,Z.jsx)($,{label:lt(),result:_.outbound}),(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:c()})]}):(0,Z.jsxs)(`p`,{className:`oc-bridge-config__check-row oc-bridge-config__check-row--err`,children:[(0,Z.jsx)(B,{"aria-hidden":!0}),ot()]})}),(0,Z.jsxs)(`div`,{className:`oc-bridge-config__actions`,children:[x&&(0,Z.jsxs)(St,{variant:`outline`,size:`sm`,onClick:()=>void ee(),disabled:h,children:[h?(0,Z.jsx)(wt,{className:`size-4 animate-spin`,"aria-hidden":!0}):null,h?he():p()]}),(0,Z.jsx)(St,{size:`sm`,onClick:()=>void S(),disabled:f,children:Te()})]})]})})}function Mn({versions:e}){if(e.length===0)return null;let t=[...e].reverse();return(0,Z.jsxs)(At,{children:[(0,Z.jsx)(Ct,{asChild:!0,children:(0,Z.jsxs)(`button`,{type:`button`,className:`oc-compat__versions-btn`,children:[e.length===1?u():f({count:e.length}),(0,Z.jsx)(M,{size:13,"aria-hidden":!0})]})}),(0,Z.jsxs)(Bt,{className:`oc-compat__versions-pop`,align:`start`,children:[(0,Z.jsx)(`p`,{className:`oc-compat__versions-title`,children:me()}),(0,Z.jsx)(`div`,{className:`oc-compat__versions-list`,children:t.map(e=>(0,Z.jsx)(j,{variant:`secondary`,children:e},e))})]})]})}export{Tn as BridgeTab,An as InstanceConfigDialog};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Bd as r,Gd as i,Hd as a,Ld as o,
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Bd as r,Gd as i,Hd as a,Ld as o,QB as s,Rd as c,Ud as l,Vd as u,Wd as d,Xi as f,ac as p,cc as m,cp as h,dc as g,fc as _,iV as v,ic as y,lc as b,np as x,oV as S,oc as C,op as w,pc as T,sV as E,sc as D,t as O,tp as k,uS as A,uc as j,xf as M,zd as N}from"./api-Dawxt_aS.js";import{t as P}from"./button-alklyZ2M.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-C-ySA5Hs.js";import{a as K}from"./compatView-C9_KgDNH.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=S(O.admin.upsertInstanceConfig),n=E(O.agents.listAgentsForInstance,{instanceName:e.name}),r=typeof e.config?.converterAgentId==`string`?e.config.converterAgentId:``,[i,a]=(0,q.useState)(r),[s,l]=(0,q.useState)(`idle`);(0,q.useEffect)(()=>{a(r),l(`idle`)},[e._id,r]);let u=`__none__`,d=i!==r;async function f(){l(`saving`);try{let n={...e.config??{}};i===``||i===u?delete n.converterAgentId:n.converterAgentId=i,await t({instanceId:e._id,config:n}),l(`done`)}catch{l(`error`)}}let p=n?.agents??[];return(0,X.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,X.jsx)(`span`,{className:`oc-cdefaults__label`,children:j()}),(0,X.jsx)(`p`,{className:`oc-admin__hint`,children:b()}),(0,X.jsxs)(`div`,{className:`oc-cdefaults__inline`,children:[(0,X.jsxs)(B,{value:i===``?u:i,onValueChange:e=>a(e===u?``:e),children:[(0,X.jsx)(F,{className:`oc-cdefaults__select`,"aria-label":j(),children:(0,X.jsx)(H,{placeholder:m()})}),(0,X.jsxs)(V,{children:[(0,X.jsx)(z,{value:u,children:m()}),p.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||s===`saving`,onClick:()=>void f(),children:s===`saving`?h():N()})]}),s===`done`?(0,X.jsx)(`p`,{className:`oc-admin__hint`,role:`status`,children:c()}):null,s===`error`?(0,X.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:o()}):null]})}function Q({instance:e}){let t=S(O.admin.upsertInstanceConfig),n=e.config?.curationEnabled===!0,r=typeof e.config?.curationBudgetChars==`number`?e.config.curationBudgetChars:null,[i,a]=(0,q.useState)(n),[s,l]=(0,q.useState)(r===null?``:String(r)),[u,d]=(0,q.useState)(`idle`);(0,q.useEffect)(()=>{a(n),l(r===null?``:String(r)),d(`idle`)},[e._id,n,r]);let f=s.trim(),m=f===``?null:/^\d+$/.test(f)?Number.parseInt(f,10):NaN,_=!i||m===null||Number.isInteger(m)&&m>=4e3&&m<=6e4,v=i!==n||(m??null)!==r;async function y(){d(`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}),d(`done`)}catch{d(`error`)}}return(0,X.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,X.jsxs)(`label`,{className:`oc-cdefaults__inline`,style:{cursor:`pointer`},children:[(0,X.jsx)(G,{checked:i,onCheckedChange:e=>a(e===!0),"aria-label":g()}),(0,X.jsx)(`span`,{className:`oc-cdefaults__label`,children:g()})]}),(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=>l(e.target.value),className:`oc-cdefaults__number`,"aria-invalid":!_,"aria-label":D(),disabled:!i}),(0,X.jsx)(P,{size:`sm`,disabled:!v||!_||u===`saving`,onClick:()=>void y(),children:u===`saving`?h():N()})]}),_?null:(0,X.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:C()}),u===`done`?(0,X.jsx)(`p`,{className:`oc-admin__hint`,role:`status`,children:c()}):null,u===`error`?(0,X.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:o()}):null,(0,X.jsx)(`p`,{className:`oc-cdefaults__help`,children:p()})]})}function $({instance:e}){let t=S(O.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 l=r.trim(),u=l===``?null:/^\d+$/.test(l)?Number.parseInt(l,10):NaN,d=u===null||Number.isInteger(u)&&u>=1e3&&u<=2e5,f=(u??null)!==n;async function p(){s(`saving`);try{let n={...e.config??{}};u===null?delete n.summarizeThresholdChars:n.summarizeThresholdChars=u,await t({instanceId:e._id,config:n}),s(`done`)}catch{s(`error`)}}return(0,X.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,X.jsx)(`span`,{className:`oc-cdefaults__label`,children:T()}),(0,X.jsxs)(`div`,{className:`oc-cdefaults__inline`,children:[(0,X.jsx)(U,{type:`number`,min:1e3,max:2e5,step:1e3,placeholder:`8000`,value:r,onChange:e=>i(e.target.value),className:`oc-cdefaults__number`,"aria-invalid":!d}),(0,X.jsx)(P,{size:`sm`,disabled:!f||!d||a===`saving`,onClick:()=>void p(),children:a===`saving`?h():N()})]}),d?null:(0,X.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:y()}),a===`done`?(0,X.jsx)(`p`,{className:`oc-admin__hint`,role:`status`,children:c()}):null,a===`error`?(0,X.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:o()}):null,(0,X.jsx)(`p`,{className:`oc-cdefaults__help`,children:_()})]})}function ee(){let e=v(O.agentFiles.getChatDefaults),[t,n]=(0,q.useState)({status:`loading`}),o=E(O.admin.listInstances,{}),[c,p]=(0,q.useState)(null);(0,q.useEffect)(()=>{!o||o.length===0||(!c||!o.some(e=>e.name===c))&&p(o[0].name)},[o,c]);let m=(o?.length??0)>1,h=o!==void 0&&o.length===0,g=E(O.compat.forInstance,c?{instanceName:c}:`skip`),_=c?I(g,`configDefaults`):`loading`,y=_===`loading`?null:_.blocked,b=(0,q.useMemo)(()=>m&&c?{instanceName:c}:{},[m,c]),S=(0,q.useRef)(0),C=(0,q.useCallback)(async()=>{let t=++S.current;n({status:`loading`});try{let r=Y(await e(b));if(S.current!==t)return;n({status:`done`,current:r})}catch{if(S.current!==t)return;n({status:`error`})}},[e,b]);(0,q.useEffect)(()=>{y===!1&&(m&&!c||C())},[C,y,m,c]);let T=t.status===`done`?t.current:null,D=(0,q.useMemo)(()=>J.map(e=>({id:e,label:R(e)})),[]),j=(0,q.useMemo)(()=>[{id:`fast`,label:x()},{id:`standard`,label:k()}],[]);return(0,X.jsxs)(`div`,{className:`oc-cdefaults`,children:[(0,X.jsx)(`p`,{className:`oc-admin__hint`,children:i()}),m&&c?(0,X.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,X.jsx)(`span`,{className:`oc-cdefaults__label`,children:M()}),(0,X.jsxs)(B,{value:c,onValueChange:e=>p(e),children:[(0,X.jsx)(F,{size:`sm`,"aria-label":M(),children:(0,X.jsx)(H,{})}),(0,X.jsx)(V,{children:(o??[]).map(e=>(0,X.jsx)(z,{value:e.name,children:e.name},e.name))})]})]}):null,h?(0,X.jsx)(`p`,{className:`oc-admin__hint`,role:`status`,children:A()}):_===`loading`?(0,X.jsx)(`p`,{className:`oc-admin__hint`,children:s()}):_.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:s()}):t.status===`error`?(0,X.jsxs)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:[r(),` `,(0,X.jsx)(P,{variant:`outline`,size:`sm`,onClick:()=>void C(),children:w()})]}):(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,X.jsx)(`span`,{className:`oc-cdefaults__label`,children:d()}),(0,X.jsx)(L,{field:`thinkingLevel`,options:D,value:T?.thinkingDefault??null,onChange:()=>{},disabled:!0,ariaLabel:d()}),(0,X.jsx)(`p`,{className:`oc-cdefaults__help`,children:l()})]}),(0,X.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,X.jsx)(`span`,{className:`oc-cdefaults__label`,children:a()}),(0,X.jsx)(L,{field:`fastMode`,options:j,value:T===null||T.fastModeDefault===null?null:T.fastModeDefault?`fast`:`standard`,onChange:()=>{},disabled:!0,ariaLabel:a()}),(0,X.jsx)(`p`,{className:`oc-cdefaults__help`,children:u()})]}),(0,X.jsx)(`p`,{className:`oc-cdefaults__note`,children:f()})]}),(()=>{let e=o?.find(e=>e.name===(c??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 +1 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{_g as r,bg as i,gg as a,hg as o,vg as s,xg as c,yg as l}from"./api-
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{_g as r,bg as i,gg as a,hg as o,vg as s,xg as c,yg as l}from"./api-Dawxt_aS.js";import{t as u}from"./chevrons-up-down-CFK9IaHn.js";import{t as d}from"./button-alklyZ2M.js";import{Hn as f,It as p,Lt as m,Mt as h,Nt as g,Pn as _,Pt as v,dn as y,gn as b,ut as x,zn as S}from"./index-C-ySA5Hs.js";import{a as C,i as w,n as T,o as E,r as D,t as O}from"./table-CJ3_5RvQ.js";var k=t(e(),1);function A(e,t){return typeof e==`number`&&typeof t==`number`?e-t:typeof e==`boolean`&&typeof t==`boolean`?!!e-+!!t:String(e).localeCompare(String(t),void 0,{numeric:!0,sensitivity:`base`})}function j(e,t,n){return[...e].sort((e,r)=>{let i=t(e),a=t(r),o=i==null,s=a==null;if(o||s)return o&&s?0:o?1:-1;let c=A(i,a);return n===`asc`?c:-c})}var M=n();function N({title:e,rows:t,columns:n,rowActions:A,onAdd:N,addLabel:P=c(),bulkActions:F,emptyHint:I=i(),isExpanded:L,renderExpanded:R}){let[z,B]=(0,k.useState)(new Set),[V,H]=(0,k.useState)(null),U=t??[],W=V?n[V.index]:void 0,G=V&&W?.sort?j(U,W.sort,V.dir):U;function K(e){H(t=>!t||t.index!==e?{index:e,dir:`asc`}:t.dir===`asc`?{index:e,dir:`desc`}:null)}let q=+!!F+n.length+ +!!A,J=U.length>0&&z.size===U.length,Y=z.size>0&&!J;function X(){B(J?new Set:new Set(U.map(e=>e._id)))}function Z(e){B(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})}return(0,M.jsxs)(`div`,{className:`oc-dt`,children:[(0,M.jsxs)(`div`,{className:`oc-dt__bar`,children:[(0,M.jsx)(`h2`,{className:`oc-dt__title`,children:e}),(0,M.jsxs)(`div`,{className:`oc-dt__bar-actions`,children:[z.size>0&&F?F.map(e=>(0,M.jsxs)(d,{size:`sm`,variant:e.variant===`destructive`?`destructive`:`outline`,onClick:()=>{e.onSelect([...z]),B(new Set)},children:[e.variant===`destructive`?(0,M.jsx)(y,{}):null,e.label,` (`,z.size,`)`]},e.label)):null,N?(0,M.jsxs)(d,{size:`sm`,onClick:N,children:[(0,M.jsx)(b,{}),` `,P]}):null]})]}),t===void 0?(0,M.jsx)(`p`,{className:`oc-admin__hint`,children:l()}):U.length===0?(0,M.jsx)(`p`,{className:`oc-admin__hint`,children:I}):(0,M.jsxs)(O,{children:[(0,M.jsx)(C,{children:(0,M.jsxs)(E,{children:[F?(0,M.jsx)(w,{className:`w-8`,children:(0,M.jsx)(x,{"aria-label":s(),checked:J?!0:Y?`indeterminate`:!1,onCheckedChange:X})}):null,n.map((e,t)=>{let n=V?.index===t;return e.sort?(0,M.jsx)(w,{className:e.className,"aria-sort":n?V.dir===`asc`?`ascending`:`descending`:`none`,children:(0,M.jsxs)(`button`,{type:`button`,className:`oc-dt__sort`,onClick:()=>K(t),"aria-label":o({column:e.header}),children:[e.header,n?V.dir===`asc`?(0,M.jsx)(S,{className:`oc-dt__sort-icon`,"aria-hidden":!0}):(0,M.jsx)(f,{className:`oc-dt__sort-icon`,"aria-hidden":!0}):(0,M.jsx)(u,{className:`oc-dt__sort-icon oc-dt__sort-icon--idle`,"aria-hidden":!0})]})},e.header):(0,M.jsx)(w,{className:e.className,children:e.header},e.header)}),A?(0,M.jsx)(w,{className:`w-8`}):null]})}),(0,M.jsx)(T,{children:G.map(e=>{let t=A?.(e)??[],i=L?.(e)??!1;return(0,M.jsxs)(k.Fragment,{children:[(0,M.jsxs)(E,{className:`group/row`,children:[F?(0,M.jsx)(D,{children:(0,M.jsx)(x,{"aria-label":r(),checked:z.has(e._id),onCheckedChange:()=>Z(e._id)})}):null,n.map(t=>(0,M.jsx)(D,{className:t.className,children:t.cell(e)},t.header)),A?(0,M.jsx)(D,{children:t.length>0?(0,M.jsxs)(h,{children:[(0,M.jsx)(m,{asChild:!0,children:(0,M.jsx)(d,{variant:`ghost`,size:`icon-sm`,"aria-label":a(),className:`opacity-0 transition-opacity group-hover/row:opacity-100 group-focus-within/row:opacity-100 aria-expanded:opacity-100`,children:(0,M.jsx)(_,{})})}),(0,M.jsx)(g,{align:`end`,children:t.map((t,n)=>(0,M.jsxs)(`div`,{children:[t.variant===`destructive`&&n>0?(0,M.jsx)(p,{}):null,(0,M.jsx)(v,{variant:t.variant,onSelect:()=>t.onSelect(e),children:t.label})]},t.label))})]}):null}):null]}),i&&R?(0,M.jsx)(E,{className:`oc-dt__expansion`,children:(0,M.jsx)(D,{colSpan:q,className:`oc-dt__expansion-cell`,children:R(e)})}):null]},e._id)})})]})]})}export{N as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./bundle-mjs-C73ZY4La.js";import{Et as t}from"./index-
|
|
1
|
+
import{r as e}from"./bundle-mjs-C73ZY4La.js";import{Et as t}from"./index-C-ySA5Hs.js";var n=e();function r({icon:e,total:r,items:i}){if(r===0)return(0,n.jsxs)(t,{variant:`outline`,className:`oc-group-chip oc-group-chip--empty gap-1`,children:[e,`0`]});let a=r-i.length;return(0,n.jsxs)(`div`,{className:`oc-group-detail`,children:[i.map((e,r)=>(0,n.jsxs)(t,{variant:e.highlight?`secondary`:`outline`,className:`oc-group-chip gap-1`,title:e.label,children:[e.marker,(0,n.jsx)(`span`,{className:`oc-group-chip__txt`,children:e.label})]},r)),a>0?(0,n.jsxs)(t,{variant:`outline`,className:`oc-group-chip`,children:[`+`,a]}):null]})}export{r as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$O as r,Ak as i,BO as a,Ck as o,Dk as s,Ek as c,FO as l,GO as u,HO as d,IO as f,JO as p,KO as
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$O as r,Ak as i,BO as a,Ck as o,Dk as s,Ek as c,FO as l,GO as u,HO as d,IO as f,JO as p,KO as ee,LO as m,MO as te,Mk as h,NO as g,Nk as _,Ok as ne,PO as re,QO as ie,RO as ae,Sk as oe,Tk as v,UO as y,VO as b,WO as x,XO as S,YO as C,ZO as w,_k as T,_s as E,ak as D,bk as O,ck as k,dk as A,ek as j,fk as M,gk as N,hk as P,ik as F,jO as I,jk as L,kk as R,lk as z,mk as B,nk as V,oV as H,ok as U,pk as W,qO as G,rk as K,sV as q,sk as se,t as J,tk as ce,uk as le,vk as ue,wk as de,xk as fe,yk as pe,ys as me,zO as he}from"./api-Dawxt_aS.js";import{t as ge}from"./button-alklyZ2M.js";import{U as _e,ct as Y}from"./index-C-ySA5Hs.js";import{t as ve}from"./DataTableShell-DGGSIwCx.js";var X=t(e(),1),Z=n(),ye={altered_words:()=>_(),incorrect:()=>h(),incoherence:()=>L(),formatting:()=>i(),latency:()=>R(),api_error:()=>ne(),other:()=>s()},Q=e=>ye[e]?.()??e;function $({matches:e,sourceWasOpen:t}){return t?e===!0?(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-ok`,children:v()}):e===!1?(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-warn`,children:de()}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill`,children:`—`}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill`,children:c()})}function be({data:e,reference:t,closeReason:n}){let r=e.snapshot,i=H(J.feedback.respondToFeedback),[a,s]=(0,X.useState)(e.thread),[c,l]=(0,X.useState)(``),[u,d]=(0,X.useState)(!1);async function f(){let t=c.trim();if(!(!t||u)){d(!0);try{await i({feedbackId:e._id,text:t}),s(e=>[...e,{authorRole:`admin`,text:t,at:Date.now()}]),l(``)}finally{d(!1)}}}let p=[];try{p=r.contextJson?JSON.parse(r.contextJson):[]}catch{p=[]}return(0,Z.jsxs)(`div`,{className:`oc-fbadmin__detail`,children:[(0,Z.jsxs)(`div`,{className:`oc-fbadmin__row`,children:[(0,Z.jsx)($,{matches:r.displayedMatchesStored,sourceWasOpen:r.clientInfo?.sourceWasOpen??!1}),(0,Z.jsxs)(`span`,{className:`oc-fbadmin__meta`,children:[Q(e.category),` · `,r.messageRole,r.isRegeneration?` · ${o()}`:``,r.openclawModel?` · ${r.openclawModel}`:``,r.openclawRuntime?` (${r.openclawRuntime})`:``]}),t?(0,Z.jsx)(`code`,{className:`oc-fbadmin__ref`,style:{userSelect:`all`,marginLeft:`auto`},title:w(),children:t}):null]}),e.comment?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:oe()}),(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:m()}),(0,Z.jsx)(`p`,{className:`oc-fbadmin__comment`,children:n})]}):null,(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:fe()}),a.length>0?(0,Z.jsx)(`div`,{className:`oc-fbadmin__thread`,children:a.map((e,t)=>(0,Z.jsxs)(`div`,{className:`oc-notif__msg oc-notif__msg--${e.authorRole}`,children:[(0,Z.jsx)(`span`,{className:`oc-notif__msg-who`,children:e.authorRole===`admin`?O():e.authorRole===`agent`?e.authorLabel??me():pe()}),(0,Z.jsx)(`span`,{className:`oc-notif__msg-text`,children:e.text})]},t))}):(0,Z.jsx)(`p`,{className:`oc-fbadmin__meta`,children:ue()}),(0,Z.jsx)(`textarea`,{className:`oc-feedback__textarea`,placeholder:T(),value:c,maxLength:2e3,rows:3,onChange:e=>l(e.target.value.slice(0,2e3))}),(0,Z.jsx)(`div`,{className:`oc-fbadmin__row`,style:{justifyContent:`flex-end`},children:(0,Z.jsx)(ge,{size:`sm`,onClick:()=>void f(),disabled:!c.trim()||u,children:u?N():P()})})]}),(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:B()}),(0,Z.jsx)(`pre`,{className:`oc-msg__source-pre`,children:r.messageText||W()})]}),r.clientInfo?.sourceWasOpen&&r.displayedText!==void 0?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:M()}),(0,Z.jsx)(`pre`,{className:`oc-msg__source-pre`,children:r.displayedText||W()})]}):null,r.promptText?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:A()}),(0,Z.jsx)(`pre`,{className:`oc-msg__source-pre`,children:r.promptText})]}):null,p.length>0?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:le({count:r.contextCount??p.length,truncated:r.contextTruncated?z():``})}),(0,Z.jsx)(`div`,{className:`oc-fbadmin__ctx`,children:p.map((e,t)=>(0,Z.jsxs)(`div`,{className:`oc-fbadmin__ctx-turn`,children:[(0,Z.jsx)(`span`,{className:`oc-fbadmin__ctx-role`,children:e.role}),(0,Z.jsx)(`span`,{className:`oc-fbadmin__ctx-text`,children:e.text})]},t))})]}):null,r.outboxAvailable?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:k()}),(0,Z.jsxs)(`pre`,{className:`oc-msg__source-pre`,children:[r.outboxText??``,r.outboxStatus?`\n[status: ${r.outboxStatus}]`:``]})]}):null,r.clientInfo?.extensionsDetected&&r.clientInfo.extensionsDetected.length>0?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:se()}),(0,Z.jsx)(`div`,{className:`oc-fbadmin__row`,children:r.clientInfo.extensionsDetected.map(e=>(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-warn`,children:e},e))})]}):null,(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:U()}),(0,Z.jsxs)(`p`,{className:`oc-fbadmin__env`,children:[[r.clientInfo?.language,r.clientInfo?.timezone,r.clientInfo?.theme?D({theme:r.clientInfo.theme}):null,r.runId?`run ${r.runId.slice(0,12)}…`:null].filter(Boolean).join(` · `)||`—`,r.clientInfo?.plugins&&r.clientInfo.plugins.length>0?(0,Z.jsxs)(`span`,{className:`oc-fbadmin__plugins`,children:[F(),` `,r.clientInfo.plugins.join(`, `),(0,Z.jsxs)(`span`,{className:`oc-fbadmin__note`,children:[` `,K()]})]}):null,r.clientInfo?.userAgent?(0,Z.jsx)(`span`,{className:`oc-fbadmin__ua`,children:r.clientInfo.userAgent}):null]})]})]})}function xe(){let e=q(J.feedback.listForAdmin,{}),t=H(J.feedback.readSnapshot),n=H(J.feedback.deleteFeedback),i=_e(),[o,s]=(0,X.useState)(null),[c,m]=(0,X.useState)({});async function h(e){if(o===e._id){s(null);return}if(!c[e._id]){let n=await t({feedbackId:e._id});m(t=>({...t,[e._id]:n}))}s(e._id)}async function _(e){await i({title:g(),description:te(),confirmLabel:I(),destructive:!0})&&(await n({feedbackId:e._id}),o===e._id&&s(null))}return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`p`,{className:`oc-admin__hint`,children:[V(),` `,(0,Z.jsx)(`strong`,{children:ce()}),` `,j()]}),(0,Z.jsx)(ve,{title:r(),rows:e,emptyHint:ie(),isExpanded:e=>o===e._id&&!!c[e._id],renderExpanded:e=>c[e._id]?(0,Z.jsx)(be,{data:c[e._id],reference:e.reference,closeReason:e.userCloseReason}):null,columns:[{header:S(),cell:e=>Y(e.at),sort:e=>e.at},{header:C(),cell:e=>Q(e.category),sort:e=>Q(e.category)},{header:p(),cell:e=>e.messageRole===`user`?G():ee(),sort:e=>e.messageRole},{header:u(),cell:e=>(e.reporterEmail||e.reporterName||`—`)+(e.impersonated&&e.realOperatorEmail?` ${x({operator:e.realOperatorEmail})}`:``),sort:e=>e.reporterEmail||e.reporterName||null},{header:y(),cell:e=>(0,Z.jsx)($,{matches:e.displayedMatchesStored,sourceWasOpen:e.sourceWasOpen}),sort:e=>e.displayedMatchesStored===!1?0:e.displayedMatchesStored===!0?1:2},{header:d(),cell:e=>e.hasComment?`✎`:`—`,sort:e=>+!!e.hasComment},{header:b(),cell:e=>e.userClosedAt==null?e.resolvedAt==null?e.answered?(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-ok`,children:a()}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill`,children:he()}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-ok`,title:e.resolvedBy??void 0,children:E()}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-closed`,children:ae()}),sort:e=>e.userClosedAt==null?e.resolvedAt==null?+!!e.answered:2:3}],rowActions:e=>[{label:o===e._id?f():l(),onSelect:()=>void h(e)},{label:re(),onSelect:()=>void _(e),variant:`destructive`}]})]})}export{xe as FeedbacksTab};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./bundle-mjs-C73ZY4La.js";import{D as t,
|
|
1
|
+
import{r as e}from"./bundle-mjs-C73ZY4La.js";import{D as t,mV as n}from"./api-Dawxt_aS.js";import{I as r,L as i,R as a,Xt as o,Yt as s,z as c}from"./index-C-ySA5Hs.js";import"./locales-CPjguROj.js";import"./curation-CQksaIbm.js";var l=t(`circle-question-mark`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3`,key:`1u773s`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]]),u=[`gateway-http`,`shared-fs`,`off`],d=[`inline`,`shared-fs`],f=[`reactive`,`sse`],p=`reactive`;n.object({mediaMode:n.optional(n.union(n.literal(`gateway-http`),n.literal(`shared-fs`),n.literal(`off`))),inboundMediaMode:n.optional(n.union(n.literal(`inline`),n.literal(`shared-fs`))),rehydration:n.optional(n.boolean()),mediaMaxMb:n.optional(n.number()),attachmentFixAttested:n.optional(n.boolean()),summarizeThresholdChars:n.optional(n.number()),curationEnabled:n.optional(n.boolean()),curationBudgetChars:n.optional(n.number()),converterAgentId:n.optional(n.string()),voiceEnabled:n.optional(n.boolean()),talkEnabled:n.optional(n.boolean()),voiceEngine:n.optional(n.union(n.literal(`browser`),n.literal(`gateway`))),voiceLang:n.optional(n.string()),voiceRate:n.optional(n.number()),voiceAutoRead:n.optional(n.boolean()),contentLocale:n.optional(n.string()),inboundAgentMount:n.optional(n.string()),outboundAgentMount:n.optional(n.string()),promptInjections:n.optional(n.record(n.string(),n.object({enabled:n.optional(n.boolean()),template:n.optional(n.string())})))});var m={mediaMode:`gateway-http`,inboundMediaMode:`inline`,rehydration:!0,mediaMaxMb:1024,inboundAgentMount:`/home/node/.openclaw/media/inbound`,outboundAgentMount:`/home/node/.openclaw/media/outbound`};function h(e,t){let n={};for(let r of o){let i=e?.[r];n[r]={enabled:i?.enabled??!0,template:typeof i?.template==`string`&&i.template.length>0?i.template:s[r].defaultTemplate[t]}}return n}function g(e,t){let n={};for(let r of o){let i=s[r],a=e[r];if(!a)continue;let o={};i.togglable&&a.enabled===!1&&(o.enabled=!1);let c=a.template.trim();c.length>0&&c!==i.defaultTemplate[t]&&(o.template=c),(o.enabled!==void 0||o.template!==void 0)&&(n[r]=o)}return n}function _(e,t){return{mediaMode:e.mediaMode??m.mediaMode,inboundMediaMode:e.inboundMediaMode??m.inboundMediaMode,rehydration:e.rehydration??m.rehydration,mediaMaxMb:e.mediaMaxMb??m.mediaMaxMb,inboundAgentMount:e.inboundAgentMount??m.inboundAgentMount,outboundAgentMount:e.outboundAgentMount??m.outboundAgentMount,promptInjections:h(e.promptInjections,t)}}var v=[`attachmentFixAttested`,`summarizeThresholdChars`,`curationEnabled`,`curationBudgetChars`,`contentLocale`,`converterAgentId`];function y(e,t,n){let r={},i=n=>{(e[n]!==m[n]||t[n]!==void 0)&&(r[n]=e[n])};i(`mediaMode`),i(`inboundMediaMode`),i(`rehydration`),i(`mediaMaxMb`),i(`inboundAgentMount`),i(`outboundAgentMount`);let a=g(e.promptInjections,n);Object.keys(a).length>0&&(r.promptInjections=a);let o=t;for(let e of v){let t=o[e];(typeof t==`number`||typeof t==`boolean`||typeof t==`string`)&&(r[e]=t)}return r}var b=e();function x({text:e}){return(0,b.jsx)(a,{delayDuration:150,children:(0,b.jsxs)(r,{children:[(0,b.jsx)(c,{asChild:!0,children:(0,b.jsx)(`button`,{type:`button`,className:`oc-field__help`,"aria-label":e,onClick:e=>e.preventDefault(),children:(0,b.jsx)(l,{"aria-hidden":!0})})}),(0,b.jsx)(i,{className:`max-w-xs text-pretty`,children:e})]})})}function S({label:e,help:t}){return(0,b.jsxs)(`span`,{className:`oc-field__label`,children:[e,(0,b.jsx)(x,{text:t})]})}export{p as a,f as c,_ as i,S as n,d as o,y as r,u as s,x as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$z as ee,Bz as te,Cs as r,Gz as ne,Hz as re,Jz as ie,Kz as i,QB as ae,Qz as oe,Rz as se,Ss as ce,Uz as a,Vz as o,Wz as s,Xz as c,Yz as l,Zz as le,_B as ue,aB as u,cB as d,dB as de,eB as fe,eV as pe,fB as me,gB as f,hB as p,iB as m,lB as he,mB as ge,nB as h,oB as g,oV as _e,pB as ve,qz as ye,rB as _,sB as v,sV as be,t as y,tB as b,tN as x,uB as S,vB as C,yB as w,zz as T}from"./api-Dawxt_aS.js";import{t as E}from"./button-alklyZ2M.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-C-ySA5Hs.js";import{a as Ne,i as z,n as Pe,o as B,r as V,t as Fe}from"./table-CJ3_5RvQ.js";var H=t(e(),1),U=n(),W=`all`;function G(e){switch(e){case`image`:return d();case`audio`:return v();case`video`:return g();case`pdf`:return u();case`document`:return m();case`archive`:return _();default:return h()}}function K(){let[e,t]=(0,H.useState)(W),[n,u]=(0,H.useState)(W),[d,m]=(0,H.useState)(W),[h,g]=(0,H.useState)(W),[_,v]=(0,H.useState)(!1),[K,q]=(0,H.useState)(null),J=_e(y.files.softDelete),Y=k();function Ie(){t(W),u(W),m(W),g(W)}async function Le(){let e=K;if(q(null),e)try{await J({fileId:e.id}),Y.success(ne())}catch(e){Y.error(s(),e)}}let X=be(y.files.listMine,{direction:e===W?void 0:e,chatId:n===W?void 0:n,instanceName:d===W?void 0:d,category:h===W?void 0:h,includeAutoGenerated:_||void 0}),Re=(0,H.useMemo)(()=>new Intl.DateTimeFormat(pe(),{dateStyle:`medium`,timeStyle:`short`}),[]);if(X===void 0)return(0,U.jsx)(`p`,{className:`oc-admin__hint`,children:ae()});let{files:Z,facets:Q,truncated:ze,cap:Be}=X,$=e!==W||n!==W||d!==W||h!==W;return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`p`,{className:`oc-admin__hint`,children:w()}),(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:ue()}),(0,U.jsx)(F,{value:`inbound`,children:f()}),(0,U.jsx)(F,{value:`outbound`,children:p()})]})]}),(0,U.jsxs)(I,{value:n,onValueChange:u,children:[(0,U.jsx)(D,{size:`sm`,"aria-label":ge(),children:(0,U.jsx)(R,{})}),(0,U.jsxs)(L,{children:[(0,U.jsx)(F,{value:W,children:ve()}),Q.chats.map(e=>(0,U.jsx)(F,{value:e.id,children:e.title},e.id))]})]}),Q.multiProvider?(0,U.jsxs)(I,{value:d,onValueChange:m,children:[(0,U.jsx)(D,{size:`sm`,"aria-label":me(),children:(0,U.jsx)(R,{})}),(0,U.jsxs)(L,{children:[(0,U.jsx)(F,{value:W,children:de()}),Q.instances.map(e=>(0,U.jsx)(F,{value:e,children:e},e))]})]}):null,(0,U.jsxs)(I,{value:h,onValueChange:g,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:he()}),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:_,onCheckedChange:e=>v(e===!0),"aria-label":r()}),(0,U.jsx)(`span`,{children:r()})]}),$?(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}),ie()]}):null]}),Z.length===0?(0,U.jsx)(`p`,{className:`oc-admin__hint`,children:$?T():te()}):(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:b()}),(0,U.jsx)(z,{children:fe()}),(0,U.jsx)(z,{children:ee()}),(0,U.jsx)(z,{children:oe()}),(0,U.jsx)(z,{children:le()}),(0,U.jsx)(z,{className:`text-right`,children:c()})]})}),(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:ce()}):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`?f():p()})}),(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":ye(),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}),l()]})}):(0,U.jsxs)(P,{disabled:!0,children:[(0,U.jsx)(j,{size:14}),o()]}),(0,U.jsxs)(P,{variant:`destructive`,onSelect:()=>q({id:e._id,filename:e.filename}),children:[(0,U.jsx)(Ee,{size:14}),i()]})]})]})})]},e._id))})]}),ze?(0,U.jsx)(`p`,{className:`oc-admin__hint`,style:{marginTop:8},children:se({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:a()}),(0,U.jsx)(Ce,{children:re()})]}),(0,U.jsxs)(O,{children:[(0,U.jsx)(Te,{children:x()}),(0,U.jsx)(Me,{onClick:()=>void Le(),children:i()})]})]})})]})}export{K as FilesTab};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Cg as r,Sg as i}from"./api-
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Cg as r,Sg as i}from"./api-Dawxt_aS.js";import{t as a}from"./button-alklyZ2M.js";import{hn as o,jt as s,mn as c}from"./index-C-ySA5Hs.js";import{t as l}from"./TimeRangePicker-DVMsYipt.js";var u=t(e(),1),d=n(),f=250;function p({q:e,onQChange:t,searchPlaceholder:n=r(),children:p,timeRange:m,onTimeRangeChange:h,onReset:g,canReset:_=!0}){let[v,y]=(0,u.useState)(e);(0,u.useEffect)(()=>{y(e)},[e]);let b=(0,u.useRef)(null);function x(e){y(e),b.current!==null&&window.clearTimeout(b.current),b.current=window.setTimeout(()=>t(e),f)}(0,u.useEffect)(()=>()=>{b.current!==null&&window.clearTimeout(b.current)},[]);function S(){b.current!==null&&window.clearTimeout(b.current),g()}return(0,d.jsxs)(`div`,{className:`oc-filterbar`,children:[(0,d.jsxs)(`div`,{className:`oc-filterbar__search`,children:[(0,d.jsx)(c,{className:`oc-filterbar__search-icon`,"aria-hidden":!0}),(0,d.jsx)(s,{value:v,onChange:e=>x(e.target.value),placeholder:n,"aria-label":n})]}),p?(0,d.jsx)(`div`,{className:`oc-filterbar__quick`,children:p}):null,m&&h?(0,d.jsx)(l,{value:m,onChange:h}):null,(0,d.jsxs)(a,{variant:`ghost`,size:`sm`,className:`oc-filterbar__reset`,onClick:S,disabled:!_,children:[(0,d.jsx)(o,{}),i()]})]})}export{p as t};
|
|
@@ -1 +1 @@
|
|
|
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,Cm as o,Cp as s,D as c,Dm as l,Dp as u,Em as d,Ep as f,Fp as p,Gp as m,Hp as h,Ip as g,Jp as _,Kp as v,Lp as y,Mp as b,Np as x,Om as S,Op as C,Pp as w,Qp as T,Rp as E,Sm as ee,Sp as D,Tm as O,Tp as te,Up as ne,Vp as re,Wp as ie,Xp as k,Yp as A,Zp as ae,_m as oe,aV as j,am as se,bm as M,bp as N,cm as P,dm as ce,em as F,fm as le,gm as ue,hm as de,im as fe,jp as pe,km as me,kp as he,lm as ge,mm as _e,nm as ve,oV as I,om as ye,pm as be,qp as xe,rm as Se,sm as Ce,t as L,tm as we,um as Te,vm as Ee,wm as De,wp as R,xm as Oe,xp as ke,ym as Ae,zp as je}from"./api-DRlXTl06.js";import{t as Me}from"./x-BM-3QiyY.js";import{i as z,n as B,r as Ne,t as Pe}from"./tabs-KQ0HdNTL.js";import{t as V}from"./button-CTuIl1H-.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-D48cFy6f.js";import{t as Ze}from"./FilterBar-Of8GWz2N.js";import{t as Qe}from"./DataTableShell-C0MSDiic.js";import{t as J}from"./DetailChips-V2Qp_G9Y.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 k();case`user`:return A();case`pending`:return _();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=I(L.groups.listGroups,{}),t=I(L.me.getMe,{host:Je})?.role===`admin`,n=j(L.groups.createGroup),r=j(L.groups.updateGroup),i=j(L.groups.deleteGroup),a=Re(),c=H(),[u,f]=(0,Z.useState)(!1),[p,m]=(0,Z.useState)(null),[h,g]=(0,Z.useState)($),[_,v]=(0,Z.useState)(null),[y,b]=(0,Z.useState)(``),x=(0,Z.useMemo)(()=>{if(!e)return e;let t=y.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,y]);function C(){m(null),g($),f(!0)}function w(e){m(e),g({name:e.name,description:e.description??``}),f(!0)}async function T(){try{p?await r({groupId:p._id,name:h.name,description:h.description}):await n({name:h.name,description:h.description||void 0}),g($),m(null),f(!1)}catch(e){c.error(s(),e)}}async function E(e){if(await a({title:Te({name:e.name}),description:ge(),confirmWord:e.name,confirmLabel:P(),cancelLabel:ue(),destructive:!0}))try{await i({groupId:e._id})}catch(e){c.error(D(),e)}}return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:S()}),(0,Q.jsx)(Ze,{q:y,onQChange:b,onReset:()=>b(``),canReset:y!==``,searchPlaceholder:Oe()}),(0,Q.jsx)(Qe,{title:me(),rows:x,addLabel:l(),onAdd:t?C:void 0,emptyHint:d(),columns:[{header:O(),cell:e=>e.name,sort:e=>e.name},{header:De(),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:o(),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:ee(),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:M(),onSelect:()=>v({groupId:e._id,name:e.name})},...t?[{label:Ae(),onSelect:()=>w(e)},{label:Ee(),variant:`destructive`,onSelect:()=>void E(e)}]:[]]}),(0,Q.jsx)(He,{open:u,onOpenChange:f,title:p?_e():de(),description:be(),canSubmit:!!h.name.trim(),onSubmit:T,submitLabel:oe(),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:le()}),(0,Q.jsx)(G,{value:h.name,onChange:e=>g({...h,name:e.target.value})})]}),(0,Q.jsxs)(`label`,{className:`oc-field`,children:[(0,Q.jsx)(`span`,{className:`oc-field__label`,children:ce()}),(0,Q.jsx)(G,{value:h.description,onChange:e=>g({...h,description:e.target.value})})]})]})}),(0,Q.jsx)(ct,{groupId:_?.groupId??null,groupName:_?.name??``,open:_!==null,onOpenChange:e=>{e||v(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}),r()]}),(0,Q.jsxs)(`span`,{className:`oc-access__pageinfo`,"aria-label":ae({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:[T(),(0,Q.jsx)(Ie,{size:14,"aria-hidden":!0})]})]})}function ct({groupId:e,groupName:t,open:n,onOpenChange:r}){let i=I(L.groups.getGroup,n&&e?{groupId:e}:`skip`),a=I(L.groups.listAssignableInstances,n?{}:`skip`),o=I(L.groups.listAssignableUsers,n?{}:`skip`),s=j(L.groups.addMember),c=j(L.groups.removeMember),l=j(L.groups.bulkSetMembers),d=j(L.groups.setGroupManager),p=H(),[_,v]=(0,Z.useState)(``),[y,b]=(0,Z.useState)(``),[x,S]=(0,Z.useState)(`members`),[w,T]=(0,Z.useState)(1),[E,ee]=(0,Z.useState)(new Set),D=(0,Z.useRef)(null),O=(0,Z.useMemo)(()=>new Set((i?.members??[]).map(e=>e.userId)),[i]),re=(0,Z.useMemo)(()=>new Set((i?.members??[]).filter(e=>e.manager).map(e=>e.userId)),[i]),ie=i?.viewerIsAdmin===!0,k=(0,Z.useMemo)(()=>new Set((i?.agents??[]).map(e=>`${e.instanceName}/${e.agentId}`)),[i]);(0,Z.useEffect)(()=>{v(``),b(``),S(`members`),T(1),D.current=null},[n,e]),(0,Z.useEffect)(()=>{T(1)},[_]),(0,Z.useEffect)(()=>{n&&i&&e&&D.current!==e&&(D.current=e,ee(new Set((i.members??[]).map(e=>e.userId))))},[n,i,e]);let A=(0,Z.useMemo)(()=>o?$e(o,_,E):[],[o,_,E]);async function ae(t,n){if(e)try{n?await c({groupId:e,userId:t}):await s({groupId:e,userId:t})}catch(e){p.error(ke(),e)}}async function oe(t,n){if(e)try{await d({groupId:e,userId:t,manager:!n})}catch(e){p.error(te(),e)}}let M=rt(A,e=>O.has(e.userId)),N=A.filter(e=>O.has(e.userId)).length,P=it(A,w,ot);async function ce(){if(!e||A.length===0)return;let t=A.map(e=>e.userId);try{await l({groupId:e,userIds:t,member:M!==`all`})}catch(e){p.error(ke(),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:Ce({name:t})}),(0,Q.jsx)(Ye,{children:ye()})]}),(0,Q.jsxs)(Pe,{value:x,onValueChange:S,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}),se(),i?(0,Q.jsx)(U,{variant:`secondary`,className:`oc-access__tabcount`,children:O.size}):null]}),(0,Q.jsxs)(z,{value:`agents`,className:`flex-1 gap-1.5`,children:[(0,Q.jsx)(K,{size:13,"aria-hidden":!0}),Se(),i?(0,Q.jsx)(U,{variant:`secondary`,className:`oc-access__tabcount`,children:k.size}):null]}),(0,Q.jsxs)(z,{value:`charts`,className:`flex-1 gap-1.5`,children:[(0,Q.jsx)(Y,{size:13,"aria-hidden":!0}),g(),i?(0,Q.jsx)(U,{variant:`secondary`,className:`oc-access__tabcount`,children:i.chartCount}):null]})]}),(0,Q.jsx)(B,{value:`members`,children:o===void 0||i===void 0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:m()}):o.length===0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:ne()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(G,{value:_,onChange:e=>v(e.target.value),placeholder:fe(),className:`oc-access__search`}),A.length===0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:we()}):(0,Q.jsxs)(Q.Fragment,{children:[A.length>1?(0,Q.jsxs)(`div`,{className:`oc-access__row oc-access__selectall`,children:[(0,Q.jsx)(q,{checked:M===`all`?!0:M===`some`?`indeterminate`:!1,onCheckedChange:()=>void ce(),"aria-label":F()}),(0,Q.jsx)(`span`,{className:`oc-access__label`,children:F()}),(0,Q.jsxs)(U,{variant:`outline`,className:`oc-access__count`,children:[N,` / `,A.length]})]}):null,(0,Q.jsx)(`div`,{className:`oc-access__list`,children:P.pageItems.map(e=>{let t=O.has(e.userId),n=tt(e),r=re.has(e.userId);return(0,Q.jsxs)(`div`,{className:`oc-access__row`,children:[(0,Q.jsx)(q,{checked:t,onCheckedChange:()=>void ae(e.userId,t),"aria-label":xe({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&&ie?(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?f():u(),title:r?f():u(),onClick:()=>void oe(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":C(),title:C(),children:(0,Q.jsx)(X,{size:15,"aria-hidden":!0})}):null})]},e._id)})}),(0,Q.jsx)(st,{page:P.page,pageCount:P.pageCount,onPage:T})]})]})}),(0,Q.jsx)(B,{value:`agents`,children:a===void 0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:m()}):a.length===0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:h()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(G,{value:y,onChange:e=>b(e.target.value),placeholder:ve(),className:`oc-access__search`}),(0,Q.jsx)(`div`,{className:`oc-access__list`,children:a.map(t=>(0,Q.jsx)(lt,{groupId:e,instanceName:t.name,kind:t.kind??`openclaw`,assigned:k,query:y},`${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 o=I(L.groups.listAssignableAgents,{instanceName:t}),s=j(L.groups.assignAgentToGroup),c=j(L.groups.removeAgentFromGroup),l=j(L.groups.bulkSetGroupAgents),u=H(),[d,f]=(0,Z.useState)(1);if((0,Z.useEffect)(()=>{f(1)},[i]),!e)return null;let p=et(o?.agents??[],i),m=o?.discovery&&!o.discovery.lastPollOk;if(i.trim()&&p.length===0)return null;let h=p.filter(e=>e.presentInLastOk!==!1&&e.enabled!==!1),g=rt(h,e=>r.has(`${t}/${e.agentId}`)),_=it(p,d,ot);async function b(n,r){try{r?await c({groupId:e,instanceName:t,agentId:n}):await s({groupId:e,instanceName:t,agentId:n})}catch(e){u.error(N(),e)}}async function x(){if(h.length===0)return;let n=h.map(e=>e.agentId);try{await l({groupId:e,instanceName:t,agentIds:n,assigned:g!==`all`})}catch(e){u.error(N(),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}),m?(0,Q.jsx)(U,{variant:`outline`,className:`oc-access__stale`,children:je()}):null]}),o===void 0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:ie()}):p.length===0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:m?a():re()}):(0,Q.jsxs)(Q.Fragment,{children:[h.length>1?(0,Q.jsxs)(`div`,{className:`oc-access__row oc-access__selectall`,children:[(0,Q.jsx)(q,{checked:g===`all`?!0:g===`some`?`indeterminate`:!1,onCheckedChange:()=>void x(),"aria-label":F()}),(0,Q.jsx)(`span`,{className:`oc-access__label`,children:F()})]}):null,_.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":v({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":y(),title:y(),children:(0,Q.jsx)(W,{size:14,fill:`currentColor`})}):null,a?(0,Q.jsx)(U,{variant:`outline`,className:`oc-access__gone`,children:E()}):null]},e.agentId)}),(0,Q.jsx)(st,{page:_.page,pageCount:_.pageCount,onPage:f})]})]})}function ut({groupId:e}){let t=I(L.charts.listGroupChartSelection,e?{groupId:e}:`skip`),n=j(L.charts.assignChartToGroup),r=j(L.charts.removeChartFromGroup),a=j(L.charts.setGroupDefaultChart),o=j(L.charts.addChartToGroupPool),s=j(L.charts.removeChartFromGroupPool),c=H();if(!e)return null;if(t===void 0)return(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:m()});let{pool:l,addable:u,canManagePool:d}=t;if(l.length===0&&!d)return(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:p()});async function f(t,i){try{i?await r({groupId:e,chartKey:t}):await n({groupId:e,chartKey:t})}catch(e){c.error(R(),e)}}async function h(t){try{await a({groupId:e,chartKey:t})}catch(e){c.error(R(),e)}}async function g(t){try{await o({groupId:e,chartKey:t})}catch(e){c.error(R(),e)}}async function _(t){try{await s({groupId:e,chartKey:t})}catch(e){c.error(R(),e)}}return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`div`,{className:`oc-access__list`,children:l.map(e=>(0,Q.jsxs)(`div`,{className:`oc-access__row`,children:[(0,Q.jsx)(q,{checked:e.selected,onCheckedChange:()=>void f(e.chartKey,e.selected),"aria-label":pe({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":i(),title:i(),children:(0,Q.jsx)(W,{size:14,fill:`currentColor`})}):(0,Q.jsx)(V,{type:`button`,variant:`ghost`,size:`sm`,onClick:()=>void h(e.chartKey),children:he()}):null,d?(0,Q.jsx)(V,{type:`button`,variant:`ghost`,size:`sm`,"aria-label":b({name:e.name}),title:b({name:e.name}),onClick:()=>void _(e.chartKey),children:(0,Q.jsx)(Me,{size:14,"aria-hidden":!0})}):null]},e.chartKey))}),d?u.length>0?(0,Q.jsxs)(Be,{value:``,onValueChange:e=>void g(e),children:[(0,Q.jsx)(Fe,{size:`sm`,className:`oc-access__search`,children:(0,Q.jsx)(Ge,{placeholder:x()})}),(0,Q.jsx)(Ve,{children:u.map(e=>(0,Q.jsx)(Le,{value:e.chartKey,children:e.name},e.chartKey))})]}):l.length===0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:w()}):null:null]})}export{at as GroupsTab};
|
|
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,Cm as o,Cp as s,D as c,Dm as l,Dp as u,Em as d,Ep as f,Fp as p,Gp as m,Hp as h,Ip as g,Jp as _,Kp as v,Lp as y,Mp as b,Np as x,Om as S,Op as C,Pp as w,Qp as T,Rp as E,Sm as ee,Sp as D,Tm as O,Tp as te,Up as ne,Vp as re,Wp as ie,Xp as k,Yp as A,Zp as ae,_m as oe,am as se,bm as j,bp as M,cm as N,dm as ce,em as P,fm as le,gm as ue,hm as de,im as fe,jp as pe,km as me,kp as he,lm as ge,mm as _e,nm as ve,oV as F,om as ye,pm as be,qp as xe,rm as Se,sV as I,sm as Ce,t as L,tm as we,um as Te,vm as Ee,wm as De,wp as R,xm as Oe,xp as ke,ym as Ae,zp as je}from"./api-Dawxt_aS.js";import{t as Me}from"./x-BSVAMcNy.js";import{i as z,n as B,r as Ne,t as Pe}from"./tabs-D-3HavQe.js";import{t as V}from"./button-alklyZ2M.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-C-ySA5Hs.js";import{t as Ze}from"./FilterBar-D_6ObXjr.js";import{t as Qe}from"./DataTableShell-DGGSIwCx.js";import{t as J}from"./DetailChips-DTzXBtIX.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 k();case`user`:return A();case`pending`:return _();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=I(L.groups.listGroups,{}),t=I(L.me.getMe,{host:Je})?.role===`admin`,n=F(L.groups.createGroup),r=F(L.groups.updateGroup),i=F(L.groups.deleteGroup),a=Re(),c=H(),[u,f]=(0,Z.useState)(!1),[p,m]=(0,Z.useState)(null),[h,g]=(0,Z.useState)($),[_,v]=(0,Z.useState)(null),[y,b]=(0,Z.useState)(``),x=(0,Z.useMemo)(()=>{if(!e)return e;let t=y.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,y]);function C(){m(null),g($),f(!0)}function w(e){m(e),g({name:e.name,description:e.description??``}),f(!0)}async function T(){try{p?await r({groupId:p._id,name:h.name,description:h.description}):await n({name:h.name,description:h.description||void 0}),g($),m(null),f(!1)}catch(e){c.error(s(),e)}}async function E(e){if(await a({title:Te({name:e.name}),description:ge(),confirmWord:e.name,confirmLabel:N(),cancelLabel:ue(),destructive:!0}))try{await i({groupId:e._id})}catch(e){c.error(D(),e)}}return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:S()}),(0,Q.jsx)(Ze,{q:y,onQChange:b,onReset:()=>b(``),canReset:y!==``,searchPlaceholder:Oe()}),(0,Q.jsx)(Qe,{title:me(),rows:x,addLabel:l(),onAdd:t?C:void 0,emptyHint:d(),columns:[{header:O(),cell:e=>e.name,sort:e=>e.name},{header:De(),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:o(),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:ee(),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:j(),onSelect:()=>v({groupId:e._id,name:e.name})},...t?[{label:Ae(),onSelect:()=>w(e)},{label:Ee(),variant:`destructive`,onSelect:()=>void E(e)}]:[]]}),(0,Q.jsx)(He,{open:u,onOpenChange:f,title:p?_e():de(),description:be(),canSubmit:!!h.name.trim(),onSubmit:T,submitLabel:oe(),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:le()}),(0,Q.jsx)(G,{value:h.name,onChange:e=>g({...h,name:e.target.value})})]}),(0,Q.jsxs)(`label`,{className:`oc-field`,children:[(0,Q.jsx)(`span`,{className:`oc-field__label`,children:ce()}),(0,Q.jsx)(G,{value:h.description,onChange:e=>g({...h,description:e.target.value})})]})]})}),(0,Q.jsx)(ct,{groupId:_?.groupId??null,groupName:_?.name??``,open:_!==null,onOpenChange:e=>{e||v(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}),r()]}),(0,Q.jsxs)(`span`,{className:`oc-access__pageinfo`,"aria-label":ae({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:[T(),(0,Q.jsx)(Ie,{size:14,"aria-hidden":!0})]})]})}function ct({groupId:e,groupName:t,open:n,onOpenChange:r}){let i=I(L.groups.getGroup,n&&e?{groupId:e}:`skip`),a=I(L.groups.listAssignableInstances,n?{}:`skip`),o=I(L.groups.listAssignableUsers,n?{}:`skip`),s=F(L.groups.addMember),c=F(L.groups.removeMember),l=F(L.groups.bulkSetMembers),d=F(L.groups.setGroupManager),p=H(),[_,v]=(0,Z.useState)(``),[y,b]=(0,Z.useState)(``),[x,S]=(0,Z.useState)(`members`),[w,T]=(0,Z.useState)(1),[E,ee]=(0,Z.useState)(new Set),D=(0,Z.useRef)(null),O=(0,Z.useMemo)(()=>new Set((i?.members??[]).map(e=>e.userId)),[i]),re=(0,Z.useMemo)(()=>new Set((i?.members??[]).filter(e=>e.manager).map(e=>e.userId)),[i]),ie=i?.viewerIsAdmin===!0,k=(0,Z.useMemo)(()=>new Set((i?.agents??[]).map(e=>`${e.instanceName}/${e.agentId}`)),[i]);(0,Z.useEffect)(()=>{v(``),b(``),S(`members`),T(1),D.current=null},[n,e]),(0,Z.useEffect)(()=>{T(1)},[_]),(0,Z.useEffect)(()=>{n&&i&&e&&D.current!==e&&(D.current=e,ee(new Set((i.members??[]).map(e=>e.userId))))},[n,i,e]);let A=(0,Z.useMemo)(()=>o?$e(o,_,E):[],[o,_,E]);async function ae(t,n){if(e)try{n?await c({groupId:e,userId:t}):await s({groupId:e,userId:t})}catch(e){p.error(ke(),e)}}async function oe(t,n){if(e)try{await d({groupId:e,userId:t,manager:!n})}catch(e){p.error(te(),e)}}let j=rt(A,e=>O.has(e.userId)),M=A.filter(e=>O.has(e.userId)).length,N=it(A,w,ot);async function ce(){if(!e||A.length===0)return;let t=A.map(e=>e.userId);try{await l({groupId:e,userIds:t,member:j!==`all`})}catch(e){p.error(ke(),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:Ce({name:t})}),(0,Q.jsx)(Ye,{children:ye()})]}),(0,Q.jsxs)(Pe,{value:x,onValueChange:S,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}),se(),i?(0,Q.jsx)(U,{variant:`secondary`,className:`oc-access__tabcount`,children:O.size}):null]}),(0,Q.jsxs)(z,{value:`agents`,className:`flex-1 gap-1.5`,children:[(0,Q.jsx)(K,{size:13,"aria-hidden":!0}),Se(),i?(0,Q.jsx)(U,{variant:`secondary`,className:`oc-access__tabcount`,children:k.size}):null]}),(0,Q.jsxs)(z,{value:`charts`,className:`flex-1 gap-1.5`,children:[(0,Q.jsx)(Y,{size:13,"aria-hidden":!0}),g(),i?(0,Q.jsx)(U,{variant:`secondary`,className:`oc-access__tabcount`,children:i.chartCount}):null]})]}),(0,Q.jsx)(B,{value:`members`,children:o===void 0||i===void 0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:m()}):o.length===0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:ne()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(G,{value:_,onChange:e=>v(e.target.value),placeholder:fe(),className:`oc-access__search`}),A.length===0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:we()}):(0,Q.jsxs)(Q.Fragment,{children:[A.length>1?(0,Q.jsxs)(`div`,{className:`oc-access__row oc-access__selectall`,children:[(0,Q.jsx)(q,{checked:j===`all`?!0:j===`some`?`indeterminate`:!1,onCheckedChange:()=>void ce(),"aria-label":P()}),(0,Q.jsx)(`span`,{className:`oc-access__label`,children:P()}),(0,Q.jsxs)(U,{variant:`outline`,className:`oc-access__count`,children:[M,` / `,A.length]})]}):null,(0,Q.jsx)(`div`,{className:`oc-access__list`,children:N.pageItems.map(e=>{let t=O.has(e.userId),n=tt(e),r=re.has(e.userId);return(0,Q.jsxs)(`div`,{className:`oc-access__row`,children:[(0,Q.jsx)(q,{checked:t,onCheckedChange:()=>void ae(e.userId,t),"aria-label":xe({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&&ie?(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?f():u(),title:r?f():u(),onClick:()=>void oe(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":C(),title:C(),children:(0,Q.jsx)(X,{size:15,"aria-hidden":!0})}):null})]},e._id)})}),(0,Q.jsx)(st,{page:N.page,pageCount:N.pageCount,onPage:T})]})]})}),(0,Q.jsx)(B,{value:`agents`,children:a===void 0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:m()}):a.length===0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:h()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(G,{value:y,onChange:e=>b(e.target.value),placeholder:ve(),className:`oc-access__search`}),(0,Q.jsx)(`div`,{className:`oc-access__list`,children:a.map(t=>(0,Q.jsx)(lt,{groupId:e,instanceName:t.name,kind:t.kind??`openclaw`,assigned:k,query:y},`${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 o=I(L.groups.listAssignableAgents,{instanceName:t}),s=F(L.groups.assignAgentToGroup),c=F(L.groups.removeAgentFromGroup),l=F(L.groups.bulkSetGroupAgents),u=H(),[d,f]=(0,Z.useState)(1);if((0,Z.useEffect)(()=>{f(1)},[i]),!e)return null;let p=et(o?.agents??[],i),m=o?.discovery&&!o.discovery.lastPollOk;if(i.trim()&&p.length===0)return null;let h=p.filter(e=>e.presentInLastOk!==!1&&e.enabled!==!1),g=rt(h,e=>r.has(`${t}/${e.agentId}`)),_=it(p,d,ot);async function b(n,r){try{r?await c({groupId:e,instanceName:t,agentId:n}):await s({groupId:e,instanceName:t,agentId:n})}catch(e){u.error(M(),e)}}async function x(){if(h.length===0)return;let n=h.map(e=>e.agentId);try{await l({groupId:e,instanceName:t,agentIds:n,assigned:g!==`all`})}catch(e){u.error(M(),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}),m?(0,Q.jsx)(U,{variant:`outline`,className:`oc-access__stale`,children:je()}):null]}),o===void 0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:ie()}):p.length===0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:m?a():re()}):(0,Q.jsxs)(Q.Fragment,{children:[h.length>1?(0,Q.jsxs)(`div`,{className:`oc-access__row oc-access__selectall`,children:[(0,Q.jsx)(q,{checked:g===`all`?!0:g===`some`?`indeterminate`:!1,onCheckedChange:()=>void x(),"aria-label":P()}),(0,Q.jsx)(`span`,{className:`oc-access__label`,children:P()})]}):null,_.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":v({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":y(),title:y(),children:(0,Q.jsx)(W,{size:14,fill:`currentColor`})}):null,a?(0,Q.jsx)(U,{variant:`outline`,className:`oc-access__gone`,children:E()}):null]},e.agentId)}),(0,Q.jsx)(st,{page:_.page,pageCount:_.pageCount,onPage:f})]})]})}function ut({groupId:e}){let t=I(L.charts.listGroupChartSelection,e?{groupId:e}:`skip`),n=F(L.charts.assignChartToGroup),r=F(L.charts.removeChartFromGroup),a=F(L.charts.setGroupDefaultChart),o=F(L.charts.addChartToGroupPool),s=F(L.charts.removeChartFromGroupPool),c=H();if(!e)return null;if(t===void 0)return(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:m()});let{pool:l,addable:u,canManagePool:d}=t;if(l.length===0&&!d)return(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:p()});async function f(t,i){try{i?await r({groupId:e,chartKey:t}):await n({groupId:e,chartKey:t})}catch(e){c.error(R(),e)}}async function h(t){try{await a({groupId:e,chartKey:t})}catch(e){c.error(R(),e)}}async function g(t){try{await o({groupId:e,chartKey:t})}catch(e){c.error(R(),e)}}async function _(t){try{await s({groupId:e,chartKey:t})}catch(e){c.error(R(),e)}}return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`div`,{className:`oc-access__list`,children:l.map(e=>(0,Q.jsxs)(`div`,{className:`oc-access__row`,children:[(0,Q.jsx)(q,{checked:e.selected,onCheckedChange:()=>void f(e.chartKey,e.selected),"aria-label":pe({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":i(),title:i(),children:(0,Q.jsx)(W,{size:14,fill:`currentColor`})}):(0,Q.jsx)(V,{type:`button`,variant:`ghost`,size:`sm`,onClick:()=>void h(e.chartKey),children:he()}):null,d?(0,Q.jsx)(V,{type:`button`,variant:`ghost`,size:`sm`,"aria-label":b({name:e.name}),title:b({name:e.name}),onClick:()=>void _(e.chartKey),children:(0,Q.jsx)(Me,{size:14,"aria-hidden":!0})}):null]},e.chartKey))}),d?u.length>0?(0,Q.jsxs)(Be,{value:``,onValueChange:e=>void g(e),children:[(0,Q.jsx)(Fe,{size:`sm`,className:`oc-access__search`,children:(0,Q.jsx)(Ge,{placeholder:x()})}),(0,Q.jsx)(Ve,{children:u.map(e=>(0,Q.jsx)(Le,{value:e.chartKey,children:e.name},e.chartKey))})]}):l.length===0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:w()}):null:null]})}export{at as GroupsTab};
|