@lacneu/atrium 0.10.11 → 0.10.13
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.
- package/dist/assets/{AccessTab-MJXVZGou.js → AccessTab-CEi2jEXZ.js} +1 -1
- package/dist/assets/AdvancedFilter-EPxqO-eA.js +1 -0
- package/dist/assets/AgentFilesTab-lYSv6XmB.js +3 -0
- package/dist/assets/AnomaliesTab-BOKqiWd2.js +1 -0
- package/dist/assets/AuditTab-DnBhTYMJ.js +1 -0
- package/dist/assets/BridgeTab-BiMrYTrr.js +1 -0
- package/dist/assets/ChatDefaultsTab-lJmDn_58.js +1 -0
- package/dist/assets/DataTableShell-BpD7pA0i.js +1 -0
- package/dist/assets/{DetailChips-CgOS7kpk.js → DetailChips-BA1mq7Wm.js} +1 -1
- package/dist/assets/FeedbacksTab-Dt92LCDU.js +1 -0
- package/dist/assets/FieldLabel-CFckKZrw.js +4 -0
- package/dist/assets/FilesTab-CABwvKIR.js +1 -0
- package/dist/assets/{FilterBar-9k1La5AD.js → FilterBar-DB-b7WAm.js} +1 -1
- package/dist/assets/GroupsTab-01UtVbu_.js +1 -0
- package/dist/assets/InstancesTab-CRA7-G_l.js +1 -0
- package/dist/assets/IntegrationsTab-Dtf3L_gX.js +1 -0
- package/dist/assets/{KpiTab-BTD6oTyg.js → KpiTab-CYRAZPuB.js} +1 -1
- package/dist/assets/PreferencesTab-CjVBIxqe.js +1 -0
- package/dist/assets/PromptInjectionsTab-O-RMzIb1.js +2 -0
- package/dist/assets/RolesTab-68zkT6ks.js +1 -0
- package/dist/assets/ServiceAccountsTab-CvguS5Iy.js +1 -0
- package/dist/assets/ThemeShowroom-DhKQpNPj.js +1 -0
- package/dist/assets/{TimeRangePicker-ytbfLYAK.js → TimeRangePicker--wX3a-5x.js} +1 -1
- package/dist/assets/TracesTab-DO0c_Ypn.js +1 -0
- package/dist/assets/UsersTab-BMM1oQPU.js +1 -0
- package/dist/assets/button-x4eiKyNo.js +1 -0
- package/dist/assets/{card-6mfv2y9A.js → card-BpwyvJ1X.js} +1 -1
- package/dist/assets/chevrons-up-down-Dn5VCqqo.js +1 -0
- package/dist/assets/{compatView-dra_1R7u.js → compatView-D1fAiei9.js} +1 -1
- package/dist/assets/{dispatchErrorInfo-4DotGcUz.js → dispatchErrorInfo-CIQ2MRwS.js} +1 -1
- package/dist/assets/{dist-CZW3hxVF.js → dist-BhemspoL.js} +1 -1
- package/dist/assets/dist-BiCy_qcc.js +1 -0
- package/dist/assets/{dist-STr4vxtr.js → dist-VD7Y9bPB.js} +1 -1
- package/dist/assets/dist-uStCogeE.js +1 -0
- package/dist/assets/{highlighted-body-OFNGDK62-Bulh0GF5.js → highlighted-body-OFNGDK62-CdPsDE0f.js} +1 -1
- package/dist/assets/index-BlZ8oKFa.js +220 -0
- package/dist/assets/index-D2yjtZhd.css +2 -0
- package/dist/assets/mermaid-GHXKKRXX-DgFC5iC-.js +1 -0
- package/dist/assets/roleDescriptions-DJHA0ezr.js +1 -0
- package/dist/assets/{table-C3YR2wAA.js → table-BQp_EgUj.js} +1 -1
- package/dist/assets/x-C9JKw9Pc.js +1 -0
- package/dist/index.html +8 -6
- package/package.json +1 -1
- package/dist/assets/AdvancedFilter-t3zpDtnl.js +0 -1
- package/dist/assets/AgentFilesTab-z1c-GxXi.js +0 -3
- package/dist/assets/AnomaliesTab-BmwnNIbl.js +0 -1
- package/dist/assets/AuditTab-RXqDV_Yh.js +0 -1
- package/dist/assets/BridgeTab-DPYvTS38.js +0 -1
- package/dist/assets/ChatDefaultsTab-JlbFiV__.js +0 -1
- package/dist/assets/DataTableShell-DI2wUkxk.js +0 -1
- package/dist/assets/FeedbacksTab-ZiKOPQ0R.js +0 -1
- package/dist/assets/FilesTab-DNvPAT7B.js +0 -1
- package/dist/assets/GroupsTab-TH3ZNuR7.js +0 -1
- package/dist/assets/InstancesTab-wASLef_U.js +0 -1
- package/dist/assets/IntegrationsTab-Cy0cPAse.js +0 -1
- package/dist/assets/PreferencesTab--2YDaPN7.js +0 -1
- package/dist/assets/RolesTab-Cp5JtW0-.js +0 -1
- package/dist/assets/ServiceAccountsTab-BRofYmYQ.js +0 -1
- package/dist/assets/ThemeShowroom-DFMEaYmX.js +0 -1
- package/dist/assets/TracesTab-DNliGoeU.js +0 -1
- package/dist/assets/UsersTab-WK8-Dn2m.js +0 -1
- package/dist/assets/button-CugigrXc.js +0 -1
- package/dist/assets/chevrons-up-down-C73YlC2o.js +0 -1
- package/dist/assets/index-BMkJqrBA.js +0 -220
- package/dist/assets/index-CDcNRXdD.css +0 -2
- package/dist/assets/mermaid-GHXKKRXX-DjKrGUeH.js +0 -1
- package/dist/assets/roleDescriptions-DN8eyhnx.js +0 -1
- package/dist/assets/x-Bol-Z6zU.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Cr as r,Dr as i,Er as a,
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Cr as r,Dr as i,Er as a,LC as o,Sr as s,Tr as c,WC as l,_r as u,br as d,gr as f,hr as p,mr as m,pr as h,uC as g,vr as _,wr as v,xr as y,yr as b}from"./dist-BhemspoL.js";import{C as x,S,b as C,m as w,x as T,y as E}from"./index-BlZ8oKFa.js";var D=t(e(),1);function O(e){return e===`user`?u():e===`all`?f():p({group:e.group})}function k(e){return e===`common`?m():e===`owner`?h():p({group:e.group})}var A=n();function j(e){return e.name||e.email||e.userId.slice(0,8)}function M(){let e=l(o.admin.listUsers,{}),[t,n]=(0,D.useState)(``),u=l(o.introspect.introspectUser,t?{userId:t}:`skip`);return(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:i()}),(0,A.jsxs)(E,{value:t,onValueChange:n,children:[(0,A.jsx)(S,{size:`sm`,"aria-label":a(),children:(0,A.jsx)(x,{placeholder:a()})}),(0,A.jsx)(C,{children:(e??[]).map(e=>(0,A.jsx)(T,{value:e.userId,children:j(e)},e._id))})]}),t===``?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:c()}):u===void 0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:g()}):(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:v()}),(0,A.jsxs)(`div`,{className:`oc-introspect__id`,children:[(0,A.jsx)(`strong`,{children:u.user.label}),(0,A.jsx)(w,{variant:`secondary`,children:u.role})]})]}),(0,A.jsxs)(`section`,{className:`oc-introspect__section`,children:[(0,A.jsx)(`h3`,{className:`oc-introspect__title`,children:r()}),u.groups.length===0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:b()}):(0,A.jsx)(`div`,{className:`oc-introspect__chips`,children:u.groups.map(e=>(0,A.jsx)(w,{variant:`secondary`,children:e.name},e.groupId))})]}),(0,A.jsxs)(`section`,{className:`oc-introspect__section`,children:[(0,A.jsx)(`h3`,{className:`oc-introspect__title`,children:s()}),u.agents.length===0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:b()}):(0,A.jsx)(`ul`,{className:`oc-introspect__list`,children:u.agents.map(e=>(0,A.jsxs)(`li`,{className:`oc-introspect__row`,children:[(0,A.jsx)(`span`,{className:`oc-introspect__name`,children:e.displayName||e.agentId}),e.isDefault?(0,A.jsx)(w,{variant:`default`,children:_()}):null,(0,A.jsx)(w,{variant:`outline`,children:O(e.via)}),(0,A.jsx)(w,{variant:`secondary`,children:e.state})]},`${e.instanceName} ${e.agentId}`))})]}),(0,A.jsxs)(`section`,{className:`oc-introspect__section`,children:[(0,A.jsx)(`h3`,{className:`oc-introspect__title`,children:y()}),u.charts.length===0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:b()}):(0,A.jsx)(`ul`,{className:`oc-introspect__list`,children:u.charts.map(e=>(0,A.jsxs)(`li`,{className:`oc-introspect__row`,children:[(0,A.jsx)(`span`,{className:`oc-introspect__name`,children:e.name}),(0,A.jsx)(w,{variant:`outline`,children:k(e.via)})]},e.key))})]}),(0,A.jsxs)(`section`,{className:`oc-introspect__section`,children:[(0,A.jsx)(`h3`,{className:`oc-introspect__title`,children:d()}),u.permissions.length===0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:b()}):(0,A.jsx)(`div`,{className:`oc-introspect__chips`,children:u.permissions.map(e=>(0,A.jsx)(w,{variant:`secondary`,children:e},e))})]})]})]})}export{M as AccessTab};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Fa as r,Ia as i,La as a,Ma as o,Na as s,Pa as c,Ra as l}from"./dist-BhemspoL.js";import{i as u}from"./dist-BiCy_qcc.js";import{r as d}from"./TimeRangePicker--wX3a-5x.js";import{t as f}from"./x-C9JKw9Pc.js";import{t as p}from"./button-x4eiKyNo.js";import{C as m,S as h,b as g,q as _,x as v,y,yt as b}from"./index-BlZ8oKFa.js";var x=t(e(),1),S=n(),C=[{value:`eq`,label:`=`},{value:`neq`,label:`≠`},{value:`contains`,label:l()},{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 l=(0,x.useRef)(t),w=!!(l.current&&l.current.length>0),[D,O]=(0,x.useState)(w),[k,A]=(0,x.useState)(()=>w?E(l.current):[]);function j(e){n(e.filter(e=>e.field!==``&&e.value!==``).map(e=>({field:e.field,op:e.op,value:d(e.value)})))}function M(e,t){let n=k.map(n=>n.id===e?{...n,...t}:n);A(n),j(n)}function N(){A(e=>[...e,T()])}function P(e){let t=k.filter(t=>t.id!==e);A(t),j(t)}let F=k.filter(e=>e.field!==``&&e.value!==``).length;return(0,S.jsxs)(`div`,{className:`oc-advfilter`,children:[(0,S.jsxs)(`button`,{type:`button`,className:`oc-advfilter__toggle`,"aria-expanded":D,onClick:()=>O(e=>!e),children:[(0,S.jsx)(u,{className:`oc-advfilter__chevron`+(D?` is-open`:``),"aria-hidden":!0}),a(),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:i()}):(0,S.jsx)(`ul`,{className:`oc-advfilter__rows`,children:k.map(t=>(0,S.jsxs)(`li`,{className:`oc-advfilter__row`,children:[(0,S.jsxs)(y,{value:t.field||void 0,onValueChange:e=>M(t.id,{field:e}),children:[(0,S.jsx)(h,{size:`sm`,className:`w-40`,children:(0,S.jsx)(m,{placeholder:r()})}),(0,S.jsx)(g,{children:e.map(e=>(0,S.jsx)(v,{value:e.value,children:e.label},e.value))})]}),(0,S.jsxs)(y,{value:t.op,onValueChange:e=>M(t.id,{op:e}),children:[(0,S.jsx)(h,{size:`sm`,className:`w-28`,children:(0,S.jsx)(m,{})}),(0,S.jsx)(g,{children:C.map(e=>(0,S.jsx)(v,{value:e.value,children:e.label},e.value))})]}),(0,S.jsx)(_,{className:`oc-advfilter__value`,value:t.value,onChange:e=>M(t.id,{value:e.target.value}),placeholder:c()}),(0,S.jsx)(p,{variant:`ghost`,size:`icon-sm`,"aria-label":s(),onClick:()=>P(t.id),children:(0,S.jsx)(f,{})})]},t.id))}),(0,S.jsxs)(p,{variant:`outline`,size:`sm`,className:`oc-advfilter__add`,onClick:N,children:[(0,S.jsx)(b,{}),o()]})]}):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{$ as r,B as i,F as a,G as o,Gt as s,H as c,I as l,J as u,K as d,L as f,LC as p,Q as ee,R as m,U as h,Ut as te,V as g,VC as _,W as v,WC as y,X as b,Y as ne,Z as x,at as S,ct as re,et as ie,fC as ae,it as C,lt as oe,nt as se,ot as w,q as T,rt as E,rv as D,st as O,tt as ce,uC as k,ut as A,z as j}from"./dist-BhemspoL.js";import{t as M}from"./button-x4eiKyNo.js";import{A as N,B as P,C as F,F as I,G as le,H as ue,K as de,L as fe,N as pe,P as me,R as he,S as L,U as ge,V as _e,W as ve,_ as R,at as z,b as B,m as V,pt as H,x as U,y as W,z as ye}from"./index-BlZ8oKFa.js";import{i as G}from"./compatView-D1fAiei9.js";/* empty css */var K=t(e(),1),q=2e4,J=6e4;function Y(e){return typeof e!=`number`||e<=0?0:Math.round(e/q*100)}function X(e){return e<=0?0:Math.round(e/J*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 be(e){return e.reduce((e,t)=>e+(typeof t.size==`number`&&t.size>0?t.size:0),0)}var xe=3;function Se(e,t){let n=new Map;for(let t of e.split(`
|
|
2
|
+
`))n.set(t,(n.get(t)??0)+1);for(let e of t.split(`
|
|
3
|
+
`))n.set(e,(n.get(e)??0)-1);let r=0,i=0,a=[],o=[];for(let[e,t]of n)t<0?(r+=-t,a.length<xe&&a.push(e)):t>0&&(i+=t,o.length<xe&&o.push(e));return{added:r,removed:i,sampleAdded:a,sampleRemoved:o}}function Ce(e){return e instanceof Error?e.message.includes(`conflict:`):String(e).includes(`conflict:`)}var Q=n(),$=e=>`${e.instanceName}::${e.agentId}`;function we(){let e=y(p.me.getMe,{host:z}),t=e?.role===`admin`,n=(e?.permissions??[]).includes(`bridge.read`),i=y(p.admin.listInstances,e!==void 0&&t?{}:`skip`),[a,o]=(0,K.useState)(null);(0,K.useEffect)(()=>{!t||!i||i.length===0||(!a||!i.some(e=>e.name===a))&&o(i[0].name)},[t,i,a]);let s=y(p.agents.listAgentsForInstance,t&&a?{instanceName:a}:`skip`),c=y(p.agents.listMyAgents,e!==void 0&&!t?{}:`skip`),l=(0,K.useMemo)(()=>{if(e!==void 0){if(t)return a===null||s===void 0?i!==void 0&&i.length===0?[]:void 0:s.agents.map(e=>({instanceName:a,agentId:e.agentId,label:`${e.emoji?`${e.emoji} `:``}${e.displayName??e.agentId}`}));if(c!==void 0)return c.map(e=>({instanceName:e.instanceName,agentId:e.agentId,label:`${e.emoji?`${e.emoji} `:``}${e.displayName??e.agentId}`}))}},[e,t,a,s,i,c]),[u,d]=(0,K.useState)(null);(0,K.useEffect)(()=>{!l||l.length===0||(!u||!l.some(e=>$(e)===u))&&d($(l[0]))},[l,u]);let f=l?.find(e=>$(e)===u)??null,m=_(p.agentFiles.listAgentFiles),[h,g]=(0,K.useState)({status:`idle`}),v=f?.instanceName??null,b=f?.agentId??null,ne=y(p.compat.forInstance,n&&v!==null?{instanceName:v}:`skip`),x=n&&v!==null?R(ne,`agentFiles`):null,T=x===null?!1:x===`loading`?null:x.blocked,D=(0,K.useCallback)(async()=>{if(!(v===null||b===null)){g({status:`loading`});try{g({status:`done`,files:(await m({instanceName:v,agentId:b})).files})}catch{g({status:`error`})}}},[m,v,b]);(0,K.useEffect)(()=>{T===!1&&D()},[D,T]);let[j,N]=(0,K.useState)(null),P=ae(),I=(0,K.useMemo)(()=>new Intl.NumberFormat(P,{maximumFractionDigits:0}),[P]);return e===void 0||l===void 0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:k()}):(0,Q.jsxs)(`div`,{className:`oc-afiles`,children:[(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:A()}),(0,Q.jsxs)(`div`,{className:`oc-afiles__picker`,children:[t&&(i?.length??0)>1?(0,Q.jsxs)(W,{value:a??``,onValueChange:e=>o(e),children:[(0,Q.jsx)(L,{size:`sm`,"aria-label":oe(),children:(0,Q.jsx)(F,{})}),(0,Q.jsx)(B,{children:(i??[]).map(e=>(0,Q.jsx)(U,{value:e.name,children:e.name},e.name))})]}):null,l.length>0?(0,Q.jsxs)(W,{value:u??``,onValueChange:e=>d(e),children:[(0,Q.jsx)(L,{size:`sm`,"aria-label":re(),children:(0,Q.jsx)(F,{})}),(0,Q.jsx)(B,{children:l.map(e=>(0,Q.jsx)(U,{value:$(e),children:e.label},$(e)))})]}):(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:O()})]}),f===null?null:x===`loading`?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:k()}):x!==null&&x.blocked?(0,Q.jsxs)(`p`,{className:`oc-compat__blocked`,role:`status`,children:[(0,Q.jsx)(H,{size:14,"aria-hidden":!0}),` `,G(x.gatewayVersion)]}):h.status===`loading`||h.status===`idle`?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:k()}):h.status===`error`?(0,Q.jsxs)(`p`,{className:`oc-afiles__error`,role:`alert`,children:[S(),` `,(0,Q.jsx)(M,{variant:`outline`,size:`sm`,onClick:()=>void D(),children:te()})]}):h.files.length===0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:w()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`div`,{className:`oc-afiles__list`,children:h.files.map(e=>{let n=Y(e.size),i=n>=80;return(0,Q.jsxs)(`div`,{className:`oc-afiles__row`,children:[(0,Q.jsx)(`span`,{className:`oc-afiles__name`,title:e.name,children:e.name}),e.missing?(0,Q.jsx)(V,{variant:`outline`,children:C()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`span`,{className:`oc-afiles__size`,children:E({size:Z(e.size,P)})}),(0,Q.jsx)(`span`,{className:`oc-afiles__gauge${i?` is-warn`:``}`,"aria-hidden":!0,children:(0,Q.jsx)(`span`,{className:`oc-afiles__gauge-fill`,style:{width:`${Math.min(n,100)}%`}})}),(0,Q.jsx)(`span`,{className:`oc-afiles__pct`,children:se({pct:I.format(n)})}),i?(0,Q.jsx)(H,{size:14,className:`oc-afiles__warn`,"aria-label":ce()}):(0,Q.jsx)(`span`,{className:`oc-afiles__warn-slot`,"aria-hidden":!0})]}),(0,Q.jsx)(M,{variant:`outline`,size:`sm`,className:`oc-afiles__open`,onClick:()=>N(e),children:t?r():ee()})]},e.name)})}),(0,Q.jsx)(`p`,{className:`oc-afiles__budget`,children:ie({used:Z(be(h.files),P),total:Z(J,P),pct:I.format(X(be(h.files)))})})]}),j&&f?(0,Q.jsx)(Te,{instanceName:f.instanceName,agentId:f.agentId,name:j.name,isAdmin:t,onClose:()=>N(null),onSaved:()=>void D()}):null]})}function Te({instanceName:e,agentId:t,name:n,isAdmin:r,onClose:ee,onSaved:y}){let S=_(p.agentFiles.getAgentFile),re=_(p.agentFiles.setAgentFile),ie=N(),[C,oe]=(0,K.useState)(null),[se,w]=(0,K.useState)(!1),[E,O]=(0,K.useState)(``),[ce,A]=(0,K.useState)(!1),[F,L]=(0,K.useState)(!1),[R,z]=(0,K.useState)(!1),[B,V]=(0,K.useState)(!1),H=(0,K.useCallback)(async r=>{w(!1);try{let i=await S({instanceName:e,agentId:t,name:n});oe({content:i.content,updatedAtMs:i.updatedAtMs}),r||O(i.content),z(!1)}catch{w(!0)}},[S,e,t,n]);(0,K.useEffect)(()=>{H(!1)},[H]);async function U(){if(C!==null){L(!0),V(!1);try{await re({instanceName:e,agentId:t,name:n,content:E,baseUpdatedAtMs:C.updatedAtMs??void 0}),ie.success(o({name:n})),y(),await H(!1)}catch(e){Ce(e)?z(!0):V(!0)}finally{L(!1)}}}let W=C!==null&&E!==C.content,G=(0,K.useMemo)(()=>C===null?null:Se(C.content,E),[C,E]),J=E.length>q,Y=ae(),X=(0,K.useMemo)(()=>new Intl.NumberFormat(Y),[Y]);return(0,Q.jsx)(pe,{open:!0,onOpenChange:e=>!e&&ee(),children:(0,Q.jsxs)(me,{className:`oc-afiles__editor`,children:[(0,Q.jsxs)(fe,{children:[(0,Q.jsx)(he,{children:x({name:n})}),(0,Q.jsxs)(I,{children:[b({agent:t,instance:e}),r?null:(0,Q.jsxs)(Q.Fragment,{children:[` · `,ne()]})]})]}),se?(0,Q.jsxs)(`p`,{className:`oc-afiles__error`,role:`alert`,children:[h(),` `,(0,Q.jsx)(M,{variant:`outline`,size:`sm`,onClick:()=>void H(!1),children:te()})]}):C===null?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:k()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`textarea`,{className:`oc-afiles__source`,value:E,readOnly:!r,spellCheck:!1,onChange:e=>O(e.target.value),"aria-label":x({name:n})}),(0,Q.jsx)(`p`,{className:`oc-afiles__hint`,children:u()}),R?(0,Q.jsxs)(`p`,{className:`oc-afiles__error`,role:`alert`,children:[c(),` `,(0,Q.jsx)(M,{variant:`outline`,size:`sm`,onClick:()=>void H(!0),children:g()})]}):null,B?(0,Q.jsx)(`p`,{className:`oc-afiles__error`,role:`alert`,children:v()}):null,(0,Q.jsxs)(`div`,{className:`oc-afiles__editor-foot`,children:[(0,Q.jsx)(`span`,{className:`oc-afiles__count${J?` is-over`:``}`,children:T({count:X.format(E.length),max:X.format(q)})}),r?(0,Q.jsx)(M,{size:`sm`,disabled:!W||F||R,onClick:()=>A(!0),children:F?s():d()}):null]})]}),(0,Q.jsx)(ye,{open:ce,onOpenChange:A,children:(0,Q.jsxs)(ue,{children:[(0,Q.jsxs)(le,{children:[(0,Q.jsx)(de,{children:i({name:n})}),(0,Q.jsx)(ge,{children:j({agent:t})})]}),G?(0,Q.jsxs)(`div`,{className:`oc-afiles__diff`,children:[(0,Q.jsx)(`p`,{className:`oc-afiles__diff-counts`,children:m({added:G.added,removed:G.removed})}),G.sampleAdded.length>0?(0,Q.jsxs)(`div`,{className:`oc-afiles__diff-block`,children:[(0,Q.jsx)(`span`,{className:`oc-afiles__diff-label`,children:f()}),G.sampleAdded.map((e,t)=>(0,Q.jsx)(`code`,{className:`oc-afiles__diff-line is-add`,children:e||` `},t))]}):null,G.sampleRemoved.length>0?(0,Q.jsxs)(`div`,{className:`oc-afiles__diff-block`,children:[(0,Q.jsx)(`span`,{className:`oc-afiles__diff-label`,children:l()}),G.sampleRemoved.map((e,t)=>(0,Q.jsx)(`code`,{className:`oc-afiles__diff-line is-del`,children:e||` `},t))]}):null]}):null,(0,Q.jsxs)(ve,{children:[(0,Q.jsx)(_e,{children:D()}),(0,Q.jsx)(P,{onClick:()=>void U(),children:a()})]})]})})]})})}export{we as AgentFilesTab};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$u as r,Au as i,Bu as a,Du as o,Eu as s,Fu as ee,Gu as te,Hu as ne,Iu as c,Ju as l,Ku as u,LC as d,Lu as re,Mu as ie,Nu as ae,Ou as oe,Pu as se,Qu as ce,Ru as le,Tu as f,UC as ue,Uu as p,Vu as m,WC as h,Wu as g,Xu as _,Yu as de,Zu as fe,ad as pe,cd as me,dd as v,ed as he,fd as y,id as b,ju as x,ku as S,ld as C,nd as w,od as T,qu as E,rd as D,sd as O,td as k,ud as A,wu as j,zu as M}from"./dist-BhemspoL.js";import{n as N}from"./TimeRangePicker--wX3a-5x.js";import{A as P,C as F,Dt as I,Ot as L,S as R,a as ge,at as _e,b as z,j as ve,m as B,r as ye,x as V,y as H}from"./index-BlZ8oKFa.js";import{t as U}from"./FilterBar-DB-b7WAm.js";import{t as be}from"./DataTableShell-BpD7pA0i.js";import{t as W}from"./dispatchErrorInfo-CIQ2MRwS.js";var G=t(e(),1),K=n(),q=`__all__`,xe=[{value:`open`},{value:`acknowledged`},{value:`resolved`}];function Se(e){return e===`open`?y():e===`acknowledged`?v():A()}var Ce=[`info`,`warn`,`critical`],we=[`detector`,`agent`],Te={kind:`relative`,from:`now-30d`,to:`now`},Ee=200,J=`all`;function Y(){let e=L({from:`/settings/anomalies`}),t=I({from:`/settings/anomalies`}),n=e.q??``,o=e.status===J?q:e.status,s=e.severity??q,f=e.kind??q,[v,y]=(0,G.useState)(q),A=ye(e.from,e.to),{from:j,to:W}=N(A),Y=e=>void t({search:t=>({...t,q:e||void 0}),replace:!0}),X=e=>void t({search:t=>({...t,status:e===q?J:e})}),je=e=>void t({search:t=>({...t,severity:e===q?void 0:e})}),Me=e=>void t({search:t=>({...t,kind:e===q?void 0:e})}),Ne=e=>void t({search:t=>({...t,...ge(e)})}),Pe=ve(),Z=P(),Q=ue(d.anomalies.resolveAnomaly),Fe=(h(d.me.getMe,{host:_e})?.permissions??[]).includes(`admin.manage`),$=h(d.anomalies.listAnomalies,{limit:Ee,filter:{q:n||void 0,from:j,to:W,anomalyStatus:o===q?void 0:o,severity:s===q?void 0:s,source:v===q?void 0:v,kind:f===q?void 0:f}}),Ie=(0,G.useMemo)(()=>{let e=new Set;for(let t of $??[])e.add(t.kind);return[...e].sort()},[$]),Le=n!==``||o!==`open`||s!==q||v!==q||f!==q||A.kind!==`relative`||A.from!==Te.from;function Re(){y(q),t({search:{status:`open`},replace:!0})}async function ze(e){if(await Pe({title:C(),description:(0,K.jsxs)(K.Fragment,{children:[me(),` `,(0,K.jsx)(`span`,{className:`font-mono`,children:e.kind}),` `,O(),` `,(0,K.jsx)(`strong`,{children:T()}),`.`,` `,pe()]}),confirmLabel:b()}))try{await Q({anomalyId:e._id,status:`resolved`}),Z.success(D(),e.kind)}catch(e){Z.error(w(),e)}}async function Be(e){try{await Q({anomalyId:e._id,status:`acknowledged`}),Z.success(k(),e.kind)}catch(e){Z.error(he(),e)}}return(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)(`p`,{className:`oc-admin__hint`,children:[r(),` `,(0,K.jsx)(`strong`,{children:ce()}),` `,fe(),` `,(0,K.jsx)(`strong`,{children:_()}),` `,de(),` `,(0,K.jsx)(`strong`,{children:l()}),` `,E(),` `,(0,K.jsx)(`span`,{className:`oc-filter__window`,children:u()})]}),(0,K.jsxs)(U,{q:n,onQChange:Y,searchPlaceholder:te(),timeRange:A,onTimeRangeChange:Ne,onReset:Re,canReset:Le,children:[(0,K.jsxs)(H,{value:o,onValueChange:X,children:[(0,K.jsx)(R,{size:`sm`,className:`w-36`,children:(0,K.jsx)(F,{})}),(0,K.jsxs)(z,{children:[(0,K.jsx)(V,{value:q,children:g()}),xe.map(e=>(0,K.jsx)(V,{value:e.value,children:Se(e.value)},e.value))]})]}),(0,K.jsxs)(H,{value:s,onValueChange:je,children:[(0,K.jsx)(R,{size:`sm`,className:`w-36`,children:(0,K.jsx)(F,{placeholder:p()})}),(0,K.jsxs)(z,{children:[(0,K.jsx)(V,{value:q,children:ne()}),Ce.map(e=>(0,K.jsx)(V,{value:e,children:e},e))]})]}),(0,K.jsxs)(H,{value:v,onValueChange:y,children:[(0,K.jsx)(R,{size:`sm`,className:`w-32`,children:(0,K.jsx)(F,{placeholder:m()})}),(0,K.jsxs)(z,{children:[(0,K.jsx)(V,{value:q,children:a()}),we.map(e=>(0,K.jsx)(V,{value:e,children:e},e))]})]}),(0,K.jsxs)(H,{value:f,onValueChange:Me,children:[(0,K.jsx)(R,{size:`sm`,className:`w-36`,children:(0,K.jsx)(F,{placeholder:M()})}),(0,K.jsxs)(z,{children:[(0,K.jsx)(V,{value:q,children:le()}),Ie.map(e=>(0,K.jsx)(V,{value:e,children:e},e))]})]})]}),(0,K.jsx)(be,{title:re(),rows:$,emptyHint:o===`open`?c():ee(),rowActions:e=>Fe&&e.status===`open`?[{label:se(),onSelect:()=>void ze(e)},{label:ae(),onSelect:()=>void Be(e)}]:[],columns:[{header:ie(),cell:e=>(0,K.jsx)(`span`,{className:`oc-traces__time`,children:new Date(e.at).toLocaleString(`fr-FR`)}),sort:e=>e.at},{header:M(),cell:e=>(0,K.jsx)(`code`,{className:`oc-traces__mono`,children:e.kind}),sort:e=>e.kind},{header:p(),cell:e=>(0,K.jsx)(Oe,{severity:e.severity}),sort:e=>e.severity===`critical`?2:+(e.severity===`warn`)},{header:x(),cell:e=>(0,K.jsx)(ke,{status:e.status}),sort:e=>e.status===`resolved`?2:+(e.status===`acknowledged`)},{header:m(),cell:e=>(0,K.jsx)(B,{variant:`outline`,children:e.source}),sort:e=>e.source},{header:i(),cell:e=>(0,K.jsx)(`span`,{className:`oc-anomaly__msg`,children:e.message}),sort:e=>e.message},{header:S(),cell:e=>(0,K.jsx)(De,{row:e}),sort:e=>e.evidence??null},{header:oe(),cell:e=>e.correlationId?(0,K.jsx)(`code`,{className:`oc-traces__mono`,children:Ae(e.correlationId)}):(0,K.jsx)(`span`,{className:`oc-traces__muted`,children:`—`}),sort:e=>e.correlationId}]})]})}function X(e){if(e.kind!==`openclaw.dispatch_failures`||!e.evidence)return{};try{let t=JSON.parse(e.evidence);return{dominantCode:t.dominantCode,sampleCorrelationId:t.sampleCorrelationId}}catch{return{}}}function De({row:e}){let t=I(),n=X(e);if(!n.dominantCode)return(0,K.jsx)(`span`,{className:`oc-traces__muted`,children:`—`});let r=W(n.dominantCode),i=n.sampleCorrelationId;return(0,K.jsxs)(`div`,{className:`oc-anomaly__cause`,children:[(0,K.jsxs)(`div`,{className:`oc-anomaly__cause-head`,children:[(0,K.jsx)(`span`,{className:`oc-anomaly__cause-label`,children:r.label}),(0,K.jsx)(`code`,{className:`oc-traces__mono`,children:n.dominantCode})]}),(0,K.jsx)(`p`,{className:`oc-anomaly__cause-hint`,children:r.hint}),i?(0,K.jsxs)(`button`,{type:`button`,className:`oc-anomaly__drill`,onClick:()=>void t({to:`/settings/traces`,search:{q:i,limit:100}}),children:[`↗ `,o()]}):null]})}function Oe({severity:e}){return(0,K.jsx)(`span`,{className:`oc-anomaly__sev oc-anomaly__sev--${e}`,children:e})}function ke({status:e}){return e===`open`?(0,K.jsx)(B,{variant:`destructive`,children:s()}):e===`acknowledged`?(0,K.jsx)(B,{variant:`secondary`,children:f()}):(0,K.jsx)(B,{variant:`outline`,children:j()})}function Ae(e){return e.length>8?e.slice(0,8):e}export{Y as AnomaliesTab};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{LC as r,WC as i,_f as a,af as o,cf as s,df as c,ff as l,gf as u,hf as ee,if as d,lf as f,mf as p,of as m,pf as h,rf as g,sf as _,uf as v}from"./dist-BhemspoL.js";import{n as y}from"./TimeRangePicker--wX3a-5x.js";import{C as b,Dt as x,Ot as S,S as C,a as w,b as T,i as E,o as D,r as O,t as k,x as A,y as j}from"./index-BlZ8oKFa.js";import{t as M}from"./FilterBar-DB-b7WAm.js";import{t as N}from"./AdvancedFilter-EPxqO-eA.js";import{t as P}from"./DataTableShell-BpD7pA0i.js";var F=t(e(),1),I=n(),L={kind:`relative`,from:k,to:`now`},R=`__all__`,z=[{value:`action`,label:`action`},{value:`realLabel`,label:`acteur réel`},{value:`targetLabel`,label:`au nom de`},{value:`impersonated`,label:`usurpation`},{value:`resource`,label:`ressource`},{value:`resourceId`,label:`id ressource`}];function B(){let e=S({from:`/settings/audit`}),t=x({from:`/settings/audit`}),n=e.q??``,k=e.action??R,B=e.impersonated??R,V=e.resource??R,H=O(e.from,e.to),U=(0,F.useMemo)(()=>D(e.adv),[e.adv]),{from:W,to:G}=y(H),K=e=>void t({search:t=>({...t,q:e||void 0}),replace:!0}),q=e=>void t({search:t=>({...t,action:e===R?void 0:e})}),J=e=>void t({search:t=>({...t,impersonated:e===R?void 0:e})}),Y=e=>void t({search:t=>({...t,resource:e===R?void 0:e})}),X=e=>void t({search:t=>({...t,...w(e)})}),Z=e=>void t({search:t=>({...t,adv:E(e)}),replace:!0}),Q=i(r.admin.listAudit,{filter:{q:n||void 0,from:W,to:G,action:k===R?void 0:k,resource:V===R?void 0:V,impersonated:B===R?void 0:B===`yes`,advanced:U.length>0?U:void 0}}),$=(0,F.useMemo)(()=>{let e=new Set;for(let t of Q??[])e.add(t.action);return[...e].sort()},[Q]),te=(0,F.useMemo)(()=>{let e=new Set;for(let t of Q??[])t.resource&&e.add(t.resource);return[...e].sort()},[Q]),ne=n!==``||k!==R||B!==R||V!==R||U.length>0||H.kind!==`relative`||H.from!==L.from;function re(){t({search:{},replace:!0})}return(0,I.jsxs)(I.Fragment,{children:[(0,I.jsxs)(`p`,{className:`oc-admin__hint`,children:[a(),` `,(0,I.jsx)(`span`,{className:`oc-filter__window`,children:u()})]}),(0,I.jsxs)(M,{q:n,onQChange:K,searchPlaceholder:ee(),timeRange:H,onTimeRangeChange:X,onReset:re,canReset:ne,children:[(0,I.jsxs)(j,{value:k,onValueChange:q,children:[(0,I.jsx)(C,{size:`sm`,className:`w-40`,children:(0,I.jsx)(b,{placeholder:p()})}),(0,I.jsxs)(T,{children:[(0,I.jsx)(A,{value:R,children:h()}),$.map(e=>(0,I.jsx)(A,{value:e,children:e},e))]})]}),(0,I.jsxs)(j,{value:B,onValueChange:J,children:[(0,I.jsx)(C,{size:`sm`,className:`w-40`,children:(0,I.jsx)(b,{})}),(0,I.jsxs)(T,{children:[(0,I.jsx)(A,{value:R,children:l()}),(0,I.jsx)(A,{value:`yes`,children:c()}),(0,I.jsx)(A,{value:`no`,children:v()})]})]}),(0,I.jsxs)(j,{value:V,onValueChange:Y,children:[(0,I.jsx)(C,{size:`sm`,className:`w-40`,children:(0,I.jsx)(b,{placeholder:f()})}),(0,I.jsxs)(T,{children:[(0,I.jsx)(A,{value:R,children:s()}),te.map(e=>(0,I.jsx)(A,{value:e,children:e},e))]})]})]}),(0,I.jsx)(N,{fields:z,seed:U,onChange:Z}),(0,I.jsx)(P,{title:_(),rows:Q,emptyHint:m(),columns:[{header:o(),cell:e=>new Date(e.at).toLocaleString(`fr-FR`),sort:e=>e.at},{header:p(),cell:e=>e.action,sort:e=>e.action},{header:d(),cell:e=>e.realLabel,sort:e=>e.realLabel},{header:g(),cell:e=>e.targetLabel??`—`,sort:e=>e.targetLabel??null},{header:f(),cell:e=>e.resource?e.resource+(e.resourceId?` · ${e.resourceId.slice(0,8)}`:``):`—`,sort:e=>e.resource??null}]})]})}export{B as AuditTab};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{As as r,Bs as i,Cs as a,Ds as o,Ec as s,Es as c,Fs as l,Gs as u,Hs as d,Is as f,LC as p,Ls as m,Ms as h,Ns as g,Os as _,Ps as v,RC as y,Rs as ee,Sc as te,Ss as b,Tc as x,Ts as S,UC as ne,Us as re,VC as ie,Vs as ae,WC as C,Ws as oe,_ as w,_c as se,_s as T,a as ce,as as le,b as ue,bc as de,bs as fe,cs as pe,d as me,ds as he,f as ge,fs as _e,g as ve,gc as ye,gs as be,h as xe,hc as Se,hs as Ce,is as E,js as we,ks as Te,l as Ee,ls as De,m as Oe,mc as ke,ms as Ae,os as je,p as Me,pc as Ne,ps as Pe,rs as D,ss as Fe,u as Ie,us as Le,v as Re,vc as ze,vs as Be,wc as Ve,ws as He,xc as Ue,xs as We,y as Ge,yc as Ke,ys as qe,zs as Je}from"./dist-BhemspoL.js";import{i as O,r as Ye}from"./dist-BiCy_qcc.js";import{t as Xe}from"./chevrons-up-down-Dn5VCqqo.js";import{a as Ze,i as Qe,n as k,o as $e,r as et}from"./FieldLabel-CFckKZrw.js";import{t as A}from"./button-x4eiKyNo.js";import{$ as tt,A as nt,C as j,Dt as rt,Et as it,F as at,J as ot,L as st,N as ct,O as lt,P as ut,Q as dt,R as ft,S as M,St as pt,Tt as mt,X as ht,Y as gt,Z as _t,at as vt,b as N,gt as yt,m as P,nt as bt,pt as F,q as I,x as L,xt,y as R}from"./index-BlZ8oKFa.js";import{a as St,i as z,n as Ct,o as B,r as V,t as wt}from"./table-BQp_EgUj.js";import{t as Tt}from"./FilterBar-DB-b7WAm.js";import{a as H,n as Et,o as U,r as W,s as Dt,t as Ot}from"./compatView-D1fAiei9.js";import{t as G}from"./dispatchErrorInfo-CIQ2MRwS.js";var kt=y(`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`}]]),At=y(`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`}]]),K=t(e(),1);function jt(e){return e.filter(e=>e.state===`error`)}function Mt(e){return e.reachable&&jt(e.targets).length===0}function Nt(e){return e.state===`error`&&e.lastErrorCode!==null}function Pt(e){return!!e.lastDownstreamRejectCode}function q(e){return e.kind??`openclaw`}function Ft(e){return[...e].sort((e,t)=>e===`openclaw`?-1:t===`openclaw`?1:e.localeCompare(t))}function It(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,q(e));let i=e=>(e.instanceName?r.get(e.instanceName):void 0)??`openclaw`,a=new Set;for(let e of n)a.add(q(e));for(let e of t)a.add(e.provider);for(let t of e)a.add(i(t));return Ft(a).map(r=>({key:r,connections:e.filter(e=>i(e)===r),compatTargets:t.filter(e=>e.provider===r),instances:n.filter(e=>q(e)===r)}))}function Lt(e){return e===`openclaw`?`OpenClaw`:e===`hermes`?`Hermes`:e.charAt(0).toUpperCase()+e.slice(1)}var J=`__all__`,Rt={q:``,state:J,instance:J,version:J},Y={connected:0,error:1,idle:2};function zt(e){return e.q.trim()!==``||e.state!==`__all__`||e.instance!==`__all__`||e.version!==`__all__`}function Bt(e,t){let n=t.q.trim().toLowerCase();return e.filter(e=>!(n&&!`${e.targetLabel} ${e.gatewayHost}`.toLowerCase().includes(n)||t.state!==`__all__`&&e.state!==t.state||t.instance!==`__all__`&&(e.instanceName??``)!==t.instance||t.version!==`__all__`&&(e.gatewayVersion??``)!==t.version))}function X(e,t){return e.localeCompare(t,void 0,{numeric:!0,sensitivity:`base`})}function Vt(e,t){return e===`version`?t.gatewayVersion===null:e===`lastOk`?t.lastOkAt===null:!1}function Ht(e,t,n){switch(e){case`state`:return(Y[t.state]??99)-(Y[n.state]??99);case`instance`:return X(t.instanceLabel??t.instanceName??``,n.instanceLabel??n.instanceName??``);case`host`:return X(t.gatewayHost,n.gatewayHost);case`version`:{let e=t.gatewayVersion,r=n.gatewayVersion;return U(e,r)??X(e,r)}case`lastOk`:return t.lastOkAt-n.lastOkAt;default:return X(t.targetLabel,n.targetLabel)}}function Ut(e,t){if(!t)return e;let n=t.dir===`asc`?1:-1;return[...e].sort((e,r)=>{let i=Vt(t.key,e),a=Vt(t.key,r);return i&&a?0:i?1:a?-1:n*Ht(t.key,e,r)})}function Wt(e){let t=new Set;for(let n of e)t.add(n.state);return[...t].sort((e,t)=>(Y[e]??99)-(Y[t]??99))}function Gt(e){let t=new Map;for(let n of e)n.instanceName!==null&&(t.has(n.instanceName)||t.set(n.instanceName,n.instanceLabel??n.instanceName));return[...t.entries()].map(([e,t])=>({name:e,label:t})).sort((e,t)=>X(e.label,t.label))}function Kt(e){let t=new Set;for(let n of e)n.gatewayVersion!==null&&t.add(n.gatewayVersion);return[...t].sort((e,t)=>U(e,t)??X(e,t))}var Z=n();function qt({connections:e,displayByInstance:t}){let[n,r]=(0,K.useState)(Rt),[i,a]=(0,K.useState)(null),o=(0,K.useMemo)(()=>e.map((e,n)=>({_id:`${e.key}:${e.canonical}/${e.agentId}:${n}`,targetLabel:`${e.canonical}/${e.agentId}`,state:e.state,instanceName:e.instanceName??null,instanceLabel:e.instanceName?t.get(e.instanceName)??e.instanceName:null,gatewayHost:e.gatewayHost,gatewayVersion:e.gatewayVersion??null,okCount:e.okCount,errorCount:e.errorCount,attempts:e.attempts,lastOkAt:e.lastOkAt??null,lastErrorCode:e.lastErrorCode??null,lastErrorAt:e.lastErrorAt??null,lastDownstreamRejectCode:e.lastDownstreamRejectCode??null,lastDownstreamRejectAt:e.lastDownstreamRejectAt??null})),[e,t]),s=(0,K.useMemo)(()=>Wt(o),[o]),c=(0,K.useMemo)(()=>Gt(o),[o]),l=(0,K.useMemo)(()=>Kt(o),[o]),u=(0,K.useMemo)(()=>Ut(Bt(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:We()}):(0,Z.jsxs)(`div`,{className:`oc-conn`,children:[(0,Z.jsxs)(Tt,{q:n.q,onQChange:e=>r(t=>({...t,q:e})),searchPlaceholder:Be(),onReset:()=>r(Rt),canReset:zt(n),children:[(0,Z.jsxs)(R,{value:n.state,onValueChange:e=>r(t=>({...t,state:e})),children:[(0,Z.jsx)(M,{size:`sm`,className:`w-36`,children:(0,Z.jsx)(j,{placeholder:be()})}),(0,Z.jsxs)(N,{children:[(0,Z.jsx)(L,{value:J,children:T()}),s.map(e=>(0,Z.jsx)(L,{value:e,children:Yt(e)},e))]})]}),(0,Z.jsxs)(R,{value:n.instance,onValueChange:e=>r(t=>({...t,instance:e})),children:[(0,Z.jsx)(M,{size:`sm`,className:`w-40`,children:(0,Z.jsx)(j,{placeholder:Ce()})}),(0,Z.jsxs)(N,{children:[(0,Z.jsx)(L,{value:J,children:T()}),c.map(e=>(0,Z.jsx)(L,{value:e.name,children:e.label},e.name))]})]}),(0,Z.jsxs)(R,{value:n.version,onValueChange:e=>r(t=>({...t,version:e})),children:[(0,Z.jsx)(M,{size:`sm`,className:`w-36`,children:(0,Z.jsx)(j,{placeholder:Ae()})}),(0,Z.jsxs)(N,{children:[(0,Z.jsx)(L,{value:J,children:T()}),l.map(e=>(0,Z.jsx)(L,{value:e,children:e},e))]})]})]}),u.length===0?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:Pe()}):(0,Z.jsxs)(wt,{className:`oc-conn__table`,children:[(0,Z.jsx)(St,{children:(0,Z.jsxs)(B,{children:[(0,Z.jsx)(Q,{label:_e(),sortKey:`target`,sort:i,onSort:d}),(0,Z.jsx)(Q,{label:he(),sortKey:`state`,sort:i,onSort:d}),(0,Z.jsx)(Q,{label:Le(),sortKey:`instance`,sort:i,onSort:d}),(0,Z.jsx)(Q,{label:De(),sortKey:`host`,sort:i,onSort:d}),(0,Z.jsx)(Q,{label:pe(),sortKey:`version`,sort:i,onSort:d}),(0,Z.jsx)(z,{children:Fe()}),(0,Z.jsx)(Q,{label:je(),sortKey:`lastOk`,sort:i,onSort:d})]})}),(0,Z.jsx)(Ct,{children:u.map(e=>(0,Z.jsx)(Jt,{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)(z,{"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)(Ye,{size:13,"aria-hidden":!0}):(0,Z.jsx)(O,{size:13,"aria-hidden":!0}):(0,Z.jsx)(Xe,{size:13,"aria-hidden":!0,className:`oc-conn__sort-idle`})]})})}function Jt({r:e}){let t=Nt(e)?G(e.lastErrorCode):null,n=Pt(e)?G(e.lastDownstreamRejectCode):null;return(0,Z.jsxs)(K.Fragment,{children:[(0,Z.jsxs)(B,{className:`oc-conn__row oc-conn__row--${e.state}`,children:[(0,Z.jsx)(V,{children:(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:e.targetLabel})}),(0,Z.jsx)(V,{children:(0,Z.jsx)(Xt,{state:e.state})}),(0,Z.jsx)(V,{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)(V,{children:(0,Z.jsx)(`span`,{className:`oc-bridge-target__host`,children:e.gatewayHost})}),(0,Z.jsx)(V,{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)(V,{children:(0,Z.jsx)(`span`,{className:`oc-conn__stats`,children:fe({ok:e.okCount,errors:e.errorCount,attempts:e.attempts})})}),(0,Z.jsx)(V,{children:e.lastOkAt?(0,Z.jsx)(`span`,{className:`oc-traces__mono`,children:new Date(e.lastOkAt).toLocaleTimeString(`fr-FR`)}):(0,Z.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})})]}),t||n?(0,Z.jsx)(B,{className:`oc-conn__detail-row`,children:(0,Z.jsxs)(V,{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?` · ${new Date(e.lastErrorAt).toLocaleTimeString(`fr-FR`)}`:``,(0,Z.jsx)(`p`,{className:`oc-bridge-card__hint`,children:t.hint})]}):null,n?(0,Z.jsxs)(`div`,{className:`oc-bridge-target__downstream`,children:[qe({label:n.label}),` `,(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:e.lastDownstreamRejectCode}),e.lastDownstreamRejectAt?` · ${new Date(e.lastDownstreamRejectAt).toLocaleTimeString(`fr-FR`)}`:``]}):null]})}):null]})}function Yt(e){return e===`connected`?le():e===`error`?E():D()}function Xt({state:e}){return e===`connected`?(0,Z.jsx)(P,{variant:`secondary`,children:le()}):e===`error`?(0,Z.jsx)(P,{variant:`destructive`,children:E()}):(0,Z.jsx)(P,{variant:`outline`,children:D()})}function Zt(){return C(p.bridgeHealth.getBridgeHealth,{})}function Qt(){let e=Zt(),t=C(p.compat.getBridgeCompat,{}),n=C(p.me.getMe,{host:vt})?.role===`admin`,r=C(p.admin.listInstances,n?{}:`skip`),i=rt(),a=()=>void i({to:`/settings/anomalies`,search:{status:`open`}}),o=It(e?e.targets:[],t?t.targets:[],r??[]),s=t?.compat??null,c=t===void 0?`loading`:t===null?`nodata`:`ready`,l=s!==null&&Et(s,`hermes`)&&!o.some(e=>e.key===`hermes`);return(0,Z.jsxs)(`div`,{className:`oc-bridge`,children:[(0,Z.jsx)($t,{health:e,compat:t,onSeeAnomalies:a}),(0,Z.jsx)(`p`,{className:`oc-admin__hint oc-bridge__caption`,children:we()}),o.map(e=>(0,Z.jsx)(en,{providerKey:e.key,connections:e.connections,instances:e.instances,manifest:s,compatStatus:c,compatReachable:t?.reachable??!0},e.key)),l?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:ce()}):null]})}function $t({health:e,compat:t,onSeeAnomalies:n}){let i=t&&t!==null?(0,Z.jsxs)(`span`,{className:`oc-bridge-card__ver`,children:[(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:H(t.bridgeVersion)}),` · `,Re(),` `,(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:t.protocolVersion===null?w():String(t.protocolVersion)})]}):null;if(e===void 0)return(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:r()});if(e===null)return(0,Z.jsx)(`div`,{className:`oc-bridge-card oc-bridge-card--idle`,children:Te()});let s=jt(e.targets),l=!e.reachable,u=Mt(e),d=u?`ok`:`error`,f=new Date(e.checkedAt).toLocaleString(`fr-FR`),p=e.startedAt==null?null:new Date(e.startedAt).toLocaleString(`fr-FR`);return(0,Z.jsxs)(`div`,{className:`oc-bridge-card oc-bridge-card--${d}`,children:[(0,Z.jsx)(`div`,{className:`oc-bridge-card__icon`,"aria-hidden":!0,children:u?(0,Z.jsx)(mt,{size:22}):l?(0,Z.jsx)(At,{size:22}):(0,Z.jsx)(F,{size:22})}),(0,Z.jsxs)(`div`,{className:`oc-bridge-card__body`,children:[(0,Z.jsx)(`div`,{className:`oc-bridge-card__title`,children:u?_():l?o():c({count:s.length})}),(0,Z.jsxs)(`div`,{className:`oc-bridge-card__meta`,children:[(0,Z.jsxs)(`span`,{children:[(0,Z.jsx)(kt,{size:12,"aria-hidden":!0}),` `,S({time:f})]}),p?(0,Z.jsx)(`span`,{children:He({time:p})}):null,i]}),l?(0,Z.jsx)(`p`,{className:`oc-bridge-card__hint`,children:G(e.lastError===`not_configured`?`NOT_CONFIGURED`:`BRIDGE_UNREACHABLE`).hint}):null]}),(0,Z.jsx)(`button`,{type:`button`,className:`oc-bridgebar__drill`,onClick:n,children:a()})]})}function en({providerKey:e,connections:t,instances:n,manifest:r,compatStatus:i,compatReachable:a}){let o=r?Dt(r,e):null,s=new Map;for(let e of n)s.set(e.name,e.displayName??e.name);let c=[],l=new Set;for(let n of t){if(!n.instanceName||l.has(n.instanceName))continue;l.add(n.instanceName);let t=n.gatewayVersion??null;c.push({instanceName:n.instanceName,displayName:s.get(n.instanceName)??n.instanceName,version:t,state:Ot(t,e,r)})}let u=c.map(e=>e.state),d=u.includes(`beyond`)?`beyond`:u.length>0&&u.every(e=>e===`supported`)?`supported`:null,[f,p]=(0,K.useState)(!1),[m,h]=(0,K.useState)(null),g=m===null?null:n.find(e=>e.name===m)??null,_=new Set(n.map(e=>e.name));return(0,Z.jsxs)(`section`,{className:`oc-bridge-provider`,children:[(0,Z.jsxs)(`header`,{className:`oc-bridge-provider__head`,children:[(0,Z.jsx)(yt,{size:15,"aria-hidden":!0,className:`oc-bridge-provider__icon`}),(0,Z.jsx)(`span`,{className:`oc-bridge-provider__name`,children:Lt(e)}),d?(0,Z.jsx)(P,{variant:d===`beyond`?`destructive`:`secondary`,children:W(d)}):null]}),(0,Z.jsx)(`h4`,{className:`oc-bridge-provider__sub`,children:ue()}),(0,Z.jsx)(tn,{support:o,compatStatus:i,compatReachable:a,manifest:r,instanceRows:c,canConfigure:e=>_.has(e),onConfigure:h}),(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)(O,{size:13,"aria-hidden":!0}):(0,Z.jsx)(it,{size:13,"aria-hidden":!0}),b({count:t.length})]}),f?(0,Z.jsx)(qt,{connections:t,displayByInstance:s}):null,g?(0,Z.jsx)(nn,{instance:g,onClose:()=>h(null)},g._id):null]})}function tn({support:e,compatStatus:t,compatReachable:n,manifest:i,instanceRows:a,canConfigure:o,onConfigure:s}){return t===`loading`?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:r()}):t===`nodata`?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:Ge()}):(0,Z.jsxs)(`div`,{className:`oc-compat`,children:[n?null:(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:ve()}),i===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:Oe()}),e&&e.range!==null?(0,Z.jsx)(`span`,{children:Me({min:e.range.min,max:e.range.maxValidated})}):(0,Z.jsx)(`span`,{children:w()}),e?(0,Z.jsx)(an,{versions:e.validatedVersions}):null]}),a.length===0?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:Ee()}):(0,Z.jsx)(`div`,{className:`oc-compat__targets`,children:a.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:H(e.version)}),(0,Z.jsx)(P,{variant:e.state===`supported`?`secondary`:e.state===`beyond`?`destructive`:`outline`,children:W(e.state)}),o(e.instanceName)?(0,Z.jsxs)(_t,{children:[(0,Z.jsx)(bt,{asChild:!0,children:(0,Z.jsx)(A,{variant:`ghost`,size:`icon`,className:`oc-compat__target-menu`,"aria-label":x(),children:(0,Z.jsx)(pt,{size:16,"aria-hidden":!0})})}),(0,Z.jsx)(dt,{align:`end`,children:(0,Z.jsx)(tt,{onSelect:()=>s(e.instanceName),children:x()})})]}):null]},e.instanceName))})]})}function nn({instance:e,onClose:t}){return(0,Z.jsx)(ct,{open:!0,onOpenChange:e=>!e&&t(),children:(0,Z.jsxs)(ut,{className:`oc-bridge-config-dialog`,onOpenAutoFocus:e=>e.preventDefault(),children:[(0,Z.jsxs)(st,{children:[(0,Z.jsx)(ft,{children:s({instance:e.displayName??e.name})}),(0,Z.jsx)(at,{children:Ve()})]}),(0,Z.jsx)(rn,{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)(mt,{"aria-hidden":!0}):(0,Z.jsx)(F,{"aria-hidden":!0}),(0,Z.jsxs)(`span`,{children:[e,` — `,t.ok?l():t.detail]})]}):(0,Z.jsxs)(`p`,{className:`oc-bridge-config__check-row oc-bridge-config__check-row--skip`,children:[e,` — `,v()]}):null}function rn({instance:e,onClose:t}){let n=ne(p.admin.upsertInstanceConfig),r=ie(p.bridge.validateMediaPaths),a=nt(),[o,s]=(0,K.useState)(()=>Qe(e.config??{})),[c,l]=(0,K.useState)(!1),[_,v]=(0,K.useState)(!1),[y,b]=(0,K.useState)(null),x=o.inboundMediaMode===`shared-fs`,S=o.mediaMode===`shared-fs`,C=x||S;async function w(){v(!0),b(null);try{b(await r({instanceName:e.name,inboundMediaMode:o.inboundMediaMode,mediaMode:o.mediaMode}))}catch(e){a.error(Je(),e)}finally{v(!1)}}async function T(){l(!0);try{let r=e.config??{};await n({instanceId:e._id,config:et(o,r)}),t()}catch(e){a.error(se(),e)}finally{l(!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)(k,{label:te(),help:ye()}),(0,Z.jsxs)(R,{value:o.mediaMode,onValueChange:e=>s({...o,mediaMode:e}),children:[(0,Z.jsx)(M,{size:`sm`,className:`w-full`,children:(0,Z.jsx)(j,{})}),(0,Z.jsx)(N,{children:$e.map(e=>(0,Z.jsx)(L,{value:e,children:e},e))})]})]}),(0,Z.jsxs)(`label`,{className:`oc-field`,children:[(0,Z.jsx)(k,{label:Ue(),help:Se()}),(0,Z.jsxs)(R,{value:o.inboundMediaMode,onValueChange:e=>s({...o,inboundMediaMode:e}),children:[(0,Z.jsx)(M,{size:`sm`,className:`w-full`,children:(0,Z.jsx)(j,{})}),(0,Z.jsx)(N,{children:Ze.map(e=>(0,Z.jsx)(L,{value:e,children:e},e))})]})]}),(0,Z.jsxs)(`label`,{className:`oc-field`,children:[(0,Z.jsx)(k,{label:de(),help:ke()}),(0,Z.jsx)(I,{type:`number`,min:1,max:4096,className:`w-full`,value:o.mediaMaxMb,onChange:e=>s({...o,mediaMaxMb:Math.trunc(Number(e.target.value)||0)})})]})]}),C&&(0,Z.jsxs)(`div`,{className:`oc-bridge-config__grid`,children:[x&&(0,Z.jsxs)(`label`,{className:`oc-field`,children:[(0,Z.jsx)(k,{label:u(),help:oe()}),(0,Z.jsx)(I,{className:`w-full`,spellCheck:!1,value:o.inboundAgentMount,onChange:e=>s({...o,inboundAgentMount:e.target.value})})]}),S&&(0,Z.jsxs)(`label`,{className:`oc-field`,children:[(0,Z.jsx)(k,{label:re(),help:d()}),(0,Z.jsx)(I,{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)(lt,{checked:o.rehydration,onCheckedChange:e=>s({...o,rehydration:e===!0})}),(0,Z.jsx)(k,{label:Ke(),help:Ne()})]}),C&&y!==null&&(0,Z.jsx)(`div`,{className:`oc-bridge-config__check`,children:y.reachable?!y.inbound&&!y.outbound?(0,Z.jsxs)(`p`,{className:`oc-bridge-config__check-row oc-bridge-config__check-row--err`,children:[(0,Z.jsx)(F,{"aria-hidden":!0}),h({reason:y.reason??`?`})]}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)($,{label:m(),result:y.inbound}),(0,Z.jsx)($,{label:f(),result:y.outbound}),(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:ee()})]}):(0,Z.jsxs)(`p`,{className:`oc-bridge-config__check-row oc-bridge-config__check-row--err`,children:[(0,Z.jsx)(F,{"aria-hidden":!0}),g()]})}),(0,Z.jsxs)(`div`,{className:`oc-bridge-config__actions`,children:[C&&(0,Z.jsxs)(A,{variant:`outline`,size:`sm`,onClick:()=>void w(),disabled:_,children:[_?(0,Z.jsx)(xt,{className:`size-4 animate-spin`,"aria-hidden":!0}):null,_?i():ae()]}),(0,Z.jsx)(A,{size:`sm`,onClick:()=>void T(),disabled:c,children:ze()})]})]})})}function an({versions:e}){if(e.length===0)return null;let t=[...e].reverse();return(0,Z.jsxs)(ot,{children:[(0,Z.jsx)(ht,{asChild:!0,children:(0,Z.jsxs)(`button`,{type:`button`,className:`oc-compat__versions-btn`,children:[e.length===1?ge():me({count:e.length}),(0,Z.jsx)(O,{size:13,"aria-hidden":!0})]})}),(0,Z.jsxs)(gt,{className:`oc-compat__versions-pop`,align:`start`,children:[(0,Z.jsx)(`p`,{className:`oc-compat__versions-title`,children:Ie()}),(0,Z.jsx)(`div`,{className:`oc-compat__versions-list`,children:t.map(e=>(0,Z.jsx)(P,{variant:`secondary`,children:e},e))})]})]})}export{Qt as BridgeTab,nn as InstanceConfigDialog};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{A as r,C as i,Cc as a,D as o,E as s,Gt as c,LC as l,M as ee,N as te,O as ne,Rt as re,S as ie,T as ae,Ut as u,VC as d,WC as f,j as oe,k as p,lt as m,rv as h,uC as g,w as se,x as ce,zt as le}from"./dist-BhemspoL.js";import{t as _}from"./button-x4eiKyNo.js";import{A as ue,B as de,C as fe,G as pe,H as me,K as he,S as v,U as y,V as b,W as x,_ as S,b as C,g as w,pt as T,v as E,x as D,y as O,z as k}from"./index-BlZ8oKFa.js";import{i as A}from"./compatView-D1fAiei9.js";/* empty css */var j=t(e(),1),M=[`off`,`minimal`,`low`,`medium`,`high`,`xhigh`];function N(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 P=n();function F(){let e=d(l.agentFiles.getChatDefaults),t=d(l.agentFiles.setChatDefaults),n=ue(),[F,I]=(0,j.useState)({status:`loading`}),[L,R]=(0,j.useState)({thinkingDefault:null,fastModeDefault:null}),[ge,z]=(0,j.useState)(!1),[B,V]=(0,j.useState)(!1),H=f(l.admin.listInstances,{}),[U,W]=(0,j.useState)(null);(0,j.useEffect)(()=>{!H||H.length===0||(!U||!H.some(e=>e.name===U))&&W(H[0].name)},[H,U]);let G=(H?.length??0)>1,_e=H!==void 0&&H.length===0,ve=f(l.compat.forInstance,U?{instanceName:U}:`skip`),K=U?S(ve,`configDefaults`):`loading`,q=K===`loading`?null:K.blocked,J=(0,j.useMemo)(()=>G&&U?{instanceName:U}:{},[G,U]),Y=(0,j.useRef)(0),X=(0,j.useCallback)(async()=>{let t=++Y.current;I({status:`loading`});try{let n=N(await e(J));if(Y.current!==t)return;I({status:`done`,current:n}),R(n)}catch{if(Y.current!==t)return;I({status:`error`})}},[e,J]);(0,j.useEffect)(()=>{q===!1&&(G&&!U||X())},[X,q,G,U]);let Z=F.status===`done`?F.current:null,Q=Z!==null&&L.thinkingDefault!==null&&L.thinkingDefault!==Z.thinkingDefault,$=Z!==null&&L.fastModeDefault!==null&&L.fastModeDefault!==Z.fastModeDefault,ye=Q||$;async function be(){V(!0);try{await t({...J,...Q?{thinkingDefault:L.thinkingDefault}:{},...$?{fastModeDefault:L.fastModeDefault}:{}}),n.success(s()),await X()}catch(e){n.error(ae(),e)}finally{V(!1)}}let xe=(0,j.useMemo)(()=>M.map(e=>({id:e,label:E(e)})),[]),Se=(0,j.useMemo)(()=>[{id:`fast`,label:le()},{id:`standard`,label:re()}],[]);return(0,P.jsxs)(`div`,{className:`oc-cdefaults`,children:[(0,P.jsx)(`p`,{className:`oc-admin__hint`,children:te()}),G&&U?(0,P.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,P.jsx)(`span`,{className:`oc-cdefaults__label`,children:m()}),(0,P.jsxs)(O,{value:U,onValueChange:e=>W(e),disabled:B,children:[(0,P.jsx)(v,{size:`sm`,"aria-label":m(),children:(0,P.jsx)(fe,{})}),(0,P.jsx)(C,{children:(H??[]).map(e=>(0,P.jsx)(D,{value:e.name,children:e.name},e.name))})]})]}):null,_e?(0,P.jsx)(`p`,{className:`oc-admin__hint`,role:`status`,children:a()}):K===`loading`?(0,P.jsx)(`p`,{className:`oc-admin__hint`,children:g()}):K.blocked?(0,P.jsxs)(`p`,{className:`oc-compat__blocked`,role:`status`,children:[(0,P.jsx)(T,{size:14,"aria-hidden":!0}),` `,A(K.gatewayVersion)]}):F.status===`loading`?(0,P.jsx)(`p`,{className:`oc-admin__hint`,children:g()}):F.status===`error`?(0,P.jsxs)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:[ne(),` `,(0,P.jsx)(_,{variant:`outline`,size:`sm`,onClick:()=>void X(),children:u()})]}):(0,P.jsxs)(P.Fragment,{children:[(0,P.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,P.jsx)(`span`,{className:`oc-cdefaults__label`,children:ee()}),(0,P.jsx)(w,{options:xe,value:L.thinkingDefault,onChange:e=>R({...L,thinkingDefault:e}),disabled:B}),(0,P.jsx)(`p`,{className:`oc-cdefaults__help`,children:oe()})]}),(0,P.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,P.jsx)(`span`,{className:`oc-cdefaults__label`,children:r()}),(0,P.jsx)(w,{options:Se,value:L.fastModeDefault===null?null:L.fastModeDefault?`fast`:`standard`,onChange:e=>R({...L,fastModeDefault:e===`fast`}),disabled:B}),(0,P.jsx)(`p`,{className:`oc-cdefaults__help`,children:p()})]}),(0,P.jsx)(`div`,{className:`oc-cdefaults__actions`,children:(0,P.jsx)(_,{size:`sm`,disabled:!ye||B,onClick:()=>z(!0),children:B?c():o()})}),(0,P.jsx)(`p`,{className:`oc-cdefaults__note`,children:se()})]}),(0,P.jsx)(k,{open:ge,onOpenChange:z,children:(0,P.jsxs)(me,{children:[(0,P.jsxs)(pe,{children:[(0,P.jsx)(he,{children:i()}),(0,P.jsx)(y,{children:ie()})]}),(0,P.jsxs)(x,{children:[(0,P.jsx)(b,{children:h()}),(0,P.jsx)(de,{onClick:()=>void be(),children:ce()})]})]})})]})}export{F as ChatDefaultsTab};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Gi as r,Ji as i,Ki as a,Wi as o,Xi as s,Yi as c,qi as l}from"./dist-BhemspoL.js";import{i as u,r as d}from"./dist-BiCy_qcc.js";import{t as f}from"./chevrons-up-down-Dn5VCqqo.js";import{t as p}from"./button-x4eiKyNo.js";import{$ as m,O as h,Q as g,St as _,Z as v,mt as y,nt as b,tt as x,yt as S}from"./index-BlZ8oKFa.js";import{a as C,i as w,n as T,o as E,r as D,t as O}from"./table-BQp_EgUj.js";var k=t(e(),1);function A(e,t){return typeof e==`number`&&typeof t==`number`?e-t:typeof e==`boolean`&&typeof t==`boolean`?!!e-+!!t:String(e).localeCompare(String(t),void 0,{numeric:!0,sensitivity:`base`})}function j(e,t,n){return[...e].sort((e,r)=>{let i=t(e),a=t(r),o=i==null,s=a==null;if(o||s)return o&&s?0:o?1:-1;let c=A(i,a);return n===`asc`?c:-c})}var M=n();function N({title:e,rows:t,columns:n,rowActions:A,onAdd:N,addLabel:P=s(),bulkActions:F,emptyHint:I=c(),isExpanded:L,renderExpanded:R}){let[z,B]=(0,k.useState)(new Set),[V,H]=(0,k.useState)(null),U=t??[],W=V?n[V.index]:void 0,G=V&&W?.sort?j(U,W.sort,V.dir):U;function K(e){H(t=>!t||t.index!==e?{index:e,dir:`asc`}:t.dir===`asc`?{index:e,dir:`desc`}:null)}let q=+!!F+n.length+ +!!A,J=U.length>0&&z.size===U.length,Y=z.size>0&&!J;function X(){B(J?new Set:new Set(U.map(e=>e._id)))}function Z(e){B(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})}return(0,M.jsxs)(`div`,{className:`oc-dt`,children:[(0,M.jsxs)(`div`,{className:`oc-dt__bar`,children:[(0,M.jsx)(`h2`,{className:`oc-dt__title`,children:e}),(0,M.jsxs)(`div`,{className:`oc-dt__bar-actions`,children:[z.size>0&&F?F.map(e=>(0,M.jsxs)(p,{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)(p,{size:`sm`,onClick:N,children:[(0,M.jsx)(S,{}),` `,P]}):null]})]}),t===void 0?(0,M.jsx)(`p`,{className:`oc-admin__hint`,children:i()}):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)(h,{"aria-label":l(),checked:J?!0:Y?`indeterminate`:!1,onCheckedChange:X})}):null,n.map((e,t)=>{let n=V?.index===t;return e.sort?(0,M.jsx)(w,{className:e.className,"aria-sort":n?V.dir===`asc`?`ascending`:`descending`:`none`,children:(0,M.jsxs)(`button`,{type:`button`,className:`oc-dt__sort`,onClick:()=>K(t),"aria-label":o({column:e.header}),children:[e.header,n?V.dir===`asc`?(0,M.jsx)(d,{className:`oc-dt__sort-icon`,"aria-hidden":!0}):(0,M.jsx)(u,{className:`oc-dt__sort-icon`,"aria-hidden":!0}):(0,M.jsx)(f,{className:`oc-dt__sort-icon oc-dt__sort-icon--idle`,"aria-hidden":!0})]})},e.header):(0,M.jsx)(w,{className:e.className,children:e.header},e.header)}),A?(0,M.jsx)(w,{className:`w-8`}):null]})}),(0,M.jsx)(T,{children:G.map(e=>{let t=A?.(e)??[],i=L?.(e)??!1;return(0,M.jsxs)(k.Fragment,{children:[(0,M.jsxs)(E,{className:`group/row`,children:[F?(0,M.jsx)(D,{children:(0,M.jsx)(h,{"aria-label":a(),checked:z.has(e._id),onCheckedChange:()=>Z(e._id)})}):null,n.map(t=>(0,M.jsx)(D,{className:t.className,children:t.cell(e)},t.header)),A?(0,M.jsx)(D,{children:t.length>0?(0,M.jsxs)(v,{children:[(0,M.jsx)(b,{asChild:!0,children:(0,M.jsx)(p,{variant:`ghost`,size:`icon-sm`,"aria-label":r(),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)(x,{}):null,(0,M.jsx)(m,{variant:t.variant,onSelect:()=>t.onSelect(e),children:t.label})]},t.label))})]}):null}):null]}),i&&R?(0,M.jsx)(E,{className:`oc-dt__expansion`,children:(0,M.jsx)(D,{colSpan:q,className:`oc-dt__expansion-cell`,children:R(e)})}):null]},e._id)})})]})]})}export{N as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./bundle-mjs-C73ZY4La.js";import{m as t}from"./index-
|
|
1
|
+
import{r as e}from"./bundle-mjs-C73ZY4La.js";import{m as t}from"./index-BlZ8oKFa.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{$m as r,Ah as i,Bm as a,Ch as o,Dh as s,Eh as c,Fm as l,Gm as u,Hm as d,Im as f,Jm as ee,Km as p,LC as m,Lm as te,Mh as h,Mm as g,Nh as _,Nm as ne,Oh as v,Pm as re,Qm as ie,Rm as y,Sh as b,Th as x,UC as S,Um as C,Vm as w,WC as T,Wm as E,Xm as D,Ym as O,Zm as k,_h as A,ah as j,bh as M,ch as N,dh as P,eh as F,fh as I,gh as L,hh as R,ih as z,jh as B,kh as V,lh as H,mh as ae,nh as U,oh as W,ph as G,qm as K,rh as q,sh as J,th as oe,uh as se,vh as ce,wh as le,xh as ue,yh as de,zm as fe}from"./dist-BhemspoL.js";import{t as pe}from"./button-x4eiKyNo.js";import{j as me}from"./index-BlZ8oKFa.js";import{t as he}from"./DataTableShell-BpD7pA0i.js";var Y=t(e(),1),X=n(),Z={altered_words:()=>_(),incorrect:()=>h(),incoherence:()=>B(),formatting:()=>i(),latency:()=>V(),api_error:()=>v(),other:()=>s()},Q=e=>Z[e]?.()??e;function $({matches:e,sourceWasOpen:t}){return t?e===!0?(0,X.jsx)(`span`,{className:`oc-fbadmin__pill is-ok`,children:x()}):e===!1?(0,X.jsx)(`span`,{className:`oc-fbadmin__pill is-warn`,children:le()}):(0,X.jsx)(`span`,{className:`oc-fbadmin__pill`,children:`—`}):(0,X.jsx)(`span`,{className:`oc-fbadmin__pill`,children:c()})}function ge({data:e,closeReason:t}){let n=e.snapshot,r=S(m.feedback.respondToFeedback),[i,a]=(0,Y.useState)(e.thread),[s,c]=(0,Y.useState)(``),[l,u]=(0,Y.useState)(!1);async function d(){let t=s.trim();if(!(!t||l)){u(!0);try{await r({feedbackId:e._id,text:t}),a(e=>[...e,{authorRole:`admin`,text:t,at:Date.now()}]),c(``)}finally{u(!1)}}}let f=[];try{f=n.contextJson?JSON.parse(n.contextJson):[]}catch{f=[]}return(0,X.jsxs)(`div`,{className:`oc-fbadmin__detail`,children:[(0,X.jsxs)(`div`,{className:`oc-fbadmin__row`,children:[(0,X.jsx)($,{matches:n.displayedMatchesStored,sourceWasOpen:n.clientInfo?.sourceWasOpen??!1}),(0,X.jsxs)(`span`,{className:`oc-fbadmin__meta`,children:[Q(e.category),` · `,n.messageRole,n.isRegeneration?` · ${o()}`:``,n.openclawModel?` · ${n.openclawModel}`:``,n.openclawRuntime?` (${n.openclawRuntime})`:``]})]}),e.comment?(0,X.jsxs)(`section`,{children:[(0,X.jsx)(`h4`,{className:`oc-fbadmin__h`,children:b()}),(0,X.jsx)(`p`,{className:`oc-fbadmin__comment`,children:e.comment})]}):null,t?(0,X.jsxs)(`section`,{children:[(0,X.jsx)(`h4`,{className:`oc-fbadmin__h`,children:y()}),(0,X.jsx)(`p`,{className:`oc-fbadmin__comment`,children:t})]}):null,(0,X.jsxs)(`section`,{children:[(0,X.jsx)(`h4`,{className:`oc-fbadmin__h`,children:ue()}),i.length>0?(0,X.jsx)(`div`,{className:`oc-fbadmin__thread`,children:i.map((e,t)=>(0,X.jsxs)(`div`,{className:`oc-notif__msg oc-notif__msg--${e.authorRole}`,children:[(0,X.jsx)(`span`,{className:`oc-notif__msg-who`,children:e.authorRole===`admin`?M():de()}),(0,X.jsx)(`span`,{className:`oc-notif__msg-text`,children:e.text})]},t))}):(0,X.jsx)(`p`,{className:`oc-fbadmin__meta`,children:ce()}),(0,X.jsx)(`textarea`,{className:`oc-feedback__textarea`,placeholder:A(),value:s,maxLength:2e3,rows:3,onChange:e=>c(e.target.value.slice(0,2e3))}),(0,X.jsx)(`div`,{className:`oc-fbadmin__row`,style:{justifyContent:`flex-end`},children:(0,X.jsx)(pe,{size:`sm`,onClick:()=>void d(),disabled:!s.trim()||l,children:l?L():R()})})]}),(0,X.jsxs)(`section`,{children:[(0,X.jsx)(`h4`,{className:`oc-fbadmin__h`,children:ae()}),(0,X.jsx)(`pre`,{className:`oc-msg__source-pre`,children:n.messageText||G()})]}),n.clientInfo?.sourceWasOpen&&n.displayedText!==void 0?(0,X.jsxs)(`section`,{children:[(0,X.jsx)(`h4`,{className:`oc-fbadmin__h`,children:I()}),(0,X.jsx)(`pre`,{className:`oc-msg__source-pre`,children:n.displayedText||G()})]}):null,n.promptText?(0,X.jsxs)(`section`,{children:[(0,X.jsx)(`h4`,{className:`oc-fbadmin__h`,children:P()}),(0,X.jsx)(`pre`,{className:`oc-msg__source-pre`,children:n.promptText})]}):null,f.length>0?(0,X.jsxs)(`section`,{children:[(0,X.jsx)(`h4`,{className:`oc-fbadmin__h`,children:se({count:n.contextCount??f.length,truncated:n.contextTruncated?H():``})}),(0,X.jsx)(`div`,{className:`oc-fbadmin__ctx`,children:f.map((e,t)=>(0,X.jsxs)(`div`,{className:`oc-fbadmin__ctx-turn`,children:[(0,X.jsx)(`span`,{className:`oc-fbadmin__ctx-role`,children:e.role}),(0,X.jsx)(`span`,{className:`oc-fbadmin__ctx-text`,children:e.text})]},t))})]}):null,n.outboxAvailable?(0,X.jsxs)(`section`,{children:[(0,X.jsx)(`h4`,{className:`oc-fbadmin__h`,children:N()}),(0,X.jsxs)(`pre`,{className:`oc-msg__source-pre`,children:[n.outboxText??``,n.outboxStatus?`\n[status: ${n.outboxStatus}]`:``]})]}):null,n.clientInfo?.extensionsDetected&&n.clientInfo.extensionsDetected.length>0?(0,X.jsxs)(`section`,{children:[(0,X.jsx)(`h4`,{className:`oc-fbadmin__h`,children:J()}),(0,X.jsx)(`div`,{className:`oc-fbadmin__row`,children:n.clientInfo.extensionsDetected.map(e=>(0,X.jsx)(`span`,{className:`oc-fbadmin__pill is-warn`,children:e},e))})]}):null,(0,X.jsxs)(`section`,{children:[(0,X.jsx)(`h4`,{className:`oc-fbadmin__h`,children:W()}),(0,X.jsxs)(`p`,{className:`oc-fbadmin__env`,children:[[n.clientInfo?.language,n.clientInfo?.timezone,n.clientInfo?.theme?j({theme:n.clientInfo.theme}):null,n.runId?`run ${n.runId.slice(0,12)}…`:null].filter(Boolean).join(` · `)||`—`,n.clientInfo?.plugins&&n.clientInfo.plugins.length>0?(0,X.jsxs)(`span`,{className:`oc-fbadmin__plugins`,children:[z(),` `,n.clientInfo.plugins.join(`, `),(0,X.jsxs)(`span`,{className:`oc-fbadmin__note`,children:[` `,q()]})]}):null,n.clientInfo?.userAgent?(0,X.jsx)(`span`,{className:`oc-fbadmin__ua`,children:n.clientInfo.userAgent}):null]})]})]})}function _e(){let e=T(m.feedback.listForAdmin,{}),t=S(m.feedback.readSnapshot),n=S(m.feedback.deleteFeedback),i=me(),[o,s]=(0,Y.useState)(null),[c,h]=(0,Y.useState)({});async function _(e){if(o===e._id){s(null);return}if(!c[e._id]){let n=await t({feedbackId:e._id});h(t=>({...t,[e._id]:n}))}s(e._id)}async function v(e){await i({title:re(),description:ne(),confirmLabel:g(),destructive:!0})&&(await n({feedbackId:e._id}),o===e._id&&s(null))}return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`p`,{className:`oc-admin__hint`,children:[U(),` `,(0,X.jsx)(`strong`,{children:oe()}),` `,F()]}),(0,X.jsx)(he,{title:r(),rows:e,emptyHint:ie(),isExpanded:e=>o===e._id&&!!c[e._id],renderExpanded:e=>c[e._id]?(0,X.jsx)(ge,{data:c[e._id],closeReason:e.userCloseReason}):null,columns:[{header:k(),cell:e=>new Date(e.at).toLocaleString(`fr-FR`),sort:e=>e.at},{header:D(),cell:e=>Q(e.category),sort:e=>Q(e.category)},{header:O(),cell:e=>e.messageRole===`user`?ee():K(),sort:e=>e.messageRole},{header:p(),cell:e=>(e.reporterEmail||e.reporterName||`—`)+(e.impersonated&&e.realOperatorEmail?` ${u({operator:e.realOperatorEmail})}`:``),sort:e=>e.reporterEmail||e.reporterName||null},{header:E(),cell:e=>(0,X.jsx)($,{matches:e.displayedMatchesStored,sourceWasOpen:e.sourceWasOpen}),sort:e=>e.displayedMatchesStored===!1?0:e.displayedMatchesStored===!0?1:2},{header:C(),cell:e=>e.hasComment?`✎`:`—`,sort:e=>+!!e.hasComment},{header:d(),cell:e=>e.userClosedAt==null?e.answered?(0,X.jsx)(`span`,{className:`oc-fbadmin__pill is-ok`,children:w()}):(0,X.jsx)(`span`,{className:`oc-fbadmin__pill`,children:a()}):(0,X.jsx)(`span`,{className:`oc-fbadmin__pill is-closed`,children:fe()}),sort:e=>e.userClosedAt==null?+!!e.answered:2}],rowActions:e=>[{label:o===e._id?te():f(),onSelect:()=>void _(e)},{label:l(),onSelect:()=>void v(e),variant:`destructive`}]})]})}export{_e as FeedbacksTab};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import{r as e}from"./bundle-mjs-C73ZY4La.js";import{RC as t,ZC as n}from"./dist-BhemspoL.js";import{c as r,l as i,s as a,u as o}from"./index-BlZ8oKFa.js";var s=t(`circle-question-mark`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3`,key:`1u773s`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]]),c={media_delivery:{key:`media_delivery`,appliedIn:`bridge`,togglable:!0,placeholders:[`outboundDir`],defaultTemplate:`[LIVRAISON]
|
|
2
|
+
Pour qu'un fichier que tu génères soit téléchargeable par l'utilisateur dans ce webchat : écris-le sous {outboundDir}/ puis ajoute, dans ta réponse finale, une ligne dédiée EXACTEMENT au format MEDIA:<chemin absolu du fichier>. N'utilise PAS de lien markdown vers un chemin local — il ne serait pas cliquable.`},documentary_fetch:{key:`documentary_fetch`,appliedIn:`convex`,togglable:!0,placeholders:[`references`],defaultTemplate:`Fournis les fichiers source téléchargeables correspondant EXACTEMENT à ces références de documents (un fichier par référence, nommé d'après la référence). Réponds uniquement avec les fichiers, sans commentaire :
|
|
3
|
+
{references}`,disabledTemplate:`{references}`},inbound_files:{key:`inbound_files`,appliedIn:`bridge`,togglable:!0,placeholders:[`files`],defaultTemplate:`[FICHIERS REÇUS]
|
|
4
|
+
{files}`}},l=Object.keys(c);function u(e,t){return t.enabled?t.template:c[e].disabledTemplate??``}function d(e,t){return e.replace(/\{(\w+)\}/g,(e,n)=>{let r=t[n];return r===void 0?e:r})}var f=[`gateway-http`,`shared-fs`,`off`],p=[`inline`,`shared-fs`];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()),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){let t={};for(let n of l){let r=e?.[n];t[n]={enabled:r?.enabled??!0,template:typeof r?.template==`string`&&r.template.length>0?r.template:c[n].defaultTemplate}}return t}function g(e){let t={};for(let n of l){let r=c[n],i=e[n];if(!i)continue;let a={};r.togglable&&i.enabled===!1&&(a.enabled=!1);let o=i.template.trim();o.length>0&&o!==r.defaultTemplate&&(a.template=o),(a.enabled!==void 0||a.template!==void 0)&&(t[n]=a)}return t}function _(e){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)}}function v(e,t){let n={},r=r=>{(e[r]!==m[r]||t[r]!==void 0)&&(n[r]=e[r])};r(`mediaMode`),r(`inboundMediaMode`),r(`rehydration`),r(`mediaMaxMb`),r(`inboundAgentMount`),r(`outboundAgentMount`);let i=g(e.promptInjections);return Object.keys(i).length>0&&(n.promptInjections=i),n}var y=e();function b({text:e}){return(0,y.jsx)(i,{delayDuration:150,children:(0,y.jsxs)(a,{children:[(0,y.jsx)(o,{asChild:!0,children:(0,y.jsx)(`button`,{type:`button`,className:`oc-field__help`,"aria-label":e,onClick:e=>e.preventDefault(),children:(0,y.jsx)(s,{"aria-hidden":!0})})}),(0,y.jsx)(r,{className:`max-w-xs text-pretty`,children:e})]})})}function x({label:e,help:t}){return(0,y.jsxs)(`span`,{className:`oc-field__label`,children:[e,(0,y.jsx)(b,{text:t})]})}export{p as a,l as c,_ as i,u as l,x as n,f as o,v as r,c as s,b as t,d as u};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{AS as r,BS as ee,CS as i,DS as a,ES as o,FS as s,HS as te,IS as ne,LC as c,LS as re,MS as l,NS as u,OS as d,PS as f,RS as p,SS as ie,TS as m,UC as ae,VS as oe,WC as se,_S as ce,bS as le,cS as ue,dS as de,fC as fe,fS as pe,gS as me,hS as h,jS as g,kS as _,lS as he,mS as ge,pS as _e,rv as ve,sS as v,uC as y,uS as b,vS as x,wS as S,xS as C,yS as w,zS as T}from"./dist-BhemspoL.js";import{t as E}from"./button-x4eiKyNo.js";import{$ as D,A as O,B as k,C as A,Ct as j,G as M,H as N,K as P,Q as F,S as I,St as ye,U as be,V as xe,W as Se,Z as Ce,b as L,m as we,mt as Te,nt as Ee,vt as De,x as R,y as z,z as Oe}from"./index-BlZ8oKFa.js";import{a as ke,i as B,n as Ae,o as V,r as H,t as je}from"./table-BQp_EgUj.js";var U=t(e(),1),W=n(),G=`all`;function K(e){switch(e){case`image`:return g();case`audio`:return r();case`video`:return _();case`pdf`:return d();case`document`:return a();case`archive`:return o();default:return m()}}function q(){let[e,t]=(0,U.useState)(G),[n,r]=(0,U.useState)(G),[a,o]=(0,U.useState)(G),[d,m]=(0,U.useState)(G),[g,_]=(0,U.useState)(null),q=ae(c.files.softDelete),J=O();function Me(){t(G),r(G),o(G),m(G)}async function Ne(){let e=g;if(_(null),e)try{await q({fileId:e.id}),J.success(ge())}catch(e){J.error(_e(),e)}}let Y=se(c.files.listMine,{direction:e===G?void 0:e,chatId:n===G?void 0:n,instanceName:a===G?void 0:a,category:d===G?void 0:d}),X=(0,U.useMemo)(()=>new Intl.DateTimeFormat(fe(),{dateStyle:`medium`,timeStyle:`short`}),[]);if(Y===void 0)return(0,W.jsx)(`p`,{className:`oc-admin__hint`,children:y()});let{files:Z,facets:Q,truncated:Pe,cap:Fe}=Y,$=e!==G||n!==G||a!==G||d!==G;return(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`p`,{className:`oc-admin__hint`,children:te()}),(0,W.jsxs)(`div`,{className:`oc-files__filters`,style:{display:`flex`,flexWrap:`wrap`,gap:8,margin:`12px 0`},children:[(0,W.jsxs)(z,{value:e,onValueChange:t,children:[(0,W.jsx)(I,{size:`sm`,"aria-label":oe(),children:(0,W.jsx)(A,{})}),(0,W.jsxs)(L,{children:[(0,W.jsx)(R,{value:G,children:ee()}),(0,W.jsx)(R,{value:`inbound`,children:T()}),(0,W.jsx)(R,{value:`outbound`,children:p()})]})]}),(0,W.jsxs)(z,{value:n,onValueChange:r,children:[(0,W.jsx)(I,{size:`sm`,"aria-label":re(),children:(0,W.jsx)(A,{})}),(0,W.jsxs)(L,{children:[(0,W.jsx)(R,{value:G,children:ne()}),Q.chats.map(e=>(0,W.jsx)(R,{value:e.id,children:e.title},e.id))]})]}),Q.multiProvider?(0,W.jsxs)(z,{value:a,onValueChange:o,children:[(0,W.jsx)(I,{size:`sm`,"aria-label":s(),children:(0,W.jsx)(A,{})}),(0,W.jsxs)(L,{children:[(0,W.jsx)(R,{value:G,children:f()}),Q.instances.map(e=>(0,W.jsx)(R,{value:e,children:e},e))]})]}):null,(0,W.jsxs)(z,{value:d,onValueChange:m,children:[(0,W.jsx)(I,{size:`sm`,"aria-label":u(),children:(0,W.jsx)(A,{})}),(0,W.jsxs)(L,{children:[(0,W.jsx)(R,{value:G,children:l()}),Q.categories.map(e=>(0,W.jsx)(R,{value:e,children:K(e)},e))]})]}),$?(0,W.jsxs)(E,{variant:`ghost`,size:`sm`,onClick:Me,style:{display:`inline-flex`,alignItems:`center`,gap:4,marginLeft:`auto`},children:[(0,W.jsx)(De,{size:14,"aria-hidden":!0}),ce()]}):null]}),Z.length===0?(0,W.jsx)(`p`,{className:`oc-admin__hint`,children:$?ue():he()}):(0,W.jsxs)(W.Fragment,{children:[(0,W.jsxs)(je,{children:[(0,W.jsx)(ke,{children:(0,W.jsxs)(V,{children:[(0,W.jsx)(B,{children:S()}),(0,W.jsx)(B,{children:i()}),(0,W.jsx)(B,{children:ie()}),(0,W.jsx)(B,{children:C()}),(0,W.jsx)(B,{children:le()}),(0,W.jsx)(B,{className:`text-right`,children:w()})]})}),(0,W.jsx)(Ae,{children:Z.map(e=>(0,W.jsxs)(V,{children:[(0,W.jsx)(H,{className:`font-medium`,style:{maxWidth:280,overflow:`hidden`,textOverflow:`ellipsis`},title:e.filename,children:e.filename}),(0,W.jsx)(H,{title:e.mimeType,children:K(e.category)}),(0,W.jsx)(H,{children:(0,W.jsx)(we,{variant:`secondary`,children:e.direction===`inbound`?T():p()})}),(0,W.jsx)(H,{style:{maxWidth:220,overflow:`hidden`,textOverflow:`ellipsis`},title:e.chatTitle,children:e.chatTitle}),(0,W.jsx)(H,{className:`whitespace-nowrap text-muted-foreground`,children:X.format(e.createdAt)}),(0,W.jsx)(H,{className:`text-right`,children:(0,W.jsxs)(Ce,{children:[(0,W.jsx)(Ee,{asChild:!0,children:(0,W.jsx)(E,{variant:`ghost`,size:`icon`,"aria-label":me(),children:(0,W.jsx)(ye,{size:16})})}),(0,W.jsxs)(F,{align:`end`,children:[e.url?(0,W.jsx)(D,{asChild:!0,children:(0,W.jsxs)(`a`,{href:e.url,download:e.filename,target:`_blank`,rel:`noopener noreferrer`,children:[(0,W.jsx)(j,{size:14}),x()]})}):(0,W.jsxs)(D,{disabled:!0,children:[(0,W.jsx)(j,{size:14}),b()]}),(0,W.jsxs)(D,{variant:`destructive`,onSelect:()=>_({id:e._id,filename:e.filename}),children:[(0,W.jsx)(Te,{size:14}),h()]})]})]})})]},e._id))})]}),Pe?(0,W.jsx)(`p`,{className:`oc-admin__hint`,style:{marginTop:8},children:v({cap:Fe})}):null]}),(0,W.jsx)(Oe,{open:g!==null,onOpenChange:e=>!e&&_(null),children:(0,W.jsxs)(N,{children:[(0,W.jsxs)(M,{children:[(0,W.jsx)(P,{children:pe()}),(0,W.jsx)(be,{children:de()})]}),(0,W.jsxs)(Se,{children:[(0,W.jsx)(xe,{children:ve()}),(0,W.jsx)(k,{onClick:()=>void Ne(),children:h()})]})]})})]})}export{q as FilesTab};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Qi as r,Zi as i}from"./dist-
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Qi as r,Zi as i}from"./dist-BhemspoL.js";import{t as a}from"./TimeRangePicker--wX3a-5x.js";import{t as o}from"./button-x4eiKyNo.js";import{_t as s,q as c,vt as l}from"./index-BlZ8oKFa.js";var u=t(e(),1),d=n(),f=250;function p({q:e,onQChange:t,searchPlaceholder:n=r(),children:p,timeRange:m,onTimeRangeChange:h,onReset:g,canReset:_=!0}){let[v,y]=(0,u.useState)(e);(0,u.useEffect)(()=>{y(e)},[e]);let b=(0,u.useRef)(null);function x(e){y(e),b.current!==null&&window.clearTimeout(b.current),b.current=window.setTimeout(()=>t(e),f)}(0,u.useEffect)(()=>()=>{b.current!==null&&window.clearTimeout(b.current)},[]);function S(){b.current!==null&&window.clearTimeout(b.current),g()}return(0,d.jsxs)(`div`,{className:`oc-filterbar`,children:[(0,d.jsxs)(`div`,{className:`oc-filterbar__search`,children:[(0,d.jsx)(s,{className:`oc-filterbar__search-icon`,"aria-hidden":!0}),(0,d.jsx)(c,{value:v,onChange:e=>x(e.target.value),placeholder:n,"aria-label":n})]}),p?(0,d.jsx)(`div`,{className:`oc-filterbar__quick`,children:p}):null,m&&h?(0,d.jsx)(a,{value:m,onChange:h}):null,(0,d.jsxs)(o,{variant:`ghost`,size:`sm`,className:`oc-filterbar__reset`,onClick:S,disabled:!_,children:[(0,d.jsx)(l,{}),i()]})]})}export{p as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$n as r,AC as i,An as a,Bn as o,CC as s,Cn as c,Dn as l,EC as u,En as d,Fn as f,Gn as p,Hn as m,In as h,Jn as g,Kn as _,LC as v,Ln as y,Mn as b,Nn as x,On as S,Pn as C,Qn as w,RC as T,Rn as ee,SC as E,Sn as D,Tn as te,UC as O,Un as ne,Vn as re,WC as k,Wn as ie,Xn as ae,Yn as A,Zn as j,_n as oe,an as se,ar as M,bn as N,cn as ce,cr as le,dn as ue,dr as de,er as P,fn as fe,fr as F,gn as pe,hn as me,in as he,ir as ge,jn as _e,kC as I,kn as ve,ln as ye,lr as be,mn as xe,n as L,nr as Se,on as Ce,or as we,pn as Te,qn as Ee,rn as De,rr as Oe,sn as R,sr as ke,t as Ae,tr as je,un as Me,ur as Ne,vn as Pe,wn as Fe,xC as Ie,xn as Le,yn as Re,zn as ze}from"./dist-BhemspoL.js";import{t as Be}from"./dist-BiCy_qcc.js";import{t as Ve}from"./x-C9JKw9Pc.js";import{t as z}from"./button-x4eiKyNo.js";import{A as B,C as He,Et as Ue,F as We,L as Ge,N as Ke,O as V,P as qe,R as Je,S as Ye,at as Xe,b as Ze,dt as Qe,ft as $e,gt as H,h as et,ht as U,j as tt,m as W,q as G,ut as nt,x as rt,y as it}from"./index-BlZ8oKFa.js";import{t as at}from"./FilterBar-DB-b7WAm.js";import{t as ot}from"./DataTableShell-BpD7pA0i.js";import{t as K}from"./DetailChips-BA1mq7Wm.js";var st=T(`chevron-left`,[[`path`,{d:`m15 18-6-6 6-6`,key:`1wnfg3`}]]),ct=T(`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`}]]),q=T(`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`}]]),lt=T(`users`,[[`path`,{d:`M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2`,key:`1yyitq`}],[`path`,{d:`M16 3.128a4 4 0 0 1 0 7.744`,key:`16gr8j`}],[`path`,{d:`M22 21v-2a4 4 0 0 0-3-3.87`,key:`kshegd`}],[`circle`,{cx:`9`,cy:`7`,r:`4`,key:`nufk8`}]]),J=t(e(),1),Y=n(),X=`Tabs`,[ut,dt]=u(X,[$e]),ft=$e(),[pt,Z]=ut(X),mt=J.forwardRef((e,t)=>{let{__scopeTabs:n,value:r,onValueChange:a,defaultValue:o,orientation:c=`horizontal`,dir:l,activationMode:u=`automatic`,...d}=e,f=Be(l),[p,m]=s({prop:r,onChange:a,defaultProp:o??``,caller:X});return(0,Y.jsx)(pt,{scope:n,baseId:Ie(),value:p,onValueChange:m,orientation:c,dir:f,activationMode:u,children:(0,Y.jsx)(i.div,{dir:f,"data-orientation":c,...d,ref:t})})});mt.displayName=X;var ht=`TabsList`,gt=J.forwardRef((e,t)=>{let{__scopeTabs:n,loop:r=!0,...a}=e,o=Z(ht,n),s=ft(n);return(0,Y.jsx)(Qe,{asChild:!0,...s,orientation:o.orientation,dir:o.dir,loop:r,children:(0,Y.jsx)(i.div,{role:`tablist`,"aria-orientation":o.orientation,...a,ref:t})})});gt.displayName=ht;var _t=`TabsTrigger`,vt=J.forwardRef((e,t)=>{let{__scopeTabs:n,value:r,disabled:a=!1,...o}=e,s=Z(_t,n),c=ft(n),l=xt(s.baseId,r),u=St(s.baseId,r),d=r===s.value;return(0,Y.jsx)(nt,{asChild:!0,...c,focusable:!a,active:d,children:(0,Y.jsx)(i.button,{type:`button`,role:`tab`,"aria-selected":d,"aria-controls":u,"data-state":d?`active`:`inactive`,"data-disabled":a?``:void 0,disabled:a,id:l,...o,ref:t,onMouseDown:I(e.onMouseDown,e=>{!a&&e.button===0&&e.ctrlKey===!1?s.onValueChange(r):e.preventDefault()}),onKeyDown:I(e.onKeyDown,e=>{[` `,`Enter`].includes(e.key)&&s.onValueChange(r)}),onFocus:I(e.onFocus,()=>{let e=s.activationMode!==`manual`;!d&&!a&&e&&s.onValueChange(r)})})})});vt.displayName=_t;var yt=`TabsContent`,bt=J.forwardRef((e,t)=>{let{__scopeTabs:n,value:r,forceMount:a,children:o,...s}=e,c=Z(yt,n),l=xt(c.baseId,r),u=St(c.baseId,r),d=r===c.value,f=J.useRef(d);return J.useEffect(()=>{let e=requestAnimationFrame(()=>f.current=!1);return()=>cancelAnimationFrame(e)},[]),(0,Y.jsx)(E,{present:a||d,children:({present:n})=>(0,Y.jsx)(i.div,{"data-state":d?`active`:`inactive`,"data-orientation":c.orientation,role:`tabpanel`,"aria-labelledby":l,hidden:!n,id:u,tabIndex:0,...s,ref:t,style:{...e.style,animationDuration:f.current?`0s`:void 0},children:n&&o})})});bt.displayName=yt;function xt(e,t){return`${e}-trigger-${t}`}function St(e,t){return`${e}-content-${t}`}var Ct=mt,wt=gt,Tt=vt,Et=bt;function Dt(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 Ot(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 kt(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 At(e){switch(e){case`admin`:return x();case`user`:return b();case`pending`:return _e();default:return e}}function jt(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 Mt(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}}function Nt({className:e,orientation:t=`horizontal`,...n}){return(0,Y.jsx)(Ct,{"data-slot":`tabs`,"data-orientation":t,className:L(`group/tabs flex gap-2 data-horizontal:flex-col`,e),...n})}var Pt=Ae(`group/tabs-list inline-flex w-fit items-center justify-center rounded-lg p-[3px] text-muted-foreground group-data-horizontal/tabs:h-8 group-data-vertical/tabs:h-fit group-data-vertical/tabs:flex-col data-[variant=line]:rounded-none`,{variants:{variant:{default:`bg-muted`,line:`gap-1 bg-transparent`}},defaultVariants:{variant:`default`}});function Ft({className:e,variant:t=`default`,...n}){return(0,Y.jsx)(wt,{"data-slot":`tabs-list`,"data-variant":t,className:L(Pt({variant:t}),e),...n})}function Q({className:e,...t}){return(0,Y.jsx)(Tt,{"data-slot":`tabs-trigger`,className:L(`relative inline-flex h-[calc(100%-1px)] flex-1 items-center justify-center gap-1.5 rounded-md border border-transparent px-1.5 py-0.5 text-sm font-medium whitespace-nowrap text-foreground/60 transition-all group-data-vertical/tabs:w-full group-data-vertical/tabs:justify-start hover:text-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-1 focus-visible:outline-ring disabled:pointer-events-none disabled:opacity-50 has-data-[icon=inline-end]:pr-1 has-data-[icon=inline-start]:pl-1 dark:text-muted-foreground dark:hover:text-foreground group-data-[variant=default]/tabs-list:data-active:shadow-sm group-data-[variant=line]/tabs-list:data-active:shadow-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,`group-data-[variant=line]/tabs-list:bg-transparent group-data-[variant=line]/tabs-list:data-active:bg-transparent dark:group-data-[variant=line]/tabs-list:data-active:border-transparent dark:group-data-[variant=line]/tabs-list:data-active:bg-transparent`,`data-active:bg-background data-active:text-foreground dark:data-active:border-input dark:data-active:bg-input/30 dark:data-active:text-foreground`,`after:absolute after:bg-foreground after:opacity-0 after:transition-opacity group-data-horizontal/tabs:after:inset-x-0 group-data-horizontal/tabs:after:bottom-[-5px] group-data-horizontal/tabs:after:h-0.5 group-data-vertical/tabs:after:inset-y-0 group-data-vertical/tabs:after:-right-1 group-data-vertical/tabs:after:w-0.5 group-data-[variant=line]/tabs-list:data-active:after:opacity-100`,e),...t})}function $({className:e,...t}){return(0,Y.jsx)(Et,{"data-slot":`tabs-content`,className:L(`flex-1 text-sm outline-none`,e),...t})}var It={name:``,description:``};function Lt(){let e=k(v.groups.listGroups,{}),t=k(v.me.getMe,{host:Xe})?.role===`admin`,n=O(v.groups.createGroup),i=O(v.groups.updateGroup),a=O(v.groups.deleteGroup),o=tt(),s=B(),[c,l]=(0,J.useState)(!1),[u,d]=(0,J.useState)(null),[f,m]=(0,J.useState)(It),[h,y]=(0,J.useState)(null),[b,x]=(0,J.useState)(``),S=(0,J.useMemo)(()=>{if(!e)return e;let t=b.trim().toLowerCase();return t?e.filter(e=>e.name.toLowerCase().includes(t)||(e.description??``).toLowerCase().includes(t)||e.members.some(e=>e.label.toLowerCase().includes(t))||e.agents.some(e=>e.toLowerCase().includes(t))||e.charts.some(e=>e.name.toLowerCase().includes(t))):e},[e,b]);function C(){d(null),m(It),l(!0)}function T(e){d(e),m({name:e.name,description:e.description??``}),l(!0)}async function ee(){try{u?await i({groupId:u._id,name:f.name,description:f.description}):await n({name:f.name,description:f.description||void 0}),m(It),d(null),l(!1)}catch(e){s.error(Ce(),e)}}async function E(e){if(await o({title:Ee({name:e.name}),description:_(),confirmWord:e.name,confirmLabel:p(),cancelLabel:r(),destructive:!0}))try{await a({groupId:e._id})}catch(e){s.error(se(),e)}}return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`p`,{className:`oc-admin__hint`,children:de()}),(0,Y.jsx)(at,{q:b,onQChange:x,onReset:()=>x(``),canReset:b!==``,searchPlaceholder:ge()}),(0,Y.jsx)(ot,{title:F(),rows:S,addLabel:Ne(),onAdd:t?C:void 0,emptyHint:be(),columns:[{header:le(),cell:e=>e.name,sort:e=>e.name},{header:ke(),cell:e=>(0,Y.jsx)(K,{icon:(0,Y.jsx)(lt,{size:12,"aria-hidden":!0}),total:e.memberCount,items:e.members.map(e=>({label:e.label,marker:e.manager?(0,Y.jsx)(q,{size:11,"aria-hidden":!0}):null,highlight:e.manager}))}),sort:e=>e.memberCount},{header:we(),cell:e=>(0,Y.jsx)(K,{icon:(0,Y.jsx)(H,{size:12,"aria-hidden":!0}),total:e.agentCount,items:e.agents.map(e=>({label:e}))}),sort:e=>e.agentCount},{header:M(),cell:e=>(0,Y.jsx)(K,{icon:(0,Y.jsx)(ct,{size:12,"aria-hidden":!0}),total:e.chartCount,items:e.charts.map(e=>({label:e.name,marker:e.isDefault?(0,Y.jsx)(U,{size:11,fill:`currentColor`,"aria-hidden":!0}):null,highlight:e.isDefault}))}),sort:e=>e.chartCount}],rowActions:e=>[{label:Oe(),onSelect:()=>y({groupId:e._id,name:e.name})},...t?[{label:Se(),onSelect:()=>T(e)},{label:je(),variant:`destructive`,onSelect:()=>void E(e)}]:[]]}),(0,Y.jsx)(et,{open:c,onOpenChange:l,title:u?j():w(),description:ae(),canSubmit:!!f.name.trim(),onSubmit:ee,submitLabel:P(),children:(0,Y.jsxs)(`div`,{className:`oc-form`,children:[(0,Y.jsxs)(`label`,{className:`oc-field`,children:[(0,Y.jsx)(`span`,{className:`oc-field__label`,children:A()}),(0,Y.jsx)(G,{value:f.name,onChange:e=>m({...f,name:e.target.value})})]}),(0,Y.jsxs)(`label`,{className:`oc-field`,children:[(0,Y.jsx)(`span`,{className:`oc-field__label`,children:g()}),(0,Y.jsx)(G,{value:f.description,onChange:e=>m({...f,description:e.target.value})})]})]})}),(0,Y.jsx)(Bt,{groupId:h?.groupId??null,groupName:h?.name??``,open:h!==null,onOpenChange:e=>{e||y(null)}})]})}var Rt=8;function zt({page:e,pageCount:t,onPage:n}){return t<=1?null:(0,Y.jsxs)(`div`,{className:`oc-access__pager`,children:[(0,Y.jsxs)(z,{type:`button`,variant:`ghost`,size:`sm`,disabled:e<=1,onClick:()=>n(e-1),children:[(0,Y.jsx)(st,{size:14,"aria-hidden":!0}),h()]}),(0,Y.jsxs)(`span`,{className:`oc-access__pageinfo`,"aria-label":C({page:e,pages:t}),children:[e,` / `,t]}),(0,Y.jsxs)(z,{type:`button`,variant:`ghost`,size:`sm`,disabled:e>=t,onClick:()=>n(e+1),children:[f(),(0,Y.jsx)(Ue,{size:14,"aria-hidden":!0})]})]})}function Bt({groupId:e,groupName:t,open:n,onOpenChange:r}){let i=k(v.groups.getGroup,n&&e?{groupId:e}:`skip`),s=k(v.groups.listAssignableInstances,n?{}:`skip`),c=k(v.groups.listAssignableUsers,n?{}:`skip`),l=O(v.groups.addMember),u=O(v.groups.removeMember),f=O(v.groups.bulkSetMembers),p=O(v.groups.setGroupManager),h=B(),[g,_]=(0,J.useState)(``),[b,x]=(0,J.useState)(``),[C,w]=(0,J.useState)(`members`),[T,E]=(0,J.useState)(1),[D,ae]=(0,J.useState)(new Set),A=(0,J.useRef)(null),j=(0,J.useMemo)(()=>new Set((i?.members??[]).map(e=>e.userId)),[i]),oe=(0,J.useMemo)(()=>new Set((i?.members??[]).filter(e=>e.manager).map(e=>e.userId)),[i]),se=i?.viewerIsAdmin===!0,M=(0,J.useMemo)(()=>new Set((i?.agents??[]).map(e=>`${e.instanceName}/${e.agentId}`)),[i]);(0,J.useEffect)(()=>{_(``),x(``),w(`members`),E(1),A.current=null},[n,e]),(0,J.useEffect)(()=>{E(1)},[g]),(0,J.useEffect)(()=>{n&&i&&e&&A.current!==e&&(A.current=e,ae(new Set((i.members??[]).map(e=>e.userId))))},[n,i,e]);let N=(0,J.useMemo)(()=>c?Dt(c,g,D):[],[c,g,D]);async function le(t,n){if(e)try{n?await u({groupId:e,userId:t}):await l({groupId:e,userId:t})}catch(e){h.error(he(),e)}}async function de(t,n){if(e)try{await p({groupId:e,userId:t,manager:!n})}catch(e){h.error(ce(),e)}}let P=jt(N,e=>j.has(e.userId)),fe=N.filter(e=>j.has(e.userId)).length,F=Mt(N,T,Rt);async function pe(){if(!e||N.length===0)return;let t=N.map(e=>e.userId);try{await f({groupId:e,userIds:t,member:P!==`all`})}catch(e){h.error(he(),e)}}return(0,Y.jsx)(Ke,{open:n,onOpenChange:r,children:(0,Y.jsxs)(qe,{className:`oc-access`,children:[(0,Y.jsxs)(Ge,{children:[(0,Y.jsx)(Je,{children:ie({name:t})}),(0,Y.jsx)(We,{children:ne()})]}),(0,Y.jsxs)(Nt,{value:C,onValueChange:w,className:`oc-access__tabs`,children:[(0,Y.jsxs)(Ft,{className:`w-full`,children:[(0,Y.jsxs)(Q,{value:`members`,className:`flex-1 gap-1.5`,children:[(0,Y.jsx)(lt,{size:13,"aria-hidden":!0}),m(),i?(0,Y.jsx)(W,{variant:`secondary`,className:`oc-access__tabcount`,children:j.size}):null]}),(0,Y.jsxs)(Q,{value:`agents`,className:`flex-1 gap-1.5`,children:[(0,Y.jsx)(H,{size:13,"aria-hidden":!0}),o(),i?(0,Y.jsx)(W,{variant:`secondary`,className:`oc-access__tabcount`,children:M.size}):null]}),(0,Y.jsxs)(Q,{value:`charts`,className:`flex-1 gap-1.5`,children:[(0,Y.jsx)(ct,{size:13,"aria-hidden":!0}),Re(),i?(0,Y.jsx)(W,{variant:`secondary`,className:`oc-access__tabcount`,children:i.chartCount}):null]})]}),(0,Y.jsx)($,{value:`members`,children:c===void 0||i===void 0?(0,Y.jsx)(`p`,{className:`oc-access__hint`,children:S()}):c.length===0?(0,Y.jsx)(`p`,{className:`oc-access__hint`,children:d()}):(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(G,{value:g,onChange:e=>_(e.target.value),placeholder:re(),className:`oc-access__search`}),N.length===0?(0,Y.jsx)(`p`,{className:`oc-access__hint`,children:ee()}):(0,Y.jsxs)(Y.Fragment,{children:[N.length>1?(0,Y.jsxs)(`div`,{className:`oc-access__row oc-access__selectall`,children:[(0,Y.jsx)(V,{checked:P===`all`?!0:P===`some`?`indeterminate`:!1,onCheckedChange:()=>void pe(),"aria-label":y()}),(0,Y.jsx)(`span`,{className:`oc-access__label`,children:y()}),(0,Y.jsxs)(W,{variant:`outline`,className:`oc-access__count`,children:[fe,` / `,N.length]})]}):null,(0,Y.jsx)(`div`,{className:`oc-access__list`,children:F.pageItems.map(e=>{let t=j.has(e.userId),n=kt(e),r=oe.has(e.userId);return(0,Y.jsxs)(`div`,{className:`oc-access__row`,children:[(0,Y.jsx)(V,{checked:t,onCheckedChange:()=>void le(e.userId,t),"aria-label":a({user:n.primary})}),(0,Y.jsxs)(`span`,{className:`oc-access__who`,children:[(0,Y.jsx)(`span`,{className:`oc-access__label`,title:n.primary,children:n.primary}),n.secondary?(0,Y.jsx)(`span`,{className:`oc-access__sub`,title:n.secondary,children:n.secondary}):null]}),(0,Y.jsx)(W,{variant:`outline`,className:`oc-access__role`,children:At(e.role)}),(0,Y.jsx)(`span`,{className:`oc-access__mgrslot`,children:t&&se?(0,Y.jsx)(z,{type:`button`,variant:`ghost`,size:`icon`,className:`shrink-0 oc-access__mgr${r?` oc-access__mgr--on`:``}`,"aria-pressed":r,"aria-label":r?ye():Me(),title:r?ye():Me(),onClick:()=>void de(e.userId,r),children:(0,Y.jsx)(q,{size:15,"aria-hidden":!0})}):t&&r?(0,Y.jsx)(`span`,{className:`oc-access__mgr oc-access__mgr--on`,role:`img`,"aria-label":ue(),title:ue(),children:(0,Y.jsx)(q,{size:15,"aria-hidden":!0})}):null})]},e._id)})}),(0,Y.jsx)(zt,{page:F.page,pageCount:F.pageCount,onPage:E})]})]})}),(0,Y.jsx)($,{value:`agents`,children:s===void 0?(0,Y.jsx)(`p`,{className:`oc-access__hint`,children:S()}):s.length===0?(0,Y.jsx)(`p`,{className:`oc-access__hint`,children:te()}):(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(G,{value:b,onChange:e=>x(e.target.value),placeholder:ze(),className:`oc-access__search`}),(0,Y.jsx)(`div`,{className:`oc-access__list`,children:s.map(t=>(0,Y.jsx)(Vt,{groupId:e,instanceName:t.name,kind:t.kind??`openclaw`,assigned:M,query:b},`${e}-${t._id}`))})]})}),(0,Y.jsx)($,{value:`charts`,children:(0,Y.jsx)(Ht,{groupId:e})})]})]})})}function Vt({groupId:e,instanceName:t,kind:n,assigned:r,query:i}){let a=k(v.groups.listAssignableAgents,{instanceName:t}),o=O(v.groups.assignAgentToGroup),s=O(v.groups.removeAgentFromGroup),u=O(v.groups.bulkSetGroupAgents),d=B(),[f,p]=(0,J.useState)(1);if((0,J.useEffect)(()=>{p(1)},[i]),!e)return null;let m=Ot(a?.agents??[],i),h=a?.discovery&&!a.discovery.lastPollOk;if(i.trim()&&m.length===0)return null;let g=m.filter(e=>e.presentInLastOk!==!1),_=jt(g,e=>r.has(`${t}/${e.agentId}`)),b=Mt(m,f,Rt);async function x(n,r){try{r?await s({groupId:e,instanceName:t,agentId:n}):await o({groupId:e,instanceName:t,agentId:n})}catch(e){d.error(De(),e)}}async function S(){if(g.length===0)return;let n=g.map(e=>e.agentId);try{await u({groupId:e,instanceName:t,agentIds:n,assigned:_!==`all`})}catch(e){d.error(De(),e)}}return(0,Y.jsxs)(`div`,{className:`oc-access__group`,children:[(0,Y.jsxs)(`div`,{className:`oc-access__instance`,children:[(0,Y.jsx)(H,{size:13,"aria-hidden":!0}),(0,Y.jsx)(`span`,{children:t}),(0,Y.jsx)(W,{variant:`outline`,className:`oc-access__kind`,children:n}),h?(0,Y.jsx)(W,{variant:`outline`,className:`oc-access__stale`,children:D()}):null]}),a===void 0?(0,Y.jsx)(`p`,{className:`oc-access__hint`,children:l()}):m.length===0?(0,Y.jsx)(`p`,{className:`oc-access__hint`,children:h?c():Fe()}):(0,Y.jsxs)(Y.Fragment,{children:[g.length>1?(0,Y.jsxs)(`div`,{className:`oc-access__row oc-access__selectall`,children:[(0,Y.jsx)(V,{checked:_===`all`?!0:_===`some`?`indeterminate`:!1,onCheckedChange:()=>void S(),"aria-label":y()}),(0,Y.jsx)(`span`,{className:`oc-access__label`,children:y()})]}):null,b.pageItems.map(e=>{let n=`${t}/${e.agentId}`,i=r.has(n),a=e.presentInLastOk===!1;return(0,Y.jsxs)(`div`,{className:`oc-access__row`,children:[(0,Y.jsx)(V,{checked:i,disabled:a&&!i,onCheckedChange:()=>void x(e.agentId,i),"aria-label":ve({name:e.displayName??e.agentId})}),(0,Y.jsxs)(`span`,{className:`oc-access__label`,title:e.displayName??e.agentId,children:[e.emoji?`${e.emoji} `:``,e.displayName??e.agentId]}),e.model?(0,Y.jsx)(`span`,{className:`oc-access__model`,children:e.model}):null,e.isDefaultOnInstance?(0,Y.jsx)(`span`,{className:`oc-access__fav`,role:`img`,"aria-label":N(),title:N(),children:(0,Y.jsx)(U,{size:14,fill:`currentColor`})}):null,a?(0,Y.jsx)(W,{variant:`outline`,className:`oc-access__gone`,children:Le()}):null]},e.agentId)}),(0,Y.jsx)(zt,{page:b.page,pageCount:b.pageCount,onPage:p})]})]})}function Ht({groupId:e}){let t=k(v.charts.listGroupChartSelection,e?{groupId:e}:`skip`),n=O(v.charts.assignChartToGroup),r=O(v.charts.removeChartFromGroup),i=O(v.charts.setGroupDefaultChart),a=O(v.charts.addChartToGroupPool),o=O(v.charts.removeChartFromGroupPool),s=B();if(!e)return null;if(t===void 0)return(0,Y.jsx)(`p`,{className:`oc-access__hint`,children:S()});let{pool:c,addable:l,canManagePool:u}=t;if(c.length===0&&!u)return(0,Y.jsx)(`p`,{className:`oc-access__hint`,children:Pe()});async function d(t,i){try{i?await r({groupId:e,chartKey:t}):await n({groupId:e,chartKey:t})}catch(e){s.error(R(),e)}}async function f(t){try{await i({groupId:e,chartKey:t})}catch(e){s.error(R(),e)}}async function p(t){try{await a({groupId:e,chartKey:t})}catch(e){s.error(R(),e)}}async function m(t){try{await o({groupId:e,chartKey:t})}catch(e){s.error(R(),e)}}return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`div`,{className:`oc-access__list`,children:c.map(e=>(0,Y.jsxs)(`div`,{className:`oc-access__row`,children:[(0,Y.jsx)(V,{checked:e.selected,onCheckedChange:()=>void d(e.chartKey,e.selected),"aria-label":xe({name:e.name})}),(0,Y.jsx)(`span`,{className:`oc-access__label`,title:e.name,children:e.name}),e.selected?e.isDefault?(0,Y.jsx)(`span`,{className:`oc-access__fav`,role:`img`,"aria-label":Te(),title:Te(),children:(0,Y.jsx)(U,{size:14,fill:`currentColor`})}):(0,Y.jsx)(z,{type:`button`,variant:`ghost`,size:`sm`,onClick:()=>void f(e.chartKey),children:fe()}):null,u?(0,Y.jsx)(z,{type:`button`,variant:`ghost`,size:`sm`,"aria-label":me({name:e.name}),title:me({name:e.name}),onClick:()=>void m(e.chartKey),children:(0,Y.jsx)(Ve,{size:14,"aria-hidden":!0})}):null]},e.chartKey))}),u?l.length>0?(0,Y.jsxs)(it,{value:``,onValueChange:e=>void p(e),children:[(0,Y.jsx)(Ye,{size:`sm`,className:`oc-access__search`,children:(0,Y.jsx)(He,{placeholder:pe()})}),(0,Y.jsx)(Ze,{children:l.map(e=>(0,Y.jsx)(rt,{value:e.chartKey,children:e.name},e.chartKey))})]}):c.length===0?(0,Y.jsx)(`p`,{className:`oc-access__hint`,children:oe()}):null:null]})}export{Lt as GroupsTab};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$f as r,$p as i,Af as a,Ap as o,Bf as s,Bp as c,Cf as l,Cp as u,Df as d,Dp as f,Ef as p,Ep as m,Ff as h,Fp as g,Gf as _,Gp as v,Gv as y,Hf as b,Hp as x,If as S,Ip as C,Jf as w,Jp as T,Kf as E,Kp as ee,LC as D,Lf as te,Lp as ne,Mf as re,Mp as ie,Nf as ae,Np as oe,Of as se,Op as ce,Pf as le,Pp as ue,Qf as de,Qp as fe,Rf as pe,Rp as me,Sf as he,Sp as ge,Tf as _e,Tp as ve,UC as O,Uf as ye,Up as be,VC as k,Vf as xe,Vp as Se,WC as A,Wf as Ce,Wp as we,Wv as j,Xf as Te,Xp as Ee,Yf as De,Yp as Oe,Zf as ke,Zp as Ae,_p as je,ap as Me,bf as Ne,bp as M,cp as Pe,dp as Fe,em as Ie,ep as Le,fp as Re,gp as ze,hp as Be,im as Ve,ip as He,jf as Ue,jp as We,kf as Ge,kp as Ke,lp as qe,mp as N,nm as Je,np as Ye,op as Xe,pp as Ze,qf as Qe,qp as $e,rm as et,rp as tt,sp as nt,tm as rt,tp as it,up as P,vf as at,vp as ot,wf as st,wp as ct,xf as lt,xp as F,yf as I,yp as ut,zf as L,zp as dt}from"./dist-BhemspoL.js";import{t as R}from"./button-x4eiKyNo.js";import{A as z,C as ft,F as B,J as pt,L as V,N as H,O as U,P as W,R as G,S as mt,X as ht,Y as gt,b as _t,h as vt,j as yt,m as K,q,x as J,y as bt}from"./index-BlZ8oKFa.js";import{t as xt}from"./DataTableShell-BpD7pA0i.js";import{InstanceConfigDialog as St}from"./BridgeTab-BiMrYTrr.js";var Y=t(e(),1),X=[`conversational`,`documentary`],Ct=new Set(X),wt=`conversational`;function Tt(e){let t=new Set((e??[]).filter(e=>Ct.has(e)));return t.size===0?[wt]:X.filter(e=>t.has(e))}var Z=n(),Q={name:``,gatewayUrl:``,bridgeUrl:``,displayName:``,kind:`openclaw`,gatewayVersion:``,gatewayHttpUrl:``},Et={openclaw:[`token`,`deviceIdentity`],hermes:[`apiKey`]};function Dt(e){return{name:e.name,gatewayUrl:e.gatewayUrl,bridgeUrl:e.bridgeUrl??``,displayName:e.displayName??``,kind:e.kind??`openclaw`,gatewayVersion:e.gatewayVersion??``,gatewayHttpUrl:e.gatewayHttpUrl??``}}function Ot(){let e=A(D.admin.listInstances,{}),t=A(D.agents.listAllInstanceAgents,{}),n=O(D.admin.upsertInstance),r=O(D.admin.deleteInstance),a=z(),[s,l]=(0,Y.useState)(!1),[u,d]=(0,Y.useState)(Q),[p,m]=(0,Y.useState)(null),[h,_]=(0,Y.useState)(null),[y,b]=(0,Y.useState)(null),[S,w]=(0,Y.useState)(null);async function E(){try{await n({instanceId:S??void 0,name:u.name,gatewayUrl:u.gatewayUrl,bridgeUrl:u.bridgeUrl||void 0,displayName:u.displayName||void 0,kind:u.kind,gatewayVersion:u.gatewayVersion||void 0,gatewayHttpUrl:u.gatewayHttpUrl||void 0}),d(Q),w(null),l(!1)}catch(e){a.error(Je(),e)}}return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`p`,{className:`oc-admin__hint`,children:[rt(),(0,Z.jsx)(`strong`,{children:Ie()}),i()]}),(0,Z.jsx)(xt,{title:fe(),rows:e,addLabel:Ae(),onAdd:()=>{w(null),d(Q),l(!0)},emptyHint:Ee(),columns:[{header:Oe(),cell:e=>e.name,sort:e=>e.name},{header:T(),cell:e=>(0,Z.jsx)(K,{variant:`outline`,children:e.kind??`openclaw`}),sort:e=>e.kind??`openclaw`},{header:$e(),cell:e=>e.gatewayUrl,sort:e=>e.gatewayUrl},{header:ee(),cell:e=>e.displayName??`—`,sort:e=>e.displayName??null},{header:Ve(),cell:e=>{let n=(t?.[e.name]??[]).filter(e=>e.presentInLastOk!==!1&&e.enabled);if(n.length===0)return(0,Z.jsx)(`span`,{className:`text-muted-foreground`,children:`—`});let r=t=>e.defaultAgentId===t;return(0,Z.jsx)(`div`,{className:`flex flex-wrap gap-1`,children:[...n].sort((e,t)=>Number(r(t.agentId))-Number(r(e.agentId))).map(e=>(0,Z.jsxs)(K,{variant:r(e.agentId)?`default`:`outline`,title:r(e.agentId)?I():void 0,children:[e.emoji?`${e.emoji} `:``,e.displayName??e.agentId]},e.agentId))})}}],rowActions:e=>[{label:x(),onSelect:()=>{w(e._id),d(Dt(e)),l(!0)}},{label:et(),onSelect:()=>m(e.name)},{label:f(),onSelect:()=>b(e)},{label:v(),onSelect:()=>_(e)},{label:we(),variant:`destructive`,onSelect:()=>void r({instanceId:e._id})}],bulkActions:[{label:we(),variant:`destructive`,onSelect:e=>e.forEach(e=>void r({instanceId:e}))}]}),(0,Z.jsx)(vt,{open:s,onOpenChange:l,title:S?Se():be(),description:dt(),canSubmit:!!(u.name&&u.gatewayUrl),onSubmit:E,submitLabel:me(),children:(0,Z.jsxs)(`div`,{className:`oc-form`,children:[(0,Z.jsxs)($,{label:ne(),children:[(0,Z.jsx)(q,{value:u.name,disabled:S!==null,onChange:e=>d({...u,name:e.target.value})}),S?(0,Z.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:c()}):null]}),(0,Z.jsx)($,{label:C(),children:(0,Z.jsxs)(bt,{value:u.kind,onValueChange:e=>d({...u,kind:e}),children:[(0,Z.jsx)(mt,{size:`sm`,className:`w-40`,children:(0,Z.jsx)(ft,{})}),(0,Z.jsxs)(_t,{children:[(0,Z.jsx)(J,{value:`openclaw`,children:`OpenClaw`}),(0,Z.jsx)(J,{value:`hermes`,children:`Hermes`})]})]})}),(0,Z.jsx)($,{label:g(),children:(0,Z.jsx)(q,{value:u.gatewayUrl,onChange:e=>d({...u,gatewayUrl:e.target.value})})}),(0,Z.jsx)($,{label:ue(),children:(0,Z.jsx)(q,{value:u.bridgeUrl,placeholder:oe(),onChange:e=>d({...u,bridgeUrl:e.target.value})})}),(0,Z.jsx)($,{label:ie(),children:(0,Z.jsx)(q,{value:u.displayName,onChange:e=>d({...u,displayName:e.target.value})})}),(0,Z.jsx)($,{label:We(),children:(0,Z.jsx)(q,{value:u.gatewayVersion,placeholder:o(),onChange:e=>d({...u,gatewayVersion:e.target.value})})}),(0,Z.jsx)($,{label:Ke(),children:(0,Z.jsx)(q,{value:u.gatewayHttpUrl,placeholder:ce(),onChange:e=>d({...u,gatewayHttpUrl:e.target.value})})})]})}),(0,Z.jsx)(Rt,{instanceName:p,open:p!==null,onOpenChange:e=>{e||m(null)}}),h?(0,Z.jsx)(St,{instance:h,onClose:()=>_(null)},h._id):null,y?(0,Z.jsx)(kt,{instance:y,onClose:()=>b(null)},y._id):null]})}function kt({instance:e,onClose:t}){let n=A(D.instanceSecrets.listInstanceSecretStatus,{}),r=Et[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)(H,{open:!0,onOpenChange:e=>!e&&t(),children:(0,Z.jsxs)(W,{onOpenAutoFocus:e=>e.preventDefault(),children:[(0,Z.jsxs)(V,{children:[(0,Z.jsx)(G,{children:m({instance:e.displayName??e.name})}),(0,Z.jsx)(B,{children:ve()})]}),(0,Z.jsx)(`div`,{className:`oc-form`,children:r.map(t=>(0,Z.jsx)(Mt,{instanceId:e._id,field:t,updatedAt:i[t]??null},t))}),(0,Z.jsx)(`div`,{className:`oc-bridgesecret`,children:(0,Z.jsx)(jt,{instance:e})}),(0,Z.jsx)(At,{instance:e})]})})}function At({instance:e}){let t=k(D.instanceSync.forceInstanceSync),n=z(),[i,a]=(0,Y.useState)(!1);async function o(){if(!i){a(!0);try{switch((await t({instanceId:e._id})).status){case`synced`:n.success(Me());break;case`no_agents`:n.success(tt());break;case`no_bridge_url`:n.error(Ye());break;case`deploy_misconfigured`:n.error(it());break;case`unauthorized`:n.error(r());break;case`not_served`:n.error(de());break;default:n.error(Le());break}}catch(e){n.error(He(),e)}finally{a(!1)}}}return(0,Z.jsxs)(`div`,{className:`oc-form`,children:[(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:ke()}),(0,Z.jsx)(`div`,{className:`flex items-center gap-2`,children:(0,Z.jsx)(R,{size:`sm`,variant:`outline`,onClick:()=>void o(),disabled:i,children:i?Xe():nt()})})]})}function jt({instance:e}){let t=A(D.bridgeAuth.listBridgeAuthStatus,{}),n=k(D.bridgeAuth.mintBridgeSecret),r=O(D.bridgeAuth.revokeBridgeSecret),i=z(),[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(Ce(),e)}finally{o(!1)}}}async function m(){if(!a){o(!0);try{await r({instanceId:e._id}),c(null),i.success(_())}catch(e){i.error(Ce(),e)}finally{o(!1)}}}async function h(){if(s)try{await navigator.clipboard.writeText(s),u(!0)}catch{}}return(0,Z.jsxs)($,{label:Te(),children:[(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:De()}),(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Z.jsx)(K,{variant:f?`outline`:`secondary`,children:f?`${F()} · ${d.prefix}…${d.lastFour}`:M()}),(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(R,{size:`sm`,onClick:()=>void p(),disabled:a,children:f?Qe():w()}),f?(0,Z.jsx)(R,{size:`sm`,variant:`destructive`,onClick:()=>void m(),disabled:a,children:E()}):null]})]}),s?(0,Z.jsxs)(`div`,{className:`oc-bridgesecret__reveal`,children:[(0,Z.jsx)(`p`,{className:`oc-sa__minted-warning`,children:ye()}),(0,Z.jsxs)(`div`,{className:`oc-sa__minted-box`,children:[(0,Z.jsx)(`code`,{className:`oc-sa__minted-plain`,children:s}),(0,Z.jsx)(R,{variant:`outline`,size:`sm`,onClick:()=>void h(),children:l?y():j()})]}),(0,Z.jsx)(R,{size:`sm`,variant:`ghost`,onClick:()=>{c(null),u(!1)},children:b()})]}):null]})}function Mt({instanceId:e,field:t,updatedAt:n}){let r=k(D.instanceSecrets.setInstanceSecret),i=O(D.instanceSecrets.clearInstanceSecret),a=k(D.deviceIdentity.generateDeviceIdentity),o=z(),[s,c]=(0,Y.useState)(``),[l,d]=(0,Y.useState)(!1),[f,p]=(0,Y.useState)(null),[m,h]=(0,Y.useState)(!1),g=n!==null,_=t===`deviceIdentity`,v=t===`token`?ct():t===`deviceIdentity`?u():ge();async function x(){if(!(!s.trim()||l)){d(!0);try{await r({instanceId:e,field:t,plaintext:s}),c(``),p(null),h(!1),o.success(Be())}catch(e){o.error(N(),e)}finally{d(!1)}}}async function S(){if(!l){d(!0);try{await i({instanceId:e,field:t}),p(null),h(!1),o.success(Ze())}catch(e){o.error(N(),e)}finally{d(!1)}}}async function C(){if(!l){d(!0);try{p(await a({instanceId:e})),h(!1),o.success(P())}catch(e){o.error(Pe(),e)}finally{d(!1)}}}let w=f?`openclaw devices approve ${f.id}`:``;async function T(){if(w)try{await navigator.clipboard.writeText(w),h(!0)}catch{}}return(0,Z.jsxs)($,{label:v,children:[_?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:Fe()}):null,(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Z.jsx)(K,{variant:g?`outline`:`secondary`,children:g?F():M()}),(0,Z.jsx)(q,{type:`password`,autoComplete:`off`,className:`flex-1 min-w-32`,value:s,placeholder:g?ot():ut(),onChange:e=>c(e.target.value)}),(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(R,{size:`sm`,onClick:()=>void x(),disabled:l||s.trim().length===0,children:je()}),_?(0,Z.jsx)(R,{size:`sm`,variant:`outline`,onClick:()=>void C(),disabled:l,children:Re()}):null,g?(0,Z.jsx)(R,{size:`sm`,variant:`destructive`,onClick:()=>void S(),disabled:l,children:ze()}):null]})]}),f?(0,Z.jsxs)(`div`,{className:`oc-bridgesecret__reveal`,children:[(0,Z.jsx)(`p`,{className:`text-sm font-medium`,children:P()}),(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:qe()}),(0,Z.jsxs)(`div`,{className:`oc-sa__minted-box`,children:[(0,Z.jsx)(`code`,{className:`oc-sa__minted-plain`,children:w}),(0,Z.jsx)(R,{variant:`outline`,size:`sm`,onClick:()=>void T(),children:m?y():j()})]}),(0,Z.jsx)(R,{size:`sm`,variant:`ghost`,onClick:()=>{p(null),h(!1)},children:b()})]}):null]})}var Nt={conversational:le,documentary:re},Pt={conversational:ae,documentary:Ue},Ft=e=>(Nt[e]??(()=>e))(),It=e=>(Pt[e]??(()=>``))();function Lt({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:pe()}),t.map(e=>(0,Z.jsx)(K,{variant:`secondary`,className:`oc-agenttype__chip`,title:It(e),children:Ft(e)},e)),(0,Z.jsxs)(pt,{children:[(0,Z.jsx)(ht,{asChild:!0,children:(0,Z.jsx)(R,{type:`button`,variant:`outline`,size:`sm`,className:`h-7`,children:te()})}),(0,Z.jsxs)(gt,{align:`start`,className:`oc-agenttypes-pop`,children:[(0,Z.jsx)(`p`,{className:`oc-agenttypes-pop__title`,children:S()}),(0,Z.jsx)(`p`,{className:`oc-agenttypes-pop__hint`,children:h()}),(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)(U,{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:Ft(r)}),(0,Z.jsx)(`span`,{className:`oc-agenttypes-pop__desc`,children:It(r)})]})]},r)})})]})]})]})}function Rt({instanceName:e,open:t,onOpenChange:n}){let r=A(D.agents.listAgentsForInstance,t&&e?{instanceName:e}:`skip`),i=O(D.agents.setAgentEnabled).withOptimisticUpdate((e,{instanceName:t,agentId:n,enabled:r})=>{let i=e.getQuery(D.agents.listAgentsForInstance,{instanceName:t});i&&e.setQuery(D.agents.listAgentsForInstance,{instanceName:t},{...i,agents:i.agents.map(e=>e.agentId===n?{...e,enabled:r}:e)})}),o=O(D.agents.setInstanceDefaultAgent).withOptimisticUpdate((e,{instanceName:t,agentId:n})=>{let r=e.getQuery(D.agents.listAgentsForInstance,{instanceName:t});r&&e.setQuery(D.agents.listAgentsForInstance,{instanceName:t},{...r,defaultAgentId:n})}),c=O(D.agents.setAgentTypes).withOptimisticUpdate((e,{instanceName:t,agentId:n,types:r})=>{let i=e.getQuery(D.agents.listAgentsForInstance,{instanceName:t});if(!i)return;let a=Tt(r);e.setQuery(D.agents.listAgentsForInstance,{instanceName:t},{...i,agents:i.agents.map(e=>e.agentId===n?{...e,types:a}:e)})}),u=O(D.agents.removeInstanceAgent),f=yt(),m=z();async function h(t,n){if(e)try{await i({instanceName:e,agentId:t,enabled:n})}catch(e){m.error(L(),e)}}async function g(t){if(e)try{await o({instanceName:e,agentId:t})}catch(e){m.error(L(),e)}}async function _(t,n,r){if(!e)return;let i=r.includes(n)?r.filter(e=>e!==n):[...r,n];try{await c({instanceName:e,agentId:t,types:i})}catch(e){m.error(L(),e)}}async function v(t,n){if(e&&await f({title:se({name:n}),description:d(),confirmLabel:p(),destructive:!0}))try{await u({instanceName:e,agentId:t}),m.success(_e())}catch(e){m.error(L(),e)}}return(0,Z.jsx)(H,{open:t,onOpenChange:n,children:(0,Z.jsxs)(W,{className:`oc-access`,children:[(0,Z.jsxs)(V,{children:[(0,Z.jsx)(G,{children:xe({name:e??``})}),(0,Z.jsx)(B,{children:s()})]}),r===void 0?(0,Z.jsx)(`p`,{className:`oc-access__hint`,children:st()}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`div`,{className:`oc-access__poll`,children:r.discovery===null?l():r.discovery.lastPollOk?he():lt({error:r.discovery.error??`?`})}),r.agents.length===0?(0,Z.jsx)(`p`,{className:`oc-access__hint`,children:Ne()}):(0,Z.jsx)(`div`,{className:`oc-access__list`,children:r.agents.map(e=>{let t=e.presentInLastOk===!1,n=r.defaultAgentId===e.agentId,i=e.displayName??e.agentId,o=e.types??[];return(0,Z.jsxs)(`div`,{className:`oc-agentcard`+(e.enabled?``:` oc-agentcard--off`),children:[(0,Z.jsxs)(`div`,{className:`oc-agentcard__head`,children:[(0,Z.jsx)(U,{checked:e.enabled,disabled:t,"aria-label":i,onCheckedChange:t=>void h(e.agentId,t===!0)}),(0,Z.jsxs)(`span`,{className:`oc-agentcard__name`,title:i,children:[e.emoji?`${e.emoji} `:``,i]}),e.model?(0,Z.jsx)(`span`,{className:`oc-access__model`,children:e.model}):null,t?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(K,{variant:`outline`,className:`oc-access__gone`,children:at()}),(0,Z.jsx)(R,{size:`sm`,variant:`ghost`,className:`h-7 text-destructive`,onClick:()=>void v(e.agentId,i),children:Ge()})]}):n?(0,Z.jsx)(K,{variant:`default`,children:I()}):(0,Z.jsx)(R,{size:`sm`,variant:`outline`,className:`h-7`,disabled:!e.enabled,onClick:()=>void g(e.agentId),children:a()})]}),e.enabled?(0,Z.jsx)(Lt,{agentId:e.agentId,types:o,onToggle:t=>void _(e.agentId,t,o)}):null]},e.agentId)})})]})]})})}function $({label:e,children:t}){return(0,Z.jsxs)(`label`,{className:`oc-field`,children:[(0,Z.jsx)(`span`,{className:`oc-field__label`,children:e}),t]})}export{Ot as InstancesTab};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$h as r,Bh as i,Cg as ee,Eg as a,Fh as o,Gh as s,Hh as c,Ih as l,Jh as u,Kh as d,LC as f,Lh as te,Ph as ne,Qh as re,Rh as ie,Sg as p,Tg as ae,UC as oe,Uh as se,Vh as ce,WC as le,Wh as m,Xh as h,Yh as g,Zh as _,_g as v,ag as y,bg as b,cg as x,dg as S,eg as C,fg as w,gg as T,hg as E,ig as D,lg as O,mg as k,ng as A,og as j,pg as M,qh as N,rg as ue,sg as P,tg as F,ug as I,vg as L,wg as R,xg as z,yg as B,zh as V}from"./dist-BhemspoL.js";import{C as H,O as U,S as W,b as G,m as K,q,x as de,y as fe}from"./index-BlZ8oKFa.js";import{t as pe}from"./DataTableShell-BpD7pA0i.js";var J=t(e(),1),Y=n();function me(){let e=le(f.integrations.status.status,{}),t=oe(f.admin.setIntegrationConfig),[n,H]=(0,J.useState)(null);if((0,J.useEffect)(()=>{e&&n===null&&H(e.config)},[e,n]),!e||!n)return(0,Y.jsx)(`p`,{className:`oc-admin__hint`,children:a()});let U=n,W=(e,t,n)=>H({...U,[e]:{...U[e],[t]:n}}),G=(e,n)=>void t({[e]:n});return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(`p`,{className:`oc-admin__hint`,children:[ae(),` `,(0,Y.jsx)(`strong`,{children:R()}),` `,ee()]}),(0,Y.jsxs)(X,{title:`Langfuse`,status:e.langfuse.configured?e.langfuse.enabled?(0,Y.jsx)(K,{variant:`secondary`,children:p()}):(0,Y.jsx)(K,{variant:`outline`,children:z()}):(0,Y.jsx)(K,{variant:`outline`,children:b()}),note:L(),children:[(0,Y.jsx)(Z,{label:T(),children:(0,Y.jsx)(q,{value:U.langfuse.host??``,placeholder:e.langfuse.effectiveHost,onChange:e=>W(`langfuse`,`host`,e.target.value),onBlur:()=>G(`langfuse`,{host:U.langfuse.host??``})})}),(0,Y.jsx)(Q,{label:w(),checked:U.langfuse.enabled??!0,onChange:e=>{W(`langfuse`,`enabled`,e),G(`langfuse`,{enabled:e})}})]}),(0,Y.jsxs)(X,{title:`Opik`,status:e.opik.configured?e.opik.enabled?(0,Y.jsx)(K,{variant:`secondary`,children:p()}):(0,Y.jsx)(K,{variant:`outline`,children:z()}):(0,Y.jsx)(K,{variant:`outline`,children:b()}),note:v(),children:[(0,Y.jsx)(Z,{label:E(),children:(0,Y.jsx)(q,{value:U.opik.baseUrl??``,placeholder:e.opik.effectiveBaseUrl,onChange:e=>W(`opik`,`baseUrl`,e.target.value),onBlur:()=>G(`opik`,{baseUrl:U.opik.baseUrl??``})})}),(0,Y.jsx)(Z,{label:k(),children:(0,Y.jsx)(q,{value:U.opik.workspace??``,placeholder:e.opik.effectiveWorkspace||M(),onChange:e=>W(`opik`,`workspace`,e.target.value),onBlur:()=>G(`opik`,{workspace:U.opik.workspace??``})})}),(0,Y.jsx)(Q,{label:w(),checked:U.opik.enabled??!0,onChange:e=>{W(`opik`,`enabled`,e),G(`opik`,{enabled:e})}})]}),(0,Y.jsxs)(X,{title:S(),status:(0,Y.jsx)(K,{variant:`outline`,children:B()}),note:I(),children:[(0,Y.jsx)(Z,{label:O(),children:(0,Y.jsx)($,{value:U.tts.auto??`off`,options:[[`off`,x()],[`always`,P()],[`inbound`,j()],[`tagged`,y()]],onChange:e=>{W(`tts`,`auto`,e),G(`tts`,{auto:e})}})}),(0,Y.jsx)(Z,{label:D(),children:(0,Y.jsx)($,{value:U.tts.provider??`openai`,options:[[`openai`,`OpenAI`],[`elevenlabs`,`ElevenLabs`],[`microsoft`,ue()],[`azure`,`Azure Speech`],[`google`,`Google Gemini`]],onChange:e=>{W(`tts`,`provider`,e),G(`tts`,{provider:e})}})}),(0,Y.jsx)(Z,{label:A(),children:(0,Y.jsx)(q,{value:U.tts.model??``,placeholder:`eleven_multilingual_v2`,onChange:e=>W(`tts`,`model`,e.target.value),onBlur:()=>G(`tts`,{model:U.tts.model??``})})}),(0,Y.jsx)(Z,{label:F(),children:(0,Y.jsx)(q,{value:U.tts.voice??``,placeholder:C(),onChange:e=>W(`tts`,`voice`,e.target.value),onBlur:()=>G(`tts`,{voice:U.tts.voice??``})})})]}),(0,Y.jsxs)(X,{title:r(),status:(0,Y.jsx)(K,{variant:`outline`,children:B()}),note:e.secrets.openai?re():_(),children:[(0,Y.jsx)(Q,{label:h(),checked:U.talk.enabled??!1,onChange:e=>{W(`talk`,`enabled`,e),G(`talk`,{enabled:e})}}),(0,Y.jsx)(Z,{label:g(),children:(0,Y.jsx)($,{value:U.talk.realtimeProvider??`openai`,options:[[`openai`,`OpenAI (gpt-realtime)`],[`google`,`Google`]],onChange:e=>{W(`talk`,`realtimeProvider`,e),G(`talk`,{realtimeProvider:e})}})}),(0,Y.jsx)(Z,{label:u(),children:(0,Y.jsx)(q,{value:U.talk.realtimeModel??``,placeholder:`gpt-realtime-2`,onChange:e=>W(`talk`,`realtimeModel`,e.target.value),onBlur:()=>G(`talk`,{realtimeModel:U.talk.realtimeModel??``})})}),(0,Y.jsx)(Z,{label:F(),children:(0,Y.jsx)(q,{value:U.talk.voice??``,placeholder:`cedar / marin`,onChange:e=>W(`talk`,`voice`,e.target.value),onBlur:()=>G(`talk`,{voice:U.talk.voice??``})})}),(0,Y.jsx)(Z,{label:N(),children:(0,Y.jsx)($,{value:U.talk.transport??`webrtc`,options:[[`webrtc`,d()],[`provider-websocket`,`Provider WebSocket`],[`gateway-relay`,`Gateway relay`]],onChange:e=>{W(`talk`,`transport`,e),G(`talk`,{transport:e})}})}),(0,Y.jsx)(Z,{label:s(),children:(0,Y.jsx)(q,{value:U.talk.speechLocale??``,placeholder:`fr-CA`,onChange:e=>W(`talk`,`speechLocale`,e.target.value),onBlur:()=>G(`talk`,{speechLocale:U.talk.speechLocale??``})})}),(0,Y.jsx)(Q,{label:m(),checked:U.talk.interruptOnSpeech??!0,onChange:e=>{W(`talk`,`interruptOnSpeech`,e),G(`talk`,{interruptOnSpeech:e})}})]}),(0,Y.jsxs)(`section`,{className:`oc-int__section`,children:[(0,Y.jsxs)(`div`,{className:`oc-int__section-head`,children:[(0,Y.jsx)(`h3`,{className:`oc-uipa__h`,children:se()}),(0,Y.jsx)(K,{variant:`outline`,children:c()})]}),(0,Y.jsxs)(`p`,{className:`oc-uipa__note`,children:[ce(),(0,Y.jsx)(`code`,{children:` voicewake.get/set`}),`.`]})]}),(0,Y.jsx)(pe,{title:i(),rows:e.cursors.map(e=>({...e,_id:e.vendor})),emptyHint:V(),columns:[{header:ie(),cell:e=>(0,Y.jsx)(K,{variant:`secondary`,children:e.vendor}),sort:e=>e.vendor},{header:te(),cell:e=>e.lastAt>0?new Date(e.lastAt).toLocaleString(`fr-FR`):`—`,sort:e=>e.lastAt>0?e.lastAt:null},{header:l(),cell:e=>String(e.failureCount),sort:e=>e.failureCount},{header:o(),cell:e=>e.lastErrorStatus??`—`,sort:e=>e.lastErrorStatus??null},{header:ne(),cell:e=>e.lastError??`—`,sort:e=>e.lastError??null}]})]})}function X({title:e,status:t,note:n,children:r}){return(0,Y.jsxs)(`section`,{className:`oc-int__section`,children:[(0,Y.jsxs)(`div`,{className:`oc-int__section-head`,children:[(0,Y.jsx)(`h3`,{className:`oc-uipa__h`,children:e}),t]}),n?(0,Y.jsx)(`p`,{className:`oc-uipa__note`,children:n}):null,(0,Y.jsx)(`div`,{className:`oc-int__fields`,children:r})]})}function Z({label:e,children:t}){return(0,Y.jsxs)(`label`,{className:`oc-int__field`,children:[(0,Y.jsx)(`span`,{className:`oc-int__field-label`,children:e}),t]})}function Q({label:e,checked:t,onChange:n}){return(0,Y.jsxs)(`label`,{className:`oc-int__toggle`,children:[(0,Y.jsx)(U,{checked:t,onCheckedChange:e=>n(e===!0)}),(0,Y.jsx)(`span`,{children:e})]})}function $({value:e,options:t,onChange:n}){return(0,Y.jsxs)(fe,{value:e,onValueChange:n,children:[(0,Y.jsx)(W,{size:`sm`,className:`w-full`,children:(0,Y.jsx)(H,{})}),(0,Y.jsx)(G,{children:t.map(([e,t])=>(0,Y.jsx)(de,{value:e,children:t},e))})]})}export{me as IntegrationsTab};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Bo as r,Fo as i,Ho as a,Io as o,
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Bo as r,Fo as i,Ho as a,Io as o,LC as s,Lo as c,Mo as l,No as u,Po as d,Ro as f,Uo as p,Vo as m,WC as h,Wo as g,jo as _,zo as v}from"./dist-BhemspoL.js";import{n as y,t as b}from"./TimeRangePicker--wX3a-5x.js";import{Dt as x,Ot as S,a as C,n as w,r as T}from"./index-BlZ8oKFa.js";import{a as E,n as D,o as O,r as k,t as A}from"./card-BpwyvJ1X.js";var j=t(e(),1),M=n(),N=[{metric:`api.calls`,label:g(),unit:`/h`,group:`API`,isError:!1},{metric:`api.errors`,label:p(),unit:`/h`,group:`API`,isError:!0},{metric:`api.latency.avg_ms`,label:a(),unit:`ms`,group:`API`,isError:!1},{metric:`openclaw.ingest`,label:m(),unit:`/h`,group:`OpenClaw`,isError:!1},{metric:`chat.send`,label:r(),unit:`/h`,group:`Chat`,isError:!1},{metric:`assistant.stream.errors`,label:v(),unit:`/h`,group:`Assistant`,isError:!0}],P=N.length,F=[`API`,`OpenClaw`,`Chat`,`Assistant`],I=1e3,L=36e5;function R(e,t){let n=Math.max(1,Math.ceil((t-e)/L)),r=Math.min(n*P,I);return{rowLimit:r,buckets:Math.max(1,Math.floor(r/P))}}function z(){let e=S({from:`/settings/kpi`}),t=x({from:`/settings/kpi`}),n=T(e.from,e.to,w,`now`),r=e=>void t({search:t=>({...t,...C(e)})}),{from:a,to:l}=y(n),{rowLimit:u,buckets:d}=R(a,l),p=h(s.kpi.listKpis,{limit:u,filter:{from:a,to:l}}),m=(0,j.useMemo)(()=>{let e=new Map;for(let t of p??[]){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>d&&e.set(t,n.slice(n.length-d));return e},[p,d]),g=(0,M.jsxs)(M.Fragment,{children:[(0,M.jsxs)(`p`,{className:`oc-admin__hint`,children:[f(),` `,(0,M.jsx)(`span`,{className:`oc-filter__window`,children:c()})]}),(0,M.jsx)(B,{value:n,onChange:r})]});return p===void 0?(0,M.jsxs)(M.Fragment,{children:[g,(0,M.jsx)(`p`,{className:`oc-admin__hint`,children:o()})]}):p.length===0?(0,M.jsxs)(M.Fragment,{children:[g,(0,M.jsx)(`p`,{className:`oc-admin__hint`,children:i()})]}):(0,M.jsxs)(M.Fragment,{children:[g,F.map(e=>{let t=N.filter(t=>t.group===e);return t.some(e=>(m.get(e.metric)??[]).length>0)?(0,M.jsxs)(`section`,{className:`oc-kpi__group`,children:[(0,M.jsx)(`h2`,{className:`oc-kpi__group-title`,children:e}),(0,M.jsx)(`div`,{className:`oc-kpi__grid`,children:t.map(e=>(0,M.jsx)(V,{config:e,series:m.get(e.metric)??[]},e.metric))})]},e):null})]})}function B({value:e,onChange:t}){return(0,M.jsx)(`div`,{className:`oc-kpi__toolbar`,children:(0,M.jsx)(b,{value:e,onChange:t})})}function V({config:e,series:t}){let n=t.length>0?t[t.length-1]:null,r=n?n.value:0;return(0,M.jsxs)(A,{size:`sm`,className:`oc-kpi__card`,children:[(0,M.jsxs)(E,{children:[(0,M.jsx)(O,{className:`oc-kpi__card-title`,children:e.label}),(0,M.jsx)(k,{className:`oc-kpi__card-metric`,children:(0,M.jsx)(`code`,{children:e.metric})})]}),(0,M.jsxs)(D,{className:`oc-kpi__card-body`,children:[(0,M.jsxs)(`div`,{className:`oc-kpi__value-row`,children:[(0,M.jsx)(`span`,{className:`oc-kpi__value`+(e.isError&&r>0?` oc-kpi__value--error`:``),children:K(r)}),(0,M.jsx)(`span`,{className:`oc-kpi__unit`,children:e.unit})]}),(0,M.jsx)(G,{series:t,isError:e.isError,unit:e.unit}),(0,M.jsxs)(`div`,{className:`oc-kpi__axis`,children:[n?(0,M.jsx)(`span`,{className:`oc-kpi__axis-latest`,children:d({value:q(n.bucket)})}):(0,M.jsx)(`span`,{className:`oc-kpi__muted`,children:u()}),(0,M.jsx)(`span`,{className:`oc-kpi__muted`,children:l({count:t.length})})]})]})]})}var H=240,U=48,W=1;function G({series:e,isError:t,unit:n}){if(e.length===0)return(0,M.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=H/e.length,a=Math.max(i-W,1);return(0,M.jsx)(`svg`,{className:`oc-kpi__chart`,viewBox:`0 0 ${H} ${U}`,preserveAspectRatio:`none`,role:`img`,"aria-label":_({max:K(r),unit:n}),children:e.map((e,o)=>{let s=r>0?e.value/r*(U-1):0,c=o*i,l=U-s;return(0,M.jsx)(`rect`,{className:`oc-kpi__bar`+(t&&e.value>0?` oc-kpi__bar--error`:``),x:c,y:l,width:a,height:s,children:(0,M.jsxs)(`title`,{children:[q(e.bucket),` · `,K(e.value),` `,n]})},e.bucket)})})}function K(e){return Number.isFinite(e)?Math.abs(e)>=1e3?(e/1e3).toFixed(e%1e3==0?0:1)+`k`:String(e):`0`}function q(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{z as KpiTab};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$S as r,Ab as i,Cb as a,Db as o,Eb as s,Fb as c,GS as l,Ib as u,JS as ee,KS as te,LC as d,Mb as f,Nb as p,Ob as ne,Pb as m,QS as h,Rp as re,Sb as ie,Tb as ae,UC as g,WC as _,WS as oe,XS as se,YS as ce,ZS as le,_b as v,aC as ue,ab as de,bb as fe,cb as y,db as b,eC as x,fb as S,gb as C,hb as w,ib as T,jb as E,kb as D,lb as O,mb as k,nC as A,ob as j,pb as M,qS as N,rb as P,sb as F,tC as I,uC as L,ub as R,vb as z,wb as B,xb as V,yb as pe}from"./dist-BhemspoL.js";import{t as H}from"./button-x4eiKyNo.js";import{A as me,C as he,O as U,S as ge,at as W,b as _e,k as ve,q as G,x as K,y as ye}from"./index-BlZ8oKFa.js";var q=t(e(),1),J=[{id:`messages`,label:()=>u()},{id:`composer`,label:()=>c()},{id:`sidebar`,label:()=>m()},{id:`other`,label:()=>p()}],Y={showSource:{category:`messages`,label:()=>f(),help:()=>E()},showReport:{category:`messages`,label:()=>i(),help:()=>D()},copyAssistant:{category:`messages`,label:()=>ne()},copyUser:{category:`messages`,label:()=>o()},showDelete:{category:`messages`,label:()=>s()},showTools:{category:`messages`,label:()=>ae(),help:()=>B()},voiceInput:{category:`composer`,label:()=>a(),help:()=>ie()},showChatAge:{category:`sidebar`,label:()=>V(),help:()=>fe()},showChatProvider:{category:`sidebar`,label:()=>pe(),help:()=>z()}};function X(e){return e.toLowerCase().normalize(`NFD`).replace(/\p{Diacritic}/gu,``)}function be(e,t){let n=X(t.trim()),r=new Map(J.map(e=>[e.id,e.label()])),i=new Map(J.map(e=>[e.id,[]]));for(let t of e){let e=Y[t],a=e?.category??`other`;n&&!X(`${e?e.label():t} ${e?.help?e.help():``} ${t} ${r.get(a)??``}`).includes(n)||i.get(a).push(t)}return J.map(e=>({id:e.id,label:r.get(e.id),keys:i.get(e.id)})).filter(e=>e.keys.length>0)}var xe=[`showSource`,`showReport`,`copyAssistant`,`copyUser`,`showDelete`,`showTools`,`voiceInput`,`showChatAge`,`showChatProvider`],Se={voiceInput:`voiceInput`};function Ce(e){return xe.includes(e)}function Z(e){return e===`admin`}function we(e){return e===!0?`on`:e===!1?`off`:`inherit`}function Q(e){return e===`on`?!0:e===`off`?!1:null}function Te(e){return Ce(e)?Se[e]:void 0}var $=n(),Ee={voiceInput:()=>F()};function De({prefKey:e,ui:t}){let n=g(d.admin.setUiPrefDefault),r=g(d.admin.setFeatureEnabled),i=Te(e),a=i?Ee[e]?.():void 0;return(0,$.jsxs)(`div`,{className:`oc-prefs__gov`,children:[(0,$.jsxs)(`div`,{className:`oc-prefs__gov-row`,children:[(0,$.jsx)(`span`,{className:`oc-prefs__gov-label`,children:b()}),(0,$.jsxs)(ye,{value:we(t.defaults[e]),onValueChange:t=>void n({key:e,value:Q(t)}),children:[(0,$.jsx)(ge,{size:`sm`,className:`w-36`,children:(0,$.jsx)(he,{})}),(0,$.jsxs)(_e,{children:[(0,$.jsx)(K,{value:`on`,children:de()}),(0,$.jsx)(K,{value:`off`,children:T()}),(0,$.jsx)(K,{value:`inherit`,children:P()})]})]}),i?(0,$.jsxs)(`span`,{className:`oc-prefs__gov-gate`,children:[(0,$.jsx)(U,{checked:t.featuresEnabled[i]===!0,onCheckedChange:e=>void r({key:i,enabled:e===!0}),"aria-label":R()}),R()]}):null]}),a?(0,$.jsx)(`span`,{className:`oc-prefs__gov-help`,children:a}):null]})}function Oe(){let[e,t]=(0,q.useState)(``),[n,r]=(0,q.useState)(!1),i=_(d.me.getMe,{host:W}),a=i?.ui,o=Z(i?.role)&&n,s=g(d.me.setUiPref).withOptimisticUpdate(ve),c=(0,q.useMemo)(()=>a?be(Object.keys(a.effective),e):[],[a,e]);return a?(0,$.jsxs)(`div`,{className:`oc-prefs-panel`,children:[Z(i?.role)?(0,$.jsxs)(`label`,{className:`oc-prefs__gov-toggle`,children:[(0,$.jsx)(U,{checked:n,onCheckedChange:e=>r(e===!0),"aria-label":S()}),S()]}):null,o?(0,$.jsxs)(`div`,{className:`oc-prefs__gov-head`,children:[(0,$.jsx)(`p`,{children:O()}),(0,$.jsx)(`p`,{children:y()}),(0,$.jsx)(`p`,{children:j()})]}):null,(0,$.jsx)(G,{value:e,onChange:e=>t(e.target.value),placeholder:v(),"aria-label":v(),className:`mb-2`}),c.length===0?(0,$.jsx)(`div`,{className:`oc-prefs__empty`,children:C()}):(0,$.jsx)(`div`,{className:`oc-prefs`,children:c.map(e=>(0,$.jsxs)(`div`,{className:`oc-prefs__group`,children:[(0,$.jsx)(`h4`,{className:`oc-prefs__cat`,children:e.label}),e.keys.map(e=>{let t=Y[e],n=t?t.label():e,r=t?.help?.(),i=a.locked[e],c=a.effective[e],l=a.userOverrides[e]!==void 0;return(0,$.jsxs)(`div`,{className:`oc-prefs__row${i?` is-locked`:``}${l&&!i?` is-overridden`:``}`,children:[(0,$.jsxs)(`div`,{className:`oc-prefs__info`,children:[(0,$.jsxs)(`span`,{className:`oc-prefs__label`,children:[n,i?(0,$.jsx)(`span`,{className:`oc-prefs__lock`,children:w()}):l?null:(0,$.jsx)(`span`,{className:`oc-prefs__def`,children:k()})]}),r?(0,$.jsx)(`span`,{className:`oc-prefs__help`,children:r}):null]}),(0,$.jsxs)(`div`,{className:`oc-prefs__ctl`,children:[!i&&l?(0,$.jsx)(`button`,{type:`button`,className:`oc-prefs__reset`,onClick:()=>void s({key:e,value:null}),children:M()}):null,(0,$.jsx)(U,{checked:c,disabled:i,onCheckedChange:t=>void s({key:e,value:t===!0}),"aria-label":n})]}),o?(0,$.jsx)(De,{prefKey:e,ui:a}):null]},e)})]},e.id))})]}):(0,$.jsx)(`div`,{className:`oc-prefs__empty`,children:L()})}function ke(){let e=_(d.me.getMe,{host:W}),t=g(d.me.setLocale),n=g(d.me.setMyName),i=me(),a=e?.locale??`default`,o=e?.name??``,[s,c]=(0,q.useState)(null),u=s??o,f=u.trim()!==o.trim();async function p(){try{await n({name:u}),c(null),i.success(h())}catch(e){i.error(le(),e)}}return(0,$.jsxs)(`div`,{className:`oc-appearance`,children:[(0,$.jsxs)(`section`,{className:`oc-show__section`,children:[(0,$.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,$.jsx)(`h2`,{className:`oc-show__title`,children:A()}),(0,$.jsx)(`p`,{className:`oc-show__desc`,children:I()})]}),(0,$.jsxs)(`div`,{className:`oc-show__row`,children:[(0,$.jsx)(G,{className:`max-w-xs`,value:u,maxLength:120,placeholder:x(),onChange:e=>c(e.target.value),onKeyDown:e=>{e.key===`Enter`&&f&&(e.preventDefault(),p())}}),(0,$.jsx)(H,{size:`sm`,disabled:!f,onClick:()=>void p(),children:re()})]}),(0,$.jsx)(`p`,{className:`oc-show__desc`,children:r()})]}),(0,$.jsxs)(`section`,{className:`oc-show__section`,children:[(0,$.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,$.jsx)(`h2`,{className:`oc-show__title`,children:se()}),(0,$.jsx)(`p`,{className:`oc-show__desc`,children:ce()})]}),(0,$.jsx)(`div`,{className:`oc-show__row`,children:[`fr`,`en`,`default`].map(e=>(0,$.jsx)(H,{variant:a===e?`default`:`outline`,size:`sm`,onClick:()=>void t({locale:e==="default"?null:e}),children:e===`fr`?l():e===`en`?oe():ue()},e))}),(0,$.jsx)(`p`,{className:`oc-show__desc`,children:ee()})]}),(0,$.jsxs)(`section`,{className:`oc-show__section`,children:[(0,$.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,$.jsx)(`h2`,{className:`oc-show__title`,children:N()}),(0,$.jsx)(`p`,{className:`oc-show__desc`,children:te()})]}),(0,$.jsx)(Oe,{})]})]})}export{ke as PreferencesTab};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$s as r,Js as i,LC as a,Qs as o,UC as s,WC as c,Xs as l,Ys as u,Zs as d,_c as f,ac as p,cc as m,dc as h,ec as g,fc as _,ic as v,lc as y,nc as b,oc as x,qs as S,rc as C,sc as w,tc as T,uc as E,vc as D}from"./dist-BhemspoL.js";import{c as O,i as k,l as A,n as j,r as M,s as N,t as P,u as F}from"./FieldLabel-CFckKZrw.js";import{t as I}from"./button-x4eiKyNo.js";import{A as L,C as R,O as z,S as B,b as V,x as H,y as U}from"./index-BlZ8oKFa.js";/* empty css */var W=t(e(),1),G=n(),K={media_delivery:{label:w,help:x},documentary_fetch:{label:p,help:v},inbound_files:{label:C,help:b}},q={outboundDir:`/home/node/.openclaw/media/outbound`,references:`- gdrive/1a2b3c4d5e6f7890abcd
|
|
2
|
+
- gdrive/0f9e8d7c6b5a4321dcba`,files:`- /home/node/.openclaw/media/inbound/rapport.pdf (124800 o, application/pdf)`},J={outboundDir:u,references:i,files:S};function Y(){let e=c(a.admin.listInstances,{}),[t,n]=(0,W.useState)(null);if(e===void 0)return(0,G.jsx)(`div`,{className:`oc-settings__tab-loading`,"aria-busy":`true`});if(e.length===0)return(0,G.jsx)(`div`,{className:`oc-injtab`,children:(0,G.jsx)(`p`,{className:`oc-admin__hint`,children:g()})});let r=e.find(e=>e._id===t)??e[0];return(0,G.jsxs)(`div`,{className:`oc-injtab`,children:[(0,G.jsxs)(`div`,{className:`oc-injtab__head`,children:[(0,G.jsx)(j,{label:_(),help:h()}),(0,G.jsxs)(`label`,{className:`oc-injtab__picker`,children:[(0,G.jsx)(`span`,{children:T()}),(0,G.jsxs)(U,{value:r._id,onValueChange:e=>n(e),children:[(0,G.jsx)(B,{size:`sm`,className:`min-w-44`,children:(0,G.jsx)(R,{})}),(0,G.jsx)(V,{children:e.map(e=>(0,G.jsx)(H,{value:e._id,children:e.displayName??e.name},e._id))})]})]})]}),(0,G.jsx)(X,{instance:r},r._id)]})}function X({instance:e}){let t=s(a.admin.upsertInstanceConfig),n=L(),r=e.config??{},[i,o]=(0,W.useState)(()=>k(r)),[c,l]=(0,W.useState)(!1),u=i.promptInjections,d=(e,t)=>o({...i,promptInjections:{...u,[e]:{...u[e],...t}}});async function p(){l(!0);try{await t({instanceId:e._id,config:M(i,r)})}catch(e){n.error(f(),e)}finally{l(!1)}}return(0,G.jsxs)(`div`,{className:`oc-injtab__body`,children:[O.map(e=>(0,G.jsx)(Z,{injKey:e,def:N[e],i18n:K[e],row:u[e]??{enabled:!0,template:N[e].defaultTemplate},onChange:t=>d(e,t)},e)),(0,G.jsx)(`div`,{className:`oc-injtab__actions`,children:(0,G.jsx)(I,{size:`sm`,onClick:()=>void p(),disabled:c,children:D()})})]})}function Z({injKey:e,def:t,i18n:n,row:i,onChange:a}){let[s,c]=(0,W.useState)(!1),u=i.template.trim()!==t.defaultTemplate,f=t.togglable&&!i.enabled,p=Object.fromEntries(t.placeholders.map(e=>[e,q[e]??`{${e}}`])),h=A(e,i),g=h?F(h,p):``;return(0,G.jsxs)(`section`,{className:`oc-injcard`,children:[(0,G.jsxs)(`div`,{className:`oc-injcard__head`,children:[t.togglable?(0,G.jsxs)(`label`,{className:`oc-field--row`,children:[(0,G.jsx)(z,{checked:i.enabled,onCheckedChange:e=>a({enabled:e===!0})}),(0,G.jsx)(j,{label:n.label(),help:n.help()})]}):(0,G.jsx)(j,{label:n.label(),help:n.help()}),u&&(0,G.jsx)(`span`,{className:`oc-injection__badge`,children:y()})]}),(0,G.jsx)(`textarea`,{className:`oc-injcard__text`,value:i.template,disabled:f,rows:8,spellCheck:!1,onChange:e=>a({template:e.target.value})}),(0,G.jsxs)(`div`,{className:`oc-injection__foot`,children:[(0,G.jsxs)(`div`,{className:`oc-injcard__phs`,children:[(0,G.jsx)(`span`,{className:`oc-injection__ph`,children:m()}),t.placeholders.map(e=>(0,G.jsxs)(`span`,{className:`oc-injcard__ph-chip`,children:[(0,G.jsx)(`code`,{children:`{${e}}`}),(0,G.jsx)(P,{text:(J[e]??(()=>e))()})]},e))]}),(0,G.jsxs)(`div`,{className:`oc-injcard__btns`,children:[(0,G.jsx)(I,{variant:`ghost`,size:`sm`,onClick:()=>c(e=>!e),children:s?o():r()}),u&&(0,G.jsx)(I,{variant:`ghost`,size:`sm`,onClick:()=>a({template:t.defaultTemplate}),children:E()})]})]}),s&&(0,G.jsx)(`div`,{className:`oc-injcard__preview`,children:g?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`pre`,{className:`oc-injcard__previewtext`,children:g}),(0,G.jsx)(`span`,{className:`oc-injection__ph`,children:d()})]}):(0,G.jsx)(`span`,{className:`oc-injection__ph`,children:l()})})]})}export{Y as PromptInjectionsTab};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$d as r,Ad as i,Bd as ee,Dd as te,Fd as ne,Gd as a,Hd as o,Id as s,Jd as c,Kd as l,LC as u,Ld as d,Md as re,Nd as f,Od as p,Pd as m,Qd as h,Rd as g,UC as _,Ud as v,Vd as y,WC as ie,Wd as b,Xd as x,Yd as S,Zd as C,_d as w,bd as T,ef as E,gd as D,hd as O,jd as k,kd as A,md as j,nf as M,pd as N,qd as P,tf as F,vd as I,xd as L,yd as R,zd as ae}from"./dist-BhemspoL.js";import{t as z}from"./button-x4eiKyNo.js";import{A as B,O as V,bt as H,h as U,j as W,m as G,q as K}from"./index-BlZ8oKFa.js";import{t as q}from"./roleDescriptions-DJHA0ezr.js";var J=t(e(),1),Y=n(),X=[{group:()=>M(),keys:[{key:`traces.read`,label:()=>C()},{key:`traces.read.content`,label:()=>x(),phi:!0},{key:`traces.write`,label:()=>S()}]},{group:()=>F(),keys:[{key:`kpi.read`,label:()=>C()},{key:`kpi.write`,label:()=>S()}]},{group:()=>E(),keys:[{key:`openclaw.query`,label:()=>c()},{key:`anomalies.read`,label:()=>P()},{key:`anomalies.report`,label:()=>l()}]},{group:()=>r(),keys:[{key:`chats.read`,label:()=>C()},{key:`selfheal`,label:()=>b()}]},{group:()=>h(),keys:[{key:`admin.manage`,label:()=>a()}]}],oe=X.flatMap(e=>e.keys.map(e=>e.key));function Z(e){return e.includes(`*`)}var Q={key:``,name:``,description:``};function $(){let e=ie(u.apiKeys.listRoles,{}),t=_(u.apiKeys.createRole),n=_(u.apiKeys.ensureRolesSeeded),r=_(u.apiKeys.updateRolePermissions).withOptimisticUpdate((e,{roleId:t,permissions:n})=>{let r=e.getQuery(u.apiKeys.listRoles,{});r&&e.setQuery(u.apiKeys.listRoles,{},r.map(e=>e._id===t?{...e,permissions:n}:e))}),a=W(),c=B(),[l,h]=(0,J.useState)(!1),[b,x]=(0,J.useState)(Q),[S,C]=(0,J.useState)(new Set);(0,J.useEffect)(()=>{n({}).catch(e=>{c.error(o(),e)})},[n,c]);let E=e??[];async function M(e,t){if(Z(e.permissions)||S.has(e._id))return;let n=e.permissions.includes(t)?e.permissions.filter(e=>e!==t):[...e.permissions,t];if(!(e.builtin&&!await a({title:y({name:e.name}),description:ee(),confirmLabel:ae()}))){C(t=>new Set(t).add(e._id));try{await r({roleId:e._id,permissions:n})}catch(e){c.error(g(),e)}finally{C(t=>{let n=new Set(t);return n.delete(e._id),n})}}}async function P(){try{await t({key:b.key,name:b.name,description:b.description||void 0,permissions:[]}),x(Q),h(!1)}catch(e){c.error(d(),e)}}let F=e===void 0,$=!F&&E.length===0;return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(`p`,{className:`oc-admin__hint`,children:[s(),` `,(0,Y.jsx)(`code`,{children:`admin`}),` `,ne(),` `,(0,Y.jsx)(`code`,{children:`traces.read.content`}),` `,m()]}),(0,Y.jsxs)(`div`,{className:`oc-dt`,children:[(0,Y.jsxs)(`div`,{className:`oc-dt__bar`,children:[(0,Y.jsx)(`h2`,{className:`oc-dt__title`,children:f()}),(0,Y.jsx)(`div`,{className:`oc-dt__bar-actions`,children:(0,Y.jsx)(z,{size:`sm`,onClick:()=>{x(Q),h(!0)},children:re()})})]}),F?(0,Y.jsx)(`p`,{className:`oc-admin__hint`,children:k()}):$?(0,Y.jsx)(`p`,{className:`oc-admin__hint`,children:i()}):(0,Y.jsx)(`div`,{className:`oc-matrix__scroll`,children:(0,Y.jsxs)(`table`,{className:`oc-matrix`,children:[(0,Y.jsxs)(`thead`,{children:[(0,Y.jsxs)(`tr`,{children:[(0,Y.jsx)(`th`,{className:`oc-matrix__corner`,rowSpan:2,children:A()}),X.map(e=>(0,Y.jsx)(`th`,{className:`oc-matrix__group`,colSpan:e.keys.length,children:e.group()},e.group()))]}),(0,Y.jsx)(`tr`,{children:X.flatMap(e=>e.keys.map(e=>(0,Y.jsxs)(`th`,{className:`oc-matrix__perm`,title:e.phi?v({key:e.key}):e.key,children:[e.label(),e.phi?(0,Y.jsx)(`span`,{className:`oc-matrix__phi`,children:` ⚠`}):null]},e.key)))})]}),(0,Y.jsx)(`tbody`,{children:E.map(e=>{let t=Z(e.permissions),n=S.has(e._id);return(0,Y.jsxs)(`tr`,{children:[(0,Y.jsxs)(`th`,{className:`oc-matrix__rolecell`,children:[(0,Y.jsxs)(`div`,{className:`oc-matrix__rolename`,children:[(0,Y.jsx)(`span`,{children:e.name}),(0,Y.jsx)(`code`,{className:`oc-matrix__rolekey`,children:e.key}),e.builtin?(0,Y.jsxs)(G,{variant:`outline`,className:`gap-1`,children:[(0,Y.jsx)(H,{}),` `,p()]}):(0,Y.jsx)(G,{variant:`secondary`,children:te()})]}),q(e)?(0,Y.jsx)(`p`,{className:`oc-matrix__roledesc`,children:q(e)}):null]}),oe.map(r=>(0,Y.jsx)(`td`,{className:`oc-matrix__cell`,children:(0,Y.jsx)(V,{checked:t||e.permissions.includes(r),disabled:t||n,"aria-label":`${e.key} · ${r}`,title:t?L():n?T():r,onCheckedChange:()=>void M(e,r)})},r))]},e.key)})})]})})]}),(0,Y.jsx)(U,{open:l,onOpenChange:h,title:R(),description:I(),canSubmit:!!(b.key&&b.name),onSubmit:P,submitLabel:w(),children:(0,Y.jsxs)(`div`,{className:`oc-form`,children:[(0,Y.jsxs)(`label`,{className:`oc-field`,children:[(0,Y.jsx)(`span`,{className:`oc-field__label`,children:D()}),(0,Y.jsx)(K,{value:b.key,placeholder:O(),onChange:e=>x({...b,key:e.target.value})})]}),(0,Y.jsxs)(`label`,{className:`oc-field`,children:[(0,Y.jsx)(`span`,{className:`oc-field__label`,children:j()}),(0,Y.jsx)(K,{value:b.name,onChange:e=>x({...b,name:e.target.value})})]}),(0,Y.jsxs)(`label`,{className:`oc-field`,children:[(0,Y.jsx)(`span`,{className:`oc-field__label`,children:N()}),(0,Y.jsx)(K,{value:b.description,onChange:e=>x({...b,description:e.target.value})})]})]})})]})}export{$ as RolesTab};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$v as r,$y as i,Ay as ee,Bv as a,By as te,Cy as ne,Dy as re,Ey as ie,Fy as ae,Gv as o,Gy as oe,Hv as s,Hy as se,Iv as ce,Iy as le,Jv as ue,Jy as de,Kv as c,Ky as fe,LC as l,Lv as u,Ly as pe,My as me,Ny as he,Oy as ge,Py as _e,Qv as d,Qy as ve,Rv as f,Ry as ye,Sy as be,Ty as xe,UC as p,Uv as m,Uy as Se,VC as Ce,Vv as h,Vy as we,WC as g,Wv as _,Wy as Te,Xv as v,Xy as y,Yv as b,Yy as Ee,Zv as x,Zy as S,_y as De,ay as C,by as Oe,cy as ke,dy as Ae,eb as je,ey as w,fy as Me,gy as Ne,hy as Pe,iy as T,jy as Fe,ky as Ie,ly as Le,my as Re,nb as ze,ny as E,oy as Be,py as Ve,qv as D,qy as He,ry as O,sy as Ue,tb as We,ty as k,uy as Ge,vy as Ke,wy as qe,xy as Je,yy as Ye,zv as A,zy as Xe}from"./dist-BhemspoL.js";import{n as j}from"./dist-uStCogeE.js";import{i as Ze}from"./dist-BiCy_qcc.js";import{t as M}from"./button-x4eiKyNo.js";import{A as Qe,C as N,Dt as $e,Et as et,F as P,I as F,L as I,N as L,Ot as tt,P as R,R as z,S as B,b as V,h as nt,j as rt,m as H,q as U,wt as W,x as G,y as K}from"./index-BlZ8oKFa.js";import{t as it}from"./FilterBar-DB-b7WAm.js";import{t as at}from"./DataTableShell-BpD7pA0i.js";import{t as ot}from"./roleDescriptions-DJHA0ezr.js";var q=t(e(),1),J=n(),st=[{value:`never`,label:()=>s(),days:null},{value:`30`,label:()=>h(),days:30},{value:`90`,label:()=>a(),days:90}],ct=720*60*60*1e3,Y=`__all__`,X={name:``,roleKey:``,description:``};function Z(){let e=tt({from:`/settings/serviceAccounts`}),t=$e({from:`/settings/serviceAccounts`}),n=e.q??``,r=e.status??Y,[a,o]=(0,q.useState)(Y),s=e=>void t({search:t=>({...t,q:e||void 0}),replace:!0}),ce=e=>void t({search:t=>({...t,status:e===Y?void 0:e})}),ue=g(l.apiKeys.listServiceAccounts,{filter:{q:n||void 0,role:a===Y?void 0:a,disabled:r===Y?void 0:r===`disabled`}}),c=g(l.apiKeys.listKeys,{}),u=g(l.apiKeys.listRoles,{}),d=p(l.apiKeys.createServiceAccount),f=p(l.apiKeys.updateServiceAccount),m=p(l.apiKeys.deleteServiceAccount),h=Ce(l.apiKeys.mintApiKey),_=p(l.apiKeys.revokeApiKey),v=rt(),b=Qe(),x=n!==``||a!==Y||r!==Y;function C(){o(Y),t({search:{},replace:!0})}let[w,T]=(0,q.useState)(!1),[E,D]=(0,q.useState)(X),[O,k]=(0,q.useState)(null),[A,j]=(0,q.useState)(new Set),[P,F]=(0,q.useState)(null),I=(0,q.useRef)(!1),[L,R]=(0,q.useState)(new Set),[z,W]=(0,q.useState)({}),[ct,Z]=(0,q.useState)(null),Q=(0,q.useMemo)(()=>{let e=new Map;for(let t of c??[]){let n=e.get(t.serviceAccountId)??[];n.push(t),e.set(t.serviceAccountId,n)}return e},[c]);function $(e){j(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})}async function dt(){try{O?(await f({serviceAccountId:O,name:E.name,roleKey:E.roleKey,description:E.description}),b.success(Oe())):await d({name:E.name,roleKey:E.roleKey,description:E.description||void 0}),D(X),k(null),T(!1)}catch(e){b.error(O?Je():be(),e)}}function ft(e){D({name:e.name,roleKey:e.roleKey,description:e.description??``}),k(e._id),T(!0)}async function pt(e){if(I.current)return;I.current=!0;let t=z[e._id]??`never`,n=st.find(e=>e.value===t)?.days??null,r=n?Date.now()+n*24*60*60*1e3:void 0;F(e._id);try{let t=await h({serviceAccountId:e._id,expiresAt:r});Z({accountName:e.name,plaintext:t.plaintext,prefix:t.prefix,lastFour:t.lastFour})}catch(e){b.error(Ye(),e)}finally{I.current=!1,F(null)}}async function mt(e){if(await v({title:Ke(),description:(0,J.jsxs)(J.Fragment,{children:[De(),` `,(0,J.jsx)(`span`,{className:`font-mono`,children:e.name}),` `,Ne(),` `,(0,J.jsx)(`strong`,{children:Pe()}),` `,Re()]}),confirmWord:e.name,confirmLabel:Ve(),destructive:!0}))try{await m({serviceAccountId:e._id}),b.success(Me(),e.name)}catch(e){b.error(Ae(),e)}}async function ht(e){if(await v({title:Ge(),description:(0,J.jsxs)(J.Fragment,{children:[Le(),` `,(0,J.jsxs)(`span`,{className:`font-mono`,children:[e.prefix,`…`,e.lastFour]}),` `,ke()]}),confirmLabel:Ue(),destructive:!0})&&!L.has(e._id)){R(t=>new Set(t).add(e._id));try{await _({keyId:e._id})}catch(e){b.error(Be(),e)}finally{R(t=>{let n=new Set(t);return n.delete(e._id),n})}}}return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(`p`,{className:`oc-admin__hint`,children:ze()}),(0,J.jsxs)(it,{q:n,onQChange:s,searchPlaceholder:We(),onReset:C,canReset:x,children:[(0,J.jsxs)(K,{value:a,onValueChange:o,children:[(0,J.jsx)(B,{size:`sm`,className:`w-40`,children:(0,J.jsx)(N,{placeholder:je()})}),(0,J.jsxs)(V,{children:[(0,J.jsx)(G,{value:Y,children:i()}),(u??[]).map(e=>(0,J.jsx)(G,{value:e.key,children:e.key},e._id))]})]}),(0,J.jsxs)(K,{value:r,onValueChange:ce,children:[(0,J.jsx)(B,{size:`sm`,className:`w-36`,children:(0,J.jsx)(N,{})}),(0,J.jsxs)(V,{children:[(0,J.jsx)(G,{value:Y,children:ve()}),(0,J.jsx)(G,{value:`active`,children:S()}),(0,J.jsx)(G,{value:`disabled`,children:y()})]})]})]}),(0,J.jsx)(at,{title:Ee(),rows:ue,addLabel:de(),onAdd:()=>{D(X),k(null),T(!0)},emptyHint:He(),isExpanded:e=>A.has(e._id),renderExpanded:e=>(0,J.jsx)(lt,{account:e,keys:Q.get(e._id)??[],onRevoke:ht,revoking:L}),rowActions:e=>[{label:Se(),onSelect:()=>ft(e)},{label:fe(),onSelect:()=>void pt(e)},{label:A.has(e._id)?oe():Te(),onSelect:()=>$(e._id)},{label:se(),variant:`destructive`,onSelect:()=>void mt(e)}],columns:[{header:``,className:`w-8`,cell:e=>(0,J.jsx)(M,{variant:`ghost`,size:`icon-sm`,"aria-label":A.has(e._id)?we():te(),onClick:()=>$(e._id),children:A.has(e._id)?(0,J.jsx)(Ze,{}):(0,J.jsx)(et,{})})},{header:Xe(),sort:e=>e.name,cell:e=>(0,J.jsxs)(`div`,{className:`flex flex-col`,children:[(0,J.jsx)(`span`,{children:e.name}),e.description?(0,J.jsx)(`span`,{className:`text-muted-foreground text-xs`,children:e.description}):null]})},{header:ye(),sort:e=>e.roleKey,cell:e=>(0,J.jsx)(H,{variant:`secondary`,children:e.roleKey})},{header:pe(),sort:e=>+!!e.disabled,cell:e=>e.disabled?(0,J.jsx)(H,{variant:`destructive`,children:y()}):(0,J.jsx)(H,{variant:`outline`,children:S()})},{header:le(),cell:e=>(0,J.jsxs)(K,{value:z[e._id]??`never`,onValueChange:t=>W(n=>({...n,[e._id]:t})),children:[(0,J.jsx)(B,{size:`sm`,className:`w-32`,children:(0,J.jsx)(N,{})}),(0,J.jsx)(V,{children:st.map(e=>(0,J.jsx)(G,{value:e.value,children:e.label()},e.value))})]})},{header:ae(),sort:e=>(Q.get(e._id)??[]).filter(e=>!e.disabled).length,cell:e=>{let t=(Q.get(e._id)??[]).filter(e=>!e.disabled).length;return(0,J.jsx)(`span`,{className:`oc-sa__keycount`,children:P===e._id?_e():he({count:t})})}}]}),(0,J.jsx)(nt,{open:w,onOpenChange:e=>{T(e),e||k(null)},title:O?me():Ie(),description:O?Fe():ge(),canSubmit:!!(E.name&&E.roleKey),onSubmit:dt,submitLabel:O?ee():re(),children:(0,J.jsxs)(`div`,{className:`oc-form`,children:[(0,J.jsxs)(`label`,{className:`oc-field`,children:[(0,J.jsx)(`span`,{className:`oc-field__label`,children:ie()}),(0,J.jsx)(U,{value:E.name,onChange:e=>D({...E,name:e.target.value})})]}),(0,J.jsxs)(`label`,{className:`oc-field`,children:[(0,J.jsx)(`span`,{className:`oc-field__label`,children:xe()}),(0,J.jsxs)(K,{value:E.roleKey||void 0,onValueChange:e=>D({...E,roleKey:e}),children:[(0,J.jsx)(B,{className:`w-full`,children:(0,J.jsx)(N,{placeholder:qe()})}),(0,J.jsx)(V,{children:(u??[]).map(e=>(0,J.jsxs)(G,{value:e.key,children:[e.name,` (`,e.key,`)`]},e._id))})]}),(()=>{let e=(u??[]).find(e=>e.key===E.roleKey),t=e?ot(e):null;return t?(0,J.jsx)(`span`,{className:`text-muted-foreground text-xs`,children:t}):null})()]}),(0,J.jsxs)(`label`,{className:`oc-field`,children:[(0,J.jsx)(`span`,{className:`oc-field__label`,children:ne()}),(0,J.jsx)(U,{value:E.description,onChange:e=>D({...E,description:e.target.value})})]})]})}),(0,J.jsx)(ut,{minted:ct,onClose:()=>Z(null)})]})}function lt({account:e,keys:t,onRevoke:n,revoking:i}){return(0,J.jsxs)(`div`,{className:`oc-sa__keys`,children:[(0,J.jsxs)(`div`,{className:`oc-sa__keys-head`,children:[C(),` `,(0,J.jsx)(`span`,{className:`font-medium`,children:e.name})]}),t.length===0?(0,J.jsx)(`p`,{className:`oc-admin__hint`,children:T()}):(0,J.jsxs)(`table`,{className:`oc-sa__keytable`,children:[(0,J.jsx)(`thead`,{children:(0,J.jsxs)(`tr`,{children:[(0,J.jsx)(`th`,{children:O()}),(0,J.jsx)(`th`,{children:E()}),(0,J.jsx)(`th`,{children:k()}),(0,J.jsx)(`th`,{children:w()}),(0,J.jsx)(`th`,{children:r()}),(0,J.jsx)(`th`,{children:d()}),(0,J.jsx)(`th`,{})]})}),(0,J.jsx)(`tbody`,{children:t.map(t=>(0,J.jsxs)(`tr`,{children:[(0,J.jsx)(`td`,{children:(0,J.jsxs)(`code`,{className:`oc-sa__keyid`,children:[t.prefix,`…`,t.lastFour]})}),(0,J.jsx)(`td`,{children:(0,J.jsx)(H,{variant:`secondary`,children:e.roleKey})}),(0,J.jsx)(`td`,{children:Q(t.createdAt)}),(0,J.jsx)(`td`,{className:$(t.lastUsedAt)?`oc-sa__stale`:``,children:dt(t.lastUsedAt)}),(0,J.jsx)(`td`,{children:ft(t.expiresAt)}),(0,J.jsx)(`td`,{children:pt(t)}),(0,J.jsx)(`td`,{className:`text-right`,children:t.disabled?null:(0,J.jsx)(M,{variant:`destructive`,size:`sm`,disabled:i.has(t._id),onClick:()=>n(t),children:i.has(t._id)?x():v()})})]},t._id))})]})]})}function ut({minted:e,onClose:t}){let[n,r]=(0,q.useState)(!1);async function i(){if(e)try{await navigator.clipboard.writeText(e.plaintext),r(!0),window.setTimeout(()=>r(!1),2e3)}catch{}}return(0,J.jsx)(L,{open:e!==null,onOpenChange:e=>{e||(r(!1),t())},children:e?(0,J.jsxs)(R,{className:`max-w-lg`,showCloseButton:!1,onInteractOutside:e=>e.preventDefault(),onEscapeKeyDown:e=>e.preventDefault(),children:[(0,J.jsxs)(I,{children:[(0,J.jsx)(z,{children:b()}),(0,J.jsx)(P,{children:ue({name:e.accountName})})]}),(0,J.jsx)(`div`,{className:`oc-sa__minted-warning`,children:D()}),(0,J.jsxs)(`div`,{className:`oc-sa__minted-box`,children:[(0,J.jsx)(`code`,{className:`oc-sa__minted-plain`,children:e.plaintext}),(0,J.jsxs)(M,{variant:`outline`,size:`sm`,onClick:()=>void i(),"aria-label":c(),children:[n?(0,J.jsx)(j,{}):(0,J.jsx)(W,{}),n?o():_()]})]}),(0,J.jsx)(F,{children:(0,J.jsx)(M,{onClick:()=>{r(!1),t()},children:m()})})]}):null})}function Q(e){return new Date(e).toLocaleString(`fr-FR`)}function $(e){return e===null?!1:Date.now()-e>ct}function dt(e){return e===null?A():new Date(e).toLocaleString(`fr-FR`)}function ft(e){return e===null?`—`:new Date(e).toLocaleDateString(`fr-FR`)}function pt(e){return e.disabled?(0,J.jsx)(H,{variant:`destructive`,children:f()}):e.expiresAt!==null&&e.expiresAt<Date.now()?(0,J.jsx)(H,{variant:`outline`,children:u()}):(0,J.jsx)(H,{variant:`outline`,children:ce()})}export{Z as ServiceAccountsTab};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$b as r,$x as i,Ax as a,Bb as o,Bx as s,Cx as c,Dx as l,Ex as u,Fx as d,GS as f,Gb as p,Gx as m,Hb as h,Hx as g,Ix as ee,Jb as te,Jx as ne,Kb as re,Kx as ie,LC as _,Lb as ae,Lx as oe,Mx as se,Nx as ce,Ox as le,Px as ue,Qb as de,Qx as fe,RC as pe,Rb as me,Rx as he,Sx as v,Tx as ge,UC as y,Ub as _e,Ux as ve,VC as ye,Vb as b,Vx as be,WC as x,WS as xe,Wb as Se,Wx as Ce,Xb as we,Xx as Te,Yb as Ee,Yx as S,Zb as De,Zx as Oe,_x as ke,aS as Ae,ax as je,bx as Me,cC as Ne,cx as Pe,dx as Fe,eS as Ie,ex as Le,fx as Re,gx as ze,hx as Be,iS as Ve,ix as He,jx as Ue,kx as We,lx as Ge,mx as Ke,n as qe,nS as Je,nx as Ye,oC as Xe,ox as Ze,px as Qe,qb as $e,qx as et,rS as tt,rx as C,sC as nt,sx as rt,tS as it,tx as at,ux as ot,vx as st,wx as ct,xx as lt,yx as ut,zb as dt,zx as ft}from"./dist-BhemspoL.js";import{n as w}from"./dist-uStCogeE.js";import{t as pt}from"./TimeRangePicker--wX3a-5x.js";import{t as T}from"./x-C9JKw9Pc.js";import{t as E}from"./button-x4eiKyNo.js";import{$ as D,C as O,O as k,Q as mt,S as A,St as j,Z as ht,at as M,b as N,et as gt,it as _t,m as P,nt as vt,q as F,rt as yt,tt as I,x as L,y as R}from"./index-BlZ8oKFa.js";import{a as bt,i as xt,n as St,o as Ct,r as wt,t as Tt}from"./card-BpwyvJ1X.js";import{a as Et,i as z,n as Dt,o as B,r as V,t as Ot}from"./table-BQp_EgUj.js";import{t as kt}from"./FilterBar-DB-b7WAm.js";import{t as At}from"./AdvancedFilter-EPxqO-eA.js";var H=pe(`upload`,[[`path`,{d:`M12 3v12`,key:`1x0j5s`}],[`path`,{d:`m17 8-5-5-5 5`,key:`7q97r8`}],[`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`,key:`ih7n3h`}]]),U=t(e(),1),jt=.1,Mt=[248,248,248],Nt=[24,24,24];function Pt(e,t,n){let r=t,i=n,a=-1,o=-1;for(let s=0;s<n;s++)for(let n=0;n<t;n++)e[(s*t+n)*4+3]>8&&(n<r&&(r=n),n>a&&(a=n),s<i&&(i=s),s>o&&(o=s));return a<0?null:{x:r,y:i,width:a-r+1,height:o-i+1}}function Ft(e,t,n){let r=t*n;if(r===0)return 0;let i=0;for(let t=3;t<e.length;t+=4)e[t]<=8&&i++;return i/r}function W(e,t,n){return Ft(e,t,n)>=jt}function It(e,t){for(let n=0;n<e.length;n+=4)e[n]=t[0],e[n+1]=t[1],e[n+2]=t[2]}function Lt(e){for(let t=0;t<e.length;t+=4)e[t]=255-e[t],e[t+1]=255-e[t+1],e[t+2]=255-e[t+2]}var Rt=12*1024*1024,zt=480,Bt=160,Vt=.92;async function Ht(e,t={}){if(!e.type.startsWith(`image/`))throw Error(Ze());if(e.size>Rt)throw Error(je());let{source:n,width:r,height:i,cleanup:a}=await Ut(e);try{let a=e.type===`image/svg+xml`,o=Math.min(zt/r,Bt/i,a?1/0:1),s=Math.max(1,Math.round(r*o)),c=Math.max(1,Math.round(i*o)),l=document.createElement(`canvas`);l.width=s,l.height=c;let u=l.getContext(`2d`);if(!u)throw Error(C());u.imageSmoothingEnabled=!0,u.imageSmoothingQuality=`high`,u.drawImage(n,0,0,s,c);let d=Pt(u.getImageData(0,0,s,c).data,s,c)??{x:0,y:0,width:s,height:c},f=document.createElement(`canvas`);f.width=d.width,f.height=d.height;let p=f.getContext(`2d`);if(!p)throw Error(C());if(p.drawImage(l,d.x,d.y,d.width,d.height,0,0,d.width,d.height),t.variantFor){let e=p.getImageData(0,0,d.width,d.height);W(e.data,d.width,d.height)?It(e.data,t.variantFor===`dark`?Mt:Nt):Lt(e.data),p.putImageData(e,0,0)}let m=W(p.getImageData(0,0,d.width,d.height).data,d.width,d.height),h=await K(f,`image/webp`,Vt)??await K(f,`image/png`);if(!h)throw Error(Ye());return{blob:h,hasAlpha:m}}finally{a()}}async function Ut(e){if(e.type===`image/svg+xml`)return G(e);if(typeof createImageBitmap==`function`)try{let t=await createImageBitmap(e);return{source:t,width:t.width,height:t.height,cleanup:()=>t.close()}}catch{}return G(e)}async function G(e){let t=URL.createObjectURL(e);try{let e=new Image;return e.decoding=`async`,await new Promise((n,r)=>{e.onload=()=>n(),e.onerror=()=>r(Error(He())),e.src=t}),{source:e,width:e.naturalWidth||300,height:e.naturalHeight||150,cleanup:()=>URL.revokeObjectURL(t)}}catch(e){throw URL.revokeObjectURL(t),e}}function K(e,t,n){return new Promise(r=>e.toBlob(e=>r(e),t,n))}var q=n(),J=`__all__`,Y={kind:`relative`,from:`now-24h`,to:`now`},X=[{value:`status`,label:`Statut`},{value:`latencyMs`,label:`Latence (ms)`},{value:`route`,label:`Route`},{value:`roleKey`,label:`Rôle`},{value:`correlationId`,label:`Corrélation`}];function Z({title:e,description:t,children:n}){return(0,q.jsxs)(`section`,{className:`oc-show__section`,children:[(0,q.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,q.jsx)(`h2`,{className:`oc-show__title`,children:e}),t?(0,q.jsx)(`p`,{className:`oc-show__desc`,children:t}):null]}),(0,q.jsx)(`div`,{className:`oc-show__demo`,children:n})]})}function Wt(e){return e===`light`?Ne():e===`dark`?nt():Xe()}var Gt=[`primary`,`secondary`,`accent`,`muted`,`chart-1`,`chart-2`];function Kt({tokens:e,mode:t}){let n=e.colors[t];return(0,q.jsx)(`div`,{className:`oc-chart-swatches`,"aria-hidden":!0,children:Gt.map(e=>{let t=n[e];return(0,q.jsx)(`span`,{className:`oc-chart-swatch`,style:t?{background:t}:void 0},e)})})}function Q({selected:e,title:t,subtitle:n,tokens:r,mode:i,onSelect:a}){return(0,q.jsxs)(`button`,{type:`button`,className:qe(`oc-chart-card`,e&&`oc-chart-card--selected`),"aria-pressed":e,onClick:a,children:[(0,q.jsxs)(`div`,{className:`oc-chart-card__head`,children:[(0,q.jsx)(`span`,{className:`oc-chart-card__title`,children:t}),e?(0,q.jsx)(w,{className:`size-4 text-primary`,"aria-hidden":!0}):null]}),r?(0,q.jsx)(Kt,{tokens:r,mode:i}):(0,q.jsx)(`div`,{className:`oc-chart-swatches oc-chart-swatches--native`,"aria-hidden":!0}),(0,q.jsx)(`div`,{className:`oc-chart-card__meta`,children:(0,q.jsx)(`span`,{className:`oc-chart-card__subtitle`,children:n})})]})}function qt({selectedKey:e,resolvedMode:t}){let n=x(_.charts.listMyCharts),r=y(_.charts.setMyChart);async function i(e){try{await r({name:e})}catch{}}return(0,q.jsxs)(`section`,{className:`oc-show__section`,children:[(0,q.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,q.jsx)(`h2`,{className:`oc-show__title`,children:Oe()}),(0,q.jsx)(`p`,{className:`oc-show__desc`,children:Te()})]}),(0,q.jsxs)(`div`,{className:`oc-chart-grid`,children:[(0,q.jsx)(Q,{selected:e===null,title:S(),subtitle:ne(),tokens:null,mode:t,onSelect:()=>void i(null)}),(n??[]).map(n=>{let r=n.via===`common`?et():n.via===`owner`?ie():m({group:n.via.group});return(0,q.jsx)(Q,{selected:e===n.key,title:n.name,subtitle:r,tokens:n.tokens,mode:t,onSelect:()=>void i(n.key)},n.key)})]}),n!==void 0&&n.length===0?(0,q.jsx)(`p`,{className:`oc-show__desc`,children:Ce()}):null]})}function Jt(){let e=y(_.charts.importChart),[t,n]=(0,U.useState)(``),[r,i]=(0,U.useState)(``),[o,s]=(0,U.useState)(null),[d,f]=(0,U.useState)(!1),[p,m]=(0,U.useState)(!1);async function h(e){let t=e.target.files?.[0];if(e.target.value=``,t){s(null),f(!1);try{i(await t.text())}catch{s(v())}}}async function g(){if(s(null),f(!1),t.trim()===``){s(Me());return}let a;try{a=JSON.parse(r)}catch{s(v());return}m(!0);try{await e({name:t.trim(),tokens:a}),f(!0),n(``),i(``)}catch(e){s(e instanceof Error?e.message:String(e))}finally{m(!1)}}return(0,q.jsxs)(`section`,{className:`oc-show__section`,children:[(0,q.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,q.jsx)(`h2`,{className:`oc-show__title`,children:a()}),(0,q.jsx)(`p`,{className:`oc-show__desc`,children:We()})]}),(0,q.jsxs)(`div`,{className:`oc-chart-import`,children:[(0,q.jsxs)(`label`,{className:`oc-chart-import__field`,children:[(0,q.jsx)(`span`,{className:`oc-chart-import__label`,children:le()}),(0,q.jsx)(F,{value:t,onChange:e=>n(e.target.value),placeholder:l(),maxLength:60})]}),(0,q.jsxs)(`label`,{className:`oc-chart-import__field`,children:[(0,q.jsx)(`span`,{className:`oc-chart-import__label`,children:u()}),(0,q.jsx)(`textarea`,{className:`oc-chart-import__textarea`,value:r,onChange:e=>i(e.target.value),placeholder:ge(),rows:8,spellCheck:!1})]}),(0,q.jsxs)(`div`,{className:`oc-show__row`,children:[(0,q.jsx)(E,{variant:`outline`,size:`sm`,asChild:!0,children:(0,q.jsxs)(`label`,{className:`oc-chart-import__file`,children:[(0,q.jsx)(H,{className:`size-4`}),ct(),(0,q.jsx)(`input`,{type:`file`,accept:`application/json,.json`,className:`oc-chart-import__file-input`,onChange:e=>void h(e)})]})}),(0,q.jsx)(E,{size:`sm`,disabled:p,onClick:()=>void g(),children:c()})]}),o?(0,q.jsx)(`p`,{className:`oc-chart-import__error`,children:o}):null,d?(0,q.jsx)(`p`,{className:`oc-chart-import__ok`,children:lt()}):null]})]})}function Yt({chart:e}){let t=ye(_.charts.setChartLogo),n=y(_.charts.removeChartLogo),[r,i]=(0,U.useState)(!1),[a,o]=(0,U.useState)(null),s=t=>t===`light`?e.logoLightUrl:e.logoDarkUrl;async function c(n,r,a){if(e.chartId!==void 0){o(null),i(!0);try{let{blob:i,hasAlpha:o}=await Ht(r,a?{variantFor:a}:{}),s=await i.arrayBuffer();await t({chartId:e.chartId,bytes:s,mode:n,hasAlpha:o})}catch(e){o(e instanceof Error?e.message:String(e))}finally{i(!1)}}}async function l(e,t){let n=t.target.files?.[0];t.target.value=``,n&&await c(e,n)}async function u(t){if(e.chartId!==void 0){o(null),i(!0);try{await n({chartId:e.chartId,mode:t})}catch(e){o(e instanceof Error?e.message:String(e))}finally{i(!1)}}}async function d(e){let t=s(e===`light`?`dark`:`light`);if(t){o(null),i(!0);try{await c(e,await(await fetch(t)).blob(),e)}catch(e){o(e instanceof Error?e.message:String(e))}finally{i(!1)}}}function f({mode:e}){let t=s(e),n=s(e===`light`?`dark`:`light`);return(0,q.jsxs)(`div`,{className:`oc-chart-mine__logo-slot`,children:[(0,q.jsx)(`span`,{className:`oc-chart-mine__logo-mode`,children:e===`light`?Qe():Re()}),(0,q.jsx)(`span`,{className:`oc-chart-mine__logo-preview`,"data-mode":e,"data-empty":t?void 0:`1`,children:t?(0,q.jsx)(`img`,{src:t,alt:``}):null}),(0,q.jsx)(E,{variant:`outline`,size:`sm`,asChild:!0,children:(0,q.jsxs)(`label`,{className:`oc-chart-import__file`,children:[(0,q.jsx)(H,{className:`size-4`}),t?ot():Fe(),(0,q.jsx)(`input`,{type:`file`,accept:`image/*`,className:`oc-chart-import__file-input`,onChange:t=>void l(e,t)})]})}),!t&&n?(0,q.jsx)(E,{variant:`ghost`,size:`sm`,disabled:r,onClick:()=>void d(e),children:Pe()}):null,t?(0,q.jsx)(E,{variant:`ghost`,size:`sm`,disabled:r,onClick:()=>void u(e),children:Ge()}):null]})}return(0,q.jsxs)(`div`,{className:`oc-chart-mine__logo`,children:[(0,q.jsx)(`span`,{className:`oc-chart-mine__groups-label`,children:Ke()}),(0,q.jsxs)(`div`,{className:`oc-chart-mine__logo-slots`,children:[(0,q.jsx)(f,{mode:`light`}),(0,q.jsx)(f,{mode:`dark`})]}),r?(0,q.jsx)(`span`,{className:`oc-show__desc`,children:rt()}):null,a?(0,q.jsx)(`p`,{className:`oc-chart-import__error`,children:a}):null]})}function $({chart:e}){let t=x(_.me.getMe,{host:M}),n=y(_.charts.addChartDomain),i=y(_.charts.removeChartDomain),[a,o]=(0,U.useState)(``),[s,c]=(0,U.useState)(null),[l,u]=(0,U.useState)(!1);if(t?.role!==`admin`)return null;let d=e.domains??[];async function f(){let t=a.trim();if(t!==``){c(null),u(!0);try{await n({chartKey:e.key,domain:t}),o(``)}catch(e){c(e instanceof Error?e.message:String(e))}finally{u(!1)}}}async function p(t){c(null);try{await i({chartKey:e.key,domain:t})}catch{}}return(0,q.jsxs)(`div`,{className:`oc-chart-mine__domains`,children:[(0,q.jsx)(`span`,{className:`oc-chart-mine__groups-label`,children:at()}),(0,q.jsxs)(`div`,{className:`oc-chart-mine__domains-body`,children:[(0,q.jsx)(`div`,{className:`oc-chart-avail__groups`,children:d.length===0?(0,q.jsx)(`span`,{className:`oc-show__desc`,children:De()}):d.map(e=>(0,q.jsxs)(P,{variant:`secondary`,className:`oc-chart-avail__chip`,children:[e,(0,q.jsx)(`button`,{type:`button`,className:`oc-chart-avail__chip-x`,"aria-label":we({domain:e}),onClick:()=>void p(e),children:(0,q.jsx)(T,{className:`size-3`})})]},e))}),(0,q.jsxs)(`div`,{className:`oc-show__row`,children:[(0,q.jsx)(F,{value:a,onChange:e=>o(e.target.value),placeholder:r(),className:`oc-chart-mine__domains-input`,onKeyDown:e=>{e.key===`Enter`&&f()}}),(0,q.jsx)(E,{variant:`outline`,size:`sm`,disabled:l,onClick:()=>void f(),children:de()})]}),(0,q.jsx)(`span`,{className:`oc-show__desc`,children:Le()}),s?(0,q.jsx)(`p`,{className:`oc-chart-import__error`,children:s}):null]})]})}function Xt({chart:e}){let t=y(_.charts.updateChart),n=y(_.charts.deleteChart),[r,i]=(0,U.useState)(!1),[a,o]=(0,U.useState)(e.name),[s,c]=(0,U.useState)(()=>JSON.stringify(e.tokens,null,2)),[l,u]=(0,U.useState)(null),[d,f]=(0,U.useState)(!1);function m(){o(e.name),c(JSON.stringify(e.tokens,null,2)),u(null),i(!0)}async function h(){if(e.chartId===void 0)return;u(null);let n;try{n=JSON.parse(s)}catch{u(v());return}f(!0);try{await t({chartId:e.chartId,name:a.trim(),tokens:n}),i(!1)}catch(e){u(e instanceof Error?e.message:String(e))}finally{f(!1)}}async function g(){if(e.chartId!==void 0&&window.confirm(p()))try{await n({chartId:e.chartId})}catch{}}return(0,q.jsxs)(`div`,{className:`oc-chart-mine__row`,children:[(0,q.jsxs)(`div`,{className:`oc-chart-mine__head`,children:[(0,q.jsx)(`span`,{className:`oc-chart-mine__name`,children:e.name}),(0,q.jsx)(`div`,{className:`oc-show__row`,children:r?null:(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(E,{variant:`outline`,size:`sm`,onClick:m,children:ze()}),(0,q.jsx)(E,{variant:`ghost`,size:`sm`,onClick:()=>void g(),children:Be()})]})})]}),r?(0,q.jsxs)(`div`,{className:`oc-chart-mine__editor`,children:[(0,q.jsxs)(`label`,{className:`oc-chart-import__field`,children:[(0,q.jsx)(`span`,{className:`oc-chart-import__label`,children:$e()}),(0,q.jsx)(F,{value:a,onChange:e=>o(e.target.value),maxLength:60})]}),(0,q.jsxs)(`label`,{className:`oc-chart-import__field`,children:[(0,q.jsx)(`span`,{className:`oc-chart-import__label`,children:re()}),(0,q.jsx)(`textarea`,{className:`oc-chart-import__textarea`,value:s,onChange:e=>c(e.target.value),rows:10,spellCheck:!1})]}),l?(0,q.jsx)(`p`,{className:`oc-chart-import__error`,children:l}):null,(0,q.jsxs)(`div`,{className:`oc-show__row`,children:[(0,q.jsx)(E,{size:`sm`,disabled:d,onClick:()=>void h(),children:Ee()}),(0,q.jsx)(E,{variant:`ghost`,size:`sm`,onClick:()=>i(!1),children:te()})]})]}):null,(0,q.jsx)(Yt,{chart:e}),(0,q.jsx)($,{chart:e})]})}function Zt(){let e=x(_.charts.listMyCharts),t=(e??[]).filter(e=>e.via===`owner`);return(0,q.jsxs)(`section`,{className:`oc-show__section`,children:[(0,q.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,q.jsx)(`h2`,{className:`oc-show__title`,children:ut()}),(0,q.jsx)(`p`,{className:`oc-show__desc`,children:st()})]}),e!==void 0&&t.length===0?(0,q.jsx)(`p`,{className:`oc-show__desc`,children:ke()}):(0,q.jsx)(`div`,{className:`oc-chart-mine-list`,children:t.map(e=>(0,q.jsx)(Xt,{chart:e},e.key))})]})}function Qt({chart:e,groups:t}){let n=y(_.charts.addChartToGroupPool),r=y(_.charts.removeChartFromGroupPool),i=e.restrictedToGroups,a=e.poolGroups,o=new Set((a??[]).map(e=>e.groupId)),s=t.filter(e=>!o.has(e._id));async function c(t){try{await n({groupId:t,chartKey:e.key})}catch{}}async function l(t){try{await r({groupId:t,chartKey:e.key})}catch{}}return(0,q.jsxs)(`div`,{className:`oc-chart-avail`,children:[(0,q.jsxs)(`div`,{className:`oc-chart-avail__head`,children:[(0,q.jsx)(`span`,{className:`oc-chart-avail__name`,children:e.name}),(0,q.jsx)(P,{variant:i?`secondary`:`outline`,className:`oc-chart-avail__state`,children:i?ee():e.kind===`custom`&&e.scope===`personal`?b():oe()}),e.isGlobalDefault?(0,q.jsx)(P,{variant:`default`,children:d()}):null]}),(0,q.jsxs)(`div`,{className:`oc-chart-avail__groups`,children:[(0,q.jsx)(`span`,{className:`oc-chart-mine__groups-label`,children:ce()}),(a??[]).map(e=>(0,q.jsxs)(P,{variant:`secondary`,className:`oc-chart-avail__chip`,children:[e.name,(0,q.jsx)(`button`,{type:`button`,className:`oc-chart-avail__chip-x`,"aria-label":Ue({group:e.name}),onClick:()=>void l(e.groupId),children:(0,q.jsx)(T,{className:`size-3`})})]},e.groupId)),s.length>0?(0,q.jsxs)(R,{value:``,onValueChange:e=>void c(e),children:[(0,q.jsx)(A,{size:`sm`,className:`w-56`,children:(0,q.jsx)(O,{placeholder:se()})}),(0,q.jsx)(N,{children:s.map(e=>(0,q.jsx)(L,{value:e._id,children:e.name},e._id))})]}):t.length===0?(0,q.jsx)(`span`,{className:`oc-show__desc`,children:ue()}):null]})]})}function $t({chart:e}){let t=y(_.charts.promoteChartToCommon),n=y(_.charts.deleteChart);async function r(){if(e.chartId!==void 0)try{await t({chartId:e.chartId})}catch{}}async function i(){if(e.chartId!==void 0&&window.confirm(p()))try{await n({chartId:e.chartId})}catch{}}return(0,q.jsxs)(`div`,{className:`oc-chart-avail`,children:[(0,q.jsxs)(`div`,{className:`oc-chart-avail__head`,children:[(0,q.jsx)(`span`,{className:`oc-chart-avail__name`,children:e.name}),(0,q.jsx)(P,{variant:e.scope===`common`?`outline`:`secondary`,children:e.scope===`common`?o():b()}),e.ownerLabel?(0,q.jsx)(`span`,{className:`oc-show__desc`,children:h({owner:e.ownerLabel})}):null]}),(0,q.jsxs)(`div`,{className:`oc-show__row`,children:[e.scope===`personal`?(0,q.jsx)(E,{variant:`outline`,size:`sm`,onClick:()=>void r(),children:dt()}):null,(0,q.jsx)(E,{variant:`ghost`,size:`sm`,onClick:()=>void i(),children:me()})]})]})}function en({defaultThemeMode:e,defaultLocale:t,defaultChartKey:n}){let r=y(_.admin.setDefaultThemeMode),a=y(_.admin.setDefaultLocale),o=y(_.charts.setDefaultChart),c=x(_.charts.listChartsAdmin),l=x(_.groups.listGroups,{}),u=e??`system`,d=t??`fr`;return(0,q.jsxs)(`div`,{className:`oc-appearance-admin`,children:[(0,q.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,q.jsx)(`h2`,{className:`oc-show__title`,children:i()}),(0,q.jsx)(`p`,{className:`oc-show__desc`,children:fe()})]}),(0,q.jsxs)(`section`,{className:`oc-show__section`,children:[(0,q.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,q.jsx)(`h3`,{className:`oc-show__title`,children:ve()}),(0,q.jsx)(`p`,{className:`oc-show__desc`,children:g()})]}),(0,q.jsxs)(`div`,{className:`oc-show__row`,children:[(0,q.jsx)(E,{variant:n===null?`default`:`outline`,size:`sm`,onClick:()=>void o({name:null}),children:S()}),_t.map(e=>(0,q.jsx)(E,{variant:n===e.key?`default`:`outline`,size:`sm`,onClick:()=>void o({name:e.key}),children:e.name},e.key)),(c??[]).filter(e=>e.kind===`custom`&&e.scope===`common`).map(e=>(0,q.jsx)(E,{variant:n===e.key?`default`:`outline`,size:`sm`,onClick:()=>void o({name:e.key}),children:e.name},e.key))]})]}),(0,q.jsxs)(`section`,{className:`oc-show__section`,children:[(0,q.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,q.jsx)(`h3`,{className:`oc-show__title`,children:be()}),(0,q.jsx)(`p`,{className:`oc-show__desc`,children:s()})]}),(0,q.jsx)(`div`,{className:`oc-chart-avail-list`,children:(c??[]).filter(e=>!(e.kind===`custom`&&e.scope===`common`)).map(e=>(0,q.jsx)(Qt,{chart:e,groups:l??[]},e.key))})]}),(0,q.jsxs)(`section`,{className:`oc-show__section`,children:[(0,q.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,q.jsx)(`h3`,{className:`oc-show__title`,children:ft()}),(0,q.jsx)(`p`,{className:`oc-show__desc`,children:he()})]}),(0,q.jsx)(`div`,{className:`oc-chart-avail-list`,children:(c??[]).filter(e=>e.kind===`builtin`||e.scope===`common`).map(e=>(0,q.jsxs)(`div`,{className:`oc-chart-avail`,children:[(0,q.jsx)(`div`,{className:`oc-chart-avail__head`,children:(0,q.jsx)(`span`,{className:`oc-chart-avail__name`,children:e.name})}),(0,q.jsx)($,{chart:e})]},e.key))})]}),(0,q.jsxs)(`section`,{className:`oc-show__section`,children:[(0,q.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,q.jsx)(`h3`,{className:`oc-show__title`,children:Se()}),(0,q.jsx)(`p`,{className:`oc-show__desc`,children:_e()})]}),(()=>{let e=(c??[]).filter(e=>e.kind===`custom`);return e.length===0?(0,q.jsx)(`p`,{className:`oc-show__desc`,children:ae()}):(0,q.jsx)(`div`,{className:`oc-chart-avail-list`,children:e.map(e=>(0,q.jsx)($t,{chart:e},e.key))})})()]}),(0,q.jsxs)(`section`,{className:`oc-show__section`,children:[(0,q.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,q.jsx)(`h3`,{className:`oc-show__title`,children:Ae()}),(0,q.jsx)(`p`,{className:`oc-show__desc`,children:Ve()})]}),(0,q.jsx)(`div`,{className:`oc-show__row`,children:[`light`,`dark`,`system`].map(e=>(0,q.jsx)(E,{variant:u===e?`default`:`outline`,size:`sm`,onClick:()=>void r({mode:e}),children:Wt(e)},e))})]}),(0,q.jsxs)(`section`,{className:`oc-show__section`,children:[(0,q.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,q.jsx)(`h3`,{className:`oc-show__title`,children:tt()}),(0,q.jsx)(`p`,{className:`oc-show__desc`,children:Je()})]}),(0,q.jsx)(`div`,{className:`oc-show__row`,children:[`fr`,`en`].map(e=>(0,q.jsx)(E,{variant:d===e?`default`:`outline`,size:`sm`,onClick:()=>void a({locale:e}),children:e===`fr`?f():xe()},e))}),(0,q.jsx)(`p`,{className:`oc-show__desc`,children:it()})]})]})}function tn(){let e=x(_.me.getMe,{host:M}),t=yt(e?.resolvedThemeMode);return(0,q.jsxs)(`div`,{className:`oc-appearance`,children:[(0,q.jsx)(qt,{selectedKey:e?.chartKey??null,resolvedMode:t}),(0,q.jsx)(Jt,{}),(0,q.jsx)(Zt,{}),e?.role===`admin`?(0,q.jsx)(en,{defaultThemeMode:e.defaultThemeMode,defaultLocale:e.defaultLocale,defaultChartKey:e.defaultChartKey}):null]})}function nn(){let[e,t]=(0,U.useState)(!0),[n,r]=(0,U.useState)(`per-user`),[i,a]=(0,U.useState)(``),[o,s]=(0,U.useState)(J),[c,l]=(0,U.useState)(J),[u,d]=(0,U.useState)(Y),f=i!==``||o!==J||c!==J;function p(){a(``),s(J),l(J),d(Y)}return(0,q.jsxs)(`div`,{className:`oc-show`,children:[(0,q.jsx)(tn,{}),(0,q.jsxs)(`details`,{className:`oc-show__ref`,children:[(0,q.jsx)(`summary`,{className:`oc-show__title`,children:Ie()}),(0,q.jsxs)(Z,{title:`Buttons`,description:`Variants`,children:[(0,q.jsxs)(`div`,{className:`oc-show__row`,children:[(0,q.jsx)(E,{children:`Default`}),(0,q.jsx)(E,{variant:`secondary`,children:`Secondary`}),(0,q.jsx)(E,{variant:`outline`,children:`Outline`}),(0,q.jsx)(E,{variant:`ghost`,children:`Ghost`}),(0,q.jsx)(E,{variant:`destructive`,children:`Destructive`}),(0,q.jsx)(E,{variant:`link`,children:`Link`})]}),(0,q.jsxs)(`div`,{className:`oc-show__row`,children:[(0,q.jsx)(E,{size:`sm`,children:`Small`}),(0,q.jsx)(E,{children:`Default`}),(0,q.jsx)(E,{size:`lg`,children:`Large`}),(0,q.jsx)(E,{size:`icon`,"aria-label":`more`,children:(0,q.jsx)(j,{})}),(0,q.jsx)(E,{disabled:!0,children:`Disabled`})]})]}),(0,q.jsx)(Z,{title:`Badges`,children:(0,q.jsxs)(`div`,{className:`oc-show__row`,children:[(0,q.jsx)(P,{children:`Default`}),(0,q.jsx)(P,{variant:`secondary`,children:`Secondary`}),(0,q.jsx)(P,{variant:`outline`,children:`Outline`}),(0,q.jsx)(P,{variant:`destructive`,children:`Destructive`})]})}),(0,q.jsx)(Z,{title:`Inputs & selection`,children:(0,q.jsxs)(`div`,{className:`oc-show__row oc-show__row--col`,children:[(0,q.jsx)(F,{placeholder:`Text input…`}),(0,q.jsxs)(`div`,{className:`oc-show__row`,children:[(0,q.jsxs)(R,{value:n,onValueChange:r,children:[(0,q.jsx)(A,{className:`w-56`,children:(0,q.jsx)(O,{placeholder:`Select…`})}),(0,q.jsxs)(N,{children:[(0,q.jsx)(L,{value:`per-user`,children:`per-user (chacun son agent)`}),(0,q.jsx)(L,{value:`shared`,children:`shared (agent commun)`})]})]}),(0,q.jsxs)(`label`,{className:`oc-show__check`,children:[(0,q.jsx)(k,{checked:e,onCheckedChange:e=>t(!!e)}),`Checkbox`]})]})]})}),(0,q.jsx)(Z,{title:`Filtres & plage temporelle`,description:`Barre réutilisable (recherche debouncée + selects rapides à largeur auto + plage façon Grafana) et constructeur de filtre avancé. Câblée dans Users, Groups, Comptes de service, Traces, Anomalies, Audit et KPI.`,children:(0,q.jsxs)(`div`,{className:`oc-show__row oc-show__row--col`,children:[(0,q.jsxs)(kt,{q:i,onQChange:a,searchPlaceholder:`Rechercher (kind, principal, rôle, route…)`,timeRange:u,onTimeRangeChange:d,onReset:p,canReset:f,children:[(0,q.jsxs)(R,{value:o,onValueChange:s,children:[(0,q.jsx)(A,{size:`sm`,children:(0,q.jsx)(O,{})}),(0,q.jsxs)(N,{children:[(0,q.jsx)(L,{value:J,children:`Toutes directions`}),(0,q.jsx)(L,{value:`inbound`,children:`inbound`}),(0,q.jsx)(L,{value:`outbound`,children:`outbound`}),(0,q.jsx)(L,{value:`internal`,children:`internal`})]})]}),(0,q.jsxs)(R,{value:c,onValueChange:l,children:[(0,q.jsx)(A,{size:`sm`,children:(0,q.jsx)(O,{})}),(0,q.jsxs)(N,{children:[(0,q.jsx)(L,{value:J,children:`Toutes sévérités`}),(0,q.jsx)(L,{value:`info`,children:`info`}),(0,q.jsx)(L,{value:`warn`,children:`warn`}),(0,q.jsx)(L,{value:`critical`,children:`critical`})]})]})]}),(0,q.jsx)(At,{fields:X,onChange:()=>{}}),(0,q.jsxs)(`div`,{className:`oc-show__row`,children:[(0,q.jsx)(`span`,{className:`oc-show__desc`,children:`Sélecteur de plage seul :`}),(0,q.jsx)(pt,{value:u,onChange:d})]})]})}),(0,q.jsx)(Z,{title:`Dropdown menu`,description:`Row actions / kebab`,children:(0,q.jsxs)(ht,{children:[(0,q.jsx)(vt,{asChild:!0,children:(0,q.jsx)(E,{variant:`outline`,size:`icon`,"aria-label":`Open menu`,children:(0,q.jsx)(j,{})})}),(0,q.jsxs)(mt,{align:`start`,children:[(0,q.jsx)(gt,{children:`Actions`}),(0,q.jsx)(I,{}),(0,q.jsx)(D,{children:`Edit`}),(0,q.jsx)(D,{children:`Duplicate`}),(0,q.jsx)(I,{}),(0,q.jsx)(D,{variant:`destructive`,children:`Delete`})]})]})}),(0,q.jsx)(Z,{title:`Card`,children:(0,q.jsxs)(Tt,{className:`w-80`,children:[(0,q.jsxs)(bt,{children:[(0,q.jsx)(Ct,{children:`Instance`}),(0,q.jsx)(wt,{children:`Non-secret metadata only.`})]}),(0,q.jsx)(St,{className:`text-sm text-muted-foreground`,children:`ws://gateway.example.org:18789`}),(0,q.jsxs)(xt,{className:`gap-2`,children:[(0,q.jsx)(E,{size:`sm`,children:`Save`}),(0,q.jsx)(E,{size:`sm`,variant:`ghost`,children:`Cancel`})]})]})}),(0,q.jsx)(Z,{title:`Table`,children:(0,q.jsxs)(Ot,{children:[(0,q.jsx)(Et,{children:(0,q.jsxs)(B,{children:[(0,q.jsx)(z,{className:`w-8`,children:(0,q.jsx)(k,{"aria-label":`select all`})}),(0,q.jsx)(z,{children:`Name`}),(0,q.jsx)(z,{children:`Mode`}),(0,q.jsx)(z,{className:`text-right`,children:`Status`}),(0,q.jsx)(z,{className:`w-8`})]})}),(0,q.jsx)(Dt,{children:[{n:`admins`,m:`per-user`,s:`active`},{n:`family`,m:`shared`,s:`active`}].map(e=>(0,q.jsxs)(B,{children:[(0,q.jsx)(V,{children:(0,q.jsx)(k,{"aria-label":`select ${e.n}`})}),(0,q.jsx)(V,{className:`font-medium`,children:e.n}),(0,q.jsx)(V,{children:(0,q.jsx)(P,{variant:`secondary`,children:e.m})}),(0,q.jsx)(V,{className:`text-right`,children:(0,q.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-muted-foreground`,children:[(0,q.jsx)(w,{className:`size-3.5`}),` `,e.s]})}),(0,q.jsx)(V,{children:(0,q.jsx)(E,{variant:`ghost`,size:`icon`,"aria-label":`row actions`,children:(0,q.jsx)(j,{})})})]},e.n))})]})}),(0,q.jsx)(Z,{title:`App fragments`,description:`Chat-specific components`,children:(0,q.jsxs)(`div`,{className:`oc-show__row oc-show__row--col`,children:[(0,q.jsx)(`div`,{className:`oc-msg oc-msg--assistant`,children:(0,q.jsx)(`div`,{className:`oc-msg__body`,children:`Assistant message bubble.`})}),(0,q.jsx)(`div`,{className:`oc-tool oc-tool--completed`,children:(0,q.jsxs)(`div`,{className:`oc-tool__header`,children:[(0,q.jsx)(`span`,{className:`oc-tool__icon`,children:`✓`}),(0,q.jsx)(`span`,{className:`oc-tool__name`,children:`write-file`}),(0,q.jsx)(`span`,{className:`oc-tool__phase`,children:`completed`})]})}),(0,q.jsxs)(`div`,{className:`oc-run-status oc-run-status--streaming`,children:[(0,q.jsx)(`span`,{className:`oc-run-status__dot`}),(0,q.jsx)(`span`,{className:`oc-run-status__label`,children:`Running`})]})]})})]})]})}export{nn as ThemeShowroom};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$o as r,Go as i,Jo as a,Ko as o,Qo as s,
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$o as r,Go as i,Jo as a,Ko as o,Qo as s,RC as c,Xo as l,Yo as u,Zo as d,es as f,ns as p,qo as m,ts as h}from"./dist-BhemspoL.js";import{t as g}from"./button-x4eiKyNo.js";import{_t as _,ct as v,lt as y,ot as b,q as x,st as S}from"./index-BlZ8oKFa.js";var C=c(`clock`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 6v6l4 2`,key:`mmk7yg`}]]),w=t(e(),1),T={s:1e3,m:6e4,h:36e5,d:864e5,w:6048e5};function E(e,t){let n=e.trim();if(n===`now`)return t;let r=/^now-(\d+)([smhdw])$/.exec(n);if(r===null)return null;let i=Number(r[1]),a=T[r[2]];return!Number.isFinite(i)||a===void 0?null:t-i*a}function D(e,t=Date.now()){return e.kind===`absolute`?{from:e.from,to:e.to}:{from:E(e.from,t)??t-T.h,to:E(e.to,t)??t}}var O=[{label:p(),from:`now-5m`},{label:h(),from:`now-15m`},{label:f(),from:`now-30m`},{label:r(),from:`now-1h`},{label:s(),from:`now-3h`},{label:d(),from:`now-6h`},{label:l(),from:`now-12h`},{label:u(),from:`now-24h`},{label:a(),from:`now-2d`},{label:m(),from:`now-7d`},{label:o(),from:`now-30d`},{label:i(),from:`now-90d`}];function k(e){return new Date(e).toLocaleString(`fr-FR`,{day:`2-digit`,month:`2-digit`,hour:`2-digit`,minute:`2-digit`})}function A(e){if(e.kind===`relative`){let t=O.find(t=>t.from===e.from&&e.to===`now`);return t?t.label:`${e.from} → ${e.to}`}return`${k(e.from)} → ${k(e.to)}`}function j(e){let t=new Date(e),n=e=>String(e).padStart(2,`0`);return`${t.getFullYear()}-${n(t.getMonth()+1)}-${n(t.getDate())}T${n(t.getHours())}:${n(t.getMinutes())}`}function M(e){if(e===``)return null;let t=new Date(e).getTime();return Number.isNaN(t)?null:t}function N(e){let t=e.trim();return t===`true`?!0:t===`false`?!1:t!==``&&Number.isFinite(Number(t))?Number(t):e}var P=n();function F(e){let[t,n]=(0,w.useState)(0);return(0,w.useEffect)(()=>{if(e.kind!==`relative`)return;let t=window.setInterval(()=>n(e=>e+1),3e4);return()=>window.clearInterval(t)},[e.kind]),(0,w.useMemo)(()=>{let{from:t,to:n}=D(e);return e.kind===`absolute`?{from:t,to:n}:{from:I(t),to:I(n)}},[e,t])}function I(e){return Math.floor(e/6e4)*6e4}function L({value:e,onChange:t}){let[n,r]=(0,w.useState)(!1),[i,a]=(0,w.useState)(``),o=D(e),[s,c]=(0,w.useState)(()=>j(o.from)),[l,u]=(0,w.useState)(()=>j(o.to));function d(t){if(t){let t=D(e);c(j(t.from)),u(j(t.to)),a(``)}r(t)}function f(e){t({kind:`relative`,from:e,to:`now`}),r(!1)}function p(){let e=M(s),n=M(l);e===null||n===null||(t({kind:`absolute`,from:e,to:n}),r(!1))}let m=(0,w.useMemo)(()=>{let e=i.trim().toLowerCase();return e===``?O:O.filter(t=>t.label.toLowerCase().includes(e)||t.from.toLowerCase().includes(e))},[i]),h=M(s)!==null&&M(l)!==null;return(0,P.jsxs)(v,{open:n,onOpenChange:d,children:[(0,P.jsx)(y,{asChild:!0,children:(0,P.jsxs)(g,{variant:`outline`,size:`sm`,className:`oc-timerange__trigger`,children:[(0,P.jsx)(C,{}),A(e)]})}),(0,P.jsx)(S,{children:(0,P.jsx)(b,{align:`end`,sideOffset:6,className:`oc-timerange__panel z-50 rounded-lg border border-border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95`,children:(0,P.jsxs)(`div`,{className:`oc-timerange__cols`,children:[(0,P.jsxs)(`div`,{className:`oc-timerange__absolute`,children:[(0,P.jsx)(`div`,{className:`oc-timerange__section-title`,children:`Plage absolue`}),(0,P.jsxs)(`label`,{className:`oc-field`,children:[(0,P.jsx)(`span`,{className:`oc-field__label`,children:`De`}),(0,P.jsx)(x,{type:`datetime-local`,value:s,onChange:e=>c(e.target.value)})]}),(0,P.jsxs)(`label`,{className:`oc-field`,children:[(0,P.jsx)(`span`,{className:`oc-field__label`,children:`À`}),(0,P.jsx)(x,{type:`datetime-local`,value:l,onChange:e=>u(e.target.value)})]}),(0,P.jsx)(g,{size:`sm`,className:`oc-timerange__apply`,disabled:!h,onClick:p,children:`Appliquer`})]}),(0,P.jsxs)(`div`,{className:`oc-timerange__relative`,children:[(0,P.jsxs)(`div`,{className:`oc-timerange__search`,children:[(0,P.jsx)(_,{className:`oc-timerange__search-icon`,"aria-hidden":!0}),(0,P.jsx)(x,{value:i,onChange:e=>a(e.target.value),placeholder:`Rechercher une plage`,"aria-label":`Rechercher une plage relative`})]}),(0,P.jsx)(`ul`,{className:`oc-timerange__list`,children:m.length===0?(0,P.jsx)(`li`,{className:`oc-timerange__empty`,children:`Aucune plage.`}):m.map(t=>(0,P.jsx)(`li`,{children:(0,P.jsx)(`button`,{type:`button`,className:`oc-timerange__option`+(e.kind===`relative`&&e.from===t.from&&e.to===`now`?` is-active`:``),onClick:()=>f(t.from),children:t.label})},t.from))})]})]})})})]})}export{F as n,N as r,L as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Al as r,Bl as ee,Cl as te,Dl as i,El as a,Fl as o,Gl as s,Hl as c,Il as l,Jl as u,Kl as d,LC as f,Ll as ne,Ml as re,Nl as ie,Ol as ae,Pl as oe,Rl as se,Sl as ce,Tl as le,Ul as ue,Vl as de,WC as p,Wl as fe,Xl as pe,Yl as me,_l as he,bl as ge,fl as m,gl as h,hl as g,jl as _,kl as v,ml as y,pl as b,ql as x,vl as S,wl as C,xl as w,yl as T,zl as E}from"./dist-BhemspoL.js";import{n as D}from"./TimeRangePicker--wX3a-5x.js";import{t as O}from"./x-C9JKw9Pc.js";import{t as k}from"./button-x4eiKyNo.js";import{C as A,Dt as j,F as M,L as N,N as P,Ot as F,P as I,R as L,S as R,a as _e,b as z,i as ve,m as B,o as ye,r as be,x as V,y as H}from"./index-BlZ8oKFa.js";import{t as xe}from"./FilterBar-DB-b7WAm.js";import{t as Se}from"./AdvancedFilter-EPxqO-eA.js";import{t as Ce}from"./DataTableShell-BpD7pA0i.js";var U=t(e(),1),W=n(),we=[50,100,200,500],G=`all`,K=`__all__`,Te=[`2xx`,`4xx`,`5xx`],Ee=[`user`,`service`,`system`],De=[`inbound`,`outbound`,`internal`],Oe={kind:`relative`,from:`now-30d`,to:`now`},ke=[{value:`kind`,label:`kind`},{value:`status`,label:`status`},{value:`latencyMs`,label:`latence (ms)`},{value:`principalType`,label:`principal`},{value:`direction`,label:`direction`},{value:`roleKey`,label:`rôle`},{value:`route`,label:`route`},{value:`correlationId`,label:`correlationId`}];function q(){let e=F({from:`/settings/traces`}),t=j({from:`/settings/traces`}),n=e.limit,m=e.kind,y=e.statusClass??K,b=e.principalType??K,M=e.direction??K,N=e.roleKey??K,P=e.q??``,I=be(e.from,e.to),L=(0,U.useMemo)(()=>ye(e.adv),[e.adv]),{from:q,to:Me}=D(I),[X,Z]=(0,U.useState)(null),[Ne,Q]=(0,U.useState)(null),Pe=e=>void t({search:t=>({...t,limit:e})}),Fe=e=>void t({search:t=>({...t,kind:e})}),Ie=e=>void t({search:t=>({...t,q:e||void 0}),replace:!0}),Le=e=>void t({search:t=>({...t,statusClass:e===K?void 0:e})}),Re=e=>void t({search:t=>({...t,principalType:e===K?void 0:e})}),ze=e=>void t({search:t=>({...t,direction:e===K?void 0:e})}),Be=e=>void t({search:t=>({...t,roleKey:e===K?void 0:e})}),Ve=e=>void t({search:t=>({...t,..._e(e)})}),He=e=>void t({search:t=>({...t,adv:ve(e)}),replace:!0}),$=p(f.observability.listEvents,{limit:n}),Ue=p(f.observability.listEvents,{limit:n,kind:m===G?void 0:m,filter:{q:P||void 0,from:q,to:Me,statusClass:y===K?void 0:y,principalType:b===K?void 0:b,direction:M===K?void 0:M,roleKey:N===K?void 0:N,advanced:L.length>0?L:void 0}}),We=(0,U.useMemo)(()=>{let e=new Set;for(let t of $??[])e.add(t.kind);return[...e].sort()},[$]),Ge=(0,U.useMemo)(()=>{let e=new Set;for(let t of $??[])t.roleKey&&e.add(t.roleKey);return[...e].sort()},[$]),Ke=P!==``||y!==K||b!==K||M!==K||N!==K||L.length>0||I.kind!==`relative`||I.from!==Oe.from;function qe(){t({search:{limit:100,kind:`all`},replace:!0})}let Je=X?$?.filter(e=>e.correlationId===X):Ue;return(0,W.jsxs)(W.Fragment,{children:[(0,W.jsxs)(`p`,{className:`oc-admin__hint`,children:[pe(),(0,W.jsx)(`strong`,{children:me()}),u(),` `,(0,W.jsx)(`span`,{className:`oc-filter__window`,children:x()})]}),(0,W.jsxs)(xe,{q:P,onQChange:Ie,searchPlaceholder:d(),timeRange:I,onTimeRangeChange:Ve,onReset:qe,canReset:Ke,children:[(0,W.jsxs)(H,{value:y,onValueChange:Le,children:[(0,W.jsx)(R,{size:`sm`,className:`w-32`,children:(0,W.jsx)(A,{placeholder:s()})}),(0,W.jsxs)(z,{children:[(0,W.jsx)(V,{value:K,children:fe()}),Te.map(e=>(0,W.jsx)(V,{value:e,children:e},e))]})]}),(0,W.jsxs)(H,{value:b,onValueChange:Re,children:[(0,W.jsx)(R,{size:`sm`,className:`w-32`,children:(0,W.jsx)(A,{placeholder:ue()})}),(0,W.jsxs)(z,{children:[(0,W.jsx)(V,{value:K,children:c()}),Ee.map(e=>(0,W.jsx)(V,{value:e,children:e},e))]})]}),(0,W.jsxs)(H,{value:M,onValueChange:ze,children:[(0,W.jsx)(R,{size:`sm`,className:`w-32`,children:(0,W.jsx)(A,{placeholder:de()})}),(0,W.jsxs)(z,{children:[(0,W.jsx)(V,{value:K,children:ee()}),De.map(e=>(0,W.jsx)(V,{value:e,children:e},e))]})]}),(0,W.jsxs)(H,{value:N,onValueChange:Be,children:[(0,W.jsx)(R,{size:`sm`,className:`w-36`,children:(0,W.jsx)(A,{placeholder:E()})}),(0,W.jsxs)(z,{children:[(0,W.jsx)(V,{value:K,children:se()}),Ge.map(e=>(0,W.jsx)(V,{value:e,children:e},e))]})]}),(0,W.jsxs)(H,{value:m,onValueChange:Fe,children:[(0,W.jsx)(R,{size:`sm`,className:`w-44`,children:(0,W.jsx)(A,{placeholder:ne()})}),(0,W.jsxs)(z,{children:[(0,W.jsx)(V,{value:G,children:l()}),We.map(e=>(0,W.jsx)(V,{value:e,children:e},e))]})]}),(0,W.jsxs)(H,{value:String(n),onValueChange:e=>Pe(Number(e)),children:[(0,W.jsx)(R,{size:`sm`,className:`w-28`,children:(0,W.jsx)(A,{})}),(0,W.jsx)(z,{children:we.map(e=>(0,W.jsx)(V,{value:String(e),children:o({count:e})},e))})]})]}),(0,W.jsx)(Se,{fields:ke,seed:L,onChange:He}),X?(0,W.jsx)(`div`,{className:`oc-traces__followline`,children:(0,W.jsxs)(`button`,{type:`button`,className:`oc-traces__chip`,onClick:()=>Z(null),title:oe(),children:[(0,W.jsxs)(`span`,{className:`oc-traces__chip-label`,children:[ie(),(0,W.jsx)(`code`,{children:J(X)})]}),(0,W.jsx)(O,{className:`oc-traces__chip-x`,"aria-hidden":!0}),(0,W.jsx)(`span`,{className:`sr-only`,children:re()})]})}):null,(0,W.jsx)(Ce,{title:_(),rows:Je,emptyHint:X?r():v(),columns:[{header:ae(),sort:e=>e.at,cell:e=>(0,W.jsx)(`span`,{className:`oc-traces__time`,children:new Date(e.at).toLocaleString(`fr-FR`)})},{header:i(),sort:e=>e.kind,cell:e=>(0,W.jsx)(B,{variant:`secondary`,children:e.kind})},{header:a(),sort:e=>Y(e)??null,cell:e=>{let t=Y(e);return t?(0,W.jsxs)(`span`,{className:`oc-traces__fail`,title:t,children:[`✕ `,t]}):(0,W.jsx)(`span`,{className:`oc-traces__ok`,"aria-label":le(),children:`✓`})}},{header:C(),sort:e=>e.direction,cell:e=>e.direction?(0,W.jsx)(B,{variant:`outline`,children:e.direction}):(0,W.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})},{header:te(),sort:e=>e.principalType,cell:e=>(0,W.jsxs)(`span`,{className:`oc-traces__principal`,children:[(0,W.jsx)(B,{variant:`outline`,children:e.principalType}),e.principalId?(0,W.jsx)(`code`,{className:`oc-traces__mono`,children:J(e.principalId)}):null]})},{header:ce(),sort:e=>e.roleKey,cell:e=>e.roleKey?(0,W.jsx)(B,{variant:`secondary`,children:e.roleKey}):(0,W.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})},{header:w(),sort:e=>e.route,cell:e=>e.route?(0,W.jsxs)(`span`,{className:`oc-traces__route`,children:[e.method?(0,W.jsx)(`span`,{className:`oc-traces__method`,children:e.method}):null,(0,W.jsx)(`code`,{className:`oc-traces__mono`,children:e.route})]}):(0,W.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})},{header:ge(),sort:e=>e.status,cell:e=>e.status===null?(0,W.jsx)(`span`,{className:`oc-traces__muted`,children:`—`}):(0,W.jsx)(`span`,{className:`oc-traces__status ${Ae(e.status)}`,children:e.status})},{header:T(),sort:e=>e.latencyMs,cell:e=>e.latencyMs===null?(0,W.jsx)(`span`,{className:`oc-traces__muted`,children:`—`}):(0,W.jsxs)(`span`,{className:`oc-traces__mono`,children:[e.latencyMs,` ms`]})},{header:S(),sort:e=>e.correlationId,cell:e=>e.correlationId?(0,W.jsx)(`button`,{type:`button`,className:`oc-traces__corr`,title:he(),onClick:()=>Z(e.correlationId),children:J(e.correlationId)}):(0,W.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})},{header:h(),sort:e=>+!!e.meta,cell:e=>e.meta?(0,W.jsx)(k,{variant:`outline`,size:`sm`,onClick:()=>Q(e),children:g()}):(0,W.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})}]}),(0,W.jsx)(je,{row:Ne,onClose:()=>Q(null)})]})}function Ae(e){return e>=500?`oc-traces__status--5xx`:e>=400?`oc-traces__status--4xx`:e>=200&&e<300?`oc-traces__status--2xx`:`oc-traces__status--other`}function J(e){return e.length>8?e.slice(0,8):e}function Y(e){if(typeof e.status==`number`&&e.status>=400)return String(e.status);if(!e.meta)return null;try{let t=JSON.parse(e.meta);if(e.kind===`openclaw.dispatch`&&t.dispatchStatus===`failed`)return t.errorCode??`failed`;if(e.kind===`assistant.stream`&&t.phase===`finalize`&&(t.streamStatus===`error`||t.streamStatus===`aborted`))return t.streamStatus;if(e.kind===`openclaw.ingest.denied`)return`denied`}catch{}return null}function je({row:e,onClose:t}){let n=(0,U.useMemo)(()=>{if(!e?.meta)return``;try{return JSON.stringify(JSON.parse(e.meta),null,2)}catch{return e.meta}},[e]);return(0,W.jsx)(P,{open:e!==null,onOpenChange:e=>{e||t()},children:e?(0,W.jsxs)(I,{className:`max-w-lg`,children:[(0,W.jsxs)(N,{children:[(0,W.jsxs)(L,{className:`oc-traces__meta-title`,children:[y(),` `,(0,W.jsx)(`code`,{children:e.kind}),(0,W.jsx)(B,{variant:`outline`,children:b()})]}),(0,W.jsx)(M,{children:m()})]}),(0,W.jsx)(`pre`,{className:`oc-traces__meta-json`,children:n})]}):null})}export{q as TracesTab};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Ac as r,Am as i,Cm as a,Dc as o,Dm as s,Em as c,Fc as l,Ic as u,LC as d,Lc as f,Mc as p,Nc as m,Oc as h,Om as g,Pc as _,Rc as v,Rp as y,Sm as b,Tm as x,UC as S,WC as C,_m as ee,am as te,bm as ne,cm as re,dm as ie,fm as ae,gm as oe,hm as w,im as T,jc as E,jm as D,kc as O,km as k,lm as A,mm as se,om as ce,pm as le,rm as ue,sm as de,um as fe,vm as pe,wm as me,xm as he,ym as ge,zc as j}from"./dist-BhemspoL.js";import{t as M}from"./button-x4eiKyNo.js";import{$ as N,A as P,C as F,Dt as I,F as L,L as R,M as _e,N as z,O as B,Ot as ve,P as ye,Q as be,R as xe,S as V,Z as Se,at as Ce,b as H,d as U,et as we,f as Te,gt as W,ht as G,j as Ee,m as K,nt as De,p as q,x as J,y as Y}from"./index-BlZ8oKFa.js";import{t as X}from"./FilterBar-DB-b7WAm.js";import{t as Oe}from"./DataTableShell-BpD7pA0i.js";import{t as ke}from"./DetailChips-BA1mq7Wm.js";var Z=t(e(),1),Q=n();function Ae({profileId:e,userLabel:t,open:n,onOpenChange:r}){let i=C(d.agents.listAgentPoolForUser,n&&e?{profileId:e}:`skip`),a=C(d.agents.listUserAgents,n&&e?{profileId:e}:`skip`),o=new Set((a??[]).map(e=>`${e.instanceName}/${e.agentId}`)),s=(a??[]).find(e=>e.isDefault)??null,c=s?`${s.instanceName}/${s.agentId}`:null,m=new Set((i?.agents??[]).map(e=>`${e.instanceName}/${e.agentId}`)),h=[...(i?.agents??[]).map(e=>({...e,outOfPool:!1})),...(a??[]).filter(e=>!m.has(`${e.instanceName}/${e.agentId}`)).map(e=>({instanceName:e.instanceName,agentId:e.agentId,displayName:e.displayName,emoji:e.emoji,model:e.model,kind:e.kind,state:e.state,outOfPool:!0}))],g=new Map;for(let e of h){let t=g.get(e.instanceName)??[];t.push(e),g.set(e.instanceName,t)}return(0,Q.jsx)(z,{open:n,onOpenChange:r,children:(0,Q.jsxs)(ye,{className:`oc-access`,children:[(0,Q.jsxs)(R,{children:[(0,Q.jsx)(xe,{children:j({user:t})}),(0,Q.jsx)(L,{children:v()})]}),i?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:i.inGroup?f():u()}):null,(0,Q.jsx)(`div`,{className:`oc-access__list`,children:i===void 0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:l()}):h.length===0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:p()}):[...g.entries()].map(([t,n])=>(0,Q.jsx)(je,{profileId:e,instanceName:t,kind:n[0].kind,agents:n,assigned:o,defaultKey:c},t))})]})})}function je({profileId:e,instanceName:t,kind:n,agents:i,assigned:a,defaultKey:s}){let c=S(d.agents.assignAgent),l=S(d.agents.removeAgent),u=S(d.agents.setDefaultAgent),f=P();if(!e)return null;async function p(n,r){try{r?await l({profileId:e,instanceName:t,agentId:n}):await c({profileId:e,instanceName:t,agentId:n})}catch(e){f.error(_(),e)}}async function g(n){try{await u({profileId:e,instanceName:t,agentId:n})}catch(e){f.error(m(),e)}}return(0,Q.jsxs)(`div`,{className:`oc-access__group`,children:[(0,Q.jsxs)(`div`,{className:`oc-access__instance`,children:[(0,Q.jsx)(W,{size:13,"aria-hidden":!0}),(0,Q.jsx)(`span`,{children:t}),(0,Q.jsx)(K,{variant:`outline`,className:`oc-access__kind`,children:n})]}),i.map(e=>{let n=`${t}/${e.agentId}`,i=a.has(n),c=s===n,l=e.state===`deleted`;return(0,Q.jsxs)(`div`,{className:`oc-access__row`,children:[(0,Q.jsx)(B,{checked:i,disabled:l&&!i,onCheckedChange:()=>void p(e.agentId,i),"aria-label":E({name:e.displayName??e.agentId})}),(0,Q.jsxs)(`span`,{className:`oc-access__label`,children:[e.emoji?`${e.emoji} `:``,e.displayName??e.agentId]}),e.model?(0,Q.jsx)(`span`,{className:`oc-access__model`,children:e.model}):null,l?(0,Q.jsx)(K,{variant:`outline`,className:`oc-access__gone`,children:r()}):null,e.outOfPool?(0,Q.jsx)(K,{variant:`outline`,className:`oc-access__gone`,children:O()}):null,i?c?(0,Q.jsx)(`span`,{className:`oc-access__fav`,role:`img`,"aria-label":h(),title:h(),children:(0,Q.jsx)(G,{size:14,fill:`currentColor`})}):(0,Q.jsx)(M,{type:`button`,size:`icon-sm`,variant:`ghost`,className:`oc-access__setdefault`,"aria-label":o(),title:o(),onClick:()=>void g(e.agentId),children:(0,Q.jsx)(G,{size:14})}):null]},e.agentId)})]})}var $=`__all__`;function Me({granted:e,onToggle:t}){let n=new Set(e),r=U.filter(e=>n.has(q[e])).length;return(0,Q.jsxs)(Se,{children:[(0,Q.jsx)(De,{asChild:!0,children:(0,Q.jsx)(M,{variant:`outline`,size:`sm`,className:`h-8 w-36 justify-start font-normal`,children:r===0?D():i({count:r})})}),(0,Q.jsxs)(be,{align:`start`,className:`w-52`,children:[(0,Q.jsx)(we,{children:k()}),U.map(e=>{let r=q[e];return(0,Q.jsxs)(N,{className:`gap-2`,onSelect:e=>{e.preventDefault(),t(r)},children:[(0,Q.jsx)(B,{checked:n.has(r),"aria-hidden":!0,tabIndex:-1,className:`pointer-events-none`}),(0,Q.jsx)(`span`,{children:Te[e]??e})]},e)})]})]})}function Ne(){let e=ve({from:`/settings/users`}),t=I({from:`/settings/users`}),n=e.q??``,r=e.role??$,i=e=>void t({search:t=>({...t,q:e||void 0}),replace:!0}),o=e=>void t({search:t=>({...t,role:e===$?void 0:e})}),l=C(d.admin.listUsers,{filter:{q:n||void 0,role:r===$?void 0:r},withAgents:!0}),u=C(d.me.getMe,{host:Ce}),f=S(d.admin.setRole),p=S(d.admin.setUserPermissions),m=S(d.admin.startImpersonation),h=S(d.admin.deleteUser),_=S(d.admin.setUserName),v=Ee(),E=_e(),D=P(),[O,k]=(0,Z.useState)(null),j=(0,Z.useMemo)(()=>{let e=new Set([`pending`,`user`,`admin`]);for(let t of l??[])e.add(t.role);return[...e]},[l]),M=n!==``||r!==$;function N(){t({search:{},replace:!0})}async function L(e){try{await f(e)}catch(e){D.error(g(),e)}}async function R(e){try{await p(e)}catch(e){D.error(s(),e)}}async function z(e){let t=e.email||e.name||e.canonical||e.userId.slice(0,8);if(await v({title:ne(),description:ge({user:t}),confirmWord:pe(),confirmLabel:ee(),destructive:!0}))try{await h({profileId:e._id}),D.success(w({user:t}))}catch(e){D.error(oe(),e)}}async function B(e){let t=e.email||e.name||e.userId.slice(0,8),n=await E({title:le(),label:ae({user:t}),placeholder:ie(),defaultValue:e.name??``,confirmLabel:y()});if(n!==null)try{await _({profileId:e._id,name:n}),D.success(fe())}catch(e){D.error(A(),e)}}return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(X,{q:n,onQChange:i,searchPlaceholder:c(),onReset:N,canReset:M,children:(0,Q.jsxs)(Y,{value:r,onValueChange:o,children:[(0,Q.jsx)(V,{size:`sm`,className:`w-36`,children:(0,Q.jsx)(F,{})}),(0,Q.jsxs)(H,{children:[(0,Q.jsx)(J,{value:$,children:x()}),j.map(e=>(0,Q.jsx)(J,{value:e,children:e},e))]})]})}),(0,Q.jsx)(Oe,{title:me(),rows:l,emptyHint:a(),rowActions:e=>{let t=[{label:ue(),onSelect:()=>k({profileId:e._id,label:e.email||e.name||e.canonical||e.userId.slice(0,8)})},{label:se(),onSelect:()=>void B(e)}];return e.userId!==u?.userId&&t.push({label:b(),onSelect:()=>void m({profileId:e._id})},{label:he(),variant:`destructive`,onSelect:()=>void z(e)}),t},columns:[{header:re(),cell:e=>{let t=e.email||e.name||e.canonical||e.userId.slice(0,8),n=e.email&&e.name&&e.name!==e.email?e.name:null;return(0,Q.jsxs)(`div`,{className:`flex flex-col`,children:[(0,Q.jsx)(`span`,{children:t}),n?(0,Q.jsx)(`span`,{className:`text-muted-foreground text-xs`,children:n}):null]})},sort:e=>e.email||e.name||e.canonical||e.userId},{header:de(),sort:e=>e.role===`admin`?2:+(e.role===`user`),cell:e=>(0,Q.jsxs)(Y,{value:e.role,onValueChange:t=>void L({profileId:e._id,role:t}),children:[(0,Q.jsx)(V,{size:`sm`,className:`w-28`,children:(0,Q.jsx)(F,{})}),(0,Q.jsxs)(H,{children:[(0,Q.jsx)(J,{value:`pending`,children:`pending`}),(0,Q.jsx)(J,{value:`user`,children:`user`}),(0,Q.jsx)(J,{value:`admin`,children:`admin`})]})]})},{header:ce(),sort:e=>e.role===`admin`?9999:e.extraPermissions?.length??0,cell:e=>e.role===`admin`?(0,Q.jsx)(`span`,{className:`text-muted-foreground text-xs`,children:te()}):(0,Q.jsx)(Me,{granted:e.extraPermissions??[],onToggle:t=>{let n=new Set(e.extraPermissions??[]);n.has(t)?n.delete(t):n.add(t),R({profileId:e._id,permissions:[...n]})}})},{header:T(),cell:e=>(0,Q.jsx)(ke,{icon:(0,Q.jsx)(W,{size:12,"aria-hidden":!0}),total:e.agentCount??0,items:e.agents.map(e=>({label:e}))}),sort:e=>e.agentCount??0}]}),(0,Q.jsx)(Ae,{profileId:O?.profileId??null,userLabel:O?.label??``,open:O!==null,onOpenChange:e=>{e||k(null)}})]})}export{Ne as UsersTab};
|