@lacneu/atrium 0.84.21 → 0.85.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 (79) hide show
  1. package/dist/assets/{AccessTab-7DgwkLkg.js → AccessTab-ywlRqoTS.js} +1 -1
  2. package/dist/assets/{AdvancedFilter-D-mIQhPG.js → AdvancedFilter-CO3ZakuW.js} +1 -1
  3. package/dist/assets/AgentFilesTab-CvXCF_f1.js +3 -0
  4. package/dist/assets/AnomaliesTab-BMfAE9Qr.js +1 -0
  5. package/dist/assets/AuditTab-BehmjVX5.js +1 -0
  6. package/dist/assets/BridgeTab-DKBERQMd.js +1 -0
  7. package/dist/assets/ChatDefaultsTab-C8FtADCX.js +1 -0
  8. package/dist/assets/{DataTableShell-BK8Kucos.js → DataTableShell-BzQgqnDl.js} +1 -1
  9. package/dist/assets/{DetailChips-DSrMAbLD.js → DetailChips-CDv5mOES.js} +1 -1
  10. package/dist/assets/FeedbacksTab-DQcwy0Me.js +1 -0
  11. package/dist/assets/{FieldLabel-CgbnOAaa.js → FieldLabel-vGVJ37ds.js} +1 -1
  12. package/dist/assets/FilesTab-DeGdJZGF.js +1 -0
  13. package/dist/assets/{FilterBar-DHbB2cbQ.js → FilterBar-CGSxi-Sq.js} +1 -1
  14. package/dist/assets/GroupsTab-x0erQjsA.js +1 -0
  15. package/dist/assets/InstancesTab-CnKKPdic.js +1 -0
  16. package/dist/assets/IntegrationsTab-BZw_cojT.js +1 -0
  17. package/dist/assets/KpiTab-S-L5_TFu.js +1 -0
  18. package/dist/assets/PreferencesTab-DUVgQOJg.js +1 -0
  19. package/dist/assets/ProjectPage-BOCy2rBV.js +1 -0
  20. package/dist/assets/PromptInjectionsTab-D4Fidxot.js +4 -0
  21. package/dist/assets/RolesTab-Cz26-VUr.js +1 -0
  22. package/dist/assets/ScheduledTab-0Y-eXTYR.js +1 -0
  23. package/dist/assets/ServiceAccountsTab-Ca9wLDNe.js +1 -0
  24. package/dist/assets/SubAgentReportsTab-PgfR3Za8.js +1 -0
  25. package/dist/assets/ThemeShowroom-CHxCts7H.js +1 -0
  26. package/dist/assets/{TimeRangePicker-B8MRcEsu.js → TimeRangePicker-DIGmrYqi.js} +1 -1
  27. package/dist/assets/{TimezoneCombobox-BYDYUkxC.js → TimezoneCombobox-CkPBJSKF.js} +1 -1
  28. package/dist/assets/TracesTab-BXHNDCiG.js +1 -0
  29. package/dist/assets/UsersTab-BtRT9A-D.js +1 -0
  30. package/dist/assets/VoiceTab-DdNwsqNA.js +1 -0
  31. package/dist/assets/{api-B1lq0pb-.js → api-D7og-4qA.js} +5 -5
  32. package/dist/assets/{button-Ds98Pj53.js → button-Ch1cRvCe.js} +1 -1
  33. package/dist/assets/{card-C2GdBOIp.js → card-B1-0rWzO.js} +1 -1
  34. package/dist/assets/chevrons-up-down-DIadyetY.js +1 -0
  35. package/dist/assets/{compatView-Dxc5HuRO.js → compatView-BWt5iAM2.js} +1 -1
  36. package/dist/assets/dispatchErrorInfo-wT9RzbRF.js +1 -0
  37. package/dist/assets/{dist-rn-1MvzJ.js → dist-B-EkxEVF.js} +1 -1
  38. package/dist/assets/{dist-DaQlSKRt.js → dist-CKlOMNhM.js} +1 -1
  39. package/dist/assets/{highlighted-body-OFNGDK62-qznyJ1AG.js → highlighted-body-OFNGDK62-C65VoJ0F.js} +1 -1
  40. package/dist/assets/index-CogfaROk.css +1 -0
  41. package/dist/assets/index-Dn5iHsqH.js +324 -0
  42. package/dist/assets/{list-DhABairq.js → list-CJY1g2_K.js} +1 -1
  43. package/dist/assets/mermaid-GHXKKRXX-DWyfHcK6.js +1 -0
  44. package/dist/assets/{pdf-RQlFQI9k.js → pdf-DUS0iuq7.js} +1 -1
  45. package/dist/assets/roleDescriptions-BkEeX-KS.js +1 -0
  46. package/dist/assets/{table-B15ESmxP.js → table-CKpkQP4H.js} +1 -1
  47. package/dist/assets/{tabs-BBnOOIhM.js → tabs-CnkwmnFT.js} +1 -1
  48. package/dist/assets/x-bVQAMbfU.js +1 -0
  49. package/dist/index.html +7 -7
  50. package/package.json +1 -1
  51. package/dist/assets/AgentFilesTab-DI6SkJi3.js +0 -3
  52. package/dist/assets/AnomaliesTab-CcdmV3_N.js +0 -1
  53. package/dist/assets/AuditTab-De1aUlfc.js +0 -1
  54. package/dist/assets/BridgeTab-BvlinzLy.js +0 -1
  55. package/dist/assets/ChatDefaultsTab-LBCm6cXz.js +0 -1
  56. package/dist/assets/FeedbacksTab-Dn5lwj2V.js +0 -1
  57. package/dist/assets/FilesTab-BR9OC5V_.js +0 -1
  58. package/dist/assets/GroupsTab-CRUou4Sn.js +0 -1
  59. package/dist/assets/InstancesTab-DzK5DgDi.js +0 -1
  60. package/dist/assets/IntegrationsTab-6rOgYMOt.js +0 -1
  61. package/dist/assets/KpiTab-BMKdEuEd.js +0 -1
  62. package/dist/assets/PreferencesTab-BNBLxTGr.js +0 -1
  63. package/dist/assets/ProjectPage-Dr7E7Gdc.js +0 -1
  64. package/dist/assets/PromptInjectionsTab-B-hui4r1.js +0 -4
  65. package/dist/assets/RolesTab-DYYmUvDN.js +0 -1
  66. package/dist/assets/ScheduledTab-B6mlE1sC.js +0 -1
  67. package/dist/assets/ServiceAccountsTab-DcDezuba.js +0 -1
  68. package/dist/assets/SubAgentReportsTab-D6R_3oe8.js +0 -1
  69. package/dist/assets/ThemeShowroom-BUXpwJRo.js +0 -1
  70. package/dist/assets/TracesTab-CGGE2Afj.js +0 -1
  71. package/dist/assets/UsersTab-LjXyy7nc.js +0 -1
  72. package/dist/assets/VoiceTab-BGkLEvDq.js +0 -1
  73. package/dist/assets/chevrons-up-down-Du-SfIms.js +0 -1
  74. package/dist/assets/dispatchErrorInfo-BGvs3mZA.js +0 -1
  75. package/dist/assets/index-9JURmeVM.css +0 -1
  76. package/dist/assets/index-Bkfx3eIe.js +0 -324
  77. package/dist/assets/mermaid-GHXKKRXX-D1_QmKBf.js +0 -1
  78. package/dist/assets/roleDescriptions-BV5RwGCx.js +0 -1
  79. package/dist/assets/x-CHx4ismM.js +0 -1
@@ -1 +1 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$B as r,Am as i,Bm as a,Fm as o,Hm as s,Im as c,Lm as l,Mm as u,Nm as d,Pm as f,Rm as p,Um as m,Vm as h,Wm as g,cV as _,jm as v,t as y,zm as b}from"./api-B1lq0pb-.js";import{$ as x,Et as S,Q as C,X as w,Z as T,et as E}from"./index-Bkfx3eIe.js";var D=t(e(),1);function O(e){return e===`user`?f():e===`all`?d():u({group:e.group})}function k(e){return e===`common`?v():e===`owner`?i():u({group:e.group})}var A=n();function j(e){return e.name||e.email||e.userId.slice(0,8)}function M(){let e=_(y.admin.listUsers,{}),[t,n]=(0,D.useState)(``),i=_(y.introspect.introspectUser,t?{userId:t}:`skip`);return(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:g()}),(0,A.jsxs)(w,{value:t,onValueChange:n,children:[(0,A.jsx)(x,{size:`sm`,"aria-label":m(),children:(0,A.jsx)(E,{placeholder:m()})}),(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:s()}):i===void 0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:r()}):(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:h()}),(0,A.jsxs)(`div`,{className:`oc-introspect__id`,children:[(0,A.jsx)(`strong`,{children:i.user.label}),(0,A.jsx)(S,{variant:`secondary`,children:i.role})]})]}),(0,A.jsxs)(`section`,{className:`oc-introspect__section`,children:[(0,A.jsx)(`h3`,{className:`oc-introspect__title`,children:a()}),i.groups.length===0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:c()}):(0,A.jsx)(`div`,{className:`oc-introspect__chips`,children:i.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:b()}),i.agents.length===0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:c()}):(0,A.jsx)(`ul`,{className:`oc-introspect__list`,children:i.agents.map(e=>(0,A.jsxs)(`li`,{className:`oc-introspect__row`,children:[(0,A.jsx)(`span`,{className:`oc-introspect__name`,children:e.displayName||e.agentId}),e.isDefault?(0,A.jsx)(S,{variant:`default`,children:o()}):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:p()}),i.charts.length===0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:c()}):(0,A.jsx)(`ul`,{className:`oc-introspect__list`,children:i.charts.map(e=>(0,A.jsxs)(`li`,{className:`oc-introspect__row`,children:[(0,A.jsx)(`span`,{className:`oc-introspect__name`,children:e.name}),(0,A.jsx)(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()}),i.permissions.length===0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:c()}):(0,A.jsx)(`div`,{className:`oc-introspect__chips`,children:i.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{Ag as r,Cg as i,Dg as a,Eg as o,Fg as s,Ig as c,Lg as l,Mg as u,Ng as d,Og as f,Pg as p,Tg as m,jg as h,kg as g,nU as _,qH as v,t as y,wg as b}from"./api-D7og-4qA.js";import{$ as x,Et as S,Q as C,X as w,Z as T,et as E}from"./index-Dn5iHsqH.js";var D=t(e(),1);function O(e){return e===`user`?a():e===`all`?o():m({group:e.group})}function k(e){return e===`common`?b():e===`owner`?i():m({group:e.group})}var A=n();function j(e){return e.name||e.email||e.userId.slice(0,8)}function M(){let e=_(y.admin.listUsers,{}),[t,n]=(0,D.useState)(``),i=_(y.introspect.introspectUser,t?{userId:t}:`skip`);return(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:l()}),(0,A.jsxs)(w,{value:t,onValueChange:n,children:[(0,A.jsx)(x,{size:`sm`,"aria-label":c(),children:(0,A.jsx)(E,{placeholder:c()})}),(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:s()}):i===void 0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:v()}):(0,A.jsxs)(`div`,{className:`oc-introspect`,children:[(0,A.jsxs)(`section`,{className:`oc-introspect__section`,children:[(0,A.jsx)(`h3`,{className:`oc-introspect__title`,children:p()}),(0,A.jsxs)(`div`,{className:`oc-introspect__id`,children:[(0,A.jsx)(`strong`,{children:i.user.label}),(0,A.jsx)(S,{variant:`secondary`,children:i.role})]})]}),(0,A.jsxs)(`section`,{className:`oc-introspect__section`,children:[(0,A.jsx)(`h3`,{className:`oc-introspect__title`,children:d()}),i.groups.length===0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:g()}):(0,A.jsx)(`div`,{className:`oc-introspect__chips`,children:i.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:u()}),i.agents.length===0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:g()}):(0,A.jsx)(`ul`,{className:`oc-introspect__list`,children:i.agents.map(e=>(0,A.jsxs)(`li`,{className:`oc-introspect__row`,children:[(0,A.jsx)(`span`,{className:`oc-introspect__name`,children:e.displayName||e.agentId}),e.isDefault?(0,A.jsx)(S,{variant:`default`,children:f()}):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:h()}),i.charts.length===0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:g()}):(0,A.jsx)(`ul`,{className:`oc-introspect__list`,children:i.charts.map(e=>(0,A.jsxs)(`li`,{className:`oc-introspect__row`,children:[(0,A.jsx)(`span`,{className:`oc-introspect__name`,children:e.name}),(0,A.jsx)(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:r()}),i.permissions.length===0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:g()}):(0,A.jsx)(`div`,{className:`oc-introspect__chips`,children:i.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{a_ as r,c_ as i,i_ as a,l_ as o,o_ as s,r_ as c,s_ as l}from"./api-B1lq0pb-.js";import{t as u}from"./x-CHx4ismM.js";import{t as d}from"./button-Ds98Pj53.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-Bkfx3eIe.js";import{r as b}from"./TimeRangePicker-B8MRcEsu.js";var x=t(e(),1),S=n(),C=[{value:`eq`,label:`=`},{value:`neq`,label:`≠`},{value:`contains`,label:o()},{value:`gt`,label:`>`},{value:`gte`,label:`≥`},{value:`lt`,label:`<`},{value:`lte`,label:`≤`}],w=1;function T(){return{id:w++,field:``,op:`eq`,value:``}}function E(e){return e.map(e=>({id:w++,field:e.field,op:e.op,value:String(e.value)}))}function D({fields:e,seed:t,onChange:n}){let o=(0,x.useRef)(t),w=!!(o.current&&o.current.length>0),[D,O]=(0,x.useState)(w),[k,A]=(0,x.useState)(()=>w?E(o.current):[]);function j(e){n(e.filter(e=>e.field!==``&&e.value!==``).map(e=>({field:e.field,op:e.op,value:b(e.value)})))}function M(e,t){let n=k.map(n=>n.id===e?{...n,...t}:n);A(n),j(n)}function N(){A(e=>[...e,T()])}function P(e){let t=k.filter(t=>t.id!==e);A(t),j(t)}let F=k.filter(e=>e.field!==``&&e.value!==``).length;return(0,S.jsxs)(`div`,{className:`oc-advfilter`,children:[(0,S.jsxs)(`button`,{type:`button`,className:`oc-advfilter__toggle`,"aria-expanded":D,onClick:()=>O(e=>!e),children:[(0,S.jsx)(p,{className:`oc-advfilter__chevron`+(D?` is-open`:``),"aria-hidden":!0}),i(),F>0?(0,S.jsx)(`span`,{className:`oc-advfilter__count`,children:F}):null]}),D?(0,S.jsxs)(`div`,{className:`oc-advfilter__body`,children:[k.length===0?(0,S.jsx)(`p`,{className:`oc-admin__hint`,children:l()}):(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:s()})}),(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:r()}),(0,S.jsx)(d,{variant:`ghost`,size:`icon-sm`,"aria-label":a(),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,{}),c()]})]}):null]})}export{D as t};
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$v as r,Qv as i,Xv as a,Zv as o,ey as s,ny as c,ty as l}from"./api-D7og-4qA.js";import{t as u}from"./x-bVQAMbfU.js";import{t as d}from"./button-Ch1cRvCe.js";import{$ as f,Q as p,Un as m,X as h,Z as g,_n as _,et as v,jt as y}from"./index-Dn5iHsqH.js";import{r as b}from"./TimeRangePicker-DIGmrYqi.js";var x=t(e(),1),S=n(),C=[{value:`eq`,label:`=`},{value:`neq`,label:`≠`},{value:`contains`,label:c()},{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 c=(0,x.useRef)(t),w=!!(c.current&&c.current.length>0),[D,O]=(0,x.useState)(w),[k,A]=(0,x.useState)(()=>w?E(c.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)(m,{className:`oc-advfilter__chevron`+(D?` is-open`:``),"aria-hidden":!0}),l(),F>0?(0,S.jsx)(`span`,{className:`oc-advfilter__count`,children:F}):null]}),D?(0,S.jsxs)(`div`,{className:`oc-advfilter__body`,children:[k.length===0?(0,S.jsx)(`p`,{className:`oc-admin__hint`,children:s()}):(0,S.jsx)(`ul`,{className:`oc-advfilter__rows`,children:k.map(t=>(0,S.jsxs)(`li`,{className:`oc-advfilter__row`,children:[(0,S.jsxs)(h,{value:t.field||void 0,onValueChange:e=>M(t.id,{field:e}),children:[(0,S.jsx)(f,{size:`sm`,className:`w-40`,children:(0,S.jsx)(v,{placeholder:r()})}),(0,S.jsx)(g,{children:e.map(e=>(0,S.jsx)(p,{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)(v,{})}),(0,S.jsx)(g,{children:C.map(e=>(0,S.jsx)(p,{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:i()}),(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)(_,{}),a()]})]}):null]})}export{D as t};
@@ -0,0 +1,3 @@
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$H as r,$c as i,$m as a,$p as o,Bc as s,Bp as c,Cc as l,Gc as u,Gp as d,Hc as f,Hp as p,Jc as m,Jp as h,Kc as g,Kp as _,Qc as v,Qp as y,Qr as b,Sc as x,Uc as S,Up as C,Vc as w,Vp as T,Wc as E,Wp as D,XP as O,Xc as k,Xp as A,YH as j,Yc as M,Yp as N,Zc as P,Zp as ee,al as F,am as te,bc as I,cm as ne,dm as L,el as R,em as re,fm as ie,hm as z,il as ae,im as B,lm as V,mm as oe,nU as H,nl as se,nm as ce,ol as le,om as ue,pm as de,qH as U,qc as fe,qp as pe,rl as me,rm as he,sm as ge,t as W,tU as _e,th as G,tl as K,tm as ve,um as ye,vc as be,wc as xe,xc as Se,yc as Ce}from"./api-D7og-4qA.js";import{t as q}from"./button-Ch1cRvCe.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-Dn5iHsqH.js";import{n as Ge,t as Ke}from"./curation-CQksaIbm.js";import{a as qe}from"./compatView-BWt5iAM2.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
+ `))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(W.me.getMe,{host:Re}),t=e?.role===`admin`,n=(e?.permissions??[]).includes(`bridge.read`),i=H(W.admin.listInstances,e!==void 0&&t?{}:`skip`),[o,s]=(0,X.useState)(null);(0,X.useEffect)(()=>{!t||!i||i.length===0||(!o||!i.some(e=>e.name===o))&&s(i[0].name)},[t,i,o]);let c=H(W.agents.listAgentsForInstance,t&&o?{instanceName:o}:`skip`),l=H(W.agents.listMyAgents,e!==void 0&&!t?{}:`skip`),u=(0,X.useMemo)(()=>{if(e!==void 0){if(t)return o===null||c===void 0?i!==void 0&&i.length===0?[]:void 0:c.agents.map(e=>({instanceName:o,agentId:e.agentId,label:`${e.emoji?`${e.emoji} `:``}${e.displayName??e.agentId}`}));if(l!==void 0)return l.map(e=>({instanceName:e.instanceName,agentId:e.agentId,label:`${e.emoji?`${e.emoji} `:``}${e.displayName??e.agentId}`}))}},[e,t,o,c,i,l]),[d,f]=(0,X.useState)(null);(0,X.useEffect)(()=>{!u||u.length===0||(!d||!u.some(e=>$(e)===d))&&f($(u[0]))},[u,d]);let p=u?.find(e=>$(e)===d)??null,m=r(W.agentFiles.listAgentFiles),[h,g]=(0,X.useState)({status:`idle`}),_=p?.instanceName??null,v=p?.agentId??null,y=H(W.compat.forInstance,n&&_!==null?{instanceName:_}:`skip`),x=n&&_!==null?Te(y,`agentFiles`):null,S=x===null?!1:x===`loading`?null:x.blocked,C=(0,X.useCallback)(async()=>{if(!(_===null||v===null)){g({status:`loading`});try{g({status:`done`,files:(await m({instanceName:_,agentId:v})).files})}catch(e){g({status:`error`,dashboardAbsent:tt(e)})}}},[m,_,v]);(0,X.useEffect)(()=>{S===!1&&C()},[C,S]);let[w,T]=(0,X.useState)(null),E=H(W.agentFileCuration.listCurations,t&&_!==null&&v!==null?{instanceName:_,agentId:v}:`skip`),D=H(W.agentFileCuration.curationSettings,t&&_!==null?{instanceName:_}:`skip`),O=r(W.agentFileCuration.requestCuration),[k,A]=(0,X.useState)(null),[M,N]=(0,X.useState)(null),{toast:P}=J(),ee=(0,X.useMemo)(()=>{let e=new Map;for(let t of E??[])e.has(t.name)||e.set(t.name,t);return e},[E]),F=(0,X.useCallback)(async e=>{if(!(_===null||v===null)){A(e);try{let t=await O({instanceName:_,agentId:v,name:e,trigger:`manual`});t.ok?P({title:me(),variant:`success`}):P({title:se({reason:t.reason??`unknown`}),variant:`error`})}catch{P({title:K(),variant:`error`})}finally{A(null)}}},[O,_,v,P]),I=j(),R=(0,X.useMemo)(()=>new Intl.NumberFormat(I,{maximumFractionDigits:0}),[I]);return e===void 0||u===void 0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:U()}):(0,Q.jsxs)(`div`,{className:`oc-afiles`,children:[(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:z()}),(0,Q.jsxs)(`div`,{className:`oc-afiles__picker`,children:[t&&(i?.length??0)>1?(0,Q.jsxs)(je,{value:o??``,onValueChange:e=>s(e),children:[(0,Q.jsx)(we,{size:`sm`,"aria-label":oe(),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,u.length>0?(0,Q.jsxs)(je,{value:d??``,onValueChange:e=>f(e),children:[(0,Q.jsx)(we,{size:`sm`,"aria-label":de(),children:(0,Q.jsx)(Fe,{})}),(0,Q.jsx)(Me,{children:u.map(e=>(0,Q.jsx)(Oe,{value:$(e),children:e.label},$(e)))})]}):(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:ie()})]}),p===null?null:x===`loading`?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:U()}):x!==null&&x.blocked?(0,Q.jsxs)(`p`,{className:`oc-compat__blocked`,role:`status`,children:[(0,Q.jsx)(Y,{size:14,"aria-hidden":!0}),` `,qe(x.gatewayVersion,x.provider)]}):h.status===`loading`||h.status===`idle`?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:U()}):h.status===`error`?(0,Q.jsxs)(`p`,{className:`oc-afiles__error`,role:`alert`,children:[h.dashboardAbsent?b():ye(),` `,!h.dashboardAbsent&&(0,Q.jsx)(q,{variant:`outline`,size:`sm`,onClick:()=>void C(),children:a()})]}):h.files.length===0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:L()}):(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:V()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`span`,{className:`oc-afiles__size`,children:ne({size:Z(e.size,I)})}),(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:R.format(n)})}),r?(0,Q.jsx)(Y,{size:14,className:`oc-afiles__warn`,"aria-label":ue()}):(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?B():he()}),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:ee.get(e.name)??null,inFlight:k===e.name,onCurate:()=>void F(e.name),onReview:e=>N(e)}):null]},e.name)})}),(0,Q.jsx)(`p`,{className:`oc-afiles__budget`,children:te({used:Z(Qe(h.files),I),total:Z(Ye,I),pct:R.format(Ze(Qe(h.files)))})})]}),w&&p?(0,Q.jsx)(at,{instanceName:p.instanceName,agentId:p.agentId,name:w.name,isAdmin:t,onClose:()=>T(null),onSaved:()=>void C()}):null,M?(0,Q.jsx)(ot,{curationId:M,onClose:()=>N(null),onApplied:()=>{N(null),C()}}):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:F()}):a||i?.status===`dispatched`||i?.status===`applying`?(0,Q.jsx)(De,{variant:`outline`,className:`oc-afiles__curate-status`,children:ae()}):e&&r&&n!==null&&Ge(t,n)?(0,Q.jsx)(q,{variant:`outline`,size:`sm`,className:`oc-afiles__curate`,onClick:o,children:le()}):null}function at({instanceName:e,agentId:t,name:n,isAdmin:i,onClose:s,onSaved:l}){let u=r(W.agentFiles.getAgentFile),f=r(W.agentFiles.setAgentFile),m=J(),[g,v]=(0,X.useState)(null),[b,x]=(0,X.useState)(!1),[S,w]=(0,X.useState)(``),[E,k]=(0,X.useState)(!1),[M,P]=(0,X.useState)(!1),[F,te]=(0,X.useState)(!1),[I,ne]=(0,X.useState)(!1),L=(0,X.useCallback)(async r=>{x(!1);try{let i=await u({instanceName:e,agentId:t,name:n});v({content:i.content,updatedAtMs:i.updatedAtMs}),r||w(i.content),te(!1)}catch{x(!0)}},[u,e,t,n]);(0,X.useEffect)(()=>{L(!1)},[L]);async function R(){if(g!==null){P(!0),ne(!1);try{await f({instanceName:e,agentId:t,name:n,content:S,baseUpdatedAtMs:g.updatedAtMs??void 0}),m.success(A({name:n})),l(),await L(!1)}catch(e){nt(e)?te(!0):ne(!0)}finally{P(!1)}}}let ie=g!==null&&S!==g.content,z=(0,X.useMemo)(()=>g===null?null:et(g.content,S),[g,S]),ae=S.length>Je,B=j(),V=(0,X.useMemo)(()=>new Intl.NumberFormat(B),[B]);return(0,Q.jsx)(Be,{open:!0,onOpenChange:e=>!e&&s(),children:(0,Q.jsxs)(Ie,{className:`oc-afiles__editor`,children:[(0,Q.jsxs)(Ne,{children:[(0,Q.jsx)(Le,{children:ce({name:n})}),(0,Q.jsxs)(ze,{children:[ve({agent:t,instance:e}),i?null:(0,Q.jsxs)(Q.Fragment,{children:[` · `,re()]})]})]}),b?(0,Q.jsxs)(`p`,{className:`oc-afiles__error`,role:`alert`,children:[h(),` `,(0,Q.jsx)(q,{variant:`outline`,size:`sm`,onClick:()=>void L(!1),children:a()})]}):g===null?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:U()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`textarea`,{className:`oc-afiles__source`,value:S,readOnly:!i,spellCheck:!1,onChange:e=>w(e.target.value),"aria-label":ce({name:n})}),(0,Q.jsx)(`p`,{className:`oc-afiles__hint`,children:o()}),F?(0,Q.jsxs)(`p`,{className:`oc-afiles__error`,role:`alert`,children:[pe(),` `,(0,Q.jsx)(q,{variant:`outline`,size:`sm`,onClick:()=>void L(!0),children:_()})]}):null,I?(0,Q.jsx)(`p`,{className:`oc-afiles__error`,role:`alert`,children:N()}):null,(0,Q.jsxs)(`div`,{className:`oc-afiles__editor-foot`,children:[(0,Q.jsx)(`span`,{className:`oc-afiles__count${ae?` is-over`:``}`,children:y({count:V.format(S.length),max:V.format(Je)})}),i?(0,Q.jsx)(q,{size:`sm`,disabled:!ie||M||F,onClick:()=>k(!0),children:M?G():ee()}):null]})]}),(0,Q.jsx)(Ve,{open:E,onOpenChange:k,children:(0,Q.jsxs)(Ue,{children:[(0,Q.jsxs)(He,{children:[(0,Q.jsx)(Ae,{children:d({name:n})}),(0,Q.jsx)(ke,{children:D({agent:t})})]}),z?(0,Q.jsxs)(`div`,{className:`oc-afiles__diff`,children:[(0,Q.jsx)(`p`,{className:`oc-afiles__diff-counts`,children:C({added:z.added,removed:z.removed})}),z.sampleAdded.length>0?(0,Q.jsxs)(`div`,{className:`oc-afiles__diff-block`,children:[(0,Q.jsx)(`span`,{className:`oc-afiles__diff-label`,children:p()}),z.sampleAdded.map((e,t)=>(0,Q.jsx)(`code`,{className:`oc-afiles__diff-line is-add`,children:e||` `},t))]}):null,z.sampleRemoved.length>0?(0,Q.jsxs)(`div`,{className:`oc-afiles__diff-block`,children:[(0,Q.jsx)(`span`,{className:`oc-afiles__diff-label`,children:T()}),z.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:O()}),(0,Q.jsx)(We,{onClick:()=>void R(),children:c()})]})]})})]})})}function ot({curationId:e,onClose:t,onApplied:n}){let a=H(W.agentFileCuration.getProposal,{curationId:e}),o=r(W.agentFileCuration.approveCuration),c=_e(W.agentFileCuration.rejectCuration),{toast:d}=J(),[p,h]=(0,X.useState)(null),[_,y]=(0,X.useState)(!1),[b,C]=(0,X.useState)(``),T=j(),D=(0,X.useMemo)(()=>a?et(a.beforeContent,a.proposedContent):null,[a]);async function O(){h(`approve`);try{let t=await o({curationId:e});t.ok?(d({title:R(),variant:`success`}),n()):d({title:t.reason===`conflict`?v():P({reason:t.reason??`unknown`}),variant:`error`})}catch{d({title:K(),variant:`error`})}finally{h(null)}}async function A(n){h(`reject`);try{let r=b.trim();(await c({curationId:e,...r?{comment:r}:{},relaunch:n})).ok?d({title:n?Ce():i(),variant:`success`}):d({title:m(),variant:`error`}),t()}catch{d({title:K(),variant:`error`})}finally{h(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:a?k({name:a.name}):U()}),(0,Q.jsx)(ze,{children:M()})]}),a===void 0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:U()}):a===null?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:m()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`p`,{className:`oc-afiles__review-sizes`,children:[fe({before:Z(a.beforeSize,T),after:Z(a.proposedSize,T)}),a.overBudget?(0,Q.jsxs)(Q.Fragment,{children:[` `,(0,Q.jsx)(Y,{size:13,"aria-hidden":!0}),` `,g()]}):null]}),D?(0,Q.jsx)(`p`,{className:`oc-afiles__review-diff`,children:u({added:D.added,removed:D.removed})}):null,a.feedback?(0,Q.jsx)(`p`,{className:`oc-afiles__review-feedback`,children:be({feedback:a.feedback})}):null,D&&D.sampleRemoved.length>0?(0,Q.jsxs)(`div`,{className:`oc-afiles__review-removed`,children:[(0,Q.jsx)(`p`,{className:`oc-afiles__review-label`,children:s()}),(0,Q.jsx)(`ul`,{children:D.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:w()}),(0,Q.jsx)(`pre`,{className:`oc-afiles__review-pre`,children:a.beforeContent})]}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`p`,{className:`oc-afiles__review-label`,children:E()}),(0,Q.jsx)(`pre`,{className:`oc-afiles__review-pre`,children:a.proposedContent})]})]})]}),_?(0,Q.jsxs)(`div`,{className:`oc-afiles__reject-form`,children:[(0,Q.jsx)(`label`,{className:`oc-afiles__review-label`,htmlFor:`curation-reject-comment`,children:xe()}),(0,Q.jsx)(`textarea`,{id:`curation-reject-comment`,className:`oc-afiles__reject-textarea`,rows:3,placeholder:l(),value:b,onChange:e=>C(e.target.value)}),(0,Q.jsxs)(`div`,{className:`oc-afiles__review-actions`,children:[(0,Q.jsx)(q,{variant:`ghost`,onClick:()=>y(!1),disabled:p!==null,children:x()}),(0,Q.jsx)(q,{variant:`outline`,onClick:()=>void A(!1),disabled:p!==null,children:p===`reject`?G():Se()}),(0,Q.jsx)(q,{variant:`default`,onClick:()=>void A(!0),disabled:p!==null,children:p===`reject`?G():I()})]})]}):(0,Q.jsxs)(`div`,{className:`oc-afiles__review-actions`,children:[(0,Q.jsx)(q,{variant:`outline`,onClick:()=>y(!0),disabled:p!==null||a==null,children:S()}),(0,Q.jsx)(q,{variant:`default`,onClick:()=>void O(),disabled:p!==null||a==null,children:p===`approve`?G():f()})]})]})})}export{rt as AgentFilesTab};
@@ -0,0 +1 @@
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$E as r,AE as i,BE as a,CE as o,DE as ee,EE as s,FE as te,GE as ne,HE as re,IE as c,JE as ie,KE as ae,LE as oe,ME as se,NE as l,OE as u,PE as ce,QE as le,RE as ue,SE as de,TE as fe,UE as pe,VE as me,WE as he,XE as ge,YE as _e,ZE as ve,_E as d,bE as f,cE as p,dE as m,eD as h,fE as g,gE as ye,hE as be,jE as xe,kE as Se,lE as _,mE as v,nD as y,nU as b,pE as x,qE as S,sE as C,t as w,tD as T,tU as E,uE as D,vE as O,wE as k,xE as A,yE as j,zE as Ce}from"./api-D7og-4qA.js";import{$ as M,Dt as we,Et as N,Kn as P,Q as F,U as Te,X as I,Z as L,at as R,ct as z,et as B,i as Ee,nt as V,o as H,ot as U,q as De,qn as Oe,tt as W}from"./index-Dn5iHsqH.js";import{n as ke}from"./TimeRangePicker-DIGmrYqi.js";import{t as Ae}from"./FilterBar-CGSxi-Sq.js";import{t as je}from"./DataTableShell-BzQgqnDl.js";import{t as G}from"./dispatchErrorInfo-wT9RzbRF.js";var K=t(e(),1),q=n(),J=`__all__`,Me=[{value:`open`},{value:`acknowledged`},{value:`resolved`}];function Ne(e){return e===`open`?y():e===`acknowledged`?T():h()}var Pe=[`info`,`warn`,`critical`],Fe=[`detector`,`agent`,`user`],Ie={kind:`relative`,from:`now-30d`,to:`now`},Le=200,Y=`all`;function X(){let e=Oe({from:`/settings/anomalies`}),t=P({from:`/settings/anomalies`}),n=e.q??``,p=e.status===Y?J:e.status,m=e.severity??J,h=e.kind??J,[g,_]=(0,K.useState)(J),v=Ee(e.from,e.to),{from:y,to:x}=ke(v),C=e=>void t({search:t=>({...t,q:e||void 0}),replace:!0}),T=e=>void t({search:t=>({...t,status:e===J?Y:e})}),D=e=>void t({search:t=>({...t,severity:e===J?void 0:e})}),R=e=>void t({search:t=>({...t,kind:e===J?void 0:e})}),V=e=>void t({search:t=>({...t,...H(e)})}),U=Te(),W=we(),G=E(w.anomalies.resolveAnomaly),X=(b(w.me.getMe,{host:De})?.permissions??[]).includes(`admin.manage`),Z=b(w.anomalies.listAnomalies,{limit:Le,filter:{q:n||void 0,from:y,to:x,anomalyStatus:p===J?void 0:p,severity:m===J?void 0:m,source:g===J?void 0:g,kind:h===J?void 0:h}}),Q=(0,K.useMemo)(()=>{let e=new Set;for(let t of Z??[])e.add(t.kind);return[...e].sort()},[Z]),$=n!==``||p!==`open`||m!==J||g!==J||h!==J||v.kind!==`relative`||v.from!==Ie.from;function Ue(){_(J),t({search:{status:`open`},replace:!0})}async function We(e){if(await U({title:r(),description:(0,q.jsxs)(q.Fragment,{children:[le(),` `,(0,q.jsx)(`span`,{className:`font-mono`,children:e.kind}),` `,ve(),` `,(0,q.jsx)(`strong`,{children:ge()}),`.`,` `,_e()]}),confirmLabel:ie()}))try{await G({anomalyId:e._id,status:`resolved`}),W.success(S(),e.kind)}catch(e){W.error(ae(),e)}}async function Ge(e){try{await G({anomalyId:e._id,status:`acknowledged`}),W.success(ne(),e.kind)}catch(e){W.error(he(),e)}}return(0,q.jsxs)(q.Fragment,{children:[(0,q.jsxs)(`p`,{className:`oc-admin__hint`,children:[pe(),` `,(0,q.jsx)(`strong`,{children:re()}),` `,me(),` `,(0,q.jsx)(`strong`,{children:a()}),` `,Ce(),` `,(0,q.jsx)(`strong`,{children:ue()}),` `,oe(),` `,(0,q.jsx)(`span`,{className:`oc-filter__window`,children:c()})]}),(0,q.jsxs)(Ae,{q:n,onQChange:C,searchPlaceholder:te(),timeRange:v,onTimeRangeChange:V,onReset:Ue,canReset:$,children:[(0,q.jsxs)(I,{value:p,onValueChange:T,children:[(0,q.jsx)(M,{size:`sm`,className:`w-36`,children:(0,q.jsx)(B,{})}),(0,q.jsxs)(L,{children:[(0,q.jsx)(F,{value:J,children:ce()}),Me.map(e=>(0,q.jsx)(F,{value:e.value,children:Ne(e.value)},e.value))]})]}),(0,q.jsxs)(I,{value:m,onValueChange:D,children:[(0,q.jsx)(M,{size:`sm`,className:`w-36`,children:(0,q.jsx)(B,{placeholder:l()})}),(0,q.jsxs)(L,{children:[(0,q.jsx)(F,{value:J,children:Se()}),Pe.map(e=>(0,q.jsx)(F,{value:e,children:e},e))]})]}),(0,q.jsxs)(I,{value:g,onValueChange:_,children:[(0,q.jsx)(M,{size:`sm`,className:`w-32`,children:(0,q.jsx)(B,{placeholder:u()})}),(0,q.jsxs)(L,{children:[(0,q.jsx)(F,{value:J,children:ee()}),Fe.map(e=>(0,q.jsx)(F,{value:e,children:e},e))]})]}),(0,q.jsxs)(I,{value:h,onValueChange:R,children:[(0,q.jsx)(M,{size:`sm`,className:`w-36`,children:(0,q.jsx)(B,{placeholder:s()})}),(0,q.jsxs)(L,{children:[(0,q.jsx)(F,{value:J,children:fe()}),Q.map(e=>(0,q.jsx)(F,{value:e,children:e},e))]})]})]}),(0,q.jsx)(je,{title:k(),rows:Z,emptyHint:p===`open`?o():de(),rowActions:e=>X&&e.status===`open`?[{label:A(),onSelect:()=>void We(e)},{label:f(),onSelect:()=>void Ge(e)}]:[],columns:[{header:j(),cell:e=>(0,q.jsx)(`span`,{className:`oc-traces__time`,children:z(e.at)}),sort:e=>e.at},{header:s(),cell:e=>(0,q.jsx)(`code`,{className:`oc-traces__mono`,children:e.kind}),sort:e=>e.kind},{header:se(),cell:e=>e.occurrenceCount!==null&&e.occurrenceCount>1?(0,q.jsx)(`span`,{className:`oc-traces__time`,title:e.firstAt===null?void 0:i({when:z(e.firstAt)}),children:xe({count:String(e.occurrenceCount)})}):(0,q.jsx)(`span`,{className:`oc-traces__time`,children:`—`}),sort:e=>e.occurrenceCount??0},{header:l(),cell:e=>(0,q.jsx)(Be,{severity:e.severity}),sort:e=>e.severity===`critical`?2:+(e.severity===`warn`)},{header:O(),cell:e=>(0,q.jsx)(Ve,{status:e.status}),sort:e=>e.status===`resolved`?2:+(e.status===`acknowledged`)},{header:u(),cell:e=>(0,q.jsx)(N,{variant:`outline`,children:e.source}),sort:e=>e.source},{header:d(),cell:e=>(0,q.jsxs)(`div`,{className:`oc-anomaly__msgcell`,children:[(0,q.jsx)(`span`,{className:`oc-anomaly__msg`,children:e.message}),(0,q.jsx)(ze,{row:e})]}),sort:e=>e.message},{header:ye(),cell:e=>(0,q.jsx)(Re,{row:e}),sort:e=>e.evidence??null},{header:be(),cell:e=>e.correlationId?(0,q.jsx)(`code`,{className:`oc-traces__mono`,children:He(e.correlationId)}):(0,q.jsx)(`span`,{className:`oc-traces__muted`,children:`—`}),sort:e=>e.correlationId}]})]})}var Z=new Set([`openclaw.dispatch_failures`,`assistant.announce_errors`]);function Q(e){if(!Z.has(e.kind)||!e.evidence)return{};try{let t=JSON.parse(e.evidence);return{dominantCode:t.dominantCode,sampleCorrelationId:t.sampleCorrelationId}}catch{return{}}}function $(e){if(e.kind!==`subagent.failure`||!e.evidence)return{};try{let t=JSON.parse(e.evidence);return{failedCount:t.failedCount,totalCount:t.totalCount,errorCategories:t.errorCategories}}catch{return{}}}function Re({row:e}){let t=P();if(e.kind===`subagent.failure`){let n=$(e);return(0,q.jsxs)(`div`,{className:`oc-anomaly__cause`,children:[(0,q.jsx)(`div`,{className:`oc-anomaly__cause-head`,children:[...new Set(n.errorCategories??[])].map(e=>(0,q.jsx)(`code`,{className:`oc-traces__mono`,children:e},e))}),e.correlationId?(0,q.jsxs)(`button`,{type:`button`,className:`oc-anomaly__drill`,onClick:()=>void t({to:`/settings/traces`,search:{q:e.correlationId,limit:100}}),children:[`↗ `,v()]}):null]})}let n=Q(e);if(!n.dominantCode){let e=n.sampleCorrelationId;return e?(0,q.jsx)(`div`,{className:`oc-anomaly__cause`,children:(0,q.jsxs)(`button`,{type:`button`,className:`oc-anomaly__drill`,onClick:()=>void t({to:`/settings/traces`,search:{correlationId:e,limit:100}}),children:[`↗ `,v()]})}):(0,q.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})}let r=G(n.dominantCode),i=n.sampleCorrelationId;return(0,q.jsxs)(`div`,{className:`oc-anomaly__cause`,children:[(0,q.jsxs)(`div`,{className:`oc-anomaly__cause-head`,children:[(0,q.jsx)(`span`,{className:`oc-anomaly__cause-label`,children:r.label}),(0,q.jsx)(`code`,{className:`oc-traces__mono`,children:n.dominantCode})]}),(0,q.jsx)(`p`,{className:`oc-anomaly__cause-hint`,children:r.hint}),i?(0,q.jsxs)(`button`,{type:`button`,className:`oc-anomaly__drill`,onClick:()=>void t({to:`/settings/traces`,search:{correlationId:i,limit:100}}),children:[`↗ `,v()]}):null]})}function ze({row:e}){let[t,n]=(0,K.useState)(!1),r=b(w.anomalies.getAnomalyAttachments,t?{anomalyId:e._id}:`skip`);return!e.attachments||e.attachments.length===0?null:(0,q.jsxs)(q.Fragment,{children:[(0,q.jsxs)(`button`,{type:`button`,className:`oc-anomaly__drill`,onClick:()=>n(!0),children:[x(),e.attachments.length>1?` (${e.attachments.length})`:``]}),(0,q.jsx)(W,{open:t,onOpenChange:n,children:(0,q.jsxs)(V,{className:`oc-anomaly__attachments-dialog`,children:[(0,q.jsx)(R,{children:(0,q.jsx)(U,{children:g()})}),r===void 0?(0,q.jsx)(`p`,{className:`oc-traces__muted`,children:m()}):r.length===0?(0,q.jsx)(`p`,{className:`oc-traces__muted`,children:D()}):(0,q.jsx)(`div`,{className:`oc-anomaly__attachments`,children:r.map(e=>(0,q.jsxs)(`section`,{className:`oc-anomaly__attachment`,children:[(0,q.jsx)(`h4`,{className:`oc-anomaly__attachment-name`,children:(0,q.jsx)(`code`,{className:`oc-traces__mono`,children:e.name})}),(0,q.jsx)(`pre`,{className:`oc-anomaly__attachment-content`,children:e.content})]},e.name))})]})})]})}function Be({severity:e}){return(0,q.jsx)(`span`,{className:`oc-anomaly__sev oc-anomaly__sev--${e}`,children:e})}function Ve({status:e}){return e===`open`?(0,q.jsx)(N,{variant:`destructive`,children:_()}):e===`acknowledged`?(0,q.jsx)(N,{variant:`secondary`,children:p()}):(0,q.jsx)(N,{variant:`outline`,children:C()})}function He(e){return e.length>8?e.slice(0,8):e}export{X as AnomaliesTab};
@@ -0,0 +1 @@
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$D as r,JD as i,QD as a,XD as o,YD as s,ZD as c,_s as l,aO as u,bs as d,cO as f,eO as p,gs as m,hs as h,iO as g,nO as _,nU as v,oO as y,rO as b,sO as x,t as S,tO as C,vs as w,ys as T}from"./api-D7og-4qA.js";import{$ as E,Kn as D,Q as O,X as k,Z as A,a as j,ct as M,et as N,i as P,n as F,o as I,qn as L,s as R}from"./index-Dn5iHsqH.js";import{n as ee}from"./TimeRangePicker-DIGmrYqi.js";import{t as z}from"./FilterBar-CGSxi-Sq.js";import{t as B}from"./AdvancedFilter-CO3ZakuW.js";import{t as V}from"./DataTableShell-BzQgqnDl.js";var H=t(e(),1),U=n(),W={kind:`relative`,from:F,to:`now`},G=`__all__`,K=[{value:`action`,label:d()},{value:`realLabel`,label:T()},{value:`targetLabel`,label:w()},{value:`impersonated`,label:l()},{value:`resource`,label:m()},{value:`resourceId`,label:h()}];function q(){let e=L({from:`/settings/audit`}),t=D({from:`/settings/audit`}),n=e.q??``,l=e.action??G,d=e.impersonated??G,m=e.resource??G,h=P(e.from,e.to),w=(0,H.useMemo)(()=>R(e.adv),[e.adv]),{from:T,to:F}=ee(h),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,...I(e)})}),Q=e=>void t({search:t=>({...t,adv:j(e)}),replace:!0}),$=v(S.admin.listAudit,{filter:{q:n||void 0,from:T,to:F,action:l===G?void 0:l,resource:m===G?void 0:m,impersonated:d===G?void 0:d===`yes`,advanced:w.length>0?w: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!==``||l!==G||d!==G||m!==G||w.length>0||h.kind!==`relative`||h.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:[f(),` `,(0,U.jsx)(`span`,{className:`oc-filter__window`,children:x()})]}),(0,U.jsxs)(z,{q:n,onQChange:q,searchPlaceholder:y(),timeRange:h,onTimeRangeChange:Z,onReset:ie,canReset:re,children:[(0,U.jsxs)(k,{value:l,onValueChange:J,children:[(0,U.jsx)(E,{size:`sm`,className:`w-40`,children:(0,U.jsx)(N,{placeholder:u()})}),(0,U.jsxs)(A,{children:[(0,U.jsx)(O,{value:G,children:g()}),te.map(e=>(0,U.jsx)(O,{value:e,children:e},e))]})]}),(0,U.jsxs)(k,{value:d,onValueChange:Y,children:[(0,U.jsx)(E,{size:`sm`,className:`w-40`,children:(0,U.jsx)(N,{})}),(0,U.jsxs)(A,{children:[(0,U.jsx)(O,{value:G,children:b()}),(0,U.jsx)(O,{value:`yes`,children:_()}),(0,U.jsx)(O,{value:`no`,children:C()})]})]}),(0,U.jsxs)(k,{value:m,onValueChange:X,children:[(0,U.jsx)(E,{size:`sm`,className:`w-40`,children:(0,U.jsx)(N,{placeholder:p()})}),(0,U.jsxs)(A,{children:[(0,U.jsx)(O,{value:G,children:r()}),ne.map(e=>(0,U.jsx)(O,{value:e,children:e},e))]})]})]}),(0,U.jsx)(B,{fields:K,seed:w,onChange:Q}),(0,U.jsx)(V,{title:a(),rows:$,emptyHint:c(),columns:[{header:o(),cell:e=>M(e.at),sort:e=>e.at},{header:u(),cell:e=>e.action,sort:e=>e.action},{header:s(),cell:e=>e.realLabel,sort:e=>e.realLabel},{header:i(),cell:e=>e.targetLabel??`—`,sort:e=>e.targetLabel??null},{header:p(),cell:e=>e.resource?e.resource+(e.resourceId?` · ${e.resourceId.slice(0,8)}`:``):`—`,sort:e=>e.resource??null}]})]})}export{q as AuditTab};
@@ -0,0 +1 @@
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$C as r,$H as i,$S as a,$r as o,AS as s,BS as c,Bo as l,CC as u,Cp as d,D as f,DS as p,Dp as m,Ep as h,FS as g,GS as _,HS as v,IS as y,JC as ee,JS as b,KS as x,LS as te,Lo as ne,MS as re,NS as ie,OS as ae,Op as oe,PS as se,QC as ce,QS as le,RS as ue,Ro as de,SC as fe,Sp as pe,TC as me,Tp as he,US as ge,VS as S,Vo as _e,WS as ve,Wo as ye,XS as be,YS as xe,ZC as Se,ZS as Ce,_C as we,_p as Te,aC as Ee,bC as De,bp as Oe,cC as ke,dC as Ae,eC as je,ew as Me,fC as Ne,fp as Pe,gC as Fe,hC as Ie,iC as Le,iw as Re,jS as ze,kS as Be,kp as Ve,lC as He,mC as Ue,nC as C,nU as w,nw as We,oC as Ge,ow as Ke,pC as qe,qC as Je,qS as Ye,rC as Xe,rw as Ze,sC as Qe,sw as $e,t as T,tC as et,tU as tt,tw as nt,uC as rt,vC as it,vp as at,wC as ot,wn as st,wp as E,xC as ct,xp as lt,yC as ut,yp as dt,zS as ft,zo as pt}from"./api-D7og-4qA.js";import{t as mt}from"./chevrons-up-down-DIadyetY.js";import{i as ht,n as D,o as gt,r as _t,s as vt}from"./FieldLabel-vGVJ37ds.js";import{i as yt,n as bt,r as xt,t as St}from"./tabs-CnkwmnFT.js";import{t as O}from"./button-Ch1cRvCe.js";import{$ as k,Bn as Ct,Bt as wt,Dt as Tt,Et as A,F as Et,Kn as Dt,On as Ot,Q as j,Rt as kt,Un as M,Vn as At,X as N,Z as P,at as jt,ct as F,et as I,jt as L,lt as R,mn as z,nt as Mt,ot as Nt,q as Pt,qn as Ft,rt as It,tt as Lt,un as B,ut as Rt,zn as zt,zt as Bt}from"./index-Dn5iHsqH.js";import{r as Vt}from"./locales-CPjguROj.js";import{a as Ht,i as V,n as Ut,o as H,r as U,t as Wt}from"./table-CKpkQP4H.js";import{t as Gt}from"./FilterBar-CGSxi-Sq.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-BWt5iAM2.js";import{t as W}from"./dispatchErrorInfo-wT9RzbRF.js";var $t=f(`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=f(`wifi-off`,[[`path`,{d:`M12 20h.01`,key:`zekei9`}],[`path`,{d:`M8.5 16.429a5 5 0 0 1 7 0`,key:`1bycff`}],[`path`,{d:`M5 12.859a10 10 0 0 1 5.17-2.69`,key:`1dl1wf`}],[`path`,{d:`M19 12.859a10 10 0 0 0-2.007-1.523`,key:`4k23kn`}],[`path`,{d:`M2 8.82a15 15 0 0 1 4.177-2.643`,key:`1grhjp`}],[`path`,{d:`M22 8.82a15 15 0 0 0-11.288-3.764`,key:`z3jwby`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}]]),G=t(e(),1);function tn(e){return e.filter(e=>e.state===`error`)}function nn(e){return e.reachable&&tn(e.targets).length===0}function rn(e){return nn(e)?(e.unreachableInstances??[]).length>0?`gateways_unreachable`:`ok`:`error`}function an(e){return e.state===`error`&&e.lastErrorCode!==null}function on(e){return!!e.lastDownstreamRejectCode}function sn(e){return!!e.lastLocalRefusalCode}function cn(e){return an(e)||on(e)||sn(e)}function K(e){return e.kind??`openclaw`}function ln(e){return[...e].sort((e,t)=>e===`openclaw`?-1:t===`openclaw`?1:e.localeCompare(t))}function un(e,t,n){let r=new Map;for(let e of t)e.instanceName&&r.set(e.instanceName,e.provider);for(let e of n)r.set(e.name,K(e));let i=e=>(e.instanceName?r.get(e.instanceName):void 0)??`openclaw`,a=new Set;for(let e of n)a.add(K(e));for(let e of t)a.add(e.provider);for(let t of e)a.add(i(t));return ln(a).map(r=>({key:r,connections:e.filter(e=>i(e)===r),compatTargets:t.filter(e=>e.provider===r),instances:n.filter(e=>K(e)===r)}))}function q(e){return e===`openclaw`?`OpenClaw`:e===`hermes`?`Hermes`:e.charAt(0).toUpperCase()+e.slice(1)}var J=`__all__`,dn={q:``,state:J,instance:J,version:J},Y={connected:0,error:1,idle:2};function fn(e){return e.q.trim()!==``||e.state!==`__all__`||e.instance!==`__all__`||e.version!==`__all__`}function pn(e,t){let n=t.q.trim().toLowerCase();return e.filter(e=>!(n&&!`${e.targetLabel} ${e.gatewayHost}`.toLowerCase().includes(n)||t.state!==`__all__`&&e.state!==t.state||t.instance!==`__all__`&&(e.instanceName??``)!==t.instance||t.version!==`__all__`&&(e.gatewayVersion??``)!==t.version))}function X(e,t){return e.localeCompare(t,void 0,{numeric:!0,sensitivity:`base`})}function mn(e,t){return e===`version`?t.gatewayVersion===null:e===`lastOk`?t.lastOkAt===null:!1}function hn(e,t,n){switch(e){case`state`:return(Y[t.state]??99)-(Y[n.state]??99);case`instance`:return X(t.instanceLabel??t.instanceName??``,n.instanceLabel??n.instanceName??``);case`host`:return X(t.gatewayHost,n.gatewayHost);case`version`:{let e=t.gatewayVersion,r=n.gatewayVersion;return Zt(e,r)??X(e,r)}case`lastOk`:return t.lastOkAt-n.lastOkAt;default:return X(t.targetLabel,n.targetLabel)}}function gn(e,t){if(!t)return e;let n=t.dir===`asc`?1:-1;return[...e].sort((e,r)=>{let i=mn(t.key,e),a=mn(t.key,r);return i&&a?0:i?1:a?-1:n*hn(t.key,e,r)})}function _n(e){let t=new Set;for(let n of e)t.add(n.state);return[...t].sort((e,t)=>(Y[e]??99)-(Y[t]??99))}function vn(e){let t=new Map;for(let n of e)n.instanceName!==null&&(t.has(n.instanceName)||t.set(n.instanceName,n.instanceLabel??n.instanceName));return[...t.entries()].map(([e,t])=>({name:e,label:t})).sort((e,t)=>X(e.label,t.label))}function yn(e){let t=new Set;for(let n of e)n.gatewayVersion!==null&&t.add(n.gatewayVersion);return[...t].sort((e,t)=>Zt(e,t)??X(e,t))}var Z=n();function bn({connections:e,displayByInstance:t}){let[n,r]=(0,G.useState)(dn),[i,a]=(0,G.useState)(null),o=(0,G.useMemo)(()=>e.map((e,n)=>({_id:`${e.key}:${e.canonical}/${e.agentId}:${n}`,targetLabel:`${e.canonical}/${e.agentId}`,state:e.state,instanceName:e.instanceName??null,instanceLabel:e.instanceName?t.get(e.instanceName)??e.instanceName:null,gatewayHost:e.gatewayHost,gatewayVersion:e.gatewayVersion??null,okCount:e.okCount,errorCount:e.errorCount+(e.downstreamRejectCount??0)+(e.localRefusalCount??0),attempts:e.attempts,lastOkAt:e.lastOkAt??null,lastErrorCode:e.lastErrorCode??null,lastErrorAt:e.lastErrorAt??null,lastDownstreamRejectCode:e.lastDownstreamRejectCode??null,lastDownstreamRejectAt:e.lastDownstreamRejectAt??null,lastLocalRefusalCode:e.lastLocalRefusalCode??null,lastLocalRefusalAt:e.lastLocalRefusalAt??null})),[e,t]),l=(0,G.useMemo)(()=>_n(o),[o]),u=(0,G.useMemo)(()=>vn(o),[o]),d=(0,G.useMemo)(()=>yn(o),[o]),f=(0,G.useMemo)(()=>gn(pn(o,n),i),[o,n,i]);function p(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:_()}):(0,Z.jsxs)(`div`,{className:`oc-conn`,children:[(0,Z.jsxs)(Gt,{q:n.q,onQChange:e=>r(t=>({...t,q:e})),searchPlaceholder:v(),onReset:()=>r(dn),canReset:fn(n),children:[(0,Z.jsxs)(N,{value:n.state,onValueChange:e=>r(t=>({...t,state:e})),children:[(0,Z.jsx)(k,{size:`sm`,className:`w-36`,children:(0,Z.jsx)(I,{placeholder:c()})}),(0,Z.jsxs)(P,{children:[(0,Z.jsx)(j,{value:J,children:S()}),l.map(e=>(0,Z.jsx)(j,{value:e,children:Sn(e)},e))]})]}),(0,Z.jsxs)(N,{value:n.instance,onValueChange:e=>r(t=>({...t,instance:e})),children:[(0,Z.jsx)(k,{size:`sm`,className:`w-40`,children:(0,Z.jsx)(I,{placeholder:ft()})}),(0,Z.jsxs)(P,{children:[(0,Z.jsx)(j,{value:J,children:S()}),u.map(e=>(0,Z.jsx)(j,{value:e.name,children:e.label},e.name))]})]}),(0,Z.jsxs)(N,{value:n.version,onValueChange:e=>r(t=>({...t,version:e})),children:[(0,Z.jsx)(k,{size:`sm`,className:`w-36`,children:(0,Z.jsx)(I,{placeholder:ue()})}),(0,Z.jsxs)(P,{children:[(0,Z.jsx)(j,{value:J,children:S()}),d.map(e=>(0,Z.jsx)(j,{value:e,children:e},e))]})]})]}),f.length===0?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:te()}):(0,Z.jsxs)(Wt,{className:`oc-conn__table`,children:[(0,Z.jsx)(Ht,{children:(0,Z.jsxs)(H,{children:[(0,Z.jsx)(Q,{label:y(),sortKey:`target`,sort:i,onSort:p}),(0,Z.jsx)(Q,{label:g(),sortKey:`state`,sort:i,onSort:p}),(0,Z.jsx)(Q,{label:se(),sortKey:`instance`,sort:i,onSort:p}),(0,Z.jsx)(Q,{label:ie(),sortKey:`host`,sort:i,onSort:p}),(0,Z.jsx)(Q,{label:re(),sortKey:`version`,sort:i,onSort:p}),(0,Z.jsx)(V,{children:ze()}),(0,Z.jsx)(Q,{label:s(),sortKey:`lastOk`,sort:i,onSort:p})]})}),(0,Z.jsx)(Ut,{children:f.map(e=>(0,Z.jsx)(xn,{r:e},e._id))})]})]})}function Q({label:e,sortKey:t,sort:n,onSort:r}){let i=n?.key===t,a=i?n.dir:null;return(0,Z.jsx)(V,{"aria-sort":i?a===`asc`?`ascending`:`descending`:`none`,children:(0,Z.jsxs)(`button`,{type:`button`,className:`oc-conn__sort`,onClick:()=>r(t),children:[e,i?a===`asc`?(0,Z.jsx)(Ct,{size:13,"aria-hidden":!0}):(0,Z.jsx)(M,{size:13,"aria-hidden":!0}):(0,Z.jsx)(mt,{size:13,"aria-hidden":!0,className:`oc-conn__sort-idle`})]})})}function xn({r:e}){let t=an(e)?W(e.lastErrorCode):null,n=on(e)?W(e.lastDownstreamRejectCode):null,r=sn(e)?W(e.lastLocalRefusalCode):null;return(0,Z.jsxs)(G.Fragment,{children:[(0,Z.jsxs)(H,{className:`oc-conn__row oc-conn__row--${e.state}`,children:[(0,Z.jsx)(U,{children:(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:e.targetLabel})}),(0,Z.jsx)(U,{children:(0,Z.jsx)(Cn,{state:e.state})}),(0,Z.jsx)(U,{children:e.instanceLabel?(0,Z.jsx)(`span`,{className:`oc-bridge-target__instance`,children:e.instanceLabel}):(0,Z.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})}),(0,Z.jsx)(U,{children:(0,Z.jsx)(`span`,{className:`oc-bridge-target__host`,children:e.gatewayHost})}),(0,Z.jsx)(U,{children:e.gatewayVersion?(0,Z.jsx)(`span`,{className:`oc-bridge-target__version`,children:e.gatewayVersion}):(0,Z.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})}),(0,Z.jsx)(U,{children:(0,Z.jsx)(`span`,{className:`oc-conn__stats`,children:ve({ok:e.okCount,errors:e.errorCount,attempts:e.attempts})})}),(0,Z.jsx)(U,{children:e.lastOkAt?(0,Z.jsx)(`span`,{className:`oc-traces__mono`,children:R(e.lastOkAt)}):(0,Z.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})})]}),cn(e)?(0,Z.jsx)(H,{className:`oc-conn__detail-row`,children:(0,Z.jsxs)(U,{colSpan:7,className:`oc-conn__detail-cell`,children:[t?(0,Z.jsxs)(`div`,{className:`oc-bridge-target__error`,children:[(0,Z.jsx)(`strong`,{children:t.label}),` `,(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:e.lastErrorCode}),e.lastErrorAt?` · ${R(e.lastErrorAt)}`:``,(0,Z.jsx)(`p`,{className:`oc-bridge-card__hint`,children:t.hint})]}):null,r?(0,Z.jsxs)(`div`,{className:`oc-bridge-target__downstream`,children:[st({label:r.label}),` `,(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:e.lastLocalRefusalCode}),e.lastLocalRefusalAt?` · ${R(e.lastLocalRefusalAt)}`:``,(0,Z.jsx)(`p`,{className:`oc-bridge-card__hint`,children:r.hint})]}):null,n?(0,Z.jsxs)(`div`,{className:`oc-bridge-target__downstream`,children:[ge({label:n.label}),` `,(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:e.lastDownstreamRejectCode}),e.lastDownstreamRejectAt?` · ${R(e.lastDownstreamRejectAt)}`:``]}):null]})}):null]})}function Sn(e){return e===`connected`?Be():e===`error`?ae():p()}function Cn({state:e}){return e===`connected`?(0,Z.jsx)(A,{variant:`secondary`,children:Be()}):e===`error`?(0,Z.jsx)(A,{variant:`destructive`,children:ae()}):(0,Z.jsx)(A,{variant:`outline`,children:p()})}function wn(){return w(T.bridgeHealth.getBridgeHealth,{})}function Tn(){let e=wn(),t=w(T.compat.getBridgeCompat,{}),n=w(T.me.getMe,{host:Pt})?.role===`admin`,r=w(T.admin.listInstances,n?{}:`skip`),i=w(T.agents.usageForInstances,n?{}:`skip`),a=Dt(),o=()=>void a({to:`/settings/anomalies`,search:{status:`open`}}),s=un(e?e.targets:[],t?t.targets:[],r??[]),{section:c}=Ft({from:`/settings/bridge`}),u=Dt({from:`/settings/bridge`}),d=t?.compat??null,f=t===void 0?`loading`:t===null?`nodata`:`ready`,p=d!==null&&Xt(d,`hermes`)&&!s.some(e=>e.key===`hermes`);return(0,Z.jsxs)(`div`,{className:`oc-bridge`,children:[(0,Z.jsx)(En,{health:e,compat:t,onSeeAnomalies:o}),(0,Z.jsx)(`p`,{className:`oc-admin__hint oc-bridge__caption`,children:Ae()}),i&&i.length>0?(0,Z.jsxs)(`section`,{className:`oc-bridge__usage`,children:[(0,Z.jsx)(`h3`,{className:`oc-bridge__usage-title`,children:rt()}),(0,Z.jsxs)(Wt,{children:[(0,Z.jsx)(Ht,{children:(0,Z.jsxs)(H,{children:[(0,Z.jsx)(V,{children:_e()}),(0,Z.jsx)(V,{children:l()}),(0,Z.jsx)(V,{children:pt()}),(0,Z.jsx)(V,{children:de()}),(0,Z.jsx)(V,{children:ne()})]})}),(0,Z.jsx)(Ut,{children:i.flatMap(e=>{let t=Et(e.usage,Date.now());return t?t.windows.map((t,n)=>(0,Z.jsxs)(H,{children:[(0,Z.jsx)(U,{className:`font-medium`,children:n===0?e.instanceName:``}),(0,Z.jsx)(U,{children:t.provider}),(0,Z.jsx)(U,{children:t.label}),(0,Z.jsx)(U,{children:(0,Z.jsxs)(A,{variant:t.percentLeft<=10?`destructive`:t.percentLeft<=25?`outline`:`secondary`,children:[t.percentLeft,`%`]})}),(0,Z.jsx)(U,{className:`text-muted-foreground`,children:t.resetText??`—`})]},`${e.instanceName}:${t.provider}:${t.label}`)):[]})})]})]}):null,s.length>0?(0,Z.jsxs)(St,{value:s.some(e=>e.key===c)?c:s[0]?.key??`openclaw`,onValueChange:e=>void u({search:{section:e},replace:!0}),children:[(0,Z.jsx)(xt,{className:`w-full`,children:s.map(e=>(0,Z.jsxs)(yt,{value:e.key,className:`flex-1 gap-1.5`,children:[(0,Z.jsx)(z,{size:13,"aria-hidden":!0}),q(e.key)]},e.key))}),s.map(e=>(0,Z.jsx)(bt,{value:e.key,children:(0,Z.jsx)(Dn,{providerKey:e.key,connections:e.connections,instances:e.instances,manifest:d,compatStatus:f,compatReachable:t?.reachable??!0,protocol:e.key===`openclaw`?t?.protocol??null:null})},e.key))]}):null,p?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:Pe()}):null]})}function En({health:e,compat:t,onSeeAnomalies:n}){let r=t!=null&&t.buildVersion!=null&&t.bridgeVersion!=null&&t.buildVersion!==t.bridgeVersion,i=t?.buildRevision&&t.buildRevision!==`unknown`?t.buildRevision.slice(0,7):null,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)}),i?(0,Z.jsxs)(Z.Fragment,{children:[` `,(0,Z.jsxs)(`code`,{className:`oc-traces__mono`,title:m(),children:[`(`,i,`)`]})]}):null,r?(0,Z.jsxs)(`strong`,{className:`oc-bridge-card__mismatch`,children:[` `,h({build:t.buildVersion??`?`})]}):null,` · `,he(),` `,(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:t.protocolVersion===null?E():String(t.protocolVersion)})]}):null;if(e===void 0)return(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:C()});if(e===null)return(0,Z.jsx)(`div`,{className:`oc-bridge-card oc-bridge-card--idle`,children:et()});let s=tn(e.targets),c=!e.reachable,l=rn(e),u=e.unreachableInstances??[],d=l===`ok`?`ok`:l===`gateways_unreachable`?`warn`:`error`,f=F(e.checkedAt),p=e.startedAt==null?null:F(e.startedAt);return(0,Z.jsxs)(`div`,{className:`oc-bridge-card oc-bridge-card--${d}`,children:[(0,Z.jsx)(`div`,{className:`oc-bridge-card__icon`,"aria-hidden":!0,children:l===`ok`?(0,Z.jsx)(zt,{size:22}):c||l===`gateways_unreachable`?(0,Z.jsx)(en,{size:22}):(0,Z.jsx)(B,{size:22})}),(0,Z.jsxs)(`div`,{className:`oc-bridge-card__body`,children:[(0,Z.jsx)(`div`,{className:`oc-bridge-card__title`,children:l===`ok`?je():l===`gateways_unreachable`?be({count:u.length}):c?a():le({count:s.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}),` `,Ce({time:f})]}),p?(0,Z.jsx)(`span`,{children:b({time:p})}):null,o]}),l===`gateways_unreachable`?(0,Z.jsx)(`p`,{className:`oc-bridge-card__hint`,children:xe({names:u.join(`, `)})}):null,c?(0,Z.jsx)(`p`,{className:`oc-bridge-card__hint`,children:W(e.lastError===`not_configured`?`NOT_CONFIGURED`:`BRIDGE_UNREACHABLE`).hint}):null]}),(0,Z.jsx)(`button`,{type:`button`,className:`oc-bridgebar__drill`,onClick:n,children:Ye()})]})}function Dn({providerKey:e,connections:t,instances:n,manifest:r,compatStatus:i,compatReachable:a,protocol:o}){let s=r?Kt(r,e):null,c=new Map;for(let e of n)c.set(e.name,e.displayName??e.name);let l=[],u=new Set;for(let n of t){if(!n.instanceName||u.has(n.instanceName))continue;u.add(n.instanceName);let t=n.gatewayVersion??null;l.push({instanceName:n.instanceName,displayName:c.get(n.instanceName)??n.instanceName,version:t,state:Jt(t,e,r)})}let d=Qt(l.map(e=>e.state)),[f,p]=(0,G.useState)(!1);return(0,Z.jsxs)(`section`,{className:`oc-bridge-provider`,children:[(0,Z.jsxs)(`header`,{className:`oc-bridge-provider__head`,children:[(0,Z.jsx)(z,{size:15,"aria-hidden":!0,className:`oc-bridge-provider__icon`}),(0,Z.jsx)(`span`,{className:`oc-bridge-provider__name`,children:q(e)}),d?(0,Z.jsx)(A,{variant:d===`beyond`||d===`defective`?`destructive`:`secondary`,children:qt(d)}):null]}),(0,Z.jsx)(`h4`,{className:`oc-bridge-provider__sub`,children:Ve()}),(0,Z.jsx)(kn,{providerName:q(e),support:s,compatStatus:i,compatReachable:a,manifest:r,instanceRows:l}),o?(0,Z.jsx)(On,{protocol:o}):null,(0,Z.jsxs)(`button`,{type:`button`,className:`oc-bridge-provider__sub oc-bridge-provider__sub--toggle`,"aria-expanded":f,onClick:()=>p(e=>!e),children:[f?(0,Z.jsx)(M,{size:13,"aria-hidden":!0}):(0,Z.jsx)(At,{size:13,"aria-hidden":!0}),x({count:t.length})]}),f?(0,Z.jsx)(bn,{connections:t,displayByInstance:c}):null]})}function On({protocol:e}){let[t,n]=(0,G.useState)(!1),r=e.coverage,i=e.drift??[],a=(e.driftOverflow??0)+(e.driftTruncated??0);return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`h4`,{className:`oc-bridge-provider__sub`,children:[He(),i.length>0?(0,Z.jsx)(A,{variant:`destructive`,children:Qe({count:i.length})}):a>0?(0,Z.jsx)(A,{variant:`destructive`,children:Ge()}):(0,Z.jsx)(A,{variant:`secondary`,children:ke()})]}),(0,Z.jsxs)(`p`,{className:`oc-admin__hint`,children:[Ee({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:o({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)(At,{size:13,"aria-hidden":!0}),Xe({count:r.gapList.length})]}),t?(0,Z.jsx)(`ul`,{className:`oc-bridge-protocol__list`,role:`list`,children:r.gapList.map(e=>(0,Z.jsx)(`li`,{children:(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:e})},e))}):null]}):null]})}function kn({support:e,compatStatus:t,compatReachable:n,manifest:r,instanceRows:i,providerName:a}){return t===`loading`?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:C()}):t===`nodata`?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:oe()}):(0,Z.jsxs)(`div`,{className:`oc-compat`,children:[n?null:(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:d()}),r===null?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:pe()}):(0,Z.jsxs)(`div`,{className:`oc-compat__support`,children:[(0,Z.jsx)(`span`,{className:`oc-compat__label`,children:ye({provider:a})}),e&&e.range!==null?(0,Z.jsx)(`span`,{children:lt({min:e.range.min,max:e.range.maxValidated})}):(0,Z.jsx)(`span`,{children:E()}),e?(0,Z.jsx)(Mn,{versions:e.validatedVersions}):null]}),i.length===0?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:Te()}):(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)(A,{variant:e.state===`supported`?`secondary`:e.state===`beyond`||e.state===`defective`?`destructive`:`outline`,children:qt(e.state)})]},e.instanceName))})]})}function An({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)(jt,{children:[(0,Z.jsx)(Nt,{children:$e({instance:e.displayName??e.name})}),(0,Z.jsx)(It,{children:Ke()})]}),(0,Z.jsx)(jn,{instance:e,onClose:t})]})})}function $({label:e,result:t}){return t?t.checked?(0,Z.jsxs)(`p`,{className:`oc-bridge-config__check-row `+(t.ok?`oc-bridge-config__check-row--ok`:`oc-bridge-config__check-row--err`),children:[t.ok?(0,Z.jsx)(zt,{"aria-hidden":!0}):(0,Z.jsx)(B,{"aria-hidden":!0}),(0,Z.jsxs)(`span`,{children:[e,` — `,t.ok?Ie():t.detail]})]}):(0,Z.jsxs)(`p`,{className:`oc-bridge-config__check-row oc-bridge-config__check-row--skip`,children:[e,` — `,Ue()]}):null}function jn({instance:e,onClose:t}){let n=tt(T.admin.upsertInstanceConfig),a=i(T.bridge.validateMediaPaths),o=Tt(),s=Vt(e.config?.contentLocale,void 0),[c,l]=(0,G.useState)(()=>ht(e.config??{},s)),[d,f]=(0,G.useState)(!1),[p,m]=(0,G.useState)(!1),[h,g]=(0,G.useState)(null),_=c.inboundMediaMode===`shared-fs`,v=c.mediaMode===`shared-fs`,y=_||v;async function b(){m(!0),g(null);try{g(await a({instanceName:e.name,inboundMediaMode:c.inboundMediaMode,mediaMode:c.mediaMode}))}catch(e){o.error(ut(),e)}finally{m(!1)}}async function x(){f(!0);try{let r=e.config??{};await n({instanceId:e._id,config:_t(c,r,s)}),t()}catch(e){o.error(r(),e)}finally{f(!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)(D,{label:Re(),help:ce()}),(0,Z.jsxs)(N,{value:c.mediaMode,onValueChange:e=>l({...c,mediaMode:e}),children:[(0,Z.jsx)(k,{size:`sm`,className:`w-full`,children:(0,Z.jsx)(I,{})}),(0,Z.jsx)(P,{children:vt.map(e=>(0,Z.jsx)(j,{value:e,children:e},e))})]})]}),(0,Z.jsxs)(`label`,{className:`oc-field`,children:[(0,Z.jsx)(D,{label:Ze(),help:Se()}),(0,Z.jsxs)(N,{value:c.inboundMediaMode,onValueChange:e=>l({...c,inboundMediaMode:e}),children:[(0,Z.jsx)(k,{size:`sm`,className:`w-full`,children:(0,Z.jsx)(I,{})}),(0,Z.jsx)(P,{children:gt.map(e=>(0,Z.jsx)(j,{value:e,children:e},e))})]})]}),(0,Z.jsxs)(`label`,{className:`oc-field`,children:[(0,Z.jsx)(D,{label:We(),help:ee()}),(0,Z.jsx)(L,{type:`number`,min:1,max:4096,className:`w-full`,value:c.mediaMaxMb,onChange:e=>l({...c,mediaMaxMb:Math.trunc(Number(e.target.value)||0)})})]})]}),y&&(0,Z.jsxs)(`div`,{className:`oc-bridge-config__grid`,children:[_&&(0,Z.jsxs)(`label`,{className:`oc-field`,children:[(0,Z.jsx)(D,{label:me(),help:ot()}),(0,Z.jsx)(L,{className:`w-full`,spellCheck:!1,value:c.inboundAgentMount,onChange:e=>l({...c,inboundAgentMount:e.target.value})})]}),v&&(0,Z.jsxs)(`label`,{className:`oc-field`,children:[(0,Z.jsx)(D,{label:u(),help:fe()}),(0,Z.jsx)(L,{className:`w-full`,spellCheck:!1,value:c.outboundAgentMount,onChange:e=>l({...c,outboundAgentMount:e.target.value})})]})]}),(0,Z.jsxs)(`label`,{className:`oc-field--row`,children:[(0,Z.jsx)(Rt,{checked:c.rehydration,onCheckedChange:e=>l({...c,rehydration:e===!0})}),(0,Z.jsx)(D,{label:nt(),help:Je()})]}),y&&h!==null&&(0,Z.jsx)(`div`,{className:`oc-bridge-config__check`,children:h.reachable?!h.inbound&&!h.outbound?(0,Z.jsxs)(`p`,{className:`oc-bridge-config__check-row oc-bridge-config__check-row--err`,children:[(0,Z.jsx)(B,{"aria-hidden":!0}),Ne({reason:h.reason??`?`})]}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)($,{label:we(),result:h.inbound}),(0,Z.jsx)($,{label:Fe(),result:h.outbound}),(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:it()})]}):(0,Z.jsxs)(`p`,{className:`oc-bridge-config__check-row oc-bridge-config__check-row--err`,children:[(0,Z.jsx)(B,{"aria-hidden":!0}),qe()]})}),(0,Z.jsxs)(`div`,{className:`oc-bridge-config__actions`,children:[y&&(0,Z.jsxs)(O,{variant:`outline`,size:`sm`,onClick:()=>void b(),disabled:p,children:[p?(0,Z.jsx)(Ot,{className:`size-4 animate-spin`,"aria-hidden":!0}):null,p?De():ct()]}),(0,Z.jsx)(O,{size:`sm`,onClick:()=>void x(),disabled:d,children:Me()})]})]})})}function Mn({versions:e}){if(e.length===0)return null;let t=[...e].reverse();return(0,Z.jsxs)(kt,{children:[(0,Z.jsx)(wt,{asChild:!0,children:(0,Z.jsxs)(`button`,{type:`button`,className:`oc-compat__versions-btn`,children:[e.length===1?Oe():dt({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:at()}),(0,Z.jsx)(`div`,{className:`oc-compat__versions-list`,children:t.map(e=>(0,Z.jsx)(A,{variant:`secondary`,children:e},e))})]})]})}export{Tn as BridgeTab,An as InstanceConfigDialog};
@@ -0,0 +1 @@
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$H as r,$l as i,$m as a,Ap as o,Fp as s,Ip as c,Jm as l,Lp as u,Mp as d,Np as f,Pp as p,Ql as m,Rp as h,Uo as g,Ym as _,Zl as v,au as y,aw as b,eu as x,iu as S,jp as C,mm as w,nU as T,nu as E,ou as D,qH as O,ru as k,t as A,tU as j,th as M,tu as N}from"./api-D7og-4qA.js";import{t as P}from"./button-Ch1cRvCe.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-Dn5iHsqH.js";import{a as K}from"./compatView-BWt5iAM2.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=j(A.admin.upsertInstanceConfig),n=T(A.agents.listAgentsForInstance,{instanceName:e.name}),r=typeof e.config?.converterAgentId==`string`?e.config.converterAgentId:``,[i,a]=(0,q.useState)(r),[s,c]=(0,q.useState)(`idle`);(0,q.useEffect)(()=>{a(r),c(`idle`)},[e._id,r]);let l=`__none__`,u=i!==r;async function f(){c(`saving`);try{let n={...e.config??{}};i===``||i===l?delete n.converterAgentId:n.converterAgentId=i,await t({instanceId:e._id,config:n}),c(`done`)}catch{c(`error`)}}let p=n?.agents??[];return(0,X.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,X.jsx)(`span`,{className:`oc-cdefaults__label`,children:k()}),(0,X.jsx)(`p`,{className:`oc-admin__hint`,children:E()}),(0,X.jsxs)(`div`,{className:`oc-cdefaults__inline`,children:[(0,X.jsxs)(B,{value:i===``?l:i,onValueChange:e=>a(e===l?``:e),children:[(0,X.jsx)(F,{className:`oc-cdefaults__select`,"aria-label":k(),children:(0,X.jsx)(H,{placeholder:N()})}),(0,X.jsxs)(V,{children:[(0,X.jsx)(z,{value:l,children:N()}),p.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||s===`saving`,onClick:()=>void f(),children:s===`saving`?M():d()})]}),s===`done`?(0,X.jsx)(`p`,{className:`oc-admin__hint`,role:`status`,children:C()}):null,s===`error`?(0,X.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:o()}):null]})}function Q({instance:e}){let t=j(A.admin.upsertInstanceConfig),n=e.config?.curationEnabled===!0,r=typeof e.config?.curationBudgetChars==`number`?e.config.curationBudgetChars:null,[a,s]=(0,q.useState)(n),[c,l]=(0,q.useState)(r===null?``:String(r)),[u,f]=(0,q.useState)(`idle`);(0,q.useEffect)(()=>{s(n),l(r===null?``:String(r)),f(`idle`)},[e._id,n,r]);let p=c.trim(),h=p===``?null:/^\d+$/.test(p)?Number.parseInt(p,10):NaN,g=!a||h===null||Number.isInteger(h)&&h>=4e3&&h<=6e4,_=a!==n||(h??null)!==r;async function v(){f(`saving`);try{let n={...e.config??{}};n.curationEnabled=a,!a||h===null||Number.isNaN(h)?delete n.curationBudgetChars:n.curationBudgetChars=h,await t({instanceId:e._id,config:n}),f(`done`)}catch{f(`error`)}}return(0,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=>s(e===!0),"aria-label":S()}),(0,X.jsx)(`span`,{className:`oc-cdefaults__label`,children:S()})]}),(0,X.jsxs)(`div`,{className:`oc-cdefaults__inline`,children:[(0,X.jsx)(U,{type:`number`,min:4e3,max:6e4,step:1e3,placeholder:`20000`,value:c,onChange:e=>l(e.target.value),className:`oc-cdefaults__number`,"aria-invalid":!g,"aria-label":x(),disabled:!a}),(0,X.jsx)(P,{size:`sm`,disabled:!_||!g||u===`saving`,onClick:()=>void v(),children:u===`saving`?M():d()})]}),g?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:C()}):null,u===`error`?(0,X.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:o()}):null,(0,X.jsx)(`p`,{className:`oc-cdefaults__help`,children:m()})]})}function $({instance:e}){let t=j(A.admin.upsertInstanceConfig),n=typeof e.config?.summarizeThresholdChars==`number`?e.config.summarizeThresholdChars:null,[r,i]=(0,q.useState)(n===null?``:String(n)),[a,s]=(0,q.useState)(`idle`);(0,q.useEffect)(()=>{i(n===null?``:String(n)),s(`idle`)},[e._id,n]);let c=r.trim(),l=c===``?null:/^\d+$/.test(c)?Number.parseInt(c,10):NaN,u=l===null||Number.isInteger(l)&&l>=1e3&&l<=2e5,f=(l??null)!==n;async function p(){s(`saving`);try{let n={...e.config??{}};l===null?delete n.summarizeThresholdChars:n.summarizeThresholdChars=l,await t({instanceId:e._id,config:n}),s(`done`)}catch{s(`error`)}}return(0,X.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,X.jsx)(`span`,{className:`oc-cdefaults__label`,children:D()}),(0,X.jsxs)(`div`,{className:`oc-cdefaults__inline`,children:[(0,X.jsx)(U,{type:`number`,min:1e3,max:2e5,step:1e3,placeholder:`8000`,value:r,onChange:e=>i(e.target.value),className:`oc-cdefaults__number`,"aria-invalid":!u}),(0,X.jsx)(P,{size:`sm`,disabled:!f||!u||a===`saving`,onClick:()=>void p(),children:a===`saving`?M():d()})]}),u?null:(0,X.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:v()}),a===`done`?(0,X.jsx)(`p`,{className:`oc-admin__hint`,role:`status`,children:C()}):null,a===`error`?(0,X.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:o()}):null,(0,X.jsx)(`p`,{className:`oc-cdefaults__help`,children:y()})]})}function ee(){let e=r(A.agentFiles.getChatDefaults),[t,n]=(0,q.useState)({status:`loading`}),i=T(A.admin.listInstances,{}),[o,d]=(0,q.useState)(null);(0,q.useEffect)(()=>{!i||i.length===0||(!o||!i.some(e=>e.name===o))&&d(i[0].name)},[i,o]);let m=(i?.length??0)>1,v=i!==void 0&&i.length===0,y=T(A.compat.forInstance,o?{instanceName:o}:`skip`),x=o?I(y,`configDefaults`):`loading`,S=x===`loading`?null:x.blocked,C=(0,q.useMemo)(()=>m&&o?{instanceName:o}:{},[m,o]),E=(0,q.useRef)(0),D=(0,q.useCallback)(async()=>{let t=++E.current;n({status:`loading`});try{let r=Y(await e(C));if(E.current!==t)return;n({status:`done`,current:r})}catch{if(E.current!==t)return;n({status:`error`})}},[e,C]);(0,q.useEffect)(()=>{S===!1&&(m&&!o||D())},[D,S,m,o]);let k=t.status===`done`?t.current:null,j=(0,q.useMemo)(()=>J.map(e=>({id:e,label:R(e)})),[]),M=(0,q.useMemo)(()=>[{id:`fast`,label:_()},{id:`standard`,label:l()}],[]);return(0,X.jsxs)(`div`,{className:`oc-cdefaults`,children:[(0,X.jsx)(`p`,{className:`oc-admin__hint`,children:h()}),m&&o?(0,X.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,X.jsx)(`span`,{className:`oc-cdefaults__label`,children:w()}),(0,X.jsxs)(B,{value:o,onValueChange:e=>d(e),children:[(0,X.jsx)(F,{size:`sm`,"aria-label":w(),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,v?(0,X.jsx)(`p`,{className:`oc-admin__hint`,role:`status`,children:b()}):x===`loading`?(0,X.jsx)(`p`,{className:`oc-admin__hint`,children:O()}):x.blocked?(0,X.jsxs)(`p`,{className:`oc-compat__blocked`,role:`status`,children:[(0,X.jsx)(W,{size:14,"aria-hidden":!0}),` `,K(x.gatewayVersion,x.provider)]}):t.status===`loading`?(0,X.jsx)(`p`,{className:`oc-admin__hint`,children:O()}):t.status===`error`?(0,X.jsxs)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:[f(),` `,(0,X.jsx)(P,{variant:`outline`,size:`sm`,onClick:()=>void D(),children:a()})]}):(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,X.jsx)(`span`,{className:`oc-cdefaults__label`,children:u()}),(0,X.jsx)(L,{field:`thinkingLevel`,options:j,value:k?.thinkingDefault??null,onChange:()=>{},disabled:!0,ariaLabel:u()}),(0,X.jsx)(`p`,{className:`oc-cdefaults__help`,children:c()})]}),(0,X.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,X.jsx)(`span`,{className:`oc-cdefaults__label`,children:s()}),(0,X.jsx)(L,{field:`fastMode`,options:M,value:k===null||k.fastModeDefault===null?null:k.fastModeDefault?`fast`:`standard`,onChange:()=>{},disabled:!0,ariaLabel:s()}),(0,X.jsx)(`p`,{className:`oc-cdefaults__help`,children:p()})]}),(0,X.jsx)(`p`,{className:`oc-cdefaults__note`,children:g()})]}),(()=>{let e=i?.find(e=>e.name===(o??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{_g as r,bg as i,gg as a,hg as o,vg as s,xg as c,yg as l}from"./api-B1lq0pb-.js";import{t as u}from"./chevrons-up-down-Du-SfIms.js";import{t as d}from"./button-Ds98Pj53.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-Bkfx3eIe.js";import{a as C,i as w,n as T,o as E,r as D,t as O}from"./table-B15ESmxP.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=c(),bulkActions:F,emptyHint:I=i(),isExpanded:L,renderExpanded:R}){let[z,B]=(0,k.useState)(new Set),[V,H]=(0,k.useState)(null),U=t??[],W=V?n[V.index]:void 0,G=V&&W?.sort?j(U,W.sort,V.dir):U;function K(e){H(t=>!t||t.index!==e?{index:e,dir:`asc`}:t.dir===`asc`?{index:e,dir:`desc`}:null)}let q=+!!F+n.length+ +!!A,J=U.length>0&&z.size===U.length,Y=z.size>0&&!J;function X(){B(J?new Set:new Set(U.map(e=>e._id)))}function Z(e){B(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})}return(0,M.jsxs)(`div`,{className:`oc-dt`,children:[(0,M.jsxs)(`div`,{className:`oc-dt__bar`,children:[(0,M.jsx)(`h2`,{className:`oc-dt__title`,children:e}),(0,M.jsxs)(`div`,{className:`oc-dt__bar-actions`,children:[z.size>0&&F?F.map(e=>(0,M.jsxs)(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:l()}):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":s(),checked:J?!0:Y?`indeterminate`:!1,onCheckedChange:X})}):null,n.map((e,t)=>{let n=V?.index===t;return e.sort?(0,M.jsx)(w,{className:e.className,"aria-sort":n?V.dir===`asc`?`ascending`:`descending`:`none`,children:(0,M.jsxs)(`button`,{type:`button`,className:`oc-dt__sort`,onClick:()=>K(t),"aria-label":o({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)??[],i=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":r(),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":a(),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]}),i&&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{cv as r,dv as i,fv as a,lv as o,mv as s,pv as c,uv as l}from"./api-D7og-4qA.js";import{t as u}from"./chevrons-up-down-DIadyetY.js";import{t as d}from"./button-Ch1cRvCe.js";import{Bn as f,Fn as p,It as m,Lt as h,Mt as g,Nt as _,Pt as v,Un as y,_n as b,dn as x,ut as S}from"./index-Dn5iHsqH.js";import{a as C,i as w,n as T,o as E,r as D,t as O}from"./table-CKpkQP4H.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=s(),bulkActions:F,emptyHint:I=c(),isExpanded:L,renderExpanded:R}){let[z,B]=(0,k.useState)(new Set),[V,H]=(0,k.useState)(null),U=t??[],W=V?n[V.index]:void 0,G=V&&W?.sort?j(U,W.sort,V.dir):U;function K(e){H(t=>!t||t.index!==e?{index:e,dir:`asc`}:t.dir===`asc`?{index:e,dir:`desc`}:null)}let q=+!!F+n.length+ +!!A,J=U.length>0&&z.size===U.length,Y=z.size>0&&!J;function X(){B(J?new Set:new Set(U.map(e=>e._id)))}function Z(e){B(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})}return(0,M.jsxs)(`div`,{className:`oc-dt`,children:[(0,M.jsxs)(`div`,{className:`oc-dt__bar`,children:[(0,M.jsx)(`h2`,{className:`oc-dt__title`,children:e}),(0,M.jsxs)(`div`,{className:`oc-dt__bar-actions`,children:[z.size>0&&F?F.map(e=>(0,M.jsxs)(d,{size:`sm`,variant:e.variant===`destructive`?`destructive`:`outline`,onClick:()=>{e.onSelect([...z]),B(new Set)},children:[e.variant===`destructive`?(0,M.jsx)(x,{}):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)(S,{"aria-label":i(),checked:J?!0:Y?`indeterminate`:!1,onCheckedChange:X})}):null,n.map((e,t)=>{let n=V?.index===t;return e.sort?(0,M.jsx)(w,{className:e.className,"aria-sort":n?V.dir===`asc`?`ascending`:`descending`:`none`,children:(0,M.jsxs)(`button`,{type:`button`,className:`oc-dt__sort`,onClick:()=>K(t),"aria-label":r({column:e.header}),children:[e.header,n?V.dir===`asc`?(0,M.jsx)(f,{className:`oc-dt__sort-icon`,"aria-hidden":!0}):(0,M.jsx)(y,{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)(S,{"aria-label":l(),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)(g,{children:[(0,M.jsx)(h,{asChild:!0,children:(0,M.jsx)(d,{variant:`ghost`,size:`icon-sm`,"aria-label":o(),className:`opacity-0 transition-opacity group-hover/row:opacity-100 group-focus-within/row:opacity-100 aria-expanded:opacity-100`,children:(0,M.jsx)(p,{})})}),(0,M.jsx)(_,{align:`end`,children:t.map((t,n)=>(0,M.jsxs)(`div`,{children:[t.variant===`destructive`&&n>0?(0,M.jsx)(m,{}):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-Bkfx3eIe.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-Dn5iHsqH.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{$A as r,AA as i,BA as a,Cj as o,DA as s,Dj as c,EA as l,Ej as u,FA as d,GA as f,HA as p,IA as ee,JA as te,KA as m,LA as h,MA as g,NA as ne,OA as re,Oj as _,PA as ie,QA as ae,RA as oe,Sj as v,Tj as y,UA as b,VA as x,WA as S,XA as C,YA as w,ZA as T,_j as E,aj as D,bj as O,cj as k,dj as A,ej as j,fj as M,fl as N,gj as P,hj as F,ij as I,jA as L,kA as R,lj as z,mj as B,nU as V,nj as se,oj as H,pj as U,qA as W,rj as G,sj as K,t as q,tU as J,tj as ce,uj as le,ul as ue,vj as de,wj as fe,xj as pe,yj as me,zA as he}from"./api-D7og-4qA.js";import{t as ge}from"./button-Ch1cRvCe.js";import{U as _e,ct as Y}from"./index-Dn5iHsqH.js";import{t as ve}from"./DataTableShell-BzQgqnDl.js";var X=t(e(),1),Z=n(),ye={altered_words:()=>_(),incorrect:()=>c(),incoherence:()=>u(),formatting:()=>y(),latency:()=>fe(),api_error:()=>o(),other:()=>v()},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:O()}):e===!1?(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-warn`,children:me()}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill`,children:`—`}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill`,children:pe()})}function be({data:e,reference:t,closeReason:n}){let i=e.snapshot,a=J(q.feedback.respondToFeedback),[o,s]=(0,X.useState)(e.thread),[c,l]=(0,X.useState)(``),[u,d]=(0,X.useState)(!1);async function f(){let t=c.trim();if(!(!t||u)){d(!0);try{await a({feedbackId:e._id,text:t}),s(e=>[...e,{authorRole:`admin`,text:t,at:Date.now()}]),l(``)}finally{d(!1)}}}let p=[];try{p=i.contextJson?JSON.parse(i.contextJson):[]}catch{p=[]}return(0,Z.jsxs)(`div`,{className:`oc-fbadmin__detail`,children:[(0,Z.jsxs)(`div`,{className:`oc-fbadmin__row`,children:[(0,Z.jsx)($,{matches:i.displayedMatchesStored,sourceWasOpen:i.clientInfo?.sourceWasOpen??!1}),(0,Z.jsxs)(`span`,{className:`oc-fbadmin__meta`,children:[Q(e.category),` · `,i.messageRole,i.isRegeneration?` · ${de()}`:``,i.openclawModel?` · ${i.openclawModel}`:``,i.openclawRuntime?` (${i.openclawRuntime})`:``]}),t?(0,Z.jsx)(`code`,{className:`oc-fbadmin__ref`,style:{userSelect:`all`,marginLeft:`auto`},title:m(),children:t}):null]}),e.comment?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:E()}),(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:g()}),(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:P()}),o.length>0?(0,Z.jsx)(`div`,{className:`oc-fbadmin__thread`,children:o.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`?F():e.authorRole===`agent`?e.authorLabel??N():B()}),(0,Z.jsx)(`span`,{className:`oc-notif__msg-text`,children:e.text})]},t))}):(0,Z.jsx)(`p`,{className:`oc-fbadmin__meta`,children:U()}),(0,Z.jsx)(`textarea`,{className:`oc-feedback__textarea`,placeholder:M(),value:c,maxLength:2e3,rows:3,onChange:e=>l(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 f(),disabled:!c.trim()||u,children:u?A():le()})})]}),(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:z()}),(0,Z.jsx)(`pre`,{className:`oc-msg__source-pre`,children:i.messageText||k()})]}),i.clientInfo?.sourceWasOpen&&i.displayedText!==void 0?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:K()}),(0,Z.jsx)(`pre`,{className:`oc-msg__source-pre`,children:i.displayedText||k()})]}):null,i.promptText?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:H()}),(0,Z.jsx)(`pre`,{className:`oc-msg__source-pre`,children:i.promptText})]}):null,p.length>0?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:D({count:i.contextCount??p.length,truncated:i.contextTruncated?I():``})}),(0,Z.jsx)(`div`,{className:`oc-fbadmin__ctx`,children:p.map((e,t)=>(0,Z.jsxs)(`div`,{className:`oc-fbadmin__ctx-turn`,children:[(0,Z.jsx)(`span`,{className:`oc-fbadmin__ctx-role`,children:e.role}),(0,Z.jsx)(`span`,{className:`oc-fbadmin__ctx-text`,children:e.text})]},t))})]}):null,i.outboxAvailable?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:G()}),(0,Z.jsxs)(`pre`,{className:`oc-msg__source-pre`,children:[i.outboxText??``,i.outboxStatus?`\n[status: ${i.outboxStatus}]`:``]})]}):null,i.clientInfo?.extensionsDetected&&i.clientInfo.extensionsDetected.length>0?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:se()}),(0,Z.jsx)(`div`,{className:`oc-fbadmin__row`,children:i.clientInfo.extensionsDetected.map(e=>(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-warn`,children:e},e))})]}):null,(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:ce()}),(0,Z.jsxs)(`p`,{className:`oc-fbadmin__env`,children:[[i.clientInfo?.language,i.clientInfo?.timezone,i.clientInfo?.theme?j({theme:i.clientInfo.theme}):null,i.runId?`run ${i.runId.slice(0,12)}…`:null].filter(Boolean).join(` · `)||`—`,i.clientInfo?.plugins&&i.clientInfo.plugins.length>0?(0,Z.jsxs)(`span`,{className:`oc-fbadmin__plugins`,children:[r(),` `,i.clientInfo.plugins.join(`, `),(0,Z.jsxs)(`span`,{className:`oc-fbadmin__note`,children:[` `,ae()]})]}):null,i.clientInfo?.userAgent?(0,Z.jsx)(`span`,{className:`oc-fbadmin__ua`,children:i.clientInfo.userAgent}):null]})]})]})}function xe(){let e=V(q.feedback.listForAdmin,{}),t=J(q.feedback.readSnapshot),n=J(q.feedback.deleteFeedback),r=_e(),[o,c]=(0,X.useState)(null),[u,m]=(0,X.useState)({});async function g(e){if(o===e._id){c(null);return}if(!u[e._id]){let n=await t({feedbackId:e._id});m(t=>({...t,[e._id]:n}))}c(e._id)}async function _(e){await r({title:re(),description:s(),confirmLabel:l(),destructive:!0})&&(await n({feedbackId:e._id}),o===e._id&&c(null))}return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`p`,{className:`oc-admin__hint`,children:[T(),` `,(0,Z.jsx)(`strong`,{children:C()}),` `,w()]}),(0,Z.jsx)(ve,{title:te(),rows:e,emptyHint:W(),isExpanded:e=>o===e._id&&!!u[e._id],renderExpanded:e=>u[e._id]?(0,Z.jsx)(be,{data:u[e._id],reference:e.reference,closeReason:e.userCloseReason}):null,columns:[{header:f(),cell:e=>Y(e.at),sort:e=>e.at},{header:S(),cell:e=>Q(e.category),sort:e=>Q(e.category)},{header:b(),cell:e=>e.messageRole===`user`?p():x(),sort:e=>e.messageRole},{header:a(),cell:e=>(e.reporterEmail||e.reporterName||`—`)+(e.impersonated&&e.realOperatorEmail?` ${he({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:h(),cell:e=>e.hasComment?`✎`:`—`,sort:e=>+!!e.hasComment},{header:ee(),cell:e=>e.userClosedAt==null?e.resolvedAt==null?e.answered?(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-ok`,children:d()}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill`,children:ie()}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-ok`,title:e.resolvedBy??void 0,children:ue()}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-closed`,children:ne()}),sort:e=>e.userClosedAt==null?e.resolvedAt==null?+!!e.answered:2:3}],rowActions:e=>[{label:o===e._id?L():i(),onSelect:()=>void g(e)},{label:R(),onSelect:()=>void _(e),variant:`destructive`}]})]})}export{xe as FeedbacksTab};
@@ -1 +1 @@
1
- import{r as e}from"./bundle-mjs-C73ZY4La.js";import{D as t,hV as n}from"./api-B1lq0pb-.js";import{I as r,L as i,R as a,Xt as o,Yt as s,z as c}from"./index-Bkfx3eIe.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,lU as n}from"./api-D7og-4qA.js";import{I as r,L as i,R as a,Xt as o,Yt as s,z as c}from"./index-Dn5iHsqH.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{$V as r,BV as i,FV as a,GV as ee,HV as te,IV as ne,JV as re,KV as ie,LV as o,NV as s,PV as c,QV as l,RV as u,UV as d,VV as f,WV as p,XP as ae,XV as oe,YH as se,YV as ce,ZV as m,aH as le,cH as ue,dH as h,eH as g,fH as de,gl as _,hl as fe,iH as pe,lH as me,mH as he,nH as v,nU as ge,oH as _e,pH as ve,qH as ye,qV as be,rH as y,sH as b,t as x,tH as S,tU as C,uH as w,zV as T}from"./api-D7og-4qA.js";import{t as E}from"./button-Ch1cRvCe.js";import{$ as D,Ct as O,Dt as k,Et as A,Fn as j,In as M,Lt as N,Mt as xe,Nt as Se,Pt as P,Q as F,St as Ce,Tt as we,X as I,Z as L,bt as Te,dn as Ee,et as R,gn as De,ut as Oe,vt as ke,wt as Ae,xt as je,yt as Me}from"./index-Dn5iHsqH.js";import{a as Ne,i as z,n as Pe,o as B,r as V,t as Fe}from"./table-CKpkQP4H.js";var H=t(e(),1),U=n(),W=`all`;function G(e){switch(e){case`image`:return y();case`audio`:return v();case`video`:return S();case`pdf`:return g();case`document`:return r();case`archive`:return l();default:return m()}}function K(){let[e,t]=(0,H.useState)(W),[n,r]=(0,H.useState)(W),[l,m]=(0,H.useState)(W),[g,v]=(0,H.useState)(W),[y,S]=(0,H.useState)(!1),[K,q]=(0,H.useState)(null),J=C(x.files.softDelete),Y=k();function Ie(){t(W),r(W),m(W),v(W)}async function Le(){let e=K;if(q(null),e)try{await J({fileId:e.id}),Y.success(i())}catch(e){Y.error(T(),e)}}let X=ge(x.files.listMine,{direction:e===W?void 0:e,chatId:n===W?void 0:n,instanceName:l===W?void 0:l,category:g===W?void 0:g,includeAutoGenerated:y||void 0}),Re=(0,H.useMemo)(()=>new Intl.DateTimeFormat(se(),{dateStyle:`medium`,timeStyle:`short`}),[]);if(X===void 0)return(0,U.jsx)(`p`,{className:`oc-admin__hint`,children:ye()});let{files:Z,facets:Q,truncated:ze,cap:Be}=X,$=e!==W||n!==W||l!==W||g!==W;return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`p`,{className:`oc-admin__hint`,children:he()}),(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":ve(),children:(0,U.jsx)(R,{})}),(0,U.jsxs)(L,{children:[(0,U.jsx)(F,{value:W,children:de()}),(0,U.jsx)(F,{value:`inbound`,children:h()}),(0,U.jsx)(F,{value:`outbound`,children:w()})]})]}),(0,U.jsxs)(I,{value:n,onValueChange:r,children:[(0,U.jsx)(D,{size:`sm`,"aria-label":me(),children:(0,U.jsx)(R,{})}),(0,U.jsxs)(L,{children:[(0,U.jsx)(F,{value:W,children:ue()}),Q.chats.map(e=>(0,U.jsx)(F,{value:e.id,children:e.title},e.id))]})]}),Q.multiProvider?(0,U.jsxs)(I,{value:l,onValueChange:m,children:[(0,U.jsx)(D,{size:`sm`,"aria-label":b(),children:(0,U.jsx)(R,{})}),(0,U.jsxs)(L,{children:[(0,U.jsx)(F,{value:W,children:_e()}),Q.instances.map(e=>(0,U.jsx)(F,{value:e,children:e},e))]})]}):null,(0,U.jsxs)(I,{value:g,onValueChange:v,children:[(0,U.jsx)(D,{size:`sm`,"aria-label":le(),children:(0,U.jsx)(R,{})}),(0,U.jsxs)(L,{children:[(0,U.jsx)(F,{value:W,children:pe()}),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:y,onCheckedChange:e=>S(e===!0),"aria-label":_()}),(0,U.jsx)(`span`,{children:_()})]}),$?(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}),d()]}):null]}),Z.length===0?(0,U.jsx)(`p`,{className:`oc-admin__hint`,children:$?c():a()}):(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:oe()}),(0,U.jsx)(z,{children:ce()}),(0,U.jsx)(z,{children:re()}),(0,U.jsx)(z,{children:be()}),(0,U.jsx)(z,{children:ie()}),(0,U.jsx)(z,{className:`text-right`,children:ee()})]})}),(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:fe()}):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`?h():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)(xe,{children:[(0,U.jsx)(N,{asChild:!0,children:(0,U.jsx)(E,{variant:`ghost`,size:`icon`,"aria-label":te(),children:(0,U.jsx)(j,{size:16})})}),(0,U.jsxs)(Se,{align:`end`,children:[e.url?(0,U.jsx)(P,{asChild:!0,children:(0,U.jsxs)(`a`,{href:e.url,download:e.filename,target:`_blank`,rel:`noopener noreferrer`,children:[(0,U.jsx)(M,{size:14}),p()]})}):(0,U.jsxs)(P,{disabled:!0,children:[(0,U.jsx)(M,{size:14}),ne()]}),(0,U.jsxs)(P,{variant:`destructive`,onSelect:()=>q({id:e._id,filename:e.filename}),children:[(0,U.jsx)(Ee,{size:14}),f()]})]})]})})]},e._id))})]}),ze?(0,U.jsx)(`p`,{className:`oc-admin__hint`,style:{marginTop:8},children:s({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:u()}),(0,U.jsx)(Ce,{children:o()})]}),(0,U.jsxs)(O,{children:[(0,U.jsx)(Te,{children:ae()}),(0,U.jsx)(Me,{onClick:()=>void Le(),children:f()})]})]})})]})}export{K as FilesTab};
@@ -1 +1 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Cg as r,Sg as i}from"./api-B1lq0pb-.js";import{t as a}from"./button-Ds98Pj53.js";import{hn as o,jt as s,mn as c}from"./index-Bkfx3eIe.js";import{t as l}from"./TimeRangePicker-B8MRcEsu.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{gv as r,hv as i}from"./api-D7og-4qA.js";import{t as a}from"./button-Ch1cRvCe.js";import{gn as o,hn as s,jt as c}from"./index-Dn5iHsqH.js";import{t as l}from"./TimeRangePicker-DIGmrYqi.js";var u=t(e(),1),d=n(),f=250;function p({q:e,onQChange:t,searchPlaceholder:n=r(),children:p,timeRange:m,onTimeRangeChange:h,onReset:g,canReset:_=!0}){let[v,y]=(0,u.useState)(e);(0,u.useEffect)(()=>{y(e)},[e]);let b=(0,u.useRef)(null);function x(e){y(e),b.current!==null&&window.clearTimeout(b.current),b.current=window.setTimeout(()=>t(e),f)}(0,u.useEffect)(()=>()=>{b.current!==null&&window.clearTimeout(b.current)},[]);function S(){b.current!==null&&window.clearTimeout(b.current),g()}return(0,d.jsxs)(`div`,{className:`oc-filterbar`,children:[(0,d.jsxs)(`div`,{className:`oc-filterbar__search`,children:[(0,d.jsx)(s,{className:`oc-filterbar__search-icon`,"aria-hidden":!0}),(0,d.jsx)(c,{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};
@@ -0,0 +1 @@
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$h as r,Ah as i,Bh as a,Ch as o,D as s,Dh as c,Eh as l,Fh as u,Gh as d,Hh as f,Ih as p,Jh as m,Kh as h,Lh as g,Mh as _,Nh as v,Oh as y,Ph as b,Qh as x,Rh as S,Sg as C,Sh as w,Th as T,Uh as E,Vh as D,Wh as ee,Xh as te,Yh as ne,Zh as re,_g as O,_h as k,ag as ie,bg as A,bh as ae,cg as j,dg as M,eg as oe,fg as se,gg as ce,gh as N,hg as le,hh as P,ig as ue,jh as de,kh as fe,lg as pe,mg as me,mh as he,nU as F,ng as ge,og as _e,pg as ve,ph as ye,qh as I,rg as be,sg as xe,t as L,tU as R,tg as Se,ug as Ce,vg as we,vh as Te,wh as Ee,xg as De,xh as Oe,yg as ke,yh as Ae,zh as je}from"./api-D7og-4qA.js";import{t as Me}from"./x-bVQAMbfU.js";import{i as z,n as B,r as Ne,t as Pe}from"./tabs-CnkwmnFT.js";import{t as V}from"./button-Ch1cRvCe.js";import{$ as Fe,Dt as H,Et as U,Hn as Ie,Q as Le,U as Re,Vn as ze,X as Be,Z as Ve,_ as He,at as Ue,cn as We,et as Ge,fn as W,jt as G,mn as K,nt as Ke,ot as qe,pn as q,q as Je,rt as Ye,tt as Xe,ut as J}from"./index-Dn5iHsqH.js";import{t as Ze}from"./FilterBar-CGSxi-Sq.js";import{t as Qe}from"./DataTableShell-BzQgqnDl.js";import{t as Y}from"./DetailChips-CDv5mOES.js";var $e=s(`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`}]]),X=t(e(),1);function et(e,t,n){let r=t.trim().toLowerCase();return[...r?e.filter(e=>[e.email,e.name,e.canonical].some(e=>e!=null&&e.toLowerCase().includes(r))):e.slice()].sort((e,t)=>!n.has(e.userId)-+!n.has(t.userId))}function tt(e,t){let n=e.filter(e=>e.source===`discovered`),r=t.trim().toLowerCase();return r?n.filter(e=>(e.displayName??e.agentId).toLowerCase().includes(r)||e.agentId.toLowerCase().includes(r)):n}function nt(e){let t=e.name?.trim()??``,n=e.email?.trim()??``,r=e.canonical?.trim()||`u-${e.userId.slice(0,8)}`;return t?{primary:t,secondary:n||`@${r}`}:n?{primary:n,secondary:null}:{primary:`@${r}`,secondary:null}}function rt(e){switch(e){case`admin`:return E();case`user`:return f();case`pending`:return D();default:return e}}function it(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 at(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 Z=n(),Q={name:``,description:``};function ot(){let e=F(L.groups.listGroups,{}),t=F(L.me.getMe,{host:Je})?.role===`admin`,n=R(L.groups.createGroup),r=R(L.groups.updateGroup),i=R(L.groups.deleteGroup),a=Re(),o=H(),[s,c]=(0,X.useState)(!1),[l,u]=(0,X.useState)(null),[d,f]=(0,X.useState)(Q),[p,m]=(0,X.useState)(null),[h,g]=(0,X.useState)(``),_=(0,X.useMemo)(()=>{if(!e)return e;let t=h.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,h]);function v(){u(null),f(Q),c(!0)}function y(e){u(e),f({name:e.name,description:e.description??``}),c(!0)}async function b(){try{l?await r({groupId:l._id,name:d.name,description:d.description}):await n({name:d.name,description:d.description||void 0}),f(Q),u(null),c(!1)}catch(e){o.error(N(),e)}}async function x(e){if(await a({title:be({name:e.name}),description:ge(),confirmWord:e.name,confirmLabel:Se(),cancelLabel:pe(),destructive:!0}))try{await i({groupId:e._id})}catch(e){o.error(P(),e)}}return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:De()}),(0,Z.jsx)(Ze,{q:h,onQChange:g,onReset:()=>g(``),canReset:h!==``,searchPlaceholder:me()}),(0,Z.jsx)(Qe,{title:C(),rows:_,addLabel:A(),onAdd:t?v:void 0,emptyHint:ke(),columns:[{header:we(),cell:e=>e.name,sort:e=>e.name},{header:O(),cell:e=>(0,Z.jsx)(Y,{icon:(0,Z.jsx)(We,{size:12,"aria-hidden":!0}),total:e.memberCount,items:e.members.map(e=>({label:e.label,marker:e.manager?(0,Z.jsx)(q,{size:11,"aria-hidden":!0}):null,highlight:e.manager}))}),sort:e=>e.memberCount},{header:ce(),cell:e=>(0,Z.jsx)(Y,{icon:(0,Z.jsx)(K,{size:12,"aria-hidden":!0}),total:e.agentCount,items:e.agents.map(e=>({label:e}))}),sort:e=>e.agentCount},{header:le(),cell:e=>(0,Z.jsx)(Y,{icon:(0,Z.jsx)($e,{size:12,"aria-hidden":!0}),total:e.chartCount,items:e.charts.map(e=>({label:e.name,marker:e.isDefault?(0,Z.jsx)(W,{size:11,fill:`currentColor`,"aria-hidden":!0}):null,highlight:e.isDefault}))}),sort:e=>e.chartCount}],rowActions:e=>[{label:ve(),onSelect:()=>m({groupId:e._id,name:e.name})},...t?[{label:se(),onSelect:()=>y(e)},{label:M(),variant:`destructive`,onSelect:()=>void x(e)}]:[]]}),(0,Z.jsx)(He,{open:s,onOpenChange:c,title:l?xe():j(),description:_e(),canSubmit:!!d.name.trim(),onSubmit:b,submitLabel:Ce(),children:(0,Z.jsxs)(`div`,{className:`oc-form`,children:[(0,Z.jsxs)(`label`,{className:`oc-field`,children:[(0,Z.jsx)(`span`,{className:`oc-field__label`,children:ie()}),(0,Z.jsx)(G,{value:d.name,onChange:e=>f({...d,name:e.target.value})})]}),(0,Z.jsxs)(`label`,{className:`oc-field`,children:[(0,Z.jsx)(`span`,{className:`oc-field__label`,children:ue()}),(0,Z.jsx)(G,{value:d.description,onChange:e=>f({...d,description:e.target.value})})]})]})}),(0,Z.jsx)(ct,{groupId:p?.groupId??null,groupName:p?.name??``,open:p!==null,onOpenChange:e=>{e||m(null)}})]})}var st=8;function $({page:e,pageCount:t,onPage:n}){return t<=1?null:(0,Z.jsxs)(`div`,{className:`oc-access__pager`,children:[(0,Z.jsxs)(V,{type:`button`,variant:`ghost`,size:`sm`,disabled:e<=1,onClick:()=>n(e-1),children:[(0,Z.jsx)(Ie,{size:14,"aria-hidden":!0}),h()]}),(0,Z.jsxs)(`span`,{className:`oc-access__pageinfo`,"aria-label":ee({page:e,pages:t}),children:[e,` / `,t]}),(0,Z.jsxs)(V,{type:`button`,variant:`ghost`,size:`sm`,disabled:e>=t,onClick:()=>n(e+1),children:[d(),(0,Z.jsx)(ze,{size:14,"aria-hidden":!0})]})]})}function ct({groupId:e,groupName:t,open:n,onOpenChange:i}){let o=F(L.groups.getGroup,n&&e?{groupId:e}:`skip`),s=F(L.groups.listAssignableInstances,n?{}:`skip`),c=F(L.groups.listAssignableUsers,n?{}:`skip`),l=R(L.groups.addMember),d=R(L.groups.removeMember),f=R(L.groups.bulkSetMembers),h=R(L.groups.setGroupManager),g=H(),[_,v]=(0,X.useState)(``),[y,b]=(0,X.useState)(``),[C,w]=(0,X.useState)(`members`),[T,E]=(0,X.useState)(1),[D,ee]=(0,X.useState)(new Set),O=(0,X.useRef)(null),k=(0,X.useMemo)(()=>new Set((o?.members??[]).map(e=>e.userId)),[o]),ie=(0,X.useMemo)(()=>new Set((o?.members??[]).filter(e=>e.manager).map(e=>e.userId)),[o]),A=o?.viewerIsAdmin===!0,j=(0,X.useMemo)(()=>new Set((o?.agents??[]).map(e=>`${e.instanceName}/${e.agentId}`)),[o]);(0,X.useEffect)(()=>{v(``),b(``),w(`members`),E(1),O.current=null},[n,e]),(0,X.useEffect)(()=>{E(1)},[_]),(0,X.useEffect)(()=>{n&&o&&e&&O.current!==e&&(O.current=e,ee(new Set((o.members??[]).map(e=>e.userId))))},[n,o,e]);let M=(0,X.useMemo)(()=>c?et(c,_,D):[],[c,_,D]);async function se(t,n){if(e)try{n?await d({groupId:e,userId:t}):await l({groupId:e,userId:t})}catch(e){g.error(he(),e)}}async function ce(t,n){if(e)try{await h({groupId:e,userId:t,manager:!n})}catch(e){g.error(Te(),e)}}let N=it(M,e=>k.has(e.userId)),le=M.filter(e=>k.has(e.userId)).length,P=at(M,T,st);async function ue(){if(!e||M.length===0)return;let t=M.map(e=>e.userId);try{await f({groupId:e,userIds:t,member:N!==`all`})}catch(e){g.error(he(),e)}}return(0,Z.jsx)(Xe,{open:n,onOpenChange:i,children:(0,Z.jsxs)(Ke,{className:`oc-access`,children:[(0,Z.jsxs)(Ue,{children:[(0,Z.jsx)(qe,{children:oe({name:t})}),(0,Z.jsx)(Ye,{children:r()})]}),(0,Z.jsxs)(Pe,{value:C,onValueChange:w,className:`oc-access__tabs`,children:[(0,Z.jsxs)(Ne,{className:`w-full`,children:[(0,Z.jsxs)(z,{value:`members`,className:`flex-1 gap-1.5`,children:[(0,Z.jsx)(We,{size:13,"aria-hidden":!0}),x(),o?(0,Z.jsx)(U,{variant:`secondary`,className:`oc-access__tabcount`,children:k.size}):null]}),(0,Z.jsxs)(z,{value:`agents`,className:`flex-1 gap-1.5`,children:[(0,Z.jsx)(K,{size:13,"aria-hidden":!0}),te(),o?(0,Z.jsx)(U,{variant:`secondary`,className:`oc-access__tabcount`,children:j.size}):null]}),(0,Z.jsxs)(z,{value:`charts`,className:`flex-1 gap-1.5`,children:[(0,Z.jsx)($e,{size:13,"aria-hidden":!0}),fe(),o?(0,Z.jsx)(U,{variant:`secondary`,className:`oc-access__tabcount`,children:o.chartCount}):null]})]}),(0,Z.jsx)(B,{value:`members`,children:c===void 0||o===void 0?(0,Z.jsx)(`p`,{className:`oc-access__hint`,children:S()}):c.length===0?(0,Z.jsx)(`p`,{className:`oc-access__hint`,children:p()}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(G,{value:_,onChange:e=>v(e.target.value),placeholder:re(),className:`oc-access__search`}),M.length===0?(0,Z.jsx)(`p`,{className:`oc-access__hint`,children:m()}):(0,Z.jsxs)(Z.Fragment,{children:[M.length>1?(0,Z.jsxs)(`div`,{className:`oc-access__row oc-access__selectall`,children:[(0,Z.jsx)(J,{checked:N===`all`?!0:N===`some`?`indeterminate`:!1,onCheckedChange:()=>void ue(),"aria-label":I()}),(0,Z.jsx)(`span`,{className:`oc-access__label`,children:I()}),(0,Z.jsxs)(U,{variant:`outline`,className:`oc-access__count`,children:[le,` / `,M.length]})]}):null,(0,Z.jsx)(`div`,{className:`oc-access__list`,children:P.pageItems.map(e=>{let t=k.has(e.userId),n=nt(e),r=ie.has(e.userId);return(0,Z.jsxs)(`div`,{className:`oc-access__row`,children:[(0,Z.jsx)(J,{checked:t,onCheckedChange:()=>void se(e.userId,t),"aria-label":a({user:n.primary})}),(0,Z.jsxs)(`span`,{className:`oc-access__who`,children:[(0,Z.jsx)(`span`,{className:`oc-access__label`,title:n.primary,children:n.primary}),n.secondary?(0,Z.jsx)(`span`,{className:`oc-access__sub`,title:n.secondary,children:n.secondary}):null]}),(0,Z.jsx)(U,{variant:`outline`,className:`oc-access__role`,children:rt(e.role)}),(0,Z.jsx)(`span`,{className:`oc-access__mgrslot`,children:t&&A?(0,Z.jsx)(V,{type:`button`,variant:`ghost`,size:`icon`,className:`shrink-0 oc-access__mgr${r?` oc-access__mgr--on`:``}`,"aria-pressed":r,"aria-label":r?Ae():ae(),title:r?Ae():ae(),onClick:()=>void ce(e.userId,r),children:(0,Z.jsx)(q,{size:15,"aria-hidden":!0})}):t&&r?(0,Z.jsx)(`span`,{className:`oc-access__mgr oc-access__mgr--on`,role:`img`,"aria-label":Oe(),title:Oe(),children:(0,Z.jsx)(q,{size:15,"aria-hidden":!0})}):null})]},e._id)})}),(0,Z.jsx)($,{page:P.page,pageCount:P.pageCount,onPage:E})]})]})}),(0,Z.jsx)(B,{value:`agents`,children:s===void 0?(0,Z.jsx)(`p`,{className:`oc-access__hint`,children:S()}):s.length===0?(0,Z.jsx)(`p`,{className:`oc-access__hint`,children:u()}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(G,{value:y,onChange:e=>b(e.target.value),placeholder:ne(),className:`oc-access__search`}),(0,Z.jsx)(`div`,{className:`oc-access__list`,children:s.map(t=>(0,Z.jsx)(lt,{groupId:e,instanceName:t.name,kind:t.kind??`openclaw`,assigned:j,query:y},`${e}-${t._id}`))})]})}),(0,Z.jsx)(B,{value:`charts`,children:(0,Z.jsx)(ut,{groupId:e})})]})]})})}function lt({groupId:e,instanceName:t,kind:n,assigned:r,query:a}){let o=F(L.groups.listAssignableAgents,{instanceName:t}),s=R(L.groups.assignAgentToGroup),c=R(L.groups.removeAgentFromGroup),l=R(L.groups.bulkSetGroupAgents),u=H(),[d,f]=(0,X.useState)(1);if((0,X.useEffect)(()=>{f(1)},[a]),!e)return null;let p=tt(o?.agents??[],a),m=o?.discovery&&!o.discovery.lastPollOk;if(a.trim()&&p.length===0)return null;let h=p.filter(e=>e.presentInLastOk!==!1&&e.enabled!==!1),y=it(h,e=>r.has(`${t}/${e.agentId}`)),x=at(p,d,st);async function S(n,r){try{r?await c({groupId:e,instanceName:t,agentId:n}):await s({groupId:e,instanceName:t,agentId:n})}catch(e){u.error(ye(),e)}}async function C(){if(h.length===0)return;let n=h.map(e=>e.agentId);try{await l({groupId:e,instanceName:t,agentIds:n,assigned:y!==`all`})}catch(e){u.error(ye(),e)}}return(0,Z.jsxs)(`div`,{className:`oc-access__group`,children:[(0,Z.jsxs)(`div`,{className:`oc-access__instance`,children:[(0,Z.jsx)(K,{size:13,"aria-hidden":!0}),(0,Z.jsx)(`span`,{children:t}),(0,Z.jsx)(U,{variant:`outline`,className:`oc-access__kind`,children:n}),m?(0,Z.jsx)(U,{variant:`outline`,className:`oc-access__stale`,children:_()}):null]}),o===void 0?(0,Z.jsx)(`p`,{className:`oc-access__hint`,children:g()}):p.length===0?(0,Z.jsx)(`p`,{className:`oc-access__hint`,children:m?v():b()}):(0,Z.jsxs)(Z.Fragment,{children:[h.length>1?(0,Z.jsxs)(`div`,{className:`oc-access__row oc-access__selectall`,children:[(0,Z.jsx)(J,{checked:y===`all`?!0:y===`some`?`indeterminate`:!1,onCheckedChange:()=>void C(),"aria-label":I()}),(0,Z.jsx)(`span`,{className:`oc-access__label`,children:I()})]}):null,x.pageItems.map(e=>{let n=`${t}/${e.agentId}`,a=r.has(n),o=e.presentInLastOk===!1,s=!e.enabled;return(0,Z.jsxs)(`div`,{className:`oc-access__row${s?` is-disabled`:``}`,children:[(0,Z.jsx)(J,{checked:a,disabled:(o||s)&&!a,onCheckedChange:()=>void S(e.agentId,a),"aria-label":je({name:e.displayName??e.agentId})}),(0,Z.jsxs)(`span`,{className:`oc-access__label`,title:e.displayName??e.agentId,children:[e.emoji?`${e.emoji} `:``,e.displayName??e.agentId]}),e.model?(0,Z.jsx)(`span`,{className:`oc-access__model`,children:e.model}):null,e.isDefaultOnInstance?(0,Z.jsx)(`span`,{className:`oc-access__fav`,role:`img`,"aria-label":i(),title:i(),children:(0,Z.jsx)(W,{size:14,fill:`currentColor`})}):null,o?(0,Z.jsx)(U,{variant:`outline`,className:`oc-access__gone`,children:de()}):null]},e.agentId)}),(0,Z.jsx)($,{page:x.page,pageCount:x.pageCount,onPage:f})]})]})}function ut({groupId:e}){let t=F(L.charts.listGroupChartSelection,e?{groupId:e}:`skip`),n=R(L.charts.assignChartToGroup),r=R(L.charts.removeChartFromGroup),i=R(L.charts.setGroupDefaultChart),a=R(L.charts.addChartToGroupPool),s=R(L.charts.removeChartFromGroupPool),u=H();if(!e)return null;if(t===void 0)return(0,Z.jsx)(`p`,{className:`oc-access__hint`,children:S()});let{pool:d,addable:f,canManagePool:p}=t;if(d.length===0&&!p)return(0,Z.jsx)(`p`,{className:`oc-access__hint`,children:y()});async function m(t,i){try{i?await r({groupId:e,chartKey:t}):await n({groupId:e,chartKey:t})}catch(e){u.error(k(),e)}}async function h(t){try{await i({groupId:e,chartKey:t})}catch(e){u.error(k(),e)}}async function g(t){try{await a({groupId:e,chartKey:t})}catch(e){u.error(k(),e)}}async function _(t){try{await s({groupId:e,chartKey:t})}catch(e){u.error(k(),e)}}return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`div`,{className:`oc-access__list`,children:d.map(e=>(0,Z.jsxs)(`div`,{className:`oc-access__row`,children:[(0,Z.jsx)(J,{checked:e.selected,onCheckedChange:()=>void m(e.chartKey,e.selected),"aria-label":Ee({name:e.name})}),(0,Z.jsx)(`span`,{className:`oc-access__label`,title:e.name,children:e.name}),e.selected?e.isDefault?(0,Z.jsx)(`span`,{className:`oc-access__fav`,role:`img`,"aria-label":o(),title:o(),children:(0,Z.jsx)(W,{size:14,fill:`currentColor`})}):(0,Z.jsx)(V,{type:`button`,variant:`ghost`,size:`sm`,onClick:()=>void h(e.chartKey),children:w()}):null,p?(0,Z.jsx)(V,{type:`button`,variant:`ghost`,size:`sm`,"aria-label":T({name:e.name}),title:T({name:e.name}),onClick:()=>void _(e.chartKey),children:(0,Z.jsx)(Me,{size:14,"aria-hidden":!0})}):null]},e.chartKey))}),p?f.length>0?(0,Z.jsxs)(Be,{value:``,onValueChange:e=>void g(e),children:[(0,Z.jsx)(Fe,{size:`sm`,className:`oc-access__search`,children:(0,Z.jsx)(Ge,{placeholder:l()})}),(0,Z.jsx)(Ve,{children:f.map(e=>(0,Z.jsx)(Le,{value:e.chartKey,children:e.name},e.chartKey))})]}):d.length===0?(0,Z.jsx)(`p`,{className:`oc-access__hint`,children:c()}):null:null]})}export{ot as GroupsTab};
@@ -0,0 +1 @@
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$F as r,$H as i,$O as a,AO as o,Ak as s,BO as c,Bk as l,Bn as u,CO as d,Ck as f,Cu as p,DO as m,Dk as h,EO as g,Ek as _,FO as v,Fk as ee,Fn as y,GO as b,Gk as x,Gn as S,HO as C,Hk as te,Hn as ne,IO as w,Ik as re,In as ie,JO as T,Jk as ae,Jn as oe,Jo as se,KO as ce,Kk as le,Kn as ue,Ko as de,LO as fe,Lk as pe,Ln as me,Mk as he,NO as E,Nk as ge,OO as _e,Ok as ve,PO as ye,Pk as be,QF as xe,QO as Se,Qk as Ce,RO as we,Rk as Te,Rn as Ee,SO as De,Sk as Oe,Su as ke,TO as Ae,Tk as je,UO as Me,Uk as Ne,Un as Pe,VO as Fe,Vk as Ie,Vn as Le,WO as Re,Wk as ze,Wn as Be,XC as Ve,XO as He,Xk as Ue,Xn as We,YC as Ge,YO as Ke,Yk as qe,Yn as Je,ZO as Ye,Zk as Xe,Zn as Ze,_O as Qe,_k as $e,ak as et,bO as tt,bk as nt,ck as D,dO as rt,dk as it,ek as at,fO as ot,fk as st,gO as ct,gk as lt,hO as ut,hk as O,ik as k,jO as dt,jk as ft,kO as pt,kk as mt,lO as ht,lk as gt,mO as _t,mk as A,nU as j,nk as vt,ok as yt,pO as bt,pk as xt,qO as St,qk as Ct,qn as wt,qo as Tt,rk as Et,sk as Dt,t as M,tU as N,tk as Ot,uO as kt,uk as At,vO as jt,vk as Mt,wO as Nt,wk as Pt,wu as Ft,xO as It,xk as Lt,xu as Rt,yO as zt,yk as Bt,zO as Vt,zk as Ht,zn as Ut}from"./api-D7og-4qA.js";import{a as Wt,c as Gt}from"./FieldLabel-vGVJ37ds.js";import{t as P}from"./button-Ch1cRvCe.js";import{$ as F,Bt as Kt,Dt as I,Et as L,Q as R,Rt as qt,U as Jt,X as z,Z as B,_ as Yt,at as V,et as H,jt as U,nt as W,ot as G,rt as K,tt as q,ut as J,zt as Xt}from"./index-Dn5iHsqH.js";import{t as Zt}from"./DataTableShell-BzQgqnDl.js";import{InstanceConfigDialog as Qt}from"./BridgeTab-DKBERQMd.js";var Y=t(e(),1),X=[`conversational`,`documentary`,`summarizer`,`curator`],$t=new Set(X),en=`conversational`;function tn(e){let t=new Set((e??[]).filter(e=>$t.has(e)));return t.size===0?[en]:X.filter(e=>t.has(e))}var Z=n(),Q={name:``,gatewayUrl:``,bridgeUrl:``,displayName:``,kind:`openclaw`,transport:`ws`,gatewayVersion:``,gatewayHttpUrl:``,authMode:`token`,personScopes:`capped`,identitySource:`canonical`,systemIdentity:``,streamTransport:Wt},nn={openclaw:[`token`,`deviceIdentity`],hermes:[`apiKey`]};function rn(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`,identitySource:e.identitySource??`canonical`,systemIdentity:e.systemIdentity??``,streamTransport:e.streamTransport??`reactive`}}function an(){let e=j(M.admin.listInstances,{}),t=j(M.agents.listAllInstanceAgents,{}),n=N(M.admin.upsertInstance),r=N(M.admin.deleteInstance),i=I(),[a,o]=(0,Y.useState)(!1),[c,d]=(0,Y.useState)(Q),[p,m]=(0,Y.useState)(null),[g,v]=(0,Y.useState)(null),[b,C]=(0,Y.useState)(null),[w,T]=(0,Y.useState)(null);async function ce(){try{await n({instanceId:w??void 0,name:c.name,gatewayUrl:c.gatewayUrl,bridgeUrl:c.bridgeUrl||void 0,displayName:c.displayName||void 0,kind:c.kind,transport:c.kind===`hermes`?c.transport:void 0,gatewayVersion:c.gatewayVersion||void 0,gatewayHttpUrl:c.gatewayHttpUrl||void 0,...c.kind===`openclaw`?{authMode:c.authMode,personScopes:c.personScopes,identitySource:c.identitySource,systemIdentity:c.systemIdentity||void 0}:{},streamTransport:c.streamTransport}),d(Q),T(null),o(!1)}catch(e){i.error(Ue(),e)}}return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`p`,{className:`oc-admin__hint`,children:[qe(),(0,Z.jsx)(`strong`,{children:ae()}),Ct()]}),(0,Z.jsx)(Zt,{title:le(),rows:e,addLabel:x(),onAdd:()=>{T(null),d(Q),o(!0)},emptyHint:ze(),columns:[{header:Ne(),cell:e=>e.name,sort:e=>e.name},{header:te(),cell:e=>(0,Z.jsx)(L,{variant:`outline`,children:e.kind??`openclaw`}),sort:e=>e.kind??`openclaw`},{header:Ie(),cell:e=>e.gatewayUrl,sort:e=>e.gatewayUrl},{header:l(),cell:e=>e.displayName??`—`,sort:e=>e.displayName??null},{header:Ce(),cell:e=>{let n=(t?.[e.name]??[]).filter(e=>e.presentInLastOk!==!1&&e.enabled);if(n.length===0)return(0,Z.jsx)(`span`,{className:`text-muted-foreground`,children:`—`});let r=t=>e.defaultAgentId===t;return(0,Z.jsx)(`div`,{className:`flex flex-wrap gap-1`,children:[...n].sort((e,t)=>Number(r(t.agentId))-Number(r(e.agentId))).map(e=>(0,Z.jsxs)(L,{variant:r(e.agentId)?`default`:`outline`,title:r(e.agentId)?kt():void 0,children:[e.emoji?`${e.emoji} `:``,e.displayName??e.agentId]},e.agentId))})}}],rowActions:e=>[{label:re(),onSelect:()=>{T(e._id),d(rn(e)),o(!0)}},{label:Xe(),onSelect:()=>m(e.name)},{label:Lt(),onSelect:()=>C(e)},{label:Ht(),onSelect:()=>v(e)},{label:Te(),variant:`destructive`,onSelect:()=>void r({instanceId:e._id})}],bulkActions:[{label:Te(),variant:`destructive`,onSelect:e=>e.forEach(e=>void r({instanceId:e}))}]}),(0,Z.jsx)(Yt,{open:a,onOpenChange:o,title:w?ee():pe(),description:ge(),canSubmit:!!(c.name&&c.gatewayUrl),onSubmit:ce,submitLabel:he(),children:(0,Z.jsxs)(`div`,{className:`oc-form`,children:[(0,Z.jsxs)($,{label:ft(),children:[(0,Z.jsx)(U,{value:c.name,disabled:w!==null,onChange:e=>d({...c,name:e.target.value})}),w?(0,Z.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:be()}):null]}),(0,Z.jsx)($,{label:s(),children:(0,Z.jsxs)(z,{value:c.kind,onValueChange:e=>d({...c,kind:e}),children:[(0,Z.jsx)(F,{size:`sm`,className:`w-full`,children:(0,Z.jsx)(H,{})}),(0,Z.jsxs)(B,{children:[(0,Z.jsx)(R,{value:`openclaw`,children:`OpenClaw`}),(0,Z.jsx)(R,{value:`hermes`,children:`Hermes`})]})]})}),c.kind===`hermes`?(0,Z.jsx)($,{label:se(),children:(0,Z.jsxs)(z,{value:c.transport,onValueChange:e=>d({...c,transport:e}),children:[(0,Z.jsx)(F,{size:`sm`,className:`w-full`,children:(0,Z.jsx)(H,{})}),(0,Z.jsxs)(B,{children:[(0,Z.jsx)(R,{value:`ws`,children:Tt()}),(0,Z.jsx)(R,{value:`rest`,children:de()})]})]})}):null,(0,Z.jsx)($,{label:mt(),children:(0,Z.jsx)(U,{value:c.gatewayUrl,onChange:e=>d({...c,gatewayUrl:e.target.value})})}),(0,Z.jsx)($,{label:ve(),children:(0,Z.jsx)(U,{value:c.bridgeUrl,placeholder:h(),onChange:e=>d({...c,bridgeUrl:e.target.value})})}),(0,Z.jsx)($,{label:_(),children:(0,Z.jsx)(U,{value:c.displayName,onChange:e=>d({...c,displayName:e.target.value})})}),(0,Z.jsxs)($,{label:Ve(),children:[(0,Z.jsxs)(z,{value:c.streamTransport,onValueChange:e=>d({...c,streamTransport:e}),children:[(0,Z.jsx)(F,{size:`sm`,className:`w-full`,children:(0,Z.jsx)(H,{})}),(0,Z.jsx)(B,{children:Gt.map(e=>(0,Z.jsx)(R,{value:e,children:e},e))})]}),(0,Z.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:Ge()})]}),(0,Z.jsx)($,{label:je(),children:(0,Z.jsx)(U,{value:c.gatewayVersion,placeholder:Pt(),onChange:e=>d({...c,gatewayVersion:e.target.value})})}),c.kind===`openclaw`?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)($,{label:Le(),children:[(0,Z.jsxs)(z,{value:c.authMode,onValueChange:e=>d({...c,authMode:e}),children:[(0,Z.jsx)(F,{size:`sm`,className:`w-full`,children:(0,Z.jsx)(H,{})}),(0,Z.jsxs)(B,{children:[(0,Z.jsx)(R,{value:`token`,children:u()}),(0,Z.jsx)(R,{value:`trusted-proxy`,children:Ut()})]})]}),(0,Z.jsx)(`p`,{className:`oc-field__hint`,children:c.authMode===`trusted-proxy`?me():Ee()})]}),c.authMode===`trusted-proxy`?(0,Z.jsxs)($,{label:Ze(),children:[(0,Z.jsxs)(z,{value:c.personScopes,onValueChange:e=>d({...c,personScopes:e}),children:[(0,Z.jsx)(F,{size:`sm`,className:`w-full`,children:(0,Z.jsx)(H,{})}),(0,Z.jsxs)(B,{children:[(0,Z.jsx)(R,{value:`capped`,children:We()}),(0,Z.jsx)(R,{value:`full`,children:Je()})]})]}),(0,Z.jsx)(`p`,{className:`oc-field__hint`,children:c.personScopes===`full`?wt():oe()})]}):null,c.authMode===`trusted-proxy`?(0,Z.jsxs)($,{label:ue(),children:[(0,Z.jsxs)(z,{value:c.identitySource,onValueChange:e=>d({...c,identitySource:e}),children:[(0,Z.jsx)(F,{size:`sm`,className:`w-full`,children:(0,Z.jsx)(H,{})}),(0,Z.jsxs)(B,{children:[(0,Z.jsx)(R,{value:`canonical`,children:S()}),(0,Z.jsx)(R,{value:`email`,children:Be()})]})]}),(0,Z.jsx)(`p`,{className:`oc-field__hint`,children:c.identitySource===`email`?ne():Pe()})]}):null,c.authMode===`trusted-proxy`?(0,Z.jsx)($,{label:ie(),children:(0,Z.jsx)(U,{value:c.systemIdentity,placeholder:y(),onChange:e=>d({...c,systemIdentity:e.target.value})})}):null]}):null,(0,Z.jsx)($,{label:f(),children:(0,Z.jsx)(U,{value:c.gatewayHttpUrl,placeholder:Oe(),onChange:e=>d({...c,gatewayHttpUrl:e.target.value})})})]})}),(0,Z.jsx)(hn,{instanceName:p,open:p!==null,onOpenChange:e=>{e||m(null)}}),g?(0,Z.jsx)(Qt,{instance:g,onClose:()=>v(null)},g._id):null,b?(0,Z.jsx)(on,{instance:b,onClose:()=>C(null)},b._id):null]})}function on({instance:e,onClose:t}){let n=j(M.instanceSecrets.listInstanceSecretStatus,{}),r=nn[e.kind??`openclaw`],i=(0,Y.useMemo)(()=>{let t={};for(let r of n??[])r.instanceId===e._id&&(t[r.field]=r.updatedAt);return t},[n,e._id]);return(0,Z.jsx)(q,{open:!0,onOpenChange:e=>!e&&t(),children:(0,Z.jsxs)(W,{onOpenAutoFocus:e=>e.preventDefault(),children:[(0,Z.jsxs)(V,{children:[(0,Z.jsx)(G,{children:nt({instance:e.displayName??e.name})}),(0,Z.jsx)(K,{children:Bt()})]}),(0,Z.jsx)(`div`,{className:`oc-form`,children:r.map(t=>(0,Z.jsx)(ln,{instanceId:e._id,field:t,updatedAt:i[t]??null},t))}),(0,Z.jsx)(`div`,{className:`oc-bridgesecret`,children:(0,Z.jsx)(cn,{instance:e})}),(0,Z.jsx)(sn,{instance:e})]})})}function sn({instance:e}){let t=i(M.instanceSync.forceInstanceSync),n=I(),[r,o]=(0,Y.useState)(!1);async function s(){if(!r){o(!0);try{switch((await t({instanceId:e._id})).status){case`synced`:n.success(a());break;case`no_agents`:n.success(Ye());break;case`no_bridge_url`:n.error(He());break;case`deploy_misconfigured`:n.error(Ke());break;case`unauthorized`:n.error(St());break;case`not_served`:n.error(ce());break;default:n.error(T());break}}catch(e){n.error(Se(),e)}finally{o(!1)}}}return(0,Z.jsxs)(`div`,{className:`oc-form`,children:[(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:b()}),(0,Z.jsx)(`div`,{className:`flex items-center gap-2`,children:(0,Z.jsx)(P,{size:`sm`,variant:`outline`,onClick:()=>void s(),disabled:r,children:r?at():Ot()})})]})}function cn({instance:e}){let t=j(M.bridgeAuth.listBridgeAuthStatus,{}),n=i(M.bridgeAuth.mintBridgeSecret),a=N(M.bridgeAuth.revokeBridgeSecret),o=I(),[s,l]=(0,Y.useState)(!1),[u,d]=(0,Y.useState)(null),[f,p]=(0,Y.useState)(!1),m=(t??[]).find(t=>t.instanceId===e._id),h=m!==void 0;async function g(){if(!s){l(!0);try{d((await n({instanceId:e._id})).plaintext),p(!1)}catch(e){o.error(we(),e)}finally{l(!1)}}}async function _(){if(!s){l(!0);try{await a({instanceId:e._id}),d(null),o.success(Vt())}catch(e){o.error(we(),e)}finally{l(!1)}}}async function v(){if(u)try{await navigator.clipboard.writeText(u),p(!0)}catch{}}return(0,Z.jsxs)($,{label:Re(),children:[(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:Me()}),(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Z.jsx)(L,{variant:h?`outline`:`secondary`,children:h?`${O()} · ${m.prefix}…${m.lastFour}`:A()}),(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(P,{size:`sm`,onClick:()=>void g(),disabled:s,children:h?Fe():C()}),h?(0,Z.jsx)(P,{size:`sm`,variant:`destructive`,onClick:()=>void _(),disabled:s,children:c()}):null]})]}),u?(0,Z.jsxs)(`div`,{className:`oc-bridgesecret__reveal`,children:[(0,Z.jsx)(`p`,{className:`oc-sa__minted-warning`,children:fe()}),(0,Z.jsxs)(`div`,{className:`oc-sa__minted-box`,children:[(0,Z.jsx)(`code`,{className:`oc-sa__minted-plain`,children:u}),(0,Z.jsx)(P,{variant:`outline`,size:`sm`,onClick:()=>void v(),children:f?r():xe()})]}),(0,Z.jsx)(P,{size:`sm`,variant:`ghost`,onClick:()=>{d(null),p(!1)},children:w()})]}):null]})}function ln({instanceId:e,field:t,updatedAt:n}){let a=i(M.instanceSecrets.setInstanceSecret),o=N(M.instanceSecrets.clearInstanceSecret),s=i(M.deviceIdentity.generateDeviceIdentity),c=I(),[l,u]=(0,Y.useState)(``),[d,f]=(0,Y.useState)(!1),[p,m]=(0,Y.useState)(null),[h,g]=(0,Y.useState)(!1),_=n!==null,v=t===`deviceIdentity`,ee=t===`token`?Mt():t===`deviceIdentity`?$e():lt();async function y(){if(!(!l.trim()||d)){f(!0);try{await a({instanceId:e,field:t,plaintext:l}),u(``),m(null),g(!1),c.success(gt())}catch(e){c.error(D(),e)}finally{f(!1)}}}async function b(){if(!d){f(!0);try{await o({instanceId:e,field:t}),m(null),g(!1),c.success(Dt())}catch(e){c.error(D(),e)}finally{f(!1)}}}async function x(){if(!d){f(!0);try{m(await s({instanceId:e})),g(!1),c.success(k())}catch(e){c.error(vt(),e)}finally{f(!1)}}}let S=p?`openclaw devices approve ${p.id}`:``;async function C(){if(S)try{await navigator.clipboard.writeText(S),g(!0)}catch{}}return(0,Z.jsxs)($,{label:ee,children:[v?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:et()}):null,(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Z.jsx)(L,{variant:_?`outline`:`secondary`,children:_?O():A()}),(0,Z.jsx)(U,{type:`password`,autoComplete:`off`,className:`flex-1 min-w-32`,value:l,placeholder:_?st():xt(),onChange:e=>u(e.target.value)}),(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(P,{size:`sm`,onClick:()=>void y(),disabled:d||l.trim().length===0,children:it()}),v?(0,Z.jsx)(P,{size:`sm`,variant:`outline`,onClick:()=>void x(),disabled:d,children:yt()}):null,_?(0,Z.jsx)(P,{size:`sm`,variant:`destructive`,onClick:()=>void b(),disabled:d,children:At()}):null]})]}),p?(0,Z.jsxs)(`div`,{className:`oc-bridgesecret__reveal`,children:[(0,Z.jsx)(`p`,{className:`text-sm font-medium`,children:k()}),(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:Et()}),(0,Z.jsxs)(`div`,{className:`oc-sa__minted-box`,children:[(0,Z.jsx)(`code`,{className:`oc-sa__minted-plain`,children:S}),(0,Z.jsx)(P,{variant:`outline`,size:`sm`,onClick:()=>void C(),children:h?r():xe()})]}),(0,Z.jsx)(P,{size:`sm`,variant:`ghost`,onClick:()=>{m(null),g(!1)},children:w()})]}):null]})}var un={conversational:Ae,documentary:d,summarizer:Ft,curator:ke},dn={conversational:Nt,documentary:De,summarizer:p,curator:Rt},fn=e=>(un[e]??(()=>e))(),pn=e=>(dn[e]??(()=>``))();function mn({agentId:e,types:t,onToggle:n}){return(0,Z.jsxs)(`div`,{className:`oc-agentcard__types`,children:[(0,Z.jsx)(`span`,{className:`oc-agentcard__types-label`,children:pt()}),t.map(e=>(0,Z.jsx)(L,{variant:`secondary`,className:`oc-agenttype__chip`,title:pn(e),children:fn(e)},e)),(0,Z.jsxs)(qt,{children:[(0,Z.jsx)(Kt,{asChild:!0,children:(0,Z.jsx)(P,{type:`button`,variant:`outline`,size:`sm`,className:`h-7`,children:_e()})}),(0,Z.jsxs)(Xt,{align:`start`,className:`oc-agenttypes-pop`,children:[(0,Z.jsx)(`p`,{className:`oc-agenttypes-pop__title`,children:m()}),(0,Z.jsx)(`p`,{className:`oc-agenttypes-pop__hint`,children:g()}),(0,Z.jsx)(`div`,{className:`oc-agenttypes-pop__list`,children:X.map(r=>{let i=`agtype-${e}-${r}`;return(0,Z.jsxs)(`div`,{className:`oc-agenttypes-pop__item`,children:[(0,Z.jsx)(J,{id:i,checked:t.includes(r),onCheckedChange:()=>n(r)}),(0,Z.jsxs)(`label`,{htmlFor:i,className:`oc-agenttypes-pop__text`,children:[(0,Z.jsx)(`span`,{className:`oc-agenttypes-pop__name`,children:fn(r)}),(0,Z.jsx)(`span`,{className:`oc-agenttypes-pop__desc`,children:pn(r)})]})]},r)})})]})]})]})}function hn({instanceName:e,open:t,onOpenChange:n}){let r=j(M.agents.listAgentsForInstance,t&&e?{instanceName:e}:`skip`),i=N(M.agents.setAgentEnabled).withOptimisticUpdate((e,{instanceName:t,agentId:n,enabled:r})=>{let i=e.getQuery(M.agents.listAgentsForInstance,{instanceName:t});i&&e.setQuery(M.agents.listAgentsForInstance,{instanceName:t},{...i,agents:i.agents.map(e=>e.agentId===n?{...e,enabled:r}:e)})}),a=N(M.agents.setInstanceDefaultAgent).withOptimisticUpdate((e,{instanceName:t,agentId:n})=>{let r=e.getQuery(M.agents.listAgentsForInstance,{instanceName:t});r&&e.setQuery(M.agents.listAgentsForInstance,{instanceName:t},{...r,defaultAgentId:n})}),o=N(M.agents.setAgentTypes).withOptimisticUpdate((e,{instanceName:t,agentId:n,types:r})=>{let i=e.getQuery(M.agents.listAgentsForInstance,{instanceName:t});if(!i)return;let a=tn(r);e.setQuery(M.agents.listAgentsForInstance,{instanceName:t},{...i,agents:i.agents.map(e=>e.agentId===n?{...e,types:a}:e)})}),s=N(M.agents.setAgentDescription).withOptimisticUpdate((e,{instanceName:t,agentId:n,description:r})=>{let i=e.getQuery(M.agents.listAgentsForInstance,{instanceName:t});if(!i)return;let a=r.trim();e.setQuery(M.agents.listAgentsForInstance,{instanceName:t},{...i,agents:i.agents.map(e=>e.agentId===n?{...e,description:a.length===0?null:a}:e)})}),c=N(M.agents.removeInstanceAgent),l=Jt(),u=I();async function d(t,n){if(e)try{await i({instanceName:e,agentId:t,enabled:n})}catch(e){u.error(E(),e)}}async function f(t){if(e)try{await a({instanceName:e,agentId:t})}catch(e){u.error(E(),e)}}async function p(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){u.error(E(),e)}}async function m(t,n){if(e&&await l({title:zt({name:n}),description:jt(),confirmLabel:Qe(),destructive:!0}))try{await c({instanceName:e,agentId:t}),u.success(ct())}catch(e){u.error(E(),e)}}return(0,Z.jsx)(q,{open:t,onOpenChange:n,children:(0,Z.jsxs)(W,{className:`oc-access`,children:[(0,Z.jsxs)(V,{children:[(0,Z.jsx)(G,{children:v({name:e??``})}),(0,Z.jsx)(K,{children:ye()})]}),r===void 0?(0,Z.jsx)(`p`,{className:`oc-access__hint`,children:ut()}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`div`,{className:`oc-access__poll`,children:r.discovery===null?_t():r.discovery.lastPollOk?bt():ot({error:r.discovery.error??`?`})}),r.agents.length===0?(0,Z.jsx)(`p`,{className:`oc-access__hint`,children:rt()}):(0,Z.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,Z.jsxs)(`div`,{className:`oc-agentcard`+(t.enabled?``:` oc-agentcard--off`),children:[(0,Z.jsxs)(`div`,{className:`oc-agentcard__head`,children:[(0,Z.jsx)(J,{checked:t.enabled,disabled:n,"aria-label":a,onCheckedChange:e=>void d(t.agentId,e===!0)}),(0,Z.jsxs)(`span`,{className:`oc-agentcard__name`,title:a,children:[t.emoji?`${t.emoji} `:``,a]}),t.model?(0,Z.jsx)(`span`,{className:`oc-access__model`,children:t.model}):null,n?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(L,{variant:`outline`,className:`oc-access__gone`,children:ht()}),(0,Z.jsx)(P,{size:`sm`,variant:`ghost`,className:`h-7 text-destructive`,onClick:()=>void m(t.agentId,a),children:tt()})]}):i?(0,Z.jsx)(L,{variant:`default`,children:kt()}):(0,Z.jsx)(P,{size:`sm`,variant:`outline`,className:`h-7`,disabled:!t.enabled,onClick:()=>void f(t.agentId),children:It()})]}),t.enabled?(0,Z.jsx)(mn,{agentId:t.agentId,types:o,onToggle:e=>void p(t.agentId,e,o)}):null,t.enabled?(0,Z.jsx)(gn,{value:t.description??``,onSave:async n=>{if(e)try{await s({instanceName:e,agentId:t.agentId,description:n})}catch(e){u.error(E(),e)}}}):null]},t.agentId)})})]})]})})}function gn({value:e,onSave:t}){let[n,r]=(0,Y.useState)(e);(0,Y.useEffect)(()=>{r(e)},[e]);let i=()=>{n.trim()!==e.trim()&&t(n)};return(0,Z.jsx)(U,{className:`oc-agentcard__desc`,value:n,maxLength:280,placeholder:dt(),"aria-label":o(),onChange:e=>r(e.target.value),onBlur:i,onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),i())}})}function $({label:e,children:t}){return(0,Z.jsxs)(`label`,{className:`oc-field`,children:[(0,Z.jsx)(`span`,{className:`oc-field__label`,children:e}),t]})}export{an as InstancesTab};
@@ -0,0 +1 @@
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$H as r,Aj as i,Bd as a,Bj as o,Fj as s,Gd as c,Hd as l,Hj as u,Ij as d,Ld as f,Lj as p,Mj as m,Nj as h,Pj as g,Rd as _,Rj as v,Ud as y,Uj as b,Vd as x,Vj as S,Wd as C,jj as w,nU as T,t as E,tU as D,zd as O,zj as k}from"./api-D7og-4qA.js";import{t as A}from"./button-Ch1cRvCe.js";import{Et as j,jt as M,ut as N}from"./index-Dn5iHsqH.js";var P=t(e(),1),F=n();function I(){let e=T(E.integrations.status.status,{}),t=D(E.admin.setIntegrationConfig),[n,r]=(0,P.useState)(null);if((0,P.useEffect)(()=>{e&&n===null&&r(e.config)},[e,n]),!e||!n)return(0,F.jsx)(`p`,{className:`oc-admin__hint`,children:b()});let a=n,l=(e,t,n)=>r({...a,[e]:{...a[e],[t]:n}}),f=(e,n)=>void t({[e]:n});return(0,F.jsxs)(F.Fragment,{children:[(0,F.jsxs)(`p`,{className:`oc-admin__hint`,children:[u(),` `,(0,F.jsx)(`strong`,{children:S()}),` `,o()]}),(0,F.jsxs)(L,{title:`Langfuse`,status:e.langfuse.configured?e.langfuse.enabled?(0,F.jsx)(j,{variant:`secondary`,children:k()}):(0,F.jsx)(j,{variant:`outline`,children:v()}):(0,F.jsx)(j,{variant:`outline`,children:p()}),note:d(),children:[(0,F.jsx)(R,{label:g(),children:(0,F.jsx)(M,{value:a.langfuse.host??``,placeholder:e.langfuse.effectiveHost,onChange:e=>l(`langfuse`,`host`,e.target.value),onBlur:()=>f(`langfuse`,{host:a.langfuse.host??``})})}),(0,F.jsx)(z,{label:i(),checked:a.langfuse.enabled??!0,onChange:e=>{l(`langfuse`,`enabled`,e),f(`langfuse`,{enabled:e})}})]}),(0,F.jsxs)(L,{title:`Opik`,status:e.opik.configured?e.opik.enabled?(0,F.jsx)(j,{variant:`secondary`,children:k()}):(0,F.jsx)(j,{variant:`outline`,children:v()}):(0,F.jsx)(j,{variant:`outline`,children:p()}),note:s(),children:[(0,F.jsx)(R,{label:h(),children:(0,F.jsx)(M,{value:a.opik.baseUrl??``,placeholder:e.opik.effectiveBaseUrl,onChange:e=>l(`opik`,`baseUrl`,e.target.value),onBlur:()=>f(`opik`,{baseUrl:a.opik.baseUrl??``})})}),(0,F.jsx)(R,{label:m(),children:(0,F.jsx)(M,{value:a.opik.workspace??``,placeholder:e.opik.effectiveWorkspace||w(),onChange:e=>l(`opik`,`workspace`,e.target.value),onBlur:()=>f(`opik`,{workspace:a.opik.workspace??``})})}),(0,F.jsx)(z,{label:i(),checked:a.opik.enabled??!0,onChange:e=>{l(`opik`,`enabled`,e),f(`opik`,{enabled:e})}})]}),(0,F.jsxs)(L,{title:`OpenTelemetry (OTLP)`,status:e.otlp.configured?e.otlp.enabled?(0,F.jsx)(j,{variant:`secondary`,children:k()}):(0,F.jsx)(j,{variant:`outline`,children:v()}):(0,F.jsx)(j,{variant:`outline`,children:c()}),note:C(),children:[(0,F.jsx)(R,{label:y(),children:(0,F.jsx)(M,{value:a.otlp.endpoint??``,placeholder:e.otlp.effectiveEndpoint||`https://otlp.example.com/v1/traces`,onChange:e=>l(`otlp`,`endpoint`,e.target.value),onBlur:()=>f(`otlp`,{endpoint:a.otlp.endpoint??``})})}),(0,F.jsx)(B,{headersSet:e.otlp.headersSet}),(0,F.jsx)(z,{label:i(),checked:a.otlp.enabled??!0,onChange:e=>{l(`otlp`,`enabled`,e),f(`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=r(E.integrations.otlpSecret.setOtlpHeaders),n=D(E.integrations.otlpSecret.clearOtlpHeaders),[i,o]=(0,P.useState)(``),[s,c]=(0,P.useState)(null),[u,d]=(0,P.useState)(!1),p=async()=>{d(!0),c(null);try{await t({headersJson:i}),o(``)}catch(e){c(e instanceof Error?e.message:String(e))}finally{d(!1)}};return(0,F.jsxs)(R,{label:l(),children:[(0,F.jsx)(M,{value:i,placeholder:e?x():a(),onChange:e=>o(e.target.value)}),(0,F.jsxs)(`div`,{className:`oc-int__otlp-headers-actions`,children:[(0,F.jsx)(A,{size:`sm`,disabled:u||i.trim().length===0,onClick:()=>void p(),children:O()}),e?(0,F.jsx)(A,{variant:`ghost`,size:`sm`,disabled:u,onClick:()=>void n({}),children:_()}):null]}),s?(0,F.jsx)(`p`,{className:`oc-int__otlp-headers-error`,children:s}):null,(0,F.jsx)(`p`,{className:`oc-uipa__note`,children:f()})]})}export{I as IntegrationsTab};
@@ -0,0 +1 @@
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$x as r,DM as i,EM as a,QM as o,TM as s,_M as c,aS as l,cS as u,dS as d,eS as ee,fS as f,gM as p,iS as m,lS as te,nS as h,nU as g,oS as ne,pS as re,rS as _,sS as v,t as y,tS as b,uS as x,wM as S}from"./api-D7og-4qA.js";import{Kn as C,i as w,o as ie,q as ae,qn as T,r as E}from"./index-Dn5iHsqH.js";import{a as D,n as O,o as k,r as A,t as j}from"./card-B1-0rWzO.js";import{n as M,t as N}from"./TimeRangePicker-DIGmrYqi.js";var P=t(e(),1),F={API_CALLS:`api.calls`,API_ERRORS:`api.errors`,API_LATENCY_AVG_MS:`api.latency.avg_ms`,OPENCLAW_INGEST:`openclaw.ingest`,CHAT_SEND:`chat.send`,ASSISTANT_STREAM_ERRORS:`assistant.stream.errors`,ASSISTANT_ANNOUNCE_ERRORS:`assistant.announce.errors`,CONVEX_PROBE_LATENCY_AVG_MS:`convex.probe.latency.avg_ms`},I=Object.keys(F).length,L=n(),R=15,z=e=>String(Math.round(e));function B(){let e=g(y.me.getMe,{host:ae})?.permissions?.includes(`traces.read`)??!1,t=g(y.deliveryTiming.listDeliverySessions,e?{}:`skip`),n=(0,P.useMemo)(()=>t?t.filter(e=>!e.active&&e.rollup!==null&&e.rollup.cP50!==null&&e.rollup.aP50!==null).slice(0,R).reverse().map(e=>({startedAt:e.startedAt,cP50:e.rollup?.cP50,aP50:e.rollup?.aP50})):[],[t]);return t===void 0?null:(0,L.jsxs)(`section`,{className:`oc-kpi__group`,children:[(0,L.jsx)(`h2`,{className:`oc-kpi__group-title`,children:o()}),(0,L.jsxs)(j,{children:[(0,L.jsxs)(D,{children:[(0,L.jsx)(k,{children:i()}),(0,L.jsx)(A,{children:s()})]}),(0,L.jsx)(O,{children:n.length<2?(0,L.jsx)(`p`,{className:`oc-admin__hint`,children:S()}):(0,L.jsx)(V,{series:n})})]})]})}function V({series:e}){let t=e.map(e=>e.cP50),n=e.map(e=>e.aP50),r=Math.max(1,...t,...n),o=t=>6+t*468/(e.length-1),s=e=>74-e*68/r,l=e=>e.map((e,t)=>`${t===0?`M`:`L`}${o(t).toFixed(1)},${s(e).toFixed(1)}`).join(` `),u=e[e.length-1];return(0,L.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,L.jsxs)(`div`,{className:`flex gap-3 text-xs text-muted-foreground`,children:[(0,L.jsxs)(`span`,{style:{color:`var(--primary)`},children:[p(),` p50 `,z(u.cP50),` `,a()]}),(0,L.jsxs)(`span`,{children:[c(),` p50 `,z(u.aP50),` `,a()]})]}),(0,L.jsxs)(`svg`,{viewBox:`0 0 480 80`,className:`h-20 w-full`,preserveAspectRatio:`none`,role:`img`,"aria-label":i(),children:[(0,L.jsx)(`path`,{d:l(n),fill:`none`,style:{stroke:`var(--muted-foreground)`},strokeWidth:1.5}),(0,L.jsx)(`path`,{d:l(t),fill:`none`,style:{stroke:`var(--primary)`},strokeWidth:1.5})]})]})}var H=[{metric:`api.calls`,label:re(),unit:`/h`,group:`API`,isError:!1},{metric:`api.errors`,label:f(),unit:`/h`,group:`API`,isError:!0},{metric:`api.latency.avg_ms`,label:d(),unit:`ms`,group:`API`,isError:!1},{metric:`openclaw.ingest`,label:x(),unit:`/h`,group:`OpenClaw`,isError:!1},{metric:`chat.send`,label:te(),unit:`/h`,group:`Chat`,isError:!1},{metric:F.ASSISTANT_STREAM_ERRORS,label:u(),unit:`/h`,group:`Assistant`,isError:!0},{metric:F.ASSISTANT_ANNOUNCE_ERRORS,label:v(),unit:`/h`,group:`Assistant`,isError:!0}],U=I,W=[`API`,`OpenClaw`,`Chat`,`Assistant`],G=1e3,K=36e5;function q(e,t){let n=Math.max(1,Math.ceil((t-e)/K)),r=Math.min(n*U,G);return{rowLimit:r,buckets:Math.max(1,Math.floor(r/U))}}function J(){let e=T({from:`/settings/kpi`}),t=C({from:`/settings/kpi`}),n=w(e.from,e.to,E,`now`),r=e=>void t({search:t=>({...t,...ie(e)})}),{from:i,to:a}=M(n),{rowLimit:o,buckets:s}=q(i,a),c=g(y.kpi.listKpis,{limit:o,filter:{from:i,to:a}}),u=(0,P.useMemo)(()=>{let e=new Map;for(let t of c??[]){let n=e.get(t.metric)??[];n.push({bucket:t.bucket,value:t.value}),e.set(t.metric,n)}for(let[t,n]of e)n.sort((e,t)=>e.bucket<t.bucket?-1:+(e.bucket>t.bucket)),n.length>s&&e.set(t,n.slice(n.length-s));return e},[c,s]),d=(0,L.jsxs)(L.Fragment,{children:[(0,L.jsxs)(`p`,{className:`oc-admin__hint`,children:[ne(),` `,(0,L.jsx)(`span`,{className:`oc-filter__window`,children:l()})]}),(0,L.jsx)(Y,{value:n,onChange:r})]});return c===void 0?(0,L.jsxs)(L.Fragment,{children:[d,(0,L.jsx)(B,{}),(0,L.jsx)(`p`,{className:`oc-admin__hint`,children:m()})]}):c.length===0?(0,L.jsxs)(L.Fragment,{children:[d,(0,L.jsx)(B,{}),(0,L.jsx)(`p`,{className:`oc-admin__hint`,children:_()})]}):(0,L.jsxs)(L.Fragment,{children:[d,(0,L.jsx)(B,{}),W.map(e=>{let t=H.filter(t=>t.group===e);return t.some(e=>(u.get(e.metric)??[]).length>0)?(0,L.jsxs)(`section`,{className:`oc-kpi__group`,children:[(0,L.jsx)(`h2`,{className:`oc-kpi__group-title`,children:e}),(0,L.jsx)(`div`,{className:`oc-kpi__grid`,children:t.map(e=>(0,L.jsx)(oe,{config:e,series:u.get(e.metric)??[]},e.metric))})]},e):null})]})}function Y({value:e,onChange:t}){return(0,L.jsx)(`div`,{className:`oc-kpi__toolbar`,children:(0,L.jsx)(N,{value:e,onChange:t})})}function oe({config:e,series:t}){let n=t.length>0?t[t.length-1]:null,r=n?n.value:0;return(0,L.jsxs)(j,{size:`sm`,className:`oc-kpi__card`,children:[(0,L.jsxs)(D,{children:[(0,L.jsx)(k,{className:`oc-kpi__card-title`,children:e.label}),(0,L.jsx)(A,{className:`oc-kpi__card-metric`,children:(0,L.jsx)(`code`,{children:e.metric})})]}),(0,L.jsxs)(O,{className:`oc-kpi__card-body`,children:[(0,L.jsxs)(`div`,{className:`oc-kpi__value-row`,children:[(0,L.jsx)(`span`,{className:`oc-kpi__value`+(e.isError&&r>0?` oc-kpi__value--error`:``),children:Q(r)}),(0,L.jsx)(`span`,{className:`oc-kpi__unit`,children:e.unit})]}),(0,L.jsx)(ce,{series:t,isError:e.isError,unit:e.unit}),(0,L.jsxs)(`div`,{className:`oc-kpi__axis`,children:[n?(0,L.jsx)(`span`,{className:`oc-kpi__axis-latest`,children:h({value:$(n.bucket)})}):(0,L.jsx)(`span`,{className:`oc-kpi__muted`,children:b()}),(0,L.jsx)(`span`,{className:`oc-kpi__muted`,children:ee({count:t.length})})]})]})]})}var X=240,Z=48,se=1;function ce({series:e,isError:t,unit:n}){if(e.length===0)return(0,L.jsx)(`div`,{className:`oc-kpi__chart oc-kpi__chart--empty`,"aria-hidden":!0});let i=e.reduce((e,t)=>t.value>e?t.value:e,0),a=X/e.length,o=Math.max(a-se,1);return(0,L.jsx)(`svg`,{className:`oc-kpi__chart`,viewBox:`0 0 ${X} ${Z}`,preserveAspectRatio:`none`,role:`img`,"aria-label":r({max:Q(i),unit:n}),children:e.map((e,r)=>{let s=i>0?e.value/i*(Z-1):0,c=r*a,l=Z-s;return(0,L.jsx)(`rect`,{className:`oc-kpi__bar`+(t&&e.value>0?` oc-kpi__bar--error`:``),x:c,y:l,width:o,height:s,children:(0,L.jsxs)(`title`,{children:[$(e.bucket),` · `,Q(e.value),` `,n]})},e.bucket)})})}function Q(e){return Number.isFinite(e)?Math.abs(e)>=1e3?(e/1e3).toFixed(e%1e3==0?0:1)+`k`:String(e):`0`}function $(e){let t=new Date(`${e}:00:00Z`);return Number.isNaN(t.getTime())?e:`${String(t.getUTCDate()).padStart(2,`0`)}/${String(t.getUTCMonth()+1).padStart(2,`0`)} ${String(t.getUTCHours()).padStart(2,`0`)}h`}export{J as KpiTab};
@@ -0,0 +1 @@
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{AH as r,AL as i,BL as a,CH as o,CL as s,DH as c,DL as l,EH as u,EL as d,FH as f,FL as p,GL as m,Gi as ee,HH as te,HL as ne,Hi as re,IH as ie,IL as ae,JL as oe,Ji as se,KL as ce,Ki as le,LH as ue,LL as de,MH as fe,ML as pe,Mk as me,NH as he,NL as ge,OH as _e,OL as ve,PH as ye,PL as h,RH as g,RL as _,SH as v,SL as y,TH as b,TL as x,UL as S,Ui as C,VL as w,Vi as T,WL as E,Wi as D,XL as O,YL as k,_H as A,_L as j,bH as M,bL as N,ca as P,dL as be,fL as xe,gH as Se,gL as Ce,hL as we,jH as Te,jL as Ee,kH as De,kL as Oe,mL as ke,nU as F,na as Ae,pL as je,qH as Me,qL as Ne,qi as Pe,r as I,sa as Fe,t as L,tU as R,vH as Ie,vL as z,wH as Le,wL as B,xH as Re,xL as ze,yH as Be,yL as Ve,zH as He,zL as Ue}from"./api-D7og-4qA.js";import{t as V}from"./button-Ch1cRvCe.js";import{$ as We,At as Ge,Dt as Ke,Et as H,Ot as qe,Q as U,V as Je,X as Ye,Z as Xe,et as Ze,jt as W,kt as Qe,q as G,t as $e,ut as K}from"./index-Dn5iHsqH.js";import{t as et}from"./localePickerView-C2RmOS86.js";import{t as tt}from"./TimezoneCombobox-CkPBJSKF.js";var q=t(e(),1),J=n();function nt({className:e,checked:t,onCheckedChange:n,disabled:r,...i}){return(0,J.jsx)(`button`,{type:`button`,role:`switch`,"aria-checked":t,"data-state":t?`checked`:`unchecked`,disabled:r,onClick:()=>n(!t),className:I(`peer inline-flex h-5 w-9 shrink-0 items-center rounded-full border border-transparent transition-colors outline-none`,`focus-visible:ring-2 focus-visible:ring-ring/50`,`disabled:cursor-not-allowed disabled:opacity-50`,t?`bg-primary`:`bg-input`,e),...i,children:(0,J.jsx)(`span`,{className:I(`pointer-events-none block size-4 rounded-full bg-background shadow transition-transform`,t?`translate-x-[18px]`:`translate-x-[2px]`)})})}var Y=[{id:`messages`,label:()=>O()},{id:`composer`,label:()=>k()},{id:`sidebar`,label:()=>oe()},{id:`notifications`,label:()=>Ee()},{id:`other`,label:()=>Ne()}],X={showSource:{category:`messages`,label:()=>ce(),help:()=>m()},showReport:{category:`messages`,label:()=>E(),help:()=>S()},copyAssistant:{category:`messages`,label:()=>ne()},copyUser:{category:`messages`,label:()=>w()},showDelete:{category:`messages`,label:()=>a()},showTools:{category:`messages`,label:()=>Ue(),help:()=>_()},voiceInput:{category:`composer`,label:()=>de(),help:()=>ae()},showUsage:{category:`composer`,label:()=>p(),help:()=>h()},autoReadAloud:{category:`composer`,label:()=>P(),help:()=>Fe()},showChatAge:{category:`sidebar`,label:()=>ge(),help:()=>pe()},notifSound:{category:`notifications`,label:()=>i(),help:()=>Oe()},notifSystem:{category:`notifications`,label:()=>ve(),help:()=>l()},replySound:{category:`notifications`,label:()=>d(),help:()=>x()}};function Z(e){return e.toLowerCase().normalize(`NFD`).replace(/\p{Diacritic}/gu,``)}function Q(e,t){let n=Z(t.trim()),r=new Map(Y.map(e=>[e.id,e.label()])),i=new Map(Y.map(e=>[e.id,[]]));for(let t of e){let e=X[t],a=e?.category??`other`;n&&!Z(`${e?e.label():t} ${e?.help?e.help():``} ${t} ${r.get(a)??``}`).includes(n)||i.get(a).push(t)}return Y.map(e=>({id:e.id,label:r.get(e.id),keys:i.get(e.id)})).filter(e=>e.keys.length>0)}var rt=[`showSource`,`showReport`,`copyAssistant`,`copyUser`,`showDelete`,`showTools`,`voiceInput`,`showChatAge`,`showUsage`,`autoReadAloud`,`notifSound`,`notifSystem`,`replySound`],it={voiceInput:`voiceInput`};function at(e){return rt.includes(e)}function $(e){return e===`admin`}function ot(e){return e===!0?`on`:e===!1?`off`:`inherit`}function st(e){return e===`on`?!0:e===`off`?!1:null}function ct(e){return at(e)?it[e]:void 0}var lt={voiceInput:()=>we()};function ut({prefKey:e,ui:t}){let n=R(L.admin.setUiPrefDefault),r=R(L.admin.setFeatureEnabled),i=ct(e),a=i?lt[e]?.():void 0;return(0,J.jsxs)(`div`,{className:`oc-prefs__gov`,children:[(0,J.jsxs)(`div`,{className:`oc-prefs__gov-row`,children:[(0,J.jsx)(`span`,{className:`oc-prefs__gov-label`,children:Ve()}),(0,J.jsxs)(Ye,{value:ot(t.defaults[e]),onValueChange:t=>void n({key:e,value:st(t)}),children:[(0,J.jsx)(We,{size:`sm`,className:`w-36`,children:(0,J.jsx)(Ze,{})}),(0,J.jsxs)(Xe,{children:[(0,J.jsx)(U,{value:`on`,children:je()}),(0,J.jsx)(U,{value:`off`,children:xe()}),(0,J.jsx)(U,{value:`inherit`,children:be()})]})]}),i?(0,J.jsxs)(`span`,{className:`oc-prefs__gov-gate`,children:[(0,J.jsx)(K,{checked:t.featuresEnabled[i]===!0,onCheckedChange:e=>void r({key:i,enabled:e===!0}),"aria-label":z()}),z()]}):null]}),a?(0,J.jsx)(`span`,{className:`oc-prefs__gov-help`,children:a}):null]})}function dt({current:e,enabled:t}){let n=R(L.me.setDictationShortcut),[r,i]=(0,q.useState)(!1),[a,o]=(0,q.useState)(!1);return(0,q.useEffect)(()=>{if(!r)return;let e=e=>{if(e.preventDefault(),e.stopPropagation(),e.key===`Escape`){i(!1);return}let t=Qe(e);if(t===null){[`Shift`,`Control`,`Meta`,`Alt`].includes(e.key)||(o(!0),window.setTimeout(()=>o(!1),1800));return}i(!1),n({shortcut:t})};return window.addEventListener(`keydown`,e,!0),()=>window.removeEventListener(`keydown`,e,!0)},[r,n]),(0,J.jsxs)(`div`,{className:`oc-prefs__row${t?``:` is-locked`}`,children:[(0,J.jsxs)(`div`,{className:`oc-prefs__info`,children:[(0,J.jsxs)(`span`,{className:`oc-prefs__label`,children:[se(),e?(0,J.jsx)(H,{variant:`secondary`,children:Ge(e,qe())}):null]}),(0,J.jsx)(`span`,{className:`oc-prefs__help`,children:a?ee():r?le():Pe()})]}),(0,J.jsxs)(`div`,{className:`oc-prefs__ctl`,children:[e&&!r?(0,J.jsx)(`button`,{type:`button`,className:`oc-prefs__reset`,onClick:()=>void n({shortcut:null}),children:T()}):null,(0,J.jsx)(`button`,{type:`button`,className:`oc-prefs__reset`,disabled:!t,"aria-pressed":r,onClick:()=>i(e=>!e),children:r?re():e?C():D()})]})]})}function ft(){let[e,t]=(0,q.useState)(``),[n,r]=(0,q.useState)(!1),i=F(L.me.getMe,{host:G}),a=i?.ui,o=$(i?.role)&&n,c=R(L.me.setUiPref).withOptimisticUpdate(Je),l=(0,q.useMemo)(()=>a?Q(Object.keys(a.effective),e):[],[a,e]);return a?(0,J.jsxs)(`div`,{className:`oc-prefs-panel`,children:[$(i?.role)?(0,J.jsxs)(`label`,{className:`oc-prefs__gov-toggle`,children:[(0,J.jsx)(K,{checked:n,onCheckedChange:e=>r(e===!0),"aria-label":N()}),N()]}):null,o?(0,J.jsxs)(`div`,{className:`oc-prefs__gov-head`,children:[(0,J.jsx)(`p`,{children:j()}),(0,J.jsx)(`p`,{children:Ce()}),(0,J.jsx)(`p`,{children:ke()})]}):null,(0,J.jsx)(W,{value:e,onChange:e=>t(e.target.value),placeholder:B(),"aria-label":B(),className:`mb-2`}),l.length===0?(0,J.jsx)(`div`,{className:`oc-prefs__empty`,children:s()}):(0,J.jsx)(`div`,{className:`oc-prefs`,children:l.map(e=>(0,J.jsxs)(`section`,{className:`oc-prefs__card`,children:[(0,J.jsx)(`h4`,{className:`oc-prefs__cat`,children:e.label}),e.keys.map(e=>{let t=X[e],n=t?t.label():e,r=t?.help?.(),i=a.locked[e],s=a.effective[e],l=a.userOverrides[e]!==void 0;return(0,J.jsxs)(`div`,{className:`oc-prefs__row${i?` is-locked`:``}`,children:[(0,J.jsxs)(`div`,{className:`oc-prefs__info`,children:[(0,J.jsxs)(`span`,{className:`oc-prefs__label`,children:[n,i?(0,J.jsx)(H,{variant:`outline`,children:y()}):l?(0,J.jsx)(H,{variant:`secondary`,children:Ae()}):null]}),r?(0,J.jsx)(`span`,{className:`oc-prefs__help`,children:r}):null]}),(0,J.jsxs)(`div`,{className:`oc-prefs__ctl`,children:[!i&&l?(0,J.jsx)(`button`,{type:`button`,className:`oc-prefs__reset`,onClick:()=>void c({key:e,value:null}),children:ze()}):null,(0,J.jsx)(nt,{checked:s,disabled:i,onCheckedChange:t=>{e===`notifSystem`&&t&&typeof Notification<`u`&&Notification.permission==="default"&&Notification.requestPermission(),c({key:e,value:t})},"aria-label":n})]}),o?(0,J.jsx)(ut,{prefKey:e,ui:a}):null]},e)})]},e.id))}),(0,J.jsx)(dt,{current:i?.dictationShortcut??null,enabled:a.effective.voiceInput===!0})]}):(0,J.jsx)(`div`,{className:`oc-prefs__empty`,children:Me()})}var pt={sm:()=>c(),md:()=>u(),lg:()=>b(),xl:()=>Le(),"2xl":()=>o(),"3xl":()=>v()};function mt(){let e=F(L.me.getMe,{host:G}),t=R(L.me.setLocale),n=R(L.me.setTimezone),i=R(L.me.setFontScale).withOptimisticUpdate((e,{scale:t})=>{let n=e.getQuery(L.me.getMe,{host:G});n&&e.setQuery(L.me.getMe,{host:G},{...n,fontScale:t,resolvedFontScale:t??`md`})}),a=R(L.me.setMyName),o=Ke(),s=e?.locale??`default`,c=e?.name??``,[l,u]=(0,q.useState)(null),d=l??c,p=d.trim()!==c.trim();async function m(){try{await a({name:d}),u(null),o.success(f())}catch(e){o.error(ye(),e)}}return(0,J.jsxs)(`div`,{className:`oc-appearance`,children:[(0,J.jsxs)(`section`,{className:`oc-show__section`,children:[(0,J.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,J.jsx)(`h2`,{className:`oc-show__title`,children:He()}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:g()})]}),(0,J.jsxs)(`div`,{className:`oc-show__row`,children:[(0,J.jsx)(W,{className:`max-w-xs`,value:d,maxLength:120,placeholder:ue(),onChange:e=>u(e.target.value),onKeyDown:e=>{e.key===`Enter`&&p&&(e.preventDefault(),m())}}),(0,J.jsx)(V,{size:`sm`,disabled:!p,onClick:()=>void m(),children:me()})]}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:ie()})]}),(0,J.jsxs)(`section`,{className:`oc-show__section`,children:[(0,J.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,J.jsx)(`h2`,{className:`oc-show__title`,children:he()}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:fe()})]}),(0,J.jsxs)(`div`,{className:`oc-show__row`,children:[et().map(e=>(0,J.jsx)(V,{variant:s===e.value?`default`:`outline`,size:`sm`,onClick:()=>void t({locale:e.value}),children:e.label},e.value)),(0,J.jsx)(V,{variant:s==="default"?`default`:`outline`,size:`sm`,onClick:()=>void t({locale:null}),children:te()})]}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:Te()})]}),(0,J.jsxs)(`section`,{className:`oc-show__section`,children:[(0,J.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,J.jsx)(`h2`,{className:`oc-show__title`,children:Re()}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:M()})]}),(0,J.jsxs)(`div`,{className:`oc-show__row`,children:[(0,J.jsx)(tt,{value:e?.timezone??``,onChange:e=>void n({timezone:e})}),(0,J.jsx)(V,{variant:e?.timezone===null||e?.timezone===void 0?`default`:`outline`,size:`sm`,onClick:()=>void n({timezone:null}),children:Be()})]}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:Ie()})]}),(0,J.jsxs)(`section`,{className:`oc-show__section`,children:[(0,J.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,J.jsx)(`h2`,{className:`oc-show__title`,children:r()}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:De()})]}),(0,J.jsx)(`div`,{className:`oc-show__row`,children:$e.map(t=>(0,J.jsx)(V,{variant:(e?.fontScale??`md`)===t?`default`:`outline`,size:`sm`,onClick:()=>void i({scale:t}),children:pt[t]()},t))}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:_e()})]}),(0,J.jsxs)(`section`,{className:`oc-show__section`,children:[(0,J.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,J.jsx)(`h2`,{className:`oc-show__title`,children:A()}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:Se()})]}),(0,J.jsx)(ft,{})]})]})}export{mt as PreferencesTab};
@@ -0,0 +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,Cx as o,D as s,Dx as c,Eb as l,Ex as u,Fx as d,Gb as f,Hb as p,Ib as m,Ix as h,Jb as g,Lb as ee,Mb as te,Nb as _,Ob as v,Pb as y,Px as ne,Qb as b,Rb as re,Ub as x,Wb as ie,Xb as S,Yb as ae,Zb as oe,_x as se,ax as ce,bx as le,cx as C,dx as w,ex as ue,fx as de,gr as fe,hr as pe,hx as T,ix as me,jb as he,jv as ge,kb as _e,kx as E,lx as ve,mx as D,nU as O,nx as k,ox as A,px as ye,qH as j,qb as be,rx as xe,sx as Se,t as M,tU as N,tx as P,vx as Ce,xx as we,yx as Te}from"./api-D7og-4qA.js";import{t as Ee}from"./list-CJY1g2_K.js";import{t as F}from"./button-Ch1cRvCe.js";import{A as De,An as Oe,C as ke,Cn as Ae,D as I,Dt as je,E as Me,En as Ne,Fn as Pe,Ft as Fe,It as Ie,J as Le,Jn as Re,Kn as L,Lt as ze,Mn as Be,Mt as Ve,Nn as He,Nt as Ue,O as R,P as We,Pn as Ge,Pt as z,S as Ke,T as qe,Tn as Je,U as Ye,Un as B,Vn as Xe,W as Ze,Y as Qe,_ as $e,b as V,bn as H,d as et,dn as tt,f as U,g as nt,h as W,j as G,jn as rt,jt as K,k as it,m as at,p as ot,qn as st,v as q,w as ct,x as J,xn as lt,y as ut,yn as dt}from"./index-Dn5iHsqH.js";var ft=s(`columns-3`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M9 3v18`,key:`fh3hqa`}],[`path`,{d:`M15 3v18`,key:`14nvp0`}]]),pt=s(`folder-input`,[[`path`,{d:`M2 9V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2v-1`,key:`fm4g5t`}],[`path`,{d:`M2 13h10`,key:`pgb2dq`}],[`path`,{d:`m9 16 3-3-3-3`,key:`6m91ic`}]]),mt=s(`layout-grid`,[[`rect`,{width:`7`,height:`7`,x:`3`,y:`3`,rx:`1`,key:`1g98yp`}],[`rect`,{width:`7`,height:`7`,x:`14`,y:`3`,rx:`1`,key:`6d4xhi`}],[`rect`,{width:`7`,height:`7`,x:`14`,y:`14`,rx:`1`,key:`nxv5o0`}],[`rect`,{width:`7`,height:`7`,x:`3`,y:`14`,rx:`1`,key:`1bb6yr`}]]),Y=s(`panel-left`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M9 3v18`,key:`fh3hqa`}]]),X=t(e(),1),Z=n();function ht({className:e}){return(0,Z.jsx)(ze,{asChild:!0,children:(0,Z.jsx)(F,{variant:`ghost`,size:`icon-xs`,"aria-label":y(),className:e,onClick:e=>e.stopPropagation(),onMouseDown:e=>e.stopPropagation(),onTouchStart:e=>e.stopPropagation(),onPointerDown:e=>e.stopPropagation(),children:(0,Z.jsx)(Pe,{})})})}function Q({folderId:e,name:t,color:n,currentParentId:r,className:a,onOpen:o}){let s=N(M.projects.renameProject),c=N(M.projects.setProjectColor),l=N(M.projects.moveProject),f=N(M.projects.deleteProject),g=N(M.projects.createProject),te=Ye(),v=Ze(),[y,b]=(0,X.useState)(!1),[re,x]=(0,X.useState)(t),[S,ae]=(0,X.useState)(!1),[oe,ce]=(0,X.useState)(!1),w=O(M.projects.projectTreeCount,oe?{projectId:e}:`skip`);return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(Ve,{onOpenChange:e=>e&&ce(!0),children:[(0,Z.jsx)(ht,{className:a}),(0,Z.jsxs)(Ue,{align:`end`,className:`w-48`,onClick:e=>e.stopPropagation(),children:[(0,Z.jsxs)(z,{onSelect:()=>o(),children:[(0,Z.jsx)(Be,{}),` `,se()]}),(0,Z.jsxs)(z,{onSelect:()=>{x(t),b(!0)},children:[(0,Z.jsx)(lt,{}),` `,_()]}),(0,Z.jsxs)(z,{onSelect:()=>{requestAnimationFrame(async()=>{let t=await v({title:C(),label:h(),placeholder:d(),confirmLabel:ne()});t&&await g({name:t,parentId:e})})},children:[(0,Z.jsx)(rt,{}),` `,C()]}),(0,Z.jsxs)(z,{onSelect:()=>ae(!0),children:[(0,Z.jsx)(pt,{}),` `,ie()]}),(0,Z.jsx)(Fe,{children:i()}),(0,Z.jsxs)(`div`,{className:`oc-colorgrid`,onClick:e=>e.stopPropagation(),children:[(0,Z.jsx)(`button`,{className:`oc-colorgrid__none`,onClick:()=>void c({projectId:e,color:null}),"aria-label":_e(),children:`✕`}),at.map(t=>(0,Z.jsx)(`button`,{className:`oc-colorgrid__dot`+(n===t.value?` is-selected`:``),style:{background:t.hue},"aria-label":t.value,onClick:()=>void c({projectId:e,color:t.value})},t.value))]}),(0,Z.jsx)(Ie,{}),(0,Z.jsxs)(z,{variant:`destructive`,onSelect:()=>{requestAnimationFrame(async()=>{let n=w?.folders??0,r=w?.chats??0;await te({title:le({name:t}),description:n>0?Ce({folders:n,chats:r}):r>0?Te({count:r}):ee(),confirmWord:m(),confirmLabel:we(),destructive:!0})&&await f({projectId:e})})},children:[(0,Z.jsx)(tt,{}),` `,m()]})]})]}),(0,Z.jsx)($e,{open:y,onOpenChange:b,title:u(),canSubmit:re.trim().length>0,onSubmit:async()=>{await s({projectId:e,name:re.trim()}),b(!1)},submitLabel:_(),children:(0,Z.jsx)(K,{value:re,onChange:e=>x(e.target.value),autoFocus:!0})}),S?(0,Z.jsx)(ot,{open:S,onOpenChange:ae,title:p(),movingFolderId:e,currentId:r,onPick:t=>void l({projectId:e,parentId:t})}):null]})}function gt({chat:e,currentFolderId:t,className:n}){let r=N(M.chats.pinChat),i=N(M.chats.deleteChat),a=N(M.chats.renameChat),o=N(M.chats.setChatSidebar),s=N(M.chats.moveChatToProject),c=Ye(),[u,d]=(0,X.useState)(!1),[p,h]=(0,X.useState)(e.title??``),[g,y]=(0,X.useState)(!1);return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(Ve,{children:[(0,Z.jsx)(ht,{className:n}),(0,Z.jsxs)(Ue,{align:`end`,className:`w-52`,onClick:e=>e.stopPropagation(),children:[(0,Z.jsxs)(z,{onSelect:()=>{h(e.title??``),d(!0)},children:[(0,Z.jsx)(lt,{}),` `,_()]}),(0,Z.jsxs)(z,{onSelect:()=>void r({chatId:e._id,pinned:!e.pinned}),children:[e.pinned?(0,Z.jsx)(dt,{}):(0,Z.jsx)(H,{}),e.pinned?te():he()]}),(0,Z.jsxs)(z,{onSelect:()=>y(!0),children:[(0,Z.jsx)(pt,{}),` `,f()]}),e.pinned&&e.inSidebar?null:(0,Z.jsxs)(z,{onSelect:()=>void o({chatId:e._id,hidden:e.inSidebar}),children:[e.inSidebar?(0,Z.jsx)(Ae,{}):(0,Z.jsx)(Y,{}),e.inSidebar?D():T()]}),(0,Z.jsx)(Ie,{}),(0,Z.jsxs)(z,{variant:`destructive`,onSelect:()=>{requestAnimationFrame(async()=>{await c({title:v(),description:ee(),confirmLabel:m(),destructive:!0})&&await i({chatId:e._id})})},children:[(0,Z.jsx)(tt,{}),` `,m()]})]})]}),(0,Z.jsx)($e,{open:u,onOpenChange:d,title:l(),canSubmit:p.trim().length>0,onSubmit:async()=>{await a({chatId:e._id,title:p.trim()}),d(!1)},submitLabel:_(),children:(0,Z.jsx)(K,{value:p,onChange:e=>h(e.target.value),autoFocus:!0})}),g?(0,Z.jsx)(ot,{open:g,onOpenChange:y,title:x(),currentId:t,onPick:t=>void s({chatId:e._id,projectId:t})}):null]})}function _t(e,t){let n=t.trim().toLowerCase();return n===``?e:e.filter(e=>(e.title??``).toLowerCase().includes(n))}function vt(e,t,n,r,i){let a=e.map(t),o=a.indexOf(i);if(o<0)return null;let s=a.indexOf(r);if(s>=0){let t=[...e],[r]=t.splice(s,1);t.splice(o,0,r);let i=t[o-1],a=t[o+1];return{prevKey:i===void 0?null:n(i),nextKey:a===void 0?null:n(a)}}let c=e[o-1];return{prevKey:c===void 0?null:n(c),nextKey:n(e[o])}}function yt(e,t){let n=new Map(t.map(e=>[e.chatId,e.lastSeenAt])),r=new Set;for(let t of e){let e=n.get(t._id);e!==void 0&&t.lastAssistantAt!==null&&t.lastAssistantAt>e&&r.add(t._id)}return r}var bt=`oc.projpage.view`;function xt(){let e=localStorage.getItem(bt);return e===`cards`||e===`list`?e:`columns`}var $=e=>`into:${e}`,St=e=>`col:${e??`null`}`,Ct=e=>`crumb:${e}`;function wt(e){if(e.startsWith(`into:`))return e.slice(5);if(e.startsWith(`crumb:`))return e.slice(6);if(e.startsWith(`col:`)){let t=e.slice(4);return t===`null`?null:t}}function Tt(){let{projectId:e}=Re({from:`/project/$projectId`}),t=L(),n=O(M.projects.projectPage,{projectId:e});return(0,Z.jsx)(`div`,{className:`oc-projpage`,children:n===void 0?(0,Z.jsx)(`p`,{className:`oc-projpage__hint`,children:j()}):n===null?(0,Z.jsxs)(`div`,{className:`oc-projpage__notfound`,children:[(0,Z.jsx)(`h2`,{children:S()}),(0,Z.jsx)(`p`,{className:`oc-projpage__hint`,children:ae()}),(0,Z.jsx)(F,{variant:`outline`,onClick:()=>void t({to:`/`}),children:g()})]}):(0,Z.jsx)(Et,{page:n})})}function Et({page:e}){let t=L(),n=Ye(),o=Ze(),s=je(),l=N(M.projects.renameProject),f=N(M.projects.setProjectColor),g=N(M.projects.deleteProject),te=N(M.projects.createProject),v=N(M.projects.moveProject),y=N(M.projects.setProjectSidebar),x=N(M.chats.moveChatToProject),S=N(M.chats.reorderChat),ae=N(M.projects.reorderProject),se=O(M.projects.projectTreeCount,{projectId:e.project._id}),[T,he]=(0,X.useState)(xt),E=e=>{localStorage.setItem(bt,e),he(e)},D=O(M.projects.folderColumns,T===`columns`?{projectId:e.project._id}:`skip`),k=O(M.projects.projectTreeList,T===`list`?{projectId:e.project._id}:`skip`),{c:A}=st({from:`/project/$projectId`}),j=O(M.projects.listProjects,{}),Se=O(M.chatReads.myBusyChats,{}),P=(0,X.useMemo)(()=>new Set(Se??[]),[Se]),Ae=O(M.chatReads.myChatReads,{}),Re=(0,X.useMemo)(()=>yt(e.chats,Ae??[]),[e.chats,Ae]),{startNewChat:Be,picker:R}=et(e=>void t({to:`/chat/$chatId`,params:{chatId:e}})),[B,Xe]=(0,X.useState)(``),[V,H]=(0,X.useState)(!1),[U,W]=(0,X.useState)(e.project.name),[G,dt]=(0,X.useState)(!1),[Y,ht]=(0,X.useState)(``);(0,X.useEffect)(()=>{let e=setTimeout(()=>ht(B.trim()),180);return()=>clearTimeout(e)},[B]);let Q=O(M.search.searchConversations,Y.length>=2?{query:Y,projectId:e.project._id}:`skip`),gt=De(it(ct,{activationConstraint:{distance:4}}),it(qe,{activationConstraint:{delay:250,tolerance:8}})),$=(0,X.useRef)(!1),St=()=>{$.current=!0,setTimeout(()=>{$.current=!1},0)},[Ct,Tt]=(0,X.useState)(null),Et=t=>{if(t.startsWith(`chat:`)){let n=t.slice(5),r=e.chats.find(e=>e._id===n),i=D?.columns.flatMap(e=>e.chats).find(e=>e._id===n);return{kind:`chat`,label:(r??i)?.title||a()}}if(t.startsWith(`folder:`)){let e=t.slice(7);return{kind:`folder`,label:(j??[]).find(t=>t._id===e)?.name??``}}return null},kt=e=>Tt(Et(String(e.active.id))),jt=(0,X.useCallback)(e=>{let t=String(e.active.id).startsWith(`folder:`),n=t=>({...e,droppableContainers:e.droppableContainers.filter(e=>String(e.id).startsWith(t))}),r=I(n(`into:`));if(r.length>0){if(!t)return r;let n=r[0],i=e.droppableRects.get(n.id),a=e.pointerCoordinates?.y;if(i&&a!=null){let e=i.height*.3;if(a>i.top+e&&a<i.top+i.height-e)return r}}let i=I(n(t?`folder:`:`chat:`));if(i.length>0)return i;let a=I(n(`crumb:`));if(a.length>0)return a;let o=I(n(`col:`));return o.length>0?o:Me(n(t?`folder:`:`chat:`))},[]),Nt=t=>{if(T===`columns`){for(let e of D?.columns??[])if(e.chats.some(e=>e._id===t))return{list:e.chats,folderId:e.folderId};return null}if(T===`list`){let e=k?.chats.find(e=>e._id===t);return e?{list:k.chats.filter(t=>t.folderId===e.folderId),folderId:e.folderId}:null}return e.chats.some(e=>e._id===t)?{list:e.chats,folderId:e.project._id}:null},Pt=t=>{if(T===`columns`){for(let e of D?.columns??[])if(e.folders.some(e=>e._id===t))return{list:e.folders,parentId:e.folderId};return null}if(T===`list`){let e=k?.folders.find(e=>e._id===t);if(!e||!k)return null;let n=e.parentId??k.rootId;return{list:Qe(k.folders,e.parentId),parentId:n}}return e.children.some(e=>e._id===t)?{list:e.children,parentId:e.project._id}:null},It=async e=>{Tt(null),St();let{active:t,over:n}=e;if(!n)return;let r=String(n.id),i=String(t.id),a=i.startsWith(`chat:`);try{let e=wt(r);if(e!==void 0){if(a)await x({chatId:i.slice(5),projectId:e});else{let t=i.slice(7);if(t===e)return;if(!Le(j??[],t,e)){s.error(ve());return}await v({projectId:t,parentId:e})}return}if(a&&r.startsWith(`chat:`)){let e=i.slice(5),t=r.slice(5);if(e===t)return;let n=Nt(t);if(!n)return;n.list.some(t=>t._id===e)||await x({chatId:e,projectId:n.folderId});let a=vt(n.list,e=>e._id,e=>e.sortKey,e,t);a&&await S({chatId:e,...a});return}if(!a&&r.startsWith(`folder:`)){let e=i.slice(7),t=r.slice(7);if(e===t)return;let n=Pt(t);if(!n)return;if(!n.list.some(t=>t._id===e)){if(!Le(j??[],e,n.parentId)){s.error(ve());return}await v({projectId:e,parentId:n.parentId})}let a=vt(n.list,e=>e._id,e=>e.sortKey,e,t);a&&await ae({projectId:e,...a});return}}catch{s.error(ve())}},[,Lt]=(0,X.useState)(0);(0,X.useEffect)(()=>{let e=window.setInterval(()=>Lt(e=>e+1),6e4);return()=>window.clearInterval(e)},[]);let Rt=Date.now(),zt=nt(e.project),Bt=_t(e.chats,B),Vt=e.breadcrumb.slice(0,-1),Ht=e=>()=>{$.current||e()};return(0,Z.jsxs)(Ke,{sensors:gt,collisionDetection:jt,onDragStart:kt,onDragEnd:It,children:[(0,Z.jsxs)(`div`,{className:`oc-projpage__body`,style:{"--proj-hue":zt},children:[(0,Z.jsxs)(`nav`,{className:`oc-projpage__crumbs`,"aria-label":be(),children:[Vt.map(e=>(0,Z.jsxs)(`span`,{className:`oc-projpage__crumb`,children:[(0,Z.jsx)(Dt,{folderId:e._id,children:(0,Z.jsx)(`button`,{type:`button`,className:`oc-projpage__crumblink`,onClick:Ht(()=>void t({to:`/project/$projectId`,params:{projectId:e._id}})),children:e.name})}),(0,Z.jsx)(`span`,{className:`oc-projpage__crumbsep`,"aria-hidden":!0,children:`›`})]},e._id)),(0,Z.jsx)(`span`,{className:`oc-projpage__crumbcur`,children:e.project.name})]}),(0,Z.jsxs)(`header`,{className:`oc-projpage__head`,children:[(0,Z.jsx)(`span`,{className:`oc-projpage__dot`,"aria-hidden":!0}),(0,Z.jsx)(`h1`,{className:`oc-projpage__title`,children:e.project.name}),e.project.sidebarHidden?(0,Z.jsxs)(F,{variant:`ghost`,size:`sm`,className:`oc-projpage__hiddenbadge`,title:fe(),onClick:()=>{y({projectId:e.project._id,hidden:!1})},children:[(0,Z.jsx)(Ge,{"aria-hidden":!0}),(0,Z.jsx)(`span`,{children:pe()}),(0,Z.jsx)(He,{"aria-hidden":!0})]}):null,(0,Z.jsxs)(`div`,{className:`oc-projpage__actions`,children:[(0,Z.jsxs)(`div`,{className:`oc-projpage__viewtoggle`,role:`group`,"aria-label":ye(),children:[(0,Z.jsx)(F,{variant:T===`cards`?`secondary`:`ghost`,size:`icon-sm`,"aria-label":ye(),title:ye(),"aria-pressed":T===`cards`,onClick:()=>E(`cards`),children:(0,Z.jsx)(mt,{})}),(0,Z.jsx)(F,{variant:T===`columns`?`secondary`:`ghost`,size:`icon-sm`,"aria-label":de(),title:de(),"aria-pressed":T===`columns`,onClick:()=>E(`columns`),children:(0,Z.jsx)(ft,{})}),(0,Z.jsx)(F,{variant:T===`list`?`secondary`:`ghost`,size:`icon-sm`,"aria-label":w(),title:w(),"aria-pressed":T===`list`,onClick:()=>E(`list`),children:(0,Z.jsx)(Ee,{})})]}),(0,Z.jsxs)(F,{variant:`outline`,size:`sm`,onClick:()=>void Be({projectId:e.project._id}),children:[(0,Z.jsx)(Ne,{}),xe()]}),(0,Z.jsxs)(F,{variant:`outline`,size:`sm`,onClick:async()=>{let t=await o({title:C(),label:h(),placeholder:d(),confirmLabel:ne()});t&&await te({name:t,parentId:e.project._id})},children:[(0,Z.jsx)(rt,{}),C()]}),(0,Z.jsxs)(Ve,{children:[(0,Z.jsx)(ze,{asChild:!0,children:(0,Z.jsx)(F,{variant:`ghost`,size:`icon-sm`,"aria-label":c(),children:(0,Z.jsx)(Pe,{})})}),(0,Z.jsxs)(Ue,{align:`end`,className:`w-48`,children:[(0,Z.jsxs)(z,{onSelect:()=>{W(e.project.name),H(!0)},children:[(0,Z.jsx)(lt,{}),` `,_()]}),(0,Z.jsxs)(z,{onSelect:()=>dt(!0),children:[(0,Z.jsx)(pt,{}),` `,ie()]}),(0,Z.jsx)(Fe,{children:i()}),(0,Z.jsxs)(`div`,{className:`oc-colorgrid`,children:[(0,Z.jsx)(`button`,{className:`oc-colorgrid__none`,onClick:()=>void f({projectId:e.project._id,color:null}),"aria-label":_e(),children:`✕`}),at.map(t=>(0,Z.jsx)(`button`,{className:`oc-colorgrid__dot`+(e.project.color===t.value?` is-selected`:``),style:{background:t.hue},"aria-label":t.value,onClick:()=>void f({projectId:e.project._id,color:t.value})},t.value))]}),(0,Z.jsx)(Ie,{}),(0,Z.jsxs)(z,{variant:`destructive`,onSelect:()=>{let r=e.project.parentId;requestAnimationFrame(async()=>{let i=se?.folders??0,a=se?.chats??0;await n({title:le({name:e.project.name}),description:i>0?Ce({folders:i,chats:a}):a>0?Te({count:a}):ee(),confirmWord:m(),confirmLabel:we(),destructive:!0})&&(await g({projectId:e.project._id}),t(r===null?{to:`/`}:{to:`/project/$projectId`,params:{projectId:r}}))})},children:[(0,Z.jsx)(tt,{}),` `,m()]})]})]})]})]}),T===`columns`?(0,Z.jsx)(Ft,{data:D,currentId:e.project._id,busyIds:P,suppressClick:$,locateChatId:A??null}):T===`list`?(0,Z.jsx)(Mt,{data:k,busyIds:P,suppressClick:$,locateChatId:A??null}):(0,Z.jsxs)(Z.Fragment,{children:[e.children.length>0?(0,Z.jsxs)(`section`,{className:`oc-projpage__section`,children:[(0,Z.jsx)(`h2`,{className:`oc-projpage__subtitle`,children:ce()}),(0,Z.jsx)(`div`,{className:`oc-projpage__cards`,children:(0,Z.jsx)(q,{items:e.children.map(e=>`folder:${e._id}`),strategy:ut,children:e.children.map(t=>(0,Z.jsx)(Ot,{child:t,parentId:e.project._id,now:Rt,suppressClick:$},t._id))})})]}):null,(0,Z.jsxs)(`section`,{className:`oc-projpage__section`,children:[(0,Z.jsxs)(`div`,{className:`oc-projpage__convhead`,children:[(0,Z.jsx)(`h2`,{className:`oc-projpage__subtitle`,children:me()}),e.chats.length>0?(0,Z.jsx)(K,{value:B,onChange:e=>Xe(e.target.value),placeholder:ue(),className:`oc-projpage__filter`}):null]}),e.chats.length===0?(0,Z.jsx)(`p`,{className:`oc-projpage__hint`,children:e.children.length===0?b():oe()}):Bt.length===0&&(Q??[]).length===0?(0,Z.jsx)(`p`,{className:`oc-projpage__hint`,children:r({term:B.trim()})}):(0,Z.jsx)(`ul`,{className:`oc-projpage__chats`,children:(0,Z.jsx)(q,{items:Bt.map(e=>`chat:${e._id}`),strategy:J,children:Bt.map(t=>(0,Z.jsx)(At,{chat:t,currentFolderId:e.project._id,now:Rt,busy:P.has(t._id),unread:Re.has(t._id),locate:t._id===A,suppressClick:$},t._id))})})]}),Y.length>=2&&Q!==void 0?(0,Z.jsxs)(`section`,{className:`oc-projpage__section`,children:[(0,Z.jsx)(`h2`,{className:`oc-projpage__subtitle`,children:re()}),Q.length===0?(0,Z.jsx)(`p`,{className:`oc-projpage__hint`,children:r({term:Y})}):(0,Z.jsx)(`ul`,{className:`oc-projpage__chats`,children:Q.map(e=>(0,Z.jsx)(`li`,{className:`oc-projpage__chatrow`,children:(0,Z.jsxs)(`button`,{type:`button`,className:`oc-projpage__chatbtn`,onClick:()=>{e.messageId&&Y&&We(e.messageId,Y),t({to:`/chat/$chatId`,params:{chatId:e.chatId},...e.messageId?{search:{m:e.messageId}}:{}})},children:[(0,Z.jsx)(Je,{size:13,"aria-hidden":!0,className:`oc-projpage__hitico`}),(0,Z.jsxs)(`span`,{className:`oc-projpage__hitbody`,children:[(0,Z.jsx)(`span`,{className:`oc-projpage__chattitle`,children:e.title||ge()}),e.projectPath&&e.projectPath.length>1?(0,Z.jsx)(`span`,{className:`oc-projpage__hitpath`,children:e.projectPath.join(` › `)}):null,e.snippet?(0,Z.jsx)(`span`,{className:`oc-projpage__hitsnippet`,children:e.snippet}):null]})]})},`${e.chatId}:${e.messageId??`t`}`))})]}):null]}),(0,Z.jsx)($e,{open:V,onOpenChange:H,title:u(),canSubmit:U.trim().length>0,onSubmit:async()=>{await l({projectId:e.project._id,name:U.trim()}),H(!1)},submitLabel:_(),children:(0,Z.jsx)(K,{value:U,onChange:e=>W(e.target.value),autoFocus:!0})}),G?(0,Z.jsx)(ot,{open:G,onOpenChange:dt,title:p(),movingFolderId:e.project._id,currentId:e.project.parentId,onPick:t=>void v({projectId:e.project._id,parentId:t})}):null,R]}),(0,Z.jsx)(ke,{children:Ct?(0,Z.jsxs)(`div`,{className:`oc-projpage__dragghost`,children:[Ct.kind===`folder`?(0,Z.jsx)(Oe,{size:13,"aria-hidden":!0}):(0,Z.jsx)(Je,{size:13,"aria-hidden":!0}),(0,Z.jsx)(`span`,{children:Ct.label})]}):null})]})}function Dt({folderId:e,children:t}){let{setNodeRef:n,isOver:r}=R({id:Ct(e)});return(0,Z.jsx)(`span`,{ref:n,className:r?`oc-projpage__cdrop is-over`:`oc-projpage__cdrop`,children:t})}function Ot({child:e,parentId:t,now:n,suppressClick:r}){let i=L(),a=V({id:`folder:${e._id}`}),o=R({id:$(e._id)});return(0,Z.jsxs)(`div`,{ref:e=>{a.setNodeRef(e),o.setNodeRef(e)},className:`oc-projpage__card`+(o.isOver?` is-over`:``)+(a.isDragging?` is-dragging`:``),style:{"--proj-hue":nt(e),transform:G.Transform.toString(a.transform),transition:a.transition},onClick:()=>{r.current||i({to:`/project/$projectId`,params:{projectId:e._id}})},onKeyDown:t=>{t.key===`Enter`&&i({to:`/project/$projectId`,params:{projectId:e._id}})},...a.listeners,...a.attributes,role:`link`,tabIndex:0,children:[(0,Z.jsxs)(`span`,{className:`oc-projpage__cardhead`,children:[(0,Z.jsx)(Oe,{size:15,"aria-hidden":!0,className:`oc-projpage__cardico`}),(0,Z.jsx)(`span`,{className:`oc-projpage__cardname`,children:e.name}),(0,Z.jsx)(Q,{folderId:e._id,name:e.name,color:e.color,currentParentId:t,className:`oc-projpage__cardmenu`,onOpen:()=>void i({to:`/project/$projectId`,params:{projectId:e._id}})})]}),(0,Z.jsxs)(`span`,{className:`oc-projpage__cardmeta`,children:[e.folderCount>0?k({count:e.folderCount})+` · `:``,P({count:e.recursiveChatCount})]}),e.lastActivityAt===null?null:(0,Z.jsx)(`span`,{className:`oc-projpage__cardage`,children:U(e.lastActivityAt,n)})]})}function kt({chat:e}){let t=N(M.chats.setChatSidebar),n=e.inSidebar?D():T();return(0,Z.jsx)(F,{variant:`ghost`,size:`icon-xs`,"aria-label":n,title:n,className:`oc-projpage__barbtn`+(e.inSidebar?` is-on`:``),disabled:e.pinned&&e.inSidebar,onClick:n=>{n.stopPropagation(),t({chatId:e._id,hidden:e.inSidebar})},children:e.inSidebar?(0,Z.jsx)(Ae,{}):(0,Z.jsx)(Y,{})})}function At({chat:e,currentFolderId:t,now:n,busy:r,unread:i,locate:s,suppressClick:c}){let l=L(),u=W(e.color),d=V({id:`chat:${e._id}`}),f=jt(s);return(0,Z.jsxs)(`li`,{ref:e=>{d.setNodeRef(e),f.current=e},className:`oc-projpage__chatrow`+(d.isDragging?` is-dragging`:``)+(s?` is-locate`:``),style:{transform:G.Transform.toString(d.transform),transition:d.transition},children:[(0,Z.jsxs)(`button`,{type:`button`,className:`oc-projpage__chatbtn`,onClick:()=>{c.current||l({to:`/chat/$chatId`,params:{chatId:e._id}})},...d.listeners,...d.attributes,children:[u?(0,Z.jsx)(`span`,{className:`oc-chatitem__dot`,style:{background:u}}):(0,Z.jsx)(`span`,{className:`oc-chatitem__dot oc-chatitem__dot--empty`}),(0,Z.jsx)(`span`,{className:`oc-projpage__chattitle`,children:e.title||a()}),e.pinned?(0,Z.jsx)(H,{size:12,"aria-hidden":!0,className:`oc-projpage__chatpin`}):null,(0,Z.jsx)(`span`,{className:`oc-projpage__chatage`,children:U(e.updatedAt,n)}),r?(0,Z.jsx)(`span`,{className:`oc-chatitem__busy`,title:E(),"aria-label":E()}):null,i&&!r?(0,Z.jsx)(`span`,{className:`oc-chatitem__unread`,title:o(),"aria-label":o()}):null]}),(0,Z.jsx)(kt,{chat:e}),(0,Z.jsx)(gt,{chat:e,currentFolderId:t,className:`oc-projpage__chatmenu`})]})}function jt(e){let t=(0,X.useRef)(null);return(0,X.useEffect)(()=>{e&&t.current&&t.current.scrollIntoView({block:`center`})},[e]),t}function Mt({data:e,busyIds:t,suppressClick:n,locateChatId:r}){let[i,a]=(0,X.useState)(new Set),o=(0,X.useMemo)(()=>{let t=new Map;for(let n of e?.chats??[]){let e=t.get(n.folderId);e===void 0?t.set(n.folderId,[n]):e.push(n)}return t},[e]);if(e===void 0)return(0,Z.jsx)(`p`,{className:`oc-projpage__hint`,children:j()});if(e===null)return null;let s=e=>a(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n}),c=(a,l)=>{let u=o.get(a??e.rootId)??[],d=Qe(e.folders,a);return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(q,{items:u.map(e=>`chat:${e._id}`),strategy:J,children:u.map(e=>(0,Z.jsx)(Pt,{chat:e,depth:l,busy:t.has(e._id),locate:e._id===r,suppressClick:n},e._id))}),(0,Z.jsx)(q,{items:d.map(e=>`folder:${e._id}`),strategy:J,children:d.map(t=>(0,Z.jsx)(Nt,{folder:t,parentId:a??e.rootId,depth:l,folded:i.has(t._id),onToggle:()=>s(t._id),suppressClick:n,children:i.has(t._id)?null:c(t._id,l+1)},t._id))})]})};return(0,Z.jsx)(`div`,{className:`oc-projpage__tree`,children:(o.get(e.rootId)??[]).length===0&&Qe(e.folders,null).length===0?(0,Z.jsx)(`p`,{className:`oc-projpage__hint`,children:b()}):c(null,0)})}function Nt({folder:e,parentId:t,depth:n,folded:r,onToggle:i,suppressClick:a,children:o}){let s=L(),c=V({id:`folder:${e._id}`}),l=R({id:$(e._id)});return(0,Z.jsxs)(`div`,{className:`oc-projpage__treegroup`,children:[(0,Z.jsxs)(`div`,{ref:e=>{c.setNodeRef(e),l.setNodeRef(e)},className:`oc-projpage__treerow oc-projpage__treerow--folder`+(l.isOver?` is-over`:``)+(c.isDragging?` is-dragging`:``),style:{"--tree-depth":n,"--proj-hue":nt(e),transform:G.Transform.toString(c.transform),transition:c.transition},...c.listeners,...c.attributes,role:`button`,tabIndex:0,onClick:()=>{a.current||s({to:`/project/$projectId`,params:{projectId:e._id}})},onKeyDown:t=>{t.key===`Enter`&&s({to:`/project/$projectId`,params:{projectId:e._id}})},children:[(0,Z.jsx)(`button`,{type:`button`,className:`oc-projpage__treechev`,"aria-label":r?Se():A(),"aria-expanded":!r,onClick:e=>{e.stopPropagation(),!a.current&&i()},onMouseDown:e=>e.stopPropagation(),onTouchStart:e=>e.stopPropagation(),children:r?(0,Z.jsx)(Xe,{size:13}):(0,Z.jsx)(B,{size:13})}),(0,Z.jsx)(Oe,{size:13,"aria-hidden":!0,className:`oc-projpage__colico`}),(0,Z.jsx)(`span`,{className:`oc-projpage__colname`,children:e.name}),(0,Z.jsx)(Q,{folderId:e._id,name:e.name,color:e.color,currentParentId:t,className:`oc-projpage__treemenu`,onOpen:()=>void s({to:`/project/$projectId`,params:{projectId:e._id}})})]}),o]})}function Pt({chat:e,depth:t,busy:n,locate:r,suppressClick:i}){let o=L(),s=V({id:`chat:${e._id}`}),c=jt(r),l=W(e.color);return(0,Z.jsxs)(`div`,{ref:e=>{s.setNodeRef(e),c.current=e},className:`oc-projpage__treerow oc-projpage__treerow--chat`+(s.isDragging?` is-dragging`:``)+(r?` is-locate`:``),style:{"--tree-depth":t,transform:G.Transform.toString(s.transform),transition:s.transition},children:[(0,Z.jsxs)(`button`,{type:`button`,className:`oc-projpage__colchatbtn`,onClick:()=>{i.current||o({to:`/chat/$chatId`,params:{chatId:e._id}})},...s.listeners,...s.attributes,children:[l?(0,Z.jsx)(`span`,{className:`oc-chatitem__dot`,style:{background:l}}):(0,Z.jsx)(`span`,{className:`oc-chatitem__dot oc-chatitem__dot--empty`}),(0,Z.jsx)(`span`,{className:`oc-projpage__colname`,children:e.title||a()}),n?(0,Z.jsx)(`span`,{className:`oc-chatitem__busy`,"aria-hidden":!0}):null]}),(0,Z.jsx)(gt,{chat:e,currentFolderId:e.folderId,className:`oc-projpage__treemenu`}),(0,Z.jsx)(kt,{chat:e})]})}function Ft({data:e,currentId:t,busyIds:n,suppressClick:r,locateChatId:i}){let a=(0,X.useRef)(null);return(0,X.useEffect)(()=>{let e=a.current;e&&(e.scrollLeft=e.scrollWidth)},[e?.columns.length??0,t]),e===void 0?(0,Z.jsx)(`p`,{className:`oc-projpage__hint`,children:j()}):(0,Z.jsx)(`div`,{className:`oc-projpage__cols`,ref:a,children:e.columns.map((a,o)=>(0,Z.jsx)(It,{col:a,isLast:o===e.columns.length-1,currentId:t,busyIds:n,suppressClick:r,locateChatId:i},a.folderId??`root`))})}function It({col:e,isLast:t,currentId:n,busyIds:r,suppressClick:i,locateChatId:a}){let o=L(),s=R({id:St(e.folderId)});return(0,Z.jsxs)(`div`,{ref:s.setNodeRef,className:`oc-projpage__col`+(s.isOver?` is-over`:``)+(t?` is-last`:``),children:[(0,Z.jsx)(q,{items:e.folders.map(e=>`folder:${e._id}`),strategy:J,children:e.folders.map(t=>(0,Z.jsx)(Lt,{folder:t,parentId:e.folderId,isCurrent:t._id===n,suppressClick:i,onOpen:()=>void o({to:`/project/$projectId`,params:{projectId:t._id}})},t._id))}),(0,Z.jsx)(q,{items:e.chats.map(e=>`chat:${e._id}`),strategy:J,children:e.chats.map(t=>(0,Z.jsx)(Rt,{chat:t,folderId:e.folderId,busy:r.has(t._id),locate:t._id===a,suppressClick:i,onOpen:()=>void o({to:`/chat/$chatId`,params:{chatId:t._id}})},t._id))}),e.folders.length===0&&e.chats.length===0?(0,Z.jsx)(`p`,{className:`oc-projpage__colempty`,children:oe()}):null]})}function Lt({folder:e,parentId:t,isCurrent:n,suppressClick:r,onOpen:i}){let a=V({id:`folder:${e._id}`}),o=R({id:$(e._id)});return(0,Z.jsxs)(`div`,{ref:e=>{a.setNodeRef(e),o.setNodeRef(e)},className:`oc-projpage__colentry oc-projpage__colentry--folder`+(e.selected||n?` is-selected`:``)+(o.isOver?` is-over`:``)+(a.isDragging?` is-dragging`:``),style:{"--proj-hue":nt(e),transform:G.Transform.toString(a.transform),transition:a.transition},onClick:()=>{r.current||i()},onKeyDown:e=>{e.key===`Enter`&&e.target===e.currentTarget&&i()},...a.listeners,...a.attributes,role:`button`,tabIndex:0,children:[(0,Z.jsx)(Oe,{size:13,"aria-hidden":!0,className:`oc-projpage__colico`}),(0,Z.jsx)(`span`,{className:`oc-projpage__colname`,children:e.name}),(0,Z.jsx)(`span`,{className:`oc-projpage__colchev`,"aria-hidden":!0,children:`›`}),(0,Z.jsx)(Q,{folderId:e._id,name:e.name,color:e.color,currentParentId:t,className:`oc-projpage__colmenu`,onOpen:i})]})}function Rt({chat:e,folderId:t,busy:n,locate:r,suppressClick:i,onOpen:o}){let s=V({id:`chat:${e._id}`}),c=jt(r),l=W(e.color);return(0,Z.jsxs)(`div`,{ref:e=>{s.setNodeRef(e),c.current=e},className:`oc-projpage__colentry oc-projpage__colentry--chat`+(s.isDragging?` is-dragging`:``)+(r?` is-locate`:``),style:{transform:G.Transform.toString(s.transform),transition:s.transition},children:[(0,Z.jsxs)(`button`,{type:`button`,className:`oc-projpage__colchatbtn`,onClick:()=>{i.current||o()},...s.listeners,...s.attributes,children:[l?(0,Z.jsx)(`span`,{className:`oc-chatitem__dot`,style:{background:l}}):(0,Z.jsx)(`span`,{className:`oc-chatitem__dot oc-chatitem__dot--empty`}),(0,Z.jsx)(`span`,{className:`oc-projpage__colname`,children:e.title||a()}),n?(0,Z.jsx)(`span`,{className:`oc-chatitem__busy`,"aria-hidden":!0}):null]}),(0,Z.jsx)(gt,{chat:e,currentFolderId:t,className:`oc-projpage__colmenu oc-projpage__colmenu--chat`}),(0,Z.jsx)(kt,{chat:e})]})}export{Tt as ProjectPage};
@@ -0,0 +1,4 @@
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$C as r,AC as i,BC as a,DC as o,Dc as s,Du as c,Ec as l,Eu as u,FC as d,GC as f,HC as p,IC as m,Ic as h,KC as g,LC as _,Lc as ee,MC as te,NC as ne,OC as v,Oc as y,Ou as b,PC as x,RC as S,Rc as C,Tc as w,Tu as T,UC as re,VC as ie,WC as ae,Xo as oe,Yo as E,Zo as D,ew as O,fr as k,jC as A,kC as j,kc as M,ku as N,nU as P,t as F,tU as I,zC as L,zc as R}from"./api-D7og-4qA.js";import{i as z,n as B,r as V,t as H}from"./FieldLabel-vGVJ37ds.js";import{t as U}from"./button-Ch1cRvCe.js";import{$ as W,Dt as se,Q as G,Qt as K,X as q,Xt as ce,Yt as J,Z as Y,Zt as le,et as X,q as ue,ut as de}from"./index-Dn5iHsqH.js";import{r as Z,t as fe}from"./locales-CPjguROj.js";import{t as pe}from"./localePickerView-C2RmOS86.js";/* empty css */var Q=t(e(),1),$=n(),me={media_delivery:{label:ie,help:a},documentary_fetch:{label:L,help:S},inbound_files:{label:_,help:m},history_summary:{label:N,help:b},file_curation:{label:R,help:M},quote_reply:{label:C,help:ee}},he={outboundDir:`/home/node/.openclaw/media/outbound`,references:`- gdrive/1a2b3c4d5e6f7890abcd
2
+ - gdrive/0f9e8d7c6b5a4321dcba`,files:`- /home/node/.openclaw/media/inbound/rapport.pdf (124800 o, application/pdf)`,previous_summary:`Projet Alpha : budget 40 000 EUR ; choix du serveur en cours.`,new_messages:`Utilisateur : Compare OVH et Scaleway.
3
+ Assistant : Comparaison en cours.`,max_chars:`6000`,file_name:`MEMORY.md`,budget_chars:`20000`,feedback:`Trop de suppressions dans la section des liens, garde-les.`,content:`# Memory index
4
+ - [Fait 1](fait-1.md) - note du projet`,excerpt:`Le classement propose trois dossiers : Clients, Fournisseurs, Interne.`},ge={outboundDir:j,references:v,files:o,previous_summary:c,new_messages:u,max_chars:T,file_name:y,budget_chars:s,feedback:l,content:w,excerpt:h};function _e(){let e=P(F.admin.listInstances,{}),[t,n]=(0,Q.useState)(null);if(e===void 0)return(0,$.jsx)(`div`,{className:`oc-settings__tab-loading`,"aria-busy":`true`});if(e.length===0)return(0,$.jsx)(`div`,{className:`oc-injtab`,children:(0,$.jsx)(`p`,{className:`oc-admin__hint`,children:x()})});let r=e.find(e=>e._id===t)??e[0];return(0,$.jsxs)(`div`,{className:`oc-injtab`,children:[(0,$.jsxs)(`div`,{className:`oc-injtab__head`,children:[(0,$.jsx)(B,{label:g(),help:f()}),(0,$.jsxs)(`label`,{className:`oc-injtab__picker`,children:[(0,$.jsx)(`span`,{children:d()}),(0,$.jsxs)(q,{value:r._id,onValueChange:e=>n(e),children:[(0,$.jsx)(W,{size:`sm`,className:`min-w-44`,children:(0,$.jsx)(X,{})}),(0,$.jsx)(Y,{children:e.map(e=>(0,$.jsx)(G,{value:e._id,children:e.displayName??e.name},e._id))})]})]})]}),(0,$.jsx)(ve,{instance:r},r._id)]})}function ve({instance:e}){let t=I(F.admin.upsertInstanceConfig),n=se(),i=P(F.me.getMe,{host:ue}),a=e.config??{},o=Z(e.config?.contentLocale,i?.defaultLocale??void 0),[s,c]=(0,Q.useState)(()=>z(a,o));(0,Q.useEffect)(()=>{c(z(a,o))},[o,e._id]);let[l,u]=(0,Q.useState)(!1),d=s.promptInjections,f=(e,t)=>c({...s,promptInjections:{...d,[e]:{...d[e],...t}}});async function p(){u(!0);try{await t({instanceId:e._id,config:V(s,a,o)})}catch(e){n.error(r(),e)}finally{u(!1)}}async function m(i){let a={...e.config??{}};i==="default"?delete a.contentLocale:a.contentLocale=i;try{await t({instanceId:e._id,config:a})}catch(e){n.error(r(),e)}}let h=e.config?.contentLocale??`default`,g=fe[Z(void 0,i?.defaultLocale??void 0)];return(0,$.jsxs)(`div`,{className:`oc-injtab__body`,children:[(0,$.jsxs)(`div`,{className:`oc-injtab__content-locale`,children:[(0,$.jsx)(`span`,{children:D()}),(0,$.jsxs)(q,{value:h,onValueChange:e=>void m(e),children:[(0,$.jsx)(W,{size:`sm`,className:`min-w-44`,children:(0,$.jsx)(X,{})}),(0,$.jsxs)(Y,{children:[(0,$.jsx)(G,{value:`default`,children:E({locale:g})}),pe().map(e=>(0,$.jsx)(G,{value:e.value,children:e.label},e.value))]})]}),(0,$.jsx)(`p`,{className:`oc-admin__hint`,children:oe()})]}),ce.map(e=>(0,$.jsx)(ye,{injKey:e,def:J[e],i18n:me[e],row:d[e]??{enabled:!0,template:J[e].defaultTemplate[o]},contentLocale:o,onChange:t=>f(e,t)},e)),(0,$.jsx)(`div`,{className:`oc-injtab__actions`,children:(0,$.jsx)(U,{size:`sm`,onClick:()=>void p(),disabled:l,children:O()})})]})}function ye({injKey:e,def:t,i18n:n,row:r,contentLocale:a,onChange:o}){let[s,c]=(0,Q.useState)(!1),l=r.template.trim()!==t.defaultTemplate[a],u=t.togglable&&!r.enabled,d=Object.fromEntries(t.placeholders.map(e=>[e,he[e]??`{${e}}`])),f=le(e,r,a),m=f?K(f,d):``;return(0,$.jsxs)(`section`,{className:`oc-injcard`,children:[(0,$.jsxs)(`div`,{className:`oc-injcard__head`,children:[t.togglable?(0,$.jsxs)(`label`,{className:`oc-field--row`,children:[(0,$.jsx)(de,{checked:r.enabled,onCheckedChange:e=>o({enabled:e===!0})}),(0,$.jsx)(B,{label:n.label(),help:n.help()})]}):(0,$.jsx)(B,{label:n.label(),help:n.help()}),l&&(0,$.jsx)(`span`,{className:`oc-injection__badge`,children:re()})]}),(0,$.jsx)(`textarea`,{className:`oc-injcard__text`,value:r.template,disabled:u,rows:8,spellCheck:!1,onChange:e=>o({template:e.target.value})}),(0,$.jsxs)(`div`,{className:`oc-injection__foot`,children:[(0,$.jsxs)(`div`,{className:`oc-injcard__phs`,children:[(0,$.jsx)(`span`,{className:`oc-injection__ph`,children:p()}),t.placeholders.map(e=>(0,$.jsxs)(`span`,{className:`oc-injcard__ph-chip`,children:[(0,$.jsx)(`code`,{children:`{${e}}`}),(0,$.jsx)(H,{text:(ge[e]??(()=>e))()})]},e))]}),(0,$.jsxs)(`div`,{className:`oc-injcard__btns`,children:[(0,$.jsx)(U,{variant:`ghost`,size:`sm`,onClick:()=>c(e=>!e),children:s?te():ne()}),l&&(0,$.jsx)(U,{variant:`ghost`,size:`sm`,onClick:()=>o({template:t.defaultTemplate[a]}),children:ae()})]})]}),s&&(0,$.jsx)(`div`,{className:`oc-injcard__preview`,children:m?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`pre`,{className:`oc-injcard__previewtext`,children:m}),(0,$.jsx)(`span`,{className:`oc-injection__ph`,children:A()}),t.pluralDefaultTemplate!==void 0&&!u?(0,$.jsx)(`span`,{className:`oc-injection__ph`,children:k()}):null]}):(0,$.jsx)(`span`,{className:`oc-injection__ph`,children:i()})})]})}export{_e as PromptInjectionsTab};
@@ -0,0 +1 @@
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{AD as r,BD as i,CD as a,DD as o,ED as s,FD as c,GD as l,HD as u,ID as d,KD as f,LD as p,MD as m,ND as ee,OD as h,PD as g,RD as _,SD as v,TD as y,UD as b,VD as x,WD as S,_D as te,aD as ne,bD as re,cD as ie,dD as ae,iD as C,jD as w,kD as T,lD as E,ll as D,nU as O,oD as k,qD as A,rD as j,sD as M,t as N,tU as P,uD as F,vD as I,wD as L,xD as R,yD as oe,zD as z}from"./api-D7og-4qA.js";import{t as B}from"./button-Ch1cRvCe.js";import{Dn as V,Dt as H,Et as U,U as W,_ as G,jt as K,ut as q}from"./index-Dn5iHsqH.js";import{t as J}from"./roleDescriptions-BkEeX-KS.js";var Y=t(e(),1),X=n(),Z=[{group:()=>A(),keys:[{key:`traces.read`,label:()=>u()},{key:`traces.read.content`,label:()=>x(),phi:!0},{key:`traces.write`,label:()=>i()}]},{group:()=>f(),keys:[{key:`kpi.read`,label:()=>u()},{key:`kpi.write`,label:()=>i()}]},{group:()=>l(),keys:[{key:`openclaw.query`,label:()=>z()},{key:`anomalies.read`,label:()=>_()},{key:`anomalies.report`,label:()=>p()}]},{group:()=>S(),keys:[{key:`chats.read`,label:()=>u()},{key:`selfheal`,label:()=>c()},{key:`media.repair`,label:()=>g()},{key:`feedback.respond`,label:()=>D()}]},{group:()=>b(),keys:[{key:`admin.manage`,label:()=>d()}]}],se=Z.flatMap(e=>e.keys.map(e=>e.key));function Q(e){return e.includes(`*`)}var $={key:``,name:``,description:``};function ce(){let e=O(N.apiKeys.listRoles,{}),t=P(N.apiKeys.createRole),n=P(N.apiKeys.ensureRolesSeeded),i=P(N.apiKeys.updateRolePermissions).withOptimisticUpdate((e,{roleId:t,permissions:n})=>{let r=e.getQuery(N.apiKeys.listRoles,{});r&&e.setQuery(N.apiKeys.listRoles,{},r.map(e=>e._id===t?{...e,permissions:n}:e))}),c=W(),l=H(),[u,d]=(0,Y.useState)(!1),[f,p]=(0,Y.useState)($),[g,_]=(0,Y.useState)(new Set);(0,Y.useEffect)(()=>{n({}).catch(e=>{l.error(m(),e)})},[n,l]);let b=e??[];async function x(e,t){if(Q(e.permissions))return;if(e.builtin){await c({title:w({name:e.name}),description:r(),confirmLabel:T()});return}if(g.has(e._id))return;let n=e.permissions.includes(t)?e.permissions.filter(e=>e!==t):[...e.permissions,t];_(t=>new Set(t).add(e._id));try{await i({roleId:e._id,permissions:n})}catch(e){l.error(h(),e)}finally{_(t=>{let n=new Set(t);return n.delete(e._id),n})}}async function S(){try{await t({key:f.key,name:f.name,description:f.description||void 0,permissions:[]}),p($),d(!1)}catch(e){l.error(o(),e)}}let D=e===void 0,A=!D&&b.length===0;return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`p`,{className:`oc-admin__hint`,children:[s(),` `,(0,X.jsx)(`code`,{children:`admin`}),` `,y(),` `,(0,X.jsx)(`code`,{children:`traces.read.content`}),` `,L()]}),(0,X.jsxs)(`div`,{className:`oc-dt`,children:[(0,X.jsxs)(`div`,{className:`oc-dt__bar`,children:[(0,X.jsx)(`h2`,{className:`oc-dt__title`,children:a()}),(0,X.jsx)(`div`,{className:`oc-dt__bar-actions`,children:(0,X.jsx)(B,{size:`sm`,onClick:()=>{p($),d(!0)},children:v()})})]}),D?(0,X.jsx)(`p`,{className:`oc-admin__hint`,children:R()}):A?(0,X.jsx)(`p`,{className:`oc-admin__hint`,children:re()}):(0,X.jsx)(`div`,{className:`oc-matrix__scroll`,children:(0,X.jsxs)(`table`,{className:`oc-matrix`,children:[(0,X.jsxs)(`thead`,{children:[(0,X.jsxs)(`tr`,{children:[(0,X.jsx)(`th`,{className:`oc-matrix__corner`,rowSpan:2,children:oe()}),Z.map(e=>(0,X.jsx)(`th`,{className:`oc-matrix__group`,colSpan:e.keys.length,children:e.group()},e.group()))]}),(0,X.jsx)(`tr`,{children:Z.flatMap(e=>e.keys.map(e=>(0,X.jsxs)(`th`,{className:`oc-matrix__perm`,title:e.phi?ee({key:e.key}):e.key,children:[e.label(),e.phi?(0,X.jsx)(`span`,{className:`oc-matrix__phi`,children:` ⚠`}):null]},e.key)))})]}),(0,X.jsx)(`tbody`,{children:b.map(e=>{let t=Q(e.permissions),n=g.has(e._id);return(0,X.jsxs)(`tr`,{children:[(0,X.jsxs)(`th`,{className:`oc-matrix__rolecell`,children:[(0,X.jsxs)(`div`,{className:`oc-matrix__rolename`,children:[(0,X.jsx)(`span`,{children:e.name}),(0,X.jsx)(`code`,{className:`oc-matrix__rolekey`,children:e.key}),e.builtin?(0,X.jsxs)(U,{variant:`outline`,className:`gap-1`,children:[(0,X.jsx)(V,{}),` `,I()]}):(0,X.jsx)(U,{variant:`secondary`,children:te()})]}),J(e)?(0,X.jsx)(`p`,{className:`oc-matrix__roledesc`,children:J(e)}):null]}),se.map(r=>(0,X.jsx)(`td`,{className:`oc-matrix__cell`,children:(0,X.jsx)(q,{checked:t||e.permissions.includes(r),disabled:t||n,"aria-label":`${e.key} · ${r}`,title:t?ae():n?F():r,onCheckedChange:()=>void x(e,r)})},r))]},e.key)})})]})})]}),(0,X.jsx)(G,{open:u,onOpenChange:d,title:E(),description:ie(),canSubmit:!!(f.key&&f.name),onSubmit:S,submitLabel:M(),children:(0,X.jsxs)(`div`,{className:`oc-form`,children:[(0,X.jsxs)(`label`,{className:`oc-field`,children:[(0,X.jsx)(`span`,{className:`oc-field__label`,children:k()}),(0,X.jsx)(K,{value:f.key,placeholder:ne(),onChange:e=>p({...f,key:e.target.value})})]}),(0,X.jsxs)(`label`,{className:`oc-field`,children:[(0,X.jsx)(`span`,{className:`oc-field__label`,children:C()}),(0,X.jsx)(K,{value:f.name,onChange:e=>p({...f,name:e.target.value})})]}),(0,X.jsxs)(`label`,{className:`oc-field`,children:[(0,X.jsx)(`span`,{className:`oc-field__label`,children:j()}),(0,X.jsx)(K,{value:f.description,onChange:e=>p({...f,description:e.target.value})})]})]})})]})}export{ce as RolesTab};