@lacneu/atrium 0.92.0 → 0.93.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-DKJU-_hz.js → AccessTab-e1oO1Kpt.js} +1 -1
- package/dist/assets/{AdvancedFilter-C7XqTAMl.js → AdvancedFilter-C5uNd2Bh.js} +1 -1
- package/dist/assets/{AgentFilesTab-BsF4j8qR.js → AgentFilesTab-CVPwLabk.js} +1 -1
- package/dist/assets/{AnomaliesTab-CtyHpztC.js → AnomaliesTab-CMpr27cm.js} +1 -1
- package/dist/assets/{AuditTab-YmkHEXMG.js → AuditTab-DnmCZyK0.js} +1 -1
- package/dist/assets/{BridgeTab-Bho32vj-.js → BridgeTab-jBNctrlU.js} +1 -1
- package/dist/assets/{ChatDefaultsTab-BhEMPeCb.js → ChatDefaultsTab-B1R8mNGT.js} +1 -1
- package/dist/assets/{DataTableShell-BWA2-Ivb.js → DataTableShell-DwnJt663.js} +1 -1
- package/dist/assets/{DeletedChatsTab-Dcc_YQyR.js → DeletedChatsTab-CUYou45F.js} +1 -1
- package/dist/assets/{DetailChips-Dli6HIcf.js → DetailChips-Bqvq37y3.js} +1 -1
- package/dist/assets/{FeedbacksTab-C-7Vx3_0.js → FeedbacksTab-kXnXbbVP.js} +1 -1
- package/dist/assets/{FieldLabel-R6-VrEew.js → FieldLabel-By4I98vO.js} +1 -1
- package/dist/assets/{FilesTab-CWquCH-x.js → FilesTab-KT8K2maS.js} +1 -1
- package/dist/assets/{FilterBar-GpmG3LXq.js → FilterBar-CF8kYMRM.js} +1 -1
- package/dist/assets/{GroupsTab-DNB4lZxZ.js → GroupsTab-DSSQpFHq.js} +1 -1
- package/dist/assets/{InstancesTab-DUFfYSEP.js → InstancesTab-B1Y94Uie.js} +1 -1
- package/dist/assets/{IntegrationsTab-C7mo7rYT.js → IntegrationsTab-TSHIMAL3.js} +1 -1
- package/dist/assets/{KpiTab-DzpJbWAN.js → KpiTab-togCNUmK.js} +1 -1
- package/dist/assets/{PreferencesTab-_WBT7GO7.js → PreferencesTab-1S_si1gy.js} +1 -1
- package/dist/assets/{ProjectPage-BRlqfsXm.js → ProjectPage-B9JozdRF.js} +1 -1
- package/dist/assets/{PromptInjectionsTab-BATtRFTd.js → PromptInjectionsTab-CghQSVr3.js} +1 -1
- package/dist/assets/{RolesTab-LiL5mTfR.js → RolesTab-3XteVLq6.js} +1 -1
- package/dist/assets/{ScheduledTab-Dtl9qTpo.js → ScheduledTab-DrVTzZOx.js} +1 -1
- package/dist/assets/{ServiceAccountsTab-Bn7bX9yn.js → ServiceAccountsTab-D05m7KHe.js} +1 -1
- package/dist/assets/{SubAgentReportsTab-CS-0rZu1.js → SubAgentReportsTab-CVjHV3k3.js} +1 -1
- package/dist/assets/{ThemeShowroom-BBRqkAlD.js → ThemeShowroom-ClbTxkxV.js} +1 -1
- package/dist/assets/{TimeRangePicker-BJl3LvfS.js → TimeRangePicker-CJYL4VHt.js} +1 -1
- package/dist/assets/{TimezoneCombobox-DEMIr-gM.js → TimezoneCombobox-aXaP7rD1.js} +1 -1
- package/dist/assets/{TracesTab-dNWgfXrZ.js → TracesTab-BK8h5goK.js} +1 -1
- package/dist/assets/{TrashTab-Buil_qUm.js → TrashTab-DGhhw1nk.js} +1 -1
- package/dist/assets/{UsersTab-riYL97bU.js → UsersTab-DTJ_fACy.js} +1 -1
- package/dist/assets/{VoiceTab-wrqfsEqI.js → VoiceTab-3l8kseDh.js} +1 -1
- package/dist/assets/{highlighted-body-OFNGDK62-BEFaauQL.js → highlighted-body-OFNGDK62-VwnHPenC.js} +1 -1
- package/dist/assets/{index-BK3dOjJU.js → index-BcCFgPG0.js} +6 -6
- package/dist/assets/mermaid-GHXKKRXX-D9U6tQ7N.js +1 -0
- package/dist/assets/{pdf-D0Nz3vEj.js → pdf-Bd95xs3Y.js} +1 -1
- package/dist/assets/{trashPage-B8Y9_v2r.js → trashPage-BqqZxj7Y.js} +1 -1
- package/dist/index.html +1 -1
- package/package.json +1 -1
- package/dist/assets/mermaid-GHXKKRXX-W_rUq8E_.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$b as r,NY as i,Qb as a,UY as o,Zb as s,ax as c,cx as l,dx as u,ex as d,ix as f,lx as p,nx as m,ox as h,rx as g,sx as _,t as v,tx as y,ux as b}from"./api-Da6_RPKW.js";import{Jt as x,St as S,bt as C,vt as w,xt as T,yt as E}from"./index-
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$b as r,NY as i,Qb as a,UY as o,Zb as s,ax as c,cx as l,dx as u,ex as d,ix as f,lx as p,nx as m,ox as h,rx as g,sx as _,t as v,tx as y,ux as b}from"./api-Da6_RPKW.js";import{Jt as x,St as S,bt as C,vt as w,xt as T,yt as E}from"./index-BcCFgPG0.js";var D=t(e(),1);function O(e){return e===`user`?y():e===`all`?d():r({group:e.group})}function k(e){return e===`common`?a():e===`owner`?s():r({group:e.group})}var A=n();function j(e){return e.name||e.email||e.userId.slice(0,8)}function M(){let e=o(v.admin.listUsers,{}),[t,n]=(0,D.useState)(``),r=o(v.introspect.introspectUser,t?{userId:t}:`skip`);return(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:u()}),(0,A.jsxs)(w,{value:t,onValueChange:n,children:[(0,A.jsx)(T,{size:`sm`,"aria-label":b(),children:(0,A.jsx)(S,{placeholder:b()})}),(0,A.jsx)(E,{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:p()}):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:l()}),(0,A.jsxs)(`div`,{className:`oc-introspect__id`,children:[(0,A.jsx)(`strong`,{children:r.user.label}),(0,A.jsx)(x,{variant:`secondary`,children:r.role})]})]}),(0,A.jsxs)(`section`,{className:`oc-introspect__section`,children:[(0,A.jsx)(`h3`,{className:`oc-introspect__title`,children:_()}),r.groups.length===0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:g()}):(0,A.jsx)(`div`,{className:`oc-introspect__chips`,children:r.groups.map(e=>(0,A.jsx)(x,{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:h()}),r.agents.length===0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:g()}):(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)(x,{variant:`default`,children:m()}):null,(0,A.jsx)(x,{variant:`outline`,children:O(e.via)}),(0,A.jsx)(x,{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:c()}),r.charts.length===0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:g()}):(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)(x,{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:f()}),r.permissions.length===0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:g()}):(0,A.jsx)(`div`,{className:`oc-introspect__chips`,children:r.permissions.map(e=>(0,A.jsx)(x,{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{AC as r,FC as i,IC as a,MC as o,NC as s,PC as c,jC as l}from"./api-Da6_RPKW.js";import{r as u}from"./dist-C5rZMbyx.js";import{t as d}from"./x-jEbKIC4W.js";import{t as f}from"./button-DezjmYbu.js";import{$t as p,Ln as m,St as h,bt as g,vt as _,xt as v,yt as y}from"./index-
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{AC as r,FC as i,IC as a,MC as o,NC as s,PC as c,jC as l}from"./api-Da6_RPKW.js";import{r as u}from"./dist-C5rZMbyx.js";import{t as d}from"./x-jEbKIC4W.js";import{t as f}from"./button-DezjmYbu.js";import{$t as p,Ln as m,St as h,bt as g,vt as _,xt as v,yt as y}from"./index-BcCFgPG0.js";import{r as b}from"./TimeRangePicker-CJYL4VHt.js";var x=t(e(),1),S=n(),C=[{value:`eq`,label:`=`},{value:`neq`,label:`≠`},{value:`contains`,label:a()},{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 a=(0,x.useRef)(t),w=!!(a.current&&a.current.length>0),[D,O]=(0,x.useState)(w),[k,A]=(0,x.useState)(()=>w?E(a.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)(u,{className:`oc-advfilter__chevron`+(D?` is-open`:``),"aria-hidden":!0}),i(),F>0?(0,S.jsx)(`span`,{className:`oc-advfilter__count`,children:F}):null]}),D?(0,S.jsxs)(`div`,{className:`oc-advfilter__body`,children:[k.length===0?(0,S.jsx)(`p`,{className:`oc-admin__hint`,children:c()}):(0,S.jsx)(`ul`,{className:`oc-advfilter__rows`,children:k.map(t=>(0,S.jsxs)(`li`,{className:`oc-advfilter__row`,children:[(0,S.jsxs)(_,{value:t.field||void 0,onValueChange:e=>M(t.id,{field:e}),children:[(0,S.jsx)(v,{size:`sm`,className:`w-40`,children:(0,S.jsx)(h,{placeholder:s()})}),(0,S.jsx)(y,{children:e.map(e=>(0,S.jsx)(g,{value:e.value,children:e.label},e.value))})]}),(0,S.jsxs)(_,{value:t.op,onValueChange:e=>M(t.id,{op:e}),children:[(0,S.jsx)(v,{size:`sm`,className:`w-28`,children:(0,S.jsx)(h,{})}),(0,S.jsx)(y,{children:C.map(e=>(0,S.jsx)(g,{value:e.value,children:e.label},e.value))})]}),(0,S.jsx)(p,{className:`oc-advfilter__value`,value:t.value,onChange:e=>M(t.id,{value:e.target.value}),placeholder:o()}),(0,S.jsx)(f,{variant:`ghost`,size:`icon-sm`,"aria-label":l(),onClick:()=>P(t.id),children:(0,S.jsx)(d,{})})]},t.id))}),(0,S.jsxs)(f,{variant:`outline`,size:`sm`,className:`oc-advfilter__add`,onClick:N,children:[(0,S.jsx)(m,{}),r()]})]}):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{$d as r,A_ as i,Ad as a,BY as o,C_ as s,D_ as c,E_ as l,FY as u,F_ as d,Fd as f,HY as p,I_ as m,M_ as h,Md as g,NY as _,N_ as v,Nd as y,O_ as b,P_ as x,Pd as S,Qd as C,S_ as w,Sv as T,T_ as E,UY as D,WB as O,Zd as k,__ as A,_f as j,af as M,b_ as N,bv as ee,c_ as P,cf as F,d_ as I,df as L,ef as R,f_ as z,ff as B,g_ as te,gf as V,h_ as H,hf as U,if as W,j_ as ne,jd as re,k_ as ie,kd as ae,l_ as G,lf as K,m_ as oe,mf as se,nf as ce,of as le,p_ as ue,pf as de,rf as fe,s_ as pe,sf as me,ss as he,t as q,tf as ge,u_ as _e,uf as ve,v_ as ye,w_ as be,x_ as xe,y_ as Se}from"./api-Da6_RPKW.js";import{t as J}from"./button-DezjmYbu.js";import{Bt as Ce,Ct as we,Dt as Te,Gt as Ee,Ht as De,Jt as Oe,Kt as ke,Ot as Ae,St as je,Tt as Me,Ut as Ne,Vt as Pe,Wt as Fe,Yt as Y,bt as Ie,ft as Le,kn as Re,nt as ze,qt 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{$d as r,A_ as i,Ad as a,BY as o,C_ as s,D_ as c,E_ as l,FY as u,F_ as d,Fd as f,HY as p,I_ as m,M_ as h,Md as g,NY as _,N_ as v,Nd as y,O_ as b,P_ as x,Pd as S,Qd as C,S_ as w,Sv as T,T_ as E,UY as D,WB as O,Zd as k,__ as A,_f as j,af as M,b_ as N,bv as ee,c_ as P,cf as F,d_ as I,df as L,ef as R,f_ as z,ff as B,g_ as te,gf as V,h_ as H,hf as U,if as W,j_ as ne,jd as re,k_ as ie,kd as ae,l_ as G,lf as K,m_ as oe,mf as se,nf as ce,of as le,p_ as ue,pf as de,rf as fe,s_ as pe,sf as me,ss as he,t as q,tf as ge,u_ as _e,uf as ve,v_ as ye,w_ as be,x_ as xe,y_ as Se}from"./api-Da6_RPKW.js";import{t as J}from"./button-DezjmYbu.js";import{Bt as Ce,Ct as we,Dt as Te,Gt as Ee,Ht as De,Jt as Oe,Kt as ke,Ot as Ae,St as je,Tt as Me,Ut as Ne,Vt as Pe,Wt as Fe,Yt as Y,bt as Ie,ft as Le,kn as Re,nt as ze,qt as Be,vt as Ve,wt as He,xt as Ue,yt as We}from"./index-BcCFgPG0.js";import{n as Ge,t as Ke}from"./curation-CQksaIbm.js";import{a as qe}from"./compatView-Dvj8v6B1.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(q.me.getMe,{host:Le}),t=e?.role===`admin`,n=(e?.permissions??[]).includes(`bridge.read`),r=D(q.admin.listInstances,e!==void 0&&t?{}:`skip`),[a,s]=(0,X.useState)(null);(0,X.useEffect)(()=>{!t||!r||r.length===0||(!a||!r.some(e=>e.name===a))&&s(r[0].name)},[t,r,a]);let f=D(q.agents.listAgentsForInstance,t&&a?{instanceName:a}:`skip`),p=D(q.agents.listMyAgents,e!==void 0&&!t?{}:`skip`),g=(0,X.useMemo)(()=>{if(e!==void 0){if(t)return a===null||f===void 0?r!==void 0&&r.length===0?[]:void 0:f.agents.map(e=>({instanceName:a,agentId:e.agentId,label:`${e.emoji?`${e.emoji} `:``}${e.displayName??e.agentId}`}));if(p!==void 0)return p.map(e=>({instanceName:e.instanceName,agentId:e.agentId,label:`${e.emoji?`${e.emoji} `:``}${e.displayName??e.agentId}`}))}},[e,t,a,f,r,p]),[y,S]=(0,X.useState)(null);(0,X.useEffect)(()=>{!g||g.length===0||(!y||!g.some(e=>$(e)===y))&&S($(g[0]))},[g,y]);let C=g?.find(e=>$(e)===y)??null,w=o(q.agentFiles.listAgentFiles),[T,O]=(0,X.useState)({status:`idle`}),k=C?.instanceName??null,A=C?.agentId??null,j=D(q.compat.forInstance,n&&k!==null?{instanceName:k}:`skip`),M=n&&k!==null?ze(j,`agentFiles`):null,N=M===null?!1:M===`loading`?null:M.blocked,P=(0,X.useCallback)(async()=>{if(!(k===null||A===null)){O({status:`loading`});try{O({status:`done`,files:(await w({instanceName:k,agentId:A})).files})}catch(e){O({status:`error`,dashboardAbsent:tt(e)})}}},[w,k,A]);(0,X.useEffect)(()=>{N===!1&&P()},[P,N]);let[F,I]=(0,X.useState)(null),L=D(q.agentFileCuration.listCurations,t&&k!==null&&A!==null?{instanceName:k,agentId:A}:`skip`),R=D(q.agentFileCuration.curationSettings,t&&k!==null?{instanceName:k}:`skip`),z=o(q.agentFileCuration.requestCuration),[te,V]=(0,X.useState)(null),[H,U]=(0,X.useState)(null),{toast:W}=Y(),re=(0,X.useMemo)(()=>{let e=new Map;for(let t of L??[])e.has(t.name)||e.set(t.name,t);return e},[L]),ae=(0,X.useCallback)(async e=>{if(!(k===null||A===null)){V(e);try{let t=await z({instanceName:k,agentId:A,name:e,trigger:`manual`});t.ok?W({title:se(),variant:`success`}):W({title:de({reason:t.reason??`unknown`}),variant:`error`})}catch{W({title:B(),variant:`error`})}finally{V(null)}}},[z,k,A,W]),G=u(),K=(0,X.useMemo)(()=>new Intl.NumberFormat(G,{maximumFractionDigits:0}),[G]);return e===void 0||g===void 0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:_()}):(0,Q.jsxs)(`div`,{className:`oc-afiles`,children:[(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:m()}),(0,Q.jsxs)(`div`,{className:`oc-afiles__picker`,children:[t&&(r?.length??0)>1?(0,Q.jsxs)(Ve,{value:a??``,onValueChange:e=>s(e),children:[(0,Q.jsx)(Ue,{size:`sm`,"aria-label":d(),children:(0,Q.jsx)(je,{})}),(0,Q.jsx)(We,{children:(r??[]).map(e=>(0,Q.jsx)(Ie,{value:e.name,children:e.name},e.name))})]}):null,g.length>0?(0,Q.jsxs)(Ve,{value:y??``,onValueChange:e=>S(e),children:[(0,Q.jsx)(Ue,{size:`sm`,"aria-label":x(),children:(0,Q.jsx)(je,{})}),(0,Q.jsx)(We,{children:g.map(e=>(0,Q.jsx)(Ie,{value:$(e),children:e.label},$(e)))})]}):(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:v()})]}),C===null?null:M===`loading`?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:_()}):M!==null&&M.blocked?(0,Q.jsxs)(`p`,{className:`oc-compat__blocked`,role:`status`,children:[(0,Q.jsx)(Re,{size:14,"aria-hidden":!0}),` `,qe(M.gatewayVersion,M.provider)]}):T.status===`loading`||T.status===`idle`?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:_()}):T.status===`error`?(0,Q.jsxs)(`p`,{className:`oc-afiles__error`,role:`alert`,children:[T.dashboardAbsent?he():ne(),` `,!T.dashboardAbsent&&(0,Q.jsx)(J,{variant:`outline`,size:`sm`,onClick:()=>void P(),children:ee()})]}):T.files.length===0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:h()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`div`,{className:`oc-afiles__list`,children:T.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)(Oe,{variant:`outline`,children:i()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`span`,{className:`oc-afiles__size`,children:ie({size:Z(e.size,G)})}),(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:b({pct:K.format(n)})}),r?(0,Q.jsx)(Re,{size:14,className:`oc-afiles__warn`,"aria-label":c()}):(0,Q.jsx)(`span`,{className:`oc-afiles__warn-slot`,"aria-hidden":!0})]}),(0,Q.jsx)(J,{variant:`outline`,size:`sm`,className:`oc-afiles__open`,onClick:()=>I(e),children:t?E():be()}),t&&!e.missing?(0,Q.jsx)(it,{curatable:Ke.includes(e.name),size:e.size??0,budget:R?.budgetChars??null,enabled:R?.enabled??!1,curation:re.get(e.name)??null,inFlight:te===e.name,onCurate:()=>void ae(e.name),onReview:e=>U(e)}):null]},e.name)})}),(0,Q.jsx)(`p`,{className:`oc-afiles__budget`,children:l({used:Z(Qe(T.files),G),total:Z(Ye,G),pct:K.format(Ze(Qe(T.files)))})})]}),F&&C?(0,Q.jsx)(at,{instanceName:C.instanceName,agentId:C.agentId,name:F.name,isAdmin:t,onClose:()=>I(null),onSaved:()=>void P()}):null,H?(0,Q.jsx)(ot,{curationId:H,onClose:()=>U(null),onApplied:()=>{U(null),P()}}):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)(J,{variant:`default`,size:`sm`,className:`oc-afiles__curate`,onClick:()=>s(i._id),children:V()}):a||i?.status===`dispatched`||i?.status===`applying`?(0,Q.jsx)(Oe,{variant:`outline`,className:`oc-afiles__curate-status`,children:U()}):e&&r&&n!==null&&Ge(t,n)?(0,Q.jsx)(J,{variant:`outline`,size:`sm`,className:`oc-afiles__curate`,onClick:o,children:j()}):null}function at({instanceName:e,agentId:t,name:n,isAdmin:r,onClose:i,onSaved:a}){let c=o(q.agentFiles.getAgentFile),l=o(q.agentFiles.setAgentFile),d=Y(),[f,p]=(0,X.useState)(null),[m,h]=(0,X.useState)(!1),[g,v]=(0,X.useState)(``),[y,b]=(0,X.useState)(!1),[x,S]=(0,X.useState)(!1),[C,E]=(0,X.useState)(!1),[D,k]=(0,X.useState)(!1),j=(0,X.useCallback)(async r=>{h(!1);try{let i=await c({instanceName:e,agentId:t,name:n});p({content:i.content,updatedAtMs:i.updatedAtMs}),r||v(i.content),E(!1)}catch{h(!0)}},[c,e,t,n]);(0,X.useEffect)(()=>{j(!1)},[j]);async function M(){if(f!==null){S(!0),k(!1);try{await l({instanceName:e,agentId:t,name:n,content:g,baseUpdatedAtMs:f.updatedAtMs??void 0}),d.success(A({name:n})),a(),await j(!1)}catch(e){nt(e)?E(!0):k(!0)}finally{S(!1)}}}let F=f!==null&&g!==f.content,L=(0,X.useMemo)(()=>f===null?null:et(f.content,g),[f,g]),R=g.length>Je,B=u(),V=(0,X.useMemo)(()=>new Intl.NumberFormat(B),[B]);return(0,Q.jsx)(we,{open:!0,onOpenChange:e=>!e&&i(),children:(0,Q.jsxs)(He,{className:`oc-afiles__editor`,children:[(0,Q.jsxs)(Te,{children:[(0,Q.jsx)(Ae,{children:s({name:n})}),(0,Q.jsxs)(Me,{children:[w({agent:t,instance:e}),r?null:(0,Q.jsxs)(Q.Fragment,{children:[` · `,xe()]})]})]}),m?(0,Q.jsxs)(`p`,{className:`oc-afiles__error`,role:`alert`,children:[H(),` `,(0,Q.jsx)(J,{variant:`outline`,size:`sm`,onClick:()=>void j(!1),children:ee()})]}):f===null?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:_()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`textarea`,{className:`oc-afiles__source`,value:g,readOnly:!r,spellCheck:!1,onChange:e=>v(e.target.value),"aria-label":s({name:n})}),(0,Q.jsx)(`p`,{className:`oc-afiles__hint`,children:N()}),C?(0,Q.jsxs)(`p`,{className:`oc-afiles__error`,role:`alert`,children:[oe(),` `,(0,Q.jsx)(J,{variant:`outline`,size:`sm`,onClick:()=>void j(!0),children:ue()})]}):null,D?(0,Q.jsx)(`p`,{className:`oc-afiles__error`,role:`alert`,children:te()}):null,(0,Q.jsxs)(`div`,{className:`oc-afiles__editor-foot`,children:[(0,Q.jsx)(`span`,{className:`oc-afiles__count${R?` is-over`:``}`,children:Se({count:V.format(g.length),max:V.format(Je)})}),r?(0,Q.jsx)(J,{size:`sm`,disabled:!F||x||C,onClick:()=>b(!0),children:x?T():ye()}):null]})]}),(0,Q.jsx)(Ce,{open:y,onOpenChange:b,children:(0,Q.jsxs)(Ne,{children:[(0,Q.jsxs)(ke,{children:[(0,Q.jsx)(Be,{children:z({name:n})}),(0,Q.jsx)(Fe,{children:I({agent:t})})]}),L?(0,Q.jsxs)(`div`,{className:`oc-afiles__diff`,children:[(0,Q.jsx)(`p`,{className:`oc-afiles__diff-counts`,children:_e({added:L.added,removed:L.removed})}),L.sampleAdded.length>0?(0,Q.jsxs)(`div`,{className:`oc-afiles__diff-block`,children:[(0,Q.jsx)(`span`,{className:`oc-afiles__diff-label`,children:G()}),L.sampleAdded.map((e,t)=>(0,Q.jsx)(`code`,{className:`oc-afiles__diff-line is-add`,children:e||` `},t))]}):null,L.sampleRemoved.length>0?(0,Q.jsxs)(`div`,{className:`oc-afiles__diff-block`,children:[(0,Q.jsx)(`span`,{className:`oc-afiles__diff-label`,children:P()}),L.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)(De,{children:O()}),(0,Q.jsx)(Pe,{onClick:()=>void M(),children:pe()})]})]})})]})})}function ot({curationId:e,onClose:t,onApplied:n}){let i=D(q.agentFileCuration.getProposal,{curationId:e}),s=o(q.agentFileCuration.approveCuration),c=p(q.agentFileCuration.rejectCuration),{toast:l}=Y(),[d,m]=(0,X.useState)(null),[h,v]=(0,X.useState)(!1),[b,x]=(0,X.useState)(``),w=u(),E=(0,X.useMemo)(()=>i?et(i.beforeContent,i.proposedContent):null,[i]);async function O(){m(`approve`);try{let t=await s({curationId:e});t.ok?(l({title:L(),variant:`success`}),n()):l({title:t.reason===`conflict`?K():F({reason:t.reason??`unknown`}),variant:`error`})}catch{l({title:B(),variant:`error`})}finally{m(null)}}async function A(n){m(`reject`);try{let r=b.trim();(await c({curationId:e,...r?{comment:r}:{},relaunch:n})).ok?l({title:n?a():ve(),variant:`success`}):l({title:M(),variant:`error`}),t()}catch{l({title:B(),variant:`error`})}finally{m(null)}}return(0,Q.jsx)(we,{open:!0,onOpenChange:e=>e?void 0:t(),children:(0,Q.jsxs)(He,{className:`oc-afiles__review`,children:[(0,Q.jsxs)(Te,{children:[(0,Q.jsx)(Ae,{children:i?me({name:i.name}):_()}),(0,Q.jsx)(Me,{children:le()})]}),i===void 0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:_()}):i===null?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:M()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`p`,{className:`oc-afiles__review-sizes`,children:[W({before:Z(i.beforeSize,w),after:Z(i.proposedSize,w)}),i.overBudget?(0,Q.jsxs)(Q.Fragment,{children:[` `,(0,Q.jsx)(Re,{size:13,"aria-hidden":!0}),` `,fe()]}):null]}),E?(0,Q.jsx)(`p`,{className:`oc-afiles__review-diff`,children:ce({added:E.added,removed:E.removed})}):null,i.feedback?(0,Q.jsx)(`p`,{className:`oc-afiles__review-feedback`,children:ae({feedback:i.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:k()}),(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:C()}),(0,Q.jsx)(`pre`,{className:`oc-afiles__review-pre`,children:i.beforeContent})]}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`p`,{className:`oc-afiles__review-label`,children:ge()}),(0,Q.jsx)(`pre`,{className:`oc-afiles__review-pre`,children:i.proposedContent})]})]})]}),h?(0,Q.jsxs)(`div`,{className:`oc-afiles__reject-form`,children:[(0,Q.jsx)(`label`,{className:`oc-afiles__review-label`,htmlFor:`curation-reject-comment`,children:f()}),(0,Q.jsx)(`textarea`,{id:`curation-reject-comment`,className:`oc-afiles__reject-textarea`,rows:3,placeholder:S(),value:b,onChange:e=>x(e.target.value)}),(0,Q.jsxs)(`div`,{className:`oc-afiles__review-actions`,children:[(0,Q.jsx)(J,{variant:`ghost`,onClick:()=>v(!1),disabled:d!==null,children:y()}),(0,Q.jsx)(J,{variant:`outline`,onClick:()=>void A(!1),disabled:d!==null,children:d===`reject`?T():g()}),(0,Q.jsx)(J,{variant:`default`,onClick:()=>void A(!0),disabled:d!==null,children:d===`reject`?T():re()})]})]}):(0,Q.jsxs)(`div`,{className:`oc-afiles__review-actions`,children:[(0,Q.jsx)(J,{variant:`outline`,onClick:()=>v(!0),disabled:d!==null||i==null,children:R()}),(0,Q.jsx)(J,{variant:`default`,onClick:()=>void O(),disabled:d!==null||i==null,children:d===`approve`?T():r()})]})]})})}export{rt as AgentFilesTab};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$j as r,AM as i,BM as a,CM as ee,DM as te,EM as ne,FM as re,HY as ie,IM as o,Jj as s,Kj as c,LM as ae,MM as oe,NM as se,OM as ce,PM as le,Qj as l,RM as ue,SM as de,TM as fe,UY as u,VM as d,Xj as f,Yj as p,Zj as m,_M as pe,aM as h,bM as g,cM as _,dM as v,eM as me,fM as he,gM as ge,hM as _e,iM as ve,jM as ye,kM as be,lM as xe,mM as Se,nM as Ce,oM as we,pM as y,qj as b,rM as x,sM as S,t as C,tM as w,uM as T,vM as E,wM as D,xM as O,yM as k,zM as A}from"./api-Da6_RPKW.js";import{At as j,Ct as M,Dt as N,Jt as P,Ot as F,St as I,Yt as Te,bt as L,ct as Ee,dr as R,fr as De,ft as Oe,i as ke,o as Ae,vt as z,wt as B,xt as V,yt as H}from"./index-
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$j as r,AM as i,BM as a,CM as ee,DM as te,EM as ne,FM as re,HY as ie,IM as o,Jj as s,Kj as c,LM as ae,MM as oe,NM as se,OM as ce,PM as le,Qj as l,RM as ue,SM as de,TM as fe,UY as u,VM as d,Xj as f,Yj as p,Zj as m,_M as pe,aM as h,bM as g,cM as _,dM as v,eM as me,fM as he,gM as ge,hM as _e,iM as ve,jM as ye,kM as be,lM as xe,mM as Se,nM as Ce,oM as we,pM as y,qj as b,rM as x,sM as S,t as C,tM as w,uM as T,vM as E,wM as D,xM as O,yM as k,zM as A}from"./api-Da6_RPKW.js";import{At as j,Ct as M,Dt as N,Jt as P,Ot as F,St as I,Yt as Te,bt as L,ct as Ee,dr as R,fr as De,ft as Oe,i as ke,o as Ae,vt as z,wt as B,xt as V,yt as H}from"./index-BcCFgPG0.js";import{n as je}from"./TimeRangePicker-CJYL4VHt.js";import{t as Me}from"./FilterBar-CF8kYMRM.js";import{t as Ne}from"./DataTableShell-DwnJt663.js";import{t as U}from"./dispatchErrorInfo-CMB-D8cW.js";var W=t(e(),1),G=new Set([`openclaw.dispatch_failures`,`assistant.announce_errors`]),K=new Set([`assistant.cause.provider_auth_revoked`,`assistant.cause.provider_permission_denied`,`assistant.cause.provider_auth_failed`]);function q(e){let t=K.has(e.kind);if(!G.has(e.kind)&&!t||!e.evidence)return{};try{let n=JSON.parse(e.evidence);if(t){let e=Array.isArray(n.agents)?n.agents.filter(e=>typeof e==`string`):[],t=Array.isArray(n.providers)?n.providers.filter(e=>typeof e==`string`):[],r=e.length===1?e[0]:void 0;return{dominantCode:n.cause,sampleCorrelationId:n.sampleCorrelationId,context:{...r===void 0?{}:{agentId:r.slice(r.lastIndexOf(`/`)+1)},...t.length===1?{provider:t[0]}:{}}}}return{dominantCode:n.dominantCode,sampleCorrelationId:n.sampleCorrelationId}}catch{return{}}}var J=n(),Y=`__all__`,Pe=[{value:`open`},{value:`acknowledged`},{value:`resolved`}];function Fe(e){return e===`open`?d():e===`acknowledged`?a():A()}var Ie=[`info`,`warn`,`critical`],Le=[`detector`,`agent`,`user`],Re={kind:`relative`,from:`now-30d`,to:`now`},ze=200,X=`all`;function Z(){let e=De({from:`/settings/anomalies`}),t=R({from:`/settings/anomalies`}),n=e.q??``,r=e.status===X?Y:e.status,a=e.severity??Y,s=e.kind??Y,[c,l]=(0,W.useState)(Y),d=ke(e.from,e.to),{from:f,to:p}=je(d),m=e=>void t({search:t=>({...t,q:e||void 0}),replace:!0}),b=e=>void t({search:t=>({...t,status:e===Y?X:e})}),A=e=>void t({search:t=>({...t,severity:e===Y?void 0:e})}),M=e=>void t({search:t=>({...t,kind:e===Y?void 0:e})}),N=e=>void t({search:t=>({...t,...Ae(e)})}),F=Ee(),B=Te(),U=ie(C.anomalies.resolveAnomaly),G=(u(C.me.getMe,{host:Oe})?.permissions??[]).includes(`admin.manage`),K=u(C.anomalies.listAnomalies,{limit:ze,filter:{q:n||void 0,from:f,to:p,anomalyStatus:r===Y?void 0:r,severity:a===Y?void 0:a,source:c===Y?void 0:c,kind:s===Y?void 0:s}}),q=(0,W.useMemo)(()=>{let e=new Set;for(let t of K??[])e.add(t.kind);return[...e].sort()},[K]),Z=n!==``||r!==`open`||a!==Y||c!==Y||s!==Y||d.kind!==`relative`||d.from!==Re.from;function Q(){l(Y),t({search:{status:`open`},replace:!0})}async function We(e){if(await F({title:ue(),description:(0,J.jsxs)(J.Fragment,{children:[ae(),` `,(0,J.jsx)(`span`,{className:`font-mono`,children:e.kind}),` `,o(),` `,(0,J.jsx)(`strong`,{children:re()}),`.`,` `,le()]}),confirmLabel:se()}))try{await U({anomalyId:e._id,status:`resolved`}),B.success(oe(),e.kind)}catch(e){B.error(ye(),e)}}async function Ge(e){try{await U({anomalyId:e._id,status:`acknowledged`}),B.success(i(),e.kind)}catch(e){B.error(be(),e)}}return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(`p`,{className:`oc-admin__hint`,children:[ce(),` `,(0,J.jsx)(`strong`,{children:te()}),` `,ne(),` `,(0,J.jsx)(`strong`,{children:fe()}),` `,D(),` `,(0,J.jsx)(`strong`,{children:ee()}),` `,de(),` `,(0,J.jsx)(`span`,{className:`oc-filter__window`,children:O()})]}),(0,J.jsxs)(Me,{q:n,onQChange:m,searchPlaceholder:g(),timeRange:d,onTimeRangeChange:N,onReset:Q,canReset:Z,children:[(0,J.jsxs)(z,{value:r,onValueChange:b,children:[(0,J.jsx)(V,{size:`sm`,className:`w-36`,children:(0,J.jsx)(I,{})}),(0,J.jsxs)(H,{children:[(0,J.jsx)(L,{value:Y,children:k()}),Pe.map(e=>(0,J.jsx)(L,{value:e.value,children:Fe(e.value)},e.value))]})]}),(0,J.jsxs)(z,{value:a,onValueChange:A,children:[(0,J.jsx)(V,{size:`sm`,className:`w-36`,children:(0,J.jsx)(I,{placeholder:E()})}),(0,J.jsxs)(H,{children:[(0,J.jsx)(L,{value:Y,children:Se()}),Ie.map(e=>(0,J.jsx)(L,{value:e,children:e},e))]})]}),(0,J.jsxs)(z,{value:c,onValueChange:l,children:[(0,J.jsx)(V,{size:`sm`,className:`w-32`,children:(0,J.jsx)(I,{placeholder:y()})}),(0,J.jsxs)(H,{children:[(0,J.jsx)(L,{value:Y,children:he()}),Le.map(e=>(0,J.jsx)(L,{value:e,children:e},e))]})]}),(0,J.jsxs)(z,{value:s,onValueChange:M,children:[(0,J.jsx)(V,{size:`sm`,className:`w-36`,children:(0,J.jsx)(I,{placeholder:v()})}),(0,J.jsxs)(H,{children:[(0,J.jsx)(L,{value:Y,children:T()}),q.map(e=>(0,J.jsx)(L,{value:e,children:e},e))]})]})]}),(0,J.jsx)(Ne,{title:xe(),rows:K,emptyHint:r===`open`?_():S(),rowActions:e=>G&&e.status===`open`?[{label:we(),onSelect:()=>void We(e)},{label:h(),onSelect:()=>void Ge(e)}]:[],columns:[{header:ve(),cell:e=>(0,J.jsx)(`span`,{className:`oc-traces__time`,children:j(e.at)}),sort:e=>e.at},{header:v(),cell:e=>(0,J.jsx)(`code`,{className:`oc-traces__mono`,children:e.kind}),sort:e=>e.kind},{header:pe(),cell:e=>e.occurrenceCount!==null&&e.occurrenceCount>1?(0,J.jsx)(`span`,{className:`oc-traces__time`,title:e.firstAt===null?void 0:_e({when:j(e.firstAt)}),children:ge({count:String(e.occurrenceCount)})}):(0,J.jsx)(`span`,{className:`oc-traces__time`,children:`—`}),sort:e=>e.occurrenceCount??0},{header:E(),cell:e=>(0,J.jsx)($,{severity:e.severity}),sort:e=>e.severity===`critical`?2:+(e.severity===`warn`)},{header:x(),cell:e=>(0,J.jsx)(He,{status:e.status}),sort:e=>e.status===`resolved`?2:+(e.status===`acknowledged`)},{header:y(),cell:e=>(0,J.jsx)(P,{variant:`outline`,children:e.source}),sort:e=>e.source},{header:Ce(),cell:e=>(0,J.jsxs)(`div`,{className:`oc-anomaly__msgcell`,children:[(0,J.jsx)(`span`,{className:`oc-anomaly__msg`,children:e.message}),(0,J.jsx)(Ve,{row:e})]}),sort:e=>e.message},{header:w(),cell:e=>(0,J.jsx)(Be,{row:e}),sort:e=>e.evidence??null},{header:me(),cell:e=>e.correlationId?(0,J.jsx)(`code`,{className:`oc-traces__mono`,children:Ue(e.correlationId)}):(0,J.jsx)(`span`,{className:`oc-traces__muted`,children:`—`}),sort:e=>e.correlationId}]})]})}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 Be({row:e}){let t=R();if(e.kind===`subagent.failure`){let n=Q(e);return(0,J.jsxs)(`div`,{className:`oc-anomaly__cause`,children:[(0,J.jsx)(`div`,{className:`oc-anomaly__cause-head`,children:[...new Set(n.errorCategories??[])].map(e=>(0,J.jsx)(`code`,{className:`oc-traces__mono`,children:e},e))}),e.correlationId?(0,J.jsxs)(`button`,{type:`button`,className:`oc-anomaly__drill`,onClick:()=>void t({to:`/settings/traces`,search:{q:e.correlationId,limit:100}}),children:[`↗ `,r()]}):null]})}let n=q(e);if(!n.dominantCode){let e=n.sampleCorrelationId;return e?(0,J.jsx)(`div`,{className:`oc-anomaly__cause`,children:(0,J.jsxs)(`button`,{type:`button`,className:`oc-anomaly__drill`,onClick:()=>void t({to:`/settings/traces`,search:{correlationId:e,limit:100}}),children:[`↗ `,r()]})}):(0,J.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})}let i=U(n.dominantCode,n.context),a=n.sampleCorrelationId;return(0,J.jsxs)(`div`,{className:`oc-anomaly__cause`,children:[(0,J.jsxs)(`div`,{className:`oc-anomaly__cause-head`,children:[(0,J.jsx)(`span`,{className:`oc-anomaly__cause-label`,children:i.label}),(0,J.jsx)(`code`,{className:`oc-traces__mono`,children:n.dominantCode})]}),(0,J.jsx)(`p`,{className:`oc-anomaly__cause-hint`,children:i.hint}),a?(0,J.jsxs)(`button`,{type:`button`,className:`oc-anomaly__drill`,onClick:()=>void t({to:`/settings/traces`,search:{correlationId:a,limit:100}}),children:[`↗ `,r()]}):null]})}function Ve({row:e}){let[t,n]=(0,W.useState)(!1),r=u(C.anomalies.getAnomalyAttachments,t?{anomalyId:e._id}:`skip`);return!e.attachments||e.attachments.length===0?null:(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(`button`,{type:`button`,className:`oc-anomaly__drill`,onClick:()=>n(!0),children:[l(),e.attachments.length>1?` (${e.attachments.length})`:``]}),(0,J.jsx)(M,{open:t,onOpenChange:n,children:(0,J.jsxs)(B,{className:`oc-anomaly__attachments-dialog`,children:[(0,J.jsx)(N,{children:(0,J.jsx)(F,{children:m()})}),r===void 0?(0,J.jsx)(`p`,{className:`oc-traces__muted`,children:f()}):r.length===0?(0,J.jsx)(`p`,{className:`oc-traces__muted`,children:p()}):(0,J.jsx)(`div`,{className:`oc-anomaly__attachments`,children:r.map(e=>(0,J.jsxs)(`section`,{className:`oc-anomaly__attachment`,children:[(0,J.jsx)(`h4`,{className:`oc-anomaly__attachment-name`,children:(0,J.jsx)(`code`,{className:`oc-traces__mono`,children:e.name})}),(0,J.jsx)(`pre`,{className:`oc-anomaly__attachment-content`,children:e.content})]},e.name))})]})})]})}function $({severity:e}){return(0,J.jsx)(`span`,{className:`oc-anomaly__sev oc-anomaly__sev--${e}`,children:e})}function He({status:e}){return e===`open`?(0,J.jsx)(P,{variant:`destructive`,children:s()}):e===`acknowledged`?(0,J.jsx)(P,{variant:`secondary`,children:b()}):(0,J.jsx)(P,{variant:`outline`,children:c()})}function Ue(e){return e.length>8?e.slice(0,8):e}export{Z as AnomaliesTab};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Au as r,BN as i,Du as a,Eu as o,FN as s,GN as c,HN as l,IN as u,KN as d,LN as f,NN as p,Ou as m,PN as h,RN as g,UN as _,UY as v,VN as y,WN as b,ju as x,ku as S,qN as C,t as w,zN as T}from"./api-Da6_RPKW.js";import{At as E,St as D,a as O,bt as k,dr as A,fr as j,i as M,n as N,o as P,s as F,vt as I,xt as L,yt as R}from"./index-
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Au as r,BN as i,Du as a,Eu as o,FN as s,GN as c,HN as l,IN as u,KN as d,LN as f,NN as p,Ou as m,PN as h,RN as g,UN as _,UY as v,VN as y,WN as b,ju as x,ku as S,qN as C,t as w,zN as T}from"./api-Da6_RPKW.js";import{At as E,St as D,a as O,bt as k,dr as A,fr as j,i as M,n as N,o as P,s as F,vt as I,xt as L,yt as R}from"./index-BcCFgPG0.js";import{n as ee}from"./TimeRangePicker-CJYL4VHt.js";import{t as z}from"./FilterBar-CF8kYMRM.js";import{t as B}from"./AdvancedFilter-C5uNd2Bh.js";import{t as V}from"./DataTableShell-DwnJt663.js";var H=t(e(),1),U=n(),W={kind:`relative`,from:N,to:`now`},G=`__all__`,K=[{value:`action`,label:x()},{value:`realLabel`,label:r()},{value:`targetLabel`,label:S()},{value:`impersonated`,label:m()},{value:`resource`,label:a()},{value:`resourceId`,label:o()}];function q(){let e=j({from:`/settings/audit`}),t=A({from:`/settings/audit`}),n=e.q??``,r=e.action??G,a=e.impersonated??G,o=e.resource??G,m=M(e.from,e.to),x=(0,H.useMemo)(()=>F(e.adv),[e.adv]),{from:S,to:N}=ee(m),q=e=>void t({search:t=>({...t,q:e||void 0}),replace:!0}),J=e=>void t({search:t=>({...t,action:e===G?void 0:e})}),Y=e=>void t({search:t=>({...t,impersonated:e===G?void 0:e})}),X=e=>void t({search:t=>({...t,resource:e===G?void 0:e})}),Z=e=>void t({search:t=>({...t,...P(e)})}),Q=e=>void t({search:t=>({...t,adv:O(e)}),replace:!0}),$=v(w.admin.listAudit,{filter:{q:n||void 0,from:S,to:N,action:r===G?void 0:r,resource:o===G?void 0:o,impersonated:a===G?void 0:a===`yes`,advanced:x.length>0?x: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!==``||r!==G||a!==G||o!==G||x.length>0||m.kind!==`relative`||m.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:[C(),` `,(0,U.jsx)(`span`,{className:`oc-filter__window`,children:d()})]}),(0,U.jsxs)(z,{q:n,onQChange:q,searchPlaceholder:c(),timeRange:m,onTimeRangeChange:Z,onReset:ie,canReset:re,children:[(0,U.jsxs)(I,{value:r,onValueChange:J,children:[(0,U.jsx)(L,{size:`sm`,className:`w-40`,children:(0,U.jsx)(D,{placeholder:b()})}),(0,U.jsxs)(R,{children:[(0,U.jsx)(k,{value:G,children:_()}),te.map(e=>(0,U.jsx)(k,{value:e,children:e},e))]})]}),(0,U.jsxs)(I,{value:a,onValueChange:Y,children:[(0,U.jsx)(L,{size:`sm`,className:`w-40`,children:(0,U.jsx)(D,{})}),(0,U.jsxs)(R,{children:[(0,U.jsx)(k,{value:G,children:l()}),(0,U.jsx)(k,{value:`yes`,children:y()}),(0,U.jsx)(k,{value:`no`,children:i()})]})]}),(0,U.jsxs)(I,{value:o,onValueChange:X,children:[(0,U.jsx)(L,{size:`sm`,className:`w-40`,children:(0,U.jsx)(D,{placeholder:T()})}),(0,U.jsxs)(R,{children:[(0,U.jsx)(k,{value:G,children:g()}),ne.map(e=>(0,U.jsx)(k,{value:e,children:e},e))]})]})]}),(0,U.jsx)(B,{fields:K,seed:x,onChange:Q}),(0,U.jsx)(V,{title:f(),rows:$,emptyHint:u(),columns:[{header:s(),cell:e=>E(e.at),sort:e=>e.at},{header:b(),cell:e=>e.action,sort:e=>e.action},{header:h(),cell:e=>e.realLabel,sort:e=>e.realLabel},{header:p(),cell:e=>e.targetLabel??`—`,sort:e=>e.targetLabel??null},{header:T(),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{$O as r,AO as i,BO as a,BY as o,Bg as s,Bk as c,CO as l,DO as u,E as d,EO as f,FO as p,GO as m,Gg as h,Gk as g,HO as _,HY as ee,Hg as v,Hk as te,IO as y,Ik as ne,JO as b,Jg as re,Jl as ie,KO as ae,Kg as oe,Kk as se,LO as ce,Lk as le,MO as ue,Mg as de,Mk as fe,NO as pe,Nk as me,OO as he,PO as ge,QO as _e,RO as ve,Rg as ye,Rk as be,SO as xe,TO as Se,UO as Ce,UY as x,Ug as we,Uk as Te,VO as S,Va as Ee,Vg as De,Vk as Oe,WO as ke,Wg as Ae,XO as je,Xg as Me,Xl as Ne,YO as Pe,Yg as Fe,Yl as Ie,ZO as Le,Zl as Re,_O as ze,ak as Be,bO as Ve,ck as He,cs as Ue,ek as We,eu as Ge,fO as C,gO as Ke,hO as qe,ik as Je,jO as Ye,kO as Xe,lk as Ze,mO as Qe,nk as $e,ok as et,pO as w,qO as tt,qg as nt,ql as rt,rk as it,sk as at,t as T,tk as ot,uk as st,vO as ct,wO as lt,xO as ut,yO as dt,zO as ft,zg as pt,zk as mt}from"./api-Da6_RPKW.js";import{r as E}from"./dist-C5rZMbyx.js";import{t as ht}from"./chevrons-up-down-BJ8yWoBT.js";import{i as gt,n as D,o as _t,r as vt,s as yt}from"./FieldLabel-R6-VrEew.js";import{t as bt}from"./button-DezjmYbu.js";import{$t as O,At as xt,Ct as St,Dt as Ct,Jn as wt,Jt as k,L as Tt,Mt as Et,Ot as Dt,Pn as A,St as j,Tt as Ot,Yt as kt,ar as M,at as At,bt as N,cn as jt,dr as P,fr as Mt,ft as Nt,it as Pt,jt as F,kn as I,on as Ft,or as It,ot as Lt,sn as Rt,sr as L,st as zt,vt as R,wt as Bt,xt as z,yt as B}from"./index-BK3dOjJU.js";import{r as Vt}from"./locales-CPjguROj.js";import{a as Ht,i as V,n as Ut,o as H,r as U,t as Wt}from"./table-CFBr2AAN.js";import{t as Gt}from"./FilterBar-GpmG3LXq.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-Dvj8v6B1.js";import{t as W}from"./dispatchErrorInfo-CMB-D8cW.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`}]]),G=t(e(),1);function tn(e){return e.filter(e=>e.state===`error`)}function nn(e){return e.reachable&&tn(e.targets).length===0}function rn(e){return nn(e)?(e.unreachableInstances??[]).length>0?`gateways_unreachable`:`ok`:`error`}function K(e){return e.state===`error`&&e.lastErrorCode!==null}function an(e){return!!e.lastDownstreamRejectCode}function on(e){return!!e.lastLocalRefusalCode}function sn(e){return K(e)||an(e)||on(e)}function q(e){return e.kind??`openclaw`}function cn(e){return[...e].sort((e,t)=>e===`openclaw`?-1:t===`openclaw`?1:e.localeCompare(t))}function ln(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,q(e));let i=e=>(e.instanceName?r.get(e.instanceName):void 0)??`openclaw`,a=new Set;for(let e of n)a.add(q(e));for(let e of t)a.add(e.provider);for(let t of e)a.add(i(t));return cn(a).map(r=>({key:r,connections:e.filter(e=>i(e)===r),compatTargets:t.filter(e=>e.provider===r),instances:n.filter(e=>q(e)===r)}))}function J(e){return e===`openclaw`?`OpenClaw`:e===`hermes`?`Hermes`:e.charAt(0).toUpperCase()+e.slice(1)}var Y=`__all__`,un={q:``,state:Y,instance:Y,version:Y},X={connected:0,error:1,idle:2};function dn(e){return e.q.trim()!==``||e.state!==`__all__`||e.instance!==`__all__`||e.version!==`__all__`}function fn(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 Z(e,t){return e.localeCompare(t,void 0,{numeric:!0,sensitivity:`base`})}function pn(e,t){return e===`version`?t.gatewayVersion===null:e===`lastOk`?t.lastOkAt===null:!1}function mn(e,t,n){switch(e){case`state`:return(X[t.state]??99)-(X[n.state]??99);case`instance`:return Z(t.instanceLabel??t.instanceName??``,n.instanceLabel??n.instanceName??``);case`host`:return Z(t.gatewayHost,n.gatewayHost);case`version`:{let e=t.gatewayVersion,r=n.gatewayVersion;return Zt(e,r)??Z(e,r)}case`lastOk`:return t.lastOkAt-n.lastOkAt;default:return Z(t.targetLabel,n.targetLabel)}}function hn(e,t){if(!t)return e;let n=t.dir===`asc`?1:-1;return[...e].sort((e,r)=>{let i=pn(t.key,e),a=pn(t.key,r);return i&&a?0:i?1:a?-1:n*mn(t.key,e,r)})}function gn(e){let t=new Set;for(let n of e)t.add(n.state);return[...t].sort((e,t)=>(X[e]??99)-(X[t]??99))}function _n(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)=>Z(e.label,t.label))}function vn(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)??Z(e,t))}var Q=n();function yn({connections:e,displayByInstance:t}){let[n,r]=(0,G.useState)(un),[a,o]=(0,G.useState)(null),s=(0,G.useMemo)(()=>e.map((e,n)=>({_id:`${e.key}:${e.canonical}/${e.agentId}:${n}`,targetLabel:`${e.canonical}/${e.agentId}`,state:e.state,instanceName:e.instanceName??null,instanceLabel:e.instanceName?t.get(e.instanceName)??e.instanceName:null,gatewayHost:e.gatewayHost,gatewayVersion:e.gatewayVersion??null,okCount:e.okCount,errorCount:e.errorCount+(e.downstreamRejectCount??0)+(e.localRefusalCount??0),attempts:e.attempts,lastOkAt:e.lastOkAt??null,lastErrorCode:e.lastErrorCode??null,lastErrorAt:e.lastErrorAt??null,lastDownstreamRejectCode:e.lastDownstreamRejectCode??null,lastDownstreamRejectAt:e.lastDownstreamRejectAt??null,lastLocalRefusalCode:e.lastLocalRefusalCode??null,lastLocalRefusalAt:e.lastLocalRefusalAt??null})),[e,t]),c=(0,G.useMemo)(()=>gn(s),[s]),d=(0,G.useMemo)(()=>_n(s),[s]),p=(0,G.useMemo)(()=>vn(s),[s]),m=(0,G.useMemo)(()=>hn(fn(s,n),a),[s,n,a]);function h(e){o(t=>t?.key===e?t.dir===`asc`?{key:e,dir:`desc`}:null:{key:e,dir:`asc`})}return e.length===0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:i()}):(0,Q.jsxs)(`div`,{className:`oc-conn`,children:[(0,Q.jsxs)(Gt,{q:n.q,onQChange:e=>r(t=>({...t,q:e})),searchPlaceholder:u(),onReset:()=>r(un),canReset:dn(n),children:[(0,Q.jsxs)(R,{value:n.state,onValueChange:e=>r(t=>({...t,state:e})),children:[(0,Q.jsx)(z,{size:`sm`,className:`w-36`,children:(0,Q.jsx)(j,{placeholder:Se()})}),(0,Q.jsxs)(B,{children:[(0,Q.jsx)(N,{value:Y,children:f()}),c.map(e=>(0,Q.jsx)(N,{value:e,children:xn(e)},e))]})]}),(0,Q.jsxs)(R,{value:n.instance,onValueChange:e=>r(t=>({...t,instance:e})),children:[(0,Q.jsx)(z,{size:`sm`,className:`w-40`,children:(0,Q.jsx)(j,{placeholder:lt()})}),(0,Q.jsxs)(B,{children:[(0,Q.jsx)(N,{value:Y,children:f()}),d.map(e=>(0,Q.jsx)(N,{value:e.name,children:e.label},e.name))]})]}),(0,Q.jsxs)(R,{value:n.version,onValueChange:e=>r(t=>({...t,version:e})),children:[(0,Q.jsx)(z,{size:`sm`,className:`w-36`,children:(0,Q.jsx)(j,{placeholder:l()})}),(0,Q.jsxs)(B,{children:[(0,Q.jsx)(N,{value:Y,children:f()}),p.map(e=>(0,Q.jsx)(N,{value:e,children:e},e))]})]})]}),m.length===0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:xe()}):(0,Q.jsxs)(Wt,{className:`oc-conn__table`,children:[(0,Q.jsx)(Ht,{children:(0,Q.jsxs)(H,{children:[(0,Q.jsx)($,{label:ut(),sortKey:`target`,sort:a,onSort:h}),(0,Q.jsx)($,{label:Ve(),sortKey:`state`,sort:a,onSort:h}),(0,Q.jsx)($,{label:dt(),sortKey:`instance`,sort:a,onSort:h}),(0,Q.jsx)($,{label:ct(),sortKey:`host`,sort:a,onSort:h}),(0,Q.jsx)($,{label:ze(),sortKey:`version`,sort:a,onSort:h}),(0,Q.jsx)(V,{children:Ke()}),(0,Q.jsx)($,{label:qe(),sortKey:`lastOk`,sort:a,onSort:h})]})}),(0,Q.jsx)(Ut,{children:m.map(e=>(0,Q.jsx)(bn,{r:e},e._id))})]})]})}function $({label:e,sortKey:t,sort:n,onSort:r}){let i=n?.key===t,a=i?n.dir:null;return(0,Q.jsx)(V,{"aria-sort":i?a===`asc`?`ascending`:`descending`:`none`,children:(0,Q.jsxs)(`button`,{type:`button`,className:`oc-conn__sort`,onClick:()=>r(t),children:[e,i?a===`asc`?(0,Q.jsx)(It,{size:13,"aria-hidden":!0}):(0,Q.jsx)(E,{size:13,"aria-hidden":!0}):(0,Q.jsx)(ht,{size:13,"aria-hidden":!0,className:`oc-conn__sort-idle`})]})})}function bn({r:e}){let t=K(e)?W(e.lastErrorCode):null,n=an(e)?W(e.lastDownstreamRejectCode):null,r=on(e)?W(e.lastLocalRefusalCode):null;return(0,Q.jsxs)(G.Fragment,{children:[(0,Q.jsxs)(H,{className:`oc-conn__row oc-conn__row--${e.state}`,children:[(0,Q.jsx)(U,{children:(0,Q.jsx)(`code`,{className:`oc-traces__mono`,children:e.targetLabel})}),(0,Q.jsx)(U,{children:(0,Q.jsx)(Sn,{state:e.state})}),(0,Q.jsx)(U,{children:e.instanceLabel?(0,Q.jsx)(`span`,{className:`oc-bridge-target__instance`,children:e.instanceLabel}):(0,Q.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})}),(0,Q.jsx)(U,{children:(0,Q.jsx)(`span`,{className:`oc-bridge-target__host`,children:e.gatewayHost})}),(0,Q.jsx)(U,{children:e.gatewayVersion?(0,Q.jsx)(`span`,{className:`oc-bridge-target__version`,children:e.gatewayVersion}):(0,Q.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})}),(0,Q.jsx)(U,{children:(0,Q.jsx)(`span`,{className:`oc-conn__stats`,children:Xe({ok:e.okCount,errors:e.errorCount,attempts:e.attempts})})}),(0,Q.jsx)(U,{children:e.lastOkAt?(0,Q.jsx)(`span`,{className:`oc-traces__mono`,children:F(e.lastOkAt)}):(0,Q.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})})]}),sn(e)?(0,Q.jsx)(H,{className:`oc-conn__detail-row`,children:(0,Q.jsxs)(U,{colSpan:7,className:`oc-conn__detail-cell`,children:[t?(0,Q.jsxs)(`div`,{className:`oc-bridge-target__error`,children:[(0,Q.jsx)(`strong`,{children:t.label}),` `,(0,Q.jsx)(`code`,{className:`oc-traces__mono`,children:e.lastErrorCode}),e.lastErrorAt?` · ${F(e.lastErrorAt)}`:``,(0,Q.jsx)(`p`,{className:`oc-bridge-card__hint`,children:t.hint})]}):null,r?(0,Q.jsxs)(`div`,{className:`oc-bridge-target__downstream`,children:[Ee({label:r.label}),` `,(0,Q.jsx)(`code`,{className:`oc-traces__mono`,children:e.lastLocalRefusalCode}),e.lastLocalRefusalAt?` · ${F(e.lastLocalRefusalAt)}`:``,(0,Q.jsx)(`p`,{className:`oc-bridge-card__hint`,children:r.hint})]}):null,n?(0,Q.jsxs)(`div`,{className:`oc-bridge-target__downstream`,children:[he({label:n.label}),` `,(0,Q.jsx)(`code`,{className:`oc-traces__mono`,children:e.lastDownstreamRejectCode}),e.lastDownstreamRejectAt?` · ${F(e.lastDownstreamRejectAt)}`:``]}):null]})}):null]})}function xn(e){return e===`connected`?Qe():e===`error`?w():C()}function Sn({state:e}){return e===`connected`?(0,Q.jsx)(k,{variant:`secondary`,children:Qe()}):e===`error`?(0,Q.jsx)(k,{variant:`destructive`,children:w()}):(0,Q.jsx)(k,{variant:`outline`,children:C()})}function Cn(){return x(T.bridgeHealth.getBridgeHealth,{})}function wn(){let e=Cn(),t=x(T.compat.getBridgeCompat,{}),n=x(T.me.getMe,{host:Nt})?.role===`admin`,r=x(T.admin.listInstances,n?{}:`skip`),i=x(T.agents.usageForInstances,n?{}:`skip`),a=P(),o=()=>void a({to:`/settings/anomalies`,search:{status:`open`}}),s=ln(e?e.targets:[],t?t.targets:[],r??[]),{section:c}=Mt({from:`/settings/bridge`}),l=P({from:`/settings/bridge`}),u=t?.compat??null,d=t===void 0?`loading`:t===null?`nodata`:`ready`,f=u!==null&&Xt(u,`hermes`)&&!s.some(e=>e.key===`hermes`);return(0,Q.jsxs)(`div`,{className:`oc-bridge`,children:[(0,Q.jsx)(Tn,{health:e,compat:t,onSeeAnomalies:o}),(0,Q.jsx)(`p`,{className:`oc-admin__hint oc-bridge__caption`,children:je()}),i&&i.length>0?(0,Q.jsxs)(`section`,{className:`oc-bridge__usage`,children:[(0,Q.jsx)(`h3`,{className:`oc-bridge__usage-title`,children:Pe()}),(0,Q.jsxs)(Wt,{children:[(0,Q.jsx)(Ht,{children:(0,Q.jsxs)(H,{children:[(0,Q.jsx)(V,{children:Re()}),(0,Q.jsx)(V,{children:Ne()}),(0,Q.jsx)(V,{children:Ie()}),(0,Q.jsx)(V,{children:ie()}),(0,Q.jsx)(V,{children:rt()})]})}),(0,Q.jsx)(Ut,{children:i.flatMap(e=>{let t=Tt(e.usage,Date.now());return t?t.windows.map((t,n)=>(0,Q.jsxs)(H,{children:[(0,Q.jsx)(U,{className:`font-medium`,children:n===0?e.instanceName:``}),(0,Q.jsx)(U,{children:t.provider}),(0,Q.jsx)(U,{children:t.label}),(0,Q.jsx)(U,{children:(0,Q.jsxs)(k,{variant:t.percentLeft<=10?`destructive`:t.percentLeft<=25?`outline`:`secondary`,children:[t.percentLeft,`%`]})}),(0,Q.jsx)(U,{className:`text-muted-foreground`,children:t.resetText??`—`})]},`${e.instanceName}:${t.provider}:${t.label}`)):[]})})]})]}):null,s.length>0?(0,Q.jsxs)(Pt,{value:s.some(e=>e.key===c)?c:s[0]?.key??`openclaw`,onValueChange:e=>void l({search:{section:e},replace:!0}),children:[(0,Q.jsx)(Lt,{className:`w-full`,children:s.map(e=>(0,Q.jsxs)(zt,{value:e.key,className:`flex-1 gap-1.5`,children:[(0,Q.jsx)(A,{size:13,"aria-hidden":!0}),J(e.key)]},e.key))}),s.map(e=>(0,Q.jsx)(At,{value:e.key,children:(0,Q.jsx)(En,{providerKey:e.key,connections:e.connections,instances:e.instances,manifest:u,compatStatus:d,compatReachable:t?.reachable??!0,protocol:e.key===`openclaw`?t?.protocol??null:null})},e.key))]}):null,f?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:de()}):null]})}function Tn({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,Q.jsxs)(`span`,{className:`oc-bridge-card__ver`,children:[(0,Q.jsx)(`code`,{className:`oc-traces__mono`,children:Yt(t.bridgeVersion)}),i?(0,Q.jsxs)(Q.Fragment,{children:[` `,(0,Q.jsxs)(`code`,{className:`oc-traces__mono`,title:re(),children:[`(`,i,`)`]})]}):null,r?(0,Q.jsxs)(`strong`,{className:`oc-bridge-card__mismatch`,children:[` `,nt({build:t.buildVersion??`?`})]}):null,` · `,oe(),` `,(0,Q.jsx)(`code`,{className:`oc-traces__mono`,children:t.protocolVersion===null?h():String(t.protocolVersion)})]}):null;if(e===void 0)return(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:S()});if(e===null)return(0,Q.jsx)(`div`,{className:`oc-bridge-card oc-bridge-card--idle`,children:a()});let s=tn(e.targets),c=!e.reachable,l=rn(e),u=e.unreachableInstances??[],d=l===`ok`?`ok`:l===`gateways_unreachable`?`warn`:`error`,f=xt(e.checkedAt),m=e.startedAt==null?null:xt(e.startedAt);return(0,Q.jsxs)(`div`,{className:`oc-bridge-card oc-bridge-card--${d}`,children:[(0,Q.jsx)(`div`,{className:`oc-bridge-card__icon`,"aria-hidden":!0,children:l===`ok`?(0,Q.jsx)(M,{size:22}):c||l===`gateways_unreachable`?(0,Q.jsx)(en,{size:22}):(0,Q.jsx)(I,{size:22})}),(0,Q.jsxs)(`div`,{className:`oc-bridge-card__body`,children:[(0,Q.jsx)(`div`,{className:`oc-bridge-card__title`,children:l===`ok`?ft():l===`gateways_unreachable`?p({count:u.length}):c?ve():ce({count:s.length})}),(0,Q.jsxs)(`div`,{className:`oc-bridge-card__meta`,children:[(0,Q.jsxs)(`span`,{children:[(0,Q.jsx)($t,{size:12,"aria-hidden":!0}),` `,y({time:f})]}),m?(0,Q.jsx)(`span`,{children:pe({time:m})}):null,o]}),l===`gateways_unreachable`?(0,Q.jsx)(`p`,{className:`oc-bridge-card__hint`,children:ge({names:u.join(`, `)})}):null,c?(0,Q.jsx)(`p`,{className:`oc-bridge-card__hint`,children:W(e.lastError===`not_configured`?`NOT_CONFIGURED`:`BRIDGE_UNREACHABLE`).hint}):null]}),(0,Q.jsx)(`button`,{type:`button`,className:`oc-bridgebar__drill`,onClick:n,children:ue()})]})}function En({providerKey:e,connections:t,instances:n,manifest:r,compatStatus:i,compatReachable:a,protocol:o}){let s=r?Kt(r,e):null,c=new Map;for(let e of n)c.set(e.name,e.displayName??e.name);let l=[],u=new Set;for(let n of t){if(!n.instanceName||u.has(n.instanceName))continue;u.add(n.instanceName);let t=n.gatewayVersion??null;l.push({instanceName:n.instanceName,displayName:c.get(n.instanceName)??n.instanceName,version:t,state:Jt(t,e,r)})}let d=Qt(l.map(e=>e.state)),[f,p]=(0,G.useState)(!1);return(0,Q.jsxs)(`section`,{className:`oc-bridge-provider`,children:[(0,Q.jsxs)(`header`,{className:`oc-bridge-provider__head`,children:[(0,Q.jsx)(A,{size:15,"aria-hidden":!0,className:`oc-bridge-provider__icon`}),(0,Q.jsx)(`span`,{className:`oc-bridge-provider__name`,children:J(e)}),d?(0,Q.jsx)(k,{variant:d===`beyond`||d===`defective`||d===`unsupported`?`destructive`:`secondary`,children:qt(d)}):null]}),(0,Q.jsx)(`h4`,{className:`oc-bridge-provider__sub`,children:Me()}),(0,Q.jsx)(On,{providerName:J(e),support:s,compatStatus:i,compatReachable:a,manifest:r,instanceRows:l}),o?(0,Q.jsx)(Dn,{protocol:o}):null,(0,Q.jsxs)(`button`,{type:`button`,className:`oc-bridge-provider__sub oc-bridge-provider__sub--toggle`,"aria-expanded":f,onClick:()=>p(e=>!e),children:[f?(0,Q.jsx)(E,{size:13,"aria-hidden":!0}):(0,Q.jsx)(L,{size:13,"aria-hidden":!0}),Ye({count:t.length})]}),f?(0,Q.jsx)(yn,{connections:t,displayByInstance:c}):null]})}function Dn({protocol:e}){let[t,n]=(0,G.useState)(!1),r=e.coverage,i=e.drift??[],a=(e.driftOverflow??0)+(e.driftTruncated??0);return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`h4`,{className:`oc-bridge-provider__sub`,children:[b(),i.length>0?(0,Q.jsx)(k,{variant:`destructive`,children:ae({count:i.length})}):a>0?(0,Q.jsx)(k,{variant:`destructive`,children:m()}):(0,Q.jsx)(k,{variant:`secondary`,children:tt()})]}),(0,Q.jsxs)(`p`,{className:`oc-admin__hint`,children:[ke({version:e.vendoredVersion}),r?` · `+Ce({handled:r.handled,ignored:r.ignored,gaps:r.gaps}):null]}),a>0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:Ue({overflow:e.driftOverflow??0,truncated:e.driftTruncated??0})}):null,i.length>0?(0,Q.jsx)(`ul`,{className:`oc-bridge-protocol__list`,role:`list`,children:i.map(e=>(0,Q.jsxs)(`li`,{children:[(0,Q.jsx)(`code`,{className:`oc-traces__mono`,children:e.shape}),` × `,e.count]},e.shape))}):null,r&&r.gapList.length>0?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`button`,{type:`button`,className:`oc-bridge-provider__sub oc-bridge-provider__sub--toggle`,"aria-expanded":t,onClick:()=>n(e=>!e),children:[t?(0,Q.jsx)(E,{size:13,"aria-hidden":!0}):(0,Q.jsx)(L,{size:13,"aria-hidden":!0}),_({count:r.gapList.length})]}),t?(0,Q.jsx)(`ul`,{className:`oc-bridge-protocol__list`,role:`list`,children:r.gapList.map(e=>(0,Q.jsx)(`li`,{children:(0,Q.jsx)(`code`,{className:`oc-traces__mono`,children:e})},e))}):null]}):null]})}function On({support:e,compatStatus:t,compatReachable:n,manifest:r,instanceRows:i,providerName:a}){return t===`loading`?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:S()}):t===`nodata`?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:Fe()}):(0,Q.jsxs)(`div`,{className:`oc-compat`,children:[n?null:(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:Ae()}),r===null?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:we()}):(0,Q.jsxs)(`div`,{className:`oc-compat__support`,children:[(0,Q.jsx)(`span`,{className:`oc-compat__label`,children:Ge({provider:a})}),e&&e.range!==null?(0,Q.jsx)(`span`,{children:v({min:e.range.min,max:e.range.maxValidated})}):(0,Q.jsx)(`span`,{children:h()}),e?(0,Q.jsx)(Mn,{versions:e.validatedVersions}):null]}),i.length===0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:ye()}):(0,Q.jsx)(`div`,{className:`oc-compat__targets`,children:i.map(e=>(0,Q.jsxs)(`div`,{className:`oc-compat__target`,children:[(0,Q.jsx)(`span`,{className:`oc-compat__instance`,children:e.displayName}),(0,Q.jsx)(`code`,{className:`oc-traces__mono`,children:Yt(e.version)}),(0,Q.jsx)(k,{variant:e.state===`supported`?`secondary`:e.state===`beyond`||e.state===`defective`||e.state===`unsupported`?`destructive`:`outline`,children:qt(e.state)})]},e.instanceName))})]})}function kn({instance:e,onClose:t}){return(0,Q.jsx)(St,{open:!0,onOpenChange:e=>!e&&t(),children:(0,Q.jsxs)(Bt,{className:`oc-bridge-config-dialog`,onOpenAutoFocus:e=>e.preventDefault(),children:[(0,Q.jsxs)(Ct,{children:[(0,Q.jsx)(Dt,{children:se({instance:e.displayName??e.name})}),(0,Q.jsx)(Ot,{children:g()})]}),(0,Q.jsx)(jn,{instance:e,onClose:t})]})})}function An({label:e,result:t}){return t?t.checked?(0,Q.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,Q.jsx)(M,{"aria-hidden":!0}):(0,Q.jsx)(I,{"aria-hidden":!0}),(0,Q.jsxs)(`span`,{children:[e,` — `,t.ok?We():t.detail]})]}):(0,Q.jsxs)(`p`,{className:`oc-bridge-config__check-row oc-bridge-config__check-row--skip`,children:[e,` — `,r()]}):null}function jn({instance:e,onClose:t}){let n=ee(T.admin.upsertInstanceConfig),r=o(T.bridge.validateMediaPaths),i=kt(),a=Vt(e.config?.contentLocale,void 0),[s,l]=(0,G.useState)(()=>gt(e.config??{},a)),[u,d]=(0,G.useState)(!1),[f,p]=(0,G.useState)(!1),[m,h]=(0,G.useState)(null),g=s.inboundMediaMode===`shared-fs`,_=s.mediaMode===`shared-fs`,v=g||_;async function y(){p(!0),h(null);try{h(await r({instanceName:e.name,inboundMediaMode:s.inboundMediaMode,mediaMode:s.mediaMode}))}catch(e){i.error(Je(),e)}finally{p(!1)}}async function b(){d(!0);try{let r=e.config??{};await n({instanceId:e._id,config:vt(s,r,a)}),t()}catch(e){i.error(be(),e)}finally{d(!1)}}return(0,Q.jsx)(`div`,{className:`oc-bridge-config`,children:(0,Q.jsxs)(`div`,{className:`oc-bridge-config__form`,children:[(0,Q.jsxs)(`div`,{className:`oc-bridge-config__grid`,children:[(0,Q.jsxs)(`label`,{className:`oc-field`,children:[(0,Q.jsx)(D,{label:Te(),help:le()}),(0,Q.jsxs)(R,{value:s.mediaMode,onValueChange:e=>l({...s,mediaMode:e}),children:[(0,Q.jsx)(z,{size:`sm`,className:`w-full`,children:(0,Q.jsx)(j,{})}),(0,Q.jsx)(B,{children:yt.map(e=>(0,Q.jsx)(N,{value:e,children:e},e))})]})]}),(0,Q.jsxs)(`label`,{className:`oc-field`,children:[(0,Q.jsx)(D,{label:te(),help:ne()}),(0,Q.jsxs)(R,{value:s.inboundMediaMode,onValueChange:e=>l({...s,inboundMediaMode:e}),children:[(0,Q.jsx)(z,{size:`sm`,className:`w-full`,children:(0,Q.jsx)(j,{})}),(0,Q.jsx)(B,{children:_t.map(e=>(0,Q.jsx)(N,{value:e,children:e},e))})]})]}),(0,Q.jsxs)(`label`,{className:`oc-field`,children:[(0,Q.jsx)(D,{label:Oe(),help:me()}),(0,Q.jsx)(O,{type:`number`,min:1,max:4096,className:`w-full`,value:s.mediaMaxMb,onChange:e=>l({...s,mediaMaxMb:Math.trunc(Number(e.target.value)||0)})})]})]}),v&&(0,Q.jsxs)(`div`,{className:`oc-bridge-config__grid`,children:[g&&(0,Q.jsxs)(`label`,{className:`oc-field`,children:[(0,Q.jsx)(D,{label:st(),help:Ze()}),(0,Q.jsx)(O,{className:`w-full`,spellCheck:!1,value:s.inboundAgentMount,onChange:e=>l({...s,inboundAgentMount:e.target.value})})]}),_&&(0,Q.jsxs)(`label`,{className:`oc-field`,children:[(0,Q.jsx)(D,{label:He(),help:at()}),(0,Q.jsx)(O,{className:`w-full`,spellCheck:!1,value:s.outboundAgentMount,onChange:e=>l({...s,outboundAgentMount:e.target.value})})]})]}),(0,Q.jsxs)(`label`,{className:`oc-field--row`,children:[(0,Q.jsx)(Et,{checked:s.rehydration,onCheckedChange:e=>l({...s,rehydration:e===!0})}),(0,Q.jsx)(D,{label:c(),help:fe()})]}),v&&m!==null&&(0,Q.jsx)(`div`,{className:`oc-bridge-config__check`,children:m.reachable?!m.inbound&&!m.outbound?(0,Q.jsxs)(`p`,{className:`oc-bridge-config__check-row oc-bridge-config__check-row--err`,children:[(0,Q.jsx)(I,{"aria-hidden":!0}),Le({reason:m.reason??`?`})]}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(An,{label:$e(),result:m.inbound}),(0,Q.jsx)(An,{label:ot(),result:m.outbound}),(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:it()})]}):(0,Q.jsxs)(`p`,{className:`oc-bridge-config__check-row oc-bridge-config__check-row--err`,children:[(0,Q.jsx)(I,{"aria-hidden":!0}),_e()]})}),(0,Q.jsxs)(`div`,{className:`oc-bridge-config__actions`,children:[v&&(0,Q.jsxs)(bt,{variant:`outline`,size:`sm`,onClick:()=>void y(),disabled:f,children:[f?(0,Q.jsx)(wt,{className:`size-4 animate-spin`,"aria-hidden":!0}):null,f?Be():et()]}),(0,Q.jsx)(bt,{size:`sm`,onClick:()=>void b(),disabled:u,children:mt()})]})]})})}function Mn({versions:e}){if(e.length===0)return null;let t=[...e].reverse();return(0,Q.jsxs)(Ft,{children:[(0,Q.jsx)(jt,{asChild:!0,children:(0,Q.jsxs)(`button`,{type:`button`,className:`oc-compat__versions-btn`,children:[e.length===1?De():s({count:e.length}),(0,Q.jsx)(E,{size:13,"aria-hidden":!0})]})}),(0,Q.jsxs)(Rt,{className:`oc-compat__versions-pop`,align:`start`,children:[(0,Q.jsx)(`p`,{className:`oc-compat__versions-title`,children:pt()}),(0,Q.jsx)(`div`,{className:`oc-compat__versions-list`,children:t.map(e=>(0,Q.jsx)(k,{variant:`secondary`,children:e},e))})]})]})}export{wn as BridgeTab,kn as InstanceConfigDialog};
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$O as r,AO as i,BO as a,BY as o,Bg as s,Bk as c,CO as l,DO as u,E as d,EO as f,FO as p,GO as m,Gg as h,Gk as g,HO as _,HY as ee,Hg as v,Hk as te,IO as y,Ik as ne,JO as b,Jg as re,Jl as ie,KO as ae,Kg as oe,Kk as se,LO as ce,Lk as le,MO as ue,Mg as de,Mk as fe,NO as pe,Nk as me,OO as he,PO as ge,QO as _e,RO as ve,Rg as ye,Rk as be,SO as xe,TO as Se,UO as Ce,UY as x,Ug as we,Uk as Te,VO as S,Va as Ee,Vg as De,Vk as Oe,WO as ke,Wg as Ae,XO as je,Xg as Me,Xl as Ne,YO as Pe,Yg as Fe,Yl as Ie,ZO as Le,Zl as Re,_O as ze,ak as Be,bO as Ve,ck as He,cs as Ue,ek as We,eu as Ge,fO as C,gO as Ke,hO as qe,ik as Je,jO as Ye,kO as Xe,lk as Ze,mO as Qe,nk as $e,ok as et,pO as w,qO as tt,qg as nt,ql as rt,rk as it,sk as at,t as T,tk as ot,uk as st,vO as ct,wO as lt,xO as ut,yO as dt,zO as ft,zg as pt,zk as mt}from"./api-Da6_RPKW.js";import{r as E}from"./dist-C5rZMbyx.js";import{t as ht}from"./chevrons-up-down-BJ8yWoBT.js";import{i as gt,n as D,o as _t,r as vt,s as yt}from"./FieldLabel-By4I98vO.js";import{t as bt}from"./button-DezjmYbu.js";import{$t as O,At as xt,Ct as St,Dt as Ct,Jn as wt,Jt as k,L as Tt,Mt as Et,Ot as Dt,Pn as A,St as j,Tt as Ot,Yt as kt,ar as M,at as At,bt as N,cn as jt,dr as P,fr as Mt,ft as Nt,it as Pt,jt as F,kn as I,on as Ft,or as It,ot as Lt,sn as Rt,sr as L,st as zt,vt as R,wt as Bt,xt as z,yt as B}from"./index-BcCFgPG0.js";import{r as Vt}from"./locales-CPjguROj.js";import{a as Ht,i as V,n as Ut,o as H,r as U,t as Wt}from"./table-CFBr2AAN.js";import{t as Gt}from"./FilterBar-CF8kYMRM.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-Dvj8v6B1.js";import{t as W}from"./dispatchErrorInfo-CMB-D8cW.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`}]]),G=t(e(),1);function tn(e){return e.filter(e=>e.state===`error`)}function nn(e){return e.reachable&&tn(e.targets).length===0}function rn(e){return nn(e)?(e.unreachableInstances??[]).length>0?`gateways_unreachable`:`ok`:`error`}function K(e){return e.state===`error`&&e.lastErrorCode!==null}function an(e){return!!e.lastDownstreamRejectCode}function on(e){return!!e.lastLocalRefusalCode}function sn(e){return K(e)||an(e)||on(e)}function q(e){return e.kind??`openclaw`}function cn(e){return[...e].sort((e,t)=>e===`openclaw`?-1:t===`openclaw`?1:e.localeCompare(t))}function ln(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,q(e));let i=e=>(e.instanceName?r.get(e.instanceName):void 0)??`openclaw`,a=new Set;for(let e of n)a.add(q(e));for(let e of t)a.add(e.provider);for(let t of e)a.add(i(t));return cn(a).map(r=>({key:r,connections:e.filter(e=>i(e)===r),compatTargets:t.filter(e=>e.provider===r),instances:n.filter(e=>q(e)===r)}))}function J(e){return e===`openclaw`?`OpenClaw`:e===`hermes`?`Hermes`:e.charAt(0).toUpperCase()+e.slice(1)}var Y=`__all__`,un={q:``,state:Y,instance:Y,version:Y},X={connected:0,error:1,idle:2};function dn(e){return e.q.trim()!==``||e.state!==`__all__`||e.instance!==`__all__`||e.version!==`__all__`}function fn(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 Z(e,t){return e.localeCompare(t,void 0,{numeric:!0,sensitivity:`base`})}function pn(e,t){return e===`version`?t.gatewayVersion===null:e===`lastOk`?t.lastOkAt===null:!1}function mn(e,t,n){switch(e){case`state`:return(X[t.state]??99)-(X[n.state]??99);case`instance`:return Z(t.instanceLabel??t.instanceName??``,n.instanceLabel??n.instanceName??``);case`host`:return Z(t.gatewayHost,n.gatewayHost);case`version`:{let e=t.gatewayVersion,r=n.gatewayVersion;return Zt(e,r)??Z(e,r)}case`lastOk`:return t.lastOkAt-n.lastOkAt;default:return Z(t.targetLabel,n.targetLabel)}}function hn(e,t){if(!t)return e;let n=t.dir===`asc`?1:-1;return[...e].sort((e,r)=>{let i=pn(t.key,e),a=pn(t.key,r);return i&&a?0:i?1:a?-1:n*mn(t.key,e,r)})}function gn(e){let t=new Set;for(let n of e)t.add(n.state);return[...t].sort((e,t)=>(X[e]??99)-(X[t]??99))}function _n(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)=>Z(e.label,t.label))}function vn(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)??Z(e,t))}var Q=n();function yn({connections:e,displayByInstance:t}){let[n,r]=(0,G.useState)(un),[a,o]=(0,G.useState)(null),s=(0,G.useMemo)(()=>e.map((e,n)=>({_id:`${e.key}:${e.canonical}/${e.agentId}:${n}`,targetLabel:`${e.canonical}/${e.agentId}`,state:e.state,instanceName:e.instanceName??null,instanceLabel:e.instanceName?t.get(e.instanceName)??e.instanceName:null,gatewayHost:e.gatewayHost,gatewayVersion:e.gatewayVersion??null,okCount:e.okCount,errorCount:e.errorCount+(e.downstreamRejectCount??0)+(e.localRefusalCount??0),attempts:e.attempts,lastOkAt:e.lastOkAt??null,lastErrorCode:e.lastErrorCode??null,lastErrorAt:e.lastErrorAt??null,lastDownstreamRejectCode:e.lastDownstreamRejectCode??null,lastDownstreamRejectAt:e.lastDownstreamRejectAt??null,lastLocalRefusalCode:e.lastLocalRefusalCode??null,lastLocalRefusalAt:e.lastLocalRefusalAt??null})),[e,t]),c=(0,G.useMemo)(()=>gn(s),[s]),d=(0,G.useMemo)(()=>_n(s),[s]),p=(0,G.useMemo)(()=>vn(s),[s]),m=(0,G.useMemo)(()=>hn(fn(s,n),a),[s,n,a]);function h(e){o(t=>t?.key===e?t.dir===`asc`?{key:e,dir:`desc`}:null:{key:e,dir:`asc`})}return e.length===0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:i()}):(0,Q.jsxs)(`div`,{className:`oc-conn`,children:[(0,Q.jsxs)(Gt,{q:n.q,onQChange:e=>r(t=>({...t,q:e})),searchPlaceholder:u(),onReset:()=>r(un),canReset:dn(n),children:[(0,Q.jsxs)(R,{value:n.state,onValueChange:e=>r(t=>({...t,state:e})),children:[(0,Q.jsx)(z,{size:`sm`,className:`w-36`,children:(0,Q.jsx)(j,{placeholder:Se()})}),(0,Q.jsxs)(B,{children:[(0,Q.jsx)(N,{value:Y,children:f()}),c.map(e=>(0,Q.jsx)(N,{value:e,children:xn(e)},e))]})]}),(0,Q.jsxs)(R,{value:n.instance,onValueChange:e=>r(t=>({...t,instance:e})),children:[(0,Q.jsx)(z,{size:`sm`,className:`w-40`,children:(0,Q.jsx)(j,{placeholder:lt()})}),(0,Q.jsxs)(B,{children:[(0,Q.jsx)(N,{value:Y,children:f()}),d.map(e=>(0,Q.jsx)(N,{value:e.name,children:e.label},e.name))]})]}),(0,Q.jsxs)(R,{value:n.version,onValueChange:e=>r(t=>({...t,version:e})),children:[(0,Q.jsx)(z,{size:`sm`,className:`w-36`,children:(0,Q.jsx)(j,{placeholder:l()})}),(0,Q.jsxs)(B,{children:[(0,Q.jsx)(N,{value:Y,children:f()}),p.map(e=>(0,Q.jsx)(N,{value:e,children:e},e))]})]})]}),m.length===0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:xe()}):(0,Q.jsxs)(Wt,{className:`oc-conn__table`,children:[(0,Q.jsx)(Ht,{children:(0,Q.jsxs)(H,{children:[(0,Q.jsx)($,{label:ut(),sortKey:`target`,sort:a,onSort:h}),(0,Q.jsx)($,{label:Ve(),sortKey:`state`,sort:a,onSort:h}),(0,Q.jsx)($,{label:dt(),sortKey:`instance`,sort:a,onSort:h}),(0,Q.jsx)($,{label:ct(),sortKey:`host`,sort:a,onSort:h}),(0,Q.jsx)($,{label:ze(),sortKey:`version`,sort:a,onSort:h}),(0,Q.jsx)(V,{children:Ke()}),(0,Q.jsx)($,{label:qe(),sortKey:`lastOk`,sort:a,onSort:h})]})}),(0,Q.jsx)(Ut,{children:m.map(e=>(0,Q.jsx)(bn,{r:e},e._id))})]})]})}function $({label:e,sortKey:t,sort:n,onSort:r}){let i=n?.key===t,a=i?n.dir:null;return(0,Q.jsx)(V,{"aria-sort":i?a===`asc`?`ascending`:`descending`:`none`,children:(0,Q.jsxs)(`button`,{type:`button`,className:`oc-conn__sort`,onClick:()=>r(t),children:[e,i?a===`asc`?(0,Q.jsx)(It,{size:13,"aria-hidden":!0}):(0,Q.jsx)(E,{size:13,"aria-hidden":!0}):(0,Q.jsx)(ht,{size:13,"aria-hidden":!0,className:`oc-conn__sort-idle`})]})})}function bn({r:e}){let t=K(e)?W(e.lastErrorCode):null,n=an(e)?W(e.lastDownstreamRejectCode):null,r=on(e)?W(e.lastLocalRefusalCode):null;return(0,Q.jsxs)(G.Fragment,{children:[(0,Q.jsxs)(H,{className:`oc-conn__row oc-conn__row--${e.state}`,children:[(0,Q.jsx)(U,{children:(0,Q.jsx)(`code`,{className:`oc-traces__mono`,children:e.targetLabel})}),(0,Q.jsx)(U,{children:(0,Q.jsx)(Sn,{state:e.state})}),(0,Q.jsx)(U,{children:e.instanceLabel?(0,Q.jsx)(`span`,{className:`oc-bridge-target__instance`,children:e.instanceLabel}):(0,Q.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})}),(0,Q.jsx)(U,{children:(0,Q.jsx)(`span`,{className:`oc-bridge-target__host`,children:e.gatewayHost})}),(0,Q.jsx)(U,{children:e.gatewayVersion?(0,Q.jsx)(`span`,{className:`oc-bridge-target__version`,children:e.gatewayVersion}):(0,Q.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})}),(0,Q.jsx)(U,{children:(0,Q.jsx)(`span`,{className:`oc-conn__stats`,children:Xe({ok:e.okCount,errors:e.errorCount,attempts:e.attempts})})}),(0,Q.jsx)(U,{children:e.lastOkAt?(0,Q.jsx)(`span`,{className:`oc-traces__mono`,children:F(e.lastOkAt)}):(0,Q.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})})]}),sn(e)?(0,Q.jsx)(H,{className:`oc-conn__detail-row`,children:(0,Q.jsxs)(U,{colSpan:7,className:`oc-conn__detail-cell`,children:[t?(0,Q.jsxs)(`div`,{className:`oc-bridge-target__error`,children:[(0,Q.jsx)(`strong`,{children:t.label}),` `,(0,Q.jsx)(`code`,{className:`oc-traces__mono`,children:e.lastErrorCode}),e.lastErrorAt?` · ${F(e.lastErrorAt)}`:``,(0,Q.jsx)(`p`,{className:`oc-bridge-card__hint`,children:t.hint})]}):null,r?(0,Q.jsxs)(`div`,{className:`oc-bridge-target__downstream`,children:[Ee({label:r.label}),` `,(0,Q.jsx)(`code`,{className:`oc-traces__mono`,children:e.lastLocalRefusalCode}),e.lastLocalRefusalAt?` · ${F(e.lastLocalRefusalAt)}`:``,(0,Q.jsx)(`p`,{className:`oc-bridge-card__hint`,children:r.hint})]}):null,n?(0,Q.jsxs)(`div`,{className:`oc-bridge-target__downstream`,children:[he({label:n.label}),` `,(0,Q.jsx)(`code`,{className:`oc-traces__mono`,children:e.lastDownstreamRejectCode}),e.lastDownstreamRejectAt?` · ${F(e.lastDownstreamRejectAt)}`:``]}):null]})}):null]})}function xn(e){return e===`connected`?Qe():e===`error`?w():C()}function Sn({state:e}){return e===`connected`?(0,Q.jsx)(k,{variant:`secondary`,children:Qe()}):e===`error`?(0,Q.jsx)(k,{variant:`destructive`,children:w()}):(0,Q.jsx)(k,{variant:`outline`,children:C()})}function Cn(){return x(T.bridgeHealth.getBridgeHealth,{})}function wn(){let e=Cn(),t=x(T.compat.getBridgeCompat,{}),n=x(T.me.getMe,{host:Nt})?.role===`admin`,r=x(T.admin.listInstances,n?{}:`skip`),i=x(T.agents.usageForInstances,n?{}:`skip`),a=P(),o=()=>void a({to:`/settings/anomalies`,search:{status:`open`}}),s=ln(e?e.targets:[],t?t.targets:[],r??[]),{section:c}=Mt({from:`/settings/bridge`}),l=P({from:`/settings/bridge`}),u=t?.compat??null,d=t===void 0?`loading`:t===null?`nodata`:`ready`,f=u!==null&&Xt(u,`hermes`)&&!s.some(e=>e.key===`hermes`);return(0,Q.jsxs)(`div`,{className:`oc-bridge`,children:[(0,Q.jsx)(Tn,{health:e,compat:t,onSeeAnomalies:o}),(0,Q.jsx)(`p`,{className:`oc-admin__hint oc-bridge__caption`,children:je()}),i&&i.length>0?(0,Q.jsxs)(`section`,{className:`oc-bridge__usage`,children:[(0,Q.jsx)(`h3`,{className:`oc-bridge__usage-title`,children:Pe()}),(0,Q.jsxs)(Wt,{children:[(0,Q.jsx)(Ht,{children:(0,Q.jsxs)(H,{children:[(0,Q.jsx)(V,{children:Re()}),(0,Q.jsx)(V,{children:Ne()}),(0,Q.jsx)(V,{children:Ie()}),(0,Q.jsx)(V,{children:ie()}),(0,Q.jsx)(V,{children:rt()})]})}),(0,Q.jsx)(Ut,{children:i.flatMap(e=>{let t=Tt(e.usage,Date.now());return t?t.windows.map((t,n)=>(0,Q.jsxs)(H,{children:[(0,Q.jsx)(U,{className:`font-medium`,children:n===0?e.instanceName:``}),(0,Q.jsx)(U,{children:t.provider}),(0,Q.jsx)(U,{children:t.label}),(0,Q.jsx)(U,{children:(0,Q.jsxs)(k,{variant:t.percentLeft<=10?`destructive`:t.percentLeft<=25?`outline`:`secondary`,children:[t.percentLeft,`%`]})}),(0,Q.jsx)(U,{className:`text-muted-foreground`,children:t.resetText??`—`})]},`${e.instanceName}:${t.provider}:${t.label}`)):[]})})]})]}):null,s.length>0?(0,Q.jsxs)(Pt,{value:s.some(e=>e.key===c)?c:s[0]?.key??`openclaw`,onValueChange:e=>void l({search:{section:e},replace:!0}),children:[(0,Q.jsx)(Lt,{className:`w-full`,children:s.map(e=>(0,Q.jsxs)(zt,{value:e.key,className:`flex-1 gap-1.5`,children:[(0,Q.jsx)(A,{size:13,"aria-hidden":!0}),J(e.key)]},e.key))}),s.map(e=>(0,Q.jsx)(At,{value:e.key,children:(0,Q.jsx)(En,{providerKey:e.key,connections:e.connections,instances:e.instances,manifest:u,compatStatus:d,compatReachable:t?.reachable??!0,protocol:e.key===`openclaw`?t?.protocol??null:null})},e.key))]}):null,f?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:de()}):null]})}function Tn({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,Q.jsxs)(`span`,{className:`oc-bridge-card__ver`,children:[(0,Q.jsx)(`code`,{className:`oc-traces__mono`,children:Yt(t.bridgeVersion)}),i?(0,Q.jsxs)(Q.Fragment,{children:[` `,(0,Q.jsxs)(`code`,{className:`oc-traces__mono`,title:re(),children:[`(`,i,`)`]})]}):null,r?(0,Q.jsxs)(`strong`,{className:`oc-bridge-card__mismatch`,children:[` `,nt({build:t.buildVersion??`?`})]}):null,` · `,oe(),` `,(0,Q.jsx)(`code`,{className:`oc-traces__mono`,children:t.protocolVersion===null?h():String(t.protocolVersion)})]}):null;if(e===void 0)return(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:S()});if(e===null)return(0,Q.jsx)(`div`,{className:`oc-bridge-card oc-bridge-card--idle`,children:a()});let s=tn(e.targets),c=!e.reachable,l=rn(e),u=e.unreachableInstances??[],d=l===`ok`?`ok`:l===`gateways_unreachable`?`warn`:`error`,f=xt(e.checkedAt),m=e.startedAt==null?null:xt(e.startedAt);return(0,Q.jsxs)(`div`,{className:`oc-bridge-card oc-bridge-card--${d}`,children:[(0,Q.jsx)(`div`,{className:`oc-bridge-card__icon`,"aria-hidden":!0,children:l===`ok`?(0,Q.jsx)(M,{size:22}):c||l===`gateways_unreachable`?(0,Q.jsx)(en,{size:22}):(0,Q.jsx)(I,{size:22})}),(0,Q.jsxs)(`div`,{className:`oc-bridge-card__body`,children:[(0,Q.jsx)(`div`,{className:`oc-bridge-card__title`,children:l===`ok`?ft():l===`gateways_unreachable`?p({count:u.length}):c?ve():ce({count:s.length})}),(0,Q.jsxs)(`div`,{className:`oc-bridge-card__meta`,children:[(0,Q.jsxs)(`span`,{children:[(0,Q.jsx)($t,{size:12,"aria-hidden":!0}),` `,y({time:f})]}),m?(0,Q.jsx)(`span`,{children:pe({time:m})}):null,o]}),l===`gateways_unreachable`?(0,Q.jsx)(`p`,{className:`oc-bridge-card__hint`,children:ge({names:u.join(`, `)})}):null,c?(0,Q.jsx)(`p`,{className:`oc-bridge-card__hint`,children:W(e.lastError===`not_configured`?`NOT_CONFIGURED`:`BRIDGE_UNREACHABLE`).hint}):null]}),(0,Q.jsx)(`button`,{type:`button`,className:`oc-bridgebar__drill`,onClick:n,children:ue()})]})}function En({providerKey:e,connections:t,instances:n,manifest:r,compatStatus:i,compatReachable:a,protocol:o}){let s=r?Kt(r,e):null,c=new Map;for(let e of n)c.set(e.name,e.displayName??e.name);let l=[],u=new Set;for(let n of t){if(!n.instanceName||u.has(n.instanceName))continue;u.add(n.instanceName);let t=n.gatewayVersion??null;l.push({instanceName:n.instanceName,displayName:c.get(n.instanceName)??n.instanceName,version:t,state:Jt(t,e,r)})}let d=Qt(l.map(e=>e.state)),[f,p]=(0,G.useState)(!1);return(0,Q.jsxs)(`section`,{className:`oc-bridge-provider`,children:[(0,Q.jsxs)(`header`,{className:`oc-bridge-provider__head`,children:[(0,Q.jsx)(A,{size:15,"aria-hidden":!0,className:`oc-bridge-provider__icon`}),(0,Q.jsx)(`span`,{className:`oc-bridge-provider__name`,children:J(e)}),d?(0,Q.jsx)(k,{variant:d===`beyond`||d===`defective`||d===`unsupported`?`destructive`:`secondary`,children:qt(d)}):null]}),(0,Q.jsx)(`h4`,{className:`oc-bridge-provider__sub`,children:Me()}),(0,Q.jsx)(On,{providerName:J(e),support:s,compatStatus:i,compatReachable:a,manifest:r,instanceRows:l}),o?(0,Q.jsx)(Dn,{protocol:o}):null,(0,Q.jsxs)(`button`,{type:`button`,className:`oc-bridge-provider__sub oc-bridge-provider__sub--toggle`,"aria-expanded":f,onClick:()=>p(e=>!e),children:[f?(0,Q.jsx)(E,{size:13,"aria-hidden":!0}):(0,Q.jsx)(L,{size:13,"aria-hidden":!0}),Ye({count:t.length})]}),f?(0,Q.jsx)(yn,{connections:t,displayByInstance:c}):null]})}function Dn({protocol:e}){let[t,n]=(0,G.useState)(!1),r=e.coverage,i=e.drift??[],a=(e.driftOverflow??0)+(e.driftTruncated??0);return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`h4`,{className:`oc-bridge-provider__sub`,children:[b(),i.length>0?(0,Q.jsx)(k,{variant:`destructive`,children:ae({count:i.length})}):a>0?(0,Q.jsx)(k,{variant:`destructive`,children:m()}):(0,Q.jsx)(k,{variant:`secondary`,children:tt()})]}),(0,Q.jsxs)(`p`,{className:`oc-admin__hint`,children:[ke({version:e.vendoredVersion}),r?` · `+Ce({handled:r.handled,ignored:r.ignored,gaps:r.gaps}):null]}),a>0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:Ue({overflow:e.driftOverflow??0,truncated:e.driftTruncated??0})}):null,i.length>0?(0,Q.jsx)(`ul`,{className:`oc-bridge-protocol__list`,role:`list`,children:i.map(e=>(0,Q.jsxs)(`li`,{children:[(0,Q.jsx)(`code`,{className:`oc-traces__mono`,children:e.shape}),` × `,e.count]},e.shape))}):null,r&&r.gapList.length>0?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`button`,{type:`button`,className:`oc-bridge-provider__sub oc-bridge-provider__sub--toggle`,"aria-expanded":t,onClick:()=>n(e=>!e),children:[t?(0,Q.jsx)(E,{size:13,"aria-hidden":!0}):(0,Q.jsx)(L,{size:13,"aria-hidden":!0}),_({count:r.gapList.length})]}),t?(0,Q.jsx)(`ul`,{className:`oc-bridge-protocol__list`,role:`list`,children:r.gapList.map(e=>(0,Q.jsx)(`li`,{children:(0,Q.jsx)(`code`,{className:`oc-traces__mono`,children:e})},e))}):null]}):null]})}function On({support:e,compatStatus:t,compatReachable:n,manifest:r,instanceRows:i,providerName:a}){return t===`loading`?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:S()}):t===`nodata`?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:Fe()}):(0,Q.jsxs)(`div`,{className:`oc-compat`,children:[n?null:(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:Ae()}),r===null?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:we()}):(0,Q.jsxs)(`div`,{className:`oc-compat__support`,children:[(0,Q.jsx)(`span`,{className:`oc-compat__label`,children:Ge({provider:a})}),e&&e.range!==null?(0,Q.jsx)(`span`,{children:v({min:e.range.min,max:e.range.maxValidated})}):(0,Q.jsx)(`span`,{children:h()}),e?(0,Q.jsx)(Mn,{versions:e.validatedVersions}):null]}),i.length===0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:ye()}):(0,Q.jsx)(`div`,{className:`oc-compat__targets`,children:i.map(e=>(0,Q.jsxs)(`div`,{className:`oc-compat__target`,children:[(0,Q.jsx)(`span`,{className:`oc-compat__instance`,children:e.displayName}),(0,Q.jsx)(`code`,{className:`oc-traces__mono`,children:Yt(e.version)}),(0,Q.jsx)(k,{variant:e.state===`supported`?`secondary`:e.state===`beyond`||e.state===`defective`||e.state===`unsupported`?`destructive`:`outline`,children:qt(e.state)})]},e.instanceName))})]})}function kn({instance:e,onClose:t}){return(0,Q.jsx)(St,{open:!0,onOpenChange:e=>!e&&t(),children:(0,Q.jsxs)(Bt,{className:`oc-bridge-config-dialog`,onOpenAutoFocus:e=>e.preventDefault(),children:[(0,Q.jsxs)(Ct,{children:[(0,Q.jsx)(Dt,{children:se({instance:e.displayName??e.name})}),(0,Q.jsx)(Ot,{children:g()})]}),(0,Q.jsx)(jn,{instance:e,onClose:t})]})})}function An({label:e,result:t}){return t?t.checked?(0,Q.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,Q.jsx)(M,{"aria-hidden":!0}):(0,Q.jsx)(I,{"aria-hidden":!0}),(0,Q.jsxs)(`span`,{children:[e,` — `,t.ok?We():t.detail]})]}):(0,Q.jsxs)(`p`,{className:`oc-bridge-config__check-row oc-bridge-config__check-row--skip`,children:[e,` — `,r()]}):null}function jn({instance:e,onClose:t}){let n=ee(T.admin.upsertInstanceConfig),r=o(T.bridge.validateMediaPaths),i=kt(),a=Vt(e.config?.contentLocale,void 0),[s,l]=(0,G.useState)(()=>gt(e.config??{},a)),[u,d]=(0,G.useState)(!1),[f,p]=(0,G.useState)(!1),[m,h]=(0,G.useState)(null),g=s.inboundMediaMode===`shared-fs`,_=s.mediaMode===`shared-fs`,v=g||_;async function y(){p(!0),h(null);try{h(await r({instanceName:e.name,inboundMediaMode:s.inboundMediaMode,mediaMode:s.mediaMode}))}catch(e){i.error(Je(),e)}finally{p(!1)}}async function b(){d(!0);try{let r=e.config??{};await n({instanceId:e._id,config:vt(s,r,a)}),t()}catch(e){i.error(be(),e)}finally{d(!1)}}return(0,Q.jsx)(`div`,{className:`oc-bridge-config`,children:(0,Q.jsxs)(`div`,{className:`oc-bridge-config__form`,children:[(0,Q.jsxs)(`div`,{className:`oc-bridge-config__grid`,children:[(0,Q.jsxs)(`label`,{className:`oc-field`,children:[(0,Q.jsx)(D,{label:Te(),help:le()}),(0,Q.jsxs)(R,{value:s.mediaMode,onValueChange:e=>l({...s,mediaMode:e}),children:[(0,Q.jsx)(z,{size:`sm`,className:`w-full`,children:(0,Q.jsx)(j,{})}),(0,Q.jsx)(B,{children:yt.map(e=>(0,Q.jsx)(N,{value:e,children:e},e))})]})]}),(0,Q.jsxs)(`label`,{className:`oc-field`,children:[(0,Q.jsx)(D,{label:te(),help:ne()}),(0,Q.jsxs)(R,{value:s.inboundMediaMode,onValueChange:e=>l({...s,inboundMediaMode:e}),children:[(0,Q.jsx)(z,{size:`sm`,className:`w-full`,children:(0,Q.jsx)(j,{})}),(0,Q.jsx)(B,{children:_t.map(e=>(0,Q.jsx)(N,{value:e,children:e},e))})]})]}),(0,Q.jsxs)(`label`,{className:`oc-field`,children:[(0,Q.jsx)(D,{label:Oe(),help:me()}),(0,Q.jsx)(O,{type:`number`,min:1,max:4096,className:`w-full`,value:s.mediaMaxMb,onChange:e=>l({...s,mediaMaxMb:Math.trunc(Number(e.target.value)||0)})})]})]}),v&&(0,Q.jsxs)(`div`,{className:`oc-bridge-config__grid`,children:[g&&(0,Q.jsxs)(`label`,{className:`oc-field`,children:[(0,Q.jsx)(D,{label:st(),help:Ze()}),(0,Q.jsx)(O,{className:`w-full`,spellCheck:!1,value:s.inboundAgentMount,onChange:e=>l({...s,inboundAgentMount:e.target.value})})]}),_&&(0,Q.jsxs)(`label`,{className:`oc-field`,children:[(0,Q.jsx)(D,{label:He(),help:at()}),(0,Q.jsx)(O,{className:`w-full`,spellCheck:!1,value:s.outboundAgentMount,onChange:e=>l({...s,outboundAgentMount:e.target.value})})]})]}),(0,Q.jsxs)(`label`,{className:`oc-field--row`,children:[(0,Q.jsx)(Et,{checked:s.rehydration,onCheckedChange:e=>l({...s,rehydration:e===!0})}),(0,Q.jsx)(D,{label:c(),help:fe()})]}),v&&m!==null&&(0,Q.jsx)(`div`,{className:`oc-bridge-config__check`,children:m.reachable?!m.inbound&&!m.outbound?(0,Q.jsxs)(`p`,{className:`oc-bridge-config__check-row oc-bridge-config__check-row--err`,children:[(0,Q.jsx)(I,{"aria-hidden":!0}),Le({reason:m.reason??`?`})]}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(An,{label:$e(),result:m.inbound}),(0,Q.jsx)(An,{label:ot(),result:m.outbound}),(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:it()})]}):(0,Q.jsxs)(`p`,{className:`oc-bridge-config__check-row oc-bridge-config__check-row--err`,children:[(0,Q.jsx)(I,{"aria-hidden":!0}),_e()]})}),(0,Q.jsxs)(`div`,{className:`oc-bridge-config__actions`,children:[v&&(0,Q.jsxs)(bt,{variant:`outline`,size:`sm`,onClick:()=>void y(),disabled:f,children:[f?(0,Q.jsx)(wt,{className:`size-4 animate-spin`,"aria-hidden":!0}):null,f?Be():et()]}),(0,Q.jsx)(bt,{size:`sm`,onClick:()=>void b(),disabled:u,children:mt()})]})]})})}function Mn({versions:e}){if(e.length===0)return null;let t=[...e].reverse();return(0,Q.jsxs)(Ft,{children:[(0,Q.jsx)(jt,{asChild:!0,children:(0,Q.jsxs)(`button`,{type:`button`,className:`oc-compat__versions-btn`,children:[e.length===1?De():s({count:e.length}),(0,Q.jsx)(E,{size:13,"aria-hidden":!0})]})}),(0,Q.jsxs)(Rt,{className:`oc-compat__versions-pop`,align:`start`,children:[(0,Q.jsx)(`p`,{className:`oc-compat__versions-title`,children:pt()}),(0,Q.jsx)(`div`,{className:`oc-compat__versions-list`,children:t.map(e=>(0,Q.jsx)(k,{variant:`secondary`,children:e},e))})]})]})}export{wn as BridgeTab,kn as InstanceConfigDialog};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$g as r,$l as i,BY as a,Ct as o,F_ as s,HY as c,NY as l,Qg as u,St as d,Sv as f,Tt as p,UY as m,Wk as h,Zg as g,_p as _,_t as v,a_ as y,at as b,bt as x,bv as S,ct as C,dp as w,dt as ee,e_ as te,et as ne,fp as re,ft as ie,gp as T,gt as ae,gv as oe,hp as se,ht as E,hv as ce,i_ as D,it as O,lt as le,mp as k,mt as A,n_ as j,nt as ue,ot as de,pp as fe,pt as pe,r_ as me,rt as he,st as ge,t as M,t_ as _e,tt as ve,up as N,ut as P,vp as F,vt as ye,wt as be,xt as xe,yp as Se,yt as Ce}from"./api-Da6_RPKW.js";import{t as we}from"./use_paginated_query-DudXPi-Q.js";import{t as I}from"./button-DezjmYbu.js";import{$t as L,Mt as R,St as z,bt as B,kn as Te,nt as Ee,rt as De,tt as V,vt as H,xt as U,yt as W}from"./index-BK3dOjJU.js";import{a as Oe}from"./compatView-Dvj8v6B1.js";/* empty css */var G=t(e(),1),ke=[`off`,`minimal`,`low`,`medium`,`high`,`xhigh`];function Ae(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 K=[`auto`,`hybrid`,`tool`,`off`];function je(e){switch(e){case`auto`:return d();case`hybrid`:return xe();case`tool`:return x();default:return Ce()}}function q(e){return{injection:e.injection??`auto`,defaultSources:e.defaultSources,...e.config?{config:e.config}:{}}}function J(e){return typeof e==`string`&&K.includes(e)}function Y(e){return{injection:J(e.injection)?e.injection:`auto`,sources:e.defaultSources.filter(t=>e.sources.some(e=>e.id===t))}}function X(e,t){let n=new Set(e);return n.size===new Set(t).size&&t.every(e=>n.has(e))}function Me(e,t,n){let r=n?e.defaultWriteRefused===`scope_refused`?A():Ne(e)?O():null:E(),i=Y(e),a=t.injection!==i.injection||!X(t.sources,i.sources),o=new Set(e.sources.map(e=>e.id)),s=t.sources.length>0&&t.sources.length<=16&&t.sources.every(e=>o.has(e));return{readOnlyReason:r,dirty:a,valid:s,invalidReason:s?null:v()}}function Ne(e){return(e.contract??1)<2&&e.ownAllowlist===!1}function Z(e,t,n){let r=t.sources.includes(n)?t.sources.filter(e=>e!==n):[...t.sources,n];return{...t,sources:e.sources.map(e=>e.id).filter(e=>r.includes(e))}}function Q(e){return e.ok?null:e.code===`scope_refused`?A():e.code===`stale_default`?pe():e.code===`write_unknown`||e.code===`not_confirmed`?P():e.code===`not_applied`?le():e.code===`default_too_large`?ue():e.code===`allowlist_too_large`?he():e.code===`plugin_too_old`?O():e.code===`source_not_allowed`?b():e.code===`plugin_config_lag`?de():e.code===`knowledge_unavailable`&&e.reason===`plugin_absent`?ae():ie({code:e.code})}function Pe(e,t){let n=q(e),r=q(t);if(n.injection!==r.injection||!X(n.defaultSources,r.defaultSources))return!0;let i=n.config,a=r.config;return i===void 0||a===void 0?i!==a:i.injection!==a.injection||!((e,t)=>e===null||t===null?e===t:e.length===t.length&&e.every((e,n)=>e===t[n]))(i.sources,a.sources)}var $=n();function Fe({instanceName:e,row:t,supported:n}){let i=a(M.knowledge.setAgentKnowledgeDefault),[s,c]=(0,G.useState)(t),[l,d]=(0,G.useState)(()=>Y(t)),[p,m]=(0,G.useState)(`idle`),[h,g]=(0,G.useState)(null),[_,v]=(0,G.useState)(!1),y=e=>{c(e),d(Y(e)),g(null)},b=Pe(s,t);(0,G.useEffect)(()=>{_&&b&&(v(!1),y(t))},[_,b]);let x=Me(s,l,n),S=x.readOnlyReason===null;async function C(){m(`saving`),g(null);try{let n=Q(await i({instanceName:e,agentId:t.agentId,injection:l.injection,sources:l.sources,expected:q(s)}));g(n),m(n===null?`done`:`idle`),n===null&&v(!0)}catch(e){g(Q({ok:!1,code:String(e?.message??`error`).slice(0,60)})),m(`idle`)}}return(0,$.jsxs)(`div`,{className:`oc-cdefaults__row`,"data-knowledge-agent":t.agentId,children:[(0,$.jsx)(`span`,{className:`oc-cdefaults__label`,children:t.agentId}),(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`div`,{className:`oc-cdefaults__inline`,children:(0,$.jsxs)(H,{value:l.injection,onValueChange:e=>{J(e)&&d({...l,injection:e})},disabled:!S,children:[(0,$.jsx)(U,{className:`oc-cdefaults__select`,"aria-label":o(),children:(0,$.jsx)(z,{})}),(0,$.jsx)(W,{children:K.map(e=>(0,$.jsx)(B,{value:e,children:je(e)},e))})]})}),(0,$.jsx)(`span`,{className:`oc-cdefaults__label`,children:ye()}),t.sources.map(e=>(0,$.jsxs)(`label`,{className:`oc-cdefaults__inline`,style:{cursor:S?`pointer`:`default`},title:e.description||void 0,children:[(0,$.jsx)(R,{checked:l.sources.includes(e.id),onCheckedChange:()=>d(Z(t,l,e.id)),disabled:!S,"aria-label":e.label,"data-knowledge-default-source":e.id}),(0,$.jsx)(`span`,{children:e.label})]},e.id)),b&&!_?(0,$.jsxs)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:[ve(),` `,(0,$.jsx)(I,{variant:`outline`,size:`sm`,onClick:()=>y(t),children:ne()})]}):null,t.overridesAllowed?null:(0,$.jsx)(`p`,{className:`oc-cdefaults__help`,children:ee()}),S?(0,$.jsx)(`div`,{className:`oc-cdefaults__inline`,children:(0,$.jsx)(I,{size:`sm`,disabled:!x.dirty||!x.valid||p===`saving`,onClick:()=>void C(),children:p===`saving`?f():r()})}):(0,$.jsx)(`p`,{className:`oc-cdefaults__note`,children:x.readOnlyReason}),S&&x.dirty&&x.invalidReason!==null?(0,$.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:x.invalidReason}):null,p===`done`&&h===null?(0,$.jsx)(`p`,{className:`oc-admin__hint`,role:`status`,children:u()}):null,h===null?null:(0,$.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:h})]})]})}function Ie({instanceName:e}){let t=m(M.knowledge.knowledgeAdminInstance,{instanceName:e}),{results:n,status:r,loadMore:i}=we(M.knowledge.agentKnowledgePage,{instanceName:e},{initialNumItems:50});return t===void 0||t.provider!==`openclaw`||n.length===0&&r!==`CanLoadMore`?null:(0,$.jsxs)(`section`,{className:`oc-cdefaults__row`,"aria-label":p(),children:[(0,$.jsx)(`span`,{className:`oc-cdefaults__label`,children:p()}),(0,$.jsx)(`p`,{className:`oc-admin__hint`,children:be()}),t.supported?null:(0,$.jsx)(`p`,{className:`oc-cdefaults__note`,children:E()}),n.map(n=>(0,$.jsx)(Fe,{instanceName:e,row:n,supported:t.supported},n.agentId)),r===`CanLoadMore`||r===`LoadingMore`?(0,$.jsxs)(`div`,{className:`oc-cdefaults__inline`,children:[(0,$.jsx)(`p`,{className:`oc-admin__hint`,children:C({shown:n.length})}),(0,$.jsx)(I,{variant:`outline`,size:`sm`,disabled:r===`LoadingMore`,onClick:()=>i(50),"data-knowledge-load-more":!0,children:ge()})]}):null]})}function Le({instance:e}){let t=c(M.admin.upsertInstanceConfig),n=m(M.agents.listAgentsForInstance,{instanceName:e.name}),i=typeof e.config?.converterAgentId==`string`?e.config.converterAgentId:``,[a,o]=(0,G.useState)(i),[s,l]=(0,G.useState)(`idle`);(0,G.useEffect)(()=>{o(i),l(`idle`)},[e._id,i]);let d=`__none__`,p=a!==i;async function h(){l(`saving`);try{let n={...e.config??{}};a===``||a===d?delete n.converterAgentId:n.converterAgentId=a,await t({instanceId:e._id,config:n}),l(`done`)}catch{l(`error`)}}let _=n?.agents??[];return(0,$.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,$.jsx)(`span`,{className:`oc-cdefaults__label`,children:T()}),(0,$.jsx)(`p`,{className:`oc-admin__hint`,children:se()}),(0,$.jsxs)(`div`,{className:`oc-cdefaults__inline`,children:[(0,$.jsxs)(H,{value:a===``?d:a,onValueChange:e=>o(e===d?``:e),children:[(0,$.jsx)(U,{className:`oc-cdefaults__select`,"aria-label":T(),children:(0,$.jsx)(z,{placeholder:k()})}),(0,$.jsxs)(W,{children:[(0,$.jsx)(B,{value:d,children:k()}),_.map(e=>(0,$.jsx)(B,{value:e.agentId,children:e.displayName?`${e.displayName} (${e.agentId})`:e.agentId},e.agentId))]})]}),(0,$.jsx)(I,{size:`sm`,disabled:!p||s===`saving`,onClick:()=>void h(),children:s===`saving`?f():r()})]}),s===`done`?(0,$.jsx)(`p`,{className:`oc-admin__hint`,role:`status`,children:u()}):null,s===`error`?(0,$.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:g()}):null]})}function Re({instance:e}){let t=c(M.admin.upsertInstanceConfig),n=e.config?.curationEnabled===!0,i=typeof e.config?.curationBudgetChars==`number`?e.config.curationBudgetChars:null,[a,o]=(0,G.useState)(n),[s,l]=(0,G.useState)(i===null?``:String(i)),[d,p]=(0,G.useState)(`idle`);(0,G.useEffect)(()=>{o(n),l(i===null?``:String(i)),p(`idle`)},[e._id,n,i]);let m=s.trim(),h=m===``?null:/^\d+$/.test(m)?Number.parseInt(m,10):NaN,v=!a||h===null||Number.isInteger(h)&&h>=4e3&&h<=6e4,y=a!==n||(h??null)!==i;async function b(){p(`saving`);try{let n={...e.config??{}};n.curationEnabled=a,!a||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,$.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,$.jsxs)(`label`,{className:`oc-cdefaults__inline`,style:{cursor:`pointer`},children:[(0,$.jsx)(R,{checked:a,onCheckedChange:e=>o(e===!0),"aria-label":_()}),(0,$.jsx)(`span`,{className:`oc-cdefaults__label`,children:_()})]}),(0,$.jsxs)(`div`,{className:`oc-cdefaults__inline`,children:[(0,$.jsx)(L,{type:`number`,min:4e3,max:6e4,step:1e3,placeholder:`20000`,value:s,onChange:e=>l(e.target.value),className:`oc-cdefaults__number`,"aria-invalid":!v,"aria-label":fe(),disabled:!a}),(0,$.jsx)(I,{size:`sm`,disabled:!y||!v||d===`saving`,onClick:()=>void b(),children:d===`saving`?f():r()})]}),v?null:(0,$.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:re()}),d===`done`?(0,$.jsx)(`p`,{className:`oc-admin__hint`,role:`status`,children:u()}):null,d===`error`?(0,$.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:g()}):null,(0,$.jsx)(`p`,{className:`oc-cdefaults__help`,children:w()})]})}function ze({instance:e}){let t=c(M.admin.upsertInstanceConfig),n=typeof e.config?.summarizeThresholdChars==`number`?e.config.summarizeThresholdChars:null,[i,a]=(0,G.useState)(n===null?``:String(n)),[o,s]=(0,G.useState)(`idle`);(0,G.useEffect)(()=>{a(n===null?``:String(n)),s(`idle`)},[e._id,n]);let l=i.trim(),d=l===``?null:/^\d+$/.test(l)?Number.parseInt(l,10):NaN,p=d===null||Number.isInteger(d)&&d>=1e3&&d<=2e5,m=(d??null)!==n;async function h(){s(`saving`);try{let n={...e.config??{}};d===null?delete n.summarizeThresholdChars:n.summarizeThresholdChars=d,await t({instanceId:e._id,config:n}),s(`done`)}catch{s(`error`)}}return(0,$.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,$.jsx)(`span`,{className:`oc-cdefaults__label`,children:Se()}),(0,$.jsxs)(`div`,{className:`oc-cdefaults__inline`,children:[(0,$.jsx)(L,{type:`number`,min:1e3,max:2e5,step:1e3,placeholder:`8000`,value:i,onChange:e=>a(e.target.value),className:`oc-cdefaults__number`,"aria-invalid":!p}),(0,$.jsx)(I,{size:`sm`,disabled:!m||!p||o===`saving`,onClick:()=>void h(),children:o===`saving`?f():r()})]}),p?null:(0,$.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:N()}),o===`done`?(0,$.jsx)(`p`,{className:`oc-admin__hint`,role:`status`,children:u()}):null,o===`error`?(0,$.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:g()}):null,(0,$.jsx)(`p`,{className:`oc-cdefaults__help`,children:F()})]})}function Be(){let e=a(M.agentFiles.getChatDefaults),[t,n]=(0,G.useState)({status:`loading`}),r=m(M.admin.listInstances,{}),[o,c]=(0,G.useState)(null);(0,G.useEffect)(()=>{!r||r.length===0||(!o||!r.some(e=>e.name===o))&&c(r[0].name)},[r,o]);let u=(r?.length??0)>1,d=r!==void 0&&r.length===0,f=m(M.compat.forInstance,o?{instanceName:o}:`skip`),p=o?Ee(f,`configDefaults`):`loading`,g=p===`loading`?null:p.blocked,_=(0,G.useMemo)(()=>u&&o?{instanceName:o}:{},[u,o]),v=(0,G.useRef)(0),b=(0,G.useCallback)(async()=>{let t=++v.current;n({status:`loading`});try{let r=Ae(await e(_));if(v.current!==t)return;n({status:`done`,current:r})}catch{if(v.current!==t)return;n({status:`error`})}},[e,_]);(0,G.useEffect)(()=>{g===!1&&(u&&!o||b())},[b,g,u,o]);let x=t.status===`done`?t.current:null,C=(0,G.useMemo)(()=>ke.map(e=>({id:e,label:De(e)})),[]),w=(0,G.useMemo)(()=>[{id:`fast`,label:oe()},{id:`standard`,label:ce()}],[]);return(0,$.jsxs)(`div`,{className:`oc-cdefaults`,children:[(0,$.jsx)(`p`,{className:`oc-admin__hint`,children:y()}),u&&o?(0,$.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,$.jsx)(`span`,{className:`oc-cdefaults__label`,children:s()}),(0,$.jsxs)(H,{value:o,onValueChange:e=>c(e),children:[(0,$.jsx)(U,{size:`sm`,"aria-label":s(),children:(0,$.jsx)(z,{})}),(0,$.jsx)(W,{children:(r??[]).map(e=>(0,$.jsx)(B,{value:e.name,children:e.name},e.name))})]})]}):null,d?(0,$.jsx)(`p`,{className:`oc-admin__hint`,role:`status`,children:h()}):p===`loading`?(0,$.jsx)(`p`,{className:`oc-admin__hint`,children:l()}):p.blocked?(0,$.jsxs)(`p`,{className:`oc-compat__blocked`,role:`status`,children:[(0,$.jsx)(Te,{size:14,"aria-hidden":!0}),` `,Oe(p.gatewayVersion,p.provider)]}):t.status===`loading`?(0,$.jsx)(`p`,{className:`oc-admin__hint`,children:l()}):t.status===`error`?(0,$.jsxs)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:[te(),` `,(0,$.jsx)(I,{variant:`outline`,size:`sm`,onClick:()=>void b(),children:S()})]}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,$.jsx)(`span`,{className:`oc-cdefaults__label`,children:D()}),(0,$.jsx)(V,{field:`thinkingLevel`,options:C,value:x?.thinkingDefault??null,onChange:()=>{},disabled:!0,ariaLabel:D()}),(0,$.jsx)(`p`,{className:`oc-cdefaults__help`,children:me()})]}),(0,$.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,$.jsx)(`span`,{className:`oc-cdefaults__label`,children:j()}),(0,$.jsx)(V,{field:`fastMode`,options:w,value:x===null||x.fastModeDefault===null?null:x.fastModeDefault?`fast`:`standard`,onChange:()=>{},disabled:!0,ariaLabel:j()}),(0,$.jsx)(`p`,{className:`oc-cdefaults__help`,children:_e()})]}),(0,$.jsx)(`p`,{className:`oc-cdefaults__note`,children:i()})]}),(()=>{let e=r?.find(e=>e.name===(o??r[0]?.name));return e?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(ze,{instance:e}),(0,$.jsx)(Re,{instance:e}),(0,$.jsx)(Le,{instance:e}),(0,$.jsx)(Ie,{instanceName:e.name})]}):null})()]})}export{Be as ChatDefaultsTab};
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$g as r,$l as i,BY as a,Ct as o,F_ as s,HY as c,NY as l,Qg as u,St as d,Sv as f,Tt as p,UY as m,Wk as h,Zg as g,_p as _,_t as v,a_ as y,at as b,bt as x,bv as S,ct as C,dp as w,dt as ee,e_ as te,et as ne,fp as re,ft as ie,gp as T,gt as ae,gv as oe,hp as se,ht as E,hv as ce,i_ as D,it as O,lt as le,mp as k,mt as A,n_ as j,nt as ue,ot as de,pp as fe,pt as pe,r_ as me,rt as he,st as ge,t as M,t_ as _e,tt as ve,up as N,ut as P,vp as F,vt as ye,wt as be,xt as xe,yp as Se,yt as Ce}from"./api-Da6_RPKW.js";import{t as we}from"./use_paginated_query-DudXPi-Q.js";import{t as I}from"./button-DezjmYbu.js";import{$t as L,Mt as R,St as z,bt as B,kn as Te,nt as Ee,rt as De,tt as V,vt as H,xt as U,yt as W}from"./index-BcCFgPG0.js";import{a as Oe}from"./compatView-Dvj8v6B1.js";/* empty css */var G=t(e(),1),ke=[`off`,`minimal`,`low`,`medium`,`high`,`xhigh`];function Ae(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 K=[`auto`,`hybrid`,`tool`,`off`];function je(e){switch(e){case`auto`:return d();case`hybrid`:return xe();case`tool`:return x();default:return Ce()}}function q(e){return{injection:e.injection??`auto`,defaultSources:e.defaultSources,...e.config?{config:e.config}:{}}}function J(e){return typeof e==`string`&&K.includes(e)}function Y(e){return{injection:J(e.injection)?e.injection:`auto`,sources:e.defaultSources.filter(t=>e.sources.some(e=>e.id===t))}}function X(e,t){let n=new Set(e);return n.size===new Set(t).size&&t.every(e=>n.has(e))}function Me(e,t,n){let r=n?e.defaultWriteRefused===`scope_refused`?A():Ne(e)?O():null:E(),i=Y(e),a=t.injection!==i.injection||!X(t.sources,i.sources),o=new Set(e.sources.map(e=>e.id)),s=t.sources.length>0&&t.sources.length<=16&&t.sources.every(e=>o.has(e));return{readOnlyReason:r,dirty:a,valid:s,invalidReason:s?null:v()}}function Ne(e){return(e.contract??1)<2&&e.ownAllowlist===!1}function Z(e,t,n){let r=t.sources.includes(n)?t.sources.filter(e=>e!==n):[...t.sources,n];return{...t,sources:e.sources.map(e=>e.id).filter(e=>r.includes(e))}}function Q(e){return e.ok?null:e.code===`scope_refused`?A():e.code===`stale_default`?pe():e.code===`write_unknown`||e.code===`not_confirmed`?P():e.code===`not_applied`?le():e.code===`default_too_large`?ue():e.code===`allowlist_too_large`?he():e.code===`plugin_too_old`?O():e.code===`source_not_allowed`?b():e.code===`plugin_config_lag`?de():e.code===`knowledge_unavailable`&&e.reason===`plugin_absent`?ae():ie({code:e.code})}function Pe(e,t){let n=q(e),r=q(t);if(n.injection!==r.injection||!X(n.defaultSources,r.defaultSources))return!0;let i=n.config,a=r.config;return i===void 0||a===void 0?i!==a:i.injection!==a.injection||!((e,t)=>e===null||t===null?e===t:e.length===t.length&&e.every((e,n)=>e===t[n]))(i.sources,a.sources)}var $=n();function Fe({instanceName:e,row:t,supported:n}){let i=a(M.knowledge.setAgentKnowledgeDefault),[s,c]=(0,G.useState)(t),[l,d]=(0,G.useState)(()=>Y(t)),[p,m]=(0,G.useState)(`idle`),[h,g]=(0,G.useState)(null),[_,v]=(0,G.useState)(!1),y=e=>{c(e),d(Y(e)),g(null)},b=Pe(s,t);(0,G.useEffect)(()=>{_&&b&&(v(!1),y(t))},[_,b]);let x=Me(s,l,n),S=x.readOnlyReason===null;async function C(){m(`saving`),g(null);try{let n=Q(await i({instanceName:e,agentId:t.agentId,injection:l.injection,sources:l.sources,expected:q(s)}));g(n),m(n===null?`done`:`idle`),n===null&&v(!0)}catch(e){g(Q({ok:!1,code:String(e?.message??`error`).slice(0,60)})),m(`idle`)}}return(0,$.jsxs)(`div`,{className:`oc-cdefaults__row`,"data-knowledge-agent":t.agentId,children:[(0,$.jsx)(`span`,{className:`oc-cdefaults__label`,children:t.agentId}),(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`div`,{className:`oc-cdefaults__inline`,children:(0,$.jsxs)(H,{value:l.injection,onValueChange:e=>{J(e)&&d({...l,injection:e})},disabled:!S,children:[(0,$.jsx)(U,{className:`oc-cdefaults__select`,"aria-label":o(),children:(0,$.jsx)(z,{})}),(0,$.jsx)(W,{children:K.map(e=>(0,$.jsx)(B,{value:e,children:je(e)},e))})]})}),(0,$.jsx)(`span`,{className:`oc-cdefaults__label`,children:ye()}),t.sources.map(e=>(0,$.jsxs)(`label`,{className:`oc-cdefaults__inline`,style:{cursor:S?`pointer`:`default`},title:e.description||void 0,children:[(0,$.jsx)(R,{checked:l.sources.includes(e.id),onCheckedChange:()=>d(Z(t,l,e.id)),disabled:!S,"aria-label":e.label,"data-knowledge-default-source":e.id}),(0,$.jsx)(`span`,{children:e.label})]},e.id)),b&&!_?(0,$.jsxs)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:[ve(),` `,(0,$.jsx)(I,{variant:`outline`,size:`sm`,onClick:()=>y(t),children:ne()})]}):null,t.overridesAllowed?null:(0,$.jsx)(`p`,{className:`oc-cdefaults__help`,children:ee()}),S?(0,$.jsx)(`div`,{className:`oc-cdefaults__inline`,children:(0,$.jsx)(I,{size:`sm`,disabled:!x.dirty||!x.valid||p===`saving`,onClick:()=>void C(),children:p===`saving`?f():r()})}):(0,$.jsx)(`p`,{className:`oc-cdefaults__note`,children:x.readOnlyReason}),S&&x.dirty&&x.invalidReason!==null?(0,$.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:x.invalidReason}):null,p===`done`&&h===null?(0,$.jsx)(`p`,{className:`oc-admin__hint`,role:`status`,children:u()}):null,h===null?null:(0,$.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:h})]})]})}function Ie({instanceName:e}){let t=m(M.knowledge.knowledgeAdminInstance,{instanceName:e}),{results:n,status:r,loadMore:i}=we(M.knowledge.agentKnowledgePage,{instanceName:e},{initialNumItems:50});return t===void 0||t.provider!==`openclaw`||n.length===0&&r!==`CanLoadMore`?null:(0,$.jsxs)(`section`,{className:`oc-cdefaults__row`,"aria-label":p(),children:[(0,$.jsx)(`span`,{className:`oc-cdefaults__label`,children:p()}),(0,$.jsx)(`p`,{className:`oc-admin__hint`,children:be()}),t.supported?null:(0,$.jsx)(`p`,{className:`oc-cdefaults__note`,children:E()}),n.map(n=>(0,$.jsx)(Fe,{instanceName:e,row:n,supported:t.supported},n.agentId)),r===`CanLoadMore`||r===`LoadingMore`?(0,$.jsxs)(`div`,{className:`oc-cdefaults__inline`,children:[(0,$.jsx)(`p`,{className:`oc-admin__hint`,children:C({shown:n.length})}),(0,$.jsx)(I,{variant:`outline`,size:`sm`,disabled:r===`LoadingMore`,onClick:()=>i(50),"data-knowledge-load-more":!0,children:ge()})]}):null]})}function Le({instance:e}){let t=c(M.admin.upsertInstanceConfig),n=m(M.agents.listAgentsForInstance,{instanceName:e.name}),i=typeof e.config?.converterAgentId==`string`?e.config.converterAgentId:``,[a,o]=(0,G.useState)(i),[s,l]=(0,G.useState)(`idle`);(0,G.useEffect)(()=>{o(i),l(`idle`)},[e._id,i]);let d=`__none__`,p=a!==i;async function h(){l(`saving`);try{let n={...e.config??{}};a===``||a===d?delete n.converterAgentId:n.converterAgentId=a,await t({instanceId:e._id,config:n}),l(`done`)}catch{l(`error`)}}let _=n?.agents??[];return(0,$.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,$.jsx)(`span`,{className:`oc-cdefaults__label`,children:T()}),(0,$.jsx)(`p`,{className:`oc-admin__hint`,children:se()}),(0,$.jsxs)(`div`,{className:`oc-cdefaults__inline`,children:[(0,$.jsxs)(H,{value:a===``?d:a,onValueChange:e=>o(e===d?``:e),children:[(0,$.jsx)(U,{className:`oc-cdefaults__select`,"aria-label":T(),children:(0,$.jsx)(z,{placeholder:k()})}),(0,$.jsxs)(W,{children:[(0,$.jsx)(B,{value:d,children:k()}),_.map(e=>(0,$.jsx)(B,{value:e.agentId,children:e.displayName?`${e.displayName} (${e.agentId})`:e.agentId},e.agentId))]})]}),(0,$.jsx)(I,{size:`sm`,disabled:!p||s===`saving`,onClick:()=>void h(),children:s===`saving`?f():r()})]}),s===`done`?(0,$.jsx)(`p`,{className:`oc-admin__hint`,role:`status`,children:u()}):null,s===`error`?(0,$.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:g()}):null]})}function Re({instance:e}){let t=c(M.admin.upsertInstanceConfig),n=e.config?.curationEnabled===!0,i=typeof e.config?.curationBudgetChars==`number`?e.config.curationBudgetChars:null,[a,o]=(0,G.useState)(n),[s,l]=(0,G.useState)(i===null?``:String(i)),[d,p]=(0,G.useState)(`idle`);(0,G.useEffect)(()=>{o(n),l(i===null?``:String(i)),p(`idle`)},[e._id,n,i]);let m=s.trim(),h=m===``?null:/^\d+$/.test(m)?Number.parseInt(m,10):NaN,v=!a||h===null||Number.isInteger(h)&&h>=4e3&&h<=6e4,y=a!==n||(h??null)!==i;async function b(){p(`saving`);try{let n={...e.config??{}};n.curationEnabled=a,!a||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,$.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,$.jsxs)(`label`,{className:`oc-cdefaults__inline`,style:{cursor:`pointer`},children:[(0,$.jsx)(R,{checked:a,onCheckedChange:e=>o(e===!0),"aria-label":_()}),(0,$.jsx)(`span`,{className:`oc-cdefaults__label`,children:_()})]}),(0,$.jsxs)(`div`,{className:`oc-cdefaults__inline`,children:[(0,$.jsx)(L,{type:`number`,min:4e3,max:6e4,step:1e3,placeholder:`20000`,value:s,onChange:e=>l(e.target.value),className:`oc-cdefaults__number`,"aria-invalid":!v,"aria-label":fe(),disabled:!a}),(0,$.jsx)(I,{size:`sm`,disabled:!y||!v||d===`saving`,onClick:()=>void b(),children:d===`saving`?f():r()})]}),v?null:(0,$.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:re()}),d===`done`?(0,$.jsx)(`p`,{className:`oc-admin__hint`,role:`status`,children:u()}):null,d===`error`?(0,$.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:g()}):null,(0,$.jsx)(`p`,{className:`oc-cdefaults__help`,children:w()})]})}function ze({instance:e}){let t=c(M.admin.upsertInstanceConfig),n=typeof e.config?.summarizeThresholdChars==`number`?e.config.summarizeThresholdChars:null,[i,a]=(0,G.useState)(n===null?``:String(n)),[o,s]=(0,G.useState)(`idle`);(0,G.useEffect)(()=>{a(n===null?``:String(n)),s(`idle`)},[e._id,n]);let l=i.trim(),d=l===``?null:/^\d+$/.test(l)?Number.parseInt(l,10):NaN,p=d===null||Number.isInteger(d)&&d>=1e3&&d<=2e5,m=(d??null)!==n;async function h(){s(`saving`);try{let n={...e.config??{}};d===null?delete n.summarizeThresholdChars:n.summarizeThresholdChars=d,await t({instanceId:e._id,config:n}),s(`done`)}catch{s(`error`)}}return(0,$.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,$.jsx)(`span`,{className:`oc-cdefaults__label`,children:Se()}),(0,$.jsxs)(`div`,{className:`oc-cdefaults__inline`,children:[(0,$.jsx)(L,{type:`number`,min:1e3,max:2e5,step:1e3,placeholder:`8000`,value:i,onChange:e=>a(e.target.value),className:`oc-cdefaults__number`,"aria-invalid":!p}),(0,$.jsx)(I,{size:`sm`,disabled:!m||!p||o===`saving`,onClick:()=>void h(),children:o===`saving`?f():r()})]}),p?null:(0,$.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:N()}),o===`done`?(0,$.jsx)(`p`,{className:`oc-admin__hint`,role:`status`,children:u()}):null,o===`error`?(0,$.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:g()}):null,(0,$.jsx)(`p`,{className:`oc-cdefaults__help`,children:F()})]})}function Be(){let e=a(M.agentFiles.getChatDefaults),[t,n]=(0,G.useState)({status:`loading`}),r=m(M.admin.listInstances,{}),[o,c]=(0,G.useState)(null);(0,G.useEffect)(()=>{!r||r.length===0||(!o||!r.some(e=>e.name===o))&&c(r[0].name)},[r,o]);let u=(r?.length??0)>1,d=r!==void 0&&r.length===0,f=m(M.compat.forInstance,o?{instanceName:o}:`skip`),p=o?Ee(f,`configDefaults`):`loading`,g=p===`loading`?null:p.blocked,_=(0,G.useMemo)(()=>u&&o?{instanceName:o}:{},[u,o]),v=(0,G.useRef)(0),b=(0,G.useCallback)(async()=>{let t=++v.current;n({status:`loading`});try{let r=Ae(await e(_));if(v.current!==t)return;n({status:`done`,current:r})}catch{if(v.current!==t)return;n({status:`error`})}},[e,_]);(0,G.useEffect)(()=>{g===!1&&(u&&!o||b())},[b,g,u,o]);let x=t.status===`done`?t.current:null,C=(0,G.useMemo)(()=>ke.map(e=>({id:e,label:De(e)})),[]),w=(0,G.useMemo)(()=>[{id:`fast`,label:oe()},{id:`standard`,label:ce()}],[]);return(0,$.jsxs)(`div`,{className:`oc-cdefaults`,children:[(0,$.jsx)(`p`,{className:`oc-admin__hint`,children:y()}),u&&o?(0,$.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,$.jsx)(`span`,{className:`oc-cdefaults__label`,children:s()}),(0,$.jsxs)(H,{value:o,onValueChange:e=>c(e),children:[(0,$.jsx)(U,{size:`sm`,"aria-label":s(),children:(0,$.jsx)(z,{})}),(0,$.jsx)(W,{children:(r??[]).map(e=>(0,$.jsx)(B,{value:e.name,children:e.name},e.name))})]})]}):null,d?(0,$.jsx)(`p`,{className:`oc-admin__hint`,role:`status`,children:h()}):p===`loading`?(0,$.jsx)(`p`,{className:`oc-admin__hint`,children:l()}):p.blocked?(0,$.jsxs)(`p`,{className:`oc-compat__blocked`,role:`status`,children:[(0,$.jsx)(Te,{size:14,"aria-hidden":!0}),` `,Oe(p.gatewayVersion,p.provider)]}):t.status===`loading`?(0,$.jsx)(`p`,{className:`oc-admin__hint`,children:l()}):t.status===`error`?(0,$.jsxs)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:[te(),` `,(0,$.jsx)(I,{variant:`outline`,size:`sm`,onClick:()=>void b(),children:S()})]}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,$.jsx)(`span`,{className:`oc-cdefaults__label`,children:D()}),(0,$.jsx)(V,{field:`thinkingLevel`,options:C,value:x?.thinkingDefault??null,onChange:()=>{},disabled:!0,ariaLabel:D()}),(0,$.jsx)(`p`,{className:`oc-cdefaults__help`,children:me()})]}),(0,$.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,$.jsx)(`span`,{className:`oc-cdefaults__label`,children:j()}),(0,$.jsx)(V,{field:`fastMode`,options:w,value:x===null||x.fastModeDefault===null?null:x.fastModeDefault?`fast`:`standard`,onChange:()=>{},disabled:!0,ariaLabel:j()}),(0,$.jsx)(`p`,{className:`oc-cdefaults__help`,children:_e()})]}),(0,$.jsx)(`p`,{className:`oc-cdefaults__note`,children:i()})]}),(()=>{let e=r?.find(e=>e.name===(o??r[0]?.name));return e?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(ze,{instance:e}),(0,$.jsx)(Re,{instance:e}),(0,$.jsx)(Le,{instance:e}),(0,$.jsx)(Ie,{instanceName:e.name})]}):null})()]})}export{Be as ChatDefaultsTab};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{GS as r,HS as i,JS as a,KS as o,US as s,WS as c,qS as l}from"./api-Da6_RPKW.js";import{r as u}from"./dist-C5rZMbyx.js";import{t as d}from"./chevrons-up-down-BJ8yWoBT.js";import{t as f}from"./button-DezjmYbu.js";import{An as p,Ln as m,Mt as h,an as g,en as _,in as v,nn as y,or as b,tn as x,tr as S}from"./index-
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{GS as r,HS as i,JS as a,KS as o,US as s,WS as c,qS as l}from"./api-Da6_RPKW.js";import{r as u}from"./dist-C5rZMbyx.js";import{t as d}from"./chevrons-up-down-BJ8yWoBT.js";import{t as f}from"./button-DezjmYbu.js";import{An as p,Ln as m,Mt as h,an as g,en as _,in as v,nn as y,or as b,tn as x,tr as S}from"./index-BcCFgPG0.js";import{a as C,i as w,n as T,o as E,r as D,t as O}from"./table-CFBr2AAN.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=l(),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)(f,{size:`sm`,variant:e.variant===`destructive`?`destructive`:`outline`,onClick:()=>{e.onSelect([...z]),B(new Set)},children:[e.variant===`destructive`?(0,M.jsx)(p,{}):null,e.label,` (`,z.size,`)`]},e.label)):null,N?(0,M.jsxs)(f,{size:`sm`,onClick:N,children:[(0,M.jsx)(m,{}),` `,P]}):null]})]}),t===void 0?(0,M.jsx)(`p`,{className:`oc-admin__hint`,children:o()}):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)(h,{"aria-label":r(),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":i({column:e.header}),children:[e.header,n?V.dir===`asc`?(0,M.jsx)(b,{className:`oc-dt__sort-icon`,"aria-hidden":!0}):(0,M.jsx)(u,{className:`oc-dt__sort-icon`,"aria-hidden":!0}):(0,M.jsx)(d,{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)(h,{"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)(_,{children:[(0,M.jsx)(g,{asChild:!0,children:(0,M.jsx)(f,{variant:`ghost`,size:`icon-sm`,"aria-label":s(),className:`opacity-0 transition-opacity group-hover/row:opacity-100 group-focus-within/row:opacity-100 aria-expanded:opacity-100`,children:(0,M.jsx)(S,{})})}),(0,M.jsx)(x,{align:`end`,children:t.map((t,n)=>(0,M.jsxs)(`div`,{children:[t.variant===`destructive`&&n>0?(0,M.jsx)(v,{}):null,(0,M.jsx)(y,{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{HY as t,PA as n,dE as r,nE as i,rE as a,t as o,tE as s,uE as c}from"./api-Da6_RPKW.js";import{t as l}from"./use_paginated_query-DudXPi-Q.js";import{t as u}from"./button-DezjmYbu.js";import{ct as d,h as f}from"./index-
|
|
1
|
+
import{r as e}from"./bundle-mjs-C73ZY4La.js";import{HY as t,PA as n,dE as r,nE as i,rE as a,t as o,tE as s,uE as c}from"./api-Da6_RPKW.js";import{t as l}from"./use_paginated_query-DudXPi-Q.js";import{t as u}from"./button-DezjmYbu.js";import{ct as d,h as f}from"./index-BcCFgPG0.js";import{n as p,t as m}from"./trashPage-BqqZxj7Y.js";var h=e();function g(){let{results:e,status:g,loadMore:_}=l(o.trash.listMyTrash,{},{initialNumItems:50}),v=f(),y=t(o.trash.restoreChat),b=t(o.trash.purgeChat),x=t(o.trash.emptyTrash),S=d();return(0,h.jsxs)(`div`,{className:`oc-trash__body`,children:[(0,h.jsxs)(`div`,{className:`oc-trash__head`,children:[(0,h.jsx)(`p`,{className:`oc-trash__hint`,children:r({days:v})}),e.length>0?(0,h.jsx)(u,{variant:`destructive`,size:`sm`,onClick:async()=>{await S({title:i(),description:s(),confirmLabel:a(),destructive:!0})&&await x({})},children:a()}):null]}),g===`LoadingFirstPage`?(0,h.jsx)(`p`,{className:`oc-trash__hint`,children:n()}):e.length===0?(0,h.jsx)(`p`,{className:`oc-trash__empty`,children:c()}):(0,h.jsx)(m,{items:e,onRestore:e=>y({chatId:e}),onPurge:e=>b({chatId:e})}),(0,h.jsx)(p,{status:g,loadMore:_})]})}export{g as DeletedChatsTab};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./bundle-mjs-C73ZY4La.js";import{Jt as t}from"./index-
|
|
1
|
+
import{r as e}from"./bundle-mjs-C73ZY4La.js";import{Jt as t}from"./index-BcCFgPG0.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{$I as r,AI as i,BI as a,CI as o,Cf as s,DI as c,EI as l,FI as u,GI as d,HI as f,HY as p,II as m,JI as h,KI as g,LI as _,MI as v,NI as y,OI as b,PI as x,QI as ee,RI as te,SI as ne,TI as re,UI as ie,UY as S,VI as C,WI as w,XI as T,YI as E,ZI as D,_I as O,_L as k,aL as A,bI as j,cL as M,dL as N,eL as P,fL as F,gL as I,hL as L,iL as R,jI as z,kI as B,lL as V,mL as H,nL as U,oL as W,pL as G,qI as ae,rL as K,sL as q,t as J,tL as oe,uL as se,vI as ce,vL as le,wI as ue,xI as de,xf as fe,yI as pe,yL as me,zI as he}from"./api-Da6_RPKW.js";import{t as ge}from"./button-DezjmYbu.js";import{At as _e,ct as Y}from"./index-
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$I as r,AI as i,BI as a,CI as o,Cf as s,DI as c,EI as l,FI as u,GI as d,HI as f,HY as p,II as m,JI as h,KI as g,LI as _,MI as v,NI as y,OI as b,PI as x,QI as ee,RI as te,SI as ne,TI as re,UI as ie,UY as S,VI as C,WI as w,XI as T,YI as E,ZI as D,_I as O,_L as k,aL as A,bI as j,cL as M,dL as N,eL as P,fL as F,gL as I,hL as L,iL as R,jI as z,kI as B,lL as V,mL as H,nL as U,oL as W,pL as G,qI as ae,rL as K,sL as q,t as J,tL as oe,uL as se,vI as ce,vL as le,wI as ue,xI as de,xf as fe,yI as pe,yL as me,zI as he}from"./api-Da6_RPKW.js";import{t as ge}from"./button-DezjmYbu.js";import{At as _e,ct as Y}from"./index-BcCFgPG0.js";import{t as ve}from"./DataTableShell-DwnJt663.js";var X=t(e(),1),Z=n(),ye={altered_words:()=>me(),incorrect:()=>le(),incoherence:()=>k(),formatting:()=>I(),latency:()=>L(),api_error:()=>H(),other:()=>G()},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:N()}):e===!1?(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-warn`,children:se()}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill`,children:`—`}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill`,children:F()})}function be({data:e,reference:t,closeReason:n}){let i=e.snapshot,a=p(J.feedback.respondToFeedback),[c,l]=(0,X.useState)(e.thread),[u,f]=(0,X.useState)(``),[m,v]=(0,X.useState)(!1);async function y(){let t=u.trim();if(!(!t||m)){v(!0);try{await a({feedbackId:e._id,text:t}),l(e=>[...e,{authorRole:`admin`,text:t,at:Date.now()}]),f(``)}finally{v(!1)}}}let b=[];try{b=i.contextJson?JSON.parse(i.contextJson):[]}catch{b=[]}return(0,Z.jsxs)(`div`,{className:`oc-fbadmin__detail`,children:[(0,Z.jsxs)(`div`,{className:`oc-fbadmin__row`,children:[(0,Z.jsx)($,{matches:i.displayedMatchesStored,sourceWasOpen:i.clientInfo?.sourceWasOpen??!1}),(0,Z.jsxs)(`span`,{className:`oc-fbadmin__meta`,children:[Q(e.category),` · `,i.messageRole,i.isRegeneration?` · ${V()}`:``,i.openclawModel?` · ${i.openclawModel}`:``,i.openclawRuntime?` (${i.openclawRuntime})`:``]}),t?(0,Z.jsx)(`code`,{className:`oc-fbadmin__ref`,style:{userSelect:`all`,marginLeft:`auto`},title:_(),children:t}):null]}),e.comment?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:M()}),(0,Z.jsx)(`p`,{className:`oc-fbadmin__comment`,children:e.comment})]}):null,n?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:o()}),(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:q()}),c.length>0?(0,Z.jsx)(`div`,{className:`oc-fbadmin__thread`,children:c.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??s():A()}),(0,Z.jsx)(`span`,{className:`oc-notif__msg-text`,children:e.text})]},t))}):(0,Z.jsx)(`p`,{className:`oc-fbadmin__meta`,children:R()}),(0,Z.jsx)(`textarea`,{className:`oc-feedback__textarea`,placeholder:K(),value:u,maxLength:2e3,rows:3,onChange:e=>f(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 y(),disabled:!u.trim()||m,children:m?U():oe()})})]}),(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:P()}),(0,Z.jsx)(`pre`,{className:`oc-msg__source-pre`,children:i.messageText||r()})]}),i.clientInfo?.sourceWasOpen&&i.displayedText!==void 0?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:ee()}),(0,Z.jsx)(`pre`,{className:`oc-msg__source-pre`,children:i.displayedText||r()})]}):null,i.promptText?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:D()}),(0,Z.jsx)(`pre`,{className:`oc-msg__source-pre`,children:i.promptText})]}):null,b.length>0?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:T({count:i.contextCount??b.length,truncated:i.contextTruncated?E():``})}),(0,Z.jsx)(`div`,{className:`oc-fbadmin__ctx`,children:b.map((e,t)=>(0,Z.jsxs)(`div`,{className:`oc-fbadmin__ctx-turn`,children:[(0,Z.jsx)(`span`,{className:`oc-fbadmin__ctx-role`,children:e.role}),(0,Z.jsx)(`span`,{className:`oc-fbadmin__ctx-text`,children:e.text})]},t))})]}):null,i.outboxAvailable?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:h()}),(0,Z.jsxs)(`pre`,{className:`oc-msg__source-pre`,children:[i.outboxText??``,i.outboxStatus?`\n[status: ${i.outboxStatus}]`:``]})]}):null,i.clientInfo?.extensionsDetected&&i.clientInfo.extensionsDetected.length>0?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:ae()}),(0,Z.jsx)(`div`,{className:`oc-fbadmin__row`,children:i.clientInfo.extensionsDetected.map(e=>(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-warn`,children:e},e))})]}):null,(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:g()}),(0,Z.jsxs)(`p`,{className:`oc-fbadmin__env`,children:[[i.clientInfo?.language,i.clientInfo?.timezone,i.clientInfo?.theme?d({theme:i.clientInfo.theme}):null,i.runId?`run ${i.runId.slice(0,12)}…`:null].filter(Boolean).join(` · `)||`—`,i.clientInfo?.plugins&&i.clientInfo.plugins.length>0?(0,Z.jsxs)(`span`,{className:`oc-fbadmin__plugins`,children:[w(),` `,i.clientInfo.plugins.join(`, `),(0,Z.jsxs)(`span`,{className:`oc-fbadmin__note`,children:[` `,ie()]})]}):null,i.clientInfo?.userAgent?(0,Z.jsx)(`span`,{className:`oc-fbadmin__ua`,children:i.clientInfo.userAgent}):null]})]})]})}function xe(){let e=S(J.feedback.listForAdmin,{}),t=p(J.feedback.readSnapshot),n=p(J.feedback.deleteFeedback),r=Y(),[o,s]=(0,X.useState)(null),[d,h]=(0,X.useState)({});async function g(e){if(o===e._id){s(null);return}if(!d[e._id]){let n=await t({feedbackId:e._id});h(t=>({...t,[e._id]:n}))}s(e._id)}async function _(e){await r({title:pe(),description:ce(),confirmLabel:O(),destructive:!0})&&(await n({feedbackId:e._id}),o===e._id&&s(null))}return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`p`,{className:`oc-admin__hint`,children:[f(),` `,(0,Z.jsx)(`strong`,{children:C()}),` `,a()]}),(0,Z.jsx)(ve,{title:he(),rows:e,emptyHint:te(),isExpanded:e=>o===e._id&&!!d[e._id],renderExpanded:e=>d[e._id]?(0,Z.jsx)(be,{data:d[e._id],reference:e.reference,closeReason:e.userCloseReason}):null,columns:[{header:m(),cell:e=>_e(e.at),sort:e=>e.at},{header:u(),cell:e=>Q(e.category),sort:e=>Q(e.category)},{header:x(),cell:e=>e.messageRole===`user`?y():v(),sort:e=>e.messageRole},{header:z(),cell:e=>(e.reporterEmail||e.reporterName||`—`)+(e.impersonated&&e.realOperatorEmail?` ${i({operator:e.realOperatorEmail})}`:``),sort:e=>e.reporterEmail||e.reporterName||null},{header:B(),cell:e=>(0,Z.jsx)($,{matches:e.displayedMatchesStored,sourceWasOpen:e.sourceWasOpen}),sort:e=>e.displayedMatchesStored===!1?0:e.displayedMatchesStored===!0?1:2},{header:b(),cell:e=>e.hasComment?`✎`:`—`,sort:e=>+!!e.hasComment},{header:c(),cell:e=>e.userClosedAt==null?e.resolvedAt==null?e.answered?(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-ok`,children:l()}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill`,children:re()}):(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:ue()}),sort:e=>e.userClosedAt==null?e.resolvedAt==null?+!!e.answered:2:3}],rowActions:e=>[{label:o===e._id?ne():de(),onSelect:()=>void g(e)},{label:j(),onSelect:()=>void _(e),variant:`destructive`}]})]})}export{xe as FeedbacksTab};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./bundle-mjs-C73ZY4La.js";import{E as t,XY as n}from"./api-Da6_RPKW.js";import{B as r,R as i,V as a,mn as o,pn as s,z as c}from"./index-
|
|
1
|
+
import{r as e}from"./bundle-mjs-C73ZY4La.js";import{E as t,XY as n}from"./api-Da6_RPKW.js";import{B as r,R as i,V as a,mn as o,pn as s,z as c}from"./index-BcCFgPG0.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()),widgetsEnabled:n.optional(n.boolean()),widgetPromptConfirm: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()),transcriptProjection:n.optional(n.union(n.literal(`off`),n.literal(`shadow`),n.literal(`on`))),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`,`voiceEnabled`,`talkEnabled`,`voiceEngine`,`voiceLang`,`voiceRate`,`voiceAutoRead`,`widgetsEnabled`,`widgetPromptConfirm`,`transcriptProjection`];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)(r,{delayDuration:150,children:(0,b.jsxs)(i,{children:[(0,b.jsx)(a,{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)(c,{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{$J as ee,AJ as te,BJ as r,CJ as i,DJ as a,Df as o,EJ as ne,Ef as re,FJ as ie,FY as ae,GJ as s,HJ as c,HY as l,IJ as u,JJ as oe,KJ as se,LJ as d,MJ as ce,NJ as le,NY as ue,OJ as de,PJ as fe,QJ as pe,RJ as f,SJ as me,TJ as he,UJ as p,UY as ge,VJ as m,WB as _e,WJ as ve,XJ as h,YJ as ye,ZJ as g,bJ as be,eY as xe,jJ as Se,kJ as _,qJ as v,t as y,wJ as b,xJ as x,yJ as S,zJ as C}from"./api-Da6_RPKW.js";import{t as w}from"./button-DezjmYbu.js";import{An as T,Bt as E,Gt as D,Ht as O,In as k,Jt as A,Kt as j,Mt as Ce,St as M,Ut as we,Vt as Te,Wt as Ee,Yt as De,an as Oe,bt as N,en as ke,nn as P,nr as F,qt as Ae,tn as je,tr as Me,vt as I,xt as L,yt as R}from"./index-
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$J as ee,AJ as te,BJ as r,CJ as i,DJ as a,Df as o,EJ as ne,Ef as re,FJ as ie,FY as ae,GJ as s,HJ as c,HY as l,IJ as u,JJ as oe,KJ as se,LJ as d,MJ as ce,NJ as le,NY as ue,OJ as de,PJ as fe,QJ as pe,RJ as f,SJ as me,TJ as he,UJ as p,UY as ge,VJ as m,WB as _e,WJ as ve,XJ as h,YJ as ye,ZJ as g,bJ as be,eY as xe,jJ as Se,kJ as _,qJ as v,t as y,wJ as b,xJ as x,yJ as S,zJ as C}from"./api-Da6_RPKW.js";import{t as w}from"./button-DezjmYbu.js";import{An as T,Bt as E,Gt as D,Ht as O,In as k,Jt as A,Kt as j,Mt as Ce,St as M,Ut as we,Vt as Te,Wt as Ee,Yt as De,an as Oe,bt as N,en as ke,nn as P,nr as F,qt as Ae,tn as je,tr as Me,vt as I,xt as L,yt as R}from"./index-BcCFgPG0.js";import{a as Ne,i as z,n as Pe,o as B,r as V,t as Fe}from"./table-CFBr2AAN.js";var H=t(e(),1),U=n(),W=`all`;function G(e){switch(e){case`image`:return p();case`audio`:return c();case`video`:return m();case`pdf`:return r();case`document`:return C();case`archive`:return f();default:return d()}}function K(){let[e,t]=(0,H.useState)(W),[n,r]=(0,H.useState)(W),[c,d]=(0,H.useState)(W),[f,p]=(0,H.useState)(W),[m,C]=(0,H.useState)(!1),[K,q]=(0,H.useState)(null),J=l(y.files.softDelete),Y=De();function Ie(){t(W),r(W),d(W),p(W)}async function Le(){let e=K;if(q(null),e)try{await J({fileId:e.id}),Y.success(ne())}catch(e){Y.error(he(),e)}}let X=ge(y.files.listMine,{direction:e===W?void 0:e,chatId:n===W?void 0:n,instanceName:c===W?void 0:c,category:f===W?void 0:f,includeAutoGenerated:m||void 0}),Re=(0,H.useMemo)(()=>new Intl.DateTimeFormat(ae(),{dateStyle:`medium`,timeStyle:`short`}),[]);if(X===void 0)return(0,U.jsx)(`p`,{className:`oc-admin__hint`,children:ue()});let{files:Z,facets:Q,truncated:ze,cap:Be}=X,$=e!==W||n!==W||c!==W||f!==W;return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`p`,{className:`oc-admin__hint`,children:xe()}),(0,U.jsxs)(`div`,{className:`oc-files__filters`,style:{display:`flex`,flexWrap:`wrap`,gap:8,margin:`12px 0`},children:[(0,U.jsxs)(I,{value:e,onValueChange:t,children:[(0,U.jsx)(L,{size:`sm`,"aria-label":ee(),children:(0,U.jsx)(M,{})}),(0,U.jsxs)(R,{children:[(0,U.jsx)(N,{value:W,children:pe()}),(0,U.jsx)(N,{value:`inbound`,children:g()}),(0,U.jsx)(N,{value:`outbound`,children:h()})]})]}),(0,U.jsxs)(I,{value:n,onValueChange:r,children:[(0,U.jsx)(L,{size:`sm`,"aria-label":ye(),children:(0,U.jsx)(M,{})}),(0,U.jsxs)(R,{children:[(0,U.jsx)(N,{value:W,children:oe()}),Q.chats.map(e=>(0,U.jsx)(N,{value:e.id,children:e.title},e.id))]})]}),Q.multiProvider?(0,U.jsxs)(I,{value:c,onValueChange:d,children:[(0,U.jsx)(L,{size:`sm`,"aria-label":v(),children:(0,U.jsx)(M,{})}),(0,U.jsxs)(R,{children:[(0,U.jsx)(N,{value:W,children:se()}),Q.instances.map(e=>(0,U.jsx)(N,{value:e,children:e},e))]})]}):null,(0,U.jsxs)(I,{value:f,onValueChange:p,children:[(0,U.jsx)(L,{size:`sm`,"aria-label":s(),children:(0,U.jsx)(M,{})}),(0,U.jsxs)(R,{children:[(0,U.jsx)(N,{value:W,children:ve()}),Q.categories.map(e=>(0,U.jsx)(N,{value:e,children:G(e)},e))]})]}),(0,U.jsxs)(`label`,{className:`oc-files__autogen`,children:[(0,U.jsx)(Ce,{checked:m,onCheckedChange:e=>C(e===!0),"aria-label":o()}),(0,U.jsx)(`span`,{children:o()})]}),$?(0,U.jsxs)(w,{variant:`ghost`,size:`sm`,onClick:Ie,style:{display:`inline-flex`,alignItems:`center`,gap:4,marginLeft:`auto`},children:[(0,U.jsx)(k,{size:14,"aria-hidden":!0}),_()]}):null]}),Z.length===0?(0,U.jsx)(`p`,{className:`oc-admin__hint`,children:$?be():x()}):(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(Fe,{children:[(0,U.jsx)(Ne,{children:(0,U.jsxs)(B,{children:[(0,U.jsx)(z,{children:u()}),(0,U.jsx)(z,{children:ie()}),(0,U.jsx)(z,{children:fe()}),(0,U.jsx)(z,{children:le()}),(0,U.jsx)(z,{children:ce()}),(0,U.jsx)(z,{className:`text-right`,children:Se()})]})}),(0,U.jsx)(Pe,{children:Z.map(e=>(0,U.jsxs)(B,{children:[(0,U.jsxs)(V,{className:`font-medium`,style:{maxWidth:280,overflow:`hidden`,textOverflow:`ellipsis`},title:e.filename,children:[e.filename,e.origin===`pasted`?(0,U.jsx)(A,{variant:`outline`,style:{marginLeft:6},children:re()}):null]}),(0,U.jsx)(V,{title:e.mimeType,children:G(e.category)}),(0,U.jsx)(V,{children:(0,U.jsx)(A,{variant:`secondary`,children:e.direction===`inbound`?g():h()})}),(0,U.jsx)(V,{style:{maxWidth:220,overflow:`hidden`,textOverflow:`ellipsis`},title:e.chatTitle,children:e.chatTitle}),(0,U.jsx)(V,{className:`whitespace-nowrap text-muted-foreground`,children:Re.format(e.createdAt)}),(0,U.jsx)(V,{className:`text-right`,children:(0,U.jsxs)(ke,{children:[(0,U.jsx)(Oe,{asChild:!0,children:(0,U.jsx)(w,{variant:`ghost`,size:`icon`,"aria-label":de(),children:(0,U.jsx)(Me,{size:16})})}),(0,U.jsxs)(je,{align:`end`,children:[e.url?(0,U.jsx)(P,{asChild:!0,children:(0,U.jsxs)(`a`,{href:e.url,download:e.filename,target:`_blank`,rel:`noopener noreferrer`,children:[(0,U.jsx)(F,{size:14}),te()]})}):(0,U.jsxs)(P,{disabled:!0,children:[(0,U.jsx)(F,{size:14}),me()]}),(0,U.jsxs)(P,{variant:`destructive`,onSelect:()=>q({id:e._id,filename:e.filename}),children:[(0,U.jsx)(T,{size:14}),a()]})]})]})})]},e._id))})]}),ze?(0,U.jsx)(`p`,{className:`oc-admin__hint`,style:{marginTop:8},children:S({cap:Be})}):null]}),(0,U.jsx)(E,{open:K!==null,onOpenChange:e=>!e&&q(null),children:(0,U.jsxs)(we,{children:[(0,U.jsxs)(j,{children:[(0,U.jsx)(Ae,{children:b()}),(0,U.jsx)(Ee,{children:i()})]}),(0,U.jsxs)(D,{children:[(0,U.jsx)(O,{children:_e()}),(0,U.jsx)(Te,{onClick:()=>void Le(),children:a()})]})]})})]})}export{K as FilesTab};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{XS as r,YS as i}from"./api-Da6_RPKW.js";import{t as a}from"./button-DezjmYbu.js";import{$t as o,Fn as s,In as c}from"./index-
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{XS as r,YS as i}from"./api-Da6_RPKW.js";import{t as a}from"./button-DezjmYbu.js";import{$t as o,Fn as s,In as c}from"./index-BcCFgPG0.js";import{t as l}from"./TimeRangePicker-CJYL4VHt.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)(s,{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)(c,{}),i()]})]})}export{p as t};
|