@lacneu/atrium 0.101.1 → 0.101.2
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-Bqe1pBHg.js → AccessTab-CgoSHwRq.js} +1 -1
- package/dist/assets/{AdvancedFilter-CuU4dw1X.js → AdvancedFilter-05ypZDMe.js} +1 -1
- package/dist/assets/{AgentFilesTab-NYJs6TMu.js → AgentFilesTab-DHL8Lt63.js} +1 -1
- package/dist/assets/{AnomaliesTab-DFvqHv9o.js → AnomaliesTab-QCxh3MK3.js} +1 -1
- package/dist/assets/{AuditTab-DIcziIJX.js → AuditTab-ZSJKAmT-.js} +1 -1
- package/dist/assets/{BridgeTab-VqbKYXla.js → BridgeTab-BJEkCzek.js} +1 -1
- package/dist/assets/{ChatDefaultsTab-DqMpmy5H.js → ChatDefaultsTab-CMbP2VpD.js} +1 -1
- package/dist/assets/{DataTableShell-D_c2Z76f.js → DataTableShell-BUYroEsA.js} +1 -1
- package/dist/assets/{DeletedChatsTab-DyxFfmef.js → DeletedChatsTab-DP3F_9Es.js} +1 -1
- package/dist/assets/{DetailChips-WBRxaQ82.js → DetailChips-Zknkp3Iu.js} +1 -1
- package/dist/assets/{FeedbacksTab-DVut75TE.js → FeedbacksTab-DVZNIYyH.js} +1 -1
- package/dist/assets/{FieldLabel-sEQ38rsG.js → FieldLabel-BP6EBGVI.js} +1 -1
- package/dist/assets/{FilesTab-BFIgkWEG.js → FilesTab-COkrJcj5.js} +1 -1
- package/dist/assets/{FilterBar-PBFn9z0b.js → FilterBar-BrdWP0oO.js} +1 -1
- package/dist/assets/{GroupsTab-C91UFNLH.js → GroupsTab-Bq7pFctp.js} +1 -1
- package/dist/assets/{InstancesTab-BviB2Jvn.js → InstancesTab-DMYsJ9Eh.js} +1 -1
- package/dist/assets/{IntegrationsTab-9qNfX7Ea.js → IntegrationsTab-BTLLarPk.js} +1 -1
- package/dist/assets/{KpiTab-CvhpHsF6.js → KpiTab-CgNFLZ4K.js} +1 -1
- package/dist/assets/{PreferencesTab-xlq16eC5.js → PreferencesTab-BnBhz2n4.js} +1 -1
- package/dist/assets/{ProjectPage-BtrFu_Lf.js → ProjectPage-CUsvZaGD.js} +1 -1
- package/dist/assets/{PromptInjectionsTab-B3TsPHrm.js → PromptInjectionsTab-B5AV0diL.js} +1 -1
- package/dist/assets/{RolesTab-sL4whlaG.js → RolesTab-yEfSrKGO.js} +1 -1
- package/dist/assets/{ScheduledTab-DTY4IM6C.js → ScheduledTab-Bfsl1JLw.js} +1 -1
- package/dist/assets/{ServiceAccountsTab-DKpSqt09.js → ServiceAccountsTab-c3kMpEBz.js} +1 -1
- package/dist/assets/{SubAgentReportsTab-gInAtOGP.js → SubAgentReportsTab-CBEyyvZD.js} +1 -1
- package/dist/assets/{ThemeShowroom-Df3xhHT5.js → ThemeShowroom-D_KOxmeA.js} +1 -1
- package/dist/assets/{TimeRangePicker-D6jq73FP.js → TimeRangePicker-BcvPW9JK.js} +1 -1
- package/dist/assets/{TimezoneCombobox-6UndnvMs.js → TimezoneCombobox-Djj8VaFK.js} +1 -1
- package/dist/assets/{TracesTab-Bk5xfjiy.js → TracesTab-BBUTNwmq.js} +1 -1
- package/dist/assets/{TrashTab-CdaRxOlx.js → TrashTab-NsT89bEO.js} +1 -1
- package/dist/assets/{UsersTab-CIwnujn2.js → UsersTab-Dyf8X1a7.js} +1 -1
- package/dist/assets/{VoiceTab-Baf3mBPU.js → VoiceTab-CakW8mBV.js} +1 -1
- package/dist/assets/{highlighted-body-OFNGDK62-CGcdFk1N.js → highlighted-body-OFNGDK62-B8sH7UMy.js} +1 -1
- package/dist/assets/{index-bizOs74t.js → index-Wii4FZxb.js} +88 -88
- package/dist/assets/mermaid-GHXKKRXX-qTTPfzhk.js +1 -0
- package/dist/assets/{pdf-CUEcMpJo.js → pdf-Dxeqzi2x.js} +1 -1
- package/dist/assets/{trashPage-Cq944d0w.js → trashPage-svjv-CK6.js} +1 -1
- package/dist/index.html +1 -1
- package/package.json +1 -1
- package/dist/assets/mermaid-GHXKKRXX-BRRFpPlu.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Ax as r,Dx as i,Ex as a,Fx as o,HX as s,Ix as c,Lx as l,MX as u,Mx as d,Nx as f,Ox as p,Px as m,Rx as h,Tx as g,jx as _,kx as v,t as y,zx as b}from"./api-Ca1H8N44.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{Ax as r,Dx as i,Ex as a,Fx as o,HX as s,Ix as c,Lx as l,MX as u,Mx as d,Nx as f,Ox as p,Px as m,Rx as h,Tx as g,jx as _,kx as v,t as y,zx as b}from"./api-Ca1H8N44.js";import{Jt as x,St as S,bt as C,vt as w,xt as T,yt as E}from"./index-Wii4FZxb.js";var D=t(e(),1);function O(e){return e===`user`?v():e===`all`?p():i({group:e.group})}function k(e){return e===`common`?a():e===`owner`?g():i({group:e.group})}var A=n();function j(e){return e.name||e.email||e.userId.slice(0,8)}function M(){let e=s(y.admin.listUsers,{}),[t,n]=(0,D.useState)(``),i=s(y.introspect.introspectUser,t?{userId:t}:`skip`);return(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:b()}),(0,A.jsxs)(w,{value:t,onValueChange:n,children:[(0,A.jsx)(T,{size:`sm`,"aria-label":h(),children:(0,A.jsx)(S,{placeholder:h()})}),(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:l()}):i===void 0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:u()}):(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:i.user.label}),(0,A.jsx)(x,{variant:`secondary`,children:i.role})]})]}),(0,A.jsxs)(`section`,{className:`oc-introspect__section`,children:[(0,A.jsx)(`h3`,{className:`oc-introspect__title`,children:o()}),i.groups.length===0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:_()}):(0,A.jsx)(`div`,{className:`oc-introspect__chips`,children:i.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()}),i.agents.length===0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:_()}):(0,A.jsx)(`ul`,{className:`oc-introspect__list`,children:i.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:r()}):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:f()}),i.charts.length===0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:_()}):(0,A.jsx)(`ul`,{className:`oc-introspect__list`,children:i.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()}),i.permissions.length===0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:_()}):(0,A.jsx)(`div`,{className:`oc-introspect__chips`,children:i.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{aw as r,cw as i,iw as a,lw as o,ow as s,sw as c,uw as l}from"./api-Ca1H8N44.js";import{r as u}from"./dist-Bfmsr8JO.js";import{t as d}from"./x-BvlIg0Y4.js";import{t as f}from"./button-BbEZKLza.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{aw as r,cw as i,iw as a,lw as o,ow as s,sw as c,uw as l}from"./api-Ca1H8N44.js";import{r as u}from"./dist-Bfmsr8JO.js";import{t as d}from"./x-BvlIg0Y4.js";import{t as f}from"./button-BbEZKLza.js";import{$t as p,Ln as m,St as h,bt as g,vt as _,xt as v,yt as y}from"./index-Wii4FZxb.js";import{r as b}from"./TimeRangePicker-BcvPW9JK.js";var x=t(e(),1),S=n(),C=[{value:`eq`,label:`=`},{value:`neq`,label:`≠`},{value:`contains`,label:l()},{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 l=(0,x.useRef)(t),w=!!(l.current&&l.current.length>0),[D,O]=(0,x.useState)(w),[k,A]=(0,x.useState)(()=>w?E(l.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}),o(),F>0?(0,S.jsx)(`span`,{className:`oc-advfilter__count`,children:F}):null]}),D?(0,S.jsxs)(`div`,{className:`oc-advfilter__body`,children:[k.length===0?(0,S.jsx)(`p`,{className:`oc-admin__hint`,children:i()}):(0,S.jsx)(`ul`,{className:`oc-advfilter__rows`,children:k.map(t=>(0,S.jsxs)(`li`,{className:`oc-advfilter__row`,children:[(0,S.jsxs)(_,{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:c()})}),(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:s()}),(0,S.jsx)(f,{variant:`ghost`,size:`icon-sm`,"aria-label":r(),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,{}),a()]})]}):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{$_ as r,Af as i,B_ as a,Bf as o,Df as s,Ef as c,F_ as l,Ff as u,G_ as d,Gf as f,HX as p,H_ as m,Hf as h,I_ as g,If as _,J_ as v,Jv as y,K_ as b,L_ as x,Lf as S,MX as C,Mf as w,Nf as T,Of as E,PX as D,Pf as O,Q_ as k,R_ as A,Rf as j,Tf as M,UV as N,U_ as ee,Uf as P,VX as F,V_ as I,Vf as L,W_ as R,Wf as z,X_ as te,Xv as B,Y_ as V,Z_ as ne,af as re,av as H,cf as ie,cv as U,ev as W,if as ae,iv as oe,jf as se,kf as ce,ks as le,lf as ue,lv as de,nv as fe,of as pe,ov as me,q_ as he,rf as ge,rv as _e,sf as ve,sv as ye,t as G,tv as be,uv as xe,zX as K,z_ as Se,zf as Ce}from"./api-Ca1H8N44.js";import{t as q}from"./button-BbEZKLza.js";import{Bt as we,Ct as Te,Dt as Ee,Gt as De,Ht as Oe,Jt as ke,Kt as Ae,Ot as je,St as Me,Tt as Ne,Ut as Pe,Vt as Fe,Wt as Ie,Yt as J,bt as Le,ft as Re,kn as Y,nt as ze,qt as Be,vt as Ve,wt as He,xt as Ue,yt as We}from"./index-
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$_ as r,Af as i,B_ as a,Bf as o,Df as s,Ef as c,F_ as l,Ff as u,G_ as d,Gf as f,HX as p,H_ as m,Hf as h,I_ as g,If as _,J_ as v,Jv as y,K_ as b,L_ as x,Lf as S,MX as C,Mf as w,Nf as T,Of as E,PX as D,Pf as O,Q_ as k,R_ as A,Rf as j,Tf as M,UV as N,U_ as ee,Uf as P,VX as F,V_ as I,Vf as L,W_ as R,Wf as z,X_ as te,Xv as B,Y_ as V,Z_ as ne,af as re,av as H,cf as ie,cv as U,ev as W,if as ae,iv as oe,jf as se,kf as ce,ks as le,lf as ue,lv as de,nv as fe,of as pe,ov as me,q_ as he,rf as ge,rv as _e,sf as ve,sv as ye,t as G,tv as be,uv as xe,zX as K,z_ as Se,zf as Ce}from"./api-Ca1H8N44.js";import{t as q}from"./button-BbEZKLza.js";import{Bt as we,Ct as Te,Dt as Ee,Gt as De,Ht as Oe,Jt as ke,Kt as Ae,Ot as je,St as Me,Tt as Ne,Ut as Pe,Vt as Fe,Wt as Ie,Yt as J,bt as Le,ft as Re,kn as Y,nt as ze,qt as Be,vt as Ve,wt as He,xt as Ue,yt as We}from"./index-Wii4FZxb.js";import{n as Ge,t as Ke}from"./curation-CQksaIbm.js";import{a as qe}from"./compatView-BDU79WFh.js";/* empty css */var X=t(e(),1),Je=2e4,Ye=6e4;function Xe(e){return typeof e!=`number`||e<=0?0:Math.round(e/Je*100)}function Ze(e){return e<=0?0:Math.round(e/Ye*100)}function Z(e,t){let n=(typeof e==`number`&&e>0?e:0)/1e3;return new Intl.NumberFormat(t,{minimumFractionDigits:1,maximumFractionDigits:1}).format(n)}function Qe(e){return e.reduce((e,t)=>e+(typeof t.size==`number`&&t.size>0?t.size:0),0)}var $e=3;function et(e,t){let n=new Map;for(let t of e.split(`
|
|
2
2
|
`))n.set(t,(n.get(t)??0)+1);for(let e of t.split(`
|
|
3
3
|
`))n.set(e,(n.get(e)??0)-1);let r=0,i=0,a=[],o=[];for(let[e,t]of n)t<0?(r+=-t,a.length<$e&&a.push(e)):t>0&&(i+=t,o.length<$e&&o.push(e));return{added:r,removed:i,sampleAdded:a,sampleRemoved:o}}function tt(e){return(e instanceof Error?e.message:String(e)).includes(`DASHBOARD_NOT_DEPLOYED`)}function nt(e){return e instanceof Error?e.message.includes(`conflict:`):String(e).includes(`conflict:`)}var Q=n(),$=e=>`${e.instanceName}::${e.agentId}`;function rt(){let e=p(G.me.getMe,{host:Re}),t=e?.role===`admin`,n=(e?.permissions??[]).includes(`bridge.read`),i=p(G.admin.listInstances,e!==void 0&&t?{}:`skip`),[a,s]=(0,X.useState)(null);(0,X.useEffect)(()=>{!t||!i||i.length===0||(!a||!i.some(e=>e.name===a))&&s(i[0].name)},[t,i,a]);let c=p(G.agents.listAgentsForInstance,t&&a?{instanceName:a}:`skip`),l=p(G.agents.listMyAgents,e!==void 0&&!t?{}:`skip`),u=(0,X.useMemo)(()=>{if(e!==void 0){if(t)return a===null||c===void 0?i!==void 0&&i.length===0?[]:void 0:c.agents.map(e=>({instanceName:a,agentId:e.agentId,label:`${e.emoji?`${e.emoji} `:``}${e.displayName??e.agentId}`}));if(l!==void 0)return l.map(e=>({instanceName:e.instanceName,agentId:e.agentId,label:`${e.emoji?`${e.emoji} `:``}${e.displayName??e.agentId}`}))}},[e,t,a,c,i,l]),[d,f]=(0,X.useState)(null);(0,X.useEffect)(()=>{!u||u.length===0||(!d||!u.some(e=>$(e)===d))&&f($(u[0]))},[u,d]);let m=u?.find(e=>$(e)===d)??null,g=K(G.agentFiles.listAgentFiles),[_,v]=(0,X.useState)({status:`idle`}),b=m?.instanceName??null,x=m?.agentId??null,S=p(G.compat.forInstance,n&&b!==null?{instanceName:b}:`skip`),w=n&&b!==null?ze(S,`agentFiles`):null,T=w===null?!1:w===`loading`?null:w.blocked,E=(0,X.useCallback)(async()=>{if(!(b===null||x===null)){v({status:`loading`});try{v({status:`done`,files:(await g({instanceName:b,agentId:x})).files})}catch(e){v({status:`error`,dashboardAbsent:tt(e)})}}},[g,b,x]);(0,X.useEffect)(()=>{T===!1&&E()},[E,T]);let[O,A]=(0,X.useState)(null),j=p(G.agentFileCuration.listCurations,t&&b!==null&&x!==null?{instanceName:b,agentId:x}:`skip`),M=p(G.agentFileCuration.curationSettings,t&&b!==null?{instanceName:b}:`skip`),N=K(G.agentFileCuration.requestCuration),[ee,P]=(0,X.useState)(null),[F,I]=(0,X.useState)(null),{toast:R}=J(),z=(0,X.useMemo)(()=>{let e=new Map;for(let t of j??[])e.has(t.name)||e.set(t.name,t);return e},[j]),te=(0,X.useCallback)(async e=>{if(!(b===null||x===null)){P(e);try{let t=await N({instanceName:b,agentId:x,name:e,trigger:`manual`});t.ok?R({title:h(),variant:`success`}):R({title:L({reason:t.reason??`unknown`}),variant:`error`})}catch{R({title:o(),variant:`error`})}finally{P(null)}}},[N,b,x,R]),B=D(),V=(0,X.useMemo)(()=>new Intl.NumberFormat(B,{maximumFractionDigits:0}),[B]);return e===void 0||u===void 0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:C()}):(0,Q.jsxs)(`div`,{className:`oc-afiles`,children:[(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:xe()}),(0,Q.jsxs)(`div`,{className:`oc-afiles__picker`,children:[t&&(i?.length??0)>1?(0,Q.jsxs)(Ve,{value:a??``,onValueChange:e=>s(e),children:[(0,Q.jsx)(Ue,{size:`sm`,"aria-label":de(),children:(0,Q.jsx)(Me,{})}),(0,Q.jsx)(We,{children:(i??[]).map(e=>(0,Q.jsx)(Le,{value:e.name,children:e.name},e.name))})]}):null,u.length>0?(0,Q.jsxs)(Ve,{value:d??``,onValueChange:e=>f(e),children:[(0,Q.jsx)(Ue,{size:`sm`,"aria-label":U(),children:(0,Q.jsx)(Me,{})}),(0,Q.jsx)(We,{children:u.map(e=>(0,Q.jsx)(Le,{value:$(e),children:e.label},$(e)))})]}):(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:ye()})]}),m===null?null:w===`loading`?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:C()}):w!==null&&w.blocked?(0,Q.jsxs)(`p`,{className:`oc-compat__blocked`,role:`status`,children:[(0,Q.jsx)(Y,{size:14,"aria-hidden":!0}),` `,qe(w.gatewayVersion,w.provider)]}):_.status===`loading`||_.status===`idle`?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:C()}):_.status===`error`?(0,Q.jsxs)(`p`,{className:`oc-afiles__error`,role:`alert`,children:[_.dashboardAbsent?le():H(),` `,!_.dashboardAbsent&&(0,Q.jsx)(q,{variant:`outline`,size:`sm`,onClick:()=>void E(),children:y()})]}):_.files.length===0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:me()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`div`,{className:`oc-afiles__list`,children:_.files.map(e=>{let n=Xe(e.size),i=n>=80;return(0,Q.jsxs)(`div`,{className:`oc-afiles__row`,children:[(0,Q.jsx)(`span`,{className:`oc-afiles__name`,title:e.name,children:e.name}),e.missing?(0,Q.jsx)(ke,{variant:`outline`,children:oe()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`span`,{className:`oc-afiles__size`,children:_e({size:Z(e.size,B)})}),(0,Q.jsx)(`span`,{className:`oc-afiles__gauge${i?` is-warn`:``}`,"aria-hidden":!0,children:(0,Q.jsx)(`span`,{className:`oc-afiles__gauge-fill`,style:{width:`${Math.min(n,100)}%`}})}),(0,Q.jsx)(`span`,{className:`oc-afiles__pct`,children:fe({pct:V.format(n)})}),i?(0,Q.jsx)(Y,{size:14,className:`oc-afiles__warn`,"aria-label":be()}):(0,Q.jsx)(`span`,{className:`oc-afiles__warn-slot`,"aria-hidden":!0})]}),(0,Q.jsx)(q,{variant:`outline`,size:`sm`,className:`oc-afiles__open`,onClick:()=>A(e),children:t?r():k()}),t&&!e.missing?(0,Q.jsx)(it,{curatable:Ke.includes(e.name),size:e.size??0,budget:M?.budgetChars??null,enabled:M?.enabled??!1,curation:z.get(e.name)??null,inFlight:ee===e.name,onCurate:()=>void te(e.name),onReview:e=>I(e)}):null]},e.name)})}),(0,Q.jsx)(`p`,{className:`oc-afiles__budget`,children:W({used:Z(Qe(_.files),B),total:Z(Ye,B),pct:V.format(Ze(Qe(_.files)))})})]}),O&&m?(0,Q.jsx)(at,{instanceName:m.instanceName,agentId:m.agentId,name:O.name,isAdmin:t,onClose:()=>A(null),onSaved:()=>void E()}):null,F?(0,Q.jsx)(ot,{curationId:F,onClose:()=>I(null),onApplied:()=>{I(null),E()}}):null]})}function it({curatable:e,size:t,budget:n,enabled:r,curation:i,inFlight:a,onCurate:o,onReview:s}){return i?.status===`proposed`?(0,Q.jsx)(q,{variant:`default`,size:`sm`,className:`oc-afiles__curate`,onClick:()=>s(i._id),children:z()}):a||i?.status===`dispatched`||i?.status===`applying`?(0,Q.jsx)(ke,{variant:`outline`,className:`oc-afiles__curate-status`,children:P()}):e&&r&&n!==null&&Ge(t,n)?(0,Q.jsx)(q,{variant:`outline`,size:`sm`,className:`oc-afiles__curate`,onClick:o,children:f()}):null}function at({instanceName:e,agentId:t,name:n,isAdmin:r,onClose:i,onSaved:o}){let s=K(G.agentFiles.getAgentFile),c=K(G.agentFiles.setAgentFile),u=J(),[f,p]=(0,X.useState)(null),[h,_]=(0,X.useState)(!1),[S,w]=(0,X.useState)(``),[T,E]=(0,X.useState)(!1),[O,k]=(0,X.useState)(!1),[j,M]=(0,X.useState)(!1),[P,F]=(0,X.useState)(!1),L=(0,X.useCallback)(async r=>{_(!1);try{let i=await s({instanceName:e,agentId:t,name:n});p({content:i.content,updatedAtMs:i.updatedAtMs}),r||w(i.content),M(!1)}catch{_(!0)}},[s,e,t,n]);(0,X.useEffect)(()=>{L(!1)},[L]);async function z(){if(f!==null){k(!0),F(!1);try{await c({instanceName:e,agentId:t,name:n,content:S,baseUpdatedAtMs:f.updatedAtMs??void 0}),u.success(d({name:n})),o(),await L(!1)}catch(e){nt(e)?M(!0):F(!0)}finally{k(!1)}}}let re=f!==null&&S!==f.content,H=(0,X.useMemo)(()=>f===null?null:et(f.content,S),[f,S]),ie=S.length>Je,U=D(),W=(0,X.useMemo)(()=>new Intl.NumberFormat(U),[U]);return(0,Q.jsx)(Te,{open:!0,onOpenChange:e=>!e&&i(),children:(0,Q.jsxs)(He,{className:`oc-afiles__editor`,children:[(0,Q.jsxs)(Ee,{children:[(0,Q.jsx)(je,{children:ne({name:n})}),(0,Q.jsxs)(Ne,{children:[te({agent:t,instance:e}),r?null:(0,Q.jsxs)(Q.Fragment,{children:[` · `,V()]})]})]}),h?(0,Q.jsxs)(`p`,{className:`oc-afiles__error`,role:`alert`,children:[ee(),` `,(0,Q.jsx)(q,{variant:`outline`,size:`sm`,onClick:()=>void L(!1),children:y()})]}):f===null?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:C()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`textarea`,{className:`oc-afiles__source`,value:S,readOnly:!r,spellCheck:!1,onChange:e=>w(e.target.value),"aria-label":ne({name:n})}),(0,Q.jsx)(`p`,{className:`oc-afiles__hint`,children:v()}),j?(0,Q.jsxs)(`p`,{className:`oc-afiles__error`,role:`alert`,children:[m(),` `,(0,Q.jsx)(q,{variant:`outline`,size:`sm`,onClick:()=>void L(!0),children:I()})]}):null,P?(0,Q.jsx)(`p`,{className:`oc-afiles__error`,role:`alert`,children:R()}):null,(0,Q.jsxs)(`div`,{className:`oc-afiles__editor-foot`,children:[(0,Q.jsx)(`span`,{className:`oc-afiles__count${ie?` is-over`:``}`,children:he({count:W.format(S.length),max:W.format(Je)})}),r?(0,Q.jsx)(q,{size:`sm`,disabled:!re||O||j,onClick:()=>E(!0),children:O?B():b()}):null]})]}),(0,Q.jsx)(we,{open:T,onOpenChange:E,children:(0,Q.jsxs)(Pe,{children:[(0,Q.jsxs)(Ae,{children:[(0,Q.jsx)(Be,{children:a({name:n})}),(0,Q.jsx)(Ie,{children:Se({agent:t})})]}),H?(0,Q.jsxs)(`div`,{className:`oc-afiles__diff`,children:[(0,Q.jsx)(`p`,{className:`oc-afiles__diff-counts`,children:A({added:H.added,removed:H.removed})}),H.sampleAdded.length>0?(0,Q.jsxs)(`div`,{className:`oc-afiles__diff-block`,children:[(0,Q.jsx)(`span`,{className:`oc-afiles__diff-label`,children:x()}),H.sampleAdded.map((e,t)=>(0,Q.jsx)(`code`,{className:`oc-afiles__diff-line is-add`,children:e||` `},t))]}):null,H.sampleRemoved.length>0?(0,Q.jsxs)(`div`,{className:`oc-afiles__diff-block`,children:[(0,Q.jsx)(`span`,{className:`oc-afiles__diff-label`,children:g()}),H.sampleRemoved.map((e,t)=>(0,Q.jsx)(`code`,{className:`oc-afiles__diff-line is-del`,children:e||` `},t))]}):null]}):null,(0,Q.jsxs)(De,{children:[(0,Q.jsx)(Oe,{children:N()}),(0,Q.jsx)(Fe,{onClick:()=>void z(),children:l()})]})]})})]})})}function ot({curationId:e,onClose:t,onApplied:n}){let r=p(G.agentFileCuration.getProposal,{curationId:e}),a=K(G.agentFileCuration.approveCuration),l=F(G.agentFileCuration.rejectCuration),{toast:d}=J(),[f,m]=(0,X.useState)(null),[h,g]=(0,X.useState)(!1),[v,y]=(0,X.useState)(``),b=D(),x=(0,X.useMemo)(()=>r?et(r.beforeContent,r.proposedContent):null,[r]);async function k(){m(`approve`);try{let t=await a({curationId:e});t.ok?(d({title:Ce(),variant:`success`}),n()):d({title:t.reason===`conflict`?S():_({reason:t.reason??`unknown`}),variant:`error`})}catch{d({title:o(),variant:`error`})}finally{m(null)}}async function A(n){m(`reject`);try{let r=v.trim();(await l({curationId:e,...r?{comment:r}:{},relaunch:n})).ok?d({title:n?ae():j(),variant:`success`}):d({title:T(),variant:`error`}),t()}catch{d({title:o(),variant:`error`})}finally{m(null)}}return(0,Q.jsx)(Te,{open:!0,onOpenChange:e=>e?void 0:t(),children:(0,Q.jsxs)(He,{className:`oc-afiles__review`,children:[(0,Q.jsxs)(Ee,{children:[(0,Q.jsx)(je,{children:r?u({name:r.name}):C()}),(0,Q.jsx)(Ne,{children:O()})]}),r===void 0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:C()}):r===null?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:T()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`p`,{className:`oc-afiles__review-sizes`,children:[w({before:Z(r.beforeSize,b),after:Z(r.proposedSize,b)}),r.overBudget?(0,Q.jsxs)(Q.Fragment,{children:[` `,(0,Q.jsx)(Y,{size:13,"aria-hidden":!0}),` `,se()]}):null]}),x?(0,Q.jsx)(`p`,{className:`oc-afiles__review-diff`,children:i({added:x.added,removed:x.removed})}):null,r.feedback?(0,Q.jsx)(`p`,{className:`oc-afiles__review-feedback`,children:ge({feedback:r.feedback})}):null,x&&x.sampleRemoved.length>0?(0,Q.jsxs)(`div`,{className:`oc-afiles__review-removed`,children:[(0,Q.jsx)(`p`,{className:`oc-afiles__review-label`,children:M()}),(0,Q.jsx)(`ul`,{children:x.sampleRemoved.map((e,t)=>(0,Q.jsx)(`li`,{children:e||`\xA0`},t))})]}):null,(0,Q.jsxs)(`div`,{className:`oc-afiles__review-panes oc-afiles__review-panes--2`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`p`,{className:`oc-afiles__review-label`,children:c()}),(0,Q.jsx)(`pre`,{className:`oc-afiles__review-pre`,children:r.beforeContent})]}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`p`,{className:`oc-afiles__review-label`,children:ce()}),(0,Q.jsx)(`pre`,{className:`oc-afiles__review-pre`,children:r.proposedContent})]})]})]}),h?(0,Q.jsxs)(`div`,{className:`oc-afiles__reject-form`,children:[(0,Q.jsx)(`label`,{className:`oc-afiles__review-label`,htmlFor:`curation-reject-comment`,children:ue()}),(0,Q.jsx)(`textarea`,{id:`curation-reject-comment`,className:`oc-afiles__reject-textarea`,rows:3,placeholder:ie(),value:v,onChange:e=>y(e.target.value)}),(0,Q.jsxs)(`div`,{className:`oc-afiles__review-actions`,children:[(0,Q.jsx)(q,{variant:`ghost`,onClick:()=>g(!1),disabled:f!==null,children:ve()}),(0,Q.jsx)(q,{variant:`outline`,onClick:()=>void A(!1),disabled:f!==null,children:f===`reject`?B():pe()}),(0,Q.jsx)(q,{variant:`default`,onClick:()=>void A(!0),disabled:f!==null,children:f===`reject`?B():re()})]})]}):(0,Q.jsxs)(`div`,{className:`oc-afiles__review-actions`,children:[(0,Q.jsx)(q,{variant:`outline`,onClick:()=>g(!0),disabled:f!==null||r==null,children:E()}),(0,Q.jsx)(q,{variant:`default`,onClick:()=>void k(),disabled:f!==null||r==null,children:f===`approve`?B():s()})]})]})})}export{rt as AgentFilesTab};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$M as r,AM as i,BM as a,DM as o,EM as s,FM as c,GM as l,HM as u,HX as d,IM as ee,JM as te,KM as ne,LM as re,MM as f,NM as p,OM as m,PM as h,QM as g,RM as ie,UM as ae,VM as oe,VX as se,WM as ce,XM as le,YM as ue,ZM as de,_N as fe,aN as pe,bN as _,cN as me,dN as he,eN as ge,fN as _e,gN as ve,hN as ye,iN as be,jM as v,kM as y,lN as xe,mN as Se,nN as Ce,oN as b,pN as x,qM as S,rN as C,sN as w,t as T,tN as E,uN as D,vN as O,xN as k,yN as A,zM as we}from"./api-Ca1H8N44.js";import{At as j,Ct as M,Dt as N,Jt as P,Ot as F,St as I,Yt as Te,bt as L,ct as Ee,dr as R,fr as De,ft as Oe,i as ke,o as Ae,vt as z,wt as B,xt as V,yt as H}from"./index-
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$M as r,AM as i,BM as a,DM as o,EM as s,FM as c,GM as l,HM as u,HX as d,IM as ee,JM as te,KM as ne,LM as re,MM as f,NM as p,OM as m,PM as h,QM as g,RM as ie,UM as ae,VM as oe,VX as se,WM as ce,XM as le,YM as ue,ZM as de,_N as fe,aN as pe,bN as _,cN as me,dN as he,eN as ge,fN as _e,gN as ve,hN as ye,iN as be,jM as v,kM as y,lN as xe,mN as Se,nN as Ce,oN as b,pN as x,qM as S,rN as C,sN as w,t as T,tN as E,uN as D,vN as O,xN as k,yN as A,zM as we}from"./api-Ca1H8N44.js";import{At as j,Ct as M,Dt as N,Jt as P,Ot as F,St as I,Yt as Te,bt as L,ct as Ee,dr as R,fr as De,ft as Oe,i as ke,o as Ae,vt as z,wt as B,xt as V,yt as H}from"./index-Wii4FZxb.js";import{n as je}from"./TimeRangePicker-BcvPW9JK.js";import{t as Me}from"./FilterBar-BrdWP0oO.js";import{t as Ne}from"./DataTableShell-BUYroEsA.js";import{t as U}from"./dispatchErrorInfo-CoXI4U8X.js";var W=t(e(),1),G=new Set([`openclaw.dispatch_failures`,`assistant.announce_errors`]),K=new Set([`assistant.cause.provider_auth_revoked`,`assistant.cause.provider_permission_denied`,`assistant.cause.provider_auth_failed`]);function q(e){let t=K.has(e.kind);if(!G.has(e.kind)&&!t||!e.evidence)return{};try{let n=JSON.parse(e.evidence);if(t){let e=Array.isArray(n.agents)?n.agents.filter(e=>typeof e==`string`):[],t=Array.isArray(n.providers)?n.providers.filter(e=>typeof e==`string`):[],r=e.length===1?e[0]:void 0;return{dominantCode:n.cause,sampleCorrelationId:n.sampleCorrelationId,context:{...r===void 0?{}:{agentId:r.slice(r.lastIndexOf(`/`)+1)},...t.length===1?{provider:t[0]}:{}}}}return{dominantCode:n.dominantCode,sampleCorrelationId:n.sampleCorrelationId}}catch{return{}}}var J=n(),Y=`__all__`,Pe=[{value:`open`},{value:`acknowledged`},{value:`resolved`}];function Fe(e){return e===`open`?k():e===`acknowledged`?_():A()}var Ie=[`info`,`warn`,`critical`],Le=[`detector`,`agent`,`user`],X={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??``,i=e.status===Z?Y:e.status,o=e.severity??Y,s=e.kind??Y,[f,p]=(0,W.useState)(Y),m=ke(e.from,e.to),{from:_,to:v}=je(m),y=e=>void t({search:t=>({...t,q:e||void 0}),replace:!0}),k=e=>void t({search:t=>({...t,status:e===Y?Z:e})}),A=e=>void t({search:t=>({...t,severity:e===Y?void 0:e})}),M=e=>void t({search:t=>({...t,kind:e===Y?void 0:e})}),N=e=>void t({search:t=>({...t,...Ae(e)})}),F=Ee(),B=Te(),U=se(T.anomalies.resolveAnomaly),G=(d(T.me.getMe,{host:Oe})?.permissions??[]).includes(`admin.manage`),K=d(T.anomalies.listAnomalies,{limit:Re,filter:{q:n||void 0,from:_,to:v,anomalyStatus:i===Y?void 0:i,severity:o===Y?void 0:o,source:f===Y?void 0:f,kind:s===Y?void 0:s}}),q=(0,W.useMemo)(()=>{let e=new Set;for(let t of K??[])e.add(t.kind);return[...e].sort()},[K]),Q=n!==``||i!==`open`||o!==Y||f!==Y||s!==Y||m.kind!==`relative`||m.from!==X.from;function $(){p(Y),t({search:{status:`open`},replace:!0})}async function We(e){if(await F({title:O(),description:(0,J.jsxs)(J.Fragment,{children:[fe(),` `,(0,J.jsx)(`span`,{className:`font-mono`,children:e.kind}),` `,ve(),` `,(0,J.jsx)(`strong`,{children:ye()}),`.`,` `,Se()]}),confirmLabel:x()}))try{await U({anomalyId:e._id,status:`resolved`}),B.success(_e(),e.kind)}catch(e){B.error(he(),e)}}async function Ge(e){try{await U({anomalyId:e._id,status:`acknowledged`}),B.success(D(),e.kind)}catch(e){B.error(xe(),e)}}return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(`p`,{className:`oc-admin__hint`,children:[me(),` `,(0,J.jsx)(`strong`,{children:w()}),` `,b(),` `,(0,J.jsx)(`strong`,{children:pe()}),` `,be(),` `,(0,J.jsx)(`strong`,{children:C()}),` `,Ce(),` `,(0,J.jsx)(`span`,{className:`oc-filter__window`,children:E()})]}),(0,J.jsxs)(Me,{q:n,onQChange:y,searchPlaceholder:ge(),timeRange:m,onTimeRangeChange:N,onReset:$,canReset:Q,children:[(0,J.jsxs)(z,{value:i,onValueChange:k,children:[(0,J.jsx)(V,{size:`sm`,className:`w-36`,children:(0,J.jsx)(I,{})}),(0,J.jsxs)(H,{children:[(0,J.jsx)(L,{value:Y,children:r()}),Pe.map(e=>(0,J.jsx)(L,{value:e.value,children:Fe(e.value)},e.value))]})]}),(0,J.jsxs)(z,{value:o,onValueChange:A,children:[(0,J.jsx)(V,{size:`sm`,className:`w-36`,children:(0,J.jsx)(I,{placeholder:g()})}),(0,J.jsxs)(H,{children:[(0,J.jsx)(L,{value:Y,children:te()}),Ie.map(e=>(0,J.jsx)(L,{value:e,children:e},e))]})]}),(0,J.jsxs)(z,{value:f,onValueChange:p,children:[(0,J.jsx)(V,{size:`sm`,className:`w-32`,children:(0,J.jsx)(I,{placeholder:S()})}),(0,J.jsxs)(H,{children:[(0,J.jsx)(L,{value:Y,children:ne()}),Le.map(e=>(0,J.jsx)(L,{value:e,children:e},e))]})]}),(0,J.jsxs)(z,{value:s,onValueChange:M,children:[(0,J.jsx)(V,{size:`sm`,className:`w-36`,children:(0,J.jsx)(I,{placeholder:l()})}),(0,J.jsxs)(H,{children:[(0,J.jsx)(L,{value:Y,children:ce()}),q.map(e=>(0,J.jsx)(L,{value:e,children:e},e))]})]})]}),(0,J.jsx)(Ne,{title:ae(),rows:K,emptyHint:i===`open`?u():oe(),rowActions:e=>G&&e.status===`open`?[{label:a(),onSelect:()=>void We(e)},{label:we(),onSelect:()=>void Ge(e)}]:[],columns:[{header:ie(),cell:e=>(0,J.jsx)(`span`,{className:`oc-traces__time`,children:j(e.at)}),sort:e=>e.at},{header:l(),cell:e=>(0,J.jsx)(`code`,{className:`oc-traces__mono`,children:e.kind}),sort:e=>e.kind},{header:de(),cell:e=>e.occurrenceCount!==null&&e.occurrenceCount>1?(0,J.jsx)(`span`,{className:`oc-traces__time`,title:e.firstAt===null?void 0:ue({when:j(e.firstAt)}),children:le({count:String(e.occurrenceCount)})}):(0,J.jsx)(`span`,{className:`oc-traces__time`,children:`—`}),sort:e=>e.occurrenceCount??0},{header:g(),cell:e=>(0,J.jsx)(Ve,{severity:e.severity}),sort:e=>e.severity===`critical`?2:+(e.severity===`warn`)},{header:re(),cell:e=>(0,J.jsx)(He,{status:e.status}),sort:e=>e.status===`resolved`?2:+(e.status===`acknowledged`)},{header:S(),cell:e=>(0,J.jsx)(P,{variant:`outline`,children:e.source}),sort:e=>e.source},{header:ee(),cell:e=>(0,J.jsxs)(`div`,{className:`oc-anomaly__msgcell`,children:[(0,J.jsx)(`span`,{className:`oc-anomaly__msg`,children:e.message}),(0,J.jsx)(Be,{row:e})]}),sort:e=>e.message},{header:c(),cell:e=>(0,J.jsx)(ze,{row:e}),sort:e=>e.evidence??null},{header:h(),cell:e=>e.correlationId?(0,J.jsx)(`code`,{className:`oc-traces__mono`,children:Ue(e.correlationId)}):(0,J.jsx)(`span`,{className:`oc-traces__muted`,children:`—`}),sort:e=>e.correlationId}]})]})}function $(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,J.jsxs)(`div`,{className:`oc-anomaly__cause`,children:[(0,J.jsx)(`div`,{className:`oc-anomaly__cause-head`,children:[...new Set(n.errorCategories??[])].map(e=>(0,J.jsx)(`code`,{className:`oc-traces__mono`,children:e},e))}),e.correlationId?(0,J.jsxs)(`button`,{type:`button`,className:`oc-anomaly__drill`,onClick:()=>void t({to:`/settings/traces`,search:{q:e.correlationId,limit:100}}),children:[`↗ `,p()]}):null]})}let n=q(e);if(!n.dominantCode){let e=n.sampleCorrelationId;return e?(0,J.jsx)(`div`,{className:`oc-anomaly__cause`,children:(0,J.jsxs)(`button`,{type:`button`,className:`oc-anomaly__drill`,onClick:()=>void t({to:`/settings/traces`,search:{correlationId:e,limit:100}}),children:[`↗ `,p()]})}):(0,J.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})}let r=U(n.dominantCode,n.context),i=n.sampleCorrelationId;return(0,J.jsxs)(`div`,{className:`oc-anomaly__cause`,children:[(0,J.jsxs)(`div`,{className:`oc-anomaly__cause-head`,children:[(0,J.jsx)(`span`,{className:`oc-anomaly__cause-label`,children:r.label}),(0,J.jsx)(`code`,{className:`oc-traces__mono`,children:n.dominantCode})]}),(0,J.jsx)(`p`,{className:`oc-anomaly__cause-hint`,children:r.hint}),i?(0,J.jsxs)(`button`,{type:`button`,className:`oc-anomaly__drill`,onClick:()=>void t({to:`/settings/traces`,search:{correlationId:i,limit:100}}),children:[`↗ `,p()]}):null]})}function Be({row:e}){let[t,n]=(0,W.useState)(!1),r=d(T.anomalies.getAnomalyAttachments,t?{anomalyId:e._id}:`skip`);return!e.attachments||e.attachments.length===0?null:(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(`button`,{type:`button`,className:`oc-anomaly__drill`,onClick:()=>n(!0),children:[f(),e.attachments.length>1?` (${e.attachments.length})`:``]}),(0,J.jsx)(M,{open:t,onOpenChange:n,children:(0,J.jsxs)(B,{className:`oc-anomaly__attachments-dialog`,children:[(0,J.jsx)(N,{children:(0,J.jsx)(F,{children:v()})}),r===void 0?(0,J.jsx)(`p`,{className:`oc-traces__muted`,children:i()}):r.length===0?(0,J.jsx)(`p`,{className:`oc-traces__muted`,children:y()}):(0,J.jsx)(`div`,{className:`oc-anomaly__attachments`,children:r.map(e=>(0,J.jsxs)(`section`,{className:`oc-anomaly__attachment`,children:[(0,J.jsx)(`h4`,{className:`oc-anomaly__attachment-name`,children:(0,J.jsx)(`code`,{className:`oc-traces__mono`,children:e.name})}),(0,J.jsx)(`pre`,{className:`oc-anomaly__attachment-content`,children:e.content})]},e.name))})]})})]})}function Ve({severity:e}){return(0,J.jsx)(`span`,{className:`oc-anomaly__sev oc-anomaly__sev--${e}`,children:e})}function He({status:e}){return e===`open`?(0,J.jsx)(P,{variant:`destructive`,children:m()}):e===`acknowledged`?(0,J.jsx)(P,{variant:`secondary`,children:o()}):(0,J.jsx)(P,{variant:`outline`,children:s()})}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{$u as r,CP as i,DP as a,EP as o,HX as s,Ju as c,Qu as l,SP as u,TP as d,Xu as f,Yu as p,Zu as m,_P as h,bP as g,gP as _,hP as v,mP as y,pP as b,t as x,vP as S,wP as C,xP as w,yP as T}from"./api-Ca1H8N44.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{$u as r,CP as i,DP as a,EP as o,HX as s,Ju as c,Qu as l,SP as u,TP as d,Xu as f,Yu as p,Zu as m,_P as h,bP as g,gP as _,hP as v,mP as y,pP as b,t as x,vP as S,wP as C,xP as w,yP as T}from"./api-Ca1H8N44.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-Wii4FZxb.js";import{n as ee}from"./TimeRangePicker-BcvPW9JK.js";import{t as z}from"./FilterBar-BrdWP0oO.js";import{t as B}from"./AdvancedFilter-05ypZDMe.js";import{t as V}from"./DataTableShell-BUYroEsA.js";var H=t(e(),1),U=n(),W={kind:`relative`,from:N,to:`now`},G=`__all__`,K=[{value:`action`,label:r()},{value:`realLabel`,label:l()},{value:`targetLabel`,label:m()},{value:`impersonated`,label:f()},{value:`resource`,label:p()},{value:`resourceId`,label:c()}];function q(){let e=j({from:`/settings/audit`}),t=A({from:`/settings/audit`}),n=e.q??``,r=e.action??G,c=e.impersonated??G,l=e.resource??G,f=M(e.from,e.to),p=(0,H.useMemo)(()=>F(e.adv),[e.adv]),{from:m,to:N}=ee(f),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}),$=s(x.admin.listAudit,{filter:{q:n||void 0,from:m,to:N,action:r===G?void 0:r,resource:l===G?void 0:l,impersonated:c===G?void 0:c===`yes`,advanced:p.length>0?p: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||c!==G||l!==G||p.length>0||f.kind!==`relative`||f.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:[a(),` `,(0,U.jsx)(`span`,{className:`oc-filter__window`,children:o()})]}),(0,U.jsxs)(z,{q:n,onQChange:q,searchPlaceholder:d(),timeRange:f,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:C()})}),(0,U.jsxs)(R,{children:[(0,U.jsx)(k,{value:G,children:i()}),te.map(e=>(0,U.jsx)(k,{value:e,children:e},e))]})]}),(0,U.jsxs)(I,{value:c,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:u()}),(0,U.jsx)(k,{value:`yes`,children:w()}),(0,U.jsx)(k,{value:`no`,children:g()})]})]}),(0,U.jsxs)(I,{value:l,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:S()}),ne.map(e=>(0,U.jsx)(k,{value:e,children:e},e))]})]})]}),(0,U.jsx)(B,{fields:K,seed:p,onChange:Q}),(0,U.jsx)(V,{title:h(),rows:$,emptyHint:_(),columns:[{header:v(),cell:e=>E(e.at),sort:e=>e.at},{header:C(),cell:e=>e.action,sort:e=>e.action},{header:y(),cell:e=>e.realLabel,sort:e=>e.realLabel},{header:b(),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,Ak as i,As as a,Bk as o,CA as s,C_ as c,Ck as l,Dk as u,E as d,Ek as f,Fk as p,GO as m,HX as h,Ik as ee,JO as g,KO as _,Lk as te,Mk as ne,Nk as re,Ok as ie,Pk as ae,QO as v,Rk as oe,SA as se,S_ as ce,Sk as le,Su as ue,Tk as de,UO as fe,VX as pe,Vk as me,WO as y,XO as he,YO as ge,ZO as _e,_A as ve,__ as ye,_k as be,_u as xe,ak as Se,bA as Ce,b_ as we,bk as Te,ck as Ee,dk as De,ek as Oe,f_ as ke,fk as Ae,gA as je,g_ as Me,gk as Ne,gu as Pe,hA as Fe,h_ as Ie,hk as Le,hu as Re,ik as ze,jk as Be,kk as Ve,lA as He,lk as Ue,mA as We,m_ as Ge,mk as Ke,nk as qe,o_ as Je,ok as Ye,oo as Xe,pA as Ze,p_ as Qe,pk as $e,qO as et,rk as b,sk as tt,t as x,tk as nt,uA as rt,uk as it,vA as at,v_ as ot,vk as S,vu as st,w_ as ct,wk as lt,x_ as ut,xk as dt,yA as ft,y_ as C,yk as pt,yu as mt,zX as ht,zk as gt}from"./api-Ca1H8N44.js";import{r as w}from"./dist-Bfmsr8JO.js";import{t as _t}from"./chevrons-up-down-DCwhEy5H.js";import{i as vt,n as T,o as yt,r as bt,s as xt}from"./FieldLabel-sEQ38rsG.js";import{t as E}from"./button-BbEZKLza.js";import{$t as D,At as O,Ct as St,Dt as Ct,Jn as wt,Jt as k,L as Tt,Mt as Et,Ot as Dt,Pn as A,St as j,Tt as Ot,Yt as kt,ar as M,at as At,bt as N,cn as jt,dr as P,fr as Mt,ft as Nt,it as Pt,jt as F,kn as I,on as Ft,or as It,ot as Lt,sn as Rt,sr as L,st as zt,vt as R,wt as Bt,xt as z,yt as B}from"./index-bizOs74t.js";import{r as Vt}from"./locales-CPjguROj.js";import{a as Ht,i as V,n as Ut,o as H,r as U,t as Wt}from"./table-BrECCZpB.js";import{t as Gt}from"./FilterBar-PBFn9z0b.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-BDU79WFh.js";import{t as W}from"./dispatchErrorInfo-CoXI4U8X.js";var $t=d(`refresh-cw`,[[`path`,{d:`M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8`,key:`v9h5vc`}],[`path`,{d:`M21 3v5h-5`,key:`1q7to0`}],[`path`,{d:`M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16`,key:`3uifl3`}],[`path`,{d:`M8 16H3v5`,key:`1cv678`}]]),en=d(`wifi-off`,[[`path`,{d:`M12 20h.01`,key:`zekei9`}],[`path`,{d:`M8.5 16.429a5 5 0 0 1 7 0`,key:`1bycff`}],[`path`,{d:`M5 12.859a10 10 0 0 1 5.17-2.69`,key:`1dl1wf`}],[`path`,{d:`M19 12.859a10 10 0 0 0-2.007-1.523`,key:`4k23kn`}],[`path`,{d:`M2 8.82a15 15 0 0 1 4.177-2.643`,key:`1grhjp`}],[`path`,{d:`M22 8.82a15 15 0 0 0-11.288-3.764`,key:`z3jwby`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}]]),G=t(e(),1);function tn(e){return e.filter(e=>e.state===`error`)}function nn(e){return e.reachable&&tn(e.targets).length===0}function rn(e){return nn(e)?(e.unreachableInstances??[]).length>0?`gateways_unreachable`:`ok`:`error`}function an(e){return e.state===`error`&&e.lastErrorCode!==null}function on(e){return!!e.lastDownstreamRejectCode}function sn(e){return!!e.lastLocalRefusalCode}function cn(e){return an(e)||on(e)||sn(e)}function K(e){return e.kind??`openclaw`}function ln(e){return[...e].sort((e,t)=>e===`openclaw`?-1:t===`openclaw`?1:e.localeCompare(t))}function un(e,t,n){let r=new Map;for(let e of t)e.instanceName&&r.set(e.instanceName,e.provider);for(let e of n)r.set(e.name,K(e));let i=e=>(e.instanceName?r.get(e.instanceName):void 0)??`openclaw`,a=new Set;for(let e of n)a.add(K(e));for(let e of t)a.add(e.provider);for(let t of e)a.add(i(t));return ln(a).map(r=>({key:r,connections:e.filter(e=>i(e)===r),compatTargets:t.filter(e=>e.provider===r),instances:n.filter(e=>K(e)===r)}))}function q(e){return e===`openclaw`?`OpenClaw`:e===`hermes`?`Hermes`:e.charAt(0).toUpperCase()+e.slice(1)}var J=`__all__`,dn={q:``,state:J,instance:J,version:J},Y={connected:0,error:1,idle:2};function fn(e){return e.q.trim()!==``||e.state!==`__all__`||e.instance!==`__all__`||e.version!==`__all__`}function pn(e,t){let n=t.q.trim().toLowerCase();return e.filter(e=>!(n&&!`${e.targetLabel} ${e.gatewayHost}`.toLowerCase().includes(n)||t.state!==`__all__`&&e.state!==t.state||t.instance!==`__all__`&&(e.instanceName??``)!==t.instance||t.version!==`__all__`&&(e.gatewayVersion??``)!==t.version))}function X(e,t){return e.localeCompare(t,void 0,{numeric:!0,sensitivity:`base`})}function mn(e,t){return e===`version`?t.gatewayVersion===null:e===`lastOk`?t.lastOkAt===null:!1}function hn(e,t,n){switch(e){case`state`:return(Y[t.state]??99)-(Y[n.state]??99);case`instance`:return X(t.instanceLabel??t.instanceName??``,n.instanceLabel??n.instanceName??``);case`host`:return X(t.gatewayHost,n.gatewayHost);case`version`:{let e=t.gatewayVersion,r=n.gatewayVersion;return Zt(e,r)??X(e,r)}case`lastOk`:return t.lastOkAt-n.lastOkAt;default:return X(t.targetLabel,n.targetLabel)}}function gn(e,t){if(!t)return e;let n=t.dir===`asc`?1:-1;return[...e].sort((e,r)=>{let i=mn(t.key,e),a=mn(t.key,r);return i&&a?0:i?1:a?-1:n*hn(t.key,e,r)})}function _n(e){let t=new Set;for(let n of e)t.add(n.state);return[...t].sort((e,t)=>(Y[e]??99)-(Y[t]??99))}function vn(e){let t=new Map;for(let n of e)n.instanceName!==null&&(t.has(n.instanceName)||t.set(n.instanceName,n.instanceLabel??n.instanceName));return[...t.entries()].map(([e,t])=>({name:e,label:t})).sort((e,t)=>X(e.label,t.label))}function yn(e){let t=new Set;for(let n of e)n.gatewayVersion!==null&&t.add(n.gatewayVersion);return[...t].sort((e,t)=>Zt(e,t)??X(e,t))}var Z=n();function bn({connections:e,displayByInstance:t}){let[n,i]=(0,G.useState)(dn),[a,o]=(0,G.useState)(null),s=(0,G.useMemo)(()=>e.map((e,n)=>({_id:`${e.key}:${e.canonical}/${e.agentId}:${n}`,targetLabel:`${e.canonical}/${e.agentId}`,state:e.state,instanceName:e.instanceName??null,instanceLabel:e.instanceName?t.get(e.instanceName)??e.instanceName:null,gatewayHost:e.gatewayHost,gatewayVersion:e.gatewayVersion??null,okCount:e.okCount,errorCount:e.errorCount+(e.downstreamRejectCount??0)+(e.localRefusalCount??0),attempts:e.attempts,lastOkAt:e.lastOkAt??null,lastErrorCode:e.lastErrorCode??null,lastErrorAt:e.lastErrorAt??null,lastDownstreamRejectCode:e.lastDownstreamRejectCode??null,lastDownstreamRejectAt:e.lastDownstreamRejectAt??null,lastLocalRefusalCode:e.lastLocalRefusalCode??null,lastLocalRefusalAt:e.lastLocalRefusalAt??null})),[e,t]),c=(0,G.useMemo)(()=>_n(s),[s]),l=(0,G.useMemo)(()=>vn(s),[s]),u=(0,G.useMemo)(()=>yn(s),[s]),d=(0,G.useMemo)(()=>gn(pn(s,n),a),[s,n,a]);function f(e){o(t=>t?.key===e?t.dir===`asc`?{key:e,dir:`desc`}:null:{key:e,dir:`asc`})}return e.length===0?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:tt()}):(0,Z.jsxs)(`div`,{className:`oc-conn`,children:[(0,Z.jsxs)(Gt,{q:n.q,onQChange:e=>i(t=>({...t,q:e})),searchPlaceholder:ze(),onReset:()=>i(dn),canReset:fn(n),children:[(0,Z.jsxs)(R,{value:n.state,onValueChange:e=>i(t=>({...t,state:e})),children:[(0,Z.jsx)(z,{size:`sm`,className:`w-36`,children:(0,Z.jsx)(j,{placeholder:qe()})}),(0,Z.jsxs)(B,{children:[(0,Z.jsx)(N,{value:J,children:b()}),c.map(e=>(0,Z.jsx)(N,{value:e,children:Sn(e)},e))]})]}),(0,Z.jsxs)(R,{value:n.instance,onValueChange:e=>i(t=>({...t,instance:e})),children:[(0,Z.jsx)(z,{size:`sm`,className:`w-40`,children:(0,Z.jsx)(j,{placeholder:nt()})}),(0,Z.jsxs)(B,{children:[(0,Z.jsx)(N,{value:J,children:b()}),l.map(e=>(0,Z.jsx)(N,{value:e.name,children:e.label},e.name))]})]}),(0,Z.jsxs)(R,{value:n.version,onValueChange:e=>i(t=>({...t,version:e})),children:[(0,Z.jsx)(z,{size:`sm`,className:`w-36`,children:(0,Z.jsx)(j,{placeholder:Oe()})}),(0,Z.jsxs)(B,{children:[(0,Z.jsx)(N,{value:J,children:b()}),u.map(e=>(0,Z.jsx)(N,{value:e,children:e},e))]})]})]}),d.length===0?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:r()}):(0,Z.jsxs)(Wt,{className:`oc-conn__table`,children:[(0,Z.jsx)(Ht,{children:(0,Z.jsxs)(H,{children:[(0,Z.jsx)(Q,{label:v(),sortKey:`target`,sort:a,onSort:f}),(0,Z.jsx)(Q,{label:_e(),sortKey:`state`,sort:a,onSort:f}),(0,Z.jsx)(Q,{label:he(),sortKey:`instance`,sort:a,onSort:f}),(0,Z.jsx)(Q,{label:ge(),sortKey:`host`,sort:a,onSort:f}),(0,Z.jsx)(Q,{label:g(),sortKey:`version`,sort:a,onSort:f}),(0,Z.jsx)(V,{children:et()}),(0,Z.jsx)(Q,{label:_(),sortKey:`lastOk`,sort:a,onSort:f})]})}),(0,Z.jsx)(Ut,{children:d.map(e=>(0,Z.jsx)(xn,{r:e},e._id))})]})]})}function Q({label:e,sortKey:t,sort:n,onSort:r}){let i=n?.key===t,a=i?n.dir:null;return(0,Z.jsx)(V,{"aria-sort":i?a===`asc`?`ascending`:`descending`:`none`,children:(0,Z.jsxs)(`button`,{type:`button`,className:`oc-conn__sort`,onClick:()=>r(t),children:[e,i?a===`asc`?(0,Z.jsx)(It,{size:13,"aria-hidden":!0}):(0,Z.jsx)(w,{size:13,"aria-hidden":!0}):(0,Z.jsx)(_t,{size:13,"aria-hidden":!0,className:`oc-conn__sort-idle`})]})})}function xn({r:e}){let t=an(e)?W(e.lastErrorCode):null,n=on(e)?W(e.lastDownstreamRejectCode):null,r=sn(e)?W(e.lastLocalRefusalCode):null;return(0,Z.jsxs)(G.Fragment,{children:[(0,Z.jsxs)(H,{className:`oc-conn__row oc-conn__row--${e.state}`,children:[(0,Z.jsx)(U,{children:(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:e.targetLabel})}),(0,Z.jsx)(U,{children:(0,Z.jsx)(Cn,{state:e.state})}),(0,Z.jsx)(U,{children:e.instanceLabel?(0,Z.jsx)(`span`,{className:`oc-bridge-target__instance`,children:e.instanceLabel}):(0,Z.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})}),(0,Z.jsx)(U,{children:(0,Z.jsx)(`span`,{className:`oc-bridge-target__host`,children:e.gatewayHost})}),(0,Z.jsx)(U,{children:e.gatewayVersion?(0,Z.jsx)(`span`,{className:`oc-bridge-target__version`,children:e.gatewayVersion}):(0,Z.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})}),(0,Z.jsx)(U,{children:(0,Z.jsx)(`span`,{className:`oc-conn__stats`,children:Ye({ok:e.okCount,errors:e.errorCount,attempts:e.attempts})})}),(0,Z.jsx)(U,{children:e.lastOkAt?(0,Z.jsx)(`span`,{className:`oc-traces__mono`,children:F(e.lastOkAt)}):(0,Z.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})})]}),cn(e)?(0,Z.jsx)(H,{className:`oc-conn__detail-row`,children:(0,Z.jsxs)(U,{colSpan:7,className:`oc-conn__detail-cell`,children:[t?(0,Z.jsxs)(`div`,{className:`oc-bridge-target__error`,children:[(0,Z.jsx)(`strong`,{children:t.label}),` `,(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:e.lastErrorCode}),e.lastErrorAt?` · ${F(e.lastErrorAt)}`:``,(0,Z.jsx)(`p`,{className:`oc-bridge-card__hint`,children:t.hint})]}):null,r?(0,Z.jsxs)(`div`,{className:`oc-bridge-target__downstream`,children:[Xe({label:r.label}),` `,(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:e.lastLocalRefusalCode}),e.lastLocalRefusalAt?` · ${F(e.lastLocalRefusalAt)}`:``,(0,Z.jsx)(`p`,{className:`oc-bridge-card__hint`,children:r.hint})]}):null,n?(0,Z.jsxs)(`div`,{className:`oc-bridge-target__downstream`,children:[Se({label:n.label}),` `,(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:e.lastDownstreamRejectCode}),e.lastDownstreamRejectAt?` · ${F(e.lastDownstreamRejectAt)}`:``]}):null]})}):null]})}function Sn(e){return e===`connected`?m():e===`error`?y():fe()}function Cn({state:e}){return e===`connected`?(0,Z.jsx)(k,{variant:`secondary`,children:m()}):e===`error`?(0,Z.jsx)(k,{variant:`destructive`,children:y()}):(0,Z.jsx)(k,{variant:`outline`,children:fe()})}function wn(){return h(x.bridgeHealth.getBridgeHealth,{})}function Tn(){let e=wn(),t=h(x.compat.getBridgeCompat,{}),n=h(x.me.getMe,{host:Nt})?.role===`admin`,r=h(x.admin.listInstances,n?{}:`skip`),i=h(x.agents.usageForInstances,n?{}:`skip`),a=P(),o=()=>void a({to:`/settings/anomalies`,search:{status:`open`}}),s=un(e?e.targets:[],t?t.targets:[],r??[]),{section:c}=Mt({from:`/settings/bridge`}),l=P({from:`/settings/bridge`}),d=t?.compat??null,p=t===void 0?`loading`:t===null?`nodata`:`ready`,m=d!==null&&Xt(d,`hermes`)&&!s.some(e=>e.key===`hermes`);return(0,Z.jsxs)(`div`,{className:`oc-bridge`,children:[(0,Z.jsx)(En,{health:e,compat:t,onSeeAnomalies:o}),(0,Z.jsx)(`p`,{className:`oc-admin__hint oc-bridge__caption`,children:u()}),i&&i.length>0?(0,Z.jsxs)(`section`,{className:`oc-bridge__usage`,children:[(0,Z.jsx)(`h3`,{className:`oc-bridge__usage-title`,children:f()}),(0,Z.jsxs)(Wt,{children:[(0,Z.jsx)(Ht,{children:(0,Z.jsxs)(H,{children:[(0,Z.jsx)(V,{children:mt()}),(0,Z.jsx)(V,{children:st()}),(0,Z.jsx)(V,{children:xe()}),(0,Z.jsx)(V,{children:Pe()}),(0,Z.jsx)(V,{children:Re()})]})}),(0,Z.jsx)(Ut,{children:i.flatMap(e=>{let t=Tt(e.usage,Date.now());return t?t.windows.map((t,n)=>(0,Z.jsxs)(H,{children:[(0,Z.jsx)(U,{className:`font-medium`,children:n===0?e.instanceName:``}),(0,Z.jsx)(U,{children:t.provider}),(0,Z.jsx)(U,{children:t.label}),(0,Z.jsx)(U,{children:(0,Z.jsxs)(k,{variant:t.percentLeft<=10?`destructive`:t.percentLeft<=25?`outline`:`secondary`,children:[t.percentLeft,`%`]})}),(0,Z.jsx)(U,{className:`text-muted-foreground`,children:t.resetText??`—`})]},`${e.instanceName}:${t.provider}:${t.label}`)):[]})})]})]}):null,s.length>0?(0,Z.jsxs)(Pt,{value:s.some(e=>e.key===c)?c:s[0]?.key??`openclaw`,onValueChange:e=>void l({search:{section:e},replace:!0}),children:[(0,Z.jsx)(Lt,{className:`w-full`,children:s.map(e=>(0,Z.jsxs)(zt,{value:e.key,className:`flex-1 gap-1.5`,children:[(0,Z.jsx)(A,{size:13,"aria-hidden":!0}),q(e.key)]},e.key))}),s.map(e=>(0,Z.jsx)(At,{value:e.key,children:(0,Z.jsx)(Dn,{providerKey:e.key,connections:e.connections,instances:e.instances,manifest:d,compatStatus:p,compatReachable:t?.reachable??!0,protocol:e.key===`openclaw`?t?.protocol??null:null})},e.key))]}):null,m?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:Je()}):null]})}function En({health:e,compat:t,onSeeAnomalies:n}){let r=t!=null&&t.buildVersion!=null&&t.bridgeVersion!=null&&t.buildVersion!==t.bridgeVersion,i=t?.buildRevision&&t.buildRevision!==`unknown`?t.buildRevision.slice(0,7):null,a=t&&t!==null?(0,Z.jsxs)(`span`,{className:`oc-bridge-card__ver`,children:[(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:Yt(t.bridgeVersion)}),i?(0,Z.jsxs)(Z.Fragment,{children:[` `,(0,Z.jsxs)(`code`,{className:`oc-traces__mono`,title:ce(),children:[`(`,i,`)`]})]}):null,r?(0,Z.jsxs)(`strong`,{className:`oc-bridge-card__mismatch`,children:[` `,ut({build:t.buildVersion??`?`})]}):null,` · `,we(),` `,(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:t.protocolVersion===null?C():String(t.protocolVersion)})]}):null;if(e===void 0)return(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:S()});if(e===null)return(0,Z.jsx)(`div`,{className:`oc-bridge-card oc-bridge-card--idle`,children:be()});let o=tn(e.targets),s=!e.reachable,c=rn(e),l=e.unreachableInstances??[],u=c===`ok`?`ok`:c===`gateways_unreachable`?`warn`:`error`,d=O(e.checkedAt),f=e.startedAt==null?null:O(e.startedAt);return(0,Z.jsxs)(`div`,{className:`oc-bridge-card oc-bridge-card--${u}`,children:[(0,Z.jsx)(`div`,{className:`oc-bridge-card__icon`,"aria-hidden":!0,children:c===`ok`?(0,Z.jsx)(M,{size:22}):s||c===`gateways_unreachable`?(0,Z.jsx)(en,{size:22}):(0,Z.jsx)(I,{size:22})}),(0,Z.jsxs)(`div`,{className:`oc-bridge-card__body`,children:[(0,Z.jsx)(`div`,{className:`oc-bridge-card__title`,children:c===`ok`?Ne():c===`gateways_unreachable`?Ae({count:l.length}):s?Le():Ke({count:o.length})}),(0,Z.jsxs)(`div`,{className:`oc-bridge-card__meta`,children:[(0,Z.jsxs)(`span`,{children:[(0,Z.jsx)($t,{size:12,"aria-hidden":!0}),` `,$e({time:d})]}),f?(0,Z.jsx)(`span`,{children:it({time:f})}):null,a]}),c===`gateways_unreachable`?(0,Z.jsx)(`p`,{className:`oc-bridge-card__hint`,children:De({names:l.join(`, `)})}):null,s?(0,Z.jsx)(`p`,{className:`oc-bridge-card__hint`,children:W(e.lastError===`not_configured`?`NOT_CONFIGURED`:`BRIDGE_UNREACHABLE`).hint}):null]}),(0,Z.jsx)(`button`,{type:`button`,className:`oc-bridgebar__drill`,onClick:n,children:Ue()})]})}function Dn({providerKey:e,connections:t,instances:n,manifest:r,compatStatus:i,compatReachable:a,protocol:o}){let s=r?Kt(r,e):null,c=new Map;for(let e of n)c.set(e.name,e.displayName??e.name);let l=[],u=new Set;for(let n of t){if(!n.instanceName||u.has(n.instanceName))continue;u.add(n.instanceName);let t=n.gatewayVersion??null;l.push({instanceName:n.instanceName,displayName:c.get(n.instanceName)??n.instanceName,version:t,state:Jt(t,e,r)})}let d=Qt(l.map(e=>e.state)),[f,p]=(0,G.useState)(!1);return(0,Z.jsxs)(`section`,{className:`oc-bridge-provider`,children:[(0,Z.jsxs)(`header`,{className:`oc-bridge-provider__head`,children:[(0,Z.jsx)(A,{size:15,"aria-hidden":!0,className:`oc-bridge-provider__icon`}),(0,Z.jsx)(`span`,{className:`oc-bridge-provider__name`,children:q(e)}),d?(0,Z.jsx)(k,{variant:d===`beyond`||d===`defective`||d===`unsupported`?`destructive`:`secondary`,children:qt(d)}):null]}),(0,Z.jsx)(`h4`,{className:`oc-bridge-provider__sub`,children:ct()}),(0,Z.jsx)(kn,{providerName:q(e),support:s,compatStatus:i,compatReachable:a,manifest:r,instanceRows:l}),o?(0,Z.jsx)(On,{protocol:o}):null,(0,Z.jsxs)(`button`,{type:`button`,className:`oc-bridge-provider__sub oc-bridge-provider__sub--toggle`,"aria-expanded":f,onClick:()=>p(e=>!e),children:[f?(0,Z.jsx)(w,{size:13,"aria-hidden":!0}):(0,Z.jsx)(L,{size:13,"aria-hidden":!0}),Ee({count:t.length})]}),f?(0,Z.jsx)(bn,{connections:t,displayByInstance:c}):null]})}function On({protocol:e}){let[t,n]=(0,G.useState)(!1),r=e.coverage,i=e.drift??[],o=(e.driftOverflow??0)+(e.driftTruncated??0);return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`h4`,{className:`oc-bridge-provider__sub`,children:[de(),i.length>0?(0,Z.jsx)(k,{variant:`destructive`,children:l({count:i.length})}):o>0?(0,Z.jsx)(k,{variant:`destructive`,children:le()}):(0,Z.jsx)(k,{variant:`secondary`,children:lt()})]}),(0,Z.jsxs)(`p`,{className:`oc-admin__hint`,children:[dt({version:e.vendoredVersion}),r?` · `+Te({handled:r.handled,ignored:r.ignored,gaps:r.gaps}):null]}),o>0?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:a({overflow:e.driftOverflow??0,truncated:e.driftTruncated??0})}):null,i.length>0?(0,Z.jsx)(`ul`,{className:`oc-bridge-protocol__list`,role:`list`,children:i.map(e=>(0,Z.jsxs)(`li`,{children:[(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:e.shape}),` × `,e.count]},e.shape))}):null,r&&r.gapList.length>0?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`button`,{type:`button`,className:`oc-bridge-provider__sub oc-bridge-provider__sub--toggle`,"aria-expanded":t,onClick:()=>n(e=>!e),children:[t?(0,Z.jsx)(w,{size:13,"aria-hidden":!0}):(0,Z.jsx)(L,{size:13,"aria-hidden":!0}),pt({count:r.gapList.length})]}),t?(0,Z.jsx)(`ul`,{className:`oc-bridge-protocol__list`,role:`list`,children:r.gapList.map(e=>(0,Z.jsx)(`li`,{children:(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:e})},e))}):null]}):null]})}function kn({support:e,compatStatus:t,compatReachable:n,manifest:r,instanceRows:i,providerName:a}){return t===`loading`?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:S()}):t===`nodata`?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:c()}):(0,Z.jsxs)(`div`,{className:`oc-compat`,children:[n?null:(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:ot()}),r===null?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:ye()}):(0,Z.jsxs)(`div`,{className:`oc-compat__support`,children:[(0,Z.jsx)(`span`,{className:`oc-compat__label`,children:ue({provider:a})}),e&&e.range!==null?(0,Z.jsx)(`span`,{children:Me({min:e.range.min,max:e.range.maxValidated})}):(0,Z.jsx)(`span`,{children:C()}),e?(0,Z.jsx)(Mn,{versions:e.validatedVersions}):null]}),i.length===0?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:ke()}):(0,Z.jsx)(`div`,{className:`oc-compat__targets`,children:i.map(e=>(0,Z.jsxs)(`div`,{className:`oc-compat__target`,children:[(0,Z.jsx)(`span`,{className:`oc-compat__instance`,children:e.displayName}),(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:Yt(e.version)}),(0,Z.jsx)(k,{variant:e.state===`supported`?`secondary`:e.state===`beyond`||e.state===`defective`||e.state===`unsupported`?`destructive`:`outline`,children:qt(e.state)})]},e.instanceName))})]})}function An({instance:e,onClose:t}){return(0,Z.jsx)(St,{open:!0,onOpenChange:e=>!e&&t(),children:(0,Z.jsxs)(Bt,{className:`oc-bridge-config-dialog`,onOpenAutoFocus:e=>e.preventDefault(),children:[(0,Z.jsxs)(Ct,{children:[(0,Z.jsx)(Dt,{children:s({instance:e.displayName??e.name})}),(0,Z.jsx)(Ot,{children:se()})]}),(0,Z.jsx)(jn,{instance:e,onClose:t})]})})}function $({label:e,result:t}){return t?t.checked?(0,Z.jsxs)(`p`,{className:`oc-bridge-config__check-row `+(t.ok?`oc-bridge-config__check-row--ok`:`oc-bridge-config__check-row--err`),children:[t.ok?(0,Z.jsx)(M,{"aria-hidden":!0}):(0,Z.jsx)(I,{"aria-hidden":!0}),(0,Z.jsxs)(`span`,{children:[e,` — `,t.ok?Be():t.detail]})]}):(0,Z.jsxs)(`p`,{className:`oc-bridge-config__check-row oc-bridge-config__check-row--skip`,children:[e,` — `,i()]}):null}function jn({instance:e,onClose:t}){let n=pe(x.admin.upsertInstanceConfig),r=ht(x.bridge.validateMediaPaths),i=kt(),a=Vt(e.config?.contentLocale,void 0),[s,c]=(0,G.useState)(()=>vt(e.config??{},a)),[l,u]=(0,G.useState)(!1),[d,f]=(0,G.useState)(!1),[m,h]=(0,G.useState)(null),g=s.inboundMediaMode===`shared-fs`,_=s.mediaMode===`shared-fs`,v=g||_;async function se(){f(!0),h(null);try{h(await r({instanceName:e.name,inboundMediaMode:s.inboundMediaMode,mediaMode:s.mediaMode}))}catch(e){i.error(p(),e)}finally{f(!1)}}async function ce(){u(!0);try{let r=e.config??{};await n({instanceId:e._id,config:bt(s,r,a)}),t()}catch(e){i.error(Fe(),e)}finally{u(!1)}}return(0,Z.jsx)(`div`,{className:`oc-bridge-config`,children:(0,Z.jsxs)(`div`,{className:`oc-bridge-config__form`,children:[(0,Z.jsxs)(`div`,{className:`oc-bridge-config__grid`,children:[(0,Z.jsxs)(`label`,{className:`oc-field`,children:[(0,Z.jsx)(T,{label:Ce(),help:We()}),(0,Z.jsxs)(R,{value:s.mediaMode,onValueChange:e=>c({...s,mediaMode:e}),children:[(0,Z.jsx)(z,{size:`sm`,className:`w-full`,children:(0,Z.jsx)(j,{})}),(0,Z.jsx)(B,{children:xt.map(e=>(0,Z.jsx)(N,{value:e,children:e},e))})]})]}),(0,Z.jsxs)(`label`,{className:`oc-field`,children:[(0,Z.jsx)(T,{label:ft(),help:Ze()}),(0,Z.jsxs)(R,{value:s.inboundMediaMode,onValueChange:e=>c({...s,inboundMediaMode:e}),children:[(0,Z.jsx)(z,{size:`sm`,className:`w-full`,children:(0,Z.jsx)(j,{})}),(0,Z.jsx)(B,{children:yt.map(e=>(0,Z.jsx)(N,{value:e,children:e},e))})]})]}),(0,Z.jsxs)(`label`,{className:`oc-field`,children:[(0,Z.jsx)(T,{label:at(),help:rt()}),(0,Z.jsx)(D,{type:`number`,min:1,max:4096,className:`w-full`,value:s.mediaMaxMb,onChange:e=>c({...s,mediaMaxMb:Math.trunc(Number(e.target.value)||0)})})]})]}),v&&(0,Z.jsxs)(`div`,{className:`oc-bridge-config__grid`,children:[g&&(0,Z.jsxs)(`label`,{className:`oc-field`,children:[(0,Z.jsx)(T,{label:me(),help:o()}),(0,Z.jsx)(D,{className:`w-full`,spellCheck:!1,value:s.inboundAgentMount,onChange:e=>c({...s,inboundAgentMount:e.target.value})})]}),_&&(0,Z.jsxs)(`label`,{className:`oc-field`,children:[(0,Z.jsx)(T,{label:gt(),help:oe()}),(0,Z.jsx)(D,{className:`w-full`,spellCheck:!1,value:s.outboundAgentMount,onChange:e=>c({...s,outboundAgentMount:e.target.value})})]})]}),(0,Z.jsxs)(`label`,{className:`oc-field--row`,children:[(0,Z.jsx)(Et,{checked:s.rehydration,onCheckedChange:e=>c({...s,rehydration:e===!0})}),(0,Z.jsx)(T,{label:ve(),help:He()})]}),v&&m!==null&&(0,Z.jsx)(`div`,{className:`oc-bridge-config__check`,children:m.reachable?!m.inbound&&!m.outbound?(0,Z.jsxs)(`p`,{className:`oc-bridge-config__check-row oc-bridge-config__check-row--err`,children:[(0,Z.jsx)(I,{"aria-hidden":!0}),ie({reason:m.reason??`?`})]}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)($,{label:re(),result:m.inbound}),(0,Z.jsx)($,{label:ne(),result:m.outbound}),(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:ae()})]}):(0,Z.jsxs)(`p`,{className:`oc-bridge-config__check-row oc-bridge-config__check-row--err`,children:[(0,Z.jsx)(I,{"aria-hidden":!0}),Ve()]})}),(0,Z.jsxs)(`div`,{className:`oc-bridge-config__actions`,children:[v&&(0,Z.jsxs)(E,{variant:`outline`,size:`sm`,onClick:()=>void se(),disabled:d,children:[d?(0,Z.jsx)(wt,{className:`size-4 animate-spin`,"aria-hidden":!0}):null,d?ee():te()]}),(0,Z.jsx)(E,{size:`sm`,onClick:()=>void ce(),disabled:l,children:je()})]})]})})}function Mn({versions:e}){if(e.length===0)return null;let t=[...e].reverse();return(0,Z.jsxs)(Ft,{children:[(0,Z.jsx)(jt,{asChild:!0,children:(0,Z.jsxs)(`button`,{type:`button`,className:`oc-compat__versions-btn`,children:[e.length===1?Ie():Ge({count:e.length}),(0,Z.jsx)(w,{size:13,"aria-hidden":!0})]})}),(0,Z.jsxs)(Rt,{className:`oc-compat__versions-pop`,align:`start`,children:[(0,Z.jsx)(`p`,{className:`oc-compat__versions-title`,children:Qe()}),(0,Z.jsx)(`div`,{className:`oc-compat__versions-list`,children:t.map(e=>(0,Z.jsx)(k,{variant:`secondary`,children:e},e))})]})]})}export{Tn as BridgeTab,An as InstanceConfigDialog};
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$O as r,Ak as i,As as a,Bk as o,CA as s,C_ as c,Ck as l,Dk as u,E as d,Ek as f,Fk as p,GO as m,HX as h,Ik as ee,JO as g,KO as _,Lk as te,Mk as ne,Nk as re,Ok as ie,Pk as ae,QO as v,Rk as oe,SA as se,S_ as ce,Sk as le,Su as ue,Tk as de,UO as fe,VX as pe,Vk as me,WO as y,XO as he,YO as ge,ZO as _e,_A as ve,__ as ye,_k as be,_u as xe,ak as Se,bA as Ce,b_ as we,bk as Te,ck as Ee,dk as De,ek as Oe,f_ as ke,fk as Ae,gA as je,g_ as Me,gk as Ne,gu as Pe,hA as Fe,h_ as Ie,hk as Le,hu as Re,ik as ze,jk as Be,kk as Ve,lA as He,lk as Ue,mA as We,m_ as Ge,mk as Ke,nk as qe,o_ as Je,ok as Ye,oo as Xe,pA as Ze,p_ as Qe,pk as $e,qO as et,rk as b,sk as tt,t as x,tk as nt,uA as rt,uk as it,vA as at,v_ as ot,vk as S,vu as st,w_ as ct,wk as lt,x_ as ut,xk as dt,yA as ft,y_ as C,yk as pt,yu as mt,zX as ht,zk as gt}from"./api-Ca1H8N44.js";import{r as w}from"./dist-Bfmsr8JO.js";import{t as _t}from"./chevrons-up-down-DCwhEy5H.js";import{i as vt,n as T,o as yt,r as bt,s as xt}from"./FieldLabel-BP6EBGVI.js";import{t as E}from"./button-BbEZKLza.js";import{$t as D,At as O,Ct as St,Dt as Ct,Jn as wt,Jt as k,L as Tt,Mt as Et,Ot as Dt,Pn as A,St as j,Tt as Ot,Yt as kt,ar as M,at as At,bt as N,cn as jt,dr as P,fr as Mt,ft as Nt,it as Pt,jt as F,kn as I,on as Ft,or as It,ot as Lt,sn as Rt,sr as L,st as zt,vt as R,wt as Bt,xt as z,yt as B}from"./index-Wii4FZxb.js";import{r as Vt}from"./locales-CPjguROj.js";import{a as Ht,i as V,n as Ut,o as H,r as U,t as Wt}from"./table-BrECCZpB.js";import{t as Gt}from"./FilterBar-BrdWP0oO.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-BDU79WFh.js";import{t as W}from"./dispatchErrorInfo-CoXI4U8X.js";var $t=d(`refresh-cw`,[[`path`,{d:`M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8`,key:`v9h5vc`}],[`path`,{d:`M21 3v5h-5`,key:`1q7to0`}],[`path`,{d:`M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16`,key:`3uifl3`}],[`path`,{d:`M8 16H3v5`,key:`1cv678`}]]),en=d(`wifi-off`,[[`path`,{d:`M12 20h.01`,key:`zekei9`}],[`path`,{d:`M8.5 16.429a5 5 0 0 1 7 0`,key:`1bycff`}],[`path`,{d:`M5 12.859a10 10 0 0 1 5.17-2.69`,key:`1dl1wf`}],[`path`,{d:`M19 12.859a10 10 0 0 0-2.007-1.523`,key:`4k23kn`}],[`path`,{d:`M2 8.82a15 15 0 0 1 4.177-2.643`,key:`1grhjp`}],[`path`,{d:`M22 8.82a15 15 0 0 0-11.288-3.764`,key:`z3jwby`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}]]),G=t(e(),1);function tn(e){return e.filter(e=>e.state===`error`)}function nn(e){return e.reachable&&tn(e.targets).length===0}function rn(e){return nn(e)?(e.unreachableInstances??[]).length>0?`gateways_unreachable`:`ok`:`error`}function an(e){return e.state===`error`&&e.lastErrorCode!==null}function on(e){return!!e.lastDownstreamRejectCode}function sn(e){return!!e.lastLocalRefusalCode}function cn(e){return an(e)||on(e)||sn(e)}function K(e){return e.kind??`openclaw`}function ln(e){return[...e].sort((e,t)=>e===`openclaw`?-1:t===`openclaw`?1:e.localeCompare(t))}function un(e,t,n){let r=new Map;for(let e of t)e.instanceName&&r.set(e.instanceName,e.provider);for(let e of n)r.set(e.name,K(e));let i=e=>(e.instanceName?r.get(e.instanceName):void 0)??`openclaw`,a=new Set;for(let e of n)a.add(K(e));for(let e of t)a.add(e.provider);for(let t of e)a.add(i(t));return ln(a).map(r=>({key:r,connections:e.filter(e=>i(e)===r),compatTargets:t.filter(e=>e.provider===r),instances:n.filter(e=>K(e)===r)}))}function q(e){return e===`openclaw`?`OpenClaw`:e===`hermes`?`Hermes`:e.charAt(0).toUpperCase()+e.slice(1)}var J=`__all__`,dn={q:``,state:J,instance:J,version:J},Y={connected:0,error:1,idle:2};function fn(e){return e.q.trim()!==``||e.state!==`__all__`||e.instance!==`__all__`||e.version!==`__all__`}function pn(e,t){let n=t.q.trim().toLowerCase();return e.filter(e=>!(n&&!`${e.targetLabel} ${e.gatewayHost}`.toLowerCase().includes(n)||t.state!==`__all__`&&e.state!==t.state||t.instance!==`__all__`&&(e.instanceName??``)!==t.instance||t.version!==`__all__`&&(e.gatewayVersion??``)!==t.version))}function X(e,t){return e.localeCompare(t,void 0,{numeric:!0,sensitivity:`base`})}function mn(e,t){return e===`version`?t.gatewayVersion===null:e===`lastOk`?t.lastOkAt===null:!1}function hn(e,t,n){switch(e){case`state`:return(Y[t.state]??99)-(Y[n.state]??99);case`instance`:return X(t.instanceLabel??t.instanceName??``,n.instanceLabel??n.instanceName??``);case`host`:return X(t.gatewayHost,n.gatewayHost);case`version`:{let e=t.gatewayVersion,r=n.gatewayVersion;return Zt(e,r)??X(e,r)}case`lastOk`:return t.lastOkAt-n.lastOkAt;default:return X(t.targetLabel,n.targetLabel)}}function gn(e,t){if(!t)return e;let n=t.dir===`asc`?1:-1;return[...e].sort((e,r)=>{let i=mn(t.key,e),a=mn(t.key,r);return i&&a?0:i?1:a?-1:n*hn(t.key,e,r)})}function _n(e){let t=new Set;for(let n of e)t.add(n.state);return[...t].sort((e,t)=>(Y[e]??99)-(Y[t]??99))}function vn(e){let t=new Map;for(let n of e)n.instanceName!==null&&(t.has(n.instanceName)||t.set(n.instanceName,n.instanceLabel??n.instanceName));return[...t.entries()].map(([e,t])=>({name:e,label:t})).sort((e,t)=>X(e.label,t.label))}function yn(e){let t=new Set;for(let n of e)n.gatewayVersion!==null&&t.add(n.gatewayVersion);return[...t].sort((e,t)=>Zt(e,t)??X(e,t))}var Z=n();function bn({connections:e,displayByInstance:t}){let[n,i]=(0,G.useState)(dn),[a,o]=(0,G.useState)(null),s=(0,G.useMemo)(()=>e.map((e,n)=>({_id:`${e.key}:${e.canonical}/${e.agentId}:${n}`,targetLabel:`${e.canonical}/${e.agentId}`,state:e.state,instanceName:e.instanceName??null,instanceLabel:e.instanceName?t.get(e.instanceName)??e.instanceName:null,gatewayHost:e.gatewayHost,gatewayVersion:e.gatewayVersion??null,okCount:e.okCount,errorCount:e.errorCount+(e.downstreamRejectCount??0)+(e.localRefusalCount??0),attempts:e.attempts,lastOkAt:e.lastOkAt??null,lastErrorCode:e.lastErrorCode??null,lastErrorAt:e.lastErrorAt??null,lastDownstreamRejectCode:e.lastDownstreamRejectCode??null,lastDownstreamRejectAt:e.lastDownstreamRejectAt??null,lastLocalRefusalCode:e.lastLocalRefusalCode??null,lastLocalRefusalAt:e.lastLocalRefusalAt??null})),[e,t]),c=(0,G.useMemo)(()=>_n(s),[s]),l=(0,G.useMemo)(()=>vn(s),[s]),u=(0,G.useMemo)(()=>yn(s),[s]),d=(0,G.useMemo)(()=>gn(pn(s,n),a),[s,n,a]);function f(e){o(t=>t?.key===e?t.dir===`asc`?{key:e,dir:`desc`}:null:{key:e,dir:`asc`})}return e.length===0?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:tt()}):(0,Z.jsxs)(`div`,{className:`oc-conn`,children:[(0,Z.jsxs)(Gt,{q:n.q,onQChange:e=>i(t=>({...t,q:e})),searchPlaceholder:ze(),onReset:()=>i(dn),canReset:fn(n),children:[(0,Z.jsxs)(R,{value:n.state,onValueChange:e=>i(t=>({...t,state:e})),children:[(0,Z.jsx)(z,{size:`sm`,className:`w-36`,children:(0,Z.jsx)(j,{placeholder:qe()})}),(0,Z.jsxs)(B,{children:[(0,Z.jsx)(N,{value:J,children:b()}),c.map(e=>(0,Z.jsx)(N,{value:e,children:Sn(e)},e))]})]}),(0,Z.jsxs)(R,{value:n.instance,onValueChange:e=>i(t=>({...t,instance:e})),children:[(0,Z.jsx)(z,{size:`sm`,className:`w-40`,children:(0,Z.jsx)(j,{placeholder:nt()})}),(0,Z.jsxs)(B,{children:[(0,Z.jsx)(N,{value:J,children:b()}),l.map(e=>(0,Z.jsx)(N,{value:e.name,children:e.label},e.name))]})]}),(0,Z.jsxs)(R,{value:n.version,onValueChange:e=>i(t=>({...t,version:e})),children:[(0,Z.jsx)(z,{size:`sm`,className:`w-36`,children:(0,Z.jsx)(j,{placeholder:Oe()})}),(0,Z.jsxs)(B,{children:[(0,Z.jsx)(N,{value:J,children:b()}),u.map(e=>(0,Z.jsx)(N,{value:e,children:e},e))]})]})]}),d.length===0?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:r()}):(0,Z.jsxs)(Wt,{className:`oc-conn__table`,children:[(0,Z.jsx)(Ht,{children:(0,Z.jsxs)(H,{children:[(0,Z.jsx)(Q,{label:v(),sortKey:`target`,sort:a,onSort:f}),(0,Z.jsx)(Q,{label:_e(),sortKey:`state`,sort:a,onSort:f}),(0,Z.jsx)(Q,{label:he(),sortKey:`instance`,sort:a,onSort:f}),(0,Z.jsx)(Q,{label:ge(),sortKey:`host`,sort:a,onSort:f}),(0,Z.jsx)(Q,{label:g(),sortKey:`version`,sort:a,onSort:f}),(0,Z.jsx)(V,{children:et()}),(0,Z.jsx)(Q,{label:_(),sortKey:`lastOk`,sort:a,onSort:f})]})}),(0,Z.jsx)(Ut,{children:d.map(e=>(0,Z.jsx)(xn,{r:e},e._id))})]})]})}function Q({label:e,sortKey:t,sort:n,onSort:r}){let i=n?.key===t,a=i?n.dir:null;return(0,Z.jsx)(V,{"aria-sort":i?a===`asc`?`ascending`:`descending`:`none`,children:(0,Z.jsxs)(`button`,{type:`button`,className:`oc-conn__sort`,onClick:()=>r(t),children:[e,i?a===`asc`?(0,Z.jsx)(It,{size:13,"aria-hidden":!0}):(0,Z.jsx)(w,{size:13,"aria-hidden":!0}):(0,Z.jsx)(_t,{size:13,"aria-hidden":!0,className:`oc-conn__sort-idle`})]})})}function xn({r:e}){let t=an(e)?W(e.lastErrorCode):null,n=on(e)?W(e.lastDownstreamRejectCode):null,r=sn(e)?W(e.lastLocalRefusalCode):null;return(0,Z.jsxs)(G.Fragment,{children:[(0,Z.jsxs)(H,{className:`oc-conn__row oc-conn__row--${e.state}`,children:[(0,Z.jsx)(U,{children:(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:e.targetLabel})}),(0,Z.jsx)(U,{children:(0,Z.jsx)(Cn,{state:e.state})}),(0,Z.jsx)(U,{children:e.instanceLabel?(0,Z.jsx)(`span`,{className:`oc-bridge-target__instance`,children:e.instanceLabel}):(0,Z.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})}),(0,Z.jsx)(U,{children:(0,Z.jsx)(`span`,{className:`oc-bridge-target__host`,children:e.gatewayHost})}),(0,Z.jsx)(U,{children:e.gatewayVersion?(0,Z.jsx)(`span`,{className:`oc-bridge-target__version`,children:e.gatewayVersion}):(0,Z.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})}),(0,Z.jsx)(U,{children:(0,Z.jsx)(`span`,{className:`oc-conn__stats`,children:Ye({ok:e.okCount,errors:e.errorCount,attempts:e.attempts})})}),(0,Z.jsx)(U,{children:e.lastOkAt?(0,Z.jsx)(`span`,{className:`oc-traces__mono`,children:F(e.lastOkAt)}):(0,Z.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})})]}),cn(e)?(0,Z.jsx)(H,{className:`oc-conn__detail-row`,children:(0,Z.jsxs)(U,{colSpan:7,className:`oc-conn__detail-cell`,children:[t?(0,Z.jsxs)(`div`,{className:`oc-bridge-target__error`,children:[(0,Z.jsx)(`strong`,{children:t.label}),` `,(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:e.lastErrorCode}),e.lastErrorAt?` · ${F(e.lastErrorAt)}`:``,(0,Z.jsx)(`p`,{className:`oc-bridge-card__hint`,children:t.hint})]}):null,r?(0,Z.jsxs)(`div`,{className:`oc-bridge-target__downstream`,children:[Xe({label:r.label}),` `,(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:e.lastLocalRefusalCode}),e.lastLocalRefusalAt?` · ${F(e.lastLocalRefusalAt)}`:``,(0,Z.jsx)(`p`,{className:`oc-bridge-card__hint`,children:r.hint})]}):null,n?(0,Z.jsxs)(`div`,{className:`oc-bridge-target__downstream`,children:[Se({label:n.label}),` `,(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:e.lastDownstreamRejectCode}),e.lastDownstreamRejectAt?` · ${F(e.lastDownstreamRejectAt)}`:``]}):null]})}):null]})}function Sn(e){return e===`connected`?m():e===`error`?y():fe()}function Cn({state:e}){return e===`connected`?(0,Z.jsx)(k,{variant:`secondary`,children:m()}):e===`error`?(0,Z.jsx)(k,{variant:`destructive`,children:y()}):(0,Z.jsx)(k,{variant:`outline`,children:fe()})}function wn(){return h(x.bridgeHealth.getBridgeHealth,{})}function Tn(){let e=wn(),t=h(x.compat.getBridgeCompat,{}),n=h(x.me.getMe,{host:Nt})?.role===`admin`,r=h(x.admin.listInstances,n?{}:`skip`),i=h(x.agents.usageForInstances,n?{}:`skip`),a=P(),o=()=>void a({to:`/settings/anomalies`,search:{status:`open`}}),s=un(e?e.targets:[],t?t.targets:[],r??[]),{section:c}=Mt({from:`/settings/bridge`}),l=P({from:`/settings/bridge`}),d=t?.compat??null,p=t===void 0?`loading`:t===null?`nodata`:`ready`,m=d!==null&&Xt(d,`hermes`)&&!s.some(e=>e.key===`hermes`);return(0,Z.jsxs)(`div`,{className:`oc-bridge`,children:[(0,Z.jsx)(En,{health:e,compat:t,onSeeAnomalies:o}),(0,Z.jsx)(`p`,{className:`oc-admin__hint oc-bridge__caption`,children:u()}),i&&i.length>0?(0,Z.jsxs)(`section`,{className:`oc-bridge__usage`,children:[(0,Z.jsx)(`h3`,{className:`oc-bridge__usage-title`,children:f()}),(0,Z.jsxs)(Wt,{children:[(0,Z.jsx)(Ht,{children:(0,Z.jsxs)(H,{children:[(0,Z.jsx)(V,{children:mt()}),(0,Z.jsx)(V,{children:st()}),(0,Z.jsx)(V,{children:xe()}),(0,Z.jsx)(V,{children:Pe()}),(0,Z.jsx)(V,{children:Re()})]})}),(0,Z.jsx)(Ut,{children:i.flatMap(e=>{let t=Tt(e.usage,Date.now());return t?t.windows.map((t,n)=>(0,Z.jsxs)(H,{children:[(0,Z.jsx)(U,{className:`font-medium`,children:n===0?e.instanceName:``}),(0,Z.jsx)(U,{children:t.provider}),(0,Z.jsx)(U,{children:t.label}),(0,Z.jsx)(U,{children:(0,Z.jsxs)(k,{variant:t.percentLeft<=10?`destructive`:t.percentLeft<=25?`outline`:`secondary`,children:[t.percentLeft,`%`]})}),(0,Z.jsx)(U,{className:`text-muted-foreground`,children:t.resetText??`—`})]},`${e.instanceName}:${t.provider}:${t.label}`)):[]})})]})]}):null,s.length>0?(0,Z.jsxs)(Pt,{value:s.some(e=>e.key===c)?c:s[0]?.key??`openclaw`,onValueChange:e=>void l({search:{section:e},replace:!0}),children:[(0,Z.jsx)(Lt,{className:`w-full`,children:s.map(e=>(0,Z.jsxs)(zt,{value:e.key,className:`flex-1 gap-1.5`,children:[(0,Z.jsx)(A,{size:13,"aria-hidden":!0}),q(e.key)]},e.key))}),s.map(e=>(0,Z.jsx)(At,{value:e.key,children:(0,Z.jsx)(Dn,{providerKey:e.key,connections:e.connections,instances:e.instances,manifest:d,compatStatus:p,compatReachable:t?.reachable??!0,protocol:e.key===`openclaw`?t?.protocol??null:null})},e.key))]}):null,m?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:Je()}):null]})}function En({health:e,compat:t,onSeeAnomalies:n}){let r=t!=null&&t.buildVersion!=null&&t.bridgeVersion!=null&&t.buildVersion!==t.bridgeVersion,i=t?.buildRevision&&t.buildRevision!==`unknown`?t.buildRevision.slice(0,7):null,a=t&&t!==null?(0,Z.jsxs)(`span`,{className:`oc-bridge-card__ver`,children:[(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:Yt(t.bridgeVersion)}),i?(0,Z.jsxs)(Z.Fragment,{children:[` `,(0,Z.jsxs)(`code`,{className:`oc-traces__mono`,title:ce(),children:[`(`,i,`)`]})]}):null,r?(0,Z.jsxs)(`strong`,{className:`oc-bridge-card__mismatch`,children:[` `,ut({build:t.buildVersion??`?`})]}):null,` · `,we(),` `,(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:t.protocolVersion===null?C():String(t.protocolVersion)})]}):null;if(e===void 0)return(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:S()});if(e===null)return(0,Z.jsx)(`div`,{className:`oc-bridge-card oc-bridge-card--idle`,children:be()});let o=tn(e.targets),s=!e.reachable,c=rn(e),l=e.unreachableInstances??[],u=c===`ok`?`ok`:c===`gateways_unreachable`?`warn`:`error`,d=O(e.checkedAt),f=e.startedAt==null?null:O(e.startedAt);return(0,Z.jsxs)(`div`,{className:`oc-bridge-card oc-bridge-card--${u}`,children:[(0,Z.jsx)(`div`,{className:`oc-bridge-card__icon`,"aria-hidden":!0,children:c===`ok`?(0,Z.jsx)(M,{size:22}):s||c===`gateways_unreachable`?(0,Z.jsx)(en,{size:22}):(0,Z.jsx)(I,{size:22})}),(0,Z.jsxs)(`div`,{className:`oc-bridge-card__body`,children:[(0,Z.jsx)(`div`,{className:`oc-bridge-card__title`,children:c===`ok`?Ne():c===`gateways_unreachable`?Ae({count:l.length}):s?Le():Ke({count:o.length})}),(0,Z.jsxs)(`div`,{className:`oc-bridge-card__meta`,children:[(0,Z.jsxs)(`span`,{children:[(0,Z.jsx)($t,{size:12,"aria-hidden":!0}),` `,$e({time:d})]}),f?(0,Z.jsx)(`span`,{children:it({time:f})}):null,a]}),c===`gateways_unreachable`?(0,Z.jsx)(`p`,{className:`oc-bridge-card__hint`,children:De({names:l.join(`, `)})}):null,s?(0,Z.jsx)(`p`,{className:`oc-bridge-card__hint`,children:W(e.lastError===`not_configured`?`NOT_CONFIGURED`:`BRIDGE_UNREACHABLE`).hint}):null]}),(0,Z.jsx)(`button`,{type:`button`,className:`oc-bridgebar__drill`,onClick:n,children:Ue()})]})}function Dn({providerKey:e,connections:t,instances:n,manifest:r,compatStatus:i,compatReachable:a,protocol:o}){let s=r?Kt(r,e):null,c=new Map;for(let e of n)c.set(e.name,e.displayName??e.name);let l=[],u=new Set;for(let n of t){if(!n.instanceName||u.has(n.instanceName))continue;u.add(n.instanceName);let t=n.gatewayVersion??null;l.push({instanceName:n.instanceName,displayName:c.get(n.instanceName)??n.instanceName,version:t,state:Jt(t,e,r)})}let d=Qt(l.map(e=>e.state)),[f,p]=(0,G.useState)(!1);return(0,Z.jsxs)(`section`,{className:`oc-bridge-provider`,children:[(0,Z.jsxs)(`header`,{className:`oc-bridge-provider__head`,children:[(0,Z.jsx)(A,{size:15,"aria-hidden":!0,className:`oc-bridge-provider__icon`}),(0,Z.jsx)(`span`,{className:`oc-bridge-provider__name`,children:q(e)}),d?(0,Z.jsx)(k,{variant:d===`beyond`||d===`defective`||d===`unsupported`?`destructive`:`secondary`,children:qt(d)}):null]}),(0,Z.jsx)(`h4`,{className:`oc-bridge-provider__sub`,children:ct()}),(0,Z.jsx)(kn,{providerName:q(e),support:s,compatStatus:i,compatReachable:a,manifest:r,instanceRows:l}),o?(0,Z.jsx)(On,{protocol:o}):null,(0,Z.jsxs)(`button`,{type:`button`,className:`oc-bridge-provider__sub oc-bridge-provider__sub--toggle`,"aria-expanded":f,onClick:()=>p(e=>!e),children:[f?(0,Z.jsx)(w,{size:13,"aria-hidden":!0}):(0,Z.jsx)(L,{size:13,"aria-hidden":!0}),Ee({count:t.length})]}),f?(0,Z.jsx)(bn,{connections:t,displayByInstance:c}):null]})}function On({protocol:e}){let[t,n]=(0,G.useState)(!1),r=e.coverage,i=e.drift??[],o=(e.driftOverflow??0)+(e.driftTruncated??0);return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`h4`,{className:`oc-bridge-provider__sub`,children:[de(),i.length>0?(0,Z.jsx)(k,{variant:`destructive`,children:l({count:i.length})}):o>0?(0,Z.jsx)(k,{variant:`destructive`,children:le()}):(0,Z.jsx)(k,{variant:`secondary`,children:lt()})]}),(0,Z.jsxs)(`p`,{className:`oc-admin__hint`,children:[dt({version:e.vendoredVersion}),r?` · `+Te({handled:r.handled,ignored:r.ignored,gaps:r.gaps}):null]}),o>0?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:a({overflow:e.driftOverflow??0,truncated:e.driftTruncated??0})}):null,i.length>0?(0,Z.jsx)(`ul`,{className:`oc-bridge-protocol__list`,role:`list`,children:i.map(e=>(0,Z.jsxs)(`li`,{children:[(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:e.shape}),` × `,e.count]},e.shape))}):null,r&&r.gapList.length>0?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`button`,{type:`button`,className:`oc-bridge-provider__sub oc-bridge-provider__sub--toggle`,"aria-expanded":t,onClick:()=>n(e=>!e),children:[t?(0,Z.jsx)(w,{size:13,"aria-hidden":!0}):(0,Z.jsx)(L,{size:13,"aria-hidden":!0}),pt({count:r.gapList.length})]}),t?(0,Z.jsx)(`ul`,{className:`oc-bridge-protocol__list`,role:`list`,children:r.gapList.map(e=>(0,Z.jsx)(`li`,{children:(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:e})},e))}):null]}):null]})}function kn({support:e,compatStatus:t,compatReachable:n,manifest:r,instanceRows:i,providerName:a}){return t===`loading`?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:S()}):t===`nodata`?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:c()}):(0,Z.jsxs)(`div`,{className:`oc-compat`,children:[n?null:(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:ot()}),r===null?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:ye()}):(0,Z.jsxs)(`div`,{className:`oc-compat__support`,children:[(0,Z.jsx)(`span`,{className:`oc-compat__label`,children:ue({provider:a})}),e&&e.range!==null?(0,Z.jsx)(`span`,{children:Me({min:e.range.min,max:e.range.maxValidated})}):(0,Z.jsx)(`span`,{children:C()}),e?(0,Z.jsx)(Mn,{versions:e.validatedVersions}):null]}),i.length===0?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:ke()}):(0,Z.jsx)(`div`,{className:`oc-compat__targets`,children:i.map(e=>(0,Z.jsxs)(`div`,{className:`oc-compat__target`,children:[(0,Z.jsx)(`span`,{className:`oc-compat__instance`,children:e.displayName}),(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:Yt(e.version)}),(0,Z.jsx)(k,{variant:e.state===`supported`?`secondary`:e.state===`beyond`||e.state===`defective`||e.state===`unsupported`?`destructive`:`outline`,children:qt(e.state)})]},e.instanceName))})]})}function An({instance:e,onClose:t}){return(0,Z.jsx)(St,{open:!0,onOpenChange:e=>!e&&t(),children:(0,Z.jsxs)(Bt,{className:`oc-bridge-config-dialog`,onOpenAutoFocus:e=>e.preventDefault(),children:[(0,Z.jsxs)(Ct,{children:[(0,Z.jsx)(Dt,{children:s({instance:e.displayName??e.name})}),(0,Z.jsx)(Ot,{children:se()})]}),(0,Z.jsx)(jn,{instance:e,onClose:t})]})})}function $({label:e,result:t}){return t?t.checked?(0,Z.jsxs)(`p`,{className:`oc-bridge-config__check-row `+(t.ok?`oc-bridge-config__check-row--ok`:`oc-bridge-config__check-row--err`),children:[t.ok?(0,Z.jsx)(M,{"aria-hidden":!0}):(0,Z.jsx)(I,{"aria-hidden":!0}),(0,Z.jsxs)(`span`,{children:[e,` — `,t.ok?Be():t.detail]})]}):(0,Z.jsxs)(`p`,{className:`oc-bridge-config__check-row oc-bridge-config__check-row--skip`,children:[e,` — `,i()]}):null}function jn({instance:e,onClose:t}){let n=pe(x.admin.upsertInstanceConfig),r=ht(x.bridge.validateMediaPaths),i=kt(),a=Vt(e.config?.contentLocale,void 0),[s,c]=(0,G.useState)(()=>vt(e.config??{},a)),[l,u]=(0,G.useState)(!1),[d,f]=(0,G.useState)(!1),[m,h]=(0,G.useState)(null),g=s.inboundMediaMode===`shared-fs`,_=s.mediaMode===`shared-fs`,v=g||_;async function se(){f(!0),h(null);try{h(await r({instanceName:e.name,inboundMediaMode:s.inboundMediaMode,mediaMode:s.mediaMode}))}catch(e){i.error(p(),e)}finally{f(!1)}}async function ce(){u(!0);try{let r=e.config??{};await n({instanceId:e._id,config:bt(s,r,a)}),t()}catch(e){i.error(Fe(),e)}finally{u(!1)}}return(0,Z.jsx)(`div`,{className:`oc-bridge-config`,children:(0,Z.jsxs)(`div`,{className:`oc-bridge-config__form`,children:[(0,Z.jsxs)(`div`,{className:`oc-bridge-config__grid`,children:[(0,Z.jsxs)(`label`,{className:`oc-field`,children:[(0,Z.jsx)(T,{label:Ce(),help:We()}),(0,Z.jsxs)(R,{value:s.mediaMode,onValueChange:e=>c({...s,mediaMode:e}),children:[(0,Z.jsx)(z,{size:`sm`,className:`w-full`,children:(0,Z.jsx)(j,{})}),(0,Z.jsx)(B,{children:xt.map(e=>(0,Z.jsx)(N,{value:e,children:e},e))})]})]}),(0,Z.jsxs)(`label`,{className:`oc-field`,children:[(0,Z.jsx)(T,{label:ft(),help:Ze()}),(0,Z.jsxs)(R,{value:s.inboundMediaMode,onValueChange:e=>c({...s,inboundMediaMode:e}),children:[(0,Z.jsx)(z,{size:`sm`,className:`w-full`,children:(0,Z.jsx)(j,{})}),(0,Z.jsx)(B,{children:yt.map(e=>(0,Z.jsx)(N,{value:e,children:e},e))})]})]}),(0,Z.jsxs)(`label`,{className:`oc-field`,children:[(0,Z.jsx)(T,{label:at(),help:rt()}),(0,Z.jsx)(D,{type:`number`,min:1,max:4096,className:`w-full`,value:s.mediaMaxMb,onChange:e=>c({...s,mediaMaxMb:Math.trunc(Number(e.target.value)||0)})})]})]}),v&&(0,Z.jsxs)(`div`,{className:`oc-bridge-config__grid`,children:[g&&(0,Z.jsxs)(`label`,{className:`oc-field`,children:[(0,Z.jsx)(T,{label:me(),help:o()}),(0,Z.jsx)(D,{className:`w-full`,spellCheck:!1,value:s.inboundAgentMount,onChange:e=>c({...s,inboundAgentMount:e.target.value})})]}),_&&(0,Z.jsxs)(`label`,{className:`oc-field`,children:[(0,Z.jsx)(T,{label:gt(),help:oe()}),(0,Z.jsx)(D,{className:`w-full`,spellCheck:!1,value:s.outboundAgentMount,onChange:e=>c({...s,outboundAgentMount:e.target.value})})]})]}),(0,Z.jsxs)(`label`,{className:`oc-field--row`,children:[(0,Z.jsx)(Et,{checked:s.rehydration,onCheckedChange:e=>c({...s,rehydration:e===!0})}),(0,Z.jsx)(T,{label:ve(),help:He()})]}),v&&m!==null&&(0,Z.jsx)(`div`,{className:`oc-bridge-config__check`,children:m.reachable?!m.inbound&&!m.outbound?(0,Z.jsxs)(`p`,{className:`oc-bridge-config__check-row oc-bridge-config__check-row--err`,children:[(0,Z.jsx)(I,{"aria-hidden":!0}),ie({reason:m.reason??`?`})]}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)($,{label:re(),result:m.inbound}),(0,Z.jsx)($,{label:ne(),result:m.outbound}),(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:ae()})]}):(0,Z.jsxs)(`p`,{className:`oc-bridge-config__check-row oc-bridge-config__check-row--err`,children:[(0,Z.jsx)(I,{"aria-hidden":!0}),Ve()]})}),(0,Z.jsxs)(`div`,{className:`oc-bridge-config__actions`,children:[v&&(0,Z.jsxs)(E,{variant:`outline`,size:`sm`,onClick:()=>void se(),disabled:d,children:[d?(0,Z.jsx)(wt,{className:`size-4 animate-spin`,"aria-hidden":!0}):null,d?ee():te()]}),(0,Z.jsx)(E,{size:`sm`,onClick:()=>void ce(),disabled:l,children:je()})]})]})})}function Mn({versions:e}){if(e.length===0)return null;let t=[...e].reverse();return(0,Z.jsxs)(Ft,{children:[(0,Z.jsx)(jt,{asChild:!0,children:(0,Z.jsxs)(`button`,{type:`button`,className:`oc-compat__versions-btn`,children:[e.length===1?Ie():Ge({count:e.length}),(0,Z.jsx)(w,{size:13,"aria-hidden":!0})]})}),(0,Z.jsxs)(Rt,{className:`oc-compat__versions-pop`,align:`start`,children:[(0,Z.jsx)(`p`,{className:`oc-compat__versions-title`,children:Qe()}),(0,Z.jsx)(`div`,{className:`oc-compat__versions-list`,children:t.map(e=>(0,Z.jsx)(k,{variant:`secondary`,children:e},e))})]})]})}export{Tn as BridgeTab,An as InstanceConfigDialog};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{A_ as r,At as i,Bp as a,Bt as o,Ct as s,D_ as c,Dt as l,E_ as u,Et as d,Ft as f,Gp as p,HX as m,Hp as h,Ht as g,It as _,Jv as v,Kp as y,Lt as ee,MX as b,M_ as x,Mt as S,N_ as te,Nt as C,O_ as ne,Ot as re,Pt as w,Rp as T,Rt as ie,St as ae,T_ as E,Tt as oe,Up as se,Ut as ce,Uv as le,VX as D,Vp as ue,Vt as de,Wp as O,Wt as k,Wv as fe,Xv as A,bt as pe,j_ as me,jt as he,k_ as ge,kt as _e,lv as j,qp as ve,t as M,wt as N,xA as P,xt as F,xu as ye,yt as be,zX as I,zp as xe,zt as Se}from"./api-Ca1H8N44.js";import{t as Ce}from"./use_paginated_query-C842MAhU.js";import{t as L}from"./button-BbEZKLza.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-bizOs74t.js";import{a as De}from"./compatView-BDU79WFh.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 de();case`hybrid`:return o();case`tool`:return Se();default:return ie()}}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`?C():Me(e)?s():null:w(),i=X(e),a=t.injection!==i.injection||!Z(t.sources,i.sources),o=new Set(e.sources.map(e=>e.id)),c=t.sources.length>0&&t.sources.length<=16&&t.sources.every(e=>o.has(e));return{readOnlyReason:r,dirty:a,valid:c,invalidReason:c?null:_()}}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`?C():e.code===`stale_default`?S():e.code===`write_unknown`||e.code===`not_confirmed`?_e():e.code===`not_applied`?re():e.code===`default_too_large`?F():e.code===`allowlist_too_large`?ae():e.code===`plugin_too_old`?s():e.code===`source_not_allowed`?N():e.code===`plugin_config_lag`?oe():e.code===`knowledge_unavailable`&&e.reason===`plugin_absent`?f():he({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 r=I(M.knowledge.setAgentKnowledgeDefault),[a,o]=(0,K.useState)(t),[s,l]=(0,K.useState)(()=>X(t)),[d,f]=(0,K.useState)(`idle`),[p,m]=(0,K.useState)(null),[h,_]=(0,K.useState)(!1),v=e=>{o(e),l(X(e)),m(null)},y=Pe(a,t);(0,K.useEffect)(()=>{h&&y&&(_(!1),v(t))},[h,y]);let b=je(a,s,n),x=b.readOnlyReason===null;async function S(){f(`saving`),m(null);try{let n=Q(await r({instanceName:e,agentId:t.agentId,injection:s.injection,sources:s.sources,expected:J(a)}));m(n),f(n===null?`done`:`idle`),n===null&&_(!0)}catch(e){m(Q({ok:!1,code:String(e?.message??`error`).slice(0,60)})),f(`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:s.injection,onValueChange:e=>{Y(e)&&l({...s,injection:e})},disabled:!x,children:[(0,$.jsx)(W,{className:`oc-cdefaults__select`,"aria-label":g(),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:ee()}),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:s.sources.includes(e.id),onCheckedChange:()=>l(Ne(t,s,e.id)),disabled:!x,"aria-label":e.label,"data-knowledge-default-source":e.id}),(0,$.jsx)(`span`,{children:e.label})]},e.id)),y&&!h?(0,$.jsxs)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:[pe(),` `,(0,$.jsx)(L,{variant:`outline`,size:`sm`,onClick:()=>v(t),children:be()})]}):null,t.overridesAllowed?null:(0,$.jsx)(`p`,{className:`oc-cdefaults__help`,children:i()}),x?(0,$.jsx)(`div`,{className:`oc-cdefaults__inline`,children:(0,$.jsx)(L,{size:`sm`,disabled:!b.dirty||!b.valid||d===`saving`,onClick:()=>void S(),children:d===`saving`?A():c()})}):(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,d===`done`&&p===null?(0,$.jsx)(`p`,{className:`oc-admin__hint`,role:`status`,children:u()}):null,p===null?null:(0,$.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:p})]})]})}function Ie({instanceName:e}){let t=m(M.knowledge.knowledgeAdminInstance,{instanceName:e}),{results:n,status:r,loadMore:i}=Ce(M.knowledge.agentKnowledgePage,{instanceName:e},{initialNumItems:50});return t===void 0||t.provider!==`openclaw`||n.length===0&&r!==`CanLoadMore`?null:(0,$.jsxs)(`section`,{className:`oc-cdefaults__row`,"aria-label":k(),children:[(0,$.jsx)(`span`,{className:`oc-cdefaults__label`,children:k()}),(0,$.jsx)(`p`,{className:`oc-admin__hint`,children:ce()}),t.supported?null:(0,$.jsx)(`p`,{className:`oc-cdefaults__note`,children:w()}),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:l({shown:n.length})}),(0,$.jsx)(L,{variant:`outline`,size:`sm`,disabled:r===`LoadingMore`,onClick:()=>i(50),"data-knowledge-load-more":!0,children:d()})]}):null]})}function Le({instance:e}){let t=D(M.admin.upsertInstanceConfig),n=m(M.agents.listAgentsForInstance,{instanceName:e.name}),r=typeof e.config?.converterAgentId==`string`?e.config.converterAgentId:``,[i,a]=(0,K.useState)(r),[o,s]=(0,K.useState)(`idle`);(0,K.useEffect)(()=>{a(r),s(`idle`)},[e._id,r]);let l=`__none__`,d=i!==r;async function f(){s(`saving`);try{let n={...e.config??{}};i===``||i===l?delete n.converterAgentId:n.converterAgentId=i,await t({instanceId:e._id,config:n}),s(`done`)}catch{s(`error`)}}let p=n?.agents??[];return(0,$.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,$.jsx)(`span`,{className:`oc-cdefaults__label`,children:O()}),(0,$.jsx)(`p`,{className:`oc-admin__hint`,children:se()}),(0,$.jsxs)(`div`,{className:`oc-cdefaults__inline`,children:[(0,$.jsxs)(U,{value:i===``?l:i,onValueChange:e=>a(e===l?``:e),children:[(0,$.jsx)(W,{className:`oc-cdefaults__select`,"aria-label":O(),children:(0,$.jsx)(B,{placeholder:h()})}),(0,$.jsxs)(G,{children:[(0,$.jsx)(V,{value:l,children:h()}),p.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:!d||o===`saving`,onClick:()=>void f(),children:o===`saving`?A():c()})]}),o===`done`?(0,$.jsx)(`p`,{className:`oc-admin__hint`,role:`status`,children:u()}):null,o===`error`?(0,$.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:E()}):null]})}function Re({instance:e}){let t=D(M.admin.upsertInstanceConfig),n=e.config?.curationEnabled===!0,r=typeof e.config?.curationBudgetChars==`number`?e.config.curationBudgetChars:null,[i,o]=(0,K.useState)(n),[s,l]=(0,K.useState)(r===null?``:String(r)),[d,f]=(0,K.useState)(`idle`);(0,K.useEffect)(()=>{o(n),l(r===null?``:String(r)),f(`idle`)},[e._id,n,r]);let m=s.trim(),h=m===``?null:/^\d+$/.test(m)?Number.parseInt(m,10):NaN,g=!i||h===null||Number.isInteger(h)&&h>=4e3&&h<=6e4,_=i!==n||(h??null)!==r;async function v(){f(`saving`);try{let n={...e.config??{}};n.curationEnabled=i,!i||h===null||Number.isNaN(h)?delete n.curationBudgetChars:n.curationBudgetChars=h,await t({instanceId:e._id,config:n}),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:i,onCheckedChange:e=>o(e===!0),"aria-label":p()}),(0,$.jsx)(`span`,{className:`oc-cdefaults__label`,children:p()})]}),(0,$.jsxs)(`div`,{className:`oc-cdefaults__inline`,children:[(0,$.jsx)(R,{type:`number`,min:4e3,max:6e4,step:1e3,placeholder:`20000`,value:s,onChange:e=>l(e.target.value),className:`oc-cdefaults__number`,"aria-invalid":!g,"aria-label":ue(),disabled:!i}),(0,$.jsx)(L,{size:`sm`,disabled:!_||!g||d===`saving`,onClick:()=>void v(),children:d===`saving`?A():c()})]}),g?null:(0,$.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:a()}),d===`done`?(0,$.jsx)(`p`,{className:`oc-admin__hint`,role:`status`,children:u()}):null,d===`error`?(0,$.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:E()}):null,(0,$.jsx)(`p`,{className:`oc-cdefaults__help`,children:xe()})]})}function ze({instance:e}){let t=D(M.admin.upsertInstanceConfig),n=typeof e.config?.summarizeThresholdChars==`number`?e.config.summarizeThresholdChars:null,[r,i]=(0,K.useState)(n===null?``:String(n)),[a,o]=(0,K.useState)(`idle`);(0,K.useEffect)(()=>{i(n===null?``:String(n)),o(`idle`)},[e._id,n]);let s=r.trim(),l=s===``?null:/^\d+$/.test(s)?Number.parseInt(s,10):NaN,d=l===null||Number.isInteger(l)&&l>=1e3&&l<=2e5,f=(l??null)!==n;async function p(){o(`saving`);try{let n={...e.config??{}};l===null?delete n.summarizeThresholdChars:n.summarizeThresholdChars=l,await t({instanceId:e._id,config:n}),o(`done`)}catch{o(`error`)}}return(0,$.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,$.jsx)(`span`,{className:`oc-cdefaults__label`,children:ve()}),(0,$.jsxs)(`div`,{className:`oc-cdefaults__inline`,children:[(0,$.jsx)(R,{type:`number`,min:1e3,max:2e5,step:1e3,placeholder:`8000`,value:r,onChange:e=>i(e.target.value),className:`oc-cdefaults__number`,"aria-invalid":!d}),(0,$.jsx)(L,{size:`sm`,disabled:!f||!d||a===`saving`,onClick:()=>void p(),children:a===`saving`?A():c()})]}),d?null:(0,$.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:T()}),a===`done`?(0,$.jsx)(`p`,{className:`oc-admin__hint`,role:`status`,children:u()}):null,a===`error`?(0,$.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:E()}):null,(0,$.jsx)(`p`,{className:`oc-cdefaults__help`,children:y()})]})}function Be(){let e=I(M.agentFiles.getChatDefaults),[t,n]=(0,K.useState)({status:`loading`}),i=m(M.admin.listInstances,{}),[a,o]=(0,K.useState)(null);(0,K.useEffect)(()=>{!i||i.length===0||(!a||!i.some(e=>e.name===a))&&o(i[0].name)},[i,a]);let s=(i?.length??0)>1,c=i!==void 0&&i.length===0,l=m(M.compat.forInstance,a?{instanceName:a}:`skip`),u=a?Te(l,`configDefaults`):`loading`,d=u===`loading`?null:u.blocked,f=(0,K.useMemo)(()=>s&&a?{instanceName:a}:{},[s,a]),p=(0,K.useRef)(0),h=(0,K.useCallback)(async()=>{let t=++p.current;n({status:`loading`});try{let r=ke(await e(f));if(p.current!==t)return;n({status:`done`,current:r})}catch{if(p.current!==t)return;n({status:`error`})}},[e,f]);(0,K.useEffect)(()=>{d===!1&&(s&&!a||h())},[h,d,s,a]);let g=t.status===`done`?t.current:null,_=(0,K.useMemo)(()=>Oe.map(e=>({id:e,label:Ee(e)})),[]),y=(0,K.useMemo)(()=>[{id:`fast`,label:fe()},{id:`standard`,label:le()}],[]);return(0,$.jsxs)(`div`,{className:`oc-cdefaults`,children:[(0,$.jsx)(`p`,{className:`oc-admin__hint`,children:te()}),s&&a?(0,$.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,$.jsx)(`span`,{className:`oc-cdefaults__label`,children:j()}),(0,$.jsxs)(U,{value:a,onValueChange:e=>o(e),children:[(0,$.jsx)(W,{size:`sm`,"aria-label":j(),children:(0,$.jsx)(B,{})}),(0,$.jsx)(G,{children:(i??[]).map(e=>(0,$.jsx)(V,{value:e.name,children:e.name},e.name))})]})]}):null,c?(0,$.jsx)(`p`,{className:`oc-admin__hint`,role:`status`,children:P()}):u===`loading`?(0,$.jsx)(`p`,{className:`oc-admin__hint`,children:b()}):u.blocked?(0,$.jsxs)(`p`,{className:`oc-compat__blocked`,role:`status`,children:[(0,$.jsx)(we,{size:14,"aria-hidden":!0}),` `,De(u.gatewayVersion,u.provider)]}):t.status===`loading`?(0,$.jsx)(`p`,{className:`oc-admin__hint`,children:b()}):t.status===`error`?(0,$.jsxs)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:[ne(),` `,(0,$.jsx)(L,{variant:`outline`,size:`sm`,onClick:()=>void h(),children:v()})]}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,$.jsx)(`span`,{className:`oc-cdefaults__label`,children:x()}),(0,$.jsx)(H,{field:`thinkingLevel`,options:_,value:g?.thinkingDefault??null,onChange:()=>{},disabled:!0,ariaLabel:x()}),(0,$.jsx)(`p`,{className:`oc-cdefaults__help`,children:me()})]}),(0,$.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,$.jsx)(`span`,{className:`oc-cdefaults__label`,children:r()}),(0,$.jsx)(H,{field:`fastMode`,options:y,value:g===null||g.fastModeDefault===null?null:g.fastModeDefault?`fast`:`standard`,onChange:()=>{},disabled:!0,ariaLabel:r()}),(0,$.jsx)(`p`,{className:`oc-cdefaults__help`,children:ge()})]}),(0,$.jsx)(`p`,{className:`oc-cdefaults__note`,children:ye()})]}),(()=>{let e=i?.find(e=>e.name===(a??i[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{A_ as r,At as i,Bp as a,Bt as o,Ct as s,D_ as c,Dt as l,E_ as u,Et as d,Ft as f,Gp as p,HX as m,Hp as h,Ht as g,It as _,Jv as v,Kp as y,Lt as ee,MX as b,M_ as x,Mt as S,N_ as te,Nt as C,O_ as ne,Ot as re,Pt as w,Rp as T,Rt as ie,St as ae,T_ as E,Tt as oe,Up as se,Ut as ce,Uv as le,VX as D,Vp as ue,Vt as de,Wp as O,Wt as k,Wv as fe,Xv as A,bt as pe,j_ as me,jt as he,k_ as ge,kt as _e,lv as j,qp as ve,t as M,wt as N,xA as P,xt as F,xu as ye,yt as be,zX as I,zp as xe,zt as Se}from"./api-Ca1H8N44.js";import{t as Ce}from"./use_paginated_query-C842MAhU.js";import{t as L}from"./button-BbEZKLza.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-Wii4FZxb.js";import{a as De}from"./compatView-BDU79WFh.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 de();case`hybrid`:return o();case`tool`:return Se();default:return ie()}}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`?C():Me(e)?s():null:w(),i=X(e),a=t.injection!==i.injection||!Z(t.sources,i.sources),o=new Set(e.sources.map(e=>e.id)),c=t.sources.length>0&&t.sources.length<=16&&t.sources.every(e=>o.has(e));return{readOnlyReason:r,dirty:a,valid:c,invalidReason:c?null:_()}}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`?C():e.code===`stale_default`?S():e.code===`write_unknown`||e.code===`not_confirmed`?_e():e.code===`not_applied`?re():e.code===`default_too_large`?F():e.code===`allowlist_too_large`?ae():e.code===`plugin_too_old`?s():e.code===`source_not_allowed`?N():e.code===`plugin_config_lag`?oe():e.code===`knowledge_unavailable`&&e.reason===`plugin_absent`?f():he({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 r=I(M.knowledge.setAgentKnowledgeDefault),[a,o]=(0,K.useState)(t),[s,l]=(0,K.useState)(()=>X(t)),[d,f]=(0,K.useState)(`idle`),[p,m]=(0,K.useState)(null),[h,_]=(0,K.useState)(!1),v=e=>{o(e),l(X(e)),m(null)},y=Pe(a,t);(0,K.useEffect)(()=>{h&&y&&(_(!1),v(t))},[h,y]);let b=je(a,s,n),x=b.readOnlyReason===null;async function S(){f(`saving`),m(null);try{let n=Q(await r({instanceName:e,agentId:t.agentId,injection:s.injection,sources:s.sources,expected:J(a)}));m(n),f(n===null?`done`:`idle`),n===null&&_(!0)}catch(e){m(Q({ok:!1,code:String(e?.message??`error`).slice(0,60)})),f(`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:s.injection,onValueChange:e=>{Y(e)&&l({...s,injection:e})},disabled:!x,children:[(0,$.jsx)(W,{className:`oc-cdefaults__select`,"aria-label":g(),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:ee()}),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:s.sources.includes(e.id),onCheckedChange:()=>l(Ne(t,s,e.id)),disabled:!x,"aria-label":e.label,"data-knowledge-default-source":e.id}),(0,$.jsx)(`span`,{children:e.label})]},e.id)),y&&!h?(0,$.jsxs)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:[pe(),` `,(0,$.jsx)(L,{variant:`outline`,size:`sm`,onClick:()=>v(t),children:be()})]}):null,t.overridesAllowed?null:(0,$.jsx)(`p`,{className:`oc-cdefaults__help`,children:i()}),x?(0,$.jsx)(`div`,{className:`oc-cdefaults__inline`,children:(0,$.jsx)(L,{size:`sm`,disabled:!b.dirty||!b.valid||d===`saving`,onClick:()=>void S(),children:d===`saving`?A():c()})}):(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,d===`done`&&p===null?(0,$.jsx)(`p`,{className:`oc-admin__hint`,role:`status`,children:u()}):null,p===null?null:(0,$.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:p})]})]})}function Ie({instanceName:e}){let t=m(M.knowledge.knowledgeAdminInstance,{instanceName:e}),{results:n,status:r,loadMore:i}=Ce(M.knowledge.agentKnowledgePage,{instanceName:e},{initialNumItems:50});return t===void 0||t.provider!==`openclaw`||n.length===0&&r!==`CanLoadMore`?null:(0,$.jsxs)(`section`,{className:`oc-cdefaults__row`,"aria-label":k(),children:[(0,$.jsx)(`span`,{className:`oc-cdefaults__label`,children:k()}),(0,$.jsx)(`p`,{className:`oc-admin__hint`,children:ce()}),t.supported?null:(0,$.jsx)(`p`,{className:`oc-cdefaults__note`,children:w()}),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:l({shown:n.length})}),(0,$.jsx)(L,{variant:`outline`,size:`sm`,disabled:r===`LoadingMore`,onClick:()=>i(50),"data-knowledge-load-more":!0,children:d()})]}):null]})}function Le({instance:e}){let t=D(M.admin.upsertInstanceConfig),n=m(M.agents.listAgentsForInstance,{instanceName:e.name}),r=typeof e.config?.converterAgentId==`string`?e.config.converterAgentId:``,[i,a]=(0,K.useState)(r),[o,s]=(0,K.useState)(`idle`);(0,K.useEffect)(()=>{a(r),s(`idle`)},[e._id,r]);let l=`__none__`,d=i!==r;async function f(){s(`saving`);try{let n={...e.config??{}};i===``||i===l?delete n.converterAgentId:n.converterAgentId=i,await t({instanceId:e._id,config:n}),s(`done`)}catch{s(`error`)}}let p=n?.agents??[];return(0,$.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,$.jsx)(`span`,{className:`oc-cdefaults__label`,children:O()}),(0,$.jsx)(`p`,{className:`oc-admin__hint`,children:se()}),(0,$.jsxs)(`div`,{className:`oc-cdefaults__inline`,children:[(0,$.jsxs)(U,{value:i===``?l:i,onValueChange:e=>a(e===l?``:e),children:[(0,$.jsx)(W,{className:`oc-cdefaults__select`,"aria-label":O(),children:(0,$.jsx)(B,{placeholder:h()})}),(0,$.jsxs)(G,{children:[(0,$.jsx)(V,{value:l,children:h()}),p.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:!d||o===`saving`,onClick:()=>void f(),children:o===`saving`?A():c()})]}),o===`done`?(0,$.jsx)(`p`,{className:`oc-admin__hint`,role:`status`,children:u()}):null,o===`error`?(0,$.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:E()}):null]})}function Re({instance:e}){let t=D(M.admin.upsertInstanceConfig),n=e.config?.curationEnabled===!0,r=typeof e.config?.curationBudgetChars==`number`?e.config.curationBudgetChars:null,[i,o]=(0,K.useState)(n),[s,l]=(0,K.useState)(r===null?``:String(r)),[d,f]=(0,K.useState)(`idle`);(0,K.useEffect)(()=>{o(n),l(r===null?``:String(r)),f(`idle`)},[e._id,n,r]);let m=s.trim(),h=m===``?null:/^\d+$/.test(m)?Number.parseInt(m,10):NaN,g=!i||h===null||Number.isInteger(h)&&h>=4e3&&h<=6e4,_=i!==n||(h??null)!==r;async function v(){f(`saving`);try{let n={...e.config??{}};n.curationEnabled=i,!i||h===null||Number.isNaN(h)?delete n.curationBudgetChars:n.curationBudgetChars=h,await t({instanceId:e._id,config:n}),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:i,onCheckedChange:e=>o(e===!0),"aria-label":p()}),(0,$.jsx)(`span`,{className:`oc-cdefaults__label`,children:p()})]}),(0,$.jsxs)(`div`,{className:`oc-cdefaults__inline`,children:[(0,$.jsx)(R,{type:`number`,min:4e3,max:6e4,step:1e3,placeholder:`20000`,value:s,onChange:e=>l(e.target.value),className:`oc-cdefaults__number`,"aria-invalid":!g,"aria-label":ue(),disabled:!i}),(0,$.jsx)(L,{size:`sm`,disabled:!_||!g||d===`saving`,onClick:()=>void v(),children:d===`saving`?A():c()})]}),g?null:(0,$.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:a()}),d===`done`?(0,$.jsx)(`p`,{className:`oc-admin__hint`,role:`status`,children:u()}):null,d===`error`?(0,$.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:E()}):null,(0,$.jsx)(`p`,{className:`oc-cdefaults__help`,children:xe()})]})}function ze({instance:e}){let t=D(M.admin.upsertInstanceConfig),n=typeof e.config?.summarizeThresholdChars==`number`?e.config.summarizeThresholdChars:null,[r,i]=(0,K.useState)(n===null?``:String(n)),[a,o]=(0,K.useState)(`idle`);(0,K.useEffect)(()=>{i(n===null?``:String(n)),o(`idle`)},[e._id,n]);let s=r.trim(),l=s===``?null:/^\d+$/.test(s)?Number.parseInt(s,10):NaN,d=l===null||Number.isInteger(l)&&l>=1e3&&l<=2e5,f=(l??null)!==n;async function p(){o(`saving`);try{let n={...e.config??{}};l===null?delete n.summarizeThresholdChars:n.summarizeThresholdChars=l,await t({instanceId:e._id,config:n}),o(`done`)}catch{o(`error`)}}return(0,$.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,$.jsx)(`span`,{className:`oc-cdefaults__label`,children:ve()}),(0,$.jsxs)(`div`,{className:`oc-cdefaults__inline`,children:[(0,$.jsx)(R,{type:`number`,min:1e3,max:2e5,step:1e3,placeholder:`8000`,value:r,onChange:e=>i(e.target.value),className:`oc-cdefaults__number`,"aria-invalid":!d}),(0,$.jsx)(L,{size:`sm`,disabled:!f||!d||a===`saving`,onClick:()=>void p(),children:a===`saving`?A():c()})]}),d?null:(0,$.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:T()}),a===`done`?(0,$.jsx)(`p`,{className:`oc-admin__hint`,role:`status`,children:u()}):null,a===`error`?(0,$.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:E()}):null,(0,$.jsx)(`p`,{className:`oc-cdefaults__help`,children:y()})]})}function Be(){let e=I(M.agentFiles.getChatDefaults),[t,n]=(0,K.useState)({status:`loading`}),i=m(M.admin.listInstances,{}),[a,o]=(0,K.useState)(null);(0,K.useEffect)(()=>{!i||i.length===0||(!a||!i.some(e=>e.name===a))&&o(i[0].name)},[i,a]);let s=(i?.length??0)>1,c=i!==void 0&&i.length===0,l=m(M.compat.forInstance,a?{instanceName:a}:`skip`),u=a?Te(l,`configDefaults`):`loading`,d=u===`loading`?null:u.blocked,f=(0,K.useMemo)(()=>s&&a?{instanceName:a}:{},[s,a]),p=(0,K.useRef)(0),h=(0,K.useCallback)(async()=>{let t=++p.current;n({status:`loading`});try{let r=ke(await e(f));if(p.current!==t)return;n({status:`done`,current:r})}catch{if(p.current!==t)return;n({status:`error`})}},[e,f]);(0,K.useEffect)(()=>{d===!1&&(s&&!a||h())},[h,d,s,a]);let g=t.status===`done`?t.current:null,_=(0,K.useMemo)(()=>Oe.map(e=>({id:e,label:Ee(e)})),[]),y=(0,K.useMemo)(()=>[{id:`fast`,label:fe()},{id:`standard`,label:le()}],[]);return(0,$.jsxs)(`div`,{className:`oc-cdefaults`,children:[(0,$.jsx)(`p`,{className:`oc-admin__hint`,children:te()}),s&&a?(0,$.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,$.jsx)(`span`,{className:`oc-cdefaults__label`,children:j()}),(0,$.jsxs)(U,{value:a,onValueChange:e=>o(e),children:[(0,$.jsx)(W,{size:`sm`,"aria-label":j(),children:(0,$.jsx)(B,{})}),(0,$.jsx)(G,{children:(i??[]).map(e=>(0,$.jsx)(V,{value:e.name,children:e.name},e.name))})]})]}):null,c?(0,$.jsx)(`p`,{className:`oc-admin__hint`,role:`status`,children:P()}):u===`loading`?(0,$.jsx)(`p`,{className:`oc-admin__hint`,children:b()}):u.blocked?(0,$.jsxs)(`p`,{className:`oc-compat__blocked`,role:`status`,children:[(0,$.jsx)(we,{size:14,"aria-hidden":!0}),` `,De(u.gatewayVersion,u.provider)]}):t.status===`loading`?(0,$.jsx)(`p`,{className:`oc-admin__hint`,children:b()}):t.status===`error`?(0,$.jsxs)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:[ne(),` `,(0,$.jsx)(L,{variant:`outline`,size:`sm`,onClick:()=>void h(),children:v()})]}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,$.jsx)(`span`,{className:`oc-cdefaults__label`,children:x()}),(0,$.jsx)(H,{field:`thinkingLevel`,options:_,value:g?.thinkingDefault??null,onChange:()=>{},disabled:!0,ariaLabel:x()}),(0,$.jsx)(`p`,{className:`oc-cdefaults__help`,children:me()})]}),(0,$.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,$.jsx)(`span`,{className:`oc-cdefaults__label`,children:r()}),(0,$.jsx)(H,{field:`fastMode`,options:y,value:g===null||g.fastModeDefault===null?null:g.fastModeDefault?`fast`:`standard`,onChange:()=>{},disabled:!0,ariaLabel:r()}),(0,$.jsx)(`p`,{className:`oc-cdefaults__help`,children:ge()})]}),(0,$.jsx)(`p`,{className:`oc-cdefaults__note`,children:ye()})]}),(()=>{let e=i?.find(e=>e.name===(a??i[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{SC as r,_C as i,bC as a,gC as o,vC as s,xC as c,yC as l}from"./api-Ca1H8N44.js";import{r as u}from"./dist-Bfmsr8JO.js";import{t as d}from"./chevrons-up-down-DCwhEy5H.js";import{t as f}from"./button-BbEZKLza.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{SC as r,_C as i,bC as a,gC as o,vC as s,xC as c,yC as l}from"./api-Ca1H8N44.js";import{r as u}from"./dist-Bfmsr8JO.js";import{t as d}from"./chevrons-up-down-DCwhEy5H.js";import{t as f}from"./button-BbEZKLza.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-Wii4FZxb.js";import{a as C,i as w,n as T,o as E,r as D,t as O}from"./table-BrECCZpB.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=r(),bulkActions:F,emptyHint:I=c(),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:a()}):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":l(),checked:J?!0:Y?`indeterminate`:!1,onCheckedChange:X})}):null,n.map((e,t)=>{let n=V?.index===t;return e.sort?(0,M.jsx)(w,{className:e.className,"aria-sort":n?V.dir===`asc`?`ascending`:`descending`:`none`,children:(0,M.jsxs)(`button`,{type:`button`,className:`oc-dt__sort`,onClick:()=>K(t),"aria-label":o({column:e.header}),children:[e.header,n?V.dir===`asc`?(0,M.jsx)(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":s(),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":i(),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{HE as t,ME as n,NE as r,PE as i,VE as a,VX as o,mj as s,t as c}from"./api-Ca1H8N44.js";import{t as l}from"./use_paginated_query-C842MAhU.js";import{t as u}from"./button-BbEZKLza.js";import{ct as d,h as f}from"./index-
|
|
1
|
+
import{r as e}from"./bundle-mjs-C73ZY4La.js";import{HE as t,ME as n,NE as r,PE as i,VE as a,VX as o,mj as s,t as c}from"./api-Ca1H8N44.js";import{t as l}from"./use_paginated_query-C842MAhU.js";import{t as u}from"./button-BbEZKLza.js";import{ct as d,h as f}from"./index-Wii4FZxb.js";import{n as p,t as m}from"./trashPage-svjv-CK6.js";var h=e();function g(){let{results:e,status:g,loadMore:_}=l(c.trash.listMyTrash,{},{initialNumItems:50}),v=f(),y=o(c.trash.restoreChat),b=o(c.trash.purgeChat),x=o(c.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:t({days:v})}),e.length>0?(0,h.jsx)(u,{variant:`destructive`,size:`sm`,onClick:async()=>{await S({title:r(),description:n(),confirmLabel:i(),destructive:!0})&&await x({})},children:i()}):null]}),g===`LoadingFirstPage`?(0,h.jsx)(`p`,{className:`oc-trash__hint`,children:s()}):e.length===0?(0,h.jsx)(`p`,{className:`oc-trash__empty`,children:a()}):(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-Wii4FZxb.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,$L as i,AL as a,BL as o,CL as s,DL as c,EL as l,FL as u,GL as d,HL as f,HX as p,IL as ee,JL as m,KL as h,LL as te,ML as ne,NL as g,OL as _,PL as re,QI as v,QL as y,RL as ie,SL as b,TL as ae,UL as x,VL as S,VX as C,WL as w,XL as T,YL as E,Yf as D,ZI as O,ZL as k,Zf as A,_L as j,aL as M,bL as N,cL as P,dL as F,eL as I,fL as L,gL as R,hL as z,iL as B,jL as V,kL as H,lL as U,mL as W,nL as oe,oL as G,pL as K,qL as q,rL as se,sL as ce,t as J,tL as le,uL as ue,vL as de,wL as fe,xL as pe,yL as me,zL as he}from"./api-Ca1H8N44.js";import{t as ge}from"./button-BbEZKLza.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,$L as i,AL as a,BL as o,CL as s,DL as c,EL as l,FL as u,GL as d,HL as f,HX as p,IL as ee,JL as m,KL as h,LL as te,ML as ne,NL as g,OL as _,PL as re,QI as v,QL as y,RL as ie,SL as b,TL as ae,UL as x,VL as S,VX as C,WL as w,XL as T,YL as E,Yf as D,ZI as O,ZL as k,Zf as A,_L as j,aL as M,bL as N,cL as P,dL as F,eL as I,fL as L,gL as R,hL as z,iL as B,jL as V,kL as H,lL as U,mL as W,nL as oe,oL as G,pL as K,qL as q,rL as se,sL as ce,t as J,tL as le,uL as ue,vL as de,wL as fe,xL as pe,yL as me,zL as he}from"./api-Ca1H8N44.js";import{t as ge}from"./button-BbEZKLza.js";import{At as _e,ct as Y}from"./index-Wii4FZxb.js";import{t as ve}from"./DataTableShell-BUYroEsA.js";var X=t(e(),1),Z=n(),ye={altered_words:()=>i(),incorrect:()=>y(),incoherence:()=>k(),formatting:()=>T(),latency:()=>E(),api_error:()=>m(),other:()=>q()},Q=e=>ye[e]?.()??e;function $({matches:e,sourceWasOpen:t}){return t?e===!0?(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-ok`,children:d()}):e===!1?(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-warn`,children:w()}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill`,children:`—`}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill`,children:h()})}function be({data:e,reference:t,closeReason:n}){let r=e.snapshot,i=C(J.feedback.respondToFeedback),[d,p]=(0,X.useState)(e.thread),[m,h]=(0,X.useState)(``),[v,y]=(0,X.useState)(!1);async function b(){let t=m.trim();if(!(!t||v)){y(!0);try{await i({feedbackId:e._id,text:t}),p(e=>[...e,{authorRole:`admin`,text:t,at:Date.now()}]),h(``)}finally{y(!1)}}}let w=[];try{w=r.contextJson?JSON.parse(r.contextJson):[]}catch{w=[]}return(0,Z.jsxs)(`div`,{className:`oc-fbadmin__detail`,children:[(0,Z.jsxs)(`div`,{className:`oc-fbadmin__row`,children:[(0,Z.jsx)($,{matches:r.displayedMatchesStored,sourceWasOpen:r.clientInfo?.sourceWasOpen??!1}),(0,Z.jsxs)(`span`,{className:`oc-fbadmin__meta`,children:[Q(e.category),` · `,r.messageRole,r.isRegeneration?` · ${x()}`:``,r.openclawModel?` · ${r.openclawModel}`:``,r.openclawRuntime?` (${r.openclawRuntime})`:``]}),t?(0,Z.jsx)(`code`,{className:`oc-fbadmin__ref`,style:{userSelect:`all`,marginLeft:`auto`},title:j(),children:t}):null]}),e.comment?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:f()}),(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:se()}),(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:S()}),d.length>0?(0,Z.jsx)(`div`,{className:`oc-fbadmin__thread`,children:d.map((e,t)=>(0,Z.jsxs)(`div`,{className:`oc-notif__msg oc-notif__msg--${e.authorRole}`,children:[(0,Z.jsx)(`span`,{className:`oc-notif__msg-who`,children:e.authorRole===`admin`?o():e.authorRole===`agent`?e.authorLabel??A():he()}),(0,Z.jsx)(`span`,{className:`oc-notif__msg-text`,children:e.text})]},t))}):(0,Z.jsx)(`p`,{className:`oc-fbadmin__meta`,children:ie()}),(0,Z.jsx)(`textarea`,{className:`oc-feedback__textarea`,placeholder:te(),value:m,maxLength:2e3,rows:3,onChange:e=>h(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 b(),disabled:!m.trim()||v,children:v?ee():u()})})]}),(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:re()}),(0,Z.jsx)(`pre`,{className:`oc-msg__source-pre`,children:r.messageText||g()})]}),r.clientInfo?.sourceWasOpen&&r.displayedText!==void 0?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:ne()}),(0,Z.jsx)(`pre`,{className:`oc-msg__source-pre`,children:r.displayedText||g()})]}):null,r.promptText?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:V()}),(0,Z.jsx)(`pre`,{className:`oc-msg__source-pre`,children:r.promptText})]}):null,w.length>0?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:a({count:r.contextCount??w.length,truncated:r.contextTruncated?H():``})}),(0,Z.jsx)(`div`,{className:`oc-fbadmin__ctx`,children:w.map((e,t)=>(0,Z.jsxs)(`div`,{className:`oc-fbadmin__ctx-turn`,children:[(0,Z.jsx)(`span`,{className:`oc-fbadmin__ctx-role`,children:e.role}),(0,Z.jsx)(`span`,{className:`oc-fbadmin__ctx-text`,children:e.text})]},t))})]}):null,r.outboxAvailable?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:_()}),(0,Z.jsxs)(`pre`,{className:`oc-msg__source-pre`,children:[r.outboxText??``,r.outboxStatus?`\n[status: ${r.outboxStatus}]`:``]})]}):null,r.clientInfo?.extensionsDetected&&r.clientInfo.extensionsDetected.length>0?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:c()}),(0,Z.jsx)(`div`,{className:`oc-fbadmin__row`,children:r.clientInfo.extensionsDetected.map(e=>(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-warn`,children:e},e))})]}):null,(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:l()}),(0,Z.jsxs)(`p`,{className:`oc-fbadmin__env`,children:[[r.clientInfo?.language,r.clientInfo?.timezone,r.clientInfo?.theme?ae({theme:r.clientInfo.theme}):null,r.runId?`run ${r.runId.slice(0,12)}…`:null].filter(Boolean).join(` · `)||`—`,r.clientInfo?.plugins&&r.clientInfo.plugins.length>0?(0,Z.jsxs)(`span`,{className:`oc-fbadmin__plugins`,children:[fe(),` `,r.clientInfo.plugins.join(`, `),(0,Z.jsxs)(`span`,{className:`oc-fbadmin__note`,children:[` `,s()]})]}):null,r.clientInfo?.userAgent?(0,Z.jsx)(`span`,{className:`oc-fbadmin__ua`,children:r.clientInfo.userAgent}):null]})]})]})}function xe(){let e=p(J.feedback.listForAdmin,{}),t=C(J.feedback.readSnapshot),n=C(J.feedback.deleteFeedback),i=Y(),[a,o]=(0,X.useState)(null),[s,c]=(0,X.useState)({});async function l(e){if(a===e._id){o(null);return}if(!s[e._id]){let n=await t({feedbackId:e._id});c(t=>({...t,[e._id]:n}))}o(e._id)}async function u(e){await i({title:r(),description:v(),confirmLabel:O(),destructive:!0})&&(await n({feedbackId:e._id}),a===e._id&&o(null))}return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`p`,{className:`oc-admin__hint`,children:[b(),` `,(0,Z.jsx)(`strong`,{children:pe()}),` `,N()]}),(0,Z.jsx)(ve,{title:me(),rows:e,emptyHint:de(),isExpanded:e=>a===e._id&&!!s[e._id],renderExpanded:e=>s[e._id]?(0,Z.jsx)(be,{data:s[e._id],reference:e.reference,closeReason:e.userCloseReason}):null,columns:[{header:R(),cell:e=>_e(e.at),sort:e=>e.at},{header:z(),cell:e=>Q(e.category),sort:e=>Q(e.category)},{header:W(),cell:e=>e.messageRole===`user`?K():L(),sort:e=>e.messageRole},{header:F(),cell:e=>(e.reporterEmail||e.reporterName||`—`)+(e.impersonated&&e.realOperatorEmail?` ${ue({operator:e.realOperatorEmail})}`:``),sort:e=>e.reporterEmail||e.reporterName||null},{header:U(),cell:e=>(0,Z.jsx)($,{matches:e.displayedMatchesStored,sourceWasOpen:e.sourceWasOpen}),sort:e=>e.displayedMatchesStored===!1?0:e.displayedMatchesStored===!0?1:2},{header:P(),cell:e=>e.hasComment?`✎`:`—`,sort:e=>+!!e.hasComment},{header:ce(),cell:e=>e.userClosedAt==null?e.resolvedAt==null?e.answered?(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-ok`,children:G()}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill`,children:M()}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-ok`,title:e.resolvedBy??void 0,children:D()}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-closed`,children:B()}),sort:e=>e.userClosedAt==null?e.resolvedAt==null?+!!e.answered:2:3}],rowActions:e=>[{label:a===e._id?oe():le(),onSelect:()=>void l(e)},{label:I(),onSelect:()=>void u(e),variant:`destructive`}]})]})}export{xe as FeedbacksTab};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./bundle-mjs-C73ZY4La.js";import{E as t,YX as n}from"./api-Ca1H8N44.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,YX as n}from"./api-Ca1H8N44.js";import{B as r,R as i,V as a,mn as o,pn as s,z as c}from"./index-Wii4FZxb.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{$Y as r,AY as ee,BY as i,CY as a,DY as o,EY as s,FY as te,GY as ne,HX as re,HY as c,IY as l,JY as u,KY as d,LY as f,MX as p,MY as ie,NY as ae,OY as oe,PX as se,PY as ce,QY as le,RY as m,SY as ue,TY as de,UV as fe,UY as pe,VX as me,VY as h,WY as he,XY as g,YY as _,ZY as ge,bY as _e,ep as ve,jY as ye,kY as be,qY as xe,t as v,tp as y,vY as b,wY as x,xY as S,yY as C,zY as w}from"./api-Ca1H8N44.js";import{t as T}from"./button-BbEZKLza.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{$Y as r,AY as ee,BY as i,CY as a,DY as o,EY as s,FY as te,GY as ne,HX as re,HY as c,IY as l,JY as u,KY as d,LY as f,MX as p,MY as ie,NY as ae,OY as oe,PX as se,PY as ce,QY as le,RY as m,SY as ue,TY as de,UV as fe,UY as pe,VX as me,VY as h,WY as he,XY as g,YY as _,ZY as ge,bY as _e,ep as ve,jY as ye,kY as be,qY as xe,t as v,tp as y,vY as b,wY as x,xY as S,yY as C,zY as w}from"./api-Ca1H8N44.js";import{t as T}from"./button-BbEZKLza.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-Wii4FZxb.js";import{a as Me,i as B,n as Ne,o as V,r as H,t as Pe}from"./table-BrECCZpB.js";var U=t(e(),1),W=n(),G=`all`;function K(e){switch(e){case`image`:return c();case`audio`:return h();case`video`:return i();case`pdf`:return w();case`document`:return m();case`archive`:return f();default:return l()}}function q(){let[e,t]=(0,U.useState)(G),[n,i]=(0,U.useState)(G),[c,l]=(0,U.useState)(G),[f,m]=(0,U.useState)(G),[h,w]=(0,U.useState)(!1),[q,J]=(0,U.useState)(null),Fe=me(v.files.softDelete),Y=Ee();function Ie(){t(G),i(G),l(G),m(G)}async function Le(){let e=q;if(J(null),e)try{await Fe({fileId:e.id}),Y.success(de())}catch(e){Y.error(x(),e)}}let X=re(v.files.listMine,{direction:e===G?void 0:e,chatId:n===G?void 0:n,instanceName:c===G?void 0:c,category:f===G?void 0:f,includeAutoGenerated:h||void 0}),Re=(0,U.useMemo)(()=>new Intl.DateTimeFormat(se(),{dateStyle:`medium`,timeStyle:`short`}),[]);if(X===void 0)return(0,W.jsx)(`p`,{className:`oc-admin__hint`,children:p()});let{files:Z,facets:Q,truncated:ze,cap:Be}=X,$=e!==G||n!==G||c!==G||f!==G;return(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`p`,{className:`oc-admin__hint`,children:r()}),(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":le(),children:(0,W.jsx)(N,{})}),(0,W.jsxs)(z,{children:[(0,W.jsx)(P,{value:G,children:ge()}),(0,W.jsx)(P,{value:`inbound`,children:g()}),(0,W.jsx)(P,{value:`outbound`,children:_()})]})]}),(0,W.jsxs)(L,{value:n,onValueChange:i,children:[(0,W.jsx)(R,{size:`sm`,"aria-label":u(),children:(0,W.jsx)(N,{})}),(0,W.jsxs)(z,{children:[(0,W.jsx)(P,{value:G,children:xe()}),Q.chats.map(e=>(0,W.jsx)(P,{value:e.id,children:e.title},e.id))]})]}),Q.multiProvider?(0,W.jsxs)(L,{value:c,onValueChange:l,children:[(0,W.jsx)(R,{size:`sm`,"aria-label":d(),children:(0,W.jsx)(N,{})}),(0,W.jsxs)(z,{children:[(0,W.jsx)(P,{value:G,children:ne()}),Q.instances.map(e=>(0,W.jsx)(P,{value:e,children:e},e))]})]}):null,(0,W.jsxs)(L,{value:f,onValueChange:m,children:[(0,W.jsx)(R,{size:`sm`,"aria-label":he(),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:h,onCheckedChange:e=>w(e===!0),"aria-label":y()}),(0,W.jsx)(`span`,{children:y()})]}),$?(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}),oe()]}):null]}),Z.length===0?(0,W.jsx)(`p`,{className:`oc-admin__hint`,children:$?C():_e()}):(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:te()}),(0,W.jsx)(B,{children:ce()}),(0,W.jsx)(B,{children:ae()}),(0,W.jsx)(B,{children:ie()}),(0,W.jsx)(B,{children:ye()}),(0,W.jsx)(B,{className:`text-right`,children:ee()})]})}),(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:ve()}):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`?g():_()})}),(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":o(),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}),be()]})}):(0,W.jsxs)(F,{disabled:!0,children:[(0,W.jsx)(I,{size:14}),S()]}),(0,W.jsxs)(F,{variant:`destructive`,onSelect:()=>J({id:e._id,filename:e.filename}),children:[(0,W.jsx)(E,{size:14}),s()]})]})]})})]},e._id))})]}),ze?(0,W.jsx)(`p`,{className:`oc-admin__hint`,style:{marginTop:8},children:b({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:a()}),(0,W.jsx)(Te,{children:ue()})]}),(0,W.jsxs)(O,{children:[(0,W.jsx)(k,{children:fe()}),(0,W.jsx)(we,{onClick:()=>void Le(),children:s()})]})]})})]})}export{q as FilesTab};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{CC as r,wC as i}from"./api-Ca1H8N44.js";import{t as a}from"./button-BbEZKLza.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{CC as r,wC as i}from"./api-Ca1H8N44.js";import{t as a}from"./button-BbEZKLza.js";import{$t as o,Fn as s,In as c}from"./index-Wii4FZxb.js";import{t as l}from"./TimeRangePicker-BcvPW9JK.js";var u=t(e(),1),d=n(),f=250;function p({q:e,onQChange:t,searchPlaceholder:n=i(),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,{}),r()]})]})}export{p as t};
|