@lacneu/atrium 0.82.1 → 0.83.1

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 (72) hide show
  1. package/dist/assets/{AccessTab-BfGSfHkJ.js → AccessTab-Dwa8D3-K.js} +1 -1
  2. package/dist/assets/{AdvancedFilter-Dhl9vbbC.js → AdvancedFilter-3ID4qv_d.js} +1 -1
  3. package/dist/assets/{AgentFilesTab-BsFMKqxN.js → AgentFilesTab-1j8C9jVb.js} +2 -2
  4. package/dist/assets/AnomaliesTab-EzFX-Buo.js +1 -0
  5. package/dist/assets/AuditTab-bekMTb1y.js +1 -0
  6. package/dist/assets/{BridgeTab-d8LOFi5Q.js → BridgeTab-CG9yn0Is.js} +1 -1
  7. package/dist/assets/{ChatDefaultsTab-C4IhtS0f.js → ChatDefaultsTab-DyJ3_O5M.js} +1 -1
  8. package/dist/assets/{DataTableShell-CSEsiKU5.js → DataTableShell-1-eBDd8r.js} +1 -1
  9. package/dist/assets/{DetailChips-BvJrftpU.js → DetailChips-u5DvS43f.js} +1 -1
  10. package/dist/assets/FeedbacksTab-L33eDrgp.js +1 -0
  11. package/dist/assets/{FieldLabel-D831BT1G.js → FieldLabel-CZ3VfRyz.js} +1 -1
  12. package/dist/assets/FilesTab-BndeFtC6.js +1 -0
  13. package/dist/assets/{FilterBar-udwh54Yv.js → FilterBar-N2zMJz7R.js} +1 -1
  14. package/dist/assets/{GroupsTab-BZzuCNzE.js → GroupsTab-Cv5gGkOm.js} +1 -1
  15. package/dist/assets/InstancesTab-BgaeSfCo.js +1 -0
  16. package/dist/assets/{IntegrationsTab-CSTl3yAO.js → IntegrationsTab-BlRVGGSg.js} +1 -1
  17. package/dist/assets/{KpiTab-BT5sJk0f.js → KpiTab-DvkpFZv4.js} +1 -1
  18. package/dist/assets/PreferencesTab-Y61Qun_P.js +1 -0
  19. package/dist/assets/ProjectPage-CR06EfQb.js +1 -0
  20. package/dist/assets/PromptInjectionsTab-BM61xm3g.js +4 -0
  21. package/dist/assets/RolesTab-CMbsPHbj.js +1 -0
  22. package/dist/assets/ScheduledTab-B9VplcvH.js +1 -0
  23. package/dist/assets/ServiceAccountsTab-CQ_mj8_l.js +1 -0
  24. package/dist/assets/{SubAgentReportsTab-CenPwDMG.js → SubAgentReportsTab-CM8J5CTP.js} +1 -1
  25. package/dist/assets/ThemeShowroom-BxrFjxrg.js +1 -0
  26. package/dist/assets/{TimeRangePicker-C-N7Oi_O.js → TimeRangePicker-yK1328F9.js} +1 -1
  27. package/dist/assets/{TimezoneCombobox-B7yB12f8.js → TimezoneCombobox-CzTx9wPL.js} +1 -1
  28. package/dist/assets/TracesTab-B4yZnlZg.js +1 -0
  29. package/dist/assets/UsersTab-Bks9QSBZ.js +1 -0
  30. package/dist/assets/VoiceTab-GaXBCdz0.js +1 -0
  31. package/dist/assets/api-BPOlScPa.js +44 -0
  32. package/dist/assets/{button-DzIspcBY.js → button-B5OAA4fh.js} +1 -1
  33. package/dist/assets/{card-AAO0v9Vm.js → card-Dv2G1V3P.js} +1 -1
  34. package/dist/assets/chevrons-up-down-WwYjqxmn.js +1 -0
  35. package/dist/assets/{compatView-B55x_jLI.js → compatView-Ca_1Ks2z.js} +1 -1
  36. package/dist/assets/{dispatchErrorInfo-CuGiUb14.js → dispatchErrorInfo-CpxQCfFa.js} +1 -1
  37. package/dist/assets/{dist-DimWGHXr.js → dist-Bz3z-NbY.js} +1 -1
  38. package/dist/assets/{dist-kCZGRh3V.js → dist-CohYA7lf.js} +1 -1
  39. package/dist/assets/{highlighted-body-OFNGDK62-7Vs0Gyx9.js → highlighted-body-OFNGDK62-CeoAgNEn.js} +1 -1
  40. package/dist/assets/index-BFVb3Mjo.css +1 -0
  41. package/dist/assets/index-Cd7vK8g7.js +324 -0
  42. package/dist/assets/{list-CpHCJVWf.js → list-fB2wMIBf.js} +1 -1
  43. package/dist/assets/mermaid-GHXKKRXX-BUWvemOo.js +1 -0
  44. package/dist/assets/{pdf-DdjfDjYm.js → pdf-vb-5HO4B.js} +1 -1
  45. package/dist/assets/roleDescriptions-BuewtMrO.js +1 -0
  46. package/dist/assets/{table-1BG3EWti.js → table-Bgj0w4qc.js} +1 -1
  47. package/dist/assets/{tabs-BRizUL-U.js → tabs-BuQ2R5Cs.js} +1 -1
  48. package/dist/assets/x-BC9FbaDw.js +1 -0
  49. package/dist/index.html +7 -7
  50. package/package.json +1 -1
  51. package/dist/assets/AnomaliesTab-BRo33Szo.js +0 -1
  52. package/dist/assets/AuditTab-Btg9SO-3.js +0 -1
  53. package/dist/assets/FeedbacksTab-odf2CZj6.js +0 -1
  54. package/dist/assets/FilesTab-CddIvk_h.js +0 -1
  55. package/dist/assets/InstancesTab-Fz5H84bF.js +0 -1
  56. package/dist/assets/PreferencesTab-DH2fgelv.js +0 -1
  57. package/dist/assets/ProjectPage-CsIQN8Gd.js +0 -1
  58. package/dist/assets/PromptInjectionsTab-zoE2FL0G.js +0 -4
  59. package/dist/assets/RolesTab-B-9nR9hK.js +0 -1
  60. package/dist/assets/ScheduledTab-BoFpz0HW.js +0 -1
  61. package/dist/assets/ServiceAccountsTab-C16xtLqD.js +0 -1
  62. package/dist/assets/ThemeShowroom-ThcCg4YK.js +0 -1
  63. package/dist/assets/TracesTab-D95QflLo.js +0 -1
  64. package/dist/assets/UsersTab-fifwJpfR.js +0 -1
  65. package/dist/assets/VoiceTab-DleFSAIb.js +0 -1
  66. package/dist/assets/api-BKX0b765.js +0 -44
  67. package/dist/assets/chevrons-up-down-Ds54l-NQ.js +0 -1
  68. package/dist/assets/index-BbZI7MO0.js +0 -324
  69. package/dist/assets/index-DEMhzN6j.css +0 -1
  70. package/dist/assets/mermaid-GHXKKRXX-Df6cOE5v.js +0 -1
  71. package/dist/assets/roleDescriptions-Bc3Grr9Z.js +0 -1
  72. package/dist/assets/x-DP601e4A.js +0 -1
@@ -1 +1 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Cm as r,Sm as i,_m as a,bm as o,dB as s,dm as c,fm as l,gm as u,hm as d,lm as f,mm as p,nB as m,pm as h,t as g,um as _,vm as v,xm as y,ym as b}from"./api-BKX0b765.js";import{$ as x,Et as S,Q as C,X as w,Z as T,et as E}from"./index-BbZI7MO0.js";var D=t(e(),1);function O(e){return e===`user`?h():e===`all`?l():c({group:e.group})}function k(e){return e===`common`?_():e===`owner`?f():c({group:e.group})}var A=n();function j(e){return e.name||e.email||e.userId.slice(0,8)}function M(){let e=s(g.admin.listUsers,{}),[t,n]=(0,D.useState)(``),c=s(g.introspect.introspectUser,t?{userId:t}:`skip`);return(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:r()}),(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:y()}):c===void 0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:m()}):(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:o()}),(0,A.jsxs)(`div`,{className:`oc-introspect__id`,children:[(0,A.jsx)(`strong`,{children:c.user.label}),(0,A.jsx)(S,{variant:`secondary`,children:c.role})]})]}),(0,A.jsxs)(`section`,{className:`oc-introspect__section`,children:[(0,A.jsx)(`h3`,{className:`oc-introspect__title`,children:b()}),c.groups.length===0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:d()}):(0,A.jsx)(`div`,{className:`oc-introspect__chips`,children:c.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:v()}),c.agents.length===0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:d()}):(0,A.jsx)(`ul`,{className:`oc-introspect__list`,children:c.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:p()}):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:a()}),c.charts.length===0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:d()}):(0,A.jsx)(`ul`,{className:`oc-introspect__list`,children:c.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:u()}),c.permissions.length===0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:d()}):(0,A.jsx)(`div`,{className:`oc-introspect__chips`,children:c.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{Cm as r,Sm as i,_m as a,bm as o,dm as s,fm as c,gm as l,hm as u,iB as d,lm as f,mm as p,pB as m,pm as h,t as g,um as _,vm as v,xm as y,ym as b}from"./api-BPOlScPa.js";import{$ as x,Et as S,Q as C,X as w,Z as T,et as E}from"./index-Cd7vK8g7.js";var D=t(e(),1);function O(e){return e===`user`?h():e===`all`?c():s({group:e.group})}function k(e){return e===`common`?_():e===`owner`?f():s({group:e.group})}var A=n();function j(e){return e.name||e.email||e.userId.slice(0,8)}function M(){let e=m(g.admin.listUsers,{}),[t,n]=(0,D.useState)(``),s=m(g.introspect.introspectUser,t?{userId:t}:`skip`);return(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:r()}),(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:y()}):s===void 0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:d()}):(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:o()}),(0,A.jsxs)(`div`,{className:`oc-introspect__id`,children:[(0,A.jsx)(`strong`,{children:s.user.label}),(0,A.jsx)(S,{variant:`secondary`,children:s.role})]})]}),(0,A.jsxs)(`section`,{className:`oc-introspect__section`,children:[(0,A.jsx)(`h3`,{className:`oc-introspect__title`,children:b()}),s.groups.length===0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:u()}):(0,A.jsx)(`div`,{className:`oc-introspect__chips`,children:s.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:v()}),s.agents.length===0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:u()}):(0,A.jsx)(`ul`,{className:`oc-introspect__list`,children:s.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:p()}):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:a()}),s.charts.length===0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:u()}):(0,A.jsx)(`ul`,{className:`oc-introspect__list`,children:s.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:l()}),s.permissions.length===0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:u()}):(0,A.jsx)(`div`,{className:`oc-introspect__chips`,children:s.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{Bg as r,Hg as i,Ig as a,Lg as o,Rg as s,Vg as c,zg as l}from"./api-BKX0b765.js";import{t as u}from"./x-DP601e4A.js";import{t as d}from"./button-DzIspcBY.js";import{$ as f,Hn as p,Q as m,X as h,Z as g,et as _,gn as v,jt as y}from"./index-BbZI7MO0.js";import{r as b}from"./TimeRangePicker-C-N7Oi_O.js";var x=t(e(),1),S=n(),C=[{value:`eq`,label:`=`},{value:`neq`,label:`≠`},{value:`contains`,label:i()},{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 i=(0,x.useRef)(t),w=!!(i.current&&i.current.length>0),[D,O]=(0,x.useState)(w),[k,A]=(0,x.useState)(()=>w?E(i.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)(p,{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:r()}):(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)(f,{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)(f,{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)(y,{className:`oc-advfilter__value`,value:t.value,onChange:e=>M(t.id,{value:e.target.value}),placeholder:s()}),(0,S.jsx)(d,{variant:`ghost`,size:`icon-sm`,"aria-label":o(),onClick:()=>P(t.id),children:(0,S.jsx)(u,{})})]},t.id))}),(0,S.jsxs)(d,{variant:`outline`,size:`sm`,className:`oc-advfilter__add`,onClick:N,children:[(0,S.jsx)(v,{}),a()]})]}):null]})}export{D as t};
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Bg as r,Hg as i,Ig as a,Lg as o,Rg as s,Vg as c,zg as l}from"./api-BPOlScPa.js";import{t as u}from"./x-BC9FbaDw.js";import{t as d}from"./button-B5OAA4fh.js";import{$ as f,Hn as p,Q as m,X as h,Z as g,et as _,gn as v,jt as y}from"./index-Cd7vK8g7.js";import{r as b}from"./TimeRangePicker-yK1328F9.js";var x=t(e(),1),S=n(),C=[{value:`eq`,label:`=`},{value:`neq`,label:`≠`},{value:`contains`,label:i()},{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 i=(0,x.useRef)(t),w=!!(i.current&&i.current.length>0),[D,O]=(0,x.useState)(w),[k,A]=(0,x.useState)(()=>w?E(i.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)(p,{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:r()}):(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)(f,{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)(f,{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)(y,{className:`oc-advfilter__value`,value:t.value,onChange:e=>M(t.id,{value:e.target.value}),placeholder:s()}),(0,S.jsx)(d,{variant:`ghost`,size:`icon-sm`,"aria-label":o(),onClick:()=>P(t.id),children:(0,S.jsx)(u,{})})]},t.id))}),(0,S.jsxs)(d,{variant:`outline`,size:`sm`,className:`oc-advfilter__add`,onClick:N,children:[(0,S.jsx)(v,{}),a()]})]}):null]})}export{D as t};
@@ -1,3 +1,3 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$d as r,Ad as i,Ao as a,Bd as o,Bo as s,Dd as c,Do as l,Ed as u,Fd as d,Fo as f,Gd as p,Go as m,Hd as h,Ho as g,Id as _,Io as v,Jd as y,Kd as b,Ko as x,Ld as S,Lo as C,Md as ee,Mo as w,Nd as te,No as T,Od as E,Oo as D,Pd as O,Po as k,Qd as A,Rd as j,Ro as M,Ud as ne,Uo as N,Ut as re,Vd as P,Vf as F,Vo as I,Wd as L,Wo as ie,Xd as R,Yd as z,Zd as ae,ao as oe,cB as B,co as V,dB as H,do as U,ef as se,iB as W,jd as ce,jo as le,kd as ue,ko as de,lo as fe,nB as G,oo as pe,qd as me,qo as he,sM as ge,so as _e,t as K,tf as ve,uB as ye,uo as be,zd as xe,zf as Se,zo as Ce}from"./api-BKX0b765.js";import{t as q}from"./button-DzIspcBY.js";import{$ as we,B as Te,Ct as Ee,Dt as J,Et as De,Q as Oe,St as ke,Tt as Ae,X as je,Z as Me,at as Ne,bt as Pe,et as Fe,nt as Ie,ot as Le,q as Re,rt as ze,tt as Be,un as Y,vt as Ve,wt as He,xt as Ue,yt as We}from"./index-BbZI7MO0.js";import{n as Ge,t as Ke}from"./curation-CQksaIbm.js";import{a as qe}from"./compatView-B55x_jLI.js";/* empty css */var X=t(e(),1),Je=2e4,Ye=6e4;function Xe(e){return typeof e!=`number`||e<=0?0:Math.round(e/Je*100)}function Ze(e){return e<=0?0:Math.round(e/Ye*100)}function Z(e,t){let n=(typeof e==`number`&&e>0?e:0)/1e3;return new Intl.NumberFormat(t,{minimumFractionDigits:1,maximumFractionDigits:1}).format(n)}function Qe(e){return e.reduce((e,t)=>e+(typeof t.size==`number`&&t.size>0?t.size:0),0)}var $e=3;function et(e,t){let n=new Map;for(let t of e.split(`
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$d as r,Ad as i,Ao as a,Bd as o,Bo as s,Dd as c,Do as l,Ed as u,Fd as d,Fo as f,Gd as p,Go as m,Hd as h,Ho as g,Id as _,Io as v,Jd as y,Kd as b,Ko as x,Ld as S,Lo as C,Md as ee,Mo as w,Nd as te,No as T,Od as E,Oo as D,Pd as O,Po as k,Qd as A,Rd as j,Ro as M,Ud as ne,Uo as N,Ut as re,Vd as P,Vf as F,Vo as I,Wd as L,Wo as ie,Xd as R,Yd as z,Zd as ae,ao as oe,co as B,do as V,ef as se,fB as ce,iB as H,jd as le,jo as ue,kd as de,ko as fe,lM as pe,lo as me,oB as U,oo as he,pB as W,qd as ge,qo as _e,so as ve,t as G,tf as ye,uB as K,uo as be,zd as xe,zf as Se,zo as Ce}from"./api-BPOlScPa.js";import{t as q}from"./button-B5OAA4fh.js";import{$ as we,B as Te,Ct as Ee,Dt as J,Et as De,Q as Oe,St as ke,Tt as Ae,X as je,Z as Me,at as Ne,bt as Pe,et as Fe,nt as Ie,ot as Le,q as Re,rt as ze,tt as Be,un as Y,vt as Ve,wt as He,xt as Ue,yt as We}from"./index-Cd7vK8g7.js";import{n as Ge,t as Ke}from"./curation-CQksaIbm.js";import{a as qe}from"./compatView-Ca_1Ks2z.js";/* empty css */var X=t(e(),1),Je=2e4,Ye=6e4;function Xe(e){return typeof e!=`number`||e<=0?0:Math.round(e/Je*100)}function Ze(e){return e<=0?0:Math.round(e/Ye*100)}function Z(e,t){let n=(typeof e==`number`&&e>0?e:0)/1e3;return new Intl.NumberFormat(t,{minimumFractionDigits:1,maximumFractionDigits:1}).format(n)}function Qe(e){return e.reduce((e,t)=>e+(typeof t.size==`number`&&t.size>0?t.size:0),0)}var $e=3;function et(e,t){let n=new Map;for(let t of e.split(`
2
2
  `))n.set(t,(n.get(t)??0)+1);for(let e of t.split(`
3
- `))n.set(e,(n.get(e)??0)-1);let r=0,i=0,a=[],o=[];for(let[e,t]of n)t<0?(r+=-t,a.length<$e&&a.push(e)):t>0&&(i+=t,o.length<$e&&o.push(e));return{added:r,removed:i,sampleAdded:a,sampleRemoved:o}}function tt(e){return(e instanceof Error?e.message:String(e)).includes(`DASHBOARD_NOT_DEPLOYED`)}function nt(e){return e instanceof Error?e.message.includes(`conflict:`):String(e).includes(`conflict:`)}var Q=n(),$=e=>`${e.instanceName}::${e.agentId}`;function rt(){let e=H(K.me.getMe,{host:Re}),t=e?.role===`admin`,n=(e?.permissions??[]).includes(`bridge.read`),i=H(K.admin.listInstances,e!==void 0&&t?{}:`skip`),[a,o]=(0,X.useState)(null);(0,X.useEffect)(()=>{!t||!i||i.length===0||(!a||!i.some(e=>e.name===a))&&o(i[0].name)},[t,i,a]);let s=H(K.agents.listAgentsForInstance,t&&a?{instanceName:a}:`skip`),c=H(K.agents.listMyAgents,e!==void 0&&!t?{}:`skip`),l=(0,X.useMemo)(()=>{if(e!==void 0){if(t)return a===null||s===void 0?i!==void 0&&i.length===0?[]:void 0:s.agents.map(e=>({instanceName:a,agentId:e.agentId,label:`${e.emoji?`${e.emoji} `:``}${e.displayName??e.agentId}`}));if(c!==void 0)return c.map(e=>({instanceName:e.instanceName,agentId:e.agentId,label:`${e.emoji?`${e.emoji} `:``}${e.displayName??e.agentId}`}))}},[e,t,a,s,i,c]),[u,d]=(0,X.useState)(null);(0,X.useEffect)(()=>{!l||l.length===0||(!u||!l.some(e=>$(e)===u))&&d($(l[0]))},[l,u]);let f=l?.find(e=>$(e)===u)??null,m=B(K.agentFiles.listAgentFiles),[h,_]=(0,X.useState)({status:`idle`}),v=f?.instanceName??null,x=f?.agentId??null,S=H(K.compat.forInstance,n&&v!==null?{instanceName:v}:`skip`),C=n&&v!==null?Te(S,`agentFiles`):null,ee=C===null?!1:C===`loading`?null:C.blocked,w=(0,X.useCallback)(async()=>{if(!(v===null||x===null)){_({status:`loading`});try{_({status:`done`,files:(await m({instanceName:v,agentId:x})).files})}catch(e){_({status:`error`,dashboardAbsent:tt(e)})}}},[m,v,x]);(0,X.useEffect)(()=>{ee===!1&&w()},[w,ee]);let[te,T]=(0,X.useState)(null),E=H(K.agentFileCuration.listCurations,t&&v!==null&&x!==null?{instanceName:v,agentId:x}:`skip`),D=H(K.agentFileCuration.curationSettings,t&&v!==null?{instanceName:v}:`skip`),O=B(K.agentFileCuration.requestCuration),[k,j]=(0,X.useState)(null),[M,P]=(0,X.useState)(null),{toast:F}=J(),I=(0,X.useMemo)(()=>{let e=new Map;for(let t of E??[])e.has(t.name)||e.set(t.name,t);return e},[E]),oe=(0,X.useCallback)(async e=>{if(!(v===null||x===null)){j(e);try{let t=await O({instanceName:v,agentId:x,name:e,trigger:`manual`});t.ok?F({title:ie(),variant:`success`}):F({title:N({reason:t.reason??`unknown`}),variant:`error`})}catch{F({title:g(),variant:`error`})}finally{j(null)}}},[O,v,x,F]),V=W(),U=(0,X.useMemo)(()=>new Intl.NumberFormat(V,{maximumFractionDigits:0}),[V]);return e===void 0||l===void 0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:G()}):(0,Q.jsxs)(`div`,{className:`oc-afiles`,children:[(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:ve()}),(0,Q.jsxs)(`div`,{className:`oc-afiles__picker`,children:[t&&(i?.length??0)>1?(0,Q.jsxs)(je,{value:a??``,onValueChange:e=>o(e),children:[(0,Q.jsx)(we,{size:`sm`,"aria-label":se(),children:(0,Q.jsx)(Fe,{})}),(0,Q.jsx)(Me,{children:(i??[]).map(e=>(0,Q.jsx)(Oe,{value:e.name,children:e.name},e.name))})]}):null,l.length>0?(0,Q.jsxs)(je,{value:u??``,onValueChange:e=>d(e),children:[(0,Q.jsx)(we,{size:`sm`,"aria-label":r(),children:(0,Q.jsx)(Fe,{})}),(0,Q.jsx)(Me,{children:l.map(e=>(0,Q.jsx)(Oe,{value:$(e),children:e.label},$(e)))})]}):(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:A()})]}),f===null?null:C===`loading`?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:G()}):C!==null&&C.blocked?(0,Q.jsxs)(`p`,{className:`oc-compat__blocked`,role:`status`,children:[(0,Q.jsx)(Y,{size:14,"aria-hidden":!0}),` `,qe(C.gatewayVersion,C.provider)]}):h.status===`loading`||h.status===`idle`?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:G()}):h.status===`error`?(0,Q.jsxs)(`p`,{className:`oc-afiles__error`,role:`alert`,children:[h.dashboardAbsent?re():R(),` `,!h.dashboardAbsent&&(0,Q.jsx)(q,{variant:`outline`,size:`sm`,onClick:()=>void w(),children:Se()})]}):h.files.length===0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:ae()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`div`,{className:`oc-afiles__list`,children:h.files.map(e=>{let n=Xe(e.size),r=n>=80;return(0,Q.jsxs)(`div`,{className:`oc-afiles__row`,children:[(0,Q.jsx)(`span`,{className:`oc-afiles__name`,title:e.name,children:e.name}),e.missing?(0,Q.jsx)(De,{variant:`outline`,children:z()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`span`,{className:`oc-afiles__size`,children:y({size:Z(e.size,V)})}),(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:me({pct:U.format(n)})}),r?(0,Q.jsx)(Y,{size:14,className:`oc-afiles__warn`,"aria-label":b()}):(0,Q.jsx)(`span`,{className:`oc-afiles__warn-slot`,"aria-hidden":!0})]}),(0,Q.jsx)(q,{variant:`outline`,size:`sm`,className:`oc-afiles__open`,onClick:()=>T(e),children:t?L():ne()}),t&&!e.missing?(0,Q.jsx)(it,{curatable:Ke.includes(e.name),size:e.size??0,budget:D?.budgetChars??null,enabled:D?.enabled??!1,curation:I.get(e.name)??null,inFlight:k===e.name,onCurate:()=>void oe(e.name),onReview:e=>P(e)}):null]},e.name)})}),(0,Q.jsx)(`p`,{className:`oc-afiles__budget`,children:p({used:Z(Qe(h.files),V),total:Z(Ye,V),pct:U.format(Ze(Qe(h.files)))})})]}),te&&f?(0,Q.jsx)(at,{instanceName:f.instanceName,agentId:f.agentId,name:te.name,isAdmin:t,onClose:()=>T(null),onSaved:()=>void w()}):null,M?(0,Q.jsx)(ot,{curationId:M,onClose:()=>P(null),onApplied:()=>{P(null),w()}}):null]})}function it({curatable:e,size:t,budget:n,enabled:r,curation:i,inFlight:a,onCurate:o,onReview:s}){return i?.status===`proposed`?(0,Q.jsx)(q,{variant:`default`,size:`sm`,className:`oc-afiles__curate`,onClick:()=>s(i._id),children:x()}):a||i?.status===`dispatched`||i?.status===`applying`?(0,Q.jsx)(De,{variant:`outline`,className:`oc-afiles__curate-status`,children:m()}):e&&r&&n!==null&&Ge(t,n)?(0,Q.jsx)(q,{variant:`outline`,size:`sm`,className:`oc-afiles__curate`,onClick:o,children:he()}):null}function at({instanceName:e,agentId:t,name:n,isAdmin:r,onClose:a,onSaved:s}){let l=B(K.agentFiles.getAgentFile),f=B(K.agentFiles.setAgentFile),p=J(),[m,g]=(0,X.useState)(null),[v,y]=(0,X.useState)(!1),[b,x]=(0,X.useState)(``),[C,w]=(0,X.useState)(!1),[T,D]=(0,X.useState)(!1),[k,A]=(0,X.useState)(!1),[M,ne]=(0,X.useState)(!1),N=(0,X.useCallback)(async r=>{y(!1);try{let i=await l({instanceName:e,agentId:t,name:n});g({content:i.content,updatedAtMs:i.updatedAtMs}),r||x(i.content),A(!1)}catch{y(!0)}},[l,e,t,n]);(0,X.useEffect)(()=>{N(!1)},[N]);async function re(){if(m!==null){D(!0),ne(!1);try{await f({instanceName:e,agentId:t,name:n,content:b,baseUpdatedAtMs:m.updatedAtMs??void 0}),p.success(_({name:n})),s(),await N(!1)}catch(e){nt(e)?A(!0):ne(!0)}finally{D(!1)}}}let I=m!==null&&b!==m.content,L=(0,X.useMemo)(()=>m===null?null:et(m.content,b),[m,b]),ie=b.length>Je,R=W(),z=(0,X.useMemo)(()=>new Intl.NumberFormat(R),[R]);return(0,Q.jsx)(Be,{open:!0,onOpenChange:e=>!e&&a(),children:(0,Q.jsxs)(Ie,{className:`oc-afiles__editor`,children:[(0,Q.jsxs)(Ne,{children:[(0,Q.jsx)(Le,{children:h({name:n})}),(0,Q.jsxs)(ze,{children:[P({agent:t,instance:e}),r?null:(0,Q.jsxs)(Q.Fragment,{children:[` · `,o()]})]})]}),v?(0,Q.jsxs)(`p`,{className:`oc-afiles__error`,role:`alert`,children:[O(),` `,(0,Q.jsx)(q,{variant:`outline`,size:`sm`,onClick:()=>void N(!1),children:Se()})]}):m===null?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:G()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`textarea`,{className:`oc-afiles__source`,value:b,readOnly:!r,spellCheck:!1,onChange:e=>x(e.target.value),"aria-label":h({name:n})}),(0,Q.jsx)(`p`,{className:`oc-afiles__hint`,children:xe()}),k?(0,Q.jsxs)(`p`,{className:`oc-afiles__error`,role:`alert`,children:[te(),` `,(0,Q.jsx)(q,{variant:`outline`,size:`sm`,onClick:()=>void N(!0),children:ee()})]}):null,M?(0,Q.jsx)(`p`,{className:`oc-afiles__error`,role:`alert`,children:d()}):null,(0,Q.jsxs)(`div`,{className:`oc-afiles__editor-foot`,children:[(0,Q.jsx)(`span`,{className:`oc-afiles__count${ie?` is-over`:``}`,children:j({count:z.format(b.length),max:z.format(Je)})}),r?(0,Q.jsx)(q,{size:`sm`,disabled:!I||T||k,onClick:()=>w(!0),children:T?F():S()}):null]})]}),(0,Q.jsx)(Ve,{open:C,onOpenChange:w,children:(0,Q.jsxs)(Ue,{children:[(0,Q.jsxs)(He,{children:[(0,Q.jsx)(Ae,{children:ce({name:n})}),(0,Q.jsx)(ke,{children:i({agent:t})})]}),L?(0,Q.jsxs)(`div`,{className:`oc-afiles__diff`,children:[(0,Q.jsx)(`p`,{className:`oc-afiles__diff-counts`,children:ue({added:L.added,removed:L.removed})}),L.sampleAdded.length>0?(0,Q.jsxs)(`div`,{className:`oc-afiles__diff-block`,children:[(0,Q.jsx)(`span`,{className:`oc-afiles__diff-label`,children:E()}),L.sampleAdded.map((e,t)=>(0,Q.jsx)(`code`,{className:`oc-afiles__diff-line is-add`,children:e||` `},t))]}):null,L.sampleRemoved.length>0?(0,Q.jsxs)(`div`,{className:`oc-afiles__diff-block`,children:[(0,Q.jsx)(`span`,{className:`oc-afiles__diff-label`,children:c()}),L.sampleRemoved.map((e,t)=>(0,Q.jsx)(`code`,{className:`oc-afiles__diff-line is-del`,children:e||` `},t))]}):null]}):null,(0,Q.jsxs)(Ee,{children:[(0,Q.jsx)(Pe,{children:ge()}),(0,Q.jsx)(We,{onClick:()=>void re(),children:u()})]})]})})]})})}function ot({curationId:e,onClose:t,onApplied:n}){let r=H(K.agentFileCuration.getProposal,{curationId:e}),i=B(K.agentFileCuration.approveCuration),o=ye(K.agentFileCuration.rejectCuration),{toast:c}=J(),[u,d]=(0,X.useState)(null),[p,m]=(0,X.useState)(!1),[h,_]=(0,X.useState)(``),y=W(),b=(0,X.useMemo)(()=>r?et(r.beforeContent,r.proposedContent):null,[r]);async function x(){d(`approve`);try{let t=await i({curationId:e});t.ok?(c({title:I(),variant:`success`}),n()):c({title:t.reason===`conflict`?Ce():M({reason:t.reason??`unknown`}),variant:`error`})}catch{c({title:g(),variant:`error`})}finally{d(null)}}async function S(n){d(`reject`);try{let r=h.trim();(await o({curationId:e,...r?{comment:r}:{},relaunch:n})).ok?c({title:n?pe():s(),variant:`success`}):c({title:f(),variant:`error`}),t()}catch{c({title:g(),variant:`error`})}finally{d(null)}}return(0,Q.jsx)(Be,{open:!0,onOpenChange:e=>e?void 0:t(),children:(0,Q.jsxs)(Ie,{className:`oc-afiles__review`,children:[(0,Q.jsxs)(Ne,{children:[(0,Q.jsx)(Le,{children:r?C({name:r.name}):G()}),(0,Q.jsx)(ze,{children:v()})]}),r===void 0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:G()}):r===null?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:f()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`p`,{className:`oc-afiles__review-sizes`,children:[k({before:Z(r.beforeSize,y),after:Z(r.proposedSize,y)}),r.overBudget?(0,Q.jsxs)(Q.Fragment,{children:[` `,(0,Q.jsx)(Y,{size:13,"aria-hidden":!0}),` `,T()]}):null]}),b?(0,Q.jsx)(`p`,{className:`oc-afiles__review-diff`,children:w({added:b.added,removed:b.removed})}):null,r.feedback?(0,Q.jsx)(`p`,{className:`oc-afiles__review-feedback`,children:oe({feedback:r.feedback})}):null,b&&b.sampleRemoved.length>0?(0,Q.jsxs)(`div`,{className:`oc-afiles__review-removed`,children:[(0,Q.jsx)(`p`,{className:`oc-afiles__review-label`,children:l()}),(0,Q.jsx)(`ul`,{children:b.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:D()}),(0,Q.jsx)(`pre`,{className:`oc-afiles__review-pre`,children:r.beforeContent})]}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`p`,{className:`oc-afiles__review-label`,children:le()}),(0,Q.jsx)(`pre`,{className:`oc-afiles__review-pre`,children:r.proposedContent})]})]})]}),p?(0,Q.jsxs)(`div`,{className:`oc-afiles__reject-form`,children:[(0,Q.jsx)(`label`,{className:`oc-afiles__review-label`,htmlFor:`curation-reject-comment`,children:U()}),(0,Q.jsx)(`textarea`,{id:`curation-reject-comment`,className:`oc-afiles__reject-textarea`,rows:3,placeholder:be(),value:h,onChange:e=>_(e.target.value)}),(0,Q.jsxs)(`div`,{className:`oc-afiles__review-actions`,children:[(0,Q.jsx)(q,{variant:`ghost`,onClick:()=>m(!1),disabled:u!==null,children:fe()}),(0,Q.jsx)(q,{variant:`outline`,onClick:()=>void S(!1),disabled:u!==null,children:u===`reject`?F():V()}),(0,Q.jsx)(q,{variant:`default`,onClick:()=>void S(!0),disabled:u!==null,children:u===`reject`?F():_e()})]})]}):(0,Q.jsxs)(`div`,{className:`oc-afiles__review-actions`,children:[(0,Q.jsx)(q,{variant:`outline`,onClick:()=>m(!0),disabled:u!==null||r==null,children:a()}),(0,Q.jsx)(q,{variant:`default`,onClick:()=>void x(),disabled:u!==null||r==null,children:u===`approve`?F():de()})]})]})})}export{rt as AgentFilesTab};
3
+ `))n.set(e,(n.get(e)??0)-1);let r=0,i=0,a=[],o=[];for(let[e,t]of n)t<0?(r+=-t,a.length<$e&&a.push(e)):t>0&&(i+=t,o.length<$e&&o.push(e));return{added:r,removed:i,sampleAdded:a,sampleRemoved:o}}function tt(e){return(e instanceof Error?e.message:String(e)).includes(`DASHBOARD_NOT_DEPLOYED`)}function nt(e){return e instanceof Error?e.message.includes(`conflict:`):String(e).includes(`conflict:`)}var Q=n(),$=e=>`${e.instanceName}::${e.agentId}`;function rt(){let e=W(G.me.getMe,{host:Re}),t=e?.role===`admin`,n=(e?.permissions??[]).includes(`bridge.read`),i=W(G.admin.listInstances,e!==void 0&&t?{}:`skip`),[a,o]=(0,X.useState)(null);(0,X.useEffect)(()=>{!t||!i||i.length===0||(!a||!i.some(e=>e.name===a))&&o(i[0].name)},[t,i,a]);let s=W(G.agents.listAgentsForInstance,t&&a?{instanceName:a}:`skip`),c=W(G.agents.listMyAgents,e!==void 0&&!t?{}:`skip`),l=(0,X.useMemo)(()=>{if(e!==void 0){if(t)return a===null||s===void 0?i!==void 0&&i.length===0?[]:void 0:s.agents.map(e=>({instanceName:a,agentId:e.agentId,label:`${e.emoji?`${e.emoji} `:``}${e.displayName??e.agentId}`}));if(c!==void 0)return c.map(e=>({instanceName:e.instanceName,agentId:e.agentId,label:`${e.emoji?`${e.emoji} `:``}${e.displayName??e.agentId}`}))}},[e,t,a,s,i,c]),[u,d]=(0,X.useState)(null);(0,X.useEffect)(()=>{!l||l.length===0||(!u||!l.some(e=>$(e)===u))&&d($(l[0]))},[l,u]);let f=l?.find(e=>$(e)===u)??null,m=K(G.agentFiles.listAgentFiles),[h,_]=(0,X.useState)({status:`idle`}),v=f?.instanceName??null,x=f?.agentId??null,S=W(G.compat.forInstance,n&&v!==null?{instanceName:v}:`skip`),C=n&&v!==null?Te(S,`agentFiles`):null,ee=C===null?!1:C===`loading`?null:C.blocked,w=(0,X.useCallback)(async()=>{if(!(v===null||x===null)){_({status:`loading`});try{_({status:`done`,files:(await m({instanceName:v,agentId:x})).files})}catch(e){_({status:`error`,dashboardAbsent:tt(e)})}}},[m,v,x]);(0,X.useEffect)(()=>{ee===!1&&w()},[w,ee]);let[te,T]=(0,X.useState)(null),E=W(G.agentFileCuration.listCurations,t&&v!==null&&x!==null?{instanceName:v,agentId:x}:`skip`),D=W(G.agentFileCuration.curationSettings,t&&v!==null?{instanceName:v}:`skip`),O=K(G.agentFileCuration.requestCuration),[k,j]=(0,X.useState)(null),[M,P]=(0,X.useState)(null),{toast:F}=J(),I=(0,X.useMemo)(()=>{let e=new Map;for(let t of E??[])e.has(t.name)||e.set(t.name,t);return e},[E]),oe=(0,X.useCallback)(async e=>{if(!(v===null||x===null)){j(e);try{let t=await O({instanceName:v,agentId:x,name:e,trigger:`manual`});t.ok?F({title:ie(),variant:`success`}):F({title:N({reason:t.reason??`unknown`}),variant:`error`})}catch{F({title:g(),variant:`error`})}finally{j(null)}}},[O,v,x,F]),B=U(),V=(0,X.useMemo)(()=>new Intl.NumberFormat(B,{maximumFractionDigits:0}),[B]);return e===void 0||l===void 0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:H()}):(0,Q.jsxs)(`div`,{className:`oc-afiles`,children:[(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:ye()}),(0,Q.jsxs)(`div`,{className:`oc-afiles__picker`,children:[t&&(i?.length??0)>1?(0,Q.jsxs)(je,{value:a??``,onValueChange:e=>o(e),children:[(0,Q.jsx)(we,{size:`sm`,"aria-label":se(),children:(0,Q.jsx)(Fe,{})}),(0,Q.jsx)(Me,{children:(i??[]).map(e=>(0,Q.jsx)(Oe,{value:e.name,children:e.name},e.name))})]}):null,l.length>0?(0,Q.jsxs)(je,{value:u??``,onValueChange:e=>d(e),children:[(0,Q.jsx)(we,{size:`sm`,"aria-label":r(),children:(0,Q.jsx)(Fe,{})}),(0,Q.jsx)(Me,{children:l.map(e=>(0,Q.jsx)(Oe,{value:$(e),children:e.label},$(e)))})]}):(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:A()})]}),f===null?null:C===`loading`?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:H()}):C!==null&&C.blocked?(0,Q.jsxs)(`p`,{className:`oc-compat__blocked`,role:`status`,children:[(0,Q.jsx)(Y,{size:14,"aria-hidden":!0}),` `,qe(C.gatewayVersion,C.provider)]}):h.status===`loading`||h.status===`idle`?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:H()}):h.status===`error`?(0,Q.jsxs)(`p`,{className:`oc-afiles__error`,role:`alert`,children:[h.dashboardAbsent?re():R(),` `,!h.dashboardAbsent&&(0,Q.jsx)(q,{variant:`outline`,size:`sm`,onClick:()=>void w(),children:Se()})]}):h.files.length===0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:ae()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`div`,{className:`oc-afiles__list`,children:h.files.map(e=>{let n=Xe(e.size),r=n>=80;return(0,Q.jsxs)(`div`,{className:`oc-afiles__row`,children:[(0,Q.jsx)(`span`,{className:`oc-afiles__name`,title:e.name,children:e.name}),e.missing?(0,Q.jsx)(De,{variant:`outline`,children:z()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`span`,{className:`oc-afiles__size`,children:y({size:Z(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:ge({pct:V.format(n)})}),r?(0,Q.jsx)(Y,{size:14,className:`oc-afiles__warn`,"aria-label":b()}):(0,Q.jsx)(`span`,{className:`oc-afiles__warn-slot`,"aria-hidden":!0})]}),(0,Q.jsx)(q,{variant:`outline`,size:`sm`,className:`oc-afiles__open`,onClick:()=>T(e),children:t?L():ne()}),t&&!e.missing?(0,Q.jsx)(it,{curatable:Ke.includes(e.name),size:e.size??0,budget:D?.budgetChars??null,enabled:D?.enabled??!1,curation:I.get(e.name)??null,inFlight:k===e.name,onCurate:()=>void oe(e.name),onReview:e=>P(e)}):null]},e.name)})}),(0,Q.jsx)(`p`,{className:`oc-afiles__budget`,children:p({used:Z(Qe(h.files),B),total:Z(Ye,B),pct:V.format(Ze(Qe(h.files)))})})]}),te&&f?(0,Q.jsx)(at,{instanceName:f.instanceName,agentId:f.agentId,name:te.name,isAdmin:t,onClose:()=>T(null),onSaved:()=>void w()}):null,M?(0,Q.jsx)(ot,{curationId:M,onClose:()=>P(null),onApplied:()=>{P(null),w()}}):null]})}function it({curatable:e,size:t,budget:n,enabled:r,curation:i,inFlight:a,onCurate:o,onReview:s}){return i?.status===`proposed`?(0,Q.jsx)(q,{variant:`default`,size:`sm`,className:`oc-afiles__curate`,onClick:()=>s(i._id),children:x()}):a||i?.status===`dispatched`||i?.status===`applying`?(0,Q.jsx)(De,{variant:`outline`,className:`oc-afiles__curate-status`,children:m()}):e&&r&&n!==null&&Ge(t,n)?(0,Q.jsx)(q,{variant:`outline`,size:`sm`,className:`oc-afiles__curate`,onClick:o,children:_e()}):null}function at({instanceName:e,agentId:t,name:n,isAdmin:r,onClose:a,onSaved:s}){let l=K(G.agentFiles.getAgentFile),f=K(G.agentFiles.setAgentFile),p=J(),[m,g]=(0,X.useState)(null),[v,y]=(0,X.useState)(!1),[b,x]=(0,X.useState)(``),[C,w]=(0,X.useState)(!1),[T,D]=(0,X.useState)(!1),[k,A]=(0,X.useState)(!1),[M,ne]=(0,X.useState)(!1),N=(0,X.useCallback)(async r=>{y(!1);try{let i=await l({instanceName:e,agentId:t,name:n});g({content:i.content,updatedAtMs:i.updatedAtMs}),r||x(i.content),A(!1)}catch{y(!0)}},[l,e,t,n]);(0,X.useEffect)(()=>{N(!1)},[N]);async function re(){if(m!==null){D(!0),ne(!1);try{await f({instanceName:e,agentId:t,name:n,content:b,baseUpdatedAtMs:m.updatedAtMs??void 0}),p.success(_({name:n})),s(),await N(!1)}catch(e){nt(e)?A(!0):ne(!0)}finally{D(!1)}}}let I=m!==null&&b!==m.content,L=(0,X.useMemo)(()=>m===null?null:et(m.content,b),[m,b]),ie=b.length>Je,R=U(),z=(0,X.useMemo)(()=>new Intl.NumberFormat(R),[R]);return(0,Q.jsx)(Be,{open:!0,onOpenChange:e=>!e&&a(),children:(0,Q.jsxs)(Ie,{className:`oc-afiles__editor`,children:[(0,Q.jsxs)(Ne,{children:[(0,Q.jsx)(Le,{children:h({name:n})}),(0,Q.jsxs)(ze,{children:[P({agent:t,instance:e}),r?null:(0,Q.jsxs)(Q.Fragment,{children:[` · `,o()]})]})]}),v?(0,Q.jsxs)(`p`,{className:`oc-afiles__error`,role:`alert`,children:[O(),` `,(0,Q.jsx)(q,{variant:`outline`,size:`sm`,onClick:()=>void N(!1),children:Se()})]}):m===null?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:H()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`textarea`,{className:`oc-afiles__source`,value:b,readOnly:!r,spellCheck:!1,onChange:e=>x(e.target.value),"aria-label":h({name:n})}),(0,Q.jsx)(`p`,{className:`oc-afiles__hint`,children:xe()}),k?(0,Q.jsxs)(`p`,{className:`oc-afiles__error`,role:`alert`,children:[te(),` `,(0,Q.jsx)(q,{variant:`outline`,size:`sm`,onClick:()=>void N(!0),children:ee()})]}):null,M?(0,Q.jsx)(`p`,{className:`oc-afiles__error`,role:`alert`,children:d()}):null,(0,Q.jsxs)(`div`,{className:`oc-afiles__editor-foot`,children:[(0,Q.jsx)(`span`,{className:`oc-afiles__count${ie?` is-over`:``}`,children:j({count:z.format(b.length),max:z.format(Je)})}),r?(0,Q.jsx)(q,{size:`sm`,disabled:!I||T||k,onClick:()=>w(!0),children:T?F():S()}):null]})]}),(0,Q.jsx)(Ve,{open:C,onOpenChange:w,children:(0,Q.jsxs)(Ue,{children:[(0,Q.jsxs)(He,{children:[(0,Q.jsx)(Ae,{children:le({name:n})}),(0,Q.jsx)(ke,{children:i({agent:t})})]}),L?(0,Q.jsxs)(`div`,{className:`oc-afiles__diff`,children:[(0,Q.jsx)(`p`,{className:`oc-afiles__diff-counts`,children:de({added:L.added,removed:L.removed})}),L.sampleAdded.length>0?(0,Q.jsxs)(`div`,{className:`oc-afiles__diff-block`,children:[(0,Q.jsx)(`span`,{className:`oc-afiles__diff-label`,children:E()}),L.sampleAdded.map((e,t)=>(0,Q.jsx)(`code`,{className:`oc-afiles__diff-line is-add`,children:e||` `},t))]}):null,L.sampleRemoved.length>0?(0,Q.jsxs)(`div`,{className:`oc-afiles__diff-block`,children:[(0,Q.jsx)(`span`,{className:`oc-afiles__diff-label`,children:c()}),L.sampleRemoved.map((e,t)=>(0,Q.jsx)(`code`,{className:`oc-afiles__diff-line is-del`,children:e||` `},t))]}):null]}):null,(0,Q.jsxs)(Ee,{children:[(0,Q.jsx)(Pe,{children:pe()}),(0,Q.jsx)(We,{onClick:()=>void re(),children:u()})]})]})})]})})}function ot({curationId:e,onClose:t,onApplied:n}){let r=W(G.agentFileCuration.getProposal,{curationId:e}),i=K(G.agentFileCuration.approveCuration),o=ce(G.agentFileCuration.rejectCuration),{toast:c}=J(),[u,d]=(0,X.useState)(null),[p,m]=(0,X.useState)(!1),[h,_]=(0,X.useState)(``),y=U(),b=(0,X.useMemo)(()=>r?et(r.beforeContent,r.proposedContent):null,[r]);async function x(){d(`approve`);try{let t=await i({curationId:e});t.ok?(c({title:I(),variant:`success`}),n()):c({title:t.reason===`conflict`?Ce():M({reason:t.reason??`unknown`}),variant:`error`})}catch{c({title:g(),variant:`error`})}finally{d(null)}}async function S(n){d(`reject`);try{let r=h.trim();(await o({curationId:e,...r?{comment:r}:{},relaunch:n})).ok?c({title:n?he():s(),variant:`success`}):c({title:f(),variant:`error`}),t()}catch{c({title:g(),variant:`error`})}finally{d(null)}}return(0,Q.jsx)(Be,{open:!0,onOpenChange:e=>e?void 0:t(),children:(0,Q.jsxs)(Ie,{className:`oc-afiles__review`,children:[(0,Q.jsxs)(Ne,{children:[(0,Q.jsx)(Le,{children:r?C({name:r.name}):H()}),(0,Q.jsx)(ze,{children:v()})]}),r===void 0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:H()}):r===null?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:f()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`p`,{className:`oc-afiles__review-sizes`,children:[k({before:Z(r.beforeSize,y),after:Z(r.proposedSize,y)}),r.overBudget?(0,Q.jsxs)(Q.Fragment,{children:[` `,(0,Q.jsx)(Y,{size:13,"aria-hidden":!0}),` `,T()]}):null]}),b?(0,Q.jsx)(`p`,{className:`oc-afiles__review-diff`,children:w({added:b.added,removed:b.removed})}):null,r.feedback?(0,Q.jsx)(`p`,{className:`oc-afiles__review-feedback`,children:oe({feedback:r.feedback})}):null,b&&b.sampleRemoved.length>0?(0,Q.jsxs)(`div`,{className:`oc-afiles__review-removed`,children:[(0,Q.jsx)(`p`,{className:`oc-afiles__review-label`,children:l()}),(0,Q.jsx)(`ul`,{children:b.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:D()}),(0,Q.jsx)(`pre`,{className:`oc-afiles__review-pre`,children:r.beforeContent})]}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`p`,{className:`oc-afiles__review-label`,children:ue()}),(0,Q.jsx)(`pre`,{className:`oc-afiles__review-pre`,children:r.proposedContent})]})]})]}),p?(0,Q.jsxs)(`div`,{className:`oc-afiles__reject-form`,children:[(0,Q.jsx)(`label`,{className:`oc-afiles__review-label`,htmlFor:`curation-reject-comment`,children:V()}),(0,Q.jsx)(`textarea`,{id:`curation-reject-comment`,className:`oc-afiles__reject-textarea`,rows:3,placeholder:be(),value:h,onChange:e=>_(e.target.value)}),(0,Q.jsxs)(`div`,{className:`oc-afiles__review-actions`,children:[(0,Q.jsx)(q,{variant:`ghost`,onClick:()=>m(!1),disabled:u!==null,children:me()}),(0,Q.jsx)(q,{variant:`outline`,onClick:()=>void S(!1),disabled:u!==null,children:u===`reject`?F():B()}),(0,Q.jsx)(q,{variant:`default`,onClick:()=>void S(!0),disabled:u!==null,children:u===`reject`?F():ve()})]})]}):(0,Q.jsxs)(`div`,{className:`oc-afiles__review-actions`,children:[(0,Q.jsx)(q,{variant:`outline`,onClick:()=>m(!0),disabled:u!==null||r==null,children:a()}),(0,Q.jsx)(q,{variant:`default`,onClick:()=>void x(),disabled:u!==null||r==null,children:u===`approve`?F():fe()})]})]})})}export{rt as AgentFilesTab};
@@ -0,0 +1 @@
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$C as r,Aw as i,BC as a,Cw as ee,Dw as te,Ew as ne,GC as re,HC as o,JC as s,KC as c,LC as l,Mw as u,Ow as ie,QC as ae,RC as d,Sw as oe,Tw as se,UC as f,VC as p,WC as m,XC as ce,YC as le,ZC as ue,_w as de,aw as fe,bw as pe,cw as me,dw as he,ew as ge,fB as _e,fw as ve,gw as ye,hw as be,iw as h,jw as g,kw as xe,lw as _,mw as Se,nw as v,ow as Ce,pB as y,pw as b,qC as x,rw as S,sw as C,t as w,tw as T,uw as E,vw as D,ww as O,xw as k,yw as A,zC as j}from"./api-BPOlScPa.js";import{$ as M,Dt as we,Et as N,Gn as P,Kn 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-Cd7vK8g7.js";import{n as Ae}from"./TimeRangePicker-yK1328F9.js";import{t as je}from"./FilterBar-N2zMJz7R.js";import{t as Me}from"./DataTableShell-1-eBDd8r.js";import{t as W}from"./dispatchErrorInfo-CpxQCfFa.js";var G=t(e(),1),K=n(),q=`__all__`,Ne=[{value:`open`},{value:`acknowledged`},{value:`resolved`}];function Pe(e){return e===`open`?u():e===`acknowledged`?g():i()}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??``,i=e.status===J?q:e.status,a=e.severity??q,o=e.kind??q,[l,u]=(0,G.useState)(q),d=De(e.from,e.to),{from:f,to:p}=Ae(d),m=e=>void t({search:t=>({...t,q:e||void 0}),replace:!0}),g=e=>void t({search:t=>({...t,status:e===q?J:e})}),j=e=>void t({search:t=>({...t,severity:e===q?void 0:e})}),R=e=>void t({search:t=>({...t,kind:e===q?void 0:e})}),V=e=>void t({search:t=>({...t,...Oe(e)})}),H=Ee(),U=we(),W=_e(w.anomalies.resolveAnomaly),Y=(y(w.me.getMe,{host:ke})?.permissions??[]).includes(`admin.manage`),X=y(w.anomalies.listAnomalies,{limit:Re,filter:{q:n||void 0,from:f,to:p,anomalyStatus:i===q?void 0:i,severity:a===q?void 0:a,source:l===q?void 0:l,kind:o===q?void 0:o}}),Z=(0,G.useMemo)(()=>{let e=new Set;for(let t of X??[])e.add(t.kind);return[...e].sort()},[X]),Q=n!==``||i!==`open`||a!==q||l!==q||o!==q||d.kind!==`relative`||d.from!==Le.from;function Ue(){u(q),t({search:{status:`open`},replace:!0})}async function We(e){if(await H({title:xe(),description:(0,K.jsxs)(K.Fragment,{children:[ie(),` `,(0,K.jsx)(`span`,{className:`font-mono`,children:e.kind}),` `,te(),` `,(0,K.jsx)(`strong`,{children:ne()}),`.`,` `,se()]}),confirmLabel:O()}))try{await W({anomalyId:e._id,status:`resolved`}),U.success(ee(),e.kind)}catch(e){U.error(oe(),e)}}async function Ge(e){try{await W({anomalyId:e._id,status:`acknowledged`}),U.success(k(),e.kind)}catch(e){U.error(pe(),e)}}return(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)(`p`,{className:`oc-admin__hint`,children:[A(),` `,(0,K.jsx)(`strong`,{children:D()}),` `,de(),` `,(0,K.jsx)(`strong`,{children:ye()}),` `,be(),` `,(0,K.jsx)(`strong`,{children:Se()}),` `,b(),` `,(0,K.jsx)(`span`,{className:`oc-filter__window`,children:ve()})]}),(0,K.jsxs)(je,{q:n,onQChange:m,searchPlaceholder:he(),timeRange:d,onTimeRangeChange:V,onReset:Ue,canReset:Q,children:[(0,K.jsxs)(I,{value:i,onValueChange:g,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:E()}),Ne.map(e=>(0,K.jsx)(F,{value:e.value,children:Pe(e.value)},e.value))]})]}),(0,K.jsxs)(I,{value:a,onValueChange:j,children:[(0,K.jsx)(M,{size:`sm`,className:`w-36`,children:(0,K.jsx)(B,{placeholder:_()})}),(0,K.jsxs)(L,{children:[(0,K.jsx)(F,{value:q,children:fe()}),Fe.map(e=>(0,K.jsx)(F,{value:e,children:e},e))]})]}),(0,K.jsxs)(I,{value:l,onValueChange:u,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:S()}),Ie.map(e=>(0,K.jsx)(F,{value:e,children:e},e))]})]}),(0,K.jsxs)(I,{value:o,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:T()}),Z.map(e=>(0,K.jsx)(F,{value:e,children:e},e))]})]})]}),(0,K.jsx)(Me,{title:ge(),rows:X,emptyHint:i===`open`?r():ae(),rowActions:e=>Y&&e.status===`open`?[{label:ue(),onSelect:()=>void We(e)},{label:ce(),onSelect:()=>void Ge(e)}]:[],columns:[{header:le(),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:me(),cell:e=>e.occurrenceCount!==null&&e.occurrenceCount>1?(0,K.jsx)(`span`,{className:`oc-traces__time`,title:e.firstAt===null?void 0:Ce({when:z(e.firstAt)}),children:C({count:String(e.occurrenceCount)})}):(0,K.jsx)(`span`,{className:`oc-traces__time`,children:`—`}),sort:e=>e.occurrenceCount??0},{header:_(),cell:e=>(0,K.jsx)(Be,{severity:e.severity}),sort:e=>e.severity===`critical`?2:+(e.severity===`warn`)},{header:s(),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:x(),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:c(),cell:e=>(0,K.jsx)(ze,{row:e}),sort:e=>e.evidence??null},{header:re(),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:[`↗ `,m()]}):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:[`↗ `,m()]})}):(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:[`↗ `,m()]}):null]})}function $({row:e}){let[t,n]=(0,G.useState)(!1),r=y(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:[f(),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:o()})}),r===void 0?(0,K.jsx)(`p`,{className:`oc-traces__muted`,children:p()}):r.length===0?(0,K.jsx)(`p`,{className:`oc-traces__muted`,children:a()}):(0,K.jsx)(`div`,{className:`oc-anomaly__attachments`,children:r.map(e=>(0,K.jsxs)(`section`,{className:`oc-anomaly__attachment`,children:[(0,K.jsx)(`h4`,{className:`oc-anomaly__attachment-name`,children:(0,K.jsx)(`code`,{className:`oc-traces__mono`,children:e.name})}),(0,K.jsx)(`pre`,{className:`oc-anomaly__attachment-content`,children:e.content})]},e.name))})]})})]})}function Be({severity:e}){return(0,K.jsx)(`span`,{className:`oc-anomaly__sev oc-anomaly__sev--${e}`,children:e})}function Ve({status:e}){return e===`open`?(0,K.jsx)(N,{variant:`destructive`,children:j()}):e===`acknowledged`?(0,K.jsx)(N,{variant:`secondary`,children:d()}):(0,K.jsx)(N,{variant:`outline`,children:l()})}function He(e){return e.length>8?e.slice(0,8):e}export{Y as AnomaliesTab};
@@ -0,0 +1 @@
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{AT as r,CT as i,DT as a,ET as o,FT as s,IT as c,LT as l,MT as u,NT as d,OT as f,PT as p,TT as m,aa as h,ia as g,jT as _,kT as v,na as y,oa as b,pB as x,ra as S,sa as C,t as w,wT as T}from"./api-BPOlScPa.js";import{$ as E,Gn as D,Kn 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-Cd7vK8g7.js";import{n as ee}from"./TimeRangePicker-yK1328F9.js";import{t as z}from"./FilterBar-N2zMJz7R.js";import{t as B}from"./AdvancedFilter-3ID4qv_d.js";import{t as V}from"./DataTableShell-1-eBDd8r.js";var H=t(e(),1),U=n(),W={kind:`relative`,from:I,to:`now`},G=`__all__`,K=[{value:`action`,label:C()},{value:`realLabel`,label:b()},{value:`targetLabel`,label:h()},{value:`impersonated`,label:g()},{value:`resource`,label:S()},{value:`resourceId`,label:y()}];function q(){let e=O({from:`/settings/audit`}),t=D({from:`/settings/audit`}),n=e.q??``,h=e.action??G,g=e.impersonated??G,y=e.resource??G,b=F(e.from,e.to),S=(0,H.useMemo)(()=>R(e.adv),[e.adv]),{from:C,to:I}=ee(b),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}),$=x(w.admin.listAudit,{filter:{q:n||void 0,from:C,to:I,action:h===G?void 0:h,resource:y===G?void 0:y,impersonated:g===G?void 0:g===`yes`,advanced:S.length>0?S: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!==``||h!==G||g!==G||y!==G||S.length>0||b.kind!==`relative`||b.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:[l(),` `,(0,U.jsx)(`span`,{className:`oc-filter__window`,children:c()})]}),(0,U.jsxs)(z,{q:n,onQChange:q,searchPlaceholder:s(),timeRange:b,onTimeRangeChange:Z,onReset:ie,canReset:re,children:[(0,U.jsxs)(A,{value:h,onValueChange:J,children:[(0,U.jsx)(E,{size:`sm`,className:`w-40`,children:(0,U.jsx)(P,{placeholder:p()})}),(0,U.jsxs)(j,{children:[(0,U.jsx)(k,{value:G,children:d()}),te.map(e=>(0,U.jsx)(k,{value:e,children:e},e))]})]}),(0,U.jsxs)(A,{value:g,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:u()}),(0,U.jsx)(k,{value:`yes`,children:_()}),(0,U.jsx)(k,{value:`no`,children:r()})]})]}),(0,U.jsxs)(A,{value:y,onValueChange:X,children:[(0,U.jsx)(E,{size:`sm`,className:`w-40`,children:(0,U.jsx)(P,{placeholder:v()})}),(0,U.jsxs)(j,{children:[(0,U.jsx)(k,{value:G,children:f()}),ne.map(e=>(0,U.jsx)(k,{value:e,children:e},e))]})]})]}),(0,U.jsx)(B,{fields:K,seed:S,onChange:Q}),(0,U.jsx)(V,{title:a(),rows:$,emptyHint:o(),columns:[{header:m(),cell:e=>N(e.at),sort:e=>e.at},{header:p(),cell:e=>e.action,sort:e=>e.action},{header:T(),cell:e=>e.realLabel,sort:e=>e.realLabel},{header:i(),cell:e=>e.targetLabel??`—`,sort:e=>e.targetLabel??null},{header:v(),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{$b as r,Ab as i,Ax as a,Bb as o,Cb as s,Cx as c,D as l,Db as u,Di as d,Dx as f,Eb as p,Ei as m,Fb as h,Gb as g,Hb as ee,Ib as _,Ix as v,Jb as te,Kb as ne,Lb as y,Lx as b,Mb as x,Mx as re,Nb as ie,Nx as ae,Ob as oe,Oi as se,Ox as ce,Pb as le,Px as ue,Qb as de,Qu as fe,Rb as pe,Sb as me,Tb as he,Ti as ge,Ub as _e,Vb as ve,Wb as ye,Wt as be,Xb as xe,Yb as Se,Zb as Ce,_b as S,ab as we,ad as Te,bb as Ee,cB as De,cb as Oe,cd as ke,dB as C,db as Ae,dd as je,ex as Me,fb as Ne,fd as Pe,gb as Fe,hb as Ie,hd as Le,ib as w,id as Re,jb as ze,ji as Be,jx as Ve,kb as He,kx as Ue,lb as We,ld as Ge,mb as Ke,md as qe,ob as Je,od as Ye,pb as Xe,pd as Ze,qb as Qe,rb as T,rd as $e,sb as et,sd as tt,t as E,tx as nt,uB as rt,ub as it,ud as D,vb as at,wb as ot,wi as st,wx as ct,xb as lt,yb as ut,zb as dt}from"./api-BKX0b765.js";import{t as ft}from"./chevrons-up-down-Ds54l-NQ.js";import{i as pt,n as O,o as mt,r as ht,s as gt}from"./FieldLabel-D831BT1G.js";import{i as _t,n as vt,r as yt,t as bt}from"./tabs-BRizUL-U.js";import{t as k}from"./button-DzIspcBY.js";import{$ as A,Bn as xt,Bt as St,Dn as Ct,Dt as wt,Et as j,F as Tt,Gn as Et,Hn as M,Kn as Dt,Q as N,Rn as Ot,Rt as kt,X as P,Z as F,at as At,ct as jt,et as I,jt as L,lt as R,nt as Mt,ot as Nt,pn as Pt,q as Ft,rt as It,tt as Lt,un as z,ut as Rt,zn as zt,zt as Bt}from"./index-BbZI7MO0.js";import{r as Vt}from"./locales-CPjguROj.js";import{a as Ht,i as B,n as Ut,o as V,r as H,t as Wt}from"./table-1BG3EWti.js";import{t as Gt}from"./FilterBar-udwh54Yv.js";import{c as Kt,i as qt,n as Jt,o as Yt,r as Xt,s as Zt,t as Qt}from"./compatView-B55x_jLI.js";import{t as U}from"./dispatchErrorInfo-CuGiUb14.js";var $t=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`}]]),en=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`}]]),W=t(e(),1);function tn(e){return e.filter(e=>e.state===`error`)}function nn(e){return e.reachable&&tn(e.targets).length===0}function rn(e){return nn(e)?(e.unreachableInstances??[]).length>0?`gateways_unreachable`:`ok`:`error`}function an(e){return e.state===`error`&&e.lastErrorCode!==null}function on(e){return!!e.lastDownstreamRejectCode}function G(e){return e.kind??`openclaw`}function sn(e){return[...e].sort((e,t)=>e===`openclaw`?-1:t===`openclaw`?1:e.localeCompare(t))}function cn(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,G(e));let i=e=>(e.instanceName?r.get(e.instanceName):void 0)??`openclaw`,a=new Set;for(let e of n)a.add(G(e));for(let e of t)a.add(e.provider);for(let t of e)a.add(i(t));return sn(a).map(r=>({key:r,connections:e.filter(e=>i(e)===r),compatTargets:t.filter(e=>e.provider===r),instances:n.filter(e=>G(e)===r)}))}function K(e){return e===`openclaw`?`OpenClaw`:e===`hermes`?`Hermes`:e.charAt(0).toUpperCase()+e.slice(1)}var q=`__all__`,ln={q:``,state:q,instance:q,version:q},J={connected:0,error:1,idle:2};function un(e){return e.q.trim()!==``||e.state!==`__all__`||e.instance!==`__all__`||e.version!==`__all__`}function dn(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 Y(e,t){return e.localeCompare(t,void 0,{numeric:!0,sensitivity:`base`})}function X(e,t){return e===`version`?t.gatewayVersion===null:e===`lastOk`?t.lastOkAt===null:!1}function fn(e,t,n){switch(e){case`state`:return(J[t.state]??99)-(J[n.state]??99);case`instance`:return Y(t.instanceLabel??t.instanceName??``,n.instanceLabel??n.instanceName??``);case`host`:return Y(t.gatewayHost,n.gatewayHost);case`version`:{let e=t.gatewayVersion,r=n.gatewayVersion;return Zt(e,r)??Y(e,r)}case`lastOk`:return t.lastOkAt-n.lastOkAt;default:return Y(t.targetLabel,n.targetLabel)}}function pn(e,t){if(!t)return e;let n=t.dir===`asc`?1:-1;return[...e].sort((e,r)=>{let i=X(t.key,e),a=X(t.key,r);return i&&a?0:i?1:a?-1:n*fn(t.key,e,r)})}function mn(e){let t=new Set;for(let n of e)t.add(n.state);return[...t].sort((e,t)=>(J[e]??99)-(J[t]??99))}function hn(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)=>Y(e.label,t.label))}function gn(e){let t=new Set;for(let n of e)n.gatewayVersion!==null&&t.add(n.gatewayVersion);return[...t].sort((e,t)=>Zt(e,t)??Y(e,t))}var Z=n();function _n({connections:e,displayByInstance:t}){let[n,r]=(0,W.useState)(ln),[i,a]=(0,W.useState)(null),o=(0,W.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]),s=(0,W.useMemo)(()=>mn(o),[o]),c=(0,W.useMemo)(()=>hn(o),[o]),l=(0,W.useMemo)(()=>gn(o),[o]),u=(0,W.useMemo)(()=>pn(dn(o,n),i),[o,n,i]);function d(e){a(t=>t?.key===e?t.dir===`asc`?{key:e,dir:`desc`}:null:{key:e,dir:`asc`})}return e.length===0?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:lt()}):(0,Z.jsxs)(`div`,{className:`oc-conn`,children:[(0,Z.jsxs)(Gt,{q:n.q,onQChange:e=>r(t=>({...t,q:e})),searchPlaceholder:at(),onReset:()=>r(ln),canReset:un(n),children:[(0,Z.jsxs)(P,{value:n.state,onValueChange:e=>r(t=>({...t,state:e})),children:[(0,Z.jsx)(A,{size:`sm`,className:`w-36`,children:(0,Z.jsx)(I,{placeholder:Fe()})}),(0,Z.jsxs)(F,{children:[(0,Z.jsx)(N,{value:q,children:S()}),s.map(e=>(0,Z.jsx)(N,{value:e,children:yn(e)},e))]})]}),(0,Z.jsxs)(P,{value:n.instance,onValueChange:e=>r(t=>({...t,instance:e})),children:[(0,Z.jsx)(A,{size:`sm`,className:`w-40`,children:(0,Z.jsx)(I,{placeholder:Ie()})}),(0,Z.jsxs)(F,{children:[(0,Z.jsx)(N,{value:q,children:S()}),c.map(e=>(0,Z.jsx)(N,{value:e.name,children:e.label},e.name))]})]}),(0,Z.jsxs)(P,{value:n.version,onValueChange:e=>r(t=>({...t,version:e})),children:[(0,Z.jsx)(A,{size:`sm`,className:`w-36`,children:(0,Z.jsx)(I,{placeholder:Ke()})}),(0,Z.jsxs)(F,{children:[(0,Z.jsx)(N,{value:q,children:S()}),l.map(e=>(0,Z.jsx)(N,{value:e,children:e},e))]})]})]}),u.length===0?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:Xe()}):(0,Z.jsxs)(Wt,{className:`oc-conn__table`,children:[(0,Z.jsx)(Ht,{children:(0,Z.jsxs)(V,{children:[(0,Z.jsx)(Q,{label:Ne(),sortKey:`target`,sort:i,onSort:d}),(0,Z.jsx)(Q,{label:Ae(),sortKey:`state`,sort:i,onSort:d}),(0,Z.jsx)(Q,{label:it(),sortKey:`instance`,sort:i,onSort:d}),(0,Z.jsx)(Q,{label:We(),sortKey:`host`,sort:i,onSort:d}),(0,Z.jsx)(Q,{label:Oe(),sortKey:`version`,sort:i,onSort:d}),(0,Z.jsx)(B,{children:et()}),(0,Z.jsx)(Q,{label:Je(),sortKey:`lastOk`,sort:i,onSort:d})]})}),(0,Z.jsx)(Ut,{children:u.map(e=>(0,Z.jsx)(vn,{r:e},e._id))})]})]})}function Q({label:e,sortKey:t,sort:n,onSort:r}){let i=n?.key===t,a=i?n.dir:null;return(0,Z.jsx)(B,{"aria-sort":i?a===`asc`?`ascending`:`descending`:`none`,children:(0,Z.jsxs)(`button`,{type:`button`,className:`oc-conn__sort`,onClick:()=>r(t),children:[e,i?a===`asc`?(0,Z.jsx)(zt,{size:13,"aria-hidden":!0}):(0,Z.jsx)(M,{size:13,"aria-hidden":!0}):(0,Z.jsx)(ft,{size:13,"aria-hidden":!0,className:`oc-conn__sort-idle`})]})})}function vn({r:e}){let t=an(e)?U(e.lastErrorCode):null,n=on(e)?U(e.lastDownstreamRejectCode):null;return(0,Z.jsxs)(W.Fragment,{children:[(0,Z.jsxs)(V,{className:`oc-conn__row oc-conn__row--${e.state}`,children:[(0,Z.jsx)(H,{children:(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:e.targetLabel})}),(0,Z.jsx)(H,{children:(0,Z.jsx)(bn,{state:e.state})}),(0,Z.jsx)(H,{children:e.instanceLabel?(0,Z.jsx)(`span`,{className:`oc-bridge-target__instance`,children:e.instanceLabel}):(0,Z.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})}),(0,Z.jsx)(H,{children:(0,Z.jsx)(`span`,{className:`oc-bridge-target__host`,children:e.gatewayHost})}),(0,Z.jsx)(H,{children:e.gatewayVersion?(0,Z.jsx)(`span`,{className:`oc-bridge-target__version`,children:e.gatewayVersion}):(0,Z.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})}),(0,Z.jsx)(H,{children:(0,Z.jsx)(`span`,{className:`oc-conn__stats`,children:Ee({ok:e.okCount,errors:e.errorCount,attempts:e.attempts})})}),(0,Z.jsx)(H,{children:e.lastOkAt?(0,Z.jsx)(`span`,{className:`oc-traces__mono`,children:R(e.lastOkAt)}):(0,Z.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})})]}),t||n?(0,Z.jsx)(V,{className:`oc-conn__detail-row`,children:(0,Z.jsxs)(H,{colSpan:7,className:`oc-conn__detail-cell`,children:[t?(0,Z.jsxs)(`div`,{className:`oc-bridge-target__error`,children:[(0,Z.jsx)(`strong`,{children:t.label}),` `,(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:e.lastErrorCode}),e.lastErrorAt?` · ${R(e.lastErrorAt)}`:``,(0,Z.jsx)(`p`,{className:`oc-bridge-card__hint`,children:t.hint})]}):null,n?(0,Z.jsxs)(`div`,{className:`oc-bridge-target__downstream`,children:[ut({label:n.label}),` `,(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:e.lastDownstreamRejectCode}),e.lastDownstreamRejectAt?` · ${R(e.lastDownstreamRejectAt)}`:``]}):null]})}):null]})}function yn(e){return e===`connected`?we():e===`error`?w():T()}function bn({state:e}){return e===`connected`?(0,Z.jsx)(j,{variant:`secondary`,children:we()}):e===`error`?(0,Z.jsx)(j,{variant:`destructive`,children:w()}):(0,Z.jsx)(j,{variant:`outline`,children:T()})}function xn(){return C(E.bridgeHealth.getBridgeHealth,{})}function Sn(){let e=xn(),t=C(E.compat.getBridgeCompat,{}),n=C(E.me.getMe,{host:Ft})?.role===`admin`,r=C(E.admin.listInstances,n?{}:`skip`),i=C(E.agents.usageForInstances,n?{}:`skip`),a=Et(),s=()=>void a({to:`/settings/anomalies`,search:{status:`open`}}),c=cn(e?e.targets:[],t?t.targets:[],r??[]),{section:l}=Dt({from:`/settings/bridge`}),u=Et({from:`/settings/bridge`}),f=t?.compat??null,p=t===void 0?`loading`:t===null?`nodata`:`ready`,h=f!==null&&Xt(f,`hermes`)&&!c.some(e=>e.key===`hermes`);return(0,Z.jsxs)(`div`,{className:`oc-bridge`,children:[(0,Z.jsx)(Cn,{health:e,compat:t,onSeeAnomalies:s}),(0,Z.jsx)(`p`,{className:`oc-admin__hint oc-bridge__caption`,children:ve()}),i&&i.length>0?(0,Z.jsxs)(`section`,{className:`oc-bridge__usage`,children:[(0,Z.jsx)(`h3`,{className:`oc-bridge__usage-title`,children:o()}),(0,Z.jsxs)(Wt,{children:[(0,Z.jsx)(Ht,{children:(0,Z.jsxs)(V,{children:[(0,Z.jsx)(B,{children:se()}),(0,Z.jsx)(B,{children:d()}),(0,Z.jsx)(B,{children:m()}),(0,Z.jsx)(B,{children:ge()}),(0,Z.jsx)(B,{children:st()})]})}),(0,Z.jsx)(Ut,{children:i.flatMap(e=>{let t=Tt(e.usage,Date.now());return t?t.windows.map((t,n)=>(0,Z.jsxs)(V,{children:[(0,Z.jsx)(H,{className:`font-medium`,children:n===0?e.instanceName:``}),(0,Z.jsx)(H,{children:t.provider}),(0,Z.jsx)(H,{children:t.label}),(0,Z.jsx)(H,{children:(0,Z.jsxs)(j,{variant:t.percentLeft<=10?`destructive`:t.percentLeft<=25?`outline`:`secondary`,children:[t.percentLeft,`%`]})}),(0,Z.jsx)(H,{className:`text-muted-foreground`,children:t.resetText??`—`})]},`${e.instanceName}:${t.provider}:${t.label}`)):[]})})]})]}):null,c.length>0?(0,Z.jsxs)(bt,{value:c.some(e=>e.key===l)?l:c[0]?.key??`openclaw`,onValueChange:e=>void u({search:{section:e},replace:!0}),children:[(0,Z.jsx)(yt,{className:`w-full`,children:c.map(e=>(0,Z.jsxs)(_t,{value:e.key,className:`flex-1 gap-1.5`,children:[(0,Z.jsx)(Pt,{size:13,"aria-hidden":!0}),K(e.key)]},e.key))}),c.map(e=>(0,Z.jsx)(vt,{value:e.key,children:(0,Z.jsx)(wn,{providerKey:e.key,connections:e.connections,instances:e.instances,manifest:f,compatStatus:p,compatReachable:t?.reachable??!0,protocol:e.key===`openclaw`?t?.protocol??null:null})},e.key))]}):null,h?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:fe()}):null]})}function Cn({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,o=t&&t!==null?(0,Z.jsxs)(`span`,{className:`oc-bridge-card__ver`,children:[(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:Yt(t.bridgeVersion)}),a?(0,Z.jsxs)(Z.Fragment,{children:[` `,(0,Z.jsxs)(`code`,{className:`oc-traces__mono`,title:Ze(),children:[`(`,a,`)`]})]}):null,r?(0,Z.jsxs)(`strong`,{className:`oc-bridge-card__mismatch`,children:[` `,Pe({build:t.buildVersion??`?`})]}):null,` · `,je(),` `,(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:t.protocolVersion===null?D():String(t.protocolVersion)})]}):null;if(e===void 0)return(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:x()});if(e===null)return(0,Z.jsx)(`div`,{className:`oc-bridge-card oc-bridge-card--idle`,children:ze()});let c=tn(e.targets),l=!e.reachable,d=rn(e),f=e.unreachableInstances??[],m=d===`ok`?`ok`:d===`gateways_unreachable`?`warn`:`error`,h=jt(e.checkedAt),g=e.startedAt==null?null:jt(e.startedAt);return(0,Z.jsxs)(`div`,{className:`oc-bridge-card oc-bridge-card--${m}`,children:[(0,Z.jsx)(`div`,{className:`oc-bridge-card__icon`,"aria-hidden":!0,children:d===`ok`?(0,Z.jsx)(Ot,{size:22}):l||d===`gateways_unreachable`?(0,Z.jsx)(en,{size:22}):(0,Z.jsx)(z,{size:22})}),(0,Z.jsxs)(`div`,{className:`oc-bridge-card__body`,children:[(0,Z.jsx)(`div`,{className:`oc-bridge-card__title`,children:d===`ok`?i():d===`gateways_unreachable`?p({count:f.length}):l?He():oe({count:c.length})}),(0,Z.jsxs)(`div`,{className:`oc-bridge-card__meta`,children:[(0,Z.jsxs)(`span`,{children:[(0,Z.jsx)($t,{size:12,"aria-hidden":!0}),` `,u({time:h})]}),g?(0,Z.jsx)(`span`,{children:ot({time:g})}):null,o]}),d===`gateways_unreachable`?(0,Z.jsx)(`p`,{className:`oc-bridge-card__hint`,children:he({names:f.join(`, `)})}):null,l?(0,Z.jsx)(`p`,{className:`oc-bridge-card__hint`,children:U(e.lastError===`not_configured`?`NOT_CONFIGURED`:`BRIDGE_UNREACHABLE`).hint}):null]}),(0,Z.jsx)(`button`,{type:`button`,className:`oc-bridgebar__drill`,onClick:n,children:s()})]})}function wn({providerKey:e,connections:t,instances:n,manifest:r,compatStatus:i,compatReachable:a,protocol:o}){let s=r?Kt(r,e):null,c=new Map;for(let e of n)c.set(e.name,e.displayName??e.name);let l=[],u=new Set;for(let n of t){if(!n.instanceName||u.has(n.instanceName))continue;u.add(n.instanceName);let t=n.gatewayVersion??null;l.push({instanceName:n.instanceName,displayName:c.get(n.instanceName)??n.instanceName,version:t,state:Jt(t,e,r)})}let d=Qt(l.map(e=>e.state)),[f,p]=(0,W.useState)(!1);return(0,Z.jsxs)(`section`,{className:`oc-bridge-provider`,children:[(0,Z.jsxs)(`header`,{className:`oc-bridge-provider__head`,children:[(0,Z.jsx)(Pt,{size:15,"aria-hidden":!0,className:`oc-bridge-provider__icon`}),(0,Z.jsx)(`span`,{className:`oc-bridge-provider__name`,children:K(e)}),d?(0,Z.jsx)(j,{variant:d===`beyond`||d===`defective`?`destructive`:`secondary`,children:qt(d)}):null]}),(0,Z.jsx)(`h4`,{className:`oc-bridge-provider__sub`,children:Le()}),(0,Z.jsx)(En,{providerName:K(e),support:s,compatStatus:i,compatReachable:a,manifest:r,instanceRows:l}),o?(0,Z.jsx)(Tn,{protocol:o}):null,(0,Z.jsxs)(`button`,{type:`button`,className:`oc-bridge-provider__sub oc-bridge-provider__sub--toggle`,"aria-expanded":f,onClick:()=>p(e=>!e),children:[f?(0,Z.jsx)(M,{size:13,"aria-hidden":!0}):(0,Z.jsx)(xt,{size:13,"aria-hidden":!0}),me({count:t.length})]}),f?(0,Z.jsx)(_n,{connections:t,displayByInstance:c}):null]})}function Tn({protocol:e}){let[t,n]=(0,W.useState)(!1),r=e.coverage,i=e.drift??[],a=(e.driftOverflow??0)+(e.driftTruncated??0);return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`h4`,{className:`oc-bridge-provider__sub`,children:[dt(),i.length>0?(0,Z.jsx)(j,{variant:`destructive`,children:y({count:i.length})}):a>0?(0,Z.jsx)(j,{variant:`destructive`,children:_()}):(0,Z.jsx)(j,{variant:`secondary`,children:pe()})]}),(0,Z.jsxs)(`p`,{className:`oc-admin__hint`,children:[h({version:e.vendoredVersion}),r?` · `+le({handled:r.handled,ignored:r.ignored,gaps:r.gaps}):null]}),a>0?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:be({overflow:e.driftOverflow??0,truncated:e.driftTruncated??0})}):null,i.length>0?(0,Z.jsx)(`ul`,{className:`oc-bridge-protocol__list`,role:`list`,children:i.map(e=>(0,Z.jsxs)(`li`,{children:[(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:e.shape}),` × `,e.count]},e.shape))}):null,r&&r.gapList.length>0?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`button`,{type:`button`,className:`oc-bridge-provider__sub oc-bridge-provider__sub--toggle`,"aria-expanded":t,onClick:()=>n(e=>!e),children:[t?(0,Z.jsx)(M,{size:13,"aria-hidden":!0}):(0,Z.jsx)(xt,{size:13,"aria-hidden":!0}),ie({count:r.gapList.length})]}),t?(0,Z.jsx)(`ul`,{className:`oc-bridge-protocol__list`,role:`list`,children:r.gapList.map(e=>(0,Z.jsx)(`li`,{children:(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:e})},e))}):null]}):null]})}function En({support:e,compatStatus:t,compatReachable:n,manifest:r,instanceRows:i,providerName:a}){return t===`loading`?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:x()}):t===`nodata`?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:qe()}):(0,Z.jsxs)(`div`,{className:`oc-compat`,children:[n?null:(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:Ge()}),r===null?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:ke()}):(0,Z.jsxs)(`div`,{className:`oc-compat__support`,children:[(0,Z.jsx)(`span`,{className:`oc-compat__label`,children:Be({provider:a})}),e&&e.range!==null?(0,Z.jsx)(`span`,{children:tt({min:e.range.min,max:e.range.maxValidated})}):(0,Z.jsx)(`span`,{children:D()}),e?(0,Z.jsx)(kn,{versions:e.validatedVersions}):null]}),i.length===0?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:$e()}):(0,Z.jsx)(`div`,{className:`oc-compat__targets`,children:i.map(e=>(0,Z.jsxs)(`div`,{className:`oc-compat__target`,children:[(0,Z.jsx)(`span`,{className:`oc-compat__instance`,children:e.displayName}),(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:Yt(e.version)}),(0,Z.jsx)(j,{variant:e.state===`supported`?`secondary`:e.state===`beyond`||e.state===`defective`?`destructive`:`outline`,children:qt(e.state)})]},e.instanceName))})]})}function Dn({instance:e,onClose:t}){return(0,Z.jsx)(Lt,{open:!0,onOpenChange:e=>!e&&t(),children:(0,Z.jsxs)(Mt,{className:`oc-bridge-config-dialog`,onOpenAutoFocus:e=>e.preventDefault(),children:[(0,Z.jsxs)(At,{children:[(0,Z.jsx)(Nt,{children:b({instance:e.displayName??e.name})}),(0,Z.jsx)(It,{children:v()})]}),(0,Z.jsx)(On,{instance:e,onClose:t})]})})}function $({label:e,result:t}){return t?t.checked?(0,Z.jsxs)(`p`,{className:`oc-bridge-config__check-row `+(t.ok?`oc-bridge-config__check-row--ok`:`oc-bridge-config__check-row--err`),children:[t.ok?(0,Z.jsx)(Ot,{"aria-hidden":!0}):(0,Z.jsx)(z,{"aria-hidden":!0}),(0,Z.jsxs)(`span`,{children:[e,` — `,t.ok?g():t.detail]})]}):(0,Z.jsxs)(`p`,{className:`oc-bridge-config__check-row oc-bridge-config__check-row--skip`,children:[e,` — `,ye()]}):null}function On({instance:e,onClose:t}){let n=rt(E.admin.upsertInstanceConfig),i=De(E.bridge.validateMediaPaths),o=wt(),s=Vt(e.config?.contentLocale,void 0),[l,u]=(0,W.useState)(()=>pt(e.config??{},s)),[d,p]=(0,W.useState)(!1),[m,h]=(0,W.useState)(!1),[g,_]=(0,W.useState)(null),v=l.inboundMediaMode===`shared-fs`,y=l.mediaMode===`shared-fs`,b=v||y;async function x(){h(!0),_(null);try{_(await i({instanceName:e.name,inboundMediaMode:l.inboundMediaMode,mediaMode:l.mediaMode}))}catch(e){o.error(Se(),e)}finally{h(!1)}}async function ie(){p(!0);try{let r=e.config??{};await n({instanceId:e._id,config:ht(l,r,s)}),t()}catch(e){o.error(Ue(),e)}finally{p(!1)}}return(0,Z.jsx)(`div`,{className:`oc-bridge-config`,children:(0,Z.jsxs)(`div`,{className:`oc-bridge-config__form`,children:[(0,Z.jsxs)(`div`,{className:`oc-bridge-config__grid`,children:[(0,Z.jsxs)(`label`,{className:`oc-field`,children:[(0,Z.jsx)(O,{label:ue(),help:ce()}),(0,Z.jsxs)(P,{value:l.mediaMode,onValueChange:e=>u({...l,mediaMode:e}),children:[(0,Z.jsx)(A,{size:`sm`,className:`w-full`,children:(0,Z.jsx)(I,{})}),(0,Z.jsx)(F,{children:gt.map(e=>(0,Z.jsx)(N,{value:e,children:e},e))})]})]}),(0,Z.jsxs)(`label`,{className:`oc-field`,children:[(0,Z.jsx)(O,{label:ae(),help:f()}),(0,Z.jsxs)(P,{value:l.inboundMediaMode,onValueChange:e=>u({...l,inboundMediaMode:e}),children:[(0,Z.jsx)(A,{size:`sm`,className:`w-full`,children:(0,Z.jsx)(I,{})}),(0,Z.jsx)(F,{children:mt.map(e=>(0,Z.jsx)(N,{value:e,children:e},e))})]})]}),(0,Z.jsxs)(`label`,{className:`oc-field`,children:[(0,Z.jsx)(O,{label:re(),help:ct()}),(0,Z.jsx)(L,{type:`number`,min:1,max:4096,className:`w-full`,value:l.mediaMaxMb,onChange:e=>u({...l,mediaMaxMb:Math.trunc(Number(e.target.value)||0)})})]})]}),b&&(0,Z.jsxs)(`div`,{className:`oc-bridge-config__grid`,children:[v&&(0,Z.jsxs)(`label`,{className:`oc-field`,children:[(0,Z.jsx)(O,{label:nt(),help:Me()}),(0,Z.jsx)(L,{className:`w-full`,spellCheck:!1,value:l.inboundAgentMount,onChange:e=>u({...l,inboundAgentMount:e.target.value})})]}),y&&(0,Z.jsxs)(`label`,{className:`oc-field`,children:[(0,Z.jsx)(O,{label:r(),help:de()}),(0,Z.jsx)(L,{className:`w-full`,spellCheck:!1,value:l.outboundAgentMount,onChange:e=>u({...l,outboundAgentMount:e.target.value})})]})]}),(0,Z.jsxs)(`label`,{className:`oc-field--row`,children:[(0,Z.jsx)(Rt,{checked:l.rehydration,onCheckedChange:e=>u({...l,rehydration:e===!0})}),(0,Z.jsx)(O,{label:Ve(),help:c()})]}),b&&g!==null&&(0,Z.jsx)(`div`,{className:`oc-bridge-config__check`,children:g.reachable?!g.inbound&&!g.outbound?(0,Z.jsxs)(`p`,{className:`oc-bridge-config__check-row oc-bridge-config__check-row--err`,children:[(0,Z.jsx)(z,{"aria-hidden":!0}),ee({reason:g.reason??`?`})]}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)($,{label:Qe(),result:g.inbound}),(0,Z.jsx)($,{label:ne(),result:g.outbound}),(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:te()})]}):(0,Z.jsxs)(`p`,{className:`oc-bridge-config__check-row oc-bridge-config__check-row--err`,children:[(0,Z.jsx)(z,{"aria-hidden":!0}),_e()]})}),(0,Z.jsxs)(`div`,{className:`oc-bridge-config__actions`,children:[b&&(0,Z.jsxs)(k,{variant:`outline`,size:`sm`,onClick:()=>void x(),disabled:m,children:[m?(0,Z.jsx)(Ct,{className:`size-4 animate-spin`,"aria-hidden":!0}):null,m?xe():Ce()]}),(0,Z.jsx)(k,{size:`sm`,onClick:()=>void ie(),disabled:d,children:a()})]})]})})}function kn({versions:e}){if(e.length===0)return null;let t=[...e].reverse();return(0,Z.jsxs)(kt,{children:[(0,Z.jsx)(St,{asChild:!0,children:(0,Z.jsxs)(`button`,{type:`button`,className:`oc-compat__versions-btn`,children:[e.length===1?Ye():Te({count:e.length}),(0,Z.jsx)(M,{size:13,"aria-hidden":!0})]})}),(0,Z.jsxs)(Bt,{className:`oc-compat__versions-pop`,align:`start`,children:[(0,Z.jsx)(`p`,{className:`oc-compat__versions-title`,children:Re()}),(0,Z.jsx)(`div`,{className:`oc-compat__versions-list`,children:t.map(e=>(0,Z.jsx)(j,{variant:`secondary`,children:e},e))})]})]})}export{Sn as BridgeTab,Dn as InstanceConfigDialog};
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$b as r,Ab as i,Ax as a,Bb as o,Cb as s,Cx as c,D as l,Db as u,Di as d,Dx as f,Eb as p,Ei as m,Fb as h,Gb as g,Hb as ee,Ib as _,Ix as v,Jb as te,Kb as ne,Lb as y,Lx as b,Mb as x,Mx as re,Nb as ie,Nx as ae,Ob as oe,Oi as se,Ox as ce,Pb as le,Px as ue,Qb as de,Qu as fe,Rb as pe,Sb as me,Tb as he,Ti as ge,Ub as _e,Vb as ve,Wb as ye,Wt as be,Xb as xe,Yb as Se,Zb as Ce,_b as S,ab as we,ad as Te,bb as Ee,cb as De,cd as Oe,db as ke,dd as Ae,ex as je,fB as Me,fb as Ne,fd as Pe,gb as Fe,hb as Ie,hd as Le,ib as C,id as Re,jb as ze,ji as Be,jx as Ve,kb as He,kx as Ue,lb as We,ld as Ge,mb as Ke,md as qe,ob as Je,od as Ye,pB as w,pb as Xe,pd as Ze,qb as Qe,rb as T,rd as $e,sb as et,sd as tt,t as E,tx as nt,uB as rt,ub as it,ud as D,vb as at,wb as ot,wi as st,wx as ct,xb as lt,yb as ut,zb as dt}from"./api-BPOlScPa.js";import{t as ft}from"./chevrons-up-down-WwYjqxmn.js";import{i as pt,n as O,o as mt,r as ht,s as gt}from"./FieldLabel-CZ3VfRyz.js";import{i as _t,n as vt,r as yt,t as bt}from"./tabs-BuQ2R5Cs.js";import{t as k}from"./button-B5OAA4fh.js";import{$ as A,Bn as xt,Bt as St,Dn as Ct,Dt as wt,Et as j,F as Tt,Gn as Et,Hn as M,Kn as Dt,Q as N,Rn as Ot,Rt as kt,X as P,Z as F,at as At,ct as jt,et as I,jt as L,lt as R,nt as Mt,ot as Nt,pn as Pt,q as Ft,rt as It,tt as Lt,un as z,ut as Rt,zn as zt,zt as Bt}from"./index-Cd7vK8g7.js";import{r as Vt}from"./locales-CPjguROj.js";import{a as Ht,i as B,n as Ut,o as V,r as H,t as Wt}from"./table-Bgj0w4qc.js";import{t as Gt}from"./FilterBar-N2zMJz7R.js";import{c as Kt,i as qt,n as Jt,o as Yt,r as Xt,s as Zt,t as Qt}from"./compatView-Ca_1Ks2z.js";import{t as U}from"./dispatchErrorInfo-CpxQCfFa.js";var $t=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`}]]),en=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`}]]),W=t(e(),1);function tn(e){return e.filter(e=>e.state===`error`)}function nn(e){return e.reachable&&tn(e.targets).length===0}function rn(e){return nn(e)?(e.unreachableInstances??[]).length>0?`gateways_unreachable`:`ok`:`error`}function an(e){return e.state===`error`&&e.lastErrorCode!==null}function on(e){return!!e.lastDownstreamRejectCode}function G(e){return e.kind??`openclaw`}function sn(e){return[...e].sort((e,t)=>e===`openclaw`?-1:t===`openclaw`?1:e.localeCompare(t))}function cn(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,G(e));let i=e=>(e.instanceName?r.get(e.instanceName):void 0)??`openclaw`,a=new Set;for(let e of n)a.add(G(e));for(let e of t)a.add(e.provider);for(let t of e)a.add(i(t));return sn(a).map(r=>({key:r,connections:e.filter(e=>i(e)===r),compatTargets:t.filter(e=>e.provider===r),instances:n.filter(e=>G(e)===r)}))}function K(e){return e===`openclaw`?`OpenClaw`:e===`hermes`?`Hermes`:e.charAt(0).toUpperCase()+e.slice(1)}var q=`__all__`,ln={q:``,state:q,instance:q,version:q},J={connected:0,error:1,idle:2};function un(e){return e.q.trim()!==``||e.state!==`__all__`||e.instance!==`__all__`||e.version!==`__all__`}function dn(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 Y(e,t){return e.localeCompare(t,void 0,{numeric:!0,sensitivity:`base`})}function X(e,t){return e===`version`?t.gatewayVersion===null:e===`lastOk`?t.lastOkAt===null:!1}function fn(e,t,n){switch(e){case`state`:return(J[t.state]??99)-(J[n.state]??99);case`instance`:return Y(t.instanceLabel??t.instanceName??``,n.instanceLabel??n.instanceName??``);case`host`:return Y(t.gatewayHost,n.gatewayHost);case`version`:{let e=t.gatewayVersion,r=n.gatewayVersion;return Zt(e,r)??Y(e,r)}case`lastOk`:return t.lastOkAt-n.lastOkAt;default:return Y(t.targetLabel,n.targetLabel)}}function pn(e,t){if(!t)return e;let n=t.dir===`asc`?1:-1;return[...e].sort((e,r)=>{let i=X(t.key,e),a=X(t.key,r);return i&&a?0:i?1:a?-1:n*fn(t.key,e,r)})}function mn(e){let t=new Set;for(let n of e)t.add(n.state);return[...t].sort((e,t)=>(J[e]??99)-(J[t]??99))}function hn(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)=>Y(e.label,t.label))}function gn(e){let t=new Set;for(let n of e)n.gatewayVersion!==null&&t.add(n.gatewayVersion);return[...t].sort((e,t)=>Zt(e,t)??Y(e,t))}var Z=n();function _n({connections:e,displayByInstance:t}){let[n,r]=(0,W.useState)(ln),[i,a]=(0,W.useState)(null),o=(0,W.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]),s=(0,W.useMemo)(()=>mn(o),[o]),c=(0,W.useMemo)(()=>hn(o),[o]),l=(0,W.useMemo)(()=>gn(o),[o]),u=(0,W.useMemo)(()=>pn(dn(o,n),i),[o,n,i]);function d(e){a(t=>t?.key===e?t.dir===`asc`?{key:e,dir:`desc`}:null:{key:e,dir:`asc`})}return e.length===0?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:lt()}):(0,Z.jsxs)(`div`,{className:`oc-conn`,children:[(0,Z.jsxs)(Gt,{q:n.q,onQChange:e=>r(t=>({...t,q:e})),searchPlaceholder:at(),onReset:()=>r(ln),canReset:un(n),children:[(0,Z.jsxs)(P,{value:n.state,onValueChange:e=>r(t=>({...t,state:e})),children:[(0,Z.jsx)(A,{size:`sm`,className:`w-36`,children:(0,Z.jsx)(I,{placeholder:Fe()})}),(0,Z.jsxs)(F,{children:[(0,Z.jsx)(N,{value:q,children:S()}),s.map(e=>(0,Z.jsx)(N,{value:e,children:yn(e)},e))]})]}),(0,Z.jsxs)(P,{value:n.instance,onValueChange:e=>r(t=>({...t,instance:e})),children:[(0,Z.jsx)(A,{size:`sm`,className:`w-40`,children:(0,Z.jsx)(I,{placeholder:Ie()})}),(0,Z.jsxs)(F,{children:[(0,Z.jsx)(N,{value:q,children:S()}),c.map(e=>(0,Z.jsx)(N,{value:e.name,children:e.label},e.name))]})]}),(0,Z.jsxs)(P,{value:n.version,onValueChange:e=>r(t=>({...t,version:e})),children:[(0,Z.jsx)(A,{size:`sm`,className:`w-36`,children:(0,Z.jsx)(I,{placeholder:Ke()})}),(0,Z.jsxs)(F,{children:[(0,Z.jsx)(N,{value:q,children:S()}),l.map(e=>(0,Z.jsx)(N,{value:e,children:e},e))]})]})]}),u.length===0?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:Xe()}):(0,Z.jsxs)(Wt,{className:`oc-conn__table`,children:[(0,Z.jsx)(Ht,{children:(0,Z.jsxs)(V,{children:[(0,Z.jsx)(Q,{label:Ne(),sortKey:`target`,sort:i,onSort:d}),(0,Z.jsx)(Q,{label:ke(),sortKey:`state`,sort:i,onSort:d}),(0,Z.jsx)(Q,{label:it(),sortKey:`instance`,sort:i,onSort:d}),(0,Z.jsx)(Q,{label:We(),sortKey:`host`,sort:i,onSort:d}),(0,Z.jsx)(Q,{label:De(),sortKey:`version`,sort:i,onSort:d}),(0,Z.jsx)(B,{children:et()}),(0,Z.jsx)(Q,{label:Je(),sortKey:`lastOk`,sort:i,onSort:d})]})}),(0,Z.jsx)(Ut,{children:u.map(e=>(0,Z.jsx)(vn,{r:e},e._id))})]})]})}function Q({label:e,sortKey:t,sort:n,onSort:r}){let i=n?.key===t,a=i?n.dir:null;return(0,Z.jsx)(B,{"aria-sort":i?a===`asc`?`ascending`:`descending`:`none`,children:(0,Z.jsxs)(`button`,{type:`button`,className:`oc-conn__sort`,onClick:()=>r(t),children:[e,i?a===`asc`?(0,Z.jsx)(zt,{size:13,"aria-hidden":!0}):(0,Z.jsx)(M,{size:13,"aria-hidden":!0}):(0,Z.jsx)(ft,{size:13,"aria-hidden":!0,className:`oc-conn__sort-idle`})]})})}function vn({r:e}){let t=an(e)?U(e.lastErrorCode):null,n=on(e)?U(e.lastDownstreamRejectCode):null;return(0,Z.jsxs)(W.Fragment,{children:[(0,Z.jsxs)(V,{className:`oc-conn__row oc-conn__row--${e.state}`,children:[(0,Z.jsx)(H,{children:(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:e.targetLabel})}),(0,Z.jsx)(H,{children:(0,Z.jsx)(bn,{state:e.state})}),(0,Z.jsx)(H,{children:e.instanceLabel?(0,Z.jsx)(`span`,{className:`oc-bridge-target__instance`,children:e.instanceLabel}):(0,Z.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})}),(0,Z.jsx)(H,{children:(0,Z.jsx)(`span`,{className:`oc-bridge-target__host`,children:e.gatewayHost})}),(0,Z.jsx)(H,{children:e.gatewayVersion?(0,Z.jsx)(`span`,{className:`oc-bridge-target__version`,children:e.gatewayVersion}):(0,Z.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})}),(0,Z.jsx)(H,{children:(0,Z.jsx)(`span`,{className:`oc-conn__stats`,children:Ee({ok:e.okCount,errors:e.errorCount,attempts:e.attempts})})}),(0,Z.jsx)(H,{children:e.lastOkAt?(0,Z.jsx)(`span`,{className:`oc-traces__mono`,children:R(e.lastOkAt)}):(0,Z.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})})]}),t||n?(0,Z.jsx)(V,{className:`oc-conn__detail-row`,children:(0,Z.jsxs)(H,{colSpan:7,className:`oc-conn__detail-cell`,children:[t?(0,Z.jsxs)(`div`,{className:`oc-bridge-target__error`,children:[(0,Z.jsx)(`strong`,{children:t.label}),` `,(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:e.lastErrorCode}),e.lastErrorAt?` · ${R(e.lastErrorAt)}`:``,(0,Z.jsx)(`p`,{className:`oc-bridge-card__hint`,children:t.hint})]}):null,n?(0,Z.jsxs)(`div`,{className:`oc-bridge-target__downstream`,children:[ut({label:n.label}),` `,(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:e.lastDownstreamRejectCode}),e.lastDownstreamRejectAt?` · ${R(e.lastDownstreamRejectAt)}`:``]}):null]})}):null]})}function yn(e){return e===`connected`?we():e===`error`?C():T()}function bn({state:e}){return e===`connected`?(0,Z.jsx)(j,{variant:`secondary`,children:we()}):e===`error`?(0,Z.jsx)(j,{variant:`destructive`,children:C()}):(0,Z.jsx)(j,{variant:`outline`,children:T()})}function xn(){return w(E.bridgeHealth.getBridgeHealth,{})}function Sn(){let e=xn(),t=w(E.compat.getBridgeCompat,{}),n=w(E.me.getMe,{host:Ft})?.role===`admin`,r=w(E.admin.listInstances,n?{}:`skip`),i=w(E.agents.usageForInstances,n?{}:`skip`),a=Et(),s=()=>void a({to:`/settings/anomalies`,search:{status:`open`}}),c=cn(e?e.targets:[],t?t.targets:[],r??[]),{section:l}=Dt({from:`/settings/bridge`}),u=Et({from:`/settings/bridge`}),f=t?.compat??null,p=t===void 0?`loading`:t===null?`nodata`:`ready`,h=f!==null&&Xt(f,`hermes`)&&!c.some(e=>e.key===`hermes`);return(0,Z.jsxs)(`div`,{className:`oc-bridge`,children:[(0,Z.jsx)(Cn,{health:e,compat:t,onSeeAnomalies:s}),(0,Z.jsx)(`p`,{className:`oc-admin__hint oc-bridge__caption`,children:ve()}),i&&i.length>0?(0,Z.jsxs)(`section`,{className:`oc-bridge__usage`,children:[(0,Z.jsx)(`h3`,{className:`oc-bridge__usage-title`,children:o()}),(0,Z.jsxs)(Wt,{children:[(0,Z.jsx)(Ht,{children:(0,Z.jsxs)(V,{children:[(0,Z.jsx)(B,{children:se()}),(0,Z.jsx)(B,{children:d()}),(0,Z.jsx)(B,{children:m()}),(0,Z.jsx)(B,{children:ge()}),(0,Z.jsx)(B,{children:st()})]})}),(0,Z.jsx)(Ut,{children:i.flatMap(e=>{let t=Tt(e.usage,Date.now());return t?t.windows.map((t,n)=>(0,Z.jsxs)(V,{children:[(0,Z.jsx)(H,{className:`font-medium`,children:n===0?e.instanceName:``}),(0,Z.jsx)(H,{children:t.provider}),(0,Z.jsx)(H,{children:t.label}),(0,Z.jsx)(H,{children:(0,Z.jsxs)(j,{variant:t.percentLeft<=10?`destructive`:t.percentLeft<=25?`outline`:`secondary`,children:[t.percentLeft,`%`]})}),(0,Z.jsx)(H,{className:`text-muted-foreground`,children:t.resetText??`—`})]},`${e.instanceName}:${t.provider}:${t.label}`)):[]})})]})]}):null,c.length>0?(0,Z.jsxs)(bt,{value:c.some(e=>e.key===l)?l:c[0]?.key??`openclaw`,onValueChange:e=>void u({search:{section:e},replace:!0}),children:[(0,Z.jsx)(yt,{className:`w-full`,children:c.map(e=>(0,Z.jsxs)(_t,{value:e.key,className:`flex-1 gap-1.5`,children:[(0,Z.jsx)(Pt,{size:13,"aria-hidden":!0}),K(e.key)]},e.key))}),c.map(e=>(0,Z.jsx)(vt,{value:e.key,children:(0,Z.jsx)(wn,{providerKey:e.key,connections:e.connections,instances:e.instances,manifest:f,compatStatus:p,compatReachable:t?.reachable??!0,protocol:e.key===`openclaw`?t?.protocol??null:null})},e.key))]}):null,h?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:fe()}):null]})}function Cn({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,o=t&&t!==null?(0,Z.jsxs)(`span`,{className:`oc-bridge-card__ver`,children:[(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:Yt(t.bridgeVersion)}),a?(0,Z.jsxs)(Z.Fragment,{children:[` `,(0,Z.jsxs)(`code`,{className:`oc-traces__mono`,title:Ze(),children:[`(`,a,`)`]})]}):null,r?(0,Z.jsxs)(`strong`,{className:`oc-bridge-card__mismatch`,children:[` `,Pe({build:t.buildVersion??`?`})]}):null,` · `,Ae(),` `,(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:t.protocolVersion===null?D():String(t.protocolVersion)})]}):null;if(e===void 0)return(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:x()});if(e===null)return(0,Z.jsx)(`div`,{className:`oc-bridge-card oc-bridge-card--idle`,children:ze()});let c=tn(e.targets),l=!e.reachable,d=rn(e),f=e.unreachableInstances??[],m=d===`ok`?`ok`:d===`gateways_unreachable`?`warn`:`error`,h=jt(e.checkedAt),g=e.startedAt==null?null:jt(e.startedAt);return(0,Z.jsxs)(`div`,{className:`oc-bridge-card oc-bridge-card--${m}`,children:[(0,Z.jsx)(`div`,{className:`oc-bridge-card__icon`,"aria-hidden":!0,children:d===`ok`?(0,Z.jsx)(Ot,{size:22}):l||d===`gateways_unreachable`?(0,Z.jsx)(en,{size:22}):(0,Z.jsx)(z,{size:22})}),(0,Z.jsxs)(`div`,{className:`oc-bridge-card__body`,children:[(0,Z.jsx)(`div`,{className:`oc-bridge-card__title`,children:d===`ok`?i():d===`gateways_unreachable`?p({count:f.length}):l?He():oe({count:c.length})}),(0,Z.jsxs)(`div`,{className:`oc-bridge-card__meta`,children:[(0,Z.jsxs)(`span`,{children:[(0,Z.jsx)($t,{size:12,"aria-hidden":!0}),` `,u({time:h})]}),g?(0,Z.jsx)(`span`,{children:ot({time:g})}):null,o]}),d===`gateways_unreachable`?(0,Z.jsx)(`p`,{className:`oc-bridge-card__hint`,children:he({names:f.join(`, `)})}):null,l?(0,Z.jsx)(`p`,{className:`oc-bridge-card__hint`,children:U(e.lastError===`not_configured`?`NOT_CONFIGURED`:`BRIDGE_UNREACHABLE`).hint}):null]}),(0,Z.jsx)(`button`,{type:`button`,className:`oc-bridgebar__drill`,onClick:n,children:s()})]})}function wn({providerKey:e,connections:t,instances:n,manifest:r,compatStatus:i,compatReachable:a,protocol:o}){let s=r?Kt(r,e):null,c=new Map;for(let e of n)c.set(e.name,e.displayName??e.name);let l=[],u=new Set;for(let n of t){if(!n.instanceName||u.has(n.instanceName))continue;u.add(n.instanceName);let t=n.gatewayVersion??null;l.push({instanceName:n.instanceName,displayName:c.get(n.instanceName)??n.instanceName,version:t,state:Jt(t,e,r)})}let d=Qt(l.map(e=>e.state)),[f,p]=(0,W.useState)(!1);return(0,Z.jsxs)(`section`,{className:`oc-bridge-provider`,children:[(0,Z.jsxs)(`header`,{className:`oc-bridge-provider__head`,children:[(0,Z.jsx)(Pt,{size:15,"aria-hidden":!0,className:`oc-bridge-provider__icon`}),(0,Z.jsx)(`span`,{className:`oc-bridge-provider__name`,children:K(e)}),d?(0,Z.jsx)(j,{variant:d===`beyond`||d===`defective`?`destructive`:`secondary`,children:qt(d)}):null]}),(0,Z.jsx)(`h4`,{className:`oc-bridge-provider__sub`,children:Le()}),(0,Z.jsx)(En,{providerName:K(e),support:s,compatStatus:i,compatReachable:a,manifest:r,instanceRows:l}),o?(0,Z.jsx)(Tn,{protocol:o}):null,(0,Z.jsxs)(`button`,{type:`button`,className:`oc-bridge-provider__sub oc-bridge-provider__sub--toggle`,"aria-expanded":f,onClick:()=>p(e=>!e),children:[f?(0,Z.jsx)(M,{size:13,"aria-hidden":!0}):(0,Z.jsx)(xt,{size:13,"aria-hidden":!0}),me({count:t.length})]}),f?(0,Z.jsx)(_n,{connections:t,displayByInstance:c}):null]})}function Tn({protocol:e}){let[t,n]=(0,W.useState)(!1),r=e.coverage,i=e.drift??[],a=(e.driftOverflow??0)+(e.driftTruncated??0);return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`h4`,{className:`oc-bridge-provider__sub`,children:[dt(),i.length>0?(0,Z.jsx)(j,{variant:`destructive`,children:y({count:i.length})}):a>0?(0,Z.jsx)(j,{variant:`destructive`,children:_()}):(0,Z.jsx)(j,{variant:`secondary`,children:pe()})]}),(0,Z.jsxs)(`p`,{className:`oc-admin__hint`,children:[h({version:e.vendoredVersion}),r?` · `+le({handled:r.handled,ignored:r.ignored,gaps:r.gaps}):null]}),a>0?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:be({overflow:e.driftOverflow??0,truncated:e.driftTruncated??0})}):null,i.length>0?(0,Z.jsx)(`ul`,{className:`oc-bridge-protocol__list`,role:`list`,children:i.map(e=>(0,Z.jsxs)(`li`,{children:[(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:e.shape}),` × `,e.count]},e.shape))}):null,r&&r.gapList.length>0?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`button`,{type:`button`,className:`oc-bridge-provider__sub oc-bridge-provider__sub--toggle`,"aria-expanded":t,onClick:()=>n(e=>!e),children:[t?(0,Z.jsx)(M,{size:13,"aria-hidden":!0}):(0,Z.jsx)(xt,{size:13,"aria-hidden":!0}),ie({count:r.gapList.length})]}),t?(0,Z.jsx)(`ul`,{className:`oc-bridge-protocol__list`,role:`list`,children:r.gapList.map(e=>(0,Z.jsx)(`li`,{children:(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:e})},e))}):null]}):null]})}function En({support:e,compatStatus:t,compatReachable:n,manifest:r,instanceRows:i,providerName:a}){return t===`loading`?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:x()}):t===`nodata`?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:qe()}):(0,Z.jsxs)(`div`,{className:`oc-compat`,children:[n?null:(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:Ge()}),r===null?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:Oe()}):(0,Z.jsxs)(`div`,{className:`oc-compat__support`,children:[(0,Z.jsx)(`span`,{className:`oc-compat__label`,children:Be({provider:a})}),e&&e.range!==null?(0,Z.jsx)(`span`,{children:tt({min:e.range.min,max:e.range.maxValidated})}):(0,Z.jsx)(`span`,{children:D()}),e?(0,Z.jsx)(kn,{versions:e.validatedVersions}):null]}),i.length===0?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:$e()}):(0,Z.jsx)(`div`,{className:`oc-compat__targets`,children:i.map(e=>(0,Z.jsxs)(`div`,{className:`oc-compat__target`,children:[(0,Z.jsx)(`span`,{className:`oc-compat__instance`,children:e.displayName}),(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:Yt(e.version)}),(0,Z.jsx)(j,{variant:e.state===`supported`?`secondary`:e.state===`beyond`||e.state===`defective`?`destructive`:`outline`,children:qt(e.state)})]},e.instanceName))})]})}function Dn({instance:e,onClose:t}){return(0,Z.jsx)(Lt,{open:!0,onOpenChange:e=>!e&&t(),children:(0,Z.jsxs)(Mt,{className:`oc-bridge-config-dialog`,onOpenAutoFocus:e=>e.preventDefault(),children:[(0,Z.jsxs)(At,{children:[(0,Z.jsx)(Nt,{children:b({instance:e.displayName??e.name})}),(0,Z.jsx)(It,{children:v()})]}),(0,Z.jsx)(On,{instance:e,onClose:t})]})})}function $({label:e,result:t}){return t?t.checked?(0,Z.jsxs)(`p`,{className:`oc-bridge-config__check-row `+(t.ok?`oc-bridge-config__check-row--ok`:`oc-bridge-config__check-row--err`),children:[t.ok?(0,Z.jsx)(Ot,{"aria-hidden":!0}):(0,Z.jsx)(z,{"aria-hidden":!0}),(0,Z.jsxs)(`span`,{children:[e,` — `,t.ok?g():t.detail]})]}):(0,Z.jsxs)(`p`,{className:`oc-bridge-config__check-row oc-bridge-config__check-row--skip`,children:[e,` — `,ye()]}):null}function On({instance:e,onClose:t}){let n=Me(E.admin.upsertInstanceConfig),i=rt(E.bridge.validateMediaPaths),o=wt(),s=Vt(e.config?.contentLocale,void 0),[l,u]=(0,W.useState)(()=>pt(e.config??{},s)),[d,p]=(0,W.useState)(!1),[m,h]=(0,W.useState)(!1),[g,_]=(0,W.useState)(null),v=l.inboundMediaMode===`shared-fs`,y=l.mediaMode===`shared-fs`,b=v||y;async function x(){h(!0),_(null);try{_(await i({instanceName:e.name,inboundMediaMode:l.inboundMediaMode,mediaMode:l.mediaMode}))}catch(e){o.error(Se(),e)}finally{h(!1)}}async function ie(){p(!0);try{let r=e.config??{};await n({instanceId:e._id,config:ht(l,r,s)}),t()}catch(e){o.error(Ue(),e)}finally{p(!1)}}return(0,Z.jsx)(`div`,{className:`oc-bridge-config`,children:(0,Z.jsxs)(`div`,{className:`oc-bridge-config__form`,children:[(0,Z.jsxs)(`div`,{className:`oc-bridge-config__grid`,children:[(0,Z.jsxs)(`label`,{className:`oc-field`,children:[(0,Z.jsx)(O,{label:ue(),help:ce()}),(0,Z.jsxs)(P,{value:l.mediaMode,onValueChange:e=>u({...l,mediaMode:e}),children:[(0,Z.jsx)(A,{size:`sm`,className:`w-full`,children:(0,Z.jsx)(I,{})}),(0,Z.jsx)(F,{children:gt.map(e=>(0,Z.jsx)(N,{value:e,children:e},e))})]})]}),(0,Z.jsxs)(`label`,{className:`oc-field`,children:[(0,Z.jsx)(O,{label:ae(),help:f()}),(0,Z.jsxs)(P,{value:l.inboundMediaMode,onValueChange:e=>u({...l,inboundMediaMode:e}),children:[(0,Z.jsx)(A,{size:`sm`,className:`w-full`,children:(0,Z.jsx)(I,{})}),(0,Z.jsx)(F,{children:mt.map(e=>(0,Z.jsx)(N,{value:e,children:e},e))})]})]}),(0,Z.jsxs)(`label`,{className:`oc-field`,children:[(0,Z.jsx)(O,{label:re(),help:ct()}),(0,Z.jsx)(L,{type:`number`,min:1,max:4096,className:`w-full`,value:l.mediaMaxMb,onChange:e=>u({...l,mediaMaxMb:Math.trunc(Number(e.target.value)||0)})})]})]}),b&&(0,Z.jsxs)(`div`,{className:`oc-bridge-config__grid`,children:[v&&(0,Z.jsxs)(`label`,{className:`oc-field`,children:[(0,Z.jsx)(O,{label:nt(),help:je()}),(0,Z.jsx)(L,{className:`w-full`,spellCheck:!1,value:l.inboundAgentMount,onChange:e=>u({...l,inboundAgentMount:e.target.value})})]}),y&&(0,Z.jsxs)(`label`,{className:`oc-field`,children:[(0,Z.jsx)(O,{label:r(),help:de()}),(0,Z.jsx)(L,{className:`w-full`,spellCheck:!1,value:l.outboundAgentMount,onChange:e=>u({...l,outboundAgentMount:e.target.value})})]})]}),(0,Z.jsxs)(`label`,{className:`oc-field--row`,children:[(0,Z.jsx)(Rt,{checked:l.rehydration,onCheckedChange:e=>u({...l,rehydration:e===!0})}),(0,Z.jsx)(O,{label:Ve(),help:c()})]}),b&&g!==null&&(0,Z.jsx)(`div`,{className:`oc-bridge-config__check`,children:g.reachable?!g.inbound&&!g.outbound?(0,Z.jsxs)(`p`,{className:`oc-bridge-config__check-row oc-bridge-config__check-row--err`,children:[(0,Z.jsx)(z,{"aria-hidden":!0}),ee({reason:g.reason??`?`})]}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)($,{label:Qe(),result:g.inbound}),(0,Z.jsx)($,{label:ne(),result:g.outbound}),(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:te()})]}):(0,Z.jsxs)(`p`,{className:`oc-bridge-config__check-row oc-bridge-config__check-row--err`,children:[(0,Z.jsx)(z,{"aria-hidden":!0}),_e()]})}),(0,Z.jsxs)(`div`,{className:`oc-bridge-config__actions`,children:[b&&(0,Z.jsxs)(k,{variant:`outline`,size:`sm`,onClick:()=>void x(),disabled:m,children:[m?(0,Z.jsx)(Ct,{className:`size-4 animate-spin`,"aria-hidden":!0}):null,m?xe():Ce()]}),(0,Z.jsx)(k,{size:`sm`,onClick:()=>void ie(),disabled:d,children:a()})]})]})})}function kn({versions:e}){if(e.length===0)return null;let t=[...e].reverse();return(0,Z.jsxs)(kt,{children:[(0,Z.jsx)(St,{asChild:!0,children:(0,Z.jsxs)(`button`,{type:`button`,className:`oc-compat__versions-btn`,children:[e.length===1?Ye():Te({count:e.length}),(0,Z.jsx)(M,{size:13,"aria-hidden":!0})]})}),(0,Z.jsxs)(Bt,{className:`oc-compat__versions-pop`,align:`start`,children:[(0,Z.jsx)(`p`,{className:`oc-compat__versions-title`,children:Re()}),(0,Z.jsx)(`div`,{className:`oc-compat__versions-list`,children:t.map(e=>(0,Z.jsx)(j,{variant:`secondary`,children:e},e))})]})]})}export{Sn as BridgeTab,Dn as InstanceConfigDialog};
@@ -1 +1 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Ai as r,Bs as i,Cd as a,Ff as o,Fx as s,Gs as c,Hs as l,Ks as u,Pf as d,Rs as f,Sd as p,Us as m,Vf as h,Vs as g,Ws as _,_d as v,bd as y,cB as b,dB as x,ef as S,gd as C,nB as w,qs as T,t as E,uB as D,vd as O,wd as k,xd as A,yd as j,zf as M,zs as N}from"./api-BKX0b765.js";import{t as P}from"./button-DzIspcBY.js";import{$ as F,B as I,M as L,N as R,Q as z,X as B,Z as V,et as H,jt as U,un as W,ut as G}from"./index-BbZI7MO0.js";import{a as K}from"./compatView-B55x_jLI.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=D(E.admin.upsertInstanceConfig),n=x(E.agents.listAgentsForInstance,{instanceName:e.name}),r=typeof e.config?.converterAgentId==`string`?e.config.converterAgentId:``,[i,a]=(0,q.useState)(r),[o,s]=(0,q.useState)(`idle`);(0,q.useEffect)(()=>{a(r),s(`idle`)},[e._id,r]);let c=`__none__`,u=i!==r;async function d(){s(`saving`);try{let n={...e.config??{}};i===``||i===c?delete n.converterAgentId:n.converterAgentId=i,await t({instanceId:e._id,config:n}),s(`done`)}catch{s(`error`)}}let f=n?.agents??[];return(0,X.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,X.jsx)(`span`,{className:`oc-cdefaults__label`,children:_()}),(0,X.jsx)(`p`,{className:`oc-admin__hint`,children:m()}),(0,X.jsxs)(`div`,{className:`oc-cdefaults__inline`,children:[(0,X.jsxs)(B,{value:i===``?c:i,onValueChange:e=>a(e===c?``:e),children:[(0,X.jsx)(F,{className:`oc-cdefaults__select`,"aria-label":_(),children:(0,X.jsx)(H,{placeholder:l()})}),(0,X.jsxs)(V,{children:[(0,X.jsx)(z,{value:c,children:l()}),f.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:!u||o===`saving`,onClick:()=>void d(),children:o===`saving`?h():O()})]}),o===`done`?(0,X.jsx)(`p`,{className:`oc-admin__hint`,role:`status`,children:v()}):null,o===`error`?(0,X.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:C()}):null]})}function Q({instance:e}){let t=D(E.admin.upsertInstanceConfig),n=e.config?.curationEnabled===!0,r=typeof e.config?.curationBudgetChars==`number`?e.config.curationBudgetChars:null,[a,o]=(0,q.useState)(n),[s,l]=(0,q.useState)(r===null?``:String(r)),[u,d]=(0,q.useState)(`idle`);(0,q.useEffect)(()=>{o(n),l(r===null?``:String(r)),d(`idle`)},[e._id,n,r]);let f=s.trim(),p=f===``?null:/^\d+$/.test(f)?Number.parseInt(f,10):NaN,m=!a||p===null||Number.isInteger(p)&&p>=4e3&&p<=6e4,_=a!==n||(p??null)!==r;async function y(){d(`saving`);try{let n={...e.config??{}};n.curationEnabled=a,!a||p===null||Number.isNaN(p)?delete n.curationBudgetChars:n.curationBudgetChars=p,await t({instanceId:e._id,config:n}),d(`done`)}catch{d(`error`)}}return(0,X.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,X.jsxs)(`label`,{className:`oc-cdefaults__inline`,style:{cursor:`pointer`},children:[(0,X.jsx)(G,{checked:a,onCheckedChange:e=>o(e===!0),"aria-label":c()}),(0,X.jsx)(`span`,{className:`oc-cdefaults__label`,children:c()})]}),(0,X.jsxs)(`div`,{className:`oc-cdefaults__inline`,children:[(0,X.jsx)(U,{type:`number`,min:4e3,max:6e4,step:1e3,placeholder:`20000`,value:s,onChange:e=>l(e.target.value),className:`oc-cdefaults__number`,"aria-invalid":!m,"aria-label":g(),disabled:!a}),(0,X.jsx)(P,{size:`sm`,disabled:!_||!m||u===`saving`,onClick:()=>void y(),children:u===`saving`?h():O()})]}),m?null:(0,X.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:i()}),u===`done`?(0,X.jsx)(`p`,{className:`oc-admin__hint`,role:`status`,children:v()}):null,u===`error`?(0,X.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:C()}):null,(0,X.jsx)(`p`,{className:`oc-cdefaults__help`,children:N()})]})}function $({instance:e}){let t=D(E.admin.upsertInstanceConfig),n=typeof e.config?.summarizeThresholdChars==`number`?e.config.summarizeThresholdChars:null,[r,i]=(0,q.useState)(n===null?``:String(n)),[a,o]=(0,q.useState)(`idle`);(0,q.useEffect)(()=>{i(n===null?``:String(n)),o(`idle`)},[e._id,n]);let s=r.trim(),c=s===``?null:/^\d+$/.test(s)?Number.parseInt(s,10):NaN,l=c===null||Number.isInteger(c)&&c>=1e3&&c<=2e5,d=(c??null)!==n;async function p(){o(`saving`);try{let n={...e.config??{}};c===null?delete n.summarizeThresholdChars:n.summarizeThresholdChars=c,await t({instanceId:e._id,config:n}),o(`done`)}catch{o(`error`)}}return(0,X.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,X.jsx)(`span`,{className:`oc-cdefaults__label`,children:T()}),(0,X.jsxs)(`div`,{className:`oc-cdefaults__inline`,children:[(0,X.jsx)(U,{type:`number`,min:1e3,max:2e5,step:1e3,placeholder:`8000`,value:r,onChange:e=>i(e.target.value),className:`oc-cdefaults__number`,"aria-invalid":!l}),(0,X.jsx)(P,{size:`sm`,disabled:!d||!l||a===`saving`,onClick:()=>void p(),children:a===`saving`?h():O()})]}),l?null:(0,X.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:f()}),a===`done`?(0,X.jsx)(`p`,{className:`oc-admin__hint`,role:`status`,children:v()}):null,a===`error`?(0,X.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:C()}):null,(0,X.jsx)(`p`,{className:`oc-cdefaults__help`,children:u()})]})}function ee(){let e=b(E.agentFiles.getChatDefaults),[t,n]=(0,q.useState)({status:`loading`}),i=x(E.admin.listInstances,{}),[c,l]=(0,q.useState)(null);(0,q.useEffect)(()=>{!i||i.length===0||(!c||!i.some(e=>e.name===c))&&l(i[0].name)},[i,c]);let u=(i?.length??0)>1,f=i!==void 0&&i.length===0,m=x(E.compat.forInstance,c?{instanceName:c}:`skip`),h=c?I(m,`configDefaults`):`loading`,g=h===`loading`?null:h.blocked,_=(0,q.useMemo)(()=>u&&c?{instanceName:c}:{},[u,c]),v=(0,q.useRef)(0),C=(0,q.useCallback)(async()=>{let t=++v.current;n({status:`loading`});try{let r=Y(await e(_));if(v.current!==t)return;n({status:`done`,current:r})}catch{if(v.current!==t)return;n({status:`error`})}},[e,_]);(0,q.useEffect)(()=>{g===!1&&(u&&!c||C())},[C,g,u,c]);let T=t.status===`done`?t.current:null,D=(0,q.useMemo)(()=>J.map(e=>({id:e,label:R(e)})),[]),O=(0,q.useMemo)(()=>[{id:`fast`,label:o()},{id:`standard`,label:d()}],[]);return(0,X.jsxs)(`div`,{className:`oc-cdefaults`,children:[(0,X.jsx)(`p`,{className:`oc-admin__hint`,children:k()}),u&&c?(0,X.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,X.jsx)(`span`,{className:`oc-cdefaults__label`,children:S()}),(0,X.jsxs)(B,{value:c,onValueChange:e=>l(e),children:[(0,X.jsx)(F,{size:`sm`,"aria-label":S(),children:(0,X.jsx)(H,{})}),(0,X.jsx)(V,{children:(i??[]).map(e=>(0,X.jsx)(z,{value:e.name,children:e.name},e.name))})]})]}):null,f?(0,X.jsx)(`p`,{className:`oc-admin__hint`,role:`status`,children:s()}):h===`loading`?(0,X.jsx)(`p`,{className:`oc-admin__hint`,children:w()}):h.blocked?(0,X.jsxs)(`p`,{className:`oc-compat__blocked`,role:`status`,children:[(0,X.jsx)(W,{size:14,"aria-hidden":!0}),` `,K(h.gatewayVersion,h.provider)]}):t.status===`loading`?(0,X.jsx)(`p`,{className:`oc-admin__hint`,children:w()}):t.status===`error`?(0,X.jsxs)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:[j(),` `,(0,X.jsx)(P,{variant:`outline`,size:`sm`,onClick:()=>void C(),children:M()})]}):(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,X.jsx)(`span`,{className:`oc-cdefaults__label`,children:a()}),(0,X.jsx)(L,{field:`thinkingLevel`,options:D,value:T?.thinkingDefault??null,onChange:()=>{},disabled:!0,ariaLabel:a()}),(0,X.jsx)(`p`,{className:`oc-cdefaults__help`,children:p()})]}),(0,X.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,X.jsx)(`span`,{className:`oc-cdefaults__label`,children:A()}),(0,X.jsx)(L,{field:`fastMode`,options:O,value:T===null||T.fastModeDefault===null?null:T.fastModeDefault?`fast`:`standard`,onChange:()=>{},disabled:!0,ariaLabel:A()}),(0,X.jsx)(`p`,{className:`oc-cdefaults__help`,children:y()})]}),(0,X.jsx)(`p`,{className:`oc-cdefaults__note`,children:r()})]}),(()=>{let e=i?.find(e=>e.name===(c??i[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{Ai as r,Bs as i,Cd as a,Ff as o,Fx as s,Gs as c,Hs as l,Ks as u,Pf as d,Rs as f,Sd as p,Us as m,Vf as h,Vs as g,Ws as _,_d as v,bd as y,ef as b,fB as x,gd as S,iB as C,pB as w,qs as T,t as E,uB as D,vd as O,wd as k,xd as A,yd as j,zf as M,zs as N}from"./api-BPOlScPa.js";import{t as P}from"./button-B5OAA4fh.js";import{$ as F,B as I,M as L,N as R,Q as z,X as B,Z as V,et as H,jt as U,un as W,ut as G}from"./index-Cd7vK8g7.js";import{a as K}from"./compatView-Ca_1Ks2z.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=x(E.admin.upsertInstanceConfig),n=w(E.agents.listAgentsForInstance,{instanceName:e.name}),r=typeof e.config?.converterAgentId==`string`?e.config.converterAgentId:``,[i,a]=(0,q.useState)(r),[o,s]=(0,q.useState)(`idle`);(0,q.useEffect)(()=>{a(r),s(`idle`)},[e._id,r]);let c=`__none__`,u=i!==r;async function d(){s(`saving`);try{let n={...e.config??{}};i===``||i===c?delete n.converterAgentId:n.converterAgentId=i,await t({instanceId:e._id,config:n}),s(`done`)}catch{s(`error`)}}let f=n?.agents??[];return(0,X.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,X.jsx)(`span`,{className:`oc-cdefaults__label`,children:_()}),(0,X.jsx)(`p`,{className:`oc-admin__hint`,children:m()}),(0,X.jsxs)(`div`,{className:`oc-cdefaults__inline`,children:[(0,X.jsxs)(B,{value:i===``?c:i,onValueChange:e=>a(e===c?``:e),children:[(0,X.jsx)(F,{className:`oc-cdefaults__select`,"aria-label":_(),children:(0,X.jsx)(H,{placeholder:l()})}),(0,X.jsxs)(V,{children:[(0,X.jsx)(z,{value:c,children:l()}),f.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:!u||o===`saving`,onClick:()=>void d(),children:o===`saving`?h():O()})]}),o===`done`?(0,X.jsx)(`p`,{className:`oc-admin__hint`,role:`status`,children:v()}):null,o===`error`?(0,X.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:S()}):null]})}function Q({instance:e}){let t=x(E.admin.upsertInstanceConfig),n=e.config?.curationEnabled===!0,r=typeof e.config?.curationBudgetChars==`number`?e.config.curationBudgetChars:null,[a,o]=(0,q.useState)(n),[s,l]=(0,q.useState)(r===null?``:String(r)),[u,d]=(0,q.useState)(`idle`);(0,q.useEffect)(()=>{o(n),l(r===null?``:String(r)),d(`idle`)},[e._id,n,r]);let f=s.trim(),p=f===``?null:/^\d+$/.test(f)?Number.parseInt(f,10):NaN,m=!a||p===null||Number.isInteger(p)&&p>=4e3&&p<=6e4,_=a!==n||(p??null)!==r;async function y(){d(`saving`);try{let n={...e.config??{}};n.curationEnabled=a,!a||p===null||Number.isNaN(p)?delete n.curationBudgetChars:n.curationBudgetChars=p,await t({instanceId:e._id,config:n}),d(`done`)}catch{d(`error`)}}return(0,X.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,X.jsxs)(`label`,{className:`oc-cdefaults__inline`,style:{cursor:`pointer`},children:[(0,X.jsx)(G,{checked:a,onCheckedChange:e=>o(e===!0),"aria-label":c()}),(0,X.jsx)(`span`,{className:`oc-cdefaults__label`,children:c()})]}),(0,X.jsxs)(`div`,{className:`oc-cdefaults__inline`,children:[(0,X.jsx)(U,{type:`number`,min:4e3,max:6e4,step:1e3,placeholder:`20000`,value:s,onChange:e=>l(e.target.value),className:`oc-cdefaults__number`,"aria-invalid":!m,"aria-label":g(),disabled:!a}),(0,X.jsx)(P,{size:`sm`,disabled:!_||!m||u===`saving`,onClick:()=>void y(),children:u===`saving`?h():O()})]}),m?null:(0,X.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:i()}),u===`done`?(0,X.jsx)(`p`,{className:`oc-admin__hint`,role:`status`,children:v()}):null,u===`error`?(0,X.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:S()}):null,(0,X.jsx)(`p`,{className:`oc-cdefaults__help`,children:N()})]})}function $({instance:e}){let t=x(E.admin.upsertInstanceConfig),n=typeof e.config?.summarizeThresholdChars==`number`?e.config.summarizeThresholdChars:null,[r,i]=(0,q.useState)(n===null?``:String(n)),[a,o]=(0,q.useState)(`idle`);(0,q.useEffect)(()=>{i(n===null?``:String(n)),o(`idle`)},[e._id,n]);let s=r.trim(),c=s===``?null:/^\d+$/.test(s)?Number.parseInt(s,10):NaN,l=c===null||Number.isInteger(c)&&c>=1e3&&c<=2e5,d=(c??null)!==n;async function p(){o(`saving`);try{let n={...e.config??{}};c===null?delete n.summarizeThresholdChars:n.summarizeThresholdChars=c,await t({instanceId:e._id,config:n}),o(`done`)}catch{o(`error`)}}return(0,X.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,X.jsx)(`span`,{className:`oc-cdefaults__label`,children:T()}),(0,X.jsxs)(`div`,{className:`oc-cdefaults__inline`,children:[(0,X.jsx)(U,{type:`number`,min:1e3,max:2e5,step:1e3,placeholder:`8000`,value:r,onChange:e=>i(e.target.value),className:`oc-cdefaults__number`,"aria-invalid":!l}),(0,X.jsx)(P,{size:`sm`,disabled:!d||!l||a===`saving`,onClick:()=>void p(),children:a===`saving`?h():O()})]}),l?null:(0,X.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:f()}),a===`done`?(0,X.jsx)(`p`,{className:`oc-admin__hint`,role:`status`,children:v()}):null,a===`error`?(0,X.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:S()}):null,(0,X.jsx)(`p`,{className:`oc-cdefaults__help`,children:u()})]})}function ee(){let e=D(E.agentFiles.getChatDefaults),[t,n]=(0,q.useState)({status:`loading`}),i=w(E.admin.listInstances,{}),[c,l]=(0,q.useState)(null);(0,q.useEffect)(()=>{!i||i.length===0||(!c||!i.some(e=>e.name===c))&&l(i[0].name)},[i,c]);let u=(i?.length??0)>1,f=i!==void 0&&i.length===0,m=w(E.compat.forInstance,c?{instanceName:c}:`skip`),h=c?I(m,`configDefaults`):`loading`,g=h===`loading`?null:h.blocked,_=(0,q.useMemo)(()=>u&&c?{instanceName:c}:{},[u,c]),v=(0,q.useRef)(0),x=(0,q.useCallback)(async()=>{let t=++v.current;n({status:`loading`});try{let r=Y(await e(_));if(v.current!==t)return;n({status:`done`,current:r})}catch{if(v.current!==t)return;n({status:`error`})}},[e,_]);(0,q.useEffect)(()=>{g===!1&&(u&&!c||x())},[x,g,u,c]);let S=t.status===`done`?t.current:null,T=(0,q.useMemo)(()=>J.map(e=>({id:e,label:R(e)})),[]),O=(0,q.useMemo)(()=>[{id:`fast`,label:o()},{id:`standard`,label:d()}],[]);return(0,X.jsxs)(`div`,{className:`oc-cdefaults`,children:[(0,X.jsx)(`p`,{className:`oc-admin__hint`,children:k()}),u&&c?(0,X.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,X.jsx)(`span`,{className:`oc-cdefaults__label`,children:b()}),(0,X.jsxs)(B,{value:c,onValueChange:e=>l(e),children:[(0,X.jsx)(F,{size:`sm`,"aria-label":b(),children:(0,X.jsx)(H,{})}),(0,X.jsx)(V,{children:(i??[]).map(e=>(0,X.jsx)(z,{value:e.name,children:e.name},e.name))})]})]}):null,f?(0,X.jsx)(`p`,{className:`oc-admin__hint`,role:`status`,children:s()}):h===`loading`?(0,X.jsx)(`p`,{className:`oc-admin__hint`,children:C()}):h.blocked?(0,X.jsxs)(`p`,{className:`oc-compat__blocked`,role:`status`,children:[(0,X.jsx)(W,{size:14,"aria-hidden":!0}),` `,K(h.gatewayVersion,h.provider)]}):t.status===`loading`?(0,X.jsx)(`p`,{className:`oc-admin__hint`,children:C()}):t.status===`error`?(0,X.jsxs)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:[j(),` `,(0,X.jsx)(P,{variant:`outline`,size:`sm`,onClick:()=>void x(),children:M()})]}):(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,X.jsx)(`span`,{className:`oc-cdefaults__label`,children:a()}),(0,X.jsx)(L,{field:`thinkingLevel`,options:T,value:S?.thinkingDefault??null,onChange:()=>{},disabled:!0,ariaLabel:a()}),(0,X.jsx)(`p`,{className:`oc-cdefaults__help`,children:p()})]}),(0,X.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,X.jsx)(`span`,{className:`oc-cdefaults__label`,children:A()}),(0,X.jsx)(L,{field:`fastMode`,options:O,value:S===null||S.fastModeDefault===null?null:S.fastModeDefault?`fast`:`standard`,onChange:()=>{},disabled:!0,ariaLabel:A()}),(0,X.jsx)(`p`,{className:`oc-cdefaults__help`,children:y()})]}),(0,X.jsx)(`p`,{className:`oc-cdefaults__note`,children:r()})]}),(()=>{let e=i?.find(e=>e.name===(c??i[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{$h as r,Jh as i,Qh as a,Xh as o,Yh as s,Zh as c,eg as l}from"./api-BKX0b765.js";import{t as u}from"./chevrons-up-down-Ds54l-NQ.js";import{t as d}from"./button-DzIspcBY.js";import{Hn as f,It as p,Lt as m,Mt as h,Nt as g,Pn as _,Pt as v,dn as y,gn as b,ut as x,zn as S}from"./index-BbZI7MO0.js";import{a as C,i as w,n as T,o as E,r as D,t as O}from"./table-1BG3EWti.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=l(),bulkActions:F,emptyHint:I=r(),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)(d,{size:`sm`,variant:e.variant===`destructive`?`destructive`:`outline`,onClick:()=>{e.onSelect([...z]),B(new Set)},children:[e.variant===`destructive`?(0,M.jsx)(y,{}):null,e.label,` (`,z.size,`)`]},e.label)):null,N?(0,M.jsxs)(d,{size:`sm`,onClick:N,children:[(0,M.jsx)(b,{}),` `,P]}):null]})]}),t===void 0?(0,M.jsx)(`p`,{className:`oc-admin__hint`,children:a()}):U.length===0?(0,M.jsx)(`p`,{className:`oc-admin__hint`,children:I}):(0,M.jsxs)(O,{children:[(0,M.jsx)(C,{children:(0,M.jsxs)(E,{children:[F?(0,M.jsx)(w,{className:`w-8`,children:(0,M.jsx)(x,{"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":i({column:e.header}),children:[e.header,n?V.dir===`asc`?(0,M.jsx)(S,{className:`oc-dt__sort-icon`,"aria-hidden":!0}):(0,M.jsx)(f,{className:`oc-dt__sort-icon`,"aria-hidden":!0}):(0,M.jsx)(u,{className:`oc-dt__sort-icon oc-dt__sort-icon--idle`,"aria-hidden":!0})]})},e.header):(0,M.jsx)(w,{className:e.className,children:e.header},e.header)}),A?(0,M.jsx)(w,{className:`w-8`}):null]})}),(0,M.jsx)(T,{children:G.map(e=>{let t=A?.(e)??[],r=L?.(e)??!1;return(0,M.jsxs)(k.Fragment,{children:[(0,M.jsxs)(E,{className:`group/row`,children:[F?(0,M.jsx)(D,{children:(0,M.jsx)(x,{"aria-label":o(),checked:z.has(e._id),onCheckedChange:()=>Z(e._id)})}):null,n.map(t=>(0,M.jsx)(D,{className:t.className,children:t.cell(e)},t.header)),A?(0,M.jsx)(D,{children:t.length>0?(0,M.jsxs)(h,{children:[(0,M.jsx)(m,{asChild:!0,children:(0,M.jsx)(d,{variant:`ghost`,size:`icon-sm`,"aria-label":s(),className:`opacity-0 transition-opacity group-hover/row:opacity-100 group-focus-within/row:opacity-100 aria-expanded:opacity-100`,children:(0,M.jsx)(_,{})})}),(0,M.jsx)(g,{align:`end`,children:t.map((t,n)=>(0,M.jsxs)(`div`,{children:[t.variant===`destructive`&&n>0?(0,M.jsx)(p,{}):null,(0,M.jsx)(v,{variant:t.variant,onSelect:()=>t.onSelect(e),children:t.label})]},t.label))})]}):null}):null]}),r&&R?(0,M.jsx)(E,{className:`oc-dt__expansion`,children:(0,M.jsx)(D,{colSpan:q,className:`oc-dt__expansion-cell`,children:R(e)})}):null]},e._id)})})]})]})}export{N as t};
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$h as r,Jh as i,Qh as a,Xh as o,Yh as s,Zh as c,eg as l}from"./api-BPOlScPa.js";import{t as u}from"./chevrons-up-down-WwYjqxmn.js";import{t as d}from"./button-B5OAA4fh.js";import{Hn as f,It as p,Lt as m,Mt as h,Nt as g,Pn as _,Pt as v,dn as y,gn as b,ut as x,zn as S}from"./index-Cd7vK8g7.js";import{a as C,i as w,n as T,o as E,r as D,t as O}from"./table-Bgj0w4qc.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=l(),bulkActions:F,emptyHint:I=r(),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)(d,{size:`sm`,variant:e.variant===`destructive`?`destructive`:`outline`,onClick:()=>{e.onSelect([...z]),B(new Set)},children:[e.variant===`destructive`?(0,M.jsx)(y,{}):null,e.label,` (`,z.size,`)`]},e.label)):null,N?(0,M.jsxs)(d,{size:`sm`,onClick:N,children:[(0,M.jsx)(b,{}),` `,P]}):null]})]}),t===void 0?(0,M.jsx)(`p`,{className:`oc-admin__hint`,children:a()}):U.length===0?(0,M.jsx)(`p`,{className:`oc-admin__hint`,children:I}):(0,M.jsxs)(O,{children:[(0,M.jsx)(C,{children:(0,M.jsxs)(E,{children:[F?(0,M.jsx)(w,{className:`w-8`,children:(0,M.jsx)(x,{"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":i({column:e.header}),children:[e.header,n?V.dir===`asc`?(0,M.jsx)(S,{className:`oc-dt__sort-icon`,"aria-hidden":!0}):(0,M.jsx)(f,{className:`oc-dt__sort-icon`,"aria-hidden":!0}):(0,M.jsx)(u,{className:`oc-dt__sort-icon oc-dt__sort-icon--idle`,"aria-hidden":!0})]})},e.header):(0,M.jsx)(w,{className:e.className,children:e.header},e.header)}),A?(0,M.jsx)(w,{className:`w-8`}):null]})}),(0,M.jsx)(T,{children:G.map(e=>{let t=A?.(e)??[],r=L?.(e)??!1;return(0,M.jsxs)(k.Fragment,{children:[(0,M.jsxs)(E,{className:`group/row`,children:[F?(0,M.jsx)(D,{children:(0,M.jsx)(x,{"aria-label":o(),checked:z.has(e._id),onCheckedChange:()=>Z(e._id)})}):null,n.map(t=>(0,M.jsx)(D,{className:t.className,children:t.cell(e)},t.header)),A?(0,M.jsx)(D,{children:t.length>0?(0,M.jsxs)(h,{children:[(0,M.jsx)(m,{asChild:!0,children:(0,M.jsx)(d,{variant:`ghost`,size:`icon-sm`,"aria-label":s(),className:`opacity-0 transition-opacity group-hover/row:opacity-100 group-focus-within/row:opacity-100 aria-expanded:opacity-100`,children:(0,M.jsx)(_,{})})}),(0,M.jsx)(g,{align:`end`,children:t.map((t,n)=>(0,M.jsxs)(`div`,{children:[t.variant===`destructive`&&n>0?(0,M.jsx)(p,{}):null,(0,M.jsx)(v,{variant:t.variant,onSelect:()=>t.onSelect(e),children:t.label})]},t.label))})]}):null}):null]}),r&&R?(0,M.jsx)(E,{className:`oc-dt__expansion`,children:(0,M.jsx)(D,{colSpan:q,className:`oc-dt__expansion-cell`,children:R(e)})}):null]},e._id)})})]})]})}export{N as t};
@@ -1 +1 @@
1
- import{r as e}from"./bundle-mjs-C73ZY4La.js";import{Et as t}from"./index-BbZI7MO0.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-Cd7vK8g7.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};
@@ -0,0 +1 @@
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$O as r,$o as i,AO as a,BO as o,CO as s,DO as c,EO as l,FO as u,GO as d,HO as ee,IO as te,JO as f,KO as ne,LO as p,MO as m,NO as h,OO as g,PO as _,QO as v,RO as re,SO as y,TO as b,UO as ie,VO as ae,WO as x,XO as S,YO as C,ZO as w,Zo as T,_O as E,aO as D,bO as O,cO as k,dO as A,ek as j,fB as M,fO as N,gO as P,hO as F,iO as I,jO as L,kO as R,lO as z,mO as B,nO as V,nk as H,oO as U,pB as W,pO as oe,qO as G,rO as K,rk as q,sO as se,t as J,tO as ce,tk as le,uO as ue,vO as de,wO as fe,xO as pe,yO as me,zO as he}from"./api-BPOlScPa.js";import{t as ge}from"./button-B5OAA4fh.js";import{U as _e,ct as Y}from"./index-Cd7vK8g7.js";import{t as ve}from"./DataTableShell-1-eBDd8r.js";var X=t(e(),1),Z=n(),ye={altered_words:()=>q(),incorrect:()=>H(),incoherence:()=>le(),formatting:()=>j(),latency:()=>r(),api_error:()=>v(),other:()=>w()},Q=e=>ye[e]?.()??e;function $({matches:e,sourceWasOpen:t}){return t?e===!0?(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-ok`,children:C()}):e===!1?(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-warn`,children:f()}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill`,children:`—`}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill`,children:S()})}function be({data:e,reference:t,closeReason:n}){let r=e.snapshot,s=M(J.feedback.respondToFeedback),[l,f]=(0,X.useState)(e.thread),[v,y]=(0,X.useState)(``),[b,S]=(0,X.useState)(!1);async function C(){let t=v.trim();if(!(!t||b)){S(!0);try{await s({feedbackId:e._id,text:t}),f(e=>[...e,{authorRole:`admin`,text:t,at:Date.now()}]),y(``)}finally{S(!1)}}}let w=[];try{w=r.contextJson?JSON.parse(r.contextJson):[]}catch{w=[]}return(0,Z.jsxs)(`div`,{className:`oc-fbadmin__detail`,children:[(0,Z.jsxs)(`div`,{className:`oc-fbadmin__row`,children:[(0,Z.jsx)($,{matches:r.displayedMatchesStored,sourceWasOpen:r.clientInfo?.sourceWasOpen??!1}),(0,Z.jsxs)(`span`,{className:`oc-fbadmin__meta`,children:[Q(e.category),` · `,r.messageRole,r.isRegeneration?` · ${G()}`:``,r.openclawModel?` · ${r.openclawModel}`:``,r.openclawRuntime?` (${r.openclawRuntime})`:``]}),t?(0,Z.jsx)(`code`,{className:`oc-fbadmin__ref`,style:{userSelect:`all`,marginLeft:`auto`},title:pe(),children:t}):null]}),e.comment?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:ne()}),(0,Z.jsx)(`p`,{className:`oc-fbadmin__comment`,children:e.comment})]}):null,n?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:se()}),(0,Z.jsx)(`p`,{className:`oc-fbadmin__comment`,children:n})]}):null,(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:d()}),l.length>0?(0,Z.jsx)(`div`,{className:`oc-fbadmin__thread`,children:l.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`?x():e.authorRole===`agent`?e.authorLabel??i():ie()}),(0,Z.jsx)(`span`,{className:`oc-notif__msg-text`,children:e.text})]},t))}):(0,Z.jsx)(`p`,{className:`oc-fbadmin__meta`,children:ee()}),(0,Z.jsx)(`textarea`,{className:`oc-feedback__textarea`,placeholder:ae(),value:v,maxLength:2e3,rows:3,onChange:e=>y(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 C(),disabled:!v.trim()||b,children:b?o():he()})})]}),(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:re()}),(0,Z.jsx)(`pre`,{className:`oc-msg__source-pre`,children:r.messageText||p()})]}),r.clientInfo?.sourceWasOpen&&r.displayedText!==void 0?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:te()}),(0,Z.jsx)(`pre`,{className:`oc-msg__source-pre`,children:r.displayedText||p()})]}):null,r.promptText?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:u()}),(0,Z.jsx)(`pre`,{className:`oc-msg__source-pre`,children:r.promptText})]}):null,w.length>0?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:_({count:r.contextCount??w.length,truncated:r.contextTruncated?h():``})}),(0,Z.jsx)(`div`,{className:`oc-fbadmin__ctx`,children:w.map((e,t)=>(0,Z.jsxs)(`div`,{className:`oc-fbadmin__ctx-turn`,children:[(0,Z.jsx)(`span`,{className:`oc-fbadmin__ctx-role`,children:e.role}),(0,Z.jsx)(`span`,{className:`oc-fbadmin__ctx-text`,children:e.text})]},t))})]}):null,r.outboxAvailable?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:m()}),(0,Z.jsxs)(`pre`,{className:`oc-msg__source-pre`,children:[r.outboxText??``,r.outboxStatus?`\n[status: ${r.outboxStatus}]`:``]})]}):null,r.clientInfo?.extensionsDetected&&r.clientInfo.extensionsDetected.length>0?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:L()}),(0,Z.jsx)(`div`,{className:`oc-fbadmin__row`,children:r.clientInfo.extensionsDetected.map(e=>(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-warn`,children:e},e))})]}):null,(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:a()}),(0,Z.jsxs)(`p`,{className:`oc-fbadmin__env`,children:[[r.clientInfo?.language,r.clientInfo?.timezone,r.clientInfo?.theme?R({theme:r.clientInfo.theme}):null,r.runId?`run ${r.runId.slice(0,12)}…`:null].filter(Boolean).join(` · `)||`—`,r.clientInfo?.plugins&&r.clientInfo.plugins.length>0?(0,Z.jsxs)(`span`,{className:`oc-fbadmin__plugins`,children:[g(),` `,r.clientInfo.plugins.join(`, `),(0,Z.jsxs)(`span`,{className:`oc-fbadmin__note`,children:[` `,c()]})]}):null,r.clientInfo?.userAgent?(0,Z.jsx)(`span`,{className:`oc-fbadmin__ua`,children:r.clientInfo.userAgent}):null]})]})]})}function xe(){let e=W(J.feedback.listForAdmin,{}),t=M(J.feedback.readSnapshot),n=M(J.feedback.deleteFeedback),r=_e(),[i,a]=(0,X.useState)(null),[o,c]=(0,X.useState)({});async function u(e){if(i===e._id){a(null);return}if(!o[e._id]){let n=await t({feedbackId:e._id});c(t=>({...t,[e._id]:n}))}a(e._id)}async function d(e){await r({title:K(),description:V(),confirmLabel:ce(),destructive:!0})&&(await n({feedbackId:e._id}),i===e._id&&a(null))}return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`p`,{className:`oc-admin__hint`,children:[l(),` `,(0,Z.jsx)(`strong`,{children:b()}),` `,fe()]}),(0,Z.jsx)(ve,{title:s(),rows:e,emptyHint:y(),isExpanded:e=>i===e._id&&!!o[e._id],renderExpanded:e=>o[e._id]?(0,Z.jsx)(be,{data:o[e._id],reference:e.reference,closeReason:e.userCloseReason}):null,columns:[{header:O(),cell:e=>Y(e.at),sort:e=>e.at},{header:me(),cell:e=>Q(e.category),sort:e=>Q(e.category)},{header:de(),cell:e=>e.messageRole===`user`?E():P(),sort:e=>e.messageRole},{header:F(),cell:e=>(e.reporterEmail||e.reporterName||`—`)+(e.impersonated&&e.realOperatorEmail?` ${B({operator:e.realOperatorEmail})}`:``),sort:e=>e.reporterEmail||e.reporterName||null},{header:oe(),cell:e=>(0,Z.jsx)($,{matches:e.displayedMatchesStored,sourceWasOpen:e.sourceWasOpen}),sort:e=>e.displayedMatchesStored===!1?0:e.displayedMatchesStored===!0?1:2},{header:N(),cell:e=>e.hasComment?`✎`:`—`,sort:e=>+!!e.hasComment},{header:A(),cell:e=>e.userClosedAt==null?e.resolvedAt==null?e.answered?(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-ok`,children:ue()}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill`,children:z()}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-ok`,title:e.resolvedBy??void 0,children:T()}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-closed`,children:k()}),sort:e=>e.userClosedAt==null?e.resolvedAt==null?+!!e.answered:2:3}],rowActions:e=>[{label:i===e._id?U():D(),onSelect:()=>void u(e)},{label:I(),onSelect:()=>void d(e),variant:`destructive`}]})]})}export{xe as FeedbacksTab};
@@ -1 +1 @@
1
- import{r as e}from"./bundle-mjs-C73ZY4La.js";import{D as t,vB as n}from"./api-BKX0b765.js";import{I as r,L as i,R as a,Xt as o,Yt as s,z as c}from"./index-BbZI7MO0.js";import"./locales-CPjguROj.js";import"./curation-CQksaIbm.js";var l=t(`circle-question-mark`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3`,key:`1u773s`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]]),u=[`gateway-http`,`shared-fs`,`off`],d=[`inline`,`shared-fs`],f=[`reactive`,`sse`],p=`reactive`;n.object({mediaMode:n.optional(n.union(n.literal(`gateway-http`),n.literal(`shared-fs`),n.literal(`off`))),inboundMediaMode:n.optional(n.union(n.literal(`inline`),n.literal(`shared-fs`))),rehydration:n.optional(n.boolean()),mediaMaxMb:n.optional(n.number()),attachmentFixAttested:n.optional(n.boolean()),summarizeThresholdChars:n.optional(n.number()),curationEnabled:n.optional(n.boolean()),curationBudgetChars:n.optional(n.number()),converterAgentId:n.optional(n.string()),voiceEnabled:n.optional(n.boolean()),talkEnabled:n.optional(n.boolean()),voiceEngine:n.optional(n.union(n.literal(`browser`),n.literal(`gateway`))),voiceLang:n.optional(n.string()),voiceRate:n.optional(n.number()),voiceAutoRead:n.optional(n.boolean()),contentLocale:n.optional(n.string()),inboundAgentMount:n.optional(n.string()),outboundAgentMount:n.optional(n.string()),promptInjections:n.optional(n.record(n.string(),n.object({enabled:n.optional(n.boolean()),template:n.optional(n.string())})))});var m={mediaMode:`gateway-http`,inboundMediaMode:`inline`,rehydration:!0,mediaMaxMb:1024,inboundAgentMount:`/home/node/.openclaw/media/inbound`,outboundAgentMount:`/home/node/.openclaw/media/outbound`};function h(e,t){let n={};for(let r of o){let i=e?.[r];n[r]={enabled:i?.enabled??!0,template:typeof i?.template==`string`&&i.template.length>0?i.template:s[r].defaultTemplate[t]}}return n}function g(e,t){let n={};for(let r of o){let i=s[r],a=e[r];if(!a)continue;let o={};i.togglable&&a.enabled===!1&&(o.enabled=!1);let c=a.template.trim();c.length>0&&c!==i.defaultTemplate[t]&&(o.template=c),(o.enabled!==void 0||o.template!==void 0)&&(n[r]=o)}return n}function _(e,t){return{mediaMode:e.mediaMode??m.mediaMode,inboundMediaMode:e.inboundMediaMode??m.inboundMediaMode,rehydration:e.rehydration??m.rehydration,mediaMaxMb:e.mediaMaxMb??m.mediaMaxMb,inboundAgentMount:e.inboundAgentMount??m.inboundAgentMount,outboundAgentMount:e.outboundAgentMount??m.outboundAgentMount,promptInjections:h(e.promptInjections,t)}}var v=[`attachmentFixAttested`,`summarizeThresholdChars`,`curationEnabled`,`curationBudgetChars`,`contentLocale`,`converterAgentId`];function y(e,t,n){let r={},i=n=>{(e[n]!==m[n]||t[n]!==void 0)&&(r[n]=e[n])};i(`mediaMode`),i(`inboundMediaMode`),i(`rehydration`),i(`mediaMaxMb`),i(`inboundAgentMount`),i(`outboundAgentMount`);let a=g(e.promptInjections,n);Object.keys(a).length>0&&(r.promptInjections=a);let o=t;for(let e of v){let t=o[e];(typeof t==`number`||typeof t==`boolean`||typeof t==`string`)&&(r[e]=t)}return r}var b=e();function x({text:e}){return(0,b.jsx)(a,{delayDuration:150,children:(0,b.jsxs)(r,{children:[(0,b.jsx)(c,{asChild:!0,children:(0,b.jsx)(`button`,{type:`button`,className:`oc-field__help`,"aria-label":e,onClick:e=>e.preventDefault(),children:(0,b.jsx)(l,{"aria-hidden":!0})})}),(0,b.jsx)(i,{className:`max-w-xs text-pretty`,children:e})]})})}function S({label:e,help:t}){return(0,b.jsxs)(`span`,{className:`oc-field__label`,children:[e,(0,b.jsx)(x,{text:t})]})}export{p as a,f as c,_ as i,S as n,d as o,y as r,u as s,x as t};
1
+ import{r as e}from"./bundle-mjs-C73ZY4La.js";import{D as t,bB as n}from"./api-BPOlScPa.js";import{I as r,L as i,R as a,Xt as o,Yt as s,z as c}from"./index-Cd7vK8g7.js";import"./locales-CPjguROj.js";import"./curation-CQksaIbm.js";var l=t(`circle-question-mark`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3`,key:`1u773s`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]]),u=[`gateway-http`,`shared-fs`,`off`],d=[`inline`,`shared-fs`],f=[`reactive`,`sse`],p=`reactive`;n.object({mediaMode:n.optional(n.union(n.literal(`gateway-http`),n.literal(`shared-fs`),n.literal(`off`))),inboundMediaMode:n.optional(n.union(n.literal(`inline`),n.literal(`shared-fs`))),rehydration:n.optional(n.boolean()),mediaMaxMb:n.optional(n.number()),attachmentFixAttested:n.optional(n.boolean()),summarizeThresholdChars:n.optional(n.number()),curationEnabled:n.optional(n.boolean()),curationBudgetChars:n.optional(n.number()),converterAgentId:n.optional(n.string()),voiceEnabled:n.optional(n.boolean()),talkEnabled:n.optional(n.boolean()),voiceEngine:n.optional(n.union(n.literal(`browser`),n.literal(`gateway`))),voiceLang:n.optional(n.string()),voiceRate:n.optional(n.number()),voiceAutoRead:n.optional(n.boolean()),contentLocale:n.optional(n.string()),inboundAgentMount:n.optional(n.string()),outboundAgentMount:n.optional(n.string()),promptInjections:n.optional(n.record(n.string(),n.object({enabled:n.optional(n.boolean()),template:n.optional(n.string())})))});var m={mediaMode:`gateway-http`,inboundMediaMode:`inline`,rehydration:!0,mediaMaxMb:1024,inboundAgentMount:`/home/node/.openclaw/media/inbound`,outboundAgentMount:`/home/node/.openclaw/media/outbound`};function h(e,t){let n={};for(let r of o){let i=e?.[r];n[r]={enabled:i?.enabled??!0,template:typeof i?.template==`string`&&i.template.length>0?i.template:s[r].defaultTemplate[t]}}return n}function g(e,t){let n={};for(let r of o){let i=s[r],a=e[r];if(!a)continue;let o={};i.togglable&&a.enabled===!1&&(o.enabled=!1);let c=a.template.trim();c.length>0&&c!==i.defaultTemplate[t]&&(o.template=c),(o.enabled!==void 0||o.template!==void 0)&&(n[r]=o)}return n}function _(e,t){return{mediaMode:e.mediaMode??m.mediaMode,inboundMediaMode:e.inboundMediaMode??m.inboundMediaMode,rehydration:e.rehydration??m.rehydration,mediaMaxMb:e.mediaMaxMb??m.mediaMaxMb,inboundAgentMount:e.inboundAgentMount??m.inboundAgentMount,outboundAgentMount:e.outboundAgentMount??m.outboundAgentMount,promptInjections:h(e.promptInjections,t)}}var v=[`attachmentFixAttested`,`summarizeThresholdChars`,`curationEnabled`,`curationBudgetChars`,`contentLocale`,`converterAgentId`];function y(e,t,n){let r={},i=n=>{(e[n]!==m[n]||t[n]!==void 0)&&(r[n]=e[n])};i(`mediaMode`),i(`inboundMediaMode`),i(`rehydration`),i(`mediaMaxMb`),i(`inboundAgentMount`),i(`outboundAgentMount`);let a=g(e.promptInjections,n);Object.keys(a).length>0&&(r.promptInjections=a);let o=t;for(let e of v){let t=o[e];(typeof t==`number`||typeof t==`boolean`||typeof t==`string`)&&(r[e]=t)}return r}var b=e();function x({text:e}){return(0,b.jsx)(a,{delayDuration:150,children:(0,b.jsxs)(r,{children:[(0,b.jsx)(c,{asChild:!0,children:(0,b.jsx)(`button`,{type:`button`,className:`oc-field__help`,"aria-label":e,onClick:e=>e.preventDefault(),children:(0,b.jsx)(l,{"aria-hidden":!0})})}),(0,b.jsx)(i,{className:`max-w-xs text-pretty`,children:e})]})})}function S({label:e,help:t}){return(0,b.jsxs)(`span`,{className:`oc-field__label`,children:[e,(0,b.jsx)(x,{text:t})]})}export{p as a,f as c,_ as i,S as n,d as o,y as r,u as s,x as t};
@@ -0,0 +1 @@
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$R as ee,Cz as te,GR as r,JR as ne,KR as re,QR as i,Sz as a,Tz as ie,WR as ae,XR as o,YR as s,ZR as c,_z as l,az as u,bz as d,cz as f,dz as p,ez as oe,fB as se,fz as m,gz as ce,hz as le,iB as ue,iz as de,lM as fe,lz as h,mz as g,ns as pe,nz as me,oB as he,oz as ge,pB as _e,pz as _,qR as ve,rs as v,rz as ye,sz as be,t as y,tz as b,uz as x,vz as S,wz as C,xz as w,yz as T}from"./api-BPOlScPa.js";import{t as E}from"./button-B5OAA4fh.js";import{$ as D,Ct as O,Dt as k,Et as A,Fn as j,Lt as M,Mt as N,Nt as xe,Pn as Se,Pt as P,Q as F,St as Ce,Tt as we,X as I,Z as L,bt as Te,dn as Ee,et as R,hn as De,ut as Oe,vt as ke,wt as Ae,xt as je,yt as Me}from"./index-Cd7vK8g7.js";import{a as Ne,i as z,n as Pe,o as B,r as V,t as Fe}from"./table-Bgj0w4qc.js";var H=t(e(),1),U=n(),W=`all`;function G(e){switch(e){case`image`:return g();case`audio`:return _();case`video`:return m();case`pdf`:return p();case`document`:return x();case`archive`:return h();default:return f()}}function K(){let[e,t]=(0,H.useState)(W),[n,f]=(0,H.useState)(W),[p,m]=(0,H.useState)(W),[h,g]=(0,H.useState)(W),[_,x]=(0,H.useState)(!1),[K,q]=(0,H.useState)(null),J=se(y.files.softDelete),Y=k();function Ie(){t(W),f(W),m(W),g(W)}async function Le(){let e=K;if(q(null),e)try{await J({fileId:e.id}),Y.success(c())}catch(e){Y.error(o(),e)}}let X=_e(y.files.listMine,{direction:e===W?void 0:e,chatId:n===W?void 0:n,instanceName:p===W?void 0:p,category:h===W?void 0:h,includeAutoGenerated:_||void 0}),Re=(0,H.useMemo)(()=>new Intl.DateTimeFormat(he(),{dateStyle:`medium`,timeStyle:`short`}),[]);if(X===void 0)return(0,U.jsx)(`p`,{className:`oc-admin__hint`,children:ue()});let{files:Z,facets:Q,truncated:ze,cap:Be}=X,$=e!==W||n!==W||p!==W||h!==W;return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`p`,{className:`oc-admin__hint`,children:ie()}),(0,U.jsxs)(`div`,{className:`oc-files__filters`,style:{display:`flex`,flexWrap:`wrap`,gap:8,margin:`12px 0`},children:[(0,U.jsxs)(I,{value:e,onValueChange:t,children:[(0,U.jsx)(D,{size:`sm`,"aria-label":C(),children:(0,U.jsx)(R,{})}),(0,U.jsxs)(L,{children:[(0,U.jsx)(F,{value:W,children:te()}),(0,U.jsx)(F,{value:`inbound`,children:a()}),(0,U.jsx)(F,{value:`outbound`,children:w()})]})]}),(0,U.jsxs)(I,{value:n,onValueChange:f,children:[(0,U.jsx)(D,{size:`sm`,"aria-label":d(),children:(0,U.jsx)(R,{})}),(0,U.jsxs)(L,{children:[(0,U.jsx)(F,{value:W,children:T()}),Q.chats.map(e=>(0,U.jsx)(F,{value:e.id,children:e.title},e.id))]})]}),Q.multiProvider?(0,U.jsxs)(I,{value:p,onValueChange:m,children:[(0,U.jsx)(D,{size:`sm`,"aria-label":S(),children:(0,U.jsx)(R,{})}),(0,U.jsxs)(L,{children:[(0,U.jsx)(F,{value:W,children:l()}),Q.instances.map(e=>(0,U.jsx)(F,{value:e,children:e},e))]})]}):null,(0,U.jsxs)(I,{value:h,onValueChange:g,children:[(0,U.jsx)(D,{size:`sm`,"aria-label":ce(),children:(0,U.jsx)(R,{})}),(0,U.jsxs)(L,{children:[(0,U.jsx)(F,{value:W,children:le()}),Q.categories.map(e=>(0,U.jsx)(F,{value:e,children:G(e)},e))]})]}),(0,U.jsxs)(`label`,{className:`oc-files__autogen`,children:[(0,U.jsx)(Oe,{checked:_,onCheckedChange:e=>x(e===!0),"aria-label":v()}),(0,U.jsx)(`span`,{children:v()})]}),$?(0,U.jsxs)(E,{variant:`ghost`,size:`sm`,onClick:Ie,style:{display:`inline-flex`,alignItems:`center`,gap:4,marginLeft:`auto`},children:[(0,U.jsx)(De,{size:14,"aria-hidden":!0}),oe()]}):null]}),Z.length===0?(0,U.jsx)(`p`,{className:`oc-admin__hint`,children:$?r():re()}):(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(Fe,{children:[(0,U.jsx)(Ne,{children:(0,U.jsxs)(B,{children:[(0,U.jsx)(z,{children:be()}),(0,U.jsx)(z,{children:ge()}),(0,U.jsx)(z,{children:u()}),(0,U.jsx)(z,{children:de()}),(0,U.jsx)(z,{children:ye()}),(0,U.jsx)(z,{className:`text-right`,children:me()})]})}),(0,U.jsx)(Pe,{children:Z.map(e=>(0,U.jsxs)(B,{children:[(0,U.jsxs)(V,{className:`font-medium`,style:{maxWidth:280,overflow:`hidden`,textOverflow:`ellipsis`},title:e.filename,children:[e.filename,e.origin===`pasted`?(0,U.jsx)(A,{variant:`outline`,style:{marginLeft:6},children:pe()}):null]}),(0,U.jsx)(V,{title:e.mimeType,children:G(e.category)}),(0,U.jsx)(V,{children:(0,U.jsx)(A,{variant:`secondary`,children:e.direction===`inbound`?a():w()})}),(0,U.jsx)(V,{style:{maxWidth:220,overflow:`hidden`,textOverflow:`ellipsis`},title:e.chatTitle,children:e.chatTitle}),(0,U.jsx)(V,{className:`whitespace-nowrap text-muted-foreground`,children:Re.format(e.createdAt)}),(0,U.jsx)(V,{className:`text-right`,children:(0,U.jsxs)(N,{children:[(0,U.jsx)(M,{asChild:!0,children:(0,U.jsx)(E,{variant:`ghost`,size:`icon`,"aria-label":ee(),children:(0,U.jsx)(Se,{size:16})})}),(0,U.jsxs)(xe,{align:`end`,children:[e.url?(0,U.jsx)(P,{asChild:!0,children:(0,U.jsxs)(`a`,{href:e.url,download:e.filename,target:`_blank`,rel:`noopener noreferrer`,children:[(0,U.jsx)(j,{size:14}),b()]})}):(0,U.jsxs)(P,{disabled:!0,children:[(0,U.jsx)(j,{size:14}),ve()]}),(0,U.jsxs)(P,{variant:`destructive`,onSelect:()=>q({id:e._id,filename:e.filename}),children:[(0,U.jsx)(Ee,{size:14}),i()]})]})]})})]},e._id))})]}),ze?(0,U.jsx)(`p`,{className:`oc-admin__hint`,style:{marginTop:8},children:ae({cap:Be})}):null]}),(0,U.jsx)(ke,{open:K!==null,onOpenChange:e=>!e&&q(null),children:(0,U.jsxs)(je,{children:[(0,U.jsxs)(Ae,{children:[(0,U.jsx)(we,{children:s()}),(0,U.jsx)(Ce,{children:ne()})]}),(0,U.jsxs)(O,{children:[(0,U.jsx)(Te,{children:fe()}),(0,U.jsx)(Me,{onClick:()=>void Le(),children:i()})]})]})})]})}export{K as FilesTab};
@@ -1 +1 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{ng as r,tg as i}from"./api-BKX0b765.js";import{t as a}from"./button-DzIspcBY.js";import{hn as o,jt as s,mn as c}from"./index-BbZI7MO0.js";import{t as l}from"./TimeRangePicker-C-N7Oi_O.js";var u=t(e(),1),d=n(),f=250;function p({q:e,onQChange:t,searchPlaceholder:n=r(),children:p,timeRange:m,onTimeRangeChange:h,onReset:g,canReset:_=!0}){let[v,y]=(0,u.useState)(e);(0,u.useEffect)(()=>{y(e)},[e]);let b=(0,u.useRef)(null);function x(e){y(e),b.current!==null&&window.clearTimeout(b.current),b.current=window.setTimeout(()=>t(e),f)}(0,u.useEffect)(()=>()=>{b.current!==null&&window.clearTimeout(b.current)},[]);function S(){b.current!==null&&window.clearTimeout(b.current),g()}return(0,d.jsxs)(`div`,{className:`oc-filterbar`,children:[(0,d.jsxs)(`div`,{className:`oc-filterbar__search`,children:[(0,d.jsx)(c,{className:`oc-filterbar__search-icon`,"aria-hidden":!0}),(0,d.jsx)(s,{value:v,onChange:e=>x(e.target.value),placeholder:n,"aria-label":n})]}),p?(0,d.jsx)(`div`,{className:`oc-filterbar__quick`,children:p}):null,m&&h?(0,d.jsx)(l,{value:m,onChange:h}):null,(0,d.jsxs)(a,{variant:`ghost`,size:`sm`,className:`oc-filterbar__reset`,onClick:S,disabled:!_,children:[(0,d.jsx)(o,{}),i()]})]})}export{p as t};
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{ng as r,tg as i}from"./api-BPOlScPa.js";import{t as a}from"./button-B5OAA4fh.js";import{hn as o,jt as s,mn as c}from"./index-Cd7vK8g7.js";import{t as l}from"./TimeRangePicker-yK1328F9.js";var u=t(e(),1),d=n(),f=250;function p({q:e,onQChange:t,searchPlaceholder:n=r(),children:p,timeRange:m,onTimeRangeChange:h,onReset:g,canReset:_=!0}){let[v,y]=(0,u.useState)(e);(0,u.useEffect)(()=>{y(e)},[e]);let b=(0,u.useRef)(null);function x(e){y(e),b.current!==null&&window.clearTimeout(b.current),b.current=window.setTimeout(()=>t(e),f)}(0,u.useEffect)(()=>()=>{b.current!==null&&window.clearTimeout(b.current)},[]);function S(){b.current!==null&&window.clearTimeout(b.current),g()}return(0,d.jsxs)(`div`,{className:`oc-filterbar`,children:[(0,d.jsxs)(`div`,{className:`oc-filterbar__search`,children:[(0,d.jsx)(c,{className:`oc-filterbar__search-icon`,"aria-hidden":!0}),(0,d.jsx)(s,{value:v,onChange:e=>x(e.target.value),placeholder:n,"aria-label":n})]}),p?(0,d.jsx)(`div`,{className:`oc-filterbar__quick`,children:p}):null,m&&h?(0,d.jsx)(l,{value:m,onChange:h}):null,(0,d.jsxs)(a,{variant:`ghost`,size:`sm`,className:`oc-filterbar__reset`,onClick:S,disabled:!_,children:[(0,d.jsx)(o,{}),i()]})]})}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,$p as i,Ap as a,Bp as o,Cp as s,D as c,Dp as l,Ep as u,Fp as d,Gp as f,Hp as p,Ip as m,Jp as h,Kp as g,Lp as _,Mp as v,Np as y,Op as b,Pp as x,Qp as S,Rp as ee,Sp as te,Tp as C,Up as w,Vp as ne,Wp as T,Xp as E,Yp as re,Zp as D,_p as O,am as ie,ap as k,bp as ae,cm as A,cp as j,dB as M,dp as N,em as oe,ep as se,fp as P,gp as F,hp as ce,im as I,ip as le,jp as ue,kp as de,lp as fe,mp as pe,nm as me,np as he,om as ge,op as _e,pp as ve,qp as ye,rm as be,rp as L,sm as xe,sp as Se,t as R,tm as Ce,tp as we,uB as z,up as Te,vp as Ee,wp as B,xp as De,yp as Oe,zp as ke}from"./api-BKX0b765.js";import{t as Ae}from"./x-DP601e4A.js";import{i as V,n as H,r as je,t as Me}from"./tabs-BRizUL-U.js";import{t as U}from"./button-DzIspcBY.js";import{$ as Ne,Bn as Pe,Dt as W,Et as G,Q as Fe,U as Ie,Vn as Le,X as Re,Z as ze,_ as Be,at as Ve,cn as He,et as Ue,fn as K,jt as q,nt as We,ot as Ge,pn as J,q as Ke,rt as qe,tt as Je,ut as Y}from"./index-BbZI7MO0.js";import{t as Ye}from"./FilterBar-udwh54Yv.js";import{t as Xe}from"./DataTableShell-CSEsiKU5.js";import{t as X}from"./DetailChips-BvJrftpU.js";var Ze=c(`palette`,[[`path`,{d:`M12 22a1 1 0 0 1 0-20 10 9 0 0 1 10 9 5 5 0 0 1-5 5h-2.25a1.75 1.75 0 0 0-1.4 2.8l.3.4a1.75 1.75 0 0 1-1.4 2.8z`,key:`e79jfc`}],[`circle`,{cx:`13.5`,cy:`6.5`,r:`.5`,fill:`currentColor`,key:`1okk4w`}],[`circle`,{cx:`17.5`,cy:`10.5`,r:`.5`,fill:`currentColor`,key:`f64h9f`}],[`circle`,{cx:`6.5`,cy:`12.5`,r:`.5`,fill:`currentColor`,key:`qy21gx`}],[`circle`,{cx:`8.5`,cy:`7.5`,r:`.5`,fill:`currentColor`,key:`fotxhn`}]]),Z=c(`shield-check`,[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`,key:`oel41y`}],[`path`,{d:`m9 12 2 2 4-4`,key:`dzmm74`}]]),Q=t(e(),1);function Qe(e,t,n){let r=t.trim().toLowerCase();return[...r?e.filter(e=>[e.email,e.name,e.canonical].some(e=>e!=null&&e.toLowerCase().includes(r))):e.slice()].sort((e,t)=>!n.has(e.userId)-+!n.has(t.userId))}function $e(e,t){let n=e.filter(e=>e.source===`discovered`),r=t.trim().toLowerCase();return r?n.filter(e=>(e.displayName??e.agentId).toLowerCase().includes(r)||e.agentId.toLowerCase().includes(r)):n}function et(e){let t=e.name?.trim()??``,n=e.email?.trim()??``,r=e.canonical?.trim()||`u-${e.userId.slice(0,8)}`;return t?{primary:t,secondary:n||`@${r}`}:n?{primary:n,secondary:null}:{primary:`@${r}`,secondary:null}}function tt(e){switch(e){case`admin`:return de();case`user`:return b();case`pending`:return l();default:return e}}function nt(e,t){if(e.length===0)return`none`;let n=0;for(let r of e)t(r)&&n++;return n===0?`none`:n===e.length?`all`:`some`}function rt(e,t,n){let r=Math.max(1,Math.ceil(e.length/n)),i=Math.min(Math.max(1,Math.floor(t)),r),a=(i-1)*n;return{pageItems:e.slice(a,a+n),page:i,pageCount:r}}var $=n(),it={name:``,description:``};function at(){let e=M(R.groups.listGroups,{}),t=M(R.me.getMe,{host:Ke})?.role===`admin`,n=z(R.groups.createGroup),r=z(R.groups.updateGroup),a=z(R.groups.deleteGroup),o=Ie(),s=W(),[c,l]=(0,Q.useState)(!1),[u,d]=(0,Q.useState)(null),[m,_]=(0,Q.useState)(it),[v,y]=(0,Q.useState)(null),[b,x]=(0,Q.useState)(``),ee=(0,Q.useMemo)(()=>{if(!e)return e;let t=b.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,b]);function te(){d(null),_(it),l(!0)}function C(e){d(e),_({name:e.name,description:e.description??``}),l(!0)}async function O(){try{u?await r({groupId:u._id,name:m.name,description:m.description}):await n({name:m.name,description:m.description||void 0}),_(it),d(null),l(!1)}catch(e){s.error(he(),e)}}async function k(e){if(await o({title:w({name:e.name}),description:p(),confirmWord:e.name,confirmLabel:ne(),cancelLabel:re(),destructive:!0}))try{await a({groupId:e._id})}catch(e){s.error(we(),e)}}return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`p`,{className:`oc-admin__hint`,children:xe()}),(0,$.jsx)(Ye,{q:b,onQChange:x,onReset:()=>x(``),canReset:b!==``,searchPlaceholder:oe()}),(0,$.jsx)(Xe,{title:A(),rows:ee,addLabel:ge(),onAdd:t?te:void 0,emptyHint:ie(),columns:[{header:I(),cell:e=>e.name,sort:e=>e.name},{header:be(),cell:e=>(0,$.jsx)(X,{icon:(0,$.jsx)(He,{size:12,"aria-hidden":!0}),total:e.memberCount,items:e.members.map(e=>({label:e.label,marker:e.manager?(0,$.jsx)(Z,{size:11,"aria-hidden":!0}):null,highlight:e.manager}))}),sort:e=>e.memberCount},{header:me(),cell:e=>(0,$.jsx)(X,{icon:(0,$.jsx)(J,{size:12,"aria-hidden":!0}),total:e.agentCount,items:e.agents.map(e=>({label:e}))}),sort:e=>e.agentCount},{header:Ce(),cell:e=>(0,$.jsx)(X,{icon:(0,$.jsx)(Ze,{size:12,"aria-hidden":!0}),total:e.chartCount,items:e.charts.map(e=>({label:e.name,marker:e.isDefault?(0,$.jsx)(K,{size:11,fill:`currentColor`,"aria-hidden":!0}):null,highlight:e.isDefault}))}),sort:e=>e.chartCount}],rowActions:e=>[{label:i(),onSelect:()=>y({groupId:e._id,name:e.name})},...t?[{label:S(),onSelect:()=>C(e)},{label:D(),variant:`destructive`,onSelect:()=>void k(e)}]:[]]}),(0,$.jsx)(Be,{open:c,onOpenChange:l,title:u?ye():h(),description:g(),canSubmit:!!m.name.trim(),onSubmit:O,submitLabel:E(),children:(0,$.jsxs)(`div`,{className:`oc-form`,children:[(0,$.jsxs)(`label`,{className:`oc-field`,children:[(0,$.jsx)(`span`,{className:`oc-field__label`,children:f()}),(0,$.jsx)(q,{value:m.name,onChange:e=>_({...m,name:e.target.value})})]}),(0,$.jsxs)(`label`,{className:`oc-field`,children:[(0,$.jsx)(`span`,{className:`oc-field__label`,children:T()}),(0,$.jsx)(q,{value:m.description,onChange:e=>_({...m,description:e.target.value})})]})]})}),(0,$.jsx)(ct,{groupId:v?.groupId??null,groupName:v?.name??``,open:v!==null,onOpenChange:e=>{e||y(null)}})]})}var ot=8;function st({page:e,pageCount:t,onPage:n}){return t<=1?null:(0,$.jsxs)(`div`,{className:`oc-access__pager`,children:[(0,$.jsxs)(U,{type:`button`,variant:`ghost`,size:`sm`,disabled:e<=1,onClick:()=>n(e-1),children:[(0,$.jsx)(Le,{size:14,"aria-hidden":!0}),v()]}),(0,$.jsxs)(`span`,{className:`oc-access__pageinfo`,"aria-label":a({page:e,pages:t}),children:[e,` / `,t]}),(0,$.jsxs)(U,{type:`button`,variant:`ghost`,size:`sm`,disabled:e>=t,onClick:()=>n(e+1),children:[ue(),(0,$.jsx)(Pe,{size:14,"aria-hidden":!0})]})]})}function ct({groupId:e,groupName:t,open:n,onOpenChange:r}){let i=M(R.groups.getGroup,n&&e?{groupId:e}:`skip`),a=M(R.groups.listAssignableInstances,n?{}:`skip`),s=M(R.groups.listAssignableUsers,n?{}:`skip`),c=z(R.groups.addMember),l=z(R.groups.removeMember),f=z(R.groups.bulkSetMembers),p=z(R.groups.setGroupManager),h=W(),[g,v]=(0,Q.useState)(``),[b,S]=(0,Q.useState)(``),[C,w]=(0,Q.useState)(`members`),[ne,T]=(0,Q.useState)(1),[E,re]=(0,Q.useState)(new Set),D=(0,Q.useRef)(null),O=(0,Q.useMemo)(()=>new Set((i?.members??[]).map(e=>e.userId)),[i]),ie=(0,Q.useMemo)(()=>new Set((i?.members??[]).filter(e=>e.manager).map(e=>e.userId)),[i]),ae=i?.viewerIsAdmin===!0,A=(0,Q.useMemo)(()=>new Set((i?.agents??[]).map(e=>`${e.instanceName}/${e.agentId}`)),[i]);(0,Q.useEffect)(()=>{v(``),S(``),w(`members`),T(1),D.current=null},[n,e]),(0,Q.useEffect)(()=>{T(1)},[g]),(0,Q.useEffect)(()=>{n&&i&&e&&D.current!==e&&(D.current=e,re(new Set((i.members??[]).map(e=>e.userId))))},[n,i,e]);let j=(0,Q.useMemo)(()=>s?Qe(s,g,E):[],[s,g,E]);async function N(t,n){if(e)try{n?await l({groupId:e,userId:t}):await c({groupId:e,userId:t})}catch(e){h.error(se(),e)}}async function oe(t,n){if(e)try{await p({groupId:e,userId:t,manager:!n})}catch(e){h.error(le(),e)}}let P=nt(j,e=>O.has(e.userId)),F=j.filter(e=>O.has(e.userId)).length,I=rt(j,ne,ot);async function ue(){if(!e||j.length===0)return;let t=j.map(e=>e.userId);try{await f({groupId:e,userIds:t,member:P!==`all`})}catch(e){h.error(se(),e)}}return(0,$.jsx)(Je,{open:n,onOpenChange:r,children:(0,$.jsxs)(We,{className:`oc-access`,children:[(0,$.jsxs)(Ve,{children:[(0,$.jsx)(Ge,{children:o({name:t})}),(0,$.jsx)(qe,{children:ke()})]}),(0,$.jsxs)(Me,{value:C,onValueChange:w,className:`oc-access__tabs`,children:[(0,$.jsxs)(je,{className:`w-full`,children:[(0,$.jsxs)(V,{value:`members`,className:`flex-1 gap-1.5`,children:[(0,$.jsx)(He,{size:13,"aria-hidden":!0}),ee(),i?(0,$.jsx)(G,{variant:`secondary`,className:`oc-access__tabcount`,children:O.size}):null]}),(0,$.jsxs)(V,{value:`agents`,className:`flex-1 gap-1.5`,children:[(0,$.jsx)(J,{size:13,"aria-hidden":!0}),m(),i?(0,$.jsx)(G,{variant:`secondary`,className:`oc-access__tabcount`,children:A.size}):null]}),(0,$.jsxs)(V,{value:`charts`,className:`flex-1 gap-1.5`,children:[(0,$.jsx)(Ze,{size:13,"aria-hidden":!0}),ce(),i?(0,$.jsx)(G,{variant:`secondary`,className:`oc-access__tabcount`,children:i.chartCount}):null]})]}),(0,$.jsx)(H,{value:`members`,children:s===void 0||i===void 0?(0,$.jsx)(`p`,{className:`oc-access__hint`,children:B()}):s.length===0?(0,$.jsx)(`p`,{className:`oc-access__hint`,children:te()}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(q,{value:g,onChange:e=>v(e.target.value),placeholder:_(),className:`oc-access__search`}),j.length===0?(0,$.jsx)(`p`,{className:`oc-access__hint`,children:x()}):(0,$.jsxs)($.Fragment,{children:[j.length>1?(0,$.jsxs)(`div`,{className:`oc-access__row oc-access__selectall`,children:[(0,$.jsx)(Y,{checked:P===`all`?!0:P===`some`?`indeterminate`:!1,onCheckedChange:()=>void ue(),"aria-label":y()}),(0,$.jsx)(`span`,{className:`oc-access__label`,children:y()}),(0,$.jsxs)(G,{variant:`outline`,className:`oc-access__count`,children:[F,` / `,j.length]})]}):null,(0,$.jsx)(`div`,{className:`oc-access__list`,children:I.pageItems.map(e=>{let t=O.has(e.userId),n=et(e),r=ie.has(e.userId);return(0,$.jsxs)(`div`,{className:`oc-access__row`,children:[(0,$.jsx)(Y,{checked:t,onCheckedChange:()=>void N(e.userId,t),"aria-label":u({user:n.primary})}),(0,$.jsxs)(`span`,{className:`oc-access__who`,children:[(0,$.jsx)(`span`,{className:`oc-access__label`,title:n.primary,children:n.primary}),n.secondary?(0,$.jsx)(`span`,{className:`oc-access__sub`,title:n.secondary,children:n.secondary}):null]}),(0,$.jsx)(G,{variant:`outline`,className:`oc-access__role`,children:tt(e.role)}),(0,$.jsx)(`span`,{className:`oc-access__mgrslot`,children:t&&ae?(0,$.jsx)(U,{type:`button`,variant:`ghost`,size:`icon`,className:`shrink-0 oc-access__mgr${r?` oc-access__mgr--on`:``}`,"aria-pressed":r,"aria-label":r?k():_e(),title:r?k():_e(),onClick:()=>void oe(e.userId,r),children:(0,$.jsx)(Z,{size:15,"aria-hidden":!0})}):t&&r?(0,$.jsx)(`span`,{className:`oc-access__mgr oc-access__mgr--on`,role:`img`,"aria-label":Se(),title:Se(),children:(0,$.jsx)(Z,{size:15,"aria-hidden":!0})}):null})]},e._id)})}),(0,$.jsx)(st,{page:I.page,pageCount:I.pageCount,onPage:T})]})]})}),(0,$.jsx)(H,{value:`agents`,children:a===void 0?(0,$.jsx)(`p`,{className:`oc-access__hint`,children:B()}):a.length===0?(0,$.jsx)(`p`,{className:`oc-access__hint`,children:De()}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(q,{value:b,onChange:e=>S(e.target.value),placeholder:d(),className:`oc-access__search`}),(0,$.jsx)(`div`,{className:`oc-access__list`,children:a.map(t=>(0,$.jsx)(lt,{groupId:e,instanceName:t.name,kind:t.kind??`openclaw`,assigned:A,query:b},`${e}-${t._id}`))})]})}),(0,$.jsx)(H,{value:`charts`,children:(0,$.jsx)(ut,{groupId:e})})]})]})})}function lt({groupId:e,instanceName:t,kind:n,assigned:i,query:a}){let o=M(R.groups.listAssignableAgents,{instanceName:t}),c=z(R.groups.assignAgentToGroup),l=z(R.groups.removeAgentFromGroup),u=z(R.groups.bulkSetGroupAgents),d=W(),[f,p]=(0,Q.useState)(1);if((0,Q.useEffect)(()=>{p(1)},[a]),!e)return null;let m=$e(o?.agents??[],a),h=o?.discovery&&!o.discovery.lastPollOk;if(a.trim()&&m.length===0)return null;let g=m.filter(e=>e.presentInLastOk!==!1&&e.enabled!==!1),_=nt(g,e=>i.has(`${t}/${e.agentId}`)),v=rt(m,f,ot);async function b(n,i){try{i?await l({groupId:e,instanceName:t,agentId:n}):await c({groupId:e,instanceName:t,agentId:n})}catch(e){d.error(r(),e)}}async function x(){if(g.length===0)return;let n=g.map(e=>e.agentId);try{await u({groupId:e,instanceName:t,agentIds:n,assigned:_!==`all`})}catch(e){d.error(r(),e)}}return(0,$.jsxs)(`div`,{className:`oc-access__group`,children:[(0,$.jsxs)(`div`,{className:`oc-access__instance`,children:[(0,$.jsx)(J,{size:13,"aria-hidden":!0}),(0,$.jsx)(`span`,{children:t}),(0,$.jsx)(G,{variant:`outline`,className:`oc-access__kind`,children:n}),h?(0,$.jsx)(G,{variant:`outline`,className:`oc-access__stale`,children:Ee()}):null]}),o===void 0?(0,$.jsx)(`p`,{className:`oc-access__hint`,children:s()}):m.length===0?(0,$.jsx)(`p`,{className:`oc-access__hint`,children:h?Oe():ae()}):(0,$.jsxs)($.Fragment,{children:[g.length>1?(0,$.jsxs)(`div`,{className:`oc-access__row oc-access__selectall`,children:[(0,$.jsx)(Y,{checked:_===`all`?!0:_===`some`?`indeterminate`:!1,onCheckedChange:()=>void x(),"aria-label":y()}),(0,$.jsx)(`span`,{className:`oc-access__label`,children:y()})]}):null,v.pageItems.map(e=>{let n=`${t}/${e.agentId}`,r=i.has(n),a=e.presentInLastOk===!1,o=!e.enabled;return(0,$.jsxs)(`div`,{className:`oc-access__row${o?` is-disabled`:``}`,children:[(0,$.jsx)(Y,{checked:r,disabled:(a||o)&&!r,onCheckedChange:()=>void b(e.agentId,r),"aria-label":C({name:e.displayName??e.agentId})}),(0,$.jsxs)(`span`,{className:`oc-access__label`,title:e.displayName??e.agentId,children:[e.emoji?`${e.emoji} `:``,e.displayName??e.agentId]}),e.model?(0,$.jsx)(`span`,{className:`oc-access__model`,children:e.model}):null,e.isDefaultOnInstance?(0,$.jsx)(`span`,{className:`oc-access__fav`,role:`img`,"aria-label":F(),title:F(),children:(0,$.jsx)(K,{size:14,fill:`currentColor`})}):null,a?(0,$.jsx)(G,{variant:`outline`,className:`oc-access__gone`,children:O()}):null]},e.agentId)}),(0,$.jsx)(st,{page:v.page,pageCount:v.pageCount,onPage:p})]})]})}function ut({groupId:e}){let t=M(R.charts.listGroupChartSelection,e?{groupId:e}:`skip`),n=z(R.charts.assignChartToGroup),r=z(R.charts.removeChartFromGroup),i=z(R.charts.setGroupDefaultChart),a=z(R.charts.addChartToGroupPool),o=z(R.charts.removeChartFromGroupPool),s=W();if(!e)return null;if(t===void 0)return(0,$.jsx)(`p`,{className:`oc-access__hint`,children:B()});let{pool:c,addable:l,canManagePool:u}=t;if(c.length===0&&!u)return(0,$.jsx)(`p`,{className:`oc-access__hint`,children:pe()});async function d(t,i){try{i?await r({groupId:e,chartKey:t}):await n({groupId:e,chartKey:t})}catch(e){s.error(L(),e)}}async function f(t){try{await i({groupId:e,chartKey:t})}catch(e){s.error(L(),e)}}async function p(t){try{await a({groupId:e,chartKey:t})}catch(e){s.error(L(),e)}}async function m(t){try{await o({groupId:e,chartKey:t})}catch(e){s.error(L(),e)}}return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`div`,{className:`oc-access__list`,children:c.map(e=>(0,$.jsxs)(`div`,{className:`oc-access__row`,children:[(0,$.jsx)(Y,{checked:e.selected,onCheckedChange:()=>void d(e.chartKey,e.selected),"aria-label":Te({name:e.name})}),(0,$.jsx)(`span`,{className:`oc-access__label`,title:e.name,children:e.name}),e.selected?e.isDefault?(0,$.jsx)(`span`,{className:`oc-access__fav`,role:`img`,"aria-label":fe(),title:fe(),children:(0,$.jsx)(K,{size:14,fill:`currentColor`})}):(0,$.jsx)(U,{type:`button`,variant:`ghost`,size:`sm`,onClick:()=>void f(e.chartKey),children:j()}):null,u?(0,$.jsx)(U,{type:`button`,variant:`ghost`,size:`sm`,"aria-label":N({name:e.name}),title:N({name:e.name}),onClick:()=>void m(e.chartKey),children:(0,$.jsx)(Ae,{size:14,"aria-hidden":!0})}):null]},e.chartKey))}),u?l.length>0?(0,$.jsxs)(Re,{value:``,onValueChange:e=>void p(e),children:[(0,$.jsx)(Ne,{size:`sm`,className:`oc-access__search`,children:(0,$.jsx)(Ue,{placeholder:P()})}),(0,$.jsx)(ze,{children:l.map(e=>(0,$.jsx)(Fe,{value:e.chartKey,children:e.name},e.chartKey))})]}):c.length===0?(0,$.jsx)(`p`,{className:`oc-access__hint`,children:ve()}):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,$p as i,Ap as a,Bp as o,Cp as s,D as c,Dp as l,Ep as u,Fp as d,Gp as f,Hp as p,Ip as m,Jp as h,Kp as g,Lp as _,Mp as v,Np as y,Op as b,Pp as x,Qp as S,Rp as ee,Sp as te,Tp as C,Up as w,Vp as ne,Wp as T,Xp as E,Yp as re,Zp as D,_p as O,am as ie,ap as k,bp as ae,cm as A,cp as j,dp as M,em as oe,ep as se,fB as N,fp as P,gp as F,hp as ce,im as I,ip as le,jp as ue,kp as de,lp as fe,mp as pe,nm as me,np as he,om as ge,op as _e,pB as L,pp as ve,qp as ye,rm as be,rp as R,sm as xe,sp as Se,t as z,tm as Ce,tp as we,up as Te,vp as Ee,wp as B,xp as De,yp as Oe,zp as ke}from"./api-BPOlScPa.js";import{t as Ae}from"./x-BC9FbaDw.js";import{i as V,n as H,r as je,t as Me}from"./tabs-BuQ2R5Cs.js";import{t as U}from"./button-B5OAA4fh.js";import{$ as Ne,Bn as Pe,Dt as W,Et as G,Q as Fe,U as Ie,Vn as Le,X as Re,Z as ze,_ as Be,at as Ve,cn as He,et as Ue,fn as K,jt as q,nt as We,ot as Ge,pn as J,q as Ke,rt as qe,tt as Je,ut as Y}from"./index-Cd7vK8g7.js";import{t as Ye}from"./FilterBar-N2zMJz7R.js";import{t as Xe}from"./DataTableShell-1-eBDd8r.js";import{t as X}from"./DetailChips-u5DvS43f.js";var Ze=c(`palette`,[[`path`,{d:`M12 22a1 1 0 0 1 0-20 10 9 0 0 1 10 9 5 5 0 0 1-5 5h-2.25a1.75 1.75 0 0 0-1.4 2.8l.3.4a1.75 1.75 0 0 1-1.4 2.8z`,key:`e79jfc`}],[`circle`,{cx:`13.5`,cy:`6.5`,r:`.5`,fill:`currentColor`,key:`1okk4w`}],[`circle`,{cx:`17.5`,cy:`10.5`,r:`.5`,fill:`currentColor`,key:`f64h9f`}],[`circle`,{cx:`6.5`,cy:`12.5`,r:`.5`,fill:`currentColor`,key:`qy21gx`}],[`circle`,{cx:`8.5`,cy:`7.5`,r:`.5`,fill:`currentColor`,key:`fotxhn`}]]),Z=c(`shield-check`,[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`,key:`oel41y`}],[`path`,{d:`m9 12 2 2 4-4`,key:`dzmm74`}]]),Q=t(e(),1);function Qe(e,t,n){let r=t.trim().toLowerCase();return[...r?e.filter(e=>[e.email,e.name,e.canonical].some(e=>e!=null&&e.toLowerCase().includes(r))):e.slice()].sort((e,t)=>!n.has(e.userId)-+!n.has(t.userId))}function $e(e,t){let n=e.filter(e=>e.source===`discovered`),r=t.trim().toLowerCase();return r?n.filter(e=>(e.displayName??e.agentId).toLowerCase().includes(r)||e.agentId.toLowerCase().includes(r)):n}function et(e){let t=e.name?.trim()??``,n=e.email?.trim()??``,r=e.canonical?.trim()||`u-${e.userId.slice(0,8)}`;return t?{primary:t,secondary:n||`@${r}`}:n?{primary:n,secondary:null}:{primary:`@${r}`,secondary:null}}function tt(e){switch(e){case`admin`:return de();case`user`:return b();case`pending`:return l();default:return e}}function nt(e,t){if(e.length===0)return`none`;let n=0;for(let r of e)t(r)&&n++;return n===0?`none`:n===e.length?`all`:`some`}function rt(e,t,n){let r=Math.max(1,Math.ceil(e.length/n)),i=Math.min(Math.max(1,Math.floor(t)),r),a=(i-1)*n;return{pageItems:e.slice(a,a+n),page:i,pageCount:r}}var $=n(),it={name:``,description:``};function at(){let e=L(z.groups.listGroups,{}),t=L(z.me.getMe,{host:Ke})?.role===`admin`,n=N(z.groups.createGroup),r=N(z.groups.updateGroup),a=N(z.groups.deleteGroup),o=Ie(),s=W(),[c,l]=(0,Q.useState)(!1),[u,d]=(0,Q.useState)(null),[m,_]=(0,Q.useState)(it),[v,y]=(0,Q.useState)(null),[b,x]=(0,Q.useState)(``),ee=(0,Q.useMemo)(()=>{if(!e)return e;let t=b.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,b]);function te(){d(null),_(it),l(!0)}function C(e){d(e),_({name:e.name,description:e.description??``}),l(!0)}async function O(){try{u?await r({groupId:u._id,name:m.name,description:m.description}):await n({name:m.name,description:m.description||void 0}),_(it),d(null),l(!1)}catch(e){s.error(he(),e)}}async function k(e){if(await o({title:w({name:e.name}),description:p(),confirmWord:e.name,confirmLabel:ne(),cancelLabel:re(),destructive:!0}))try{await a({groupId:e._id})}catch(e){s.error(we(),e)}}return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`p`,{className:`oc-admin__hint`,children:xe()}),(0,$.jsx)(Ye,{q:b,onQChange:x,onReset:()=>x(``),canReset:b!==``,searchPlaceholder:oe()}),(0,$.jsx)(Xe,{title:A(),rows:ee,addLabel:ge(),onAdd:t?te:void 0,emptyHint:ie(),columns:[{header:I(),cell:e=>e.name,sort:e=>e.name},{header:be(),cell:e=>(0,$.jsx)(X,{icon:(0,$.jsx)(He,{size:12,"aria-hidden":!0}),total:e.memberCount,items:e.members.map(e=>({label:e.label,marker:e.manager?(0,$.jsx)(Z,{size:11,"aria-hidden":!0}):null,highlight:e.manager}))}),sort:e=>e.memberCount},{header:me(),cell:e=>(0,$.jsx)(X,{icon:(0,$.jsx)(J,{size:12,"aria-hidden":!0}),total:e.agentCount,items:e.agents.map(e=>({label:e}))}),sort:e=>e.agentCount},{header:Ce(),cell:e=>(0,$.jsx)(X,{icon:(0,$.jsx)(Ze,{size:12,"aria-hidden":!0}),total:e.chartCount,items:e.charts.map(e=>({label:e.name,marker:e.isDefault?(0,$.jsx)(K,{size:11,fill:`currentColor`,"aria-hidden":!0}):null,highlight:e.isDefault}))}),sort:e=>e.chartCount}],rowActions:e=>[{label:i(),onSelect:()=>y({groupId:e._id,name:e.name})},...t?[{label:S(),onSelect:()=>C(e)},{label:D(),variant:`destructive`,onSelect:()=>void k(e)}]:[]]}),(0,$.jsx)(Be,{open:c,onOpenChange:l,title:u?ye():h(),description:g(),canSubmit:!!m.name.trim(),onSubmit:O,submitLabel:E(),children:(0,$.jsxs)(`div`,{className:`oc-form`,children:[(0,$.jsxs)(`label`,{className:`oc-field`,children:[(0,$.jsx)(`span`,{className:`oc-field__label`,children:f()}),(0,$.jsx)(q,{value:m.name,onChange:e=>_({...m,name:e.target.value})})]}),(0,$.jsxs)(`label`,{className:`oc-field`,children:[(0,$.jsx)(`span`,{className:`oc-field__label`,children:T()}),(0,$.jsx)(q,{value:m.description,onChange:e=>_({...m,description:e.target.value})})]})]})}),(0,$.jsx)(ct,{groupId:v?.groupId??null,groupName:v?.name??``,open:v!==null,onOpenChange:e=>{e||y(null)}})]})}var ot=8;function st({page:e,pageCount:t,onPage:n}){return t<=1?null:(0,$.jsxs)(`div`,{className:`oc-access__pager`,children:[(0,$.jsxs)(U,{type:`button`,variant:`ghost`,size:`sm`,disabled:e<=1,onClick:()=>n(e-1),children:[(0,$.jsx)(Le,{size:14,"aria-hidden":!0}),v()]}),(0,$.jsxs)(`span`,{className:`oc-access__pageinfo`,"aria-label":a({page:e,pages:t}),children:[e,` / `,t]}),(0,$.jsxs)(U,{type:`button`,variant:`ghost`,size:`sm`,disabled:e>=t,onClick:()=>n(e+1),children:[ue(),(0,$.jsx)(Pe,{size:14,"aria-hidden":!0})]})]})}function ct({groupId:e,groupName:t,open:n,onOpenChange:r}){let i=L(z.groups.getGroup,n&&e?{groupId:e}:`skip`),a=L(z.groups.listAssignableInstances,n?{}:`skip`),s=L(z.groups.listAssignableUsers,n?{}:`skip`),c=N(z.groups.addMember),l=N(z.groups.removeMember),f=N(z.groups.bulkSetMembers),p=N(z.groups.setGroupManager),h=W(),[g,v]=(0,Q.useState)(``),[b,S]=(0,Q.useState)(``),[C,w]=(0,Q.useState)(`members`),[ne,T]=(0,Q.useState)(1),[E,re]=(0,Q.useState)(new Set),D=(0,Q.useRef)(null),O=(0,Q.useMemo)(()=>new Set((i?.members??[]).map(e=>e.userId)),[i]),ie=(0,Q.useMemo)(()=>new Set((i?.members??[]).filter(e=>e.manager).map(e=>e.userId)),[i]),ae=i?.viewerIsAdmin===!0,A=(0,Q.useMemo)(()=>new Set((i?.agents??[]).map(e=>`${e.instanceName}/${e.agentId}`)),[i]);(0,Q.useEffect)(()=>{v(``),S(``),w(`members`),T(1),D.current=null},[n,e]),(0,Q.useEffect)(()=>{T(1)},[g]),(0,Q.useEffect)(()=>{n&&i&&e&&D.current!==e&&(D.current=e,re(new Set((i.members??[]).map(e=>e.userId))))},[n,i,e]);let j=(0,Q.useMemo)(()=>s?Qe(s,g,E):[],[s,g,E]);async function M(t,n){if(e)try{n?await l({groupId:e,userId:t}):await c({groupId:e,userId:t})}catch(e){h.error(se(),e)}}async function oe(t,n){if(e)try{await p({groupId:e,userId:t,manager:!n})}catch(e){h.error(le(),e)}}let P=nt(j,e=>O.has(e.userId)),F=j.filter(e=>O.has(e.userId)).length,I=rt(j,ne,ot);async function ue(){if(!e||j.length===0)return;let t=j.map(e=>e.userId);try{await f({groupId:e,userIds:t,member:P!==`all`})}catch(e){h.error(se(),e)}}return(0,$.jsx)(Je,{open:n,onOpenChange:r,children:(0,$.jsxs)(We,{className:`oc-access`,children:[(0,$.jsxs)(Ve,{children:[(0,$.jsx)(Ge,{children:o({name:t})}),(0,$.jsx)(qe,{children:ke()})]}),(0,$.jsxs)(Me,{value:C,onValueChange:w,className:`oc-access__tabs`,children:[(0,$.jsxs)(je,{className:`w-full`,children:[(0,$.jsxs)(V,{value:`members`,className:`flex-1 gap-1.5`,children:[(0,$.jsx)(He,{size:13,"aria-hidden":!0}),ee(),i?(0,$.jsx)(G,{variant:`secondary`,className:`oc-access__tabcount`,children:O.size}):null]}),(0,$.jsxs)(V,{value:`agents`,className:`flex-1 gap-1.5`,children:[(0,$.jsx)(J,{size:13,"aria-hidden":!0}),m(),i?(0,$.jsx)(G,{variant:`secondary`,className:`oc-access__tabcount`,children:A.size}):null]}),(0,$.jsxs)(V,{value:`charts`,className:`flex-1 gap-1.5`,children:[(0,$.jsx)(Ze,{size:13,"aria-hidden":!0}),ce(),i?(0,$.jsx)(G,{variant:`secondary`,className:`oc-access__tabcount`,children:i.chartCount}):null]})]}),(0,$.jsx)(H,{value:`members`,children:s===void 0||i===void 0?(0,$.jsx)(`p`,{className:`oc-access__hint`,children:B()}):s.length===0?(0,$.jsx)(`p`,{className:`oc-access__hint`,children:te()}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(q,{value:g,onChange:e=>v(e.target.value),placeholder:_(),className:`oc-access__search`}),j.length===0?(0,$.jsx)(`p`,{className:`oc-access__hint`,children:x()}):(0,$.jsxs)($.Fragment,{children:[j.length>1?(0,$.jsxs)(`div`,{className:`oc-access__row oc-access__selectall`,children:[(0,$.jsx)(Y,{checked:P===`all`?!0:P===`some`?`indeterminate`:!1,onCheckedChange:()=>void ue(),"aria-label":y()}),(0,$.jsx)(`span`,{className:`oc-access__label`,children:y()}),(0,$.jsxs)(G,{variant:`outline`,className:`oc-access__count`,children:[F,` / `,j.length]})]}):null,(0,$.jsx)(`div`,{className:`oc-access__list`,children:I.pageItems.map(e=>{let t=O.has(e.userId),n=et(e),r=ie.has(e.userId);return(0,$.jsxs)(`div`,{className:`oc-access__row`,children:[(0,$.jsx)(Y,{checked:t,onCheckedChange:()=>void M(e.userId,t),"aria-label":u({user:n.primary})}),(0,$.jsxs)(`span`,{className:`oc-access__who`,children:[(0,$.jsx)(`span`,{className:`oc-access__label`,title:n.primary,children:n.primary}),n.secondary?(0,$.jsx)(`span`,{className:`oc-access__sub`,title:n.secondary,children:n.secondary}):null]}),(0,$.jsx)(G,{variant:`outline`,className:`oc-access__role`,children:tt(e.role)}),(0,$.jsx)(`span`,{className:`oc-access__mgrslot`,children:t&&ae?(0,$.jsx)(U,{type:`button`,variant:`ghost`,size:`icon`,className:`shrink-0 oc-access__mgr${r?` oc-access__mgr--on`:``}`,"aria-pressed":r,"aria-label":r?k():_e(),title:r?k():_e(),onClick:()=>void oe(e.userId,r),children:(0,$.jsx)(Z,{size:15,"aria-hidden":!0})}):t&&r?(0,$.jsx)(`span`,{className:`oc-access__mgr oc-access__mgr--on`,role:`img`,"aria-label":Se(),title:Se(),children:(0,$.jsx)(Z,{size:15,"aria-hidden":!0})}):null})]},e._id)})}),(0,$.jsx)(st,{page:I.page,pageCount:I.pageCount,onPage:T})]})]})}),(0,$.jsx)(H,{value:`agents`,children:a===void 0?(0,$.jsx)(`p`,{className:`oc-access__hint`,children:B()}):a.length===0?(0,$.jsx)(`p`,{className:`oc-access__hint`,children:De()}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(q,{value:b,onChange:e=>S(e.target.value),placeholder:d(),className:`oc-access__search`}),(0,$.jsx)(`div`,{className:`oc-access__list`,children:a.map(t=>(0,$.jsx)(lt,{groupId:e,instanceName:t.name,kind:t.kind??`openclaw`,assigned:A,query:b},`${e}-${t._id}`))})]})}),(0,$.jsx)(H,{value:`charts`,children:(0,$.jsx)(ut,{groupId:e})})]})]})})}function lt({groupId:e,instanceName:t,kind:n,assigned:i,query:a}){let o=L(z.groups.listAssignableAgents,{instanceName:t}),c=N(z.groups.assignAgentToGroup),l=N(z.groups.removeAgentFromGroup),u=N(z.groups.bulkSetGroupAgents),d=W(),[f,p]=(0,Q.useState)(1);if((0,Q.useEffect)(()=>{p(1)},[a]),!e)return null;let m=$e(o?.agents??[],a),h=o?.discovery&&!o.discovery.lastPollOk;if(a.trim()&&m.length===0)return null;let g=m.filter(e=>e.presentInLastOk!==!1&&e.enabled!==!1),_=nt(g,e=>i.has(`${t}/${e.agentId}`)),v=rt(m,f,ot);async function b(n,i){try{i?await l({groupId:e,instanceName:t,agentId:n}):await c({groupId:e,instanceName:t,agentId:n})}catch(e){d.error(r(),e)}}async function x(){if(g.length===0)return;let n=g.map(e=>e.agentId);try{await u({groupId:e,instanceName:t,agentIds:n,assigned:_!==`all`})}catch(e){d.error(r(),e)}}return(0,$.jsxs)(`div`,{className:`oc-access__group`,children:[(0,$.jsxs)(`div`,{className:`oc-access__instance`,children:[(0,$.jsx)(J,{size:13,"aria-hidden":!0}),(0,$.jsx)(`span`,{children:t}),(0,$.jsx)(G,{variant:`outline`,className:`oc-access__kind`,children:n}),h?(0,$.jsx)(G,{variant:`outline`,className:`oc-access__stale`,children:Ee()}):null]}),o===void 0?(0,$.jsx)(`p`,{className:`oc-access__hint`,children:s()}):m.length===0?(0,$.jsx)(`p`,{className:`oc-access__hint`,children:h?Oe():ae()}):(0,$.jsxs)($.Fragment,{children:[g.length>1?(0,$.jsxs)(`div`,{className:`oc-access__row oc-access__selectall`,children:[(0,$.jsx)(Y,{checked:_===`all`?!0:_===`some`?`indeterminate`:!1,onCheckedChange:()=>void x(),"aria-label":y()}),(0,$.jsx)(`span`,{className:`oc-access__label`,children:y()})]}):null,v.pageItems.map(e=>{let n=`${t}/${e.agentId}`,r=i.has(n),a=e.presentInLastOk===!1,o=!e.enabled;return(0,$.jsxs)(`div`,{className:`oc-access__row${o?` is-disabled`:``}`,children:[(0,$.jsx)(Y,{checked:r,disabled:(a||o)&&!r,onCheckedChange:()=>void b(e.agentId,r),"aria-label":C({name:e.displayName??e.agentId})}),(0,$.jsxs)(`span`,{className:`oc-access__label`,title:e.displayName??e.agentId,children:[e.emoji?`${e.emoji} `:``,e.displayName??e.agentId]}),e.model?(0,$.jsx)(`span`,{className:`oc-access__model`,children:e.model}):null,e.isDefaultOnInstance?(0,$.jsx)(`span`,{className:`oc-access__fav`,role:`img`,"aria-label":F(),title:F(),children:(0,$.jsx)(K,{size:14,fill:`currentColor`})}):null,a?(0,$.jsx)(G,{variant:`outline`,className:`oc-access__gone`,children:O()}):null]},e.agentId)}),(0,$.jsx)(st,{page:v.page,pageCount:v.pageCount,onPage:p})]})]})}function ut({groupId:e}){let t=L(z.charts.listGroupChartSelection,e?{groupId:e}:`skip`),n=N(z.charts.assignChartToGroup),r=N(z.charts.removeChartFromGroup),i=N(z.charts.setGroupDefaultChart),a=N(z.charts.addChartToGroupPool),o=N(z.charts.removeChartFromGroupPool),s=W();if(!e)return null;if(t===void 0)return(0,$.jsx)(`p`,{className:`oc-access__hint`,children:B()});let{pool:c,addable:l,canManagePool:u}=t;if(c.length===0&&!u)return(0,$.jsx)(`p`,{className:`oc-access__hint`,children:pe()});async function d(t,i){try{i?await r({groupId:e,chartKey:t}):await n({groupId:e,chartKey:t})}catch(e){s.error(R(),e)}}async function f(t){try{await i({groupId:e,chartKey:t})}catch(e){s.error(R(),e)}}async function p(t){try{await a({groupId:e,chartKey:t})}catch(e){s.error(R(),e)}}async function m(t){try{await o({groupId:e,chartKey:t})}catch(e){s.error(R(),e)}}return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`div`,{className:`oc-access__list`,children:c.map(e=>(0,$.jsxs)(`div`,{className:`oc-access__row`,children:[(0,$.jsx)(Y,{checked:e.selected,onCheckedChange:()=>void d(e.chartKey,e.selected),"aria-label":Te({name:e.name})}),(0,$.jsx)(`span`,{className:`oc-access__label`,title:e.name,children:e.name}),e.selected?e.isDefault?(0,$.jsx)(`span`,{className:`oc-access__fav`,role:`img`,"aria-label":fe(),title:fe(),children:(0,$.jsx)(K,{size:14,fill:`currentColor`})}):(0,$.jsx)(U,{type:`button`,variant:`ghost`,size:`sm`,onClick:()=>void f(e.chartKey),children:j()}):null,u?(0,$.jsx)(U,{type:`button`,variant:`ghost`,size:`sm`,"aria-label":M({name:e.name}),title:M({name:e.name}),onClick:()=>void m(e.chartKey),children:(0,$.jsx)(Ae,{size:14,"aria-hidden":!0})}):null]},e.chartKey))}),u?l.length>0?(0,$.jsxs)(Re,{value:``,onValueChange:e=>void p(e),children:[(0,$.jsx)(Ne,{size:`sm`,className:`oc-access__search`,children:(0,$.jsx)(Ue,{placeholder:P()})}),(0,$.jsx)(ze,{children:l.map(e=>(0,$.jsx)(Fe,{value:e.chartKey,children:e.name},e.chartKey))})]}):c.length===0?(0,$.jsx)(`p`,{className:`oc-access__hint`,children:ve()}):null:null]})}export{at as GroupsTab};
@@ -0,0 +1 @@
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$E as r,$T as i,AE as a,B as o,BE as s,BT as c,CD as l,CE as u,DD as d,DE as f,ED as p,EE as m,Ex as h,F as g,FE as _,Fi as v,GE as y,GT as b,H as x,HE as S,HT as C,I as ee,IE as w,JE as T,JT as E,KE as te,KT as ne,L as re,LE as D,M as ie,ME as ae,N as oe,NE as O,Ni as se,OE as ce,P as le,PE as ue,Pi as de,QE as fe,QT as pe,R as me,RE as he,RT as ge,SD as _e,SE as ve,TD as ye,TE as be,Tx as xe,UE as Se,UT as Ce,V as we,VE as Te,VT as Ee,WE as De,WT as Oe,XE as ke,XT as Ae,YE as je,YT as Me,ZE as Ne,ZT as Pe,_D as Fe,_E as Ie,aD as Le,aE as Re,bD as ze,bE as Be,cD as Ve,cE as k,cc as He,dD as Ue,dE as We,dN as Ge,dc as Ke,eD as qe,eE as Je,fB as A,fD as Ye,fE as Xe,gD as Ze,gE as Qe,hD as $e,hE as et,iD as tt,iE as nt,j as rt,jE as it,kE as at,lD as ot,lE as st,lc as ct,mD as lt,mE as ut,nD as dt,nE as ft,oD as pt,oE as mt,pB as j,pD as M,pE as N,qE as ht,qT as gt,rD as _t,rE as vt,sD as yt,t as P,tD as bt,tE as xt,uB as F,uD as St,uE as Ct,uN as wt,uc as Tt,vD as Et,vE as Dt,wD as Ot,wE as kt,xD as At,xE as jt,yD as Mt,yE as Nt,z as Pt,zE as Ft,zT as It}from"./api-BPOlScPa.js";import{a as Lt,c as Rt}from"./FieldLabel-CZ3VfRyz.js";import{t as I}from"./button-B5OAA4fh.js";import{$ as L,Bt as zt,Dt as R,Et as z,Q as B,Rt as Bt,U as Vt,X as V,Z as H,_ as Ht,at as U,et as W,jt as G,nt as K,ot as q,rt as Ut,tt as Wt,ut as Gt,zt as Kt}from"./index-Cd7vK8g7.js";import{t as qt}from"./DataTableShell-1-eBDd8r.js";import{InstanceConfigDialog as Jt}from"./BridgeTab-CG9yn0Is.js";var J=t(e(),1),Y=[`conversational`,`documentary`,`summarizer`,`curator`],Yt=new Set(Y),Xt=`conversational`;function Zt(e){let t=new Set((e??[]).filter(e=>Yt.has(e)));return t.size===0?[Xt]:Y.filter(e=>t.has(e))}var X=n(),Z={name:``,gatewayUrl:``,bridgeUrl:``,displayName:``,kind:`openclaw`,transport:`ws`,gatewayVersion:``,gatewayHttpUrl:``,authMode:`token`,personScopes:`capped`,systemIdentity:``,streamTransport:Lt},Qt={openclaw:[`token`,`deviceIdentity`],hermes:[`apiKey`]};function $t(e){return{name:e.name,gatewayUrl:e.gatewayUrl,bridgeUrl:e.bridgeUrl??``,displayName:e.displayName??``,kind:e.kind??`openclaw`,transport:e.transport??`ws`,gatewayVersion:e.gatewayVersion??``,gatewayHttpUrl:e.gatewayHttpUrl??``,authMode:e.authMode??`token`,personScopes:e.personScopes??`capped`,systemIdentity:e.systemIdentity??``,streamTransport:e.streamTransport??`reactive`}}function en(){let e=j(P.admin.listInstances,{}),t=j(P.agents.listAllInstanceAgents,{}),n=A(P.admin.upsertInstance),i=A(P.admin.deleteInstance),a=R(),[s,c]=(0,J.useState)(!1),[u,f]=(0,J.useState)(Z),[m,_]=(0,J.useState)(null),[y,b]=(0,J.useState)(null),[S,C]=(0,J.useState)(null),[w,T]=(0,J.useState)(null);async function E(){try{await n({instanceId:w??void 0,name:u.name,gatewayUrl:u.gatewayUrl,bridgeUrl:u.bridgeUrl||void 0,displayName:u.displayName||void 0,kind:u.kind,transport:u.kind===`hermes`?u.transport:void 0,gatewayVersion:u.gatewayVersion||void 0,gatewayHttpUrl:u.gatewayHttpUrl||void 0,...u.kind===`openclaw`?{authMode:u.authMode,personScopes:u.personScopes,systemIdentity:u.systemIdentity||void 0}:{},streamTransport:u.streamTransport}),f(Z),T(null),c(!1)}catch(e){a.error(ye(),e)}}return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`p`,{className:`oc-admin__hint`,children:[Ot(),(0,X.jsx)(`strong`,{children:l()}),_e()]}),(0,X.jsx)(qt,{title:At(),rows:e,addLabel:ze(),onAdd:()=>{T(null),f(Z),c(!0)},emptyHint:Mt(),columns:[{header:Et(),cell:e=>e.name,sort:e=>e.name},{header:Fe(),cell:e=>(0,X.jsx)(z,{variant:`outline`,children:e.kind??`openclaw`}),sort:e=>e.kind??`openclaw`},{header:Ze(),cell:e=>e.gatewayUrl,sort:e=>e.gatewayUrl},{header:$e(),cell:e=>e.displayName??`—`,sort:e=>e.displayName??null},{header:d(),cell:e=>{let n=(t?.[e.name]??[]).filter(e=>e.presentInLastOk!==!1&&e.enabled);if(n.length===0)return(0,X.jsx)(`span`,{className:`text-muted-foreground`,children:`—`});let r=t=>e.defaultAgentId===t;return(0,X.jsx)(`div`,{className:`flex flex-wrap gap-1`,children:[...n].sort((e,t)=>Number(r(t.agentId))-Number(r(e.agentId))).map(e=>(0,X.jsxs)(z,{variant:r(e.agentId)?`default`:`outline`,title:r(e.agentId)?It():void 0,children:[e.emoji?`${e.emoji} `:``,e.displayName??e.agentId]},e.agentId))})}}],rowActions:e=>[{label:Ue(),onSelect:()=>{T(e._id),f($t(e)),c(!0)}},{label:p(),onSelect:()=>_(e.name)},{label:ke(),onSelect:()=>C(e)},{label:lt(),onSelect:()=>b(e)},{label:M(),variant:`destructive`,onSelect:()=>void i({instanceId:e._id})}],bulkActions:[{label:M(),variant:`destructive`,onSelect:e=>e.forEach(e=>void i({instanceId:e}))}]}),(0,X.jsx)(Ht,{open:s,onOpenChange:c,title:w?St():Ye(),description:Ve(),canSubmit:!!(u.name&&u.gatewayUrl),onSubmit:E,submitLabel:yt(),children:(0,X.jsxs)(`div`,{className:`oc-form`,children:[(0,X.jsxs)($,{label:pt(),children:[(0,X.jsx)(G,{value:u.name,disabled:w!==null,onChange:e=>f({...u,name:e.target.value})}),w?(0,X.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:ot()}):null]}),(0,X.jsx)($,{label:Le(),children:(0,X.jsxs)(V,{value:u.kind,onValueChange:e=>f({...u,kind:e}),children:[(0,X.jsx)(L,{size:`sm`,className:`w-full`,children:(0,X.jsx)(W,{})}),(0,X.jsxs)(H,{children:[(0,X.jsx)(B,{value:`openclaw`,children:`OpenClaw`}),(0,X.jsx)(B,{value:`hermes`,children:`Hermes`})]})]})}),u.kind===`hermes`?(0,X.jsx)($,{label:v(),children:(0,X.jsxs)(V,{value:u.transport,onValueChange:e=>f({...u,transport:e}),children:[(0,X.jsx)(L,{size:`sm`,className:`w-full`,children:(0,X.jsx)(W,{})}),(0,X.jsxs)(H,{children:[(0,X.jsx)(B,{value:`ws`,children:de()}),(0,X.jsx)(B,{value:`rest`,children:se()})]})]})}):null,(0,X.jsx)($,{label:tt(),children:(0,X.jsx)(G,{value:u.gatewayUrl,onChange:e=>f({...u,gatewayUrl:e.target.value})})}),(0,X.jsx)($,{label:_t(),children:(0,X.jsx)(G,{value:u.bridgeUrl,placeholder:dt(),onChange:e=>f({...u,bridgeUrl:e.target.value})})}),(0,X.jsx)($,{label:bt(),children:(0,X.jsx)(G,{value:u.displayName,onChange:e=>f({...u,displayName:e.target.value})})}),(0,X.jsxs)($,{label:h(),children:[(0,X.jsxs)(V,{value:u.streamTransport,onValueChange:e=>f({...u,streamTransport:e}),children:[(0,X.jsx)(L,{size:`sm`,className:`w-full`,children:(0,X.jsx)(W,{})}),(0,X.jsx)(H,{children:Rt.map(e=>(0,X.jsx)(B,{value:e,children:e},e))})]}),(0,X.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:xe()})]}),(0,X.jsx)($,{label:qe(),children:(0,X.jsx)(G,{value:u.gatewayVersion,placeholder:r(),onChange:e=>f({...u,gatewayVersion:e.target.value})})}),u.kind===`openclaw`?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)($,{label:re(),children:[(0,X.jsxs)(V,{value:u.authMode,onValueChange:e=>f({...u,authMode:e}),children:[(0,X.jsx)(L,{size:`sm`,className:`w-full`,children:(0,X.jsx)(W,{})}),(0,X.jsxs)(H,{children:[(0,X.jsx)(B,{value:`token`,children:ee()}),(0,X.jsx)(B,{value:`trusted-proxy`,children:g()})]})]}),(0,X.jsx)(`p`,{className:`oc-field__hint`,children:u.authMode===`trusted-proxy`?oe():le()})]}),u.authMode===`trusted-proxy`?(0,X.jsxs)($,{label:x(),children:[(0,X.jsxs)(V,{value:u.personScopes,onValueChange:e=>f({...u,personScopes:e}),children:[(0,X.jsx)(L,{size:`sm`,className:`w-full`,children:(0,X.jsx)(W,{})}),(0,X.jsxs)(H,{children:[(0,X.jsx)(B,{value:`capped`,children:we()}),(0,X.jsx)(B,{value:`full`,children:o()})]})]}),(0,X.jsx)(`p`,{className:`oc-field__hint`,children:u.personScopes===`full`?me():Pt()})]}):null,u.authMode===`trusted-proxy`?(0,X.jsx)($,{label:ie(),children:(0,X.jsx)(G,{value:u.systemIdentity,placeholder:rt(),onChange:e=>f({...u,systemIdentity:e.target.value})})}):null]}):null,(0,X.jsx)($,{label:fe(),children:(0,X.jsx)(G,{value:u.gatewayHttpUrl,placeholder:Ne(),onChange:e=>f({...u,gatewayHttpUrl:e.target.value})})})]})}),(0,X.jsx)(un,{instanceName:m,open:m!==null,onOpenChange:e=>{e||_(null)}}),y?(0,X.jsx)(Jt,{instance:y,onClose:()=>b(null)},y._id):null,S?(0,X.jsx)(tn,{instance:S,onClose:()=>C(null)},S._id):null]})}function tn({instance:e,onClose:t}){let n=j(P.instanceSecrets.listInstanceSecretStatus,{}),r=Qt[e.kind??`openclaw`],i=(0,J.useMemo)(()=>{let t={};for(let r of n??[])r.instanceId===e._id&&(t[r.field]=r.updatedAt);return t},[n,e._id]);return(0,X.jsx)(Wt,{open:!0,onOpenChange:e=>!e&&t(),children:(0,X.jsxs)(K,{onOpenAutoFocus:e=>e.preventDefault(),children:[(0,X.jsxs)(U,{children:[(0,X.jsx)(q,{children:je({instance:e.displayName??e.name})}),(0,X.jsx)(Ut,{children:T()})]}),(0,X.jsx)(`div`,{className:`oc-form`,children:r.map(t=>(0,X.jsx)(an,{instanceId:e._id,field:t,updatedAt:i[t]??null},t))}),(0,X.jsx)(`div`,{className:`oc-bridgesecret`,children:(0,X.jsx)(rn,{instance:e})}),(0,X.jsx)(nn,{instance:e})]})})}function nn({instance:e}){let t=F(P.instanceSync.forceInstanceSync),n=R(),[r,i]=(0,J.useState)(!1);async function o(){if(!r){i(!0);try{switch((await t({instanceId:e._id})).status){case`synced`:n.success(ce());break;case`no_agents`:n.success(m());break;case`no_bridge_url`:n.error(be());break;case`deploy_misconfigured`:n.error(kt());break;case`unauthorized`:n.error(ve());break;case`not_served`:n.error(jt());break;default:n.error(u());break}}catch(e){n.error(f(),e)}finally{i(!1)}}}return(0,X.jsxs)(`div`,{className:`oc-form`,children:[(0,X.jsx)(`p`,{className:`oc-admin__hint`,children:Be()}),(0,X.jsx)(`div`,{className:`flex items-center gap-2`,children:(0,X.jsx)(I,{size:`sm`,variant:`outline`,onClick:()=>void o(),disabled:r,children:r?at():a()})})]})}function rn({instance:e}){let t=j(P.bridgeAuth.listBridgeAuthStatus,{}),n=F(P.bridgeAuth.mintBridgeSecret),r=A(P.bridgeAuth.revokeBridgeSecret),i=R(),[a,o]=(0,J.useState)(!1),[s,c]=(0,J.useState)(null),[l,u]=(0,J.useState)(!1),d=(t??[]).find(t=>t.instanceId===e._id),f=d!==void 0;async function p(){if(!a){o(!0);try{c((await n({instanceId:e._id})).plaintext),u(!1)}catch(e){i.error(N(),e)}finally{o(!1)}}}async function m(){if(!a){o(!0);try{await r({instanceId:e._id}),c(null),i.success(ut())}catch(e){i.error(N(),e)}finally{o(!1)}}}async function h(){if(s)try{await navigator.clipboard.writeText(s),u(!0)}catch{}}return(0,X.jsxs)($,{label:Nt(),children:[(0,X.jsx)(`p`,{className:`oc-admin__hint`,children:Dt()}),(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,X.jsx)(z,{variant:f?`outline`:`secondary`,children:f?`${De()} · ${d.prefix}…${d.lastFour}`:Se()}),(0,X.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,X.jsx)(I,{size:`sm`,onClick:()=>void p(),disabled:a,children:f?Qe():Ie()}),f?(0,X.jsx)(I,{size:`sm`,variant:`destructive`,onClick:()=>void m(),disabled:a,children:et()}):null]})]}),s?(0,X.jsxs)(`div`,{className:`oc-bridgesecret__reveal`,children:[(0,X.jsx)(`p`,{className:`oc-sa__minted-warning`,children:Xe()}),(0,X.jsxs)(`div`,{className:`oc-sa__minted-box`,children:[(0,X.jsx)(`code`,{className:`oc-sa__minted-plain`,children:s}),(0,X.jsx)(I,{variant:`outline`,size:`sm`,onClick:()=>void h(),children:l?Ge():wt()})]}),(0,X.jsx)(I,{size:`sm`,variant:`ghost`,onClick:()=>{c(null),u(!1)},children:We()})]}):null]})}function an({instanceId:e,field:t,updatedAt:n}){let r=F(P.instanceSecrets.setInstanceSecret),i=A(P.instanceSecrets.clearInstanceSecret),a=F(P.deviceIdentity.generateDeviceIdentity),o=R(),[c,l]=(0,J.useState)(``),[u,d]=(0,J.useState)(!1),[f,p]=(0,J.useState)(null),[m,h]=(0,J.useState)(!1),g=n!==null,v=t===`deviceIdentity`,b=t===`token`?ht():t===`deviceIdentity`?te():y();async function x(){if(!(!c.trim()||u)){d(!0);try{await r({instanceId:e,field:t,plaintext:c}),l(``),p(null),h(!1),o.success(he())}catch(e){o.error(D(),e)}finally{d(!1)}}}async function C(){if(!u){d(!0);try{await i({instanceId:e,field:t}),p(null),h(!1),o.success(w())}catch(e){o.error(D(),e)}finally{d(!1)}}}async function ee(){if(!u){d(!0);try{p(await a({instanceId:e})),h(!1),o.success(O())}catch(e){o.error(it(),e)}finally{d(!1)}}}let T=f?`openclaw devices approve ${f.id}`:``;async function E(){if(T)try{await navigator.clipboard.writeText(T),h(!0)}catch{}}return(0,X.jsxs)($,{label:b,children:[v?(0,X.jsx)(`p`,{className:`oc-admin__hint`,children:ue()}):null,(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,X.jsx)(z,{variant:g?`outline`:`secondary`,children:g?De():Se()}),(0,X.jsx)(G,{type:`password`,autoComplete:`off`,className:`flex-1 min-w-32`,value:c,placeholder:g?Te():S(),onChange:e=>l(e.target.value)}),(0,X.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,X.jsx)(I,{size:`sm`,onClick:()=>void x(),disabled:u||c.trim().length===0,children:s()}),v?(0,X.jsx)(I,{size:`sm`,variant:`outline`,onClick:()=>void ee(),disabled:u,children:_()}):null,g?(0,X.jsx)(I,{size:`sm`,variant:`destructive`,onClick:()=>void C(),disabled:u,children:Ft()}):null]})]}),f?(0,X.jsxs)(`div`,{className:`oc-bridgesecret__reveal`,children:[(0,X.jsx)(`p`,{className:`text-sm font-medium`,children:O()}),(0,X.jsx)(`p`,{className:`oc-admin__hint`,children:ae()}),(0,X.jsxs)(`div`,{className:`oc-sa__minted-box`,children:[(0,X.jsx)(`code`,{className:`oc-sa__minted-plain`,children:T}),(0,X.jsx)(I,{variant:`outline`,size:`sm`,onClick:()=>void E(),children:m?Ge():wt()})]}),(0,X.jsx)(I,{size:`sm`,variant:`ghost`,onClick:()=>{p(null),h(!1)},children:We()})]}):null]})}var on={conversational:Je,documentary:pe,summarizer:Ke,curator:ct},sn={conversational:i,documentary:Pe,summarizer:Tt,curator:He},cn=e=>(on[e]??(()=>e))(),Q=e=>(sn[e]??(()=>``))();function ln({agentId:e,types:t,onToggle:n}){return(0,X.jsxs)(`div`,{className:`oc-agentcard__types`,children:[(0,X.jsx)(`span`,{className:`oc-agentcard__types-label`,children:nt()}),t.map(e=>(0,X.jsx)(z,{variant:`secondary`,className:`oc-agenttype__chip`,title:Q(e),children:cn(e)},e)),(0,X.jsxs)(Bt,{children:[(0,X.jsx)(zt,{asChild:!0,children:(0,X.jsx)(I,{type:`button`,variant:`outline`,size:`sm`,className:`h-7`,children:vt()})}),(0,X.jsxs)(Kt,{align:`start`,className:`oc-agenttypes-pop`,children:[(0,X.jsx)(`p`,{className:`oc-agenttypes-pop__title`,children:ft()}),(0,X.jsx)(`p`,{className:`oc-agenttypes-pop__hint`,children:xt()}),(0,X.jsx)(`div`,{className:`oc-agenttypes-pop__list`,children:Y.map(r=>{let i=`agtype-${e}-${r}`;return(0,X.jsxs)(`div`,{className:`oc-agenttypes-pop__item`,children:[(0,X.jsx)(Gt,{id:i,checked:t.includes(r),onCheckedChange:()=>n(r)}),(0,X.jsxs)(`label`,{htmlFor:i,className:`oc-agenttypes-pop__text`,children:[(0,X.jsx)(`span`,{className:`oc-agenttypes-pop__name`,children:cn(r)}),(0,X.jsx)(`span`,{className:`oc-agenttypes-pop__desc`,children:Q(r)})]})]},r)})})]})]})]})}function un({instanceName:e,open:t,onOpenChange:n}){let r=j(P.agents.listAgentsForInstance,t&&e?{instanceName:e}:`skip`),i=A(P.agents.setAgentEnabled).withOptimisticUpdate((e,{instanceName:t,agentId:n,enabled:r})=>{let i=e.getQuery(P.agents.listAgentsForInstance,{instanceName:t});i&&e.setQuery(P.agents.listAgentsForInstance,{instanceName:t},{...i,agents:i.agents.map(e=>e.agentId===n?{...e,enabled:r}:e)})}),a=A(P.agents.setInstanceDefaultAgent).withOptimisticUpdate((e,{instanceName:t,agentId:n})=>{let r=e.getQuery(P.agents.listAgentsForInstance,{instanceName:t});r&&e.setQuery(P.agents.listAgentsForInstance,{instanceName:t},{...r,defaultAgentId:n})}),o=A(P.agents.setAgentTypes).withOptimisticUpdate((e,{instanceName:t,agentId:n,types:r})=>{let i=e.getQuery(P.agents.listAgentsForInstance,{instanceName:t});if(!i)return;let a=Zt(r);e.setQuery(P.agents.listAgentsForInstance,{instanceName:t},{...i,agents:i.agents.map(e=>e.agentId===n?{...e,types:a}:e)})}),s=A(P.agents.setAgentDescription).withOptimisticUpdate((e,{instanceName:t,agentId:n,description:r})=>{let i=e.getQuery(P.agents.listAgentsForInstance,{instanceName:t});if(!i)return;let a=r.trim();e.setQuery(P.agents.listAgentsForInstance,{instanceName:t},{...i,agents:i.agents.map(e=>e.agentId===n?{...e,description:a.length===0?null:a}:e)})}),l=A(P.agents.removeInstanceAgent),u=Vt(),d=R();async function f(t,n){if(e)try{await i({instanceName:e,agentId:t,enabled:n})}catch(e){d.error(k(),e)}}async function p(t){if(e)try{await a({instanceName:e,agentId:t})}catch(e){d.error(k(),e)}}async function m(t,n,r){if(!e)return;let i=r.includes(n)?r.filter(e=>e!==n):[...r,n];try{await o({instanceName:e,agentId:t,types:i})}catch(e){d.error(k(),e)}}async function h(t,n){if(e&&await u({title:E({name:n}),description:gt(),confirmLabel:ne(),destructive:!0}))try{await l({instanceName:e,agentId:t}),d.success(b())}catch(e){d.error(k(),e)}}return(0,X.jsx)(Wt,{open:t,onOpenChange:n,children:(0,X.jsxs)(K,{className:`oc-access`,children:[(0,X.jsxs)(U,{children:[(0,X.jsx)(q,{children:Ct({name:e??``})}),(0,X.jsx)(Ut,{children:st()})]}),r===void 0?(0,X.jsx)(`p`,{className:`oc-access__hint`,children:Oe()}):(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`div`,{className:`oc-access__poll`,children:r.discovery===null?Ce():r.discovery.lastPollOk?C():Ee({error:r.discovery.error??`?`})}),r.agents.length===0?(0,X.jsx)(`p`,{className:`oc-access__hint`,children:c()}):(0,X.jsx)(`div`,{className:`oc-access__list`,children:r.agents.map(t=>{let n=t.presentInLastOk===!1,i=r.defaultAgentId===t.agentId,a=t.displayName??t.agentId,o=t.types??[];return(0,X.jsxs)(`div`,{className:`oc-agentcard`+(t.enabled?``:` oc-agentcard--off`),children:[(0,X.jsxs)(`div`,{className:`oc-agentcard__head`,children:[(0,X.jsx)(Gt,{checked:t.enabled,disabled:n,"aria-label":a,onCheckedChange:e=>void f(t.agentId,e===!0)}),(0,X.jsxs)(`span`,{className:`oc-agentcard__name`,title:a,children:[t.emoji?`${t.emoji} `:``,a]}),t.model?(0,X.jsx)(`span`,{className:`oc-access__model`,children:t.model}):null,n?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(z,{variant:`outline`,className:`oc-access__gone`,children:ge()}),(0,X.jsx)(I,{size:`sm`,variant:`ghost`,className:`h-7 text-destructive`,onClick:()=>void h(t.agentId,a),children:Me()})]}):i?(0,X.jsx)(z,{variant:`default`,children:It()}):(0,X.jsx)(I,{size:`sm`,variant:`outline`,className:`h-7`,disabled:!t.enabled,onClick:()=>void p(t.agentId),children:Ae()})]}),t.enabled?(0,X.jsx)(ln,{agentId:t.agentId,types:o,onToggle:e=>void m(t.agentId,e,o)}):null,t.enabled?(0,X.jsx)(dn,{value:t.description??``,onSave:async n=>{if(e)try{await s({instanceName:e,agentId:t.agentId,description:n})}catch(e){d.error(k(),e)}}}):null]},t.agentId)})})]})]})})}function dn({value:e,onSave:t}){let[n,r]=(0,J.useState)(e);(0,J.useEffect)(()=>{r(e)},[e]);let i=()=>{n.trim()!==e.trim()&&t(n)};return(0,X.jsx)(G,{className:`oc-agentcard__desc`,value:n,maxLength:280,placeholder:mt(),"aria-label":Re(),onChange:e=>r(e.target.value),onBlur:i,onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),i())}})}function $({label:e,children:t}){return(0,X.jsxs)(`label`,{className:`oc-field`,children:[(0,X.jsx)(`span`,{className:`oc-field__label`,children:e}),t]})}export{en as InstancesTab};
@@ -1 +1 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Al as r,Dl as i,El as a,Ml as o,Ol as s,Tl as c,ak as l,cB as u,ck as d,dB as f,dk as p,fk as m,gk as h,hk as g,ik as _,jl as v,kl as y,lk as b,mk as x,ok as S,pk as C,rk as w,sk as T,t as E,uB as D,uk as O,wl as k}from"./api-BKX0b765.js";import{t as A}from"./button-DzIspcBY.js";import{Et as j,jt as M,ut as N}from"./index-BbZI7MO0.js";var P=t(e(),1),F=n();function I(){let e=f(E.integrations.status.status,{}),t=D(E.admin.setIntegrationConfig),[n,i]=(0,P.useState)(null);if((0,P.useEffect)(()=>{e&&n===null&&i(e.config)},[e,n]),!e||!n)return(0,F.jsx)(`p`,{className:`oc-admin__hint`,children:h()});let a=n,s=(e,t,n)=>i({...a,[e]:{...a[e],[t]:n}}),c=(e,n)=>void t({[e]:n});return(0,F.jsxs)(F.Fragment,{children:[(0,F.jsxs)(`p`,{className:`oc-admin__hint`,children:[g(),` `,(0,F.jsx)(`strong`,{children:x()}),` `,C()]}),(0,F.jsxs)(L,{title:`Langfuse`,status:e.langfuse.configured?e.langfuse.enabled?(0,F.jsx)(j,{variant:`secondary`,children:m()}):(0,F.jsx)(j,{variant:`outline`,children:p()}):(0,F.jsx)(j,{variant:`outline`,children:O()}),note:b(),children:[(0,F.jsx)(R,{label:T(),children:(0,F.jsx)(M,{value:a.langfuse.host??``,placeholder:e.langfuse.effectiveHost,onChange:e=>s(`langfuse`,`host`,e.target.value),onBlur:()=>c(`langfuse`,{host:a.langfuse.host??``})})}),(0,F.jsx)(z,{label:w(),checked:a.langfuse.enabled??!0,onChange:e=>{s(`langfuse`,`enabled`,e),c(`langfuse`,{enabled:e})}})]}),(0,F.jsxs)(L,{title:`Opik`,status:e.opik.configured?e.opik.enabled?(0,F.jsx)(j,{variant:`secondary`,children:m()}):(0,F.jsx)(j,{variant:`outline`,children:p()}):(0,F.jsx)(j,{variant:`outline`,children:O()}),note:d(),children:[(0,F.jsx)(R,{label:S(),children:(0,F.jsx)(M,{value:a.opik.baseUrl??``,placeholder:e.opik.effectiveBaseUrl,onChange:e=>s(`opik`,`baseUrl`,e.target.value),onBlur:()=>c(`opik`,{baseUrl:a.opik.baseUrl??``})})}),(0,F.jsx)(R,{label:l(),children:(0,F.jsx)(M,{value:a.opik.workspace??``,placeholder:e.opik.effectiveWorkspace||_(),onChange:e=>s(`opik`,`workspace`,e.target.value),onBlur:()=>c(`opik`,{workspace:a.opik.workspace??``})})}),(0,F.jsx)(z,{label:w(),checked:a.opik.enabled??!0,onChange:e=>{s(`opik`,`enabled`,e),c(`opik`,{enabled:e})}})]}),(0,F.jsxs)(L,{title:`OpenTelemetry (OTLP)`,status:e.otlp.configured?e.otlp.enabled?(0,F.jsx)(j,{variant:`secondary`,children:m()}):(0,F.jsx)(j,{variant:`outline`,children:p()}):(0,F.jsx)(j,{variant:`outline`,children:o()}),note:v(),children:[(0,F.jsx)(R,{label:r(),children:(0,F.jsx)(M,{value:a.otlp.endpoint??``,placeholder:e.otlp.effectiveEndpoint||`https://otlp.example.com/v1/traces`,onChange:e=>s(`otlp`,`endpoint`,e.target.value),onBlur:()=>c(`otlp`,{endpoint:a.otlp.endpoint??``})})}),(0,F.jsx)(B,{headersSet:e.otlp.headersSet}),(0,F.jsx)(z,{label:w(),checked:a.otlp.enabled??!0,onChange:e=>{s(`otlp`,`enabled`,e),c(`otlp`,{enabled:e})}})]})]})}function L({title:e,status:t,note:n,children:r}){return(0,F.jsxs)(`section`,{className:`oc-int__section`,children:[(0,F.jsxs)(`div`,{className:`oc-int__section-head`,children:[(0,F.jsx)(`h3`,{className:`oc-uipa__h`,children:e}),t]}),n?(0,F.jsx)(`p`,{className:`oc-uipa__note`,children:n}):null,(0,F.jsx)(`div`,{className:`oc-int__fields`,children:r})]})}function R({label:e,children:t}){return(0,F.jsxs)(`label`,{className:`oc-int__field`,children:[(0,F.jsx)(`span`,{className:`oc-int__field-label`,children:e}),t]})}function z({label:e,checked:t,onChange:n}){return(0,F.jsxs)(`label`,{className:`oc-int__toggle`,children:[(0,F.jsx)(N,{checked:t,onCheckedChange:e=>n(e===!0)}),(0,F.jsx)(`span`,{children:e})]})}function B({headersSet:e}){let t=u(E.integrations.otlpSecret.setOtlpHeaders),n=D(E.integrations.otlpSecret.clearOtlpHeaders),[r,o]=(0,P.useState)(``),[l,d]=(0,P.useState)(null),[f,p]=(0,P.useState)(!1),m=async()=>{p(!0),d(null);try{await t({headersJson:r}),o(``)}catch(e){d(e instanceof Error?e.message:String(e))}finally{p(!1)}};return(0,F.jsxs)(R,{label:y(),children:[(0,F.jsx)(M,{value:r,placeholder:e?s():i(),onChange:e=>o(e.target.value)}),(0,F.jsxs)(`div`,{className:`oc-int__otlp-headers-actions`,children:[(0,F.jsx)(A,{size:`sm`,disabled:f||r.trim().length===0,onClick:()=>void m(),children:a()}),e?(0,F.jsx)(A,{variant:`ghost`,size:`sm`,disabled:f,onClick:()=>void n({}),children:c()}):null]}),l?(0,F.jsx)(`p`,{className:`oc-int__otlp-headers-error`,children:l}):null,(0,F.jsx)(`p`,{className:`oc-uipa__note`,children:k()})]})}export{I as IntegrationsTab};
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Al as r,Dl as i,El as a,Ml as o,Ol as s,Tl as c,_k as l,ak as u,ck as d,dk as f,fB as p,fk as m,gk as h,hk as g,jl as _,kl as v,lk as y,mk as b,ok as x,pB as S,pk as C,sk as w,t as T,uB as E,uk as D,vk as O,wl as k}from"./api-BPOlScPa.js";import{t as A}from"./button-B5OAA4fh.js";import{Et as j,jt as M,ut as N}from"./index-Cd7vK8g7.js";var P=t(e(),1),F=n();function I(){let e=S(T.integrations.status.status,{}),t=p(T.admin.setIntegrationConfig),[n,i]=(0,P.useState)(null);if((0,P.useEffect)(()=>{e&&n===null&&i(e.config)},[e,n]),!e||!n)return(0,F.jsx)(`p`,{className:`oc-admin__hint`,children:O()});let a=n,s=(e,t,n)=>i({...a,[e]:{...a[e],[t]:n}}),c=(e,n)=>void t({[e]:n});return(0,F.jsxs)(F.Fragment,{children:[(0,F.jsxs)(`p`,{className:`oc-admin__hint`,children:[l(),` `,(0,F.jsx)(`strong`,{children:h()}),` `,g()]}),(0,F.jsxs)(L,{title:`Langfuse`,status:e.langfuse.configured?e.langfuse.enabled?(0,F.jsx)(j,{variant:`secondary`,children:b()}):(0,F.jsx)(j,{variant:`outline`,children:C()}):(0,F.jsx)(j,{variant:`outline`,children:m()}),note:f(),children:[(0,F.jsx)(R,{label:y(),children:(0,F.jsx)(M,{value:a.langfuse.host??``,placeholder:e.langfuse.effectiveHost,onChange:e=>s(`langfuse`,`host`,e.target.value),onBlur:()=>c(`langfuse`,{host:a.langfuse.host??``})})}),(0,F.jsx)(z,{label:u(),checked:a.langfuse.enabled??!0,onChange:e=>{s(`langfuse`,`enabled`,e),c(`langfuse`,{enabled:e})}})]}),(0,F.jsxs)(L,{title:`Opik`,status:e.opik.configured?e.opik.enabled?(0,F.jsx)(j,{variant:`secondary`,children:b()}):(0,F.jsx)(j,{variant:`outline`,children:C()}):(0,F.jsx)(j,{variant:`outline`,children:m()}),note:D(),children:[(0,F.jsx)(R,{label:d(),children:(0,F.jsx)(M,{value:a.opik.baseUrl??``,placeholder:e.opik.effectiveBaseUrl,onChange:e=>s(`opik`,`baseUrl`,e.target.value),onBlur:()=>c(`opik`,{baseUrl:a.opik.baseUrl??``})})}),(0,F.jsx)(R,{label:w(),children:(0,F.jsx)(M,{value:a.opik.workspace??``,placeholder:e.opik.effectiveWorkspace||x(),onChange:e=>s(`opik`,`workspace`,e.target.value),onBlur:()=>c(`opik`,{workspace:a.opik.workspace??``})})}),(0,F.jsx)(z,{label:u(),checked:a.opik.enabled??!0,onChange:e=>{s(`opik`,`enabled`,e),c(`opik`,{enabled:e})}})]}),(0,F.jsxs)(L,{title:`OpenTelemetry (OTLP)`,status:e.otlp.configured?e.otlp.enabled?(0,F.jsx)(j,{variant:`secondary`,children:b()}):(0,F.jsx)(j,{variant:`outline`,children:C()}):(0,F.jsx)(j,{variant:`outline`,children:o()}),note:_(),children:[(0,F.jsx)(R,{label:r(),children:(0,F.jsx)(M,{value:a.otlp.endpoint??``,placeholder:e.otlp.effectiveEndpoint||`https://otlp.example.com/v1/traces`,onChange:e=>s(`otlp`,`endpoint`,e.target.value),onBlur:()=>c(`otlp`,{endpoint:a.otlp.endpoint??``})})}),(0,F.jsx)(B,{headersSet:e.otlp.headersSet}),(0,F.jsx)(z,{label:u(),checked:a.otlp.enabled??!0,onChange:e=>{s(`otlp`,`enabled`,e),c(`otlp`,{enabled:e})}})]})]})}function L({title:e,status:t,note:n,children:r}){return(0,F.jsxs)(`section`,{className:`oc-int__section`,children:[(0,F.jsxs)(`div`,{className:`oc-int__section-head`,children:[(0,F.jsx)(`h3`,{className:`oc-uipa__h`,children:e}),t]}),n?(0,F.jsx)(`p`,{className:`oc-uipa__note`,children:n}):null,(0,F.jsx)(`div`,{className:`oc-int__fields`,children:r})]})}function R({label:e,children:t}){return(0,F.jsxs)(`label`,{className:`oc-int__field`,children:[(0,F.jsx)(`span`,{className:`oc-int__field-label`,children:e}),t]})}function z({label:e,checked:t,onChange:n}){return(0,F.jsxs)(`label`,{className:`oc-int__toggle`,children:[(0,F.jsx)(N,{checked:t,onCheckedChange:e=>n(e===!0)}),(0,F.jsx)(`span`,{children:e})]})}function B({headersSet:e}){let t=E(T.integrations.otlpSecret.setOtlpHeaders),n=p(T.integrations.otlpSecret.clearOtlpHeaders),[r,o]=(0,P.useState)(``),[l,u]=(0,P.useState)(null),[d,f]=(0,P.useState)(!1),m=async()=>{f(!0),u(null);try{await t({headersJson:r}),o(``)}catch(e){u(e instanceof Error?e.message:String(e))}finally{f(!1)}};return(0,F.jsxs)(R,{label:v(),children:[(0,F.jsx)(M,{value:r,placeholder:e?s():i(),onChange:e=>o(e.target.value)}),(0,F.jsxs)(`div`,{className:`oc-int__otlp-headers-actions`,children:[(0,F.jsx)(A,{size:`sm`,disabled:d||r.trim().length===0,onClick:()=>void m(),children:a()}),e?(0,F.jsx)(A,{variant:`ghost`,size:`sm`,disabled:d,onClick:()=>void n({}),children:c()}):null]}),l?(0,F.jsx)(`p`,{className:`oc-int__otlp-headers-error`,children:l}):null,(0,F.jsx)(`p`,{className:`oc-uipa__note`,children:k()})]})}export{I as IntegrationsTab};