@lacneu/atrium 0.14.0 → 0.16.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-CQwLWARe.js +1 -0
- package/dist/assets/AdvancedFilter-Dsn2CdBY.js +1 -0
- package/dist/assets/AgentFilesTab-Cnvrgsf0.js +3 -0
- package/dist/assets/AnomaliesTab-Dc0ZBmMT.js +1 -0
- package/dist/assets/AuditTab-Bi5vISLS.js +1 -0
- package/dist/assets/BridgeTab-H12vdjQc.js +1 -0
- package/dist/assets/ChatDefaultsTab-rV2R20Ad.js +1 -0
- package/dist/assets/{DataTableShell-B44W_69s.js → DataTableShell-67hI2aZh.js} +1 -1
- package/dist/assets/{DetailChips-SZr2PERg.js → DetailChips-CTU-lZny.js} +1 -1
- package/dist/assets/FeedbacksTab-CLE-RiFB.js +1 -0
- package/dist/assets/{FieldLabel-Dn9ltnAG.js → FieldLabel-D8l7ss4W.js} +1 -1
- package/dist/assets/FilesTab-DlWojbFd.js +1 -0
- package/dist/assets/{FilterBar-RytfYInF.js → FilterBar-DZBiB1MF.js} +1 -1
- package/dist/assets/GroupsTab-CdmZ136v.js +1 -0
- package/dist/assets/InstancesTab-BcQzLsnJ.js +1 -0
- package/dist/assets/IntegrationsTab-DFEnr5e6.js +1 -0
- package/dist/assets/KpiTab-BNADRVU3.js +1 -0
- package/dist/assets/PreferencesTab-CJUrE633.js +1 -0
- package/dist/assets/PromptInjectionsTab-C0cMSQ8x.js +2 -0
- package/dist/assets/RolesTab-Bwgnt5Nh.js +1 -0
- package/dist/assets/ServiceAccountsTab-C-KmfNqX.js +1 -0
- package/dist/assets/SubAgentReportsTab-DP-c7pwV.js +1 -0
- package/dist/assets/ThemeShowroom-ioH8EI6M.js +1 -0
- package/dist/assets/{TimeRangePicker-BP0hPL2e.js → TimeRangePicker-BJ_SDnZN.js} +1 -1
- package/dist/assets/TracesTab-CfxNJ_IN.js +1 -0
- package/dist/assets/UsersTab-C9upk4jg.js +1 -0
- package/dist/assets/{button-nO0gX-NR.js → button-HRR8tdJ2.js} +1 -1
- package/dist/assets/{card-BZOj8vDF.js → card-DdObfJrM.js} +1 -1
- package/dist/assets/chevrons-up-down-DLfMeWLX.js +1 -0
- package/dist/assets/compatView-Ihz_y_lK.js +1 -0
- package/dist/assets/dispatchErrorInfo-CiUDlf_q.js +1 -0
- package/dist/assets/dist-CKhDstdM.js +44 -0
- package/dist/assets/dist-CkXWG_t8.js +1 -0
- package/dist/assets/{dist-xA--peN1.js → dist-DErYNbMW.js} +1 -1
- package/dist/assets/dist-DdcF2Plv.js +5 -0
- package/dist/assets/{highlighted-body-OFNGDK62-DNgOAHiR.js → highlighted-body-OFNGDK62-rg7WOukZ.js} +1 -1
- package/dist/assets/index-DR0RpyTI.js +226 -0
- package/dist/assets/index-GVGG9WDP.css +2 -0
- package/dist/assets/mermaid-GHXKKRXX-CHQslKq1.js +1 -0
- package/dist/assets/roleDescriptions-B8pJ6mkq.js +1 -0
- package/dist/assets/{table-CQttJ0e5.js → table-fGxqLVNE.js} +1 -1
- package/dist/assets/{tabs-D-DUf5Yr.js → tabs-Bh17c652.js} +1 -1
- package/dist/assets/x-Dnhgu6fy.js +1 -0
- package/dist/index.html +8 -8
- package/package.json +1 -1
- package/dist/assets/AccessTab-De0sJr0t.js +0 -1
- package/dist/assets/AdvancedFilter-CO_XQQz0.js +0 -1
- package/dist/assets/AgentFilesTab-BpgoJ9RY.js +0 -3
- package/dist/assets/AnomaliesTab-DMFRiLxu.js +0 -1
- package/dist/assets/AuditTab-BLsAgUqt.js +0 -1
- package/dist/assets/BridgeTab-BWExnIBq.js +0 -1
- package/dist/assets/ChatDefaultsTab-DNy4hn4P.js +0 -1
- package/dist/assets/FeedbacksTab-B3mTF8gA.js +0 -1
- package/dist/assets/FilesTab-DrFmoPZJ.js +0 -1
- package/dist/assets/GroupsTab-NeGxwsGw.js +0 -1
- package/dist/assets/InstancesTab-D-zHqwWo.js +0 -1
- package/dist/assets/IntegrationsTab-BDbA-XQW.js +0 -1
- package/dist/assets/KpiTab-CD6Rk_3X.js +0 -1
- package/dist/assets/PreferencesTab-BAAGt839.js +0 -1
- package/dist/assets/PromptInjectionsTab-Cb-uPfgC.js +0 -2
- package/dist/assets/RolesTab-BY0jkajs.js +0 -1
- package/dist/assets/ServiceAccountsTab-BeNR30lB.js +0 -1
- package/dist/assets/ThemeShowroom-P8XIo-XT.js +0 -1
- package/dist/assets/TracesTab-CMVJpkgr.js +0 -1
- package/dist/assets/UsersTab-ZUaqS4l_.js +0 -1
- package/dist/assets/chevrons-up-down-BbTkkJkE.js +0 -1
- package/dist/assets/compatView-xxuYVFiT.js +0 -1
- package/dist/assets/dispatchErrorInfo-ByWow4dK.js +0 -1
- package/dist/assets/dist-Cci6Ggjl.js +0 -44
- package/dist/assets/dist-dF88UcEZ.js +0 -1
- package/dist/assets/dist-rCLg1WXy.js +0 -5
- package/dist/assets/index-C6XDcLXH.js +0 -226
- package/dist/assets/index-nayepuF0.css +0 -2
- package/dist/assets/mermaid-GHXKKRXX-DK3RngoE.js +0 -1
- package/dist/assets/roleDescriptions-BmCKM40P.js +0 -1
- package/dist/assets/x-VwKg9NoU.js +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$i as r,Gi as i,Ji as a,Ki as o,LT as s,Qi as c,Wi as l,Xi as u,Yi as d,Zi as f,_E as p,ea as m,ia as h,na as g,qi as _,ra as v,ta as y,uE as b}from"./dist-CKhDstdM.js";import{C as x,E as S,S as C,T as w,X as T,w as E}from"./index-DR0RpyTI.js";var D=t(e(),1);function O(e){return e===`user`?a():e===`all`?_():o({group:e.group})}function k(e){return e===`common`?i():e===`owner`?l():o({group:e.group})}var A=n();function j(e){return e.name||e.email||e.userId.slice(0,8)}function M(){let e=p(b.admin.listUsers,{}),[t,n]=(0,D.useState)(``),i=p(b.introspect.introspectUser,t?{userId:t}:`skip`);return(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:h()}),(0,A.jsxs)(C,{value:t,onValueChange:n,children:[(0,A.jsx)(w,{size:`sm`,"aria-label":v(),children:(0,A.jsx)(S,{placeholder:v()})}),(0,A.jsx)(x,{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:g()}):i===void 0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:s()}):(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:y()}),(0,A.jsxs)(`div`,{className:`oc-introspect__id`,children:[(0,A.jsx)(`strong`,{children:i.user.label}),(0,A.jsx)(T,{variant:`secondary`,children:i.role})]})]}),(0,A.jsxs)(`section`,{className:`oc-introspect__section`,children:[(0,A.jsx)(`h3`,{className:`oc-introspect__title`,children:m()}),i.groups.length===0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:u()}):(0,A.jsx)(`div`,{className:`oc-introspect__chips`,children:i.groups.map(e=>(0,A.jsx)(T,{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:r()}),i.agents.length===0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:u()}):(0,A.jsx)(`ul`,{className:`oc-introspect__list`,children:i.agents.map(e=>(0,A.jsxs)(`li`,{className:`oc-introspect__row`,children:[(0,A.jsx)(`span`,{className:`oc-introspect__name`,children:e.displayName||e.agentId}),e.isDefault?(0,A.jsx)(T,{variant:`default`,children:d()}):null,(0,A.jsx)(T,{variant:`outline`,children:O(e.via)}),(0,A.jsx)(T,{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()}),i.charts.length===0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:u()}):(0,A.jsx)(`ul`,{className:`oc-introspect__list`,children:i.charts.map(e=>(0,A.jsxs)(`li`,{className:`oc-introspect__row`,children:[(0,A.jsx)(`span`,{className:`oc-introspect__name`,children:e.name}),(0,A.jsx)(T,{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:f()}),i.permissions.length===0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:u()}):(0,A.jsx)(`div`,{className:`oc-introspect__chips`,children:i.permissions.map(e=>(0,A.jsx)(T,{variant:`secondary`,children:e},e))})]})]})]})}export{M as AccessTab};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{ds as r,fs as i,hs as a,ls as o,ms as s,ps as c,us as l}from"./dist-CKhDstdM.js";import{i as u}from"./dist-CkXWG_t8.js";import{r as d}from"./TimeRangePicker-BJ_SDnZN.js";import{t as f}from"./x-Dnhgu6fy.js";import{t as p}from"./button-HRR8tdJ2.js";import{C as m,E as h,S as g,T as _,Z as v,bt as y,w as b}from"./index-DR0RpyTI.js";var x=t(e(),1),S=n(),C=[{value:`eq`,label:`=`},{value:`neq`,label:`≠`},{value:`contains`,label:a()},{value:`gt`,label:`>`},{value:`gte`,label:`≥`},{value:`lt`,label:`<`},{value:`lte`,label:`≤`}],w=1;function T(){return{id:w++,field:``,op:`eq`,value:``}}function E(e){return e.map(e=>({id:w++,field:e.field,op:e.op,value:String(e.value)}))}function D({fields:e,seed:t,onChange:n}){let a=(0,x.useRef)(t),w=!!(a.current&&a.current.length>0),[D,O]=(0,x.useState)(w),[k,A]=(0,x.useState)(()=>w?E(a.current):[]);function j(e){n(e.filter(e=>e.field!==``&&e.value!==``).map(e=>({field:e.field,op:e.op,value: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}),s(),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)(g,{value:t.field||void 0,onValueChange:e=>M(t.id,{field:e}),children:[(0,S.jsx)(_,{size:`sm`,className:`w-40`,children:(0,S.jsx)(h,{placeholder:i()})}),(0,S.jsx)(m,{children:e.map(e=>(0,S.jsx)(b,{value:e.value,children:e.label},e.value))})]}),(0,S.jsxs)(g,{value:t.op,onValueChange:e=>M(t.id,{op:e}),children:[(0,S.jsx)(_,{size:`sm`,className:`w-28`,children:(0,S.jsx)(h,{})}),(0,S.jsx)(m,{children:C.map(e=>(0,S.jsx)(b,{value:e.value,children:e.label},e.value))})]}),(0,S.jsx)(v,{className:`oc-advfilter__value`,value:t.value,onChange:e=>M(t.id,{value:e.target.value}),placeholder:r()}),(0,S.jsx)(p,{variant:`ghost`,size:`icon-sm`,"aria-label":l(),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)(y,{}),o()]})]}):null]})}export{D as t};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{An as r,Bn as i,Cn as a,Dn as o,En as s,Fn as ee,In as c,LT as l,Ln as te,Mn as ne,Nn as u,On as d,Pn as re,Rn as ie,Sn as f,Sr as p,Tn as m,Vn as h,_E as g,_n as _,bn as v,br as ae,fn as y,gn as b,hn as x,jn as S,kb as C,kn as oe,mE as w,mn as T,pn as E,uE as D,vn as O,wn as k,xn as A,yn as j,zT as se,zn as M}from"./dist-CKhDstdM.js";import{t as N}from"./button-HRR8tdJ2.js";import{$ as P,A as F,B as I,C as L,D as R,E as z,F as ce,I as le,L as ue,N as de,P as fe,Q as pe,R as me,S as B,T as V,X as H,et as he,mt as U,nt as ge,ot as _e,rt as ve,w as W,z as ye}from"./index-DR0RpyTI.js";import{i as G}from"./compatView-Ihz_y_lK.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=g(D.me.getMe,{host:_e}),t=e?.role===`admin`,n=(e?.permissions??[]).includes(`bridge.read`),a=g(D.admin.listInstances,e!==void 0&&t?{}:`skip`),[o,s]=(0,K.useState)(null);(0,K.useEffect)(()=>{!t||!a||a.length===0||(!o||!a.some(e=>e.name===o))&&s(a[0].name)},[t,a,o]);let d=g(D.agents.listAgentsForInstance,t&&o?{instanceName:o}:`skip`),f=g(D.agents.listMyAgents,e!==void 0&&!t?{}:`skip`),p=(0,K.useMemo)(()=>{if(e!==void 0){if(t)return o===null||d===void 0?a!==void 0&&a.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,a,f]),[m,_]=(0,K.useState)(null);(0,K.useEffect)(()=>{!p||p.length===0||(!m||!p.some(e=>$(e)===m))&&_($(p[0]))},[p,m]);let v=p?.find(e=>$(e)===m)??null,y=w(D.agentFiles.listAgentFiles),[b,x]=(0,K.useState)({status:`idle`}),C=v?.instanceName??null,T=v?.agentId??null,E=g(D.compat.forInstance,n&&C!==null?{instanceName:C}:`skip`),O=n&&C!==null?R(E,`agentFiles`):null,k=O===null?!1:O===`loading`?null:O.blocked,A=(0,K.useCallback)(async()=>{if(!(C===null||T===null)){x({status:`loading`});try{x({status:`done`,files:(await y({instanceName:C,agentId:T})).files})}catch{x({status:`error`})}}},[y,C,T]);(0,K.useEffect)(()=>{k===!1&&A()},[A,k]);let[j,P]=(0,K.useState)(null),F=se(),I=(0,K.useMemo)(()=>new Intl.NumberFormat(F,{maximumFractionDigits:0}),[F]);return e===void 0||p===void 0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:l()}):(0,Q.jsxs)(`div`,{className:`oc-afiles`,children:[(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:h()}),(0,Q.jsxs)(`div`,{className:`oc-afiles__picker`,children:[t&&(a?.length??0)>1?(0,Q.jsxs)(B,{value:o??``,onValueChange:e=>s(e),children:[(0,Q.jsx)(V,{size:`sm`,"aria-label":i(),children:(0,Q.jsx)(z,{})}),(0,Q.jsx)(L,{children:(a??[]).map(e=>(0,Q.jsx)(W,{value:e.name,children:e.name},e.name))})]}):null,p.length>0?(0,Q.jsxs)(B,{value:m??``,onValueChange:e=>_(e),children:[(0,Q.jsx)(V,{size:`sm`,"aria-label":M(),children:(0,Q.jsx)(z,{})}),(0,Q.jsx)(L,{children:p.map(e=>(0,Q.jsx)(W,{value:$(e),children:e.label},$(e)))})]}):(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:ie()})]}),v===null?null:O===`loading`?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:l()}):O!==null&&O.blocked?(0,Q.jsxs)(`p`,{className:`oc-compat__blocked`,role:`status`,children:[(0,Q.jsx)(U,{size:14,"aria-hidden":!0}),` `,G(O.gatewayVersion)]}):b.status===`loading`||b.status===`idle`?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:l()}):b.status===`error`?(0,Q.jsxs)(`p`,{className:`oc-afiles__error`,role:`alert`,children:[c(),` `,(0,Q.jsx)(N,{variant:`outline`,size:`sm`,onClick:()=>void A(),children:ae()})]}):b.files.length===0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:te()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`div`,{className:`oc-afiles__list`,children:b.files.map(e=>{let n=Y(e.size),i=n>=80;return(0,Q.jsxs)(`div`,{className:`oc-afiles__row`,children:[(0,Q.jsx)(`span`,{className:`oc-afiles__name`,title:e.name,children:e.name}),e.missing?(0,Q.jsx)(H,{variant:`outline`,children:ee()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`span`,{className:`oc-afiles__size`,children:re({size:Z(e.size,F)})}),(0,Q.jsx)(`span`,{className:`oc-afiles__gauge${i?` is-warn`:``}`,"aria-hidden":!0,children:(0,Q.jsx)(`span`,{className:`oc-afiles__gauge-fill`,style:{width:`${Math.min(n,100)}%`}})}),(0,Q.jsx)(`span`,{className:`oc-afiles__pct`,children:u({pct:I.format(n)})}),i?(0,Q.jsx)(U,{size:14,className:`oc-afiles__warn`,"aria-label":ne()}):(0,Q.jsx)(`span`,{className:`oc-afiles__warn-slot`,"aria-hidden":!0})]}),(0,Q.jsx)(N,{variant:`outline`,size:`sm`,className:`oc-afiles__open`,onClick:()=>P(e),children:t?r():oe()})]},e.name)})}),(0,Q.jsx)(`p`,{className:`oc-afiles__budget`,children:S({used:Z(be(b.files),F),total:Z(J,F),pct:I.format(X(be(b.files)))})})]}),j&&v?(0,Q.jsx)(Te,{instanceName:v.instanceName,agentId:v.agentId,name:j.name,isAdmin:t,onClose:()=>P(null),onSaved:()=>void A()}):null]})}function Te({instanceName:e,agentId:t,name:n,isAdmin:r,onClose:i,onSaved:ee}){let c=w(D.agentFiles.getAgentFile),te=w(D.agentFiles.setAgentFile),ne=F(),[u,re]=(0,K.useState)(null),[ie,h]=(0,K.useState)(!1),[g,S]=(0,K.useState)(``),[oe,M]=(0,K.useState)(!1),[L,R]=(0,K.useState)(!1),[z,B]=(0,K.useState)(!1),[V,H]=(0,K.useState)(!1),U=(0,K.useCallback)(async r=>{h(!1);try{let i=await c({instanceName:e,agentId:t,name:n});re({content:i.content,updatedAtMs:i.updatedAtMs}),r||S(i.content),B(!1)}catch{h(!0)}},[c,e,t,n]);(0,K.useEffect)(()=>{U(!1)},[U]);async function _e(){if(u!==null){R(!0),H(!1);try{await te({instanceName:e,agentId:t,name:n,content:g,baseUpdatedAtMs:u.updatedAtMs??void 0}),ne.success(f({name:n})),ee(),await U(!1)}catch(e){Ce(e)?B(!0):H(!0)}finally{R(!1)}}}let W=u!==null&&g!==u.content,G=(0,K.useMemo)(()=>u===null?null:Se(u.content,g),[u,g]),J=g.length>q,Y=se(),X=(0,K.useMemo)(()=>new Intl.NumberFormat(Y),[Y]);return(0,Q.jsx)(pe,{open:!0,onOpenChange:e=>!e&&i(),children:(0,Q.jsxs)(P,{className:`oc-afiles__editor`,children:[(0,Q.jsxs)(ge,{children:[(0,Q.jsx)(ve,{children:d({name:n})}),(0,Q.jsxs)(he,{children:[o({agent:t,instance:e}),r?null:(0,Q.jsxs)(Q.Fragment,{children:[` · `,s()]})]})]}),ie?(0,Q.jsxs)(`p`,{className:`oc-afiles__error`,role:`alert`,children:[v(),` `,(0,Q.jsx)(N,{variant:`outline`,size:`sm`,onClick:()=>void U(!1),children:ae()})]}):u===null?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:l()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`textarea`,{className:`oc-afiles__source`,value:g,readOnly:!r,spellCheck:!1,onChange:e=>S(e.target.value),"aria-label":d({name:n})}),(0,Q.jsx)(`p`,{className:`oc-afiles__hint`,children:m()}),z?(0,Q.jsxs)(`p`,{className:`oc-afiles__error`,role:`alert`,children:[j(),` `,(0,Q.jsx)(N,{variant:`outline`,size:`sm`,onClick:()=>void U(!0),children:O()})]}):null,V?(0,Q.jsx)(`p`,{className:`oc-afiles__error`,role:`alert`,children:A()}):null,(0,Q.jsxs)(`div`,{className:`oc-afiles__editor-foot`,children:[(0,Q.jsx)(`span`,{className:`oc-afiles__count${J?` is-over`:``}`,children:k({count:X.format(g.length),max:X.format(q)})}),r?(0,Q.jsx)(N,{size:`sm`,disabled:!W||L||z,onClick:()=>M(!0),children:L?p():a()}):null]})]}),(0,Q.jsx)(de,{open:oe,onOpenChange:M,children:(0,Q.jsxs)(le,{children:[(0,Q.jsxs)(ye,{children:[(0,Q.jsx)(I,{children:_({name:n})}),(0,Q.jsx)(ue,{children:b({agent:t})})]}),G?(0,Q.jsxs)(`div`,{className:`oc-afiles__diff`,children:[(0,Q.jsx)(`p`,{className:`oc-afiles__diff-counts`,children:x({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:T()}),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:E()}),G.sampleRemoved.map((e,t)=>(0,Q.jsx)(`code`,{className:`oc-afiles__diff-line is-del`,children:e||` `},t))]}):null]}):null,(0,Q.jsxs)(me,{children:[(0,Q.jsx)(ce,{children:C()}),(0,Q.jsx)(fe,{onClick:()=>void _e(),children:y()})]})]})})]})})}export{we as AgentFilesTab};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Af as r,Bf as i,Cf as ee,Df as a,Ef as te,Ff as ne,Gf as o,Hf as re,If as ie,Lf as ae,Mf as s,Nf as c,Of as l,Pf as u,Rf as d,Sf as f,Tf as p,Uf as m,Vf as oe,Wf as h,_E as g,_f as se,af as _,bf as v,cf as ce,df as le,ff as ue,gE as de,gf as fe,hf as pe,if as y,jf as me,kf as he,lf as ge,mf as b,of as x,pf as S,rf as C,sf as w,uE as T,uf as E,vf as D,wf as O,xf as k,yf as A,zf as j}from"./dist-CKhDstdM.js";import{n as M}from"./TimeRangePicker-BJ_SDnZN.js";import{A as N,At as P,C as F,E as I,S as L,T as R,X as z,a as _e,j as ve,kt as B,ot as ye,r as be,w as V}from"./index-DR0RpyTI.js";import{t as xe}from"./FilterBar-DZBiB1MF.js";import{t as Se}from"./DataTableShell-67hI2aZh.js";import{t as H}from"./dispatchErrorInfo-CiUDlf_q.js";var U=t(e(),1),W=n(),G=`__all__`,Ce=[{value:`open`},{value:`acknowledged`},{value:`resolved`}];function we(e){return e===`open`?o():e===`acknowledged`?h():m()}var Te=[`info`,`warn`,`critical`],Ee=[`detector`,`agent`,`user`],De={kind:`relative`,from:`now-30d`,to:`now`},Oe=200,K=`all`;function q(){let e=P({from:`/settings/anomalies`}),t=B({from:`/settings/anomalies`}),n=e.q??``,o=e.status===K?G:e.status,m=e.severity??G,h=e.kind??G,[_,y]=(0,U.useState)(G),x=be(e.from,e.to),{from:C,to:H}=M(x),q=e=>void t({search:t=>({...t,q:e||void 0}),replace:!0}),J=e=>void t({search:t=>({...t,status:e===G?K:e})}),Y=e=>void t({search:t=>({...t,severity:e===G?void 0:e})}),Ne=e=>void t({search:t=>({...t,kind:e===G?void 0:e})}),X=e=>void t({search:t=>({...t,..._e(e)})}),Pe=ve(),Z=N(),Q=de(T.anomalies.resolveAnomaly),Fe=(g(T.me.getMe,{host:ye})?.permissions??[]).includes(`admin.manage`),$=g(T.anomalies.listAnomalies,{limit:Oe,filter:{q:n||void 0,from:C,to:H,anomalyStatus:o===G?void 0:o,severity:m===G?void 0:m,source:_===G?void 0:_,kind:h===G?void 0:h}}),Ie=(0,U.useMemo)(()=>{let e=new Set;for(let t of $??[])e.add(t.kind);return[...e].sort()},[$]),Le=n!==``||o!==`open`||m!==G||_!==G||h!==G||x.kind!==`relative`||x.from!==De.from;function Re(){y(G),t({search:{status:`open`},replace:!0})}async function ze(e){if(await Pe({title:re(),description:(0,W.jsxs)(W.Fragment,{children:[oe(),` `,(0,W.jsx)(`span`,{className:`font-mono`,children:e.kind}),` `,i(),` `,(0,W.jsx)(`strong`,{children:j()}),`.`,` `,d()]}),confirmLabel:ae()}))try{await Q({anomalyId:e._id,status:`resolved`}),Z.success(ie(),e.kind)}catch(e){Z.error(ne(),e)}}async function Be(e){try{await Q({anomalyId:e._id,status:`acknowledged`}),Z.success(u(),e.kind)}catch(e){Z.error(c(),e)}}return(0,W.jsxs)(W.Fragment,{children:[(0,W.jsxs)(`p`,{className:`oc-admin__hint`,children:[s(),` `,(0,W.jsx)(`strong`,{children:me()}),` `,r(),` `,(0,W.jsx)(`strong`,{children:he()}),` `,l(),` `,(0,W.jsx)(`strong`,{children:a()}),` `,te(),` `,(0,W.jsx)(`span`,{className:`oc-filter__window`,children:p()})]}),(0,W.jsxs)(xe,{q:n,onQChange:q,searchPlaceholder:O(),timeRange:x,onTimeRangeChange:X,onReset:Re,canReset:Le,children:[(0,W.jsxs)(L,{value:o,onValueChange:J,children:[(0,W.jsx)(R,{size:`sm`,className:`w-36`,children:(0,W.jsx)(I,{})}),(0,W.jsxs)(F,{children:[(0,W.jsx)(V,{value:G,children:ee()}),Ce.map(e=>(0,W.jsx)(V,{value:e.value,children:we(e.value)},e.value))]})]}),(0,W.jsxs)(L,{value:m,onValueChange:Y,children:[(0,W.jsx)(R,{size:`sm`,className:`w-36`,children:(0,W.jsx)(I,{placeholder:f()})}),(0,W.jsxs)(F,{children:[(0,W.jsx)(V,{value:G,children:k()}),Te.map(e=>(0,W.jsx)(V,{value:e,children:e},e))]})]}),(0,W.jsxs)(L,{value:_,onValueChange:y,children:[(0,W.jsx)(R,{size:`sm`,className:`w-32`,children:(0,W.jsx)(I,{placeholder:v()})}),(0,W.jsxs)(F,{children:[(0,W.jsx)(V,{value:G,children:A()}),Ee.map(e=>(0,W.jsx)(V,{value:e,children:e},e))]})]}),(0,W.jsxs)(L,{value:h,onValueChange:Ne,children:[(0,W.jsx)(R,{size:`sm`,className:`w-36`,children:(0,W.jsx)(I,{placeholder:D()})}),(0,W.jsxs)(F,{children:[(0,W.jsx)(V,{value:G,children:se()}),Ie.map(e=>(0,W.jsx)(V,{value:e,children:e},e))]})]})]}),(0,W.jsx)(Se,{title:fe(),rows:$,emptyHint:o===`open`?pe():b(),rowActions:e=>Fe&&e.status===`open`?[{label:S(),onSelect:()=>void ze(e)},{label:ue(),onSelect:()=>void Be(e)}]:[],columns:[{header:le(),cell:e=>(0,W.jsx)(`span`,{className:`oc-traces__time`,children:new Date(e.at).toLocaleString(`fr-FR`)}),sort:e=>e.at},{header:D(),cell:e=>(0,W.jsx)(`code`,{className:`oc-traces__mono`,children:e.kind}),sort:e=>e.kind},{header:f(),cell:e=>(0,W.jsx)(Ae,{severity:e.severity}),sort:e=>e.severity===`critical`?2:+(e.severity===`warn`)},{header:E(),cell:e=>(0,W.jsx)(je,{status:e.status}),sort:e=>e.status===`resolved`?2:+(e.status===`acknowledged`)},{header:v(),cell:e=>(0,W.jsx)(z,{variant:`outline`,children:e.source}),sort:e=>e.source},{header:ge(),cell:e=>(0,W.jsx)(`span`,{className:`oc-anomaly__msg`,children:e.message}),sort:e=>e.message},{header:ce(),cell:e=>(0,W.jsx)(ke,{row:e}),sort:e=>e.evidence??null},{header:w(),cell:e=>e.correlationId?(0,W.jsx)(`code`,{className:`oc-traces__mono`,children:Me(e.correlationId)}):(0,W.jsx)(`span`,{className:`oc-traces__muted`,children:`—`}),sort:e=>e.correlationId}]})]})}function J(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 Y(e){if(e.kind!==`subagent.failure`||!e.evidence)return{};try{let t=JSON.parse(e.evidence);return{failedCount:t.failedCount,totalCount:t.totalCount,errorCategories:t.errorCategories}}catch{return{}}}function ke({row:e}){let t=B();if(e.kind===`subagent.failure`){let n=Y(e);return(0,W.jsxs)(`div`,{className:`oc-anomaly__cause`,children:[(0,W.jsx)(`div`,{className:`oc-anomaly__cause-head`,children:[...new Set(n.errorCategories??[])].map(e=>(0,W.jsx)(`code`,{className:`oc-traces__mono`,children:e},e))}),e.correlationId?(0,W.jsxs)(`button`,{type:`button`,className:`oc-anomaly__drill`,onClick:()=>void t({to:`/settings/traces`,search:{q:e.correlationId,limit:100}}),children:[`↗ `,x()]}):null]})}let n=J(e);if(!n.dominantCode)return(0,W.jsx)(`span`,{className:`oc-traces__muted`,children:`—`});let r=H(n.dominantCode),i=n.sampleCorrelationId;return(0,W.jsxs)(`div`,{className:`oc-anomaly__cause`,children:[(0,W.jsxs)(`div`,{className:`oc-anomaly__cause-head`,children:[(0,W.jsx)(`span`,{className:`oc-anomaly__cause-label`,children:r.label}),(0,W.jsx)(`code`,{className:`oc-traces__mono`,children:n.dominantCode})]}),(0,W.jsx)(`p`,{className:`oc-anomaly__cause-hint`,children:r.hint}),i?(0,W.jsxs)(`button`,{type:`button`,className:`oc-anomaly__drill`,onClick:()=>void t({to:`/settings/traces`,search:{q:i,limit:100}}),children:[`↗ `,x()]}):null]})}function Ae({severity:e}){return(0,W.jsx)(`span`,{className:`oc-anomaly__sev oc-anomaly__sev--${e}`,children:e})}function je({status:e}){return e===`open`?(0,W.jsx)(z,{variant:`destructive`,children:_()}):e===`acknowledged`?(0,W.jsx)(z,{variant:`secondary`,children:y()}):(0,W.jsx)(z,{variant:`outline`,children:C()})}function Me(e){return e.length>8?e.slice(0,8):e}export{q as AnomaliesTab};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Bp as r,Gp as i,Hp as a,Ip as o,Jp as s,Kp as c,Lp as l,Rp as u,Up as ee,Vp as d,Wp as f,Xp as p,Yp as m,_E as h,qp as g,uE as _,zp as v}from"./dist-CKhDstdM.js";import{n as y}from"./TimeRangePicker-BJ_SDnZN.js";import{At as b,C as x,E as S,S as C,T as w,a as T,i as E,kt as D,o as O,r as k,t as A,w as j}from"./index-DR0RpyTI.js";import{t as M}from"./FilterBar-DZBiB1MF.js";import{t as N}from"./AdvancedFilter-Dsn2CdBY.js";import{t as P}from"./DataTableShell-67hI2aZh.js";var F=t(e(),1),I=n(),L={kind:`relative`,from:A,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=D({from:`/settings/audit`}),n=e.q??``,A=e.action??R,B=e.impersonated??R,V=e.resource??R,H=k(e.from,e.to),U=(0,F.useMemo)(()=>O(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,...T(e)})}),Z=e=>void t({search:t=>({...t,adv:E(e)}),replace:!0}),Q=h(_.admin.listAudit,{filter:{q:n||void 0,from:W,to:G,action:A===R?void 0:A,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!==``||A!==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:[p(),` `,(0,I.jsx)(`span`,{className:`oc-filter__window`,children:m()})]}),(0,I.jsxs)(M,{q:n,onQChange:K,searchPlaceholder:s(),timeRange:H,onTimeRangeChange:X,onReset:re,canReset:ne,children:[(0,I.jsxs)(C,{value:A,onValueChange:q,children:[(0,I.jsx)(w,{size:`sm`,className:`w-40`,children:(0,I.jsx)(S,{placeholder:g()})}),(0,I.jsxs)(x,{children:[(0,I.jsx)(j,{value:R,children:c()}),$.map(e=>(0,I.jsx)(j,{value:e,children:e},e))]})]}),(0,I.jsxs)(C,{value:B,onValueChange:J,children:[(0,I.jsx)(w,{size:`sm`,className:`w-40`,children:(0,I.jsx)(S,{})}),(0,I.jsxs)(x,{children:[(0,I.jsx)(j,{value:R,children:i()}),(0,I.jsx)(j,{value:`yes`,children:f()}),(0,I.jsx)(j,{value:`no`,children:ee()})]})]}),(0,I.jsxs)(C,{value:V,onValueChange:Y,children:[(0,I.jsx)(w,{size:`sm`,className:`w-40`,children:(0,I.jsx)(S,{placeholder:a()})}),(0,I.jsxs)(x,{children:[(0,I.jsx)(j,{value:R,children:d()}),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:r(),rows:Q,emptyHint:v(),columns:[{header:u(),cell:e=>new Date(e.at).toLocaleString(`fr-FR`),sort:e=>e.at},{header:g(),cell:e=>e.action,sort:e=>e.action},{header:l(),cell:e=>e.realLabel,sort:e=>e.realLabel},{header:o(),cell:e=>e.targetLabel??`—`,sort:e=>e.targetLabel??null},{header:a(),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{$c as r,$l as i,Bc as a,Bt as o,Cl as s,Fc as c,Gc as l,Gl as u,Gt as d,Hc as f,Ht as p,Ic as m,It as h,Jc as g,Jt as _,Kc as v,Kl as ee,Kt as y,Lc as b,Qc as te,Ql as ne,Rc as re,Sl as ie,Uc as ae,Ut as oe,Vc as se,Vt as ce,Wc as le,Wt as ue,Xc as de,Xl as fe,Xt as pe,Yc as x,Yl as me,Yt as he,Zc as ge,Zl as _e,Zt as ve,_E as S,_l as ye,al as be,au as xe,bl as Se,cl as C,dE as w,dl as Ce,el as we,eu as Te,fl as Ee,gE as De,gl as Oe,hl as ke,il as Ae,iu as je,ll as Me,mE as Ne,ml as Pe,nl as Fe,nu as Ie,ol as Le,pl as Re,qc as ze,qt as Be,rl as Ve,sl as He,tl as Ue,tu as We,uE as T,ul as Ge,vl as Ke,xl as qe,yl as Je,zc as Ye}from"./dist-CKhDstdM.js";import{i as E,r as Xe}from"./dist-CkXWG_t8.js";import{t as Ze}from"./chevrons-up-down-DLfMeWLX.js";import{i as Qe,n as D,o as $e,r as et,s as tt}from"./FieldLabel-D8l7ss4W.js";import{t as O}from"./button-HRR8tdJ2.js";import{$ as nt,A as rt,C as k,Dt as A,E as j,H as it,Ot as at,Q as ot,S as M,St as st,T as N,U as ct,V as lt,X as P,Z as F,_t as ut,et as dt,kt as ft,mt as I,nt as pt,ot as mt,rt as ht,w as L,x as gt}from"./index-DR0RpyTI.js";import{a as _t,i as R,n as vt,o as z,r as B,t as yt}from"./table-fGxqLVNE.js";import{t as bt}from"./FilterBar-DZBiB1MF.js";import{a as V,n as xt,o as H,r as U,s as St,t as Ct}from"./compatView-Ihz_y_lK.js";import{t as W}from"./dispatchErrorInfo-CiUDlf_q.js";var wt=w(`refresh-cw`,[[`path`,{d:`M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8`,key:`v9h5vc`}],[`path`,{d:`M21 3v5h-5`,key:`1q7to0`}],[`path`,{d:`M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16`,key:`3uifl3`}],[`path`,{d:`M8 16H3v5`,key:`1cv678`}]]),Tt=w(`wifi-off`,[[`path`,{d:`M12 20h.01`,key:`zekei9`}],[`path`,{d:`M8.5 16.429a5 5 0 0 1 7 0`,key:`1bycff`}],[`path`,{d:`M5 12.859a10 10 0 0 1 5.17-2.69`,key:`1dl1wf`}],[`path`,{d:`M19 12.859a10 10 0 0 0-2.007-1.523`,key:`4k23kn`}],[`path`,{d:`M2 8.82a15 15 0 0 1 4.177-2.643`,key:`1grhjp`}],[`path`,{d:`M22 8.82a15 15 0 0 0-11.288-3.764`,key:`z3jwby`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}]]),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 H(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)=>H(e,t)??Y(e,t))}var Z=n();function Vt({connections:e,displayByInstance:t}){let[n,i]=(0,G.useState)(Nt),[o,s]=(0,G.useState)(null),c=(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]),u=(0,G.useMemo)(()=>Rt(c),[c]),d=(0,G.useMemo)(()=>zt(c),[c]),p=(0,G.useMemo)(()=>Bt(c),[c]),m=(0,G.useMemo)(()=>Lt(Ft(c,n),o),[c,n,o]);function h(e){s(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:r()}):(0,Z.jsxs)(`div`,{className:`oc-conn`,children:[(0,Z.jsxs)(bt,{q:n.q,onQChange:e=>i(t=>({...t,q:e})),searchPlaceholder:de(),onReset:()=>i(Nt),canReset:Pt(n),children:[(0,Z.jsxs)(M,{value:n.state,onValueChange:e=>i(t=>({...t,state:e})),children:[(0,Z.jsx)(N,{size:`sm`,className:`w-36`,children:(0,Z.jsx)(j,{placeholder:g()})}),(0,Z.jsxs)(k,{children:[(0,Z.jsx)(L,{value:q,children:x()}),u.map(e=>(0,Z.jsx)(L,{value:e,children:Ut(e)},e))]})]}),(0,Z.jsxs)(M,{value:n.instance,onValueChange:e=>i(t=>({...t,instance:e})),children:[(0,Z.jsx)(N,{size:`sm`,className:`w-40`,children:(0,Z.jsx)(j,{placeholder:ze()})}),(0,Z.jsxs)(k,{children:[(0,Z.jsx)(L,{value:q,children:x()}),d.map(e=>(0,Z.jsx)(L,{value:e.name,children:e.label},e.name))]})]}),(0,Z.jsxs)(M,{value:n.version,onValueChange:e=>i(t=>({...t,version:e})),children:[(0,Z.jsx)(N,{size:`sm`,className:`w-36`,children:(0,Z.jsx)(j,{placeholder:v()})}),(0,Z.jsxs)(k,{children:[(0,Z.jsx)(L,{value:q,children:x()}),p.map(e=>(0,Z.jsx)(L,{value:e,children:e},e))]})]})]}),m.length===0?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:l()}):(0,Z.jsxs)(yt,{className:`oc-conn__table`,children:[(0,Z.jsx)(_t,{children:(0,Z.jsxs)(z,{children:[(0,Z.jsx)(Q,{label:le(),sortKey:`target`,sort:o,onSort:h}),(0,Z.jsx)(Q,{label:ae(),sortKey:`state`,sort:o,onSort:h}),(0,Z.jsx)(Q,{label:f(),sortKey:`instance`,sort:o,onSort:h}),(0,Z.jsx)(Q,{label:se(),sortKey:`host`,sort:o,onSort:h}),(0,Z.jsx)(Q,{label:a(),sortKey:`version`,sort:o,onSort:h}),(0,Z.jsx)(R,{children:Ye()}),(0,Z.jsx)(Q,{label:re(),sortKey:`lastOk`,sort:o,onSort:h})]})}),(0,Z.jsx)(vt,{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)(R,{"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)(Xe,{size:13,"aria-hidden":!0}):(0,Z.jsx)(E,{size:13,"aria-hidden":!0}):(0,Z.jsx)(Ze,{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)(z,{className:`oc-conn__row oc-conn__row--${e.state}`,children:[(0,Z.jsx)(B,{children:(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:e.targetLabel})}),(0,Z.jsx)(B,{children:(0,Z.jsx)(Wt,{state:e.state})}),(0,Z.jsx)(B,{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)(B,{children:(0,Z.jsx)(`span`,{className:`oc-bridge-target__host`,children:e.gatewayHost})}),(0,Z.jsx)(B,{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)(B,{children:(0,Z.jsx)(`span`,{className:`oc-conn__stats`,children:te({ok:e.okCount,errors:e.errorCount,attempts:e.attempts})})}),(0,Z.jsx)(B,{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)(z,{className:`oc-conn__detail-row`,children:(0,Z.jsxs)(B,{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:[ge({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`?b():e===`error`?m():c()}function Wt({state:e}){return e===`connected`?(0,Z.jsx)(P,{variant:`secondary`,children:b()}):e===`error`?(0,Z.jsx)(P,{variant:`destructive`,children:m()}):(0,Z.jsx)(P,{variant:`outline`,children:c()})}function Gt(){return S(T.bridgeHealth.getBridgeHealth,{})}function Kt(){let e=Gt(),t=S(T.compat.getBridgeCompat,{}),n=S(T.me.getMe,{host:mt})?.role===`admin`,r=S(T.admin.listInstances,n?{}:`skip`),i=ft(),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&&xt(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:Me()}),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:h()}):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:V(t.bridgeVersion)}),` · `,he(),` `,(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:t.protocolVersion===null?_():String(t.protocolVersion)})]}):null;if(e===void 0)return(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:C()});if(e===null)return(0,Z.jsx)(`div`,{className:`oc-bridge-card oc-bridge-card--idle`,children:He()});let i=Et(e.targets),a=!e.reachable,o=Dt(e),s=o?`ok`:`error`,c=new Date(e.checkedAt).toLocaleString(`fr-FR`),l=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)(A,{size:22}):a?(0,Z.jsx)(Tt,{size:22}):(0,Z.jsx)(I,{size:22})}),(0,Z.jsxs)(`div`,{className:`oc-bridge-card__body`,children:[(0,Z.jsx)(`div`,{className:`oc-bridge-card__title`,children:o?Le():a?be():Ae({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}),` `,Ve({time:c})]}),l?(0,Z.jsx)(`span`,{children:Fe({time:l})}):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:Ue()})]})}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)(ut,{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:U(d)}):null]}),(0,Z.jsx)(`h4`,{className:`oc-bridge-provider__sub`,children:ve()}),(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)(E,{size:13,"aria-hidden":!0}):(0,Z.jsx)(at,{size:13,"aria-hidden":!0}),we({count:t.length})]}),f?(0,Z.jsx)(Vt,{connections:t,displayByInstance:s}):null]})}function Yt({support:e,compatStatus:t,compatReachable:n,manifest:r,instanceRows:i}){return t===`loading`?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:C()}):t===`nodata`?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:pe()}):(0,Z.jsxs)(`div`,{className:`oc-compat`,children:[n?null:(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:Be()}),r===null?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:y()}):(0,Z.jsxs)(`div`,{className:`oc-compat__support`,children:[(0,Z.jsx)(`span`,{className:`oc-compat__label`,children:d()}),e&&e.range!==null?(0,Z.jsx)(`span`,{children:ue({min:e.range.min,max:e.range.maxValidated})}):(0,Z.jsx)(`span`,{children:_()}),e?(0,Z.jsx)(Qt,{versions:e.validatedVersions}):null]}),i.length===0?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:o()}):(0,Z.jsx)(`div`,{className:`oc-compat__targets`,children:i.map(e=>(0,Z.jsxs)(`div`,{className:`oc-compat__target`,children:[(0,Z.jsx)(`span`,{className:`oc-compat__instance`,children:e.displayName}),(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:V(e.version)}),(0,Z.jsx)(P,{variant:e.state===`supported`?`secondary`:e.state===`beyond`?`destructive`:`outline`,children:U(e.state)})]},e.instanceName))})]})}function Xt({instance:e,onClose:t}){return(0,Z.jsx)(ot,{open:!0,onOpenChange:e=>!e&&t(),children:(0,Z.jsxs)(nt,{className:`oc-bridge-config-dialog`,onOpenAutoFocus:e=>e.preventDefault(),children:[(0,Z.jsxs)(pt,{children:[(0,Z.jsx)(ht,{children:xe({instance:e.displayName??e.name})}),(0,Z.jsx)(dt,{children:je()})]}),(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)(A,{"aria-hidden":!0}):(0,Z.jsx)(I,{"aria-hidden":!0}),(0,Z.jsxs)(`span`,{children:[e,` — `,t.ok?Re():t.detail]})]}):(0,Z.jsxs)(`p`,{className:`oc-bridge-config__check-row oc-bridge-config__check-row--skip`,children:[e,` — `,Ee()]}):null}function Zt({instance:e,onClose:t}){let n=De(T.admin.upsertInstanceConfig),r=Ne(T.bridge.validateMediaPaths),a=rt(),[o,c]=(0,G.useState)(()=>Qe(e.config??{})),[l,d]=(0,G.useState)(!1),[f,p]=(0,G.useState)(!1),[m,h]=(0,G.useState)(null),g=o.inboundMediaMode===`shared-fs`,_=o.mediaMode===`shared-fs`,v=g||_;async function y(){p(!0),h(null);try{h(await r({instanceName:e.name,inboundMediaMode:o.inboundMediaMode,mediaMode:o.mediaMode}))}catch(e){a.error(ye(),e)}finally{p(!1)}}async function b(){d(!0);try{let r=e.config??{};await n({instanceId:e._id,config:et(o,r)}),t()}catch(e){a.error(_e(),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)(D,{label:Ie(),help:fe()}),(0,Z.jsxs)(M,{value:o.mediaMode,onValueChange:e=>c({...o,mediaMode:e}),children:[(0,Z.jsx)(N,{size:`sm`,className:`w-full`,children:(0,Z.jsx)(j,{})}),(0,Z.jsx)(k,{children:tt.map(e=>(0,Z.jsx)(L,{value:e,children:e},e))})]})]}),(0,Z.jsxs)(`label`,{className:`oc-field`,children:[(0,Z.jsx)(D,{label:We(),help:me()}),(0,Z.jsxs)(M,{value:o.inboundMediaMode,onValueChange:e=>c({...o,inboundMediaMode:e}),children:[(0,Z.jsx)(N,{size:`sm`,className:`w-full`,children:(0,Z.jsx)(j,{})}),(0,Z.jsx)(k,{children:$e.map(e=>(0,Z.jsx)(L,{value:e,children:e},e))})]})]}),(0,Z.jsxs)(`label`,{className:`oc-field`,children:[(0,Z.jsx)(D,{label:Te(),help:ee()}),(0,Z.jsx)(F,{type:`number`,min:1,max:4096,className:`w-full`,value:o.mediaMaxMb,onChange:e=>c({...o,mediaMaxMb:Math.trunc(Number(e.target.value)||0)})})]})]}),v&&(0,Z.jsxs)(`div`,{className:`oc-bridge-config__grid`,children:[g&&(0,Z.jsxs)(`label`,{className:`oc-field`,children:[(0,Z.jsx)(D,{label:s(),help:ie()}),(0,Z.jsx)(F,{className:`w-full`,spellCheck:!1,value:o.inboundAgentMount,onChange:e=>c({...o,inboundAgentMount:e.target.value})})]}),_&&(0,Z.jsxs)(`label`,{className:`oc-field`,children:[(0,Z.jsx)(D,{label:qe(),help:Se()}),(0,Z.jsx)(F,{className:`w-full`,spellCheck:!1,value:o.outboundAgentMount,onChange:e=>c({...o,outboundAgentMount:e.target.value})})]})]}),(0,Z.jsxs)(`label`,{className:`oc-field--row`,children:[(0,Z.jsx)(gt,{checked:o.rehydration,onCheckedChange:e=>c({...o,rehydration:e===!0})}),(0,Z.jsx)(D,{label:i(),help:u()})]}),v&&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)(I,{"aria-hidden":!0}),Ge({reason:m.reason??`?`})]}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)($,{label:ke(),result:m.inbound}),(0,Z.jsx)($,{label:Pe(),result:m.outbound}),(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:Oe()})]}):(0,Z.jsxs)(`p`,{className:`oc-bridge-config__check-row oc-bridge-config__check-row--err`,children:[(0,Z.jsx)(I,{"aria-hidden":!0}),Ce()]})}),(0,Z.jsxs)(`div`,{className:`oc-bridge-config__actions`,children:[v&&(0,Z.jsxs)(O,{variant:`outline`,size:`sm`,onClick:()=>void y(),disabled:f,children:[f?(0,Z.jsx)(st,{className:`size-4 animate-spin`,"aria-hidden":!0}):null,f?Ke():Je()]}),(0,Z.jsx)(O,{size:`sm`,onClick:()=>void b(),disabled:l,children:ne()})]})]})})}function Qt({versions:e}){if(e.length===0)return null;let t=[...e].reverse();return(0,Z.jsxs)(lt,{children:[(0,Z.jsx)(ct,{asChild:!0,children:(0,Z.jsxs)(`button`,{type:`button`,className:`oc-compat__versions-btn`,children:[e.length===1?oe():p({count:e.length}),(0,Z.jsx)(E,{size:13,"aria-hidden":!0})]})}),(0,Z.jsxs)(it,{className:`oc-compat__versions-pop`,align:`start`,children:[(0,Z.jsx)(`p`,{className:`oc-compat__versions-title`,children:ce()}),(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,Bn as i,LT as a,Qt as o,Sr as s,_E as c,an as ee,br as te,cn as ne,en as re,gr as ie,hr as ae,in as oe,kb as se,ln as l,mE as u,nn as d,on as ce,rn as f,ru as p,sn as m,tn as le,uE as h,un as ue}from"./dist-CKhDstdM.js";import{t as g}from"./button-HRR8tdJ2.js";import{A as de,B as fe,C as pe,D as me,E as he,F as _,I as v,L as y,N as b,P as x,R as S,S as C,T as w,g as T,h as E,mt as D,w as O,z as k}from"./index-DR0RpyTI.js";import{i as A}from"./compatView-Ihz_y_lK.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=u(h.agentFiles.getChatDefaults),t=u(h.agentFiles.setChatDefaults),n=de(),[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=c(h.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=c(h.compat.forInstance,U?{instanceName:U}:`skip`),K=U?me(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(f()),await X()}catch(e){n.error(d(),e)}finally{V(!1)}}let xe=(0,j.useMemo)(()=>M.map(e=>({id:e,label:T(e)})),[]),Se=(0,j.useMemo)(()=>[{id:`fast`,label:ie()},{id:`standard`,label:ae()}],[]);return(0,P.jsxs)(`div`,{className:`oc-cdefaults`,children:[(0,P.jsx)(`p`,{className:`oc-admin__hint`,children:ue()}),G&&U?(0,P.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,P.jsx)(`span`,{className:`oc-cdefaults__label`,children:i()}),(0,P.jsxs)(C,{value:U,onValueChange:e=>W(e),disabled:B,children:[(0,P.jsx)(w,{size:`sm`,"aria-label":i(),children:(0,P.jsx)(he,{})}),(0,P.jsx)(pe,{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:p()}):K===`loading`?(0,P.jsx)(`p`,{className:`oc-admin__hint`,children:a()}):K.blocked?(0,P.jsxs)(`p`,{className:`oc-compat__blocked`,role:`status`,children:[(0,P.jsx)(D,{size:14,"aria-hidden":!0}),` `,A(K.gatewayVersion)]}):F.status===`loading`?(0,P.jsx)(`p`,{className:`oc-admin__hint`,children:a()}):F.status===`error`?(0,P.jsxs)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:[ee(),` `,(0,P.jsx)(g,{variant:`outline`,size:`sm`,onClick:()=>void X(),children:te()})]}):(0,P.jsxs)(P.Fragment,{children:[(0,P.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,P.jsx)(`span`,{className:`oc-cdefaults__label`,children:l()}),(0,P.jsx)(E,{options:xe,value:L.thinkingDefault,onChange:e=>R({...L,thinkingDefault:e}),disabled:B}),(0,P.jsx)(`p`,{className:`oc-cdefaults__help`,children:ne()})]}),(0,P.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,P.jsx)(`span`,{className:`oc-cdefaults__label`,children:m()}),(0,P.jsx)(E,{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:ce()})]}),(0,P.jsx)(`div`,{className:`oc-cdefaults__actions`,children:(0,P.jsx)(g,{size:`sm`,disabled:!ye||B,onClick:()=>z(!0),children:B?s():oe()})}),(0,P.jsx)(`p`,{className:`oc-cdefaults__note`,children:le()})]}),(0,P.jsx)(b,{open:ge,onOpenChange:z,children:(0,P.jsxs)(v,{children:[(0,P.jsxs)(k,{children:[(0,P.jsx)(fe,{children:re()}),(0,P.jsx)(y,{children:r()})]}),(0,P.jsxs)(S,{children:[(0,P.jsx)(_,{children:se()}),(0,P.jsx)(x,{onClick:()=>void be(),children:o()})]})]})})]})}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{Co as r,Do as i,Eo as a,So as o,To as s,wo as c,xo as l}from"./dist-CKhDstdM.js";import{i as u,r as d}from"./dist-CkXWG_t8.js";import{t as f}from"./chevrons-up-down-DLfMeWLX.js";import{t as p}from"./button-HRR8tdJ2.js";import{G as m,J as h,K as g,W as _,Y as v,bt as y,ht as b,wt as x,x as S}from"./index-DR0RpyTI.js";import{a as C,i as w,n as T,o as E,r as D,t as O}from"./table-fGxqLVNE.js";var k=t(e(),1);function A(e,t){return typeof e==`number`&&typeof t==`number`?e-t:typeof e==`boolean`&&typeof t==`boolean`?!!e-+!!t:String(e).localeCompare(String(t),void 0,{numeric:!0,sensitivity:`base`})}function j(e,t,n){return[...e].sort((e,r)=>{let i=t(e),a=t(r),o=i==null,s=a==null;if(o||s)return o&&s?0:o?1:-1;let c=A(i,a);return n===`asc`?c:-c})}var M=n();function N({title:e,rows:t,columns:n,rowActions:A,onAdd:N,addLabel:P=i(),bulkActions:F,emptyHint:I=a(),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)(b,{}):null,e.label,` (`,z.size,`)`]},e.label)):null,N?(0,M.jsxs)(p,{size:`sm`,onClick:N,children:[(0,M.jsx)(y,{}),` `,P]}):null]})]}),t===void 0?(0,M.jsx)(`p`,{className:`oc-admin__hint`,children:s()}):U.length===0?(0,M.jsx)(`p`,{className:`oc-admin__hint`,children:I}):(0,M.jsxs)(O,{children:[(0,M.jsx)(C,{children:(0,M.jsxs)(E,{children:[F?(0,M.jsx)(w,{className:`w-8`,children:(0,M.jsx)(S,{"aria-label":c(),checked:J?!0:Y?`indeterminate`:!1,onCheckedChange:X})}):null,n.map((e,t)=>{let n=V?.index===t;return e.sort?(0,M.jsx)(w,{className:e.className,"aria-sort":n?V.dir===`asc`?`ascending`:`descending`:`none`,children:(0,M.jsxs)(`button`,{type:`button`,className:`oc-dt__sort`,onClick:()=>K(t),"aria-label":l({column:e.header}),children:[e.header,n?V.dir===`asc`?(0,M.jsx)(d,{className:`oc-dt__sort-icon`,"aria-hidden":!0}):(0,M.jsx)(u,{className:`oc-dt__sort-icon`,"aria-hidden":!0}):(0,M.jsx)(f,{className:`oc-dt__sort-icon oc-dt__sort-icon--idle`,"aria-hidden":!0})]})},e.header):(0,M.jsx)(w,{className:e.className,children:e.header},e.header)}),A?(0,M.jsx)(w,{className:`w-8`}):null]})}),(0,M.jsx)(T,{children:G.map(e=>{let t=A?.(e)??[],i=L?.(e)??!1;return(0,M.jsxs)(k.Fragment,{children:[(0,M.jsxs)(E,{className:`group/row`,children:[F?(0,M.jsx)(D,{children:(0,M.jsx)(S,{"aria-label":r(),checked:z.has(e._id),onCheckedChange:()=>Z(e._id)})}):null,n.map(t=>(0,M.jsx)(D,{className:t.className,children:t.cell(e)},t.header)),A?(0,M.jsx)(D,{children:t.length>0?(0,M.jsxs)(_,{children:[(0,M.jsx)(v,{asChild:!0,children:(0,M.jsx)(p,{variant:`ghost`,size:`icon-sm`,"aria-label":o(),className:`opacity-0 transition-opacity group-hover/row:opacity-100 group-focus-within/row:opacity-100 aria-expanded:opacity-100`,children:(0,M.jsx)(x,{})})}),(0,M.jsx)(m,{align:`end`,children:t.map((t,n)=>(0,M.jsxs)(`div`,{children:[t.variant===`destructive`&&n>0?(0,M.jsx)(h,{}):null,(0,M.jsx)(g,{variant:t.variant,onSelect:()=>t.onSelect(e),children:t.label})]},t.label))})]}):null}):null]}),i&&R?(0,M.jsx)(E,{className:`oc-dt__expansion`,children:(0,M.jsx)(D,{colSpan:q,className:`oc-dt__expansion-cell`,children:R(e)})}):null]},e._id)})})]})]})}export{N as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./bundle-mjs-C73ZY4La.js";import{X as t}from"./index-
|
|
1
|
+
import{r as e}from"./bundle-mjs-C73ZY4La.js";import{X as t}from"./index-DR0RpyTI.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{$g as r,Ag as i,Bg as a,Cg as o,Dg as s,Eg as c,Fg as l,Gg as u,Hg as d,Ig as f,Jg as p,Kg as m,Lg as h,Mg as g,Ng as _,Og as v,Pg as y,Qg as ee,Rg as te,Sg as ne,Tg as re,Ug as ie,Vg as ae,Wg as b,Xg as x,Yg as S,Zg as C,_E as w,_g as T,a_ as E,bg as D,c_ as O,d_ as k,dg as A,e_ as j,f_ as M,fg as N,gE as P,gg as F,hg as I,i_ as L,jg as R,kg as z,l_ as oe,mg as B,n_ as V,o_ as H,pg as U,qg as W,r_ as G,s_ as K,t_ as q,uE as J,u_ as se,vg as ce,wg as le,xg as ue,yg as de,zg as fe}from"./dist-CKhDstdM.js";import{t as pe}from"./button-HRR8tdJ2.js";import{j as me}from"./index-DR0RpyTI.js";import{t as he}from"./DataTableShell-67hI2aZh.js";var Y=t(e(),1),X=n(),Z={altered_words:()=>M(),incorrect:()=>k(),incoherence:()=>se(),formatting:()=>oe(),latency:()=>O(),api_error:()=>K(),other:()=>H()},Q=e=>Z[e]?.()??e;function $({matches:e,sourceWasOpen:t}){return t?e===!0?(0,X.jsx)(`span`,{className:`oc-fbadmin__pill is-ok`,children:L()}):e===!1?(0,X.jsx)(`span`,{className:`oc-fbadmin__pill is-warn`,children:G()}):(0,X.jsx)(`span`,{className:`oc-fbadmin__pill`,children:`—`}):(0,X.jsx)(`span`,{className:`oc-fbadmin__pill`,children:E()})}function ge({data:e,closeReason:t}){let n=e.snapshot,i=P(J.feedback.respondToFeedback),[o,s]=(0,Y.useState)(e.thread),[c,l]=(0,Y.useState)(``),[g,_]=(0,Y.useState)(!1);async function v(){let t=c.trim();if(!(!t||g)){_(!0);try{await i({feedbackId:e._id,text:t}),s(e=>[...e,{authorRole:`admin`,text:t,at:Date.now()}]),l(``)}finally{_(!1)}}}let y=[];try{y=n.contextJson?JSON.parse(n.contextJson):[]}catch{y=[]}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?` · ${V()}`:``,n.openclawModel?` · ${n.openclawModel}`:``,n.openclawRuntime?` (${n.openclawRuntime})`:``]})]}),e.comment?(0,X.jsxs)(`section`,{children:[(0,X.jsx)(`h4`,{className:`oc-fbadmin__h`,children:q()}),(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:T()}),(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:j()}),o.length>0?(0,X.jsx)(`div`,{className:`oc-fbadmin__thread`,children:o.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`?r():ee()}),(0,X.jsx)(`span`,{className:`oc-notif__msg-text`,children:e.text})]},t))}):(0,X.jsx)(`p`,{className:`oc-fbadmin__meta`,children:C()}),(0,X.jsx)(`textarea`,{className:`oc-feedback__textarea`,placeholder:x(),value:c,maxLength:2e3,rows:3,onChange:e=>l(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 v(),disabled:!c.trim()||g,children:g?S():p()})})]}),(0,X.jsxs)(`section`,{children:[(0,X.jsx)(`h4`,{className:`oc-fbadmin__h`,children:W()}),(0,X.jsx)(`pre`,{className:`oc-msg__source-pre`,children:n.messageText||m()})]}),n.clientInfo?.sourceWasOpen&&n.displayedText!==void 0?(0,X.jsxs)(`section`,{children:[(0,X.jsx)(`h4`,{className:`oc-fbadmin__h`,children:u()}),(0,X.jsx)(`pre`,{className:`oc-msg__source-pre`,children:n.displayedText||m()})]}):null,n.promptText?(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.promptText})]}):null,y.length>0?(0,X.jsxs)(`section`,{children:[(0,X.jsx)(`h4`,{className:`oc-fbadmin__h`,children:ie({count:n.contextCount??y.length,truncated:n.contextTruncated?d():``})}),(0,X.jsx)(`div`,{className:`oc-fbadmin__ctx`,children:y.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:ae()}),(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:a()}),(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:fe()}),(0,X.jsxs)(`p`,{className:`oc-fbadmin__env`,children:[[n.clientInfo?.language,n.clientInfo?.timezone,n.clientInfo?.theme?te({theme:n.clientInfo.theme}):null,n.runId?`run ${n.runId.slice(0,12)}…`:null].filter(Boolean).join(` · `)||`—`,n.clientInfo?.plugins&&n.clientInfo.plugins.length>0?(0,X.jsxs)(`span`,{className:`oc-fbadmin__plugins`,children:[h(),` `,n.clientInfo.plugins.join(`, `),(0,X.jsxs)(`span`,{className:`oc-fbadmin__note`,children:[` `,f()]})]}):null,n.clientInfo?.userAgent?(0,X.jsx)(`span`,{className:`oc-fbadmin__ua`,children:n.clientInfo.userAgent}):null]})]})]})}function _e(){let e=w(J.feedback.listForAdmin,{}),t=P(J.feedback.readSnapshot),n=P(J.feedback.deleteFeedback),r=me(),[a,u]=(0,Y.useState)(null),[d,f]=(0,Y.useState)({});async function p(e){if(a===e._id){u(null);return}if(!d[e._id]){let n=await t({feedbackId:e._id});f(t=>({...t,[e._id]:n}))}u(e._id)}async function m(e){await r({title:U(),description:N(),confirmLabel:A(),destructive:!0})&&(await n({feedbackId:e._id}),a===e._id&&u(null))}return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`p`,{className:`oc-admin__hint`,children:[l(),` `,(0,X.jsx)(`strong`,{children:y()}),` `,_()]}),(0,X.jsx)(he,{title:g(),rows:e,emptyHint:R(),isExpanded:e=>a===e._id&&!!d[e._id],renderExpanded:e=>d[e._id]?(0,X.jsx)(ge,{data:d[e._id],closeReason:e.userCloseReason}):null,columns:[{header:i(),cell:e=>new Date(e.at).toLocaleString(`fr-FR`),sort:e=>e.at},{header:z(),cell:e=>Q(e.category),sort:e=>Q(e.category)},{header:v(),cell:e=>e.messageRole===`user`?s():c(),sort:e=>e.messageRole},{header:re(),cell:e=>(e.reporterEmail||e.reporterName||`—`)+(e.impersonated&&e.realOperatorEmail?` ${le({operator:e.realOperatorEmail})}`:``),sort:e=>e.reporterEmail||e.reporterName||null},{header:o(),cell:e=>(0,X.jsx)($,{matches:e.displayedMatchesStored,sourceWasOpen:e.sourceWasOpen}),sort:e=>e.displayedMatchesStored===!1?0:e.displayedMatchesStored===!0?1:2},{header:ne(),cell:e=>e.hasComment?`✎`:`—`,sort:e=>+!!e.hasComment},{header:ue(),cell:e=>e.userClosedAt==null?e.answered?(0,X.jsx)(`span`,{className:`oc-fbadmin__pill is-ok`,children:D()}):(0,X.jsx)(`span`,{className:`oc-fbadmin__pill`,children:de()}):(0,X.jsx)(`span`,{className:`oc-fbadmin__pill is-closed`,children:ce()}),sort:e=>e.userClosedAt==null?+!!e.answered:2}],rowActions:e=>[{label:a===e._id?F():I(),onSelect:()=>void p(e)},{label:B(),onSelect:()=>void m(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{dE as t,wE as n}from"./dist-CKhDstdM.js";import{c as r,l as i,s as a,u as o}from"./index-DR0RpyTI.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
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{$w as r,Bw as ee,Fw as i,Gw as te,Hw as a,Iw as ne,Jw as re,Kw as ie,LT as o,Lw as s,Pw as c,Qw as l,Rw as u,Uw as d,Vw as f,Ww as ae,Xw as oe,Yw as se,Zw as ce,_E as le,aT as ue,cT as de,dT as p,eT as m,fT as h,gE as fe,hT as pe,iT as g,kb as me,lT as he,mT as ge,nT as _,oT as _e,pT as ve,qw as v,rT as y,sT as b,tT as x,uE as S,uT as C,zT as w,zw as T}from"./dist-CKhDstdM.js";import{t as E}from"./button-HRR8tdJ2.js";import{A as D,B as O,C as k,E as A,F as j,G as M,I as N,K as P,L as F,N as ye,P as be,R as xe,S as I,T as L,Tt as R,W as Se,X as Ce,Y as we,ht as Te,w as z,wt as Ee,yt as De,z as Oe}from"./index-DR0RpyTI.js";import{a as ke,i as B,n as Ae,o as V,r as H,t as je}from"./table-fGxqLVNE.js";var U=t(e(),1),W=n(),G=`all`;function K(e){switch(e){case`image`:return g();case`audio`:return y();case`video`:return _();case`pdf`:return x();case`document`:return m();case`archive`:return r();default:return l()}}function q(){let[e,t]=(0,U.useState)(G),[n,r]=(0,U.useState)(G),[l,m]=(0,U.useState)(G),[g,_]=(0,U.useState)(G),[y,x]=(0,U.useState)(null),q=fe(S.files.softDelete),J=D();function Me(){t(G),r(G),m(G),_(G)}async function Ne(){let e=y;if(x(null),e)try{await q({fileId:e.id}),J.success(f())}catch(e){J.error(ee(),e)}}let Y=le(S.files.listMine,{direction:e===G?void 0:e,chatId:n===G?void 0:n,instanceName:l===G?void 0:l,category:g===G?void 0:g}),X=(0,U.useMemo)(()=>new Intl.DateTimeFormat(w(),{dateStyle:`medium`,timeStyle:`short`}),[]);if(Y===void 0)return(0,W.jsx)(`p`,{className:`oc-admin__hint`,children:o()});let{files:Z,facets:Q,truncated:Pe,cap:Fe}=Y,$=e!==G||n!==G||l!==G||g!==G;return(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`p`,{className:`oc-admin__hint`,children:pe()}),(0,W.jsxs)(`div`,{className:`oc-files__filters`,style:{display:`flex`,flexWrap:`wrap`,gap:8,margin:`12px 0`},children:[(0,W.jsxs)(I,{value:e,onValueChange:t,children:[(0,W.jsx)(L,{size:`sm`,"aria-label":ge(),children:(0,W.jsx)(A,{})}),(0,W.jsxs)(k,{children:[(0,W.jsx)(z,{value:G,children:ve()}),(0,W.jsx)(z,{value:`inbound`,children:h()}),(0,W.jsx)(z,{value:`outbound`,children:p()})]})]}),(0,W.jsxs)(I,{value:n,onValueChange:r,children:[(0,W.jsx)(L,{size:`sm`,"aria-label":C(),children:(0,W.jsx)(A,{})}),(0,W.jsxs)(k,{children:[(0,W.jsx)(z,{value:G,children:he()}),Q.chats.map(e=>(0,W.jsx)(z,{value:e.id,children:e.title},e.id))]})]}),Q.multiProvider?(0,W.jsxs)(I,{value:l,onValueChange:m,children:[(0,W.jsx)(L,{size:`sm`,"aria-label":de(),children:(0,W.jsx)(A,{})}),(0,W.jsxs)(k,{children:[(0,W.jsx)(z,{value:G,children:b()}),Q.instances.map(e=>(0,W.jsx)(z,{value:e,children:e},e))]})]}):null,(0,W.jsxs)(I,{value:g,onValueChange:_,children:[(0,W.jsx)(L,{size:`sm`,"aria-label":_e(),children:(0,W.jsx)(A,{})}),(0,W.jsxs)(k,{children:[(0,W.jsx)(z,{value:G,children:ue()}),Q.categories.map(e=>(0,W.jsx)(z,{value:e,children:K(e)},e))]})]}),$?(0,W.jsxs)(E,{variant:`ghost`,size:`sm`,onClick:Me,style:{display:`inline-flex`,alignItems:`center`,gap:4,marginLeft:`auto`},children:[(0,W.jsx)(De,{size:14,"aria-hidden":!0}),ae()]}):null]}),Z.length===0?(0,W.jsx)(`p`,{className:`oc-admin__hint`,children:$?i():ne()}):(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:ce()}),(0,W.jsx)(B,{children:oe()}),(0,W.jsx)(B,{children:se()}),(0,W.jsx)(B,{children:re()}),(0,W.jsx)(B,{children:v()}),(0,W.jsx)(B,{className:`text-right`,children:ie()})]})}),(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`?h():p()})}),(0,W.jsx)(H,{style:{maxWidth:220,overflow:`hidden`,textOverflow:`ellipsis`},title:e.chatTitle,children:e.chatTitle}),(0,W.jsx)(H,{className:`whitespace-nowrap text-muted-foreground`,children:X.format(e.createdAt)}),(0,W.jsx)(H,{className:`text-right`,children:(0,W.jsxs)(Se,{children:[(0,W.jsx)(we,{asChild:!0,children:(0,W.jsx)(E,{variant:`ghost`,size:`icon`,"aria-label":d(),children:(0,W.jsx)(Ee,{size:16})})}),(0,W.jsxs)(M,{align:`end`,children:[e.url?(0,W.jsx)(P,{asChild:!0,children:(0,W.jsxs)(`a`,{href:e.url,download:e.filename,target:`_blank`,rel:`noopener noreferrer`,children:[(0,W.jsx)(R,{size:14}),te()]})}):(0,W.jsxs)(P,{disabled:!0,children:[(0,W.jsx)(R,{size:14}),s()]}),(0,W.jsxs)(P,{variant:`destructive`,onSelect:()=>x({id:e._id,filename:e.filename}),children:[(0,W.jsx)(Te,{size:14}),a()]})]})]})})]},e._id))})]}),Pe?(0,W.jsx)(`p`,{className:`oc-admin__hint`,style:{marginTop:8},children:c({cap:Fe})}):null]}),(0,W.jsx)(ye,{open:y!==null,onOpenChange:e=>!e&&x(null),children:(0,W.jsxs)(N,{children:[(0,W.jsxs)(Oe,{children:[(0,W.jsx)(O,{children:T()}),(0,W.jsx)(F,{children:u()})]}),(0,W.jsxs)(xe,{children:[(0,W.jsx)(j,{children:me()}),(0,W.jsx)(be,{onClick:()=>void Ne(),children:a()})]})]})})]})}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{Oo as r,ko as i}from"./dist-CKhDstdM.js";import{t as a}from"./TimeRangePicker-BJ_SDnZN.js";import{t as o}from"./button-HRR8tdJ2.js";import{Z as s,vt as c,yt as l}from"./index-DR0RpyTI.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{$r as r,Ai as i,Bi as a,Br as o,Ci as s,Di as c,Ei as l,Fi as u,Fr as d,Gr as f,Hi as p,Hr as m,Ii as h,Ir as g,Jr as _,Kr as v,Li as y,Lr as b,Mi as ee,Ni as x,Oi as S,Pi as te,Pr as C,Qr as w,Ri as ne,Rr as T,Si as E,Ti as D,Ui as re,Ur as O,Vi as k,Vr as A,Wr as j,Xr as M,Yr as N,Zr as P,_E as F,_i as ie,ai as I,bi as ae,ci as oe,dE as L,di as se,ei as ce,fi as le,gE as R,gi as ue,hi as de,ii as fe,ji as pe,ki as me,li as he,mi as z,ni as ge,oi as _e,pi as ve,qr as ye,ri as be,si as xe,ti as Se,uE as B,ui as Ce,vi as we,wi as Te,xi as Ee,yi as De,zi as Oe,zr as ke}from"./dist-CKhDstdM.js";import{t as Ae}from"./x-Dnhgu6fy.js";import{i as V,n as H,r as je,t as Me}from"./tabs-Bh17c652.js";import{t as U}from"./button-HRR8tdJ2.js";import{$ as Ne,A as W,C as Pe,E as Fe,Ot as Ie,Q as Le,S as Re,T as ze,X as G,Z as K,_t as q,et as Be,gt as J,j as Ve,m as He,nt as Ue,ot as We,rt as Ge,w as Ke,x as Y}from"./index-DR0RpyTI.js";import{t as qe}from"./FilterBar-DZBiB1MF.js";import{t as Je}from"./DataTableShell-67hI2aZh.js";import{t as X}from"./DetailChips-CTU-lZny.js";var Ye=L(`chevron-left`,[[`path`,{d:`m15 18-6-6 6-6`,key:`1wnfg3`}]]),Xe=L(`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`}]]),Z=L(`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`}]]),Ze=L(`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`}]]),Q=t(e(),1);function Qe(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 $e(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 et(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 tt(e){switch(e){case`admin`:return Ce();case`user`:return he();case`pending`:return oe();default:return e}}function nt(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 rt(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 $=n(),it={name:``,description:``};function at(){let e=F(B.groups.listGroups,{}),t=F(B.me.getMe,{host:We})?.role===`admin`,n=R(B.groups.createGroup),r=R(B.groups.updateGroup),o=R(B.groups.deleteGroup),d=Ve(),f=W(),[m,_]=(0,Q.useState)(!1),[v,C]=(0,Q.useState)(null),[w,T]=(0,Q.useState)(it),[O,A]=(0,Q.useState)(null),[j,M]=(0,Q.useState)(``),N=(0,Q.useMemo)(()=>{if(!e)return e;let t=j.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,j]);function P(){C(null),T(it),_(!0)}function ie(e){C(e),T({name:e.name,description:e.description??``}),_(!0)}async function I(){try{v?await r({groupId:v._id,name:w.name,description:w.description}):await n({name:w.name,description:w.description||void 0}),T(it),C(null),_(!1)}catch(e){f.error(b(),e)}}async function ae(e){if(await d({title:Te({name:e.name}),description:s(),confirmWord:e.name,confirmLabel:E(),cancelLabel:i(),destructive:!0}))try{await o({groupId:e._id})}catch(e){f.error(g(),e)}}return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`p`,{className:`oc-admin__hint`,children:p()}),(0,$.jsx)(qe,{q:j,onQChange:M,onReset:()=>M(``),canReset:j!==``,searchPlaceholder:u()}),(0,$.jsx)(Je,{title:re(),rows:N,addLabel:k(),onAdd:t?P:void 0,emptyHint:a(),columns:[{header:Oe(),cell:e=>e.name,sort:e=>e.name},{header:ne(),cell:e=>(0,$.jsx)(X,{icon:(0,$.jsx)(Ze,{size:12,"aria-hidden":!0}),total:e.memberCount,items:e.members.map(e=>({label:e.label,marker:e.manager?(0,$.jsx)(Z,{size:11,"aria-hidden":!0}):null,highlight:e.manager}))}),sort:e=>e.memberCount},{header:y(),cell:e=>(0,$.jsx)(X,{icon:(0,$.jsx)(q,{size:12,"aria-hidden":!0}),total:e.agentCount,items:e.agents.map(e=>({label:e}))}),sort:e=>e.agentCount},{header:h(),cell:e=>(0,$.jsx)(X,{icon:(0,$.jsx)(Xe,{size:12,"aria-hidden":!0}),total:e.chartCount,items:e.charts.map(e=>({label:e.name,marker:e.isDefault?(0,$.jsx)(J,{size:11,fill:`currentColor`,"aria-hidden":!0}):null,highlight:e.isDefault}))}),sort:e=>e.chartCount}],rowActions:e=>[{label:te(),onSelect:()=>A({groupId:e._id,name:e.name})},...t?[{label:x(),onSelect:()=>ie(e)},{label:ee(),variant:`destructive`,onSelect:()=>void ae(e)}]:[]]}),(0,$.jsx)(He,{open:m,onOpenChange:_,title:v?S():me(),description:c(),canSubmit:!!w.name.trim(),onSubmit:I,submitLabel:pe(),children:(0,$.jsxs)(`div`,{className:`oc-form`,children:[(0,$.jsxs)(`label`,{className:`oc-field`,children:[(0,$.jsx)(`span`,{className:`oc-field__label`,children:l()}),(0,$.jsx)(K,{value:w.name,onChange:e=>T({...w,name:e.target.value})})]}),(0,$.jsxs)(`label`,{className:`oc-field`,children:[(0,$.jsx)(`span`,{className:`oc-field__label`,children:D()}),(0,$.jsx)(K,{value:w.description,onChange:e=>T({...w,description:e.target.value})})]})]})}),(0,$.jsx)(ct,{groupId:O?.groupId??null,groupName:O?.name??``,open:O!==null,onOpenChange:e=>{e||A(null)}})]})}var ot=8;function st({page:e,pageCount:t,onPage:n}){return t<=1?null:(0,$.jsxs)(`div`,{className:`oc-access__pager`,children:[(0,$.jsxs)(U,{type:`button`,variant:`ghost`,size:`sm`,disabled:e<=1,onClick:()=>n(e-1),children:[(0,$.jsx)(Ye,{size:14,"aria-hidden":!0}),ve()]}),(0,$.jsxs)(`span`,{className:`oc-access__pageinfo`,"aria-label":se({page:e,pages:t}),children:[e,` / `,t]}),(0,$.jsxs)(U,{type:`button`,variant:`ghost`,size:`sm`,disabled:e>=t,onClick:()=>n(e+1),children:[le(),(0,$.jsx)(Ie,{size:14,"aria-hidden":!0})]})]})}function ct({groupId:e,groupName:t,open:n,onOpenChange:r}){let i=F(B.groups.getGroup,n&&e?{groupId:e}:`skip`),a=F(B.groups.listAssignableInstances,n?{}:`skip`),s=F(B.groups.listAssignableUsers,n?{}:`skip`),c=R(B.groups.addMember),l=R(B.groups.removeMember),u=R(B.groups.bulkSetMembers),f=R(B.groups.setGroupManager),p=W(),[h,g]=(0,Q.useState)(``),[_,v]=(0,Q.useState)(``),[y,b]=(0,Q.useState)(`members`),[ee,x]=(0,Q.useState)(1),[S,te]=(0,Q.useState)(new Set),C=(0,Q.useRef)(null),w=(0,Q.useMemo)(()=>new Set((i?.members??[]).map(e=>e.userId)),[i]),ne=(0,Q.useMemo)(()=>new Set((i?.members??[]).filter(e=>e.manager).map(e=>e.userId)),[i]),T=i?.viewerIsAdmin===!0,E=(0,Q.useMemo)(()=>new Set((i?.agents??[]).map(e=>`${e.instanceName}/${e.agentId}`)),[i]);(0,Q.useEffect)(()=>{g(``),v(``),b(`members`),x(1),C.current=null},[n,e]),(0,Q.useEffect)(()=>{x(1)},[h]),(0,Q.useEffect)(()=>{n&&i&&e&&C.current!==e&&(C.current=e,te(new Set((i.members??[]).map(e=>e.userId))))},[n,i,e]);let D=(0,Q.useMemo)(()=>s?Qe(s,h,S):[],[s,h,S]);async function re(t,n){if(e)try{n?await l({groupId:e,userId:t}):await c({groupId:e,userId:t})}catch(e){p.error(d(),e)}}async function O(t,n){if(e)try{await f({groupId:e,userId:t,manager:!n})}catch(e){p.error(ke(),e)}}let k=nt(D,e=>w.has(e.userId)),j=D.filter(e=>w.has(e.userId)).length,N=rt(D,ee,ot);async function P(){if(!e||D.length===0)return;let t=D.map(e=>e.userId);try{await u({groupId:e,userIds:t,member:k!==`all`})}catch(e){p.error(d(),e)}}return(0,$.jsx)(Le,{open:n,onOpenChange:r,children:(0,$.jsxs)(Ne,{className:`oc-access`,children:[(0,$.jsxs)(Ue,{children:[(0,$.jsx)(Ge,{children:Ee({name:t})}),(0,$.jsx)(Be,{children:ae()})]}),(0,$.jsxs)(Me,{value:y,onValueChange:b,className:`oc-access__tabs`,children:[(0,$.jsxs)(je,{className:`w-full`,children:[(0,$.jsxs)(V,{value:`members`,className:`flex-1 gap-1.5`,children:[(0,$.jsx)(Ze,{size:13,"aria-hidden":!0}),De(),i?(0,$.jsx)(G,{variant:`secondary`,className:`oc-access__tabcount`,children:w.size}):null]}),(0,$.jsxs)(V,{value:`agents`,className:`flex-1 gap-1.5`,children:[(0,$.jsx)(q,{size:13,"aria-hidden":!0}),ie(),i?(0,$.jsx)(G,{variant:`secondary`,className:`oc-access__tabcount`,children:E.size}):null]}),(0,$.jsxs)(V,{value:`charts`,className:`flex-1 gap-1.5`,children:[(0,$.jsx)(Xe,{size:13,"aria-hidden":!0}),M(),i?(0,$.jsx)(G,{variant:`secondary`,className:`oc-access__tabcount`,children:i.chartCount}):null]})]}),(0,$.jsx)(H,{value:`members`,children:s===void 0||i===void 0?(0,$.jsx)(`p`,{className:`oc-access__hint`,children:I()}):s.length===0?(0,$.jsx)(`p`,{className:`oc-access__hint`,children:be()}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(K,{value:h,onChange:e=>g(e.target.value),placeholder:we(),className:`oc-access__search`}),D.length===0?(0,$.jsx)(`p`,{className:`oc-access__hint`,children:de()}):(0,$.jsxs)($.Fragment,{children:[D.length>1?(0,$.jsxs)(`div`,{className:`oc-access__row oc-access__selectall`,children:[(0,$.jsx)(Y,{checked:k===`all`?!0:k===`some`?`indeterminate`:!1,onCheckedChange:()=>void P(),"aria-label":z()}),(0,$.jsx)(`span`,{className:`oc-access__label`,children:z()}),(0,$.jsxs)(G,{variant:`outline`,className:`oc-access__count`,children:[j,` / `,D.length]})]}):null,(0,$.jsx)(`div`,{className:`oc-access__list`,children:N.pageItems.map(e=>{let t=w.has(e.userId),n=et(e),r=ne.has(e.userId);return(0,$.jsxs)(`div`,{className:`oc-access__row`,children:[(0,$.jsx)(Y,{checked:t,onCheckedChange:()=>void re(e.userId,t),"aria-label":xe({user:n.primary})}),(0,$.jsxs)(`span`,{className:`oc-access__who`,children:[(0,$.jsx)(`span`,{className:`oc-access__label`,title:n.primary,children:n.primary}),n.secondary?(0,$.jsx)(`span`,{className:`oc-access__sub`,title:n.secondary,children:n.secondary}):null]}),(0,$.jsx)(G,{variant:`outline`,className:`oc-access__role`,children:tt(e.role)}),(0,$.jsx)(`span`,{className:`oc-access__mgrslot`,children:t&&T?(0,$.jsx)(U,{type:`button`,variant:`ghost`,size:`icon`,className:`shrink-0 oc-access__mgr${r?` oc-access__mgr--on`:``}`,"aria-pressed":r,"aria-label":r?o():A(),title:r?o():A(),onClick:()=>void O(e.userId,r),children:(0,$.jsx)(Z,{size:15,"aria-hidden":!0})}):t&&r?(0,$.jsx)(`span`,{className:`oc-access__mgr oc-access__mgr--on`,role:`img`,"aria-label":m(),title:m(),children:(0,$.jsx)(Z,{size:15,"aria-hidden":!0})}):null})]},e._id)})}),(0,$.jsx)(st,{page:N.page,pageCount:N.pageCount,onPage:x})]})]})}),(0,$.jsx)(H,{value:`agents`,children:a===void 0?(0,$.jsx)(`p`,{className:`oc-access__hint`,children:I()}):a.length===0?(0,$.jsx)(`p`,{className:`oc-access__hint`,children:ge()}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(K,{value:_,onChange:e=>v(e.target.value),placeholder:ue(),className:`oc-access__search`}),(0,$.jsx)(`div`,{className:`oc-access__list`,children:a.map(t=>(0,$.jsx)(lt,{groupId:e,instanceName:t.name,kind:t.kind??`openclaw`,assigned:E,query:_},`${e}-${t._id}`))})]})}),(0,$.jsx)(H,{value:`charts`,children:(0,$.jsx)(ut,{groupId:e})})]})]})})}function lt({groupId:e,instanceName:t,kind:n,assigned:i,query:a}){let o=F(B.groups.listAssignableAgents,{instanceName:t}),s=R(B.groups.assignAgentToGroup),c=R(B.groups.removeAgentFromGroup),l=R(B.groups.bulkSetGroupAgents),u=W(),[d,f]=(0,Q.useState)(1);if((0,Q.useEffect)(()=>{f(1)},[a]),!e)return null;let p=$e(o?.agents??[],a),m=o?.discovery&&!o.discovery.lastPollOk;if(a.trim()&&p.length===0)return null;let h=p.filter(e=>e.presentInLastOk!==!1),g=nt(h,e=>i.has(`${t}/${e.agentId}`)),_=rt(p,d,ot);async function v(n,r){try{r?await c({groupId:e,instanceName:t,agentId:n}):await s({groupId:e,instanceName:t,agentId:n})}catch(e){u.error(C(),e)}}async function y(){if(h.length===0)return;let n=h.map(e=>e.agentId);try{await l({groupId:e,instanceName:t,agentIds:n,assigned:g!==`all`})}catch(e){u.error(C(),e)}}return(0,$.jsxs)(`div`,{className:`oc-access__group`,children:[(0,$.jsxs)(`div`,{className:`oc-access__instance`,children:[(0,$.jsx)(q,{size:13,"aria-hidden":!0}),(0,$.jsx)(`span`,{children:t}),(0,$.jsx)(G,{variant:`outline`,className:`oc-access__kind`,children:n}),m?(0,$.jsx)(G,{variant:`outline`,className:`oc-access__stale`,children:r()}):null]}),o===void 0?(0,$.jsx)(`p`,{className:`oc-access__hint`,children:fe()}):p.length===0?(0,$.jsx)(`p`,{className:`oc-access__hint`,children:m?ce():Se()}):(0,$.jsxs)($.Fragment,{children:[h.length>1?(0,$.jsxs)(`div`,{className:`oc-access__row oc-access__selectall`,children:[(0,$.jsx)(Y,{checked:g===`all`?!0:g===`some`?`indeterminate`:!1,onCheckedChange:()=>void y(),"aria-label":z()}),(0,$.jsx)(`span`,{className:`oc-access__label`,children:z()})]}):null,_.pageItems.map(e=>{let n=`${t}/${e.agentId}`,r=i.has(n),a=e.presentInLastOk===!1;return(0,$.jsxs)(`div`,{className:`oc-access__row`,children:[(0,$.jsx)(Y,{checked:r,disabled:a&&!r,onCheckedChange:()=>void v(e.agentId,r),"aria-label":_e({name:e.displayName??e.agentId})}),(0,$.jsxs)(`span`,{className:`oc-access__label`,title:e.displayName??e.agentId,children:[e.emoji?`${e.emoji} `:``,e.displayName??e.agentId]}),e.model?(0,$.jsx)(`span`,{className:`oc-access__model`,children:e.model}):null,e.isDefaultOnInstance?(0,$.jsx)(`span`,{className:`oc-access__fav`,role:`img`,"aria-label":P(),title:P(),children:(0,$.jsx)(J,{size:14,fill:`currentColor`})}):null,a?(0,$.jsx)(G,{variant:`outline`,className:`oc-access__gone`,children:w()}):null]},e.agentId)}),(0,$.jsx)(st,{page:_.page,pageCount:_.pageCount,onPage:f})]})]})}function ut({groupId:e}){let t=F(B.charts.listGroupChartSelection,e?{groupId:e}:`skip`),n=R(B.charts.assignChartToGroup),r=R(B.charts.removeChartFromGroup),i=R(B.charts.setGroupDefaultChart),a=R(B.charts.addChartToGroupPool),o=R(B.charts.removeChartFromGroupPool),s=W();if(!e)return null;if(t===void 0)return(0,$.jsx)(`p`,{className:`oc-access__hint`,children:I()});let{pool:c,addable:l,canManagePool:u}=t;if(c.length===0&&!u)return(0,$.jsx)(`p`,{className:`oc-access__hint`,children:N()});async function d(t,i){try{i?await r({groupId:e,chartKey:t}):await n({groupId:e,chartKey:t})}catch(e){s.error(T(),e)}}async function p(t){try{await i({groupId:e,chartKey:t})}catch(e){s.error(T(),e)}}async function m(t){try{await a({groupId:e,chartKey:t})}catch(e){s.error(T(),e)}}async function h(t){try{await o({groupId:e,chartKey:t})}catch(e){s.error(T(),e)}}return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`div`,{className:`oc-access__list`,children:c.map(e=>(0,$.jsxs)(`div`,{className:`oc-access__row`,children:[(0,$.jsx)(Y,{checked:e.selected,onCheckedChange:()=>void d(e.chartKey,e.selected),"aria-label":f({name:e.name})}),(0,$.jsx)(`span`,{className:`oc-access__label`,title:e.name,children:e.name}),e.selected?e.isDefault?(0,$.jsx)(`span`,{className:`oc-access__fav`,role:`img`,"aria-label":j(),title:j(),children:(0,$.jsx)(J,{size:14,fill:`currentColor`})}):(0,$.jsx)(U,{type:`button`,variant:`ghost`,size:`sm`,onClick:()=>void p(e.chartKey),children:O()}):null,u?(0,$.jsx)(U,{type:`button`,variant:`ghost`,size:`sm`,"aria-label":v({name:e.name}),title:v({name:e.name}),onClick:()=>void h(e.chartKey),children:(0,$.jsx)(Ae,{size:14,"aria-hidden":!0})}):null]},e.chartKey))}),u?l.length>0?(0,$.jsxs)(Re,{value:``,onValueChange:e=>void m(e),children:[(0,$.jsx)(ze,{size:`sm`,className:`oc-access__search`,children:(0,$.jsx)(Fe,{placeholder:ye()})}),(0,$.jsx)(Pe,{children:l.map(e=>(0,$.jsx)(Ke,{value:e.chartKey,children:e.name},e.chartKey))})]}):c.length===0?(0,$.jsx)(`p`,{className:`oc-access__hint`,children:_()}):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{$m as r,$p as i,Ah as a,Am as o,Bm as s,Ch as c,Cm as l,Dh as u,Dm as d,Eh as f,Em as p,Fh as m,Fm as h,Gm as g,Hm as _,Ih as v,Im as y,Jl as b,Jm as x,Km as S,Lh as C,Lm as w,Mh as T,Mm as E,Nh as ee,Nm as te,Oh as ne,Om as re,Ph as ie,Pm as ae,Qm as oe,Qp as se,Rm as ce,Sh as le,Sm as ue,Th as de,Tm as fe,Um as pe,Vm as me,Wm as he,Xm as ge,Ym as _e,Zm as ve,Zp as ye,_E as D,_h as be,_m as xe,_x as O,ah as Se,am as Ce,bh as we,bm as Te,ch as Ee,cm as De,dh as Oe,dm as ke,eh as k,em as Ae,fh as je,fm as Me,gE as A,gh as Ne,gm as Pe,hh as Fe,hm as Ie,ih as Le,im as Re,jh as ze,jm as Be,kh as Ve,km as He,lh as Ue,lm as We,mE as j,mh as Ge,mm as Ke,nh as qe,nm as Je,oh as Ye,om as Xe,ph as Ze,pm as Qe,ql as $e,qm as et,rh as tt,rm as nt,sh as rt,sm as it,th as at,tm as ot,uE as M,uh as st,um as ct,vh as lt,vm as N,vx as ut,wh as dt,wm as ft,xh as pt,xm as mt,yh as ht,ym as gt,zm as _t}from"./dist-CKhDstdM.js";import{a as vt,c as yt}from"./FieldLabel-D8l7ss4W.js";import{t as P}from"./button-HRR8tdJ2.js";import{$ as F,A as I,C as L,E as R,H as bt,Q as z,S as B,T as V,U as xt,V as St,X as H,Z as U,et as W,j as Ct,m as wt,nt as G,rt as K,w as q,x as J}from"./index-DR0RpyTI.js";import{t as Tt}from"./DataTableShell-67hI2aZh.js";import{InstanceConfigDialog as Et}from"./BridgeTab-H12vdjQc.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(M.admin.listInstances,{}),t=D(M.agents.listAllInstanceAgents,{}),n=A(M.admin.upsertInstance),r=A(M.admin.deleteInstance),i=I(),[o,s]=(0,Y.useState)(!1),[l,d]=(0,Y.useState)(Q),[p,h]=(0,Y.useState)(null),[g,_]=(0,Y.useState)(null),[y,x]=(0,Y.useState)(null),[S,w]=(0,Y.useState)(null);async function E(){try{await n({instanceId:S??void 0,name:l.name,gatewayUrl:l.gatewayUrl,bridgeUrl:l.bridgeUrl||void 0,displayName:l.displayName||void 0,kind:l.kind,gatewayVersion:l.gatewayVersion||void 0,gatewayHttpUrl:l.gatewayHttpUrl||void 0,streamTransport:l.streamTransport}),d(Q),w(null),s(!1)}catch(e){i.error(m(),e)}}return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`p`,{className:`oc-admin__hint`,children:[ie(),(0,Z.jsx)(`strong`,{children:ee()}),T()]}),(0,Z.jsx)(Tt,{title:ze(),rows:e,addLabel:a(),onAdd:()=>{w(null),d(Q),s(!0)},emptyHint:Ve(),columns:[{header:ne(),cell:e=>e.name,sort:e=>e.name},{header:u(),cell:e=>(0,Z.jsx)(H,{variant:`outline`,children:e.kind??`openclaw`}),sort:e=>e.kind??`openclaw`},{header:f(),cell:e=>e.gatewayUrl,sort:e=>e.gatewayUrl},{header:de(),cell:e=>e.displayName??`—`,sort:e=>e.displayName??null},{header:C(),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)(H,{variant:r(e.agentId)?`default`:`outline`,title:r(e.agentId)?se():void 0,children:[e.emoji?`${e.emoji} `:``,e.displayName??e.agentId]},e.agentId))})}}],rowActions:e=>[{label:pt(),onSelect:()=>{w(e._id),d(jt(e)),s(!0)}},{label:v(),onSelect:()=>h(e.name)},{label:Ye(),onSelect:()=>x(e)},{label:dt(),onSelect:()=>_(e)},{label:c(),variant:`destructive`,onSelect:()=>void r({instanceId:e._id})}],bulkActions:[{label:c(),variant:`destructive`,onSelect:e=>e.forEach(e=>void r({instanceId:e}))}]}),(0,Z.jsx)(wt,{open:o,onOpenChange:s,title:S?we():le(),description:lt(),canSubmit:!!(l.name&&l.gatewayUrl),onSubmit:E,submitLabel:be(),children:(0,Z.jsxs)(`div`,{className:`oc-form`,children:[(0,Z.jsxs)($,{label:Ne(),children:[(0,Z.jsx)(U,{value:l.name,disabled:S!==null,onChange:e=>d({...l,name:e.target.value})}),S?(0,Z.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:ht()}):null]}),(0,Z.jsx)($,{label:Fe(),children:(0,Z.jsxs)(B,{value:l.kind,onValueChange:e=>d({...l,kind:e}),children:[(0,Z.jsx)(V,{size:`sm`,className:`w-40`,children:(0,Z.jsx)(R,{})}),(0,Z.jsxs)(L,{children:[(0,Z.jsx)(q,{value:`openclaw`,children:`OpenClaw`}),(0,Z.jsx)(q,{value:`hermes`,children:`Hermes`})]})]})}),(0,Z.jsx)($,{label:Ge(),children:(0,Z.jsx)(U,{value:l.gatewayUrl,onChange:e=>d({...l,gatewayUrl:e.target.value})})}),(0,Z.jsx)($,{label:Ze(),children:(0,Z.jsx)(U,{value:l.bridgeUrl,placeholder:je(),onChange:e=>d({...l,bridgeUrl:e.target.value})})}),(0,Z.jsx)($,{label:Oe(),children:(0,Z.jsx)(U,{value:l.displayName,onChange:e=>d({...l,displayName:e.target.value})})}),(0,Z.jsxs)($,{label:b(),children:[(0,Z.jsxs)(B,{value:l.streamTransport,onValueChange:e=>d({...l,streamTransport:e}),children:[(0,Z.jsx)(V,{size:`sm`,className:`w-40`,children:(0,Z.jsx)(R,{})}),(0,Z.jsx)(L,{children:yt.map(e=>(0,Z.jsx)(q,{value:e,children:e},e))})]}),(0,Z.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:$e()})]}),(0,Z.jsx)($,{label:st(),children:(0,Z.jsx)(U,{value:l.gatewayVersion,placeholder:Ue(),onChange:e=>d({...l,gatewayVersion:e.target.value})})}),(0,Z.jsx)($,{label:Ee(),children:(0,Z.jsx)(U,{value:l.gatewayHttpUrl,placeholder:rt(),onChange:e=>d({...l,gatewayHttpUrl:e.target.value})})})]})}),(0,Z.jsx)(Ht,{instanceName:p,open:p!==null,onOpenChange:e=>{e||h(null)}}),g?(0,Z.jsx)(Et,{instance:g,onClose:()=>_(null)},g._id):null,y?(0,Z.jsx)(Nt,{instance:y,onClose:()=>x(null)},y._id):null]})}function Nt({instance:e,onClose:t}){let n=D(M.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)(z,{open:!0,onOpenChange:e=>!e&&t(),children:(0,Z.jsxs)(F,{onOpenAutoFocus:e=>e.preventDefault(),children:[(0,Z.jsxs)(G,{children:[(0,Z.jsx)(K,{children:Se({instance:e.displayName??e.name})}),(0,Z.jsx)(W,{children:Le()})]}),(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(M.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(ce());break;case`no_agents`:n.success(y());break;case`no_bridge_url`:n.error(h());break;case`deploy_misconfigured`:n.error(ae());break;case`unauthorized`:n.error(E());break;case`not_served`:n.error(Be());break;default:n.error(te());break}}catch(e){n.error(w(),e)}finally{i(!1)}}}return(0,Z.jsxs)(`div`,{className:`oc-form`,children:[(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:o()}),(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?_t():s()})})]})}function Ft({instance:e}){let t=D(M.bridgeAuth.listBridgeAuthStatus,{}),n=j(M.bridgeAuth.mintBridgeSecret),i=A(M.bridgeAuth.revokeBridgeSecret),a=I(),[o,s]=(0,Y.useState)(!1),[c,u]=(0,Y.useState)(null),[f,m]=(0,Y.useState)(!1),h=(t??[]).find(t=>t.instanceId===e._id),g=h!==void 0;async function _(){if(!o){s(!0);try{u((await n({instanceId:e._id})).plaintext),m(!1)}catch(e){a.error(l(),e)}finally{s(!1)}}}async function v(){if(!o){s(!0);try{await i({instanceId:e._id}),u(null),a.success(ft())}catch(e){a.error(l(),e)}finally{s(!1)}}}async function y(){if(c)try{await navigator.clipboard.writeText(c),m(!0)}catch{}}return(0,Z.jsxs)($,{label:He(),children:[(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:re()}),(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Z.jsx)(H,{variant:g?`outline`:`secondary`,children:g?`${k()} · ${h.prefix}…${h.lastFour}`:r()}),(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(P,{size:`sm`,onClick:()=>void _(),disabled:o,children:g?p():d()}),g?(0,Z.jsx)(P,{size:`sm`,variant:`destructive`,onClick:()=>void v(),disabled:o,children:fe()}):null]})]}),c?(0,Z.jsxs)(`div`,{className:`oc-bridgesecret__reveal`,children:[(0,Z.jsx)(`p`,{className:`oc-sa__minted-warning`,children:ue()}),(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 y(),children:f?ut():O()})]}),(0,Z.jsx)(P,{size:`sm`,variant:`ghost`,onClick:()=>{u(null),m(!1)},children:mt()})]}):null]})}function It({instanceId:e,field:t,updatedAt:n}){let i=j(M.instanceSecrets.setInstanceSecret),a=A(M.instanceSecrets.clearInstanceSecret),o=j(M.deviceIdentity.generateDeviceIdentity),s=I(),[c,l]=(0,Y.useState)(``),[u,d]=(0,Y.useState)(!1),[f,p]=(0,Y.useState)(null),[m,h]=(0,Y.useState)(!1),v=n!==null,y=t===`deviceIdentity`,b=t===`token`?tt():t===`deviceIdentity`?qe():at();async function C(){if(!(!c.trim()||u)){d(!0);try{await i({instanceId:e,field:t,plaintext:c}),l(``),p(null),h(!1),s.success(x())}catch(e){s.error(et(),e)}finally{d(!1)}}}async function w(){if(!u){d(!0);try{await a({instanceId:e,field:t}),p(null),h(!1),s.success(S())}catch(e){s.error(et(),e)}finally{d(!1)}}}async function T(){if(!u){d(!0);try{p(await o({instanceId:e})),h(!1),s.success(pe())}catch(e){s.error(me(),e)}finally{d(!1)}}}let E=f?`openclaw devices approve ${f.id}`:``;async function ee(){if(E)try{await navigator.clipboard.writeText(E),h(!0)}catch{}}return(0,Z.jsxs)($,{label:b,children:[y?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:he()}):null,(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Z.jsx)(H,{variant:v?`outline`:`secondary`,children:v?k():r()}),(0,Z.jsx)(U,{type:`password`,autoComplete:`off`,className:`flex-1 min-w-32`,value:c,placeholder:v?ve():oe(),onChange:e=>l(e.target.value)}),(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(P,{size:`sm`,onClick:()=>void C(),disabled:u||c.trim().length===0,children:ge()}),y?(0,Z.jsx)(P,{size:`sm`,variant:`outline`,onClick:()=>void T(),disabled:u,children:g()}):null,v?(0,Z.jsx)(P,{size:`sm`,variant:`destructive`,onClick:()=>void w(),disabled:u,children:_e()}):null]})]}),f?(0,Z.jsxs)(`div`,{className:`oc-bridgesecret__reveal`,children:[(0,Z.jsx)(`p`,{className:`text-sm font-medium`,children:pe()}),(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:_()}),(0,Z.jsxs)(`div`,{className:`oc-sa__minted-box`,children:[(0,Z.jsx)(`code`,{className:`oc-sa__minted-plain`,children:E}),(0,Z.jsx)(P,{variant:`outline`,size:`sm`,onClick:()=>void ee(),children:m?ut():O()})]}),(0,Z.jsx)(P,{size:`sm`,variant:`ghost`,onClick:()=>{p(null),h(!1)},children:mt()})]}):null]})}var Lt={conversational:Qe,documentary:ke},Rt={conversational:Me,documentary:ct},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:xe()}),t.map(e=>(0,Z.jsx)(H,{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:Pe()})}),(0,Z.jsxs)(bt,{align:`start`,className:`oc-agenttypes-pop`,children:[(0,Z.jsx)(`p`,{className:`oc-agenttypes-pop__title`,children:Ie()}),(0,Z.jsx)(`p`,{className:`oc-agenttypes-pop__hint`,children:Ke()}),(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)(J,{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(M.agents.listAgentsForInstance,t&&e?{instanceName:e}:`skip`),a=A(M.agents.setAgentEnabled).withOptimisticUpdate((e,{instanceName:t,agentId:n,enabled:r})=>{let i=e.getQuery(M.agents.listAgentsForInstance,{instanceName:t});i&&e.setQuery(M.agents.listAgentsForInstance,{instanceName:t},{...i,agents:i.agents.map(e=>e.agentId===n?{...e,enabled:r}:e)})}),o=A(M.agents.setInstanceDefaultAgent).withOptimisticUpdate((e,{instanceName:t,agentId:n})=>{let r=e.getQuery(M.agents.listAgentsForInstance,{instanceName:t});r&&e.setQuery(M.agents.listAgentsForInstance,{instanceName:t},{...r,defaultAgentId:n})}),s=A(M.agents.setAgentTypes).withOptimisticUpdate((e,{instanceName:t,agentId:n,types:r})=>{let i=e.getQuery(M.agents.listAgentsForInstance,{instanceName:t});if(!i)return;let a=kt(r);e.setQuery(M.agents.listAgentsForInstance,{instanceName:t},{...i,agents:i.agents.map(e=>e.agentId===n?{...e,types:a}:e)})}),c=A(M.agents.removeInstanceAgent),l=Ct(),u=I();async function d(t,n){if(e)try{await a({instanceName:e,agentId:t,enabled:n})}catch(e){u.error(N(),e)}}async function f(t){if(e)try{await o({instanceName:e,agentId:t})}catch(e){u.error(N(),e)}}async function p(t,n,r){if(!e)return;let i=r.includes(n)?r.filter(e=>e!==n):[...r,n];try{await s({instanceName:e,agentId:t,types:i})}catch(e){u.error(N(),e)}}async function m(t,n){if(e&&await l({title:it({name:n}),description:Xe(),confirmLabel:Ce(),destructive:!0}))try{await c({instanceName:e,agentId:t}),u.success(Re())}catch(e){u.error(N(),e)}}return(0,Z.jsx)(z,{open:t,onOpenChange:n,children:(0,Z.jsxs)(F,{className:`oc-access`,children:[(0,Z.jsxs)(G,{children:[(0,Z.jsx)(K,{children:Te({name:e??``})}),(0,Z.jsx)(W,{children:gt()})]}),r===void 0?(0,Z.jsx)(`p`,{className:`oc-access__hint`,children:nt()}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`div`,{className:`oc-access__poll`,children:r.discovery===null?Je():r.discovery.lastPollOk?ot():Ae({error:r.discovery.error??`?`})}),r.agents.length===0?(0,Z.jsx)(`p`,{className:`oc-access__hint`,children:i()}):(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)(J,{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)(H,{variant:`outline`,className:`oc-access__gone`,children:ye()}),(0,Z.jsx)(P,{size:`sm`,variant:`ghost`,className:`h-7 text-destructive`,onClick:()=>void m(e.agentId,i),children:De()})]}):n?(0,Z.jsx)(H,{variant:`default`,children:se()}):(0,Z.jsx)(P,{size:`sm`,variant:`outline`,className:`h-7`,disabled:!e.enabled,onClick:()=>void f(e.agentId),children:We()})]}),e.enabled?(0,Z.jsx)(Vt,{agentId:e.agentId,types:a,onToggle:t=>void p(e.agentId,t,a)}):null]},e.agentId)})})]})]})})}function $({label:e,children:t}){return(0,Z.jsxs)(`label`,{className:`oc-field`,children:[(0,Z.jsx)(`span`,{className:`oc-field__label`,children:e}),t]})}export{Mt as InstancesTab};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$_ as r,A_ as i,B_ as a,C_ as o,D_ as s,E_ as c,F_ as l,G_ as u,H_ as ee,I_ as te,J_ as ne,K_ as re,L_ as ie,M_ as ae,N_ as d,O_ as oe,P_ as f,Q_ as p,R_ as m,S_ as h,T_ as g,U_ as _,V_ as v,W_ as y,X_ as b,Y_ as se,Z_ as ce,_E as le,__ as ue,_t as x,av as S,b_ as C,bt as w,ev as T,ft as E,gE as D,g_ as O,gt as k,h_ as A,ht as j,iv as M,j_ as N,k_ as P,mE as F,m_ as I,mt as L,nv as R,p_ as z,pt as B,q_ as V,rv as H,tv as U,uE as W,v_ as de,vt as fe,w_ as pe,x_ as me,y_ as he,yt as ge,z_ as _e}from"./dist-CKhDstdM.js";import{t as G}from"./button-HRR8tdJ2.js";import{C as ve,E as ye,S as be,T as xe,X as K,Z as q,w as Se,x as Ce}from"./index-DR0RpyTI.js";import{t as we}from"./DataTableShell-67hI2aZh.js";var J=t(e(),1),Y=n();function Te(){let e=le(W.integrations.status.status,{}),t=D(W.admin.setIntegrationConfig),[n,x]=(0,J.useState)(null);if((0,J.useEffect)(()=>{e&&n===null&&x(e.config)},[e,n]),!e||!n)return(0,Y.jsx)(`p`,{className:`oc-admin__hint`,children:S()});let E=n,k=(e,t,n)=>x({...E,[e]:{...E[e],[t]:n}}),j=(e,n)=>void t({[e]:n});return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(`p`,{className:`oc-admin__hint`,children:[M(),` `,(0,Y.jsx)(`strong`,{children:H()}),` `,R()]}),(0,Y.jsxs)(X,{title:`Langfuse`,status:e.langfuse.configured?e.langfuse.enabled?(0,Y.jsx)(K,{variant:`secondary`,children:U()}):(0,Y.jsx)(K,{variant:`outline`,children:T()}):(0,Y.jsx)(K,{variant:`outline`,children:r()}),note:ce(),children:[(0,Y.jsx)(Z,{label:se(),children:(0,Y.jsx)(q,{value:E.langfuse.host??``,placeholder:e.langfuse.effectiveHost,onChange:e=>k(`langfuse`,`host`,e.target.value),onBlur:()=>j(`langfuse`,{host:E.langfuse.host??``})})}),(0,Y.jsx)(Q,{label:u(),checked:E.langfuse.enabled??!0,onChange:e=>{k(`langfuse`,`enabled`,e),j(`langfuse`,{enabled:e})}})]}),(0,Y.jsxs)(X,{title:`Opik`,status:e.opik.configured?e.opik.enabled?(0,Y.jsx)(K,{variant:`secondary`,children:U()}):(0,Y.jsx)(K,{variant:`outline`,children:T()}):(0,Y.jsx)(K,{variant:`outline`,children:r()}),note:b(),children:[(0,Y.jsx)(Z,{label:ne(),children:(0,Y.jsx)(q,{value:E.opik.baseUrl??``,placeholder:e.opik.effectiveBaseUrl,onChange:e=>k(`opik`,`baseUrl`,e.target.value),onBlur:()=>j(`opik`,{baseUrl:E.opik.baseUrl??``})})}),(0,Y.jsx)(Z,{label:V(),children:(0,Y.jsx)(q,{value:E.opik.workspace??``,placeholder:e.opik.effectiveWorkspace||re(),onChange:e=>k(`opik`,`workspace`,e.target.value),onBlur:()=>j(`opik`,{workspace:E.opik.workspace??``})})}),(0,Y.jsx)(Q,{label:u(),checked:E.opik.enabled??!0,onChange:e=>{k(`opik`,`enabled`,e),j(`opik`,{enabled:e})}})]}),(0,Y.jsxs)(X,{title:`OpenTelemetry (OTLP)`,status:e.otlp.configured?e.otlp.enabled?(0,Y.jsx)(K,{variant:`secondary`,children:U()}):(0,Y.jsx)(K,{variant:`outline`,children:T()}):(0,Y.jsx)(K,{variant:`outline`,children:w()}),note:ge(),children:[(0,Y.jsx)(Z,{label:fe(),children:(0,Y.jsx)(q,{value:E.otlp.endpoint??``,placeholder:e.otlp.effectiveEndpoint||`https://otlp.example.com/v1/traces`,onChange:e=>k(`otlp`,`endpoint`,e.target.value),onBlur:()=>j(`otlp`,{endpoint:E.otlp.endpoint??``})})}),(0,Y.jsx)(Ee,{headersSet:e.otlp.headersSet}),(0,Y.jsx)(Q,{label:u(),checked:E.otlp.enabled??!0,onChange:e=>{k(`otlp`,`enabled`,e),j(`otlp`,{enabled:e})}})]}),(0,Y.jsxs)(X,{title:y(),status:(0,Y.jsx)(K,{variant:`outline`,children:p()}),note:_(),children:[(0,Y.jsx)(Z,{label:ee(),children:(0,Y.jsx)($,{value:E.tts.auto??`off`,options:[[`off`,v()],[`always`,a()],[`inbound`,_e()],[`tagged`,m()]],onChange:e=>{k(`tts`,`auto`,e),j(`tts`,{auto:e})}})}),(0,Y.jsx)(Z,{label:ie(),children:(0,Y.jsx)($,{value:E.tts.provider??`openai`,options:[[`openai`,`OpenAI`],[`elevenlabs`,`ElevenLabs`],[`microsoft`,te()],[`azure`,`Azure Speech`],[`google`,`Google Gemini`]],onChange:e=>{k(`tts`,`provider`,e),j(`tts`,{provider:e})}})}),(0,Y.jsx)(Z,{label:l(),children:(0,Y.jsx)(q,{value:E.tts.model??``,placeholder:`eleven_multilingual_v2`,onChange:e=>k(`tts`,`model`,e.target.value),onBlur:()=>j(`tts`,{model:E.tts.model??``})})}),(0,Y.jsx)(Z,{label:f(),children:(0,Y.jsx)(q,{value:E.tts.voice??``,placeholder:d(),onChange:e=>k(`tts`,`voice`,e.target.value),onBlur:()=>j(`tts`,{voice:E.tts.voice??``})})})]}),(0,Y.jsxs)(X,{title:ae(),status:(0,Y.jsx)(K,{variant:`outline`,children:p()}),note:e.secrets.openai?N():i(),children:[(0,Y.jsx)(Q,{label:P(),checked:E.talk.enabled??!1,onChange:e=>{k(`talk`,`enabled`,e),j(`talk`,{enabled:e})}}),(0,Y.jsx)(Z,{label:oe(),children:(0,Y.jsx)($,{value:E.talk.realtimeProvider??`openai`,options:[[`openai`,`OpenAI (gpt-realtime)`],[`google`,`Google`]],onChange:e=>{k(`talk`,`realtimeProvider`,e),j(`talk`,{realtimeProvider:e})}})}),(0,Y.jsx)(Z,{label:s(),children:(0,Y.jsx)(q,{value:E.talk.realtimeModel??``,placeholder:`gpt-realtime-2`,onChange:e=>k(`talk`,`realtimeModel`,e.target.value),onBlur:()=>j(`talk`,{realtimeModel:E.talk.realtimeModel??``})})}),(0,Y.jsx)(Z,{label:f(),children:(0,Y.jsx)(q,{value:E.talk.voice??``,placeholder:`cedar / marin`,onChange:e=>k(`talk`,`voice`,e.target.value),onBlur:()=>j(`talk`,{voice:E.talk.voice??``})})}),(0,Y.jsx)(Z,{label:c(),children:(0,Y.jsx)($,{value:E.talk.transport??`webrtc`,options:[[`webrtc`,g()],[`provider-websocket`,`Provider WebSocket`],[`gateway-relay`,`Gateway relay`]],onChange:e=>{k(`talk`,`transport`,e),j(`talk`,{transport:e})}})}),(0,Y.jsx)(Z,{label:pe(),children:(0,Y.jsx)(q,{value:E.talk.speechLocale??``,placeholder:`fr-CA`,onChange:e=>k(`talk`,`speechLocale`,e.target.value),onBlur:()=>j(`talk`,{speechLocale:E.talk.speechLocale??``})})}),(0,Y.jsx)(Q,{label:o(),checked:E.talk.interruptOnSpeech??!0,onChange:e=>{k(`talk`,`interruptOnSpeech`,e),j(`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:h()}),(0,Y.jsx)(K,{variant:`outline`,children:me()})]}),(0,Y.jsxs)(`p`,{className:`oc-uipa__note`,children:[C(),(0,Y.jsx)(`code`,{children:` voicewake.get/set`}),`.`]})]}),(0,Y.jsx)(we,{title:he(),rows:e.cursors.map(e=>({...e,_id:e.vendor})),emptyHint:de(),columns:[{header:ue(),cell:e=>(0,Y.jsx)(K,{variant:`secondary`,children:e.vendor}),sort:e=>e.vendor},{header:O(),cell:e=>e.lastAt>0?new Date(e.lastAt).toLocaleString(`fr-FR`):`—`,sort:e=>e.lastAt>0?e.lastAt:null},{header:A(),cell:e=>String(e.failureCount),sort:e=>e.failureCount},{header:I(),cell:e=>e.lastErrorStatus??`—`,sort:e=>e.lastErrorStatus??null},{header:z(),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)(Ce,{checked:t,onCheckedChange:e=>n(e===!0)}),(0,Y.jsx)(`span`,{children:e})]})}function $({value:e,options:t,onChange:n}){return(0,Y.jsxs)(be,{value:e,onValueChange:n,children:[(0,Y.jsx)(xe,{size:`sm`,className:`w-full`,children:(0,Y.jsx)(ye,{})}),(0,Y.jsx)(ve,{children:t.map(([e,t])=>(0,Y.jsx)(Se,{value:e,children:t},e))})]})}function Ee({headersSet:e}){let t=F(W.integrations.otlpSecret.setOtlpHeaders),n=D(W.integrations.otlpSecret.clearOtlpHeaders),[r,i]=(0,J.useState)(``),[a,o]=(0,J.useState)(null),[s,c]=(0,J.useState)(!1),l=async()=>{c(!0),o(null);try{await t({headersJson:r}),i(``)}catch(e){o(e instanceof Error?e.message:String(e))}finally{c(!1)}};return(0,Y.jsxs)(Z,{label:x(),children:[(0,Y.jsx)(q,{value:r,placeholder:e?k():j(),onChange:e=>i(e.target.value)}),(0,Y.jsxs)(`div`,{className:`oc-int__otlp-headers-actions`,children:[(0,Y.jsx)(G,{size:`sm`,disabled:s||r.trim().length===0,onClick:()=>void l(),children:L()}),e?(0,Y.jsx)(G,{variant:`ghost`,size:`sm`,disabled:s,onClick:()=>void n({}),children:B()}):null]}),a?(0,Y.jsx)(`p`,{className:`oc-int__otlp-headers-error`,children:a}):null,(0,Y.jsx)(`p`,{className:`oc-uipa__note`,children:E()})]})}export{Te as IntegrationsTab};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Av as r,Bv as i,Lv as a,Rv as o,_E as s,_c as c,bc as l,cc as u,dc as d,dy as f,fc as p,gc as m,hc as h,kv as g,lc as _,mc as v,pc as y,uE as b,uc as x,vc as S,xc as C,yc as w,zv as T}from"./dist-CKhDstdM.js";import{n as ee,t as te}from"./TimeRangePicker-BJ_SDnZN.js";import{At as ne,a as re,kt as E,n as D,ot as O,r as k}from"./index-DR0RpyTI.js";import{a as A,n as j,o as M,r as N,t as P}from"./card-DdObfJrM.js";var F=t(e(),1),I=n(),L=15,R=e=>String(Math.round(e));function z(){let e=s(b.me.getMe,{host:O})?.permissions?.includes(`traces.read`)??!1,t=s(b.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:f()}),(0,I.jsxs)(P,{children:[(0,I.jsxs)(A,{children:[(0,I.jsx)(M,{children:i()}),(0,I.jsx)(N,{children:o()})]}),(0,I.jsx)(j,{children:n.length<2?(0,I.jsx)(`p`,{className:`oc-admin__hint`,children:a()}):(0,I.jsx)(B,{series:n})})]})]})}function B({series:e}){let t=e.map(e=>e.cP50),n=e.map(e=>e.aP50),a=Math.max(1,...t,...n),o=t=>6+t*468/(e.length-1),s=e=>74-e*68/a,c=e=>e.map((e,t)=>`${t===0?`M`:`L`}${o(t).toFixed(1)},${s(e).toFixed(1)}`).join(` `),l=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:[g(),` p50 `,R(l.cP50),` `,T()]}),(0,I.jsxs)(`span`,{children:[r(),` p50 `,R(l.aP50),` `,T()]})]}),(0,I.jsxs)(`svg`,{viewBox:`0 0 480 80`,className:`h-20 w-full`,preserveAspectRatio:`none`,role:`img`,"aria-label":i(),children:[(0,I.jsx)(`path`,{d:c(n),fill:`none`,style:{stroke:`var(--muted-foreground)`},strokeWidth:1.5}),(0,I.jsx)(`path`,{d:c(t),fill:`none`,style:{stroke:`var(--primary)`},strokeWidth:1.5})]})]})}var V=[{metric:`api.calls`,label:C(),unit:`/h`,group:`API`,isError:!1},{metric:`api.errors`,label:l(),unit:`/h`,group:`API`,isError:!0},{metric:`api.latency.avg_ms`,label:w(),unit:`ms`,group:`API`,isError:!1},{metric:`openclaw.ingest`,label:S(),unit:`/h`,group:`OpenClaw`,isError:!1},{metric:`chat.send`,label:c(),unit:`/h`,group:`Chat`,isError:!1},{metric:`assistant.stream.errors`,label:m(),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=ne({from:`/settings/kpi`}),t=E({from:`/settings/kpi`}),n=k(e.from,e.to,D,`now`),r=e=>void t({search:t=>({...t,...re(e)})}),{from:i,to:a}=ee(n),{rowLimit:o,buckets:c}=K(i,a),l=s(b.kpi.listKpis,{limit:o,filter:{from:i,to:a}}),u=(0,F.useMemo)(()=>{let e=new Map;for(let t of l??[]){let n=e.get(t.metric)??[];n.push({bucket:t.bucket,value:t.value}),e.set(t.metric,n)}for(let[t,n]of e)n.sort((e,t)=>e.bucket<t.bucket?-1:+(e.bucket>t.bucket)),n.length>c&&e.set(t,n.slice(n.length-c));return e},[l,c]),d=(0,I.jsxs)(I.Fragment,{children:[(0,I.jsxs)(`p`,{className:`oc-admin__hint`,children:[h(),` `,(0,I.jsx)(`span`,{className:`oc-filter__window`,children:v()})]}),(0,I.jsx)(J,{value:n,onChange:r})]});return l===void 0?(0,I.jsxs)(I.Fragment,{children:[d,(0,I.jsx)(z,{}),(0,I.jsx)(`p`,{className:`oc-admin__hint`,children:y()})]}):l.length===0?(0,I.jsxs)(I.Fragment,{children:[d,(0,I.jsx)(z,{}),(0,I.jsx)(`p`,{className:`oc-admin__hint`,children:p()})]}):(0,I.jsxs)(I.Fragment,{children:[d,(0,I.jsx)(z,{}),U.map(e=>{let t=V.filter(t=>t.group===e);return t.some(e=>(u.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:u.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)(te,{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:x()}),(0,I.jsx)(`span`,{className:`oc-kpi__muted`,children:_({count:t.length})})]})]})]})}var X=240,Z=48,ie=1;function ae({series:e,isError:t,unit:n}){if(e.length===0)return(0,I.jsx)(`div`,{className:`oc-kpi__chart oc-kpi__chart--empty`,"aria-hidden":!0});let r=e.reduce((e,t)=>t.value>e?t.value:e,0),i=X/e.length,a=Math.max(i-ie,1);return(0,I.jsx)(`svg`,{className:`oc-kpi__chart`,viewBox:`0 0 ${X} ${Z}`,preserveAspectRatio:`none`,role:`img`,"aria-label":u({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{$S as r,AS as i,BS as a,CT as o,DT as s,ET as c,FS as l,GS as u,HS as d,IS as f,JS as p,KS as ee,LS as m,LT as te,MS as h,MT as g,NS as ne,OT as re,PS as ie,QS as ae,RS as oe,ST as se,TT as ce,US as le,VS as ue,WS as _,XS as de,YS as fe,ZS as pe,_E as v,_T as y,_h as b,aC as x,bT as S,cC as C,eC as w,gE as T,iC as E,jS as D,kT as O,lC as k,nC as A,oC as j,qS as M,rC as N,sC as P,tC as F,uE as I,vT as L,wT as R,xT as z,yT as B,zS as V}from"./dist-CKhDstdM.js";import{t as H}from"./button-HRR8tdJ2.js";import{A as me,C as he,E as ge,O as _e,S as ve,T as ye,Z as U,ot as W,w as G,x as K}from"./index-DR0RpyTI.js";var q=t(e(),1),J=[{id:`messages`,label:()=>k()},{id:`composer`,label:()=>C()},{id:`sidebar`,label:()=>P()},{id:`other`,label:()=>j()}],Y={showSource:{category:`messages`,label:()=>x(),help:()=>E()},showReport:{category:`messages`,label:()=>N(),help:()=>A()},copyAssistant:{category:`messages`,label:()=>F()},copyUser:{category:`messages`,label:()=>w()},showDelete:{category:`messages`,label:()=>r()},showTools:{category:`messages`,label:()=>ae(),help:()=>pe()},voiceInput:{category:`composer`,label:()=>de(),help:()=>fe()},showChatAge:{category:`sidebar`,label:()=>p(),help:()=>M()},showChatProvider:{category:`sidebar`,label:()=>ee(),help:()=>u()}};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:()=>ie()};function De({prefKey:e,ui:t}){let n=T(I.admin.setUiPrefDefault),r=T(I.admin.setFeatureEnabled),a=Te(e),o=a?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:oe()}),(0,$.jsxs)(ve,{value:we(t.defaults[e]),onValueChange:t=>void n({key:e,value:Q(t)}),children:[(0,$.jsx)(ye,{size:`sm`,className:`w-36`,children:(0,$.jsx)(ge,{})}),(0,$.jsxs)(he,{children:[(0,$.jsx)(G,{value:`on`,children:h()}),(0,$.jsx)(G,{value:`off`,children:D()}),(0,$.jsx)(G,{value:`inherit`,children:i()})]})]}),a?(0,$.jsxs)(`span`,{className:`oc-prefs__gov-gate`,children:[(0,$.jsx)(K,{checked:t.featuresEnabled[a]===!0,onCheckedChange:e=>void r({key:a,enabled:e===!0}),"aria-label":m()}),m()]}):null]}),o?(0,$.jsx)(`span`,{className:`oc-prefs__gov-help`,children:o}):null]})}function Oe(){let[e,t]=(0,q.useState)(``),[n,r]=(0,q.useState)(!1),i=v(I.me.getMe,{host:W}),o=i?.ui,s=Z(i?.role)&&n,c=T(I.me.setUiPref).withOptimisticUpdate(_e),u=(0,q.useMemo)(()=>o?be(Object.keys(o.effective),e):[],[o,e]);return o?(0,$.jsxs)(`div`,{className:`oc-prefs-panel`,children:[Z(i?.role)?(0,$.jsxs)(`label`,{className:`oc-prefs__gov-toggle`,children:[(0,$.jsx)(K,{checked:n,onCheckedChange:e=>r(e===!0),"aria-label":V()}),V()]}):null,s?(0,$.jsxs)(`div`,{className:`oc-prefs__gov-head`,children:[(0,$.jsx)(`p`,{children:f()}),(0,$.jsx)(`p`,{children:l()}),(0,$.jsx)(`p`,{children:ne()})]}):null,(0,$.jsx)(U,{value:e,onChange:e=>t(e.target.value),placeholder:_(),"aria-label":_(),className:`mb-2`}),u.length===0?(0,$.jsx)(`div`,{className:`oc-prefs__empty`,children:le()}):(0,$.jsx)(`div`,{className:`oc-prefs`,children:u.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=o.locked[e],l=o.effective[e],u=o.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:d()}):u?null:(0,$.jsx)(`span`,{className:`oc-prefs__def`,children:ue()})]}),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:a()}):null,(0,$.jsx)(K,{checked:l,disabled:i,onCheckedChange:t=>void c({key:e,value:t===!0}),"aria-label":n})]}),s?(0,$.jsx)(De,{prefKey:e,ui:o}):null]},e)})]},e.id))})]}):(0,$.jsx)(`div`,{className:`oc-prefs__empty`,children:te()})}function ke(){let e=v(I.me.getMe,{host:W}),t=T(I.me.setLocale),n=T(I.me.setMyName),r=me(),i=e?.locale??`default`,a=e?.name??``,[l,u]=(0,q.useState)(null),d=l??a,f=d.trim()!==a.trim();async function p(){try{await n({name:d}),u(null),r.success(ce())}catch(e){r.error(R(),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:O()}),(0,$.jsx)(`p`,{className:`oc-show__desc`,children:re()})]}),(0,$.jsxs)(`div`,{className:`oc-show__row`,children:[(0,$.jsx)(U,{className:`max-w-xs`,value:d,maxLength:120,placeholder:s(),onChange:e=>u(e.target.value),onKeyDown:e=>{e.key===`Enter`&&f&&(e.preventDefault(),p())}}),(0,$.jsx)(H,{size:`sm`,disabled:!f,onClick:()=>void p(),children:b()})]}),(0,$.jsx)(`p`,{className:`oc-show__desc`,children:c()})]}),(0,$.jsxs)(`section`,{className:`oc-show__section`,children:[(0,$.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,$.jsx)(`h2`,{className:`oc-show__title`,children:o()}),(0,$.jsx)(`p`,{className:`oc-show__desc`,children:se()})]}),(0,$.jsx)(`div`,{className:`oc-show__row`,children:[`fr`,`en`,`default`].map(e=>(0,$.jsx)(H,{variant:i===e?`default`:`outline`,size:`sm`,onClick:()=>void t({locale:e==="default"?null:e}),children:e===`fr`?L():e===`en`?y():g()},e))}),(0,$.jsx)(`p`,{className:`oc-show__desc`,children:z()})]}),(0,$.jsxs)(`section`,{className:`oc-show__section`,children:[(0,$.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,$.jsx)(`h2`,{className:`oc-show__title`,children:S()}),(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{Al as r,Bl as i,Dl as a,El as o,Fl as s,Hl as c,Il as l,Ll as u,Ml as d,Nl as f,Ol as p,Pl as m,Ql as h,Rl as g,Tl as _,Ul as v,Vl as y,Wl as b,Zl as x,_E as S,gE as C,jl as w,kl as T,uE as E,zl as D}from"./dist-CKhDstdM.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-D8l7ss4W.js";import{t as I}from"./button-HRR8tdJ2.js";import{A as L,C as R,E as z,S as B,T as V,w as H,x as U}from"./index-DR0RpyTI.js";/* empty css */var W=t(e(),1),G=n(),K={media_delivery:{label:D,help:g},documentary_fetch:{label:u,help:l},inbound_files:{label:s,help:m}},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:a,references:o,files:_};function Y(){let e=S(E.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:d()})});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:b(),help:v()}),(0,G.jsxs)(`label`,{className:`oc-injtab__picker`,children:[(0,G.jsx)(`span`,{children:f()}),(0,G.jsxs)(B,{value:r._id,onValueChange:e=>n(e),children:[(0,G.jsx)(V,{size:`sm`,className:`min-w-44`,children:(0,G.jsx)(z,{})}),(0,G.jsx)(R,{children:e.map(e=>(0,G.jsx)(H,{value:e._id,children:e.displayName??e.name},e._id))})]})]})]}),(0,G.jsx)(X,{instance:r},r._id)]})}function X({instance:e}){let t=C(E.admin.upsertInstanceConfig),n=L(),r=e.config??{},[i,a]=(0,W.useState)(()=>A(r)),[o,s]=(0,W.useState)(!1),c=i.promptInjections,l=(e,t)=>a({...i,promptInjections:{...c,[e]:{...c[e],...t}}});async function u(){s(!0);try{await t({instanceId:e._id,config:N(i,r)})}catch(e){n.error(x(),e)}finally{s(!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:c[e]??{enabled:!0,template:j[e].defaultTemplate},onChange:t=>l(e,t)},e)),(0,G.jsx)(`div`,{className:`oc-injtab__actions`,children:(0,G.jsx)(I,{size:`sm`,onClick:()=>void u(),disabled:o,children:h()})})]})}function Z({injKey:e,def:t,i18n:n,row:a,onChange:o}){let[s,l]=(0,W.useState)(!1),u=a.template.trim()!==t.defaultTemplate,d=t.togglable&&!a.enabled,f=Object.fromEntries(t.placeholders.map(e=>[e,q[e]??`{${e}}`])),m=O(e,a),h=m?k(m,f):``;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)(U,{checked:a.enabled,onCheckedChange:e=>o({enabled:e===!0})}),(0,G.jsx)(M,{label:n.label(),help:n.help()})]}):(0,G.jsx)(M,{label:n.label(),help:n.help()}),u&&(0,G.jsx)(`span`,{className:`oc-injection__badge`,children:y()})]}),(0,G.jsx)(`textarea`,{className:`oc-injcard__text`,value:a.template,disabled:d,rows:8,spellCheck:!1,onChange:e=>o({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:i()}),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:()=>l(e=>!e),children:s?r():w()}),u&&(0,G.jsx)(I,{variant:`ghost`,size:`sm`,onClick:()=>o({template:t.defaultTemplate}),children:c()})]})]}),s&&(0,G.jsx)(`div`,{className:`oc-injcard__preview`,children:h?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`pre`,{className:`oc-injcard__previewtext`,children:h}),(0,G.jsx)(`span`,{className:`oc-injection__ph`,children:T()})]}):(0,G.jsx)(`span`,{className:`oc-injection__ph`,children:p()})})]})}export{Y as PromptInjectionsTab};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$f as r,Ap as i,Cp as a,Dp as o,Ep as s,Fp as c,Jf as ee,Kf as l,Mp as u,Np as d,Op as f,Pp as p,Qf as m,Sp as h,Tp as g,Xf as te,Yf as ne,Zf as re,_E as _,_p as v,bp as y,cp as b,dp as x,ep as S,fp as ie,gE as C,gp as ae,hp as w,jp as T,kp as E,lp as D,mp as O,op as k,pp as A,qf as j,sp as M,uE as N,up as P,vp as F,wp as I,xp as L,yp as R}from"./dist-CKhDstdM.js";import{t as z}from"./button-HRR8tdJ2.js";import{A as B,X as V,Z as H,j as U,m as W,x as G,xt as K}from"./index-DR0RpyTI.js";import{t as q}from"./roleDescriptions-B8pJ6mkq.js";var J=t(e(),1),Y=n(),X=[{group:()=>c(),keys:[{key:`traces.read`,label:()=>i()},{key:`traces.read.content`,label:()=>E(),phi:!0},{key:`traces.write`,label:()=>f()}]},{group:()=>p(),keys:[{key:`kpi.read`,label:()=>i()},{key:`kpi.write`,label:()=>f()}]},{group:()=>d(),keys:[{key:`openclaw.query`,label:()=>o()},{key:`anomalies.read`,label:()=>s()},{key:`anomalies.report`,label:()=>g()}]},{group:()=>u(),keys:[{key:`chats.read`,label:()=>i()},{key:`selfheal`,label:()=>a()}]},{group:()=>T(),keys:[{key:`admin.manage`,label:()=>I()}]}],oe=X.flatMap(e=>e.keys.map(e=>e.key));function Z(e){return e.includes(`*`)}var Q={key:``,name:``,description:``};function $(){let e=_(N.apiKeys.listRoles,{}),t=C(N.apiKeys.createRole),n=C(N.apiKeys.ensureRolesSeeded),i=C(N.apiKeys.updateRolePermissions).withOptimisticUpdate((e,{roleId:t,permissions:n})=>{let r=e.getQuery(N.apiKeys.listRoles,{});r&&e.setQuery(N.apiKeys.listRoles,{},r.map(e=>e._id===t?{...e,permissions:n}:e))}),a=U(),o=B(),[s,c]=(0,J.useState)(!1),[u,d]=(0,J.useState)(Q),[f,p]=(0,J.useState)(new Set);(0,J.useEffect)(()=>{n({}).catch(e=>{o.error(L(),e)})},[n,o]);let g=e??[];async function T(e,t){if(Z(e.permissions)||f.has(e._id))return;let n=e.permissions.includes(t)?e.permissions.filter(e=>e!==t):[...e.permissions,t];if(!(e.builtin&&!await a({title:y({name:e.name}),description:R(),confirmLabel:F()}))){p(t=>new Set(t).add(e._id));try{await i({roleId:e._id,permissions:n})}catch(e){o.error(v(),e)}finally{p(t=>{let n=new Set(t);return n.delete(e._id),n})}}}async function E(){try{await t({key:u.key,name:u.name,description:u.description||void 0,permissions:[]}),d(Q),c(!1)}catch(e){o.error(ae(),e)}}let I=e===void 0,$=!I&&g.length===0;return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(`p`,{className:`oc-admin__hint`,children:[w(),` `,(0,Y.jsx)(`code`,{children:`admin`}),` `,O(),` `,(0,Y.jsx)(`code`,{children:`traces.read.content`}),` `,A()]}),(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:ie()}),(0,Y.jsx)(`div`,{className:`oc-dt__bar-actions`,children:(0,Y.jsx)(z,{size:`sm`,onClick:()=>{d(Q),c(!0)},children:x()})})]}),I?(0,Y.jsx)(`p`,{className:`oc-admin__hint`,children:P()}):$?(0,Y.jsx)(`p`,{className:`oc-admin__hint`,children:D()}):(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:b()}),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?h({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:g.map(e=>{let t=Z(e.permissions),n=f.has(e._id);return(0,Y.jsxs)(`tr`,{children:[(0,Y.jsxs)(`th`,{className:`oc-matrix__rolecell`,children:[(0,Y.jsxs)(`div`,{className:`oc-matrix__rolename`,children:[(0,Y.jsx)(`span`,{children:e.name}),(0,Y.jsx)(`code`,{className:`oc-matrix__rolekey`,children:e.key}),e.builtin?(0,Y.jsxs)(V,{variant:`outline`,className:`gap-1`,children:[(0,Y.jsx)(K,{}),` `,M()]}):(0,Y.jsx)(V,{variant:`secondary`,children:k()})]}),q(e)?(0,Y.jsx)(`p`,{className:`oc-matrix__roledesc`,children:q(e)}):null]}),oe.map(i=>(0,Y.jsx)(`td`,{className:`oc-matrix__cell`,children:(0,Y.jsx)(G,{checked:t||e.permissions.includes(i),disabled:t||n,"aria-label":`${e.key} · ${i}`,title:t?S():n?r():i,onCheckedChange:()=>void T(e,i)})},i))]},e.key)})})]})})]}),(0,Y.jsx)(W,{open:s,onOpenChange:c,title:m(),description:re(),canSubmit:!!(u.key&&u.name),onSubmit:E,submitLabel:te(),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:ne()}),(0,Y.jsx)(H,{value:u.key,placeholder:ee(),onChange:e=>d({...u,key:e.target.value})})]}),(0,Y.jsxs)(`label`,{className:`oc-field`,children:[(0,Y.jsx)(`span`,{className:`oc-field__label`,children:j()}),(0,Y.jsx)(H,{value:u.name,onChange:e=>d({...u,name:e.target.value})})]}),(0,Y.jsxs)(`label`,{className:`oc-field`,children:[(0,Y.jsx)(`span`,{className:`oc-field__label`,children:l()}),(0,Y.jsx)(H,{value:u.description,onChange:e=>d({...u,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{$x as r,Ax as i,Bx as ee,CS as a,Cx as o,DS as te,Dx as s,ES as ne,Ex as c,Fx as re,Gx as ie,Hx as ae,Ix as oe,Jx as se,Kx as ce,Lx as le,Mx as l,Nx as ue,OS as de,Ox as u,Px as fe,Qx as pe,Rx as me,SS as he,Sx as d,TS as ge,Tx as f,Ux as _e,Vx as ve,Wx as ye,Xx as be,Yx as xe,Zx as Se,_E as p,_S as Ce,_x as we,aS as Te,bS as Ee,bx as m,cS as De,dS as Oe,dx as ke,eS as Ae,fS as je,fx as h,gE as g,gS as Me,gx as _,hS as Ne,hx as v,iS as Pe,jx as y,kS as Fe,kx as b,lS as Ie,lx as x,mE as Le,mS as Re,mx as S,nS as ze,oS as Be,pS as Ve,px as C,qx as He,rS as Ue,sS as We,tS as Ge,uE as w,uS as Ke,ux as T,vS as qe,vx as E,wS as D,wx as O,xS as Je,xx as k,yS as Ye,yx as A,zx as Xe}from"./dist-CKhDstdM.js";import{n as j}from"./dist-DErYNbMW.js";import{i as Ze}from"./dist-CkXWG_t8.js";import{t as M}from"./button-HRR8tdJ2.js";import{$ as N,A as Qe,At as $e,C as P,E as F,Et as I,Ot as et,Q as L,S as R,T as z,X as B,Z as V,et as H,j as tt,kt as nt,m as rt,nt as U,rt as W,tt as G,w as K}from"./index-DR0RpyTI.js";import{t as it}from"./FilterBar-DZBiB1MF.js";import{t as at}from"./DataTableShell-67hI2aZh.js";import{t as ot}from"./roleDescriptions-B8pJ6mkq.js";var q=t(e(),1),J=n(),st=[{value:`never`,label:()=>v(),days:null},{value:`30`,label:()=>S(),days:30},{value:`90`,label:()=>C(),days:90}],ct=720*60*60*1e3,Y=`__all__`,X={name:``,roleKey:``,description:``};function Z(){let e=$e({from:`/settings/serviceAccounts`}),t=nt({from:`/settings/serviceAccounts`}),n=e.q??``,i=e.status??Y,[o,s]=(0,q.useState)(Y),c=e=>void t({search:t=>({...t,q:e||void 0}),replace:!0}),l=e=>void t({search:t=>({...t,status:e===Y?void 0:e})}),u=p(w.apiKeys.listServiceAccounts,{filter:{q:n||void 0,role:o===Y?void 0:o,disabled:i===Y?void 0:i===`disabled`}}),d=p(w.apiKeys.listKeys,{}),f=p(w.apiKeys.listRoles,{}),we=g(w.apiKeys.createServiceAccount),m=g(w.apiKeys.updateServiceAccount),ke=g(w.apiKeys.deleteServiceAccount),h=Le(w.apiKeys.mintApiKey),_=g(w.apiKeys.revokeApiKey),v=tt(),y=Qe(),b=n!==``||o!==Y||i!==Y;function x(){s(Y),t({search:{},replace:!0})}let[S,C]=(0,q.useState)(!1),[T,E]=(0,q.useState)(X),[O,k]=(0,q.useState)(null),[A,j]=(0,q.useState)(new Set),[N,I]=(0,q.useState)(null),L=(0,q.useRef)(!1),[H,U]=(0,q.useState)(new Set),[W,G]=(0,q.useState)({}),[ct,Z]=(0,q.useState)(null),Q=(0,q.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 $(e){j(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})}async function dt(){try{O?(await m({serviceAccountId:O,name:T.name,roleKey:T.roleKey,description:T.description}),y.success(He())):await we({name:T.name,roleKey:T.roleKey,description:T.description||void 0}),E(X),k(null),C(!1)}catch(e){y.error(O?se():xe(),e)}}function ft(e){E({name:e.name,roleKey:e.roleKey,description:e.description??``}),k(e._id),C(!0)}async function pt(e){if(L.current)return;L.current=!0;let t=W[e._id]??`never`,n=st.find(e=>e.value===t)?.days??null,r=n?Date.now()+n*24*60*60*1e3:void 0;I(e._id);try{let t=await h({serviceAccountId:e._id,expiresAt:r});Z({accountName:e.name,plaintext:t.plaintext,prefix:t.prefix,lastFour:t.lastFour})}catch(e){y.error(ce(),e)}finally{L.current=!1,I(null)}}async function mt(e){if(await v({title:ie(),description:(0,J.jsxs)(J.Fragment,{children:[ye(),` `,(0,J.jsx)(`span`,{className:`font-mono`,children:e.name}),` `,_e(),` `,(0,J.jsx)(`strong`,{children:ae()}),` `,ve()]}),confirmWord:e.name,confirmLabel:ee(),destructive:!0}))try{await ke({serviceAccountId:e._id}),y.success(Xe(),e.name)}catch(e){y.error(me(),e)}}async function ht(e){if(await v({title:le(),description:(0,J.jsxs)(J.Fragment,{children:[oe(),` `,(0,J.jsxs)(`span`,{className:`font-mono`,children:[e.prefix,`…`,e.lastFour]}),` `,re()]}),confirmLabel:fe(),destructive:!0})&&!H.has(e._id)){U(t=>new Set(t).add(e._id));try{await _({keyId:e._id})}catch(e){y.error(ue(),e)}finally{U(t=>{let n=new Set(t);return n.delete(e._id),n})}}}return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(`p`,{className:`oc-admin__hint`,children:Fe()}),(0,J.jsxs)(it,{q:n,onQChange:c,searchPlaceholder:de(),onReset:x,canReset:b,children:[(0,J.jsxs)(R,{value:o,onValueChange:s,children:[(0,J.jsx)(z,{size:`sm`,className:`w-40`,children:(0,J.jsx)(F,{placeholder:te()})}),(0,J.jsxs)(P,{children:[(0,J.jsx)(K,{value:Y,children:ne()}),(f??[]).map(e=>(0,J.jsx)(K,{value:e.key,children:e.key},e._id))]})]}),(0,J.jsxs)(R,{value:i,onValueChange:l,children:[(0,J.jsx)(z,{size:`sm`,className:`w-36`,children:(0,J.jsx)(F,{})}),(0,J.jsxs)(P,{children:[(0,J.jsx)(K,{value:Y,children:ge()}),(0,J.jsx)(K,{value:`active`,children:D()}),(0,J.jsx)(K,{value:`disabled`,children:a()})]})]})]}),(0,J.jsx)(at,{title:he(),rows:u,addLabel:Je(),onAdd:()=>{E(X),k(null),C(!0)},emptyHint:Ee(),isExpanded:e=>A.has(e._id),renderExpanded:e=>(0,J.jsx)(lt,{account:e,keys:Q.get(e._id)??[],onRevoke:ht,revoking:H}),rowActions:e=>[{label:Me(),onSelect:()=>ft(e)},{label:Ye(),onSelect:()=>void pt(e)},{label:A.has(e._id)?qe():Ce(),onSelect:()=>$(e._id)},{label:Ne(),variant:`destructive`,onSelect:()=>void mt(e)}],columns:[{header:``,className:`w-8`,cell:e=>(0,J.jsx)(M,{variant:`ghost`,size:`icon-sm`,"aria-label":A.has(e._id)?Re():Ve(),onClick:()=>$(e._id),children:A.has(e._id)?(0,J.jsx)(Ze,{}):(0,J.jsx)(et,{})})},{header:je(),sort:e=>e.name,cell:e=>(0,J.jsxs)(`div`,{className:`flex flex-col`,children:[(0,J.jsx)(`span`,{children:e.name}),e.description?(0,J.jsx)(`span`,{className:`text-muted-foreground text-xs`,children:e.description}):null]})},{header:Oe(),sort:e=>e.roleKey,cell:e=>(0,J.jsx)(B,{variant:`secondary`,children:e.roleKey})},{header:Ke(),sort:e=>+!!e.disabled,cell:e=>e.disabled?(0,J.jsx)(B,{variant:`destructive`,children:a()}):(0,J.jsx)(B,{variant:`outline`,children:D()})},{header:Ie(),cell:e=>(0,J.jsxs)(R,{value:W[e._id]??`never`,onValueChange:t=>G(n=>({...n,[e._id]:t})),children:[(0,J.jsx)(z,{size:`sm`,className:`w-32`,children:(0,J.jsx)(F,{})}),(0,J.jsx)(P,{children:st.map(e=>(0,J.jsx)(K,{value:e.value,children:e.label()},e.value))})]})},{header:De(),sort:e=>(Q.get(e._id)??[]).filter(e=>!e.disabled).length,cell:e=>{let t=(Q.get(e._id)??[]).filter(e=>!e.disabled).length;return(0,J.jsx)(`span`,{className:`oc-sa__keycount`,children:N===e._id?We():Be({count:t})})}}]}),(0,J.jsx)(rt,{open:S,onOpenChange:e=>{C(e),e||k(null)},title:O?Te():ze(),description:O?Pe():Ge(),canSubmit:!!(T.name&&T.roleKey),onSubmit:dt,submitLabel:O?Ue():Ae(),children:(0,J.jsxs)(`div`,{className:`oc-form`,children:[(0,J.jsxs)(`label`,{className:`oc-field`,children:[(0,J.jsx)(`span`,{className:`oc-field__label`,children:r()}),(0,J.jsx)(V,{value:T.name,onChange:e=>E({...T,name:e.target.value})})]}),(0,J.jsxs)(`label`,{className:`oc-field`,children:[(0,J.jsx)(`span`,{className:`oc-field__label`,children:pe()}),(0,J.jsxs)(R,{value:T.roleKey||void 0,onValueChange:e=>E({...T,roleKey:e}),children:[(0,J.jsx)(z,{className:`w-full`,children:(0,J.jsx)(F,{placeholder:Se()})}),(0,J.jsx)(P,{children:(f??[]).map(e=>(0,J.jsxs)(K,{value:e.key,children:[e.name,` (`,e.key,`)`]},e._id))})]}),(()=>{let e=(f??[]).find(e=>e.key===T.roleKey),t=e?ot(e):null;return t?(0,J.jsx)(`span`,{className:`text-muted-foreground text-xs`,children:t}):null})()]}),(0,J.jsxs)(`label`,{className:`oc-field`,children:[(0,J.jsx)(`span`,{className:`oc-field__label`,children:be()}),(0,J.jsx)(V,{value:T.description,onChange:e=>E({...T,description:e.target.value})})]})]})}),(0,J.jsx)(ut,{minted:ct,onClose:()=>Z(null)})]})}function lt({account:e,keys:t,onRevoke:n,revoking:r}){return(0,J.jsxs)(`div`,{className:`oc-sa__keys`,children:[(0,J.jsxs)(`div`,{className:`oc-sa__keys-head`,children:[l(),` `,(0,J.jsx)(`span`,{className:`font-medium`,children:e.name})]}),t.length===0?(0,J.jsx)(`p`,{className:`oc-admin__hint`,children:y()}):(0,J.jsxs)(`table`,{className:`oc-sa__keytable`,children:[(0,J.jsx)(`thead`,{children:(0,J.jsxs)(`tr`,{children:[(0,J.jsx)(`th`,{children:i()}),(0,J.jsx)(`th`,{children:b()}),(0,J.jsx)(`th`,{children:u()}),(0,J.jsx)(`th`,{children:s()}),(0,J.jsx)(`th`,{children:c()}),(0,J.jsx)(`th`,{children:f()}),(0,J.jsx)(`th`,{})]})}),(0,J.jsx)(`tbody`,{children:t.map(t=>(0,J.jsxs)(`tr`,{children:[(0,J.jsx)(`td`,{children:(0,J.jsxs)(`code`,{className:`oc-sa__keyid`,children:[t.prefix,`…`,t.lastFour]})}),(0,J.jsx)(`td`,{children:(0,J.jsx)(B,{variant:`secondary`,children:e.roleKey})}),(0,J.jsx)(`td`,{children:Q(t.createdAt)}),(0,J.jsx)(`td`,{className:$(t.lastUsedAt)?`oc-sa__stale`:``,children:dt(t.lastUsedAt)}),(0,J.jsx)(`td`,{children:ft(t.expiresAt)}),(0,J.jsx)(`td`,{children:pt(t)}),(0,J.jsx)(`td`,{className:`text-right`,children:t.disabled?null:(0,J.jsx)(M,{variant:`destructive`,size:`sm`,disabled:r.has(t._id),onClick:()=>n(t),children:r.has(t._id)?O():o()})})]},t._id))})]})]})}function ut({minted:e,onClose:t}){let[n,r]=(0,q.useState)(!1);async function i(){if(e)try{await navigator.clipboard.writeText(e.plaintext),r(!0),window.setTimeout(()=>r(!1),2e3)}catch{}}return(0,J.jsx)(L,{open:e!==null,onOpenChange:e=>{e||(r(!1),t())},children:e?(0,J.jsxs)(N,{className:`max-w-lg`,showCloseButton:!1,onInteractOutside:e=>e.preventDefault(),onEscapeKeyDown:e=>e.preventDefault(),children:[(0,J.jsxs)(U,{children:[(0,J.jsx)(W,{children:d()}),(0,J.jsx)(H,{children:k({name:e.accountName})})]}),(0,J.jsx)(`div`,{className:`oc-sa__minted-warning`,children:m()}),(0,J.jsxs)(`div`,{className:`oc-sa__minted-box`,children:[(0,J.jsx)(`code`,{className:`oc-sa__minted-plain`,children:e.plaintext}),(0,J.jsxs)(M,{variant:`outline`,size:`sm`,onClick:()=>void i(),"aria-label":A(),children:[n?(0,J.jsx)(j,{}):(0,J.jsx)(I,{}),n?E():we()]})]}),(0,J.jsx)(G,{children:(0,J.jsx)(M,{onClick:()=>{r(!1),t()},children:_()})})]}):null})}function Q(e){return new Date(e).toLocaleString(`fr-FR`)}function $(e){return e===null?!1:Date.now()-e>ct}function dt(e){return e===null?h():new Date(e).toLocaleString(`fr-FR`)}function ft(e){return e===null?`—`:new Date(e).toLocaleDateString(`fr-FR`)}function pt(e){return e.disabled?(0,J.jsx)(B,{variant:`destructive`,children:ke()}):e.expiresAt!==null&&e.expiresAt<Date.now()?(0,J.jsx)(B,{variant:`outline`,children:T()}):(0,J.jsx)(B,{variant:`outline`,children:x()})}export{Z as ServiceAccountsTab};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{A as r,B as i,C as a,D as o,E as s,F as c,G as l,H as u,I as d,L as f,M as p,N as m,O as h,P as g,R as _,S as v,T as y,U as b,V as x,W as S,_ as C,_E as w,b as T,c as E,d as D,f as O,g as k,gE as A,h as j,j as M,k as N,l as P,m as F,p as I,s as ee,u as L,uE as R,v as z,w as B,x as V,y as H,z as U}from"./dist-CKhDstdM.js";import{t as W}from"./button-HRR8tdJ2.js";import{j as G}from"./index-DR0RpyTI.js";import{t as K}from"./DataTableShell-67hI2aZh.js";var q=t(e(),1),J=n(),Y={hung:()=>h(),wrong_result:()=>o(),error:()=>s(),other:()=>y()},X=e=>(e&&Y[e]?.())??e??`—`;function Z(e){let t=e.slice(e.lastIndexOf(`:`)+1)||e;return t.length>12?`${t.slice(0,12)}…`:t}function Q({data:e}){let t=e.snapshot,n=A(R.subAgentReports.respondToReport),[r,i]=(0,q.useState)(e.thread),[o,s]=(0,q.useState)(``),[c,l]=(0,q.useState)(!1);async function u(){let t=o.trim();if(!(!t||c)){l(!0);try{await n({reportId:e._id,text:t}),i(e=>[...e,{authorRole:`admin`,text:t,at:Date.now()}]),s(``)}finally{l(!1)}}}return(0,J.jsxs)(`div`,{className:`oc-fbadmin__detail`,children:[(0,J.jsx)(`div`,{className:`oc-fbadmin__row`,children:(0,J.jsxs)(`span`,{className:`oc-fbadmin__meta`,children:[X(e.category),` · `,B({failed:t.failedCount,total:t.totalCount}),t.openclawModel?` · ${t.openclawModel}`:``,t.openclawRuntime?` (${t.openclawRuntime})`:``]})}),e.comment?(0,J.jsxs)(`section`,{children:[(0,J.jsx)(`h4`,{className:`oc-fbadmin__h`,children:a()}),(0,J.jsx)(`p`,{className:`oc-fbadmin__comment`,children:e.comment})]}):null,(0,J.jsxs)(`section`,{children:[(0,J.jsx)(`h4`,{className:`oc-fbadmin__h`,children:v()}),r.length>0?(0,J.jsx)(`div`,{className:`oc-fbadmin__thread`,children:r.map((e,t)=>(0,J.jsxs)(`div`,{className:`oc-notif__msg oc-notif__msg--${e.authorRole}`,children:[(0,J.jsx)(`span`,{className:`oc-notif__msg-who`,children:e.authorRole===`admin`?V():T()}),(0,J.jsx)(`span`,{className:`oc-notif__msg-text`,children:e.text})]},t))}):(0,J.jsx)(`p`,{className:`oc-fbadmin__meta`,children:H()}),(0,J.jsx)(`textarea`,{className:`oc-feedback__textarea`,placeholder:z(),value:o,maxLength:2e3,rows:3,onChange:e=>s(e.target.value.slice(0,2e3))}),(0,J.jsx)(`div`,{className:`oc-fbadmin__row`,style:{justifyContent:`flex-end`},children:(0,J.jsx)(W,{size:`sm`,onClick:()=>void u(),disabled:!o.trim()||c,children:c?k():C()})})]}),(0,J.jsxs)(`section`,{children:[(0,J.jsxs)(`h4`,{className:`oc-fbadmin__h`,children:[j({count:t.children.length}),t.childrenTruncated?` ${F()}`:``,t.textTruncated?` ${I()}`:``]}),(0,J.jsx)(`div`,{className:`oc-fbadmin__ctx`,children:t.children.map((e,n)=>(0,J.jsxs)(`div`,{className:`oc-fbadmin__ctx-turn`,children:[(0,J.jsxs)(`span`,{className:`oc-fbadmin__ctx-role`,children:[(e.taskName?.trim()||Z(e.childSessionKey))+` · ${e.status}`,e.phase?` · ${e.phase}`:``,e.childSessionKey===t.flaggedChildSessionKey?` · ${O()}`:``]}),e.errorMessage?(0,J.jsx)(`pre`,{className:`oc-msg__source-pre`,children:e.errorMessage}):null,e.resultText?(0,J.jsx)(`pre`,{className:`oc-msg__source-pre`,children:e.resultText}):null]},n))})]}),t.parentText?(0,J.jsxs)(`section`,{children:[(0,J.jsx)(`h4`,{className:`oc-fbadmin__h`,children:D()}),(0,J.jsx)(`pre`,{className:`oc-msg__source-pre`,children:t.parentText})]}):null,(0,J.jsxs)(`section`,{children:[(0,J.jsx)(`h4`,{className:`oc-fbadmin__h`,children:L()}),(0,J.jsx)(`p`,{className:`oc-fbadmin__env`,children:[t.parentStatus?`status: ${t.parentStatus}`:null,t.parentErrorCode?`code: ${t.parentErrorCode}`:null,t.parentRunId?`run ${t.parentRunId.slice(0,12)}…`:null,e.correlationId?`corr ${e.correlationId.slice(0,16)}…`:null,t.openclawProvider].filter(Boolean).join(` · `)||`—`})]})]})}function $(){let e=w(R.subAgentReports.listForAdmin,{}),t=A(R.subAgentReports.readReport),n=A(R.subAgentReports.deleteReport),a=G(),[o,s]=(0,q.useState)(null),[h,v]=(0,q.useState)({});async function y(e){if(o===e._id){s(null);return}if(!h[e._id]){let n=await t({reportId:e._id});v(t=>({...t,[e._id]:n}))}s(e._id)}async function C(e){await a({title:P(),description:E(),confirmLabel:ee(),destructive:!0})&&(await n({reportId:e._id}),o===e._id&&s(null))}return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(`p`,{className:`oc-admin__hint`,children:[b(),` `,(0,J.jsx)(`strong`,{children:u()}),` `,x()]}),(0,J.jsx)(K,{title:l(),rows:e,emptyHint:S(),isExpanded:e=>o===e._id&&!!h[e._id],renderExpanded:e=>h[e._id]?(0,J.jsx)(Q,{data:h[e._id]}):null,columns:[{header:i(),cell:e=>new Date(e.at).toLocaleString(`fr-FR`),sort:e=>e.at},{header:U(),cell:e=>X(e.category),sort:e=>X(e.category)},{header:_(),cell:e=>`${e.failedCount}/${e.totalCount}`,sort:e=>e.failedCount},{header:f(),cell:e=>(e.reporterEmail||e.reporterName||`—`)+(e.impersonated&&e.realOperatorEmail?` ${g({operator:e.realOperatorEmail})}`:``),sort:e=>e.reporterEmail||e.reporterName||null},{header:d(),cell:e=>e.hasComment?`✎`:`—`,sort:e=>+!!e.hasComment},{header:c(),cell:e=>e.answered?(0,J.jsx)(`span`,{className:`oc-fbadmin__pill is-ok`,children:m()}):(0,J.jsx)(`span`,{className:`oc-fbadmin__pill`,children:p()}),sort:e=>+!!e.answered}],rowActions:e=>[{label:o===e._id?r():M(),onSelect:()=>void y(e)},{label:N(),onSelect:()=>void C(e),variant:`destructive`}]})]})}export{$ as SubAgentReportsTab};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$C as r,AC as i,Aw as a,BC as o,CC as s,Cw as c,DC as l,Dw as u,EC as d,Ew as f,FC as p,FT as m,GC as h,HC as g,IC as _,JC as v,KC as ee,LC as te,MC as ne,Mw as re,NC as ie,NT as ae,OC as oe,Ow as se,PC as ce,PT as le,QC as ue,RC as de,SC as fe,Sw as y,TC as pe,Tw as me,UC as he,VC as ge,WC as _e,XC as ve,YC as b,ZC as ye,_C as be,_E as x,_T as xe,_w as Se,a as S,aw as Ce,bC as we,bw as Te,cw as Ee,dC as De,dE as Oe,dw as ke,ew as Ae,fC as je,fw as Me,gC as Ne,gE as C,gw as Pe,hC as Fe,hw as Ie,i as Le,iw as Re,jC as ze,jw as Be,kC as Ve,kw as He,lw as Ue,mC as w,mE as We,mw as Ge,n as Ke,nw as qe,o as T,ow as Je,pC as Ye,pw as Xe,qC as Ze,r as Qe,rw as $e,sw as et,tw as tt,uC as nt,uE as E,uw as rt,vC as D,vT as it,vw as at,wC as ot,ww as st,xC as ct,xw as lt,yC as ut,yw as dt,zC as ft}from"./dist-CKhDstdM.js";import{n as O}from"./dist-DErYNbMW.js";import{t as pt}from"./TimeRangePicker-BJ_SDnZN.js";import{t as k}from"./x-Dnhgu6fy.js";import{t as A}from"./button-HRR8tdJ2.js";import{C as j,E as M,G as mt,J as N,K as P,S as F,T as I,Tt as ht,W as gt,X as L,Y as _t,Z as R,at as vt,it as yt,ot as bt,q as xt,w as z,wt as B,x as V}from"./index-DR0RpyTI.js";import{a as St,i as Ct,n as wt,o as Tt,r as Et,t as Dt}from"./card-DdObfJrM.js";import{a as Ot,i as H,n as kt,o as U,r as W,t as At}from"./table-fGxqLVNE.js";import{t as jt}from"./FilterBar-DZBiB1MF.js";import{t as Mt}from"./AdvancedFilter-Dsn2CdBY.js";var G=Oe(`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`}]]),K=t(e(),1),Nt=.1,Pt=[248,248,248],Ft=[24,24,24];function It(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 Lt(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 q(e,t,n){return Lt(e,t,n)>=Nt}function Rt(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 zt(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 Bt=12*1024*1024,Vt=480,Ht=160,Ut=.92;async function Wt(e,t={}){if(!e.type.startsWith(`image/`))throw Error(ie());if(e.size>Bt)throw Error(ne());let{source:n,width:r,height:a,cleanup:o}=await Gt(e);try{let o=e.type===`image/svg+xml`,s=Math.min(Vt/r,Ht/a,o?1/0:1),c=Math.max(1,Math.round(r*s)),l=Math.max(1,Math.round(a*s)),u=document.createElement(`canvas`);u.width=c,u.height=l;let d=u.getContext(`2d`);if(!d)throw Error(i());d.imageSmoothingEnabled=!0,d.imageSmoothingQuality=`high`,d.drawImage(n,0,0,c,l);let f=It(d.getImageData(0,0,c,l).data,c,l)??{x:0,y:0,width:c,height:l},p=document.createElement(`canvas`);p.width=f.width,p.height=f.height;let m=p.getContext(`2d`);if(!m)throw Error(i());if(m.drawImage(u,f.x,f.y,f.width,f.height,0,0,f.width,f.height),t.variantFor){let e=m.getImageData(0,0,f.width,f.height);q(e.data,f.width,f.height)?Rt(e.data,t.variantFor===`dark`?Pt:Ft):zt(e.data),m.putImageData(e,0,0)}let h=q(m.getImageData(0,0,f.width,f.height).data,f.width,f.height),g=await Y(p,`image/webp`,Ut)??await Y(p,`image/png`);if(!g)throw Error(Ve());return{blob:g,hasAlpha:h}}finally{o()}}async function Gt(e){if(e.type===`image/svg+xml`)return J(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 J(e)}async function J(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(ze())),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 Y(e,t,n){return new Promise(r=>e.toBlob(e=>r(e),t,n))}var X=n();function Kt(e,t){let n=e.trim().replace(/[^A-Za-z0-9_.-]+/g,`-`).replace(/^-+|-+$/g,``)||`chart`,r=new Blob([JSON.stringify(t,null,2)],{type:`application/json`}),i=URL.createObjectURL(r),a=document.createElement(`a`);a.href=i,a.download=`${n}.chart.json`,document.body.appendChild(a),a.click(),a.remove(),URL.revokeObjectURL(i)}var Z=`__all__`,Q={kind:`relative`,from:`now-24h`,to:`now`},qt=[{value:`status`,label:`Statut`},{value:`latencyMs`,label:`Latence (ms)`},{value:`route`,label:`Route`},{value:`roleKey`,label:`Rôle`},{value:`correlationId`,label:`Corrélation`}];function $({title:e,description:t,children:n}){return(0,X.jsxs)(`section`,{className:`oc-show__section`,children:[(0,X.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,X.jsx)(`h2`,{className:`oc-show__title`,children:e}),t?(0,X.jsx)(`p`,{className:`oc-show__desc`,children:t}):null]}),(0,X.jsx)(`div`,{className:`oc-show__demo`,children:n})]})}function Jt(e){return e===`light`?m():e===`dark`?le():ae()}var Yt=[`primary`,`secondary`,`accent`,`muted`,`chart-1`,`chart-2`];function Xt({tokens:e,mode:t}){let n=e.colors[t];return(0,X.jsx)(`div`,{className:`oc-chart-swatches`,"aria-hidden":!0,children:Yt.map(e=>{let t=n[e];return(0,X.jsx)(`span`,{className:`oc-chart-swatch`,style:t?{background:t}:void 0},e)})})}function Zt({selected:e,title:t,subtitle:n,tokens:r,mode:i,onSelect:a,onExport:o}){return(0,X.jsxs)(`div`,{className:`oc-chart-card-wrap`,children:[(0,X.jsxs)(`button`,{type:`button`,className:Ke(`oc-chart-card`,e&&`oc-chart-card--selected`),"aria-pressed":e,onClick:a,children:[(0,X.jsxs)(`div`,{className:`oc-chart-card__head`,children:[(0,X.jsx)(`span`,{className:`oc-chart-card__title`,children:t}),e?(0,X.jsx)(O,{className:`size-4 text-primary`,"aria-hidden":!0}):null]}),r?(0,X.jsx)(Xt,{tokens:r,mode:i}):(0,X.jsx)(`div`,{className:`oc-chart-swatches oc-chart-swatches--native`,"aria-hidden":!0}),(0,X.jsx)(`div`,{className:`oc-chart-card__meta`,children:(0,X.jsx)(`span`,{className:`oc-chart-card__subtitle`,children:n})})]}),o?(0,X.jsx)(A,{type:`button`,variant:`ghost`,size:`icon`,className:`oc-chart-card__export`,onClick:o,"aria-label":T(),title:T(),children:(0,X.jsx)(ht,{className:`size-4`})}):null]})}function Qt({selectedKey:e,resolvedMode:t}){let n=x(E.charts.listMyCharts),r=C(E.charts.setMyChart);async function i(e){try{await r({name:e})}catch{}}return(0,X.jsxs)(`section`,{className:`oc-show__section`,children:[(0,X.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,X.jsx)(`h2`,{className:`oc-show__title`,children:st()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:c()})]}),(0,X.jsxs)(`div`,{className:`oc-chart-grid`,children:[(0,X.jsx)(Zt,{selected:e===null,title:y(),subtitle:lt(),tokens:null,mode:t,onSelect:()=>void i(null)}),(n??[]).map(n=>{let r=n.via===`common`?Te():n.via===`owner`?dt():at({group:n.via.group});return(0,X.jsx)(Zt,{selected:e===n.key,title:n.name,subtitle:r,tokens:n.tokens,mode:t,onSelect:()=>void i(n.key),onExport:()=>Kt(n.name,n.tokens)},n.key)})]}),n!==void 0&&n.length===0?(0,X.jsx)(`p`,{className:`oc-show__desc`,children:Se()}):null]})}function $t(){let e=C(E.charts.importChart),[t,n]=(0,K.useState)(``),[i,a]=(0,K.useState)(``),[o,s]=(0,K.useState)(null),[c,l]=(0,K.useState)(!1),[u,d]=(0,K.useState)(!1);async function f(e){let t=e.target.files?.[0];if(e.target.value=``,t){s(null),l(!1);try{a(await t.text())}catch{s(b())}}}async function p(){if(s(null),l(!1),t.trim()===``){s(Ze());return}let r;try{r=JSON.parse(i)}catch{s(b());return}d(!0);try{await e({name:t.trim(),tokens:r}),l(!0),n(``),a(``)}catch(e){s(e instanceof Error?e.message:String(e))}finally{d(!1)}}return(0,X.jsxs)(`section`,{className:`oc-show__section`,children:[(0,X.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,X.jsx)(`h2`,{className:`oc-show__title`,children:$e()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:qe()})]}),(0,X.jsxs)(`div`,{className:`oc-chart-import`,children:[(0,X.jsxs)(`label`,{className:`oc-chart-import__field`,children:[(0,X.jsx)(`span`,{className:`oc-chart-import__label`,children:tt()}),(0,X.jsx)(R,{value:t,onChange:e=>n(e.target.value),placeholder:Ae(),maxLength:60})]}),(0,X.jsxs)(`label`,{className:`oc-chart-import__field`,children:[(0,X.jsx)(`span`,{className:`oc-chart-import__label`,children:r()}),(0,X.jsx)(`textarea`,{className:`oc-chart-import__textarea`,value:i,onChange:e=>a(e.target.value),placeholder:ue(),rows:8,spellCheck:!1})]}),(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsx)(A,{variant:`outline`,size:`sm`,asChild:!0,children:(0,X.jsxs)(`label`,{className:`oc-chart-import__file`,children:[(0,X.jsx)(G,{className:`size-4`}),ye(),(0,X.jsx)(`input`,{type:`file`,accept:`application/json,.json`,className:`oc-chart-import__file-input`,onChange:e=>void f(e)})]})}),(0,X.jsx)(A,{size:`sm`,disabled:u,onClick:()=>void p(),children:ve()})]}),o?(0,X.jsx)(`p`,{className:`oc-chart-import__error`,children:o}):null,c?(0,X.jsx)(`p`,{className:`oc-chart-import__ok`,children:v()}):null]})]})}function en({chart:e}){let t=We(E.charts.setChartLogo),n=C(E.charts.removeChartLogo),[r,i]=(0,K.useState)(!1),[a,s]=(0,K.useState)(null),c=t=>t===`light`?e.logoLightUrl:e.logoDarkUrl;async function l(n,r,a){if(e.chartId!==void 0){s(null),i(!0);try{let{blob:i,hasAlpha:o}=await Wt(r,a?{variantFor:a}:{}),s=await i.arrayBuffer();await t({chartId:e.chartId,bytes:s,mode:n,hasAlpha:o})}catch(e){s(e instanceof Error?e.message:String(e))}finally{i(!1)}}}async function u(e,t){let n=t.target.files?.[0];t.target.value=``,n&&await l(e,n)}async function d(t){if(e.chartId!==void 0){s(null),i(!0);try{await n({chartId:e.chartId,mode:t})}catch(e){s(e instanceof Error?e.message:String(e))}finally{i(!1)}}}async function f(e){let t=c(e===`light`?`dark`:`light`);if(t){s(null),i(!0);try{await l(e,await(await fetch(t)).blob(),e)}catch(e){s(e instanceof Error?e.message:String(e))}finally{i(!1)}}}function m({mode:e}){let t=c(e),n=c(e===`light`?`dark`:`light`);return(0,X.jsxs)(`div`,{className:`oc-chart-mine__logo-slot`,children:[(0,X.jsx)(`span`,{className:`oc-chart-mine__logo-mode`,children:e===`light`?o():ft()}),(0,X.jsx)(`span`,{className:`oc-chart-mine__logo-preview`,"data-mode":e,"data-empty":t?void 0:`1`,children:t?(0,X.jsx)(`img`,{src:t,alt:``}):null}),(0,X.jsx)(A,{variant:`outline`,size:`sm`,asChild:!0,children:(0,X.jsxs)(`label`,{className:`oc-chart-import__file`,children:[(0,X.jsx)(G,{className:`size-4`}),t?te():de(),(0,X.jsx)(`input`,{type:`file`,accept:`image/*`,className:`oc-chart-import__file-input`,onChange:t=>void u(e,t)})]})}),!t&&n?(0,X.jsx)(A,{variant:`ghost`,size:`sm`,disabled:r,onClick:()=>void f(e),children:p()}):null,t?(0,X.jsx)(A,{variant:`ghost`,size:`sm`,disabled:r,onClick:()=>void d(e),children:_()}):null]})}return(0,X.jsxs)(`div`,{className:`oc-chart-mine__logo`,children:[(0,X.jsx)(`span`,{className:`oc-chart-mine__groups-label`,children:ge()}),(0,X.jsxs)(`div`,{className:`oc-chart-mine__logo-slots`,children:[(0,X.jsx)(m,{mode:`light`}),(0,X.jsx)(m,{mode:`dark`})]}),r?(0,X.jsx)(`span`,{className:`oc-show__desc`,children:ce()}):null,a?(0,X.jsx)(`p`,{className:`oc-chart-import__error`,children:a}):null]})}function tn({chart:e}){let t=x(E.me.getMe,{host:bt}),n=C(E.charts.addChartDomain),r=C(E.charts.removeChartDomain),[i,a]=(0,K.useState)(``),[o,c]=(0,K.useState)(null),[u,f]=(0,K.useState)(!1);if(t?.role!==`admin`)return null;let p=e.domains??[];async function m(){let t=i.trim();if(t!==``){c(null),f(!0);try{await n({chartKey:e.key,domain:t}),a(``)}catch(e){c(e instanceof Error?e.message:String(e))}finally{f(!1)}}}async function h(t){c(null);try{await r({chartKey:e.key,domain:t})}catch{}}return(0,X.jsxs)(`div`,{className:`oc-chart-mine__domains`,children:[(0,X.jsx)(`span`,{className:`oc-chart-mine__groups-label`,children:oe()}),(0,X.jsxs)(`div`,{className:`oc-chart-mine__domains-body`,children:[(0,X.jsx)(`div`,{className:`oc-chart-avail__groups`,children:p.length===0?(0,X.jsx)(`span`,{className:`oc-show__desc`,children:ot()}):p.map(e=>(0,X.jsxs)(L,{variant:`secondary`,className:`oc-chart-avail__chip`,children:[e,(0,X.jsx)(`button`,{type:`button`,className:`oc-chart-avail__chip-x`,"aria-label":s({domain:e}),onClick:()=>void h(e),children:(0,X.jsx)(k,{className:`size-3`})})]},e))}),(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsx)(R,{value:i,onChange:e=>a(e.target.value),placeholder:d(),className:`oc-chart-mine__domains-input`,onKeyDown:e=>{e.key===`Enter`&&m()}}),(0,X.jsx)(A,{variant:`outline`,size:`sm`,disabled:u,onClick:()=>void m(),children:pe()})]}),(0,X.jsx)(`span`,{className:`oc-show__desc`,children:l()}),o?(0,X.jsx)(`p`,{className:`oc-chart-import__error`,children:o}):null]})]})}function nn(e){let t={...e};return delete t.bpm,JSON.stringify(t,null,2)}function rn({chart:e}){let t=C(E.charts.updateChart),n=C(E.charts.deleteChart),[r,i]=(0,K.useState)(!1),[a,o]=(0,K.useState)(e.name),[s,c]=(0,K.useState)(()=>nn(e.tokens)),[l,u]=(0,K.useState)(e.tokens.bpm??0),[d,f]=(0,K.useState)(null),[p,m]=(0,K.useState)(!1);function h(){o(e.name),c(nn(e.tokens)),u(e.tokens.bpm??0),f(null),i(!0)}async function _(){if(e.chartId===void 0)return;f(null);let n;try{n=JSON.parse(s)}catch{f(b());return}if(n&&typeof n==`object`&&!Array.isArray(n)){let e=n;l>0?e.bpm=l:delete e.bpm}m(!0);try{await t({chartId:e.chartId,name:a.trim(),tokens:n}),i(!1)}catch(e){f(e instanceof Error?e.message:String(e))}finally{m(!1)}}async function v(){if(e.chartId!==void 0&&window.confirm(D()))try{await n({chartId:e.chartId})}catch{}}return(0,X.jsxs)(`div`,{className:`oc-chart-mine__row`,children:[(0,X.jsxs)(`div`,{className:`oc-chart-mine__head`,children:[(0,X.jsx)(`span`,{className:`oc-chart-mine__name`,children:e.name}),(0,X.jsx)(`div`,{className:`oc-show__row`,children:r?null:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(A,{variant:`outline`,size:`sm`,onClick:h,children:he()}),(0,X.jsx)(A,{variant:`ghost`,size:`sm`,onClick:()=>void v(),children:g()})]})})]}),r?(0,X.jsxs)(`div`,{className:`oc-chart-mine__editor`,children:[(0,X.jsxs)(`label`,{className:`oc-chart-import__field`,children:[(0,X.jsx)(`span`,{className:`oc-chart-import__label`,children:we()}),(0,X.jsx)(R,{value:a,onChange:e=>o(e.target.value),maxLength:60})]}),(0,X.jsxs)(`div`,{className:`oc-chart-import__field`,children:[(0,X.jsx)(`span`,{className:`oc-chart-import__label`,children:S()}),(0,X.jsxs)(`div`,{className:`oc-chart-bpm`,children:[(0,X.jsx)(`input`,{type:`range`,className:`oc-chart-bpm__slider`,min:0,max:90,step:5,value:l,onChange:e=>u(Number(e.target.value)),"aria-label":S()}),(0,X.jsx)(`span`,{className:`oc-chart-bpm__value`,children:l===0?Le():`${l} BPM`})]}),(0,X.jsx)(`span`,{className:`oc-show__desc`,children:Qe()})]}),(0,X.jsxs)(`label`,{className:`oc-chart-import__field`,children:[(0,X.jsx)(`span`,{className:`oc-chart-import__label`,children:ut()}),(0,X.jsx)(`textarea`,{className:`oc-chart-import__textarea`,value:s,onChange:e=>c(e.target.value),rows:10,spellCheck:!1})]}),d?(0,X.jsx)(`p`,{className:`oc-chart-import__error`,children:d}):null,(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsx)(A,{size:`sm`,disabled:p,onClick:()=>void _(),children:fe()}),(0,X.jsx)(A,{variant:`ghost`,size:`sm`,onClick:()=>i(!1),children:ct()})]})]}):null,(0,X.jsx)(en,{chart:e}),(0,X.jsx)(tn,{chart:e})]})}function an(){let e=x(E.charts.listMyCharts),t=(e??[]).filter(e=>e.via===`owner`);return(0,X.jsxs)(`section`,{className:`oc-show__section`,children:[(0,X.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,X.jsx)(`h2`,{className:`oc-show__title`,children:ee()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:h()})]}),e!==void 0&&t.length===0?(0,X.jsx)(`p`,{className:`oc-show__desc`,children:_e()}):(0,X.jsx)(`div`,{className:`oc-chart-mine-list`,children:t.map(e=>(0,X.jsx)(rn,{chart:e},e.key))})]})}function on({chart:e,groups:t}){let n=C(E.charts.addChartToGroupPool),r=C(E.charts.removeChartFromGroupPool),i=e.restrictedToGroups,a=e.poolGroups,o=new Set((a??[]).map(e=>e.groupId)),s=t.filter(e=>!o.has(e._id));async function c(t){try{await n({groupId:t,chartKey:e.key})}catch{}}async function l(t){try{await r({groupId:t,chartKey:e.key})}catch{}}return(0,X.jsxs)(`div`,{className:`oc-chart-avail`,children:[(0,X.jsxs)(`div`,{className:`oc-chart-avail__head`,children:[(0,X.jsx)(`span`,{className:`oc-chart-avail__name`,children:e.name}),(0,X.jsx)(L,{variant:i?`secondary`:`outline`,className:`oc-chart-avail__state`,children:i?Ue():e.kind===`custom`&&e.scope===`personal`?w():rt()}),e.isGlobalDefault?(0,X.jsx)(L,{variant:`default`,children:Ee()}):null]}),(0,X.jsxs)(`div`,{className:`oc-chart-avail__groups`,children:[(0,X.jsx)(`span`,{className:`oc-chart-mine__groups-label`,children:Je()}),(a??[]).map(e=>(0,X.jsxs)(L,{variant:`secondary`,className:`oc-chart-avail__chip`,children:[e.name,(0,X.jsx)(`button`,{type:`button`,className:`oc-chart-avail__chip-x`,"aria-label":Re({group:e.name}),onClick:()=>void l(e.groupId),children:(0,X.jsx)(k,{className:`size-3`})})]},e.groupId)),s.length>0?(0,X.jsxs)(F,{value:``,onValueChange:e=>void c(e),children:[(0,X.jsx)(I,{size:`sm`,className:`w-56`,children:(0,X.jsx)(M,{placeholder:Ce()})}),(0,X.jsx)(j,{children:s.map(e=>(0,X.jsx)(z,{value:e._id,children:e.name},e._id))})]}):t.length===0?(0,X.jsx)(`span`,{className:`oc-show__desc`,children:et()}):null]})]})}function sn({chart:e}){let t=C(E.charts.promoteChartToCommon),n=C(E.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(D()))try{await n({chartId:e.chartId})}catch{}}return(0,X.jsxs)(`div`,{className:`oc-chart-avail`,children:[(0,X.jsxs)(`div`,{className:`oc-chart-avail__head`,children:[(0,X.jsx)(`span`,{className:`oc-chart-avail__name`,children:e.name}),(0,X.jsx)(L,{variant:e.scope===`common`?`outline`:`secondary`,children:e.scope===`common`?Ye():w()}),e.ownerLabel?(0,X.jsx)(`span`,{className:`oc-show__desc`,children:Fe({owner:e.ownerLabel})}):null]}),(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[e.scope===`personal`?(0,X.jsx)(A,{variant:`outline`,size:`sm`,onClick:()=>void r(),children:je()}):null,(0,X.jsx)(A,{variant:`ghost`,size:`sm`,onClick:()=>void i(),children:De()})]})]})}function cn({defaultThemeMode:e,defaultLocale:t,defaultChartKey:n}){let r=C(E.admin.setDefaultThemeMode),i=C(E.admin.setDefaultLocale),o=C(E.charts.setDefaultChart),s=x(E.charts.listChartsAdmin),c=x(E.groups.listGroups,{}),l=e??`system`,u=t??`fr`;return(0,X.jsxs)(`div`,{className:`oc-appearance-admin`,children:[(0,X.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,X.jsx)(`h2`,{className:`oc-show__title`,children:f()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:me()})]}),(0,X.jsxs)(`section`,{className:`oc-show__section`,children:[(0,X.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,X.jsx)(`h3`,{className:`oc-show__title`,children:Pe()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:Ie()})]}),(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsx)(A,{variant:n===null?`default`:`outline`,size:`sm`,onClick:()=>void o({name:null}),children:y()}),vt.map(e=>(0,X.jsx)(A,{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,X.jsx)(A,{variant:n===e.key?`default`:`outline`,size:`sm`,onClick:()=>void o({name:e.key}),children:e.name},e.key))]})]}),(0,X.jsxs)(`section`,{className:`oc-show__section`,children:[(0,X.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,X.jsx)(`h3`,{className:`oc-show__title`,children:Ge()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:Xe()})]}),(0,X.jsx)(`div`,{className:`oc-chart-avail-list`,children:(s??[]).filter(e=>!(e.kind===`custom`&&e.scope===`common`)).map(e=>(0,X.jsx)(on,{chart:e,groups:c??[]},e.key))})]}),(0,X.jsxs)(`section`,{className:`oc-show__section`,children:[(0,X.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,X.jsx)(`h3`,{className:`oc-show__title`,children:Me()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:ke()})]}),(0,X.jsx)(`div`,{className:`oc-chart-avail-list`,children:(s??[]).filter(e=>e.kind===`builtin`||e.scope===`common`).map(e=>(0,X.jsxs)(`div`,{className:`oc-chart-avail`,children:[(0,X.jsx)(`div`,{className:`oc-chart-avail__head`,children:(0,X.jsx)(`span`,{className:`oc-chart-avail__name`,children:e.name})}),(0,X.jsx)(tn,{chart:e})]},e.key))})]}),(0,X.jsxs)(`section`,{className:`oc-show__section`,children:[(0,X.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,X.jsx)(`h3`,{className:`oc-show__title`,children:be()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:Ne()})]}),(()=>{let e=(s??[]).filter(e=>e.kind===`custom`);return e.length===0?(0,X.jsx)(`p`,{className:`oc-show__desc`,children:nt()}):(0,X.jsx)(`div`,{className:`oc-chart-avail-list`,children:e.map(e=>(0,X.jsx)(sn,{chart:e},e.key))})})()]}),(0,X.jsxs)(`section`,{className:`oc-show__section`,children:[(0,X.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,X.jsx)(`h3`,{className:`oc-show__title`,children:re()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:Be()})]}),(0,X.jsx)(`div`,{className:`oc-show__row`,children:[`light`,`dark`,`system`].map(e=>(0,X.jsx)(A,{variant:l===e?`default`:`outline`,size:`sm`,onClick:()=>void r({mode:e}),children:Jt(e)},e))})]}),(0,X.jsxs)(`section`,{className:`oc-show__section`,children:[(0,X.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,X.jsx)(`h3`,{className:`oc-show__title`,children:a()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:He()})]}),(0,X.jsx)(`div`,{className:`oc-show__row`,children:[`fr`,`en`].map(e=>(0,X.jsx)(A,{variant:u===e?`default`:`outline`,size:`sm`,onClick:()=>void i({locale:e}),children:e===`fr`?it():xe()},e))}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:se()})]})]})}function ln(){let e=x(E.me.getMe,{host:bt}),t=yt(e?.resolvedThemeMode);return(0,X.jsxs)(`div`,{className:`oc-appearance`,children:[(0,X.jsx)(Qt,{selectedKey:e?.chartKey??null,resolvedMode:t}),(0,X.jsx)($t,{}),(0,X.jsx)(an,{}),e?.role===`admin`?(0,X.jsx)(cn,{defaultThemeMode:e.defaultThemeMode,defaultLocale:e.defaultLocale,defaultChartKey:e.defaultChartKey}):null]})}function un(){let[e,t]=(0,K.useState)(!0),[n,r]=(0,K.useState)(`per-user`),[i,a]=(0,K.useState)(``),[o,s]=(0,K.useState)(Z),[c,l]=(0,K.useState)(Z),[d,f]=(0,K.useState)(Q),p=i!==``||o!==Z||c!==Z;function m(){a(``),s(Z),l(Z),f(Q)}return(0,X.jsxs)(`div`,{className:`oc-show`,children:[(0,X.jsx)(ln,{}),(0,X.jsxs)(`details`,{className:`oc-show__ref`,children:[(0,X.jsx)(`summary`,{className:`oc-show__title`,children:u()}),(0,X.jsxs)($,{title:`Buttons`,description:`Variants`,children:[(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsx)(A,{children:`Default`}),(0,X.jsx)(A,{variant:`secondary`,children:`Secondary`}),(0,X.jsx)(A,{variant:`outline`,children:`Outline`}),(0,X.jsx)(A,{variant:`ghost`,children:`Ghost`}),(0,X.jsx)(A,{variant:`destructive`,children:`Destructive`}),(0,X.jsx)(A,{variant:`link`,children:`Link`})]}),(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsx)(A,{size:`sm`,children:`Small`}),(0,X.jsx)(A,{children:`Default`}),(0,X.jsx)(A,{size:`lg`,children:`Large`}),(0,X.jsx)(A,{size:`icon`,"aria-label":`more`,children:(0,X.jsx)(B,{})}),(0,X.jsx)(A,{disabled:!0,children:`Disabled`})]})]}),(0,X.jsx)($,{title:`Badges`,children:(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsx)(L,{children:`Default`}),(0,X.jsx)(L,{variant:`secondary`,children:`Secondary`}),(0,X.jsx)(L,{variant:`outline`,children:`Outline`}),(0,X.jsx)(L,{variant:`destructive`,children:`Destructive`})]})}),(0,X.jsx)($,{title:`Inputs & selection`,children:(0,X.jsxs)(`div`,{className:`oc-show__row oc-show__row--col`,children:[(0,X.jsx)(R,{placeholder:`Text input…`}),(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsxs)(F,{value:n,onValueChange:r,children:[(0,X.jsx)(I,{className:`w-56`,children:(0,X.jsx)(M,{placeholder:`Select…`})}),(0,X.jsxs)(j,{children:[(0,X.jsx)(z,{value:`per-user`,children:`per-user (chacun son agent)`}),(0,X.jsx)(z,{value:`shared`,children:`shared (agent commun)`})]})]}),(0,X.jsxs)(`label`,{className:`oc-show__check`,children:[(0,X.jsx)(V,{checked:e,onCheckedChange:e=>t(!!e)}),`Checkbox`]})]})]})}),(0,X.jsx)($,{title:`Filtres & plage temporelle`,description:`Barre réutilisable (recherche debouncée + selects rapides à largeur auto + plage façon Grafana) et constructeur de filtre avancé. Câblée dans Users, Groups, Comptes de service, Traces, Anomalies, Audit et KPI.`,children:(0,X.jsxs)(`div`,{className:`oc-show__row oc-show__row--col`,children:[(0,X.jsxs)(jt,{q:i,onQChange:a,searchPlaceholder:`Rechercher (kind, principal, rôle, route…)`,timeRange:d,onTimeRangeChange:f,onReset:m,canReset:p,children:[(0,X.jsxs)(F,{value:o,onValueChange:s,children:[(0,X.jsx)(I,{size:`sm`,children:(0,X.jsx)(M,{})}),(0,X.jsxs)(j,{children:[(0,X.jsx)(z,{value:Z,children:`Toutes directions`}),(0,X.jsx)(z,{value:`inbound`,children:`inbound`}),(0,X.jsx)(z,{value:`outbound`,children:`outbound`}),(0,X.jsx)(z,{value:`internal`,children:`internal`})]})]}),(0,X.jsxs)(F,{value:c,onValueChange:l,children:[(0,X.jsx)(I,{size:`sm`,children:(0,X.jsx)(M,{})}),(0,X.jsxs)(j,{children:[(0,X.jsx)(z,{value:Z,children:`Toutes sévérités`}),(0,X.jsx)(z,{value:`info`,children:`info`}),(0,X.jsx)(z,{value:`warn`,children:`warn`}),(0,X.jsx)(z,{value:`critical`,children:`critical`})]})]})]}),(0,X.jsx)(Mt,{fields:qt,onChange:()=>{}}),(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsx)(`span`,{className:`oc-show__desc`,children:`Sélecteur de plage seul :`}),(0,X.jsx)(pt,{value:d,onChange:f})]})]})}),(0,X.jsx)($,{title:`Dropdown menu`,description:`Row actions / kebab`,children:(0,X.jsxs)(gt,{children:[(0,X.jsx)(_t,{asChild:!0,children:(0,X.jsx)(A,{variant:`outline`,size:`icon`,"aria-label":`Open menu`,children:(0,X.jsx)(B,{})})}),(0,X.jsxs)(mt,{align:`start`,children:[(0,X.jsx)(xt,{children:`Actions`}),(0,X.jsx)(N,{}),(0,X.jsx)(P,{children:`Edit`}),(0,X.jsx)(P,{children:`Duplicate`}),(0,X.jsx)(N,{}),(0,X.jsx)(P,{variant:`destructive`,children:`Delete`})]})]})}),(0,X.jsx)($,{title:`Card`,children:(0,X.jsxs)(Dt,{className:`w-80`,children:[(0,X.jsxs)(St,{children:[(0,X.jsx)(Tt,{children:`Instance`}),(0,X.jsx)(Et,{children:`Non-secret metadata only.`})]}),(0,X.jsx)(wt,{className:`text-sm text-muted-foreground`,children:`ws://gateway.example.org:18789`}),(0,X.jsxs)(Ct,{className:`gap-2`,children:[(0,X.jsx)(A,{size:`sm`,children:`Save`}),(0,X.jsx)(A,{size:`sm`,variant:`ghost`,children:`Cancel`})]})]})}),(0,X.jsx)($,{title:`Table`,children:(0,X.jsxs)(At,{children:[(0,X.jsx)(Ot,{children:(0,X.jsxs)(U,{children:[(0,X.jsx)(H,{className:`w-8`,children:(0,X.jsx)(V,{"aria-label":`select all`})}),(0,X.jsx)(H,{children:`Name`}),(0,X.jsx)(H,{children:`Mode`}),(0,X.jsx)(H,{className:`text-right`,children:`Status`}),(0,X.jsx)(H,{className:`w-8`})]})}),(0,X.jsx)(kt,{children:[{n:`admins`,m:`per-user`,s:`active`},{n:`family`,m:`shared`,s:`active`}].map(e=>(0,X.jsxs)(U,{children:[(0,X.jsx)(W,{children:(0,X.jsx)(V,{"aria-label":`select ${e.n}`})}),(0,X.jsx)(W,{className:`font-medium`,children:e.n}),(0,X.jsx)(W,{children:(0,X.jsx)(L,{variant:`secondary`,children:e.m})}),(0,X.jsx)(W,{className:`text-right`,children:(0,X.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-muted-foreground`,children:[(0,X.jsx)(O,{className:`size-3.5`}),` `,e.s]})}),(0,X.jsx)(W,{children:(0,X.jsx)(A,{variant:`ghost`,size:`icon`,"aria-label":`row actions`,children:(0,X.jsx)(B,{})})})]},e.n))})]})}),(0,X.jsx)($,{title:`App fragments`,description:`Chat-specific components`,children:(0,X.jsxs)(`div`,{className:`oc-show__row oc-show__row--col`,children:[(0,X.jsx)(`div`,{className:`oc-msg oc-msg--assistant`,children:(0,X.jsx)(`div`,{className:`oc-msg__body`,children:`Assistant message bubble.`})}),(0,X.jsx)(`div`,{className:`oc-tool oc-tool--completed`,children:(0,X.jsxs)(`div`,{className:`oc-tool__header`,children:[(0,X.jsx)(`span`,{className:`oc-tool__icon`,children:`✓`}),(0,X.jsx)(`span`,{className:`oc-tool__name`,children:`write-file`}),(0,X.jsx)(`span`,{className:`oc-tool__phase`,children:`completed`})]})}),(0,X.jsxs)(`div`,{className:`oc-run-status oc-run-status--streaming`,children:[(0,X.jsx)(`span`,{className:`oc-run-status__dot`}),(0,X.jsx)(`span`,{className:`oc-run-status__label`,children:`Running`})]})]})})]})]})}export{un 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{Ac as r,Cc as i,Dc as a,Ec as o,Mc as s,Nc as c,Oc as l,Pc as u,Sc as d,Tc as f,dE as p,jc as m,kc as h,wc as g}from"./dist-CKhDstdM.js";import{t as _}from"./button-HRR8tdJ2.js";import{Z as v,ct as y,lt as b,st as x,ut as S,vt as C}from"./index-DR0RpyTI.js";var w=p(`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:u(),from:`now-5m`},{label:c(),from:`now-15m`},{label:s(),from:`now-30m`},{label:m(),from:`now-1h`},{label:r(),from:`now-3h`},{label:h(),from:`now-6h`},{label:l(),from:`now-12h`},{label:a(),from:`now-24h`},{label:o(),from:`now-2d`},{label:f(),from:`now-7d`},{label:g(),from:`now-30d`},{label:i(),from:`now-90d`},{label:d(),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{$u as r,$v as i,Av as a,Cd as o,Cv as s,Dd as c,Dv as l,Ed as u,Ev as d,Fv as f,Gu as p,Gv as m,Hv as h,Iv as g,Ju as ee,Jv as _,Ku as v,Kv as y,Mv as b,Nv as x,Od as te,Ov as S,Pv as C,Qu as ne,Qv as w,Sd as re,Sv as ie,Td as ae,Tv as oe,Uv as se,Vv as ce,Wv as le,Xu as ue,Xv as T,Yu as de,Yv as E,Zu as fe,Zv as D,_E as O,_d as pe,ad as me,ay as k,bd as he,cd as ge,cy as A,dE as j,dd as _e,dy as M,ed as ve,ey as N,fd as ye,gE as P,gd as be,hd as xe,id as Se,iy as F,jv as I,kd as Ce,kv as we,ld as Te,ly as Ee,md as De,nd as Oe,ny as ke,od as Ae,oy as je,pd as Me,qu as Ne,qv as Pe,rd as Fe,ry as Ie,sd as Le,sy as Re,td as ze,ty as Be,uE as L,ud as Ve,uy as He,vd as Ue,wd as We,wv as Ge,xd as Ke,yd as qe}from"./dist-CKhDstdM.js";import{n as Je}from"./dist-DErYNbMW.js";import{n as R}from"./TimeRangePicker-BJ_SDnZN.js";import{t as Ye}from"./x-Dnhgu6fy.js";import{i as z,n as B,r as Xe,t as Ze}from"./tabs-Bh17c652.js";import{t as V}from"./button-HRR8tdJ2.js";import{$ as Qe,At as $e,C as H,Ct as et,E as U,Et as tt,Q as nt,S as W,T as G,X as K,a as rt,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,w as q}from"./index-DR0RpyTI.js";import{t as pt}from"./FilterBar-DZBiB1MF.js";import{t as mt}from"./AdvancedFilter-Dsn2CdBY.js";import{t as ht}from"./DataTableShell-67hI2aZh.js";var gt=j(`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=j(`gauge`,[[`path`,{d:`m12 14 4-4`,key:`9kzdfg`}],[`path`,{d:`M3.34 19a10 10 0 1 1 17.32 0`,key:`19p75a`}]]),vt=j(`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`?y():n===`agent`?`${m()} - ${r}`:e}function bt(){let e=O(L.me.getMe,{host:ut})?.role===`admin`,t=O(L.deliveryTiming.getDeliveryStatus,{}),n=P(L.deliveryTiming.startDeliveryRecord),r=P(L.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:M()}),(0,Y.jsx)(`p`,{className:`oc-admin__hint`,children:He()})]}),e?(0,Y.jsx)(V,{variant:c?`destructive`:`default`,size:`sm`,disabled:o||t===void 0,onClick:()=>void l(),children:c?A():Ee()}):null]}),c?(0,Y.jsxs)(`p`,{className:`flex items-center gap-2 text-sm`,children:[(0,Y.jsx)(K,{variant:`secondary`,children:Re()}),t?.startedAt?(0,Y.jsx)(`span`,{className:`text-muted-foreground`,children:je({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?Ie():F()})}),i?(0,Y.jsx)(xt,{isAdmin:e}):null]})}function xt({isAdmin:e}){let t=O(L.deliveryTiming.listDeliverySessions,{}),n=P(L.deliveryTiming.deleteDeliverySessions),[r,a]=(0,J.useState)(``),[o,c]=(0,J.useState)(`all`),[l,u]=(0,J.useState)(X),[d,f]=(0,J.useState)(null),{from:p,to:m}=R(l),g=l.to===`now`?1/0:m,ee=r.trim()!==``||o!==`all`||l!==X,v=()=>{a(``),c(`all`),u(X)},y=(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>=p&&t.startedAt<=g).map(e=>({...e,_id:e.sessionId}))},[t,r,o,p,g]),b=e=>{let t=new Set((y??[]).map(e=>e.sessionId)),r=e.filter(e=>t.has(e));r.length!==0&&(n({sessionIds:r}),d!==null&&r.includes(d)&&f(null))};return(0,Y.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Y.jsx)(pt,{q:r,onQChange:a,searchPlaceholder:Be(),timeRange:l,onTimeRangeChange:u,onReset:v,canReset:ee,children:(0,Y.jsxs)(W,{value:o,onValueChange:e=>c(e),children:[(0,Y.jsx)(G,{size:`sm`,className:`w-36`,children:(0,Y.jsx)(U,{})}),(0,Y.jsxs)(H,{children:[(0,Y.jsx)(q,{value:`all`,children:N()}),(0,Y.jsx)(q,{value:`active`,children:i()}),(0,Y.jsx)(q,{value:`stopped`,children:w()})]})]})}),(0,Y.jsx)(ht,{title:ke(),rows:y,emptyHint:s(),columns:[{header:``,className:`w-8`,cell:e=>(0,Y.jsx)(V,{variant:`ghost`,size:`icon`,"aria-label":d===e.sessionId?se():le(),onClick:()=>f(t=>t===e.sessionId?null:e.sessionId),children:d===e.sessionId?(0,Y.jsx)(gt,{size:15,"aria-hidden":!0}):(0,Y.jsx)(et,{size:15,"aria-hidden":!0})})},{header:D(),sort:e=>e.startedAt,cell:e=>(0,Y.jsx)(`span`,{className:`tabular-nums`,children:new Date(e.startedAt).toLocaleString()})},{header:T(),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:E(),sort:e=>e.count,cell:e=>(0,Y.jsx)(`span`,{className:`tabular-nums`,children:Z(e.count)})},{header:_(),sort:e=>e.startedBy,cell:e=>yt(e.startedBy)},{header:Pe(),sort:e=>e.active,cell:e=>e.active?(0,Y.jsx)(K,{variant:`secondary`,children:i()}):(0,Y.jsx)(`span`,{className:`text-muted-foreground`,children:w()})}],rowActions:e?e=>[{label:h(),variant:`destructive`,onSelect:()=>b([e.sessionId])}]:void 0,bulkActions:e?[{label:h(),variant:`destructive`,onSelect:e=>b(e)}]:void 0,isExpanded:e=>e.sessionId===d,renderExpanded:e=>(0,Y.jsx)(St,{sessionId:e.sessionId})})]})}function St({sessionId:e}){let t=O(L.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:ce()});if(e.count===0||e.segments===null)return(0,Y.jsx)(`p`,{className:`oc-admin__hint`,children:k()});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,` `,ie()]}),(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():oe()]})]}),(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:C()}),(0,Y.jsx)(`th`,{className:`py-1 text-right font-medium`,children:x()}),(0,Y.jsx)(`th`,{className:`py-1 text-right font-medium`,children:b()})]})}),(0,Y.jsxs)(`tbody`,{children:[i(I(),r.bridge),i(a(),r.A),i(we(),r.C)]})]}),(0,Y.jsx)(`p`,{className:`oc-admin__hint`,children:S()}),e.truncated?(0,Y.jsx)(`p`,{className:`oc-admin__hint`,children:d()}):null,(0,Y.jsx)(`p`,{className:`oc-admin__hint`,children:l()})]})}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,s=e.principalType??Q,l=e.direction??Q,d=e.roleKey??Q,p=e.q??``,m=dt(e.from,e.to),h=(0,J.useMemo)(()=>lt(e.adv),[e.adv]),{from:_,to:v}=R(m),[y,b]=(0,J.useState)(null),[x,S]=(0,J.useState)(null),C=e=>void t({search:t=>({...t,limit:e})}),w=e=>void t({search:t=>({...t,kind:e})}),ie=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})}),se=e=>void t({search:t=>({...t,principalType:e===Q?void 0:e})}),ce=e=>void t({search:t=>({...t,direction:e===Q?void 0:e})}),le=e=>void t({search:t=>({...t,roleKey:e===Q?void 0:e})}),T=e=>void t({search:t=>({...t,...rt(e)})}),E=e=>void t({search:t=>({...t,adv:at(e)}),replace:!0}),D=O(L.observability.listEvents,{limit:n}),k=O(L.observability.listEvents,{limit:n,kind:i===Tt?void 0:i,filter:{q:p||void 0,from:_,to:v,statusClass:a===Q?void 0:a,principalType:s===Q?void 0:s,direction:l===Q?void 0:l,roleKey:d===Q?void 0:d,advanced:h.length>0?h:void 0}}),A=(0,J.useMemo)(()=>{let e=new Set;for(let t of D??[])e.add(t.kind);return[...e].sort()},[D]),j=(0,J.useMemo)(()=>{let e=new Set;for(let t of D??[])t.roleKey&&e.add(t.roleKey);return[...e].sort()},[D]),M=p!==``||a!==Q||s!==Q||l!==Q||d!==Q||h.length>0||m.kind!==`relative`||m.from!==kt.from;function N(){t({search:{limit:100,kind:`all`},replace:!0})}let P=y?D?.filter(e=>e.correlationId===y):k,[F,I]=(0,J.useState)(`events`);return(0,Y.jsxs)(Ze,{value:F,onValueChange:e=>I(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}),g()]}),(0,Y.jsxs)(z,{value:`events`,className:`flex-1 gap-1.5`,children:[(0,Y.jsx)(vt,{size:13,"aria-hidden":!0}),f()]})]}),(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:[Ce(),(0,Y.jsx)(`strong`,{children:te()}),c(),` `,(0,Y.jsx)(`span`,{className:`oc-filter__window`,children:u()})]}),(0,Y.jsxs)(pt,{q:p,onQChange:ie,searchPlaceholder:ae(),timeRange:m,onTimeRangeChange:T,onReset:N,canReset:M,children:[(0,Y.jsxs)(W,{value:a,onValueChange:oe,children:[(0,Y.jsx)(G,{size:`sm`,className:`w-32`,children:(0,Y.jsx)(U,{placeholder:We()})}),(0,Y.jsxs)(H,{children:[(0,Y.jsx)(q,{value:Q,children:o()}),Et.map(e=>(0,Y.jsx)(q,{value:e,children:e},e))]})]}),(0,Y.jsxs)(W,{value:s,onValueChange:se,children:[(0,Y.jsx)(G,{size:`sm`,className:`w-32`,children:(0,Y.jsx)(U,{placeholder:re()})}),(0,Y.jsxs)(H,{children:[(0,Y.jsx)(q,{value:Q,children:Ke()}),Dt.map(e=>(0,Y.jsx)(q,{value:e,children:e},e))]})]}),(0,Y.jsxs)(W,{value:l,onValueChange:ce,children:[(0,Y.jsx)(G,{size:`sm`,className:`w-32`,children:(0,Y.jsx)(U,{placeholder:he()})}),(0,Y.jsxs)(H,{children:[(0,Y.jsx)(q,{value:Q,children:qe()}),Ot.map(e=>(0,Y.jsx)(q,{value:e,children:e},e))]})]}),(0,Y.jsxs)(W,{value:d,onValueChange:le,children:[(0,Y.jsx)(G,{size:`sm`,className:`w-36`,children:(0,Y.jsx)(U,{placeholder:Ue()})}),(0,Y.jsxs)(H,{children:[(0,Y.jsx)(q,{value:Q,children:pe()}),j.map(e=>(0,Y.jsx)(q,{value:e,children:e},e))]})]}),(0,Y.jsxs)(W,{value:i,onValueChange:w,children:[(0,Y.jsx)(G,{size:`sm`,className:`w-44`,children:(0,Y.jsx)(U,{placeholder:be()})}),(0,Y.jsxs)(H,{children:[(0,Y.jsx)(q,{value:Tt,children:xe()}),A.map(e=>(0,Y.jsx)(q,{value:e,children:e},e))]})]}),(0,Y.jsxs)(W,{value:String(n),onValueChange:e=>C(Number(e)),children:[(0,Y.jsx)(G,{size:`sm`,className:`w-28`,children:(0,Y.jsx)(U,{})}),(0,Y.jsx)(H,{children:wt.map(e=>(0,Y.jsx)(q,{value:String(e),children:De({count:e})},e))})]})]}),(0,Y.jsx)(mt,{fields:At,seed:h,onChange:E}),y?(0,Y.jsx)(`div`,{className:`oc-traces__followline`,children:(0,Y.jsxs)(`button`,{type:`button`,className:`oc-traces__chip`,onClick:()=>b(null),title:Me(),children:[(0,Y.jsxs)(`span`,{className:`oc-traces__chip-label`,children:[ye(),(0,Y.jsx)(`code`,{children:$(y)})]}),(0,Y.jsx)(Ye,{className:`oc-traces__chip-x`,"aria-hidden":!0}),(0,Y.jsx)(`span`,{className:`sr-only`,children:_e()})]})}):null,(0,Y.jsx)(ht,{title:Ve(),rows:P,emptyHint:y?Te():ge(),columns:[{header:Le(),sort:e=>e.at,cell:e=>(0,Y.jsx)(`span`,{className:`oc-traces__time`,children:new Date(e.at).toLocaleString(`fr-FR`)})},{header:Ae(),sort:e=>e.kind,cell:e=>(0,Y.jsx)(K,{variant:`secondary`,children:e.kind})},{header:me(),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":Se(),children:`✓`})}},{header:Fe(),sort:e=>e.direction,cell:e=>e.direction?(0,Y.jsx)(K,{variant:`outline`,children:e.direction}):(0,Y.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})},{header:Oe(),sort:e=>e.principalType,cell:e=>(0,Y.jsxs)(`span`,{className:`oc-traces__principal`,children:[(0,Y.jsx)(K,{variant:`outline`,children:e.principalType}),e.principalId?(0,Y.jsx)(`code`,{className:`oc-traces__mono`,children:$(e.principalId)}):null]})},{header:ze(),sort:e=>e.roleKey,cell:e=>e.roleKey?(0,Y.jsx)(K,{variant:`secondary`,children:e.roleKey}):(0,Y.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})},{header:ve(),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:r(),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:ne(),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:fe(),sort:e=>e.correlationId,cell:e=>e.correlationId?(0,Y.jsx)(`button`,{type:`button`,className:`oc-traces__corr`,title:ue(),onClick:()=>b(e.correlationId),children:$(e.correlationId)}):(0,Y.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})},{header:de(),sort:e=>+!!e.meta,cell:e=>e.meta?(0,Y.jsx)(V,{variant:`outline`,size:`sm`,onClick:()=>S(e),children:ee()}):(0,Y.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})}]}),(0,Y.jsx)(Pt,{row:x,onClose:()=>S(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:[Ne(),` `,(0,Y.jsx)(`code`,{children:e.kind}),(0,Y.jsx)(K,{variant:`outline`,children:v()})]}),(0,Y.jsx)(it,{children:p()})]}),(0,Y.jsx)(`pre`,{className:`oc-traces__meta-json`,children:n})]}):null})}export{jt as TracesTab};
|