@lacneu/atrium 0.13.0 → 0.14.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/AccessTab-De0sJr0t.js +1 -0
- package/dist/assets/{AdvancedFilter-Cjt4cP7-.js → AdvancedFilter-CO_XQQz0.js} +1 -1
- package/dist/assets/AgentFilesTab-BpgoJ9RY.js +3 -0
- package/dist/assets/AnomaliesTab-DMFRiLxu.js +1 -0
- package/dist/assets/AuditTab-BLsAgUqt.js +1 -0
- package/dist/assets/BridgeTab-BWExnIBq.js +1 -0
- package/dist/assets/ChatDefaultsTab-DNy4hn4P.js +1 -0
- package/dist/assets/{DataTableShell-DY8nOACn.js → DataTableShell-B44W_69s.js} +1 -1
- package/dist/assets/{DetailChips-DTltyjOV.js → DetailChips-SZr2PERg.js} +1 -1
- package/dist/assets/FeedbacksTab-B3mTF8gA.js +1 -0
- package/dist/assets/{FieldLabel-BAi9qHY_.js → FieldLabel-Dn9ltnAG.js} +2 -2
- package/dist/assets/FilesTab-DrFmoPZJ.js +1 -0
- package/dist/assets/{FilterBar-B3HyBcMN.js → FilterBar-RytfYInF.js} +1 -1
- package/dist/assets/GroupsTab-NeGxwsGw.js +1 -0
- package/dist/assets/InstancesTab-D-zHqwWo.js +1 -0
- package/dist/assets/IntegrationsTab-BDbA-XQW.js +1 -0
- package/dist/assets/KpiTab-CD6Rk_3X.js +1 -0
- package/dist/assets/PreferencesTab-BAAGt839.js +1 -0
- package/dist/assets/PromptInjectionsTab-Cb-uPfgC.js +2 -0
- package/dist/assets/RolesTab-BY0jkajs.js +1 -0
- package/dist/assets/ServiceAccountsTab-BeNR30lB.js +1 -0
- package/dist/assets/ThemeShowroom-P8XIo-XT.js +1 -0
- package/dist/assets/{TimeRangePicker-B2SK3o8o.js → TimeRangePicker-BP0hPL2e.js} +1 -1
- package/dist/assets/TracesTab-CMVJpkgr.js +1 -0
- package/dist/assets/UsersTab-ZUaqS4l_.js +1 -0
- package/dist/assets/button-nO0gX-NR.js +1 -0
- package/dist/assets/{card-C0DYbnDZ.js → card-BZOj8vDF.js} +1 -1
- package/dist/assets/chevrons-up-down-BbTkkJkE.js +1 -0
- package/dist/assets/{compatView-Zpd8xEb0.js → compatView-xxuYVFiT.js} +1 -1
- package/dist/assets/dispatchErrorInfo-ByWow4dK.js +1 -0
- package/dist/assets/{dist-ONRHFnrv.js → dist-Cci6Ggjl.js} +1 -1
- package/dist/assets/{dist-CEr_Gjjt.js → dist-dF88UcEZ.js} +1 -1
- package/dist/assets/{dist-D9HKhjU9.js → dist-rCLg1WXy.js} +1 -1
- package/dist/assets/{dist-D0lueamf.js → dist-xA--peN1.js} +1 -1
- package/dist/assets/{highlighted-body-OFNGDK62-C4lDTBXi.js → highlighted-body-OFNGDK62-DNgOAHiR.js} +1 -1
- package/dist/assets/index-C6XDcLXH.js +226 -0
- package/dist/assets/{index-DE3I6s1g.css → index-nayepuF0.css} +1 -1
- package/dist/assets/mermaid-GHXKKRXX-DK3RngoE.js +1 -0
- package/dist/assets/roleDescriptions-BmCKM40P.js +1 -0
- package/dist/assets/{table-BrqjFLFP.js → table-CQttJ0e5.js} +1 -1
- package/dist/assets/tabs-D-DUf5Yr.js +1 -0
- package/dist/assets/x-VwKg9NoU.js +1 -0
- package/dist/index.html +8 -8
- package/package.json +1 -1
- package/dist/assets/AccessTab-Bl3z-oaJ.js +0 -1
- package/dist/assets/AgentFilesTab-BvWPXaPy.js +0 -3
- package/dist/assets/AnomaliesTab-Bt3rUt5h.js +0 -1
- package/dist/assets/AuditTab-BUDCT6C_.js +0 -1
- package/dist/assets/BridgeTab-CaRqpzhJ.js +0 -1
- package/dist/assets/ChatDefaultsTab-D2PUOgIG.js +0 -1
- package/dist/assets/FeedbacksTab-CQydUkCH.js +0 -1
- package/dist/assets/FilesTab-DedNE9vp.js +0 -1
- package/dist/assets/GroupsTab-BYuoTQ0m.js +0 -1
- package/dist/assets/InstancesTab-De8L8K_O.js +0 -1
- package/dist/assets/IntegrationsTab-ChkDnL5l.js +0 -1
- package/dist/assets/KpiTab-B60Mw6H3.js +0 -1
- package/dist/assets/PreferencesTab-BJVXFQZy.js +0 -1
- package/dist/assets/PromptInjectionsTab-BSMQl2wO.js +0 -2
- package/dist/assets/RolesTab-CTmqlMh1.js +0 -1
- package/dist/assets/ServiceAccountsTab-CLEU-Si6.js +0 -1
- package/dist/assets/ThemeShowroom-CkbK5_J1.js +0 -1
- package/dist/assets/TracesTab-Bm9mn32S.js +0 -1
- package/dist/assets/UsersTab-Di1rLX5R.js +0 -1
- package/dist/assets/button-B6rrzUWu.js +0 -1
- package/dist/assets/chevrons-up-down-ClxkhYiU.js +0 -1
- package/dist/assets/dispatchErrorInfo-CBRNT965.js +0 -1
- package/dist/assets/index-Ci__4cCS.js +0 -226
- package/dist/assets/mermaid-GHXKKRXX-CLDSlio9.js +0 -1
- package/dist/assets/roleDescriptions-DoeFMOcx.js +0 -1
- package/dist/assets/x-BKk70OzX.js +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Ar as r,Br as i,Fr as a,Gw as o,Hr as s,Ir as c,Lr as l,Mr as u,Nr as d,Or as f,Pr as p,Qw as m,Rr as h,Vr as g,jr as _,kr as v,vw as y,zr as b}from"./dist-Cci6Ggjl.js";import{X as x,_ as S,b as C,v as w,x as T,y as E}from"./index-C6XDcLXH.js";var D=t(e(),1);function O(e){return e===`user`?u():e===`all`?_():r({group:e.group})}function k(e){return e===`common`?v():e===`owner`?f():r({group:e.group})}var A=n();function j(e){return e.name||e.email||e.userId.slice(0,8)}function M(){let e=m(o.admin.listUsers,{}),[t,n]=(0,D.useState)(``),r=m(o.introspect.introspectUser,t?{userId:t}:`skip`);return(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:s()}),(0,A.jsxs)(S,{value:t,onValueChange:n,children:[(0,A.jsx)(C,{size:`sm`,"aria-label":g(),children:(0,A.jsx)(T,{placeholder:g()})}),(0,A.jsx)(w,{children:(e??[]).map(e=>(0,A.jsx)(E,{value:e.userId,children:j(e)},e._id))})]}),t===``?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:i()}):r===void 0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:y()}):(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:b()}),(0,A.jsxs)(`div`,{className:`oc-introspect__id`,children:[(0,A.jsx)(`strong`,{children:r.user.label}),(0,A.jsx)(x,{variant:`secondary`,children:r.role})]})]}),(0,A.jsxs)(`section`,{className:`oc-introspect__section`,children:[(0,A.jsx)(`h3`,{className:`oc-introspect__title`,children:h()}),r.groups.length===0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:p()}):(0,A.jsx)(`div`,{className:`oc-introspect__chips`,children:r.groups.map(e=>(0,A.jsx)(x,{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:l()}),r.agents.length===0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:p()}):(0,A.jsx)(`ul`,{className:`oc-introspect__list`,children:r.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)(x,{variant:`default`,children:d()}):null,(0,A.jsx)(x,{variant:`outline`,children:O(e.via)}),(0,A.jsx)(x,{variant:`secondary`,children:e.state})]},`${e.instanceName} ${e.agentId}`))})]}),(0,A.jsxs)(`section`,{className:`oc-introspect__section`,children:[(0,A.jsx)(`h3`,{className:`oc-introspect__title`,children:c()}),r.charts.length===0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:p()}):(0,A.jsx)(`ul`,{className:`oc-introspect__list`,children:r.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)(x,{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:a()}),r.permissions.length===0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:p()}):(0,A.jsx)(`div`,{className:`oc-introspect__chips`,children:r.permissions.map(e=>(0,A.jsx)(x,{variant:`secondary`,children:e},e))})]})]})]})}export{M as AccessTab};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$a as r,Ja as i,Qa as a,Xa as o,Ya as s,Za as c,qa as l}from"./dist-Cci6Ggjl.js";import{i as u}from"./dist-dF88UcEZ.js";import{r as d}from"./TimeRangePicker-BP0hPL2e.js";import{t as f}from"./x-VwKg9NoU.js";import{t as p}from"./button-nO0gX-NR.js";import{Z as m,_ as h,b as g,bt as _,v,x as y,y as b}from"./index-C6XDcLXH.js";var x=t(e(),1),S=n(),C=[{value:`eq`,label:`=`},{value:`neq`,label:`≠`},{value:`contains`,label:r()},{value:`gt`,label:`>`},{value:`gte`,label:`≥`},{value:`lt`,label:`<`},{value:`lte`,label:`≤`}],w=1;function T(){return{id:w++,field:``,op:`eq`,value:``}}function E(e){return e.map(e=>({id:w++,field:e.field,op:e.op,value:String(e.value)}))}function D({fields:e,seed:t,onChange:n}){let r=(0,x.useRef)(t),w=!!(r.current&&r.current.length>0),[D,O]=(0,x.useState)(w),[k,A]=(0,x.useState)(()=>w?E(r.current):[]);function j(e){n(e.filter(e=>e.field!==``&&e.value!==``).map(e=>({field:e.field,op:e.op,value: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:c()}):(0,S.jsx)(`ul`,{className:`oc-advfilter__rows`,children:k.map(t=>(0,S.jsxs)(`li`,{className:`oc-advfilter__row`,children:[(0,S.jsxs)(h,{value:t.field||void 0,onValueChange:e=>M(t.id,{field:e}),children:[(0,S.jsx)(g,{size:`sm`,className:`w-40`,children:(0,S.jsx)(y,{placeholder:o()})}),(0,S.jsx)(v,{children:e.map(e=>(0,S.jsx)(b,{value:e.value,children:e.label},e.value))})]}),(0,S.jsxs)(h,{value:t.op,onValueChange:e=>M(t.id,{op:e}),children:[(0,S.jsx)(g,{size:`sm`,className:`w-28`,children:(0,S.jsx)(y,{})}),(0,S.jsx)(v,{children:C.map(e=>(0,S.jsx)(b,{value:e.value,children:e.label},e.value))})]}),(0,S.jsx)(m,{className:`oc-advfilter__value`,value:t.value,onChange:e=>M(t.id,{value:e.target.value}),placeholder:s()}),(0,S.jsx)(p,{variant:`ghost`,size:`icon-sm`,"aria-label":i(),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)(_,{}),l()]})]}):null]})}export{D as t};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$ as r,Ct as i,Gw as a,Q as o,Qw as s,St as ee,Tt as c,X as l,Yw as u,Z as d,_t as te,at as f,bt as ne,bw as re,ct as p,dt as m,et as h,ft as g,gt as _,ht as ie,in as ae,it as v,lt as y,mt as oe,nt as b,on as x,ot as S,pt as C,rt as se,st as w,tt as T,ut as E,uy as D,vt as O,vw as k,wt as A,xt as ce,yt as j}from"./dist-Cci6Ggjl.js";import{t as M}from"./button-nO0gX-NR.js";import{$ as N,A as P,B as F,D as I,F as le,I as ue,L as de,N as fe,P as pe,Q as me,R as he,X as L,_ as R,b as z,et as ge,mt as B,nt as _e,ot as V,rt as ve,v as H,x as U,y as W,z as ye}from"./index-C6XDcLXH.js";import{i as G}from"./compatView-xxuYVFiT.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=s(a.me.getMe,{host:V}),t=e?.role===`admin`,n=(e?.permissions??[]).includes(`bridge.read`),r=s(a.admin.listInstances,e!==void 0&&t?{}:`skip`),[o,l]=(0,K.useState)(null);(0,K.useEffect)(()=>{!t||!r||r.length===0||(!o||!r.some(e=>e.name===o))&&l(r[0].name)},[t,r,o]);let d=s(a.agents.listAgentsForInstance,t&&o?{instanceName:o}:`skip`),f=s(a.agents.listMyAgents,e!==void 0&&!t?{}:`skip`),p=(0,K.useMemo)(()=>{if(e!==void 0){if(t)return o===null||d===void 0?r!==void 0&&r.length===0?[]:void 0:d.agents.map(e=>({instanceName:o,agentId:e.agentId,label:`${e.emoji?`${e.emoji} `:``}${e.displayName??e.agentId}`}));if(f!==void 0)return f.map(e=>({instanceName:e.instanceName,agentId:e.agentId,label:`${e.emoji?`${e.emoji} `:``}${e.displayName??e.agentId}`}))}},[e,t,o,d,r,f]),[m,h]=(0,K.useState)(null);(0,K.useEffect)(()=>{!p||p.length===0||(!m||!p.some(e=>$(e)===m))&&h($(p[0]))},[p,m]);let g=p?.find(e=>$(e)===m)??null,v=u(a.agentFiles.listAgentFiles),[y,b]=(0,K.useState)({status:`idle`}),x=g?.instanceName??null,S=g?.agentId??null,se=s(a.compat.forInstance,n&&x!==null?{instanceName:x}:`skip`),w=n&&x!==null?I(se,`agentFiles`):null,T=w===null?!1:w===`loading`?null:w.blocked,E=(0,K.useCallback)(async()=>{if(!(x===null||S===null)){b({status:`loading`});try{b({status:`done`,files:(await v({instanceName:x,agentId:S})).files})}catch{b({status:`error`})}}},[v,x,S]);(0,K.useEffect)(()=>{T===!1&&E()},[E,T]);let[D,N]=(0,K.useState)(null),P=re(),F=(0,K.useMemo)(()=>new Intl.NumberFormat(P,{maximumFractionDigits:0}),[P]);return e===void 0||p===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:c()}),(0,Q.jsxs)(`div`,{className:`oc-afiles__picker`,children:[t&&(r?.length??0)>1?(0,Q.jsxs)(R,{value:o??``,onValueChange:e=>l(e),children:[(0,Q.jsx)(z,{size:`sm`,"aria-label":A(),children:(0,Q.jsx)(U,{})}),(0,Q.jsx)(H,{children:(r??[]).map(e=>(0,Q.jsx)(W,{value:e.name,children:e.name},e.name))})]}):null,p.length>0?(0,Q.jsxs)(R,{value:m??``,onValueChange:e=>h(e),children:[(0,Q.jsx)(z,{size:`sm`,"aria-label":i(),children:(0,Q.jsx)(U,{})}),(0,Q.jsx)(H,{children:p.map(e=>(0,Q.jsx)(W,{value:$(e),children:e.label},$(e)))})]}):(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:ee()})]}),g===null?null:w===`loading`?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:k()}):w!==null&&w.blocked?(0,Q.jsxs)(`p`,{className:`oc-compat__blocked`,role:`status`,children:[(0,Q.jsx)(B,{size:14,"aria-hidden":!0}),` `,G(w.gatewayVersion)]}):y.status===`loading`||y.status===`idle`?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:k()}):y.status===`error`?(0,Q.jsxs)(`p`,{className:`oc-afiles__error`,role:`alert`,children:[ne(),` `,(0,Q.jsx)(M,{variant:`outline`,size:`sm`,onClick:()=>void E(),children:ae()})]}):y.files.length===0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:ce()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`div`,{className:`oc-afiles__list`,children:y.files.map(e=>{let n=Y(e.size),r=n>=80;return(0,Q.jsxs)(`div`,{className:`oc-afiles__row`,children:[(0,Q.jsx)(`span`,{className:`oc-afiles__name`,title:e.name,children:e.name}),e.missing?(0,Q.jsx)(L,{variant:`outline`,children:j()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`span`,{className:`oc-afiles__size`,children:O({size:Z(e.size,P)})}),(0,Q.jsx)(`span`,{className:`oc-afiles__gauge${r?` is-warn`:``}`,"aria-hidden":!0,children:(0,Q.jsx)(`span`,{className:`oc-afiles__gauge-fill`,style:{width:`${Math.min(n,100)}%`}})}),(0,Q.jsx)(`span`,{className:`oc-afiles__pct`,children:te({pct:F.format(n)})}),r?(0,Q.jsx)(B,{size:14,className:`oc-afiles__warn`,"aria-label":_()}):(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?oe():C()})]},e.name)})}),(0,Q.jsx)(`p`,{className:`oc-afiles__budget`,children:ie({used:Z(be(y.files),P),total:Z(J,P),pct:F.format(X(be(y.files)))})})]}),D&&g?(0,Q.jsx)(Te,{instanceName:g.instanceName,agentId:g.agentId,name:D.name,isAdmin:t,onClose:()=>N(null),onSaved:()=>void E()}):null]})}function Te({instanceName:e,agentId:t,name:n,isAdmin:i,onClose:s,onSaved:ee}){let c=u(a.agentFiles.getAgentFile),te=u(a.agentFiles.setAgentFile),ne=P(),[_,ie]=(0,K.useState)(null),[oe,C]=(0,K.useState)(!1),[O,A]=(0,K.useState)(``),[ce,j]=(0,K.useState)(!1),[I,L]=(0,K.useState)(!1),[R,z]=(0,K.useState)(!1),[B,V]=(0,K.useState)(!1),H=(0,K.useCallback)(async r=>{C(!1);try{let i=await c({instanceName:e,agentId:t,name:n});ie({content:i.content,updatedAtMs:i.updatedAtMs}),r||A(i.content),z(!1)}catch{C(!0)}},[c,e,t,n]);(0,K.useEffect)(()=>{H(!1)},[H]);async function U(){if(_!==null){L(!0),V(!1);try{await te({instanceName:e,agentId:t,name:n,content:O,baseUpdatedAtMs:_.updatedAtMs??void 0}),ne.success(S({name:n})),ee(),await H(!1)}catch(e){Ce(e)?z(!0):V(!0)}finally{L(!1)}}}let W=_!==null&&O!==_.content,G=(0,K.useMemo)(()=>_===null?null:Se(_.content,O),[_,O]),J=O.length>q,Y=re(),X=(0,K.useMemo)(()=>new Intl.NumberFormat(Y),[Y]);return(0,Q.jsx)(me,{open:!0,onOpenChange:e=>!e&&s(),children:(0,Q.jsxs)(N,{className:`oc-afiles__editor`,children:[(0,Q.jsxs)(_e,{children:[(0,Q.jsx)(ve,{children:g({name:n})}),(0,Q.jsxs)(ge,{children:[m({agent:t,instance:e}),i?null:(0,Q.jsxs)(Q.Fragment,{children:[` · `,E()]})]})]}),oe?(0,Q.jsxs)(`p`,{className:`oc-afiles__error`,role:`alert`,children:[v(),` `,(0,Q.jsx)(M,{variant:`outline`,size:`sm`,onClick:()=>void H(!1),children:ae()})]}):_===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:O,readOnly:!i,spellCheck:!1,onChange:e=>A(e.target.value),"aria-label":g({name:n})}),(0,Q.jsx)(`p`,{className:`oc-afiles__hint`,children:y()}),R?(0,Q.jsxs)(`p`,{className:`oc-afiles__error`,role:`alert`,children:[se(),` `,(0,Q.jsx)(M,{variant:`outline`,size:`sm`,onClick:()=>void H(!0),children:b()})]}):null,B?(0,Q.jsx)(`p`,{className:`oc-afiles__error`,role:`alert`,children:f()}):null,(0,Q.jsxs)(`div`,{className:`oc-afiles__editor-foot`,children:[(0,Q.jsx)(`span`,{className:`oc-afiles__count${J?` is-over`:``}`,children:p({count:X.format(O.length),max:X.format(q)})}),i?(0,Q.jsx)(M,{size:`sm`,disabled:!W||I||R,onClick:()=>j(!0),children:I?x():w()}):null]})]}),(0,Q.jsx)(fe,{open:ce,onOpenChange:j,children:(0,Q.jsxs)(ue,{children:[(0,Q.jsxs)(ye,{children:[(0,Q.jsx)(F,{children:T({name:n})}),(0,Q.jsx)(de,{children:h({agent:t})})]}),G?(0,Q.jsxs)(`div`,{className:`oc-afiles__diff`,children:[(0,Q.jsx)(`p`,{className:`oc-afiles__diff-counts`,children:r({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:o()}),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:d()}),G.sampleRemoved.map((e,t)=>(0,Q.jsx)(`code`,{className:`oc-afiles__diff-line is-del`,children:e||` `},t))]}):null]}):null,(0,Q.jsxs)(he,{children:[(0,Q.jsx)(le,{children:D()}),(0,Q.jsx)(pe,{onClick:()=>void U(),children:l()})]})]})})]})})}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,Cd as i,Dd as a,Ed as ee,Gu as te,Gw as o,Hu as s,Ju as c,Ku as l,Od as u,Qu as ne,Qw as d,Sd as f,Td as p,Uu as m,Vu as h,Wu as g,Xu as re,Yu as ie,Zu as ae,Zw as oe,_d as se,ad as ce,bd as le,cd as ue,dd as de,ed as fe,fd as pe,gd as me,hd as he,id as _,kd as v,ld as ge,md as y,nd as b,od as x,pd as S,qu as C,rd as w,sd as T,td as E,ud as D,vd as O,wd as k,xd as A,yd as j}from"./dist-Cci6Ggjl.js";import{n as M}from"./TimeRangePicker-BP0hPL2e.js";import{A as N,At as P,X as F,_ as I,a as L,b as R,j as _e,kt as z,ot as ve,r as ye,v as B,x as V,y as H}from"./index-C6XDcLXH.js";import{t as be}from"./FilterBar-RytfYInF.js";import{t as xe}from"./DataTableShell-B44W_69s.js";import{t as U}from"./dispatchErrorInfo-ByWow4dK.js";var W=t(e(),1),G=n(),K=`__all__`,Se=[{value:`open`},{value:`acknowledged`},{value:`resolved`}];function Ce(e){return e===`open`?v():e===`acknowledged`?u():a()}var we=[`info`,`warn`,`critical`],Te=[`detector`,`agent`],Ee={kind:`relative`,from:`now-30d`,to:`now`},De=200,q=`all`;function J(){let e=P({from:`/settings/anomalies`}),t=z({from:`/settings/anomalies`}),n=e.q??``,a=e.status===q?K:e.status,s=e.severity??K,u=e.kind??K,[m,h]=(0,W.useState)(K),g=ye(e.from,e.to),{from:v,to:U}=M(g),J=e=>void t({search:t=>({...t,q:e||void 0}),replace:!0}),Y=e=>void t({search:t=>({...t,status:e===K?q:e})}),Me=e=>void t({search:t=>({...t,severity:e===K?void 0:e})}),Ne=e=>void t({search:t=>({...t,kind:e===K?void 0:e})}),X=e=>void t({search:t=>({...t,...L(e)})}),Pe=_e(),Z=N(),Q=oe(o.anomalies.resolveAnomaly),Fe=(d(o.me.getMe,{host:ve})?.permissions??[]).includes(`admin.manage`),$=d(o.anomalies.listAnomalies,{limit:De,filter:{q:n||void 0,from:v,to:U,anomalyStatus:a===K?void 0:a,severity:s===K?void 0:s,source:m===K?void 0:m,kind:u===K?void 0:u}}),Ie=(0,W.useMemo)(()=>{let e=new Set;for(let t of $??[])e.add(t.kind);return[...e].sort()},[$]),Le=n!==``||a!==`open`||s!==K||m!==K||u!==K||g.kind!==`relative`||g.from!==Ee.from;function Re(){h(K),t({search:{status:`open`},replace:!0})}async function ze(e){if(await Pe({title:ee(),description:(0,G.jsxs)(G.Fragment,{children:[p(),` `,(0,G.jsx)(`span`,{className:`font-mono`,children:e.kind}),` `,k(),` `,(0,G.jsx)(`strong`,{children:i()}),`.`,` `,f()]}),confirmLabel:A()}))try{await Q({anomalyId:e._id,status:`resolved`}),Z.success(le(),e.kind)}catch(e){Z.error(j(),e)}}async function Be(e){try{await Q({anomalyId:e._id,status:`acknowledged`}),Z.success(O(),e.kind)}catch(e){Z.error(se(),e)}}return(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(`p`,{className:`oc-admin__hint`,children:[me(),` `,(0,G.jsx)(`strong`,{children:he()}),` `,y(),` `,(0,G.jsx)(`strong`,{children:S()}),` `,pe(),` `,(0,G.jsx)(`strong`,{children:de()}),` `,D(),` `,(0,G.jsx)(`span`,{className:`oc-filter__window`,children:ge()})]}),(0,G.jsxs)(be,{q:n,onQChange:J,searchPlaceholder:ue(),timeRange:g,onTimeRangeChange:X,onReset:Re,canReset:Le,children:[(0,G.jsxs)(I,{value:a,onValueChange:Y,children:[(0,G.jsx)(R,{size:`sm`,className:`w-36`,children:(0,G.jsx)(V,{})}),(0,G.jsxs)(B,{children:[(0,G.jsx)(H,{value:K,children:T()}),Se.map(e=>(0,G.jsx)(H,{value:e.value,children:Ce(e.value)},e.value))]})]}),(0,G.jsxs)(I,{value:s,onValueChange:Me,children:[(0,G.jsx)(R,{size:`sm`,className:`w-36`,children:(0,G.jsx)(V,{placeholder:x()})}),(0,G.jsxs)(B,{children:[(0,G.jsx)(H,{value:K,children:ce()}),we.map(e=>(0,G.jsx)(H,{value:e,children:e},e))]})]}),(0,G.jsxs)(I,{value:m,onValueChange:h,children:[(0,G.jsx)(R,{size:`sm`,className:`w-32`,children:(0,G.jsx)(V,{placeholder:_()})}),(0,G.jsxs)(B,{children:[(0,G.jsx)(H,{value:K,children:w()}),Te.map(e=>(0,G.jsx)(H,{value:e,children:e},e))]})]}),(0,G.jsxs)(I,{value:u,onValueChange:Ne,children:[(0,G.jsx)(R,{size:`sm`,className:`w-36`,children:(0,G.jsx)(V,{placeholder:b()})}),(0,G.jsxs)(B,{children:[(0,G.jsx)(H,{value:K,children:E()}),Ie.map(e=>(0,G.jsx)(H,{value:e,children:e},e))]})]})]}),(0,G.jsx)(xe,{title:fe(),rows:$,emptyHint:a===`open`?r():ne(),rowActions:e=>Fe&&e.status===`open`?[{label:ae(),onSelect:()=>void ze(e)},{label:re(),onSelect:()=>void Be(e)}]:[],columns:[{header:ie(),cell:e=>(0,G.jsx)(`span`,{className:`oc-traces__time`,children:new Date(e.at).toLocaleString(`fr-FR`)}),sort:e=>e.at},{header:b(),cell:e=>(0,G.jsx)(`code`,{className:`oc-traces__mono`,children:e.kind}),sort:e=>e.kind},{header:x(),cell:e=>(0,G.jsx)(ke,{severity:e.severity}),sort:e=>e.severity===`critical`?2:+(e.severity===`warn`)},{header:c(),cell:e=>(0,G.jsx)(Ae,{status:e.status}),sort:e=>e.status===`resolved`?2:+(e.status===`acknowledged`)},{header:_(),cell:e=>(0,G.jsx)(F,{variant:`outline`,children:e.source}),sort:e=>e.source},{header:C(),cell:e=>(0,G.jsx)(`span`,{className:`oc-anomaly__msg`,children:e.message}),sort:e=>e.message},{header:l(),cell:e=>(0,G.jsx)(Oe,{row:e}),sort:e=>e.evidence??null},{header:te(),cell:e=>e.correlationId?(0,G.jsx)(`code`,{className:`oc-traces__mono`,children:je(e.correlationId)}):(0,G.jsx)(`span`,{className:`oc-traces__muted`,children:`—`}),sort:e=>e.correlationId}]})]})}function Y(e){if(e.kind!==`openclaw.dispatch_failures`||!e.evidence)return{};try{let t=JSON.parse(e.evidence);return{dominantCode:t.dominantCode,sampleCorrelationId:t.sampleCorrelationId}}catch{return{}}}function Oe({row:e}){let t=z(),n=Y(e);if(!n.dominantCode)return(0,G.jsx)(`span`,{className:`oc-traces__muted`,children:`—`});let r=U(n.dominantCode),i=n.sampleCorrelationId;return(0,G.jsxs)(`div`,{className:`oc-anomaly__cause`,children:[(0,G.jsxs)(`div`,{className:`oc-anomaly__cause-head`,children:[(0,G.jsx)(`span`,{className:`oc-anomaly__cause-label`,children:r.label}),(0,G.jsx)(`code`,{className:`oc-traces__mono`,children:n.dominantCode})]}),(0,G.jsx)(`p`,{className:`oc-anomaly__cause-hint`,children:r.hint}),i?(0,G.jsxs)(`button`,{type:`button`,className:`oc-anomaly__drill`,onClick:()=>void t({to:`/settings/traces`,search:{q:i,limit:100}}),children:[`↗ `,g()]}):null]})}function ke({severity:e}){return(0,G.jsx)(`span`,{className:`oc-anomaly__sev oc-anomaly__sev--${e}`,children:e})}function Ae({status:e}){return e===`open`?(0,G.jsx)(F,{variant:`destructive`,children:m()}):e===`acknowledged`?(0,G.jsx)(F,{variant:`secondary`,children:s()}):(0,G.jsx)(F,{variant:`outline`,children:h()})}function je(e){return e.length>8?e.slice(0,8):e}export{J as AnomaliesTab};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Af as r,Cf as i,Df as a,Ef as o,Gw as s,Mf as c,Nf as l,Of as u,Pf as ee,Qw as d,Sf as f,Tf as p,bf as m,jf as h,kf as g,wf as _,xf as v}from"./dist-Cci6Ggjl.js";import{n as y}from"./TimeRangePicker-BP0hPL2e.js";import{At as b,_ as x,a as S,b as C,i as w,kt as T,o as E,r as D,t as O,v as k,x as A,y as j}from"./index-C6XDcLXH.js";import{t as M}from"./FilterBar-RytfYInF.js";import{t as N}from"./AdvancedFilter-CO_XQQz0.js";import{t as P}from"./DataTableShell-B44W_69s.js";var F=t(e(),1),I=n(),L={kind:`relative`,from:O,to:`now`},R=`__all__`,z=[{value:`action`,label:`action`},{value:`realLabel`,label:`acteur réel`},{value:`targetLabel`,label:`au nom de`},{value:`impersonated`,label:`usurpation`},{value:`resource`,label:`ressource`},{value:`resourceId`,label:`id ressource`}];function B(){let e=b({from:`/settings/audit`}),t=T({from:`/settings/audit`}),n=e.q??``,O=e.action??R,B=e.impersonated??R,V=e.resource??R,H=D(e.from,e.to),U=(0,F.useMemo)(()=>E(e.adv),[e.adv]),{from:W,to:G}=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,...S(e)})}),Z=e=>void t({search:t=>({...t,adv:w(e)}),replace:!0}),Q=d(s.admin.listAudit,{filter:{q:n||void 0,from:W,to:G,action:O===R?void 0:O,resource:V===R?void 0:V,impersonated:B===R?void 0:B===`yes`,advanced:U.length>0?U:void 0}}),$=(0,F.useMemo)(()=>{let e=new Set;for(let t of Q??[])e.add(t.action);return[...e].sort()},[Q]),te=(0,F.useMemo)(()=>{let e=new Set;for(let t of Q??[])t.resource&&e.add(t.resource);return[...e].sort()},[Q]),ne=n!==``||O!==R||B!==R||V!==R||U.length>0||H.kind!==`relative`||H.from!==L.from;function re(){t({search:{},replace:!0})}return(0,I.jsxs)(I.Fragment,{children:[(0,I.jsxs)(`p`,{className:`oc-admin__hint`,children:[ee(),` `,(0,I.jsx)(`span`,{className:`oc-filter__window`,children:l()})]}),(0,I.jsxs)(M,{q:n,onQChange:K,searchPlaceholder:c(),timeRange:H,onTimeRangeChange:X,onReset:re,canReset:ne,children:[(0,I.jsxs)(x,{value:O,onValueChange:q,children:[(0,I.jsx)(C,{size:`sm`,className:`w-40`,children:(0,I.jsx)(A,{placeholder:h()})}),(0,I.jsxs)(k,{children:[(0,I.jsx)(j,{value:R,children:r()}),$.map(e=>(0,I.jsx)(j,{value:e,children:e},e))]})]}),(0,I.jsxs)(x,{value:B,onValueChange:J,children:[(0,I.jsx)(C,{size:`sm`,className:`w-40`,children:(0,I.jsx)(A,{})}),(0,I.jsxs)(k,{children:[(0,I.jsx)(j,{value:R,children:g()}),(0,I.jsx)(j,{value:`yes`,children:u()}),(0,I.jsx)(j,{value:`no`,children:a()})]})]}),(0,I.jsxs)(x,{value:V,onValueChange:Y,children:[(0,I.jsx)(C,{size:`sm`,className:`w-40`,children:(0,I.jsx)(A,{placeholder:o()})}),(0,I.jsxs)(k,{children:[(0,I.jsx)(j,{value:R,children:p()}),te.map(e=>(0,I.jsx)(j,{value:e,children:e},e))]})]})]}),(0,I.jsx)(N,{fields:z,seed:U,onChange:Z}),(0,I.jsx)(P,{title:_(),rows:Q,emptyHint:i(),columns:[{header:f(),cell:e=>new Date(e.at).toLocaleString(`fr-FR`),sort:e=>e.at},{header:h(),cell:e=>e.action,sort:e=>e.action},{header:v(),cell:e=>e.realLabel,sort:e=>e.realLabel},{header:m(),cell:e=>e.targetLabel??`—`,sort:e=>e.targetLabel??null},{header:o(),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{$s as r,A as i,Ac as a,As as o,Bc as s,Bs as c,Cs as l,D as u,Ds as d,E as f,Es as p,F as m,Fc as h,Fs as g,Gs as _,Gw as v,Hc as y,Hs as b,Ic as ee,Is as x,Js as te,Ks as S,Kw as C,Lc as ne,Ls as re,M as w,Ms as ie,N as ae,Nc as oe,Ns as T,O as se,Os as ce,P as le,Pc as ue,Ps as de,Qs as fe,Qw as E,Rc as pe,Rs as me,Ss as he,T as ge,Ts as _e,Uc as ve,Us as ye,Vs as be,Ws as xe,Xs as Se,Ys as Ce,Yw as we,Zs as Te,Zw as Ee,ac as De,b as Oe,bs as D,ec as ke,ic as Ae,j as je,js as Me,k as Ne,kc as Pe,ks as Fe,nc as Ie,oc as Le,qs as Re,rc as ze,sc as Be,tc as Ve,w as He,ws as Ue,xs as O,ys as k,zc as We,zs as Ge}from"./dist-Cci6Ggjl.js";import{i as A,r as Ke}from"./dist-dF88UcEZ.js";import{t as qe}from"./chevrons-up-down-BbTkkJkE.js";import{i as Je,n as j,o as Ye,r as Xe,s as Ze}from"./FieldLabel-Dn9ltnAG.js";import{t as M}from"./button-nO0gX-NR.js";import{$ as Qe,A as $e,Dt as N,E as et,H as tt,Ot as nt,Q as rt,St as it,U as at,V as ot,X as P,Z as F,_ as I,_t as st,b as L,et as ct,kt as lt,mt as R,nt as ut,ot as dt,rt as ft,v as z,x as B,y as V}from"./index-C6XDcLXH.js";import{a as pt,i as mt,n as ht,o as H,r as U,t as gt}from"./table-CQttJ0e5.js";import{t as _t}from"./FilterBar-RytfYInF.js";import{a as vt,n as yt,o as bt,r as xt,s as St,t as Ct}from"./compatView-xxuYVFiT.js";import{t as W}from"./dispatchErrorInfo-ByWow4dK.js";var wt=C(`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`}]]),Tt=C(`wifi-off`,[[`path`,{d:`M12 20h.01`,key:`zekei9`}],[`path`,{d:`M8.5 16.429a5 5 0 0 1 7 0`,key:`1bycff`}],[`path`,{d:`M5 12.859a10 10 0 0 1 5.17-2.69`,key:`1dl1wf`}],[`path`,{d:`M19 12.859a10 10 0 0 0-2.007-1.523`,key:`4k23kn`}],[`path`,{d:`M2 8.82a15 15 0 0 1 4.177-2.643`,key:`1grhjp`}],[`path`,{d:`M22 8.82a15 15 0 0 0-11.288-3.764`,key:`z3jwby`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}]]),G=t(e(),1);function Et(e){return e.filter(e=>e.state===`error`)}function Dt(e){return e.reachable&&Et(e.targets).length===0}function Ot(e){return e.state===`error`&&e.lastErrorCode!==null}function kt(e){return!!e.lastDownstreamRejectCode}function K(e){return e.kind??`openclaw`}function At(e){return[...e].sort((e,t)=>e===`openclaw`?-1:t===`openclaw`?1:e.localeCompare(t))}function jt(e,t,n){let r=new Map;for(let e of t)e.instanceName&&r.set(e.instanceName,e.provider);for(let e of n)r.set(e.name,K(e));let i=e=>(e.instanceName?r.get(e.instanceName):void 0)??`openclaw`,a=new Set;for(let e of n)a.add(K(e));for(let e of t)a.add(e.provider);for(let t of e)a.add(i(t));return At(a).map(r=>({key:r,connections:e.filter(e=>i(e)===r),compatTargets:t.filter(e=>e.provider===r),instances:n.filter(e=>K(e)===r)}))}function Mt(e){return e===`openclaw`?`OpenClaw`:e===`hermes`?`Hermes`:e.charAt(0).toUpperCase()+e.slice(1)}var q=`__all__`,Nt={q:``,state:q,instance:q,version:q},J={connected:0,error:1,idle:2};function Pt(e){return e.q.trim()!==``||e.state!==`__all__`||e.instance!==`__all__`||e.version!==`__all__`}function Ft(e,t){let n=t.q.trim().toLowerCase();return e.filter(e=>!(n&&!`${e.targetLabel} ${e.gatewayHost}`.toLowerCase().includes(n)||t.state!==`__all__`&&e.state!==t.state||t.instance!==`__all__`&&(e.instanceName??``)!==t.instance||t.version!==`__all__`&&(e.gatewayVersion??``)!==t.version))}function Y(e,t){return e.localeCompare(t,void 0,{numeric:!0,sensitivity:`base`})}function X(e,t){return e===`version`?t.gatewayVersion===null:e===`lastOk`?t.lastOkAt===null:!1}function It(e,t,n){switch(e){case`state`:return(J[t.state]??99)-(J[n.state]??99);case`instance`:return Y(t.instanceLabel??t.instanceName??``,n.instanceLabel??n.instanceName??``);case`host`:return Y(t.gatewayHost,n.gatewayHost);case`version`:{let e=t.gatewayVersion,r=n.gatewayVersion;return bt(e,r)??Y(e,r)}case`lastOk`:return t.lastOkAt-n.lastOkAt;default:return Y(t.targetLabel,n.targetLabel)}}function Lt(e,t){if(!t)return e;let n=t.dir===`asc`?1:-1;return[...e].sort((e,r)=>{let i=X(t.key,e),a=X(t.key,r);return i&&a?0:i?1:a?-1:n*It(t.key,e,r)})}function Rt(e){let t=new Set;for(let n of e)t.add(n.state);return[...t].sort((e,t)=>(J[e]??99)-(J[t]??99))}function zt(e){let t=new Map;for(let n of e)n.instanceName!==null&&(t.has(n.instanceName)||t.set(n.instanceName,n.instanceLabel??n.instanceName));return[...t.entries()].map(([e,t])=>({name:e,label:t})).sort((e,t)=>Y(e.label,t.label))}function Bt(e){let t=new Set;for(let n of e)n.gatewayVersion!==null&&t.add(n.gatewayVersion);return[...t].sort((e,t)=>bt(e,t)??Y(e,t))}var Z=n();function Vt({connections:e,displayByInstance:t}){let[n,r]=(0,G.useState)(Nt),[i,a]=(0,G.useState)(null),s=(0,G.useMemo)(()=>e.map((e,n)=>({_id:`${e.key}:${e.canonical}/${e.agentId}:${n}`,targetLabel:`${e.canonical}/${e.agentId}`,state:e.state,instanceName:e.instanceName??null,instanceLabel:e.instanceName?t.get(e.instanceName)??e.instanceName:null,gatewayHost:e.gatewayHost,gatewayVersion:e.gatewayVersion??null,okCount:e.okCount,errorCount:e.errorCount,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]),c=(0,G.useMemo)(()=>Rt(s),[s]),u=(0,G.useMemo)(()=>zt(s),[s]),f=(0,G.useMemo)(()=>Bt(s),[s]),m=(0,G.useMemo)(()=>Lt(Ft(s,n),i),[s,n,i]);function h(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:re()}):(0,Z.jsxs)(`div`,{className:`oc-conn`,children:[(0,Z.jsxs)(_t,{q:n.q,onQChange:e=>r(t=>({...t,q:e})),searchPlaceholder:de(),onReset:()=>r(Nt),canReset:Pt(n),children:[(0,Z.jsxs)(I,{value:n.state,onValueChange:e=>r(t=>({...t,state:e})),children:[(0,Z.jsx)(L,{size:`sm`,className:`w-36`,children:(0,Z.jsx)(B,{placeholder:ie()})}),(0,Z.jsxs)(z,{children:[(0,Z.jsx)(V,{value:q,children:T()}),c.map(e=>(0,Z.jsx)(V,{value:e,children:Ut(e)},e))]})]}),(0,Z.jsxs)(I,{value:n.instance,onValueChange:e=>r(t=>({...t,instance:e})),children:[(0,Z.jsx)(L,{size:`sm`,className:`w-40`,children:(0,Z.jsx)(B,{placeholder:Me()})}),(0,Z.jsxs)(z,{children:[(0,Z.jsx)(V,{value:q,children:T()}),u.map(e=>(0,Z.jsx)(V,{value:e.name,children:e.label},e.name))]})]}),(0,Z.jsxs)(I,{value:n.version,onValueChange:e=>r(t=>({...t,version:e})),children:[(0,Z.jsx)(L,{size:`sm`,className:`w-36`,children:(0,Z.jsx)(B,{placeholder:o()})}),(0,Z.jsxs)(z,{children:[(0,Z.jsx)(V,{value:q,children:T()}),f.map(e=>(0,Z.jsx)(V,{value:e,children:e},e))]})]})]}),m.length===0?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:Fe()}):(0,Z.jsxs)(gt,{className:`oc-conn__table`,children:[(0,Z.jsx)(pt,{children:(0,Z.jsxs)(H,{children:[(0,Z.jsx)(Q,{label:ce(),sortKey:`target`,sort:i,onSort:h}),(0,Z.jsx)(Q,{label:d(),sortKey:`state`,sort:i,onSort:h}),(0,Z.jsx)(Q,{label:p(),sortKey:`instance`,sort:i,onSort:h}),(0,Z.jsx)(Q,{label:_e(),sortKey:`host`,sort:i,onSort:h}),(0,Z.jsx)(Q,{label:Ue(),sortKey:`version`,sort:i,onSort:h}),(0,Z.jsx)(mt,{children:l()}),(0,Z.jsx)(Q,{label:he(),sortKey:`lastOk`,sort:i,onSort:h})]})}),(0,Z.jsx)(ht,{children:m.map(e=>(0,Z.jsx)(Ht,{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)(mt,{"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)(Ke,{size:13,"aria-hidden":!0}):(0,Z.jsx)(A,{size:13,"aria-hidden":!0}):(0,Z.jsx)(qe,{size:13,"aria-hidden":!0,className:`oc-conn__sort-idle`})]})})}function Ht({r:e}){let t=Ot(e)?W(e.lastErrorCode):null,n=kt(e)?W(e.lastDownstreamRejectCode):null;return(0,Z.jsxs)(G.Fragment,{children:[(0,Z.jsxs)(H,{className:`oc-conn__row oc-conn__row--${e.state}`,children:[(0,Z.jsx)(U,{children:(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:e.targetLabel})}),(0,Z.jsx)(U,{children:(0,Z.jsx)(Wt,{state:e.state})}),(0,Z.jsx)(U,{children:e.instanceLabel?(0,Z.jsx)(`span`,{className:`oc-bridge-target__instance`,children:e.instanceLabel}):(0,Z.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})}),(0,Z.jsx)(U,{children:(0,Z.jsx)(`span`,{className:`oc-bridge-target__host`,children:e.gatewayHost})}),(0,Z.jsx)(U,{children:e.gatewayVersion?(0,Z.jsx)(`span`,{className:`oc-bridge-target__version`,children:e.gatewayVersion}):(0,Z.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})}),(0,Z.jsx)(U,{children:(0,Z.jsx)(`span`,{className:`oc-conn__stats`,children:x({ok:e.okCount,errors:e.errorCount,attempts:e.attempts})})}),(0,Z.jsx)(U,{children:e.lastOkAt?(0,Z.jsx)(`span`,{className:`oc-traces__mono`,children:new Date(e.lastOkAt).toLocaleTimeString(`fr-FR`)}):(0,Z.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})})]}),t||n?(0,Z.jsx)(H,{className:`oc-conn__detail-row`,children:(0,Z.jsxs)(U,{colSpan:7,className:`oc-conn__detail-cell`,children:[t?(0,Z.jsxs)(`div`,{className:`oc-bridge-target__error`,children:[(0,Z.jsx)(`strong`,{children:t.label}),` `,(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:e.lastErrorCode}),e.lastErrorAt?` · ${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:[g({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 Ut(e){return e===`connected`?O():e===`error`?D():k()}function Wt({state:e}){return e===`connected`?(0,Z.jsx)(P,{variant:`secondary`,children:O()}):e===`error`?(0,Z.jsx)(P,{variant:`destructive`,children:D()}):(0,Z.jsx)(P,{variant:`outline`,children:k()})}function Gt(){return E(v.bridgeHealth.getBridgeHealth,{})}function Kt(){let e=Gt(),t=E(v.compat.getBridgeCompat,{}),n=E(v.me.getMe,{host:dt})?.role===`admin`,r=E(v.admin.listInstances,n?{}:`skip`),i=lt(),a=()=>void i({to:`/settings/anomalies`,search:{status:`open`}}),o=jt(e?e.targets:[],t?t.targets:[],r??[]),s=t?.compat??null,c=t===void 0?`loading`:t===null?`nodata`:`ready`,l=s!==null&&yt(s,`hermes`)&&!o.some(e=>e.key===`hermes`);return(0,Z.jsxs)(`div`,{className:`oc-bridge`,children:[(0,Z.jsx)(qt,{health:e,compat:t,onSeeAnomalies:a}),(0,Z.jsx)(`p`,{className:`oc-admin__hint oc-bridge__caption`,children:Re()}),o.map(e=>(0,Z.jsx)(Jt,{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:Oe()}):null]})}function qt({health:e,compat:t,onSeeAnomalies:n}){let r=t&&t!==null?(0,Z.jsxs)(`span`,{className:`oc-bridge-card__ver`,children:[(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:vt(t.bridgeVersion)}),` · `,ae(),` `,(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:S()});if(e===null)return(0,Z.jsx)(`div`,{className:`oc-bridge-card oc-bridge-card--idle`,children:_()});let i=Et(e.targets),a=!e.reachable,o=Dt(e),s=o?`ok`:`error`,l=new Date(e.checkedAt).toLocaleString(`fr-FR`),u=e.startedAt==null?null:new Date(e.startedAt).toLocaleString(`fr-FR`);return(0,Z.jsxs)(`div`,{className:`oc-bridge-card oc-bridge-card--${s}`,children:[(0,Z.jsx)(`div`,{className:`oc-bridge-card__icon`,"aria-hidden":!0,children:o?(0,Z.jsx)(N,{size:22}):a?(0,Z.jsx)(Tt,{size:22}):(0,Z.jsx)(R,{size:22})}),(0,Z.jsxs)(`div`,{className:`oc-bridge-card__body`,children:[(0,Z.jsx)(`div`,{className:`oc-bridge-card__title`,children:o?xe():a?ye():b({count:i.length})}),(0,Z.jsxs)(`div`,{className:`oc-bridge-card__meta`,children:[(0,Z.jsxs)(`span`,{children:[(0,Z.jsx)(wt,{size:12,"aria-hidden":!0}),` `,be({time:l})]}),u?(0,Z.jsx)(`span`,{children:c({time:u})}):null,r]}),a?(0,Z.jsx)(`p`,{className:`oc-bridge-card__hint`,children:W(e.lastError===`not_configured`?`NOT_CONFIGURED`:`BRIDGE_UNREACHABLE`).hint}):null]}),(0,Z.jsx)(`button`,{type:`button`,className:`oc-bridgebar__drill`,onClick:n,children:Ge()})]})}function Jt({providerKey:e,connections:t,instances:n,manifest:r,compatStatus:i,compatReachable:a}){let o=r?St(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:Ct(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,G.useState)(!1);return(0,Z.jsxs)(`section`,{className:`oc-bridge-provider`,children:[(0,Z.jsxs)(`header`,{className:`oc-bridge-provider__head`,children:[(0,Z.jsx)(st,{size:15,"aria-hidden":!0,className:`oc-bridge-provider__icon`}),(0,Z.jsx)(`span`,{className:`oc-bridge-provider__name`,children:Mt(e)}),d?(0,Z.jsx)(P,{variant:d===`beyond`?`destructive`:`secondary`,children:xt(d)}):null]}),(0,Z.jsx)(`h4`,{className:`oc-bridge-provider__sub`,children:m()}),(0,Z.jsx)(Yt,{support:o,compatStatus:i,compatReachable:a,manifest:r,instanceRows:c}),(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)(A,{size:13,"aria-hidden":!0}):(0,Z.jsx)(nt,{size:13,"aria-hidden":!0}),me({count:t.length})]}),f?(0,Z.jsx)(Vt,{connections:t,displayByInstance:s}):null]})}function Yt({support:e,compatStatus:t,compatReachable:n,manifest:r,instanceRows:a}){return t===`loading`?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:S()}):t===`nodata`?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:le()}):(0,Z.jsxs)(`div`,{className:`oc-compat`,children:[n?null:(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:je()}),r===null?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:i()}):(0,Z.jsxs)(`div`,{className:`oc-compat__support`,children:[(0,Z.jsx)(`span`,{className:`oc-compat__label`,children:Ne()}),e&&e.range!==null?(0,Z.jsx)(`span`,{children:se({min:e.range.min,max:e.range.maxValidated})}):(0,Z.jsx)(`span`,{children:w()}),e?(0,Z.jsx)(Qt,{versions:e.validatedVersions}):null]}),a.length===0?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:He()}):(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:vt(e.version)}),(0,Z.jsx)(P,{variant:e.state===`supported`?`secondary`:e.state===`beyond`?`destructive`:`outline`,children:xt(e.state)})]},e.instanceName))})]})}function Xt({instance:e,onClose:t}){return(0,Z.jsx)(rt,{open:!0,onOpenChange:e=>!e&&t(),children:(0,Z.jsxs)(Qe,{className:`oc-bridge-config-dialog`,onOpenAutoFocus:e=>e.preventDefault(),children:[(0,Z.jsxs)(ut,{children:[(0,Z.jsx)(ft,{children:ve({instance:e.displayName??e.name})}),(0,Z.jsx)(ct,{children:y()})]}),(0,Z.jsx)(Zt,{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)(N,{"aria-hidden":!0}):(0,Z.jsx)(R,{"aria-hidden":!0}),(0,Z.jsxs)(`span`,{children:[e,` — `,t.ok?Te():t.detail]})]}):(0,Z.jsxs)(`p`,{className:`oc-bridge-config__check-row oc-bridge-config__check-row--skip`,children:[e,` — `,Se()]}):null}function Zt({instance:e,onClose:t}){let n=Ee(v.admin.upsertInstanceConfig),i=we(v.bridge.validateMediaPaths),o=$e(),[c,l]=(0,G.useState)(()=>Je(e.config??{})),[u,d]=(0,G.useState)(!1),[f,p]=(0,G.useState)(!1),[m,g]=(0,G.useState)(null),_=c.inboundMediaMode===`shared-fs`,y=c.mediaMode===`shared-fs`,b=_||y;async function x(){p(!0),g(null);try{g(await i({instanceName:e.name,inboundMediaMode:c.inboundMediaMode,mediaMode:c.mediaMode}))}catch(e){o.error(Ve(),e)}finally{p(!1)}}async function S(){d(!0);try{let r=e.config??{};await n({instanceId:e._id,config:Xe(c,r)}),t()}catch(e){o.error(h(),e)}finally{d(!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)(j,{label:s(),help:ue()}),(0,Z.jsxs)(I,{value:c.mediaMode,onValueChange:e=>l({...c,mediaMode:e}),children:[(0,Z.jsx)(L,{size:`sm`,className:`w-full`,children:(0,Z.jsx)(B,{})}),(0,Z.jsx)(z,{children:Ze.map(e=>(0,Z.jsx)(V,{value:e,children:e},e))})]})]}),(0,Z.jsxs)(`label`,{className:`oc-field`,children:[(0,Z.jsx)(j,{label:We(),help:oe()}),(0,Z.jsxs)(I,{value:c.inboundMediaMode,onValueChange:e=>l({...c,inboundMediaMode:e}),children:[(0,Z.jsx)(L,{size:`sm`,className:`w-full`,children:(0,Z.jsx)(B,{})}),(0,Z.jsx)(z,{children:Ye.map(e=>(0,Z.jsx)(V,{value:e,children:e},e))})]})]}),(0,Z.jsxs)(`label`,{className:`oc-field`,children:[(0,Z.jsx)(j,{label:pe(),help:a()}),(0,Z.jsx)(F,{type:`number`,min:1,max:4096,className:`w-full`,value:c.mediaMaxMb,onChange:e=>l({...c,mediaMaxMb:Math.trunc(Number(e.target.value)||0)})})]})]}),b&&(0,Z.jsxs)(`div`,{className:`oc-bridge-config__grid`,children:[_&&(0,Z.jsxs)(`label`,{className:`oc-field`,children:[(0,Z.jsx)(j,{label:Be(),help:Le()}),(0,Z.jsx)(F,{className:`w-full`,spellCheck:!1,value:c.inboundAgentMount,onChange:e=>l({...c,inboundAgentMount:e.target.value})})]}),y&&(0,Z.jsxs)(`label`,{className:`oc-field`,children:[(0,Z.jsx)(j,{label:De(),help:Ae()}),(0,Z.jsx)(F,{className:`w-full`,spellCheck:!1,value:c.outboundAgentMount,onChange:e=>l({...c,outboundAgentMount:e.target.value})})]})]}),(0,Z.jsxs)(`label`,{className:`oc-field--row`,children:[(0,Z.jsx)(et,{checked:c.rehydration,onCheckedChange:e=>l({...c,rehydration:e===!0})}),(0,Z.jsx)(j,{label:ne(),help:Pe()})]}),b&&m!==null&&(0,Z.jsx)(`div`,{className:`oc-bridge-config__check`,children:m.reachable?!m.inbound&&!m.outbound?(0,Z.jsxs)(`p`,{className:`oc-bridge-config__check-row oc-bridge-config__check-row--err`,children:[(0,Z.jsx)(R,{"aria-hidden":!0}),te({reason:m.reason??`?`})]}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)($,{label:r(),result:m.inbound}),(0,Z.jsx)($,{label:fe(),result:m.outbound}),(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:ke()})]}):(0,Z.jsxs)(`p`,{className:`oc-bridge-config__check-row oc-bridge-config__check-row--err`,children:[(0,Z.jsx)(R,{"aria-hidden":!0}),Ce()]})}),(0,Z.jsxs)(`div`,{className:`oc-bridge-config__actions`,children:[b&&(0,Z.jsxs)(M,{variant:`outline`,size:`sm`,onClick:()=>void x(),disabled:f,children:[f?(0,Z.jsx)(it,{className:`size-4 animate-spin`,"aria-hidden":!0}):null,f?Ie():ze()]}),(0,Z.jsx)(M,{size:`sm`,onClick:()=>void S(),disabled:u,children:ee()})]})]})})}function Qt({versions:e}){if(e.length===0)return null;let t=[...e].reverse();return(0,Z.jsxs)(ot,{children:[(0,Z.jsx)(at,{asChild:!0,children:(0,Z.jsxs)(`button`,{type:`button`,className:`oc-compat__versions-btn`,children:[e.length===1?u():f({count:e.length}),(0,Z.jsx)(A,{size:13,"aria-hidden":!0})]})}),(0,Z.jsxs)(tt,{className:`oc-compat__versions-pop`,align:`start`,children:[(0,Z.jsx)(`p`,{className:`oc-compat__versions-title`,children:ge()}),(0,Z.jsx)(`div`,{className:`oc-compat__versions-list`,children:t.map(e=>(0,Z.jsx)(P,{variant:`secondary`,children:e},e))})]})]})}export{Kt as BridgeTab,Xt as InstanceConfigDialog};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$t as r,B as i,G as a,Gw as o,H as s,I as c,J as ee,K as te,L as ne,Qw as l,R as re,U as ie,V as ae,Vc as u,W as d,Yw as f,en as p,in as oe,on as se,q as m,uy as h,vw as g,wt as _,z as ce}from"./dist-Cci6Ggjl.js";import{t as v}from"./button-nO0gX-NR.js";import{A as le,B as ue,D as de,F as fe,I as pe,L as me,N as he,P as y,R as b,_ as x,b as S,g as C,h as w,mt as T,v as E,x as D,y as O,z as k}from"./index-C6XDcLXH.js";import{i as A}from"./compatView-xxuYVFiT.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=f(o.agentFiles.getChatDefaults),t=f(o.agentFiles.setChatDefaults),n=le(),[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=l(o.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=l(o.compat.forInstance,U?{instanceName:U}:`skip`),K=U?de(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(ae()),await X()}catch(e){n.error(i(),e)}finally{V(!1)}}let xe=(0,j.useMemo)(()=>M.map(e=>({id:e,label:C(e)})),[]),Se=(0,j.useMemo)(()=>[{id:`fast`,label:p()},{id:`standard`,label:r()}],[]);return(0,P.jsxs)(`div`,{className:`oc-cdefaults`,children:[(0,P.jsx)(`p`,{className:`oc-admin__hint`,children:ee()}),G&&U?(0,P.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,P.jsx)(`span`,{className:`oc-cdefaults__label`,children:_()}),(0,P.jsxs)(x,{value:U,onValueChange:e=>W(e),disabled:B,children:[(0,P.jsx)(S,{size:`sm`,"aria-label":_(),children:(0,P.jsx)(D,{})}),(0,P.jsx)(E,{children:(H??[]).map(e=>(0,P.jsx)(O,{value:e.name,children:e.name},e.name))})]})]}):null,_e?(0,P.jsx)(`p`,{className:`oc-admin__hint`,role:`status`,children:u()}):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:[ie(),` `,(0,P.jsx)(v,{variant:`outline`,size:`sm`,onClick:()=>void X(),children:oe()})]}):(0,P.jsxs)(P.Fragment,{children:[(0,P.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,P.jsx)(`span`,{className:`oc-cdefaults__label`,children:m()}),(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:te()})]}),(0,P.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,P.jsx)(`span`,{className:`oc-cdefaults__label`,children:a()}),(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:d()})]}),(0,P.jsx)(`div`,{className:`oc-cdefaults__actions`,children:(0,P.jsx)(v,{size:`sm`,disabled:!ye||B,onClick:()=>z(!0),children:B?se():s()})}),(0,P.jsx)(`p`,{className:`oc-cdefaults__note`,children:ce()})]}),(0,P.jsx)(he,{open:ge,onOpenChange:z,children:(0,P.jsxs)(pe,{children:[(0,P.jsxs)(k,{children:[(0,P.jsx)(ue,{children:re()}),(0,P.jsx)(me,{children:ne()})]}),(0,P.jsxs)(b,{children:[(0,P.jsx)(fe,{children:h()}),(0,P.jsx)(y,{onClick:()=>void be(),children:c()})]})]})})]})}export{F as ChatDefaultsTab};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{aa as r,ca as i,da as a,la as o,oa as s,sa as c,ua as l}from"./dist-Cci6Ggjl.js";import{i as u,r as d}from"./dist-dF88UcEZ.js";import{t as f}from"./chevrons-up-down-BbTkkJkE.js";import{t as p}from"./button-nO0gX-NR.js";import{E as m,G as h,J as g,K as _,W as v,Y as y,bt as b,ht as x,wt as S}from"./index-C6XDcLXH.js";import{a as C,i as w,n as T,o as E,r as D,t as O}from"./table-CQttJ0e5.js";var k=t(e(),1);function A(e,t){return typeof e==`number`&&typeof t==`number`?e-t:typeof e==`boolean`&&typeof t==`boolean`?!!e-+!!t:String(e).localeCompare(String(t),void 0,{numeric:!0,sensitivity:`base`})}function j(e,t,n){return[...e].sort((e,r)=>{let i=t(e),a=t(r),o=i==null,s=a==null;if(o||s)return o&&s?0:o?1:-1;let c=A(i,a);return n===`asc`?c:-c})}var M=n();function N({title:e,rows:t,columns:n,rowActions:A,onAdd:N,addLabel:P=a(),bulkActions:F,emptyHint:I=l(),isExpanded:L,renderExpanded:R}){let[z,B]=(0,k.useState)(new Set),[V,H]=(0,k.useState)(null),U=t??[],W=V?n[V.index]:void 0,G=V&&W?.sort?j(U,W.sort,V.dir):U;function K(e){H(t=>!t||t.index!==e?{index:e,dir:`asc`}:t.dir===`asc`?{index:e,dir:`desc`}:null)}let q=+!!F+n.length+ +!!A,J=U.length>0&&z.size===U.length,Y=z.size>0&&!J;function X(){B(J?new Set:new Set(U.map(e=>e._id)))}function Z(e){B(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})}return(0,M.jsxs)(`div`,{className:`oc-dt`,children:[(0,M.jsxs)(`div`,{className:`oc-dt__bar`,children:[(0,M.jsx)(`h2`,{className:`oc-dt__title`,children:e}),(0,M.jsxs)(`div`,{className:`oc-dt__bar-actions`,children:[z.size>0&&F?F.map(e=>(0,M.jsxs)(p,{size:`sm`,variant:e.variant===`destructive`?`destructive`:`outline`,onClick:()=>{e.onSelect([...z]),B(new Set)},children:[e.variant===`destructive`?(0,M.jsx)(x,{}):null,e.label,` (`,z.size,`)`]},e.label)):null,N?(0,M.jsxs)(p,{size:`sm`,onClick:N,children:[(0,M.jsx)(b,{}),` `,P]}):null]})]}),t===void 0?(0,M.jsx)(`p`,{className:`oc-admin__hint`,children:o()}):U.length===0?(0,M.jsx)(`p`,{className:`oc-admin__hint`,children:I}):(0,M.jsxs)(O,{children:[(0,M.jsx)(C,{children:(0,M.jsxs)(E,{children:[F?(0,M.jsx)(w,{className:`w-8`,children:(0,M.jsx)(m,{"aria-label":i(),checked:J?!0:Y?`indeterminate`:!1,onCheckedChange:X})}):null,n.map((e,t)=>{let n=V?.index===t;return e.sort?(0,M.jsx)(w,{className:e.className,"aria-sort":n?V.dir===`asc`?`ascending`:`descending`:`none`,children:(0,M.jsxs)(`button`,{type:`button`,className:`oc-dt__sort`,onClick:()=>K(t),"aria-label":r({column:e.header}),children:[e.header,n?V.dir===`asc`?(0,M.jsx)(d,{className:`oc-dt__sort-icon`,"aria-hidden":!0}):(0,M.jsx)(u,{className:`oc-dt__sort-icon`,"aria-hidden":!0}):(0,M.jsx)(f,{className:`oc-dt__sort-icon oc-dt__sort-icon--idle`,"aria-hidden":!0})]})},e.header):(0,M.jsx)(w,{className:e.className,children:e.header},e.header)}),A?(0,M.jsx)(w,{className:`w-8`}):null]})}),(0,M.jsx)(T,{children:G.map(e=>{let t=A?.(e)??[],r=L?.(e)??!1;return(0,M.jsxs)(k.Fragment,{children:[(0,M.jsxs)(E,{className:`group/row`,children:[F?(0,M.jsx)(D,{children:(0,M.jsx)(m,{"aria-label":c(),checked:z.has(e._id),onCheckedChange:()=>Z(e._id)})}):null,n.map(t=>(0,M.jsx)(D,{className:t.className,children:t.cell(e)},t.header)),A?(0,M.jsx)(D,{children:t.length>0?(0,M.jsxs)(v,{children:[(0,M.jsx)(y,{asChild:!0,children:(0,M.jsx)(p,{variant:`ghost`,size:`icon-sm`,"aria-label":s(),className:`opacity-0 transition-opacity group-hover/row:opacity-100 group-focus-within/row:opacity-100 aria-expanded:opacity-100`,children:(0,M.jsx)(S,{})})}),(0,M.jsx)(h,{align:`end`,children:t.map((t,n)=>(0,M.jsxs)(`div`,{children:[t.variant===`destructive`&&n>0?(0,M.jsx)(g,{}):null,(0,M.jsx)(_,{variant:t.variant,onSelect:()=>t.onSelect(e),children:t.label})]},t.label))})]}):null}):null]}),r&&R?(0,M.jsx)(E,{className:`oc-dt__expansion`,children:(0,M.jsx)(D,{colSpan:q,className:`oc-dt__expansion-cell`,children:R(e)})}):null]},e._id)})})]})]})}export{N as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./bundle-mjs-C73ZY4La.js";import{X as t}from"./index-
|
|
1
|
+
import{r as e}from"./bundle-mjs-C73ZY4La.js";import{X as t}from"./index-C6XDcLXH.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,Bh as a,Ch as o,Dh as s,Eh as c,Fh as l,Gh as u,Gw as d,Hh as f,Ih as ee,Jh as p,Kh as m,Lh as te,Mh as h,Nh as g,Oh as _,Ph as ne,Qm as v,Qw as y,Rh as re,Sh as ie,Th as b,Uh as x,Vh as S,Wh as C,Xh as w,Xm as T,Yh as E,Ym as D,Zm as O,Zw 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 ae,kh as B,lh as V,mh as H,nh as U,oh as W,ph as G,qh 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,zh as fe}from"./dist-Cci6Ggjl.js";import{t as pe}from"./button-nO0gX-NR.js";import{j as me}from"./index-C6XDcLXH.js";import{t as he}from"./DataTableShell-B44W_69s.js";var Y=t(e(),1),X=n(),Z={altered_words:()=>w(),incorrect:()=>E(),incoherence:()=>p(),formatting:()=>K(),latency:()=>m(),api_error:()=>u(),other:()=>C()},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:f()}):e===!1?(0,X.jsx)(`span`,{className:`oc-fbadmin__pill is-warn`,children:S()}):(0,X.jsx)(`span`,{className:`oc-fbadmin__pill`,children:`—`}):(0,X.jsx)(`span`,{className:`oc-fbadmin__pill`,children:x()})}function ge({data:e,closeReason:t}){let n=e.snapshot,r=k(d.feedback.respondToFeedback),[u,f]=(0,Y.useState)(e.thread),[p,m]=(0,Y.useState)(``),[v,y]=(0,Y.useState)(!1);async function x(){let t=p.trim();if(!(!t||v)){y(!0);try{await r({feedbackId:e._id,text:t}),f(e=>[...e,{authorRole:`admin`,text:t,at:Date.now()}]),m(``)}finally{y(!1)}}}let S=[];try{S=n.contextJson?JSON.parse(n.contextJson):[]}catch{S=[]}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?` · ${a()}`:``,n.openclawModel?` · ${n.openclawModel}`:``,n.openclawRuntime?` (${n.openclawRuntime})`:``]})]}),e.comment?(0,X.jsxs)(`section`,{children:[(0,X.jsx)(`h4`,{className:`oc-fbadmin__h`,children:fe()}),(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:oe()}),(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:re()}),u.length>0?(0,X.jsx)(`div`,{className:`oc-fbadmin__thread`,children:u.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`?te():ee()}),(0,X.jsx)(`span`,{className:`oc-notif__msg-text`,children:e.text})]},t))}):(0,X.jsx)(`p`,{className:`oc-fbadmin__meta`,children:l()}),(0,X.jsx)(`textarea`,{className:`oc-feedback__textarea`,placeholder:ne(),value:p,maxLength:2e3,rows:3,onChange:e=>m(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 x(),disabled:!p.trim()||v,children:v?g():h()})})]}),(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||i()})]}),n.clientInfo?.sourceWasOpen&&n.displayedText!==void 0?(0,X.jsxs)(`section`,{children:[(0,X.jsx)(`h4`,{className:`oc-fbadmin__h`,children:B()}),(0,X.jsx)(`pre`,{className:`oc-msg__source-pre`,children:n.displayedText||i()})]}):null,n.promptText?(0,X.jsxs)(`section`,{children:[(0,X.jsx)(`h4`,{className:`oc-fbadmin__h`,children:_()}),(0,X.jsx)(`pre`,{className:`oc-msg__source-pre`,children:n.promptText})]}):null,S.length>0?(0,X.jsxs)(`section`,{children:[(0,X.jsx)(`h4`,{className:`oc-fbadmin__h`,children:s({count:n.contextCount??S.length,truncated:n.contextTruncated?c():``})}),(0,X.jsx)(`div`,{className:`oc-fbadmin__ctx`,children:S.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:b()}),(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:le()}),(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:o()}),(0,X.jsxs)(`p`,{className:`oc-fbadmin__env`,children:[[n.clientInfo?.language,n.clientInfo?.timezone,n.clientInfo?.theme?ie({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:[ue(),` `,n.clientInfo.plugins.join(`, `),(0,X.jsxs)(`span`,{className:`oc-fbadmin__note`,children:[` `,M()]})]}):null,n.clientInfo?.userAgent?(0,X.jsx)(`span`,{className:`oc-fbadmin__ua`,children:n.clientInfo.userAgent}):null]})]})]})}function _e(){let e=y(d.feedback.listForAdmin,{}),t=k(d.feedback.readSnapshot),n=k(d.feedback.deleteFeedback),i=me(),[a,o]=(0,Y.useState)(null),[s,c]=(0,Y.useState)({});async function l(e){if(a===e._id){o(null);return}if(!s[e._id]){let n=await t({feedbackId:e._id});c(t=>({...t,[e._id]:n}))}o(e._id)}async function u(e){await i({title:O(),description:T(),confirmLabel:D(),destructive:!0})&&(await n({feedbackId:e._id}),a===e._id&&o(null))}return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`p`,{className:`oc-admin__hint`,children:[de(),` `,(0,X.jsx)(`strong`,{children:ce()}),` `,A()]}),(0,X.jsx)(he,{title:L(),rows:e,emptyHint:R(),isExpanded:e=>a===e._id&&!!s[e._id],renderExpanded:e=>s[e._id]?(0,X.jsx)(ge,{data:s[e._id],closeReason:e.userCloseReason}):null,columns:[{header:H(),cell:e=>new Date(e.at).toLocaleString(`fr-FR`),sort:e=>e.at},{header:G(),cell:e=>Q(e.category),sort:e=>Q(e.category)},{header:I(),cell:e=>e.messageRole===`user`?P():se(),sort:e=>e.messageRole},{header:V(),cell:e=>(e.reporterEmail||e.reporterName||`—`)+(e.impersonated&&e.realOperatorEmail?` ${N({operator:e.realOperatorEmail})}`:``),sort:e=>e.reporterEmail||e.reporterName||null},{header:J(),cell:e=>(0,X.jsx)($,{matches:e.displayedMatchesStored,sourceWasOpen:e.sourceWasOpen}),sort:e=>e.displayedMatchesStored===!1?0:e.displayedMatchesStored===!0?1:2},{header:W(),cell:e=>e.hasComment?`✎`:`—`,sort:e=>+!!e.hasComment},{header:j(),cell:e=>e.userClosedAt==null?e.answered?(0,X.jsx)(`span`,{className:`oc-fbadmin__pill is-ok`,children:z()}):(0,X.jsx)(`span`,{className:`oc-fbadmin__pill`,children:q()}):(0,X.jsx)(`span`,{className:`oc-fbadmin__pill is-closed`,children:U()}),sort:e=>e.userClosedAt==null?+!!e.answered:2}],rowActions:e=>[{label:a===e._id?F():r(),onSelect:()=>void l(e)},{label:v(),onSelect:()=>void u(e),variant:`destructive`}]})]})}export{_e as FeedbacksTab};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{r as e}from"./bundle-mjs-C73ZY4La.js";import{
|
|
1
|
+
import{r as e}from"./bundle-mjs-C73ZY4La.js";import{Kw as t,aT as n}from"./dist-Cci6Ggjl.js";import{c as r,l as i,s as a,u as o}from"./index-C6XDcLXH.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
2
|
Pour qu'un fichier que tu génères soit téléchargeable par l'utilisateur dans ce webchat : écris-le sous {outboundDir}/ puis ajoute, dans ta réponse finale, une ligne dédiée EXACTEMENT au format MEDIA:<chemin absolu du fichier>. N'utilise PAS de lien markdown vers un chemin local — il ne serait pas cliquable.`},documentary_fetch:{key:`documentary_fetch`,appliedIn:`convex`,togglable:!0,placeholders:[`references`],defaultTemplate:`Fournis les fichiers source téléchargeables correspondant EXACTEMENT à ces références de documents (un fichier par référence, nommé d'après la référence). Réponds uniquement avec les fichiers, sans commentaire :
|
|
3
3
|
{references}`,disabledTemplate:`{references}`},inbound_files:{key:`inbound_files`,appliedIn:`bridge`,togglable:!0,placeholders:[`files`],defaultTemplate:`[FICHIERS REÇUS]
|
|
4
|
-
{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`],m=[`reactive`,`sse`],h=`reactive`;
|
|
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`],m=[`reactive`,`sse`],h=`reactive`;n.object({mediaMode:n.optional(n.union(n.literal(`gateway-http`),n.literal(`shared-fs`),n.literal(`off`))),inboundMediaMode:n.optional(n.union(n.literal(`inline`),n.literal(`shared-fs`))),rehydration:n.optional(n.boolean()),mediaMaxMb:n.optional(n.number()),inboundAgentMount:n.optional(n.string()),outboundAgentMount:n.optional(n.string()),promptInjections:n.optional(n.record(n.string(),n.object({enabled:n.optional(n.boolean()),template:n.optional(n.string())})))});var g={mediaMode:`gateway-http`,inboundMediaMode:`inline`,rehydration:!0,mediaMaxMb:1024,inboundAgentMount:`/home/node/.openclaw/media/inbound`,outboundAgentMount:`/home/node/.openclaw/media/outbound`};function _(e){let t={};for(let n of l){let r=e?.[n];t[n]={enabled:r?.enabled??!0,template:typeof r?.template==`string`&&r.template.length>0?r.template:c[n].defaultTemplate}}return t}function v(e){let t={};for(let n of l){let r=c[n],i=e[n];if(!i)continue;let a={};r.togglable&&i.enabled===!1&&(a.enabled=!1);let o=i.template.trim();o.length>0&&o!==r.defaultTemplate&&(a.template=o),(a.enabled!==void 0||a.template!==void 0)&&(t[n]=a)}return t}function y(e){return{mediaMode:e.mediaMode??g.mediaMode,inboundMediaMode:e.inboundMediaMode??g.inboundMediaMode,rehydration:e.rehydration??g.rehydration,mediaMaxMb:e.mediaMaxMb??g.mediaMaxMb,inboundAgentMount:e.inboundAgentMount??g.inboundAgentMount,outboundAgentMount:e.outboundAgentMount??g.outboundAgentMount,promptInjections:_(e.promptInjections)}}function b(e,t){let n={},r=r=>{(e[r]!==g[r]||t[r]!==void 0)&&(n[r]=e[r])};r(`mediaMode`),r(`inboundMediaMode`),r(`rehydration`),r(`mediaMaxMb`),r(`inboundAgentMount`),r(`outboundAgentMount`);let i=v(e.promptInjections);return Object.keys(i).length>0&&(n.promptInjections=i),n}var x=e();function S({text:e}){return(0,x.jsx)(i,{delayDuration:150,children:(0,x.jsxs)(a,{children:[(0,x.jsx)(o,{asChild:!0,children:(0,x.jsx)(`button`,{type:`button`,className:`oc-field__help`,"aria-label":e,onClick:e=>e.preventDefault(),children:(0,x.jsx)(s,{"aria-hidden":!0})})}),(0,x.jsx)(r,{className:`max-w-xs text-pretty`,children:e})]})})}function C({label:e,help:t}){return(0,x.jsxs)(`span`,{className:`oc-field__label`,children:[e,(0,x.jsx)(S,{text:t})]})}export{h as a,m as c,u as d,d as f,y as i,c as l,C as n,p as o,b as r,f as s,S as t,l as u};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{AC as ee,BC as r,CC as i,DC as a,EC as o,FC as s,GC as te,Gw as c,HC as ne,IC as l,JC as u,KC as d,LC as f,MC as re,NC as p,OC as ie,PC as m,Qw as ae,RC as h,SC as oe,TC as se,UC as ce,VC as le,WC as ue,XC as de,YC as fe,Zw as pe,_C as me,bC as he,bw as ge,gC as _e,hC as ve,jC as ye,kC as be,qC as g,uy as _,vC as v,vw as y,wC as b,xC as x,yC as S,zC as C}from"./dist-Cci6Ggjl.js";import{t as w}from"./button-nO0gX-NR.js";import{A as T,B as E,F as D,G as O,I as k,K as A,L as j,N as M,P as N,R as xe,Tt as P,W as Se,X as Ce,Y as we,_ as F,b as I,ht as Te,v as L,wt as Ee,x as R,y as z,yt as De,z as Oe}from"./index-C6XDcLXH.js";import{a as ke,i as B,n as Ae,o as V,r as H,t as je}from"./table-CQttJ0e5.js";var U=t(e(),1),W=n(),G=`all`;function K(e){switch(e){case`image`:return C();case`audio`:return h();case`video`:return f();case`pdf`:return l();case`document`:return s();case`archive`:return m();default:return p()}}function q(){let[e,t]=(0,U.useState)(G),[n,s]=(0,U.useState)(G),[l,f]=(0,U.useState)(G),[p,m]=(0,U.useState)(G),[h,C]=(0,U.useState)(null),q=pe(c.files.softDelete),J=T();function Me(){t(G),s(G),f(G),m(G)}async function Ne(){let e=h;if(C(null),e)try{await q({fileId:e.id}),J.success(oe())}catch(e){J.error(x(),e)}}let Y=ae(c.files.listMine,{direction:e===G?void 0:e,chatId:n===G?void 0:n,instanceName:l===G?void 0:l,category:p===G?void 0:p}),X=(0,U.useMemo)(()=>new Intl.DateTimeFormat(ge(),{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||l!==G||p!==G;return(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`p`,{className:`oc-admin__hint`,children:de()}),(0,W.jsxs)(`div`,{className:`oc-files__filters`,style:{display:`flex`,flexWrap:`wrap`,gap:8,margin:`12px 0`},children:[(0,W.jsxs)(F,{value:e,onValueChange:t,children:[(0,W.jsx)(I,{size:`sm`,"aria-label":fe(),children:(0,W.jsx)(R,{})}),(0,W.jsxs)(L,{children:[(0,W.jsx)(z,{value:G,children:u()}),(0,W.jsx)(z,{value:`inbound`,children:g()}),(0,W.jsx)(z,{value:`outbound`,children:d()})]})]}),(0,W.jsxs)(F,{value:n,onValueChange:s,children:[(0,W.jsx)(I,{size:`sm`,"aria-label":te(),children:(0,W.jsx)(R,{})}),(0,W.jsxs)(L,{children:[(0,W.jsx)(z,{value:G,children:ue()}),Q.chats.map(e=>(0,W.jsx)(z,{value:e.id,children:e.title},e.id))]})]}),Q.multiProvider?(0,W.jsxs)(F,{value:l,onValueChange:f,children:[(0,W.jsx)(I,{size:`sm`,"aria-label":ce(),children:(0,W.jsx)(R,{})}),(0,W.jsxs)(L,{children:[(0,W.jsx)(z,{value:G,children:ne()}),Q.instances.map(e=>(0,W.jsx)(z,{value:e,children:e},e))]})]}):null,(0,W.jsxs)(F,{value:p,onValueChange:m,children:[(0,W.jsx)(I,{size:`sm`,"aria-label":le(),children:(0,W.jsx)(R,{})}),(0,W.jsxs)(L,{children:[(0,W.jsx)(z,{value:G,children:r()}),Q.categories.map(e=>(0,W.jsx)(z,{value:e,children:K(e)},e))]})]}),$?(0,W.jsxs)(w,{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}),se()]}):null]}),Z.length===0?(0,W.jsx)(`p`,{className:`oc-admin__hint`,children:$?_e():me()}):(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:re()}),(0,W.jsx)(B,{children:ye()}),(0,W.jsx)(B,{children:ee()}),(0,W.jsx)(B,{children:be()}),(0,W.jsx)(B,{children:ie()}),(0,W.jsx)(B,{className:`text-right`,children:a()})]})}),(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)(Ce,{variant:`secondary`,children:e.direction===`inbound`?g():d()})}),(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)(Se,{children:[(0,W.jsx)(we,{asChild:!0,children:(0,W.jsx)(w,{variant:`ghost`,size:`icon`,"aria-label":b(),children:(0,W.jsx)(Ee,{size:16})})}),(0,W.jsxs)(O,{align:`end`,children:[e.url?(0,W.jsx)(A,{asChild:!0,children:(0,W.jsxs)(`a`,{href:e.url,download:e.filename,target:`_blank`,rel:`noopener noreferrer`,children:[(0,W.jsx)(P,{size:14}),o()]})}):(0,W.jsxs)(A,{disabled:!0,children:[(0,W.jsx)(P,{size:14}),v()]}),(0,W.jsxs)(A,{variant:`destructive`,onSelect:()=>C({id:e._id,filename:e.filename}),children:[(0,W.jsx)(Te,{size:14}),i()]})]})]})})]},e._id))})]}),Pe?(0,W.jsx)(`p`,{className:`oc-admin__hint`,style:{marginTop:8},children:ve({cap:Fe})}):null]}),(0,W.jsx)(M,{open:h!==null,onOpenChange:e=>!e&&C(null),children:(0,W.jsxs)(k,{children:[(0,W.jsxs)(Oe,{children:[(0,W.jsx)(E,{children:he()}),(0,W.jsx)(j,{children:S()})]}),(0,W.jsxs)(xe,{children:[(0,W.jsx)(D,{children:_()}),(0,W.jsx)(N,{onClick:()=>void Ne(),children:i()})]})]})})]})}export{q as FilesTab};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{fa as r,pa as i}from"./dist-Cci6Ggjl.js";import{t as a}from"./TimeRangePicker-BP0hPL2e.js";import{t as o}from"./button-nO0gX-NR.js";import{Z as s,vt as c,yt as l}from"./index-C6XDcLXH.js";var u=t(e(),1),d=n(),f=250;function p({q:e,onQChange:t,searchPlaceholder:n=i(),children:p,timeRange:m,onTimeRangeChange:h,onReset:g,canReset:_=!0}){let[v,y]=(0,u.useState)(e);(0,u.useEffect)(()=>{y(e)},[e]);let b=(0,u.useRef)(null);function x(e){y(e),b.current!==null&&window.clearTimeout(b.current),b.current=window.setTimeout(()=>t(e),f)}(0,u.useEffect)(()=>()=>{b.current!==null&&window.clearTimeout(b.current)},[]);function S(){b.current!==null&&window.clearTimeout(b.current),g()}return(0,d.jsxs)(`div`,{className:`oc-filterbar`,children:[(0,d.jsxs)(`div`,{className:`oc-filterbar__search`,children:[(0,d.jsx)(c,{className:`oc-filterbar__search-icon`,"aria-hidden":!0}),(0,d.jsx)(s,{value:v,onChange:e=>x(e.target.value),placeholder:n,"aria-label":n})]}),p?(0,d.jsx)(`div`,{className:`oc-filterbar__quick`,children:p}):null,m&&h?(0,d.jsx)(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,{}),r()]})]})}export{p as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$n as r,An as i,Bn as a,Cn as o,Cr as s,Dn as c,Dr as l,En as u,Er as d,Fn as f,Gn as p,Gw as m,Hn as h,In as g,Jn as _,Kn as v,Kw as y,Ln as b,Mn as x,Nn as S,On as C,Pn as ee,Qn as w,Qw as T,Rn as te,Sn as E,Sr as D,Tn as ne,Tr as O,Un as k,Vn as re,Wn as A,Xn as j,Yn as ie,Zn as ae,Zw as M,_r as N,ar as oe,bn as P,br as se,cr as F,dr as I,er as ce,fr as le,gr as L,hr as R,ir as ue,jn as de,kn as fe,lr as pe,mr as me,nr as he,or as ge,pr as _e,qn as ve,rr as ye,sr as be,tr as xe,ur as Se,vn as Ce,vr as we,wn as Te,wr as Ee,xn as De,xr as Oe,yn as ke,yr as Ae,zn as je}from"./dist-Cci6Ggjl.js";import{t as Me}from"./x-VwKg9NoU.js";import{i as z,n as B,r as Ne,t as Pe}from"./tabs-D-DUf5Yr.js";import{t as V}from"./button-nO0gX-NR.js";import{$ as Fe,A as H,E as U,Ot as Ie,Q as Le,X as W,Z as G,_ as Re,_t as K,b as ze,et as Be,gt as q,j as Ve,m as He,nt as Ue,ot as We,rt as Ge,v as Ke,x as qe,y as Je}from"./index-C6XDcLXH.js";import{t as Ye}from"./FilterBar-RytfYInF.js";import{t as Xe}from"./DataTableShell-B44W_69s.js";import{t as J}from"./DetailChips-SZr2PERg.js";var Ze=y(`chevron-left`,[[`path`,{d:`m15 18-6-6 6-6`,key:`1wnfg3`}]]),Qe=y(`palette`,[[`path`,{d:`M12 22a1 1 0 0 1 0-20 10 9 0 0 1 10 9 5 5 0 0 1-5 5h-2.25a1.75 1.75 0 0 0-1.4 2.8l.3.4a1.75 1.75 0 0 1-1.4 2.8z`,key:`e79jfc`}],[`circle`,{cx:`13.5`,cy:`6.5`,r:`.5`,fill:`currentColor`,key:`1okk4w`}],[`circle`,{cx:`17.5`,cy:`10.5`,r:`.5`,fill:`currentColor`,key:`f64h9f`}],[`circle`,{cx:`6.5`,cy:`12.5`,r:`.5`,fill:`currentColor`,key:`qy21gx`}],[`circle`,{cx:`8.5`,cy:`7.5`,r:`.5`,fill:`currentColor`,key:`fotxhn`}]]),Y=y(`shield-check`,[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`,key:`oel41y`}],[`path`,{d:`m9 12 2 2 4-4`,key:`dzmm74`}]]),$e=y(`users`,[[`path`,{d:`M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2`,key:`1yyitq`}],[`path`,{d:`M16 3.128a4 4 0 0 1 0 7.744`,key:`16gr8j`}],[`path`,{d:`M22 21v-2a4 4 0 0 0-3-3.87`,key:`kshegd`}],[`circle`,{cx:`9`,cy:`7`,r:`4`,key:`nufk8`}]]),X=t(e(),1);function et(e,t,n){let r=t.trim().toLowerCase();return[...r?e.filter(e=>[e.email,e.name,e.canonical].some(e=>e!=null&&e.toLowerCase().includes(r))):e.slice()].sort((e,t)=>!n.has(e.userId)-+!n.has(t.userId))}function tt(e,t){let n=e.filter(e=>e.source===`discovered`),r=t.trim().toLowerCase();return r?n.filter(e=>(e.displayName??e.agentId).toLowerCase().includes(r)||e.agentId.toLowerCase().includes(r)):n}function nt(e){let t=e.name?.trim()??``,n=e.email?.trim()??``,r=e.canonical?.trim()||`u-${e.userId.slice(0,8)}`;return t?{primary:t,secondary:n||`@${r}`}:n?{primary:n,secondary:null}:{primary:`@${r}`,secondary:null}}function rt(e){switch(e){case`admin`:return _();case`user`:return ve();case`pending`:return v();default:return e}}function Z(e,t){if(e.length===0)return`none`;let n=0;for(let r of e)t(r)&&n++;return n===0?`none`:n===e.length?`all`:`some`}function it(e,t,n){let r=Math.max(1,Math.ceil(e.length/n)),i=Math.min(Math.max(1,Math.floor(t)),r),a=(i-1)*n;return{pageItems:e.slice(a,a+n),page:i,pageCount:r}}var Q=n(),$={name:``,description:``};function at(){let e=T(m.groups.listGroups,{}),t=T(m.me.getMe,{host:We})?.role===`admin`,n=M(m.groups.createGroup),r=M(m.groups.updateGroup),i=M(m.groups.deleteGroup),a=Ve(),o=H(),[c,u]=(0,X.useState)(!1),[f,p]=(0,X.useState)(null),[h,g]=(0,X.useState)($),[_,v]=(0,X.useState)(null),[y,b]=(0,X.useState)(``),x=(0,X.useMemo)(()=>{if(!e)return e;let t=y.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,y]);function S(){p(null),g($),u(!0)}function C(e){p(e),g({name:e.name,description:e.description??``}),u(!0)}async function ee(){try{f?await r({groupId:f._id,name:h.name,description:h.description}):await n({name:h.name,description:h.description||void 0}),g($),p(null),u(!1)}catch(e){o.error(De(),e)}}async function w(e){if(await a({title:F({name:e.name}),description:be(),confirmWord:e.name,confirmLabel:ge(),cancelLabel:me(),destructive:!0}))try{await i({groupId:e._id})}catch(e){o.error(P(),e)}}return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:d()}),(0,Q.jsx)(Ye,{q:y,onQChange:b,onReset:()=>b(``),canReset:y!==``,searchPlaceholder:Ae()}),(0,Q.jsx)(Xe,{title:l(),rows:x,addLabel:O(),onAdd:t?S:void 0,emptyHint:Ee(),columns:[{header:s(),cell:e=>e.name,sort:e=>e.name},{header:D(),cell:e=>(0,Q.jsx)(J,{icon:(0,Q.jsx)($e,{size:12,"aria-hidden":!0}),total:e.memberCount,items:e.members.map(e=>({label:e.label,marker:e.manager?(0,Q.jsx)(Y,{size:11,"aria-hidden":!0}):null,highlight:e.manager}))}),sort:e=>e.memberCount},{header:Oe(),cell:e=>(0,Q.jsx)(J,{icon:(0,Q.jsx)(K,{size:12,"aria-hidden":!0}),total:e.agentCount,items:e.agents.map(e=>({label:e}))}),sort:e=>e.agentCount},{header:se(),cell:e=>(0,Q.jsx)(J,{icon:(0,Q.jsx)(Qe,{size:12,"aria-hidden":!0}),total:e.chartCount,items:e.charts.map(e=>({label:e.name,marker:e.isDefault?(0,Q.jsx)(q,{size:11,fill:`currentColor`,"aria-hidden":!0}):null,highlight:e.isDefault}))}),sort:e=>e.chartCount}],rowActions:e=>[{label:we(),onSelect:()=>v({groupId:e._id,name:e.name})},...t?[{label:N(),onSelect:()=>C(e)},{label:L(),variant:`destructive`,onSelect:()=>void w(e)}]:[]]}),(0,Q.jsx)(He,{open:c,onOpenChange:u,title:f?le():_e(),description:I(),canSubmit:!!h.name.trim(),onSubmit:ee,submitLabel:R(),children:(0,Q.jsxs)(`div`,{className:`oc-form`,children:[(0,Q.jsxs)(`label`,{className:`oc-field`,children:[(0,Q.jsx)(`span`,{className:`oc-field__label`,children:Se()}),(0,Q.jsx)(G,{value:h.name,onChange:e=>g({...h,name:e.target.value})})]}),(0,Q.jsxs)(`label`,{className:`oc-field`,children:[(0,Q.jsx)(`span`,{className:`oc-field__label`,children:pe()}),(0,Q.jsx)(G,{value:h.description,onChange:e=>g({...h,description:e.target.value})})]})]})}),(0,Q.jsx)(ct,{groupId:_?.groupId??null,groupName:_?.name??``,open:_!==null,onOpenChange:e=>{e||v(null)}})]})}var ot=8;function st({page:e,pageCount:t,onPage:n}){return t<=1?null:(0,Q.jsxs)(`div`,{className:`oc-access__pager`,children:[(0,Q.jsxs)(V,{type:`button`,variant:`ghost`,size:`sm`,disabled:e<=1,onClick:()=>n(e-1),children:[(0,Q.jsx)(Ze,{size:14,"aria-hidden":!0}),ae()]}),(0,Q.jsxs)(`span`,{className:`oc-access__pageinfo`,"aria-label":ie({page:e,pages:t}),children:[e,` / `,t]}),(0,Q.jsxs)(V,{type:`button`,variant:`ghost`,size:`sm`,disabled:e>=t,onClick:()=>n(e+1),children:[j(),(0,Q.jsx)(Ie,{size:14,"aria-hidden":!0})]})]})}function ct({groupId:e,groupName:t,open:n,onOpenChange:i}){let s=T(m.groups.getGroup,n&&e?{groupId:e}:`skip`),c=T(m.groups.listAssignableInstances,n?{}:`skip`),l=T(m.groups.listAssignableUsers,n?{}:`skip`),d=M(m.groups.addMember),f=M(m.groups.removeMember),h=M(m.groups.bulkSetMembers),g=M(m.groups.setGroupManager),_=H(),[v,y]=(0,X.useState)(``),[b,x]=(0,X.useState)(``),[S,C]=(0,X.useState)(`members`),[te,E]=(0,X.useState)(1),[D,O]=(0,X.useState)(new Set),A=(0,X.useRef)(null),j=(0,X.useMemo)(()=>new Set((s?.members??[]).map(e=>e.userId)),[s]),ie=(0,X.useMemo)(()=>new Set((s?.members??[]).filter(e=>e.manager).map(e=>e.userId)),[s]),ae=s?.viewerIsAdmin===!0,N=(0,X.useMemo)(()=>new Set((s?.agents??[]).map(e=>`${e.instanceName}/${e.agentId}`)),[s]);(0,X.useEffect)(()=>{y(``),x(``),C(`members`),E(1),A.current=null},[n,e]),(0,X.useEffect)(()=>{E(1)},[v]),(0,X.useEffect)(()=>{n&&s&&e&&A.current!==e&&(A.current=e,O(new Set((s.members??[]).map(e=>e.userId))))},[n,s,e]);let P=(0,X.useMemo)(()=>l?et(l,v,D):[],[l,v,D]);async function se(t,n){if(e)try{n?await f({groupId:e,userId:t}):await d({groupId:e,userId:t})}catch(e){_.error(ke(),e)}}async function F(t,n){if(e)try{await g({groupId:e,userId:t,manager:!n})}catch(e){_.error(o(),e)}}let I=Z(P,e=>j.has(e.userId)),le=P.filter(e=>j.has(e.userId)).length,L=it(P,te,ot);async function R(){if(!e||P.length===0)return;let t=P.map(e=>e.userId);try{await h({groupId:e,userIds:t,member:I!==`all`})}catch(e){_.error(ke(),e)}}return(0,Q.jsx)(Le,{open:n,onOpenChange:i,children:(0,Q.jsxs)(Fe,{className:`oc-access`,children:[(0,Q.jsxs)(Ue,{children:[(0,Q.jsx)(Ge,{children:oe({name:t})}),(0,Q.jsx)(Be,{children:ue()})]}),(0,Q.jsxs)(Pe,{value:S,onValueChange:C,className:`oc-access__tabs`,children:[(0,Q.jsxs)(Ne,{className:`w-full`,children:[(0,Q.jsxs)(z,{value:`members`,className:`flex-1 gap-1.5`,children:[(0,Q.jsx)($e,{size:13,"aria-hidden":!0}),ye(),s?(0,Q.jsx)(W,{variant:`secondary`,className:`oc-access__tabcount`,children:j.size}):null]}),(0,Q.jsxs)(z,{value:`agents`,className:`flex-1 gap-1.5`,children:[(0,Q.jsx)(K,{size:13,"aria-hidden":!0}),xe(),s?(0,Q.jsx)(W,{variant:`secondary`,className:`oc-access__tabcount`,children:N.size}):null]}),(0,Q.jsxs)(z,{value:`charts`,className:`flex-1 gap-1.5`,children:[(0,Q.jsx)(Qe,{size:13,"aria-hidden":!0}),ee(),s?(0,Q.jsx)(W,{variant:`secondary`,className:`oc-access__tabcount`,children:s.chartCount}):null]})]}),(0,Q.jsx)(B,{value:`members`,children:l===void 0||s===void 0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:k()}):l.length===0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:re()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(G,{value:v,onChange:e=>y(e.target.value),placeholder:he(),className:`oc-access__search`}),P.length===0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:r()}):(0,Q.jsxs)(Q.Fragment,{children:[P.length>1?(0,Q.jsxs)(`div`,{className:`oc-access__row oc-access__selectall`,children:[(0,Q.jsx)(U,{checked:I===`all`?!0:I===`some`?`indeterminate`:!1,onCheckedChange:()=>void R(),"aria-label":w()}),(0,Q.jsx)(`span`,{className:`oc-access__label`,children:w()}),(0,Q.jsxs)(W,{variant:`outline`,className:`oc-access__count`,children:[le,` / `,P.length]})]}):null,(0,Q.jsx)(`div`,{className:`oc-access__list`,children:L.pageItems.map(e=>{let t=j.has(e.userId),n=nt(e),r=ie.has(e.userId);return(0,Q.jsxs)(`div`,{className:`oc-access__row`,children:[(0,Q.jsx)(U,{checked:t,onCheckedChange:()=>void se(e.userId,t),"aria-label":p({user:n.primary})}),(0,Q.jsxs)(`span`,{className:`oc-access__who`,children:[(0,Q.jsx)(`span`,{className:`oc-access__label`,title:n.primary,children:n.primary}),n.secondary?(0,Q.jsx)(`span`,{className:`oc-access__sub`,title:n.secondary,children:n.secondary}):null]}),(0,Q.jsx)(W,{variant:`outline`,className:`oc-access__role`,children:rt(e.role)}),(0,Q.jsx)(`span`,{className:`oc-access__mgrslot`,children:t&&ae?(0,Q.jsx)(V,{type:`button`,variant:`ghost`,size:`icon`,className:`shrink-0 oc-access__mgr${r?` oc-access__mgr--on`:``}`,"aria-pressed":r,"aria-label":r?Te():ne(),title:r?Te():ne(),onClick:()=>void F(e.userId,r),children:(0,Q.jsx)(Y,{size:15,"aria-hidden":!0})}):t&&r?(0,Q.jsx)(`span`,{className:`oc-access__mgr oc-access__mgr--on`,role:`img`,"aria-label":u(),title:u(),children:(0,Q.jsx)(Y,{size:15,"aria-hidden":!0})}):null})]},e._id)})}),(0,Q.jsx)(st,{page:L.page,pageCount:L.pageCount,onPage:E})]})]})}),(0,Q.jsx)(B,{value:`agents`,children:c===void 0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:k()}):c.length===0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:a()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(G,{value:b,onChange:e=>x(e.target.value),placeholder:ce(),className:`oc-access__search`}),(0,Q.jsx)(`div`,{className:`oc-access__list`,children:c.map(t=>(0,Q.jsx)(lt,{groupId:e,instanceName:t.name,kind:t.kind??`openclaw`,assigned:N,query:b},`${e}-${t._id}`))})]})}),(0,Q.jsx)(B,{value:`charts`,children:(0,Q.jsx)(ut,{groupId:e})})]})]})})}function lt({groupId:e,instanceName:t,kind:n,assigned:r,query:i}){let a=T(m.groups.listAssignableAgents,{instanceName:t}),o=M(m.groups.assignAgentToGroup),s=M(m.groups.removeAgentFromGroup),c=M(m.groups.bulkSetGroupAgents),l=H(),[u,d]=(0,X.useState)(1);if((0,X.useEffect)(()=>{d(1)},[i]),!e)return null;let p=tt(a?.agents??[],i),_=a?.discovery&&!a.discovery.lastPollOk;if(i.trim()&&p.length===0)return null;let v=p.filter(e=>e.presentInLastOk!==!1),y=Z(v,e=>r.has(`${t}/${e.agentId}`)),x=it(p,u,ot);async function S(n,r){try{r?await s({groupId:e,instanceName:t,agentId:n}):await o({groupId:e,instanceName:t,agentId:n})}catch(e){l.error(Ce(),e)}}async function C(){if(v.length===0)return;let n=v.map(e=>e.agentId);try{await c({groupId:e,instanceName:t,agentIds:n,assigned:y!==`all`})}catch(e){l.error(Ce(),e)}}return(0,Q.jsxs)(`div`,{className:`oc-access__group`,children:[(0,Q.jsxs)(`div`,{className:`oc-access__instance`,children:[(0,Q.jsx)(K,{size:13,"aria-hidden":!0}),(0,Q.jsx)(`span`,{children:t}),(0,Q.jsx)(W,{variant:`outline`,className:`oc-access__kind`,children:n}),_?(0,Q.jsx)(W,{variant:`outline`,className:`oc-access__stale`,children:b()}):null]}),a===void 0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:h()}):p.length===0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:_?te():je()}):(0,Q.jsxs)(Q.Fragment,{children:[v.length>1?(0,Q.jsxs)(`div`,{className:`oc-access__row oc-access__selectall`,children:[(0,Q.jsx)(U,{checked:y===`all`?!0:y===`some`?`indeterminate`:!1,onCheckedChange:()=>void C(),"aria-label":w()}),(0,Q.jsx)(`span`,{className:`oc-access__label`,children:w()})]}):null,x.pageItems.map(e=>{let n=`${t}/${e.agentId}`,i=r.has(n),a=e.presentInLastOk===!1;return(0,Q.jsxs)(`div`,{className:`oc-access__row`,children:[(0,Q.jsx)(U,{checked:i,disabled:a&&!i,onCheckedChange:()=>void S(e.agentId,i),"aria-label":A({name:e.displayName??e.agentId})}),(0,Q.jsxs)(`span`,{className:`oc-access__label`,title:e.displayName??e.agentId,children:[e.emoji?`${e.emoji} `:``,e.displayName??e.agentId]}),e.model?(0,Q.jsx)(`span`,{className:`oc-access__model`,children:e.model}):null,e.isDefaultOnInstance?(0,Q.jsx)(`span`,{className:`oc-access__fav`,role:`img`,"aria-label":f(),title:f(),children:(0,Q.jsx)(q,{size:14,fill:`currentColor`})}):null,a?(0,Q.jsx)(W,{variant:`outline`,className:`oc-access__gone`,children:g()}):null]},e.agentId)}),(0,Q.jsx)(st,{page:x.page,pageCount:x.pageCount,onPage:d})]})]})}function ut({groupId:e}){let t=T(m.charts.listGroupChartSelection,e?{groupId:e}:`skip`),n=M(m.charts.assignChartToGroup),r=M(m.charts.removeChartFromGroup),a=M(m.charts.setGroupDefaultChart),o=M(m.charts.addChartToGroupPool),s=M(m.charts.removeChartFromGroupPool),l=H();if(!e)return null;if(t===void 0)return(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:k()});let{pool:u,addable:d,canManagePool:f}=t;if(u.length===0&&!f)return(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:S()});async function p(t,i){try{i?await r({groupId:e,chartKey:t}):await n({groupId:e,chartKey:t})}catch(e){l.error(E(),e)}}async function h(t){try{await a({groupId:e,chartKey:t})}catch(e){l.error(E(),e)}}async function g(t){try{await o({groupId:e,chartKey:t})}catch(e){l.error(E(),e)}}async function _(t){try{await s({groupId:e,chartKey:t})}catch(e){l.error(E(),e)}}return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`div`,{className:`oc-access__list`,children:u.map(e=>(0,Q.jsxs)(`div`,{className:`oc-access__row`,children:[(0,Q.jsx)(U,{checked:e.selected,onCheckedChange:()=>void p(e.chartKey,e.selected),"aria-label":fe({name:e.name})}),(0,Q.jsx)(`span`,{className:`oc-access__label`,title:e.name,children:e.name}),e.selected?e.isDefault?(0,Q.jsx)(`span`,{className:`oc-access__fav`,role:`img`,"aria-label":C(),title:C(),children:(0,Q.jsx)(q,{size:14,fill:`currentColor`})}):(0,Q.jsx)(V,{type:`button`,variant:`ghost`,size:`sm`,onClick:()=>void h(e.chartKey),children:c()}):null,f?(0,Q.jsx)(V,{type:`button`,variant:`ghost`,size:`sm`,"aria-label":i({name:e.name}),title:i({name:e.name}),onClick:()=>void _(e.chartKey),children:(0,Q.jsx)(Me,{size:14,"aria-hidden":!0})}):null]},e.chartKey))}),f?d.length>0?(0,Q.jsxs)(Re,{value:``,onValueChange:e=>void g(e),children:[(0,Q.jsx)(ze,{size:`sm`,className:`oc-access__search`,children:(0,Q.jsx)(qe,{placeholder:de()})}),(0,Q.jsx)(Ke,{children:d.map(e=>(0,Q.jsx)(Je,{value:e.chartKey,children:e.name},e.chartKey))})]}):u.length===0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:x()}):null:null]})}export{at as GroupsTab};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$f as r,$p as i,$y as a,Ap as o,Bf as s,Bp as c,Cp as l,Dp as u,Ep as d,Ff as f,Fp as p,Gf as m,Gp as h,Gw as g,Hf as _,Hp as v,If as y,Ip as b,Jf as x,Jp as S,Kf as C,Kp as w,Lf as T,Lp as ee,Mc as te,Mp as ne,Np as re,Op as ie,Pp as ae,Qf as oe,Qp as E,Qw as D,Qy as O,Rf as k,Rp as A,Sp as se,Tp as ce,Uf as le,Up as ue,Vf as de,Vp as fe,Wf as pe,Wp as me,Xf as he,Xp as ge,Yf as _e,Yp as ve,Yw as j,Zf as ye,Zp as be,Zw as M,_m as xe,_p as Se,am as Ce,ap as we,bm as Te,bp as Ee,cm as De,cp as Oe,dm as ke,dp as Ae,em as je,ep as Me,fm as Ne,fp as Pe,gm as Fe,gp as Ie,hm as Le,hp as Re,im as ze,ip as Be,jc as Ve,jp as He,kp as Ue,lm as We,lp as Ge,mm as Ke,mp as qe,nm as Je,np as N,om as Ye,op as Xe,pm as Ze,pp as Qe,qf as $e,qp as et,rm as tt,rp as nt,sm as rt,sp as it,tm as at,tp as ot,um as st,up as ct,vm as lt,vp as ut,wp as dt,xm as ft,xp as pt,ym as mt,yp as ht,zf as gt,zp as _t}from"./dist-Cci6Ggjl.js";import{a as vt,c as yt}from"./FieldLabel-Dn9ltnAG.js";import{t as P}from"./button-nO0gX-NR.js";import{$ as F,A as I,E as L,H as bt,Q as R,U as xt,V as St,X as z,Z as B,_ as V,b as H,et as U,j as Ct,m as wt,nt as W,rt as G,v as K,x as q,y as J}from"./index-C6XDcLXH.js";import{t as Tt}from"./DataTableShell-B44W_69s.js";import{InstanceConfigDialog as Et}from"./BridgeTab-BWExnIBq.js";var Y=t(e(),1),X=[`conversational`,`documentary`],Dt=new Set(X),Ot=`conversational`;function kt(e){let t=new Set((e??[]).filter(e=>Dt.has(e)));return t.size===0?[Ot]:X.filter(e=>t.has(e))}var Z=n(),Q={name:``,gatewayUrl:``,bridgeUrl:``,displayName:``,kind:`openclaw`,gatewayVersion:``,gatewayHttpUrl:``,streamTransport:vt},At={openclaw:[`token`,`deviceIdentity`],hermes:[`apiKey`]};function jt(e){return{name:e.name,gatewayUrl:e.gatewayUrl,bridgeUrl:e.bridgeUrl??``,displayName:e.displayName??``,kind:e.kind??`openclaw`,gatewayVersion:e.gatewayVersion??``,gatewayHttpUrl:e.gatewayHttpUrl??``,streamTransport:e.streamTransport??`reactive`}}function Mt(){let e=D(g.admin.listInstances,{}),t=D(g.agents.listAllInstanceAgents,{}),n=M(g.admin.upsertInstance),r=M(g.admin.deleteInstance),a=I(),[o,s]=(0,Y.useState)(!1),[c,l]=(0,Y.useState)(Q),[u,d]=(0,Y.useState)(null),[f,p]=(0,Y.useState)(null),[m,_]=(0,Y.useState)(null),[v,b]=(0,Y.useState)(null);async function x(){try{await n({instanceId:v??void 0,name:c.name,gatewayUrl:c.gatewayUrl,bridgeUrl:c.bridgeUrl||void 0,displayName:c.displayName||void 0,kind:c.kind,gatewayVersion:c.gatewayVersion||void 0,gatewayHttpUrl:c.gatewayHttpUrl||void 0,streamTransport:c.streamTransport}),l(Q),b(null),s(!1)}catch(e){a.error(mt(),e)}}return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`p`,{className:`oc-admin__hint`,children:[lt(),(0,Z.jsx)(`strong`,{children:xe()}),Fe()]}),(0,Z.jsx)(Tt,{title:Le(),rows:e,addLabel:Ke(),onAdd:()=>{b(null),l(Q),s(!0)},emptyHint:Ze(),columns:[{header:Ne(),cell:e=>e.name,sort:e=>e.name},{header:ke(),cell:e=>(0,Z.jsx)(z,{variant:`outline`,children:e.kind??`openclaw`}),sort:e=>e.kind??`openclaw`},{header:st(),cell:e=>e.gatewayUrl,sort:e=>e.gatewayUrl},{header:We(),cell:e=>e.displayName??`—`,sort:e=>e.displayName??null},{header:ft(),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)(z,{variant:r(e.agentId)?`default`:`outline`,title:r(e.agentId)?y():void 0,children:[e.emoji?`${e.emoji} `:``,e.displayName??e.agentId]},e.agentId))})}}],rowActions:e=>[{label:Ce(),onSelect:()=>{b(e._id),l(jt(e)),s(!0)}},{label:Te(),onSelect:()=>d(e.name)},{label:me(),onSelect:()=>_(e)},{label:De(),onSelect:()=>p(e)},{label:rt(),variant:`destructive`,onSelect:()=>void r({instanceId:e._id})}],bulkActions:[{label:rt(),variant:`destructive`,onSelect:e=>e.forEach(e=>void r({instanceId:e}))}]}),(0,Z.jsx)(wt,{open:o,onOpenChange:s,title:v?ze():Ye(),description:Je(),canSubmit:!!(c.name&&c.gatewayUrl),onSubmit:x,submitLabel:at(),children:(0,Z.jsxs)(`div`,{className:`oc-form`,children:[(0,Z.jsxs)($,{label:je(),children:[(0,Z.jsx)(B,{value:c.name,disabled:v!==null,onChange:e=>l({...c,name:e.target.value})}),v?(0,Z.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:tt()}):null]}),(0,Z.jsx)($,{label:i(),children:(0,Z.jsxs)(V,{value:c.kind,onValueChange:e=>l({...c,kind:e}),children:[(0,Z.jsx)(H,{size:`sm`,className:`w-40`,children:(0,Z.jsx)(q,{})}),(0,Z.jsxs)(K,{children:[(0,Z.jsx)(J,{value:`openclaw`,children:`OpenClaw`}),(0,Z.jsx)(J,{value:`hermes`,children:`Hermes`})]})]})}),(0,Z.jsx)($,{label:E(),children:(0,Z.jsx)(B,{value:c.gatewayUrl,onChange:e=>l({...c,gatewayUrl:e.target.value})})}),(0,Z.jsx)($,{label:be(),children:(0,Z.jsx)(B,{value:c.bridgeUrl,placeholder:ge(),onChange:e=>l({...c,bridgeUrl:e.target.value})})}),(0,Z.jsx)($,{label:ve(),children:(0,Z.jsx)(B,{value:c.displayName,onChange:e=>l({...c,displayName:e.target.value})})}),(0,Z.jsxs)($,{label:te(),children:[(0,Z.jsxs)(V,{value:c.streamTransport,onValueChange:e=>l({...c,streamTransport:e}),children:[(0,Z.jsx)(H,{size:`sm`,className:`w-40`,children:(0,Z.jsx)(q,{})}),(0,Z.jsx)(K,{children:yt.map(e=>(0,Z.jsx)(J,{value:e,children:e},e))})]}),(0,Z.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:Ve()})]}),(0,Z.jsx)($,{label:S(),children:(0,Z.jsx)(B,{value:c.gatewayVersion,placeholder:et(),onChange:e=>l({...c,gatewayVersion:e.target.value})})}),(0,Z.jsx)($,{label:w(),children:(0,Z.jsx)(B,{value:c.gatewayHttpUrl,placeholder:h(),onChange:e=>l({...c,gatewayHttpUrl:e.target.value})})})]})}),(0,Z.jsx)(Ht,{instanceName:u,open:u!==null,onOpenChange:e=>{e||d(null)}}),f?(0,Z.jsx)(Et,{instance:f,onClose:()=>p(null)},f._id):null,m?(0,Z.jsx)(Nt,{instance:m,onClose:()=>_(null)},m._id):null]})}function Nt({instance:e,onClose:t}){let n=D(g.instanceSecrets.listInstanceSecretStatus,{}),r=At[e.kind??`openclaw`],i=(0,Y.useMemo)(()=>{let t={};for(let r of n??[])r.instanceId===e._id&&(t[r.field]=r.updatedAt);return t},[n,e._id]);return(0,Z.jsx)(R,{open:!0,onOpenChange:e=>!e&&t(),children:(0,Z.jsxs)(F,{onOpenAutoFocus:e=>e.preventDefault(),children:[(0,Z.jsxs)(W,{children:[(0,Z.jsx)(G,{children:ue({instance:e.displayName??e.name})}),(0,Z.jsx)(U,{children:v()})]}),(0,Z.jsx)(`div`,{className:`oc-form`,children:r.map(t=>(0,Z.jsx)(It,{instanceId:e._id,field:t,updatedAt:i[t]??null},t))}),(0,Z.jsx)(`div`,{className:`oc-bridgesecret`,children:(0,Z.jsx)(Ft,{instance:e})}),(0,Z.jsx)(Pt,{instance:e})]})})}function Pt({instance:e}){let t=j(g.instanceSync.forceInstanceSync),n=I(),[r,i]=(0,Y.useState)(!1);async function a(){if(!r){i(!0);try{switch((await t({instanceId:e._id})).status){case`synced`:n.success(se());break;case`no_agents`:n.success(Ee());break;case`no_bridge_url`:n.error(ht());break;case`deploy_misconfigured`:n.error(ut());break;case`unauthorized`:n.error(Ie());break;case`not_served`:n.error(Re());break;default:n.error(Se());break}}catch(e){n.error(pt(),e)}finally{i(!1)}}}return(0,Z.jsxs)(`div`,{className:`oc-form`,children:[(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:qe()}),(0,Z.jsx)(`div`,{className:`flex items-center gap-2`,children:(0,Z.jsx)(P,{size:`sm`,variant:`outline`,onClick:()=>void a(),disabled:r,children:r?l():dt()})})]})}function Ft({instance:e}){let t=D(g.bridgeAuth.listBridgeAuthStatus,{}),n=j(g.bridgeAuth.mintBridgeSecret),r=M(g.bridgeAuth.revokeBridgeSecret),i=I(),[o,s]=(0,Y.useState)(!1),[c,l]=(0,Y.useState)(null),[u,d]=(0,Y.useState)(!1),f=(t??[]).find(t=>t.instanceId===e._id),p=f!==void 0;async function m(){if(!o){s(!0);try{l((await n({instanceId:e._id})).plaintext),d(!1)}catch(e){i.error(it(),e)}finally{s(!1)}}}async function h(){if(!o){s(!0);try{await r({instanceId:e._id}),l(null),i.success(Oe())}catch(e){i.error(it(),e)}finally{s(!1)}}}async function _(){if(c)try{await navigator.clipboard.writeText(c),d(!0)}catch{}}return(0,Z.jsxs)($,{label:Qe(),children:[(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:Pe()}),(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Z.jsx)(z,{variant:p?`outline`:`secondary`,children:p?`${A()} · ${f.prefix}…${f.lastFour}`:ee()}),(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(P,{size:`sm`,onClick:()=>void m(),disabled:o,children:p?ct():Ae()}),p?(0,Z.jsx)(P,{size:`sm`,variant:`destructive`,onClick:()=>void h(),disabled:o,children:Ge()}):null]})]}),c?(0,Z.jsxs)(`div`,{className:`oc-bridgesecret__reveal`,children:[(0,Z.jsx)(`p`,{className:`oc-sa__minted-warning`,children:Xe()}),(0,Z.jsxs)(`div`,{className:`oc-sa__minted-box`,children:[(0,Z.jsx)(`code`,{className:`oc-sa__minted-plain`,children:c}),(0,Z.jsx)(P,{variant:`outline`,size:`sm`,onClick:()=>void _(),children:u?a():O()})]}),(0,Z.jsx)(P,{size:`sm`,variant:`ghost`,onClick:()=>{l(null),d(!1)},children:we()})]}):null]})}function It({instanceId:e,field:t,updatedAt:n}){let r=j(g.instanceSecrets.setInstanceSecret),i=M(g.instanceSecrets.clearInstanceSecret),s=j(g.deviceIdentity.generateDeviceIdentity),l=I(),[f,m]=(0,Y.useState)(``),[h,_]=(0,Y.useState)(!1),[v,y]=(0,Y.useState)(null),[x,S]=(0,Y.useState)(!1),C=n!==null,w=t===`deviceIdentity`,T=t===`token`?fe():t===`deviceIdentity`?c():_t();async function te(){if(!(!f.trim()||h)){_(!0);try{await r({instanceId:e,field:t,plaintext:f}),m(``),y(null),S(!1),l.success(ne())}catch(e){l.error(He(),e)}finally{_(!1)}}}async function oe(){if(!h){_(!0);try{await i({instanceId:e,field:t}),y(null),S(!1),l.success(o())}catch(e){l.error(He(),e)}finally{_(!1)}}}async function E(){if(!h){_(!0);try{y(await s({instanceId:e})),S(!1),l.success(u())}catch(e){l.error(ce(),e)}finally{_(!1)}}}let D=v?`openclaw devices approve ${v.id}`:``;async function k(){if(D)try{await navigator.clipboard.writeText(D),S(!0)}catch{}}return(0,Z.jsxs)($,{label:T,children:[w?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:ie()}):null,(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Z.jsx)(z,{variant:C?`outline`:`secondary`,children:C?A():ee()}),(0,Z.jsx)(B,{type:`password`,autoComplete:`off`,className:`flex-1 min-w-32`,value:f,placeholder:C?p():b(),onChange:e=>m(e.target.value)}),(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(P,{size:`sm`,onClick:()=>void te(),disabled:h||f.trim().length===0,children:ae()}),w?(0,Z.jsx)(P,{size:`sm`,variant:`outline`,onClick:()=>void E(),disabled:h,children:Ue()}):null,C?(0,Z.jsx)(P,{size:`sm`,variant:`destructive`,onClick:()=>void oe(),disabled:h,children:re()}):null]})]}),v?(0,Z.jsxs)(`div`,{className:`oc-bridgesecret__reveal`,children:[(0,Z.jsx)(`p`,{className:`text-sm font-medium`,children:u()}),(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:d()}),(0,Z.jsxs)(`div`,{className:`oc-sa__minted-box`,children:[(0,Z.jsx)(`code`,{className:`oc-sa__minted-plain`,children:D}),(0,Z.jsx)(P,{variant:`outline`,size:`sm`,onClick:()=>void k(),children:x?a():O()})]}),(0,Z.jsx)(P,{size:`sm`,variant:`ghost`,onClick:()=>{y(null),S(!1)},children:we()})]}):null]})}var Lt={conversational:ye,documentary:_e},Rt={conversational:he,documentary:x},zt=e=>(Lt[e]??(()=>e))(),Bt=e=>(Rt[e]??(()=>``))();function Vt({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:ot()}),t.map(e=>(0,Z.jsx)(z,{variant:`secondary`,className:`oc-agenttype__chip`,title:Bt(e),children:zt(e)},e)),(0,Z.jsxs)(St,{children:[(0,Z.jsx)(xt,{asChild:!0,children:(0,Z.jsx)(P,{type:`button`,variant:`outline`,size:`sm`,className:`h-7`,children:Me()})}),(0,Z.jsxs)(bt,{align:`start`,className:`oc-agenttypes-pop`,children:[(0,Z.jsx)(`p`,{className:`oc-agenttypes-pop__title`,children:r()}),(0,Z.jsx)(`p`,{className:`oc-agenttypes-pop__hint`,children:oe()}),(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)(L,{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:zt(r)}),(0,Z.jsx)(`span`,{className:`oc-agenttypes-pop__desc`,children:Bt(r)})]})]},r)})})]})]})]})}function Ht({instanceName:e,open:t,onOpenChange:n}){let r=D(g.agents.listAgentsForInstance,t&&e?{instanceName:e}:`skip`),i=M(g.agents.setAgentEnabled).withOptimisticUpdate((e,{instanceName:t,agentId:n,enabled:r})=>{let i=e.getQuery(g.agents.listAgentsForInstance,{instanceName:t});i&&e.setQuery(g.agents.listAgentsForInstance,{instanceName:t},{...i,agents:i.agents.map(e=>e.agentId===n?{...e,enabled:r}:e)})}),a=M(g.agents.setInstanceDefaultAgent).withOptimisticUpdate((e,{instanceName:t,agentId:n})=>{let r=e.getQuery(g.agents.listAgentsForInstance,{instanceName:t});r&&e.setQuery(g.agents.listAgentsForInstance,{instanceName:t},{...r,defaultAgentId:n})}),o=M(g.agents.setAgentTypes).withOptimisticUpdate((e,{instanceName:t,agentId:n,types:r})=>{let i=e.getQuery(g.agents.listAgentsForInstance,{instanceName:t});if(!i)return;let a=kt(r);e.setQuery(g.agents.listAgentsForInstance,{instanceName:t},{...i,agents:i.agents.map(e=>e.agentId===n?{...e,types:a}:e)})}),c=M(g.agents.removeInstanceAgent),l=Ct(),u=I();async function d(t,n){if(e)try{await i({instanceName:e,agentId:t,enabled:n})}catch(e){u.error(N(),e)}}async function p(t){if(e)try{await a({instanceName:e,agentId:t})}catch(e){u.error(N(),e)}}async function h(t,n,r){if(!e)return;let i=r.includes(n)?r.filter(e=>e!==n):[...r,n];try{await o({instanceName:e,agentId:t,types:i})}catch(e){u.error(N(),e)}}async function v(t,n){if(e&&await l({title:m({name:n}),description:pe(),confirmLabel:le(),destructive:!0}))try{await c({instanceName:e,agentId:t}),u.success(_())}catch(e){u.error(N(),e)}}return(0,Z.jsx)(R,{open:t,onOpenChange:n,children:(0,Z.jsxs)(F,{className:`oc-access`,children:[(0,Z.jsxs)(W,{children:[(0,Z.jsx)(G,{children:Be({name:e??``})}),(0,Z.jsx)(U,{children:nt()})]}),r===void 0?(0,Z.jsx)(`p`,{className:`oc-access__hint`,children:de()}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`div`,{className:`oc-access__poll`,children:r.discovery===null?s():r.discovery.lastPollOk?gt():k({error:r.discovery.error??`?`})}),r.agents.length===0?(0,Z.jsx)(`p`,{className:`oc-access__hint`,children:T()}):(0,Z.jsx)(`div`,{className:`oc-access__list`,children:r.agents.map(e=>{let t=e.presentInLastOk===!1,n=r.defaultAgentId===e.agentId,i=e.displayName??e.agentId,a=e.types??[];return(0,Z.jsxs)(`div`,{className:`oc-agentcard`+(e.enabled?``:` oc-agentcard--off`),children:[(0,Z.jsxs)(`div`,{className:`oc-agentcard__head`,children:[(0,Z.jsx)(L,{checked:e.enabled,disabled:t,"aria-label":i,onCheckedChange:t=>void d(e.agentId,t===!0)}),(0,Z.jsxs)(`span`,{className:`oc-agentcard__name`,title:i,children:[e.emoji?`${e.emoji} `:``,i]}),e.model?(0,Z.jsx)(`span`,{className:`oc-access__model`,children:e.model}):null,t?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(z,{variant:`outline`,className:`oc-access__gone`,children:f()}),(0,Z.jsx)(P,{size:`sm`,variant:`ghost`,className:`h-7 text-destructive`,onClick:()=>void v(e.agentId,i),children:C()})]}):n?(0,Z.jsx)(z,{variant:`default`,children:y()}):(0,Z.jsx)(P,{size:`sm`,variant:`outline`,className:`h-7`,disabled:!e.enabled,onClick:()=>void p(e.agentId),children:$e()})]}),e.enabled?(0,Z.jsx)(Vt,{agentId:e.agentId,types:a,onToggle:t=>void h(e.agentId,t,a)}):null]},e.agentId)})})]})]})})}function $({label:e,children:t}){return(0,Z.jsxs)(`label`,{className:`oc-field`,children:[(0,Z.jsx)(`span`,{className:`oc-field__label`,children:e}),t]})}export{Mt 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,Ag as i,Bg as a,Cg as o,Dg as ee,Eg as s,Fg as c,Gw as l,Hg as u,Ig as d,Lg as f,Mg as te,Ng as ne,Og as re,Pg as ie,Qh as ae,Qw as oe,Rg as p,Sg as se,Tg as ce,Ug as le,Vg as m,Zh as h,Zw as g,_g as _,ag as v,bg as y,cg as b,dg as x,eg as S,fg as C,gg as w,hg as T,ig as E,jg as D,kg as O,lg as k,mg as A,ng as j,og as M,pg 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,zg as V}from"./dist-Cci6Ggjl.js";import{E as H,X as U,Z as W,_ as G,b as K,v as q,x as de,y as fe}from"./index-C6XDcLXH.js";import{t as pe}from"./DataTableShell-B44W_69s.js";var J=t(e(),1),Y=n();function me(){let e=oe(l.integrations.status.status,{}),t=g(l.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:le()});let G=n,K=(e,t,n)=>H({...G,[e]:{...G[e],[t]:n}}),q=(e,n)=>void t({[e]:n});return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(`p`,{className:`oc-admin__hint`,children:[u(),` `,(0,Y.jsx)(`strong`,{children:m()}),` `,a()]}),(0,Y.jsxs)(X,{title:`Langfuse`,status:e.langfuse.configured?e.langfuse.enabled?(0,Y.jsx)(U,{variant:`secondary`,children:V()}):(0,Y.jsx)(U,{variant:`outline`,children:p()}):(0,Y.jsx)(U,{variant:`outline`,children:f()}),note:c(),children:[(0,Y.jsx)(Z,{label:ne(),children:(0,Y.jsx)(W,{value:G.langfuse.host??``,placeholder:e.langfuse.effectiveHost,onChange:e=>K(`langfuse`,`host`,e.target.value),onBlur:()=>q(`langfuse`,{host:G.langfuse.host??``})})}),(0,Y.jsx)(Q,{label:O(),checked:G.langfuse.enabled??!0,onChange:e=>{K(`langfuse`,`enabled`,e),q(`langfuse`,{enabled:e})}})]}),(0,Y.jsxs)(X,{title:`Opik`,status:e.opik.configured?e.opik.enabled?(0,Y.jsx)(U,{variant:`secondary`,children:V()}):(0,Y.jsx)(U,{variant:`outline`,children:p()}):(0,Y.jsx)(U,{variant:`outline`,children:f()}),note:ie(),children:[(0,Y.jsx)(Z,{label:te(),children:(0,Y.jsx)(W,{value:G.opik.baseUrl??``,placeholder:e.opik.effectiveBaseUrl,onChange:e=>K(`opik`,`baseUrl`,e.target.value),onBlur:()=>q(`opik`,{baseUrl:G.opik.baseUrl??``})})}),(0,Y.jsx)(Z,{label:D(),children:(0,Y.jsx)(W,{value:G.opik.workspace??``,placeholder:e.opik.effectiveWorkspace||i(),onChange:e=>K(`opik`,`workspace`,e.target.value),onBlur:()=>q(`opik`,{workspace:G.opik.workspace??``})})}),(0,Y.jsx)(Q,{label:O(),checked:G.opik.enabled??!0,onChange:e=>{K(`opik`,`enabled`,e),q(`opik`,{enabled:e})}})]}),(0,Y.jsxs)(X,{title:re(),status:(0,Y.jsx)(U,{variant:`outline`,children:d()}),note:ee(),children:[(0,Y.jsx)(Z,{label:s(),children:(0,Y.jsx)($,{value:G.tts.auto??`off`,options:[[`off`,ce()],[`always`,R()],[`inbound`,o()],[`tagged`,se()]],onChange:e=>{K(`tts`,`auto`,e),q(`tts`,{auto:e})}})}),(0,Y.jsx)(Z,{label:z(),children:(0,Y.jsx)($,{value:G.tts.provider??`openai`,options:[[`openai`,`OpenAI`],[`elevenlabs`,`ElevenLabs`],[`microsoft`,y()],[`azure`,`Azure Speech`],[`google`,`Google Gemini`]],onChange:e=>{K(`tts`,`provider`,e),q(`tts`,{provider:e})}})}),(0,Y.jsx)(Z,{label:B(),children:(0,Y.jsx)(W,{value:G.tts.model??``,placeholder:`eleven_multilingual_v2`,onChange:e=>K(`tts`,`model`,e.target.value),onBlur:()=>q(`tts`,{model:G.tts.model??``})})}),(0,Y.jsx)(Z,{label:L(),children:(0,Y.jsx)(W,{value:G.tts.voice??``,placeholder:_(),onChange:e=>K(`tts`,`voice`,e.target.value),onBlur:()=>q(`tts`,{voice:G.tts.voice??``})})})]}),(0,Y.jsxs)(X,{title:w(),status:(0,Y.jsx)(U,{variant:`outline`,children:d()}),note:e.secrets.openai?T():A(),children:[(0,Y.jsx)(Q,{label:N(),checked:G.talk.enabled??!1,onChange:e=>{K(`talk`,`enabled`,e),q(`talk`,{enabled:e})}}),(0,Y.jsx)(Z,{label:C(),children:(0,Y.jsx)($,{value:G.talk.realtimeProvider??`openai`,options:[[`openai`,`OpenAI (gpt-realtime)`],[`google`,`Google`]],onChange:e=>{K(`talk`,`realtimeProvider`,e),q(`talk`,{realtimeProvider:e})}})}),(0,Y.jsx)(Z,{label:x(),children:(0,Y.jsx)(W,{value:G.talk.realtimeModel??``,placeholder:`gpt-realtime-2`,onChange:e=>K(`talk`,`realtimeModel`,e.target.value),onBlur:()=>q(`talk`,{realtimeModel:G.talk.realtimeModel??``})})}),(0,Y.jsx)(Z,{label:L(),children:(0,Y.jsx)(W,{value:G.talk.voice??``,placeholder:`cedar / marin`,onChange:e=>K(`talk`,`voice`,e.target.value),onBlur:()=>q(`talk`,{voice:G.talk.voice??``})})}),(0,Y.jsx)(Z,{label:I(),children:(0,Y.jsx)($,{value:G.talk.transport??`webrtc`,options:[[`webrtc`,k()],[`provider-websocket`,`Provider WebSocket`],[`gateway-relay`,`Gateway relay`]],onChange:e=>{K(`talk`,`transport`,e),q(`talk`,{transport:e})}})}),(0,Y.jsx)(Z,{label:b(),children:(0,Y.jsx)(W,{value:G.talk.speechLocale??``,placeholder:`fr-CA`,onChange:e=>K(`talk`,`speechLocale`,e.target.value),onBlur:()=>q(`talk`,{speechLocale:G.talk.speechLocale??``})})}),(0,Y.jsx)(Q,{label:P(),checked:G.talk.interruptOnSpeech??!0,onChange:e=>{K(`talk`,`interruptOnSpeech`,e),q(`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:M()}),(0,Y.jsx)(U,{variant:`outline`,children:v()})]}),(0,Y.jsxs)(`p`,{className:`oc-uipa__note`,children:[E(),(0,Y.jsx)(`code`,{children:` voicewake.get/set`}),`.`]})]}),(0,Y.jsx)(pe,{title:ue(),rows:e.cursors.map(e=>({...e,_id:e.vendor})),emptyHint:j(),columns:[{header:F(),cell:e=>(0,Y.jsx)(U,{variant:`secondary`,children:e.vendor}),sort:e=>e.vendor},{header:S(),cell:e=>e.lastAt>0?new Date(e.lastAt).toLocaleString(`fr-FR`):`—`,sort:e=>e.lastAt>0?e.lastAt:null},{header:r(),cell:e=>String(e.failureCount),sort:e=>e.failureCount},{header:ae(),cell:e=>e.lastErrorStatus??`—`,sort:e=>e.lastErrorStatus??null},{header:h(),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)(H,{checked:t,onCheckedChange:e=>n(e===!0)}),(0,Y.jsx)(`span`,{children:e})]})}function $({value:e,options:t,onChange:n}){return(0,Y.jsxs)(G,{value:e,onValueChange:n,children:[(0,Y.jsx)(K,{size:`sm`,className:`w-full`,children:(0,Y.jsx)(de,{})}),(0,Y.jsx)(q,{children:t.map(([e,t])=>(0,Y.jsx)(fe,{value:e,children:t},e))})]})}export{me as IntegrationsTab};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$o as r,Gw as i,Jo as a,K_ as o,Ko as s,Qo as c,Qw as l,Xo as u,Yo as d,Zo as f,as as p,b_ as m,d_ as h,es as g,is as _,ns as v,qo as y,rs as b,ts as x,u_ as S,v_ as C,x_ as w,y_ as T}from"./dist-Cci6Ggjl.js";import{n as E,t as D}from"./TimeRangePicker-BP0hPL2e.js";import{At as ee,a as te,kt as ne,n as re,ot as O,r as k}from"./index-C6XDcLXH.js";import{a as A,n as j,o as M,r as N,t as P}from"./card-BZOj8vDF.js";var F=t(e(),1),I=n(),L=15,R=e=>String(Math.round(e));function z(){let e=l(i.me.getMe,{host:O})?.permissions?.includes(`traces.read`)??!1,t=l(i.deliveryTiming.listDeliverySessions,e?{}:`skip`),n=(0,F.useMemo)(()=>t?t.filter(e=>!e.active&&e.rollup!==null&&e.rollup.cP50!==null&&e.rollup.aP50!==null).slice(0,L).reverse().map(e=>({startedAt:e.startedAt,cP50:e.rollup?.cP50,aP50:e.rollup?.aP50})):[],[t]);return t===void 0?null:(0,I.jsxs)(`section`,{className:`oc-kpi__group`,children:[(0,I.jsx)(`h2`,{className:`oc-kpi__group-title`,children:o()}),(0,I.jsxs)(P,{children:[(0,I.jsxs)(A,{children:[(0,I.jsx)(M,{children:w()}),(0,I.jsx)(N,{children:T()})]}),(0,I.jsx)(j,{children:n.length<2?(0,I.jsx)(`p`,{className:`oc-admin__hint`,children:C()}):(0,I.jsx)(B,{series:n})})]})]})}function B({series:e}){let t=e.map(e=>e.cP50),n=e.map(e=>e.aP50),r=Math.max(1,...t,...n),i=t=>6+t*468/(e.length-1),a=e=>74-e*68/r,o=e=>e.map((e,t)=>`${t===0?`M`:`L`}${i(t).toFixed(1)},${a(e).toFixed(1)}`).join(` `),s=e[e.length-1];return(0,I.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,I.jsxs)(`div`,{className:`flex gap-3 text-xs text-muted-foreground`,children:[(0,I.jsxs)(`span`,{style:{color:`var(--primary)`},children:[S(),` p50 `,R(s.cP50),` `,m()]}),(0,I.jsxs)(`span`,{children:[h(),` p50 `,R(s.aP50),` `,m()]})]}),(0,I.jsxs)(`svg`,{viewBox:`0 0 480 80`,className:`h-20 w-full`,preserveAspectRatio:`none`,role:`img`,"aria-label":w(),children:[(0,I.jsx)(`path`,{d:o(n),fill:`none`,style:{stroke:`var(--muted-foreground)`},strokeWidth:1.5}),(0,I.jsx)(`path`,{d:o(t),fill:`none`,style:{stroke:`var(--primary)`},strokeWidth:1.5})]})]})}var V=[{metric:`api.calls`,label:p(),unit:`/h`,group:`API`,isError:!1},{metric:`api.errors`,label:_(),unit:`/h`,group:`API`,isError:!0},{metric:`api.latency.avg_ms`,label:b(),unit:`ms`,group:`API`,isError:!1},{metric:`openclaw.ingest`,label:v(),unit:`/h`,group:`OpenClaw`,isError:!1},{metric:`chat.send`,label:x(),unit:`/h`,group:`Chat`,isError:!1},{metric:`assistant.stream.errors`,label:g(),unit:`/h`,group:`Assistant`,isError:!0}],H=V.length,U=[`API`,`OpenClaw`,`Chat`,`Assistant`],W=1e3,G=36e5;function K(e,t){let n=Math.max(1,Math.ceil((t-e)/G)),r=Math.min(n*H,W);return{rowLimit:r,buckets:Math.max(1,Math.floor(r/H))}}function q(){let e=ee({from:`/settings/kpi`}),t=ne({from:`/settings/kpi`}),n=k(e.from,e.to,re,`now`),a=e=>void t({search:t=>({...t,...te(e)})}),{from:o,to:s}=E(n),{rowLimit:d,buckets:p}=K(o,s),m=l(i.kpi.listKpis,{limit:d,filter:{from:o,to:s}}),h=(0,F.useMemo)(()=>{let e=new Map;for(let t of m??[]){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>p&&e.set(t,n.slice(n.length-p));return e},[m,p]),g=(0,I.jsxs)(I.Fragment,{children:[(0,I.jsxs)(`p`,{className:`oc-admin__hint`,children:[r(),` `,(0,I.jsx)(`span`,{className:`oc-filter__window`,children:c()})]}),(0,I.jsx)(J,{value:n,onChange:a})]});return m===void 0?(0,I.jsxs)(I.Fragment,{children:[g,(0,I.jsx)(z,{}),(0,I.jsx)(`p`,{className:`oc-admin__hint`,children:f()})]}):m.length===0?(0,I.jsxs)(I.Fragment,{children:[g,(0,I.jsx)(z,{}),(0,I.jsx)(`p`,{className:`oc-admin__hint`,children:u()})]}):(0,I.jsxs)(I.Fragment,{children:[g,(0,I.jsx)(z,{}),U.map(e=>{let t=V.filter(t=>t.group===e);return t.some(e=>(h.get(e.metric)??[]).length>0)?(0,I.jsxs)(`section`,{className:`oc-kpi__group`,children:[(0,I.jsx)(`h2`,{className:`oc-kpi__group-title`,children:e}),(0,I.jsx)(`div`,{className:`oc-kpi__grid`,children:t.map(e=>(0,I.jsx)(Y,{config:e,series:h.get(e.metric)??[]},e.metric))})]},e):null})]})}function J({value:e,onChange:t}){return(0,I.jsx)(`div`,{className:`oc-kpi__toolbar`,children:(0,I.jsx)(D,{value:e,onChange:t})})}function Y({config:e,series:t}){let n=t.length>0?t[t.length-1]:null,r=n?n.value:0;return(0,I.jsxs)(P,{size:`sm`,className:`oc-kpi__card`,children:[(0,I.jsxs)(A,{children:[(0,I.jsx)(M,{className:`oc-kpi__card-title`,children:e.label}),(0,I.jsx)(N,{className:`oc-kpi__card-metric`,children:(0,I.jsx)(`code`,{children:e.metric})})]}),(0,I.jsxs)(j,{className:`oc-kpi__card-body`,children:[(0,I.jsxs)(`div`,{className:`oc-kpi__value-row`,children:[(0,I.jsx)(`span`,{className:`oc-kpi__value`+(e.isError&&r>0?` oc-kpi__value--error`:``),children:Q(r)}),(0,I.jsx)(`span`,{className:`oc-kpi__unit`,children:e.unit})]}),(0,I.jsx)(ae,{series:t,isError:e.isError,unit:e.unit}),(0,I.jsxs)(`div`,{className:`oc-kpi__axis`,children:[n?(0,I.jsx)(`span`,{className:`oc-kpi__axis-latest`,children:d({value:$(n.bucket)})}):(0,I.jsx)(`span`,{className:`oc-kpi__muted`,children:a()}),(0,I.jsx)(`span`,{className:`oc-kpi__muted`,children:y({count:t.length})})]})]})]})}var X=240,Z=48,ie=1;function ae({series:e,isError:t,unit:n}){if(e.length===0)return(0,I.jsx)(`div`,{className:`oc-kpi__chart oc-kpi__chart--empty`,"aria-hidden":!0});let r=e.reduce((e,t)=>t.value>e?t.value:e,0),i=X/e.length,a=Math.max(i-ie,1);return(0,I.jsx)(`svg`,{className:`oc-kpi__chart`,viewBox:`0 0 ${X} ${Z}`,preserveAspectRatio:`none`,role:`img`,"aria-label":s({max:Q(r),unit:n}),children:e.map((e,o)=>{let s=r>0?e.value/r*(Z-1):0,c=o*i,l=Z-s;return(0,I.jsx)(`rect`,{className:`oc-kpi__bar`+(t&&e.value>0?` oc-kpi__bar--error`:``),x:c,y:l,width:a,height:s,children:(0,I.jsxs)(`title`,{children:[$(e.bucket),` · `,Q(e.value),` `,n]})},e.bucket)})})}function Q(e){return Number.isFinite(e)?Math.abs(e)>=1e3?(e/1e3).toFixed(e%1e3==0?0:1)+`k`:String(e):`0`}function $(e){let t=new Date(`${e}:00:00Z`);return Number.isNaN(t.getTime())?e:`${String(t.getUTCDate()).padStart(2,`0`)}/${String(t.getUTCMonth()+1).padStart(2,`0`)} ${String(t.getUTCHours()).padStart(2,`0`)}h`}export{q as KpiTab};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$C as r,Ax as i,Bx as a,Cx as o,Dx as s,Ex as c,Fx as l,Gw as u,Hx as d,Ix as f,Lx as ee,Mx as te,Nx as ne,Ox as re,Px as p,QC as ie,Qw as m,Rx as ae,Sx as oe,Tx as h,Ux as se,Vx as ce,Wx as le,Zw as g,_x as ue,aw as de,bx as _,cw as v,dx as y,ew as b,fx as x,gx as S,hx as C,iw as w,jx as T,kx as E,lw as D,mx as O,nw as k,ow as A,pw as j,px as M,rw as N,sw as P,tm as F,tw as I,uw as L,vw as R,vx as z,wx as B,xx as V,yx as fe,zx as pe}from"./dist-Cci6Ggjl.js";import{t as H}from"./button-nO0gX-NR.js";import{A as me,E as U,O as he,Z as W,_ as ge,b as _e,ot as G,v as ve,x as ye,y as K}from"./index-C6XDcLXH.js";var q=t(e(),1),J=[{id:`messages`,label:()=>le()},{id:`composer`,label:()=>se()},{id:`sidebar`,label:()=>d()},{id:`other`,label:()=>ce()}],Y={showSource:{category:`messages`,label:()=>a(),help:()=>pe()},showReport:{category:`messages`,label:()=>ae(),help:()=>ee()},copyAssistant:{category:`messages`,label:()=>f()},copyUser:{category:`messages`,label:()=>l()},showDelete:{category:`messages`,label:()=>p()},showTools:{category:`messages`,label:()=>ne(),help:()=>te()},voiceInput:{category:`composer`,label:()=>T(),help:()=>i()},showChatAge:{category:`sidebar`,label:()=>E(),help:()=>re()},showChatProvider:{category:`sidebar`,label:()=>s(),help:()=>c()}};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:()=>C()};function De({prefKey:e,ui:t}){let n=g(u.admin.setUiPrefDefault),r=g(u.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:fe()}),(0,$.jsxs)(ge,{value:we(t.defaults[e]),onValueChange:t=>void n({key:e,value:Q(t)}),children:[(0,$.jsx)(_e,{size:`sm`,className:`w-36`,children:(0,$.jsx)(ye,{})}),(0,$.jsxs)(ve,{children:[(0,$.jsx)(K,{value:`on`,children:M()}),(0,$.jsx)(K,{value:`off`,children:x()}),(0,$.jsx)(K,{value:`inherit`,children:y()})]})]}),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":z()}),z()]}):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=m(u.me.getMe,{host:G}),a=i?.ui,s=Z(i?.role)&&n,c=g(u.me.setUiPref).withOptimisticUpdate(he),l=(0,q.useMemo)(()=>a?be(Object.keys(a.effective),e):[],[a,e]);return a?(0,$.jsxs)(`div`,{className:`oc-prefs-panel`,children:[Z(i?.role)?(0,$.jsxs)(`label`,{className:`oc-prefs__gov-toggle`,children:[(0,$.jsx)(U,{checked:n,onCheckedChange:e=>r(e===!0),"aria-label":_()}),_()]}):null,s?(0,$.jsxs)(`div`,{className:`oc-prefs__gov-head`,children:[(0,$.jsx)(`p`,{children:ue()}),(0,$.jsx)(`p`,{children:S()}),(0,$.jsx)(`p`,{children:O()})]}):null,(0,$.jsx)(W,{value:e,onChange:e=>t(e.target.value),placeholder:h(),"aria-label":h(),className:`mb-2`}),l.length===0?(0,$.jsx)(`div`,{className:`oc-prefs__empty`,children:B()}):(0,$.jsx)(`div`,{className:`oc-prefs`,children:l.map(e=>(0,$.jsxs)(`div`,{className:`oc-prefs__group`,children:[(0,$.jsx)(`h4`,{className:`oc-prefs__cat`,children:e.label}),e.keys.map(e=>{let t=Y[e],n=t?t.label():e,r=t?.help?.(),i=a.locked[e],l=a.effective[e],u=a.userOverrides[e]!==void 0;return(0,$.jsxs)(`div`,{className:`oc-prefs__row${i?` is-locked`:``}${u&&!i?` is-overridden`:``}`,children:[(0,$.jsxs)(`div`,{className:`oc-prefs__info`,children:[(0,$.jsxs)(`span`,{className:`oc-prefs__label`,children:[n,i?(0,$.jsx)(`span`,{className:`oc-prefs__lock`,children:o()}):u?null:(0,$.jsx)(`span`,{className:`oc-prefs__def`,children:oe()})]}),r?(0,$.jsx)(`span`,{className:`oc-prefs__help`,children:r}):null]}),(0,$.jsxs)(`div`,{className:`oc-prefs__ctl`,children:[!i&&u?(0,$.jsx)(`button`,{type:`button`,className:`oc-prefs__reset`,onClick:()=>void c({key:e,value:null}),children:V()}):null,(0,$.jsx)(U,{checked:l,disabled:i,onCheckedChange:t=>void c({key:e,value:t===!0}),"aria-label":n})]}),s?(0,$.jsx)(De,{prefKey:e,ui:a}):null]},e)})]},e.id))})]}):(0,$.jsx)(`div`,{className:`oc-prefs__empty`,children:R()})}function ke(){let e=m(u.me.getMe,{host:G}),t=g(u.me.setLocale),n=g(u.me.setMyName),i=me(),a=e?.locale??`default`,o=e?.name??``,[s,c]=(0,q.useState)(null),l=s??o,d=l.trim()!==o.trim();async function f(){try{await n({name:l}),c(null),i.success(A())}catch(e){i.error(de(),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:L()}),(0,$.jsx)(`p`,{className:`oc-show__desc`,children:D()})]}),(0,$.jsxs)(`div`,{className:`oc-show__row`,children:[(0,$.jsx)(W,{className:`max-w-xs`,value:l,maxLength:120,placeholder:v(),onChange:e=>c(e.target.value),onKeyDown:e=>{e.key===`Enter`&&d&&(e.preventDefault(),f())}}),(0,$.jsx)(H,{size:`sm`,disabled:!d,onClick:()=>void f(),children:F()})]}),(0,$.jsx)(`p`,{className:`oc-show__desc`,children:P()})]}),(0,$.jsxs)(`section`,{className:`oc-show__section`,children:[(0,$.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,$.jsx)(`h2`,{className:`oc-show__title`,children:w()}),(0,$.jsx)(`p`,{className:`oc-show__desc`,children:N()})]}),(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`?r():e===`en`?ie():j()},e))}),(0,$.jsx)(`p`,{className:`oc-show__desc`,children:k()})]}),(0,$.jsxs)(`section`,{className:`oc-show__section`,children:[(0,$.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,$.jsx)(`h2`,{className:`oc-show__title`,children:I()}),(0,$.jsx)(`p`,{className:`oc-show__desc`,children:b()})]}),(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{Cc as r,Dc as i,Ec as a,Fc as o,Gw as s,Ic as c,Oc as l,Qw as u,Sc as d,Tc as f,Zw as p,_c as m,bc as h,dc as g,fc as _,gc as v,hc as y,lc as b,mc as x,pc as S,uc as C,vc as w,wc as T,xc as E,yc as D}from"./dist-Cci6Ggjl.js";import{d as O,f as k,i as A,l as j,n as M,r as N,t as P,u as F}from"./FieldLabel-Dn9ltnAG.js";import{t as I}from"./button-nO0gX-NR.js";import{A as L,E as R,_ as z,b as B,v as V,x as H,y as U}from"./index-C6XDcLXH.js";/* empty css */var W=t(e(),1),G=n(),K={media_delivery:{label:r,help:d},documentary_fetch:{label:E,help:h},inbound_files:{label:D,help:w}},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:g,references:C,files:b};function Y(){let e=u(s.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:v()})});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)(M,{label:l(),help:i()}),(0,G.jsxs)(`label`,{className:`oc-injtab__picker`,children:[(0,G.jsx)(`span`,{children:m()}),(0,G.jsxs)(z,{value:r._id,onValueChange:e=>n(e),children:[(0,G.jsx)(B,{size:`sm`,className:`min-w-44`,children:(0,G.jsx)(H,{})}),(0,G.jsx)(V,{children:e.map(e=>(0,G.jsx)(U,{value:e._id,children:e.displayName??e.name},e._id))})]})]})]}),(0,G.jsx)(X,{instance:r},r._id)]})}function X({instance:e}){let t=p(s.admin.upsertInstanceConfig),n=L(),r=e.config??{},[i,a]=(0,W.useState)(()=>A(r)),[l,u]=(0,W.useState)(!1),d=i.promptInjections,f=(e,t)=>a({...i,promptInjections:{...d,[e]:{...d[e],...t}}});async function m(){u(!0);try{await t({instanceId:e._id,config:N(i,r)})}catch(e){n.error(o(),e)}finally{u(!1)}}return(0,G.jsxs)(`div`,{className:`oc-injtab__body`,children:[F.map(e=>(0,G.jsx)(Z,{injKey:e,def:j[e],i18n:K[e],row:d[e]??{enabled:!0,template:j[e].defaultTemplate},onChange:t=>f(e,t)},e)),(0,G.jsx)(`div`,{className:`oc-injtab__actions`,children:(0,G.jsx)(I,{size:`sm`,onClick:()=>void m(),disabled:l,children:c()})})]})}function Z({injKey:e,def:t,i18n:n,row:r,onChange:i}){let[o,s]=(0,W.useState)(!1),c=r.template.trim()!==t.defaultTemplate,l=t.togglable&&!r.enabled,u=Object.fromEntries(t.placeholders.map(e=>[e,q[e]??`{${e}}`])),d=O(e,r),p=d?k(d,u):``;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)(R,{checked:r.enabled,onCheckedChange:e=>i({enabled:e===!0})}),(0,G.jsx)(M,{label:n.label(),help:n.help()})]}):(0,G.jsx)(M,{label:n.label(),help:n.help()}),c&&(0,G.jsx)(`span`,{className:`oc-injection__badge`,children:f()})]}),(0,G.jsx)(`textarea`,{className:`oc-injcard__text`,value:r.template,disabled:l,rows:8,spellCheck:!1,onChange:e=>i({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:T()}),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:()=>s(e=>!e),children:o?x():y()}),c&&(0,G.jsx)(I,{variant:`ghost`,size:`sm`,onClick:()=>i({template:t.defaultTemplate}),children:a()})]})]}),o&&(0,G.jsx)(`div`,{className:`oc-injcard__preview`,children:p?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`pre`,{className:`oc-injcard__previewtext`,children:p}),(0,G.jsx)(`span`,{className:`oc-injection__ph`,children:S()})]}):(0,G.jsx)(`span`,{className:`oc-injection__ph`,children:_()})})]})}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,Fd as ee,Gd as te,Gw as a,Id as o,Jd as s,Kd as c,Ld as ne,Md as l,Nd as re,Pd as u,Qd as d,Qw as f,Rd as p,Wd as ie,Xd as m,Yd as h,Zd as g,Zw as _,_f as v,af as y,cf as b,df as x,ef as ae,ff as S,gf as C,hf as w,if as T,jd as E,lf as D,mf as O,nf as k,of as A,pf as j,qd as M,rf as N,sf as P,tf as F,uf as I,vf as L,yf as R}from"./dist-Cci6Ggjl.js";import{t as z}from"./button-nO0gX-NR.js";import{A as B,E as V,X as H,Z as U,j as W,m as G,xt as K}from"./index-C6XDcLXH.js";import{t as q}from"./roleDescriptions-BmCKM40P.js";var J=t(e(),1),Y=n(),X=[{group:()=>R(),keys:[{key:`traces.read`,label:()=>O()},{key:`traces.read.content`,label:()=>j(),phi:!0},{key:`traces.write`,label:()=>S()}]},{group:()=>L(),keys:[{key:`kpi.read`,label:()=>O()},{key:`kpi.write`,label:()=>S()}]},{group:()=>v(),keys:[{key:`openclaw.query`,label:()=>x()},{key:`anomalies.read`,label:()=>I()},{key:`anomalies.report`,label:()=>D()}]},{group:()=>C(),keys:[{key:`chats.read`,label:()=>O()},{key:`selfheal`,label:()=>P()}]},{group:()=>w(),keys:[{key:`admin.manage`,label:()=>b()}]}],oe=X.flatMap(e=>e.keys.map(e=>e.key));function Z(e){return e.includes(`*`)}var Q={key:``,name:``,description:``};function $(){let e=f(a.apiKeys.listRoles,{}),t=_(a.apiKeys.createRole),n=_(a.apiKeys.ensureRolesSeeded),v=_(a.apiKeys.updateRolePermissions).withOptimisticUpdate((e,{roleId:t,permissions:n})=>{let r=e.getQuery(a.apiKeys.listRoles,{});r&&e.setQuery(a.apiKeys.listRoles,{},r.map(e=>e._id===t?{...e,permissions:n}:e))}),b=W(),x=B(),[S,C]=(0,J.useState)(!1),[w,D]=(0,J.useState)(Q),[O,j]=(0,J.useState)(new Set);(0,J.useEffect)(()=>{n({}).catch(e=>{x.error(y(),e)})},[n,x]);let P=e??[];async function I(e,t){if(Z(e.permissions)||O.has(e._id))return;let n=e.permissions.includes(t)?e.permissions.filter(e=>e!==t):[...e.permissions,t];if(!(e.builtin&&!await b({title:T({name:e.name}),description:N(),confirmLabel:k()}))){j(t=>new Set(t).add(e._id));try{await v({roleId:e._id,permissions:n})}catch(e){x.error(F(),e)}finally{j(t=>{let n=new Set(t);return n.delete(e._id),n})}}}async function L(){try{await t({key:w.key,name:w.name,description:w.description||void 0,permissions:[]}),D(Q),C(!1)}catch(e){x.error(ae(),e)}}let R=e===void 0,$=!R&&P.length===0;return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(`p`,{className:`oc-admin__hint`,children:[r(),` `,(0,Y.jsx)(`code`,{children:`admin`}),` `,d(),` `,(0,Y.jsx)(`code`,{children:`traces.read.content`}),` `,g()]}),(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:m()}),(0,Y.jsx)(`div`,{className:`oc-dt__bar-actions`,children:(0,Y.jsx)(z,{size:`sm`,onClick:()=>{D(Q),C(!0)},children:h()})})]}),R?(0,Y.jsx)(`p`,{className:`oc-admin__hint`,children:s()}):$?(0,Y.jsx)(`p`,{className:`oc-admin__hint`,children:M()}):(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:c()}),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?A({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:P.map(e=>{let t=Z(e.permissions),n=O.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)(H,{variant:`outline`,className:`gap-1`,children:[(0,Y.jsx)(K,{}),` `,te()]}):(0,Y.jsx)(H,{variant:`secondary`,children:ie()})]}),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?p():n?ne():r,onCheckedChange:()=>void I(e,r)})},r))]},e.key)})})]})})]}),(0,Y.jsx)(G,{open:S,onOpenChange:C,title:o(),description:ee(),canSubmit:!!(w.key&&w.name),onSubmit:L,submitLabel:u(),children:(0,Y.jsxs)(`div`,{className:`oc-form`,children:[(0,Y.jsxs)(`label`,{className:`oc-field`,children:[(0,Y.jsx)(`span`,{className:`oc-field__label`,children:re()}),(0,Y.jsx)(U,{value:w.key,placeholder:l(),onChange:e=>D({...w,key:e.target.value})})]}),(0,Y.jsxs)(`label`,{className:`oc-field`,children:[(0,Y.jsx)(`span`,{className:`oc-field__label`,children:E()}),(0,Y.jsx)(U,{value:w.name,onChange:e=>D({...w,name:e.target.value})})]}),(0,Y.jsxs)(`label`,{className:`oc-field`,children:[(0,Y.jsx)(`span`,{className:`oc-field__label`,children:i()}),(0,Y.jsx)(U,{value:w.description,onChange:e=>D({...w,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{$b as r,$y as i,Ab as a,Bb as ee,Cb as te,Db as ne,Eb as re,Fb as ie,Gb as ae,Gw as o,Gy as s,Hb as oe,Ib as se,Jb as ce,Jy as c,Kb as le,Ky as ue,Lb as de,Mb as fe,Nb as pe,Ob as me,Pb as he,Qb as ge,Qw as l,Qy as _e,Rb as ve,Sb as ye,Tb as be,Ub as xe,Vb as Se,Wb as Ce,Wy as u,Xb as we,Xy as d,Yb as Te,Yw as Ee,Yy as f,Zb as De,Zw as p,Zy as m,_b as Oe,ab as ke,ax as Ae,bb as je,cb as h,cx as Me,db as g,eb as _,ex as Ne,fb as v,gb as Pe,hb as Fe,ib as y,ix as b,jb as Ie,kb as Le,lb as x,lx as Re,mb as ze,nb as S,nx as Be,ob as C,ox as Ve,pb as w,qb as He,qy as T,rb as E,rx as Ue,sb as D,sx as We,tb as O,tx as Ge,ub as k,ux as Ke,vb as qe,wb as Je,xb as Ye,yb as Xe,zb as Ze}from"./dist-Cci6Ggjl.js";import{n as Qe}from"./dist-xA--peN1.js";import{i as $e}from"./dist-dF88UcEZ.js";import{t as A}from"./button-nO0gX-NR.js";import{$ as j,A as et,At as tt,Et as M,Ot as nt,Q as N,X as P,Z as F,_ as I,b as L,et as R,j as rt,kt as it,m as at,nt as z,rt as B,tt as V,v as H,x as U,y as W}from"./index-C6XDcLXH.js";import{t as ot}from"./FilterBar-RytfYInF.js";import{t as st}from"./DataTableShell-B44W_69s.js";import{t as ct}from"./roleDescriptions-BmCKM40P.js";var G=t(e(),1),K=n(),lt=[{value:`never`,label:()=>d(),days:null},{value:`30`,label:()=>f(),days:30},{value:`90`,label:()=>c(),days:90}],q=720*60*60*1e3,J=`__all__`,Y={name:``,roleKey:``,description:``};function X(){let e=tt({from:`/settings/serviceAccounts`}),t=it({from:`/settings/serviceAccounts`}),n=e.q??``,i=e.status??J,[s,c]=(0,G.useState)(J),ue=e=>void t({search:t=>({...t,q:e||void 0}),replace:!0}),_e=e=>void t({search:t=>({...t,status:e===J?void 0:e})}),u=l(o.apiKeys.listServiceAccounts,{filter:{q:n||void 0,role:s===J?void 0:s,disabled:i===J?void 0:i===`disabled`}}),d=l(o.apiKeys.listKeys,{}),f=l(o.apiKeys.listRoles,{}),m=p(o.apiKeys.createServiceAccount),ke=p(o.apiKeys.updateServiceAccount),h=p(o.apiKeys.deleteServiceAccount),g=Ee(o.apiKeys.mintApiKey),_=p(o.apiKeys.revokeApiKey),v=rt(),y=et(),x=n!==``||s!==J||i!==J;function S(){c(J),t({search:{},replace:!0})}let[C,w]=(0,G.useState)(!1),[T,E]=(0,G.useState)(Y),[D,O]=(0,G.useState)(null),[k,Qe]=(0,G.useState)(new Set),[j,M]=(0,G.useState)(null),N=(0,G.useRef)(!1),[R,z]=(0,G.useState)(new Set),[B,V]=(0,G.useState)({}),[q,X]=(0,G.useState)(null),Z=(0,G.useMemo)(()=>{let e=new Map;for(let t of d??[]){let n=e.get(t.serviceAccountId)??[];n.push(t),e.set(t.serviceAccountId,n)}return e},[d]);function Q(e){Qe(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})}async function ft(){try{D?(await ke({serviceAccountId:D,name:T.name,roleKey:T.roleKey,description:T.description}),y.success(me())):await m({name:T.name,roleKey:T.roleKey,description:T.description||void 0}),E(Y),O(null),w(!1)}catch(e){y.error(D?Le():a(),e)}}function pt(e){E({name:e.name,roleKey:e.roleKey,description:e.description??``}),O(e._id),w(!0)}async function $(e){if(N.current)return;N.current=!0;let t=B[e._id]??`never`,n=lt.find(e=>e.value===t)?.days??null,r=n?Date.now()+n*24*60*60*1e3:void 0;M(e._id);try{let t=await g({serviceAccountId:e._id,expiresAt:r});X({accountName:e.name,plaintext:t.plaintext,prefix:t.prefix,lastFour:t.lastFour})}catch(e){y.error(ne(),e)}finally{N.current=!1,M(null)}}async function mt(e){if(await v({title:re(),description:(0,K.jsxs)(K.Fragment,{children:[be(),` `,(0,K.jsx)(`span`,{className:`font-mono`,children:e.name}),` `,Je(),` `,(0,K.jsx)(`strong`,{children:te()}),` `,ye()]}),confirmWord:e.name,confirmLabel:Ye(),destructive:!0}))try{await h({serviceAccountId:e._id}),y.success(je(),e.name)}catch(e){y.error(Xe(),e)}}async function ht(e){if(await v({title:qe(),description:(0,K.jsxs)(K.Fragment,{children:[Oe(),` `,(0,K.jsxs)(`span`,{className:`font-mono`,children:[e.prefix,`…`,e.lastFour]}),` `,Pe()]}),confirmLabel:Fe(),destructive:!0})&&!R.has(e._id)){z(t=>new Set(t).add(e._id));try{await _({keyId:e._id})}catch(e){y.error(ze(),e)}finally{z(t=>{let n=new Set(t);return n.delete(e._id),n})}}}return(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`p`,{className:`oc-admin__hint`,children:Ke()}),(0,K.jsxs)(ot,{q:n,onQChange:ue,searchPlaceholder:Re(),onReset:S,canReset:x,children:[(0,K.jsxs)(I,{value:s,onValueChange:c,children:[(0,K.jsx)(L,{size:`sm`,className:`w-40`,children:(0,K.jsx)(U,{placeholder:Me()})}),(0,K.jsxs)(H,{children:[(0,K.jsx)(W,{value:J,children:We()}),(f??[]).map(e=>(0,K.jsx)(W,{value:e.key,children:e.key},e._id))]})]}),(0,K.jsxs)(I,{value:i,onValueChange:_e,children:[(0,K.jsx)(L,{size:`sm`,className:`w-36`,children:(0,K.jsx)(U,{})}),(0,K.jsxs)(H,{children:[(0,K.jsx)(W,{value:J,children:Ve()}),(0,K.jsx)(W,{value:`active`,children:Ae()}),(0,K.jsx)(W,{value:`disabled`,children:b()})]})]})]}),(0,K.jsx)(st,{title:Ue(),rows:u,addLabel:Be(),onAdd:()=>{E(Y),O(null),w(!0)},emptyHint:Ge(),isExpanded:e=>k.has(e._id),renderExpanded:e=>(0,K.jsx)(ut,{account:e,keys:Z.get(e._id)??[],onRevoke:ht,revoking:R}),rowActions:e=>[{label:De(),onSelect:()=>pt(e)},{label:Ne(),onSelect:()=>void $(e)},{label:k.has(e._id)?r():ge(),onSelect:()=>Q(e._id)},{label:we(),variant:`destructive`,onSelect:()=>void mt(e)}],columns:[{header:``,className:`w-8`,cell:e=>(0,K.jsx)(A,{variant:`ghost`,size:`icon-sm`,"aria-label":k.has(e._id)?Te():ce(),onClick:()=>Q(e._id),children:k.has(e._id)?(0,K.jsx)($e,{}):(0,K.jsx)(nt,{})})},{header:He(),sort:e=>e.name,cell:e=>(0,K.jsxs)(`div`,{className:`flex flex-col`,children:[(0,K.jsx)(`span`,{children:e.name}),e.description?(0,K.jsx)(`span`,{className:`text-muted-foreground text-xs`,children:e.description}):null]})},{header:le(),sort:e=>e.roleKey,cell:e=>(0,K.jsx)(P,{variant:`secondary`,children:e.roleKey})},{header:ae(),sort:e=>+!!e.disabled,cell:e=>e.disabled?(0,K.jsx)(P,{variant:`destructive`,children:b()}):(0,K.jsx)(P,{variant:`outline`,children:Ae()})},{header:Ce(),cell:e=>(0,K.jsxs)(I,{value:B[e._id]??`never`,onValueChange:t=>V(n=>({...n,[e._id]:t})),children:[(0,K.jsx)(L,{size:`sm`,className:`w-32`,children:(0,K.jsx)(U,{})}),(0,K.jsx)(H,{children:lt.map(e=>(0,K.jsx)(W,{value:e.value,children:e.label()},e.value))})]})},{header:xe(),sort:e=>(Z.get(e._id)??[]).filter(e=>!e.disabled).length,cell:e=>{let t=(Z.get(e._id)??[]).filter(e=>!e.disabled).length;return(0,K.jsx)(`span`,{className:`oc-sa__keycount`,children:j===e._id?oe():Se({count:t})})}}]}),(0,K.jsx)(at,{open:C,onOpenChange:e=>{w(e),e||O(null)},title:D?ee():de(),description:D?Ze():se(),canSubmit:!!(T.name&&T.roleKey),onSubmit:ft,submitLabel:D?ve():ie(),children:(0,K.jsxs)(`div`,{className:`oc-form`,children:[(0,K.jsxs)(`label`,{className:`oc-field`,children:[(0,K.jsx)(`span`,{className:`oc-field__label`,children:he()}),(0,K.jsx)(F,{value:T.name,onChange:e=>E({...T,name:e.target.value})})]}),(0,K.jsxs)(`label`,{className:`oc-field`,children:[(0,K.jsx)(`span`,{className:`oc-field__label`,children:pe()}),(0,K.jsxs)(I,{value:T.roleKey||void 0,onValueChange:e=>E({...T,roleKey:e}),children:[(0,K.jsx)(L,{className:`w-full`,children:(0,K.jsx)(U,{placeholder:fe()})}),(0,K.jsx)(H,{children:(f??[]).map(e=>(0,K.jsxs)(W,{value:e.key,children:[e.name,` (`,e.key,`)`]},e._id))})]}),(()=>{let e=(f??[]).find(e=>e.key===T.roleKey),t=e?ct(e):null;return t?(0,K.jsx)(`span`,{className:`text-muted-foreground text-xs`,children:t}):null})()]}),(0,K.jsxs)(`label`,{className:`oc-field`,children:[(0,K.jsx)(`span`,{className:`oc-field__label`,children:Ie()}),(0,K.jsx)(F,{value:T.description,onChange:e=>E({...T,description:e.target.value})})]})]})}),(0,K.jsx)(dt,{minted:q,onClose:()=>X(null)})]})}function ut({account:e,keys:t,onRevoke:n,revoking:r}){return(0,K.jsxs)(`div`,{className:`oc-sa__keys`,children:[(0,K.jsxs)(`div`,{className:`oc-sa__keys-head`,children:[w(),` `,(0,K.jsx)(`span`,{className:`font-medium`,children:e.name})]}),t.length===0?(0,K.jsx)(`p`,{className:`oc-admin__hint`,children:v()}):(0,K.jsxs)(`table`,{className:`oc-sa__keytable`,children:[(0,K.jsx)(`thead`,{children:(0,K.jsxs)(`tr`,{children:[(0,K.jsx)(`th`,{children:g()}),(0,K.jsx)(`th`,{children:k()}),(0,K.jsx)(`th`,{children:x()}),(0,K.jsx)(`th`,{children:h()}),(0,K.jsx)(`th`,{children:D()}),(0,K.jsx)(`th`,{children:C()}),(0,K.jsx)(`th`,{})]})}),(0,K.jsx)(`tbody`,{children:t.map(t=>(0,K.jsxs)(`tr`,{children:[(0,K.jsx)(`td`,{children:(0,K.jsxs)(`code`,{className:`oc-sa__keyid`,children:[t.prefix,`…`,t.lastFour]})}),(0,K.jsx)(`td`,{children:(0,K.jsx)(P,{variant:`secondary`,children:e.roleKey})}),(0,K.jsx)(`td`,{children:Z(t.createdAt)}),(0,K.jsx)(`td`,{className:Q(t.lastUsedAt)?`oc-sa__stale`:``,children:ft(t.lastUsedAt)}),(0,K.jsx)(`td`,{children:pt(t.expiresAt)}),(0,K.jsx)(`td`,{children:$(t)}),(0,K.jsx)(`td`,{className:`text-right`,children:t.disabled?null:(0,K.jsx)(A,{variant:`destructive`,size:`sm`,disabled:r.has(t._id),onClick:()=>n(t),children:r.has(t._id)?ke():y()})})]},t._id))})]})]})}function dt({minted:e,onClose:t}){let[n,r]=(0,G.useState)(!1);async function a(){if(e)try{await navigator.clipboard.writeText(e.plaintext),r(!0),window.setTimeout(()=>r(!1),2e3)}catch{}}return(0,K.jsx)(N,{open:e!==null,onOpenChange:e=>{e||(r(!1),t())},children:e?(0,K.jsxs)(j,{className:`max-w-lg`,showCloseButton:!1,onInteractOutside:e=>e.preventDefault(),onEscapeKeyDown:e=>e.preventDefault(),children:[(0,K.jsxs)(z,{children:[(0,K.jsx)(B,{children:E()}),(0,K.jsx)(R,{children:S({name:e.accountName})})]}),(0,K.jsx)(`div`,{className:`oc-sa__minted-warning`,children:O()}),(0,K.jsxs)(`div`,{className:`oc-sa__minted-box`,children:[(0,K.jsx)(`code`,{className:`oc-sa__minted-plain`,children:e.plaintext}),(0,K.jsxs)(A,{variant:`outline`,size:`sm`,onClick:()=>void a(),"aria-label":_(),children:[n?(0,K.jsx)(Qe,{}):(0,K.jsx)(M,{}),n?i():_e()]})]}),(0,K.jsx)(V,{children:(0,K.jsx)(A,{onClick:()=>{r(!1),t()},children:m()})})]}):null})}function Z(e){return new Date(e).toLocaleString(`fr-FR`)}function Q(e){return e===null?!1:Date.now()-e>q}function ft(e){return e===null?T():new Date(e).toLocaleString(`fr-FR`)}function pt(e){return e===null?`—`:new Date(e).toLocaleDateString(`fr-FR`)}function $(e){return e.disabled?(0,K.jsx)(P,{variant:`destructive`,children:ue()}):e.expiresAt!==null&&e.expiresAt<Date.now()?(0,K.jsx)(P,{variant:`outline`,children:s()}):(0,K.jsx)(P,{variant:`outline`,children:u()})}export{X as ServiceAccountsTab};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$C as r,$S as i,$x as a,AS as o,BS as s,CS as c,DS as l,ES as u,FS as d,GS as f,Gw as p,Gx as m,HS as h,IS as g,JS as _,Jx as v,KS as y,Kw as ee,Kx as te,LS as ne,MS as re,NS as ie,OS as ae,PS as oe,QC as se,QS as ce,Qw as b,Qx as le,RS as ue,SS as de,TS as fe,US as pe,VS as me,WS as he,XS as ge,Xx as _e,YS as ve,Yw as ye,Yx as x,ZS as be,Zw as S,Zx as xe,_S as Se,aC as Ce,aS as we,bS as Te,cC as Ee,cS as De,dC as Oe,dS as C,eC as ke,eS as Ae,fC as je,fS as Me,gS as Ne,gw as Pe,hS as Fe,hw as Ie,iC as Le,iS as Re,jS as ze,kS as Be,lC as Ve,lS as He,mS as Ue,mw as We,n as Ge,nC as Ke,nS as qe,oC as Je,oS as Ye,pC as Xe,pS as Ze,qS as Qe,qx as $e,rC as w,rS as et,sC as tt,sS as nt,tC as rt,tS as it,uC as at,uS as ot,vS as st,wS as ct,xS as lt,yS as ut,zS as dt}from"./dist-Cci6Ggjl.js";import{n as T}from"./dist-xA--peN1.js";import{t as ft}from"./TimeRangePicker-BP0hPL2e.js";import{t as E}from"./x-VwKg9NoU.js";import{t as D}from"./button-nO0gX-NR.js";import{E as O,G as pt,J as k,K as A,W as mt,X as j,Y as ht,Z as M,_ as N,at as gt,b as P,it as _t,ot as F,q as vt,v as I,wt as L,x as R,y as z}from"./index-C6XDcLXH.js";import{a as yt,i as bt,n as xt,o as St,r as Ct,t as wt}from"./card-BZOj8vDF.js";import{a as Tt,i as B,n as Et,o as V,r as H,t as Dt}from"./table-CQttJ0e5.js";import{t as Ot}from"./FilterBar-RytfYInF.js";import{t as kt}from"./AdvancedFilter-CO_XQQz0.js";var U=ee(`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`}]]),W=t(e(),1),At=.1,jt=[248,248,248],Mt=[24,24,24];function Nt(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 Pt(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 G(e,t,n){return Pt(e,t,n)>=At}function Ft(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 It(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 Lt=12*1024*1024,Rt=480,zt=160,Bt=.92;async function Vt(e,t={}){if(!e.type.startsWith(`image/`))throw Error(Ue());if(e.size>Lt)throw Error(Ze());let{source:n,width:r,height:i,cleanup:a}=await Ht(e);try{let a=e.type===`image/svg+xml`,o=Math.min(Rt/r,zt/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=Nt(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);G(e.data,d.width,d.height)?Ft(e.data,t.variantFor===`dark`?jt:Mt):It(e.data),p.putImageData(e,0,0)}let m=G(p.getImageData(0,0,d.width,d.height).data,d.width,d.height),h=await q(f,`image/webp`,Bt)??await q(f,`image/png`);if(!h)throw Error(ot());return{blob:h,hasAlpha:m}}finally{a()}}async function Ht(e){if(e.type===`image/svg+xml`)return K(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 K(e)}async function K(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(Me())),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 q(e,t,n){return new Promise(r=>e.toBlob(e=>r(e),t,n))}var J=n(),Y=`__all__`,X={kind:`relative`,from:`now-24h`,to:`now`},Ut=[{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,J.jsxs)(`section`,{className:`oc-show__section`,children:[(0,J.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,J.jsx)(`h2`,{className:`oc-show__title`,children:e}),t?(0,J.jsx)(`p`,{className:`oc-show__desc`,children:t}):null]}),(0,J.jsx)(`div`,{className:`oc-show__demo`,children:n})]})}function Wt(e){return e===`light`?Pe():e===`dark`?Ie():We()}var Gt=[`primary`,`secondary`,`accent`,`muted`,`chart-1`,`chart-2`];function Kt({tokens:e,mode:t}){let n=e.colors[t];return(0,J.jsx)(`div`,{className:`oc-chart-swatches`,"aria-hidden":!0,children:Gt.map(e=>{let t=n[e];return(0,J.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,J.jsxs)(`button`,{type:`button`,className:Ge(`oc-chart-card`,e&&`oc-chart-card--selected`),"aria-pressed":e,onClick:a,children:[(0,J.jsxs)(`div`,{className:`oc-chart-card__head`,children:[(0,J.jsx)(`span`,{className:`oc-chart-card__title`,children:t}),e?(0,J.jsx)(T,{className:`size-4 text-primary`,"aria-hidden":!0}):null]}),r?(0,J.jsx)(Kt,{tokens:r,mode:i}):(0,J.jsx)(`div`,{className:`oc-chart-swatches oc-chart-swatches--native`,"aria-hidden":!0}),(0,J.jsx)(`div`,{className:`oc-chart-card__meta`,children:(0,J.jsx)(`span`,{className:`oc-chart-card__subtitle`,children:n})})]})}function qt({selectedKey:e,resolvedMode:t}){let n=b(p.charts.listMyCharts),r=S(p.charts.setMyChart);async function a(e){try{await r({name:e})}catch{}}return(0,J.jsxs)(`section`,{className:`oc-show__section`,children:[(0,J.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,J.jsx)(`h2`,{className:`oc-show__title`,children:Ce()}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:Le()})]}),(0,J.jsxs)(`div`,{className:`oc-chart-grid`,children:[(0,J.jsx)(Q,{selected:e===null,title:w(),subtitle:Ke(),tokens:null,mode:t,onSelect:()=>void a(null)}),(n??[]).map(n=>{let r=n.via===`common`?rt():n.via===`owner`?ke():i({group:n.via.group});return(0,J.jsx)(Q,{selected:e===n.key,title:n.name,subtitle:r,tokens:n.tokens,mode:t,onSelect:()=>void a(n.key)},n.key)})]}),n!==void 0&&n.length===0?(0,J.jsx)(`p`,{className:`oc-show__desc`,children:ce()}):null]})}function Jt(){let e=S(p.charts.importChart),[t,n]=(0,W.useState)(``),[r,i]=(0,W.useState)(``),[a,s]=(0,W.useState)(null),[c,l]=(0,W.useState)(!1),[u,f]=(0,W.useState)(!1);async function m(e){let t=e.target.files?.[0];if(e.target.value=``,t){s(null),l(!1);try{i(await t.text())}catch{s(o())}}}async function h(){if(s(null),l(!1),t.trim()===``){s(ae());return}let a;try{a=JSON.parse(r)}catch{s(o());return}f(!0);try{await e({name:t.trim(),tokens:a}),l(!0),n(``),i(``)}catch(e){s(e instanceof Error?e.message:String(e))}finally{f(!1)}}return(0,J.jsxs)(`section`,{className:`oc-show__section`,children:[(0,J.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,J.jsx)(`h2`,{className:`oc-show__title`,children:ue()}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:ne()})]}),(0,J.jsxs)(`div`,{className:`oc-chart-import`,children:[(0,J.jsxs)(`label`,{className:`oc-chart-import__field`,children:[(0,J.jsx)(`span`,{className:`oc-chart-import__label`,children:g()}),(0,J.jsx)(M,{value:t,onChange:e=>n(e.target.value),placeholder:d(),maxLength:60})]}),(0,J.jsxs)(`label`,{className:`oc-chart-import__field`,children:[(0,J.jsx)(`span`,{className:`oc-chart-import__label`,children:oe()}),(0,J.jsx)(`textarea`,{className:`oc-chart-import__textarea`,value:r,onChange:e=>i(e.target.value),placeholder:ie(),rows:8,spellCheck:!1})]}),(0,J.jsxs)(`div`,{className:`oc-show__row`,children:[(0,J.jsx)(D,{variant:`outline`,size:`sm`,asChild:!0,children:(0,J.jsxs)(`label`,{className:`oc-chart-import__file`,children:[(0,J.jsx)(U,{className:`size-4`}),re(),(0,J.jsx)(`input`,{type:`file`,accept:`application/json,.json`,className:`oc-chart-import__file-input`,onChange:e=>void m(e)})]})}),(0,J.jsx)(D,{size:`sm`,disabled:u,onClick:()=>void h(),children:ze()})]}),a?(0,J.jsx)(`p`,{className:`oc-chart-import__error`,children:a}):null,c?(0,J.jsx)(`p`,{className:`oc-chart-import__ok`,children:Be()}):null]})]})}function Yt({chart:e}){let t=ye(p.charts.setChartLogo),n=S(p.charts.removeChartLogo),[r,i]=(0,W.useState)(!1),[a,o]=(0,W.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 Vt(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,J.jsxs)(`div`,{className:`oc-chart-mine__logo-slot`,children:[(0,J.jsx)(`span`,{className:`oc-chart-mine__logo-mode`,children:e===`light`?lt():Te()}),(0,J.jsx)(`span`,{className:`oc-chart-mine__logo-preview`,"data-mode":e,"data-empty":t?void 0:`1`,children:t?(0,J.jsx)(`img`,{src:t,alt:``}):null}),(0,J.jsx)(D,{variant:`outline`,size:`sm`,asChild:!0,children:(0,J.jsxs)(`label`,{className:`oc-chart-import__file`,children:[(0,J.jsx)(U,{className:`size-4`}),t?st():ut(),(0,J.jsx)(`input`,{type:`file`,accept:`image/*`,className:`oc-chart-import__file-input`,onChange:t=>void l(e,t)})]})}),!t&&n?(0,J.jsx)(D,{variant:`ghost`,size:`sm`,disabled:r,onClick:()=>void d(e),children:Ne()}):null,t?(0,J.jsx)(D,{variant:`ghost`,size:`sm`,disabled:r,onClick:()=>void u(e),children:Se()}):null]})}return(0,J.jsxs)(`div`,{className:`oc-chart-mine__logo`,children:[(0,J.jsx)(`span`,{className:`oc-chart-mine__groups-label`,children:de()}),(0,J.jsxs)(`div`,{className:`oc-chart-mine__logo-slots`,children:[(0,J.jsx)(f,{mode:`light`}),(0,J.jsx)(f,{mode:`dark`})]}),r?(0,J.jsx)(`span`,{className:`oc-show__desc`,children:Fe()}):null,a?(0,J.jsx)(`p`,{className:`oc-chart-import__error`,children:a}):null]})}function $({chart:e}){let t=b(p.me.getMe,{host:F}),n=S(p.charts.addChartDomain),r=S(p.charts.removeChartDomain),[i,a]=(0,W.useState)(``),[o,s]=(0,W.useState)(null),[c,l]=(0,W.useState)(!1);if(t?.role!==`admin`)return null;let u=e.domains??[];async function d(){let t=i.trim();if(t!==``){s(null),l(!0);try{await n({chartKey:e.key,domain:t}),a(``)}catch(e){s(e instanceof Error?e.message:String(e))}finally{l(!1)}}}async function f(t){s(null);try{await r({chartKey:e.key,domain:t})}catch{}}return(0,J.jsxs)(`div`,{className:`oc-chart-mine__domains`,children:[(0,J.jsx)(`span`,{className:`oc-chart-mine__groups-label`,children:He()}),(0,J.jsxs)(`div`,{className:`oc-chart-mine__domains-body`,children:[(0,J.jsx)(`div`,{className:`oc-chart-avail__groups`,children:u.length===0?(0,J.jsx)(`span`,{className:`oc-show__desc`,children:we()}):u.map(e=>(0,J.jsxs)(j,{variant:`secondary`,className:`oc-chart-avail__chip`,children:[e,(0,J.jsx)(`button`,{type:`button`,className:`oc-chart-avail__chip-x`,"aria-label":Re({domain:e}),onClick:()=>void f(e),children:(0,J.jsx)(E,{className:`size-3`})})]},e))}),(0,J.jsxs)(`div`,{className:`oc-show__row`,children:[(0,J.jsx)(M,{value:i,onChange:e=>a(e.target.value),placeholder:nt(),className:`oc-chart-mine__domains-input`,onKeyDown:e=>{e.key===`Enter`&&d()}}),(0,J.jsx)(D,{variant:`outline`,size:`sm`,disabled:c,onClick:()=>void d(),children:Ye()})]}),(0,J.jsx)(`span`,{className:`oc-show__desc`,children:De()}),o?(0,J.jsx)(`p`,{className:`oc-chart-import__error`,children:o}):null]})]})}function Xt({chart:e}){let t=S(p.charts.updateChart),n=S(p.charts.deleteChart),[r,i]=(0,W.useState)(!1),[s,l]=(0,W.useState)(e.name),[u,d]=(0,W.useState)(()=>JSON.stringify(e.tokens,null,2)),[f,m]=(0,W.useState)(null),[h,g]=(0,W.useState)(!1);function _(){l(e.name),d(JSON.stringify(e.tokens,null,2)),m(null),i(!0)}async function v(){if(e.chartId===void 0)return;m(null);let n;try{n=JSON.parse(u)}catch{m(o());return}g(!0);try{await t({chartId:e.chartId,name:s.trim(),tokens:n}),i(!1)}catch(e){m(e instanceof Error?e.message:String(e))}finally{g(!1)}}async function y(){if(e.chartId!==void 0&&window.confirm(a()))try{await n({chartId:e.chartId})}catch{}}return(0,J.jsxs)(`div`,{className:`oc-chart-mine__row`,children:[(0,J.jsxs)(`div`,{className:`oc-chart-mine__head`,children:[(0,J.jsx)(`span`,{className:`oc-chart-mine__name`,children:e.name}),(0,J.jsx)(`div`,{className:`oc-show__row`,children:r?null:(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(D,{variant:`outline`,size:`sm`,onClick:_,children:ct()}),(0,J.jsx)(D,{variant:`ghost`,size:`sm`,onClick:()=>void y(),children:c()})]})})]}),r?(0,J.jsxs)(`div`,{className:`oc-chart-mine__editor`,children:[(0,J.jsxs)(`label`,{className:`oc-chart-import__field`,children:[(0,J.jsx)(`span`,{className:`oc-chart-import__label`,children:it()}),(0,J.jsx)(M,{value:s,onChange:e=>l(e.target.value),maxLength:60})]}),(0,J.jsxs)(`label`,{className:`oc-chart-import__field`,children:[(0,J.jsx)(`span`,{className:`oc-chart-import__label`,children:Ae()}),(0,J.jsx)(`textarea`,{className:`oc-chart-import__textarea`,value:u,onChange:e=>d(e.target.value),rows:10,spellCheck:!1})]}),f?(0,J.jsx)(`p`,{className:`oc-chart-import__error`,children:f}):null,(0,J.jsxs)(`div`,{className:`oc-show__row`,children:[(0,J.jsx)(D,{size:`sm`,disabled:h,onClick:()=>void v(),children:et()}),(0,J.jsx)(D,{variant:`ghost`,size:`sm`,onClick:()=>i(!1),children:qe()})]})]}):null,(0,J.jsx)(Yt,{chart:e}),(0,J.jsx)($,{chart:e})]})}function Zt(){let e=b(p.charts.listMyCharts),t=(e??[]).filter(e=>e.via===`owner`);return(0,J.jsxs)(`section`,{className:`oc-show__section`,children:[(0,J.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,J.jsx)(`h2`,{className:`oc-show__title`,children:l()}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:u()})]}),e!==void 0&&t.length===0?(0,J.jsx)(`p`,{className:`oc-show__desc`,children:fe()}):(0,J.jsx)(`div`,{className:`oc-chart-mine-list`,children:t.map(e=>(0,J.jsx)(Xt,{chart:e},e.key))})]})}function Qt({chart:e,groups:t}){let n=S(p.charts.addChartToGroupPool),r=S(p.charts.removeChartFromGroupPool),i=e.restrictedToGroups,a=e.poolGroups,o=new Set((a??[]).map(e=>e.groupId)),c=t.filter(e=>!o.has(e._id));async function l(t){try{await n({groupId:t,chartKey:e.key})}catch{}}async function u(t){try{await r({groupId:t,chartKey:e.key})}catch{}}return(0,J.jsxs)(`div`,{className:`oc-chart-avail`,children:[(0,J.jsxs)(`div`,{className:`oc-chart-avail__head`,children:[(0,J.jsx)(`span`,{className:`oc-chart-avail__name`,children:e.name}),(0,J.jsx)(j,{variant:i?`secondary`:`outline`,className:`oc-chart-avail__state`,children:i?he():e.kind===`custom`&&e.scope===`personal`?x():f()}),e.isGlobalDefault?(0,J.jsx)(j,{variant:`default`,children:pe()}):null]}),(0,J.jsxs)(`div`,{className:`oc-chart-avail__groups`,children:[(0,J.jsx)(`span`,{className:`oc-chart-mine__groups-label`,children:me()}),(a??[]).map(e=>(0,J.jsxs)(j,{variant:`secondary`,className:`oc-chart-avail__chip`,children:[e.name,(0,J.jsx)(`button`,{type:`button`,className:`oc-chart-avail__chip-x`,"aria-label":dt({group:e.name}),onClick:()=>void u(e.groupId),children:(0,J.jsx)(E,{className:`size-3`})})]},e.groupId)),c.length>0?(0,J.jsxs)(N,{value:``,onValueChange:e=>void l(e),children:[(0,J.jsx)(P,{size:`sm`,className:`w-56`,children:(0,J.jsx)(R,{placeholder:s()})}),(0,J.jsx)(I,{children:c.map(e=>(0,J.jsx)(z,{value:e._id,children:e.name},e._id))})]}):t.length===0?(0,J.jsx)(`span`,{className:`oc-show__desc`,children:h()}):null]})]})}function $t({chart:e}){let t=S(p.charts.promoteChartToCommon),n=S(p.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(a()))try{await n({chartId:e.chartId})}catch{}}return(0,J.jsxs)(`div`,{className:`oc-chart-avail`,children:[(0,J.jsxs)(`div`,{className:`oc-chart-avail__head`,children:[(0,J.jsx)(`span`,{className:`oc-chart-avail__name`,children:e.name}),(0,J.jsx)(j,{variant:e.scope===`common`?`outline`:`secondary`,children:e.scope===`common`?v():x()}),e.ownerLabel?(0,J.jsx)(`span`,{className:`oc-show__desc`,children:_e({owner:e.ownerLabel})}):null]}),(0,J.jsxs)(`div`,{className:`oc-show__row`,children:[e.scope===`personal`?(0,J.jsx)(D,{variant:`outline`,size:`sm`,onClick:()=>void r(),children:$e()}):null,(0,J.jsx)(D,{variant:`ghost`,size:`sm`,onClick:()=>void i(),children:te()})]})]})}function en({defaultThemeMode:e,defaultLocale:t,defaultChartKey:n}){let i=S(p.admin.setDefaultThemeMode),a=S(p.admin.setDefaultLocale),o=S(p.charts.setDefaultChart),s=b(p.charts.listChartsAdmin),c=b(p.groups.listGroups,{}),l=e??`system`,u=t??`fr`;return(0,J.jsxs)(`div`,{className:`oc-appearance-admin`,children:[(0,J.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,J.jsx)(`h2`,{className:`oc-show__title`,children:tt()}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:Je()})]}),(0,J.jsxs)(`section`,{className:`oc-show__section`,children:[(0,J.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,J.jsx)(`h3`,{className:`oc-show__title`,children:be()}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:ge()})]}),(0,J.jsxs)(`div`,{className:`oc-show__row`,children:[(0,J.jsx)(D,{variant:n===null?`default`:`outline`,size:`sm`,onClick:()=>void o({name:null}),children:w()}),gt.map(e=>(0,J.jsx)(D,{variant:n===e.key?`default`:`outline`,size:`sm`,onClick:()=>void o({name:e.key}),children:e.name},e.key)),(s??[]).filter(e=>e.kind===`custom`&&e.scope===`common`).map(e=>(0,J.jsx)(D,{variant:n===e.key?`default`:`outline`,size:`sm`,onClick:()=>void o({name:e.key}),children:e.name},e.key))]})]}),(0,J.jsxs)(`section`,{className:`oc-show__section`,children:[(0,J.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,J.jsx)(`h3`,{className:`oc-show__title`,children:ve()}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:_()})]}),(0,J.jsx)(`div`,{className:`oc-chart-avail-list`,children:(s??[]).filter(e=>!(e.kind===`custom`&&e.scope===`common`)).map(e=>(0,J.jsx)(Qt,{chart:e,groups:c??[]},e.key))})]}),(0,J.jsxs)(`section`,{className:`oc-show__section`,children:[(0,J.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,J.jsx)(`h3`,{className:`oc-show__title`,children:Qe()}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:y()})]}),(0,J.jsx)(`div`,{className:`oc-chart-avail-list`,children:(s??[]).filter(e=>e.kind===`builtin`||e.scope===`common`).map(e=>(0,J.jsxs)(`div`,{className:`oc-chart-avail`,children:[(0,J.jsx)(`div`,{className:`oc-chart-avail__head`,children:(0,J.jsx)(`span`,{className:`oc-chart-avail__name`,children:e.name})}),(0,J.jsx)($,{chart:e})]},e.key))})]}),(0,J.jsxs)(`section`,{className:`oc-show__section`,children:[(0,J.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,J.jsx)(`h3`,{className:`oc-show__title`,children:le()}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:xe()})]}),(()=>{let e=(s??[]).filter(e=>e.kind===`custom`);return e.length===0?(0,J.jsx)(`p`,{className:`oc-show__desc`,children:m()}):(0,J.jsx)(`div`,{className:`oc-chart-avail-list`,children:e.map(e=>(0,J.jsx)($t,{chart:e},e.key))})})()]}),(0,J.jsxs)(`section`,{className:`oc-show__section`,children:[(0,J.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,J.jsx)(`h3`,{className:`oc-show__title`,children:Xe()}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:je()})]}),(0,J.jsx)(`div`,{className:`oc-show__row`,children:[`light`,`dark`,`system`].map(e=>(0,J.jsx)(D,{variant:l===e?`default`:`outline`,size:`sm`,onClick:()=>void i({mode:e}),children:Wt(e)},e))})]}),(0,J.jsxs)(`section`,{className:`oc-show__section`,children:[(0,J.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,J.jsx)(`h3`,{className:`oc-show__title`,children:Oe()}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:at()})]}),(0,J.jsx)(`div`,{className:`oc-show__row`,children:[`fr`,`en`].map(e=>(0,J.jsx)(D,{variant:u===e?`default`:`outline`,size:`sm`,onClick:()=>void a({locale:e}),children:e===`fr`?r():se()},e))}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:Ve()})]})]})}function tn(){let e=b(p.me.getMe,{host:F}),t=_t(e?.resolvedThemeMode);return(0,J.jsxs)(`div`,{className:`oc-appearance`,children:[(0,J.jsx)(qt,{selectedKey:e?.chartKey??null,resolvedMode:t}),(0,J.jsx)(Jt,{}),(0,J.jsx)(Zt,{}),e?.role===`admin`?(0,J.jsx)(en,{defaultThemeMode:e.defaultThemeMode,defaultLocale:e.defaultLocale,defaultChartKey:e.defaultChartKey}):null]})}function nn(){let[e,t]=(0,W.useState)(!0),[n,r]=(0,W.useState)(`per-user`),[i,a]=(0,W.useState)(``),[o,s]=(0,W.useState)(Y),[c,l]=(0,W.useState)(Y),[u,d]=(0,W.useState)(X),f=i!==``||o!==Y||c!==Y;function p(){a(``),s(Y),l(Y),d(X)}return(0,J.jsxs)(`div`,{className:`oc-show`,children:[(0,J.jsx)(tn,{}),(0,J.jsxs)(`details`,{className:`oc-show__ref`,children:[(0,J.jsx)(`summary`,{className:`oc-show__title`,children:Ee()}),(0,J.jsxs)(Z,{title:`Buttons`,description:`Variants`,children:[(0,J.jsxs)(`div`,{className:`oc-show__row`,children:[(0,J.jsx)(D,{children:`Default`}),(0,J.jsx)(D,{variant:`secondary`,children:`Secondary`}),(0,J.jsx)(D,{variant:`outline`,children:`Outline`}),(0,J.jsx)(D,{variant:`ghost`,children:`Ghost`}),(0,J.jsx)(D,{variant:`destructive`,children:`Destructive`}),(0,J.jsx)(D,{variant:`link`,children:`Link`})]}),(0,J.jsxs)(`div`,{className:`oc-show__row`,children:[(0,J.jsx)(D,{size:`sm`,children:`Small`}),(0,J.jsx)(D,{children:`Default`}),(0,J.jsx)(D,{size:`lg`,children:`Large`}),(0,J.jsx)(D,{size:`icon`,"aria-label":`more`,children:(0,J.jsx)(L,{})}),(0,J.jsx)(D,{disabled:!0,children:`Disabled`})]})]}),(0,J.jsx)(Z,{title:`Badges`,children:(0,J.jsxs)(`div`,{className:`oc-show__row`,children:[(0,J.jsx)(j,{children:`Default`}),(0,J.jsx)(j,{variant:`secondary`,children:`Secondary`}),(0,J.jsx)(j,{variant:`outline`,children:`Outline`}),(0,J.jsx)(j,{variant:`destructive`,children:`Destructive`})]})}),(0,J.jsx)(Z,{title:`Inputs & selection`,children:(0,J.jsxs)(`div`,{className:`oc-show__row oc-show__row--col`,children:[(0,J.jsx)(M,{placeholder:`Text input…`}),(0,J.jsxs)(`div`,{className:`oc-show__row`,children:[(0,J.jsxs)(N,{value:n,onValueChange:r,children:[(0,J.jsx)(P,{className:`w-56`,children:(0,J.jsx)(R,{placeholder:`Select…`})}),(0,J.jsxs)(I,{children:[(0,J.jsx)(z,{value:`per-user`,children:`per-user (chacun son agent)`}),(0,J.jsx)(z,{value:`shared`,children:`shared (agent commun)`})]})]}),(0,J.jsxs)(`label`,{className:`oc-show__check`,children:[(0,J.jsx)(O,{checked:e,onCheckedChange:e=>t(!!e)}),`Checkbox`]})]})]})}),(0,J.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,J.jsxs)(`div`,{className:`oc-show__row oc-show__row--col`,children:[(0,J.jsxs)(Ot,{q:i,onQChange:a,searchPlaceholder:`Rechercher (kind, principal, rôle, route…)`,timeRange:u,onTimeRangeChange:d,onReset:p,canReset:f,children:[(0,J.jsxs)(N,{value:o,onValueChange:s,children:[(0,J.jsx)(P,{size:`sm`,children:(0,J.jsx)(R,{})}),(0,J.jsxs)(I,{children:[(0,J.jsx)(z,{value:Y,children:`Toutes directions`}),(0,J.jsx)(z,{value:`inbound`,children:`inbound`}),(0,J.jsx)(z,{value:`outbound`,children:`outbound`}),(0,J.jsx)(z,{value:`internal`,children:`internal`})]})]}),(0,J.jsxs)(N,{value:c,onValueChange:l,children:[(0,J.jsx)(P,{size:`sm`,children:(0,J.jsx)(R,{})}),(0,J.jsxs)(I,{children:[(0,J.jsx)(z,{value:Y,children:`Toutes sévérités`}),(0,J.jsx)(z,{value:`info`,children:`info`}),(0,J.jsx)(z,{value:`warn`,children:`warn`}),(0,J.jsx)(z,{value:`critical`,children:`critical`})]})]})]}),(0,J.jsx)(kt,{fields:Ut,onChange:()=>{}}),(0,J.jsxs)(`div`,{className:`oc-show__row`,children:[(0,J.jsx)(`span`,{className:`oc-show__desc`,children:`Sélecteur de plage seul :`}),(0,J.jsx)(ft,{value:u,onChange:d})]})]})}),(0,J.jsx)(Z,{title:`Dropdown menu`,description:`Row actions / kebab`,children:(0,J.jsxs)(mt,{children:[(0,J.jsx)(ht,{asChild:!0,children:(0,J.jsx)(D,{variant:`outline`,size:`icon`,"aria-label":`Open menu`,children:(0,J.jsx)(L,{})})}),(0,J.jsxs)(pt,{align:`start`,children:[(0,J.jsx)(vt,{children:`Actions`}),(0,J.jsx)(k,{}),(0,J.jsx)(A,{children:`Edit`}),(0,J.jsx)(A,{children:`Duplicate`}),(0,J.jsx)(k,{}),(0,J.jsx)(A,{variant:`destructive`,children:`Delete`})]})]})}),(0,J.jsx)(Z,{title:`Card`,children:(0,J.jsxs)(wt,{className:`w-80`,children:[(0,J.jsxs)(yt,{children:[(0,J.jsx)(St,{children:`Instance`}),(0,J.jsx)(Ct,{children:`Non-secret metadata only.`})]}),(0,J.jsx)(xt,{className:`text-sm text-muted-foreground`,children:`ws://gateway.example.org:18789`}),(0,J.jsxs)(bt,{className:`gap-2`,children:[(0,J.jsx)(D,{size:`sm`,children:`Save`}),(0,J.jsx)(D,{size:`sm`,variant:`ghost`,children:`Cancel`})]})]})}),(0,J.jsx)(Z,{title:`Table`,children:(0,J.jsxs)(Dt,{children:[(0,J.jsx)(Tt,{children:(0,J.jsxs)(V,{children:[(0,J.jsx)(B,{className:`w-8`,children:(0,J.jsx)(O,{"aria-label":`select all`})}),(0,J.jsx)(B,{children:`Name`}),(0,J.jsx)(B,{children:`Mode`}),(0,J.jsx)(B,{className:`text-right`,children:`Status`}),(0,J.jsx)(B,{className:`w-8`})]})}),(0,J.jsx)(Et,{children:[{n:`admins`,m:`per-user`,s:`active`},{n:`family`,m:`shared`,s:`active`}].map(e=>(0,J.jsxs)(V,{children:[(0,J.jsx)(H,{children:(0,J.jsx)(O,{"aria-label":`select ${e.n}`})}),(0,J.jsx)(H,{className:`font-medium`,children:e.n}),(0,J.jsx)(H,{children:(0,J.jsx)(j,{variant:`secondary`,children:e.m})}),(0,J.jsx)(H,{className:`text-right`,children:(0,J.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-muted-foreground`,children:[(0,J.jsx)(T,{className:`size-3.5`}),` `,e.s]})}),(0,J.jsx)(H,{children:(0,J.jsx)(D,{variant:`ghost`,size:`icon`,"aria-label":`row actions`,children:(0,J.jsx)(L,{})})})]},e.n))})]})}),(0,J.jsx)(Z,{title:`App fragments`,description:`Chat-specific components`,children:(0,J.jsxs)(`div`,{className:`oc-show__row oc-show__row--col`,children:[(0,J.jsx)(`div`,{className:`oc-msg oc-msg--assistant`,children:(0,J.jsx)(`div`,{className:`oc-msg__body`,children:`Assistant message bubble.`})}),(0,J.jsx)(`div`,{className:`oc-tool oc-tool--completed`,children:(0,J.jsxs)(`div`,{className:`oc-tool__header`,children:[(0,J.jsx)(`span`,{className:`oc-tool__icon`,children:`✓`}),(0,J.jsx)(`span`,{className:`oc-tool__name`,children:`write-file`}),(0,J.jsx)(`span`,{className:`oc-tool__phase`,children:`completed`})]})}),(0,J.jsxs)(`div`,{className:`oc-run-status oc-run-status--streaming`,children:[(0,J.jsx)(`span`,{className:`oc-run-status__dot`}),(0,J.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{
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Kw as r,_s as i,cs as a,ds as o,fs as s,gs as c,hs as l,ls as u,ms as d,os as f,ps as p,ss as m,us as h,vs as g}from"./dist-Cci6Ggjl.js";import{t as _}from"./button-nO0gX-NR.js";import{Z as v,ct as y,lt as b,st as x,ut as S,vt as C}from"./index-C6XDcLXH.js";var w=r(`clock`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 6v6l4 2`,key:`mmk7yg`}]]),T=t(e(),1),E={s:1e3,m:6e4,h:36e5,d:864e5,w:6048e5};function D(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=E[r[2]];return!Number.isFinite(i)||a===void 0?null:t-i*a}function O(e,t=Date.now()){return e.kind===`absolute`?{from:e.from,to:e.to}:{from:D(e.from,t)??t-E.h,to:D(e.to,t)??t}}var k=[{label:g(),from:`now-5m`},{label:i(),from:`now-15m`},{label:c(),from:`now-30m`},{label:l(),from:`now-1h`},{label:d(),from:`now-3h`},{label:p(),from:`now-6h`},{label:s(),from:`now-12h`},{label:o(),from:`now-24h`},{label:h(),from:`now-2d`},{label:u(),from:`now-7d`},{label:a(),from:`now-30d`},{label:m(),from:`now-90d`},{label:f(),from:`now-520w`}];function A(e){return new Date(e).toLocaleString(`fr-FR`,{day:`2-digit`,month:`2-digit`,hour:`2-digit`,minute:`2-digit`})}function j(e){if(e.kind===`relative`){let t=k.find(t=>t.from===e.from&&e.to===`now`);return t?t.label:`${e.from} → ${e.to}`}return`${A(e.from)} → ${A(e.to)}`}function M(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 N(e){if(e===``)return null;let t=new Date(e).getTime();return Number.isNaN(t)?null:t}function P(e){let t=e.trim();return t===`true`?!0:t===`false`?!1:t!==``&&Number.isFinite(Number(t))?Number(t):e}var F=n();function I(e){let[t,n]=(0,T.useState)(0);return(0,T.useEffect)(()=>{if(e.kind!==`relative`)return;let t=window.setInterval(()=>n(e=>e+1),3e4);return()=>window.clearInterval(t)},[e.kind]),(0,T.useMemo)(()=>{let{from:t,to:n}=O(e);return e.kind===`absolute`?{from:t,to:n}:{from:L(t),to:L(n)}},[e,t])}function L(e){return Math.floor(e/6e4)*6e4}function R({value:e,onChange:t}){let[n,r]=(0,T.useState)(!1),[i,a]=(0,T.useState)(``),o=O(e),[s,c]=(0,T.useState)(()=>M(o.from)),[l,u]=(0,T.useState)(()=>M(o.to));function d(t){if(t){let t=O(e);c(M(t.from)),u(M(t.to)),a(``)}r(t)}function f(e){t({kind:`relative`,from:e,to:`now`}),r(!1)}function p(){let e=N(s),n=N(l);e===null||n===null||(t({kind:`absolute`,from:e,to:n}),r(!1))}let m=(0,T.useMemo)(()=>{let e=i.trim().toLowerCase();return e===``?k:k.filter(t=>t.label.toLowerCase().includes(e)||t.from.toLowerCase().includes(e))},[i]),h=N(s)!==null&&N(l)!==null;return(0,F.jsxs)(b,{open:n,onOpenChange:d,children:[(0,F.jsx)(S,{asChild:!0,children:(0,F.jsxs)(_,{variant:`outline`,size:`sm`,className:`oc-timerange__trigger`,children:[(0,F.jsx)(w,{}),j(e)]})}),(0,F.jsx)(y,{children:(0,F.jsx)(x,{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,F.jsxs)(`div`,{className:`oc-timerange__cols`,children:[(0,F.jsxs)(`div`,{className:`oc-timerange__absolute`,children:[(0,F.jsx)(`div`,{className:`oc-timerange__section-title`,children:`Plage absolue`}),(0,F.jsxs)(`label`,{className:`oc-field`,children:[(0,F.jsx)(`span`,{className:`oc-field__label`,children:`De`}),(0,F.jsx)(v,{type:`datetime-local`,value:s,onChange:e=>c(e.target.value)})]}),(0,F.jsxs)(`label`,{className:`oc-field`,children:[(0,F.jsx)(`span`,{className:`oc-field__label`,children:`À`}),(0,F.jsx)(v,{type:`datetime-local`,value:l,onChange:e=>u(e.target.value)})]}),(0,F.jsx)(_,{size:`sm`,className:`oc-timerange__apply`,disabled:!h,onClick:p,children:`Appliquer`})]}),(0,F.jsxs)(`div`,{className:`oc-timerange__relative`,children:[(0,F.jsxs)(`div`,{className:`oc-timerange__search`,children:[(0,F.jsx)(C,{className:`oc-timerange__search-icon`,"aria-hidden":!0}),(0,F.jsx)(v,{value:i,onChange:e=>a(e.target.value),placeholder:`Rechercher une plage`,"aria-label":`Rechercher une plage relative`})]}),(0,F.jsx)(`ul`,{className:`oc-timerange__list`,children:m.length===0?(0,F.jsx)(`li`,{className:`oc-timerange__empty`,children:`Aucune plage.`}):m.map(t=>(0,F.jsx)(`li`,{children:(0,F.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{I as n,P as r,R as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$l as r,A_ as i,Al as a,B_ as o,Bl as s,C_ as c,D_ as l,E_ as u,F_ as d,Fl as f,G_ as p,Gl as m,Gw as h,H_ as g,Hl as _,I_ as v,Il as y,Jl as b,K_ as x,Kl as S,Kw as C,L_ as ee,Ll as te,M_ as w,Ml as ne,N_ as T,Nl as re,O_ as E,P_ as D,Pl as ie,Ql as ae,Qw as O,R_ as oe,Rl as se,S_ as k,T_ as A,U_ as j,Ul as ce,V_ as M,Vl as le,W_ as ue,Wl as de,Xl as fe,Yl as pe,Zl as me,Zw as N,__ as he,a_ as ge,au as _e,c_ as ve,cu as ye,d_ as be,du as xe,eu as Se,f_ as Ce,fu as we,g_ as Te,h_ as P,i_ as F,iu as Ee,j_ as I,jl as L,k_ as De,kl as Oe,l_ as ke,lu as Ae,m_ as je,nu as Me,o_ as Ne,ou as Pe,p_ as Fe,pu as Ie,ql as Le,r_ as Re,ru as ze,s_ as Be,su as Ve,tu as He,u_ as Ue,uu as We,w_ as Ge,z_ as Ke,zl as qe}from"./dist-Cci6Ggjl.js";import{n as Je}from"./dist-xA--peN1.js";import{n as R}from"./TimeRangePicker-BP0hPL2e.js";import{t as Ye}from"./x-VwKg9NoU.js";import{i as z,n as B,r as Xe,t as Ze}from"./tabs-D-DUf5Yr.js";import{t as V}from"./button-nO0gX-NR.js";import{$ as Qe,At as $e,Ct as et,Et as tt,Q as nt,X as H,_ as U,a as rt,b as W,et as it,i as at,k as ot,kt as st,nt as ct,o as lt,ot as ut,r as dt,rt as ft,v as G,x as K,y as q}from"./index-C6XDcLXH.js";import{t as pt}from"./FilterBar-RytfYInF.js";import{t as mt}from"./AdvancedFilter-CO_XQQz0.js";import{t as ht}from"./DataTableShell-B44W_69s.js";var gt=C(`eye-off`,[[`path`,{d:`M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49`,key:`ct8e1f`}],[`path`,{d:`M14.084 14.158a3 3 0 0 1-4.242-4.242`,key:`151rxh`}],[`path`,{d:`M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143`,key:`13bj9a`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}]]),_t=C(`gauge`,[[`path`,{d:`m12 14 4-4`,key:`9kzdfg`}],[`path`,{d:`M3.34 19a10 10 0 1 1 17.32 0`,key:`19p75a`}]]),vt=C(`scroll-text`,[[`path`,{d:`M15 12h-5`,key:`r7krc0`}],[`path`,{d:`M15 8h-5`,key:`1khuty`}],[`path`,{d:`M19 17V5a2 2 0 0 0-2-2H4`,key:`zz82l3`}],[`path`,{d:`M8 21h12a2 2 0 0 0 2-2v-1a1 1 0 0 0-1-1H11a1 1 0 0 0-1 1v1a2 2 0 1 1-4 0V5a2 2 0 1 0-4 0v2a1 1 0 0 0 1 1h3`,key:`1ph1d7`}]]),J=t(e(),1),Y=n(),X={kind:`relative`,from:`now-520w`,to:`now`},Z=e=>e===null?`-`:String(Math.round(e));function yt(e){let t=e.indexOf(`:`);if(t<0)return e;let n=e.slice(0,t),r=e.slice(t+1);return n===`admin`?l():n===`agent`?`${u()} - ${r}`:e}function bt(){let e=O(h.me.getMe,{host:ut})?.role===`admin`,t=O(h.deliveryTiming.getDeliveryStatus,{}),n=N(h.deliveryTiming.startDeliveryRecord),r=N(h.deliveryTiming.stopDeliveryRecord),[i,a]=(0,J.useState)(!1),[o,s]=(0,J.useState)(!1),c=t?.recording??!1,l=async()=>{s(!0);try{c?await r({}):await n({})}finally{s(!1)}};return(0,Y.jsxs)(`section`,{className:`mb-4 flex flex-col gap-3 rounded-lg border border-border p-4`,children:[(0,Y.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`h3`,{className:`text-sm font-semibold`,children:x()}),(0,Y.jsx)(`p`,{className:`oc-admin__hint`,children:p()})]}),e?(0,Y.jsx)(V,{variant:c?`destructive`:`default`,size:`sm`,disabled:o||t===void 0,onClick:()=>void l(),children:c?j():ue()}):null]}),c?(0,Y.jsxs)(`p`,{className:`flex items-center gap-2 text-sm`,children:[(0,Y.jsx)(H,{variant:`secondary`,children:g()}),t?.startedAt?(0,Y.jsx)(`span`,{className:`text-muted-foreground`,children:M({time:new Date(t.startedAt).toLocaleTimeString()})}):null]}):null,(0,Y.jsx)(`div`,{children:(0,Y.jsx)(V,{variant:`outline`,size:`sm`,onClick:()=>a(e=>!e),children:i?oe():Ke()})}),i?(0,Y.jsx)(xt,{isAdmin:e}):null]})}function xt({isAdmin:e}){let t=O(h.deliveryTiming.listDeliverySessions,{}),n=N(h.deliveryTiming.deleteDeliverySessions),[r,a]=(0,J.useState)(``),[o,s]=(0,J.useState)(`all`),[l,u]=(0,J.useState)(X),[f,p]=(0,J.useState)(null),{from:m,to:g}=R(l),_=l.to===`now`?1/0:g,y=r.trim()!==``||o!==`all`||l!==X,b=()=>{a(``),s(`all`),u(X)},x=(0,J.useMemo)(()=>{if(t===void 0)return;let e=r.trim().toLowerCase();return t.filter(t=>(e===``||t.startedBy.toLowerCase().includes(e))&&(o===`all`||(o===`active`?t.active:!t.active))&&t.startedAt>=m&&t.startedAt<=_).map(e=>({...e,_id:e.sessionId}))},[t,r,o,m,_]),S=e=>{let t=new Set((x??[]).map(e=>e.sessionId)),r=e.filter(e=>t.has(e));r.length!==0&&(n({sessionIds:r}),f!==null&&r.includes(f)&&p(null))};return(0,Y.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Y.jsx)(pt,{q:r,onQChange:a,searchPlaceholder:v(),timeRange:l,onTimeRangeChange:u,onReset:b,canReset:y,children:(0,Y.jsxs)(U,{value:o,onValueChange:e=>s(e),children:[(0,Y.jsx)(W,{size:`sm`,className:`w-36`,children:(0,Y.jsx)(K,{})}),(0,Y.jsxs)(G,{children:[(0,Y.jsx)(q,{value:`all`,children:d()}),(0,Y.jsx)(q,{value:`active`,children:D()}),(0,Y.jsx)(q,{value:`stopped`,children:T()})]})]})}),(0,Y.jsx)(ht,{title:ee(),rows:x,emptyHint:F(),columns:[{header:``,className:`w-8`,cell:e=>(0,Y.jsx)(V,{variant:`ghost`,size:`icon`,"aria-label":f===e.sessionId?Ge():A(),onClick:()=>p(t=>t===e.sessionId?null:e.sessionId),children:f===e.sessionId?(0,Y.jsx)(gt,{size:15,"aria-hidden":!0}):(0,Y.jsx)(et,{size:15,"aria-hidden":!0})})},{header:w(),sort:e=>e.startedAt,cell:e=>(0,Y.jsx)(`span`,{className:`tabular-nums`,children:new Date(e.startedAt).toLocaleString()})},{header:I(),sort:e=>e.stoppedAt,cell:e=>e.stoppedAt===null?(0,Y.jsx)(`span`,{className:`text-muted-foreground`,children:`-`}):(0,Y.jsx)(`span`,{className:`tabular-nums`,children:new Date(e.stoppedAt).toLocaleString()})},{header:i(),sort:e=>e.count,cell:e=>(0,Y.jsx)(`span`,{className:`tabular-nums`,children:Z(e.count)})},{header:De(),sort:e=>e.startedBy,cell:e=>yt(e.startedBy)},{header:E(),sort:e=>e.active,cell:e=>e.active?(0,Y.jsx)(H,{variant:`secondary`,children:D()}):(0,Y.jsx)(`span`,{className:`text-muted-foreground`,children:T()})}],rowActions:e?e=>[{label:c(),variant:`destructive`,onSelect:()=>S([e.sessionId])}]:void 0,bulkActions:e?[{label:c(),variant:`destructive`,onSelect:e=>S(e)}]:void 0,isExpanded:e=>e.sessionId===f,renderExpanded:e=>(0,Y.jsx)(St,{sessionId:e.sessionId})})]})}function St({sessionId:e}){let t=O(h.deliveryTiming.getDeliveryReport,{sessionId:e}),[n,r]=(0,J.useState)(!1);return(0,Y.jsx)(Ct,{report:t,copied:n,onCopy:()=>{t&&navigator.clipboard?.writeText(ot(t)).then(()=>{r(!0),window.setTimeout(()=>r(!1),1200)}).catch(()=>{})}})}function Ct({report:e,copied:t,onCopy:n}){if(!e)return(0,Y.jsx)(`p`,{className:`oc-admin__hint`,children:k()});if(e.count===0||e.segments===null)return(0,Y.jsx)(`p`,{className:`oc-admin__hint`,children:o()});let r=e.segments,i=(e,t)=>(0,Y.jsxs)(`tr`,{className:`border-t border-border`,children:[(0,Y.jsx)(`td`,{className:`py-1`,children:e}),(0,Y.jsx)(`td`,{className:`py-1 text-right tabular-nums`,children:t.count}),(0,Y.jsxs)(`td`,{className:`py-1 text-right tabular-nums`,children:[Z(t.p50),` / `,Z(t.p95),` / `,Z(t.max)]})]});return(0,Y.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,Y.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[e.count,` `,Re()]}),(0,Y.jsxs)(V,{variant:`outline`,size:`sm`,onClick:n,children:[t?(0,Y.jsx)(Je,{size:13,"aria-hidden":!0}):(0,Y.jsx)(tt,{size:13,"aria-hidden":!0}),t?ge():Ne()]})]}),(0,Y.jsxs)(`table`,{className:`w-full text-sm`,children:[(0,Y.jsx)(`thead`,{children:(0,Y.jsxs)(`tr`,{className:`text-left text-muted-foreground`,children:[(0,Y.jsx)(`th`,{className:`py-1 font-medium`,children:P()}),(0,Y.jsx)(`th`,{className:`py-1 text-right font-medium`,children:je()}),(0,Y.jsx)(`th`,{className:`py-1 text-right font-medium`,children:Fe()})]})}),(0,Y.jsxs)(`tbody`,{children:[i(Ce(),r.bridge),i(be(),r.A),i(Ue(),r.C)]})]}),(0,Y.jsx)(`p`,{className:`oc-admin__hint`,children:ke()}),e.truncated?(0,Y.jsx)(`p`,{className:`oc-admin__hint`,children:Be()}):null,(0,Y.jsx)(`p`,{className:`oc-admin__hint`,children:ve()})]})}var wt=[50,100,200,500],Tt=`all`,Q=`__all__`,Et=[`2xx`,`4xx`,`5xx`],Dt=[`user`,`service`,`system`],Ot=[`inbound`,`outbound`,`internal`],kt={kind:`relative`,from:`now-30d`,to:`now`},At=[{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 jt(){let e=$e({from:`/settings/traces`}),t=st({from:`/settings/traces`}),n=e.limit,i=e.kind,a=e.statusClass??Q,o=e.principalType??Q,c=e.direction??Q,l=e.roleKey??Q,u=e.q??``,d=dt(e.from,e.to),p=(0,J.useMemo)(()=>lt(e.adv),[e.adv]),{from:g,to:v}=R(d),[x,C]=(0,J.useState)(null),[ee,w]=(0,J.useState)(null),T=e=>void t({search:t=>({...t,limit:e})}),E=e=>void t({search:t=>({...t,kind:e})}),D=e=>void t({search:t=>({...t,q:e||void 0}),replace:!0}),oe=e=>void t({search:t=>({...t,statusClass:e===Q?void 0:e})}),k=e=>void t({search:t=>({...t,principalType:e===Q?void 0:e})}),A=e=>void t({search:t=>({...t,direction:e===Q?void 0:e})}),j=e=>void t({search:t=>({...t,roleKey:e===Q?void 0:e})}),M=e=>void t({search:t=>({...t,...rt(e)})}),ue=e=>void t({search:t=>({...t,adv:at(e)}),replace:!0}),N=O(h.observability.listEvents,{limit:n}),ge=O(h.observability.listEvents,{limit:n,kind:i===Tt?void 0:i,filter:{q:u||void 0,from:g,to:v,statusClass:a===Q?void 0:a,principalType:o===Q?void 0:o,direction:c===Q?void 0:c,roleKey:l===Q?void 0:l,advanced:p.length>0?p:void 0}}),ve=(0,J.useMemo)(()=>{let e=new Set;for(let t of N??[])e.add(t.kind);return[...e].sort()},[N]),be=(0,J.useMemo)(()=>{let e=new Set;for(let t of N??[])t.roleKey&&e.add(t.roleKey);return[...e].sort()},[N]),Ce=u!==``||a!==Q||o!==Q||c!==Q||l!==Q||p.length>0||d.kind!==`relative`||d.from!==kt.from;function P(){t({search:{limit:100,kind:`all`},replace:!0})}let F=x?N?.filter(e=>e.correlationId===x):ge,[I,L]=(0,J.useState)(`events`);return(0,Y.jsxs)(Ze,{value:I,onValueChange:e=>L(e),children:[(0,Y.jsxs)(Xe,{className:`w-full`,children:[(0,Y.jsxs)(z,{value:`latency`,className:`flex-1 gap-1.5`,children:[(0,Y.jsx)(_t,{size:13,"aria-hidden":!0}),he()]}),(0,Y.jsxs)(z,{value:`events`,className:`flex-1 gap-1.5`,children:[(0,Y.jsx)(vt,{size:13,"aria-hidden":!0}),Te()]})]}),(0,Y.jsx)(B,{value:`latency`,children:(0,Y.jsx)(bt,{})}),(0,Y.jsxs)(B,{value:`events`,className:`flex flex-col gap-3`,children:[(0,Y.jsxs)(`p`,{className:`oc-admin__hint`,children:[Ie(),(0,Y.jsx)(`strong`,{children:we()}),xe(),` `,(0,Y.jsx)(`span`,{className:`oc-filter__window`,children:We()})]}),(0,Y.jsxs)(pt,{q:u,onQChange:D,searchPlaceholder:Ae(),timeRange:d,onTimeRangeChange:M,onReset:P,canReset:Ce,children:[(0,Y.jsxs)(U,{value:a,onValueChange:oe,children:[(0,Y.jsx)(W,{size:`sm`,className:`w-32`,children:(0,Y.jsx)(K,{placeholder:ye()})}),(0,Y.jsxs)(G,{children:[(0,Y.jsx)(q,{value:Q,children:Ve()}),Et.map(e=>(0,Y.jsx)(q,{value:e,children:e},e))]})]}),(0,Y.jsxs)(U,{value:o,onValueChange:k,children:[(0,Y.jsx)(W,{size:`sm`,className:`w-32`,children:(0,Y.jsx)(K,{placeholder:Pe()})}),(0,Y.jsxs)(G,{children:[(0,Y.jsx)(q,{value:Q,children:_e()}),Dt.map(e=>(0,Y.jsx)(q,{value:e,children:e},e))]})]}),(0,Y.jsxs)(U,{value:c,onValueChange:A,children:[(0,Y.jsx)(W,{size:`sm`,className:`w-32`,children:(0,Y.jsx)(K,{placeholder:Ee()})}),(0,Y.jsxs)(G,{children:[(0,Y.jsx)(q,{value:Q,children:ze()}),Ot.map(e=>(0,Y.jsx)(q,{value:e,children:e},e))]})]}),(0,Y.jsxs)(U,{value:l,onValueChange:j,children:[(0,Y.jsx)(W,{size:`sm`,className:`w-36`,children:(0,Y.jsx)(K,{placeholder:Me()})}),(0,Y.jsxs)(G,{children:[(0,Y.jsx)(q,{value:Q,children:He()}),be.map(e=>(0,Y.jsx)(q,{value:e,children:e},e))]})]}),(0,Y.jsxs)(U,{value:i,onValueChange:E,children:[(0,Y.jsx)(W,{size:`sm`,className:`w-44`,children:(0,Y.jsx)(K,{placeholder:Se()})}),(0,Y.jsxs)(G,{children:[(0,Y.jsx)(q,{value:Tt,children:r()}),ve.map(e=>(0,Y.jsx)(q,{value:e,children:e},e))]})]}),(0,Y.jsxs)(U,{value:String(n),onValueChange:e=>T(Number(e)),children:[(0,Y.jsx)(W,{size:`sm`,className:`w-28`,children:(0,Y.jsx)(K,{})}),(0,Y.jsx)(G,{children:wt.map(e=>(0,Y.jsx)(q,{value:String(e),children:ae({count:e})},e))})]})]}),(0,Y.jsx)(mt,{fields:At,seed:p,onChange:ue}),x?(0,Y.jsx)(`div`,{className:`oc-traces__followline`,children:(0,Y.jsxs)(`button`,{type:`button`,className:`oc-traces__chip`,onClick:()=>C(null),title:me(),children:[(0,Y.jsxs)(`span`,{className:`oc-traces__chip-label`,children:[fe(),(0,Y.jsx)(`code`,{children:$(x)})]}),(0,Y.jsx)(Ye,{className:`oc-traces__chip-x`,"aria-hidden":!0}),(0,Y.jsx)(`span`,{className:`sr-only`,children:pe()})]})}):null,(0,Y.jsx)(ht,{title:b(),rows:F,emptyHint:x?Le():S(),columns:[{header:m(),sort:e=>e.at,cell:e=>(0,Y.jsx)(`span`,{className:`oc-traces__time`,children:new Date(e.at).toLocaleString(`fr-FR`)})},{header:de(),sort:e=>e.kind,cell:e=>(0,Y.jsx)(H,{variant:`secondary`,children:e.kind})},{header:ce(),sort:e=>Nt(e)??null,cell:e=>{let t=Nt(e);return t?(0,Y.jsxs)(`span`,{className:`oc-traces__fail`,title:t,children:[`✕ `,t]}):(0,Y.jsx)(`span`,{className:`oc-traces__ok`,"aria-label":_(),children:`✓`})}},{header:le(),sort:e=>e.direction,cell:e=>e.direction?(0,Y.jsx)(H,{variant:`outline`,children:e.direction}):(0,Y.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})},{header:s(),sort:e=>e.principalType,cell:e=>(0,Y.jsxs)(`span`,{className:`oc-traces__principal`,children:[(0,Y.jsx)(H,{variant:`outline`,children:e.principalType}),e.principalId?(0,Y.jsx)(`code`,{className:`oc-traces__mono`,children:$(e.principalId)}):null]})},{header:qe(),sort:e=>e.roleKey,cell:e=>e.roleKey?(0,Y.jsx)(H,{variant:`secondary`,children:e.roleKey}):(0,Y.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})},{header:se(),sort:e=>e.route,cell:e=>e.route?(0,Y.jsxs)(`span`,{className:`oc-traces__route`,children:[e.method?(0,Y.jsx)(`span`,{className:`oc-traces__method`,children:e.method}):null,(0,Y.jsx)(`code`,{className:`oc-traces__mono`,children:e.route})]}):(0,Y.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})},{header:te(),sort:e=>e.status,cell:e=>e.status===null?(0,Y.jsx)(`span`,{className:`oc-traces__muted`,children:`—`}):(0,Y.jsx)(`span`,{className:`oc-traces__status ${Mt(e.status)}`,children:e.status})},{header:y(),sort:e=>e.latencyMs,cell:e=>e.latencyMs===null?(0,Y.jsx)(`span`,{className:`oc-traces__muted`,children:`—`}):(0,Y.jsxs)(`span`,{className:`oc-traces__mono`,children:[e.latencyMs,` ms`]})},{header:f(),sort:e=>e.correlationId,cell:e=>e.correlationId?(0,Y.jsx)(`button`,{type:`button`,className:`oc-traces__corr`,title:ie(),onClick:()=>C(e.correlationId),children:$(e.correlationId)}):(0,Y.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})},{header:re(),sort:e=>+!!e.meta,cell:e=>e.meta?(0,Y.jsx)(V,{variant:`outline`,size:`sm`,onClick:()=>w(e),children:ne()}):(0,Y.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})}]}),(0,Y.jsx)(Pt,{row:ee,onClose:()=>w(null)})]})]})}function Mt(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 $(e){return e.length>8?e.slice(0,8):e}function Nt(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 Pt({row:e,onClose:t}){let n=(0,J.useMemo)(()=>{if(!e?.meta)return``;try{return JSON.stringify(JSON.parse(e.meta),null,2)}catch{return e.meta}},[e]);return(0,Y.jsx)(nt,{open:e!==null,onOpenChange:e=>{e||t()},children:e?(0,Y.jsxs)(Qe,{className:`max-w-lg`,children:[(0,Y.jsxs)(ct,{children:[(0,Y.jsxs)(ft,{className:`oc-traces__meta-title`,children:[L(),` `,(0,Y.jsx)(`code`,{children:e.kind}),(0,Y.jsx)(H,{variant:`outline`,children:a()})]}),(0,Y.jsx)(it,{children:Oe()})]}),(0,Y.jsx)(`pre`,{className:`oc-traces__meta-json`,children:n})]}):null})}export{jt as TracesTab};
|