@lacneu/atrium 0.95.0 → 0.96.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-rdS2LHXZ.js → AccessTab-CX08Ry4n.js} +1 -1
- package/dist/assets/{AdvancedFilter-CsTovdEV.js → AdvancedFilter-NdO-ABAb.js} +1 -1
- package/dist/assets/{AgentFilesTab-EiYd8sjW.js → AgentFilesTab-Bf1HY6m-.js} +1 -1
- package/dist/assets/{AnomaliesTab-p18K7yDf.js → AnomaliesTab-BVOmAPJz.js} +1 -1
- package/dist/assets/{AuditTab-5GcRAHVs.js → AuditTab-C8Vdj6sE.js} +1 -1
- package/dist/assets/{BridgeTab-BxbQafxo.js → BridgeTab-6it0lVRs.js} +1 -1
- package/dist/assets/{ChatDefaultsTab-DTrqvYQI.js → ChatDefaultsTab--eOikDSv.js} +1 -1
- package/dist/assets/{DataTableShell-B1MSVaC4.js → DataTableShell-DwQKTbat.js} +1 -1
- package/dist/assets/{DeletedChatsTab-CjNUgEJg.js → DeletedChatsTab-BgiGkq5o.js} +1 -1
- package/dist/assets/{DetailChips-DC3_vSvJ.js → DetailChips-B79dXme3.js} +1 -1
- package/dist/assets/{FeedbacksTab-B2FSw5a3.js → FeedbacksTab-C1yc9DOZ.js} +1 -1
- package/dist/assets/{FieldLabel-DqPoFgwl.js → FieldLabel-pGuDJHof.js} +1 -1
- package/dist/assets/{FilesTab-Bz5CxvQd.js → FilesTab-DM3-5ePt.js} +1 -1
- package/dist/assets/{FilterBar-BTpxyiRB.js → FilterBar-DDDj8Wi2.js} +1 -1
- package/dist/assets/{GroupsTab-BIg7zbLb.js → GroupsTab-DB601qwu.js} +1 -1
- package/dist/assets/{InstancesTab-7JRlmEtj.js → InstancesTab-B9JtAxFO.js} +1 -1
- package/dist/assets/{IntegrationsTab-ri9XV9Ja.js → IntegrationsTab-DfNFl2UZ.js} +1 -1
- package/dist/assets/{KpiTab-Ducybaoz.js → KpiTab-BGxs3igy.js} +1 -1
- package/dist/assets/{PreferencesTab-CRKH1-vP.js → PreferencesTab-Da7rOXq0.js} +1 -1
- package/dist/assets/{ProjectPage-Dz-lBZwU.js → ProjectPage-DsvdJ4jl.js} +1 -1
- package/dist/assets/{PromptInjectionsTab-C9tVh14s.js → PromptInjectionsTab-C-JZd1GM.js} +1 -1
- package/dist/assets/{RolesTab-BkSk3dhm.js → RolesTab-u4Jz95GA.js} +1 -1
- package/dist/assets/{ScheduledTab-DLqi_pHx.js → ScheduledTab-CuQiOFvx.js} +1 -1
- package/dist/assets/{ServiceAccountsTab-xZmekdfT.js → ServiceAccountsTab-BCBBrG-g.js} +1 -1
- package/dist/assets/{SubAgentReportsTab-BeCpOep_.js → SubAgentReportsTab-D6UhTJ2Q.js} +1 -1
- package/dist/assets/{ThemeShowroom-CnfchF4y.js → ThemeShowroom-CMA0A8Lc.js} +1 -1
- package/dist/assets/{TimeRangePicker-BXoSfz3D.js → TimeRangePicker-D-l1jL_i.js} +1 -1
- package/dist/assets/{TimezoneCombobox-DXjoNwGk.js → TimezoneCombobox-7YfscLD7.js} +1 -1
- package/dist/assets/{TracesTab-apOnGu2I.js → TracesTab-BdSq-X2g.js} +1 -1
- package/dist/assets/{TrashTab-Av3nukrj.js → TrashTab-CQfKOCIH.js} +1 -1
- package/dist/assets/{UsersTab-CQWnOuHY.js → UsersTab-Cy6C6yVf.js} +1 -1
- package/dist/assets/{VoiceTab-B5m_KO_S.js → VoiceTab-hkKsq7lK.js} +1 -1
- package/dist/assets/{highlighted-body-OFNGDK62-KyHtemyk.js → highlighted-body-OFNGDK62-CPvMZWDL.js} +1 -1
- package/dist/assets/{index-nxFP6zJZ.js → index-C_ywXTWT.js} +12 -12
- package/dist/assets/index-DshenjZG.css +1 -0
- package/dist/assets/mermaid-GHXKKRXX-BZBeDf7b.js +1 -0
- package/dist/assets/{pdf-CkIYBhfa.js → pdf-iLQ-6sXC.js} +1 -1
- package/dist/assets/{trashPage-CIk8ugRC.js → trashPage-K2ys0z1F.js} +1 -1
- package/dist/index.html +2 -2
- package/package.json +1 -1
- package/dist/assets/index-B9R4HSNT.css +0 -1
- package/dist/assets/mermaid-GHXKKRXX-DLup0npw.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,Qb as i,ZY as a,Zb as o,ax as s,cx as c,dx as l,ex as u,ix as d,lx as f,nx as p,ox as m,rx as h,sX as g,sx as _,t as v,tx as y,ux as b}from"./api-ZghOy9gS.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,Qb as i,ZY as a,Zb as o,ax as s,cx as c,dx as l,ex as u,ix as d,lx as f,nx as p,ox as m,rx as h,sX as g,sx as _,t as v,tx as y,ux as b}from"./api-ZghOy9gS.js";import{Jt as x,St as S,bt as C,vt as w,xt as T,yt as E}from"./index-C_ywXTWT.js";var D=t(e(),1);function O(e){return e===`user`?y():e===`all`?u():r({group:e.group})}function k(e){return e===`common`?i():e===`owner`?o():r({group:e.group})}var A=n();function j(e){return e.name||e.email||e.userId.slice(0,8)}function M(){let e=g(v.admin.listUsers,{}),[t,n]=(0,D.useState)(``),r=g(v.introspect.introspectUser,t?{userId:t}:`skip`);return(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:l()}),(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:f()}):r===void 0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:a()}):(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:c()}),(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:h()}):(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:m()}),r.agents.length===0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:h()}):(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:p()}):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:s()}),r.charts.length===0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:h()}):(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:d()}),r.permissions.length===0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:h()}):(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-ZghOy9gS.js";import{r as u}from"./dist-CzXQ0eKG.js";import{t as d}from"./x-SeWtpTcs.js";import{t as f}from"./button-kCamrfzR.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-ZghOy9gS.js";import{r as u}from"./dist-CzXQ0eKG.js";import{t as d}from"./x-SeWtpTcs.js";import{t as f}from"./button-kCamrfzR.js";import{$t as p,Ln as m,St as h,bt as g,vt as _,xt as v,yt as y}from"./index-C_ywXTWT.js";import{r as b}from"./TimeRangePicker-D-l1jL_i.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{$Y as r,$d as i,A_ as a,Ad as o,C_ as s,D_ as c,E_ as l,F_ as u,Fd as d,I_ as f,M_ as p,Md as m,N_ as h,Nd as g,O_ as _,P_ as v,Pd as y,Qd as b,S_ as x,Sv as S,T_ as C,ZY as w,Zd as T,__ as E,_f as D,af as O,b_ as ee,bv as te,cV as k,c_ as A,cf as j,d_ as M,df as N,ef as P,f_ as F,ff as I,g_ as L,gf as ne,h_ as R,hf as z,iX as B,if as V,j_ as re,jd as H,k_ as ie,kd as ae,l_ as oe,lf as U,m_ as se,mf as ce,nf as le,oX as ue,of as de,p_ as fe,pf as pe,rf as me,sX as W,s_ as he,sf as ge,ss as _e,t as G,tf as ve,u_ as ye,uf as be,v_ as xe,w_ as Se,x_ as Ce,y_ as we}from"./api-ZghOy9gS.js";import{t as K}from"./button-kCamrfzR.js";import{Bt as Te,Ct as Ee,Dt as De,Gt as Oe,Ht as ke,Jt as Ae,Kt as je,Ot as Me,St as Ne,Tt as Pe,Ut as Fe,Vt as Ie,Wt as Le,Yt as q,bt as Re,ft as ze,kn as J,nt as Be,qt as Ve,vt as He,wt as Ue,xt as We,yt as Ge}from"./index-
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$Y as r,$d as i,A_ as a,Ad as o,C_ as s,D_ as c,E_ as l,F_ as u,Fd as d,I_ as f,M_ as p,Md as m,N_ as h,Nd as g,O_ as _,P_ as v,Pd as y,Qd as b,S_ as x,Sv as S,T_ as C,ZY as w,Zd as T,__ as E,_f as D,af as O,b_ as ee,bv as te,cV as k,c_ as A,cf as j,d_ as M,df as N,ef as P,f_ as F,ff as I,g_ as L,gf as ne,h_ as R,hf as z,iX as B,if as V,j_ as re,jd as H,k_ as ie,kd as ae,l_ as oe,lf as U,m_ as se,mf as ce,nf as le,oX as ue,of as de,p_ as fe,pf as pe,rf as me,sX as W,s_ as he,sf as ge,ss as _e,t as G,tf as ve,u_ as ye,uf as be,v_ as xe,w_ as Se,x_ as Ce,y_ as we}from"./api-ZghOy9gS.js";import{t as K}from"./button-kCamrfzR.js";import{Bt as Te,Ct as Ee,Dt as De,Gt as Oe,Ht as ke,Jt as Ae,Kt as je,Ot as Me,St as Ne,Tt as Pe,Ut as Fe,Vt as Ie,Wt as Le,Yt as q,bt as Re,ft as ze,kn as J,nt as Be,qt as Ve,vt as He,wt as Ue,xt as We,yt as Ge}from"./index-C_ywXTWT.js";import{n as Ke,t as qe}from"./curation-CQksaIbm.js";import{a as Je}from"./compatView-BC1dh2j7.js";/* empty css */var Y=t(e(),1),X=2e4,Ye=6e4;function Xe(e){return typeof e!=`number`||e<=0?0:Math.round(e/X*100)}function Ze(e){return e<=0?0:Math.round(e/Ye*100)}function Z(e,t){let n=(typeof e==`number`&&e>0?e:0)/1e3;return new Intl.NumberFormat(t,{minimumFractionDigits:1,maximumFractionDigits:1}).format(n)}function Qe(e){return e.reduce((e,t)=>e+(typeof t.size==`number`&&t.size>0?t.size:0),0)}var $e=3;function et(e,t){let n=new Map;for(let t of e.split(`
|
|
2
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=W(G.me.getMe,{host:ze}),t=e?.role===`admin`,n=(e?.permissions??[]).includes(`bridge.read`),i=W(G.admin.listInstances,e!==void 0&&t?{}:`skip`),[o,s]=(0,Y.useState)(null);(0,Y.useEffect)(()=>{!t||!i||i.length===0||(!o||!i.some(e=>e.name===o))&&s(i[0].name)},[t,i,o]);let d=W(G.agents.listAgentsForInstance,t&&o?{instanceName:o}:`skip`),m=W(G.agents.listMyAgents,e!==void 0&&!t?{}:`skip`),g=(0,Y.useMemo)(()=>{if(e!==void 0){if(t)return o===null||d===void 0?i!==void 0&&i.length===0?[]:void 0:d.agents.map(e=>({instanceName:o,agentId:e.agentId,label:`${e.emoji?`${e.emoji} `:``}${e.displayName??e.agentId}`}));if(m!==void 0)return m.map(e=>({instanceName:e.instanceName,agentId:e.agentId,label:`${e.emoji?`${e.emoji} `:``}${e.displayName??e.agentId}`}))}},[e,t,o,d,i,m]),[y,b]=(0,Y.useState)(null);(0,Y.useEffect)(()=>{!g||g.length===0||(!y||!g.some(e=>$(e)===y))&&b($(g[0]))},[g,y]);let x=g?.find(e=>$(e)===y)??null,S=B(G.agentFiles.listAgentFiles),[T,E]=(0,Y.useState)({status:`idle`}),D=x?.instanceName??null,O=x?.agentId??null,ee=W(G.compat.forInstance,n&&D!==null?{instanceName:D}:`skip`),k=n&&D!==null?Be(ee,`agentFiles`):null,A=k===null?!1:k===`loading`?null:k.blocked,j=(0,Y.useCallback)(async()=>{if(!(D===null||O===null)){E({status:`loading`});try{E({status:`done`,files:(await S({instanceName:D,agentId:O})).files})}catch(e){E({status:`error`,dashboardAbsent:tt(e)})}}},[S,D,O]);(0,Y.useEffect)(()=>{A===!1&&j()},[j,A]);let[M,N]=(0,Y.useState)(null),P=W(G.agentFileCuration.listCurations,t&&D!==null&&O!==null?{instanceName:D,agentId:O}:`skip`),F=W(G.agentFileCuration.curationSettings,t&&D!==null?{instanceName:D}:`skip`),L=B(G.agentFileCuration.requestCuration),[ne,R]=(0,Y.useState)(null),[z,V]=(0,Y.useState)(null),{toast:H}=q(),ae=(0,Y.useMemo)(()=>{let e=new Map;for(let t of P??[])e.has(t.name)||e.set(t.name,t);return e},[P]),oe=(0,Y.useCallback)(async e=>{if(!(D===null||O===null)){R(e);try{let t=await L({instanceName:D,agentId:O,name:e,trigger:`manual`});t.ok?H({title:ce(),variant:`success`}):H({title:pe({reason:t.reason??`unknown`}),variant:`error`})}catch{H({title:I(),variant:`error`})}finally{R(null)}}},[L,D,O,H]),U=r(),se=(0,Y.useMemo)(()=>new Intl.NumberFormat(U,{maximumFractionDigits:0}),[U]);return e===void 0||g===void 0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:w()}):(0,Q.jsxs)(`div`,{className:`oc-afiles`,children:[(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:f()}),(0,Q.jsxs)(`div`,{className:`oc-afiles__picker`,children:[t&&(i?.length??0)>1?(0,Q.jsxs)(He,{value:o??``,onValueChange:e=>s(e),children:[(0,Q.jsx)(We,{size:`sm`,"aria-label":u(),children:(0,Q.jsx)(Ne,{})}),(0,Q.jsx)(Ge,{children:(i??[]).map(e=>(0,Q.jsx)(Re,{value:e.name,children:e.name},e.name))})]}):null,g.length>0?(0,Q.jsxs)(He,{value:y??``,onValueChange:e=>b(e),children:[(0,Q.jsx)(We,{size:`sm`,"aria-label":v(),children:(0,Q.jsx)(Ne,{})}),(0,Q.jsx)(Ge,{children:g.map(e=>(0,Q.jsx)(Re,{value:$(e),children:e.label},$(e)))})]}):(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:h()})]}),x===null?null:k===`loading`?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:w()}):k!==null&&k.blocked?(0,Q.jsxs)(`p`,{className:`oc-compat__blocked`,role:`status`,children:[(0,Q.jsx)(J,{size:14,"aria-hidden":!0}),` `,Je(k.gatewayVersion,k.provider)]}):T.status===`loading`||T.status===`idle`?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:w()}):T.status===`error`?(0,Q.jsxs)(`p`,{className:`oc-afiles__error`,role:`alert`,children:[T.dashboardAbsent?_e():re(),` `,!T.dashboardAbsent&&(0,Q.jsx)(K,{variant:`outline`,size:`sm`,onClick:()=>void j(),children:te()})]}):T.files.length===0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:p()}):(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)(Ae,{variant:`outline`,children:a()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`span`,{className:`oc-afiles__size`,children:ie({size:Z(e.size,U)})}),(0,Q.jsx)(`span`,{className:`oc-afiles__gauge${r?` is-warn`:``}`,"aria-hidden":!0,children:(0,Q.jsx)(`span`,{className:`oc-afiles__gauge-fill`,style:{width:`${Math.min(n,100)}%`}})}),(0,Q.jsx)(`span`,{className:`oc-afiles__pct`,children:_({pct:se.format(n)})}),r?(0,Q.jsx)(J,{size:14,className:`oc-afiles__warn`,"aria-label":c()}):(0,Q.jsx)(`span`,{className:`oc-afiles__warn-slot`,"aria-hidden":!0})]}),(0,Q.jsx)(K,{variant:`outline`,size:`sm`,className:`oc-afiles__open`,onClick:()=>N(e),children:t?C():Se()}),t&&!e.missing?(0,Q.jsx)(it,{curatable:qe.includes(e.name),size:e.size??0,budget:F?.budgetChars??null,enabled:F?.enabled??!1,curation:ae.get(e.name)??null,inFlight:ne===e.name,onCurate:()=>void oe(e.name),onReview:e=>V(e)}):null]},e.name)})}),(0,Q.jsx)(`p`,{className:`oc-afiles__budget`,children:l({used:Z(Qe(T.files),U),total:Z(Ye,U),pct:se.format(Ze(Qe(T.files)))})})]}),M&&x?(0,Q.jsx)(at,{instanceName:x.instanceName,agentId:x.agentId,name:M.name,isAdmin:t,onClose:()=>N(null),onSaved:()=>void j()}):null,z?(0,Q.jsx)(ot,{curationId:z,onClose:()=>V(null),onApplied:()=>{V(null),j()}}):null]})}function it({curatable:e,size:t,budget:n,enabled:r,curation:i,inFlight:a,onCurate:o,onReview:s}){return i?.status===`proposed`?(0,Q.jsx)(K,{variant:`default`,size:`sm`,className:`oc-afiles__curate`,onClick:()=>s(i._id),children:ne()}):a||i?.status===`dispatched`||i?.status===`applying`?(0,Q.jsx)(Ae,{variant:`outline`,className:`oc-afiles__curate-status`,children:z()}):e&&r&&n!==null&&Ke(t,n)?(0,Q.jsx)(K,{variant:`outline`,size:`sm`,className:`oc-afiles__curate`,onClick:o,children:D()}):null}function at({instanceName:e,agentId:t,name:n,isAdmin:i,onClose:a,onSaved:o}){let c=B(G.agentFiles.getAgentFile),l=B(G.agentFiles.setAgentFile),u=q(),[d,f]=(0,Y.useState)(null),[p,m]=(0,Y.useState)(!1),[h,g]=(0,Y.useState)(``),[_,v]=(0,Y.useState)(!1),[y,b]=(0,Y.useState)(!1),[C,T]=(0,Y.useState)(!1),[D,O]=(0,Y.useState)(!1),j=(0,Y.useCallback)(async r=>{m(!1);try{let i=await c({instanceName:e,agentId:t,name:n});f({content:i.content,updatedAtMs:i.updatedAtMs}),r||g(i.content),T(!1)}catch{m(!0)}},[c,e,t,n]);(0,Y.useEffect)(()=>{j(!1)},[j]);async function N(){if(d!==null){b(!0),O(!1);try{await l({instanceName:e,agentId:t,name:n,content:h,baseUpdatedAtMs:d.updatedAtMs??void 0}),u.success(E({name:n})),o(),await j(!1)}catch(e){nt(e)?T(!0):O(!0)}finally{b(!1)}}}let P=d!==null&&h!==d.content,I=(0,Y.useMemo)(()=>d===null?null:et(d.content,h),[d,h]),ne=h.length>X,z=r(),V=(0,Y.useMemo)(()=>new Intl.NumberFormat(z),[z]);return(0,Q.jsx)(Ee,{open:!0,onOpenChange:e=>!e&&a(),children:(0,Q.jsxs)(Ue,{className:`oc-afiles__editor`,children:[(0,Q.jsxs)(De,{children:[(0,Q.jsx)(Me,{children:s({name:n})}),(0,Q.jsxs)(Pe,{children:[x({agent:t,instance:e}),i?null:(0,Q.jsxs)(Q.Fragment,{children:[` · `,Ce()]})]})]}),p?(0,Q.jsxs)(`p`,{className:`oc-afiles__error`,role:`alert`,children:[R(),` `,(0,Q.jsx)(K,{variant:`outline`,size:`sm`,onClick:()=>void j(!1),children:te()})]}):d===null?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:w()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`textarea`,{className:`oc-afiles__source`,value:h,readOnly:!i,spellCheck:!1,onChange:e=>g(e.target.value),"aria-label":s({name:n})}),(0,Q.jsx)(`p`,{className:`oc-afiles__hint`,children:ee()}),C?(0,Q.jsxs)(`p`,{className:`oc-afiles__error`,role:`alert`,children:[se(),` `,(0,Q.jsx)(K,{variant:`outline`,size:`sm`,onClick:()=>void j(!0),children:fe()})]}):null,D?(0,Q.jsx)(`p`,{className:`oc-afiles__error`,role:`alert`,children:L()}):null,(0,Q.jsxs)(`div`,{className:`oc-afiles__editor-foot`,children:[(0,Q.jsx)(`span`,{className:`oc-afiles__count${ne?` is-over`:``}`,children:we({count:V.format(h.length),max:V.format(X)})}),i?(0,Q.jsx)(K,{size:`sm`,disabled:!P||y||C,onClick:()=>v(!0),children:y?S():xe()}):null]})]}),(0,Q.jsx)(Te,{open:_,onOpenChange:v,children:(0,Q.jsxs)(Fe,{children:[(0,Q.jsxs)(je,{children:[(0,Q.jsx)(Ve,{children:F({name:n})}),(0,Q.jsx)(Le,{children:M({agent:t})})]}),I?(0,Q.jsxs)(`div`,{className:`oc-afiles__diff`,children:[(0,Q.jsx)(`p`,{className:`oc-afiles__diff-counts`,children:ye({added:I.added,removed:I.removed})}),I.sampleAdded.length>0?(0,Q.jsxs)(`div`,{className:`oc-afiles__diff-block`,children:[(0,Q.jsx)(`span`,{className:`oc-afiles__diff-label`,children:oe()}),I.sampleAdded.map((e,t)=>(0,Q.jsx)(`code`,{className:`oc-afiles__diff-line is-add`,children:e||` `},t))]}):null,I.sampleRemoved.length>0?(0,Q.jsxs)(`div`,{className:`oc-afiles__diff-block`,children:[(0,Q.jsx)(`span`,{className:`oc-afiles__diff-label`,children:A()}),I.sampleRemoved.map((e,t)=>(0,Q.jsx)(`code`,{className:`oc-afiles__diff-line is-del`,children:e||` `},t))]}):null]}):null,(0,Q.jsxs)(Oe,{children:[(0,Q.jsx)(ke,{children:k()}),(0,Q.jsx)(Ie,{onClick:()=>void N(),children:he()})]})]})})]})})}function ot({curationId:e,onClose:t,onApplied:n}){let a=W(G.agentFileCuration.getProposal,{curationId:e}),s=B(G.agentFileCuration.approveCuration),c=ue(G.agentFileCuration.rejectCuration),{toast:l}=q(),[u,f]=(0,Y.useState)(null),[p,h]=(0,Y.useState)(!1),[_,v]=(0,Y.useState)(``),x=r(),C=(0,Y.useMemo)(()=>a?et(a.beforeContent,a.proposedContent):null,[a]);async function E(){f(`approve`);try{let t=await s({curationId:e});t.ok?(l({title:N(),variant:`success`}),n()):l({title:t.reason===`conflict`?U():j({reason:t.reason??`unknown`}),variant:`error`})}catch{l({title:I(),variant:`error`})}finally{f(null)}}async function D(n){f(`reject`);try{let r=_.trim();(await c({curationId:e,...r?{comment:r}:{},relaunch:n})).ok?l({title:n?o():be(),variant:`success`}):l({title:O(),variant:`error`}),t()}catch{l({title:I(),variant:`error`})}finally{f(null)}}return(0,Q.jsx)(Ee,{open:!0,onOpenChange:e=>e?void 0:t(),children:(0,Q.jsxs)(Ue,{className:`oc-afiles__review`,children:[(0,Q.jsxs)(De,{children:[(0,Q.jsx)(Me,{children:a?ge({name:a.name}):w()}),(0,Q.jsx)(Pe,{children:de()})]}),a===void 0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:w()}):a===null?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:O()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`p`,{className:`oc-afiles__review-sizes`,children:[V({before:Z(a.beforeSize,x),after:Z(a.proposedSize,x)}),a.overBudget?(0,Q.jsxs)(Q.Fragment,{children:[` `,(0,Q.jsx)(J,{size:13,"aria-hidden":!0}),` `,me()]}):null]}),C?(0,Q.jsx)(`p`,{className:`oc-afiles__review-diff`,children:le({added:C.added,removed:C.removed})}):null,a.feedback?(0,Q.jsx)(`p`,{className:`oc-afiles__review-feedback`,children:ae({feedback:a.feedback})}):null,C&&C.sampleRemoved.length>0?(0,Q.jsxs)(`div`,{className:`oc-afiles__review-removed`,children:[(0,Q.jsx)(`p`,{className:`oc-afiles__review-label`,children:T()}),(0,Q.jsx)(`ul`,{children:C.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:b()}),(0,Q.jsx)(`pre`,{className:`oc-afiles__review-pre`,children:a.beforeContent})]}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`p`,{className:`oc-afiles__review-label`,children:ve()}),(0,Q.jsx)(`pre`,{className:`oc-afiles__review-pre`,children:a.proposedContent})]})]})]}),p?(0,Q.jsxs)(`div`,{className:`oc-afiles__reject-form`,children:[(0,Q.jsx)(`label`,{className:`oc-afiles__review-label`,htmlFor:`curation-reject-comment`,children:d()}),(0,Q.jsx)(`textarea`,{id:`curation-reject-comment`,className:`oc-afiles__reject-textarea`,rows:3,placeholder:y(),value:_,onChange:e=>v(e.target.value)}),(0,Q.jsxs)(`div`,{className:`oc-afiles__review-actions`,children:[(0,Q.jsx)(K,{variant:`ghost`,onClick:()=>h(!1),disabled:u!==null,children:g()}),(0,Q.jsx)(K,{variant:`outline`,onClick:()=>void D(!1),disabled:u!==null,children:u===`reject`?S():m()}),(0,Q.jsx)(K,{variant:`default`,onClick:()=>void D(!0),disabled:u!==null,children:u===`reject`?S():H()})]})]}):(0,Q.jsxs)(`div`,{className:`oc-afiles__review-actions`,children:[(0,Q.jsx)(K,{variant:`outline`,onClick:()=>h(!0),disabled:u!==null||a==null,children:P()}),(0,Q.jsx)(K,{variant:`default`,onClick:()=>void E(),disabled:u!==null||a==null,children:u===`approve`?S():i()})]})]})})}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 o,DM as ee,EM as te,FM as ne,IM as s,Jj as c,Kj as l,LM as re,MM as ie,NM as ae,OM as oe,PM as se,Qj as u,RM as ce,SM as le,TM as ue,VM as d,Xj as f,Yj as p,Zj as m,_M as de,aM as h,bM as fe,cM as g,dM as _,eM as pe,fM as me,gM as he,hM as ge,iM as _e,jM as ve,kM as ye,lM as be,mM as xe,nM as Se,oM as Ce,oX as we,pM as v,qj as y,rM as b,sM as x,sX 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-ZghOy9gS.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 z,o as ke,vt as B,wt as V,xt as H,yt as U}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 o,DM as ee,EM as te,FM as ne,IM as s,Jj as c,Kj as l,LM as re,MM as ie,NM as ae,OM as oe,PM as se,Qj as u,RM as ce,SM as le,TM as ue,VM as d,Xj as f,Yj as p,Zj as m,_M as de,aM as h,bM as fe,cM as g,dM as _,eM as pe,fM as me,gM as he,hM as ge,iM as _e,jM as ve,kM as ye,lM as be,mM as xe,nM as Se,oM as Ce,oX as we,pM as v,qj as y,rM as b,sM as x,sX 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-ZghOy9gS.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 z,o as ke,vt as B,wt as V,xt as H,yt as U}from"./index-C_ywXTWT.js";import{n as Ae}from"./TimeRangePicker-D-l1jL_i.js";import{t as je}from"./FilterBar-DDDj8Wi2.js";import{t as Me}from"./DataTableShell-DwQKTbat.js";import{t as W}from"./dispatchErrorInfo-DBBnWn64.js";var G=t(e(),1),K=new Set([`openclaw.dispatch_failures`,`assistant.announce_errors`]),q=new Set([`assistant.cause.provider_auth_revoked`,`assistant.cause.provider_permission_denied`,`assistant.cause.provider_auth_failed`]);function J(e){let t=q.has(e.kind);if(!K.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 Y=n(),X=`__all__`,Ne=[{value:`open`},{value:`acknowledged`},{value:`resolved`}];function Pe(e){return e===`open`?d():e===`acknowledged`?a():A()}var Fe=[`info`,`warn`,`critical`],Ie=[`detector`,`agent`,`user`],Le={kind:`relative`,from:`now-30d`,to:`now`},Re=200,Z=`all`;function Q(){let e=De({from:`/settings/anomalies`}),t=R({from:`/settings/anomalies`}),n=e.q??``,r=e.status===Z?X:e.status,a=e.severity??X,c=e.kind??X,[l,u]=(0,G.useState)(X),d=z(e.from,e.to),{from:f,to:p}=Ae(d),m=e=>void t({search:t=>({...t,q:e||void 0}),replace:!0}),y=e=>void t({search:t=>({...t,status:e===X?Z:e})}),A=e=>void t({search:t=>({...t,severity:e===X?void 0:e})}),M=e=>void t({search:t=>({...t,kind:e===X?void 0:e})}),N=e=>void t({search:t=>({...t,...ke(e)})}),F=Ee(),V=Te(),W=we(C.anomalies.resolveAnomaly),K=(S(C.me.getMe,{host:Oe})?.permissions??[]).includes(`admin.manage`),q=S(C.anomalies.listAnomalies,{limit:Re,filter:{q:n||void 0,from:f,to:p,anomalyStatus:r===X?void 0:r,severity:a===X?void 0:a,source:l===X?void 0:l,kind:c===X?void 0:c}}),J=(0,G.useMemo)(()=>{let e=new Set;for(let t of q??[])e.add(t.kind);return[...e].sort()},[q]),Q=n!==``||r!==`open`||a!==X||l!==X||c!==X||d.kind!==`relative`||d.from!==Le.from;function $(){u(X),t({search:{status:`open`},replace:!0})}async function We(e){if(await F({title:ce(),description:(0,Y.jsxs)(Y.Fragment,{children:[re(),` `,(0,Y.jsx)(`span`,{className:`font-mono`,children:e.kind}),` `,s(),` `,(0,Y.jsx)(`strong`,{children:ne()}),`.`,` `,se()]}),confirmLabel:ae()}))try{await W({anomalyId:e._id,status:`resolved`}),V.success(ie(),e.kind)}catch(e){V.error(ve(),e)}}async function Ge(e){try{await W({anomalyId:e._id,status:`acknowledged`}),V.success(i(),e.kind)}catch(e){V.error(ye(),e)}}return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(`p`,{className:`oc-admin__hint`,children:[oe(),` `,(0,Y.jsx)(`strong`,{children:ee()}),` `,te(),` `,(0,Y.jsx)(`strong`,{children:ue()}),` `,D(),` `,(0,Y.jsx)(`strong`,{children:o()}),` `,le(),` `,(0,Y.jsx)(`span`,{className:`oc-filter__window`,children:O()})]}),(0,Y.jsxs)(je,{q:n,onQChange:m,searchPlaceholder:fe(),timeRange:d,onTimeRangeChange:N,onReset:$,canReset:Q,children:[(0,Y.jsxs)(B,{value:r,onValueChange:y,children:[(0,Y.jsx)(H,{size:`sm`,className:`w-36`,children:(0,Y.jsx)(I,{})}),(0,Y.jsxs)(U,{children:[(0,Y.jsx)(L,{value:X,children:k()}),Ne.map(e=>(0,Y.jsx)(L,{value:e.value,children:Pe(e.value)},e.value))]})]}),(0,Y.jsxs)(B,{value:a,onValueChange:A,children:[(0,Y.jsx)(H,{size:`sm`,className:`w-36`,children:(0,Y.jsx)(I,{placeholder:E()})}),(0,Y.jsxs)(U,{children:[(0,Y.jsx)(L,{value:X,children:xe()}),Fe.map(e=>(0,Y.jsx)(L,{value:e,children:e},e))]})]}),(0,Y.jsxs)(B,{value:l,onValueChange:u,children:[(0,Y.jsx)(H,{size:`sm`,className:`w-32`,children:(0,Y.jsx)(I,{placeholder:v()})}),(0,Y.jsxs)(U,{children:[(0,Y.jsx)(L,{value:X,children:me()}),Ie.map(e=>(0,Y.jsx)(L,{value:e,children:e},e))]})]}),(0,Y.jsxs)(B,{value:c,onValueChange:M,children:[(0,Y.jsx)(H,{size:`sm`,className:`w-36`,children:(0,Y.jsx)(I,{placeholder:_()})}),(0,Y.jsxs)(U,{children:[(0,Y.jsx)(L,{value:X,children:T()}),J.map(e=>(0,Y.jsx)(L,{value:e,children:e},e))]})]})]}),(0,Y.jsx)(Me,{title:be(),rows:q,emptyHint:r===`open`?g():x(),rowActions:e=>K&&e.status===`open`?[{label:Ce(),onSelect:()=>void We(e)},{label:h(),onSelect:()=>void Ge(e)}]:[],columns:[{header:_e(),cell:e=>(0,Y.jsx)(`span`,{className:`oc-traces__time`,children:j(e.at)}),sort:e=>e.at},{header:_(),cell:e=>(0,Y.jsx)(`code`,{className:`oc-traces__mono`,children:e.kind}),sort:e=>e.kind},{header:de(),cell:e=>e.occurrenceCount!==null&&e.occurrenceCount>1?(0,Y.jsx)(`span`,{className:`oc-traces__time`,title:e.firstAt===null?void 0:ge({when:j(e.firstAt)}),children:he({count:String(e.occurrenceCount)})}):(0,Y.jsx)(`span`,{className:`oc-traces__time`,children:`—`}),sort:e=>e.occurrenceCount??0},{header:E(),cell:e=>(0,Y.jsx)(Ve,{severity:e.severity}),sort:e=>e.severity===`critical`?2:+(e.severity===`warn`)},{header:b(),cell:e=>(0,Y.jsx)(He,{status:e.status}),sort:e=>e.status===`resolved`?2:+(e.status===`acknowledged`)},{header:v(),cell:e=>(0,Y.jsx)(P,{variant:`outline`,children:e.source}),sort:e=>e.source},{header:Se(),cell:e=>(0,Y.jsxs)(`div`,{className:`oc-anomaly__msgcell`,children:[(0,Y.jsx)(`span`,{className:`oc-anomaly__msg`,children:e.message}),(0,Y.jsx)(Be,{row:e})]}),sort:e=>e.message},{header:w(),cell:e=>(0,Y.jsx)(ze,{row:e}),sort:e=>e.evidence??null},{header:pe(),cell:e=>e.correlationId?(0,Y.jsx)(`code`,{className:`oc-traces__mono`,children:Ue(e.correlationId)}):(0,Y.jsx)(`span`,{className:`oc-traces__muted`,children:`—`}),sort:e=>e.correlationId}]})]})}function $(e){if(e.kind!==`subagent.failure`||!e.evidence)return{};try{let t=JSON.parse(e.evidence);return{failedCount:t.failedCount,totalCount:t.totalCount,errorCategories:t.errorCategories}}catch{return{}}}function ze({row:e}){let t=R();if(e.kind===`subagent.failure`){let n=$(e);return(0,Y.jsxs)(`div`,{className:`oc-anomaly__cause`,children:[(0,Y.jsx)(`div`,{className:`oc-anomaly__cause-head`,children:[...new Set(n.errorCategories??[])].map(e=>(0,Y.jsx)(`code`,{className:`oc-traces__mono`,children:e},e))}),e.correlationId?(0,Y.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=J(e);if(!n.dominantCode){let e=n.sampleCorrelationId;return e?(0,Y.jsx)(`div`,{className:`oc-anomaly__cause`,children:(0,Y.jsxs)(`button`,{type:`button`,className:`oc-anomaly__drill`,onClick:()=>void t({to:`/settings/traces`,search:{correlationId:e,limit:100}}),children:[`↗ `,r()]})}):(0,Y.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})}let i=W(n.dominantCode,n.context),a=n.sampleCorrelationId;return(0,Y.jsxs)(`div`,{className:`oc-anomaly__cause`,children:[(0,Y.jsxs)(`div`,{className:`oc-anomaly__cause-head`,children:[(0,Y.jsx)(`span`,{className:`oc-anomaly__cause-label`,children:i.label}),(0,Y.jsx)(`code`,{className:`oc-traces__mono`,children:n.dominantCode})]}),(0,Y.jsx)(`p`,{className:`oc-anomaly__cause-hint`,children:i.hint}),a?(0,Y.jsxs)(`button`,{type:`button`,className:`oc-anomaly__drill`,onClick:()=>void t({to:`/settings/traces`,search:{correlationId:a,limit:100}}),children:[`↗ `,r()]}):null]})}function Be({row:e}){let[t,n]=(0,G.useState)(!1),r=S(C.anomalies.getAnomalyAttachments,t?{anomalyId:e._id}:`skip`);return!e.attachments||e.attachments.length===0?null:(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(`button`,{type:`button`,className:`oc-anomaly__drill`,onClick:()=>n(!0),children:[u(),e.attachments.length>1?` (${e.attachments.length})`:``]}),(0,Y.jsx)(M,{open:t,onOpenChange:n,children:(0,Y.jsxs)(V,{className:`oc-anomaly__attachments-dialog`,children:[(0,Y.jsx)(N,{children:(0,Y.jsx)(F,{children:m()})}),r===void 0?(0,Y.jsx)(`p`,{className:`oc-traces__muted`,children:f()}):r.length===0?(0,Y.jsx)(`p`,{className:`oc-traces__muted`,children:p()}):(0,Y.jsx)(`div`,{className:`oc-anomaly__attachments`,children:r.map(e=>(0,Y.jsxs)(`section`,{className:`oc-anomaly__attachment`,children:[(0,Y.jsx)(`h4`,{className:`oc-anomaly__attachment-name`,children:(0,Y.jsx)(`code`,{className:`oc-traces__mono`,children:e.name})}),(0,Y.jsx)(`pre`,{className:`oc-anomaly__attachment-content`,children:e.content})]},e.name))})]})})]})}function Ve({severity:e}){return(0,Y.jsx)(`span`,{className:`oc-anomaly__sev oc-anomaly__sev--${e}`,children:e})}function He({status:e}){return e===`open`?(0,Y.jsx)(P,{variant:`destructive`,children:c()}):e===`acknowledged`?(0,Y.jsx)(P,{variant:`secondary`,children:y()}):(0,Y.jsx)(P,{variant:`outline`,children:l()})}function Ue(e){return e.length>8?e.slice(0,8):e}export{Q 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 _,VN as v,WN as y,ju as b,ku as x,qN as S,sX as C,t as w,zN as T}from"./api-ZghOy9gS.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 _,VN as v,WN as y,ju as b,ku as x,qN as S,sX as C,t as w,zN as T}from"./api-ZghOy9gS.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-C_ywXTWT.js";import{n as ee}from"./TimeRangePicker-D-l1jL_i.js";import{t as z}from"./FilterBar-DDDj8Wi2.js";import{t as B}from"./AdvancedFilter-NdO-ABAb.js";import{t as V}from"./DataTableShell-DwQKTbat.js";var H=t(e(),1),U=n(),W={kind:`relative`,from:N,to:`now`},G=`__all__`,K=[{value:`action`,label:b()},{value:`realLabel`,label:r()},{value:`targetLabel`,label:x()},{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),b=(0,H.useMemo)(()=>F(e.adv),[e.adv]),{from:x,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}),$=C(w.admin.listAudit,{filter:{q:n||void 0,from:x,to:N,action:r===G?void 0:r,resource:o===G?void 0:o,impersonated:a===G?void 0:a===`yes`,advanced:b.length>0?b: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||b.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:[S(),` `,(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:y()})}),(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:v()}),(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:b,onChange:Q}),(0,U.jsx)(V,{title:f(),rows:$,emptyHint:u(),columns:[{header:s(),cell:e=>E(e.at),sort:e=>e.at},{header:y(),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,Bg as o,Bk as s,CO as c,DO as l,E as u,EO as d,FO as f,GO as p,Gg as m,Gk as h,HO as g,Hg as _,Hk as ee,IO as v,Ik as te,JO as y,Jg as ne,Jl as re,KO as ie,Kg as ae,Kk as oe,LO as se,Lk as ce,MO as le,Mg as ue,Mk as de,NO as fe,Nk as pe,OO as me,PO as he,QO as ge,RO as _e,Rg as ve,Rk as ye,SO as be,TO as xe,UO as Se,Ug as Ce,Uk as we,VO as b,Va as Te,Vg as Ee,Vk as De,WO as Oe,Wg as ke,XO as Ae,Xg as je,Xl as Me,YO as Ne,Yg as Pe,Yl as Fe,ZO as Ie,Zl as Le,_O as Re,ak as ze,bO as Be,ck as Ve,cs as He,ek as Ue,eu as We,fO as Ge,gO as Ke,hO as qe,iX as Je,ik as Ye,jO as Xe,kO as Ze,lk as Qe,mO as x,nk as $e,oX as et,ok as tt,pO as S,qO as nt,qg as rt,ql as it,rk as at,sX as C,sk as ot,t as w,tk as st,uk as ct,vO as lt,wO as ut,xO as dt,yO as ft,zO as pt,zg as mt,zk as ht}from"./api-ZghOy9gS.js";import{r as T}from"./dist-CzXQ0eKG.js";import{t as gt}from"./chevrons-up-down-Btm4pQFN.js";import{i as _t,n as E,o as vt,r as yt,s as bt}from"./FieldLabel-DqPoFgwl.js";import{t as xt}from"./button-kCamrfzR.js";import{$t as D,At as St,Ct,Dt as wt,Jn as Tt,Jt as O,L as Et,Mt as Dt,Ot,Pn as k,St as A,Tt as kt,Yt as At,ar as j,at as jt,bt as M,cn as Mt,dr as N,fr as Nt,ft as Pt,it as Ft,jt as P,kn as F,on as It,or as Lt,ot as Rt,sn as zt,sr as I,st as Bt,vt as L,wt as Vt,xt as R,yt as z}from"./index-nxFP6zJZ.js";import{r as Ht}from"./locales-CPjguROj.js";import{a as B,i as V,n as Ut,o as H,r as U,t as Wt}from"./table-BpXBaCrR.js";import{t as Gt}from"./FilterBar-BTpxyiRB.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-BC1dh2j7.js";import{t as W}from"./dispatchErrorInfo-DBBnWn64.js";var $t=u(`refresh-cw`,[[`path`,{d:`M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8`,key:`v9h5vc`}],[`path`,{d:`M21 3v5h-5`,key:`1q7to0`}],[`path`,{d:`M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16`,key:`3uifl3`}],[`path`,{d:`M8 16H3v5`,key:`1cv678`}]]),en=u(`wifi-off`,[[`path`,{d:`M12 20h.01`,key:`zekei9`}],[`path`,{d:`M8.5 16.429a5 5 0 0 1 7 0`,key:`1bycff`}],[`path`,{d:`M5 12.859a10 10 0 0 1 5.17-2.69`,key:`1dl1wf`}],[`path`,{d:`M19 12.859a10 10 0 0 0-2.007-1.523`,key:`4k23kn`}],[`path`,{d:`M2 8.82a15 15 0 0 1 4.177-2.643`,key:`1grhjp`}],[`path`,{d:`M22 8.82a15 15 0 0 0-11.288-3.764`,key:`z3jwby`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}]]),G=t(e(),1);function tn(e){return e.filter(e=>e.state===`error`)}function nn(e){return e.reachable&&tn(e.targets).length===0}function rn(e){return nn(e)?(e.unreachableInstances??[]).length>0?`gateways_unreachable`:`ok`:`error`}function an(e){return e.state===`error`&&e.lastErrorCode!==null}function K(e){return!!e.lastDownstreamRejectCode}function on(e){return!!e.lastLocalRefusalCode}function sn(e){return an(e)||K(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]),u=(0,G.useMemo)(()=>gn(s),[s]),f=(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:l(),onReset:()=>r(un),canReset:dn(n),children:[(0,Q.jsxs)(L,{value:n.state,onValueChange:e=>r(t=>({...t,state:e})),children:[(0,Q.jsx)(R,{size:`sm`,className:`w-36`,children:(0,Q.jsx)(A,{placeholder:xe()})}),(0,Q.jsxs)(z,{children:[(0,Q.jsx)(M,{value:Y,children:d()}),u.map(e=>(0,Q.jsx)(M,{value:e,children:xn(e)},e))]})]}),(0,Q.jsxs)(L,{value:n.instance,onValueChange:e=>r(t=>({...t,instance:e})),children:[(0,Q.jsx)(R,{size:`sm`,className:`w-40`,children:(0,Q.jsx)(A,{placeholder:ut()})}),(0,Q.jsxs)(z,{children:[(0,Q.jsx)(M,{value:Y,children:d()}),f.map(e=>(0,Q.jsx)(M,{value:e.name,children:e.label},e.name))]})]}),(0,Q.jsxs)(L,{value:n.version,onValueChange:e=>r(t=>({...t,version:e})),children:[(0,Q.jsx)(R,{size:`sm`,className:`w-36`,children:(0,Q.jsx)(A,{placeholder:c()})}),(0,Q.jsxs)(z,{children:[(0,Q.jsx)(M,{value:Y,children:d()}),p.map(e=>(0,Q.jsx)(M,{value:e,children:e},e))]})]})]}),m.length===0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:be()}):(0,Q.jsxs)(Wt,{className:`oc-conn__table`,children:[(0,Q.jsx)(B,{children:(0,Q.jsxs)(H,{children:[(0,Q.jsx)($,{label:dt(),sortKey:`target`,sort:a,onSort:h}),(0,Q.jsx)($,{label:Be(),sortKey:`state`,sort:a,onSort:h}),(0,Q.jsx)($,{label:ft(),sortKey:`instance`,sort:a,onSort:h}),(0,Q.jsx)($,{label:lt(),sortKey:`host`,sort:a,onSort:h}),(0,Q.jsx)($,{label:Re(),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)(Lt,{size:13,"aria-hidden":!0}):(0,Q.jsx)(T,{size:13,"aria-hidden":!0}):(0,Q.jsx)(gt,{size:13,"aria-hidden":!0,className:`oc-conn__sort-idle`})]})})}function bn({r:e}){let t=an(e)?W(e.lastErrorCode):null,n=K(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:Ze({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:P(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?` · ${P(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:[Te({label:r.label}),` `,(0,Q.jsx)(`code`,{className:`oc-traces__mono`,children:e.lastLocalRefusalCode}),e.lastLocalRefusalAt?` · ${P(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:[me({label:n.label}),` `,(0,Q.jsx)(`code`,{className:`oc-traces__mono`,children:e.lastDownstreamRejectCode}),e.lastDownstreamRejectAt?` · ${P(e.lastDownstreamRejectAt)}`:``]}):null]})}):null]})}function xn(e){return e===`connected`?x():e===`error`?S():Ge()}function Sn({state:e}){return e===`connected`?(0,Q.jsx)(O,{variant:`secondary`,children:x()}):e===`error`?(0,Q.jsx)(O,{variant:`destructive`,children:S()}):(0,Q.jsx)(O,{variant:`outline`,children:Ge()})}function Cn(){return C(w.bridgeHealth.getBridgeHealth,{})}function wn(){let e=Cn(),t=C(w.compat.getBridgeCompat,{}),n=C(w.me.getMe,{host:Pt})?.role===`admin`,r=C(w.admin.listInstances,n?{}:`skip`),i=C(w.agents.usageForInstances,n?{}:`skip`),a=N(),o=()=>void a({to:`/settings/anomalies`,search:{status:`open`}}),s=ln(e?e.targets:[],t?t.targets:[],r??[]),{section:c}=Nt({from:`/settings/bridge`}),l=N({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:Ae()}),i&&i.length>0?(0,Q.jsxs)(`section`,{className:`oc-bridge__usage`,children:[(0,Q.jsx)(`h3`,{className:`oc-bridge__usage-title`,children:Ne()}),(0,Q.jsxs)(Wt,{children:[(0,Q.jsx)(B,{children:(0,Q.jsxs)(H,{children:[(0,Q.jsx)(V,{children:Le()}),(0,Q.jsx)(V,{children:Me()}),(0,Q.jsx)(V,{children:Fe()}),(0,Q.jsx)(V,{children:re()}),(0,Q.jsx)(V,{children:it()})]})}),(0,Q.jsx)(Ut,{children:i.flatMap(e=>{let t=Et(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)(O,{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)(Ft,{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)(Rt,{className:`w-full`,children:s.map(e=>(0,Q.jsxs)(Bt,{value:e.key,className:`flex-1 gap-1.5`,children:[(0,Q.jsx)(k,{size:13,"aria-hidden":!0}),J(e.key)]},e.key))}),s.map(e=>(0,Q.jsx)(jt,{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:ue()}):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:ne(),children:[`(`,i,`)`]})]}):null,r?(0,Q.jsxs)(`strong`,{className:`oc-bridge-card__mismatch`,children:[` `,rt({build:t.buildVersion??`?`})]}):null,` · `,ae(),` `,(0,Q.jsx)(`code`,{className:`oc-traces__mono`,children:t.protocolVersion===null?m():String(t.protocolVersion)})]}):null;if(e===void 0)return(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:b()});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`,p=St(e.checkedAt),h=e.startedAt==null?null:St(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)(j,{size:22}):c||l===`gateways_unreachable`?(0,Q.jsx)(en,{size:22}):(0,Q.jsx)(F,{size:22})}),(0,Q.jsxs)(`div`,{className:`oc-bridge-card__body`,children:[(0,Q.jsx)(`div`,{className:`oc-bridge-card__title`,children:l===`ok`?pt():l===`gateways_unreachable`?f({count:u.length}):c?_e():se({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}),` `,v({time:p})]}),h?(0,Q.jsx)(`span`,{children:fe({time:h})}):null,o]}),l===`gateways_unreachable`?(0,Q.jsx)(`p`,{className:`oc-bridge-card__hint`,children:he({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:le()})]})}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)(k,{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)(O,{variant:d===`beyond`||d===`defective`||d===`unsupported`?`destructive`:`secondary`,children:qt(d)}):null]}),(0,Q.jsx)(`h4`,{className:`oc-bridge-provider__sub`,children:je()}),(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)(T,{size:13,"aria-hidden":!0}):(0,Q.jsx)(I,{size:13,"aria-hidden":!0}),Xe({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:[y(),i.length>0?(0,Q.jsx)(O,{variant:`destructive`,children:ie({count:i.length})}):a>0?(0,Q.jsx)(O,{variant:`destructive`,children:p()}):(0,Q.jsx)(O,{variant:`secondary`,children:nt()})]}),(0,Q.jsxs)(`p`,{className:`oc-admin__hint`,children:[Oe({version:e.vendoredVersion}),r?` · `+Se({handled:r.handled,ignored:r.ignored,gaps:r.gaps}):null]}),a>0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:He({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)(T,{size:13,"aria-hidden":!0}):(0,Q.jsx)(I,{size:13,"aria-hidden":!0}),g({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:b()}):t===`nodata`?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:Pe()}):(0,Q.jsxs)(`div`,{className:`oc-compat`,children:[n?null:(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:ke()}),r===null?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:Ce()}):(0,Q.jsxs)(`div`,{className:`oc-compat__support`,children:[(0,Q.jsx)(`span`,{className:`oc-compat__label`,children:We({provider:a})}),e&&e.range!==null?(0,Q.jsx)(`span`,{children:_({min:e.range.min,max:e.range.maxValidated})}):(0,Q.jsx)(`span`,{children:m()}),e?(0,Q.jsx)(Mn,{versions:e.validatedVersions}):null]}),i.length===0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:ve()}):(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)(O,{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)(Ct,{open:!0,onOpenChange:e=>!e&&t(),children:(0,Q.jsxs)(Vt,{className:`oc-bridge-config-dialog`,onOpenAutoFocus:e=>e.preventDefault(),children:[(0,Q.jsxs)(wt,{children:[(0,Q.jsx)(Ot,{children:oe({instance:e.displayName??e.name})}),(0,Q.jsx)(kt,{children:h()})]}),(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)(j,{"aria-hidden":!0}):(0,Q.jsx)(F,{"aria-hidden":!0}),(0,Q.jsxs)(`span`,{children:[e,` — `,t.ok?Ue():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=et(w.admin.upsertInstanceConfig),r=Je(w.bridge.validateMediaPaths),i=At(),a=Ht(e.config?.contentLocale,void 0),[o,c]=(0,G.useState)(()=>_t(e.config??{},a)),[l,u]=(0,G.useState)(!1),[d,f]=(0,G.useState)(!1),[p,m]=(0,G.useState)(null),h=o.inboundMediaMode===`shared-fs`,g=o.mediaMode===`shared-fs`,_=h||g;async function v(){f(!0),m(null);try{m(await r({instanceName:e.name,inboundMediaMode:o.inboundMediaMode,mediaMode:o.mediaMode}))}catch(e){i.error(Ye(),e)}finally{f(!1)}}async function y(){u(!0);try{let r=e.config??{};await n({instanceId:e._id,config:yt(o,r,a)}),t()}catch(e){i.error(ye(),e)}finally{u(!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)(E,{label:we(),help:ce()}),(0,Q.jsxs)(L,{value:o.mediaMode,onValueChange:e=>c({...o,mediaMode:e}),children:[(0,Q.jsx)(R,{size:`sm`,className:`w-full`,children:(0,Q.jsx)(A,{})}),(0,Q.jsx)(z,{children:bt.map(e=>(0,Q.jsx)(M,{value:e,children:e},e))})]})]}),(0,Q.jsxs)(`label`,{className:`oc-field`,children:[(0,Q.jsx)(E,{label:ee(),help:te()}),(0,Q.jsxs)(L,{value:o.inboundMediaMode,onValueChange:e=>c({...o,inboundMediaMode:e}),children:[(0,Q.jsx)(R,{size:`sm`,className:`w-full`,children:(0,Q.jsx)(A,{})}),(0,Q.jsx)(z,{children:vt.map(e=>(0,Q.jsx)(M,{value:e,children:e},e))})]})]}),(0,Q.jsxs)(`label`,{className:`oc-field`,children:[(0,Q.jsx)(E,{label:De(),help:pe()}),(0,Q.jsx)(D,{type:`number`,min:1,max:4096,className:`w-full`,value:o.mediaMaxMb,onChange:e=>c({...o,mediaMaxMb:Math.trunc(Number(e.target.value)||0)})})]})]}),_&&(0,Q.jsxs)(`div`,{className:`oc-bridge-config__grid`,children:[h&&(0,Q.jsxs)(`label`,{className:`oc-field`,children:[(0,Q.jsx)(E,{label:ct(),help:Qe()}),(0,Q.jsx)(D,{className:`w-full`,spellCheck:!1,value:o.inboundAgentMount,onChange:e=>c({...o,inboundAgentMount:e.target.value})})]}),g&&(0,Q.jsxs)(`label`,{className:`oc-field`,children:[(0,Q.jsx)(E,{label:Ve(),help:ot()}),(0,Q.jsx)(D,{className:`w-full`,spellCheck:!1,value:o.outboundAgentMount,onChange:e=>c({...o,outboundAgentMount:e.target.value})})]})]}),(0,Q.jsxs)(`label`,{className:`oc-field--row`,children:[(0,Q.jsx)(Dt,{checked:o.rehydration,onCheckedChange:e=>c({...o,rehydration:e===!0})}),(0,Q.jsx)(E,{label:s(),help:de()})]}),_&&p!==null&&(0,Q.jsx)(`div`,{className:`oc-bridge-config__check`,children:p.reachable?!p.inbound&&!p.outbound?(0,Q.jsxs)(`p`,{className:`oc-bridge-config__check-row oc-bridge-config__check-row--err`,children:[(0,Q.jsx)(F,{"aria-hidden":!0}),Ie({reason:p.reason??`?`})]}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(An,{label:$e(),result:p.inbound}),(0,Q.jsx)(An,{label:st(),result:p.outbound}),(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:at()})]}):(0,Q.jsxs)(`p`,{className:`oc-bridge-config__check-row oc-bridge-config__check-row--err`,children:[(0,Q.jsx)(F,{"aria-hidden":!0}),ge()]})}),(0,Q.jsxs)(`div`,{className:`oc-bridge-config__actions`,children:[_&&(0,Q.jsxs)(xt,{variant:`outline`,size:`sm`,onClick:()=>void v(),disabled:d,children:[d?(0,Q.jsx)(Tt,{className:`size-4 animate-spin`,"aria-hidden":!0}):null,d?ze():tt()]}),(0,Q.jsx)(xt,{size:`sm`,onClick:()=>void y(),disabled:l,children:ht()})]})]})})}function Mn({versions:e}){if(e.length===0)return null;let t=[...e].reverse();return(0,Q.jsxs)(It,{children:[(0,Q.jsx)(Mt,{asChild:!0,children:(0,Q.jsxs)(`button`,{type:`button`,className:`oc-compat__versions-btn`,children:[e.length===1?Ee():o({count:e.length}),(0,Q.jsx)(T,{size:13,"aria-hidden":!0})]})}),(0,Q.jsxs)(zt,{className:`oc-compat__versions-pop`,align:`start`,children:[(0,Q.jsx)(`p`,{className:`oc-compat__versions-title`,children:mt()}),(0,Q.jsx)(`div`,{className:`oc-compat__versions-list`,children:t.map(e=>(0,Q.jsx)(O,{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,Bg as o,Bk as s,CO as c,DO as l,E as u,EO as d,FO as f,GO as p,Gg as m,Gk as h,HO as g,Hg as _,Hk as ee,IO as v,Ik as te,JO as y,Jg as ne,Jl as re,KO as ie,Kg as ae,Kk as oe,LO as se,Lk as ce,MO as le,Mg as ue,Mk as de,NO as fe,Nk as pe,OO as me,PO as he,QO as ge,RO as _e,Rg as ve,Rk as ye,SO as be,TO as xe,UO as Se,Ug as Ce,Uk as we,VO as b,Va as Te,Vg as Ee,Vk as De,WO as Oe,Wg as ke,XO as Ae,Xg as je,Xl as Me,YO as Ne,Yg as Pe,Yl as Fe,ZO as Ie,Zl as Le,_O as Re,ak as ze,bO as Be,ck as Ve,cs as He,ek as Ue,eu as We,fO as Ge,gO as Ke,hO as qe,iX as Je,ik as Ye,jO as Xe,kO as Ze,lk as Qe,mO as x,nk as $e,oX as et,ok as tt,pO as S,qO as nt,qg as rt,ql as it,rk as at,sX as C,sk as ot,t as w,tk as st,uk as ct,vO as lt,wO as ut,xO as dt,yO as ft,zO as pt,zg as mt,zk as ht}from"./api-ZghOy9gS.js";import{r as T}from"./dist-CzXQ0eKG.js";import{t as gt}from"./chevrons-up-down-Btm4pQFN.js";import{i as _t,n as E,o as vt,r as yt,s as bt}from"./FieldLabel-pGuDJHof.js";import{t as xt}from"./button-kCamrfzR.js";import{$t as D,At as St,Ct,Dt as wt,Jn as Tt,Jt as O,L as Et,Mt as Dt,Ot,Pn as k,St as A,Tt as kt,Yt as At,ar as j,at as jt,bt as M,cn as Mt,dr as N,fr as Nt,ft as Pt,it as Ft,jt as P,kn as F,on as It,or as Lt,ot as Rt,sn as zt,sr as I,st as Bt,vt as L,wt as Vt,xt as R,yt as z}from"./index-C_ywXTWT.js";import{r as Ht}from"./locales-CPjguROj.js";import{a as B,i as V,n as Ut,o as H,r as U,t as Wt}from"./table-BpXBaCrR.js";import{t as Gt}from"./FilterBar-DDDj8Wi2.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-BC1dh2j7.js";import{t as W}from"./dispatchErrorInfo-DBBnWn64.js";var $t=u(`refresh-cw`,[[`path`,{d:`M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8`,key:`v9h5vc`}],[`path`,{d:`M21 3v5h-5`,key:`1q7to0`}],[`path`,{d:`M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16`,key:`3uifl3`}],[`path`,{d:`M8 16H3v5`,key:`1cv678`}]]),en=u(`wifi-off`,[[`path`,{d:`M12 20h.01`,key:`zekei9`}],[`path`,{d:`M8.5 16.429a5 5 0 0 1 7 0`,key:`1bycff`}],[`path`,{d:`M5 12.859a10 10 0 0 1 5.17-2.69`,key:`1dl1wf`}],[`path`,{d:`M19 12.859a10 10 0 0 0-2.007-1.523`,key:`4k23kn`}],[`path`,{d:`M2 8.82a15 15 0 0 1 4.177-2.643`,key:`1grhjp`}],[`path`,{d:`M22 8.82a15 15 0 0 0-11.288-3.764`,key:`z3jwby`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}]]),G=t(e(),1);function tn(e){return e.filter(e=>e.state===`error`)}function nn(e){return e.reachable&&tn(e.targets).length===0}function rn(e){return nn(e)?(e.unreachableInstances??[]).length>0?`gateways_unreachable`:`ok`:`error`}function an(e){return e.state===`error`&&e.lastErrorCode!==null}function K(e){return!!e.lastDownstreamRejectCode}function on(e){return!!e.lastLocalRefusalCode}function sn(e){return an(e)||K(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]),u=(0,G.useMemo)(()=>gn(s),[s]),f=(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:l(),onReset:()=>r(un),canReset:dn(n),children:[(0,Q.jsxs)(L,{value:n.state,onValueChange:e=>r(t=>({...t,state:e})),children:[(0,Q.jsx)(R,{size:`sm`,className:`w-36`,children:(0,Q.jsx)(A,{placeholder:xe()})}),(0,Q.jsxs)(z,{children:[(0,Q.jsx)(M,{value:Y,children:d()}),u.map(e=>(0,Q.jsx)(M,{value:e,children:xn(e)},e))]})]}),(0,Q.jsxs)(L,{value:n.instance,onValueChange:e=>r(t=>({...t,instance:e})),children:[(0,Q.jsx)(R,{size:`sm`,className:`w-40`,children:(0,Q.jsx)(A,{placeholder:ut()})}),(0,Q.jsxs)(z,{children:[(0,Q.jsx)(M,{value:Y,children:d()}),f.map(e=>(0,Q.jsx)(M,{value:e.name,children:e.label},e.name))]})]}),(0,Q.jsxs)(L,{value:n.version,onValueChange:e=>r(t=>({...t,version:e})),children:[(0,Q.jsx)(R,{size:`sm`,className:`w-36`,children:(0,Q.jsx)(A,{placeholder:c()})}),(0,Q.jsxs)(z,{children:[(0,Q.jsx)(M,{value:Y,children:d()}),p.map(e=>(0,Q.jsx)(M,{value:e,children:e},e))]})]})]}),m.length===0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:be()}):(0,Q.jsxs)(Wt,{className:`oc-conn__table`,children:[(0,Q.jsx)(B,{children:(0,Q.jsxs)(H,{children:[(0,Q.jsx)($,{label:dt(),sortKey:`target`,sort:a,onSort:h}),(0,Q.jsx)($,{label:Be(),sortKey:`state`,sort:a,onSort:h}),(0,Q.jsx)($,{label:ft(),sortKey:`instance`,sort:a,onSort:h}),(0,Q.jsx)($,{label:lt(),sortKey:`host`,sort:a,onSort:h}),(0,Q.jsx)($,{label:Re(),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)(Lt,{size:13,"aria-hidden":!0}):(0,Q.jsx)(T,{size:13,"aria-hidden":!0}):(0,Q.jsx)(gt,{size:13,"aria-hidden":!0,className:`oc-conn__sort-idle`})]})})}function bn({r:e}){let t=an(e)?W(e.lastErrorCode):null,n=K(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:Ze({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:P(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?` · ${P(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:[Te({label:r.label}),` `,(0,Q.jsx)(`code`,{className:`oc-traces__mono`,children:e.lastLocalRefusalCode}),e.lastLocalRefusalAt?` · ${P(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:[me({label:n.label}),` `,(0,Q.jsx)(`code`,{className:`oc-traces__mono`,children:e.lastDownstreamRejectCode}),e.lastDownstreamRejectAt?` · ${P(e.lastDownstreamRejectAt)}`:``]}):null]})}):null]})}function xn(e){return e===`connected`?x():e===`error`?S():Ge()}function Sn({state:e}){return e===`connected`?(0,Q.jsx)(O,{variant:`secondary`,children:x()}):e===`error`?(0,Q.jsx)(O,{variant:`destructive`,children:S()}):(0,Q.jsx)(O,{variant:`outline`,children:Ge()})}function Cn(){return C(w.bridgeHealth.getBridgeHealth,{})}function wn(){let e=Cn(),t=C(w.compat.getBridgeCompat,{}),n=C(w.me.getMe,{host:Pt})?.role===`admin`,r=C(w.admin.listInstances,n?{}:`skip`),i=C(w.agents.usageForInstances,n?{}:`skip`),a=N(),o=()=>void a({to:`/settings/anomalies`,search:{status:`open`}}),s=ln(e?e.targets:[],t?t.targets:[],r??[]),{section:c}=Nt({from:`/settings/bridge`}),l=N({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:Ae()}),i&&i.length>0?(0,Q.jsxs)(`section`,{className:`oc-bridge__usage`,children:[(0,Q.jsx)(`h3`,{className:`oc-bridge__usage-title`,children:Ne()}),(0,Q.jsxs)(Wt,{children:[(0,Q.jsx)(B,{children:(0,Q.jsxs)(H,{children:[(0,Q.jsx)(V,{children:Le()}),(0,Q.jsx)(V,{children:Me()}),(0,Q.jsx)(V,{children:Fe()}),(0,Q.jsx)(V,{children:re()}),(0,Q.jsx)(V,{children:it()})]})}),(0,Q.jsx)(Ut,{children:i.flatMap(e=>{let t=Et(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)(O,{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)(Ft,{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)(Rt,{className:`w-full`,children:s.map(e=>(0,Q.jsxs)(Bt,{value:e.key,className:`flex-1 gap-1.5`,children:[(0,Q.jsx)(k,{size:13,"aria-hidden":!0}),J(e.key)]},e.key))}),s.map(e=>(0,Q.jsx)(jt,{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:ue()}):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:ne(),children:[`(`,i,`)`]})]}):null,r?(0,Q.jsxs)(`strong`,{className:`oc-bridge-card__mismatch`,children:[` `,rt({build:t.buildVersion??`?`})]}):null,` · `,ae(),` `,(0,Q.jsx)(`code`,{className:`oc-traces__mono`,children:t.protocolVersion===null?m():String(t.protocolVersion)})]}):null;if(e===void 0)return(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:b()});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`,p=St(e.checkedAt),h=e.startedAt==null?null:St(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)(j,{size:22}):c||l===`gateways_unreachable`?(0,Q.jsx)(en,{size:22}):(0,Q.jsx)(F,{size:22})}),(0,Q.jsxs)(`div`,{className:`oc-bridge-card__body`,children:[(0,Q.jsx)(`div`,{className:`oc-bridge-card__title`,children:l===`ok`?pt():l===`gateways_unreachable`?f({count:u.length}):c?_e():se({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}),` `,v({time:p})]}),h?(0,Q.jsx)(`span`,{children:fe({time:h})}):null,o]}),l===`gateways_unreachable`?(0,Q.jsx)(`p`,{className:`oc-bridge-card__hint`,children:he({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:le()})]})}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)(k,{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)(O,{variant:d===`beyond`||d===`defective`||d===`unsupported`?`destructive`:`secondary`,children:qt(d)}):null]}),(0,Q.jsx)(`h4`,{className:`oc-bridge-provider__sub`,children:je()}),(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)(T,{size:13,"aria-hidden":!0}):(0,Q.jsx)(I,{size:13,"aria-hidden":!0}),Xe({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:[y(),i.length>0?(0,Q.jsx)(O,{variant:`destructive`,children:ie({count:i.length})}):a>0?(0,Q.jsx)(O,{variant:`destructive`,children:p()}):(0,Q.jsx)(O,{variant:`secondary`,children:nt()})]}),(0,Q.jsxs)(`p`,{className:`oc-admin__hint`,children:[Oe({version:e.vendoredVersion}),r?` · `+Se({handled:r.handled,ignored:r.ignored,gaps:r.gaps}):null]}),a>0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:He({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)(T,{size:13,"aria-hidden":!0}):(0,Q.jsx)(I,{size:13,"aria-hidden":!0}),g({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:b()}):t===`nodata`?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:Pe()}):(0,Q.jsxs)(`div`,{className:`oc-compat`,children:[n?null:(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:ke()}),r===null?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:Ce()}):(0,Q.jsxs)(`div`,{className:`oc-compat__support`,children:[(0,Q.jsx)(`span`,{className:`oc-compat__label`,children:We({provider:a})}),e&&e.range!==null?(0,Q.jsx)(`span`,{children:_({min:e.range.min,max:e.range.maxValidated})}):(0,Q.jsx)(`span`,{children:m()}),e?(0,Q.jsx)(Mn,{versions:e.validatedVersions}):null]}),i.length===0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:ve()}):(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)(O,{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)(Ct,{open:!0,onOpenChange:e=>!e&&t(),children:(0,Q.jsxs)(Vt,{className:`oc-bridge-config-dialog`,onOpenAutoFocus:e=>e.preventDefault(),children:[(0,Q.jsxs)(wt,{children:[(0,Q.jsx)(Ot,{children:oe({instance:e.displayName??e.name})}),(0,Q.jsx)(kt,{children:h()})]}),(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)(j,{"aria-hidden":!0}):(0,Q.jsx)(F,{"aria-hidden":!0}),(0,Q.jsxs)(`span`,{children:[e,` — `,t.ok?Ue():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=et(w.admin.upsertInstanceConfig),r=Je(w.bridge.validateMediaPaths),i=At(),a=Ht(e.config?.contentLocale,void 0),[o,c]=(0,G.useState)(()=>_t(e.config??{},a)),[l,u]=(0,G.useState)(!1),[d,f]=(0,G.useState)(!1),[p,m]=(0,G.useState)(null),h=o.inboundMediaMode===`shared-fs`,g=o.mediaMode===`shared-fs`,_=h||g;async function v(){f(!0),m(null);try{m(await r({instanceName:e.name,inboundMediaMode:o.inboundMediaMode,mediaMode:o.mediaMode}))}catch(e){i.error(Ye(),e)}finally{f(!1)}}async function y(){u(!0);try{let r=e.config??{};await n({instanceId:e._id,config:yt(o,r,a)}),t()}catch(e){i.error(ye(),e)}finally{u(!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)(E,{label:we(),help:ce()}),(0,Q.jsxs)(L,{value:o.mediaMode,onValueChange:e=>c({...o,mediaMode:e}),children:[(0,Q.jsx)(R,{size:`sm`,className:`w-full`,children:(0,Q.jsx)(A,{})}),(0,Q.jsx)(z,{children:bt.map(e=>(0,Q.jsx)(M,{value:e,children:e},e))})]})]}),(0,Q.jsxs)(`label`,{className:`oc-field`,children:[(0,Q.jsx)(E,{label:ee(),help:te()}),(0,Q.jsxs)(L,{value:o.inboundMediaMode,onValueChange:e=>c({...o,inboundMediaMode:e}),children:[(0,Q.jsx)(R,{size:`sm`,className:`w-full`,children:(0,Q.jsx)(A,{})}),(0,Q.jsx)(z,{children:vt.map(e=>(0,Q.jsx)(M,{value:e,children:e},e))})]})]}),(0,Q.jsxs)(`label`,{className:`oc-field`,children:[(0,Q.jsx)(E,{label:De(),help:pe()}),(0,Q.jsx)(D,{type:`number`,min:1,max:4096,className:`w-full`,value:o.mediaMaxMb,onChange:e=>c({...o,mediaMaxMb:Math.trunc(Number(e.target.value)||0)})})]})]}),_&&(0,Q.jsxs)(`div`,{className:`oc-bridge-config__grid`,children:[h&&(0,Q.jsxs)(`label`,{className:`oc-field`,children:[(0,Q.jsx)(E,{label:ct(),help:Qe()}),(0,Q.jsx)(D,{className:`w-full`,spellCheck:!1,value:o.inboundAgentMount,onChange:e=>c({...o,inboundAgentMount:e.target.value})})]}),g&&(0,Q.jsxs)(`label`,{className:`oc-field`,children:[(0,Q.jsx)(E,{label:Ve(),help:ot()}),(0,Q.jsx)(D,{className:`w-full`,spellCheck:!1,value:o.outboundAgentMount,onChange:e=>c({...o,outboundAgentMount:e.target.value})})]})]}),(0,Q.jsxs)(`label`,{className:`oc-field--row`,children:[(0,Q.jsx)(Dt,{checked:o.rehydration,onCheckedChange:e=>c({...o,rehydration:e===!0})}),(0,Q.jsx)(E,{label:s(),help:de()})]}),_&&p!==null&&(0,Q.jsx)(`div`,{className:`oc-bridge-config__check`,children:p.reachable?!p.inbound&&!p.outbound?(0,Q.jsxs)(`p`,{className:`oc-bridge-config__check-row oc-bridge-config__check-row--err`,children:[(0,Q.jsx)(F,{"aria-hidden":!0}),Ie({reason:p.reason??`?`})]}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(An,{label:$e(),result:p.inbound}),(0,Q.jsx)(An,{label:st(),result:p.outbound}),(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:at()})]}):(0,Q.jsxs)(`p`,{className:`oc-bridge-config__check-row oc-bridge-config__check-row--err`,children:[(0,Q.jsx)(F,{"aria-hidden":!0}),ge()]})}),(0,Q.jsxs)(`div`,{className:`oc-bridge-config__actions`,children:[_&&(0,Q.jsxs)(xt,{variant:`outline`,size:`sm`,onClick:()=>void v(),disabled:d,children:[d?(0,Q.jsx)(Tt,{className:`size-4 animate-spin`,"aria-hidden":!0}):null,d?ze():tt()]}),(0,Q.jsx)(xt,{size:`sm`,onClick:()=>void y(),disabled:l,children:ht()})]})]})})}function Mn({versions:e}){if(e.length===0)return null;let t=[...e].reverse();return(0,Q.jsxs)(It,{children:[(0,Q.jsx)(Mt,{asChild:!0,children:(0,Q.jsxs)(`button`,{type:`button`,className:`oc-compat__versions-btn`,children:[e.length===1?Ee():o({count:e.length}),(0,Q.jsx)(T,{size:13,"aria-hidden":!0})]})}),(0,Q.jsxs)(zt,{className:`oc-compat__versions-pop`,align:`start`,children:[(0,Q.jsx)(`p`,{className:`oc-compat__versions-title`,children:mt()}),(0,Q.jsx)(`div`,{className:`oc-compat__versions-list`,children:t.map(e=>(0,Q.jsx)(O,{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,Ct as a,F_ as o,Qg as s,St as c,Sv as l,Tt as u,Wk as d,ZY as f,Zg as p,_p as m,_t as h,a_ as g,at as _,bt as v,bv as y,ct as b,dp as x,dt as S,e_ as C,et as ee,fp as te,ft as w,gp as T,gt as ne,gv as re,hp as ie,ht as E,hv as ae,iX as D,i_ as O,it as k,lt as oe,mp as A,mt as j,n_ as M,nt as se,oX as N,ot as ce,pp as le,pt as ue,r_ as de,rt as fe,sX as P,st as pe,t as F,t_ as me,tt as he,up as ge,ut as _e,vp as I,vt as ve,wt as ye,xt as be,yp as xe,yt as Se}from"./api-ZghOy9gS.js";import{t as Ce}from"./use_paginated_query-B_mVv9z5.js";import{t as L}from"./button-kCamrfzR.js";import{$t as R,Mt as z,St as B,bt as V,kn as we,nt as Te,rt as Ee,tt as H,vt as U,xt as W,yt as G}from"./index-nxFP6zJZ.js";import{a as De}from"./compatView-BC1dh2j7.js";/* empty css */var K=t(e(),1),Oe=[`off`,`minimal`,`low`,`medium`,`high`,`xhigh`];function ke(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 q=[`auto`,`hybrid`,`tool`,`off`];function Ae(e){switch(e){case`auto`:return c();case`hybrid`:return be();case`tool`:return v();default:return Se()}}function J(e){return{injection:e.injection??`auto`,defaultSources:e.defaultSources,...e.config?{config:e.config}:{}}}function Y(e){return typeof e==`string`&&q.includes(e)}function X(e){return{injection:Y(e.injection)?e.injection:`auto`,sources:e.defaultSources.filter(t=>e.sources.some(e=>e.id===t))}}function Z(e,t){let n=new Set(e);return n.size===new Set(t).size&&t.every(e=>n.has(e))}function je(e,t,n){let r=n?e.defaultWriteRefused===`scope_refused`?j():Me(e)?k():null:E(),i=X(e),a=t.injection!==i.injection||!Z(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:h()}}function Me(e){return(e.contract??1)<2&&e.ownAllowlist===!1}function Ne(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`?j():e.code===`stale_default`?ue():e.code===`write_unknown`||e.code===`not_confirmed`?_e():e.code===`not_applied`?oe():e.code===`default_too_large`?se():e.code===`allowlist_too_large`?fe():e.code===`plugin_too_old`?k():e.code===`source_not_allowed`?_():e.code===`plugin_config_lag`?ce():e.code===`knowledge_unavailable`&&e.reason===`plugin_absent`?ne():w({code:e.code})}function Pe(e,t){let n=J(e),r=J(t);if(n.injection!==r.injection||!Z(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=D(F.knowledge.setAgentKnowledgeDefault),[o,c]=(0,K.useState)(t),[u,d]=(0,K.useState)(()=>X(t)),[f,p]=(0,K.useState)(`idle`),[m,h]=(0,K.useState)(null),[g,_]=(0,K.useState)(!1),v=e=>{c(e),d(X(e)),h(null)},y=Pe(o,t);(0,K.useEffect)(()=>{g&&y&&(_(!1),v(t))},[g,y]);let b=je(o,u,n),x=b.readOnlyReason===null;async function C(){p(`saving`),h(null);try{let n=Q(await i({instanceName:e,agentId:t.agentId,injection:u.injection,sources:u.sources,expected:J(o)}));h(n),p(n===null?`done`:`idle`),n===null&&_(!0)}catch(e){h(Q({ok:!1,code:String(e?.message??`error`).slice(0,60)})),p(`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)(U,{value:u.injection,onValueChange:e=>{Y(e)&&d({...u,injection:e})},disabled:!x,children:[(0,$.jsx)(W,{className:`oc-cdefaults__select`,"aria-label":a(),children:(0,$.jsx)(B,{})}),(0,$.jsx)(G,{children:q.map(e=>(0,$.jsx)(V,{value:e,children:Ae(e)},e))})]})}),(0,$.jsx)(`span`,{className:`oc-cdefaults__label`,children:ve()}),t.sources.map(e=>(0,$.jsxs)(`label`,{className:`oc-cdefaults__inline`,style:{cursor:x?`pointer`:`default`},title:e.description||void 0,children:[(0,$.jsx)(z,{checked:u.sources.includes(e.id),onCheckedChange:()=>d(Ne(t,u,e.id)),disabled:!x,"aria-label":e.label,"data-knowledge-default-source":e.id}),(0,$.jsx)(`span`,{children:e.label})]},e.id)),y&&!g?(0,$.jsxs)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:[he(),` `,(0,$.jsx)(L,{variant:`outline`,size:`sm`,onClick:()=>v(t),children:ee()})]}):null,t.overridesAllowed?null:(0,$.jsx)(`p`,{className:`oc-cdefaults__help`,children:S()}),x?(0,$.jsx)(`div`,{className:`oc-cdefaults__inline`,children:(0,$.jsx)(L,{size:`sm`,disabled:!b.dirty||!b.valid||f===`saving`,onClick:()=>void C(),children:f===`saving`?l():r()})}):(0,$.jsx)(`p`,{className:`oc-cdefaults__note`,children:b.readOnlyReason}),x&&b.dirty&&b.invalidReason!==null?(0,$.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:b.invalidReason}):null,f===`done`&&m===null?(0,$.jsx)(`p`,{className:`oc-admin__hint`,role:`status`,children:s()}):null,m===null?null:(0,$.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:m})]})]})}function Ie({instanceName:e}){let t=P(F.knowledge.knowledgeAdminInstance,{instanceName:e}),{results:n,status:r,loadMore:i}=Ce(F.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":u(),children:[(0,$.jsx)(`span`,{className:`oc-cdefaults__label`,children:u()}),(0,$.jsx)(`p`,{className:`oc-admin__hint`,children:ye()}),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:b({shown:n.length})}),(0,$.jsx)(L,{variant:`outline`,size:`sm`,disabled:r===`LoadingMore`,onClick:()=>i(50),"data-knowledge-load-more":!0,children:pe()})]}):null]})}function Le({instance:e}){let t=N(F.admin.upsertInstanceConfig),n=P(F.agents.listAgentsForInstance,{instanceName:e.name}),i=typeof e.config?.converterAgentId==`string`?e.config.converterAgentId:``,[a,o]=(0,K.useState)(i),[c,u]=(0,K.useState)(`idle`);(0,K.useEffect)(()=>{o(i),u(`idle`)},[e._id,i]);let d=`__none__`,f=a!==i;async function m(){u(`saving`);try{let n={...e.config??{}};a===``||a===d?delete n.converterAgentId:n.converterAgentId=a,await t({instanceId:e._id,config:n}),u(`done`)}catch{u(`error`)}}let h=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:ie()}),(0,$.jsxs)(`div`,{className:`oc-cdefaults__inline`,children:[(0,$.jsxs)(U,{value:a===``?d:a,onValueChange:e=>o(e===d?``:e),children:[(0,$.jsx)(W,{className:`oc-cdefaults__select`,"aria-label":T(),children:(0,$.jsx)(B,{placeholder:A()})}),(0,$.jsxs)(G,{children:[(0,$.jsx)(V,{value:d,children:A()}),h.map(e=>(0,$.jsx)(V,{value:e.agentId,children:e.displayName?`${e.displayName} (${e.agentId})`:e.agentId},e.agentId))]})]}),(0,$.jsx)(L,{size:`sm`,disabled:!f||c===`saving`,onClick:()=>void m(),children:c===`saving`?l():r()})]}),c===`done`?(0,$.jsx)(`p`,{className:`oc-admin__hint`,role:`status`,children:s()}):null,c===`error`?(0,$.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:p()}):null]})}function Re({instance:e}){let t=N(F.admin.upsertInstanceConfig),n=e.config?.curationEnabled===!0,i=typeof e.config?.curationBudgetChars==`number`?e.config.curationBudgetChars:null,[a,o]=(0,K.useState)(n),[c,u]=(0,K.useState)(i===null?``:String(i)),[d,f]=(0,K.useState)(`idle`);(0,K.useEffect)(()=>{o(n),u(i===null?``:String(i)),f(`idle`)},[e._id,n,i]);let h=c.trim(),g=h===``?null:/^\d+$/.test(h)?Number.parseInt(h,10):NaN,_=!a||g===null||Number.isInteger(g)&&g>=4e3&&g<=6e4,v=a!==n||(g??null)!==i;async function y(){f(`saving`);try{let n={...e.config??{}};n.curationEnabled=a,!a||g===null||Number.isNaN(g)?delete n.curationBudgetChars:n.curationBudgetChars=g,await t({instanceId:e._id,config:n}),f(`done`)}catch{f(`error`)}}return(0,$.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,$.jsxs)(`label`,{className:`oc-cdefaults__inline`,style:{cursor:`pointer`},children:[(0,$.jsx)(z,{checked:a,onCheckedChange:e=>o(e===!0),"aria-label":m()}),(0,$.jsx)(`span`,{className:`oc-cdefaults__label`,children:m()})]}),(0,$.jsxs)(`div`,{className:`oc-cdefaults__inline`,children:[(0,$.jsx)(R,{type:`number`,min:4e3,max:6e4,step:1e3,placeholder:`20000`,value:c,onChange:e=>u(e.target.value),className:`oc-cdefaults__number`,"aria-invalid":!_,"aria-label":le(),disabled:!a}),(0,$.jsx)(L,{size:`sm`,disabled:!v||!_||d===`saving`,onClick:()=>void y(),children:d===`saving`?l():r()})]}),_?null:(0,$.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:te()}),d===`done`?(0,$.jsx)(`p`,{className:`oc-admin__hint`,role:`status`,children:s()}):null,d===`error`?(0,$.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:p()}):null,(0,$.jsx)(`p`,{className:`oc-cdefaults__help`,children:x()})]})}function ze({instance:e}){let t=N(F.admin.upsertInstanceConfig),n=typeof e.config?.summarizeThresholdChars==`number`?e.config.summarizeThresholdChars:null,[i,a]=(0,K.useState)(n===null?``:String(n)),[o,c]=(0,K.useState)(`idle`);(0,K.useEffect)(()=>{a(n===null?``:String(n)),c(`idle`)},[e._id,n]);let u=i.trim(),d=u===``?null:/^\d+$/.test(u)?Number.parseInt(u,10):NaN,f=d===null||Number.isInteger(d)&&d>=1e3&&d<=2e5,m=(d??null)!==n;async function h(){c(`saving`);try{let n={...e.config??{}};d===null?delete n.summarizeThresholdChars:n.summarizeThresholdChars=d,await t({instanceId:e._id,config:n}),c(`done`)}catch{c(`error`)}}return(0,$.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,$.jsx)(`span`,{className:`oc-cdefaults__label`,children:xe()}),(0,$.jsxs)(`div`,{className:`oc-cdefaults__inline`,children:[(0,$.jsx)(R,{type:`number`,min:1e3,max:2e5,step:1e3,placeholder:`8000`,value:i,onChange:e=>a(e.target.value),className:`oc-cdefaults__number`,"aria-invalid":!f}),(0,$.jsx)(L,{size:`sm`,disabled:!m||!f||o===`saving`,onClick:()=>void h(),children:o===`saving`?l():r()})]}),f?null:(0,$.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:ge()}),o===`done`?(0,$.jsx)(`p`,{className:`oc-admin__hint`,role:`status`,children:s()}):null,o===`error`?(0,$.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:p()}):null,(0,$.jsx)(`p`,{className:`oc-cdefaults__help`,children:I()})]})}function Be(){let e=D(F.agentFiles.getChatDefaults),[t,n]=(0,K.useState)({status:`loading`}),r=P(F.admin.listInstances,{}),[a,s]=(0,K.useState)(null);(0,K.useEffect)(()=>{!r||r.length===0||(!a||!r.some(e=>e.name===a))&&s(r[0].name)},[r,a]);let c=(r?.length??0)>1,l=r!==void 0&&r.length===0,u=P(F.compat.forInstance,a?{instanceName:a}:`skip`),p=a?Te(u,`configDefaults`):`loading`,m=p===`loading`?null:p.blocked,h=(0,K.useMemo)(()=>c&&a?{instanceName:a}:{},[c,a]),_=(0,K.useRef)(0),v=(0,K.useCallback)(async()=>{let t=++_.current;n({status:`loading`});try{let r=ke(await e(h));if(_.current!==t)return;n({status:`done`,current:r})}catch{if(_.current!==t)return;n({status:`error`})}},[e,h]);(0,K.useEffect)(()=>{m===!1&&(c&&!a||v())},[v,m,c,a]);let b=t.status===`done`?t.current:null,x=(0,K.useMemo)(()=>Oe.map(e=>({id:e,label:Ee(e)})),[]),S=(0,K.useMemo)(()=>[{id:`fast`,label:re()},{id:`standard`,label:ae()}],[]);return(0,$.jsxs)(`div`,{className:`oc-cdefaults`,children:[(0,$.jsx)(`p`,{className:`oc-admin__hint`,children:g()}),c&&a?(0,$.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,$.jsx)(`span`,{className:`oc-cdefaults__label`,children:o()}),(0,$.jsxs)(U,{value:a,onValueChange:e=>s(e),children:[(0,$.jsx)(W,{size:`sm`,"aria-label":o(),children:(0,$.jsx)(B,{})}),(0,$.jsx)(G,{children:(r??[]).map(e=>(0,$.jsx)(V,{value:e.name,children:e.name},e.name))})]})]}):null,l?(0,$.jsx)(`p`,{className:`oc-admin__hint`,role:`status`,children:d()}):p===`loading`?(0,$.jsx)(`p`,{className:`oc-admin__hint`,children:f()}):p.blocked?(0,$.jsxs)(`p`,{className:`oc-compat__blocked`,role:`status`,children:[(0,$.jsx)(we,{size:14,"aria-hidden":!0}),` `,De(p.gatewayVersion,p.provider)]}):t.status===`loading`?(0,$.jsx)(`p`,{className:`oc-admin__hint`,children:f()}):t.status===`error`?(0,$.jsxs)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:[C(),` `,(0,$.jsx)(L,{variant:`outline`,size:`sm`,onClick:()=>void v(),children:y()})]}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,$.jsx)(`span`,{className:`oc-cdefaults__label`,children:O()}),(0,$.jsx)(H,{field:`thinkingLevel`,options:x,value:b?.thinkingDefault??null,onChange:()=>{},disabled:!0,ariaLabel:O()}),(0,$.jsx)(`p`,{className:`oc-cdefaults__help`,children:de()})]}),(0,$.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,$.jsx)(`span`,{className:`oc-cdefaults__label`,children:M()}),(0,$.jsx)(H,{field:`fastMode`,options:S,value:b===null||b.fastModeDefault===null?null:b.fastModeDefault?`fast`:`standard`,onChange:()=>{},disabled:!0,ariaLabel:M()}),(0,$.jsx)(`p`,{className:`oc-cdefaults__help`,children:me()})]}),(0,$.jsx)(`p`,{className:`oc-cdefaults__note`,children:i()})]}),(()=>{let e=r?.find(e=>e.name===(a??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,Ct as a,F_ as o,Qg as s,St as c,Sv as l,Tt as u,Wk as d,ZY as f,Zg as p,_p as m,_t as h,a_ as g,at as _,bt as v,bv as y,ct as b,dp as x,dt as S,e_ as C,et as ee,fp as te,ft as w,gp as T,gt as ne,gv as re,hp as ie,ht as E,hv as ae,iX as D,i_ as O,it as k,lt as oe,mp as A,mt as j,n_ as M,nt as se,oX as N,ot as ce,pp as le,pt as ue,r_ as de,rt as fe,sX as P,st as pe,t as F,t_ as me,tt as he,up as ge,ut as _e,vp as I,vt as ve,wt as ye,xt as be,yp as xe,yt as Se}from"./api-ZghOy9gS.js";import{t as Ce}from"./use_paginated_query-B_mVv9z5.js";import{t as L}from"./button-kCamrfzR.js";import{$t as R,Mt as z,St as B,bt as V,kn as we,nt as Te,rt as Ee,tt as H,vt as U,xt as W,yt as G}from"./index-C_ywXTWT.js";import{a as De}from"./compatView-BC1dh2j7.js";/* empty css */var K=t(e(),1),Oe=[`off`,`minimal`,`low`,`medium`,`high`,`xhigh`];function ke(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 q=[`auto`,`hybrid`,`tool`,`off`];function Ae(e){switch(e){case`auto`:return c();case`hybrid`:return be();case`tool`:return v();default:return Se()}}function J(e){return{injection:e.injection??`auto`,defaultSources:e.defaultSources,...e.config?{config:e.config}:{}}}function Y(e){return typeof e==`string`&&q.includes(e)}function X(e){return{injection:Y(e.injection)?e.injection:`auto`,sources:e.defaultSources.filter(t=>e.sources.some(e=>e.id===t))}}function Z(e,t){let n=new Set(e);return n.size===new Set(t).size&&t.every(e=>n.has(e))}function je(e,t,n){let r=n?e.defaultWriteRefused===`scope_refused`?j():Me(e)?k():null:E(),i=X(e),a=t.injection!==i.injection||!Z(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:h()}}function Me(e){return(e.contract??1)<2&&e.ownAllowlist===!1}function Ne(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`?j():e.code===`stale_default`?ue():e.code===`write_unknown`||e.code===`not_confirmed`?_e():e.code===`not_applied`?oe():e.code===`default_too_large`?se():e.code===`allowlist_too_large`?fe():e.code===`plugin_too_old`?k():e.code===`source_not_allowed`?_():e.code===`plugin_config_lag`?ce():e.code===`knowledge_unavailable`&&e.reason===`plugin_absent`?ne():w({code:e.code})}function Pe(e,t){let n=J(e),r=J(t);if(n.injection!==r.injection||!Z(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=D(F.knowledge.setAgentKnowledgeDefault),[o,c]=(0,K.useState)(t),[u,d]=(0,K.useState)(()=>X(t)),[f,p]=(0,K.useState)(`idle`),[m,h]=(0,K.useState)(null),[g,_]=(0,K.useState)(!1),v=e=>{c(e),d(X(e)),h(null)},y=Pe(o,t);(0,K.useEffect)(()=>{g&&y&&(_(!1),v(t))},[g,y]);let b=je(o,u,n),x=b.readOnlyReason===null;async function C(){p(`saving`),h(null);try{let n=Q(await i({instanceName:e,agentId:t.agentId,injection:u.injection,sources:u.sources,expected:J(o)}));h(n),p(n===null?`done`:`idle`),n===null&&_(!0)}catch(e){h(Q({ok:!1,code:String(e?.message??`error`).slice(0,60)})),p(`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)(U,{value:u.injection,onValueChange:e=>{Y(e)&&d({...u,injection:e})},disabled:!x,children:[(0,$.jsx)(W,{className:`oc-cdefaults__select`,"aria-label":a(),children:(0,$.jsx)(B,{})}),(0,$.jsx)(G,{children:q.map(e=>(0,$.jsx)(V,{value:e,children:Ae(e)},e))})]})}),(0,$.jsx)(`span`,{className:`oc-cdefaults__label`,children:ve()}),t.sources.map(e=>(0,$.jsxs)(`label`,{className:`oc-cdefaults__inline`,style:{cursor:x?`pointer`:`default`},title:e.description||void 0,children:[(0,$.jsx)(z,{checked:u.sources.includes(e.id),onCheckedChange:()=>d(Ne(t,u,e.id)),disabled:!x,"aria-label":e.label,"data-knowledge-default-source":e.id}),(0,$.jsx)(`span`,{children:e.label})]},e.id)),y&&!g?(0,$.jsxs)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:[he(),` `,(0,$.jsx)(L,{variant:`outline`,size:`sm`,onClick:()=>v(t),children:ee()})]}):null,t.overridesAllowed?null:(0,$.jsx)(`p`,{className:`oc-cdefaults__help`,children:S()}),x?(0,$.jsx)(`div`,{className:`oc-cdefaults__inline`,children:(0,$.jsx)(L,{size:`sm`,disabled:!b.dirty||!b.valid||f===`saving`,onClick:()=>void C(),children:f===`saving`?l():r()})}):(0,$.jsx)(`p`,{className:`oc-cdefaults__note`,children:b.readOnlyReason}),x&&b.dirty&&b.invalidReason!==null?(0,$.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:b.invalidReason}):null,f===`done`&&m===null?(0,$.jsx)(`p`,{className:`oc-admin__hint`,role:`status`,children:s()}):null,m===null?null:(0,$.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:m})]})]})}function Ie({instanceName:e}){let t=P(F.knowledge.knowledgeAdminInstance,{instanceName:e}),{results:n,status:r,loadMore:i}=Ce(F.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":u(),children:[(0,$.jsx)(`span`,{className:`oc-cdefaults__label`,children:u()}),(0,$.jsx)(`p`,{className:`oc-admin__hint`,children:ye()}),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:b({shown:n.length})}),(0,$.jsx)(L,{variant:`outline`,size:`sm`,disabled:r===`LoadingMore`,onClick:()=>i(50),"data-knowledge-load-more":!0,children:pe()})]}):null]})}function Le({instance:e}){let t=N(F.admin.upsertInstanceConfig),n=P(F.agents.listAgentsForInstance,{instanceName:e.name}),i=typeof e.config?.converterAgentId==`string`?e.config.converterAgentId:``,[a,o]=(0,K.useState)(i),[c,u]=(0,K.useState)(`idle`);(0,K.useEffect)(()=>{o(i),u(`idle`)},[e._id,i]);let d=`__none__`,f=a!==i;async function m(){u(`saving`);try{let n={...e.config??{}};a===``||a===d?delete n.converterAgentId:n.converterAgentId=a,await t({instanceId:e._id,config:n}),u(`done`)}catch{u(`error`)}}let h=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:ie()}),(0,$.jsxs)(`div`,{className:`oc-cdefaults__inline`,children:[(0,$.jsxs)(U,{value:a===``?d:a,onValueChange:e=>o(e===d?``:e),children:[(0,$.jsx)(W,{className:`oc-cdefaults__select`,"aria-label":T(),children:(0,$.jsx)(B,{placeholder:A()})}),(0,$.jsxs)(G,{children:[(0,$.jsx)(V,{value:d,children:A()}),h.map(e=>(0,$.jsx)(V,{value:e.agentId,children:e.displayName?`${e.displayName} (${e.agentId})`:e.agentId},e.agentId))]})]}),(0,$.jsx)(L,{size:`sm`,disabled:!f||c===`saving`,onClick:()=>void m(),children:c===`saving`?l():r()})]}),c===`done`?(0,$.jsx)(`p`,{className:`oc-admin__hint`,role:`status`,children:s()}):null,c===`error`?(0,$.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:p()}):null]})}function Re({instance:e}){let t=N(F.admin.upsertInstanceConfig),n=e.config?.curationEnabled===!0,i=typeof e.config?.curationBudgetChars==`number`?e.config.curationBudgetChars:null,[a,o]=(0,K.useState)(n),[c,u]=(0,K.useState)(i===null?``:String(i)),[d,f]=(0,K.useState)(`idle`);(0,K.useEffect)(()=>{o(n),u(i===null?``:String(i)),f(`idle`)},[e._id,n,i]);let h=c.trim(),g=h===``?null:/^\d+$/.test(h)?Number.parseInt(h,10):NaN,_=!a||g===null||Number.isInteger(g)&&g>=4e3&&g<=6e4,v=a!==n||(g??null)!==i;async function y(){f(`saving`);try{let n={...e.config??{}};n.curationEnabled=a,!a||g===null||Number.isNaN(g)?delete n.curationBudgetChars:n.curationBudgetChars=g,await t({instanceId:e._id,config:n}),f(`done`)}catch{f(`error`)}}return(0,$.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,$.jsxs)(`label`,{className:`oc-cdefaults__inline`,style:{cursor:`pointer`},children:[(0,$.jsx)(z,{checked:a,onCheckedChange:e=>o(e===!0),"aria-label":m()}),(0,$.jsx)(`span`,{className:`oc-cdefaults__label`,children:m()})]}),(0,$.jsxs)(`div`,{className:`oc-cdefaults__inline`,children:[(0,$.jsx)(R,{type:`number`,min:4e3,max:6e4,step:1e3,placeholder:`20000`,value:c,onChange:e=>u(e.target.value),className:`oc-cdefaults__number`,"aria-invalid":!_,"aria-label":le(),disabled:!a}),(0,$.jsx)(L,{size:`sm`,disabled:!v||!_||d===`saving`,onClick:()=>void y(),children:d===`saving`?l():r()})]}),_?null:(0,$.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:te()}),d===`done`?(0,$.jsx)(`p`,{className:`oc-admin__hint`,role:`status`,children:s()}):null,d===`error`?(0,$.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:p()}):null,(0,$.jsx)(`p`,{className:`oc-cdefaults__help`,children:x()})]})}function ze({instance:e}){let t=N(F.admin.upsertInstanceConfig),n=typeof e.config?.summarizeThresholdChars==`number`?e.config.summarizeThresholdChars:null,[i,a]=(0,K.useState)(n===null?``:String(n)),[o,c]=(0,K.useState)(`idle`);(0,K.useEffect)(()=>{a(n===null?``:String(n)),c(`idle`)},[e._id,n]);let u=i.trim(),d=u===``?null:/^\d+$/.test(u)?Number.parseInt(u,10):NaN,f=d===null||Number.isInteger(d)&&d>=1e3&&d<=2e5,m=(d??null)!==n;async function h(){c(`saving`);try{let n={...e.config??{}};d===null?delete n.summarizeThresholdChars:n.summarizeThresholdChars=d,await t({instanceId:e._id,config:n}),c(`done`)}catch{c(`error`)}}return(0,$.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,$.jsx)(`span`,{className:`oc-cdefaults__label`,children:xe()}),(0,$.jsxs)(`div`,{className:`oc-cdefaults__inline`,children:[(0,$.jsx)(R,{type:`number`,min:1e3,max:2e5,step:1e3,placeholder:`8000`,value:i,onChange:e=>a(e.target.value),className:`oc-cdefaults__number`,"aria-invalid":!f}),(0,$.jsx)(L,{size:`sm`,disabled:!m||!f||o===`saving`,onClick:()=>void h(),children:o===`saving`?l():r()})]}),f?null:(0,$.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:ge()}),o===`done`?(0,$.jsx)(`p`,{className:`oc-admin__hint`,role:`status`,children:s()}):null,o===`error`?(0,$.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:p()}):null,(0,$.jsx)(`p`,{className:`oc-cdefaults__help`,children:I()})]})}function Be(){let e=D(F.agentFiles.getChatDefaults),[t,n]=(0,K.useState)({status:`loading`}),r=P(F.admin.listInstances,{}),[a,s]=(0,K.useState)(null);(0,K.useEffect)(()=>{!r||r.length===0||(!a||!r.some(e=>e.name===a))&&s(r[0].name)},[r,a]);let c=(r?.length??0)>1,l=r!==void 0&&r.length===0,u=P(F.compat.forInstance,a?{instanceName:a}:`skip`),p=a?Te(u,`configDefaults`):`loading`,m=p===`loading`?null:p.blocked,h=(0,K.useMemo)(()=>c&&a?{instanceName:a}:{},[c,a]),_=(0,K.useRef)(0),v=(0,K.useCallback)(async()=>{let t=++_.current;n({status:`loading`});try{let r=ke(await e(h));if(_.current!==t)return;n({status:`done`,current:r})}catch{if(_.current!==t)return;n({status:`error`})}},[e,h]);(0,K.useEffect)(()=>{m===!1&&(c&&!a||v())},[v,m,c,a]);let b=t.status===`done`?t.current:null,x=(0,K.useMemo)(()=>Oe.map(e=>({id:e,label:Ee(e)})),[]),S=(0,K.useMemo)(()=>[{id:`fast`,label:re()},{id:`standard`,label:ae()}],[]);return(0,$.jsxs)(`div`,{className:`oc-cdefaults`,children:[(0,$.jsx)(`p`,{className:`oc-admin__hint`,children:g()}),c&&a?(0,$.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,$.jsx)(`span`,{className:`oc-cdefaults__label`,children:o()}),(0,$.jsxs)(U,{value:a,onValueChange:e=>s(e),children:[(0,$.jsx)(W,{size:`sm`,"aria-label":o(),children:(0,$.jsx)(B,{})}),(0,$.jsx)(G,{children:(r??[]).map(e=>(0,$.jsx)(V,{value:e.name,children:e.name},e.name))})]})]}):null,l?(0,$.jsx)(`p`,{className:`oc-admin__hint`,role:`status`,children:d()}):p===`loading`?(0,$.jsx)(`p`,{className:`oc-admin__hint`,children:f()}):p.blocked?(0,$.jsxs)(`p`,{className:`oc-compat__blocked`,role:`status`,children:[(0,$.jsx)(we,{size:14,"aria-hidden":!0}),` `,De(p.gatewayVersion,p.provider)]}):t.status===`loading`?(0,$.jsx)(`p`,{className:`oc-admin__hint`,children:f()}):t.status===`error`?(0,$.jsxs)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:[C(),` `,(0,$.jsx)(L,{variant:`outline`,size:`sm`,onClick:()=>void v(),children:y()})]}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,$.jsx)(`span`,{className:`oc-cdefaults__label`,children:O()}),(0,$.jsx)(H,{field:`thinkingLevel`,options:x,value:b?.thinkingDefault??null,onChange:()=>{},disabled:!0,ariaLabel:O()}),(0,$.jsx)(`p`,{className:`oc-cdefaults__help`,children:de()})]}),(0,$.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,$.jsx)(`span`,{className:`oc-cdefaults__label`,children:M()}),(0,$.jsx)(H,{field:`fastMode`,options:S,value:b===null||b.fastModeDefault===null?null:b.fastModeDefault?`fast`:`standard`,onChange:()=>{},disabled:!0,ariaLabel:M()}),(0,$.jsx)(`p`,{className:`oc-cdefaults__help`,children:me()})]}),(0,$.jsx)(`p`,{className:`oc-cdefaults__note`,children:i()})]}),(()=>{let e=r?.find(e=>e.name===(a??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-ZghOy9gS.js";import{r as u}from"./dist-CzXQ0eKG.js";import{t as d}from"./chevrons-up-down-Btm4pQFN.js";import{t as f}from"./button-kCamrfzR.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-ZghOy9gS.js";import{r as u}from"./dist-CzXQ0eKG.js";import{t as d}from"./chevrons-up-down-Btm4pQFN.js";import{t as f}from"./button-kCamrfzR.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-C_ywXTWT.js";import{a as C,i as w,n as T,o as E,r as D,t as O}from"./table-BpXBaCrR.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{PA as t,dE as n,nE as r,oX as i,rE as a,t as o,tE as s,uE as c}from"./api-ZghOy9gS.js";import{t as l}from"./use_paginated_query-B_mVv9z5.js";import{t as u}from"./button-kCamrfzR.js";import{ct as d,h as f}from"./index-
|
|
1
|
+
import{r as e}from"./bundle-mjs-C73ZY4La.js";import{PA as t,dE as n,nE as r,oX as i,rE as a,t as o,tE as s,uE as c}from"./api-ZghOy9gS.js";import{t as l}from"./use_paginated_query-B_mVv9z5.js";import{t as u}from"./button-kCamrfzR.js";import{ct as d,h as f}from"./index-C_ywXTWT.js";import{n as p,t as m}from"./trashPage-K2ys0z1F.js";var h=e();function g(){let{results:e,status:g,loadMore:_}=l(o.trash.listMyTrash,{},{initialNumItems:50}),v=f(),y=i(o.trash.restoreChat),b=i(o.trash.purgeChat),x=i(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:n({days:v})}),e.length>0?(0,h.jsx)(u,{variant:`destructive`,size:`sm`,onClick:async()=>{await S({title:r(),description:s(),confirmLabel:a(),destructive:!0})&&await x({})},children:a()}):null]}),g===`LoadingFirstPage`?(0,h.jsx)(`p`,{className:`oc-trash__hint`,children:t()}):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-C_ywXTWT.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,II as p,JI as m,KI as h,LI as g,MI as _,NI as v,OI as y,PI as b,QI as x,RI as ee,SI as te,TI as ne,UI as re,VI as ie,WI as S,XI as C,YI as w,ZI as T,_I as E,_L as D,aL as O,bI as k,cL as A,dL as j,eL as M,fL as N,gL as P,hL as F,iL as I,jI as L,kI as R,lL as z,mL as B,nL as V,oL as H,oX as U,pL as W,qI as G,rL as ae,sL as K,sX 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-ZghOy9gS.js";import{t as ge}from"./button-kCamrfzR.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,II as p,JI as m,KI as h,LI as g,MI as _,NI as v,OI as y,PI as b,QI as x,RI as ee,SI as te,TI as ne,UI as re,VI as ie,WI as S,XI as C,YI as w,ZI as T,_I as E,_L as D,aL as O,bI as k,cL as A,dL as j,eL as M,fL as N,gL as P,hL as F,iL as I,jI as L,kI as R,lL as z,mL as B,nL as V,oL as H,oX as U,pL as W,qI as G,rL as ae,sL as K,sX 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-ZghOy9gS.js";import{t as ge}from"./button-kCamrfzR.js";import{At as _e,ct as Y}from"./index-C_ywXTWT.js";import{t as ve}from"./DataTableShell-DwQKTbat.js";var X=t(e(),1),Z=n(),ye={altered_words:()=>me(),incorrect:()=>le(),incoherence:()=>D(),formatting:()=>P(),latency:()=>F(),api_error:()=>B(),other:()=>W()},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:j()}):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:N()})}function be({data:e,reference:t,closeReason:n}){let i=e.snapshot,a=U(J.feedback.respondToFeedback),[c,l]=(0,X.useState)(e.thread),[u,f]=(0,X.useState)(``),[p,_]=(0,X.useState)(!1);async function v(){let t=u.trim();if(!(!t||p)){_(!0);try{await a({feedbackId:e._id,text:t}),l(e=>[...e,{authorRole:`admin`,text:t,at:Date.now()}]),f(``)}finally{_(!1)}}}let y=[];try{y=i.contextJson?JSON.parse(i.contextJson):[]}catch{y=[]}return(0,Z.jsxs)(`div`,{className:`oc-fbadmin__detail`,children:[(0,Z.jsxs)(`div`,{className:`oc-fbadmin__row`,children:[(0,Z.jsx)($,{matches:i.displayedMatchesStored,sourceWasOpen:i.clientInfo?.sourceWasOpen??!1}),(0,Z.jsxs)(`span`,{className:`oc-fbadmin__meta`,children:[Q(e.category),` · `,i.messageRole,i.isRegeneration?` · ${z()}`:``,i.openclawModel?` · ${i.openclawModel}`:``,i.openclawRuntime?` (${i.openclawRuntime})`:``]}),t?(0,Z.jsx)(`code`,{className:`oc-fbadmin__ref`,style:{userSelect:`all`,marginLeft:`auto`},title:g(),children:t}):null]}),e.comment?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:A()}),(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:K()}),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`?H():e.authorRole===`agent`?e.authorLabel??s():O()}),(0,Z.jsx)(`span`,{className:`oc-notif__msg-text`,children:e.text})]},t))}):(0,Z.jsx)(`p`,{className:`oc-fbadmin__meta`,children:I()}),(0,Z.jsx)(`textarea`,{className:`oc-feedback__textarea`,placeholder:ae(),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 v(),disabled:!u.trim()||p,children:p?V():oe()})})]}),(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:M()}),(0,Z.jsx)(`pre`,{className:`oc-msg__source-pre`,children:i.messageText||r()})]}),i.clientInfo?.sourceWasOpen&&i.displayedText!==void 0?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:x()}),(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:T()}),(0,Z.jsx)(`pre`,{className:`oc-msg__source-pre`,children:i.promptText})]}):null,y.length>0?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:C({count:i.contextCount??y.length,truncated:i.contextTruncated?w():``})}),(0,Z.jsx)(`div`,{className:`oc-fbadmin__ctx`,children:y.map((e,t)=>(0,Z.jsxs)(`div`,{className:`oc-fbadmin__ctx-turn`,children:[(0,Z.jsx)(`span`,{className:`oc-fbadmin__ctx-role`,children:e.role}),(0,Z.jsx)(`span`,{className:`oc-fbadmin__ctx-text`,children:e.text})]},t))})]}):null,i.outboxAvailable?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:m()}),(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:G()}),(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:h()}),(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:[S(),` `,i.clientInfo.plugins.join(`, `),(0,Z.jsxs)(`span`,{className:`oc-fbadmin__note`,children:[` `,re()]})]}):null,i.clientInfo?.userAgent?(0,Z.jsx)(`span`,{className:`oc-fbadmin__ua`,children:i.clientInfo.userAgent}):null]})]})]})}function xe(){let e=q(J.feedback.listForAdmin,{}),t=U(J.feedback.readSnapshot),n=U(J.feedback.deleteFeedback),r=Y(),[o,s]=(0,X.useState)(null),[d,m]=(0,X.useState)({});async function h(e){if(o===e._id){s(null);return}if(!d[e._id]){let n=await t({feedbackId:e._id});m(t=>({...t,[e._id]:n}))}s(e._id)}async function g(e){await r({title:pe(),description:ce(),confirmLabel:E(),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:ie()}),` `,a()]}),(0,Z.jsx)(ve,{title:he(),rows:e,emptyHint:ee(),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:p(),cell:e=>_e(e.at),sort:e=>e.at},{header:u(),cell:e=>Q(e.category),sort:e=>Q(e.category)},{header:b(),cell:e=>e.messageRole===`user`?v():_(),sort:e=>e.messageRole},{header:L(),cell:e=>(e.reporterEmail||e.reporterName||`—`)+(e.impersonated&&e.realOperatorEmail?` ${i({operator:e.realOperatorEmail})}`:``),sort:e=>e.reporterEmail||e.reporterName||null},{header:R(),cell:e=>(0,Z.jsx)($,{matches:e.displayedMatchesStored,sourceWasOpen:e.sourceWasOpen}),sort:e=>e.displayedMatchesStored===!1?0:e.displayedMatchesStored===!0?1:2},{header:y(),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:ne()}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-ok`,title:e.resolvedBy??void 0,children:fe()}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-closed`,children:ue()}),sort:e=>e.userClosedAt==null?e.resolvedAt==null?+!!e.answered:2:3}],rowActions:e=>[{label:o===e._id?te():de(),onSelect:()=>void h(e)},{label:k(),onSelect:()=>void g(e),variant:`destructive`}]})]})}export{xe as FeedbacksTab};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./bundle-mjs-C73ZY4La.js";import{E as t,mX as n}from"./api-ZghOy9gS.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,mX as n}from"./api-ZghOy9gS.js";import{B as r,R as i,V as a,mn as o,pn as s,z as c}from"./index-C_ywXTWT.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,$Y as te,BJ as ne,Df as r,Ef as re,GJ as i,HJ as ie,JJ as ae,KJ as oe,LJ as a,QJ as o,RJ as s,UJ as c,VJ as l,WJ as u,XJ as se,YJ as ce,ZJ as le,ZY as ue,_Y as de,aY as d,cV as fe,cY as pe,dY as me,eY as he,fY as ge,gY as _e,hY as f,iY as p,lY as ve,mY as m,nY as h,oX as ye,oY as g,pY as be,qJ as xe,rY as _,sX as v,sY as y,t as b,tY as x,uY as S,vY as C,zJ as w}from"./api-ZghOy9gS.js";import{t as T}from"./button-kCamrfzR.js";import{An as E,Bt as D,Gt as O,Ht as k,In as A,Jt as j,Kt as M,Mt as Se,St as N,Ut as Ce,Vt as we,Wt as Te,Yt as Ee,an as De,bt as P,en as Oe,nn as F,nr as I,qt as ke,tn as Ae,tr as je,vt as L,xt as R,yt as z}from"./index-
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$J as ee,$Y as te,BJ as ne,Df as r,Ef as re,GJ as i,HJ as ie,JJ as ae,KJ as oe,LJ as a,QJ as o,RJ as s,UJ as c,VJ as l,WJ as u,XJ as se,YJ as ce,ZJ as le,ZY as ue,_Y as de,aY as d,cV as fe,cY as pe,dY as me,eY as he,fY as ge,gY as _e,hY as f,iY as p,lY as ve,mY as m,nY as h,oX as ye,oY as g,pY as be,qJ as xe,rY as _,sX as v,sY as y,t as b,tY as x,uY as S,vY as C,zJ as w}from"./api-ZghOy9gS.js";import{t as T}from"./button-kCamrfzR.js";import{An as E,Bt as D,Gt as O,Ht as k,In as A,Jt as j,Kt as M,Mt as Se,St as N,Ut as Ce,Vt as we,Wt as Te,Yt as Ee,an as De,bt as P,en as Oe,nn as F,nr as I,qt as ke,tn as Ae,tr as je,vt as L,xt as R,yt as z}from"./index-C_ywXTWT.js";import{a as Me,i as B,n as Ne,o as V,r as H,t as Pe}from"./table-BpXBaCrR.js";var U=t(e(),1),W=n(),G=`all`;function K(e){switch(e){case`image`:return y();case`audio`:return g();case`video`:return d();case`pdf`:return p();case`document`:return _();case`archive`:return h();default:return x()}}function q(){let[e,t]=(0,U.useState)(G),[n,d]=(0,U.useState)(G),[p,h]=(0,U.useState)(G),[g,_]=(0,U.useState)(G),[y,x]=(0,U.useState)(!1),[q,J]=(0,U.useState)(null),Fe=ye(b.files.softDelete),Y=Ee();function Ie(){t(G),d(G),h(G),_(G)}async function Le(){let e=q;if(J(null),e)try{await Fe({fileId:e.id}),Y.success(u())}catch(e){Y.error(c(),e)}}let X=v(b.files.listMine,{direction:e===G?void 0:e,chatId:n===G?void 0:n,instanceName:p===G?void 0:p,category:g===G?void 0:g,includeAutoGenerated:y||void 0}),Re=(0,U.useMemo)(()=>new Intl.DateTimeFormat(te(),{dateStyle:`medium`,timeStyle:`short`}),[]);if(X===void 0)return(0,W.jsx)(`p`,{className:`oc-admin__hint`,children:ue()});let{files:Z,facets:Q,truncated:ze,cap:Be}=X,$=e!==G||n!==G||p!==G||g!==G;return(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`p`,{className:`oc-admin__hint`,children:C()}),(0,W.jsxs)(`div`,{className:`oc-files__filters`,style:{display:`flex`,flexWrap:`wrap`,gap:8,margin:`12px 0`},children:[(0,W.jsxs)(L,{value:e,onValueChange:t,children:[(0,W.jsx)(R,{size:`sm`,"aria-label":de(),children:(0,W.jsx)(N,{})}),(0,W.jsxs)(z,{children:[(0,W.jsx)(P,{value:G,children:_e()}),(0,W.jsx)(P,{value:`inbound`,children:f()}),(0,W.jsx)(P,{value:`outbound`,children:m()})]})]}),(0,W.jsxs)(L,{value:n,onValueChange:d,children:[(0,W.jsx)(R,{size:`sm`,"aria-label":be(),children:(0,W.jsx)(N,{})}),(0,W.jsxs)(z,{children:[(0,W.jsx)(P,{value:G,children:ge()}),Q.chats.map(e=>(0,W.jsx)(P,{value:e.id,children:e.title},e.id))]})]}),Q.multiProvider?(0,W.jsxs)(L,{value:p,onValueChange:h,children:[(0,W.jsx)(R,{size:`sm`,"aria-label":me(),children:(0,W.jsx)(N,{})}),(0,W.jsxs)(z,{children:[(0,W.jsx)(P,{value:G,children:S()}),Q.instances.map(e=>(0,W.jsx)(P,{value:e,children:e},e))]})]}):null,(0,W.jsxs)(L,{value:g,onValueChange:_,children:[(0,W.jsx)(R,{size:`sm`,"aria-label":ve(),children:(0,W.jsx)(N,{})}),(0,W.jsxs)(z,{children:[(0,W.jsx)(P,{value:G,children:pe()}),Q.categories.map(e=>(0,W.jsx)(P,{value:e,children:K(e)},e))]})]}),(0,W.jsxs)(`label`,{className:`oc-files__autogen`,children:[(0,W.jsx)(Se,{checked:y,onCheckedChange:e=>x(e===!0),"aria-label":r()}),(0,W.jsx)(`span`,{children:r()})]}),$?(0,W.jsxs)(T,{variant:`ghost`,size:`sm`,onClick:Ie,style:{display:`inline-flex`,alignItems:`center`,gap:4,marginLeft:`auto`},children:[(0,W.jsx)(A,{size:14,"aria-hidden":!0}),xe()]}):null]}),Z.length===0?(0,W.jsx)(`p`,{className:`oc-admin__hint`,children:$?s():w()}):(0,W.jsxs)(W.Fragment,{children:[(0,W.jsxs)(Pe,{children:[(0,W.jsx)(Me,{children:(0,W.jsxs)(V,{children:[(0,W.jsx)(B,{children:he()}),(0,W.jsx)(B,{children:ee()}),(0,W.jsx)(B,{children:o()}),(0,W.jsx)(B,{children:le()}),(0,W.jsx)(B,{children:se()}),(0,W.jsx)(B,{className:`text-right`,children:ce()})]})}),(0,W.jsx)(Ne,{children:Z.map(e=>(0,W.jsxs)(V,{children:[(0,W.jsxs)(H,{className:`font-medium`,style:{maxWidth:280,overflow:`hidden`,textOverflow:`ellipsis`},title:e.filename,children:[e.filename,e.origin===`pasted`?(0,W.jsx)(j,{variant:`outline`,style:{marginLeft:6},children:re()}):null]}),(0,W.jsx)(H,{title:e.mimeType,children:K(e.category)}),(0,W.jsx)(H,{children:(0,W.jsx)(j,{variant:`secondary`,children:e.direction===`inbound`?f():m()})}),(0,W.jsx)(H,{style:{maxWidth:220,overflow:`hidden`,textOverflow:`ellipsis`},title:e.chatTitle,children:e.chatTitle}),(0,W.jsx)(H,{className:`whitespace-nowrap text-muted-foreground`,children:Re.format(e.createdAt)}),(0,W.jsx)(H,{className:`text-right`,children:(0,W.jsxs)(Oe,{children:[(0,W.jsx)(De,{asChild:!0,children:(0,W.jsx)(T,{variant:`ghost`,size:`icon`,"aria-label":oe(),children:(0,W.jsx)(je,{size:16})})}),(0,W.jsxs)(Ae,{align:`end`,children:[e.url?(0,W.jsx)(F,{asChild:!0,children:(0,W.jsxs)(`a`,{href:e.url,download:e.filename,target:`_blank`,rel:`noopener noreferrer`,children:[(0,W.jsx)(I,{size:14}),ae()]})}):(0,W.jsxs)(F,{disabled:!0,children:[(0,W.jsx)(I,{size:14}),ne()]}),(0,W.jsxs)(F,{variant:`destructive`,onSelect:()=>J({id:e._id,filename:e.filename}),children:[(0,W.jsx)(E,{size:14}),i()]})]})]})})]},e._id))})]}),ze?(0,W.jsx)(`p`,{className:`oc-admin__hint`,style:{marginTop:8},children:a({cap:Be})}):null]}),(0,W.jsx)(D,{open:q!==null,onOpenChange:e=>!e&&J(null),children:(0,W.jsxs)(Ce,{children:[(0,W.jsxs)(M,{children:[(0,W.jsx)(ke,{children:ie()}),(0,W.jsx)(Te,{children:l()})]}),(0,W.jsxs)(O,{children:[(0,W.jsx)(k,{children:fe()}),(0,W.jsx)(we,{onClick:()=>void Le(),children:i()})]})]})})]})}export{q 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-ZghOy9gS.js";import{t as a}from"./button-kCamrfzR.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-ZghOy9gS.js";import{t as a}from"./button-kCamrfzR.js";import{$t as o,Fn as s,In as c}from"./index-C_ywXTWT.js";import{t as l}from"./TimeRangePicker-D-l1jL_i.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};
|