@lacneu/atrium 0.77.0 → 0.78.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/{AccessTab-BPl6RGWf.js → AccessTab-YOPTfk-I.js} +1 -1
- package/dist/assets/{AdvancedFilter-QHL1Jz1Z.js → AdvancedFilter-Bm1TIX9k.js} +1 -1
- package/dist/assets/{AgentFilesTab-CjesR_c6.js → AgentFilesTab-DRQkurXm.js} +1 -1
- package/dist/assets/{AnomaliesTab-yzNzDsXN.js → AnomaliesTab-Dq2dqog2.js} +1 -1
- package/dist/assets/{AuditTab-1rUI2z6b.js → AuditTab-Cntt5whu.js} +1 -1
- package/dist/assets/{BridgeTab-COQr-xZD.js → BridgeTab-DzV-2POL.js} +1 -1
- package/dist/assets/{ChatDefaultsTab-CM2Yd28v.js → ChatDefaultsTab-C0sMC9lx.js} +1 -1
- package/dist/assets/{DataTableShell-CW5udl6V.js → DataTableShell-DWXPn72S.js} +1 -1
- package/dist/assets/{DetailChips-Dlt_uEHU.js → DetailChips-D6mdBUOT.js} +1 -1
- package/dist/assets/{FeedbacksTab-Uzv7-Dj0.js → FeedbacksTab-CbdS0wvF.js} +1 -1
- package/dist/assets/{FieldLabel-Bbe-KIdW.js → FieldLabel-Bww3UDFn.js} +1 -1
- package/dist/assets/{FilesTab-fi7x53E6.js → FilesTab-gqJalvPX.js} +1 -1
- package/dist/assets/{FilterBar-BO7_dR0d.js → FilterBar-FHDxb3k3.js} +1 -1
- package/dist/assets/{GroupsTab-C2ErNAiu.js → GroupsTab-BA8yKOnN.js} +1 -1
- package/dist/assets/{InstancesTab-D3PbSRsE.js → InstancesTab-sdopggdY.js} +1 -1
- package/dist/assets/{IntegrationsTab-DsvIgPM9.js → IntegrationsTab-BFpswDLB.js} +1 -1
- package/dist/assets/{KpiTab-boTUKc3M.js → KpiTab-DwKThxZR.js} +1 -1
- package/dist/assets/{PreferencesTab-D1GB1DjD.js → PreferencesTab-C3J_i-eF.js} +1 -1
- package/dist/assets/{ProjectPage-BKOn9--c.js → ProjectPage-Dk_aI-j5.js} +1 -1
- package/dist/assets/{PromptInjectionsTab-CMynIw-2.js → PromptInjectionsTab-B_mdD-DZ.js} +1 -1
- package/dist/assets/{RolesTab-rU1yG45_.js → RolesTab-AEwrbrY4.js} +1 -1
- package/dist/assets/{ScheduledTab-D1E65eqQ.js → ScheduledTab-1EVZpEec.js} +1 -1
- package/dist/assets/{ServiceAccountsTab-DTW2ImlD.js → ServiceAccountsTab-CGQ1lSPD.js} +1 -1
- package/dist/assets/{SubAgentReportsTab-C9t7ObEO.js → SubAgentReportsTab-jYVPpy6r.js} +1 -1
- package/dist/assets/{ThemeShowroom-SQKNzsXc.js → ThemeShowroom-Ce00J53a.js} +1 -1
- package/dist/assets/{TimeRangePicker-Di0xhZgB.js → TimeRangePicker-BlRNLd96.js} +1 -1
- package/dist/assets/{TimezoneCombobox-eEhKbenA.js → TimezoneCombobox-UX7uQX62.js} +1 -1
- package/dist/assets/{TracesTab-C_EHq15B.js → TracesTab-h8arGKis.js} +1 -1
- package/dist/assets/{UsersTab-Dk5CxK1-.js → UsersTab-CuY3xwoe.js} +1 -1
- package/dist/assets/{VoiceTab-CkceCrfE.js → VoiceTab-D-J9M4a1.js} +1 -1
- package/dist/assets/{highlighted-body-OFNGDK62-kKNZy35t.js → highlighted-body-OFNGDK62-B8scDgZo.js} +1 -1
- package/dist/assets/{index-c5j0e823.js → index-Bc3aF-kJ.js} +33 -33
- package/dist/assets/mermaid-GHXKKRXX-BcADHOv7.js +1 -0
- package/dist/assets/{pdf-DWeO12dm.js → pdf-DKBRfoBb.js} +1 -1
- package/dist/assets/{tabs-Bmd8xvTL.js → tabs-DHs6yOVA.js} +1 -1
- package/dist/index.html +1 -1
- package/package.json +1 -1
- package/dist/assets/mermaid-GHXKKRXX-BZZjoNSF.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Bp as r,Dz as i,Gp as a,Hp as o,Ip as s,Iz as c,Jp as l,Kp as u,Lp as d,Rp as f,Up as p,Vp as m,Wp as h,Xp as g,Yp as _,qp as v,t as y,zp as b}from"./api-Cpjr7qvl.js";import{$ as x,Et as S,Q as C,X as w,Z as T,et as E}from"./index-
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Bp as r,Dz as i,Gp as a,Hp as o,Ip as s,Iz as c,Jp as l,Kp as u,Lp as d,Rp as f,Up as p,Vp as m,Wp as h,Xp as g,Yp as _,qp as v,t as y,zp as b}from"./api-Cpjr7qvl.js";import{$ as x,Et as S,Q as C,X as w,Z as T,et as E}from"./index-Bc3aF-kJ.js";var D=t(e(),1);function O(e){return e===`user`?r():e===`all`?b():f({group:e.group})}function k(e){return e===`common`?d():e===`owner`?s():f({group:e.group})}var A=n();function j(e){return e.name||e.email||e.userId.slice(0,8)}function M(){let e=c(y.admin.listUsers,{}),[t,n]=(0,D.useState)(``),r=c(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":_(),children:(0,A.jsx)(E,{placeholder:_()})}),(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:l()}):r===void 0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:i()}):(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:v()}),(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:u()}),r.groups.length===0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:o()}):(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:a()}),r.agents.length===0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:o()}):(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:m()}):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:h()}),r.charts.length===0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:o()}):(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:p()}),r.permissions.length===0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:o()}):(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{cg as r,dg as i,fg as a,lg as o,pg as s,sg as c,ug as l}from"./api-Cpjr7qvl.js";import{t as u}from"./x-Dqrt5OdW.js";import{t as d}from"./button-CbwCr9Pi.js";import{$ as f,Q as p,Vn as m,X as h,Z as g,et as _,hn as v,jt as y}from"./index-
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{cg as r,dg as i,fg as a,lg as o,pg as s,sg as c,ug as l}from"./api-Cpjr7qvl.js";import{t as u}from"./x-Dqrt5OdW.js";import{t as d}from"./button-CbwCr9Pi.js";import{$ as f,Q as p,Vn as m,X as h,Z as g,et as _,hn as v,jt as y}from"./index-Bc3aF-kJ.js";import{r as b}from"./TimeRangePicker-BlRNLd96.js";var x=t(e(),1),S=n(),C=[{value:`eq`,label:`=`},{value:`neq`,label:`≠`},{value:`contains`,label:s()},{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 s=(0,x.useRef)(t),w=!!(s.current&&s.current.length>0),[D,O]=(0,x.useState)(w),[k,A]=(0,x.useState)(()=>w?E(s.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)(m,{className:`oc-advfilter__chevron`+(D?` is-open`:``),"aria-hidden":!0}),a(),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:i()}):(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:l()})}),(0,S.jsx)(g,{children:e.map(e=>(0,S.jsx)(p,{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)(p,{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:o()}),(0,S.jsx)(d,{variant:`ghost`,size:`icon-sm`,"aria-label":r(),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};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$u as r,Cd as i,Dd as a,Dz as o,Ed as s,Fa as c,Fz as l,Ia as u,Iz as d,La as f,Ma as p,Mj as m,Na as h,Nz as g,Od as _,Pa as v,Ra as y,Sd as b,Td as x,_d as S,_o as C,ad as w,ao as T,bd as E,bo as D,cd as O,co as k,dd as A,do as j,ed as M,eo as N,fd as P,ff as ee,fo as F,gd as te,go as ne,gt as re,hd as I,ho as L,id as R,io as ie,kz as z,ld as B,lo as V,md as H,mf as U,mo as ae,nd as oe,no as W,od as G,oo as se,pd as ce,po as le,rd as ue,ro as de,sd as fe,so as pe,t as K,td as me,to as he,ud as ge,uo as _e,vd as ve,vo as ye,wd as be,xd as xe,yd as Se,yo as Ce}from"./api-Cpjr7qvl.js";import{t as q}from"./button-CbwCr9Pi.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,ln as Y,nt as Ie,ot as Le,q as Re,rt as ze,tt as Be,vt as Ve,wt as He,xt as Ue,yt as We}from"./index-
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$u as r,Cd as i,Dd as a,Dz as o,Ed as s,Fa as c,Fz as l,Ia as u,Iz as d,La as f,Ma as p,Mj as m,Na as h,Nz as g,Od as _,Pa as v,Ra as y,Sd as b,Td as x,_d as S,_o as C,ad as w,ao as T,bd as E,bo as D,cd as O,co as k,dd as A,do as j,ed as M,eo as N,fd as P,ff as ee,fo as F,gd as te,go as ne,gt as re,hd as I,ho as L,id as R,io as ie,kz as z,ld as B,lo as V,md as H,mf as U,mo as ae,nd as oe,no as W,od as G,oo as se,pd as ce,po as le,rd as ue,ro as de,sd as fe,so as pe,t as K,td as me,to as he,ud as ge,uo as _e,vd as ve,vo as ye,wd as be,xd as xe,yd as Se,yo as Ce}from"./api-Cpjr7qvl.js";import{t as q}from"./button-CbwCr9Pi.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,ln as Y,nt as Ie,ot as Le,q as Re,rt as ze,tt as Be,vt as Ve,wt as He,xt as Ue,yt as We}from"./index-Bc3aF-kJ.js";import{n as Ge,t as Ke}from"./curation-CQksaIbm.js";import{a as qe}from"./compatView-BHtlzKRR.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
2
|
`))n.set(t,(n.get(t)??0)+1);for(let e of t.split(`
|
|
3
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=d(K.me.getMe,{host:Re}),t=e?.role===`admin`,n=(e?.permissions??[]).includes(`bridge.read`),r=d(K.admin.listInstances,e!==void 0&&t?{}:`skip`),[c,l]=(0,X.useState)(null);(0,X.useEffect)(()=>{!t||!r||r.length===0||(!c||!r.some(e=>e.name===c))&&l(r[0].name)},[t,r,c]);let u=d(K.agents.listAgentsForInstance,t&&c?{instanceName:c}:`skip`),f=d(K.agents.listMyAgents,e!==void 0&&!t?{}:`skip`),p=(0,X.useMemo)(()=>{if(e!==void 0){if(t)return c===null||u===void 0?r!==void 0&&r.length===0?[]:void 0:u.agents.map(e=>({instanceName:c,agentId:e.agentId,label:`${e.emoji?`${e.emoji} `:``}${e.displayName??e.agentId}`}));if(f!==void 0)return f.map(e=>({instanceName:e.instanceName,agentId:e.agentId,label:`${e.emoji?`${e.emoji} `:``}${e.displayName??e.agentId}`}))}},[e,t,c,u,r,f]),[m,h]=(0,X.useState)(null);(0,X.useEffect)(()=>{!p||p.length===0||(!m||!p.some(e=>$(e)===m))&&h($(p[0]))},[p,m]);let v=p?.find(e=>$(e)===m)??null,y=g(K.agentFiles.listAgentFiles),[w,T]=(0,X.useState)({status:`idle`}),D=v?.instanceName??null,O=v?.agentId??null,k=d(K.compat.forInstance,n&&D!==null?{instanceName:D}:`skip`),A=n&&D!==null?Te(k,`agentFiles`):null,j=A===null?!1:A===`loading`?null:A.blocked,M=(0,X.useCallback)(async()=>{if(!(D===null||O===null)){T({status:`loading`});try{T({status:`done`,files:(await y({instanceName:D,agentId:O})).files})}catch(e){T({status:`error`,dashboardAbsent:tt(e)})}}},[y,D,O]);(0,X.useEffect)(()=>{j===!1&&M()},[M,j]);let[N,P]=(0,X.useState)(null),F=d(K.agentFileCuration.listCurations,t&&D!==null&&O!==null?{instanceName:D,agentId:O}:`skip`),I=d(K.agentFileCuration.curationSettings,t&&D!==null?{instanceName:D}:`skip`),R=g(K.agentFileCuration.requestCuration),[ie,B]=(0,X.useState)(null),[V,H]=(0,X.useState)(null),{toast:U}=J(),ae=(0,X.useMemo)(()=>{let e=new Map;for(let t of F??[])e.has(t.name)||e.set(t.name,t);return e},[F]),oe=(0,X.useCallback)(async e=>{if(!(D===null||O===null)){B(e);try{let t=await R({instanceName:D,agentId:O,name:e,trigger:`manual`});t.ok?U({title:C(),variant:`success`}):U({title:ne({reason:t.reason??`unknown`}),variant:`error`})}catch{U({title:L(),variant:`error`})}finally{B(null)}}},[R,D,O,U]),W=z(),G=(0,X.useMemo)(()=>new Intl.NumberFormat(W,{maximumFractionDigits:0}),[W]);return e===void 0||p===void 0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:o()}):(0,Q.jsxs)(`div`,{className:`oc-afiles`,children:[(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:_()}),(0,Q.jsxs)(`div`,{className:`oc-afiles__picker`,children:[t&&(r?.length??0)>1?(0,Q.jsxs)(je,{value:c??``,onValueChange:e=>l(e),children:[(0,Q.jsx)(we,{size:`sm`,"aria-label":a(),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,p.length>0?(0,Q.jsxs)(je,{value:m??``,onValueChange:e=>h(e),children:[(0,Q.jsx)(we,{size:`sm`,"aria-label":s(),children:(0,Q.jsx)(Fe,{})}),(0,Q.jsx)(Me,{children:p.map(e=>(0,Q.jsx)(Oe,{value:$(e),children:e.label},$(e)))})]}):(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:x()})]}),v===null?null:A===`loading`?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:o()}):A!==null&&A.blocked?(0,Q.jsxs)(`p`,{className:`oc-compat__blocked`,role:`status`,children:[(0,Q.jsx)(Y,{size:14,"aria-hidden":!0}),` `,qe(A.gatewayVersion,A.provider)]}):w.status===`loading`||w.status===`idle`?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:o()}):w.status===`error`?(0,Q.jsxs)(`p`,{className:`oc-afiles__error`,role:`alert`,children:[w.dashboardAbsent?re():i(),` `,!w.dashboardAbsent&&(0,Q.jsx)(q,{variant:`outline`,size:`sm`,onClick:()=>void M(),children:ee()})]}):w.files.length===0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:be()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`div`,{className:`oc-afiles__list`,children:w.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:b()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`span`,{className:`oc-afiles__size`,children:xe({size:Z(e.size,W)})}),(0,Q.jsx)(`span`,{className:`oc-afiles__gauge${r?` is-warn`:``}`,"aria-hidden":!0,children:(0,Q.jsx)(`span`,{className:`oc-afiles__gauge-fill`,style:{width:`${Math.min(n,100)}%`}})}),(0,Q.jsx)(`span`,{className:`oc-afiles__pct`,children:E({pct:G.format(n)})}),r?(0,Q.jsx)(Y,{size:14,className:`oc-afiles__warn`,"aria-label":Se()}):(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:()=>P(e),children:t?S():te()}),t&&!e.missing?(0,Q.jsx)(it,{curatable:Ke.includes(e.name),size:e.size??0,budget:I?.budgetChars??null,enabled:I?.enabled??!1,curation:ae.get(e.name)??null,inFlight:ie===e.name,onCurate:()=>void oe(e.name),onReview:e=>H(e)}):null]},e.name)})}),(0,Q.jsx)(`p`,{className:`oc-afiles__budget`,children:ve({used:Z(Qe(w.files),W),total:Z(Ye,W),pct:G.format(Ze(Qe(w.files)))})})]}),N&&v?(0,Q.jsx)(at,{instanceName:v.instanceName,agentId:v.agentId,name:N.name,isAdmin:t,onClose:()=>P(null),onSaved:()=>void M()}):null,V?(0,Q.jsx)(ot,{curationId:V,onClose:()=>H(null),onApplied:()=>{H(null),M()}}):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:Ce()}):a||i?.status===`dispatched`||i?.status===`applying`?(0,Q.jsx)(De,{variant:`outline`,className:`oc-afiles__curate-status`,children:ye()}):e&&r&&n!==null&&Ge(t,n)?(0,Q.jsx)(q,{variant:`outline`,size:`sm`,className:`oc-afiles__curate`,onClick:o,children:D()}):null}function at({instanceName:e,agentId:t,name:n,isAdmin:i,onClose:a,onSaved:s}){let c=g(K.agentFiles.getAgentFile),l=g(K.agentFiles.setAgentFile),u=J(),[d,f]=(0,X.useState)(null),[p,h]=(0,X.useState)(!1),[_,v]=(0,X.useState)(``),[y,b]=(0,X.useState)(!1),[x,S]=(0,X.useState)(!1),[C,T]=(0,X.useState)(!1),[E,D]=(0,X.useState)(!1),k=(0,X.useCallback)(async r=>{h(!1);try{let i=await c({instanceName:e,agentId:t,name:n});f({content:i.content,updatedAtMs:i.updatedAtMs}),r||v(i.content),T(!1)}catch{h(!0)}},[c,e,t,n]);(0,X.useEffect)(()=>{k(!1)},[k]);async function j(){if(d!==null){S(!0),D(!1);try{await l({instanceName:e,agentId:t,name:n,content:_,baseUpdatedAtMs:d.updatedAtMs??void 0}),u.success(B({name:n})),s(),await k(!1)}catch(e){nt(e)?T(!0):D(!0)}finally{S(!1)}}}let N=d!==null&&_!==d.content,F=(0,X.useMemo)(()=>d===null?null:et(d.content,_),[d,_]),te=_.length>Je,ne=z(),re=(0,X.useMemo)(()=>new Intl.NumberFormat(ne),[ne]);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:I({name:n})}),(0,Q.jsxs)(ze,{children:[H({agent:t,instance:e}),i?null:(0,Q.jsxs)(Q.Fragment,{children:[` · `,ce()]})]})]}),p?(0,Q.jsxs)(`p`,{className:`oc-afiles__error`,role:`alert`,children:[fe(),` `,(0,Q.jsx)(q,{variant:`outline`,size:`sm`,onClick:()=>void k(!1),children:ee()})]}):d===null?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:o()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`textarea`,{className:`oc-afiles__source`,value:_,readOnly:!i,spellCheck:!1,onChange:e=>v(e.target.value),"aria-label":I({name:n})}),(0,Q.jsx)(`p`,{className:`oc-afiles__hint`,children:P()}),C?(0,Q.jsxs)(`p`,{className:`oc-afiles__error`,role:`alert`,children:[G(),` `,(0,Q.jsx)(q,{variant:`outline`,size:`sm`,onClick:()=>void k(!0),children:w()})]}):null,E?(0,Q.jsx)(`p`,{className:`oc-afiles__error`,role:`alert`,children:O()}):null,(0,Q.jsxs)(`div`,{className:`oc-afiles__editor-foot`,children:[(0,Q.jsx)(`span`,{className:`oc-afiles__count${te?` is-over`:``}`,children:A({count:re.format(_.length),max:re.format(Je)})}),i?(0,Q.jsx)(q,{size:`sm`,disabled:!N||x||C,onClick:()=>b(!0),children:x?U():ge()}):null]})]}),(0,Q.jsx)(Ve,{open:y,onOpenChange:b,children:(0,Q.jsxs)(Ue,{children:[(0,Q.jsxs)(He,{children:[(0,Q.jsx)(Ae,{children:R({name:n})}),(0,Q.jsx)(ke,{children:ue({agent:t})})]}),F?(0,Q.jsxs)(`div`,{className:`oc-afiles__diff`,children:[(0,Q.jsx)(`p`,{className:`oc-afiles__diff-counts`,children:oe({added:F.added,removed:F.removed})}),F.sampleAdded.length>0?(0,Q.jsxs)(`div`,{className:`oc-afiles__diff-block`,children:[(0,Q.jsx)(`span`,{className:`oc-afiles__diff-label`,children:me()}),F.sampleAdded.map((e,t)=>(0,Q.jsx)(`code`,{className:`oc-afiles__diff-line is-add`,children:e||` `},t))]}):null,F.sampleRemoved.length>0?(0,Q.jsxs)(`div`,{className:`oc-afiles__diff-block`,children:[(0,Q.jsx)(`span`,{className:`oc-afiles__diff-label`,children:M()}),F.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:m()}),(0,Q.jsx)(We,{onClick:()=>void j(),children:r()})]})]})})]})})}function ot({curationId:e,onClose:t,onApplied:n}){let r=d(K.agentFileCuration.getProposal,{curationId:e}),i=g(K.agentFileCuration.approveCuration),a=l(K.agentFileCuration.rejectCuration),{toast:s}=J(),[m,_]=(0,X.useState)(null),[b,x]=(0,X.useState)(!1),[S,C]=(0,X.useState)(``),w=z(),E=(0,X.useMemo)(()=>r?et(r.beforeContent,r.proposedContent):null,[r]);async function D(){_(`approve`);try{let t=await i({curationId:e});t.ok?(s({title:ae(),variant:`success`}),n()):s({title:t.reason===`conflict`?F():j({reason:t.reason??`unknown`}),variant:`error`})}catch{s({title:L(),variant:`error`})}finally{_(null)}}async function O(n){_(`reject`);try{let r=S.trim();(await a({curationId:e,...r?{comment:r}:{},relaunch:n})).ok?s({title:n?h():le(),variant:`success`}):s({title:k(),variant:`error`}),t()}catch{s({title:L(),variant:`error`})}finally{_(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?_e({name:r.name}):o()}),(0,Q.jsx)(ze,{children:V()})]}),r===void 0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:o()}):r===null?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:k()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`p`,{className:`oc-afiles__review-sizes`,children:[pe({before:Z(r.beforeSize,w),after:Z(r.proposedSize,w)}),r.overBudget?(0,Q.jsxs)(Q.Fragment,{children:[` `,(0,Q.jsx)(Y,{size:13,"aria-hidden":!0}),` `,se()]}):null]}),E?(0,Q.jsx)(`p`,{className:`oc-afiles__review-diff`,children:T({added:E.added,removed:E.removed})}):null,r.feedback?(0,Q.jsx)(`p`,{className:`oc-afiles__review-feedback`,children:p({feedback:r.feedback})}):null,E&&E.sampleRemoved.length>0?(0,Q.jsxs)(`div`,{className:`oc-afiles__review-removed`,children:[(0,Q.jsx)(`p`,{className:`oc-afiles__review-label`,children:N()}),(0,Q.jsx)(`ul`,{children:E.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:he()}),(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:ie()}),(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:y()}),(0,Q.jsx)(`textarea`,{id:`curation-reject-comment`,className:`oc-afiles__reject-textarea`,rows:3,placeholder:f(),value:S,onChange:e=>C(e.target.value)}),(0,Q.jsxs)(`div`,{className:`oc-afiles__review-actions`,children:[(0,Q.jsx)(q,{variant:`ghost`,onClick:()=>x(!1),disabled:m!==null,children:u()}),(0,Q.jsx)(q,{variant:`outline`,onClick:()=>void O(!1),disabled:m!==null,children:m===`reject`?U():c()}),(0,Q.jsx)(q,{variant:`default`,onClick:()=>void O(!0),disabled:m!==null,children:m===`reject`?U():v()})]})]}):(0,Q.jsxs)(`div`,{className:`oc-afiles__review-actions`,children:[(0,Q.jsx)(q,{variant:`outline`,onClick:()=>x(!0),disabled:m!==null||r==null,children:de()}),(0,Q.jsx)(q,{variant:`default`,onClick:()=>void D(),disabled:m!==null||r==null,children:m===`approve`?U():W()})]})]})})}export{rt as AgentFilesTab};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$C as r,AC as i,BC as ee,CC as te,DC as a,EC as ne,FC as re,Fz as ie,GC as o,HC as s,IC as ae,Iz as c,JC as oe,KC as se,LC as ce,MC as l,NC as le,OC as ue,PC as de,QC as fe,RC as pe,SC as me,TC as u,UC as he,VC as ge,WC as _e,XC as d,YC as f,ZC as p,_C as m,bC as ve,cC as h,dC as g,ew as _,fC as v,gC as ye,hC as be,jC as xe,kC as Se,lC as y,mC as b,oC as x,pC as S,qC as C,sC as w,t as T,tw as E,uC as D,vC as O,wC as k,xC as A,yC as j,zC as Ce}from"./api-Cpjr7qvl.js";import{$ as M,Dt as we,Et as N,Gn as Te,Q as P,U as Ee,Wn as F,X as I,Z as L,at as R,ct as z,et as B,i as De,nt as V,o as Oe,ot as H,q as ke,tt as U}from"./index-
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$C as r,AC as i,BC as ee,CC as te,DC as a,EC as ne,FC as re,Fz as ie,GC as o,HC as s,IC as ae,Iz as c,JC as oe,KC as se,LC as ce,MC as l,NC as le,OC as ue,PC as de,QC as fe,RC as pe,SC as me,TC as u,UC as he,VC as ge,WC as _e,XC as d,YC as f,ZC as p,_C as m,bC as ve,cC as h,dC as g,ew as _,fC as v,gC as ye,hC as be,jC as xe,kC as Se,lC as y,mC as b,oC as x,pC as S,qC as C,sC as w,t as T,tw as E,uC as D,vC as O,wC as k,xC as A,yC as j,zC as Ce}from"./api-Cpjr7qvl.js";import{$ as M,Dt as we,Et as N,Gn as Te,Q as P,U as Ee,Wn as F,X as I,Z as L,at as R,ct as z,et as B,i as De,nt as V,o as Oe,ot as H,q as ke,tt as U}from"./index-Bc3aF-kJ.js";import{n as Ae}from"./TimeRangePicker-BlRNLd96.js";import{t as je}from"./FilterBar-FHDxb3k3.js";import{t as Me}from"./DataTableShell-DWXPn72S.js";import{t as W}from"./dispatchErrorInfo-EQWxZ8Ki.js";var G=t(e(),1),K=n(),q=`__all__`,Ne=[{value:`open`},{value:`acknowledged`},{value:`resolved`}];function Pe(e){return e===`open`?E():e===`acknowledged`?_():r()}var Fe=[`info`,`warn`,`critical`],Ie=[`detector`,`agent`,`user`],Le={kind:`relative`,from:`now-30d`,to:`now`},Re=200,J=`all`;function Y(){let e=Te({from:`/settings/anomalies`}),t=F({from:`/settings/anomalies`}),n=e.q??``,r=e.status===J?q:e.status,h=e.severity??q,g=e.kind??q,[_,v]=(0,G.useState)(q),y=De(e.from,e.to),{from:x,to:S}=Ae(y),w=e=>void t({search:t=>({...t,q:e||void 0}),replace:!0}),E=e=>void t({search:t=>({...t,status:e===q?J:e})}),D=e=>void t({search:t=>({...t,severity:e===q?void 0:e})}),R=e=>void t({search:t=>({...t,kind:e===q?void 0:e})}),V=e=>void t({search:t=>({...t,...Oe(e)})}),H=Ee(),U=we(),W=ie(T.anomalies.resolveAnomaly),Y=(c(T.me.getMe,{host:ke})?.permissions??[]).includes(`admin.manage`),X=c(T.anomalies.listAnomalies,{limit:Re,filter:{q:n||void 0,from:x,to:S,anomalyStatus:r===q?void 0:r,severity:h===q?void 0:h,source:_===q?void 0:_,kind:g===q?void 0:g}}),Z=(0,G.useMemo)(()=>{let e=new Set;for(let t of X??[])e.add(t.kind);return[...e].sort()},[X]),Q=n!==``||r!==`open`||h!==q||_!==q||g!==q||y.kind!==`relative`||y.from!==Le.from;function Ue(){v(q),t({search:{status:`open`},replace:!0})}async function We(e){if(await H({title:fe(),description:(0,K.jsxs)(K.Fragment,{children:[p(),` `,(0,K.jsx)(`span`,{className:`font-mono`,children:e.kind}),` `,d(),` `,(0,K.jsx)(`strong`,{children:f()}),`.`,` `,oe()]}),confirmLabel:C()}))try{await W({anomalyId:e._id,status:`resolved`}),U.success(se(),e.kind)}catch(e){U.error(o(),e)}}async function Ge(e){try{await W({anomalyId:e._id,status:`acknowledged`}),U.success(_e(),e.kind)}catch(e){U.error(he(),e)}}return(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)(`p`,{className:`oc-admin__hint`,children:[s(),` `,(0,K.jsx)(`strong`,{children:ge()}),` `,ee(),` `,(0,K.jsx)(`strong`,{children:Ce()}),` `,pe(),` `,(0,K.jsx)(`strong`,{children:ce()}),` `,ae(),` `,(0,K.jsx)(`span`,{className:`oc-filter__window`,children:re()})]}),(0,K.jsxs)(je,{q:n,onQChange:w,searchPlaceholder:de(),timeRange:y,onTimeRangeChange:V,onReset:Ue,canReset:Q,children:[(0,K.jsxs)(I,{value:r,onValueChange:E,children:[(0,K.jsx)(M,{size:`sm`,className:`w-36`,children:(0,K.jsx)(B,{})}),(0,K.jsxs)(L,{children:[(0,K.jsx)(P,{value:q,children:le()}),Ne.map(e=>(0,K.jsx)(P,{value:e.value,children:Pe(e.value)},e.value))]})]}),(0,K.jsxs)(I,{value:h,onValueChange:D,children:[(0,K.jsx)(M,{size:`sm`,className:`w-36`,children:(0,K.jsx)(B,{placeholder:l()})}),(0,K.jsxs)(L,{children:[(0,K.jsx)(P,{value:q,children:ue()}),Fe.map(e=>(0,K.jsx)(P,{value:e,children:e},e))]})]}),(0,K.jsxs)(I,{value:_,onValueChange:v,children:[(0,K.jsx)(M,{size:`sm`,className:`w-32`,children:(0,K.jsx)(B,{placeholder:a()})}),(0,K.jsxs)(L,{children:[(0,K.jsx)(P,{value:q,children:ne()}),Ie.map(e=>(0,K.jsx)(P,{value:e,children:e},e))]})]}),(0,K.jsxs)(I,{value:g,onValueChange:R,children:[(0,K.jsx)(M,{size:`sm`,className:`w-36`,children:(0,K.jsx)(B,{placeholder:u()})}),(0,K.jsxs)(L,{children:[(0,K.jsx)(P,{value:q,children:k()}),Z.map(e=>(0,K.jsx)(P,{value:e,children:e},e))]})]})]}),(0,K.jsx)(Me,{title:te(),rows:X,emptyHint:r===`open`?me():A(),rowActions:e=>Y&&e.status===`open`?[{label:ve(),onSelect:()=>void We(e)},{label:j(),onSelect:()=>void Ge(e)}]:[],columns:[{header:O(),cell:e=>(0,K.jsx)(`span`,{className:`oc-traces__time`,children:z(e.at)}),sort:e=>e.at},{header:u(),cell:e=>(0,K.jsx)(`code`,{className:`oc-traces__mono`,children:e.kind}),sort:e=>e.kind},{header:xe(),cell:e=>e.occurrenceCount!==null&&e.occurrenceCount>1?(0,K.jsx)(`span`,{className:`oc-traces__time`,title:e.firstAt===null?void 0:Se({when:z(e.firstAt)}),children:i({count:String(e.occurrenceCount)})}):(0,K.jsx)(`span`,{className:`oc-traces__time`,children:`—`}),sort:e=>e.occurrenceCount??0},{header:l(),cell:e=>(0,K.jsx)(Ve,{severity:e.severity}),sort:e=>e.severity===`critical`?2:+(e.severity===`warn`)},{header:m(),cell:e=>(0,K.jsx)(He,{status:e.status}),sort:e=>e.status===`resolved`?2:+(e.status===`acknowledged`)},{header:a(),cell:e=>(0,K.jsx)(N,{variant:`outline`,children:e.source}),sort:e=>e.source},{header:ye(),cell:e=>(0,K.jsxs)(`div`,{className:`oc-anomaly__msgcell`,children:[(0,K.jsx)(`span`,{className:`oc-anomaly__msg`,children:e.message}),(0,K.jsx)(Be,{row:e})]}),sort:e=>e.message},{header:be(),cell:e=>(0,K.jsx)(ze,{row:e}),sort:e=>e.evidence??null},{header:b(),cell:e=>e.correlationId?(0,K.jsx)(`code`,{className:`oc-traces__mono`,children:$(e.correlationId)}):(0,K.jsx)(`span`,{className:`oc-traces__muted`,children:`—`}),sort:e=>e.correlationId}]})]})}var X=new Set([`openclaw.dispatch_failures`,`assistant.announce_errors`]);function Z(e){if(!X.has(e.kind)||!e.evidence)return{};try{let t=JSON.parse(e.evidence);return{dominantCode:t.dominantCode,sampleCorrelationId:t.sampleCorrelationId}}catch{return{}}}function Q(e){if(e.kind!==`subagent.failure`||!e.evidence)return{};try{let t=JSON.parse(e.evidence);return{failedCount:t.failedCount,totalCount:t.totalCount,errorCategories:t.errorCategories}}catch{return{}}}function ze({row:e}){let t=F();if(e.kind===`subagent.failure`){let n=Q(e);return(0,K.jsxs)(`div`,{className:`oc-anomaly__cause`,children:[(0,K.jsx)(`div`,{className:`oc-anomaly__cause-head`,children:[...new Set(n.errorCategories??[])].map(e=>(0,K.jsx)(`code`,{className:`oc-traces__mono`,children:e},e))}),e.correlationId?(0,K.jsxs)(`button`,{type:`button`,className:`oc-anomaly__drill`,onClick:()=>void t({to:`/settings/traces`,search:{q:e.correlationId,limit:100}}),children:[`↗ `,S()]}):null]})}let n=Z(e);if(!n.dominantCode){let e=n.sampleCorrelationId;return e?(0,K.jsx)(`div`,{className:`oc-anomaly__cause`,children:(0,K.jsxs)(`button`,{type:`button`,className:`oc-anomaly__drill`,onClick:()=>void t({to:`/settings/traces`,search:{correlationId:e,limit:100}}),children:[`↗ `,S()]})}):(0,K.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})}let r=W(n.dominantCode),i=n.sampleCorrelationId;return(0,K.jsxs)(`div`,{className:`oc-anomaly__cause`,children:[(0,K.jsxs)(`div`,{className:`oc-anomaly__cause-head`,children:[(0,K.jsx)(`span`,{className:`oc-anomaly__cause-label`,children:r.label}),(0,K.jsx)(`code`,{className:`oc-traces__mono`,children:n.dominantCode})]}),(0,K.jsx)(`p`,{className:`oc-anomaly__cause-hint`,children:r.hint}),i?(0,K.jsxs)(`button`,{type:`button`,className:`oc-anomaly__drill`,onClick:()=>void t({to:`/settings/traces`,search:{correlationId:i,limit:100}}),children:[`↗ `,S()]}):null]})}function Be({row:e}){let[t,n]=(0,G.useState)(!1),r=c(T.anomalies.getAnomalyAttachments,t?{anomalyId:e._id}:`skip`);return!e.attachments||e.attachments.length===0?null:(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)(`button`,{type:`button`,className:`oc-anomaly__drill`,onClick:()=>n(!0),children:[v(),e.attachments.length>1?` (${e.attachments.length})`:``]}),(0,K.jsx)(U,{open:t,onOpenChange:n,children:(0,K.jsxs)(V,{className:`oc-anomaly__attachments-dialog`,children:[(0,K.jsx)(R,{children:(0,K.jsx)(H,{children:g()})}),r===void 0?(0,K.jsx)(`p`,{className:`oc-traces__muted`,children:D()}):r.length===0?(0,K.jsx)(`p`,{className:`oc-traces__muted`,children:y()}):(0,K.jsx)(`div`,{className:`oc-anomaly__attachments`,children:r.map(e=>(0,K.jsxs)(`section`,{className:`oc-anomaly__attachment`,children:[(0,K.jsx)(`h4`,{className:`oc-anomaly__attachment-name`,children:(0,K.jsx)(`code`,{className:`oc-traces__mono`,children:e.name})}),(0,K.jsx)(`pre`,{className:`oc-anomaly__attachment-content`,children:e.content})]},e.name))})]})})]})}function Ve({severity:e}){return(0,K.jsx)(`span`,{className:`oc-anomaly__sev oc-anomaly__sev--${e}`,children:e})}function He({status:e}){return e===`open`?(0,K.jsx)(N,{variant:`destructive`,children:h()}):e===`acknowledged`?(0,K.jsx)(N,{variant:`secondary`,children:w()}):(0,K.jsx)(N,{variant:`outline`,children:x()})}function $(e){return e.length>8?e.slice(0,8):e}export{Y as AnomaliesTab};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$w as r,Ai as i,Iz as a,Jw as o,Kw as s,Mi as c,Ni as l,Pi as u,Qw as d,Xw as f,Yw as p,Zw as m,aT as h,eT as g,iT as _,ji as v,ki as y,nT as b,oT as x,qw as S,rT as C,t as w,tT as T}from"./api-Cpjr7qvl.js";import{$ as E,Gn as D,Q as O,Wn 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-
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$w as r,Ai as i,Iz as a,Jw as o,Kw as s,Mi as c,Ni as l,Pi as u,Qw as d,Xw as f,Yw as p,Zw as m,aT as h,eT as g,iT as _,ji as v,ki as y,nT as b,oT as x,qw as S,rT as C,t as w,tT as T}from"./api-Cpjr7qvl.js";import{$ as E,Gn as D,Q as O,Wn 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-Bc3aF-kJ.js";import{n as ee}from"./TimeRangePicker-BlRNLd96.js";import{t as z}from"./FilterBar-FHDxb3k3.js";import{t as B}from"./AdvancedFilter-Bm1TIX9k.js";import{t as V}from"./DataTableShell-DWXPn72S.js";var H=t(e(),1),U=n(),W={kind:`relative`,from:I,to:`now`},G=`__all__`,K=[{value:`action`,label:u()},{value:`realLabel`,label:l()},{value:`targetLabel`,label:c()},{value:`impersonated`,label:v()},{value:`resource`,label:i()},{value:`resourceId`,label:y()}];function q(){let e=D({from:`/settings/audit`}),t=k({from:`/settings/audit`}),n=e.q??``,i=e.action??G,c=e.impersonated??G,l=e.resource??G,u=F(e.from,e.to),v=(0,H.useMemo)(()=>R(e.adv),[e.adv]),{from:y,to:I}=ee(u),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}),$=a(w.admin.listAudit,{filter:{q:n||void 0,from:y,to:I,action:i===G?void 0:i,resource:l===G?void 0:l,impersonated:c===G?void 0:c===`yes`,advanced:v.length>0?v: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||c!==G||l!==G||v.length>0||u.kind!==`relative`||u.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:[x(),` `,(0,U.jsx)(`span`,{className:`oc-filter__window`,children:h()})]}),(0,U.jsxs)(z,{q:n,onQChange:q,searchPlaceholder:_(),timeRange:u,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:C()})}),(0,U.jsxs)(j,{children:[(0,U.jsx)(O,{value:G,children:b()}),te.map(e=>(0,U.jsx)(O,{value:e,children:e},e))]})]}),(0,U.jsxs)(A,{value:c,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)(O,{value:G,children:T()}),(0,U.jsx)(O,{value:`yes`,children:g()}),(0,U.jsx)(O,{value:`no`,children:r()})]})]}),(0,U.jsxs)(A,{value:l,onValueChange:X,children:[(0,U.jsx)(E,{size:`sm`,className:`w-40`,children:(0,U.jsx)(P,{placeholder:d()})}),(0,U.jsxs)(j,{children:[(0,U.jsx)(O,{value:G,children:m()}),ne.map(e=>(0,U.jsx)(O,{value:e,children:e},e))]})]})]}),(0,U.jsx)(B,{fields:K,seed:v,onChange:Q}),(0,U.jsx)(V,{title:f(),rows:$,emptyHint:p(),columns:[{header:o(),cell:e=>N(e.at),sort:e=>e.at},{header:C(),cell:e=>e.action,sort:e=>e.action},{header:S(),cell:e=>e.realLabel,sort:e=>e.realLabel},{header:s(),cell:e=>e.targetLabel??`—`,sort:e=>e.targetLabel??null},{header:d(),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,$r as i,$y as a,Au as o,Ay as s,Bu as c,By as l,Cb as u,D as d,Eb as f,Fu as p,Fy as m,Fz as ee,Gy as h,Hu as g,Hy as _,Iu as v,Iy as y,Iz as b,Jb as te,Jy as x,Ky as ne,Lu as S,Ly as re,Mu as ie,My as ae,Nu as oe,Ny as se,Nz as ce,Oy as le,Pu as ue,Py as de,Qb as fe,Qr as pe,Qy as me,Ru as he,Ry as ge,Sb as _e,Tb as ve,Tu as ye,Uy as be,Vu as xe,Vy as Se,Wy as Ce,Xy as we,Yb as Te,Yy as Ee,Zr as De,Zy as Oe,_b as ke,_t as Ae,ab as je,ax as Me,bb as Ne,cb as Pe,cx as Fe,db as Ie,eb as Le,ei as Re,ex as ze,fb as Be,gb as Ve,hb as He,ib as Ue,ii as We,ix as Ge,ju as Ke,jy as qe,ky as C,lb as Je,mb as Ye,nb as Xe,nx as Ze,ob as Qe,pb as $e,qy as et,rb as w,rx as tt,sb as nt,sx as rt,t as T,tb as it,ti as at,tx as ot,ub as st,vb as ct,wb as lt,xb as ut,yb as dt,zu as ft,zy as pt}from"./api-Cpjr7qvl.js";import{t as mt}from"./chevrons-up-down-Chp_XyRp.js";import{i as ht,n as E,o as gt,r as _t,s as vt}from"./FieldLabel-Bbe-KIdW.js";import{i as yt,n as bt,r as xt,t as St}from"./tabs-Bmd8xvTL.js";import{t as D}from"./button-CbwCr9Pi.js";import{$ as O,Bt as Ct,Dt as wt,En as Tt,Et as k,F as Et,Gn as Dt,Ln as A,Q as j,Rn as Ot,Rt as kt,Vn as M,Wn as N,X as P,Z as F,at as At,ct as jt,et as I,fn as Mt,jt as L,ln as R,lt as z,nt as Nt,ot as Pt,q as Ft,rt as It,tt as Lt,ut as Rt,zn as zt,zt as Bt}from"./index-c5j0e823.js";import{r as Vt}from"./locales-CPjguROj.js";import{a as Ht,i as B,n as Ut,o as V,r as H,t as Wt}from"./table-CeTqDEfs.js";import{t as Gt}from"./FilterBar-BO7_dR0d.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-BHtlzKRR.js";import{t as U}from"./dispatchErrorInfo-EQWxZ8Ki.js";var $t=d(`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=d(`wifi-off`,[[`path`,{d:`M12 20h.01`,key:`zekei9`}],[`path`,{d:`M8.5 16.429a5 5 0 0 1 7 0`,key:`1bycff`}],[`path`,{d:`M5 12.859a10 10 0 0 1 5.17-2.69`,key:`1dl1wf`}],[`path`,{d:`M19 12.859a10 10 0 0 0-2.007-1.523`,key:`4k23kn`}],[`path`,{d:`M2 8.82a15 15 0 0 1 4.177-2.643`,key:`1grhjp`}],[`path`,{d:`M22 8.82a15 15 0 0 0-11.288-3.764`,key:`z3jwby`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}]]),W=t(e(),1);function tn(e){return e.filter(e=>e.state===`error`)}function nn(e){return e.reachable&&tn(e.targets).length===0}function rn(e){return nn(e)?(e.unreachableInstances??[]).length>0?`gateways_unreachable`:`ok`:`error`}function an(e){return e.state===`error`&&e.lastErrorCode!==null}function on(e){return!!e.lastDownstreamRejectCode}function G(e){return e.kind??`openclaw`}function sn(e){return[...e].sort((e,t)=>e===`openclaw`?-1:t===`openclaw`?1:e.localeCompare(t))}function cn(e,t,n){let r=new Map;for(let e of t)e.instanceName&&r.set(e.instanceName,e.provider);for(let e of n)r.set(e.name,G(e));let i=e=>(e.instanceName?r.get(e.instanceName):void 0)??`openclaw`,a=new Set;for(let e of n)a.add(G(e));for(let e of t)a.add(e.provider);for(let t of e)a.add(i(t));return sn(a).map(r=>({key:r,connections:e.filter(e=>i(e)===r),compatTargets:t.filter(e=>e.provider===r),instances:n.filter(e=>G(e)===r)}))}function K(e){return e===`openclaw`?`OpenClaw`:e===`hermes`?`Hermes`:e.charAt(0).toUpperCase()+e.slice(1)}var q=`__all__`,ln={q:``,state:q,instance:q,version:q},J={connected:0,error:1,idle:2};function un(e){return e.q.trim()!==``||e.state!==`__all__`||e.instance!==`__all__`||e.version!==`__all__`}function dn(e,t){let n=t.q.trim().toLowerCase();return e.filter(e=>!(n&&!`${e.targetLabel} ${e.gatewayHost}`.toLowerCase().includes(n)||t.state!==`__all__`&&e.state!==t.state||t.instance!==`__all__`&&(e.instanceName??``)!==t.instance||t.version!==`__all__`&&(e.gatewayVersion??``)!==t.version))}function Y(e,t){return e.localeCompare(t,void 0,{numeric:!0,sensitivity:`base`})}function X(e,t){return e===`version`?t.gatewayVersion===null:e===`lastOk`?t.lastOkAt===null:!1}function fn(e,t,n){switch(e){case`state`:return(J[t.state]??99)-(J[n.state]??99);case`instance`:return Y(t.instanceLabel??t.instanceName??``,n.instanceLabel??n.instanceName??``);case`host`:return Y(t.gatewayHost,n.gatewayHost);case`version`:{let e=t.gatewayVersion,r=n.gatewayVersion;return Zt(e,r)??Y(e,r)}case`lastOk`:return t.lastOkAt-n.lastOkAt;default:return Y(t.targetLabel,n.targetLabel)}}function pn(e,t){if(!t)return e;let n=t.dir===`asc`?1:-1;return[...e].sort((e,r)=>{let i=X(t.key,e),a=X(t.key,r);return i&&a?0:i?1:a?-1:n*fn(t.key,e,r)})}function mn(e){let t=new Set;for(let n of e)t.add(n.state);return[...t].sort((e,t)=>(J[e]??99)-(J[t]??99))}function hn(e){let t=new Map;for(let n of e)n.instanceName!==null&&(t.has(n.instanceName)||t.set(n.instanceName,n.instanceLabel??n.instanceName));return[...t.entries()].map(([e,t])=>({name:e,label:t})).sort((e,t)=>Y(e.label,t.label))}function gn(e){let t=new Set;for(let n of e)n.gatewayVersion!==null&&t.add(n.gatewayVersion);return[...t].sort((e,t)=>Zt(e,t)??Y(e,t))}var Z=n();function _n({connections:e,displayByInstance:t}){let[n,r]=(0,W.useState)(ln),[i,a]=(0,W.useState)(null),o=(0,W.useMemo)(()=>e.map((e,n)=>({_id:`${e.key}:${e.canonical}/${e.agentId}:${n}`,targetLabel:`${e.canonical}/${e.agentId}`,state:e.state,instanceName:e.instanceName??null,instanceLabel:e.instanceName?t.get(e.instanceName)??e.instanceName:null,gatewayHost:e.gatewayHost,gatewayVersion:e.gatewayVersion??null,okCount:e.okCount,errorCount:e.errorCount+(e.downstreamRejectCount??0),attempts:e.attempts,lastOkAt:e.lastOkAt??null,lastErrorCode:e.lastErrorCode??null,lastErrorAt:e.lastErrorAt??null,lastDownstreamRejectCode:e.lastDownstreamRejectCode??null,lastDownstreamRejectAt:e.lastDownstreamRejectAt??null})),[e,t]),s=(0,W.useMemo)(()=>mn(o),[o]),c=(0,W.useMemo)(()=>hn(o),[o]),u=(0,W.useMemo)(()=>gn(o),[o]),d=(0,W.useMemo)(()=>pn(dn(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:ne()}):(0,Z.jsxs)(`div`,{className:`oc-conn`,children:[(0,Z.jsxs)(Gt,{q:n.q,onQChange:e=>r(t=>({...t,q:e})),searchPlaceholder:be(),onReset:()=>r(ln),canReset:un(n),children:[(0,Z.jsxs)(P,{value:n.state,onValueChange:e=>r(t=>({...t,state:e})),children:[(0,Z.jsx)(O,{size:`sm`,className:`w-36`,children:(0,Z.jsx)(I,{placeholder:Se()})}),(0,Z.jsxs)(F,{children:[(0,Z.jsx)(j,{value:q,children:_()}),s.map(e=>(0,Z.jsx)(j,{value:e,children:yn(e)},e))]})]}),(0,Z.jsxs)(P,{value:n.instance,onValueChange:e=>r(t=>({...t,instance:e})),children:[(0,Z.jsx)(O,{size:`sm`,className:`w-40`,children:(0,Z.jsx)(I,{placeholder:l()})}),(0,Z.jsxs)(F,{children:[(0,Z.jsx)(j,{value:q,children:_()}),c.map(e=>(0,Z.jsx)(j,{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)(O,{size:`sm`,className:`w-36`,children:(0,Z.jsx)(I,{placeholder:pt()})}),(0,Z.jsxs)(F,{children:[(0,Z.jsx)(j,{value:q,children:_()}),u.map(e=>(0,Z.jsx)(j,{value:e,children:e},e))]})]})]}),d.length===0?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:ge()}):(0,Z.jsxs)(Wt,{className:`oc-conn__table`,children:[(0,Z.jsx)(Ht,{children:(0,Z.jsxs)(V,{children:[(0,Z.jsx)(Q,{label:re(),sortKey:`target`,sort:i,onSort:f}),(0,Z.jsx)(Q,{label:y(),sortKey:`state`,sort:i,onSort:f}),(0,Z.jsx)(Q,{label:m(),sortKey:`instance`,sort:i,onSort:f}),(0,Z.jsx)(Q,{label:de(),sortKey:`host`,sort:i,onSort:f}),(0,Z.jsx)(Q,{label:se(),sortKey:`version`,sort:i,onSort:f}),(0,Z.jsx)(B,{children:ae()}),(0,Z.jsx)(Q,{label:qe(),sortKey:`lastOk`,sort:i,onSort:f})]})}),(0,Z.jsx)(Ut,{children:d.map(e=>(0,Z.jsx)(vn,{r:e},e._id))})]})]})}function Q({label:e,sortKey:t,sort:n,onSort:r}){let i=n?.key===t,a=i?n.dir:null;return(0,Z.jsx)(B,{"aria-sort":i?a===`asc`?`ascending`:`descending`:`none`,children:(0,Z.jsxs)(`button`,{type:`button`,className:`oc-conn__sort`,onClick:()=>r(t),children:[e,i?a===`asc`?(0,Z.jsx)(Ot,{size:13,"aria-hidden":!0}):(0,Z.jsx)(M,{size:13,"aria-hidden":!0}):(0,Z.jsx)(mt,{size:13,"aria-hidden":!0,className:`oc-conn__sort-idle`})]})})}function vn({r:e}){let t=an(e)?U(e.lastErrorCode):null,n=on(e)?U(e.lastDownstreamRejectCode):null;return(0,Z.jsxs)(W.Fragment,{children:[(0,Z.jsxs)(V,{className:`oc-conn__row oc-conn__row--${e.state}`,children:[(0,Z.jsx)(H,{children:(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:e.targetLabel})}),(0,Z.jsx)(H,{children:(0,Z.jsx)(bn,{state:e.state})}),(0,Z.jsx)(H,{children:e.instanceLabel?(0,Z.jsx)(`span`,{className:`oc-bridge-target__instance`,children:e.instanceLabel}):(0,Z.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})}),(0,Z.jsx)(H,{children:(0,Z.jsx)(`span`,{className:`oc-bridge-target__host`,children:e.gatewayHost})}),(0,Z.jsx)(H,{children:e.gatewayVersion?(0,Z.jsx)(`span`,{className:`oc-bridge-target__version`,children:e.gatewayVersion}):(0,Z.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})}),(0,Z.jsx)(H,{children:(0,Z.jsx)(`span`,{className:`oc-conn__stats`,children:h({ok:e.okCount,errors:e.errorCount,attempts:e.attempts})})}),(0,Z.jsx)(H,{children:e.lastOkAt?(0,Z.jsx)(`span`,{className:`oc-traces__mono`,children:z(e.lastOkAt)}):(0,Z.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})})]}),t||n?(0,Z.jsx)(V,{className:`oc-conn__detail-row`,children:(0,Z.jsxs)(H,{colSpan:7,className:`oc-conn__detail-cell`,children:[t?(0,Z.jsxs)(`div`,{className:`oc-bridge-target__error`,children:[(0,Z.jsx)(`strong`,{children:t.label}),` `,(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:e.lastErrorCode}),e.lastErrorAt?` · ${z(e.lastErrorAt)}`:``,(0,Z.jsx)(`p`,{className:`oc-bridge-card__hint`,children:t.hint})]}):null,n?(0,Z.jsxs)(`div`,{className:`oc-bridge-target__downstream`,children:[Ce({label:n.label}),` `,(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:e.lastDownstreamRejectCode}),e.lastDownstreamRejectAt?` · ${z(e.lastDownstreamRejectAt)}`:``]}):null]})}):null]})}function yn(e){return e===`connected`?s():e===`error`?C():le()}function bn({state:e}){return e===`connected`?(0,Z.jsx)(k,{variant:`secondary`,children:s()}):e===`error`?(0,Z.jsx)(k,{variant:`destructive`,children:C()}):(0,Z.jsx)(k,{variant:`outline`,children:le()})}function xn(){return b(T.bridgeHealth.getBridgeHealth,{})}function Sn(){let e=xn(),t=b(T.compat.getBridgeCompat,{}),n=b(T.me.getMe,{host:Ft})?.role===`admin`,r=b(T.admin.listInstances,n?{}:`skip`),a=b(T.agents.usageForInstances,n?{}:`skip`),o=N(),s=()=>void o({to:`/settings/anomalies`,search:{status:`open`}}),c=cn(e?e.targets:[],t?t.targets:[],r??[]),{section:l}=Dt({from:`/settings/bridge`}),u=N({from:`/settings/bridge`}),d=t?.compat??null,f=t===void 0?`loading`:t===null?`nodata`:`ready`,p=d!==null&&Xt(d,`hermes`)&&!c.some(e=>e.key===`hermes`);return(0,Z.jsxs)(`div`,{className:`oc-bridge`,children:[(0,Z.jsx)(Cn,{health:e,compat:t,onSeeAnomalies:s}),(0,Z.jsx)(`p`,{className:`oc-admin__hint oc-bridge__caption`,children:Be()}),a&&a.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)(V,{children:[(0,Z.jsx)(B,{children:at()}),(0,Z.jsx)(B,{children:Re()}),(0,Z.jsx)(B,{children:i()}),(0,Z.jsx)(B,{children:pe()}),(0,Z.jsx)(B,{children:De()})]})}),(0,Z.jsx)(Ut,{children:a.flatMap(e=>{let t=Et(e.usage,Date.now());return t?t.windows.map((t,n)=>(0,Z.jsxs)(V,{children:[(0,Z.jsx)(H,{className:`font-medium`,children:n===0?e.instanceName:``}),(0,Z.jsx)(H,{children:t.provider}),(0,Z.jsx)(H,{children:t.label}),(0,Z.jsx)(H,{children:(0,Z.jsxs)(k,{variant:t.percentLeft<=10?`destructive`:t.percentLeft<=25?`outline`:`secondary`,children:[t.percentLeft,`%`]})}),(0,Z.jsx)(H,{className:`text-muted-foreground`,children:t.resetText??`—`})]},`${e.instanceName}:${t.provider}:${t.label}`)):[]})})]})]}):null,c.length>0?(0,Z.jsxs)(St,{value:c.some(e=>e.key===l)?l:c[0]?.key??`openclaw`,onValueChange:e=>void u({search:{section:e},replace:!0}),children:[(0,Z.jsx)(xt,{className:`w-full`,children:c.map(e=>(0,Z.jsxs)(yt,{value:e.key,className:`flex-1 gap-1.5`,children:[(0,Z.jsx)(Mt,{size:13,"aria-hidden":!0}),K(e.key)]},e.key))}),c.map(e=>(0,Z.jsx)(bt,{value:e.key,children:(0,Z.jsx)(wn,{providerKey:e.key,connections:e.connections,instances:e.instances,manifest:d,compatStatus:f,compatReachable:t?.reachable??!0,protocol:e.key===`openclaw`?t?.protocol??null:null})},e.key))]}):null,p?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:ye()}):null]})}function Cn({health:e,compat:t,onSeeAnomalies:n}){let r=t!=null&&t.buildVersion!=null&&t.bridgeVersion!=null&&t.buildVersion!==t.bridgeVersion,i=t?.buildRevision&&t.buildRevision!==`unknown`?t.buildRevision.slice(0,7):null,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)}),i?(0,Z.jsxs)(Z.Fragment,{children:[` `,(0,Z.jsxs)(`code`,{className:`oc-traces__mono`,title:c(),children:[`(`,i,`)`]})]}):null,r?(0,Z.jsxs)(`strong`,{className:`oc-bridge-card__mismatch`,children:[` `,ft({build:t.buildVersion??`?`})]}):null,` · `,he(),` `,(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:t.protocolVersion===null?S():String(t.protocolVersion)})]}):null;if(e===void 0)return(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:w()});if(e===null)return(0,Z.jsx)(`div`,{className:`oc-bridge-card oc-bridge-card--idle`,children:Xe()});let s=tn(e.targets),l=!e.reachable,u=rn(e),d=e.unreachableInstances??[],f=u===`ok`?`ok`:u===`gateways_unreachable`?`warn`:`error`,p=jt(e.checkedAt),m=e.startedAt==null?null:jt(e.startedAt);return(0,Z.jsxs)(`div`,{className:`oc-bridge-card oc-bridge-card--${f}`,children:[(0,Z.jsx)(`div`,{className:`oc-bridge-card__icon`,"aria-hidden":!0,children:u===`ok`?(0,Z.jsx)(A,{size:22}):l||u===`gateways_unreachable`?(0,Z.jsx)(en,{size:22}):(0,Z.jsx)(R,{size:22})}),(0,Z.jsxs)(`div`,{className:`oc-bridge-card__body`,children:[(0,Z.jsx)(`div`,{className:`oc-bridge-card__title`,children:u===`ok`?it():u===`gateways_unreachable`?Oe({count:d.length}):l?Le():a({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}),` `,me({time:p})]}),m?(0,Z.jsx)(`span`,{children:Ee({time:m})}):null,o]}),u===`gateways_unreachable`?(0,Z.jsx)(`p`,{className:`oc-bridge-card__hint`,children:we({names:d.join(`, `)})}):null,l?(0,Z.jsx)(`p`,{className:`oc-bridge-card__hint`,children:U(e.lastError===`not_configured`?`NOT_CONFIGURED`:`BRIDGE_UNREACHABLE`).hint}):null]}),(0,Z.jsx)(`button`,{type:`button`,className:`oc-bridgebar__drill`,onClick:n,children:x()})]})}function wn({providerKey:e,connections:t,instances:n,manifest:r,compatStatus:i,compatReachable:a,protocol:o}){let s=r?Kt(r,e):null,c=new Map;for(let e of n)c.set(e.name,e.displayName??e.name);let l=[],u=new Set;for(let n of t){if(!n.instanceName||u.has(n.instanceName))continue;u.add(n.instanceName);let t=n.gatewayVersion??null;l.push({instanceName:n.instanceName,displayName:c.get(n.instanceName)??n.instanceName,version:t,state:Jt(t,e,r)})}let d=Qt(l.map(e=>e.state)),[f,p]=(0,W.useState)(!1);return(0,Z.jsxs)(`section`,{className:`oc-bridge-provider`,children:[(0,Z.jsxs)(`header`,{className:`oc-bridge-provider__head`,children:[(0,Z.jsx)(Mt,{size:15,"aria-hidden":!0,className:`oc-bridge-provider__icon`}),(0,Z.jsx)(`span`,{className:`oc-bridge-provider__name`,children:K(e)}),d?(0,Z.jsx)(k,{variant:d===`beyond`||d===`defective`?`destructive`:`secondary`,children:qt(d)}):null]}),(0,Z.jsx)(`h4`,{className:`oc-bridge-provider__sub`,children:g()}),(0,Z.jsx)(En,{providerName:K(e),support:s,compatStatus:i,compatReachable:a,manifest:r,instanceRows:l}),o?(0,Z.jsx)(Tn,{protocol:o}):null,(0,Z.jsxs)(`button`,{type:`button`,className:`oc-bridge-provider__sub oc-bridge-provider__sub--toggle`,"aria-expanded":f,onClick:()=>p(e=>!e),children:[f?(0,Z.jsx)(M,{size:13,"aria-hidden":!0}):(0,Z.jsx)(zt,{size:13,"aria-hidden":!0}),et({count:t.length})]}),f?(0,Z.jsx)(_n,{connections:t,displayByInstance:c}):null]})}function Tn({protocol:e}){let[t,n]=(0,W.useState)(!1),r=e.coverage,i=e.drift??[],a=(e.driftOverflow??0)+(e.driftTruncated??0);return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`h4`,{className:`oc-bridge-provider__sub`,children:[st(),i.length>0?(0,Z.jsx)(k,{variant:`destructive`,children:Pe({count:i.length})}):a>0?(0,Z.jsx)(k,{variant:`destructive`,children:nt()}):(0,Z.jsx)(k,{variant:`secondary`,children:Je()})]}),(0,Z.jsxs)(`p`,{className:`oc-admin__hint`,children:[Qe({version:e.vendoredVersion}),r?` · `+je({handled:r.handled,ignored:r.ignored,gaps:r.gaps}):null]}),a>0?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:Ae({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)(zt,{size:13,"aria-hidden":!0}),Ue({count:r.gapList.length})]}),t?(0,Z.jsx)(`ul`,{className:`oc-bridge-protocol__list`,role:`list`,children:r.gapList.map(e=>(0,Z.jsx)(`li`,{children:(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:e})},e))}):null]}):null]})}function En({support:e,compatStatus:t,compatReachable:n,manifest:r,instanceRows:i,providerName:a}){return t===`loading`?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:w()}):t===`nodata`?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:xe()}):(0,Z.jsxs)(`div`,{className:`oc-compat`,children:[n?null:(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:v()}),r===null?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:p()}):(0,Z.jsxs)(`div`,{className:`oc-compat__support`,children:[(0,Z.jsx)(`span`,{className:`oc-compat__label`,children:We({provider:a})}),e&&e.range!==null?(0,Z.jsx)(`span`,{children:ue({min:e.range.min,max:e.range.maxValidated})}):(0,Z.jsx)(`span`,{children:S()}),e?(0,Z.jsx)(kn,{versions:e.validatedVersions}):null]}),i.length===0?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:o()}):(0,Z.jsx)(`div`,{className:`oc-compat__targets`,children:i.map(e=>(0,Z.jsxs)(`div`,{className:`oc-compat__target`,children:[(0,Z.jsx)(`span`,{className:`oc-compat__instance`,children:e.displayName}),(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:Yt(e.version)}),(0,Z.jsx)(k,{variant:e.state===`supported`?`secondary`:e.state===`beyond`||e.state===`defective`?`destructive`:`outline`,children:qt(e.state)})]},e.instanceName))})]})}function Dn({instance:e,onClose:t}){return(0,Z.jsx)(Lt,{open:!0,onOpenChange:e=>!e&&t(),children:(0,Z.jsxs)(Nt,{className:`oc-bridge-config-dialog`,onOpenAutoFocus:e=>e.preventDefault(),children:[(0,Z.jsxs)(At,{children:[(0,Z.jsx)(Pt,{children:Fe({instance:e.displayName??e.name})}),(0,Z.jsx)(It,{children:rt()})]}),(0,Z.jsx)(On,{instance:e,onClose:t})]})})}function $({label:e,result:t}){return t?t.checked?(0,Z.jsxs)(`p`,{className:`oc-bridge-config__check-row `+(t.ok?`oc-bridge-config__check-row--ok`:`oc-bridge-config__check-row--err`),children:[t.ok?(0,Z.jsx)(A,{"aria-hidden":!0}):(0,Z.jsx)(R,{"aria-hidden":!0}),(0,Z.jsxs)(`span`,{children:[e,` — `,t.ok?Ve():t.detail]})]}):(0,Z.jsxs)(`p`,{className:`oc-bridge-config__check-row oc-bridge-config__check-row--skip`,children:[e,` — `,He()]}):null}function On({instance:e,onClose:t}){let n=ee(T.admin.upsertInstanceConfig),i=ce(T.bridge.validateMediaPaths),a=wt(),o=Vt(e.config?.contentLocale,void 0),[s,c]=(0,W.useState)(()=>ht(e.config??{},o)),[l,d]=(0,W.useState)(!1),[p,m]=(0,W.useState)(!1),[h,g]=(0,W.useState)(null),_=s.inboundMediaMode===`shared-fs`,v=s.mediaMode===`shared-fs`,y=_||v;async function b(){m(!0),g(null);try{g(await i({instanceName:e.name,inboundMediaMode:s.inboundMediaMode,mediaMode:s.mediaMode}))}catch(e){a.error(Ne(),e)}finally{m(!1)}}async function x(){d(!0);try{let r=e.config??{};await n({instanceId:e._id,config:_t(s,r,o)}),t()}catch(e){a.error(ze(),e)}finally{d(!1)}}return(0,Z.jsx)(`div`,{className:`oc-bridge-config`,children:(0,Z.jsxs)(`div`,{className:`oc-bridge-config__form`,children:[(0,Z.jsxs)(`div`,{className:`oc-bridge-config__grid`,children:[(0,Z.jsxs)(`label`,{className:`oc-field`,children:[(0,Z.jsx)(E,{label:Me(),help:r()}),(0,Z.jsxs)(P,{value:s.mediaMode,onValueChange:e=>c({...s,mediaMode:e}),children:[(0,Z.jsx)(O,{size:`sm`,className:`w-full`,children:(0,Z.jsx)(I,{})}),(0,Z.jsx)(F,{children:vt.map(e=>(0,Z.jsx)(j,{value:e,children:e},e))})]})]}),(0,Z.jsxs)(`label`,{className:`oc-field`,children:[(0,Z.jsx)(E,{label:Ge(),help:fe()}),(0,Z.jsxs)(P,{value:s.inboundMediaMode,onValueChange:e=>c({...s,inboundMediaMode:e}),children:[(0,Z.jsx)(O,{size:`sm`,className:`w-full`,children:(0,Z.jsx)(I,{})}),(0,Z.jsx)(F,{children:gt.map(e=>(0,Z.jsx)(j,{value:e,children:e},e))})]})]}),(0,Z.jsxs)(`label`,{className:`oc-field`,children:[(0,Z.jsx)(E,{label:tt(),help:Te()}),(0,Z.jsx)(L,{type:`number`,min:1,max:4096,className:`w-full`,value:s.mediaMaxMb,onChange:e=>c({...s,mediaMaxMb:Math.trunc(Number(e.target.value)||0)})})]})]}),y&&(0,Z.jsxs)(`div`,{className:`oc-bridge-config__grid`,children:[_&&(0,Z.jsxs)(`label`,{className:`oc-field`,children:[(0,Z.jsx)(E,{label:f(),help:ve()}),(0,Z.jsx)(L,{className:`w-full`,spellCheck:!1,value:s.inboundAgentMount,onChange:e=>c({...s,inboundAgentMount:e.target.value})})]}),v&&(0,Z.jsxs)(`label`,{className:`oc-field`,children:[(0,Z.jsx)(E,{label:lt(),help:u()}),(0,Z.jsx)(L,{className:`w-full`,spellCheck:!1,value:s.outboundAgentMount,onChange:e=>c({...s,outboundAgentMount:e.target.value})})]})]}),(0,Z.jsxs)(`label`,{className:`oc-field--row`,children:[(0,Z.jsx)(Rt,{checked:s.rehydration,onCheckedChange:e=>c({...s,rehydration:e===!0})}),(0,Z.jsx)(E,{label:Ze(),help:te()})]}),y&&h!==null&&(0,Z.jsx)(`div`,{className:`oc-bridge-config__check`,children:h.reachable?!h.inbound&&!h.outbound?(0,Z.jsxs)(`p`,{className:`oc-bridge-config__check-row oc-bridge-config__check-row--err`,children:[(0,Z.jsx)(R,{"aria-hidden":!0}),$e({reason:h.reason??`?`})]}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)($,{label:ct(),result:h.inbound}),(0,Z.jsx)($,{label:ke(),result:h.outbound}),(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:dt()})]}):(0,Z.jsxs)(`p`,{className:`oc-bridge-config__check-row oc-bridge-config__check-row--err`,children:[(0,Z.jsx)(R,{"aria-hidden":!0}),Ye()]})}),(0,Z.jsxs)(`div`,{className:`oc-bridge-config__actions`,children:[y&&(0,Z.jsxs)(D,{variant:`outline`,size:`sm`,onClick:()=>void b(),disabled:p,children:[p?(0,Z.jsx)(Tt,{className:`size-4 animate-spin`,"aria-hidden":!0}):null,p?ut():_e()]}),(0,Z.jsx)(D,{size:`sm`,onClick:()=>void x(),disabled:l,children:ot()})]})]})})}function kn({versions:e}){if(e.length===0)return null;let t=[...e].reverse();return(0,Z.jsxs)(kt,{children:[(0,Z.jsx)(Ct,{asChild:!0,children:(0,Z.jsxs)(`button`,{type:`button`,className:`oc-compat__versions-btn`,children:[e.length===1?oe():ie({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:Ke()}),(0,Z.jsx)(`div`,{className:`oc-compat__versions-list`,children:t.map(e=>(0,Z.jsx)(k,{variant:`secondary`,children:e},e))})]})]})}export{Sn as BridgeTab,Dn as InstanceConfigDialog};
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$b as r,$r as i,$y as a,Au as o,Ay as s,Bu as c,By as l,Cb as u,D as d,Eb as f,Fu as p,Fy as m,Fz as ee,Gy as h,Hu as g,Hy as _,Iu as v,Iy as y,Iz as b,Jb as te,Jy as x,Ky as ne,Lu as S,Ly as re,Mu as ie,My as ae,Nu as oe,Ny as se,Nz as ce,Oy as le,Pu as ue,Py as de,Qb as fe,Qr as pe,Qy as me,Ru as he,Ry as ge,Sb as _e,Tb as ve,Tu as ye,Uy as be,Vu as xe,Vy as Se,Wy as Ce,Xy as we,Yb as Te,Yy as Ee,Zr as De,Zy as Oe,_b as ke,_t as Ae,ab as je,ax as Me,bb as Ne,cb as Pe,cx as Fe,db as Ie,eb as Le,ei as Re,ex as ze,fb as Be,gb as Ve,hb as He,ib as Ue,ii as We,ix as Ge,ju as Ke,jy as qe,ky as C,lb as Je,mb as Ye,nb as Xe,nx as Ze,ob as Qe,pb as $e,qy as et,rb as w,rx as tt,sb as nt,sx as rt,t as T,tb as it,ti as at,tx as ot,ub as st,vb as ct,wb as lt,xb as ut,yb as dt,zu as ft,zy as pt}from"./api-Cpjr7qvl.js";import{t as mt}from"./chevrons-up-down-Chp_XyRp.js";import{i as ht,n as E,o as gt,r as _t,s as vt}from"./FieldLabel-Bww3UDFn.js";import{i as yt,n as bt,r as xt,t as St}from"./tabs-DHs6yOVA.js";import{t as D}from"./button-CbwCr9Pi.js";import{$ as O,Bt as Ct,Dt as wt,En as Tt,Et as k,F as Et,Gn as Dt,Ln as A,Q as j,Rn as Ot,Rt as kt,Vn as M,Wn as N,X as P,Z as F,at as At,ct as jt,et as I,fn as Mt,jt as L,ln as R,lt as z,nt as Nt,ot as Pt,q as Ft,rt as It,tt as Lt,ut as Rt,zn as zt,zt as Bt}from"./index-Bc3aF-kJ.js";import{r as Vt}from"./locales-CPjguROj.js";import{a as Ht,i as B,n as Ut,o as V,r as H,t as Wt}from"./table-CeTqDEfs.js";import{t as Gt}from"./FilterBar-FHDxb3k3.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-BHtlzKRR.js";import{t as U}from"./dispatchErrorInfo-EQWxZ8Ki.js";var $t=d(`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=d(`wifi-off`,[[`path`,{d:`M12 20h.01`,key:`zekei9`}],[`path`,{d:`M8.5 16.429a5 5 0 0 1 7 0`,key:`1bycff`}],[`path`,{d:`M5 12.859a10 10 0 0 1 5.17-2.69`,key:`1dl1wf`}],[`path`,{d:`M19 12.859a10 10 0 0 0-2.007-1.523`,key:`4k23kn`}],[`path`,{d:`M2 8.82a15 15 0 0 1 4.177-2.643`,key:`1grhjp`}],[`path`,{d:`M22 8.82a15 15 0 0 0-11.288-3.764`,key:`z3jwby`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}]]),W=t(e(),1);function tn(e){return e.filter(e=>e.state===`error`)}function nn(e){return e.reachable&&tn(e.targets).length===0}function rn(e){return nn(e)?(e.unreachableInstances??[]).length>0?`gateways_unreachable`:`ok`:`error`}function an(e){return e.state===`error`&&e.lastErrorCode!==null}function on(e){return!!e.lastDownstreamRejectCode}function G(e){return e.kind??`openclaw`}function sn(e){return[...e].sort((e,t)=>e===`openclaw`?-1:t===`openclaw`?1:e.localeCompare(t))}function cn(e,t,n){let r=new Map;for(let e of t)e.instanceName&&r.set(e.instanceName,e.provider);for(let e of n)r.set(e.name,G(e));let i=e=>(e.instanceName?r.get(e.instanceName):void 0)??`openclaw`,a=new Set;for(let e of n)a.add(G(e));for(let e of t)a.add(e.provider);for(let t of e)a.add(i(t));return sn(a).map(r=>({key:r,connections:e.filter(e=>i(e)===r),compatTargets:t.filter(e=>e.provider===r),instances:n.filter(e=>G(e)===r)}))}function K(e){return e===`openclaw`?`OpenClaw`:e===`hermes`?`Hermes`:e.charAt(0).toUpperCase()+e.slice(1)}var q=`__all__`,ln={q:``,state:q,instance:q,version:q},J={connected:0,error:1,idle:2};function un(e){return e.q.trim()!==``||e.state!==`__all__`||e.instance!==`__all__`||e.version!==`__all__`}function dn(e,t){let n=t.q.trim().toLowerCase();return e.filter(e=>!(n&&!`${e.targetLabel} ${e.gatewayHost}`.toLowerCase().includes(n)||t.state!==`__all__`&&e.state!==t.state||t.instance!==`__all__`&&(e.instanceName??``)!==t.instance||t.version!==`__all__`&&(e.gatewayVersion??``)!==t.version))}function Y(e,t){return e.localeCompare(t,void 0,{numeric:!0,sensitivity:`base`})}function X(e,t){return e===`version`?t.gatewayVersion===null:e===`lastOk`?t.lastOkAt===null:!1}function fn(e,t,n){switch(e){case`state`:return(J[t.state]??99)-(J[n.state]??99);case`instance`:return Y(t.instanceLabel??t.instanceName??``,n.instanceLabel??n.instanceName??``);case`host`:return Y(t.gatewayHost,n.gatewayHost);case`version`:{let e=t.gatewayVersion,r=n.gatewayVersion;return Zt(e,r)??Y(e,r)}case`lastOk`:return t.lastOkAt-n.lastOkAt;default:return Y(t.targetLabel,n.targetLabel)}}function pn(e,t){if(!t)return e;let n=t.dir===`asc`?1:-1;return[...e].sort((e,r)=>{let i=X(t.key,e),a=X(t.key,r);return i&&a?0:i?1:a?-1:n*fn(t.key,e,r)})}function mn(e){let t=new Set;for(let n of e)t.add(n.state);return[...t].sort((e,t)=>(J[e]??99)-(J[t]??99))}function hn(e){let t=new Map;for(let n of e)n.instanceName!==null&&(t.has(n.instanceName)||t.set(n.instanceName,n.instanceLabel??n.instanceName));return[...t.entries()].map(([e,t])=>({name:e,label:t})).sort((e,t)=>Y(e.label,t.label))}function gn(e){let t=new Set;for(let n of e)n.gatewayVersion!==null&&t.add(n.gatewayVersion);return[...t].sort((e,t)=>Zt(e,t)??Y(e,t))}var Z=n();function _n({connections:e,displayByInstance:t}){let[n,r]=(0,W.useState)(ln),[i,a]=(0,W.useState)(null),o=(0,W.useMemo)(()=>e.map((e,n)=>({_id:`${e.key}:${e.canonical}/${e.agentId}:${n}`,targetLabel:`${e.canonical}/${e.agentId}`,state:e.state,instanceName:e.instanceName??null,instanceLabel:e.instanceName?t.get(e.instanceName)??e.instanceName:null,gatewayHost:e.gatewayHost,gatewayVersion:e.gatewayVersion??null,okCount:e.okCount,errorCount:e.errorCount+(e.downstreamRejectCount??0),attempts:e.attempts,lastOkAt:e.lastOkAt??null,lastErrorCode:e.lastErrorCode??null,lastErrorAt:e.lastErrorAt??null,lastDownstreamRejectCode:e.lastDownstreamRejectCode??null,lastDownstreamRejectAt:e.lastDownstreamRejectAt??null})),[e,t]),s=(0,W.useMemo)(()=>mn(o),[o]),c=(0,W.useMemo)(()=>hn(o),[o]),u=(0,W.useMemo)(()=>gn(o),[o]),d=(0,W.useMemo)(()=>pn(dn(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:ne()}):(0,Z.jsxs)(`div`,{className:`oc-conn`,children:[(0,Z.jsxs)(Gt,{q:n.q,onQChange:e=>r(t=>({...t,q:e})),searchPlaceholder:be(),onReset:()=>r(ln),canReset:un(n),children:[(0,Z.jsxs)(P,{value:n.state,onValueChange:e=>r(t=>({...t,state:e})),children:[(0,Z.jsx)(O,{size:`sm`,className:`w-36`,children:(0,Z.jsx)(I,{placeholder:Se()})}),(0,Z.jsxs)(F,{children:[(0,Z.jsx)(j,{value:q,children:_()}),s.map(e=>(0,Z.jsx)(j,{value:e,children:yn(e)},e))]})]}),(0,Z.jsxs)(P,{value:n.instance,onValueChange:e=>r(t=>({...t,instance:e})),children:[(0,Z.jsx)(O,{size:`sm`,className:`w-40`,children:(0,Z.jsx)(I,{placeholder:l()})}),(0,Z.jsxs)(F,{children:[(0,Z.jsx)(j,{value:q,children:_()}),c.map(e=>(0,Z.jsx)(j,{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)(O,{size:`sm`,className:`w-36`,children:(0,Z.jsx)(I,{placeholder:pt()})}),(0,Z.jsxs)(F,{children:[(0,Z.jsx)(j,{value:q,children:_()}),u.map(e=>(0,Z.jsx)(j,{value:e,children:e},e))]})]})]}),d.length===0?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:ge()}):(0,Z.jsxs)(Wt,{className:`oc-conn__table`,children:[(0,Z.jsx)(Ht,{children:(0,Z.jsxs)(V,{children:[(0,Z.jsx)(Q,{label:re(),sortKey:`target`,sort:i,onSort:f}),(0,Z.jsx)(Q,{label:y(),sortKey:`state`,sort:i,onSort:f}),(0,Z.jsx)(Q,{label:m(),sortKey:`instance`,sort:i,onSort:f}),(0,Z.jsx)(Q,{label:de(),sortKey:`host`,sort:i,onSort:f}),(0,Z.jsx)(Q,{label:se(),sortKey:`version`,sort:i,onSort:f}),(0,Z.jsx)(B,{children:ae()}),(0,Z.jsx)(Q,{label:qe(),sortKey:`lastOk`,sort:i,onSort:f})]})}),(0,Z.jsx)(Ut,{children:d.map(e=>(0,Z.jsx)(vn,{r:e},e._id))})]})]})}function Q({label:e,sortKey:t,sort:n,onSort:r}){let i=n?.key===t,a=i?n.dir:null;return(0,Z.jsx)(B,{"aria-sort":i?a===`asc`?`ascending`:`descending`:`none`,children:(0,Z.jsxs)(`button`,{type:`button`,className:`oc-conn__sort`,onClick:()=>r(t),children:[e,i?a===`asc`?(0,Z.jsx)(Ot,{size:13,"aria-hidden":!0}):(0,Z.jsx)(M,{size:13,"aria-hidden":!0}):(0,Z.jsx)(mt,{size:13,"aria-hidden":!0,className:`oc-conn__sort-idle`})]})})}function vn({r:e}){let t=an(e)?U(e.lastErrorCode):null,n=on(e)?U(e.lastDownstreamRejectCode):null;return(0,Z.jsxs)(W.Fragment,{children:[(0,Z.jsxs)(V,{className:`oc-conn__row oc-conn__row--${e.state}`,children:[(0,Z.jsx)(H,{children:(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:e.targetLabel})}),(0,Z.jsx)(H,{children:(0,Z.jsx)(bn,{state:e.state})}),(0,Z.jsx)(H,{children:e.instanceLabel?(0,Z.jsx)(`span`,{className:`oc-bridge-target__instance`,children:e.instanceLabel}):(0,Z.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})}),(0,Z.jsx)(H,{children:(0,Z.jsx)(`span`,{className:`oc-bridge-target__host`,children:e.gatewayHost})}),(0,Z.jsx)(H,{children:e.gatewayVersion?(0,Z.jsx)(`span`,{className:`oc-bridge-target__version`,children:e.gatewayVersion}):(0,Z.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})}),(0,Z.jsx)(H,{children:(0,Z.jsx)(`span`,{className:`oc-conn__stats`,children:h({ok:e.okCount,errors:e.errorCount,attempts:e.attempts})})}),(0,Z.jsx)(H,{children:e.lastOkAt?(0,Z.jsx)(`span`,{className:`oc-traces__mono`,children:z(e.lastOkAt)}):(0,Z.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})})]}),t||n?(0,Z.jsx)(V,{className:`oc-conn__detail-row`,children:(0,Z.jsxs)(H,{colSpan:7,className:`oc-conn__detail-cell`,children:[t?(0,Z.jsxs)(`div`,{className:`oc-bridge-target__error`,children:[(0,Z.jsx)(`strong`,{children:t.label}),` `,(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:e.lastErrorCode}),e.lastErrorAt?` · ${z(e.lastErrorAt)}`:``,(0,Z.jsx)(`p`,{className:`oc-bridge-card__hint`,children:t.hint})]}):null,n?(0,Z.jsxs)(`div`,{className:`oc-bridge-target__downstream`,children:[Ce({label:n.label}),` `,(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:e.lastDownstreamRejectCode}),e.lastDownstreamRejectAt?` · ${z(e.lastDownstreamRejectAt)}`:``]}):null]})}):null]})}function yn(e){return e===`connected`?s():e===`error`?C():le()}function bn({state:e}){return e===`connected`?(0,Z.jsx)(k,{variant:`secondary`,children:s()}):e===`error`?(0,Z.jsx)(k,{variant:`destructive`,children:C()}):(0,Z.jsx)(k,{variant:`outline`,children:le()})}function xn(){return b(T.bridgeHealth.getBridgeHealth,{})}function Sn(){let e=xn(),t=b(T.compat.getBridgeCompat,{}),n=b(T.me.getMe,{host:Ft})?.role===`admin`,r=b(T.admin.listInstances,n?{}:`skip`),a=b(T.agents.usageForInstances,n?{}:`skip`),o=N(),s=()=>void o({to:`/settings/anomalies`,search:{status:`open`}}),c=cn(e?e.targets:[],t?t.targets:[],r??[]),{section:l}=Dt({from:`/settings/bridge`}),u=N({from:`/settings/bridge`}),d=t?.compat??null,f=t===void 0?`loading`:t===null?`nodata`:`ready`,p=d!==null&&Xt(d,`hermes`)&&!c.some(e=>e.key===`hermes`);return(0,Z.jsxs)(`div`,{className:`oc-bridge`,children:[(0,Z.jsx)(Cn,{health:e,compat:t,onSeeAnomalies:s}),(0,Z.jsx)(`p`,{className:`oc-admin__hint oc-bridge__caption`,children:Be()}),a&&a.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)(V,{children:[(0,Z.jsx)(B,{children:at()}),(0,Z.jsx)(B,{children:Re()}),(0,Z.jsx)(B,{children:i()}),(0,Z.jsx)(B,{children:pe()}),(0,Z.jsx)(B,{children:De()})]})}),(0,Z.jsx)(Ut,{children:a.flatMap(e=>{let t=Et(e.usage,Date.now());return t?t.windows.map((t,n)=>(0,Z.jsxs)(V,{children:[(0,Z.jsx)(H,{className:`font-medium`,children:n===0?e.instanceName:``}),(0,Z.jsx)(H,{children:t.provider}),(0,Z.jsx)(H,{children:t.label}),(0,Z.jsx)(H,{children:(0,Z.jsxs)(k,{variant:t.percentLeft<=10?`destructive`:t.percentLeft<=25?`outline`:`secondary`,children:[t.percentLeft,`%`]})}),(0,Z.jsx)(H,{className:`text-muted-foreground`,children:t.resetText??`—`})]},`${e.instanceName}:${t.provider}:${t.label}`)):[]})})]})]}):null,c.length>0?(0,Z.jsxs)(St,{value:c.some(e=>e.key===l)?l:c[0]?.key??`openclaw`,onValueChange:e=>void u({search:{section:e},replace:!0}),children:[(0,Z.jsx)(xt,{className:`w-full`,children:c.map(e=>(0,Z.jsxs)(yt,{value:e.key,className:`flex-1 gap-1.5`,children:[(0,Z.jsx)(Mt,{size:13,"aria-hidden":!0}),K(e.key)]},e.key))}),c.map(e=>(0,Z.jsx)(bt,{value:e.key,children:(0,Z.jsx)(wn,{providerKey:e.key,connections:e.connections,instances:e.instances,manifest:d,compatStatus:f,compatReachable:t?.reachable??!0,protocol:e.key===`openclaw`?t?.protocol??null:null})},e.key))]}):null,p?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:ye()}):null]})}function Cn({health:e,compat:t,onSeeAnomalies:n}){let r=t!=null&&t.buildVersion!=null&&t.bridgeVersion!=null&&t.buildVersion!==t.bridgeVersion,i=t?.buildRevision&&t.buildRevision!==`unknown`?t.buildRevision.slice(0,7):null,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)}),i?(0,Z.jsxs)(Z.Fragment,{children:[` `,(0,Z.jsxs)(`code`,{className:`oc-traces__mono`,title:c(),children:[`(`,i,`)`]})]}):null,r?(0,Z.jsxs)(`strong`,{className:`oc-bridge-card__mismatch`,children:[` `,ft({build:t.buildVersion??`?`})]}):null,` · `,he(),` `,(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:t.protocolVersion===null?S():String(t.protocolVersion)})]}):null;if(e===void 0)return(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:w()});if(e===null)return(0,Z.jsx)(`div`,{className:`oc-bridge-card oc-bridge-card--idle`,children:Xe()});let s=tn(e.targets),l=!e.reachable,u=rn(e),d=e.unreachableInstances??[],f=u===`ok`?`ok`:u===`gateways_unreachable`?`warn`:`error`,p=jt(e.checkedAt),m=e.startedAt==null?null:jt(e.startedAt);return(0,Z.jsxs)(`div`,{className:`oc-bridge-card oc-bridge-card--${f}`,children:[(0,Z.jsx)(`div`,{className:`oc-bridge-card__icon`,"aria-hidden":!0,children:u===`ok`?(0,Z.jsx)(A,{size:22}):l||u===`gateways_unreachable`?(0,Z.jsx)(en,{size:22}):(0,Z.jsx)(R,{size:22})}),(0,Z.jsxs)(`div`,{className:`oc-bridge-card__body`,children:[(0,Z.jsx)(`div`,{className:`oc-bridge-card__title`,children:u===`ok`?it():u===`gateways_unreachable`?Oe({count:d.length}):l?Le():a({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}),` `,me({time:p})]}),m?(0,Z.jsx)(`span`,{children:Ee({time:m})}):null,o]}),u===`gateways_unreachable`?(0,Z.jsx)(`p`,{className:`oc-bridge-card__hint`,children:we({names:d.join(`, `)})}):null,l?(0,Z.jsx)(`p`,{className:`oc-bridge-card__hint`,children:U(e.lastError===`not_configured`?`NOT_CONFIGURED`:`BRIDGE_UNREACHABLE`).hint}):null]}),(0,Z.jsx)(`button`,{type:`button`,className:`oc-bridgebar__drill`,onClick:n,children:x()})]})}function wn({providerKey:e,connections:t,instances:n,manifest:r,compatStatus:i,compatReachable:a,protocol:o}){let s=r?Kt(r,e):null,c=new Map;for(let e of n)c.set(e.name,e.displayName??e.name);let l=[],u=new Set;for(let n of t){if(!n.instanceName||u.has(n.instanceName))continue;u.add(n.instanceName);let t=n.gatewayVersion??null;l.push({instanceName:n.instanceName,displayName:c.get(n.instanceName)??n.instanceName,version:t,state:Jt(t,e,r)})}let d=Qt(l.map(e=>e.state)),[f,p]=(0,W.useState)(!1);return(0,Z.jsxs)(`section`,{className:`oc-bridge-provider`,children:[(0,Z.jsxs)(`header`,{className:`oc-bridge-provider__head`,children:[(0,Z.jsx)(Mt,{size:15,"aria-hidden":!0,className:`oc-bridge-provider__icon`}),(0,Z.jsx)(`span`,{className:`oc-bridge-provider__name`,children:K(e)}),d?(0,Z.jsx)(k,{variant:d===`beyond`||d===`defective`?`destructive`:`secondary`,children:qt(d)}):null]}),(0,Z.jsx)(`h4`,{className:`oc-bridge-provider__sub`,children:g()}),(0,Z.jsx)(En,{providerName:K(e),support:s,compatStatus:i,compatReachable:a,manifest:r,instanceRows:l}),o?(0,Z.jsx)(Tn,{protocol:o}):null,(0,Z.jsxs)(`button`,{type:`button`,className:`oc-bridge-provider__sub oc-bridge-provider__sub--toggle`,"aria-expanded":f,onClick:()=>p(e=>!e),children:[f?(0,Z.jsx)(M,{size:13,"aria-hidden":!0}):(0,Z.jsx)(zt,{size:13,"aria-hidden":!0}),et({count:t.length})]}),f?(0,Z.jsx)(_n,{connections:t,displayByInstance:c}):null]})}function Tn({protocol:e}){let[t,n]=(0,W.useState)(!1),r=e.coverage,i=e.drift??[],a=(e.driftOverflow??0)+(e.driftTruncated??0);return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`h4`,{className:`oc-bridge-provider__sub`,children:[st(),i.length>0?(0,Z.jsx)(k,{variant:`destructive`,children:Pe({count:i.length})}):a>0?(0,Z.jsx)(k,{variant:`destructive`,children:nt()}):(0,Z.jsx)(k,{variant:`secondary`,children:Je()})]}),(0,Z.jsxs)(`p`,{className:`oc-admin__hint`,children:[Qe({version:e.vendoredVersion}),r?` · `+je({handled:r.handled,ignored:r.ignored,gaps:r.gaps}):null]}),a>0?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:Ae({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)(zt,{size:13,"aria-hidden":!0}),Ue({count:r.gapList.length})]}),t?(0,Z.jsx)(`ul`,{className:`oc-bridge-protocol__list`,role:`list`,children:r.gapList.map(e=>(0,Z.jsx)(`li`,{children:(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:e})},e))}):null]}):null]})}function En({support:e,compatStatus:t,compatReachable:n,manifest:r,instanceRows:i,providerName:a}){return t===`loading`?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:w()}):t===`nodata`?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:xe()}):(0,Z.jsxs)(`div`,{className:`oc-compat`,children:[n?null:(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:v()}),r===null?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:p()}):(0,Z.jsxs)(`div`,{className:`oc-compat__support`,children:[(0,Z.jsx)(`span`,{className:`oc-compat__label`,children:We({provider:a})}),e&&e.range!==null?(0,Z.jsx)(`span`,{children:ue({min:e.range.min,max:e.range.maxValidated})}):(0,Z.jsx)(`span`,{children:S()}),e?(0,Z.jsx)(kn,{versions:e.validatedVersions}):null]}),i.length===0?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:o()}):(0,Z.jsx)(`div`,{className:`oc-compat__targets`,children:i.map(e=>(0,Z.jsxs)(`div`,{className:`oc-compat__target`,children:[(0,Z.jsx)(`span`,{className:`oc-compat__instance`,children:e.displayName}),(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:Yt(e.version)}),(0,Z.jsx)(k,{variant:e.state===`supported`?`secondary`:e.state===`beyond`||e.state===`defective`?`destructive`:`outline`,children:qt(e.state)})]},e.instanceName))})]})}function Dn({instance:e,onClose:t}){return(0,Z.jsx)(Lt,{open:!0,onOpenChange:e=>!e&&t(),children:(0,Z.jsxs)(Nt,{className:`oc-bridge-config-dialog`,onOpenAutoFocus:e=>e.preventDefault(),children:[(0,Z.jsxs)(At,{children:[(0,Z.jsx)(Pt,{children:Fe({instance:e.displayName??e.name})}),(0,Z.jsx)(It,{children:rt()})]}),(0,Z.jsx)(On,{instance:e,onClose:t})]})})}function $({label:e,result:t}){return t?t.checked?(0,Z.jsxs)(`p`,{className:`oc-bridge-config__check-row `+(t.ok?`oc-bridge-config__check-row--ok`:`oc-bridge-config__check-row--err`),children:[t.ok?(0,Z.jsx)(A,{"aria-hidden":!0}):(0,Z.jsx)(R,{"aria-hidden":!0}),(0,Z.jsxs)(`span`,{children:[e,` — `,t.ok?Ve():t.detail]})]}):(0,Z.jsxs)(`p`,{className:`oc-bridge-config__check-row oc-bridge-config__check-row--skip`,children:[e,` — `,He()]}):null}function On({instance:e,onClose:t}){let n=ee(T.admin.upsertInstanceConfig),i=ce(T.bridge.validateMediaPaths),a=wt(),o=Vt(e.config?.contentLocale,void 0),[s,c]=(0,W.useState)(()=>ht(e.config??{},o)),[l,d]=(0,W.useState)(!1),[p,m]=(0,W.useState)(!1),[h,g]=(0,W.useState)(null),_=s.inboundMediaMode===`shared-fs`,v=s.mediaMode===`shared-fs`,y=_||v;async function b(){m(!0),g(null);try{g(await i({instanceName:e.name,inboundMediaMode:s.inboundMediaMode,mediaMode:s.mediaMode}))}catch(e){a.error(Ne(),e)}finally{m(!1)}}async function x(){d(!0);try{let r=e.config??{};await n({instanceId:e._id,config:_t(s,r,o)}),t()}catch(e){a.error(ze(),e)}finally{d(!1)}}return(0,Z.jsx)(`div`,{className:`oc-bridge-config`,children:(0,Z.jsxs)(`div`,{className:`oc-bridge-config__form`,children:[(0,Z.jsxs)(`div`,{className:`oc-bridge-config__grid`,children:[(0,Z.jsxs)(`label`,{className:`oc-field`,children:[(0,Z.jsx)(E,{label:Me(),help:r()}),(0,Z.jsxs)(P,{value:s.mediaMode,onValueChange:e=>c({...s,mediaMode:e}),children:[(0,Z.jsx)(O,{size:`sm`,className:`w-full`,children:(0,Z.jsx)(I,{})}),(0,Z.jsx)(F,{children:vt.map(e=>(0,Z.jsx)(j,{value:e,children:e},e))})]})]}),(0,Z.jsxs)(`label`,{className:`oc-field`,children:[(0,Z.jsx)(E,{label:Ge(),help:fe()}),(0,Z.jsxs)(P,{value:s.inboundMediaMode,onValueChange:e=>c({...s,inboundMediaMode:e}),children:[(0,Z.jsx)(O,{size:`sm`,className:`w-full`,children:(0,Z.jsx)(I,{})}),(0,Z.jsx)(F,{children:gt.map(e=>(0,Z.jsx)(j,{value:e,children:e},e))})]})]}),(0,Z.jsxs)(`label`,{className:`oc-field`,children:[(0,Z.jsx)(E,{label:tt(),help:Te()}),(0,Z.jsx)(L,{type:`number`,min:1,max:4096,className:`w-full`,value:s.mediaMaxMb,onChange:e=>c({...s,mediaMaxMb:Math.trunc(Number(e.target.value)||0)})})]})]}),y&&(0,Z.jsxs)(`div`,{className:`oc-bridge-config__grid`,children:[_&&(0,Z.jsxs)(`label`,{className:`oc-field`,children:[(0,Z.jsx)(E,{label:f(),help:ve()}),(0,Z.jsx)(L,{className:`w-full`,spellCheck:!1,value:s.inboundAgentMount,onChange:e=>c({...s,inboundAgentMount:e.target.value})})]}),v&&(0,Z.jsxs)(`label`,{className:`oc-field`,children:[(0,Z.jsx)(E,{label:lt(),help:u()}),(0,Z.jsx)(L,{className:`w-full`,spellCheck:!1,value:s.outboundAgentMount,onChange:e=>c({...s,outboundAgentMount:e.target.value})})]})]}),(0,Z.jsxs)(`label`,{className:`oc-field--row`,children:[(0,Z.jsx)(Rt,{checked:s.rehydration,onCheckedChange:e=>c({...s,rehydration:e===!0})}),(0,Z.jsx)(E,{label:Ze(),help:te()})]}),y&&h!==null&&(0,Z.jsx)(`div`,{className:`oc-bridge-config__check`,children:h.reachable?!h.inbound&&!h.outbound?(0,Z.jsxs)(`p`,{className:`oc-bridge-config__check-row oc-bridge-config__check-row--err`,children:[(0,Z.jsx)(R,{"aria-hidden":!0}),$e({reason:h.reason??`?`})]}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)($,{label:ct(),result:h.inbound}),(0,Z.jsx)($,{label:ke(),result:h.outbound}),(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:dt()})]}):(0,Z.jsxs)(`p`,{className:`oc-bridge-config__check-row oc-bridge-config__check-row--err`,children:[(0,Z.jsx)(R,{"aria-hidden":!0}),Ye()]})}),(0,Z.jsxs)(`div`,{className:`oc-bridge-config__actions`,children:[y&&(0,Z.jsxs)(D,{variant:`outline`,size:`sm`,onClick:()=>void b(),disabled:p,children:[p?(0,Z.jsx)(Tt,{className:`size-4 animate-spin`,"aria-hidden":!0}):null,p?ut():_e()]}),(0,Z.jsx)(D,{size:`sm`,onClick:()=>void x(),disabled:l,children:ot()})]})]})})}function kn({versions:e}){if(e.length===0)return null;let t=[...e].reverse();return(0,Z.jsxs)(kt,{children:[(0,Z.jsx)(Ct,{asChild:!0,children:(0,Z.jsxs)(`button`,{type:`button`,className:`oc-compat__versions-btn`,children:[e.length===1?oe():ie({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:Ke()}),(0,Z.jsx)(`div`,{className:`oc-compat__versions-list`,children:t.map(e=>(0,Z.jsx)(k,{variant:`secondary`,children:e},e))})]})]})}export{Sn as BridgeTab,Dn as InstanceConfigDialog};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Dd as r,Dz as i,Fz as a,Gu as o,Iz as s,Ju as c,Ku as l,Nz as u,Uu as d,Wu as f,Xu as p,Yu as m,Zu as h,_s as g,bs as _,cf as v,ds as y,ff as b,fs as x,gs as S,hs as C,mf as w,ms as T,ox as E,ps as D,qu as O,ri as k,sf as A,t as j,vs as M,ys as N}from"./api-Cpjr7qvl.js";import{t as P}from"./button-CbwCr9Pi.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,ln as W,ut as G}from"./index-
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Dd as r,Dz as i,Fz as a,Gu as o,Iz as s,Ju as c,Ku as l,Nz as u,Uu as d,Wu as f,Xu as p,Yu as m,Zu as h,_s as g,bs as _,cf as v,ds as y,ff as b,fs as x,gs as S,hs as C,mf as w,ms as T,ox as E,ps as D,qu as O,ri as k,sf as A,t as j,vs as M,ys as N}from"./api-Cpjr7qvl.js";import{t as P}from"./button-CbwCr9Pi.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,ln as W,ut as G}from"./index-Bc3aF-kJ.js";import{a as K}from"./compatView-BHtlzKRR.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=a(j.admin.upsertInstanceConfig),n=s(j.agents.listAgentsForInstance,{instanceName:e.name}),r=typeof e.config?.converterAgentId==`string`?e.config.converterAgentId:``,[i,c]=(0,q.useState)(r),[l,u]=(0,q.useState)(`idle`);(0,q.useEffect)(()=>{c(r),u(`idle`)},[e._id,r]);let p=`__none__`,m=i!==r;async function h(){u(`saving`);try{let n={...e.config??{}};i===``||i===p?delete n.converterAgentId:n.converterAgentId=i,await t({instanceId:e._id,config:n}),u(`done`)}catch{u(`error`)}}let _=n?.agents??[];return(0,X.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,X.jsx)(`span`,{className:`oc-cdefaults__label`,children:g()}),(0,X.jsx)(`p`,{className:`oc-admin__hint`,children:S()}),(0,X.jsxs)(`div`,{className:`oc-cdefaults__inline`,children:[(0,X.jsxs)(B,{value:i===``?p:i,onValueChange:e=>c(e===p?``:e),children:[(0,X.jsx)(F,{className:`oc-cdefaults__select`,"aria-label":g(),children:(0,X.jsx)(H,{placeholder:C()})}),(0,X.jsxs)(V,{children:[(0,X.jsx)(z,{value:p,children:C()}),_.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:!m||l===`saving`,onClick:()=>void h(),children:l===`saving`?w():o()})]}),l===`done`?(0,X.jsx)(`p`,{className:`oc-admin__hint`,role:`status`,children:f()}):null,l===`error`?(0,X.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:d()}):null]})}function Q({instance:e}){let t=a(j.admin.upsertInstanceConfig),n=e.config?.curationEnabled===!0,r=typeof e.config?.curationBudgetChars==`number`?e.config.curationBudgetChars:null,[i,s]=(0,q.useState)(n),[c,l]=(0,q.useState)(r===null?``:String(r)),[u,p]=(0,q.useState)(`idle`);(0,q.useEffect)(()=>{s(n),l(r===null?``:String(r)),p(`idle`)},[e._id,n,r]);let m=c.trim(),h=m===``?null:/^\d+$/.test(m)?Number.parseInt(m,10):NaN,g=!i||h===null||Number.isInteger(h)&&h>=4e3&&h<=6e4,_=i!==n||(h??null)!==r;async function v(){p(`saving`);try{let n={...e.config??{}};n.curationEnabled=i,!i||h===null||Number.isNaN(h)?delete n.curationBudgetChars:n.curationBudgetChars=h,await t({instanceId:e._id,config:n}),p(`done`)}catch{p(`error`)}}return(0,X.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,X.jsxs)(`label`,{className:`oc-cdefaults__inline`,style:{cursor:`pointer`},children:[(0,X.jsx)(G,{checked:i,onCheckedChange:e=>s(e===!0),"aria-label":M()}),(0,X.jsx)(`span`,{className:`oc-cdefaults__label`,children:M()})]}),(0,X.jsxs)(`div`,{className:`oc-cdefaults__inline`,children:[(0,X.jsx)(U,{type:`number`,min:4e3,max:6e4,step:1e3,placeholder:`20000`,value:c,onChange:e=>l(e.target.value),className:`oc-cdefaults__number`,"aria-invalid":!g,"aria-label":T(),disabled:!i}),(0,X.jsx)(P,{size:`sm`,disabled:!_||!g||u===`saving`,onClick:()=>void v(),children:u===`saving`?w():o()})]}),g?null:(0,X.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:D()}),u===`done`?(0,X.jsx)(`p`,{className:`oc-admin__hint`,role:`status`,children:f()}):null,u===`error`?(0,X.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:d()}):null,(0,X.jsx)(`p`,{className:`oc-cdefaults__help`,children:x()})]})}function $({instance:e}){let t=a(j.admin.upsertInstanceConfig),n=typeof e.config?.summarizeThresholdChars==`number`?e.config.summarizeThresholdChars:null,[r,i]=(0,q.useState)(n===null?``:String(n)),[s,c]=(0,q.useState)(`idle`);(0,q.useEffect)(()=>{i(n===null?``:String(n)),c(`idle`)},[e._id,n]);let l=r.trim(),u=l===``?null:/^\d+$/.test(l)?Number.parseInt(l,10):NaN,p=u===null||Number.isInteger(u)&&u>=1e3&&u<=2e5,m=(u??null)!==n;async function h(){c(`saving`);try{let n={...e.config??{}};u===null?delete n.summarizeThresholdChars:n.summarizeThresholdChars=u,await t({instanceId:e._id,config:n}),c(`done`)}catch{c(`error`)}}return(0,X.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,X.jsx)(`span`,{className:`oc-cdefaults__label`,children:_()}),(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":!p}),(0,X.jsx)(P,{size:`sm`,disabled:!m||!p||s===`saving`,onClick:()=>void h(),children:s===`saving`?w():o()})]}),p?null:(0,X.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:y()}),s===`done`?(0,X.jsx)(`p`,{className:`oc-admin__hint`,role:`status`,children:f()}):null,s===`error`?(0,X.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:d()}):null,(0,X.jsx)(`p`,{className:`oc-cdefaults__help`,children:N()})]})}function ee(){let e=u(j.agentFiles.getChatDefaults),[t,n]=(0,q.useState)({status:`loading`}),a=s(j.admin.listInstances,{}),[o,d]=(0,q.useState)(null);(0,q.useEffect)(()=>{!a||a.length===0||(!o||!a.some(e=>e.name===o))&&d(a[0].name)},[a,o]);let f=(a?.length??0)>1,g=a!==void 0&&a.length===0,_=s(j.compat.forInstance,o?{instanceName:o}:`skip`),y=o?I(_,`configDefaults`):`loading`,x=y===`loading`?null:y.blocked,S=(0,q.useMemo)(()=>f&&o?{instanceName:o}:{},[f,o]),C=(0,q.useRef)(0),w=(0,q.useCallback)(async()=>{let t=++C.current;n({status:`loading`});try{let r=Y(await e(S));if(C.current!==t)return;n({status:`done`,current:r})}catch{if(C.current!==t)return;n({status:`error`})}},[e,S]);(0,q.useEffect)(()=>{x===!1&&(f&&!o||w())},[w,x,f,o]);let T=t.status===`done`?t.current:null,D=(0,q.useMemo)(()=>J.map(e=>({id:e,label:R(e)})),[]),M=(0,q.useMemo)(()=>[{id:`fast`,label:v()},{id:`standard`,label:A()}],[]);return(0,X.jsxs)(`div`,{className:`oc-cdefaults`,children:[(0,X.jsx)(`p`,{className:`oc-admin__hint`,children:h()}),f&&o?(0,X.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,X.jsx)(`span`,{className:`oc-cdefaults__label`,children:r()}),(0,X.jsxs)(B,{value:o,onValueChange:e=>d(e),children:[(0,X.jsx)(F,{size:`sm`,"aria-label":r(),children:(0,X.jsx)(H,{})}),(0,X.jsx)(V,{children:(a??[]).map(e=>(0,X.jsx)(z,{value:e.name,children:e.name},e.name))})]})]}):null,g?(0,X.jsx)(`p`,{className:`oc-admin__hint`,role:`status`,children:E()}):y===`loading`?(0,X.jsx)(`p`,{className:`oc-admin__hint`,children:i()}):y.blocked?(0,X.jsxs)(`p`,{className:`oc-compat__blocked`,role:`status`,children:[(0,X.jsx)(W,{size:14,"aria-hidden":!0}),` `,K(y.gatewayVersion,y.provider)]}):t.status===`loading`?(0,X.jsx)(`p`,{className:`oc-admin__hint`,children:i()}):t.status===`error`?(0,X.jsxs)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:[l(),` `,(0,X.jsx)(P,{variant:`outline`,size:`sm`,onClick:()=>void w(),children:b()})]}):(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,X.jsx)(`span`,{className:`oc-cdefaults__label`,children:p()}),(0,X.jsx)(L,{field:`thinkingLevel`,options:D,value:T?.thinkingDefault??null,onChange:()=>{},disabled:!0,ariaLabel:p()}),(0,X.jsx)(`p`,{className:`oc-cdefaults__help`,children:m()})]}),(0,X.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,X.jsx)(`span`,{className:`oc-cdefaults__label`,children:c()}),(0,X.jsx)(L,{field:`fastMode`,options:M,value:T===null||T.fastModeDefault===null?null:T.fastModeDefault?`fast`:`standard`,onChange:()=>{},disabled:!0,ariaLabel:c()}),(0,X.jsx)(`p`,{className:`oc-cdefaults__help`,children:O()})]}),(0,X.jsx)(`p`,{className:`oc-cdefaults__note`,children:k()})]}),(()=>{let e=a?.find(e=>e.name===(o??a[0]?.name));return e?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)($,{instance:e}),(0,X.jsx)(Q,{instance:e}),(0,X.jsx)(Z,{instance:e})]}):null})()]})}export{ee as ChatDefaultsTab};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Ch as r,Sh as i,Th as a,bh as o,wh as s,xh as c,yh as l}from"./api-Cpjr7qvl.js";import{t as u}from"./chevrons-up-down-Chp_XyRp.js";import{t as d}from"./button-CbwCr9Pi.js";import{It as f,Lt as p,Mt as m,Nn as h,Nt as g,Pt as _,Rn as v,Vn as y,hn as b,un as x,ut as S}from"./index-
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Ch as r,Sh as i,Th as a,bh as o,wh as s,xh as c,yh as l}from"./api-Cpjr7qvl.js";import{t as u}from"./chevrons-up-down-Chp_XyRp.js";import{t as d}from"./button-CbwCr9Pi.js";import{It as f,Lt as p,Mt as m,Nn as h,Nt as g,Pt as _,Rn as v,Vn as y,hn as b,un as x,ut as S}from"./index-Bc3aF-kJ.js";import{a as C,i as w,n as T,o as E,r as D,t as O}from"./table-CeTqDEfs.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=a(),bulkActions:F,emptyHint:I=s(),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)(x,{}):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:r()}):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)(S,{"aria-label":i(),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":l({column:e.header}),children:[e.header,n?V.dir===`asc`?(0,M.jsx)(v,{className:`oc-dt__sort-icon`,"aria-hidden":!0}):(0,M.jsx)(y,{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)??[],r=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)(S,{"aria-label":c(),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)(m,{children:[(0,M.jsx)(p,{asChild:!0,children:(0,M.jsx)(d,{variant:`ghost`,size:`icon-sm`,"aria-label":o(),className:`opacity-0 transition-opacity group-hover/row:opacity-100 group-focus-within/row:opacity-100 aria-expanded:opacity-100`,children:(0,M.jsx)(h,{})})}),(0,M.jsx)(g,{align:`end`,children:t.map((t,n)=>(0,M.jsxs)(`div`,{children:[t.variant===`destructive`&&n>0?(0,M.jsx)(f,{}):null,(0,M.jsx)(_,{variant:t.variant,onSelect:()=>t.onSelect(e),children:t.label})]},t.label))})]}):null}):null]}),r&&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-Bc3aF-kJ.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{$D as r,AD as i,BD as a,CO as o,DD as s,ED as c,EO as l,Eo as u,FD as d,Fz as f,GD as p,HD as m,ID as h,Iz as g,JD as ee,KD as _,LD as te,MD as ne,ND as re,OD as ie,PD as ae,QD as v,RD as oe,SO as y,TD as b,TO as x,UD as S,VD as C,WD as w,XD as T,YD as E,ZD as D,_O as O,aO as k,bO as A,cO as j,dO as M,eO as N,fO as P,gO as F,hO as I,iO as L,jD as R,kD as z,lO as B,mO as V,nO as H,oO as U,pO as W,qD as G,rO as K,sO as q,t as J,tO as se,uO as ce,vO as le,wD as ue,wO as de,wo as fe,xO as pe,yO as me,zD as he}from"./api-Cpjr7qvl.js";import{t as ge}from"./button-CbwCr9Pi.js";import{U as _e,ct as Y}from"./index-
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$D as r,AD as i,BD as a,CO as o,DD as s,ED as c,EO as l,Eo as u,FD as d,Fz as f,GD as p,HD as m,ID as h,Iz as g,JD as ee,KD as _,LD as te,MD as ne,ND as re,OD as ie,PD as ae,QD as v,RD as oe,SO as y,TD as b,TO as x,UD as S,VD as C,WD as w,XD as T,YD as E,ZD as D,_O as O,aO as k,bO as A,cO as j,dO as M,eO as N,fO as P,gO as F,hO as I,iO as L,jD as R,kD as z,lO as B,mO as V,nO as H,oO as U,pO as W,qD as G,rO as K,sO as q,t as J,tO as se,uO as ce,vO as le,wD as ue,wO as de,wo as fe,xO as pe,yO as me,zD as he}from"./api-Cpjr7qvl.js";import{t as ge}from"./button-CbwCr9Pi.js";import{U as _e,ct as Y}from"./index-Bc3aF-kJ.js";import{t as ve}from"./DataTableShell-DWXPn72S.js";var X=t(e(),1),Z=n(),ye={altered_words:()=>l(),incorrect:()=>x(),incoherence:()=>de(),formatting:()=>o(),latency:()=>y(),api_error:()=>pe(),other:()=>A()},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:le()}):e===!1?(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-warn`,children:O()}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill`,children:`—`}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill`,children:me()})}function be({data:e,reference:t,closeReason:n}){let a=e.snapshot,o=f(J.feedback.respondToFeedback),[s,c]=(0,X.useState)(e.thread),[l,d]=(0,X.useState)(``),[p,m]=(0,X.useState)(!1);async function h(){let t=l.trim();if(!(!t||p)){m(!0);try{await o({feedbackId:e._id,text:t}),c(e=>[...e,{authorRole:`admin`,text:t,at:Date.now()}]),d(``)}finally{m(!1)}}}let g=[];try{g=a.contextJson?JSON.parse(a.contextJson):[]}catch{g=[]}return(0,Z.jsxs)(`div`,{className:`oc-fbadmin__detail`,children:[(0,Z.jsxs)(`div`,{className:`oc-fbadmin__row`,children:[(0,Z.jsx)($,{matches:a.displayedMatchesStored,sourceWasOpen:a.clientInfo?.sourceWasOpen??!1}),(0,Z.jsxs)(`span`,{className:`oc-fbadmin__meta`,children:[Q(e.category),` · `,a.messageRole,a.isRegeneration?` · ${F()}`:``,a.openclawModel?` · ${a.openclawModel}`:``,a.openclawRuntime?` (${a.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:I()}),(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:i()}),(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:V()}),s.length>0?(0,Z.jsx)(`div`,{className:`oc-fbadmin__thread`,children:s.map((e,t)=>(0,Z.jsxs)(`div`,{className:`oc-notif__msg oc-notif__msg--${e.authorRole}`,children:[(0,Z.jsx)(`span`,{className:`oc-notif__msg-who`,children:e.authorRole===`admin`?W():e.authorRole===`agent`?e.authorLabel??u():P()}),(0,Z.jsx)(`span`,{className:`oc-notif__msg-text`,children:e.text})]},t))}):(0,Z.jsx)(`p`,{className:`oc-fbadmin__meta`,children:M()}),(0,Z.jsx)(`textarea`,{className:`oc-feedback__textarea`,placeholder:ce(),value:l,maxLength:2e3,rows:3,onChange:e=>d(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 h(),disabled:!l.trim()||p,children:p?B():j()})})]}),(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:q()}),(0,Z.jsx)(`pre`,{className:`oc-msg__source-pre`,children:a.messageText||U()})]}),a.clientInfo?.sourceWasOpen&&a.displayedText!==void 0?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:k()}),(0,Z.jsx)(`pre`,{className:`oc-msg__source-pre`,children:a.displayedText||U()})]}):null,a.promptText?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:L()}),(0,Z.jsx)(`pre`,{className:`oc-msg__source-pre`,children:a.promptText})]}):null,g.length>0?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:K({count:a.contextCount??g.length,truncated:a.contextTruncated?H():``})}),(0,Z.jsx)(`div`,{className:`oc-fbadmin__ctx`,children:g.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,a.outboxAvailable?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:se()}),(0,Z.jsxs)(`pre`,{className:`oc-msg__source-pre`,children:[a.outboxText??``,a.outboxStatus?`\n[status: ${a.outboxStatus}]`:``]})]}):null,a.clientInfo?.extensionsDetected&&a.clientInfo.extensionsDetected.length>0?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:N()}),(0,Z.jsx)(`div`,{className:`oc-fbadmin__row`,children:a.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:r()}),(0,Z.jsxs)(`p`,{className:`oc-fbadmin__env`,children:[[a.clientInfo?.language,a.clientInfo?.timezone,a.clientInfo?.theme?v({theme:a.clientInfo.theme}):null,a.runId?`run ${a.runId.slice(0,12)}…`:null].filter(Boolean).join(` · `)||`—`,a.clientInfo?.plugins&&a.clientInfo.plugins.length>0?(0,Z.jsxs)(`span`,{className:`oc-fbadmin__plugins`,children:[D(),` `,a.clientInfo.plugins.join(`, `),(0,Z.jsxs)(`span`,{className:`oc-fbadmin__note`,children:[` `,T()]})]}):null,a.clientInfo?.userAgent?(0,Z.jsx)(`span`,{className:`oc-fbadmin__ua`,children:a.clientInfo.userAgent}):null]})]})]})}function xe(){let e=g(J.feedback.listForAdmin,{}),t=f(J.feedback.readSnapshot),n=f(J.feedback.deleteFeedback),r=_e(),[i,o]=(0,X.useState)(null),[l,u]=(0,X.useState)({});async function v(e){if(i===e._id){o(null);return}if(!l[e._id]){let n=await t({feedbackId:e._id});u(t=>({...t,[e._id]:n}))}o(e._id)}async function y(e){await r({title:c(),description:b(),confirmLabel:ue(),destructive:!0})&&(await n({feedbackId:e._id}),i===e._id&&o(null))}return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`p`,{className:`oc-admin__hint`,children:[E(),` `,(0,Z.jsx)(`strong`,{children:ee()}),` `,G()]}),(0,Z.jsx)(ve,{title:_(),rows:e,emptyHint:p(),isExpanded:e=>i===e._id&&!!l[e._id],renderExpanded:e=>l[e._id]?(0,Z.jsx)(be,{data:l[e._id],reference:e.reference,closeReason:e.userCloseReason}):null,columns:[{header:S(),cell:e=>Y(e.at),sort:e=>e.at},{header:m(),cell:e=>Q(e.category),sort:e=>Q(e.category)},{header:C(),cell:e=>e.messageRole===`user`?a():he(),sort:e=>e.messageRole},{header:oe(),cell:e=>(e.reporterEmail||e.reporterName||`—`)+(e.impersonated&&e.realOperatorEmail?` ${te({operator:e.realOperatorEmail})}`:``),sort:e=>e.reporterEmail||e.reporterName||null},{header:h(),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:ae(),cell:e=>e.userClosedAt==null?e.resolvedAt==null?e.answered?(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-ok`,children:re()}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill`,children:ne()}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-ok`,title:e.resolvedBy??void 0,children:fe()}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-closed`,children:R()}),sort:e=>e.userClosedAt==null?e.resolvedAt==null?+!!e.answered:2:3}],rowActions:e=>[{label:i===e._id?z():ie(),onSelect:()=>void v(e)},{label:s(),onSelect:()=>void y(e),variant:`destructive`}]})]})}export{xe as FeedbacksTab};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./bundle-mjs-C73ZY4La.js";import{D as t,Uz as n}from"./api-Cpjr7qvl.js";import{I as r,L as i,R as a,Xt as o,Yt as s,z as c}from"./index-
|
|
1
|
+
import{r as e}from"./bundle-mjs-C73ZY4La.js";import{D as t,Uz as n}from"./api-Cpjr7qvl.js";import{I as r,L as i,R as a,Xt as o,Yt as s,z as c}from"./index-Bc3aF-kJ.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};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{AR as r,Ao as i,BR as ee,CR as te,DR as ne,Dz as re,ER as ie,FR as a,Fz as ae,GR as o,HR as oe,IR as s,Iz as se,JR as ce,KR as le,LR as c,MR as l,Mj as ue,NR as u,OR as de,PR as d,RR as fe,SR as pe,TR as f,UR as me,VR as p,WR as m,_R as h,bR as g,gR as he,hR as ge,jR as _,kR as _e,ko as ve,kz as ye,mR as be,pR as xe,qR as v,t as y,vR as b,wR as x,xR as S,yR as C,zR as w}from"./api-Cpjr7qvl.js";import{t as T}from"./button-CbwCr9Pi.js";import{$ as E,Ct as D,Dt as O,Et as k,Lt as A,Mt as j,Nn as M,Nt as Se,Pn as N,Pt as P,Q as F,St as Ce,Tt as we,X as I,Z as L,bt as R,et as z,mn as Te,un as Ee,ut as De,vt as Oe,wt as ke,xt as Ae,yt as je}from"./index-
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{AR as r,Ao as i,BR as ee,CR as te,DR as ne,Dz as re,ER as ie,FR as a,Fz as ae,GR as o,HR as oe,IR as s,Iz as se,JR as ce,KR as le,LR as c,MR as l,Mj as ue,NR as u,OR as de,PR as d,RR as fe,SR as pe,TR as f,UR as me,VR as p,WR as m,_R as h,bR as g,gR as he,hR as ge,jR as _,kR as _e,ko as ve,kz as ye,mR as be,pR as xe,qR as v,t as y,vR as b,wR as x,xR as S,yR as C,zR as w}from"./api-Cpjr7qvl.js";import{t as T}from"./button-CbwCr9Pi.js";import{$ as E,Ct as D,Dt as O,Et as k,Lt as A,Mt as j,Nn as M,Nt as Se,Pn as N,Pt as P,Q as F,St as Ce,Tt as we,X as I,Z as L,bt as R,et as z,mn as Te,un as Ee,ut as De,vt as Oe,wt as ke,xt as Ae,yt as je}from"./index-Bc3aF-kJ.js";import{a as Me,i as B,n as Ne,o as V,r as H,t as Pe}from"./table-CeTqDEfs.js";var U=t(e(),1),W=n(),G=`all`;function K(e){switch(e){case`image`:return c();case`audio`:return s();case`video`:return a();case`pdf`:return d();case`document`:return u();case`archive`:return l();default:return _()}}function q(){let[e,t]=(0,U.useState)(G),[n,a]=(0,U.useState)(G),[s,c]=(0,U.useState)(G),[l,u]=(0,U.useState)(G),[d,_]=(0,U.useState)(!1),[q,J]=(0,U.useState)(null),Fe=ae(y.files.softDelete),Y=O();function Ie(){t(G),a(G),c(G),u(G)}async function Le(){let e=q;if(J(null),e)try{await Fe({fileId:e.id}),Y.success(g())}catch(e){Y.error(C(),e)}}let X=se(y.files.listMine,{direction:e===G?void 0:e,chatId:n===G?void 0:n,instanceName:s===G?void 0:s,category:l===G?void 0:l,includeAutoGenerated:d||void 0}),Re=(0,U.useMemo)(()=>new Intl.DateTimeFormat(ye(),{dateStyle:`medium`,timeStyle:`short`}),[]);if(X===void 0)return(0,W.jsx)(`p`,{className:`oc-admin__hint`,children:re()});let{files:Z,facets:Q,truncated:ze,cap:Be}=X,$=e!==G||n!==G||s!==G||l!==G;return(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`p`,{className:`oc-admin__hint`,children:ce()}),(0,W.jsxs)(`div`,{className:`oc-files__filters`,style:{display:`flex`,flexWrap:`wrap`,gap:8,margin:`12px 0`},children:[(0,W.jsxs)(I,{value:e,onValueChange:t,children:[(0,W.jsx)(E,{size:`sm`,"aria-label":v(),children:(0,W.jsx)(z,{})}),(0,W.jsxs)(L,{children:[(0,W.jsx)(F,{value:G,children:le()}),(0,W.jsx)(F,{value:`inbound`,children:o()}),(0,W.jsx)(F,{value:`outbound`,children:m()})]})]}),(0,W.jsxs)(I,{value:n,onValueChange:a,children:[(0,W.jsx)(E,{size:`sm`,"aria-label":me(),children:(0,W.jsx)(z,{})}),(0,W.jsxs)(L,{children:[(0,W.jsx)(F,{value:G,children:oe()}),Q.chats.map(e=>(0,W.jsx)(F,{value:e.id,children:e.title},e.id))]})]}),Q.multiProvider?(0,W.jsxs)(I,{value:s,onValueChange:c,children:[(0,W.jsx)(E,{size:`sm`,"aria-label":p(),children:(0,W.jsx)(z,{})}),(0,W.jsxs)(L,{children:[(0,W.jsx)(F,{value:G,children:ee()}),Q.instances.map(e=>(0,W.jsx)(F,{value:e,children:e},e))]})]}):null,(0,W.jsxs)(I,{value:l,onValueChange:u,children:[(0,W.jsx)(E,{size:`sm`,"aria-label":w(),children:(0,W.jsx)(z,{})}),(0,W.jsxs)(L,{children:[(0,W.jsx)(F,{value:G,children:fe()}),Q.categories.map(e=>(0,W.jsx)(F,{value:e,children:K(e)},e))]})]}),(0,W.jsxs)(`label`,{className:`oc-files__autogen`,children:[(0,W.jsx)(De,{checked:d,onCheckedChange:e=>_(e===!0),"aria-label":i()}),(0,W.jsx)(`span`,{children:i()})]}),$?(0,W.jsxs)(T,{variant:`ghost`,size:`sm`,onClick:Ie,style:{display:`inline-flex`,alignItems:`center`,gap:4,marginLeft:`auto`},children:[(0,W.jsx)(Te,{size:14,"aria-hidden":!0}),te()]}):null]}),Z.length===0?(0,W.jsx)(`p`,{className:`oc-admin__hint`,children:$?be():ge()}):(0,W.jsxs)(W.Fragment,{children:[(0,W.jsxs)(Pe,{children:[(0,W.jsx)(Me,{children:(0,W.jsxs)(V,{children:[(0,W.jsx)(B,{children:r()}),(0,W.jsx)(B,{children:_e()}),(0,W.jsx)(B,{children:de()}),(0,W.jsx)(B,{children:ne()}),(0,W.jsx)(B,{children:ie()}),(0,W.jsx)(B,{className:`text-right`,children:f()})]})}),(0,W.jsx)(Ne,{children:Z.map(e=>(0,W.jsxs)(V,{children:[(0,W.jsxs)(H,{className:`font-medium`,style:{maxWidth:280,overflow:`hidden`,textOverflow:`ellipsis`},title:e.filename,children:[e.filename,e.origin===`pasted`?(0,W.jsx)(k,{variant:`outline`,style:{marginLeft:6},children:ve()}):null]}),(0,W.jsx)(H,{title:e.mimeType,children:K(e.category)}),(0,W.jsx)(H,{children:(0,W.jsx)(k,{variant:`secondary`,children:e.direction===`inbound`?o():m()})}),(0,W.jsx)(H,{style:{maxWidth:220,overflow:`hidden`,textOverflow:`ellipsis`},title:e.chatTitle,children:e.chatTitle}),(0,W.jsx)(H,{className:`whitespace-nowrap text-muted-foreground`,children:Re.format(e.createdAt)}),(0,W.jsx)(H,{className:`text-right`,children:(0,W.jsxs)(j,{children:[(0,W.jsx)(A,{asChild:!0,children:(0,W.jsx)(T,{variant:`ghost`,size:`icon`,"aria-label":pe(),children:(0,W.jsx)(M,{size:16})})}),(0,W.jsxs)(Se,{align:`end`,children:[e.url?(0,W.jsx)(P,{asChild:!0,children:(0,W.jsxs)(`a`,{href:e.url,download:e.filename,target:`_blank`,rel:`noopener noreferrer`,children:[(0,W.jsx)(N,{size:14}),x()]})}):(0,W.jsxs)(P,{disabled:!0,children:[(0,W.jsx)(N,{size:14}),he()]}),(0,W.jsxs)(P,{variant:`destructive`,onSelect:()=>J({id:e._id,filename:e.filename}),children:[(0,W.jsx)(Ee,{size:14}),S()]})]})]})})]},e._id))})]}),ze?(0,W.jsx)(`p`,{className:`oc-admin__hint`,style:{marginTop:8},children:xe({cap:Be})}):null]}),(0,W.jsx)(Oe,{open:q!==null,onOpenChange:e=>!e&&J(null),children:(0,W.jsxs)(Ae,{children:[(0,W.jsxs)(ke,{children:[(0,W.jsx)(we,{children:b()}),(0,W.jsx)(Ce,{children:h()})]}),(0,W.jsxs)(D,{children:[(0,W.jsx)(R,{children:ue()}),(0,W.jsx)(je,{onClick:()=>void Le(),children:S()})]})]})})]})}export{q as FilesTab};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Dh as r,Eh as i}from"./api-Cpjr7qvl.js";import{t as a}from"./button-CbwCr9Pi.js";import{jt as o,mn as s,pn as c}from"./index-
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Dh as r,Eh as i}from"./api-Cpjr7qvl.js";import{t as a}from"./button-CbwCr9Pi.js";import{jt as o,mn as s,pn as c}from"./index-Bc3aF-kJ.js";import{t as l}from"./TimeRangePicker-BlRNLd96.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)(o,{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)(s,{}),i()]})]})}export{p as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$f as r,Af as i,Ap as a,Bf as o,Cp as s,D as c,Df as l,Dp as u,Ef as d,Ep as f,Ff as p,Fp as m,Fz as h,Gf as g,Hf as _,If as v,Iz as y,Jf as b,Kf as x,Lf as S,Mf as C,Mp as w,Nf as T,Np as ee,Of as E,Op as D,Pf as O,Pp as k,Qf as A,Rf as j,Sp as te,Tp as ne,Uf as M,Vf as N,Wf as re,Xf as ie,Yf as ae,Zf as P,_p as F,ap as oe,bp as I,cp as se,dp as ce,ep as L,fp as le,gp as ue,hp as de,ip as fe,jf as pe,jp as me,kf as he,kp as ge,lp as _e,mp as ve,np as ye,op as R,pp as be,qf as xe,rp as Se,sp as Ce,t as z,tp as we,up as Te,vp as Ee,wp as De,xp as Oe,yp as ke,zf as Ae}from"./api-Cpjr7qvl.js";import{t as je}from"./x-Dqrt5OdW.js";import{i as B,n as V,r as Me,t as Ne}from"./tabs-Bmd8xvTL.js";import{t as H}from"./button-CbwCr9Pi.js";import{$ as Pe,Bn as Fe,Dt as U,Et as W,Q as Ie,U as Le,X as Re,Z as ze,_ as Be,at as Ve,dn as G,et as He,fn as K,jt as q,nt as Ue,ot as We,q as Ge,rt as Ke,tt as qe,ut as J,zn as Je}from"./index-c5j0e823.js";import{t as Ye}from"./FilterBar-BO7_dR0d.js";import{t as Xe}from"./DataTableShell-CW5udl6V.js";import{t as Y}from"./DetailChips-Dlt_uEHU.js";var Ze=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`}]]),Qe=c(`users`,[[`path`,{d:`M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2`,key:`1yyitq`}],[`path`,{d:`M16 3.128a4 4 0 0 1 0 7.744`,key:`16gr8j`}],[`path`,{d:`M22 21v-2a4 4 0 0 0-3-3.87`,key:`kshegd`}],[`circle`,{cx:`9`,cy:`7`,r:`4`,key:`nufk8`}]]),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 ye();case`user`:return we();case`pending`:return L();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=y(z.groups.listGroups,{}),t=y(z.me.getMe,{host:Ge})?.role===`admin`,n=h(z.groups.createGroup),r=h(z.groups.updateGroup),i=h(z.groups.deleteGroup),o=Le(),c=U(),[l,d]=(0,Z.useState)(!1),[p,g]=(0,Z.useState)(null),[_,v]=(0,Z.useState)($),[b,x]=(0,Z.useState)(null),[S,C]=(0,Z.useState)(``),T=(0,Z.useMemo)(()=>{if(!e)return e;let t=S.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,S]);function O(){g(null),v($),d(!0)}function A(e){g(e),v({name:e.name,description:e.description??``}),d(!0)}async function j(){try{p?await r({groupId:p._id,name:_.name,description:_.description}):await n({name:_.name,description:_.description||void 0}),v($),g(null),d(!1)}catch(e){c.error(he(),e)}}async function M(e){if(await o({title:ue({name:e.name}),description:de(),confirmWord:e.name,confirmLabel:ve(),cancelLabel:te(),destructive:!0}))try{await i({groupId:e._id})}catch(e){c.error(E(),e)}}return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:k()}),(0,Q.jsx)(Ye,{q:S,onQChange:C,onReset:()=>C(``),canReset:S!==``,searchPlaceholder:u()}),(0,Q.jsx)(Xe,{title:m(),rows:T,addLabel:ee(),onAdd:t?O:void 0,emptyHint:w(),columns:[{header:me(),cell:e=>e.name,sort:e=>e.name},{header:a(),cell:e=>(0,Q.jsx)(Y,{icon:(0,Q.jsx)(Qe,{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:ge(),cell:e=>(0,Q.jsx)(Y,{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:D(),cell:e=>(0,Q.jsx)(Y,{icon:(0,Q.jsx)(Ze,{size:12,"aria-hidden":!0}),total:e.chartCount,items:e.charts.map(e=>({label:e.name,marker:e.isDefault?(0,Q.jsx)(G,{size:11,fill:`currentColor`,"aria-hidden":!0}):null,highlight:e.isDefault}))}),sort:e=>e.chartCount}],rowActions:e=>[{label:f(),onSelect:()=>x({groupId:e._id,name:e.name})},...t?[{label:ne(),onSelect:()=>A(e)},{label:De(),variant:`destructive`,onSelect:()=>void M(e)}]:[]]}),(0,Q.jsx)(Be,{open:l,onOpenChange:d,title:p?I():Oe(),description:ke(),canSubmit:!!_.name.trim(),onSubmit:j,submitLabel:s(),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:Ee()}),(0,Q.jsx)(q,{value:_.name,onChange:e=>v({..._,name:e.target.value})})]}),(0,Q.jsxs)(`label`,{className:`oc-field`,children:[(0,Q.jsx)(`span`,{className:`oc-field__label`,children:F()}),(0,Q.jsx)(q,{value:_.description,onChange:e=>v({..._,description:e.target.value})})]})]})}),(0,Q.jsx)(ct,{groupId:b?.groupId??null,groupName:b?.name??``,open:b!==null,onOpenChange:e=>{e||x(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)(H,{type:`button`,variant:`ghost`,size:`sm`,disabled:e<=1,onClick:()=>n(e-1),children:[(0,Q.jsx)(Fe,{size:14,"aria-hidden":!0}),oe()]}),(0,Q.jsxs)(`span`,{className:`oc-access__pageinfo`,"aria-label":Se({page:e,pages:t}),children:[e,` / `,t]}),(0,Q.jsxs)(H,{type:`button`,variant:`ghost`,size:`sm`,disabled:e>=t,onClick:()=>n(e+1),children:[fe(),(0,Q.jsx)(Je,{size:14,"aria-hidden":!0})]})]})}function ct({groupId:e,groupName:t,open:n,onOpenChange:i}){let a=y(z.groups.getGroup,n&&e?{groupId:e}:`skip`),o=y(z.groups.listAssignableInstances,n?{}:`skip`),s=y(z.groups.listAssignableUsers,n?{}:`skip`),c=h(z.groups.addMember),u=h(z.groups.removeMember),d=h(z.groups.bulkSetMembers),f=h(z.groups.setGroupManager),p=U(),[m,g]=(0,Z.useState)(``),[v,x]=(0,Z.useState)(``),[S,w]=(0,Z.useState)(`members`),[ee,E]=(0,Z.useState)(1),[D,k]=(0,Z.useState)(new Set),A=(0,Z.useRef)(null),j=(0,Z.useMemo)(()=>new Set((a?.members??[]).map(e=>e.userId)),[a]),te=(0,Z.useMemo)(()=>new Set((a?.members??[]).filter(e=>e.manager).map(e=>e.userId)),[a]),ne=a?.viewerIsAdmin===!0,M=(0,Z.useMemo)(()=>new Set((a?.agents??[]).map(e=>`${e.instanceName}/${e.agentId}`)),[a]);(0,Z.useEffect)(()=>{g(``),x(``),w(`members`),E(1),A.current=null},[n,e]),(0,Z.useEffect)(()=>{E(1)},[m]),(0,Z.useEffect)(()=>{n&&a&&e&&A.current!==e&&(A.current=e,k(new Set((a.members??[]).map(e=>e.userId))))},[n,a,e]);let N=(0,Z.useMemo)(()=>s?$e(s,m,D):[],[s,m,D]);async function re(t,n){if(e)try{n?await u({groupId:e,userId:t}):await c({groupId:e,userId:t})}catch(e){p.error(l(),e)}}async function ie(t,n){if(e)try{await f({groupId:e,userId:t,manager:!n})}catch(e){p.error(pe(),e)}}let F=rt(N,e=>j.has(e.userId)),oe=N.filter(e=>j.has(e.userId)).length,I=it(N,ee,ot);async function L(){if(!e||N.length===0)return;let t=N.map(e=>e.userId);try{await d({groupId:e,userIds:t,member:F!==`all`})}catch(e){p.error(l(),e)}}return(0,Q.jsx)(qe,{open:n,onOpenChange:i,children:(0,Q.jsxs)(Ue,{className:`oc-access`,children:[(0,Q.jsxs)(Ve,{children:[(0,Q.jsx)(We,{children:be({name:t})}),(0,Q.jsx)(Ke,{children:le()})]}),(0,Q.jsxs)(Ne,{value:S,onValueChange:w,className:`oc-access__tabs`,children:[(0,Q.jsxs)(Me,{className:`w-full`,children:[(0,Q.jsxs)(B,{value:`members`,className:`flex-1 gap-1.5`,children:[(0,Q.jsx)(Qe,{size:13,"aria-hidden":!0}),ce(),a?(0,Q.jsx)(W,{variant:`secondary`,className:`oc-access__tabcount`,children:j.size}):null]}),(0,Q.jsxs)(B,{value:`agents`,className:`flex-1 gap-1.5`,children:[(0,Q.jsx)(K,{size:13,"aria-hidden":!0}),_e(),a?(0,Q.jsx)(W,{variant:`secondary`,className:`oc-access__tabcount`,children:M.size}):null]}),(0,Q.jsxs)(B,{value:`charts`,className:`flex-1 gap-1.5`,children:[(0,Q.jsx)(Ze,{size:13,"aria-hidden":!0}),_(),a?(0,Q.jsx)(W,{variant:`secondary`,className:`oc-access__tabcount`,children:a.chartCount}):null]})]}),(0,Q.jsx)(V,{value:`members`,children:s===void 0||a===void 0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:P()}):s.length===0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:ae()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(q,{value:m,onChange:e=>g(e.target.value),placeholder:Te(),className:`oc-access__search`}),N.length===0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:Ce()}):(0,Q.jsxs)(Q.Fragment,{children:[N.length>1?(0,Q.jsxs)(`div`,{className:`oc-access__row oc-access__selectall`,children:[(0,Q.jsx)(J,{checked:F===`all`?!0:F===`some`?`indeterminate`:!1,onCheckedChange:()=>void L(),"aria-label":R()}),(0,Q.jsx)(`span`,{className:`oc-access__label`,children:R()}),(0,Q.jsxs)(W,{variant:`outline`,className:`oc-access__count`,children:[oe,` / `,N.length]})]}):null,(0,Q.jsx)(`div`,{className:`oc-access__list`,children:I.pageItems.map(e=>{let t=j.has(e.userId),n=tt(e),i=te.has(e.userId);return(0,Q.jsxs)(`div`,{className:`oc-access__row`,children:[(0,Q.jsx)(J,{checked:t,onCheckedChange:()=>void re(e.userId,t),"aria-label":r({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)(W,{variant:`outline`,className:`oc-access__role`,children:nt(e.role)}),(0,Q.jsx)(`span`,{className:`oc-access__mgrslot`,children:t&&ne?(0,Q.jsx)(H,{type:`button`,variant:`ghost`,size:`icon`,className:`shrink-0 oc-access__mgr${i?` oc-access__mgr--on`:``}`,"aria-pressed":i,"aria-label":i?C():T(),title:i?C():T(),onClick:()=>void ie(e.userId,i),children:(0,Q.jsx)(X,{size:15,"aria-hidden":!0})}):t&&i?(0,Q.jsx)(`span`,{className:`oc-access__mgr oc-access__mgr--on`,role:`img`,"aria-label":O(),title:O(),children:(0,Q.jsx)(X,{size:15,"aria-hidden":!0})}):null})]},e._id)})}),(0,Q.jsx)(st,{page:I.page,pageCount:I.pageCount,onPage:E})]})]})}),(0,Q.jsx)(V,{value:`agents`,children:o===void 0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:P()}):o.length===0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:b()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(q,{value:v,onChange:e=>x(e.target.value),placeholder:se(),className:`oc-access__search`}),(0,Q.jsx)(`div`,{className:`oc-access__list`,children:o.map(t=>(0,Q.jsx)(lt,{groupId:e,instanceName:t.name,kind:t.kind??`openclaw`,assigned:M,query:v},`${e}-${t._id}`))})]})}),(0,Q.jsx)(V,{value:`charts`,children:(0,Q.jsx)(ut,{groupId:e})})]})]})})}function lt({groupId:e,instanceName:t,kind:n,assigned:r,query:i}){let a=y(z.groups.listAssignableAgents,{instanceName:t}),o=h(z.groups.assignAgentToGroup),s=h(z.groups.removeAgentFromGroup),c=h(z.groups.bulkSetGroupAgents),l=U(),[u,f]=(0,Z.useState)(1);if((0,Z.useEffect)(()=>{f(1)},[i]),!e)return null;let p=et(a?.agents??[],i),m=a?.discovery&&!a.discovery.lastPollOk;if(i.trim()&&p.length===0)return null;let _=p.filter(e=>e.presentInLastOk!==!1&&e.enabled!==!1),v=rt(_,e=>r.has(`${t}/${e.agentId}`)),b=it(p,u,ot);async function S(n,r){try{r?await s({groupId:e,instanceName:t,agentId:n}):await o({groupId:e,instanceName:t,agentId:n})}catch(e){l.error(d(),e)}}async function C(){if(_.length===0)return;let n=_.map(e=>e.agentId);try{await c({groupId:e,instanceName:t,agentIds:n,assigned:v!==`all`})}catch(e){l.error(d(),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)(W,{variant:`outline`,className:`oc-access__kind`,children:n}),m?(0,Q.jsx)(W,{variant:`outline`,className:`oc-access__stale`,children:g()}):null]}),a===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?x():xe()}):(0,Q.jsxs)(Q.Fragment,{children:[_.length>1?(0,Q.jsxs)(`div`,{className:`oc-access__row oc-access__selectall`,children:[(0,Q.jsx)(J,{checked:v===`all`?!0:v===`some`?`indeterminate`:!1,onCheckedChange:()=>void C(),"aria-label":R()}),(0,Q.jsx)(`span`,{className:`oc-access__label`,children:R()})]}):null,b.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)(J,{checked:i,disabled:(a||o)&&!i,onCheckedChange:()=>void S(e.agentId,i),"aria-label":A({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":M(),title:M(),children:(0,Q.jsx)(G,{size:14,fill:`currentColor`})}):null,a?(0,Q.jsx)(W,{variant:`outline`,className:`oc-access__gone`,children:re()}):null]},e.agentId)}),(0,Q.jsx)(st,{page:b.page,pageCount:b.pageCount,onPage:f})]})]})}function ut({groupId:e}){let t=y(z.charts.listGroupChartSelection,e?{groupId:e}:`skip`),n=h(z.charts.assignChartToGroup),r=h(z.charts.removeChartFromGroup),a=h(z.charts.setGroupDefaultChart),s=h(z.charts.addChartToGroupPool),c=h(z.charts.removeChartFromGroupPool),l=U();if(!e)return null;if(t===void 0)return(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:P()});let{pool:u,addable:d,canManagePool:f}=t;if(u.length===0&&!f)return(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:N()});async function m(t,a){try{a?await r({groupId:e,chartKey:t}):await n({groupId:e,chartKey:t})}catch(e){l.error(i(),e)}}async function g(t){try{await a({groupId:e,chartKey:t})}catch(e){l.error(i(),e)}}async function _(t){try{await s({groupId:e,chartKey:t})}catch(e){l.error(i(),e)}}async function b(t){try{await c({groupId:e,chartKey:t})}catch(e){l.error(i(),e)}}return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`div`,{className:`oc-access__list`,children:u.map(e=>(0,Q.jsxs)(`div`,{className:`oc-access__row`,children:[(0,Q.jsx)(J,{checked:e.selected,onCheckedChange:()=>void m(e.chartKey,e.selected),"aria-label":S({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":v(),title:v(),children:(0,Q.jsx)(G,{size:14,fill:`currentColor`})}):(0,Q.jsx)(H,{type:`button`,variant:`ghost`,size:`sm`,onClick:()=>void g(e.chartKey),children:p()}):null,f?(0,Q.jsx)(H,{type:`button`,variant:`ghost`,size:`sm`,"aria-label":j({name:e.name}),title:j({name:e.name}),onClick:()=>void b(e.chartKey),children:(0,Q.jsx)(je,{size:14,"aria-hidden":!0})}):null]},e.chartKey))}),f?d.length>0?(0,Q.jsxs)(Re,{value:``,onValueChange:e=>void _(e),children:[(0,Q.jsx)(Pe,{size:`sm`,className:`oc-access__search`,children:(0,Q.jsx)(He,{placeholder:Ae()})}),(0,Q.jsx)(ze,{children:d.map(e=>(0,Q.jsx)(Ie,{value:e.chartKey,children:e.name},e.chartKey))})]}):u.length===0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:o()}):null:null]})}export{at as GroupsTab};
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$f as r,Af as i,Ap as a,Bf as o,Cp as s,D as c,Df as l,Dp as u,Ef as d,Ep as f,Ff as p,Fp as m,Fz as h,Gf as g,Hf as _,If as v,Iz as y,Jf as b,Kf as x,Lf as S,Mf as C,Mp as w,Nf as T,Np as ee,Of as E,Op as D,Pf as O,Pp as k,Qf as A,Rf as j,Sp as te,Tp as ne,Uf as M,Vf as N,Wf as re,Xf as ie,Yf as ae,Zf as P,_p as F,ap as oe,bp as I,cp as se,dp as ce,ep as L,fp as le,gp as ue,hp as de,ip as fe,jf as pe,jp as me,kf as he,kp as ge,lp as _e,mp as ve,np as ye,op as R,pp as be,qf as xe,rp as Se,sp as Ce,t as z,tp as we,up as Te,vp as Ee,wp as De,xp as Oe,yp as ke,zf as Ae}from"./api-Cpjr7qvl.js";import{t as je}from"./x-Dqrt5OdW.js";import{i as B,n as V,r as Me,t as Ne}from"./tabs-DHs6yOVA.js";import{t as H}from"./button-CbwCr9Pi.js";import{$ as Pe,Bn as Fe,Dt as U,Et as W,Q as Ie,U as Le,X as Re,Z as ze,_ as Be,at as Ve,dn as G,et as He,fn as K,jt as q,nt as Ue,ot as We,q as Ge,rt as Ke,tt as qe,ut as J,zn as Je}from"./index-Bc3aF-kJ.js";import{t as Ye}from"./FilterBar-FHDxb3k3.js";import{t as Xe}from"./DataTableShell-DWXPn72S.js";import{t as Y}from"./DetailChips-D6mdBUOT.js";var Ze=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`}]]),Qe=c(`users`,[[`path`,{d:`M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2`,key:`1yyitq`}],[`path`,{d:`M16 3.128a4 4 0 0 1 0 7.744`,key:`16gr8j`}],[`path`,{d:`M22 21v-2a4 4 0 0 0-3-3.87`,key:`kshegd`}],[`circle`,{cx:`9`,cy:`7`,r:`4`,key:`nufk8`}]]),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 ye();case`user`:return we();case`pending`:return L();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=y(z.groups.listGroups,{}),t=y(z.me.getMe,{host:Ge})?.role===`admin`,n=h(z.groups.createGroup),r=h(z.groups.updateGroup),i=h(z.groups.deleteGroup),o=Le(),c=U(),[l,d]=(0,Z.useState)(!1),[p,g]=(0,Z.useState)(null),[_,v]=(0,Z.useState)($),[b,x]=(0,Z.useState)(null),[S,C]=(0,Z.useState)(``),T=(0,Z.useMemo)(()=>{if(!e)return e;let t=S.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,S]);function O(){g(null),v($),d(!0)}function A(e){g(e),v({name:e.name,description:e.description??``}),d(!0)}async function j(){try{p?await r({groupId:p._id,name:_.name,description:_.description}):await n({name:_.name,description:_.description||void 0}),v($),g(null),d(!1)}catch(e){c.error(he(),e)}}async function M(e){if(await o({title:ue({name:e.name}),description:de(),confirmWord:e.name,confirmLabel:ve(),cancelLabel:te(),destructive:!0}))try{await i({groupId:e._id})}catch(e){c.error(E(),e)}}return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:k()}),(0,Q.jsx)(Ye,{q:S,onQChange:C,onReset:()=>C(``),canReset:S!==``,searchPlaceholder:u()}),(0,Q.jsx)(Xe,{title:m(),rows:T,addLabel:ee(),onAdd:t?O:void 0,emptyHint:w(),columns:[{header:me(),cell:e=>e.name,sort:e=>e.name},{header:a(),cell:e=>(0,Q.jsx)(Y,{icon:(0,Q.jsx)(Qe,{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:ge(),cell:e=>(0,Q.jsx)(Y,{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:D(),cell:e=>(0,Q.jsx)(Y,{icon:(0,Q.jsx)(Ze,{size:12,"aria-hidden":!0}),total:e.chartCount,items:e.charts.map(e=>({label:e.name,marker:e.isDefault?(0,Q.jsx)(G,{size:11,fill:`currentColor`,"aria-hidden":!0}):null,highlight:e.isDefault}))}),sort:e=>e.chartCount}],rowActions:e=>[{label:f(),onSelect:()=>x({groupId:e._id,name:e.name})},...t?[{label:ne(),onSelect:()=>A(e)},{label:De(),variant:`destructive`,onSelect:()=>void M(e)}]:[]]}),(0,Q.jsx)(Be,{open:l,onOpenChange:d,title:p?I():Oe(),description:ke(),canSubmit:!!_.name.trim(),onSubmit:j,submitLabel:s(),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:Ee()}),(0,Q.jsx)(q,{value:_.name,onChange:e=>v({..._,name:e.target.value})})]}),(0,Q.jsxs)(`label`,{className:`oc-field`,children:[(0,Q.jsx)(`span`,{className:`oc-field__label`,children:F()}),(0,Q.jsx)(q,{value:_.description,onChange:e=>v({..._,description:e.target.value})})]})]})}),(0,Q.jsx)(ct,{groupId:b?.groupId??null,groupName:b?.name??``,open:b!==null,onOpenChange:e=>{e||x(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)(H,{type:`button`,variant:`ghost`,size:`sm`,disabled:e<=1,onClick:()=>n(e-1),children:[(0,Q.jsx)(Fe,{size:14,"aria-hidden":!0}),oe()]}),(0,Q.jsxs)(`span`,{className:`oc-access__pageinfo`,"aria-label":Se({page:e,pages:t}),children:[e,` / `,t]}),(0,Q.jsxs)(H,{type:`button`,variant:`ghost`,size:`sm`,disabled:e>=t,onClick:()=>n(e+1),children:[fe(),(0,Q.jsx)(Je,{size:14,"aria-hidden":!0})]})]})}function ct({groupId:e,groupName:t,open:n,onOpenChange:i}){let a=y(z.groups.getGroup,n&&e?{groupId:e}:`skip`),o=y(z.groups.listAssignableInstances,n?{}:`skip`),s=y(z.groups.listAssignableUsers,n?{}:`skip`),c=h(z.groups.addMember),u=h(z.groups.removeMember),d=h(z.groups.bulkSetMembers),f=h(z.groups.setGroupManager),p=U(),[m,g]=(0,Z.useState)(``),[v,x]=(0,Z.useState)(``),[S,w]=(0,Z.useState)(`members`),[ee,E]=(0,Z.useState)(1),[D,k]=(0,Z.useState)(new Set),A=(0,Z.useRef)(null),j=(0,Z.useMemo)(()=>new Set((a?.members??[]).map(e=>e.userId)),[a]),te=(0,Z.useMemo)(()=>new Set((a?.members??[]).filter(e=>e.manager).map(e=>e.userId)),[a]),ne=a?.viewerIsAdmin===!0,M=(0,Z.useMemo)(()=>new Set((a?.agents??[]).map(e=>`${e.instanceName}/${e.agentId}`)),[a]);(0,Z.useEffect)(()=>{g(``),x(``),w(`members`),E(1),A.current=null},[n,e]),(0,Z.useEffect)(()=>{E(1)},[m]),(0,Z.useEffect)(()=>{n&&a&&e&&A.current!==e&&(A.current=e,k(new Set((a.members??[]).map(e=>e.userId))))},[n,a,e]);let N=(0,Z.useMemo)(()=>s?$e(s,m,D):[],[s,m,D]);async function re(t,n){if(e)try{n?await u({groupId:e,userId:t}):await c({groupId:e,userId:t})}catch(e){p.error(l(),e)}}async function ie(t,n){if(e)try{await f({groupId:e,userId:t,manager:!n})}catch(e){p.error(pe(),e)}}let F=rt(N,e=>j.has(e.userId)),oe=N.filter(e=>j.has(e.userId)).length,I=it(N,ee,ot);async function L(){if(!e||N.length===0)return;let t=N.map(e=>e.userId);try{await d({groupId:e,userIds:t,member:F!==`all`})}catch(e){p.error(l(),e)}}return(0,Q.jsx)(qe,{open:n,onOpenChange:i,children:(0,Q.jsxs)(Ue,{className:`oc-access`,children:[(0,Q.jsxs)(Ve,{children:[(0,Q.jsx)(We,{children:be({name:t})}),(0,Q.jsx)(Ke,{children:le()})]}),(0,Q.jsxs)(Ne,{value:S,onValueChange:w,className:`oc-access__tabs`,children:[(0,Q.jsxs)(Me,{className:`w-full`,children:[(0,Q.jsxs)(B,{value:`members`,className:`flex-1 gap-1.5`,children:[(0,Q.jsx)(Qe,{size:13,"aria-hidden":!0}),ce(),a?(0,Q.jsx)(W,{variant:`secondary`,className:`oc-access__tabcount`,children:j.size}):null]}),(0,Q.jsxs)(B,{value:`agents`,className:`flex-1 gap-1.5`,children:[(0,Q.jsx)(K,{size:13,"aria-hidden":!0}),_e(),a?(0,Q.jsx)(W,{variant:`secondary`,className:`oc-access__tabcount`,children:M.size}):null]}),(0,Q.jsxs)(B,{value:`charts`,className:`flex-1 gap-1.5`,children:[(0,Q.jsx)(Ze,{size:13,"aria-hidden":!0}),_(),a?(0,Q.jsx)(W,{variant:`secondary`,className:`oc-access__tabcount`,children:a.chartCount}):null]})]}),(0,Q.jsx)(V,{value:`members`,children:s===void 0||a===void 0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:P()}):s.length===0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:ae()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(q,{value:m,onChange:e=>g(e.target.value),placeholder:Te(),className:`oc-access__search`}),N.length===0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:Ce()}):(0,Q.jsxs)(Q.Fragment,{children:[N.length>1?(0,Q.jsxs)(`div`,{className:`oc-access__row oc-access__selectall`,children:[(0,Q.jsx)(J,{checked:F===`all`?!0:F===`some`?`indeterminate`:!1,onCheckedChange:()=>void L(),"aria-label":R()}),(0,Q.jsx)(`span`,{className:`oc-access__label`,children:R()}),(0,Q.jsxs)(W,{variant:`outline`,className:`oc-access__count`,children:[oe,` / `,N.length]})]}):null,(0,Q.jsx)(`div`,{className:`oc-access__list`,children:I.pageItems.map(e=>{let t=j.has(e.userId),n=tt(e),i=te.has(e.userId);return(0,Q.jsxs)(`div`,{className:`oc-access__row`,children:[(0,Q.jsx)(J,{checked:t,onCheckedChange:()=>void re(e.userId,t),"aria-label":r({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)(W,{variant:`outline`,className:`oc-access__role`,children:nt(e.role)}),(0,Q.jsx)(`span`,{className:`oc-access__mgrslot`,children:t&&ne?(0,Q.jsx)(H,{type:`button`,variant:`ghost`,size:`icon`,className:`shrink-0 oc-access__mgr${i?` oc-access__mgr--on`:``}`,"aria-pressed":i,"aria-label":i?C():T(),title:i?C():T(),onClick:()=>void ie(e.userId,i),children:(0,Q.jsx)(X,{size:15,"aria-hidden":!0})}):t&&i?(0,Q.jsx)(`span`,{className:`oc-access__mgr oc-access__mgr--on`,role:`img`,"aria-label":O(),title:O(),children:(0,Q.jsx)(X,{size:15,"aria-hidden":!0})}):null})]},e._id)})}),(0,Q.jsx)(st,{page:I.page,pageCount:I.pageCount,onPage:E})]})]})}),(0,Q.jsx)(V,{value:`agents`,children:o===void 0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:P()}):o.length===0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:b()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(q,{value:v,onChange:e=>x(e.target.value),placeholder:se(),className:`oc-access__search`}),(0,Q.jsx)(`div`,{className:`oc-access__list`,children:o.map(t=>(0,Q.jsx)(lt,{groupId:e,instanceName:t.name,kind:t.kind??`openclaw`,assigned:M,query:v},`${e}-${t._id}`))})]})}),(0,Q.jsx)(V,{value:`charts`,children:(0,Q.jsx)(ut,{groupId:e})})]})]})})}function lt({groupId:e,instanceName:t,kind:n,assigned:r,query:i}){let a=y(z.groups.listAssignableAgents,{instanceName:t}),o=h(z.groups.assignAgentToGroup),s=h(z.groups.removeAgentFromGroup),c=h(z.groups.bulkSetGroupAgents),l=U(),[u,f]=(0,Z.useState)(1);if((0,Z.useEffect)(()=>{f(1)},[i]),!e)return null;let p=et(a?.agents??[],i),m=a?.discovery&&!a.discovery.lastPollOk;if(i.trim()&&p.length===0)return null;let _=p.filter(e=>e.presentInLastOk!==!1&&e.enabled!==!1),v=rt(_,e=>r.has(`${t}/${e.agentId}`)),b=it(p,u,ot);async function S(n,r){try{r?await s({groupId:e,instanceName:t,agentId:n}):await o({groupId:e,instanceName:t,agentId:n})}catch(e){l.error(d(),e)}}async function C(){if(_.length===0)return;let n=_.map(e=>e.agentId);try{await c({groupId:e,instanceName:t,agentIds:n,assigned:v!==`all`})}catch(e){l.error(d(),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)(W,{variant:`outline`,className:`oc-access__kind`,children:n}),m?(0,Q.jsx)(W,{variant:`outline`,className:`oc-access__stale`,children:g()}):null]}),a===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?x():xe()}):(0,Q.jsxs)(Q.Fragment,{children:[_.length>1?(0,Q.jsxs)(`div`,{className:`oc-access__row oc-access__selectall`,children:[(0,Q.jsx)(J,{checked:v===`all`?!0:v===`some`?`indeterminate`:!1,onCheckedChange:()=>void C(),"aria-label":R()}),(0,Q.jsx)(`span`,{className:`oc-access__label`,children:R()})]}):null,b.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)(J,{checked:i,disabled:(a||o)&&!i,onCheckedChange:()=>void S(e.agentId,i),"aria-label":A({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":M(),title:M(),children:(0,Q.jsx)(G,{size:14,fill:`currentColor`})}):null,a?(0,Q.jsx)(W,{variant:`outline`,className:`oc-access__gone`,children:re()}):null]},e.agentId)}),(0,Q.jsx)(st,{page:b.page,pageCount:b.pageCount,onPage:f})]})]})}function ut({groupId:e}){let t=y(z.charts.listGroupChartSelection,e?{groupId:e}:`skip`),n=h(z.charts.assignChartToGroup),r=h(z.charts.removeChartFromGroup),a=h(z.charts.setGroupDefaultChart),s=h(z.charts.addChartToGroupPool),c=h(z.charts.removeChartFromGroupPool),l=U();if(!e)return null;if(t===void 0)return(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:P()});let{pool:u,addable:d,canManagePool:f}=t;if(u.length===0&&!f)return(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:N()});async function m(t,a){try{a?await r({groupId:e,chartKey:t}):await n({groupId:e,chartKey:t})}catch(e){l.error(i(),e)}}async function g(t){try{await a({groupId:e,chartKey:t})}catch(e){l.error(i(),e)}}async function _(t){try{await s({groupId:e,chartKey:t})}catch(e){l.error(i(),e)}}async function b(t){try{await c({groupId:e,chartKey:t})}catch(e){l.error(i(),e)}}return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`div`,{className:`oc-access__list`,children:u.map(e=>(0,Q.jsxs)(`div`,{className:`oc-access__row`,children:[(0,Q.jsx)(J,{checked:e.selected,onCheckedChange:()=>void m(e.chartKey,e.selected),"aria-label":S({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":v(),title:v(),children:(0,Q.jsx)(G,{size:14,fill:`currentColor`})}):(0,Q.jsx)(H,{type:`button`,variant:`ghost`,size:`sm`,onClick:()=>void g(e.chartKey),children:p()}):null,f?(0,Q.jsx)(H,{type:`button`,variant:`ghost`,size:`sm`,"aria-label":j({name:e.name}),title:j({name:e.name}),onClick:()=>void b(e.chartKey),children:(0,Q.jsx)(je,{size:14,"aria-hidden":!0})}):null]},e.chartKey))}),f?d.length>0?(0,Q.jsxs)(Re,{value:``,onValueChange:e=>void _(e),children:[(0,Q.jsx)(Pe,{size:`sm`,className:`oc-access__search`,children:(0,Q.jsx)(He,{placeholder:Ae()})}),(0,Q.jsx)(ze,{children:d.map(e=>(0,Q.jsx)(Ie,{value:e.chartKey,children:e.name},e.chartKey))})]}):u.length===0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:o()}):null:null]})}export{at as GroupsTab};
|