@lacneu/atrium 0.61.0 → 0.62.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 (76) hide show
  1. package/dist/assets/AccessTab-DY7s2nUA.js +1 -0
  2. package/dist/assets/{AdvancedFilter-B6eiX7Zx.js → AdvancedFilter-BbljBL_5.js} +1 -1
  3. package/dist/assets/AgentFilesTab-BtY1O3co.js +3 -0
  4. package/dist/assets/AnomaliesTab-Dc1BWkpz.js +1 -0
  5. package/dist/assets/AuditTab-BDH_c5SQ.js +1 -0
  6. package/dist/assets/BridgeTab-BpMpD4Gm.js +1 -0
  7. package/dist/assets/ChatDefaultsTab-B2vDY2FL.js +1 -0
  8. package/dist/assets/{DataTableShell-D-RklOZj.js → DataTableShell-Bo9JdV4-.js} +1 -1
  9. package/dist/assets/{DetailChips-DdVat1KM.js → DetailChips-stIZjuDW.js} +1 -1
  10. package/dist/assets/FeedbacksTab-CxQJT8RQ.js +1 -0
  11. package/dist/assets/{FieldLabel-HlyBnXo4.js → FieldLabel-DVIaWFle.js} +1 -1
  12. package/dist/assets/FilesTab-COkLn-3m.js +1 -0
  13. package/dist/assets/{FilterBar-UyunwEZF.js → FilterBar-XGMlTH00.js} +1 -1
  14. package/dist/assets/GroupsTab-DahUEKfi.js +1 -0
  15. package/dist/assets/InstancesTab-CdxmyjKD.js +1 -0
  16. package/dist/assets/IntegrationsTab-DcTQI2LV.js +1 -0
  17. package/dist/assets/{KpiTab-h0NlewDJ.js → KpiTab-CRHncLGM.js} +1 -1
  18. package/dist/assets/PreferencesTab-CMQIXTo8.js +1 -0
  19. package/dist/assets/PromptInjectionsTab-RUWYcoYK.js +4 -0
  20. package/dist/assets/RolesTab-CTWsWK9B.js +1 -0
  21. package/dist/assets/ScheduledTab-BR6mWCfc.js +1 -0
  22. package/dist/assets/ServiceAccountsTab-BTyR_9ZB.js +1 -0
  23. package/dist/assets/SubAgentReportsTab-L2Dsfn4x.js +1 -0
  24. package/dist/assets/ThemeShowroom-CUXWYVrF.js +1 -0
  25. package/dist/assets/{TimeRangePicker-fvvxJ7HC.js → TimeRangePicker-DGb-YJj5.js} +1 -1
  26. package/dist/assets/TracesTab-Cbp7BSkH.js +1 -0
  27. package/dist/assets/UsersTab-NHhJ0saL.js +1 -0
  28. package/dist/assets/VoiceTab-sjryLTED.js +1 -0
  29. package/dist/assets/{button-BCAsV4-2.js → button-DRguy6Hz.js} +1 -1
  30. package/dist/assets/{card-BwAm8Ufs.js → card-BTuOmZr0.js} +1 -1
  31. package/dist/assets/chevrons-up-down-BFfHriX4.js +1 -0
  32. package/dist/assets/{compatView-CKSMKOA6.js → compatView-BHorgRif.js} +1 -1
  33. package/dist/assets/dispatchErrorInfo-CJWXIZnL.js +1 -0
  34. package/dist/assets/{dist-CRven8ef.js → dist-3KrBDl5H.js} +1 -1
  35. package/dist/assets/dist-CAP0mn60.js +44 -0
  36. package/dist/assets/{dist-Bw4s22TB.js → dist-DH6cB1zr.js} +1 -1
  37. package/dist/assets/{dist-CT4mrpPz.js → dist-h58Lj6DX.js} +1 -1
  38. package/dist/assets/{highlighted-body-OFNGDK62-DlBa16Mr.js → highlighted-body-OFNGDK62-INR9Ztt5.js} +1 -1
  39. package/dist/assets/{index-DPQr8euK.css → index-Ba5lBN_I.css} +1 -1
  40. package/dist/assets/index-DcPINOh1.js +238 -0
  41. package/dist/assets/mermaid-GHXKKRXX-Dnmq3zax.js +1 -0
  42. package/dist/assets/{pdf-ctspKy12.js → pdf-bkWuoknj.js} +1 -1
  43. package/dist/assets/roleDescriptions-B6dQdyoM.js +1 -0
  44. package/dist/assets/{table-DckOsZQY.js → table-1vsq56Zt.js} +1 -1
  45. package/dist/assets/{tabs-DKk4J439.js → tabs-IFDKEY73.js} +1 -1
  46. package/dist/assets/x-ChVRoy_h.js +1 -0
  47. package/dist/index.html +8 -8
  48. package/package.json +1 -1
  49. package/dist/assets/AccessTab-DBXKZGgf.js +0 -1
  50. package/dist/assets/AgentFilesTab-CUMkUFY0.js +0 -3
  51. package/dist/assets/AnomaliesTab-DU5uZOg-.js +0 -1
  52. package/dist/assets/AuditTab-nLpz-KoA.js +0 -1
  53. package/dist/assets/BridgeTab-Bno_F96W.js +0 -1
  54. package/dist/assets/ChatDefaultsTab-CwRGLZ4Z.js +0 -1
  55. package/dist/assets/FeedbacksTab-ejc0BNCp.js +0 -1
  56. package/dist/assets/FilesTab-xKmAhsXC.js +0 -1
  57. package/dist/assets/GroupsTab-DkaxUE-L.js +0 -1
  58. package/dist/assets/InstancesTab-BnSYWxfp.js +0 -1
  59. package/dist/assets/IntegrationsTab-BOQYLTZE.js +0 -1
  60. package/dist/assets/PreferencesTab-CcGguucO.js +0 -1
  61. package/dist/assets/PromptInjectionsTab-y-Gf5MXQ.js +0 -4
  62. package/dist/assets/RolesTab-lwOfl6N5.js +0 -1
  63. package/dist/assets/ScheduledTab-BntpA-Zo.js +0 -1
  64. package/dist/assets/ServiceAccountsTab-CQDS8dvg.js +0 -1
  65. package/dist/assets/SubAgentReportsTab-BKX-g9sQ.js +0 -1
  66. package/dist/assets/ThemeShowroom-CdO9EEFA.js +0 -1
  67. package/dist/assets/TracesTab-C2GNUs6y.js +0 -1
  68. package/dist/assets/UsersTab-BRdWHZOu.js +0 -1
  69. package/dist/assets/VoiceTab-RC5QjSW2.js +0 -1
  70. package/dist/assets/chevrons-up-down-C82Hxi1c.js +0 -1
  71. package/dist/assets/dispatchErrorInfo-BMHBocZy.js +0 -1
  72. package/dist/assets/dist-B1qnlN7I.js +0 -44
  73. package/dist/assets/index-rCasMjHB.js +0 -238
  74. package/dist/assets/mermaid-GHXKKRXX-BQnxJzgK.js +0 -1
  75. package/dist/assets/roleDescriptions-Bb_m4cgS.js +0 -1
  76. package/dist/assets/x-8-3cz0V6.js +0 -1
@@ -0,0 +1 @@
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{AF as r,Cf as i,Df as a,Ef as o,Sf as s,T as c,Tf as l,_f as u,bf as d,gf as f,hf as p,mf as m,pf as h,vf as g,wf as _,xF as v,xf as y,yf as b}from"./dist-CAP0mn60.js";import{C as x,S,T as C,rt as w,w as T,x as E}from"./index-DcPINOh1.js";var D=t(e(),1);function O(e){return e===`user`?u():e===`all`?f():p({group:e.group})}function k(e){return e===`common`?m():e===`owner`?h():p({group:e.group})}var A=n();function j(e){return e.name||e.email||e.userId.slice(0,8)}function M(){let e=r(c.admin.listUsers,{}),[t,n]=(0,D.useState)(``),u=r(c.introspect.introspectUser,t?{userId:t}:`skip`);return(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:a()}),(0,A.jsxs)(E,{value:t,onValueChange:n,children:[(0,A.jsx)(T,{size:`sm`,"aria-label":o(),children:(0,A.jsx)(C,{placeholder:o()})}),(0,A.jsx)(S,{children:(e??[]).map(e=>(0,A.jsx)(x,{value:e.userId,children:j(e)},e._id))})]}),t===``?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:l()}):u===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:_()}),(0,A.jsxs)(`div`,{className:`oc-introspect__id`,children:[(0,A.jsx)(`strong`,{children:u.user.label}),(0,A.jsx)(w,{variant:`secondary`,children:u.role})]})]}),(0,A.jsxs)(`section`,{className:`oc-introspect__section`,children:[(0,A.jsx)(`h3`,{className:`oc-introspect__title`,children:i()}),u.groups.length===0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:b()}):(0,A.jsx)(`div`,{className:`oc-introspect__chips`,children:u.groups.map(e=>(0,A.jsx)(w,{variant:`secondary`,children:e.name},e.groupId))})]}),(0,A.jsxs)(`section`,{className:`oc-introspect__section`,children:[(0,A.jsx)(`h3`,{className:`oc-introspect__title`,children:s()}),u.agents.length===0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:b()}):(0,A.jsx)(`ul`,{className:`oc-introspect__list`,children:u.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)(w,{variant:`default`,children:g()}):null,(0,A.jsx)(w,{variant:`outline`,children:O(e.via)}),(0,A.jsx)(w,{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:y()}),u.charts.length===0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:b()}):(0,A.jsx)(`ul`,{className:`oc-introspect__list`,children:u.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)(w,{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:d()}),u.permissions.length===0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:b()}):(0,A.jsx)(`div`,{className:`oc-introspect__chips`,children:u.permissions.map(e=>(0,A.jsx)(w,{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{Am as r,Dm as i,Em as a,Om as o,Tm as s,km as c,wm as l}from"./dist-B1qnlN7I.js";import{i as u}from"./dist-CRven8ef.js";import{t as d}from"./x-8-3cz0V6.js";import{t as f}from"./button-BCAsV4-2.js";import{Bt as p,C as m,S as h,T as g,it as _,w as v,x as y}from"./index-rCasMjHB.js";import{r as b}from"./TimeRangePicker-fvvxJ7HC.js";var x=t(e(),1),S=n(),C=[{value:`eq`,label:`=`},{value:`neq`,label:`≠`},{value:`contains`,label:r()},{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 r=(0,x.useRef)(t),w=!!(r.current&&r.current.length>0),[D,O]=(0,x.useState)(w),[k,A]=(0,x.useState)(()=>w?E(r.current):[]);function j(e){n(e.filter(e=>e.field!==``&&e.value!==``).map(e=>({field:e.field,op:e.op,value:b(e.value)})))}function M(e,t){let n=k.map(n=>n.id===e?{...n,...t}:n);A(n),j(n)}function N(){A(e=>[...e,T()])}function P(e){let t=k.filter(t=>t.id!==e);A(t),j(t)}let F=k.filter(e=>e.field!==``&&e.value!==``).length;return(0,S.jsxs)(`div`,{className:`oc-advfilter`,children:[(0,S.jsxs)(`button`,{type:`button`,className:`oc-advfilter__toggle`,"aria-expanded":D,onClick:()=>O(e=>!e),children:[(0,S.jsx)(u,{className:`oc-advfilter__chevron`+(D?` is-open`:``),"aria-hidden":!0}),c(),F>0?(0,S.jsx)(`span`,{className:`oc-advfilter__count`,children:F}):null]}),D?(0,S.jsxs)(`div`,{className:`oc-advfilter__body`,children:[k.length===0?(0,S.jsx)(`p`,{className:`oc-admin__hint`,children:o()}):(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)(v,{size:`sm`,className:`w-40`,children:(0,S.jsx)(g,{placeholder:i()})}),(0,S.jsx)(h,{children:e.map(e=>(0,S.jsx)(m,{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)(v,{size:`sm`,className:`w-28`,children:(0,S.jsx)(g,{})}),(0,S.jsx)(h,{children:C.map(e=>(0,S.jsx)(m,{value:e.value,children:e.label},e.value))})]}),(0,S.jsx)(_,{className:`oc-advfilter__value`,value:t.value,onChange:e=>M(t.id,{value:e.target.value}),placeholder:a()}),(0,S.jsx)(f,{variant:`ghost`,size:`icon-sm`,"aria-label":s(),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)(p,{}),l()]})]}):null]})}export{D as t};
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Bm as r,Fm as i,Im as a,Lm as o,Pm as s,Rm as c,zm as l}from"./dist-CAP0mn60.js";import{i as u}from"./dist-3KrBDl5H.js";import{t as d}from"./x-ChVRoy_h.js";import{t as f}from"./button-DRguy6Hz.js";import{Bt as p,C as m,S as h,T as g,it as _,w as v,x as y}from"./index-DcPINOh1.js";import{r as b}from"./TimeRangePicker-DGb-YJj5.js";var x=t(e(),1),S=n(),C=[{value:`eq`,label:`=`},{value:`neq`,label:`≠`},{value:`contains`,label:r()},{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 r=(0,x.useRef)(t),w=!!(r.current&&r.current.length>0),[D,O]=(0,x.useState)(w),[k,A]=(0,x.useState)(()=>w?E(r.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}),l(),F>0?(0,S.jsx)(`span`,{className:`oc-advfilter__count`,children:F}):null]}),D?(0,S.jsxs)(`div`,{className:`oc-advfilter__body`,children:[k.length===0?(0,S.jsx)(`p`,{className:`oc-admin__hint`,children: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)(v,{size:`sm`,className:`w-40`,children:(0,S.jsx)(g,{placeholder:o()})}),(0,S.jsx)(h,{children:e.map(e=>(0,S.jsx)(m,{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)(v,{size:`sm`,className:`w-28`,children:(0,S.jsx)(g,{})}),(0,S.jsx)(h,{children:C.map(e=>(0,S.jsx)(m,{value:e.value,children:e.label},e.value))})]}),(0,S.jsx)(_,{className:`oc-advfilter__value`,value:t.value,onChange:e=>M(t.id,{value:e.target.value}),placeholder:a()}),(0,S.jsx)(f,{variant:`ghost`,size:`icon-sm`,"aria-label":i(),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)(p,{}),s()]})]}):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{$i as r,$l as i,AF as a,Ai as o,Bl as s,CF as c,DF as l,Fi as u,Fl as d,Gi as f,Gl as p,Gu as m,Hl as h,Ii as g,Il as _,Ji as v,Jl as y,Ki as b,Kl as x,Ll as S,Mi as C,Ni as w,Nl as T,Pi as E,Pl as D,Qi as O,Ql as k,Rl as A,T as j,Ui as M,Ul as N,Uu as ee,Vl as te,Wi as P,Wl as F,Xi as I,Xl as ne,Yi as L,Yl as R,Zi as z,Zl as B,aa as re,au as ie,ca as V,cu as ae,ea as H,eu as U,ia as W,iu as oe,ji as se,kF as ce,la as le,na as ue,nu as de,oa as fe,ou as pe,qi as me,ql as he,ra as ge,ru as _e,sa as ve,su as ye,ta as be,tu as xe,xF as G,xO as Se,zl as Ce}from"./dist-CAP0mn60.js";import{t as K}from"./button-DRguy6Hz.js";import{B as we,C as Te,H as Ee,L as De,Pt as q,R as Oe,S as ke,T as Ae,U as je,V as Me,W as Ne,at as Pe,b as Fe,gt as Ie,lt as Le,ot as Re,rt as ze,st as Be,ut as Ve,w as He,wt as J,x as Ue,z as We}from"./index-DcPINOh1.js";import{n as Ge,t as Ke}from"./curation-CQksaIbm.js";import{i as qe}from"./compatView-BHorgRif.js";/* empty css */var Y=t(e(),1),X=2e4,Je=6e4;function Ye(e){return typeof e!=`number`||e<=0?0:Math.round(e/X*100)}function Xe(e){return e<=0?0:Math.round(e/Je*100)}function Z(e,t){let n=(typeof e==`number`&&e>0?e:0)/1e3;return new Intl.NumberFormat(t,{minimumFractionDigits:1,maximumFractionDigits:1}).format(n)}function Ze(e){return e.reduce((e,t)=>e+(typeof t.size==`number`&&t.size>0?t.size:0),0)}var Qe=3;function $e(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<Qe&&a.push(e)):t>0&&(i+=t,o.length<Qe&&o.push(e));return{added:r,removed:i,sampleAdded:a,sampleRemoved:o}}function et(e){return e instanceof Error?e.message.includes(`conflict:`):String(e).includes(`conflict:`)}var Q=n(),$=e=>`${e.instanceName}::${e.agentId}`;function tt(){let e=a(j.me.getMe,{host:Ie}),t=e?.role===`admin`,n=(e?.permissions??[]).includes(`bridge.read`),r=a(j.admin.listInstances,e!==void 0&&t?{}:`skip`),[o,s]=(0,Y.useState)(null);(0,Y.useEffect)(()=>{!t||!r||r.length===0||(!o||!r.some(e=>e.name===o))&&s(r[0].name)},[t,r,o]);let u=a(j.agents.listAgentsForInstance,t&&o?{instanceName:o}:`skip`),d=a(j.agents.listMyAgents,e!==void 0&&!t?{}:`skip`),f=(0,Y.useMemo)(()=>{if(e!==void 0){if(t)return o===null||u===void 0?r!==void 0&&r.length===0?[]:void 0:u.agents.map(e=>({instanceName:o,agentId:e.agentId,label:`${e.emoji?`${e.emoji} `:``}${e.displayName??e.agentId}`}));if(d!==void 0)return d.map(e=>({instanceName:e.instanceName,agentId:e.agentId,label:`${e.emoji?`${e.emoji} `:``}${e.displayName??e.agentId}`}))}},[e,t,o,u,r,d]),[p,m]=(0,Y.useState)(null);(0,Y.useEffect)(()=>{!f||f.length===0||(!p||!f.some(e=>$(e)===p))&&m($(f[0]))},[f,p]);let h=f?.find(e=>$(e)===p)??null,g=l(j.agentFiles.listAgentFiles),[_,v]=(0,Y.useState)({status:`idle`}),y=h?.instanceName??null,b=h?.agentId??null,x=a(j.compat.forInstance,n&&y!==null?{instanceName:y}:`skip`),S=n&&y!==null?Fe(x,`agentFiles`):null,C=S===null?!1:S===`loading`?null:S.blocked,w=(0,Y.useCallback)(async()=>{if(!(y===null||b===null)){v({status:`loading`});try{v({status:`done`,files:(await g({instanceName:y,agentId:b})).files})}catch{v({status:`error`})}}},[g,y,b]);(0,Y.useEffect)(()=>{C===!1&&w()},[w,C]);let[T,E]=(0,Y.useState)(null),D=a(j.agentFileCuration.listCurations,t&&y!==null&&b!==null?{instanceName:y,agentId:b}:`skip`),O=a(j.agentFileCuration.curationSettings,t&&y!==null?{instanceName:y}:`skip`),A=l(j.agentFileCuration.requestCuration),[M,N]=(0,Y.useState)(null),[te,P]=(0,Y.useState)(null),{toast:F}=J(),I=(0,Y.useMemo)(()=>{let e=new Map;for(let t of D??[])e.has(t.name)||e.set(t.name,t);return e},[D]),L=(0,Y.useCallback)(async e=>{if(!(y===null||b===null)){N(e);try{let t=await A({instanceName:y,agentId:b,name:e,trigger:`manual`});t.ok?F({title:fe(),variant:`success`}):F({title:re({reason:t.reason??`unknown`}),variant:`error`})}catch{F({title:W(),variant:`error`})}finally{N(null)}}},[A,y,b,F]),R=c(),z=(0,Y.useMemo)(()=>new Intl.NumberFormat(R,{maximumFractionDigits:0}),[R]);return e===void 0||f===void 0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:G()}):(0,Q.jsxs)(`div`,{className:`oc-afiles`,children:[(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:ae()}),(0,Q.jsxs)(`div`,{className:`oc-afiles__picker`,children:[t&&(r?.length??0)>1?(0,Q.jsxs)(Ue,{value:o??``,onValueChange:e=>s(e),children:[(0,Q.jsx)(He,{size:`sm`,"aria-label":ye(),children:(0,Q.jsx)(Ae,{})}),(0,Q.jsx)(ke,{children:(r??[]).map(e=>(0,Q.jsx)(Te,{value:e.name,children:e.name},e.name))})]}):null,f.length>0?(0,Q.jsxs)(Ue,{value:p??``,onValueChange:e=>m(e),children:[(0,Q.jsx)(He,{size:`sm`,"aria-label":pe(),children:(0,Q.jsx)(Ae,{})}),(0,Q.jsx)(ke,{children:f.map(e=>(0,Q.jsx)(Te,{value:$(e),children:e.label},$(e)))})]}):(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:ie()})]}),h===null?null:S===`loading`?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:G()}):S!==null&&S.blocked?(0,Q.jsxs)(`p`,{className:`oc-compat__blocked`,role:`status`,children:[(0,Q.jsx)(q,{size:14,"aria-hidden":!0}),` `,qe(S.gatewayVersion,S.provider)]}):_.status===`loading`||_.status===`idle`?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:G()}):_.status===`error`?(0,Q.jsxs)(`p`,{className:`oc-afiles__error`,role:`alert`,children:[_e(),` `,(0,Q.jsx)(K,{variant:`outline`,size:`sm`,onClick:()=>void w(),children:ee()})]}):_.files.length===0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:oe()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`div`,{className:`oc-afiles__list`,children:_.files.map(e=>{let n=Ye(e.size),r=n>=80;return(0,Q.jsxs)(`div`,{className:`oc-afiles__row`,children:[(0,Q.jsx)(`span`,{className:`oc-afiles__name`,title:e.name,children:e.name}),e.missing?(0,Q.jsx)(ze,{variant:`outline`,children:de()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`span`,{className:`oc-afiles__size`,children:xe({size:Z(e.size,R)})}),(0,Q.jsx)(`span`,{className:`oc-afiles__gauge${r?` is-warn`:``}`,"aria-hidden":!0,children:(0,Q.jsx)(`span`,{className:`oc-afiles__gauge-fill`,style:{width:`${Math.min(n,100)}%`}})}),(0,Q.jsx)(`span`,{className:`oc-afiles__pct`,children:U({pct:z.format(n)})}),r?(0,Q.jsx)(q,{size:14,className:`oc-afiles__warn`,"aria-label":i()}):(0,Q.jsx)(`span`,{className:`oc-afiles__warn-slot`,"aria-hidden":!0})]}),(0,Q.jsx)(K,{variant:`outline`,size:`sm`,className:`oc-afiles__open`,onClick:()=>E(e),children:t?B():ne()}),t&&!e.missing?(0,Q.jsx)(nt,{curatable:Ke.includes(e.name),size:e.size??0,budget:O?.budgetChars??null,enabled:O?.enabled??!1,curation:I.get(e.name)??null,inFlight:M===e.name,onCurate:()=>void L(e.name),onReview:e=>P(e)}):null]},e.name)})}),(0,Q.jsx)(`p`,{className:`oc-afiles__budget`,children:k({used:Z(Ze(_.files),R),total:Z(Je,R),pct:z.format(Xe(Ze(_.files)))})})]}),T&&h?(0,Q.jsx)(rt,{instanceName:h.instanceName,agentId:h.agentId,name:T.name,isAdmin:t,onClose:()=>E(null),onSaved:()=>void w()}):null,te?(0,Q.jsx)(it,{curationId:te,onClose:()=>P(null),onApplied:()=>{P(null),w()}}):null]})}function nt({curatable:e,size:t,budget:n,enabled:r,curation:i,inFlight:a,onCurate:o,onReview:s}){return i?.status===`proposed`?(0,Q.jsx)(K,{variant:`default`,size:`sm`,className:`oc-afiles__curate`,onClick:()=>s(i._id),children:V()}):a||i?.status===`dispatched`||i?.status===`applying`?(0,Q.jsx)(ze,{variant:`outline`,className:`oc-afiles__curate-status`,children:ve()}):e&&r&&n!==null&&Ge(t,n)?(0,Q.jsx)(K,{variant:`outline`,size:`sm`,className:`oc-afiles__curate`,onClick:o,children:le()}):null}function rt({instanceName:e,agentId:t,name:n,isAdmin:r,onClose:i,onSaved:a}){let o=l(j.agentFiles.getAgentFile),u=l(j.agentFiles.setAgentFile),f=J(),[g,v]=(0,Y.useState)(null),[b,C]=(0,Y.useState)(!1),[w,E]=(0,Y.useState)(``),[O,k]=(0,Y.useState)(!1),[M,P]=(0,Y.useState)(!1),[I,ne]=(0,Y.useState)(!1),[L,z]=(0,Y.useState)(!1),B=(0,Y.useCallback)(async r=>{C(!1);try{let i=await o({instanceName:e,agentId:t,name:n});v({content:i.content,updatedAtMs:i.updatedAtMs}),r||E(i.content),ne(!1)}catch{C(!0)}},[o,e,t,n]);(0,Y.useEffect)(()=>{B(!1)},[B]);async function re(){if(g!==null){P(!0),z(!1);try{await u({instanceName:e,agentId:t,name:n,content:w,baseUpdatedAtMs:g.updatedAtMs??void 0}),f.success(N({name:n})),a(),await B(!1)}catch(e){et(e)?ne(!0):z(!0)}finally{P(!1)}}}let ie=g!==null&&w!==g.content,V=(0,Y.useMemo)(()=>g===null?null:$e(g.content,w),[g,w]),ae=w.length>X,H=c(),U=(0,Y.useMemo)(()=>new Intl.NumberFormat(H),[H]);return(0,Q.jsx)(Pe,{open:!0,onOpenChange:e=>!e&&i(),children:(0,Q.jsxs)(Re,{className:`oc-afiles__editor`,children:[(0,Q.jsxs)(Le,{children:[(0,Q.jsx)(Ve,{children:R({name:n})}),(0,Q.jsxs)(Be,{children:[y({agent:t,instance:e}),r?null:(0,Q.jsxs)(Q.Fragment,{children:[` · `,he()]})]})]}),b?(0,Q.jsxs)(`p`,{className:`oc-afiles__error`,role:`alert`,children:[te(),` `,(0,Q.jsx)(K,{variant:`outline`,size:`sm`,onClick:()=>void B(!1),children:ee()})]}):g===null?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:G()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`textarea`,{className:`oc-afiles__source`,value:w,readOnly:!r,spellCheck:!1,onChange:e=>E(e.target.value),"aria-label":R({name:n})}),(0,Q.jsx)(`p`,{className:`oc-afiles__hint`,children:x()}),I?(0,Q.jsxs)(`p`,{className:`oc-afiles__error`,role:`alert`,children:[s(),` `,(0,Q.jsx)(K,{variant:`outline`,size:`sm`,onClick:()=>void B(!0),children:Ce()})]}):null,L?(0,Q.jsx)(`p`,{className:`oc-afiles__error`,role:`alert`,children:h()}):null,(0,Q.jsxs)(`div`,{className:`oc-afiles__editor-foot`,children:[(0,Q.jsx)(`span`,{className:`oc-afiles__count${ae?` is-over`:``}`,children:p({count:U.format(w.length),max:U.format(X)})}),r?(0,Q.jsx)(K,{size:`sm`,disabled:!ie||M||I,onClick:()=>k(!0),children:M?m():F()}):null]})]}),(0,Q.jsx)(De,{open:O,onOpenChange:k,children:(0,Q.jsxs)(we,{children:[(0,Q.jsxs)(je,{children:[(0,Q.jsx)(Ne,{children:A({name:n})}),(0,Q.jsx)(Me,{children:S({agent:t})})]}),V?(0,Q.jsxs)(`div`,{className:`oc-afiles__diff`,children:[(0,Q.jsx)(`p`,{className:`oc-afiles__diff-counts`,children:_({added:V.added,removed:V.removed})}),V.sampleAdded.length>0?(0,Q.jsxs)(`div`,{className:`oc-afiles__diff-block`,children:[(0,Q.jsx)(`span`,{className:`oc-afiles__diff-label`,children:d()}),V.sampleAdded.map((e,t)=>(0,Q.jsx)(`code`,{className:`oc-afiles__diff-line is-add`,children:e||` `},t))]}):null,V.sampleRemoved.length>0?(0,Q.jsxs)(`div`,{className:`oc-afiles__diff-block`,children:[(0,Q.jsx)(`span`,{className:`oc-afiles__diff-label`,children:D()}),V.sampleRemoved.map((e,t)=>(0,Q.jsx)(`code`,{className:`oc-afiles__diff-line is-del`,children:e||` `},t))]}):null]}):null,(0,Q.jsxs)(Ee,{children:[(0,Q.jsx)(We,{children:Se()}),(0,Q.jsx)(Oe,{onClick:()=>void re(),children:T()})]})]})})]})})}function it({curationId:e,onClose:t,onApplied:n}){let i=a(j.agentFileCuration.getProposal,{curationId:e}),s=l(j.agentFileCuration.approveCuration),d=ce(j.agentFileCuration.rejectCuration),{toast:p}=J(),[h,_]=(0,Y.useState)(null),[y,x]=(0,Y.useState)(!1),[S,T]=(0,Y.useState)(``),D=c(),k=(0,Y.useMemo)(()=>i?$e(i.beforeContent,i.proposedContent):null,[i]);async function A(){_(`approve`);try{let t=await s({curationId:e});t.ok?(p({title:ge(),variant:`success`}),n()):p({title:t.reason===`conflict`?be():H({reason:t.reason??`unknown`}),variant:`error`})}catch{p({title:W(),variant:`error`})}finally{_(null)}}async function N(n){_(`reject`);try{let r=S.trim();(await d({curationId:e,...r?{comment:r}:{},relaunch:n})).ok?p({title:n?se():ue(),variant:`success`}):p({title:z(),variant:`error`}),t()}catch{p({title:W(),variant:`error`})}finally{_(null)}}return(0,Q.jsx)(Pe,{open:!0,onOpenChange:e=>e?void 0:t(),children:(0,Q.jsxs)(Re,{className:`oc-afiles__review`,children:[(0,Q.jsxs)(Le,{children:[(0,Q.jsx)(Ve,{children:i?r({name:i.name}):G()}),(0,Q.jsx)(Be,{children:O()})]}),i===void 0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:G()}):i===null?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:z()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`p`,{className:`oc-afiles__review-sizes`,children:[I({before:Z(i.beforeSize,D),after:Z(i.proposedSize,D)}),i.overBudget?(0,Q.jsxs)(Q.Fragment,{children:[` `,(0,Q.jsx)(q,{size:13,"aria-hidden":!0}),` `,L()]}):null]}),k?(0,Q.jsx)(`p`,{className:`oc-afiles__review-diff`,children:v({added:k.added,removed:k.removed})}):null,i.feedback?(0,Q.jsx)(`p`,{className:`oc-afiles__review-feedback`,children:o({feedback:i.feedback})}):null,k&&k.sampleRemoved.length>0?(0,Q.jsxs)(`div`,{className:`oc-afiles__review-removed`,children:[(0,Q.jsx)(`p`,{className:`oc-afiles__review-label`,children:M()}),(0,Q.jsx)(`ul`,{children:k.sampleRemoved.map((e,t)=>(0,Q.jsx)(`li`,{children:e||`\xA0`},t))})]}):null,(0,Q.jsxs)(`div`,{className:`oc-afiles__review-panes oc-afiles__review-panes--2`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`p`,{className:`oc-afiles__review-label`,children:P()}),(0,Q.jsx)(`pre`,{className:`oc-afiles__review-pre`,children:i.beforeContent})]}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`p`,{className:`oc-afiles__review-label`,children:me()}),(0,Q.jsx)(`pre`,{className:`oc-afiles__review-pre`,children:i.proposedContent})]})]})]}),y?(0,Q.jsxs)(`div`,{className:`oc-afiles__reject-form`,children:[(0,Q.jsx)(`label`,{className:`oc-afiles__review-label`,htmlFor:`curation-reject-comment`,children:g()}),(0,Q.jsx)(`textarea`,{id:`curation-reject-comment`,className:`oc-afiles__reject-textarea`,rows:3,placeholder:u(),value:S,onChange:e=>T(e.target.value)}),(0,Q.jsxs)(`div`,{className:`oc-afiles__review-actions`,children:[(0,Q.jsx)(K,{variant:`ghost`,onClick:()=>x(!1),disabled:h!==null,children:E()}),(0,Q.jsx)(K,{variant:`outline`,onClick:()=>void N(!1),disabled:h!==null,children:h===`reject`?m():w()}),(0,Q.jsx)(K,{variant:`default`,onClick:()=>void N(!0),disabled:h!==null,children:h===`reject`?m():C()})]})]}):(0,Q.jsxs)(`div`,{className:`oc-afiles__review-actions`,children:[(0,Q.jsx)(K,{variant:`outline`,onClick:()=>x(!0),disabled:h!==null||i==null,children:b()}),(0,Q.jsx)(K,{variant:`default`,onClick:()=>void A(),disabled:h!==null||i==null,children:h===`approve`?m():f()})]})]})})}export{tt as AgentFilesTab};
@@ -0,0 +1 @@
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{AF as r,Ab as i,Bb as ee,Cb as a,Db as o,Eb as te,Fb as ne,Gb as re,Hb as ie,Ib as ae,Jb as s,Kb as oe,Lb as se,Mb as c,Nb as l,Ob as u,Pb as d,Rb as f,Sb as ce,T as p,Tb as m,Ub as le,Vb as ue,Wb as de,Xb as h,Yb as g,_b as fe,ab as _,bb as pe,cb as v,db as y,fb as me,gb as he,hb as ge,ib as b,jb as _e,kF as ve,kb as ye,lb as x,mb as S,ob as C,pb as w,qb as T,sb as E,ub as D,vb as O,wb as k,xb as A,yb as j,zb as M}from"./dist-CAP0mn60.js";import{C as N,F as P,S as F,T as I,Y as be,at as L,gt as xe,i as Se,in as Ce,lt as R,o as we,ot as z,rn as B,rt as V,ut as H,w as U,wt as Te,x as W}from"./index-DcPINOh1.js";import{n as Ee}from"./TimeRangePicker-DGb-YJj5.js";import{t as De}from"./FilterBar-XGMlTH00.js";import{t as Oe}from"./DataTableShell-Bo9JdV4-.js";import{t as G}from"./dispatchErrorInfo-CJWXIZnL.js";var K=t(e(),1),q=n(),J=`__all__`,ke=[{value:`open`},{value:`acknowledged`},{value:`resolved`}];function Ae(e){return e===`open`?h():e===`acknowledged`?g():s()}var je=[`info`,`warn`,`critical`],Me=[`detector`,`agent`,`user`],Ne={kind:`relative`,from:`now-30d`,to:`now`},Pe=200,Y=`all`;function X(){let e=Ce({from:`/settings/anomalies`}),t=B({from:`/settings/anomalies`}),n=e.q??``,s=e.status===Y?J:e.status,h=e.severity??J,g=e.kind??J,[_,v]=(0,K.useState)(J),y=Se(e.from,e.to),{from:b,to:x}=Ee(y),C=e=>void t({search:t=>({...t,q:e||void 0}),replace:!0}),E=e=>void t({search:t=>({...t,status:e===J?Y:e})}),D=e=>void t({search:t=>({...t,severity:e===J?void 0:e})}),L=e=>void t({search:t=>({...t,kind:e===J?void 0:e})}),R=e=>void t({search:t=>({...t,...we(e)})}),z=P(),H=Te(),G=ve(p.anomalies.resolveAnomaly),X=(r(p.me.getMe,{host:xe})?.permissions??[]).includes(`admin.manage`),Z=r(p.anomalies.listAnomalies,{limit:Pe,filter:{q:n||void 0,from:b,to:x,anomalyStatus:s===J?void 0:s,severity:h===J?void 0:h,source:_===J?void 0:_,kind:g===J?void 0:g}}),Q=(0,K.useMemo)(()=>{let e=new Set;for(let t of Z??[])e.add(t.kind);return[...e].sort()},[Z]),ze=n!==``||s!==`open`||h!==J||_!==J||g!==J||y.kind!==`relative`||y.from!==Ne.from;function Be(){v(J),t({search:{status:`open`},replace:!0})}async function Ve(e){if(await z({title:T(),description:(0,q.jsxs)(q.Fragment,{children:[oe(),` `,(0,q.jsx)(`span`,{className:`font-mono`,children:e.kind}),` `,re(),` `,(0,q.jsx)(`strong`,{children:de()}),`.`,` `,le()]}),confirmLabel:ie()}))try{await G({anomalyId:e._id,status:`resolved`}),H.success(ue(),e.kind)}catch(e){H.error(ee(),e)}}async function He(e){try{await G({anomalyId:e._id,status:`acknowledged`}),H.success(M(),e.kind)}catch(e){H.error(f(),e)}}return(0,q.jsxs)(q.Fragment,{children:[(0,q.jsxs)(`p`,{className:`oc-admin__hint`,children:[se(),` `,(0,q.jsx)(`strong`,{children:ae()}),` `,ne(),` `,(0,q.jsx)(`strong`,{children:d()}),` `,l(),` `,(0,q.jsx)(`strong`,{children:c()}),` `,_e(),` `,(0,q.jsx)(`span`,{className:`oc-filter__window`,children:i()})]}),(0,q.jsxs)(De,{q:n,onQChange:C,searchPlaceholder:ye(),timeRange:y,onTimeRangeChange:R,onReset:Be,canReset:ze,children:[(0,q.jsxs)(W,{value:s,onValueChange:E,children:[(0,q.jsx)(U,{size:`sm`,className:`w-36`,children:(0,q.jsx)(I,{})}),(0,q.jsxs)(F,{children:[(0,q.jsx)(N,{value:J,children:u()}),ke.map(e=>(0,q.jsx)(N,{value:e.value,children:Ae(e.value)},e.value))]})]}),(0,q.jsxs)(W,{value:h,onValueChange:D,children:[(0,q.jsx)(U,{size:`sm`,className:`w-36`,children:(0,q.jsx)(I,{placeholder:o()})}),(0,q.jsxs)(F,{children:[(0,q.jsx)(N,{value:J,children:te()}),je.map(e=>(0,q.jsx)(N,{value:e,children:e},e))]})]}),(0,q.jsxs)(W,{value:_,onValueChange:v,children:[(0,q.jsx)(U,{size:`sm`,className:`w-32`,children:(0,q.jsx)(I,{placeholder:m()})}),(0,q.jsxs)(F,{children:[(0,q.jsx)(N,{value:J,children:k()}),Me.map(e=>(0,q.jsx)(N,{value:e,children:e},e))]})]}),(0,q.jsxs)(W,{value:g,onValueChange:L,children:[(0,q.jsx)(U,{size:`sm`,className:`w-36`,children:(0,q.jsx)(I,{placeholder:a()})}),(0,q.jsxs)(F,{children:[(0,q.jsx)(N,{value:J,children:ce()}),Q.map(e=>(0,q.jsx)(N,{value:e,children:e},e))]})]})]}),(0,q.jsx)(Oe,{title:A(),rows:Z,emptyHint:s===`open`?pe():j(),rowActions:e=>X&&e.status===`open`?[{label:O(),onSelect:()=>void Ve(e)},{label:fe(),onSelect:()=>void He(e)}]:[],columns:[{header:he(),cell:e=>(0,q.jsx)(`span`,{className:`oc-traces__time`,children:be(e.at)}),sort:e=>e.at},{header:a(),cell:e=>(0,q.jsx)(`code`,{className:`oc-traces__mono`,children:e.kind}),sort:e=>e.kind},{header:o(),cell:e=>(0,q.jsx)(Le,{severity:e.severity}),sort:e=>e.severity===`critical`?2:+(e.severity===`warn`)},{header:ge(),cell:e=>(0,q.jsx)($,{status:e.status}),sort:e=>e.status===`resolved`?2:+(e.status===`acknowledged`)},{header:m(),cell:e=>(0,q.jsx)(V,{variant:`outline`,children:e.source}),sort:e=>e.source},{header:S(),cell:e=>(0,q.jsxs)(`div`,{className:`oc-anomaly__msgcell`,children:[(0,q.jsx)(`span`,{className:`oc-anomaly__msg`,children:e.message}),(0,q.jsx)(Ie,{row:e})]}),sort:e=>e.message},{header:w(),cell:e=>(0,q.jsx)(Fe,{row:e}),sort:e=>e.evidence??null},{header:me(),cell:e=>e.correlationId?(0,q.jsx)(`code`,{className:`oc-traces__mono`,children:Re(e.correlationId)}):(0,q.jsx)(`span`,{className:`oc-traces__muted`,children:`—`}),sort:e=>e.correlationId}]})]})}function Z(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 Q(e){if(e.kind!==`subagent.failure`||!e.evidence)return{};try{let t=JSON.parse(e.evidence);return{failedCount:t.failedCount,totalCount:t.totalCount,errorCategories:t.errorCategories}}catch{return{}}}function Fe({row:e}){let t=B();if(e.kind===`subagent.failure`){let n=Q(e);return(0,q.jsxs)(`div`,{className:`oc-anomaly__cause`,children:[(0,q.jsx)(`div`,{className:`oc-anomaly__cause-head`,children:[...new Set(n.errorCategories??[])].map(e=>(0,q.jsx)(`code`,{className:`oc-traces__mono`,children:e},e))}),e.correlationId?(0,q.jsxs)(`button`,{type:`button`,className:`oc-anomaly__drill`,onClick:()=>void t({to:`/settings/traces`,search:{q:e.correlationId,limit:100}}),children:[`↗ `,y()]}):null]})}let n=Z(e);if(!n.dominantCode)return(0,q.jsx)(`span`,{className:`oc-traces__muted`,children:`—`});let r=G(n.dominantCode),i=n.sampleCorrelationId;return(0,q.jsxs)(`div`,{className:`oc-anomaly__cause`,children:[(0,q.jsxs)(`div`,{className:`oc-anomaly__cause-head`,children:[(0,q.jsx)(`span`,{className:`oc-anomaly__cause-label`,children:r.label}),(0,q.jsx)(`code`,{className:`oc-traces__mono`,children:n.dominantCode})]}),(0,q.jsx)(`p`,{className:`oc-anomaly__cause-hint`,children:r.hint}),i?(0,q.jsxs)(`button`,{type:`button`,className:`oc-anomaly__drill`,onClick:()=>void t({to:`/settings/traces`,search:{q:i,limit:100}}),children:[`↗ `,y()]}):null]})}function Ie({row:e}){let[t,n]=(0,K.useState)(!1),i=r(p.anomalies.getAnomalyAttachments,t?{anomalyId:e._id}:`skip`);return!e.attachments||e.attachments.length===0?null:(0,q.jsxs)(q.Fragment,{children:[(0,q.jsxs)(`button`,{type:`button`,className:`oc-anomaly__drill`,onClick:()=>n(!0),children:[D(),e.attachments.length>1?` (${e.attachments.length})`:``]}),(0,q.jsx)(L,{open:t,onOpenChange:n,children:(0,q.jsxs)(z,{className:`oc-anomaly__attachments-dialog`,children:[(0,q.jsx)(R,{children:(0,q.jsx)(H,{children:x()})}),i===void 0?(0,q.jsx)(`p`,{className:`oc-traces__muted`,children:v()}):i.length===0?(0,q.jsx)(`p`,{className:`oc-traces__muted`,children:E()}):(0,q.jsx)(`div`,{className:`oc-anomaly__attachments`,children:i.map(e=>(0,q.jsxs)(`section`,{className:`oc-anomaly__attachment`,children:[(0,q.jsx)(`h4`,{className:`oc-anomaly__attachment-name`,children:(0,q.jsx)(`code`,{className:`oc-traces__mono`,children:e.name})}),(0,q.jsx)(`pre`,{className:`oc-anomaly__attachment-content`,children:e.content})]},e.name))})]})})]})}function Le({severity:e}){return(0,q.jsx)(`span`,{className:`oc-anomaly__sev oc-anomaly__sev--${e}`,children:e})}function $({status:e}){return e===`open`?(0,q.jsx)(V,{variant:`destructive`,children:C()}):e===`acknowledged`?(0,q.jsx)(V,{variant:`secondary`,children:_()}):(0,q.jsx)(V,{variant:`outline`,children:b()})}function Re(e){return e.length>8?e.slice(0,8):e}export{X as AnomaliesTab};
@@ -0,0 +1 @@
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$x as r,AF as i,Ar as a,Dr as o,Gx as s,Hx as c,Jx as l,Kx as u,Mr as d,Or as f,Qx as p,T as m,Ux as h,Vx as g,Wx as _,Xx as v,Yx as y,Zx as b,eS as x,jr as S,kr as C,qx as w,tS as T}from"./dist-CAP0mn60.js";import{C as E,S as D,T as O,Y as k,a as A,i as j,in as M,n as N,o as P,rn as F,s as I,w as L,x as R}from"./index-DcPINOh1.js";import{n as ee}from"./TimeRangePicker-DGb-YJj5.js";import{t as z}from"./FilterBar-XGMlTH00.js";import{t as B}from"./AdvancedFilter-BbljBL_5.js";import{t as V}from"./DataTableShell-Bo9JdV4-.js";var H=t(e(),1),U=n(),W={kind:`relative`,from:N,to:`now`},G=`__all__`,K=[{value:`action`,label:d()},{value:`realLabel`,label:S()},{value:`targetLabel`,label:a()},{value:`impersonated`,label:C()},{value:`resource`,label:f()},{value:`resourceId`,label:o()}];function q(){let e=M({from:`/settings/audit`}),t=F({from:`/settings/audit`}),n=e.q??``,a=e.action??G,o=e.impersonated??G,d=e.resource??G,f=j(e.from,e.to),S=(0,H.useMemo)(()=>I(e.adv),[e.adv]),{from:C,to:N}=ee(f),q=e=>void t({search:t=>({...t,q:e||void 0}),replace:!0}),J=e=>void t({search:t=>({...t,action:e===G?void 0:e})}),Y=e=>void t({search:t=>({...t,impersonated:e===G?void 0:e})}),X=e=>void t({search:t=>({...t,resource:e===G?void 0:e})}),Z=e=>void t({search:t=>({...t,...P(e)})}),Q=e=>void t({search:t=>({...t,adv:A(e)}),replace:!0}),$=i(m.admin.listAudit,{filter:{q:n||void 0,from:C,to:N,action:a===G?void 0:a,resource:d===G?void 0:d,impersonated:o===G?void 0:o===`yes`,advanced:S.length>0?S:void 0}}),te=(0,H.useMemo)(()=>{let e=new Set;for(let t of $??[])e.add(t.action);return[...e].sort()},[$]),ne=(0,H.useMemo)(()=>{let e=new Set;for(let t of $??[])t.resource&&e.add(t.resource);return[...e].sort()},[$]),re=n!==``||a!==G||o!==G||d!==G||S.length>0||f.kind!==`relative`||f.from!==W.from;function ie(){t({search:{},replace:!0})}return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(`p`,{className:`oc-admin__hint`,children:[T(),` `,(0,U.jsx)(`span`,{className:`oc-filter__window`,children:x()})]}),(0,U.jsxs)(z,{q:n,onQChange:q,searchPlaceholder:r(),timeRange:f,onTimeRangeChange:Z,onReset:ie,canReset:re,children:[(0,U.jsxs)(R,{value:a,onValueChange:J,children:[(0,U.jsx)(L,{size:`sm`,className:`w-40`,children:(0,U.jsx)(O,{placeholder:p()})}),(0,U.jsxs)(D,{children:[(0,U.jsx)(E,{value:G,children:b()}),te.map(e=>(0,U.jsx)(E,{value:e,children:e},e))]})]}),(0,U.jsxs)(R,{value:o,onValueChange:Y,children:[(0,U.jsx)(L,{size:`sm`,className:`w-40`,children:(0,U.jsx)(O,{})}),(0,U.jsxs)(D,{children:[(0,U.jsx)(E,{value:G,children:v()}),(0,U.jsx)(E,{value:`yes`,children:y()}),(0,U.jsx)(E,{value:`no`,children:l()})]})]}),(0,U.jsxs)(R,{value:d,onValueChange:X,children:[(0,U.jsx)(L,{size:`sm`,className:`w-40`,children:(0,U.jsx)(O,{placeholder:w()})}),(0,U.jsxs)(D,{children:[(0,U.jsx)(E,{value:G,children:u()}),ne.map(e=>(0,U.jsx)(E,{value:e,children:e},e))]})]})]}),(0,U.jsx)(B,{fields:K,seed:S,onChange:Q}),(0,U.jsx)(V,{title:s(),rows:$,emptyHint:_(),columns:[{header:h(),cell:e=>k(e.at),sort:e=>e.at},{header:p(),cell:e=>e.action,sort:e=>e.action},{header:c(),cell:e=>e.realLabel,sort:e=>e.realLabel},{header:g(),cell:e=>e.targetLabel??`—`,sort:e=>e.targetLabel??null},{header:w(),cell:e=>e.resource?e.resource+(e.resourceId?` · ${e.resourceId.slice(0,8)}`:``):`—`,sort:e=>e.resource??null}]})]})}export{q as AuditTab};
@@ -0,0 +1 @@
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$_ as r,$g as i,$n as a,AF as o,Ag as s,Bg as c,C_ as l,D as u,DF as d,Dg as f,Eg as p,Fg as m,G_ as ee,Gg as h,Hg as g,Ig as _,Jg as v,K_ as te,Kg as y,Lg as b,Mg as ne,Ng as re,Og as ie,Pg as ae,Q_ as oe,Qg as se,Qn as ce,Rg as le,S_ as ue,Sl as de,T as x,Ug as fe,Vg as pe,Wg as me,X_ as he,Xg as ge,Xn as _e,Y_ as ve,Yg as ye,Yn as be,Z_ as xe,Zg as Se,Zn as Ce,__ as we,_l as S,a_ as Te,av as Ee,b_ as De,bl as Oe,c_ as ke,d_ as Ae,dl as je,e_ as Me,ev as Ne,f_ as Pe,fl as Fe,g_ as Ie,gl as Le,h_ as Re,hl as ze,i_ as Be,iv as Ve,jg as He,kF as Ue,kg as We,l_ as Ge,m_ as Ke,ml as qe,n_ as Je,nr as Ye,nv as Xe,o_ as Ze,ol as Qe,p_ as $e,pl as et,qg as tt,r_ as nt,s_ as rt,t_ as C,tv as it,u_ as at,ul as ot,v_ as st,vl as ct,x_ as lt,xl as ut,y_ as dt,yl as ft,zg as pt}from"./dist-CAP0mn60.js";import{i as w,r as mt}from"./dist-3KrBDl5H.js";import{t as ht}from"./chevrons-up-down-BFfHriX4.js";import{i as gt,n as T,o as _t,r as vt,s as yt}from"./FieldLabel-DVIaWFle.js";import{i as bt,n as xt,r as St,t as Ct}from"./tabs-IFDKEY73.js";import{t as E}from"./button-DRguy6Hz.js";import{$t as D,C as O,G as wt,K as Tt,Kt as Et,Lt as k,Pt as A,S as j,T as M,X as N,Y as P,at as Dt,en as F,gt as Ot,h as kt,in as At,it as I,lt as jt,m as Mt,ot as Nt,q as Pt,rn as L,rt as R,st as Ft,ut as It,w as z,wt as Lt,x as B}from"./index-DcPINOh1.js";import{r as Rt}from"./locales-CPjguROj.js";import{a as zt,i as V,n as Bt,o as H,r as U,t as Vt}from"./table-1vsq56Zt.js";import{t as Ht}from"./FilterBar-XGMlTH00.js";import{a as Ut,n as Wt,o as Gt,r as Kt,s as qt,t as Jt}from"./compatView-BHorgRif.js";import{t as W}from"./dispatchErrorInfo-CJWXIZnL.js";var Yt=u(`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`}]]),Xt=u(`wifi-off`,[[`path`,{d:`M12 20h.01`,key:`zekei9`}],[`path`,{d:`M8.5 16.429a5 5 0 0 1 7 0`,key:`1bycff`}],[`path`,{d:`M5 12.859a10 10 0 0 1 5.17-2.69`,key:`1dl1wf`}],[`path`,{d:`M19 12.859a10 10 0 0 0-2.007-1.523`,key:`4k23kn`}],[`path`,{d:`M2 8.82a15 15 0 0 1 4.177-2.643`,key:`1grhjp`}],[`path`,{d:`M22 8.82a15 15 0 0 0-11.288-3.764`,key:`z3jwby`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}]]),G=t(e(),1);function Zt(e){return e.filter(e=>e.state===`error`)}function Qt(e){return e.reachable&&Zt(e.targets).length===0}function $t(e){return Qt(e)?(e.unreachableInstances??[]).length>0?`gateways_unreachable`:`ok`:`error`}function en(e){return e.state===`error`&&e.lastErrorCode!==null}function tn(e){return!!e.lastDownstreamRejectCode}function K(e){return e.kind??`openclaw`}function nn(e){return[...e].sort((e,t)=>e===`openclaw`?-1:t===`openclaw`?1:e.localeCompare(t))}function rn(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 nn(a).map(r=>({key:r,connections:e.filter(e=>i(e)===r),compatTargets:t.filter(e=>e.provider===r),instances:n.filter(e=>K(e)===r)}))}function q(e){return e===`openclaw`?`OpenClaw`:e===`hermes`?`Hermes`:e.charAt(0).toUpperCase()+e.slice(1)}var J=`__all__`,an={q:``,state:J,instance:J,version:J},Y={connected:0,error:1,idle:2};function on(e){return e.q.trim()!==``||e.state!==`__all__`||e.instance!==`__all__`||e.version!==`__all__`}function sn(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 cn(e,t){return e===`version`?t.gatewayVersion===null:e===`lastOk`?t.lastOkAt===null:!1}function ln(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 Gt(e,r)??X(e,r)}case`lastOk`:return t.lastOkAt-n.lastOkAt;default:return X(t.targetLabel,n.targetLabel)}}function un(e,t){if(!t)return e;let n=t.dir===`asc`?1:-1;return[...e].sort((e,r)=>{let i=cn(t.key,e),a=cn(t.key,r);return i&&a?0:i?1:a?-1:n*ln(t.key,e,r)})}function dn(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 fn(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 pn(e){let t=new Set;for(let n of e)n.gatewayVersion!==null&&t.add(n.gatewayVersion);return[...t].sort((e,t)=>Gt(e,t)??X(e,t))}var Z=n();function mn({connections:e,displayByInstance:t}){let[n,r]=(0,G.useState)(an),[i,a]=(0,G.useState)(null),o=(0,G.useMemo)(()=>e.map((e,n)=>({_id:`${e.key}:${e.canonical}/${e.agentId}:${n}`,targetLabel:`${e.canonical}/${e.agentId}`,state:e.state,instanceName:e.instanceName??null,instanceLabel:e.instanceName?t.get(e.instanceName)??e.instanceName:null,gatewayHost:e.gatewayHost,gatewayVersion:e.gatewayVersion??null,okCount:e.okCount,errorCount:e.errorCount+(e.downstreamRejectCount??0),attempts:e.attempts,lastOkAt:e.lastOkAt??null,lastErrorCode:e.lastErrorCode??null,lastErrorAt:e.lastErrorAt??null,lastDownstreamRejectCode:e.lastDownstreamRejectCode??null,lastDownstreamRejectAt:e.lastDownstreamRejectAt??null})),[e,t]),l=(0,G.useMemo)(()=>dn(o),[o]),u=(0,G.useMemo)(()=>fn(o),[o]),d=(0,G.useMemo)(()=>pn(o),[o]),f=(0,G.useMemo)(()=>un(sn(o,n),i),[o,n,i]);function p(e){a(t=>t?.key===e?t.dir===`asc`?{key:e,dir:`desc`}:null:{key:e,dir:`asc`})}return e.length===0?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:me()}):(0,Z.jsxs)(`div`,{className:`oc-conn`,children:[(0,Z.jsxs)(Ht,{q:n.q,onQChange:e=>r(t=>({...t,q:e})),searchPlaceholder:pe(),onReset:()=>r(an),canReset:on(n),children:[(0,Z.jsxs)(B,{value:n.state,onValueChange:e=>r(t=>({...t,state:e})),children:[(0,Z.jsx)(z,{size:`sm`,className:`w-36`,children:(0,Z.jsx)(M,{placeholder:pt()})}),(0,Z.jsxs)(j,{children:[(0,Z.jsx)(O,{value:J,children:c()}),l.map(e=>(0,Z.jsx)(O,{value:e,children:gn(e)},e))]})]}),(0,Z.jsxs)(B,{value:n.instance,onValueChange:e=>r(t=>({...t,instance:e})),children:[(0,Z.jsx)(z,{size:`sm`,className:`w-40`,children:(0,Z.jsx)(M,{placeholder:le()})}),(0,Z.jsxs)(j,{children:[(0,Z.jsx)(O,{value:J,children:c()}),u.map(e=>(0,Z.jsx)(O,{value:e.name,children:e.label},e.name))]})]}),(0,Z.jsxs)(B,{value:n.version,onValueChange:e=>r(t=>({...t,version:e})),children:[(0,Z.jsx)(z,{size:`sm`,className:`w-36`,children:(0,Z.jsx)(M,{placeholder:b()})}),(0,Z.jsxs)(j,{children:[(0,Z.jsx)(O,{value:J,children:c()}),d.map(e=>(0,Z.jsx)(O,{value:e,children:e},e))]})]})]}),f.length===0?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:_()}):(0,Z.jsxs)(Vt,{className:`oc-conn__table`,children:[(0,Z.jsx)(zt,{children:(0,Z.jsxs)(H,{children:[(0,Z.jsx)(Q,{label:m(),sortKey:`target`,sort:i,onSort:p}),(0,Z.jsx)(Q,{label:ae(),sortKey:`state`,sort:i,onSort:p}),(0,Z.jsx)(Q,{label:re(),sortKey:`instance`,sort:i,onSort:p}),(0,Z.jsx)(Q,{label:ne(),sortKey:`host`,sort:i,onSort:p}),(0,Z.jsx)(Q,{label:He(),sortKey:`version`,sort:i,onSort:p}),(0,Z.jsx)(V,{children:s()}),(0,Z.jsx)(Q,{label:We(),sortKey:`lastOk`,sort:i,onSort:p})]})}),(0,Z.jsx)(Bt,{children:f.map(e=>(0,Z.jsx)(hn,{r:e},e._id))})]})]})}function Q({label:e,sortKey:t,sort:n,onSort:r}){let i=n?.key===t,a=i?n.dir:null;return(0,Z.jsx)(V,{"aria-sort":i?a===`asc`?`ascending`:`descending`:`none`,children:(0,Z.jsxs)(`button`,{type:`button`,className:`oc-conn__sort`,onClick:()=>r(t),children:[e,i?a===`asc`?(0,Z.jsx)(mt,{size:13,"aria-hidden":!0}):(0,Z.jsx)(w,{size:13,"aria-hidden":!0}):(0,Z.jsx)(ht,{size:13,"aria-hidden":!0,className:`oc-conn__sort-idle`})]})})}function hn({r:e}){let t=en(e)?W(e.lastErrorCode):null,n=tn(e)?W(e.lastDownstreamRejectCode):null;return(0,Z.jsxs)(G.Fragment,{children:[(0,Z.jsxs)(H,{className:`oc-conn__row oc-conn__row--${e.state}`,children:[(0,Z.jsx)(U,{children:(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:e.targetLabel})}),(0,Z.jsx)(U,{children:(0,Z.jsx)(_n,{state:e.state})}),(0,Z.jsx)(U,{children:e.instanceLabel?(0,Z.jsx)(`span`,{className:`oc-bridge-target__instance`,children:e.instanceLabel}):(0,Z.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})}),(0,Z.jsx)(U,{children:(0,Z.jsx)(`span`,{className:`oc-bridge-target__host`,children:e.gatewayHost})}),(0,Z.jsx)(U,{children:e.gatewayVersion?(0,Z.jsx)(`span`,{className:`oc-bridge-target__version`,children:e.gatewayVersion}):(0,Z.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})}),(0,Z.jsx)(U,{children:(0,Z.jsx)(`span`,{className:`oc-conn__stats`,children:fe({ok:e.okCount,errors:e.errorCount,attempts:e.attempts})})}),(0,Z.jsx)(U,{children:e.lastOkAt?(0,Z.jsx)(`span`,{className:`oc-traces__mono`,children:N(e.lastOkAt)}):(0,Z.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})})]}),t||n?(0,Z.jsx)(H,{className:`oc-conn__detail-row`,children:(0,Z.jsxs)(U,{colSpan:7,className:`oc-conn__detail-cell`,children:[t?(0,Z.jsxs)(`div`,{className:`oc-bridge-target__error`,children:[(0,Z.jsx)(`strong`,{children:t.label}),` `,(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:e.lastErrorCode}),e.lastErrorAt?` · ${N(e.lastErrorAt)}`:``,(0,Z.jsx)(`p`,{className:`oc-bridge-card__hint`,children:t.hint})]}):null,n?(0,Z.jsxs)(`div`,{className:`oc-bridge-target__downstream`,children:[g({label:n.label}),` `,(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:e.lastDownstreamRejectCode}),e.lastDownstreamRejectAt?` · ${N(e.lastDownstreamRejectAt)}`:``]}):null]})}):null]})}function gn(e){return e===`connected`?ie():e===`error`?f():p()}function _n({state:e}){return e===`connected`?(0,Z.jsx)(R,{variant:`secondary`,children:ie()}):e===`error`?(0,Z.jsx)(R,{variant:`destructive`,children:f()}):(0,Z.jsx)(R,{variant:`outline`,children:p()})}function vn(){return o(x.bridgeHealth.getBridgeHealth,{})}function yn(){let e=vn(),t=o(x.compat.getBridgeCompat,{}),n=o(x.me.getMe,{host:Ot})?.role===`admin`,r=o(x.admin.listInstances,n?{}:`skip`),i=o(x.agents.usageForInstances,n?{}:`skip`),s=L(),c=()=>void s({to:`/settings/anomalies`,search:{status:`open`}}),l=rn(e?e.targets:[],t?t.targets:[],r??[]),{section:u}=At({from:`/settings/bridge`}),d=L({from:`/settings/bridge`}),f=t?.compat??null,p=t===void 0?`loading`:t===null?`nodata`:`ready`,m=f!==null&&Wt(f,`hermes`)&&!l.some(e=>e.key===`hermes`);return(0,Z.jsxs)(`div`,{className:`oc-bridge`,children:[(0,Z.jsx)(bn,{health:e,compat:t,onSeeAnomalies:c}),(0,Z.jsx)(`p`,{className:`oc-admin__hint oc-bridge__caption`,children:Ge()}),i&&i.length>0?(0,Z.jsxs)(`section`,{className:`oc-bridge__usage`,children:[(0,Z.jsx)(`h3`,{className:`oc-bridge__usage-title`,children:ke()}),(0,Z.jsxs)(Vt,{children:[(0,Z.jsx)(zt,{children:(0,Z.jsxs)(H,{children:[(0,Z.jsx)(V,{children:a()}),(0,Z.jsx)(V,{children:ce()}),(0,Z.jsx)(V,{children:Ce()}),(0,Z.jsx)(V,{children:_e()}),(0,Z.jsx)(V,{children:be()})]})}),(0,Z.jsx)(Bt,{children:i.flatMap(e=>{let t=kt(e.usage,Date.now());return t?t.windows.map((t,n)=>(0,Z.jsxs)(H,{children:[(0,Z.jsx)(U,{className:`font-medium`,children:n===0?e.instanceName:``}),(0,Z.jsx)(U,{children:t.provider}),(0,Z.jsx)(U,{children:t.label}),(0,Z.jsx)(U,{children:(0,Z.jsxs)(R,{variant:t.percentLeft<=10?`destructive`:t.percentLeft<=25?`outline`:`secondary`,children:[t.percentLeft,`%`]})}),(0,Z.jsx)(U,{className:`text-muted-foreground`,children:t.resetText??`—`})]},`${e.instanceName}:${t.provider}:${t.label}`)):[]})})]})]}):null,l.length>0?(0,Z.jsxs)(Ct,{value:l.some(e=>e.key===u)?u:l[0]?.key??`openclaw`,onValueChange:e=>void d({search:{section:e},replace:!0}),children:[(0,Z.jsx)(St,{className:`w-full`,children:l.map(e=>(0,Z.jsxs)(bt,{value:e.key,className:`flex-1 gap-1.5`,children:[(0,Z.jsx)(k,{size:13,"aria-hidden":!0}),q(e.key)]},e.key))}),l.map(e=>(0,Z.jsx)(xt,{value:e.key,children:(0,Z.jsx)(xn,{providerKey:e.key,connections:e.connections,instances:e.instances,manifest:f,compatStatus:p,compatReachable:t?.reachable??!0,protocol:e.key===`openclaw`?t?.protocol??null:null})},e.key))]}):null,m?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:Qe()}):null]})}function bn({health:e,compat:t,onSeeAnomalies:n}){let r=t!=null&&t.buildVersion!=null&&t.bridgeVersion!=null&&t.buildVersion!==t.bridgeVersion,a=t?.buildRevision&&t.buildRevision!==`unknown`?t.buildRevision.slice(0,7):null,o=t&&t!==null?(0,Z.jsxs)(`span`,{className:`oc-bridge-card__ver`,children:[(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:Ut(t.bridgeVersion)}),a?(0,Z.jsxs)(Z.Fragment,{children:[` `,(0,Z.jsxs)(`code`,{className:`oc-traces__mono`,title:Oe(),children:[`(`,a,`)`]})]}):null,r?(0,Z.jsxs)(`strong`,{className:`oc-bridge-card__mismatch`,children:[` `,ft({build:t.buildVersion??`?`})]}):null,` · `,ct(),` `,(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:t.protocolVersion===null?S():String(t.protocolVersion)})]}):null;if(e===void 0)return(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:C()});if(e===null)return(0,Z.jsx)(`div`,{className:`oc-bridge-card oc-bridge-card--idle`,children:Me()});let s=Zt(e.targets),c=!e.reachable,l=$t(e),u=e.unreachableInstances??[],d=l===`ok`?`ok`:l===`gateways_unreachable`?`warn`:`error`,f=P(e.checkedAt),p=e.startedAt==null?null:P(e.startedAt);return(0,Z.jsxs)(`div`,{className:`oc-bridge-card oc-bridge-card--${d}`,children:[(0,Z.jsx)(`div`,{className:`oc-bridge-card__icon`,"aria-hidden":!0,children:l===`ok`?(0,Z.jsx)(D,{size:22}):c||l===`gateways_unreachable`?(0,Z.jsx)(Xt,{size:22}):(0,Z.jsx)(A,{size:22})}),(0,Z.jsxs)(`div`,{className:`oc-bridge-card__body`,children:[(0,Z.jsx)(`div`,{className:`oc-bridge-card__title`,children:l===`ok`?i():l===`gateways_unreachable`?ye({count:u.length}):c?se():Se({count:s.length})}),(0,Z.jsxs)(`div`,{className:`oc-bridge-card__meta`,children:[(0,Z.jsxs)(`span`,{children:[(0,Z.jsx)(Yt,{size:12,"aria-hidden":!0}),` `,ge({time:f})]}),p?(0,Z.jsx)(`span`,{children:tt({time:p})}):null,o]}),l===`gateways_unreachable`?(0,Z.jsx)(`p`,{className:`oc-bridge-card__hint`,children:v({names:u.join(`, `)})}):null,c?(0,Z.jsx)(`p`,{className:`oc-bridge-card__hint`,children:W(e.lastError===`not_configured`?`NOT_CONFIGURED`:`BRIDGE_UNREACHABLE`).hint}):null]}),(0,Z.jsx)(`button`,{type:`button`,className:`oc-bridgebar__drill`,onClick:n,children:y()})]})}function xn({providerKey:e,connections:t,instances:n,manifest:r,compatStatus:i,compatReachable:a,protocol:o}){let s=r?qt(r,e):null,c=new Map;for(let e of n)c.set(e.name,e.displayName??e.name);let l=[],u=new Set;for(let n of t){if(!n.instanceName||u.has(n.instanceName))continue;u.add(n.instanceName);let t=n.gatewayVersion??null;l.push({instanceName:n.instanceName,displayName:c.get(n.instanceName)??n.instanceName,version:t,state:Jt(t,e,r)})}let d=l.map(e=>e.state),f=d.includes(`beyond`)?`beyond`:d.length>0&&d.every(e=>e===`supported`)?`supported`:null,[p,m]=(0,G.useState)(!1);return(0,Z.jsxs)(`section`,{className:`oc-bridge-provider`,children:[(0,Z.jsxs)(`header`,{className:`oc-bridge-provider__head`,children:[(0,Z.jsx)(k,{size:15,"aria-hidden":!0,className:`oc-bridge-provider__icon`}),(0,Z.jsx)(`span`,{className:`oc-bridge-provider__name`,children:q(e)}),f?(0,Z.jsx)(R,{variant:f===`beyond`?`destructive`:`secondary`,children:Kt(f)}):null]}),(0,Z.jsx)(`h4`,{className:`oc-bridge-provider__sub`,children:de()}),(0,Z.jsx)(Cn,{providerName:q(e),support:s,compatStatus:i,compatReachable:a,manifest:r,instanceRows:l}),o?(0,Z.jsx)(Sn,{protocol:o}):null,(0,Z.jsxs)(`button`,{type:`button`,className:`oc-bridge-provider__sub oc-bridge-provider__sub--toggle`,"aria-expanded":p,onClick:()=>m(e=>!e),children:[p?(0,Z.jsx)(w,{size:13,"aria-hidden":!0}):(0,Z.jsx)(F,{size:13,"aria-hidden":!0}),h({count:t.length})]}),p?(0,Z.jsx)(mn,{connections:t,displayByInstance:c}):null]})}function Sn({protocol:e}){let[t,n]=(0,G.useState)(!1),r=e.coverage,i=e.drift??[];return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`h4`,{className:`oc-bridge-provider__sub`,children:[rt(),i.length>0?(0,Z.jsx)(R,{variant:`destructive`,children:Te({count:i.length})}):(0,Z.jsx)(R,{variant:`secondary`,children:Ze()})]}),(0,Z.jsxs)(`p`,{className:`oc-admin__hint`,children:[Be({version:e.vendoredVersion}),r?` · `+nt({handled:r.handled,ignored:r.ignored,gaps:r.gaps}):null]}),i.length>0?(0,Z.jsx)(`ul`,{className:`oc-bridge-protocol__list`,role:`list`,children:i.map(e=>(0,Z.jsxs)(`li`,{children:[(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:e.shape}),` × `,e.count]},e.shape))}):null,r&&r.gapList.length>0?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`button`,{type:`button`,className:`oc-bridge-provider__sub oc-bridge-provider__sub--toggle`,"aria-expanded":t,onClick:()=>n(e=>!e),children:[t?(0,Z.jsx)(w,{size:13,"aria-hidden":!0}):(0,Z.jsx)(F,{size:13,"aria-hidden":!0}),Je({count:r.gapList.length})]}),t?(0,Z.jsx)(`ul`,{className:`oc-bridge-protocol__list`,role:`list`,children:r.gapList.map(e=>(0,Z.jsx)(`li`,{children:(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:e})},e))}):null]}):null]})}function Cn({support:e,compatStatus:t,compatReachable:n,manifest:r,instanceRows:i,providerName:a}){return t===`loading`?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:C()}):t===`nodata`?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:ut()}):(0,Z.jsxs)(`div`,{className:`oc-compat`,children:[n?null:(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:Le()}),r===null?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:ze()}):(0,Z.jsxs)(`div`,{className:`oc-compat__support`,children:[(0,Z.jsx)(`span`,{className:`oc-compat__label`,children:Ye({provider:a})}),e&&e.range!==null?(0,Z.jsx)(`span`,{children:qe({min:e.range.min,max:e.range.maxValidated})}):(0,Z.jsx)(`span`,{children:S()}),e?(0,Z.jsx)(En,{versions:e.validatedVersions}):null]}),i.length===0?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:ot()}):(0,Z.jsx)(`div`,{className:`oc-compat__targets`,children:i.map(e=>(0,Z.jsxs)(`div`,{className:`oc-compat__target`,children:[(0,Z.jsx)(`span`,{className:`oc-compat__instance`,children:e.displayName}),(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:Ut(e.version)}),(0,Z.jsx)(R,{variant:e.state===`supported`?`secondary`:e.state===`beyond`?`destructive`:`outline`,children:Kt(e.state)})]},e.instanceName))})]})}function wn({instance:e,onClose:t}){return(0,Z.jsx)(Dt,{open:!0,onOpenChange:e=>!e&&t(),children:(0,Z.jsxs)(Nt,{className:`oc-bridge-config-dialog`,onOpenAutoFocus:e=>e.preventDefault(),children:[(0,Z.jsxs)(jt,{children:[(0,Z.jsx)(It,{children:Ee({instance:e.displayName??e.name})}),(0,Z.jsx)(Ft,{children:Ve()})]}),(0,Z.jsx)(Tn,{instance:e,onClose:t})]})})}function $({label:e,result:t}){return t?t.checked?(0,Z.jsxs)(`p`,{className:`oc-bridge-config__check-row `+(t.ok?`oc-bridge-config__check-row--ok`:`oc-bridge-config__check-row--err`),children:[t.ok?(0,Z.jsx)(D,{"aria-hidden":!0}):(0,Z.jsx)(A,{"aria-hidden":!0}),(0,Z.jsxs)(`span`,{children:[e,` — `,t.ok?$e():t.detail]})]}):(0,Z.jsxs)(`p`,{className:`oc-bridge-config__check-row oc-bridge-config__check-row--skip`,children:[e,` — `,Pe()]}):null}function Tn({instance:e,onClose:t}){let n=Ue(x.admin.upsertInstanceConfig),i=d(x.bridge.validateMediaPaths),a=Lt(),o=Rt(e.config?.contentLocale,void 0),[s,c]=(0,G.useState)(()=>gt(e.config??{},o)),[u,f]=(0,G.useState)(!1),[p,m]=(0,G.useState)(!1),[h,g]=(0,G.useState)(null),_=s.inboundMediaMode===`shared-fs`,v=s.mediaMode===`shared-fs`,y=_||v;async function b(){m(!0),g(null);try{g(await i({instanceName:e.name,inboundMediaMode:s.inboundMediaMode,mediaMode:s.mediaMode}))}catch(e){a.error(we(),e)}finally{m(!1)}}async function ne(){f(!0);try{let r=e.config??{};await n({instanceId:e._id,config:vt(s,r,o)}),t()}catch(e){a.error(xe(),e)}finally{f(!1)}}return(0,Z.jsx)(`div`,{className:`oc-bridge-config`,children:(0,Z.jsxs)(`div`,{className:`oc-bridge-config__form`,children:[(0,Z.jsxs)(`div`,{className:`oc-bridge-config__grid`,children:[(0,Z.jsxs)(`label`,{className:`oc-field`,children:[(0,Z.jsx)(T,{label:Xe(),help:he()}),(0,Z.jsxs)(B,{value:s.mediaMode,onValueChange:e=>c({...s,mediaMode:e}),children:[(0,Z.jsx)(z,{size:`sm`,className:`w-full`,children:(0,Z.jsx)(M,{})}),(0,Z.jsx)(j,{children:yt.map(e=>(0,Z.jsx)(O,{value:e,children:e},e))})]})]}),(0,Z.jsxs)(`label`,{className:`oc-field`,children:[(0,Z.jsx)(T,{label:it(),help:ve()}),(0,Z.jsxs)(B,{value:s.inboundMediaMode,onValueChange:e=>c({...s,inboundMediaMode:e}),children:[(0,Z.jsx)(z,{size:`sm`,className:`w-full`,children:(0,Z.jsx)(M,{})}),(0,Z.jsx)(j,{children:_t.map(e=>(0,Z.jsx)(O,{value:e,children:e},e))})]})]}),(0,Z.jsxs)(`label`,{className:`oc-field`,children:[(0,Z.jsx)(T,{label:Ne(),help:te()}),(0,Z.jsx)(I,{type:`number`,min:1,max:4096,className:`w-full`,value:s.mediaMaxMb,onChange:e=>c({...s,mediaMaxMb:Math.trunc(Number(e.target.value)||0)})})]})]}),y&&(0,Z.jsxs)(`div`,{className:`oc-bridge-config__grid`,children:[_&&(0,Z.jsxs)(`label`,{className:`oc-field`,children:[(0,Z.jsx)(T,{label:l(),help:ue()}),(0,Z.jsx)(I,{className:`w-full`,spellCheck:!1,value:s.inboundAgentMount,onChange:e=>c({...s,inboundAgentMount:e.target.value})})]}),v&&(0,Z.jsxs)(`label`,{className:`oc-field`,children:[(0,Z.jsx)(T,{label:lt(),help:De()}),(0,Z.jsx)(I,{className:`w-full`,spellCheck:!1,value:s.outboundAgentMount,onChange:e=>c({...s,outboundAgentMount:e.target.value})})]})]}),(0,Z.jsxs)(`label`,{className:`oc-field--row`,children:[(0,Z.jsx)(Mt,{checked:s.rehydration,onCheckedChange:e=>c({...s,rehydration:e===!0})}),(0,Z.jsx)(T,{label:r(),help:ee()})]}),y&&h!==null&&(0,Z.jsx)(`div`,{className:`oc-bridge-config__check`,children:h.reachable?!h.inbound&&!h.outbound?(0,Z.jsxs)(`p`,{className:`oc-bridge-config__check-row oc-bridge-config__check-row--err`,children:[(0,Z.jsx)(A,{"aria-hidden":!0}),at({reason:h.reason??`?`})]}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)($,{label:Re(),result:h.inbound}),(0,Z.jsx)($,{label:Ke(),result:h.outbound}),(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:Ie()})]}):(0,Z.jsxs)(`p`,{className:`oc-bridge-config__check-row oc-bridge-config__check-row--err`,children:[(0,Z.jsx)(A,{"aria-hidden":!0}),Ae()]})}),(0,Z.jsxs)(`div`,{className:`oc-bridge-config__actions`,children:[y&&(0,Z.jsxs)(E,{variant:`outline`,size:`sm`,onClick:()=>void b(),disabled:p,children:[p?(0,Z.jsx)(Et,{className:`size-4 animate-spin`,"aria-hidden":!0}):null,p?st():dt()]}),(0,Z.jsx)(E,{size:`sm`,onClick:()=>void ne(),disabled:u,children:oe()})]})]})})}function En({versions:e}){if(e.length===0)return null;let t=[...e].reverse();return(0,Z.jsxs)(wt,{children:[(0,Z.jsx)(Pt,{asChild:!0,children:(0,Z.jsxs)(`button`,{type:`button`,className:`oc-compat__versions-btn`,children:[e.length===1?et():Fe({count:e.length}),(0,Z.jsx)(w,{size:13,"aria-hidden":!0})]})}),(0,Z.jsxs)(Tt,{className:`oc-compat__versions-pop`,align:`start`,children:[(0,Z.jsx)(`p`,{className:`oc-compat__versions-title`,children:je()}),(0,Z.jsx)(`div`,{className:`oc-compat__versions-list`,children:t.map(e=>(0,Z.jsx)(R,{variant:`secondary`,children:e},e))})]})]})}export{yn as BridgeTab,wn as InstanceConfigDialog};
@@ -0,0 +1 @@
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$a as r,AF as i,Al as a,Cl as o,DF as s,Dl as c,El as l,Gu as u,Ja as d,Ol as f,Qa as p,Ru as m,T as h,Tl as g,Uu as _,Xa as v,Ya as y,Za as b,eo as x,jl as S,kF as C,kl as w,no as T,ro as E,rv as D,su as O,to as k,tr as A,wl as j,xF as M,zu as N}from"./dist-CAP0mn60.js";import{t as P}from"./button-DRguy6Hz.js";import{C as F,Pt as I,S as L,T as R,b as z,f as B,it as V,m as H,p as U,w as W,x as G}from"./index-DcPINOh1.js";import{i as K}from"./compatView-BHorgRif.js";/* empty css */var q=t(e(),1),J=[`off`,`minimal`,`low`,`medium`,`high`,`xhigh`];function Y(e){let t=typeof e==`object`&&e?e:{},n=t.defaults!==null&&typeof t.defaults==`object`?t.defaults:{},r=n.thinkingDefault??t.thinkingDefault,i=n.fastModeDefault??t.fastModeDefault;return{thinkingDefault:typeof r==`string`?r:null,fastModeDefault:typeof i==`boolean`?i:null}}var X=n();function Z({instance:e}){let t=C(h.admin.upsertInstanceConfig),n=i(h.agents.listAgentsForInstance,{instanceName:e.name}),a=typeof e.config?.converterAgentId==`string`?e.config.converterAgentId:``,[s,c]=(0,q.useState)(a),[l,d]=(0,q.useState)(`idle`);(0,q.useEffect)(()=>{c(a),d(`idle`)},[e._id,a]);let f=`__none__`,m=s!==a;async function _(){d(`saving`);try{let n={...e.config??{}};s===``||s===f?delete n.converterAgentId:n.converterAgentId=s,await t({instanceId:e._id,config:n}),d(`done`)}catch{d(`error`)}}let v=n?.agents??[];return(0,X.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,X.jsx)(`span`,{className:`oc-cdefaults__label`,children:x()}),(0,X.jsx)(`p`,{className:`oc-admin__hint`,children:r()}),(0,X.jsxs)(`div`,{className:`oc-cdefaults__inline`,children:[(0,X.jsxs)(G,{value:s===``?f:s,onValueChange:e=>c(e===f?``:e),children:[(0,X.jsx)(W,{className:`oc-cdefaults__select`,"aria-label":x(),children:(0,X.jsx)(R,{placeholder:p()})}),(0,X.jsxs)(L,{children:[(0,X.jsx)(F,{value:f,children:p()}),v.map(e=>(0,X.jsx)(F,{value:e.agentId,children:e.displayName?`${e.displayName} (${e.agentId})`:e.agentId},e.agentId))]})]}),(0,X.jsx)(P,{size:`sm`,disabled:!m||l===`saving`,onClick:()=>void _(),children:l===`saving`?u():g()})]}),l===`done`?(0,X.jsx)(`p`,{className:`oc-admin__hint`,role:`status`,children:j()}):null,l===`error`?(0,X.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:o()}):null]})}function Q({instance:e}){let t=C(h.admin.upsertInstanceConfig),n=e.config?.curationEnabled===!0,r=typeof e.config?.curationBudgetChars==`number`?e.config.curationBudgetChars:null,[i,a]=(0,q.useState)(n),[s,c]=(0,q.useState)(r===null?``:String(r)),[l,d]=(0,q.useState)(`idle`);(0,q.useEffect)(()=>{a(n),c(r===null?``:String(r)),d(`idle`)},[e._id,n,r]);let f=s.trim(),p=f===``?null:/^\d+$/.test(f)?Number.parseInt(f,10):NaN,m=!i||p===null||Number.isInteger(p)&&p>=4e3&&p<=6e4,_=i!==n||(p??null)!==r;async function x(){d(`saving`);try{let n={...e.config??{}};n.curationEnabled=i,!i||p===null||Number.isNaN(p)?delete n.curationBudgetChars:n.curationBudgetChars=p,await t({instanceId:e._id,config:n}),d(`done`)}catch{d(`error`)}}return(0,X.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,X.jsxs)(`label`,{className:`oc-cdefaults__inline`,style:{cursor:`pointer`},children:[(0,X.jsx)(H,{checked:i,onCheckedChange:e=>a(e===!0),"aria-label":k()}),(0,X.jsx)(`span`,{className:`oc-cdefaults__label`,children:k()})]}),(0,X.jsxs)(`div`,{className:`oc-cdefaults__inline`,children:[(0,X.jsx)(V,{type:`number`,min:4e3,max:6e4,step:1e3,placeholder:`20000`,value:s,onChange:e=>c(e.target.value),className:`oc-cdefaults__number`,"aria-invalid":!m,"aria-label":b(),disabled:!i}),(0,X.jsx)(P,{size:`sm`,disabled:!_||!m||l===`saving`,onClick:()=>void x(),children:l===`saving`?u():g()})]}),m?null:(0,X.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:v()}),l===`done`?(0,X.jsx)(`p`,{className:`oc-admin__hint`,role:`status`,children:j()}):null,l===`error`?(0,X.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:o()}):null,(0,X.jsx)(`p`,{className:`oc-cdefaults__help`,children:y()})]})}function $({instance:e}){let t=C(h.admin.upsertInstanceConfig),n=typeof e.config?.summarizeThresholdChars==`number`?e.config.summarizeThresholdChars:null,[r,i]=(0,q.useState)(n===null?``:String(n)),[a,s]=(0,q.useState)(`idle`);(0,q.useEffect)(()=>{i(n===null?``:String(n)),s(`idle`)},[e._id,n]);let c=r.trim(),l=c===``?null:/^\d+$/.test(c)?Number.parseInt(c,10):NaN,f=l===null||Number.isInteger(l)&&l>=1e3&&l<=2e5,p=(l??null)!==n;async function m(){s(`saving`);try{let n={...e.config??{}};l===null?delete n.summarizeThresholdChars:n.summarizeThresholdChars=l,await t({instanceId:e._id,config:n}),s(`done`)}catch{s(`error`)}}return(0,X.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,X.jsx)(`span`,{className:`oc-cdefaults__label`,children:E()}),(0,X.jsxs)(`div`,{className:`oc-cdefaults__inline`,children:[(0,X.jsx)(V,{type:`number`,min:1e3,max:2e5,step:1e3,placeholder:`8000`,value:r,onChange:e=>i(e.target.value),className:`oc-cdefaults__number`,"aria-invalid":!f}),(0,X.jsx)(P,{size:`sm`,disabled:!p||!f||a===`saving`,onClick:()=>void m(),children:a===`saving`?u():g()})]}),f?null:(0,X.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:d()}),a===`done`?(0,X.jsx)(`p`,{className:`oc-admin__hint`,role:`status`,children:j()}):null,a===`error`?(0,X.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:o()}):null,(0,X.jsx)(`p`,{className:`oc-cdefaults__help`,children:T()})]})}function ee(){let e=s(h.agentFiles.getChatDefaults),[t,n]=(0,q.useState)({status:`loading`}),r=i(h.admin.listInstances,{}),[o,u]=(0,q.useState)(null);(0,q.useEffect)(()=>{!r||r.length===0||(!o||!r.some(e=>e.name===o))&&u(r[0].name)},[r,o]);let d=(r?.length??0)>1,p=r!==void 0&&r.length===0,g=i(h.compat.forInstance,o?{instanceName:o}:`skip`),v=o?z(g,`configDefaults`):`loading`,y=v===`loading`?null:v.blocked,b=(0,q.useMemo)(()=>d&&o?{instanceName:o}:{},[d,o]),x=(0,q.useRef)(0),C=(0,q.useCallback)(async()=>{let t=++x.current;n({status:`loading`});try{let r=Y(await e(b));if(x.current!==t)return;n({status:`done`,current:r})}catch{if(x.current!==t)return;n({status:`error`})}},[e,b]);(0,q.useEffect)(()=>{y===!1&&(d&&!o||C())},[C,y,d,o]);let T=t.status===`done`?t.current:null,E=(0,q.useMemo)(()=>J.map(e=>({id:e,label:U(e)})),[]),k=(0,q.useMemo)(()=>[{id:`fast`,label:N()},{id:`standard`,label:m()}],[]);return(0,X.jsxs)(`div`,{className:`oc-cdefaults`,children:[(0,X.jsx)(`p`,{className:`oc-admin__hint`,children:S()}),d&&o?(0,X.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,X.jsx)(`span`,{className:`oc-cdefaults__label`,children:O()}),(0,X.jsxs)(G,{value:o,onValueChange:e=>u(e),children:[(0,X.jsx)(W,{size:`sm`,"aria-label":O(),children:(0,X.jsx)(R,{})}),(0,X.jsx)(L,{children:(r??[]).map(e=>(0,X.jsx)(F,{value:e.name,children:e.name},e.name))})]})]}):null,p?(0,X.jsx)(`p`,{className:`oc-admin__hint`,role:`status`,children:D()}):v===`loading`?(0,X.jsx)(`p`,{className:`oc-admin__hint`,children:M()}):v.blocked?(0,X.jsxs)(`p`,{className:`oc-compat__blocked`,role:`status`,children:[(0,X.jsx)(I,{size:14,"aria-hidden":!0}),` `,K(v.gatewayVersion,v.provider)]}):t.status===`loading`?(0,X.jsx)(`p`,{className:`oc-admin__hint`,children:M()}):t.status===`error`?(0,X.jsxs)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:[l(),` `,(0,X.jsx)(P,{variant:`outline`,size:`sm`,onClick:()=>void C(),children:_()})]}):(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,X.jsx)(`span`,{className:`oc-cdefaults__label`,children:a()}),(0,X.jsx)(B,{options:E,value:T?.thinkingDefault??null,onChange:()=>{},disabled:!0}),(0,X.jsx)(`p`,{className:`oc-cdefaults__help`,children:w()})]}),(0,X.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,X.jsx)(`span`,{className:`oc-cdefaults__label`,children:f()}),(0,X.jsx)(B,{options:k,value:T===null||T.fastModeDefault===null?null:T.fastModeDefault?`fast`:`standard`,onChange:()=>{},disabled:!0}),(0,X.jsx)(`p`,{className:`oc-cdefaults__help`,children:c()})]}),(0,X.jsx)(`p`,{className:`oc-cdefaults__note`,children:A()})]}),(()=>{let e=r?.find(e=>e.name===(o??r[0]?.name));return e?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)($,{instance:e}),(0,X.jsx)(Q,{instance:e}),(0,X.jsx)(Z,{instance:e})]}):null})()]})}export{ee as ChatDefaultsTab};
@@ -1 +1 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Bp as r,Hp as i,Ip as a,Lp as o,Rp as s,Vp as c,zp as l}from"./dist-B1qnlN7I.js";import{i as u,r as d}from"./dist-CRven8ef.js";import{t as f}from"./chevrons-up-down-C82Hxi1c.js";import{t as p}from"./button-BCAsV4-2.js";import{$ as m,Bt as h,Ft as g,Q as _,Yt as v,Z as y,m as b,nt as x,tt as S}from"./index-rCasMjHB.js";import{a as C,i as w,n as T,o as E,r as D,t as O}from"./table-DckOsZQY.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=i(),bulkActions:F,emptyHint:I=c(),isExpanded:L,renderExpanded:R}){let[z,B]=(0,k.useState)(new Set),[V,H]=(0,k.useState)(null),U=t??[],W=V?n[V.index]:void 0,G=V&&W?.sort?j(U,W.sort,V.dir):U;function K(e){H(t=>!t||t.index!==e?{index:e,dir:`asc`}:t.dir===`asc`?{index:e,dir:`desc`}:null)}let q=+!!F+n.length+ +!!A,J=U.length>0&&z.size===U.length,Y=z.size>0&&!J;function X(){B(J?new Set:new Set(U.map(e=>e._id)))}function Z(e){B(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})}return(0,M.jsxs)(`div`,{className:`oc-dt`,children:[(0,M.jsxs)(`div`,{className:`oc-dt__bar`,children:[(0,M.jsx)(`h2`,{className:`oc-dt__title`,children:e}),(0,M.jsxs)(`div`,{className:`oc-dt__bar-actions`,children:[z.size>0&&F?F.map(e=>(0,M.jsxs)(p,{size:`sm`,variant:e.variant===`destructive`?`destructive`:`outline`,onClick:()=>{e.onSelect([...z]),B(new Set)},children:[e.variant===`destructive`?(0,M.jsx)(g,{}):null,e.label,` (`,z.size,`)`]},e.label)):null,N?(0,M.jsxs)(p,{size:`sm`,onClick:N,children:[(0,M.jsx)(h,{}),` `,P]}):null]})]}),t===void 0?(0,M.jsx)(`p`,{className:`oc-admin__hint`,children:r()}):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":l(),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":a({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":s(),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)(y,{children:[(0,M.jsx)(x,{asChild:!0,children:(0,M.jsx)(p,{variant:`ghost`,size:`icon-sm`,"aria-label":o(),className:`opacity-0 transition-opacity group-hover/row:opacity-100 group-focus-within/row:opacity-100 aria-expanded:opacity-100`,children:(0,M.jsx)(v,{})})}),(0,M.jsx)(_,{align:`end`,children:t.map((t,n)=>(0,M.jsxs)(`div`,{children:[t.variant===`destructive`&&n>0?(0,M.jsx)(S,{}):null,(0,M.jsx)(m,{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{Jp as r,Kp as i,Qp as a,Xp as o,Yp as s,Zp as c,qp as l}from"./dist-CAP0mn60.js";import{i as u,r as d}from"./dist-3KrBDl5H.js";import{t as f}from"./chevrons-up-down-BFfHriX4.js";import{t as p}from"./button-DRguy6Hz.js";import{$ as m,Bt as h,Ft as g,Q as _,Yt as v,Z as y,m as b,nt as x,tt as S}from"./index-DcPINOh1.js";import{a as C,i as w,n as T,o as E,r as D,t as O}from"./table-1vsq56Zt.js";var k=t(e(),1);function A(e,t){return typeof e==`number`&&typeof t==`number`?e-t:typeof e==`boolean`&&typeof t==`boolean`?!!e-+!!t:String(e).localeCompare(String(t),void 0,{numeric:!0,sensitivity:`base`})}function j(e,t,n){return[...e].sort((e,r)=>{let i=t(e),a=t(r),o=i==null,s=a==null;if(o||s)return o&&s?0:o?1:-1;let c=A(i,a);return n===`asc`?c:-c})}var M=n();function N({title:e,rows:t,columns:n,rowActions:A,onAdd:N,addLabel:P=a(),bulkActions:F,emptyHint:I=c(),isExpanded:L,renderExpanded:R}){let[z,B]=(0,k.useState)(new Set),[V,H]=(0,k.useState)(null),U=t??[],W=V?n[V.index]:void 0,G=V&&W?.sort?j(U,W.sort,V.dir):U;function K(e){H(t=>!t||t.index!==e?{index:e,dir:`asc`}:t.dir===`asc`?{index:e,dir:`desc`}:null)}let q=+!!F+n.length+ +!!A,J=U.length>0&&z.size===U.length,Y=z.size>0&&!J;function X(){B(J?new Set:new Set(U.map(e=>e._id)))}function Z(e){B(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})}return(0,M.jsxs)(`div`,{className:`oc-dt`,children:[(0,M.jsxs)(`div`,{className:`oc-dt__bar`,children:[(0,M.jsx)(`h2`,{className:`oc-dt__title`,children:e}),(0,M.jsxs)(`div`,{className:`oc-dt__bar-actions`,children:[z.size>0&&F?F.map(e=>(0,M.jsxs)(p,{size:`sm`,variant:e.variant===`destructive`?`destructive`:`outline`,onClick:()=>{e.onSelect([...z]),B(new Set)},children:[e.variant===`destructive`?(0,M.jsx)(g,{}):null,e.label,` (`,z.size,`)`]},e.label)):null,N?(0,M.jsxs)(p,{size:`sm`,onClick:N,children:[(0,M.jsx)(h,{}),` `,P]}):null]})]}),t===void 0?(0,M.jsx)(`p`,{className:`oc-admin__hint`,children:o()}):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":s(),checked:J?!0:Y?`indeterminate`:!1,onCheckedChange:X})}):null,n.map((e,t)=>{let n=V?.index===t;return e.sort?(0,M.jsx)(w,{className:e.className,"aria-sort":n?V.dir===`asc`?`ascending`:`descending`:`none`,children:(0,M.jsxs)(`button`,{type:`button`,className:`oc-dt__sort`,onClick:()=>K(t),"aria-label":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)??[],i=L?.(e)??!1;return(0,M.jsxs)(k.Fragment,{children:[(0,M.jsxs)(E,{className:`group/row`,children:[F?(0,M.jsx)(D,{children:(0,M.jsx)(b,{"aria-label":r(),checked:z.has(e._id),onCheckedChange:()=>Z(e._id)})}):null,n.map(t=>(0,M.jsx)(D,{className:t.className,children:t.cell(e)},t.header)),A?(0,M.jsx)(D,{children:t.length>0?(0,M.jsxs)(y,{children:[(0,M.jsx)(x,{asChild:!0,children:(0,M.jsx)(p,{variant:`ghost`,size:`icon-sm`,"aria-label":l(),className:`opacity-0 transition-opacity group-hover/row:opacity-100 group-focus-within/row:opacity-100 aria-expanded:opacity-100`,children:(0,M.jsx)(v,{})})}),(0,M.jsx)(_,{align:`end`,children:t.map((t,n)=>(0,M.jsxs)(`div`,{children:[t.variant===`destructive`&&n>0?(0,M.jsx)(S,{}):null,(0,M.jsx)(m,{variant:t.variant,onSelect:()=>t.onSelect(e),children:t.label})]},t.label))})]}):null}):null]}),i&&R?(0,M.jsx)(E,{className:`oc-dt__expansion`,children:(0,M.jsx)(D,{colSpan:q,className:`oc-dt__expansion-cell`,children:R(e)})}):null]},e._id)})})]})]})}export{N as t};
@@ -1 +1 @@
1
- import{r as e}from"./bundle-mjs-C73ZY4La.js";import{rt as t}from"./index-rCasMjHB.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{rt as t}from"./index-DcPINOh1.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{$w as r,AF as i,Aw as a,Bw as o,Cw as s,Dw as c,Ew as l,Fw as u,Gw as d,Hw as f,Iw as p,Jw as m,Kw as h,Lw as g,Mw as _,Nw as ee,Ow as te,Pw as v,Qw as y,Rw as ne,Sw as re,T as b,Tw as x,Uw as ie,Vw as ae,Ww as S,Xw as C,Yw as w,Zw as T,_T as E,aT as D,bT as O,bw as k,cT as A,dT as j,eT as M,fT as N,gT as P,hT as F,ha as I,iT as L,jw as R,kF as z,kw as B,lT as V,mT as H,nT as U,oT as W,pT as G,pa as oe,qw as K,rT as q,sT as se,tT as J,uT as ce,vT as le,ww as ue,xT as de,xw as fe,yT as pe,yw as me,zw as he}from"./dist-CAP0mn60.js";import{t as ge}from"./button-DRguy6Hz.js";import{F as _e,Y}from"./index-DcPINOh1.js";import{t as ve}from"./DataTableShell-Bo9JdV4-.js";var X=t(e(),1),Z=n(),ye={altered_words:()=>de(),incorrect:()=>O(),incoherence:()=>pe(),formatting:()=>le(),latency:()=>E(),api_error:()=>P(),other:()=>F()},Q=e=>ye[e]?.()??e;function $({matches:e,sourceWasOpen:t}){return t?e===!0?(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-ok`,children:G()}):e===!1?(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-warn`,children:N()}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill`,children:`—`}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill`,children:H()})}function be({data:e,reference:t,closeReason:n}){let i=e.snapshot,a=z(b.feedback.respondToFeedback),[o,s]=(0,X.useState)(e.thread),[c,l]=(0,X.useState)(``),[u,f]=(0,X.useState)(!1);async function p(){let t=c.trim();if(!(!t||u)){f(!0);try{await a({feedbackId:e._id,text:t}),s(e=>[...e,{authorRole:`admin`,text:t,at:Date.now()}]),l(``)}finally{f(!1)}}}let g=[];try{g=i.contextJson?JSON.parse(i.contextJson):[]}catch{g=[]}return(0,Z.jsxs)(`div`,{className:`oc-fbadmin__detail`,children:[(0,Z.jsxs)(`div`,{className:`oc-fbadmin__row`,children:[(0,Z.jsx)($,{matches:i.displayedMatchesStored,sourceWasOpen:i.clientInfo?.sourceWasOpen??!1}),(0,Z.jsxs)(`span`,{className:`oc-fbadmin__meta`,children:[Q(e.category),` · `,i.messageRole,i.isRegeneration?` · ${j()}`:``,i.openclawModel?` · ${i.openclawModel}`:``,i.openclawRuntime?` (${i.openclawRuntime})`:``]}),t?(0,Z.jsx)(`code`,{className:`oc-fbadmin__ref`,style:{userSelect:`all`,marginLeft:`auto`},title:he(),children:t}):null]}),e.comment?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:ce()}),(0,Z.jsx)(`p`,{className:`oc-fbadmin__comment`,children:e.comment})]}):null,n?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:x()}),(0,Z.jsx)(`p`,{className:`oc-fbadmin__comment`,children:n})]}):null,(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:V()}),o.length>0?(0,Z.jsx)(`div`,{className:`oc-fbadmin__thread`,children:o.map((e,t)=>(0,Z.jsxs)(`div`,{className:`oc-notif__msg oc-notif__msg--${e.authorRole}`,children:[(0,Z.jsx)(`span`,{className:`oc-notif__msg-who`,children:e.authorRole===`admin`?A():e.authorRole===`agent`?e.authorLabel??I():se()}),(0,Z.jsx)(`span`,{className:`oc-notif__msg-text`,children:e.text})]},t))}):(0,Z.jsx)(`p`,{className:`oc-fbadmin__meta`,children:W()}),(0,Z.jsx)(`textarea`,{className:`oc-feedback__textarea`,placeholder:D(),value:c,maxLength:2e3,rows:3,onChange:e=>l(e.target.value.slice(0,2e3))}),(0,Z.jsx)(`div`,{className:`oc-fbadmin__row`,style:{justifyContent:`flex-end`},children:(0,Z.jsx)(ge,{size:`sm`,onClick:()=>void p(),disabled:!c.trim()||u,children:u?L():q()})})]}),(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:U()}),(0,Z.jsx)(`pre`,{className:`oc-msg__source-pre`,children:i.messageText||J()})]}),i.clientInfo?.sourceWasOpen&&i.displayedText!==void 0?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:M()}),(0,Z.jsx)(`pre`,{className:`oc-msg__source-pre`,children:i.displayedText||J()})]}):null,i.promptText?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:r()}),(0,Z.jsx)(`pre`,{className:`oc-msg__source-pre`,children:i.promptText})]}):null,g.length>0?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:y({count:i.contextCount??g.length,truncated:i.contextTruncated?T():``})}),(0,Z.jsx)(`div`,{className:`oc-fbadmin__ctx`,children:g.map((e,t)=>(0,Z.jsxs)(`div`,{className:`oc-fbadmin__ctx-turn`,children:[(0,Z.jsx)(`span`,{className:`oc-fbadmin__ctx-role`,children:e.role}),(0,Z.jsx)(`span`,{className:`oc-fbadmin__ctx-text`,children:e.text})]},t))})]}):null,i.outboxAvailable?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:C()}),(0,Z.jsxs)(`pre`,{className:`oc-msg__source-pre`,children:[i.outboxText??``,i.outboxStatus?`\n[status: ${i.outboxStatus}]`:``]})]}):null,i.clientInfo?.extensionsDetected&&i.clientInfo.extensionsDetected.length>0?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:w()}),(0,Z.jsx)(`div`,{className:`oc-fbadmin__row`,children:i.clientInfo.extensionsDetected.map(e=>(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-warn`,children:e},e))})]}):null,(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:m()}),(0,Z.jsxs)(`p`,{className:`oc-fbadmin__env`,children:[[i.clientInfo?.language,i.clientInfo?.timezone,i.clientInfo?.theme?K({theme:i.clientInfo.theme}):null,i.runId?`run ${i.runId.slice(0,12)}…`:null].filter(Boolean).join(` · `)||`—`,i.clientInfo?.plugins&&i.clientInfo.plugins.length>0?(0,Z.jsxs)(`span`,{className:`oc-fbadmin__plugins`,children:[h(),` `,i.clientInfo.plugins.join(`, `),(0,Z.jsxs)(`span`,{className:`oc-fbadmin__note`,children:[` `,d()]})]}):null,i.clientInfo?.userAgent?(0,Z.jsx)(`span`,{className:`oc-fbadmin__ua`,children:i.clientInfo.userAgent}):null]})]})]})}function xe(){let e=i(b.feedback.listForAdmin,{}),t=z(b.feedback.readSnapshot),n=z(b.feedback.deleteFeedback),r=_e(),[d,m]=(0,X.useState)(null),[h,y]=(0,X.useState)({});async function x(e){if(d===e._id){m(null);return}if(!h[e._id]){let n=await t({feedbackId:e._id});y(t=>({...t,[e._id]:n}))}m(e._id)}async function C(e){await r({title:fe(),description:k(),confirmLabel:me(),destructive:!0})&&(await n({feedbackId:e._id}),d===e._id&&m(null))}return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`p`,{className:`oc-admin__hint`,children:[S(),` `,(0,Z.jsx)(`strong`,{children:ie()}),` `,f()]}),(0,Z.jsx)(ve,{title:ae(),rows:e,emptyHint:o(),isExpanded:e=>d===e._id&&!!h[e._id],renderExpanded:e=>h[e._id]?(0,Z.jsx)(be,{data:h[e._id],reference:e.reference,closeReason:e.userCloseReason}):null,columns:[{header:ne(),cell:e=>Y(e.at),sort:e=>e.at},{header:g(),cell:e=>Q(e.category),sort:e=>Q(e.category)},{header:p(),cell:e=>e.messageRole===`user`?u():v(),sort:e=>e.messageRole},{header:ee(),cell:e=>(e.reporterEmail||e.reporterName||`—`)+(e.impersonated&&e.realOperatorEmail?` ${_({operator:e.realOperatorEmail})}`:``),sort:e=>e.reporterEmail||e.reporterName||null},{header:R(),cell:e=>(0,Z.jsx)($,{matches:e.displayedMatchesStored,sourceWasOpen:e.sourceWasOpen}),sort:e=>e.displayedMatchesStored===!1?0:e.displayedMatchesStored===!0?1:2},{header:a(),cell:e=>e.hasComment?`✎`:`—`,sort:e=>+!!e.hasComment},{header:B(),cell:e=>e.userClosedAt==null?e.resolvedAt==null?e.answered?(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-ok`,children:te()}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill`,children:c()}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-ok`,title:e.resolvedBy??void 0,children:oe()}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-closed`,children:l()}),sort:e=>e.userClosedAt==null?e.resolvedAt==null?+!!e.answered:2:3}],rowActions:e=>[{label:d===e._id?ue():s(),onSelect:()=>void x(e)},{label:re(),onSelect:()=>void C(e),variant:`destructive`}]})]})}export{xe as FeedbacksTab};
@@ -1,4 +1,4 @@
1
- import{r as e}from"./bundle-mjs-C73ZY4La.js";import{D as t,EF as n}from"./dist-B1qnlN7I.js";import{_ as r,g as i,v as a,y as o}from"./index-rCasMjHB.js";import"./locales-CPjguROj.js";import"./curation-CQksaIbm.js";var s=t(`circle-question-mark`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3`,key:`1u773s`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]]),c={media_delivery:{key:`media_delivery`,appliedIn:`bridge`,togglable:!0,placeholders:[`outboundDir`],defaultTemplate:{fr:`[LIVRAISON]
1
+ import{r as e}from"./bundle-mjs-C73ZY4La.js";import{D as t,LF as n}from"./dist-CAP0mn60.js";import{_ as r,g as i,v as a,y as o}from"./index-DcPINOh1.js";import"./locales-CPjguROj.js";import"./curation-CQksaIbm.js";var s=t(`circle-question-mark`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3`,key:`1u773s`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]]),c={media_delivery:{key:`media_delivery`,appliedIn:`bridge`,togglable:!0,placeholders:[`outboundDir`],defaultTemplate:{fr:`[LIVRAISON]
2
2
  Pour qu'un fichier que tu génères soit téléchargeable par l'utilisateur dans ce webchat : écris-le sous {outboundDir}/ puis ajoute, dans ta réponse finale, une ligne dédiée EXACTEMENT au format MEDIA:<chemin absolu du fichier>. N'utilise PAS de lien markdown vers un chemin local — il ne serait pas cliquable.`,en:`[DELIVERY]
3
3
  To make a file you generate downloadable by the user in this webchat: write it under {outboundDir}/ then add, in your final reply, a dedicated line EXACTLY in the format MEDIA:<absolute file path>. Do NOT use a markdown link to a local path — it would not be clickable.`}},documentary_fetch:{key:`documentary_fetch`,appliedIn:`convex`,togglable:!0,placeholders:[`references`],defaultTemplate:{fr:`Fournis les fichiers source téléchargeables correspondant EXACTEMENT à ces références de documents (un fichier par référence, nommé d'après la référence). Réponds uniquement avec les fichiers, sans commentaire :
4
4
  {references}`,en:`Provide the downloadable source files matching EXACTLY these document references (one file per reference, named after the reference). Reply only with the files, no commentary:
@@ -0,0 +1 @@
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{AF as ee,AP as te,BP as r,CF as i,CP as a,DP as o,EP as ne,FP as s,GP as c,HP as re,IP as l,JP as u,KP as d,LP as f,MP as p,NP as m,OP as ie,PP as h,RP as ae,SP as oe,T as g,TP as se,UP as ce,VP as le,WP as _,_P as ue,bP as de,gP as fe,hP as pe,jP as v,kF as me,kP as he,mP as ge,pP as _e,qP as ve,vP as ye,va as be,wP as y,xF as b,xO as x,xP as S,yP as C,ya as w,zP as T}from"./dist-CAP0mn60.js";import{t as E}from"./button-DRguy6Hz.js";import{$ as D,B as O,C as k,Ft as A,H as j,L as M,Q as N,R as xe,S as P,T as F,U as Se,V as Ce,W as we,Xt as I,Yt as Te,Z as Ee,m as De,nt as Oe,rt as L,w as R,wt as ke,x as z,z as Ae,zt as je}from"./index-DcPINOh1.js";import{a as Me,i as B,n as Ne,o as V,r as H,t as Pe}from"./table-1vsq56Zt.js";var U=t(e(),1),W=n(),G=`all`;function K(e){switch(e){case`image`:return f();case`audio`:return l();case`video`:return s();case`pdf`:return h();case`document`:return m();case`archive`:return p();default:return v()}}function q(){let[e,t]=(0,U.useState)(G),[n,s]=(0,U.useState)(G),[l,f]=(0,U.useState)(G),[p,m]=(0,U.useState)(G),[h,v]=(0,U.useState)(!1),[q,J]=(0,U.useState)(null),Fe=me(g.files.softDelete),Y=ke();function Ie(){t(G),s(G),f(G),m(G)}async function Le(){let e=q;if(J(null),e)try{await Fe({fileId:e.id}),Y.success(de())}catch(e){Y.error(C(),e)}}let X=ee(g.files.listMine,{direction:e===G?void 0:e,chatId:n===G?void 0:n,instanceName:l===G?void 0:l,category:p===G?void 0:p,includeAutoGenerated:h||void 0}),Re=(0,U.useMemo)(()=>new Intl.DateTimeFormat(i(),{dateStyle:`medium`,timeStyle:`short`}),[]);if(X===void 0)return(0,W.jsx)(`p`,{className:`oc-admin__hint`,children:b()});let{files:Z,facets:Q,truncated:ze,cap:Be}=X,$=e!==G||n!==G||l!==G||p!==G;return(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`p`,{className:`oc-admin__hint`,children:u()}),(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)(R,{size:`sm`,"aria-label":ve(),children:(0,W.jsx)(F,{})}),(0,W.jsxs)(P,{children:[(0,W.jsx)(k,{value:G,children:d()}),(0,W.jsx)(k,{value:`inbound`,children:c()}),(0,W.jsx)(k,{value:`outbound`,children:_()})]})]}),(0,W.jsxs)(z,{value:n,onValueChange:s,children:[(0,W.jsx)(R,{size:`sm`,"aria-label":ce(),children:(0,W.jsx)(F,{})}),(0,W.jsxs)(P,{children:[(0,W.jsx)(k,{value:G,children:re()}),Q.chats.map(e=>(0,W.jsx)(k,{value:e.id,children:e.title},e.id))]})]}),Q.multiProvider?(0,W.jsxs)(z,{value:l,onValueChange:f,children:[(0,W.jsx)(R,{size:`sm`,"aria-label":le(),children:(0,W.jsx)(F,{})}),(0,W.jsxs)(P,{children:[(0,W.jsx)(k,{value:G,children:r()}),Q.instances.map(e=>(0,W.jsx)(k,{value:e,children:e},e))]})]}):null,(0,W.jsxs)(z,{value:p,onValueChange:m,children:[(0,W.jsx)(R,{size:`sm`,"aria-label":T(),children:(0,W.jsx)(F,{})}),(0,W.jsxs)(P,{children:[(0,W.jsx)(k,{value:G,children:ae()}),Q.categories.map(e=>(0,W.jsx)(k,{value:e,children:K(e)},e))]})]}),(0,W.jsxs)(`label`,{className:`oc-files__autogen`,children:[(0,W.jsx)(De,{checked:h,onCheckedChange:e=>v(e===!0),"aria-label":w()}),(0,W.jsx)(`span`,{children:w()})]}),$?(0,W.jsxs)(E,{variant:`ghost`,size:`sm`,onClick:Ie,style:{display:`inline-flex`,alignItems:`center`,gap:4,marginLeft:`auto`},children:[(0,W.jsx)(je,{size:14,"aria-hidden":!0}),a()]}):null]}),Z.length===0?(0,W.jsx)(`p`,{className:`oc-admin__hint`,children:$?ge():pe()}):(0,W.jsxs)(W.Fragment,{children:[(0,W.jsxs)(Pe,{children:[(0,W.jsx)(Me,{children:(0,W.jsxs)(V,{children:[(0,W.jsx)(B,{children:te()}),(0,W.jsx)(B,{children:he()}),(0,W.jsx)(B,{children:ie()}),(0,W.jsx)(B,{children:o()}),(0,W.jsx)(B,{children:ne()}),(0,W.jsx)(B,{className:`text-right`,children:se()})]})}),(0,W.jsx)(Ne,{children:Z.map(e=>(0,W.jsxs)(V,{children:[(0,W.jsxs)(H,{className:`font-medium`,style:{maxWidth:280,overflow:`hidden`,textOverflow:`ellipsis`},title:e.filename,children:[e.filename,e.origin===`pasted`?(0,W.jsx)(L,{variant:`outline`,style:{marginLeft:6},children:be()}):null]}),(0,W.jsx)(H,{title:e.mimeType,children:K(e.category)}),(0,W.jsx)(H,{children:(0,W.jsx)(L,{variant:`secondary`,children:e.direction===`inbound`?c():_()})}),(0,W.jsx)(H,{style:{maxWidth:220,overflow:`hidden`,textOverflow:`ellipsis`},title:e.chatTitle,children:e.chatTitle}),(0,W.jsx)(H,{className:`whitespace-nowrap text-muted-foreground`,children:Re.format(e.createdAt)}),(0,W.jsx)(H,{className:`text-right`,children:(0,W.jsxs)(Ee,{children:[(0,W.jsx)(Oe,{asChild:!0,children:(0,W.jsx)(E,{variant:`ghost`,size:`icon`,"aria-label":oe(),children:(0,W.jsx)(Te,{size:16})})}),(0,W.jsxs)(N,{align:`end`,children:[e.url?(0,W.jsx)(D,{asChild:!0,children:(0,W.jsxs)(`a`,{href:e.url,download:e.filename,target:`_blank`,rel:`noopener noreferrer`,children:[(0,W.jsx)(I,{size:14}),y()]})}):(0,W.jsxs)(D,{disabled:!0,children:[(0,W.jsx)(I,{size:14}),fe()]}),(0,W.jsxs)(D,{variant:`destructive`,onSelect:()=>J({id:e._id,filename:e.filename}),children:[(0,W.jsx)(A,{size:14}),S()]})]})]})})]},e._id))})]}),ze?(0,W.jsx)(`p`,{className:`oc-admin__hint`,style:{marginTop:8},children:_e({cap:Be})}):null]}),(0,W.jsx)(M,{open:q!==null,onOpenChange:e=>!e&&J(null),children:(0,W.jsxs)(O,{children:[(0,W.jsxs)(Se,{children:[(0,W.jsx)(we,{children:ye()}),(0,W.jsx)(Ce,{children:ue()})]}),(0,W.jsxs)(j,{children:[(0,W.jsx)(Ae,{children:x()}),(0,W.jsx)(xe,{onClick:()=>void Le(),children:S()})]})]})})]})}export{q as FilesTab};
@@ -1 +1 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Up as r,Wp as i}from"./dist-B1qnlN7I.js";import{t as a}from"./button-BCAsV4-2.js";import{Rt as o,it as s,zt as c}from"./index-rCasMjHB.js";import{t as l}from"./TimeRangePicker-fvvxJ7HC.js";var u=t(e(),1),d=n(),f=250;function p({q:e,onQChange:t,searchPlaceholder:n=i(),children:p,timeRange:m,onTimeRangeChange:h,onReset:g,canReset:_=!0}){let[v,y]=(0,u.useState)(e);(0,u.useEffect)(()=>{y(e)},[e]);let b=(0,u.useRef)(null);function x(e){y(e),b.current!==null&&window.clearTimeout(b.current),b.current=window.setTimeout(()=>t(e),f)}(0,u.useEffect)(()=>()=>{b.current!==null&&window.clearTimeout(b.current)},[]);function S(){b.current!==null&&window.clearTimeout(b.current),g()}return(0,d.jsxs)(`div`,{className:`oc-filterbar`,children:[(0,d.jsxs)(`div`,{className:`oc-filterbar__search`,children:[(0,d.jsx)(o,{className:`oc-filterbar__search-icon`,"aria-hidden":!0}),(0,d.jsx)(s,{value:v,onChange:e=>x(e.target.value),placeholder:n,"aria-label":n})]}),p?(0,d.jsx)(`div`,{className:`oc-filterbar__quick`,children:p}):null,m&&h?(0,d.jsx)(l,{value:m,onChange:h}):null,(0,d.jsxs)(a,{variant:`ghost`,size:`sm`,className:`oc-filterbar__reset`,onClick:S,disabled:!_,children:[(0,d.jsx)(c,{}),r()]})]})}export{p as t};
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$p as r,em as i}from"./dist-CAP0mn60.js";import{t as a}from"./button-DRguy6Hz.js";import{Rt as o,it as s,zt as c}from"./index-DcPINOh1.js";import{t as l}from"./TimeRangePicker-DGb-YJj5.js";var u=t(e(),1),d=n(),f=250;function p({q:e,onQChange:t,searchPlaceholder:n=i(),children:p,timeRange:m,onTimeRangeChange:h,onReset:g,canReset:_=!0}){let[v,y]=(0,u.useState)(e);(0,u.useEffect)(()=>{y(e)},[e]);let b=(0,u.useRef)(null);function x(e){y(e),b.current!==null&&window.clearTimeout(b.current),b.current=window.setTimeout(()=>t(e),f)}(0,u.useEffect)(()=>()=>{b.current!==null&&window.clearTimeout(b.current)},[]);function S(){b.current!==null&&window.clearTimeout(b.current),g()}return(0,d.jsxs)(`div`,{className:`oc-filterbar`,children:[(0,d.jsxs)(`div`,{className:`oc-filterbar__search`,children:[(0,d.jsx)(o,{className:`oc-filterbar__search-icon`,"aria-hidden":!0}),(0,d.jsx)(s,{value:v,onChange:e=>x(e.target.value),placeholder:n,"aria-label":n})]}),p?(0,d.jsx)(`div`,{className:`oc-filterbar__quick`,children:p}):null,m&&h?(0,d.jsx)(l,{value:m,onChange:h}):null,(0,d.jsxs)(a,{variant:`ghost`,size:`sm`,className:`oc-filterbar__reset`,onClick:S,disabled:!_,children:[(0,d.jsx)(c,{}),r()]})]})}export{p as t};
@@ -0,0 +1 @@
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$d as r,AF as i,Ad as a,Bd as o,Cd as s,D as c,Dd as l,Ed as u,Fd as d,Gd as f,Hd as p,Id as m,Jd as h,Kd as g,Ld as _,Md as v,Nd as y,Od as b,Pd as x,Qd as S,Rd as ee,Sd as C,T as w,Td as te,Ud as ne,Vd as re,Wd as ie,Xd as T,Yd as ae,Zd as E,_d as D,ad as oe,af as O,bd as k,cd as se,cf as A,dd as ce,df as j,ef as M,fd as N,ff as le,gd as ue,hd as P,id as de,if as fe,jd as F,kF as I,kd as pe,ld as me,lf as he,md as ge,nf as _e,od as ve,of as ye,pd as be,qd as xe,rd as Se,rf as Ce,sd as L,sf as we,tf as Te,ud as R,uf as Ee,vd as De,wd as Oe,xd as ke,yd as Ae,zd as je}from"./dist-CAP0mn60.js";import{t as Me}from"./x-ChVRoy_h.js";import{i as z,n as B,r as Ne,t as Pe}from"./tabs-IFDKEY73.js";import{t as V}from"./button-DRguy6Hz.js";import{C as Fe,F as Ie,It as H,Lt as U,S as Le,T as Re,at as ze,d as Be,en as Ve,gt as He,it as W,lt as Ue,m as G,ot as We,rt as K,st as Ge,tn as Ke,ut as qe,w as Je,wt as q,x as Ye}from"./index-DcPINOh1.js";import{t as Xe}from"./FilterBar-XGMlTH00.js";import{t as Ze}from"./DataTableShell-Bo9JdV4-.js";import{t as J}from"./DetailChips-stIZjuDW.js";var Qe=c(`palette`,[[`path`,{d:`M12 22a1 1 0 0 1 0-20 10 9 0 0 1 10 9 5 5 0 0 1-5 5h-2.25a1.75 1.75 0 0 0-1.4 2.8l.3.4a1.75 1.75 0 0 1-1.4 2.8z`,key:`e79jfc`}],[`circle`,{cx:`13.5`,cy:`6.5`,r:`.5`,fill:`currentColor`,key:`1okk4w`}],[`circle`,{cx:`17.5`,cy:`10.5`,r:`.5`,fill:`currentColor`,key:`f64h9f`}],[`circle`,{cx:`6.5`,cy:`12.5`,r:`.5`,fill:`currentColor`,key:`qy21gx`}],[`circle`,{cx:`8.5`,cy:`7.5`,r:`.5`,fill:`currentColor`,key:`fotxhn`}]]),Y=c(`shield-check`,[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`,key:`oel41y`}],[`path`,{d:`m9 12 2 2 4-4`,key:`dzmm74`}]]),$e=c(`users`,[[`path`,{d:`M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2`,key:`1yyitq`}],[`path`,{d:`M16 3.128a4 4 0 0 1 0 7.744`,key:`16gr8j`}],[`path`,{d:`M22 21v-2a4 4 0 0 0-3-3.87`,key:`kshegd`}],[`circle`,{cx:`9`,cy:`7`,r:`4`,key:`nufk8`}]]),X=t(e(),1);function et(e,t,n){let r=t.trim().toLowerCase();return[...r?e.filter(e=>[e.email,e.name,e.canonical].some(e=>e!=null&&e.toLowerCase().includes(r))):e.slice()].sort((e,t)=>!n.has(e.userId)-+!n.has(t.userId))}function tt(e,t){let n=e.filter(e=>e.source===`discovered`),r=t.trim().toLowerCase();return r?n.filter(e=>(e.displayName??e.agentId).toLowerCase().includes(r)||e.agentId.toLowerCase().includes(r)):n}function nt(e){let t=e.name?.trim()??``,n=e.email?.trim()??``,r=e.canonical?.trim()||`u-${e.userId.slice(0,8)}`;return t?{primary:t,secondary:n||`@${r}`}:n?{primary:n,secondary:null}:{primary:`@${r}`,secondary:null}}function rt(e){switch(e){case`admin`:return y();case`user`:return v();case`pending`:return F();default:return e}}function Z(e,t){if(e.length===0)return`none`;let n=0;for(let r of e)t(r)&&n++;return n===0?`none`:n===e.length?`all`:`some`}function it(e,t,n){let r=Math.max(1,Math.ceil(e.length/n)),i=Math.min(Math.max(1,Math.floor(t)),r),a=(i-1)*n;return{pageItems:e.slice(a,a+n),page:i,pageCount:r}}var Q=n(),$={name:``,description:``};function at(){let e=i(w.groups.listGroups,{}),t=i(w.me.getMe,{host:He})?.role===`admin`,n=I(w.groups.createGroup),a=I(w.groups.updateGroup),o=I(w.groups.deleteGroup),s=Ie(),c=q(),[l,u]=(0,X.useState)(!1),[d,p]=(0,X.useState)(null),[m,_]=(0,X.useState)($),[v,y]=(0,X.useState)(null),[b,x]=(0,X.useState)(``),ee=(0,X.useMemo)(()=>{if(!e)return e;let t=b.trim().toLowerCase();return t?e.filter(e=>e.name.toLowerCase().includes(t)||(e.description??``).toLowerCase().includes(t)||e.members.some(e=>e.label.toLowerCase().includes(t))||e.agents.some(e=>e.toLowerCase().includes(t))||e.charts.some(e=>e.name.toLowerCase().includes(t))):e},[e,b]);function C(){p(null),_($),u(!0)}function te(e){p(e),_({name:e.name,description:e.description??``}),u(!0)}async function ne(){try{d?await a({groupId:d._id,name:m.name,description:m.description}):await n({name:m.name,description:m.description||void 0}),_($),p(null),u(!1)}catch(e){c.error(ve(),e)}}async function re(e){if(await s({title:xe({name:e.name}),description:g(),confirmWord:e.name,confirmLabel:f(),cancelLabel:r(),destructive:!0}))try{await o({groupId:e._id})}catch(e){c.error(oe(),e)}}return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:j()}),(0,Q.jsx)(Xe,{q:b,onQChange:x,onReset:()=>x(``),canReset:b!==``,searchPlaceholder:fe()}),(0,Q.jsx)(Ze,{title:le(),rows:ee,addLabel:Ee(),onAdd:t?C:void 0,emptyHint:he(),columns:[{header:A(),cell:e=>e.name,sort:e=>e.name},{header:we(),cell:e=>(0,Q.jsx)(J,{icon:(0,Q.jsx)($e,{size:12,"aria-hidden":!0}),total:e.memberCount,items:e.members.map(e=>({label:e.label,marker:e.manager?(0,Q.jsx)(Y,{size:11,"aria-hidden":!0}):null,highlight:e.manager}))}),sort:e=>e.memberCount},{header:ye(),cell:e=>(0,Q.jsx)(J,{icon:(0,Q.jsx)(U,{size:12,"aria-hidden":!0}),total:e.agentCount,items:e.agents.map(e=>({label:e}))}),sort:e=>e.agentCount},{header:O(),cell:e=>(0,Q.jsx)(J,{icon:(0,Q.jsx)(Qe,{size:12,"aria-hidden":!0}),total:e.chartCount,items:e.charts.map(e=>({label:e.name,marker:e.isDefault?(0,Q.jsx)(H,{size:11,fill:`currentColor`,"aria-hidden":!0}):null,highlight:e.isDefault}))}),sort:e=>e.chartCount}],rowActions:e=>[{label:Ce(),onSelect:()=>y({groupId:e._id,name:e.name})},...t?[{label:_e(),onSelect:()=>te(e)},{label:Te(),variant:`destructive`,onSelect:()=>void re(e)}]:[]]}),(0,Q.jsx)(Be,{open:l,onOpenChange:u,title:d?E():S(),description:T(),canSubmit:!!m.name.trim(),onSubmit:ne,submitLabel:M(),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:ae()}),(0,Q.jsx)(W,{value:m.name,onChange:e=>_({...m,name:e.target.value})})]}),(0,Q.jsxs)(`label`,{className:`oc-field`,children:[(0,Q.jsx)(`span`,{className:`oc-field__label`,children:h()}),(0,Q.jsx)(W,{value:m.description,onChange:e=>_({...m,description:e.target.value})})]})]})}),(0,Q.jsx)(ct,{groupId:v?.groupId??null,groupName:v?.name??``,open:v!==null,onOpenChange:e=>{e||y(null)}})]})}var ot=8;function st({page:e,pageCount:t,onPage:n}){return t<=1?null:(0,Q.jsxs)(`div`,{className:`oc-access__pager`,children:[(0,Q.jsxs)(V,{type:`button`,variant:`ghost`,size:`sm`,disabled:e<=1,onClick:()=>n(e-1),children:[(0,Q.jsx)(Ke,{size:14,"aria-hidden":!0}),m()]}),(0,Q.jsxs)(`span`,{className:`oc-access__pageinfo`,"aria-label":x({page:e,pages:t}),children:[e,` / `,t]}),(0,Q.jsxs)(V,{type:`button`,variant:`ghost`,size:`sm`,disabled:e>=t,onClick:()=>n(e+1),children:[d(),(0,Q.jsx)(Ve,{size:14,"aria-hidden":!0})]})]})}function ct({groupId:e,groupName:t,open:n,onOpenChange:r}){let s=i(w.groups.getGroup,n&&e?{groupId:e}:`skip`),c=i(w.groups.listAssignableInstances,n?{}:`skip`),l=i(w.groups.listAssignableUsers,n?{}:`skip`),d=I(w.groups.addMember),f=I(w.groups.removeMember),m=I(w.groups.bulkSetMembers),h=I(w.groups.setGroupManager),g=q(),[v,y]=(0,X.useState)(``),[x,S]=(0,X.useState)(``),[C,T]=(0,X.useState)(`members`),[ae,E]=(0,X.useState)(1),[D,oe]=(0,X.useState)(new Set),O=(0,X.useRef)(null),k=(0,X.useMemo)(()=>new Set((s?.members??[]).map(e=>e.userId)),[s]),A=(0,X.useMemo)(()=>new Set((s?.members??[]).filter(e=>e.manager).map(e=>e.userId)),[s]),j=s?.viewerIsAdmin===!0,M=(0,X.useMemo)(()=>new Set((s?.agents??[]).map(e=>`${e.instanceName}/${e.agentId}`)),[s]);(0,X.useEffect)(()=>{y(``),S(``),T(`members`),E(1),O.current=null},[n,e]),(0,X.useEffect)(()=>{E(1)},[v]),(0,X.useEffect)(()=>{n&&s&&e&&O.current!==e&&(O.current=e,oe(new Set((s.members??[]).map(e=>e.userId))))},[n,s,e]);let N=(0,X.useMemo)(()=>l?et(l,v,D):[],[l,v,D]);async function le(t,n){if(e)try{n?await f({groupId:e,userId:t}):await d({groupId:e,userId:t})}catch(e){g.error(de(),e)}}async function ue(t,n){if(e)try{await h({groupId:e,userId:t,manager:!n})}catch(e){g.error(se(),e)}}let P=Z(N,e=>k.has(e.userId)),fe=N.filter(e=>k.has(e.userId)).length,F=it(N,ae,ot);async function pe(){if(!e||N.length===0)return;let t=N.map(e=>e.userId);try{await m({groupId:e,userIds:t,member:P!==`all`})}catch(e){g.error(de(),e)}}return(0,Q.jsx)(ze,{open:n,onOpenChange:r,children:(0,Q.jsxs)(We,{className:`oc-access`,children:[(0,Q.jsxs)(Ue,{children:[(0,Q.jsx)(qe,{children:ie({name:t})}),(0,Q.jsx)(Ge,{children:ne()})]}),(0,Q.jsxs)(Pe,{value:C,onValueChange:T,className:`oc-access__tabs`,children:[(0,Q.jsxs)(Ne,{className:`w-full`,children:[(0,Q.jsxs)(z,{value:`members`,className:`flex-1 gap-1.5`,children:[(0,Q.jsx)($e,{size:13,"aria-hidden":!0}),p(),s?(0,Q.jsx)(K,{variant:`secondary`,className:`oc-access__tabcount`,children:k.size}):null]}),(0,Q.jsxs)(z,{value:`agents`,className:`flex-1 gap-1.5`,children:[(0,Q.jsx)(U,{size:13,"aria-hidden":!0}),o(),s?(0,Q.jsx)(K,{variant:`secondary`,className:`oc-access__tabcount`,children:M.size}):null]}),(0,Q.jsxs)(z,{value:`charts`,className:`flex-1 gap-1.5`,children:[(0,Q.jsx)(Qe,{size:13,"aria-hidden":!0}),Ae(),s?(0,Q.jsx)(K,{variant:`secondary`,className:`oc-access__tabcount`,children:s.chartCount}):null]})]}),(0,Q.jsx)(B,{value:`members`,children:l===void 0||s===void 0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:b()}):l.length===0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:u()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(W,{value:v,onChange:e=>y(e.target.value),placeholder:re(),className:`oc-access__search`}),N.length===0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:ee()}):(0,Q.jsxs)(Q.Fragment,{children:[N.length>1?(0,Q.jsxs)(`div`,{className:`oc-access__row oc-access__selectall`,children:[(0,Q.jsx)(G,{checked:P===`all`?!0:P===`some`?`indeterminate`:!1,onCheckedChange:()=>void pe(),"aria-label":_()}),(0,Q.jsx)(`span`,{className:`oc-access__label`,children:_()}),(0,Q.jsxs)(K,{variant:`outline`,className:`oc-access__count`,children:[fe,` / `,N.length]})]}):null,(0,Q.jsx)(`div`,{className:`oc-access__list`,children:F.pageItems.map(e=>{let t=k.has(e.userId),n=nt(e),r=A.has(e.userId);return(0,Q.jsxs)(`div`,{className:`oc-access__row`,children:[(0,Q.jsx)(G,{checked:t,onCheckedChange:()=>void le(e.userId,t),"aria-label":a({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)(K,{variant:`outline`,className:`oc-access__role`,children:rt(e.role)}),(0,Q.jsx)(`span`,{className:`oc-access__mgrslot`,children:t&&j?(0,Q.jsx)(V,{type:`button`,variant:`ghost`,size:`icon`,className:`shrink-0 oc-access__mgr${r?` oc-access__mgr--on`:``}`,"aria-pressed":r,"aria-label":r?me():R(),title:r?me():R(),onClick:()=>void ue(e.userId,r),children:(0,Q.jsx)(Y,{size:15,"aria-hidden":!0})}):t&&r?(0,Q.jsx)(`span`,{className:`oc-access__mgr oc-access__mgr--on`,role:`img`,"aria-label":ce(),title:ce(),children:(0,Q.jsx)(Y,{size:15,"aria-hidden":!0})}):null})]},e._id)})}),(0,Q.jsx)(st,{page:F.page,pageCount:F.pageCount,onPage:E})]})]})}),(0,Q.jsx)(B,{value:`agents`,children:c===void 0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:b()}):c.length===0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:te()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(W,{value:x,onChange:e=>S(e.target.value),placeholder:je(),className:`oc-access__search`}),(0,Q.jsx)(`div`,{className:`oc-access__list`,children:c.map(t=>(0,Q.jsx)(lt,{groupId:e,instanceName:t.name,kind:t.kind??`openclaw`,assigned:M,query:x},`${e}-${t._id}`))})]})}),(0,Q.jsx)(B,{value:`charts`,children:(0,Q.jsx)(ut,{groupId:e})})]})]})})}function lt({groupId:e,instanceName:t,kind:n,assigned:r,query:a}){let o=i(w.groups.listAssignableAgents,{instanceName:t}),c=I(w.groups.assignAgentToGroup),u=I(w.groups.removeAgentFromGroup),d=I(w.groups.bulkSetGroupAgents),f=q(),[p,m]=(0,X.useState)(1);if((0,X.useEffect)(()=>{m(1)},[a]),!e)return null;let h=tt(o?.agents??[],a),g=o?.discovery&&!o.discovery.lastPollOk;if(a.trim()&&h.length===0)return null;let v=h.filter(e=>e.presentInLastOk!==!1&&e.enabled!==!1),y=Z(v,e=>r.has(`${t}/${e.agentId}`)),b=it(h,p,ot);async function x(n,r){try{r?await u({groupId:e,instanceName:t,agentId:n}):await c({groupId:e,instanceName:t,agentId:n})}catch(e){f.error(Se(),e)}}async function S(){if(v.length===0)return;let n=v.map(e=>e.agentId);try{await d({groupId:e,instanceName:t,agentIds:n,assigned:y!==`all`})}catch(e){f.error(Se(),e)}}return(0,Q.jsxs)(`div`,{className:`oc-access__group`,children:[(0,Q.jsxs)(`div`,{className:`oc-access__instance`,children:[(0,Q.jsx)(U,{size:13,"aria-hidden":!0}),(0,Q.jsx)(`span`,{children:t}),(0,Q.jsx)(K,{variant:`outline`,className:`oc-access__kind`,children:n}),g?(0,Q.jsx)(K,{variant:`outline`,className:`oc-access__stale`,children:C()}):null]}),o===void 0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:l()}):h.length===0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:g?s():Oe()}):(0,Q.jsxs)(Q.Fragment,{children:[v.length>1?(0,Q.jsxs)(`div`,{className:`oc-access__row oc-access__selectall`,children:[(0,Q.jsx)(G,{checked:y===`all`?!0:y===`some`?`indeterminate`:!1,onCheckedChange:()=>void S(),"aria-label":_()}),(0,Q.jsx)(`span`,{className:`oc-access__label`,children:_()})]}):null,b.pageItems.map(e=>{let n=`${t}/${e.agentId}`,i=r.has(n),a=e.presentInLastOk===!1,o=!e.enabled;return(0,Q.jsxs)(`div`,{className:`oc-access__row${o?` is-disabled`:``}`,children:[(0,Q.jsx)(G,{checked:i,disabled:(a||o)&&!i,onCheckedChange:()=>void x(e.agentId,i),"aria-label":pe({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)(H,{size:14,fill:`currentColor`})}):null,a?(0,Q.jsx)(K,{variant:`outline`,className:`oc-access__gone`,children:ke()}):null]},e.agentId)}),(0,Q.jsx)(st,{page:b.page,pageCount:b.pageCount,onPage:m})]})]})}function ut({groupId:e}){let t=i(w.charts.listGroupChartSelection,e?{groupId:e}:`skip`),n=I(w.charts.assignChartToGroup),r=I(w.charts.removeChartFromGroup),a=I(w.charts.setGroupDefaultChart),o=I(w.charts.addChartToGroupPool),s=I(w.charts.removeChartFromGroupPool),c=q();if(!e)return null;if(t===void 0)return(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:b()});let{pool:l,addable:u,canManagePool:d}=t;if(l.length===0&&!d)return(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:De()});async function f(t,i){try{i?await r({groupId:e,chartKey:t}):await n({groupId:e,chartKey:t})}catch(e){c.error(L(),e)}}async function p(t){try{await a({groupId:e,chartKey:t})}catch(e){c.error(L(),e)}}async function m(t){try{await o({groupId:e,chartKey:t})}catch(e){c.error(L(),e)}}async function h(t){try{await s({groupId:e,chartKey:t})}catch(e){c.error(L(),e)}}return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`div`,{className:`oc-access__list`,children:l.map(e=>(0,Q.jsxs)(`div`,{className:`oc-access__row`,children:[(0,Q.jsx)(G,{checked:e.selected,onCheckedChange:()=>void f(e.chartKey,e.selected),"aria-label":ge({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":be(),title:be(),children:(0,Q.jsx)(H,{size:14,fill:`currentColor`})}):(0,Q.jsx)(V,{type:`button`,variant:`ghost`,size:`sm`,onClick:()=>void p(e.chartKey),children:N()}):null,d?(0,Q.jsx)(V,{type:`button`,variant:`ghost`,size:`sm`,"aria-label":P({name:e.name}),title:P({name:e.name}),onClick:()=>void h(e.chartKey),children:(0,Q.jsx)(Me,{size:14,"aria-hidden":!0})}):null]},e.chartKey))}),d?u.length>0?(0,Q.jsxs)(Ye,{value:``,onValueChange:e=>void m(e),children:[(0,Q.jsx)(Je,{size:`sm`,className:`oc-access__search`,children:(0,Q.jsx)(Re,{placeholder:ue()})}),(0,Q.jsx)(Le,{children:u.map(e=>(0,Q.jsx)(Fe,{value:e.chartKey,children:e.name},e.chartKey))})]}):l.length===0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:D()}):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{$S as r,AC as i,AF as a,AS as o,BC as s,BS as c,CC as l,CS as u,DC as d,DF as f,DS as p,EC as m,ES as h,FC as g,FS as _,GC as v,GS as y,HC as ee,HS as b,IC as x,IS as S,JS as C,J_ as te,KS as w,LC as ne,LS as T,MC as re,MS as ie,NC as ae,NS as oe,OC as se,OS as ce,PC as le,PS as ue,QS as de,RC as fe,RS as pe,SC as me,SS as he,T as E,TC as ge,UC as _e,US as ve,VC as ye,VS as be,WC as xe,WS as Se,XS as Ce,YS as we,ZS as Te,_C as Ee,_S as De,aC as Oe,aS as ke,ar as Ae,bC as je,bS as Me,bo as Ne,cC as D,cS as Pe,dC as Fe,dS as Ie,eC as Le,fC as Re,fS as ze,gC as Be,gS as Ve,hC as He,hS as Ue,iC as We,iS as Ge,ir as Ke,jC as O,jS as k,kC as qe,kF as A,kS as j,lC as Je,lS as Ye,mC as Xe,mS as Ze,mk as M,nC as Qe,nS as $e,oC as et,oS as tt,or as nt,pC as rt,pS as it,pk as N,qS as at,q_ as ot,rC as st,rS as ct,sC as lt,sS as ut,tC as dt,uC as ft,uS as pt,vC as mt,vS as ht,vo as gt,wC as _t,wS as vt,xC as yt,xS as bt,xo as xt,yC as St,yS as Ct,yo as wt,zC as Tt,zS as Et}from"./dist-CAP0mn60.js";import{a as Dt,c as Ot}from"./FieldLabel-DVIaWFle.js";import{t as P}from"./button-DRguy6Hz.js";import{C as F,F as kt,G as At,K as jt,S as I,T as L,at as R,d as Mt,it as z,lt as B,m as V,ot as H,q as Nt,rt as U,st as W,ut as G,w as K,wt as q,x as J}from"./index-DcPINOh1.js";import{t as Pt}from"./DataTableShell-Bo9JdV4-.js";import{InstanceConfigDialog as Ft}from"./BridgeTab-BpMpD4Gm.js";var Y=t(e(),1),X=[`conversational`,`documentary`,`summarizer`,`curator`],It=new Set(X),Lt=`conversational`;function Rt(e){let t=new Set((e??[]).filter(e=>It.has(e)));return t.size===0?[Lt]:X.filter(e=>t.has(e))}var Z=n(),Q={name:``,gatewayUrl:``,bridgeUrl:``,displayName:``,kind:`openclaw`,transport:`ws`,gatewayVersion:``,gatewayHttpUrl:``,streamTransport:Dt},zt={openclaw:[`token`,`deviceIdentity`],hermes:[`apiKey`]};function Bt(e){return{name:e.name,gatewayUrl:e.gatewayUrl,bridgeUrl:e.bridgeUrl??``,displayName:e.displayName??``,kind:e.kind??`openclaw`,transport:e.transport??`ws`,gatewayVersion:e.gatewayVersion??``,gatewayHttpUrl:e.gatewayHttpUrl??``,streamTransport:e.streamTransport??`reactive`}}function Vt(){let e=a(E.admin.listInstances,{}),t=a(E.agents.listAllInstanceAgents,{}),n=A(E.admin.upsertInstance),r=A(E.admin.deleteInstance),o=q(),[c,u]=(0,Y.useState)(!1),[f,p]=(0,Y.useState)(Q),[h,_]=(0,Y.useState)(null),[y,b]=(0,Y.useState)(null),[S,C]=(0,Y.useState)(null),[w,T]=(0,Y.useState)(null);async function ie(){try{await n({instanceId:w??void 0,name:f.name,gatewayUrl:f.gatewayUrl,bridgeUrl:f.bridgeUrl||void 0,displayName:f.displayName||void 0,kind:f.kind,transport:f.kind===`hermes`?f.transport:void 0,gatewayVersion:f.gatewayVersion||void 0,gatewayHttpUrl:f.gatewayHttpUrl||void 0,streamTransport:f.streamTransport}),p(Q),T(null),u(!1)}catch(e){o.error(_e(),e)}}return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`p`,{className:`oc-admin__hint`,children:[ee(),(0,Z.jsx)(`strong`,{children:ye()}),s()]}),(0,Z.jsx)(Pt,{title:Tt(),rows:e,addLabel:fe(),onAdd:()=>{T(null),p(Q),u(!0)},emptyHint:ne(),columns:[{header:x(),cell:e=>e.name,sort:e=>e.name},{header:g(),cell:e=>(0,Z.jsx)(U,{variant:`outline`,children:e.kind??`openclaw`}),sort:e=>e.kind??`openclaw`},{header:le(),cell:e=>e.gatewayUrl,sort:e=>e.gatewayUrl},{header:ae(),cell:e=>e.displayName??`—`,sort:e=>e.displayName??null},{header:v(),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)(U,{variant:r(e.agentId)?`default`:`outline`,title:r(e.agentId)?ct():void 0,children:[e.emoji?`${e.emoji} `:``,e.displayName??e.agentId]},e.agentId))})}}],rowActions:e=>[{label:qe(),onSelect:()=>{T(e._id),p(Bt(e)),u(!0)}},{label:xe(),onSelect:()=>_(e.name)},{label:Xe(),onSelect:()=>C(e)},{label:re(),onSelect:()=>b(e)},{label:O(),variant:`destructive`,onSelect:()=>void r({instanceId:e._id})}],bulkActions:[{label:O(),variant:`destructive`,onSelect:e=>e.forEach(e=>void r({instanceId:e}))}]}),(0,Z.jsx)(Mt,{open:c,onOpenChange:u,title:w?se():i(),description:m(),canSubmit:!!(f.name&&f.gatewayUrl),onSubmit:ie,submitLabel:ge(),children:(0,Z.jsxs)(`div`,{className:`oc-form`,children:[(0,Z.jsxs)($,{label:_t(),children:[(0,Z.jsx)(z,{value:f.name,disabled:w!==null,onChange:e=>p({...f,name:e.target.value})}),w?(0,Z.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:d()}):null]}),(0,Z.jsx)($,{label:l(),children:(0,Z.jsxs)(J,{value:f.kind,onValueChange:e=>p({...f,kind:e}),children:[(0,Z.jsx)(K,{size:`sm`,className:`w-40`,children:(0,Z.jsx)(L,{})}),(0,Z.jsxs)(I,{children:[(0,Z.jsx)(F,{value:`openclaw`,children:`OpenClaw`}),(0,Z.jsx)(F,{value:`hermes`,children:`Hermes`})]})]})}),f.kind===`hermes`?(0,Z.jsx)($,{label:nt(),children:(0,Z.jsxs)(J,{value:f.transport,onValueChange:e=>p({...f,transport:e}),children:[(0,Z.jsx)(K,{size:`sm`,className:`w-56`,children:(0,Z.jsx)(L,{})}),(0,Z.jsxs)(I,{children:[(0,Z.jsx)(F,{value:`ws`,children:Ae()}),(0,Z.jsx)(F,{value:`rest`,children:Ke()})]})]})}):null,(0,Z.jsx)($,{label:me(),children:(0,Z.jsx)(z,{value:f.gatewayUrl,onChange:e=>p({...f,gatewayUrl:e.target.value})})}),(0,Z.jsx)($,{label:yt(),children:(0,Z.jsx)(z,{value:f.bridgeUrl,placeholder:je(),onChange:e=>p({...f,bridgeUrl:e.target.value})})}),(0,Z.jsx)($,{label:St(),children:(0,Z.jsx)(z,{value:f.displayName,onChange:e=>p({...f,displayName:e.target.value})})}),(0,Z.jsxs)($,{label:te(),children:[(0,Z.jsxs)(J,{value:f.streamTransport,onValueChange:e=>p({...f,streamTransport:e}),children:[(0,Z.jsx)(K,{size:`sm`,className:`w-40`,children:(0,Z.jsx)(L,{})}),(0,Z.jsx)(I,{children:Ot.map(e=>(0,Z.jsx)(F,{value:e,children:e},e))})]}),(0,Z.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:ot()})]}),(0,Z.jsx)($,{label:mt(),children:(0,Z.jsx)(z,{value:f.gatewayVersion,placeholder:Ee(),onChange:e=>p({...f,gatewayVersion:e.target.value})})}),(0,Z.jsx)($,{label:Be(),children:(0,Z.jsx)(z,{value:f.gatewayHttpUrl,placeholder:He(),onChange:e=>p({...f,gatewayHttpUrl:e.target.value})})})]})}),(0,Z.jsx)(Zt,{instanceName:h,open:h!==null,onOpenChange:e=>{e||_(null)}}),y?(0,Z.jsx)(Ft,{instance:y,onClose:()=>b(null)},y._id):null,S?(0,Z.jsx)(Ht,{instance:S,onClose:()=>C(null)},S._id):null]})}function Ht({instance:e,onClose:t}){let n=a(E.instanceSecrets.listInstanceSecretStatus,{}),r=zt[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)(R,{open:!0,onOpenChange:e=>!e&&t(),children:(0,Z.jsxs)(H,{onOpenAutoFocus:e=>e.preventDefault(),children:[(0,Z.jsxs)(B,{children:[(0,Z.jsx)(G,{children:rt({instance:e.displayName??e.name})}),(0,Z.jsx)(W,{children:Re()})]}),(0,Z.jsx)(`div`,{className:`oc-form`,children:r.map(t=>(0,Z.jsx)(Gt,{instanceId:e._id,field:t,updatedAt:i[t]??null},t))}),(0,Z.jsx)(`div`,{className:`oc-bridgesecret`,children:(0,Z.jsx)(Wt,{instance:e})}),(0,Z.jsx)(Ut,{instance:e})]})})}function Ut({instance:e}){let t=f(E.instanceSync.forceInstanceSync),n=q(),[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(w());break;case`no_agents`:n.success(Se());break;case`no_bridge_url`:n.error(ve());break;case`deploy_misconfigured`:n.error(b());break;case`unauthorized`:n.error(c());break;case`not_served`:n.error(Et());break;default:n.error(be());break}}catch(e){n.error(y(),e)}finally{i(!1)}}}return(0,Z.jsxs)(`div`,{className:`oc-form`,children:[(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:pe()}),(0,Z.jsx)(`div`,{className:`flex items-center gap-2`,children:(0,Z.jsx)(P,{size:`sm`,variant:`outline`,onClick:()=>void a(),disabled:r,children:r?at():C()})})]})}function Wt({instance:e}){let t=a(E.bridgeAuth.listBridgeAuthStatus,{}),n=f(E.bridgeAuth.mintBridgeSecret),r=A(E.bridgeAuth.revokeBridgeSecret),i=q(),[s,c]=(0,Y.useState)(!1),[l,u]=(0,Y.useState)(null),[d,p]=(0,Y.useState)(!1),m=(t??[]).find(t=>t.instanceId===e._id),h=m!==void 0;async function g(){if(!s){c(!0);try{u((await n({instanceId:e._id})).plaintext),p(!1)}catch(e){i.error(k(),e)}finally{c(!1)}}}async function v(){if(!s){c(!0);try{await r({instanceId:e._id}),u(null),i.success(ie())}catch(e){i.error(k(),e)}finally{c(!1)}}}async function y(){if(l)try{await navigator.clipboard.writeText(l),p(!0)}catch{}}return(0,Z.jsxs)($,{label:T(),children:[(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:S()}),(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Z.jsx)(U,{variant:h?`outline`:`secondary`,children:h?`${D()} · ${m.prefix}…${m.lastFour}`:lt()}),(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(P,{size:`sm`,onClick:()=>void g(),disabled:s,children:h?ue():_()}),h?(0,Z.jsx)(P,{size:`sm`,variant:`destructive`,onClick:()=>void v(),disabled:s,children:oe()}):null]})]}),l?(0,Z.jsxs)(`div`,{className:`oc-bridgesecret__reveal`,children:[(0,Z.jsx)(`p`,{className:`oc-sa__minted-warning`,children:o()}),(0,Z.jsxs)(`div`,{className:`oc-sa__minted-box`,children:[(0,Z.jsx)(`code`,{className:`oc-sa__minted-plain`,children:l}),(0,Z.jsx)(P,{variant:`outline`,size:`sm`,onClick:()=>void y(),children:d?M():N()})]}),(0,Z.jsx)(P,{size:`sm`,variant:`ghost`,onClick:()=>{u(null),p(!1)},children:j()})]}):null]})}function Gt({instanceId:e,field:t,updatedAt:n}){let i=f(E.instanceSecrets.setInstanceSecret),a=A(E.instanceSecrets.clearInstanceSecret),o=f(E.deviceIdentity.generateDeviceIdentity),s=q(),[c,l]=(0,Y.useState)(``),[u,d]=(0,Y.useState)(!1),[p,m]=(0,Y.useState)(null),[h,g]=(0,Y.useState)(!1),_=n!==null,v=t===`deviceIdentity`,y=t===`token`?Fe():t===`deviceIdentity`?ft():Je();async function ee(){if(!(!c.trim()||u)){d(!0);try{await i({instanceId:e,field:t,plaintext:c}),l(``),m(null),g(!1),s.success(Qe())}catch(e){s.error(dt(),e)}finally{d(!1)}}}async function b(){if(!u){d(!0);try{await a({instanceId:e,field:t}),m(null),g(!1),s.success(Le())}catch(e){s.error(dt(),e)}finally{d(!1)}}}async function x(){if(!u){d(!0);try{m(await o({instanceId:e})),g(!1),s.success(Te())}catch(e){s.error(we(),e)}finally{d(!1)}}}let S=p?`openclaw devices approve ${p.id}`:``;async function C(){if(S)try{await navigator.clipboard.writeText(S),g(!0)}catch{}}return(0,Z.jsxs)($,{label:y,children:[v?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:de()}):null,(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Z.jsx)(U,{variant:_?`outline`:`secondary`,children:_?D():lt()}),(0,Z.jsx)(z,{type:`password`,autoComplete:`off`,className:`flex-1 min-w-32`,value:c,placeholder:_?Oe():et(),onChange:e=>l(e.target.value)}),(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(P,{size:`sm`,onClick:()=>void ee(),disabled:u||c.trim().length===0,children:We()}),v?(0,Z.jsx)(P,{size:`sm`,variant:`outline`,onClick:()=>void x(),disabled:u,children:r()}):null,_?(0,Z.jsx)(P,{size:`sm`,variant:`destructive`,onClick:()=>void b(),disabled:u,children:st()}):null]})]}),p?(0,Z.jsxs)(`div`,{className:`oc-bridgesecret__reveal`,children:[(0,Z.jsx)(`p`,{className:`text-sm font-medium`,children:Te()}),(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:Ce()}),(0,Z.jsxs)(`div`,{className:`oc-sa__minted-box`,children:[(0,Z.jsx)(`code`,{className:`oc-sa__minted-plain`,children:S}),(0,Z.jsx)(P,{variant:`outline`,size:`sm`,onClick:()=>void C(),children:h?M():N()})]}),(0,Z.jsx)(P,{size:`sm`,variant:`ghost`,onClick:()=>{m(null),g(!1)},children:j()})]}):null]})}var Kt={conversational:ht,documentary:Ve,summarizer:xt,curator:wt},qt={conversational:De,documentary:Ue,summarizer:Ne,curator:gt},Jt=e=>(Kt[e]??(()=>e))(),Yt=e=>(qt[e]??(()=>``))();function Xt({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:he()}),t.map(e=>(0,Z.jsx)(U,{variant:`secondary`,className:`oc-agenttype__chip`,title:Yt(e),children:Jt(e)},e)),(0,Z.jsxs)(At,{children:[(0,Z.jsx)(Nt,{asChild:!0,children:(0,Z.jsx)(P,{type:`button`,variant:`outline`,size:`sm`,className:`h-7`,children:bt()})}),(0,Z.jsxs)(jt,{align:`start`,className:`oc-agenttypes-pop`,children:[(0,Z.jsx)(`p`,{className:`oc-agenttypes-pop__title`,children:Me()}),(0,Z.jsx)(`p`,{className:`oc-agenttypes-pop__hint`,children:Ct()}),(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)(V,{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:Jt(r)}),(0,Z.jsx)(`span`,{className:`oc-agenttypes-pop__desc`,children:Yt(r)})]})]},r)})})]})]})]})}function Zt({instanceName:e,open:t,onOpenChange:n}){let r=a(E.agents.listAgentsForInstance,t&&e?{instanceName:e}:`skip`),i=A(E.agents.setAgentEnabled).withOptimisticUpdate((e,{instanceName:t,agentId:n,enabled:r})=>{let i=e.getQuery(E.agents.listAgentsForInstance,{instanceName:t});i&&e.setQuery(E.agents.listAgentsForInstance,{instanceName:t},{...i,agents:i.agents.map(e=>e.agentId===n?{...e,enabled:r}:e)})}),o=A(E.agents.setInstanceDefaultAgent).withOptimisticUpdate((e,{instanceName:t,agentId:n})=>{let r=e.getQuery(E.agents.listAgentsForInstance,{instanceName:t});r&&e.setQuery(E.agents.listAgentsForInstance,{instanceName:t},{...r,defaultAgentId:n})}),s=A(E.agents.setAgentTypes).withOptimisticUpdate((e,{instanceName:t,agentId:n,types:r})=>{let i=e.getQuery(E.agents.listAgentsForInstance,{instanceName:t});if(!i)return;let a=Rt(r);e.setQuery(E.agents.listAgentsForInstance,{instanceName:t},{...i,agents:i.agents.map(e=>e.agentId===n?{...e,types:a}:e)})}),c=A(E.agents.setAgentDescription).withOptimisticUpdate((e,{instanceName:t,agentId:n,description:r})=>{let i=e.getQuery(E.agents.listAgentsForInstance,{instanceName:t});if(!i)return;let a=r.trim();e.setQuery(E.agents.listAgentsForInstance,{instanceName:t},{...i,agents:i.agents.map(e=>e.agentId===n?{...e,description:a.length===0?null:a}:e)})}),l=A(E.agents.removeInstanceAgent),u=kt(),d=q();async function f(t,n){if(e)try{await i({instanceName:e,agentId:t,enabled:n})}catch(e){d.error(h(),e)}}async function m(t){if(e)try{await o({instanceName:e,agentId:t})}catch(e){d.error(h(),e)}}async function g(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){d.error(h(),e)}}async function _(t,n){if(e&&await u({title:ze({name:n}),description:Ie(),confirmLabel:pt(),destructive:!0}))try{await l({instanceName:e,agentId:t}),d.success(Ye())}catch(e){d.error(h(),e)}}return(0,Z.jsx)(R,{open:t,onOpenChange:n,children:(0,Z.jsxs)(H,{className:`oc-access`,children:[(0,Z.jsxs)(B,{children:[(0,Z.jsx)(G,{children:ce({name:e??``})}),(0,Z.jsx)(W,{children:p()})]}),r===void 0?(0,Z.jsx)(`p`,{className:`oc-access__hint`,children:Pe()}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`div`,{className:`oc-access__poll`,children:r.discovery===null?ut():r.discovery.lastPollOk?tt():ke({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(t=>{let n=t.presentInLastOk===!1,i=r.defaultAgentId===t.agentId,a=t.displayName??t.agentId,o=t.types??[];return(0,Z.jsxs)(`div`,{className:`oc-agentcard`+(t.enabled?``:` oc-agentcard--off`),children:[(0,Z.jsxs)(`div`,{className:`oc-agentcard__head`,children:[(0,Z.jsx)(V,{checked:t.enabled,disabled:n,"aria-label":a,onCheckedChange:e=>void f(t.agentId,e===!0)}),(0,Z.jsxs)(`span`,{className:`oc-agentcard__name`,title:a,children:[t.emoji?`${t.emoji} `:``,a]}),t.model?(0,Z.jsx)(`span`,{className:`oc-access__model`,children:t.model}):null,n?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(U,{variant:`outline`,className:`oc-access__gone`,children:$e()}),(0,Z.jsx)(P,{size:`sm`,variant:`ghost`,className:`h-7 text-destructive`,onClick:()=>void _(t.agentId,a),children:it()})]}):i?(0,Z.jsx)(U,{variant:`default`,children:ct()}):(0,Z.jsx)(P,{size:`sm`,variant:`outline`,className:`h-7`,disabled:!t.enabled,onClick:()=>void m(t.agentId),children:Ze()})]}),t.enabled?(0,Z.jsx)(Xt,{agentId:t.agentId,types:o,onToggle:e=>void g(t.agentId,e,o)}):null,t.enabled?(0,Z.jsx)(Qt,{value:t.description??``,onSave:async n=>{if(e)try{await c({instanceName:e,agentId:t.agentId,description:n})}catch(e){d.error(h(),e)}}}):null]},t.agentId)})})]})]})})}function Qt({value:e,onSave:t}){let[n,r]=(0,Y.useState)(e);(0,Y.useEffect)(()=>{r(e)},[e]);let i=()=>{n.trim()!==e.trim()&&t(n)};return(0,Z.jsx)(z,{className:`oc-agentcard__desc`,value:n,maxLength:280,placeholder:vt(),"aria-label":u(),onChange:e=>r(e.target.value),onBlur:i,onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),i())}})}function $({label:e,children:t}){return(0,Z.jsxs)(`label`,{className:`oc-field`,children:[(0,Z.jsx)(`span`,{className:`oc-field__label`,children:e}),t]})}export{Vt as InstancesTab};
@@ -0,0 +1 @@
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{AF as r,AT as i,Bs as a,CT as o,DF as s,DT as c,ET as l,FT as u,Fs as d,Hs as f,IT as p,Is as m,Ls as h,MT as g,NT as _,OT as v,PT as y,Ps as b,Rs as x,T as S,TT as C,Vs as w,jT as T,kF as E,kT as D,wT as O,zs as k}from"./dist-CAP0mn60.js";import{t as A}from"./button-DRguy6Hz.js";import{it as j,m as M,rt as N}from"./index-DcPINOh1.js";var P=t(e(),1),F=n();function I(){let e=r(S.integrations.status.status,{}),t=E(S.admin.setIntegrationConfig),[n,s]=(0,P.useState)(null);if((0,P.useEffect)(()=>{e&&n===null&&s(e.config)},[e,n]),!e||!n)return(0,F.jsx)(`p`,{className:`oc-admin__hint`,children:p()});let d=n,m=(e,t,n)=>s({...d,[e]:{...d[e],[t]:n}}),h=(e,n)=>void t({[e]:n});return(0,F.jsxs)(F.Fragment,{children:[(0,F.jsxs)(`p`,{className:`oc-admin__hint`,children:[u(),` `,(0,F.jsx)(`strong`,{children:y()}),` `,_()]}),(0,F.jsxs)(L,{title:`Langfuse`,status:e.langfuse.configured?e.langfuse.enabled?(0,F.jsx)(N,{variant:`secondary`,children:g()}):(0,F.jsx)(N,{variant:`outline`,children:T()}):(0,F.jsx)(N,{variant:`outline`,children:i()}),note:D(),children:[(0,F.jsx)(R,{label:c(),children:(0,F.jsx)(j,{value:d.langfuse.host??``,placeholder:e.langfuse.effectiveHost,onChange:e=>m(`langfuse`,`host`,e.target.value),onBlur:()=>h(`langfuse`,{host:d.langfuse.host??``})})}),(0,F.jsx)(z,{label:o(),checked:d.langfuse.enabled??!0,onChange:e=>{m(`langfuse`,`enabled`,e),h(`langfuse`,{enabled:e})}})]}),(0,F.jsxs)(L,{title:`Opik`,status:e.opik.configured?e.opik.enabled?(0,F.jsx)(N,{variant:`secondary`,children:g()}):(0,F.jsx)(N,{variant:`outline`,children:T()}):(0,F.jsx)(N,{variant:`outline`,children:i()}),note:v(),children:[(0,F.jsx)(R,{label:l(),children:(0,F.jsx)(j,{value:d.opik.baseUrl??``,placeholder:e.opik.effectiveBaseUrl,onChange:e=>m(`opik`,`baseUrl`,e.target.value),onBlur:()=>h(`opik`,{baseUrl:d.opik.baseUrl??``})})}),(0,F.jsx)(R,{label:C(),children:(0,F.jsx)(j,{value:d.opik.workspace??``,placeholder:e.opik.effectiveWorkspace||O(),onChange:e=>m(`opik`,`workspace`,e.target.value),onBlur:()=>h(`opik`,{workspace:d.opik.workspace??``})})}),(0,F.jsx)(z,{label:o(),checked:d.opik.enabled??!0,onChange:e=>{m(`opik`,`enabled`,e),h(`opik`,{enabled:e})}})]}),(0,F.jsxs)(L,{title:`OpenTelemetry (OTLP)`,status:e.otlp.configured?e.otlp.enabled?(0,F.jsx)(N,{variant:`secondary`,children:g()}):(0,F.jsx)(N,{variant:`outline`,children:T()}):(0,F.jsx)(N,{variant:`outline`,children:f()}),note:w(),children:[(0,F.jsx)(R,{label:a(),children:(0,F.jsx)(j,{value:d.otlp.endpoint??``,placeholder:e.otlp.effectiveEndpoint||`https://otlp.example.com/v1/traces`,onChange:e=>m(`otlp`,`endpoint`,e.target.value),onBlur:()=>h(`otlp`,{endpoint:d.otlp.endpoint??``})})}),(0,F.jsx)(B,{headersSet:e.otlp.headersSet}),(0,F.jsx)(z,{label:o(),checked:d.otlp.enabled??!0,onChange:e=>{m(`otlp`,`enabled`,e),h(`otlp`,{enabled:e})}})]})]})}function L({title:e,status:t,note:n,children:r}){return(0,F.jsxs)(`section`,{className:`oc-int__section`,children:[(0,F.jsxs)(`div`,{className:`oc-int__section-head`,children:[(0,F.jsx)(`h3`,{className:`oc-uipa__h`,children:e}),t]}),n?(0,F.jsx)(`p`,{className:`oc-uipa__note`,children:n}):null,(0,F.jsx)(`div`,{className:`oc-int__fields`,children:r})]})}function R({label:e,children:t}){return(0,F.jsxs)(`label`,{className:`oc-int__field`,children:[(0,F.jsx)(`span`,{className:`oc-int__field-label`,children:e}),t]})}function z({label:e,checked:t,onChange:n}){return(0,F.jsxs)(`label`,{className:`oc-int__toggle`,children:[(0,F.jsx)(M,{checked:t,onCheckedChange:e=>n(e===!0)}),(0,F.jsx)(`span`,{children:e})]})}function B({headersSet:e}){let t=s(S.integrations.otlpSecret.setOtlpHeaders),n=E(S.integrations.otlpSecret.clearOtlpHeaders),[r,i]=(0,P.useState)(``),[a,o]=(0,P.useState)(null),[c,l]=(0,P.useState)(!1),u=async()=>{l(!0),o(null);try{await t({headersJson:r}),i(``)}catch(e){o(e instanceof Error?e.message:String(e))}finally{l(!1)}};return(0,F.jsxs)(R,{label:k(),children:[(0,F.jsx)(j,{value:r,placeholder:e?x():h(),onChange:e=>i(e.target.value)}),(0,F.jsxs)(`div`,{className:`oc-int__otlp-headers-actions`,children:[(0,F.jsx)(A,{size:`sm`,disabled:c||r.trim().length===0,onClick:()=>void u(),children:m()}),e?(0,F.jsx)(A,{variant:`ghost`,size:`sm`,disabled:c,onClick:()=>void n({}),children:d()}):null]}),a?(0,F.jsx)(`p`,{className:`oc-int__otlp-headers-error`,children:a}):null,(0,F.jsx)(`p`,{className:`oc-uipa__note`,children:b()})]})}export{I as IntegrationsTab};
@@ -1 +1 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$h as r,Gh as i,Jh as a,Kh as o,NE as s,QT as c,Qh as l,T as u,Uh as d,Wh as f,Xh as p,Yh as m,ZT as h,Zh as g,aE as _,cE as v,eg as y,ng as b,oE as x,qh as S,sE as C,tg as w,yF as T}from"./dist-B1qnlN7I.js";import{gt as E,i as D,nn as ee,o as te,r as ne,rn as re}from"./index-rCasMjHB.js";import{a as O,n as k,o as A,r as j,t as M}from"./card-BwAm8Ufs.js";import{n as N,t as P}from"./TimeRangePicker-fvvxJ7HC.js";var F=t(e(),1),I=n(),L=15,R=e=>String(Math.round(e));function z(){let e=T(u.me.getMe,{host:E})?.permissions?.includes(`traces.read`)??!1,t=T(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:s()}),(0,I.jsxs)(M,{children:[(0,I.jsxs)(O,{children:[(0,I.jsx)(A,{children:v()}),(0,I.jsx)(j,{children:x()})]}),(0,I.jsx)(k,{children:n.length<2?(0,I.jsx)(`p`,{className:`oc-admin__hint`,children:_()}):(0,I.jsx)(B,{series:n})})]})]})}function B({series:e}){let t=e.map(e=>e.cP50),n=e.map(e=>e.aP50),r=Math.max(1,...t,...n),i=t=>6+t*468/(e.length-1),a=e=>74-e*68/r,o=e=>e.map((e,t)=>`${t===0?`M`:`L`}${i(t).toFixed(1)},${a(e).toFixed(1)}`).join(` `),s=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:[h(),` p50 `,R(s.cP50),` `,C()]}),(0,I.jsxs)(`span`,{children:[c(),` p50 `,R(s.aP50),` `,C()]})]}),(0,I.jsxs)(`svg`,{viewBox:`0 0 480 80`,className:`h-20 w-full`,preserveAspectRatio:`none`,role:`img`,"aria-label":v(),children:[(0,I.jsx)(`path`,{d:o(n),fill:`none`,style:{stroke:`var(--muted-foreground)`},strokeWidth:1.5}),(0,I.jsx)(`path`,{d:o(t),fill:`none`,style:{stroke:`var(--primary)`},strokeWidth:1.5})]})]})}var V=[{metric:`api.calls`,label:b(),unit:`/h`,group:`API`,isError:!1},{metric:`api.errors`,label:w(),unit:`/h`,group:`API`,isError:!0},{metric:`api.latency.avg_ms`,label:y(),unit:`ms`,group:`API`,isError:!1},{metric:`openclaw.ingest`,label:r(),unit:`/h`,group:`OpenClaw`,isError:!1},{metric:`chat.send`,label:l(),unit:`/h`,group:`Chat`,isError:!1},{metric:`assistant.stream.errors`,label:g(),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=re({from:`/settings/kpi`}),t=ee({from:`/settings/kpi`}),n=D(e.from,e.to,ne,`now`),r=e=>void t({search:t=>({...t,...te(e)})}),{from:i,to:o}=N(n),{rowLimit:s,buckets:c}=K(i,o),l=T(u.kpi.listKpis,{limit:s,filter:{from:i,to:o}}),d=(0,F.useMemo)(()=>{let e=new Map;for(let t of l??[]){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>c&&e.set(t,n.slice(n.length-c));return e},[l,c]),f=(0,I.jsxs)(I.Fragment,{children:[(0,I.jsxs)(`p`,{className:`oc-admin__hint`,children:[p(),` `,(0,I.jsx)(`span`,{className:`oc-filter__window`,children:m()})]}),(0,I.jsx)(J,{value:n,onChange:r})]});return l===void 0?(0,I.jsxs)(I.Fragment,{children:[f,(0,I.jsx)(z,{}),(0,I.jsx)(`p`,{className:`oc-admin__hint`,children:a()})]}):l.length===0?(0,I.jsxs)(I.Fragment,{children:[f,(0,I.jsx)(z,{}),(0,I.jsx)(`p`,{className:`oc-admin__hint`,children:S()})]}):(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=>(d.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:d.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:o({value:$(n.bucket)})}):(0,I.jsx)(`span`,{className:`oc-kpi__muted`,children:i()}),(0,I.jsx)(`span`,{className:`oc-kpi__muted`,children:f({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":d({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};
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$h as r,AF as i,T as a,WE as o,_E as s,ag as c,cE as l,cg as u,dg as d,eg as f,fg as p,gE as m,ig as h,lE as g,lg as _,ng as v,og as y,rg as b,sg as x,tg as S,ug as C,vE as w,yE as T}from"./dist-CAP0mn60.js";import{gt as E,i as D,in as ee,o as te,r as ne,rn as re}from"./index-DcPINOh1.js";import{a as O,n as k,o as A,r as j,t as M}from"./card-BTuOmZr0.js";import{n as N,t as P}from"./TimeRangePicker-DGb-YJj5.js";var F=t(e(),1),I=n(),L=15,R=e=>String(Math.round(e));function z(){let e=i(a.me.getMe,{host:E})?.permissions?.includes(`traces.read`)??!1,t=i(a.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:o()}),(0,I.jsxs)(M,{children:[(0,I.jsxs)(O,{children:[(0,I.jsx)(A,{children:T()}),(0,I.jsx)(j,{children:s()})]}),(0,I.jsx)(k,{children:n.length<2?(0,I.jsx)(`p`,{className:`oc-admin__hint`,children:m()}):(0,I.jsx)(B,{series:n})})]})]})}function B({series:e}){let t=e.map(e=>e.cP50),n=e.map(e=>e.aP50),r=Math.max(1,...t,...n),i=t=>6+t*468/(e.length-1),a=e=>74-e*68/r,o=e=>e.map((e,t)=>`${t===0?`M`:`L`}${i(t).toFixed(1)},${a(e).toFixed(1)}`).join(` `),s=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:[l(),` p50 `,R(s.cP50),` `,w()]}),(0,I.jsxs)(`span`,{children:[g(),` p50 `,R(s.aP50),` `,w()]})]}),(0,I.jsxs)(`svg`,{viewBox:`0 0 480 80`,className:`h-20 w-full`,preserveAspectRatio:`none`,role:`img`,"aria-label":T(),children:[(0,I.jsx)(`path`,{d:o(n),fill:`none`,style:{stroke:`var(--muted-foreground)`},strokeWidth:1.5}),(0,I.jsx)(`path`,{d:o(t),fill:`none`,style:{stroke:`var(--primary)`},strokeWidth:1.5})]})]})}var V=[{metric:`api.calls`,label:p(),unit:`/h`,group:`API`,isError:!1},{metric:`api.errors`,label:d(),unit:`/h`,group:`API`,isError:!0},{metric:`api.latency.avg_ms`,label:C(),unit:`ms`,group:`API`,isError:!1},{metric:`openclaw.ingest`,label:_(),unit:`/h`,group:`OpenClaw`,isError:!1},{metric:`chat.send`,label:u(),unit:`/h`,group:`Chat`,isError:!1},{metric:`assistant.stream.errors`,label:x(),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=re({from:`/settings/kpi`}),n=D(e.from,e.to,ne,`now`),r=e=>void t({search:t=>({...t,...te(e)})}),{from:o,to:s}=N(n),{rowLimit:l,buckets:u}=K(o,s),d=i(a.kpi.listKpis,{limit:l,filter:{from:o,to:s}}),f=(0,F.useMemo)(()=>{let e=new Map;for(let t of d??[]){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>u&&e.set(t,n.slice(n.length-u));return e},[d,u]),p=(0,I.jsxs)(I.Fragment,{children:[(0,I.jsxs)(`p`,{className:`oc-admin__hint`,children:[y(),` `,(0,I.jsx)(`span`,{className:`oc-filter__window`,children:c()})]}),(0,I.jsx)(J,{value:n,onChange:r})]});return d===void 0?(0,I.jsxs)(I.Fragment,{children:[p,(0,I.jsx)(z,{}),(0,I.jsx)(`p`,{className:`oc-admin__hint`,children:h()})]}):d.length===0?(0,I.jsxs)(I.Fragment,{children:[p,(0,I.jsx)(z,{}),(0,I.jsx)(`p`,{className:`oc-admin__hint`,children:b()})]}):(0,I.jsxs)(I.Fragment,{children:[p,(0,I.jsx)(z,{}),U.map(e=>{let t=V.filter(t=>t.group===e);return t.some(e=>(f.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:f.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:v({value:$(n.bucket)})}):(0,I.jsx)(`span`,{className:`oc-kpi__muted`,children:S()}),(0,I.jsx)(`span`,{className:`oc-kpi__muted`,children:f({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 i=e.reduce((e,t)=>t.value>e?t.value:e,0),a=X/e.length,o=Math.max(a-ie,1);return(0,I.jsx)(`svg`,{className:`oc-kpi__chart`,viewBox:`0 0 ${X} ${Z}`,preserveAspectRatio:`none`,role:`img`,"aria-label":r({max:Q(i),unit:n}),children:e.map((e,r)=>{let s=i>0?e.value/i*(Z-1):0,c=r*a,l=Z-s;return(0,I.jsx)(`rect`,{className:`oc-kpi__bar`+(t&&e.value>0?` oc-kpi__bar--error`:``),x:c,y:l,width:o,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{$A as r,$P as i,AA as a,AF as o,BA as s,DA as c,E as l,EA as u,Et as d,FA as f,GA as ee,HA as te,IA as ne,JA as re,KA as ie,LA as ae,MA as oe,Mt as se,NA as p,OA as ce,PA as le,QA as ue,QP as de,RA as fe,T as m,TC as pe,UA as me,VA as he,WA as h,XA as g,XP as _,YA as v,ZA as y,ZP as b,_t as x,aF as S,aj as C,cF as w,cj as T,dF as E,dj as D,dt as O,eF as k,ej as A,fF as j,ft as M,gF as N,gt as P,ht as F,iF as I,ij as L,jA as R,jt as ge,kA as _e,kF as z,lF as ve,lj as ye,mt as be,nF as xe,nj as Se,oF as Ce,oj as we,pF as Te,pt as Ee,qA as De,rF as Oe,rj as ke,sF as Ae,sj as je,tF as Me,tj as Ne,uF as Pe,uj as Fe,vt as Ie,xF as Le,zA as B}from"./dist-CAP0mn60.js";import{t as V}from"./button-DRguy6Hz.js";import{C as H,S as Re,T as ze,gt as U,ht as Be,it as W,j as Ve,m as G,mt as He,pt as Ue,rt as K,t as We,w as Ge,wt as Ke,x as qe}from"./index-DcPINOh1.js";import{t as Je}from"./localePickerView-C2RmOS86.js";var q=t(e(),1),J=n();function Ye({className:e,checked:t,onCheckedChange:n,disabled:r,...i}){return(0,J.jsx)(`button`,{type:`button`,role:`switch`,"aria-checked":t,"data-state":t?`checked`:`unchecked`,disabled:r,onClick:()=>n(!t),className:l(`peer inline-flex h-5 w-9 shrink-0 items-center rounded-full border border-transparent transition-colors outline-none`,`focus-visible:ring-2 focus-visible:ring-ring/50`,`disabled:cursor-not-allowed disabled:opacity-50`,t?`bg-primary`:`bg-input`,e),...i,children:(0,J.jsx)(`span`,{className:l(`pointer-events-none block size-4 rounded-full bg-background shadow transition-transform`,t?`translate-x-[18px]`:`translate-x-[2px]`)})})}var Y=[{id:`messages`,label:()=>D()},{id:`composer`,label:()=>Fe()},{id:`sidebar`,label:()=>ye()},{id:`notifications`,label:()=>ie()},{id:`other`,label:()=>T()}],X={showSource:{category:`messages`,label:()=>je(),help:()=>we()},showReport:{category:`messages`,label:()=>C(),help:()=>L()},copyAssistant:{category:`messages`,label:()=>ke()},copyUser:{category:`messages`,label:()=>Se()},showDelete:{category:`messages`,label:()=>Ne()},showTools:{category:`messages`,label:()=>A(),help:()=>r()},voiceInput:{category:`composer`,label:()=>ue(),help:()=>y()},showUsage:{category:`composer`,label:()=>g(),help:()=>v()},autoReadAloud:{category:`composer`,label:()=>se(),help:()=>ge()},showChatAge:{category:`sidebar`,label:()=>re(),help:()=>De()},notifSound:{category:`notifications`,label:()=>ee(),help:()=>h()},notifSystem:{category:`notifications`,label:()=>me(),help:()=>te()},replySound:{category:`notifications`,label:()=>he(),help:()=>s()}};function Z(e){return e.toLowerCase().normalize(`NFD`).replace(/\p{Diacritic}/gu,``)}function Q(e,t){let n=Z(t.trim()),r=new Map(Y.map(e=>[e.id,e.label()])),i=new Map(Y.map(e=>[e.id,[]]));for(let t of e){let e=X[t],a=e?.category??`other`;n&&!Z(`${e?e.label():t} ${e?.help?e.help():``} ${t} ${r.get(a)??``}`).includes(n)||i.get(a).push(t)}return Y.map(e=>({id:e.id,label:r.get(e.id),keys:i.get(e.id)})).filter(e=>e.keys.length>0)}var Xe=[`showSource`,`showReport`,`copyAssistant`,`copyUser`,`showDelete`,`showTools`,`voiceInput`,`showChatAge`,`showUsage`,`autoReadAloud`,`notifSound`,`notifSystem`,`replySound`],Ze={voiceInput:`voiceInput`};function Qe(e){return Xe.includes(e)}function $(e){return e===`admin`}function $e(e){return e===!0?`on`:e===!1?`off`:`inherit`}function et(e){return e===`on`?!0:e===`off`?!1:null}function tt(e){return Qe(e)?Ze[e]:void 0}var nt={voiceInput:()=>a()};function rt({prefKey:e,ui:t}){let n=z(m.admin.setUiPrefDefault),r=z(m.admin.setFeatureEnabled),i=tt(e),a=i?nt[e]?.():void 0;return(0,J.jsxs)(`div`,{className:`oc-prefs__gov`,children:[(0,J.jsxs)(`div`,{className:`oc-prefs__gov-row`,children:[(0,J.jsx)(`span`,{className:`oc-prefs__gov-label`,children:le()}),(0,J.jsxs)(qe,{value:$e(t.defaults[e]),onValueChange:t=>void n({key:e,value:et(t)}),children:[(0,J.jsx)(Ge,{size:`sm`,className:`w-36`,children:(0,J.jsx)(ze,{})}),(0,J.jsxs)(Re,{children:[(0,J.jsx)(H,{value:`on`,children:ce()}),(0,J.jsx)(H,{value:`off`,children:c()}),(0,J.jsx)(H,{value:`inherit`,children:u()})]})]}),i?(0,J.jsxs)(`span`,{className:`oc-prefs__gov-gate`,children:[(0,J.jsx)(G,{checked:t.featuresEnabled[i]===!0,onCheckedChange:e=>void r({key:i,enabled:e===!0}),"aria-label":p()}),p()]}):null]}),a?(0,J.jsx)(`span`,{className:`oc-prefs__gov-help`,children:a}):null]})}function it({current:e,enabled:t}){let n=z(m.me.setDictationShortcut),[r,i]=(0,q.useState)(!1),[a,o]=(0,q.useState)(!1);return(0,q.useEffect)(()=>{if(!r)return;let e=e=>{if(e.preventDefault(),e.stopPropagation(),e.key===`Escape`){i(!1);return}let t=He(e);if(t===null){[`Shift`,`Control`,`Meta`,`Alt`].includes(e.key)||(o(!0),window.setTimeout(()=>o(!1),1800));return}i(!1),n({shortcut:t})};return window.addEventListener(`keydown`,e,!0),()=>window.removeEventListener(`keydown`,e,!0)},[r,n]),(0,J.jsxs)(`div`,{className:`oc-prefs__row${t?``:` is-locked`}`,children:[(0,J.jsxs)(`div`,{className:`oc-prefs__info`,children:[(0,J.jsxs)(`span`,{className:`oc-prefs__label`,children:[Ie(),e?(0,J.jsx)(K,{variant:`secondary`,children:Be(e,Ue())}):null]}),(0,J.jsx)(`span`,{className:`oc-prefs__help`,children:a?F():r?P():x()})]}),(0,J.jsxs)(`div`,{className:`oc-prefs__ctl`,children:[e&&!r?(0,J.jsx)(`button`,{type:`button`,className:`oc-prefs__reset`,onClick:()=>void n({shortcut:null}),children:O()}):null,(0,J.jsx)(`button`,{type:`button`,className:`oc-prefs__reset`,disabled:!t,"aria-pressed":r,onClick:()=>i(e=>!e),children:r?M():e?Ee():be()})]})]})}function at(){let[e,t]=(0,q.useState)(``),[n,r]=(0,q.useState)(!1),i=o(m.me.getMe,{host:U}),a=i?.ui,s=$(i?.role)&&n,c=z(m.me.setUiPref).withOptimisticUpdate(Ve),l=(0,q.useMemo)(()=>a?Q(Object.keys(a.effective),e):[],[a,e]);return a?(0,J.jsxs)(`div`,{className:`oc-prefs-panel`,children:[$(i?.role)?(0,J.jsxs)(`label`,{className:`oc-prefs__gov-toggle`,children:[(0,J.jsx)(G,{checked:n,onCheckedChange:e=>r(e===!0),"aria-label":f()}),f()]}):null,s?(0,J.jsxs)(`div`,{className:`oc-prefs__gov-head`,children:[(0,J.jsx)(`p`,{children:oe()}),(0,J.jsx)(`p`,{children:R()}),(0,J.jsx)(`p`,{children:_e()})]}):null,(0,J.jsx)(W,{value:e,onChange:e=>t(e.target.value),placeholder:B(),"aria-label":B(),className:`mb-2`}),l.length===0?(0,J.jsx)(`div`,{className:`oc-prefs__empty`,children:fe()}):(0,J.jsx)(`div`,{className:`oc-prefs`,children:l.map(e=>(0,J.jsxs)(`section`,{className:`oc-prefs__card`,children:[(0,J.jsx)(`h4`,{className:`oc-prefs__cat`,children:e.label}),e.keys.map(e=>{let t=X[e],n=t?t.label():e,r=t?.help?.(),i=a.locked[e],o=a.effective[e],l=a.userOverrides[e]!==void 0;return(0,J.jsxs)(`div`,{className:`oc-prefs__row${i?` is-locked`:``}`,children:[(0,J.jsxs)(`div`,{className:`oc-prefs__info`,children:[(0,J.jsxs)(`span`,{className:`oc-prefs__label`,children:[n,i?(0,J.jsx)(K,{variant:`outline`,children:ae()}):l?(0,J.jsx)(K,{variant:`secondary`,children:d()}):null]}),r?(0,J.jsx)(`span`,{className:`oc-prefs__help`,children:r}):null]}),(0,J.jsxs)(`div`,{className:`oc-prefs__ctl`,children:[!i&&l?(0,J.jsx)(`button`,{type:`button`,className:`oc-prefs__reset`,onClick:()=>void c({key:e,value:null}),children:ne()}):null,(0,J.jsx)(Ye,{checked:o,disabled:i,onCheckedChange:t=>{e===`notifSystem`&&t&&typeof Notification<`u`&&Notification.permission==="default"&&Notification.requestPermission(),c({key:e,value:t})},"aria-label":n})]}),s?(0,J.jsx)(rt,{prefKey:e,ui:a}):null]},e)})]},e.id))}),(0,J.jsx)(it,{current:i?.dictationShortcut??null,enabled:a.effective.voiceInput===!0})]}):(0,J.jsx)(`div`,{className:`oc-prefs__empty`,children:Le()})}var ot={sm:()=>Me(),md:()=>k(),lg:()=>i(),xl:()=>de()};function st(){let e=o(m.me.getMe,{host:U}),t=z(m.me.setLocale),n=z(m.me.setFontScale).withOptimisticUpdate((e,{scale:t})=>{let n=e.getQuery(m.me.getMe,{host:U});n&&e.setQuery(m.me.getMe,{host:U},{...n,fontScale:t,resolvedFontScale:t??`md`})}),r=z(m.me.setMyName),i=Ke(),a=e?.locale??`default`,s=e?.name??``,[c,l]=(0,q.useState)(null),u=c??s,d=u.trim()!==s.trim();async function f(){try{await r({name:u}),l(null),i.success(ve())}catch(e){i.error(w(),e)}}return(0,J.jsxs)(`div`,{className:`oc-appearance`,children:[(0,J.jsxs)(`section`,{className:`oc-show__section`,children:[(0,J.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,J.jsx)(`h2`,{className:`oc-show__title`,children:Te()}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:j()})]}),(0,J.jsxs)(`div`,{className:`oc-show__row`,children:[(0,J.jsx)(W,{className:`max-w-xs`,value:u,maxLength:120,placeholder:E(),onChange:e=>l(e.target.value),onKeyDown:e=>{e.key===`Enter`&&d&&(e.preventDefault(),f())}}),(0,J.jsx)(V,{size:`sm`,disabled:!d,onClick:()=>void f(),children:pe()})]}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:Pe()})]}),(0,J.jsxs)(`section`,{className:`oc-show__section`,children:[(0,J.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,J.jsx)(`h2`,{className:`oc-show__title`,children:Ae()}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:Ce()})]}),(0,J.jsxs)(`div`,{className:`oc-show__row`,children:[Je().map(e=>(0,J.jsx)(V,{variant:a===e.value?`default`:`outline`,size:`sm`,onClick:()=>void t({locale:e.value}),children:e.label},e.value)),(0,J.jsx)(V,{variant:a==="default"?`default`:`outline`,size:`sm`,onClick:()=>void t({locale:null}),children:N()})]}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:S()})]}),(0,J.jsxs)(`section`,{className:`oc-show__section`,children:[(0,J.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,J.jsx)(`h2`,{className:`oc-show__title`,children:I()}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:Oe()})]}),(0,J.jsx)(`div`,{className:`oc-show__row`,children:We.map(t=>(0,J.jsx)(V,{variant:(e?.fontScale??`md`)===t?`default`:`outline`,size:`sm`,onClick:()=>void n({scale:t}),children:ot[t]()},t))}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:xe()})]}),(0,J.jsxs)(`section`,{className:`oc-show__section`,children:[(0,J.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,J.jsx)(`h2`,{className:`oc-show__title`,children:b()}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:_()})]}),(0,J.jsx)(at,{})]})]})}export{st as PreferencesTab};
@@ -0,0 +1,4 @@
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{AF as r,A_ as i,B_ as a,Bi as o,Co as s,D_ as c,E_ as l,Eo as u,F_ as d,H_ as f,Hi as p,I_ as m,L_ as h,Li as g,M_ as _,N_ as v,O_ as ee,P_ as te,Q_ as ne,R_ as re,Ri as y,So as ie,T as b,T_ as x,To as S,U_ as C,V_ as w,Vi as T,W_ as ae,Z_ as E,cr as D,j_ as O,kF as k,k_ as A,lr as j,sr as M,wo as N,z_ as P,zi as F}from"./dist-CAP0mn60.js";import{d as I,f as L,i as R,l as z,n as B,r as V,t as oe,u as H}from"./FieldLabel-DVIaWFle.js";import{t as U}from"./button-DRguy6Hz.js";import{C as W,S as G,T as K,gt as q,m as se,w as J,wt as ce,x as Y}from"./index-DcPINOh1.js";import{r as X,t as le}from"./locales-CPjguROj.js";import{t as ue}from"./localePickerView-C2RmOS86.js";/* empty css */var Z=t(e(),1),Q=n(),$={media_delivery:{label:P,help:re},documentary_fetch:{label:h,help:m},inbound_files:{label:d,help:te},history_summary:{label:u,help:S},file_curation:{label:p,help:T}},de={outboundDir:`/home/node/.openclaw/media/outbound`,references:`- gdrive/1a2b3c4d5e6f7890abcd
2
+ - gdrive/0f9e8d7c6b5a4321dcba`,files:`- /home/node/.openclaw/media/inbound/rapport.pdf (124800 o, application/pdf)`,previous_summary:`Projet Alpha : budget 40 000 EUR ; choix du serveur en cours.`,new_messages:`Utilisateur : Compare OVH et Scaleway.
3
+ Assistant : Comparaison en cours.`,max_chars:`6000`,file_name:`MEMORY.md`,budget_chars:`20000`,feedback:`Trop de suppressions dans la section des liens, garde-les.`,content:`# Memory index
4
+ - [Fait 1](fait-1.md) - note du projet`},fe={outboundDir:c,references:l,files:x,previous_summary:N,new_messages:s,max_chars:ie,file_name:o,budget_chars:F,feedback:y,content:g};function pe(){let e=r(b.admin.listInstances,{}),[t,n]=(0,Z.useState)(null);if(e===void 0)return(0,Q.jsx)(`div`,{className:`oc-settings__tab-loading`,"aria-busy":`true`});if(e.length===0)return(0,Q.jsx)(`div`,{className:`oc-injtab`,children:(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:_()})});let i=e.find(e=>e._id===t)??e[0];return(0,Q.jsxs)(`div`,{className:`oc-injtab`,children:[(0,Q.jsxs)(`div`,{className:`oc-injtab__head`,children:[(0,Q.jsx)(B,{label:ae(),help:C()}),(0,Q.jsxs)(`label`,{className:`oc-injtab__picker`,children:[(0,Q.jsx)(`span`,{children:v()}),(0,Q.jsxs)(Y,{value:i._id,onValueChange:e=>n(e),children:[(0,Q.jsx)(J,{size:`sm`,className:`min-w-44`,children:(0,Q.jsx)(K,{})}),(0,Q.jsx)(G,{children:e.map(e=>(0,Q.jsx)(W,{value:e._id,children:e.displayName??e.name},e._id))})]})]})]}),(0,Q.jsx)(me,{instance:i},i._id)]})}function me({instance:e}){let t=k(b.admin.upsertInstanceConfig),n=ce(),i=r(b.me.getMe,{host:q}),a=e.config??{},o=X(e.config?.contentLocale,i?.defaultLocale??void 0),[s,c]=(0,Z.useState)(()=>R(a,o));(0,Z.useEffect)(()=>{c(R(a,o))},[o,e._id]);let[l,u]=(0,Z.useState)(!1),d=s.promptInjections,f=(e,t)=>c({...s,promptInjections:{...d,[e]:{...d[e],...t}}});async function p(){u(!0);try{await t({instanceId:e._id,config:V(s,a,o)})}catch(e){n.error(E(),e)}finally{u(!1)}}async function m(r){let i={...e.config??{}};r==="default"?delete i.contentLocale:i.contentLocale=r;try{await t({instanceId:e._id,config:i})}catch(e){n.error(E(),e)}}let h=e.config?.contentLocale??`default`,g=le[X(void 0,i?.defaultLocale??void 0)];return(0,Q.jsxs)(`div`,{className:`oc-injtab__body`,children:[(0,Q.jsxs)(`div`,{className:`oc-injtab__content-locale`,children:[(0,Q.jsx)(`span`,{children:j()}),(0,Q.jsxs)(Y,{value:h,onValueChange:e=>void m(e),children:[(0,Q.jsx)(J,{size:`sm`,className:`min-w-44`,children:(0,Q.jsx)(K,{})}),(0,Q.jsxs)(G,{children:[(0,Q.jsx)(W,{value:`default`,children:M({locale:g})}),ue().map(e=>(0,Q.jsx)(W,{value:e.value,children:e.label},e.value))]})]}),(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:D()})]}),H.map(e=>(0,Q.jsx)(he,{injKey:e,def:z[e],i18n:$[e],row:d[e]??{enabled:!0,template:z[e].defaultTemplate[o]},contentLocale:o,onChange:t=>f(e,t)},e)),(0,Q.jsx)(`div`,{className:`oc-injtab__actions`,children:(0,Q.jsx)(U,{size:`sm`,onClick:()=>void p(),disabled:l,children:ne()})})]})}function he({injKey:e,def:t,i18n:n,row:r,contentLocale:o,onChange:s}){let[c,l]=(0,Z.useState)(!1),u=r.template.trim()!==t.defaultTemplate[o],d=t.togglable&&!r.enabled,p=Object.fromEntries(t.placeholders.map(e=>[e,de[e]??`{${e}}`])),m=I(e,r,o),h=m?L(m,p):``;return(0,Q.jsxs)(`section`,{className:`oc-injcard`,children:[(0,Q.jsxs)(`div`,{className:`oc-injcard__head`,children:[t.togglable?(0,Q.jsxs)(`label`,{className:`oc-field--row`,children:[(0,Q.jsx)(se,{checked:r.enabled,onCheckedChange:e=>s({enabled:e===!0})}),(0,Q.jsx)(B,{label:n.label(),help:n.help()})]}):(0,Q.jsx)(B,{label:n.label(),help:n.help()}),u&&(0,Q.jsx)(`span`,{className:`oc-injection__badge`,children:w()})]}),(0,Q.jsx)(`textarea`,{className:`oc-injcard__text`,value:r.template,disabled:d,rows:8,spellCheck:!1,onChange:e=>s({template:e.target.value})}),(0,Q.jsxs)(`div`,{className:`oc-injection__foot`,children:[(0,Q.jsxs)(`div`,{className:`oc-injcard__phs`,children:[(0,Q.jsx)(`span`,{className:`oc-injection__ph`,children:a()}),t.placeholders.map(e=>(0,Q.jsxs)(`span`,{className:`oc-injcard__ph-chip`,children:[(0,Q.jsx)(`code`,{children:`{${e}}`}),(0,Q.jsx)(oe,{text:(fe[e]??(()=>e))()})]},e))]}),(0,Q.jsxs)(`div`,{className:`oc-injcard__btns`,children:[(0,Q.jsx)(U,{variant:`ghost`,size:`sm`,onClick:()=>l(e=>!e),children:c?i():O()}),u&&(0,Q.jsx)(U,{variant:`ghost`,size:`sm`,onClick:()=>s({template:t.defaultTemplate[o]}),children:f()})]})]}),c&&(0,Q.jsx)(`div`,{className:`oc-injcard__preview`,children:h?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`pre`,{className:`oc-injcard__previewtext`,children:h}),(0,Q.jsx)(`span`,{className:`oc-injection__ph`,children:A()})]}):(0,Q.jsx)(`span`,{className:`oc-injection__ph`,children:ee()})})]})}export{pe as PromptInjectionsTab};
@@ -0,0 +1 @@
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$b as r,AF as ee,Ax as i,Bx as a,Cx as o,Dx as s,Ex as c,Fx as l,Ix as u,Lx as d,Mx as f,Nx as p,Ox as m,Px as h,Qb as te,Rx as g,Sx as ne,T as _,Tx as v,Zb as re,_x as y,ax as b,bx as ie,dx as x,ex as S,fa as C,fx as ae,gx as w,hx as T,ix as E,jx as D,kF as O,kx as k,mx as A,nx as j,px as M,rx as N,tx as P,vx as F,wx as I,xx as L,yx as R,zx as z}from"./dist-CAP0mn60.js";import{t as B}from"./button-DRguy6Hz.js";import{F as V,Gt as H,d as U,it as W,m as G,rt as K,wt as q}from"./index-DcPINOh1.js";import{t as J}from"./roleDescriptions-B6dQdyoM.js";var Y=t(e(),1),X=n(),Z=[{group:()=>a(),keys:[{key:`traces.read`,label:()=>l()},{key:`traces.read.content`,label:()=>h(),phi:!0},{key:`traces.write`,label:()=>p()}]},{group:()=>z(),keys:[{key:`kpi.read`,label:()=>l()},{key:`kpi.write`,label:()=>p()}]},{group:()=>g(),keys:[{key:`openclaw.query`,label:()=>f()},{key:`anomalies.read`,label:()=>D()},{key:`anomalies.report`,label:()=>i()}]},{group:()=>d(),keys:[{key:`chats.read`,label:()=>l()},{key:`selfheal`,label:()=>m()},{key:`feedback.respond`,label:()=>C()}]},{group:()=>u(),keys:[{key:`admin.manage`,label:()=>k()}]}],oe=Z.flatMap(e=>e.keys.map(e=>e.key));function Q(e){return e.includes(`*`)}var $={key:``,name:``,description:``};function se(){let e=ee(_.apiKeys.listRoles,{}),t=O(_.apiKeys.createRole),n=O(_.apiKeys.ensureRolesSeeded),i=O(_.apiKeys.updateRolePermissions).withOptimisticUpdate((e,{roleId:t,permissions:n})=>{let r=e.getQuery(_.apiKeys.listRoles,{});r&&e.setQuery(_.apiKeys.listRoles,{},r.map(e=>e._id===t?{...e,permissions:n}:e))}),a=V(),l=q(),[u,d]=(0,Y.useState)(!1),[f,p]=(0,Y.useState)($),[m,h]=(0,Y.useState)(new Set);(0,Y.useEffect)(()=>{n({}).catch(e=>{l.error(c(),e)})},[n,l]);let g=e??[];async function C(e,t){if(Q(e.permissions))return;if(e.builtin){await a({title:v({name:e.name}),description:I(),confirmLabel:o()});return}if(m.has(e._id))return;let n=e.permissions.includes(t)?e.permissions.filter(e=>e!==t):[...e.permissions,t];h(t=>new Set(t).add(e._id));try{await i({roleId:e._id,permissions:n})}catch(e){l.error(ne(),e)}finally{h(t=>{let n=new Set(t);return n.delete(e._id),n})}}async function D(){try{await t({key:f.key,name:f.name,description:f.description||void 0,permissions:[]}),p($),d(!1)}catch(e){l.error(L(),e)}}let k=e===void 0,z=!k&&g.length===0;return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`p`,{className:`oc-admin__hint`,children:[ie(),` `,(0,X.jsx)(`code`,{children:`admin`}),` `,R(),` `,(0,X.jsx)(`code`,{children:`traces.read.content`}),` `,F()]}),(0,X.jsxs)(`div`,{className:`oc-dt`,children:[(0,X.jsxs)(`div`,{className:`oc-dt__bar`,children:[(0,X.jsx)(`h2`,{className:`oc-dt__title`,children:y()}),(0,X.jsx)(`div`,{className:`oc-dt__bar-actions`,children:(0,X.jsx)(B,{size:`sm`,onClick:()=>{p($),d(!0)},children:w()})})]}),k?(0,X.jsx)(`p`,{className:`oc-admin__hint`,children:T()}):z?(0,X.jsx)(`p`,{className:`oc-admin__hint`,children:A()}):(0,X.jsx)(`div`,{className:`oc-matrix__scroll`,children:(0,X.jsxs)(`table`,{className:`oc-matrix`,children:[(0,X.jsxs)(`thead`,{children:[(0,X.jsxs)(`tr`,{children:[(0,X.jsx)(`th`,{className:`oc-matrix__corner`,rowSpan:2,children:M()}),Z.map(e=>(0,X.jsx)(`th`,{className:`oc-matrix__group`,colSpan:e.keys.length,children:e.group()},e.group()))]}),(0,X.jsx)(`tr`,{children:Z.flatMap(e=>e.keys.map(e=>(0,X.jsxs)(`th`,{className:`oc-matrix__perm`,title:e.phi?s({key:e.key}):e.key,children:[e.label(),e.phi?(0,X.jsx)(`span`,{className:`oc-matrix__phi`,children:` ⚠`}):null]},e.key)))})]}),(0,X.jsx)(`tbody`,{children:g.map(e=>{let t=Q(e.permissions),n=m.has(e._id);return(0,X.jsxs)(`tr`,{children:[(0,X.jsxs)(`th`,{className:`oc-matrix__rolecell`,children:[(0,X.jsxs)(`div`,{className:`oc-matrix__rolename`,children:[(0,X.jsx)(`span`,{children:e.name}),(0,X.jsx)(`code`,{className:`oc-matrix__rolekey`,children:e.key}),e.builtin?(0,X.jsxs)(K,{variant:`outline`,className:`gap-1`,children:[(0,X.jsx)(H,{}),` `,ae()]}):(0,X.jsx)(K,{variant:`secondary`,children:x()})]}),J(e)?(0,X.jsx)(`p`,{className:`oc-matrix__roledesc`,children:J(e)}):null]}),oe.map(r=>(0,X.jsx)(`td`,{className:`oc-matrix__cell`,children:(0,X.jsx)(G,{checked:t||e.permissions.includes(r),disabled:t||n,"aria-label":`${e.key} · ${r}`,title:t?b():n?E():r,onCheckedChange:()=>void C(e,r)})},r))]},e.key)})})]})})]}),(0,X.jsx)(U,{open:u,onOpenChange:d,title:N(),description:j(),canSubmit:!!(f.key&&f.name),onSubmit:D,submitLabel:P(),children:(0,X.jsxs)(`div`,{className:`oc-form`,children:[(0,X.jsxs)(`label`,{className:`oc-field`,children:[(0,X.jsx)(`span`,{className:`oc-field__label`,children:S()}),(0,X.jsx)(W,{value:f.key,placeholder:r(),onChange:e=>p({...f,key:e.target.value})})]}),(0,X.jsxs)(`label`,{className:`oc-field`,children:[(0,X.jsx)(`span`,{className:`oc-field__label`,children:te()}),(0,X.jsx)(W,{value:f.name,onChange:e=>p({...f,name:e.target.value})})]}),(0,X.jsxs)(`label`,{className:`oc-field`,children:[(0,X.jsx)(`span`,{className:`oc-field__label`,children:re()}),(0,X.jsx)(W,{value:f.description,onChange:e=>p({...f,description:e.target.value})})]})]})})]})}export{se as RolesTab};
@@ -0,0 +1 @@
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$M as r,$N as i,AN as a,CF as o,CN as s,D as c,DF as l,DN as ee,EN as te,GM as ne,JM as re,KM as ie,MN as u,NN as d,ON as f,PN as ae,QM as oe,QN as se,RM as ce,SN as le,T as p,TN as ue,WM as de,XM as fe,YM as pe,ZM as me,ZN as he,_N as ge,aN as m,aP as _e,bN as ve,cP as ye,dP as be,eN as xe,eP as Se,iN as Ce,iP as we,jN as Te,lP as h,nN as Ee,nP as De,oN as g,oP as Oe,qM as ke,rN as Ae,rP as je,sN as Me,sP as Ne,tN as Pe,tP as Fe,uP as Ie,vN as Le,wN as Re,xF as _,xN as ze}from"./dist-CAP0mn60.js";import{t as v}from"./button-DRguy6Hz.js";import{B as Be,C as y,Ft as Ve,H as He,Ht as Ue,Kt as We,L as Ge,Mt as Ke,N as qe,P as Je,R as Ye,S as Xe,T as Ze,U as Qe,Ut as $e,V as et,Vt as tt,W as nt,at as rt,ct as it,it as b,lt as x,ot as S,rt as C,st as at,ut as w,w as T,wt as ot,x as E,z as st,zt as ct}from"./index-DcPINOh1.js";import{a as lt,i as D,n as ut,o as O,r as k,t as dt}from"./table-1vsq56Zt.js";var ft=c(`history`,[[`path`,{d:`M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`,key:`1357e3`}],[`path`,{d:`M3 3v5h5`,key:`1xhq8a`}],[`path`,{d:`M12 7v5l4 2`,key:`1fdv2h`}]]),A=t(e(),1),j=n(),M={minutes:6e4,hours:36e5,days:864e5};function N(e){return e?.data?.code??`unknown`}function P(){let e=l(p.scheduled.listMyCrons),t=l(p.scheduled.getCronDetail),n=l(p.scheduled.listCronRuns),c=l(p.scheduled.updateCron),P=l(p.scheduled.removeCron),pt=l(p.scheduled.runCronNow),F=ot(),[I,mt]=(0,A.useState)(null),[L,R]=(0,A.useState)(!1),[z,B]=(0,A.useState)(!1),[V,H]=(0,A.useState)(null),[U,W]=(0,A.useState)(null),[G,K]=(0,A.useState)(null),[q,J]=(0,A.useState)(null),[ht,gt]=(0,A.useState)(!1),Y=(0,A.useCallback)(async()=>{R(!0),B(!1);try{mt(await e({}))}catch{B(!0)}finally{R(!1)}},[e]);(0,A.useEffect)(()=>{Y()},[Y]);let _t=(0,A.useMemo)(()=>new URLSearchParams(window.location.search).get(`job`),[]),X=(0,A.useRef)(null);(0,A.useEffect)(()=>{I!==null&&X.current!==null&&X.current.scrollIntoView({block:`center`})},[I]);let vt=(0,A.useMemo)(()=>new Intl.DateTimeFormat(o(),{dateStyle:`medium`,timeStyle:`short`}),[]),Z=async(e,t,n)=>{H(e);try{await t(),F.success(n),await Y()}catch(e){F.toast({variant:`error`,title:f({code:N(e)})})}finally{H(null)}},Q=(0,A.useRef)(0),$=(0,A.useRef)(0),yt=async(e,t)=>{if(t.id===null)return;let r=++Q.current;K({name:t.name??t.id,entries:null});try{let i=await n({instanceName:e,jobId:t.id,limit:20});if(r!==Q.current)return;K({name:t.name??t.id,entries:i})}catch(e){if(r!==Q.current)return;K(null),F.toast({variant:`error`,title:f({code:N(e)})})}},bt=async(e,n)=>{if(n.id===null)return;let r=++$.current;J({instanceName:e,jobId:n.id,loading:!0,name:n.name??``,scheduleKind:`cron`,cronExpr:``,tz:``,everyValue:`1`,everyUnit:`hours`,at:``,message:``,hasMessage:!1,scheduleDirty:!1,messageDirty:!1,nameDirty:!1});try{let i=(await t({instanceName:e,jobId:n.id})).job,a=i.scheduleKind===`every`||i.scheduleKind===`at`?i.scheduleKind:`cron`,o=``;if(a===`at`&&i.scheduleExpr!==null){let e=Date.parse(i.scheduleExpr);Number.isFinite(e)&&(o=new Date(e-new Date(e).getTimezoneOffset()*6e4).toISOString().slice(0,16))}let s=`1`,c=`hours`;if(a===`every`&&i.scheduleExpr!==null){let e=Number(i.scheduleExpr);Number.isFinite(e)&&e>0&&(e%M.days===0?(s=String(e/M.days),c=`days`):e%M.hours===0?(s=String(e/M.hours),c=`hours`):(s=String(Math.max(1,Math.round(e/M.minutes))),c=`minutes`))}if(r!==$.current)return;J(e=>e===null||e.jobId!==n.id?e:{...e,loading:!1,name:i.name??e.name,scheduleKind:a,cronExpr:a===`cron`?i.scheduleExpr??``:``,tz:i.tz??``,everyValue:s,everyUnit:c,at:o,message:i.message??``,hasMessage:i.message!==null&&!i.messageTruncated})}catch(e){if(r!==$.current)return;J(null),F.toast({variant:`error`,title:f({code:N(e)})})}},xt=async()=>{if(q===null)return;let e={};if(q.nameDirty&&q.name.trim()===``||q.messageDirty&&q.hasMessage&&q.message.trim()===``){F.toast({variant:`error`,title:de()});return}if(q.nameDirty&&q.name.trim()!==``&&(e.name=q.name.trim()),q.scheduleDirty){if(q.scheduleKind===`cron`&&q.cronExpr.trim()!==``)e.schedule={kind:`cron`,expr:q.cronExpr.trim(),...q.tz.trim()===``?{}:{tz:q.tz.trim()}};else if(q.scheduleKind===`every`){let t=Number(q.everyValue);Number.isFinite(t)&&t>=1&&(e.schedule={kind:`every`,everyMs:Math.round(t*M[q.everyUnit])})}else if(q.scheduleKind===`at`&&q.at!==``){let t=Date.parse(q.at);Number.isFinite(t)&&(e.schedule={kind:`at`,at:new Date(t).toISOString()})}}if(q.scheduleDirty&&e.schedule===void 0){F.toast({variant:`error`,title:ne()});return}if(q.messageDirty&&q.hasMessage&&q.message.trim()!==``&&(e.message=q.message.trim()),Object.keys(e).length===0){J(null);return}let t=$.current;gt(!0);try{await c({instanceName:q.instanceName,jobId:q.jobId,patch:e}),F.success(Ce()),t===$.current&&J(null),await Y()}catch(e){F.toast({variant:`error`,title:f({code:N(e)})})}finally{gt(!1)}},St=I?.reduce((e,t)=>e+t.jobs.length,0)??0;return(0,j.jsxs)(j.Fragment,{children:[(0,j.jsxs)(`div`,{style:{display:`flex`,alignItems:`flex-start`,gap:8,marginBottom:12},children:[(0,j.jsx)(`p`,{className:`oc-admin__hint`,style:{flex:1,margin:0},children:be()}),(0,j.jsxs)(v,{variant:`ghost`,size:`sm`,onClick:()=>void Y(),disabled:L,style:{display:`inline-flex`,alignItems:`center`,gap:4},children:[(0,j.jsx)(ct,{size:14,"aria-hidden":!0}),Ie()]})]}),I===null?(0,j.jsx)(`p`,{className:`oc-admin__hint`,"aria-busy":L,children:z?h():_()}):(0,j.jsxs)(j.Fragment,{children:[z?(0,j.jsx)(`p`,{className:`oc-admin__hint`,children:h()}):null,I.length===0?(0,j.jsx)(`p`,{className:`oc-admin__hint`,children:ye()}):null,I.map(e=>(0,j.jsxs)(`section`,{style:{marginBottom:20},children:[I.length>1||e.error||!e.supported?(0,j.jsxs)(`h3`,{style:{display:`flex`,alignItems:`center`,gap:8,fontSize:`0.85rem`,fontWeight:600,margin:`0 0 6px`},children:[e.instanceName,(0,j.jsx)(C,{variant:`outline`,children:e.kind})]}):null,e.supported?e.error?(0,j.jsx)(`p`,{className:`oc-admin__hint`,children:Oe({code:e.error})}):e.jobs.length===0?(0,j.jsx)(`p`,{className:`oc-admin__hint`,children:_e()}):(0,j.jsxs)(dt,{children:[(0,j.jsx)(lt,{children:(0,j.jsxs)(O,{children:[(0,j.jsx)(D,{children:we()}),(0,j.jsx)(D,{children:je()}),(0,j.jsx)(D,{children:De()}),(0,j.jsx)(D,{children:Fe()}),(0,j.jsx)(D,{children:Se()}),(0,j.jsx)(D,{children:Me()})]})}),(0,j.jsx)(ut,{children:e.jobs.map((t,n)=>{let r=`${e.instanceName}:${t.id??n}`,o=V===r,s=e.manageSupported,l=e.kind===`openclaw`&&s;return(0,j.jsxs)(O,{ref:t.id!==null&&t.id===_t?X:void 0,"data-state":t.id!==null&&t.id===_t?`selected`:void 0,children:[(0,j.jsx)(k,{className:`font-medium`,style:{maxWidth:280,overflow:`hidden`,textOverflow:`ellipsis`},title:t.name??void 0,children:t.name??i()}),(0,j.jsx)(k,{children:(0,j.jsx)(C,{variant:`secondary`,children:t.agentId})}),(0,j.jsxs)(k,{className:`whitespace-nowrap`,children:[(0,j.jsx)(`span`,{style:{fontFamily:`var(--font-mono, monospace)`},children:t.schedule??`—`}),(()=>{let e=qe(t.schedule),n=e===null?null:Je(e);return n===null?null:(0,j.jsx)(`span`,{className:`text-muted-foreground`,style:{display:`block`,fontSize:`0.78rem`},children:n})})()]}),(0,j.jsx)(k,{className:`whitespace-nowrap text-muted-foreground`,children:t.nextRunAtMs===null?`—`:vt.format(t.nextRunAtMs)}),(0,j.jsxs)(k,{children:[t.enabled===!0?(0,j.jsx)(C,{variant:`secondary`,children:he()}):t.enabled===!1?(0,j.jsx)(C,{variant:`outline`,children:se()}):(0,j.jsx)(`span`,{className:`text-muted-foreground`,children:`—`}),t.lastRunStatus?(0,j.jsx)(`span`,{className:`text-muted-foreground`,style:{marginLeft:8,fontSize:`0.8rem`},children:t.lastRunStatus}):null]}),(0,j.jsx)(k,{className:`whitespace-nowrap`,children:t.id===null?(0,j.jsx)(`span`,{className:`text-muted-foreground`,children:`—`}):o?(0,j.jsx)(We,{size:14,className:`oc-actrow__spin`,"aria-hidden":!0}):(0,j.jsxs)(`span`,{style:{display:`inline-flex`,gap:2},children:[l?(0,j.jsx)(v,{variant:`ghost`,size:`icon-sm`,title:d(),"aria-label":d(),disabled:V!==null,onClick:()=>void Z(r,async()=>{let n=await pt({instanceName:e.instanceName,jobId:t.id});if(n.ran!==!0&&n.runId===null)throw{data:{code:n.reason??`run_not_started`}}},ee()),children:(0,j.jsx)(Ke,{size:14,"aria-hidden":!0})}):null,l&&t.enabled!==null?(0,j.jsx)(v,{variant:`ghost`,size:`icon-sm`,title:t.enabled?u():Te(),"aria-label":t.enabled?u():Te(),disabled:V!==null,onClick:()=>void Z(r,()=>c({instanceName:e.instanceName,jobId:t.id,patch:{enabled:!t.enabled}}),t.enabled?te():ue()),children:t.enabled?(0,j.jsx)($e,{size:14,"aria-hidden":!0}):(0,j.jsx)(tt,{size:14,"aria-hidden":!0})}):null,l?(0,j.jsx)(v,{variant:`ghost`,size:`icon-sm`,title:g(),"aria-label":g(),disabled:V!==null,onClick:()=>void bt(e.instanceName,t),children:(0,j.jsx)(Ue,{size:14,"aria-hidden":!0})}):null,l?(0,j.jsx)(v,{variant:`ghost`,size:`icon-sm`,title:m(),"aria-label":m(),disabled:V!==null,onClick:()=>void yt(e.instanceName,t),children:(0,j.jsx)(ft,{size:14,"aria-hidden":!0})}):null,s?(0,j.jsx)(v,{variant:`ghost`,size:`icon-sm`,title:a(),"aria-label":a(),disabled:V!==null,onClick:()=>W({instanceName:e.instanceName,jobId:t.id,name:t.name??t.id}),children:(0,j.jsx)(Ve,{size:14,"aria-hidden":!0})}):null]})})]},t.id??`${e.instanceName}-${n}`)})})]}):(0,j.jsx)(`p`,{className:`oc-admin__hint`,children:Ne()})]},e.instanceName)),St>0?(0,j.jsx)(`p`,{className:`oc-admin__hint`,style:{marginTop:4},children:ce()}):null]}),(0,j.jsx)(Ge,{open:U!==null,onOpenChange:e=>{e||W(null)},children:(0,j.jsxs)(Be,{children:[(0,j.jsxs)(Qe,{children:[(0,j.jsx)(nt,{children:s()}),(0,j.jsx)(et,{children:le({name:U?.name??``})})]}),(0,j.jsxs)(He,{children:[(0,j.jsx)(st,{children:ze()}),(0,j.jsx)(Ye,{onClick:()=>{let e=U;W(null),e!==null&&Z(`${e.instanceName}:${e.jobId}`,()=>P({instanceName:e.instanceName,jobId:e.jobId}),Re())},children:ve()})]})]})}),(0,j.jsx)(rt,{open:G!==null,onOpenChange:e=>{e||(Q.current++,K(null))},children:(0,j.jsxs)(S,{style:{maxWidth:640},children:[(0,j.jsx)(x,{children:(0,j.jsx)(w,{children:Ae({name:G?.name??``})})}),G?.entries===null?(0,j.jsx)(`p`,{className:`oc-admin__hint`,children:_()}):G!==null&&G.entries.length===0?(0,j.jsx)(`p`,{className:`oc-admin__hint`,children:Ee()}):G===null?null:(0,j.jsx)(`div`,{className:`oc-cronpanel__runs`,style:{maxHeight:420,overflowY:`auto`},children:G.entries.map((e,t)=>(0,j.jsxs)(`div`,{className:`oc-cronpanel__run`,children:[(0,j.jsxs)(`div`,{className:`oc-cronpanel__run-head`,children:[e.status===`ok`?(0,j.jsx)(C,{variant:`secondary`,children:Le()}):e.status===`error`?(0,j.jsx)(C,{variant:`destructive`,children:ge()}):(0,j.jsx)(C,{variant:`outline`,children:e.status??`—`}),(0,j.jsx)(`span`,{children:typeof(e.runAtMs??e.ts)==`number`?vt.format(e.runAtMs??e.ts):`—`}),typeof e.durationMs==`number`?(0,j.jsxs)(`span`,{className:`oc-cronpanel__run-dur`,children:[Math.round(e.durationMs/1e3),`s`]}):null]}),e.summary===null?null:(0,j.jsx)(`div`,{className:`oc-cronpanel__run-summary`,children:e.summary}),e.error===null?null:(0,j.jsx)(`div`,{className:`oc-cronpanel__run-error`,children:e.error})]},t))})]})}),(0,j.jsx)(rt,{open:q!==null,onOpenChange:e=>{e||($.current++,J(null))},children:(0,j.jsxs)(S,{children:[(0,j.jsxs)(x,{children:[(0,j.jsx)(w,{children:Pe()}),(0,j.jsx)(at,{children:xe()})]}),q===null?null:q.loading?(0,j.jsx)(`p`,{className:`oc-admin__hint`,children:_()}):(0,j.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:12},children:[(0,j.jsxs)(`label`,{style:{display:`flex`,flexDirection:`column`,gap:4},children:[(0,j.jsx)(`span`,{className:`oc-admin__hint`,style:{margin:0},children:we()}),(0,j.jsx)(b,{value:q.name,maxLength:200,onChange:e=>J({...q,name:e.target.value,nameDirty:!0})})]}),(0,j.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:4},children:[(0,j.jsx)(`span`,{className:`oc-admin__hint`,style:{margin:0},children:r()}),(0,j.jsxs)(E,{value:q.scheduleKind,onValueChange:e=>J({...q,scheduleKind:e,scheduleDirty:!0}),children:[(0,j.jsx)(T,{children:(0,j.jsx)(Ze,{})}),(0,j.jsxs)(Xe,{children:[(0,j.jsx)(y,{value:`cron`,children:oe()}),(0,j.jsx)(y,{value:`every`,children:me()}),(0,j.jsx)(y,{value:`at`,children:fe()})]})]}),q.scheduleKind===`cron`?(0,j.jsxs)(`div`,{style:{display:`flex`,gap:8},children:[(0,j.jsx)(b,{value:q.cronExpr,onChange:e=>J({...q,cronExpr:e.target.value,scheduleDirty:!0}),placeholder:`30 9 * * *`,style:{fontFamily:`var(--font-mono, monospace)`}}),(0,j.jsx)(b,{value:q.tz,onChange:e=>J({...q,tz:e.target.value,scheduleDirty:!0}),placeholder:`America/Toronto`,style:{maxWidth:180}})]}):q.scheduleKind===`every`?(0,j.jsxs)(`div`,{style:{display:`flex`,gap:8},children:[(0,j.jsx)(b,{type:`number`,min:1,value:q.everyValue,onChange:e=>J({...q,everyValue:e.target.value,scheduleDirty:!0}),style:{maxWidth:120}}),(0,j.jsxs)(E,{value:q.everyUnit,onValueChange:e=>J({...q,everyUnit:e,scheduleDirty:!0}),children:[(0,j.jsx)(T,{style:{maxWidth:160},children:(0,j.jsx)(Ze,{})}),(0,j.jsxs)(Xe,{children:[(0,j.jsx)(y,{value:`minutes`,children:pe()}),(0,j.jsx)(y,{value:`hours`,children:re()}),(0,j.jsx)(y,{value:`days`,children:ke()})]})]})]}):(0,j.jsx)(b,{type:`datetime-local`,value:q.at,onChange:e=>J({...q,at:e.target.value,scheduleDirty:!0})})]}),q.hasMessage?(0,j.jsxs)(`label`,{style:{display:`flex`,flexDirection:`column`,gap:4},children:[(0,j.jsx)(`span`,{className:`oc-admin__hint`,style:{margin:0},children:ae()}),(0,j.jsx)(`textarea`,{className:`oc-cronedit__textarea`,rows:4,value:q.message,onChange:e=>J({...q,message:e.target.value,messageDirty:!0})})]}):null]}),(0,j.jsxs)(it,{children:[(0,j.jsx)(v,{variant:`ghost`,onClick:()=>J(null),children:ze()}),(0,j.jsxs)(v,{onClick:()=>void xt(),disabled:q===null||q.loading||ht,children:[ht?(0,j.jsx)(We,{size:14,className:`oc-actrow__spin`,"aria-hidden":!0}):null,ie()]})]})]})})]})}export{P as ScheduledTab};
@@ -0,0 +1 @@
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$k as r,AF as i,Ak as ee,Bk as te,CA as ne,Ck as a,DF as re,Dk as o,Ek as s,Fk as ie,Gk as ae,Hk as oe,Ik as se,Jk as ce,Kk as le,Lk as ue,Mk as de,Nk as fe,Ok as c,Pk as pe,Qk as me,Rk as he,SA as ge,Sk as l,T as u,TA as _e,Tk as d,Uk as ve,Vk as ye,Wk as be,Xk as xe,Yk as Se,Zk as Ce,_A as we,_k as f,aA as Te,ak as p,bA as m,bk as h,cA as Ee,ck as g,dA as De,dk as Oe,eA as ke,fA as Ae,fk as je,gA as Me,gk as Ne,hA as Pe,hk as _,iA as Fe,jk as Ie,kF as v,kk as Le,lA as Re,lk as y,mA as ze,mk as b,nA as Be,oA as Ve,ok as x,pA as He,pk as Ue,qk as We,rA as Ge,sA as Ke,sk as S,tA as qe,uA as Je,uk as C,vA as Ye,vk as w,wA as Xe,wk as T,xA as Ze,xk as E,yA as D,yk as O,zk as Qe}from"./dist-CAP0mn60.js";import{n as k}from"./dist-DH6cB1zr.js";import{i as $e}from"./dist-3KrBDl5H.js";import{t as A}from"./button-DRguy6Hz.js";import{C as j,F as et,J as M,S as N,T as P,Y as F,Zt as I,at as L,ct as R,d as tt,en as nt,in as rt,it as z,lt as B,ot as V,rn as it,rt as H,st as U,ut as W,w as G,wt as at,x as K}from"./index-DcPINOh1.js";import{t as ot}from"./FilterBar-XGMlTH00.js";import{t as st}from"./DataTableShell-Bo9JdV4-.js";import{t as ct}from"./roleDescriptions-B6dQdyoM.js";var q=t(e(),1),J=n(),Y=[{value:`never`,label:()=>Oe(),days:null},{value:`30`,label:()=>C(),days:30},{value:`90`,label:()=>y(),days:90}],X=720*60*60*1e3,Z=`__all__`,Q={name:``,roleKey:``,description:``};function $(){let e=rt({from:`/settings/serviceAccounts`}),t=it({from:`/settings/serviceAccounts`}),n=e.q??``,a=e.status??Z,[o,s]=(0,q.useState)(Z),c=e=>void t({search:t=>({...t,q:e||void 0}),replace:!0}),l=e=>void t({search:t=>({...t,status:e===Z?void 0:e})}),d=i(u.apiKeys.listServiceAccounts,{filter:{q:n||void 0,role:o===Z?void 0:o,disabled:a===Z?void 0:a===`disabled`}}),f=i(u.apiKeys.listKeys,{}),p=i(u.apiKeys.listRoles,{}),h=v(u.apiKeys.createServiceAccount),g=v(u.apiKeys.updateServiceAccount),Oe=v(u.apiKeys.deleteServiceAccount),je=re(u.apiKeys.mintApiKey),Ne=v(u.apiKeys.revokeApiKey),_=et(),y=at(),b=n!==``||o!==Z||a!==Z;function x(){s(Z),t({search:{},replace:!0})}let[Ue,S]=(0,q.useState)(!1),[C,w]=(0,q.useState)(Q),[T,E]=(0,q.useState)(null),[O,k]=(0,q.useState)(new Set),[M,F]=(0,q.useState)(null),I=(0,q.useRef)(!1),[L,R]=(0,q.useState)(new Set),[B,V]=(0,q.useState)({}),[U,W]=(0,q.useState)(null),X=(0,q.useMemo)(()=>{let e=new Map;for(let t of f??[]){let n=e.get(t.serviceAccountId)??[];n.push(t),e.set(t.serviceAccountId,n)}return e},[f]);function $(e){k(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})}async function dt(){try{T?(await g({serviceAccountId:T,name:C.name,roleKey:C.roleKey,description:C.description}),y.success(ve())):await h({name:C.name,roleKey:C.roleKey,description:C.description||void 0}),w(Q),E(null),S(!1)}catch(e){y.error(T?be():ae(),e)}}function ft(e){w({name:e.name,roleKey:e.roleKey,description:e.description??``}),E(e._id),S(!0)}async function pt(e){if(I.current)return;I.current=!0;let t=B[e._id]??`never`,n=Y.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 je({serviceAccountId:e._id,expiresAt:r});W({accountName:e.name,plaintext:t.plaintext,prefix:t.prefix,lastFour:t.lastFour})}catch(e){y.error(oe(),e)}finally{I.current=!1,F(null)}}async function mt(e){if(await _({title:ye(),description:(0,J.jsxs)(J.Fragment,{children:[te(),` `,(0,J.jsx)(`span`,{className:`font-mono`,children:e.name}),` `,Qe(),` `,(0,J.jsx)(`strong`,{children:he()}),` `,ue()]}),confirmWord:e.name,confirmLabel:se(),destructive:!0}))try{await Oe({serviceAccountId:e._id}),y.success(ie(),e.name)}catch(e){y.error(pe(),e)}}async function ht(e){if(await _({title:fe(),description:(0,J.jsxs)(J.Fragment,{children:[de(),` `,(0,J.jsxs)(`span`,{className:`font-mono`,children:[e.prefix,`…`,e.lastFour]}),` `,Ie()]}),confirmLabel:ee(),destructive:!0})&&!L.has(e._id)){R(t=>new Set(t).add(e._id));try{await Ne({keyId:e._id})}catch(e){y.error(Le(),e)}finally{R(t=>{let n=new Set(t);return n.delete(e._id),n})}}}return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(`p`,{className:`oc-admin__hint`,children:_e()}),(0,J.jsxs)(ot,{q:n,onQChange:c,searchPlaceholder:Xe(),onReset:x,canReset:b,children:[(0,J.jsxs)(K,{value:o,onValueChange:s,children:[(0,J.jsx)(G,{size:`sm`,className:`w-40`,children:(0,J.jsx)(P,{placeholder:ne()})}),(0,J.jsxs)(N,{children:[(0,J.jsx)(j,{value:Z,children:ge()}),(p??[]).map(e=>(0,J.jsx)(j,{value:e.key,children:e.key},e._id))]})]}),(0,J.jsxs)(K,{value:a,onValueChange:l,children:[(0,J.jsx)(G,{size:`sm`,className:`w-36`,children:(0,J.jsx)(P,{})}),(0,J.jsxs)(N,{children:[(0,J.jsx)(j,{value:Z,children:Ze()}),(0,J.jsx)(j,{value:`active`,children:m()}),(0,J.jsx)(j,{value:`disabled`,children:D()})]})]})]}),(0,J.jsx)(st,{title:Ye(),rows:d,addLabel:we(),onAdd:()=>{w(Q),E(null),S(!0)},emptyHint:Me(),isExpanded:e=>O.has(e._id),renderExpanded:e=>(0,J.jsx)(lt,{account:e,keys:X.get(e._id)??[],onRevoke:ht,revoking:L}),rowActions:e=>[{label:Ae(),onSelect:()=>ft(e)},{label:Pe(),onSelect:()=>void pt(e)},{label:O.has(e._id)?ze():He(),onSelect:()=>$(e._id)},{label:De(),variant:`destructive`,onSelect:()=>void mt(e)}],columns:[{header:``,className:`w-8`,cell:e=>(0,J.jsx)(A,{variant:`ghost`,size:`icon-sm`,"aria-label":O.has(e._id)?Je():Re(),onClick:()=>$(e._id),children:O.has(e._id)?(0,J.jsx)($e,{}):(0,J.jsx)(nt,{})})},{header:Ee(),sort:e=>e.name,cell:e=>(0,J.jsxs)(`div`,{className:`flex flex-col`,children:[(0,J.jsx)(`span`,{children:e.name}),e.description?(0,J.jsx)(`span`,{className:`text-muted-foreground text-xs`,children:e.description}):null]})},{header:Ke(),sort:e=>e.roleKey,cell:e=>(0,J.jsx)(H,{variant:`secondary`,children:e.roleKey})},{header:Ve(),sort:e=>+!!e.disabled,cell:e=>e.disabled?(0,J.jsx)(H,{variant:`destructive`,children:D()}):(0,J.jsx)(H,{variant:`outline`,children:m()})},{header:Te(),cell:e=>(0,J.jsxs)(K,{value:B[e._id]??`never`,onValueChange:t=>V(n=>({...n,[e._id]:t})),children:[(0,J.jsx)(G,{size:`sm`,className:`w-32`,children:(0,J.jsx)(P,{})}),(0,J.jsx)(N,{children:Y.map(e=>(0,J.jsx)(j,{value:e.value,children:e.label()},e.value))})]})},{header:Fe(),sort:e=>(X.get(e._id)??[]).filter(e=>!e.disabled).length,cell:e=>{let t=(X.get(e._id)??[]).filter(e=>!e.disabled).length;return(0,J.jsx)(`span`,{className:`oc-sa__keycount`,children:M===e._id?Ge():Be({count:t})})}}]}),(0,J.jsx)(tt,{open:Ue,onOpenChange:e=>{S(e),e||E(null)},title:T?qe():me(),description:T?ke():Ce(),canSubmit:!!(C.name&&C.roleKey),onSubmit:dt,submitLabel:T?r():xe(),children:(0,J.jsxs)(`div`,{className:`oc-form`,children:[(0,J.jsxs)(`label`,{className:`oc-field`,children:[(0,J.jsx)(`span`,{className:`oc-field__label`,children:Se()}),(0,J.jsx)(z,{value:C.name,onChange:e=>w({...C,name:e.target.value})})]}),(0,J.jsxs)(`label`,{className:`oc-field`,children:[(0,J.jsx)(`span`,{className:`oc-field__label`,children:ce()}),(0,J.jsxs)(K,{value:C.roleKey||void 0,onValueChange:e=>w({...C,roleKey:e}),children:[(0,J.jsx)(G,{className:`w-full`,children:(0,J.jsx)(P,{placeholder:We()})}),(0,J.jsx)(N,{children:(p??[]).map(e=>(0,J.jsxs)(j,{value:e.key,children:[e.name,` (`,e.key,`)`]},e._id))})]}),(()=>{let e=(p??[]).find(e=>e.key===C.roleKey),t=e?ct(e):null;return t?(0,J.jsx)(`span`,{className:`text-muted-foreground text-xs`,children:t}):null})()]}),(0,J.jsxs)(`label`,{className:`oc-field`,children:[(0,J.jsx)(`span`,{className:`oc-field__label`,children:le()}),(0,J.jsx)(z,{value:C.description,onChange:e=>w({...C,description:e.target.value})})]})]})}),(0,J.jsx)(ut,{minted:U,onClose:()=>W(null)})]})}function lt({account:e,keys:t,onRevoke:n,revoking:r}){return(0,J.jsxs)(`div`,{className:`oc-sa__keys`,children:[(0,J.jsxs)(`div`,{className:`oc-sa__keys-head`,children:[c(),` `,(0,J.jsx)(`span`,{className:`font-medium`,children:e.name})]}),t.length===0?(0,J.jsx)(`p`,{className:`oc-admin__hint`,children:o()}):(0,J.jsxs)(`table`,{className:`oc-sa__keytable`,children:[(0,J.jsx)(`thead`,{children:(0,J.jsxs)(`tr`,{children:[(0,J.jsx)(`th`,{children:s()}),(0,J.jsx)(`th`,{children:d()}),(0,J.jsx)(`th`,{children:T()}),(0,J.jsx)(`th`,{children:a()}),(0,J.jsx)(`th`,{children:l()}),(0,J.jsx)(`th`,{children:E()}),(0,J.jsx)(`th`,{})]})}),(0,J.jsx)(`tbody`,{children:t.map(t=>(0,J.jsxs)(`tr`,{children:[(0,J.jsx)(`td`,{children:(0,J.jsxs)(`code`,{className:`oc-sa__keyid`,children:[t.prefix,`…`,t.lastFour]})}),(0,J.jsx)(`td`,{children:(0,J.jsx)(H,{variant:`secondary`,children:e.roleKey})}),(0,J.jsx)(`td`,{children:F(t.createdAt)}),(0,J.jsx)(`td`,{className:dt(t.lastUsedAt)?`oc-sa__stale`:``,children:ft(t.lastUsedAt)}),(0,J.jsx)(`td`,{children:pt(t.expiresAt)}),(0,J.jsx)(`td`,{children:mt(t)}),(0,J.jsx)(`td`,{className:`text-right`,children:t.disabled?null:(0,J.jsx)(A,{variant:`destructive`,size:`sm`,disabled:r.has(t._id),onClick:()=>n(t),children:r.has(t._id)?h():O()})})]},t._id))})]})]})}function ut({minted:e,onClose:t}){let[n,r]=(0,q.useState)(!1);async function i(){if(e)try{await navigator.clipboard.writeText(e.plaintext),r(!0),window.setTimeout(()=>r(!1),2e3)}catch{}}return(0,J.jsx)(L,{open:e!==null,onOpenChange:e=>{e||(r(!1),t())},children:e?(0,J.jsxs)(V,{className:`max-w-lg`,showCloseButton:!1,onInteractOutside:e=>e.preventDefault(),onEscapeKeyDown:e=>e.preventDefault(),children:[(0,J.jsxs)(B,{children:[(0,J.jsx)(W,{children:w()}),(0,J.jsx)(U,{children:f({name:e.accountName})})]}),(0,J.jsx)(`div`,{className:`oc-sa__minted-warning`,children:Ne()}),(0,J.jsxs)(`div`,{className:`oc-sa__minted-box`,children:[(0,J.jsx)(`code`,{className:`oc-sa__minted-plain`,children:e.plaintext}),(0,J.jsxs)(A,{variant:`outline`,size:`sm`,onClick:()=>void i(),"aria-label":_(),children:[n?(0,J.jsx)(k,{}):(0,J.jsx)(I,{}),n?b():Ue()]})]}),(0,J.jsx)(R,{children:(0,J.jsx)(A,{onClick:()=>{r(!1),t()},children:je()})})]}):null})}function dt(e){return e===null?!1:Date.now()-e>X}function ft(e){return e===null?g():F(e)}function pt(e){return e===null?`—`:M(e)}function mt(e){return e.disabled?(0,J.jsx)(H,{variant:`destructive`,children:S()}):e.expiresAt!==null&&e.expiresAt<Date.now()?(0,J.jsx)(H,{variant:`outline`,children:x()}):(0,J.jsx)(H,{variant:`outline`,children:p()})}export{$ as ServiceAccountsTab};
@@ -0,0 +1 @@
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$o as r,AF as i,Bo as a,Fo as o,Go as s,Ho as c,Io as l,Jo as u,Ko as d,Lo as f,Mo as p,No as m,Po as h,Qo as g,Ro as _,T as v,Uo as y,Vo as b,Wo as x,Xo as S,Yo as C,Zo as w,as as T,cs as E,ds as D,es as O,fs as k,hs as A,is as j,jo as M,kF as N,ls as P,ms as F,ns as I,os as L,ps as R,qo as ee,rs as z,ss as B,ts as V,us as H,zo as U}from"./dist-CAP0mn60.js";import{t as W}from"./button-DRguy6Hz.js";import{F as G,Y as K}from"./index-DcPINOh1.js";import{t as q}from"./DataTableShell-Bo9JdV4-.js";var J=t(e(),1),Y=n(),X={hung:()=>g(),wrong_result:()=>w(),error:()=>S(),other:()=>C()},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=N(v.subAgentReports.respondToReport),[r,i]=(0,J.useState)(e.thread),[p,m]=(0,J.useState)(``),[g,S]=(0,J.useState)(!1);async function C(){let t=p.trim();if(!(!t||g)){S(!0);try{await n({reportId:e._id,text:t}),i(e=>[...e,{authorRole:`admin`,text:t,at:Date.now()}]),m(``)}finally{S(!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),` · `,u({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:ee()}),(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:d()}),r.length>0?(0,Y.jsx)(`div`,{className:`oc-fbadmin__thread`,children:r.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`?s():x()}),(0,Y.jsx)(`span`,{className:`oc-notif__msg-text`,children:e.text})]},t))}):(0,Y.jsx)(`p`,{className:`oc-fbadmin__meta`,children:y()}),(0,Y.jsx)(`textarea`,{className:`oc-feedback__textarea`,placeholder:c(),value:p,maxLength:2e3,rows:3,onChange:e=>m(e.target.value.slice(0,2e3))}),(0,Y.jsx)(`div`,{className:`oc-fbadmin__row`,style:{justifyContent:`flex-end`},children:(0,Y.jsx)(W,{size:`sm`,onClick:()=>void C(),disabled:!p.trim()||g,children:g?a():b()})})]}),(0,Y.jsxs)(`section`,{children:[(0,Y.jsxs)(`h4`,{className:`oc-fbadmin__h`,children:[U({count:t.children.length}),t.childrenTruncated?` ${_()}`:``,t.textTruncated?` ${f()}`:``]}),(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?` · ${l()}`:``]}),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:o()}),(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:h()}),(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 te(){let e=i(v.subAgentReports.listForAdmin,{}),t=N(v.subAgentReports.readReport),n=N(v.subAgentReports.deleteReport),a=G(),[o,s]=(0,J.useState)(null),[c,l]=(0,J.useState)({});async function u(e){if(o===e._id){s(null);return}if(!c[e._id]){let n=await t({reportId:e._id});l(t=>({...t,[e._id]:n}))}s(e._id)}async function d(e){await a({title:m(),description:p(),confirmLabel:M(),destructive:!0})&&(await n({reportId:e._id}),o===e._id&&s(null))}return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(`p`,{className:`oc-admin__hint`,children:[R(),` `,(0,Y.jsx)(`strong`,{children:k()}),` `,D()]}),(0,Y.jsx)(q,{title:A(),rows:e,emptyHint:F(),isExpanded:e=>o===e._id&&!!c[e._id],renderExpanded:e=>c[e._id]?(0,Y.jsx)($,{data:c[e._id]}):null,columns:[{header:H(),cell:e=>K(e.at),sort:e=>e.at},{header:P(),cell:e=>Z(e.category),sort:e=>Z(e.category)},{header:E(),cell:e=>`${e.failedCount}/${e.totalCount}`,sort:e=>e.failedCount},{header:B(),cell:e=>(e.reporterEmail||e.reporterName||`—`)+(e.impersonated&&e.realOperatorEmail?` ${j({operator:e.realOperatorEmail})}`:``),sort:e=>e.reporterEmail||e.reporterName||null},{header:L(),cell:e=>e.hasComment?`✎`:`—`,sort:e=>+!!e.hasComment},{header:T(),cell:e=>e.answered?(0,Y.jsx)(`span`,{className:`oc-fbadmin__pill is-ok`,children:z()}):(0,Y.jsx)(`span`,{className:`oc-fbadmin__pill`,children:I()}),sort:e=>+!!e.answered}],rowActions:e=>[{label:o===e._id?O():V(),onSelect:()=>void u(e)},{label:r(),onSelect:()=>void d(e),variant:`destructive`}]})]})}export{te as SubAgentReportsTab};