@lacneu/atrium 0.21.0 → 0.22.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (69) hide show
  1. package/dist/assets/{AccessTab-BpmHOH2b.js → AccessTab-CJcKd-bd.js} +1 -1
  2. package/dist/assets/{AdvancedFilter-BOBkqtk6.js → AdvancedFilter-BL2m0s1O.js} +1 -1
  3. package/dist/assets/AgentFilesTab-CD068nL5.js +3 -0
  4. package/dist/assets/AnomaliesTab-Bc7-utkr.js +1 -0
  5. package/dist/assets/{AuditTab-CGfU9rSl.js → AuditTab-rp3o9ni_.js} +1 -1
  6. package/dist/assets/BridgeTab-D9M2Jvdh.js +1 -0
  7. package/dist/assets/ChatDefaultsTab-TAcdFRwg.js +1 -0
  8. package/dist/assets/{DataTableShell-DRaoMzdi.js → DataTableShell-ezCmCHde.js} +1 -1
  9. package/dist/assets/{DetailChips-BJRTpKvv.js → DetailChips-DZl7SJAQ.js} +1 -1
  10. package/dist/assets/FeedbacksTab-DlqnH300.js +1 -0
  11. package/dist/assets/{FieldLabel-DG-U2yJD.js → FieldLabel-P7nCb2ED.js} +2 -2
  12. package/dist/assets/FilesTab-BRjvjI3H.js +1 -0
  13. package/dist/assets/{FilterBar-BBJk4kP8.js → FilterBar-NyP0u16q.js} +1 -1
  14. package/dist/assets/GroupsTab-By5diDc0.js +1 -0
  15. package/dist/assets/InstancesTab-GL7a4Nh0.js +1 -0
  16. package/dist/assets/IntegrationsTab-HG2z67bd.js +1 -0
  17. package/dist/assets/KpiTab-eRc73EfH.js +1 -0
  18. package/dist/assets/PreferencesTab-CzxxuXHQ.js +1 -0
  19. package/dist/assets/PromptInjectionsTab-Ca3Wtw06.js +3 -0
  20. package/dist/assets/RolesTab-ZtdhQkki.js +1 -0
  21. package/dist/assets/ServiceAccountsTab-BmBwTFtH.js +1 -0
  22. package/dist/assets/{SubAgentReportsTab-CzaVSPFb.js → SubAgentReportsTab-Dx2BdaRA.js} +1 -1
  23. package/dist/assets/ThemeShowroom-ljIrzkNU.js +1 -0
  24. package/dist/assets/{TimeRangePicker-CAhWZBEI.js → TimeRangePicker-JtLvHr3a.js} +1 -1
  25. package/dist/assets/TracesTab-Bi8G8ogN.js +1 -0
  26. package/dist/assets/UsersTab-CJboXvTd.js +1 -0
  27. package/dist/assets/button-Chsl3hJr.js +1 -0
  28. package/dist/assets/{card-4N7N5yEr.js → card-BUOYrB8s.js} +1 -1
  29. package/dist/assets/chevrons-up-down-BxjTVcP-.js +1 -0
  30. package/dist/assets/{compatView-5hziRv_l.js → compatView-B-SErG8a.js} +1 -1
  31. package/dist/assets/{dispatchErrorInfo-DsgZO0if.js → dispatchErrorInfo-DY4Xsf5c.js} +1 -1
  32. package/dist/assets/{dist-C_wXViAC.js → dist-CEWcFkOy.js} +1 -1
  33. package/dist/assets/{dist-B-U7A_Kp.js → dist-CcSJxYOw.js} +1 -1
  34. package/dist/assets/{dist-BNEZtSYw.js → dist-ClJFgNZb.js} +1 -1
  35. package/dist/assets/dist-CnMhrvCU.js +5 -0
  36. package/dist/assets/{highlighted-body-OFNGDK62-ClkcrmUm.js → highlighted-body-OFNGDK62-DzEhHpM8.js} +1 -1
  37. package/dist/assets/index-Dld_NfaR.js +227 -0
  38. package/dist/assets/{index-Baso9Ryo.css → index-f9NGvYte.css} +1 -1
  39. package/dist/assets/mermaid-GHXKKRXX-D5fTxsHz.js +1 -0
  40. package/dist/assets/roleDescriptions-s8ifW_os.js +1 -0
  41. package/dist/assets/{table-CEVcfIlY.js → table-CKAkPBqh.js} +1 -1
  42. package/dist/assets/{tabs-DTsAt8vZ.js → tabs-0mZb1m9H.js} +1 -1
  43. package/dist/assets/x-CfhV2nwo.js +1 -0
  44. package/dist/index.html +8 -8
  45. package/package.json +1 -1
  46. package/dist/assets/AgentFilesTab-A7KIKZuy.js +0 -3
  47. package/dist/assets/AnomaliesTab-D1oMEdo7.js +0 -1
  48. package/dist/assets/BridgeTab-wIiXQVx4.js +0 -1
  49. package/dist/assets/ChatDefaultsTab-BiAi9i7q.js +0 -1
  50. package/dist/assets/FeedbacksTab-DXt9vggG.js +0 -1
  51. package/dist/assets/FilesTab-D6N2e-YF.js +0 -1
  52. package/dist/assets/GroupsTab-Bd8LlkxI.js +0 -1
  53. package/dist/assets/InstancesTab-0V2J2Qtq.js +0 -1
  54. package/dist/assets/IntegrationsTab-pGZl_dNY.js +0 -1
  55. package/dist/assets/KpiTab-B3XVJcNt.js +0 -1
  56. package/dist/assets/PreferencesTab-Cj6tC2ZE.js +0 -1
  57. package/dist/assets/PromptInjectionsTab-_BUqUmC6.js +0 -3
  58. package/dist/assets/RolesTab-PbMAqWrZ.js +0 -1
  59. package/dist/assets/ServiceAccountsTab-Bau7cms3.js +0 -1
  60. package/dist/assets/ThemeShowroom-COaylZ2W.js +0 -1
  61. package/dist/assets/TracesTab-B0uGrcLJ.js +0 -1
  62. package/dist/assets/UsersTab-C6Ulyvwq.js +0 -1
  63. package/dist/assets/button-CoB18od4.js +0 -1
  64. package/dist/assets/chevrons-up-down-CaKfHJNA.js +0 -1
  65. package/dist/assets/dist-BN_-yUvA.js +0 -5
  66. package/dist/assets/index-B6IXWbc8.js +0 -227
  67. package/dist/assets/mermaid-GHXKKRXX-BnwtjR3q.js +0 -1
  68. package/dist/assets/roleDescriptions-C3lIPjqc.js +0 -1
  69. package/dist/assets/x-Dl0sHEar.js +0 -1
@@ -1 +1 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Bo as r,Fo as i,Go as a,Ho as o,Io as s,Jo as c,Ko as l,Lo as u,Po as d,Ro as f,Uo as p,Vo as m,Wo as h,dO as g,iO as _,jD as v,qo as y,zo as b}from"./dist-B-U7A_Kp.js";import{C as x,S,X as C,b as w,x as T,y as E}from"./index-B6IXWbc8.js";var D=t(e(),1);function O(e){return e===`user`?f():e===`all`?u():s({group:e.group})}function k(e){return e===`common`?i():e===`owner`?d():s({group:e.group})}var A=n();function j(e){return e.name||e.email||e.userId.slice(0,8)}function M(){let e=g(_.admin.listUsers,{}),[t,n]=(0,D.useState)(``),i=g(_.introspect.introspectUser,t?{userId:t}:`skip`);return(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:c()}),(0,A.jsxs)(E,{value:t,onValueChange:n,children:[(0,A.jsx)(S,{size:`sm`,"aria-label":y(),children:(0,A.jsx)(x,{placeholder:y()})}),(0,A.jsx)(w,{children:(e??[]).map(e=>(0,A.jsx)(T,{value:e.userId,children:j(e)},e._id))})]}),t===``?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:l()}):i===void 0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children: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:a()}),(0,A.jsxs)(`div`,{className:`oc-introspect__id`,children:[(0,A.jsx)(`strong`,{children:i.user.label}),(0,A.jsx)(C,{variant:`secondary`,children:i.role})]})]}),(0,A.jsxs)(`section`,{className:`oc-introspect__section`,children:[(0,A.jsx)(`h3`,{className:`oc-introspect__title`,children:h()}),i.groups.length===0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:r()}):(0,A.jsx)(`div`,{className:`oc-introspect__chips`,children:i.groups.map(e=>(0,A.jsx)(C,{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:p()}),i.agents.length===0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:r()}):(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)(C,{variant:`default`,children:b()}):null,(0,A.jsx)(C,{variant:`outline`,children:O(e.via)}),(0,A.jsx)(C,{variant:`secondary`,children:e.state})]},`${e.instanceName} ${e.agentId}`))})]}),(0,A.jsxs)(`section`,{className:`oc-introspect__section`,children:[(0,A.jsx)(`h3`,{className:`oc-introspect__title`,children:o()}),i.charts.length===0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:r()}):(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)(C,{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:m()}),i.permissions.length===0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:r()}):(0,A.jsx)(`div`,{className:`oc-introspect__chips`,children:i.permissions.map(e=>(0,A.jsx)(C,{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{Bo as r,FD as i,Fo as a,Go as o,Ho as s,Io as c,Jo as l,Ko as u,Lo as d,Po as f,Ro as p,Uo as m,Vo as h,Wo as g,cO as _,hO as v,qo as y,zo as b}from"./dist-CcSJxYOw.js";import{C as x,S,X as C,b as w,x as T,y as E}from"./index-Dld_NfaR.js";var D=t(e(),1);function O(e){return e===`user`?p():e===`all`?d():c({group:e.group})}function k(e){return e===`common`?a():e===`owner`?f():c({group:e.group})}var A=n();function j(e){return e.name||e.email||e.userId.slice(0,8)}function M(){let e=v(_.admin.listUsers,{}),[t,n]=(0,D.useState)(``),a=v(_.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)(E,{value:t,onValueChange:n,children:[(0,A.jsx)(S,{size:`sm`,"aria-label":y(),children:(0,A.jsx)(x,{placeholder:y()})}),(0,A.jsx)(w,{children:(e??[]).map(e=>(0,A.jsx)(T,{value:e.userId,children:j(e)},e._id))})]}),t===``?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:u()}):a===void 0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:i()}):(0,A.jsxs)(`div`,{className:`oc-introspect`,children:[(0,A.jsxs)(`section`,{className:`oc-introspect__section`,children:[(0,A.jsx)(`h3`,{className:`oc-introspect__title`,children:o()}),(0,A.jsxs)(`div`,{className:`oc-introspect__id`,children:[(0,A.jsx)(`strong`,{children:a.user.label}),(0,A.jsx)(C,{variant:`secondary`,children:a.role})]})]}),(0,A.jsxs)(`section`,{className:`oc-introspect__section`,children:[(0,A.jsx)(`h3`,{className:`oc-introspect__title`,children:g()}),a.groups.length===0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:r()}):(0,A.jsx)(`div`,{className:`oc-introspect__chips`,children:a.groups.map(e=>(0,A.jsx)(C,{variant:`secondary`,children:e.name},e.groupId))})]}),(0,A.jsxs)(`section`,{className:`oc-introspect__section`,children:[(0,A.jsx)(`h3`,{className:`oc-introspect__title`,children:m()}),a.agents.length===0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:r()}):(0,A.jsx)(`ul`,{className:`oc-introspect__list`,children:a.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)(C,{variant:`default`,children:b()}):null,(0,A.jsx)(C,{variant:`outline`,children:O(e.via)}),(0,A.jsx)(C,{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:s()}),a.charts.length===0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:r()}):(0,A.jsx)(`ul`,{className:`oc-introspect__list`,children:a.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)(C,{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:h()}),a.permissions.length===0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:r()}):(0,A.jsx)(`div`,{className:`oc-introspect__chips`,children:a.permissions.map(e=>(0,A.jsx)(C,{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{$c as r,al as i,el as a,il as o,nl as s,rl as c,tl as l}from"./dist-B-U7A_Kp.js";import{i as u}from"./dist-BNEZtSYw.js";import{t as d}from"./x-Dl0sHEar.js";import{t as f}from"./button-CoB18od4.js";import{C as p,S as m,Z as h,b as g,bt as _,x as v,y}from"./index-B6IXWbc8.js";import{r as b}from"./TimeRangePicker-CAhWZBEI.js";var x=t(e(),1),S=n(),C=[{value:`eq`,label:`=`},{value:`neq`,label:`≠`},{value:`contains`,label:i()},{value:`gt`,label:`>`},{value:`gte`,label:`≥`},{value:`lt`,label:`<`},{value:`lte`,label:`≤`}],w=1;function T(){return{id:w++,field:``,op:`eq`,value:``}}function E(e){return e.map(e=>({id:w++,field:e.field,op:e.op,value:String(e.value)}))}function D({fields:e,seed:t,onChange:n}){let i=(0,x.useRef)(t),w=!!(i.current&&i.current.length>0),[D,O]=(0,x.useState)(w),[k,A]=(0,x.useState)(()=>w?E(i.current):[]);function j(e){n(e.filter(e=>e.field!==``&&e.value!==``).map(e=>({field:e.field,op:e.op,value:b(e.value)})))}function M(e,t){let n=k.map(n=>n.id===e?{...n,...t}:n);A(n),j(n)}function N(){A(e=>[...e,T()])}function P(e){let t=k.filter(t=>t.id!==e);A(t),j(t)}let F=k.filter(e=>e.field!==``&&e.value!==``).length;return(0,S.jsxs)(`div`,{className:`oc-advfilter`,children:[(0,S.jsxs)(`button`,{type:`button`,className:`oc-advfilter__toggle`,"aria-expanded":D,onClick:()=>O(e=>!e),children:[(0,S.jsx)(u,{className:`oc-advfilter__chevron`+(D?` is-open`:``),"aria-hidden":!0}),o(),F>0?(0,S.jsx)(`span`,{className:`oc-advfilter__count`,children:F}):null]}),D?(0,S.jsxs)(`div`,{className:`oc-advfilter__body`,children:[k.length===0?(0,S.jsx)(`p`,{className:`oc-admin__hint`,children:c()}):(0,S.jsx)(`ul`,{className:`oc-advfilter__rows`,children:k.map(t=>(0,S.jsxs)(`li`,{className:`oc-advfilter__row`,children:[(0,S.jsxs)(y,{value:t.field||void 0,onValueChange:e=>M(t.id,{field:e}),children:[(0,S.jsx)(m,{size:`sm`,className:`w-40`,children:(0,S.jsx)(p,{placeholder:s()})}),(0,S.jsx)(g,{children:e.map(e=>(0,S.jsx)(v,{value:e.value,children:e.label},e.value))})]}),(0,S.jsxs)(y,{value:t.op,onValueChange:e=>M(t.id,{op:e}),children:[(0,S.jsx)(m,{size:`sm`,className:`w-28`,children:(0,S.jsx)(p,{})}),(0,S.jsx)(g,{children:C.map(e=>(0,S.jsx)(v,{value:e.value,children:e.label},e.value))})]}),(0,S.jsx)(h,{className:`oc-advfilter__value`,value:t.value,onChange:e=>M(t.id,{value:e.target.value}),placeholder:l()}),(0,S.jsx)(f,{variant:`ghost`,size:`icon-sm`,"aria-label":a(),onClick:()=>P(t.id),children:(0,S.jsx)(d,{})})]},t.id))}),(0,S.jsxs)(f,{variant:`outline`,size:`sm`,className:`oc-advfilter__add`,onClick:N,children:[(0,S.jsx)(_,{}),r()]})]}):null]})}export{D as t};
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$c as r,al as i,el as a,il as o,nl as s,rl as c,tl as l}from"./dist-CcSJxYOw.js";import{i as u}from"./dist-ClJFgNZb.js";import{t as d}from"./x-CfhV2nwo.js";import{t as f}from"./button-Chsl3hJr.js";import{C as p,S as m,Z as h,b as g,bt as _,x as v,y}from"./index-Dld_NfaR.js";import{r as b}from"./TimeRangePicker-JtLvHr3a.js";var x=t(e(),1),S=n(),C=[{value:`eq`,label:`=`},{value:`neq`,label:`≠`},{value:`contains`,label:i()},{value:`gt`,label:`>`},{value:`gte`,label:`≥`},{value:`lt`,label:`<`},{value:`lte`,label:`≤`}],w=1;function T(){return{id:w++,field:``,op:`eq`,value:``}}function E(e){return e.map(e=>({id:w++,field:e.field,op:e.op,value:String(e.value)}))}function D({fields:e,seed:t,onChange:n}){let i=(0,x.useRef)(t),w=!!(i.current&&i.current.length>0),[D,O]=(0,x.useState)(w),[k,A]=(0,x.useState)(()=>w?E(i.current):[]);function j(e){n(e.filter(e=>e.field!==``&&e.value!==``).map(e=>({field:e.field,op:e.op,value:b(e.value)})))}function M(e,t){let n=k.map(n=>n.id===e?{...n,...t}:n);A(n),j(n)}function N(){A(e=>[...e,T()])}function P(e){let t=k.filter(t=>t.id!==e);A(t),j(t)}let F=k.filter(e=>e.field!==``&&e.value!==``).length;return(0,S.jsxs)(`div`,{className:`oc-advfilter`,children:[(0,S.jsxs)(`button`,{type:`button`,className:`oc-advfilter__toggle`,"aria-expanded":D,onClick:()=>O(e=>!e),children:[(0,S.jsx)(u,{className:`oc-advfilter__chevron`+(D?` is-open`:``),"aria-hidden":!0}),o(),F>0?(0,S.jsx)(`span`,{className:`oc-advfilter__count`,children:F}):null]}),D?(0,S.jsxs)(`div`,{className:`oc-advfilter__body`,children:[k.length===0?(0,S.jsx)(`p`,{className:`oc-admin__hint`,children:c()}):(0,S.jsx)(`ul`,{className:`oc-advfilter__rows`,children:k.map(t=>(0,S.jsxs)(`li`,{className:`oc-advfilter__row`,children:[(0,S.jsxs)(y,{value:t.field||void 0,onValueChange:e=>M(t.id,{field:e}),children:[(0,S.jsx)(m,{size:`sm`,className:`w-40`,children:(0,S.jsx)(p,{placeholder:s()})}),(0,S.jsx)(g,{children:e.map(e=>(0,S.jsx)(v,{value:e.value,children:e.label},e.value))})]}),(0,S.jsxs)(y,{value:t.op,onValueChange:e=>M(t.id,{op:e}),children:[(0,S.jsx)(m,{size:`sm`,className:`w-28`,children:(0,S.jsx)(p,{})}),(0,S.jsx)(g,{children:C.map(e=>(0,S.jsx)(v,{value:e.value,children:e.label},e.value))})]}),(0,S.jsx)(h,{className:`oc-advfilter__value`,value:t.value,onChange:e=>M(t.id,{value:e.target.value}),placeholder:l()}),(0,S.jsx)(f,{variant:`ghost`,size:`icon-sm`,"aria-label":a(),onClick:()=>P(t.id),children:(0,S.jsx)(d,{})})]},t.id))}),(0,S.jsxs)(f,{variant:`outline`,size:`sm`,className:`oc-advfilter__add`,onClick:N,children:[(0,S.jsx)(_,{}),r()]})]}):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{Ci as r,Di as i,ES as a,Ei as o,FD as s,LD as ee,Oi as c,Si as te,Ti as ne,_i as l,ai as u,bi as re,cO as d,ci as f,di as p,ei as m,fO as h,fa as g,fi as _,gi as v,hO as y,hi as b,ii as x,ki as S,li as C,mi as w,ni as T,oi as E,pi as ie,ri as D,si as O,ti as k,ua as ae,ui as oe,vi as A,wi as j,xi as se,yi as M}from"./dist-CcSJxYOw.js";import{t as N}from"./button-Chsl3hJr.js";import{$ as P,A as F,B as I,C as L,F as ce,I as le,L as ue,N as de,P as fe,Q as pe,R as me,S as R,X as z,b as B,et as he,mt as V,nt as ge,ot as H,rt as _e,v as U,x as W,y as G,z as ve}from"./index-Dld_NfaR.js";import{i as K}from"./compatView-B-SErG8a.js";/* empty css */var q=t(e(),1),J=2e4,Y=6e4;function X(e){return typeof e!=`number`||e<=0?0:Math.round(e/J*100)}function Z(e){return e<=0?0:Math.round(e/Y*100)}function ye(e,t){let n=(typeof e==`number`&&e>0?e:0)/1e3;return new Intl.NumberFormat(t,{minimumFractionDigits:1,maximumFractionDigits:1}).format(n)}function be(e){return e.reduce((e,t)=>e+(typeof t.size==`number`&&t.size>0?t.size:0),0)}var xe=3;function Se(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<xe&&a.push(e)):t>0&&(i+=t,o.length<xe&&o.push(e));return{added:r,removed:i,sampleAdded:a,sampleRemoved:o}}function Ce(e){return e instanceof Error?e.message.includes(`conflict:`):String(e).includes(`conflict:`)}var Q=n(),$=e=>`${e.instanceName}::${e.agentId}`;function we(){let e=y(d.me.getMe,{host:H}),t=e?.role===`admin`,n=(e?.permissions??[]).includes(`bridge.read`),a=y(d.admin.listInstances,e!==void 0&&t?{}:`skip`),[u,f]=(0,q.useState)(null);(0,q.useEffect)(()=>{!t||!a||a.length===0||(!u||!a.some(e=>e.name===u))&&f(a[0].name)},[t,a,u]);let p=y(d.agents.listAgentsForInstance,t&&u?{instanceName:u}:`skip`),m=y(d.agents.listMyAgents,e!==void 0&&!t?{}:`skip`),g=(0,q.useMemo)(()=>{if(e!==void 0){if(t)return u===null||p===void 0?a!==void 0&&a.length===0?[]:void 0:p.agents.map(e=>({instanceName:u,agentId:e.agentId,label:`${e.emoji?`${e.emoji} `:``}${e.displayName??e.agentId}`}));if(m!==void 0)return m.map(e=>({instanceName:e.instanceName,agentId:e.agentId,label:`${e.emoji?`${e.emoji} `:``}${e.displayName??e.agentId}`}))}},[e,t,u,p,a,m]),[_,v]=(0,q.useState)(null);(0,q.useEffect)(()=>{!g||g.length===0||(!_||!g.some(e=>$(e)===_))&&v($(g[0]))},[g,_]);let b=g?.find(e=>$(e)===_)??null,x=h(d.agentFiles.listAgentFiles),[C,w]=(0,q.useState)({status:`idle`}),T=b?.instanceName??null,E=b?.agentId??null,ie=y(d.compat.forInstance,n&&T!==null?{instanceName:T}:`skip`),D=n&&T!==null?U(ie,`agentFiles`):null,O=D===null?!1:D===`loading`?null:D.blocked,k=(0,q.useCallback)(async()=>{if(!(T===null||E===null)){w({status:`loading`});try{w({status:`done`,files:(await x({instanceName:T,agentId:E})).files})}catch{w({status:`error`})}}},[x,T,E]);(0,q.useEffect)(()=>{O===!1&&k()},[k,O]);let[oe,P]=(0,q.useState)(null),F=ee(),I=(0,q.useMemo)(()=>new Intl.NumberFormat(F,{maximumFractionDigits:0}),[F]);return e===void 0||g===void 0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:s()}):(0,Q.jsxs)(`div`,{className:`oc-afiles`,children:[(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:S()}),(0,Q.jsxs)(`div`,{className:`oc-afiles__picker`,children:[t&&(a?.length??0)>1?(0,Q.jsxs)(G,{value:u??``,onValueChange:e=>f(e),children:[(0,Q.jsx)(R,{size:`sm`,"aria-label":c(),children:(0,Q.jsx)(L,{})}),(0,Q.jsx)(B,{children:(a??[]).map(e=>(0,Q.jsx)(W,{value:e.name,children:e.name},e.name))})]}):null,g.length>0?(0,Q.jsxs)(G,{value:_??``,onValueChange:e=>v(e),children:[(0,Q.jsx)(R,{size:`sm`,"aria-label":i(),children:(0,Q.jsx)(L,{})}),(0,Q.jsx)(B,{children:g.map(e=>(0,Q.jsx)(W,{value:$(e),children:e.label},$(e)))})]}):(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:o()})]}),b===null?null:D===`loading`?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:s()}):D!==null&&D.blocked?(0,Q.jsxs)(`p`,{className:`oc-compat__blocked`,role:`status`,children:[(0,Q.jsx)(V,{size:14,"aria-hidden":!0}),` `,K(D.gatewayVersion)]}):C.status===`loading`||C.status===`idle`?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:s()}):C.status===`error`?(0,Q.jsxs)(`p`,{className:`oc-afiles__error`,role:`alert`,children:[j(),` `,(0,Q.jsx)(N,{variant:`outline`,size:`sm`,onClick:()=>void k(),children:ae()})]}):C.files.length===0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:ne()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`div`,{className:`oc-afiles__list`,children:C.files.map(e=>{let n=X(e.size),i=n>=80;return(0,Q.jsxs)(`div`,{className:`oc-afiles__row`,children:[(0,Q.jsx)(`span`,{className:`oc-afiles__name`,title:e.name,children:e.name}),e.missing?(0,Q.jsx)(z,{variant:`outline`,children:r()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`span`,{className:`oc-afiles__size`,children:te({size:ye(e.size,F)})}),(0,Q.jsx)(`span`,{className:`oc-afiles__gauge${i?` is-warn`:``}`,"aria-hidden":!0,children:(0,Q.jsx)(`span`,{className:`oc-afiles__gauge-fill`,style:{width:`${Math.min(n,100)}%`}})}),(0,Q.jsx)(`span`,{className:`oc-afiles__pct`,children:se({pct:I.format(n)})}),i?(0,Q.jsx)(V,{size:14,className:`oc-afiles__warn`,"aria-label":re()}):(0,Q.jsx)(`span`,{className:`oc-afiles__warn-slot`,"aria-hidden":!0})]}),(0,Q.jsx)(N,{variant:`outline`,size:`sm`,className:`oc-afiles__open`,onClick:()=>P(e),children:t?A():l()})]},e.name)})}),(0,Q.jsx)(`p`,{className:`oc-afiles__budget`,children:M({used:ye(be(C.files),F),total:ye(Y,F),pct:I.format(Z(be(C.files)))})})]}),oe&&b?(0,Q.jsx)(Te,{instanceName:b.instanceName,agentId:b.agentId,name:oe.name,isAdmin:t,onClose:()=>P(null),onSaved:()=>void k()}):null]})}function Te({instanceName:e,agentId:t,name:n,isAdmin:r,onClose:i,onSaved:o}){let c=h(d.agentFiles.getAgentFile),te=h(d.agentFiles.setAgentFile),ne=F(),[l,re]=(0,q.useState)(null),[y,S]=(0,q.useState)(!1),[A,j]=(0,q.useState)(``),[se,M]=(0,q.useState)(!1),[L,R]=(0,q.useState)(!1),[z,B]=(0,q.useState)(!1),[V,H]=(0,q.useState)(!1),U=(0,q.useCallback)(async r=>{S(!1);try{let i=await c({instanceName:e,agentId:t,name:n});re({content:i.content,updatedAtMs:i.updatedAtMs}),r||j(i.content),B(!1)}catch{S(!0)}},[c,e,t,n]);(0,q.useEffect)(()=>{U(!1)},[U]);async function W(){if(l!==null){R(!0),H(!1);try{await te({instanceName:e,agentId:t,name:n,content:A,baseUpdatedAtMs:l.updatedAtMs??void 0}),ne.success(oe({name:n})),o(),await U(!1)}catch(e){Ce(e)?B(!0):H(!0)}finally{R(!1)}}}let G=l!==null&&A!==l.content,K=(0,q.useMemo)(()=>l===null?null:Se(l.content,A),[l,A]),Y=A.length>J,X=ee(),Z=(0,q.useMemo)(()=>new Intl.NumberFormat(X),[X]);return(0,Q.jsx)(pe,{open:!0,onOpenChange:e=>!e&&i(),children:(0,Q.jsxs)(P,{className:`oc-afiles__editor`,children:[(0,Q.jsxs)(ge,{children:[(0,Q.jsx)(_e,{children:v({name:n})}),(0,Q.jsxs)(he,{children:[b({agent:t,instance:e}),r?null:(0,Q.jsxs)(Q.Fragment,{children:[` · `,w()]})]})]}),y?(0,Q.jsxs)(`p`,{className:`oc-afiles__error`,role:`alert`,children:[f(),` `,(0,Q.jsx)(N,{variant:`outline`,size:`sm`,onClick:()=>void U(!1),children:ae()})]}):l===null?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:s()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`textarea`,{className:`oc-afiles__source`,value:A,readOnly:!r,spellCheck:!1,onChange:e=>j(e.target.value),"aria-label":v({name:n})}),(0,Q.jsx)(`p`,{className:`oc-afiles__hint`,children:ie()}),z?(0,Q.jsxs)(`p`,{className:`oc-afiles__error`,role:`alert`,children:[O(),` `,(0,Q.jsx)(N,{variant:`outline`,size:`sm`,onClick:()=>void U(!0),children:E()})]}):null,V?(0,Q.jsx)(`p`,{className:`oc-afiles__error`,role:`alert`,children:C()}):null,(0,Q.jsxs)(`div`,{className:`oc-afiles__editor-foot`,children:[(0,Q.jsx)(`span`,{className:`oc-afiles__count${Y?` is-over`:``}`,children:_({count:Z.format(A.length),max:Z.format(J)})}),r?(0,Q.jsx)(N,{size:`sm`,disabled:!G||L||z,onClick:()=>M(!0),children:L?g():p()}):null]})]}),(0,Q.jsx)(de,{open:se,onOpenChange:M,children:(0,Q.jsxs)(le,{children:[(0,Q.jsxs)(ve,{children:[(0,Q.jsx)(I,{children:u({name:n})}),(0,Q.jsx)(ue,{children:x({agent:t})})]}),K?(0,Q.jsxs)(`div`,{className:`oc-afiles__diff`,children:[(0,Q.jsx)(`p`,{className:`oc-afiles__diff-counts`,children:D({added:K.added,removed:K.removed})}),K.sampleAdded.length>0?(0,Q.jsxs)(`div`,{className:`oc-afiles__diff-block`,children:[(0,Q.jsx)(`span`,{className:`oc-afiles__diff-label`,children:T()}),K.sampleAdded.map((e,t)=>(0,Q.jsx)(`code`,{className:`oc-afiles__diff-line is-add`,children:e||` `},t))]}):null,K.sampleRemoved.length>0?(0,Q.jsxs)(`div`,{className:`oc-afiles__diff-block`,children:[(0,Q.jsx)(`span`,{className:`oc-afiles__diff-label`,children:k()}),K.sampleRemoved.map((e,t)=>(0,Q.jsx)(`code`,{className:`oc-afiles__diff-line is-del`,children:e||` `},t))]}):null]}):null,(0,Q.jsxs)(me,{children:[(0,Q.jsx)(ce,{children:a()}),(0,Q.jsx)(fe,{onClick:()=>void W(),children:m()})]})]})})]})})}export{we as AgentFilesTab};
@@ -0,0 +1 @@
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$p as r,Am as i,Bm as a,Cm as ee,Dm as te,Em as o,Fm as s,Im as c,Lm as l,Mm as u,Nm as d,Om as f,Pm as ne,Rm as re,Sm as ie,Tm as ae,Vm as p,_m as oe,am as se,bm as ce,cO as m,cm as le,dm as ue,em as h,fm as g,gm as _,hO as v,hm as de,im as fe,jm as pe,km as me,lm as he,mO as ge,mm as y,nm as b,om as x,pm as S,rm as C,sm as w,tm as T,um as E,vm as D,wm as O,xm as k,ym as A,zm as j}from"./dist-CcSJxYOw.js";import{A as M,C as N,Mt as P,S as F,X as I,a as L,b as R,j as _e,jt as z,ot as ve,r as ye,x as B,y as V}from"./index-Dld_NfaR.js";import{n as H}from"./TimeRangePicker-JtLvHr3a.js";import{t as be}from"./FilterBar-NyP0u16q.js";import{t as xe}from"./DataTableShell-ezCmCHde.js";import{t as U}from"./dispatchErrorInfo-DY4Xsf5c.js";var W=t(e(),1),G=n(),K=`__all__`,Se=[{value:`open`},{value:`acknowledged`},{value:`resolved`}];function Ce(e){return e===`open`?p():e===`acknowledged`?a():j()}var we=[`info`,`warn`,`critical`],Te=[`detector`,`agent`,`user`],Ee={kind:`relative`,from:`now-30d`,to:`now`},De=200,q=`all`;function J(){let e=P({from:`/settings/anomalies`}),t=z({from:`/settings/anomalies`}),n=e.q??``,r=e.status===q?K:e.status,a=e.severity??K,p=e.kind??K,[h,b]=(0,W.useState)(K),T=ye(e.from,e.to),{from:j,to:U}=H(T),J=e=>void t({search:t=>({...t,q:e||void 0}),replace:!0}),Y=e=>void t({search:t=>({...t,status:e===K?q:e})}),X=e=>void t({search:t=>({...t,severity:e===K?void 0:e})}),Me=e=>void t({search:t=>({...t,kind:e===K?void 0:e})}),Ne=e=>void t({search:t=>({...t,...L(e)})}),Pe=_e(),Z=M(),Q=ge(m.anomalies.resolveAnomaly),Fe=(v(m.me.getMe,{host:ve})?.permissions??[]).includes(`admin.manage`),$=v(m.anomalies.listAnomalies,{limit:De,filter:{q:n||void 0,from:j,to:U,anomalyStatus:r===K?void 0:r,severity:a===K?void 0:a,source:h===K?void 0:h,kind:p===K?void 0:p}}),Ie=(0,W.useMemo)(()=>{let e=new Set;for(let t of $??[])e.add(t.kind);return[...e].sort()},[$]),Le=n!==``||r!==`open`||a!==K||h!==K||p!==K||T.kind!==`relative`||T.from!==Ee.from;function Re(){b(K),t({search:{status:`open`},replace:!0})}async function ze(e){if(await Pe({title:re(),description:(0,G.jsxs)(G.Fragment,{children:[l(),` `,(0,G.jsx)(`span`,{className:`font-mono`,children:e.kind}),` `,c(),` `,(0,G.jsx)(`strong`,{children:s()}),`.`,` `,ne()]}),confirmLabel:d()}))try{await Q({anomalyId:e._id,status:`resolved`}),Z.success(u(),e.kind)}catch(e){Z.error(pe(),e)}}async function Be(e){try{await Q({anomalyId:e._id,status:`acknowledged`}),Z.success(i(),e.kind)}catch(e){Z.error(me(),e)}}return(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(`p`,{className:`oc-admin__hint`,children:[f(),` `,(0,G.jsx)(`strong`,{children:te()}),` `,o(),` `,(0,G.jsx)(`strong`,{children:ae()}),` `,O(),` `,(0,G.jsx)(`strong`,{children:ee()}),` `,ie(),` `,(0,G.jsx)(`span`,{className:`oc-filter__window`,children:k()})]}),(0,G.jsxs)(be,{q:n,onQChange:J,searchPlaceholder:ce(),timeRange:T,onTimeRangeChange:Ne,onReset:Re,canReset:Le,children:[(0,G.jsxs)(V,{value:r,onValueChange:Y,children:[(0,G.jsx)(F,{size:`sm`,className:`w-36`,children:(0,G.jsx)(N,{})}),(0,G.jsxs)(R,{children:[(0,G.jsx)(B,{value:K,children:A()}),Se.map(e=>(0,G.jsx)(B,{value:e.value,children:Ce(e.value)},e.value))]})]}),(0,G.jsxs)(V,{value:a,onValueChange:X,children:[(0,G.jsx)(F,{size:`sm`,className:`w-36`,children:(0,G.jsx)(N,{placeholder:D()})}),(0,G.jsxs)(R,{children:[(0,G.jsx)(B,{value:K,children:oe()}),we.map(e=>(0,G.jsx)(B,{value:e,children:e},e))]})]}),(0,G.jsxs)(V,{value:h,onValueChange:b,children:[(0,G.jsx)(F,{size:`sm`,className:`w-32`,children:(0,G.jsx)(N,{placeholder:_()})}),(0,G.jsxs)(R,{children:[(0,G.jsx)(B,{value:K,children:de()}),Te.map(e=>(0,G.jsx)(B,{value:e,children:e},e))]})]}),(0,G.jsxs)(V,{value:p,onValueChange:Me,children:[(0,G.jsx)(F,{size:`sm`,className:`w-36`,children:(0,G.jsx)(N,{placeholder:y()})}),(0,G.jsxs)(R,{children:[(0,G.jsx)(B,{value:K,children:S()}),Ie.map(e=>(0,G.jsx)(B,{value:e,children:e},e))]})]})]}),(0,G.jsx)(xe,{title:g(),rows:$,emptyHint:r===`open`?ue():E(),rowActions:e=>Fe&&e.status===`open`?[{label:he(),onSelect:()=>void ze(e)},{label:le(),onSelect:()=>void Be(e)}]:[],columns:[{header:w(),cell:e=>(0,G.jsx)(`span`,{className:`oc-traces__time`,children:new Date(e.at).toLocaleString(`fr-FR`)}),sort:e=>e.at},{header:y(),cell:e=>(0,G.jsx)(`code`,{className:`oc-traces__mono`,children:e.kind}),sort:e=>e.kind},{header:D(),cell:e=>(0,G.jsx)(ke,{severity:e.severity}),sort:e=>e.severity===`critical`?2:+(e.severity===`warn`)},{header:x(),cell:e=>(0,G.jsx)(Ae,{status:e.status}),sort:e=>e.status===`resolved`?2:+(e.status===`acknowledged`)},{header:_(),cell:e=>(0,G.jsx)(I,{variant:`outline`,children:e.source}),sort:e=>e.source},{header:se(),cell:e=>(0,G.jsx)(`span`,{className:`oc-anomaly__msg`,children:e.message}),sort:e=>e.message},{header:fe(),cell:e=>(0,G.jsx)(Oe,{row:e}),sort:e=>e.evidence??null},{header:C(),cell:e=>e.correlationId?(0,G.jsx)(`code`,{className:`oc-traces__mono`,children:je(e.correlationId)}):(0,G.jsx)(`span`,{className:`oc-traces__muted`,children:`—`}),sort:e=>e.correlationId}]})]})}function Y(e){if(e.kind!==`openclaw.dispatch_failures`||!e.evidence)return{};try{let t=JSON.parse(e.evidence);return{dominantCode:t.dominantCode,sampleCorrelationId:t.sampleCorrelationId}}catch{return{}}}function X(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 Oe({row:e}){let t=z();if(e.kind===`subagent.failure`){let n=X(e);return(0,G.jsxs)(`div`,{className:`oc-anomaly__cause`,children:[(0,G.jsx)(`div`,{className:`oc-anomaly__cause-head`,children:[...new Set(n.errorCategories??[])].map(e=>(0,G.jsx)(`code`,{className:`oc-traces__mono`,children:e},e))}),e.correlationId?(0,G.jsxs)(`button`,{type:`button`,className:`oc-anomaly__drill`,onClick:()=>void t({to:`/settings/traces`,search:{q:e.correlationId,limit:100}}),children:[`↗ `,b()]}):null]})}let n=Y(e);if(!n.dominantCode)return(0,G.jsx)(`span`,{className:`oc-traces__muted`,children:`—`});let r=U(n.dominantCode),i=n.sampleCorrelationId;return(0,G.jsxs)(`div`,{className:`oc-anomaly__cause`,children:[(0,G.jsxs)(`div`,{className:`oc-anomaly__cause-head`,children:[(0,G.jsx)(`span`,{className:`oc-anomaly__cause-label`,children:r.label}),(0,G.jsx)(`code`,{className:`oc-traces__mono`,children:n.dominantCode})]}),(0,G.jsx)(`p`,{className:`oc-anomaly__cause-hint`,children:r.hint}),i?(0,G.jsxs)(`button`,{type:`button`,className:`oc-anomaly__drill`,onClick:()=>void t({to:`/settings/traces`,search:{q:i,limit:100}}),children:[`↗ `,b()]}):null]})}function ke({severity:e}){return(0,G.jsx)(`span`,{className:`oc-anomaly__sev oc-anomaly__sev--${e}`,children:e})}function Ae({status:e}){return e===`open`?(0,G.jsx)(I,{variant:`destructive`,children:T()}):e===`acknowledged`?(0,G.jsx)(I,{variant:`secondary`,children:h()}):(0,G.jsx)(I,{variant:`outline`,children:r()})}function je(e){return e.length>8?e.slice(0,8):e}export{J as AnomaliesTab};
@@ -1 +1 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Ah as r,Bh as i,Fh as a,Hh as o,Ih as s,Lh as c,Mh as l,Nh as u,Oh as ee,Ph as d,Rh as f,Vh as p,dO as m,iO as h,jh as g,kh as _,zh as v}from"./dist-B-U7A_Kp.js";import{C as y,Mt as b,S as x,a as S,b as C,i as w,jt as T,o as E,r as D,t as O,x as k,y as A}from"./index-B6IXWbc8.js";import{n as j}from"./TimeRangePicker-CAhWZBEI.js";import{t as M}from"./FilterBar-BBJk4kP8.js";import{t as N}from"./AdvancedFilter-BOBkqtk6.js";import{t as P}from"./DataTableShell-DRaoMzdi.js";var F=t(e(),1),I=n(),L={kind:`relative`,from:O,to:`now`},R=`__all__`,z=[{value:`action`,label:`action`},{value:`realLabel`,label:`acteur réel`},{value:`targetLabel`,label:`au nom de`},{value:`impersonated`,label:`usurpation`},{value:`resource`,label:`ressource`},{value:`resourceId`,label:`id ressource`}];function B(){let e=b({from:`/settings/audit`}),t=T({from:`/settings/audit`}),n=e.q??``,O=e.action??R,B=e.impersonated??R,V=e.resource??R,H=D(e.from,e.to),U=(0,F.useMemo)(()=>E(e.adv),[e.adv]),{from:W,to:G}=j(H),K=e=>void t({search:t=>({...t,q:e||void 0}),replace:!0}),q=e=>void t({search:t=>({...t,action:e===R?void 0:e})}),J=e=>void t({search:t=>({...t,impersonated:e===R?void 0:e})}),Y=e=>void t({search:t=>({...t,resource:e===R?void 0:e})}),X=e=>void t({search:t=>({...t,...S(e)})}),Z=e=>void t({search:t=>({...t,adv:w(e)}),replace:!0}),Q=m(h.admin.listAudit,{filter:{q:n||void 0,from:W,to:G,action:O===R?void 0:O,resource:V===R?void 0:V,impersonated:B===R?void 0:B===`yes`,advanced:U.length>0?U:void 0}}),$=(0,F.useMemo)(()=>{let e=new Set;for(let t of Q??[])e.add(t.action);return[...e].sort()},[Q]),te=(0,F.useMemo)(()=>{let e=new Set;for(let t of Q??[])t.resource&&e.add(t.resource);return[...e].sort()},[Q]),ne=n!==``||O!==R||B!==R||V!==R||U.length>0||H.kind!==`relative`||H.from!==L.from;function re(){t({search:{},replace:!0})}return(0,I.jsxs)(I.Fragment,{children:[(0,I.jsxs)(`p`,{className:`oc-admin__hint`,children:[o(),` `,(0,I.jsx)(`span`,{className:`oc-filter__window`,children:p()})]}),(0,I.jsxs)(M,{q:n,onQChange:K,searchPlaceholder:i(),timeRange:H,onTimeRangeChange:X,onReset:re,canReset:ne,children:[(0,I.jsxs)(A,{value:O,onValueChange:q,children:[(0,I.jsx)(x,{size:`sm`,className:`w-40`,children:(0,I.jsx)(y,{placeholder:v()})}),(0,I.jsxs)(C,{children:[(0,I.jsx)(k,{value:R,children:f()}),$.map(e=>(0,I.jsx)(k,{value:e,children:e},e))]})]}),(0,I.jsxs)(A,{value:B,onValueChange:J,children:[(0,I.jsx)(x,{size:`sm`,className:`w-40`,children:(0,I.jsx)(y,{})}),(0,I.jsxs)(C,{children:[(0,I.jsx)(k,{value:R,children:c()}),(0,I.jsx)(k,{value:`yes`,children:s()}),(0,I.jsx)(k,{value:`no`,children:a()})]})]}),(0,I.jsxs)(A,{value:V,onValueChange:Y,children:[(0,I.jsx)(x,{size:`sm`,className:`w-40`,children:(0,I.jsx)(y,{placeholder:d()})}),(0,I.jsxs)(C,{children:[(0,I.jsx)(k,{value:R,children:u()}),te.map(e=>(0,I.jsx)(k,{value:e,children:e},e))]})]})]}),(0,I.jsx)(N,{fields:z,seed:U,onChange:Z}),(0,I.jsx)(P,{title:l(),rows:Q,emptyHint:g(),columns:[{header:r(),cell:e=>new Date(e.at).toLocaleString(`fr-FR`),sort:e=>e.at},{header:v(),cell:e=>e.action,sort:e=>e.action},{header:_(),cell:e=>e.realLabel,sort:e=>e.realLabel},{header:ee(),cell:e=>e.targetLabel??`—`,sort:e=>e.targetLabel??null},{header:d(),cell:e=>e.resource?e.resource+(e.resourceId?` · ${e.resourceId.slice(0,8)}`:``):`—`,sort:e=>e.resource??null}]})]})}export{B as AuditTab};
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Bh as r,Fh as i,Gh as a,Hh as o,Ih as s,Kh as c,Lh as l,Mh as u,Nh as ee,Ph as d,Rh as f,Uh as p,Vh as m,Wh as h,cO as g,hO as _,zh as v}from"./dist-CcSJxYOw.js";import{C as y,Mt as b,S as x,a as S,b as C,i as w,jt as T,o as E,r as D,t as O,x as k,y as A}from"./index-Dld_NfaR.js";import{n as j}from"./TimeRangePicker-JtLvHr3a.js";import{t as M}from"./FilterBar-NyP0u16q.js";import{t as N}from"./AdvancedFilter-BL2m0s1O.js";import{t as P}from"./DataTableShell-ezCmCHde.js";var F=t(e(),1),I=n(),L={kind:`relative`,from:O,to:`now`},R=`__all__`,z=[{value:`action`,label:`action`},{value:`realLabel`,label:`acteur réel`},{value:`targetLabel`,label:`au nom de`},{value:`impersonated`,label:`usurpation`},{value:`resource`,label:`ressource`},{value:`resourceId`,label:`id ressource`}];function B(){let e=b({from:`/settings/audit`}),t=T({from:`/settings/audit`}),n=e.q??``,O=e.action??R,B=e.impersonated??R,V=e.resource??R,H=D(e.from,e.to),U=(0,F.useMemo)(()=>E(e.adv),[e.adv]),{from:W,to:G}=j(H),K=e=>void t({search:t=>({...t,q:e||void 0}),replace:!0}),q=e=>void t({search:t=>({...t,action:e===R?void 0:e})}),J=e=>void t({search:t=>({...t,impersonated:e===R?void 0:e})}),Y=e=>void t({search:t=>({...t,resource:e===R?void 0:e})}),X=e=>void t({search:t=>({...t,...S(e)})}),Z=e=>void t({search:t=>({...t,adv:w(e)}),replace:!0}),Q=_(g.admin.listAudit,{filter:{q:n||void 0,from:W,to:G,action:O===R?void 0:O,resource:V===R?void 0:V,impersonated:B===R?void 0:B===`yes`,advanced:U.length>0?U:void 0}}),$=(0,F.useMemo)(()=>{let e=new Set;for(let t of Q??[])e.add(t.action);return[...e].sort()},[Q]),te=(0,F.useMemo)(()=>{let e=new Set;for(let t of Q??[])t.resource&&e.add(t.resource);return[...e].sort()},[Q]),ne=n!==``||O!==R||B!==R||V!==R||U.length>0||H.kind!==`relative`||H.from!==L.from;function re(){t({search:{},replace:!0})}return(0,I.jsxs)(I.Fragment,{children:[(0,I.jsxs)(`p`,{className:`oc-admin__hint`,children:[c(),` `,(0,I.jsx)(`span`,{className:`oc-filter__window`,children:a()})]}),(0,I.jsxs)(M,{q:n,onQChange:K,searchPlaceholder:h(),timeRange:H,onTimeRangeChange:X,onReset:re,canReset:ne,children:[(0,I.jsxs)(A,{value:O,onValueChange:q,children:[(0,I.jsx)(x,{size:`sm`,className:`w-40`,children:(0,I.jsx)(y,{placeholder:p()})}),(0,I.jsxs)(C,{children:[(0,I.jsx)(k,{value:R,children:o()}),$.map(e=>(0,I.jsx)(k,{value:e,children:e},e))]})]}),(0,I.jsxs)(A,{value:B,onValueChange:J,children:[(0,I.jsx)(x,{size:`sm`,className:`w-40`,children:(0,I.jsx)(y,{})}),(0,I.jsxs)(C,{children:[(0,I.jsx)(k,{value:R,children:m()}),(0,I.jsx)(k,{value:`yes`,children:r()}),(0,I.jsx)(k,{value:`no`,children:v()})]})]}),(0,I.jsxs)(A,{value:V,onValueChange:Y,children:[(0,I.jsx)(x,{size:`sm`,className:`w-40`,children:(0,I.jsx)(y,{placeholder:f()})}),(0,I.jsxs)(C,{children:[(0,I.jsx)(k,{value:R,children:l()}),te.map(e=>(0,I.jsx)(k,{value:e,children:e},e))]})]})]}),(0,I.jsx)(N,{fields:z,seed:U,onChange:Z}),(0,I.jsx)(P,{title:s(),rows:Q,emptyHint:i(),columns:[{header:d(),cell:e=>new Date(e.at).toLocaleString(`fr-FR`),sort:e=>e.at},{header:p(),cell:e=>e.action,sort:e=>e.action},{header:ee(),cell:e=>e.realLabel,sort:e=>e.realLabel},{header:u(),cell:e=>e.targetLabel??`—`,sort:e=>e.targetLabel??null},{header:f(),cell:e=>e.resource?e.resource+(e.resourceId?` · ${e.resourceId.slice(0,8)}`:``):`—`,sort:e=>e.resource??null}]})]})}export{B as AuditTab};
@@ -0,0 +1 @@
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$d as r,$u as i,Ar as a,Au as o,Bd as s,Bu as c,Dr as l,Er as u,Fr as d,Fu as f,Gd as p,Gu as m,Hu as h,Ir as g,Iu as _,Jd as ee,Ju as te,Kd as ne,Ku as re,Lr as ie,Lu as ae,Mr as oe,Mu as v,Nr as se,Nu as ce,Or as le,Pr as y,Pu as ue,Qu as de,Rr as fe,Ru as pe,Sr as me,Uu as he,Vd as ge,Vu as _e,Wd as ve,Wu as b,Xd as ye,Xu as be,Yd as xe,Yu as Se,Zd as Ce,Zu as we,_d as Te,ad as Ee,cO as x,cd as De,dd as Oe,ed as ke,ef as Ae,fO as je,fd as Me,gd as Ne,hO as S,hd as Pe,id as Fe,jr as Ie,ju as C,kr as Le,lO as w,ld as Re,mO as ze,md as Be,nd as Ve,od as He,pd as Ue,qd as We,qu as Ge,rd as T,sd as Ke,td as qe,ud as Je,vd as Ye,zr as Xe,zu as Ze}from"./dist-CcSJxYOw.js";import{i as E,r as Qe}from"./dist-ClJFgNZb.js";import{t as $e}from"./chevrons-up-down-BxjTVcP-.js";import{i as et,n as D,o as tt,r as nt,s as rt}from"./FieldLabel-P7nCb2ED.js";import{t as O}from"./button-Chsl3hJr.js";import{$ as it,A as at,At as ot,C as k,H as st,Q as ct,S as A,St as lt,U as ut,V as dt,X as j,Z as M,_ as ft,_t as pt,b as N,et as mt,jt as ht,kt as P,mt as F,nt as gt,ot as _t,rt as vt,x as I,y as L}from"./index-Dld_NfaR.js";import{a as yt,i as R,n as bt,o as z,r as B,t as xt}from"./table-CKAkPBqh.js";import{t as St}from"./FilterBar-NyP0u16q.js";import{a as Ct,n as wt,o as V,r as H,s as Tt,t as Et}from"./compatView-B-SErG8a.js";import{t as U}from"./dispatchErrorInfo-DY4Xsf5c.js";var Dt=w(`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`}]]),Ot=w(`wifi-off`,[[`path`,{d:`M12 20h.01`,key:`zekei9`}],[`path`,{d:`M8.5 16.429a5 5 0 0 1 7 0`,key:`1bycff`}],[`path`,{d:`M5 12.859a10 10 0 0 1 5.17-2.69`,key:`1dl1wf`}],[`path`,{d:`M19 12.859a10 10 0 0 0-2.007-1.523`,key:`4k23kn`}],[`path`,{d:`M2 8.82a15 15 0 0 1 4.177-2.643`,key:`1grhjp`}],[`path`,{d:`M22 8.82a15 15 0 0 0-11.288-3.764`,key:`z3jwby`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}]]),W=t(e(),1);function G(e){return e.filter(e=>e.state===`error`)}function kt(e){return e.reachable&&G(e.targets).length===0}function At(e){return e.state===`error`&&e.lastErrorCode!==null}function jt(e){return!!e.lastDownstreamRejectCode}function K(e){return e.kind??`openclaw`}function Mt(e){return[...e].sort((e,t)=>e===`openclaw`?-1:t===`openclaw`?1:e.localeCompare(t))}function Nt(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 Mt(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 Pt(e){return e===`openclaw`?`OpenClaw`:e===`hermes`?`Hermes`:e.charAt(0).toUpperCase()+e.slice(1)}var q=`__all__`,J={q:``,state:q,instance:q,version:q},Y={connected:0,error:1,idle:2};function Ft(e){return e.q.trim()!==``||e.state!==`__all__`||e.instance!==`__all__`||e.version!==`__all__`}function It(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 Z(e,t){return e===`version`?t.gatewayVersion===null:e===`lastOk`?t.lastOkAt===null:!1}function Lt(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 V(e,r)??X(e,r)}case`lastOk`:return t.lastOkAt-n.lastOkAt;default:return X(t.targetLabel,n.targetLabel)}}function Rt(e,t){if(!t)return e;let n=t.dir===`asc`?1:-1;return[...e].sort((e,r)=>{let i=Z(t.key,e),a=Z(t.key,r);return i&&a?0:i?1:a?-1:n*Lt(t.key,e,r)})}function zt(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 Bt(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 Vt(e){let t=new Set;for(let n of e)n.gatewayVersion!==null&&t.add(n.gatewayVersion);return[...t].sort((e,t)=>V(e,t)??X(e,t))}var Q=n();function Ht({connections:e,displayByInstance:t}){let[n,r]=(0,W.useState)(J),[i,a]=(0,W.useState)(null),o=(0,W.useMemo)(()=>e.map((e,n)=>({_id:`${e.key}:${e.canonical}/${e.agentId}:${n}`,targetLabel:`${e.canonical}/${e.agentId}`,state:e.state,instanceName:e.instanceName??null,instanceLabel:e.instanceName?t.get(e.instanceName)??e.instanceName:null,gatewayHost:e.gatewayHost,gatewayVersion:e.gatewayVersion??null,okCount:e.okCount,errorCount:e.errorCount,attempts:e.attempts,lastOkAt:e.lastOkAt??null,lastErrorCode:e.lastErrorCode??null,lastErrorAt:e.lastErrorAt??null,lastDownstreamRejectCode:e.lastDownstreamRejectCode??null,lastDownstreamRejectAt:e.lastDownstreamRejectAt??null})),[e,t]),s=(0,W.useMemo)(()=>zt(o),[o]),l=(0,W.useMemo)(()=>Bt(o),[o]),u=(0,W.useMemo)(()=>Vt(o),[o]),d=(0,W.useMemo)(()=>Rt(It(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,Q.jsx)(`p`,{className:`oc-admin__hint`,children:te()}):(0,Q.jsxs)(`div`,{className:`oc-conn`,children:[(0,Q.jsxs)(St,{q:n.q,onQChange:e=>r(t=>({...t,q:e})),searchPlaceholder:m(),onReset:()=>r(J),canReset:Ft(n),children:[(0,Q.jsxs)(L,{value:n.state,onValueChange:e=>r(t=>({...t,state:e})),children:[(0,Q.jsx)(A,{size:`sm`,className:`w-36`,children:(0,Q.jsx)(k,{placeholder:he()})}),(0,Q.jsxs)(N,{children:[(0,Q.jsx)(I,{value:q,children:b()}),s.map(e=>(0,Q.jsx)(I,{value:e,children:Wt(e)},e))]})]}),(0,Q.jsxs)(L,{value:n.instance,onValueChange:e=>r(t=>({...t,instance:e})),children:[(0,Q.jsx)(A,{size:`sm`,className:`w-40`,children:(0,Q.jsx)(k,{placeholder:h()})}),(0,Q.jsxs)(N,{children:[(0,Q.jsx)(I,{value:q,children:b()}),l.map(e=>(0,Q.jsx)(I,{value:e.name,children:e.label},e.name))]})]}),(0,Q.jsxs)(L,{value:n.version,onValueChange:e=>r(t=>({...t,version:e})),children:[(0,Q.jsx)(A,{size:`sm`,className:`w-36`,children:(0,Q.jsx)(k,{placeholder:_e()})}),(0,Q.jsxs)(N,{children:[(0,Q.jsx)(I,{value:q,children:b()}),u.map(e=>(0,Q.jsx)(I,{value:e,children:e},e))]})]})]}),d.length===0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:c()}):(0,Q.jsxs)(xt,{className:`oc-conn__table`,children:[(0,Q.jsx)(yt,{children:(0,Q.jsxs)(z,{children:[(0,Q.jsx)($,{label:Ze(),sortKey:`target`,sort:i,onSort:p}),(0,Q.jsx)($,{label:pe(),sortKey:`state`,sort:i,onSort:p}),(0,Q.jsx)($,{label:ae(),sortKey:`instance`,sort:i,onSort:p}),(0,Q.jsx)($,{label:_(),sortKey:`host`,sort:i,onSort:p}),(0,Q.jsx)($,{label:f(),sortKey:`version`,sort:i,onSort:p}),(0,Q.jsx)(R,{children:ue()}),(0,Q.jsx)($,{label:ce(),sortKey:`lastOk`,sort:i,onSort:p})]})}),(0,Q.jsx)(bt,{children:d.map(e=>(0,Q.jsx)(Ut,{r:e},e._id))})]})]})}function $({label:e,sortKey:t,sort:n,onSort:r}){let i=n?.key===t,a=i?n.dir:null;return(0,Q.jsx)(R,{"aria-sort":i?a===`asc`?`ascending`:`descending`:`none`,children:(0,Q.jsxs)(`button`,{type:`button`,className:`oc-conn__sort`,onClick:()=>r(t),children:[e,i?a===`asc`?(0,Q.jsx)(Qe,{size:13,"aria-hidden":!0}):(0,Q.jsx)(E,{size:13,"aria-hidden":!0}):(0,Q.jsx)($e,{size:13,"aria-hidden":!0,className:`oc-conn__sort-idle`})]})})}function Ut({r:e}){let t=At(e)?U(e.lastErrorCode):null,n=jt(e)?U(e.lastDownstreamRejectCode):null;return(0,Q.jsxs)(W.Fragment,{children:[(0,Q.jsxs)(z,{className:`oc-conn__row oc-conn__row--${e.state}`,children:[(0,Q.jsx)(B,{children:(0,Q.jsx)(`code`,{className:`oc-traces__mono`,children:e.targetLabel})}),(0,Q.jsx)(B,{children:(0,Q.jsx)(Gt,{state:e.state})}),(0,Q.jsx)(B,{children:e.instanceLabel?(0,Q.jsx)(`span`,{className:`oc-bridge-target__instance`,children:e.instanceLabel}):(0,Q.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})}),(0,Q.jsx)(B,{children:(0,Q.jsx)(`span`,{className:`oc-bridge-target__host`,children:e.gatewayHost})}),(0,Q.jsx)(B,{children:e.gatewayVersion?(0,Q.jsx)(`span`,{className:`oc-bridge-target__version`,children:e.gatewayVersion}):(0,Q.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})}),(0,Q.jsx)(B,{children:(0,Q.jsx)(`span`,{className:`oc-conn__stats`,children:Ge({ok:e.okCount,errors:e.errorCount,attempts:e.attempts})})}),(0,Q.jsx)(B,{children:e.lastOkAt?(0,Q.jsx)(`span`,{className:`oc-traces__mono`,children:new Date(e.lastOkAt).toLocaleTimeString(`fr-FR`)}):(0,Q.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})})]}),t||n?(0,Q.jsx)(z,{className:`oc-conn__detail-row`,children:(0,Q.jsxs)(B,{colSpan:7,className:`oc-conn__detail-cell`,children:[t?(0,Q.jsxs)(`div`,{className:`oc-bridge-target__error`,children:[(0,Q.jsx)(`strong`,{children:t.label}),` `,(0,Q.jsx)(`code`,{className:`oc-traces__mono`,children:e.lastErrorCode}),e.lastErrorAt?` · ${new Date(e.lastErrorAt).toLocaleTimeString(`fr-FR`)}`:``,(0,Q.jsx)(`p`,{className:`oc-bridge-card__hint`,children:t.hint})]}):null,n?(0,Q.jsxs)(`div`,{className:`oc-bridge-target__downstream`,children:[re({label:n.label}),` `,(0,Q.jsx)(`code`,{className:`oc-traces__mono`,children:e.lastDownstreamRejectCode}),e.lastDownstreamRejectAt?` · ${new Date(e.lastDownstreamRejectAt).toLocaleTimeString(`fr-FR`)}`:``]}):null]})}):null]})}function Wt(e){return e===`connected`?v():e===`error`?C():o()}function Gt({state:e}){return e===`connected`?(0,Q.jsx)(j,{variant:`secondary`,children:v()}):e===`error`?(0,Q.jsx)(j,{variant:`destructive`,children:C()}):(0,Q.jsx)(j,{variant:`outline`,children:o()})}function Kt(){return S(x.bridgeHealth.getBridgeHealth,{})}function qt(){let e=Kt(),t=S(x.compat.getBridgeCompat,{}),n=S(x.me.getMe,{host:_t})?.role===`admin`,r=S(x.admin.listInstances,n?{}:`skip`),i=ht(),a=()=>void i({to:`/settings/anomalies`,search:{status:`open`}}),o=Nt(e?e.targets:[],t?t.targets:[],r??[]),s=t?.compat??null,c=t===void 0?`loading`:t===null?`nodata`:`ready`,l=s!==null&&wt(s,`hermes`)&&!o.some(e=>e.key===`hermes`);return(0,Q.jsxs)(`div`,{className:`oc-bridge`,children:[(0,Q.jsx)(Jt,{health:e,compat:t,onSeeAnomalies:a}),(0,Q.jsx)(`p`,{className:`oc-admin__hint oc-bridge__caption`,children:Fe()}),o.map(e=>(0,Q.jsx)(Yt,{providerKey:e.key,connections:e.connections,instances:e.instances,manifest:s,compatStatus:c,compatReachable:t?.reachable??!0},e.key)),l?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:me()}):null]})}function Jt({health:e,compat:t,onSeeAnomalies:n}){let r=t!=null&&t.buildVersion!=null&&t.bridgeVersion!=null&&t.buildVersion!==t.bridgeVersion,a=t?.buildRevision&&t.buildRevision!==`unknown`?t.buildRevision.slice(0,7):null,o=t&&t!==null?(0,Q.jsxs)(`span`,{className:`oc-bridge-card__ver`,children:[(0,Q.jsx)(`code`,{className:`oc-traces__mono`,children:Ct(t.bridgeVersion)}),a?(0,Q.jsxs)(Q.Fragment,{children:[` `,(0,Q.jsxs)(`code`,{className:`oc-traces__mono`,title:ie(),children:[`(`,a,`)`]})]}):null,r?(0,Q.jsxs)(`strong`,{className:`oc-bridge-card__mismatch`,children:[` `,g({build:t.buildVersion??`?`})]}):null,` · `,d(),` `,(0,Q.jsx)(`code`,{className:`oc-traces__mono`,children:t.protocolVersion===null?y():String(t.protocolVersion)})]}):null;if(e===void 0)return(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:T()});if(e===null)return(0,Q.jsx)(`div`,{className:`oc-bridge-card oc-bridge-card--idle`,children:Ve()});let s=G(e.targets),c=!e.reachable,l=kt(e),u=l?`ok`:`error`,f=new Date(e.checkedAt).toLocaleString(`fr-FR`),p=e.startedAt==null?null:new Date(e.startedAt).toLocaleString(`fr-FR`);return(0,Q.jsxs)(`div`,{className:`oc-bridge-card oc-bridge-card--${u}`,children:[(0,Q.jsx)(`div`,{className:`oc-bridge-card__icon`,"aria-hidden":!0,children:l?(0,Q.jsx)(P,{size:22}):c?(0,Q.jsx)(Ot,{size:22}):(0,Q.jsx)(F,{size:22})}),(0,Q.jsxs)(`div`,{className:`oc-bridge-card__body`,children:[(0,Q.jsx)(`div`,{className:`oc-bridge-card__title`,children:l?qe():c?ke():i({count:s.length})}),(0,Q.jsxs)(`div`,{className:`oc-bridge-card__meta`,children:[(0,Q.jsxs)(`span`,{children:[(0,Q.jsx)(Dt,{size:12,"aria-hidden":!0}),` `,de({time:f})]}),p?(0,Q.jsx)(`span`,{children:we({time:p})}):null,o]}),c?(0,Q.jsx)(`p`,{className:`oc-bridge-card__hint`,children:U(e.lastError===`not_configured`?`NOT_CONFIGURED`:`BRIDGE_UNREACHABLE`).hint}):null]}),(0,Q.jsx)(`button`,{type:`button`,className:`oc-bridgebar__drill`,onClick:n,children:be()})]})}function Yt({providerKey:e,connections:t,instances:n,manifest:r,compatStatus:i,compatReachable:a}){let o=r?Tt(r,e):null,s=new Map;for(let e of n)s.set(e.name,e.displayName??e.name);let c=[],l=new Set;for(let n of t){if(!n.instanceName||l.has(n.instanceName))continue;l.add(n.instanceName);let t=n.gatewayVersion??null;c.push({instanceName:n.instanceName,displayName:s.get(n.instanceName)??n.instanceName,version:t,state:Et(t,e,r)})}let u=c.map(e=>e.state),d=u.includes(`beyond`)?`beyond`:u.length>0&&u.every(e=>e===`supported`)?`supported`:null,[f,p]=(0,W.useState)(!1);return(0,Q.jsxs)(`section`,{className:`oc-bridge-provider`,children:[(0,Q.jsxs)(`header`,{className:`oc-bridge-provider__head`,children:[(0,Q.jsx)(pt,{size:15,"aria-hidden":!0,className:`oc-bridge-provider__icon`}),(0,Q.jsx)(`span`,{className:`oc-bridge-provider__name`,children:Pt(e)}),d?(0,Q.jsx)(j,{variant:d===`beyond`?`destructive`:`secondary`,children:H(d)}):null]}),(0,Q.jsx)(`h4`,{className:`oc-bridge-provider__sub`,children:Xe()}),(0,Q.jsx)(Xt,{support:o,compatStatus:i,compatReachable:a,manifest:r,instanceRows:c}),(0,Q.jsxs)(`button`,{type:`button`,className:`oc-bridge-provider__sub oc-bridge-provider__sub--toggle`,"aria-expanded":f,onClick:()=>p(e=>!e),children:[f?(0,Q.jsx)(E,{size:13,"aria-hidden":!0}):(0,Q.jsx)(ot,{size:13,"aria-hidden":!0}),Se({count:t.length})]}),f?(0,Q.jsx)(Ht,{connections:t,displayByInstance:s}):null]})}function Xt({support:e,compatStatus:t,compatReachable:n,manifest:r,instanceRows:i}){return t===`loading`?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:T()}):t===`nodata`?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:fe()}):(0,Q.jsxs)(`div`,{className:`oc-compat`,children:[n?null:(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:se()}),r===null?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:oe()}):(0,Q.jsxs)(`div`,{className:`oc-compat__support`,children:[(0,Q.jsx)(`span`,{className:`oc-compat__label`,children:Ie()}),e&&e.range!==null?(0,Q.jsx)(`span`,{children:a({min:e.range.min,max:e.range.maxValidated})}):(0,Q.jsx)(`span`,{children:y()}),e?(0,Q.jsx)(en,{versions:e.validatedVersions}):null]}),i.length===0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:u()}):(0,Q.jsx)(`div`,{className:`oc-compat__targets`,children:i.map(e=>(0,Q.jsxs)(`div`,{className:`oc-compat__target`,children:[(0,Q.jsx)(`span`,{className:`oc-compat__instance`,children:e.displayName}),(0,Q.jsx)(`code`,{className:`oc-traces__mono`,children:Ct(e.version)}),(0,Q.jsx)(j,{variant:e.state===`supported`?`secondary`:e.state===`beyond`?`destructive`:`outline`,children:H(e.state)})]},e.instanceName))})]})}function Zt({instance:e,onClose:t}){return(0,Q.jsx)(ct,{open:!0,onOpenChange:e=>!e&&t(),children:(0,Q.jsxs)(it,{className:`oc-bridge-config-dialog`,onOpenAutoFocus:e=>e.preventDefault(),children:[(0,Q.jsxs)(gt,{children:[(0,Q.jsx)(vt,{children:Ae({instance:e.displayName??e.name})}),(0,Q.jsx)(mt,{children:r()})]}),(0,Q.jsx)($t,{instance:e,onClose:t})]})})}function Qt({label:e,result:t}){return t?t.checked?(0,Q.jsxs)(`p`,{className:`oc-bridge-config__check-row `+(t.ok?`oc-bridge-config__check-row--ok`:`oc-bridge-config__check-row--err`),children:[t.ok?(0,Q.jsx)(P,{"aria-hidden":!0}):(0,Q.jsx)(F,{"aria-hidden":!0}),(0,Q.jsxs)(`span`,{children:[e,` — `,t.ok?De():t.detail]})]}):(0,Q.jsxs)(`p`,{className:`oc-bridge-config__check-row oc-bridge-config__check-row--skip`,children:[e,` — `,Ke()]}):null}function $t({instance:e,onClose:t}){let n=ze(x.admin.upsertInstanceConfig),r=je(x.bridge.validateMediaPaths),i=at(),[a,o]=(0,W.useState)(()=>et(e.config??{})),[c,l]=(0,W.useState)(!1),[u,d]=(0,W.useState)(!1),[f,m]=(0,W.useState)(null),h=a.inboundMediaMode===`shared-fs`,g=a.mediaMode===`shared-fs`,_=h||g;async function te(){d(!0),m(null);try{m(await r({instanceName:e.name,inboundMediaMode:a.inboundMediaMode,mediaMode:a.mediaMode}))}catch(e){i.error(Me(),e)}finally{d(!1)}}async function re(){l(!0);try{let r=e.config??{};await n({instanceId:e._id,config:nt(a,r)}),t()}catch(e){i.error(ne(),e)}finally{l(!1)}}return(0,Q.jsx)(`div`,{className:`oc-bridge-config`,children:(0,Q.jsxs)(`div`,{className:`oc-bridge-config__form`,children:[(0,Q.jsxs)(`div`,{className:`oc-bridge-config__grid`,children:[(0,Q.jsxs)(`label`,{className:`oc-field`,children:[(0,Q.jsx)(D,{label:Ce(),help:p()}),(0,Q.jsxs)(L,{value:a.mediaMode,onValueChange:e=>o({...a,mediaMode:e}),children:[(0,Q.jsx)(A,{size:`sm`,className:`w-full`,children:(0,Q.jsx)(k,{})}),(0,Q.jsx)(N,{children:rt.map(e=>(0,Q.jsx)(I,{value:e,children:e},e))})]})]}),(0,Q.jsxs)(`label`,{className:`oc-field`,children:[(0,Q.jsx)(D,{label:ye(),help:ve()}),(0,Q.jsxs)(L,{value:a.inboundMediaMode,onValueChange:e=>o({...a,inboundMediaMode:e}),children:[(0,Q.jsx)(A,{size:`sm`,className:`w-full`,children:(0,Q.jsx)(k,{})}),(0,Q.jsx)(N,{children:tt.map(e=>(0,Q.jsx)(I,{value:e,children:e},e))})]})]}),(0,Q.jsxs)(`label`,{className:`oc-field`,children:[(0,Q.jsx)(D,{label:xe(),help:ge()}),(0,Q.jsx)(M,{type:`number`,min:1,max:4096,className:`w-full`,value:a.mediaMaxMb,onChange:e=>o({...a,mediaMaxMb:Math.trunc(Number(e.target.value)||0)})})]})]}),_&&(0,Q.jsxs)(`div`,{className:`oc-bridge-config__grid`,children:[h&&(0,Q.jsxs)(`label`,{className:`oc-field`,children:[(0,Q.jsx)(D,{label:Ye(),help:Te()}),(0,Q.jsx)(M,{className:`w-full`,spellCheck:!1,value:a.inboundAgentMount,onChange:e=>o({...a,inboundAgentMount:e.target.value})})]}),g&&(0,Q.jsxs)(`label`,{className:`oc-field`,children:[(0,Q.jsx)(D,{label:Ne(),help:Pe()}),(0,Q.jsx)(M,{className:`w-full`,spellCheck:!1,value:a.outboundAgentMount,onChange:e=>o({...a,outboundAgentMount:e.target.value})})]})]}),(0,Q.jsxs)(`label`,{className:`oc-field--row`,children:[(0,Q.jsx)(ft,{checked:a.rehydration,onCheckedChange:e=>o({...a,rehydration:e===!0})}),(0,Q.jsx)(D,{label:ee(),help:s()})]}),_&&f!==null&&(0,Q.jsx)(`div`,{className:`oc-bridge-config__check`,children:f.reachable?!f.inbound&&!f.outbound?(0,Q.jsxs)(`p`,{className:`oc-bridge-config__check-row oc-bridge-config__check-row--err`,children:[(0,Q.jsx)(F,{"aria-hidden":!0}),Ee({reason:f.reason??`?`})]}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(Qt,{label:Je(),result:f.inbound}),(0,Q.jsx)(Qt,{label:Re(),result:f.outbound}),(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:Oe()})]}):(0,Q.jsxs)(`p`,{className:`oc-bridge-config__check-row oc-bridge-config__check-row--err`,children:[(0,Q.jsx)(F,{"aria-hidden":!0}),He()]})}),(0,Q.jsxs)(`div`,{className:`oc-bridge-config__actions`,children:[_&&(0,Q.jsxs)(O,{variant:`outline`,size:`sm`,onClick:()=>void te(),disabled:u,children:[u?(0,Q.jsx)(lt,{className:`size-4 animate-spin`,"aria-hidden":!0}):null,u?Ue():Be()]}),(0,Q.jsx)(O,{size:`sm`,onClick:()=>void re(),disabled:c,children:We()})]})]})})}function en({versions:e}){if(e.length===0)return null;let t=[...e].reverse();return(0,Q.jsxs)(dt,{children:[(0,Q.jsx)(ut,{asChild:!0,children:(0,Q.jsxs)(`button`,{type:`button`,className:`oc-compat__versions-btn`,children:[e.length===1?Le():le({count:e.length}),(0,Q.jsx)(E,{size:13,"aria-hidden":!0})]})}),(0,Q.jsxs)(st,{className:`oc-compat__versions-pop`,align:`start`,children:[(0,Q.jsx)(`p`,{className:`oc-compat__versions-title`,children:l()}),(0,Q.jsx)(`div`,{className:`oc-compat__versions-list`,children:t.map(e=>(0,Q.jsx)(j,{variant:`secondary`,children:e},e))})]})]})}export{qt as BridgeTab,Zt as InstanceConfigDialog};
@@ -0,0 +1 @@
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Br as r,ES as i,FD as a,Gr as o,Hr as s,Jr as c,Kr as l,Oi as u,Qd as d,Qr as f,S as p,Ur as m,Vr as ee,Wr as h,Xr as te,Yr as ne,Zr as g,aa as re,b as _,cO as v,fO as y,fa as b,hO as x,mO as S,oa as C,qr as w,ua as ie,x as T}from"./dist-CcSJxYOw.js";import{t as E}from"./button-Chsl3hJr.js";import{A as ae,B as oe,C as se,F as ce,I as le,L as ue,N as de,P as fe,R as pe,S as me,Z as D,b as he,g as ge,h as O,mt as k,v as A,x as j,y as M,z as N}from"./index-Dld_NfaR.js";import{i as P}from"./compatView-B-SErG8a.js";/* empty css */var F=t(e(),1),I=[`off`,`minimal`,`low`,`medium`,`high`,`xhigh`];function L(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 R=n();function _e({instance:e}){let t=S(v.admin.upsertInstanceConfig),n=typeof e.config?.summarizeThresholdChars==`number`?e.config.summarizeThresholdChars:null,[r,i]=(0,F.useState)(n===null?``:String(n)),[a,s]=(0,F.useState)(`idle`);(0,F.useEffect)(()=>{i(n===null?``:String(n)),s(`idle`)},[e._id,n]);let c=r.trim(),u=c===``?null:/^\d+$/.test(c)?Number.parseInt(c,10):NaN,d=u===null||Number.isInteger(u)&&u>=1e3&&u<=2e5,f=(u??null)!==n;async function m(){s(`saving`);try{let n={...e.config??{}};u===null?delete n.summarizeThresholdChars:n.summarizeThresholdChars=u,await t({instanceId:e._id,config:n}),s(`done`)}catch{s(`error`)}}return(0,R.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,R.jsx)(`span`,{className:`oc-cdefaults__label`,children:p()}),(0,R.jsxs)(`div`,{className:`oc-cdefaults__inline`,children:[(0,R.jsx)(D,{type:`number`,min:1e3,max:2e5,step:1e3,placeholder:`8000`,value:r,onChange:e=>i(e.target.value),className:`oc-cdefaults__number`,"aria-invalid":!d}),(0,R.jsx)(E,{size:`sm`,disabled:!f||!d||a===`saving`,onClick:()=>void m(),children:a===`saving`?b():l()})]}),d?null:(0,R.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:_()}),a===`done`?(0,R.jsx)(`p`,{className:`oc-admin__hint`,role:`status`,children:o()}):null,a===`error`?(0,R.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:h()}):null,(0,R.jsx)(`p`,{className:`oc-cdefaults__help`,children:T()})]})}function z(){let e=y(v.agentFiles.getChatDefaults),t=y(v.agentFiles.setChatDefaults),n=ae(),[p,_]=(0,F.useState)({status:`loading`}),[S,T]=(0,F.useState)({thinkingDefault:null,fastModeDefault:null}),[D,z]=(0,F.useState)(!1),[B,V]=(0,F.useState)(!1),H=x(v.admin.listInstances,{}),[U,W]=(0,F.useState)(null);(0,F.useEffect)(()=>{!H||H.length===0||(!U||!H.some(e=>e.name===U))&&W(H[0].name)},[H,U]);let G=(H?.length??0)>1,ve=H!==void 0&&H.length===0,ye=x(v.compat.forInstance,U?{instanceName:U}:`skip`),K=U?A(ye,`configDefaults`):`loading`,q=K===`loading`?null:K.blocked,J=(0,F.useMemo)(()=>G&&U?{instanceName:U}:{},[G,U]),Y=(0,F.useRef)(0),X=(0,F.useCallback)(async()=>{let t=++Y.current;_({status:`loading`});try{let n=L(await e(J));if(Y.current!==t)return;_({status:`done`,current:n}),T(n)}catch{if(Y.current!==t)return;_({status:`error`})}},[e,J]);(0,F.useEffect)(()=>{q===!1&&(G&&!U||X())},[X,q,G,U]);let Z=p.status===`done`?p.current:null,Q=Z!==null&&S.thinkingDefault!==null&&S.thinkingDefault!==Z.thinkingDefault,$=Z!==null&&S.fastModeDefault!==null&&S.fastModeDefault!==Z.fastModeDefault,be=Q||$;async function xe(){V(!0);try{await t({...J,...Q?{thinkingDefault:S.thinkingDefault}:{},...$?{fastModeDefault:S.fastModeDefault}:{}}),n.success(o()),await X()}catch(e){n.error(h(),e)}finally{V(!1)}}let Se=(0,F.useMemo)(()=>I.map(e=>({id:e,label:ge(e)})),[]),Ce=(0,F.useMemo)(()=>[{id:`fast`,label:C()},{id:`standard`,label:re()}],[]);return(0,R.jsxs)(`div`,{className:`oc-cdefaults`,children:[(0,R.jsx)(`p`,{className:`oc-admin__hint`,children:f()}),G&&U?(0,R.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,R.jsx)(`span`,{className:`oc-cdefaults__label`,children:u()}),(0,R.jsxs)(M,{value:U,onValueChange:e=>W(e),disabled:B,children:[(0,R.jsx)(me,{size:`sm`,"aria-label":u(),children:(0,R.jsx)(se,{})}),(0,R.jsx)(he,{children:(H??[]).map(e=>(0,R.jsx)(j,{value:e.name,children:e.name},e.name))})]})]}):null,ve?(0,R.jsx)(`p`,{className:`oc-admin__hint`,role:`status`,children:d()}):K===`loading`?(0,R.jsx)(`p`,{className:`oc-admin__hint`,children:a()}):K.blocked?(0,R.jsxs)(`p`,{className:`oc-compat__blocked`,role:`status`,children:[(0,R.jsx)(k,{size:14,"aria-hidden":!0}),` `,P(K.gatewayVersion)]}):p.status===`loading`?(0,R.jsx)(`p`,{className:`oc-admin__hint`,children:a()}):p.status===`error`?(0,R.jsxs)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:[w(),` `,(0,R.jsx)(E,{variant:`outline`,size:`sm`,onClick:()=>void X(),children:ie()})]}):(0,R.jsxs)(R.Fragment,{children:[(0,R.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,R.jsx)(`span`,{className:`oc-cdefaults__label`,children:g()}),(0,R.jsx)(O,{options:Se,value:S.thinkingDefault,onChange:e=>T({...S,thinkingDefault:e}),disabled:B}),(0,R.jsx)(`p`,{className:`oc-cdefaults__help`,children:te()})]}),(0,R.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,R.jsx)(`span`,{className:`oc-cdefaults__label`,children:ne()}),(0,R.jsx)(O,{options:Ce,value:S.fastModeDefault===null?null:S.fastModeDefault?`fast`:`standard`,onChange:e=>T({...S,fastModeDefault:e===`fast`}),disabled:B}),(0,R.jsx)(`p`,{className:`oc-cdefaults__help`,children:c()})]}),(0,R.jsx)(`div`,{className:`oc-cdefaults__actions`,children:(0,R.jsx)(E,{size:`sm`,disabled:!be||B,onClick:()=>z(!0),children:B?b():l()})}),(0,R.jsx)(`p`,{className:`oc-cdefaults__note`,children:m()})]}),(()=>{let e=H?.find(e=>e.name===(U??H[0]?.name));return e?(0,R.jsx)(_e,{instance:e}):null})(),(0,R.jsx)(de,{open:D,onOpenChange:z,children:(0,R.jsxs)(le,{children:[(0,R.jsxs)(N,{children:[(0,R.jsx)(oe,{children:s()}),(0,R.jsx)(ue,{children:ee()})]}),(0,R.jsxs)(pe,{children:[(0,R.jsx)(ce,{children:i()}),(0,R.jsx)(fe,{onClick:()=>void xe(),children:r()})]})]})})]})}export{z as ChatDefaultsTab};
@@ -1 +1 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{_c as r,dc as i,fc as a,gc as o,hc as s,mc as c,pc as l}from"./dist-B-U7A_Kp.js";import{i as u,r as d}from"./dist-BNEZtSYw.js";import{t as f}from"./chevrons-up-down-CaKfHJNA.js";import{t as p}from"./button-CoB18od4.js";import{G as m,J as h,K as g,Tt as _,W as v,Y as y,_ as b,bt as x,ht as S}from"./index-B6IXWbc8.js";import{a as C,i as w,n as T,o as E,r as D,t as O}from"./table-CEVcfIlY.js";var k=t(e(),1);function A(e,t){return typeof e==`number`&&typeof t==`number`?e-t:typeof e==`boolean`&&typeof t==`boolean`?!!e-+!!t:String(e).localeCompare(String(t),void 0,{numeric:!0,sensitivity:`base`})}function j(e,t,n){return[...e].sort((e,r)=>{let i=t(e),a=t(r),o=i==null,s=a==null;if(o||s)return o&&s?0:o?1:-1;let c=A(i,a);return n===`asc`?c:-c})}var M=n();function N({title:e,rows:t,columns:n,rowActions:A,onAdd:N,addLabel:P=r(),bulkActions:F,emptyHint:I=o(),isExpanded:L,renderExpanded:R}){let[z,B]=(0,k.useState)(new Set),[V,H]=(0,k.useState)(null),U=t??[],W=V?n[V.index]:void 0,G=V&&W?.sort?j(U,W.sort,V.dir):U;function K(e){H(t=>!t||t.index!==e?{index:e,dir:`asc`}:t.dir===`asc`?{index:e,dir:`desc`}:null)}let q=+!!F+n.length+ +!!A,J=U.length>0&&z.size===U.length,Y=z.size>0&&!J;function X(){B(J?new Set:new Set(U.map(e=>e._id)))}function Z(e){B(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})}return(0,M.jsxs)(`div`,{className:`oc-dt`,children:[(0,M.jsxs)(`div`,{className:`oc-dt__bar`,children:[(0,M.jsx)(`h2`,{className:`oc-dt__title`,children:e}),(0,M.jsxs)(`div`,{className:`oc-dt__bar-actions`,children:[z.size>0&&F?F.map(e=>(0,M.jsxs)(p,{size:`sm`,variant:e.variant===`destructive`?`destructive`:`outline`,onClick:()=>{e.onSelect([...z]),B(new Set)},children:[e.variant===`destructive`?(0,M.jsx)(S,{}):null,e.label,` (`,z.size,`)`]},e.label)):null,N?(0,M.jsxs)(p,{size:`sm`,onClick:N,children:[(0,M.jsx)(x,{}),` `,P]}):null]})]}),t===void 0?(0,M.jsx)(`p`,{className:`oc-admin__hint`,children:s()}):U.length===0?(0,M.jsx)(`p`,{className:`oc-admin__hint`,children:I}):(0,M.jsxs)(O,{children:[(0,M.jsx)(C,{children:(0,M.jsxs)(E,{children:[F?(0,M.jsx)(w,{className:`w-8`,children:(0,M.jsx)(b,{"aria-label":c(),checked:J?!0:Y?`indeterminate`:!1,onCheckedChange:X})}):null,n.map((e,t)=>{let n=V?.index===t;return e.sort?(0,M.jsx)(w,{className:e.className,"aria-sort":n?V.dir===`asc`?`ascending`:`descending`:`none`,children:(0,M.jsxs)(`button`,{type:`button`,className:`oc-dt__sort`,onClick:()=>K(t),"aria-label":i({column:e.header}),children:[e.header,n?V.dir===`asc`?(0,M.jsx)(d,{className:`oc-dt__sort-icon`,"aria-hidden":!0}):(0,M.jsx)(u,{className:`oc-dt__sort-icon`,"aria-hidden":!0}):(0,M.jsx)(f,{className:`oc-dt__sort-icon oc-dt__sort-icon--idle`,"aria-hidden":!0})]})},e.header):(0,M.jsx)(w,{className:e.className,children:e.header},e.header)}),A?(0,M.jsx)(w,{className:`w-8`}):null]})}),(0,M.jsx)(T,{children:G.map(e=>{let t=A?.(e)??[],r=L?.(e)??!1;return(0,M.jsxs)(k.Fragment,{children:[(0,M.jsxs)(E,{className:`group/row`,children:[F?(0,M.jsx)(D,{children:(0,M.jsx)(b,{"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)(v,{children:[(0,M.jsx)(y,{asChild:!0,children:(0,M.jsx)(p,{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)(m,{align:`end`,children:t.map((t,n)=>(0,M.jsxs)(`div`,{children:[t.variant===`destructive`&&n>0?(0,M.jsx)(h,{}):null,(0,M.jsx)(g,{variant:t.variant,onSelect:()=>t.onSelect(e),children:t.label})]},t.label))})]}):null}):null]}),r&&R?(0,M.jsx)(E,{className:`oc-dt__expansion`,children:(0,M.jsx)(D,{colSpan:q,className:`oc-dt__expansion-cell`,children:R(e)})}):null]},e._id)})})]})]})}export{N as t};
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{_c as r,dc as i,fc as a,gc as o,hc as s,mc as c,pc as l}from"./dist-CcSJxYOw.js";import{i as u,r as d}from"./dist-ClJFgNZb.js";import{t as f}from"./chevrons-up-down-BxjTVcP-.js";import{t as p}from"./button-Chsl3hJr.js";import{G as m,J as h,K as g,Tt as _,W as v,Y as y,_ as b,bt as x,ht as S}from"./index-Dld_NfaR.js";import{a as C,i as w,n as T,o as E,r as D,t as O}from"./table-CKAkPBqh.js";var k=t(e(),1);function A(e,t){return typeof e==`number`&&typeof t==`number`?e-t:typeof e==`boolean`&&typeof t==`boolean`?!!e-+!!t:String(e).localeCompare(String(t),void 0,{numeric:!0,sensitivity:`base`})}function j(e,t,n){return[...e].sort((e,r)=>{let i=t(e),a=t(r),o=i==null,s=a==null;if(o||s)return o&&s?0:o?1:-1;let c=A(i,a);return n===`asc`?c:-c})}var M=n();function N({title:e,rows:t,columns:n,rowActions:A,onAdd:N,addLabel:P=r(),bulkActions:F,emptyHint:I=o(),isExpanded:L,renderExpanded:R}){let[z,B]=(0,k.useState)(new Set),[V,H]=(0,k.useState)(null),U=t??[],W=V?n[V.index]:void 0,G=V&&W?.sort?j(U,W.sort,V.dir):U;function K(e){H(t=>!t||t.index!==e?{index:e,dir:`asc`}:t.dir===`asc`?{index:e,dir:`desc`}:null)}let q=+!!F+n.length+ +!!A,J=U.length>0&&z.size===U.length,Y=z.size>0&&!J;function X(){B(J?new Set:new Set(U.map(e=>e._id)))}function Z(e){B(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})}return(0,M.jsxs)(`div`,{className:`oc-dt`,children:[(0,M.jsxs)(`div`,{className:`oc-dt__bar`,children:[(0,M.jsx)(`h2`,{className:`oc-dt__title`,children:e}),(0,M.jsxs)(`div`,{className:`oc-dt__bar-actions`,children:[z.size>0&&F?F.map(e=>(0,M.jsxs)(p,{size:`sm`,variant:e.variant===`destructive`?`destructive`:`outline`,onClick:()=>{e.onSelect([...z]),B(new Set)},children:[e.variant===`destructive`?(0,M.jsx)(S,{}):null,e.label,` (`,z.size,`)`]},e.label)):null,N?(0,M.jsxs)(p,{size:`sm`,onClick:N,children:[(0,M.jsx)(x,{}),` `,P]}):null]})]}),t===void 0?(0,M.jsx)(`p`,{className:`oc-admin__hint`,children:s()}):U.length===0?(0,M.jsx)(`p`,{className:`oc-admin__hint`,children:I}):(0,M.jsxs)(O,{children:[(0,M.jsx)(C,{children:(0,M.jsxs)(E,{children:[F?(0,M.jsx)(w,{className:`w-8`,children:(0,M.jsx)(b,{"aria-label":c(),checked:J?!0:Y?`indeterminate`:!1,onCheckedChange:X})}):null,n.map((e,t)=>{let n=V?.index===t;return e.sort?(0,M.jsx)(w,{className:e.className,"aria-sort":n?V.dir===`asc`?`ascending`:`descending`:`none`,children:(0,M.jsxs)(`button`,{type:`button`,className:`oc-dt__sort`,onClick:()=>K(t),"aria-label":i({column:e.header}),children:[e.header,n?V.dir===`asc`?(0,M.jsx)(d,{className:`oc-dt__sort-icon`,"aria-hidden":!0}):(0,M.jsx)(u,{className:`oc-dt__sort-icon`,"aria-hidden":!0}):(0,M.jsx)(f,{className:`oc-dt__sort-icon oc-dt__sort-icon--idle`,"aria-hidden":!0})]})},e.header):(0,M.jsx)(w,{className:e.className,children:e.header},e.header)}),A?(0,M.jsx)(w,{className:`w-8`}):null]})}),(0,M.jsx)(T,{children:G.map(e=>{let t=A?.(e)??[],r=L?.(e)??!1;return(0,M.jsxs)(k.Fragment,{children:[(0,M.jsxs)(E,{className:`group/row`,children:[F?(0,M.jsx)(D,{children:(0,M.jsx)(b,{"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)(v,{children:[(0,M.jsx)(y,{asChild:!0,children:(0,M.jsx)(p,{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)(m,{align:`end`,children:t.map((t,n)=>(0,M.jsxs)(`div`,{children:[t.variant===`destructive`&&n>0?(0,M.jsx)(h,{}):null,(0,M.jsx)(g,{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{X as t}from"./index-B6IXWbc8.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{X as t}from"./index-Dld_NfaR.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{$v as r,Av as i,Bv as a,Cv as o,Dv as s,Ev as c,Fv as l,Gv as u,Hv as d,Iv as f,Jv as p,Kv as m,Lv as ee,Mv as te,Nv as h,Ov as g,Pv as _,Qv as ne,Rv as re,Sv as v,Tv as y,Uv as ie,Vv as b,Wv as x,Xv as S,Yv as C,Zv as w,_v as T,ay as E,bv as D,cO as O,cv as k,cy as A,dv as j,ey as M,fv as N,gv as P,hO as F,hv as I,iy as L,jv as R,kv as z,lv as ae,mO as B,mv as V,ny as H,oy as U,pv as W,qv as G,ry as K,sv as q,sy as J,ty as oe,uv as se,vv as ce,wv as le,xv as ue,yv as de,zv as fe}from"./dist-CcSJxYOw.js";import{t as pe}from"./button-Chsl3hJr.js";import{j as me}from"./index-Dld_NfaR.js";import{t as he}from"./DataTableShell-ezCmCHde.js";var Y=t(e(),1),X=n(),Z={altered_words:()=>A(),incorrect:()=>J(),incoherence:()=>U(),formatting:()=>E(),latency:()=>L(),api_error:()=>K(),other:()=>H()},Q=e=>Z[e]?.()??e;function $({matches:e,sourceWasOpen:t}){return t?e===!0?(0,X.jsx)(`span`,{className:`oc-fbadmin__pill is-ok`,children:M()}):e===!1?(0,X.jsx)(`span`,{className:`oc-fbadmin__pill is-warn`,children:r()}):(0,X.jsx)(`span`,{className:`oc-fbadmin__pill`,children:`—`}):(0,X.jsx)(`span`,{className:`oc-fbadmin__pill`,children:oe()})}function ge({data:e,closeReason:t}){let n=e.snapshot,r=B(O.feedback.respondToFeedback),[i,o]=(0,Y.useState)(e.thread),[s,c]=(0,Y.useState)(``),[g,v]=(0,Y.useState)(!1);async function y(){let t=s.trim();if(!(!t||g)){v(!0);try{await r({feedbackId:e._id,text:t}),o(e=>[...e,{authorRole:`admin`,text:t,at:Date.now()}]),c(``)}finally{v(!1)}}}let T=[];try{T=n.contextJson?JSON.parse(n.contextJson):[]}catch{T=[]}return(0,X.jsxs)(`div`,{className:`oc-fbadmin__detail`,children:[(0,X.jsxs)(`div`,{className:`oc-fbadmin__row`,children:[(0,X.jsx)($,{matches:n.displayedMatchesStored,sourceWasOpen:n.clientInfo?.sourceWasOpen??!1}),(0,X.jsxs)(`span`,{className:`oc-fbadmin__meta`,children:[Q(e.category),` · `,n.messageRole,n.isRegeneration?` · ${ne()}`:``,n.openclawModel?` · ${n.openclawModel}`:``,n.openclawRuntime?` (${n.openclawRuntime})`:``]})]}),e.comment?(0,X.jsxs)(`section`,{children:[(0,X.jsx)(`h4`,{className:`oc-fbadmin__h`,children:w()}),(0,X.jsx)(`p`,{className:`oc-fbadmin__comment`,children:e.comment})]}):null,t?(0,X.jsxs)(`section`,{children:[(0,X.jsx)(`h4`,{className:`oc-fbadmin__h`,children:W()}),(0,X.jsx)(`p`,{className:`oc-fbadmin__comment`,children:t})]}):null,(0,X.jsxs)(`section`,{children:[(0,X.jsx)(`h4`,{className:`oc-fbadmin__h`,children:S()}),i.length>0?(0,X.jsx)(`div`,{className:`oc-fbadmin__thread`,children:i.map((e,t)=>(0,X.jsxs)(`div`,{className:`oc-notif__msg oc-notif__msg--${e.authorRole}`,children:[(0,X.jsx)(`span`,{className:`oc-notif__msg-who`,children:e.authorRole===`admin`?C():p()}),(0,X.jsx)(`span`,{className:`oc-notif__msg-text`,children:e.text})]},t))}):(0,X.jsx)(`p`,{className:`oc-fbadmin__meta`,children:G()}),(0,X.jsx)(`textarea`,{className:`oc-feedback__textarea`,placeholder:m(),value:s,maxLength:2e3,rows:3,onChange:e=>c(e.target.value.slice(0,2e3))}),(0,X.jsx)(`div`,{className:`oc-fbadmin__row`,style:{justifyContent:`flex-end`},children:(0,X.jsx)(pe,{size:`sm`,onClick:()=>void y(),disabled:!s.trim()||g,children:g?u():x()})})]}),(0,X.jsxs)(`section`,{children:[(0,X.jsx)(`h4`,{className:`oc-fbadmin__h`,children:ie()}),(0,X.jsx)(`pre`,{className:`oc-msg__source-pre`,children:n.messageText||d()})]}),n.clientInfo?.sourceWasOpen&&n.displayedText!==void 0?(0,X.jsxs)(`section`,{children:[(0,X.jsx)(`h4`,{className:`oc-fbadmin__h`,children:b()}),(0,X.jsx)(`pre`,{className:`oc-msg__source-pre`,children:n.displayedText||d()})]}):null,n.promptText?(0,X.jsxs)(`section`,{children:[(0,X.jsx)(`h4`,{className:`oc-fbadmin__h`,children:a()}),(0,X.jsx)(`pre`,{className:`oc-msg__source-pre`,children:n.promptText})]}):null,T.length>0?(0,X.jsxs)(`section`,{children:[(0,X.jsx)(`h4`,{className:`oc-fbadmin__h`,children:fe({count:n.contextCount??T.length,truncated:n.contextTruncated?re():``})}),(0,X.jsx)(`div`,{className:`oc-fbadmin__ctx`,children:T.map((e,t)=>(0,X.jsxs)(`div`,{className:`oc-fbadmin__ctx-turn`,children:[(0,X.jsx)(`span`,{className:`oc-fbadmin__ctx-role`,children:e.role}),(0,X.jsx)(`span`,{className:`oc-fbadmin__ctx-text`,children:e.text})]},t))})]}):null,n.outboxAvailable?(0,X.jsxs)(`section`,{children:[(0,X.jsx)(`h4`,{className:`oc-fbadmin__h`,children:ee()}),(0,X.jsxs)(`pre`,{className:`oc-msg__source-pre`,children:[n.outboxText??``,n.outboxStatus?`\n[status: ${n.outboxStatus}]`:``]})]}):null,n.clientInfo?.extensionsDetected&&n.clientInfo.extensionsDetected.length>0?(0,X.jsxs)(`section`,{children:[(0,X.jsx)(`h4`,{className:`oc-fbadmin__h`,children:f()}),(0,X.jsx)(`div`,{className:`oc-fbadmin__row`,children:n.clientInfo.extensionsDetected.map(e=>(0,X.jsx)(`span`,{className:`oc-fbadmin__pill is-warn`,children:e},e))})]}):null,(0,X.jsxs)(`section`,{children:[(0,X.jsx)(`h4`,{className:`oc-fbadmin__h`,children:l()}),(0,X.jsxs)(`p`,{className:`oc-fbadmin__env`,children:[[n.clientInfo?.language,n.clientInfo?.timezone,n.clientInfo?.theme?_({theme:n.clientInfo.theme}):null,n.runId?`run ${n.runId.slice(0,12)}…`:null].filter(Boolean).join(` · `)||`—`,n.clientInfo?.plugins&&n.clientInfo.plugins.length>0?(0,X.jsxs)(`span`,{className:`oc-fbadmin__plugins`,children:[h(),` `,n.clientInfo.plugins.join(`, `),(0,X.jsxs)(`span`,{className:`oc-fbadmin__note`,children:[` `,te()]})]}):null,n.clientInfo?.userAgent?(0,X.jsx)(`span`,{className:`oc-fbadmin__ua`,children:n.clientInfo.userAgent}):null]})]})]})}function _e(){let e=F(O.feedback.listForAdmin,{}),t=B(O.feedback.readSnapshot),n=B(O.feedback.deleteFeedback),r=me(),[a,l]=(0,Y.useState)(null),[u,d]=(0,Y.useState)({});async function f(e){if(a===e._id){l(null);return}if(!u[e._id]){let n=await t({feedbackId:e._id});d(t=>({...t,[e._id]:n}))}l(e._id)}async function p(e){await r({title:ae(),description:k(),confirmLabel:q(),destructive:!0})&&(await n({feedbackId:e._id}),a===e._id&&l(null))}return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`p`,{className:`oc-admin__hint`,children:[R(),` `,(0,X.jsx)(`strong`,{children:i()}),` `,z()]}),(0,X.jsx)(he,{title:g(),rows:e,emptyHint:s(),isExpanded:e=>a===e._id&&!!u[e._id],renderExpanded:e=>u[e._id]?(0,X.jsx)(ge,{data:u[e._id],closeReason:e.userCloseReason}):null,columns:[{header:c(),cell:e=>new Date(e.at).toLocaleString(`fr-FR`),sort:e=>e.at},{header:y(),cell:e=>Q(e.category),sort:e=>Q(e.category)},{header:le(),cell:e=>e.messageRole===`user`?o():v(),sort:e=>e.messageRole},{header:ue(),cell:e=>(e.reporterEmail||e.reporterName||`—`)+(e.impersonated&&e.realOperatorEmail?` ${D({operator:e.realOperatorEmail})}`:``),sort:e=>e.reporterEmail||e.reporterName||null},{header:de(),cell:e=>(0,X.jsx)($,{matches:e.displayedMatchesStored,sourceWasOpen:e.sourceWasOpen}),sort:e=>e.displayedMatchesStored===!1?0:e.displayedMatchesStored===!0?1:2},{header:ce(),cell:e=>e.hasComment?`✎`:`—`,sort:e=>+!!e.hasComment},{header:T(),cell:e=>e.userClosedAt==null?e.answered?(0,X.jsx)(`span`,{className:`oc-fbadmin__pill is-ok`,children:P()}):(0,X.jsx)(`span`,{className:`oc-fbadmin__pill`,children:I()}):(0,X.jsx)(`span`,{className:`oc-fbadmin__pill is-closed`,children:V()}),sort:e=>e.userClosedAt==null?+!!e.answered:2}],rowActions:e=>[{label:a===e._id?N():j(),onSelect:()=>void f(e)},{label:se(),onSelect:()=>void p(e),variant:`destructive`}]})]})}export{_e as FeedbacksTab};
@@ -1,4 +1,4 @@
1
- import{r as e}from"./bundle-mjs-C73ZY4La.js";import{aO as t,vO as n}from"./dist-B-U7A_Kp.js";import{c as r,l as i,s as a,u as o}from"./index-B6IXWbc8.js";var s=t(`circle-question-mark`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3`,key:`1u773s`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]]),c={media_delivery:{key:`media_delivery`,appliedIn:`bridge`,togglable:!0,placeholders:[`outboundDir`],defaultTemplate:`[LIVRAISON]
1
+ import{r as e}from"./bundle-mjs-C73ZY4La.js";import{SO as t,lO as n}from"./dist-CcSJxYOw.js";import{c as r,l as i,s as a,u as o}from"./index-Dld_NfaR.js";var s=n(`circle-question-mark`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3`,key:`1u773s`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]]),c={media_delivery:{key:`media_delivery`,appliedIn:`bridge`,togglable:!0,placeholders:[`outboundDir`],defaultTemplate:`[LIVRAISON]
2
2
  Pour qu'un fichier que tu génères soit téléchargeable par l'utilisateur dans ce webchat : écris-le sous {outboundDir}/ puis ajoute, dans ta réponse finale, une ligne dédiée EXACTEMENT au format MEDIA:<chemin absolu du fichier>. N'utilise PAS de lien markdown vers un chemin local — il ne serait pas cliquable.`},documentary_fetch:{key:`documentary_fetch`,appliedIn:`convex`,togglable:!0,placeholders:[`references`],defaultTemplate:`Fournis les fichiers source téléchargeables correspondant EXACTEMENT à ces références de documents (un fichier par référence, nommé d'après la référence). Réponds uniquement avec les fichiers, sans commentaire :
3
3
  {references}`,disabledTemplate:`{references}`},inbound_files:{key:`inbound_files`,appliedIn:`bridge`,togglable:!0,placeholders:[`files`],defaultTemplate:`[FICHIERS REÇUS]
4
4
  {files}`},history_summary:{key:`history_summary`,appliedIn:`convex`,togglable:!0,placeholders:[`previous_summary`,`new_messages`,`max_chars`],defaultTemplate:`[SYNTHÈSE DE CONVERSATION]
@@ -12,4 +12,4 @@ Tu maintiens le résumé cumulatif d'une conversation entre un utilisateur et un
12
12
  {previous_summary}
13
13
 
14
14
  [NOUVEAUX MESSAGES]
15
- {new_messages}`}},l=Object.keys(c);function u(e,t){return t.enabled?t.template:c[e].disabledTemplate??``}function d(e,t){return e.replace(/\{(\w+)\}/g,(e,n)=>{let r=t[n];return r===void 0?e:r})}var f=[`gateway-http`,`shared-fs`,`off`],p=[`inline`,`shared-fs`],m=[`reactive`,`sse`],h=`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()),summarizeThresholdChars:n.optional(n.number()),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 g={mediaMode:`gateway-http`,inboundMediaMode:`inline`,rehydration:!0,mediaMaxMb:1024,inboundAgentMount:`/home/node/.openclaw/media/inbound`,outboundAgentMount:`/home/node/.openclaw/media/outbound`};function _(e){let t={};for(let n of l){let r=e?.[n];t[n]={enabled:r?.enabled??!0,template:typeof r?.template==`string`&&r.template.length>0?r.template:c[n].defaultTemplate}}return t}function v(e){let t={};for(let n of l){let r=c[n],i=e[n];if(!i)continue;let a={};r.togglable&&i.enabled===!1&&(a.enabled=!1);let o=i.template.trim();o.length>0&&o!==r.defaultTemplate&&(a.template=o),(a.enabled!==void 0||a.template!==void 0)&&(t[n]=a)}return t}function y(e){return{mediaMode:e.mediaMode??g.mediaMode,inboundMediaMode:e.inboundMediaMode??g.inboundMediaMode,rehydration:e.rehydration??g.rehydration,mediaMaxMb:e.mediaMaxMb??g.mediaMaxMb,inboundAgentMount:e.inboundAgentMount??g.inboundAgentMount,outboundAgentMount:e.outboundAgentMount??g.outboundAgentMount,promptInjections:_(e.promptInjections)}}var b=[`summarizeThresholdChars`];function x(e,t){let n={},r=r=>{(e[r]!==g[r]||t[r]!==void 0)&&(n[r]=e[r])};r(`mediaMode`),r(`inboundMediaMode`),r(`rehydration`),r(`mediaMaxMb`),r(`inboundAgentMount`),r(`outboundAgentMount`);let i=v(e.promptInjections);Object.keys(i).length>0&&(n.promptInjections=i);let a=t;for(let e of b)typeof a[e]==`number`&&(n[e]=a[e]);return n}var S=e();function C({text:e}){return(0,S.jsx)(i,{delayDuration:150,children:(0,S.jsxs)(a,{children:[(0,S.jsx)(o,{asChild:!0,children:(0,S.jsx)(`button`,{type:`button`,className:`oc-field__help`,"aria-label":e,onClick:e=>e.preventDefault(),children:(0,S.jsx)(s,{"aria-hidden":!0})})}),(0,S.jsx)(r,{className:`max-w-xs text-pretty`,children:e})]})})}function w({label:e,help:t}){return(0,S.jsxs)(`span`,{className:`oc-field__label`,children:[e,(0,S.jsx)(C,{text:t})]})}export{h as a,m as c,u as d,d as f,y as i,c as l,w as n,p as o,x as r,f as s,C as t,l as u};
15
+ {new_messages}`}},l=Object.keys(c);function u(e,t){return t.enabled?t.template:c[e].disabledTemplate??``}function d(e,t){return e.replace(/\{(\w+)\}/g,(e,n)=>{let r=t[n];return r===void 0?e:r})}var f=[`gateway-http`,`shared-fs`,`off`],p=[`inline`,`shared-fs`],m=[`reactive`,`sse`],h=`reactive`;t.object({mediaMode:t.optional(t.union(t.literal(`gateway-http`),t.literal(`shared-fs`),t.literal(`off`))),inboundMediaMode:t.optional(t.union(t.literal(`inline`),t.literal(`shared-fs`))),rehydration:t.optional(t.boolean()),mediaMaxMb:t.optional(t.number()),summarizeThresholdChars:t.optional(t.number()),inboundAgentMount:t.optional(t.string()),outboundAgentMount:t.optional(t.string()),promptInjections:t.optional(t.record(t.string(),t.object({enabled:t.optional(t.boolean()),template:t.optional(t.string())})))});var g={mediaMode:`gateway-http`,inboundMediaMode:`inline`,rehydration:!0,mediaMaxMb:1024,inboundAgentMount:`/home/node/.openclaw/media/inbound`,outboundAgentMount:`/home/node/.openclaw/media/outbound`};function _(e){let t={};for(let n of l){let r=e?.[n];t[n]={enabled:r?.enabled??!0,template:typeof r?.template==`string`&&r.template.length>0?r.template:c[n].defaultTemplate}}return t}function v(e){let t={};for(let n of l){let r=c[n],i=e[n];if(!i)continue;let a={};r.togglable&&i.enabled===!1&&(a.enabled=!1);let o=i.template.trim();o.length>0&&o!==r.defaultTemplate&&(a.template=o),(a.enabled!==void 0||a.template!==void 0)&&(t[n]=a)}return t}function y(e){return{mediaMode:e.mediaMode??g.mediaMode,inboundMediaMode:e.inboundMediaMode??g.inboundMediaMode,rehydration:e.rehydration??g.rehydration,mediaMaxMb:e.mediaMaxMb??g.mediaMaxMb,inboundAgentMount:e.inboundAgentMount??g.inboundAgentMount,outboundAgentMount:e.outboundAgentMount??g.outboundAgentMount,promptInjections:_(e.promptInjections)}}var b=[`summarizeThresholdChars`];function x(e,t){let n={},r=r=>{(e[r]!==g[r]||t[r]!==void 0)&&(n[r]=e[r])};r(`mediaMode`),r(`inboundMediaMode`),r(`rehydration`),r(`mediaMaxMb`),r(`inboundAgentMount`),r(`outboundAgentMount`);let i=v(e.promptInjections);Object.keys(i).length>0&&(n.promptInjections=i);let a=t;for(let e of b)typeof a[e]==`number`&&(n[e]=a[e]);return n}var S=e();function C({text:e}){return(0,S.jsx)(i,{delayDuration:150,children:(0,S.jsxs)(a,{children:[(0,S.jsx)(o,{asChild:!0,children:(0,S.jsx)(`button`,{type:`button`,className:`oc-field__help`,"aria-label":e,onClick:e=>e.preventDefault(),children:(0,S.jsx)(s,{"aria-hidden":!0})})}),(0,S.jsx)(r,{className:`max-w-xs text-pretty`,children:e})]})})}function w({label:e,help:t}){return(0,S.jsxs)(`span`,{className:`oc-field__label`,children:[e,(0,S.jsx)(C,{text:t})]})}export{h as a,m as c,u as d,d as f,y as i,c as l,w as n,p as o,x as r,f as s,C as t,l as u};
@@ -0,0 +1 @@
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$E as r,BE as i,ES as ee,FD as te,FE as ne,GE as re,HE as ie,IE as ae,JE as oe,KE as a,LD as o,LE as s,ME as c,NE as l,PE as u,QE as d,RE as se,UE as ce,VE as le,WE as ue,XE as f,YE as de,ZE as p,aD as fe,cD as pe,cO as m,dD as me,eD as h,fD as he,hO as ge,iD as _e,lD as g,mO as ve,nD as _,oD as v,pD as y,qE as b,rD as x,sD as S,tD as C,uD as w,zE as T}from"./dist-CcSJxYOw.js";import{t as E}from"./button-Chsl3hJr.js";import{A as D,B as O,C as k,Et as A,F as j,G as M,I as N,K as P,L as F,N as ye,P as be,R as xe,S as I,Tt as Se,W as Ce,X as we,Y as Te,b as L,ht as Ee,x as R,y as z,yt as De,z as Oe}from"./index-Dld_NfaR.js";import{a as ke,i as B,n as Ae,o as V,r as H,t as je}from"./table-CKAkPBqh.js";var U=t(e(),1),W=n(),G=`all`;function K(e){switch(e){case`image`:return _();case`audio`:return C();case`video`:return h();case`pdf`:return r();case`document`:return d();case`archive`:return p();default:return f()}}function q(){let[e,t]=(0,U.useState)(G),[n,r]=(0,U.useState)(G),[d,f]=(0,U.useState)(G),[p,h]=(0,U.useState)(G),[_,C]=(0,U.useState)(null),q=ve(m.files.softDelete),J=D();function Me(){t(G),r(G),f(G),h(G)}async function Ne(){let e=_;if(C(null),e)try{await q({fileId:e.id}),J.success(T())}catch(e){J.error(se(),e)}}let Y=ge(m.files.listMine,{direction:e===G?void 0:e,chatId:n===G?void 0:n,instanceName:d===G?void 0:d,category:p===G?void 0:p}),X=(0,U.useMemo)(()=>new Intl.DateTimeFormat(o(),{dateStyle:`medium`,timeStyle:`short`}),[]);if(Y===void 0)return(0,W.jsx)(`p`,{className:`oc-admin__hint`,children:te()});let{files:Z,facets:Q,truncated:Pe,cap:Fe}=Y,$=e!==G||n!==G||d!==G||p!==G;return(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`p`,{className:`oc-admin__hint`,children:y()}),(0,W.jsxs)(`div`,{className:`oc-files__filters`,style:{display:`flex`,flexWrap:`wrap`,gap:8,margin:`12px 0`},children:[(0,W.jsxs)(z,{value:e,onValueChange:t,children:[(0,W.jsx)(I,{size:`sm`,"aria-label":he(),children:(0,W.jsx)(k,{})}),(0,W.jsxs)(L,{children:[(0,W.jsx)(R,{value:G,children:me()}),(0,W.jsx)(R,{value:`inbound`,children:w()}),(0,W.jsx)(R,{value:`outbound`,children:g()})]})]}),(0,W.jsxs)(z,{value:n,onValueChange:r,children:[(0,W.jsx)(I,{size:`sm`,"aria-label":pe(),children:(0,W.jsx)(k,{})}),(0,W.jsxs)(L,{children:[(0,W.jsx)(R,{value:G,children:S()}),Q.chats.map(e=>(0,W.jsx)(R,{value:e.id,children:e.title},e.id))]})]}),Q.multiProvider?(0,W.jsxs)(z,{value:d,onValueChange:f,children:[(0,W.jsx)(I,{size:`sm`,"aria-label":v(),children:(0,W.jsx)(k,{})}),(0,W.jsxs)(L,{children:[(0,W.jsx)(R,{value:G,children:fe()}),Q.instances.map(e=>(0,W.jsx)(R,{value:e,children:e},e))]})]}):null,(0,W.jsxs)(z,{value:p,onValueChange:h,children:[(0,W.jsx)(I,{size:`sm`,"aria-label":_e(),children:(0,W.jsx)(k,{})}),(0,W.jsxs)(L,{children:[(0,W.jsx)(R,{value:G,children:x()}),Q.categories.map(e=>(0,W.jsx)(R,{value:e,children:K(e)},e))]})]}),$?(0,W.jsxs)(E,{variant:`ghost`,size:`sm`,onClick:Me,style:{display:`inline-flex`,alignItems:`center`,gap:4,marginLeft:`auto`},children:[(0,W.jsx)(De,{size:14,"aria-hidden":!0}),ie()]}):null]}),Z.length===0?(0,W.jsx)(`p`,{className:`oc-admin__hint`,children:$?l():u()}):(0,W.jsxs)(W.Fragment,{children:[(0,W.jsxs)(je,{children:[(0,W.jsx)(ke,{children:(0,W.jsxs)(V,{children:[(0,W.jsx)(B,{children:de()}),(0,W.jsx)(B,{children:oe()}),(0,W.jsx)(B,{children:b()}),(0,W.jsx)(B,{children:a()}),(0,W.jsx)(B,{children:re()}),(0,W.jsx)(B,{className:`text-right`,children:ue()})]})}),(0,W.jsx)(Ae,{children:Z.map(e=>(0,W.jsxs)(V,{children:[(0,W.jsx)(H,{className:`font-medium`,style:{maxWidth:280,overflow:`hidden`,textOverflow:`ellipsis`},title:e.filename,children:e.filename}),(0,W.jsx)(H,{title:e.mimeType,children:K(e.category)}),(0,W.jsx)(H,{children:(0,W.jsx)(we,{variant:`secondary`,children:e.direction===`inbound`?w():g()})}),(0,W.jsx)(H,{style:{maxWidth:220,overflow:`hidden`,textOverflow:`ellipsis`},title:e.chatTitle,children:e.chatTitle}),(0,W.jsx)(H,{className:`whitespace-nowrap text-muted-foreground`,children:X.format(e.createdAt)}),(0,W.jsx)(H,{className:`text-right`,children:(0,W.jsxs)(Ce,{children:[(0,W.jsx)(Te,{asChild:!0,children:(0,W.jsx)(E,{variant:`ghost`,size:`icon`,"aria-label":le(),children:(0,W.jsx)(Se,{size:16})})}),(0,W.jsxs)(M,{align:`end`,children:[e.url?(0,W.jsx)(P,{asChild:!0,children:(0,W.jsxs)(`a`,{href:e.url,download:e.filename,target:`_blank`,rel:`noopener noreferrer`,children:[(0,W.jsx)(A,{size:14}),ce()]})}):(0,W.jsxs)(P,{disabled:!0,children:[(0,W.jsx)(A,{size:14}),ne()]}),(0,W.jsxs)(P,{variant:`destructive`,onSelect:()=>C({id:e._id,filename:e.filename}),children:[(0,W.jsx)(Ee,{size:14}),i()]})]})]})})]},e._id))})]}),Pe?(0,W.jsx)(`p`,{className:`oc-admin__hint`,style:{marginTop:8},children:c({cap:Fe})}):null]}),(0,W.jsx)(ye,{open:_!==null,onOpenChange:e=>!e&&C(null),children:(0,W.jsxs)(N,{children:[(0,W.jsxs)(Oe,{children:[(0,W.jsx)(O,{children:s()}),(0,W.jsx)(F,{children:ae()})]}),(0,W.jsxs)(xe,{children:[(0,W.jsx)(j,{children:ee()}),(0,W.jsx)(be,{onClick:()=>void Ne(),children:i()})]})]})})]})}export{q as FilesTab};
@@ -1 +1 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{vc as r,yc as i}from"./dist-B-U7A_Kp.js";import{t as a}from"./button-CoB18od4.js";import{Z as o,vt as s,yt as c}from"./index-B6IXWbc8.js";import{t as l}from"./TimeRangePicker-CAhWZBEI.js";var u=t(e(),1),d=n(),f=250;function p({q:e,onQChange:t,searchPlaceholder:n=i(),children:p,timeRange:m,onTimeRangeChange:h,onReset:g,canReset:_=!0}){let[v,y]=(0,u.useState)(e);(0,u.useEffect)(()=>{y(e)},[e]);let b=(0,u.useRef)(null);function x(e){y(e),b.current!==null&&window.clearTimeout(b.current),b.current=window.setTimeout(()=>t(e),f)}(0,u.useEffect)(()=>()=>{b.current!==null&&window.clearTimeout(b.current)},[]);function S(){b.current!==null&&window.clearTimeout(b.current),g()}return(0,d.jsxs)(`div`,{className:`oc-filterbar`,children:[(0,d.jsxs)(`div`,{className:`oc-filterbar__search`,children:[(0,d.jsx)(s,{className:`oc-filterbar__search-icon`,"aria-hidden":!0}),(0,d.jsx)(o,{value:v,onChange:e=>x(e.target.value),placeholder:n,"aria-label":n})]}),p?(0,d.jsx)(`div`,{className:`oc-filterbar__quick`,children:p}):null,m&&h?(0,d.jsx)(l,{value:m,onChange:h}):null,(0,d.jsxs)(a,{variant:`ghost`,size:`sm`,className:`oc-filterbar__reset`,onClick:S,disabled:!_,children:[(0,d.jsx)(c,{}),r()]})]})}export{p as t};
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{vc as r,yc as i}from"./dist-CcSJxYOw.js";import{t as a}from"./button-Chsl3hJr.js";import{Z as o,vt as s,yt as c}from"./index-Dld_NfaR.js";import{t as l}from"./TimeRangePicker-JtLvHr3a.js";var u=t(e(),1),d=n(),f=250;function p({q:e,onQChange:t,searchPlaceholder:n=i(),children:p,timeRange:m,onTimeRangeChange:h,onReset:g,canReset:_=!0}){let[v,y]=(0,u.useState)(e);(0,u.useEffect)(()=>{y(e)},[e]);let b=(0,u.useRef)(null);function x(e){y(e),b.current!==null&&window.clearTimeout(b.current),b.current=window.setTimeout(()=>t(e),f)}(0,u.useEffect)(()=>()=>{b.current!==null&&window.clearTimeout(b.current)},[]);function S(){b.current!==null&&window.clearTimeout(b.current),g()}return(0,d.jsxs)(`div`,{className:`oc-filterbar`,children:[(0,d.jsxs)(`div`,{className:`oc-filterbar__search`,children:[(0,d.jsx)(s,{className:`oc-filterbar__search-icon`,"aria-hidden":!0}),(0,d.jsx)(o,{value:v,onChange:e=>x(e.target.value),placeholder:n,"aria-label":n})]}),p?(0,d.jsx)(`div`,{className:`oc-filterbar__quick`,children:p}):null,m&&h?(0,d.jsx)(l,{value:m,onChange:h}):null,(0,d.jsxs)(a,{variant:`ghost`,size:`sm`,className:`oc-filterbar__reset`,onClick:S,disabled:!_,children:[(0,d.jsx)(c,{}),r()]})]})}export{p as t};
@@ -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,Ao as a,Ba as o,Co as s,Da as c,Do as l,Ea as u,Eo as d,Fa as f,Ga as p,Ha as m,Ia as h,Ja as g,Ka as _,La as v,Ma as y,Mo as b,Na as x,No as ee,Oa as S,Oo as C,Pa as w,Qa as T,Ra as E,So as te,Ta as D,To as ne,Ua as O,Va as k,Wa as A,Xa as re,Ya as j,Za as ie,_o as M,ao as ae,bo as oe,cO as N,co as se,do as ce,eo as P,fo as le,go as ue,hO as F,ho as de,io as I,ja as L,jo as fe,ka as pe,ko as me,lO as R,lo as he,mO as z,mo as ge,no as _e,oo as ve,po as ye,qa as be,ro as xe,so as Se,to as Ce,uo as we,vo as Te,wa as Ee,wo as De,xo as Oe,yo as ke,za as Ae}from"./dist-CcSJxYOw.js";import{t as je}from"./x-CfhV2nwo.js";import{i as B,n as V,r as Me,t as Ne}from"./tabs-0mZb1m9H.js";import{t as H}from"./button-Chsl3hJr.js";import{$ as Pe,A as U,At as Fe,C as Ie,Q as Le,S as Re,X as W,Z as G,_ as K,_t as q,b as ze,et as Be,gt as J,j as Ve,m as He,nt as Ue,ot as We,rt as Ge,x as Ke,y as qe}from"./index-Dld_NfaR.js";import{t as Je}from"./FilterBar-NyP0u16q.js";import{t as Ye}from"./DataTableShell-ezCmCHde.js";import{t as Y}from"./DetailChips-DZl7SJAQ.js";var Xe=R(`chevron-left`,[[`path`,{d:`m15 18-6-6 6-6`,key:`1wnfg3`}]]),Ze=R(`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=R(`shield-check`,[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`,key:`oel41y`}],[`path`,{d:`m9 12 2 2 4-4`,key:`dzmm74`}]]),Qe=R(`users`,[[`path`,{d:`M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2`,key:`1yyitq`}],[`path`,{d:`M16 3.128a4 4 0 0 1 0 7.744`,key:`16gr8j`}],[`path`,{d:`M22 21v-2a4 4 0 0 0-3-3.87`,key:`kshegd`}],[`circle`,{cx:`9`,cy:`7`,r:`4`,key:`nufk8`}]]),Z=t(e(),1);function $e(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 et(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 tt(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 nt(e){switch(e){case`admin`:return P();case`user`:return r();case`pending`:return T();default:return e}}function rt(e,t){if(e.length===0)return`none`;let n=0;for(let r of e)t(r)&&n++;return n===0?`none`:n===e.length?`all`:`some`}function it(e,t,n){let r=Math.max(1,Math.ceil(e.length/n)),i=Math.min(Math.max(1,Math.floor(t)),r),a=(i-1)*n;return{pageItems:e.slice(a,a+n),page:i,pageCount:r}}var Q=n(),$={name:``,description:``};function at(){let e=F(N.groups.listGroups,{}),t=F(N.me.getMe,{host:We})?.role===`admin`,n=z(N.groups.createGroup),r=z(N.groups.updateGroup),i=z(N.groups.deleteGroup),o=Ve(),f=U(),[p,m]=(0,Z.useState)(!1),[h,g]=(0,Z.useState)(null),[_,v]=(0,Z.useState)($),[y,x]=(0,Z.useState)(null),[S,w]=(0,Z.useState)(``),T=(0,Z.useMemo)(()=>{if(!e)return e;let t=S.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,S]);function E(){g(null),v($),m(!0)}function D(e){g(e),v({name:e.name,description:e.description??``}),m(!0)}async function O(){try{h?await r({groupId:h._id,name:_.name,description:_.description}):await n({name:_.name,description:_.description||void 0}),v($),g(null),m(!1)}catch(e){f.error(c(),e)}}async function k(e){if(await o({title:ge({name:e.name}),description:ye(),confirmWord:e.name,confirmLabel:le(),cancelLabel:oe(),destructive:!0}))try{await i({groupId:e._id})}catch(e){f.error(u(),e)}}return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:b()}),(0,Q.jsx)(Je,{q:S,onQChange:w,onReset:()=>w(``),canReset:S!==``,searchPlaceholder:ne()}),(0,Q.jsx)(Ye,{title:ee(),rows:T,addLabel:fe(),onAdd:t?E:void 0,emptyHint:a(),columns:[{header:me(),cell:e=>e.name,sort:e=>e.name},{header:C(),cell:e=>(0,Q.jsx)(Y,{icon:(0,Q.jsx)(Qe,{size:12,"aria-hidden":!0}),total:e.memberCount,items:e.members.map(e=>({label:e.label,marker:e.manager?(0,Q.jsx)(X,{size:11,"aria-hidden":!0}):null,highlight:e.manager}))}),sort:e=>e.memberCount},{header:l(),cell:e=>(0,Q.jsx)(Y,{icon:(0,Q.jsx)(q,{size:12,"aria-hidden":!0}),total:e.agentCount,items:e.agents.map(e=>({label:e}))}),sort:e=>e.agentCount},{header:d(),cell:e=>(0,Q.jsx)(Y,{icon:(0,Q.jsx)(Ze,{size:12,"aria-hidden":!0}),total:e.chartCount,items:e.charts.map(e=>({label:e.name,marker:e.isDefault?(0,Q.jsx)(J,{size:11,fill:`currentColor`,"aria-hidden":!0}):null,highlight:e.isDefault}))}),sort:e=>e.chartCount}],rowActions:e=>[{label:De(),onSelect:()=>x({groupId:e._id,name:e.name})},...t?[{label:s(),onSelect:()=>D(e)},{label:te(),variant:`destructive`,onSelect:()=>void k(e)}]:[]]}),(0,Q.jsx)(He,{open:p,onOpenChange:m,title:h?Te():ke(),description:M(),canSubmit:!!_.name.trim(),onSubmit:O,submitLabel:Oe(),children:(0,Q.jsxs)(`div`,{className:`oc-form`,children:[(0,Q.jsxs)(`label`,{className:`oc-field`,children:[(0,Q.jsx)(`span`,{className:`oc-field__label`,children:ue()}),(0,Q.jsx)(G,{value:_.name,onChange:e=>v({..._,name:e.target.value})})]}),(0,Q.jsxs)(`label`,{className:`oc-field`,children:[(0,Q.jsx)(`span`,{className:`oc-field__label`,children:de()}),(0,Q.jsx)(G,{value:_.description,onChange:e=>v({..._,description:e.target.value})})]})]})}),(0,Q.jsx)(ct,{groupId:y?.groupId??null,groupName:y?.name??``,open:y!==null,onOpenChange:e=>{e||x(null)}})]})}var ot=8;function st({page:e,pageCount:t,onPage:n}){return t<=1?null:(0,Q.jsxs)(`div`,{className:`oc-access__pager`,children:[(0,Q.jsxs)(H,{type:`button`,variant:`ghost`,size:`sm`,disabled:e<=1,onClick:()=>n(e-1),children:[(0,Q.jsx)(Xe,{size:14,"aria-hidden":!0}),xe()]}),(0,Q.jsxs)(`span`,{className:`oc-access__pageinfo`,"aria-label":Ce({page:e,pages:t}),children:[e,` / `,t]}),(0,Q.jsxs)(H,{type:`button`,variant:`ghost`,size:`sm`,disabled:e>=t,onClick:()=>n(e+1),children:[_e(),(0,Q.jsx)(Fe,{size:14,"aria-hidden":!0})]})]})}function ct({groupId:e,groupName:t,open:n,onOpenChange:r}){let a=F(N.groups.getGroup,n&&e?{groupId:e}:`skip`),s=F(N.groups.listAssignableInstances,n?{}:`skip`),c=F(N.groups.listAssignableUsers,n?{}:`skip`),l=z(N.groups.addMember),u=z(N.groups.removeMember),d=z(N.groups.bulkSetMembers),f=z(N.groups.setGroupManager),p=U(),[m,h]=(0,Z.useState)(``),[g,v]=(0,Z.useState)(``),[b,x]=(0,Z.useState)(`members`),[ee,S]=(0,Z.useState)(1),[C,w]=(0,Z.useState)(new Set),T=(0,Z.useRef)(null),E=(0,Z.useMemo)(()=>new Set((a?.members??[]).map(e=>e.userId)),[a]),te=(0,Z.useMemo)(()=>new Set((a?.members??[]).filter(e=>e.manager).map(e=>e.userId)),[a]),ne=a?.viewerIsAdmin===!0,O=(0,Z.useMemo)(()=>new Set((a?.agents??[]).map(e=>`${e.instanceName}/${e.agentId}`)),[a]);(0,Z.useEffect)(()=>{h(``),v(``),x(`members`),S(1),T.current=null},[n,e]),(0,Z.useEffect)(()=>{S(1)},[m]),(0,Z.useEffect)(()=>{n&&a&&e&&T.current!==e&&(T.current=e,w(new Set((a.members??[]).map(e=>e.userId))))},[n,a,e]);let k=(0,Z.useMemo)(()=>c?$e(c,m,C):[],[c,m,C]);async function A(t,n){if(e)try{n?await u({groupId:e,userId:t}):await l({groupId:e,userId:t})}catch(e){p.error(D(),e)}}async function re(t,n){if(e)try{await f({groupId:e,userId:t,manager:!n})}catch(e){p.error(pe(),e)}}let M=rt(k,e=>E.has(e.userId)),oe=k.filter(e=>E.has(e.userId)).length,P=it(k,ee,ot);async function le(){if(!e||k.length===0)return;let t=k.map(e=>e.userId);try{await d({groupId:e,userIds:t,member:M!==`all`})}catch(e){p.error(D(),e)}}return(0,Q.jsx)(Le,{open:n,onOpenChange:r,children:(0,Q.jsxs)(Pe,{className:`oc-access`,children:[(0,Q.jsxs)(Ue,{children:[(0,Q.jsx)(Ge,{children:ce({name:t})}),(0,Q.jsx)(Be,{children:we()})]}),(0,Q.jsxs)(Ne,{value:b,onValueChange:x,className:`oc-access__tabs`,children:[(0,Q.jsxs)(Me,{className:`w-full`,children:[(0,Q.jsxs)(B,{value:`members`,className:`flex-1 gap-1.5`,children:[(0,Q.jsx)(Qe,{size:13,"aria-hidden":!0}),he(),a?(0,Q.jsx)(W,{variant:`secondary`,className:`oc-access__tabcount`,children:E.size}):null]}),(0,Q.jsxs)(B,{value:`agents`,className:`flex-1 gap-1.5`,children:[(0,Q.jsx)(q,{size:13,"aria-hidden":!0}),Se(),a?(0,Q.jsx)(W,{variant:`secondary`,className:`oc-access__tabcount`,children:O.size}):null]}),(0,Q.jsxs)(B,{value:`charts`,className:`flex-1 gap-1.5`,children:[(0,Q.jsx)(Ze,{size:13,"aria-hidden":!0}),o(),a?(0,Q.jsx)(W,{variant:`secondary`,className:`oc-access__tabcount`,children:a.chartCount}):null]})]}),(0,Q.jsx)(V,{value:`members`,children:c===void 0||a===void 0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:j()}):c.length===0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:be()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(G,{value:m,onChange:e=>h(e.target.value),placeholder:se(),className:`oc-access__search`}),k.length===0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:ae()}):(0,Q.jsxs)(Q.Fragment,{children:[k.length>1?(0,Q.jsxs)(`div`,{className:`oc-access__row oc-access__selectall`,children:[(0,Q.jsx)(K,{checked:M===`all`?!0:M===`some`?`indeterminate`:!1,onCheckedChange:()=>void le(),"aria-label":I()}),(0,Q.jsx)(`span`,{className:`oc-access__label`,children:I()}),(0,Q.jsxs)(W,{variant:`outline`,className:`oc-access__count`,children:[oe,` / `,k.length]})]}):null,(0,Q.jsx)(`div`,{className:`oc-access__list`,children:P.pageItems.map(e=>{let t=E.has(e.userId),n=tt(e),r=te.has(e.userId);return(0,Q.jsxs)(`div`,{className:`oc-access__row`,children:[(0,Q.jsx)(K,{checked:t,onCheckedChange:()=>void A(e.userId,t),"aria-label":ie({user:n.primary})}),(0,Q.jsxs)(`span`,{className:`oc-access__who`,children:[(0,Q.jsx)(`span`,{className:`oc-access__label`,title:n.primary,children:n.primary}),n.secondary?(0,Q.jsx)(`span`,{className:`oc-access__sub`,title:n.secondary,children:n.secondary}):null]}),(0,Q.jsx)(W,{variant:`outline`,className:`oc-access__role`,children:nt(e.role)}),(0,Q.jsx)(`span`,{className:`oc-access__mgrslot`,children:t&&ne?(0,Q.jsx)(H,{type:`button`,variant:`ghost`,size:`icon`,className:`shrink-0 oc-access__mgr${r?` oc-access__mgr--on`:``}`,"aria-pressed":r,"aria-label":r?i():L(),title:r?i():L(),onClick:()=>void re(e.userId,r),children:(0,Q.jsx)(X,{size:15,"aria-hidden":!0})}):t&&r?(0,Q.jsx)(`span`,{className:`oc-access__mgr oc-access__mgr--on`,role:`img`,"aria-label":y(),title:y(),children:(0,Q.jsx)(X,{size:15,"aria-hidden":!0})}):null})]},e._id)})}),(0,Q.jsx)(st,{page:P.page,pageCount:P.pageCount,onPage:S})]})]})}),(0,Q.jsx)(V,{value:`agents`,children:s===void 0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:j()}):s.length===0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:_()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(G,{value:g,onChange:e=>v(e.target.value),placeholder:ve(),className:`oc-access__search`}),(0,Q.jsx)(`div`,{className:`oc-access__list`,children:s.map(t=>(0,Q.jsx)(lt,{groupId:e,instanceName:t.name,kind:t.kind??`openclaw`,assigned:O,query:g},`${e}-${t._id}`))})]})}),(0,Q.jsx)(V,{value:`charts`,children:(0,Q.jsx)(ut,{groupId:e})})]})]})})}function lt({groupId:e,instanceName:t,kind:n,assigned:r,query:i}){let a=F(N.groups.listAssignableAgents,{instanceName:t}),o=z(N.groups.assignAgentToGroup),s=z(N.groups.removeAgentFromGroup),c=z(N.groups.bulkSetGroupAgents),l=U(),[u,d]=(0,Z.useState)(1);if((0,Z.useEffect)(()=>{d(1)},[i]),!e)return null;let f=et(a?.agents??[],i),h=a?.discovery&&!a.discovery.lastPollOk;if(i.trim()&&f.length===0)return null;let _=f.filter(e=>e.presentInLastOk!==!1),v=rt(_,e=>r.has(`${t}/${e.agentId}`)),y=it(f,u,ot);async function b(n,r){try{r?await s({groupId:e,instanceName:t,agentId:n}):await o({groupId:e,instanceName:t,agentId:n})}catch(e){l.error(Ee(),e)}}async function x(){if(_.length===0)return;let n=_.map(e=>e.agentId);try{await c({groupId:e,instanceName:t,agentIds:n,assigned:v!==`all`})}catch(e){l.error(Ee(),e)}}return(0,Q.jsxs)(`div`,{className:`oc-access__group`,children:[(0,Q.jsxs)(`div`,{className:`oc-access__instance`,children:[(0,Q.jsx)(q,{size:13,"aria-hidden":!0}),(0,Q.jsx)(`span`,{children:t}),(0,Q.jsx)(W,{variant:`outline`,className:`oc-access__kind`,children:n}),h?(0,Q.jsx)(W,{variant:`outline`,className:`oc-access__stale`,children:O()}):null]}),a===void 0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:g()}):f.length===0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:h?A():p()}):(0,Q.jsxs)(Q.Fragment,{children:[_.length>1?(0,Q.jsxs)(`div`,{className:`oc-access__row oc-access__selectall`,children:[(0,Q.jsx)(K,{checked:v===`all`?!0:v===`some`?`indeterminate`:!1,onCheckedChange:()=>void x(),"aria-label":I()}),(0,Q.jsx)(`span`,{className:`oc-access__label`,children:I()})]}):null,y.pageItems.map(e=>{let n=`${t}/${e.agentId}`,i=r.has(n),a=e.presentInLastOk===!1;return(0,Q.jsxs)(`div`,{className:`oc-access__row`,children:[(0,Q.jsx)(K,{checked:i,disabled:a&&!i,onCheckedChange:()=>void b(e.agentId,i),"aria-label":re({name:e.displayName??e.agentId})}),(0,Q.jsxs)(`span`,{className:`oc-access__label`,title:e.displayName??e.agentId,children:[e.emoji?`${e.emoji} `:``,e.displayName??e.agentId]}),e.model?(0,Q.jsx)(`span`,{className:`oc-access__model`,children:e.model}):null,e.isDefaultOnInstance?(0,Q.jsx)(`span`,{className:`oc-access__fav`,role:`img`,"aria-label":k(),title:k(),children:(0,Q.jsx)(J,{size:14,fill:`currentColor`})}):null,a?(0,Q.jsx)(W,{variant:`outline`,className:`oc-access__gone`,children:m()}):null]},e.agentId)}),(0,Q.jsx)(st,{page:y.page,pageCount:y.pageCount,onPage:d})]})]})}function ut({groupId:e}){let t=F(N.charts.listGroupChartSelection,e?{groupId:e}:`skip`),n=z(N.charts.assignChartToGroup),r=z(N.charts.removeChartFromGroup),i=z(N.charts.setGroupDefaultChart),a=z(N.charts.addChartToGroupPool),o=z(N.charts.removeChartFromGroupPool),s=U();if(!e)return null;if(t===void 0)return(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:j()});let{pool:c,addable:l,canManagePool:u}=t;if(c.length===0&&!u)return(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:Ae()});async function d(t,i){try{i?await r({groupId:e,chartKey:t}):await n({groupId:e,chartKey:t})}catch(e){s.error(S(),e)}}async function p(t){try{await i({groupId:e,chartKey:t})}catch(e){s.error(S(),e)}}async function m(t){try{await a({groupId:e,chartKey:t})}catch(e){s.error(S(),e)}}async function g(t){try{await o({groupId:e,chartKey:t})}catch(e){s.error(S(),e)}}return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`div`,{className:`oc-access__list`,children:c.map(e=>(0,Q.jsxs)(`div`,{className:`oc-access__row`,children:[(0,Q.jsx)(K,{checked:e.selected,onCheckedChange:()=>void d(e.chartKey,e.selected),"aria-label":f({name:e.name})}),(0,Q.jsx)(`span`,{className:`oc-access__label`,title:e.name,children:e.name}),e.selected?e.isDefault?(0,Q.jsx)(`span`,{className:`oc-access__fav`,role:`img`,"aria-label":w(),title:w(),children:(0,Q.jsx)(J,{size:14,fill:`currentColor`})}):(0,Q.jsx)(H,{type:`button`,variant:`ghost`,size:`sm`,onClick:()=>void p(e.chartKey),children:x()}):null,u?(0,Q.jsx)(H,{type:`button`,variant:`ghost`,size:`sm`,"aria-label":h({name:e.name}),title:h({name:e.name}),onClick:()=>void g(e.chartKey),children:(0,Q.jsx)(je,{size:14,"aria-hidden":!0})}):null]},e.chartKey))}),u?l.length>0?(0,Q.jsxs)(qe,{value:``,onValueChange:e=>void m(e),children:[(0,Q.jsx)(Re,{size:`sm`,className:`oc-access__search`,children:(0,Q.jsx)(Ie,{placeholder:v()})}),(0,Q.jsx)(ze,{children:l.map(e=>(0,Q.jsx)(Ke,{value:e.chartKey,children:e.name},e.chartKey))})]}):c.length===0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:E()}):null:null]})}export{at as GroupsTab};
@@ -0,0 +1 @@
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$g as r,$h as i,A_ as a,Ag as o,Bg as s,C_ as c,Cg as l,D_ as u,Dg as d,E_ as f,Eg as p,Fg as m,Gg as h,Hd as g,Hg as _,Ig as v,Jg as y,Jh as b,Kg as x,L as S,Lg as C,M_ as w,Mg as T,N_ as E,Ng as D,O_ as O,Og as k,Pg as ee,Qg as te,Qh as ne,R as re,Rg as ie,S_ as ae,Sg as oe,T_ as se,Tg as ce,Ud as le,Ug as ue,Vg as de,Wg as fe,Xg as pe,Xh as me,Yg as he,Yh as ge,Zg as _e,Zh as ve,__ as ye,_g as be,a_ as xe,ag as Se,b_ as Ce,bg as we,cO as A,c_ as Te,cg as Ee,d_ as De,dg as Oe,e_ as ke,eg as Ae,fO as j,f_ as je,fg as Me,gC as M,g_ as Ne,gg as Pe,hC as N,hO as P,h_ as Fe,hg as Ie,i_ as Le,ig as Re,j_ as ze,jg as Be,k_ as Ve,kg as He,l_ as Ue,lg as We,mO as F,m_ as Ge,mg as I,n_ as Ke,ng as qe,o_ as Je,og as Ye,p_ as Xe,pg as Ze,qg as Qe,qh as $e,r_ as et,rg as tt,s_ as nt,sg as rt,t_ as it,tg as at,u_ as ot,ug as st,v_ as ct,vg as lt,w_ as ut,wg as dt,x_ as ft,xg as pt,y_ as L,yg as R,zg as z}from"./dist-CcSJxYOw.js";import{a as mt,c as ht}from"./FieldLabel-P7nCb2ED.js";import{t as B}from"./button-Chsl3hJr.js";import{$ as V,A as H,C as U,H as gt,Q as W,S as G,U as _t,V as vt,X as K,Z as q,_ as yt,b as bt,et as xt,j as St,m as Ct,nt as wt,rt as Tt,x as J,y as Et}from"./index-Dld_NfaR.js";import{t as Dt}from"./DataTableShell-ezCmCHde.js";import{InstanceConfigDialog as Ot}from"./BridgeTab-D9M2Jvdh.js";var Y=t(e(),1),X=[`conversational`,`documentary`,`summarizer`],kt=new Set(X),At=`conversational`;function jt(e){let t=new Set((e??[]).filter(e=>kt.has(e)));return t.size===0?[At]:X.filter(e=>t.has(e))}var Z=n(),Q={name:``,gatewayUrl:``,bridgeUrl:``,displayName:``,kind:`openclaw`,gatewayVersion:``,gatewayHttpUrl:``,streamTransport:mt},Mt={openclaw:[`token`,`deviceIdentity`],hermes:[`apiKey`]};function Nt(e){return{name:e.name,gatewayUrl:e.gatewayUrl,bridgeUrl:e.bridgeUrl??``,displayName:e.displayName??``,kind:e.kind??`openclaw`,gatewayVersion:e.gatewayVersion??``,gatewayHttpUrl:e.gatewayHttpUrl??``,streamTransport:e.streamTransport??`reactive`}}function Pt(){let e=P(A.admin.listInstances,{}),t=P(A.agents.listAllInstanceAgents,{}),n=F(A.admin.upsertInstance),r=F(A.admin.deleteInstance),i=H(),[o,s]=(0,Y.useState)(!1),[l,d]=(0,Y.useState)(Q),[p,m]=(0,Y.useState)(null),[h,_]=(0,Y.useState)(null),[v,y]=(0,Y.useState)(null),[x,S]=(0,Y.useState)(null);async function C(){try{await n({instanceId:x??void 0,name:l.name,gatewayUrl:l.gatewayUrl,bridgeUrl:l.bridgeUrl||void 0,displayName:l.displayName||void 0,kind:l.kind,gatewayVersion:l.gatewayVersion||void 0,gatewayHttpUrl:l.gatewayHttpUrl||void 0,streamTransport:l.streamTransport}),d(Q),S(null),s(!1)}catch(e){i.error(ze(),e)}}return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`p`,{className:`oc-admin__hint`,children:[a(),(0,Z.jsx)(`strong`,{children:Ve()}),O()]}),(0,Z.jsx)(Dt,{title:u(),rows:e,addLabel:f(),onAdd:()=>{S(null),d(Q),s(!0)},emptyHint:se(),columns:[{header:ut(),cell:e=>e.name,sort:e=>e.name},{header:c(),cell:e=>(0,Z.jsx)(K,{variant:`outline`,children:e.kind??`openclaw`}),sort:e=>e.kind??`openclaw`},{header:ae(),cell:e=>e.gatewayUrl,sort:e=>e.gatewayUrl},{header:ft(),cell:e=>e.displayName??`—`,sort:e=>e.displayName??null},{header:E(),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)(K,{variant:r(e.agentId)?`default`:`outline`,title:r(e.agentId)?b():void 0,children:[e.emoji?`${e.emoji} `:``,e.displayName??e.agentId]},e.agentId))})}}],rowActions:e=>[{label:ye(),onSelect:()=>{S(e._id),d(Nt(e)),s(!0)}},{label:w(),onSelect:()=>m(e.name)},{label:Ke(),onSelect:()=>y(e)},{label:Ce(),onSelect:()=>_(e)},{label:L(),variant:`destructive`,onSelect:()=>void r({instanceId:e._id})}],bulkActions:[{label:L(),variant:`destructive`,onSelect:e=>e.forEach(e=>void r({instanceId:e}))}]}),(0,Z.jsx)(Ct,{open:o,onOpenChange:s,title:x?Ne():ct(),description:Ge(),canSubmit:!!(l.name&&l.gatewayUrl),onSubmit:C,submitLabel:Xe(),children:(0,Z.jsxs)(`div`,{className:`oc-form`,children:[(0,Z.jsxs)($,{label:je(),children:[(0,Z.jsx)(q,{value:l.name,disabled:x!==null,onChange:e=>d({...l,name:e.target.value})}),x?(0,Z.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:Fe()}):null]}),(0,Z.jsx)($,{label:De(),children:(0,Z.jsxs)(Et,{value:l.kind,onValueChange:e=>d({...l,kind:e}),children:[(0,Z.jsx)(G,{size:`sm`,className:`w-40`,children:(0,Z.jsx)(U,{})}),(0,Z.jsxs)(bt,{children:[(0,Z.jsx)(J,{value:`openclaw`,children:`OpenClaw`}),(0,Z.jsx)(J,{value:`hermes`,children:`Hermes`})]})]})}),(0,Z.jsx)($,{label:ot(),children:(0,Z.jsx)(q,{value:l.gatewayUrl,onChange:e=>d({...l,gatewayUrl:e.target.value})})}),(0,Z.jsx)($,{label:Ue(),children:(0,Z.jsx)(q,{value:l.bridgeUrl,placeholder:Te(),onChange:e=>d({...l,bridgeUrl:e.target.value})})}),(0,Z.jsx)($,{label:nt(),children:(0,Z.jsx)(q,{value:l.displayName,onChange:e=>d({...l,displayName:e.target.value})})}),(0,Z.jsxs)($,{label:le(),children:[(0,Z.jsxs)(Et,{value:l.streamTransport,onValueChange:e=>d({...l,streamTransport:e}),children:[(0,Z.jsx)(G,{size:`sm`,className:`w-40`,children:(0,Z.jsx)(U,{})}),(0,Z.jsx)(bt,{children:ht.map(e=>(0,Z.jsx)(J,{value:e,children:e},e))})]}),(0,Z.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:g()})]}),(0,Z.jsx)($,{label:Je(),children:(0,Z.jsx)(q,{value:l.gatewayVersion,placeholder:xe(),onChange:e=>d({...l,gatewayVersion:e.target.value})})}),(0,Z.jsx)($,{label:Le(),children:(0,Z.jsx)(q,{value:l.gatewayHttpUrl,placeholder:et(),onChange:e=>d({...l,gatewayHttpUrl:e.target.value})})})]})}),(0,Z.jsx)(Wt,{instanceName:p,open:p!==null,onOpenChange:e=>{e||m(null)}}),h?(0,Z.jsx)(Ot,{instance:h,onClose:()=>_(null)},h._id):null,v?(0,Z.jsx)(Ft,{instance:v,onClose:()=>y(null)},v._id):null]})}function Ft({instance:e,onClose:t}){let n=P(A.instanceSecrets.listInstanceSecretStatus,{}),r=Mt[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)(W,{open:!0,onOpenChange:e=>!e&&t(),children:(0,Z.jsxs)(V,{onOpenAutoFocus:e=>e.preventDefault(),children:[(0,Z.jsxs)(wt,{children:[(0,Z.jsx)(Tt,{children:it({instance:e.displayName??e.name})}),(0,Z.jsx)(xt,{children:ke()})]}),(0,Z.jsx)(`div`,{className:`oc-form`,children:r.map(t=>(0,Z.jsx)(Rt,{instanceId:e._id,field:t,updatedAt:i[t]??null},t))}),(0,Z.jsx)(`div`,{className:`oc-bridgesecret`,children:(0,Z.jsx)(Lt,{instance:e})}),(0,Z.jsx)(It,{instance:e})]})})}function It({instance:e}){let t=j(A.instanceSync.forceInstanceSync),n=H(),[r,i]=(0,Y.useState)(!1);async function a(){if(!r){i(!0);try{switch((await t({instanceId:e._id})).status){case`synced`:n.success(ee());break;case`no_agents`:n.success(T());break;case`no_bridge_url`:n.error(Be());break;case`deploy_misconfigured`:n.error(o());break;case`unauthorized`:n.error(k());break;case`not_served`:n.error(d());break;default:n.error(He());break}}catch(e){n.error(D(),e)}finally{i(!1)}}}return(0,Z.jsxs)(`div`,{className:`oc-form`,children:[(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:p()}),(0,Z.jsx)(`div`,{className:`flex items-center gap-2`,children:(0,Z.jsx)(B,{size:`sm`,variant:`outline`,onClick:()=>void a(),disabled:r,children:r?m():v()})})]})}function Lt({instance:e}){let t=P(A.bridgeAuth.listBridgeAuthStatus,{}),n=j(A.bridgeAuth.mintBridgeSecret),r=F(A.bridgeAuth.revokeBridgeSecret),i=H(),[a,o]=(0,Y.useState)(!1),[s,c]=(0,Y.useState)(null),[u,d]=(0,Y.useState)(!1),f=(t??[]).find(t=>t.instanceId===e._id),p=f!==void 0;async function m(){if(!a){o(!0);try{c((await n({instanceId:e._id})).plaintext),d(!1)}catch(e){i.error(R(),e)}finally{o(!1)}}}async function h(){if(!a){o(!0);try{await r({instanceId:e._id}),c(null),i.success(we())}catch(e){i.error(R(),e)}finally{o(!1)}}}async function g(){if(s)try{await navigator.clipboard.writeText(s),d(!0)}catch{}}return(0,Z.jsxs)($,{label:ce(),children:[(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:dt()}),(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Z.jsx)(K,{variant:p?`outline`:`secondary`,children:p?`${pe()} · ${f.prefix}…${f.lastFour}`:he()}),(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(B,{size:`sm`,onClick:()=>void m(),disabled:a,children:p?oe():l()}),p?(0,Z.jsx)(B,{size:`sm`,variant:`destructive`,onClick:()=>void h(),disabled:a,children:pt()}):null]})]}),s?(0,Z.jsxs)(`div`,{className:`oc-bridgesecret__reveal`,children:[(0,Z.jsx)(`p`,{className:`oc-sa__minted-warning`,children:lt()}),(0,Z.jsxs)(`div`,{className:`oc-sa__minted-box`,children:[(0,Z.jsx)(`code`,{className:`oc-sa__minted-plain`,children:s}),(0,Z.jsx)(B,{variant:`outline`,size:`sm`,onClick:()=>void g(),children:u?M():N()})]}),(0,Z.jsx)(B,{size:`sm`,variant:`ghost`,onClick:()=>{c(null),d(!1)},children:be()})]}):null]})}function Rt({instanceId:e,field:t,updatedAt:n}){let i=j(A.instanceSecrets.setInstanceSecret),a=F(A.instanceSecrets.clearInstanceSecret),o=j(A.deviceIdentity.generateDeviceIdentity),c=H(),[l,u]=(0,Y.useState)(``),[d,f]=(0,Y.useState)(!1),[p,m]=(0,Y.useState)(null),[g,v]=(0,Y.useState)(!1),b=n!==null,S=t===`deviceIdentity`,w=t===`token`?r():t===`deviceIdentity`?te():_e();async function T(){if(!(!l.trim()||d)){f(!0);try{await i({instanceId:e,field:t,plaintext:l}),u(``),m(null),v(!1),c.success(fe())}catch(e){c.error(ue(),e)}finally{f(!1)}}}async function E(){if(!d){f(!0);try{await a({instanceId:e,field:t}),m(null),v(!1),c.success(_())}catch(e){c.error(ue(),e)}finally{f(!1)}}}async function D(){if(!d){f(!0);try{m(await o({instanceId:e})),v(!1),c.success(z())}catch(e){c.error(C(),e)}finally{f(!1)}}}let O=p?`openclaw devices approve ${p.id}`:``;async function k(){if(O)try{await navigator.clipboard.writeText(O),v(!0)}catch{}}return(0,Z.jsxs)($,{label:w,children:[S?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:s()}):null,(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Z.jsx)(K,{variant:b?`outline`:`secondary`,children:b?pe():he()}),(0,Z.jsx)(q,{type:`password`,autoComplete:`off`,className:`flex-1 min-w-32`,value:l,placeholder:b?Qe():y(),onChange:e=>u(e.target.value)}),(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(B,{size:`sm`,onClick:()=>void T(),disabled:d||l.trim().length===0,children:x()}),S?(0,Z.jsx)(B,{size:`sm`,variant:`outline`,onClick:()=>void D(),disabled:d,children:de()}):null,b?(0,Z.jsx)(B,{size:`sm`,variant:`destructive`,onClick:()=>void E(),disabled:d,children:h()}):null]})]}),p?(0,Z.jsxs)(`div`,{className:`oc-bridgesecret__reveal`,children:[(0,Z.jsx)(`p`,{className:`text-sm font-medium`,children:z()}),(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:ie()}),(0,Z.jsxs)(`div`,{className:`oc-sa__minted-box`,children:[(0,Z.jsx)(`code`,{className:`oc-sa__minted-plain`,children:O}),(0,Z.jsx)(B,{variant:`outline`,size:`sm`,onClick:()=>void k(),children:g?M():N()})]}),(0,Z.jsx)(B,{size:`sm`,variant:`ghost`,onClick:()=>{m(null),v(!1)},children:be()})]}):null]})}var zt={conversational:We,documentary:rt,summarizer:re},Bt={conversational:Ee,documentary:Ye,summarizer:S},Vt=e=>(zt[e]??(()=>e))(),Ht=e=>(Bt[e]??(()=>``))();function Ut({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:Ze()}),t.map(e=>(0,Z.jsx)(K,{variant:`secondary`,className:`oc-agenttype__chip`,title:Ht(e),children:Vt(e)},e)),(0,Z.jsxs)(vt,{children:[(0,Z.jsx)(_t,{asChild:!0,children:(0,Z.jsx)(B,{type:`button`,variant:`outline`,size:`sm`,className:`h-7`,children:Me()})}),(0,Z.jsxs)(gt,{align:`start`,className:`oc-agenttypes-pop`,children:[(0,Z.jsx)(`p`,{className:`oc-agenttypes-pop__title`,children:Oe()}),(0,Z.jsx)(`p`,{className:`oc-agenttypes-pop__hint`,children:st()}),(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)(yt,{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:Vt(r)}),(0,Z.jsx)(`span`,{className:`oc-agenttypes-pop__desc`,children:Ht(r)})]})]},r)})})]})]})]})}function Wt({instanceName:e,open:t,onOpenChange:n}){let r=P(A.agents.listAgentsForInstance,t&&e?{instanceName:e}:`skip`),a=F(A.agents.setAgentEnabled).withOptimisticUpdate((e,{instanceName:t,agentId:n,enabled:r})=>{let i=e.getQuery(A.agents.listAgentsForInstance,{instanceName:t});i&&e.setQuery(A.agents.listAgentsForInstance,{instanceName:t},{...i,agents:i.agents.map(e=>e.agentId===n?{...e,enabled:r}:e)})}),o=F(A.agents.setInstanceDefaultAgent).withOptimisticUpdate((e,{instanceName:t,agentId:n})=>{let r=e.getQuery(A.agents.listAgentsForInstance,{instanceName:t});r&&e.setQuery(A.agents.listAgentsForInstance,{instanceName:t},{...r,defaultAgentId:n})}),s=F(A.agents.setAgentTypes).withOptimisticUpdate((e,{instanceName:t,agentId:n,types:r})=>{let i=e.getQuery(A.agents.listAgentsForInstance,{instanceName:t});if(!i)return;let a=jt(r);e.setQuery(A.agents.listAgentsForInstance,{instanceName:t},{...i,agents:i.agents.map(e=>e.agentId===n?{...e,types:a}:e)})}),c=F(A.agents.removeInstanceAgent),l=St(),u=H();async function d(t,n){if(e)try{await a({instanceName:e,agentId:t,enabled:n})}catch(e){u.error(I(),e)}}async function f(t){if(e)try{await o({instanceName:e,agentId:t})}catch(e){u.error(I(),e)}}async function p(t,n,r){if(!e)return;let i=r.includes(n)?r.filter(e=>e!==n):[...r,n];try{await s({instanceName:e,agentId:t,types:i})}catch(e){u.error(I(),e)}}async function m(t,n){if(e&&await l({title:tt({name:n}),description:qe(),confirmLabel:at(),destructive:!0}))try{await c({instanceName:e,agentId:t}),u.success(Ae())}catch(e){u.error(I(),e)}}return(0,Z.jsx)(W,{open:t,onOpenChange:n,children:(0,Z.jsxs)(V,{className:`oc-access`,children:[(0,Z.jsxs)(wt,{children:[(0,Z.jsx)(Tt,{children:Pe({name:e??``})}),(0,Z.jsx)(xt,{children:Ie()})]}),r===void 0?(0,Z.jsx)(`p`,{className:`oc-access__hint`,children:i()}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`div`,{className:`oc-access__poll`,children:r.discovery===null?ne():r.discovery.lastPollOk?ve():me({error:r.discovery.error??`?`})}),r.agents.length===0?(0,Z.jsx)(`p`,{className:`oc-access__hint`,children:ge()}):(0,Z.jsx)(`div`,{className:`oc-access__list`,children:r.agents.map(e=>{let t=e.presentInLastOk===!1,n=r.defaultAgentId===e.agentId,i=e.displayName??e.agentId,a=e.types??[];return(0,Z.jsxs)(`div`,{className:`oc-agentcard`+(e.enabled?``:` oc-agentcard--off`),children:[(0,Z.jsxs)(`div`,{className:`oc-agentcard__head`,children:[(0,Z.jsx)(yt,{checked:e.enabled,disabled:t,"aria-label":i,onCheckedChange:t=>void d(e.agentId,t===!0)}),(0,Z.jsxs)(`span`,{className:`oc-agentcard__name`,title:i,children:[e.emoji?`${e.emoji} `:``,i]}),e.model?(0,Z.jsx)(`span`,{className:`oc-access__model`,children:e.model}):null,t?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(K,{variant:`outline`,className:`oc-access__gone`,children:$e()}),(0,Z.jsx)(B,{size:`sm`,variant:`ghost`,className:`h-7 text-destructive`,onClick:()=>void m(e.agentId,i),children:Re()})]}):n?(0,Z.jsx)(K,{variant:`default`,children:b()}):(0,Z.jsx)(B,{size:`sm`,variant:`outline`,className:`h-7`,disabled:!e.enabled,onClick:()=>void f(e.agentId),children:Se()})]}),e.enabled?(0,Z.jsx)(Ut,{agentId:e.agentId,types:a,onToggle:t=>void p(e.agentId,t,a)}):null]},e.agentId)})})]})]})})}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{Pt as InstancesTab};
@@ -0,0 +1 @@
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$t as r,$y as i,Ay as a,By as o,Cy as s,Dy as c,Ey as l,Fy as u,Gy as ee,Hy as d,Iy as te,Jy as f,Ky as ne,Ly as p,My as re,Ny as ie,Oy as ae,Py as oe,Qt as m,Qy as h,Ry as g,Sy as _,Ty as se,Uy as ce,Vy as v,Wy as le,Xy as y,Yy as b,Zt as x,Zy as S,_y as C,an as w,by as T,cO as E,dy as D,eb as O,en as k,fO as A,fy as j,gy as M,hO as N,hy as P,in as F,jy as I,ky as L,ly as R,mO as z,my as B,nn as V,py as H,qy as U,rn as W,tb as ue,tn as de,uy as fe,vy as pe,wy as me,xy as he,yy as ge,zy as _e}from"./dist-CcSJxYOw.js";import{t as G}from"./button-Chsl3hJr.js";import{C as ve,S as ye,X as K,Z as q,_ as be,b as xe,x as Se,y as Ce}from"./index-Dld_NfaR.js";import{t as we}from"./DataTableShell-ezCmCHde.js";var J=t(e(),1),Y=n();function Te(){let e=N(E.integrations.status.status,{}),t=z(E.admin.setIntegrationConfig),[n,r]=(0,J.useState)(null);if((0,J.useEffect)(()=>{e&&n===null&&r(e.config)},[e,n]),!e||!n)return(0,Y.jsx)(`p`,{className:`oc-admin__hint`,children:ue()});let m=n,x=(e,t,n)=>r({...m,[e]:{...m[e],[t]:n}}),k=(e,n)=>void t({[e]:n});return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(`p`,{className:`oc-admin__hint`,children:[O(),` `,(0,Y.jsx)(`strong`,{children:i()}),` `,h()]}),(0,Y.jsxs)(X,{title:`Langfuse`,status:e.langfuse.configured?e.langfuse.enabled?(0,Y.jsx)(K,{variant:`secondary`,children:S()}):(0,Y.jsx)(K,{variant:`outline`,children:y()}):(0,Y.jsx)(K,{variant:`outline`,children:b()}),note:U(),children:[(0,Y.jsx)(Z,{label:ee(),children:(0,Y.jsx)(q,{value:m.langfuse.host??``,placeholder:e.langfuse.effectiveHost,onChange:e=>x(`langfuse`,`host`,e.target.value),onBlur:()=>k(`langfuse`,{host:m.langfuse.host??``})})}),(0,Y.jsx)(Q,{label:v(),checked:m.langfuse.enabled??!0,onChange:e=>{x(`langfuse`,`enabled`,e),k(`langfuse`,{enabled:e})}})]}),(0,Y.jsxs)(X,{title:`Opik`,status:e.opik.configured?e.opik.enabled?(0,Y.jsx)(K,{variant:`secondary`,children:S()}):(0,Y.jsx)(K,{variant:`outline`,children:y()}):(0,Y.jsx)(K,{variant:`outline`,children:b()}),note:ne(),children:[(0,Y.jsx)(Z,{label:le(),children:(0,Y.jsx)(q,{value:m.opik.baseUrl??``,placeholder:e.opik.effectiveBaseUrl,onChange:e=>x(`opik`,`baseUrl`,e.target.value),onBlur:()=>k(`opik`,{baseUrl:m.opik.baseUrl??``})})}),(0,Y.jsx)(Z,{label:ce(),children:(0,Y.jsx)(q,{value:m.opik.workspace??``,placeholder:e.opik.effectiveWorkspace||d(),onChange:e=>x(`opik`,`workspace`,e.target.value),onBlur:()=>k(`opik`,{workspace:m.opik.workspace??``})})}),(0,Y.jsx)(Q,{label:v(),checked:m.opik.enabled??!0,onChange:e=>{x(`opik`,`enabled`,e),k(`opik`,{enabled:e})}})]}),(0,Y.jsxs)(X,{title:`OpenTelemetry (OTLP)`,status:e.otlp.configured?e.otlp.enabled?(0,Y.jsx)(K,{variant:`secondary`,children:S()}):(0,Y.jsx)(K,{variant:`outline`,children:y()}):(0,Y.jsx)(K,{variant:`outline`,children:w()}),note:F(),children:[(0,Y.jsx)(Z,{label:W(),children:(0,Y.jsx)(q,{value:m.otlp.endpoint??``,placeholder:e.otlp.effectiveEndpoint||`https://otlp.example.com/v1/traces`,onChange:e=>x(`otlp`,`endpoint`,e.target.value),onBlur:()=>k(`otlp`,{endpoint:m.otlp.endpoint??``})})}),(0,Y.jsx)(Ee,{headersSet:e.otlp.headersSet}),(0,Y.jsx)(Q,{label:v(),checked:m.otlp.enabled??!0,onChange:e=>{x(`otlp`,`enabled`,e),k(`otlp`,{enabled:e})}})]}),(0,Y.jsxs)(X,{title:o(),status:(0,Y.jsx)(K,{variant:`outline`,children:f()}),note:_e(),children:[(0,Y.jsx)(Z,{label:g(),children:(0,Y.jsx)($,{value:m.tts.auto??`off`,options:[[`off`,p()],[`always`,te()],[`inbound`,u()],[`tagged`,oe()]],onChange:e=>{x(`tts`,`auto`,e),k(`tts`,{auto:e})}})}),(0,Y.jsx)(Z,{label:ie(),children:(0,Y.jsx)($,{value:m.tts.provider??`openai`,options:[[`openai`,`OpenAI`],[`elevenlabs`,`ElevenLabs`],[`microsoft`,re()],[`azure`,`Azure Speech`],[`google`,`Google Gemini`]],onChange:e=>{x(`tts`,`provider`,e),k(`tts`,{provider:e})}})}),(0,Y.jsx)(Z,{label:I(),children:(0,Y.jsx)(q,{value:m.tts.model??``,placeholder:`eleven_multilingual_v2`,onChange:e=>x(`tts`,`model`,e.target.value),onBlur:()=>k(`tts`,{model:m.tts.model??``})})}),(0,Y.jsx)(Z,{label:a(),children:(0,Y.jsx)(q,{value:m.tts.voice??``,placeholder:L(),onChange:e=>x(`tts`,`voice`,e.target.value),onBlur:()=>k(`tts`,{voice:m.tts.voice??``})})})]}),(0,Y.jsxs)(X,{title:ae(),status:(0,Y.jsx)(K,{variant:`outline`,children:f()}),note:e.secrets.openai?c():l(),children:[(0,Y.jsx)(Q,{label:se(),checked:m.talk.enabled??!1,onChange:e=>{x(`talk`,`enabled`,e),k(`talk`,{enabled:e})}}),(0,Y.jsx)(Z,{label:me(),children:(0,Y.jsx)($,{value:m.talk.realtimeProvider??`openai`,options:[[`openai`,`OpenAI (gpt-realtime)`],[`google`,`Google`]],onChange:e=>{x(`talk`,`realtimeProvider`,e),k(`talk`,{realtimeProvider:e})}})}),(0,Y.jsx)(Z,{label:s(),children:(0,Y.jsx)(q,{value:m.talk.realtimeModel??``,placeholder:`gpt-realtime-2`,onChange:e=>x(`talk`,`realtimeModel`,e.target.value),onBlur:()=>k(`talk`,{realtimeModel:m.talk.realtimeModel??``})})}),(0,Y.jsx)(Z,{label:a(),children:(0,Y.jsx)(q,{value:m.talk.voice??``,placeholder:`cedar / marin`,onChange:e=>x(`talk`,`voice`,e.target.value),onBlur:()=>k(`talk`,{voice:m.talk.voice??``})})}),(0,Y.jsx)(Z,{label:_(),children:(0,Y.jsx)($,{value:m.talk.transport??`webrtc`,options:[[`webrtc`,he()],[`provider-websocket`,`Provider WebSocket`],[`gateway-relay`,`Gateway relay`]],onChange:e=>{x(`talk`,`transport`,e),k(`talk`,{transport:e})}})}),(0,Y.jsx)(Z,{label:T(),children:(0,Y.jsx)(q,{value:m.talk.speechLocale??``,placeholder:`fr-CA`,onChange:e=>x(`talk`,`speechLocale`,e.target.value),onBlur:()=>k(`talk`,{speechLocale:m.talk.speechLocale??``})})}),(0,Y.jsx)(Q,{label:ge(),checked:m.talk.interruptOnSpeech??!0,onChange:e=>{x(`talk`,`interruptOnSpeech`,e),k(`talk`,{interruptOnSpeech:e})}})]}),(0,Y.jsxs)(`section`,{className:`oc-int__section`,children:[(0,Y.jsxs)(`div`,{className:`oc-int__section-head`,children:[(0,Y.jsx)(`h3`,{className:`oc-uipa__h`,children:pe()}),(0,Y.jsx)(K,{variant:`outline`,children:C()})]}),(0,Y.jsxs)(`p`,{className:`oc-uipa__note`,children:[M(),(0,Y.jsx)(`code`,{children:` voicewake.get/set`}),`.`]})]}),(0,Y.jsx)(we,{title:P(),rows:e.cursors.map(e=>({...e,_id:e.vendor})),emptyHint:B(),columns:[{header:H(),cell:e=>(0,Y.jsx)(K,{variant:`secondary`,children:e.vendor}),sort:e=>e.vendor},{header:j(),cell:e=>e.lastAt>0?new Date(e.lastAt).toLocaleString(`fr-FR`):`—`,sort:e=>e.lastAt>0?e.lastAt:null},{header:D(),cell:e=>String(e.failureCount),sort:e=>e.failureCount},{header:fe(),cell:e=>e.lastErrorStatus??`—`,sort:e=>e.lastErrorStatus??null},{header:R(),cell:e=>e.lastError??`—`,sort:e=>e.lastError??null}]})]})}function X({title:e,status:t,note:n,children:r}){return(0,Y.jsxs)(`section`,{className:`oc-int__section`,children:[(0,Y.jsxs)(`div`,{className:`oc-int__section-head`,children:[(0,Y.jsx)(`h3`,{className:`oc-uipa__h`,children:e}),t]}),n?(0,Y.jsx)(`p`,{className:`oc-uipa__note`,children:n}):null,(0,Y.jsx)(`div`,{className:`oc-int__fields`,children:r})]})}function Z({label:e,children:t}){return(0,Y.jsxs)(`label`,{className:`oc-int__field`,children:[(0,Y.jsx)(`span`,{className:`oc-int__field-label`,children:e}),t]})}function Q({label:e,checked:t,onChange:n}){return(0,Y.jsxs)(`label`,{className:`oc-int__toggle`,children:[(0,Y.jsx)(be,{checked:t,onCheckedChange:e=>n(e===!0)}),(0,Y.jsx)(`span`,{children:e})]})}function $({value:e,options:t,onChange:n}){return(0,Y.jsxs)(Ce,{value:e,onValueChange:n,children:[(0,Y.jsx)(ye,{size:`sm`,className:`w-full`,children:(0,Y.jsx)(ve,{})}),(0,Y.jsx)(xe,{children:t.map(([e,t])=>(0,Y.jsx)(Se,{value:e,children:t},e))})]})}function Ee({headersSet:e}){let t=A(E.integrations.otlpSecret.setOtlpHeaders),n=z(E.integrations.otlpSecret.clearOtlpHeaders),[i,a]=(0,J.useState)(``),[o,s]=(0,J.useState)(null),[c,l]=(0,J.useState)(!1),u=async()=>{l(!0),s(null);try{await t({headersJson:i}),a(``)}catch(e){s(e instanceof Error?e.message:String(e))}finally{l(!1)}};return(0,Y.jsxs)(Z,{label:V(),children:[(0,Y.jsx)(q,{value:i,placeholder:e?de():k(),onChange:e=>a(e.target.value)}),(0,Y.jsxs)(`div`,{className:`oc-int__otlp-headers-actions`,children:[(0,Y.jsx)(G,{size:`sm`,disabled:c||i.trim().length===0,onClick:()=>void u(),children:r()}),e?(0,Y.jsx)(G,{variant:`ghost`,size:`sm`,disabled:c,onClick:()=>void n({}),children:m()}):null]}),o?(0,Y.jsx)(`p`,{className:`oc-int__otlp-headers-error`,children:o}):null,(0,Y.jsx)(`p`,{className:`oc-uipa__note`,children:x()})]})}export{Te as IntegrationsTab};
@@ -0,0 +1 @@
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Eb as r,Fb as i,Ib as a,Nb as o,Pb as s,Tb as c,au as l,cO as u,cu as d,du as f,fu as p,gu as m,hO as h,hu as g,iu as _,lu as v,mu as y,ou as b,pu as x,ru as S,su as C,sx as w,uu as T}from"./dist-CcSJxYOw.js";import{Mt as ee,a as te,jt as ne,n as re,ot as E,r as D}from"./index-Dld_NfaR.js";import{a as O,n as k,o as A,r as j,t as M}from"./card-BUOYrB8s.js";import{n as N,t as P}from"./TimeRangePicker-JtLvHr3a.js";var F=t(e(),1),I=n(),L=15,R=e=>String(Math.round(e));function z(){let e=h(u.me.getMe,{host:E})?.permissions?.includes(`traces.read`)??!1,t=h(u.deliveryTiming.listDeliverySessions,e?{}:`skip`),n=(0,F.useMemo)(()=>t?t.filter(e=>!e.active&&e.rollup!==null&&e.rollup.cP50!==null&&e.rollup.aP50!==null).slice(0,L).reverse().map(e=>({startedAt:e.startedAt,cP50:e.rollup?.cP50,aP50:e.rollup?.aP50})):[],[t]);return t===void 0?null:(0,I.jsxs)(`section`,{className:`oc-kpi__group`,children:[(0,I.jsx)(`h2`,{className:`oc-kpi__group-title`,children:w()}),(0,I.jsxs)(M,{children:[(0,I.jsxs)(O,{children:[(0,I.jsx)(A,{children:a()}),(0,I.jsx)(j,{children:s()})]}),(0,I.jsx)(k,{children:n.length<2?(0,I.jsx)(`p`,{className:`oc-admin__hint`,children:o()}):(0,I.jsx)(B,{series:n})})]})]})}function B({series:e}){let t=e.map(e=>e.cP50),n=e.map(e=>e.aP50),o=Math.max(1,...t,...n),s=t=>6+t*468/(e.length-1),l=e=>74-e*68/o,u=e=>e.map((e,t)=>`${t===0?`M`:`L`}${s(t).toFixed(1)},${l(e).toFixed(1)}`).join(` `),d=e[e.length-1];return(0,I.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,I.jsxs)(`div`,{className:`flex gap-3 text-xs text-muted-foreground`,children:[(0,I.jsxs)(`span`,{style:{color:`var(--primary)`},children:[c(),` p50 `,R(d.cP50),` `,i()]}),(0,I.jsxs)(`span`,{children:[r(),` p50 `,R(d.aP50),` `,i()]})]}),(0,I.jsxs)(`svg`,{viewBox:`0 0 480 80`,className:`h-20 w-full`,preserveAspectRatio:`none`,role:`img`,"aria-label":a(),children:[(0,I.jsx)(`path`,{d:u(n),fill:`none`,style:{stroke:`var(--muted-foreground)`},strokeWidth:1.5}),(0,I.jsx)(`path`,{d:u(t),fill:`none`,style:{stroke:`var(--primary)`},strokeWidth:1.5})]})]})}var V=[{metric:`api.calls`,label:m(),unit:`/h`,group:`API`,isError:!1},{metric:`api.errors`,label:g(),unit:`/h`,group:`API`,isError:!0},{metric:`api.latency.avg_ms`,label:y(),unit:`ms`,group:`API`,isError:!1},{metric:`openclaw.ingest`,label:x(),unit:`/h`,group:`OpenClaw`,isError:!1},{metric:`chat.send`,label:p(),unit:`/h`,group:`Chat`,isError:!1},{metric:`assistant.stream.errors`,label:f(),unit:`/h`,group:`Assistant`,isError:!0}],H=V.length,U=[`API`,`OpenClaw`,`Chat`,`Assistant`],W=1e3,G=36e5;function K(e,t){let n=Math.max(1,Math.ceil((t-e)/G)),r=Math.min(n*H,W);return{rowLimit:r,buckets:Math.max(1,Math.floor(r/H))}}function q(){let e=ee({from:`/settings/kpi`}),t=ne({from:`/settings/kpi`}),n=D(e.from,e.to,re,`now`),r=e=>void t({search:t=>({...t,...te(e)})}),{from:i,to:a}=N(n),{rowLimit:o,buckets:s}=K(i,a),c=h(u.kpi.listKpis,{limit:o,filter:{from:i,to:a}}),l=(0,F.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]),f=(0,I.jsxs)(I.Fragment,{children:[(0,I.jsxs)(`p`,{className:`oc-admin__hint`,children:[T(),` `,(0,I.jsx)(`span`,{className:`oc-filter__window`,children:v()})]}),(0,I.jsx)(J,{value:n,onChange:r})]});return c===void 0?(0,I.jsxs)(I.Fragment,{children:[f,(0,I.jsx)(z,{}),(0,I.jsx)(`p`,{className:`oc-admin__hint`,children:d()})]}):c.length===0?(0,I.jsxs)(I.Fragment,{children:[f,(0,I.jsx)(z,{}),(0,I.jsx)(`p`,{className:`oc-admin__hint`,children:C()})]}):(0,I.jsxs)(I.Fragment,{children:[f,(0,I.jsx)(z,{}),U.map(e=>{let t=V.filter(t=>t.group===e);return t.some(e=>(l.get(e.metric)??[]).length>0)?(0,I.jsxs)(`section`,{className:`oc-kpi__group`,children:[(0,I.jsx)(`h2`,{className:`oc-kpi__group-title`,children:e}),(0,I.jsx)(`div`,{className:`oc-kpi__grid`,children:t.map(e=>(0,I.jsx)(Y,{config:e,series:l.get(e.metric)??[]},e.metric))})]},e):null})]})}function J({value:e,onChange:t}){return(0,I.jsx)(`div`,{className:`oc-kpi__toolbar`,children:(0,I.jsx)(P,{value:e,onChange:t})})}function Y({config:e,series:t}){let n=t.length>0?t[t.length-1]:null,r=n?n.value:0;return(0,I.jsxs)(M,{size:`sm`,className:`oc-kpi__card`,children:[(0,I.jsxs)(O,{children:[(0,I.jsx)(A,{className:`oc-kpi__card-title`,children:e.label}),(0,I.jsx)(j,{className:`oc-kpi__card-metric`,children:(0,I.jsx)(`code`,{children:e.metric})})]}),(0,I.jsxs)(k,{className:`oc-kpi__card-body`,children:[(0,I.jsxs)(`div`,{className:`oc-kpi__value-row`,children:[(0,I.jsx)(`span`,{className:`oc-kpi__value`+(e.isError&&r>0?` oc-kpi__value--error`:``),children:Q(r)}),(0,I.jsx)(`span`,{className:`oc-kpi__unit`,children:e.unit})]}),(0,I.jsx)(ae,{series:t,isError:e.isError,unit:e.unit}),(0,I.jsxs)(`div`,{className:`oc-kpi__axis`,children:[n?(0,I.jsx)(`span`,{className:`oc-kpi__axis-latest`,children:b({value:$(n.bucket)})}):(0,I.jsx)(`span`,{className:`oc-kpi__muted`,children:l()}),(0,I.jsx)(`span`,{className:`oc-kpi__muted`,children:_({count:t.length})})]})]})]})}var X=240,Z=48,ie=1;function ae({series:e,isError:t,unit:n}){if(e.length===0)return(0,I.jsx)(`div`,{className:`oc-kpi__chart oc-kpi__chart--empty`,"aria-hidden":!0});let r=e.reduce((e,t)=>t.value>e?t.value:e,0),i=X/e.length,a=Math.max(i-ie,1);return(0,I.jsx)(`svg`,{className:`oc-kpi__chart`,viewBox:`0 0 ${X} ${Z}`,preserveAspectRatio:`none`,role:`img`,"aria-label":S({max:Q(r),unit:n}),children:e.map((e,o)=>{let s=r>0?e.value/r*(Z-1):0,c=o*i,l=Z-s;return(0,I.jsx)(`rect`,{className:`oc-kpi__bar`+(t&&e.value>0?` oc-kpi__bar--error`:``),x:c,y:l,width:a,height:s,children:(0,I.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{q as KpiTab};
@@ -0,0 +1 @@
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$w as r,AD as i,Aw as a,Bw as o,CD as s,DD as c,ED as l,FD as u,Fw as d,Gw as f,Hw as p,Iw as m,Jw as h,Kw as g,Lw as _,Mw as v,Nw as ee,Ow as te,Pw as ne,Qw as re,Rw as ie,SD as ae,TD as oe,Uw as se,Vw as ce,Ww as le,Xw as ue,Yw as de,Zw as fe,_D as y,aT as b,bD as x,cO as S,eT as C,gD as w,hD as T,hO as E,iT as D,jw as O,kw as k,mO as A,nT as j,oT as M,p_ as N,qw as P,rT as F,sT as I,tT as L,vD as R,wD as z,xD as B,yD as V,zw as pe}from"./dist-CcSJxYOw.js";import{t as H}from"./button-Chsl3hJr.js";import{A as me,C as he,O as ge,S as _e,Z as U,_ as W,b as ve,ot as G,x as K,y as ye}from"./index-Dld_NfaR.js";var q=t(e(),1),J=[{id:`messages`,label:()=>I()},{id:`composer`,label:()=>M()},{id:`sidebar`,label:()=>b()},{id:`other`,label:()=>D()}],Y={showSource:{category:`messages`,label:()=>F(),help:()=>j()},showReport:{category:`messages`,label:()=>L(),help:()=>C()},copyAssistant:{category:`messages`,label:()=>r()},copyUser:{category:`messages`,label:()=>re()},showDelete:{category:`messages`,label:()=>fe()},showTools:{category:`messages`,label:()=>ue(),help:()=>de()},voiceInput:{category:`composer`,label:()=>h(),help:()=>P()},showChatAge:{category:`sidebar`,label:()=>g(),help:()=>f()},showChatProvider:{category:`sidebar`,label:()=>le(),help:()=>se()}};function X(e){return e.toLowerCase().normalize(`NFD`).replace(/\p{Diacritic}/gu,``)}function be(e,t){let n=X(t.trim()),r=new Map(J.map(e=>[e.id,e.label()])),i=new Map(J.map(e=>[e.id,[]]));for(let t of e){let e=Y[t],a=e?.category??`other`;n&&!X(`${e?e.label():t} ${e?.help?e.help():``} ${t} ${r.get(a)??``}`).includes(n)||i.get(a).push(t)}return J.map(e=>({id:e.id,label:r.get(e.id),keys:i.get(e.id)})).filter(e=>e.keys.length>0)}var xe=[`showSource`,`showReport`,`copyAssistant`,`copyUser`,`showDelete`,`showTools`,`voiceInput`,`showChatAge`,`showChatProvider`],Se={voiceInput:`voiceInput`};function Ce(e){return xe.includes(e)}function Z(e){return e===`admin`}function we(e){return e===!0?`on`:e===!1?`off`:`inherit`}function Q(e){return e===`on`?!0:e===`off`?!1:null}function Te(e){return Ce(e)?Se[e]:void 0}var $=n(),Ee={voiceInput:()=>v()};function De({prefKey:e,ui:t}){let n=A(S.admin.setUiPrefDefault),r=A(S.admin.setFeatureEnabled),i=Te(e),o=i?Ee[e]?.():void 0;return(0,$.jsxs)(`div`,{className:`oc-prefs__gov`,children:[(0,$.jsxs)(`div`,{className:`oc-prefs__gov-row`,children:[(0,$.jsx)(`span`,{className:`oc-prefs__gov-label`,children:m()}),(0,$.jsxs)(ye,{value:we(t.defaults[e]),onValueChange:t=>void n({key:e,value:Q(t)}),children:[(0,$.jsx)(_e,{size:`sm`,className:`w-36`,children:(0,$.jsx)(he,{})}),(0,$.jsxs)(ve,{children:[(0,$.jsx)(K,{value:`on`,children:a()}),(0,$.jsx)(K,{value:`off`,children:k()}),(0,$.jsx)(K,{value:`inherit`,children:te()})]})]}),i?(0,$.jsxs)(`span`,{className:`oc-prefs__gov-gate`,children:[(0,$.jsx)(W,{checked:t.featuresEnabled[i]===!0,onCheckedChange:e=>void r({key:i,enabled:e===!0}),"aria-label":d()}),d()]}):null]}),o?(0,$.jsx)(`span`,{className:`oc-prefs__gov-help`,children:o}):null]})}function Oe(){let[e,t]=(0,q.useState)(``),[n,r]=(0,q.useState)(!1),i=E(S.me.getMe,{host:G}),a=i?.ui,s=Z(i?.role)&&n,c=A(S.me.setUiPref).withOptimisticUpdate(ge),l=(0,q.useMemo)(()=>a?be(Object.keys(a.effective),e):[],[a,e]);return a?(0,$.jsxs)(`div`,{className:`oc-prefs-panel`,children:[Z(i?.role)?(0,$.jsxs)(`label`,{className:`oc-prefs__gov-toggle`,children:[(0,$.jsx)(W,{checked:n,onCheckedChange:e=>r(e===!0),"aria-label":_()}),_()]}):null,s?(0,$.jsxs)(`div`,{className:`oc-prefs__gov-head`,children:[(0,$.jsx)(`p`,{children:ne()}),(0,$.jsx)(`p`,{children:ee()}),(0,$.jsx)(`p`,{children:O()})]}):null,(0,$.jsx)(U,{value:e,onChange:e=>t(e.target.value),placeholder:p(),"aria-label":p(),className:`mb-2`}),l.length===0?(0,$.jsx)(`div`,{className:`oc-prefs__empty`,children:ce()}):(0,$.jsx)(`div`,{className:`oc-prefs`,children:l.map(e=>(0,$.jsxs)(`div`,{className:`oc-prefs__group`,children:[(0,$.jsx)(`h4`,{className:`oc-prefs__cat`,children:e.label}),e.keys.map(e=>{let t=Y[e],n=t?t.label():e,r=t?.help?.(),i=a.locked[e],l=a.effective[e],u=a.userOverrides[e]!==void 0;return(0,$.jsxs)(`div`,{className:`oc-prefs__row${i?` is-locked`:``}${u&&!i?` is-overridden`:``}`,children:[(0,$.jsxs)(`div`,{className:`oc-prefs__info`,children:[(0,$.jsxs)(`span`,{className:`oc-prefs__label`,children:[n,i?(0,$.jsx)(`span`,{className:`oc-prefs__lock`,children:o()}):u?null:(0,$.jsx)(`span`,{className:`oc-prefs__def`,children:pe()})]}),r?(0,$.jsx)(`span`,{className:`oc-prefs__help`,children:r}):null]}),(0,$.jsxs)(`div`,{className:`oc-prefs__ctl`,children:[!i&&u?(0,$.jsx)(`button`,{type:`button`,className:`oc-prefs__reset`,onClick:()=>void c({key:e,value:null}),children:ie()}):null,(0,$.jsx)(W,{checked:l,disabled:i,onCheckedChange:t=>void c({key:e,value:t===!0}),"aria-label":n})]}),s?(0,$.jsx)(De,{prefKey:e,ui:a}):null]},e)})]},e.id))})]}):(0,$.jsx)(`div`,{className:`oc-prefs__empty`,children:u()})}function ke(){let e=E(S.me.getMe,{host:G}),t=A(S.me.setLocale),n=A(S.me.setMyName),r=me(),a=e?.locale??`default`,o=e?.name??``,[u,d]=(0,q.useState)(null),f=u??o,p=f.trim()!==o.trim();async function m(){try{await n({name:f}),d(null),r.success(s())}catch(e){r.error(ae(),e)}}return(0,$.jsxs)(`div`,{className:`oc-appearance`,children:[(0,$.jsxs)(`section`,{className:`oc-show__section`,children:[(0,$.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,$.jsx)(`h2`,{className:`oc-show__title`,children:c()}),(0,$.jsx)(`p`,{className:`oc-show__desc`,children:l()})]}),(0,$.jsxs)(`div`,{className:`oc-show__row`,children:[(0,$.jsx)(U,{className:`max-w-xs`,value:f,maxLength:120,placeholder:oe(),onChange:e=>d(e.target.value),onKeyDown:e=>{e.key===`Enter`&&p&&(e.preventDefault(),m())}}),(0,$.jsx)(H,{size:`sm`,disabled:!p,onClick:()=>void m(),children:N()})]}),(0,$.jsx)(`p`,{className:`oc-show__desc`,children:z()})]}),(0,$.jsxs)(`section`,{className:`oc-show__section`,children:[(0,$.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,$.jsx)(`h2`,{className:`oc-show__title`,children:B()}),(0,$.jsx)(`p`,{className:`oc-show__desc`,children:x()})]}),(0,$.jsx)(`div`,{className:`oc-show__row`,children:[`fr`,`en`,`default`].map(e=>(0,$.jsx)(H,{variant:a===e?`default`:`outline`,size:`sm`,onClick:()=>void t({locale:e==="default"?null:e}),children:e===`fr`?w():e===`en`?T():i()},e))}),(0,$.jsx)(`p`,{className:`oc-show__desc`,children:V()})]}),(0,$.jsxs)(`section`,{className:`oc-show__section`,children:[(0,$.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,$.jsx)(`h2`,{className:`oc-show__title`,children:R()}),(0,$.jsx)(`p`,{className:`oc-show__desc`,children:y()})]}),(0,$.jsx)(Oe,{})]})]})}export{ke as PreferencesTab};
@@ -0,0 +1,3 @@
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Ad as r,B as i,Cd as a,Dd as o,Ed as s,Fd as c,H as l,Id as u,Kd as d,Ld as f,Md as p,Nd as m,Od as h,Pd as g,Rd as _,Sd as v,Td as y,U as b,V as x,bd as S,cO as C,hO as w,jd as T,kd as E,mO as D,qd as O,wd as k,xd as A,z as j,zd as M}from"./dist-CcSJxYOw.js";import{d as N,f as P,i as F,l as I,n as L,r as R,t as ee,u as z}from"./FieldLabel-P7nCb2ED.js";import{t as B}from"./button-Chsl3hJr.js";import{A as V,C as H,S as U,_ as W,b as G,x as K,y as q}from"./index-Dld_NfaR.js";/* empty css */var J=t(e(),1),Y=n(),X={media_delivery:{label:g,help:m},documentary_fetch:{label:p,help:T},inbound_files:{label:r,help:E},history_summary:{label:b,help:l}},Z={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`},Q={outboundDir:v,references:A,files:S,previous_summary:x,new_messages:i,max_chars:j};function $(){let e=w(C.admin.listInstances,{}),[t,n]=(0,J.useState)(null);if(e===void 0)return(0,Y.jsx)(`div`,{className:`oc-settings__tab-loading`,"aria-busy":`true`});if(e.length===0)return(0,Y.jsx)(`div`,{className:`oc-injtab`,children:(0,Y.jsx)(`p`,{className:`oc-admin__hint`,children:o()})});let r=e.find(e=>e._id===t)??e[0];return(0,Y.jsxs)(`div`,{className:`oc-injtab`,children:[(0,Y.jsxs)(`div`,{className:`oc-injtab__head`,children:[(0,Y.jsx)(L,{label:M(),help:_()}),(0,Y.jsxs)(`label`,{className:`oc-injtab__picker`,children:[(0,Y.jsx)(`span`,{children:h()}),(0,Y.jsxs)(q,{value:r._id,onValueChange:e=>n(e),children:[(0,Y.jsx)(U,{size:`sm`,className:`min-w-44`,children:(0,Y.jsx)(H,{})}),(0,Y.jsx)(G,{children:e.map(e=>(0,Y.jsx)(K,{value:e._id,children:e.displayName??e.name},e._id))})]})]})]}),(0,Y.jsx)(te,{instance:r},r._id)]})}function te({instance:e}){let t=D(C.admin.upsertInstanceConfig),n=V(),r=e.config??{},[i,a]=(0,J.useState)(()=>F(r)),[o,s]=(0,J.useState)(!1),c=i.promptInjections,l=(e,t)=>a({...i,promptInjections:{...c,[e]:{...c[e],...t}}});async function u(){s(!0);try{await t({instanceId:e._id,config:R(i,r)})}catch(e){n.error(d(),e)}finally{s(!1)}}return(0,Y.jsxs)(`div`,{className:`oc-injtab__body`,children:[z.map(e=>(0,Y.jsx)(ne,{injKey:e,def:I[e],i18n:X[e],row:c[e]??{enabled:!0,template:I[e].defaultTemplate},onChange:t=>l(e,t)},e)),(0,Y.jsx)(`div`,{className:`oc-injtab__actions`,children:(0,Y.jsx)(B,{size:`sm`,onClick:()=>void u(),disabled:o,children:O()})})]})}function ne({injKey:e,def:t,i18n:n,row:r,onChange:i}){let[o,l]=(0,J.useState)(!1),d=r.template.trim()!==t.defaultTemplate,p=t.togglable&&!r.enabled,m=Object.fromEntries(t.placeholders.map(e=>[e,Z[e]??`{${e}}`])),h=N(e,r),g=h?P(h,m):``;return(0,Y.jsxs)(`section`,{className:`oc-injcard`,children:[(0,Y.jsxs)(`div`,{className:`oc-injcard__head`,children:[t.togglable?(0,Y.jsxs)(`label`,{className:`oc-field--row`,children:[(0,Y.jsx)(W,{checked:r.enabled,onCheckedChange:e=>i({enabled:e===!0})}),(0,Y.jsx)(L,{label:n.label(),help:n.help()})]}):(0,Y.jsx)(L,{label:n.label(),help:n.help()}),d&&(0,Y.jsx)(`span`,{className:`oc-injection__badge`,children:u()})]}),(0,Y.jsx)(`textarea`,{className:`oc-injcard__text`,value:r.template,disabled:p,rows:8,spellCheck:!1,onChange:e=>i({template:e.target.value})}),(0,Y.jsxs)(`div`,{className:`oc-injection__foot`,children:[(0,Y.jsxs)(`div`,{className:`oc-injcard__phs`,children:[(0,Y.jsx)(`span`,{className:`oc-injection__ph`,children:c()}),t.placeholders.map(e=>(0,Y.jsxs)(`span`,{className:`oc-injcard__ph-chip`,children:[(0,Y.jsx)(`code`,{children:`{${e}}`}),(0,Y.jsx)(ee,{text:(Q[e]??(()=>e))()})]},e))]}),(0,Y.jsxs)(`div`,{className:`oc-injcard__btns`,children:[(0,Y.jsx)(B,{variant:`ghost`,size:`sm`,onClick:()=>l(e=>!e),children:o?y():s()}),d&&(0,Y.jsx)(B,{variant:`ghost`,size:`sm`,onClick:()=>i({template:t.defaultTemplate}),children:f()})]})]}),o&&(0,Y.jsx)(`div`,{className:`oc-injcard__preview`,children:g?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`pre`,{className:`oc-injcard__previewtext`,children:g}),(0,Y.jsx)(`span`,{className:`oc-injection__ph`,children:k()})]}):(0,Y.jsx)(`span`,{className:`oc-injection__ph`,children:a()})})]})}export{$ as PromptInjectionsTab};
@@ -0,0 +1 @@
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Ah as r,Ch as i,Dh as a,Eh as o,Gm as s,Hm as c,Jm as l,Km as u,Oh as d,Sh as f,Th as p,Um as m,Wm as h,Xm as g,Ym as ee,_h as _,ah as v,bh as y,cO as b,ch as x,dh as te,fh as ne,gh as re,hO as ie,hh as ae,ih as S,jh as C,kh as w,lh as T,mO as E,mh as D,nh as O,oh as k,ph as A,qm as j,rh as M,sh as N,uh as P,vh as F,wh as I,xh as L,yh as R}from"./dist-CcSJxYOw.js";import{t as z}from"./button-Chsl3hJr.js";import{A as B,X as V,Z as H,_ as U,j as W,m as G,xt as K}from"./index-Dld_NfaR.js";import{t as q}from"./roleDescriptions-s8ifW_os.js";var J=t(e(),1),Y=n(),X=[{group:()=>C(),keys:[{key:`traces.read`,label:()=>o()},{key:`traces.read.content`,label:()=>p(),phi:!0},{key:`traces.write`,label:()=>I()}]},{group:()=>r(),keys:[{key:`kpi.read`,label:()=>o()},{key:`kpi.write`,label:()=>I()}]},{group:()=>w(),keys:[{key:`openclaw.query`,label:()=>i()},{key:`anomalies.read`,label:()=>f()},{key:`anomalies.report`,label:()=>L()}]},{group:()=>d(),keys:[{key:`chats.read`,label:()=>o()},{key:`selfheal`,label:()=>R()}]},{group:()=>a(),keys:[{key:`admin.manage`,label:()=>y()}]}],oe=X.flatMap(e=>e.keys.map(e=>e.key));function Z(e){return e.includes(`*`)}var Q={key:``,name:``,description:``};function $(){let e=ie(b.apiKeys.listRoles,{}),t=E(b.apiKeys.createRole),n=E(b.apiKeys.ensureRolesSeeded),r=E(b.apiKeys.updateRolePermissions).withOptimisticUpdate((e,{roleId:t,permissions:n})=>{let r=e.getQuery(b.apiKeys.listRoles,{});r&&e.setQuery(b.apiKeys.listRoles,{},r.map(e=>e._id===t?{...e,permissions:n}:e))}),i=W(),a=B(),[o,d]=(0,J.useState)(!1),[f,p]=(0,J.useState)(Q),[y,C]=(0,J.useState)(new Set);(0,J.useEffect)(()=>{n({}).catch(e=>{a.error(_(),e)})},[n,a]);let w=e??[];async function I(e,t){if(Z(e.permissions)||y.has(e._id))return;let n=e.permissions.includes(t)?e.permissions.filter(e=>e!==t):[...e.permissions,t];if(!(e.builtin&&!await i({title:re({name:e.name}),description:ae(),confirmLabel:D()}))){C(t=>new Set(t).add(e._id));try{await r({roleId:e._id,permissions:n})}catch(e){a.error(A(),e)}finally{C(t=>{let n=new Set(t);return n.delete(e._id),n})}}}async function L(){try{await t({key:f.key,name:f.name,description:f.description||void 0,permissions:[]}),p(Q),d(!1)}catch(e){a.error(ne(),e)}}let R=e===void 0,$=!R&&w.length===0;return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(`p`,{className:`oc-admin__hint`,children:[te(),` `,(0,Y.jsx)(`code`,{children:`admin`}),` `,P(),` `,(0,Y.jsx)(`code`,{children:`traces.read.content`}),` `,T()]}),(0,Y.jsxs)(`div`,{className:`oc-dt`,children:[(0,Y.jsxs)(`div`,{className:`oc-dt__bar`,children:[(0,Y.jsx)(`h2`,{className:`oc-dt__title`,children:x()}),(0,Y.jsx)(`div`,{className:`oc-dt__bar-actions`,children:(0,Y.jsx)(z,{size:`sm`,onClick:()=>{p(Q),d(!0)},children:N()})})]}),R?(0,Y.jsx)(`p`,{className:`oc-admin__hint`,children:k()}):$?(0,Y.jsx)(`p`,{className:`oc-admin__hint`,children:v()}):(0,Y.jsx)(`div`,{className:`oc-matrix__scroll`,children:(0,Y.jsxs)(`table`,{className:`oc-matrix`,children:[(0,Y.jsxs)(`thead`,{children:[(0,Y.jsxs)(`tr`,{children:[(0,Y.jsx)(`th`,{className:`oc-matrix__corner`,rowSpan:2,children:S()}),X.map(e=>(0,Y.jsx)(`th`,{className:`oc-matrix__group`,colSpan:e.keys.length,children:e.group()},e.group()))]}),(0,Y.jsx)(`tr`,{children:X.flatMap(e=>e.keys.map(e=>(0,Y.jsxs)(`th`,{className:`oc-matrix__perm`,title:e.phi?F({key:e.key}):e.key,children:[e.label(),e.phi?(0,Y.jsx)(`span`,{className:`oc-matrix__phi`,children:` ⚠`}):null]},e.key)))})]}),(0,Y.jsx)(`tbody`,{children:w.map(e=>{let t=Z(e.permissions),n=y.has(e._id);return(0,Y.jsxs)(`tr`,{children:[(0,Y.jsxs)(`th`,{className:`oc-matrix__rolecell`,children:[(0,Y.jsxs)(`div`,{className:`oc-matrix__rolename`,children:[(0,Y.jsx)(`span`,{children:e.name}),(0,Y.jsx)(`code`,{className:`oc-matrix__rolekey`,children:e.key}),e.builtin?(0,Y.jsxs)(V,{variant:`outline`,className:`gap-1`,children:[(0,Y.jsx)(K,{}),` `,M()]}):(0,Y.jsx)(V,{variant:`secondary`,children:O()})]}),q(e)?(0,Y.jsx)(`p`,{className:`oc-matrix__roledesc`,children:q(e)}):null]}),oe.map(r=>(0,Y.jsx)(`td`,{className:`oc-matrix__cell`,children:(0,Y.jsx)(U,{checked:t||e.permissions.includes(r),disabled:t||n,"aria-label":`${e.key} · ${r}`,title:t?g():n?ee():r,onCheckedChange:()=>void I(e,r)})},r))]},e.key)})})]})})]}),(0,Y.jsx)(G,{open:o,onOpenChange:d,title:l(),description:j(),canSubmit:!!(f.key&&f.name),onSubmit:L,submitLabel:u(),children:(0,Y.jsxs)(`div`,{className:`oc-form`,children:[(0,Y.jsxs)(`label`,{className:`oc-field`,children:[(0,Y.jsx)(`span`,{className:`oc-field__label`,children:s()}),(0,Y.jsx)(H,{value:f.key,placeholder:h(),onChange:e=>p({...f,key:e.target.value})})]}),(0,Y.jsxs)(`label`,{className:`oc-field`,children:[(0,Y.jsx)(`span`,{className:`oc-field__label`,children:m()}),(0,Y.jsx)(H,{value:f.name,onChange:e=>p({...f,name:e.target.value})})]}),(0,Y.jsxs)(`label`,{className:`oc-field`,children:[(0,Y.jsx)(`span`,{className:`oc-field__label`,children:c()}),(0,Y.jsx)(H,{value:f.description,onChange:e=>p({...f,description:e.target.value})})]})]})})]})}export{$ as RolesTab};
@@ -0,0 +1 @@
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 ee,CC as a,Cw as te,DC as o,Dw as ne,EC as s,Ew as re,FC as ie,GC as ae,HC as oe,IC as se,JC as ce,KC as le,LC as ue,MC as de,NC as fe,OC as c,PC as pe,QC as me,RC as he,SC as l,Sw as ge,TC as u,Tw as _e,UC as ve,VC as ye,WC as be,XC as xe,YC as Se,ZC as Ce,_C as d,_w as we,aw as Te,bC as f,bw as Ee,cC as p,cO as m,cw as De,dC as h,dw as Oe,ew as ke,fC as g,fO as Ae,fw as je,gC as _,gw as Me,hC as v,hO as y,hw as Ne,iw as Pe,jC as Fe,kC as b,lC as Ie,lw as Le,mC as x,mO as S,mw as Re,nw as ze,ow as Be,pC as C,pw as Ve,qC as He,rw as Ue,sC as w,sw as We,tw as Ge,uC as T,uw as Ke,vC as E,vw as qe,wC as D,ww as Je,xC as O,xw as k,yC as A,yw as Ye,zC as Xe}from"./dist-CcSJxYOw.js";import{n as j}from"./dist-CEWcFkOy.js";import{i as Ze}from"./dist-ClJFgNZb.js";import{t as M}from"./button-Chsl3hJr.js";import{$ as N,A as Qe,At as $e,C as P,Dt as F,Mt as et,Q as I,S as L,X as R,Z as z,b as B,et as V,j as tt,jt as nt,m as rt,nt as H,rt as U,tt as it,x as W,y as G}from"./index-Dld_NfaR.js";import{t as at}from"./FilterBar-NyP0u16q.js";import{t as ot}from"./DataTableShell-ezCmCHde.js";import{t as st}from"./roleDescriptions-s8ifW_os.js";var K=t(e(),1),q=n(),ct=[{value:`never`,label:()=>C(),days:null},{value:`30`,label:()=>g(),days:30},{value:`90`,label:()=>h(),days:90}],lt=720*60*60*1e3,J=`__all__`,Y={name:``,roleKey:``,description:``};function X(){let e=et({from:`/settings/serviceAccounts`}),t=nt({from:`/settings/serviceAccounts`}),n=e.q??``,i=e.status??J,[a,o]=(0,K.useState)(J),s=e=>void t({search:t=>({...t,q:e||void 0}),replace:!0}),c=e=>void t({search:t=>({...t,status:e===J?void 0:e})}),l=y(m.apiKeys.listServiceAccounts,{filter:{q:n||void 0,role:a===J?void 0:a,disabled:i===J?void 0:i===`disabled`}}),u=y(m.apiKeys.listKeys,{}),d=y(m.apiKeys.listRoles,{}),f=S(m.apiKeys.createServiceAccount),p=S(m.apiKeys.updateServiceAccount),h=S(m.apiKeys.deleteServiceAccount),g=Ae(m.apiKeys.mintApiKey),_=S(m.apiKeys.revokeApiKey),v=tt(),b=Qe(),Ie=n!==``||a!==J||i!==J;function x(){o(J),t({search:{},replace:!0})}let[C,w]=(0,K.useState)(!1),[T,E]=(0,K.useState)(Y),[D,O]=(0,K.useState)(null),[A,j]=(0,K.useState)(new Set),[N,F]=(0,K.useState)(null),I=(0,K.useRef)(!1),[V,H]=(0,K.useState)(new Set),[U,it]=(0,K.useState)({}),[lt,X]=(0,K.useState)(null),Z=(0,K.useMemo)(()=>{let e=new Map;for(let t of u??[]){let n=e.get(t.serviceAccountId)??[];n.push(t),e.set(t.serviceAccountId,n)}return e},[u]);function Q(e){j(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})}async function ft(){try{D?(await p({serviceAccountId:D,name:T.name,roleKey:T.roleKey,description:T.description}),b.success(ae())):await f({name:T.name,roleKey:T.roleKey,description:T.description||void 0}),E(Y),O(null),w(!1)}catch(e){b.error(D?le():He(),e)}}function pt(e){E({name:e.name,roleKey:e.roleKey,description:e.description??``}),O(e._id),w(!0)}async function $(e){if(I.current)return;I.current=!0;let t=U[e._id]??`never`,n=ct.find(e=>e.value===t)?.days??null,r=n?Date.now()+n*24*60*60*1e3:void 0;F(e._id);try{let t=await g({serviceAccountId:e._id,expiresAt:r});X({accountName:e.name,plaintext:t.plaintext,prefix:t.prefix,lastFour:t.lastFour})}catch(e){b.error(be(),e)}finally{I.current=!1,F(null)}}async function mt(e){if(await v({title:ve(),description:(0,q.jsxs)(q.Fragment,{children:[oe(),` `,(0,q.jsx)(`span`,{className:`font-mono`,children:e.name}),` `,ye(),` `,(0,q.jsx)(`strong`,{children:ee()}),` `,Xe()]}),confirmWord:e.name,confirmLabel:he(),destructive:!0}))try{await h({serviceAccountId:e._id}),b.success(ue(),e.name)}catch(e){b.error(se(),e)}}async function ht(e){if(await v({title:ie(),description:(0,q.jsxs)(q.Fragment,{children:[pe(),` `,(0,q.jsxs)(`span`,{className:`font-mono`,children:[e.prefix,`…`,e.lastFour]}),` `,fe()]}),confirmLabel:de(),destructive:!0})&&!V.has(e._id)){H(t=>new Set(t).add(e._id));try{await _({keyId:e._id})}catch(e){b.error(Fe(),e)}finally{H(t=>{let n=new Set(t);return n.delete(e._id),n})}}}return(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(`p`,{className:`oc-admin__hint`,children:ne()}),(0,q.jsxs)(at,{q:n,onQChange:s,searchPlaceholder:re(),onReset:x,canReset:Ie,children:[(0,q.jsxs)(G,{value:a,onValueChange:o,children:[(0,q.jsx)(L,{size:`sm`,className:`w-40`,children:(0,q.jsx)(P,{placeholder:_e()})}),(0,q.jsxs)(B,{children:[(0,q.jsx)(W,{value:J,children:Je()}),(d??[]).map(e=>(0,q.jsx)(W,{value:e.key,children:e.key},e._id))]})]}),(0,q.jsxs)(G,{value:i,onValueChange:c,children:[(0,q.jsx)(L,{size:`sm`,className:`w-36`,children:(0,q.jsx)(P,{})}),(0,q.jsxs)(B,{children:[(0,q.jsx)(W,{value:J,children:te()}),(0,q.jsx)(W,{value:`active`,children:ge()}),(0,q.jsx)(W,{value:`disabled`,children:k()})]})]})]}),(0,q.jsx)(ot,{title:Ee(),rows:l,addLabel:Ye(),onAdd:()=>{E(Y),O(null),w(!0)},emptyHint:qe(),isExpanded:e=>A.has(e._id),renderExpanded:e=>(0,q.jsx)(ut,{account:e,keys:Z.get(e._id)??[],onRevoke:ht,revoking:V}),rowActions:e=>[{label:Re(),onSelect:()=>pt(e)},{label:we(),onSelect:()=>void $(e)},{label:A.has(e._id)?Me():Ne(),onSelect:()=>Q(e._id)},{label:Ve(),variant:`destructive`,onSelect:()=>void mt(e)}],columns:[{header:``,className:`w-8`,cell:e=>(0,q.jsx)(M,{variant:`ghost`,size:`icon-sm`,"aria-label":A.has(e._id)?je():Oe(),onClick:()=>Q(e._id),children:A.has(e._id)?(0,q.jsx)(Ze,{}):(0,q.jsx)($e,{})})},{header:Ke(),sort:e=>e.name,cell:e=>(0,q.jsxs)(`div`,{className:`flex flex-col`,children:[(0,q.jsx)(`span`,{children:e.name}),e.description?(0,q.jsx)(`span`,{className:`text-muted-foreground text-xs`,children:e.description}):null]})},{header:Le(),sort:e=>e.roleKey,cell:e=>(0,q.jsx)(R,{variant:`secondary`,children:e.roleKey})},{header:De(),sort:e=>+!!e.disabled,cell:e=>e.disabled?(0,q.jsx)(R,{variant:`destructive`,children:k()}):(0,q.jsx)(R,{variant:`outline`,children:ge()})},{header:We(),cell:e=>(0,q.jsxs)(G,{value:U[e._id]??`never`,onValueChange:t=>it(n=>({...n,[e._id]:t})),children:[(0,q.jsx)(L,{size:`sm`,className:`w-32`,children:(0,q.jsx)(P,{})}),(0,q.jsx)(B,{children:ct.map(e=>(0,q.jsx)(W,{value:e.value,children:e.label()},e.value))})]})},{header:Be(),sort:e=>(Z.get(e._id)??[]).filter(e=>!e.disabled).length,cell:e=>{let t=(Z.get(e._id)??[]).filter(e=>!e.disabled).length;return(0,q.jsx)(`span`,{className:`oc-sa__keycount`,children:N===e._id?Te():Pe({count:t})})}}]}),(0,q.jsx)(rt,{open:C,onOpenChange:e=>{w(e),e||O(null)},title:D?Ue():ke(),description:D?ze():r(),canSubmit:!!(T.name&&T.roleKey),onSubmit:ft,submitLabel:D?Ge():me(),children:(0,q.jsxs)(`div`,{className:`oc-form`,children:[(0,q.jsxs)(`label`,{className:`oc-field`,children:[(0,q.jsx)(`span`,{className:`oc-field__label`,children:Ce()}),(0,q.jsx)(z,{value:T.name,onChange:e=>E({...T,name:e.target.value})})]}),(0,q.jsxs)(`label`,{className:`oc-field`,children:[(0,q.jsx)(`span`,{className:`oc-field__label`,children:xe()}),(0,q.jsxs)(G,{value:T.roleKey||void 0,onValueChange:e=>E({...T,roleKey:e}),children:[(0,q.jsx)(L,{className:`w-full`,children:(0,q.jsx)(P,{placeholder:Se()})}),(0,q.jsx)(B,{children:(d??[]).map(e=>(0,q.jsxs)(W,{value:e.key,children:[e.name,` (`,e.key,`)`]},e._id))})]}),(()=>{let e=(d??[]).find(e=>e.key===T.roleKey),t=e?st(e):null;return t?(0,q.jsx)(`span`,{className:`text-muted-foreground text-xs`,children:t}):null})()]}),(0,q.jsxs)(`label`,{className:`oc-field`,children:[(0,q.jsx)(`span`,{className:`oc-field__label`,children:ce()}),(0,q.jsx)(z,{value:T.description,onChange:e=>E({...T,description:e.target.value})})]})]})}),(0,q.jsx)(dt,{minted:lt,onClose:()=>X(null)})]})}function ut({account:e,keys:t,onRevoke:n,revoking:r}){return(0,q.jsxs)(`div`,{className:`oc-sa__keys`,children:[(0,q.jsxs)(`div`,{className:`oc-sa__keys-head`,children:[i(),` `,(0,q.jsx)(`span`,{className:`font-medium`,children:e.name})]}),t.length===0?(0,q.jsx)(`p`,{className:`oc-admin__hint`,children:b()}):(0,q.jsxs)(`table`,{className:`oc-sa__keytable`,children:[(0,q.jsx)(`thead`,{children:(0,q.jsxs)(`tr`,{children:[(0,q.jsx)(`th`,{children:c()}),(0,q.jsx)(`th`,{children:o()}),(0,q.jsx)(`th`,{children:s()}),(0,q.jsx)(`th`,{children:u()}),(0,q.jsx)(`th`,{children:D()}),(0,q.jsx)(`th`,{children:a()}),(0,q.jsx)(`th`,{})]})}),(0,q.jsx)(`tbody`,{children:t.map(t=>(0,q.jsxs)(`tr`,{children:[(0,q.jsx)(`td`,{children:(0,q.jsxs)(`code`,{className:`oc-sa__keyid`,children:[t.prefix,`…`,t.lastFour]})}),(0,q.jsx)(`td`,{children:(0,q.jsx)(R,{variant:`secondary`,children:e.roleKey})}),(0,q.jsx)(`td`,{children:Z(t.createdAt)}),(0,q.jsx)(`td`,{className:Q(t.lastUsedAt)?`oc-sa__stale`:``,children:ft(t.lastUsedAt)}),(0,q.jsx)(`td`,{children:pt(t.expiresAt)}),(0,q.jsx)(`td`,{children:$(t)}),(0,q.jsx)(`td`,{className:`text-right`,children:t.disabled?null:(0,q.jsx)(M,{variant:`destructive`,size:`sm`,disabled:r.has(t._id),onClick:()=>n(t),children:r.has(t._id)?l():O()})})]},t._id))})]})]})}function dt({minted:e,onClose:t}){let[n,r]=(0,K.useState)(!1);async function i(){if(e)try{await navigator.clipboard.writeText(e.plaintext),r(!0),window.setTimeout(()=>r(!1),2e3)}catch{}}return(0,q.jsx)(I,{open:e!==null,onOpenChange:e=>{e||(r(!1),t())},children:e?(0,q.jsxs)(N,{className:`max-w-lg`,showCloseButton:!1,onInteractOutside:e=>e.preventDefault(),onEscapeKeyDown:e=>e.preventDefault(),children:[(0,q.jsxs)(H,{children:[(0,q.jsx)(U,{children:f()}),(0,q.jsx)(V,{children:A({name:e.accountName})})]}),(0,q.jsx)(`div`,{className:`oc-sa__minted-warning`,children:E()}),(0,q.jsxs)(`div`,{className:`oc-sa__minted-box`,children:[(0,q.jsx)(`code`,{className:`oc-sa__minted-plain`,children:e.plaintext}),(0,q.jsxs)(M,{variant:`outline`,size:`sm`,onClick:()=>void i(),"aria-label":d(),children:[n?(0,q.jsx)(j,{}):(0,q.jsx)(F,{}),n?_():v()]})]}),(0,q.jsx)(it,{children:(0,q.jsx)(M,{onClick:()=>{r(!1),t()},children:x()})})]}):null})}function Z(e){return new Date(e).toLocaleString(`fr-FR`)}function Q(e){return e===null?!1:Date.now()-e>lt}function ft(e){return e===null?T():new Date(e).toLocaleString(`fr-FR`)}function pt(e){return e===null?`—`:new Date(e).toLocaleDateString(`fr-FR`)}function $(e){return e.disabled?(0,q.jsx)(R,{variant:`destructive`,children:Ie()}):e.expiresAt!==null&&e.expiresAt<Date.now()?(0,q.jsx)(R,{variant:`outline`,children:p()}):(0,q.jsx)(R,{variant:`outline`,children:w()})}export{X as ServiceAccountsTab};
@@ -1 +1 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$ as r,At as i,Ct as a,Dt as o,Et as s,J as c,Mt as l,Ot as u,Q as d,St as f,Tt as p,X as m,Y as h,Z as g,_t as _,at as v,bt as y,ct as b,dO as x,dt as S,et as C,ft as w,gt as T,ht as E,iO as D,it as O,jt as k,kt as A,lt as j,mt as M,nt as N,ot as P,pt as F,rt as I,st as L,tt as R,uO as z,ut as B,vt as V,wt as H,xt as U,yt as W}from"./dist-B-U7A_Kp.js";import{t as G}from"./button-CoB18od4.js";import{j as K}from"./index-B6IXWbc8.js";import{t as q}from"./DataTableShell-DRaoMzdi.js";var J=t(e(),1),Y=n(),X={hung:()=>E(),wrong_result:()=>M(),error:()=>F(),other:()=>w()},Z=e=>(e&&X[e]?.())??e??`—`;function Q(e){let t=e.slice(e.lastIndexOf(`:`)+1)||e;return t.length>12?`${t.slice(0,12)}…`:t}function $({data:e}){let t=e.snapshot,n=z(D.subAgentReports.respondToReport),[i,a]=(0,J.useState)(e.thread),[o,s]=(0,J.useState)(``),[c,l]=(0,J.useState)(!1);async function u(){let t=o.trim();if(!(!t||c)){l(!0);try{await n({reportId:e._id,text:t}),a(e=>[...e,{authorRole:`admin`,text:t,at:Date.now()}]),s(``)}finally{l(!1)}}}return(0,Y.jsxs)(`div`,{className:`oc-fbadmin__detail`,children:[(0,Y.jsx)(`div`,{className:`oc-fbadmin__row`,children:(0,Y.jsxs)(`span`,{className:`oc-fbadmin__meta`,children:[Z(e.category),` · `,S({failed:t.failedCount,total:t.totalCount}),t.openclawModel?` · ${t.openclawModel}`:``,t.openclawRuntime?` (${t.openclawRuntime})`:``]})}),e.comment?(0,Y.jsxs)(`section`,{children:[(0,Y.jsx)(`h4`,{className:`oc-fbadmin__h`,children:B()}),(0,Y.jsx)(`p`,{className:`oc-fbadmin__comment`,children:e.comment})]}):null,(0,Y.jsxs)(`section`,{children:[(0,Y.jsx)(`h4`,{className:`oc-fbadmin__h`,children:j()}),i.length>0?(0,Y.jsx)(`div`,{className:`oc-fbadmin__thread`,children:i.map((e,t)=>(0,Y.jsxs)(`div`,{className:`oc-notif__msg oc-notif__msg--${e.authorRole}`,children:[(0,Y.jsx)(`span`,{className:`oc-notif__msg-who`,children:e.authorRole===`admin`?b():L()}),(0,Y.jsx)(`span`,{className:`oc-notif__msg-text`,children:e.text})]},t))}):(0,Y.jsx)(`p`,{className:`oc-fbadmin__meta`,children:P()}),(0,Y.jsx)(`textarea`,{className:`oc-feedback__textarea`,placeholder:v(),value:o,maxLength:2e3,rows:3,onChange:e=>s(e.target.value.slice(0,2e3))}),(0,Y.jsx)(`div`,{className:`oc-fbadmin__row`,style:{justifyContent:`flex-end`},children:(0,Y.jsx)(G,{size:`sm`,onClick:()=>void u(),disabled:!o.trim()||c,children:c?I():O()})})]}),(0,Y.jsxs)(`section`,{children:[(0,Y.jsxs)(`h4`,{className:`oc-fbadmin__h`,children:[N({count:t.children.length}),t.childrenTruncated?` ${R()}`:``,t.textTruncated?` ${C()}`:``]}),(0,Y.jsx)(`div`,{className:`oc-fbadmin__ctx`,children:t.children.map((e,n)=>(0,Y.jsxs)(`div`,{className:`oc-fbadmin__ctx-turn`,children:[(0,Y.jsxs)(`span`,{className:`oc-fbadmin__ctx-role`,children:[(e.taskName?.trim()||Q(e.childSessionKey))+` · ${e.status}`,e.phase?` · ${e.phase}`:``,e.childSessionKey===t.flaggedChildSessionKey?` · ${r()}`:``]}),e.errorMessage?(0,Y.jsx)(`pre`,{className:`oc-msg__source-pre`,children:e.errorMessage}):null,e.resultText?(0,Y.jsx)(`pre`,{className:`oc-msg__source-pre`,children:e.resultText}):null]},n))})]}),t.parentText?(0,Y.jsxs)(`section`,{children:[(0,Y.jsx)(`h4`,{className:`oc-fbadmin__h`,children:d()}),(0,Y.jsx)(`pre`,{className:`oc-msg__source-pre`,children:t.parentText})]}):null,(0,Y.jsxs)(`section`,{children:[(0,Y.jsx)(`h4`,{className:`oc-fbadmin__h`,children:g()}),(0,Y.jsx)(`p`,{className:`oc-fbadmin__env`,children:[t.parentStatus?`status: ${t.parentStatus}`:null,t.parentErrorCode?`code: ${t.parentErrorCode}`:null,t.parentRunId?`run ${t.parentRunId.slice(0,12)}…`:null,e.correlationId?`corr ${e.correlationId.slice(0,16)}…`:null,t.openclawProvider].filter(Boolean).join(` · `)||`—`})]})]})}function ee(){let e=x(D.subAgentReports.listForAdmin,{}),t=z(D.subAgentReports.readReport),n=z(D.subAgentReports.deleteReport),r=K(),[d,g]=(0,J.useState)(null),[v,b]=(0,J.useState)({});async function S(e){if(d===e._id){g(null);return}if(!v[e._id]){let n=await t({reportId:e._id});b(t=>({...t,[e._id]:n}))}g(e._id)}async function C(e){await r({title:m(),description:h(),confirmLabel:c(),destructive:!0})&&(await n({reportId:e._id}),d===e._id&&g(null))}return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(`p`,{className:`oc-admin__hint`,children:[i(),` `,(0,Y.jsx)(`strong`,{children:A()}),` `,u()]}),(0,Y.jsx)(q,{title:l(),rows:e,emptyHint:k(),isExpanded:e=>d===e._id&&!!v[e._id],renderExpanded:e=>v[e._id]?(0,Y.jsx)($,{data:v[e._id]}):null,columns:[{header:o(),cell:e=>new Date(e.at).toLocaleString(`fr-FR`),sort:e=>e.at},{header:s(),cell:e=>Z(e.category),sort:e=>Z(e.category)},{header:p(),cell:e=>`${e.failedCount}/${e.totalCount}`,sort:e=>e.failedCount},{header:H(),cell:e=>(e.reporterEmail||e.reporterName||`—`)+(e.impersonated&&e.realOperatorEmail?` ${U({operator:e.realOperatorEmail})}`:``),sort:e=>e.reporterEmail||e.reporterName||null},{header:a(),cell:e=>e.hasComment?`✎`:`—`,sort:e=>+!!e.hasComment},{header:f(),cell:e=>e.answered?(0,Y.jsx)(`span`,{className:`oc-fbadmin__pill is-ok`,children:y()}):(0,Y.jsx)(`span`,{className:`oc-fbadmin__pill`,children:W()}),sort:e=>+!!e.answered}],rowActions:e=>[{label:d===e._id?_():V(),onSelect:()=>void S(e)},{label:T(),onSelect:()=>void C(e),variant:`destructive`}]})]})}export{ee as SubAgentReportsTab};
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$ as r,At as i,Ct as a,Dt as o,Et as s,J as c,Mt as l,Ot as u,Q as d,St as f,Tt as p,X as m,Y as h,Z as g,_t as _,at as v,bt as y,cO as b,ct as x,dt as S,et as C,ft as w,gt as T,hO as E,ht as D,it as O,jt as k,kt as A,lt as j,mO as M,mt as N,nt as P,ot as F,pt as I,rt as L,st as R,tt as z,ut as B,vt as V,wt as H,xt as U,yt as W}from"./dist-CcSJxYOw.js";import{t as G}from"./button-Chsl3hJr.js";import{j as K}from"./index-Dld_NfaR.js";import{t as q}from"./DataTableShell-ezCmCHde.js";var J=t(e(),1),Y=n(),X={hung:()=>D(),wrong_result:()=>N(),error:()=>I(),other:()=>w()},Z=e=>(e&&X[e]?.())??e??`—`;function Q(e){let t=e.slice(e.lastIndexOf(`:`)+1)||e;return t.length>12?`${t.slice(0,12)}…`:t}function $({data:e}){let t=e.snapshot,n=M(b.subAgentReports.respondToReport),[i,a]=(0,J.useState)(e.thread),[o,s]=(0,J.useState)(``),[c,l]=(0,J.useState)(!1);async function u(){let t=o.trim();if(!(!t||c)){l(!0);try{await n({reportId:e._id,text:t}),a(e=>[...e,{authorRole:`admin`,text:t,at:Date.now()}]),s(``)}finally{l(!1)}}}return(0,Y.jsxs)(`div`,{className:`oc-fbadmin__detail`,children:[(0,Y.jsx)(`div`,{className:`oc-fbadmin__row`,children:(0,Y.jsxs)(`span`,{className:`oc-fbadmin__meta`,children:[Z(e.category),` · `,S({failed:t.failedCount,total:t.totalCount}),t.openclawModel?` · ${t.openclawModel}`:``,t.openclawRuntime?` (${t.openclawRuntime})`:``]})}),e.comment?(0,Y.jsxs)(`section`,{children:[(0,Y.jsx)(`h4`,{className:`oc-fbadmin__h`,children:B()}),(0,Y.jsx)(`p`,{className:`oc-fbadmin__comment`,children:e.comment})]}):null,(0,Y.jsxs)(`section`,{children:[(0,Y.jsx)(`h4`,{className:`oc-fbadmin__h`,children:j()}),i.length>0?(0,Y.jsx)(`div`,{className:`oc-fbadmin__thread`,children:i.map((e,t)=>(0,Y.jsxs)(`div`,{className:`oc-notif__msg oc-notif__msg--${e.authorRole}`,children:[(0,Y.jsx)(`span`,{className:`oc-notif__msg-who`,children:e.authorRole===`admin`?x():R()}),(0,Y.jsx)(`span`,{className:`oc-notif__msg-text`,children:e.text})]},t))}):(0,Y.jsx)(`p`,{className:`oc-fbadmin__meta`,children:F()}),(0,Y.jsx)(`textarea`,{className:`oc-feedback__textarea`,placeholder:v(),value:o,maxLength:2e3,rows:3,onChange:e=>s(e.target.value.slice(0,2e3))}),(0,Y.jsx)(`div`,{className:`oc-fbadmin__row`,style:{justifyContent:`flex-end`},children:(0,Y.jsx)(G,{size:`sm`,onClick:()=>void u(),disabled:!o.trim()||c,children:c?L():O()})})]}),(0,Y.jsxs)(`section`,{children:[(0,Y.jsxs)(`h4`,{className:`oc-fbadmin__h`,children:[P({count:t.children.length}),t.childrenTruncated?` ${z()}`:``,t.textTruncated?` ${C()}`:``]}),(0,Y.jsx)(`div`,{className:`oc-fbadmin__ctx`,children:t.children.map((e,n)=>(0,Y.jsxs)(`div`,{className:`oc-fbadmin__ctx-turn`,children:[(0,Y.jsxs)(`span`,{className:`oc-fbadmin__ctx-role`,children:[(e.taskName?.trim()||Q(e.childSessionKey))+` · ${e.status}`,e.phase?` · ${e.phase}`:``,e.childSessionKey===t.flaggedChildSessionKey?` · ${r()}`:``]}),e.errorMessage?(0,Y.jsx)(`pre`,{className:`oc-msg__source-pre`,children:e.errorMessage}):null,e.resultText?(0,Y.jsx)(`pre`,{className:`oc-msg__source-pre`,children:e.resultText}):null]},n))})]}),t.parentText?(0,Y.jsxs)(`section`,{children:[(0,Y.jsx)(`h4`,{className:`oc-fbadmin__h`,children:d()}),(0,Y.jsx)(`pre`,{className:`oc-msg__source-pre`,children:t.parentText})]}):null,(0,Y.jsxs)(`section`,{children:[(0,Y.jsx)(`h4`,{className:`oc-fbadmin__h`,children:g()}),(0,Y.jsx)(`p`,{className:`oc-fbadmin__env`,children:[t.parentStatus?`status: ${t.parentStatus}`:null,t.parentErrorCode?`code: ${t.parentErrorCode}`:null,t.parentRunId?`run ${t.parentRunId.slice(0,12)}…`:null,e.correlationId?`corr ${e.correlationId.slice(0,16)}…`:null,t.openclawProvider].filter(Boolean).join(` · `)||`—`})]})]})}function ee(){let e=E(b.subAgentReports.listForAdmin,{}),t=M(b.subAgentReports.readReport),n=M(b.subAgentReports.deleteReport),r=K(),[d,g]=(0,J.useState)(null),[v,x]=(0,J.useState)({});async function S(e){if(d===e._id){g(null);return}if(!v[e._id]){let n=await t({reportId:e._id});x(t=>({...t,[e._id]:n}))}g(e._id)}async function C(e){await r({title:m(),description:h(),confirmLabel:c(),destructive:!0})&&(await n({reportId:e._id}),d===e._id&&g(null))}return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(`p`,{className:`oc-admin__hint`,children:[i(),` `,(0,Y.jsx)(`strong`,{children:A()}),` `,u()]}),(0,Y.jsx)(q,{title:l(),rows:e,emptyHint:k(),isExpanded:e=>d===e._id&&!!v[e._id],renderExpanded:e=>v[e._id]?(0,Y.jsx)($,{data:v[e._id]}):null,columns:[{header:o(),cell:e=>new Date(e.at).toLocaleString(`fr-FR`),sort:e=>e.at},{header:s(),cell:e=>Z(e.category),sort:e=>Z(e.category)},{header:p(),cell:e=>`${e.failedCount}/${e.totalCount}`,sort:e=>e.failedCount},{header:H(),cell:e=>(e.reporterEmail||e.reporterName||`—`)+(e.impersonated&&e.realOperatorEmail?` ${U({operator:e.realOperatorEmail})}`:``),sort:e=>e.reporterEmail||e.reporterName||null},{header:a(),cell:e=>e.hasComment?`✎`:`—`,sort:e=>+!!e.hasComment},{header:f(),cell:e=>e.answered?(0,Y.jsx)(`span`,{className:`oc-fbadmin__pill is-ok`,children:y()}):(0,Y.jsx)(`span`,{className:`oc-fbadmin__pill`,children:W()}),sort:e=>+!!e.answered}],rowActions:e=>[{label:d===e._id?_():V(),onSelect:()=>void S(e)},{label:T(),onSelect:()=>void C(e),variant:`destructive`}]})]})}export{ee as SubAgentReportsTab};
@@ -0,0 +1 @@
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$T as r,AE as i,AT as a,BT as o,CE as s,CT as c,DE as l,DT as u,EE as d,ET as f,FT as p,G as m,GT as h,HT as g,IT as _,JT as v,K as y,KT as b,LT as ee,MD as te,MT as ne,ND as re,NT as ie,OE as ae,OT as oe,PT as se,QT as ce,RT as le,SE as ue,ST as de,TE as fe,TT as pe,UT as me,VT as he,W as ge,WT as _e,XT as ve,YT as ye,ZT as be,_E as xe,_T as Se,aE as Ce,bE as x,bT as we,cE as Te,cO as S,cT as Ee,dE as De,dT as Oe,eE as ke,fE as Ae,fO as je,fT as C,gD as Me,gE as Ne,gT as w,hD as Pe,hE as Fe,hO as T,hT as Ie,iE as Le,jD as Re,jT as ze,kE as Be,kT as Ve,lE as He,lO as Ue,lT as We,mE as Ge,mO as E,mT as Ke,n as qe,nE as Je,oE as Ye,pE as Xe,pT as Ze,q as D,qT as O,rE as Qe,sE as $e,tE as et,uE as tt,uT as nt,vE as rt,vT as it,wE as at,wT as ot,xE as st,xT as ct,yE as lt,yT as ut,zT as dt}from"./dist-CcSJxYOw.js";import{n as k}from"./dist-CEWcFkOy.js";import{t as A}from"./x-CfhV2nwo.js";import{t as j}from"./button-Chsl3hJr.js";import{C as M,Et as ft,G as pt,J as mt,K as N,S as P,Tt as F,W as ht,X as I,Y as gt,Z as L,_ as R,at as _t,b as z,it as vt,ot as B,q as yt,x as V,y as H}from"./index-Dld_NfaR.js";import{a as bt,i as xt,n as St,o as Ct,r as wt,t as Tt}from"./card-BUOYrB8s.js";import{a as Et,i as U,n as Dt,o as W,r as G,t as Ot}from"./table-CKAkPBqh.js";import{t as kt}from"./TimeRangePicker-JtLvHr3a.js";import{t as At}from"./FilterBar-NyP0u16q.js";import{t as jt}from"./AdvancedFilter-BL2m0s1O.js";var K=Ue(`upload`,[[`path`,{d:`M12 3v12`,key:`1x0j5s`}],[`path`,{d:`m17 8-5-5-5 5`,key:`7q97r8`}],[`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`,key:`ih7n3h`}]]),q=t(e(),1),Mt=.1,Nt=[248,248,248],Pt=[24,24,24];function Ft(e,t,n){let r=t,i=n,a=-1,o=-1;for(let s=0;s<n;s++)for(let n=0;n<t;n++)e[(s*t+n)*4+3]>8&&(n<r&&(r=n),n>a&&(a=n),s<i&&(i=s),s>o&&(o=s));return a<0?null:{x:r,y:i,width:a-r+1,height:o-i+1}}function It(e,t,n){let r=t*n;if(r===0)return 0;let i=0;for(let t=3;t<e.length;t+=4)e[t]<=8&&i++;return i/r}function J(e,t,n){return It(e,t,n)>=Mt}function Lt(e,t){for(let n=0;n<e.length;n+=4)e[n]=t[0],e[n+1]=t[1],e[n+2]=t[2]}function Rt(e){for(let t=0;t<e.length;t+=4)e[t]=255-e[t],e[t+1]=255-e[t+1],e[t+2]=255-e[t+2]}var zt=12*1024*1024,Bt=480,Vt=160,Ht=.92;async function Ut(e,t={}){if(!e.type.startsWith(`image/`))throw Error(ze());if(e.size>zt)throw Error(a());let{source:n,width:r,height:i,cleanup:o}=await Wt(e);try{let a=e.type===`image/svg+xml`,o=Math.min(Bt/r,Vt/i,a?1/0:1),s=Math.max(1,Math.round(r*o)),c=Math.max(1,Math.round(i*o)),l=document.createElement(`canvas`);l.width=s,l.height=c;let d=l.getContext(`2d`);if(!d)throw Error(oe());d.imageSmoothingEnabled=!0,d.imageSmoothingQuality=`high`,d.drawImage(n,0,0,s,c);let f=Ft(d.getImageData(0,0,s,c).data,s,c)??{x:0,y:0,width:s,height:c},p=document.createElement(`canvas`);p.width=f.width,p.height=f.height;let m=p.getContext(`2d`);if(!m)throw Error(oe());if(m.drawImage(l,f.x,f.y,f.width,f.height,0,0,f.width,f.height),t.variantFor){let e=m.getImageData(0,0,f.width,f.height);J(e.data,f.width,f.height)?Lt(e.data,t.variantFor===`dark`?Nt:Pt):Rt(e.data),m.putImageData(e,0,0)}let h=J(m.getImageData(0,0,f.width,f.height).data,f.width,f.height),g=await X(p,`image/webp`,Ht)??await X(p,`image/png`);if(!g)throw Error(u());return{blob:g,hasAlpha:h}}finally{o()}}async function Wt(e){if(e.type===`image/svg+xml`)return Y(e);if(typeof createImageBitmap==`function`)try{let t=await createImageBitmap(e);return{source:t,width:t.width,height:t.height,cleanup:()=>t.close()}}catch{}return Y(e)}async function Y(e){let t=URL.createObjectURL(e);try{let e=new Image;return e.decoding=`async`,await new Promise((n,r)=>{e.onload=()=>n(),e.onerror=()=>r(Error(Ve())),e.src=t}),{source:e,width:e.naturalWidth||300,height:e.naturalHeight||150,cleanup:()=>URL.revokeObjectURL(t)}}catch(e){throw URL.revokeObjectURL(t),e}}function X(e,t,n){return new Promise(r=>e.toBlob(e=>r(e),t,n))}var Z=n();function Gt(e,t){let n=e.trim().replace(/[^A-Za-z0-9_.-]+/g,`-`).replace(/^-+|-+$/g,``)||`chart`,r=new Blob([JSON.stringify(t,null,2)],{type:`application/json`}),i=URL.createObjectURL(r),a=document.createElement(`a`);a.href=i,a.download=`${n}.chart.json`,document.body.appendChild(a),a.click(),a.remove(),URL.revokeObjectURL(i)}var Q=`__all__`,Kt={kind:`relative`,from:`now-24h`,to:`now`},qt=[{value:`status`,label:`Statut`},{value:`latencyMs`,label:`Latence (ms)`},{value:`route`,label:`Route`},{value:`roleKey`,label:`Rôle`},{value:`correlationId`,label:`Corrélation`}];function $({title:e,description:t,children:n}){return(0,Z.jsxs)(`section`,{className:`oc-show__section`,children:[(0,Z.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,Z.jsx)(`h2`,{className:`oc-show__title`,children:e}),t?(0,Z.jsx)(`p`,{className:`oc-show__desc`,children:t}):null]}),(0,Z.jsx)(`div`,{className:`oc-show__demo`,children:n})]})}function Jt(e){return e===`light`?re():e===`dark`?te():Re()}var Yt=[`primary`,`secondary`,`accent`,`muted`,`chart-1`,`chart-2`];function Xt({tokens:e,mode:t}){let n=e.colors[t];return(0,Z.jsx)(`div`,{className:`oc-chart-swatches`,"aria-hidden":!0,children:Yt.map(e=>{let t=n[e];return(0,Z.jsx)(`span`,{className:`oc-chart-swatch`,style:t?{background:t}:void 0},e)})})}function Zt({selected:e,title:t,subtitle:n,tokens:r,mode:i,onSelect:a,onExport:o}){return(0,Z.jsxs)(`div`,{className:`oc-chart-card-wrap`,children:[(0,Z.jsxs)(`button`,{type:`button`,className:qe(`oc-chart-card`,e&&`oc-chart-card--selected`),"aria-pressed":e,onClick:a,children:[(0,Z.jsxs)(`div`,{className:`oc-chart-card__head`,children:[(0,Z.jsx)(`span`,{className:`oc-chart-card__title`,children:t}),e?(0,Z.jsx)(k,{className:`size-4 text-primary`,"aria-hidden":!0}):null]}),r?(0,Z.jsx)(Xt,{tokens:r,mode:i}):(0,Z.jsx)(`div`,{className:`oc-chart-swatches oc-chart-swatches--native`,"aria-hidden":!0}),(0,Z.jsx)(`div`,{className:`oc-chart-card__meta`,children:(0,Z.jsx)(`span`,{className:`oc-chart-card__subtitle`,children:n})})]}),o?(0,Z.jsx)(j,{type:`button`,variant:`ghost`,size:`icon`,className:`oc-chart-card__export`,onClick:o,"aria-label":D(),title:D(),children:(0,Z.jsx)(ft,{className:`size-4`})}):null]})}function Qt({selectedKey:e,resolvedMode:t}){let n=T(S.charts.listMyCharts),r=E(S.charts.setMyChart);async function i(e){try{await r({name:e})}catch{}}return(0,Z.jsxs)(`section`,{className:`oc-show__section`,children:[(0,Z.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,Z.jsx)(`h2`,{className:`oc-show__title`,children:ue()}),(0,Z.jsx)(`p`,{className:`oc-show__desc`,children:st()})]}),(0,Z.jsxs)(`div`,{className:`oc-chart-grid`,children:[(0,Z.jsx)(Zt,{selected:e===null,title:x(),subtitle:lt(),tokens:null,mode:t,onSelect:()=>void i(null)}),(n??[]).map(n=>{let r=n.via===`common`?rt():n.via===`owner`?xe():Ne({group:n.via.group});return(0,Z.jsx)(Zt,{selected:e===n.key,title:n.name,subtitle:r,tokens:n.tokens,mode:t,onSelect:()=>void i(n.key),onExport:()=>Gt(n.name,n.tokens)},n.key)})]}),n!==void 0&&n.length===0?(0,Z.jsx)(`p`,{className:`oc-show__desc`,children:Fe()}):null]})}function $t(){let e=E(S.charts.importChart),[t,n]=(0,q.useState)(``),[i,a]=(0,q.useState)(``),[o,s]=(0,q.useState)(null),[c,l]=(0,q.useState)(!1),[u,d]=(0,q.useState)(!1);async function f(e){let t=e.target.files?.[0];if(e.target.value=``,t){s(null),l(!1);try{a(await t.text())}catch{s(O())}}}async function p(){if(s(null),l(!1),t.trim()===``){s(h());return}let r;try{r=JSON.parse(i)}catch{s(O());return}d(!0);try{await e({name:t.trim(),tokens:r}),l(!0),n(``),a(``)}catch(e){s(e instanceof Error?e.message:String(e))}finally{d(!1)}}return(0,Z.jsxs)(`section`,{className:`oc-show__section`,children:[(0,Z.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,Z.jsx)(`h2`,{className:`oc-show__title`,children:et()}),(0,Z.jsx)(`p`,{className:`oc-show__desc`,children:ke()})]}),(0,Z.jsxs)(`div`,{className:`oc-chart-import`,children:[(0,Z.jsxs)(`label`,{className:`oc-chart-import__field`,children:[(0,Z.jsx)(`span`,{className:`oc-chart-import__label`,children:r()}),(0,Z.jsx)(L,{value:t,onChange:e=>n(e.target.value),placeholder:ce(),maxLength:60})]}),(0,Z.jsxs)(`label`,{className:`oc-chart-import__field`,children:[(0,Z.jsx)(`span`,{className:`oc-chart-import__label`,children:be()}),(0,Z.jsx)(`textarea`,{className:`oc-chart-import__textarea`,value:i,onChange:e=>a(e.target.value),placeholder:ve(),rows:8,spellCheck:!1})]}),(0,Z.jsxs)(`div`,{className:`oc-show__row`,children:[(0,Z.jsx)(j,{variant:`outline`,size:`sm`,asChild:!0,children:(0,Z.jsxs)(`label`,{className:`oc-chart-import__file`,children:[(0,Z.jsx)(K,{className:`size-4`}),ye(),(0,Z.jsx)(`input`,{type:`file`,accept:`application/json,.json`,className:`oc-chart-import__file-input`,onChange:e=>void f(e)})]})}),(0,Z.jsx)(j,{size:`sm`,disabled:u,onClick:()=>void p(),children:v()})]}),o?(0,Z.jsx)(`p`,{className:`oc-chart-import__error`,children:o}):null,c?(0,Z.jsx)(`p`,{className:`oc-chart-import__ok`,children:b()}):null]})]})}function en({chart:e}){let t=je(S.charts.setChartLogo),n=E(S.charts.removeChartLogo),[r,i]=(0,q.useState)(!1),[a,o]=(0,q.useState)(null),s=t=>t===`light`?e.logoLightUrl:e.logoDarkUrl;async function c(n,r,a){if(e.chartId!==void 0){o(null),i(!0);try{let{blob:i,hasAlpha:o}=await Ut(r,a?{variantFor:a}:{}),s=await i.arrayBuffer();await t({chartId:e.chartId,bytes:s,mode:n,hasAlpha:o})}catch(e){o(e instanceof Error?e.message:String(e))}finally{i(!1)}}}async function l(e,t){let n=t.target.files?.[0];t.target.value=``,n&&await c(e,n)}async function u(t){if(e.chartId!==void 0){o(null),i(!0);try{await n({chartId:e.chartId,mode:t})}catch(e){o(e instanceof Error?e.message:String(e))}finally{i(!1)}}}async function d(e){let t=s(e===`light`?`dark`:`light`);if(t){o(null),i(!0);try{await c(e,await(await fetch(t)).blob(),e)}catch(e){o(e instanceof Error?e.message:String(e))}finally{i(!1)}}}function f({mode:e}){let t=s(e),n=s(e===`light`?`dark`:`light`);return(0,Z.jsxs)(`div`,{className:`oc-chart-mine__logo-slot`,children:[(0,Z.jsx)(`span`,{className:`oc-chart-mine__logo-mode`,children:e===`light`?le():ee()}),(0,Z.jsx)(`span`,{className:`oc-chart-mine__logo-preview`,"data-mode":e,"data-empty":t?void 0:`1`,children:t?(0,Z.jsx)(`img`,{src:t,alt:``}):null}),(0,Z.jsx)(j,{variant:`outline`,size:`sm`,asChild:!0,children:(0,Z.jsxs)(`label`,{className:`oc-chart-import__file`,children:[(0,Z.jsx)(K,{className:`size-4`}),t?p():_(),(0,Z.jsx)(`input`,{type:`file`,accept:`image/*`,className:`oc-chart-import__file-input`,onChange:t=>void l(e,t)})]})}),!t&&n?(0,Z.jsx)(j,{variant:`ghost`,size:`sm`,disabled:r,onClick:()=>void d(e),children:ie()}):null,t?(0,Z.jsx)(j,{variant:`ghost`,size:`sm`,disabled:r,onClick:()=>void u(e),children:se()}):null]})}return(0,Z.jsxs)(`div`,{className:`oc-chart-mine__logo`,children:[(0,Z.jsx)(`span`,{className:`oc-chart-mine__groups-label`,children:dt()}),(0,Z.jsxs)(`div`,{className:`oc-chart-mine__logo-slots`,children:[(0,Z.jsx)(f,{mode:`light`}),(0,Z.jsx)(f,{mode:`dark`})]}),r?(0,Z.jsx)(`span`,{className:`oc-show__desc`,children:ne()}):null,a?(0,Z.jsx)(`p`,{className:`oc-chart-import__error`,children:a}):null]})}function tn({chart:e}){let t=T(S.me.getMe,{host:B}),n=E(S.charts.addChartDomain),r=E(S.charts.removeChartDomain),[i,a]=(0,q.useState)(``),[o,s]=(0,q.useState)(null),[l,u]=(0,q.useState)(!1);if(t?.role!==`admin`)return null;let d=e.domains??[];async function p(){let t=i.trim();if(t!==``){s(null),u(!0);try{await n({chartKey:e.key,domain:t}),a(``)}catch(e){s(e instanceof Error?e.message:String(e))}finally{u(!1)}}}async function m(t){s(null);try{await r({chartKey:e.key,domain:t})}catch{}}return(0,Z.jsxs)(`div`,{className:`oc-chart-mine__domains`,children:[(0,Z.jsx)(`span`,{className:`oc-chart-mine__groups-label`,children:f()}),(0,Z.jsxs)(`div`,{className:`oc-chart-mine__domains-body`,children:[(0,Z.jsx)(`div`,{className:`oc-chart-avail__groups`,children:d.length===0?(0,Z.jsx)(`span`,{className:`oc-show__desc`,children:de()}):d.map(e=>(0,Z.jsxs)(I,{variant:`secondary`,className:`oc-chart-avail__chip`,children:[e,(0,Z.jsx)(`button`,{type:`button`,className:`oc-chart-avail__chip-x`,"aria-label":ct({domain:e}),onClick:()=>void m(e),children:(0,Z.jsx)(A,{className:`size-3`})})]},e))}),(0,Z.jsxs)(`div`,{className:`oc-show__row`,children:[(0,Z.jsx)(L,{value:i,onChange:e=>a(e.target.value),placeholder:ot(),className:`oc-chart-mine__domains-input`,onKeyDown:e=>{e.key===`Enter`&&p()}}),(0,Z.jsx)(j,{variant:`outline`,size:`sm`,disabled:l,onClick:()=>void p(),children:c()})]}),(0,Z.jsx)(`span`,{className:`oc-show__desc`,children:pe()}),o?(0,Z.jsx)(`p`,{className:`oc-chart-import__error`,children:o}):null]})]})}function nn(e){let t={...e};return delete t.bpm,JSON.stringify(t,null,2)}function rn({chart:e}){let t=E(S.charts.updateChart),n=E(S.charts.deleteChart),[r,i]=(0,q.useState)(!1),[a,s]=(0,q.useState)(e.name),[c,l]=(0,q.useState)(()=>nn(e.tokens)),[u,d]=(0,q.useState)(e.tokens.bpm??0),[f,p]=(0,q.useState)(null),[h,g]=(0,q.useState)(!1);function _(){s(e.name),l(nn(e.tokens)),d(e.tokens.bpm??0),p(null),i(!0)}async function v(){if(e.chartId===void 0)return;p(null);let n;try{n=JSON.parse(c)}catch{p(O());return}if(n&&typeof n==`object`&&!Array.isArray(n)){let e=n;u>0?e.bpm=u:delete e.bpm}g(!0);try{await t({chartId:e.chartId,name:a.trim(),tokens:n}),i(!1)}catch(e){p(e instanceof Error?e.message:String(e))}finally{g(!1)}}async function b(){if(e.chartId!==void 0&&window.confirm(w()))try{await n({chartId:e.chartId})}catch{}}return(0,Z.jsxs)(`div`,{className:`oc-chart-mine__row`,children:[(0,Z.jsxs)(`div`,{className:`oc-chart-mine__head`,children:[(0,Z.jsx)(`span`,{className:`oc-chart-mine__name`,children:e.name}),(0,Z.jsx)(`div`,{className:`oc-show__row`,children:r?null:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(j,{variant:`outline`,size:`sm`,onClick:_,children:he()}),(0,Z.jsx)(j,{variant:`ghost`,size:`sm`,onClick:()=>void b(),children:o()})]})})]}),r?(0,Z.jsxs)(`div`,{className:`oc-chart-mine__editor`,children:[(0,Z.jsxs)(`label`,{className:`oc-chart-import__field`,children:[(0,Z.jsx)(`span`,{className:`oc-chart-import__label`,children:it()}),(0,Z.jsx)(L,{value:a,onChange:e=>s(e.target.value),maxLength:60})]}),(0,Z.jsxs)(`div`,{className:`oc-chart-import__field`,children:[(0,Z.jsx)(`span`,{className:`oc-chart-import__label`,children:y()}),(0,Z.jsxs)(`div`,{className:`oc-chart-bpm`,children:[(0,Z.jsx)(`input`,{type:`range`,className:`oc-chart-bpm__slider`,min:0,max:90,step:5,value:u,onChange:e=>d(Number(e.target.value)),"aria-label":y()}),(0,Z.jsx)(`span`,{className:`oc-chart-bpm__value`,children:u===0?m():`${u} BPM`})]}),(0,Z.jsx)(`span`,{className:`oc-show__desc`,children:ge()})]}),(0,Z.jsxs)(`label`,{className:`oc-chart-import__field`,children:[(0,Z.jsx)(`span`,{className:`oc-chart-import__label`,children:Se()}),(0,Z.jsx)(`textarea`,{className:`oc-chart-import__textarea`,value:c,onChange:e=>l(e.target.value),rows:10,spellCheck:!1})]}),f?(0,Z.jsx)(`p`,{className:`oc-chart-import__error`,children:f}):null,(0,Z.jsxs)(`div`,{className:`oc-show__row`,children:[(0,Z.jsx)(j,{size:`sm`,disabled:h,onClick:()=>void v(),children:we()}),(0,Z.jsx)(j,{variant:`ghost`,size:`sm`,onClick:()=>i(!1),children:ut()})]})]}):null,(0,Z.jsx)(en,{chart:e}),(0,Z.jsx)(tn,{chart:e})]})}function an(){let e=T(S.charts.listMyCharts),t=(e??[]).filter(e=>e.via===`owner`);return(0,Z.jsxs)(`section`,{className:`oc-show__section`,children:[(0,Z.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,Z.jsx)(`h2`,{className:`oc-show__title`,children:_e()}),(0,Z.jsx)(`p`,{className:`oc-show__desc`,children:me()})]}),e!==void 0&&t.length===0?(0,Z.jsx)(`p`,{className:`oc-show__desc`,children:g()}):(0,Z.jsx)(`div`,{className:`oc-chart-mine-list`,children:t.map(e=>(0,Z.jsx)(rn,{chart:e},e.key))})]})}function on({chart:e,groups:t}){let n=E(S.charts.addChartToGroupPool),r=E(S.charts.removeChartFromGroupPool),i=e.restrictedToGroups,a=e.poolGroups,o=new Set((a??[]).map(e=>e.groupId)),s=t.filter(e=>!o.has(e._id));async function c(t){try{await n({groupId:t,chartKey:e.key})}catch{}}async function l(t){try{await r({groupId:t,chartKey:e.key})}catch{}}return(0,Z.jsxs)(`div`,{className:`oc-chart-avail`,children:[(0,Z.jsxs)(`div`,{className:`oc-chart-avail__head`,children:[(0,Z.jsx)(`span`,{className:`oc-chart-avail__name`,children:e.name}),(0,Z.jsx)(I,{variant:i?`secondary`:`outline`,className:`oc-chart-avail__state`,children:i?$e():e.kind===`custom`&&e.scope===`personal`?C():Te()}),e.isGlobalDefault?(0,Z.jsx)(I,{variant:`default`,children:Ye()}):null]}),(0,Z.jsxs)(`div`,{className:`oc-chart-avail__groups`,children:[(0,Z.jsx)(`span`,{className:`oc-chart-mine__groups-label`,children:Le()}),(a??[]).map(e=>(0,Z.jsxs)(I,{variant:`secondary`,className:`oc-chart-avail__chip`,children:[e.name,(0,Z.jsx)(`button`,{type:`button`,className:`oc-chart-avail__chip-x`,"aria-label":Je({group:e.name}),onClick:()=>void l(e.groupId),children:(0,Z.jsx)(A,{className:`size-3`})})]},e.groupId)),s.length>0?(0,Z.jsxs)(H,{value:``,onValueChange:e=>void c(e),children:[(0,Z.jsx)(P,{size:`sm`,className:`w-56`,children:(0,Z.jsx)(M,{placeholder:Qe()})}),(0,Z.jsx)(z,{children:s.map(e=>(0,Z.jsx)(V,{value:e._id,children:e.name},e._id))})]}):t.length===0?(0,Z.jsx)(`span`,{className:`oc-show__desc`,children:Ce()}):null]})]})}function sn({chart:e}){let t=E(S.charts.promoteChartToCommon),n=E(S.charts.deleteChart);async function r(){if(e.chartId!==void 0)try{await t({chartId:e.chartId})}catch{}}async function i(){if(e.chartId!==void 0&&window.confirm(w()))try{await n({chartId:e.chartId})}catch{}}return(0,Z.jsxs)(`div`,{className:`oc-chart-avail`,children:[(0,Z.jsxs)(`div`,{className:`oc-chart-avail__head`,children:[(0,Z.jsx)(`span`,{className:`oc-chart-avail__name`,children:e.name}),(0,Z.jsx)(I,{variant:e.scope===`common`?`outline`:`secondary`,children:e.scope===`common`?Oe():C()}),e.ownerLabel?(0,Z.jsx)(`span`,{className:`oc-show__desc`,children:Ze({owner:e.ownerLabel})}):null]}),(0,Z.jsxs)(`div`,{className:`oc-show__row`,children:[e.scope===`personal`?(0,Z.jsx)(j,{variant:`outline`,size:`sm`,onClick:()=>void r(),children:nt()}):null,(0,Z.jsx)(j,{variant:`ghost`,size:`sm`,onClick:()=>void i(),children:We()})]})]})}function cn({defaultThemeMode:e,defaultLocale:t,defaultChartKey:n}){let r=E(S.admin.setDefaultThemeMode),a=E(S.admin.setDefaultLocale),o=E(S.charts.setDefaultChart),c=T(S.charts.listChartsAdmin),u=T(S.groups.listGroups,{}),f=e??`system`,p=t??`fr`;return(0,Z.jsxs)(`div`,{className:`oc-appearance-admin`,children:[(0,Z.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,Z.jsx)(`h2`,{className:`oc-show__title`,children:at()}),(0,Z.jsx)(`p`,{className:`oc-show__desc`,children:s()})]}),(0,Z.jsxs)(`section`,{className:`oc-show__section`,children:[(0,Z.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,Z.jsx)(`h3`,{className:`oc-show__title`,children:Ge()}),(0,Z.jsx)(`p`,{className:`oc-show__desc`,children:Xe()})]}),(0,Z.jsxs)(`div`,{className:`oc-show__row`,children:[(0,Z.jsx)(j,{variant:n===null?`default`:`outline`,size:`sm`,onClick:()=>void o({name:null}),children:x()}),_t.map(e=>(0,Z.jsx)(j,{variant:n===e.key?`default`:`outline`,size:`sm`,onClick:()=>void o({name:e.key}),children:e.name},e.key)),(c??[]).filter(e=>e.kind===`custom`&&e.scope===`common`).map(e=>(0,Z.jsx)(j,{variant:n===e.key?`default`:`outline`,size:`sm`,onClick:()=>void o({name:e.key}),children:e.name},e.key))]})]}),(0,Z.jsxs)(`section`,{className:`oc-show__section`,children:[(0,Z.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,Z.jsx)(`h3`,{className:`oc-show__title`,children:Ae()}),(0,Z.jsx)(`p`,{className:`oc-show__desc`,children:De()})]}),(0,Z.jsx)(`div`,{className:`oc-chart-avail-list`,children:(c??[]).filter(e=>!(e.kind===`custom`&&e.scope===`common`)).map(e=>(0,Z.jsx)(on,{chart:e,groups:u??[]},e.key))})]}),(0,Z.jsxs)(`section`,{className:`oc-show__section`,children:[(0,Z.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,Z.jsx)(`h3`,{className:`oc-show__title`,children:tt()}),(0,Z.jsx)(`p`,{className:`oc-show__desc`,children:He()})]}),(0,Z.jsx)(`div`,{className:`oc-chart-avail-list`,children:(c??[]).filter(e=>e.kind===`builtin`||e.scope===`common`).map(e=>(0,Z.jsxs)(`div`,{className:`oc-chart-avail`,children:[(0,Z.jsx)(`div`,{className:`oc-chart-avail__head`,children:(0,Z.jsx)(`span`,{className:`oc-chart-avail__name`,children:e.name})}),(0,Z.jsx)(tn,{chart:e})]},e.key))})]}),(0,Z.jsxs)(`section`,{className:`oc-show__section`,children:[(0,Z.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,Z.jsx)(`h3`,{className:`oc-show__title`,children:Ie()}),(0,Z.jsx)(`p`,{className:`oc-show__desc`,children:Ke()})]}),(()=>{let e=(c??[]).filter(e=>e.kind===`custom`);return e.length===0?(0,Z.jsx)(`p`,{className:`oc-show__desc`,children:Ee()}):(0,Z.jsx)(`div`,{className:`oc-chart-avail-list`,children:e.map(e=>(0,Z.jsx)(sn,{chart:e},e.key))})})()]}),(0,Z.jsxs)(`section`,{className:`oc-show__section`,children:[(0,Z.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,Z.jsx)(`h3`,{className:`oc-show__title`,children:i()}),(0,Z.jsx)(`p`,{className:`oc-show__desc`,children:Be()})]}),(0,Z.jsx)(`div`,{className:`oc-show__row`,children:[`light`,`dark`,`system`].map(e=>(0,Z.jsx)(j,{variant:f===e?`default`:`outline`,size:`sm`,onClick:()=>void r({mode:e}),children:Jt(e)},e))})]}),(0,Z.jsxs)(`section`,{className:`oc-show__section`,children:[(0,Z.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,Z.jsx)(`h3`,{className:`oc-show__title`,children:ae()}),(0,Z.jsx)(`p`,{className:`oc-show__desc`,children:l()})]}),(0,Z.jsx)(`div`,{className:`oc-show__row`,children:[`fr`,`en`].map(e=>(0,Z.jsx)(j,{variant:p===e?`default`:`outline`,size:`sm`,onClick:()=>void a({locale:e}),children:e===`fr`?Me():Pe()},e))}),(0,Z.jsx)(`p`,{className:`oc-show__desc`,children:d()})]})]})}function ln(){let e=T(S.me.getMe,{host:B}),t=vt(e?.resolvedThemeMode);return(0,Z.jsxs)(`div`,{className:`oc-appearance`,children:[(0,Z.jsx)(Qt,{selectedKey:e?.chartKey??null,resolvedMode:t}),(0,Z.jsx)($t,{}),(0,Z.jsx)(an,{}),e?.role===`admin`?(0,Z.jsx)(cn,{defaultThemeMode:e.defaultThemeMode,defaultLocale:e.defaultLocale,defaultChartKey:e.defaultChartKey}):null]})}function un(){let[e,t]=(0,q.useState)(!0),[n,r]=(0,q.useState)(`per-user`),[i,a]=(0,q.useState)(``),[o,s]=(0,q.useState)(Q),[c,l]=(0,q.useState)(Q),[u,d]=(0,q.useState)(Kt),f=i!==``||o!==Q||c!==Q;function p(){a(``),s(Q),l(Q),d(Kt)}return(0,Z.jsxs)(`div`,{className:`oc-show`,children:[(0,Z.jsx)(ln,{}),(0,Z.jsxs)(`details`,{className:`oc-show__ref`,children:[(0,Z.jsx)(`summary`,{className:`oc-show__title`,children:fe()}),(0,Z.jsxs)($,{title:`Buttons`,description:`Variants`,children:[(0,Z.jsxs)(`div`,{className:`oc-show__row`,children:[(0,Z.jsx)(j,{children:`Default`}),(0,Z.jsx)(j,{variant:`secondary`,children:`Secondary`}),(0,Z.jsx)(j,{variant:`outline`,children:`Outline`}),(0,Z.jsx)(j,{variant:`ghost`,children:`Ghost`}),(0,Z.jsx)(j,{variant:`destructive`,children:`Destructive`}),(0,Z.jsx)(j,{variant:`link`,children:`Link`})]}),(0,Z.jsxs)(`div`,{className:`oc-show__row`,children:[(0,Z.jsx)(j,{size:`sm`,children:`Small`}),(0,Z.jsx)(j,{children:`Default`}),(0,Z.jsx)(j,{size:`lg`,children:`Large`}),(0,Z.jsx)(j,{size:`icon`,"aria-label":`more`,children:(0,Z.jsx)(F,{})}),(0,Z.jsx)(j,{disabled:!0,children:`Disabled`})]})]}),(0,Z.jsx)($,{title:`Badges`,children:(0,Z.jsxs)(`div`,{className:`oc-show__row`,children:[(0,Z.jsx)(I,{children:`Default`}),(0,Z.jsx)(I,{variant:`secondary`,children:`Secondary`}),(0,Z.jsx)(I,{variant:`outline`,children:`Outline`}),(0,Z.jsx)(I,{variant:`destructive`,children:`Destructive`})]})}),(0,Z.jsx)($,{title:`Inputs & selection`,children:(0,Z.jsxs)(`div`,{className:`oc-show__row oc-show__row--col`,children:[(0,Z.jsx)(L,{placeholder:`Text input…`}),(0,Z.jsxs)(`div`,{className:`oc-show__row`,children:[(0,Z.jsxs)(H,{value:n,onValueChange:r,children:[(0,Z.jsx)(P,{className:`w-56`,children:(0,Z.jsx)(M,{placeholder:`Select…`})}),(0,Z.jsxs)(z,{children:[(0,Z.jsx)(V,{value:`per-user`,children:`per-user (chacun son agent)`}),(0,Z.jsx)(V,{value:`shared`,children:`shared (agent commun)`})]})]}),(0,Z.jsxs)(`label`,{className:`oc-show__check`,children:[(0,Z.jsx)(R,{checked:e,onCheckedChange:e=>t(!!e)}),`Checkbox`]})]})]})}),(0,Z.jsx)($,{title:`Filtres & plage temporelle`,description:`Barre réutilisable (recherche debouncée + selects rapides à largeur auto + plage façon Grafana) et constructeur de filtre avancé. Câblée dans Users, Groups, Comptes de service, Traces, Anomalies, Audit et KPI.`,children:(0,Z.jsxs)(`div`,{className:`oc-show__row oc-show__row--col`,children:[(0,Z.jsxs)(At,{q:i,onQChange:a,searchPlaceholder:`Rechercher (kind, principal, rôle, route…)`,timeRange:u,onTimeRangeChange:d,onReset:p,canReset:f,children:[(0,Z.jsxs)(H,{value:o,onValueChange:s,children:[(0,Z.jsx)(P,{size:`sm`,children:(0,Z.jsx)(M,{})}),(0,Z.jsxs)(z,{children:[(0,Z.jsx)(V,{value:Q,children:`Toutes directions`}),(0,Z.jsx)(V,{value:`inbound`,children:`inbound`}),(0,Z.jsx)(V,{value:`outbound`,children:`outbound`}),(0,Z.jsx)(V,{value:`internal`,children:`internal`})]})]}),(0,Z.jsxs)(H,{value:c,onValueChange:l,children:[(0,Z.jsx)(P,{size:`sm`,children:(0,Z.jsx)(M,{})}),(0,Z.jsxs)(z,{children:[(0,Z.jsx)(V,{value:Q,children:`Toutes sévérités`}),(0,Z.jsx)(V,{value:`info`,children:`info`}),(0,Z.jsx)(V,{value:`warn`,children:`warn`}),(0,Z.jsx)(V,{value:`critical`,children:`critical`})]})]})]}),(0,Z.jsx)(jt,{fields:qt,onChange:()=>{}}),(0,Z.jsxs)(`div`,{className:`oc-show__row`,children:[(0,Z.jsx)(`span`,{className:`oc-show__desc`,children:`Sélecteur de plage seul :`}),(0,Z.jsx)(kt,{value:u,onChange:d})]})]})}),(0,Z.jsx)($,{title:`Dropdown menu`,description:`Row actions / kebab`,children:(0,Z.jsxs)(ht,{children:[(0,Z.jsx)(gt,{asChild:!0,children:(0,Z.jsx)(j,{variant:`outline`,size:`icon`,"aria-label":`Open menu`,children:(0,Z.jsx)(F,{})})}),(0,Z.jsxs)(pt,{align:`start`,children:[(0,Z.jsx)(yt,{children:`Actions`}),(0,Z.jsx)(mt,{}),(0,Z.jsx)(N,{children:`Edit`}),(0,Z.jsx)(N,{children:`Duplicate`}),(0,Z.jsx)(mt,{}),(0,Z.jsx)(N,{variant:`destructive`,children:`Delete`})]})]})}),(0,Z.jsx)($,{title:`Card`,children:(0,Z.jsxs)(Tt,{className:`w-80`,children:[(0,Z.jsxs)(bt,{children:[(0,Z.jsx)(Ct,{children:`Instance`}),(0,Z.jsx)(wt,{children:`Non-secret metadata only.`})]}),(0,Z.jsx)(St,{className:`text-sm text-muted-foreground`,children:`ws://gateway.example.org:18789`}),(0,Z.jsxs)(xt,{className:`gap-2`,children:[(0,Z.jsx)(j,{size:`sm`,children:`Save`}),(0,Z.jsx)(j,{size:`sm`,variant:`ghost`,children:`Cancel`})]})]})}),(0,Z.jsx)($,{title:`Table`,children:(0,Z.jsxs)(Ot,{children:[(0,Z.jsx)(Et,{children:(0,Z.jsxs)(W,{children:[(0,Z.jsx)(U,{className:`w-8`,children:(0,Z.jsx)(R,{"aria-label":`select all`})}),(0,Z.jsx)(U,{children:`Name`}),(0,Z.jsx)(U,{children:`Mode`}),(0,Z.jsx)(U,{className:`text-right`,children:`Status`}),(0,Z.jsx)(U,{className:`w-8`})]})}),(0,Z.jsx)(Dt,{children:[{n:`admins`,m:`per-user`,s:`active`},{n:`family`,m:`shared`,s:`active`}].map(e=>(0,Z.jsxs)(W,{children:[(0,Z.jsx)(G,{children:(0,Z.jsx)(R,{"aria-label":`select ${e.n}`})}),(0,Z.jsx)(G,{className:`font-medium`,children:e.n}),(0,Z.jsx)(G,{children:(0,Z.jsx)(I,{variant:`secondary`,children:e.m})}),(0,Z.jsx)(G,{className:`text-right`,children:(0,Z.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-muted-foreground`,children:[(0,Z.jsx)(k,{className:`size-3.5`}),` `,e.s]})}),(0,Z.jsx)(G,{children:(0,Z.jsx)(j,{variant:`ghost`,size:`icon`,"aria-label":`row actions`,children:(0,Z.jsx)(F,{})})})]},e.n))})]})}),(0,Z.jsx)($,{title:`App fragments`,description:`Chat-specific components`,children:(0,Z.jsxs)(`div`,{className:`oc-show__row oc-show__row--col`,children:[(0,Z.jsx)(`div`,{className:`oc-msg oc-msg--assistant`,children:(0,Z.jsx)(`div`,{className:`oc-msg__body`,children:`Assistant message bubble.`})}),(0,Z.jsx)(`div`,{className:`oc-tool oc-tool--completed`,children:(0,Z.jsxs)(`div`,{className:`oc-tool__header`,children:[(0,Z.jsx)(`span`,{className:`oc-tool__icon`,children:`✓`}),(0,Z.jsx)(`span`,{className:`oc-tool__name`,children:`write-file`}),(0,Z.jsx)(`span`,{className:`oc-tool__phase`,children:`completed`})]})}),(0,Z.jsxs)(`div`,{className:`oc-run-status oc-run-status--streaming`,children:[(0,Z.jsx)(`span`,{className:`oc-run-status__dot`}),(0,Z.jsx)(`span`,{className:`oc-run-status__label`,children:`Running`})]})]})})]})]})}export{un as ThemeShowroom};