@lacneu/atrium 0.80.0 → 0.81.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 (80) hide show
  1. package/dist/assets/AccessTab-BgWLWjSu.js +1 -0
  2. package/dist/assets/{AdvancedFilter-Ddd7TM1I.js → AdvancedFilter-CDngwUem.js} +1 -1
  3. package/dist/assets/AgentFilesTab-CL0cJrKE.js +3 -0
  4. package/dist/assets/AnomaliesTab-CKSRbds6.js +1 -0
  5. package/dist/assets/AuditTab-BnDFtbaS.js +1 -0
  6. package/dist/assets/BridgeTab-QW9px1z5.js +1 -0
  7. package/dist/assets/ChatDefaultsTab-XNB8jInh.js +1 -0
  8. package/dist/assets/{DataTableShell-D2srrwu0.js → DataTableShell-BWoSBli_.js} +1 -1
  9. package/dist/assets/{DetailChips-WUMzjman.js → DetailChips-CUfCyLvN.js} +1 -1
  10. package/dist/assets/FeedbacksTab-Ba-zMA-p.js +1 -0
  11. package/dist/assets/{FieldLabel-BNwSIo5u.js → FieldLabel-8vj4ipPC.js} +1 -1
  12. package/dist/assets/FilesTab-Dht0_RDj.js +1 -0
  13. package/dist/assets/{FilterBar-BS4HsrlJ.js → FilterBar-BJ1mhU3e.js} +1 -1
  14. package/dist/assets/GroupsTab-Bz7Mvvwj.js +1 -0
  15. package/dist/assets/InstancesTab-BTESpzxw.js +1 -0
  16. package/dist/assets/IntegrationsTab-D3y4_fhI.js +1 -0
  17. package/dist/assets/KpiTab-D9ujtelb.js +1 -0
  18. package/dist/assets/PreferencesTab-CHqxxQ3R.js +1 -0
  19. package/dist/assets/ProjectPage-Dom5dB_v.js +1 -0
  20. package/dist/assets/PromptInjectionsTab-D-7L-yZy.js +4 -0
  21. package/dist/assets/RolesTab-2nGoIoBg.js +1 -0
  22. package/dist/assets/ScheduledTab-_v_HWkIY.js +1 -0
  23. package/dist/assets/ServiceAccountsTab-foQObSmk.js +1 -0
  24. package/dist/assets/SubAgentReportsTab-DIzBgBj5.js +1 -0
  25. package/dist/assets/ThemeShowroom-Gqbq2MWW.js +1 -0
  26. package/dist/assets/{TimeRangePicker-Dx50b9Tc.js → TimeRangePicker-qNMV_Gj-.js} +1 -1
  27. package/dist/assets/{TimezoneCombobox-DH_5qFyU.js → TimezoneCombobox-D2e6UjGY.js} +1 -1
  28. package/dist/assets/TracesTab-D_Z__oYy.js +1 -0
  29. package/dist/assets/UsersTab-1HZ5mAYl.js +1 -0
  30. package/dist/assets/VoiceTab-DGQk5yGt.js +1 -0
  31. package/dist/assets/{api-CyG2Kb2E.js → api-CCk5U5gB.js} +5 -5
  32. package/dist/assets/{button-SxU4iS5M.js → button-CbUSFbZL.js} +1 -1
  33. package/dist/assets/{card-vJtS-_yl.js → card-PW6qFB8Z.js} +1 -1
  34. package/dist/assets/chevrons-up-down-DAdQ-ohu.js +1 -0
  35. package/dist/assets/{compatView-JE5RFigb.js → compatView-DgV9jG5C.js} +1 -1
  36. package/dist/assets/dispatchErrorInfo-CW9VFOfh.js +1 -0
  37. package/dist/assets/{dist-bgyYeQqP.js → dist-BF1pXGOi.js} +1 -1
  38. package/dist/assets/{dist-CPSxRyhy.js → dist-CeBeEhXM.js} +1 -1
  39. package/dist/assets/{highlighted-body-OFNGDK62-BakvA9z8.js → highlighted-body-OFNGDK62-B0i3QCx_.js} +1 -1
  40. package/dist/assets/index-DY7zoioz.js +324 -0
  41. package/dist/assets/index-vuXE_6pY.css +1 -0
  42. package/dist/assets/{list-JGKvhNdi.js → list-wMpxVo2w.js} +1 -1
  43. package/dist/assets/mermaid-GHXKKRXX-CWDFvVZH.js +1 -0
  44. package/dist/assets/{pdf-BkJsigVn.js → pdf-BFBPmq_U.js} +1 -1
  45. package/dist/assets/roleDescriptions-Du6v2lbA.js +1 -0
  46. package/dist/assets/{table-jvClq47d.js → table-BhYNJKZu.js} +1 -1
  47. package/dist/assets/{tabs-D_DuLEpU.js → tabs-BwhZusQZ.js} +1 -1
  48. package/dist/assets/x-BvfQ_1AZ.js +1 -0
  49. package/dist/index.html +7 -7
  50. package/package.json +1 -1
  51. package/dist/assets/AccessTab-Bg7AJltl.js +0 -1
  52. package/dist/assets/AgentFilesTab-BRmbz8_w.js +0 -3
  53. package/dist/assets/AnomaliesTab-m5WLIYl2.js +0 -1
  54. package/dist/assets/AuditTab-1gyBuFew.js +0 -1
  55. package/dist/assets/BridgeTab-DlU50D2z.js +0 -1
  56. package/dist/assets/ChatDefaultsTab-CN8cDKMU.js +0 -1
  57. package/dist/assets/FeedbacksTab-CcE_6zZR.js +0 -1
  58. package/dist/assets/FilesTab-CfDSdvOR.js +0 -1
  59. package/dist/assets/GroupsTab-BN8czt3O.js +0 -1
  60. package/dist/assets/InstancesTab-Mw3vQGZr.js +0 -1
  61. package/dist/assets/IntegrationsTab-HnFrohTq.js +0 -1
  62. package/dist/assets/KpiTab-Bt81LKar.js +0 -1
  63. package/dist/assets/PreferencesTab-DNxJMl_1.js +0 -1
  64. package/dist/assets/ProjectPage-BNEr-qVc.js +0 -1
  65. package/dist/assets/PromptInjectionsTab-DaLlUnez.js +0 -4
  66. package/dist/assets/RolesTab-DjKUmoAu.js +0 -1
  67. package/dist/assets/ScheduledTab-BTuR5Igi.js +0 -1
  68. package/dist/assets/ServiceAccountsTab-3PR98Iqq.js +0 -1
  69. package/dist/assets/SubAgentReportsTab-kiNltjSe.js +0 -1
  70. package/dist/assets/ThemeShowroom-DGuXtdJT.js +0 -1
  71. package/dist/assets/TracesTab-zOMYT0Ye.js +0 -1
  72. package/dist/assets/UsersTab-DVhM7px6.js +0 -1
  73. package/dist/assets/VoiceTab-l-Tr6bly.js +0 -1
  74. package/dist/assets/chevrons-up-down-ChvoKzuN.js +0 -1
  75. package/dist/assets/dispatchErrorInfo-BKhXLGGN.js +0 -1
  76. package/dist/assets/index-Cv1UBVbk.css +0 -1
  77. package/dist/assets/index-DWkl2h55.js +0 -324
  78. package/dist/assets/mermaid-GHXKKRXX-CgrVl_4r.js +0 -1
  79. package/dist/assets/roleDescriptions-B9SjwOYY.js +0 -1
  80. package/dist/assets/x-CHe0mcCM.js +0 -1
@@ -0,0 +1 @@
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Zz as r,_m as i,am as a,cm as o,dm as s,fm as c,gm as l,hm as u,im as d,lm as f,mm as p,oB as m,om as h,pm as g,sm as _,t as v,um as y,vm as b}from"./api-CCk5U5gB.js";import{$ as x,Et as S,Q as C,X as w,Z as T,et as E}from"./index-DY7zoioz.js";var D=t(e(),1);function O(e){return e===`user`?o():e===`all`?_():h({group:e.group})}function k(e){return e===`common`?a():e===`owner`?d():h({group:e.group})}var A=n();function j(e){return e.name||e.email||e.userId.slice(0,8)}function M(){let e=m(v.admin.listUsers,{}),[t,n]=(0,D.useState)(``),a=m(v.introspect.introspectUser,t?{userId:t}:`skip`);return(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:b()}),(0,A.jsxs)(w,{value:t,onValueChange:n,children:[(0,A.jsx)(x,{size:`sm`,"aria-label":i(),children:(0,A.jsx)(E,{placeholder:i()})}),(0,A.jsx)(T,{children:(e??[]).map(e=>(0,A.jsx)(C,{value:e.userId,children:j(e)},e._id))})]}),t===``?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:l()}):a===void 0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:r()}):(0,A.jsxs)(`div`,{className:`oc-introspect`,children:[(0,A.jsxs)(`section`,{className:`oc-introspect__section`,children:[(0,A.jsx)(`h3`,{className:`oc-introspect__title`,children:u()}),(0,A.jsxs)(`div`,{className:`oc-introspect__id`,children:[(0,A.jsx)(`strong`,{children:a.user.label}),(0,A.jsx)(S,{variant:`secondary`,children:a.role})]})]}),(0,A.jsxs)(`section`,{className:`oc-introspect__section`,children:[(0,A.jsx)(`h3`,{className:`oc-introspect__title`,children:p()}),a.groups.length===0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:y()}):(0,A.jsx)(`div`,{className:`oc-introspect__chips`,children:a.groups.map(e=>(0,A.jsx)(S,{variant:`secondary`,children:e.name},e.groupId))})]}),(0,A.jsxs)(`section`,{className:`oc-introspect__section`,children:[(0,A.jsx)(`h3`,{className:`oc-introspect__title`,children:g()}),a.agents.length===0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:y()}):(0,A.jsx)(`ul`,{className:`oc-introspect__list`,children:a.agents.map(e=>(0,A.jsxs)(`li`,{className:`oc-introspect__row`,children:[(0,A.jsx)(`span`,{className:`oc-introspect__name`,children:e.displayName||e.agentId}),e.isDefault?(0,A.jsx)(S,{variant:`default`,children:f()}):null,(0,A.jsx)(S,{variant:`outline`,children:O(e.via)}),(0,A.jsx)(S,{variant:`secondary`,children:e.state})]},`${e.instanceName} ${e.agentId}`))})]}),(0,A.jsxs)(`section`,{className:`oc-introspect__section`,children:[(0,A.jsx)(`h3`,{className:`oc-introspect__title`,children:c()}),a.charts.length===0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:y()}):(0,A.jsx)(`ul`,{className:`oc-introspect__list`,children:a.charts.map(e=>(0,A.jsxs)(`li`,{className:`oc-introspect__row`,children:[(0,A.jsx)(`span`,{className:`oc-introspect__name`,children:e.name}),(0,A.jsx)(S,{variant:`outline`,children:k(e.via)})]},e.key))})]}),(0,A.jsxs)(`section`,{className:`oc-introspect__section`,children:[(0,A.jsx)(`h3`,{className:`oc-introspect__title`,children:s()}),a.permissions.length===0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:y()}):(0,A.jsx)(`div`,{className:`oc-introspect__chips`,children:a.permissions.map(e=>(0,A.jsx)(S,{variant:`secondary`,children:e},e))})]})]})]})}export{M as AccessTab};
@@ -1 +1 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Ag as r,Fg as i,Ig as a,Mg as o,Ng as s,Pg as c,jg as l}from"./api-CyG2Kb2E.js";import{t as u}from"./x-CHe0mcCM.js";import{t as d}from"./button-SxU4iS5M.js";import{$ as f,Hn as p,Q as m,X as h,Z as g,et as _,gn as v,jt as y}from"./index-DWkl2h55.js";import{r as b}from"./TimeRangePicker-Dx50b9Tc.js";var x=t(e(),1),S=n(),C=[{value:`eq`,label:`=`},{value:`neq`,label:`≠`},{value:`contains`,label:a()},{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 a=(0,x.useRef)(t),w=!!(a.current&&a.current.length>0),[D,O]=(0,x.useState)(w),[k,A]=(0,x.useState)(()=>w?E(a.current):[]);function j(e){n(e.filter(e=>e.field!==``&&e.value!==``).map(e=>({field:e.field,op:e.op,value:b(e.value)})))}function M(e,t){let n=k.map(n=>n.id===e?{...n,...t}:n);A(n),j(n)}function N(){A(e=>[...e,T()])}function P(e){let t=k.filter(t=>t.id!==e);A(t),j(t)}let F=k.filter(e=>e.field!==``&&e.value!==``).length;return(0,S.jsxs)(`div`,{className:`oc-advfilter`,children:[(0,S.jsxs)(`button`,{type:`button`,className:`oc-advfilter__toggle`,"aria-expanded":D,onClick:()=>O(e=>!e),children:[(0,S.jsx)(p,{className:`oc-advfilter__chevron`+(D?` is-open`:``),"aria-hidden":!0}),i(),F>0?(0,S.jsx)(`span`,{className:`oc-advfilter__count`,children:F}):null]}),D?(0,S.jsxs)(`div`,{className:`oc-advfilter__body`,children:[k.length===0?(0,S.jsx)(`p`,{className:`oc-admin__hint`,children: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)(h,{value:t.field||void 0,onValueChange:e=>M(t.id,{field:e}),children:[(0,S.jsx)(f,{size:`sm`,className:`w-40`,children:(0,S.jsx)(_,{placeholder:s()})}),(0,S.jsx)(g,{children:e.map(e=>(0,S.jsx)(m,{value:e.value,children:e.label},e.value))})]}),(0,S.jsxs)(h,{value:t.op,onValueChange:e=>M(t.id,{op:e}),children:[(0,S.jsx)(f,{size:`sm`,className:`w-28`,children:(0,S.jsx)(_,{})}),(0,S.jsx)(g,{children:C.map(e=>(0,S.jsx)(m,{value:e.value,children:e.label},e.value))})]}),(0,S.jsx)(y,{className:`oc-advfilter__value`,value:t.value,onChange:e=>M(t.id,{value:e.target.value}),placeholder:o()}),(0,S.jsx)(d,{variant:`ghost`,size:`icon-sm`,"aria-label":l(),onClick:()=>P(t.id),children:(0,S.jsx)(u,{})})]},t.id))}),(0,S.jsxs)(d,{variant:`outline`,size:`sm`,className:`oc-advfilter__add`,onClick:N,children:[(0,S.jsx)(v,{}),r()]})]}):null]})}export{D as t};
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Fg as r,Ig as i,Lg as a,Mg as o,Ng as s,Pg as c,jg as l}from"./api-CCk5U5gB.js";import{t as u}from"./x-BvfQ_1AZ.js";import{t as d}from"./button-CbUSFbZL.js";import{$ as f,Hn as p,Q as m,X as h,Z as g,et as _,gn as v,jt as y}from"./index-DY7zoioz.js";import{r as b}from"./TimeRangePicker-qNMV_Gj-.js";var x=t(e(),1),S=n(),C=[{value:`eq`,label:`=`},{value:`neq`,label:`≠`},{value:`contains`,label:a()},{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 a=(0,x.useRef)(t),w=!!(a.current&&a.current.length>0),[D,O]=(0,x.useState)(w),[k,A]=(0,x.useState)(()=>w?E(a.current):[]);function j(e){n(e.filter(e=>e.field!==``&&e.value!==``).map(e=>({field:e.field,op:e.op,value:b(e.value)})))}function M(e,t){let n=k.map(n=>n.id===e?{...n,...t}:n);A(n),j(n)}function N(){A(e=>[...e,T()])}function P(e){let t=k.filter(t=>t.id!==e);A(t),j(t)}let F=k.filter(e=>e.field!==``&&e.value!==``).length;return(0,S.jsxs)(`div`,{className:`oc-advfilter`,children:[(0,S.jsxs)(`button`,{type:`button`,className:`oc-advfilter__toggle`,"aria-expanded":D,onClick:()=>O(e=>!e),children:[(0,S.jsx)(p,{className:`oc-advfilter__chevron`+(D?` is-open`:``),"aria-hidden":!0}),i(),F>0?(0,S.jsx)(`span`,{className:`oc-advfilter__count`,children:F}):null]}),D?(0,S.jsxs)(`div`,{className:`oc-advfilter__body`,children:[k.length===0?(0,S.jsx)(`p`,{className:`oc-admin__hint`,children:r()}):(0,S.jsx)(`ul`,{className:`oc-advfilter__rows`,children:k.map(t=>(0,S.jsxs)(`li`,{className:`oc-advfilter__row`,children:[(0,S.jsxs)(h,{value:t.field||void 0,onValueChange:e=>M(t.id,{field:e}),children:[(0,S.jsx)(f,{size:`sm`,className:`w-40`,children:(0,S.jsx)(_,{placeholder:c()})}),(0,S.jsx)(g,{children:e.map(e=>(0,S.jsx)(m,{value:e.value,children:e.label},e.value))})]}),(0,S.jsxs)(h,{value:t.op,onValueChange:e=>M(t.id,{op:e}),children:[(0,S.jsx)(f,{size:`sm`,className:`w-28`,children:(0,S.jsx)(_,{})}),(0,S.jsx)(g,{children:C.map(e=>(0,S.jsx)(m,{value:e.value,children:e.label},e.value))})]}),(0,S.jsx)(y,{className:`oc-advfilter__value`,value:t.value,onChange:e=>M(t.id,{value:e.target.value}),placeholder:s()}),(0,S.jsx)(d,{variant:`ghost`,size:`icon-sm`,"aria-label":o(),onClick:()=>P(t.id),children:(0,S.jsx)(u,{})})]},t.id))}),(0,S.jsxs)(d,{variant:`outline`,size:`sm`,className:`oc-advfilter__add`,onClick:N,children:[(0,S.jsx)(v,{}),l()]})]}):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{$z as r,Ad as i,Ao as a,Bd as o,Bo as s,Cd as c,Co as l,Dd as u,Do as d,Ed as f,Eo as p,Fd as m,Fo as h,Gd as g,Hd as _,Ho as v,Id as y,If as b,Io as x,Jd as S,Kd as C,Ld as w,Lo as T,Md as E,Mo as D,Nd as O,No as k,Od as ee,Oo as A,Pd as te,Pf as ne,Po as j,Rd as re,Ro as M,Rt as N,Sd as P,So as F,Td as I,To as L,Ud as R,Vd as ie,Vo as z,Wd as B,Xd as ae,Yd as oe,Zz as V,aB as se,ao as H,eo as U,io as ce,jd as le,jo as ue,kd as de,ko as fe,nM as pe,no as me,oB as W,oo as he,qd as ge,rB as G,ro as _e,t as K,to as ve,wd as ye,wo as be,xd as xe,zd as Se,zo as Ce}from"./api-CCk5U5gB.js";import{t as q}from"./button-CbUSFbZL.js";import{$ as we,B as Te,Ct as Ee,Dt as J,Et as De,Q as Oe,St as ke,Tt as Ae,X as je,Z as Me,at as Ne,bt as Pe,et as Fe,nt as Ie,ot as Le,q as Re,rt as ze,tt as Be,un as Y,vt as Ve,wt as He,xt as Ue,yt as We}from"./index-DY7zoioz.js";import{n as Ge,t as Ke}from"./curation-CQksaIbm.js";import{a as qe}from"./compatView-DgV9jG5C.js";/* empty css */var X=t(e(),1),Je=2e4,Ye=6e4;function Xe(e){return typeof e!=`number`||e<=0?0:Math.round(e/Je*100)}function Ze(e){return e<=0?0:Math.round(e/Ye*100)}function Z(e,t){let n=(typeof e==`number`&&e>0?e:0)/1e3;return new Intl.NumberFormat(t,{minimumFractionDigits:1,maximumFractionDigits:1}).format(n)}function Qe(e){return e.reduce((e,t)=>e+(typeof t.size==`number`&&t.size>0?t.size:0),0)}var $e=3;function et(e,t){let n=new Map;for(let t of e.split(`
2
+ `))n.set(t,(n.get(t)??0)+1);for(let e of t.split(`
3
+ `))n.set(e,(n.get(e)??0)-1);let r=0,i=0,a=[],o=[];for(let[e,t]of n)t<0?(r+=-t,a.length<$e&&a.push(e)):t>0&&(i+=t,o.length<$e&&o.push(e));return{added:r,removed:i,sampleAdded:a,sampleRemoved:o}}function tt(e){return(e instanceof Error?e.message:String(e)).includes(`DASHBOARD_NOT_DEPLOYED`)}function nt(e){return e instanceof Error?e.message.includes(`conflict:`):String(e).includes(`conflict:`)}var Q=n(),$=e=>`${e.instanceName}::${e.agentId}`;function rt(){let e=W(K.me.getMe,{host:Re}),t=e?.role===`admin`,n=(e?.permissions??[]).includes(`bridge.read`),i=W(K.admin.listInstances,e!==void 0&&t?{}:`skip`),[a,s]=(0,X.useState)(null);(0,X.useEffect)(()=>{!t||!i||i.length===0||(!a||!i.some(e=>e.name===a))&&s(i[0].name)},[t,i,a]);let c=W(K.agents.listAgentsForInstance,t&&a?{instanceName:a}:`skip`),l=W(K.agents.listMyAgents,e!==void 0&&!t?{}:`skip`),u=(0,X.useMemo)(()=>{if(e!==void 0){if(t)return a===null||c===void 0?i!==void 0&&i.length===0?[]:void 0:c.agents.map(e=>({instanceName:a,agentId:e.agentId,label:`${e.emoji?`${e.emoji} `:``}${e.displayName??e.agentId}`}));if(l!==void 0)return l.map(e=>({instanceName:e.instanceName,agentId:e.agentId,label:`${e.emoji?`${e.emoji} `:``}${e.displayName??e.agentId}`}))}},[e,t,a,c,i,l]),[d,f]=(0,X.useState)(null);(0,X.useEffect)(()=>{!u||u.length===0||(!d||!u.some(e=>$(e)===d))&&f($(u[0]))},[u,d]);let p=u?.find(e=>$(e)===d)??null,m=G(K.agentFiles.listAgentFiles),[h,v]=(0,X.useState)({status:`idle`}),y=p?.instanceName??null,b=p?.agentId??null,x=W(K.compat.forInstance,n&&y!==null?{instanceName:y}:`skip`),w=n&&y!==null?Te(x,`agentFiles`):null,E=w===null?!1:w===`loading`?null:w.blocked,D=(0,X.useCallback)(async()=>{if(!(y===null||b===null)){v({status:`loading`});try{v({status:`done`,files:(await m({instanceName:y,agentId:b})).files})}catch(e){v({status:`error`,dashboardAbsent:tt(e)})}}},[m,y,b]);(0,X.useEffect)(()=>{E===!1&&D()},[D,E]);let[O,k]=(0,X.useState)(null),ee=W(K.agentFileCuration.listCurations,t&&y!==null&&b!==null?{instanceName:y,agentId:b}:`skip`),A=W(K.agentFileCuration.curationSettings,t&&y!==null?{instanceName:y}:`skip`),te=G(K.agentFileCuration.requestCuration),[j,P]=(0,X.useState)(null),[F,I]=(0,X.useState)(null),{toast:L}=J(),z=(0,X.useMemo)(()=>{let e=new Map;for(let t of ee??[])e.has(t.name)||e.set(t.name,t);return e},[ee]),se=(0,X.useCallback)(async e=>{if(!(y===null||b===null)){P(e);try{let t=await te({instanceName:y,agentId:b,name:e,trigger:`manual`});t.ok?L({title:Ce(),variant:`success`}):L({title:M({reason:t.reason??`unknown`}),variant:`error`})}catch{L({title:T(),variant:`error`})}finally{P(null)}}},[te,y,b,L]),H=r(),U=(0,X.useMemo)(()=>new Intl.NumberFormat(H,{maximumFractionDigits:0}),[H]);return e===void 0||u===void 0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:V()}):(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&&(i?.length??0)>1?(0,Q.jsxs)(je,{value:a??``,onValueChange:e=>s(e),children:[(0,Q.jsx)(we,{size:`sm`,"aria-label":oe(),children:(0,Q.jsx)(Fe,{})}),(0,Q.jsx)(Me,{children:(i??[]).map(e=>(0,Q.jsx)(Oe,{value:e.name,children:e.name},e.name))})]}):null,u.length>0?(0,Q.jsxs)(je,{value:d??``,onValueChange:e=>f(e),children:[(0,Q.jsx)(we,{size:`sm`,"aria-label":S(),children:(0,Q.jsx)(Fe,{})}),(0,Q.jsx)(Me,{children:u.map(e=>(0,Q.jsx)(Oe,{value:$(e),children:e.label},$(e)))})]}):(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:ge()})]}),p===null?null:w===`loading`?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:V()}):w!==null&&w.blocked?(0,Q.jsxs)(`p`,{className:`oc-compat__blocked`,role:`status`,children:[(0,Q.jsx)(Y,{size:14,"aria-hidden":!0}),` `,qe(w.gatewayVersion,w.provider)]}):h.status===`loading`||h.status===`idle`?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:V()}):h.status===`error`?(0,Q.jsxs)(`p`,{className:`oc-afiles__error`,role:`alert`,children:[h.dashboardAbsent?N():g(),` `,!h.dashboardAbsent&&(0,Q.jsx)(q,{variant:`outline`,size:`sm`,onClick:()=>void D(),children:ne()})]}):h.files.length===0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:C()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`div`,{className:`oc-afiles__list`,children:h.files.map(e=>{let n=Xe(e.size),r=n>=80;return(0,Q.jsxs)(`div`,{className:`oc-afiles__row`,children:[(0,Q.jsx)(`span`,{className:`oc-afiles__name`,title:e.name,children:e.name}),e.missing?(0,Q.jsx)(De,{variant:`outline`,children:B()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`span`,{className:`oc-afiles__size`,children:R({size:Z(e.size,H)})}),(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:_({pct:U.format(n)})}),r?(0,Q.jsx)(Y,{size:14,className:`oc-afiles__warn`,"aria-label":ie()}):(0,Q.jsx)(`span`,{className:`oc-afiles__warn-slot`,"aria-hidden":!0})]}),(0,Q.jsx)(q,{variant:`outline`,size:`sm`,className:`oc-afiles__open`,onClick:()=>k(e),children:t?Se():re()}),t&&!e.missing?(0,Q.jsx)(it,{curatable:Ke.includes(e.name),size:e.size??0,budget:A?.budgetChars??null,enabled:A?.enabled??!1,curation:z.get(e.name)??null,inFlight:j===e.name,onCurate:()=>void se(e.name),onReview:e=>I(e)}):null]},e.name)})}),(0,Q.jsx)(`p`,{className:`oc-afiles__budget`,children:o({used:Z(Qe(h.files),H),total:Z(Ye,H),pct:U.format(Ze(Qe(h.files)))})})]}),O&&p?(0,Q.jsx)(at,{instanceName:p.instanceName,agentId:p.agentId,name:O.name,isAdmin:t,onClose:()=>k(null),onSaved:()=>void D()}):null,F?(0,Q.jsx)(ot,{curationId:F,onClose:()=>I(null),onApplied:()=>{I(null),D()}}):null]})}function it({curatable:e,size:t,budget:n,enabled:r,curation:i,inFlight:a,onCurate:o,onReview:c}){return i?.status===`proposed`?(0,Q.jsx)(q,{variant:`default`,size:`sm`,className:`oc-afiles__curate`,onClick:()=>c(i._id),children:z()}):a||i?.status===`dispatched`||i?.status===`applying`?(0,Q.jsx)(De,{variant:`outline`,className:`oc-afiles__curate-status`,children:s()}):e&&r&&n!==null&&Ge(t,n)?(0,Q.jsx)(q,{variant:`outline`,size:`sm`,className:`oc-afiles__curate`,onClick:o,children:v()}):null}function at({instanceName:e,agentId:t,name:n,isAdmin:a,onClose:o,onSaved:s}){let l=G(K.agentFiles.getAgentFile),d=G(K.agentFiles.setAgentFile),p=J(),[h,g]=(0,X.useState)(null),[_,v]=(0,X.useState)(!1),[x,S]=(0,X.useState)(``),[C,T]=(0,X.useState)(!1),[D,k]=(0,X.useState)(!1),[A,j]=(0,X.useState)(!1),[re,M]=(0,X.useState)(!1),N=(0,X.useCallback)(async r=>{v(!1);try{let i=await l({instanceName:e,agentId:t,name:n});g({content:i.content,updatedAtMs:i.updatedAtMs}),r||S(i.content),j(!1)}catch{v(!0)}},[l,e,t,n]);(0,X.useEffect)(()=>{N(!1)},[N]);async function F(){if(h!==null){k(!0),M(!1);try{await d({instanceName:e,agentId:t,name:n,content:x,baseUpdatedAtMs:h.updatedAtMs??void 0}),p.success(le({name:n})),s(),await N(!1)}catch(e){nt(e)?j(!0):M(!0)}finally{k(!1)}}}let L=h!==null&&x!==h.content,R=(0,X.useMemo)(()=>h===null?null:et(h.content,x),[h,x]),ie=x.length>Je,z=r(),B=(0,X.useMemo)(()=>new Intl.NumberFormat(z),[z]);return(0,Q.jsx)(Be,{open:!0,onOpenChange:e=>!e&&o(),children:(0,Q.jsxs)(Ie,{className:`oc-afiles__editor`,children:[(0,Q.jsxs)(Ne,{children:[(0,Q.jsx)(Le,{children:w({name:n})}),(0,Q.jsxs)(ze,{children:[y({agent:t,instance:e}),a?null:(0,Q.jsxs)(Q.Fragment,{children:[` · `,m()]})]})]}),_?(0,Q.jsxs)(`p`,{className:`oc-afiles__error`,role:`alert`,children:[de(),` `,(0,Q.jsx)(q,{variant:`outline`,size:`sm`,onClick:()=>void N(!1),children:ne()})]}):h===null?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:V()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`textarea`,{className:`oc-afiles__source`,value:x,readOnly:!a,spellCheck:!1,onChange:e=>S(e.target.value),"aria-label":w({name:n})}),(0,Q.jsx)(`p`,{className:`oc-afiles__hint`,children:te()}),A?(0,Q.jsxs)(`p`,{className:`oc-afiles__error`,role:`alert`,children:[ee(),` `,(0,Q.jsx)(q,{variant:`outline`,size:`sm`,onClick:()=>void N(!0),children:u()})]}):null,re?(0,Q.jsx)(`p`,{className:`oc-afiles__error`,role:`alert`,children:i()}):null,(0,Q.jsxs)(`div`,{className:`oc-afiles__editor-foot`,children:[(0,Q.jsx)(`span`,{className:`oc-afiles__count${ie?` is-over`:``}`,children:O({count:B.format(x.length),max:B.format(Je)})}),a?(0,Q.jsx)(q,{size:`sm`,disabled:!L||D||A,onClick:()=>T(!0),children:D?b():E()}):null]})]}),(0,Q.jsx)(Ve,{open:C,onOpenChange:T,children:(0,Q.jsxs)(Ue,{children:[(0,Q.jsxs)(He,{children:[(0,Q.jsx)(Ae,{children:f({name:n})}),(0,Q.jsx)(ke,{children:I({agent:t})})]}),R?(0,Q.jsxs)(`div`,{className:`oc-afiles__diff`,children:[(0,Q.jsx)(`p`,{className:`oc-afiles__diff-counts`,children:ye({added:R.added,removed:R.removed})}),R.sampleAdded.length>0?(0,Q.jsxs)(`div`,{className:`oc-afiles__diff-block`,children:[(0,Q.jsx)(`span`,{className:`oc-afiles__diff-label`,children:c()}),R.sampleAdded.map((e,t)=>(0,Q.jsx)(`code`,{className:`oc-afiles__diff-line is-add`,children:e||` `},t))]}):null,R.sampleRemoved.length>0?(0,Q.jsxs)(`div`,{className:`oc-afiles__diff-block`,children:[(0,Q.jsx)(`span`,{className:`oc-afiles__diff-label`,children:P()}),R.sampleRemoved.map((e,t)=>(0,Q.jsx)(`code`,{className:`oc-afiles__diff-line is-del`,children:e||` `},t))]}):null]}):null,(0,Q.jsxs)(Ee,{children:[(0,Q.jsx)(Pe,{children:pe()}),(0,Q.jsx)(We,{onClick:()=>void F(),children:xe()})]})]})})]})})}function ot({curationId:e,onClose:t,onApplied:n}){let i=W(K.agentFileCuration.getProposal,{curationId:e}),o=G(K.agentFileCuration.approveCuration),s=se(K.agentFileCuration.rejectCuration),{toast:c}=J(),[u,f]=(0,X.useState)(null),[m,g]=(0,X.useState)(!1),[_,v]=(0,X.useState)(``),y=r(),S=(0,X.useMemo)(()=>i?et(i.beforeContent,i.proposedContent):null,[i]);async function C(){f(`approve`);try{let t=await o({curationId:e});t.ok?(c({title:x(),variant:`success`}),n()):c({title:t.reason===`conflict`?j():k({reason:t.reason??`unknown`}),variant:`error`})}catch{c({title:T(),variant:`error`})}finally{f(null)}}async function w(n){f(`reject`);try{let r=_.trim();(await s({curationId:e,...r?{comment:r}:{},relaunch:n})).ok?c({title:n?ve():h(),variant:`success`}):c({title:a(),variant:`error`}),t()}catch{c({title:T(),variant:`error`})}finally{f(null)}}return(0,Q.jsx)(Be,{open:!0,onOpenChange:e=>e?void 0:t(),children:(0,Q.jsxs)(Ie,{className:`oc-afiles__review`,children:[(0,Q.jsxs)(Ne,{children:[(0,Q.jsx)(Le,{children:i?D({name:i.name}):V()}),(0,Q.jsx)(ze,{children:ue()})]}),i===void 0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:V()}):i===null?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:a()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`p`,{className:`oc-afiles__review-sizes`,children:[fe({before:Z(i.beforeSize,y),after:Z(i.proposedSize,y)}),i.overBudget?(0,Q.jsxs)(Q.Fragment,{children:[` `,(0,Q.jsx)(Y,{size:13,"aria-hidden":!0}),` `,A()]}):null]}),S?(0,Q.jsx)(`p`,{className:`oc-afiles__review-diff`,children:d({added:S.added,removed:S.removed})}):null,i.feedback?(0,Q.jsx)(`p`,{className:`oc-afiles__review-feedback`,children:U({feedback:i.feedback})}):null,S&&S.sampleRemoved.length>0?(0,Q.jsxs)(`div`,{className:`oc-afiles__review-removed`,children:[(0,Q.jsx)(`p`,{className:`oc-afiles__review-label`,children:F()}),(0,Q.jsx)(`ul`,{children:S.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:l()}),(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:p()}),(0,Q.jsx)(`pre`,{className:`oc-afiles__review-pre`,children:i.proposedContent})]})]})]}),m?(0,Q.jsxs)(`div`,{className:`oc-afiles__reject-form`,children:[(0,Q.jsx)(`label`,{className:`oc-afiles__review-label`,htmlFor:`curation-reject-comment`,children:he()}),(0,Q.jsx)(`textarea`,{id:`curation-reject-comment`,className:`oc-afiles__reject-textarea`,rows:3,placeholder:H(),value:_,onChange:e=>v(e.target.value)}),(0,Q.jsxs)(`div`,{className:`oc-afiles__review-actions`,children:[(0,Q.jsx)(q,{variant:`ghost`,onClick:()=>g(!1),disabled:u!==null,children:ce()}),(0,Q.jsx)(q,{variant:`outline`,onClick:()=>void w(!1),disabled:u!==null,children:u===`reject`?b():_e()}),(0,Q.jsx)(q,{variant:`default`,onClick:()=>void w(!0),disabled:u!==null,children:u===`reject`?b():me()})]})]}):(0,Q.jsxs)(`div`,{className:`oc-afiles__review-actions`,children:[(0,Q.jsx)(q,{variant:`outline`,onClick:()=>g(!0),disabled:u!==null||i==null,children:L()}),(0,Q.jsx)(q,{variant:`default`,onClick:()=>void C(),disabled:u!==null||i==null,children:u===`approve`?b():be()})]})]})})}export{rt as AgentFilesTab};
@@ -0,0 +1 @@
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$C as r,AC as i,BC as ee,Cw as a,FC as o,GC as te,HC as ne,IC as s,JC as c,KC as re,LC as l,MC as u,NC as d,PC as f,QC as ie,RC as ae,Sw as oe,Tw as p,UC as se,VC as ce,WC as le,XC as ue,YC as m,ZC as h,_w as de,aB as fe,aw as g,bw as pe,cw as me,dw as he,ew as ge,fw as _e,gw as ve,hw as ye,iw as be,jC as _,lw as xe,mw as Se,nw as v,oB as y,ow as b,pw as x,qC as S,rw as C,sw as w,t as T,tw as E,uw as D,vw as O,ww as k,xw as A,yw as j,zC as Ce}from"./api-CCk5U5gB.js";import{$ as M,Dt as we,Et as N,Gn as P,Kn as Te,Q as F,U as Ee,X as I,Z as L,at as R,ct as z,et as B,i as V,nt as H,o as De,ot as U,q as Oe,tt as W}from"./index-DY7zoioz.js";import{n as ke}from"./TimeRangePicker-qNMV_Gj-.js";import{t as Ae}from"./FilterBar-BJ1mhU3e.js";import{t as je}from"./DataTableShell-BWoSBli_.js";import{t as G}from"./dispatchErrorInfo-CW9VFOfh.js";var K=t(e(),1),q=n(),J=`__all__`,Me=[{value:`open`},{value:`acknowledged`},{value:`resolved`}];function Ne(e){return e===`open`?p():e===`acknowledged`?k():a()}var Pe=[`info`,`warn`,`critical`],Fe=[`detector`,`agent`,`user`],Ie={kind:`relative`,from:`now-30d`,to:`now`},Le=200,Y=`all`;function X(){let e=Te({from:`/settings/anomalies`}),t=P({from:`/settings/anomalies`}),n=e.q??``,i=e.status===Y?J:e.status,a=e.severity??J,o=e.kind??J,[s,l]=(0,K.useState)(J),u=V(e.from,e.to),{from:d,to:f}=ke(u),p=e=>void t({search:t=>({...t,q:e||void 0}),replace:!0}),_=e=>void t({search:t=>({...t,status:e===J?Y:e})}),k=e=>void t({search:t=>({...t,severity:e===J?void 0:e})}),R=e=>void t({search:t=>({...t,kind:e===J?void 0:e})}),H=e=>void t({search:t=>({...t,...De(e)})}),U=Ee(),W=we(),G=fe(T.anomalies.resolveAnomaly),X=(y(T.me.getMe,{host:Oe})?.permissions??[]).includes(`admin.manage`),Z=y(T.anomalies.listAnomalies,{limit:Le,filter:{q:n||void 0,from:d,to:f,anomalyStatus:i===J?void 0:i,severity:a===J?void 0:a,source:s===J?void 0:s,kind:o===J?void 0:o}}),Q=(0,K.useMemo)(()=>{let e=new Set;for(let t of Z??[])e.add(t.kind);return[...e].sort()},[Z]),$=n!==``||i!==`open`||a!==J||s!==J||o!==J||u.kind!==`relative`||u.from!==Ie.from;function Ue(){l(J),t({search:{status:`open`},replace:!0})}async function We(e){if(await U({title:oe(),description:(0,q.jsxs)(q.Fragment,{children:[A(),` `,(0,q.jsx)(`span`,{className:`font-mono`,children:e.kind}),` `,pe(),` `,(0,q.jsx)(`strong`,{children:j()}),`.`,` `,O()]}),confirmLabel:de()}))try{await G({anomalyId:e._id,status:`resolved`}),W.success(ve(),e.kind)}catch(e){W.error(ye(),e)}}async function Ge(e){try{await G({anomalyId:e._id,status:`acknowledged`}),W.success(Se(),e.kind)}catch(e){W.error(x(),e)}}return(0,q.jsxs)(q.Fragment,{children:[(0,q.jsxs)(`p`,{className:`oc-admin__hint`,children:[_e(),` `,(0,q.jsx)(`strong`,{children:he()}),` `,D(),` `,(0,q.jsx)(`strong`,{children:xe()}),` `,me(),` `,(0,q.jsx)(`strong`,{children:w()}),` `,b(),` `,(0,q.jsx)(`span`,{className:`oc-filter__window`,children:g()})]}),(0,q.jsxs)(Ae,{q:n,onQChange:p,searchPlaceholder:be(),timeRange:u,onTimeRangeChange:H,onReset:Ue,canReset:$,children:[(0,q.jsxs)(I,{value:i,onValueChange:_,children:[(0,q.jsx)(M,{size:`sm`,className:`w-36`,children:(0,q.jsx)(B,{})}),(0,q.jsxs)(L,{children:[(0,q.jsx)(F,{value:J,children:C()}),Me.map(e=>(0,q.jsx)(F,{value:e.value,children:Ne(e.value)},e.value))]})]}),(0,q.jsxs)(I,{value:a,onValueChange:k,children:[(0,q.jsx)(M,{size:`sm`,className:`w-36`,children:(0,q.jsx)(B,{placeholder:v()})}),(0,q.jsxs)(L,{children:[(0,q.jsx)(F,{value:J,children:ie()}),Pe.map(e=>(0,q.jsx)(F,{value:e,children:e},e))]})]}),(0,q.jsxs)(I,{value:s,onValueChange:l,children:[(0,q.jsx)(M,{size:`sm`,className:`w-32`,children:(0,q.jsx)(B,{placeholder:h()})}),(0,q.jsxs)(L,{children:[(0,q.jsx)(F,{value:J,children:ue()}),Fe.map(e=>(0,q.jsx)(F,{value:e,children:e},e))]})]}),(0,q.jsxs)(I,{value:o,onValueChange:R,children:[(0,q.jsx)(M,{size:`sm`,className:`w-36`,children:(0,q.jsx)(B,{placeholder:m()})}),(0,q.jsxs)(L,{children:[(0,q.jsx)(F,{value:J,children:c()}),Q.map(e=>(0,q.jsx)(F,{value:e,children:e},e))]})]})]}),(0,q.jsx)(je,{title:S(),rows:Z,emptyHint:i===`open`?re():te(),rowActions:e=>X&&e.status===`open`?[{label:le(),onSelect:()=>void We(e)},{label:se(),onSelect:()=>void Ge(e)}]:[],columns:[{header:ne(),cell:e=>(0,q.jsx)(`span`,{className:`oc-traces__time`,children:z(e.at)}),sort:e=>e.at},{header:m(),cell:e=>(0,q.jsx)(`code`,{className:`oc-traces__mono`,children:e.kind}),sort:e=>e.kind},{header:E(),cell:e=>e.occurrenceCount!==null&&e.occurrenceCount>1?(0,q.jsx)(`span`,{className:`oc-traces__time`,title:e.firstAt===null?void 0:r({when:z(e.firstAt)}),children:ge({count:String(e.occurrenceCount)})}):(0,q.jsx)(`span`,{className:`oc-traces__time`,children:`—`}),sort:e=>e.occurrenceCount??0},{header:v(),cell:e=>(0,q.jsx)(Be,{severity:e.severity}),sort:e=>e.severity===`critical`?2:+(e.severity===`warn`)},{header:ce(),cell:e=>(0,q.jsx)(Ve,{status:e.status}),sort:e=>e.status===`resolved`?2:+(e.status===`acknowledged`)},{header:h(),cell:e=>(0,q.jsx)(N,{variant:`outline`,children:e.source}),sort:e=>e.source},{header:ee(),cell:e=>(0,q.jsxs)(`div`,{className:`oc-anomaly__msgcell`,children:[(0,q.jsx)(`span`,{className:`oc-anomaly__msg`,children:e.message}),(0,q.jsx)(ze,{row:e})]}),sort:e=>e.message},{header:Ce(),cell:e=>(0,q.jsx)(Re,{row:e}),sort:e=>e.evidence??null},{header:ae(),cell:e=>e.correlationId?(0,q.jsx)(`code`,{className:`oc-traces__mono`,children:He(e.correlationId)}):(0,q.jsx)(`span`,{className:`oc-traces__muted`,children:`—`}),sort:e=>e.correlationId}]})]})}var Z=new Set([`openclaw.dispatch_failures`,`assistant.announce_errors`]);function Q(e){if(!Z.has(e.kind)||!e.evidence)return{};try{let t=JSON.parse(e.evidence);return{dominantCode:t.dominantCode,sampleCorrelationId:t.sampleCorrelationId}}catch{return{}}}function $(e){if(e.kind!==`subagent.failure`||!e.evidence)return{};try{let t=JSON.parse(e.evidence);return{failedCount:t.failedCount,totalCount:t.totalCount,errorCategories:t.errorCategories}}catch{return{}}}function Re({row:e}){let t=P();if(e.kind===`subagent.failure`){let n=$(e);return(0,q.jsxs)(`div`,{className:`oc-anomaly__cause`,children:[(0,q.jsx)(`div`,{className:`oc-anomaly__cause-head`,children:[...new Set(n.errorCategories??[])].map(e=>(0,q.jsx)(`code`,{className:`oc-traces__mono`,children:e},e))}),e.correlationId?(0,q.jsxs)(`button`,{type:`button`,className:`oc-anomaly__drill`,onClick:()=>void t({to:`/settings/traces`,search:{q:e.correlationId,limit:100}}),children:[`↗ `,l()]}):null]})}let n=Q(e);if(!n.dominantCode){let e=n.sampleCorrelationId;return e?(0,q.jsx)(`div`,{className:`oc-anomaly__cause`,children:(0,q.jsxs)(`button`,{type:`button`,className:`oc-anomaly__drill`,onClick:()=>void t({to:`/settings/traces`,search:{correlationId:e,limit:100}}),children:[`↗ `,l()]})}):(0,q.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})}let r=G(n.dominantCode),i=n.sampleCorrelationId;return(0,q.jsxs)(`div`,{className:`oc-anomaly__cause`,children:[(0,q.jsxs)(`div`,{className:`oc-anomaly__cause-head`,children:[(0,q.jsx)(`span`,{className:`oc-anomaly__cause-label`,children:r.label}),(0,q.jsx)(`code`,{className:`oc-traces__mono`,children:n.dominantCode})]}),(0,q.jsx)(`p`,{className:`oc-anomaly__cause-hint`,children:r.hint}),i?(0,q.jsxs)(`button`,{type:`button`,className:`oc-anomaly__drill`,onClick:()=>void t({to:`/settings/traces`,search:{correlationId:i,limit:100}}),children:[`↗ `,l()]}):null]})}function ze({row:e}){let[t,n]=(0,K.useState)(!1),r=y(T.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:[s(),e.attachments.length>1?` (${e.attachments.length})`:``]}),(0,q.jsx)(W,{open:t,onOpenChange:n,children:(0,q.jsxs)(H,{className:`oc-anomaly__attachments-dialog`,children:[(0,q.jsx)(R,{children:(0,q.jsx)(U,{children:o()})}),r===void 0?(0,q.jsx)(`p`,{className:`oc-traces__muted`,children:f()}):r.length===0?(0,q.jsx)(`p`,{className:`oc-traces__muted`,children:d()}):(0,q.jsx)(`div`,{className:`oc-anomaly__attachments`,children:r.map(e=>(0,q.jsxs)(`section`,{className:`oc-anomaly__attachment`,children:[(0,q.jsx)(`h4`,{className:`oc-anomaly__attachment-name`,children:(0,q.jsx)(`code`,{className:`oc-traces__mono`,children:e.name})}),(0,q.jsx)(`pre`,{className:`oc-anomaly__attachment-content`,children:e.content})]},e.name))})]})})]})}function Be({severity:e}){return(0,q.jsx)(`span`,{className:`oc-anomaly__sev oc-anomaly__sev--${e}`,children:e})}function Ve({status:e}){return e===`open`?(0,q.jsx)(N,{variant:`destructive`,children:u()}):e===`acknowledged`?(0,q.jsx)(N,{variant:`secondary`,children:_()}):(0,q.jsx)(N,{variant:`outline`,children:i()})}function He(e){return e.length>8?e.slice(0,8):e}export{X as AnomaliesTab};
@@ -0,0 +1 @@
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$i as r,AT as i,CT as a,DT as o,ET as s,OT as c,Qi as l,ST as u,TT as d,Zi as f,_T as p,bT as m,ea as h,gT as g,kT as _,na as v,oB as y,t as b,ta as x,vT as S,wT as C,xT as w,yT as T}from"./api-CCk5U5gB.js";import{$ as E,Gn as D,Kn as O,Q as k,X as A,Z as j,a as M,ct as N,et as P,i as F,n as I,o as L,s as R}from"./index-DY7zoioz.js";import{n as ee}from"./TimeRangePicker-qNMV_Gj-.js";import{t as z}from"./FilterBar-BJ1mhU3e.js";import{t as B}from"./AdvancedFilter-CDngwUem.js";import{t as V}from"./DataTableShell-BWoSBli_.js";var H=t(e(),1),U=n(),W={kind:`relative`,from:I,to:`now`},G=`__all__`,K=[{value:`action`,label:v()},{value:`realLabel`,label:x()},{value:`targetLabel`,label:h()},{value:`impersonated`,label:r()},{value:`resource`,label:l()},{value:`resourceId`,label:f()}];function q(){let e=O({from:`/settings/audit`}),t=D({from:`/settings/audit`}),n=e.q??``,r=e.action??G,l=e.impersonated??G,f=e.resource??G,h=F(e.from,e.to),v=(0,H.useMemo)(()=>R(e.adv),[e.adv]),{from:x,to:I}=ee(h),q=e=>void t({search:t=>({...t,q:e||void 0}),replace:!0}),J=e=>void t({search:t=>({...t,action:e===G?void 0:e})}),Y=e=>void t({search:t=>({...t,impersonated:e===G?void 0:e})}),X=e=>void t({search:t=>({...t,resource:e===G?void 0:e})}),Z=e=>void t({search:t=>({...t,...L(e)})}),Q=e=>void t({search:t=>({...t,adv:M(e)}),replace:!0}),$=y(b.admin.listAudit,{filter:{q:n||void 0,from:x,to:I,action:r===G?void 0:r,resource:f===G?void 0:f,impersonated:l===G?void 0:l===`yes`,advanced:v.length>0?v: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!==``||r!==G||l!==G||f!==G||v.length>0||h.kind!==`relative`||h.from!==W.from;function ie(){t({search:{},replace:!0})}return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(`p`,{className:`oc-admin__hint`,children:[i(),` `,(0,U.jsx)(`span`,{className:`oc-filter__window`,children:_()})]}),(0,U.jsxs)(z,{q:n,onQChange:q,searchPlaceholder:c(),timeRange:h,onTimeRangeChange:Z,onReset:ie,canReset:re,children:[(0,U.jsxs)(A,{value:r,onValueChange:J,children:[(0,U.jsx)(E,{size:`sm`,className:`w-40`,children:(0,U.jsx)(P,{placeholder:o()})}),(0,U.jsxs)(j,{children:[(0,U.jsx)(k,{value:G,children:s()}),te.map(e=>(0,U.jsx)(k,{value:e,children:e},e))]})]}),(0,U.jsxs)(A,{value:l,onValueChange:Y,children:[(0,U.jsx)(E,{size:`sm`,className:`w-40`,children:(0,U.jsx)(P,{})}),(0,U.jsxs)(j,{children:[(0,U.jsx)(k,{value:G,children:d()}),(0,U.jsx)(k,{value:`yes`,children:C()}),(0,U.jsx)(k,{value:`no`,children:a()})]})]}),(0,U.jsxs)(A,{value:f,onValueChange:X,children:[(0,U.jsx)(E,{size:`sm`,className:`w-40`,children:(0,U.jsx)(P,{placeholder:u()})}),(0,U.jsxs)(j,{children:[(0,U.jsx)(k,{value:G,children:w()}),ne.map(e=>(0,U.jsx)(k,{value:e,children:e},e))]})]})]}),(0,U.jsx)(B,{fields:K,seed:v,onChange:Q}),(0,U.jsx)(V,{title:m(),rows:$,emptyHint:T(),columns:[{header:S(),cell:e=>N(e.at),sort:e=>e.at},{header:o(),cell:e=>e.action,sort:e=>e.action},{header:p(),cell:e=>e.realLabel,sort:e=>e.realLabel},{header:g(),cell:e=>e.targetLabel??`—`,sort:e=>e.targetLabel??null},{header:u(),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{$u as r,$y as i,Ab as a,Bb as o,Cb as s,Ci as c,Cx as l,D as u,Db as d,Dx as f,Eb as p,Ei as m,Ex as h,Fb as g,Gb as ee,Hb as te,Ib as _,Jb as ne,Kb as re,Lb as ie,Mb as v,Mx as y,Nb as b,Ob as x,Ox as ae,Pb as oe,Qu as se,Qy as ce,Rb as le,Sb as ue,Si as de,Sx as fe,Tb as pe,Tx as me,Ub as he,Vb as ge,Wb as _e,Xb as ve,Yb as ye,_b as be,aB as xe,ab as Se,ad as Ce,bb as we,bi as Te,cb as Ee,cd as De,db as Oe,eb as S,ed as ke,fb as C,gb as Ae,hb as je,ib as Me,id as Ne,jb as Pe,jx as Fe,kb as Ie,kx as Le,lb as Re,ld as ze,mb as Be,nb as Ve,nd as He,oB as w,ob as Ue,od as We,pb as Ge,qb as Ke,qu as qe,rB as Je,rb as Ye,rd as Xe,sb as Ze,sd as Qe,t as T,tb as $e,td as et,ub as tt,ud as nt,vb as rt,vx as it,wb as at,wx as ot,xb as st,xi as ct,yb as lt,yi as ut,yx as dt,zb as ft,zt as pt}from"./api-CCk5U5gB.js";import{t as mt}from"./chevrons-up-down-DAdQ-ohu.js";import{i as ht,n as E,o as gt,r as _t,s as vt}from"./FieldLabel-8vj4ipPC.js";import{i as yt,n as bt,r as xt,t as St}from"./tabs-BwhZusQZ.js";import{t as D}from"./button-CbUSFbZL.js";import{$ as O,Bn as k,Bt as Ct,Dn as wt,Dt as Tt,Et as A,F as Et,Gn as j,Hn as M,Kn as Dt,Q as N,Rn as Ot,Rt as kt,X as P,Z as F,at as At,ct as jt,et as I,jt as L,lt as R,nt as Mt,ot as Nt,pn as Pt,q as Ft,rt as It,tt as Lt,un as z,ut as Rt,zn as zt,zt as Bt}from"./index-DY7zoioz.js";import{r as Vt}from"./locales-CPjguROj.js";import{a as Ht,i as B,n as Ut,o as V,r as H,t as Wt}from"./table-BhYNJKZu.js";import{t as Gt}from"./FilterBar-BJ1mhU3e.js";import{c as Kt,i as qt,n as Jt,o as Yt,r as Xt,s as Zt,t as Qt}from"./compatView-DgV9jG5C.js";import{t as U}from"./dispatchErrorInfo-CW9VFOfh.js";var $t=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`}]]),en=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`}]]),W=t(e(),1);function tn(e){return e.filter(e=>e.state===`error`)}function nn(e){return e.reachable&&tn(e.targets).length===0}function rn(e){return nn(e)?(e.unreachableInstances??[]).length>0?`gateways_unreachable`:`ok`:`error`}function an(e){return e.state===`error`&&e.lastErrorCode!==null}function on(e){return!!e.lastDownstreamRejectCode}function G(e){return e.kind??`openclaw`}function sn(e){return[...e].sort((e,t)=>e===`openclaw`?-1:t===`openclaw`?1:e.localeCompare(t))}function cn(e,t,n){let r=new Map;for(let e of t)e.instanceName&&r.set(e.instanceName,e.provider);for(let e of n)r.set(e.name,G(e));let i=e=>(e.instanceName?r.get(e.instanceName):void 0)??`openclaw`,a=new Set;for(let e of n)a.add(G(e));for(let e of t)a.add(e.provider);for(let t of e)a.add(i(t));return sn(a).map(r=>({key:r,connections:e.filter(e=>i(e)===r),compatTargets:t.filter(e=>e.provider===r),instances:n.filter(e=>G(e)===r)}))}function K(e){return e===`openclaw`?`OpenClaw`:e===`hermes`?`Hermes`:e.charAt(0).toUpperCase()+e.slice(1)}var q=`__all__`,ln={q:``,state:q,instance:q,version:q},J={connected:0,error:1,idle:2};function un(e){return e.q.trim()!==``||e.state!==`__all__`||e.instance!==`__all__`||e.version!==`__all__`}function dn(e,t){let n=t.q.trim().toLowerCase();return e.filter(e=>!(n&&!`${e.targetLabel} ${e.gatewayHost}`.toLowerCase().includes(n)||t.state!==`__all__`&&e.state!==t.state||t.instance!==`__all__`&&(e.instanceName??``)!==t.instance||t.version!==`__all__`&&(e.gatewayVersion??``)!==t.version))}function Y(e,t){return e.localeCompare(t,void 0,{numeric:!0,sensitivity:`base`})}function X(e,t){return e===`version`?t.gatewayVersion===null:e===`lastOk`?t.lastOkAt===null:!1}function fn(e,t,n){switch(e){case`state`:return(J[t.state]??99)-(J[n.state]??99);case`instance`:return Y(t.instanceLabel??t.instanceName??``,n.instanceLabel??n.instanceName??``);case`host`:return Y(t.gatewayHost,n.gatewayHost);case`version`:{let e=t.gatewayVersion,r=n.gatewayVersion;return Zt(e,r)??Y(e,r)}case`lastOk`:return t.lastOkAt-n.lastOkAt;default:return Y(t.targetLabel,n.targetLabel)}}function pn(e,t){if(!t)return e;let n=t.dir===`asc`?1:-1;return[...e].sort((e,r)=>{let i=X(t.key,e),a=X(t.key,r);return i&&a?0:i?1:a?-1:n*fn(t.key,e,r)})}function mn(e){let t=new Set;for(let n of e)t.add(n.state);return[...t].sort((e,t)=>(J[e]??99)-(J[t]??99))}function hn(e){let t=new Map;for(let n of e)n.instanceName!==null&&(t.has(n.instanceName)||t.set(n.instanceName,n.instanceLabel??n.instanceName));return[...t.entries()].map(([e,t])=>({name:e,label:t})).sort((e,t)=>Y(e.label,t.label))}function gn(e){let t=new Set;for(let n of e)n.gatewayVersion!==null&&t.add(n.gatewayVersion);return[...t].sort((e,t)=>Zt(e,t)??Y(e,t))}var Z=n();function _n({connections:e,displayByInstance:t}){let[n,r]=(0,W.useState)(ln),[i,a]=(0,W.useState)(null),o=(0,W.useMemo)(()=>e.map((e,n)=>({_id:`${e.key}:${e.canonical}/${e.agentId}:${n}`,targetLabel:`${e.canonical}/${e.agentId}`,state:e.state,instanceName:e.instanceName??null,instanceLabel:e.instanceName?t.get(e.instanceName)??e.instanceName:null,gatewayHost:e.gatewayHost,gatewayVersion:e.gatewayVersion??null,okCount:e.okCount,errorCount:e.errorCount+(e.downstreamRejectCount??0),attempts:e.attempts,lastOkAt:e.lastOkAt??null,lastErrorCode:e.lastErrorCode??null,lastErrorAt:e.lastErrorAt??null,lastDownstreamRejectCode:e.lastDownstreamRejectCode??null,lastDownstreamRejectAt:e.lastDownstreamRejectAt??null})),[e,t]),s=(0,W.useMemo)(()=>mn(o),[o]),c=(0,W.useMemo)(()=>hn(o),[o]),l=(0,W.useMemo)(()=>gn(o),[o]),u=(0,W.useMemo)(()=>pn(dn(o,n),i),[o,n,i]);function d(e){a(t=>t?.key===e?t.dir===`asc`?{key:e,dir:`desc`}:null:{key:e,dir:`asc`})}return e.length===0?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:Ae()}):(0,Z.jsxs)(`div`,{className:`oc-conn`,children:[(0,Z.jsxs)(Gt,{q:n.q,onQChange:e=>r(t=>({...t,q:e})),searchPlaceholder:Ge(),onReset:()=>r(ln),canReset:un(n),children:[(0,Z.jsxs)(P,{value:n.state,onValueChange:e=>r(t=>({...t,state:e})),children:[(0,Z.jsx)(O,{size:`sm`,className:`w-36`,children:(0,Z.jsx)(I,{placeholder:Oe()})}),(0,Z.jsxs)(F,{children:[(0,Z.jsx)(N,{value:q,children:C()}),s.map(e=>(0,Z.jsx)(N,{value:e,children:yn(e)},e))]})]}),(0,Z.jsxs)(P,{value:n.instance,onValueChange:e=>r(t=>({...t,instance:e})),children:[(0,Z.jsx)(O,{size:`sm`,className:`w-40`,children:(0,Z.jsx)(I,{placeholder:tt()})}),(0,Z.jsxs)(F,{children:[(0,Z.jsx)(N,{value:q,children:C()}),c.map(e=>(0,Z.jsx)(N,{value:e.name,children:e.label},e.name))]})]}),(0,Z.jsxs)(P,{value:n.version,onValueChange:e=>r(t=>({...t,version:e})),children:[(0,Z.jsx)(O,{size:`sm`,className:`w-36`,children:(0,Z.jsx)(I,{placeholder:Re()})}),(0,Z.jsxs)(F,{children:[(0,Z.jsx)(N,{value:q,children:C()}),l.map(e=>(0,Z.jsx)(N,{value:e,children:e},e))]})]})]}),u.length===0?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:Ee()}):(0,Z.jsxs)(Wt,{className:`oc-conn__table`,children:[(0,Z.jsx)(Ht,{children:(0,Z.jsxs)(V,{children:[(0,Z.jsx)(Q,{label:Ze(),sortKey:`target`,sort:i,onSort:d}),(0,Z.jsx)(Q,{label:Ue(),sortKey:`state`,sort:i,onSort:d}),(0,Z.jsx)(Q,{label:Se(),sortKey:`instance`,sort:i,onSort:d}),(0,Z.jsx)(Q,{label:Me(),sortKey:`host`,sort:i,onSort:d}),(0,Z.jsx)(Q,{label:Ye(),sortKey:`version`,sort:i,onSort:d}),(0,Z.jsx)(B,{children:Ve()}),(0,Z.jsx)(Q,{label:$e(),sortKey:`lastOk`,sort:i,onSort:d})]})}),(0,Z.jsx)(Ut,{children:u.map(e=>(0,Z.jsx)(vn,{r:e},e._id))})]})]})}function Q({label:e,sortKey:t,sort:n,onSort:r}){let i=n?.key===t,a=i?n.dir:null;return(0,Z.jsx)(B,{"aria-sort":i?a===`asc`?`ascending`:`descending`:`none`,children:(0,Z.jsxs)(`button`,{type:`button`,className:`oc-conn__sort`,onClick:()=>r(t),children:[e,i?a===`asc`?(0,Z.jsx)(zt,{size:13,"aria-hidden":!0}):(0,Z.jsx)(M,{size:13,"aria-hidden":!0}):(0,Z.jsx)(mt,{size:13,"aria-hidden":!0,className:`oc-conn__sort-idle`})]})})}function vn({r:e}){let t=an(e)?U(e.lastErrorCode):null,n=on(e)?U(e.lastDownstreamRejectCode):null;return(0,Z.jsxs)(W.Fragment,{children:[(0,Z.jsxs)(V,{className:`oc-conn__row oc-conn__row--${e.state}`,children:[(0,Z.jsx)(H,{children:(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:e.targetLabel})}),(0,Z.jsx)(H,{children:(0,Z.jsx)(bn,{state:e.state})}),(0,Z.jsx)(H,{children:e.instanceLabel?(0,Z.jsx)(`span`,{className:`oc-bridge-target__instance`,children:e.instanceLabel}):(0,Z.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})}),(0,Z.jsx)(H,{children:(0,Z.jsx)(`span`,{className:`oc-bridge-target__host`,children:e.gatewayHost})}),(0,Z.jsx)(H,{children:e.gatewayVersion?(0,Z.jsx)(`span`,{className:`oc-bridge-target__version`,children:e.gatewayVersion}):(0,Z.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})}),(0,Z.jsx)(H,{children:(0,Z.jsx)(`span`,{className:`oc-conn__stats`,children:je({ok:e.okCount,errors:e.errorCount,attempts:e.attempts})})}),(0,Z.jsx)(H,{children:e.lastOkAt?(0,Z.jsx)(`span`,{className:`oc-traces__mono`,children:R(e.lastOkAt)}):(0,Z.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})})]}),t||n?(0,Z.jsx)(V,{className:`oc-conn__detail-row`,children:(0,Z.jsxs)(H,{colSpan:7,className:`oc-conn__detail-cell`,children:[t?(0,Z.jsxs)(`div`,{className:`oc-bridge-target__error`,children:[(0,Z.jsx)(`strong`,{children:t.label}),` `,(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:e.lastErrorCode}),e.lastErrorAt?` · ${R(e.lastErrorAt)}`:``,(0,Z.jsx)(`p`,{className:`oc-bridge-card__hint`,children:t.hint})]}):null,n?(0,Z.jsxs)(`div`,{className:`oc-bridge-target__downstream`,children:[Be({label:n.label}),` `,(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:e.lastDownstreamRejectCode}),e.lastDownstreamRejectAt?` · ${R(e.lastDownstreamRejectAt)}`:``]}):null]})}):null]})}function yn(e){return e===`connected`?S():e===`error`?i():ce()}function bn({state:e}){return e===`connected`?(0,Z.jsx)(A,{variant:`secondary`,children:S()}):e===`error`?(0,Z.jsx)(A,{variant:`destructive`,children:i()}):(0,Z.jsx)(A,{variant:`outline`,children:ce()})}function xn(){return w(T.bridgeHealth.getBridgeHealth,{})}function Sn(){let e=xn(),t=w(T.compat.getBridgeCompat,{}),n=w(T.me.getMe,{host:Ft})?.role===`admin`,r=w(T.admin.listInstances,n?{}:`skip`),i=w(T.agents.usageForInstances,n?{}:`skip`),a=j(),o=()=>void a({to:`/settings/anomalies`,search:{status:`open`}}),s=cn(e?e.targets:[],t?t.targets:[],r??[]),{section:l}=Dt({from:`/settings/bridge`}),u=j({from:`/settings/bridge`}),d=t?.compat??null,f=t===void 0?`loading`:t===null?`nodata`:`ready`,p=d!==null&&Xt(d,`hermes`)&&!s.some(e=>e.key===`hermes`);return(0,Z.jsxs)(`div`,{className:`oc-bridge`,children:[(0,Z.jsx)(Cn,{health:e,compat:t,onSeeAnomalies:o}),(0,Z.jsx)(`p`,{className:`oc-admin__hint oc-bridge__caption`,children:_()}),i&&i.length>0?(0,Z.jsxs)(`section`,{className:`oc-bridge__usage`,children:[(0,Z.jsx)(`h3`,{className:`oc-bridge__usage-title`,children:g()}),(0,Z.jsxs)(Wt,{children:[(0,Z.jsx)(Ht,{children:(0,Z.jsxs)(V,{children:[(0,Z.jsx)(B,{children:c()}),(0,Z.jsx)(B,{children:de()}),(0,Z.jsx)(B,{children:ct()}),(0,Z.jsx)(B,{children:Te()}),(0,Z.jsx)(B,{children:ut()})]})}),(0,Z.jsx)(Ut,{children:i.flatMap(e=>{let t=Et(e.usage,Date.now());return t?t.windows.map((t,n)=>(0,Z.jsxs)(V,{children:[(0,Z.jsx)(H,{className:`font-medium`,children:n===0?e.instanceName:``}),(0,Z.jsx)(H,{children:t.provider}),(0,Z.jsx)(H,{children:t.label}),(0,Z.jsx)(H,{children:(0,Z.jsxs)(A,{variant:t.percentLeft<=10?`destructive`:t.percentLeft<=25?`outline`:`secondary`,children:[t.percentLeft,`%`]})}),(0,Z.jsx)(H,{className:`text-muted-foreground`,children:t.resetText??`—`})]},`${e.instanceName}:${t.provider}:${t.label}`)):[]})})]})]}):null,s.length>0?(0,Z.jsxs)(St,{value:s.some(e=>e.key===l)?l:s[0]?.key??`openclaw`,onValueChange:e=>void u({search:{section:e},replace:!0}),children:[(0,Z.jsx)(xt,{className:`w-full`,children:s.map(e=>(0,Z.jsxs)(yt,{value:e.key,className:`flex-1 gap-1.5`,children:[(0,Z.jsx)(Pt,{size:13,"aria-hidden":!0}),K(e.key)]},e.key))}),s.map(e=>(0,Z.jsx)(bt,{value:e.key,children:(0,Z.jsx)(wn,{providerKey:e.key,connections:e.connections,instances:e.instances,manifest:d,compatStatus:f,compatReachable:t?.reachable??!0,protocol:e.key===`openclaw`?t?.protocol??null:null})},e.key))]}):null,p?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:qe()}):null]})}function Cn({health:e,compat:t,onSeeAnomalies:n}){let r=t!=null&&t.buildVersion!=null&&t.bridgeVersion!=null&&t.buildVersion!==t.bridgeVersion,i=t?.buildRevision&&t.buildRevision!==`unknown`?t.buildRevision.slice(0,7):null,a=t&&t!==null?(0,Z.jsxs)(`span`,{className:`oc-bridge-card__ver`,children:[(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:Yt(t.bridgeVersion)}),i?(0,Z.jsxs)(Z.Fragment,{children:[` `,(0,Z.jsxs)(`code`,{className:`oc-traces__mono`,title:De(),children:[`(`,i,`)`]})]}):null,r?(0,Z.jsxs)(`strong`,{className:`oc-bridge-card__mismatch`,children:[` `,Qe({build:t.buildVersion??`?`})]}):null,` · `,We(),` `,(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:t.protocolVersion===null?Ce():String(t.protocolVersion)})]}):null;if(e===void 0)return(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:d()});if(e===null)return(0,Z.jsx)(`div`,{className:`oc-bridge-card oc-bridge-card--idle`,children:p()});let o=tn(e.targets),c=!e.reachable,l=rn(e),u=e.unreachableInstances??[],f=l===`ok`?`ok`:l===`gateways_unreachable`?`warn`:`error`,m=jt(e.checkedAt),h=e.startedAt==null?null:jt(e.startedAt);return(0,Z.jsxs)(`div`,{className:`oc-bridge-card oc-bridge-card--${f}`,children:[(0,Z.jsx)(`div`,{className:`oc-bridge-card__icon`,"aria-hidden":!0,children:l===`ok`?(0,Z.jsx)(Ot,{size:22}):c||l===`gateways_unreachable`?(0,Z.jsx)(en,{size:22}):(0,Z.jsx)(z,{size:22})}),(0,Z.jsxs)(`div`,{className:`oc-bridge-card__body`,children:[(0,Z.jsx)(`div`,{className:`oc-bridge-card__title`,children:l===`ok`?pe():l===`gateways_unreachable`?st({count:u.length}):c?at():s({count:o.length})}),(0,Z.jsxs)(`div`,{className:`oc-bridge-card__meta`,children:[(0,Z.jsxs)(`span`,{children:[(0,Z.jsx)($t,{size:12,"aria-hidden":!0}),` `,ue({time:m})]}),h?(0,Z.jsx)(`span`,{children:lt({time:h})}):null,a]}),l===`gateways_unreachable`?(0,Z.jsx)(`p`,{className:`oc-bridge-card__hint`,children:we({names:u.join(`, `)})}):null,c?(0,Z.jsx)(`p`,{className:`oc-bridge-card__hint`,children:U(e.lastError===`not_configured`?`NOT_CONFIGURED`:`BRIDGE_UNREACHABLE`).hint}):null]}),(0,Z.jsx)(`button`,{type:`button`,className:`oc-bridgebar__drill`,onClick:n,children:rt()})]})}function wn({providerKey:e,connections:t,instances:n,manifest:r,compatStatus:i,compatReachable:a,protocol:o}){let s=r?Kt(r,e):null,c=new Map;for(let e of n)c.set(e.name,e.displayName??e.name);let l=[],u=new Set;for(let n of t){if(!n.instanceName||u.has(n.instanceName))continue;u.add(n.instanceName);let t=n.gatewayVersion??null;l.push({instanceName:n.instanceName,displayName:c.get(n.instanceName)??n.instanceName,version:t,state:Jt(t,e,r)})}let d=Qt(l.map(e=>e.state)),[f,p]=(0,W.useState)(!1);return(0,Z.jsxs)(`section`,{className:`oc-bridge-provider`,children:[(0,Z.jsxs)(`header`,{className:`oc-bridge-provider__head`,children:[(0,Z.jsx)(Pt,{size:15,"aria-hidden":!0,className:`oc-bridge-provider__icon`}),(0,Z.jsx)(`span`,{className:`oc-bridge-provider__name`,children:K(e)}),d?(0,Z.jsx)(A,{variant:d===`beyond`||d===`defective`?`destructive`:`secondary`,children:qt(d)}):null]}),(0,Z.jsx)(`h4`,{className:`oc-bridge-provider__sub`,children:nt()}),(0,Z.jsx)(En,{providerName:K(e),support:s,compatStatus:i,compatReachable:a,manifest:r,instanceRows:l}),o?(0,Z.jsx)(Tn,{protocol:o}):null,(0,Z.jsxs)(`button`,{type:`button`,className:`oc-bridge-provider__sub oc-bridge-provider__sub--toggle`,"aria-expanded":f,onClick:()=>p(e=>!e),children:[f?(0,Z.jsx)(M,{size:13,"aria-hidden":!0}):(0,Z.jsx)(k,{size:13,"aria-hidden":!0}),be({count:t.length})]}),f?(0,Z.jsx)(_n,{connections:t,displayByInstance:c}):null]})}function Tn({protocol:e}){let[t,n]=(0,W.useState)(!1),r=e.coverage,i=e.drift??[],o=(e.driftOverflow??0)+(e.driftTruncated??0);return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`h4`,{className:`oc-bridge-provider__sub`,children:[oe(),i.length>0?(0,Z.jsx)(A,{variant:`destructive`,children:v({count:i.length})}):o>0?(0,Z.jsx)(A,{variant:`destructive`,children:Pe()}):(0,Z.jsx)(A,{variant:`secondary`,children:b()})]}),(0,Z.jsxs)(`p`,{className:`oc-admin__hint`,children:[a({version:e.vendoredVersion}),r?` · `+Ie({handled:r.handled,ignored:r.ignored,gaps:r.gaps}):null]}),o>0?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:pt({overflow:e.driftOverflow??0,truncated:e.driftTruncated??0})}):null,i.length>0?(0,Z.jsx)(`ul`,{className:`oc-bridge-protocol__list`,role:`list`,children:i.map(e=>(0,Z.jsxs)(`li`,{children:[(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:e.shape}),` × `,e.count]},e.shape))}):null,r&&r.gapList.length>0?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`button`,{type:`button`,className:`oc-bridge-provider__sub oc-bridge-provider__sub--toggle`,"aria-expanded":t,onClick:()=>n(e=>!e),children:[t?(0,Z.jsx)(M,{size:13,"aria-hidden":!0}):(0,Z.jsx)(k,{size:13,"aria-hidden":!0}),x({count:r.gapList.length})]}),t?(0,Z.jsx)(`ul`,{className:`oc-bridge-protocol__list`,role:`list`,children:r.gapList.map(e=>(0,Z.jsx)(`li`,{children:(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:e})},e))}):null]}):null]})}function En({support:e,compatStatus:t,compatReachable:n,manifest:r,instanceRows:i,providerName:a}){return t===`loading`?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:d()}):t===`nodata`?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:ze()}):(0,Z.jsxs)(`div`,{className:`oc-compat`,children:[n?null:(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:Ne()}),r===null?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:Xe()}):(0,Z.jsxs)(`div`,{className:`oc-compat__support`,children:[(0,Z.jsx)(`span`,{className:`oc-compat__label`,children:m({provider:a})}),e&&e.range!==null?(0,Z.jsx)(`span`,{children:He({min:e.range.min,max:e.range.maxValidated})}):(0,Z.jsx)(`span`,{children:Ce()}),e?(0,Z.jsx)(kn,{versions:e.validatedVersions}):null]}),i.length===0?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:se()}):(0,Z.jsx)(`div`,{className:`oc-compat__targets`,children:i.map(e=>(0,Z.jsxs)(`div`,{className:`oc-compat__target`,children:[(0,Z.jsx)(`span`,{className:`oc-compat__instance`,children:e.displayName}),(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:Yt(e.version)}),(0,Z.jsx)(A,{variant:e.state===`supported`?`secondary`:e.state===`beyond`||e.state===`defective`?`destructive`:`outline`,children:qt(e.state)})]},e.instanceName))})]})}function Dn({instance:e,onClose:t}){return(0,Z.jsx)(Lt,{open:!0,onOpenChange:e=>!e&&t(),children:(0,Z.jsxs)(Mt,{className:`oc-bridge-config-dialog`,onOpenAutoFocus:e=>e.preventDefault(),children:[(0,Z.jsxs)(At,{children:[(0,Z.jsx)(Nt,{children:y({instance:e.displayName??e.name})}),(0,Z.jsx)(It,{children:Fe()})]}),(0,Z.jsx)(On,{instance:e,onClose:t})]})})}function $({label:e,result:t}){return t?t.checked?(0,Z.jsxs)(`p`,{className:`oc-bridge-config__check-row `+(t.ok?`oc-bridge-config__check-row--ok`:`oc-bridge-config__check-row--err`),children:[t.ok?(0,Z.jsx)(Ot,{"aria-hidden":!0}):(0,Z.jsx)(z,{"aria-hidden":!0}),(0,Z.jsxs)(`span`,{children:[e,` — `,t.ok?o():t.detail]})]}):(0,Z.jsxs)(`p`,{className:`oc-bridge-config__check-row oc-bridge-config__check-row--skip`,children:[e,` — `,ft()]}):null}function On({instance:e,onClose:t}){let n=xe(T.admin.upsertInstanceConfig),r=Je(T.bridge.validateMediaPaths),i=Tt(),a=Vt(e.config?.contentLocale,void 0),[o,s]=(0,W.useState)(()=>ht(e.config??{},a)),[c,u]=(0,W.useState)(!1),[d,p]=(0,W.useState)(!1),[m,g]=(0,W.useState)(null),_=o.inboundMediaMode===`shared-fs`,v=o.mediaMode===`shared-fs`,y=_||v;async function b(){p(!0),g(null);try{g(await r({instanceName:e.name,inboundMediaMode:o.inboundMediaMode,mediaMode:o.mediaMode}))}catch(e){i.error(_e(),e)}finally{p(!1)}}async function x(){u(!0);try{let r=e.config??{};await n({instanceId:e._id,config:_t(o,r,a)}),t()}catch(e){i.error(ot(),e)}finally{u(!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)(E,{label:Le(),help:l()}),(0,Z.jsxs)(P,{value:o.mediaMode,onValueChange:e=>s({...o,mediaMode:e}),children:[(0,Z.jsx)(O,{size:`sm`,className:`w-full`,children:(0,Z.jsx)(I,{})}),(0,Z.jsx)(F,{children:vt.map(e=>(0,Z.jsx)(N,{value:e,children:e},e))})]})]}),(0,Z.jsxs)(`label`,{className:`oc-field`,children:[(0,Z.jsx)(E,{label:ae(),help:fe()}),(0,Z.jsxs)(P,{value:o.inboundMediaMode,onValueChange:e=>s({...o,inboundMediaMode:e}),children:[(0,Z.jsx)(O,{size:`sm`,className:`w-full`,children:(0,Z.jsx)(I,{})}),(0,Z.jsx)(F,{children:gt.map(e=>(0,Z.jsx)(N,{value:e,children:e},e))})]})]}),(0,Z.jsxs)(`label`,{className:`oc-field`,children:[(0,Z.jsx)(E,{label:f(),help:dt()}),(0,Z.jsx)(L,{type:`number`,min:1,max:4096,className:`w-full`,value:o.mediaMaxMb,onChange:e=>s({...o,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)(E,{label:ve(),help:ye()}),(0,Z.jsx)(L,{className:`w-full`,spellCheck:!1,value:o.inboundAgentMount,onChange:e=>s({...o,inboundAgentMount:e.target.value})})]}),v&&(0,Z.jsxs)(`label`,{className:`oc-field`,children:[(0,Z.jsx)(E,{label:ne(),help:Ke()}),(0,Z.jsx)(L,{className:`w-full`,spellCheck:!1,value:o.outboundAgentMount,onChange:e=>s({...o,outboundAgentMount:e.target.value})})]})]}),(0,Z.jsxs)(`label`,{className:`oc-field--row`,children:[(0,Z.jsx)(Rt,{checked:o.rehydration,onCheckedChange:e=>s({...o,rehydration:e===!0})}),(0,Z.jsx)(E,{label:h(),help:it()})]}),y&&m!==null&&(0,Z.jsx)(`div`,{className:`oc-bridge-config__check`,children:m.reachable?!m.inbound&&!m.outbound?(0,Z.jsxs)(`p`,{className:`oc-bridge-config__check-row oc-bridge-config__check-row--err`,children:[(0,Z.jsx)(z,{"aria-hidden":!0}),ie({reason:m.reason??`?`})]}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)($,{label:te(),result:m.inbound}),(0,Z.jsx)($,{label:ge(),result:m.outbound}),(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:he()})]}):(0,Z.jsxs)(`p`,{className:`oc-bridge-config__check-row oc-bridge-config__check-row--err`,children:[(0,Z.jsx)(z,{"aria-hidden":!0}),le()]})}),(0,Z.jsxs)(`div`,{className:`oc-bridge-config__actions`,children:[y&&(0,Z.jsxs)(D,{variant:`outline`,size:`sm`,onClick:()=>void b(),disabled:d,children:[d?(0,Z.jsx)(wt,{className:`size-4 animate-spin`,"aria-hidden":!0}):null,d?ee():re()]}),(0,Z.jsx)(D,{size:`sm`,onClick:()=>void x(),disabled:c,children:me()})]})]})})}function kn({versions:e}){if(e.length===0)return null;let t=[...e].reverse();return(0,Z.jsxs)(kt,{children:[(0,Z.jsx)(Ct,{asChild:!0,children:(0,Z.jsxs)(`button`,{type:`button`,className:`oc-compat__versions-btn`,children:[e.length===1?et():ke({count:e.length}),(0,Z.jsx)(M,{size:13,"aria-hidden":!0})]})}),(0,Z.jsxs)(Bt,{className:`oc-compat__versions-pop`,align:`start`,children:[(0,Z.jsx)(`p`,{className:`oc-compat__versions-title`,children:r()}),(0,Z.jsx)(`div`,{className:`oc-compat__versions-list`,children:t.map(e=>(0,Z.jsx)(A,{variant:`secondary`,children:e},e))})]})]})}export{Sn as BridgeTab,Dn as InstanceConfigDialog};
@@ -0,0 +1 @@
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Af as r,Ax as i,Bs as a,Fs as o,Hs as s,If as c,Is as l,Ls as u,Ns as d,Pf as f,Ps as p,Rs as m,Ti as h,Vs as g,Yd as _,Zz as v,_d as y,aB as b,dd as x,fd as S,gd as C,hd as w,kf as T,md as E,oB as D,pd as O,rB as k,t as A,vd as j,yd as M,zs as N}from"./api-CCk5U5gB.js";import{t as P}from"./button-CbUSFbZL.js";import{$ as F,B as I,M as L,N as R,Q as z,X as B,Z as V,et as H,jt as U,un as W,ut as G}from"./index-DY7zoioz.js";import{a as K}from"./compatView-DgV9jG5C.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=b(A.admin.upsertInstanceConfig),n=D(A.agents.listAgentsForInstance,{instanceName:e.name}),r=typeof e.config?.converterAgentId==`string`?e.config.converterAgentId:``,[i,a]=(0,q.useState)(r),[o,s]=(0,q.useState)(`idle`);(0,q.useEffect)(()=>{a(r),s(`idle`)},[e._id,r]);let l=`__none__`,d=i!==r;async function f(){s(`saving`);try{let n={...e.config??{}};i===``||i===l?delete n.converterAgentId:n.converterAgentId=i,await t({instanceId:e._id,config:n}),s(`done`)}catch{s(`error`)}}let p=n?.agents??[];return(0,X.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,X.jsx)(`span`,{className:`oc-cdefaults__label`,children:N()}),(0,X.jsx)(`p`,{className:`oc-admin__hint`,children:m()}),(0,X.jsxs)(`div`,{className:`oc-cdefaults__inline`,children:[(0,X.jsxs)(B,{value:i===``?l:i,onValueChange:e=>a(e===l?``:e),children:[(0,X.jsx)(F,{className:`oc-cdefaults__select`,"aria-label":N(),children:(0,X.jsx)(H,{placeholder:u()})}),(0,X.jsxs)(V,{children:[(0,X.jsx)(z,{value:l,children:u()}),p.map(e=>(0,X.jsx)(z,{value:e.agentId,children:e.displayName?`${e.displayName} (${e.agentId})`:e.agentId},e.agentId))]})]}),(0,X.jsx)(P,{size:`sm`,disabled:!d||o===`saving`,onClick:()=>void f(),children:o===`saving`?c():O()})]}),o===`done`?(0,X.jsx)(`p`,{className:`oc-admin__hint`,role:`status`,children:S()}):null,o===`error`?(0,X.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:x()}):null]})}function Q({instance:e}){let t=b(A.admin.upsertInstanceConfig),n=e.config?.curationEnabled===!0,r=typeof e.config?.curationBudgetChars==`number`?e.config.curationBudgetChars:null,[i,s]=(0,q.useState)(n),[u,d]=(0,q.useState)(r===null?``:String(r)),[f,m]=(0,q.useState)(`idle`);(0,q.useEffect)(()=>{s(n),d(r===null?``:String(r)),m(`idle`)},[e._id,n,r]);let h=u.trim(),g=h===``?null:/^\d+$/.test(h)?Number.parseInt(h,10):NaN,_=!i||g===null||Number.isInteger(g)&&g>=4e3&&g<=6e4,v=i!==n||(g??null)!==r;async function y(){m(`saving`);try{let n={...e.config??{}};n.curationEnabled=i,!i||g===null||Number.isNaN(g)?delete n.curationBudgetChars:n.curationBudgetChars=g,await t({instanceId:e._id,config:n}),m(`done`)}catch{m(`error`)}}return(0,X.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,X.jsxs)(`label`,{className:`oc-cdefaults__inline`,style:{cursor:`pointer`},children:[(0,X.jsx)(G,{checked:i,onCheckedChange:e=>s(e===!0),"aria-label":a()}),(0,X.jsx)(`span`,{className:`oc-cdefaults__label`,children:a()})]}),(0,X.jsxs)(`div`,{className:`oc-cdefaults__inline`,children:[(0,X.jsx)(U,{type:`number`,min:4e3,max:6e4,step:1e3,placeholder:`20000`,value:u,onChange:e=>d(e.target.value),className:`oc-cdefaults__number`,"aria-invalid":!_,"aria-label":l(),disabled:!i}),(0,X.jsx)(P,{size:`sm`,disabled:!v||!_||f===`saving`,onClick:()=>void y(),children:f===`saving`?c():O()})]}),_?null:(0,X.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:o()}),f===`done`?(0,X.jsx)(`p`,{className:`oc-admin__hint`,role:`status`,children:S()}):null,f===`error`?(0,X.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:x()}):null,(0,X.jsx)(`p`,{className:`oc-cdefaults__help`,children:p()})]})}function $({instance:e}){let t=b(A.admin.upsertInstanceConfig),n=typeof e.config?.summarizeThresholdChars==`number`?e.config.summarizeThresholdChars:null,[r,i]=(0,q.useState)(n===null?``:String(n)),[a,o]=(0,q.useState)(`idle`);(0,q.useEffect)(()=>{i(n===null?``:String(n)),o(`idle`)},[e._id,n]);let l=r.trim(),u=l===``?null:/^\d+$/.test(l)?Number.parseInt(l,10):NaN,f=u===null||Number.isInteger(u)&&u>=1e3&&u<=2e5,p=(u??null)!==n;async function m(){o(`saving`);try{let n={...e.config??{}};u===null?delete n.summarizeThresholdChars:n.summarizeThresholdChars=u,await t({instanceId:e._id,config:n}),o(`done`)}catch{o(`error`)}}return(0,X.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,X.jsx)(`span`,{className:`oc-cdefaults__label`,children:s()}),(0,X.jsxs)(`div`,{className:`oc-cdefaults__inline`,children:[(0,X.jsx)(U,{type:`number`,min:1e3,max:2e5,step:1e3,placeholder:`8000`,value:r,onChange:e=>i(e.target.value),className:`oc-cdefaults__number`,"aria-invalid":!f}),(0,X.jsx)(P,{size:`sm`,disabled:!p||!f||a===`saving`,onClick:()=>void m(),children:a===`saving`?c():O()})]}),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:S()}):null,a===`error`?(0,X.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:x()}):null,(0,X.jsx)(`p`,{className:`oc-cdefaults__help`,children:g()})]})}function ee(){let e=k(A.agentFiles.getChatDefaults),[t,n]=(0,q.useState)({status:`loading`}),a=D(A.admin.listInstances,{}),[o,s]=(0,q.useState)(null);(0,q.useEffect)(()=>{!a||a.length===0||(!o||!a.some(e=>e.name===o))&&s(a[0].name)},[a,o]);let c=(a?.length??0)>1,l=a!==void 0&&a.length===0,u=D(A.compat.forInstance,o?{instanceName:o}:`skip`),d=o?I(u,`configDefaults`):`loading`,p=d===`loading`?null:d.blocked,m=(0,q.useMemo)(()=>c&&o?{instanceName:o}:{},[c,o]),g=(0,q.useRef)(0),b=(0,q.useCallback)(async()=>{let t=++g.current;n({status:`loading`});try{let r=Y(await e(m));if(g.current!==t)return;n({status:`done`,current:r})}catch{if(g.current!==t)return;n({status:`error`})}},[e,m]);(0,q.useEffect)(()=>{p===!1&&(c&&!o||b())},[b,p,c,o]);let x=t.status===`done`?t.current:null,S=(0,q.useMemo)(()=>J.map(e=>({id:e,label:R(e)})),[]),O=(0,q.useMemo)(()=>[{id:`fast`,label:r()},{id:`standard`,label:T()}],[]);return(0,X.jsxs)(`div`,{className:`oc-cdefaults`,children:[(0,X.jsx)(`p`,{className:`oc-admin__hint`,children:M()}),c&&o?(0,X.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,X.jsx)(`span`,{className:`oc-cdefaults__label`,children:_()}),(0,X.jsxs)(B,{value:o,onValueChange:e=>s(e),children:[(0,X.jsx)(F,{size:`sm`,"aria-label":_(),children:(0,X.jsx)(H,{})}),(0,X.jsx)(V,{children:(a??[]).map(e=>(0,X.jsx)(z,{value:e.name,children:e.name},e.name))})]})]}):null,l?(0,X.jsx)(`p`,{className:`oc-admin__hint`,role:`status`,children:i()}):d===`loading`?(0,X.jsx)(`p`,{className:`oc-admin__hint`,children:v()}):d.blocked?(0,X.jsxs)(`p`,{className:`oc-compat__blocked`,role:`status`,children:[(0,X.jsx)(W,{size:14,"aria-hidden":!0}),` `,K(d.gatewayVersion,d.provider)]}):t.status===`loading`?(0,X.jsx)(`p`,{className:`oc-admin__hint`,children:v()}):t.status===`error`?(0,X.jsxs)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:[E(),` `,(0,X.jsx)(P,{variant:`outline`,size:`sm`,onClick:()=>void b(),children:f()})]}):(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,X.jsx)(`span`,{className:`oc-cdefaults__label`,children:j()}),(0,X.jsx)(L,{field:`thinkingLevel`,options:S,value:x?.thinkingDefault??null,onChange:()=>{},disabled:!0,ariaLabel:j()}),(0,X.jsx)(`p`,{className:`oc-cdefaults__help`,children:y()})]}),(0,X.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,X.jsx)(`span`,{className:`oc-cdefaults__label`,children:C()}),(0,X.jsx)(L,{field:`fastMode`,options:O,value:x===null||x.fastModeDefault===null?null:x.fastModeDefault?`fast`:`standard`,onChange:()=>{},disabled:!0,ariaLabel:C()}),(0,X.jsx)(`p`,{className:`oc-cdefaults__help`,children:w()})]}),(0,X.jsx)(`p`,{className:`oc-cdefaults__note`,children:h()})]}),(()=>{let e=a?.find(e=>e.name===(o??a[0]?.name));return e?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)($,{instance:e}),(0,X.jsx)(Q,{instance:e}),(0,X.jsx)(Z,{instance:e})]}):null})()]})}export{ee as ChatDefaultsTab};
@@ -1 +1 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Gh as r,Hh as i,Jh as a,Kh as o,Uh as s,Wh as c,qh as l}from"./api-CyG2Kb2E.js";import{t as u}from"./chevrons-up-down-ChvoKzuN.js";import{t as d}from"./button-SxU4iS5M.js";import{Hn as f,It as p,Lt as m,Mt as h,Nt as g,Pn as _,Pt as v,dn as y,gn as b,ut as x,zn as S}from"./index-DWkl2h55.js";import{a as C,i as w,n as T,o as E,r as D,t as O}from"./table-jvClq47d.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=l(),isExpanded:L,renderExpanded:R}){let[z,B]=(0,k.useState)(new Set),[V,H]=(0,k.useState)(null),U=t??[],W=V?n[V.index]:void 0,G=V&&W?.sort?j(U,W.sort,V.dir):U;function K(e){H(t=>!t||t.index!==e?{index:e,dir:`asc`}:t.dir===`asc`?{index:e,dir:`desc`}:null)}let q=+!!F+n.length+ +!!A,J=U.length>0&&z.size===U.length,Y=z.size>0&&!J;function X(){B(J?new Set:new Set(U.map(e=>e._id)))}function Z(e){B(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})}return(0,M.jsxs)(`div`,{className:`oc-dt`,children:[(0,M.jsxs)(`div`,{className:`oc-dt__bar`,children:[(0,M.jsx)(`h2`,{className:`oc-dt__title`,children:e}),(0,M.jsxs)(`div`,{className:`oc-dt__bar-actions`,children:[z.size>0&&F?F.map(e=>(0,M.jsxs)(d,{size:`sm`,variant:e.variant===`destructive`?`destructive`:`outline`,onClick:()=>{e.onSelect([...z]),B(new Set)},children:[e.variant===`destructive`?(0,M.jsx)(y,{}):null,e.label,` (`,z.size,`)`]},e.label)):null,N?(0,M.jsxs)(d,{size:`sm`,onClick:N,children:[(0,M.jsx)(b,{}),` `,P]}):null]})]}),t===void 0?(0,M.jsx)(`p`,{className:`oc-admin__hint`,children: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)(x,{"aria-label":r(),checked:J?!0:Y?`indeterminate`:!1,onCheckedChange:X})}):null,n.map((e,t)=>{let n=V?.index===t;return e.sort?(0,M.jsx)(w,{className:e.className,"aria-sort":n?V.dir===`asc`?`ascending`:`descending`:`none`,children:(0,M.jsxs)(`button`,{type:`button`,className:`oc-dt__sort`,onClick:()=>K(t),"aria-label":i({column:e.header}),children:[e.header,n?V.dir===`asc`?(0,M.jsx)(S,{className:`oc-dt__sort-icon`,"aria-hidden":!0}):(0,M.jsx)(f,{className:`oc-dt__sort-icon`,"aria-hidden":!0}):(0,M.jsx)(u,{className:`oc-dt__sort-icon oc-dt__sort-icon--idle`,"aria-hidden":!0})]})},e.header):(0,M.jsx)(w,{className:e.className,children:e.header},e.header)}),A?(0,M.jsx)(w,{className:`w-8`}):null]})}),(0,M.jsx)(T,{children:G.map(e=>{let t=A?.(e)??[],r=L?.(e)??!1;return(0,M.jsxs)(k.Fragment,{children:[(0,M.jsxs)(E,{className:`group/row`,children:[F?(0,M.jsx)(D,{children:(0,M.jsx)(x,{"aria-label":c(),checked:z.has(e._id),onCheckedChange:()=>Z(e._id)})}):null,n.map(t=>(0,M.jsx)(D,{className:t.className,children:t.cell(e)},t.header)),A?(0,M.jsx)(D,{children:t.length>0?(0,M.jsxs)(h,{children:[(0,M.jsx)(m,{asChild:!0,children:(0,M.jsx)(d,{variant:`ghost`,size:`icon-sm`,"aria-label":s(),className:`opacity-0 transition-opacity group-hover/row:opacity-100 group-focus-within/row:opacity-100 aria-expanded:opacity-100`,children:(0,M.jsx)(_,{})})}),(0,M.jsx)(g,{align:`end`,children:t.map((t,n)=>(0,M.jsxs)(`div`,{children:[t.variant===`destructive`&&n>0?(0,M.jsx)(p,{}):null,(0,M.jsx)(v,{variant:t.variant,onSelect:()=>t.onSelect(e),children:t.label})]},t.label))})]}):null}):null]}),r&&R?(0,M.jsx)(E,{className:`oc-dt__expansion`,children:(0,M.jsx)(D,{colSpan:q,className:`oc-dt__expansion-cell`,children:R(e)})}):null]},e._id)})})]})]})}export{N as t};
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Gh as r,Jh as i,Kh as a,Uh as o,Wh as s,Yh as c,qh as l}from"./api-CCk5U5gB.js";import{t as u}from"./chevrons-up-down-DAdQ-ohu.js";import{t as d}from"./button-CbUSFbZL.js";import{Hn as f,It as p,Lt as m,Mt as h,Nt as g,Pn as _,Pt as v,dn as y,gn as b,ut as x,zn as S}from"./index-DY7zoioz.js";import{a as C,i as w,n as T,o as E,r as D,t as O}from"./table-BhYNJKZu.js";var k=t(e(),1);function A(e,t){return typeof e==`number`&&typeof t==`number`?e-t:typeof e==`boolean`&&typeof t==`boolean`?!!e-+!!t:String(e).localeCompare(String(t),void 0,{numeric:!0,sensitivity:`base`})}function j(e,t,n){return[...e].sort((e,r)=>{let i=t(e),a=t(r),o=i==null,s=a==null;if(o||s)return o&&s?0:o?1:-1;let c=A(i,a);return n===`asc`?c:-c})}var M=n();function N({title:e,rows:t,columns:n,rowActions:A,onAdd:N,addLabel:P=c(),bulkActions:F,emptyHint:I=i(),isExpanded:L,renderExpanded:R}){let[z,B]=(0,k.useState)(new Set),[V,H]=(0,k.useState)(null),U=t??[],W=V?n[V.index]:void 0,G=V&&W?.sort?j(U,W.sort,V.dir):U;function K(e){H(t=>!t||t.index!==e?{index:e,dir:`asc`}:t.dir===`asc`?{index:e,dir:`desc`}:null)}let q=+!!F+n.length+ +!!A,J=U.length>0&&z.size===U.length,Y=z.size>0&&!J;function X(){B(J?new Set:new Set(U.map(e=>e._id)))}function Z(e){B(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})}return(0,M.jsxs)(`div`,{className:`oc-dt`,children:[(0,M.jsxs)(`div`,{className:`oc-dt__bar`,children:[(0,M.jsx)(`h2`,{className:`oc-dt__title`,children:e}),(0,M.jsxs)(`div`,{className:`oc-dt__bar-actions`,children:[z.size>0&&F?F.map(e=>(0,M.jsxs)(d,{size:`sm`,variant:e.variant===`destructive`?`destructive`:`outline`,onClick:()=>{e.onSelect([...z]),B(new Set)},children:[e.variant===`destructive`?(0,M.jsx)(y,{}):null,e.label,` (`,z.size,`)`]},e.label)):null,N?(0,M.jsxs)(d,{size:`sm`,onClick:N,children:[(0,M.jsx)(b,{}),` `,P]}):null]})]}),t===void 0?(0,M.jsx)(`p`,{className:`oc-admin__hint`,children:l()}):U.length===0?(0,M.jsx)(`p`,{className:`oc-admin__hint`,children:I}):(0,M.jsxs)(O,{children:[(0,M.jsx)(C,{children:(0,M.jsxs)(E,{children:[F?(0,M.jsx)(w,{className:`w-8`,children:(0,M.jsx)(x,{"aria-label":a(),checked:J?!0:Y?`indeterminate`:!1,onCheckedChange:X})}):null,n.map((e,t)=>{let n=V?.index===t;return e.sort?(0,M.jsx)(w,{className:e.className,"aria-sort":n?V.dir===`asc`?`ascending`:`descending`:`none`,children:(0,M.jsxs)(`button`,{type:`button`,className:`oc-dt__sort`,onClick:()=>K(t),"aria-label":o({column:e.header}),children:[e.header,n?V.dir===`asc`?(0,M.jsx)(S,{className:`oc-dt__sort-icon`,"aria-hidden":!0}):(0,M.jsx)(f,{className:`oc-dt__sort-icon`,"aria-hidden":!0}):(0,M.jsx)(u,{className:`oc-dt__sort-icon oc-dt__sort-icon--idle`,"aria-hidden":!0})]})},e.header):(0,M.jsx)(w,{className:e.className,children:e.header},e.header)}),A?(0,M.jsx)(w,{className:`w-8`}):null]})}),(0,M.jsx)(T,{children:G.map(e=>{let t=A?.(e)??[],i=L?.(e)??!1;return(0,M.jsxs)(k.Fragment,{children:[(0,M.jsxs)(E,{className:`group/row`,children:[F?(0,M.jsx)(D,{children:(0,M.jsx)(x,{"aria-label":r(),checked:z.has(e._id),onCheckedChange:()=>Z(e._id)})}):null,n.map(t=>(0,M.jsx)(D,{className:t.className,children:t.cell(e)},t.header)),A?(0,M.jsx)(D,{children:t.length>0?(0,M.jsxs)(h,{children:[(0,M.jsx)(m,{asChild:!0,children:(0,M.jsx)(d,{variant:`ghost`,size:`icon-sm`,"aria-label":s(),className:`opacity-0 transition-opacity group-hover/row:opacity-100 group-focus-within/row:opacity-100 aria-expanded:opacity-100`,children:(0,M.jsx)(_,{})})}),(0,M.jsx)(g,{align:`end`,children:t.map((t,n)=>(0,M.jsxs)(`div`,{children:[t.variant===`destructive`&&n>0?(0,M.jsx)(p,{}):null,(0,M.jsx)(v,{variant:t.variant,onSelect:()=>t.onSelect(e),children:t.label})]},t.label))})]}):null}):null]}),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{Et as t}from"./index-DWkl2h55.js";var n=e();function r({icon:e,total:r,items:i}){if(r===0)return(0,n.jsxs)(t,{variant:`outline`,className:`oc-group-chip oc-group-chip--empty gap-1`,children:[e,`0`]});let a=r-i.length;return(0,n.jsxs)(`div`,{className:`oc-group-detail`,children:[i.map((e,r)=>(0,n.jsxs)(t,{variant:e.highlight?`secondary`:`outline`,className:`oc-group-chip gap-1`,title:e.label,children:[e.marker,(0,n.jsx)(`span`,{className:`oc-group-chip__txt`,children:e.label})]},r)),a>0?(0,n.jsxs)(t,{variant:`outline`,className:`oc-group-chip`,children:[`+`,a]}):null]})}export{r as t};
1
+ import{r as e}from"./bundle-mjs-C73ZY4La.js";import{Et as t}from"./index-DY7zoioz.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{$D as r,AO as i,BO as a,CO as o,DO as s,EO as c,FO as l,GO as u,HO as d,IO as ee,JD as f,JO as p,Jo as m,KO as h,Ko as g,LO as _,MO as v,NO as te,OO as ne,PO as re,QD as y,RO as ie,SO as ae,TO as b,UO as x,VO as S,WO as C,XD as w,XO as T,YD as E,YO as D,ZD as O,_O as k,aB as A,aO as j,bO as M,cO as N,dO as P,eO as F,fO as I,gO as L,hO as R,iO as z,jO as B,kO as V,lO as H,mO as U,nO as oe,oB as W,oO as G,pO as K,qO as q,rO as se,sO as ce,t as J,tO as le,uO as ue,vO as de,wO as fe,xO as pe,yO as me,zO as he}from"./api-CCk5U5gB.js";import{t as ge}from"./button-CbUSFbZL.js";import{U as _e,ct as Y}from"./index-DY7zoioz.js";import{t as ve}from"./DataTableShell-BWoSBli_.js";var X=t(e(),1),Z=n(),ye={altered_words:()=>T(),incorrect:()=>D(),incoherence:()=>p(),formatting:()=>q(),latency:()=>h(),api_error:()=>u(),other:()=>C()},Q=e=>ye[e]?.()??e;function $({matches:e,sourceWasOpen:t}){return t?e===!0?(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-ok`,children:d()}):e===!1?(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-warn`,children:S()}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill`,children:`—`}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill`,children:x()})}function be({data:e,reference:t,closeReason:n}){let r=e.snapshot,u=A(J.feedback.respondToFeedback),[d,f]=(0,X.useState)(e.thread),[p,h]=(0,X.useState)(``),[g,y]=(0,X.useState)(!1);async function x(){let t=p.trim();if(!(!t||g)){y(!0);try{await u({feedbackId:e._id,text:t}),f(e=>[...e,{authorRole:`admin`,text:t,at:Date.now()}]),h(``)}finally{y(!1)}}}let S=[];try{S=r.contextJson?JSON.parse(r.contextJson):[]}catch{S=[]}return(0,Z.jsxs)(`div`,{className:`oc-fbadmin__detail`,children:[(0,Z.jsxs)(`div`,{className:`oc-fbadmin__row`,children:[(0,Z.jsx)($,{matches:r.displayedMatchesStored,sourceWasOpen:r.clientInfo?.sourceWasOpen??!1}),(0,Z.jsxs)(`span`,{className:`oc-fbadmin__meta`,children:[Q(e.category),` · `,r.messageRole,r.isRegeneration?` · ${a()}`:``,r.openclawModel?` · ${r.openclawModel}`:``,r.openclawRuntime?` (${r.openclawRuntime})`:``]}),t?(0,Z.jsx)(`code`,{className:`oc-fbadmin__ref`,style:{userSelect:`all`,marginLeft:`auto`},title:U(),children:t}):null]}),e.comment?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:he()}),(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:F()}),(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:ie()}),d.length>0?(0,Z.jsx)(`div`,{className:`oc-fbadmin__thread`,children:d.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`?_():e.authorRole===`agent`?e.authorLabel??m():ee()}),(0,Z.jsx)(`span`,{className:`oc-notif__msg-text`,children:e.text})]},t))}):(0,Z.jsx)(`p`,{className:`oc-fbadmin__meta`,children:l()}),(0,Z.jsx)(`textarea`,{className:`oc-feedback__textarea`,placeholder:re(),value:p,maxLength:2e3,rows:3,onChange:e=>h(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 x(),disabled:!p.trim()||g,children:g?te():v()})})]}),(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:B()}),(0,Z.jsx)(`pre`,{className:`oc-msg__source-pre`,children:r.messageText||i()})]}),r.clientInfo?.sourceWasOpen&&r.displayedText!==void 0?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:V()}),(0,Z.jsx)(`pre`,{className:`oc-msg__source-pre`,children:r.displayedText||i()})]}):null,r.promptText?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:ne()}),(0,Z.jsx)(`pre`,{className:`oc-msg__source-pre`,children:r.promptText})]}):null,S.length>0?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:s({count:r.contextCount??S.length,truncated:r.contextTruncated?c():``})}),(0,Z.jsx)(`div`,{className:`oc-fbadmin__ctx`,children:S.map((e,t)=>(0,Z.jsxs)(`div`,{className:`oc-fbadmin__ctx-turn`,children:[(0,Z.jsx)(`span`,{className:`oc-fbadmin__ctx-role`,children:e.role}),(0,Z.jsx)(`span`,{className:`oc-fbadmin__ctx-text`,children:e.text})]},t))})]}):null,r.outboxAvailable?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:b()}),(0,Z.jsxs)(`pre`,{className:`oc-msg__source-pre`,children:[r.outboxText??``,r.outboxStatus?`\n[status: ${r.outboxStatus}]`:``]})]}):null,r.clientInfo?.extensionsDetected&&r.clientInfo.extensionsDetected.length>0?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:fe()}),(0,Z.jsx)(`div`,{className:`oc-fbadmin__row`,children:r.clientInfo.extensionsDetected.map(e=>(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-warn`,children:e},e))})]}):null,(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:o()}),(0,Z.jsxs)(`p`,{className:`oc-fbadmin__env`,children:[[r.clientInfo?.language,r.clientInfo?.timezone,r.clientInfo?.theme?ae({theme:r.clientInfo.theme}):null,r.runId?`run ${r.runId.slice(0,12)}…`:null].filter(Boolean).join(` · `)||`—`,r.clientInfo?.plugins&&r.clientInfo.plugins.length>0?(0,Z.jsxs)(`span`,{className:`oc-fbadmin__plugins`,children:[pe(),` `,r.clientInfo.plugins.join(`, `),(0,Z.jsxs)(`span`,{className:`oc-fbadmin__note`,children:[` `,M()]})]}):null,r.clientInfo?.userAgent?(0,Z.jsx)(`span`,{className:`oc-fbadmin__ua`,children:r.clientInfo.userAgent}):null]})]})]})}function xe(){let e=W(J.feedback.listForAdmin,{}),t=A(J.feedback.readSnapshot),n=A(J.feedback.deleteFeedback),i=_e(),[a,o]=(0,X.useState)(null),[s,c]=(0,X.useState)({});async function l(e){if(a===e._id){o(null);return}if(!s[e._id]){let n=await t({feedbackId:e._id});c(t=>({...t,[e._id]:n}))}o(e._id)}async function u(e){await i({title:w(),description:E(),confirmLabel:f(),destructive:!0})&&(await n({feedbackId:e._id}),a===e._id&&o(null))}return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`p`,{className:`oc-admin__hint`,children:[me(),` `,(0,Z.jsx)(`strong`,{children:de()}),` `,k()]}),(0,Z.jsx)(ve,{title:L(),rows:e,emptyHint:R(),isExpanded:e=>a===e._id&&!!s[e._id],renderExpanded:e=>s[e._id]?(0,Z.jsx)(be,{data:s[e._id],reference:e.reference,closeReason:e.userCloseReason}):null,columns:[{header:K(),cell:e=>Y(e.at),sort:e=>e.at},{header:I(),cell:e=>Q(e.category),sort:e=>Q(e.category)},{header:P(),cell:e=>e.messageRole===`user`?ue():H(),sort:e=>e.messageRole},{header:N(),cell:e=>(e.reporterEmail||e.reporterName||`—`)+(e.impersonated&&e.realOperatorEmail?` ${ce({operator:e.realOperatorEmail})}`:``),sort:e=>e.reporterEmail||e.reporterName||null},{header:G(),cell:e=>(0,Z.jsx)($,{matches:e.displayedMatchesStored,sourceWasOpen:e.sourceWasOpen}),sort:e=>e.displayedMatchesStored===!1?0:e.displayedMatchesStored===!0?1:2},{header:j(),cell:e=>e.hasComment?`✎`:`—`,sort:e=>+!!e.hasComment},{header:z(),cell:e=>e.userClosedAt==null?e.resolvedAt==null?e.answered?(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-ok`,children:se()}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill`,children:oe()}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-ok`,title:e.resolvedBy??void 0,children:g()}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-closed`,children:le()}),sort:e=>e.userClosedAt==null?e.resolvedAt==null?+!!e.answered:2:3}],rowActions:e=>[{label:a===e._id?r():y(),onSelect:()=>void l(e)},{label:O(),onSelect:()=>void u(e),variant:`destructive`}]})]})}export{xe as FeedbacksTab};
@@ -1 +1 @@
1
- import{r as e}from"./bundle-mjs-C73ZY4La.js";import{D as t,fB as n}from"./api-CyG2Kb2E.js";import{I as r,L as i,R as a,Xt as o,Yt as s,z as c}from"./index-DWkl2h55.js";import"./locales-CPjguROj.js";import"./curation-CQksaIbm.js";var l=t(`circle-question-mark`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3`,key:`1u773s`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]]),u=[`gateway-http`,`shared-fs`,`off`],d=[`inline`,`shared-fs`],f=[`reactive`,`sse`],p=`reactive`;n.object({mediaMode:n.optional(n.union(n.literal(`gateway-http`),n.literal(`shared-fs`),n.literal(`off`))),inboundMediaMode:n.optional(n.union(n.literal(`inline`),n.literal(`shared-fs`))),rehydration:n.optional(n.boolean()),mediaMaxMb:n.optional(n.number()),attachmentFixAttested:n.optional(n.boolean()),summarizeThresholdChars:n.optional(n.number()),curationEnabled:n.optional(n.boolean()),curationBudgetChars:n.optional(n.number()),converterAgentId:n.optional(n.string()),voiceEnabled:n.optional(n.boolean()),talkEnabled:n.optional(n.boolean()),voiceEngine:n.optional(n.union(n.literal(`browser`),n.literal(`gateway`))),voiceLang:n.optional(n.string()),voiceRate:n.optional(n.number()),voiceAutoRead:n.optional(n.boolean()),contentLocale:n.optional(n.string()),inboundAgentMount:n.optional(n.string()),outboundAgentMount:n.optional(n.string()),promptInjections:n.optional(n.record(n.string(),n.object({enabled:n.optional(n.boolean()),template:n.optional(n.string())})))});var m={mediaMode:`gateway-http`,inboundMediaMode:`inline`,rehydration:!0,mediaMaxMb:1024,inboundAgentMount:`/home/node/.openclaw/media/inbound`,outboundAgentMount:`/home/node/.openclaw/media/outbound`};function h(e,t){let n={};for(let r of o){let i=e?.[r];n[r]={enabled:i?.enabled??!0,template:typeof i?.template==`string`&&i.template.length>0?i.template:s[r].defaultTemplate[t]}}return n}function g(e,t){let n={};for(let r of o){let i=s[r],a=e[r];if(!a)continue;let o={};i.togglable&&a.enabled===!1&&(o.enabled=!1);let c=a.template.trim();c.length>0&&c!==i.defaultTemplate[t]&&(o.template=c),(o.enabled!==void 0||o.template!==void 0)&&(n[r]=o)}return n}function _(e,t){return{mediaMode:e.mediaMode??m.mediaMode,inboundMediaMode:e.inboundMediaMode??m.inboundMediaMode,rehydration:e.rehydration??m.rehydration,mediaMaxMb:e.mediaMaxMb??m.mediaMaxMb,inboundAgentMount:e.inboundAgentMount??m.inboundAgentMount,outboundAgentMount:e.outboundAgentMount??m.outboundAgentMount,promptInjections:h(e.promptInjections,t)}}var v=[`attachmentFixAttested`,`summarizeThresholdChars`,`curationEnabled`,`curationBudgetChars`,`contentLocale`,`converterAgentId`];function y(e,t,n){let r={},i=n=>{(e[n]!==m[n]||t[n]!==void 0)&&(r[n]=e[n])};i(`mediaMode`),i(`inboundMediaMode`),i(`rehydration`),i(`mediaMaxMb`),i(`inboundAgentMount`),i(`outboundAgentMount`);let a=g(e.promptInjections,n);Object.keys(a).length>0&&(r.promptInjections=a);let o=t;for(let e of v){let t=o[e];(typeof t==`number`||typeof t==`boolean`||typeof t==`string`)&&(r[e]=t)}return r}var b=e();function x({text:e}){return(0,b.jsx)(a,{delayDuration:150,children:(0,b.jsxs)(r,{children:[(0,b.jsx)(c,{asChild:!0,children:(0,b.jsx)(`button`,{type:`button`,className:`oc-field__help`,"aria-label":e,onClick:e=>e.preventDefault(),children:(0,b.jsx)(l,{"aria-hidden":!0})})}),(0,b.jsx)(i,{className:`max-w-xs text-pretty`,children:e})]})})}function S({label:e,help:t}){return(0,b.jsxs)(`span`,{className:`oc-field__label`,children:[e,(0,b.jsx)(x,{text:t})]})}export{p as a,f as c,_ as i,S as n,d as o,y as r,u as s,x as t};
1
+ import{r as e}from"./bundle-mjs-C73ZY4La.js";import{D as t,pB as n}from"./api-CCk5U5gB.js";import{I as r,L as i,R as a,Xt as o,Yt as s,z as c}from"./index-DY7zoioz.js";import"./locales-CPjguROj.js";import"./curation-CQksaIbm.js";var l=t(`circle-question-mark`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3`,key:`1u773s`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]]),u=[`gateway-http`,`shared-fs`,`off`],d=[`inline`,`shared-fs`],f=[`reactive`,`sse`],p=`reactive`;n.object({mediaMode:n.optional(n.union(n.literal(`gateway-http`),n.literal(`shared-fs`),n.literal(`off`))),inboundMediaMode:n.optional(n.union(n.literal(`inline`),n.literal(`shared-fs`))),rehydration:n.optional(n.boolean()),mediaMaxMb:n.optional(n.number()),attachmentFixAttested:n.optional(n.boolean()),summarizeThresholdChars:n.optional(n.number()),curationEnabled:n.optional(n.boolean()),curationBudgetChars:n.optional(n.number()),converterAgentId:n.optional(n.string()),voiceEnabled:n.optional(n.boolean()),talkEnabled:n.optional(n.boolean()),voiceEngine:n.optional(n.union(n.literal(`browser`),n.literal(`gateway`))),voiceLang:n.optional(n.string()),voiceRate:n.optional(n.number()),voiceAutoRead:n.optional(n.boolean()),contentLocale:n.optional(n.string()),inboundAgentMount:n.optional(n.string()),outboundAgentMount:n.optional(n.string()),promptInjections:n.optional(n.record(n.string(),n.object({enabled:n.optional(n.boolean()),template:n.optional(n.string())})))});var m={mediaMode:`gateway-http`,inboundMediaMode:`inline`,rehydration:!0,mediaMaxMb:1024,inboundAgentMount:`/home/node/.openclaw/media/inbound`,outboundAgentMount:`/home/node/.openclaw/media/outbound`};function h(e,t){let n={};for(let r of o){let i=e?.[r];n[r]={enabled:i?.enabled??!0,template:typeof i?.template==`string`&&i.template.length>0?i.template:s[r].defaultTemplate[t]}}return n}function g(e,t){let n={};for(let r of o){let i=s[r],a=e[r];if(!a)continue;let o={};i.togglable&&a.enabled===!1&&(o.enabled=!1);let c=a.template.trim();c.length>0&&c!==i.defaultTemplate[t]&&(o.template=c),(o.enabled!==void 0||o.template!==void 0)&&(n[r]=o)}return n}function _(e,t){return{mediaMode:e.mediaMode??m.mediaMode,inboundMediaMode:e.inboundMediaMode??m.inboundMediaMode,rehydration:e.rehydration??m.rehydration,mediaMaxMb:e.mediaMaxMb??m.mediaMaxMb,inboundAgentMount:e.inboundAgentMount??m.inboundAgentMount,outboundAgentMount:e.outboundAgentMount??m.outboundAgentMount,promptInjections:h(e.promptInjections,t)}}var v=[`attachmentFixAttested`,`summarizeThresholdChars`,`curationEnabled`,`curationBudgetChars`,`contentLocale`,`converterAgentId`];function y(e,t,n){let r={},i=n=>{(e[n]!==m[n]||t[n]!==void 0)&&(r[n]=e[n])};i(`mediaMode`),i(`inboundMediaMode`),i(`rehydration`),i(`mediaMaxMb`),i(`inboundAgentMount`),i(`outboundAgentMount`);let a=g(e.promptInjections,n);Object.keys(a).length>0&&(r.promptInjections=a);let o=t;for(let e of v){let t=o[e];(typeof t==`number`||typeof t==`boolean`||typeof t==`string`)&&(r[e]=t)}return r}var b=e();function x({text:e}){return(0,b.jsx)(a,{delayDuration:150,children:(0,b.jsxs)(r,{children:[(0,b.jsx)(c,{asChild:!0,children:(0,b.jsx)(`button`,{type:`button`,className:`oc-field__help`,"aria-label":e,onClick:e=>e.preventDefault(),children:(0,b.jsx)(l,{"aria-hidden":!0})})}),(0,b.jsx)(i,{className:`max-w-xs text-pretty`,children:e})]})})}function S({label:e,help:t}){return(0,b.jsxs)(`span`,{className:`oc-field__label`,children:[e,(0,b.jsx)(x,{text:t})]})}export{p as a,f as c,_ as i,S as n,d as o,y as r,u as s,x as t};
@@ -0,0 +1 @@
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$R as ee,$z as r,BR as te,GR as i,HR as ne,JR as re,KR as ie,LR as ae,QR as a,Qo as o,RR as s,UR as c,VR as l,WR as u,XR as d,YR as f,ZR as oe,Zo as se,Zz as ce,_z as le,aB as ue,az as p,cz as de,dz as fe,ez as pe,fz as me,gz as he,hz as m,iz as h,lz as ge,mz as g,nM as _e,nz as _,oB as ve,oz as v,pz as ye,qR as be,rz as y,sz as b,t as x,tz as S,uz as C,vz as w,zR as T}from"./api-CCk5U5gB.js";import{t as E}from"./button-CbUSFbZL.js";import{$ as D,Ct as O,Dt as k,Et as A,Fn as j,Lt as M,Mt as N,Nt as xe,Pn as Se,Pt as P,Q as F,St as Ce,Tt as we,X as I,Z as L,bt as Te,dn as Ee,et as R,hn as De,ut as Oe,vt as ke,wt as Ae,xt as je,yt as Me}from"./index-DY7zoioz.js";import{a as Ne,i as z,n as Pe,o as B,r as V,t as Fe}from"./table-BhYNJKZu.js";var H=t(e(),1),U=n(),W=`all`;function G(e){switch(e){case`image`:return b();case`audio`:return v();case`video`:return p();case`pdf`:return h();case`document`:return y();case`archive`:return _();default:return S()}}function K(){let[e,t]=(0,H.useState)(W),[n,p]=(0,H.useState)(W),[h,_]=(0,H.useState)(W),[v,y]=(0,H.useState)(W),[b,S]=(0,H.useState)(!1),[K,q]=(0,H.useState)(null),J=ue(x.files.softDelete),Y=k();function Ie(){t(W),p(W),_(W),y(W)}async function Le(){let e=K;if(q(null),e)try{await J({fileId:e.id}),Y.success(u())}catch(e){Y.error(c(),e)}}let X=ve(x.files.listMine,{direction:e===W?void 0:e,chatId:n===W?void 0:n,instanceName:h===W?void 0:h,category:v===W?void 0:v,includeAutoGenerated:b||void 0}),Re=(0,H.useMemo)(()=>new Intl.DateTimeFormat(r(),{dateStyle:`medium`,timeStyle:`short`}),[]);if(X===void 0)return(0,U.jsx)(`p`,{className:`oc-admin__hint`,children:ce()});let{files:Z,facets:Q,truncated:ze,cap:Be}=X,$=e!==W||n!==W||h!==W||v!==W;return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`p`,{className:`oc-admin__hint`,children:w()}),(0,U.jsxs)(`div`,{className:`oc-files__filters`,style:{display:`flex`,flexWrap:`wrap`,gap:8,margin:`12px 0`},children:[(0,U.jsxs)(I,{value:e,onValueChange:t,children:[(0,U.jsx)(D,{size:`sm`,"aria-label":le(),children:(0,U.jsx)(R,{})}),(0,U.jsxs)(L,{children:[(0,U.jsx)(F,{value:W,children:he()}),(0,U.jsx)(F,{value:`inbound`,children:m()}),(0,U.jsx)(F,{value:`outbound`,children:g()})]})]}),(0,U.jsxs)(I,{value:n,onValueChange:p,children:[(0,U.jsx)(D,{size:`sm`,"aria-label":ye(),children:(0,U.jsx)(R,{})}),(0,U.jsxs)(L,{children:[(0,U.jsx)(F,{value:W,children:me()}),Q.chats.map(e=>(0,U.jsx)(F,{value:e.id,children:e.title},e.id))]})]}),Q.multiProvider?(0,U.jsxs)(I,{value:h,onValueChange:_,children:[(0,U.jsx)(D,{size:`sm`,"aria-label":fe(),children:(0,U.jsx)(R,{})}),(0,U.jsxs)(L,{children:[(0,U.jsx)(F,{value:W,children:C()}),Q.instances.map(e=>(0,U.jsx)(F,{value:e,children:e},e))]})]}):null,(0,U.jsxs)(I,{value:v,onValueChange:y,children:[(0,U.jsx)(D,{size:`sm`,"aria-label":ge(),children:(0,U.jsx)(R,{})}),(0,U.jsxs)(L,{children:[(0,U.jsx)(F,{value:W,children:de()}),Q.categories.map(e=>(0,U.jsx)(F,{value:e,children:G(e)},e))]})]}),(0,U.jsxs)(`label`,{className:`oc-files__autogen`,children:[(0,U.jsx)(Oe,{checked:b,onCheckedChange:e=>S(e===!0),"aria-label":o()}),(0,U.jsx)(`span`,{children:o()})]}),$?(0,U.jsxs)(E,{variant:`ghost`,size:`sm`,onClick:Ie,style:{display:`inline-flex`,alignItems:`center`,gap:4,marginLeft:`auto`},children:[(0,U.jsx)(De,{size:14,"aria-hidden":!0}),be()]}):null]}),Z.length===0?(0,U.jsx)(`p`,{className:`oc-admin__hint`,children:$?s():T()}):(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(Fe,{children:[(0,U.jsx)(Ne,{children:(0,U.jsxs)(B,{children:[(0,U.jsx)(z,{children:pe()}),(0,U.jsx)(z,{children:ee()}),(0,U.jsx)(z,{children:a()}),(0,U.jsx)(z,{children:oe()}),(0,U.jsx)(z,{children:d()}),(0,U.jsx)(z,{className:`text-right`,children:f()})]})}),(0,U.jsx)(Pe,{children:Z.map(e=>(0,U.jsxs)(B,{children:[(0,U.jsxs)(V,{className:`font-medium`,style:{maxWidth:280,overflow:`hidden`,textOverflow:`ellipsis`},title:e.filename,children:[e.filename,e.origin===`pasted`?(0,U.jsx)(A,{variant:`outline`,style:{marginLeft:6},children:se()}):null]}),(0,U.jsx)(V,{title:e.mimeType,children:G(e.category)}),(0,U.jsx)(V,{children:(0,U.jsx)(A,{variant:`secondary`,children:e.direction===`inbound`?m():g()})}),(0,U.jsx)(V,{style:{maxWidth:220,overflow:`hidden`,textOverflow:`ellipsis`},title:e.chatTitle,children:e.chatTitle}),(0,U.jsx)(V,{className:`whitespace-nowrap text-muted-foreground`,children:Re.format(e.createdAt)}),(0,U.jsx)(V,{className:`text-right`,children:(0,U.jsxs)(N,{children:[(0,U.jsx)(M,{asChild:!0,children:(0,U.jsx)(E,{variant:`ghost`,size:`icon`,"aria-label":ie(),children:(0,U.jsx)(Se,{size:16})})}),(0,U.jsxs)(xe,{align:`end`,children:[e.url?(0,U.jsx)(P,{asChild:!0,children:(0,U.jsxs)(`a`,{href:e.url,download:e.filename,target:`_blank`,rel:`noopener noreferrer`,children:[(0,U.jsx)(j,{size:14}),re()]})}):(0,U.jsxs)(P,{disabled:!0,children:[(0,U.jsx)(j,{size:14}),te()]}),(0,U.jsxs)(P,{variant:`destructive`,onSelect:()=>q({id:e._id,filename:e.filename}),children:[(0,U.jsx)(Ee,{size:14}),i()]})]})]})})]},e._id))})]}),ze?(0,U.jsx)(`p`,{className:`oc-admin__hint`,style:{marginTop:8},children:ae({cap:Be})}):null]}),(0,U.jsx)(ke,{open:K!==null,onOpenChange:e=>!e&&q(null),children:(0,U.jsxs)(je,{children:[(0,U.jsxs)(Ae,{children:[(0,U.jsx)(we,{children:ne()}),(0,U.jsx)(Ce,{children:l()})]}),(0,U.jsxs)(O,{children:[(0,U.jsx)(Te,{children:_e()}),(0,U.jsx)(Me,{onClick:()=>void Le(),children:i()})]})]})})]})}export{K as FilesTab};
@@ -1 +1 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Xh as r,Yh as i}from"./api-CyG2Kb2E.js";import{t as a}from"./button-SxU4iS5M.js";import{hn as o,jt as s,mn as c}from"./index-DWkl2h55.js";import{t as l}from"./TimeRangePicker-Dx50b9Tc.js";var u=t(e(),1),d=n(),f=250;function p({q:e,onQChange:t,searchPlaceholder:n=r(),children:p,timeRange:m,onTimeRangeChange:h,onReset:g,canReset:_=!0}){let[v,y]=(0,u.useState)(e);(0,u.useEffect)(()=>{y(e)},[e]);let b=(0,u.useRef)(null);function x(e){y(e),b.current!==null&&window.clearTimeout(b.current),b.current=window.setTimeout(()=>t(e),f)}(0,u.useEffect)(()=>()=>{b.current!==null&&window.clearTimeout(b.current)},[]);function S(){b.current!==null&&window.clearTimeout(b.current),g()}return(0,d.jsxs)(`div`,{className:`oc-filterbar`,children:[(0,d.jsxs)(`div`,{className:`oc-filterbar__search`,children:[(0,d.jsx)(c,{className:`oc-filterbar__search-icon`,"aria-hidden":!0}),(0,d.jsx)(s,{value:v,onChange:e=>x(e.target.value),placeholder:n,"aria-label":n})]}),p?(0,d.jsx)(`div`,{className:`oc-filterbar__quick`,children:p}):null,m&&h?(0,d.jsx)(l,{value:m,onChange:h}):null,(0,d.jsxs)(a,{variant:`ghost`,size:`sm`,className:`oc-filterbar__reset`,onClick:S,disabled:!_,children:[(0,d.jsx)(o,{}),i()]})]})}export{p as t};
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Xh as r,Zh as i}from"./api-CCk5U5gB.js";import{t as a}from"./button-CbUSFbZL.js";import{hn as o,jt as s,mn as c}from"./index-DY7zoioz.js";import{t as l}from"./TimeRangePicker-qNMV_Gj-.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)(c,{className:`oc-filterbar__search-icon`,"aria-hidden":!0}),(0,d.jsx)(s,{value:v,onChange:e=>x(e.target.value),placeholder:n,"aria-label":n})]}),p?(0,d.jsx)(`div`,{className:`oc-filterbar__quick`,children:p}):null,m&&h?(0,d.jsx)(l,{value:m,onChange:h}):null,(0,d.jsxs)(a,{variant:`ghost`,size:`sm`,className:`oc-filterbar__reset`,onClick:S,disabled:!_,children:[(0,d.jsx)(o,{}),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{$f as r,$p as i,Ap as a,Bp as o,Cp as s,D as c,Dp as l,Ep as u,Fp as d,Gp as f,Hp as p,Ip as m,Jf as h,Jp as g,Kp as _,Lp as v,Mp as y,Np as b,Op as x,Pp as S,Qf as C,Qp as w,Rp as ee,Sp as T,Tp as E,Up as te,Vp as D,Wp as O,Xf as ne,Xp as re,Yf as k,Yp as A,Zf as j,Zp as ie,_p as ae,aB as M,ap as N,bp as P,cp as oe,dp as F,em as se,ep as ce,fp as le,gp as ue,hp as de,ip as fe,jp as pe,kp as me,lp as he,mp as ge,nm as _e,np as ve,oB as I,op as ye,pp as be,qp as xe,rm as Se,rp as Ce,sp as we,t as L,tm as Te,tp as Ee,up as De,vp as Oe,wp as ke,xp as Ae,yp as R,zp as je}from"./api-CCk5U5gB.js";import{t as Me}from"./x-BvfQ_1AZ.js";import{i as z,n as B,r as Ne,t as Pe}from"./tabs-BwhZusQZ.js";import{t as V}from"./button-CbUSFbZL.js";import{$ as Fe,Bn as Ie,Dt as H,Et as U,Q as Le,U as Re,Vn as ze,X as Be,Z as Ve,_ as He,at as Ue,cn as We,et as Ge,fn as W,jt as G,nt as Ke,ot as qe,pn as K,q as Je,rt as Ye,tt as Xe,ut as q}from"./index-DY7zoioz.js";import{t as Ze}from"./FilterBar-BJ1mhU3e.js";import{t as Qe}from"./DataTableShell-BWoSBli_.js";import{t as J}from"./DetailChips-CUfCyLvN.js";var Y=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`}]]),X=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`}]]),Z=t(e(),1);function $e(e,t,n){let r=t.trim().toLowerCase();return[...r?e.filter(e=>[e.email,e.name,e.canonical].some(e=>e!=null&&e.toLowerCase().includes(r))):e.slice()].sort((e,t)=>!n.has(e.userId)-+!n.has(t.userId))}function et(e,t){let n=e.filter(e=>e.source===`discovered`),r=t.trim().toLowerCase();return r?n.filter(e=>(e.displayName??e.agentId).toLowerCase().includes(r)||e.agentId.toLowerCase().includes(r)):n}function tt(e){let t=e.name?.trim()??``,n=e.email?.trim()??``,r=e.canonical?.trim()||`u-${e.userId.slice(0,8)}`;return t?{primary:t,secondary:n||`@${r}`}:n?{primary:n,secondary:null}:{primary:`@${r}`,secondary:null}}function nt(e){switch(e){case`admin`:return ke();case`user`:return s();case`pending`:return T();default:return e}}function rt(e,t){if(e.length===0)return`none`;let n=0;for(let r of e)t(r)&&n++;return n===0?`none`:n===e.length?`all`:`some`}function it(e,t,n){let r=Math.max(1,Math.ceil(e.length/n)),i=Math.min(Math.max(1,Math.floor(t)),r),a=(i-1)*n;return{pageItems:e.slice(a,a+n),page:i,pageCount:r}}var Q=n(),$={name:``,description:``};function at(){let e=I(L.groups.listGroups,{}),t=I(L.me.getMe,{host:Je})?.role===`admin`,n=M(L.groups.createGroup),r=M(L.groups.updateGroup),a=M(L.groups.deleteGroup),s=Re(),c=H(),[l,u]=(0,Z.useState)(!1),[d,h]=(0,Z.useState)(null),[y,b]=(0,Z.useState)($),[x,S]=(0,Z.useState)(null),[C,T]=(0,Z.useState)(``),E=(0,Z.useMemo)(()=>{if(!e)return e;let t=C.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,C]);function k(){h(null),b($),u(!0)}function ae(e){h(e),b({name:e.name,description:e.description??``}),u(!0)}async function N(){try{d?await r({groupId:d._id,name:y.name,description:y.description}):await n({name:y.name,description:y.description||void 0}),b($),h(null),u(!1)}catch(e){c.error(j(),e)}}async function P(e){if(await s({title:ee({name:e.name}),description:v(),confirmWord:e.name,confirmLabel:m(),cancelLabel:O(),destructive:!0}))try{await a({groupId:e._id})}catch(e){c.error(ne(),e)}}return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:_e()}),(0,Q.jsx)(Ze,{q:C,onQChange:T,onReset:()=>T(``),canReset:C!==``,searchPlaceholder:A()}),(0,Q.jsx)(Qe,{title:Se(),rows:E,addLabel:Te(),onAdd:t?k:void 0,emptyHint:se(),columns:[{header:i(),cell:e=>e.name,sort:e=>e.name},{header:w(),cell:e=>(0,Q.jsx)(J,{icon:(0,Q.jsx)(We,{size:12,"aria-hidden":!0}),total:e.memberCount,items:e.members.map(e=>({label:e.label,marker:e.manager?(0,Q.jsx)(X,{size:11,"aria-hidden":!0}):null,highlight:e.manager}))}),sort:e=>e.memberCount},{header:ie(),cell:e=>(0,Q.jsx)(J,{icon:(0,Q.jsx)(K,{size:12,"aria-hidden":!0}),total:e.agentCount,items:e.agents.map(e=>({label:e}))}),sort:e=>e.agentCount},{header:re(),cell:e=>(0,Q.jsx)(J,{icon:(0,Q.jsx)(Y,{size:12,"aria-hidden":!0}),total:e.chartCount,items:e.charts.map(e=>({label:e.name,marker:e.isDefault?(0,Q.jsx)(W,{size:11,fill:`currentColor`,"aria-hidden":!0}):null,highlight:e.isDefault}))}),sort:e=>e.chartCount}],rowActions:e=>[{label:g(),onSelect:()=>S({groupId:e._id,name:e.name})},...t?[{label:xe(),onSelect:()=>ae(e)},{label:_(),variant:`destructive`,onSelect:()=>void P(e)}]:[]]}),(0,Q.jsx)(He,{open:l,onOpenChange:u,title:d?p():te(),description:D(),canSubmit:!!y.name.trim(),onSubmit:N,submitLabel:f(),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:o()}),(0,Q.jsx)(G,{value:y.name,onChange:e=>b({...y,name:e.target.value})})]}),(0,Q.jsxs)(`label`,{className:`oc-field`,children:[(0,Q.jsx)(`span`,{className:`oc-field__label`,children:je()}),(0,Q.jsx)(G,{value:y.description,onChange:e=>b({...y,description:e.target.value})})]})]})}),(0,Q.jsx)(ct,{groupId:x?.groupId??null,groupName:x?.name??``,open:x!==null,onOpenChange:e=>{e||S(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)(ze,{size:14,"aria-hidden":!0}),l()]}),(0,Q.jsxs)(`span`,{className:`oc-access__pageinfo`,"aria-label":E({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:[u(),(0,Q.jsx)(Ie,{size:14,"aria-hidden":!0})]})]})}function ct({groupId:e,groupName:t,open:n,onOpenChange:i}){let o=I(L.groups.getGroup,n&&e?{groupId:e}:`skip`),s=I(L.groups.listAssignableInstances,n?{}:`skip`),c=I(L.groups.listAssignableUsers,n?{}:`skip`),l=M(L.groups.addMember),u=M(L.groups.removeMember),f=M(L.groups.bulkSetMembers),p=M(L.groups.setGroupManager),m=H(),[h,g]=(0,Z.useState)(``),[_,v]=(0,Z.useState)(``),[C,w]=(0,Z.useState)(`members`),[ee,T]=(0,Z.useState)(1),[E,te]=(0,Z.useState)(new Set),D=(0,Z.useRef)(null),O=(0,Z.useMemo)(()=>new Set((o?.members??[]).map(e=>e.userId)),[o]),ne=(0,Z.useMemo)(()=>new Set((o?.members??[]).filter(e=>e.manager).map(e=>e.userId)),[o]),re=o?.viewerIsAdmin===!0,A=(0,Z.useMemo)(()=>new Set((o?.agents??[]).map(e=>`${e.instanceName}/${e.agentId}`)),[o]);(0,Z.useEffect)(()=>{g(``),v(``),w(`members`),T(1),D.current=null},[n,e]),(0,Z.useEffect)(()=>{T(1)},[h]),(0,Z.useEffect)(()=>{n&&o&&e&&D.current!==e&&(D.current=e,te(new Set((o.members??[]).map(e=>e.userId))))},[n,o,e]);let j=(0,Z.useMemo)(()=>c?$e(c,h,E):[],[c,h,E]);async function ie(t,n){if(e)try{n?await u({groupId:e,userId:t}):await l({groupId:e,userId:t})}catch(e){m.error(k(),e)}}async function N(t,n){if(e)try{await p({groupId:e,userId:t,manager:!n})}catch(e){m.error(r(),e)}}let P=rt(j,e=>O.has(e.userId)),oe=j.filter(e=>O.has(e.userId)).length,F=it(j,ee,ot);async function se(){if(!e||j.length===0)return;let t=j.map(e=>e.userId);try{await f({groupId:e,userIds:t,member:P!==`all`})}catch(e){m.error(k(),e)}}return(0,Q.jsx)(Xe,{open:n,onOpenChange:i,children:(0,Q.jsxs)(Ke,{className:`oc-access`,children:[(0,Q.jsxs)(Ue,{children:[(0,Q.jsx)(qe,{children:d({name:t})}),(0,Q.jsx)(Ye,{children:S()})]}),(0,Q.jsxs)(Pe,{value:C,onValueChange:w,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)(We,{size:13,"aria-hidden":!0}),b(),o?(0,Q.jsx)(U,{variant:`secondary`,className:`oc-access__tabcount`,children:O.size}):null]}),(0,Q.jsxs)(z,{value:`agents`,className:`flex-1 gap-1.5`,children:[(0,Q.jsx)(K,{size:13,"aria-hidden":!0}),pe(),o?(0,Q.jsx)(U,{variant:`secondary`,className:`oc-access__tabcount`,children:A.size}):null]}),(0,Q.jsxs)(z,{value:`charts`,className:`flex-1 gap-1.5`,children:[(0,Q.jsx)(Y,{size:13,"aria-hidden":!0}),De(),o?(0,Q.jsx)(U,{variant:`secondary`,className:`oc-access__tabcount`,children:o.chartCount}):null]})]}),(0,Q.jsx)(B,{value:`members`,children:c===void 0||o===void 0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:R()}):c.length===0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:ae()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(G,{value:h,onChange:e=>g(e.target.value),placeholder:y(),className:`oc-access__search`}),j.length===0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:me()}):(0,Q.jsxs)(Q.Fragment,{children:[j.length>1?(0,Q.jsxs)(`div`,{className:`oc-access__row oc-access__selectall`,children:[(0,Q.jsx)(q,{checked:P===`all`?!0:P===`some`?`indeterminate`:!1,onCheckedChange:()=>void se(),"aria-label":x()}),(0,Q.jsx)(`span`,{className:`oc-access__label`,children:x()}),(0,Q.jsxs)(U,{variant:`outline`,className:`oc-access__count`,children:[oe,` / `,j.length]})]}):null,(0,Q.jsx)(`div`,{className:`oc-access__list`,children:F.pageItems.map(e=>{let t=O.has(e.userId),n=tt(e),r=ne.has(e.userId);return(0,Q.jsxs)(`div`,{className:`oc-access__row`,children:[(0,Q.jsx)(q,{checked:t,onCheckedChange:()=>void ie(e.userId,t),"aria-label":Ae({user:n.primary})}),(0,Q.jsxs)(`span`,{className:`oc-access__who`,children:[(0,Q.jsx)(`span`,{className:`oc-access__label`,title:n.primary,children:n.primary}),n.secondary?(0,Q.jsx)(`span`,{className:`oc-access__sub`,title:n.secondary,children:n.secondary}):null]}),(0,Q.jsx)(U,{variant:`outline`,className:`oc-access__role`,children:nt(e.role)}),(0,Q.jsx)(`span`,{className:`oc-access__mgrslot`,children:t&&re?(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?ce():Ee(),title:r?ce():Ee(),onClick:()=>void N(e.userId,r),children:(0,Q.jsx)(X,{size:15,"aria-hidden":!0})}):t&&r?(0,Q.jsx)(`span`,{className:`oc-access__mgr oc-access__mgr--on`,role:`img`,"aria-label":ve(),title:ve(),children:(0,Q.jsx)(X,{size:15,"aria-hidden":!0})}):null})]},e._id)})}),(0,Q.jsx)(st,{page:F.page,pageCount:F.pageCount,onPage:T})]})]})}),(0,Q.jsx)(B,{value:`agents`,children:s===void 0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:R()}):s.length===0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:ue()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(G,{value:_,onChange:e=>v(e.target.value),placeholder:a(),className:`oc-access__search`}),(0,Q.jsx)(`div`,{className:`oc-access__list`,children:s.map(t=>(0,Q.jsx)(lt,{groupId:e,instanceName:t.name,kind:t.kind??`openclaw`,assigned:A,query:_},`${e}-${t._id}`))})]})}),(0,Q.jsx)(B,{value:`charts`,children:(0,Q.jsx)(ut,{groupId:e})})]})]})})}function lt({groupId:e,instanceName:t,kind:n,assigned:r,query:i}){let a=I(L.groups.listAssignableAgents,{instanceName:t}),o=M(L.groups.assignAgentToGroup),s=M(L.groups.removeAgentFromGroup),c=M(L.groups.bulkSetGroupAgents),l=H(),[u,d]=(0,Z.useState)(1);if((0,Z.useEffect)(()=>{d(1)},[i]),!e)return null;let f=et(a?.agents??[],i),p=a?.discovery&&!a.discovery.lastPollOk;if(i.trim()&&f.length===0)return null;let m=f.filter(e=>e.presentInLastOk!==!1&&e.enabled!==!1),g=rt(m,e=>r.has(`${t}/${e.agentId}`)),_=it(f,u,ot);async function v(n,r){try{r?await s({groupId:e,instanceName:t,agentId:n}):await o({groupId:e,instanceName:t,agentId:n})}catch(e){l.error(h(),e)}}async function y(){if(m.length===0)return;let n=m.map(e=>e.agentId);try{await c({groupId:e,instanceName:t,agentIds:n,assigned:g!==`all`})}catch(e){l.error(h(),e)}}return(0,Q.jsxs)(`div`,{className:`oc-access__group`,children:[(0,Q.jsxs)(`div`,{className:`oc-access__instance`,children:[(0,Q.jsx)(K,{size:13,"aria-hidden":!0}),(0,Q.jsx)(`span`,{children:t}),(0,Q.jsx)(U,{variant:`outline`,className:`oc-access__kind`,children:n}),p?(0,Q.jsx)(U,{variant:`outline`,className:`oc-access__stale`,children:be()}):null]}),a===void 0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:Oe()}):f.length===0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:p?ge():de()}):(0,Q.jsxs)(Q.Fragment,{children:[m.length>1?(0,Q.jsxs)(`div`,{className:`oc-access__row oc-access__selectall`,children:[(0,Q.jsx)(q,{checked:g===`all`?!0:g===`some`?`indeterminate`:!1,onCheckedChange:()=>void y(),"aria-label":x()}),(0,Q.jsx)(`span`,{className:`oc-access__label`,children:x()})]}):null,_.pageItems.map(e=>{let n=`${t}/${e.agentId}`,i=r.has(n),a=e.presentInLastOk===!1,o=!e.enabled;return(0,Q.jsxs)(`div`,{className:`oc-access__row${o?` is-disabled`:``}`,children:[(0,Q.jsx)(q,{checked:i,disabled:(a||o)&&!i,onCheckedChange:()=>void v(e.agentId,i),"aria-label":P({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":F(),title:F(),children:(0,Q.jsx)(W,{size:14,fill:`currentColor`})}):null,a?(0,Q.jsx)(U,{variant:`outline`,className:`oc-access__gone`,children:le()}):null]},e.agentId)}),(0,Q.jsx)(st,{page:_.page,pageCount:_.pageCount,onPage:d})]})]})}function ut({groupId:e}){let t=I(L.charts.listGroupChartSelection,e?{groupId:e}:`skip`),n=M(L.charts.assignChartToGroup),r=M(L.charts.removeChartFromGroup),i=M(L.charts.setGroupDefaultChart),a=M(L.charts.addChartToGroupPool),o=M(L.charts.removeChartFromGroupPool),s=H();if(!e)return null;if(t===void 0)return(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:R()});let{pool:c,addable:l,canManagePool:u}=t;if(c.length===0&&!u)return(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:he()});async function d(t,i){try{i?await r({groupId:e,chartKey:t}):await n({groupId:e,chartKey:t})}catch(e){s.error(C(),e)}}async function f(t){try{await i({groupId:e,chartKey:t})}catch(e){s.error(C(),e)}}async function p(t){try{await a({groupId:e,chartKey:t})}catch(e){s.error(C(),e)}}async function m(t){try{await o({groupId:e,chartKey:t})}catch(e){s.error(C(),e)}}return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`div`,{className:`oc-access__list`,children:c.map(e=>(0,Q.jsxs)(`div`,{className:`oc-access__row`,children:[(0,Q.jsx)(q,{checked:e.selected,onCheckedChange:()=>void d(e.chartKey,e.selected),"aria-label":N({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":fe(),title:fe(),children:(0,Q.jsx)(W,{size:14,fill:`currentColor`})}):(0,Q.jsx)(V,{type:`button`,variant:`ghost`,size:`sm`,onClick:()=>void f(e.chartKey),children:Ce()}):null,u?(0,Q.jsx)(V,{type:`button`,variant:`ghost`,size:`sm`,"aria-label":ye({name:e.name}),title:ye({name:e.name}),onClick:()=>void m(e.chartKey),children:(0,Q.jsx)(Me,{size:14,"aria-hidden":!0})}):null]},e.chartKey))}),u?l.length>0?(0,Q.jsxs)(Be,{value:``,onValueChange:e=>void p(e),children:[(0,Q.jsx)(Fe,{size:`sm`,className:`oc-access__search`,children:(0,Q.jsx)(Ge,{placeholder:we()})}),(0,Q.jsx)(Ve,{children:l.map(e=>(0,Q.jsx)(Le,{value:e.chartKey,children:e.name},e.chartKey))})]}):c.length===0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:oe()}):null:null]})}export{at as GroupsTab};
@@ -0,0 +1 @@
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$E as r,$T as i,AE as a,Ai as o,BE as s,BT as c,CE as l,DE as u,EE as d,F as f,FE as p,FT as m,GE as h,GT as g,HE as _,HT as v,I as y,IE as b,IT as x,JE as S,JT as C,KE as w,KT as ee,L as te,LE as T,LT as E,M as ne,ME as re,MT as ie,N as ae,NE as oe,NT as se,OE as ce,Oi as le,P as ue,PE as de,PT as fe,QE as pe,QT as me,RE as he,RT as ge,SE as _e,TE as ve,UE as ye,UT as be,VE as xe,VT as Se,WE as Ce,WT as we,XE as Te,XT as Ee,YE as De,YT as Oe,ZE as ke,ZT as Ae,_D as je,_E as Me,aB as D,aD as Ne,aE as Pe,ac as Fe,bD as Ie,bE as Le,bx as Re,cD as ze,cE as Be,dD as Ve,dE as He,eD as Ue,fD as We,fE as Ge,gD as Ke,gE as qe,hD as Je,hE as Ye,iD as Xe,iE as Ze,iN as Qe,ic as $e,j as et,jE as tt,jT as nt,kE as rt,ki as it,lD as at,lE as ot,mD as st,mE as ct,nD as lt,nE as ut,oB as O,oD as k,oE as A,oc as dt,pD as ft,pE as pt,qE as mt,qT as ht,rB as j,rD as gt,rE as _t,rN as M,rc as vt,sD as yt,sE as bt,t as N,tD as xt,tE as P,uD as St,uE as Ct,vD as wt,vE as Tt,wE as Et,xE as Dt,xx as Ot,yD as kt,yE as At,zE as jt,zT as Mt}from"./api-CCk5U5gB.js";import{a as Nt,c as Pt}from"./FieldLabel-8vj4ipPC.js";import{t as F}from"./button-CbUSFbZL.js";import{$ as I,Bt as Ft,Dt as L,Et as R,Q as z,Rt as It,U as Lt,X as B,Z as V,_ as Rt,at as H,et as U,jt as W,nt as G,ot as K,rt as q,tt as J,ut as zt,zt as Bt}from"./index-DY7zoioz.js";import{t as Vt}from"./DataTableShell-BWoSBli_.js";import{InstanceConfigDialog as Ht}from"./BridgeTab-QW9px1z5.js";var Y=t(e(),1),X=[`conversational`,`documentary`,`summarizer`,`curator`],Ut=new Set(X),Wt=`conversational`;function Gt(e){let t=new Set((e??[]).filter(e=>Ut.has(e)));return t.size===0?[Wt]:X.filter(e=>t.has(e))}var Z=n(),Q={name:``,gatewayUrl:``,bridgeUrl:``,displayName:``,kind:`openclaw`,transport:`ws`,gatewayVersion:``,gatewayHttpUrl:``,authMode:`token`,systemIdentity:``,streamTransport:Nt},Kt={openclaw:[`token`,`deviceIdentity`],hermes:[`apiKey`]};function qt(e){return{name:e.name,gatewayUrl:e.gatewayUrl,bridgeUrl:e.bridgeUrl??``,displayName:e.displayName??``,kind:e.kind??`openclaw`,transport:e.transport??`ws`,gatewayVersion:e.gatewayVersion??``,gatewayHttpUrl:e.gatewayHttpUrl??``,authMode:e.authMode??`token`,systemIdentity:e.systemIdentity??``,streamTransport:e.streamTransport??`reactive`}}function Jt(){let e=O(N.admin.listInstances,{}),t=O(N.agents.listAllInstanceAgents,{}),n=D(N.admin.upsertInstance),i=D(N.admin.deleteInstance),a=L(),[s,c]=(0,Y.useState)(!1),[l,u]=(0,Y.useState)(Q),[d,p]=(0,Y.useState)(null),[m,g]=(0,Y.useState)(null),[_,v]=(0,Y.useState)(null),[b,x]=(0,Y.useState)(null);async function C(){try{await n({instanceId:b??void 0,name:l.name,gatewayUrl:l.gatewayUrl,bridgeUrl:l.bridgeUrl||void 0,displayName:l.displayName||void 0,kind:l.kind,transport:l.kind===`hermes`?l.transport:void 0,gatewayVersion:l.gatewayVersion||void 0,gatewayHttpUrl:l.gatewayHttpUrl||void 0,...l.kind===`openclaw`?{authMode:l.authMode,systemIdentity:l.systemIdentity||void 0}:{},streamTransport:l.streamTransport}),u(Q),x(null),c(!1)}catch(e){a.error(wt(),e)}}return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`p`,{className:`oc-admin__hint`,children:[je(),(0,Z.jsx)(`strong`,{children:Ke()}),Je()]}),(0,Z.jsx)(Vt,{title:st(),rows:e,addLabel:ft(),onAdd:()=>{x(null),u(Q),c(!0)},emptyHint:We(),columns:[{header:Ve(),cell:e=>e.name,sort:e=>e.name},{header:St(),cell:e=>(0,Z.jsx)(R,{variant:`outline`,children:e.kind??`openclaw`}),sort:e=>e.kind??`openclaw`},{header:at(),cell:e=>e.gatewayUrl,sort:e=>e.gatewayUrl},{header:ze(),cell:e=>e.displayName??`—`,sort:e=>e.displayName??null},{header:Ie(),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)(R,{variant:r(e.agentId)?`default`:`outline`,title:r(e.agentId)?ie():void 0,children:[e.emoji?`${e.emoji} `:``,e.displayName??e.agentId]},e.agentId))})}}],rowActions:e=>[{label:Xe(),onSelect:()=>{x(e._id),u(qt(e)),c(!0)}},{label:kt(),onSelect:()=>p(e.name)},{label:ye(),onSelect:()=>v(e)},{label:yt(),onSelect:()=>g(e)},{label:k(),variant:`destructive`,onSelect:()=>void i({instanceId:e._id})}],bulkActions:[{label:k(),variant:`destructive`,onSelect:e=>e.forEach(e=>void i({instanceId:e}))}]}),(0,Z.jsx)(Rt,{open:s,onOpenChange:c,title:b?gt():Ne(),description:xt(),canSubmit:!!(l.name&&l.gatewayUrl),onSubmit:C,submitLabel:Ue(),children:(0,Z.jsxs)(`div`,{className:`oc-form`,children:[(0,Z.jsxs)($,{label:r(),children:[(0,Z.jsx)(W,{value:l.name,disabled:b!==null,onChange:e=>u({...l,name:e.target.value})}),b?(0,Z.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:lt()}):null]}),(0,Z.jsx)($,{label:pe(),children:(0,Z.jsxs)(B,{value:l.kind,onValueChange:e=>u({...l,kind:e}),children:[(0,Z.jsx)(I,{size:`sm`,className:`w-40`,children:(0,Z.jsx)(U,{})}),(0,Z.jsxs)(V,{children:[(0,Z.jsx)(z,{value:`openclaw`,children:`OpenClaw`}),(0,Z.jsx)(z,{value:`hermes`,children:`Hermes`})]})]})}),l.kind===`hermes`?(0,Z.jsx)($,{label:o(),children:(0,Z.jsxs)(B,{value:l.transport,onValueChange:e=>u({...l,transport:e}),children:[(0,Z.jsx)(I,{size:`sm`,className:`w-56`,children:(0,Z.jsx)(U,{})}),(0,Z.jsxs)(V,{children:[(0,Z.jsx)(z,{value:`ws`,children:it()}),(0,Z.jsx)(z,{value:`rest`,children:le()})]})]})}):null,(0,Z.jsx)($,{label:ke(),children:(0,Z.jsx)(W,{value:l.gatewayUrl,onChange:e=>u({...l,gatewayUrl:e.target.value})})}),(0,Z.jsx)($,{label:Te(),children:(0,Z.jsx)(W,{value:l.bridgeUrl,placeholder:De(),onChange:e=>u({...l,bridgeUrl:e.target.value})})}),(0,Z.jsx)($,{label:S(),children:(0,Z.jsx)(W,{value:l.displayName,onChange:e=>u({...l,displayName:e.target.value})})}),(0,Z.jsxs)($,{label:Ot(),children:[(0,Z.jsxs)(B,{value:l.streamTransport,onValueChange:e=>u({...l,streamTransport:e}),children:[(0,Z.jsx)(I,{size:`sm`,className:`w-40`,children:(0,Z.jsx)(U,{})}),(0,Z.jsx)(V,{children:Pt.map(e=>(0,Z.jsx)(z,{value:e,children:e},e))})]}),(0,Z.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:Re()})]}),(0,Z.jsx)($,{label:mt(),children:(0,Z.jsx)(W,{value:l.gatewayVersion,placeholder:w(),onChange:e=>u({...l,gatewayVersion:e.target.value})})}),l.kind===`openclaw`?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)($,{label:te(),children:[(0,Z.jsxs)(B,{value:l.authMode,onValueChange:e=>u({...l,authMode:e}),children:[(0,Z.jsx)(I,{size:`sm`,className:`w-56`,children:(0,Z.jsx)(U,{})}),(0,Z.jsxs)(V,{children:[(0,Z.jsx)(z,{value:`token`,children:y()}),(0,Z.jsx)(z,{value:`trusted-proxy`,children:f()})]})]}),(0,Z.jsx)(`p`,{className:`oc-field__hint`,children:l.authMode===`trusted-proxy`?ae():ue()})]}),l.authMode===`trusted-proxy`?(0,Z.jsx)($,{label:ne(),children:(0,Z.jsx)(W,{value:l.systemIdentity,placeholder:et(),onChange:e=>u({...l,systemIdentity:e.target.value})})}):null]}):null,(0,Z.jsx)($,{label:h(),children:(0,Z.jsx)(W,{value:l.gatewayHttpUrl,placeholder:Ce(),onChange:e=>u({...l,gatewayHttpUrl:e.target.value})})})]})}),(0,Z.jsx)(an,{instanceName:d,open:d!==null,onOpenChange:e=>{e||p(null)}}),m?(0,Z.jsx)(Ht,{instance:m,onClose:()=>g(null)},m._id):null,_?(0,Z.jsx)(Yt,{instance:_,onClose:()=>v(null)},_._id):null]})}function Yt({instance:e,onClose:t}){let n=O(N.instanceSecrets.listInstanceSecretStatus,{}),r=Kt[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)(J,{open:!0,onOpenChange:e=>!e&&t(),children:(0,Z.jsxs)(G,{onOpenAutoFocus:e=>e.preventDefault(),children:[(0,Z.jsxs)(H,{children:[(0,Z.jsx)(K,{children:_({instance:e.displayName??e.name})}),(0,Z.jsx)(q,{children:xe()})]}),(0,Z.jsx)(`div`,{className:`oc-form`,children:r.map(t=>(0,Z.jsx)(Qt,{instanceId:e._id,field:t,updatedAt:i[t]??null},t))}),(0,Z.jsx)(`div`,{className:`oc-bridgesecret`,children:(0,Z.jsx)(Zt,{instance:e})}),(0,Z.jsx)(Xt,{instance:e})]})})}function Xt({instance:e}){let t=j(N.instanceSync.forceInstanceSync),n=L(),[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(Dt());break;case`no_agents`:n.success(At());break;case`no_bridge_url`:n.error(Tt());break;case`deploy_misconfigured`:n.error(Me());break;case`unauthorized`:n.error(Ye());break;case`not_served`:n.error(ct());break;default:n.error(qe());break}}catch(e){n.error(Le(),e)}finally{i(!1)}}}return(0,Z.jsxs)(`div`,{className:`oc-form`,children:[(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:pt()}),(0,Z.jsx)(`div`,{className:`flex items-center gap-2`,children:(0,Z.jsx)(F,{size:`sm`,variant:`outline`,onClick:()=>void a(),disabled:r,children:r?_e():l()})})]})}function Zt({instance:e}){let t=O(N.bridgeAuth.listBridgeAuthStatus,{}),n=j(N.bridgeAuth.mintBridgeSecret),r=D(N.bridgeAuth.revokeBridgeSecret),i=L(),[a,o]=(0,Y.useState)(!1),[s,c]=(0,Y.useState)(null),[l,u]=(0,Y.useState)(!1),d=(t??[]).find(t=>t.instanceId===e._id),f=d!==void 0;async function p(){if(!a){o(!0);try{c((await n({instanceId:e._id})).plaintext),u(!1)}catch(e){i.error(A(),e)}finally{o(!1)}}}async function m(){if(!a){o(!0);try{await r({instanceId:e._id}),c(null),i.success(bt())}catch(e){i.error(A(),e)}finally{o(!1)}}}async function h(){if(s)try{await navigator.clipboard.writeText(s),u(!0)}catch{}}return(0,Z.jsxs)($,{label:Ge(),children:[(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:He()}),(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Z.jsx)(R,{variant:f?`outline`:`secondary`,children:f?`${T()} · ${d.prefix}…${d.lastFour}`:b()}),(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(F,{size:`sm`,onClick:()=>void p(),disabled:a,children:f?ot():Ct()}),f?(0,Z.jsx)(F,{size:`sm`,variant:`destructive`,onClick:()=>void m(),disabled:a,children:Be()}):null]})]}),s?(0,Z.jsxs)(`div`,{className:`oc-bridgesecret__reveal`,children:[(0,Z.jsx)(`p`,{className:`oc-sa__minted-warning`,children:Pe()}),(0,Z.jsxs)(`div`,{className:`oc-sa__minted-box`,children:[(0,Z.jsx)(`code`,{className:`oc-sa__minted-plain`,children:s}),(0,Z.jsx)(F,{variant:`outline`,size:`sm`,onClick:()=>void h(),children:l?Qe():M()})]}),(0,Z.jsx)(F,{size:`sm`,variant:`ghost`,onClick:()=>{c(null),u(!1)},children:Ze()})]}):null]})}function Qt({instanceId:e,field:t,updatedAt:n}){let r=j(N.instanceSecrets.setInstanceSecret),i=D(N.instanceSecrets.clearInstanceSecret),o=j(N.deviceIdentity.generateDeviceIdentity),c=L(),[l,f]=(0,Y.useState)(``),[m,h]=(0,Y.useState)(!1),[g,_]=(0,Y.useState)(null),[v,y]=(0,Y.useState)(!1),x=n!==null,S=t===`deviceIdentity`,C=t===`token`?s():t===`deviceIdentity`?jt():he();async function w(){if(!(!l.trim()||m)){h(!0);try{await r({instanceId:e,field:t,plaintext:l}),f(``),_(null),y(!1),c.success(tt())}catch(e){c.error(a(),e)}finally{h(!1)}}}async function ee(){if(!m){h(!0);try{await i({instanceId:e,field:t}),_(null),y(!1),c.success(rt())}catch(e){c.error(a(),e)}finally{h(!1)}}}async function te(){if(!m){h(!0);try{_(await o({instanceId:e})),y(!1),c.success(d())}catch(e){c.error(Et(),e)}finally{h(!1)}}}let E=g?`openclaw devices approve ${g.id}`:``;async function ne(){if(E)try{await navigator.clipboard.writeText(E),y(!0)}catch{}}return(0,Z.jsxs)($,{label:C,children:[S?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:u()}):null,(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Z.jsx)(R,{variant:x?`outline`:`secondary`,children:x?T():b()}),(0,Z.jsx)(W,{type:`password`,autoComplete:`off`,className:`flex-1 min-w-32`,value:l,placeholder:x?de():p(),onChange:e=>f(e.target.value)}),(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(F,{size:`sm`,onClick:()=>void w(),disabled:m||l.trim().length===0,children:oe()}),S?(0,Z.jsx)(F,{size:`sm`,variant:`outline`,onClick:()=>void te(),disabled:m,children:ce()}):null,x?(0,Z.jsx)(F,{size:`sm`,variant:`destructive`,onClick:()=>void ee(),disabled:m,children:re()}):null]})]}),g?(0,Z.jsxs)(`div`,{className:`oc-bridgesecret__reveal`,children:[(0,Z.jsx)(`p`,{className:`text-sm font-medium`,children:d()}),(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:ve()}),(0,Z.jsxs)(`div`,{className:`oc-sa__minted-box`,children:[(0,Z.jsx)(`code`,{className:`oc-sa__minted-plain`,children:E}),(0,Z.jsx)(F,{variant:`outline`,size:`sm`,onClick:()=>void ne(),children:v?Qe():M()})]}),(0,Z.jsx)(F,{size:`sm`,variant:`ghost`,onClick:()=>{_(null),y(!1)},children:Ze()})]}):null]})}var $t={conversational:ht,documentary:g,summarizer:dt,curator:$e},en={conversational:ee,documentary:we,summarizer:Fe,curator:vt},tn=e=>($t[e]??(()=>e))(),nn=e=>(en[e]??(()=>``))();function rn({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:Ae()}),t.map(e=>(0,Z.jsx)(R,{variant:`secondary`,className:`oc-agenttype__chip`,title:nn(e),children:tn(e)},e)),(0,Z.jsxs)(It,{children:[(0,Z.jsx)(Ft,{asChild:!0,children:(0,Z.jsx)(F,{type:`button`,variant:`outline`,size:`sm`,className:`h-7`,children:Ee()})}),(0,Z.jsxs)(Bt,{align:`start`,className:`oc-agenttypes-pop`,children:[(0,Z.jsx)(`p`,{className:`oc-agenttypes-pop__title`,children:Oe()}),(0,Z.jsx)(`p`,{className:`oc-agenttypes-pop__hint`,children:C()}),(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)(zt,{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:tn(r)}),(0,Z.jsx)(`span`,{className:`oc-agenttypes-pop__desc`,children:nn(r)})]})]},r)})})]})]})]})}function an({instanceName:e,open:t,onOpenChange:n}){let r=O(N.agents.listAgentsForInstance,t&&e?{instanceName:e}:`skip`),i=D(N.agents.setAgentEnabled).withOptimisticUpdate((e,{instanceName:t,agentId:n,enabled:r})=>{let i=e.getQuery(N.agents.listAgentsForInstance,{instanceName:t});i&&e.setQuery(N.agents.listAgentsForInstance,{instanceName:t},{...i,agents:i.agents.map(e=>e.agentId===n?{...e,enabled:r}:e)})}),a=D(N.agents.setInstanceDefaultAgent).withOptimisticUpdate((e,{instanceName:t,agentId:n})=>{let r=e.getQuery(N.agents.listAgentsForInstance,{instanceName:t});r&&e.setQuery(N.agents.listAgentsForInstance,{instanceName:t},{...r,defaultAgentId:n})}),o=D(N.agents.setAgentTypes).withOptimisticUpdate((e,{instanceName:t,agentId:n,types:r})=>{let i=e.getQuery(N.agents.listAgentsForInstance,{instanceName:t});if(!i)return;let a=Gt(r);e.setQuery(N.agents.listAgentsForInstance,{instanceName:t},{...i,agents:i.agents.map(e=>e.agentId===n?{...e,types:a}:e)})}),s=D(N.agents.setAgentDescription).withOptimisticUpdate((e,{instanceName:t,agentId:n,description:r})=>{let i=e.getQuery(N.agents.listAgentsForInstance,{instanceName:t});if(!i)return;let a=r.trim();e.setQuery(N.agents.listAgentsForInstance,{instanceName:t},{...i,agents:i.agents.map(e=>e.agentId===n?{...e,description:a.length===0?null:a}:e)})}),l=D(N.agents.removeInstanceAgent),u=Lt(),d=L();async function f(t,n){if(e)try{await i({instanceName:e,agentId:t,enabled:n})}catch(e){d.error(P(),e)}}async function p(t){if(e)try{await a({instanceName:e,agentId:t})}catch(e){d.error(P(),e)}}async function h(t,n,r){if(!e)return;let i=r.includes(n)?r.filter(e=>e!==n):[...r,n];try{await o({instanceName:e,agentId:t,types:i})}catch(e){d.error(P(),e)}}async function g(t,n){if(e&&await u({title:Se({name:n}),description:c(),confirmLabel:Mt(),destructive:!0}))try{await l({instanceName:e,agentId:t}),d.success(ge())}catch(e){d.error(P(),e)}}return(0,Z.jsx)(J,{open:t,onOpenChange:n,children:(0,Z.jsxs)(G,{className:`oc-access`,children:[(0,Z.jsxs)(H,{children:[(0,Z.jsx)(K,{children:_t({name:e??``})}),(0,Z.jsx)(q,{children:ut()})]}),r===void 0?(0,Z.jsx)(`p`,{className:`oc-access__hint`,children:E()}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`div`,{className:`oc-access__poll`,children:r.discovery===null?x():r.discovery.lastPollOk?m():fe({error:r.discovery.error??`?`})}),r.agents.length===0?(0,Z.jsx)(`p`,{className:`oc-access__hint`,children:se()}):(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)(zt,{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)(R,{variant:`outline`,className:`oc-access__gone`,children:nt()}),(0,Z.jsx)(F,{size:`sm`,variant:`ghost`,className:`h-7 text-destructive`,onClick:()=>void g(t.agentId,a),children:v()})]}):i?(0,Z.jsx)(R,{variant:`default`,children:ie()}):(0,Z.jsx)(F,{size:`sm`,variant:`outline`,className:`h-7`,disabled:!t.enabled,onClick:()=>void p(t.agentId),children:be()})]}),t.enabled?(0,Z.jsx)(rn,{agentId:t.agentId,types:o,onToggle:e=>void h(t.agentId,e,o)}):null,t.enabled?(0,Z.jsx)(on,{value:t.description??``,onSave:async n=>{if(e)try{await s({instanceName:e,agentId:t.agentId,description:n})}catch(e){d.error(P(),e)}}}):null]},t.agentId)})})]})]})})}function on({value:e,onSave:t}){let[n,r]=(0,Y.useState)(e);(0,Y.useEffect)(()=>{r(e)},[e]);let a=()=>{n.trim()!==e.trim()&&t(n)};return(0,Z.jsx)(W,{className:`oc-agentcard__desc`,value:n,maxLength:280,placeholder:i(),"aria-label":me(),onChange:e=>r(e.target.value),onBlur:a,onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),a())}})}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{Jt as InstancesTab};
@@ -0,0 +1 @@
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$O as r,Cl as i,Dl as a,El as o,QO as s,Sl as c,Tl as l,aB as u,ak as d,bl as f,ck as p,dk as m,ek as h,ik as g,lk as _,nk as v,oB as y,ok as b,rB as x,rk as S,sk as C,t as w,tk as T,uk as E,wl as D,xl as O,yl as k}from"./api-CCk5U5gB.js";import{t as A}from"./button-CbUSFbZL.js";import{Et as j,jt as M,ut as N}from"./index-DY7zoioz.js";var P=t(e(),1),F=n();function I(){let e=y(w.integrations.status.status,{}),t=u(w.admin.setIntegrationConfig),[n,i]=(0,P.useState)(null);if((0,P.useEffect)(()=>{e&&n===null&&i(e.config)},[e,n]),!e||!n)return(0,F.jsx)(`p`,{className:`oc-admin__hint`,children:m()});let c=n,f=(e,t,n)=>i({...c,[e]:{...c[e],[t]:n}}),x=(e,n)=>void t({[e]:n});return(0,F.jsxs)(F.Fragment,{children:[(0,F.jsxs)(`p`,{className:`oc-admin__hint`,children:[E(),` `,(0,F.jsx)(`strong`,{children:_()}),` `,p()]}),(0,F.jsxs)(L,{title:`Langfuse`,status:e.langfuse.configured?e.langfuse.enabled?(0,F.jsx)(j,{variant:`secondary`,children:C()}):(0,F.jsx)(j,{variant:`outline`,children:b()}):(0,F.jsx)(j,{variant:`outline`,children:d()}),note:g(),children:[(0,F.jsx)(R,{label:v(),children:(0,F.jsx)(M,{value:c.langfuse.host??``,placeholder:e.langfuse.effectiveHost,onChange:e=>f(`langfuse`,`host`,e.target.value),onBlur:()=>x(`langfuse`,{host:c.langfuse.host??``})})}),(0,F.jsx)(z,{label:s(),checked:c.langfuse.enabled??!0,onChange:e=>{f(`langfuse`,`enabled`,e),x(`langfuse`,{enabled:e})}})]}),(0,F.jsxs)(L,{title:`Opik`,status:e.opik.configured?e.opik.enabled?(0,F.jsx)(j,{variant:`secondary`,children:C()}):(0,F.jsx)(j,{variant:`outline`,children:b()}):(0,F.jsx)(j,{variant:`outline`,children:d()}),note:S(),children:[(0,F.jsx)(R,{label:T(),children:(0,F.jsx)(M,{value:c.opik.baseUrl??``,placeholder:e.opik.effectiveBaseUrl,onChange:e=>f(`opik`,`baseUrl`,e.target.value),onBlur:()=>x(`opik`,{baseUrl:c.opik.baseUrl??``})})}),(0,F.jsx)(R,{label:h(),children:(0,F.jsx)(M,{value:c.opik.workspace??``,placeholder:e.opik.effectiveWorkspace||r(),onChange:e=>f(`opik`,`workspace`,e.target.value),onBlur:()=>x(`opik`,{workspace:c.opik.workspace??``})})}),(0,F.jsx)(z,{label:s(),checked:c.opik.enabled??!0,onChange:e=>{f(`opik`,`enabled`,e),x(`opik`,{enabled:e})}})]}),(0,F.jsxs)(L,{title:`OpenTelemetry (OTLP)`,status:e.otlp.configured?e.otlp.enabled?(0,F.jsx)(j,{variant:`secondary`,children:C()}):(0,F.jsx)(j,{variant:`outline`,children:b()}):(0,F.jsx)(j,{variant:`outline`,children:a()}),note:o(),children:[(0,F.jsx)(R,{label:l(),children:(0,F.jsx)(M,{value:c.otlp.endpoint??``,placeholder:e.otlp.effectiveEndpoint||`https://otlp.example.com/v1/traces`,onChange:e=>f(`otlp`,`endpoint`,e.target.value),onBlur:()=>x(`otlp`,{endpoint:c.otlp.endpoint??``})})}),(0,F.jsx)(B,{headersSet:e.otlp.headersSet}),(0,F.jsx)(z,{label:s(),checked:c.otlp.enabled??!0,onChange:e=>{f(`otlp`,`enabled`,e),x(`otlp`,{enabled:e})}})]})]})}function L({title:e,status:t,note:n,children:r}){return(0,F.jsxs)(`section`,{className:`oc-int__section`,children:[(0,F.jsxs)(`div`,{className:`oc-int__section-head`,children:[(0,F.jsx)(`h3`,{className:`oc-uipa__h`,children:e}),t]}),n?(0,F.jsx)(`p`,{className:`oc-uipa__note`,children:n}):null,(0,F.jsx)(`div`,{className:`oc-int__fields`,children:r})]})}function R({label:e,children:t}){return(0,F.jsxs)(`label`,{className:`oc-int__field`,children:[(0,F.jsx)(`span`,{className:`oc-int__field-label`,children:e}),t]})}function z({label:e,checked:t,onChange:n}){return(0,F.jsxs)(`label`,{className:`oc-int__toggle`,children:[(0,F.jsx)(N,{checked:t,onCheckedChange:e=>n(e===!0)}),(0,F.jsx)(`span`,{children:e})]})}function B({headersSet:e}){let t=x(w.integrations.otlpSecret.setOtlpHeaders),n=u(w.integrations.otlpSecret.clearOtlpHeaders),[r,a]=(0,P.useState)(``),[o,s]=(0,P.useState)(null),[l,d]=(0,P.useState)(!1),p=async()=>{d(!0),s(null);try{await t({headersJson:r}),a(``)}catch(e){s(e instanceof Error?e.message:String(e))}finally{d(!1)}};return(0,F.jsxs)(R,{label:D(),children:[(0,F.jsx)(M,{value:r,placeholder:e?i():c(),onChange:e=>a(e.target.value)}),(0,F.jsxs)(`div`,{className:`oc-int__otlp-headers-actions`,children:[(0,F.jsx)(A,{size:`sm`,disabled:l||r.trim().length===0,onClick:()=>void p(),children:O()}),e?(0,F.jsx)(A,{variant:`ghost`,size:`sm`,disabled:l,onClick:()=>void n({}),children:f()}):null]}),o?(0,F.jsx)(`p`,{className:`oc-int__otlp-headers-error`,children:o}):null,(0,F.jsx)(`p`,{className:`oc-uipa__note`,children:k()})]})}export{I as IntegrationsTab};
@@ -0,0 +1 @@
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Ay as r,Dy as i,Ey as a,Fy as o,Gk as s,Iy as c,Jk as l,Kk as u,Lk as d,Ly as f,My as p,Ny as m,Oy as h,Py as g,Rk as _,Ry as ee,Ty as te,jy as ne,ky as v,oB as y,qk as b,t as x,wy as S,yA as C}from"./api-CCk5U5gB.js";import{Gn as w,Kn as T,i as E,o as re,q as ie,r as D}from"./index-DY7zoioz.js";import{a as O,n as k,o as A,r as j,t as M}from"./card-PW6qFB8Z.js";import{n as N,t as P}from"./TimeRangePicker-qNMV_Gj-.js";var F=t(e(),1),I={API_CALLS:`api.calls`,API_ERRORS:`api.errors`,API_LATENCY_AVG_MS:`api.latency.avg_ms`,OPENCLAW_INGEST:`openclaw.ingest`,CHAT_SEND:`chat.send`,ASSISTANT_STREAM_ERRORS:`assistant.stream.errors`,ASSISTANT_ANNOUNCE_ERRORS:`assistant.announce.errors`,CONVEX_PROBE_LATENCY_AVG_MS:`convex.probe.latency.avg_ms`},L=Object.keys(I).length,R=n(),z=15,B=e=>String(Math.round(e));function V(){let e=y(x.me.getMe,{host:ie})?.permissions?.includes(`traces.read`)??!1,t=y(x.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,z).reverse().map(e=>({startedAt:e.startedAt,cP50:e.rollup?.cP50,aP50:e.rollup?.aP50})):[],[t]);return t===void 0?null:(0,R.jsxs)(`section`,{className:`oc-kpi__group`,children:[(0,R.jsx)(`h2`,{className:`oc-kpi__group-title`,children:C()}),(0,R.jsxs)(M,{children:[(0,R.jsxs)(O,{children:[(0,R.jsx)(A,{children:l()}),(0,R.jsx)(j,{children:u()})]}),(0,R.jsx)(k,{children:n.length<2?(0,R.jsx)(`p`,{className:`oc-admin__hint`,children:s()}):(0,R.jsx)(H,{series:n})})]})]})}function H({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,R.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,R.jsxs)(`div`,{className:`flex gap-3 text-xs text-muted-foreground`,children:[(0,R.jsxs)(`span`,{style:{color:`var(--primary)`},children:[d(),` p50 `,B(s.cP50),` `,b()]}),(0,R.jsxs)(`span`,{children:[_(),` p50 `,B(s.aP50),` `,b()]})]}),(0,R.jsxs)(`svg`,{viewBox:`0 0 480 80`,className:`h-20 w-full`,preserveAspectRatio:`none`,role:`img`,"aria-label":l(),children:[(0,R.jsx)(`path`,{d:o(n),fill:`none`,style:{stroke:`var(--muted-foreground)`},strokeWidth:1.5}),(0,R.jsx)(`path`,{d:o(t),fill:`none`,style:{stroke:`var(--primary)`},strokeWidth:1.5})]})]})}var U=[{metric:`api.calls`,label:ee(),unit:`/h`,group:`API`,isError:!1},{metric:`api.errors`,label:f(),unit:`/h`,group:`API`,isError:!0},{metric:`api.latency.avg_ms`,label:c(),unit:`ms`,group:`API`,isError:!1},{metric:`openclaw.ingest`,label:o(),unit:`/h`,group:`OpenClaw`,isError:!1},{metric:`chat.send`,label:g(),unit:`/h`,group:`Chat`,isError:!1},{metric:I.ASSISTANT_STREAM_ERRORS,label:m(),unit:`/h`,group:`Assistant`,isError:!0},{metric:I.ASSISTANT_ANNOUNCE_ERRORS,label:p(),unit:`/h`,group:`Assistant`,isError:!0}],W=L,G=[`API`,`OpenClaw`,`Chat`,`Assistant`],K=1e3,q=36e5;function J(e,t){let n=Math.max(1,Math.ceil((t-e)/q)),r=Math.min(n*W,K);return{rowLimit:r,buckets:Math.max(1,Math.floor(r/W))}}function ae(){let e=T({from:`/settings/kpi`}),t=w({from:`/settings/kpi`}),n=E(e.from,e.to,D,`now`),i=e=>void t({search:t=>({...t,...re(e)})}),{from:a,to:o}=N(n),{rowLimit:s,buckets:c}=J(a,o),l=y(x.kpi.listKpis,{limit:s,filter:{from:a,to:o}}),u=(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]),d=(0,R.jsxs)(R.Fragment,{children:[(0,R.jsxs)(`p`,{className:`oc-admin__hint`,children:[ne(),` `,(0,R.jsx)(`span`,{className:`oc-filter__window`,children:r()})]}),(0,R.jsx)(Y,{value:n,onChange:i})]});return l===void 0?(0,R.jsxs)(R.Fragment,{children:[d,(0,R.jsx)(V,{}),(0,R.jsx)(`p`,{className:`oc-admin__hint`,children:v()})]}):l.length===0?(0,R.jsxs)(R.Fragment,{children:[d,(0,R.jsx)(V,{}),(0,R.jsx)(`p`,{className:`oc-admin__hint`,children:h()})]}):(0,R.jsxs)(R.Fragment,{children:[d,(0,R.jsx)(V,{}),G.map(e=>{let t=U.filter(t=>t.group===e);return t.some(e=>(u.get(e.metric)??[]).length>0)?(0,R.jsxs)(`section`,{className:`oc-kpi__group`,children:[(0,R.jsx)(`h2`,{className:`oc-kpi__group-title`,children:e}),(0,R.jsx)(`div`,{className:`oc-kpi__grid`,children:t.map(e=>(0,R.jsx)(oe,{config:e,series:u.get(e.metric)??[]},e.metric))})]},e):null})]})}function Y({value:e,onChange:t}){return(0,R.jsx)(`div`,{className:`oc-kpi__toolbar`,children:(0,R.jsx)(P,{value:e,onChange:t})})}function oe({config:e,series:t}){let n=t.length>0?t[t.length-1]:null,r=n?n.value:0;return(0,R.jsxs)(M,{size:`sm`,className:`oc-kpi__card`,children:[(0,R.jsxs)(O,{children:[(0,R.jsx)(A,{className:`oc-kpi__card-title`,children:e.label}),(0,R.jsx)(j,{className:`oc-kpi__card-metric`,children:(0,R.jsx)(`code`,{children:e.metric})})]}),(0,R.jsxs)(k,{className:`oc-kpi__card-body`,children:[(0,R.jsxs)(`div`,{className:`oc-kpi__value-row`,children:[(0,R.jsx)(`span`,{className:`oc-kpi__value`+(e.isError&&r>0?` oc-kpi__value--error`:``),children:Q(r)}),(0,R.jsx)(`span`,{className:`oc-kpi__unit`,children:e.unit})]}),(0,R.jsx)(ce,{series:t,isError:e.isError,unit:e.unit}),(0,R.jsxs)(`div`,{className:`oc-kpi__axis`,children:[n?(0,R.jsx)(`span`,{className:`oc-kpi__axis-latest`,children:i({value:$(n.bucket)})}):(0,R.jsx)(`span`,{className:`oc-kpi__muted`,children:a()}),(0,R.jsx)(`span`,{className:`oc-kpi__muted`,children:te({count:t.length})})]})]})]})}var X=240,Z=48,se=1;function ce({series:e,isError:t,unit:n}){if(e.length===0)return(0,R.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-se,1);return(0,R.jsx)(`svg`,{className:`oc-kpi__chart`,viewBox:`0 0 ${X} ${Z}`,preserveAspectRatio:`none`,role:`img`,"aria-label":S({max:Q(r),unit:n}),children:e.map((e,o)=>{let s=r>0?e.value/r*(Z-1):0,c=o*i,l=Z-s;return(0,R.jsx)(`rect`,{className:`oc-kpi__bar`+(t&&e.value>0?` oc-kpi__bar--error`:``),x:c,y:l,width:a,height:s,children:(0,R.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{ae as KpiTab};
@@ -0,0 +1 @@
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$P as r,AP as i,An as a,Az as o,BP as s,Bz as c,CP as l,Cz as u,DP as d,Dn as f,Dz as p,EP as m,Ez as ee,FP as te,Fz as ne,GP as re,HP as ie,Hn as ae,Hz as oe,IP as se,Iz as ce,JP as le,Jn as ue,KP as de,Kz as fe,LP as pe,Lz as me,MP as he,Mn as ge,Mz as _e,NP as ve,Nn as h,Nz as g,OP as _,On as v,Oz as y,PP as b,Pn as x,Pz as S,QP as C,RP as w,Rz as T,SP as E,Sz as D,TP as O,Tz as k,UP as A,Uz as j,VP as M,Vz as N,WP as P,XP as F,YP as ye,ZP as be,Zz as xe,_P as Se,aB as I,bP as Ce,bz as we,eD as Te,eF as Ee,gP as De,jP as Oe,jn as ke,jz as Ae,kP as L,kn as je,kz as Me,oB as R,qP as Ne,qn as Pe,r as z,t as B,tF as Fe,vP as Ie,wP as Le,wz as Re,xP as ze,xz as Be,yP as Ve,zP as He,zz as Ue}from"./api-CCk5U5gB.js";import{t as V}from"./button-CbUSFbZL.js";import{$ as We,At as Ge,Dt as Ke,Et as H,Ot as qe,Q as U,V as Je,X as Ye,Z as Xe,et as Ze,jt as W,kt as Qe,q as G,t as $e,ut as K}from"./index-DY7zoioz.js";import{t as et}from"./localePickerView-C2RmOS86.js";import{t as tt}from"./TimezoneCombobox-D2e6UjGY.js";var q=t(e(),1),J=n();function nt({className:e,checked:t,onCheckedChange:n,disabled:r,...i}){return(0,J.jsx)(`button`,{type:`button`,role:`switch`,"aria-checked":t,"data-state":t?`checked`:`unchecked`,disabled:r,onClick:()=>n(!t),className:z(`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:z(`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:()=>Fe()},{id:`composer`,label:()=>Ee()},{id:`sidebar`,label:()=>r()},{id:`notifications`,label:()=>se()},{id:`other`,label:()=>C()}],X={showSource:{category:`messages`,label:()=>be(),help:()=>F()},showReport:{category:`messages`,label:()=>ye(),help:()=>le()},copyAssistant:{category:`messages`,label:()=>Ne()},copyUser:{category:`messages`,label:()=>de()},showDelete:{category:`messages`,label:()=>re()},showTools:{category:`messages`,label:()=>P(),help:()=>A()},voiceInput:{category:`composer`,label:()=>ie(),help:()=>M()},showUsage:{category:`composer`,label:()=>s(),help:()=>He()},autoReadAloud:{category:`composer`,label:()=>ue(),help:()=>Pe()},showChatAge:{category:`sidebar`,label:()=>w(),help:()=>pe()},notifSound:{category:`notifications`,label:()=>te(),help:()=>b()},notifSystem:{category:`notifications`,label:()=>ve(),help:()=>he()},replySound:{category:`notifications`,label:()=>Oe(),help:()=>i()}};function Z(e){return e.toLowerCase().normalize(`NFD`).replace(/\p{Diacritic}/gu,``)}function Q(e,t){let n=Z(t.trim()),r=new Map(Y.map(e=>[e.id,e.label()])),i=new Map(Y.map(e=>[e.id,[]]));for(let t of e){let e=X[t],a=e?.category??`other`;n&&!Z(`${e?e.label():t} ${e?.help?e.help():``} ${t} ${r.get(a)??``}`).includes(n)||i.get(a).push(t)}return Y.map(e=>({id:e.id,label:r.get(e.id),keys:i.get(e.id)})).filter(e=>e.keys.length>0)}var rt=[`showSource`,`showReport`,`copyAssistant`,`copyUser`,`showDelete`,`showTools`,`voiceInput`,`showChatAge`,`showUsage`,`autoReadAloud`,`notifSound`,`notifSystem`,`replySound`],it={voiceInput:`voiceInput`};function at(e){return rt.includes(e)}function $(e){return e===`admin`}function ot(e){return e===!0?`on`:e===!1?`off`:`inherit`}function st(e){return e===`on`?!0:e===`off`?!1:null}function ct(e){return at(e)?it[e]:void 0}var lt={voiceInput:()=>Ce()};function ut({prefKey:e,ui:t}){let n=I(B.admin.setUiPrefDefault),r=I(B.admin.setFeatureEnabled),i=ct(e),a=i?lt[e]?.():void 0;return(0,J.jsxs)(`div`,{className:`oc-prefs__gov`,children:[(0,J.jsxs)(`div`,{className:`oc-prefs__gov-row`,children:[(0,J.jsx)(`span`,{className:`oc-prefs__gov-label`,children:Le()}),(0,J.jsxs)(Ye,{value:ot(t.defaults[e]),onValueChange:t=>void n({key:e,value:st(t)}),children:[(0,J.jsx)(We,{size:`sm`,className:`w-36`,children:(0,J.jsx)(Ze,{})}),(0,J.jsxs)(Xe,{children:[(0,J.jsx)(U,{value:`on`,children:Ie()}),(0,J.jsx)(U,{value:`off`,children:Se()}),(0,J.jsx)(U,{value:`inherit`,children:De()})]})]}),i?(0,J.jsxs)(`span`,{className:`oc-prefs__gov-gate`,children:[(0,J.jsx)(K,{checked:t.featuresEnabled[i]===!0,onCheckedChange:e=>void r({key:i,enabled:e===!0}),"aria-label":l()}),l()]}):null]}),a?(0,J.jsx)(`span`,{className:`oc-prefs__gov-help`,children:a}):null]})}function dt({current:e,enabled:t}){let n=I(B.me.setDictationShortcut),[r,i]=(0,q.useState)(!1),[o,s]=(0,q.useState)(!1);return(0,q.useEffect)(()=>{if(!r)return;let e=e=>{if(e.preventDefault(),e.stopPropagation(),e.key===`Escape`){i(!1);return}let t=Qe(e);if(t===null){[`Shift`,`Control`,`Meta`,`Alt`].includes(e.key)||(s(!0),window.setTimeout(()=>s(!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:[x(),e?(0,J.jsx)(H,{variant:`secondary`,children:Ge(e,qe())}):null]}),(0,J.jsx)(`span`,{className:`oc-prefs__help`,children:o?ke():r?ge():h()})]}),(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:f()}):null,(0,J.jsx)(`button`,{type:`button`,className:`oc-prefs__reset`,disabled:!t,"aria-pressed":r,onClick:()=>i(e=>!e),children:r?v():e?je():a()})]})]})}function ft(){let[e,t]=(0,q.useState)(``),[n,r]=(0,q.useState)(!1),i=R(B.me.getMe,{host:G}),a=i?.ui,o=$(i?.role)&&n,s=I(B.me.setUiPref).withOptimisticUpdate(Je),c=(0,q.useMemo)(()=>a?Q(Object.keys(a.effective),e):[],[a,e]);return a?(0,J.jsxs)(`div`,{className:`oc-prefs-panel`,children:[$(i?.role)?(0,J.jsxs)(`label`,{className:`oc-prefs__gov-toggle`,children:[(0,J.jsx)(K,{checked:n,onCheckedChange:e=>r(e===!0),"aria-label":O()}),O()]}):null,o?(0,J.jsxs)(`div`,{className:`oc-prefs__gov-head`,children:[(0,J.jsx)(`p`,{children:E()}),(0,J.jsx)(`p`,{children:ze()}),(0,J.jsx)(`p`,{children:Ve()})]}):null,(0,J.jsx)(W,{value:e,onChange:e=>t(e.target.value),placeholder:L(),"aria-label":L(),className:`mb-2`}),c.length===0?(0,J.jsx)(`div`,{className:`oc-prefs__empty`,children:_()}):(0,J.jsx)(`div`,{className:`oc-prefs`,children:c.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],c=a.effective[e],l=a.userOverrides[e]!==void 0;return(0,J.jsxs)(`div`,{className:`oc-prefs__row${i?` is-locked`:``}`,children:[(0,J.jsxs)(`div`,{className:`oc-prefs__info`,children:[(0,J.jsxs)(`span`,{className:`oc-prefs__label`,children:[n,i?(0,J.jsx)(H,{variant:`outline`,children:d()}):l?(0,J.jsx)(H,{variant:`secondary`,children:ae()}):null]}),r?(0,J.jsx)(`span`,{className:`oc-prefs__help`,children:r}):null]}),(0,J.jsxs)(`div`,{className:`oc-prefs__ctl`,children:[!i&&l?(0,J.jsx)(`button`,{type:`button`,className:`oc-prefs__reset`,onClick:()=>void s({key:e,value:null}),children:m()}):null,(0,J.jsx)(nt,{checked:c,disabled:i,onCheckedChange:t=>{e===`notifSystem`&&t&&typeof Notification<`u`&&Notification.permission==="default"&&Notification.requestPermission(),s({key:e,value:t})},"aria-label":n})]}),o?(0,J.jsx)(ut,{prefKey:e,ui:a}):null]},e)})]},e.id))}),(0,J.jsx)(dt,{current:i?.dictationShortcut??null,enabled:a.effective.voiceInput===!0})]}):(0,J.jsx)(`div`,{className:`oc-prefs__empty`,children:xe()})}var pt={sm:()=>Ae(),md:()=>o(),lg:()=>Me(),xl:()=>y(),"2xl":()=>p(),"3xl":()=>ee()};function mt(){let e=R(B.me.getMe,{host:G}),t=I(B.me.setLocale),n=I(B.me.setTimezone),r=I(B.me.setFontScale).withOptimisticUpdate((e,{scale:t})=>{let n=e.getQuery(B.me.getMe,{host:G});n&&e.setQuery(B.me.getMe,{host:G},{...n,fontScale:t,resolvedFontScale:t??`md`})}),i=I(B.me.setMyName),a=Ke(),o=e?.locale??`default`,s=e?.name??``,[l,d]=(0,q.useState)(null),f=l??s,p=f.trim()!==s.trim();async function m(){try{await i({name:f}),d(null),a.success(Ue())}catch(e){a.error(T(),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:j()}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:oe()})]}),(0,J.jsxs)(`div`,{className:`oc-show__row`,children:[(0,J.jsx)(W,{className:`max-w-xs`,value:f,maxLength:120,placeholder:N(),onChange:e=>d(e.target.value),onKeyDown:e=>{e.key===`Enter`&&p&&(e.preventDefault(),m())}}),(0,J.jsx)(V,{size:`sm`,disabled:!p,onClick:()=>void m(),children:Te()})]}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:c()})]}),(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:me()}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:ce()})]}),(0,J.jsxs)(`div`,{className:`oc-show__row`,children:[et().map(e=>(0,J.jsx)(V,{variant:o===e.value?`default`:`outline`,size:`sm`,onClick:()=>void t({locale:e.value}),children:e.label},e.value)),(0,J.jsx)(V,{variant:o==="default"?`default`:`outline`,size:`sm`,onClick:()=>void t({locale:null}),children:fe()})]}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:ne()})]}),(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:k()}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:Re()})]}),(0,J.jsxs)(`div`,{className:`oc-show__row`,children:[(0,J.jsx)(tt,{value:e?.timezone??``,onChange:e=>void n({timezone:e})}),(0,J.jsx)(V,{variant:e?.timezone===null||e?.timezone===void 0?`default`:`outline`,size:`sm`,onClick:()=>void n({timezone:null}),children:u()})]}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:D()})]}),(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:S()}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:g()})]}),(0,J.jsx)(`div`,{className:`oc-show__row`,children:$e.map(t=>(0,J.jsx)(V,{variant:(e?.fontScale??`md`)===t?`default`:`outline`,size:`sm`,onClick:()=>void r({scale:t}),children:pt[t]()},t))}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:_e()})]}),(0,J.jsxs)(`section`,{className:`oc-show__section`,children:[(0,J.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,J.jsx)(`h2`,{className:`oc-show__title`,children:Be()}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:we()})]}),(0,J.jsx)(ft,{})]})]})}export{mt as PreferencesTab};
@@ -0,0 +1 @@
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$_ as r,Av as i,Bv as a,Cv as o,D as s,Dv as c,Ev as l,Gv as u,Hv as d,Iv as f,Jv as p,Kv as m,Lv as h,Mv as g,Nv as _,Ov as ee,Pv as v,Qv as te,Rv as y,Sv as b,Tv as ne,Uv as re,Wv as ie,Z_ as ae,Zv as oe,Zz as x,aB as S,av as se,ay as ce,bv as le,cv as ue,ev as de,ey as C,fg as fe,gv as pe,hv as me,iv as w,jv as T,kv as he,lv as ge,mv as E,nt as _e,nv as D,oB as O,oy as ve,pv as ye,rv as k,sv as A,sy as be,t as j,tt as xe,tv as Se,ty as Ce,vv as we,wv as Te,xv as M,yv as Ee,zv as N}from"./api-CCk5U5gB.js";import{t as De}from"./list-wMpxVo2w.js";import{t as P}from"./button-CbUSFbZL.js";import{A as Oe,An as ke,Bn as Ae,C as je,D as F,Dt as Me,E as Ne,Ft as Pe,Gn as I,Hn as Fe,It as Ie,J as Le,Kn as Re,Lt as ze,Mn as Be,Mt as Ve,Nn as He,Nt as Ue,O as L,P as We,Pn as Ge,Pt as R,S as Ke,Sn as qe,T as Je,Tn as Ye,U as Xe,W as Ze,Y as Qe,_ as $e,b as z,bn as et,d as tt,dn as nt,f as rt,g as B,h as V,j as H,jn as U,jt as W,k as it,kn as G,m as at,p as ot,qn as st,v as K,vn as ct,w as lt,wn as ut,x as q,y as dt,yn as J}from"./index-DY7zoioz.js";var ft=s(`columns-3`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M9 3v18`,key:`fh3hqa`}],[`path`,{d:`M15 3v18`,key:`14nvp0`}]]),pt=s(`folder-input`,[[`path`,{d:`M2 9V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2v-1`,key:`fm4g5t`}],[`path`,{d:`M2 13h10`,key:`pgb2dq`}],[`path`,{d:`m9 16 3-3-3-3`,key:`6m91ic`}]]),mt=s(`layout-grid`,[[`rect`,{width:`7`,height:`7`,x:`3`,y:`3`,rx:`1`,key:`1g98yp`}],[`rect`,{width:`7`,height:`7`,x:`14`,y:`3`,rx:`1`,key:`6d4xhi`}],[`rect`,{width:`7`,height:`7`,x:`14`,y:`14`,rx:`1`,key:`nxv5o0`}],[`rect`,{width:`7`,height:`7`,x:`3`,y:`14`,rx:`1`,key:`1bb6yr`}]]),Y=s(`panel-left`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M9 3v18`,key:`fh3hqa`}]]),X=t(e(),1),Z=n();function ht({className:e}){return(0,Z.jsx)(ze,{asChild:!0,children:(0,Z.jsx)(P,{variant:`ghost`,size:`icon-xs`,"aria-label":se(),className:e,onClick:e=>e.stopPropagation(),onMouseDown:e=>e.stopPropagation(),onTouchStart:e=>e.stopPropagation(),onPointerDown:e=>e.stopPropagation(),children:(0,Z.jsx)(Ge,{})})})}function Q({folderId:e,name:t,color:n,currentParentId:r,className:i,onOpen:a}){let o=S(j.projects.renameProject),s=S(j.projects.setProjectColor),c=S(j.projects.moveProject),l=S(j.projects.deleteProject),f=S(j.projects.createProject),p=Xe(),h=Ze(),[g,ee]=(0,X.useState)(!1),[v,te]=(0,X.useState)(t),[y,b]=(0,X.useState)(!1),[ne,ae]=(0,X.useState)(!1),x=O(j.projects.projectTreeCount,ne?{projectId:e}:`skip`);return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(Ve,{onOpenChange:e=>e&&ae(!0),children:[(0,Z.jsx)(ht,{className:i}),(0,Z.jsxs)(Ue,{align:`end`,className:`w-48`,onClick:e=>e.stopPropagation(),children:[(0,Z.jsxs)(R,{onSelect:()=>a(),children:[(0,Z.jsx)(U,{}),` `,d()]}),(0,Z.jsxs)(R,{onSelect:()=>{te(t),ee(!0)},children:[(0,Z.jsx)(et,{}),` `,w()]}),(0,Z.jsxs)(R,{onSelect:()=>{requestAnimationFrame(async()=>{let t=await h({title:_(),label:be(),placeholder:ve(),confirmLabel:ce()});t&&await f({name:t,parentId:e})})},children:[(0,Z.jsx)(ke,{}),` `,_()]}),(0,Z.jsxs)(R,{onSelect:()=>b(!0),children:[(0,Z.jsx)(pt,{}),` `,me()]}),(0,Z.jsx)(Pe,{children:Se()}),(0,Z.jsxs)(`div`,{className:`oc-colorgrid`,onClick:e=>e.stopPropagation(),children:[(0,Z.jsx)(`button`,{className:`oc-colorgrid__none`,onClick:()=>void s({projectId:e,color:null}),"aria-label":de(),children:`✕`}),at.map(t=>(0,Z.jsx)(`button`,{className:`oc-colorgrid__dot`+(n===t.value?` is-selected`:``),style:{background:t.hue},"aria-label":t.value,onClick:()=>void s({projectId:e,color:t.value})},t.value))]}),(0,Z.jsx)(Ie,{}),(0,Z.jsxs)(R,{variant:`destructive`,onSelect:()=>{requestAnimationFrame(async()=>{let n=x?.folders??0,r=x?.chats??0;await p({title:u({name:t}),description:n>0?re({folders:n,chats:r}):r>0?ie({count:r}):ue(),confirmWord:A(),confirmLabel:m(),destructive:!0})&&await l({projectId:e})})},children:[(0,Z.jsx)(nt,{}),` `,A()]})]})]}),(0,Z.jsx)($e,{open:g,onOpenChange:ee,title:oe(),canSubmit:v.trim().length>0,onSubmit:async()=>{await o({projectId:e,name:v.trim()}),ee(!1)},submitLabel:w(),children:(0,Z.jsx)(W,{value:v,onChange:e=>te(e.target.value),autoFocus:!0})}),y?(0,Z.jsx)(ot,{open:y,onOpenChange:b,title:ye(),movingFolderId:e,currentId:r,onPick:t=>void c({projectId:e,parentId:t})}):null]})}function gt({chat:e,currentFolderId:t,className:n}){let i=S(j.chats.pinChat),o=S(j.chats.deleteChat),s=S(j.chats.renameChat),c=S(j.chats.setChatSidebar),l=S(j.chats.moveChatToProject),u=Xe(),[d,f]=(0,X.useState)(!1),[p,m]=(0,X.useState)(e.title??``),[h,g]=(0,X.useState)(!1);return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(Ve,{children:[(0,Z.jsx)(ht,{className:n}),(0,Z.jsxs)(Ue,{align:`end`,className:`w-52`,onClick:e=>e.stopPropagation(),children:[(0,Z.jsxs)(R,{onSelect:()=>{m(e.title??``),f(!0)},children:[(0,Z.jsx)(et,{}),` `,w()]}),(0,Z.jsxs)(R,{onSelect:()=>void i({chatId:e._id,pinned:!e.pinned}),children:[e.pinned?(0,Z.jsx)(ct,{}):(0,Z.jsx)(J,{}),e.pinned?k():D()]}),(0,Z.jsxs)(R,{onSelect:()=>g(!0),children:[(0,Z.jsx)(pt,{}),` `,pe()]}),e.pinned&&e.inSidebar?null:(0,Z.jsxs)(R,{onSelect:()=>void c({chatId:e._id,hidden:e.inSidebar}),children:[e.inSidebar?(0,Z.jsx)(qe,{}):(0,Z.jsx)(Y,{}),e.inSidebar?N():a()]}),(0,Z.jsx)(Ie,{}),(0,Z.jsxs)(R,{variant:`destructive`,onSelect:()=>{requestAnimationFrame(async()=>{await u({title:r(),description:ue(),confirmLabel:A(),destructive:!0})&&await o({chatId:e._id})})},children:[(0,Z.jsx)(nt,{}),` `,A()]})]})]}),(0,Z.jsx)($e,{open:d,onOpenChange:f,title:ae(),canSubmit:p.trim().length>0,onSubmit:async()=>{await s({chatId:e._id,title:p.trim()}),f(!1)},submitLabel:w(),children:(0,Z.jsx)(W,{value:p,onChange:e=>m(e.target.value),autoFocus:!0})}),h?(0,Z.jsx)(ot,{open:h,onOpenChange:g,title:E(),currentId:t,onPick:t=>void l({chatId:e._id,projectId:t})}):null]})}function _t(e,t){let n=t.trim().toLowerCase();return n===``?e:e.filter(e=>(e.title??``).toLowerCase().includes(n))}function vt(e,t,n,r,i){let a=e.map(t),o=a.indexOf(i);if(o<0)return null;let s=a.indexOf(r);if(s>=0){let t=[...e],[r]=t.splice(s,1);t.splice(o,0,r);let i=t[o-1],a=t[o+1];return{prevKey:i===void 0?null:n(i),nextKey:a===void 0?null:n(a)}}let c=e[o-1];return{prevKey:c===void 0?null:n(c),nextKey:n(e[o])}}function yt(e,t){let n=new Map(t.map(e=>[e.chatId,e.lastSeenAt])),r=new Set;for(let t of e){let e=n.get(t._id);e!==void 0&&t.lastAssistantAt!==null&&t.lastAssistantAt>e&&r.add(t._id)}return r}var bt=`oc.projpage.view`;function xt(){let e=localStorage.getItem(bt);return e===`cards`||e===`list`?e:`columns`}var $=e=>`into:${e}`,St=e=>`col:${e??`null`}`,Ct=e=>`crumb:${e}`;function wt(e){if(e.startsWith(`into:`))return e.slice(5);if(e.startsWith(`crumb:`))return e.slice(6);if(e.startsWith(`col:`)){let t=e.slice(4);return t===`null`?null:t}}function Tt(){let{projectId:e}=st({from:`/project/$projectId`}),t=I(),n=O(j.projects.projectPage,{projectId:e});return(0,Z.jsx)(`div`,{className:`oc-projpage`,children:n===void 0?(0,Z.jsx)(`p`,{className:`oc-projpage__hint`,children:x()}):n===null?(0,Z.jsxs)(`div`,{className:`oc-projpage__notfound`,children:[(0,Z.jsx)(`h2`,{children:M()}),(0,Z.jsx)(`p`,{className:`oc-projpage__hint`,children:le()}),(0,Z.jsx)(P,{variant:`outline`,onClick:()=>void t({to:`/`}),children:Ee()})]}):(0,Z.jsx)(Et,{page:n})})}function Et({page:e}){let t=I(),n=Xe(),r=Ze(),a=Me(),s=S(j.projects.renameProject),c=S(j.projects.setProjectColor),l=S(j.projects.deleteProject),d=S(j.projects.createProject),p=S(j.projects.moveProject),g=S(j.projects.setProjectSidebar),ae=S(j.chats.moveChatToProject),x=S(j.chats.reorderChat),se=S(j.projects.reorderProject),le=O(j.projects.projectTreeCount,{projectId:e.project._id}),[C,pe]=(0,X.useState)(xt),T=e=>{localStorage.setItem(bt,e),pe(e)},E=O(j.projects.folderColumns,C===`columns`?{projectId:e.project._id}:`skip`),D=O(j.projects.projectTreeList,C===`list`?{projectId:e.project._id}:`skip`),{c:k}=Re({from:`/project/$projectId`}),M=O(j.projects.listProjects,{}),Ee=O(j.chatReads.myBusyChats,{}),N=(0,X.useMemo)(()=>new Set(Ee??[]),[Ee]),Ae=O(j.chatReads.myChatReads,{}),Fe=(0,X.useMemo)(()=>yt(e.chats,Ae??[]),[e.chats,Ae]),{startNewChat:L,picker:qe}=tt(e=>void t({to:`/chat/$chatId`,params:{chatId:e}})),[z,rt]=(0,X.useState)(``),[V,H]=(0,X.useState)(!1),[U,st]=(0,X.useState)(e.project.name),[ct,J]=(0,X.useState)(!1),[Y,ht]=(0,X.useState)(``);(0,X.useEffect)(()=>{let e=setTimeout(()=>ht(z.trim()),180);return()=>clearTimeout(e)},[z]);let Q=O(j.search.searchConversations,Y.length>=2?{query:Y,projectId:e.project._id}:`skip`),gt=Oe(it(lt,{activationConstraint:{distance:4}}),it(Je,{activationConstraint:{delay:250,tolerance:8}})),$=(0,X.useRef)(!1),St=()=>{$.current=!0,setTimeout(()=>{$.current=!1},0)},[Ct,Tt]=(0,X.useState)(null),Et=t=>{if(t.startsWith(`chat:`)){let n=t.slice(5),r=e.chats.find(e=>e._id===n),i=E?.columns.flatMap(e=>e.chats).find(e=>e._id===n);return{kind:`chat`,label:(r??i)?.title||Ce()}}if(t.startsWith(`folder:`)){let e=t.slice(7);return{kind:`folder`,label:(M??[]).find(t=>t._id===e)?.name??``}}return null},kt=e=>Tt(Et(String(e.active.id))),jt=(0,X.useCallback)(e=>{let t=String(e.active.id).startsWith(`folder:`),n=t=>({...e,droppableContainers:e.droppableContainers.filter(e=>String(e.id).startsWith(t))}),r=F(n(`into:`));if(r.length>0){if(!t)return r;let n=r[0],i=e.droppableRects.get(n.id),a=e.pointerCoordinates?.y;if(i&&a!=null){let e=i.height*.3;if(a>i.top+e&&a<i.top+i.height-e)return r}}let i=F(n(t?`folder:`:`chat:`));if(i.length>0)return i;let a=F(n(`crumb:`));if(a.length>0)return a;let o=F(n(`col:`));return o.length>0?o:Ne(n(t?`folder:`:`chat:`))},[]),Nt=t=>{if(C===`columns`){for(let e of E?.columns??[])if(e.chats.some(e=>e._id===t))return{list:e.chats,folderId:e.folderId};return null}if(C===`list`){let e=D?.chats.find(e=>e._id===t);return e?{list:D.chats.filter(t=>t.folderId===e.folderId),folderId:e.folderId}:null}return e.chats.some(e=>e._id===t)?{list:e.chats,folderId:e.project._id}:null},Pt=t=>{if(C===`columns`){for(let e of E?.columns??[])if(e.folders.some(e=>e._id===t))return{list:e.folders,parentId:e.folderId};return null}if(C===`list`){let e=D?.folders.find(e=>e._id===t);if(!e||!D)return null;let n=e.parentId??D.rootId;return{list:Qe(D.folders,e.parentId),parentId:n}}return e.children.some(e=>e._id===t)?{list:e.children,parentId:e.project._id}:null},It=async e=>{Tt(null),St();let{active:t,over:n}=e;if(!n)return;let r=String(n.id),i=String(t.id),o=i.startsWith(`chat:`);try{let e=wt(r);if(e!==void 0){if(o)await ae({chatId:i.slice(5),projectId:e});else{let t=i.slice(7);if(t===e)return;if(!Le(M??[],t,e)){a.error(v());return}await p({projectId:t,parentId:e})}return}if(o&&r.startsWith(`chat:`)){let e=i.slice(5),t=r.slice(5);if(e===t)return;let n=Nt(t);if(!n)return;n.list.some(t=>t._id===e)||await ae({chatId:e,projectId:n.folderId});let a=vt(n.list,e=>e._id,e=>e.sortKey,e,t);a&&await x({chatId:e,...a});return}if(!o&&r.startsWith(`folder:`)){let e=i.slice(7),t=r.slice(7);if(e===t)return;let n=Pt(t);if(!n)return;if(!n.list.some(t=>t._id===e)){if(!Le(M??[],e,n.parentId)){a.error(v());return}await p({projectId:e,parentId:n.parentId})}let o=vt(n.list,e=>e._id,e=>e.sortKey,e,t);o&&await se({projectId:e,...o});return}}catch{a.error(v())}},[,Lt]=(0,X.useState)(0);(0,X.useEffect)(()=>{let e=window.setInterval(()=>Lt(e=>e+1),6e4);return()=>window.clearInterval(e)},[]);let Rt=Date.now(),zt=B(e.project),Bt=_t(e.chats,z),Vt=e.breadcrumb.slice(0,-1),Ht=e=>()=>{$.current||e()};return(0,Z.jsxs)(Ke,{sensors:gt,collisionDetection:jt,onDragStart:kt,onDragEnd:It,children:[(0,Z.jsxs)(`div`,{className:`oc-projpage__body`,style:{"--proj-hue":zt},children:[(0,Z.jsxs)(`nav`,{className:`oc-projpage__crumbs`,"aria-label":we(),children:[Vt.map(e=>(0,Z.jsxs)(`span`,{className:`oc-projpage__crumb`,children:[(0,Z.jsx)(Dt,{folderId:e._id,children:(0,Z.jsx)(`button`,{type:`button`,className:`oc-projpage__crumblink`,onClick:Ht(()=>void t({to:`/project/$projectId`,params:{projectId:e._id}})),children:e.name})}),(0,Z.jsx)(`span`,{className:`oc-projpage__crumbsep`,"aria-hidden":!0,children:`›`})]},e._id)),(0,Z.jsx)(`span`,{className:`oc-projpage__crumbcur`,children:e.project.name})]}),(0,Z.jsxs)(`header`,{className:`oc-projpage__head`,children:[(0,Z.jsx)(`span`,{className:`oc-projpage__dot`,"aria-hidden":!0}),(0,Z.jsx)(`h1`,{className:`oc-projpage__title`,children:e.project.name}),e.project.sidebarHidden?(0,Z.jsxs)(P,{variant:`ghost`,size:`sm`,className:`oc-projpage__hiddenbadge`,title:_e(),onClick:()=>{g({projectId:e.project._id,hidden:!1})},children:[(0,Z.jsx)(He,{"aria-hidden":!0}),(0,Z.jsx)(`span`,{children:xe()}),(0,Z.jsx)(Be,{"aria-hidden":!0})]}):null,(0,Z.jsxs)(`div`,{className:`oc-projpage__actions`,children:[(0,Z.jsxs)(`div`,{className:`oc-projpage__viewtoggle`,role:`group`,"aria-label":y(),children:[(0,Z.jsx)(P,{variant:C===`cards`?`secondary`:`ghost`,size:`icon-sm`,"aria-label":y(),title:y(),"aria-pressed":C===`cards`,onClick:()=>T(`cards`),children:(0,Z.jsx)(mt,{})}),(0,Z.jsx)(P,{variant:C===`columns`?`secondary`:`ghost`,size:`icon-sm`,"aria-label":h(),title:h(),"aria-pressed":C===`columns`,onClick:()=>T(`columns`),children:(0,Z.jsx)(ft,{})}),(0,Z.jsx)(P,{variant:C===`list`?`secondary`:`ghost`,size:`icon-sm`,"aria-label":f(),title:f(),"aria-pressed":C===`list`,onClick:()=>T(`list`),children:(0,Z.jsx)(De,{})})]}),(0,Z.jsxs)(P,{variant:`outline`,size:`sm`,onClick:()=>void L({projectId:e.project._id}),children:[(0,Z.jsx)(Ye,{}),ee()]}),(0,Z.jsxs)(P,{variant:`outline`,size:`sm`,onClick:async()=>{let t=await r({title:_(),label:be(),placeholder:ve(),confirmLabel:ce()});t&&await d({name:t,parentId:e.project._id})},children:[(0,Z.jsx)(ke,{}),_()]}),(0,Z.jsxs)(Ve,{children:[(0,Z.jsx)(ze,{asChild:!0,children:(0,Z.jsx)(P,{variant:`ghost`,size:`icon-sm`,"aria-label":te(),children:(0,Z.jsx)(Ge,{})})}),(0,Z.jsxs)(Ue,{align:`end`,className:`w-48`,children:[(0,Z.jsxs)(R,{onSelect:()=>{st(e.project.name),H(!0)},children:[(0,Z.jsx)(et,{}),` `,w()]}),(0,Z.jsxs)(R,{onSelect:()=>J(!0),children:[(0,Z.jsx)(pt,{}),` `,me()]}),(0,Z.jsx)(Pe,{children:Se()}),(0,Z.jsxs)(`div`,{className:`oc-colorgrid`,children:[(0,Z.jsx)(`button`,{className:`oc-colorgrid__none`,onClick:()=>void c({projectId:e.project._id,color:null}),"aria-label":de(),children:`✕`}),at.map(t=>(0,Z.jsx)(`button`,{className:`oc-colorgrid__dot`+(e.project.color===t.value?` is-selected`:``),style:{background:t.hue},"aria-label":t.value,onClick:()=>void c({projectId:e.project._id,color:t.value})},t.value))]}),(0,Z.jsx)(Ie,{}),(0,Z.jsxs)(R,{variant:`destructive`,onSelect:()=>{let r=e.project.parentId;requestAnimationFrame(async()=>{let i=le?.folders??0,a=le?.chats??0;await n({title:u({name:e.project.name}),description:i>0?re({folders:i,chats:a}):a>0?ie({count:a}):ue(),confirmWord:A(),confirmLabel:m(),destructive:!0})&&(await l({projectId:e.project._id}),t(r===null?{to:`/`}:{to:`/project/$projectId`,params:{projectId:r}}))})},children:[(0,Z.jsx)(nt,{}),` `,A()]})]})]})]})]}),C===`columns`?(0,Z.jsx)(Ft,{data:E,currentId:e.project._id,busyIds:N,suppressClick:$,locateChatId:k??null}):C===`list`?(0,Z.jsx)(Mt,{data:D,busyIds:N,suppressClick:$,locateChatId:k??null}):(0,Z.jsxs)(Z.Fragment,{children:[e.children.length>0?(0,Z.jsxs)(`section`,{className:`oc-projpage__section`,children:[(0,Z.jsx)(`h2`,{className:`oc-projpage__subtitle`,children:i()}),(0,Z.jsx)(`div`,{className:`oc-projpage__cards`,children:(0,Z.jsx)(K,{items:e.children.map(e=>`folder:${e._id}`),strategy:dt,children:e.children.map(t=>(0,Z.jsx)(Ot,{child:t,parentId:e.project._id,now:Rt,suppressClick:$},t._id))})})]}):null,(0,Z.jsxs)(`section`,{className:`oc-projpage__section`,children:[(0,Z.jsxs)(`div`,{className:`oc-projpage__convhead`,children:[(0,Z.jsx)(`h2`,{className:`oc-projpage__subtitle`,children:he()}),e.chats.length>0?(0,Z.jsx)(W,{value:z,onChange:e=>rt(e.target.value),placeholder:ne(),className:`oc-projpage__filter`}):null]}),e.chats.length===0?(0,Z.jsx)(`p`,{className:`oc-projpage__hint`,children:e.children.length===0?o():b()}):Bt.length===0&&(Q??[]).length===0?(0,Z.jsx)(`p`,{className:`oc-projpage__hint`,children:Te({term:z.trim()})}):(0,Z.jsx)(`ul`,{className:`oc-projpage__chats`,children:(0,Z.jsx)(K,{items:Bt.map(e=>`chat:${e._id}`),strategy:q,children:Bt.map(t=>(0,Z.jsx)(At,{chat:t,currentFolderId:e.project._id,now:Rt,busy:N.has(t._id),unread:Fe.has(t._id),locate:t._id===k,suppressClick:$},t._id))})})]}),Y.length>=2&&Q!==void 0?(0,Z.jsxs)(`section`,{className:`oc-projpage__section`,children:[(0,Z.jsx)(`h2`,{className:`oc-projpage__subtitle`,children:ge()}),Q.length===0?(0,Z.jsx)(`p`,{className:`oc-projpage__hint`,children:Te({term:Y})}):(0,Z.jsx)(`ul`,{className:`oc-projpage__chats`,children:Q.map(e=>(0,Z.jsx)(`li`,{className:`oc-projpage__chatrow`,children:(0,Z.jsxs)(`button`,{type:`button`,className:`oc-projpage__chatbtn`,onClick:()=>{e.messageId&&Y&&We(e.messageId,Y),t({to:`/chat/$chatId`,params:{chatId:e.chatId},...e.messageId?{search:{m:e.messageId}}:{}})},children:[(0,Z.jsx)(ut,{size:13,"aria-hidden":!0,className:`oc-projpage__hitico`}),(0,Z.jsxs)(`span`,{className:`oc-projpage__hitbody`,children:[(0,Z.jsx)(`span`,{className:`oc-projpage__chattitle`,children:e.title||fe()}),e.projectPath&&e.projectPath.length>1?(0,Z.jsx)(`span`,{className:`oc-projpage__hitpath`,children:e.projectPath.join(` › `)}):null,e.snippet?(0,Z.jsx)(`span`,{className:`oc-projpage__hitsnippet`,children:e.snippet}):null]})]})},`${e.chatId}:${e.messageId??`t`}`))})]}):null]}),(0,Z.jsx)($e,{open:V,onOpenChange:H,title:oe(),canSubmit:U.trim().length>0,onSubmit:async()=>{await s({projectId:e.project._id,name:U.trim()}),H(!1)},submitLabel:w(),children:(0,Z.jsx)(W,{value:U,onChange:e=>st(e.target.value),autoFocus:!0})}),ct?(0,Z.jsx)(ot,{open:ct,onOpenChange:J,title:ye(),movingFolderId:e.project._id,currentId:e.project.parentId,onPick:t=>void p({projectId:e.project._id,parentId:t})}):null,qe]}),(0,Z.jsx)(je,{children:Ct?(0,Z.jsxs)(`div`,{className:`oc-projpage__dragghost`,children:[Ct.kind===`folder`?(0,Z.jsx)(G,{size:13,"aria-hidden":!0}):(0,Z.jsx)(ut,{size:13,"aria-hidden":!0}),(0,Z.jsx)(`span`,{children:Ct.label})]}):null})]})}function Dt({folderId:e,children:t}){let{setNodeRef:n,isOver:r}=L({id:Ct(e)});return(0,Z.jsx)(`span`,{ref:n,className:r?`oc-projpage__cdrop is-over`:`oc-projpage__cdrop`,children:t})}function Ot({child:e,parentId:t,now:n,suppressClick:r}){let i=I(),a=z({id:`folder:${e._id}`}),o=L({id:$(e._id)});return(0,Z.jsxs)(`div`,{ref:e=>{a.setNodeRef(e),o.setNodeRef(e)},className:`oc-projpage__card`+(o.isOver?` is-over`:``)+(a.isDragging?` is-dragging`:``),style:{"--proj-hue":B(e),transform:H.Transform.toString(a.transform),transition:a.transition},onClick:()=>{r.current||i({to:`/project/$projectId`,params:{projectId:e._id}})},onKeyDown:t=>{t.key===`Enter`&&i({to:`/project/$projectId`,params:{projectId:e._id}})},...a.listeners,...a.attributes,role:`link`,tabIndex:0,children:[(0,Z.jsxs)(`span`,{className:`oc-projpage__cardhead`,children:[(0,Z.jsx)(G,{size:15,"aria-hidden":!0,className:`oc-projpage__cardico`}),(0,Z.jsx)(`span`,{className:`oc-projpage__cardname`,children:e.name}),(0,Z.jsx)(Q,{folderId:e._id,name:e.name,color:e.color,currentParentId:t,className:`oc-projpage__cardmenu`,onOpen:()=>void i({to:`/project/$projectId`,params:{projectId:e._id}})})]}),(0,Z.jsxs)(`span`,{className:`oc-projpage__cardmeta`,children:[e.folderCount>0?c({count:e.folderCount})+` · `:``,l({count:e.recursiveChatCount})]}),e.lastActivityAt===null?null:(0,Z.jsx)(`span`,{className:`oc-projpage__cardage`,children:rt(e.lastActivityAt,n)})]})}function kt({chat:e}){let t=S(j.chats.setChatSidebar),n=e.inSidebar?N():a();return(0,Z.jsx)(P,{variant:`ghost`,size:`icon-xs`,"aria-label":n,title:n,className:`oc-projpage__barbtn`+(e.inSidebar?` is-on`:``),disabled:e.pinned&&e.inSidebar,onClick:n=>{n.stopPropagation(),t({chatId:e._id,hidden:e.inSidebar})},children:e.inSidebar?(0,Z.jsx)(qe,{}):(0,Z.jsx)(Y,{})})}function At({chat:e,currentFolderId:t,now:n,busy:r,unread:i,locate:a,suppressClick:o}){let s=I(),c=V(e.color),l=z({id:`chat:${e._id}`}),u=jt(a);return(0,Z.jsxs)(`li`,{ref:e=>{l.setNodeRef(e),u.current=e},className:`oc-projpage__chatrow`+(l.isDragging?` is-dragging`:``)+(a?` is-locate`:``),style:{transform:H.Transform.toString(l.transform),transition:l.transition},children:[(0,Z.jsxs)(`button`,{type:`button`,className:`oc-projpage__chatbtn`,onClick:()=>{o.current||s({to:`/chat/$chatId`,params:{chatId:e._id}})},...l.listeners,...l.attributes,children:[c?(0,Z.jsx)(`span`,{className:`oc-chatitem__dot`,style:{background:c}}):(0,Z.jsx)(`span`,{className:`oc-chatitem__dot oc-chatitem__dot--empty`}),(0,Z.jsx)(`span`,{className:`oc-projpage__chattitle`,children:e.title||Ce()}),e.pinned?(0,Z.jsx)(J,{size:12,"aria-hidden":!0,className:`oc-projpage__chatpin`}):null,(0,Z.jsx)(`span`,{className:`oc-projpage__chatage`,children:rt(e.updatedAt,n)}),r?(0,Z.jsx)(`span`,{className:`oc-chatitem__busy`,title:C(),"aria-label":C()}):null,i&&!r?(0,Z.jsx)(`span`,{className:`oc-chatitem__unread`,title:p(),"aria-label":p()}):null]}),(0,Z.jsx)(kt,{chat:e}),(0,Z.jsx)(gt,{chat:e,currentFolderId:t,className:`oc-projpage__chatmenu`})]})}function jt(e){let t=(0,X.useRef)(null);return(0,X.useEffect)(()=>{e&&t.current&&t.current.scrollIntoView({block:`center`})},[e]),t}function Mt({data:e,busyIds:t,suppressClick:n,locateChatId:r}){let[i,a]=(0,X.useState)(new Set),s=(0,X.useMemo)(()=>{let t=new Map;for(let n of e?.chats??[]){let e=t.get(n.folderId);e===void 0?t.set(n.folderId,[n]):e.push(n)}return t},[e]);if(e===void 0)return(0,Z.jsx)(`p`,{className:`oc-projpage__hint`,children:x()});if(e===null)return null;let c=e=>a(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n}),l=(a,o)=>{let u=s.get(a??e.rootId)??[],d=Qe(e.folders,a);return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(K,{items:u.map(e=>`chat:${e._id}`),strategy:q,children:u.map(e=>(0,Z.jsx)(Pt,{chat:e,depth:o,busy:t.has(e._id),locate:e._id===r,suppressClick:n},e._id))}),(0,Z.jsx)(K,{items:d.map(e=>`folder:${e._id}`),strategy:q,children:d.map(t=>(0,Z.jsx)(Nt,{folder:t,parentId:a??e.rootId,depth:o,folded:i.has(t._id),onToggle:()=>c(t._id),suppressClick:n,children:i.has(t._id)?null:l(t._id,o+1)},t._id))})]})};return(0,Z.jsx)(`div`,{className:`oc-projpage__tree`,children:(s.get(e.rootId)??[]).length===0&&Qe(e.folders,null).length===0?(0,Z.jsx)(`p`,{className:`oc-projpage__hint`,children:o()}):l(null,0)})}function Nt({folder:e,parentId:t,depth:n,folded:r,onToggle:i,suppressClick:a,children:o}){let s=I(),c=z({id:`folder:${e._id}`}),l=L({id:$(e._id)});return(0,Z.jsxs)(`div`,{className:`oc-projpage__treegroup`,children:[(0,Z.jsxs)(`div`,{ref:e=>{c.setNodeRef(e),l.setNodeRef(e)},className:`oc-projpage__treerow oc-projpage__treerow--folder`+(l.isOver?` is-over`:``)+(c.isDragging?` is-dragging`:``),style:{"--tree-depth":n,"--proj-hue":B(e),transform:H.Transform.toString(c.transform),transition:c.transition},...c.listeners,...c.attributes,role:`button`,tabIndex:0,onClick:()=>{a.current||s({to:`/project/$projectId`,params:{projectId:e._id}})},onKeyDown:t=>{t.key===`Enter`&&s({to:`/project/$projectId`,params:{projectId:e._id}})},children:[(0,Z.jsx)(`button`,{type:`button`,className:`oc-projpage__treechev`,"aria-label":r?g():T(),"aria-expanded":!r,onClick:e=>{e.stopPropagation(),!a.current&&i()},onMouseDown:e=>e.stopPropagation(),onTouchStart:e=>e.stopPropagation(),children:r?(0,Z.jsx)(Ae,{size:13}):(0,Z.jsx)(Fe,{size:13})}),(0,Z.jsx)(G,{size:13,"aria-hidden":!0,className:`oc-projpage__colico`}),(0,Z.jsx)(`span`,{className:`oc-projpage__colname`,children:e.name}),(0,Z.jsx)(Q,{folderId:e._id,name:e.name,color:e.color,currentParentId:t,className:`oc-projpage__treemenu`,onOpen:()=>void s({to:`/project/$projectId`,params:{projectId:e._id}})})]}),o]})}function Pt({chat:e,depth:t,busy:n,locate:r,suppressClick:i}){let a=I(),o=z({id:`chat:${e._id}`}),s=jt(r),c=V(e.color);return(0,Z.jsxs)(`div`,{ref:e=>{o.setNodeRef(e),s.current=e},className:`oc-projpage__treerow oc-projpage__treerow--chat`+(o.isDragging?` is-dragging`:``)+(r?` is-locate`:``),style:{"--tree-depth":t,transform:H.Transform.toString(o.transform),transition:o.transition},children:[(0,Z.jsxs)(`button`,{type:`button`,className:`oc-projpage__colchatbtn`,onClick:()=>{i.current||a({to:`/chat/$chatId`,params:{chatId:e._id}})},...o.listeners,...o.attributes,children:[c?(0,Z.jsx)(`span`,{className:`oc-chatitem__dot`,style:{background:c}}):(0,Z.jsx)(`span`,{className:`oc-chatitem__dot oc-chatitem__dot--empty`}),(0,Z.jsx)(`span`,{className:`oc-projpage__colname`,children:e.title||Ce()}),n?(0,Z.jsx)(`span`,{className:`oc-chatitem__busy`,"aria-hidden":!0}):null]}),(0,Z.jsx)(gt,{chat:e,currentFolderId:e.folderId,className:`oc-projpage__treemenu`}),(0,Z.jsx)(kt,{chat:e})]})}function Ft({data:e,currentId:t,busyIds:n,suppressClick:r,locateChatId:i}){let a=(0,X.useRef)(null);return(0,X.useEffect)(()=>{let e=a.current;e&&(e.scrollLeft=e.scrollWidth)},[e?.columns.length??0,t]),e===void 0?(0,Z.jsx)(`p`,{className:`oc-projpage__hint`,children:x()}):(0,Z.jsx)(`div`,{className:`oc-projpage__cols`,ref:a,children:e.columns.map((a,o)=>(0,Z.jsx)(It,{col:a,isLast:o===e.columns.length-1,currentId:t,busyIds:n,suppressClick:r,locateChatId:i},a.folderId??`root`))})}function It({col:e,isLast:t,currentId:n,busyIds:r,suppressClick:i,locateChatId:a}){let o=I(),s=L({id:St(e.folderId)});return(0,Z.jsxs)(`div`,{ref:s.setNodeRef,className:`oc-projpage__col`+(s.isOver?` is-over`:``)+(t?` is-last`:``),children:[(0,Z.jsx)(K,{items:e.folders.map(e=>`folder:${e._id}`),strategy:q,children:e.folders.map(t=>(0,Z.jsx)(Lt,{folder:t,parentId:e.folderId,isCurrent:t._id===n,suppressClick:i,onOpen:()=>void o({to:`/project/$projectId`,params:{projectId:t._id}})},t._id))}),(0,Z.jsx)(K,{items:e.chats.map(e=>`chat:${e._id}`),strategy:q,children:e.chats.map(t=>(0,Z.jsx)(Rt,{chat:t,folderId:e.folderId,busy:r.has(t._id),locate:t._id===a,suppressClick:i,onOpen:()=>void o({to:`/chat/$chatId`,params:{chatId:t._id}})},t._id))}),e.folders.length===0&&e.chats.length===0?(0,Z.jsx)(`p`,{className:`oc-projpage__colempty`,children:b()}):null]})}function Lt({folder:e,parentId:t,isCurrent:n,suppressClick:r,onOpen:i}){let a=z({id:`folder:${e._id}`}),o=L({id:$(e._id)});return(0,Z.jsxs)(`div`,{ref:e=>{a.setNodeRef(e),o.setNodeRef(e)},className:`oc-projpage__colentry oc-projpage__colentry--folder`+(e.selected||n?` is-selected`:``)+(o.isOver?` is-over`:``)+(a.isDragging?` is-dragging`:``),style:{"--proj-hue":B(e),transform:H.Transform.toString(a.transform),transition:a.transition},onClick:()=>{r.current||i()},onKeyDown:e=>{e.key===`Enter`&&e.target===e.currentTarget&&i()},...a.listeners,...a.attributes,role:`button`,tabIndex:0,children:[(0,Z.jsx)(G,{size:13,"aria-hidden":!0,className:`oc-projpage__colico`}),(0,Z.jsx)(`span`,{className:`oc-projpage__colname`,children:e.name}),(0,Z.jsx)(`span`,{className:`oc-projpage__colchev`,"aria-hidden":!0,children:`›`}),(0,Z.jsx)(Q,{folderId:e._id,name:e.name,color:e.color,currentParentId:t,className:`oc-projpage__colmenu`,onOpen:i})]})}function Rt({chat:e,folderId:t,busy:n,locate:r,suppressClick:i,onOpen:a}){let o=z({id:`chat:${e._id}`}),s=jt(r),c=V(e.color);return(0,Z.jsxs)(`div`,{ref:e=>{o.setNodeRef(e),s.current=e},className:`oc-projpage__colentry oc-projpage__colentry--chat`+(o.isDragging?` is-dragging`:``)+(r?` is-locate`:``),style:{transform:H.Transform.toString(o.transform),transition:o.transition},children:[(0,Z.jsxs)(`button`,{type:`button`,className:`oc-projpage__colchatbtn`,onClick:()=>{i.current||a()},...o.listeners,...o.attributes,children:[c?(0,Z.jsx)(`span`,{className:`oc-chatitem__dot`,style:{background:c}}):(0,Z.jsx)(`span`,{className:`oc-chatitem__dot oc-chatitem__dot--empty`}),(0,Z.jsx)(`span`,{className:`oc-projpage__colname`,children:e.title||Ce()}),n?(0,Z.jsx)(`span`,{className:`oc-chatitem__busy`,"aria-hidden":!0}):null]}),(0,Z.jsx)(gt,{chat:e,currentFolderId:t,className:`oc-projpage__colmenu oc-projpage__colmenu--chat`}),(0,Z.jsx)(kt,{chat:e})]})}export{Tt as ProjectPage};
@@ -0,0 +1,4 @@
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$b as r,Mi as i,Ni as a,Q as o,Qb as s,Tx as c,_x as l,aB as u,ax as d,bo as f,cc as p,co as m,cx as h,dc as g,do as _,dx as v,ex as y,fx as ee,gx as b,hx as x,ix as S,ji as C,lc as w,lo as T,lx as E,mx as D,nx as O,oB as k,ox as te,px as ne,rx as re,sc as ie,so as ae,sx as oe,t as A,tx as j,uc as M,uo as N,ux as P,vo as F,wx as I,xo as L,yo as R}from"./api-CCk5U5gB.js";import{i as z,n as B,r as V,t as H}from"./FieldLabel-8vj4ipPC.js";import{t as U}from"./button-CbUSFbZL.js";import{$ as W,Dt as se,Q as G,Qt as K,X as q,Xt as ce,Yt as J,Z as Y,Zt as le,et as X,q as ue,ut as de}from"./index-DY7zoioz.js";import{r as Z,t as fe}from"./locales-CPjguROj.js";import{t as pe}from"./localePickerView-C2RmOS86.js";/* empty css */var Q=t(e(),1),$=n(),me={media_delivery:{label:ee,help:v},documentary_fetch:{label:P,help:E},inbound_files:{label:h,help:oe},history_summary:{label:g,help:M},file_curation:{label:L,help:_},quote_reply:{label:f,help:R}},he={outboundDir:`/home/node/.openclaw/media/outbound`,references:`- gdrive/1a2b3c4d5e6f7890abcd
2
+ - gdrive/0f9e8d7c6b5a4321dcba`,files:`- /home/node/.openclaw/media/inbound/rapport.pdf (124800 o, application/pdf)`,previous_summary:`Projet Alpha : budget 40 000 EUR ; choix du serveur en cours.`,new_messages:`Utilisateur : Compare OVH et Scaleway.
3
+ Assistant : Comparaison en cours.`,max_chars:`6000`,file_name:`MEMORY.md`,budget_chars:`20000`,feedback:`Trop de suppressions dans la section des liens, garde-les.`,content:`# Memory index
4
+ - [Fait 1](fait-1.md) - note du projet`,excerpt:`Le classement propose trois dossiers : Clients, Fournisseurs, Interne.`},ge={outboundDir:y,references:r,files:s,previous_summary:w,new_messages:p,max_chars:ie,file_name:N,budget_chars:T,feedback:m,content:ae,excerpt:F};function _e(){let e=k(A.admin.listInstances,{}),[t,n]=(0,Q.useState)(null);if(e===void 0)return(0,$.jsx)(`div`,{className:`oc-settings__tab-loading`,"aria-busy":`true`});if(e.length===0)return(0,$.jsx)(`div`,{className:`oc-injtab`,children:(0,$.jsx)(`p`,{className:`oc-admin__hint`,children:d()})});let r=e.find(e=>e._id===t)??e[0];return(0,$.jsxs)(`div`,{className:`oc-injtab`,children:[(0,$.jsxs)(`div`,{className:`oc-injtab__head`,children:[(0,$.jsx)(B,{label:l(),help:b()}),(0,$.jsxs)(`label`,{className:`oc-injtab__picker`,children:[(0,$.jsx)(`span`,{children:te()}),(0,$.jsxs)(q,{value:r._id,onValueChange:e=>n(e),children:[(0,$.jsx)(W,{size:`sm`,className:`min-w-44`,children:(0,$.jsx)(X,{})}),(0,$.jsx)(Y,{children:e.map(e=>(0,$.jsx)(G,{value:e._id,children:e.displayName??e.name},e._id))})]})]})]}),(0,$.jsx)(ve,{instance:r},r._id)]})}function ve({instance:e}){let t=u(A.admin.upsertInstanceConfig),n=se(),r=k(A.me.getMe,{host:ue}),o=e.config??{},s=Z(e.config?.contentLocale,r?.defaultLocale??void 0),[l,d]=(0,Q.useState)(()=>z(o,s));(0,Q.useEffect)(()=>{d(z(o,s))},[s,e._id]);let[f,p]=(0,Q.useState)(!1),m=l.promptInjections,h=(e,t)=>d({...l,promptInjections:{...m,[e]:{...m[e],...t}}});async function g(){p(!0);try{await t({instanceId:e._id,config:V(l,o,s)})}catch(e){n.error(I(),e)}finally{p(!1)}}async function _(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(I(),e)}}let v=e.config?.contentLocale??`default`,y=fe[Z(void 0,r?.defaultLocale??void 0)];return(0,$.jsxs)(`div`,{className:`oc-injtab__body`,children:[(0,$.jsxs)(`div`,{className:`oc-injtab__content-locale`,children:[(0,$.jsx)(`span`,{children:a()}),(0,$.jsxs)(q,{value:v,onValueChange:e=>void _(e),children:[(0,$.jsx)(W,{size:`sm`,className:`min-w-44`,children:(0,$.jsx)(X,{})}),(0,$.jsxs)(Y,{children:[(0,$.jsx)(G,{value:`default`,children:C({locale:y})}),pe().map(e=>(0,$.jsx)(G,{value:e.value,children:e.label},e.value))]})]}),(0,$.jsx)(`p`,{className:`oc-admin__hint`,children:i()})]}),ce.map(e=>(0,$.jsx)(ye,{injKey:e,def:J[e],i18n:me[e],row:m[e]??{enabled:!0,template:J[e].defaultTemplate[s]},contentLocale:s,onChange:t=>h(e,t)},e)),(0,$.jsx)(`div`,{className:`oc-injtab__actions`,children:(0,$.jsx)(U,{size:`sm`,onClick:()=>void g(),disabled:f,children:c()})})]})}function ye({injKey:e,def:t,i18n:n,row:r,contentLocale:i,onChange:a}){let[s,c]=(0,Q.useState)(!1),l=r.template.trim()!==t.defaultTemplate[i],u=t.togglable&&!r.enabled,d=Object.fromEntries(t.placeholders.map(e=>[e,he[e]??`{${e}}`])),f=le(e,r,i),p=f?K(f,d):``;return(0,$.jsxs)(`section`,{className:`oc-injcard`,children:[(0,$.jsxs)(`div`,{className:`oc-injcard__head`,children:[t.togglable?(0,$.jsxs)(`label`,{className:`oc-field--row`,children:[(0,$.jsx)(de,{checked:r.enabled,onCheckedChange:e=>a({enabled:e===!0})}),(0,$.jsx)(B,{label:n.label(),help:n.help()})]}):(0,$.jsx)(B,{label:n.label(),help:n.help()}),l&&(0,$.jsx)(`span`,{className:`oc-injection__badge`,children:D()})]}),(0,$.jsx)(`textarea`,{className:`oc-injcard__text`,value:r.template,disabled:u,rows:8,spellCheck:!1,onChange:e=>a({template:e.target.value})}),(0,$.jsxs)(`div`,{className:`oc-injection__foot`,children:[(0,$.jsxs)(`div`,{className:`oc-injcard__phs`,children:[(0,$.jsx)(`span`,{className:`oc-injection__ph`,children:ne()}),t.placeholders.map(e=>(0,$.jsxs)(`span`,{className:`oc-injcard__ph-chip`,children:[(0,$.jsx)(`code`,{children:`{${e}}`}),(0,$.jsx)(H,{text:(ge[e]??(()=>e))()})]},e))]}),(0,$.jsxs)(`div`,{className:`oc-injcard__btns`,children:[(0,$.jsx)(U,{variant:`ghost`,size:`sm`,onClick:()=>c(e=>!e),children:s?re():S()}),l&&(0,$.jsx)(U,{variant:`ghost`,size:`sm`,onClick:()=>a({template:t.defaultTemplate[i]}),children:x()})]})]}),s&&(0,$.jsx)(`div`,{className:`oc-injcard__preview`,children:p?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`pre`,{className:`oc-injcard__previewtext`,children:p}),(0,$.jsx)(`span`,{className:`oc-injection__ph`,children:O()}),t.pluralDefaultTemplate!==void 0&&!u?(0,$.jsx)(`span`,{className:`oc-injection__ph`,children:o()}):null]}):(0,$.jsx)(`span`,{className:`oc-injection__ph`,children:j()})})]})}export{_e as PromptInjectionsTab};
@@ -0,0 +1 @@
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$w as r,Aw as i,Bw as a,Dw as ee,Ew as o,Go as s,Gw as c,Hw as l,Jw as u,Kw as d,Mw as f,Nw as te,Ow as p,Pw as m,Qw as ne,Uw as h,Vw as re,Ww as ie,Xw as ae,Yw as g,Zw as _,aB as v,aT as y,cT as b,dT as x,eT as S,fT as C,hT as w,iT as T,jw as E,kw as D,lT as O,mT as k,nT as A,oB as j,oT as M,pT as N,qw as P,rT as F,sT as I,t as L,tT as R,uT as z}from"./api-CCk5U5gB.js";import{t as B}from"./button-CbUSFbZL.js";import{Dt as V,En as H,Et as U,U as W,_ as G,jt as K,ut as q}from"./index-DY7zoioz.js";import{t as J}from"./roleDescriptions-Du6v2lbA.js";var Y=t(e(),1),X=n(),Z=[{group:()=>w(),keys:[{key:`traces.read`,label:()=>z()},{key:`traces.read.content`,label:()=>O(),phi:!0},{key:`traces.write`,label:()=>b()}]},{group:()=>k(),keys:[{key:`kpi.read`,label:()=>z()},{key:`kpi.write`,label:()=>b()}]},{group:()=>N(),keys:[{key:`openclaw.query`,label:()=>I()},{key:`anomalies.read`,label:()=>M()},{key:`anomalies.report`,label:()=>y()}]},{group:()=>C(),keys:[{key:`chats.read`,label:()=>z()},{key:`selfheal`,label:()=>F()},{key:`feedback.respond`,label:()=>s()}]},{group:()=>x(),keys:[{key:`admin.manage`,label:()=>T()}]}],oe=Z.flatMap(e=>e.keys.map(e=>e.key));function Q(e){return e.includes(`*`)}var $={key:``,name:``,description:``};function se(){let e=j(L.apiKeys.listRoles,{}),t=v(L.apiKeys.createRole),n=v(L.apiKeys.ensureRolesSeeded),s=v(L.apiKeys.updateRolePermissions).withOptimisticUpdate((e,{roleId:t,permissions:n})=>{let r=e.getQuery(L.apiKeys.listRoles,{});r&&e.setQuery(L.apiKeys.listRoles,{},r.map(e=>e._id===t?{...e,permissions:n}:e))}),y=W(),b=V(),[x,C]=(0,Y.useState)(!1),[w,T]=(0,Y.useState)($),[O,k]=(0,Y.useState)(new Set);(0,Y.useEffect)(()=>{n({}).catch(e=>{b.error(R(),e)})},[n,b]);let M=e??[];async function N(e,t){if(Q(e.permissions))return;if(e.builtin){await y({title:S({name:e.name}),description:r(),confirmLabel:ne()});return}if(O.has(e._id))return;let n=e.permissions.includes(t)?e.permissions.filter(e=>e!==t):[...e.permissions,t];k(t=>new Set(t).add(e._id));try{await s({roleId:e._id,permissions:n})}catch(e){b.error(_(),e)}finally{k(t=>{let n=new Set(t);return n.delete(e._id),n})}}async function F(){try{await t({key:w.key,name:w.name,description:w.description||void 0,permissions:[]}),T($),C(!1)}catch(e){b.error(ae(),e)}}let I=e===void 0,z=!I&&M.length===0;return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`p`,{className:`oc-admin__hint`,children:[g(),` `,(0,X.jsx)(`code`,{children:`admin`}),` `,u(),` `,(0,X.jsx)(`code`,{children:`traces.read.content`}),` `,P()]}),(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:d()}),(0,X.jsx)(`div`,{className:`oc-dt__bar-actions`,children:(0,X.jsx)(B,{size:`sm`,onClick:()=>{T($),C(!0)},children:c()})})]}),I?(0,X.jsx)(`p`,{className:`oc-admin__hint`,children:ie()}):z?(0,X.jsx)(`p`,{className:`oc-admin__hint`,children:h()}):(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:l()}),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?A({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:M.map(e=>{let t=Q(e.permissions),n=O.has(e._id);return(0,X.jsxs)(`tr`,{children:[(0,X.jsxs)(`th`,{className:`oc-matrix__rolecell`,children:[(0,X.jsxs)(`div`,{className:`oc-matrix__rolename`,children:[(0,X.jsx)(`span`,{children:e.name}),(0,X.jsx)(`code`,{className:`oc-matrix__rolekey`,children:e.key}),e.builtin?(0,X.jsxs)(U,{variant:`outline`,className:`gap-1`,children:[(0,X.jsx)(H,{}),` `,re()]}):(0,X.jsx)(U,{variant:`secondary`,children:a()})]}),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)(q,{checked:t||e.permissions.includes(r),disabled:t||n,"aria-label":`${e.key} · ${r}`,title:t?m():n?te():r,onCheckedChange:()=>void N(e,r)})},r))]},e.key)})})]})})]}),(0,X.jsx)(G,{open:x,onOpenChange:C,title:f(),description:E(),canSubmit:!!(w.key&&w.name),onSubmit:F,submitLabel:i(),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:D()}),(0,X.jsx)(K,{value:w.key,placeholder:p(),onChange:e=>T({...w,key:e.target.value})})]}),(0,X.jsxs)(`label`,{className:`oc-field`,children:[(0,X.jsx)(`span`,{className:`oc-field__label`,children:ee()}),(0,X.jsx)(K,{value:w.name,onChange:e=>T({...w,name:e.target.value})})]}),(0,X.jsxs)(`label`,{className:`oc-field`,children:[(0,X.jsx)(`span`,{className:`oc-field__label`,children:o()}),(0,X.jsx)(K,{value:w.description,onChange:e=>T({...w,description:e.target.value})})]})]})})]})}export{se as RolesTab};