@lacneu/atrium 0.71.6 → 0.72.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/{AccessTab-BtmO9KE5.js → AccessTab-DYrUPmjp.js} +1 -1
- package/dist/assets/{AdvancedFilter-jU8Fbwl1.js → AdvancedFilter-BDVmqtnD.js} +1 -1
- package/dist/assets/{AgentFilesTab-BGKb8PdH.js → AgentFilesTab-kIRg9YDO.js} +1 -1
- package/dist/assets/{AnomaliesTab-C5wgECld.js → AnomaliesTab-b4O_PHhq.js} +1 -1
- package/dist/assets/{AuditTab-BKiJ4_TF.js → AuditTab-DLXQguRl.js} +1 -1
- package/dist/assets/{BridgeTab-TwfICfbD.js → BridgeTab-COOjCey2.js} +1 -1
- package/dist/assets/{ChatDefaultsTab-BPXwe9a0.js → ChatDefaultsTab-DULvhN5B.js} +1 -1
- package/dist/assets/{DataTableShell-CzIcsYvR.js → DataTableShell-vuJDvlum.js} +1 -1
- package/dist/assets/{DetailChips-Rp2S51Jt.js → DetailChips-D-HlZTp-.js} +1 -1
- package/dist/assets/{FeedbacksTab-CVLjIvkF.js → FeedbacksTab-DJn3PSSA.js} +1 -1
- package/dist/assets/{FieldLabel-D4xtReLR.js → FieldLabel-fW5dBj9i.js} +1 -1
- package/dist/assets/{FilesTab-MOlj7wN5.js → FilesTab-iqISoQvw.js} +1 -1
- package/dist/assets/{FilterBar-DZvwFu4q.js → FilterBar-BbF96T8z.js} +1 -1
- package/dist/assets/{GroupsTab-DLfX1phu.js → GroupsTab-COHQgpuq.js} +1 -1
- package/dist/assets/{InstancesTab-B5JkkyhW.js → InstancesTab-DzkWXWDr.js} +1 -1
- package/dist/assets/{IntegrationsTab-DsSTvRj0.js → IntegrationsTab-DhEekkdi.js} +1 -1
- package/dist/assets/{KpiTab-BDHT_iva.js → KpiTab-CM9cHlkw.js} +1 -1
- package/dist/assets/{PreferencesTab-DbUt0619.js → PreferencesTab-BJ_drPlk.js} +1 -1
- package/dist/assets/{ProjectPage-DCgYHfe9.js → ProjectPage-C9ncz-Wz.js} +1 -1
- package/dist/assets/{PromptInjectionsTab-DzPLNbBB.js → PromptInjectionsTab-B4sZi64x.js} +1 -1
- package/dist/assets/{RolesTab-D44zOC0u.js → RolesTab-Bsjz_VFr.js} +1 -1
- package/dist/assets/{ScheduledTab-DUcav25H.js → ScheduledTab-r1YDrEr3.js} +1 -1
- package/dist/assets/{ServiceAccountsTab-CpcKRaaN.js → ServiceAccountsTab-CHBjoJrF.js} +1 -1
- package/dist/assets/{SubAgentReportsTab-BvFCAZ9L.js → SubAgentReportsTab-BoTWB1Sz.js} +1 -1
- package/dist/assets/{ThemeShowroom-BbW3_UsN.js → ThemeShowroom-S86Ia-Tt.js} +1 -1
- package/dist/assets/{TimeRangePicker-RpBi7Yt_.js → TimeRangePicker-BWBSluZX.js} +1 -1
- package/dist/assets/{TimezoneCombobox-DBgAtYNP.js → TimezoneCombobox-B0NcuG2m.js} +1 -1
- package/dist/assets/{TracesTab-A7CPvuRP.js → TracesTab-CnTLWpFj.js} +1 -1
- package/dist/assets/{UsersTab-uVbHVnoK.js → UsersTab-DKG6lmyS.js} +1 -1
- package/dist/assets/{VoiceTab-D6DkG9Za.js → VoiceTab-CS0P6-jO.js} +1 -1
- package/dist/assets/{highlighted-body-OFNGDK62-D5jO1eQM.js → highlighted-body-OFNGDK62-DkEeCM4I.js} +1 -1
- package/dist/assets/{index-Bp13zOvd.js → index-CaP52i63.js} +79 -79
- package/dist/assets/mermaid-GHXKKRXX-OwBbbvqf.js +1 -0
- package/dist/assets/{pdf-joZUl_RJ.js → pdf-BlYP59Fs.js} +1 -1
- package/dist/assets/{tabs-qs6n9nsm.js → tabs-BPua3v_Q.js} +1 -1
- package/dist/index.html +1 -1
- package/package.json +1 -1
- package/dist/assets/mermaid-GHXKKRXX-Q3rL8rUY.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$f as r,GR as i,IR as a,Jf as o,Qf as s,Xf as c,Yf as l,Zf as u,ap as d,ep as f,ip as p,np as m,op as h,qf as g,rp as _,sp as v,t as y,tp as b}from"./api-Dr5hDHvi.js";import{$ as x,Et as S,Q as C,X as w,Z as T,et as E}from"./index-
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$f as r,GR as i,IR as a,Jf as o,Qf as s,Xf as c,Yf as l,Zf as u,ap as d,ep as f,ip as p,np as m,op as h,qf as g,rp as _,sp as v,t as y,tp as b}from"./api-Dr5hDHvi.js";import{$ as x,Et as S,Q as C,X as w,Z as T,et as E}from"./index-CaP52i63.js";var D=t(e(),1);function O(e){return e===`user`?u():e===`all`?c():l({group:e.group})}function k(e){return e===`common`?o():e===`owner`?g():l({group:e.group})}var A=n();function j(e){return e.name||e.email||e.userId.slice(0,8)}function M(){let e=i(y.admin.listUsers,{}),[t,n]=(0,D.useState)(``),o=i(y.introspect.introspectUser,t?{userId:t}:`skip`);return(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:v()}),(0,A.jsxs)(w,{value:t,onValueChange:n,children:[(0,A.jsx)(x,{size:`sm`,"aria-label":h(),children:(0,A.jsx)(E,{placeholder:h()})}),(0,A.jsx)(T,{children:(e??[]).map(e=>(0,A.jsx)(C,{value:e.userId,children:j(e)},e._id))})]}),t===``?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:d()}):o===void 0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:a()}):(0,A.jsxs)(`div`,{className:`oc-introspect`,children:[(0,A.jsxs)(`section`,{className:`oc-introspect__section`,children:[(0,A.jsx)(`h3`,{className:`oc-introspect__title`,children:p()}),(0,A.jsxs)(`div`,{className:`oc-introspect__id`,children:[(0,A.jsx)(`strong`,{children:o.user.label}),(0,A.jsx)(S,{variant:`secondary`,children:o.role})]})]}),(0,A.jsxs)(`section`,{className:`oc-introspect__section`,children:[(0,A.jsx)(`h3`,{className:`oc-introspect__title`,children:_()}),o.groups.length===0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:r()}):(0,A.jsx)(`div`,{className:`oc-introspect__chips`,children:o.groups.map(e=>(0,A.jsx)(S,{variant:`secondary`,children:e.name},e.groupId))})]}),(0,A.jsxs)(`section`,{className:`oc-introspect__section`,children:[(0,A.jsx)(`h3`,{className:`oc-introspect__title`,children:m()}),o.agents.length===0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:r()}):(0,A.jsx)(`ul`,{className:`oc-introspect__list`,children:o.agents.map(e=>(0,A.jsxs)(`li`,{className:`oc-introspect__row`,children:[(0,A.jsx)(`span`,{className:`oc-introspect__name`,children:e.displayName||e.agentId}),e.isDefault?(0,A.jsx)(S,{variant:`default`,children:s()}):null,(0,A.jsx)(S,{variant:`outline`,children:O(e.via)}),(0,A.jsx)(S,{variant:`secondary`,children:e.state})]},`${e.instanceName} ${e.agentId}`))})]}),(0,A.jsxs)(`section`,{className:`oc-introspect__section`,children:[(0,A.jsx)(`h3`,{className:`oc-introspect__title`,children:b()}),o.charts.length===0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:r()}):(0,A.jsx)(`ul`,{className:`oc-introspect__list`,children:o.charts.map(e=>(0,A.jsxs)(`li`,{className:`oc-introspect__row`,children:[(0,A.jsx)(`span`,{className:`oc-introspect__name`,children:e.name}),(0,A.jsx)(S,{variant:`outline`,children:k(e.via)})]},e.key))})]}),(0,A.jsxs)(`section`,{className:`oc-introspect__section`,children:[(0,A.jsx)(`h3`,{className:`oc-introspect__title`,children:f()}),o.permissions.length===0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:r()}):(0,A.jsx)(`div`,{className:`oc-introspect__chips`,children:o.permissions.map(e=>(0,A.jsx)(S,{variant:`secondary`,children:e},e))})]})]})]})}export{M as AccessTab};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Ch as r,Sh as i,bh as a,vh as o,wh as s,xh as c,yh as l}from"./api-Dr5hDHvi.js";import{r as u}from"./dist-B9J3rPRX.js";import{t as d}from"./x-B_mNl1Gq.js";import{t as f}from"./button-BI3fckfr.js";import{$ as p,Q as m,X as h,Z as g,et as _,jt as v,ln as y}from"./index-
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Ch as r,Sh as i,bh as a,vh as o,wh as s,xh as c,yh as l}from"./api-Dr5hDHvi.js";import{r as u}from"./dist-B9J3rPRX.js";import{t as d}from"./x-B_mNl1Gq.js";import{t as f}from"./button-BI3fckfr.js";import{$ as p,Q as m,X as h,Z as g,et as _,jt as v,ln as y}from"./index-CaP52i63.js";import{r as b}from"./TimeRangePicker-BWBSluZX.js";var x=t(e(),1),S=n(),C=[{value:`eq`,label:`=`},{value:`neq`,label:`≠`},{value:`contains`,label:s()},{value:`gt`,label:`>`},{value:`gte`,label:`≥`},{value:`lt`,label:`<`},{value:`lte`,label:`≤`}],w=1;function T(){return{id:w++,field:``,op:`eq`,value:``}}function E(e){return e.map(e=>({id:w++,field:e.field,op:e.op,value:String(e.value)}))}function D({fields:e,seed:t,onChange:n}){let s=(0,x.useRef)(t),w=!!(s.current&&s.current.length>0),[D,O]=(0,x.useState)(w),[k,A]=(0,x.useState)(()=>w?E(s.current):[]);function j(e){n(e.filter(e=>e.field!==``&&e.value!==``).map(e=>({field:e.field,op:e.op,value:b(e.value)})))}function M(e,t){let n=k.map(n=>n.id===e?{...n,...t}:n);A(n),j(n)}function N(){A(e=>[...e,T()])}function P(e){let t=k.filter(t=>t.id!==e);A(t),j(t)}let F=k.filter(e=>e.field!==``&&e.value!==``).length;return(0,S.jsxs)(`div`,{className:`oc-advfilter`,children:[(0,S.jsxs)(`button`,{type:`button`,className:`oc-advfilter__toggle`,"aria-expanded":D,onClick:()=>O(e=>!e),children:[(0,S.jsx)(u,{className:`oc-advfilter__chevron`+(D?` is-open`:``),"aria-hidden":!0}),r(),F>0?(0,S.jsx)(`span`,{className:`oc-advfilter__count`,children:F}):null]}),D?(0,S.jsxs)(`div`,{className:`oc-advfilter__body`,children:[k.length===0?(0,S.jsx)(`p`,{className:`oc-admin__hint`,children:i()}):(0,S.jsx)(`ul`,{className:`oc-advfilter__rows`,children:k.map(t=>(0,S.jsxs)(`li`,{className:`oc-advfilter__row`,children:[(0,S.jsxs)(h,{value:t.field||void 0,onValueChange:e=>M(t.id,{field:e}),children:[(0,S.jsx)(p,{size:`sm`,className:`w-40`,children:(0,S.jsx)(_,{placeholder:c()})}),(0,S.jsx)(g,{children:e.map(e=>(0,S.jsx)(m,{value:e.value,children:e.label},e.value))})]}),(0,S.jsxs)(h,{value:t.op,onValueChange:e=>M(t.id,{op:e}),children:[(0,S.jsx)(p,{size:`sm`,className:`w-28`,children:(0,S.jsx)(_,{})}),(0,S.jsx)(g,{children:C.map(e=>(0,S.jsx)(m,{value:e.value,children:e.label},e.value))})]}),(0,S.jsx)(v,{className:`oc-advfilter__value`,value:t.value,onChange:e=>M(t.id,{value:e.target.value}),placeholder:a()}),(0,S.jsx)(f,{variant:`ghost`,size:`icon-sm`,"aria-label":l(),onClick:()=>P(t.id),children:(0,S.jsx)(d,{})})]},t.id))}),(0,S.jsxs)(f,{variant:`outline`,size:`sm`,className:`oc-advfilter__add`,onClick:N,children:[(0,S.jsx)(y,{}),o()]})]}):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{Aa as r,Au as i,Ca as a,Cd as o,Cu as s,Da as c,Du as l,Ea as u,Eu as d,Fu as f,GR as p,Gi as m,HA as h,HR as g,IR as _,Iu as v,Ji as y,Ki as b,Lu as x,Ma as S,Mu as C,Nu as w,O as T,Oa as E,Ou as ee,Pu as te,RR as ne,Ru as D,Sa as O,Su as k,Ta as A,Td as j,Tu as re,WR as M,Wi as N,Xi as P,Yi as F,_a as I,_u as L,ba as R,bu as z,du as ie,fa as B,fu as V,ga as H,gu as U,ha as ae,hu as oe,ja as W,ju as se,ka as ce,ku as le,ma as G,mu as ue,pa as de,pu as fe,qi as pe,t as K,uu as me,va as he,vu as ge,wa as _e,wu as ve,xa as ye,xu as be,ya as xe,yu as Se,zu as Ce}from"./api-Dr5hDHvi.js";import{t as q}from"./button-BI3fckfr.js";import{$ as we,B as Te,Ct as Ee,Dt as J,Et as De,Q as Oe,St as ke,Tt as Ae,X as je,Z as Me,at as Ne,bt as Pe,et as Fe,nt as Ie,ot as Le,q as Re,rn as Y,rt as ze,tt as Be,vt as Ve,wt as He,xt as Ue,yt as We}from"./index-
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Aa as r,Au as i,Ca as a,Cd as o,Cu as s,Da as c,Du as l,Ea as u,Eu as d,Fu as f,GR as p,Gi as m,HA as h,HR as g,IR as _,Iu as v,Ji as y,Ki as b,Lu as x,Ma as S,Mu as C,Nu as w,O as T,Oa as E,Ou as ee,Pu as te,RR as ne,Ru as D,Sa as O,Su as k,Ta as A,Td as j,Tu as re,WR as M,Wi as N,Xi as P,Yi as F,_a as I,_u as L,ba as R,bu as z,du as ie,fa as B,fu as V,ga as H,gu as U,ha as ae,hu as oe,ja as W,ju as se,ka as ce,ku as le,ma as G,mu as ue,pa as de,pu as fe,qi as pe,t as K,uu as me,va as he,vu as ge,wa as _e,wu as ve,xa as ye,xu as be,ya as xe,yu as Se,zu as Ce}from"./api-Dr5hDHvi.js";import{t as q}from"./button-BI3fckfr.js";import{$ as we,B as Te,Ct as Ee,Dt as J,Et as De,Q as Oe,St as ke,Tt as Ae,X as je,Z as Me,at as Ne,bt as Pe,et as Fe,nt as Ie,ot as Le,q as Re,rn as Y,rt as ze,tt as Be,vt as Ve,wt as He,xt as Ue,yt as We}from"./index-CaP52i63.js";import{n as Ge,t as Ke}from"./curation-CQksaIbm.js";import{i as qe}from"./compatView-Dw2Mg_up.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(K.me.getMe,{host:Re}),t=e?.role===`admin`,n=(e?.permissions??[]).includes(`bridge.read`),r=p(K.admin.listInstances,e!==void 0&&t?{}:`skip`),[a,s]=(0,X.useState)(null);(0,X.useEffect)(()=>{!t||!r||r.length===0||(!a||!r.some(e=>e.name===a))&&s(r[0].name)},[t,r,a]);let u=p(K.agents.listAgentsForInstance,t&&a?{instanceName:a}:`skip`),d=p(K.agents.listMyAgents,e!==void 0&&!t?{}:`skip`),m=(0,X.useMemo)(()=>{if(e!==void 0){if(t)return a===null||u===void 0?r!==void 0&&r.length===0?[]:void 0:u.agents.map(e=>({instanceName:a,agentId:e.agentId,label:`${e.emoji?`${e.emoji} `:``}${e.displayName??e.agentId}`}));if(d!==void 0)return d.map(e=>({instanceName:e.instanceName,agentId:e.agentId,label:`${e.emoji?`${e.emoji} `:``}${e.displayName??e.agentId}`}))}},[e,t,a,u,r,d]),[h,y]=(0,X.useState)(null);(0,X.useEffect)(()=>{!m||m.length===0||(!h||!m.some(e=>$(e)===h))&&y($(m[0]))},[m,h]);let b=m?.find(e=>$(e)===h)??null,S=g(K.agentFiles.listAgentFiles),[O,k]=(0,X.useState)({status:`idle`}),A=b?.instanceName??null,j=b?.agentId??null,re=p(K.compat.forInstance,n&&A!==null?{instanceName:A}:`skip`),M=n&&A!==null?Te(re,`agentFiles`):null,N=M===null?!1:M===`loading`?null:M.blocked,P=(0,X.useCallback)(async()=>{if(!(A===null||j===null)){k({status:`loading`});try{k({status:`done`,files:(await S({instanceName:A,agentId:j})).files})}catch(e){k({status:`error`,dashboardAbsent:tt(e)})}}},[S,A,j]);(0,X.useEffect)(()=>{N===!1&&P()},[P,N]);let[F,I]=(0,X.useState)(null),L=p(K.agentFileCuration.listCurations,t&&A!==null&&j!==null?{instanceName:A,agentId:j}:`skip`),R=p(K.agentFileCuration.curationSettings,t&&A!==null?{instanceName:A}:`skip`),z=g(K.agentFileCuration.requestCuration),[ie,B]=(0,X.useState)(null),[V,H]=(0,X.useState)(null),{toast:U}=J(),ae=(0,X.useMemo)(()=>{let e=new Map;for(let t of L??[])e.has(t.name)||e.set(t.name,t);return e},[L]),oe=(0,X.useCallback)(async e=>{if(!(A===null||j===null)){B(e);try{let t=await z({instanceName:A,agentId:j,name:e,trigger:`manual`});t.ok?U({title:ce(),variant:`success`}):U({title:E({reason:t.reason??`unknown`}),variant:`error`})}catch{U({title:c(),variant:`error`})}finally{B(null)}}},[z,A,j,U]),W=ne(),G=(0,X.useMemo)(()=>new Intl.NumberFormat(W,{maximumFractionDigits:0}),[W]);return e===void 0||m===void 0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:_()}):(0,Q.jsxs)(`div`,{className:`oc-afiles`,children:[(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:Ce()}),(0,Q.jsxs)(`div`,{className:`oc-afiles__picker`,children:[t&&(r?.length??0)>1?(0,Q.jsxs)(je,{value:a??``,onValueChange:e=>s(e),children:[(0,Q.jsx)(we,{size:`sm`,"aria-label":D(),children:(0,Q.jsx)(Fe,{})}),(0,Q.jsx)(Me,{children:(r??[]).map(e=>(0,Q.jsx)(Oe,{value:e.name,children:e.name},e.name))})]}):null,m.length>0?(0,Q.jsxs)(je,{value:h??``,onValueChange:e=>y(e),children:[(0,Q.jsx)(we,{size:`sm`,"aria-label":x(),children:(0,Q.jsx)(Fe,{})}),(0,Q.jsx)(Me,{children:m.map(e=>(0,Q.jsx)(Oe,{value:$(e),children:e.label},$(e)))})]}):(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:v()})]}),b===null?null:M===`loading`?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:_()}):M!==null&&M.blocked?(0,Q.jsxs)(`p`,{className:`oc-compat__blocked`,role:`status`,children:[(0,Q.jsx)(Y,{size:14,"aria-hidden":!0}),` `,qe(M.gatewayVersion,M.provider)]}):O.status===`loading`||O.status===`idle`?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:_()}):O.status===`error`?(0,Q.jsxs)(`p`,{className:`oc-afiles__error`,role:`alert`,children:[O.dashboardAbsent?T():te(),` `,!O.dashboardAbsent&&(0,Q.jsx)(q,{variant:`outline`,size:`sm`,onClick:()=>void P(),children:o()})]}):O.files.length===0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:f()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`div`,{className:`oc-afiles__list`,children:O.files.map(e=>{let n=Xe(e.size),r=n>=80;return(0,Q.jsxs)(`div`,{className:`oc-afiles__row`,children:[(0,Q.jsx)(`span`,{className:`oc-afiles__name`,title:e.name,children:e.name}),e.missing?(0,Q.jsx)(De,{variant:`outline`,children:w()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`span`,{className:`oc-afiles__size`,children:C({size:Z(e.size,W)})}),(0,Q.jsx)(`span`,{className:`oc-afiles__gauge${r?` is-warn`:``}`,"aria-hidden":!0,children:(0,Q.jsx)(`span`,{className:`oc-afiles__gauge-fill`,style:{width:`${Math.min(n,100)}%`}})}),(0,Q.jsx)(`span`,{className:`oc-afiles__pct`,children:se({pct:G.format(n)})}),r?(0,Q.jsx)(Y,{size:14,className:`oc-afiles__warn`,"aria-label":i()}):(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:()=>I(e),children:t?ee():l()}),t&&!e.missing?(0,Q.jsx)(it,{curatable:Ke.includes(e.name),size:e.size??0,budget:R?.budgetChars??null,enabled:R?.enabled??!1,curation:ae.get(e.name)??null,inFlight:ie===e.name,onCurate:()=>void oe(e.name),onReview:e=>H(e)}):null]},e.name)})}),(0,Q.jsx)(`p`,{className:`oc-afiles__budget`,children:le({used:Z(Qe(O.files),W),total:Z(Ye,W),pct:G.format(Ze(Qe(O.files)))})})]}),F&&b?(0,Q.jsx)(at,{instanceName:b.instanceName,agentId:b.agentId,name:F.name,isAdmin:t,onClose:()=>I(null),onSaved:()=>void P()}):null,V?(0,Q.jsx)(ot,{curationId:V,onClose:()=>H(null),onApplied:()=>{H(null),P()}}):null]})}function it({curatable:e,size:t,budget:n,enabled:i,curation:a,inFlight:o,onCurate:s,onReview:c}){return a?.status===`proposed`?(0,Q.jsx)(q,{variant:`default`,size:`sm`,className:`oc-afiles__curate`,onClick:()=>c(a._id),children:W()}):o||a?.status===`dispatched`||a?.status===`applying`?(0,Q.jsx)(De,{variant:`outline`,className:`oc-afiles__curate-status`,children:r()}):e&&i&&n!==null&&Ge(t,n)?(0,Q.jsx)(q,{variant:`outline`,size:`sm`,className:`oc-afiles__curate`,onClick:s,children:S()}):null}function at({instanceName:e,agentId:t,name:n,isAdmin:r,onClose:i,onSaved:a}){let c=g(K.agentFiles.getAgentFile),l=g(K.agentFiles.setAgentFile),u=J(),[f,p]=(0,X.useState)(null),[m,v]=(0,X.useState)(!1),[y,b]=(0,X.useState)(``),[x,S]=(0,X.useState)(!1),[C,w]=(0,X.useState)(!1),[T,E]=(0,X.useState)(!1),[ee,te]=(0,X.useState)(!1),D=(0,X.useCallback)(async r=>{v(!1);try{let i=await c({instanceName:e,agentId:t,name:n});p({content:i.content,updatedAtMs:i.updatedAtMs}),r||b(i.content),E(!1)}catch{v(!0)}},[c,e,t,n]);(0,X.useEffect)(()=>{D(!1)},[D]);async function O(){if(f!==null){w(!0),te(!1);try{await l({instanceName:e,agentId:t,name:n,content:y,baseUpdatedAtMs:f.updatedAtMs??void 0}),u.success(z({name:n})),a(),await D(!1)}catch(e){nt(e)?E(!0):te(!0)}finally{w(!1)}}}let A=f!==null&&y!==f.content,M=(0,X.useMemo)(()=>f===null?null:et(f.content,y),[f,y]),N=y.length>Je,P=ne(),F=(0,X.useMemo)(()=>new Intl.NumberFormat(P),[P]);return(0,Q.jsx)(Be,{open:!0,onOpenChange:e=>!e&&i(),children:(0,Q.jsxs)(Ie,{className:`oc-afiles__editor`,children:[(0,Q.jsxs)(Ne,{children:[(0,Q.jsx)(Le,{children:d({name:n})}),(0,Q.jsxs)(ze,{children:[re({agent:t,instance:e}),r?null:(0,Q.jsxs)(Q.Fragment,{children:[` · `,ve()]})]})]}),m?(0,Q.jsxs)(`p`,{className:`oc-afiles__error`,role:`alert`,children:[ge(),` `,(0,Q.jsx)(q,{variant:`outline`,size:`sm`,onClick:()=>void D(!1),children:o()})]}):f===null?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:_()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`textarea`,{className:`oc-afiles__source`,value:y,readOnly:!r,spellCheck:!1,onChange:e=>b(e.target.value),"aria-label":d({name:n})}),(0,Q.jsx)(`p`,{className:`oc-afiles__hint`,children:s()}),T?(0,Q.jsxs)(`p`,{className:`oc-afiles__error`,role:`alert`,children:[L(),` `,(0,Q.jsx)(q,{variant:`outline`,size:`sm`,onClick:()=>void D(!0),children:U()})]}):null,ee?(0,Q.jsx)(`p`,{className:`oc-afiles__error`,role:`alert`,children:Se()}):null,(0,Q.jsxs)(`div`,{className:`oc-afiles__editor-foot`,children:[(0,Q.jsx)(`span`,{className:`oc-afiles__count${N?` is-over`:``}`,children:k({count:F.format(y.length),max:F.format(Je)})}),r?(0,Q.jsx)(q,{size:`sm`,disabled:!A||C||T,onClick:()=>S(!0),children:C?j():be()}):null]})]}),(0,Q.jsx)(Ve,{open:x,onOpenChange:S,children:(0,Q.jsxs)(Ue,{children:[(0,Q.jsxs)(He,{children:[(0,Q.jsx)(Ae,{children:oe({name:n})}),(0,Q.jsx)(ke,{children:ue({agent:t})})]}),M?(0,Q.jsxs)(`div`,{className:`oc-afiles__diff`,children:[(0,Q.jsx)(`p`,{className:`oc-afiles__diff-counts`,children:fe({added:M.added,removed:M.removed})}),M.sampleAdded.length>0?(0,Q.jsxs)(`div`,{className:`oc-afiles__diff-block`,children:[(0,Q.jsx)(`span`,{className:`oc-afiles__diff-label`,children:V()}),M.sampleAdded.map((e,t)=>(0,Q.jsx)(`code`,{className:`oc-afiles__diff-line is-add`,children:e||` `},t))]}):null,M.sampleRemoved.length>0?(0,Q.jsxs)(`div`,{className:`oc-afiles__diff-block`,children:[(0,Q.jsx)(`span`,{className:`oc-afiles__diff-label`,children:ie()}),M.sampleRemoved.map((e,t)=>(0,Q.jsx)(`code`,{className:`oc-afiles__diff-line is-del`,children:e||` `},t))]}):null]}):null,(0,Q.jsxs)(Ee,{children:[(0,Q.jsx)(Pe,{children:h()}),(0,Q.jsx)(We,{onClick:()=>void O(),children:me()})]})]})})]})})}function ot({curationId:e,onClose:t,onApplied:n}){let r=p(K.agentFileCuration.getProposal,{curationId:e}),i=g(K.agentFileCuration.approveCuration),o=M(K.agentFileCuration.rejectCuration),{toast:s}=J(),[l,d]=(0,X.useState)(null),[f,h]=(0,X.useState)(!1),[v,x]=(0,X.useState)(``),S=ne(),C=(0,X.useMemo)(()=>r?et(r.beforeContent,r.proposedContent):null,[r]);async function w(){d(`approve`);try{let t=await i({curationId:e});t.ok?(s({title:u(),variant:`success`}),n()):s({title:t.reason===`conflict`?_e():a({reason:t.reason??`unknown`}),variant:`error`})}catch{s({title:c(),variant:`error`})}finally{d(null)}}async function T(n){d(`reject`);try{let r=v.trim();(await o({curationId:e,...r?{comment:r}:{},relaunch:n})).ok?s({title:n?m():A(),variant:`success`}):s({title:R(),variant:`error`}),t()}catch{s({title:c(),variant:`error`})}finally{d(null)}}return(0,Q.jsx)(Be,{open:!0,onOpenChange:e=>e?void 0:t(),children:(0,Q.jsxs)(Ie,{className:`oc-afiles__review`,children:[(0,Q.jsxs)(Ne,{children:[(0,Q.jsx)(Le,{children:r?O({name:r.name}):_()}),(0,Q.jsx)(ze,{children:ye()})]}),r===void 0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:_()}):r===null?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:R()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`p`,{className:`oc-afiles__review-sizes`,children:[xe({before:Z(r.beforeSize,S),after:Z(r.proposedSize,S)}),r.overBudget?(0,Q.jsxs)(Q.Fragment,{children:[` `,(0,Q.jsx)(Y,{size:13,"aria-hidden":!0}),` `,he()]}):null]}),C?(0,Q.jsx)(`p`,{className:`oc-afiles__review-diff`,children:I({added:C.added,removed:C.removed})}):null,r.feedback?(0,Q.jsx)(`p`,{className:`oc-afiles__review-feedback`,children:N({feedback:r.feedback})}):null,C&&C.sampleRemoved.length>0?(0,Q.jsxs)(`div`,{className:`oc-afiles__review-removed`,children:[(0,Q.jsx)(`p`,{className:`oc-afiles__review-label`,children:B()}),(0,Q.jsx)(`ul`,{children:C.sampleRemoved.map((e,t)=>(0,Q.jsx)(`li`,{children:e||`\xA0`},t))})]}):null,(0,Q.jsxs)(`div`,{className:`oc-afiles__review-panes oc-afiles__review-panes--2`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`p`,{className:`oc-afiles__review-label`,children:de()}),(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:H()}),(0,Q.jsx)(`pre`,{className:`oc-afiles__review-pre`,children:r.proposedContent})]})]})]}),f?(0,Q.jsxs)(`div`,{className:`oc-afiles__reject-form`,children:[(0,Q.jsx)(`label`,{className:`oc-afiles__review-label`,htmlFor:`curation-reject-comment`,children:P()}),(0,Q.jsx)(`textarea`,{id:`curation-reject-comment`,className:`oc-afiles__reject-textarea`,rows:3,placeholder:F(),value:v,onChange:e=>x(e.target.value)}),(0,Q.jsxs)(`div`,{className:`oc-afiles__review-actions`,children:[(0,Q.jsx)(q,{variant:`ghost`,onClick:()=>h(!1),disabled:l!==null,children:y()}),(0,Q.jsx)(q,{variant:`outline`,onClick:()=>void T(!1),disabled:l!==null,children:l===`reject`?j():pe()}),(0,Q.jsx)(q,{variant:`default`,onClick:()=>void T(!0),disabled:l!==null,children:l===`reject`?j():b()})]})]}):(0,Q.jsxs)(`div`,{className:`oc-afiles__review-actions`,children:[(0,Q.jsx)(q,{variant:`outline`,onClick:()=>h(!0),disabled:l!==null||r==null,children:ae()}),(0,Q.jsx)(q,{variant:`default`,onClick:()=>void w(),disabled:l!==null||r==null,children:l===`approve`?j():G()})]})]})})}export{rt as AgentFilesTab};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$S as r,AS as i,BS as ee,CS as a,DS as te,ES as o,FS as s,GR as c,GS as ne,HS as l,IS as re,JS as ie,KS as ae,LS as u,MS as oe,NS as se,OS as ce,PS as le,QS as ue,RS as de,SS as d,TS as fe,US as pe,VS as me,WR as he,WS as f,XS as ge,YS as p,ZS as m,_S as h,aC as g,bS as _,cC as _e,dC as v,eC as ve,gS as y,iC as ye,jS as be,kS as xe,lC as b,nC as Se,oC as x,qS as S,rC as C,sC as w,t as T,tC as E,uC as D,vS as O,wS as k,xS as A,yS as j,zS as Ce}from"./api-Dr5hDHvi.js";import{$ as M,Dt as we,Et as N,Fn as Te,Pn as P,Q as F,U as Ee,X as I,Z as L,at as R,ct as z,et as B,i as De,nt as V,o as Oe,ot as H,q as ke,tt as U}from"./index-
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$S as r,AS as i,BS as ee,CS as a,DS as te,ES as o,FS as s,GR as c,GS as ne,HS as l,IS as re,JS as ie,KS as ae,LS as u,MS as oe,NS as se,OS as ce,PS as le,QS as ue,RS as de,SS as d,TS as fe,US as pe,VS as me,WR as he,WS as f,XS as ge,YS as p,ZS as m,_S as h,aC as g,bS as _,cC as _e,dC as v,eC as ve,gS as y,iC as ye,jS as be,kS as xe,lC as b,nC as Se,oC as x,qS as S,rC as C,sC as w,t as T,tC as E,uC as D,vS as O,wS as k,xS as A,yS as j,zS as Ce}from"./api-Dr5hDHvi.js";import{$ as M,Dt as we,Et as N,Fn as Te,Pn as P,Q as F,U as Ee,X as I,Z as L,at as R,ct as z,et as B,i as De,nt as V,o as Oe,ot as H,q as ke,tt as U}from"./index-CaP52i63.js";import{n as Ae}from"./TimeRangePicker-BWBSluZX.js";import{t as je}from"./FilterBar-BbF96T8z.js";import{t as Me}from"./DataTableShell-vuJDvlum.js";import{t as W}from"./dispatchErrorInfo-CvAG5Yps.js";var G=t(e(),1),K=n(),q=`__all__`,Ne=[{value:`open`},{value:`acknowledged`},{value:`resolved`}];function Pe(e){return e===`open`?v():e===`acknowledged`?D():b()}var Fe=[`info`,`warn`,`critical`],Ie=[`detector`,`agent`,`user`],Le={kind:`relative`,from:`now-30d`,to:`now`},Re=200,J=`all`;function Y(){let e=Te({from:`/settings/anomalies`}),t=P({from:`/settings/anomalies`}),n=e.q??``,a=e.status===J?q:e.status,d=e.severity??q,h=e.kind??q,[_,v]=(0,G.useState)(q),y=De(e.from,e.to),{from:b,to:D}=Ae(y),O=e=>void t({search:t=>({...t,q:e||void 0}),replace:!0}),A=e=>void t({search:t=>({...t,status:e===q?J:e})}),j=e=>void t({search:t=>({...t,severity:e===q?void 0:e})}),R=e=>void t({search:t=>({...t,kind:e===q?void 0:e})}),V=e=>void t({search:t=>({...t,...Oe(e)})}),H=Ee(),U=we(),W=he(T.anomalies.resolveAnomaly),Y=(c(T.me.getMe,{host:ke})?.permissions??[]).includes(`admin.manage`),X=c(T.anomalies.listAnomalies,{limit:Re,filter:{q:n||void 0,from:b,to:D,anomalyStatus:a===q?void 0:a,severity:d===q?void 0:d,source:_===q?void 0:_,kind:h===q?void 0:h}}),Z=(0,G.useMemo)(()=>{let e=new Set;for(let t of X??[])e.add(t.kind);return[...e].sort()},[X]),Q=n!==``||a!==`open`||d!==q||_!==q||h!==q||y.kind!==`relative`||y.from!==Le.from;function Ue(){v(q),t({search:{status:`open`},replace:!0})}async function We(e){if(await H({title:_e(),description:(0,K.jsxs)(K.Fragment,{children:[w(),` `,(0,K.jsx)(`span`,{className:`font-mono`,children:e.kind}),` `,x(),` `,(0,K.jsx)(`strong`,{children:g()}),`.`,` `,ye()]}),confirmLabel:C()}))try{await W({anomalyId:e._id,status:`resolved`}),U.success(Se(),e.kind)}catch(e){U.error(E(),e)}}async function Ge(e){try{await W({anomalyId:e._id,status:`acknowledged`}),U.success(ve(),e.kind)}catch(e){U.error(r(),e)}}return(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)(`p`,{className:`oc-admin__hint`,children:[ue(),` `,(0,K.jsx)(`strong`,{children:m()}),` `,ge(),` `,(0,K.jsx)(`strong`,{children:p()}),` `,ie(),` `,(0,K.jsx)(`strong`,{children:S()}),` `,ae(),` `,(0,K.jsx)(`span`,{className:`oc-filter__window`,children:ne()})]}),(0,K.jsxs)(je,{q:n,onQChange:O,searchPlaceholder:f(),timeRange:y,onTimeRangeChange:V,onReset:Ue,canReset:Q,children:[(0,K.jsxs)(I,{value:a,onValueChange:A,children:[(0,K.jsx)(M,{size:`sm`,className:`w-36`,children:(0,K.jsx)(B,{})}),(0,K.jsxs)(L,{children:[(0,K.jsx)(F,{value:q,children:pe()}),Ne.map(e=>(0,K.jsx)(F,{value:e.value,children:Pe(e.value)},e.value))]})]}),(0,K.jsxs)(I,{value:d,onValueChange:j,children:[(0,K.jsx)(M,{size:`sm`,className:`w-36`,children:(0,K.jsx)(B,{placeholder:l()})}),(0,K.jsxs)(L,{children:[(0,K.jsx)(F,{value:q,children:de()}),Fe.map(e=>(0,K.jsx)(F,{value:e,children:e},e))]})]}),(0,K.jsxs)(I,{value:_,onValueChange:v,children:[(0,K.jsx)(M,{size:`sm`,className:`w-32`,children:(0,K.jsx)(B,{placeholder:u()})}),(0,K.jsxs)(L,{children:[(0,K.jsx)(F,{value:q,children:re()}),Ie.map(e=>(0,K.jsx)(F,{value:e,children:e},e))]})]}),(0,K.jsxs)(I,{value:h,onValueChange:R,children:[(0,K.jsx)(M,{size:`sm`,className:`w-36`,children:(0,K.jsx)(B,{placeholder:s()})}),(0,K.jsxs)(L,{children:[(0,K.jsx)(F,{value:q,children:le()}),Z.map(e=>(0,K.jsx)(F,{value:e,children:e},e))]})]})]}),(0,K.jsx)(Me,{title:se(),rows:X,emptyHint:a===`open`?oe():be(),rowActions:e=>Y&&e.status===`open`?[{label:i(),onSelect:()=>void We(e)},{label:xe(),onSelect:()=>void Ge(e)}]:[],columns:[{header:ce(),cell:e=>(0,K.jsx)(`span`,{className:`oc-traces__time`,children:z(e.at)}),sort:e=>e.at},{header:s(),cell:e=>(0,K.jsx)(`code`,{className:`oc-traces__mono`,children:e.kind}),sort:e=>e.kind},{header:me(),cell:e=>e.occurrenceCount!==null&&e.occurrenceCount>1?(0,K.jsx)(`span`,{className:`oc-traces__time`,title:e.firstAt===null?void 0:Ce({when:z(e.firstAt)}),children:ee({count:String(e.occurrenceCount)})}):(0,K.jsx)(`span`,{className:`oc-traces__time`,children:`—`}),sort:e=>e.occurrenceCount??0},{header:l(),cell:e=>(0,K.jsx)(Be,{severity:e.severity}),sort:e=>e.severity===`critical`?2:+(e.severity===`warn`)},{header:te(),cell:e=>(0,K.jsx)(Ve,{status:e.status}),sort:e=>e.status===`resolved`?2:+(e.status===`acknowledged`)},{header:u(),cell:e=>(0,K.jsx)(N,{variant:`outline`,children:e.source}),sort:e=>e.source},{header:o(),cell:e=>(0,K.jsxs)(`div`,{className:`oc-anomaly__msgcell`,children:[(0,K.jsx)(`span`,{className:`oc-anomaly__msg`,children:e.message}),(0,K.jsx)($,{row:e})]}),sort:e=>e.message},{header:fe(),cell:e=>(0,K.jsx)(ze,{row:e}),sort:e=>e.evidence??null},{header:k(),cell:e=>e.correlationId?(0,K.jsx)(`code`,{className:`oc-traces__mono`,children:He(e.correlationId)}):(0,K.jsx)(`span`,{className:`oc-traces__muted`,children:`—`}),sort:e=>e.correlationId}]})]})}var X=new Set([`openclaw.dispatch_failures`,`assistant.announce_errors`]);function Z(e){if(!X.has(e.kind)||!e.evidence)return{};try{let t=JSON.parse(e.evidence);return{dominantCode:t.dominantCode,sampleCorrelationId:t.sampleCorrelationId}}catch{return{}}}function Q(e){if(e.kind!==`subagent.failure`||!e.evidence)return{};try{let t=JSON.parse(e.evidence);return{failedCount:t.failedCount,totalCount:t.totalCount,errorCategories:t.errorCategories}}catch{return{}}}function ze({row:e}){let t=P();if(e.kind===`subagent.failure`){let n=Q(e);return(0,K.jsxs)(`div`,{className:`oc-anomaly__cause`,children:[(0,K.jsx)(`div`,{className:`oc-anomaly__cause-head`,children:[...new Set(n.errorCategories??[])].map(e=>(0,K.jsx)(`code`,{className:`oc-traces__mono`,children:e},e))}),e.correlationId?(0,K.jsxs)(`button`,{type:`button`,className:`oc-anomaly__drill`,onClick:()=>void t({to:`/settings/traces`,search:{q:e.correlationId,limit:100}}),children:[`↗ `,a()]}):null]})}let n=Z(e);if(!n.dominantCode){let e=n.sampleCorrelationId;return e?(0,K.jsx)(`div`,{className:`oc-anomaly__cause`,children:(0,K.jsxs)(`button`,{type:`button`,className:`oc-anomaly__drill`,onClick:()=>void t({to:`/settings/traces`,search:{correlationId:e,limit:100}}),children:[`↗ `,a()]})}):(0,K.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})}let r=W(n.dominantCode),i=n.sampleCorrelationId;return(0,K.jsxs)(`div`,{className:`oc-anomaly__cause`,children:[(0,K.jsxs)(`div`,{className:`oc-anomaly__cause-head`,children:[(0,K.jsx)(`span`,{className:`oc-anomaly__cause-label`,children:r.label}),(0,K.jsx)(`code`,{className:`oc-traces__mono`,children:n.dominantCode})]}),(0,K.jsx)(`p`,{className:`oc-anomaly__cause-hint`,children:r.hint}),i?(0,K.jsxs)(`button`,{type:`button`,className:`oc-anomaly__drill`,onClick:()=>void t({to:`/settings/traces`,search:{correlationId:i,limit:100}}),children:[`↗ `,a()]}):null]})}function $({row:e}){let[t,n]=(0,G.useState)(!1),r=c(T.anomalies.getAnomalyAttachments,t?{anomalyId:e._id}:`skip`);return!e.attachments||e.attachments.length===0?null:(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)(`button`,{type:`button`,className:`oc-anomaly__drill`,onClick:()=>n(!0),children:[d(),e.attachments.length>1?` (${e.attachments.length})`:``]}),(0,K.jsx)(U,{open:t,onOpenChange:n,children:(0,K.jsxs)(V,{className:`oc-anomaly__attachments-dialog`,children:[(0,K.jsx)(R,{children:(0,K.jsx)(H,{children:A()})}),r===void 0?(0,K.jsx)(`p`,{className:`oc-traces__muted`,children:_()}):r.length===0?(0,K.jsx)(`p`,{className:`oc-traces__muted`,children:j()}):(0,K.jsx)(`div`,{className:`oc-anomaly__attachments`,children:r.map(e=>(0,K.jsxs)(`section`,{className:`oc-anomaly__attachment`,children:[(0,K.jsx)(`h4`,{className:`oc-anomaly__attachment-name`,children:(0,K.jsx)(`code`,{className:`oc-traces__mono`,children:e.name})}),(0,K.jsx)(`pre`,{className:`oc-anomaly__attachment-content`,children:e.content})]},e.name))})]})})]})}function Be({severity:e}){return(0,K.jsx)(`span`,{className:`oc-anomaly__sev oc-anomaly__sev--${e}`,children:e})}function Ve({status:e}){return e===`open`?(0,K.jsx)(N,{variant:`destructive`,children:O()}):e===`acknowledged`?(0,K.jsx)(N,{variant:`secondary`,children:h()}):(0,K.jsx)(N,{variant:`outline`,children:y()})}function He(e){return e.length>8?e.slice(0,8):e}export{Y as AnomaliesTab};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{GR as r,Gr as i,Hr as a,Kr as o,Ur as s,Vr as c,Wr as l,aw as u,cw as d,dw as f,fw as p,gw as m,hw as h,iw as g,lw as _,mw as v,nw as y,ow as b,pw as x,rw as S,sw as C,t as w,uw as T}from"./api-Dr5hDHvi.js";import{$ as E,Fn as D,Pn as O,Q as k,X as A,Z as j,a as M,ct as N,et as P,i as F,n as I,o as L,s as R}from"./index-
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{GR as r,Gr as i,Hr as a,Kr as o,Ur as s,Vr as c,Wr as l,aw as u,cw as d,dw as f,fw as p,gw as m,hw as h,iw as g,lw as _,mw as v,nw as y,ow as b,pw as x,rw as S,sw as C,t as w,uw as T}from"./api-Dr5hDHvi.js";import{$ as E,Fn as D,Pn as O,Q as k,X as A,Z as j,a as M,ct as N,et as P,i as F,n as I,o as L,s as R}from"./index-CaP52i63.js";import{n as ee}from"./TimeRangePicker-BWBSluZX.js";import{t as z}from"./FilterBar-BbF96T8z.js";import{t as B}from"./AdvancedFilter-BDVmqtnD.js";import{t as V}from"./DataTableShell-vuJDvlum.js";var H=t(e(),1),U=n(),W={kind:`relative`,from:I,to:`now`},G=`__all__`,K=[{value:`action`,label:o()},{value:`realLabel`,label:i()},{value:`targetLabel`,label:l()},{value:`impersonated`,label:s()},{value:`resource`,label:a()},{value:`resourceId`,label:c()}];function q(){let e=D({from:`/settings/audit`}),t=O({from:`/settings/audit`}),n=e.q??``,i=e.action??G,a=e.impersonated??G,o=e.resource??G,s=F(e.from,e.to),c=(0,H.useMemo)(()=>R(e.adv),[e.adv]),{from:l,to:I}=ee(s),q=e=>void t({search:t=>({...t,q:e||void 0}),replace:!0}),J=e=>void t({search:t=>({...t,action:e===G?void 0:e})}),Y=e=>void t({search:t=>({...t,impersonated:e===G?void 0:e})}),X=e=>void t({search:t=>({...t,resource:e===G?void 0:e})}),Z=e=>void t({search:t=>({...t,...L(e)})}),Q=e=>void t({search:t=>({...t,adv:M(e)}),replace:!0}),$=r(w.admin.listAudit,{filter:{q:n||void 0,from:l,to:I,action:i===G?void 0:i,resource:o===G?void 0:o,impersonated:a===G?void 0:a===`yes`,advanced:c.length>0?c:void 0}}),te=(0,H.useMemo)(()=>{let e=new Set;for(let t of $??[])e.add(t.action);return[...e].sort()},[$]),ne=(0,H.useMemo)(()=>{let e=new Set;for(let t of $??[])t.resource&&e.add(t.resource);return[...e].sort()},[$]),re=n!==``||i!==G||a!==G||o!==G||c.length>0||s.kind!==`relative`||s.from!==W.from;function ie(){t({search:{},replace:!0})}return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(`p`,{className:`oc-admin__hint`,children:[m(),` `,(0,U.jsx)(`span`,{className:`oc-filter__window`,children:h()})]}),(0,U.jsxs)(z,{q:n,onQChange:q,searchPlaceholder:v(),timeRange:s,onTimeRangeChange:Z,onReset:ie,canReset:re,children:[(0,U.jsxs)(A,{value:i,onValueChange:J,children:[(0,U.jsx)(E,{size:`sm`,className:`w-40`,children:(0,U.jsx)(P,{placeholder:x()})}),(0,U.jsxs)(j,{children:[(0,U.jsx)(k,{value:G,children:p()}),te.map(e=>(0,U.jsx)(k,{value:e,children:e},e))]})]}),(0,U.jsxs)(A,{value:a,onValueChange:Y,children:[(0,U.jsx)(E,{size:`sm`,className:`w-40`,children:(0,U.jsx)(P,{})}),(0,U.jsxs)(j,{children:[(0,U.jsx)(k,{value:G,children:f()}),(0,U.jsx)(k,{value:`yes`,children:T()}),(0,U.jsx)(k,{value:`no`,children:_()})]})]}),(0,U.jsxs)(A,{value:o,onValueChange:X,children:[(0,U.jsx)(E,{size:`sm`,className:`w-40`,children:(0,U.jsx)(P,{placeholder:d()})}),(0,U.jsxs)(j,{children:[(0,U.jsx)(k,{value:G,children:C()}),ne.map(e=>(0,U.jsx)(k,{value:e,children:e},e))]})]})]}),(0,U.jsx)(B,{fields:K,seed:c,onChange:Q}),(0,U.jsx)(V,{title:b(),rows:$,emptyHint:u(),columns:[{header:g(),cell:e=>N(e.at),sort:e=>e.at},{header:x(),cell:e=>e.action,sort:e=>e.action},{header:S(),cell:e=>e.realLabel,sort:e=>e.realLabel},{header:y(),cell:e=>e.targetLabel??`—`,sort:e=>e.targetLabel??null},{header:d(),cell:e=>e.resource?e.resource+(e.resourceId?` · ${e.resourceId.slice(0,8)}`:``):`—`,sort:e=>e.resource??null}]})]})}export{q as AuditTab};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$l as r,$v as i,Ay as a,Bv as o,Cy as s,D as c,Dy as l,Ey as u,Fy as d,GR as f,Gl as p,Gv as m,HR as h,Hl as g,Hv as _,Iy as ee,Jl as v,Jv as y,Kl as b,Kv as x,Ll as S,My as te,Ny as ne,Oy as re,Py as ie,Ql as ae,Qv as C,Rv as oe,Sy as se,Ty as ce,Ul as le,Uv as ue,Vl as de,Vv as fe,WR as pe,Wl as me,Wv as he,Xl as ge,Xv as _e,Yl as ve,Yv as ye,Zl as be,Zv as xe,_b as Se,_y as Ce,ab as we,ay as Te,by as Ee,cb as De,cy as Oe,db as ke,dr as Ae,dy as je,ey as Me,fb as Ne,fr as Pe,fy as Fe,gr as Ie,gy as Le,hb as Re,hy as ze,ib as Be,iy as Ve,jy as He,k as Ue,ky as We,lb as Ge,lr as Ke,ly as qe,mb as Je,my as Ye,ny as Xe,oy as Ze,pb as Qe,pr as $e,py as et,ql as tt,qv as nt,ry as rt,sy as it,t as w,ty as at,ub as ot,ur as st,uy as ct,vb as lt,vy as ut,wy as dt,xy as ft,yy as pt,zv as mt}from"./api-Dr5hDHvi.js";import{r as T}from"./dist-B9J3rPRX.js";import{t as ht}from"./chevron-up-BwcZQhBy.js";import{t as gt}from"./chevrons-up-down-DBgS9XVd.js";import{i as _t,n as E,o as vt,r as yt,s as bt}from"./FieldLabel-D4xtReLR.js";import{i as xt,n as St,r as Ct,t as wt}from"./tabs-qs6n9nsm.js";import{t as D}from"./button-BI3fckfr.js";import{$ as O,An as Tt,Bt as Et,Dt,Et as k,F as Ot,Fn as kt,Pn as A,Q as j,Rt as At,X as M,Z as N,at as jt,bn as Mt,ct as Nt,et as P,jn as Pt,jt as F,lt as I,nt as Ft,on as It,ot as Lt,q as Rt,rn as L,rt as zt,tt as Bt,ut as Vt,zt as Ht}from"./index-Bp13zOvd.js";import{r as Ut}from"./locales-CPjguROj.js";import{a as Wt,i as R,n as Gt,o as z,r as B,t as V}from"./table-CH0obeXz.js";import{t as Kt}from"./FilterBar-DZvwFu4q.js";import{a as H,n as qt,o as U,r as W,s as Jt,t as Yt}from"./compatView-Dw2Mg_up.js";import{t as G}from"./dispatchErrorInfo-CvAG5Yps.js";var Xt=c(`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`}]]),Zt=c(`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`}]]),K=t(e(),1);function Qt(e){return e.filter(e=>e.state===`error`)}function $t(e){return e.reachable&&Qt(e.targets).length===0}function en(e){return $t(e)?(e.unreachableInstances??[]).length>0?`gateways_unreachable`:`ok`:`error`}function tn(e){return e.state===`error`&&e.lastErrorCode!==null}function nn(e){return!!e.lastDownstreamRejectCode}function q(e){return e.kind??`openclaw`}function rn(e){return[...e].sort((e,t)=>e===`openclaw`?-1:t===`openclaw`?1:e.localeCompare(t))}function an(e,t,n){let r=new Map;for(let e of t)e.instanceName&&r.set(e.instanceName,e.provider);for(let e of n)r.set(e.name,q(e));let i=e=>(e.instanceName?r.get(e.instanceName):void 0)??`openclaw`,a=new Set;for(let e of n)a.add(q(e));for(let e of t)a.add(e.provider);for(let t of e)a.add(i(t));return rn(a).map(r=>({key:r,connections:e.filter(e=>i(e)===r),compatTargets:t.filter(e=>e.provider===r),instances:n.filter(e=>q(e)===r)}))}function J(e){return e===`openclaw`?`OpenClaw`:e===`hermes`?`Hermes`:e.charAt(0).toUpperCase()+e.slice(1)}var Y=`__all__`,on={q:``,state:Y,instance:Y,version:Y},X={connected:0,error:1,idle:2};function sn(e){return e.q.trim()!==``||e.state!==`__all__`||e.instance!==`__all__`||e.version!==`__all__`}function cn(e,t){let n=t.q.trim().toLowerCase();return e.filter(e=>!(n&&!`${e.targetLabel} ${e.gatewayHost}`.toLowerCase().includes(n)||t.state!==`__all__`&&e.state!==t.state||t.instance!==`__all__`&&(e.instanceName??``)!==t.instance||t.version!==`__all__`&&(e.gatewayVersion??``)!==t.version))}function Z(e,t){return e.localeCompare(t,void 0,{numeric:!0,sensitivity:`base`})}function ln(e,t){return e===`version`?t.gatewayVersion===null:e===`lastOk`?t.lastOkAt===null:!1}function un(e,t,n){switch(e){case`state`:return(X[t.state]??99)-(X[n.state]??99);case`instance`:return Z(t.instanceLabel??t.instanceName??``,n.instanceLabel??n.instanceName??``);case`host`:return Z(t.gatewayHost,n.gatewayHost);case`version`:{let e=t.gatewayVersion,r=n.gatewayVersion;return U(e,r)??Z(e,r)}case`lastOk`:return t.lastOkAt-n.lastOkAt;default:return Z(t.targetLabel,n.targetLabel)}}function dn(e,t){if(!t)return e;let n=t.dir===`asc`?1:-1;return[...e].sort((e,r)=>{let i=ln(t.key,e),a=ln(t.key,r);return i&&a?0:i?1:a?-1:n*un(t.key,e,r)})}function fn(e){let t=new Set;for(let n of e)t.add(n.state);return[...t].sort((e,t)=>(X[e]??99)-(X[t]??99))}function pn(e){let t=new Map;for(let n of e)n.instanceName!==null&&(t.has(n.instanceName)||t.set(n.instanceName,n.instanceLabel??n.instanceName));return[...t.entries()].map(([e,t])=>({name:e,label:t})).sort((e,t)=>Z(e.label,t.label))}function mn(e){let t=new Set;for(let n of e)n.gatewayVersion!==null&&t.add(n.gatewayVersion);return[...t].sort((e,t)=>U(e,t)??Z(e,t))}var Q=n();function hn({connections:e,displayByInstance:t}){let[n,r]=(0,K.useState)(on),[a,o]=(0,K.useState)(null),s=(0,K.useMemo)(()=>e.map((e,n)=>({_id:`${e.key}:${e.canonical}/${e.agentId}:${n}`,targetLabel:`${e.canonical}/${e.agentId}`,state:e.state,instanceName:e.instanceName??null,instanceLabel:e.instanceName?t.get(e.instanceName)??e.instanceName:null,gatewayHost:e.gatewayHost,gatewayVersion:e.gatewayVersion??null,okCount:e.okCount,errorCount:e.errorCount+(e.downstreamRejectCount??0),attempts:e.attempts,lastOkAt:e.lastOkAt??null,lastErrorCode:e.lastErrorCode??null,lastErrorAt:e.lastErrorAt??null,lastDownstreamRejectCode:e.lastDownstreamRejectCode??null,lastDownstreamRejectAt:e.lastDownstreamRejectAt??null})),[e,t]),c=(0,K.useMemo)(()=>fn(s),[s]),l=(0,K.useMemo)(()=>pn(s),[s]),u=(0,K.useMemo)(()=>mn(s),[s]),d=(0,K.useMemo)(()=>dn(cn(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,Q.jsx)(`p`,{className:`oc-admin__hint`,children:Xe()}):(0,Q.jsxs)(`div`,{className:`oc-conn`,children:[(0,Q.jsxs)(Kt,{q:n.q,onQChange:e=>r(t=>({...t,q:e})),searchPlaceholder:i(),onReset:()=>r(on),canReset:sn(n),children:[(0,Q.jsxs)(M,{value:n.state,onValueChange:e=>r(t=>({...t,state:e})),children:[(0,Q.jsx)(O,{size:`sm`,className:`w-36`,children:(0,Q.jsx)(P,{placeholder:xe()})}),(0,Q.jsxs)(N,{children:[(0,Q.jsx)(j,{value:Y,children:C()}),c.map(e=>(0,Q.jsx)(j,{value:e,children:_n(e)},e))]})]}),(0,Q.jsxs)(M,{value:n.instance,onValueChange:e=>r(t=>({...t,instance:e})),children:[(0,Q.jsx)(O,{size:`sm`,className:`w-40`,children:(0,Q.jsx)(P,{placeholder:_e()})}),(0,Q.jsxs)(N,{children:[(0,Q.jsx)(j,{value:Y,children:C()}),l.map(e=>(0,Q.jsx)(j,{value:e.name,children:e.label},e.name))]})]}),(0,Q.jsxs)(M,{value:n.version,onValueChange:e=>r(t=>({...t,version:e})),children:[(0,Q.jsx)(O,{size:`sm`,className:`w-36`,children:(0,Q.jsx)(P,{placeholder:ye()})}),(0,Q.jsxs)(N,{children:[(0,Q.jsx)(j,{value:Y,children:C()}),u.map(e=>(0,Q.jsx)(j,{value:e,children:e},e))]})]})]}),d.length===0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:y()}):(0,Q.jsxs)(V,{className:`oc-conn__table`,children:[(0,Q.jsx)(Wt,{children:(0,Q.jsxs)(z,{children:[(0,Q.jsx)($,{label:nt(),sortKey:`target`,sort:a,onSort:f}),(0,Q.jsx)($,{label:x(),sortKey:`state`,sort:a,onSort:f}),(0,Q.jsx)($,{label:m(),sortKey:`instance`,sort:a,onSort:f}),(0,Q.jsx)($,{label:he(),sortKey:`host`,sort:a,onSort:f}),(0,Q.jsx)($,{label:ue(),sortKey:`version`,sort:a,onSort:f}),(0,Q.jsx)(R,{children:_()}),(0,Q.jsx)($,{label:fe(),sortKey:`lastOk`,sort:a,onSort:f})]})}),(0,Q.jsx)(Gt,{children:d.map(e=>(0,Q.jsx)(gn,{r:e},e._id))})]})]})}function $({label:e,sortKey:t,sort:n,onSort:r}){let i=n?.key===t,a=i?n.dir:null;return(0,Q.jsx)(R,{"aria-sort":i?a===`asc`?`ascending`:`descending`:`none`,children:(0,Q.jsxs)(`button`,{type:`button`,className:`oc-conn__sort`,onClick:()=>r(t),children:[e,i?a===`asc`?(0,Q.jsx)(ht,{size:13,"aria-hidden":!0}):(0,Q.jsx)(T,{size:13,"aria-hidden":!0}):(0,Q.jsx)(gt,{size:13,"aria-hidden":!0,className:`oc-conn__sort-idle`})]})})}function gn({r:e}){let t=tn(e)?G(e.lastErrorCode):null,n=nn(e)?G(e.lastDownstreamRejectCode):null;return(0,Q.jsxs)(K.Fragment,{children:[(0,Q.jsxs)(z,{className:`oc-conn__row oc-conn__row--${e.state}`,children:[(0,Q.jsx)(B,{children:(0,Q.jsx)(`code`,{className:`oc-traces__mono`,children:e.targetLabel})}),(0,Q.jsx)(B,{children:(0,Q.jsx)(vn,{state:e.state})}),(0,Q.jsx)(B,{children:e.instanceLabel?(0,Q.jsx)(`span`,{className:`oc-bridge-target__instance`,children:e.instanceLabel}):(0,Q.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})}),(0,Q.jsx)(B,{children:(0,Q.jsx)(`span`,{className:`oc-bridge-target__host`,children:e.gatewayHost})}),(0,Q.jsx)(B,{children:e.gatewayVersion?(0,Q.jsx)(`span`,{className:`oc-bridge-target__version`,children:e.gatewayVersion}):(0,Q.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})}),(0,Q.jsx)(B,{children:(0,Q.jsx)(`span`,{className:`oc-conn__stats`,children:at({ok:e.okCount,errors:e.errorCount,attempts:e.attempts})})}),(0,Q.jsx)(B,{children:e.lastOkAt?(0,Q.jsx)(`span`,{className:`oc-traces__mono`,children:I(e.lastOkAt)}):(0,Q.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})})]}),t||n?(0,Q.jsx)(z,{className:`oc-conn__detail-row`,children:(0,Q.jsxs)(B,{colSpan:7,className:`oc-conn__detail-cell`,children:[t?(0,Q.jsxs)(`div`,{className:`oc-bridge-target__error`,children:[(0,Q.jsx)(`strong`,{children:t.label}),` `,(0,Q.jsx)(`code`,{className:`oc-traces__mono`,children:e.lastErrorCode}),e.lastErrorAt?` · ${I(e.lastErrorAt)}`:``,(0,Q.jsx)(`p`,{className:`oc-bridge-card__hint`,children:t.hint})]}):null,n?(0,Q.jsxs)(`div`,{className:`oc-bridge-target__downstream`,children:[Me({label:n.label}),` `,(0,Q.jsx)(`code`,{className:`oc-traces__mono`,children:e.lastDownstreamRejectCode}),e.lastDownstreamRejectAt?` · ${I(e.lastDownstreamRejectAt)}`:``]}):null]})}):null]})}function _n(e){return e===`connected`?o():e===`error`?mt():oe()}function vn({state:e}){return e===`connected`?(0,Q.jsx)(k,{variant:`secondary`,children:o()}):e===`error`?(0,Q.jsx)(k,{variant:`destructive`,children:mt()}):(0,Q.jsx)(k,{variant:`outline`,children:oe()})}function yn(){return f(w.bridgeHealth.getBridgeHealth,{})}function bn(){let e=yn(),t=f(w.compat.getBridgeCompat,{}),n=f(w.me.getMe,{host:Rt})?.role===`admin`,r=f(w.admin.listInstances,n?{}:`skip`),i=f(w.agents.usageForInstances,n?{}:`skip`),a=A(),o=()=>void a({to:`/settings/anomalies`,search:{status:`open`}}),s=an(e?e.targets:[],t?t.targets:[],r??[]),{section:c}=kt({from:`/settings/bridge`}),l=A({from:`/settings/bridge`}),u=t?.compat??null,d=t===void 0?`loading`:t===null?`nodata`:`ready`,p=u!==null&&qt(u,`hermes`)&&!s.some(e=>e.key===`hermes`);return(0,Q.jsxs)(`div`,{className:`oc-bridge`,children:[(0,Q.jsx)(xn,{health:e,compat:t,onSeeAnomalies:o}),(0,Q.jsx)(`p`,{className:`oc-admin__hint oc-bridge__caption`,children:se()}),i&&i.length>0?(0,Q.jsxs)(`section`,{className:`oc-bridge__usage`,children:[(0,Q.jsx)(`h3`,{className:`oc-bridge__usage-title`,children:ft()}),(0,Q.jsxs)(V,{children:[(0,Q.jsx)(Wt,{children:(0,Q.jsxs)(z,{children:[(0,Q.jsx)(R,{children:$e()}),(0,Q.jsx)(R,{children:Pe()}),(0,Q.jsx)(R,{children:Ae()}),(0,Q.jsx)(R,{children:st()}),(0,Q.jsx)(R,{children:Ke()})]})}),(0,Q.jsx)(Gt,{children:i.flatMap(e=>{let t=Ot(e.usage,Date.now());return t?t.windows.map((t,n)=>(0,Q.jsxs)(z,{children:[(0,Q.jsx)(B,{className:`font-medium`,children:n===0?e.instanceName:``}),(0,Q.jsx)(B,{children:t.provider}),(0,Q.jsx)(B,{children:t.label}),(0,Q.jsx)(B,{children:(0,Q.jsxs)(k,{variant:t.percentLeft<=10?`destructive`:t.percentLeft<=25?`outline`:`secondary`,children:[t.percentLeft,`%`]})}),(0,Q.jsx)(B,{className:`text-muted-foreground`,children:t.resetText??`—`})]},`${e.instanceName}:${t.provider}:${t.label}`)):[]})})]})]}):null,s.length>0?(0,Q.jsxs)(wt,{value:s.some(e=>e.key===c)?c:s[0]?.key??`openclaw`,onValueChange:e=>void l({search:{section:e},replace:!0}),children:[(0,Q.jsx)(Ct,{className:`w-full`,children:s.map(e=>(0,Q.jsxs)(xt,{value:e.key,className:`flex-1 gap-1.5`,children:[(0,Q.jsx)(It,{size:13,"aria-hidden":!0}),J(e.key)]},e.key))}),s.map(e=>(0,Q.jsx)(St,{value:e.key,children:(0,Q.jsx)(Sn,{providerKey:e.key,connections:e.connections,instances:e.instances,manifest:u,compatStatus:d,compatReachable:t?.reachable??!0,protocol:e.key===`openclaw`?t?.protocol??null:null})},e.key))]}):null,p?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:S()}):null]})}function xn({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,Q.jsxs)(`span`,{className:`oc-bridge-card__ver`,children:[(0,Q.jsx)(`code`,{className:`oc-traces__mono`,children:H(t.bridgeVersion)}),i?(0,Q.jsxs)(Q.Fragment,{children:[` `,(0,Q.jsxs)(`code`,{className:`oc-traces__mono`,title:be(),children:[`(`,i,`)`]})]}):null,r?(0,Q.jsxs)(`strong`,{className:`oc-bridge-card__mismatch`,children:[` `,ge({build:t.buildVersion??`?`})]}):null,` · `,ve(),` `,(0,Q.jsx)(`code`,{className:`oc-traces__mono`,children:t.protocolVersion===null?v():String(t.protocolVersion)})]}):null;if(e===void 0)return(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:et()});if(e===null)return(0,Q.jsx)(`div`,{className:`oc-bridge-card oc-bridge-card--idle`,children:Fe()});let o=Qt(e.targets),s=!e.reachable,c=en(e),l=e.unreachableInstances??[],u=c===`ok`?`ok`:c===`gateways_unreachable`?`warn`:`error`,d=Nt(e.checkedAt),f=e.startedAt==null?null:Nt(e.startedAt);return(0,Q.jsxs)(`div`,{className:`oc-bridge-card oc-bridge-card--${u}`,children:[(0,Q.jsx)(`div`,{className:`oc-bridge-card__icon`,"aria-hidden":!0,children:c===`ok`?(0,Q.jsx)(Tt,{size:22}):s||c===`gateways_unreachable`?(0,Q.jsx)(Zt,{size:22}):(0,Q.jsx)(L,{size:22})}),(0,Q.jsxs)(`div`,{className:`oc-bridge-card__body`,children:[(0,Q.jsx)(`div`,{className:`oc-bridge-card__title`,children:c===`ok`?je():c===`gateways_unreachable`?it({count:l.length}):s?ct():qe({count:o.length})}),(0,Q.jsxs)(`div`,{className:`oc-bridge-card__meta`,children:[(0,Q.jsxs)(`span`,{children:[(0,Q.jsx)(Xt,{size:12,"aria-hidden":!0}),` `,Oe({time:d})]}),f?(0,Q.jsx)(`span`,{children:Te({time:f})}):null,a]}),c===`gateways_unreachable`?(0,Q.jsx)(`p`,{className:`oc-bridge-card__hint`,children:Ze({names:l.join(`, `)})}):null,s?(0,Q.jsx)(`p`,{className:`oc-bridge-card__hint`,children:G(e.lastError===`not_configured`?`NOT_CONFIGURED`:`BRIDGE_UNREACHABLE`).hint}):null]}),(0,Q.jsx)(`button`,{type:`button`,className:`oc-bridgebar__drill`,onClick:n,children:Ve()})]})}function Sn({providerKey:e,connections:t,instances:n,manifest:i,compatStatus:a,compatReachable:o,protocol:s}){let c=i?Jt(i,e):null,l=new Map;for(let e of n)l.set(e.name,e.displayName??e.name);let u=[],d=new Set;for(let n of t){if(!n.instanceName||d.has(n.instanceName))continue;d.add(n.instanceName);let t=n.gatewayVersion??null;u.push({instanceName:n.instanceName,displayName:l.get(n.instanceName)??n.instanceName,version:t,state:Yt(t,e,i)})}let f=u.map(e=>e.state),p=f.includes(`beyond`)?`beyond`:f.length>0&&f.every(e=>e===`supported`)?`supported`:null,[m,h]=(0,K.useState)(!1);return(0,Q.jsxs)(`section`,{className:`oc-bridge-provider`,children:[(0,Q.jsxs)(`header`,{className:`oc-bridge-provider__head`,children:[(0,Q.jsx)(It,{size:15,"aria-hidden":!0,className:`oc-bridge-provider__icon`}),(0,Q.jsx)(`span`,{className:`oc-bridge-provider__name`,children:J(e)}),p?(0,Q.jsx)(k,{variant:p===`beyond`?`destructive`:`secondary`,children:W(p)}):null]}),(0,Q.jsx)(`h4`,{className:`oc-bridge-provider__sub`,children:r()}),(0,Q.jsx)(wn,{providerName:J(e),support:c,compatStatus:a,compatReachable:o,manifest:i,instanceRows:u}),s?(0,Q.jsx)(Cn,{protocol:s}):null,(0,Q.jsxs)(`button`,{type:`button`,className:`oc-bridge-provider__sub oc-bridge-provider__sub--toggle`,"aria-expanded":m,onClick:()=>h(e=>!e),children:[m?(0,Q.jsx)(T,{size:13,"aria-hidden":!0}):(0,Q.jsx)(Pt,{size:13,"aria-hidden":!0}),rt({count:t.length})]}),m?(0,Q.jsx)(hn,{connections:t,displayByInstance:l}):null]})}function Cn({protocol:e}){let[t,n]=(0,K.useState)(!1),r=e.coverage,i=e.drift??[],a=(e.driftOverflow??0)+(e.driftTruncated??0);return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`h4`,{className:`oc-bridge-provider__sub`,children:[Ee(),i.length>0?(0,Q.jsx)(k,{variant:`destructive`,children:ut({count:i.length})}):a>0?(0,Q.jsx)(k,{variant:`destructive`,children:Ce()}):(0,Q.jsx)(k,{variant:`secondary`,children:pt()})]}),(0,Q.jsxs)(`p`,{className:`oc-admin__hint`,children:[Le({version:e.vendoredVersion}),r?` · `+ze({handled:r.handled,ignored:r.ignored,gaps:r.gaps}):null]}),a>0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:Ue({overflow:e.driftOverflow??0,truncated:e.driftTruncated??0})}):null,i.length>0?(0,Q.jsx)(`ul`,{className:`oc-bridge-protocol__list`,role:`list`,children:i.map(e=>(0,Q.jsxs)(`li`,{children:[(0,Q.jsx)(`code`,{className:`oc-traces__mono`,children:e.shape}),` × `,e.count]},e.shape))}):null,r&&r.gapList.length>0?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`button`,{type:`button`,className:`oc-bridge-provider__sub oc-bridge-provider__sub--toggle`,"aria-expanded":t,onClick:()=>n(e=>!e),children:[t?(0,Q.jsx)(T,{size:13,"aria-hidden":!0}):(0,Q.jsx)(Pt,{size:13,"aria-hidden":!0}),Ye({count:r.gapList.length})]}),t?(0,Q.jsx)(`ul`,{className:`oc-bridge-protocol__list`,role:`list`,children:r.gapList.map(e=>(0,Q.jsx)(`li`,{children:(0,Q.jsx)(`code`,{className:`oc-traces__mono`,children:e})},e))}):null]}):null]})}function wn({support:e,compatStatus:t,compatReachable:n,manifest:r,instanceRows:i,providerName:a}){return t===`loading`?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:et()}):t===`nodata`?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:ae()}):(0,Q.jsxs)(`div`,{className:`oc-compat`,children:[n?null:(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:tt()}),r===null?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:b()}):(0,Q.jsxs)(`div`,{className:`oc-compat__support`,children:[(0,Q.jsx)(`span`,{className:`oc-compat__label`,children:Ie({provider:a})}),e&&e.range!==null?(0,Q.jsx)(`span`,{children:p({min:e.range.min,max:e.range.maxValidated})}):(0,Q.jsx)(`span`,{children:v()}),e?(0,Q.jsx)(On,{versions:e.validatedVersions}):null]}),i.length===0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:de()}):(0,Q.jsx)(`div`,{className:`oc-compat__targets`,children:i.map(e=>(0,Q.jsxs)(`div`,{className:`oc-compat__target`,children:[(0,Q.jsx)(`span`,{className:`oc-compat__instance`,children:e.displayName}),(0,Q.jsx)(`code`,{className:`oc-traces__mono`,children:H(e.version)}),(0,Q.jsx)(k,{variant:e.state===`supported`?`secondary`:e.state===`beyond`?`destructive`:`outline`,children:W(e.state)})]},e.instanceName))})]})}function Tn({instance:e,onClose:t}){return(0,Q.jsx)(Bt,{open:!0,onOpenChange:e=>!e&&t(),children:(0,Q.jsxs)(Ft,{className:`oc-bridge-config-dialog`,onOpenAutoFocus:e=>e.preventDefault(),children:[(0,Q.jsxs)(jt,{children:[(0,Q.jsx)(Lt,{children:lt({instance:e.displayName??e.name})}),(0,Q.jsx)(zt,{children:Se()})]}),(0,Q.jsx)(Dn,{instance:e,onClose:t})]})})}function En({label:e,result:t}){return t?t.checked?(0,Q.jsxs)(`p`,{className:`oc-bridge-config__check-row `+(t.ok?`oc-bridge-config__check-row--ok`:`oc-bridge-config__check-row--err`),children:[t.ok?(0,Q.jsx)(Tt,{"aria-hidden":!0}):(0,Q.jsx)(L,{"aria-hidden":!0}),(0,Q.jsxs)(`span`,{children:[e,` — `,t.ok?u():t.detail]})]}):(0,Q.jsxs)(`p`,{className:`oc-bridge-config__check-row oc-bridge-config__check-row--skip`,children:[e,` — `,ce()]}):null}function Dn({instance:e,onClose:t}){let n=pe(w.admin.upsertInstanceConfig),r=h(w.bridge.validateMediaPaths),i=Dt(),o=Ut(e.config?.contentLocale,void 0),[c,u]=(0,K.useState)(()=>_t(e.config??{},o)),[f,p]=(0,K.useState)(!1),[m,g]=(0,K.useState)(!1),[_,v]=(0,K.useState)(null),y=c.inboundMediaMode===`shared-fs`,b=c.mediaMode===`shared-fs`,x=y||b;async function S(){g(!0),v(null);try{v(await r({instanceName:e.name,inboundMediaMode:c.inboundMediaMode,mediaMode:c.mediaMode}))}catch(e){i.error(a(),e)}finally{g(!1)}}async function ae(){p(!0);try{let r=e.config??{};await n({instanceId:e._id,config:yt(c,r,o)}),t()}catch(e){i.error(ot(),e)}finally{p(!1)}}return(0,Q.jsx)(`div`,{className:`oc-bridge-config`,children:(0,Q.jsxs)(`div`,{className:`oc-bridge-config__form`,children:[(0,Q.jsxs)(`div`,{className:`oc-bridge-config__grid`,children:[(0,Q.jsxs)(`label`,{className:`oc-field`,children:[(0,Q.jsx)(E,{label:Re(),help:Ge()}),(0,Q.jsxs)(M,{value:c.mediaMode,onValueChange:e=>u({...c,mediaMode:e}),children:[(0,Q.jsx)(O,{size:`sm`,className:`w-full`,children:(0,Q.jsx)(P,{})}),(0,Q.jsx)(N,{children:bt.map(e=>(0,Q.jsx)(j,{value:e,children:e},e))})]})]}),(0,Q.jsxs)(`label`,{className:`oc-field`,children:[(0,Q.jsx)(E,{label:Je(),help:De()}),(0,Q.jsxs)(M,{value:c.inboundMediaMode,onValueChange:e=>u({...c,inboundMediaMode:e}),children:[(0,Q.jsx)(O,{size:`sm`,className:`w-full`,children:(0,Q.jsx)(P,{})}),(0,Q.jsx)(N,{children:vt.map(e=>(0,Q.jsx)(j,{value:e,children:e},e))})]})]}),(0,Q.jsxs)(`label`,{className:`oc-field`,children:[(0,Q.jsx)(E,{label:Qe(),help:we()}),(0,Q.jsx)(F,{type:`number`,min:1,max:4096,className:`w-full`,value:c.mediaMaxMb,onChange:e=>u({...c,mediaMaxMb:Math.trunc(Number(e.target.value)||0)})})]})]}),x&&(0,Q.jsxs)(`div`,{className:`oc-bridge-config__grid`,children:[y&&(0,Q.jsxs)(`label`,{className:`oc-field`,children:[(0,Q.jsx)(E,{label:ee(),help:d()}),(0,Q.jsx)(F,{className:`w-full`,spellCheck:!1,value:c.inboundAgentMount,onChange:e=>u({...c,inboundAgentMount:e.target.value})})]}),b&&(0,Q.jsxs)(`label`,{className:`oc-field`,children:[(0,Q.jsx)(E,{label:ie(),help:ne()}),(0,Q.jsx)(F,{className:`w-full`,spellCheck:!1,value:c.outboundAgentMount,onChange:e=>u({...c,outboundAgentMount:e.target.value})})]})]}),(0,Q.jsxs)(`label`,{className:`oc-field--row`,children:[(0,Q.jsx)(Vt,{checked:c.rehydration,onCheckedChange:e=>u({...c,rehydration:e===!0})}),(0,Q.jsx)(E,{label:Ne(),help:Be()})]}),x&&_!==null&&(0,Q.jsx)(`div`,{className:`oc-bridge-config__check`,children:_.reachable?!_.inbound&&!_.outbound?(0,Q.jsxs)(`p`,{className:`oc-bridge-config__check-row oc-bridge-config__check-row--err`,children:[(0,Q.jsx)(L,{"aria-hidden":!0}),s({reason:_.reason??`?`})]}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(En,{label:re(),result:_.inbound}),(0,Q.jsx)(En,{label:l(),result:_.outbound}),(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:We()})]}):(0,Q.jsxs)(`p`,{className:`oc-bridge-config__check-row oc-bridge-config__check-row--err`,children:[(0,Q.jsx)(L,{"aria-hidden":!0}),dt()]})}),(0,Q.jsxs)(`div`,{className:`oc-bridge-config__actions`,children:[x&&(0,Q.jsxs)(D,{variant:`outline`,size:`sm`,onClick:()=>void S(),disabled:m,children:[m?(0,Q.jsx)(Mt,{className:`size-4 animate-spin`,"aria-hidden":!0}):null,m?He():te()]}),(0,Q.jsx)(D,{size:`sm`,onClick:()=>void ae(),disabled:f,children:ke()})]})]})})}function On({versions:e}){if(e.length===0)return null;let t=[...e].reverse();return(0,Q.jsxs)(At,{children:[(0,Q.jsx)(Et,{asChild:!0,children:(0,Q.jsxs)(`button`,{type:`button`,className:`oc-compat__versions-btn`,children:[e.length===1?me():le({count:e.length}),(0,Q.jsx)(T,{size:13,"aria-hidden":!0})]})}),(0,Q.jsxs)(Ht,{className:`oc-compat__versions-pop`,align:`start`,children:[(0,Q.jsx)(`p`,{className:`oc-compat__versions-title`,children:g()}),(0,Q.jsx)(`div`,{className:`oc-compat__versions-list`,children:t.map(e=>(0,Q.jsx)(k,{variant:`secondary`,children:e},e))})]})]})}export{bn as BridgeTab,Tn as InstanceConfigDialog};
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$l as r,$v as i,Ay as a,Bv as o,Cy as s,D as c,Dy as l,Ey as u,Fy as d,GR as f,Gl as p,Gv as m,HR as h,Hl as g,Hv as _,Iy as ee,Jl as v,Jv as y,Kl as b,Kv as x,Ll as S,My as te,Ny as ne,Oy as re,Py as ie,Ql as ae,Qv as C,Rv as oe,Sy as se,Ty as ce,Ul as le,Uv as ue,Vl as de,Vv as fe,WR as pe,Wl as me,Wv as he,Xl as ge,Xv as _e,Yl as ve,Yv as ye,Zl as be,Zv as xe,_b as Se,_y as Ce,ab as we,ay as Te,by as Ee,cb as De,cy as Oe,db as ke,dr as Ae,dy as je,ey as Me,fb as Ne,fr as Pe,fy as Fe,gr as Ie,gy as Le,hb as Re,hy as ze,ib as Be,iy as Ve,jy as He,k as Ue,ky as We,lb as Ge,lr as Ke,ly as qe,mb as Je,my as Ye,ny as Xe,oy as Ze,pb as Qe,pr as $e,py as et,ql as tt,qv as nt,ry as rt,sy as it,t as w,ty as at,ub as ot,ur as st,uy as ct,vb as lt,vy as ut,wy as dt,xy as ft,yy as pt,zv as mt}from"./api-Dr5hDHvi.js";import{r as T}from"./dist-B9J3rPRX.js";import{t as ht}from"./chevron-up-BwcZQhBy.js";import{t as gt}from"./chevrons-up-down-DBgS9XVd.js";import{i as _t,n as E,o as vt,r as yt,s as bt}from"./FieldLabel-fW5dBj9i.js";import{i as xt,n as St,r as Ct,t as wt}from"./tabs-BPua3v_Q.js";import{t as D}from"./button-BI3fckfr.js";import{$ as O,An as Tt,Bt as Et,Dt,Et as k,F as Ot,Fn as kt,Pn as A,Q as j,Rt as At,X as M,Z as N,at as jt,bn as Mt,ct as Nt,et as P,jn as Pt,jt as F,lt as I,nt as Ft,on as It,ot as Lt,q as Rt,rn as L,rt as zt,tt as Bt,ut as Vt,zt as Ht}from"./index-CaP52i63.js";import{r as Ut}from"./locales-CPjguROj.js";import{a as Wt,i as R,n as Gt,o as z,r as B,t as V}from"./table-CH0obeXz.js";import{t as Kt}from"./FilterBar-BbF96T8z.js";import{a as H,n as qt,o as U,r as W,s as Jt,t as Yt}from"./compatView-Dw2Mg_up.js";import{t as G}from"./dispatchErrorInfo-CvAG5Yps.js";var Xt=c(`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`}]]),Zt=c(`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`}]]),K=t(e(),1);function Qt(e){return e.filter(e=>e.state===`error`)}function $t(e){return e.reachable&&Qt(e.targets).length===0}function en(e){return $t(e)?(e.unreachableInstances??[]).length>0?`gateways_unreachable`:`ok`:`error`}function tn(e){return e.state===`error`&&e.lastErrorCode!==null}function nn(e){return!!e.lastDownstreamRejectCode}function q(e){return e.kind??`openclaw`}function rn(e){return[...e].sort((e,t)=>e===`openclaw`?-1:t===`openclaw`?1:e.localeCompare(t))}function an(e,t,n){let r=new Map;for(let e of t)e.instanceName&&r.set(e.instanceName,e.provider);for(let e of n)r.set(e.name,q(e));let i=e=>(e.instanceName?r.get(e.instanceName):void 0)??`openclaw`,a=new Set;for(let e of n)a.add(q(e));for(let e of t)a.add(e.provider);for(let t of e)a.add(i(t));return rn(a).map(r=>({key:r,connections:e.filter(e=>i(e)===r),compatTargets:t.filter(e=>e.provider===r),instances:n.filter(e=>q(e)===r)}))}function J(e){return e===`openclaw`?`OpenClaw`:e===`hermes`?`Hermes`:e.charAt(0).toUpperCase()+e.slice(1)}var Y=`__all__`,on={q:``,state:Y,instance:Y,version:Y},X={connected:0,error:1,idle:2};function sn(e){return e.q.trim()!==``||e.state!==`__all__`||e.instance!==`__all__`||e.version!==`__all__`}function cn(e,t){let n=t.q.trim().toLowerCase();return e.filter(e=>!(n&&!`${e.targetLabel} ${e.gatewayHost}`.toLowerCase().includes(n)||t.state!==`__all__`&&e.state!==t.state||t.instance!==`__all__`&&(e.instanceName??``)!==t.instance||t.version!==`__all__`&&(e.gatewayVersion??``)!==t.version))}function Z(e,t){return e.localeCompare(t,void 0,{numeric:!0,sensitivity:`base`})}function ln(e,t){return e===`version`?t.gatewayVersion===null:e===`lastOk`?t.lastOkAt===null:!1}function un(e,t,n){switch(e){case`state`:return(X[t.state]??99)-(X[n.state]??99);case`instance`:return Z(t.instanceLabel??t.instanceName??``,n.instanceLabel??n.instanceName??``);case`host`:return Z(t.gatewayHost,n.gatewayHost);case`version`:{let e=t.gatewayVersion,r=n.gatewayVersion;return U(e,r)??Z(e,r)}case`lastOk`:return t.lastOkAt-n.lastOkAt;default:return Z(t.targetLabel,n.targetLabel)}}function dn(e,t){if(!t)return e;let n=t.dir===`asc`?1:-1;return[...e].sort((e,r)=>{let i=ln(t.key,e),a=ln(t.key,r);return i&&a?0:i?1:a?-1:n*un(t.key,e,r)})}function fn(e){let t=new Set;for(let n of e)t.add(n.state);return[...t].sort((e,t)=>(X[e]??99)-(X[t]??99))}function pn(e){let t=new Map;for(let n of e)n.instanceName!==null&&(t.has(n.instanceName)||t.set(n.instanceName,n.instanceLabel??n.instanceName));return[...t.entries()].map(([e,t])=>({name:e,label:t})).sort((e,t)=>Z(e.label,t.label))}function mn(e){let t=new Set;for(let n of e)n.gatewayVersion!==null&&t.add(n.gatewayVersion);return[...t].sort((e,t)=>U(e,t)??Z(e,t))}var Q=n();function hn({connections:e,displayByInstance:t}){let[n,r]=(0,K.useState)(on),[a,o]=(0,K.useState)(null),s=(0,K.useMemo)(()=>e.map((e,n)=>({_id:`${e.key}:${e.canonical}/${e.agentId}:${n}`,targetLabel:`${e.canonical}/${e.agentId}`,state:e.state,instanceName:e.instanceName??null,instanceLabel:e.instanceName?t.get(e.instanceName)??e.instanceName:null,gatewayHost:e.gatewayHost,gatewayVersion:e.gatewayVersion??null,okCount:e.okCount,errorCount:e.errorCount+(e.downstreamRejectCount??0),attempts:e.attempts,lastOkAt:e.lastOkAt??null,lastErrorCode:e.lastErrorCode??null,lastErrorAt:e.lastErrorAt??null,lastDownstreamRejectCode:e.lastDownstreamRejectCode??null,lastDownstreamRejectAt:e.lastDownstreamRejectAt??null})),[e,t]),c=(0,K.useMemo)(()=>fn(s),[s]),l=(0,K.useMemo)(()=>pn(s),[s]),u=(0,K.useMemo)(()=>mn(s),[s]),d=(0,K.useMemo)(()=>dn(cn(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,Q.jsx)(`p`,{className:`oc-admin__hint`,children:Xe()}):(0,Q.jsxs)(`div`,{className:`oc-conn`,children:[(0,Q.jsxs)(Kt,{q:n.q,onQChange:e=>r(t=>({...t,q:e})),searchPlaceholder:i(),onReset:()=>r(on),canReset:sn(n),children:[(0,Q.jsxs)(M,{value:n.state,onValueChange:e=>r(t=>({...t,state:e})),children:[(0,Q.jsx)(O,{size:`sm`,className:`w-36`,children:(0,Q.jsx)(P,{placeholder:xe()})}),(0,Q.jsxs)(N,{children:[(0,Q.jsx)(j,{value:Y,children:C()}),c.map(e=>(0,Q.jsx)(j,{value:e,children:_n(e)},e))]})]}),(0,Q.jsxs)(M,{value:n.instance,onValueChange:e=>r(t=>({...t,instance:e})),children:[(0,Q.jsx)(O,{size:`sm`,className:`w-40`,children:(0,Q.jsx)(P,{placeholder:_e()})}),(0,Q.jsxs)(N,{children:[(0,Q.jsx)(j,{value:Y,children:C()}),l.map(e=>(0,Q.jsx)(j,{value:e.name,children:e.label},e.name))]})]}),(0,Q.jsxs)(M,{value:n.version,onValueChange:e=>r(t=>({...t,version:e})),children:[(0,Q.jsx)(O,{size:`sm`,className:`w-36`,children:(0,Q.jsx)(P,{placeholder:ye()})}),(0,Q.jsxs)(N,{children:[(0,Q.jsx)(j,{value:Y,children:C()}),u.map(e=>(0,Q.jsx)(j,{value:e,children:e},e))]})]})]}),d.length===0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:y()}):(0,Q.jsxs)(V,{className:`oc-conn__table`,children:[(0,Q.jsx)(Wt,{children:(0,Q.jsxs)(z,{children:[(0,Q.jsx)($,{label:nt(),sortKey:`target`,sort:a,onSort:f}),(0,Q.jsx)($,{label:x(),sortKey:`state`,sort:a,onSort:f}),(0,Q.jsx)($,{label:m(),sortKey:`instance`,sort:a,onSort:f}),(0,Q.jsx)($,{label:he(),sortKey:`host`,sort:a,onSort:f}),(0,Q.jsx)($,{label:ue(),sortKey:`version`,sort:a,onSort:f}),(0,Q.jsx)(R,{children:_()}),(0,Q.jsx)($,{label:fe(),sortKey:`lastOk`,sort:a,onSort:f})]})}),(0,Q.jsx)(Gt,{children:d.map(e=>(0,Q.jsx)(gn,{r:e},e._id))})]})]})}function $({label:e,sortKey:t,sort:n,onSort:r}){let i=n?.key===t,a=i?n.dir:null;return(0,Q.jsx)(R,{"aria-sort":i?a===`asc`?`ascending`:`descending`:`none`,children:(0,Q.jsxs)(`button`,{type:`button`,className:`oc-conn__sort`,onClick:()=>r(t),children:[e,i?a===`asc`?(0,Q.jsx)(ht,{size:13,"aria-hidden":!0}):(0,Q.jsx)(T,{size:13,"aria-hidden":!0}):(0,Q.jsx)(gt,{size:13,"aria-hidden":!0,className:`oc-conn__sort-idle`})]})})}function gn({r:e}){let t=tn(e)?G(e.lastErrorCode):null,n=nn(e)?G(e.lastDownstreamRejectCode):null;return(0,Q.jsxs)(K.Fragment,{children:[(0,Q.jsxs)(z,{className:`oc-conn__row oc-conn__row--${e.state}`,children:[(0,Q.jsx)(B,{children:(0,Q.jsx)(`code`,{className:`oc-traces__mono`,children:e.targetLabel})}),(0,Q.jsx)(B,{children:(0,Q.jsx)(vn,{state:e.state})}),(0,Q.jsx)(B,{children:e.instanceLabel?(0,Q.jsx)(`span`,{className:`oc-bridge-target__instance`,children:e.instanceLabel}):(0,Q.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})}),(0,Q.jsx)(B,{children:(0,Q.jsx)(`span`,{className:`oc-bridge-target__host`,children:e.gatewayHost})}),(0,Q.jsx)(B,{children:e.gatewayVersion?(0,Q.jsx)(`span`,{className:`oc-bridge-target__version`,children:e.gatewayVersion}):(0,Q.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})}),(0,Q.jsx)(B,{children:(0,Q.jsx)(`span`,{className:`oc-conn__stats`,children:at({ok:e.okCount,errors:e.errorCount,attempts:e.attempts})})}),(0,Q.jsx)(B,{children:e.lastOkAt?(0,Q.jsx)(`span`,{className:`oc-traces__mono`,children:I(e.lastOkAt)}):(0,Q.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})})]}),t||n?(0,Q.jsx)(z,{className:`oc-conn__detail-row`,children:(0,Q.jsxs)(B,{colSpan:7,className:`oc-conn__detail-cell`,children:[t?(0,Q.jsxs)(`div`,{className:`oc-bridge-target__error`,children:[(0,Q.jsx)(`strong`,{children:t.label}),` `,(0,Q.jsx)(`code`,{className:`oc-traces__mono`,children:e.lastErrorCode}),e.lastErrorAt?` · ${I(e.lastErrorAt)}`:``,(0,Q.jsx)(`p`,{className:`oc-bridge-card__hint`,children:t.hint})]}):null,n?(0,Q.jsxs)(`div`,{className:`oc-bridge-target__downstream`,children:[Me({label:n.label}),` `,(0,Q.jsx)(`code`,{className:`oc-traces__mono`,children:e.lastDownstreamRejectCode}),e.lastDownstreamRejectAt?` · ${I(e.lastDownstreamRejectAt)}`:``]}):null]})}):null]})}function _n(e){return e===`connected`?o():e===`error`?mt():oe()}function vn({state:e}){return e===`connected`?(0,Q.jsx)(k,{variant:`secondary`,children:o()}):e===`error`?(0,Q.jsx)(k,{variant:`destructive`,children:mt()}):(0,Q.jsx)(k,{variant:`outline`,children:oe()})}function yn(){return f(w.bridgeHealth.getBridgeHealth,{})}function bn(){let e=yn(),t=f(w.compat.getBridgeCompat,{}),n=f(w.me.getMe,{host:Rt})?.role===`admin`,r=f(w.admin.listInstances,n?{}:`skip`),i=f(w.agents.usageForInstances,n?{}:`skip`),a=A(),o=()=>void a({to:`/settings/anomalies`,search:{status:`open`}}),s=an(e?e.targets:[],t?t.targets:[],r??[]),{section:c}=kt({from:`/settings/bridge`}),l=A({from:`/settings/bridge`}),u=t?.compat??null,d=t===void 0?`loading`:t===null?`nodata`:`ready`,p=u!==null&&qt(u,`hermes`)&&!s.some(e=>e.key===`hermes`);return(0,Q.jsxs)(`div`,{className:`oc-bridge`,children:[(0,Q.jsx)(xn,{health:e,compat:t,onSeeAnomalies:o}),(0,Q.jsx)(`p`,{className:`oc-admin__hint oc-bridge__caption`,children:se()}),i&&i.length>0?(0,Q.jsxs)(`section`,{className:`oc-bridge__usage`,children:[(0,Q.jsx)(`h3`,{className:`oc-bridge__usage-title`,children:ft()}),(0,Q.jsxs)(V,{children:[(0,Q.jsx)(Wt,{children:(0,Q.jsxs)(z,{children:[(0,Q.jsx)(R,{children:$e()}),(0,Q.jsx)(R,{children:Pe()}),(0,Q.jsx)(R,{children:Ae()}),(0,Q.jsx)(R,{children:st()}),(0,Q.jsx)(R,{children:Ke()})]})}),(0,Q.jsx)(Gt,{children:i.flatMap(e=>{let t=Ot(e.usage,Date.now());return t?t.windows.map((t,n)=>(0,Q.jsxs)(z,{children:[(0,Q.jsx)(B,{className:`font-medium`,children:n===0?e.instanceName:``}),(0,Q.jsx)(B,{children:t.provider}),(0,Q.jsx)(B,{children:t.label}),(0,Q.jsx)(B,{children:(0,Q.jsxs)(k,{variant:t.percentLeft<=10?`destructive`:t.percentLeft<=25?`outline`:`secondary`,children:[t.percentLeft,`%`]})}),(0,Q.jsx)(B,{className:`text-muted-foreground`,children:t.resetText??`—`})]},`${e.instanceName}:${t.provider}:${t.label}`)):[]})})]})]}):null,s.length>0?(0,Q.jsxs)(wt,{value:s.some(e=>e.key===c)?c:s[0]?.key??`openclaw`,onValueChange:e=>void l({search:{section:e},replace:!0}),children:[(0,Q.jsx)(Ct,{className:`w-full`,children:s.map(e=>(0,Q.jsxs)(xt,{value:e.key,className:`flex-1 gap-1.5`,children:[(0,Q.jsx)(It,{size:13,"aria-hidden":!0}),J(e.key)]},e.key))}),s.map(e=>(0,Q.jsx)(St,{value:e.key,children:(0,Q.jsx)(Sn,{providerKey:e.key,connections:e.connections,instances:e.instances,manifest:u,compatStatus:d,compatReachable:t?.reachable??!0,protocol:e.key===`openclaw`?t?.protocol??null:null})},e.key))]}):null,p?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:S()}):null]})}function xn({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,Q.jsxs)(`span`,{className:`oc-bridge-card__ver`,children:[(0,Q.jsx)(`code`,{className:`oc-traces__mono`,children:H(t.bridgeVersion)}),i?(0,Q.jsxs)(Q.Fragment,{children:[` `,(0,Q.jsxs)(`code`,{className:`oc-traces__mono`,title:be(),children:[`(`,i,`)`]})]}):null,r?(0,Q.jsxs)(`strong`,{className:`oc-bridge-card__mismatch`,children:[` `,ge({build:t.buildVersion??`?`})]}):null,` · `,ve(),` `,(0,Q.jsx)(`code`,{className:`oc-traces__mono`,children:t.protocolVersion===null?v():String(t.protocolVersion)})]}):null;if(e===void 0)return(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:et()});if(e===null)return(0,Q.jsx)(`div`,{className:`oc-bridge-card oc-bridge-card--idle`,children:Fe()});let o=Qt(e.targets),s=!e.reachable,c=en(e),l=e.unreachableInstances??[],u=c===`ok`?`ok`:c===`gateways_unreachable`?`warn`:`error`,d=Nt(e.checkedAt),f=e.startedAt==null?null:Nt(e.startedAt);return(0,Q.jsxs)(`div`,{className:`oc-bridge-card oc-bridge-card--${u}`,children:[(0,Q.jsx)(`div`,{className:`oc-bridge-card__icon`,"aria-hidden":!0,children:c===`ok`?(0,Q.jsx)(Tt,{size:22}):s||c===`gateways_unreachable`?(0,Q.jsx)(Zt,{size:22}):(0,Q.jsx)(L,{size:22})}),(0,Q.jsxs)(`div`,{className:`oc-bridge-card__body`,children:[(0,Q.jsx)(`div`,{className:`oc-bridge-card__title`,children:c===`ok`?je():c===`gateways_unreachable`?it({count:l.length}):s?ct():qe({count:o.length})}),(0,Q.jsxs)(`div`,{className:`oc-bridge-card__meta`,children:[(0,Q.jsxs)(`span`,{children:[(0,Q.jsx)(Xt,{size:12,"aria-hidden":!0}),` `,Oe({time:d})]}),f?(0,Q.jsx)(`span`,{children:Te({time:f})}):null,a]}),c===`gateways_unreachable`?(0,Q.jsx)(`p`,{className:`oc-bridge-card__hint`,children:Ze({names:l.join(`, `)})}):null,s?(0,Q.jsx)(`p`,{className:`oc-bridge-card__hint`,children:G(e.lastError===`not_configured`?`NOT_CONFIGURED`:`BRIDGE_UNREACHABLE`).hint}):null]}),(0,Q.jsx)(`button`,{type:`button`,className:`oc-bridgebar__drill`,onClick:n,children:Ve()})]})}function Sn({providerKey:e,connections:t,instances:n,manifest:i,compatStatus:a,compatReachable:o,protocol:s}){let c=i?Jt(i,e):null,l=new Map;for(let e of n)l.set(e.name,e.displayName??e.name);let u=[],d=new Set;for(let n of t){if(!n.instanceName||d.has(n.instanceName))continue;d.add(n.instanceName);let t=n.gatewayVersion??null;u.push({instanceName:n.instanceName,displayName:l.get(n.instanceName)??n.instanceName,version:t,state:Yt(t,e,i)})}let f=u.map(e=>e.state),p=f.includes(`beyond`)?`beyond`:f.length>0&&f.every(e=>e===`supported`)?`supported`:null,[m,h]=(0,K.useState)(!1);return(0,Q.jsxs)(`section`,{className:`oc-bridge-provider`,children:[(0,Q.jsxs)(`header`,{className:`oc-bridge-provider__head`,children:[(0,Q.jsx)(It,{size:15,"aria-hidden":!0,className:`oc-bridge-provider__icon`}),(0,Q.jsx)(`span`,{className:`oc-bridge-provider__name`,children:J(e)}),p?(0,Q.jsx)(k,{variant:p===`beyond`?`destructive`:`secondary`,children:W(p)}):null]}),(0,Q.jsx)(`h4`,{className:`oc-bridge-provider__sub`,children:r()}),(0,Q.jsx)(wn,{providerName:J(e),support:c,compatStatus:a,compatReachable:o,manifest:i,instanceRows:u}),s?(0,Q.jsx)(Cn,{protocol:s}):null,(0,Q.jsxs)(`button`,{type:`button`,className:`oc-bridge-provider__sub oc-bridge-provider__sub--toggle`,"aria-expanded":m,onClick:()=>h(e=>!e),children:[m?(0,Q.jsx)(T,{size:13,"aria-hidden":!0}):(0,Q.jsx)(Pt,{size:13,"aria-hidden":!0}),rt({count:t.length})]}),m?(0,Q.jsx)(hn,{connections:t,displayByInstance:l}):null]})}function Cn({protocol:e}){let[t,n]=(0,K.useState)(!1),r=e.coverage,i=e.drift??[],a=(e.driftOverflow??0)+(e.driftTruncated??0);return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`h4`,{className:`oc-bridge-provider__sub`,children:[Ee(),i.length>0?(0,Q.jsx)(k,{variant:`destructive`,children:ut({count:i.length})}):a>0?(0,Q.jsx)(k,{variant:`destructive`,children:Ce()}):(0,Q.jsx)(k,{variant:`secondary`,children:pt()})]}),(0,Q.jsxs)(`p`,{className:`oc-admin__hint`,children:[Le({version:e.vendoredVersion}),r?` · `+ze({handled:r.handled,ignored:r.ignored,gaps:r.gaps}):null]}),a>0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:Ue({overflow:e.driftOverflow??0,truncated:e.driftTruncated??0})}):null,i.length>0?(0,Q.jsx)(`ul`,{className:`oc-bridge-protocol__list`,role:`list`,children:i.map(e=>(0,Q.jsxs)(`li`,{children:[(0,Q.jsx)(`code`,{className:`oc-traces__mono`,children:e.shape}),` × `,e.count]},e.shape))}):null,r&&r.gapList.length>0?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`button`,{type:`button`,className:`oc-bridge-provider__sub oc-bridge-provider__sub--toggle`,"aria-expanded":t,onClick:()=>n(e=>!e),children:[t?(0,Q.jsx)(T,{size:13,"aria-hidden":!0}):(0,Q.jsx)(Pt,{size:13,"aria-hidden":!0}),Ye({count:r.gapList.length})]}),t?(0,Q.jsx)(`ul`,{className:`oc-bridge-protocol__list`,role:`list`,children:r.gapList.map(e=>(0,Q.jsx)(`li`,{children:(0,Q.jsx)(`code`,{className:`oc-traces__mono`,children:e})},e))}):null]}):null]})}function wn({support:e,compatStatus:t,compatReachable:n,manifest:r,instanceRows:i,providerName:a}){return t===`loading`?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:et()}):t===`nodata`?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:ae()}):(0,Q.jsxs)(`div`,{className:`oc-compat`,children:[n?null:(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:tt()}),r===null?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:b()}):(0,Q.jsxs)(`div`,{className:`oc-compat__support`,children:[(0,Q.jsx)(`span`,{className:`oc-compat__label`,children:Ie({provider:a})}),e&&e.range!==null?(0,Q.jsx)(`span`,{children:p({min:e.range.min,max:e.range.maxValidated})}):(0,Q.jsx)(`span`,{children:v()}),e?(0,Q.jsx)(On,{versions:e.validatedVersions}):null]}),i.length===0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:de()}):(0,Q.jsx)(`div`,{className:`oc-compat__targets`,children:i.map(e=>(0,Q.jsxs)(`div`,{className:`oc-compat__target`,children:[(0,Q.jsx)(`span`,{className:`oc-compat__instance`,children:e.displayName}),(0,Q.jsx)(`code`,{className:`oc-traces__mono`,children:H(e.version)}),(0,Q.jsx)(k,{variant:e.state===`supported`?`secondary`:e.state===`beyond`?`destructive`:`outline`,children:W(e.state)})]},e.instanceName))})]})}function Tn({instance:e,onClose:t}){return(0,Q.jsx)(Bt,{open:!0,onOpenChange:e=>!e&&t(),children:(0,Q.jsxs)(Ft,{className:`oc-bridge-config-dialog`,onOpenAutoFocus:e=>e.preventDefault(),children:[(0,Q.jsxs)(jt,{children:[(0,Q.jsx)(Lt,{children:lt({instance:e.displayName??e.name})}),(0,Q.jsx)(zt,{children:Se()})]}),(0,Q.jsx)(Dn,{instance:e,onClose:t})]})})}function En({label:e,result:t}){return t?t.checked?(0,Q.jsxs)(`p`,{className:`oc-bridge-config__check-row `+(t.ok?`oc-bridge-config__check-row--ok`:`oc-bridge-config__check-row--err`),children:[t.ok?(0,Q.jsx)(Tt,{"aria-hidden":!0}):(0,Q.jsx)(L,{"aria-hidden":!0}),(0,Q.jsxs)(`span`,{children:[e,` — `,t.ok?u():t.detail]})]}):(0,Q.jsxs)(`p`,{className:`oc-bridge-config__check-row oc-bridge-config__check-row--skip`,children:[e,` — `,ce()]}):null}function Dn({instance:e,onClose:t}){let n=pe(w.admin.upsertInstanceConfig),r=h(w.bridge.validateMediaPaths),i=Dt(),o=Ut(e.config?.contentLocale,void 0),[c,u]=(0,K.useState)(()=>_t(e.config??{},o)),[f,p]=(0,K.useState)(!1),[m,g]=(0,K.useState)(!1),[_,v]=(0,K.useState)(null),y=c.inboundMediaMode===`shared-fs`,b=c.mediaMode===`shared-fs`,x=y||b;async function S(){g(!0),v(null);try{v(await r({instanceName:e.name,inboundMediaMode:c.inboundMediaMode,mediaMode:c.mediaMode}))}catch(e){i.error(a(),e)}finally{g(!1)}}async function ae(){p(!0);try{let r=e.config??{};await n({instanceId:e._id,config:yt(c,r,o)}),t()}catch(e){i.error(ot(),e)}finally{p(!1)}}return(0,Q.jsx)(`div`,{className:`oc-bridge-config`,children:(0,Q.jsxs)(`div`,{className:`oc-bridge-config__form`,children:[(0,Q.jsxs)(`div`,{className:`oc-bridge-config__grid`,children:[(0,Q.jsxs)(`label`,{className:`oc-field`,children:[(0,Q.jsx)(E,{label:Re(),help:Ge()}),(0,Q.jsxs)(M,{value:c.mediaMode,onValueChange:e=>u({...c,mediaMode:e}),children:[(0,Q.jsx)(O,{size:`sm`,className:`w-full`,children:(0,Q.jsx)(P,{})}),(0,Q.jsx)(N,{children:bt.map(e=>(0,Q.jsx)(j,{value:e,children:e},e))})]})]}),(0,Q.jsxs)(`label`,{className:`oc-field`,children:[(0,Q.jsx)(E,{label:Je(),help:De()}),(0,Q.jsxs)(M,{value:c.inboundMediaMode,onValueChange:e=>u({...c,inboundMediaMode:e}),children:[(0,Q.jsx)(O,{size:`sm`,className:`w-full`,children:(0,Q.jsx)(P,{})}),(0,Q.jsx)(N,{children:vt.map(e=>(0,Q.jsx)(j,{value:e,children:e},e))})]})]}),(0,Q.jsxs)(`label`,{className:`oc-field`,children:[(0,Q.jsx)(E,{label:Qe(),help:we()}),(0,Q.jsx)(F,{type:`number`,min:1,max:4096,className:`w-full`,value:c.mediaMaxMb,onChange:e=>u({...c,mediaMaxMb:Math.trunc(Number(e.target.value)||0)})})]})]}),x&&(0,Q.jsxs)(`div`,{className:`oc-bridge-config__grid`,children:[y&&(0,Q.jsxs)(`label`,{className:`oc-field`,children:[(0,Q.jsx)(E,{label:ee(),help:d()}),(0,Q.jsx)(F,{className:`w-full`,spellCheck:!1,value:c.inboundAgentMount,onChange:e=>u({...c,inboundAgentMount:e.target.value})})]}),b&&(0,Q.jsxs)(`label`,{className:`oc-field`,children:[(0,Q.jsx)(E,{label:ie(),help:ne()}),(0,Q.jsx)(F,{className:`w-full`,spellCheck:!1,value:c.outboundAgentMount,onChange:e=>u({...c,outboundAgentMount:e.target.value})})]})]}),(0,Q.jsxs)(`label`,{className:`oc-field--row`,children:[(0,Q.jsx)(Vt,{checked:c.rehydration,onCheckedChange:e=>u({...c,rehydration:e===!0})}),(0,Q.jsx)(E,{label:Ne(),help:Be()})]}),x&&_!==null&&(0,Q.jsx)(`div`,{className:`oc-bridge-config__check`,children:_.reachable?!_.inbound&&!_.outbound?(0,Q.jsxs)(`p`,{className:`oc-bridge-config__check-row oc-bridge-config__check-row--err`,children:[(0,Q.jsx)(L,{"aria-hidden":!0}),s({reason:_.reason??`?`})]}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(En,{label:re(),result:_.inbound}),(0,Q.jsx)(En,{label:l(),result:_.outbound}),(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:We()})]}):(0,Q.jsxs)(`p`,{className:`oc-bridge-config__check-row oc-bridge-config__check-row--err`,children:[(0,Q.jsx)(L,{"aria-hidden":!0}),dt()]})}),(0,Q.jsxs)(`div`,{className:`oc-bridge-config__actions`,children:[x&&(0,Q.jsxs)(D,{variant:`outline`,size:`sm`,onClick:()=>void S(),disabled:m,children:[m?(0,Q.jsx)(Mt,{className:`size-4 animate-spin`,"aria-hidden":!0}):null,m?He():te()]}),(0,Q.jsx)(D,{size:`sm`,onClick:()=>void ae(),disabled:f,children:ke()})]})]})})}function On({versions:e}){if(e.length===0)return null;let t=[...e].reverse();return(0,Q.jsxs)(At,{children:[(0,Q.jsx)(Et,{asChild:!0,children:(0,Q.jsxs)(`button`,{type:`button`,className:`oc-compat__versions-btn`,children:[e.length===1?me():le({count:e.length}),(0,Q.jsx)(T,{size:13,"aria-hidden":!0})]})}),(0,Q.jsxs)(Ht,{className:`oc-compat__versions-pop`,align:`start`,children:[(0,Q.jsx)(`p`,{className:`oc-compat__versions-title`,children:g()}),(0,Q.jsx)(`div`,{className:`oc-compat__versions-list`,children:t.map(e=>(0,Q.jsx)(k,{variant:`secondary`,children:e},e))})]})]})}export{bn as BridgeTab,Tn as InstanceConfigDialog};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Ao as r,Cd as i,Co as a,Do as o,Eo as s,GR as c,HR as l,IR as u,Mo as d,Oo as f,Ru as p,Td as m,To as h,WR as g,au as _,cu as v,eu as y,gb as b,hr as x,iu as S,jo as C,ko as w,nu as T,ou as E,ru as D,su as O,t as k,tu as A,vd as j,wo as M,yd as N}from"./api-Dr5hDHvi.js";import{t as P}from"./button-BI3fckfr.js";import{$ as F,B as I,M as L,N as R,Q as z,X as B,Z as V,et as H,jt as U,rn as W,ut as G}from"./index-
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Ao as r,Cd as i,Co as a,Do as o,Eo as s,GR as c,HR as l,IR as u,Mo as d,Oo as f,Ru as p,Td as m,To as h,WR as g,au as _,cu as v,eu as y,gb as b,hr as x,iu as S,jo as C,ko as w,nu as T,ou as E,ru as D,su as O,t as k,tu as A,vd as j,wo as M,yd as N}from"./api-Dr5hDHvi.js";import{t as P}from"./button-BI3fckfr.js";import{$ as F,B as I,M as L,N as R,Q as z,X as B,Z as V,et as H,jt as U,rn as W,ut as G}from"./index-CaP52i63.js";import{i as K}from"./compatView-Dw2Mg_up.js";/* empty css */var q=t(e(),1),J=[`off`,`minimal`,`low`,`medium`,`high`,`xhigh`];function Y(e){let t=typeof e==`object`&&e?e:{},n=t.defaults!==null&&typeof t.defaults==`object`?t.defaults:{},r=n.thinkingDefault??t.thinkingDefault,i=n.fastModeDefault??t.fastModeDefault;return{thinkingDefault:typeof r==`string`?r:null,fastModeDefault:typeof i==`boolean`?i:null}}var X=n();function Z({instance:e}){let t=g(k.admin.upsertInstanceConfig),n=c(k.agents.listAgentsForInstance,{instanceName:e.name}),r=typeof e.config?.converterAgentId==`string`?e.config.converterAgentId:``,[i,a]=(0,q.useState)(r),[s,l]=(0,q.useState)(`idle`);(0,q.useEffect)(()=>{a(r),l(`idle`)},[e._id,r]);let u=`__none__`,d=i!==r;async function p(){l(`saving`);try{let n={...e.config??{}};i===``||i===u?delete n.converterAgentId:n.converterAgentId=i,await t({instanceId:e._id,config:n}),l(`done`)}catch{l(`error`)}}let h=n?.agents??[];return(0,X.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,X.jsx)(`span`,{className:`oc-cdefaults__label`,children:w()}),(0,X.jsx)(`p`,{className:`oc-admin__hint`,children:f()}),(0,X.jsxs)(`div`,{className:`oc-cdefaults__inline`,children:[(0,X.jsxs)(B,{value:i===``?u:i,onValueChange:e=>a(e===u?``:e),children:[(0,X.jsx)(F,{className:`oc-cdefaults__select`,"aria-label":w(),children:(0,X.jsx)(H,{placeholder:o()})}),(0,X.jsxs)(V,{children:[(0,X.jsx)(z,{value:u,children:o()}),h.map(e=>(0,X.jsx)(z,{value:e.agentId,children:e.displayName?`${e.displayName} (${e.agentId})`:e.agentId},e.agentId))]})]}),(0,X.jsx)(P,{size:`sm`,disabled:!d||s===`saving`,onClick:()=>void p(),children:s===`saving`?m():T()})]}),s===`done`?(0,X.jsx)(`p`,{className:`oc-admin__hint`,role:`status`,children:A()}):null,s===`error`?(0,X.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:y()}):null]})}function Q({instance:e}){let t=g(k.admin.upsertInstanceConfig),n=e.config?.curationEnabled===!0,i=typeof e.config?.curationBudgetChars==`number`?e.config.curationBudgetChars:null,[a,o]=(0,q.useState)(n),[c,l]=(0,q.useState)(i===null?``:String(i)),[u,d]=(0,q.useState)(`idle`);(0,q.useEffect)(()=>{o(n),l(i===null?``:String(i)),d(`idle`)},[e._id,n,i]);let f=c.trim(),p=f===``?null:/^\d+$/.test(f)?Number.parseInt(f,10):NaN,_=!a||p===null||Number.isInteger(p)&&p>=4e3&&p<=6e4,v=a!==n||(p??null)!==i;async function b(){d(`saving`);try{let n={...e.config??{}};n.curationEnabled=a,!a||p===null||Number.isNaN(p)?delete n.curationBudgetChars:n.curationBudgetChars=p,await t({instanceId:e._id,config:n}),d(`done`)}catch{d(`error`)}}return(0,X.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,X.jsxs)(`label`,{className:`oc-cdefaults__inline`,style:{cursor:`pointer`},children:[(0,X.jsx)(G,{checked:a,onCheckedChange:e=>o(e===!0),"aria-label":r()}),(0,X.jsx)(`span`,{className:`oc-cdefaults__label`,children:r()})]}),(0,X.jsxs)(`div`,{className:`oc-cdefaults__inline`,children:[(0,X.jsx)(U,{type:`number`,min:4e3,max:6e4,step:1e3,placeholder:`20000`,value:c,onChange:e=>l(e.target.value),className:`oc-cdefaults__number`,"aria-invalid":!_,"aria-label":s(),disabled:!a}),(0,X.jsx)(P,{size:`sm`,disabled:!v||!_||u===`saving`,onClick:()=>void b(),children:u===`saving`?m():T()})]}),_?null:(0,X.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:h()}),u===`done`?(0,X.jsx)(`p`,{className:`oc-admin__hint`,role:`status`,children:A()}):null,u===`error`?(0,X.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:y()}):null,(0,X.jsx)(`p`,{className:`oc-cdefaults__help`,children:M()})]})}function $({instance:e}){let t=g(k.admin.upsertInstanceConfig),n=typeof e.config?.summarizeThresholdChars==`number`?e.config.summarizeThresholdChars:null,[r,i]=(0,q.useState)(n===null?``:String(n)),[o,s]=(0,q.useState)(`idle`);(0,q.useEffect)(()=>{i(n===null?``:String(n)),s(`idle`)},[e._id,n]);let c=r.trim(),l=c===``?null:/^\d+$/.test(c)?Number.parseInt(c,10):NaN,u=l===null||Number.isInteger(l)&&l>=1e3&&l<=2e5,f=(l??null)!==n;async function p(){s(`saving`);try{let n={...e.config??{}};l===null?delete n.summarizeThresholdChars:n.summarizeThresholdChars=l,await t({instanceId:e._id,config:n}),s(`done`)}catch{s(`error`)}}return(0,X.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,X.jsx)(`span`,{className:`oc-cdefaults__label`,children:d()}),(0,X.jsxs)(`div`,{className:`oc-cdefaults__inline`,children:[(0,X.jsx)(U,{type:`number`,min:1e3,max:2e5,step:1e3,placeholder:`8000`,value:r,onChange:e=>i(e.target.value),className:`oc-cdefaults__number`,"aria-invalid":!u}),(0,X.jsx)(P,{size:`sm`,disabled:!f||!u||o===`saving`,onClick:()=>void p(),children:o===`saving`?m():T()})]}),u?null:(0,X.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:a()}),o===`done`?(0,X.jsx)(`p`,{className:`oc-admin__hint`,role:`status`,children:A()}):null,o===`error`?(0,X.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:y()}):null,(0,X.jsx)(`p`,{className:`oc-cdefaults__help`,children:C()})]})}function ee(){let e=l(k.agentFiles.getChatDefaults),[t,n]=(0,q.useState)({status:`loading`}),r=c(k.admin.listInstances,{}),[a,o]=(0,q.useState)(null);(0,q.useEffect)(()=>{!r||r.length===0||(!a||!r.some(e=>e.name===a))&&o(r[0].name)},[r,a]);let s=(r?.length??0)>1,d=r!==void 0&&r.length===0,f=c(k.compat.forInstance,a?{instanceName:a}:`skip`),m=a?I(f,`configDefaults`):`loading`,h=m===`loading`?null:m.blocked,g=(0,q.useMemo)(()=>s&&a?{instanceName:a}:{},[s,a]),y=(0,q.useRef)(0),C=(0,q.useCallback)(async()=>{let t=++y.current;n({status:`loading`});try{let r=Y(await e(g));if(y.current!==t)return;n({status:`done`,current:r})}catch{if(y.current!==t)return;n({status:`error`})}},[e,g]);(0,q.useEffect)(()=>{h===!1&&(s&&!a||C())},[C,h,s,a]);let w=t.status===`done`?t.current:null,T=(0,q.useMemo)(()=>J.map(e=>({id:e,label:R(e)})),[]),A=(0,q.useMemo)(()=>[{id:`fast`,label:N()},{id:`standard`,label:j()}],[]);return(0,X.jsxs)(`div`,{className:`oc-cdefaults`,children:[(0,X.jsx)(`p`,{className:`oc-admin__hint`,children:v()}),s&&a?(0,X.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,X.jsx)(`span`,{className:`oc-cdefaults__label`,children:p()}),(0,X.jsxs)(B,{value:a,onValueChange:e=>o(e),children:[(0,X.jsx)(F,{size:`sm`,"aria-label":p(),children:(0,X.jsx)(H,{})}),(0,X.jsx)(V,{children:(r??[]).map(e=>(0,X.jsx)(z,{value:e.name,children:e.name},e.name))})]})]}):null,d?(0,X.jsx)(`p`,{className:`oc-admin__hint`,role:`status`,children:b()}):m===`loading`?(0,X.jsx)(`p`,{className:`oc-admin__hint`,children:u()}):m.blocked?(0,X.jsxs)(`p`,{className:`oc-compat__blocked`,role:`status`,children:[(0,X.jsx)(W,{size:14,"aria-hidden":!0}),` `,K(m.gatewayVersion,m.provider)]}):t.status===`loading`?(0,X.jsx)(`p`,{className:`oc-admin__hint`,children:u()}):t.status===`error`?(0,X.jsxs)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:[D(),` `,(0,X.jsx)(P,{variant:`outline`,size:`sm`,onClick:()=>void C(),children:i()})]}):(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,X.jsx)(`span`,{className:`oc-cdefaults__label`,children:O()}),(0,X.jsx)(L,{options:T,value:w?.thinkingDefault??null,onChange:()=>{},disabled:!0}),(0,X.jsx)(`p`,{className:`oc-cdefaults__help`,children:E()})]}),(0,X.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,X.jsx)(`span`,{className:`oc-cdefaults__label`,children:_()}),(0,X.jsx)(L,{options:A,value:w===null||w.fastModeDefault===null?null:w.fastModeDefault?`fast`:`standard`,onChange:()=>{},disabled:!0}),(0,X.jsx)(`p`,{className:`oc-cdefaults__help`,children:S()})]}),(0,X.jsx)(`p`,{className:`oc-cdefaults__note`,children:x()})]}),(()=>{let e=r?.find(e=>e.name===(a??r[0]?.name));return e?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)($,{instance:e}),(0,X.jsx)(Q,{instance:e}),(0,X.jsx)(Z,{instance:e})]}):null})()]})}export{ee as ChatDefaultsTab};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Am as r,Fm as i,Im as a,Mm as o,Nm as s,Pm as c,jm as l}from"./api-Dr5hDHvi.js";import{r as u}from"./dist-B9J3rPRX.js";import{t as d}from"./chevron-up-BwcZQhBy.js";import{t as f}from"./chevrons-up-down-DBgS9XVd.js";import{t as p}from"./button-BI3fckfr.js";import{En as m,It as h,Lt as g,Mt as _,Nt as v,Pt as y,in as b,ln as x,ut as S}from"./index-
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Am as r,Fm as i,Im as a,Mm as o,Nm as s,Pm as c,jm as l}from"./api-Dr5hDHvi.js";import{r as u}from"./dist-B9J3rPRX.js";import{t as d}from"./chevron-up-BwcZQhBy.js";import{t as f}from"./chevrons-up-down-DBgS9XVd.js";import{t as p}from"./button-BI3fckfr.js";import{En as m,It as h,Lt as g,Mt as _,Nt as v,Pt as y,in as b,ln as x,ut as S}from"./index-CaP52i63.js";import{a as C,i as w,n as T,o as E,r as D,t as O}from"./table-CH0obeXz.js";var k=t(e(),1);function A(e,t){return typeof e==`number`&&typeof t==`number`?e-t:typeof e==`boolean`&&typeof t==`boolean`?!!e-+!!t:String(e).localeCompare(String(t),void 0,{numeric:!0,sensitivity:`base`})}function j(e,t,n){return[...e].sort((e,r)=>{let i=t(e),a=t(r),o=i==null,s=a==null;if(o||s)return o&&s?0:o?1:-1;let c=A(i,a);return n===`asc`?c:-c})}var M=n();function N({title:e,rows:t,columns:n,rowActions:A,onAdd:N,addLabel:P=a(),bulkActions:F,emptyHint:I=i(),isExpanded:L,renderExpanded:R}){let[z,B]=(0,k.useState)(new Set),[V,H]=(0,k.useState)(null),U=t??[],W=V?n[V.index]:void 0,G=V&&W?.sort?j(U,W.sort,V.dir):U;function K(e){H(t=>!t||t.index!==e?{index:e,dir:`asc`}:t.dir===`asc`?{index:e,dir:`desc`}:null)}let q=+!!F+n.length+ +!!A,J=U.length>0&&z.size===U.length,Y=z.size>0&&!J;function X(){B(J?new Set:new Set(U.map(e=>e._id)))}function Z(e){B(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})}return(0,M.jsxs)(`div`,{className:`oc-dt`,children:[(0,M.jsxs)(`div`,{className:`oc-dt__bar`,children:[(0,M.jsx)(`h2`,{className:`oc-dt__title`,children:e}),(0,M.jsxs)(`div`,{className:`oc-dt__bar-actions`,children:[z.size>0&&F?F.map(e=>(0,M.jsxs)(p,{size:`sm`,variant:e.variant===`destructive`?`destructive`:`outline`,onClick:()=>{e.onSelect([...z]),B(new Set)},children:[e.variant===`destructive`?(0,M.jsx)(b,{}):null,e.label,` (`,z.size,`)`]},e.label)):null,N?(0,M.jsxs)(p,{size:`sm`,onClick:N,children:[(0,M.jsx)(x,{}),` `,P]}):null]})]}),t===void 0?(0,M.jsx)(`p`,{className:`oc-admin__hint`,children:c()}):U.length===0?(0,M.jsx)(`p`,{className:`oc-admin__hint`,children:I}):(0,M.jsxs)(O,{children:[(0,M.jsx)(C,{children:(0,M.jsxs)(E,{children:[F?(0,M.jsx)(w,{className:`w-8`,children:(0,M.jsx)(S,{"aria-label":s(),checked:J?!0:Y?`indeterminate`:!1,onCheckedChange:X})}):null,n.map((e,t)=>{let n=V?.index===t;return e.sort?(0,M.jsx)(w,{className:e.className,"aria-sort":n?V.dir===`asc`?`ascending`:`descending`:`none`,children:(0,M.jsxs)(`button`,{type:`button`,className:`oc-dt__sort`,onClick:()=>K(t),"aria-label":r({column:e.header}),children:[e.header,n?V.dir===`asc`?(0,M.jsx)(d,{className:`oc-dt__sort-icon`,"aria-hidden":!0}):(0,M.jsx)(u,{className:`oc-dt__sort-icon`,"aria-hidden":!0}):(0,M.jsx)(f,{className:`oc-dt__sort-icon oc-dt__sort-icon--idle`,"aria-hidden":!0})]})},e.header):(0,M.jsx)(w,{className:e.className,children:e.header},e.header)}),A?(0,M.jsx)(w,{className:`w-8`}):null]})}),(0,M.jsx)(T,{children:G.map(e=>{let t=A?.(e)??[],r=L?.(e)??!1;return(0,M.jsxs)(k.Fragment,{children:[(0,M.jsxs)(E,{className:`group/row`,children:[F?(0,M.jsx)(D,{children:(0,M.jsx)(S,{"aria-label":o(),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)(p,{variant:`ghost`,size:`icon-sm`,"aria-label":l(),className:`opacity-0 transition-opacity group-hover/row:opacity-100 group-focus-within/row:opacity-100 aria-expanded:opacity-100`,children:(0,M.jsx)(m,{})})}),(0,M.jsx)(v,{align:`end`,children:t.map((t,n)=>(0,M.jsxs)(`div`,{children:[t.variant===`destructive`&&n>0?(0,M.jsx)(h,{}):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{Et as t}from"./index-
|
|
1
|
+
import{r as e}from"./bundle-mjs-C73ZY4La.js";import{Et as t}from"./index-CaP52i63.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{$E as r,AD as i,BE as a,CD as o,DD as s,ED as c,FD as l,FE as u,GE as d,GR as f,HE as p,ID as m,IE as h,Ia as g,JE as _,KE as ee,LE as te,MD as ne,ND as re,OD as ie,PD as ae,PE as v,QE as y,RE as b,Ra as x,SD as S,TD as C,UE as w,VE as T,WE as E,WR as D,XE as O,YE as k,ZE as A,_D as j,aD as M,bD as N,cD as P,dD as F,eD as I,fD as L,gD as R,hD as z,iD as B,jD as V,kD as oe,lD as H,mD as U,nD as W,oD as G,pD as K,qE as q,rD as se,sD as ce,t as J,tD as le,uD as ue,vD as de,wD as fe,xD as pe,yD as me,zE as he}from"./api-Dr5hDHvi.js";import{t as ge}from"./button-BI3fckfr.js";import{U as _e,ct as Y}from"./index-
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$E as r,AD as i,BE as a,CD as o,DD as s,ED as c,FD as l,FE as u,GE as d,GR as f,HE as p,ID as m,IE as h,Ia as g,JE as _,KE as ee,LE as te,MD as ne,ND as re,OD as ie,PD as ae,PE as v,QE as y,RE as b,Ra as x,SD as S,TD as C,UE as w,VE as T,WE as E,WR as D,XE as O,YE as k,ZE as A,_D as j,aD as M,bD as N,cD as P,dD as F,eD as I,fD as L,gD as R,hD as z,iD as B,jD as V,kD as oe,lD as H,mD as U,nD as W,oD as G,pD as K,qE as q,rD as se,sD as ce,t as J,tD as le,uD as ue,vD as de,wD as fe,xD as pe,yD as me,zE as he}from"./api-Dr5hDHvi.js";import{t as ge}from"./button-BI3fckfr.js";import{U as _e,ct as Y}from"./index-CaP52i63.js";import{t as ve}from"./DataTableShell-vuJDvlum.js";var X=t(e(),1),Z=n(),ye={altered_words:()=>m(),incorrect:()=>l(),incoherence:()=>ae(),formatting:()=>re(),latency:()=>ne(),api_error:()=>V(),other:()=>i()},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:ie()}):e===!1?(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-warn`,children:s()}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill`,children:`—`}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill`,children:oe()})}function be({data:e,reference:t,closeReason:n}){let r=e.snapshot,i=D(J.feedback.respondToFeedback),[s,l]=(0,X.useState)(e.thread),[u,d]=(0,X.useState)(``),[f,p]=(0,X.useState)(!1);async function m(){let t=u.trim();if(!(!t||f)){p(!0);try{await i({feedbackId:e._id,text:t}),l(e=>[...e,{authorRole:`admin`,text:t,at:Date.now()}]),d(``)}finally{p(!1)}}}let h=[];try{h=r.contextJson?JSON.parse(r.contextJson):[]}catch{h=[]}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?` · ${c()}`:``,r.openclawModel?` · ${r.openclawModel}`:``,r.openclawRuntime?` (${r.openclawRuntime})`:``]}),t?(0,Z.jsx)(`code`,{className:`oc-fbadmin__ref`,style:{userSelect:`all`,marginLeft:`auto`},title:I(),children:t}):null]}),e.comment?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:C()}),(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:a()}),(0,Z.jsx)(`p`,{className:`oc-fbadmin__comment`,children:n})]}):null,(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:fe()}),s.length>0?(0,Z.jsx)(`div`,{className:`oc-fbadmin__thread`,children:s.map((e,t)=>(0,Z.jsxs)(`div`,{className:`oc-notif__msg oc-notif__msg--${e.authorRole}`,children:[(0,Z.jsx)(`span`,{className:`oc-notif__msg-who`,children:e.authorRole===`admin`?o():e.authorRole===`agent`?e.authorLabel??x():S()}),(0,Z.jsx)(`span`,{className:`oc-notif__msg-text`,children:e.text})]},t))}):(0,Z.jsx)(`p`,{className:`oc-fbadmin__meta`,children:pe()}),(0,Z.jsx)(`textarea`,{className:`oc-feedback__textarea`,placeholder:N(),value:u,maxLength:2e3,rows:3,onChange:e=>d(e.target.value.slice(0,2e3))}),(0,Z.jsx)(`div`,{className:`oc-fbadmin__row`,style:{justifyContent:`flex-end`},children:(0,Z.jsx)(ge,{size:`sm`,onClick:()=>void m(),disabled:!u.trim()||f,children:f?me():de()})})]}),(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:j()}),(0,Z.jsx)(`pre`,{className:`oc-msg__source-pre`,children:r.messageText||R()})]}),r.clientInfo?.sourceWasOpen&&r.displayedText!==void 0?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:z()}),(0,Z.jsx)(`pre`,{className:`oc-msg__source-pre`,children:r.displayedText||R()})]}):null,r.promptText?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:U()}),(0,Z.jsx)(`pre`,{className:`oc-msg__source-pre`,children:r.promptText})]}):null,h.length>0?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:K({count:r.contextCount??h.length,truncated:r.contextTruncated?L():``})}),(0,Z.jsx)(`div`,{className:`oc-fbadmin__ctx`,children:h.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:F()}),(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:ue()}),(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:H()}),(0,Z.jsxs)(`p`,{className:`oc-fbadmin__env`,children:[[r.clientInfo?.language,r.clientInfo?.timezone,r.clientInfo?.theme?P({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:[ce(),` `,r.clientInfo.plugins.join(`, `),(0,Z.jsxs)(`span`,{className:`oc-fbadmin__note`,children:[` `,G()]})]}):null,r.clientInfo?.userAgent?(0,Z.jsx)(`span`,{className:`oc-fbadmin__ua`,children:r.clientInfo.userAgent}):null]})]})]})}function xe(){let e=f(J.feedback.listForAdmin,{}),t=D(J.feedback.readSnapshot),n=D(J.feedback.deleteFeedback),i=_e(),[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 m(e){await i({title:h(),description:u(),confirmLabel:v(),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:[M(),` `,(0,Z.jsx)(`strong`,{children:B()}),` `,se()]}),(0,Z.jsx)(ve,{title:W(),rows:e,emptyHint:le(),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=>Y(e.at),sort:e=>e.at},{header:y(),cell:e=>Q(e.category),sort:e=>Q(e.category)},{header:A(),cell:e=>e.messageRole===`user`?O():k(),sort:e=>e.messageRole},{header:_(),cell:e=>(e.reporterEmail||e.reporterName||`—`)+(e.impersonated&&e.realOperatorEmail?` ${q({operator:e.realOperatorEmail})}`:``),sort:e=>e.reporterEmail||e.reporterName||null},{header:ee(),cell:e=>(0,Z.jsx)($,{matches:e.displayedMatchesStored,sourceWasOpen:e.sourceWasOpen}),sort:e=>e.displayedMatchesStored===!1?0:e.displayedMatchesStored===!0?1:2},{header:d(),cell:e=>e.hasComment?`✎`:`—`,sort:e=>+!!e.hasComment},{header:E(),cell:e=>e.userClosedAt==null?e.resolvedAt==null?e.answered?(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-ok`,children:w()}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill`,children:p()}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-ok`,title:e.resolvedBy??void 0,children:g()}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-closed`,children:T()}),sort:e=>e.userClosedAt==null?e.resolvedAt==null?+!!e.answered:2:3}],rowActions:e=>[{label:a===e._id?he():b(),onSelect:()=>void l(e)},{label:te(),onSelect:()=>void m(e),variant:`destructive`}]})]})}export{xe as FeedbacksTab};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{r as e}from"./bundle-mjs-C73ZY4La.js";import{D as t,QR as n}from"./api-Dr5hDHvi.js";import{I as r,L as i,R as a,z as o}from"./index-
|
|
1
|
+
import{r as e}from"./bundle-mjs-C73ZY4La.js";import{D as t,QR as n}from"./api-Dr5hDHvi.js";import{I as r,L as i,R as a,z as o}from"./index-CaP52i63.js";import"./locales-CPjguROj.js";import"./curation-CQksaIbm.js";var s=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`}]]),c={media_delivery:{key:`media_delivery`,appliedIn:`bridge`,togglable:!0,placeholders:[`outboundDir`],defaultTemplate:{fr:`[LIVRAISON]
|
|
2
2
|
Pour qu'un fichier que tu génères soit téléchargeable par l'utilisateur dans ce webchat : écris-le sous {outboundDir}/ puis ajoute, dans ta réponse finale, une ligne dédiée EXACTEMENT au format MEDIA:<chemin absolu du fichier>. N'utilise PAS de lien markdown vers un chemin local — il ne serait pas cliquable.`,en:`[DELIVERY]
|
|
3
3
|
To make a file you generate downloadable by the user in this webchat: write it under {outboundDir}/ then add, in your final reply, a dedicated line EXACTLY in the format MEDIA:<absolute file path>. Do NOT use a markdown link to a local path — it would not be clickable.`}},documentary_fetch:{key:`documentary_fetch`,appliedIn:`convex`,togglable:!0,placeholders:[`references`],defaultTemplate:{fr:`Fournis les fichiers source téléchargeables correspondant EXACTEMENT à ces références de documents (un fichier par référence, nommé d'après la référence). Réponds uniquement avec les fichiers, sans commentaire :
|
|
4
4
|
{references}`,en:`Provide the downloadable source files matching EXACTLY these document references (one file per reference, named after the reference). Reply only with the files, no commentary:
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$L as r,AL as i,BL as a,CL as ee,DL as te,EL as o,FL as s,GL as c,GR as ne,HA as re,HL as l,Ha as u,IL as d,IR as f,JL as p,KL as m,LL as ie,ML as ae,NL as oe,OL as se,PL as ce,QL as le,RL as ue,RR as de,SL as fe,TL as pe,UL as h,VL as g,Va as me,WL as _,WR as he,XL as ge,YL as _e,ZL as ve,eR as v,jL as ye,kL as be,nR as y,qL as b,rR as x,t as S,tR as C,wL as w,zL as T}from"./api-Dr5hDHvi.js";import{t as E}from"./button-BI3fckfr.js";import{$ as D,Ct as O,Dn as k,Dt as A,En as j,Et as M,Lt as N,Mt as xe,Nt as Se,Pt as P,Q as F,St as Ce,Tt as we,X as I,Z as L,bt as Te,cn as Ee,et as R,in as De,ut as Oe,vt as ke,wt as Ae,xt as je,yt as Me}from"./index-
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$L as r,AL as i,BL as a,CL as ee,DL as te,EL as o,FL as s,GL as c,GR as ne,HA as re,HL as l,Ha as u,IL as d,IR as f,JL as p,KL as m,LL as ie,ML as ae,NL as oe,OL as se,PL as ce,QL as le,RL as ue,RR as de,SL as fe,TL as pe,UL as h,VL as g,Va as me,WL as _,WR as he,XL as ge,YL as _e,ZL as ve,eR as v,jL as ye,kL as be,nR as y,qL as b,rR as x,t as S,tR as C,wL as w,zL as T}from"./api-Dr5hDHvi.js";import{t as E}from"./button-BI3fckfr.js";import{$ as D,Ct as O,Dn as k,Dt as A,En as j,Et as M,Lt as N,Mt as xe,Nt as Se,Pt as P,Q as F,St as Ce,Tt as we,X as I,Z as L,bt as Te,cn as Ee,et as R,in as De,ut as Oe,vt as ke,wt as Ae,xt as je,yt as Me}from"./index-CaP52i63.js";import{a as Ne,i as z,n as Pe,o as B,r as V,t as Fe}from"./table-CH0obeXz.js";var H=t(e(),1),U=n(),W=`all`;function G(e){switch(e){case`image`:return m();case`audio`:return c();case`video`:return _();case`pdf`:return h();case`document`:return l();case`archive`:return g();default:return a()}}function K(){let[e,t]=(0,H.useState)(W),[n,a]=(0,H.useState)(W),[c,l]=(0,H.useState)(W),[m,h]=(0,H.useState)(W),[g,_]=(0,H.useState)(!1),[K,q]=(0,H.useState)(null),J=he(S.files.softDelete),Y=A();function Ie(){t(W),a(W),l(W),h(W)}async function Le(){let e=K;if(q(null),e)try{await J({fileId:e.id}),Y.success(be())}catch(e){Y.error(se(),e)}}let X=ne(S.files.listMine,{direction:e===W?void 0:e,chatId:n===W?void 0:n,instanceName:c===W?void 0:c,category:m===W?void 0:m,includeAutoGenerated:g||void 0}),Re=(0,H.useMemo)(()=>new Intl.DateTimeFormat(de(),{dateStyle:`medium`,timeStyle:`short`}),[]);if(X===void 0)return(0,U.jsx)(`p`,{className:`oc-admin__hint`,children:f()});let{files:Z,facets:Q,truncated:ze,cap:Be}=X,$=e!==W||n!==W||c!==W||m!==W;return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`p`,{className:`oc-admin__hint`,children:x()}),(0,U.jsxs)(`div`,{className:`oc-files__filters`,style:{display:`flex`,flexWrap:`wrap`,gap:8,margin:`12px 0`},children:[(0,U.jsxs)(I,{value:e,onValueChange:t,children:[(0,U.jsx)(D,{size:`sm`,"aria-label":y(),children:(0,U.jsx)(R,{})}),(0,U.jsxs)(L,{children:[(0,U.jsx)(F,{value:W,children:C()}),(0,U.jsx)(F,{value:`inbound`,children:v()}),(0,U.jsx)(F,{value:`outbound`,children:r()})]})]}),(0,U.jsxs)(I,{value:n,onValueChange:a,children:[(0,U.jsx)(D,{size:`sm`,"aria-label":le(),children:(0,U.jsx)(R,{})}),(0,U.jsxs)(L,{children:[(0,U.jsx)(F,{value:W,children:ve()}),Q.chats.map(e=>(0,U.jsx)(F,{value:e.id,children:e.title},e.id))]})]}),Q.multiProvider?(0,U.jsxs)(I,{value:c,onValueChange:l,children:[(0,U.jsx)(D,{size:`sm`,"aria-label":ge(),children:(0,U.jsx)(R,{})}),(0,U.jsxs)(L,{children:[(0,U.jsx)(F,{value:W,children:_e()}),Q.instances.map(e=>(0,U.jsx)(F,{value:e,children:e},e))]})]}):null,(0,U.jsxs)(I,{value:m,onValueChange:h,children:[(0,U.jsx)(D,{size:`sm`,"aria-label":p(),children:(0,U.jsx)(R,{})}),(0,U.jsxs)(L,{children:[(0,U.jsx)(F,{value:W,children:b()}),Q.categories.map(e=>(0,U.jsx)(F,{value:e,children:G(e)},e))]})]}),(0,U.jsxs)(`label`,{className:`oc-files__autogen`,children:[(0,U.jsx)(Oe,{checked:g,onCheckedChange:e=>_(e===!0),"aria-label":u()}),(0,U.jsx)(`span`,{children:u()})]}),$?(0,U.jsxs)(E,{variant:`ghost`,size:`sm`,onClick:Ie,style:{display:`inline-flex`,alignItems:`center`,gap:4,marginLeft:`auto`},children:[(0,U.jsx)(Ee,{size:14,"aria-hidden":!0}),ae()]}):null]}),Z.length===0?(0,U.jsx)(`p`,{className:`oc-admin__hint`,children:$?ee():w()}):(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(Fe,{children:[(0,U.jsx)(Ne,{children:(0,U.jsxs)(B,{children:[(0,U.jsx)(z,{children:T()}),(0,U.jsx)(z,{children:ue()}),(0,U.jsx)(z,{children:ie()}),(0,U.jsx)(z,{children:d()}),(0,U.jsx)(z,{children:s()}),(0,U.jsx)(z,{className:`text-right`,children:ce()})]})}),(0,U.jsx)(Pe,{children:Z.map(e=>(0,U.jsxs)(B,{children:[(0,U.jsxs)(V,{className:`font-medium`,style:{maxWidth:280,overflow:`hidden`,textOverflow:`ellipsis`},title:e.filename,children:[e.filename,e.origin===`pasted`?(0,U.jsx)(M,{variant:`outline`,style:{marginLeft:6},children:me()}):null]}),(0,U.jsx)(V,{title:e.mimeType,children:G(e.category)}),(0,U.jsx)(V,{children:(0,U.jsx)(M,{variant:`secondary`,children:e.direction===`inbound`?v():r()})}),(0,U.jsx)(V,{style:{maxWidth:220,overflow:`hidden`,textOverflow:`ellipsis`},title:e.chatTitle,children:e.chatTitle}),(0,U.jsx)(V,{className:`whitespace-nowrap text-muted-foreground`,children:Re.format(e.createdAt)}),(0,U.jsx)(V,{className:`text-right`,children:(0,U.jsxs)(xe,{children:[(0,U.jsx)(N,{asChild:!0,children:(0,U.jsx)(E,{variant:`ghost`,size:`icon`,"aria-label":ye(),children:(0,U.jsx)(j,{size:16})})}),(0,U.jsxs)(Se,{align:`end`,children:[e.url?(0,U.jsx)(P,{asChild:!0,children:(0,U.jsxs)(`a`,{href:e.url,download:e.filename,target:`_blank`,rel:`noopener noreferrer`,children:[(0,U.jsx)(k,{size:14}),oe()]})}):(0,U.jsxs)(P,{disabled:!0,children:[(0,U.jsx)(k,{size:14}),pe()]}),(0,U.jsxs)(P,{variant:`destructive`,onSelect:()=>q({id:e._id,filename:e.filename}),children:[(0,U.jsx)(De,{size:14}),i()]})]})]})})]},e._id))})]}),ze?(0,U.jsx)(`p`,{className:`oc-admin__hint`,style:{marginTop:8},children:fe({cap:Be})}):null]}),(0,U.jsx)(ke,{open:K!==null,onOpenChange:e=>!e&&q(null),children:(0,U.jsxs)(je,{children:[(0,U.jsxs)(Ae,{children:[(0,U.jsx)(we,{children:te()}),(0,U.jsx)(Ce,{children:o()})]}),(0,U.jsxs)(O,{children:[(0,U.jsx)(Te,{children:re()}),(0,U.jsx)(Me,{onClick:()=>void Le(),children:i()})]})]})})]})}export{K as FilesTab};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Lm as r,Rm as i}from"./api-Dr5hDHvi.js";import{t as a}from"./button-BI3fckfr.js";import{cn as o,jt as s,sn as c}from"./index-
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Lm as r,Rm as i}from"./api-Dr5hDHvi.js";import{t as a}from"./button-BI3fckfr.js";import{cn as o,jt as s,sn as c}from"./index-CaP52i63.js";import{t as l}from"./TimeRangePicker-BWBSluZX.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)(c,{className:`oc-filterbar__search-icon`,"aria-hidden":!0}),(0,d.jsx)(s,{value:v,onChange:e=>x(e.target.value),placeholder:n,"aria-label":n})]}),p?(0,d.jsx)(`div`,{className:`oc-filterbar__quick`,children:p}):null,m&&h?(0,d.jsx)(l,{value:m,onChange:h}):null,(0,d.jsxs)(a,{variant:`ghost`,size:`sm`,className:`oc-filterbar__reset`,onClick:S,disabled:!_,children:[(0,d.jsx)(o,{}),r()]})]})}export{p as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$d as r,Af as i,Bd as a,Bf as o,Cf as s,D as c,Df as l,Ef as u,Ff as d,GR as f,Gd as p,Gf as m,Hd as h,Hf as g,If as _,Jd as v,Kd as y,Kf as b,Ld as x,Lf as S,Mf as ee,Nf as C,Of as te,Pf as ne,Qd as w,Rd as T,Rf as E,Sf as D,Tf as re,Ud as O,Uf as ie,Vd as k,Vf as A,WR as j,Wd as M,Wf as ae,Xd as N,Yd as P,Zd as F,_f as I,af as oe,bf as se,cf as L,df as R,ef as z,ff as ce,gf as le,hf as ue,if as de,jf as fe,kf as pe,lf as me,mf as he,nf as ge,of as _e,pf as ve,qd as ye,rf as be,sf as xe,t as B,tf as Se,uf as Ce,vf as we,wf as Te,xf as Ee,yf as De,zd as Oe,zf as ke}from"./api-Dr5hDHvi.js";import{t as Ae}from"./x-B_mNl1Gq.js";import{i as V,n as H,r as je,t as Me}from"./tabs-qs6n9nsm.js";import{t as U}from"./button-BI3fckfr.js";import{$ as Ne,Dt as W,Et as G,Mn as Pe,Q as Fe,U as Ie,X as Le,Z as Re,_ as ze,an as K,at as Be,et as Ve,jn as He,jt as q,nt as Ue,on as J,ot as We,q as Ge,rt as Ke,tt as qe,ut as Y}from"./index-Bp13zOvd.js";import{t as Je}from"./FilterBar-DZvwFu4q.js";import{t as Ye}from"./DataTableShell-CzIcsYvR.js";import{t as X}from"./DetailChips-Rp2S51Jt.js";var Xe=c(`palette`,[[`path`,{d:`M12 22a1 1 0 0 1 0-20 10 9 0 0 1 10 9 5 5 0 0 1-5 5h-2.25a1.75 1.75 0 0 0-1.4 2.8l.3.4a1.75 1.75 0 0 1-1.4 2.8z`,key:`e79jfc`}],[`circle`,{cx:`13.5`,cy:`6.5`,r:`.5`,fill:`currentColor`,key:`1okk4w`}],[`circle`,{cx:`17.5`,cy:`10.5`,r:`.5`,fill:`currentColor`,key:`f64h9f`}],[`circle`,{cx:`6.5`,cy:`12.5`,r:`.5`,fill:`currentColor`,key:`qy21gx`}],[`circle`,{cx:`8.5`,cy:`7.5`,r:`.5`,fill:`currentColor`,key:`fotxhn`}]]),Z=c(`shield-check`,[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`,key:`oel41y`}],[`path`,{d:`m9 12 2 2 4-4`,key:`dzmm74`}]]),Ze=c(`users`,[[`path`,{d:`M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2`,key:`1yyitq`}],[`path`,{d:`M16 3.128a4 4 0 0 1 0 7.744`,key:`16gr8j`}],[`path`,{d:`M22 21v-2a4 4 0 0 0-3-3.87`,key:`kshegd`}],[`circle`,{cx:`9`,cy:`7`,r:`4`,key:`nufk8`}]]),Q=t(e(),1);function Qe(e,t,n){let r=t.trim().toLowerCase();return[...r?e.filter(e=>[e.email,e.name,e.canonical].some(e=>e!=null&&e.toLowerCase().includes(r))):e.slice()].sort((e,t)=>!n.has(e.userId)-+!n.has(t.userId))}function $e(e,t){let n=e.filter(e=>e.source===`discovered`),r=t.trim().toLowerCase();return r?n.filter(e=>(e.displayName??e.agentId).toLowerCase().includes(r)||e.agentId.toLowerCase().includes(r)):n}function et(e){let t=e.name?.trim()??``,n=e.email?.trim()??``,r=e.canonical?.trim()||`u-${e.userId.slice(0,8)}`;return t?{primary:t,secondary:n||`@${r}`}:n?{primary:n,secondary:null}:{primary:`@${r}`,secondary:null}}function tt(e){switch(e){case`admin`:return ve();case`user`:return ce();case`pending`:return R();default:return e}}function nt(e,t){if(e.length===0)return`none`;let n=0;for(let r of e)t(r)&&n++;return n===0?`none`:n===e.length?`all`:`some`}function rt(e,t,n){let r=Math.max(1,Math.ceil(e.length/n)),i=Math.min(Math.max(1,Math.floor(t)),r),a=(i-1)*n;return{pageItems:e.slice(a,a+n),page:i,pageCount:r}}var $=n(),it={name:``,description:``};function at(){let e=f(B.groups.listGroups,{}),t=f(B.me.getMe,{host:Ge})?.role===`admin`,n=j(B.groups.createGroup),r=j(B.groups.updateGroup),s=j(B.groups.deleteGroup),c=Ie(),p=W(),[h,v]=(0,Q.useState)(!1),[y,x]=(0,Q.useState)(null),[w,T]=(0,Q.useState)(it),[D,O]=(0,Q.useState)(null),[k,M]=(0,Q.useState)(``),N=(0,Q.useMemo)(()=>{if(!e)return e;let t=k.trim().toLowerCase();return t?e.filter(e=>e.name.toLowerCase().includes(t)||(e.description??``).toLowerCase().includes(t)||e.members.some(e=>e.label.toLowerCase().includes(t))||e.agents.some(e=>e.toLowerCase().includes(t))||e.charts.some(e=>e.name.toLowerCase().includes(t))):e},[e,k]);function P(){x(null),T(it),v(!0)}function F(e){x(e),T({name:e.name,description:e.description??``}),v(!0)}async function I(){try{y?await r({groupId:y._id,name:w.name,description:w.description}):await n({name:w.name,description:w.description||void 0}),T(it),x(null),v(!1)}catch(e){p.error(a(),e)}}async function oe(e){if(await c({title:l({name:e.name}),description:u(),confirmWord:e.name,confirmLabel:re(),cancelLabel:C(),destructive:!0}))try{await s({groupId:e._id})}catch(e){p.error(Oe(),e)}}return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`p`,{className:`oc-admin__hint`,children:m()}),(0,$.jsx)(Je,{q:k,onQChange:M,onReset:()=>M(``),canReset:k!==``,searchPlaceholder:E()}),(0,$.jsx)(Ye,{title:b(),rows:N,addLabel:ae(),onAdd:t?P:void 0,emptyHint:ie(),columns:[{header:g(),cell:e=>e.name,sort:e=>e.name},{header:A(),cell:e=>(0,$.jsx)(X,{icon:(0,$.jsx)(Ze,{size:12,"aria-hidden":!0}),total:e.memberCount,items:e.members.map(e=>({label:e.label,marker:e.manager?(0,$.jsx)(Z,{size:11,"aria-hidden":!0}):null,highlight:e.manager}))}),sort:e=>e.memberCount},{header:o(),cell:e=>(0,$.jsx)(X,{icon:(0,$.jsx)(J,{size:12,"aria-hidden":!0}),total:e.agentCount,items:e.agents.map(e=>({label:e}))}),sort:e=>e.agentCount},{header:ke(),cell:e=>(0,$.jsx)(X,{icon:(0,$.jsx)(Xe,{size:12,"aria-hidden":!0}),total:e.chartCount,items:e.charts.map(e=>({label:e.name,marker:e.isDefault?(0,$.jsx)(K,{size:11,fill:`currentColor`,"aria-hidden":!0}):null,highlight:e.isDefault}))}),sort:e=>e.chartCount}],rowActions:e=>[{label:S(),onSelect:()=>O({groupId:e._id,name:e.name})},...t?[{label:_(),onSelect:()=>F(e)},{label:d(),variant:`destructive`,onSelect:()=>void oe(e)}]:[]]}),(0,$.jsx)(ze,{open:h,onOpenChange:v,title:y?fe():ee(),description:i(),canSubmit:!!w.name.trim(),onSubmit:I,submitLabel:ne(),children:(0,$.jsxs)(`div`,{className:`oc-form`,children:[(0,$.jsxs)(`label`,{className:`oc-field`,children:[(0,$.jsx)(`span`,{className:`oc-field__label`,children:pe()}),(0,$.jsx)(q,{value:w.name,onChange:e=>T({...w,name:e.target.value})})]}),(0,$.jsxs)(`label`,{className:`oc-field`,children:[(0,$.jsx)(`span`,{className:`oc-field__label`,children:te()}),(0,$.jsx)(q,{value:w.description,onChange:e=>T({...w,description:e.target.value})})]})]})}),(0,$.jsx)(ct,{groupId:D?.groupId??null,groupName:D?.name??``,open:D!==null,onOpenChange:e=>{e||O(null)}})]})}var ot=8;function st({page:e,pageCount:t,onPage:n}){return t<=1?null:(0,$.jsxs)(`div`,{className:`oc-access__pager`,children:[(0,$.jsxs)(U,{type:`button`,variant:`ghost`,size:`sm`,disabled:e<=1,onClick:()=>n(e-1),children:[(0,$.jsx)(Pe,{size:14,"aria-hidden":!0}),le()]}),(0,$.jsxs)(`span`,{className:`oc-access__pageinfo`,"aria-label":he({page:e,pages:t}),children:[e,` / `,t]}),(0,$.jsxs)(U,{type:`button`,variant:`ghost`,size:`sm`,disabled:e>=t,onClick:()=>n(e+1),children:[ue(),(0,$.jsx)(He,{size:14,"aria-hidden":!0})]})]})}function ct({groupId:e,groupName:t,open:n,onOpenChange:i}){let a=f(B.groups.getGroup,n&&e?{groupId:e}:`skip`),o=f(B.groups.listAssignableInstances,n?{}:`skip`),c=f(B.groups.listAssignableUsers,n?{}:`skip`),l=j(B.groups.addMember),u=j(B.groups.removeMember),d=j(B.groups.bulkSetMembers),m=j(B.groups.setGroupManager),g=W(),[_,v]=(0,Q.useState)(``),[y,b]=(0,Q.useState)(``),[x,S]=(0,Q.useState)(`members`),[ee,C]=(0,Q.useState)(1),[te,ne]=(0,Q.useState)(new Set),w=(0,Q.useRef)(null),E=(0,Q.useMemo)(()=>new Set((a?.members??[]).map(e=>e.userId)),[a]),re=(0,Q.useMemo)(()=>new Set((a?.members??[]).filter(e=>e.manager).map(e=>e.userId)),[a]),ie=a?.viewerIsAdmin===!0,k=(0,Q.useMemo)(()=>new Set((a?.agents??[]).map(e=>`${e.instanceName}/${e.agentId}`)),[a]);(0,Q.useEffect)(()=>{v(``),b(``),S(`members`),C(1),w.current=null},[n,e]),(0,Q.useEffect)(()=>{C(1)},[_]),(0,Q.useEffect)(()=>{n&&a&&e&&w.current!==e&&(w.current=e,ne(new Set((a.members??[]).map(e=>e.userId))))},[n,a,e]);let A=(0,Q.useMemo)(()=>c?Qe(c,_,te):[],[c,_,te]);async function ae(t,n){if(e)try{n?await u({groupId:e,userId:t}):await l({groupId:e,userId:t})}catch(e){g.error(T(),e)}}async function N(t,n){if(e)try{await m({groupId:e,userId:t,manager:!n})}catch(e){g.error(h(),e)}}let P=nt(A,e=>E.has(e.userId)),F=A.filter(e=>E.has(e.userId)).length,R=rt(A,ee,ot);async function z(){if(!e||A.length===0)return;let t=A.map(e=>e.userId);try{await d({groupId:e,userIds:t,member:P!==`all`})}catch(e){g.error(T(),e)}}return(0,$.jsx)(qe,{open:n,onOpenChange:i,children:(0,$.jsxs)(Ue,{className:`oc-access`,children:[(0,$.jsxs)(Be,{children:[(0,$.jsx)(We,{children:Te({name:t})}),(0,$.jsx)(Ke,{children:s()})]}),(0,$.jsxs)(Me,{value:x,onValueChange:S,className:`oc-access__tabs`,children:[(0,$.jsxs)(je,{className:`w-full`,children:[(0,$.jsxs)(V,{value:`members`,className:`flex-1 gap-1.5`,children:[(0,$.jsx)(Ze,{size:13,"aria-hidden":!0}),D(),a?(0,$.jsx)(G,{variant:`secondary`,className:`oc-access__tabcount`,children:E.size}):null]}),(0,$.jsxs)(V,{value:`agents`,className:`flex-1 gap-1.5`,children:[(0,$.jsx)(J,{size:13,"aria-hidden":!0}),se(),a?(0,$.jsx)(G,{variant:`secondary`,className:`oc-access__tabcount`,children:k.size}):null]}),(0,$.jsxs)(V,{value:`charts`,className:`flex-1 gap-1.5`,children:[(0,$.jsx)(Xe,{size:13,"aria-hidden":!0}),r(),a?(0,$.jsx)(G,{variant:`secondary`,className:`oc-access__tabcount`,children:a.chartCount}):null]})]}),(0,$.jsx)(H,{value:`members`,children:c===void 0||a===void 0?(0,$.jsx)(`p`,{className:`oc-access__hint`,children:L()}):c.length===0?(0,$.jsx)(`p`,{className:`oc-access__hint`,children:_e()}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(q,{value:_,onChange:e=>v(e.target.value),placeholder:Ee(),className:`oc-access__search`}),A.length===0?(0,$.jsx)(`p`,{className:`oc-access__hint`,children:we()}):(0,$.jsxs)($.Fragment,{children:[A.length>1?(0,$.jsxs)(`div`,{className:`oc-access__row oc-access__selectall`,children:[(0,$.jsx)(Y,{checked:P===`all`?!0:P===`some`?`indeterminate`:!1,onCheckedChange:()=>void z(),"aria-label":I()}),(0,$.jsx)(`span`,{className:`oc-access__label`,children:I()}),(0,$.jsxs)(G,{variant:`outline`,className:`oc-access__count`,children:[F,` / `,A.length]})]}):null,(0,$.jsx)(`div`,{className:`oc-access__list`,children:R.pageItems.map(e=>{let t=E.has(e.userId),n=et(e),r=re.has(e.userId);return(0,$.jsxs)(`div`,{className:`oc-access__row`,children:[(0,$.jsx)(Y,{checked:t,onCheckedChange:()=>void ae(e.userId,t),"aria-label":Ce({user:n.primary})}),(0,$.jsxs)(`span`,{className:`oc-access__who`,children:[(0,$.jsx)(`span`,{className:`oc-access__label`,title:n.primary,children:n.primary}),n.secondary?(0,$.jsx)(`span`,{className:`oc-access__sub`,title:n.secondary,children:n.secondary}):null]}),(0,$.jsx)(G,{variant:`outline`,className:`oc-access__role`,children:tt(e.role)}),(0,$.jsx)(`span`,{className:`oc-access__mgrslot`,children:t&&ie?(0,$.jsx)(U,{type:`button`,variant:`ghost`,size:`icon`,className:`shrink-0 oc-access__mgr${r?` oc-access__mgr--on`:``}`,"aria-pressed":r,"aria-label":r?O():M(),title:r?O():M(),onClick:()=>void N(e.userId,r),children:(0,$.jsx)(Z,{size:15,"aria-hidden":!0})}):t&&r?(0,$.jsx)(`span`,{className:`oc-access__mgr oc-access__mgr--on`,role:`img`,"aria-label":p(),title:p(),children:(0,$.jsx)(Z,{size:15,"aria-hidden":!0})}):null})]},e._id)})}),(0,$.jsx)(st,{page:R.page,pageCount:R.pageCount,onPage:C})]})]})}),(0,$.jsx)(H,{value:`agents`,children:o===void 0?(0,$.jsx)(`p`,{className:`oc-access__hint`,children:L()}):o.length===0?(0,$.jsx)(`p`,{className:`oc-access__hint`,children:oe()}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(q,{value:y,onChange:e=>b(e.target.value),placeholder:De(),className:`oc-access__search`}),(0,$.jsx)(`div`,{className:`oc-access__list`,children:o.map(t=>(0,$.jsx)(lt,{groupId:e,instanceName:t.name,kind:t.kind??`openclaw`,assigned:k,query:y},`${e}-${t._id}`))})]})}),(0,$.jsx)(H,{value:`charts`,children:(0,$.jsx)(ut,{groupId:e})})]})]})})}function lt({groupId:e,instanceName:t,kind:n,assigned:r,query:i}){let a=f(B.groups.listAssignableAgents,{instanceName:t}),o=j(B.groups.assignAgentToGroup),s=j(B.groups.removeAgentFromGroup),c=j(B.groups.bulkSetGroupAgents),l=W(),[u,d]=(0,Q.useState)(1);if((0,Q.useEffect)(()=>{d(1)},[i]),!e)return null;let p=$e(a?.agents??[],i),m=a?.discovery&&!a.discovery.lastPollOk;if(i.trim()&&p.length===0)return null;let h=p.filter(e=>e.presentInLastOk!==!1&&e.enabled!==!1),g=nt(h,e=>r.has(`${t}/${e.agentId}`)),_=rt(p,u,ot);async function v(n,r){try{r?await s({groupId:e,instanceName:t,agentId:n}):await o({groupId:e,instanceName:t,agentId:n})}catch(e){l.error(x(),e)}}async function y(){if(h.length===0)return;let n=h.map(e=>e.agentId);try{await c({groupId:e,instanceName:t,agentIds:n,assigned:g!==`all`})}catch(e){l.error(x(),e)}}return(0,$.jsxs)(`div`,{className:`oc-access__group`,children:[(0,$.jsxs)(`div`,{className:`oc-access__instance`,children:[(0,$.jsx)(J,{size:13,"aria-hidden":!0}),(0,$.jsx)(`span`,{children:t}),(0,$.jsx)(G,{variant:`outline`,className:`oc-access__kind`,children:n}),m?(0,$.jsx)(G,{variant:`outline`,className:`oc-access__stale`,children:ge()}):null]}),a===void 0?(0,$.jsx)(`p`,{className:`oc-access__hint`,children:xe()}):p.length===0?(0,$.jsx)(`p`,{className:`oc-access__hint`,children:m?be():de()}):(0,$.jsxs)($.Fragment,{children:[h.length>1?(0,$.jsxs)(`div`,{className:`oc-access__row oc-access__selectall`,children:[(0,$.jsx)(Y,{checked:g===`all`?!0:g===`some`?`indeterminate`:!1,onCheckedChange:()=>void y(),"aria-label":I()}),(0,$.jsx)(`span`,{className:`oc-access__label`,children:I()})]}):null,_.pageItems.map(e=>{let n=`${t}/${e.agentId}`,i=r.has(n),a=e.presentInLastOk===!1,o=!e.enabled;return(0,$.jsxs)(`div`,{className:`oc-access__row${o?` is-disabled`:``}`,children:[(0,$.jsx)(Y,{checked:i,disabled:(a||o)&&!i,onCheckedChange:()=>void v(e.agentId,i),"aria-label":me({name:e.displayName??e.agentId})}),(0,$.jsxs)(`span`,{className:`oc-access__label`,title:e.displayName??e.agentId,children:[e.emoji?`${e.emoji} `:``,e.displayName??e.agentId]}),e.model?(0,$.jsx)(`span`,{className:`oc-access__model`,children:e.model}):null,e.isDefaultOnInstance?(0,$.jsx)(`span`,{className:`oc-access__fav`,role:`img`,"aria-label":z(),title:z(),children:(0,$.jsx)(K,{size:14,fill:`currentColor`})}):null,a?(0,$.jsx)(G,{variant:`outline`,className:`oc-access__gone`,children:Se()}):null]},e.agentId)}),(0,$.jsx)(st,{page:_.page,pageCount:_.pageCount,onPage:d})]})]})}function ut({groupId:e}){let t=f(B.charts.listGroupChartSelection,e?{groupId:e}:`skip`),n=j(B.charts.assignChartToGroup),r=j(B.charts.removeChartFromGroup),i=j(B.charts.setGroupDefaultChart),a=j(B.charts.addChartToGroupPool),o=j(B.charts.removeChartFromGroupPool),s=W();if(!e)return null;if(t===void 0)return(0,$.jsx)(`p`,{className:`oc-access__hint`,children:L()});let{pool:c,addable:l,canManagePool:u}=t;if(c.length===0&&!u)return(0,$.jsx)(`p`,{className:`oc-access__hint`,children:w()});async function d(t,i){try{i?await r({groupId:e,chartKey:t}):await n({groupId:e,chartKey:t})}catch(e){s.error(k(),e)}}async function p(t){try{await i({groupId:e,chartKey:t})}catch(e){s.error(k(),e)}}async function m(t){try{await a({groupId:e,chartKey:t})}catch(e){s.error(k(),e)}}async function h(t){try{await o({groupId:e,chartKey:t})}catch(e){s.error(k(),e)}}return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`div`,{className:`oc-access__list`,children:c.map(e=>(0,$.jsxs)(`div`,{className:`oc-access__row`,children:[(0,$.jsx)(Y,{checked:e.selected,onCheckedChange:()=>void d(e.chartKey,e.selected),"aria-label":v({name:e.name})}),(0,$.jsx)(`span`,{className:`oc-access__label`,title:e.name,children:e.name}),e.selected?e.isDefault?(0,$.jsx)(`span`,{className:`oc-access__fav`,role:`img`,"aria-label":ye(),title:ye(),children:(0,$.jsx)(K,{size:14,fill:`currentColor`})}):(0,$.jsx)(U,{type:`button`,variant:`ghost`,size:`sm`,onClick:()=>void p(e.chartKey),children:y()}):null,u?(0,$.jsx)(U,{type:`button`,variant:`ghost`,size:`sm`,"aria-label":P({name:e.name}),title:P({name:e.name}),onClick:()=>void h(e.chartKey),children:(0,$.jsx)(Ae,{size:14,"aria-hidden":!0})}):null]},e.chartKey))}),u?l.length>0?(0,$.jsxs)(Le,{value:``,onValueChange:e=>void m(e),children:[(0,$.jsx)(Ne,{size:`sm`,className:`oc-access__search`,children:(0,$.jsx)(Ve,{placeholder:N()})}),(0,$.jsx)(Re,{children:l.map(e=>(0,$.jsx)(Fe,{value:e.chartKey,children:e.name},e.chartKey))})]}):c.length===0?(0,$.jsx)(`p`,{className:`oc-access__hint`,children:F()}):null:null]})}export{at as GroupsTab};
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$d as r,Af as i,Bd as a,Bf as o,Cf as s,D as c,Df as l,Ef as u,Ff as d,GR as f,Gd as p,Gf as m,Hd as h,Hf as g,If as _,Jd as v,Kd as y,Kf as b,Ld as x,Lf as S,Mf as ee,Nf as C,Of as te,Pf as ne,Qd as w,Rd as T,Rf as E,Sf as D,Tf as re,Ud as O,Uf as ie,Vd as k,Vf as A,WR as j,Wd as M,Wf as ae,Xd as N,Yd as P,Zd as F,_f as I,af as oe,bf as se,cf as L,df as R,ef as z,ff as ce,gf as le,hf as ue,if as de,jf as fe,kf as pe,lf as me,mf as he,nf as ge,of as _e,pf as ve,qd as ye,rf as be,sf as xe,t as B,tf as Se,uf as Ce,vf as we,wf as Te,xf as Ee,yf as De,zd as Oe,zf as ke}from"./api-Dr5hDHvi.js";import{t as Ae}from"./x-B_mNl1Gq.js";import{i as V,n as H,r as je,t as Me}from"./tabs-BPua3v_Q.js";import{t as U}from"./button-BI3fckfr.js";import{$ as Ne,Dt as W,Et as G,Mn as Pe,Q as Fe,U as Ie,X as Le,Z as Re,_ as ze,an as K,at as Be,et as Ve,jn as He,jt as q,nt as Ue,on as J,ot as We,q as Ge,rt as Ke,tt as qe,ut as Y}from"./index-CaP52i63.js";import{t as Je}from"./FilterBar-BbF96T8z.js";import{t as Ye}from"./DataTableShell-vuJDvlum.js";import{t as X}from"./DetailChips-D-HlZTp-.js";var Xe=c(`palette`,[[`path`,{d:`M12 22a1 1 0 0 1 0-20 10 9 0 0 1 10 9 5 5 0 0 1-5 5h-2.25a1.75 1.75 0 0 0-1.4 2.8l.3.4a1.75 1.75 0 0 1-1.4 2.8z`,key:`e79jfc`}],[`circle`,{cx:`13.5`,cy:`6.5`,r:`.5`,fill:`currentColor`,key:`1okk4w`}],[`circle`,{cx:`17.5`,cy:`10.5`,r:`.5`,fill:`currentColor`,key:`f64h9f`}],[`circle`,{cx:`6.5`,cy:`12.5`,r:`.5`,fill:`currentColor`,key:`qy21gx`}],[`circle`,{cx:`8.5`,cy:`7.5`,r:`.5`,fill:`currentColor`,key:`fotxhn`}]]),Z=c(`shield-check`,[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`,key:`oel41y`}],[`path`,{d:`m9 12 2 2 4-4`,key:`dzmm74`}]]),Ze=c(`users`,[[`path`,{d:`M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2`,key:`1yyitq`}],[`path`,{d:`M16 3.128a4 4 0 0 1 0 7.744`,key:`16gr8j`}],[`path`,{d:`M22 21v-2a4 4 0 0 0-3-3.87`,key:`kshegd`}],[`circle`,{cx:`9`,cy:`7`,r:`4`,key:`nufk8`}]]),Q=t(e(),1);function Qe(e,t,n){let r=t.trim().toLowerCase();return[...r?e.filter(e=>[e.email,e.name,e.canonical].some(e=>e!=null&&e.toLowerCase().includes(r))):e.slice()].sort((e,t)=>!n.has(e.userId)-+!n.has(t.userId))}function $e(e,t){let n=e.filter(e=>e.source===`discovered`),r=t.trim().toLowerCase();return r?n.filter(e=>(e.displayName??e.agentId).toLowerCase().includes(r)||e.agentId.toLowerCase().includes(r)):n}function et(e){let t=e.name?.trim()??``,n=e.email?.trim()??``,r=e.canonical?.trim()||`u-${e.userId.slice(0,8)}`;return t?{primary:t,secondary:n||`@${r}`}:n?{primary:n,secondary:null}:{primary:`@${r}`,secondary:null}}function tt(e){switch(e){case`admin`:return ve();case`user`:return ce();case`pending`:return R();default:return e}}function nt(e,t){if(e.length===0)return`none`;let n=0;for(let r of e)t(r)&&n++;return n===0?`none`:n===e.length?`all`:`some`}function rt(e,t,n){let r=Math.max(1,Math.ceil(e.length/n)),i=Math.min(Math.max(1,Math.floor(t)),r),a=(i-1)*n;return{pageItems:e.slice(a,a+n),page:i,pageCount:r}}var $=n(),it={name:``,description:``};function at(){let e=f(B.groups.listGroups,{}),t=f(B.me.getMe,{host:Ge})?.role===`admin`,n=j(B.groups.createGroup),r=j(B.groups.updateGroup),s=j(B.groups.deleteGroup),c=Ie(),p=W(),[h,v]=(0,Q.useState)(!1),[y,x]=(0,Q.useState)(null),[w,T]=(0,Q.useState)(it),[D,O]=(0,Q.useState)(null),[k,M]=(0,Q.useState)(``),N=(0,Q.useMemo)(()=>{if(!e)return e;let t=k.trim().toLowerCase();return t?e.filter(e=>e.name.toLowerCase().includes(t)||(e.description??``).toLowerCase().includes(t)||e.members.some(e=>e.label.toLowerCase().includes(t))||e.agents.some(e=>e.toLowerCase().includes(t))||e.charts.some(e=>e.name.toLowerCase().includes(t))):e},[e,k]);function P(){x(null),T(it),v(!0)}function F(e){x(e),T({name:e.name,description:e.description??``}),v(!0)}async function I(){try{y?await r({groupId:y._id,name:w.name,description:w.description}):await n({name:w.name,description:w.description||void 0}),T(it),x(null),v(!1)}catch(e){p.error(a(),e)}}async function oe(e){if(await c({title:l({name:e.name}),description:u(),confirmWord:e.name,confirmLabel:re(),cancelLabel:C(),destructive:!0}))try{await s({groupId:e._id})}catch(e){p.error(Oe(),e)}}return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`p`,{className:`oc-admin__hint`,children:m()}),(0,$.jsx)(Je,{q:k,onQChange:M,onReset:()=>M(``),canReset:k!==``,searchPlaceholder:E()}),(0,$.jsx)(Ye,{title:b(),rows:N,addLabel:ae(),onAdd:t?P:void 0,emptyHint:ie(),columns:[{header:g(),cell:e=>e.name,sort:e=>e.name},{header:A(),cell:e=>(0,$.jsx)(X,{icon:(0,$.jsx)(Ze,{size:12,"aria-hidden":!0}),total:e.memberCount,items:e.members.map(e=>({label:e.label,marker:e.manager?(0,$.jsx)(Z,{size:11,"aria-hidden":!0}):null,highlight:e.manager}))}),sort:e=>e.memberCount},{header:o(),cell:e=>(0,$.jsx)(X,{icon:(0,$.jsx)(J,{size:12,"aria-hidden":!0}),total:e.agentCount,items:e.agents.map(e=>({label:e}))}),sort:e=>e.agentCount},{header:ke(),cell:e=>(0,$.jsx)(X,{icon:(0,$.jsx)(Xe,{size:12,"aria-hidden":!0}),total:e.chartCount,items:e.charts.map(e=>({label:e.name,marker:e.isDefault?(0,$.jsx)(K,{size:11,fill:`currentColor`,"aria-hidden":!0}):null,highlight:e.isDefault}))}),sort:e=>e.chartCount}],rowActions:e=>[{label:S(),onSelect:()=>O({groupId:e._id,name:e.name})},...t?[{label:_(),onSelect:()=>F(e)},{label:d(),variant:`destructive`,onSelect:()=>void oe(e)}]:[]]}),(0,$.jsx)(ze,{open:h,onOpenChange:v,title:y?fe():ee(),description:i(),canSubmit:!!w.name.trim(),onSubmit:I,submitLabel:ne(),children:(0,$.jsxs)(`div`,{className:`oc-form`,children:[(0,$.jsxs)(`label`,{className:`oc-field`,children:[(0,$.jsx)(`span`,{className:`oc-field__label`,children:pe()}),(0,$.jsx)(q,{value:w.name,onChange:e=>T({...w,name:e.target.value})})]}),(0,$.jsxs)(`label`,{className:`oc-field`,children:[(0,$.jsx)(`span`,{className:`oc-field__label`,children:te()}),(0,$.jsx)(q,{value:w.description,onChange:e=>T({...w,description:e.target.value})})]})]})}),(0,$.jsx)(ct,{groupId:D?.groupId??null,groupName:D?.name??``,open:D!==null,onOpenChange:e=>{e||O(null)}})]})}var ot=8;function st({page:e,pageCount:t,onPage:n}){return t<=1?null:(0,$.jsxs)(`div`,{className:`oc-access__pager`,children:[(0,$.jsxs)(U,{type:`button`,variant:`ghost`,size:`sm`,disabled:e<=1,onClick:()=>n(e-1),children:[(0,$.jsx)(Pe,{size:14,"aria-hidden":!0}),le()]}),(0,$.jsxs)(`span`,{className:`oc-access__pageinfo`,"aria-label":he({page:e,pages:t}),children:[e,` / `,t]}),(0,$.jsxs)(U,{type:`button`,variant:`ghost`,size:`sm`,disabled:e>=t,onClick:()=>n(e+1),children:[ue(),(0,$.jsx)(He,{size:14,"aria-hidden":!0})]})]})}function ct({groupId:e,groupName:t,open:n,onOpenChange:i}){let a=f(B.groups.getGroup,n&&e?{groupId:e}:`skip`),o=f(B.groups.listAssignableInstances,n?{}:`skip`),c=f(B.groups.listAssignableUsers,n?{}:`skip`),l=j(B.groups.addMember),u=j(B.groups.removeMember),d=j(B.groups.bulkSetMembers),m=j(B.groups.setGroupManager),g=W(),[_,v]=(0,Q.useState)(``),[y,b]=(0,Q.useState)(``),[x,S]=(0,Q.useState)(`members`),[ee,C]=(0,Q.useState)(1),[te,ne]=(0,Q.useState)(new Set),w=(0,Q.useRef)(null),E=(0,Q.useMemo)(()=>new Set((a?.members??[]).map(e=>e.userId)),[a]),re=(0,Q.useMemo)(()=>new Set((a?.members??[]).filter(e=>e.manager).map(e=>e.userId)),[a]),ie=a?.viewerIsAdmin===!0,k=(0,Q.useMemo)(()=>new Set((a?.agents??[]).map(e=>`${e.instanceName}/${e.agentId}`)),[a]);(0,Q.useEffect)(()=>{v(``),b(``),S(`members`),C(1),w.current=null},[n,e]),(0,Q.useEffect)(()=>{C(1)},[_]),(0,Q.useEffect)(()=>{n&&a&&e&&w.current!==e&&(w.current=e,ne(new Set((a.members??[]).map(e=>e.userId))))},[n,a,e]);let A=(0,Q.useMemo)(()=>c?Qe(c,_,te):[],[c,_,te]);async function ae(t,n){if(e)try{n?await u({groupId:e,userId:t}):await l({groupId:e,userId:t})}catch(e){g.error(T(),e)}}async function N(t,n){if(e)try{await m({groupId:e,userId:t,manager:!n})}catch(e){g.error(h(),e)}}let P=nt(A,e=>E.has(e.userId)),F=A.filter(e=>E.has(e.userId)).length,R=rt(A,ee,ot);async function z(){if(!e||A.length===0)return;let t=A.map(e=>e.userId);try{await d({groupId:e,userIds:t,member:P!==`all`})}catch(e){g.error(T(),e)}}return(0,$.jsx)(qe,{open:n,onOpenChange:i,children:(0,$.jsxs)(Ue,{className:`oc-access`,children:[(0,$.jsxs)(Be,{children:[(0,$.jsx)(We,{children:Te({name:t})}),(0,$.jsx)(Ke,{children:s()})]}),(0,$.jsxs)(Me,{value:x,onValueChange:S,className:`oc-access__tabs`,children:[(0,$.jsxs)(je,{className:`w-full`,children:[(0,$.jsxs)(V,{value:`members`,className:`flex-1 gap-1.5`,children:[(0,$.jsx)(Ze,{size:13,"aria-hidden":!0}),D(),a?(0,$.jsx)(G,{variant:`secondary`,className:`oc-access__tabcount`,children:E.size}):null]}),(0,$.jsxs)(V,{value:`agents`,className:`flex-1 gap-1.5`,children:[(0,$.jsx)(J,{size:13,"aria-hidden":!0}),se(),a?(0,$.jsx)(G,{variant:`secondary`,className:`oc-access__tabcount`,children:k.size}):null]}),(0,$.jsxs)(V,{value:`charts`,className:`flex-1 gap-1.5`,children:[(0,$.jsx)(Xe,{size:13,"aria-hidden":!0}),r(),a?(0,$.jsx)(G,{variant:`secondary`,className:`oc-access__tabcount`,children:a.chartCount}):null]})]}),(0,$.jsx)(H,{value:`members`,children:c===void 0||a===void 0?(0,$.jsx)(`p`,{className:`oc-access__hint`,children:L()}):c.length===0?(0,$.jsx)(`p`,{className:`oc-access__hint`,children:_e()}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(q,{value:_,onChange:e=>v(e.target.value),placeholder:Ee(),className:`oc-access__search`}),A.length===0?(0,$.jsx)(`p`,{className:`oc-access__hint`,children:we()}):(0,$.jsxs)($.Fragment,{children:[A.length>1?(0,$.jsxs)(`div`,{className:`oc-access__row oc-access__selectall`,children:[(0,$.jsx)(Y,{checked:P===`all`?!0:P===`some`?`indeterminate`:!1,onCheckedChange:()=>void z(),"aria-label":I()}),(0,$.jsx)(`span`,{className:`oc-access__label`,children:I()}),(0,$.jsxs)(G,{variant:`outline`,className:`oc-access__count`,children:[F,` / `,A.length]})]}):null,(0,$.jsx)(`div`,{className:`oc-access__list`,children:R.pageItems.map(e=>{let t=E.has(e.userId),n=et(e),r=re.has(e.userId);return(0,$.jsxs)(`div`,{className:`oc-access__row`,children:[(0,$.jsx)(Y,{checked:t,onCheckedChange:()=>void ae(e.userId,t),"aria-label":Ce({user:n.primary})}),(0,$.jsxs)(`span`,{className:`oc-access__who`,children:[(0,$.jsx)(`span`,{className:`oc-access__label`,title:n.primary,children:n.primary}),n.secondary?(0,$.jsx)(`span`,{className:`oc-access__sub`,title:n.secondary,children:n.secondary}):null]}),(0,$.jsx)(G,{variant:`outline`,className:`oc-access__role`,children:tt(e.role)}),(0,$.jsx)(`span`,{className:`oc-access__mgrslot`,children:t&&ie?(0,$.jsx)(U,{type:`button`,variant:`ghost`,size:`icon`,className:`shrink-0 oc-access__mgr${r?` oc-access__mgr--on`:``}`,"aria-pressed":r,"aria-label":r?O():M(),title:r?O():M(),onClick:()=>void N(e.userId,r),children:(0,$.jsx)(Z,{size:15,"aria-hidden":!0})}):t&&r?(0,$.jsx)(`span`,{className:`oc-access__mgr oc-access__mgr--on`,role:`img`,"aria-label":p(),title:p(),children:(0,$.jsx)(Z,{size:15,"aria-hidden":!0})}):null})]},e._id)})}),(0,$.jsx)(st,{page:R.page,pageCount:R.pageCount,onPage:C})]})]})}),(0,$.jsx)(H,{value:`agents`,children:o===void 0?(0,$.jsx)(`p`,{className:`oc-access__hint`,children:L()}):o.length===0?(0,$.jsx)(`p`,{className:`oc-access__hint`,children:oe()}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(q,{value:y,onChange:e=>b(e.target.value),placeholder:De(),className:`oc-access__search`}),(0,$.jsx)(`div`,{className:`oc-access__list`,children:o.map(t=>(0,$.jsx)(lt,{groupId:e,instanceName:t.name,kind:t.kind??`openclaw`,assigned:k,query:y},`${e}-${t._id}`))})]})}),(0,$.jsx)(H,{value:`charts`,children:(0,$.jsx)(ut,{groupId:e})})]})]})})}function lt({groupId:e,instanceName:t,kind:n,assigned:r,query:i}){let a=f(B.groups.listAssignableAgents,{instanceName:t}),o=j(B.groups.assignAgentToGroup),s=j(B.groups.removeAgentFromGroup),c=j(B.groups.bulkSetGroupAgents),l=W(),[u,d]=(0,Q.useState)(1);if((0,Q.useEffect)(()=>{d(1)},[i]),!e)return null;let p=$e(a?.agents??[],i),m=a?.discovery&&!a.discovery.lastPollOk;if(i.trim()&&p.length===0)return null;let h=p.filter(e=>e.presentInLastOk!==!1&&e.enabled!==!1),g=nt(h,e=>r.has(`${t}/${e.agentId}`)),_=rt(p,u,ot);async function v(n,r){try{r?await s({groupId:e,instanceName:t,agentId:n}):await o({groupId:e,instanceName:t,agentId:n})}catch(e){l.error(x(),e)}}async function y(){if(h.length===0)return;let n=h.map(e=>e.agentId);try{await c({groupId:e,instanceName:t,agentIds:n,assigned:g!==`all`})}catch(e){l.error(x(),e)}}return(0,$.jsxs)(`div`,{className:`oc-access__group`,children:[(0,$.jsxs)(`div`,{className:`oc-access__instance`,children:[(0,$.jsx)(J,{size:13,"aria-hidden":!0}),(0,$.jsx)(`span`,{children:t}),(0,$.jsx)(G,{variant:`outline`,className:`oc-access__kind`,children:n}),m?(0,$.jsx)(G,{variant:`outline`,className:`oc-access__stale`,children:ge()}):null]}),a===void 0?(0,$.jsx)(`p`,{className:`oc-access__hint`,children:xe()}):p.length===0?(0,$.jsx)(`p`,{className:`oc-access__hint`,children:m?be():de()}):(0,$.jsxs)($.Fragment,{children:[h.length>1?(0,$.jsxs)(`div`,{className:`oc-access__row oc-access__selectall`,children:[(0,$.jsx)(Y,{checked:g===`all`?!0:g===`some`?`indeterminate`:!1,onCheckedChange:()=>void y(),"aria-label":I()}),(0,$.jsx)(`span`,{className:`oc-access__label`,children:I()})]}):null,_.pageItems.map(e=>{let n=`${t}/${e.agentId}`,i=r.has(n),a=e.presentInLastOk===!1,o=!e.enabled;return(0,$.jsxs)(`div`,{className:`oc-access__row${o?` is-disabled`:``}`,children:[(0,$.jsx)(Y,{checked:i,disabled:(a||o)&&!i,onCheckedChange:()=>void v(e.agentId,i),"aria-label":me({name:e.displayName??e.agentId})}),(0,$.jsxs)(`span`,{className:`oc-access__label`,title:e.displayName??e.agentId,children:[e.emoji?`${e.emoji} `:``,e.displayName??e.agentId]}),e.model?(0,$.jsx)(`span`,{className:`oc-access__model`,children:e.model}):null,e.isDefaultOnInstance?(0,$.jsx)(`span`,{className:`oc-access__fav`,role:`img`,"aria-label":z(),title:z(),children:(0,$.jsx)(K,{size:14,fill:`currentColor`})}):null,a?(0,$.jsx)(G,{variant:`outline`,className:`oc-access__gone`,children:Se()}):null]},e.agentId)}),(0,$.jsx)(st,{page:_.page,pageCount:_.pageCount,onPage:d})]})]})}function ut({groupId:e}){let t=f(B.charts.listGroupChartSelection,e?{groupId:e}:`skip`),n=j(B.charts.assignChartToGroup),r=j(B.charts.removeChartFromGroup),i=j(B.charts.setGroupDefaultChart),a=j(B.charts.addChartToGroupPool),o=j(B.charts.removeChartFromGroupPool),s=W();if(!e)return null;if(t===void 0)return(0,$.jsx)(`p`,{className:`oc-access__hint`,children:L()});let{pool:c,addable:l,canManagePool:u}=t;if(c.length===0&&!u)return(0,$.jsx)(`p`,{className:`oc-access__hint`,children:w()});async function d(t,i){try{i?await r({groupId:e,chartKey:t}):await n({groupId:e,chartKey:t})}catch(e){s.error(k(),e)}}async function p(t){try{await i({groupId:e,chartKey:t})}catch(e){s.error(k(),e)}}async function m(t){try{await a({groupId:e,chartKey:t})}catch(e){s.error(k(),e)}}async function h(t){try{await o({groupId:e,chartKey:t})}catch(e){s.error(k(),e)}}return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`div`,{className:`oc-access__list`,children:c.map(e=>(0,$.jsxs)(`div`,{className:`oc-access__row`,children:[(0,$.jsx)(Y,{checked:e.selected,onCheckedChange:()=>void d(e.chartKey,e.selected),"aria-label":v({name:e.name})}),(0,$.jsx)(`span`,{className:`oc-access__label`,title:e.name,children:e.name}),e.selected?e.isDefault?(0,$.jsx)(`span`,{className:`oc-access__fav`,role:`img`,"aria-label":ye(),title:ye(),children:(0,$.jsx)(K,{size:14,fill:`currentColor`})}):(0,$.jsx)(U,{type:`button`,variant:`ghost`,size:`sm`,onClick:()=>void p(e.chartKey),children:y()}):null,u?(0,$.jsx)(U,{type:`button`,variant:`ghost`,size:`sm`,"aria-label":P({name:e.name}),title:P({name:e.name}),onClick:()=>void h(e.chartKey),children:(0,$.jsx)(Ae,{size:14,"aria-hidden":!0})}):null]},e.chartKey))}),u?l.length>0?(0,$.jsxs)(Le,{value:``,onValueChange:e=>void m(e),children:[(0,$.jsx)(Ne,{size:`sm`,className:`oc-access__search`,children:(0,$.jsx)(Ve,{placeholder:N()})}),(0,$.jsx)(Re,{children:l.map(e=>(0,$.jsx)(Fe,{value:e.chartKey,children:e.name},e.chartKey))})]}):c.length===0?(0,$.jsx)(`p`,{className:`oc-access__hint`,children:F()}):null:null]})}export{at as GroupsTab};
|