@lacneu/atrium 0.18.1 → 0.19.1
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-SACgMGAi.js +1 -0
- package/dist/assets/{AdvancedFilter-CxFcwq_P.js → AdvancedFilter-D7QXVQ5_.js} +1 -1
- package/dist/assets/AgentFilesTab-DcWaUTsA.js +3 -0
- package/dist/assets/AnomaliesTab-B856xOQY.js +1 -0
- package/dist/assets/{AuditTab-C5iOM0e2.js → AuditTab-B0xwh9EC.js} +1 -1
- package/dist/assets/BridgeTab-KP5PlAMx.js +1 -0
- package/dist/assets/ChatDefaultsTab-1p-luBRT.js +1 -0
- package/dist/assets/{DataTableShell-DQ-E7MMz.js → DataTableShell-C1ZKbpq3.js} +1 -1
- package/dist/assets/{DetailChips-DLGo-JpY.js → DetailChips-Dg4YEpwe.js} +1 -1
- package/dist/assets/FeedbacksTab-Bg62mK4W.js +1 -0
- package/dist/assets/{FieldLabel-D8ek_B4M.js → FieldLabel-X2EAqICh.js} +1 -1
- package/dist/assets/FilesTab-BiW2j80D.js +1 -0
- package/dist/assets/{FilterBar-C2YZIUUe.js → FilterBar-CSA8xMkl.js} +1 -1
- package/dist/assets/GroupsTab-CevcyqNU.js +1 -0
- package/dist/assets/InstancesTab-CK-3Nvfy.js +1 -0
- package/dist/assets/IntegrationsTab-Cf2NA4f0.js +1 -0
- package/dist/assets/{KpiTab-BSPnCroi.js → KpiTab-BHkpsXb_.js} +1 -1
- package/dist/assets/PreferencesTab-DBxEQcoG.js +1 -0
- package/dist/assets/PromptInjectionsTab-ILsAUU_D.js +2 -0
- package/dist/assets/RolesTab-cg8r2k6J.js +1 -0
- package/dist/assets/ServiceAccountsTab-DV9xE6V0.js +1 -0
- package/dist/assets/SubAgentReportsTab-Cre8FArV.js +1 -0
- package/dist/assets/ThemeShowroom-DxfyV3nj.js +1 -0
- package/dist/assets/{TimeRangePicker-BrRrLGuZ.js → TimeRangePicker-CY6cFX3v.js} +1 -1
- package/dist/assets/TracesTab-C5hnZP3-.js +1 -0
- package/dist/assets/UsersTab-DDINHhFG.js +1 -0
- package/dist/assets/button-DXGXeanX.js +1 -0
- package/dist/assets/{card-DfgoJ62e.js → card-B60DsQBe.js} +1 -1
- package/dist/assets/chevrons-up-down-CeISPPN2.js +1 -0
- package/dist/assets/{compatView-DkKdPV6Y.js → compatView-BKe3swOt.js} +1 -1
- package/dist/assets/dispatchErrorInfo-DekuLV6o.js +1 -0
- package/dist/assets/{dist-uaKglBXL.js → dist-AH7-HhdT.js} +1 -1
- package/dist/assets/{dist-BUmwZkrg.js → dist-By-c_NRB.js} +1 -1
- package/dist/assets/dist-BzNYkP4V.js +44 -0
- package/dist/assets/{dist-nuTFLy00.js → dist-CWfWFr7t.js} +1 -1
- package/dist/assets/{highlighted-body-OFNGDK62-CFixeKPt.js → highlighted-body-OFNGDK62-CVA3g0hA.js} +1 -1
- package/dist/assets/index-CKlFEsq3.js +227 -0
- package/dist/assets/{index-CwMQjTTm.css → index-DnIjl_W2.css} +1 -1
- package/dist/assets/mermaid-GHXKKRXX-BKbfiXDa.js +1 -0
- package/dist/assets/roleDescriptions-BN-dndvd.js +1 -0
- package/dist/assets/{table-DwL2Ye60.js → table-AFxsandT.js} +1 -1
- package/dist/assets/{tabs-B6uAHd27.js → tabs-9X-5Pgx3.js} +1 -1
- package/dist/assets/x-DQ_CLIEK.js +1 -0
- package/dist/index.html +8 -8
- package/package.json +1 -1
- package/dist/assets/AccessTab-TkrgrzLa.js +0 -1
- package/dist/assets/AgentFilesTab-CatKzUVP.js +0 -3
- package/dist/assets/AnomaliesTab-DSRyvaxR.js +0 -1
- package/dist/assets/BridgeTab-B7qr2P6q.js +0 -1
- package/dist/assets/ChatDefaultsTab-iOv_x32i.js +0 -1
- package/dist/assets/FeedbacksTab-CvsErlG2.js +0 -1
- package/dist/assets/FilesTab-B33o68UO.js +0 -1
- package/dist/assets/GroupsTab-CdvzID07.js +0 -1
- package/dist/assets/InstancesTab-CGkYjfNo.js +0 -1
- package/dist/assets/IntegrationsTab-CQpiJULa.js +0 -1
- package/dist/assets/PreferencesTab-C7qcojIg.js +0 -1
- package/dist/assets/PromptInjectionsTab-CogXAvHV.js +0 -2
- package/dist/assets/RolesTab--gHOFpff.js +0 -1
- package/dist/assets/ServiceAccountsTab-Cp2DaUB7.js +0 -1
- package/dist/assets/SubAgentReportsTab-UtnXHw5b.js +0 -1
- package/dist/assets/ThemeShowroom-cqNDsPWJ.js +0 -1
- package/dist/assets/TracesTab-nnYTuzmk.js +0 -1
- package/dist/assets/UsersTab-C0cFq4Am.js +0 -1
- package/dist/assets/button-C-Nb2Vgm.js +0 -1
- package/dist/assets/chevrons-up-down-BX1oFIbx.js +0 -1
- package/dist/assets/dispatchErrorInfo-B5yYJpqG.js +0 -1
- package/dist/assets/dist-dqCqhBJa.js +0 -44
- package/dist/assets/index-Chpx7q4s.js +0 -227
- package/dist/assets/mermaid-GHXKKRXX-l2fnQUrB.js +0 -1
- package/dist/assets/roleDescriptions-BAcwraVL.js +0 -1
- package/dist/assets/x-BK7YTQm6.js +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$a as r,CD as i,Ja as a,Ka as o,Qa as s,UE as c,Xa as l,Ya as u,Za as d,ao as f,eo as p,gD as m,io as h,no as g,oo as _,qa as v,ro as y,to as b}from"./dist-BzNYkP4V.js";import{C as x,S,X as C,b as w,x as T,y as E}from"./index-CKlFEsq3.js";var D=t(e(),1);function O(e){return e===`user`?l():e===`all`?u():a({group:e.group})}function k(e){return e===`common`?v():e===`owner`?o():a({group:e.group})}var A=n();function j(e){return e.name||e.email||e.userId.slice(0,8)}function M(){let e=i(m.admin.listUsers,{}),[t,n]=(0,D.useState)(``),a=i(m.introspect.introspectUser,t?{userId:t}:`skip`);return(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:_()}),(0,A.jsxs)(E,{value:t,onValueChange:n,children:[(0,A.jsx)(S,{size:`sm`,"aria-label":f(),children:(0,A.jsx)(x,{placeholder:f()})}),(0,A.jsx)(w,{children:(e??[]).map(e=>(0,A.jsx)(T,{value:e.userId,children:j(e)},e._id))})]}),t===``?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:h()}):a===void 0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:c()}):(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:a.user.label}),(0,A.jsx)(C,{variant:`secondary`,children:a.role})]})]}),(0,A.jsxs)(`section`,{className:`oc-introspect__section`,children:[(0,A.jsx)(`h3`,{className:`oc-introspect__title`,children:g()}),a.groups.length===0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:s()}):(0,A.jsx)(`div`,{className:`oc-introspect__chips`,children:a.groups.map(e=>(0,A.jsx)(C,{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:b()}),a.agents.length===0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:s()}):(0,A.jsx)(`ul`,{className:`oc-introspect__list`,children:a.agents.map(e=>(0,A.jsxs)(`li`,{className:`oc-introspect__row`,children:[(0,A.jsx)(`span`,{className:`oc-introspect__name`,children:e.displayName||e.agentId}),e.isDefault?(0,A.jsx)(C,{variant:`default`,children:d()}):null,(0,A.jsx)(C,{variant:`outline`,children:O(e.via)}),(0,A.jsx)(C,{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:p()}),a.charts.length===0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:s()}):(0,A.jsx)(`ul`,{className:`oc-introspect__list`,children:a.charts.map(e=>(0,A.jsxs)(`li`,{className:`oc-introspect__row`,children:[(0,A.jsx)(`span`,{className:`oc-introspect__name`,children:e.name}),(0,A.jsx)(C,{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:r()}),a.permissions.length===0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:s()}):(0,A.jsx)(`div`,{className:`oc-introspect__chips`,children:a.permissions.map(e=>(0,A.jsx)(C,{variant:`secondary`,children:e},e))})]})]})]})}export{M as AccessTab};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{_c as r,dc as i,fc as a,gc as o,hc as s,mc as c,pc as l}from"./dist-BzNYkP4V.js";import{i as u}from"./dist-AH7-HhdT.js";import{t as d}from"./x-DQ_CLIEK.js";import{t as f}from"./button-DXGXeanX.js";import{C as p,S as m,Z as h,b as g,bt as _,x as v,y}from"./index-CKlFEsq3.js";import{r as b}from"./TimeRangePicker-CY6cFX3v.js";var x=t(e(),1),S=n(),C=[{value:`eq`,label:`=`},{value:`neq`,label:`≠`},{value:`contains`,label:r()},{value:`gt`,label:`>`},{value:`gte`,label:`≥`},{value:`lt`,label:`<`},{value:`lte`,label:`≤`}],w=1;function T(){return{id:w++,field:``,op:`eq`,value:``}}function E(e){return e.map(e=>({id:w++,field:e.field,op:e.op,value:String(e.value)}))}function D({fields:e,seed:t,onChange:n}){let r=(0,x.useRef)(t),w=!!(r.current&&r.current.length>0),[D,O]=(0,x.useState)(w),[k,A]=(0,x.useState)(()=>w?E(r.current):[]);function j(e){n(e.filter(e=>e.field!==``&&e.value!==``).map(e=>({field:e.field,op:e.op,value:b(e.value)})))}function M(e,t){let n=k.map(n=>n.id===e?{...n,...t}:n);A(n),j(n)}function N(){A(e=>[...e,T()])}function P(e){let t=k.filter(t=>t.id!==e);A(t),j(t)}let F=k.filter(e=>e.field!==``&&e.value!==``).length;return(0,S.jsxs)(`div`,{className:`oc-advfilter`,children:[(0,S.jsxs)(`button`,{type:`button`,className:`oc-advfilter__toggle`,"aria-expanded":D,onClick:()=>O(e=>!e),children:[(0,S.jsx)(u,{className:`oc-advfilter__chevron`+(D?` is-open`:``),"aria-hidden":!0}),o(),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:s()}):(0,S.jsx)(`ul`,{className:`oc-advfilter__rows`,children:k.map(t=>(0,S.jsxs)(`li`,{className:`oc-advfilter__row`,children:[(0,S.jsxs)(y,{value:t.field||void 0,onValueChange:e=>M(t.id,{field:e}),children:[(0,S.jsx)(m,{size:`sm`,className:`w-40`,children:(0,S.jsx)(p,{placeholder:c()})}),(0,S.jsx)(g,{children:e.map(e=>(0,S.jsx)(v,{value:e.value,children:e.label},e.value))})]}),(0,S.jsxs)(y,{value:t.op,onValueChange:e=>M(t.id,{op:e}),children:[(0,S.jsx)(m,{size:`sm`,className:`w-28`,children:(0,S.jsx)(p,{})}),(0,S.jsx)(g,{children:C.map(e=>(0,S.jsx)(v,{value:e.value,children:e.label},e.value))})]}),(0,S.jsx)(h,{className:`oc-advfilter__value`,value:t.value,onChange:e=>M(t.id,{value:e.target.value}),placeholder:l()}),(0,S.jsx)(f,{variant:`ghost`,size:`icon-sm`,"aria-label":a(),onClick:()=>P(t.id),children:(0,S.jsx)(d,{})})]},t.id))}),(0,S.jsxs)(f,{variant:`outline`,size:`sm`,className:`oc-advfilter__add`,onClick:N,children:[(0,S.jsx)(_,{}),i()]})]}):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{Ar as r,Br as i,CD as a,Cr as o,Dr as s,Er as c,Fr as l,GE as ee,Ir as te,Lr as ne,Mr as u,Nr as re,Or as d,Pr as ie,Px as f,Rr as p,Si as ae,Sr as m,Tr as h,UE as g,Vr as _,_r as v,bD as y,br as b,fr as x,gD as S,gr as C,hr as w,jr as T,kr as oe,mr as E,pr as D,vr as se,wi as O,wr as k,xr as A,yr as j,zr as M}from"./dist-BzNYkP4V.js";import{t as N}from"./button-DXGXeanX.js";import{$ as P,A as F,B as I,C as L,F as ce,I as le,L as ue,N as de,P as fe,Q as pe,R as me,S as R,X as he,b as z,et as ge,mt as B,nt as _e,ot as V,rt as ve,v as H,x as U,y as W,z as ye}from"./index-CKlFEsq3.js";import{i as G}from"./compatView-BKe3swOt.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=a(S.me.getMe,{host:V}),t=e?.role===`admin`,n=(e?.permissions??[]).includes(`bridge.read`),o=a(S.admin.listInstances,e!==void 0&&t?{}:`skip`),[s,c]=(0,K.useState)(null);(0,K.useEffect)(()=>{!t||!o||o.length===0||(!s||!o.some(e=>e.name===s))&&c(o[0].name)},[t,o,s]);let d=a(S.agents.listAgentsForInstance,t&&s?{instanceName:s}:`skip`),f=a(S.agents.listMyAgents,e!==void 0&&!t?{}:`skip`),m=(0,K.useMemo)(()=>{if(e!==void 0){if(t)return s===null||d===void 0?o!==void 0&&o.length===0?[]:void 0:d.agents.map(e=>({instanceName:s,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,s,d,o,f]),[h,v]=(0,K.useState)(null);(0,K.useEffect)(()=>{!m||m.length===0||(!h||!m.some(e=>$(e)===h))&&v($(m[0]))},[m,h]);let b=m?.find(e=>$(e)===h)??null,x=y(S.agentFiles.listAgentFiles),[C,w]=(0,K.useState)({status:`idle`}),E=b?.instanceName??null,D=b?.agentId??null,se=a(S.compat.forInstance,n&&E!==null?{instanceName:E}:`skip`),O=n&&E!==null?H(se,`agentFiles`):null,k=O===null?!1:O===`loading`?null:O.blocked,A=(0,K.useCallback)(async()=>{if(!(E===null||D===null)){w({status:`loading`});try{w({status:`done`,files:(await x({instanceName:E,agentId:D})).files})}catch{w({status:`error`})}}},[x,E,D]);(0,K.useEffect)(()=>{k===!1&&A()},[A,k]);let[j,P]=(0,K.useState)(null),F=ee(),I=(0,K.useMemo)(()=>new Intl.NumberFormat(F,{maximumFractionDigits:0}),[F]);return e===void 0||m===void 0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:g()}):(0,Q.jsxs)(`div`,{className:`oc-afiles`,children:[(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:_()}),(0,Q.jsxs)(`div`,{className:`oc-afiles__picker`,children:[t&&(o?.length??0)>1?(0,Q.jsxs)(W,{value:s??``,onValueChange:e=>c(e),children:[(0,Q.jsx)(R,{size:`sm`,"aria-label":i(),children:(0,Q.jsx)(L,{})}),(0,Q.jsx)(z,{children:(o??[]).map(e=>(0,Q.jsx)(U,{value:e.name,children:e.name},e.name))})]}):null,m.length>0?(0,Q.jsxs)(W,{value:h??``,onValueChange:e=>v(e),children:[(0,Q.jsx)(R,{size:`sm`,"aria-label":M(),children:(0,Q.jsx)(L,{})}),(0,Q.jsx)(z,{children:m.map(e=>(0,Q.jsx)(U,{value:$(e),children:e.label},$(e)))})]}):(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:p()})]}),b===null?null:O===`loading`?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:g()}):O!==null&&O.blocked?(0,Q.jsxs)(`p`,{className:`oc-compat__blocked`,role:`status`,children:[(0,Q.jsx)(B,{size:14,"aria-hidden":!0}),` `,G(O.gatewayVersion)]}):C.status===`loading`||C.status===`idle`?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:g()}):C.status===`error`?(0,Q.jsxs)(`p`,{className:`oc-afiles__error`,role:`alert`,children:[te(),` `,(0,Q.jsx)(N,{variant:`outline`,size:`sm`,onClick:()=>void A(),children:ae()})]}):C.files.length===0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:ne()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`div`,{className:`oc-afiles__list`,children:C.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)(he,{variant:`outline`,children:l()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`span`,{className:`oc-afiles__size`,children:ie({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:re({pct:I.format(n)})}),i?(0,Q.jsx)(B,{size:14,className:`oc-afiles__warn`,"aria-label":u()}):(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:T({used:Z(be(C.files),F),total:Z(J,F),pct:I.format(X(be(C.files)))})})]}),j&&b?(0,Q.jsx)(Te,{instanceName:b.instanceName,agentId:b.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:a}){let l=y(S.agentFiles.getAgentFile),te=y(S.agentFiles.setAgentFile),ne=F(),[u,re]=(0,K.useState)(null),[ie,p]=(0,K.useState)(!1),[_,T]=(0,K.useState)(``),[oe,M]=(0,K.useState)(!1),[L,R]=(0,K.useState)(!1),[he,z]=(0,K.useState)(!1),[B,V]=(0,K.useState)(!1),H=(0,K.useCallback)(async r=>{p(!1);try{let i=await l({instanceName:e,agentId:t,name:n});re({content:i.content,updatedAtMs:i.updatedAtMs}),r||T(i.content),z(!1)}catch{p(!0)}},[l,e,t,n]);(0,K.useEffect)(()=>{H(!1)},[H]);async function U(){if(u!==null){R(!0),V(!1);try{await te({instanceName:e,agentId:t,name:n,content:_,baseUpdatedAtMs:u.updatedAtMs??void 0}),ne.success(m({name:n})),a(),await H(!1)}catch(e){Ce(e)?z(!0):V(!0)}finally{R(!1)}}}let W=u!==null&&_!==u.content,G=(0,K.useMemo)(()=>u===null?null:Se(u.content,_),[u,_]),J=_.length>q,Y=ee(),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)(_e,{children:[(0,Q.jsx)(ve,{children:d({name:n})}),(0,Q.jsxs)(ge,{children:[s({agent:t,instance:e}),r?null:(0,Q.jsxs)(Q.Fragment,{children:[` · `,c()]})]})]}),ie?(0,Q.jsxs)(`p`,{className:`oc-afiles__error`,role:`alert`,children:[b(),` `,(0,Q.jsx)(N,{variant:`outline`,size:`sm`,onClick:()=>void H(!1),children:ae()})]}):u===null?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:g()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`textarea`,{className:`oc-afiles__source`,value:_,readOnly:!r,spellCheck:!1,onChange:e=>T(e.target.value),"aria-label":d({name:n})}),(0,Q.jsx)(`p`,{className:`oc-afiles__hint`,children:h()}),he?(0,Q.jsxs)(`p`,{className:`oc-afiles__error`,role:`alert`,children:[j(),` `,(0,Q.jsx)(N,{variant:`outline`,size:`sm`,onClick:()=>void H(!0),children:se()})]}):null,B?(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(_.length),max:X.format(q)})}),r?(0,Q.jsx)(N,{size:`sm`,disabled:!W||L||he,onClick:()=>M(!0),children:L?O():o()}):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:v({name:n})}),(0,Q.jsx)(ue,{children:C({agent:t})})]}),G?(0,Q.jsxs)(`div`,{className:`oc-afiles__diff`,children:[(0,Q.jsx)(`p`,{className:`oc-afiles__diff-counts`,children:w({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:E()}),G.sampleAdded.map((e,t)=>(0,Q.jsx)(`code`,{className:`oc-afiles__diff-line is-add`,children:e||` `},t))]}):null,G.sampleRemoved.length>0?(0,Q.jsxs)(`div`,{className:`oc-afiles__diff-block`,children:[(0,Q.jsx)(`span`,{className:`oc-afiles__diff-label`,children:D()}),G.sampleRemoved.map((e,t)=>(0,Q.jsx)(`code`,{className:`oc-afiles__diff-line is-del`,children:e||` `},t))]}):null]}):null,(0,Q.jsxs)(me,{children:[(0,Q.jsx)(ce,{children:f()}),(0,Q.jsx)(fe,{onClick:()=>void U(),children:x()})]})]})})]})})}export{we as AgentFilesTab};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Ap as r,Bp as i,CD as a,Cp as ee,Dp as o,Ep as s,Fp as te,Gp as ne,Hp as re,Ip as c,Jp as l,Kp as u,Lp as d,Mp as f,Np as p,Op as m,Pp as h,Rp as ie,SD as ae,Sp as g,Tp as oe,Up as se,Vp as ce,Wp as le,Yp as _,_p as ue,bp as de,cp as v,dp as fe,fp as pe,gD as y,gp as me,hp as he,jp as ge,kp as b,lp as x,mp as S,pp as C,qp as w,sp as T,up as E,vp as D,wp as O,xp as k,yp as A,zp as j}from"./dist-BzNYkP4V.js";import{A as M,C as N,Mt as P,S as F,X as I,a as L,b as R,j as _e,jt as z,ot as ve,r as ye,x as B,y as V}from"./index-CKlFEsq3.js";import{n as be}from"./TimeRangePicker-CY6cFX3v.js";import{t as xe}from"./FilterBar-CSA8xMkl.js";import{t as Se}from"./DataTableShell-C1ZKbpq3.js";import{t as H}from"./dispatchErrorInfo-DekuLV6o.js";var U=t(e(),1),W=n(),G=`__all__`,Ce=[{value:`open`},{value:`acknowledged`},{value:`resolved`}];function we(e){return e===`open`?_():e===`acknowledged`?l():w()}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=z({from:`/settings/anomalies`}),n=e.q??``,l=e.status===K?G:e.status,_=e.severity??G,v=e.kind??G,[x,w]=(0,U.useState)(G),T=ye(e.from,e.to),{from:E,to:H}=be(T),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,...L(e)})}),Pe=_e(),Z=M(),Q=ae(y.anomalies.resolveAnomaly),Fe=(a(y.me.getMe,{host:ve})?.permissions??[]).includes(`admin.manage`),$=a(y.anomalies.listAnomalies,{limit:Oe,filter:{q:n||void 0,from:E,to:H,anomalyStatus:l===G?void 0:l,severity:_===G?void 0:_,source:x===G?void 0:x,kind:v===G?void 0:v}}),Ie=(0,U.useMemo)(()=>{let e=new Set;for(let t of $??[])e.add(t.kind);return[...e].sort()},[$]),Le=n!==``||l!==`open`||_!==G||x!==G||v!==G||T.kind!==`relative`||T.from!==De.from;function Re(){w(G),t({search:{status:`open`},replace:!0})}async function ze(e){if(await Pe({title:u(),description:(0,W.jsxs)(W.Fragment,{children:[ne(),` `,(0,W.jsx)(`span`,{className:`font-mono`,children:e.kind}),` `,le(),` `,(0,W.jsx)(`strong`,{children:se()}),`.`,` `,re()]}),confirmLabel:ce()}))try{await Q({anomalyId:e._id,status:`resolved`}),Z.success(i(),e.kind)}catch(e){Z.error(j(),e)}}async function Be(e){try{await Q({anomalyId:e._id,status:`acknowledged`}),Z.success(ie(),e.kind)}catch(e){Z.error(d(),e)}}return(0,W.jsxs)(W.Fragment,{children:[(0,W.jsxs)(`p`,{className:`oc-admin__hint`,children:[c(),` `,(0,W.jsx)(`strong`,{children:te()}),` `,h(),` `,(0,W.jsx)(`strong`,{children:p()}),` `,f(),` `,(0,W.jsx)(`strong`,{children:ge()}),` `,r(),` `,(0,W.jsx)(`span`,{className:`oc-filter__window`,children:b()})]}),(0,W.jsxs)(xe,{q:n,onQChange:q,searchPlaceholder:m(),timeRange:T,onTimeRangeChange:X,onReset:Re,canReset:Le,children:[(0,W.jsxs)(V,{value:l,onValueChange:J,children:[(0,W.jsx)(F,{size:`sm`,className:`w-36`,children:(0,W.jsx)(N,{})}),(0,W.jsxs)(R,{children:[(0,W.jsx)(B,{value:G,children:o()}),Ce.map(e=>(0,W.jsx)(B,{value:e.value,children:we(e.value)},e.value))]})]}),(0,W.jsxs)(V,{value:_,onValueChange:Y,children:[(0,W.jsx)(F,{size:`sm`,className:`w-36`,children:(0,W.jsx)(N,{placeholder:s()})}),(0,W.jsxs)(R,{children:[(0,W.jsx)(B,{value:G,children:oe()}),Te.map(e=>(0,W.jsx)(B,{value:e,children:e},e))]})]}),(0,W.jsxs)(V,{value:x,onValueChange:w,children:[(0,W.jsx)(F,{size:`sm`,className:`w-32`,children:(0,W.jsx)(N,{placeholder:O()})}),(0,W.jsxs)(R,{children:[(0,W.jsx)(B,{value:G,children:ee()}),Ee.map(e=>(0,W.jsx)(B,{value:e,children:e},e))]})]}),(0,W.jsxs)(V,{value:v,onValueChange:Ne,children:[(0,W.jsx)(F,{size:`sm`,className:`w-36`,children:(0,W.jsx)(N,{placeholder:g()})}),(0,W.jsxs)(R,{children:[(0,W.jsx)(B,{value:G,children:k()}),Ie.map(e=>(0,W.jsx)(B,{value:e,children:e},e))]})]})]}),(0,W.jsx)(Se,{title:de(),rows:$,emptyHint:l===`open`?A():D(),rowActions:e=>Fe&&e.status===`open`?[{label:ue(),onSelect:()=>void ze(e)},{label:me(),onSelect:()=>void Be(e)}]:[],columns:[{header:he(),cell:e=>(0,W.jsx)(`span`,{className:`oc-traces__time`,children:new Date(e.at).toLocaleString(`fr-FR`)}),sort:e=>e.at},{header:g(),cell:e=>(0,W.jsx)(`code`,{className:`oc-traces__mono`,children:e.kind}),sort:e=>e.kind},{header:s(),cell:e=>(0,W.jsx)(Ae,{severity:e.severity}),sort:e=>e.severity===`critical`?2:+(e.severity===`warn`)},{header:S(),cell:e=>(0,W.jsx)(je,{status:e.status}),sort:e=>e.status===`resolved`?2:+(e.status===`acknowledged`)},{header:O(),cell:e=>(0,W.jsx)(I,{variant:`outline`,children:e.source}),sort:e=>e.source},{header:C(),cell:e=>(0,W.jsx)(`span`,{className:`oc-anomaly__msg`,children:e.message}),sort:e=>e.message},{header:pe(),cell:e=>(0,W.jsx)(ke,{row:e}),sort:e=>e.evidence??null},{header:fe(),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=z();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:[`↗ `,E()]}):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:[`↗ `,E()]}):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)(I,{variant:`destructive`,children:x()}):e===`acknowledged`?(0,W.jsx)(I,{variant:`secondary`,children:v()}):(0,W.jsx)(I,{variant:`outline`,children:T()})}function Me(e){return e.length>8?e.slice(0,8):e}export{q as AnomaliesTab};
|
|
@@ -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{$m as r,Bm as i,CD as a,Gm as o,Hm as s,Jm as c,Km as l,Qm as u,Um as ee,Vm as d,Wm as f,Xm as p,Ym as m,Zm as h,eh as g,gD as _,qm as v}from"./dist-BzNYkP4V.js";import{C as y,Mt as b,S as x,a as S,b as C,i as w,jt as T,o as E,r as D,t as O,x as k,y as A}from"./index-CKlFEsq3.js";import{n as j}from"./TimeRangePicker-CY6cFX3v.js";import{t as M}from"./FilterBar-CSA8xMkl.js";import{t as N}from"./AdvancedFilter-D7QXVQ5_.js";import{t as P}from"./DataTableShell-C1ZKbpq3.js";var F=t(e(),1),I=n(),L={kind:`relative`,from:O,to:`now`},R=`__all__`,z=[{value:`action`,label:`action`},{value:`realLabel`,label:`acteur réel`},{value:`targetLabel`,label:`au nom de`},{value:`impersonated`,label:`usurpation`},{value:`resource`,label:`ressource`},{value:`resourceId`,label:`id ressource`}];function B(){let e=b({from:`/settings/audit`}),t=T({from:`/settings/audit`}),n=e.q??``,O=e.action??R,B=e.impersonated??R,V=e.resource??R,H=D(e.from,e.to),U=(0,F.useMemo)(()=>E(e.adv),[e.adv]),{from:W,to:G}=j(H),K=e=>void t({search:t=>({...t,q:e||void 0}),replace:!0}),q=e=>void t({search:t=>({...t,action:e===R?void 0:e})}),J=e=>void t({search:t=>({...t,impersonated:e===R?void 0:e})}),Y=e=>void t({search:t=>({...t,resource:e===R?void 0:e})}),X=e=>void t({search:t=>({...t,...S(e)})}),Z=e=>void t({search:t=>({...t,adv:w(e)}),replace:!0}),Q=a(_.admin.listAudit,{filter:{q:n||void 0,from:W,to:G,action:O===R?void 0:O,resource:V===R?void 0:V,impersonated:B===R?void 0:B===`yes`,advanced:U.length>0?U:void 0}}),$=(0,F.useMemo)(()=>{let e=new Set;for(let t of Q??[])e.add(t.action);return[...e].sort()},[Q]),te=(0,F.useMemo)(()=>{let e=new Set;for(let t of Q??[])t.resource&&e.add(t.resource);return[...e].sort()},[Q]),ne=n!==``||O!==R||B!==R||V!==R||U.length>0||H.kind!==`relative`||H.from!==L.from;function re(){t({search:{},replace:!0})}return(0,I.jsxs)(I.Fragment,{children:[(0,I.jsxs)(`p`,{className:`oc-admin__hint`,children:[g(),` `,(0,I.jsx)(`span`,{className:`oc-filter__window`,children:r()})]}),(0,I.jsxs)(M,{q:n,onQChange:K,searchPlaceholder:u(),timeRange:H,onTimeRangeChange:X,onReset:re,canReset:ne,children:[(0,I.jsxs)(A,{value:O,onValueChange:q,children:[(0,I.jsx)(x,{size:`sm`,className:`w-40`,children:(0,I.jsx)(y,{placeholder:h()})}),(0,I.jsxs)(C,{children:[(0,I.jsx)(k,{value:R,children:p()}),$.map(e=>(0,I.jsx)(k,{value:e,children:e},e))]})]}),(0,I.jsxs)(A,{value:B,onValueChange:J,children:[(0,I.jsx)(x,{size:`sm`,className:`w-40`,children:(0,I.jsx)(y,{})}),(0,I.jsxs)(C,{children:[(0,I.jsx)(k,{value:R,children:m()}),(0,I.jsx)(k,{value:`yes`,children:c()}),(0,I.jsx)(k,{value:`no`,children:v()})]})]}),(0,I.jsxs)(A,{value:V,onValueChange:Y,children:[(0,I.jsx)(x,{size:`sm`,className:`w-40`,children:(0,I.jsx)(y,{placeholder:l()})}),(0,I.jsxs)(C,{children:[(0,I.jsx)(k,{value:R,children:o()}),te.map(e=>(0,I.jsx)(k,{value:e,children:e},e))]})]})]}),(0,I.jsx)(N,{fields:z,seed:U,onChange:Z}),(0,I.jsx)(P,{title:f(),rows:Q,emptyHint:ee(),columns:[{header:s(),cell:e=>new Date(e.at).toLocaleString(`fr-FR`),sort:e=>e.at},{header:h(),cell:e=>e.action,sort:e=>e.action},{header:d(),cell:e=>e.realLabel,sort:e=>e.realLabel},{header:i(),cell:e=>e.targetLabel??`—`,sort:e=>e.targetLabel??null},{header:l(),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{$l as r,$u as i,Bl as a,Bn as o,CD as s,Cu as c,Eu as l,Gl as u,Gn as d,Hl as f,Hn as p,In as m,Jl as h,Jn as g,Ju as ee,Kl as _,Kn as v,Ql as y,Qu as te,Rl as b,SD as ne,Su as re,Tu as ie,Ul as ae,Un as oe,Vl as se,Vn as ce,Wl as le,Wn as ue,Xl as de,Xn as fe,Yl as pe,Yn as me,Yu as he,Zl as ge,Zn as _e,_D as x,_u as ve,ad as ye,au as be,bD as xe,bu as Se,cd as Ce,cu as we,du as S,ed as Te,eu as Ee,fu as De,gD as C,gu as Oe,hu as ke,id as Ae,iu as je,lu as Me,mu as Ne,nd as Pe,nu as Fe,ou as Ie,pu as Le,ql as Re,qn as ze,rd as Be,ru as Ve,sd as He,su as Ue,td as We,tu as Ge,uu as Ke,vu as qe,wu as Je,xu as Ye,yu as Xe,zl as w}from"./dist-BzNYkP4V.js";import{i as T,r as Ze}from"./dist-AH7-HhdT.js";import{t as Qe}from"./chevrons-up-down-CeISPPN2.js";import{i as $e,n as E,o as et,r as tt,s as nt}from"./FieldLabel-X2EAqICh.js";import{t as D}from"./button-DXGXeanX.js";import{$ as rt,A as it,At as at,C as O,H as ot,Q as st,S as k,St as ct,U as lt,V as ut,X as A,Z as j,_ as dt,_t as ft,b as M,et as pt,jt as mt,kt as N,mt as P,nt as ht,ot as gt,rt as _t,x as F,y as I}from"./index-CKlFEsq3.js";import{a as vt,i as L,n as yt,o as R,r as z,t as bt}from"./table-AFxsandT.js";import{t as xt}from"./FilterBar-CSA8xMkl.js";import{a as B,n as St,o as V,r as H,s as Ct,t as wt}from"./compatView-BKe3swOt.js";import{t as U}from"./dispatchErrorInfo-DekuLV6o.js";var Tt=x(`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`}]]),Et=x(`wifi-off`,[[`path`,{d:`M12 20h.01`,key:`zekei9`}],[`path`,{d:`M8.5 16.429a5 5 0 0 1 7 0`,key:`1bycff`}],[`path`,{d:`M5 12.859a10 10 0 0 1 5.17-2.69`,key:`1dl1wf`}],[`path`,{d:`M19 12.859a10 10 0 0 0-2.007-1.523`,key:`4k23kn`}],[`path`,{d:`M2 8.82a15 15 0 0 1 4.177-2.643`,key:`1grhjp`}],[`path`,{d:`M22 8.82a15 15 0 0 0-11.288-3.764`,key:`z3jwby`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}]]),W=t(e(),1);function G(e){return e.filter(e=>e.state===`error`)}function Dt(e){return e.reachable&&G(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__`,J={q:``,state:q,instance:q,version:q},Y={connected:0,error:1,idle:2};function Nt(e){return e.q.trim()!==``||e.state!==`__all__`||e.instance!==`__all__`||e.version!==`__all__`}function Pt(e,t){let n=t.q.trim().toLowerCase();return e.filter(e=>!(n&&!`${e.targetLabel} ${e.gatewayHost}`.toLowerCase().includes(n)||t.state!==`__all__`&&e.state!==t.state||t.instance!==`__all__`&&(e.instanceName??``)!==t.instance||t.version!==`__all__`&&(e.gatewayVersion??``)!==t.version))}function X(e,t){return e.localeCompare(t,void 0,{numeric:!0,sensitivity:`base`})}function Ft(e,t){return e===`version`?t.gatewayVersion===null:e===`lastOk`?t.lastOkAt===null:!1}function It(e,t,n){switch(e){case`state`:return(Y[t.state]??99)-(Y[n.state]??99);case`instance`:return X(t.instanceLabel??t.instanceName??``,n.instanceLabel??n.instanceName??``);case`host`:return X(t.gatewayHost,n.gatewayHost);case`version`:{let e=t.gatewayVersion,r=n.gatewayVersion;return V(e,r)??X(e,r)}case`lastOk`:return t.lastOkAt-n.lastOkAt;default:return X(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=Ft(t.key,e),a=Ft(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)=>(Y[e]??99)-(Y[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)=>X(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)=>V(e,t)??X(e,t))}var Z=n();function Vt({connections:e,displayByInstance:t}){let[n,i]=(0,W.useState)(J),[a,o]=(0,W.useState)(null),s=(0,W.useMemo)(()=>e.map((e,n)=>({_id:`${e.key}:${e.canonical}/${e.agentId}:${n}`,targetLabel:`${e.canonical}/${e.agentId}`,state:e.state,instanceName:e.instanceName??null,instanceLabel:e.instanceName?t.get(e.instanceName)??e.instanceName:null,gatewayHost:e.gatewayHost,gatewayVersion:e.gatewayVersion??null,okCount:e.okCount,errorCount:e.errorCount,attempts:e.attempts,lastOkAt:e.lastOkAt??null,lastErrorCode:e.lastErrorCode??null,lastErrorAt:e.lastErrorAt??null,lastDownstreamRejectCode:e.lastDownstreamRejectCode??null,lastDownstreamRejectAt:e.lastDownstreamRejectAt??null})),[e,t]),c=(0,W.useMemo)(()=>Rt(s),[s]),l=(0,W.useMemo)(()=>zt(s),[s]),d=(0,W.useMemo)(()=>Bt(s),[s]),p=(0,W.useMemo)(()=>Lt(Pt(s,n),a),[s,n,a]);function m(e){o(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:Fe()}):(0,Z.jsxs)(`div`,{className:`oc-conn`,children:[(0,Z.jsxs)(xt,{q:n.q,onQChange:e=>i(t=>({...t,q:e})),searchPlaceholder:r(),onReset:()=>i(J),canReset:Nt(n),children:[(0,Z.jsxs)(I,{value:n.state,onValueChange:e=>i(t=>({...t,state:e})),children:[(0,Z.jsx)(k,{size:`sm`,className:`w-36`,children:(0,Z.jsx)(O,{placeholder:ge()})}),(0,Z.jsxs)(M,{children:[(0,Z.jsx)(F,{value:q,children:y()}),c.map(e=>(0,Z.jsx)(F,{value:e,children:Ut(e)},e))]})]}),(0,Z.jsxs)(I,{value:n.instance,onValueChange:e=>i(t=>({...t,instance:e})),children:[(0,Z.jsx)(k,{size:`sm`,className:`w-40`,children:(0,Z.jsx)(O,{placeholder:de()})}),(0,Z.jsxs)(M,{children:[(0,Z.jsx)(F,{value:q,children:y()}),l.map(e=>(0,Z.jsx)(F,{value:e.name,children:e.label},e.name))]})]}),(0,Z.jsxs)(I,{value:n.version,onValueChange:e=>i(t=>({...t,version:e})),children:[(0,Z.jsx)(k,{size:`sm`,className:`w-36`,children:(0,Z.jsx)(O,{placeholder:pe()})}),(0,Z.jsxs)(M,{children:[(0,Z.jsx)(F,{value:q,children:y()}),d.map(e=>(0,Z.jsx)(F,{value:e,children:e},e))]})]})]}),p.length===0?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:h()}):(0,Z.jsxs)(bt,{className:`oc-conn__table`,children:[(0,Z.jsx)(vt,{children:(0,Z.jsxs)(R,{children:[(0,Z.jsx)(Q,{label:Re(),sortKey:`target`,sort:a,onSort:m}),(0,Z.jsx)(Q,{label:_(),sortKey:`state`,sort:a,onSort:m}),(0,Z.jsx)(Q,{label:u(),sortKey:`instance`,sort:a,onSort:m}),(0,Z.jsx)(Q,{label:le(),sortKey:`host`,sort:a,onSort:m}),(0,Z.jsx)(Q,{label:ae(),sortKey:`version`,sort:a,onSort:m}),(0,Z.jsx)(L,{children:f()}),(0,Z.jsx)(Q,{label:se(),sortKey:`lastOk`,sort:a,onSort:m})]})}),(0,Z.jsx)(yt,{children:p.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)(L,{"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)(Ze,{size:13,"aria-hidden":!0}):(0,Z.jsx)(T,{size:13,"aria-hidden":!0}):(0,Z.jsx)(Qe,{size:13,"aria-hidden":!0,className:`oc-conn__sort-idle`})]})})}function Ht({r:e}){let t=Ot(e)?U(e.lastErrorCode):null,n=kt(e)?U(e.lastDownstreamRejectCode):null;return(0,Z.jsxs)(W.Fragment,{children:[(0,Z.jsxs)(R,{className:`oc-conn__row oc-conn__row--${e.state}`,children:[(0,Z.jsx)(z,{children:(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:e.targetLabel})}),(0,Z.jsx)(z,{children:(0,Z.jsx)(Wt,{state:e.state})}),(0,Z.jsx)(z,{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)(z,{children:(0,Z.jsx)(`span`,{className:`oc-bridge-target__host`,children:e.gatewayHost})}),(0,Z.jsx)(z,{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)(z,{children:(0,Z.jsx)(`span`,{className:`oc-conn__stats`,children:Ge({ok:e.okCount,errors:e.errorCount,attempts:e.attempts})})}),(0,Z.jsx)(z,{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)(R,{className:`oc-conn__detail-row`,children:(0,Z.jsxs)(z,{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:[Ee({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`?a():e===`error`?w():b()}function Wt({state:e}){return e===`connected`?(0,Z.jsx)(A,{variant:`secondary`,children:a()}):e===`error`?(0,Z.jsx)(A,{variant:`destructive`,children:w()}):(0,Z.jsx)(A,{variant:`outline`,children:b()})}function Gt(){return s(C.bridgeHealth.getBridgeHealth,{})}function Kt(){let e=Gt(),t=s(C.compat.getBridgeCompat,{}),n=s(C.me.getMe,{host:gt})?.role===`admin`,r=s(C.admin.listInstances,n?{}:`skip`),i=mt(),a=()=>void i({to:`/settings/anomalies`,search:{status:`open`}}),o=jt(e?e.targets:[],t?t.targets:[],r??[]),c=t?.compat??null,l=t===void 0?`loading`:t===null?`nodata`:`ready`,u=c!==null&&St(c,`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:De()}),o.map(e=>(0,Z.jsx)(Jt,{providerKey:e.key,connections:e.connections,instances:e.instances,manifest:c,compatStatus:l,compatReachable:t?.reachable??!0},e.key)),u?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:m()}):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:B(t.bridgeVersion)}),` · `,me(),` `,(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:t.protocolVersion===null?g():String(t.protocolVersion)})]}):null;if(e===void 0)return(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:S()});if(e===null)return(0,Z.jsx)(`div`,{className:`oc-bridge-card oc-bridge-card--idle`,children:Ke()});let i=G(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)(N,{size:22}):a?(0,Z.jsx)(Et,{size:22}):(0,Z.jsx)(P,{size:22})}),(0,Z.jsxs)(`div`,{className:`oc-bridge-card__body`,children:[(0,Z.jsx)(`div`,{className:`oc-bridge-card__title`,children:o?Me():a?we():Ue({count:i.length})}),(0,Z.jsxs)(`div`,{className:`oc-bridge-card__meta`,children:[(0,Z.jsxs)(`span`,{children:[(0,Z.jsx)(Tt,{size:12,"aria-hidden":!0}),` `,Ie({time:c})]}),l?(0,Z.jsx)(`span`,{children:be({time:l})}):null,r]}),a?(0,Z.jsx)(`p`,{className:`oc-bridge-card__hint`,children:U(e.lastError===`not_configured`?`NOT_CONFIGURED`:`BRIDGE_UNREACHABLE`).hint}):null]}),(0,Z.jsx)(`button`,{type:`button`,className:`oc-bridgebar__drill`,onClick:n,children:je()})]})}function Jt({providerKey:e,connections:t,instances:n,manifest:r,compatStatus:i,compatReachable:a}){let o=r?Ct(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:wt(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,W.useState)(!1);return(0,Z.jsxs)(`section`,{className:`oc-bridge-provider`,children:[(0,Z.jsxs)(`header`,{className:`oc-bridge-provider__head`,children:[(0,Z.jsx)(ft,{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)(A,{variant:d===`beyond`?`destructive`:`secondary`,children:H(d)}):null]}),(0,Z.jsx)(`h4`,{className:`oc-bridge-provider__sub`,children:_e()}),(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)(T,{size:13,"aria-hidden":!0}):(0,Z.jsx)(at,{size:13,"aria-hidden":!0}),Ve({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:S()}):t===`nodata`?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:fe()}):(0,Z.jsxs)(`div`,{className:`oc-compat`,children:[n?null:(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:ze()}),r===null?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:v()}):(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:g()}),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:B(e.version)}),(0,Z.jsx)(A,{variant:e.state===`supported`?`secondary`:e.state===`beyond`?`destructive`:`outline`,children:H(e.state)})]},e.instanceName))})]})}function Xt({instance:e,onClose:t}){return(0,Z.jsx)(st,{open:!0,onOpenChange:e=>!e&&t(),children:(0,Z.jsxs)(rt,{className:`oc-bridge-config-dialog`,onOpenAutoFocus:e=>e.preventDefault(),children:[(0,Z.jsxs)(ht,{children:[(0,Z.jsx)(_t,{children:Ce({instance:e.displayName??e.name})}),(0,Z.jsx)(pt,{children:He()})]}),(0,Z.jsx)(Zt,{instance:e,onClose:t})]})})}function $({label:e,result:t}){return t?t.checked?(0,Z.jsxs)(`p`,{className:`oc-bridge-config__check-row `+(t.ok?`oc-bridge-config__check-row--ok`:`oc-bridge-config__check-row--err`),children:[t.ok?(0,Z.jsx)(N,{"aria-hidden":!0}):(0,Z.jsx)(P,{"aria-hidden":!0}),(0,Z.jsxs)(`span`,{children:[e,` — `,t.ok?Oe():t.detail]})]}):(0,Z.jsxs)(`p`,{className:`oc-bridge-config__check-row oc-bridge-config__check-row--skip`,children:[e,` — `,ke()]}):null}function Zt({instance:e,onClose:t}){let n=ne(C.admin.upsertInstanceConfig),r=xe(C.bridge.validateMediaPaths),a=it(),[o,s]=(0,W.useState)(()=>$e(e.config??{})),[u,d]=(0,W.useState)(!1),[f,p]=(0,W.useState)(!1),[m,h]=(0,W.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(Se(),e)}finally{p(!1)}}async function b(){d(!0);try{let r=e.config??{};await n({instanceId:e._id,config:tt(o,r)}),t()}catch(e){a.error(Te(),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)(E,{label:ye(),help:i()}),(0,Z.jsxs)(I,{value:o.mediaMode,onValueChange:e=>s({...o,mediaMode:e}),children:[(0,Z.jsx)(k,{size:`sm`,className:`w-full`,children:(0,Z.jsx)(O,{})}),(0,Z.jsx)(M,{children:nt.map(e=>(0,Z.jsx)(F,{value:e,children:e},e))})]})]}),(0,Z.jsxs)(`label`,{className:`oc-field`,children:[(0,Z.jsx)(E,{label:Ae(),help:te()}),(0,Z.jsxs)(I,{value:o.inboundMediaMode,onValueChange:e=>s({...o,inboundMediaMode:e}),children:[(0,Z.jsx)(k,{size:`sm`,className:`w-full`,children:(0,Z.jsx)(O,{})}),(0,Z.jsx)(M,{children:et.map(e=>(0,Z.jsx)(F,{value:e,children:e},e))})]})]}),(0,Z.jsxs)(`label`,{className:`oc-field`,children:[(0,Z.jsx)(E,{label:Be(),help:he()}),(0,Z.jsx)(j,{type:`number`,min:1,max:4096,className:`w-full`,value:o.mediaMaxMb,onChange:e=>s({...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)(E,{label:l(),help:ie()}),(0,Z.jsx)(j,{className:`w-full`,spellCheck:!1,value:o.inboundAgentMount,onChange:e=>s({...o,inboundAgentMount:e.target.value})})]}),_&&(0,Z.jsxs)(`label`,{className:`oc-field`,children:[(0,Z.jsx)(E,{label:Je(),help:c()}),(0,Z.jsx)(j,{className:`w-full`,spellCheck:!1,value:o.outboundAgentMount,onChange:e=>s({...o,outboundAgentMount:e.target.value})})]})]}),(0,Z.jsxs)(`label`,{className:`oc-field--row`,children:[(0,Z.jsx)(dt,{checked:o.rehydration,onCheckedChange:e=>s({...o,rehydration:e===!0})}),(0,Z.jsx)(E,{label:Pe(),help:ee()})]}),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)(P,{"aria-hidden":!0}),Le({reason:m.reason??`?`})]}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)($,{label:qe(),result:m.inbound}),(0,Z.jsx)($,{label:ve(),result:m.outbound}),(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:Xe()})]}):(0,Z.jsxs)(`p`,{className:`oc-bridge-config__check-row oc-bridge-config__check-row--err`,children:[(0,Z.jsx)(P,{"aria-hidden":!0}),Ne()]})}),(0,Z.jsxs)(`div`,{className:`oc-bridge-config__actions`,children:[v&&(0,Z.jsxs)(D,{variant:`outline`,size:`sm`,onClick:()=>void y(),disabled:f,children:[f?(0,Z.jsx)(ct,{className:`size-4 animate-spin`,"aria-hidden":!0}):null,f?Ye():re()]}),(0,Z.jsx)(D,{size:`sm`,onClick:()=>void b(),disabled:u,children:We()})]})]})})}function Qt({versions:e}){if(e.length===0)return null;let t=[...e].reverse();return(0,Z.jsxs)(ut,{children:[(0,Z.jsx)(lt,{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)(T,{size:13,"aria-hidden":!0})]})}),(0,Z.jsxs)(ot,{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)(A,{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{$n as r,Br as i,CD as a,Px as o,Qn as s,Si as ee,UE as c,_i as te,ar as ne,bD as l,cr as re,er as ie,gD as u,ir as ae,lr as d,nr as f,od as oe,or as p,rr as m,sr as h,tr as g,ur as se,vi as ce,wi as le}from"./dist-BzNYkP4V.js";import{t as _}from"./button-DXGXeanX.js";import{A as ue,B as de,C as fe,F as pe,I as me,L as he,N as v,P as y,R as b,S as x,b as S,g as C,h as w,mt as T,v as E,x as D,y as O,z as k}from"./index-CKlFEsq3.js";import{i as A}from"./compatView-BKe3swOt.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=l(u.agentFiles.getChatDefaults),t=l(u.agentFiles.setChatDefaults),n=ue(),[F,I]=(0,j.useState)({status:`loading`}),[L,R]=(0,j.useState)({thinkingDefault:null,fastModeDefault:null}),[ge,z]=(0,j.useState)(!1),[B,V]=(0,j.useState)(!1),H=a(u.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=a(u.compat.forInstance,U?{instanceName:U}:`skip`),K=U?E(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(m()),await X()}catch(e){n.error(f(),e)}finally{V(!1)}}let xe=(0,j.useMemo)(()=>M.map(e=>({id:e,label:C(e)})),[]),Se=(0,j.useMemo)(()=>[{id:`fast`,label:ce()},{id:`standard`,label:te()}],[]);return(0,P.jsxs)(`div`,{className:`oc-cdefaults`,children:[(0,P.jsx)(`p`,{className:`oc-admin__hint`,children:se()}),G&&U?(0,P.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,P.jsx)(`span`,{className:`oc-cdefaults__label`,children:i()}),(0,P.jsxs)(O,{value:U,onValueChange:e=>W(e),disabled:B,children:[(0,P.jsx)(x,{size:`sm`,"aria-label":i(),children:(0,P.jsx)(fe,{})}),(0,P.jsx)(S,{children:(H??[]).map(e=>(0,P.jsx)(D,{value:e.name,children:e.name},e.name))})]})]}):null,_e?(0,P.jsx)(`p`,{className:`oc-admin__hint`,role:`status`,children:oe()}):K===`loading`?(0,P.jsx)(`p`,{className:`oc-admin__hint`,children:c()}):K.blocked?(0,P.jsxs)(`p`,{className:`oc-compat__blocked`,role:`status`,children:[(0,P.jsx)(T,{size:14,"aria-hidden":!0}),` `,A(K.gatewayVersion)]}):F.status===`loading`?(0,P.jsx)(`p`,{className:`oc-admin__hint`,children:c()}):F.status===`error`?(0,P.jsxs)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:[ne(),` `,(0,P.jsx)(_,{variant:`outline`,size:`sm`,onClick:()=>void X(),children:ee()})]}):(0,P.jsxs)(P.Fragment,{children:[(0,P.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,P.jsx)(`span`,{className:`oc-cdefaults__label`,children:d()}),(0,P.jsx)(w,{options:xe,value:L.thinkingDefault,onChange:e=>R({...L,thinkingDefault:e}),disabled:B}),(0,P.jsx)(`p`,{className:`oc-cdefaults__help`,children:re()})]}),(0,P.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,P.jsx)(`span`,{className:`oc-cdefaults__label`,children:h()}),(0,P.jsx)(w,{options:Se,value:L.fastModeDefault===null?null:L.fastModeDefault?`fast`:`standard`,onChange:e=>R({...L,fastModeDefault:e===`fast`}),disabled:B}),(0,P.jsx)(`p`,{className:`oc-cdefaults__help`,children:p()})]}),(0,P.jsx)(`div`,{className:`oc-cdefaults__actions`,children:(0,P.jsx)(_,{size:`sm`,disabled:!ye||B,onClick:()=>z(!0),children:B?le():ae()})}),(0,P.jsx)(`p`,{className:`oc-cdefaults__note`,children:g()})]}),(0,P.jsx)(v,{open:ge,onOpenChange:z,children:(0,P.jsxs)(me,{children:[(0,P.jsxs)(k,{children:[(0,P.jsx)(de,{children:ie()}),(0,P.jsx)(he,{children:r()})]}),(0,P.jsxs)(b,{children:[(0,P.jsx)(pe,{children:o()}),(0,P.jsx)(y,{onClick:()=>void be(),children:s()})]})]})})]})}export{F as ChatDefaultsTab};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Cs as r,Ds as i,Es as a,
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Cs as r,Ds as i,Es as a,Os as o,Ts as s,ks as c,ws as l}from"./dist-BzNYkP4V.js";import{i as u,r as d}from"./dist-AH7-HhdT.js";import{t as f}from"./chevrons-up-down-CeISPPN2.js";import{t as p}from"./button-DXGXeanX.js";import{G as m,J as h,K as g,Tt as _,W as v,Y as y,_ as b,bt as x,ht as S}from"./index-CKlFEsq3.js";import{a as C,i as w,n as T,o as E,r as D,t as O}from"./table-AFxsandT.js";var k=t(e(),1);function A(e,t){return typeof e==`number`&&typeof t==`number`?e-t:typeof e==`boolean`&&typeof t==`boolean`?!!e-+!!t:String(e).localeCompare(String(t),void 0,{numeric:!0,sensitivity:`base`})}function j(e,t,n){return[...e].sort((e,r)=>{let i=t(e),a=t(r),o=i==null,s=a==null;if(o||s)return o&&s?0:o?1:-1;let c=A(i,a);return n===`asc`?c:-c})}var M=n();function N({title:e,rows:t,columns:n,rowActions:A,onAdd:N,addLabel:P=c(),bulkActions:F,emptyHint:I=o(),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)(S,{}):null,e.label,` (`,z.size,`)`]},e.label)):null,N?(0,M.jsxs)(p,{size:`sm`,onClick:N,children:[(0,M.jsx)(x,{}),` `,P]}):null]})]}),t===void 0?(0,M.jsx)(`p`,{className:`oc-admin__hint`,children:i()}):U.length===0?(0,M.jsx)(`p`,{className:`oc-admin__hint`,children:I}):(0,M.jsxs)(O,{children:[(0,M.jsx)(C,{children:(0,M.jsxs)(E,{children:[F?(0,M.jsx)(w,{className:`w-8`,children:(0,M.jsx)(b,{"aria-label":a(),checked:J?!0:Y?`indeterminate`:!1,onCheckedChange:X})}):null,n.map((e,t)=>{let n=V?.index===t;return e.sort?(0,M.jsx)(w,{className:e.className,"aria-sort":n?V.dir===`asc`?`ascending`:`descending`:`none`,children:(0,M.jsxs)(`button`,{type:`button`,className:`oc-dt__sort`,onClick:()=>K(t),"aria-label":r({column:e.header}),children:[e.header,n?V.dir===`asc`?(0,M.jsx)(d,{className:`oc-dt__sort-icon`,"aria-hidden":!0}):(0,M.jsx)(u,{className:`oc-dt__sort-icon`,"aria-hidden":!0}):(0,M.jsx)(f,{className:`oc-dt__sort-icon oc-dt__sort-icon--idle`,"aria-hidden":!0})]})},e.header):(0,M.jsx)(w,{className:e.className,children:e.header},e.header)}),A?(0,M.jsx)(w,{className:`w-8`}):null]})}),(0,M.jsx)(T,{children:G.map(e=>{let t=A?.(e)??[],r=L?.(e)??!1;return(0,M.jsxs)(k.Fragment,{children:[(0,M.jsxs)(E,{className:`group/row`,children:[F?(0,M.jsx)(D,{children:(0,M.jsx)(b,{"aria-label":s(),checked:z.has(e._id),onCheckedChange:()=>Z(e._id)})}):null,n.map(t=>(0,M.jsx)(D,{className:t.className,children:t.cell(e)},t.header)),A?(0,M.jsx)(D,{children:t.length>0?(0,M.jsxs)(v,{children:[(0,M.jsx)(y,{asChild:!0,children:(0,M.jsx)(p,{variant:`ghost`,size:`icon-sm`,"aria-label":l(),className:`opacity-0 transition-opacity group-hover/row:opacity-100 group-focus-within/row:opacity-100 aria-expanded:opacity-100`,children:(0,M.jsx)(_,{})})}),(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]}),r&&R?(0,M.jsx)(E,{className:`oc-dt__expansion`,children:(0,M.jsx)(D,{colSpan:q,className:`oc-dt__expansion-cell`,children:R(e)})}):null]},e._id)})})]})]})}export{N as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./bundle-mjs-C73ZY4La.js";import{X as t}from"./index-
|
|
1
|
+
import{r as e}from"./bundle-mjs-C73ZY4La.js";import{X as t}from"./index-CKlFEsq3.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{$_ as r,A_ as i,B_ as a,CD as o,C_ as s,D_ as c,E_ as l,F_ as u,G_ as d,H_ as f,I_ as p,J_ as m,K_ as h,L_ as g,M_ as _,N_ as v,O_ as ee,P_ as y,Q_ as b,R_ as te,SD as x,S_ as ne,T_ as re,U_ as ie,V_ as S,W_ as C,X_ as w,Y_ as T,Z_ as E,__ as D,av as O,b_ as k,cv as A,dv as j,ev as M,fv as N,gD as P,g_ as F,gv as I,h_ as L,hv as R,iv as z,j_ as B,k_ as V,lv as ae,mv as H,nv as U,ov as W,pv as G,q_ as K,rv as q,sv as J,tv as oe,uv as se,v_ as ce,w_ as le,x_ as ue,y_ as de,z_ as fe}from"./dist-BzNYkP4V.js";import{t as pe}from"./button-DXGXeanX.js";import{j as me}from"./index-CKlFEsq3.js";import{t as he}from"./DataTableShell-C1ZKbpq3.js";var Y=t(e(),1),X=n(),Z={altered_words:()=>I(),incorrect:()=>R(),incoherence:()=>H(),formatting:()=>G(),latency:()=>N(),api_error:()=>j(),other:()=>se()},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:A()}):e===!1?(0,X.jsx)(`span`,{className:`oc-fbadmin__pill is-warn`,children:J()}):(0,X.jsx)(`span`,{className:`oc-fbadmin__pill`,children:`—`}):(0,X.jsx)(`span`,{className:`oc-fbadmin__pill`,children:ae()})}function ge({data:e,closeReason:t}){let n=e.snapshot,i=x(P.feedback.respondToFeedback),[o,s]=(0,Y.useState)(e.thread),[c,l]=(0,Y.useState)(``),[u,p]=(0,Y.useState)(!1);async function g(){let t=c.trim();if(!(!t||u)){p(!0);try{await i({feedbackId:e._id,text:t}),s(e=>[...e,{authorRole:`admin`,text:t,at:Date.now()}]),l(``)}finally{p(!1)}}}let _=[];try{_=n.contextJson?JSON.parse(n.contextJson):[]}catch{_=[]}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?` · ${W()}`:``,n.openclawModel?` · ${n.openclawModel}`:``,n.openclawRuntime?` (${n.openclawRuntime})`:``]})]}),e.comment?(0,X.jsxs)(`section`,{children:[(0,X.jsx)(`h4`,{className:`oc-fbadmin__h`,children:O()}),(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:ue()}),(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:z()}),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`?q():U()}),(0,X.jsx)(`span`,{className:`oc-notif__msg-text`,children:e.text})]},t))}):(0,X.jsx)(`p`,{className:`oc-fbadmin__meta`,children:oe()}),(0,X.jsx)(`textarea`,{className:`oc-feedback__textarea`,placeholder:M(),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 g(),disabled:!c.trim()||u,children:u?r():b()})})]}),(0,X.jsxs)(`section`,{children:[(0,X.jsx)(`h4`,{className:`oc-fbadmin__h`,children:E()}),(0,X.jsx)(`pre`,{className:`oc-msg__source-pre`,children:n.messageText||w()})]}),n.clientInfo?.sourceWasOpen&&n.displayedText!==void 0?(0,X.jsxs)(`section`,{children:[(0,X.jsx)(`h4`,{className:`oc-fbadmin__h`,children:T()}),(0,X.jsx)(`pre`,{className:`oc-msg__source-pre`,children:n.displayedText||w()})]}):null,n.promptText?(0,X.jsxs)(`section`,{children:[(0,X.jsx)(`h4`,{className:`oc-fbadmin__h`,children:m()}),(0,X.jsx)(`pre`,{className:`oc-msg__source-pre`,children:n.promptText})]}):null,_.length>0?(0,X.jsxs)(`section`,{children:[(0,X.jsx)(`h4`,{className:`oc-fbadmin__h`,children:K({count:n.contextCount??_.length,truncated:n.contextTruncated?h():``})}),(0,X.jsx)(`div`,{className:`oc-fbadmin__ctx`,children:_.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:d()}),(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:C()}),(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:ie()}),(0,X.jsxs)(`p`,{className:`oc-fbadmin__env`,children:[[n.clientInfo?.language,n.clientInfo?.timezone,n.clientInfo?.theme?f({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:[S(),` `,n.clientInfo.plugins.join(`, `),(0,X.jsxs)(`span`,{className:`oc-fbadmin__note`,children:[` `,a()]})]}):null,n.clientInfo?.userAgent?(0,X.jsx)(`span`,{className:`oc-fbadmin__ua`,children:n.clientInfo.userAgent}):null]})]})]})}function _e(){let e=o(P.feedback.listForAdmin,{}),t=x(P.feedback.readSnapshot),n=x(P.feedback.deleteFeedback),r=me(),[a,d]=(0,Y.useState)(null),[f,m]=(0,Y.useState)({});async function h(e){if(a===e._id){d(null);return}if(!f[e._id]){let n=await t({feedbackId:e._id});m(t=>({...t,[e._id]:n}))}d(e._id)}async function b(e){await r({title:D(),description:F(),confirmLabel:L(),destructive:!0})&&(await n({feedbackId:e._id}),a===e._id&&d(null))}return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`p`,{className:`oc-admin__hint`,children:[fe(),` `,(0,X.jsx)(`strong`,{children:te()}),` `,g()]}),(0,X.jsx)(he,{title:p(),rows:e,emptyHint:u(),isExpanded:e=>a===e._id&&!!f[e._id],renderExpanded:e=>f[e._id]?(0,X.jsx)(ge,{data:f[e._id],closeReason:e.userCloseReason}):null,columns:[{header:y(),cell:e=>new Date(e.at).toLocaleString(`fr-FR`),sort:e=>e.at},{header:v(),cell:e=>Q(e.category),sort:e=>Q(e.category)},{header:_(),cell:e=>e.messageRole===`user`?B():i(),sort:e=>e.messageRole},{header:V(),cell:e=>(e.reporterEmail||e.reporterName||`—`)+(e.impersonated&&e.realOperatorEmail?` ${ee({operator:e.realOperatorEmail})}`:``),sort:e=>e.reporterEmail||e.reporterName||null},{header:c(),cell:e=>(0,X.jsx)($,{matches:e.displayedMatchesStored,sourceWasOpen:e.sourceWasOpen}),sort:e=>e.displayedMatchesStored===!1?0:e.displayedMatchesStored===!0?1:2},{header:l(),cell:e=>e.hasComment?`✎`:`—`,sort:e=>+!!e.hasComment},{header:re(),cell:e=>e.userClosedAt==null?e.answered?(0,X.jsx)(`span`,{className:`oc-fbadmin__pill is-ok`,children:le()}):(0,X.jsx)(`span`,{className:`oc-fbadmin__pill`,children:s()}):(0,X.jsx)(`span`,{className:`oc-fbadmin__pill is-closed`,children:ne()}),sort:e=>e.userClosedAt==null?+!!e.answered:2}],rowActions:e=>[{label:a===e._id?k():de(),onSelect:()=>void h(e)},{label:ce(),onSelect:()=>void b(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{AD as t,_D as n}from"./dist-BzNYkP4V.js";import{c as r,l as i,s as a,u as o}from"./index-CKlFEsq3.js";var s=n(`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`;t.object({mediaMode:t.optional(t.union(t.literal(`gateway-http`),t.literal(`shared-fs`),t.literal(`off`))),inboundMediaMode:t.optional(t.union(t.literal(`inline`),t.literal(`shared-fs`))),rehydration:t.optional(t.boolean()),mediaMaxMb:t.optional(t.number()),inboundAgentMount:t.optional(t.string()),outboundAgentMount:t.optional(t.string()),promptInjections:t.optional(t.record(t.string(),t.object({enabled:t.optional(t.boolean()),template:t.optional(t.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{$T as ee,BT as te,CD as ne,GE as re,GT as ie,HT as ae,JT as r,KT as oe,Px as i,QT as a,SD as o,UE as s,UT as c,VT as l,WT as u,XT as d,YT as se,ZT as ce,_E as f,aE as p,bE as le,cE as m,dE as ue,eE as de,fE as fe,gD as h,gE as pe,hE as me,iE as g,lE as _,mE as he,nE as ge,oE as v,pE as _e,qT as y,rE as b,sE as x,tE as S,uE as C,vE as w,xE as T,yE as E}from"./dist-BzNYkP4V.js";import{t as D}from"./button-DXGXeanX.js";import{A as O,B as k,C as A,Et as j,F as M,G as N,I as P,K as F,L as I,N as ve,P as ye,R as be,S as L,Tt as xe,W as Se,X as Ce,Y as we,b as R,ht as Te,x as z,y as B,yt as Ee,z as De}from"./index-CKlFEsq3.js";import{a as Oe,i as V,n as ke,o as H,r as U,t as Ae}from"./table-AFxsandT.js";var W=t(e(),1),G=n(),K=`all`;function q(e){switch(e){case`image`:return C();case`audio`:return _();case`video`:return m();case`pdf`:return x();case`document`:return v();case`archive`:return p();default:return g()}}function J(){let[e,t]=(0,W.useState)(K),[n,p]=(0,W.useState)(K),[m,g]=(0,W.useState)(K),[_,v]=(0,W.useState)(K),[x,C]=(0,W.useState)(null),J=o(h.files.softDelete),Y=O();function je(){t(K),p(K),g(K),v(K)}async function Me(){let e=x;if(C(null),e)try{await J({fileId:e.id}),Y.success(y())}catch(e){Y.error(oe(),e)}}let X=ne(h.files.listMine,{direction:e===K?void 0:e,chatId:n===K?void 0:n,instanceName:m===K?void 0:m,category:_===K?void 0:_}),Ne=(0,W.useMemo)(()=>new Intl.DateTimeFormat(re(),{dateStyle:`medium`,timeStyle:`short`}),[]);if(X===void 0)return(0,G.jsx)(`p`,{className:`oc-admin__hint`,children:s()});let{files:Z,facets:Q,truncated:Pe,cap:Fe}=X,$=e!==K||n!==K||m!==K||_!==K;return(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`p`,{className:`oc-admin__hint`,children:T()}),(0,G.jsxs)(`div`,{className:`oc-files__filters`,style:{display:`flex`,flexWrap:`wrap`,gap:8,margin:`12px 0`},children:[(0,G.jsxs)(B,{value:e,onValueChange:t,children:[(0,G.jsx)(L,{size:`sm`,"aria-label":le(),children:(0,G.jsx)(A,{})}),(0,G.jsxs)(R,{children:[(0,G.jsx)(z,{value:K,children:E()}),(0,G.jsx)(z,{value:`inbound`,children:w()}),(0,G.jsx)(z,{value:`outbound`,children:f()})]})]}),(0,G.jsxs)(B,{value:n,onValueChange:p,children:[(0,G.jsx)(L,{size:`sm`,"aria-label":pe(),children:(0,G.jsx)(A,{})}),(0,G.jsxs)(R,{children:[(0,G.jsx)(z,{value:K,children:me()}),Q.chats.map(e=>(0,G.jsx)(z,{value:e.id,children:e.title},e.id))]})]}),Q.multiProvider?(0,G.jsxs)(B,{value:m,onValueChange:g,children:[(0,G.jsx)(L,{size:`sm`,"aria-label":he(),children:(0,G.jsx)(A,{})}),(0,G.jsxs)(R,{children:[(0,G.jsx)(z,{value:K,children:_e()}),Q.instances.map(e=>(0,G.jsx)(z,{value:e,children:e},e))]})]}):null,(0,G.jsxs)(B,{value:_,onValueChange:v,children:[(0,G.jsx)(L,{size:`sm`,"aria-label":fe(),children:(0,G.jsx)(A,{})}),(0,G.jsxs)(R,{children:[(0,G.jsx)(z,{value:K,children:ue()}),Q.categories.map(e=>(0,G.jsx)(z,{value:e,children:q(e)},e))]})]}),$?(0,G.jsxs)(D,{variant:`ghost`,size:`sm`,onClick:je,style:{display:`inline-flex`,alignItems:`center`,gap:4,marginLeft:`auto`},children:[(0,G.jsx)(Ee,{size:14,"aria-hidden":!0}),d()]}):null]}),Z.length===0?(0,G.jsx)(`p`,{className:`oc-admin__hint`,children:$?l():ae()}):(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(Ae,{children:[(0,G.jsx)(Oe,{children:(0,G.jsxs)(H,{children:[(0,G.jsx)(V,{children:b()}),(0,G.jsx)(V,{children:ge()}),(0,G.jsx)(V,{children:S()}),(0,G.jsx)(V,{children:de()}),(0,G.jsx)(V,{children:ee()}),(0,G.jsx)(V,{className:`text-right`,children:a()})]})}),(0,G.jsx)(ke,{children:Z.map(e=>(0,G.jsxs)(H,{children:[(0,G.jsx)(U,{className:`font-medium`,style:{maxWidth:280,overflow:`hidden`,textOverflow:`ellipsis`},title:e.filename,children:e.filename}),(0,G.jsx)(U,{title:e.mimeType,children:q(e.category)}),(0,G.jsx)(U,{children:(0,G.jsx)(Ce,{variant:`secondary`,children:e.direction===`inbound`?w():f()})}),(0,G.jsx)(U,{style:{maxWidth:220,overflow:`hidden`,textOverflow:`ellipsis`},title:e.chatTitle,children:e.chatTitle}),(0,G.jsx)(U,{className:`whitespace-nowrap text-muted-foreground`,children:Ne.format(e.createdAt)}),(0,G.jsx)(U,{className:`text-right`,children:(0,G.jsxs)(Se,{children:[(0,G.jsx)(we,{asChild:!0,children:(0,G.jsx)(D,{variant:`ghost`,size:`icon`,"aria-label":se(),children:(0,G.jsx)(xe,{size:16})})}),(0,G.jsxs)(N,{align:`end`,children:[e.url?(0,G.jsx)(F,{asChild:!0,children:(0,G.jsxs)(`a`,{href:e.url,download:e.filename,target:`_blank`,rel:`noopener noreferrer`,children:[(0,G.jsx)(j,{size:14}),ce()]})}):(0,G.jsxs)(F,{disabled:!0,children:[(0,G.jsx)(j,{size:14}),c()]}),(0,G.jsxs)(F,{variant:`destructive`,onSelect:()=>C({id:e._id,filename:e.filename}),children:[(0,G.jsx)(Te,{size:14}),r()]})]})]})})]},e._id))})]}),Pe?(0,G.jsx)(`p`,{className:`oc-admin__hint`,style:{marginTop:8},children:te({cap:Fe})}):null]}),(0,G.jsx)(ve,{open:x!==null,onOpenChange:e=>!e&&C(null),children:(0,G.jsxs)(P,{children:[(0,G.jsxs)(De,{children:[(0,G.jsx)(k,{children:ie()}),(0,G.jsx)(I,{children:u()})]}),(0,G.jsxs)(be,{children:[(0,G.jsx)(M,{children:i()}),(0,G.jsx)(ye,{onClick:()=>void Me(),children:r()})]})]})})]})}export{J 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{As as r,js as i}from"./dist-BzNYkP4V.js";import{t as a}from"./button-DXGXeanX.js";import{Z as o,vt as s,yt as c}from"./index-CKlFEsq3.js";import{t as l}from"./TimeRangePicker-CY6cFX3v.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)(s,{className:`oc-filterbar__search-icon`,"aria-hidden":!0}),(0,d.jsx)(o,{value:v,onChange:e=>x(e.target.value),placeholder:n,"aria-label":n})]}),p?(0,d.jsx)(`div`,{className:`oc-filterbar__quick`,children:p}):null,m&&h?(0,d.jsx)(l,{value:m,onChange:h}):null,(0,d.jsxs)(a,{variant:`ghost`,size:`sm`,className:`oc-filterbar__reset`,onClick:S,disabled:!_,children:[(0,d.jsx)(c,{}),r()]})]})}export{p as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$i as r,Aa as i,Ba as a,Bi as o,CD as s,Ca as c,Da as l,Ea as u,Fa as d,Ga as f,Gi as p,Ha as m,Hi as h,Ia as g,Ii as _,Ji as v,Ki as y,La as b,Li as x,Ma as ee,Na as S,Oa as C,Pa as te,Qi as w,Ra as T,Ri as E,SD as D,Sa as O,Ta as ne,Ua as re,Ui as k,Va as ie,Vi as A,Wa as j,Wi as M,Xi as N,Yi as P,Zi as F,_D as I,_a as ae,aa as oe,ba as se,ca as L,da as ce,ea as le,fa as ue,gD as R,ga as z,ha as de,ia as fe,ja as pe,ka as me,la as he,ma as ge,na as _e,oa as ve,pa as ye,qi as be,ra as xe,sa as B,ta as Se,ua as Ce,va as we,wa as Te,xa as Ee,ya as De,za as Oe,zi as ke}from"./dist-BzNYkP4V.js";import{t as Ae}from"./x-DQ_CLIEK.js";import{i as V,n as H,r as je,t as Me}from"./tabs-9X-5Pgx3.js";import{t as U}from"./button-DXGXeanX.js";import{$ as Ne,A as W,At as Pe,C as Fe,Q as Ie,S as Le,X as G,Z as K,_ as q,_t as J,b as Re,et as ze,gt as Y,j as Be,m as Ve,nt as He,ot as Ue,rt as We,x as Ge,y as Ke}from"./index-CKlFEsq3.js";import{t as qe}from"./FilterBar-CSA8xMkl.js";import{t as Je}from"./DataTableShell-C1ZKbpq3.js";import{t as X}from"./DetailChips-Dg4YEpwe.js";var Ye=I(`chevron-left`,[[`path`,{d:`m15 18-6-6 6-6`,key:`1wnfg3`}]]),Xe=I(`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=I(`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=I(`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 ue();case`user`:return ce();case`pending`:return Ce();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=s(R.groups.listGroups,{}),t=s(R.me.getMe,{host:Ue})?.role===`admin`,n=D(R.groups.createGroup),r=D(R.groups.updateGroup),o=D(R.groups.deleteGroup),c=Be(),p=W(),[h,_]=(0,Q.useState)(!1),[v,y]=(0,Q.useState)(null),[x,w]=(0,Q.useState)(it),[O,k]=(0,Q.useState)(null),[A,M]=(0,Q.useState)(``),N=(0,Q.useMemo)(()=>{if(!e)return e;let t=A.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,A]);function P(){y(null),w(it),_(!0)}function F(e){y(e),w({name:e.name,description:e.description??``}),_(!0)}async function I(){try{v?await r({groupId:v._id,name:x.name,description:x.description}):await n({name:x.name,description:x.description||void 0}),w(it),y(null),_(!1)}catch(e){p.error(ke(),e)}}async function ae(e){if(await c({title:u({name:e.name}),description:ne(),confirmWord:e.name,confirmLabel:Te(),cancelLabel:ee(),destructive:!0}))try{await o({groupId:e._id})}catch(e){p.error(E(),e)}}return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`p`,{className:`oc-admin__hint`,children:j()}),(0,$.jsx)(qe,{q:A,onQChange:M,onReset:()=>M(``),canReset:A!==``,searchPlaceholder:b()}),(0,$.jsx)(Je,{title:f(),rows:N,addLabel:re(),onAdd:t?P:void 0,emptyHint:m(),columns:[{header:ie(),cell:e=>e.name,sort:e=>e.name},{header:a(),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:Oe(),cell:e=>(0,$.jsx)(X,{icon:(0,$.jsx)(J,{size:12,"aria-hidden":!0}),total:e.agentCount,items:e.agents.map(e=>({label:e}))}),sort:e=>e.agentCount},{header:T(),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)(Y,{size:11,fill:`currentColor`,"aria-hidden":!0}):null,highlight:e.isDefault}))}),sort:e=>e.chartCount}],rowActions:e=>[{label:g(),onSelect:()=>k({groupId:e._id,name:e.name})},...t?[{label:d(),onSelect:()=>F(e)},{label:te(),variant:`destructive`,onSelect:()=>void ae(e)}]:[]]}),(0,$.jsx)(Ve,{open:h,onOpenChange:_,title:v?i():pe(),description:me(),canSubmit:!!x.name.trim(),onSubmit:I,submitLabel:S(),children:(0,$.jsxs)(`div`,{className:`oc-form`,children:[(0,$.jsxs)(`label`,{className:`oc-field`,children:[(0,$.jsx)(`span`,{className:`oc-field__label`,children:C()}),(0,$.jsx)(K,{value:x.name,onChange:e=>w({...x,name:e.target.value})})]}),(0,$.jsxs)(`label`,{className:`oc-field`,children:[(0,$.jsx)(`span`,{className:`oc-field__label`,children:l()}),(0,$.jsx)(K,{value:x.description,onChange:e=>w({...x,description:e.target.value})})]})]})}),(0,$.jsx)(ct,{groupId:O?.groupId??null,groupName:O?.name??``,open:O!==null,onOpenChange:e=>{e||k(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}),de()]}),(0,$.jsxs)(`span`,{className:`oc-access__pageinfo`,"aria-label":ye({page:e,pages:t}),children:[e,` / `,t]}),(0,$.jsxs)(U,{type:`button`,variant:`ghost`,size:`sm`,disabled:e>=t,onClick:()=>n(e+1),children:[ge(),(0,$.jsx)(Pe,{size:14,"aria-hidden":!0})]})]})}function ct({groupId:e,groupName:t,open:n,onOpenChange:r}){let i=s(R.groups.getGroup,n&&e?{groupId:e}:`skip`),a=s(R.groups.listAssignableInstances,n?{}:`skip`),o=s(R.groups.listAssignableUsers,n?{}:`skip`),l=D(R.groups.addMember),u=D(R.groups.removeMember),d=D(R.groups.bulkSetMembers),f=D(R.groups.setGroupManager),p=W(),[m,g]=(0,Q.useState)(``),[_,v]=(0,Q.useState)(``),[y,b]=(0,Q.useState)(`members`),[ee,S]=(0,Q.useState)(1),[C,te]=(0,Q.useState)(new Set),T=(0,Q.useRef)(null),E=(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]),re=i?.viewerIsAdmin===!0,ie=(0,Q.useMemo)(()=>new Set((i?.agents??[]).map(e=>`${e.instanceName}/${e.agentId}`)),[i]);(0,Q.useEffect)(()=>{g(``),v(``),b(`members`),S(1),T.current=null},[n,e]),(0,Q.useEffect)(()=>{S(1)},[m]),(0,Q.useEffect)(()=>{n&&i&&e&&T.current!==e&&(T.current=e,te(new Set((i.members??[]).map(e=>e.userId))))},[n,i,e]);let j=(0,Q.useMemo)(()=>o?Qe(o,m,C):[],[o,m,C]);async function N(t,n){if(e)try{n?await u({groupId:e,userId:t}):await l({groupId:e,userId:t})}catch(e){p.error(x(),e)}}async function P(t,n){if(e)try{await f({groupId:e,userId:t,manager:!n})}catch(e){p.error(A(),e)}}let F=nt(j,e=>E.has(e.userId)),I=j.filter(e=>E.has(e.userId)).length,L=rt(j,ee,ot);async function ce(){if(!e||j.length===0)return;let t=j.map(e=>e.userId);try{await d({groupId:e,userIds:t,member:F!==`all`})}catch(e){p.error(x(),e)}}return(0,$.jsx)(Ie,{open:n,onOpenChange:r,children:(0,$.jsxs)(Ne,{className:`oc-access`,children:[(0,$.jsxs)(He,{children:[(0,$.jsx)(We,{children:c({name:t})}),(0,$.jsx)(ze,{children:O()})]}),(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}),Ee(),i?(0,$.jsx)(G,{variant:`secondary`,className:`oc-access__tabcount`,children:E.size}):null]}),(0,$.jsxs)(V,{value:`agents`,className:`flex-1 gap-1.5`,children:[(0,$.jsx)(J,{size:13,"aria-hidden":!0}),De(),i?(0,$.jsx)(G,{variant:`secondary`,className:`oc-access__tabcount`,children:ie.size}):null]}),(0,$.jsxs)(V,{value:`charts`,className:`flex-1 gap-1.5`,children:[(0,$.jsx)(Xe,{size:13,"aria-hidden":!0}),w(),i?(0,$.jsx)(G,{variant:`secondary`,className:`oc-access__tabcount`,children:i.chartCount}):null]})]}),(0,$.jsx)(H,{value:`members`,children:o===void 0||i===void 0?(0,$.jsx)(`p`,{className:`oc-access__hint`,children:B()}):o.length===0?(0,$.jsx)(`p`,{className:`oc-access__hint`,children:oe()}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(K,{value:m,onChange:e=>g(e.target.value),placeholder:se(),className:`oc-access__search`}),j.length===0?(0,$.jsx)(`p`,{className:`oc-access__hint`,children:ae()}):(0,$.jsxs)($.Fragment,{children:[j.length>1?(0,$.jsxs)(`div`,{className:`oc-access__row oc-access__selectall`,children:[(0,$.jsx)(q,{checked:F===`all`?!0:F===`some`?`indeterminate`:!1,onCheckedChange:()=>void ce(),"aria-label":z()}),(0,$.jsx)(`span`,{className:`oc-access__label`,children:z()}),(0,$.jsxs)(G,{variant:`outline`,className:`oc-access__count`,children:[I,` / `,j.length]})]}):null,(0,$.jsx)(`div`,{className:`oc-access__list`,children:L.pageItems.map(e=>{let t=E.has(e.userId),n=et(e),r=ne.has(e.userId);return(0,$.jsxs)(`div`,{className:`oc-access__row`,children:[(0,$.jsx)(q,{checked:t,onCheckedChange:()=>void N(e.userId,t),"aria-label":he({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&&re?(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?h():k(),title:r?h():k(),onClick:()=>void P(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:L.page,pageCount:L.pageCount,onPage:S})]})]})}),(0,$.jsx)(H,{value:`agents`,children:a===void 0?(0,$.jsx)(`p`,{className:`oc-access__hint`,children:B()}):a.length===0?(0,$.jsx)(`p`,{className:`oc-access__hint`,children:fe()}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(K,{value:_,onChange:e=>v(e.target.value),placeholder:we(),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:ie,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=s(R.groups.listAssignableAgents,{instanceName:t}),c=D(R.groups.assignAgentToGroup),l=D(R.groups.removeAgentFromGroup),u=D(R.groups.bulkSetGroupAgents),d=W(),[f,p]=(0,Q.useState)(1);if((0,Q.useEffect)(()=>{p(1)},[a]),!e)return null;let m=$e(o?.agents??[],a),h=o?.discovery&&!o.discovery.lastPollOk;if(a.trim()&&m.length===0)return null;let g=m.filter(e=>e.presentInLastOk!==!1),v=nt(g,e=>i.has(`${t}/${e.agentId}`)),y=rt(m,f,ot);async function b(n,r){try{r?await l({groupId:e,instanceName:t,agentId:n}):await c({groupId:e,instanceName:t,agentId:n})}catch(e){d.error(_(),e)}}async function x(){if(g.length===0)return;let n=g.map(e=>e.agentId);try{await u({groupId:e,instanceName:t,agentIds:n,assigned:v!==`all`})}catch(e){d.error(_(),e)}}return(0,$.jsxs)(`div`,{className:`oc-access__group`,children:[(0,$.jsxs)(`div`,{className:`oc-access__instance`,children:[(0,$.jsx)(J,{size:13,"aria-hidden":!0}),(0,$.jsx)(`span`,{children:t}),(0,$.jsx)(G,{variant:`outline`,className:`oc-access__kind`,children:n}),h?(0,$.jsx)(G,{variant:`outline`,className:`oc-access__stale`,children:Se()}):null]}),o===void 0?(0,$.jsx)(`p`,{className:`oc-access__hint`,children:ve()}):m.length===0?(0,$.jsx)(`p`,{className:`oc-access__hint`,children:h?_e():xe()}):(0,$.jsxs)($.Fragment,{children:[g.length>1?(0,$.jsxs)(`div`,{className:`oc-access__row oc-access__selectall`,children:[(0,$.jsx)(q,{checked:v===`all`?!0:v===`some`?`indeterminate`:!1,onCheckedChange:()=>void x(),"aria-label":z()}),(0,$.jsx)(`span`,{className:`oc-access__label`,children:z()})]}):null,y.pageItems.map(e=>{let n=`${t}/${e.agentId}`,a=i.has(n),o=e.presentInLastOk===!1;return(0,$.jsxs)(`div`,{className:`oc-access__row`,children:[(0,$.jsx)(q,{checked:a,disabled:o&&!a,onCheckedChange:()=>void b(e.agentId,a),"aria-label":L({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":r(),title:r(),children:(0,$.jsx)(Y,{size:14,fill:`currentColor`})}):null,o?(0,$.jsx)(G,{variant:`outline`,className:`oc-access__gone`,children:le()}):null]},e.agentId)}),(0,$.jsx)(st,{page:y.page,pageCount:y.pageCount,onPage:p})]})]})}function ut({groupId:e}){let t=s(R.charts.listGroupChartSelection,e?{groupId:e}:`skip`),n=D(R.charts.assignChartToGroup),r=D(R.charts.removeChartFromGroup),i=D(R.charts.setGroupDefaultChart),a=D(R.charts.addChartToGroupPool),c=D(R.charts.removeChartFromGroupPool),l=W();if(!e)return null;if(t===void 0)return(0,$.jsx)(`p`,{className:`oc-access__hint`,children:B()});let{pool:u,addable:d,canManagePool:f}=t;if(u.length===0&&!f)return(0,$.jsx)(`p`,{className:`oc-access__hint`,children:F()});async function m(t,i){try{i?await r({groupId:e,chartKey:t}):await n({groupId:e,chartKey:t})}catch(e){l.error(o(),e)}}async function h(t){try{await i({groupId:e,chartKey:t})}catch(e){l.error(o(),e)}}async function g(t){try{await a({groupId:e,chartKey:t})}catch(e){l.error(o(),e)}}async function _(t){try{await c({groupId:e,chartKey:t})}catch(e){l.error(o(),e)}}return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`div`,{className:`oc-access__list`,children:u.map(e=>(0,$.jsxs)(`div`,{className:`oc-access__row`,children:[(0,$.jsx)(q,{checked:e.selected,onCheckedChange:()=>void m(e.chartKey,e.selected),"aria-label":be({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":y(),title:y(),children:(0,$.jsx)(Y,{size:14,fill:`currentColor`})}):(0,$.jsx)(U,{type:`button`,variant:`ghost`,size:`sm`,onClick:()=>void h(e.chartKey),children:p()}):null,f?(0,$.jsx)(U,{type:`button`,variant:`ghost`,size:`sm`,"aria-label":v({name:e.name}),title:v({name:e.name}),onClick:()=>void _(e.chartKey),children:(0,$.jsx)(Ae,{size:14,"aria-hidden":!0})}):null]},e.chartKey))}),f?d.length>0?(0,$.jsxs)(Ke,{value:``,onValueChange:e=>void g(e),children:[(0,$.jsx)(Le,{size:`sm`,className:`oc-access__search`,children:(0,$.jsx)(Fe,{placeholder:P()})}),(0,$.jsx)(Re,{children:d.map(e=>(0,$.jsx)(Ge,{value:e.chartKey,children:e.name},e.chartKey))})]}):u.length===0?(0,$.jsx)(`p`,{className:`oc-access__hint`,children:N()}):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{$h as r,Ag as i,Ah as a,Bg as o,Bh as s,CD as c,CS as l,Cg as u,Ch as d,Dg as f,Dh as p,Eg as m,Eh as h,Fg as g,Fh as _,Gh as v,Hh as y,Ig as b,Ih as x,Jh as S,Kh as C,Lg as w,Lh as T,Mg as E,Mh as D,Ng as ee,Nh as te,Og as ne,Oh as re,Pg as ie,Ph as ae,Qh as oe,Rg as se,Rh as ce,SD as O,Sg as le,Sh as k,Tg as ue,Th as de,Uh as fe,Vg as pe,Vh as me,Wh as he,Xh as ge,Xu as _e,Yh as ve,Zh as ye,Zu as be,_g as xe,_h as Se,ag as Ce,ah as we,bD as A,bg as Te,bh as Ee,cg as De,ch as Oe,dg as ke,dh as Ae,eg as je,fg as Me,fh as Ne,gD as j,gg as Pe,gh as Fe,hg as Ie,hh as Le,ig as M,ih as Re,jg as ze,jh as Be,kg as Ve,kh as He,lg as Ue,lh as We,mg as Ge,mh as Ke,ng as qe,nh as N,og as Je,oh as Ye,pg as Xe,ph as Ze,qh as P,rg as F,rh as Qe,sg as $e,sh as et,tg as tt,th as nt,ug as rt,uh as it,vg as at,vh as ot,wS as I,wg as st,wh as ct,xg as lt,xh as ut,yg as dt,yh as ft,zg as pt,zh as mt}from"./dist-BzNYkP4V.js";import{a as ht,c as gt}from"./FieldLabel-X2EAqICh.js";import{t as L}from"./button-DXGXeanX.js";import{$ as R,A as z,C as B,H as _t,Q as V,S as H,U as vt,V as yt,X as U,Z as W,_ as G,b as K,et as q,j as bt,m as xt,nt as St,rt as Ct,x as J,y as wt}from"./index-CKlFEsq3.js";import{t as Tt}from"./DataTableShell-C1ZKbpq3.js";import{InstanceConfigDialog as Et}from"./BridgeTab-KP5PlAMx.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:ht},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=c(j.admin.listInstances,{}),t=c(j.agents.listAllInstanceAgents,{}),n=O(j.admin.upsertInstance),r=O(j.admin.deleteInstance),a=z(),[s,l]=(0,Y.useState)(!1),[d,p]=(0,Y.useState)(Q),[h,_]=(0,Y.useState)(null),[v,y]=(0,Y.useState)(null),[x,S]=(0,Y.useState)(null),[C,T]=(0,Y.useState)(null);async function D(){try{await n({instanceId:C??void 0,name:d.name,gatewayUrl:d.gatewayUrl,bridgeUrl:d.bridgeUrl||void 0,displayName:d.displayName||void 0,kind:d.kind,gatewayVersion:d.gatewayVersion||void 0,gatewayHttpUrl:d.gatewayHttpUrl||void 0,streamTransport:d.streamTransport}),p(Q),T(null),l(!1)}catch(e){a.error(pt(),e)}}return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`p`,{className:`oc-admin__hint`,children:[se(),(0,Z.jsx)(`strong`,{children:w()}),b()]}),(0,Z.jsx)(Tt,{title:g(),rows:e,addLabel:ie(),onAdd:()=>{T(null),p(Q),l(!0)},emptyHint:ee(),columns:[{header:E(),cell:e=>e.name,sort:e=>e.name},{header:ze(),cell:e=>(0,Z.jsx)(U,{variant:`outline`,children:e.kind??`openclaw`}),sort:e=>e.kind??`openclaw`},{header:i(),cell:e=>e.gatewayUrl,sort:e=>e.gatewayUrl},{header:Ve(),cell:e=>e.displayName??`—`,sort:e=>e.displayName??null},{header:pe(),cell:e=>{let n=(t?.[e.name]??[]).filter(e=>e.presentInLastOk!==!1&&e.enabled);if(n.length===0)return(0,Z.jsx)(`span`,{className:`text-muted-foreground`,children:`—`});let r=t=>e.defaultAgentId===t;return(0,Z.jsx)(`div`,{className:`flex flex-wrap gap-1`,children:[...n].sort((e,t)=>Number(r(t.agentId))-Number(r(e.agentId))).map(e=>(0,Z.jsxs)(U,{variant:r(e.agentId)?`default`:`outline`,title:r(e.agentId)?N():void 0,children:[e.emoji?`${e.emoji} `:``,e.displayName??e.agentId]},e.agentId))})}}],rowActions:e=>[{label:ue(),onSelect:()=>{T(e._id),p(jt(e)),l(!0)}},{label:o(),onSelect:()=>_(e.name)},{label:rt(),onSelect:()=>S(e)},{label:ne(),onSelect:()=>y(e)},{label:f(),variant:`destructive`,onSelect:()=>void r({instanceId:e._id})}],bulkActions:[{label:f(),variant:`destructive`,onSelect:e=>e.forEach(e=>void r({instanceId:e}))}]}),(0,Z.jsx)(xt,{open:s,onOpenChange:l,title:C?st():m(),description:le(),canSubmit:!!(d.name&&d.gatewayUrl),onSubmit:D,submitLabel:lt(),children:(0,Z.jsxs)(`div`,{className:`oc-form`,children:[(0,Z.jsxs)($,{label:Te(),children:[(0,Z.jsx)(W,{value:d.name,disabled:C!==null,onChange:e=>p({...d,name:e.target.value})}),C?(0,Z.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:u()}):null]}),(0,Z.jsx)($,{label:dt(),children:(0,Z.jsxs)(wt,{value:d.kind,onValueChange:e=>p({...d,kind:e}),children:[(0,Z.jsx)(H,{size:`sm`,className:`w-40`,children:(0,Z.jsx)(B,{})}),(0,Z.jsxs)(K,{children:[(0,Z.jsx)(J,{value:`openclaw`,children:`OpenClaw`}),(0,Z.jsx)(J,{value:`hermes`,children:`Hermes`})]})]})}),(0,Z.jsx)($,{label:at(),children:(0,Z.jsx)(W,{value:d.gatewayUrl,onChange:e=>p({...d,gatewayUrl:e.target.value})})}),(0,Z.jsx)($,{label:xe(),children:(0,Z.jsx)(W,{value:d.bridgeUrl,placeholder:Pe(),onChange:e=>p({...d,bridgeUrl:e.target.value})})}),(0,Z.jsx)($,{label:Ie(),children:(0,Z.jsx)(W,{value:d.displayName,onChange:e=>p({...d,displayName:e.target.value})})}),(0,Z.jsxs)($,{label:be(),children:[(0,Z.jsxs)(wt,{value:d.streamTransport,onValueChange:e=>p({...d,streamTransport:e}),children:[(0,Z.jsx)(H,{size:`sm`,className:`w-40`,children:(0,Z.jsx)(B,{})}),(0,Z.jsx)(K,{children:gt.map(e=>(0,Z.jsx)(J,{value:e,children:e},e))})]}),(0,Z.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:_e()})]}),(0,Z.jsx)($,{label:Ge(),children:(0,Z.jsx)(W,{value:d.gatewayVersion,placeholder:Xe(),onChange:e=>p({...d,gatewayVersion:e.target.value})})}),(0,Z.jsx)($,{label:Me(),children:(0,Z.jsx)(W,{value:d.gatewayHttpUrl,placeholder:ke(),onChange:e=>p({...d,gatewayHttpUrl:e.target.value})})})]})}),(0,Z.jsx)(Ht,{instanceName:h,open:h!==null,onOpenChange:e=>{e||_(null)}}),v?(0,Z.jsx)(Et,{instance:v,onClose:()=>y(null)},v._id):null,x?(0,Z.jsx)(Nt,{instance:x,onClose:()=>S(null)},x._id):null]})}function Nt({instance:e,onClose:t}){let n=c(j.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)(V,{open:!0,onOpenChange:e=>!e&&t(),children:(0,Z.jsxs)(R,{onOpenAutoFocus:e=>e.preventDefault(),children:[(0,Z.jsxs)(St,{children:[(0,Z.jsx)(Ct,{children:Ue({instance:e.displayName??e.name})}),(0,Z.jsx)(q,{children:De()})]}),(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=A(j.instanceSync.forceInstanceSync),n=z(),[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(y());break;case`no_agents`:n.success(s());break;case`no_bridge_url`:n.error(mt());break;case`deploy_misconfigured`:n.error(ce());break;case`unauthorized`:n.error(x());break;case`not_served`:n.error(_());break;default:n.error(T());break}}catch(e){n.error(me(),e)}finally{i(!1)}}}return(0,Z.jsxs)(`div`,{className:`oc-form`,children:[(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:ae()}),(0,Z.jsx)(`div`,{className:`flex items-center gap-2`,children:(0,Z.jsx)(L,{size:`sm`,variant:`outline`,onClick:()=>void a(),disabled:r,children:r?fe():he()})})]})}function Ft({instance:e}){let t=c(j.bridgeAuth.listBridgeAuthStatus,{}),n=A(j.bridgeAuth.mintBridgeSecret),r=O(j.bridgeAuth.revokeBridgeSecret),i=z(),[o,s]=(0,Y.useState)(!1),[u,d]=(0,Y.useState)(null),[f,m]=(0,Y.useState)(!1),g=(t??[]).find(t=>t.instanceId===e._id),_=g!==void 0;async function v(){if(!o){s(!0);try{d((await n({instanceId:e._id})).plaintext),m(!1)}catch(e){i.error(p(),e)}finally{s(!1)}}}async function y(){if(!o){s(!0);try{await r({instanceId:e._id}),d(null),i.success(re())}catch(e){i.error(p(),e)}finally{s(!1)}}}async function b(){if(u)try{await navigator.clipboard.writeText(u),m(!0)}catch{}}return(0,Z.jsxs)($,{label:te(),children:[(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:D()}),(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Z.jsx)(U,{variant:_?`outline`:`secondary`,children:_?`${M()} · ${g.prefix}…${g.lastFour}`:F()}),(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(L,{size:`sm`,onClick:()=>void v(),disabled:o,children:_?a():Be()}),_?(0,Z.jsx)(L,{size:`sm`,variant:`destructive`,onClick:()=>void y(),disabled:o,children:He()}):null]})]}),u?(0,Z.jsxs)(`div`,{className:`oc-bridgesecret__reveal`,children:[(0,Z.jsx)(`p`,{className:`oc-sa__minted-warning`,children:h()}),(0,Z.jsxs)(`div`,{className:`oc-sa__minted-box`,children:[(0,Z.jsx)(`code`,{className:`oc-sa__minted-plain`,children:u}),(0,Z.jsx)(L,{variant:`outline`,size:`sm`,onClick:()=>void b(),children:f?I():l()})]}),(0,Z.jsx)(L,{size:`sm`,variant:`ghost`,onClick:()=>{d(null),m(!1)},children:de()})]}):null]})}function It({instanceId:e,field:t,updatedAt:n}){let i=A(j.instanceSecrets.setInstanceSecret),a=O(j.instanceSecrets.clearInstanceSecret),o=A(j.deviceIdentity.generateDeviceIdentity),s=z(),[c,u]=(0,Y.useState)(``),[d,f]=(0,Y.useState)(!1),[p,m]=(0,Y.useState)(null),[h,g]=(0,Y.useState)(!1),_=n!==null,y=t===`deviceIdentity`,b=t===`token`?$e():t===`deviceIdentity`?Je():Ce();async function x(){if(!(!c.trim()||d)){f(!0);try{await i({instanceId:e,field:t,plaintext:c}),u(``),m(null),g(!1),s.success(oe())}catch(e){s.error(ye(),e)}finally{f(!1)}}}async function w(){if(!d){f(!0);try{await a({instanceId:e,field:t}),m(null),g(!1),s.success(ge())}catch(e){s.error(ye(),e)}finally{f(!1)}}}async function T(){if(!d){f(!0);try{m(await o({instanceId:e})),g(!1),s.success(P())}catch(e){s.error(v(),e)}finally{f(!1)}}}let E=p?`openclaw devices approve ${p.id}`:``;async function D(){if(E)try{await navigator.clipboard.writeText(E),g(!0)}catch{}}return(0,Z.jsxs)($,{label:b,children:[y?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:S()}):null,(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Z.jsx)(U,{variant:_?`outline`:`secondary`,children:_?M():F()}),(0,Z.jsx)(W,{type:`password`,autoComplete:`off`,className:`flex-1 min-w-32`,value:c,placeholder:_?tt():qe(),onChange:e=>u(e.target.value)}),(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(L,{size:`sm`,onClick:()=>void x(),disabled:d||c.trim().length===0,children:je()}),y?(0,Z.jsx)(L,{size:`sm`,variant:`outline`,onClick:()=>void T(),disabled:d,children:ve()}):null,_?(0,Z.jsx)(L,{size:`sm`,variant:`destructive`,onClick:()=>void w(),disabled:d,children:r()}):null]})]}),p?(0,Z.jsxs)(`div`,{className:`oc-bridgesecret__reveal`,children:[(0,Z.jsx)(`p`,{className:`text-sm font-medium`,children:P()}),(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:C()}),(0,Z.jsxs)(`div`,{className:`oc-sa__minted-box`,children:[(0,Z.jsx)(`code`,{className:`oc-sa__minted-plain`,children:E}),(0,Z.jsx)(L,{variant:`outline`,size:`sm`,onClick:()=>void D(),children:h?I():l()})]}),(0,Z.jsx)(L,{size:`sm`,variant:`ghost`,onClick:()=>{m(null),g(!1)},children:de()})]}):null]})}var Lt={conversational:Se,documentary:Le},Rt={conversational:Fe,documentary:Ke},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:ut()}),t.map(e=>(0,Z.jsx)(U,{variant:`secondary`,className:`oc-agenttype__chip`,title:Bt(e),children:zt(e)},e)),(0,Z.jsxs)(yt,{children:[(0,Z.jsx)(vt,{asChild:!0,children:(0,Z.jsx)(L,{type:`button`,variant:`outline`,size:`sm`,className:`h-7`,children:Ee()})}),(0,Z.jsxs)(_t,{align:`start`,className:`oc-agenttypes-pop`,children:[(0,Z.jsx)(`p`,{className:`oc-agenttypes-pop__title`,children:ft()}),(0,Z.jsx)(`p`,{className:`oc-agenttypes-pop__hint`,children:ot()}),(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)(G,{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=c(j.agents.listAgentsForInstance,t&&e?{instanceName:e}:`skip`),i=O(j.agents.setAgentEnabled).withOptimisticUpdate((e,{instanceName:t,agentId:n,enabled:r})=>{let i=e.getQuery(j.agents.listAgentsForInstance,{instanceName:t});i&&e.setQuery(j.agents.listAgentsForInstance,{instanceName:t},{...i,agents:i.agents.map(e=>e.agentId===n?{...e,enabled:r}:e)})}),a=O(j.agents.setInstanceDefaultAgent).withOptimisticUpdate((e,{instanceName:t,agentId:n})=>{let r=e.getQuery(j.agents.listAgentsForInstance,{instanceName:t});r&&e.setQuery(j.agents.listAgentsForInstance,{instanceName:t},{...r,defaultAgentId:n})}),o=O(j.agents.setAgentTypes).withOptimisticUpdate((e,{instanceName:t,agentId:n,types:r})=>{let i=e.getQuery(j.agents.listAgentsForInstance,{instanceName:t});if(!i)return;let a=kt(r);e.setQuery(j.agents.listAgentsForInstance,{instanceName:t},{...i,agents:i.agents.map(e=>e.agentId===n?{...e,types:a}:e)})}),s=O(j.agents.removeInstanceAgent),l=bt(),u=z();async function f(t,n){if(e)try{await i({instanceName:e,agentId:t,enabled:n})}catch(e){u.error(k(),e)}}async function p(t){if(e)try{await a({instanceName:e,agentId:t})}catch(e){u.error(k(),e)}}async function m(t,n,r){if(!e)return;let i=r.includes(n)?r.filter(e=>e!==n):[...r,n];try{await o({instanceName:e,agentId:t,types:i})}catch(e){u.error(k(),e)}}async function h(t,n){if(e&&await l({title:Ae({name:n}),description:it(),confirmLabel:We(),destructive:!0}))try{await s({instanceName:e,agentId:t}),u.success(Oe())}catch(e){u.error(k(),e)}}return(0,Z.jsx)(V,{open:t,onOpenChange:n,children:(0,Z.jsxs)(R,{className:`oc-access`,children:[(0,Z.jsxs)(St,{children:[(0,Z.jsx)(Ct,{children:ct({name:e??``})}),(0,Z.jsx)(q,{children:d()})]}),r===void 0?(0,Z.jsx)(`p`,{className:`oc-access__hint`,children:et()}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`div`,{className:`oc-access__poll`,children:r.discovery===null?Ye():r.discovery.lastPollOk?we():Re({error:r.discovery.error??`?`})}),r.agents.length===0?(0,Z.jsx)(`p`,{className:`oc-access__hint`,children:Qe()}):(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)(G,{checked:e.enabled,disabled:t,"aria-label":i,onCheckedChange:t=>void f(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)(U,{variant:`outline`,className:`oc-access__gone`,children:nt()}),(0,Z.jsx)(L,{size:`sm`,variant:`ghost`,className:`h-7 text-destructive`,onClick:()=>void h(e.agentId,i),children:Ne()})]}):n?(0,Z.jsx)(U,{variant:`default`,children:N()}):(0,Z.jsx)(L,{size:`sm`,variant:`outline`,className:`h-7`,disabled:!e.enabled,onClick:()=>void p(e.agentId),children:Ze()})]}),e.enabled?(0,Z.jsx)(Vt,{agentId:e.agentId,types:a,onToggle:t=>void m(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{$v as r,Av as i,Bv as a,CD as o,Cv as s,Dv as c,Ev as l,Fv as ee,Gv as te,Hv as ne,Iv as re,Jv as u,Kv as ie,Lv as ae,Mv as oe,Nv as se,Ov as d,Pv as f,Qv as p,Rv as m,SD as h,Sv as g,Tv as _,Uv as v,Vv as y,Wv as b,Xv as x,Yv as S,Zv as ce,_t as le,_v as C,ay as w,bD as T,bv as E,cy as D,dt as O,ey as k,ft as A,gD as j,gt as M,ht as N,iy as P,jv as F,kv as I,ly as L,mt as R,ny as z,oy as B,pt as V,qv as H,ry as U,sy as W,ty as ue,ut as de,vt as fe,vv as pe,wv as me,xv as he,yv as ge,zv as _e}from"./dist-BzNYkP4V.js";import{t as G}from"./button-DXGXeanX.js";import{C as ve,S as ye,X as K,Z as q,_ as be,b as xe,x as Se,y as Ce}from"./index-CKlFEsq3.js";import{t as we}from"./DataTableShell-C1ZKbpq3.js";var J=t(e(),1),Y=n();function Te(){let e=o(j.integrations.status.status,{}),t=h(j.admin.setIntegrationConfig),[n,T]=(0,J.useState)(null);if((0,J.useEffect)(()=>{e&&n===null&&T(e.config)},[e,n]),!e||!n)return(0,Y.jsx)(`p`,{className:`oc-admin__hint`,children:L()});let O=n,A=(e,t,n)=>T({...O,[e]:{...O[e],[t]:n}}),N=(e,n)=>void t({[e]:n});return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(`p`,{className:`oc-admin__hint`,children:[D(),` `,(0,Y.jsx)(`strong`,{children:W()}),` `,B()]}),(0,Y.jsxs)(X,{title:`Langfuse`,status:e.langfuse.configured?e.langfuse.enabled?(0,Y.jsx)(K,{variant:`secondary`,children:w()}):(0,Y.jsx)(K,{variant:`outline`,children:P()}):(0,Y.jsx)(K,{variant:`outline`,children:U()}),note:ue(),children:[(0,Y.jsx)(Z,{label:r(),children:(0,Y.jsx)(q,{value:O.langfuse.host??``,placeholder:e.langfuse.effectiveHost,onChange:e=>A(`langfuse`,`host`,e.target.value),onBlur:()=>N(`langfuse`,{host:O.langfuse.host??``})})}),(0,Y.jsx)(Q,{label:S(),checked:O.langfuse.enabled??!0,onChange:e=>{A(`langfuse`,`enabled`,e),N(`langfuse`,{enabled:e})}})]}),(0,Y.jsxs)(X,{title:`Opik`,status:e.opik.configured?e.opik.enabled?(0,Y.jsx)(K,{variant:`secondary`,children:w()}):(0,Y.jsx)(K,{variant:`outline`,children:P()}):(0,Y.jsx)(K,{variant:`outline`,children:U()}),note:k(),children:[(0,Y.jsx)(Z,{label:p(),children:(0,Y.jsx)(q,{value:O.opik.baseUrl??``,placeholder:e.opik.effectiveBaseUrl,onChange:e=>A(`opik`,`baseUrl`,e.target.value),onBlur:()=>N(`opik`,{baseUrl:O.opik.baseUrl??``})})}),(0,Y.jsx)(Z,{label:ce(),children:(0,Y.jsx)(q,{value:O.opik.workspace??``,placeholder:e.opik.effectiveWorkspace||x(),onChange:e=>A(`opik`,`workspace`,e.target.value),onBlur:()=>N(`opik`,{workspace:O.opik.workspace??``})})}),(0,Y.jsx)(Q,{label:S(),checked:O.opik.enabled??!0,onChange:e=>{A(`opik`,`enabled`,e),N(`opik`,{enabled:e})}})]}),(0,Y.jsxs)(X,{title:`OpenTelemetry (OTLP)`,status:e.otlp.configured?e.otlp.enabled?(0,Y.jsx)(K,{variant:`secondary`,children:w()}):(0,Y.jsx)(K,{variant:`outline`,children:P()}):(0,Y.jsx)(K,{variant:`outline`,children:fe()}),note:le(),children:[(0,Y.jsx)(Z,{label:M(),children:(0,Y.jsx)(q,{value:O.otlp.endpoint??``,placeholder:e.otlp.effectiveEndpoint||`https://otlp.example.com/v1/traces`,onChange:e=>A(`otlp`,`endpoint`,e.target.value),onBlur:()=>N(`otlp`,{endpoint:O.otlp.endpoint??``})})}),(0,Y.jsx)(Ee,{headersSet:e.otlp.headersSet}),(0,Y.jsx)(Q,{label:S(),checked:O.otlp.enabled??!0,onChange:e=>{A(`otlp`,`enabled`,e),N(`otlp`,{enabled:e})}})]}),(0,Y.jsxs)(X,{title:u(),status:(0,Y.jsx)(K,{variant:`outline`,children:z()}),note:H(),children:[(0,Y.jsx)(Z,{label:ie(),children:(0,Y.jsx)($,{value:O.tts.auto??`off`,options:[[`off`,te()],[`always`,b()],[`inbound`,v()],[`tagged`,ne()]],onChange:e=>{A(`tts`,`auto`,e),N(`tts`,{auto:e})}})}),(0,Y.jsx)(Z,{label:y(),children:(0,Y.jsx)($,{value:O.tts.provider??`openai`,options:[[`openai`,`OpenAI`],[`elevenlabs`,`ElevenLabs`],[`microsoft`,a()],[`azure`,`Azure Speech`],[`google`,`Google Gemini`]],onChange:e=>{A(`tts`,`provider`,e),N(`tts`,{provider:e})}})}),(0,Y.jsx)(Z,{label:_e(),children:(0,Y.jsx)(q,{value:O.tts.model??``,placeholder:`eleven_multilingual_v2`,onChange:e=>A(`tts`,`model`,e.target.value),onBlur:()=>N(`tts`,{model:O.tts.model??``})})}),(0,Y.jsx)(Z,{label:m(),children:(0,Y.jsx)(q,{value:O.tts.voice??``,placeholder:ae(),onChange:e=>A(`tts`,`voice`,e.target.value),onBlur:()=>N(`tts`,{voice:O.tts.voice??``})})})]}),(0,Y.jsxs)(X,{title:re(),status:(0,Y.jsx)(K,{variant:`outline`,children:z()}),note:e.secrets.openai?ee():f(),children:[(0,Y.jsx)(Q,{label:se(),checked:O.talk.enabled??!1,onChange:e=>{A(`talk`,`enabled`,e),N(`talk`,{enabled:e})}}),(0,Y.jsx)(Z,{label:oe(),children:(0,Y.jsx)($,{value:O.talk.realtimeProvider??`openai`,options:[[`openai`,`OpenAI (gpt-realtime)`],[`google`,`Google`]],onChange:e=>{A(`talk`,`realtimeProvider`,e),N(`talk`,{realtimeProvider:e})}})}),(0,Y.jsx)(Z,{label:F(),children:(0,Y.jsx)(q,{value:O.talk.realtimeModel??``,placeholder:`gpt-realtime-2`,onChange:e=>A(`talk`,`realtimeModel`,e.target.value),onBlur:()=>N(`talk`,{realtimeModel:O.talk.realtimeModel??``})})}),(0,Y.jsx)(Z,{label:m(),children:(0,Y.jsx)(q,{value:O.talk.voice??``,placeholder:`cedar / marin`,onChange:e=>A(`talk`,`voice`,e.target.value),onBlur:()=>N(`talk`,{voice:O.talk.voice??``})})}),(0,Y.jsx)(Z,{label:i(),children:(0,Y.jsx)($,{value:O.talk.transport??`webrtc`,options:[[`webrtc`,I()],[`provider-websocket`,`Provider WebSocket`],[`gateway-relay`,`Gateway relay`]],onChange:e=>{A(`talk`,`transport`,e),N(`talk`,{transport:e})}})}),(0,Y.jsx)(Z,{label:d(),children:(0,Y.jsx)(q,{value:O.talk.speechLocale??``,placeholder:`fr-CA`,onChange:e=>A(`talk`,`speechLocale`,e.target.value),onBlur:()=>N(`talk`,{speechLocale:O.talk.speechLocale??``})})}),(0,Y.jsx)(Q,{label:c(),checked:O.talk.interruptOnSpeech??!0,onChange:e=>{A(`talk`,`interruptOnSpeech`,e),N(`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:l()}),(0,Y.jsx)(K,{variant:`outline`,children:_()})]}),(0,Y.jsxs)(`p`,{className:`oc-uipa__note`,children:[me(),(0,Y.jsx)(`code`,{children:` voicewake.get/set`}),`.`]})]}),(0,Y.jsx)(we,{title:s(),rows:e.cursors.map(e=>({...e,_id:e.vendor})),emptyHint:g(),columns:[{header:he(),cell:e=>(0,Y.jsx)(K,{variant:`secondary`,children:e.vendor}),sort:e=>e.vendor},{header:E(),cell:e=>e.lastAt>0?new Date(e.lastAt).toLocaleString(`fr-FR`):`—`,sort:e=>e.lastAt>0?e.lastAt:null},{header:ge(),cell:e=>String(e.failureCount),sort:e=>e.failureCount},{header:pe(),cell:e=>e.lastErrorStatus??`—`,sort:e=>e.lastErrorStatus??null},{header:C(),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)(be,{checked:t,onCheckedChange:e=>n(e===!0)}),(0,Y.jsx)(`span`,{children:e})]})}function $({value:e,options:t,onChange:n}){return(0,Y.jsxs)(Ce,{value:e,onValueChange:n,children:[(0,Y.jsx)(ye,{size:`sm`,className:`w-full`,children:(0,Y.jsx)(ve,{})}),(0,Y.jsx)(xe,{children:t.map(([e,t])=>(0,Y.jsx)(Se,{value:e,children:t},e))})]})}function Ee({headersSet:e}){let t=T(j.integrations.otlpSecret.setOtlpHeaders),n=h(j.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:N(),children:[(0,Y.jsx)(q,{value:r,placeholder:e?R():V(),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:A()}),e?(0,Y.jsx)(G,{variant:`ghost`,size:`sm`,disabled:s,onClick:()=>void n({}),children:O()}):null]}),a?(0,Y.jsx)(`p`,{className:`oc-int__otlp-headers-error`,children:a}):null,(0,Y.jsx)(`p`,{className:`oc-uipa__note`,children:de()})]})}export{Te as IntegrationsTab};
|
|
@@ -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{CD as r,Cl as i,Hy as a,Ny as o,Py as s,Sl as c,Uy as l,Vy as u,Wy as d,_l as f,bl as p,dl as m,fl as h,gD as g,gl as _,hb as v,hl as y,ml as b,pl as x,vl as S,wl as C,xl as w,yl as ee}from"./dist-BzNYkP4V.js";import{Mt as te,a as ne,jt as re,n as T,ot as E,r as D}from"./index-CKlFEsq3.js";import{a as O,n as k,o as A,r as j,t as M}from"./card-B60DsQBe.js";import{n as N,t as P}from"./TimeRangePicker-CY6cFX3v.js";var F=t(e(),1),I=n(),L=15,R=e=>String(Math.round(e));function z(){let e=r(g.me.getMe,{host:E})?.permissions?.includes(`traces.read`)??!1,t=r(g.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:v()}),(0,I.jsxs)(M,{children:[(0,I.jsxs)(O,{children:[(0,I.jsx)(A,{children:d()}),(0,I.jsx)(j,{children:a()})]}),(0,I.jsx)(k,{children:n.length<2?(0,I.jsx)(`p`,{className:`oc-admin__hint`,children:u()}):(0,I.jsx)(B,{series:n})})]})]})}function B({series:e}){let t=e.map(e=>e.cP50),n=e.map(e=>e.aP50),r=Math.max(1,...t,...n),i=t=>6+t*468/(e.length-1),a=e=>74-e*68/r,c=e=>e.map((e,t)=>`${t===0?`M`:`L`}${i(t).toFixed(1)},${a(e).toFixed(1)}`).join(` `),u=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:[o(),` p50 `,R(u.cP50),` `,l()]}),(0,I.jsxs)(`span`,{children:[s(),` p50 `,R(u.aP50),` `,l()]})]}),(0,I.jsxs)(`svg`,{viewBox:`0 0 480 80`,className:`h-20 w-full`,preserveAspectRatio:`none`,role:`img`,"aria-label":d(),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:i(),unit:`/h`,group:`API`,isError:!0},{metric:`api.latency.avg_ms`,label:c(),unit:`ms`,group:`API`,isError:!1},{metric:`openclaw.ingest`,label:w(),unit:`/h`,group:`OpenClaw`,isError:!1},{metric:`chat.send`,label:p(),unit:`/h`,group:`Chat`,isError:!1},{metric:`assistant.stream.errors`,label:ee(),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=te({from:`/settings/kpi`}),t=re({from:`/settings/kpi`}),n=D(e.from,e.to,T,`now`),i=e=>void t({search:t=>({...t,...ne(e)})}),{from:a,to:o}=N(n),{rowLimit:s,buckets:c}=K(a,o),l=r(g.kpi.listKpis,{limit:s,filter:{from:a,to:o}}),u=(0,F.useMemo)(()=>{let e=new Map;for(let t of l??[]){let n=e.get(t.metric)??[];n.push({bucket:t.bucket,value:t.value}),e.set(t.metric,n)}for(let[t,n]of e)n.sort((e,t)=>e.bucket<t.bucket?-1:+(e.bucket>t.bucket)),n.length>c&&e.set(t,n.slice(n.length-c));return e},[l,c]),d=(0,I.jsxs)(I.Fragment,{children:[(0,I.jsxs)(`p`,{className:`oc-admin__hint`,children:[S(),` `,(0,I.jsx)(`span`,{className:`oc-filter__window`,children:f()})]}),(0,I.jsx)(J,{value:n,onChange:i})]});return l===void 0?(0,I.jsxs)(I.Fragment,{children:[d,(0,I.jsx)(z,{}),(0,I.jsx)(`p`,{className:`oc-admin__hint`,children:_()})]}):l.length===0?(0,I.jsxs)(I.Fragment,{children:[d,(0,I.jsx)(z,{}),(0,I.jsx)(`p`,{className:`oc-admin__hint`,children:y()})]}):(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)(P,{value:e,onChange:t})})}function Y({config:e,series:t}){let n=t.length>0?t[t.length-1]:null,r=n?n.value:0;return(0,I.jsxs)(M,{size:`sm`,className:`oc-kpi__card`,children:[(0,I.jsxs)(O,{children:[(0,I.jsx)(A,{className:`oc-kpi__card-title`,children:e.label}),(0,I.jsx)(j,{className:`oc-kpi__card-metric`,children:(0,I.jsx)(`code`,{children:e.metric})})]}),(0,I.jsxs)(k,{className:`oc-kpi__card-body`,children:[(0,I.jsxs)(`div`,{className:`oc-kpi__value-row`,children:[(0,I.jsx)(`span`,{className:`oc-kpi__value`+(e.isError&&r>0?` oc-kpi__value--error`:``),children:Q(r)}),(0,I.jsx)(`span`,{className:`oc-kpi__unit`,children:e.unit})]}),(0,I.jsx)(ae,{series:t,isError:e.isError,unit:e.unit}),(0,I.jsxs)(`div`,{className:`oc-kpi__axis`,children:[n?(0,I.jsx)(`span`,{className:`oc-kpi__axis-latest`,children:b({value:$(n.bucket)})}):(0,I.jsx)(`span`,{className:`oc-kpi__muted`,children:x()}),(0,I.jsx)(`span`,{className:`oc-kpi__muted`,children:h({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":m({max:Q(r),unit:n}),children:e.map((e,o)=>{let s=r>0?e.value/r*(Z-1):0,c=o*i,l=Z-s;return(0,I.jsx)(`rect`,{className:`oc-kpi__bar`+(t&&e.value>0?` oc-kpi__bar--error`:``),x:c,y:l,width:a,height:s,children:(0,I.jsxs)(`title`,{children:[$(e.bucket),` · `,Q(e.value),` `,n]})},e.bucket)})})}function Q(e){return Number.isFinite(e)?Math.abs(e)>=1e3?(e/1e3).toFixed(e%1e3==0?0:1)+`k`:String(e):`0`}function $(e){let t=new Date(`${e}:00:00Z`);return Number.isNaN(t.getTime())?e:`${String(t.getUTCDate()).padStart(2,`0`)}/${String(t.getUTCMonth()+1).padStart(2,`0`)} ${String(t.getUTCHours()).padStart(2,`0`)}h`}export{q as KpiTab};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$C as r,AE as i,BC as a,CD as o,CE as s,DE as c,EE as l,FE as ee,GC as u,HC as d,IC as f,JC as p,KC as m,LC as h,ME as te,NE as ne,OE as g,PE as re,QC as ie,RC as ae,RE as oe,SD as _,TE as se,UC as v,UE as ce,VC as le,WC as ue,XC as y,YC as de,ZC as fe,aw as b,cw as x,dw as S,ew as C,fw as w,gD as T,hw as E,iw as D,jE as O,kE as k,lw as A,mw as j,nw as M,ow as N,pw as P,qC as F,rw as I,sw as L,tw as R,uw as z,wE as B,xg as V,zC as pe}from"./dist-BzNYkP4V.js";import{t as H}from"./button-DXGXeanX.js";import{A as me,C as he,O as ge,S as _e,Z as U,_ as W,b as ve,ot as G,x as K,y as ye}from"./index-CKlFEsq3.js";var q=t(e(),1),J=[{id:`messages`,label:()=>E()},{id:`composer`,label:()=>j()},{id:`sidebar`,label:()=>P()},{id:`other`,label:()=>w()}],Y={showSource:{category:`messages`,label:()=>S(),help:()=>z()},showReport:{category:`messages`,label:()=>A(),help:()=>x()},copyAssistant:{category:`messages`,label:()=>L()},copyUser:{category:`messages`,label:()=>N()},showDelete:{category:`messages`,label:()=>b()},showTools:{category:`messages`,label:()=>D(),help:()=>I()},voiceInput:{category:`composer`,label:()=>M(),help:()=>R()},showChatAge:{category:`sidebar`,label:()=>C(),help:()=>r()},showChatProvider:{category:`sidebar`,label:()=>ie(),help:()=>fe()}};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:()=>a()};function De({prefKey:e,ui:t}){let n=_(T.admin.setUiPrefDefault),r=_(T.admin.setFeatureEnabled),i=Te(e),a=i?Ee[e]?.():void 0;return(0,$.jsxs)(`div`,{className:`oc-prefs__gov`,children:[(0,$.jsxs)(`div`,{className:`oc-prefs__gov-row`,children:[(0,$.jsx)(`span`,{className:`oc-prefs__gov-label`,children:ue()}),(0,$.jsxs)(ye,{value:we(t.defaults[e]),onValueChange:t=>void n({key:e,value:Q(t)}),children:[(0,$.jsx)(_e,{size:`sm`,className:`w-36`,children:(0,$.jsx)(he,{})}),(0,$.jsxs)(ve,{children:[(0,$.jsx)(K,{value:`on`,children:ae()}),(0,$.jsx)(K,{value:`off`,children:h()}),(0,$.jsx)(K,{value:`inherit`,children:f()})]})]}),i?(0,$.jsxs)(`span`,{className:`oc-prefs__gov-gate`,children:[(0,$.jsx)(W,{checked:t.featuresEnabled[i]===!0,onCheckedChange:e=>void r({key:i,enabled:e===!0}),"aria-label":v()}),v()]}):null]}),a?(0,$.jsx)(`span`,{className:`oc-prefs__gov-help`,children:a}):null]})}function Oe(){let[e,t]=(0,q.useState)(``),[n,r]=(0,q.useState)(!1),i=o(T.me.getMe,{host:G}),a=i?.ui,s=Z(i?.role)&&n,c=_(T.me.setUiPref).withOptimisticUpdate(ge),l=(0,q.useMemo)(()=>a?be(Object.keys(a.effective),e):[],[a,e]);return a?(0,$.jsxs)(`div`,{className:`oc-prefs-panel`,children:[Z(i?.role)?(0,$.jsxs)(`label`,{className:`oc-prefs__gov-toggle`,children:[(0,$.jsx)(W,{checked:n,onCheckedChange:e=>r(e===!0),"aria-label":u()}),u()]}):null,s?(0,$.jsxs)(`div`,{className:`oc-prefs__gov-head`,children:[(0,$.jsx)(`p`,{children:d()}),(0,$.jsx)(`p`,{children:le()}),(0,$.jsx)(`p`,{children:pe()})]}):null,(0,$.jsx)(U,{value:e,onChange:e=>t(e.target.value),placeholder:y(),"aria-label":y(),className:`mb-2`}),l.length===0?(0,$.jsx)(`div`,{className:`oc-prefs__empty`,children:de()}):(0,$.jsx)(`div`,{className:`oc-prefs`,children:l.map(e=>(0,$.jsxs)(`div`,{className:`oc-prefs__group`,children:[(0,$.jsx)(`h4`,{className:`oc-prefs__cat`,children:e.label}),e.keys.map(e=>{let t=Y[e],n=t?t.label():e,r=t?.help?.(),i=a.locked[e],o=a.effective[e],l=a.userOverrides[e]!==void 0;return(0,$.jsxs)(`div`,{className:`oc-prefs__row${i?` is-locked`:``}${l&&!i?` is-overridden`:``}`,children:[(0,$.jsxs)(`div`,{className:`oc-prefs__info`,children:[(0,$.jsxs)(`span`,{className:`oc-prefs__label`,children:[n,i?(0,$.jsx)(`span`,{className:`oc-prefs__lock`,children:p()}):l?null:(0,$.jsx)(`span`,{className:`oc-prefs__def`,children:F()})]}),r?(0,$.jsx)(`span`,{className:`oc-prefs__help`,children:r}):null]}),(0,$.jsxs)(`div`,{className:`oc-prefs__ctl`,children:[!i&&l?(0,$.jsx)(`button`,{type:`button`,className:`oc-prefs__reset`,onClick:()=>void c({key:e,value:null}),children:m()}):null,(0,$.jsx)(W,{checked:o,disabled:i,onCheckedChange:t=>void c({key:e,value:t===!0}),"aria-label":n})]}),s?(0,$.jsx)(De,{prefKey:e,ui:a}):null]},e)})]},e.id))})]}):(0,$.jsx)(`div`,{className:`oc-prefs__empty`,children:ce()})}function ke(){let e=o(T.me.getMe,{host:G}),t=_(T.me.setLocale),n=_(T.me.setMyName),r=me(),a=e?.locale??`default`,u=e?.name??``,[d,f]=(0,q.useState)(null),p=d??u,m=p.trim()!==u.trim();async function h(){try{await n({name:p}),f(null),r.success(O())}catch(e){r.error(i(),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:ee()}),(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:p,maxLength:120,placeholder:ne(),onChange:e=>f(e.target.value),onKeyDown:e=>{e.key===`Enter`&&m&&(e.preventDefault(),h())}}),(0,$.jsx)(H,{size:`sm`,disabled:!m,onClick:()=>void h(),children:V()})]}),(0,$.jsx)(`p`,{className:`oc-show__desc`,children:te()})]}),(0,$.jsxs)(`section`,{className:`oc-show__section`,children:[(0,$.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,$.jsx)(`h2`,{className:`oc-show__title`,children:k()}),(0,$.jsx)(`p`,{className:`oc-show__desc`,children:g()})]}),(0,$.jsx)(`div`,{className:`oc-show__row`,children:[`fr`,`en`,`default`].map(e=>(0,$.jsx)(H,{variant:a===e?`default`:`outline`,size:`sm`,onClick:()=>void t({locale:e==="default"?null:e}),children:e===`fr`?B():e===`en`?s():oe()},e))}),(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:l()}),(0,$.jsx)(`p`,{className:`oc-show__desc`,children:se()})]}),(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{Au as r,Bu as i,CD as a,Fu as o,Gu as s,Hu as c,Iu as l,Ku as u,Lu as d,Mu as f,Nu as p,Ou as m,Pu as h,Ru as g,SD as _,Uu as v,Vu as y,Wu as b,ed as x,gD as S,ju as C,ku as w,qu as T,td as E,zu as D}from"./dist-BzNYkP4V.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-X2EAqICh.js";import{t as I}from"./button-DXGXeanX.js";import{A as L,C as R,S as z,_ as B,b as V,x as H,y as U}from"./index-CKlFEsq3.js";/* empty css */var W=t(e(),1),G=n(),K={media_delivery:{label:c,help:y},documentary_fetch:{label:i,help:D},inbound_files:{label:g,help:d}},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:r,references:w,files:m};function Y(){let e=a(S.admin.listInstances,{}),[t,n]=(0,W.useState)(null);if(e===void 0)return(0,G.jsx)(`div`,{className:`oc-settings__tab-loading`,"aria-busy":`true`});if(e.length===0)return(0,G.jsx)(`div`,{className:`oc-injtab`,children:(0,G.jsx)(`p`,{className:`oc-admin__hint`,children:o()})});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:T(),help:u()}),(0,G.jsxs)(`label`,{className:`oc-injtab__picker`,children:[(0,G.jsx)(`span`,{children:l()}),(0,G.jsxs)(U,{value:r._id,onValueChange:e=>n(e),children:[(0,G.jsx)(z,{size:`sm`,className:`min-w-44`,children:(0,G.jsx)(R,{})}),(0,G.jsx)(V,{children:e.map(e=>(0,G.jsx)(H,{value:e._id,children:e.displayName??e.name},e._id))})]})]})]}),(0,G.jsx)(X,{instance:r},r._id)]})}function X({instance:e}){let t=_(S.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:E()})})]})}function Z({injKey:e,def:t,i18n:n,row:r,onChange:i}){let[a,o]=(0,W.useState)(!1),c=r.template.trim()!==t.defaultTemplate,l=t.togglable&&!r.enabled,u=Object.fromEntries(t.placeholders.map(e=>[e,q[e]??`{${e}}`])),d=O(e,r),m=d?k(d,u):``;return(0,G.jsxs)(`section`,{className:`oc-injcard`,children:[(0,G.jsxs)(`div`,{className:`oc-injcard__head`,children:[t.togglable?(0,G.jsxs)(`label`,{className:`oc-field--row`,children:[(0,G.jsx)(B,{checked:r.enabled,onCheckedChange:e=>i({enabled:e===!0})}),(0,G.jsx)(M,{label:n.label(),help:n.help()})]}):(0,G.jsx)(M,{label:n.label(),help:n.help()}),c&&(0,G.jsx)(`span`,{className:`oc-injection__badge`,children:b()})]}),(0,G.jsx)(`textarea`,{className:`oc-injcard__text`,value:r.template,disabled:l,rows:8,spellCheck:!1,onChange:e=>i({template:e.target.value})}),(0,G.jsxs)(`div`,{className:`oc-injection__foot`,children:[(0,G.jsxs)(`div`,{className:`oc-injcard__phs`,children:[(0,G.jsx)(`span`,{className:`oc-injection__ph`,children:v()}),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:()=>o(e=>!e),children:a?p():h()}),c&&(0,G.jsx)(I,{variant:`ghost`,size:`sm`,onClick:()=>i({template:t.defaultTemplate}),children:s()})]})]}),a&&(0,G.jsx)(`div`,{className:`oc-injcard__preview`,children:m?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`pre`,{className:`oc-injcard__previewtext`,children:m}),(0,G.jsx)(`span`,{className:`oc-injection__ph`,children:f()})]}):(0,G.jsx)(`span`,{className:`oc-injection__ph`,children:C()})})]})}export{Y as PromptInjectionsTab};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$p as r,Am as i,CD as ee,Cm as te,Dm as a,Em as o,Fm as s,Im as c,Lm as l,Mm as u,Nm as d,Om as f,Pm as p,Qp as m,Rm as h,SD as g,Sm as _,Tm as v,Xp as y,Zp as b,_m as x,bm as S,dm as ne,em as re,fm as ie,gD as C,gm as ae,hm as w,im as T,jm as E,km as D,mm as O,nm as k,pm as A,rm as j,tm as M,um as N,vm as P,wm as F,xm as I,ym as L,zm as R}from"./dist-BzNYkP4V.js";import{t as z}from"./button-DXGXeanX.js";import{A as B,X as V,Z as H,_ as U,j as W,m as G,xt as K}from"./index-CKlFEsq3.js";import{t as q}from"./roleDescriptions-BN-dndvd.js";var J=t(e(),1),Y=n(),X=[{group:()=>R(),keys:[{key:`traces.read`,label:()=>p()},{key:`traces.read.content`,label:()=>d(),phi:!0},{key:`traces.write`,label:()=>u()}]},{group:()=>h(),keys:[{key:`kpi.read`,label:()=>p()},{key:`kpi.write`,label:()=>u()}]},{group:()=>l(),keys:[{key:`openclaw.query`,label:()=>E()},{key:`anomalies.read`,label:()=>i()},{key:`anomalies.report`,label:()=>D()}]},{group:()=>c(),keys:[{key:`chats.read`,label:()=>p()},{key:`selfheal`,label:()=>a()}]},{group:()=>s(),keys:[{key:`admin.manage`,label:()=>f()}]}],oe=X.flatMap(e=>e.keys.map(e=>e.key));function Z(e){return e.includes(`*`)}var Q={key:``,name:``,description:``};function $(){let e=ee(C.apiKeys.listRoles,{}),t=g(C.apiKeys.createRole),n=g(C.apiKeys.ensureRolesSeeded),i=g(C.apiKeys.updateRolePermissions).withOptimisticUpdate((e,{roleId:t,permissions:n})=>{let r=e.getQuery(C.apiKeys.listRoles,{});r&&e.setQuery(C.apiKeys.listRoles,{},r.map(e=>e._id===t?{...e,permissions:n}:e))}),a=W(),s=B(),[c,l]=(0,J.useState)(!1),[u,d]=(0,J.useState)(Q),[f,p]=(0,J.useState)(new Set);(0,J.useEffect)(()=>{n({}).catch(e=>{s.error(v(),e)})},[n,s]);let h=e??[];async function E(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:F({name:e.name}),description:te(),confirmLabel:_()}))){p(t=>new Set(t).add(e._id));try{await i({roleId:e._id,permissions:n})}catch(e){s.error(I(),e)}finally{p(t=>{let n=new Set(t);return n.delete(e._id),n})}}}async function D(){try{await t({key:u.key,name:u.name,description:u.description||void 0,permissions:[]}),d(Q),l(!1)}catch(e){s.error(S(),e)}}let R=e===void 0,$=!R&&h.length===0;return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(`p`,{className:`oc-admin__hint`,children:[L(),` `,(0,Y.jsx)(`code`,{children:`admin`}),` `,P(),` `,(0,Y.jsx)(`code`,{children:`traces.read.content`}),` `,x()]}),(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:ae()}),(0,Y.jsx)(`div`,{className:`oc-dt__bar-actions`,children:(0,Y.jsx)(z,{size:`sm`,onClick:()=>{d(Q),l(!0)},children:w()})})]}),R?(0,Y.jsx)(`p`,{className:`oc-admin__hint`,children:O()}):$?(0,Y.jsx)(`p`,{className:`oc-admin__hint`,children:A()}):(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:ie()}),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?o({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:h.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,{}),` `,ne()]}):(0,Y.jsx)(V,{variant:`secondary`,children:N()})]}),q(e)?(0,Y.jsx)(`p`,{className:`oc-matrix__roledesc`,children:q(e)}):null]}),oe.map(r=>(0,Y.jsx)(`td`,{className:`oc-matrix__cell`,children:(0,Y.jsx)(U,{checked:t||e.permissions.includes(r),disabled:t||n,"aria-label":`${e.key} · ${r}`,title:t?T():n?j():r,onCheckedChange:()=>void E(e,r)})},r))]},e.key)})})]})})]}),(0,Y.jsx)(G,{open:c,onOpenChange:l,title:k(),description:M(),canSubmit:!!(u.key&&u.name),onSubmit:D,submitLabel:re(),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:r()}),(0,Y.jsx)(H,{value:u.key,placeholder:m(),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:b()}),(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:y()}),(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{$S as r,AC as i,AS as a,BS as ee,CC as te,CD as o,CS as s,DC as ne,DS as c,EC as re,ES as l,FC as ie,FS as u,GS as ae,HS as oe,IS as d,JS as se,KS as ce,LS as f,MC as le,MS as p,NC as ue,NS as de,OC as fe,OS as pe,PC as me,PS as he,QS as ge,RS as m,SC as _e,SD as h,SS as g,TC as ve,TS as _,US as ye,VS as be,WS as xe,XS as Se,YS as Ce,ZS as we,_C as Te,_S as v,aC as Ee,bC as De,bD as Oe,bS as y,cC as ke,dC as Ae,eC as je,fC as Me,gC as Ne,gD as b,gS as x,hC as Pe,hS as S,iC as Fe,jC as Ie,jS as C,kC as w,kS as T,lC as Le,mC as Re,nC as ze,oC as Be,pC as Ve,qS as He,rC as Ue,sC as We,tC as Ge,uC as Ke,vC as qe,vS as E,wC as Je,wS as D,xC as Ye,xS as O,yC as Xe,yS as k,zS as Ze}from"./dist-BzNYkP4V.js";import{n as A}from"./dist-CWfWFr7t.js";import{i as Qe}from"./dist-AH7-HhdT.js";import{t as j}from"./button-DXGXeanX.js";import{$ as M,A as $e,At as et,C as N,Dt as P,Mt as tt,Q as F,S as I,X as L,Z as R,b as z,et as B,j as nt,jt as rt,m as it,nt as V,rt as H,tt as at,x as U,y as W}from"./index-CKlFEsq3.js";import{t as ot}from"./FilterBar-CSA8xMkl.js";import{t as st}from"./DataTableShell-C1ZKbpq3.js";import{t as ct}from"./roleDescriptions-BN-dndvd.js";var G=t(e(),1),K=n(),q=[{value:`never`,label:()=>O(),days:null},{value:`30`,label:()=>y(),days:30},{value:`90`,label:()=>k(),days:90}],lt=720*60*60*1e3,J=`__all__`,Y={name:``,roleKey:``,description:``};function X(){let e=tt({from:`/settings/serviceAccounts`}),t=rt({from:`/settings/serviceAccounts`}),n=e.q??``,a=e.status??J,[s,c]=(0,G.useState)(J),l=e=>void t({search:t=>({...t,q:e||void 0}),replace:!0}),u=e=>void t({search:t=>({...t,status:e===J?void 0:e})}),d=o(b.apiKeys.listServiceAccounts,{filter:{q:n||void 0,role:s===J?void 0:s,disabled:a===J?void 0:a===`disabled`}}),f=o(b.apiKeys.listKeys,{}),p=o(b.apiKeys.listRoles,{}),de=h(b.apiKeys.createServiceAccount),pe=h(b.apiKeys.updateServiceAccount),he=h(b.apiKeys.deleteServiceAccount),m=Oe(b.apiKeys.mintApiKey),g=h(b.apiKeys.revokeApiKey),_=nt(),v=$e(),y=n!==``||s!==J||a!==J;function x(){c(J),t({search:{},replace:!0})}let[S,C]=(0,G.useState)(!1),[T,E]=(0,G.useState)(Y),[D,O]=(0,G.useState)(null),[k,A]=(0,G.useState)(new Set),[M,P]=(0,G.useState)(null),F=(0,G.useRef)(!1),[B,V]=(0,G.useState)(new Set),[H,at]=(0,G.useState)({}),[lt,X]=(0,G.useState)(null),Z=(0,G.useMemo)(()=>{let e=new Map;for(let t of f??[]){let n=e.get(t.serviceAccountId)??[];n.push(t),e.set(t.serviceAccountId,n)}return e},[f]);function Q(e){A(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})}async function ft(){try{D?(await pe({serviceAccountId:D,name:T.name,roleKey:T.roleKey,description:T.description}),v.success(r())):await de({name:T.name,roleKey:T.roleKey,description:T.description||void 0}),E(Y),O(null),C(!1)}catch(e){v.error(D?je():Ge(),e)}}function pt(e){E({name:e.name,roleKey:e.roleKey,description:e.description??``}),O(e._id),C(!0)}async function $(e){if(F.current)return;F.current=!0;let t=H[e._id]??`never`,n=q.find(e=>e.value===t)?.days??null,r=n?Date.now()+n*24*60*60*1e3:void 0;P(e._id);try{let t=await m({serviceAccountId:e._id,expiresAt:r});X({accountName:e.name,plaintext:t.plaintext,prefix:t.prefix,lastFour:t.lastFour})}catch(e){v.error(ge(),e)}finally{F.current=!1,P(null)}}async function mt(e){if(await _({title:we(),description:(0,K.jsxs)(K.Fragment,{children:[Se(),` `,(0,K.jsx)(`span`,{className:`font-mono`,children:e.name}),` `,Ce(),` `,(0,K.jsx)(`strong`,{children:se()}),` `,He()]}),confirmWord:e.name,confirmLabel:ce(),destructive:!0}))try{await he({serviceAccountId:e._id}),v.success(ae(),e.name)}catch(e){v.error(xe(),e)}}async function ht(e){if(await _({title:ye(),description:(0,K.jsxs)(K.Fragment,{children:[oe(),` `,(0,K.jsxs)(`span`,{className:`font-mono`,children:[e.prefix,`…`,e.lastFour]}),` `,be()]}),confirmLabel:ee(),destructive:!0})&&!B.has(e._id)){V(t=>new Set(t).add(e._id));try{await g({keyId:e._id})}catch(e){v.error(Ze(),e)}finally{V(t=>{let n=new Set(t);return n.delete(e._id),n})}}}return(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`p`,{className:`oc-admin__hint`,children:ie()}),(0,K.jsxs)(ot,{q:n,onQChange:l,searchPlaceholder:me(),onReset:x,canReset:y,children:[(0,K.jsxs)(W,{value:s,onValueChange:c,children:[(0,K.jsx)(I,{size:`sm`,className:`w-40`,children:(0,K.jsx)(N,{placeholder:ue()})}),(0,K.jsxs)(z,{children:[(0,K.jsx)(U,{value:J,children:le()}),(p??[]).map(e=>(0,K.jsx)(U,{value:e.key,children:e.key},e._id))]})]}),(0,K.jsxs)(W,{value:a,onValueChange:u,children:[(0,K.jsx)(I,{size:`sm`,className:`w-36`,children:(0,K.jsx)(N,{})}),(0,K.jsxs)(z,{children:[(0,K.jsx)(U,{value:J,children:Ie()}),(0,K.jsx)(U,{value:`active`,children:i()}),(0,K.jsx)(U,{value:`disabled`,children:w()})]})]})]}),(0,K.jsx)(st,{title:fe(),rows:d,addLabel:ne(),onAdd:()=>{E(Y),O(null),C(!0)},emptyHint:re(),isExpanded:e=>k.has(e._id),renderExpanded:e=>(0,K.jsx)(ut,{account:e,keys:Z.get(e._id)??[],onRevoke:ht,revoking:B}),rowActions:e=>[{label:_e(),onSelect:()=>pt(e)},{label:ve(),onSelect:()=>void $(e)},{label:k.has(e._id)?Je():te(),onSelect:()=>Q(e._id)},{label:Ye(),variant:`destructive`,onSelect:()=>void mt(e)}],columns:[{header:``,className:`w-8`,cell:e=>(0,K.jsx)(j,{variant:`ghost`,size:`icon-sm`,"aria-label":k.has(e._id)?De():Xe(),onClick:()=>Q(e._id),children:k.has(e._id)?(0,K.jsx)(Qe,{}):(0,K.jsx)(et,{})})},{header:qe(),sort:e=>e.name,cell:e=>(0,K.jsxs)(`div`,{className:`flex flex-col`,children:[(0,K.jsx)(`span`,{children:e.name}),e.description?(0,K.jsx)(`span`,{className:`text-muted-foreground text-xs`,children:e.description}):null]})},{header:Te(),sort:e=>e.roleKey,cell:e=>(0,K.jsx)(L,{variant:`secondary`,children:e.roleKey})},{header:Ne(),sort:e=>+!!e.disabled,cell:e=>e.disabled?(0,K.jsx)(L,{variant:`destructive`,children:w()}):(0,K.jsx)(L,{variant:`outline`,children:i()})},{header:Pe(),cell:e=>(0,K.jsxs)(W,{value:H[e._id]??`never`,onValueChange:t=>at(n=>({...n,[e._id]:t})),children:[(0,K.jsx)(I,{size:`sm`,className:`w-32`,children:(0,K.jsx)(N,{})}),(0,K.jsx)(z,{children:q.map(e=>(0,K.jsx)(U,{value:e.value,children:e.label()},e.value))})]})},{header:Re(),sort:e=>(Z.get(e._id)??[]).filter(e=>!e.disabled).length,cell:e=>{let t=(Z.get(e._id)??[]).filter(e=>!e.disabled).length;return(0,K.jsx)(`span`,{className:`oc-sa__keycount`,children:M===e._id?Ve():Me({count:t})})}}]}),(0,K.jsx)(it,{open:S,onOpenChange:e=>{C(e),e||O(null)},title:D?Ae():ke(),description:D?Ke():We(),canSubmit:!!(T.name&&T.roleKey),onSubmit:ft,submitLabel:D?Le():Be(),children:(0,K.jsxs)(`div`,{className:`oc-form`,children:[(0,K.jsxs)(`label`,{className:`oc-field`,children:[(0,K.jsx)(`span`,{className:`oc-field__label`,children:Ee()}),(0,K.jsx)(R,{value:T.name,onChange:e=>E({...T,name:e.target.value})})]}),(0,K.jsxs)(`label`,{className:`oc-field`,children:[(0,K.jsx)(`span`,{className:`oc-field__label`,children:Fe()}),(0,K.jsxs)(W,{value:T.roleKey||void 0,onValueChange:e=>E({...T,roleKey:e}),children:[(0,K.jsx)(I,{className:`w-full`,children:(0,K.jsx)(N,{placeholder:Ue()})}),(0,K.jsx)(z,{children:(p??[]).map(e=>(0,K.jsxs)(U,{value:e.key,children:[e.name,` (`,e.key,`)`]},e._id))})]}),(()=>{let e=(p??[]).find(e=>e.key===T.roleKey),t=e?ct(e):null;return t?(0,K.jsx)(`span`,{className:`text-muted-foreground text-xs`,children:t}):null})()]}),(0,K.jsxs)(`label`,{className:`oc-field`,children:[(0,K.jsx)(`span`,{className:`oc-field__label`,children:ze()}),(0,K.jsx)(R,{value:T.description,onChange:e=>E({...T,description:e.target.value})})]})]})}),(0,K.jsx)(dt,{minted:lt,onClose:()=>X(null)})]})}function ut({account:e,keys:t,onRevoke:n,revoking:r}){return(0,K.jsxs)(`div`,{className:`oc-sa__keys`,children:[(0,K.jsxs)(`div`,{className:`oc-sa__keys-head`,children:[m(),` `,(0,K.jsx)(`span`,{className:`font-medium`,children:e.name})]}),t.length===0?(0,K.jsx)(`p`,{className:`oc-admin__hint`,children:f()}):(0,K.jsxs)(`table`,{className:`oc-sa__keytable`,children:[(0,K.jsx)(`thead`,{children:(0,K.jsxs)(`tr`,{children:[(0,K.jsx)(`th`,{children:d()}),(0,K.jsx)(`th`,{children:u()}),(0,K.jsx)(`th`,{children:he()}),(0,K.jsx)(`th`,{children:de()}),(0,K.jsx)(`th`,{children:p()}),(0,K.jsx)(`th`,{children:C()}),(0,K.jsx)(`th`,{})]})}),(0,K.jsx)(`tbody`,{children:t.map(t=>(0,K.jsxs)(`tr`,{children:[(0,K.jsx)(`td`,{children:(0,K.jsxs)(`code`,{className:`oc-sa__keyid`,children:[t.prefix,`…`,t.lastFour]})}),(0,K.jsx)(`td`,{children:(0,K.jsx)(L,{variant:`secondary`,children:e.roleKey})}),(0,K.jsx)(`td`,{children:Z(t.createdAt)}),(0,K.jsx)(`td`,{className:Q(t.lastUsedAt)?`oc-sa__stale`:``,children:ft(t.lastUsedAt)}),(0,K.jsx)(`td`,{children:pt(t.expiresAt)}),(0,K.jsx)(`td`,{children:$(t)}),(0,K.jsx)(`td`,{className:`text-right`,children:t.disabled?null:(0,K.jsx)(j,{variant:`destructive`,size:`sm`,disabled:r.has(t._id),onClick:()=>n(t),children:r.has(t._id)?a():T()})})]},t._id))})]})]})}function dt({minted:e,onClose:t}){let[n,r]=(0,G.useState)(!1);async function i(){if(e)try{await navigator.clipboard.writeText(e.plaintext),r(!0),window.setTimeout(()=>r(!1),2e3)}catch{}}return(0,K.jsx)(F,{open:e!==null,onOpenChange:e=>{e||(r(!1),t())},children:e?(0,K.jsxs)(M,{className:`max-w-lg`,showCloseButton:!1,onInteractOutside:e=>e.preventDefault(),onEscapeKeyDown:e=>e.preventDefault(),children:[(0,K.jsxs)(V,{children:[(0,K.jsx)(H,{children:pe()}),(0,K.jsx)(B,{children:c({name:e.accountName})})]}),(0,K.jsx)(`div`,{className:`oc-sa__minted-warning`,children:l()}),(0,K.jsxs)(`div`,{className:`oc-sa__minted-box`,children:[(0,K.jsx)(`code`,{className:`oc-sa__minted-plain`,children:e.plaintext}),(0,K.jsxs)(j,{variant:`outline`,size:`sm`,onClick:()=>void i(),"aria-label":_(),children:[n?(0,K.jsx)(A,{}):(0,K.jsx)(P,{}),n?D():s()]})]}),(0,K.jsx)(at,{children:(0,K.jsx)(j,{onClick:()=>{r(!1),t()},children:g()})})]}):null})}function Z(e){return new Date(e).toLocaleString(`fr-FR`)}function Q(e){return e===null?!1:Date.now()-e>lt}function ft(e){return e===null?E():new Date(e).toLocaleString(`fr-FR`)}function pt(e){return e===null?`—`:new Date(e).toLocaleDateString(`fr-FR`)}function $(e){return e.disabled?(0,K.jsx)(L,{variant:`destructive`,children:v()}):e.expiresAt!==null&&e.expiresAt<Date.now()?(0,K.jsx)(L,{variant:`outline`,children:x()}):(0,K.jsx)(L,{variant:`outline`,children:S()})}export{X 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,CD as o,D as s,E as c,F as l,G as u,H as d,I as f,L as p,M as m,N as h,O as g,P as _,R as v,S as y,SD as b,T as x,U as S,V as C,W as w,_ as T,b as E,c as D,d as O,f as k,g as A,gD as j,h as M,j as N,k as P,l as F,m as I,p as ee,s as L,u as R,v as z,w as B,x as V,y as H,z as U}from"./dist-BzNYkP4V.js";import{t as W}from"./button-DXGXeanX.js";import{j as G}from"./index-CKlFEsq3.js";import{t as K}from"./DataTableShell-C1ZKbpq3.js";var q=t(e(),1),J=n(),Y={hung:()=>g(),wrong_result:()=>s(),error:()=>c(),other:()=>x()},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=b(j.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:y()}),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():E()}),(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?A():T()})})]}),(0,J.jsxs)(`section`,{children:[(0,J.jsxs)(`h4`,{className:`oc-fbadmin__h`,children:[M({count:t.children.length}),t.childrenTruncated?` ${I()}`:``,t.textTruncated?` ${ee()}`:``]}),(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?` · ${k()}`:``]}),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:O()}),(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:R()}),(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=o(j.subAgentReports.listForAdmin,{}),t=b(j.subAgentReports.readReport),n=b(j.subAgentReports.deleteReport),a=G(),[s,c]=(0,q.useState)(null),[g,y]=(0,q.useState)({});async function x(e){if(s===e._id){c(null);return}if(!g[e._id]){let n=await t({reportId:e._id});y(t=>({...t,[e._id]:n}))}c(e._id)}async function T(e){await a({title:F(),description:D(),confirmLabel:L(),destructive:!0})&&(await n({reportId:e._id}),s===e._id&&c(null))}return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(`p`,{className:`oc-admin__hint`,children:[S(),` `,(0,J.jsx)(`strong`,{children:d()}),` `,C()]}),(0,J.jsx)(K,{title:u(),rows:e,emptyHint:w(),isExpanded:e=>s===e._id&&!!g[e._id],renderExpanded:e=>g[e._id]?(0,J.jsx)(Q,{data:g[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:v(),cell:e=>`${e.failedCount}/${e.totalCount}`,sort:e=>e.failedCount},{header:p(),cell:e=>(e.reporterEmail||e.reporterName||`—`)+(e.impersonated&&e.realOperatorEmail?` ${_({operator:e.realOperatorEmail})}`:``),sort:e=>e.reporterEmail||e.reporterName||null},{header:f(),cell:e=>e.hasComment?`✎`:`—`,sort:e=>+!!e.hasComment},{header:l(),cell:e=>e.answered?(0,J.jsx)(`span`,{className:`oc-fbadmin__pill is-ok`,children:h()}):(0,J.jsx)(`span`,{className:`oc-fbadmin__pill`,children:m()}),sort:e=>+!!e.answered}],rowActions:e=>[{label:s===e._id?r():N(),onSelect:()=>void x(e)},{label:P(),onSelect:()=>void T(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{$w as r,AT as i,Aw as a,BE as o,Bw as s,CD as c,CE as l,CT as u,Cw as d,DT as f,Dw as p,ET as m,Ew as h,FT as g,Fw as _,Gw as ee,Hw as v,IT as te,Iw as y,Jw as ne,Kw as re,LT as ie,Lw as ae,MT as oe,Mw as se,NT as ce,Nw as le,OT as b,Ow as ue,PT as de,Pw as fe,Qw as pe,RT as me,Rw as he,SD as x,ST as ge,Sw as _e,TT as ve,Tw as ye,Uw as be,VE as xe,Vw as Se,Ww as Ce,Xw as we,Yw as Te,Zw as Ee,_D as De,_T as Oe,_w as ke,a as S,aT as Ae,bD as je,bT as Me,bw as C,cT as Ne,dT as Pe,eT as Fe,fT as Ie,gD as w,gT as Le,gw as Re,hT as ze,i as Be,iT as Ve,jT as He,jw as Ue,kT as We,kw as Ge,lT as Ke,mT as qe,n as Je,nT as Ye,o as Xe,oT as Ze,pT as Qe,qw as $e,r as et,rT as tt,sT as nt,tT as T,uT as rt,vT as it,vw as at,wE as ot,wT as st,ww as E,xT as ct,xw as lt,yT as ut,yw as dt,zE as ft,zw as pt}from"./dist-BzNYkP4V.js";import{n as D}from"./dist-CWfWFr7t.js";import{t as O}from"./x-DQ_CLIEK.js";import{t as k}from"./button-DXGXeanX.js";import{C as A,Et as mt,G as ht,J as j,K as M,S as N,Tt as P,W as gt,X as F,Y as _t,Z as I,_ as L,at as vt,b as R,it as yt,ot as z,q as bt,x as B,y as V}from"./index-CKlFEsq3.js";import{a as xt,i as St,n as Ct,o as wt,r as Tt,t as Et}from"./card-B60DsQBe.js";import{a as Dt,i as H,n as Ot,o as U,r as W,t as kt}from"./table-AFxsandT.js";import{t as At}from"./TimeRangePicker-CY6cFX3v.js";import{t as jt}from"./FilterBar-CSA8xMkl.js";import{t as Mt}from"./AdvancedFilter-D7QXVQ5_.js";var G=De(`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(pt());if(e.size>Bt)throw Error(he());let{source:n,width:r,height:i,cleanup:a}=await Gt(e);try{let a=e.type===`image/svg+xml`,o=Math.min(Vt/r,Ht/i,a?1/0:1),s=Math.max(1,Math.round(r*o)),c=Math.max(1,Math.round(i*o)),l=document.createElement(`canvas`);l.width=s,l.height=c;let u=l.getContext(`2d`);if(!u)throw Error(y());u.imageSmoothingEnabled=!0,u.imageSmoothingQuality=`high`,u.drawImage(n,0,0,s,c);let d=It(u.getImageData(0,0,s,c).data,s,c)??{x:0,y:0,width:s,height:c},f=document.createElement(`canvas`);f.width=d.width,f.height=d.height;let p=f.getContext(`2d`);if(!p)throw Error(y());if(p.drawImage(l,d.x,d.y,d.width,d.height,0,0,d.width,d.height),t.variantFor){let e=p.getImageData(0,0,d.width,d.height);q(e.data,d.width,d.height)?Rt(e.data,t.variantFor===`dark`?Pt:Ft):zt(e.data),p.putImageData(e,0,0)}let m=q(p.getImageData(0,0,d.width,d.height).data,d.width,d.height),h=await Y(f,`image/webp`,Ut)??await Y(f,`image/png`);if(!h)throw Error(_());return{blob:h,hasAlpha:m}}finally{a()}}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(ae())),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`?xe():e===`dark`?o():ft()}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:Je(`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)(D,{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)(k,{type:`button`,variant:`ghost`,size:`icon`,className:`oc-chart-card__export`,onClick:o,"aria-label":Xe(),title:Xe(),children:(0,X.jsx)(mt,{className:`size-4`})}):null]})}function Qt({selectedKey:e,resolvedMode:t}){let n=c(w.charts.listMyCharts),r=x(w.charts.setMyChart);async function a(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:i()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:We()})]}),(0,X.jsxs)(`div`,{className:`oc-chart-grid`,children:[(0,X.jsx)(Zt,{selected:e===null,title:b(),subtitle:f(),tokens:null,mode:t,onSelect:()=>void a(null)}),(n??[]).map(n=>{let r=n.via===`common`?m():n.via===`owner`?ve():st({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 a(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:u()}):null]})}function $t(){let e=x(w.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(T())}}}async function p(){if(s(null),l(!1),t.trim()===``){s(r());return}let o;try{o=JSON.parse(i)}catch{s(T());return}d(!0);try{await e({name:t.trim(),tokens:o}),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:Ke()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:Ne()})]}),(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:nt()}),(0,X.jsx)(I,{value:t,onChange:e=>n(e.target.value),placeholder:Ze(),maxLength:60})]}),(0,X.jsxs)(`label`,{className:`oc-chart-import__field`,children:[(0,X.jsx)(`span`,{className:`oc-chart-import__label`,children:Ae()}),(0,X.jsx)(`textarea`,{className:`oc-chart-import__textarea`,value:i,onChange:e=>a(e.target.value),placeholder:Ve(),rows:8,spellCheck:!1})]}),(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsx)(k,{variant:`outline`,size:`sm`,asChild:!0,children:(0,X.jsxs)(`label`,{className:`oc-chart-import__file`,children:[(0,X.jsx)(G,{className:`size-4`}),tt(),(0,X.jsx)(`input`,{type:`file`,accept:`application/json,.json`,className:`oc-chart-import__file-input`,onChange:e=>void f(e)})]})}),(0,X.jsx)(k,{size:`sm`,disabled:u,onClick:()=>void p(),children:Ye()})]}),o?(0,X.jsx)(`p`,{className:`oc-chart-import__error`,children:o}):null,c?(0,X.jsx)(`p`,{className:`oc-chart-import__ok`,children:Fe()}):null]})]})}function en({chart:e}){let t=je(w.charts.setChartLogo),n=x(w.charts.removeChartLogo),[r,i]=(0,K.useState)(!1),[a,o]=(0,K.useState)(null),c=t=>t===`light`?e.logoLightUrl:e.logoDarkUrl;async function l(n,r,a){if(e.chartId!==void 0){o(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){o(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){o(null),i(!0);try{await n({chartId:e.chartId,mode:t})}catch(e){o(e instanceof Error?e.message:String(e))}finally{i(!1)}}}async function f(e){let t=c(e===`light`?`dark`:`light`);if(t){o(null),i(!0);try{await l(e,await(await fetch(t)).blob(),e)}catch(e){o(e instanceof Error?e.message:String(e))}finally{i(!1)}}}function p({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`?re():ee()}),(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)(k,{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?be():Ce(),(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)(k,{variant:`ghost`,size:`sm`,disabled:r,onClick:()=>void f(e),children:Se()}):null,t?(0,X.jsx)(k,{variant:`ghost`,size:`sm`,disabled:r,onClick:()=>void d(e),children:v()}):null]})}return(0,X.jsxs)(`div`,{className:`oc-chart-mine__logo`,children:[(0,X.jsx)(`span`,{className:`oc-chart-mine__groups-label`,children:$e()}),(0,X.jsxs)(`div`,{className:`oc-chart-mine__logo-slots`,children:[(0,X.jsx)(p,{mode:`light`}),(0,X.jsx)(p,{mode:`dark`})]}),r?(0,X.jsx)(`span`,{className:`oc-show__desc`,children:s()}):null,a?(0,X.jsx)(`p`,{className:`oc-chart-import__error`,children:a}):null]})}function tn({chart:e}){let t=c(w.me.getMe,{host:z}),n=x(w.charts.addChartDomain),r=x(w.charts.removeChartDomain),[i,o]=(0,K.useState)(``),[s,l]=(0,K.useState)(null),[u,d]=(0,K.useState)(!1);if(t?.role!==`admin`)return null;let f=e.domains??[];async function p(){let t=i.trim();if(t!==``){l(null),d(!0);try{await n({chartKey:e.key,domain:t}),o(``)}catch(e){l(e instanceof Error?e.message:String(e))}finally{d(!1)}}}async function m(t){l(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:fe()}),(0,X.jsxs)(`div`,{className:`oc-chart-mine__domains-body`,children:[(0,X.jsx)(`div`,{className:`oc-chart-avail__groups`,children:f.length===0?(0,X.jsx)(`span`,{className:`oc-show__desc`,children:a()}):f.map(e=>(0,X.jsxs)(F,{variant:`secondary`,className:`oc-chart-avail__chip`,children:[e,(0,X.jsx)(`button`,{type:`button`,className:`oc-chart-avail__chip-x`,"aria-label":Ge({domain:e}),onClick:()=>void m(e),children:(0,X.jsx)(O,{className:`size-3`})})]},e))}),(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsx)(I,{value:i,onChange:e=>o(e.target.value),placeholder:se(),className:`oc-chart-mine__domains-input`,onKeyDown:e=>{e.key===`Enter`&&p()}}),(0,X.jsx)(k,{variant:`outline`,size:`sm`,disabled:u,onClick:()=>void p(),children:Ue()})]}),(0,X.jsx)(`span`,{className:`oc-show__desc`,children:le()}),s?(0,X.jsx)(`p`,{className:`oc-chart-import__error`,children:s}):null]})]})}function nn(e){let t={...e};return delete t.bpm,JSON.stringify(t,null,2)}function rn({chart:e}){let t=x(w.charts.updateChart),n=x(w.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),[m,g]=(0,K.useState)(!1);function _(){o(e.name),c(nn(e.tokens)),u(e.tokens.bpm??0),f(null),i(!0)}async function ee(){if(e.chartId===void 0)return;f(null);let n;try{n=JSON.parse(s)}catch{f(T());return}if(n&&typeof n==`object`&&!Array.isArray(n)){let e=n;l>0?e.bpm=l:delete e.bpm}g(!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{g(!1)}}async function v(){if(e.chartId!==void 0&&window.confirm(E()))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)(k,{variant:`outline`,size:`sm`,onClick:_,children:Te()}),(0,X.jsx)(k,{variant:`ghost`,size:`sm`,onClick:()=>void v(),children:ne()})]})})]}),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:h()}),(0,X.jsx)(I,{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?Be():`${l} BPM`})]}),(0,X.jsx)(`span`,{className:`oc-show__desc`,children:et()})]}),(0,X.jsxs)(`label`,{className:`oc-chart-import__field`,children:[(0,X.jsx)(`span`,{className:`oc-chart-import__label`,children:ye()}),(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)(k,{size:`sm`,disabled:m,onClick:()=>void ee(),children:ue()}),(0,X.jsx)(k,{variant:`ghost`,size:`sm`,onClick:()=>i(!1),children:p()})]})]}):null,(0,X.jsx)(en,{chart:e}),(0,X.jsx)(tn,{chart:e})]})}function an(){let e=c(w.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:pe()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:Ee()})]}),e!==void 0&&t.length===0?(0,X.jsx)(`p`,{className:`oc-show__desc`,children:we()}):(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=x(w.charts.addChartToGroupPool),r=x(w.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)(F,{variant:i?`secondary`:`outline`,className:`oc-chart-avail__state`,children:i?ze():e.kind===`custom`&&e.scope===`personal`?C():Le()}),e.isGlobalDefault?(0,X.jsx)(F,{variant:`default`,children:qe()}):null]}),(0,X.jsxs)(`div`,{className:`oc-chart-avail__groups`,children:[(0,X.jsx)(`span`,{className:`oc-chart-mine__groups-label`,children:Ie()}),(a??[]).map(e=>(0,X.jsxs)(F,{variant:`secondary`,className:`oc-chart-avail__chip`,children:[e.name,(0,X.jsx)(`button`,{type:`button`,className:`oc-chart-avail__chip-x`,"aria-label":rt({group:e.name}),onClick:()=>void l(e.groupId),children:(0,X.jsx)(O,{className:`size-3`})})]},e.groupId)),s.length>0?(0,X.jsxs)(V,{value:``,onValueChange:e=>void c(e),children:[(0,X.jsx)(N,{size:`sm`,className:`w-56`,children:(0,X.jsx)(A,{placeholder:Pe()})}),(0,X.jsx)(R,{children:s.map(e=>(0,X.jsx)(B,{value:e._id,children:e.name},e._id))})]}):t.length===0?(0,X.jsx)(`span`,{className:`oc-show__desc`,children:Qe()}):null]})]})}function sn({chart:e}){let t=x(w.charts.promoteChartToCommon),n=x(w.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(E()))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)(F,{variant:e.scope===`common`?`outline`:`secondary`,children:e.scope===`common`?dt():C()}),e.ownerLabel?(0,X.jsx)(`span`,{className:`oc-show__desc`,children:lt({owner:e.ownerLabel})}):null]}),(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[e.scope===`personal`?(0,X.jsx)(k,{variant:`outline`,size:`sm`,onClick:()=>void r(),children:at()}):null,(0,X.jsx)(k,{variant:`ghost`,size:`sm`,onClick:()=>void i(),children:ke()})]})]})}function cn({defaultThemeMode:e,defaultLocale:t,defaultChartKey:n}){let r=x(w.admin.setDefaultThemeMode),i=x(w.admin.setDefaultLocale),a=x(w.charts.setDefaultChart),o=c(w.charts.listChartsAdmin),s=c(w.groups.listGroups,{}),u=e??`system`,f=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:oe()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:He()})]}),(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:ct()})]}),(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsx)(k,{variant:n===null?`default`:`outline`,size:`sm`,onClick:()=>void a({name:null}),children:b()}),vt.map(e=>(0,X.jsx)(k,{variant:n===e.key?`default`:`outline`,size:`sm`,onClick:()=>void a({name:e.key}),children:e.name},e.key)),(o??[]).filter(e=>e.kind===`custom`&&e.scope===`common`).map(e=>(0,X.jsx)(k,{variant:n===e.key?`default`:`outline`,size:`sm`,onClick:()=>void a({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:Me()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:ut()})]}),(0,X.jsx)(`div`,{className:`oc-chart-avail-list`,children:(o??[]).filter(e=>!(e.kind===`custom`&&e.scope===`common`)).map(e=>(0,X.jsx)(on,{chart:e,groups:s??[]},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:it()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:Oe()})]}),(0,X.jsx)(`div`,{className:`oc-chart-avail-list`,children:(o??[]).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:d()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:_e()})]}),(()=>{let e=(o??[]).filter(e=>e.kind===`custom`);return e.length===0?(0,X.jsx)(`p`,{className:`oc-show__desc`,children:Re()}):(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:me()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:ie()})]}),(0,X.jsx)(`div`,{className:`oc-show__row`,children:[`light`,`dark`,`system`].map(e=>(0,X.jsx)(k,{variant:u===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:te()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:g()})]}),(0,X.jsx)(`div`,{className:`oc-show__row`,children:[`fr`,`en`].map(e=>(0,X.jsx)(k,{variant:f===e?`default`:`outline`,size:`sm`,onClick:()=>void i({locale:e}),children:e===`fr`?ot():l()},e))}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:de()})]})]})}function ln(){let e=c(w.me.getMe,{host:z}),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),[u,d]=(0,K.useState)(Q),f=i!==``||o!==Z||c!==Z;function p(){a(``),s(Z),l(Z),d(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:ce()}),(0,X.jsxs)($,{title:`Buttons`,description:`Variants`,children:[(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsx)(k,{children:`Default`}),(0,X.jsx)(k,{variant:`secondary`,children:`Secondary`}),(0,X.jsx)(k,{variant:`outline`,children:`Outline`}),(0,X.jsx)(k,{variant:`ghost`,children:`Ghost`}),(0,X.jsx)(k,{variant:`destructive`,children:`Destructive`}),(0,X.jsx)(k,{variant:`link`,children:`Link`})]}),(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsx)(k,{size:`sm`,children:`Small`}),(0,X.jsx)(k,{children:`Default`}),(0,X.jsx)(k,{size:`lg`,children:`Large`}),(0,X.jsx)(k,{size:`icon`,"aria-label":`more`,children:(0,X.jsx)(P,{})}),(0,X.jsx)(k,{disabled:!0,children:`Disabled`})]})]}),(0,X.jsx)($,{title:`Badges`,children:(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsx)(F,{children:`Default`}),(0,X.jsx)(F,{variant:`secondary`,children:`Secondary`}),(0,X.jsx)(F,{variant:`outline`,children:`Outline`}),(0,X.jsx)(F,{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)(I,{placeholder:`Text input…`}),(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsxs)(V,{value:n,onValueChange:r,children:[(0,X.jsx)(N,{className:`w-56`,children:(0,X.jsx)(A,{placeholder:`Select…`})}),(0,X.jsxs)(R,{children:[(0,X.jsx)(B,{value:`per-user`,children:`per-user (chacun son agent)`}),(0,X.jsx)(B,{value:`shared`,children:`shared (agent commun)`})]})]}),(0,X.jsxs)(`label`,{className:`oc-show__check`,children:[(0,X.jsx)(L,{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:u,onTimeRangeChange:d,onReset:p,canReset:f,children:[(0,X.jsxs)(V,{value:o,onValueChange:s,children:[(0,X.jsx)(N,{size:`sm`,children:(0,X.jsx)(A,{})}),(0,X.jsxs)(R,{children:[(0,X.jsx)(B,{value:Z,children:`Toutes directions`}),(0,X.jsx)(B,{value:`inbound`,children:`inbound`}),(0,X.jsx)(B,{value:`outbound`,children:`outbound`}),(0,X.jsx)(B,{value:`internal`,children:`internal`})]})]}),(0,X.jsxs)(V,{value:c,onValueChange:l,children:[(0,X.jsx)(N,{size:`sm`,children:(0,X.jsx)(A,{})}),(0,X.jsxs)(R,{children:[(0,X.jsx)(B,{value:Z,children:`Toutes sévérités`}),(0,X.jsx)(B,{value:`info`,children:`info`}),(0,X.jsx)(B,{value:`warn`,children:`warn`}),(0,X.jsx)(B,{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)(At,{value:u,onChange:d})]})]})}),(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)(k,{variant:`outline`,size:`icon`,"aria-label":`Open menu`,children:(0,X.jsx)(P,{})})}),(0,X.jsxs)(ht,{align:`start`,children:[(0,X.jsx)(bt,{children:`Actions`}),(0,X.jsx)(j,{}),(0,X.jsx)(M,{children:`Edit`}),(0,X.jsx)(M,{children:`Duplicate`}),(0,X.jsx)(j,{}),(0,X.jsx)(M,{variant:`destructive`,children:`Delete`})]})]})}),(0,X.jsx)($,{title:`Card`,children:(0,X.jsxs)(Et,{className:`w-80`,children:[(0,X.jsxs)(xt,{children:[(0,X.jsx)(wt,{children:`Instance`}),(0,X.jsx)(Tt,{children:`Non-secret metadata only.`})]}),(0,X.jsx)(Ct,{className:`text-sm text-muted-foreground`,children:`ws://gateway.example.org:18789`}),(0,X.jsxs)(St,{className:`gap-2`,children:[(0,X.jsx)(k,{size:`sm`,children:`Save`}),(0,X.jsx)(k,{size:`sm`,variant:`ghost`,children:`Cancel`})]})]})}),(0,X.jsx)($,{title:`Table`,children:(0,X.jsxs)(kt,{children:[(0,X.jsx)(Dt,{children:(0,X.jsxs)(U,{children:[(0,X.jsx)(H,{className:`w-8`,children:(0,X.jsx)(L,{"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)(Ot,{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)(L,{"aria-label":`select ${e.n}`})}),(0,X.jsx)(W,{className:`font-medium`,children:e.n}),(0,X.jsx)(W,{children:(0,X.jsx)(F,{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)(D,{className:`size-3.5`}),` `,e.s]})}),(0,X.jsx)(W,{children:(0,X.jsx)(k,{variant:`ghost`,size:`icon`,"aria-label":`row actions`,children:(0,X.jsx)(P,{})})})]},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{Al as r,
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Al as r,Dl as i,El as a,Fl as o,Il as s,Ll as c,Ml as l,Nl as u,Ol as d,Pl as f,Tl as p,jl as m,kl as h}from"./dist-BzNYkP4V.js";import{t as g}from"./button-DXGXeanX.js";import{Ot as _,Z as v,ct as y,lt as b,st as x,ut as S,vt as C}from"./index-CKlFEsq3.js";var w=t(e(),1),T={s:1e3,m:6e4,h:36e5,d:864e5,w:6048e5};function E(e,t){let n=e.trim();if(n===`now`)return t;let r=/^now-(\d+)([smhdw])$/.exec(n);if(r===null)return null;let i=Number(r[1]),a=T[r[2]];return!Number.isFinite(i)||a===void 0?null:t-i*a}function D(e,t=Date.now()){return e.kind===`absolute`?{from:e.from,to:e.to}:{from:E(e.from,t)??t-T.h,to:E(e.to,t)??t}}var O=[{label:c(),from:`now-5m`},{label:s(),from:`now-15m`},{label:o(),from:`now-30m`},{label:f(),from:`now-1h`},{label:u(),from:`now-3h`},{label:l(),from:`now-6h`},{label:m(),from:`now-12h`},{label:r(),from:`now-24h`},{label:h(),from:`now-2d`},{label:d(),from:`now-7d`},{label:i(),from:`now-30d`},{label:a(),from:`now-90d`},{label:p(),from:`now-520w`}];function k(e){return new Date(e).toLocaleString(`fr-FR`,{day:`2-digit`,month:`2-digit`,hour:`2-digit`,minute:`2-digit`})}function A(e){if(e.kind===`relative`){let t=O.find(t=>t.from===e.from&&e.to===`now`);return t?t.label:`${e.from} → ${e.to}`}return`${k(e.from)} → ${k(e.to)}`}function j(e){let t=new Date(e),n=e=>String(e).padStart(2,`0`);return`${t.getFullYear()}-${n(t.getMonth()+1)}-${n(t.getDate())}T${n(t.getHours())}:${n(t.getMinutes())}`}function M(e){if(e===``)return null;let t=new Date(e).getTime();return Number.isNaN(t)?null:t}function N(e){let t=e.trim();return t===`true`?!0:t===`false`?!1:t!==``&&Number.isFinite(Number(t))?Number(t):e}var P=n();function F(e){let[t,n]=(0,w.useState)(0);return(0,w.useEffect)(()=>{if(e.kind!==`relative`)return;let t=window.setInterval(()=>n(e=>e+1),3e4);return()=>window.clearInterval(t)},[e.kind]),(0,w.useMemo)(()=>{let{from:t,to:n}=D(e);return e.kind===`absolute`?{from:t,to:n}:{from:I(t),to:I(n)}},[e,t])}function I(e){return Math.floor(e/6e4)*6e4}function L({value:e,onChange:t}){let[n,r]=(0,w.useState)(!1),[i,a]=(0,w.useState)(``),o=D(e),[s,c]=(0,w.useState)(()=>j(o.from)),[l,u]=(0,w.useState)(()=>j(o.to));function d(t){if(t){let t=D(e);c(j(t.from)),u(j(t.to)),a(``)}r(t)}function f(e){t({kind:`relative`,from:e,to:`now`}),r(!1)}function p(){let e=M(s),n=M(l);e===null||n===null||(t({kind:`absolute`,from:e,to:n}),r(!1))}let m=(0,w.useMemo)(()=>{let e=i.trim().toLowerCase();return e===``?O:O.filter(t=>t.label.toLowerCase().includes(e)||t.from.toLowerCase().includes(e))},[i]),h=M(s)!==null&&M(l)!==null;return(0,P.jsxs)(b,{open:n,onOpenChange:d,children:[(0,P.jsx)(S,{asChild:!0,children:(0,P.jsxs)(g,{variant:`outline`,size:`sm`,className:`oc-timerange__trigger`,children:[(0,P.jsx)(_,{}),A(e)]})}),(0,P.jsx)(y,{children:(0,P.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,P.jsxs)(`div`,{className:`oc-timerange__cols`,children:[(0,P.jsxs)(`div`,{className:`oc-timerange__absolute`,children:[(0,P.jsx)(`div`,{className:`oc-timerange__section-title`,children:`Plage absolue`}),(0,P.jsxs)(`label`,{className:`oc-field`,children:[(0,P.jsx)(`span`,{className:`oc-field__label`,children:`De`}),(0,P.jsx)(v,{type:`datetime-local`,value:s,onChange:e=>c(e.target.value)})]}),(0,P.jsxs)(`label`,{className:`oc-field`,children:[(0,P.jsx)(`span`,{className:`oc-field__label`,children:`À`}),(0,P.jsx)(v,{type:`datetime-local`,value:l,onChange:e=>u(e.target.value)})]}),(0,P.jsx)(g,{size:`sm`,className:`oc-timerange__apply`,disabled:!h,onClick:p,children:`Appliquer`})]}),(0,P.jsxs)(`div`,{className:`oc-timerange__relative`,children:[(0,P.jsxs)(`div`,{className:`oc-timerange__search`,children:[(0,P.jsx)(C,{className:`oc-timerange__search-icon`,"aria-hidden":!0}),(0,P.jsx)(v,{value:i,onChange:e=>a(e.target.value),placeholder:`Rechercher une plage`,"aria-label":`Rechercher une plage relative`})]}),(0,P.jsx)(`ul`,{className:`oc-timerange__list`,children:m.length===0?(0,P.jsx)(`li`,{className:`oc-timerange__empty`,children:`Aucune plage.`}):m.map(t=>(0,P.jsx)(`li`,{children:(0,P.jsx)(`button`,{type:`button`,className:`oc-timerange__option`+(e.kind===`relative`&&e.from===t.from&&e.to===`now`?` is-active`:``),onClick:()=>f(t.from),children:t.label})},t.from))})]})]})})})]})}export{F as n,N as r,L as t};
|