@lacneu/atrium 0.75.1 → 0.75.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (39) hide show
  1. package/dist/assets/{AccessTab-D4QP4p9J.js → AccessTab-DuyiTRVr.js} +1 -1
  2. package/dist/assets/{AdvancedFilter-Cj03B7Mb.js → AdvancedFilter-BzF0GRUD.js} +1 -1
  3. package/dist/assets/{AgentFilesTab-Bnn47As9.js → AgentFilesTab-BzZ4iNiw.js} +1 -1
  4. package/dist/assets/{AnomaliesTab-BCw0xO9Y.js → AnomaliesTab-Aksn6eYz.js} +1 -1
  5. package/dist/assets/{AuditTab-gHQ_wQmh.js → AuditTab-BqKVttX3.js} +1 -1
  6. package/dist/assets/{BridgeTab-DwjWGxdx.js → BridgeTab-BxMufTiI.js} +1 -1
  7. package/dist/assets/{ChatDefaultsTab-eUFvsrmp.js → ChatDefaultsTab-6xoE3T9G.js} +1 -1
  8. package/dist/assets/{DataTableShell-hu5AF3BF.js → DataTableShell-BInsTzwk.js} +1 -1
  9. package/dist/assets/{DetailChips-CPHHClkW.js → DetailChips-Lo0Kvu7k.js} +1 -1
  10. package/dist/assets/{FeedbacksTab-Cl4rHkqk.js → FeedbacksTab-ZNCSDc3k.js} +1 -1
  11. package/dist/assets/{FieldLabel-orXtJQ8U.js → FieldLabel-8IB11dM6.js} +1 -1
  12. package/dist/assets/{FilesTab-BgNepwhZ.js → FilesTab-B3bm4Kq2.js} +1 -1
  13. package/dist/assets/{FilterBar-B3g5mQkA.js → FilterBar-CnjTuIOw.js} +1 -1
  14. package/dist/assets/{GroupsTab-iNciegdR.js → GroupsTab-B-8I0P6D.js} +1 -1
  15. package/dist/assets/{InstancesTab-D6lM2BsV.js → InstancesTab-DvyrJSBO.js} +1 -1
  16. package/dist/assets/{IntegrationsTab--a2Y9KS4.js → IntegrationsTab-DYG99wtP.js} +1 -1
  17. package/dist/assets/{KpiTab-Fl5Bk8Gj.js → KpiTab-C1rebj1v.js} +1 -1
  18. package/dist/assets/{PreferencesTab-axQ_DQ-W.js → PreferencesTab-mg8QORuA.js} +1 -1
  19. package/dist/assets/{ProjectPage-Bd7DK5RJ.js → ProjectPage-CNYuUcd2.js} +1 -1
  20. package/dist/assets/{PromptInjectionsTab-OiV13dvS.js → PromptInjectionsTab-j_2hboca.js} +1 -1
  21. package/dist/assets/{RolesTab-CeTKQHRD.js → RolesTab-CY_nK9vi.js} +1 -1
  22. package/dist/assets/{ScheduledTab-B0jErNoz.js → ScheduledTab-DCUrDndB.js} +1 -1
  23. package/dist/assets/{ServiceAccountsTab-BHe_p9wb.js → ServiceAccountsTab-BNL5015A.js} +1 -1
  24. package/dist/assets/{SubAgentReportsTab-BUXZQIyv.js → SubAgentReportsTab-B5VH_bLL.js} +1 -1
  25. package/dist/assets/{ThemeShowroom-Bz6AuYIe.js → ThemeShowroom-CN3wPvKh.js} +1 -1
  26. package/dist/assets/{TimeRangePicker-CS4l2E_Y.js → TimeRangePicker-DLQwf08l.js} +1 -1
  27. package/dist/assets/{TimezoneCombobox-C6dFG3Xz.js → TimezoneCombobox-PqzYbV3J.js} +1 -1
  28. package/dist/assets/{TracesTab-C66qWc1i.js → TracesTab-CESxAkKQ.js} +1 -1
  29. package/dist/assets/{UsersTab-Bclv37Pv.js → UsersTab-N5fFzUTq.js} +1 -1
  30. package/dist/assets/{VoiceTab-DjZp4YXH.js → VoiceTab-CfcROoO4.js} +1 -1
  31. package/dist/assets/{highlighted-body-OFNGDK62-CEI-JPe4.js → highlighted-body-OFNGDK62-__Py8DCh.js} +1 -1
  32. package/dist/assets/{index-CFqHR0gi.js → index-C3dl90Xw.js} +6 -6
  33. package/dist/assets/{index-BfYewJnn.css → index-DIPoQZi2.css} +1 -1
  34. package/dist/assets/mermaid-GHXKKRXX-CFE134PH.js +1 -0
  35. package/dist/assets/{pdf-Bymhe00c.js → pdf-CZxpuHbO.js} +1 -1
  36. package/dist/assets/{tabs-BQOp_WCt.js → tabs-BPsz_527.js} +1 -1
  37. package/dist/index.html +2 -2
  38. package/package.json +1 -1
  39. package/dist/assets/mermaid-GHXKKRXX-BKAkYTvj.js +0 -1
@@ -1 +1 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Ap as r,Bp as i,Dp as a,Fp as o,Ip as s,Lp as c,Mp as l,Np as u,Op as d,Pp as f,Rp as p,Tz as m,Vp as h,gz as g,jp as _,kp as v,t as y,zp as b}from"./api-CMppRsht.js";import{$ as x,Et as S,Q as C,X as w,Z as T,et as E}from"./index-CFqHR0gi.js";var D=t(e(),1);function O(e){return e===`user`?_():e===`all`?r():v({group:e.group})}function k(e){return e===`common`?d():e===`owner`?a():v({group:e.group})}var A=n();function j(e){return e.name||e.email||e.userId.slice(0,8)}function M(){let e=m(y.admin.listUsers,{}),[t,n]=(0,D.useState)(``),r=m(y.introspect.introspectUser,t?{userId:t}:`skip`);return(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:h()}),(0,A.jsxs)(w,{value:t,onValueChange:n,children:[(0,A.jsx)(x,{size:`sm`,"aria-label":i(),children:(0,A.jsx)(E,{placeholder:i()})}),(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:b()}):r===void 0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:g()}):(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:r.user.label}),(0,A.jsx)(S,{variant:`secondary`,children:r.role})]})]}),(0,A.jsxs)(`section`,{className:`oc-introspect__section`,children:[(0,A.jsx)(`h3`,{className:`oc-introspect__title`,children:c()}),r.groups.length===0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:u()}):(0,A.jsx)(`div`,{className:`oc-introspect__chips`,children:r.groups.map(e=>(0,A.jsx)(S,{variant:`secondary`,children:e.name},e.groupId))})]}),(0,A.jsxs)(`section`,{className:`oc-introspect__section`,children:[(0,A.jsx)(`h3`,{className:`oc-introspect__title`,children:s()}),r.agents.length===0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:u()}):(0,A.jsx)(`ul`,{className:`oc-introspect__list`,children:r.agents.map(e=>(0,A.jsxs)(`li`,{className:`oc-introspect__row`,children:[(0,A.jsx)(`span`,{className:`oc-introspect__name`,children:e.displayName||e.agentId}),e.isDefault?(0,A.jsx)(S,{variant:`default`,children:l()}):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:o()}),r.charts.length===0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:u()}):(0,A.jsx)(`ul`,{className:`oc-introspect__list`,children:r.charts.map(e=>(0,A.jsxs)(`li`,{className:`oc-introspect__row`,children:[(0,A.jsx)(`span`,{className:`oc-introspect__name`,children:e.name}),(0,A.jsx)(S,{variant:`outline`,children:k(e.via)})]},e.key))})]}),(0,A.jsxs)(`section`,{className:`oc-introspect__section`,children:[(0,A.jsx)(`h3`,{className:`oc-introspect__title`,children:f()}),r.permissions.length===0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:u()}):(0,A.jsx)(`div`,{className:`oc-introspect__chips`,children:r.permissions.map(e=>(0,A.jsx)(S,{variant:`secondary`,children:e},e))})]})]})]})}export{M as AccessTab};
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Ap as r,Bp as i,Dp as a,Fp as o,Ip as s,Lp as c,Mp as l,Np as u,Op as d,Pp as f,Rp as p,Tz as m,Vp as h,gz as g,jp as _,kp as v,t as y,zp as b}from"./api-CMppRsht.js";import{$ as x,Et as S,Q as C,X as w,Z as T,et as E}from"./index-C3dl90Xw.js";var D=t(e(),1);function O(e){return e===`user`?_():e===`all`?r():v({group:e.group})}function k(e){return e===`common`?d():e===`owner`?a():v({group:e.group})}var A=n();function j(e){return e.name||e.email||e.userId.slice(0,8)}function M(){let e=m(y.admin.listUsers,{}),[t,n]=(0,D.useState)(``),r=m(y.introspect.introspectUser,t?{userId:t}:`skip`);return(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:h()}),(0,A.jsxs)(w,{value:t,onValueChange:n,children:[(0,A.jsx)(x,{size:`sm`,"aria-label":i(),children:(0,A.jsx)(E,{placeholder:i()})}),(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:b()}):r===void 0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:g()}):(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:r.user.label}),(0,A.jsx)(S,{variant:`secondary`,children:r.role})]})]}),(0,A.jsxs)(`section`,{className:`oc-introspect__section`,children:[(0,A.jsx)(`h3`,{className:`oc-introspect__title`,children:c()}),r.groups.length===0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:u()}):(0,A.jsx)(`div`,{className:`oc-introspect__chips`,children:r.groups.map(e=>(0,A.jsx)(S,{variant:`secondary`,children:e.name},e.groupId))})]}),(0,A.jsxs)(`section`,{className:`oc-introspect__section`,children:[(0,A.jsx)(`h3`,{className:`oc-introspect__title`,children:s()}),r.agents.length===0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:u()}):(0,A.jsx)(`ul`,{className:`oc-introspect__list`,children:r.agents.map(e=>(0,A.jsxs)(`li`,{className:`oc-introspect__row`,children:[(0,A.jsx)(`span`,{className:`oc-introspect__name`,children:e.displayName||e.agentId}),e.isDefault?(0,A.jsx)(S,{variant:`default`,children:l()}):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:o()}),r.charts.length===0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:u()}):(0,A.jsx)(`ul`,{className:`oc-introspect__list`,children:r.charts.map(e=>(0,A.jsxs)(`li`,{className:`oc-introspect__row`,children:[(0,A.jsx)(`span`,{className:`oc-introspect__name`,children:e.name}),(0,A.jsx)(S,{variant:`outline`,children:k(e.via)})]},e.key))})]}),(0,A.jsxs)(`section`,{className:`oc-introspect__section`,children:[(0,A.jsx)(`h3`,{className:`oc-introspect__title`,children:f()}),r.permissions.length===0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:u()}):(0,A.jsx)(`div`,{className:`oc-introspect__chips`,children:r.permissions.map(e=>(0,A.jsx)(S,{variant:`secondary`,children:e},e))})]})]})]})}export{M as AccessTab};
@@ -1 +1 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$h as r,Qh as i,eg as a,ig as o,ng as s,rg as c,tg as l}from"./api-CMppRsht.js";import{r as u}from"./dist-CNchpxsr.js";import{t as d}from"./x-CdHbCgxq.js";import{t as f}from"./button-IhgT55aN.js";import{$ as p,Q as m,X as h,Z as g,et as _,jt as v,un as y}from"./index-CFqHR0gi.js";import{r as b}from"./TimeRangePicker-CS4l2E_Y.js";var x=t(e(),1),S=n(),C=[{value:`eq`,label:`=`},{value:`neq`,label:`≠`},{value:`contains`,label:o()},{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 o=(0,x.useRef)(t),w=!!(o.current&&o.current.length>0),[D,O]=(0,x.useState)(w),[k,A]=(0,x.useState)(()=>w?E(o.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}),c(),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:s()}):(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:l()})}),(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":r(),onClick:()=>P(t.id),children:(0,S.jsx)(d,{})})]},t.id))}),(0,S.jsxs)(f,{variant:`outline`,size:`sm`,className:`oc-advfilter__add`,onClick:N,children:[(0,S.jsx)(y,{}),i()]})]}):null]})}export{D as t};
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$h as r,Qh as i,eg as a,ig as o,ng as s,rg as c,tg as l}from"./api-CMppRsht.js";import{r as u}from"./dist-CNchpxsr.js";import{t as d}from"./x-CdHbCgxq.js";import{t as f}from"./button-IhgT55aN.js";import{$ as p,Q as m,X as h,Z as g,et as _,jt as v,un as y}from"./index-C3dl90Xw.js";import{r as b}from"./TimeRangePicker-DLQwf08l.js";var x=t(e(),1),S=n(),C=[{value:`eq`,label:`=`},{value:`neq`,label:`≠`},{value:`contains`,label:o()},{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 o=(0,x.useRef)(t),w=!!(o.current&&o.current.length>0),[D,O]=(0,x.useState)(w),[k,A]=(0,x.useState)(()=>w?E(o.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}),c(),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:s()}):(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:l()})}),(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":r(),onClick:()=>P(t.id),children:(0,S.jsx)(d,{})})]},t.id))}),(0,S.jsxs)(f,{variant:`outline`,size:`sm`,className:`oc-advfilter__add`,onClick:N,children:[(0,S.jsx)(y,{}),i()]})]}):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{$a as r,$u as i,Aa as a,Da as o,Ea as s,Gu as c,Ja as l,Ju as u,Ka as d,Ku as f,Oa as p,Qa as m,Qu as h,Sj as g,Sz as _,Ta as v,Tz as y,Wu as b,Xa as x,Xu as S,Ya as C,Yu as w,Za as T,Zu as E,_d as D,ad as O,af as k,ao as A,cd as j,co as M,ct as N,dd as ee,do as P,ed as F,eo as I,fd as te,fo as L,gd as R,gz as z,hd as ne,id as re,io as B,ka as V,ld as ie,lo as ae,md as oe,nd as se,no as ce,od as le,oo as ue,pd as de,qa as fe,qu as pe,rd as me,rf as he,ro as ge,sd as _e,so as H,t as U,td as ve,to as ye,ud as be,uo as xe,vd as Se,vz as W,wa as Ce,wz as we,yd as Te}from"./api-CMppRsht.js";import{t as G}from"./button-IhgT55aN.js";import{$ as Ee,B as De,Ct as Oe,Dt as K,Et as ke,Q as Ae,St as je,Tt as Me,X as Ne,Z as Pe,at as Fe,bt as Ie,et as Le,in as q,nt as Re,ot as ze,q as Be,rt as Ve,tt as He,vt as Ue,wt as We,xt as Ge,yt as Ke}from"./index-CFqHR0gi.js";import{n as qe,t as Je}from"./curation-CQksaIbm.js";import{i as Ye}from"./compatView-ok0H4ab7.js";/* empty css */var J=t(e(),1),Y=2e4,Xe=6e4;function Ze(e){return typeof e!=`number`||e<=0?0:Math.round(e/Y*100)}function Qe(e){return e<=0?0:Math.round(e/Xe*100)}function X(e,t){let n=(typeof e==`number`&&e>0?e:0)/1e3;return new Intl.NumberFormat(t,{minimumFractionDigits:1,maximumFractionDigits:1}).format(n)}function $e(e){return e.reduce((e,t)=>e+(typeof t.size==`number`&&t.size>0?t.size:0),0)}var Z=3;function et(e,t){let n=new Map;for(let t of e.split(`
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$a as r,$u as i,Aa as a,Da as o,Ea as s,Gu as c,Ja as l,Ju as u,Ka as d,Ku as f,Oa as p,Qa as m,Qu as h,Sj as g,Sz as _,Ta as v,Tz as y,Wu as b,Xa as x,Xu as S,Ya as C,Yu as w,Za as T,Zu as E,_d as D,ad as O,af as k,ao as A,cd as j,co as M,ct as N,dd as ee,do as P,ed as F,eo as I,fd as te,fo as L,gd as R,gz as z,hd as ne,id as re,io as B,ka as V,ld as ie,lo as ae,md as oe,nd as se,no as ce,od as le,oo as ue,pd as de,qa as fe,qu as pe,rd as me,rf as he,ro as ge,sd as _e,so as H,t as U,td as ve,to as ye,ud as be,uo as xe,vd as Se,vz as W,wa as Ce,wz as we,yd as Te}from"./api-CMppRsht.js";import{t as G}from"./button-IhgT55aN.js";import{$ as Ee,B as De,Ct as Oe,Dt as K,Et as ke,Q as Ae,St as je,Tt as Me,X as Ne,Z as Pe,at as Fe,bt as Ie,et as Le,in as q,nt as Re,ot as ze,q as Be,rt as Ve,tt as He,vt as Ue,wt as We,xt as Ge,yt as Ke}from"./index-C3dl90Xw.js";import{n as qe,t as Je}from"./curation-CQksaIbm.js";import{i as Ye}from"./compatView-ok0H4ab7.js";/* empty css */var J=t(e(),1),Y=2e4,Xe=6e4;function Ze(e){return typeof e!=`number`||e<=0?0:Math.round(e/Y*100)}function Qe(e){return e<=0?0:Math.round(e/Xe*100)}function X(e,t){let n=(typeof e==`number`&&e>0?e:0)/1e3;return new Intl.NumberFormat(t,{minimumFractionDigits:1,maximumFractionDigits:1}).format(n)}function $e(e){return e.reduce((e,t)=>e+(typeof t.size==`number`&&t.size>0?t.size:0),0)}var Z=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<Z&&a.push(e)):t>0&&(i+=t,o.length<Z&&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=y(U.me.getMe,{host:Be}),t=e?.role===`admin`,n=(e?.permissions??[]).includes(`bridge.read`),r=y(U.admin.listInstances,e!==void 0&&t?{}:`skip`),[i,a]=(0,J.useState)(null);(0,J.useEffect)(()=>{!t||!r||r.length===0||(!i||!r.some(e=>e.name===i))&&a(r[0].name)},[t,r,i]);let o=y(U.agents.listAgentsForInstance,t&&i?{instanceName:i}:`skip`),s=y(U.agents.listMyAgents,e!==void 0&&!t?{}:`skip`),c=(0,J.useMemo)(()=>{if(e!==void 0){if(t)return i===null||o===void 0?r!==void 0&&r.length===0?[]:void 0:o.agents.map(e=>({instanceName:i,agentId:e.agentId,label:`${e.emoji?`${e.emoji} `:``}${e.displayName??e.agentId}`}));if(s!==void 0)return s.map(e=>({instanceName:e.instanceName,agentId:e.agentId,label:`${e.emoji?`${e.emoji} `:``}${e.displayName??e.agentId}`}))}},[e,t,i,o,r,s]),[l,u]=(0,J.useState)(null);(0,J.useEffect)(()=>{!c||c.length===0||(!l||!c.some(e=>$(e)===l))&&u($(c[0]))},[c,l]);let d=c?.find(e=>$(e)===l)??null,f=_(U.agentFiles.listAgentFiles),[p,m]=(0,J.useState)({status:`idle`}),h=d?.instanceName??null,g=d?.agentId??null,v=y(U.compat.forInstance,n&&h!==null?{instanceName:h}:`skip`),b=n&&h!==null?De(v,`agentFiles`):null,x=b===null?!1:b===`loading`?null:b.blocked,S=(0,J.useCallback)(async()=>{if(!(h===null||g===null)){m({status:`loading`});try{m({status:`done`,files:(await f({instanceName:h,agentId:g})).files})}catch(e){m({status:`error`,dashboardAbsent:tt(e)})}}},[f,h,g]);(0,J.useEffect)(()=>{x===!1&&S()},[S,x]);let[C,w]=(0,J.useState)(null),T=y(U.agentFileCuration.listCurations,t&&h!==null&&g!==null?{instanceName:h,agentId:g}:`skip`),E=y(U.agentFileCuration.curationSettings,t&&h!==null?{instanceName:h}:`skip`),O=_(U.agentFileCuration.requestCuration),[k,A]=(0,J.useState)(null),[P,F]=(0,J.useState)(null),{toast:I}=K(),L=(0,J.useMemo)(()=>{let e=new Map;for(let t of T??[])e.has(t.name)||e.set(t.name,t);return e},[T]),re=(0,J.useCallback)(async e=>{if(!(h===null||g===null)){A(e);try{let t=await O({instanceName:h,agentId:g,name:e,trigger:`manual`});t.ok?I({title:ae(),variant:`success`}):I({title:M({reason:t.reason??`unknown`}),variant:`error`})}catch{I({title:H(),variant:`error`})}finally{A(null)}}},[O,h,g,I]),B=W(),V=(0,J.useMemo)(()=>new Intl.NumberFormat(B,{maximumFractionDigits:0}),[B]);return e===void 0||c===void 0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:z()}):(0,Q.jsxs)(`div`,{className:`oc-afiles`,children:[(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:Te()}),(0,Q.jsxs)(`div`,{className:`oc-afiles__picker`,children:[t&&(r?.length??0)>1?(0,Q.jsxs)(Ne,{value:i??``,onValueChange:e=>a(e),children:[(0,Q.jsx)(Ee,{size:`sm`,"aria-label":Se(),children:(0,Q.jsx)(Le,{})}),(0,Q.jsx)(Pe,{children:(r??[]).map(e=>(0,Q.jsx)(Ae,{value:e.name,children:e.name},e.name))})]}):null,c.length>0?(0,Q.jsxs)(Ne,{value:l??``,onValueChange:e=>u(e),children:[(0,Q.jsx)(Ee,{size:`sm`,"aria-label":D(),children:(0,Q.jsx)(Le,{})}),(0,Q.jsx)(Pe,{children:c.map(e=>(0,Q.jsx)(Ae,{value:$(e),children:e.label},$(e)))})]}):(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:R()})]}),d===null?null:b===`loading`?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:z()}):b!==null&&b.blocked?(0,Q.jsxs)(`p`,{className:`oc-compat__blocked`,role:`status`,children:[(0,Q.jsx)(q,{size:14,"aria-hidden":!0}),` `,Ye(b.gatewayVersion,b.provider)]}):p.status===`loading`||p.status===`idle`?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:z()}):p.status===`error`?(0,Q.jsxs)(`p`,{className:`oc-afiles__error`,role:`alert`,children:[p.dashboardAbsent?N():oe(),` `,!p.dashboardAbsent&&(0,Q.jsx)(G,{variant:`outline`,size:`sm`,onClick:()=>void S(),children:he()})]}):p.files.length===0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:ne()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`div`,{className:`oc-afiles__list`,children:p.files.map(e=>{let n=Ze(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)(ke,{variant:`outline`,children:de()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`span`,{className:`oc-afiles__size`,children:te({size:X(e.size,B)})}),(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:ee({pct:V.format(n)})}),r?(0,Q.jsx)(q,{size:14,className:`oc-afiles__warn`,"aria-label":be()}):(0,Q.jsx)(`span`,{className:`oc-afiles__warn-slot`,"aria-hidden":!0})]}),(0,Q.jsx)(G,{variant:`outline`,size:`sm`,className:`oc-afiles__open`,onClick:()=>w(e),children:t?j():_e()}),t&&!e.missing?(0,Q.jsx)(it,{curatable:Je.includes(e.name),size:e.size??0,budget:E?.budgetChars??null,enabled:E?.enabled??!1,curation:L.get(e.name)??null,inFlight:k===e.name,onCurate:()=>void re(e.name),onReview:e=>F(e)}):null]},e.name)})}),(0,Q.jsx)(`p`,{className:`oc-afiles__budget`,children:ie({used:X($e(p.files),B),total:X(Xe,B),pct:V.format(Qe($e(p.files)))})})]}),C&&d?(0,Q.jsx)(at,{instanceName:d.instanceName,agentId:d.agentId,name:C.name,isAdmin:t,onClose:()=>w(null),onSaved:()=>void S()}):null,P?(0,Q.jsx)(ot,{curationId:P,onClose:()=>F(null),onApplied:()=>{F(null),S()}}):null]})}function it({curatable:e,size:t,budget:n,enabled:r,curation:i,inFlight:a,onCurate:o,onReview:s}){return i?.status===`proposed`?(0,Q.jsx)(G,{variant:`default`,size:`sm`,className:`oc-afiles__curate`,onClick:()=>s(i._id),children:P()}):a||i?.status===`dispatched`||i?.status===`applying`?(0,Q.jsx)(ke,{variant:`outline`,className:`oc-afiles__curate-status`,children:xe()}):e&&r&&n!==null&&qe(t,n)?(0,Q.jsx)(G,{variant:`outline`,size:`sm`,className:`oc-afiles__curate`,onClick:o,children:L()}):null}function at({instanceName:e,agentId:t,name:n,isAdmin:r,onClose:a,onSaved:o}){let s=_(U.agentFiles.getAgentFile),l=_(U.agentFiles.setAgentFile),d=K(),[p,m]=(0,J.useState)(null),[v,y]=(0,J.useState)(!1),[x,C]=(0,J.useState)(``),[T,D]=(0,J.useState)(!1),[A,j]=(0,J.useState)(!1),[M,N]=(0,J.useState)(!1),[ee,P]=(0,J.useState)(!1),I=(0,J.useCallback)(async r=>{y(!1);try{let i=await s({instanceName:e,agentId:t,name:n});m({content:i.content,updatedAtMs:i.updatedAtMs}),r||C(i.content),N(!1)}catch{y(!0)}},[s,e,t,n]);(0,J.useEffect)(()=>{I(!1)},[I]);async function te(){if(p!==null){j(!0),P(!1);try{await l({instanceName:e,agentId:t,name:n,content:x,baseUpdatedAtMs:p.updatedAtMs??void 0}),d.success(F({name:n})),o(),await I(!1)}catch(e){nt(e)?N(!0):P(!0)}finally{j(!1)}}}let L=p!==null&&x!==p.content,R=(0,J.useMemo)(()=>p===null?null:et(p.content,x),[p,x]),ne=x.length>Y,B=W(),V=(0,J.useMemo)(()=>new Intl.NumberFormat(B),[B]);return(0,Q.jsx)(He,{open:!0,onOpenChange:e=>!e&&a(),children:(0,Q.jsxs)(Re,{className:`oc-afiles__editor`,children:[(0,Q.jsxs)(Fe,{children:[(0,Q.jsx)(ze,{children:le({name:n})}),(0,Q.jsxs)(Ve,{children:[O({agent:t,instance:e}),r?null:(0,Q.jsxs)(Q.Fragment,{children:[` · `,re()]})]})]}),v?(0,Q.jsxs)(`p`,{className:`oc-afiles__error`,role:`alert`,children:[h(),` `,(0,Q.jsx)(G,{variant:`outline`,size:`sm`,onClick:()=>void I(!1),children:he()})]}):p===null?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:z()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`textarea`,{className:`oc-afiles__source`,value:x,readOnly:!r,spellCheck:!1,onChange:e=>C(e.target.value),"aria-label":le({name:n})}),(0,Q.jsx)(`p`,{className:`oc-afiles__hint`,children:me()}),M?(0,Q.jsxs)(`p`,{className:`oc-afiles__error`,role:`alert`,children:[E(),` `,(0,Q.jsx)(G,{variant:`outline`,size:`sm`,onClick:()=>void I(!0),children:S()})]}):null,ee?(0,Q.jsx)(`p`,{className:`oc-afiles__error`,role:`alert`,children:i()}):null,(0,Q.jsxs)(`div`,{className:`oc-afiles__editor-foot`,children:[(0,Q.jsx)(`span`,{className:`oc-afiles__count${ne?` is-over`:``}`,children:se({count:V.format(x.length),max:V.format(Y)})}),r?(0,Q.jsx)(G,{size:`sm`,disabled:!L||A||M,onClick:()=>D(!0),children:A?k():ve()}):null]})]}),(0,Q.jsx)(Ue,{open:T,onOpenChange:D,children:(0,Q.jsxs)(Ge,{children:[(0,Q.jsxs)(We,{children:[(0,Q.jsx)(Me,{children:w({name:n})}),(0,Q.jsx)(je,{children:u({agent:t})})]}),R?(0,Q.jsxs)(`div`,{className:`oc-afiles__diff`,children:[(0,Q.jsx)(`p`,{className:`oc-afiles__diff-counts`,children:pe({added:R.added,removed:R.removed})}),R.sampleAdded.length>0?(0,Q.jsxs)(`div`,{className:`oc-afiles__diff-block`,children:[(0,Q.jsx)(`span`,{className:`oc-afiles__diff-label`,children:f()}),R.sampleAdded.map((e,t)=>(0,Q.jsx)(`code`,{className:`oc-afiles__diff-line is-add`,children:e||` `},t))]}):null,R.sampleRemoved.length>0?(0,Q.jsxs)(`div`,{className:`oc-afiles__diff-block`,children:[(0,Q.jsx)(`span`,{className:`oc-afiles__diff-label`,children:c()}),R.sampleRemoved.map((e,t)=>(0,Q.jsx)(`code`,{className:`oc-afiles__diff-line is-del`,children:e||` `},t))]}):null]}):null,(0,Q.jsxs)(Oe,{children:[(0,Q.jsx)(Ie,{children:g()}),(0,Q.jsx)(Ke,{onClick:()=>void te(),children:b()})]})]})})]})})}function ot({curationId:e,onClose:t,onApplied:n}){let i=y(U.agentFileCuration.getProposal,{curationId:e}),c=_(U.agentFileCuration.approveCuration),u=we(U.agentFileCuration.rejectCuration),{toast:f}=K(),[h,g]=(0,J.useState)(null),[b,S]=(0,J.useState)(!1),[w,E]=(0,J.useState)(``),D=W(),O=(0,J.useMemo)(()=>i?et(i.beforeContent,i.proposedContent):null,[i]);async function j(){g(`approve`);try{let t=await c({curationId:e});t.ok?(f({title:ue(),variant:`success`}),n()):f({title:t.reason===`conflict`?B():ge({reason:t.reason??`unknown`}),variant:`error`})}catch{f({title:H(),variant:`error`})}finally{g(null)}}async function M(n){g(`reject`);try{let r=w.trim();(await u({curationId:e,...r?{comment:r}:{},relaunch:n})).ok?f({title:n?v():A(),variant:`success`}):f({title:I(),variant:`error`}),t()}catch{f({title:H(),variant:`error`})}finally{g(null)}}return(0,Q.jsx)(He,{open:!0,onOpenChange:e=>e?void 0:t(),children:(0,Q.jsxs)(Re,{className:`oc-afiles__review`,children:[(0,Q.jsxs)(Fe,{children:[(0,Q.jsx)(ze,{children:i?ce({name:i.name}):z()}),(0,Q.jsx)(Ve,{children:ye()})]}),i===void 0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:z()}):i===null?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:I()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`p`,{className:`oc-afiles__review-sizes`,children:[r({before:X(i.beforeSize,D),after:X(i.proposedSize,D)}),i.overBudget?(0,Q.jsxs)(Q.Fragment,{children:[` `,(0,Q.jsx)(q,{size:13,"aria-hidden":!0}),` `,m()]}):null]}),O?(0,Q.jsx)(`p`,{className:`oc-afiles__review-diff`,children:T({added:O.added,removed:O.removed})}):null,i.feedback?(0,Q.jsx)(`p`,{className:`oc-afiles__review-feedback`,children:Ce({feedback:i.feedback})}):null,O&&O.sampleRemoved.length>0?(0,Q.jsxs)(`div`,{className:`oc-afiles__review-removed`,children:[(0,Q.jsx)(`p`,{className:`oc-afiles__review-label`,children:d()}),(0,Q.jsx)(`ul`,{children:O.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:fe()}),(0,Q.jsx)(`pre`,{className:`oc-afiles__review-pre`,children:i.beforeContent})]}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`p`,{className:`oc-afiles__review-label`,children:x()}),(0,Q.jsx)(`pre`,{className:`oc-afiles__review-pre`,children:i.proposedContent})]})]})]}),b?(0,Q.jsxs)(`div`,{className:`oc-afiles__reject-form`,children:[(0,Q.jsx)(`label`,{className:`oc-afiles__review-label`,htmlFor:`curation-reject-comment`,children:a()}),(0,Q.jsx)(`textarea`,{id:`curation-reject-comment`,className:`oc-afiles__reject-textarea`,rows:3,placeholder:V(),value:w,onChange:e=>E(e.target.value)}),(0,Q.jsxs)(`div`,{className:`oc-afiles__review-actions`,children:[(0,Q.jsx)(G,{variant:`ghost`,onClick:()=>S(!1),disabled:h!==null,children:p()}),(0,Q.jsx)(G,{variant:`outline`,onClick:()=>void M(!1),disabled:h!==null,children:h===`reject`?k():o()}),(0,Q.jsx)(G,{variant:`default`,onClick:()=>void M(!0),disabled:h!==null,children:h===`reject`?k():s()})]})]}):(0,Q.jsxs)(`div`,{className:`oc-afiles__review-actions`,children:[(0,Q.jsx)(G,{variant:`outline`,onClick:()=>S(!0),disabled:h!==null||i==null,children:C()}),(0,Q.jsx)(G,{variant:`default`,onClick:()=>void j(),disabled:h!==null||i==null,children:h===`approve`?k():l()})]})]})})}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,AC as i,BC as ee,CC as te,DC as ne,EC as re,FC as ie,GC as a,HC as o,IC as s,LC as ae,MC as oe,NC as se,OC as ce,PC as le,QS as c,RC as ue,SC as l,TC as de,Tz as u,UC as d,VC as fe,WC as f,XS as p,ZS as m,_C as h,aC as pe,bC as me,cC as he,dC as g,eC as _,fC as ge,gC as _e,hC as v,iC as ve,jC as ye,kC as be,lC as xe,mC as Se,nC as y,oC as b,pC as x,rC as S,sC as C,t as w,tC as T,uC as E,vC as D,wC as O,wz as k,xC as A,yC as j,zC as Ce}from"./api-CMppRsht.js";import{$ as M,Dt as we,Et as N,Fn as P,In as Te,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-CFqHR0gi.js";import{n as Ae}from"./TimeRangePicker-CS4l2E_Y.js";import{t as je}from"./FilterBar-B3g5mQkA.js";import{t as Me}from"./DataTableShell-hu5AF3BF.js";import{t as W}from"./dispatchErrorInfo-BvZIc7oP.js";var G=t(e(),1),K=n(),q=`__all__`,Ne=[{value:`open`},{value:`acknowledged`},{value:`resolved`}];function Pe(e){return e===`open`?a():e===`acknowledged`?f():d()}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??``,r=e.status===J?q:e.status,a=e.severity??q,c=e.kind??q,[d,f]=(0,G.useState)(q),p=De(e.from,e.to),{from:m,to:_}=Ae(p),y=e=>void t({search:t=>({...t,q:e||void 0}),replace:!0}),S=e=>void t({search:t=>({...t,status:e===q?J:e})}),T=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=k(w.anomalies.resolveAnomaly),Y=(u(w.me.getMe,{host:ke})?.permissions??[]).includes(`admin.manage`),X=u(w.anomalies.listAnomalies,{limit:Re,filter:{q:n||void 0,from:m,to:_,anomalyStatus:r===q?void 0:r,severity:a===q?void 0:a,source:d===q?void 0:d,kind:c===q?void 0:c}}),Z=(0,G.useMemo)(()=>{let e=new Set;for(let t of X??[])e.add(t.kind);return[...e].sort()},[X]),Q=n!==``||r!==`open`||a!==q||d!==q||c!==q||p.kind!==`relative`||p.from!==Le.from;function Ue(){f(q),t({search:{status:`open`},replace:!0})}async function We(e){if(await H({title:o(),description:(0,K.jsxs)(K.Fragment,{children:[fe(),` `,(0,K.jsx)(`span`,{className:`font-mono`,children:e.kind}),` `,ee(),` `,(0,K.jsx)(`strong`,{children:Ce()}),`.`,` `,ue()]}),confirmLabel:ae()}))try{await W({anomalyId:e._id,status:`resolved`}),U.success(s(),e.kind)}catch(e){U.error(ie(),e)}}async function Ge(e){try{await W({anomalyId:e._id,status:`acknowledged`}),U.success(le(),e.kind)}catch(e){U.error(se(),e)}}return(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)(`p`,{className:`oc-admin__hint`,children:[oe(),` `,(0,K.jsx)(`strong`,{children:ye()}),` `,i(),` `,(0,K.jsx)(`strong`,{children:be()}),` `,ce(),` `,(0,K.jsx)(`strong`,{children:ne()}),` `,re(),` `,(0,K.jsx)(`span`,{className:`oc-filter__window`,children:de()})]}),(0,K.jsxs)(je,{q:n,onQChange:y,searchPlaceholder:O(),timeRange:p,onTimeRangeChange:V,onReset:Ue,canReset:Q,children:[(0,K.jsxs)(I,{value:r,onValueChange:S,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:te()}),Ne.map(e=>(0,K.jsx)(F,{value:e.value,children:Pe(e.value)},e.value))]})]}),(0,K.jsxs)(I,{value:a,onValueChange:T,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:D()}),Fe.map(e=>(0,K.jsx)(F,{value:e,children:e},e))]})]}),(0,K.jsxs)(I,{value:d,onValueChange:f,children:[(0,K.jsx)(M,{size:`sm`,className:`w-32`,children:(0,K.jsx)(B,{placeholder:h()})}),(0,K.jsxs)(L,{children:[(0,K.jsx)(F,{value:q,children:_e()}),Ie.map(e=>(0,K.jsx)(F,{value:e,children:e},e))]})]}),(0,K.jsxs)(I,{value:c,onValueChange:R,children:[(0,K.jsx)(M,{size:`sm`,className:`w-36`,children:(0,K.jsx)(B,{placeholder:v()})}),(0,K.jsxs)(L,{children:[(0,K.jsx)(F,{value:q,children:Se()}),Z.map(e=>(0,K.jsx)(F,{value:e,children:e},e))]})]})]}),(0,K.jsx)(Me,{title:x(),rows:X,emptyHint:r===`open`?ge():g(),rowActions:e=>Y&&e.status===`open`?[{label:E(),onSelect:()=>void We(e)},{label:xe(),onSelect:()=>void Ge(e)}]:[],columns:[{header:he(),cell:e=>(0,K.jsx)(`span`,{className:`oc-traces__time`,children:z(e.at)}),sort:e=>e.at},{header:v(),cell:e=>(0,K.jsx)(`code`,{className:`oc-traces__mono`,children:e.kind}),sort:e=>e.kind},{header:A(),cell:e=>e.occurrenceCount!==null&&e.occurrenceCount>1?(0,K.jsx)(`span`,{className:`oc-traces__time`,title:e.firstAt===null?void 0:j({when:z(e.firstAt)}),children:me({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:C(),cell:e=>(0,K.jsx)(Ve,{status:e.status}),sort:e=>e.status===`resolved`?2:+(e.status===`acknowledged`)},{header:h(),cell:e=>(0,K.jsx)(N,{variant:`outline`,children:e.source}),sort:e=>e.source},{header:b(),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:pe(),cell:e=>(0,K.jsx)(ze,{row:e}),sort:e=>e.evidence??null},{header:ve(),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:[`↗ `,S()]}):null]})}let n=Z(e);if(!n.dominantCode){let e=n.sampleCorrelationId;return e?(0,K.jsx)(`div`,{className:`oc-anomaly__cause`,children:(0,K.jsxs)(`button`,{type:`button`,className:`oc-anomaly__drill`,onClick:()=>void t({to:`/settings/traces`,search:{correlationId:e,limit:100}}),children:[`↗ `,S()]})}):(0,K.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})}let r=W(n.dominantCode),i=n.sampleCorrelationId;return(0,K.jsxs)(`div`,{className:`oc-anomaly__cause`,children:[(0,K.jsxs)(`div`,{className:`oc-anomaly__cause-head`,children:[(0,K.jsx)(`span`,{className:`oc-anomaly__cause-label`,children:r.label}),(0,K.jsx)(`code`,{className:`oc-traces__mono`,children:n.dominantCode})]}),(0,K.jsx)(`p`,{className:`oc-anomaly__cause-hint`,children:r.hint}),i?(0,K.jsxs)(`button`,{type:`button`,className:`oc-anomaly__drill`,onClick:()=>void t({to:`/settings/traces`,search:{correlationId:i,limit:100}}),children:[`↗ `,S()]}):null]})}function $({row:e}){let[t,n]=(0,G.useState)(!1),i=u(w.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:[y(),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:T()})}),i===void 0?(0,K.jsx)(`p`,{className:`oc-traces__muted`,children:_()}):i.length===0?(0,K.jsx)(`p`,{className:`oc-traces__muted`,children:r()}):(0,K.jsx)(`div`,{className:`oc-anomaly__attachments`,children:i.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:c()}):e===`acknowledged`?(0,K.jsx)(N,{variant:`secondary`,children:m()}):(0,K.jsx)(N,{variant:`outline`,children:p()})}function He(e){return e.length>8?e.slice(0,8):e}export{Y as AnomaliesTab};
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$S as r,AC as i,BC as ee,CC as te,DC as ne,EC as re,FC as ie,GC as a,HC as o,IC as s,LC as ae,MC as oe,NC as se,OC as ce,PC as le,QS as c,RC as ue,SC as l,TC as de,Tz as u,UC as d,VC as fe,WC as f,XS as p,ZS as m,_C as h,aC as pe,bC as me,cC as he,dC as g,eC as _,fC as ge,gC as _e,hC as v,iC as ve,jC as ye,kC as be,lC as xe,mC as Se,nC as y,oC as b,pC as x,rC as S,sC as C,t as w,tC as T,uC as E,vC as D,wC as O,wz as k,xC as A,yC as j,zC as Ce}from"./api-CMppRsht.js";import{$ as M,Dt as we,Et as N,Fn as P,In as Te,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-C3dl90Xw.js";import{n as Ae}from"./TimeRangePicker-DLQwf08l.js";import{t as je}from"./FilterBar-CnjTuIOw.js";import{t as Me}from"./DataTableShell-BInsTzwk.js";import{t as W}from"./dispatchErrorInfo-BvZIc7oP.js";var G=t(e(),1),K=n(),q=`__all__`,Ne=[{value:`open`},{value:`acknowledged`},{value:`resolved`}];function Pe(e){return e===`open`?a():e===`acknowledged`?f():d()}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??``,r=e.status===J?q:e.status,a=e.severity??q,c=e.kind??q,[d,f]=(0,G.useState)(q),p=De(e.from,e.to),{from:m,to:_}=Ae(p),y=e=>void t({search:t=>({...t,q:e||void 0}),replace:!0}),S=e=>void t({search:t=>({...t,status:e===q?J:e})}),T=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=k(w.anomalies.resolveAnomaly),Y=(u(w.me.getMe,{host:ke})?.permissions??[]).includes(`admin.manage`),X=u(w.anomalies.listAnomalies,{limit:Re,filter:{q:n||void 0,from:m,to:_,anomalyStatus:r===q?void 0:r,severity:a===q?void 0:a,source:d===q?void 0:d,kind:c===q?void 0:c}}),Z=(0,G.useMemo)(()=>{let e=new Set;for(let t of X??[])e.add(t.kind);return[...e].sort()},[X]),Q=n!==``||r!==`open`||a!==q||d!==q||c!==q||p.kind!==`relative`||p.from!==Le.from;function Ue(){f(q),t({search:{status:`open`},replace:!0})}async function We(e){if(await H({title:o(),description:(0,K.jsxs)(K.Fragment,{children:[fe(),` `,(0,K.jsx)(`span`,{className:`font-mono`,children:e.kind}),` `,ee(),` `,(0,K.jsx)(`strong`,{children:Ce()}),`.`,` `,ue()]}),confirmLabel:ae()}))try{await W({anomalyId:e._id,status:`resolved`}),U.success(s(),e.kind)}catch(e){U.error(ie(),e)}}async function Ge(e){try{await W({anomalyId:e._id,status:`acknowledged`}),U.success(le(),e.kind)}catch(e){U.error(se(),e)}}return(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)(`p`,{className:`oc-admin__hint`,children:[oe(),` `,(0,K.jsx)(`strong`,{children:ye()}),` `,i(),` `,(0,K.jsx)(`strong`,{children:be()}),` `,ce(),` `,(0,K.jsx)(`strong`,{children:ne()}),` `,re(),` `,(0,K.jsx)(`span`,{className:`oc-filter__window`,children:de()})]}),(0,K.jsxs)(je,{q:n,onQChange:y,searchPlaceholder:O(),timeRange:p,onTimeRangeChange:V,onReset:Ue,canReset:Q,children:[(0,K.jsxs)(I,{value:r,onValueChange:S,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:te()}),Ne.map(e=>(0,K.jsx)(F,{value:e.value,children:Pe(e.value)},e.value))]})]}),(0,K.jsxs)(I,{value:a,onValueChange:T,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:D()}),Fe.map(e=>(0,K.jsx)(F,{value:e,children:e},e))]})]}),(0,K.jsxs)(I,{value:d,onValueChange:f,children:[(0,K.jsx)(M,{size:`sm`,className:`w-32`,children:(0,K.jsx)(B,{placeholder:h()})}),(0,K.jsxs)(L,{children:[(0,K.jsx)(F,{value:q,children:_e()}),Ie.map(e=>(0,K.jsx)(F,{value:e,children:e},e))]})]}),(0,K.jsxs)(I,{value:c,onValueChange:R,children:[(0,K.jsx)(M,{size:`sm`,className:`w-36`,children:(0,K.jsx)(B,{placeholder:v()})}),(0,K.jsxs)(L,{children:[(0,K.jsx)(F,{value:q,children:Se()}),Z.map(e=>(0,K.jsx)(F,{value:e,children:e},e))]})]})]}),(0,K.jsx)(Me,{title:x(),rows:X,emptyHint:r===`open`?ge():g(),rowActions:e=>Y&&e.status===`open`?[{label:E(),onSelect:()=>void We(e)},{label:xe(),onSelect:()=>void Ge(e)}]:[],columns:[{header:he(),cell:e=>(0,K.jsx)(`span`,{className:`oc-traces__time`,children:z(e.at)}),sort:e=>e.at},{header:v(),cell:e=>(0,K.jsx)(`code`,{className:`oc-traces__mono`,children:e.kind}),sort:e=>e.kind},{header:A(),cell:e=>e.occurrenceCount!==null&&e.occurrenceCount>1?(0,K.jsx)(`span`,{className:`oc-traces__time`,title:e.firstAt===null?void 0:j({when:z(e.firstAt)}),children:me({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:C(),cell:e=>(0,K.jsx)(Ve,{status:e.status}),sort:e=>e.status===`resolved`?2:+(e.status===`acknowledged`)},{header:h(),cell:e=>(0,K.jsx)(N,{variant:`outline`,children:e.source}),sort:e=>e.source},{header:b(),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:pe(),cell:e=>(0,K.jsx)(ze,{row:e}),sort:e=>e.evidence??null},{header:ve(),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:[`↗ `,S()]}):null]})}let n=Z(e);if(!n.dominantCode){let e=n.sampleCorrelationId;return e?(0,K.jsx)(`div`,{className:`oc-anomaly__cause`,children:(0,K.jsxs)(`button`,{type:`button`,className:`oc-anomaly__drill`,onClick:()=>void t({to:`/settings/traces`,search:{correlationId:e,limit:100}}),children:[`↗ `,S()]})}):(0,K.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})}let r=W(n.dominantCode),i=n.sampleCorrelationId;return(0,K.jsxs)(`div`,{className:`oc-anomaly__cause`,children:[(0,K.jsxs)(`div`,{className:`oc-anomaly__cause-head`,children:[(0,K.jsx)(`span`,{className:`oc-anomaly__cause-label`,children:r.label}),(0,K.jsx)(`code`,{className:`oc-traces__mono`,children:n.dominantCode})]}),(0,K.jsx)(`p`,{className:`oc-anomaly__cause-hint`,children:r.hint}),i?(0,K.jsxs)(`button`,{type:`button`,className:`oc-anomaly__drill`,onClick:()=>void t({to:`/settings/traces`,search:{correlationId:i,limit:100}}),children:[`↗ `,S()]}):null]})}function $({row:e}){let[t,n]=(0,G.useState)(!1),i=u(w.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:[y(),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:T()})}),i===void 0?(0,K.jsx)(`p`,{className:`oc-traces__muted`,children:_()}):i.length===0?(0,K.jsx)(`p`,{className:`oc-traces__muted`,children:r()}):(0,K.jsx)(`div`,{className:`oc-anomaly__attachments`,children:i.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:c()}):e===`acknowledged`?(0,K.jsx)(N,{variant:`secondary`,children:m()}):(0,K.jsx)(N,{variant:`outline`,children:p()})}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{Bw as r,Ci as i,Ei as a,Gw as o,Hw as s,Iw as c,Jw as l,Kw as u,Lw as d,Rw as f,Si as p,Ti as m,Tz as h,Uw as g,Vw as _,Ww as v,Xw as y,Yw as b,qw as x,t as S,wi as C,xi as w,zw as T}from"./api-CMppRsht.js";import{$ as E,Fn as D,In 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-CFqHR0gi.js";import{n as ee}from"./TimeRangePicker-CS4l2E_Y.js";import{t as z}from"./FilterBar-B3g5mQkA.js";import{t as B}from"./AdvancedFilter-Cj03B7Mb.js";import{t as V}from"./DataTableShell-hu5AF3BF.js";var H=t(e(),1),U=n(),W={kind:`relative`,from:I,to:`now`},G=`__all__`,K=[{value:`action`,label:a()},{value:`realLabel`,label:m()},{value:`targetLabel`,label:C()},{value:`impersonated`,label:i()},{value:`resource`,label:p()},{value:`resourceId`,label:w()}];function q(){let e=O({from:`/settings/audit`}),t=D({from:`/settings/audit`}),n=e.q??``,i=e.action??G,a=e.impersonated??G,p=e.resource??G,m=F(e.from,e.to),C=(0,H.useMemo)(()=>R(e.adv),[e.adv]),{from:w,to:I}=ee(m),q=e=>void t({search:t=>({...t,q:e||void 0}),replace:!0}),J=e=>void t({search:t=>({...t,action:e===G?void 0:e})}),Y=e=>void t({search:t=>({...t,impersonated:e===G?void 0:e})}),X=e=>void t({search:t=>({...t,resource:e===G?void 0:e})}),Z=e=>void t({search:t=>({...t,...L(e)})}),Q=e=>void t({search:t=>({...t,adv:M(e)}),replace:!0}),$=h(S.admin.listAudit,{filter:{q:n||void 0,from:w,to:I,action:i===G?void 0:i,resource:p===G?void 0:p,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||p!==G||C.length>0||m.kind!==`relative`||m.from!==W.from;function ie(){t({search:{},replace:!0})}return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(`p`,{className:`oc-admin__hint`,children:[y(),` `,(0,U.jsx)(`span`,{className:`oc-filter__window`,children:b()})]}),(0,U.jsxs)(z,{q:n,onQChange:q,searchPlaceholder:l(),timeRange:m,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:u()}),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:o()}),(0,U.jsx)(k,{value:`yes`,children:v()}),(0,U.jsx)(k,{value:`no`,children:g()})]})]}),(0,U.jsxs)(A,{value:p,onValueChange:X,children:[(0,U.jsx)(E,{size:`sm`,className:`w-40`,children:(0,U.jsx)(P,{placeholder:s()})}),(0,U.jsxs)(j,{children:[(0,U.jsx)(k,{value:G,children:_()}),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:r(),rows:$,emptyHint:T(),columns:[{header:f(),cell:e=>N(e.at),sort:e=>e.at},{header:x(),cell:e=>e.action,sort:e=>e.action},{header:d(),cell:e=>e.realLabel,sort:e=>e.realLabel},{header:c(),cell:e=>e.targetLabel??`—`,sort:e=>e.targetLabel??null},{header:s(),cell:e=>e.resource?e.resource+(e.resourceId?` · ${e.resourceId.slice(0,8)}`:``):`—`,sort:e=>e.resource??null}]})]})}export{q as AuditTab};
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Bw as r,Ci as i,Ei as a,Gw as o,Hw as s,Iw as c,Jw as l,Kw as u,Lw as d,Rw as f,Si as p,Ti as m,Tz as h,Uw as g,Vw as _,Ww as v,Xw as y,Yw as b,qw as x,t as S,wi as C,xi as w,zw as T}from"./api-CMppRsht.js";import{$ as E,Fn as D,In 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-C3dl90Xw.js";import{n as ee}from"./TimeRangePicker-DLQwf08l.js";import{t as z}from"./FilterBar-CnjTuIOw.js";import{t as B}from"./AdvancedFilter-BzF0GRUD.js";import{t as V}from"./DataTableShell-BInsTzwk.js";var H=t(e(),1),U=n(),W={kind:`relative`,from:I,to:`now`},G=`__all__`,K=[{value:`action`,label:a()},{value:`realLabel`,label:m()},{value:`targetLabel`,label:C()},{value:`impersonated`,label:i()},{value:`resource`,label:p()},{value:`resourceId`,label:w()}];function q(){let e=O({from:`/settings/audit`}),t=D({from:`/settings/audit`}),n=e.q??``,i=e.action??G,a=e.impersonated??G,p=e.resource??G,m=F(e.from,e.to),C=(0,H.useMemo)(()=>R(e.adv),[e.adv]),{from:w,to:I}=ee(m),q=e=>void t({search:t=>({...t,q:e||void 0}),replace:!0}),J=e=>void t({search:t=>({...t,action:e===G?void 0:e})}),Y=e=>void t({search:t=>({...t,impersonated:e===G?void 0:e})}),X=e=>void t({search:t=>({...t,resource:e===G?void 0:e})}),Z=e=>void t({search:t=>({...t,...L(e)})}),Q=e=>void t({search:t=>({...t,adv:M(e)}),replace:!0}),$=h(S.admin.listAudit,{filter:{q:n||void 0,from:w,to:I,action:i===G?void 0:i,resource:p===G?void 0:p,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||p!==G||C.length>0||m.kind!==`relative`||m.from!==W.from;function ie(){t({search:{},replace:!0})}return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(`p`,{className:`oc-admin__hint`,children:[y(),` `,(0,U.jsx)(`span`,{className:`oc-filter__window`,children:b()})]}),(0,U.jsxs)(z,{q:n,onQChange:q,searchPlaceholder:l(),timeRange:m,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:u()}),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:o()}),(0,U.jsx)(k,{value:`yes`,children:v()}),(0,U.jsx)(k,{value:`no`,children:g()})]})]}),(0,U.jsxs)(A,{value:p,onValueChange:X,children:[(0,U.jsx)(E,{size:`sm`,className:`w-40`,children:(0,U.jsx)(P,{placeholder:s()})}),(0,U.jsxs)(j,{children:[(0,U.jsx)(k,{value:G,children:_()}),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:r(),rows:$,emptyHint:T(),columns:[{header:f(),cell:e=>N(e.at),sort:e=>e.at},{header:x(),cell:e=>e.action,sort:e=>e.action},{header:d(),cell:e=>e.realLabel,sort:e=>e.realLabel},{header:c(),cell:e=>e.targetLabel??`—`,sort:e=>e.targetLabel??null},{header:s(),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{$y as r,Au as i,Ay as a,By as o,Cu as s,Cy as c,D as l,Du as u,Dy as d,Eu as f,Ey as p,Fy as m,Gb as h,Gr as g,Gy as _,Hb as ee,Hy as te,Iy as ne,Jb as re,Jy as ie,Kb as ae,Kr as oe,Ky as se,Ly as ce,Mu as le,My as v,Nu as ue,Ny as de,Ou as y,Oy as fe,Py as pe,Qb as me,Qy as he,Rb as ge,Ry as _e,Su as ve,Sy as ye,Sz as be,Tu as xe,Ty as Se,Tz as b,Ub as Ce,Ur as we,Uy as Te,Vy as Ee,Wb as De,Wr as Oe,Wy as ke,Xr as Ae,Xy as je,Yb as Me,Yy as Ne,Zb as Pe,Zy as Fe,_u as Ie,ab as Le,by as x,cb as Re,db as ze,eb as Be,fb as Ve,gb as He,hb as Ue,ib as We,ju as Ge,jy as Ke,ku as qe,ky as Je,lb as Ye,lt as Xe,mb as Ze,nb as Qe,ob as $e,pb as et,qb as tt,qr as nt,qy as rt,rb as it,sb as at,t as S,tb as ot,ub as st,vy as C,wu as ct,wy as lt,wz as ut,xu as dt,xy as ft,yy as w,zb as pt,zy as mt}from"./api-CMppRsht.js";import{r as T}from"./dist-CNchpxsr.js";import{t as ht}from"./chevron-up-Od7h9avP.js";import{t as gt}from"./chevrons-up-down-DJIIcTyy.js";import{i as _t,n as E,o as vt,r as yt,s as bt}from"./FieldLabel-orXtJQ8U.js";import{i as xt,n as St,r as Ct,t as wt}from"./tabs-BQOp_WCt.js";import{t as Tt}from"./button-IhgT55aN.js";import{$ as D,Bt as Et,Dt,Et as O,F as Ot,Fn as kt,In as At,Mn as jt,Q as k,Rt as Mt,X as A,Z as j,at as Nt,ct as Pt,et as M,in as N,jn as P,jt as F,lt as I,nt as Ft,ot as It,q as Lt,rt as Rt,sn as zt,tt as Bt,ut as Vt,xn as Ht,zt as Ut}from"./index-CFqHR0gi.js";import{r as Wt}from"./locales-CPjguROj.js";import{a as Gt,i as L,n as R,o as z,r as B,t as V}from"./table-E4WVxNnB.js";import{t as Kt}from"./FilterBar-B3g5mQkA.js";import{a as H,n as qt,o as U,r as W,s as Jt,t as Yt}from"./compatView-ok0H4ab7.js";import{t as G}from"./dispatchErrorInfo-BvZIc7oP.js";var Xt=l(`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=l(`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),[i,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]),l=(0,K.useMemo)(()=>fn(s),[s]),u=(0,K.useMemo)(()=>pn(s),[s]),f=(0,K.useMemo)(()=>mn(s),[s]),m=(0,K.useMemo)(()=>dn(cn(s,n),i),[s,n,i]);function h(e){o(t=>t?.key===e?t.dir===`asc`?{key:e,dir:`desc`}:null:{key:e,dir:`asc`})}return e.length===0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:ne()}):(0,Q.jsxs)(`div`,{className:`oc-conn`,children:[(0,Q.jsxs)(Kt,{q:n.q,onQChange:e=>r(t=>({...t,q:e})),searchPlaceholder:de(),onReset:()=>r(on),canReset:sn(n),children:[(0,Q.jsxs)(A,{value:n.state,onValueChange:e=>r(t=>({...t,state:e})),children:[(0,Q.jsx)(D,{size:`sm`,className:`w-36`,children:(0,Q.jsx)(M,{placeholder:Ke()})}),(0,Q.jsxs)(j,{children:[(0,Q.jsx)(k,{value:Y,children:v()}),l.map(e=>(0,Q.jsx)(k,{value:e,children:_n(e)},e))]})]}),(0,Q.jsxs)(A,{value:n.instance,onValueChange:e=>r(t=>({...t,instance:e})),children:[(0,Q.jsx)(D,{size:`sm`,className:`w-40`,children:(0,Q.jsx)(M,{placeholder:a()})}),(0,Q.jsxs)(j,{children:[(0,Q.jsx)(k,{value:Y,children:v()}),u.map(e=>(0,Q.jsx)(k,{value:e.name,children:e.label},e.name))]})]}),(0,Q.jsxs)(A,{value:n.version,onValueChange:e=>r(t=>({...t,version:e})),children:[(0,Q.jsx)(D,{size:`sm`,className:`w-36`,children:(0,Q.jsx)(M,{placeholder:Je()})}),(0,Q.jsxs)(j,{children:[(0,Q.jsx)(k,{value:Y,children:v()}),f.map(e=>(0,Q.jsx)(k,{value:e,children:e},e))]})]})]}),m.length===0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:fe()}):(0,Q.jsxs)(V,{className:`oc-conn__table`,children:[(0,Q.jsx)(Gt,{children:(0,Q.jsxs)(z,{children:[(0,Q.jsx)($,{label:d(),sortKey:`target`,sort:i,onSort:h}),(0,Q.jsx)($,{label:p(),sortKey:`state`,sort:i,onSort:h}),(0,Q.jsx)($,{label:Se(),sortKey:`instance`,sort:i,onSort:h}),(0,Q.jsx)($,{label:lt(),sortKey:`host`,sort:i,onSort:h}),(0,Q.jsx)($,{label:c(),sortKey:`version`,sort:i,onSort:h}),(0,Q.jsx)(L,{children:ye()}),(0,Q.jsx)($,{label:ft(),sortKey:`lastOk`,sort:i,onSort:h})]})}),(0,Q.jsx)(R,{children:m.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)(L,{"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:m({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:[pe({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`?x():e===`error`?w():C()}function vn({state:e}){return e===`connected`?(0,Q.jsx)(O,{variant:`secondary`,children:x()}):e===`error`?(0,Q.jsx)(O,{variant:`destructive`,children:w()}):(0,Q.jsx)(O,{variant:`outline`,children:C()})}function yn(){return b(S.bridgeHealth.getBridgeHealth,{})}function bn(){let e=yn(),t=b(S.compat.getBridgeCompat,{}),n=b(S.me.getMe,{host:Lt})?.role===`admin`,r=b(S.admin.listInstances,n?{}:`skip`),i=b(S.agents.usageForInstances,n?{}:`skip`),a=kt(),o=()=>void a({to:`/settings/anomalies`,search:{status:`open`}}),s=an(e?e.targets:[],t?t.targets:[],r??[]),{section:c}=At({from:`/settings/bridge`}),l=kt({from:`/settings/bridge`}),u=t?.compat??null,d=t===void 0?`loading`:t===null?`nodata`:`ready`,f=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:Qe()}),i&&i.length>0?(0,Q.jsxs)(`section`,{className:`oc-bridge__usage`,children:[(0,Q.jsx)(`h3`,{className:`oc-bridge__usage-title`,children:ot()}),(0,Q.jsxs)(V,{children:[(0,Q.jsx)(Gt,{children:(0,Q.jsxs)(z,{children:[(0,Q.jsx)(L,{children:nt()}),(0,Q.jsx)(L,{children:oe()}),(0,Q.jsx)(L,{children:g()}),(0,Q.jsx)(L,{children:Oe()}),(0,Q.jsx)(L,{children:we()})]})}),(0,Q.jsx)(R,{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)(O,{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)(zt,{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,f?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:Ie()}):null]})}function xn({health:e,compat:t,onSeeAnomalies:n}){let r=t!=null&&t.buildVersion!=null&&t.bridgeVersion!=null&&t.buildVersion!==t.bridgeVersion,a=t?.buildRevision&&t.buildRevision!==`unknown`?t.buildRevision.slice(0,7):null,s=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)}),a?(0,Q.jsxs)(Q.Fragment,{children:[` `,(0,Q.jsxs)(`code`,{className:`oc-traces__mono`,title:Ge(),children:[`(`,a,`)`]})]}):null,r?(0,Q.jsxs)(`strong`,{className:`oc-bridge-card__mismatch`,children:[` `,i({build:t.buildVersion??`?`})]}):null,` · `,qe(),` `,(0,Q.jsx)(`code`,{className:`oc-traces__mono`,children:t.protocolVersion===null?y():String(t.protocolVersion)})]}):null;if(e===void 0)return(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:rt()});if(e===null)return(0,Q.jsx)(`div`,{className:`oc-bridge-card oc-bridge-card--idle`,children:se()});let c=Qt(e.targets),l=!e.reachable,u=en(e),d=e.unreachableInstances??[],f=u===`ok`?`ok`:u===`gateways_unreachable`?`warn`:`error`,p=Pt(e.checkedAt),m=e.startedAt==null?null:Pt(e.startedAt);return(0,Q.jsxs)(`div`,{className:`oc-bridge-card oc-bridge-card--${f}`,children:[(0,Q.jsx)(`div`,{className:`oc-bridge-card__icon`,"aria-hidden":!0,children:u===`ok`?(0,Q.jsx)(P,{size:22}):l||u===`gateways_unreachable`?(0,Q.jsx)(Zt,{size:22}):(0,Q.jsx)(N,{size:22})}),(0,Q.jsxs)(`div`,{className:`oc-bridge-card__body`,children:[(0,Q.jsx)(`div`,{className:`oc-bridge-card__title`,children:u===`ok`?_():u===`gateways_unreachable`?Ee({count:d.length}):l?ke():Te({count:c.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}),` `,te({time:p})]}),m?(0,Q.jsx)(`span`,{children:mt({time:m})}):null,s]}),u===`gateways_unreachable`?(0,Q.jsx)(`p`,{className:`oc-bridge-card__hint`,children:o({names:d.join(`, `)})}):null,l?(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:_e()})]})}function Sn({providerKey:e,connections:t,instances:n,manifest:r,compatStatus:i,compatReachable:a,protocol:o}){let s=r?Jt(r,e):null,c=new Map;for(let e of n)c.set(e.name,e.displayName??e.name);let l=[],u=new Set;for(let n of t){if(!n.instanceName||u.has(n.instanceName))continue;u.add(n.instanceName);let t=n.gatewayVersion??null;l.push({instanceName:n.instanceName,displayName:c.get(n.instanceName)??n.instanceName,version:t,state:Yt(t,e,r)})}let d=l.map(e=>e.state),f=d.includes(`beyond`)?`beyond`:d.length>0&&d.every(e=>e===`supported`)?`supported`:null,[p,m]=(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)(zt,{size:15,"aria-hidden":!0,className:`oc-bridge-provider__icon`}),(0,Q.jsx)(`span`,{className:`oc-bridge-provider__name`,children:J(e)}),f?(0,Q.jsx)(O,{variant:f===`beyond`?`destructive`:`secondary`,children:W(f)}):null]}),(0,Q.jsx)(`h4`,{className:`oc-bridge-provider__sub`,children:ue()}),(0,Q.jsx)(wn,{providerName:J(e),support:s,compatStatus:i,compatReachable:a,manifest:r,instanceRows:l}),o?(0,Q.jsx)(Cn,{protocol:o}):null,(0,Q.jsxs)(`button`,{type:`button`,className:`oc-bridge-provider__sub oc-bridge-provider__sub--toggle`,"aria-expanded":p,onClick:()=>m(e=>!e),children:[p?(0,Q.jsx)(T,{size:13,"aria-hidden":!0}):(0,Q.jsx)(jt,{size:13,"aria-hidden":!0}),ce({count:t.length})]}),p?(0,Q.jsx)(hn,{connections:t,displayByInstance:c}):null]})}function Cn({protocol:e}){let[t,n]=(0,K.useState)(!1),i=e.coverage,a=e.drift??[],o=(e.driftOverflow??0)+(e.driftTruncated??0);return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`h4`,{className:`oc-bridge-provider__sub`,children:[Be(),a.length>0?(0,Q.jsx)(O,{variant:`destructive`,children:he({count:a.length})}):o>0?(0,Q.jsx)(O,{variant:`destructive`,children:Fe()}):(0,Q.jsx)(O,{variant:`secondary`,children:r()})]}),(0,Q.jsxs)(`p`,{className:`oc-admin__hint`,children:[je({version:e.vendoredVersion}),i?` · `+Ne({handled:i.handled,ignored:i.ignored,gaps:i.gaps}):null]}),o>0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:Xe({overflow:e.driftOverflow??0,truncated:e.driftTruncated??0})}):null,a.length>0?(0,Q.jsx)(`ul`,{className:`oc-bridge-protocol__list`,role:`list`,children:a.map(e=>(0,Q.jsxs)(`li`,{children:[(0,Q.jsx)(`code`,{className:`oc-traces__mono`,children:e.shape}),` × `,e.count]},e.shape))}):null,i&&i.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)(jt,{size:13,"aria-hidden":!0}),ie({count:i.gapList.length})]}),t?(0,Q.jsx)(`ul`,{className:`oc-bridge-protocol__list`,role:`list`,children:i.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:rt()}):t===`nodata`?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:le()}):(0,Q.jsxs)(`div`,{className:`oc-compat`,children:[n?null:(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:u()}),r===null?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:f()}):(0,Q.jsxs)(`div`,{className:`oc-compat__support`,children:[(0,Q.jsx)(`span`,{className:`oc-compat__label`,children:Ae({provider:a})}),e&&e.range!==null?(0,Q.jsx)(`span`,{children:xe({min:e.range.min,max:e.range.maxValidated})}):(0,Q.jsx)(`span`,{children:y()}),e?(0,Q.jsx)(On,{versions:e.validatedVersions}):null]}),i.length===0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:dt()}):(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)(O,{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)(Nt,{children:[(0,Q.jsx)(It,{children:me({instance:e.displayName??e.name})}),(0,Q.jsx)(Rt,{children:Pe()})]}),(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)(P,{"aria-hidden":!0}):(0,Q.jsx)(N,{"aria-hidden":!0}),(0,Q.jsxs)(`span`,{children:[e,` — `,t.ok?$e():t.detail]})]}):(0,Q.jsxs)(`p`,{className:`oc-bridge-config__check-row oc-bridge-config__check-row--skip`,children:[e,` — `,Le()]}):null}function Dn({instance:e,onClose:t}){let n=ut(S.admin.upsertInstanceConfig),r=be(S.bridge.validateMediaPaths),i=Dt(),a=Wt(e.config?.contentLocale,void 0),[o,s]=(0,K.useState)(()=>_t(e.config??{},a)),[c,l]=(0,K.useState)(!1),[u,d]=(0,K.useState)(!1),[f,p]=(0,K.useState)(null),m=o.inboundMediaMode===`shared-fs`,g=o.mediaMode===`shared-fs`,_=m||g;async function te(){d(!0),p(null);try{p(await r({instanceName:e.name,inboundMediaMode:o.inboundMediaMode,mediaMode:o.mediaMode}))}catch(e){i.error(st(),e)}finally{d(!1)}}async function ne(){l(!0);try{let r=e.config??{};await n({instanceId:e._id,config:yt(o,r,a)}),t()}catch(e){i.error(De(),e)}finally{l(!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:Me(),help:Ce()}),(0,Q.jsxs)(A,{value:o.mediaMode,onValueChange:e=>s({...o,mediaMode:e}),children:[(0,Q.jsx)(D,{size:`sm`,className:`w-full`,children:(0,Q.jsx)(M,{})}),(0,Q.jsx)(j,{children:bt.map(e=>(0,Q.jsx)(k,{value:e,children:e},e))})]})]}),(0,Q.jsxs)(`label`,{className:`oc-field`,children:[(0,Q.jsx)(E,{label:re(),help:ee()}),(0,Q.jsxs)(A,{value:o.inboundMediaMode,onValueChange:e=>s({...o,inboundMediaMode:e}),children:[(0,Q.jsx)(D,{size:`sm`,className:`w-full`,children:(0,Q.jsx)(M,{})}),(0,Q.jsx)(j,{children:vt.map(e=>(0,Q.jsx)(k,{value:e,children:e},e))})]})]}),(0,Q.jsxs)(`label`,{className:`oc-field`,children:[(0,Q.jsx)(E,{label:tt(),help:pt()}),(0,Q.jsx)(F,{type:`number`,min:1,max:4096,className:`w-full`,value:o.mediaMaxMb,onChange:e=>s({...o,mediaMaxMb:Math.trunc(Number(e.target.value)||0)})})]})]}),_&&(0,Q.jsxs)(`div`,{className:`oc-bridge-config__grid`,children:[m&&(0,Q.jsxs)(`label`,{className:`oc-field`,children:[(0,Q.jsx)(E,{label:He(),help:Ue()}),(0,Q.jsx)(F,{className:`w-full`,spellCheck:!1,value:o.inboundAgentMount,onChange:e=>s({...o,inboundAgentMount:e.target.value})})]}),g&&(0,Q.jsxs)(`label`,{className:`oc-field`,children:[(0,Q.jsx)(E,{label:Ze(),help:et()}),(0,Q.jsx)(F,{className:`w-full`,spellCheck:!1,value:o.outboundAgentMount,onChange:e=>s({...o,outboundAgentMount:e.target.value})})]})]}),(0,Q.jsxs)(`label`,{className:`oc-field--row`,children:[(0,Q.jsx)(Vt,{checked:o.rehydration,onCheckedChange:e=>s({...o,rehydration:e===!0})}),(0,Q.jsx)(E,{label:ae(),help:ge()})]}),_&&f!==null&&(0,Q.jsx)(`div`,{className:`oc-bridge-config__check`,children:f.reachable?!f.inbound&&!f.outbound?(0,Q.jsxs)(`p`,{className:`oc-bridge-config__check-row oc-bridge-config__check-row--err`,children:[(0,Q.jsx)(N,{"aria-hidden":!0}),it({reason:f.reason??`?`})]}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(En,{label:Re(),result:f.inbound}),(0,Q.jsx)(En,{label:at(),result:f.outbound}),(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:Ye()})]}):(0,Q.jsxs)(`p`,{className:`oc-bridge-config__check-row oc-bridge-config__check-row--err`,children:[(0,Q.jsx)(N,{"aria-hidden":!0}),We()]})}),(0,Q.jsxs)(`div`,{className:`oc-bridge-config__actions`,children:[_&&(0,Q.jsxs)(Tt,{variant:`outline`,size:`sm`,onClick:()=>void te(),disabled:u,children:[u?(0,Q.jsx)(Ht,{className:`size-4 animate-spin`,"aria-hidden":!0}):null,u?ze():Ve()]}),(0,Q.jsx)(Tt,{size:`sm`,onClick:()=>void ne(),disabled:c,children:h()})]})]})})}function On({versions:e}){if(e.length===0)return null;let t=[...e].reverse();return(0,Q.jsxs)(Mt,{children:[(0,Q.jsx)(Et,{asChild:!0,children:(0,Q.jsxs)(`button`,{type:`button`,className:`oc-compat__versions-btn`,children:[e.length===1?ct():s({count:e.length}),(0,Q.jsx)(T,{size:13,"aria-hidden":!0})]})}),(0,Q.jsxs)(Ut,{className:`oc-compat__versions-pop`,align:`start`,children:[(0,Q.jsx)(`p`,{className:`oc-compat__versions-title`,children:ve()}),(0,Q.jsx)(`div`,{className:`oc-compat__versions-list`,children:t.map(e=>(0,Q.jsx)(O,{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{$y as r,Au as i,Ay as a,By as o,Cu as s,Cy as c,D as l,Du as u,Dy as d,Eu as f,Ey as p,Fy as m,Gb as h,Gr as g,Gy as _,Hb as ee,Hy as te,Iy as ne,Jb as re,Jy as ie,Kb as ae,Kr as oe,Ky as se,Ly as ce,Mu as le,My as v,Nu as ue,Ny as de,Ou as y,Oy as fe,Py as pe,Qb as me,Qy as he,Rb as ge,Ry as _e,Su as ve,Sy as ye,Sz as be,Tu as xe,Ty as Se,Tz as b,Ub as Ce,Ur as we,Uy as Te,Vy as Ee,Wb as De,Wr as Oe,Wy as ke,Xr as Ae,Xy as je,Yb as Me,Yy as Ne,Zb as Pe,Zy as Fe,_u as Ie,ab as Le,by as x,cb as Re,db as ze,eb as Be,fb as Ve,gb as He,hb as Ue,ib as We,ju as Ge,jy as Ke,ku as qe,ky as Je,lb as Ye,lt as Xe,mb as Ze,nb as Qe,ob as $e,pb as et,qb as tt,qr as nt,qy as rt,rb as it,sb as at,t as S,tb as ot,ub as st,vy as C,wu as ct,wy as lt,wz as ut,xu as dt,xy as ft,yy as w,zb as pt,zy as mt}from"./api-CMppRsht.js";import{r as T}from"./dist-CNchpxsr.js";import{t as ht}from"./chevron-up-Od7h9avP.js";import{t as gt}from"./chevrons-up-down-DJIIcTyy.js";import{i as _t,n as E,o as vt,r as yt,s as bt}from"./FieldLabel-8IB11dM6.js";import{i as xt,n as St,r as Ct,t as wt}from"./tabs-BPsz_527.js";import{t as Tt}from"./button-IhgT55aN.js";import{$ as D,Bt as Et,Dt,Et as O,F as Ot,Fn as kt,In as At,Mn as jt,Q as k,Rt as Mt,X as A,Z as j,at as Nt,ct as Pt,et as M,in as N,jn as P,jt as F,lt as I,nt as Ft,ot as It,q as Lt,rt as Rt,sn as zt,tt as Bt,ut as Vt,xn as Ht,zt as Ut}from"./index-C3dl90Xw.js";import{r as Wt}from"./locales-CPjguROj.js";import{a as Gt,i as L,n as R,o as z,r as B,t as V}from"./table-E4WVxNnB.js";import{t as Kt}from"./FilterBar-CnjTuIOw.js";import{a as H,n as qt,o as U,r as W,s as Jt,t as Yt}from"./compatView-ok0H4ab7.js";import{t as G}from"./dispatchErrorInfo-BvZIc7oP.js";var Xt=l(`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=l(`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),[i,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]),l=(0,K.useMemo)(()=>fn(s),[s]),u=(0,K.useMemo)(()=>pn(s),[s]),f=(0,K.useMemo)(()=>mn(s),[s]),m=(0,K.useMemo)(()=>dn(cn(s,n),i),[s,n,i]);function h(e){o(t=>t?.key===e?t.dir===`asc`?{key:e,dir:`desc`}:null:{key:e,dir:`asc`})}return e.length===0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:ne()}):(0,Q.jsxs)(`div`,{className:`oc-conn`,children:[(0,Q.jsxs)(Kt,{q:n.q,onQChange:e=>r(t=>({...t,q:e})),searchPlaceholder:de(),onReset:()=>r(on),canReset:sn(n),children:[(0,Q.jsxs)(A,{value:n.state,onValueChange:e=>r(t=>({...t,state:e})),children:[(0,Q.jsx)(D,{size:`sm`,className:`w-36`,children:(0,Q.jsx)(M,{placeholder:Ke()})}),(0,Q.jsxs)(j,{children:[(0,Q.jsx)(k,{value:Y,children:v()}),l.map(e=>(0,Q.jsx)(k,{value:e,children:_n(e)},e))]})]}),(0,Q.jsxs)(A,{value:n.instance,onValueChange:e=>r(t=>({...t,instance:e})),children:[(0,Q.jsx)(D,{size:`sm`,className:`w-40`,children:(0,Q.jsx)(M,{placeholder:a()})}),(0,Q.jsxs)(j,{children:[(0,Q.jsx)(k,{value:Y,children:v()}),u.map(e=>(0,Q.jsx)(k,{value:e.name,children:e.label},e.name))]})]}),(0,Q.jsxs)(A,{value:n.version,onValueChange:e=>r(t=>({...t,version:e})),children:[(0,Q.jsx)(D,{size:`sm`,className:`w-36`,children:(0,Q.jsx)(M,{placeholder:Je()})}),(0,Q.jsxs)(j,{children:[(0,Q.jsx)(k,{value:Y,children:v()}),f.map(e=>(0,Q.jsx)(k,{value:e,children:e},e))]})]})]}),m.length===0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:fe()}):(0,Q.jsxs)(V,{className:`oc-conn__table`,children:[(0,Q.jsx)(Gt,{children:(0,Q.jsxs)(z,{children:[(0,Q.jsx)($,{label:d(),sortKey:`target`,sort:i,onSort:h}),(0,Q.jsx)($,{label:p(),sortKey:`state`,sort:i,onSort:h}),(0,Q.jsx)($,{label:Se(),sortKey:`instance`,sort:i,onSort:h}),(0,Q.jsx)($,{label:lt(),sortKey:`host`,sort:i,onSort:h}),(0,Q.jsx)($,{label:c(),sortKey:`version`,sort:i,onSort:h}),(0,Q.jsx)(L,{children:ye()}),(0,Q.jsx)($,{label:ft(),sortKey:`lastOk`,sort:i,onSort:h})]})}),(0,Q.jsx)(R,{children:m.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)(L,{"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:m({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:[pe({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`?x():e===`error`?w():C()}function vn({state:e}){return e===`connected`?(0,Q.jsx)(O,{variant:`secondary`,children:x()}):e===`error`?(0,Q.jsx)(O,{variant:`destructive`,children:w()}):(0,Q.jsx)(O,{variant:`outline`,children:C()})}function yn(){return b(S.bridgeHealth.getBridgeHealth,{})}function bn(){let e=yn(),t=b(S.compat.getBridgeCompat,{}),n=b(S.me.getMe,{host:Lt})?.role===`admin`,r=b(S.admin.listInstances,n?{}:`skip`),i=b(S.agents.usageForInstances,n?{}:`skip`),a=kt(),o=()=>void a({to:`/settings/anomalies`,search:{status:`open`}}),s=an(e?e.targets:[],t?t.targets:[],r??[]),{section:c}=At({from:`/settings/bridge`}),l=kt({from:`/settings/bridge`}),u=t?.compat??null,d=t===void 0?`loading`:t===null?`nodata`:`ready`,f=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:Qe()}),i&&i.length>0?(0,Q.jsxs)(`section`,{className:`oc-bridge__usage`,children:[(0,Q.jsx)(`h3`,{className:`oc-bridge__usage-title`,children:ot()}),(0,Q.jsxs)(V,{children:[(0,Q.jsx)(Gt,{children:(0,Q.jsxs)(z,{children:[(0,Q.jsx)(L,{children:nt()}),(0,Q.jsx)(L,{children:oe()}),(0,Q.jsx)(L,{children:g()}),(0,Q.jsx)(L,{children:Oe()}),(0,Q.jsx)(L,{children:we()})]})}),(0,Q.jsx)(R,{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)(O,{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)(zt,{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,f?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:Ie()}):null]})}function xn({health:e,compat:t,onSeeAnomalies:n}){let r=t!=null&&t.buildVersion!=null&&t.bridgeVersion!=null&&t.buildVersion!==t.bridgeVersion,a=t?.buildRevision&&t.buildRevision!==`unknown`?t.buildRevision.slice(0,7):null,s=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)}),a?(0,Q.jsxs)(Q.Fragment,{children:[` `,(0,Q.jsxs)(`code`,{className:`oc-traces__mono`,title:Ge(),children:[`(`,a,`)`]})]}):null,r?(0,Q.jsxs)(`strong`,{className:`oc-bridge-card__mismatch`,children:[` `,i({build:t.buildVersion??`?`})]}):null,` · `,qe(),` `,(0,Q.jsx)(`code`,{className:`oc-traces__mono`,children:t.protocolVersion===null?y():String(t.protocolVersion)})]}):null;if(e===void 0)return(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:rt()});if(e===null)return(0,Q.jsx)(`div`,{className:`oc-bridge-card oc-bridge-card--idle`,children:se()});let c=Qt(e.targets),l=!e.reachable,u=en(e),d=e.unreachableInstances??[],f=u===`ok`?`ok`:u===`gateways_unreachable`?`warn`:`error`,p=Pt(e.checkedAt),m=e.startedAt==null?null:Pt(e.startedAt);return(0,Q.jsxs)(`div`,{className:`oc-bridge-card oc-bridge-card--${f}`,children:[(0,Q.jsx)(`div`,{className:`oc-bridge-card__icon`,"aria-hidden":!0,children:u===`ok`?(0,Q.jsx)(P,{size:22}):l||u===`gateways_unreachable`?(0,Q.jsx)(Zt,{size:22}):(0,Q.jsx)(N,{size:22})}),(0,Q.jsxs)(`div`,{className:`oc-bridge-card__body`,children:[(0,Q.jsx)(`div`,{className:`oc-bridge-card__title`,children:u===`ok`?_():u===`gateways_unreachable`?Ee({count:d.length}):l?ke():Te({count:c.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}),` `,te({time:p})]}),m?(0,Q.jsx)(`span`,{children:mt({time:m})}):null,s]}),u===`gateways_unreachable`?(0,Q.jsx)(`p`,{className:`oc-bridge-card__hint`,children:o({names:d.join(`, `)})}):null,l?(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:_e()})]})}function Sn({providerKey:e,connections:t,instances:n,manifest:r,compatStatus:i,compatReachable:a,protocol:o}){let s=r?Jt(r,e):null,c=new Map;for(let e of n)c.set(e.name,e.displayName??e.name);let l=[],u=new Set;for(let n of t){if(!n.instanceName||u.has(n.instanceName))continue;u.add(n.instanceName);let t=n.gatewayVersion??null;l.push({instanceName:n.instanceName,displayName:c.get(n.instanceName)??n.instanceName,version:t,state:Yt(t,e,r)})}let d=l.map(e=>e.state),f=d.includes(`beyond`)?`beyond`:d.length>0&&d.every(e=>e===`supported`)?`supported`:null,[p,m]=(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)(zt,{size:15,"aria-hidden":!0,className:`oc-bridge-provider__icon`}),(0,Q.jsx)(`span`,{className:`oc-bridge-provider__name`,children:J(e)}),f?(0,Q.jsx)(O,{variant:f===`beyond`?`destructive`:`secondary`,children:W(f)}):null]}),(0,Q.jsx)(`h4`,{className:`oc-bridge-provider__sub`,children:ue()}),(0,Q.jsx)(wn,{providerName:J(e),support:s,compatStatus:i,compatReachable:a,manifest:r,instanceRows:l}),o?(0,Q.jsx)(Cn,{protocol:o}):null,(0,Q.jsxs)(`button`,{type:`button`,className:`oc-bridge-provider__sub oc-bridge-provider__sub--toggle`,"aria-expanded":p,onClick:()=>m(e=>!e),children:[p?(0,Q.jsx)(T,{size:13,"aria-hidden":!0}):(0,Q.jsx)(jt,{size:13,"aria-hidden":!0}),ce({count:t.length})]}),p?(0,Q.jsx)(hn,{connections:t,displayByInstance:c}):null]})}function Cn({protocol:e}){let[t,n]=(0,K.useState)(!1),i=e.coverage,a=e.drift??[],o=(e.driftOverflow??0)+(e.driftTruncated??0);return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`h4`,{className:`oc-bridge-provider__sub`,children:[Be(),a.length>0?(0,Q.jsx)(O,{variant:`destructive`,children:he({count:a.length})}):o>0?(0,Q.jsx)(O,{variant:`destructive`,children:Fe()}):(0,Q.jsx)(O,{variant:`secondary`,children:r()})]}),(0,Q.jsxs)(`p`,{className:`oc-admin__hint`,children:[je({version:e.vendoredVersion}),i?` · `+Ne({handled:i.handled,ignored:i.ignored,gaps:i.gaps}):null]}),o>0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:Xe({overflow:e.driftOverflow??0,truncated:e.driftTruncated??0})}):null,a.length>0?(0,Q.jsx)(`ul`,{className:`oc-bridge-protocol__list`,role:`list`,children:a.map(e=>(0,Q.jsxs)(`li`,{children:[(0,Q.jsx)(`code`,{className:`oc-traces__mono`,children:e.shape}),` × `,e.count]},e.shape))}):null,i&&i.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)(jt,{size:13,"aria-hidden":!0}),ie({count:i.gapList.length})]}),t?(0,Q.jsx)(`ul`,{className:`oc-bridge-protocol__list`,role:`list`,children:i.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:rt()}):t===`nodata`?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:le()}):(0,Q.jsxs)(`div`,{className:`oc-compat`,children:[n?null:(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:u()}),r===null?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:f()}):(0,Q.jsxs)(`div`,{className:`oc-compat__support`,children:[(0,Q.jsx)(`span`,{className:`oc-compat__label`,children:Ae({provider:a})}),e&&e.range!==null?(0,Q.jsx)(`span`,{children:xe({min:e.range.min,max:e.range.maxValidated})}):(0,Q.jsx)(`span`,{children:y()}),e?(0,Q.jsx)(On,{versions:e.validatedVersions}):null]}),i.length===0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:dt()}):(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)(O,{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)(Nt,{children:[(0,Q.jsx)(It,{children:me({instance:e.displayName??e.name})}),(0,Q.jsx)(Rt,{children:Pe()})]}),(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)(P,{"aria-hidden":!0}):(0,Q.jsx)(N,{"aria-hidden":!0}),(0,Q.jsxs)(`span`,{children:[e,` — `,t.ok?$e():t.detail]})]}):(0,Q.jsxs)(`p`,{className:`oc-bridge-config__check-row oc-bridge-config__check-row--skip`,children:[e,` — `,Le()]}):null}function Dn({instance:e,onClose:t}){let n=ut(S.admin.upsertInstanceConfig),r=be(S.bridge.validateMediaPaths),i=Dt(),a=Wt(e.config?.contentLocale,void 0),[o,s]=(0,K.useState)(()=>_t(e.config??{},a)),[c,l]=(0,K.useState)(!1),[u,d]=(0,K.useState)(!1),[f,p]=(0,K.useState)(null),m=o.inboundMediaMode===`shared-fs`,g=o.mediaMode===`shared-fs`,_=m||g;async function te(){d(!0),p(null);try{p(await r({instanceName:e.name,inboundMediaMode:o.inboundMediaMode,mediaMode:o.mediaMode}))}catch(e){i.error(st(),e)}finally{d(!1)}}async function ne(){l(!0);try{let r=e.config??{};await n({instanceId:e._id,config:yt(o,r,a)}),t()}catch(e){i.error(De(),e)}finally{l(!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:Me(),help:Ce()}),(0,Q.jsxs)(A,{value:o.mediaMode,onValueChange:e=>s({...o,mediaMode:e}),children:[(0,Q.jsx)(D,{size:`sm`,className:`w-full`,children:(0,Q.jsx)(M,{})}),(0,Q.jsx)(j,{children:bt.map(e=>(0,Q.jsx)(k,{value:e,children:e},e))})]})]}),(0,Q.jsxs)(`label`,{className:`oc-field`,children:[(0,Q.jsx)(E,{label:re(),help:ee()}),(0,Q.jsxs)(A,{value:o.inboundMediaMode,onValueChange:e=>s({...o,inboundMediaMode:e}),children:[(0,Q.jsx)(D,{size:`sm`,className:`w-full`,children:(0,Q.jsx)(M,{})}),(0,Q.jsx)(j,{children:vt.map(e=>(0,Q.jsx)(k,{value:e,children:e},e))})]})]}),(0,Q.jsxs)(`label`,{className:`oc-field`,children:[(0,Q.jsx)(E,{label:tt(),help:pt()}),(0,Q.jsx)(F,{type:`number`,min:1,max:4096,className:`w-full`,value:o.mediaMaxMb,onChange:e=>s({...o,mediaMaxMb:Math.trunc(Number(e.target.value)||0)})})]})]}),_&&(0,Q.jsxs)(`div`,{className:`oc-bridge-config__grid`,children:[m&&(0,Q.jsxs)(`label`,{className:`oc-field`,children:[(0,Q.jsx)(E,{label:He(),help:Ue()}),(0,Q.jsx)(F,{className:`w-full`,spellCheck:!1,value:o.inboundAgentMount,onChange:e=>s({...o,inboundAgentMount:e.target.value})})]}),g&&(0,Q.jsxs)(`label`,{className:`oc-field`,children:[(0,Q.jsx)(E,{label:Ze(),help:et()}),(0,Q.jsx)(F,{className:`w-full`,spellCheck:!1,value:o.outboundAgentMount,onChange:e=>s({...o,outboundAgentMount:e.target.value})})]})]}),(0,Q.jsxs)(`label`,{className:`oc-field--row`,children:[(0,Q.jsx)(Vt,{checked:o.rehydration,onCheckedChange:e=>s({...o,rehydration:e===!0})}),(0,Q.jsx)(E,{label:ae(),help:ge()})]}),_&&f!==null&&(0,Q.jsx)(`div`,{className:`oc-bridge-config__check`,children:f.reachable?!f.inbound&&!f.outbound?(0,Q.jsxs)(`p`,{className:`oc-bridge-config__check-row oc-bridge-config__check-row--err`,children:[(0,Q.jsx)(N,{"aria-hidden":!0}),it({reason:f.reason??`?`})]}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(En,{label:Re(),result:f.inbound}),(0,Q.jsx)(En,{label:at(),result:f.outbound}),(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:Ye()})]}):(0,Q.jsxs)(`p`,{className:`oc-bridge-config__check-row oc-bridge-config__check-row--err`,children:[(0,Q.jsx)(N,{"aria-hidden":!0}),We()]})}),(0,Q.jsxs)(`div`,{className:`oc-bridge-config__actions`,children:[_&&(0,Q.jsxs)(Tt,{variant:`outline`,size:`sm`,onClick:()=>void te(),disabled:u,children:[u?(0,Q.jsx)(Ht,{className:`size-4 animate-spin`,"aria-hidden":!0}):null,u?ze():Ve()]}),(0,Q.jsx)(Tt,{size:`sm`,onClick:()=>void ne(),disabled:c,children:h()})]})]})})}function On({versions:e}){if(e.length===0)return null;let t=[...e].reverse();return(0,Q.jsxs)(Mt,{children:[(0,Q.jsx)(Et,{asChild:!0,children:(0,Q.jsxs)(`button`,{type:`button`,className:`oc-compat__versions-btn`,children:[e.length===1?ct():s({count:e.length}),(0,Q.jsx)(T,{size:13,"aria-hidden":!0})]})}),(0,Q.jsxs)(Ut,{className:`oc-compat__versions-pop`,align:`start`,children:[(0,Q.jsx)(`p`,{className:`oc-compat__versions-title`,children:ve()}),(0,Q.jsx)(`div`,{className:`oc-compat__versions-list`,children:t.map(e=>(0,Q.jsx)(O,{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{$d as r,Bu as i,Fu as a,Hu as o,Iu as s,Lu as c,Pu as l,Qd as u,Ru as d,Sz as f,Tz as p,Vu as m,Xb as h,Yr as g,af as _,as as v,cs as y,ds as b,fs as x,gz as S,is as C,ls as w,os as T,rf as E,rs as D,ss as O,t as k,us as A,vd as j,wz as M,zu as N}from"./api-CMppRsht.js";import{t as P}from"./button-IhgT55aN.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,in as U,jt as W,ut as G}from"./index-CFqHR0gi.js";import{i as K}from"./compatView-ok0H4ab7.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=M(k.admin.upsertInstanceConfig),n=p(k.agents.listAgentsForInstance,{instanceName:e.name}),r=typeof e.config?.converterAgentId==`string`?e.config.converterAgentId:``,[i,o]=(0,q.useState)(r),[c,u]=(0,q.useState)(`idle`);(0,q.useEffect)(()=>{o(r),u(`idle`)},[e._id,r]);let d=`__none__`,f=i!==r;async function m(){u(`saving`);try{let n={...e.config??{}};i===``||i===d?delete n.converterAgentId:n.converterAgentId=i,await t({instanceId:e._id,config:n}),u(`done`)}catch{u(`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:y()}),(0,X.jsxs)(`div`,{className:`oc-cdefaults__inline`,children:[(0,X.jsxs)(B,{value:i===``?d:i,onValueChange:e=>o(e===d?``: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:d,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:!f||c===`saving`,onClick:()=>void m(),children:c===`saving`?_():s()})]}),c===`done`?(0,X.jsx)(`p`,{className:`oc-admin__hint`,role:`status`,children:a()}):null,c===`error`?(0,X.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:l()}):null]})}function Q({instance:e}){let t=M(k.admin.upsertInstanceConfig),n=e.config?.curationEnabled===!0,r=typeof e.config?.curationBudgetChars==`number`?e.config.curationBudgetChars:null,[i,o]=(0,q.useState)(n),[c,u]=(0,q.useState)(r===null?``:String(r)),[d,f]=(0,q.useState)(`idle`);(0,q.useEffect)(()=>{o(n),u(r===null?``:String(r)),f(`idle`)},[e._id,n,r]);let p=c.trim(),m=p===``?null:/^\d+$/.test(p)?Number.parseInt(p,10):NaN,h=!i||m===null||Number.isInteger(m)&&m>=4e3&&m<=6e4,g=i!==n||(m??null)!==r;async function y(){f(`saving`);try{let n={...e.config??{}};n.curationEnabled=i,!i||m===null||Number.isNaN(m)?delete n.curationBudgetChars:n.curationBudgetChars=m,await t({instanceId:e._id,config:n}),f(`done`)}catch{f(`error`)}}return(0,X.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,X.jsxs)(`label`,{className:`oc-cdefaults__inline`,style:{cursor:`pointer`},children:[(0,X.jsx)(G,{checked:i,onCheckedChange:e=>o(e===!0),"aria-label":A()}),(0,X.jsx)(`span`,{className:`oc-cdefaults__label`,children:A()})]}),(0,X.jsxs)(`div`,{className:`oc-cdefaults__inline`,children:[(0,X.jsx)(W,{type:`number`,min:4e3,max:6e4,step:1e3,placeholder:`20000`,value:c,onChange:e=>u(e.target.value),className:`oc-cdefaults__number`,"aria-invalid":!h,"aria-label":T(),disabled:!i}),(0,X.jsx)(P,{size:`sm`,disabled:!g||!h||d===`saving`,onClick:()=>void y(),children:d===`saving`?_():s()})]}),h?null:(0,X.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:v()}),d===`done`?(0,X.jsx)(`p`,{className:`oc-admin__hint`,role:`status`,children:a()}):null,d===`error`?(0,X.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:l()}):null,(0,X.jsx)(`p`,{className:`oc-cdefaults__help`,children:C()})]})}function $({instance:e}){let t=M(k.admin.upsertInstanceConfig),n=typeof e.config?.summarizeThresholdChars==`number`?e.config.summarizeThresholdChars:null,[r,i]=(0,q.useState)(n===null?``:String(n)),[o,c]=(0,q.useState)(`idle`);(0,q.useEffect)(()=>{i(n===null?``:String(n)),c(`idle`)},[e._id,n]);let u=r.trim(),d=u===``?null:/^\d+$/.test(u)?Number.parseInt(u,10):NaN,f=d===null||Number.isInteger(d)&&d>=1e3&&d<=2e5,p=(d??null)!==n;async function m(){c(`saving`);try{let n={...e.config??{}};d===null?delete n.summarizeThresholdChars:n.summarizeThresholdChars=d,await t({instanceId:e._id,config:n}),c(`done`)}catch{c(`error`)}}return(0,X.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,X.jsx)(`span`,{className:`oc-cdefaults__label`,children:x()}),(0,X.jsxs)(`div`,{className:`oc-cdefaults__inline`,children:[(0,X.jsx)(W,{type:`number`,min:1e3,max:2e5,step:1e3,placeholder:`8000`,value:r,onChange:e=>i(e.target.value),className:`oc-cdefaults__number`,"aria-invalid":!f}),(0,X.jsx)(P,{size:`sm`,disabled:!p||!f||o===`saving`,onClick:()=>void m(),children:o===`saving`?_():s()})]}),f?null:(0,X.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:D()}),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:l()}):null,(0,X.jsx)(`p`,{className:`oc-cdefaults__help`,children:b()})]})}function ee(){let e=f(k.agentFiles.getChatDefaults),[t,n]=(0,q.useState)({status:`loading`}),a=p(k.admin.listInstances,{}),[s,l]=(0,q.useState)(null);(0,q.useEffect)(()=>{!a||a.length===0||(!s||!a.some(e=>e.name===s))&&l(a[0].name)},[a,s]);let _=(a?.length??0)>1,v=a!==void 0&&a.length===0,y=p(k.compat.forInstance,s?{instanceName:s}:`skip`),b=s?I(y,`configDefaults`):`loading`,x=b===`loading`?null:b.blocked,C=(0,q.useMemo)(()=>_&&s?{instanceName:s}:{},[_,s]),w=(0,q.useRef)(0),T=(0,q.useCallback)(async()=>{let t=++w.current;n({status:`loading`});try{let r=Y(await e(C));if(w.current!==t)return;n({status:`done`,current:r})}catch{if(w.current!==t)return;n({status:`error`})}},[e,C]);(0,q.useEffect)(()=>{x===!1&&(_&&!s||T())},[T,x,_,s]);let D=t.status===`done`?t.current:null,O=(0,q.useMemo)(()=>J.map(e=>({id:e,label:R(e)})),[]),A=(0,q.useMemo)(()=>[{id:`fast`,label:r()},{id:`standard`,label:u()}],[]);return(0,X.jsxs)(`div`,{className:`oc-cdefaults`,children:[(0,X.jsx)(`p`,{className:`oc-admin__hint`,children:o()}),_&&s?(0,X.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,X.jsx)(`span`,{className:`oc-cdefaults__label`,children:j()}),(0,X.jsxs)(B,{value:s,onValueChange:e=>l(e),children:[(0,X.jsx)(F,{size:`sm`,"aria-label":j(),children:(0,X.jsx)(H,{})}),(0,X.jsx)(V,{children:(a??[]).map(e=>(0,X.jsx)(z,{value:e.name,children:e.name},e.name))})]})]}):null,v?(0,X.jsx)(`p`,{className:`oc-admin__hint`,role:`status`,children:h()}):b===`loading`?(0,X.jsx)(`p`,{className:`oc-admin__hint`,children:S()}):b.blocked?(0,X.jsxs)(`p`,{className:`oc-compat__blocked`,role:`status`,children:[(0,X.jsx)(U,{size:14,"aria-hidden":!0}),` `,K(b.gatewayVersion,b.provider)]}):t.status===`loading`?(0,X.jsx)(`p`,{className:`oc-admin__hint`,children:S()}):t.status===`error`?(0,X.jsxs)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:[c(),` `,(0,X.jsx)(P,{variant:`outline`,size:`sm`,onClick:()=>void T(),children:E()})]}):(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,X.jsx)(`span`,{className:`oc-cdefaults__label`,children:m()}),(0,X.jsx)(L,{options:O,value:D?.thinkingDefault??null,onChange:()=>{},disabled:!0}),(0,X.jsx)(`p`,{className:`oc-cdefaults__help`,children:i()})]}),(0,X.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,X.jsx)(`span`,{className:`oc-cdefaults__label`,children:N()}),(0,X.jsx)(L,{options:A,value:D===null||D.fastModeDefault===null?null:D.fastModeDefault?`fast`:`standard`,onChange:()=>{},disabled:!0}),(0,X.jsx)(`p`,{className:`oc-cdefaults__help`,children:d()})]}),(0,X.jsx)(`p`,{className:`oc-cdefaults__note`,children:g()})]}),(()=>{let e=a?.find(e=>e.name===(s??a[0]?.name));return e?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)($,{instance:e}),(0,X.jsx)(Q,{instance:e}),(0,X.jsx)(Z,{instance:e})]}):null})()]})}export{ee as ChatDefaultsTab};
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$d as r,Bu as i,Fu as a,Hu as o,Iu as s,Lu as c,Pu as l,Qd as u,Ru as d,Sz as f,Tz as p,Vu as m,Xb as h,Yr as g,af as _,as as v,cs as y,ds as b,fs as x,gz as S,is as C,ls as w,os as T,rf as E,rs as D,ss as O,t as k,us as A,vd as j,wz as M,zu as N}from"./api-CMppRsht.js";import{t as P}from"./button-IhgT55aN.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,in as U,jt as W,ut as G}from"./index-C3dl90Xw.js";import{i as K}from"./compatView-ok0H4ab7.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=M(k.admin.upsertInstanceConfig),n=p(k.agents.listAgentsForInstance,{instanceName:e.name}),r=typeof e.config?.converterAgentId==`string`?e.config.converterAgentId:``,[i,o]=(0,q.useState)(r),[c,u]=(0,q.useState)(`idle`);(0,q.useEffect)(()=>{o(r),u(`idle`)},[e._id,r]);let d=`__none__`,f=i!==r;async function m(){u(`saving`);try{let n={...e.config??{}};i===``||i===d?delete n.converterAgentId:n.converterAgentId=i,await t({instanceId:e._id,config:n}),u(`done`)}catch{u(`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:y()}),(0,X.jsxs)(`div`,{className:`oc-cdefaults__inline`,children:[(0,X.jsxs)(B,{value:i===``?d:i,onValueChange:e=>o(e===d?``: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:d,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:!f||c===`saving`,onClick:()=>void m(),children:c===`saving`?_():s()})]}),c===`done`?(0,X.jsx)(`p`,{className:`oc-admin__hint`,role:`status`,children:a()}):null,c===`error`?(0,X.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:l()}):null]})}function Q({instance:e}){let t=M(k.admin.upsertInstanceConfig),n=e.config?.curationEnabled===!0,r=typeof e.config?.curationBudgetChars==`number`?e.config.curationBudgetChars:null,[i,o]=(0,q.useState)(n),[c,u]=(0,q.useState)(r===null?``:String(r)),[d,f]=(0,q.useState)(`idle`);(0,q.useEffect)(()=>{o(n),u(r===null?``:String(r)),f(`idle`)},[e._id,n,r]);let p=c.trim(),m=p===``?null:/^\d+$/.test(p)?Number.parseInt(p,10):NaN,h=!i||m===null||Number.isInteger(m)&&m>=4e3&&m<=6e4,g=i!==n||(m??null)!==r;async function y(){f(`saving`);try{let n={...e.config??{}};n.curationEnabled=i,!i||m===null||Number.isNaN(m)?delete n.curationBudgetChars:n.curationBudgetChars=m,await t({instanceId:e._id,config:n}),f(`done`)}catch{f(`error`)}}return(0,X.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,X.jsxs)(`label`,{className:`oc-cdefaults__inline`,style:{cursor:`pointer`},children:[(0,X.jsx)(G,{checked:i,onCheckedChange:e=>o(e===!0),"aria-label":A()}),(0,X.jsx)(`span`,{className:`oc-cdefaults__label`,children:A()})]}),(0,X.jsxs)(`div`,{className:`oc-cdefaults__inline`,children:[(0,X.jsx)(W,{type:`number`,min:4e3,max:6e4,step:1e3,placeholder:`20000`,value:c,onChange:e=>u(e.target.value),className:`oc-cdefaults__number`,"aria-invalid":!h,"aria-label":T(),disabled:!i}),(0,X.jsx)(P,{size:`sm`,disabled:!g||!h||d===`saving`,onClick:()=>void y(),children:d===`saving`?_():s()})]}),h?null:(0,X.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:v()}),d===`done`?(0,X.jsx)(`p`,{className:`oc-admin__hint`,role:`status`,children:a()}):null,d===`error`?(0,X.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:l()}):null,(0,X.jsx)(`p`,{className:`oc-cdefaults__help`,children:C()})]})}function $({instance:e}){let t=M(k.admin.upsertInstanceConfig),n=typeof e.config?.summarizeThresholdChars==`number`?e.config.summarizeThresholdChars:null,[r,i]=(0,q.useState)(n===null?``:String(n)),[o,c]=(0,q.useState)(`idle`);(0,q.useEffect)(()=>{i(n===null?``:String(n)),c(`idle`)},[e._id,n]);let u=r.trim(),d=u===``?null:/^\d+$/.test(u)?Number.parseInt(u,10):NaN,f=d===null||Number.isInteger(d)&&d>=1e3&&d<=2e5,p=(d??null)!==n;async function m(){c(`saving`);try{let n={...e.config??{}};d===null?delete n.summarizeThresholdChars:n.summarizeThresholdChars=d,await t({instanceId:e._id,config:n}),c(`done`)}catch{c(`error`)}}return(0,X.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,X.jsx)(`span`,{className:`oc-cdefaults__label`,children:x()}),(0,X.jsxs)(`div`,{className:`oc-cdefaults__inline`,children:[(0,X.jsx)(W,{type:`number`,min:1e3,max:2e5,step:1e3,placeholder:`8000`,value:r,onChange:e=>i(e.target.value),className:`oc-cdefaults__number`,"aria-invalid":!f}),(0,X.jsx)(P,{size:`sm`,disabled:!p||!f||o===`saving`,onClick:()=>void m(),children:o===`saving`?_():s()})]}),f?null:(0,X.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:D()}),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:l()}):null,(0,X.jsx)(`p`,{className:`oc-cdefaults__help`,children:b()})]})}function ee(){let e=f(k.agentFiles.getChatDefaults),[t,n]=(0,q.useState)({status:`loading`}),a=p(k.admin.listInstances,{}),[s,l]=(0,q.useState)(null);(0,q.useEffect)(()=>{!a||a.length===0||(!s||!a.some(e=>e.name===s))&&l(a[0].name)},[a,s]);let _=(a?.length??0)>1,v=a!==void 0&&a.length===0,y=p(k.compat.forInstance,s?{instanceName:s}:`skip`),b=s?I(y,`configDefaults`):`loading`,x=b===`loading`?null:b.blocked,C=(0,q.useMemo)(()=>_&&s?{instanceName:s}:{},[_,s]),w=(0,q.useRef)(0),T=(0,q.useCallback)(async()=>{let t=++w.current;n({status:`loading`});try{let r=Y(await e(C));if(w.current!==t)return;n({status:`done`,current:r})}catch{if(w.current!==t)return;n({status:`error`})}},[e,C]);(0,q.useEffect)(()=>{x===!1&&(_&&!s||T())},[T,x,_,s]);let D=t.status===`done`?t.current:null,O=(0,q.useMemo)(()=>J.map(e=>({id:e,label:R(e)})),[]),A=(0,q.useMemo)(()=>[{id:`fast`,label:r()},{id:`standard`,label:u()}],[]);return(0,X.jsxs)(`div`,{className:`oc-cdefaults`,children:[(0,X.jsx)(`p`,{className:`oc-admin__hint`,children:o()}),_&&s?(0,X.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,X.jsx)(`span`,{className:`oc-cdefaults__label`,children:j()}),(0,X.jsxs)(B,{value:s,onValueChange:e=>l(e),children:[(0,X.jsx)(F,{size:`sm`,"aria-label":j(),children:(0,X.jsx)(H,{})}),(0,X.jsx)(V,{children:(a??[]).map(e=>(0,X.jsx)(z,{value:e.name,children:e.name},e.name))})]})]}):null,v?(0,X.jsx)(`p`,{className:`oc-admin__hint`,role:`status`,children:h()}):b===`loading`?(0,X.jsx)(`p`,{className:`oc-admin__hint`,children:S()}):b.blocked?(0,X.jsxs)(`p`,{className:`oc-compat__blocked`,role:`status`,children:[(0,X.jsx)(U,{size:14,"aria-hidden":!0}),` `,K(b.gatewayVersion,b.provider)]}):t.status===`loading`?(0,X.jsx)(`p`,{className:`oc-admin__hint`,children:S()}):t.status===`error`?(0,X.jsxs)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:[c(),` `,(0,X.jsx)(P,{variant:`outline`,size:`sm`,onClick:()=>void T(),children:E()})]}):(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,X.jsx)(`span`,{className:`oc-cdefaults__label`,children:m()}),(0,X.jsx)(L,{options:O,value:D?.thinkingDefault??null,onChange:()=>{},disabled:!0}),(0,X.jsx)(`p`,{className:`oc-cdefaults__help`,children:i()})]}),(0,X.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,X.jsx)(`span`,{className:`oc-cdefaults__label`,children:N()}),(0,X.jsx)(L,{options:A,value:D===null||D.fastModeDefault===null?null:D.fastModeDefault?`fast`:`standard`,onChange:()=>{},disabled:!0}),(0,X.jsx)(`p`,{className:`oc-cdefaults__help`,children:d()})]}),(0,X.jsx)(`p`,{className:`oc-cdefaults__note`,children:g()})]}),(()=>{let e=a?.find(e=>e.name===(s??a[0]?.name));return e?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)($,{instance:e}),(0,X.jsx)(Q,{instance:e}),(0,X.jsx)(Z,{instance:e})]}):null})()]})}export{ee as ChatDefaultsTab};
@@ -1 +1 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{dh as r,fh as i,gh as a,hh as o,mh as s,ph as c,uh as l}from"./api-CMppRsht.js";import{r as u}from"./dist-CNchpxsr.js";import{t as d}from"./chevron-up-Od7h9avP.js";import{t as f}from"./chevrons-up-down-DJIIcTyy.js";import{t as p}from"./button-IhgT55aN.js";import{Dn as m,It as h,Lt as g,Mt as _,Nt as v,Pt as y,an as b,un as x,ut as S}from"./index-CFqHR0gi.js";import{a as C,i as w,n as T,o as E,r as D,t as O}from"./table-E4WVxNnB.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=o(),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:s()}):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":c(),checked:J?!0:Y?`indeterminate`:!1,onCheckedChange:X})}):null,n.map((e,t)=>{let n=V?.index===t;return e.sort?(0,M.jsx)(w,{className:e.className,"aria-sort":n?V.dir===`asc`?`ascending`:`descending`:`none`,children:(0,M.jsxs)(`button`,{type:`button`,className:`oc-dt__sort`,onClick:()=>K(t),"aria-label":l({column:e.header}),children:[e.header,n?V.dir===`asc`?(0,M.jsx)(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)??[],a=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":i(),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":r(),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]}),a&&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
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{dh as r,fh as i,gh as a,hh as o,mh as s,ph as c,uh as l}from"./api-CMppRsht.js";import{r as u}from"./dist-CNchpxsr.js";import{t as d}from"./chevron-up-Od7h9avP.js";import{t as f}from"./chevrons-up-down-DJIIcTyy.js";import{t as p}from"./button-IhgT55aN.js";import{Dn as m,It as h,Lt as g,Mt as _,Nt as v,Pt as y,an as b,un as x,ut as S}from"./index-C3dl90Xw.js";import{a as C,i as w,n as T,o as E,r as D,t as O}from"./table-E4WVxNnB.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=o(),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:s()}):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":c(),checked:J?!0:Y?`indeterminate`:!1,onCheckedChange:X})}):null,n.map((e,t)=>{let n=V?.index===t;return e.sort?(0,M.jsx)(w,{className:e.className,"aria-sort":n?V.dir===`asc`?`ascending`:`descending`:`none`,children:(0,M.jsxs)(`button`,{type:`button`,className:`oc-dt__sort`,onClick:()=>K(t),"aria-label":l({column:e.header}),children:[e.header,n?V.dir===`asc`?(0,M.jsx)(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)??[],a=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":i(),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":r(),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]}),a&&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-CFqHR0gi.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
+ import{r as e}from"./bundle-mjs-C73ZY4La.js";import{Et as t}from"./index-C3dl90Xw.js";var n=e();function r({icon:e,total:r,items:i}){if(r===0)return(0,n.jsxs)(t,{variant:`outline`,className:`oc-group-chip oc-group-chip--empty gap-1`,children:[e,`0`]});let a=r-i.length;return(0,n.jsxs)(`div`,{className:`oc-group-detail`,children:[i.map((e,r)=>(0,n.jsxs)(t,{variant:e.highlight?`secondary`:`outline`,className:`oc-group-chip gap-1`,title:e.label,children:[e.marker,(0,n.jsx)(`span`,{className:`oc-group-chip__txt`,children:e.label})]},r)),a>0?(0,n.jsxs)(t,{variant:`outline`,className:`oc-group-chip`,children:[`+`,a]}):null]})}export{r as t};
@@ -1 +1 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$D as r,AD as i,BD as a,CD as o,DD as s,ED as c,FD as l,GD as u,HD as d,ID as f,JD as p,KD as m,LD as h,MD as g,ND as _,OD as v,PD as y,QD as b,RD as ee,SD as te,TD as ne,Tz as re,UD as ie,VD as ae,WD as oe,XD as x,YD as S,ZD as C,_D as w,aO as T,bD as E,cO as D,dO as O,eO as k,fO as A,gD as j,gO as M,go as N,hD as P,hO as F,iO as I,jD as L,kD as R,lO as z,mD as B,mO as V,nO as H,oO as U,pO as W,qD as se,rO as G,sO as K,t as q,tO as ce,uO as le,vD as ue,vo as de,wD as fe,wz as J,xD as pe,yD as me,zD as he}from"./api-CMppRsht.js";import{t as ge}from"./button-IhgT55aN.js";import{U as _e,ct as Y}from"./index-CFqHR0gi.js";import{t as ve}from"./DataTableShell-hu5AF3BF.js";var X=t(e(),1),Z=n(),ye={altered_words:()=>M(),incorrect:()=>F(),incoherence:()=>V(),formatting:()=>W(),latency:()=>A(),api_error:()=>O(),other:()=>le()},Q=e=>ye[e]?.()??e;function $({matches:e,sourceWasOpen:t}){return t?e===!0?(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-ok`,children:D()}):e===!1?(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-warn`,children:K()}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill`,children:`—`}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill`,children:z()})}function be({data:e,reference:t,closeReason:n}){let i=e.snapshot,o=J(q.feedback.respondToFeedback),[s,c]=(0,X.useState)(e.thread),[l,f]=(0,X.useState)(``),[h,g]=(0,X.useState)(!1);async function _(){let t=l.trim();if(!(!t||h)){g(!0);try{await o({feedbackId:e._id,text:t}),c(e=>[...e,{authorRole:`admin`,text:t,at:Date.now()}]),f(``)}finally{g(!1)}}}let v=[];try{v=i.contextJson?JSON.parse(i.contextJson):[]}catch{v=[]}return(0,Z.jsxs)(`div`,{className:`oc-fbadmin__detail`,children:[(0,Z.jsxs)(`div`,{className:`oc-fbadmin__row`,children:[(0,Z.jsx)($,{matches:i.displayedMatchesStored,sourceWasOpen:i.clientInfo?.sourceWasOpen??!1}),(0,Z.jsxs)(`span`,{className:`oc-fbadmin__meta`,children:[Q(e.category),` · `,i.messageRole,i.isRegeneration?` · ${U()}`:``,i.openclawModel?` · ${i.openclawModel}`:``,i.openclawRuntime?` (${i.openclawRuntime})`:``]}),t?(0,Z.jsx)(`code`,{className:`oc-fbadmin__ref`,style:{userSelect:`all`,marginLeft:`auto`},title:y(),children:t}):null]}),e.comment?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:T()}),(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:E()}),(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:I()}),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`?G():e.authorRole===`agent`?e.authorLabel??de():H()}),(0,Z.jsx)(`span`,{className:`oc-notif__msg-text`,children:e.text})]},t))}):(0,Z.jsx)(`p`,{className:`oc-fbadmin__meta`,children:ce()}),(0,Z.jsx)(`textarea`,{className:`oc-feedback__textarea`,placeholder:k(),value:l,maxLength:2e3,rows:3,onChange:e=>f(e.target.value.slice(0,2e3))}),(0,Z.jsx)(`div`,{className:`oc-fbadmin__row`,style:{justifyContent:`flex-end`},children:(0,Z.jsx)(ge,{size:`sm`,onClick:()=>void _(),disabled:!l.trim()||h,children:h?r():b()})})]}),(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:C()}),(0,Z.jsx)(`pre`,{className:`oc-msg__source-pre`,children:i.messageText||x()})]}),i.clientInfo?.sourceWasOpen&&i.displayedText!==void 0?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:S()}),(0,Z.jsx)(`pre`,{className:`oc-msg__source-pre`,children:i.displayedText||x()})]}):null,i.promptText?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:p()}),(0,Z.jsx)(`pre`,{className:`oc-msg__source-pre`,children:i.promptText})]}):null,v.length>0?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:se({count:i.contextCount??v.length,truncated:i.contextTruncated?m():``})}),(0,Z.jsx)(`div`,{className:`oc-fbadmin__ctx`,children:v.map((e,t)=>(0,Z.jsxs)(`div`,{className:`oc-fbadmin__ctx-turn`,children:[(0,Z.jsx)(`span`,{className:`oc-fbadmin__ctx-role`,children:e.role}),(0,Z.jsx)(`span`,{className:`oc-fbadmin__ctx-text`,children:e.text})]},t))})]}):null,i.outboxAvailable?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:u()}),(0,Z.jsxs)(`pre`,{className:`oc-msg__source-pre`,children:[i.outboxText??``,i.outboxStatus?`\n[status: ${i.outboxStatus}]`:``]})]}):null,i.clientInfo?.extensionsDetected&&i.clientInfo.extensionsDetected.length>0?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:oe()}),(0,Z.jsx)(`div`,{className:`oc-fbadmin__row`,children:i.clientInfo.extensionsDetected.map(e=>(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-warn`,children:e},e))})]}):null,(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:ie()}),(0,Z.jsxs)(`p`,{className:`oc-fbadmin__env`,children:[[i.clientInfo?.language,i.clientInfo?.timezone,i.clientInfo?.theme?d({theme:i.clientInfo.theme}):null,i.runId?`run ${i.runId.slice(0,12)}…`:null].filter(Boolean).join(` · `)||`—`,i.clientInfo?.plugins&&i.clientInfo.plugins.length>0?(0,Z.jsxs)(`span`,{className:`oc-fbadmin__plugins`,children:[ae(),` `,i.clientInfo.plugins.join(`, `),(0,Z.jsxs)(`span`,{className:`oc-fbadmin__note`,children:[` `,a()]})]}):null,i.clientInfo?.userAgent?(0,Z.jsx)(`span`,{className:`oc-fbadmin__ua`,children:i.clientInfo.userAgent}):null]})]})]})}function xe(){let e=re(q.feedback.listForAdmin,{}),t=J(q.feedback.readSnapshot),n=J(q.feedback.deleteFeedback),r=_e(),[a,u]=(0,X.useState)(null),[d,p]=(0,X.useState)({});async function m(e){if(a===e._id){u(null);return}if(!d[e._id]){let n=await t({feedbackId:e._id});p(t=>({...t,[e._id]:n}))}u(e._id)}async function y(e){await r({title:j(),description:P(),confirmLabel:B(),destructive:!0})&&(await n({feedbackId:e._id}),a===e._id&&u(null))}return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`p`,{className:`oc-admin__hint`,children:[he(),` `,(0,Z.jsx)(`strong`,{children:ee()}),` `,h()]}),(0,Z.jsx)(ve,{title:f(),rows:e,emptyHint:l(),isExpanded:e=>a===e._id&&!!d[e._id],renderExpanded:e=>d[e._id]?(0,Z.jsx)(be,{data:d[e._id],reference:e.reference,closeReason:e.userCloseReason}):null,columns:[{header:_(),cell:e=>Y(e.at),sort:e=>e.at},{header:g(),cell:e=>Q(e.category),sort:e=>Q(e.category)},{header:L(),cell:e=>e.messageRole===`user`?i():R(),sort:e=>e.messageRole},{header:v(),cell:e=>(e.reporterEmail||e.reporterName||`—`)+(e.impersonated&&e.realOperatorEmail?` ${s({operator:e.realOperatorEmail})}`:``),sort:e=>e.reporterEmail||e.reporterName||null},{header:c(),cell:e=>(0,Z.jsx)($,{matches:e.displayedMatchesStored,sourceWasOpen:e.sourceWasOpen}),sort:e=>e.displayedMatchesStored===!1?0:e.displayedMatchesStored===!0?1:2},{header:ne(),cell:e=>e.hasComment?`✎`:`—`,sort:e=>+!!e.hasComment},{header:fe(),cell:e=>e.userClosedAt==null?e.resolvedAt==null?e.answered?(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-ok`,children:o()}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill`,children:te()}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-ok`,title:e.resolvedBy??void 0,children:N()}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-closed`,children:pe()}),sort:e=>e.userClosedAt==null?e.resolvedAt==null?+!!e.answered:2:3}],rowActions:e=>[{label:a===e._id?me():ue(),onSelect:()=>void m(e)},{label:w(),onSelect:()=>void y(e),variant:`destructive`}]})]})}export{xe as FeedbacksTab};
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$D as r,AD as i,BD as a,CD as o,DD as s,ED as c,FD as l,GD as u,HD as d,ID as f,JD as p,KD as m,LD as h,MD as g,ND as _,OD as v,PD as y,QD as b,RD as ee,SD as te,TD as ne,Tz as re,UD as ie,VD as ae,WD as oe,XD as x,YD as S,ZD as C,_D as w,aO as T,bD as E,cO as D,dO as O,eO as k,fO as A,gD as j,gO as M,go as N,hD as P,hO as F,iO as I,jD as L,kD as R,lO as z,mD as B,mO as V,nO as H,oO as U,pO as W,qD as se,rO as G,sO as K,t as q,tO as ce,uO as le,vD as ue,vo as de,wD as fe,wz as J,xD as pe,yD as me,zD as he}from"./api-CMppRsht.js";import{t as ge}from"./button-IhgT55aN.js";import{U as _e,ct as Y}from"./index-C3dl90Xw.js";import{t as ve}from"./DataTableShell-BInsTzwk.js";var X=t(e(),1),Z=n(),ye={altered_words:()=>M(),incorrect:()=>F(),incoherence:()=>V(),formatting:()=>W(),latency:()=>A(),api_error:()=>O(),other:()=>le()},Q=e=>ye[e]?.()??e;function $({matches:e,sourceWasOpen:t}){return t?e===!0?(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-ok`,children:D()}):e===!1?(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-warn`,children:K()}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill`,children:`—`}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill`,children:z()})}function be({data:e,reference:t,closeReason:n}){let i=e.snapshot,o=J(q.feedback.respondToFeedback),[s,c]=(0,X.useState)(e.thread),[l,f]=(0,X.useState)(``),[h,g]=(0,X.useState)(!1);async function _(){let t=l.trim();if(!(!t||h)){g(!0);try{await o({feedbackId:e._id,text:t}),c(e=>[...e,{authorRole:`admin`,text:t,at:Date.now()}]),f(``)}finally{g(!1)}}}let v=[];try{v=i.contextJson?JSON.parse(i.contextJson):[]}catch{v=[]}return(0,Z.jsxs)(`div`,{className:`oc-fbadmin__detail`,children:[(0,Z.jsxs)(`div`,{className:`oc-fbadmin__row`,children:[(0,Z.jsx)($,{matches:i.displayedMatchesStored,sourceWasOpen:i.clientInfo?.sourceWasOpen??!1}),(0,Z.jsxs)(`span`,{className:`oc-fbadmin__meta`,children:[Q(e.category),` · `,i.messageRole,i.isRegeneration?` · ${U()}`:``,i.openclawModel?` · ${i.openclawModel}`:``,i.openclawRuntime?` (${i.openclawRuntime})`:``]}),t?(0,Z.jsx)(`code`,{className:`oc-fbadmin__ref`,style:{userSelect:`all`,marginLeft:`auto`},title:y(),children:t}):null]}),e.comment?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:T()}),(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:E()}),(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:I()}),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`?G():e.authorRole===`agent`?e.authorLabel??de():H()}),(0,Z.jsx)(`span`,{className:`oc-notif__msg-text`,children:e.text})]},t))}):(0,Z.jsx)(`p`,{className:`oc-fbadmin__meta`,children:ce()}),(0,Z.jsx)(`textarea`,{className:`oc-feedback__textarea`,placeholder:k(),value:l,maxLength:2e3,rows:3,onChange:e=>f(e.target.value.slice(0,2e3))}),(0,Z.jsx)(`div`,{className:`oc-fbadmin__row`,style:{justifyContent:`flex-end`},children:(0,Z.jsx)(ge,{size:`sm`,onClick:()=>void _(),disabled:!l.trim()||h,children:h?r():b()})})]}),(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:C()}),(0,Z.jsx)(`pre`,{className:`oc-msg__source-pre`,children:i.messageText||x()})]}),i.clientInfo?.sourceWasOpen&&i.displayedText!==void 0?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:S()}),(0,Z.jsx)(`pre`,{className:`oc-msg__source-pre`,children:i.displayedText||x()})]}):null,i.promptText?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:p()}),(0,Z.jsx)(`pre`,{className:`oc-msg__source-pre`,children:i.promptText})]}):null,v.length>0?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:se({count:i.contextCount??v.length,truncated:i.contextTruncated?m():``})}),(0,Z.jsx)(`div`,{className:`oc-fbadmin__ctx`,children:v.map((e,t)=>(0,Z.jsxs)(`div`,{className:`oc-fbadmin__ctx-turn`,children:[(0,Z.jsx)(`span`,{className:`oc-fbadmin__ctx-role`,children:e.role}),(0,Z.jsx)(`span`,{className:`oc-fbadmin__ctx-text`,children:e.text})]},t))})]}):null,i.outboxAvailable?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:u()}),(0,Z.jsxs)(`pre`,{className:`oc-msg__source-pre`,children:[i.outboxText??``,i.outboxStatus?`\n[status: ${i.outboxStatus}]`:``]})]}):null,i.clientInfo?.extensionsDetected&&i.clientInfo.extensionsDetected.length>0?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:oe()}),(0,Z.jsx)(`div`,{className:`oc-fbadmin__row`,children:i.clientInfo.extensionsDetected.map(e=>(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-warn`,children:e},e))})]}):null,(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:ie()}),(0,Z.jsxs)(`p`,{className:`oc-fbadmin__env`,children:[[i.clientInfo?.language,i.clientInfo?.timezone,i.clientInfo?.theme?d({theme:i.clientInfo.theme}):null,i.runId?`run ${i.runId.slice(0,12)}…`:null].filter(Boolean).join(` · `)||`—`,i.clientInfo?.plugins&&i.clientInfo.plugins.length>0?(0,Z.jsxs)(`span`,{className:`oc-fbadmin__plugins`,children:[ae(),` `,i.clientInfo.plugins.join(`, `),(0,Z.jsxs)(`span`,{className:`oc-fbadmin__note`,children:[` `,a()]})]}):null,i.clientInfo?.userAgent?(0,Z.jsx)(`span`,{className:`oc-fbadmin__ua`,children:i.clientInfo.userAgent}):null]})]})]})}function xe(){let e=re(q.feedback.listForAdmin,{}),t=J(q.feedback.readSnapshot),n=J(q.feedback.deleteFeedback),r=_e(),[a,u]=(0,X.useState)(null),[d,p]=(0,X.useState)({});async function m(e){if(a===e._id){u(null);return}if(!d[e._id]){let n=await t({feedbackId:e._id});p(t=>({...t,[e._id]:n}))}u(e._id)}async function y(e){await r({title:j(),description:P(),confirmLabel:B(),destructive:!0})&&(await n({feedbackId:e._id}),a===e._id&&u(null))}return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`p`,{className:`oc-admin__hint`,children:[he(),` `,(0,Z.jsx)(`strong`,{children:ee()}),` `,h()]}),(0,Z.jsx)(ve,{title:f(),rows:e,emptyHint:l(),isExpanded:e=>a===e._id&&!!d[e._id],renderExpanded:e=>d[e._id]?(0,Z.jsx)(be,{data:d[e._id],reference:e.reference,closeReason:e.userCloseReason}):null,columns:[{header:_(),cell:e=>Y(e.at),sort:e=>e.at},{header:g(),cell:e=>Q(e.category),sort:e=>Q(e.category)},{header:L(),cell:e=>e.messageRole===`user`?i():R(),sort:e=>e.messageRole},{header:v(),cell:e=>(e.reporterEmail||e.reporterName||`—`)+(e.impersonated&&e.realOperatorEmail?` ${s({operator:e.realOperatorEmail})}`:``),sort:e=>e.reporterEmail||e.reporterName||null},{header:c(),cell:e=>(0,Z.jsx)($,{matches:e.displayedMatchesStored,sourceWasOpen:e.sourceWasOpen}),sort:e=>e.displayedMatchesStored===!1?0:e.displayedMatchesStored===!0?1:2},{header:ne(),cell:e=>e.hasComment?`✎`:`—`,sort:e=>+!!e.hasComment},{header:fe(),cell:e=>e.userClosedAt==null?e.resolvedAt==null?e.answered?(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-ok`,children:o()}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill`,children:te()}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-ok`,title:e.resolvedBy??void 0,children:N()}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-closed`,children:pe()}),sort:e=>e.userClosedAt==null?e.resolvedAt==null?+!!e.answered:2:3}],rowActions:e=>[{label:a===e._id?me():ue(),onSelect:()=>void m(e)},{label:w(),onSelect:()=>void y(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,Mz as n}from"./api-CMppRsht.js";import{I as r,L as i,R as a,z as o}from"./index-CFqHR0gi.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]
1
+ import{r as e}from"./bundle-mjs-C73ZY4La.js";import{D as t,Mz as n}from"./api-CMppRsht.js";import{I as r,L as i,R as a,z as o}from"./index-C3dl90Xw.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{AR as ee,CR as r,DR as te,ER as i,FR as ne,IR as a,LR as o,MR as s,NR as c,OR as re,PR as l,SR as u,Sj as ie,So as d,TR as f,Tz as ae,_R as oe,aR as se,bR as p,cR as ce,dR as le,fR as ue,gR as de,gz as fe,hR as pe,iR as m,jR as h,kR as me,lR as he,mR as ge,nR as _e,oR as ve,pR as ye,rR as be,sR as xe,t as g,uR as _,vR as v,vz as y,wR as b,wz as x,xR as S,xo as C,yR as w}from"./api-CMppRsht.js";import{t as T}from"./button-IhgT55aN.js";import{$ as E,Ct as D,Dn as O,Dt as k,Et as A,Lt as j,Mt as M,Nt as Se,On as N,Pt as P,Q as F,St as Ce,Tt as we,X as I,Z as L,an as R,bt as Te,et as z,ln as Ee,ut as De,vt as Oe,wt as ke,xt as Ae,yt as je}from"./index-CFqHR0gi.js";import{a as Me,i as B,n as Ne,o as V,r as H,t as Pe}from"./table-E4WVxNnB.js";var U=t(e(),1),W=n(),G=`all`;function K(e){switch(e){case`image`:return i();case`audio`:return f();case`video`:return b();case`pdf`:return r();case`document`:return u();case`archive`:return S();default:return p()}}function q(){let[e,t]=(0,U.useState)(G),[n,r]=(0,U.useState)(G),[i,u]=(0,U.useState)(G),[f,p]=(0,U.useState)(G),[b,S]=(0,U.useState)(!1),[q,J]=(0,U.useState)(null),Fe=x(g.files.softDelete),Y=k();function Ie(){t(G),r(G),u(G),p(G)}async function Le(){let e=q;if(J(null),e)try{await Fe({fileId:e.id}),Y.success(he())}catch(e){Y.error(ce(),e)}}let X=ae(g.files.listMine,{direction:e===G?void 0:e,chatId:n===G?void 0:n,instanceName:i===G?void 0:i,category:f===G?void 0:f,includeAutoGenerated:b||void 0}),Re=(0,U.useMemo)(()=>new Intl.DateTimeFormat(y(),{dateStyle:`medium`,timeStyle:`short`}),[]);if(X===void 0)return(0,W.jsx)(`p`,{className:`oc-admin__hint`,children:fe()});let{files:Z,facets:Q,truncated:ze,cap:Be}=X,$=e!==G||n!==G||i!==G||f!==G;return(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`p`,{className:`oc-admin__hint`,children:o()}),(0,W.jsxs)(`div`,{className:`oc-files__filters`,style:{display:`flex`,flexWrap:`wrap`,gap:8,margin:`12px 0`},children:[(0,W.jsxs)(I,{value:e,onValueChange:t,children:[(0,W.jsx)(E,{size:`sm`,"aria-label":a(),children:(0,W.jsx)(z,{})}),(0,W.jsxs)(L,{children:[(0,W.jsx)(F,{value:G,children:ne()}),(0,W.jsx)(F,{value:`inbound`,children:l()}),(0,W.jsx)(F,{value:`outbound`,children:c()})]})]}),(0,W.jsxs)(I,{value:n,onValueChange:r,children:[(0,W.jsx)(E,{size:`sm`,"aria-label":s(),children:(0,W.jsx)(z,{})}),(0,W.jsxs)(L,{children:[(0,W.jsx)(F,{value:G,children:h()}),Q.chats.map(e=>(0,W.jsx)(F,{value:e.id,children:e.title},e.id))]})]}),Q.multiProvider?(0,W.jsxs)(I,{value:i,onValueChange:u,children:[(0,W.jsx)(E,{size:`sm`,"aria-label":ee(),children:(0,W.jsx)(z,{})}),(0,W.jsxs)(L,{children:[(0,W.jsx)(F,{value:G,children:me()}),Q.instances.map(e=>(0,W.jsx)(F,{value:e,children:e},e))]})]}):null,(0,W.jsxs)(I,{value:f,onValueChange:p,children:[(0,W.jsx)(E,{size:`sm`,"aria-label":re(),children:(0,W.jsx)(z,{})}),(0,W.jsxs)(L,{children:[(0,W.jsx)(F,{value:G,children:te()}),Q.categories.map(e=>(0,W.jsx)(F,{value:e,children:K(e)},e))]})]}),(0,W.jsxs)(`label`,{className:`oc-files__autogen`,children:[(0,W.jsx)(De,{checked:b,onCheckedChange:e=>S(e===!0),"aria-label":d()}),(0,W.jsx)(`span`,{children:d()})]}),$?(0,W.jsxs)(T,{variant:`ghost`,size:`sm`,onClick:Ie,style:{display:`inline-flex`,alignItems:`center`,gap:4,marginLeft:`auto`},children:[(0,W.jsx)(Ee,{size:14,"aria-hidden":!0}),ue()]}):null]}),Z.length===0?(0,W.jsx)(`p`,{className:`oc-admin__hint`,children:$?be():m()}):(0,W.jsxs)(W.Fragment,{children:[(0,W.jsxs)(Pe,{children:[(0,W.jsx)(Me,{children:(0,W.jsxs)(V,{children:[(0,W.jsx)(B,{children:w()}),(0,W.jsx)(B,{children:v()}),(0,W.jsx)(B,{children:oe()}),(0,W.jsx)(B,{children:de()}),(0,W.jsx)(B,{children:pe()}),(0,W.jsx)(B,{className:`text-right`,children:ge()})]})}),(0,W.jsx)(Ne,{children:Z.map(e=>(0,W.jsxs)(V,{children:[(0,W.jsxs)(H,{className:`font-medium`,style:{maxWidth:280,overflow:`hidden`,textOverflow:`ellipsis`},title:e.filename,children:[e.filename,e.origin===`pasted`?(0,W.jsx)(A,{variant:`outline`,style:{marginLeft:6},children:C()}):null]}),(0,W.jsx)(H,{title:e.mimeType,children:K(e.category)}),(0,W.jsx)(H,{children:(0,W.jsx)(A,{variant:`secondary`,children:e.direction===`inbound`?l():c()})}),(0,W.jsx)(H,{style:{maxWidth:220,overflow:`hidden`,textOverflow:`ellipsis`},title:e.chatTitle,children:e.chatTitle}),(0,W.jsx)(H,{className:`whitespace-nowrap text-muted-foreground`,children:Re.format(e.createdAt)}),(0,W.jsx)(H,{className:`text-right`,children:(0,W.jsxs)(M,{children:[(0,W.jsx)(j,{asChild:!0,children:(0,W.jsx)(T,{variant:`ghost`,size:`icon`,"aria-label":le(),children:(0,W.jsx)(O,{size:16})})}),(0,W.jsxs)(Se,{align:`end`,children:[e.url?(0,W.jsx)(P,{asChild:!0,children:(0,W.jsxs)(`a`,{href:e.url,download:e.filename,target:`_blank`,rel:`noopener noreferrer`,children:[(0,W.jsx)(N,{size:14}),ye()]})}):(0,W.jsxs)(P,{disabled:!0,children:[(0,W.jsx)(N,{size:14}),se()]}),(0,W.jsxs)(P,{variant:`destructive`,onSelect:()=>J({id:e._id,filename:e.filename}),children:[(0,W.jsx)(R,{size:14}),_()]})]})]})})]},e._id))})]}),ze?(0,W.jsx)(`p`,{className:`oc-admin__hint`,style:{marginTop:8},children:_e({cap:Be})}):null]}),(0,W.jsx)(Oe,{open:q!==null,onOpenChange:e=>!e&&J(null),children:(0,W.jsxs)(Ae,{children:[(0,W.jsxs)(ke,{children:[(0,W.jsx)(we,{children:xe()}),(0,W.jsx)(Ce,{children:ve()})]}),(0,W.jsxs)(D,{children:[(0,W.jsx)(Te,{children:ie()}),(0,W.jsx)(je,{onClick:()=>void Le(),children:_()})]})]})})]})}export{q as FilesTab};
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{AR as ee,CR as r,DR as te,ER as i,FR as ne,IR as a,LR as o,MR as s,NR as c,OR as re,PR as l,SR as u,Sj as ie,So as d,TR as f,Tz as ae,_R as oe,aR as se,bR as p,cR as ce,dR as le,fR as ue,gR as de,gz as fe,hR as pe,iR as m,jR as h,kR as me,lR as he,mR as ge,nR as _e,oR as ve,pR as ye,rR as be,sR as xe,t as g,uR as _,vR as v,vz as y,wR as b,wz as x,xR as S,xo as C,yR as w}from"./api-CMppRsht.js";import{t as T}from"./button-IhgT55aN.js";import{$ as E,Ct as D,Dn as O,Dt as k,Et as A,Lt as j,Mt as M,Nt as Se,On as N,Pt as P,Q as F,St as Ce,Tt as we,X as I,Z as L,an as R,bt as Te,et as z,ln as Ee,ut as De,vt as Oe,wt as ke,xt as Ae,yt as je}from"./index-C3dl90Xw.js";import{a as Me,i as B,n as Ne,o as V,r as H,t as Pe}from"./table-E4WVxNnB.js";var U=t(e(),1),W=n(),G=`all`;function K(e){switch(e){case`image`:return i();case`audio`:return f();case`video`:return b();case`pdf`:return r();case`document`:return u();case`archive`:return S();default:return p()}}function q(){let[e,t]=(0,U.useState)(G),[n,r]=(0,U.useState)(G),[i,u]=(0,U.useState)(G),[f,p]=(0,U.useState)(G),[b,S]=(0,U.useState)(!1),[q,J]=(0,U.useState)(null),Fe=x(g.files.softDelete),Y=k();function Ie(){t(G),r(G),u(G),p(G)}async function Le(){let e=q;if(J(null),e)try{await Fe({fileId:e.id}),Y.success(he())}catch(e){Y.error(ce(),e)}}let X=ae(g.files.listMine,{direction:e===G?void 0:e,chatId:n===G?void 0:n,instanceName:i===G?void 0:i,category:f===G?void 0:f,includeAutoGenerated:b||void 0}),Re=(0,U.useMemo)(()=>new Intl.DateTimeFormat(y(),{dateStyle:`medium`,timeStyle:`short`}),[]);if(X===void 0)return(0,W.jsx)(`p`,{className:`oc-admin__hint`,children:fe()});let{files:Z,facets:Q,truncated:ze,cap:Be}=X,$=e!==G||n!==G||i!==G||f!==G;return(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`p`,{className:`oc-admin__hint`,children:o()}),(0,W.jsxs)(`div`,{className:`oc-files__filters`,style:{display:`flex`,flexWrap:`wrap`,gap:8,margin:`12px 0`},children:[(0,W.jsxs)(I,{value:e,onValueChange:t,children:[(0,W.jsx)(E,{size:`sm`,"aria-label":a(),children:(0,W.jsx)(z,{})}),(0,W.jsxs)(L,{children:[(0,W.jsx)(F,{value:G,children:ne()}),(0,W.jsx)(F,{value:`inbound`,children:l()}),(0,W.jsx)(F,{value:`outbound`,children:c()})]})]}),(0,W.jsxs)(I,{value:n,onValueChange:r,children:[(0,W.jsx)(E,{size:`sm`,"aria-label":s(),children:(0,W.jsx)(z,{})}),(0,W.jsxs)(L,{children:[(0,W.jsx)(F,{value:G,children:h()}),Q.chats.map(e=>(0,W.jsx)(F,{value:e.id,children:e.title},e.id))]})]}),Q.multiProvider?(0,W.jsxs)(I,{value:i,onValueChange:u,children:[(0,W.jsx)(E,{size:`sm`,"aria-label":ee(),children:(0,W.jsx)(z,{})}),(0,W.jsxs)(L,{children:[(0,W.jsx)(F,{value:G,children:me()}),Q.instances.map(e=>(0,W.jsx)(F,{value:e,children:e},e))]})]}):null,(0,W.jsxs)(I,{value:f,onValueChange:p,children:[(0,W.jsx)(E,{size:`sm`,"aria-label":re(),children:(0,W.jsx)(z,{})}),(0,W.jsxs)(L,{children:[(0,W.jsx)(F,{value:G,children:te()}),Q.categories.map(e=>(0,W.jsx)(F,{value:e,children:K(e)},e))]})]}),(0,W.jsxs)(`label`,{className:`oc-files__autogen`,children:[(0,W.jsx)(De,{checked:b,onCheckedChange:e=>S(e===!0),"aria-label":d()}),(0,W.jsx)(`span`,{children:d()})]}),$?(0,W.jsxs)(T,{variant:`ghost`,size:`sm`,onClick:Ie,style:{display:`inline-flex`,alignItems:`center`,gap:4,marginLeft:`auto`},children:[(0,W.jsx)(Ee,{size:14,"aria-hidden":!0}),ue()]}):null]}),Z.length===0?(0,W.jsx)(`p`,{className:`oc-admin__hint`,children:$?be():m()}):(0,W.jsxs)(W.Fragment,{children:[(0,W.jsxs)(Pe,{children:[(0,W.jsx)(Me,{children:(0,W.jsxs)(V,{children:[(0,W.jsx)(B,{children:w()}),(0,W.jsx)(B,{children:v()}),(0,W.jsx)(B,{children:oe()}),(0,W.jsx)(B,{children:de()}),(0,W.jsx)(B,{children:pe()}),(0,W.jsx)(B,{className:`text-right`,children:ge()})]})}),(0,W.jsx)(Ne,{children:Z.map(e=>(0,W.jsxs)(V,{children:[(0,W.jsxs)(H,{className:`font-medium`,style:{maxWidth:280,overflow:`hidden`,textOverflow:`ellipsis`},title:e.filename,children:[e.filename,e.origin===`pasted`?(0,W.jsx)(A,{variant:`outline`,style:{marginLeft:6},children:C()}):null]}),(0,W.jsx)(H,{title:e.mimeType,children:K(e.category)}),(0,W.jsx)(H,{children:(0,W.jsx)(A,{variant:`secondary`,children:e.direction===`inbound`?l():c()})}),(0,W.jsx)(H,{style:{maxWidth:220,overflow:`hidden`,textOverflow:`ellipsis`},title:e.chatTitle,children:e.chatTitle}),(0,W.jsx)(H,{className:`whitespace-nowrap text-muted-foreground`,children:Re.format(e.createdAt)}),(0,W.jsx)(H,{className:`text-right`,children:(0,W.jsxs)(M,{children:[(0,W.jsx)(j,{asChild:!0,children:(0,W.jsx)(T,{variant:`ghost`,size:`icon`,"aria-label":le(),children:(0,W.jsx)(O,{size:16})})}),(0,W.jsxs)(Se,{align:`end`,children:[e.url?(0,W.jsx)(P,{asChild:!0,children:(0,W.jsxs)(`a`,{href:e.url,download:e.filename,target:`_blank`,rel:`noopener noreferrer`,children:[(0,W.jsx)(N,{size:14}),ye()]})}):(0,W.jsxs)(P,{disabled:!0,children:[(0,W.jsx)(N,{size:14}),se()]}),(0,W.jsxs)(P,{variant:`destructive`,onSelect:()=>J({id:e._id,filename:e.filename}),children:[(0,W.jsx)(R,{size:14}),_()]})]})]})})]},e._id))})]}),ze?(0,W.jsx)(`p`,{className:`oc-admin__hint`,style:{marginTop:8},children:_e({cap:Be})}):null]}),(0,W.jsx)(Oe,{open:q!==null,onOpenChange:e=>!e&&J(null),children:(0,W.jsxs)(Ae,{children:[(0,W.jsxs)(ke,{children:[(0,W.jsx)(we,{children:xe()}),(0,W.jsx)(Ce,{children:ve()})]}),(0,W.jsxs)(D,{children:[(0,W.jsx)(Te,{children:ie()}),(0,W.jsx)(je,{onClick:()=>void Le(),children:_()})]})]})})]})}export{q as FilesTab};
@@ -1 +1 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{_h as r,vh as i}from"./api-CMppRsht.js";import{t as a}from"./button-IhgT55aN.js";import{cn as o,jt as s,ln as c}from"./index-CFqHR0gi.js";import{t as l}from"./TimeRangePicker-CS4l2E_Y.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)(o,{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)(c,{}),r()]})]})}export{p as t};
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{_h as r,vh as i}from"./api-CMppRsht.js";import{t as a}from"./button-IhgT55aN.js";import{cn as o,jt as s,ln as c}from"./index-C3dl90Xw.js";import{t as l}from"./TimeRangePicker-DLQwf08l.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)(o,{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)(c,{}),r()]})]})}export{p as t};
@@ -1 +1 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$f as r,Af as i,Bf as a,Cf as o,Cp as s,D as c,Df as l,Ef as u,Ep as d,Ff as f,Gf as p,Hf as m,If as h,Jf as g,Kf as _,Lf as v,Mf as y,Nf as b,Of as x,Pf as S,Qf as C,Rf as ee,Sf as te,Sp as w,Tf as ne,Tp as T,Tz as E,Uf as re,Vf as D,Wf as ie,Xf as O,Yf as ae,Zf as k,_f as A,_p as j,ap as M,bf as oe,bp as se,cp as N,dp as ce,ep as le,fp as P,gp as F,hp as ue,ip as de,jf as fe,kf as pe,lp as me,mp as he,np as ge,op as _e,pp as ve,qf as ye,rp as be,sp as xe,t as I,tp as Se,up as Ce,vf as we,vp as Te,wf as Ee,wp as De,wz as L,xf as R,xp as Oe,yf as ke,yp as Ae,zf as je}from"./api-CMppRsht.js";import{t as Me}from"./x-CdHbCgxq.js";import{i as z,n as B,r as Ne,t as Pe}from"./tabs-BQOp_WCt.js";import{t as V}from"./button-IhgT55aN.js";import{$ as Fe,Dt as H,Et as U,Mn as Ie,Nn as Le,Q as Re,U as ze,X as Be,Z as Ve,_ as He,at as Ue,et as We,jt as W,nt as Ge,on as G,ot as Ke,q as qe,rt as Je,sn as K,tt as Ye,ut as q}from"./index-CFqHR0gi.js";import{t as Xe}from"./FilterBar-B3g5mQkA.js";import{t as Ze}from"./DataTableShell-hu5AF3BF.js";import{t as J}from"./DetailChips-CPHHClkW.js";var Qe=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`}]]),Y=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`}]]),$e=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`}]]),X=t(e(),1);function et(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 tt(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 nt(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 rt(e){switch(e){case`admin`:return ye();case`user`:return _();case`pending`:return p();default:return e}}function Z(e,t){if(e.length===0)return`none`;let n=0;for(let r of e)t(r)&&n++;return n===0?`none`:n===e.length?`all`:`some`}function it(e,t,n){let r=Math.max(1,Math.ceil(e.length/n)),i=Math.min(Math.max(1,Math.floor(t)),r),a=(i-1)*n;return{pageItems:e.slice(a,a+n),page:i,pageCount:r}}var Q=n(),$={name:``,description:``};function at(){let e=E(I.groups.listGroups,{}),t=E(I.me.getMe,{host:qe})?.role===`admin`,n=L(I.groups.createGroup),r=L(I.groups.updateGroup),i=L(I.groups.deleteGroup),a=ze(),o=H(),[c,l]=(0,X.useState)(!1),[u,f]=(0,X.useState)(null),[p,m]=(0,X.useState)($),[h,g]=(0,X.useState)(null),[_,v]=(0,X.useState)(``),y=(0,X.useMemo)(()=>{if(!e)return e;let t=_.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,_]);function b(){f(null),m($),l(!0)}function x(e){f(e),m({name:e.name,description:e.description??``}),l(!0)}async function S(){try{u?await r({groupId:u._id,name:p.name,description:p.description}):await n({name:p.name,description:p.description||void 0}),m($),f(null),l(!1)}catch(e){o.error(oe(),e)}}async function C(e){if(await a({title:xe({name:e.name}),description:_e(),confirmWord:e.name,confirmLabel:M(),cancelLabel:ve(),destructive:!0}))try{await i({groupId:e._id})}catch(e){o.error(ke(),e)}}return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:T()}),(0,Q.jsx)(Xe,{q:_,onQChange:v,onReset:()=>v(``),canReset:_!==``,searchPlaceholder:Te()}),(0,Q.jsx)(Ze,{title:d(),rows:y,addLabel:De(),onAdd:t?b:void 0,emptyHint:s(),columns:[{header:w(),cell:e=>e.name,sort:e=>e.name},{header:Oe(),cell:e=>(0,Q.jsx)(J,{icon:(0,Q.jsx)($e,{size:12,"aria-hidden":!0}),total:e.memberCount,items:e.members.map(e=>({label:e.label,marker:e.manager?(0,Q.jsx)(Y,{size:11,"aria-hidden":!0}):null,highlight:e.manager}))}),sort:e=>e.memberCount},{header:se(),cell:e=>(0,Q.jsx)(J,{icon:(0,Q.jsx)(K,{size:12,"aria-hidden":!0}),total:e.agentCount,items:e.agents.map(e=>({label:e}))}),sort:e=>e.agentCount},{header:Ae(),cell:e=>(0,Q.jsx)(J,{icon:(0,Q.jsx)(Qe,{size:12,"aria-hidden":!0}),total:e.chartCount,items:e.charts.map(e=>({label:e.name,marker:e.isDefault?(0,Q.jsx)(G,{size:11,fill:`currentColor`,"aria-hidden":!0}):null,highlight:e.isDefault}))}),sort:e=>e.chartCount}],rowActions:e=>[{label:j(),onSelect:()=>g({groupId:e._id,name:e.name})},...t?[{label:F(),onSelect:()=>x(e)},{label:ue(),variant:`destructive`,onSelect:()=>void C(e)}]:[]]}),(0,Q.jsx)(He,{open:c,onOpenChange:l,title:u?ce():P(),description:Ce(),canSubmit:!!p.name.trim(),onSubmit:S,submitLabel:he(),children:(0,Q.jsxs)(`div`,{className:`oc-form`,children:[(0,Q.jsxs)(`label`,{className:`oc-field`,children:[(0,Q.jsx)(`span`,{className:`oc-field__label`,children:me()}),(0,Q.jsx)(W,{value:p.name,onChange:e=>m({...p,name:e.target.value})})]}),(0,Q.jsxs)(`label`,{className:`oc-field`,children:[(0,Q.jsx)(`span`,{className:`oc-field__label`,children:N()}),(0,Q.jsx)(W,{value:p.description,onChange:e=>m({...p,description:e.target.value})})]})]})}),(0,Q.jsx)(ct,{groupId:h?.groupId??null,groupName:h?.name??``,open:h!==null,onOpenChange:e=>{e||g(null)}})]})}var ot=8;function st({page:e,pageCount:t,onPage:n}){return t<=1?null:(0,Q.jsxs)(`div`,{className:`oc-access__pager`,children:[(0,Q.jsxs)(V,{type:`button`,variant:`ghost`,size:`sm`,disabled:e<=1,onClick:()=>n(e-1),children:[(0,Q.jsx)(Le,{size:14,"aria-hidden":!0}),O()]}),(0,Q.jsxs)(`span`,{className:`oc-access__pageinfo`,"aria-label":g({page:e,pages:t}),children:[e,` / `,t]}),(0,Q.jsxs)(V,{type:`button`,variant:`ghost`,size:`sm`,disabled:e>=t,onClick:()=>n(e+1),children:[ae(),(0,Q.jsx)(Ie,{size:14,"aria-hidden":!0})]})]})}function ct({groupId:e,groupName:t,open:n,onOpenChange:i}){let s=E(I.groups.getGroup,n&&e?{groupId:e}:`skip`),c=E(I.groups.listAssignableInstances,n?{}:`skip`),l=E(I.groups.listAssignableUsers,n?{}:`skip`),u=L(I.groups.addMember),d=L(I.groups.removeMember),f=L(I.groups.bulkSetMembers),p=L(I.groups.setGroupManager),h=H(),[g,_]=(0,X.useState)(``),[v,y]=(0,X.useState)(``),[x,S]=(0,X.useState)(`members`),[ee,w]=(0,X.useState)(1),[T,re]=(0,X.useState)(new Set),D=(0,X.useRef)(null),O=(0,X.useMemo)(()=>new Set((s?.members??[]).map(e=>e.userId)),[s]),ae=(0,X.useMemo)(()=>new Set((s?.members??[]).filter(e=>e.manager).map(e=>e.userId)),[s]),A=s?.viewerIsAdmin===!0,j=(0,X.useMemo)(()=>new Set((s?.agents??[]).map(e=>`${e.instanceName}/${e.agentId}`)),[s]);(0,X.useEffect)(()=>{_(``),y(``),S(`members`),w(1),D.current=null},[n,e]),(0,X.useEffect)(()=>{w(1)},[g]),(0,X.useEffect)(()=>{n&&s&&e&&D.current!==e&&(D.current=e,re(new Set((s.members??[]).map(e=>e.userId))))},[n,s,e]);let M=(0,X.useMemo)(()=>l?et(l,g,T):[],[l,g,T]);async function oe(t,n){if(e)try{n?await d({groupId:e,userId:t}):await u({groupId:e,userId:t})}catch(e){h.error(we(),e)}}async function se(t,n){if(e)try{await p({groupId:e,userId:t,manager:!n})}catch(e){h.error(te(),e)}}let N=Z(M,e=>O.has(e.userId)),ce=M.filter(e=>O.has(e.userId)).length,P=it(M,ee,ot);async function F(){if(!e||M.length===0)return;let t=M.map(e=>e.userId);try{await f({groupId:e,userIds:t,member:N!==`all`})}catch(e){h.error(we(),e)}}return(0,Q.jsx)(Ye,{open:n,onOpenChange:i,children:(0,Q.jsxs)(Ge,{className:`oc-access`,children:[(0,Q.jsxs)(Ue,{children:[(0,Q.jsx)(Ke,{children:de({name:t})}),(0,Q.jsx)(Je,{children:be()})]}),(0,Q.jsxs)(Pe,{value:x,onValueChange:S,className:`oc-access__tabs`,children:[(0,Q.jsxs)(Ne,{className:`w-full`,children:[(0,Q.jsxs)(z,{value:`members`,className:`flex-1 gap-1.5`,children:[(0,Q.jsx)($e,{size:13,"aria-hidden":!0}),ge(),s?(0,Q.jsx)(U,{variant:`secondary`,className:`oc-access__tabcount`,children:O.size}):null]}),(0,Q.jsxs)(z,{value:`agents`,className:`flex-1 gap-1.5`,children:[(0,Q.jsx)(K,{size:13,"aria-hidden":!0}),le(),s?(0,Q.jsx)(U,{variant:`secondary`,className:`oc-access__tabcount`,children:j.size}):null]}),(0,Q.jsxs)(z,{value:`charts`,className:`flex-1 gap-1.5`,children:[(0,Q.jsx)(Qe,{size:13,"aria-hidden":!0}),b(),s?(0,Q.jsx)(U,{variant:`secondary`,className:`oc-access__tabcount`,children:s.chartCount}):null]})]}),(0,Q.jsx)(B,{value:`members`,children:l===void 0||s===void 0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:m()}):l.length===0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:a()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(W,{value:g,onChange:e=>_(e.target.value),placeholder:Se(),className:`oc-access__search`}),M.length===0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:C()}):(0,Q.jsxs)(Q.Fragment,{children:[M.length>1?(0,Q.jsxs)(`div`,{className:`oc-access__row oc-access__selectall`,children:[(0,Q.jsx)(q,{checked:N===`all`?!0:N===`some`?`indeterminate`:!1,onCheckedChange:()=>void F(),"aria-label":k()}),(0,Q.jsx)(`span`,{className:`oc-access__label`,children:k()}),(0,Q.jsxs)(U,{variant:`outline`,className:`oc-access__count`,children:[ce,` / `,M.length]})]}):null,(0,Q.jsx)(`div`,{className:`oc-access__list`,children:P.pageItems.map(e=>{let t=O.has(e.userId),n=nt(e),r=ae.has(e.userId);return(0,Q.jsxs)(`div`,{className:`oc-access__row`,children:[(0,Q.jsx)(q,{checked:t,onCheckedChange:()=>void oe(e.userId,t),"aria-label":ie({user:n.primary})}),(0,Q.jsxs)(`span`,{className:`oc-access__who`,children:[(0,Q.jsx)(`span`,{className:`oc-access__label`,title:n.primary,children:n.primary}),n.secondary?(0,Q.jsx)(`span`,{className:`oc-access__sub`,title:n.secondary,children:n.secondary}):null]}),(0,Q.jsx)(U,{variant:`outline`,className:`oc-access__role`,children:rt(e.role)}),(0,Q.jsx)(`span`,{className:`oc-access__mgrslot`,children:t&&A?(0,Q.jsx)(V,{type:`button`,variant:`ghost`,size:`icon`,className:`shrink-0 oc-access__mgr${r?` oc-access__mgr--on`:``}`,"aria-pressed":r,"aria-label":r?o():Ee(),title:r?o():Ee(),onClick:()=>void se(e.userId,r),children:(0,Q.jsx)(Y,{size:15,"aria-hidden":!0})}):t&&r?(0,Q.jsx)(`span`,{className:`oc-access__mgr oc-access__mgr--on`,role:`img`,"aria-label":ne(),title:ne(),children:(0,Q.jsx)(Y,{size:15,"aria-hidden":!0})}):null})]},e._id)})}),(0,Q.jsx)(st,{page:P.page,pageCount:P.pageCount,onPage:w})]})]})}),(0,Q.jsx)(B,{value:`agents`,children:c===void 0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:m()}):c.length===0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:je()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(W,{value:v,onChange:e=>y(e.target.value),placeholder:r(),className:`oc-access__search`}),(0,Q.jsx)(`div`,{className:`oc-access__list`,children:c.map(t=>(0,Q.jsx)(lt,{groupId:e,instanceName:t.name,kind:t.kind??`openclaw`,assigned:j,query:v},`${e}-${t._id}`))})]})}),(0,Q.jsx)(B,{value:`charts`,children:(0,Q.jsx)(ut,{groupId:e})})]})]})})}function lt({groupId:e,instanceName:t,kind:n,assigned:r,query:i}){let a=E(I.groups.listAssignableAgents,{instanceName:t}),o=L(I.groups.assignAgentToGroup),s=L(I.groups.removeAgentFromGroup),c=L(I.groups.bulkSetGroupAgents),l=H(),[u,d]=(0,X.useState)(1);if((0,X.useEffect)(()=>{d(1)},[i]),!e)return null;let p=tt(a?.agents??[],i),m=a?.discovery&&!a.discovery.lastPollOk;if(i.trim()&&p.length===0)return null;let g=p.filter(e=>e.presentInLastOk!==!1&&e.enabled!==!1),_=Z(g,e=>r.has(`${t}/${e.agentId}`)),y=it(p,u,ot);async function b(n,r){try{r?await s({groupId:e,instanceName:t,agentId:n}):await o({groupId:e,instanceName:t,agentId:n})}catch(e){l.error(A(),e)}}async function x(){if(g.length===0)return;let n=g.map(e=>e.agentId);try{await c({groupId:e,instanceName:t,agentIds:n,assigned:_!==`all`})}catch(e){l.error(A(),e)}}return(0,Q.jsxs)(`div`,{className:`oc-access__group`,children:[(0,Q.jsxs)(`div`,{className:`oc-access__instance`,children:[(0,Q.jsx)(K,{size:13,"aria-hidden":!0}),(0,Q.jsx)(`span`,{children:t}),(0,Q.jsx)(U,{variant:`outline`,className:`oc-access__kind`,children:n}),m?(0,Q.jsx)(U,{variant:`outline`,className:`oc-access__stale`,children:h()}):null]}),a===void 0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:D()}):p.length===0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:m?v():ee()}):(0,Q.jsxs)(Q.Fragment,{children:[g.length>1?(0,Q.jsxs)(`div`,{className:`oc-access__row oc-access__selectall`,children:[(0,Q.jsx)(q,{checked:_===`all`?!0:_===`some`?`indeterminate`:!1,onCheckedChange:()=>void x(),"aria-label":k()}),(0,Q.jsx)(`span`,{className:`oc-access__label`,children:k()})]}):null,y.pageItems.map(e=>{let n=`${t}/${e.agentId}`,i=r.has(n),a=e.presentInLastOk===!1,o=!e.enabled;return(0,Q.jsxs)(`div`,{className:`oc-access__row${o?` is-disabled`:``}`,children:[(0,Q.jsx)(q,{checked:i,disabled:(a||o)&&!i,onCheckedChange:()=>void b(e.agentId,i),"aria-label":re({name:e.displayName??e.agentId})}),(0,Q.jsxs)(`span`,{className:`oc-access__label`,title:e.displayName??e.agentId,children:[e.emoji?`${e.emoji} `:``,e.displayName??e.agentId]}),e.model?(0,Q.jsx)(`span`,{className:`oc-access__model`,children:e.model}):null,e.isDefaultOnInstance?(0,Q.jsx)(`span`,{className:`oc-access__fav`,role:`img`,"aria-label":S(),title:S(),children:(0,Q.jsx)(G,{size:14,fill:`currentColor`})}):null,a?(0,Q.jsx)(U,{variant:`outline`,className:`oc-access__gone`,children:f()}):null]},e.agentId)}),(0,Q.jsx)(st,{page:y.page,pageCount:y.pageCount,onPage:d})]})]})}function ut({groupId:e}){let t=E(I.charts.listGroupChartSelection,e?{groupId:e}:`skip`),n=L(I.charts.assignChartToGroup),r=L(I.charts.removeChartFromGroup),a=L(I.charts.setGroupDefaultChart),o=L(I.charts.addChartToGroupPool),s=L(I.charts.removeChartFromGroupPool),c=H();if(!e)return null;if(t===void 0)return(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:m()});let{pool:d,addable:f,canManagePool:p}=t;if(d.length===0&&!p)return(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:y()});async function h(t,i){try{i?await r({groupId:e,chartKey:t}):await n({groupId:e,chartKey:t})}catch(e){c.error(R(),e)}}async function g(t){try{await a({groupId:e,chartKey:t})}catch(e){c.error(R(),e)}}async function _(t){try{await o({groupId:e,chartKey:t})}catch(e){c.error(R(),e)}}async function v(t){try{await s({groupId:e,chartKey:t})}catch(e){c.error(R(),e)}}return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`div`,{className:`oc-access__list`,children:d.map(e=>(0,Q.jsxs)(`div`,{className:`oc-access__row`,children:[(0,Q.jsx)(q,{checked:e.selected,onCheckedChange:()=>void h(e.chartKey,e.selected),"aria-label":x({name:e.name})}),(0,Q.jsx)(`span`,{className:`oc-access__label`,title:e.name,children:e.name}),e.selected?e.isDefault?(0,Q.jsx)(`span`,{className:`oc-access__fav`,role:`img`,"aria-label":l(),title:l(),children:(0,Q.jsx)(G,{size:14,fill:`currentColor`})}):(0,Q.jsx)(V,{type:`button`,variant:`ghost`,size:`sm`,onClick:()=>void g(e.chartKey),children:u()}):null,p?(0,Q.jsx)(V,{type:`button`,variant:`ghost`,size:`sm`,"aria-label":pe({name:e.name}),title:pe({name:e.name}),onClick:()=>void v(e.chartKey),children:(0,Q.jsx)(Me,{size:14,"aria-hidden":!0})}):null]},e.chartKey))}),p?f.length>0?(0,Q.jsxs)(Be,{value:``,onValueChange:e=>void _(e),children:[(0,Q.jsx)(Fe,{size:`sm`,className:`oc-access__search`,children:(0,Q.jsx)(We,{placeholder:i()})}),(0,Q.jsx)(Ve,{children:f.map(e=>(0,Q.jsx)(Re,{value:e.chartKey,children:e.name},e.chartKey))})]}):d.length===0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:fe()}):null:null]})}export{at as GroupsTab};
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$f as r,Af as i,Bf as a,Cf as o,Cp as s,D as c,Df as l,Ef as u,Ep as d,Ff as f,Gf as p,Hf as m,If as h,Jf as g,Kf as _,Lf as v,Mf as y,Nf as b,Of as x,Pf as S,Qf as C,Rf as ee,Sf as te,Sp as w,Tf as ne,Tp as T,Tz as E,Uf as re,Vf as D,Wf as ie,Xf as O,Yf as ae,Zf as k,_f as A,_p as j,ap as M,bf as oe,bp as se,cp as N,dp as ce,ep as le,fp as P,gp as F,hp as ue,ip as de,jf as fe,kf as pe,lp as me,mp as he,np as ge,op as _e,pp as ve,qf as ye,rp as be,sp as xe,t as I,tp as Se,up as Ce,vf as we,vp as Te,wf as Ee,wp as De,wz as L,xf as R,xp as Oe,yf as ke,yp as Ae,zf as je}from"./api-CMppRsht.js";import{t as Me}from"./x-CdHbCgxq.js";import{i as z,n as B,r as Ne,t as Pe}from"./tabs-BPsz_527.js";import{t as V}from"./button-IhgT55aN.js";import{$ as Fe,Dt as H,Et as U,Mn as Ie,Nn as Le,Q as Re,U as ze,X as Be,Z as Ve,_ as He,at as Ue,et as We,jt as W,nt as Ge,on as G,ot as Ke,q as qe,rt as Je,sn as K,tt as Ye,ut as q}from"./index-C3dl90Xw.js";import{t as Xe}from"./FilterBar-CnjTuIOw.js";import{t as Ze}from"./DataTableShell-BInsTzwk.js";import{t as J}from"./DetailChips-Lo0Kvu7k.js";var Qe=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`}]]),Y=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`}]]),$e=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`}]]),X=t(e(),1);function et(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 tt(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 nt(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 rt(e){switch(e){case`admin`:return ye();case`user`:return _();case`pending`:return p();default:return e}}function Z(e,t){if(e.length===0)return`none`;let n=0;for(let r of e)t(r)&&n++;return n===0?`none`:n===e.length?`all`:`some`}function it(e,t,n){let r=Math.max(1,Math.ceil(e.length/n)),i=Math.min(Math.max(1,Math.floor(t)),r),a=(i-1)*n;return{pageItems:e.slice(a,a+n),page:i,pageCount:r}}var Q=n(),$={name:``,description:``};function at(){let e=E(I.groups.listGroups,{}),t=E(I.me.getMe,{host:qe})?.role===`admin`,n=L(I.groups.createGroup),r=L(I.groups.updateGroup),i=L(I.groups.deleteGroup),a=ze(),o=H(),[c,l]=(0,X.useState)(!1),[u,f]=(0,X.useState)(null),[p,m]=(0,X.useState)($),[h,g]=(0,X.useState)(null),[_,v]=(0,X.useState)(``),y=(0,X.useMemo)(()=>{if(!e)return e;let t=_.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,_]);function b(){f(null),m($),l(!0)}function x(e){f(e),m({name:e.name,description:e.description??``}),l(!0)}async function S(){try{u?await r({groupId:u._id,name:p.name,description:p.description}):await n({name:p.name,description:p.description||void 0}),m($),f(null),l(!1)}catch(e){o.error(oe(),e)}}async function C(e){if(await a({title:xe({name:e.name}),description:_e(),confirmWord:e.name,confirmLabel:M(),cancelLabel:ve(),destructive:!0}))try{await i({groupId:e._id})}catch(e){o.error(ke(),e)}}return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:T()}),(0,Q.jsx)(Xe,{q:_,onQChange:v,onReset:()=>v(``),canReset:_!==``,searchPlaceholder:Te()}),(0,Q.jsx)(Ze,{title:d(),rows:y,addLabel:De(),onAdd:t?b:void 0,emptyHint:s(),columns:[{header:w(),cell:e=>e.name,sort:e=>e.name},{header:Oe(),cell:e=>(0,Q.jsx)(J,{icon:(0,Q.jsx)($e,{size:12,"aria-hidden":!0}),total:e.memberCount,items:e.members.map(e=>({label:e.label,marker:e.manager?(0,Q.jsx)(Y,{size:11,"aria-hidden":!0}):null,highlight:e.manager}))}),sort:e=>e.memberCount},{header:se(),cell:e=>(0,Q.jsx)(J,{icon:(0,Q.jsx)(K,{size:12,"aria-hidden":!0}),total:e.agentCount,items:e.agents.map(e=>({label:e}))}),sort:e=>e.agentCount},{header:Ae(),cell:e=>(0,Q.jsx)(J,{icon:(0,Q.jsx)(Qe,{size:12,"aria-hidden":!0}),total:e.chartCount,items:e.charts.map(e=>({label:e.name,marker:e.isDefault?(0,Q.jsx)(G,{size:11,fill:`currentColor`,"aria-hidden":!0}):null,highlight:e.isDefault}))}),sort:e=>e.chartCount}],rowActions:e=>[{label:j(),onSelect:()=>g({groupId:e._id,name:e.name})},...t?[{label:F(),onSelect:()=>x(e)},{label:ue(),variant:`destructive`,onSelect:()=>void C(e)}]:[]]}),(0,Q.jsx)(He,{open:c,onOpenChange:l,title:u?ce():P(),description:Ce(),canSubmit:!!p.name.trim(),onSubmit:S,submitLabel:he(),children:(0,Q.jsxs)(`div`,{className:`oc-form`,children:[(0,Q.jsxs)(`label`,{className:`oc-field`,children:[(0,Q.jsx)(`span`,{className:`oc-field__label`,children:me()}),(0,Q.jsx)(W,{value:p.name,onChange:e=>m({...p,name:e.target.value})})]}),(0,Q.jsxs)(`label`,{className:`oc-field`,children:[(0,Q.jsx)(`span`,{className:`oc-field__label`,children:N()}),(0,Q.jsx)(W,{value:p.description,onChange:e=>m({...p,description:e.target.value})})]})]})}),(0,Q.jsx)(ct,{groupId:h?.groupId??null,groupName:h?.name??``,open:h!==null,onOpenChange:e=>{e||g(null)}})]})}var ot=8;function st({page:e,pageCount:t,onPage:n}){return t<=1?null:(0,Q.jsxs)(`div`,{className:`oc-access__pager`,children:[(0,Q.jsxs)(V,{type:`button`,variant:`ghost`,size:`sm`,disabled:e<=1,onClick:()=>n(e-1),children:[(0,Q.jsx)(Le,{size:14,"aria-hidden":!0}),O()]}),(0,Q.jsxs)(`span`,{className:`oc-access__pageinfo`,"aria-label":g({page:e,pages:t}),children:[e,` / `,t]}),(0,Q.jsxs)(V,{type:`button`,variant:`ghost`,size:`sm`,disabled:e>=t,onClick:()=>n(e+1),children:[ae(),(0,Q.jsx)(Ie,{size:14,"aria-hidden":!0})]})]})}function ct({groupId:e,groupName:t,open:n,onOpenChange:i}){let s=E(I.groups.getGroup,n&&e?{groupId:e}:`skip`),c=E(I.groups.listAssignableInstances,n?{}:`skip`),l=E(I.groups.listAssignableUsers,n?{}:`skip`),u=L(I.groups.addMember),d=L(I.groups.removeMember),f=L(I.groups.bulkSetMembers),p=L(I.groups.setGroupManager),h=H(),[g,_]=(0,X.useState)(``),[v,y]=(0,X.useState)(``),[x,S]=(0,X.useState)(`members`),[ee,w]=(0,X.useState)(1),[T,re]=(0,X.useState)(new Set),D=(0,X.useRef)(null),O=(0,X.useMemo)(()=>new Set((s?.members??[]).map(e=>e.userId)),[s]),ae=(0,X.useMemo)(()=>new Set((s?.members??[]).filter(e=>e.manager).map(e=>e.userId)),[s]),A=s?.viewerIsAdmin===!0,j=(0,X.useMemo)(()=>new Set((s?.agents??[]).map(e=>`${e.instanceName}/${e.agentId}`)),[s]);(0,X.useEffect)(()=>{_(``),y(``),S(`members`),w(1),D.current=null},[n,e]),(0,X.useEffect)(()=>{w(1)},[g]),(0,X.useEffect)(()=>{n&&s&&e&&D.current!==e&&(D.current=e,re(new Set((s.members??[]).map(e=>e.userId))))},[n,s,e]);let M=(0,X.useMemo)(()=>l?et(l,g,T):[],[l,g,T]);async function oe(t,n){if(e)try{n?await d({groupId:e,userId:t}):await u({groupId:e,userId:t})}catch(e){h.error(we(),e)}}async function se(t,n){if(e)try{await p({groupId:e,userId:t,manager:!n})}catch(e){h.error(te(),e)}}let N=Z(M,e=>O.has(e.userId)),ce=M.filter(e=>O.has(e.userId)).length,P=it(M,ee,ot);async function F(){if(!e||M.length===0)return;let t=M.map(e=>e.userId);try{await f({groupId:e,userIds:t,member:N!==`all`})}catch(e){h.error(we(),e)}}return(0,Q.jsx)(Ye,{open:n,onOpenChange:i,children:(0,Q.jsxs)(Ge,{className:`oc-access`,children:[(0,Q.jsxs)(Ue,{children:[(0,Q.jsx)(Ke,{children:de({name:t})}),(0,Q.jsx)(Je,{children:be()})]}),(0,Q.jsxs)(Pe,{value:x,onValueChange:S,className:`oc-access__tabs`,children:[(0,Q.jsxs)(Ne,{className:`w-full`,children:[(0,Q.jsxs)(z,{value:`members`,className:`flex-1 gap-1.5`,children:[(0,Q.jsx)($e,{size:13,"aria-hidden":!0}),ge(),s?(0,Q.jsx)(U,{variant:`secondary`,className:`oc-access__tabcount`,children:O.size}):null]}),(0,Q.jsxs)(z,{value:`agents`,className:`flex-1 gap-1.5`,children:[(0,Q.jsx)(K,{size:13,"aria-hidden":!0}),le(),s?(0,Q.jsx)(U,{variant:`secondary`,className:`oc-access__tabcount`,children:j.size}):null]}),(0,Q.jsxs)(z,{value:`charts`,className:`flex-1 gap-1.5`,children:[(0,Q.jsx)(Qe,{size:13,"aria-hidden":!0}),b(),s?(0,Q.jsx)(U,{variant:`secondary`,className:`oc-access__tabcount`,children:s.chartCount}):null]})]}),(0,Q.jsx)(B,{value:`members`,children:l===void 0||s===void 0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:m()}):l.length===0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:a()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(W,{value:g,onChange:e=>_(e.target.value),placeholder:Se(),className:`oc-access__search`}),M.length===0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:C()}):(0,Q.jsxs)(Q.Fragment,{children:[M.length>1?(0,Q.jsxs)(`div`,{className:`oc-access__row oc-access__selectall`,children:[(0,Q.jsx)(q,{checked:N===`all`?!0:N===`some`?`indeterminate`:!1,onCheckedChange:()=>void F(),"aria-label":k()}),(0,Q.jsx)(`span`,{className:`oc-access__label`,children:k()}),(0,Q.jsxs)(U,{variant:`outline`,className:`oc-access__count`,children:[ce,` / `,M.length]})]}):null,(0,Q.jsx)(`div`,{className:`oc-access__list`,children:P.pageItems.map(e=>{let t=O.has(e.userId),n=nt(e),r=ae.has(e.userId);return(0,Q.jsxs)(`div`,{className:`oc-access__row`,children:[(0,Q.jsx)(q,{checked:t,onCheckedChange:()=>void oe(e.userId,t),"aria-label":ie({user:n.primary})}),(0,Q.jsxs)(`span`,{className:`oc-access__who`,children:[(0,Q.jsx)(`span`,{className:`oc-access__label`,title:n.primary,children:n.primary}),n.secondary?(0,Q.jsx)(`span`,{className:`oc-access__sub`,title:n.secondary,children:n.secondary}):null]}),(0,Q.jsx)(U,{variant:`outline`,className:`oc-access__role`,children:rt(e.role)}),(0,Q.jsx)(`span`,{className:`oc-access__mgrslot`,children:t&&A?(0,Q.jsx)(V,{type:`button`,variant:`ghost`,size:`icon`,className:`shrink-0 oc-access__mgr${r?` oc-access__mgr--on`:``}`,"aria-pressed":r,"aria-label":r?o():Ee(),title:r?o():Ee(),onClick:()=>void se(e.userId,r),children:(0,Q.jsx)(Y,{size:15,"aria-hidden":!0})}):t&&r?(0,Q.jsx)(`span`,{className:`oc-access__mgr oc-access__mgr--on`,role:`img`,"aria-label":ne(),title:ne(),children:(0,Q.jsx)(Y,{size:15,"aria-hidden":!0})}):null})]},e._id)})}),(0,Q.jsx)(st,{page:P.page,pageCount:P.pageCount,onPage:w})]})]})}),(0,Q.jsx)(B,{value:`agents`,children:c===void 0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:m()}):c.length===0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:je()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(W,{value:v,onChange:e=>y(e.target.value),placeholder:r(),className:`oc-access__search`}),(0,Q.jsx)(`div`,{className:`oc-access__list`,children:c.map(t=>(0,Q.jsx)(lt,{groupId:e,instanceName:t.name,kind:t.kind??`openclaw`,assigned:j,query:v},`${e}-${t._id}`))})]})}),(0,Q.jsx)(B,{value:`charts`,children:(0,Q.jsx)(ut,{groupId:e})})]})]})})}function lt({groupId:e,instanceName:t,kind:n,assigned:r,query:i}){let a=E(I.groups.listAssignableAgents,{instanceName:t}),o=L(I.groups.assignAgentToGroup),s=L(I.groups.removeAgentFromGroup),c=L(I.groups.bulkSetGroupAgents),l=H(),[u,d]=(0,X.useState)(1);if((0,X.useEffect)(()=>{d(1)},[i]),!e)return null;let p=tt(a?.agents??[],i),m=a?.discovery&&!a.discovery.lastPollOk;if(i.trim()&&p.length===0)return null;let g=p.filter(e=>e.presentInLastOk!==!1&&e.enabled!==!1),_=Z(g,e=>r.has(`${t}/${e.agentId}`)),y=it(p,u,ot);async function b(n,r){try{r?await s({groupId:e,instanceName:t,agentId:n}):await o({groupId:e,instanceName:t,agentId:n})}catch(e){l.error(A(),e)}}async function x(){if(g.length===0)return;let n=g.map(e=>e.agentId);try{await c({groupId:e,instanceName:t,agentIds:n,assigned:_!==`all`})}catch(e){l.error(A(),e)}}return(0,Q.jsxs)(`div`,{className:`oc-access__group`,children:[(0,Q.jsxs)(`div`,{className:`oc-access__instance`,children:[(0,Q.jsx)(K,{size:13,"aria-hidden":!0}),(0,Q.jsx)(`span`,{children:t}),(0,Q.jsx)(U,{variant:`outline`,className:`oc-access__kind`,children:n}),m?(0,Q.jsx)(U,{variant:`outline`,className:`oc-access__stale`,children:h()}):null]}),a===void 0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:D()}):p.length===0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:m?v():ee()}):(0,Q.jsxs)(Q.Fragment,{children:[g.length>1?(0,Q.jsxs)(`div`,{className:`oc-access__row oc-access__selectall`,children:[(0,Q.jsx)(q,{checked:_===`all`?!0:_===`some`?`indeterminate`:!1,onCheckedChange:()=>void x(),"aria-label":k()}),(0,Q.jsx)(`span`,{className:`oc-access__label`,children:k()})]}):null,y.pageItems.map(e=>{let n=`${t}/${e.agentId}`,i=r.has(n),a=e.presentInLastOk===!1,o=!e.enabled;return(0,Q.jsxs)(`div`,{className:`oc-access__row${o?` is-disabled`:``}`,children:[(0,Q.jsx)(q,{checked:i,disabled:(a||o)&&!i,onCheckedChange:()=>void b(e.agentId,i),"aria-label":re({name:e.displayName??e.agentId})}),(0,Q.jsxs)(`span`,{className:`oc-access__label`,title:e.displayName??e.agentId,children:[e.emoji?`${e.emoji} `:``,e.displayName??e.agentId]}),e.model?(0,Q.jsx)(`span`,{className:`oc-access__model`,children:e.model}):null,e.isDefaultOnInstance?(0,Q.jsx)(`span`,{className:`oc-access__fav`,role:`img`,"aria-label":S(),title:S(),children:(0,Q.jsx)(G,{size:14,fill:`currentColor`})}):null,a?(0,Q.jsx)(U,{variant:`outline`,className:`oc-access__gone`,children:f()}):null]},e.agentId)}),(0,Q.jsx)(st,{page:y.page,pageCount:y.pageCount,onPage:d})]})]})}function ut({groupId:e}){let t=E(I.charts.listGroupChartSelection,e?{groupId:e}:`skip`),n=L(I.charts.assignChartToGroup),r=L(I.charts.removeChartFromGroup),a=L(I.charts.setGroupDefaultChart),o=L(I.charts.addChartToGroupPool),s=L(I.charts.removeChartFromGroupPool),c=H();if(!e)return null;if(t===void 0)return(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:m()});let{pool:d,addable:f,canManagePool:p}=t;if(d.length===0&&!p)return(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:y()});async function h(t,i){try{i?await r({groupId:e,chartKey:t}):await n({groupId:e,chartKey:t})}catch(e){c.error(R(),e)}}async function g(t){try{await a({groupId:e,chartKey:t})}catch(e){c.error(R(),e)}}async function _(t){try{await o({groupId:e,chartKey:t})}catch(e){c.error(R(),e)}}async function v(t){try{await s({groupId:e,chartKey:t})}catch(e){c.error(R(),e)}}return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`div`,{className:`oc-access__list`,children:d.map(e=>(0,Q.jsxs)(`div`,{className:`oc-access__row`,children:[(0,Q.jsx)(q,{checked:e.selected,onCheckedChange:()=>void h(e.chartKey,e.selected),"aria-label":x({name:e.name})}),(0,Q.jsx)(`span`,{className:`oc-access__label`,title:e.name,children:e.name}),e.selected?e.isDefault?(0,Q.jsx)(`span`,{className:`oc-access__fav`,role:`img`,"aria-label":l(),title:l(),children:(0,Q.jsx)(G,{size:14,fill:`currentColor`})}):(0,Q.jsx)(V,{type:`button`,variant:`ghost`,size:`sm`,onClick:()=>void g(e.chartKey),children:u()}):null,p?(0,Q.jsx)(V,{type:`button`,variant:`ghost`,size:`sm`,"aria-label":pe({name:e.name}),title:pe({name:e.name}),onClick:()=>void v(e.chartKey),children:(0,Q.jsx)(Me,{size:14,"aria-hidden":!0})}):null]},e.chartKey))}),p?f.length>0?(0,Q.jsxs)(Be,{value:``,onValueChange:e=>void _(e),children:[(0,Q.jsx)(Fe,{size:`sm`,className:`oc-access__search`,children:(0,Q.jsx)(We,{placeholder:i()})}),(0,Q.jsx)(Ve,{children:f.map(e=>(0,Q.jsx)(Re,{value:e.chartKey,children:e.name},e.chartKey))})]}):d.length===0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:fe()}):null:null]})}export{at as GroupsTab};