@lacneu/atrium 0.33.0 → 0.35.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/{AccessTab-7ikPRDrZ.js → AccessTab-C0Gs7iUK.js} +1 -1
- package/dist/assets/{AdvancedFilter-gsdcm_1A.js → AdvancedFilter-DIvWQV1i.js} +1 -1
- package/dist/assets/AgentFilesTab-Di6WnHuY.js +3 -0
- package/dist/assets/AnomaliesTab-DI8azyvt.js +1 -0
- package/dist/assets/AuditTab-BzYbjLVE.js +1 -0
- package/dist/assets/BridgeTab-BAGIOGBx.js +1 -0
- package/dist/assets/ChatDefaultsTab-D06Rn0br.js +1 -0
- package/dist/assets/{DataTableShell-DzK-qEdq.js → DataTableShell-nb7UG6xl.js} +1 -1
- package/dist/assets/{DetailChips-BIvUUZKQ.js → DetailChips-B2YQy9Nb.js} +1 -1
- package/dist/assets/FeedbacksTab-BjwAoZXc.js +1 -0
- package/dist/assets/{FieldLabel-Cz-9BS36.js → FieldLabel-DrAMRvzk.js} +1 -1
- package/dist/assets/FilesTab-CXvK2QTA.js +1 -0
- package/dist/assets/{FilterBar-CZN4zOuy.js → FilterBar-CDYmDUw2.js} +1 -1
- package/dist/assets/{GroupsTab-q8FOBA9S.js → GroupsTab-ColE5y3Z.js} +1 -1
- package/dist/assets/InstancesTab-B3DNUXG1.js +1 -0
- package/dist/assets/IntegrationsTab-BiNTszi0.js +1 -0
- package/dist/assets/KpiTab-Qtgx_WGW.js +1 -0
- package/dist/assets/PreferencesTab-BoJ3uU66.js +1 -0
- package/dist/assets/PromptInjectionsTab-CRWMranw.js +4 -0
- package/dist/assets/RolesTab-CNKlyefB.js +1 -0
- package/dist/assets/ServiceAccountsTab-Bb_z1Zd2.js +1 -0
- package/dist/assets/SubAgentReportsTab-DrGt_erU.js +1 -0
- package/dist/assets/ThemeShowroom-D9bfB9e-.js +1 -0
- package/dist/assets/{TimeRangePicker-DVDywKqe.js → TimeRangePicker-CD2-qOqD.js} +1 -1
- package/dist/assets/TracesTab-CGApOE9c.js +1 -0
- package/dist/assets/UsersTab-CeaHLZbz.js +1 -0
- package/dist/assets/{button-C3T_nXdg.js → button-BgI9tkZX.js} +1 -1
- package/dist/assets/{card-DESvIpRK.js → card-C0nw-MW3.js} +1 -1
- package/dist/assets/chevrons-up-down-CNTF8s9f.js +1 -0
- package/dist/assets/{compatView-A0wf8Ngm.js → compatView-CKwdSOAo.js} +1 -1
- package/dist/assets/{dispatchErrorInfo-CG5-z2lD.js → dispatchErrorInfo-8iiDNzMm.js} +1 -1
- package/dist/assets/{dist-CpS8aq8T.js → dist-CNjYZaW-.js} +1 -1
- package/dist/assets/{dist-BJuS9RKK.js → dist-DLKTmLXq.js} +5 -5
- package/dist/assets/{dist-B1tb-c2t.js → dist-DTUs9qnE.js} +1 -1
- package/dist/assets/{dist-C5xpMIpa.js → dist-JjvFHcOU.js} +1 -1
- package/dist/assets/{highlighted-body-OFNGDK62-CLCx-LYW.js → highlighted-body-OFNGDK62-Xt_9-n6Z.js} +1 -1
- package/dist/assets/index-D6NQyqlV.js +229 -0
- package/dist/assets/mermaid-GHXKKRXX-PHuLRA0g.js +1 -0
- package/dist/assets/roleDescriptions-DtK7AfJm.js +1 -0
- package/dist/assets/{table-Dgu2YiDE.js → table-CwHklpki.js} +1 -1
- package/dist/assets/{tabs-bHkQWa8h.js → tabs-DjWpx9_s.js} +1 -1
- package/dist/assets/x-ClVgrrpF.js +1 -0
- package/dist/index.html +7 -7
- package/package.json +1 -1
- package/dist/assets/AgentFilesTab-DLXgboNK.js +0 -3
- package/dist/assets/AnomaliesTab-CcTaJJF7.js +0 -1
- package/dist/assets/AuditTab-B51XdrS-.js +0 -1
- package/dist/assets/BridgeTab-B0fJjtmW.js +0 -1
- package/dist/assets/ChatDefaultsTab-IJWE_sxZ.js +0 -1
- package/dist/assets/FeedbacksTab-CRF5np-W.js +0 -1
- package/dist/assets/FilesTab-CUEzcwu7.js +0 -1
- package/dist/assets/InstancesTab-Dl2EJUgc.js +0 -1
- package/dist/assets/IntegrationsTab-hTzia7mx.js +0 -1
- package/dist/assets/KpiTab-DI8vQ1LD.js +0 -1
- package/dist/assets/PreferencesTab-7nFPybn0.js +0 -1
- package/dist/assets/PromptInjectionsTab-R-YFEPfz.js +0 -4
- package/dist/assets/RolesTab-DTUfolk3.js +0 -1
- package/dist/assets/ServiceAccountsTab-WYurhM36.js +0 -1
- package/dist/assets/SubAgentReportsTab-DAd0x6y2.js +0 -1
- package/dist/assets/ThemeShowroom-BclE06WS.js +0 -1
- package/dist/assets/TracesTab-sUddGVLv.js +0 -1
- package/dist/assets/UsersTab-DY-84glO.js +0 -1
- package/dist/assets/chevrons-up-down-RW5J1Q7S.js +0 -1
- package/dist/assets/index-DgeJfwWI.js +0 -229
- package/dist/assets/mermaid-GHXKKRXX-BKfbghLf.js +0 -1
- package/dist/assets/roleDescriptions-D-TCtebQ.js +0 -1
- package/dist/assets/x-DzHSe3Kh.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{E as r,
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{E as r,SA as i,_l as a,al as o,cl as s,dl as c,fl as l,gl as u,hl as d,jA as f,ll as p,ml as m,ol as h,pl as g,sl as _,ul as v,vl as y,yl as b}from"./dist-DLKTmLXq.js";import{$ as x,C as S,S as C,b as w,x as T,y as E}from"./index-D6NQyqlV.js";var D=t(e(),1);function O(e){return e===`user`?p():e===`all`?s():_({group:e.group})}function k(e){return e===`common`?h():e===`owner`?o():_({group:e.group})}var A=n();function j(e){return e.name||e.email||e.userId.slice(0,8)}function M(){let e=f(r.admin.listUsers,{}),[t,n]=(0,D.useState)(``),o=f(r.introspect.introspectUser,t?{userId:t}:`skip`);return(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:b()}),(0,A.jsxs)(E,{value:t,onValueChange:n,children:[(0,A.jsx)(C,{size:`sm`,"aria-label":y(),children:(0,A.jsx)(S,{placeholder:y()})}),(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:a()}):o===void 0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:i()}):(0,A.jsxs)(`div`,{className:`oc-introspect`,children:[(0,A.jsxs)(`section`,{className:`oc-introspect__section`,children:[(0,A.jsx)(`h3`,{className:`oc-introspect__title`,children:u()}),(0,A.jsxs)(`div`,{className:`oc-introspect__id`,children:[(0,A.jsx)(`strong`,{children:o.user.label}),(0,A.jsx)(x,{variant:`secondary`,children:o.role})]})]}),(0,A.jsxs)(`section`,{className:`oc-introspect__section`,children:[(0,A.jsx)(`h3`,{className:`oc-introspect__title`,children:d()}),o.groups.length===0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:c()}):(0,A.jsx)(`div`,{className:`oc-introspect__chips`,children:o.groups.map(e=>(0,A.jsx)(x,{variant:`secondary`,children:e.name},e.groupId))})]}),(0,A.jsxs)(`section`,{className:`oc-introspect__section`,children:[(0,A.jsx)(`h3`,{className:`oc-introspect__title`,children:m()}),o.agents.length===0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:c()}):(0,A.jsx)(`ul`,{className:`oc-introspect__list`,children:o.agents.map(e=>(0,A.jsxs)(`li`,{className:`oc-introspect__row`,children:[(0,A.jsx)(`span`,{className:`oc-introspect__name`,children:e.displayName||e.agentId}),e.isDefault?(0,A.jsx)(x,{variant:`default`,children:v()}):null,(0,A.jsx)(x,{variant:`outline`,children:O(e.via)}),(0,A.jsx)(x,{variant:`secondary`,children:e.state})]},`${e.instanceName} ${e.agentId}`))})]}),(0,A.jsxs)(`section`,{className:`oc-introspect__section`,children:[(0,A.jsx)(`h3`,{className:`oc-introspect__title`,children:g()}),o.charts.length===0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:c()}):(0,A.jsx)(`ul`,{className:`oc-introspect__list`,children:o.charts.map(e=>(0,A.jsxs)(`li`,{className:`oc-introspect__row`,children:[(0,A.jsx)(`span`,{className:`oc-introspect__name`,children:e.name}),(0,A.jsx)(x,{variant:`outline`,children:k(e.via)})]},e.key))})]}),(0,A.jsxs)(`section`,{className:`oc-introspect__section`,children:[(0,A.jsx)(`h3`,{className:`oc-introspect__title`,children:l()}),o.permissions.length===0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:c()}):(0,A.jsx)(`div`,{className:`oc-introspect__chips`,children:o.permissions.map(e=>(0,A.jsx)(x,{variant:`secondary`,children:e},e))})]})]})]})}export{M as AccessTab};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Ad as r,Dd as i,Ed as a,Od as o,Td as s,kd as c,wd as l}from"./dist-
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Ad as r,Dd as i,Ed as a,Od as o,Td as s,kd as c,wd as l}from"./dist-DLKTmLXq.js";import{i as u}from"./dist-CNjYZaW-.js";import{t as d}from"./x-ClVgrrpF.js";import{t as f}from"./button-BgI9tkZX.js";import{C as p,Ct as m,S as h,b as g,et as _,x as v,y}from"./index-D6NQyqlV.js";import{r as b}from"./TimeRangePicker-CD2-qOqD.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}),c(),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:o()}):(0,S.jsx)(`ul`,{className:`oc-advfilter__rows`,children:k.map(t=>(0,S.jsxs)(`li`,{className:`oc-advfilter__row`,children:[(0,S.jsxs)(y,{value:t.field||void 0,onValueChange:e=>M(t.id,{field:e}),children:[(0,S.jsx)(h,{size:`sm`,className:`w-40`,children:(0,S.jsx)(p,{placeholder:i()})}),(0,S.jsx)(g,{children:e.map(e=>(0,S.jsx)(v,{value:e.value,children:e.label},e.value))})]}),(0,S.jsxs)(y,{value:t.op,onValueChange:e=>M(t.id,{op:e}),children:[(0,S.jsx)(h,{size:`sm`,className:`w-28`,children:(0,S.jsx)(p,{})}),(0,S.jsx)(g,{children:C.map(e=>(0,S.jsx)(v,{value:e.value,children:e.label},e.value))})]}),(0,S.jsx)(_,{className:`oc-advfilter__value`,value:t.value,onChange:e=>M(t.id,{value:e.target.value}),placeholder:a()}),(0,S.jsx)(f,{variant:`ghost`,size:`icon-sm`,"aria-label":s(),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)(m,{}),l()]})]}):null]})}export{D as t};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$o as r,$t as i,AA as a,Ao as o,Bo as s,Bt as c,Ct as l,Do as u,Dt as d,E as f,Eo as p,Et as m,Fo as h,Fs as g,Ft as _,Go as v,Gt as y,Ho as b,Ht as x,Io as S,It as C,Jo as w,Jt as T,Ko as E,Kt as D,Lo as O,Ls as k,Lt as A,Mo as j,No as ee,OA as M,Oo as te,Po as N,Pt as P,Qo as ne,Qt as F,Ro as I,Rt as L,SA as R,St as re,To as z,Tt as B,Uo as ie,Ut as V,Vo as ae,Vt as H,Wo as oe,Wt as se,Xo as ce,Xt as le,Yo as ue,Yt as U,Zo as de,Zt as fe,en as pe,es as me,hT as he,jA as W,jo as ge,ko as _e,qo as ve,qt as ye,wA as G,wt as be,xt as xe,zo as Se,zt as Ce}from"./dist-DLKTmLXq.js";import{t as K}from"./button-BgI9tkZX.js";import{$ as we,B as Te,C as Ee,H as De,I as Oe,L as ke,N as q,R as Ae,S as je,U as Me,V as Ne,_t as J,at as Pe,b as Fe,lt as Ie,nt as Le,ot as Re,rt as ze,tt as Be,v as Ve,x as He,y as Ue,z as We}from"./index-D6NQyqlV.js";import{n as Ge,t as Ke}from"./curation-CQksaIbm.js";import{i as qe}from"./compatView-CKwdSOAo.js";/* empty css */var Y=t(e(),1),X=2e4,Je=6e4;function Ye(e){return typeof e!=`number`||e<=0?0:Math.round(e/X*100)}function Xe(e){return e<=0?0:Math.round(e/Je*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 Ze(e){return e.reduce((e,t)=>e+(typeof t.size==`number`&&t.size>0?t.size:0),0)}var Qe=3;function $e(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<Qe&&a.push(e)):t>0&&(i+=t,o.length<Qe&&o.push(e));return{added:r,removed:i,sampleAdded:a,sampleRemoved:o}}function et(e){return e instanceof Error?e.message.includes(`conflict:`):String(e).includes(`conflict:`)}var Q=n(),$=e=>`${e.instanceName}::${e.agentId}`;function tt(){let e=W(f.me.getMe,{host:Ie}),t=e?.role===`admin`,n=(e?.permissions??[]).includes(`bridge.read`),i=W(f.admin.listInstances,e!==void 0&&t?{}:`skip`),[a,o]=(0,Y.useState)(null);(0,Y.useEffect)(()=>{!t||!i||i.length===0||(!a||!i.some(e=>e.name===a))&&o(i[0].name)},[t,i,a]);let s=W(f.agents.listAgentsForInstance,t&&a?{instanceName:a}:`skip`),c=W(f.agents.listMyAgents,e!==void 0&&!t?{}:`skip`),l=(0,Y.useMemo)(()=>{if(e!==void 0){if(t)return a===null||s===void 0?i!==void 0&&i.length===0?[]:void 0:s.agents.map(e=>({instanceName:a,agentId:e.agentId,label:`${e.emoji?`${e.emoji} `:``}${e.displayName??e.agentId}`}));if(c!==void 0)return c.map(e=>({instanceName:e.instanceName,agentId:e.agentId,label:`${e.emoji?`${e.emoji} `:``}${e.displayName??e.agentId}`}))}},[e,t,a,s,i,c]),[u,d]=(0,Y.useState)(null);(0,Y.useEffect)(()=>{!l||l.length===0||(!u||!l.some(e=>$(e)===u))&&d($(l[0]))},[l,u]);let p=l?.find(e=>$(e)===u)??null,m=M(f.agentFiles.listAgentFiles),[h,_]=(0,Y.useState)({status:`idle`}),y=p?.instanceName??null,x=p?.agentId??null,S=W(f.compat.forInstance,n&&y!==null?{instanceName:y}:`skip`),C=n&&y!==null?Ve(S,`agentFiles`):null,T=C===null?!1:C===`loading`?null:C.blocked,D=(0,Y.useCallback)(async()=>{if(!(y===null||x===null)){_({status:`loading`});try{_({status:`done`,files:(await m({instanceName:y,agentId:x})).files})}catch{_({status:`error`})}}},[m,y,x]);(0,Y.useEffect)(()=>{T===!1&&D()},[D,T]);let[O,k]=(0,Y.useState)(null),A=W(f.agentFileCuration.listCurations,t&&y!==null&&x!==null?{instanceName:y,agentId:x}:`skip`),j=W(f.agentFileCuration.curationSettings,t&&y!==null?{instanceName:y}:`skip`),ee=M(f.agentFileCuration.requestCuration),[te,N]=(0,Y.useState)(null),[P,F]=(0,Y.useState)(null),{toast:I}=q(),L=(0,Y.useMemo)(()=>{let e=new Map;for(let t of A??[])e.has(t.name)||e.set(t.name,t);return e},[A]),re=(0,Y.useCallback)(async e=>{if(!(y===null||x===null)){N(e);try{let t=await ee({instanceName:y,agentId:x,name:e,trigger:`manual`});t.ok?I({title:fe(),variant:`success`}):I({title:le({reason:t.reason??`unknown`}),variant:`error`})}catch{I({title:U(),variant:`error`})}finally{N(null)}}},[ee,y,x,I]),z=G(),B=(0,Y.useMemo)(()=>new Intl.NumberFormat(z,{maximumFractionDigits:0}),[z]);return e===void 0||l===void 0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:R()}):(0,Q.jsxs)(`div`,{className:`oc-afiles`,children:[(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:me()}),(0,Q.jsxs)(`div`,{className:`oc-afiles__picker`,children:[t&&(i?.length??0)>1?(0,Q.jsxs)(Ue,{value:a??``,onValueChange:e=>o(e),children:[(0,Q.jsx)(je,{size:`sm`,"aria-label":r(),children:(0,Q.jsx)(Ee,{})}),(0,Q.jsx)(Fe,{children:(i??[]).map(e=>(0,Q.jsx)(He,{value:e.name,children:e.name},e.name))})]}):null,l.length>0?(0,Q.jsxs)(Ue,{value:u??``,onValueChange:e=>d(e),children:[(0,Q.jsx)(je,{size:`sm`,"aria-label":ne(),children:(0,Q.jsx)(Ee,{})}),(0,Q.jsx)(Fe,{children:l.map(e=>(0,Q.jsx)(He,{value:$(e),children:e.label},$(e)))})]}):(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:de()})]}),p===null?null:C===`loading`?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:R()}):C!==null&&C.blocked?(0,Q.jsxs)(`p`,{className:`oc-compat__blocked`,role:`status`,children:[(0,Q.jsx)(J,{size:14,"aria-hidden":!0}),` `,qe(C.gatewayVersion)]}):h.status===`loading`||h.status===`idle`?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:R()}):h.status===`error`?(0,Q.jsxs)(`p`,{className:`oc-afiles__error`,role:`alert`,children:[ue(),` `,(0,Q.jsx)(K,{variant:`outline`,size:`sm`,onClick:()=>void D(),children:g()})]}):h.files.length===0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:ce()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`div`,{className:`oc-afiles__list`,children:h.files.map(e=>{let n=Ye(e.size),r=n>=80;return(0,Q.jsxs)(`div`,{className:`oc-afiles__row`,children:[(0,Q.jsx)(`span`,{className:`oc-afiles__name`,title:e.name,children:e.name}),e.missing?(0,Q.jsx)(we,{variant:`outline`,children:w()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`span`,{className:`oc-afiles__size`,children:ve({size:Z(e.size,z)})}),(0,Q.jsx)(`span`,{className:`oc-afiles__gauge${r?` is-warn`:``}`,"aria-hidden":!0,children:(0,Q.jsx)(`span`,{className:`oc-afiles__gauge-fill`,style:{width:`${Math.min(n,100)}%`}})}),(0,Q.jsx)(`span`,{className:`oc-afiles__pct`,children:E({pct:B.format(n)})}),r?(0,Q.jsx)(J,{size:14,className:`oc-afiles__warn`,"aria-label":v()}):(0,Q.jsx)(`span`,{className:`oc-afiles__warn-slot`,"aria-hidden":!0})]}),(0,Q.jsx)(K,{variant:`outline`,size:`sm`,className:`oc-afiles__open`,onClick:()=>k(e),children:t?ie():b()}),t&&!e.missing?(0,Q.jsx)(nt,{curatable:Ke.includes(e.name),size:e.size??0,budget:j?.budgetChars??null,enabled:j?.enabled??!1,curation:L.get(e.name)??null,inFlight:te===e.name,onCurate:()=>void re(e.name),onReview:e=>F(e)}):null]},e.name)})}),(0,Q.jsx)(`p`,{className:`oc-afiles__budget`,children:oe({used:Z(Ze(h.files),z),total:Z(Je,z),pct:B.format(Xe(Ze(h.files)))})})]}),O&&p?(0,Q.jsx)(rt,{instanceName:p.instanceName,agentId:p.agentId,name:O.name,isAdmin:t,onClose:()=>k(null),onSaved:()=>void D()}):null,P?(0,Q.jsx)(it,{curationId:P,onClose:()=>F(null),onApplied:()=>{F(null),D()}}):null]})}function nt({curatable:e,size:t,budget:n,enabled:r,curation:a,inFlight:o,onCurate:s,onReview:c}){return a?.status===`proposed`?(0,Q.jsx)(K,{variant:`default`,size:`sm`,className:`oc-afiles__curate`,onClick:()=>c(a._id),children:i()}):o||a?.status===`dispatched`||a?.status===`applying`?(0,Q.jsx)(we,{variant:`outline`,className:`oc-afiles__curate-status`,children:F()}):e&&r&&n!==null&&Ge(t,n)?(0,Q.jsx)(K,{variant:`outline`,size:`sm`,className:`oc-afiles__curate`,onClick:s,children:pe()}):null}function rt({instanceName:e,agentId:t,name:n,isAdmin:r,onClose:i,onSaved:a}){let c=M(f.agentFiles.getAgentFile),l=M(f.agentFiles.setAgentFile),d=q(),[m,_]=(0,Y.useState)(null),[v,y]=(0,Y.useState)(!1),[b,x]=(0,Y.useState)(``),[C,w]=(0,Y.useState)(!1),[T,E]=(0,Y.useState)(!1),[D,A]=(0,Y.useState)(!1),[P,ne]=(0,Y.useState)(!1),F=(0,Y.useCallback)(async r=>{y(!1);try{let i=await c({instanceName:e,agentId:t,name:n});_({content:i.content,updatedAtMs:i.updatedAtMs}),r||x(i.content),A(!1)}catch{y(!0)}},[c,e,t,n]);(0,Y.useEffect)(()=>{F(!1)},[F]);async function L(){if(m!==null){E(!0),ne(!1);try{await l({instanceName:e,agentId:t,name:n,content:b,baseUpdatedAtMs:m.updatedAtMs??void 0}),d.success(h({name:n})),a(),await F(!1)}catch(e){et(e)?A(!0):ne(!0)}finally{E(!1)}}}let re=m!==null&&b!==m.content,B=(0,Y.useMemo)(()=>m===null?null:$e(m.content,b),[m,b]),ie=b.length>X,V=G(),H=(0,Y.useMemo)(()=>new Intl.NumberFormat(V),[V]);return(0,Q.jsx)(Be,{open:!0,onOpenChange:e=>!e&&i(),children:(0,Q.jsxs)(Le,{className:`oc-afiles__editor`,children:[(0,Q.jsxs)(Pe,{children:[(0,Q.jsx)(Re,{children:ae({name:n})}),(0,Q.jsxs)(ze,{children:[s({agent:t,instance:e}),r?null:(0,Q.jsxs)(Q.Fragment,{children:[` · `,Se()]})]})]}),v?(0,Q.jsxs)(`p`,{className:`oc-afiles__error`,role:`alert`,children:[ee(),` `,(0,Q.jsx)(K,{variant:`outline`,size:`sm`,onClick:()=>void F(!1),children:g()})]}):m===null?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:R()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`textarea`,{className:`oc-afiles__source`,value:b,readOnly:!r,spellCheck:!1,onChange:e=>x(e.target.value),"aria-label":ae({name:n})}),(0,Q.jsx)(`p`,{className:`oc-afiles__hint`,children:I()}),D?(0,Q.jsxs)(`p`,{className:`oc-afiles__error`,role:`alert`,children:[j(),` `,(0,Q.jsx)(K,{variant:`outline`,size:`sm`,onClick:()=>void F(!0),children:ge()})]}):null,P?(0,Q.jsx)(`p`,{className:`oc-afiles__error`,role:`alert`,children:N()}):null,(0,Q.jsxs)(`div`,{className:`oc-afiles__editor-foot`,children:[(0,Q.jsx)(`span`,{className:`oc-afiles__count${ie?` is-over`:``}`,children:O({count:H.format(b.length),max:H.format(X)})}),r?(0,Q.jsx)(K,{size:`sm`,disabled:!re||T||D,onClick:()=>w(!0),children:T?k():S()}):null]})]}),(0,Q.jsx)(Oe,{open:C,onOpenChange:w,children:(0,Q.jsxs)(We,{children:[(0,Q.jsxs)(De,{children:[(0,Q.jsx)(Me,{children:o({name:n})}),(0,Q.jsx)(Te,{children:_e({agent:t})})]}),B?(0,Q.jsxs)(`div`,{className:`oc-afiles__diff`,children:[(0,Q.jsx)(`p`,{className:`oc-afiles__diff-counts`,children:te({added:B.added,removed:B.removed})}),B.sampleAdded.length>0?(0,Q.jsxs)(`div`,{className:`oc-afiles__diff-block`,children:[(0,Q.jsx)(`span`,{className:`oc-afiles__diff-label`,children:u()}),B.sampleAdded.map((e,t)=>(0,Q.jsx)(`code`,{className:`oc-afiles__diff-line is-add`,children:e||` `},t))]}):null,B.sampleRemoved.length>0?(0,Q.jsxs)(`div`,{className:`oc-afiles__diff-block`,children:[(0,Q.jsx)(`span`,{className:`oc-afiles__diff-label`,children:p()}),B.sampleRemoved.map((e,t)=>(0,Q.jsx)(`code`,{className:`oc-afiles__diff-line is-del`,children:e||` `},t))]}):null]}):null,(0,Q.jsxs)(Ne,{children:[(0,Q.jsx)(Ae,{children:he()}),(0,Q.jsx)(ke,{onClick:()=>void L(),children:z()})]})]})})]})})}function it({curationId:e,onClose:t,onApplied:n}){let r=W(f.agentFileCuration.getProposal,{curationId:e}),i=M(f.agentFileCuration.approveCuration),o=a(f.agentFileCuration.rejectCuration),{toast:s}=q(),[u,p]=(0,Y.useState)(null),[h,g]=(0,Y.useState)(!1),[v,b]=(0,Y.useState)(``),S=G(),w=(0,Y.useMemo)(()=>r?$e(r.beforeContent,r.proposedContent):null,[r]);async function E(){p(`approve`);try{let t=await i({curationId:e});t.ok?(s({title:T(),variant:`success`}),n()):s({title:t.reason===`conflict`?D():y({reason:t.reason??`unknown`}),variant:`error`})}catch{s({title:U(),variant:`error`})}finally{p(null)}}async function O(n){p(`reject`);try{let r=v.trim();(await o({curationId:e,...r?{comment:r}:{},relaunch:n})).ok?s({title:n?re():ye(),variant:`success`}):s({title:x(),variant:`error`}),t()}catch{s({title:U(),variant:`error`})}finally{p(null)}}return(0,Q.jsx)(Be,{open:!0,onOpenChange:e=>e?void 0:t(),children:(0,Q.jsxs)(Le,{className:`oc-afiles__review`,children:[(0,Q.jsxs)(Pe,{children:[(0,Q.jsx)(Re,{children:r?se({name:r.name}):R()}),(0,Q.jsx)(ze,{children:V()})]}),r===void 0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:R()}):r===null?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:x()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`p`,{className:`oc-afiles__review-sizes`,children:[H({before:Z(r.beforeSize,S),after:Z(r.proposedSize,S)}),r.overBudget?(0,Q.jsxs)(Q.Fragment,{children:[` `,(0,Q.jsx)(J,{size:13,"aria-hidden":!0}),` `,c()]}):null]}),w?(0,Q.jsx)(`p`,{className:`oc-afiles__review-diff`,children:Ce({added:w.added,removed:w.removed})}):null,r.feedback?(0,Q.jsx)(`p`,{className:`oc-afiles__review-feedback`,children:xe({feedback:r.feedback})}):null,w&&w.sampleRemoved.length>0?(0,Q.jsxs)(`div`,{className:`oc-afiles__review-removed`,children:[(0,Q.jsx)(`p`,{className:`oc-afiles__review-label`,children:P()}),(0,Q.jsx)(`ul`,{children:w.sampleRemoved.map((e,t)=>(0,Q.jsx)(`li`,{children:e||`\xA0`},t))})]}):null,(0,Q.jsxs)(`div`,{className:`oc-afiles__review-panes oc-afiles__review-panes--2`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`p`,{className:`oc-afiles__review-label`,children:_()}),(0,Q.jsx)(`pre`,{className:`oc-afiles__review-pre`,children:r.beforeContent})]}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`p`,{className:`oc-afiles__review-label`,children:L()}),(0,Q.jsx)(`pre`,{className:`oc-afiles__review-pre`,children:r.proposedContent})]})]})]}),h?(0,Q.jsxs)(`div`,{className:`oc-afiles__reject-form`,children:[(0,Q.jsx)(`label`,{className:`oc-afiles__review-label`,htmlFor:`curation-reject-comment`,children:d()}),(0,Q.jsx)(`textarea`,{id:`curation-reject-comment`,className:`oc-afiles__reject-textarea`,rows:3,placeholder:m(),value:v,onChange:e=>b(e.target.value)}),(0,Q.jsxs)(`div`,{className:`oc-afiles__review-actions`,children:[(0,Q.jsx)(K,{variant:`ghost`,onClick:()=>g(!1),disabled:u!==null,children:B()}),(0,Q.jsx)(K,{variant:`outline`,onClick:()=>void O(!1),disabled:u!==null,children:u===`reject`?k():be()}),(0,Q.jsx)(K,{variant:`default`,onClick:()=>void O(!0),disabled:u!==null,children:u===`reject`?k():l()})]})]}):(0,Q.jsxs)(`div`,{className:`oc-afiles__review-actions`,children:[(0,Q.jsx)(K,{variant:`outline`,onClick:()=>g(!0),disabled:u!==null||r==null,children:A()}),(0,Q.jsx)(K,{variant:`default`,onClick:()=>void E(),disabled:u!==null||r==null,children:u===`approve`?k():C()})]})]})})}export{tt as AgentFilesTab};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$g as r,AA as i,Bg as a,C_ as o,E as s,E_ as c,Gg as ee,Hg as te,Jg as l,Kg as u,Qg as d,Rg as f,S_ as ne,T_ as p,Ug as re,Vg as m,Wg as ie,Xg as ae,Yg as oe,Zg as se,__ as ce,a_ as le,b_ as ue,c_ as h,d_ as g,e_ as _,f_ as de,g_ as fe,h_ as pe,i_ as me,jA as v,l_ as he,m_ as ge,n_ as y,o_ as b,p_ as x,qg as S,r_ as C,s_ as w,t_ as T,u_ as E,v_ as D,w_ as O,x_ as k,y_ as A,zg as j}from"./dist-DLKTmLXq.js";import{$ as M,C as N,Ft as P,N as F,P as I,Pt as L,S as R,a as _e,b as z,k as ve,lt as ye,r as be,x as B,y as V}from"./index-D6NQyqlV.js";import{n as H}from"./TimeRangePicker-CD2-qOqD.js";import{t as xe}from"./FilterBar-CDYmDUw2.js";import{t as Se}from"./DataTableShell-nb7UG6xl.js";import{t as U}from"./dispatchErrorInfo-8iiDNzMm.js";var W=t(e(),1),G=n(),K=`__all__`,Ce=[{value:`open`},{value:`acknowledged`},{value:`resolved`}];function we(e){return e===`open`?c():e===`acknowledged`?p():O()}var Te=[`info`,`warn`,`critical`],Ee=[`detector`,`agent`,`user`],De={kind:`relative`,from:`now-30d`,to:`now`},Oe=200,q=`all`;function J(){let e=P({from:`/settings/anomalies`}),t=L({from:`/settings/anomalies`}),n=e.q??``,a=e.status===q?K:e.status,c=e.severity??K,f=e.kind??K,[p,m]=(0,W.useState)(K),O=be(e.from,e.to),{from:j,to:U}=H(O),J=e=>void t({search:t=>({...t,q:e||void 0}),replace:!0}),Y=e=>void t({search:t=>({...t,status:e===K?q:e})}),X=e=>void t({search:t=>({...t,severity:e===K?void 0:e})}),Ne=e=>void t({search:t=>({...t,kind:e===K?void 0:e})}),Pe=e=>void t({search:t=>({...t,..._e(e)})}),Fe=I(),Z=F(),Q=i(s.anomalies.resolveAnomaly),Ie=(v(s.me.getMe,{host:ye})?.permissions??[]).includes(`admin.manage`),$=v(s.anomalies.listAnomalies,{limit:Oe,filter:{q:n||void 0,from:j,to:U,anomalyStatus:a===K?void 0:a,severity:c===K?void 0:c,source:p===K?void 0:p,kind:f===K?void 0:f}}),Le=(0,W.useMemo)(()=>{let e=new Set;for(let t of $??[])e.add(t.kind);return[...e].sort()},[$]),Re=n!==``||a!==`open`||c!==K||p!==K||f!==K||O.kind!==`relative`||O.from!==De.from;function ze(){m(K),t({search:{status:`open`},replace:!0})}async function Be(e){if(await Fe({title:o(),description:(0,G.jsxs)(G.Fragment,{children:[ne(),` `,(0,G.jsx)(`span`,{className:`font-mono`,children:e.kind}),` `,k(),` `,(0,G.jsx)(`strong`,{children:ue()}),`.`,` `,A()]}),confirmLabel:D()}))try{await Q({anomalyId:e._id,status:`resolved`}),Z.success(ce(),e.kind)}catch(e){Z.error(fe(),e)}}async function Ve(e){try{await Q({anomalyId:e._id,status:`acknowledged`}),Z.success(pe(),e.kind)}catch(e){Z.error(ge(),e)}}return(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(`p`,{className:`oc-admin__hint`,children:[x(),` `,(0,G.jsx)(`strong`,{children:de()}),` `,g(),` `,(0,G.jsx)(`strong`,{children:E()}),` `,he(),` `,(0,G.jsx)(`strong`,{children:h()}),` `,w(),` `,(0,G.jsx)(`span`,{className:`oc-filter__window`,children:b()})]}),(0,G.jsxs)(xe,{q:n,onQChange:J,searchPlaceholder:le(),timeRange:O,onTimeRangeChange:Pe,onReset:ze,canReset:Re,children:[(0,G.jsxs)(V,{value:a,onValueChange:Y,children:[(0,G.jsx)(R,{size:`sm`,className:`w-36`,children:(0,G.jsx)(N,{})}),(0,G.jsxs)(z,{children:[(0,G.jsx)(B,{value:K,children:me()}),Ce.map(e=>(0,G.jsx)(B,{value:e.value,children:we(e.value)},e.value))]})]}),(0,G.jsxs)(V,{value:c,onValueChange:X,children:[(0,G.jsx)(R,{size:`sm`,className:`w-36`,children:(0,G.jsx)(N,{placeholder:C()})}),(0,G.jsxs)(z,{children:[(0,G.jsx)(B,{value:K,children:y()}),Te.map(e=>(0,G.jsx)(B,{value:e,children:e},e))]})]}),(0,G.jsxs)(V,{value:p,onValueChange:m,children:[(0,G.jsx)(R,{size:`sm`,className:`w-32`,children:(0,G.jsx)(N,{placeholder:T()})}),(0,G.jsxs)(z,{children:[(0,G.jsx)(B,{value:K,children:_()}),Ee.map(e=>(0,G.jsx)(B,{value:e,children:e},e))]})]}),(0,G.jsxs)(V,{value:f,onValueChange:Ne,children:[(0,G.jsx)(R,{size:`sm`,className:`w-36`,children:(0,G.jsx)(N,{placeholder:r()})}),(0,G.jsxs)(z,{children:[(0,G.jsx)(B,{value:K,children:d()}),Le.map(e=>(0,G.jsx)(B,{value:e,children:e},e))]})]})]}),(0,G.jsx)(Se,{title:se(),rows:$,emptyHint:a===`open`?ae():oe(),rowActions:e=>Ie&&e.status===`open`?[{label:l(),onSelect:()=>void Be(e)},{label:S(),onSelect:()=>void Ve(e)}]:[],columns:[{header:u(),cell:e=>(0,G.jsx)(`span`,{className:`oc-traces__time`,children:ve(e.at)}),sort:e=>e.at},{header:r(),cell:e=>(0,G.jsx)(`code`,{className:`oc-traces__mono`,children:e.kind}),sort:e=>e.kind},{header:C(),cell:e=>(0,G.jsx)(Ae,{severity:e.severity}),sort:e=>e.severity===`critical`?2:+(e.severity===`warn`)},{header:ee(),cell:e=>(0,G.jsx)(je,{status:e.status}),sort:e=>e.status===`resolved`?2:+(e.status===`acknowledged`)},{header:T(),cell:e=>(0,G.jsx)(M,{variant:`outline`,children:e.source}),sort:e=>e.source},{header:ie(),cell:e=>(0,G.jsx)(`span`,{className:`oc-anomaly__msg`,children:e.message}),sort:e=>e.message},{header:re(),cell:e=>(0,G.jsx)(ke,{row:e}),sort:e=>e.evidence??null},{header:te(),cell:e=>e.correlationId?(0,G.jsx)(`code`,{className:`oc-traces__mono`,children:Me(e.correlationId)}):(0,G.jsx)(`span`,{className:`oc-traces__muted`,children:`—`}),sort:e=>e.correlationId}]})]})}function Y(e){if(e.kind!==`openclaw.dispatch_failures`||!e.evidence)return{};try{let t=JSON.parse(e.evidence);return{dominantCode:t.dominantCode,sampleCorrelationId:t.sampleCorrelationId}}catch{return{}}}function X(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=L();if(e.kind===`subagent.failure`){let n=X(e);return(0,G.jsxs)(`div`,{className:`oc-anomaly__cause`,children:[(0,G.jsx)(`div`,{className:`oc-anomaly__cause-head`,children:[...new Set(n.errorCategories??[])].map(e=>(0,G.jsx)(`code`,{className:`oc-traces__mono`,children:e},e))}),e.correlationId?(0,G.jsxs)(`button`,{type:`button`,className:`oc-anomaly__drill`,onClick:()=>void t({to:`/settings/traces`,search:{q:e.correlationId,limit:100}}),children:[`↗ `,m()]}):null]})}let n=Y(e);if(!n.dominantCode)return(0,G.jsx)(`span`,{className:`oc-traces__muted`,children:`—`});let r=U(n.dominantCode),i=n.sampleCorrelationId;return(0,G.jsxs)(`div`,{className:`oc-anomaly__cause`,children:[(0,G.jsxs)(`div`,{className:`oc-anomaly__cause-head`,children:[(0,G.jsx)(`span`,{className:`oc-anomaly__cause-label`,children:r.label}),(0,G.jsx)(`code`,{className:`oc-traces__mono`,children:n.dominantCode})]}),(0,G.jsx)(`p`,{className:`oc-anomaly__cause-hint`,children:r.hint}),i?(0,G.jsxs)(`button`,{type:`button`,className:`oc-anomaly__drill`,onClick:()=>void t({to:`/settings/traces`,search:{q:i,limit:100}}),children:[`↗ `,m()]}):null]})}function Ae({severity:e}){return(0,G.jsx)(`span`,{className:`oc-anomaly__sev oc-anomaly__sev--${e}`,children:e})}function je({status:e}){return e===`open`?(0,G.jsx)(M,{variant:`destructive`,children:a()}):e===`acknowledged`?(0,G.jsx)(M,{variant:`secondary`,children:j()}):(0,G.jsx)(M,{variant:`outline`,children:f()})}function Me(e){return e.length>8?e.slice(0,8):e}export{J as AnomaliesTab};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$ as r,Av as i,Cv as a,Dv as o,E as s,Ev as c,J as l,Ov as u,Q as d,Sv as f,Tv as p,X as m,Y as h,Z as g,_v as _,bv as v,jA as y,jv as b,kv as x,vv as S,wv as C,xv as w,yv as T}from"./dist-DLKTmLXq.js";import{C as E,Ft as D,Pt as O,S as k,a as A,b as j,i as M,k as N,o as P,r as F,t as I,x as L,y as R}from"./index-D6NQyqlV.js";import{n as ee}from"./TimeRangePicker-CD2-qOqD.js";import{t as z}from"./FilterBar-CDYmDUw2.js";import{t as B}from"./AdvancedFilter-DIvWQV1i.js";import{t as V}from"./DataTableShell-nb7UG6xl.js";var H=t(e(),1),U=n(),W={kind:`relative`,from:I,to:`now`},G=`__all__`,K=[{value:`action`,label:r()},{value:`realLabel`,label:d()},{value:`targetLabel`,label:g()},{value:`impersonated`,label:m()},{value:`resource`,label:h()},{value:`resourceId`,label:l()}];function q(){let e=D({from:`/settings/audit`}),t=O({from:`/settings/audit`}),n=e.q??``,r=e.action??G,l=e.impersonated??G,d=e.resource??G,m=F(e.from,e.to),h=(0,H.useMemo)(()=>P(e.adv),[e.adv]),{from:g,to:I}=ee(m),q=e=>void t({search:t=>({...t,q:e||void 0}),replace:!0}),J=e=>void t({search:t=>({...t,action:e===G?void 0:e})}),Y=e=>void t({search:t=>({...t,impersonated:e===G?void 0:e})}),X=e=>void t({search:t=>({...t,resource:e===G?void 0:e})}),Z=e=>void t({search:t=>({...t,...A(e)})}),Q=e=>void t({search:t=>({...t,adv:M(e)}),replace:!0}),$=y(s.admin.listAudit,{filter:{q:n||void 0,from:g,to:I,action:r===G?void 0:r,resource:d===G?void 0:d,impersonated:l===G?void 0:l===`yes`,advanced:h.length>0?h:void 0}}),te=(0,H.useMemo)(()=>{let e=new Set;for(let t of $??[])e.add(t.action);return[...e].sort()},[$]),ne=(0,H.useMemo)(()=>{let e=new Set;for(let t of $??[])t.resource&&e.add(t.resource);return[...e].sort()},[$]),re=n!==``||r!==G||l!==G||d!==G||h.length>0||m.kind!==`relative`||m.from!==W.from;function ie(){t({search:{},replace:!0})}return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(`p`,{className:`oc-admin__hint`,children:[b(),` `,(0,U.jsx)(`span`,{className:`oc-filter__window`,children:i()})]}),(0,U.jsxs)(z,{q:n,onQChange:q,searchPlaceholder:x(),timeRange:m,onTimeRangeChange:Z,onReset:ie,canReset:re,children:[(0,U.jsxs)(R,{value:r,onValueChange:J,children:[(0,U.jsx)(k,{size:`sm`,className:`w-40`,children:(0,U.jsx)(E,{placeholder:u()})}),(0,U.jsxs)(j,{children:[(0,U.jsx)(L,{value:G,children:o()}),te.map(e=>(0,U.jsx)(L,{value:e,children:e},e))]})]}),(0,U.jsxs)(R,{value:l,onValueChange:Y,children:[(0,U.jsx)(k,{size:`sm`,className:`w-40`,children:(0,U.jsx)(E,{})}),(0,U.jsxs)(j,{children:[(0,U.jsx)(L,{value:G,children:c()}),(0,U.jsx)(L,{value:`yes`,children:p()}),(0,U.jsx)(L,{value:`no`,children:C()})]})]}),(0,U.jsxs)(R,{value:d,onValueChange:X,children:[(0,U.jsx)(k,{size:`sm`,className:`w-40`,children:(0,U.jsx)(E,{placeholder:a()})}),(0,U.jsxs)(j,{children:[(0,U.jsx)(L,{value:G,children:f()}),ne.map(e=>(0,U.jsx)(L,{value:e,children:e},e))]})]})]}),(0,U.jsx)(B,{fields:K,seed:h,onChange:Q}),(0,U.jsx)(V,{title:w(),rows:$,emptyHint:v(),columns:[{header:T(),cell:e=>N(e.at),sort:e=>e.at},{header:u(),cell:e=>e.action,sort:e=>e.action},{header:S(),cell:e=>e.realLabel,sort:e=>e.realLabel},{header:_(),cell:e=>e.targetLabel??`—`,sort:e=>e.targetLabel??null},{header:a(),cell:e=>e.resource?e.resource+(e.resourceId?` · ${e.resourceId.slice(0,8)}`:``):`—`,sort:e=>e.resource??null}]})]})}export{q as AuditTab};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$a as r,$p as i,AA as a,Am as o,Ap as s,Bp as c,Cp as l,D as u,Dp as d,E as f,Em as p,Ep as m,Fm as ee,Fp as h,Gp as te,Hp as g,Im as ne,Ip as _,Jp as re,Kp as v,Lp as y,Mm as ie,Mp as b,Nm as ae,Np as x,OA as oe,Op as S,Pm as se,Pp as C,Qa as ce,Qp as le,Rm as ue,Rp as de,Sp as fe,Tm as pe,Tp as me,Up as he,Vp as ge,Wp as _e,Xp as ve,Yp as ye,Za as be,Zp as xe,_p as Se,ao as w,bp as Ce,co as we,dp as T,em as Te,eo as Ee,fp as De,gp as Oe,hp as ke,io as Ae,jA as E,jm as je,jp as Me,km as Ne,kp as Pe,lo as Fe,lp as D,mp as Ie,nm as Le,no as Re,oo as ze,pp as Be,qa as Ve,qp as He,rm as Ue,ro as We,so as Ge,tm as Ke,to as qe,uo as Je,up as O,vp as Ye,wp as Xe,xp as Ze,yp as Qe,zm as $e,zp as et}from"./dist-DLKTmLXq.js";import{i as k,r as tt}from"./dist-CNjYZaW-.js";import{t as nt}from"./chevrons-up-down-CNTF8s9f.js";import{i as rt,n as A,o as it,r as at,s as ot}from"./FieldLabel-DrAMRvzk.js";import{t as j}from"./button-BgI9tkZX.js";import{$ as M,A as N,C as P,G as st,K as ct,Mt as F,N as lt,Nt as I,Pt as ut,S as L,Tt as dt,W as ft,_ as pt,_t as R,at as mt,b as z,bt as ht,et as B,k as gt,lt as _t,nt as vt,ot as yt,rt as bt,tt as xt,x as V,y as H}from"./index-D6NQyqlV.js";import{r as St}from"./locales-CPjguROj.js";import{a as Ct,i as wt,n as Tt,o as U,r as W,t as Et}from"./table-CwHklpki.js";import{t as Dt}from"./FilterBar-CDYmDUw2.js";import{a as Ot,n as kt,o as At,r as jt,s as Mt,t as Nt}from"./compatView-CKwdSOAo.js";import{t as G}from"./dispatchErrorInfo-8iiDNzMm.js";var Pt=u(`refresh-cw`,[[`path`,{d:`M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8`,key:`v9h5vc`}],[`path`,{d:`M21 3v5h-5`,key:`1q7to0`}],[`path`,{d:`M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16`,key:`3uifl3`}],[`path`,{d:`M8 16H3v5`,key:`1cv678`}]]),Ft=u(`wifi-off`,[[`path`,{d:`M12 20h.01`,key:`zekei9`}],[`path`,{d:`M8.5 16.429a5 5 0 0 1 7 0`,key:`1bycff`}],[`path`,{d:`M5 12.859a10 10 0 0 1 5.17-2.69`,key:`1dl1wf`}],[`path`,{d:`M19 12.859a10 10 0 0 0-2.007-1.523`,key:`4k23kn`}],[`path`,{d:`M2 8.82a15 15 0 0 1 4.177-2.643`,key:`1grhjp`}],[`path`,{d:`M22 8.82a15 15 0 0 0-11.288-3.764`,key:`z3jwby`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}]]),K=t(e(),1);function It(e){return e.filter(e=>e.state===`error`)}function Lt(e){return e.reachable&&It(e.targets).length===0}function Rt(e){return e.state===`error`&&e.lastErrorCode!==null}function zt(e){return!!e.lastDownstreamRejectCode}function q(e){return e.kind??`openclaw`}function Bt(e){return[...e].sort((e,t)=>e===`openclaw`?-1:t===`openclaw`?1:e.localeCompare(t))}function Vt(e,t,n){let r=new Map;for(let e of t)e.instanceName&&r.set(e.instanceName,e.provider);for(let e of n)r.set(e.name,q(e));let i=e=>(e.instanceName?r.get(e.instanceName):void 0)??`openclaw`,a=new Set;for(let e of n)a.add(q(e));for(let e of t)a.add(e.provider);for(let t of e)a.add(i(t));return Bt(a).map(r=>({key:r,connections:e.filter(e=>i(e)===r),compatTargets:t.filter(e=>e.provider===r),instances:n.filter(e=>q(e)===r)}))}function Ht(e){return e===`openclaw`?`OpenClaw`:e===`hermes`?`Hermes`:e.charAt(0).toUpperCase()+e.slice(1)}var J=`__all__`,Ut={q:``,state:J,instance:J,version:J},Y={connected:0,error:1,idle:2};function Wt(e){return e.q.trim()!==``||e.state!==`__all__`||e.instance!==`__all__`||e.version!==`__all__`}function Gt(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 Kt(e,t){return e===`version`?t.gatewayVersion===null:e===`lastOk`?t.lastOkAt===null:!1}function qt(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 At(e,r)??X(e,r)}case`lastOk`:return t.lastOkAt-n.lastOkAt;default:return X(t.targetLabel,n.targetLabel)}}function Jt(e,t){if(!t)return e;let n=t.dir===`asc`?1:-1;return[...e].sort((e,r)=>{let i=Kt(t.key,e),a=Kt(t.key,r);return i&&a?0:i?1:a?-1:n*qt(t.key,e,r)})}function Yt(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 Xt(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 Zt(e){let t=new Set;for(let n of e)n.gatewayVersion!==null&&t.add(n.gatewayVersion);return[...t].sort((e,t)=>At(e,t)??X(e,t))}var Z=n();function Qt({connections:e,displayByInstance:t}){let[n,r]=(0,K.useState)(Ut),[i,a]=(0,K.useState)(null),o=(0,K.useMemo)(()=>e.map((e,n)=>({_id:`${e.key}:${e.canonical}/${e.agentId}:${n}`,targetLabel:`${e.canonical}/${e.agentId}`,state:e.state,instanceName:e.instanceName??null,instanceLabel:e.instanceName?t.get(e.instanceName)??e.instanceName:null,gatewayHost:e.gatewayHost,gatewayVersion:e.gatewayVersion??null,okCount:e.okCount,errorCount:e.errorCount,attempts:e.attempts,lastOkAt:e.lastOkAt??null,lastErrorCode:e.lastErrorCode??null,lastErrorAt:e.lastErrorAt??null,lastDownstreamRejectCode:e.lastDownstreamRejectCode??null,lastDownstreamRejectAt:e.lastDownstreamRejectAt??null})),[e,t]),s=(0,K.useMemo)(()=>Yt(o),[o]),c=(0,K.useMemo)(()=>Xt(o),[o]),u=(0,K.useMemo)(()=>Zt(o),[o]),f=(0,K.useMemo)(()=>Jt(Gt(o,n),i),[o,n,i]);function p(e){a(t=>t?.key===e?t.dir===`asc`?{key:e,dir:`desc`}:null:{key:e,dir:`asc`})}return e.length===0?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:d()}):(0,Z.jsxs)(`div`,{className:`oc-conn`,children:[(0,Z.jsxs)(Dt,{q:n.q,onQChange:e=>r(t=>({...t,q:e})),searchPlaceholder:Xe(),onReset:()=>r(Ut),canReset:Wt(n),children:[(0,Z.jsxs)(H,{value:n.state,onValueChange:e=>r(t=>({...t,state:e})),children:[(0,Z.jsx)(L,{size:`sm`,className:`w-36`,children:(0,Z.jsx)(P,{placeholder:fe()})}),(0,Z.jsxs)(z,{children:[(0,Z.jsx)(V,{value:J,children:l()}),s.map(e=>(0,Z.jsx)(V,{value:e,children:en(e)},e))]})]}),(0,Z.jsxs)(H,{value:n.instance,onValueChange:e=>r(t=>({...t,instance:e})),children:[(0,Z.jsx)(L,{size:`sm`,className:`w-40`,children:(0,Z.jsx)(P,{placeholder:Ze()})}),(0,Z.jsxs)(z,{children:[(0,Z.jsx)(V,{value:J,children:l()}),c.map(e=>(0,Z.jsx)(V,{value:e.name,children:e.label},e.name))]})]}),(0,Z.jsxs)(H,{value:n.version,onValueChange:e=>r(t=>({...t,version:e})),children:[(0,Z.jsx)(L,{size:`sm`,className:`w-36`,children:(0,Z.jsx)(P,{placeholder:Ce()})}),(0,Z.jsxs)(z,{children:[(0,Z.jsx)(V,{value:J,children:l()}),u.map(e=>(0,Z.jsx)(V,{value:e,children:e},e))]})]})]}),f.length===0?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:Qe()}):(0,Z.jsxs)(Et,{className:`oc-conn__table`,children:[(0,Z.jsx)(Ct,{children:(0,Z.jsxs)(U,{children:[(0,Z.jsx)(Q,{label:Ye(),sortKey:`target`,sort:i,onSort:p}),(0,Z.jsx)(Q,{label:Se(),sortKey:`state`,sort:i,onSort:p}),(0,Z.jsx)(Q,{label:Oe(),sortKey:`instance`,sort:i,onSort:p}),(0,Z.jsx)(Q,{label:ke(),sortKey:`host`,sort:i,onSort:p}),(0,Z.jsx)(Q,{label:Ie(),sortKey:`version`,sort:i,onSort:p}),(0,Z.jsx)(wt,{children:Be()}),(0,Z.jsx)(Q,{label:De(),sortKey:`lastOk`,sort:i,onSort:p})]})}),(0,Z.jsx)(Tt,{children:f.map(e=>(0,Z.jsx)($t,{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)(wt,{"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)(tt,{size:13,"aria-hidden":!0}):(0,Z.jsx)(k,{size:13,"aria-hidden":!0}):(0,Z.jsx)(nt,{size:13,"aria-hidden":!0,className:`oc-conn__sort-idle`})]})})}function $t({r:e}){let t=Rt(e)?G(e.lastErrorCode):null,n=zt(e)?G(e.lastDownstreamRejectCode):null;return(0,Z.jsxs)(K.Fragment,{children:[(0,Z.jsxs)(U,{className:`oc-conn__row oc-conn__row--${e.state}`,children:[(0,Z.jsx)(W,{children:(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:e.targetLabel})}),(0,Z.jsx)(W,{children:(0,Z.jsx)(tn,{state:e.state})}),(0,Z.jsx)(W,{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)(W,{children:(0,Z.jsx)(`span`,{className:`oc-bridge-target__host`,children:e.gatewayHost})}),(0,Z.jsx)(W,{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)(W,{children:(0,Z.jsx)(`span`,{className:`oc-conn__stats`,children:m({ok:e.okCount,errors:e.errorCount,attempts:e.attempts})})}),(0,Z.jsx)(W,{children:e.lastOkAt?(0,Z.jsx)(`span`,{className:`oc-traces__mono`,children:N(e.lastOkAt)}):(0,Z.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})})]}),t||n?(0,Z.jsx)(U,{className:`oc-conn__detail-row`,children:(0,Z.jsxs)(W,{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?` · ${N(e.lastErrorAt)}`:``,(0,Z.jsx)(`p`,{className:`oc-bridge-card__hint`,children:t.hint})]}):null,n?(0,Z.jsxs)(`div`,{className:`oc-bridge-target__downstream`,children:[me({label:n.label}),` `,(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:e.lastDownstreamRejectCode}),e.lastDownstreamRejectAt?` · ${N(e.lastDownstreamRejectAt)}`:``]}):null]})}):null]})}function en(e){return e===`connected`?T():e===`error`?O():D()}function tn({state:e}){return e===`connected`?(0,Z.jsx)(M,{variant:`secondary`,children:T()}):e===`error`?(0,Z.jsx)(M,{variant:`destructive`,children:O()}):(0,Z.jsx)(M,{variant:`outline`,children:D()})}function nn(){return E(f.bridgeHealth.getBridgeHealth,{})}function rn(){let e=nn(),t=E(f.compat.getBridgeCompat,{}),n=E(f.me.getMe,{host:_t})?.role===`admin`,r=E(f.admin.listInstances,n?{}:`skip`),i=ut(),a=()=>void i({to:`/settings/anomalies`,search:{status:`open`}}),o=Vt(e?e.targets:[],t?t.targets:[],r??[]),s=t?.compat??null,c=t===void 0?`loading`:t===null?`nodata`:`ready`,l=s!==null&&kt(s,`hermes`)&&!o.some(e=>e.key===`hermes`);return(0,Z.jsxs)(`div`,{className:`oc-bridge`,children:[(0,Z.jsx)(an,{health:e,compat:t,onSeeAnomalies:a}),(0,Z.jsx)(`p`,{className:`oc-admin__hint oc-bridge__caption`,children:he()}),o.map(e=>(0,Z.jsx)(on,{providerKey:e.key,connections:e.connections,instances:e.instances,manifest:s,compatStatus:c,compatReachable:t?.reachable??!0,protocol:e.key===`openclaw`?t?.protocol??null:null},e.key)),l?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:Ve()}):null]})}function an({health:e,compat:t,onSeeAnomalies:n}){let r=t!=null&&t.buildVersion!=null&&t.bridgeVersion!=null&&t.buildVersion!==t.bridgeVersion,i=t?.buildRevision&&t.buildRevision!==`unknown`?t.buildRevision.slice(0,7):null,a=t&&t!==null?(0,Z.jsxs)(`span`,{className:`oc-bridge-card__ver`,children:[(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:Ot(t.bridgeVersion)}),i?(0,Z.jsxs)(Z.Fragment,{children:[` `,(0,Z.jsxs)(`code`,{className:`oc-traces__mono`,title:we(),children:[`(`,i,`)`]})]}):null,r?(0,Z.jsxs)(`strong`,{className:`oc-bridge-card__mismatch`,children:[` `,Ge({build:t.buildVersion??`?`})]}):null,` · `,ze(),` `,(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:t.protocolVersion===null?w():String(t.protocolVersion)})]}):null;if(e===void 0)return(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:_()});if(e===null)return(0,Z.jsx)(`div`,{className:`oc-bridge-card oc-bridge-card--idle`,children:h()});let o=It(e.targets),c=!e.reachable,l=Lt(e),u=l?`ok`:`error`,d=gt(e.checkedAt),f=e.startedAt==null?null:gt(e.startedAt);return(0,Z.jsxs)(`div`,{className:`oc-bridge-card oc-bridge-card--${u}`,children:[(0,Z.jsx)(`div`,{className:`oc-bridge-card__icon`,"aria-hidden":!0,children:l?(0,Z.jsx)(F,{size:22}):c?(0,Z.jsx)(Ft,{size:22}):(0,Z.jsx)(R,{size:22})}),(0,Z.jsxs)(`div`,{className:`oc-bridge-card__body`,children:[(0,Z.jsx)(`div`,{className:`oc-bridge-card__title`,children:l?C():c?x():b({count:o.length})}),(0,Z.jsxs)(`div`,{className:`oc-bridge-card__meta`,children:[(0,Z.jsxs)(`span`,{children:[(0,Z.jsx)(Pt,{size:12,"aria-hidden":!0}),` `,Me({time:d})]}),f?(0,Z.jsx)(`span`,{children:s({time:f})}):null,a]}),c?(0,Z.jsx)(`p`,{className:`oc-bridge-card__hint`,children:G(e.lastError===`not_configured`?`NOT_CONFIGURED`:`BRIDGE_UNREACHABLE`).hint}):null]}),(0,Z.jsx)(`button`,{type:`button`,className:`oc-bridgebar__drill`,onClick:n,children:Pe()})]})}function on({providerKey:e,connections:t,instances:n,manifest:r,compatStatus:i,compatReachable:a,protocol:o}){let s=r?Mt(r,e):null,c=new Map;for(let e of n)c.set(e.name,e.displayName??e.name);let l=[],u=new Set;for(let n of t){if(!n.instanceName||u.has(n.instanceName))continue;u.add(n.instanceName);let t=n.gatewayVersion??null;l.push({instanceName:n.instanceName,displayName:c.get(n.instanceName)??n.instanceName,version:t,state:Nt(t,e,r)})}let d=l.map(e=>e.state),f=d.includes(`beyond`)?`beyond`:d.length>0&&d.every(e=>e===`supported`)?`supported`:null,[p,m]=(0,K.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)(ht,{size:15,"aria-hidden":!0,className:`oc-bridge-provider__icon`}),(0,Z.jsx)(`span`,{className:`oc-bridge-provider__name`,children:Ht(e)}),f?(0,Z.jsx)(M,{variant:f===`beyond`?`destructive`:`secondary`,children:jt(f)}):null]}),(0,Z.jsx)(`h4`,{className:`oc-bridge-provider__sub`,children:Je()}),(0,Z.jsx)(cn,{support:s,compatStatus:i,compatReachable:a,manifest:r,instanceRows:l}),o?(0,Z.jsx)(sn,{protocol:o}):null,(0,Z.jsxs)(`button`,{type:`button`,className:`oc-bridge-provider__sub oc-bridge-provider__sub--toggle`,"aria-expanded":p,onClick:()=>m(e=>!e),children:[p?(0,Z.jsx)(k,{size:13,"aria-hidden":!0}):(0,Z.jsx)(I,{size:13,"aria-hidden":!0}),S({count:t.length})]}),p?(0,Z.jsx)(Qt,{connections:t,displayByInstance:c}):null]})}function sn({protocol:e}){let[t,n]=(0,K.useState)(!1),r=e.coverage,i=e.drift??[];return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`h4`,{className:`oc-bridge-provider__sub`,children:[g(),i.length>0?(0,Z.jsx)(M,{variant:`destructive`,children:c({count:i.length})}):(0,Z.jsx)(M,{variant:`secondary`,children:ge()})]}),(0,Z.jsxs)(`p`,{className:`oc-admin__hint`,children:[et({version:e.vendoredVersion}),r?` · `+de({handled:r.handled,ignored:r.ignored,gaps:r.gaps}):null]}),i.length>0?(0,Z.jsx)(`ul`,{className:`oc-bridge-protocol__list`,role:`list`,children:i.map(e=>(0,Z.jsxs)(`li`,{children:[(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:e.shape}),` × `,e.count]},e.shape))}):null,r&&r.gapList.length>0?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`button`,{type:`button`,className:`oc-bridge-provider__sub oc-bridge-provider__sub--toggle`,"aria-expanded":t,onClick:()=>n(e=>!e),children:[t?(0,Z.jsx)(k,{size:13,"aria-hidden":!0}):(0,Z.jsx)(I,{size:13,"aria-hidden":!0}),y({count:r.gapList.length})]}),t?(0,Z.jsx)(`ul`,{className:`oc-bridge-protocol__list`,role:`list`,children:r.gapList.map(e=>(0,Z.jsx)(`li`,{children:(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:e})},e))}):null]}):null]})}function cn({support:e,compatStatus:t,compatReachable:n,manifest:r,instanceRows:i}){return t===`loading`?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:_()}):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:Ae()}),r===null?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:We()}):(0,Z.jsxs)(`div`,{className:`oc-compat__support`,children:[(0,Z.jsx)(`span`,{className:`oc-compat__label`,children:Re()}),e&&e.range!==null?(0,Z.jsx)(`span`,{children:qe({min:e.range.min,max:e.range.maxValidated})}):(0,Z.jsx)(`span`,{children:w()}),e?(0,Z.jsx)(dn,{versions:e.validatedVersions}):null]}),i.length===0?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:be()}):(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:Ot(e.version)}),(0,Z.jsx)(M,{variant:e.state===`supported`?`secondary`:e.state===`beyond`?`destructive`:`outline`,children:jt(e.state)})]},e.instanceName))})]})}function ln({instance:e,onClose:t}){return(0,Z.jsx)(xt,{open:!0,onOpenChange:e=>!e&&t(),children:(0,Z.jsxs)(vt,{className:`oc-bridge-config-dialog`,onOpenAutoFocus:e=>e.preventDefault(),children:[(0,Z.jsxs)(mt,{children:[(0,Z.jsx)(yt,{children:$e({instance:e.displayName??e.name})}),(0,Z.jsx)(bt,{children:ue()})]}),(0,Z.jsx)(un,{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)(F,{"aria-hidden":!0}):(0,Z.jsx)(R,{"aria-hidden":!0}),(0,Z.jsxs)(`span`,{children:[e,` — `,t.ok?He():t.detail]})]}):(0,Z.jsxs)(`p`,{className:`oc-bridge-config__check-row oc-bridge-config__check-row--skip`,children:[e,` — `,v()]}):null}function un({instance:e,onClose:t}){let n=a(f.admin.upsertInstanceConfig),r=oe(f.bridge.validateMediaPaths),s=lt(),c=St(e.config?.contentLocale,void 0),[l,u]=(0,K.useState)(()=>rt(e.config??{},c)),[d,m]=(0,K.useState)(!1),[h,g]=(0,K.useState)(!1),[_,v]=(0,K.useState)(null),y=l.inboundMediaMode===`shared-fs`,b=l.mediaMode===`shared-fs`,x=y||b;async function S(){g(!0),v(null);try{v(await r({instanceName:e.name,inboundMediaMode:l.inboundMediaMode,mediaMode:l.mediaMode}))}catch(e){s.error(xe(),e)}finally{g(!1)}}async function C(){m(!0);try{let r=e.config??{};await n({instanceId:e._id,config:at(l,r,c)}),t()}catch(e){s.error(je(),e)}finally{m(!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)(A,{label:ne(),help:o()}),(0,Z.jsxs)(H,{value:l.mediaMode,onValueChange:e=>u({...l,mediaMode:e}),children:[(0,Z.jsx)(L,{size:`sm`,className:`w-full`,children:(0,Z.jsx)(P,{})}),(0,Z.jsx)(z,{children:ot.map(e=>(0,Z.jsx)(V,{value:e,children:e},e))})]})]}),(0,Z.jsxs)(`label`,{className:`oc-field`,children:[(0,Z.jsx)(A,{label:ee(),help:Ne()}),(0,Z.jsxs)(H,{value:l.inboundMediaMode,onValueChange:e=>u({...l,inboundMediaMode:e}),children:[(0,Z.jsx)(L,{size:`sm`,className:`w-full`,children:(0,Z.jsx)(P,{})}),(0,Z.jsx)(z,{children:it.map(e=>(0,Z.jsx)(V,{value:e,children:e},e))})]})]}),(0,Z.jsxs)(`label`,{className:`oc-field`,children:[(0,Z.jsx)(A,{label:se(),help:p()}),(0,Z.jsx)(B,{type:`number`,min:1,max:4096,className:`w-full`,value:l.mediaMaxMb,onChange:e=>u({...l,mediaMaxMb:Math.trunc(Number(e.target.value)||0)})})]})]}),x&&(0,Z.jsxs)(`div`,{className:`oc-bridge-config__grid`,children:[y&&(0,Z.jsxs)(`label`,{className:`oc-field`,children:[(0,Z.jsx)(A,{label:Ue(),help:Le()}),(0,Z.jsx)(B,{className:`w-full`,spellCheck:!1,value:l.inboundAgentMount,onChange:e=>u({...l,inboundAgentMount:e.target.value})})]}),b&&(0,Z.jsxs)(`label`,{className:`oc-field`,children:[(0,Z.jsx)(A,{label:Ke(),help:Te()}),(0,Z.jsx)(B,{className:`w-full`,spellCheck:!1,value:l.outboundAgentMount,onChange:e=>u({...l,outboundAgentMount:e.target.value})})]})]}),(0,Z.jsxs)(`label`,{className:`oc-field--row`,children:[(0,Z.jsx)(pt,{checked:l.rehydration,onCheckedChange:e=>u({...l,rehydration:e===!0})}),(0,Z.jsx)(A,{label:ae(),help:pe()})]}),x&&_!==null&&(0,Z.jsx)(`div`,{className:`oc-bridge-config__check`,children:_.reachable?!_.inbound&&!_.outbound?(0,Z.jsxs)(`p`,{className:`oc-bridge-config__check-row oc-bridge-config__check-row--err`,children:[(0,Z.jsx)(R,{"aria-hidden":!0}),_e({reason:_.reason??`?`})]}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)($,{label:ye(),result:_.inbound}),(0,Z.jsx)($,{label:re(),result:_.outbound}),(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:ve()})]}):(0,Z.jsxs)(`p`,{className:`oc-bridge-config__check-row oc-bridge-config__check-row--err`,children:[(0,Z.jsx)(R,{"aria-hidden":!0}),te()]})}),(0,Z.jsxs)(`div`,{className:`oc-bridge-config__actions`,children:[x&&(0,Z.jsxs)(j,{variant:`outline`,size:`sm`,onClick:()=>void S(),disabled:h,children:[h?(0,Z.jsx)(dt,{className:`size-4 animate-spin`,"aria-hidden":!0}):null,h?le():i()]}),(0,Z.jsx)(j,{size:`sm`,onClick:()=>void C(),disabled:d,children:ie()})]})]})})}function dn({versions:e}){if(e.length===0)return null;let t=[...e].reverse();return(0,Z.jsxs)(ft,{children:[(0,Z.jsx)(ct,{asChild:!0,children:(0,Z.jsxs)(`button`,{type:`button`,className:`oc-compat__versions-btn`,children:[e.length===1?Ee():r({count:e.length}),(0,Z.jsx)(k,{size:13,"aria-hidden":!0})]})}),(0,Z.jsxs)(st,{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)(M,{variant:`secondary`,children:e},e))})]})]})}export{rn as BridgeTab,ln as InstanceConfigDialog};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$o as r,AA as i,As as a,Bn as o,Co as s,E as c,Fs as l,Gn as u,Hn as d,Lm as f,Ls as p,OA as m,SA as h,So as g,Un as _,Vn as v,Wn as y,_o as b,bo as x,do as S,fo as ee,go as C,hT as te,ho as w,jA as T,js as ne,mo as re,po as ie,vo as E,xo as D,yo as O,zn as k}from"./dist-DLKTmLXq.js";import{t as A}from"./button-BgI9tkZX.js";import{B as ae,C as oe,H as se,I as j,L as ce,N as le,R as ue,S as de,U as fe,V as M,_ as N,_t as P,b as F,et as I,g as L,h as R,v as z,x as B,y as V,z as pe}from"./index-D6NQyqlV.js";import{i as me}from"./compatView-CKwdSOAo.js";/* empty css */var H=t(e(),1),he=[`off`,`minimal`,`low`,`medium`,`high`,`xhigh`];function ge(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 U=n();function _e({instance:e}){let t=i(c.admin.upsertInstanceConfig),n=e.config?.curationEnabled===!0,r=typeof e.config?.curationBudgetChars==`number`?e.config.curationBudgetChars:null,[a,s]=(0,H.useState)(n),[l,u]=(0,H.useState)(r===null?``:String(r)),[f,m]=(0,H.useState)(`idle`);(0,H.useEffect)(()=>{s(n),u(r===null?``:String(r)),m(`idle`)},[e._id,n,r]);let h=l.trim(),g=h===``?null:/^\d+$/.test(h)?Number.parseInt(h,10):NaN,y=!a||g===null||Number.isInteger(g)&&g>=4e3&&g<=6e4,x=a!==n||(g??null)!==r;async function S(){m(`saving`);try{let n={...e.config??{}};n.curationEnabled=a,!a||g===null||Number.isNaN(g)?delete n.curationBudgetChars:n.curationBudgetChars=g,await t({instanceId:e._id,config:n}),m(`done`)}catch{m(`error`)}}return(0,U.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,U.jsxs)(`label`,{className:`oc-cdefaults__inline`,style:{cursor:`pointer`},children:[(0,U.jsx)(N,{checked:a,onCheckedChange:e=>s(e===!0),"aria-label":_()}),(0,U.jsx)(`span`,{className:`oc-cdefaults__label`,children:_()})]}),(0,U.jsxs)(`div`,{className:`oc-cdefaults__inline`,children:[(0,U.jsx)(I,{type:`number`,min:4e3,max:6e4,step:1e3,placeholder:`20000`,value:l,onChange:e=>u(e.target.value),className:`oc-cdefaults__number`,"aria-invalid":!y,"aria-label":d(),disabled:!a}),(0,U.jsx)(A,{size:`sm`,disabled:!x||!y||f===`saving`,onClick:()=>void S(),children:f===`saving`?p():b()})]}),y?null:(0,U.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:v()}),f===`done`?(0,U.jsx)(`p`,{className:`oc-admin__hint`,role:`status`,children:C()}):null,f===`error`?(0,U.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:w()}):null,(0,U.jsx)(`p`,{className:`oc-cdefaults__help`,children:o()})]})}function ve({instance:e}){let t=i(c.admin.upsertInstanceConfig),n=typeof e.config?.summarizeThresholdChars==`number`?e.config.summarizeThresholdChars:null,[r,a]=(0,H.useState)(n===null?``:String(n)),[o,s]=(0,H.useState)(`idle`);(0,H.useEffect)(()=>{a(n===null?``:String(n)),s(`idle`)},[e._id,n]);let l=r.trim(),d=l===``?null:/^\d+$/.test(l)?Number.parseInt(l,10):NaN,f=d===null||Number.isInteger(d)&&d>=1e3&&d<=2e5,m=(d??null)!==n;async function h(){s(`saving`);try{let n={...e.config??{}};d===null?delete n.summarizeThresholdChars:n.summarizeThresholdChars=d,await t({instanceId:e._id,config:n}),s(`done`)}catch{s(`error`)}}return(0,U.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,U.jsx)(`span`,{className:`oc-cdefaults__label`,children:u()}),(0,U.jsxs)(`div`,{className:`oc-cdefaults__inline`,children:[(0,U.jsx)(I,{type:`number`,min:1e3,max:2e5,step:1e3,placeholder:`8000`,value:r,onChange:e=>a(e.target.value),className:`oc-cdefaults__number`,"aria-invalid":!f}),(0,U.jsx)(A,{size:`sm`,disabled:!m||!f||o===`saving`,onClick:()=>void h(),children:o===`saving`?p():b()})]}),f?null:(0,U.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:k()}),o===`done`?(0,U.jsx)(`p`,{className:`oc-admin__hint`,role:`status`,children:C()}):null,o===`error`?(0,U.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:w()}):null,(0,U.jsx)(`p`,{className:`oc-cdefaults__help`,children:y()})]})}function W(){let e=m(c.agentFiles.getChatDefaults),t=m(c.agentFiles.setChatDefaults),n=le(),[i,o]=(0,H.useState)({status:`loading`}),[u,d]=(0,H.useState)({thinkingDefault:null,fastModeDefault:null}),[_,v]=(0,H.useState)(!1),[y,k]=(0,H.useState)(!1),N=T(c.admin.listInstances,{}),[I,W]=(0,H.useState)(null);(0,H.useEffect)(()=>{!N||N.length===0||(!I||!N.some(e=>e.name===I))&&W(N[0].name)},[N,I]);let G=(N?.length??0)>1,ye=N!==void 0&&N.length===0,be=T(c.compat.forInstance,I?{instanceName:I}:`skip`),K=I?z(be,`configDefaults`):`loading`,q=K===`loading`?null:K.blocked,J=(0,H.useMemo)(()=>G&&I?{instanceName:I}:{},[G,I]),Y=(0,H.useRef)(0),X=(0,H.useCallback)(async()=>{let t=++Y.current;o({status:`loading`});try{let n=ge(await e(J));if(Y.current!==t)return;o({status:`done`,current:n}),d(n)}catch{if(Y.current!==t)return;o({status:`error`})}},[e,J]);(0,H.useEffect)(()=>{q===!1&&(G&&!I||X())},[X,q,G,I]);let Z=i.status===`done`?i.current:null,Q=Z!==null&&u.thinkingDefault!==null&&u.thinkingDefault!==Z.thinkingDefault,$=Z!==null&&u.fastModeDefault!==null&&u.fastModeDefault!==Z.fastModeDefault,xe=Q||$;async function Se(){k(!0);try{await t({...J,...Q?{thinkingDefault:u.thinkingDefault}:{},...$?{fastModeDefault:u.fastModeDefault}:{}}),n.success(C()),await X()}catch(e){n.error(w(),e)}finally{k(!1)}}let Ce=(0,H.useMemo)(()=>he.map(e=>({id:e,label:L(e)})),[]),we=(0,H.useMemo)(()=>[{id:`fast`,label:ne()},{id:`standard`,label:a()}],[]);return(0,U.jsxs)(`div`,{className:`oc-cdefaults`,children:[(0,U.jsx)(`p`,{className:`oc-admin__hint`,children:s()}),G&&I?(0,U.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,U.jsx)(`span`,{className:`oc-cdefaults__label`,children:r()}),(0,U.jsxs)(V,{value:I,onValueChange:e=>W(e),disabled:y,children:[(0,U.jsx)(de,{size:`sm`,"aria-label":r(),children:(0,U.jsx)(oe,{})}),(0,U.jsx)(F,{children:(N??[]).map(e=>(0,U.jsx)(B,{value:e.name,children:e.name},e.name))})]})]}):null,ye?(0,U.jsx)(`p`,{className:`oc-admin__hint`,role:`status`,children:f()}):K===`loading`?(0,U.jsx)(`p`,{className:`oc-admin__hint`,children:h()}):K.blocked?(0,U.jsxs)(`p`,{className:`oc-compat__blocked`,role:`status`,children:[(0,U.jsx)(P,{size:14,"aria-hidden":!0}),` `,me(K.gatewayVersion)]}):i.status===`loading`?(0,U.jsx)(`p`,{className:`oc-admin__hint`,children:h()}):i.status===`error`?(0,U.jsxs)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:[E(),` `,(0,U.jsx)(A,{variant:`outline`,size:`sm`,onClick:()=>void X(),children:l()})]}):(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,U.jsx)(`span`,{className:`oc-cdefaults__label`,children:g()}),(0,U.jsx)(R,{options:Ce,value:u.thinkingDefault,onChange:e=>d({...u,thinkingDefault:e}),disabled:y}),(0,U.jsx)(`p`,{className:`oc-cdefaults__help`,children:D()})]}),(0,U.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,U.jsx)(`span`,{className:`oc-cdefaults__label`,children:x()}),(0,U.jsx)(R,{options:we,value:u.fastModeDefault===null?null:u.fastModeDefault?`fast`:`standard`,onChange:e=>d({...u,fastModeDefault:e===`fast`}),disabled:y}),(0,U.jsx)(`p`,{className:`oc-cdefaults__help`,children:O()})]}),(0,U.jsx)(`div`,{className:`oc-cdefaults__actions`,children:(0,U.jsx)(A,{size:`sm`,disabled:!xe||y,onClick:()=>v(!0),children:y?p():b()})}),(0,U.jsx)(`p`,{className:`oc-cdefaults__note`,children:re()})]}),(()=>{let e=N?.find(e=>e.name===(I??N[0]?.name));return e?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(ve,{instance:e}),(0,U.jsx)(_e,{instance:e})]}):null})(),(0,U.jsx)(j,{open:_,onOpenChange:v,children:(0,U.jsxs)(pe,{children:[(0,U.jsxs)(se,{children:[(0,U.jsx)(fe,{children:ie()}),(0,U.jsx)(ae,{children:ee()})]}),(0,U.jsxs)(M,{children:[(0,U.jsx)(ue,{children:te()}),(0,U.jsx)(ce,{onClick:()=>void Se(),children:S()})]})]})})]})}export{W as ChatDefaultsTab};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Bu as r,Hu as i,Iu as a,Lu as o,Ru as s,Vu as c,zu as l}from"./dist-
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Bu as r,Hu as i,Iu as a,Lu as o,Ru as s,Vu as c,zu as l}from"./dist-DLKTmLXq.js";import{i as u,r as d}from"./dist-CNjYZaW-.js";import{t as f}from"./chevrons-up-down-CNTF8s9f.js";import{t as p}from"./button-BgI9tkZX.js";import{Ct as m,J as h,Ot as g,Q as _,Y as v,Z as y,_ as b,q as x,vt as S}from"./index-D6NQyqlV.js";import{a as C,i as w,n as T,o as E,r as D,t as O}from"./table-CwHklpki.js";var k=t(e(),1);function A(e,t){return typeof e==`number`&&typeof t==`number`?e-t:typeof e==`boolean`&&typeof t==`boolean`?!!e-+!!t:String(e).localeCompare(String(t),void 0,{numeric:!0,sensitivity:`base`})}function j(e,t,n){return[...e].sort((e,r)=>{let i=t(e),a=t(r),o=i==null,s=a==null;if(o||s)return o&&s?0:o?1:-1;let c=A(i,a);return n===`asc`?c:-c})}var M=n();function N({title:e,rows:t,columns:n,rowActions:A,onAdd:N,addLabel:P=i(),bulkActions:F,emptyHint:I=c(),isExpanded:L,renderExpanded:R}){let[z,B]=(0,k.useState)(new Set),[V,H]=(0,k.useState)(null),U=t??[],W=V?n[V.index]:void 0,G=V&&W?.sort?j(U,W.sort,V.dir):U;function K(e){H(t=>!t||t.index!==e?{index:e,dir:`asc`}:t.dir===`asc`?{index:e,dir:`desc`}:null)}let q=+!!F+n.length+ +!!A,J=U.length>0&&z.size===U.length,Y=z.size>0&&!J;function X(){B(J?new Set:new Set(U.map(e=>e._id)))}function Z(e){B(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})}return(0,M.jsxs)(`div`,{className:`oc-dt`,children:[(0,M.jsxs)(`div`,{className:`oc-dt__bar`,children:[(0,M.jsx)(`h2`,{className:`oc-dt__title`,children:e}),(0,M.jsxs)(`div`,{className:`oc-dt__bar-actions`,children:[z.size>0&&F?F.map(e=>(0,M.jsxs)(p,{size:`sm`,variant:e.variant===`destructive`?`destructive`:`outline`,onClick:()=>{e.onSelect([...z]),B(new Set)},children:[e.variant===`destructive`?(0,M.jsx)(S,{}):null,e.label,` (`,z.size,`)`]},e.label)):null,N?(0,M.jsxs)(p,{size:`sm`,onClick:N,children:[(0,M.jsx)(m,{}),` `,P]}):null]})]}),t===void 0?(0,M.jsx)(`p`,{className:`oc-admin__hint`,children:r()}):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":l(),checked:J?!0:Y?`indeterminate`:!1,onCheckedChange:X})}):null,n.map((e,t)=>{let n=V?.index===t;return e.sort?(0,M.jsx)(w,{className:e.className,"aria-sort":n?V.dir===`asc`?`ascending`:`descending`:`none`,children:(0,M.jsxs)(`button`,{type:`button`,className:`oc-dt__sort`,onClick:()=>K(t),"aria-label":a({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)(x,{children:[(0,M.jsx)(_,{asChild:!0,children:(0,M.jsx)(p,{variant:`ghost`,size:`icon-sm`,"aria-label":o(),className:`opacity-0 transition-opacity group-hover/row:opacity-100 group-focus-within/row:opacity-100 aria-expanded:opacity-100`,children:(0,M.jsx)(g,{})})}),(0,M.jsx)(h,{align:`end`,children:t.map((t,n)=>(0,M.jsxs)(`div`,{children:[t.variant===`destructive`&&n>0?(0,M.jsx)(y,{}):null,(0,M.jsx)(v,{variant:t.variant,onSelect:()=>t.onSelect(e),children:t.label})]},t.label))})]}):null}):null]}),r&&R?(0,M.jsx)(E,{className:`oc-dt__expansion`,children:(0,M.jsx)(D,{colSpan:q,className:`oc-dt__expansion-cell`,children:R(e)})}):null]},e._id)})})]})]})}export{N as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./bundle-mjs-C73ZY4La.js";import{$ as t}from"./index-
|
|
1
|
+
import{r as e}from"./bundle-mjs-C73ZY4La.js";import{$ as t}from"./index-D6NQyqlV.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{$b as r,AA as i,Ax as a,Bx as o,Cx as s,Dx as c,E as l,Ex as u,Fx as d,Gx as f,Hx as p,Ix as m,Jb as h,Kb as g,Kx as _,Lx as v,Mx as ee,Nx as te,Ox as ne,Px as re,Qb as ie,Rx as y,Sx as b,Tx as x,Ux as S,Vx as C,Wx as w,Xb as T,Yb as E,Zb as D,_x as O,ax as k,bx as A,cx as j,dx as M,ex as N,fx as P,gx as F,hx as I,in as L,ix as R,jA as z,jx as B,kx as V,lx as H,mx as ae,nx as U,on as W,ox as G,px as K,qb as q,qx as J,rx as oe,sx as se,tx as ce,ux as le,vx as ue,wx as de,xx as fe,yx as pe,zx as me}from"./dist-DLKTmLXq.js";import{t as he}from"./button-BgI9tkZX.js";import{P as ge,k as _e}from"./index-D6NQyqlV.js";import{t as Y}from"./DataTableShell-nb7UG6xl.js";var X=t(e(),1),Z=n(),ve={altered_words:()=>J(),incorrect:()=>_(),incoherence:()=>f(),formatting:()=>w(),latency:()=>S(),api_error:()=>p(),other:()=>C()},Q=e=>ve[e]?.()??e;function $({matches:e,sourceWasOpen:t}){return t?e===!0?(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-ok`,children:me()}):e===!1?(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-warn`,children:y()}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill`,children:`—`}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill`,children:o()})}function ye({data:e,closeReason:t}){let n=e.snapshot,r=i(l.feedback.respondToFeedback),[o,f]=(0,X.useState)(e.thread),[p,h]=(0,X.useState)(``),[g,_]=(0,X.useState)(!1);async function y(){let t=p.trim();if(!(!t||g)){_(!0);try{await r({feedbackId:e._id,text:t}),f(e=>[...e,{authorRole:`admin`,text:t,at:Date.now()}]),h(``)}finally{_(!1)}}}let S=[];try{S=n.contextJson?JSON.parse(n.contextJson):[]}catch{S=[]}return(0,Z.jsxs)(`div`,{className:`oc-fbadmin__detail`,children:[(0,Z.jsxs)(`div`,{className:`oc-fbadmin__row`,children:[(0,Z.jsx)($,{matches:n.displayedMatchesStored,sourceWasOpen:n.clientInfo?.sourceWasOpen??!1}),(0,Z.jsxs)(`span`,{className:`oc-fbadmin__meta`,children:[Q(e.category),` · `,n.messageRole,n.isRegeneration?` · ${v()}`:``,n.openclawModel?` · ${n.openclawModel}`:``,n.openclawRuntime?` (${n.openclawRuntime})`:``]})]}),e.comment?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:m()}),(0,Z.jsx)(`p`,{className:`oc-fbadmin__comment`,children:e.comment})]}):null,t?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:ie()}),(0,Z.jsx)(`p`,{className:`oc-fbadmin__comment`,children:t})]}):null,(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:d()}),o.length>0?(0,Z.jsx)(`div`,{className:`oc-fbadmin__thread`,children:o.map((e,t)=>(0,Z.jsxs)(`div`,{className:`oc-notif__msg oc-notif__msg--${e.authorRole}`,children:[(0,Z.jsx)(`span`,{className:`oc-notif__msg-who`,children:e.authorRole===`admin`?re():e.authorRole===`agent`?e.authorLabel??W():te()}),(0,Z.jsx)(`span`,{className:`oc-notif__msg-text`,children:e.text})]},t))}):(0,Z.jsx)(`p`,{className:`oc-fbadmin__meta`,children:ee()}),(0,Z.jsx)(`textarea`,{className:`oc-feedback__textarea`,placeholder:B(),value:p,maxLength:2e3,rows:3,onChange:e=>h(e.target.value.slice(0,2e3))}),(0,Z.jsx)(`div`,{className:`oc-fbadmin__row`,style:{justifyContent:`flex-end`},children:(0,Z.jsx)(he,{size:`sm`,onClick:()=>void y(),disabled:!p.trim()||g,children:g?a():V()})})]}),(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:ne()}),(0,Z.jsx)(`pre`,{className:`oc-msg__source-pre`,children:n.messageText||c()})]}),n.clientInfo?.sourceWasOpen&&n.displayedText!==void 0?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:u()}),(0,Z.jsx)(`pre`,{className:`oc-msg__source-pre`,children:n.displayedText||c()})]}):null,n.promptText?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:x()}),(0,Z.jsx)(`pre`,{className:`oc-msg__source-pre`,children:n.promptText})]}):null,S.length>0?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:de({count:n.contextCount??S.length,truncated:n.contextTruncated?s():``})}),(0,Z.jsx)(`div`,{className:`oc-fbadmin__ctx`,children:S.map((e,t)=>(0,Z.jsxs)(`div`,{className:`oc-fbadmin__ctx-turn`,children:[(0,Z.jsx)(`span`,{className:`oc-fbadmin__ctx-role`,children:e.role}),(0,Z.jsx)(`span`,{className:`oc-fbadmin__ctx-text`,children:e.text})]},t))})]}):null,n.outboxAvailable?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:b()}),(0,Z.jsxs)(`pre`,{className:`oc-msg__source-pre`,children:[n.outboxText??``,n.outboxStatus?`\n[status: ${n.outboxStatus}]`:``]})]}):null,n.clientInfo?.extensionsDetected&&n.clientInfo.extensionsDetected.length>0?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:fe()}),(0,Z.jsx)(`div`,{className:`oc-fbadmin__row`,children:n.clientInfo.extensionsDetected.map(e=>(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-warn`,children:e},e))})]}):null,(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:A()}),(0,Z.jsxs)(`p`,{className:`oc-fbadmin__env`,children:[[n.clientInfo?.language,n.clientInfo?.timezone,n.clientInfo?.theme?pe({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,Z.jsxs)(`span`,{className:`oc-fbadmin__plugins`,children:[ue(),` `,n.clientInfo.plugins.join(`, `),(0,Z.jsxs)(`span`,{className:`oc-fbadmin__note`,children:[` `,O()]})]}):null,n.clientInfo?.userAgent?(0,Z.jsx)(`span`,{className:`oc-fbadmin__ua`,children:n.clientInfo.userAgent}):null]})]})]})}function be(){let e=z(l.feedback.listForAdmin,{}),t=i(l.feedback.readSnapshot),n=i(l.feedback.deleteFeedback),a=ge(),[o,s]=(0,X.useState)(null),[c,u]=(0,X.useState)({});async function d(e){if(o===e._id){s(null);return}if(!c[e._id]){let n=await t({feedbackId:e._id});u(t=>({...t,[e._id]:n}))}s(e._id)}async function f(e){await a({title:h(),description:q(),confirmLabel:g(),destructive:!0})&&(await n({feedbackId:e._id}),o===e._id&&s(null))}return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`p`,{className:`oc-admin__hint`,children:[F(),` `,(0,Z.jsx)(`strong`,{children:I()}),` `,ae()]}),(0,Z.jsx)(Y,{title:K(),rows:e,emptyHint:P(),isExpanded:e=>o===e._id&&!!c[e._id],renderExpanded:e=>c[e._id]?(0,Z.jsx)(ye,{data:c[e._id],closeReason:e.userCloseReason}):null,columns:[{header:M(),cell:e=>_e(e.at),sort:e=>e.at},{header:le(),cell:e=>Q(e.category),sort:e=>Q(e.category)},{header:H(),cell:e=>e.messageRole===`user`?j():se(),sort:e=>e.messageRole},{header:G(),cell:e=>(e.reporterEmail||e.reporterName||`—`)+(e.impersonated&&e.realOperatorEmail?` ${k({operator:e.realOperatorEmail})}`:``),sort:e=>e.reporterEmail||e.reporterName||null},{header:R(),cell:e=>(0,Z.jsx)($,{matches:e.displayedMatchesStored,sourceWasOpen:e.sourceWasOpen}),sort:e=>e.displayedMatchesStored===!1?0:e.displayedMatchesStored===!0?1:2},{header:oe(),cell:e=>e.hasComment?`✎`:`—`,sort:e=>+!!e.hasComment},{header:U(),cell:e=>e.userClosedAt==null?e.resolvedAt==null?e.answered?(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-ok`,children:ce()}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill`,children:N()}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-ok`,title:e.resolvedBy??void 0,children:L()}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-closed`,children:r()}),sort:e=>e.userClosedAt==null?e.resolvedAt==null?+!!e.answered:2:3}],rowActions:e=>[{label:o===e._id?D():T(),onSelect:()=>void d(e)},{label:E(),onSelect:()=>void f(e),variant:`destructive`}]})]})}export{be as FeedbacksTab};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{r as e}from"./bundle-mjs-C73ZY4La.js";import{D as t,
|
|
1
|
+
import{r as e}from"./bundle-mjs-C73ZY4La.js";import{D as t,RA as n}from"./dist-DLKTmLXq.js";import{c as r,l as i,s as a,u as o}from"./index-D6NQyqlV.js";import"./locales-CPjguROj.js";import"./curation-CQksaIbm.js";var s=t(`circle-question-mark`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3`,key:`1u773s`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]]),c={media_delivery:{key:`media_delivery`,appliedIn:`bridge`,togglable:!0,placeholders:[`outboundDir`],defaultTemplate:{fr:`[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.`,en:`[DELIVERY]
|
|
3
3
|
To make a file you generate downloadable by the user in this webchat: write it under {outboundDir}/ then add, in your final reply, a dedicated line EXACTLY in the format MEDIA:<absolute file path>. Do NOT use a markdown link to a local path — it would not be clickable.`}},documentary_fetch:{key:`documentary_fetch`,appliedIn:`convex`,togglable:!0,placeholders:[`references`],defaultTemplate:{fr:`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 :
|
|
4
4
|
{references}`,en:`Provide the downloadable source files matching EXACTLY these document references (one file per reference, named after the reference). Reply only with the files, no commentary:
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$k as r,AA as ee,Ak as te,Bk as i,Ck as a,Dk as ne,E as o,Ek as re,Fk as ie,Gk as s,Hk as c,Ik as l,Jk as u,Kk as d,Lk as f,Mk as p,Nk as ae,Ok as oe,Pk as se,Qk as m,Rk as ce,SA as le,Sk as ue,Tk as de,Uk as h,Vk as g,Wk as _,Xk as fe,Yk as pe,Zk as me,eA as he,hT as ge,jA as _e,jk as ve,kk as v,ln as ye,nA as be,qk as y,tA as b,un as x,wA as S,wk as C,xk as w,zk as T}from"./dist-DLKTmLXq.js";import{t as E}from"./button-BgI9tkZX.js";import{$ as D,B as O,C as k,H as A,I as j,J as M,L as N,N as xe,Ot as Se,Q as Ce,R as we,S as P,St as Te,U as Ee,V as De,Y as F,_ as Oe,b as I,kt as L,q as ke,vt as Ae,x as R,y as z,z as je}from"./index-D6NQyqlV.js";import{a as Me,i as B,n as Ne,o as V,r as H,t as Pe}from"./table-CwHklpki.js";var U=t(e(),1),W=n(),G=`all`;function K(e){switch(e){case`image`:return s();case`audio`:return _();case`video`:return h();case`pdf`:return c();case`document`:return g();case`archive`:return i();default:return T()}}function q(){let[e,t]=(0,U.useState)(G),[n,i]=(0,U.useState)(G),[s,c]=(0,U.useState)(G),[h,g]=(0,U.useState)(G),[_,T]=(0,U.useState)(!1),[q,J]=(0,U.useState)(null),Fe=ee(o.files.softDelete),Y=xe();function Ie(){t(G),i(G),c(G),g(G)}async function Le(){let e=q;if(J(null),e)try{await Fe({fileId:e.id}),Y.success(oe())}catch(e){Y.error(ne(),e)}}let X=_e(o.files.listMine,{direction:e===G?void 0:e,chatId:n===G?void 0:n,instanceName:s===G?void 0:s,category:h===G?void 0:h,includeAutoGenerated:_||void 0}),Re=(0,U.useMemo)(()=>new Intl.DateTimeFormat(S(),{dateStyle:`medium`,timeStyle:`short`}),[]);if(X===void 0)return(0,W.jsx)(`p`,{className:`oc-admin__hint`,children:le()});let{files:Z,facets:Q,truncated:ze,cap:Be}=X,$=e!==G||n!==G||s!==G||h!==G;return(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`p`,{className:`oc-admin__hint`,children:be()}),(0,W.jsxs)(`div`,{className:`oc-files__filters`,style:{display:`flex`,flexWrap:`wrap`,gap:8,margin:`12px 0`},children:[(0,W.jsxs)(z,{value:e,onValueChange:t,children:[(0,W.jsx)(P,{size:`sm`,"aria-label":b(),children:(0,W.jsx)(k,{})}),(0,W.jsxs)(I,{children:[(0,W.jsx)(R,{value:G,children:he()}),(0,W.jsx)(R,{value:`inbound`,children:r()}),(0,W.jsx)(R,{value:`outbound`,children:m()})]})]}),(0,W.jsxs)(z,{value:n,onValueChange:i,children:[(0,W.jsx)(P,{size:`sm`,"aria-label":me(),children:(0,W.jsx)(k,{})}),(0,W.jsxs)(I,{children:[(0,W.jsx)(R,{value:G,children:fe()}),Q.chats.map(e=>(0,W.jsx)(R,{value:e.id,children:e.title},e.id))]})]}),Q.multiProvider?(0,W.jsxs)(z,{value:s,onValueChange:c,children:[(0,W.jsx)(P,{size:`sm`,"aria-label":pe(),children:(0,W.jsx)(k,{})}),(0,W.jsxs)(I,{children:[(0,W.jsx)(R,{value:G,children:u()}),Q.instances.map(e=>(0,W.jsx)(R,{value:e,children:e},e))]})]}):null,(0,W.jsxs)(z,{value:h,onValueChange:g,children:[(0,W.jsx)(P,{size:`sm`,"aria-label":y(),children:(0,W.jsx)(k,{})}),(0,W.jsxs)(I,{children:[(0,W.jsx)(R,{value:G,children:d()}),Q.categories.map(e=>(0,W.jsx)(R,{value:e,children:K(e)},e))]})]}),(0,W.jsxs)(`label`,{className:`oc-files__autogen`,children:[(0,W.jsx)(Oe,{checked:_,onCheckedChange:e=>T(e===!0),"aria-label":x()}),(0,W.jsx)(`span`,{children:x()})]}),$?(0,W.jsxs)(E,{variant:`ghost`,size:`sm`,onClick:Ie,style:{display:`inline-flex`,alignItems:`center`,gap:4,marginLeft:`auto`},children:[(0,W.jsx)(Te,{size:14,"aria-hidden":!0}),ve()]}):null]}),Z.length===0?(0,W.jsx)(`p`,{className:`oc-admin__hint`,children:$?ue():a()}):(0,W.jsxs)(W.Fragment,{children:[(0,W.jsxs)(Pe,{children:[(0,W.jsx)(Me,{children:(0,W.jsxs)(V,{children:[(0,W.jsx)(B,{children:ce()}),(0,W.jsx)(B,{children:f()}),(0,W.jsx)(B,{children:l()}),(0,W.jsx)(B,{children:ie()}),(0,W.jsx)(B,{children:se()}),(0,W.jsx)(B,{className:`text-right`,children:ae()})]})}),(0,W.jsx)(Ne,{children:Z.map(e=>(0,W.jsxs)(V,{children:[(0,W.jsxs)(H,{className:`font-medium`,style:{maxWidth:280,overflow:`hidden`,textOverflow:`ellipsis`},title:e.filename,children:[e.filename,e.origin===`pasted`?(0,W.jsx)(D,{variant:`outline`,style:{marginLeft:6},children:ye()}):null]}),(0,W.jsx)(H,{title:e.mimeType,children:K(e.category)}),(0,W.jsx)(H,{children:(0,W.jsx)(D,{variant:`secondary`,children:e.direction===`inbound`?r():m()})}),(0,W.jsx)(H,{style:{maxWidth:220,overflow:`hidden`,textOverflow:`ellipsis`},title:e.chatTitle,children:e.chatTitle}),(0,W.jsx)(H,{className:`whitespace-nowrap text-muted-foreground`,children:Re.format(e.createdAt)}),(0,W.jsx)(H,{className:`text-right`,children:(0,W.jsxs)(ke,{children:[(0,W.jsx)(Ce,{asChild:!0,children:(0,W.jsx)(E,{variant:`ghost`,size:`icon`,"aria-label":te(),children:(0,W.jsx)(Se,{size:16})})}),(0,W.jsxs)(M,{align:`end`,children:[e.url?(0,W.jsx)(F,{asChild:!0,children:(0,W.jsxs)(`a`,{href:e.url,download:e.filename,target:`_blank`,rel:`noopener noreferrer`,children:[(0,W.jsx)(L,{size:14}),p()]})}):(0,W.jsxs)(F,{disabled:!0,children:[(0,W.jsx)(L,{size:14}),C()]}),(0,W.jsxs)(F,{variant:`destructive`,onSelect:()=>J({id:e._id,filename:e.filename}),children:[(0,W.jsx)(Ae,{size:14}),v()]})]})]})})]},e._id))})]}),ze?(0,W.jsx)(`p`,{className:`oc-admin__hint`,style:{marginTop:8},children:w({cap:Be})}):null]}),(0,W.jsx)(j,{open:q!==null,onOpenChange:e=>!e&&J(null),children:(0,W.jsxs)(je,{children:[(0,W.jsxs)(A,{children:[(0,W.jsx)(Ee,{children:re()}),(0,W.jsx)(O,{children:de()})]}),(0,W.jsxs)(De,{children:[(0,W.jsx)(we,{children:ge()}),(0,W.jsx)(N,{onClick:()=>void Le(),children:v()})]})]})})]})}export{q as FilesTab};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Uu as r,Wu as i}from"./dist-
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Uu as r,Wu as i}from"./dist-DLKTmLXq.js";import{t as a}from"./button-BgI9tkZX.js";import{St as o,et as s,xt as c}from"./index-D6NQyqlV.js";import{t as l}from"./TimeRangePicker-CD2-qOqD.js";var u=t(e(),1),d=n(),f=250;function p({q:e,onQChange:t,searchPlaceholder:n=i(),children:p,timeRange:m,onTimeRangeChange:h,onReset:g,canReset:_=!0}){let[v,y]=(0,u.useState)(e);(0,u.useEffect)(()=>{y(e)},[e]);let b=(0,u.useRef)(null);function x(e){y(e),b.current!==null&&window.clearTimeout(b.current),b.current=window.setTimeout(()=>t(e),f)}(0,u.useEffect)(()=>()=>{b.current!==null&&window.clearTimeout(b.current)},[]);function S(){b.current!==null&&window.clearTimeout(b.current),g()}return(0,d.jsxs)(`div`,{className:`oc-filterbar`,children:[(0,d.jsxs)(`div`,{className:`oc-filterbar__search`,children:[(0,d.jsx)(c,{className:`oc-filterbar__search-icon`,"aria-hidden":!0}),(0,d.jsx)(s,{value:v,onChange:e=>x(e.target.value),placeholder:n,"aria-label":n})]}),p?(0,d.jsx)(`div`,{className:`oc-filterbar__quick`,children:p}):null,m&&h?(0,d.jsx)(l,{value:m,onChange:h}):null,(0,d.jsxs)(a,{variant:`ghost`,size:`sm`,className:`oc-filterbar__reset`,onClick:S,disabled:!_,children:[(0,d.jsx)(o,{}),r()]})]})}export{p as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$c as r,$s as i,Ac as a,Bc as o,Cc as s,D as c,Dc as l,E as u,Ec as d,Fc as f,Gc as p,Hc as m,Ic as h,Jc as g,Kc as _,Lc as v,Mc as y,Nc as b,Oc as x,Pc as S,Qc as ee,Qs as C,Rc as te,Sc as w,TA as T,Tc as E,Uc as D,Vc as ne,Wc as O,Xc as k,Xs as A,Yc as re,Ys as j,Zc as M,Zs as N,_c as ie,ac as P,bc as F,cc as ae,dc as oe,ec as se,el as I,fc as L,gc as R,hc as ce,ic as le,il as ue,jc as de,kc as z,lc as fe,mc as pe,nc as me,nl as he,oc as ge,pc as _e,qc as ve,rc as ye,rl as be,sc as xe,tc as Se,tl as Ce,uc as we,vc as Te,wA as B,wc as Ee,xc as De,yc as Oe,zc as ke}from"./dist-BJuS9RKK.js";import{t as Ae}from"./x-DzHSe3Kh.js";import{i as V,n as H,r as je,t as Me}from"./tabs-bHkQWa8h.js";import{t as U}from"./button-C3T_nXdg.js";import{$ as W,C as Ne,N as G,Nt as Pe,P as Fe,S as Ie,_ as K,at as Le,b as Re,bt as q,et as J,lt as ze,m as Be,nt as Ve,ot as He,rt as Ue,tt as We,x as Ge,y as Ke,yt as Y}from"./index-DgeJfwWI.js";import{t as qe}from"./FilterBar-CZN4zOuy.js";import{t as Je}from"./DataTableShell-DzK-qEdq.js";import{t as X}from"./DetailChips-BIvUUZKQ.js";var Ye=c(`chevron-left`,[[`path`,{d:`m15 18-6-6 6-6`,key:`1wnfg3`}]]),Xe=c(`palette`,[[`path`,{d:`M12 22a1 1 0 0 1 0-20 10 9 0 0 1 10 9 5 5 0 0 1-5 5h-2.25a1.75 1.75 0 0 0-1.4 2.8l.3.4a1.75 1.75 0 0 1-1.4 2.8z`,key:`e79jfc`}],[`circle`,{cx:`13.5`,cy:`6.5`,r:`.5`,fill:`currentColor`,key:`1okk4w`}],[`circle`,{cx:`17.5`,cy:`10.5`,r:`.5`,fill:`currentColor`,key:`f64h9f`}],[`circle`,{cx:`6.5`,cy:`12.5`,r:`.5`,fill:`currentColor`,key:`qy21gx`}],[`circle`,{cx:`8.5`,cy:`7.5`,r:`.5`,fill:`currentColor`,key:`fotxhn`}]]),Z=c(`shield-check`,[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`,key:`oel41y`}],[`path`,{d:`m9 12 2 2 4-4`,key:`dzmm74`}]]),Ze=c(`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 E();case`user`:return Ee();case`pending`:return s();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=T(u.groups.listGroups,{}),t=T(u.me.getMe,{host:ze})?.role===`admin`,n=B(u.groups.createGroup),i=B(u.groups.updateGroup),a=B(u.groups.deleteGroup),s=Fe(),c=G(),[l,d]=(0,Q.useState)(!1),[f,h]=(0,Q.useState)(null),[y,b]=(0,Q.useState)(it),[x,S]=(0,Q.useState)(null),[w,E]=(0,Q.useState)(``),A=(0,Q.useMemo)(()=>{if(!e)return e;let t=w.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,w]);function j(){h(null),b(it),d(!0)}function ie(e){h(e),b({name:e.name,description:e.description??``}),d(!0)}async function P(){try{f?await i({groupId:f._id,name:y.name,description:y.description}):await n({name:y.name,description:y.description||void 0}),b(it),h(null),d(!1)}catch(e){c.error(C(),e)}}async function F(e){if(await s({title:ke({name:e.name}),description:te(),confirmWord:e.name,confirmLabel:v(),cancelLabel:p(),destructive:!0}))try{await a({groupId:e._id})}catch(e){c.error(N(),e)}}return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`p`,{className:`oc-admin__hint`,children:be()}),(0,$.jsx)(qe,{q:w,onQChange:E,onReset:()=>E(``),canReset:w!==``,searchPlaceholder:k()}),(0,$.jsx)(Je,{title:ue(),rows:A,addLabel:he(),onAdd:t?j:void 0,emptyHint:Ce(),columns:[{header:I(),cell:e=>e.name,sort:e=>e.name},{header:r(),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:ee(),cell:e=>(0,$.jsx)(X,{icon:(0,$.jsx)(q,{size:12,"aria-hidden":!0}),total:e.agentCount,items:e.agents.map(e=>({label:e}))}),sort:e=>e.agentCount},{header:M(),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:re(),onSelect:()=>S({groupId:e._id,name:e.name})},...t?[{label:g(),onSelect:()=>ie(e)},{label:ve(),variant:`destructive`,onSelect:()=>void F(e)}]:[]]}),(0,$.jsx)(Be,{open:l,onOpenChange:d,title:f?D():O(),description:m(),canSubmit:!!y.name.trim(),onSubmit:P,submitLabel:_(),children:(0,$.jsxs)(`div`,{className:`oc-form`,children:[(0,$.jsxs)(`label`,{className:`oc-field`,children:[(0,$.jsx)(`span`,{className:`oc-field__label`,children:ne()}),(0,$.jsx)(J,{value:y.name,onChange:e=>b({...y,name:e.target.value})})]}),(0,$.jsxs)(`label`,{className:`oc-field`,children:[(0,$.jsx)(`span`,{className:`oc-field__label`,children:o()}),(0,$.jsx)(J,{value:y.description,onChange:e=>b({...y,description:e.target.value})})]})]})}),(0,$.jsx)(ct,{groupId:x?.groupId??null,groupName:x?.name??``,open:x!==null,onOpenChange:e=>{e||S(null)}})]})}var ot=8;function st({page:e,pageCount:t,onPage:n}){return t<=1?null:(0,$.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}),x()]}),(0,$.jsxs)(`span`,{className:`oc-access__pageinfo`,"aria-label":d({page:e,pages:t}),children:[e,` / `,t]}),(0,$.jsxs)(U,{type:`button`,variant:`ghost`,size:`sm`,disabled:e>=t,onClick:()=>n(e+1),children:[l(),(0,$.jsx)(Pe,{size:14,"aria-hidden":!0})]})]})}function ct({groupId:e,groupName:t,open:n,onOpenChange:r}){let i=T(u.groups.getGroup,n&&e?{groupId:e}:`skip`),o=T(u.groups.listAssignableInstances,n?{}:`skip`),s=T(u.groups.listAssignableUsers,n?{}:`skip`),c=B(u.groups.addMember),l=B(u.groups.removeMember),d=B(u.groups.bulkSetMembers),p=B(u.groups.setGroupManager),m=G(),[g,_]=(0,Q.useState)(``),[v,x]=(0,Q.useState)(``),[ee,C]=(0,Q.useState)(`members`),[te,E]=(0,Q.useState)(1),[D,ne]=(0,Q.useState)(new Set),O=(0,Q.useRef)(null),k=(0,Q.useMemo)(()=>new Set((i?.members??[]).map(e=>e.userId)),[i]),re=(0,Q.useMemo)(()=>new Set((i?.members??[]).filter(e=>e.manager).map(e=>e.userId)),[i]),j=i?.viewerIsAdmin===!0,M=(0,Q.useMemo)(()=>new Set((i?.agents??[]).map(e=>`${e.instanceName}/${e.agentId}`)),[i]);(0,Q.useEffect)(()=>{_(``),x(``),C(`members`),E(1),O.current=null},[n,e]),(0,Q.useEffect)(()=>{E(1)},[g]),(0,Q.useEffect)(()=>{n&&i&&e&&O.current!==e&&(O.current=e,ne(new Set((i.members??[]).map(e=>e.userId))))},[n,i,e]);let N=(0,Q.useMemo)(()=>s?Qe(s,g,D):[],[s,g,D]);async function P(t,n){if(e)try{n?await l({groupId:e,userId:t}):await c({groupId:e,userId:t})}catch(e){m.error(A(),e)}}async function ae(t,n){if(e)try{await p({groupId:e,userId:t,manager:!n})}catch(e){m.error(se(),e)}}let I=nt(N,e=>k.has(e.userId)),L=N.filter(e=>k.has(e.userId)).length,R=rt(N,te,ot);async function ce(){if(!e||N.length===0)return;let t=N.map(e=>e.userId);try{await d({groupId:e,userIds:t,member:I!==`all`})}catch(e){m.error(A(),e)}}return(0,$.jsx)(We,{open:n,onOpenChange:r,children:(0,$.jsxs)(Ve,{className:`oc-access`,children:[(0,$.jsxs)(Le,{children:[(0,$.jsx)(He,{children:h({name:t})}),(0,$.jsx)(Ue,{children:f()})]}),(0,$.jsxs)(Me,{value:ee,onValueChange:C,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}),S(),i?(0,$.jsx)(W,{variant:`secondary`,className:`oc-access__tabcount`,children:k.size}):null]}),(0,$.jsxs)(V,{value:`agents`,className:`flex-1 gap-1.5`,children:[(0,$.jsx)(q,{size:13,"aria-hidden":!0}),y(),i?(0,$.jsx)(W,{variant:`secondary`,className:`oc-access__tabcount`,children:M.size}):null]}),(0,$.jsxs)(V,{value:`charts`,className:`flex-1 gap-1.5`,children:[(0,$.jsx)(Xe,{size:13,"aria-hidden":!0}),oe(),i?(0,$.jsx)(W,{variant:`secondary`,className:`oc-access__tabcount`,children:i.chartCount}):null]})]}),(0,$.jsx)(H,{value:`members`,children:s===void 0||i===void 0?(0,$.jsx)(`p`,{className:`oc-access__hint`,children:F()}):s.length===0?(0,$.jsx)(`p`,{className:`oc-access__hint`,children:Te()}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(J,{value:g,onChange:e=>_(e.target.value),placeholder:b(),className:`oc-access__search`}),N.length===0?(0,$.jsx)(`p`,{className:`oc-access__hint`,children:a()}):(0,$.jsxs)($.Fragment,{children:[N.length>1?(0,$.jsxs)(`div`,{className:`oc-access__row oc-access__selectall`,children:[(0,$.jsx)(K,{checked:I===`all`?!0:I===`some`?`indeterminate`:!1,onCheckedChange:()=>void ce(),"aria-label":z()}),(0,$.jsx)(`span`,{className:`oc-access__label`,children:z()}),(0,$.jsxs)(W,{variant:`outline`,className:`oc-access__count`,children:[L,` / `,N.length]})]}):null,(0,$.jsx)(`div`,{className:`oc-access__list`,children:R.pageItems.map(e=>{let t=k.has(e.userId),n=et(e),r=re.has(e.userId);return(0,$.jsxs)(`div`,{className:`oc-access__row`,children:[(0,$.jsx)(K,{checked:t,onCheckedChange:()=>void P(e.userId,t),"aria-label":w({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)(W,{variant:`outline`,className:`oc-access__role`,children:tt(e.role)}),(0,$.jsx)(`span`,{className:`oc-access__mgrslot`,children:t&&j?(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?Se():me(),title:r?Se():me(),onClick:()=>void ae(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":ye(),title:ye(),children:(0,$.jsx)(Z,{size:15,"aria-hidden":!0})}):null})]},e._id)})}),(0,$.jsx)(st,{page:R.page,pageCount:R.pageCount,onPage:E})]})]})}),(0,$.jsx)(H,{value:`agents`,children:o===void 0?(0,$.jsx)(`p`,{className:`oc-access__hint`,children:F()}):o.length===0?(0,$.jsx)(`p`,{className:`oc-access__hint`,children:ie()}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(J,{value:v,onChange:e=>x(e.target.value),placeholder:de(),className:`oc-access__search`}),(0,$.jsx)(`div`,{className:`oc-access__list`,children:o.map(t=>(0,$.jsx)(lt,{groupId:e,instanceName:t.name,kind:t.kind??`openclaw`,assigned:M,query:v},`${e}-${t._id}`))})]})}),(0,$.jsx)(H,{value:`charts`,children:(0,$.jsx)(ut,{groupId:e})})]})]})})}function lt({groupId:e,instanceName:t,kind:n,assigned:r,query:i}){let a=T(u.groups.listAssignableAgents,{instanceName:t}),o=B(u.groups.assignAgentToGroup),s=B(u.groups.removeAgentFromGroup),c=B(u.groups.bulkSetGroupAgents),l=G(),[d,f]=(0,Q.useState)(1);if((0,Q.useEffect)(()=>{f(1)},[i]),!e)return null;let p=$e(a?.agents??[],i),m=a?.discovery&&!a.discovery.lastPollOk;if(i.trim()&&p.length===0)return null;let h=p.filter(e=>e.presentInLastOk!==!1),g=nt(h,e=>r.has(`${t}/${e.agentId}`)),_=rt(p,d,ot);async function v(n,r){try{r?await s({groupId:e,instanceName:t,agentId:n}):await o({groupId:e,instanceName:t,agentId:n})}catch(e){l.error(j(),e)}}async function y(){if(h.length===0)return;let n=h.map(e=>e.agentId);try{await c({groupId:e,instanceName:t,agentIds:n,assigned:g!==`all`})}catch(e){l.error(j(),e)}}return(0,$.jsxs)(`div`,{className:`oc-access__group`,children:[(0,$.jsxs)(`div`,{className:`oc-access__instance`,children:[(0,$.jsx)(q,{size:13,"aria-hidden":!0}),(0,$.jsx)(`span`,{children:t}),(0,$.jsx)(W,{variant:`outline`,className:`oc-access__kind`,children:n}),m?(0,$.jsx)(W,{variant:`outline`,className:`oc-access__stale`,children:pe()}):null]}),a===void 0?(0,$.jsx)(`p`,{className:`oc-access__hint`,children:Oe()}):p.length===0?(0,$.jsx)(`p`,{className:`oc-access__hint`,children:m?ce():R()}):(0,$.jsxs)($.Fragment,{children:[h.length>1?(0,$.jsxs)(`div`,{className:`oc-access__row oc-access__selectall`,children:[(0,$.jsx)(K,{checked:g===`all`?!0:g===`some`?`indeterminate`:!1,onCheckedChange:()=>void y(),"aria-label":z()}),(0,$.jsx)(`span`,{className:`oc-access__label`,children:z()})]}):null,_.pageItems.map(e=>{let n=`${t}/${e.agentId}`,i=r.has(n),a=e.presentInLastOk===!1;return(0,$.jsxs)(`div`,{className:`oc-access__row`,children:[(0,$.jsx)(K,{checked:i,disabled:a&&!i,onCheckedChange:()=>void v(e.agentId,i),"aria-label":De({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":L(),title:L(),children:(0,$.jsx)(Y,{size:14,fill:`currentColor`})}):null,a?(0,$.jsx)(W,{variant:`outline`,className:`oc-access__gone`,children:_e()}):null]},e.agentId)}),(0,$.jsx)(st,{page:_.page,pageCount:_.pageCount,onPage:f})]})]})}function ut({groupId:e}){let t=T(u.charts.listGroupChartSelection,e?{groupId:e}:`skip`),n=B(u.charts.assignChartToGroup),r=B(u.charts.removeChartFromGroup),a=B(u.charts.setGroupDefaultChart),o=B(u.charts.addChartToGroupPool),s=B(u.charts.removeChartFromGroupPool),c=G();if(!e)return null;if(t===void 0)return(0,$.jsx)(`p`,{className:`oc-access__hint`,children:F()});let{pool:l,addable:d,canManagePool:f}=t;if(l.length===0&&!f)return(0,$.jsx)(`p`,{className:`oc-access__hint`,children:we()});async function p(t,a){try{a?await r({groupId:e,chartKey:t}):await n({groupId:e,chartKey:t})}catch(e){c.error(i(),e)}}async function m(t){try{await a({groupId:e,chartKey:t})}catch(e){c.error(i(),e)}}async function h(t){try{await o({groupId:e,chartKey:t})}catch(e){c.error(i(),e)}}async function g(t){try{await s({groupId:e,chartKey:t})}catch(e){c.error(i(),e)}}return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`div`,{className:`oc-access__list`,children:l.map(e=>(0,$.jsxs)(`div`,{className:`oc-access__row`,children:[(0,$.jsx)(K,{checked:e.selected,onCheckedChange:()=>void p(e.chartKey,e.selected),"aria-label":ge({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":P(),title:P(),children:(0,$.jsx)(Y,{size:14,fill:`currentColor`})}):(0,$.jsx)(U,{type:`button`,variant:`ghost`,size:`sm`,onClick:()=>void m(e.chartKey),children:le()}):null,f?(0,$.jsx)(U,{type:`button`,variant:`ghost`,size:`sm`,"aria-label":xe({name:e.name}),title:xe({name:e.name}),onClick:()=>void g(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 h(e),children:[(0,$.jsx)(Ie,{size:`sm`,className:`oc-access__search`,children:(0,$.jsx)(Ne,{placeholder:ae()})}),(0,$.jsx)(Re,{children:d.map(e=>(0,$.jsx)(Ge,{value:e.chartKey,children:e.name},e.chartKey))})]}):l.length===0?(0,$.jsx)(`p`,{className:`oc-access__hint`,children:fe()}):null:null]})}export{at as GroupsTab};
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$c as r,$s as i,AA as a,Ac as o,Bc as s,Cc as c,D as l,Dc as u,E as d,Ec as f,Fc as p,Gc as m,Hc as h,Ic as g,Jc as _,Kc as v,Lc as y,Mc as b,Nc as x,Oc as S,Pc as C,Qc as ee,Qs as w,Rc as te,Sc as T,Tc as E,Uc as D,Vc as ne,Wc as O,Xc as k,Xs as A,Yc as re,Ys as j,Zc as M,Zs as N,_c as ie,ac as P,bc as F,cc as ae,dc as oe,ec as se,el as I,fc as L,gc as R,hc as ce,ic as le,il as ue,jA as z,jc as de,kc as B,lc as fe,mc as pe,nc as me,nl as he,oc as ge,pc as _e,qc as ve,rc as ye,rl as be,sc as xe,tc as Se,tl as Ce,uc as we,vc as Te,wc as Ee,xc as De,yc as Oe,zc as ke}from"./dist-DLKTmLXq.js";import{t as Ae}from"./x-ClVgrrpF.js";import{i as V,n as H,r as je,t as Me}from"./tabs-DjWpx9_s.js";import{t as U}from"./button-BgI9tkZX.js";import{$ as W,C as Ne,N as G,Nt as Pe,P as Fe,S as Ie,_ as K,at as Le,b as Re,bt as q,et as J,lt as ze,m as Be,nt as Ve,ot as He,rt as Ue,tt as We,x as Ge,y as Ke,yt as Y}from"./index-D6NQyqlV.js";import{t as qe}from"./FilterBar-CDYmDUw2.js";import{t as Je}from"./DataTableShell-nb7UG6xl.js";import{t as X}from"./DetailChips-B2YQy9Nb.js";var Ye=l(`chevron-left`,[[`path`,{d:`m15 18-6-6 6-6`,key:`1wnfg3`}]]),Xe=l(`palette`,[[`path`,{d:`M12 22a1 1 0 0 1 0-20 10 9 0 0 1 10 9 5 5 0 0 1-5 5h-2.25a1.75 1.75 0 0 0-1.4 2.8l.3.4a1.75 1.75 0 0 1-1.4 2.8z`,key:`e79jfc`}],[`circle`,{cx:`13.5`,cy:`6.5`,r:`.5`,fill:`currentColor`,key:`1okk4w`}],[`circle`,{cx:`17.5`,cy:`10.5`,r:`.5`,fill:`currentColor`,key:`f64h9f`}],[`circle`,{cx:`6.5`,cy:`12.5`,r:`.5`,fill:`currentColor`,key:`qy21gx`}],[`circle`,{cx:`8.5`,cy:`7.5`,r:`.5`,fill:`currentColor`,key:`fotxhn`}]]),Z=l(`shield-check`,[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`,key:`oel41y`}],[`path`,{d:`m9 12 2 2 4-4`,key:`dzmm74`}]]),Ze=l(`users`,[[`path`,{d:`M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2`,key:`1yyitq`}],[`path`,{d:`M16 3.128a4 4 0 0 1 0 7.744`,key:`16gr8j`}],[`path`,{d:`M22 21v-2a4 4 0 0 0-3-3.87`,key:`kshegd`}],[`circle`,{cx:`9`,cy:`7`,r:`4`,key:`nufk8`}]]),Q=t(e(),1);function Qe(e,t,n){let r=t.trim().toLowerCase();return[...r?e.filter(e=>[e.email,e.name,e.canonical].some(e=>e!=null&&e.toLowerCase().includes(r))):e.slice()].sort((e,t)=>!n.has(e.userId)-+!n.has(t.userId))}function $e(e,t){let n=e.filter(e=>e.source===`discovered`),r=t.trim().toLowerCase();return r?n.filter(e=>(e.displayName??e.agentId).toLowerCase().includes(r)||e.agentId.toLowerCase().includes(r)):n}function et(e){let t=e.name?.trim()??``,n=e.email?.trim()??``,r=e.canonical?.trim()||`u-${e.userId.slice(0,8)}`;return t?{primary:t,secondary:n||`@${r}`}:n?{primary:n,secondary:null}:{primary:`@${r}`,secondary:null}}function tt(e){switch(e){case`admin`:return E();case`user`:return Ee();case`pending`:return c();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=z(d.groups.listGroups,{}),t=z(d.me.getMe,{host:ze})?.role===`admin`,n=a(d.groups.createGroup),i=a(d.groups.updateGroup),o=a(d.groups.deleteGroup),c=Fe(),l=G(),[u,f]=(0,Q.useState)(!1),[p,g]=(0,Q.useState)(null),[b,x]=(0,Q.useState)(it),[S,C]=(0,Q.useState)(null),[T,E]=(0,Q.useState)(``),A=(0,Q.useMemo)(()=>{if(!e)return e;let t=T.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,T]);function j(){g(null),x(it),f(!0)}function ie(e){g(e),x({name:e.name,description:e.description??``}),f(!0)}async function P(){try{p?await i({groupId:p._id,name:b.name,description:b.description}):await n({name:b.name,description:b.description||void 0}),x(it),g(null),f(!1)}catch(e){l.error(w(),e)}}async function F(e){if(await c({title:ke({name:e.name}),description:te(),confirmWord:e.name,confirmLabel:y(),cancelLabel:m(),destructive:!0}))try{await o({groupId:e._id})}catch(e){l.error(N(),e)}}return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`p`,{className:`oc-admin__hint`,children:be()}),(0,$.jsx)(qe,{q:T,onQChange:E,onReset:()=>E(``),canReset:T!==``,searchPlaceholder:k()}),(0,$.jsx)(Je,{title:ue(),rows:A,addLabel:he(),onAdd:t?j:void 0,emptyHint:Ce(),columns:[{header:I(),cell:e=>e.name,sort:e=>e.name},{header:r(),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:ee(),cell:e=>(0,$.jsx)(X,{icon:(0,$.jsx)(q,{size:12,"aria-hidden":!0}),total:e.agentCount,items:e.agents.map(e=>({label:e}))}),sort:e=>e.agentCount},{header:M(),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:re(),onSelect:()=>C({groupId:e._id,name:e.name})},...t?[{label:_(),onSelect:()=>ie(e)},{label:ve(),variant:`destructive`,onSelect:()=>void F(e)}]:[]]}),(0,$.jsx)(Be,{open:u,onOpenChange:f,title:p?D():O(),description:h(),canSubmit:!!b.name.trim(),onSubmit:P,submitLabel:v(),children:(0,$.jsxs)(`div`,{className:`oc-form`,children:[(0,$.jsxs)(`label`,{className:`oc-field`,children:[(0,$.jsx)(`span`,{className:`oc-field__label`,children:ne()}),(0,$.jsx)(J,{value:b.name,onChange:e=>x({...b,name:e.target.value})})]}),(0,$.jsxs)(`label`,{className:`oc-field`,children:[(0,$.jsx)(`span`,{className:`oc-field__label`,children:s()}),(0,$.jsx)(J,{value:b.description,onChange:e=>x({...b,description:e.target.value})})]})]})}),(0,$.jsx)(ct,{groupId:S?.groupId??null,groupName:S?.name??``,open:S!==null,onOpenChange:e=>{e||C(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}),S()]}),(0,$.jsxs)(`span`,{className:`oc-access__pageinfo`,"aria-label":f({page:e,pages:t}),children:[e,` / `,t]}),(0,$.jsxs)(U,{type:`button`,variant:`ghost`,size:`sm`,disabled:e>=t,onClick:()=>n(e+1),children:[u(),(0,$.jsx)(Pe,{size:14,"aria-hidden":!0})]})]})}function ct({groupId:e,groupName:t,open:n,onOpenChange:r}){let i=z(d.groups.getGroup,n&&e?{groupId:e}:`skip`),s=z(d.groups.listAssignableInstances,n?{}:`skip`),c=z(d.groups.listAssignableUsers,n?{}:`skip`),l=a(d.groups.addMember),u=a(d.groups.removeMember),f=a(d.groups.bulkSetMembers),m=a(d.groups.setGroupManager),h=G(),[_,v]=(0,Q.useState)(``),[y,S]=(0,Q.useState)(``),[ee,w]=(0,Q.useState)(`members`),[te,E]=(0,Q.useState)(1),[D,ne]=(0,Q.useState)(new Set),O=(0,Q.useRef)(null),k=(0,Q.useMemo)(()=>new Set((i?.members??[]).map(e=>e.userId)),[i]),re=(0,Q.useMemo)(()=>new Set((i?.members??[]).filter(e=>e.manager).map(e=>e.userId)),[i]),j=i?.viewerIsAdmin===!0,M=(0,Q.useMemo)(()=>new Set((i?.agents??[]).map(e=>`${e.instanceName}/${e.agentId}`)),[i]);(0,Q.useEffect)(()=>{v(``),S(``),w(`members`),E(1),O.current=null},[n,e]),(0,Q.useEffect)(()=>{E(1)},[_]),(0,Q.useEffect)(()=>{n&&i&&e&&O.current!==e&&(O.current=e,ne(new Set((i.members??[]).map(e=>e.userId))))},[n,i,e]);let N=(0,Q.useMemo)(()=>c?Qe(c,_,D):[],[c,_,D]);async function P(t,n){if(e)try{n?await u({groupId:e,userId:t}):await l({groupId:e,userId:t})}catch(e){h.error(A(),e)}}async function ae(t,n){if(e)try{await m({groupId:e,userId:t,manager:!n})}catch(e){h.error(se(),e)}}let I=nt(N,e=>k.has(e.userId)),L=N.filter(e=>k.has(e.userId)).length,R=rt(N,te,ot);async function ce(){if(!e||N.length===0)return;let t=N.map(e=>e.userId);try{await f({groupId:e,userIds:t,member:I!==`all`})}catch(e){h.error(A(),e)}}return(0,$.jsx)(We,{open:n,onOpenChange:r,children:(0,$.jsxs)(Ve,{className:`oc-access`,children:[(0,$.jsxs)(Le,{children:[(0,$.jsx)(He,{children:g({name:t})}),(0,$.jsx)(Ue,{children:p()})]}),(0,$.jsxs)(Me,{value:ee,onValueChange:w,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}),C(),i?(0,$.jsx)(W,{variant:`secondary`,className:`oc-access__tabcount`,children:k.size}):null]}),(0,$.jsxs)(V,{value:`agents`,className:`flex-1 gap-1.5`,children:[(0,$.jsx)(q,{size:13,"aria-hidden":!0}),b(),i?(0,$.jsx)(W,{variant:`secondary`,className:`oc-access__tabcount`,children:M.size}):null]}),(0,$.jsxs)(V,{value:`charts`,className:`flex-1 gap-1.5`,children:[(0,$.jsx)(Xe,{size:13,"aria-hidden":!0}),oe(),i?(0,$.jsx)(W,{variant:`secondary`,className:`oc-access__tabcount`,children:i.chartCount}):null]})]}),(0,$.jsx)(H,{value:`members`,children:c===void 0||i===void 0?(0,$.jsx)(`p`,{className:`oc-access__hint`,children:F()}):c.length===0?(0,$.jsx)(`p`,{className:`oc-access__hint`,children:Te()}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(J,{value:_,onChange:e=>v(e.target.value),placeholder:x(),className:`oc-access__search`}),N.length===0?(0,$.jsx)(`p`,{className:`oc-access__hint`,children:o()}):(0,$.jsxs)($.Fragment,{children:[N.length>1?(0,$.jsxs)(`div`,{className:`oc-access__row oc-access__selectall`,children:[(0,$.jsx)(K,{checked:I===`all`?!0:I===`some`?`indeterminate`:!1,onCheckedChange:()=>void ce(),"aria-label":B()}),(0,$.jsx)(`span`,{className:`oc-access__label`,children:B()}),(0,$.jsxs)(W,{variant:`outline`,className:`oc-access__count`,children:[L,` / `,N.length]})]}):null,(0,$.jsx)(`div`,{className:`oc-access__list`,children:R.pageItems.map(e=>{let t=k.has(e.userId),n=et(e),r=re.has(e.userId);return(0,$.jsxs)(`div`,{className:`oc-access__row`,children:[(0,$.jsx)(K,{checked:t,onCheckedChange:()=>void P(e.userId,t),"aria-label":T({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)(W,{variant:`outline`,className:`oc-access__role`,children:tt(e.role)}),(0,$.jsx)(`span`,{className:`oc-access__mgrslot`,children:t&&j?(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?Se():me(),title:r?Se():me(),onClick:()=>void ae(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":ye(),title:ye(),children:(0,$.jsx)(Z,{size:15,"aria-hidden":!0})}):null})]},e._id)})}),(0,$.jsx)(st,{page:R.page,pageCount:R.pageCount,onPage:E})]})]})}),(0,$.jsx)(H,{value:`agents`,children:s===void 0?(0,$.jsx)(`p`,{className:`oc-access__hint`,children:F()}):s.length===0?(0,$.jsx)(`p`,{className:`oc-access__hint`,children:ie()}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(J,{value:y,onChange:e=>S(e.target.value),placeholder:de(),className:`oc-access__search`}),(0,$.jsx)(`div`,{className:`oc-access__list`,children:s.map(t=>(0,$.jsx)(lt,{groupId:e,instanceName:t.name,kind:t.kind??`openclaw`,assigned:M,query:y},`${e}-${t._id}`))})]})}),(0,$.jsx)(H,{value:`charts`,children:(0,$.jsx)(ut,{groupId:e})})]})]})})}function lt({groupId:e,instanceName:t,kind:n,assigned:r,query:i}){let o=z(d.groups.listAssignableAgents,{instanceName:t}),s=a(d.groups.assignAgentToGroup),c=a(d.groups.removeAgentFromGroup),l=a(d.groups.bulkSetGroupAgents),u=G(),[f,p]=(0,Q.useState)(1);if((0,Q.useEffect)(()=>{p(1)},[i]),!e)return null;let m=$e(o?.agents??[],i),h=o?.discovery&&!o.discovery.lastPollOk;if(i.trim()&&m.length===0)return null;let g=m.filter(e=>e.presentInLastOk!==!1),_=nt(g,e=>r.has(`${t}/${e.agentId}`)),v=rt(m,f,ot);async function y(n,r){try{r?await c({groupId:e,instanceName:t,agentId:n}):await s({groupId:e,instanceName:t,agentId:n})}catch(e){u.error(j(),e)}}async function b(){if(g.length===0)return;let n=g.map(e=>e.agentId);try{await l({groupId:e,instanceName:t,agentIds:n,assigned:_!==`all`})}catch(e){u.error(j(),e)}}return(0,$.jsxs)(`div`,{className:`oc-access__group`,children:[(0,$.jsxs)(`div`,{className:`oc-access__instance`,children:[(0,$.jsx)(q,{size:13,"aria-hidden":!0}),(0,$.jsx)(`span`,{children:t}),(0,$.jsx)(W,{variant:`outline`,className:`oc-access__kind`,children:n}),h?(0,$.jsx)(W,{variant:`outline`,className:`oc-access__stale`,children:pe()}):null]}),o===void 0?(0,$.jsx)(`p`,{className:`oc-access__hint`,children:Oe()}):m.length===0?(0,$.jsx)(`p`,{className:`oc-access__hint`,children:h?ce():R()}):(0,$.jsxs)($.Fragment,{children:[g.length>1?(0,$.jsxs)(`div`,{className:`oc-access__row oc-access__selectall`,children:[(0,$.jsx)(K,{checked:_===`all`?!0:_===`some`?`indeterminate`:!1,onCheckedChange:()=>void b(),"aria-label":B()}),(0,$.jsx)(`span`,{className:`oc-access__label`,children:B()})]}):null,v.pageItems.map(e=>{let n=`${t}/${e.agentId}`,i=r.has(n),a=e.presentInLastOk===!1;return(0,$.jsxs)(`div`,{className:`oc-access__row`,children:[(0,$.jsx)(K,{checked:i,disabled:a&&!i,onCheckedChange:()=>void y(e.agentId,i),"aria-label":De({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":L(),title:L(),children:(0,$.jsx)(Y,{size:14,fill:`currentColor`})}):null,a?(0,$.jsx)(W,{variant:`outline`,className:`oc-access__gone`,children:_e()}):null]},e.agentId)}),(0,$.jsx)(st,{page:v.page,pageCount:v.pageCount,onPage:p})]})]})}function ut({groupId:e}){let t=z(d.charts.listGroupChartSelection,e?{groupId:e}:`skip`),n=a(d.charts.assignChartToGroup),r=a(d.charts.removeChartFromGroup),o=a(d.charts.setGroupDefaultChart),s=a(d.charts.addChartToGroupPool),c=a(d.charts.removeChartFromGroupPool),l=G();if(!e)return null;if(t===void 0)return(0,$.jsx)(`p`,{className:`oc-access__hint`,children:F()});let{pool:u,addable:f,canManagePool:p}=t;if(u.length===0&&!p)return(0,$.jsx)(`p`,{className:`oc-access__hint`,children:we()});async function m(t,a){try{a?await r({groupId:e,chartKey:t}):await n({groupId:e,chartKey:t})}catch(e){l.error(i(),e)}}async function h(t){try{await o({groupId:e,chartKey:t})}catch(e){l.error(i(),e)}}async function g(t){try{await s({groupId:e,chartKey:t})}catch(e){l.error(i(),e)}}async function _(t){try{await c({groupId:e,chartKey:t})}catch(e){l.error(i(),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)(K,{checked:e.selected,onCheckedChange:()=>void m(e.chartKey,e.selected),"aria-label":ge({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":P(),title:P(),children:(0,$.jsx)(Y,{size:14,fill:`currentColor`})}):(0,$.jsx)(U,{type:`button`,variant:`ghost`,size:`sm`,onClick:()=>void h(e.chartKey),children:le()}):null,p?(0,$.jsx)(U,{type:`button`,variant:`ghost`,size:`sm`,"aria-label":xe({name:e.name}),title:xe({name:e.name}),onClick:()=>void _(e.chartKey),children:(0,$.jsx)(Ae,{size:14,"aria-hidden":!0})}):null]},e.chartKey))}),p?f.length>0?(0,$.jsxs)(Ke,{value:``,onValueChange:e=>void g(e),children:[(0,$.jsx)(Ie,{size:`sm`,className:`oc-access__search`,children:(0,$.jsx)(Ne,{placeholder:ae()})}),(0,$.jsx)(Re,{children:f.map(e=>(0,$.jsx)(Ge,{value:e.chartKey,children:e.name},e.chartKey))})]}):u.length===0?(0,$.jsx)(`p`,{className:`oc-access__hint`,children:fe()}):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{$v as r,$y as i,AA as a,Ay as o,Bv as s,By as c,Cy as l,Dm as u,Dy as d,E as f,Ey as p,Fv as m,Fy as h,Gv as g,Gy as _,Hv as v,Hy as y,Iv as b,Iy as x,Jv as S,Jy as C,Kv as w,Ky as T,Lv as E,Ly as ee,Mv as D,My as te,Nv as O,Ny as ne,OA as k,Om as A,Oy as re,Pv as ie,Py as j,Qv as ae,Qy as oe,Rv as se,Ry as ce,Sy as le,Ty as ue,Uv as de,Uy as fe,Vv as pe,Vy as me,Wv as he,Wy as ge,Xv as _e,Xy as ve,Yv as ye,Yy as be,Zv as xe,Zy as Se,_b as Ce,_y as we,aE as M,ab as Te,ay as Ee,by as De,cb as Oe,cr as ke,cy as Ae,db as je,dy as Me,eb as Ne,ey as Pe,fb as Fe,fy as Ie,gb as Le,gy as Re,hb as ze,hy as Be,iE as N,ib as P,iy as F,jA as I,jy as Ve,ky as He,lb as Ue,lr as We,ly as Ge,mb as Ke,my as qe,nb as Je,ny as L,ob as Ye,or as Xe,oy as Ze,pb as Qe,py as $e,qv as et,qy as tt,rb as nt,ry as rt,sb as it,sr as at,sy as ot,tb as st,ty as ct,ub as lt,uy as ut,vb as dt,vy as ft,wy as R,xy as pt,yy as mt,zv as ht,zy as gt}from"./dist-DLKTmLXq.js";import{a as _t,c as vt}from"./FieldLabel-DrAMRvzk.js";import{t as z}from"./button-BgI9tkZX.js";import{$ as B,C as V,G as yt,K as bt,N as H,P as xt,S as U,W as St,_ as W,at as G,b as K,et as q,m as Ct,nt as wt,ot as Tt,rt as Et,tt as Dt,x as J,y as Ot}from"./index-D6NQyqlV.js";import{t as kt}from"./DataTableShell-nb7UG6xl.js";import{InstanceConfigDialog as At}from"./BridgeTab-BAGIOGBx.js";var Y=t(e(),1),X=[`conversational`,`documentary`,`summarizer`,`curator`],jt=new Set(X),Mt=`conversational`;function Nt(e){let t=new Set((e??[]).filter(e=>jt.has(e)));return t.size===0?[Mt]:X.filter(e=>t.has(e))}var Z=n(),Q={name:``,gatewayUrl:``,bridgeUrl:``,displayName:``,kind:`openclaw`,gatewayVersion:``,gatewayHttpUrl:``,streamTransport:_t},Pt={openclaw:[`token`,`deviceIdentity`],hermes:[`apiKey`]};function Ft(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 It(){let e=I(f.admin.listInstances,{}),t=I(f.agents.listAllInstanceAgents,{}),n=a(f.admin.upsertInstance),r=a(f.admin.deleteInstance),o=H(),[s,c]=(0,Y.useState)(!1),[l,d]=(0,Y.useState)(Q),[p,m]=(0,Y.useState)(null),[h,g]=(0,Y.useState)(null),[v,b]=(0,Y.useState)(null),[x,S]=(0,Y.useState)(null);async function w(){try{await n({instanceId:x??void 0,name:l.name,gatewayUrl:l.gatewayUrl,bridgeUrl:l.bridgeUrl||void 0,displayName:l.displayName||void 0,kind:l.kind,gatewayVersion:l.gatewayVersion||void 0,gatewayHttpUrl:l.gatewayHttpUrl||void 0,streamTransport:l.streamTransport}),d(Q),S(null),c(!1)}catch(e){o.error(Le(),e)}}return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`p`,{className:`oc-admin__hint`,children:[ze(),(0,Z.jsx)(`strong`,{children:Ke()}),Qe()]}),(0,Z.jsx)(kt,{title:Fe(),rows:e,addLabel:je(),onAdd:()=>{S(null),d(Q),c(!0)},emptyHint:lt(),columns:[{header:Ue(),cell:e=>e.name,sort:e=>e.name},{header:Oe(),cell:e=>(0,Z.jsx)(B,{variant:`outline`,children:e.kind??`openclaw`}),sort:e=>e.kind??`openclaw`},{header:it(),cell:e=>e.gatewayUrl,sort:e=>e.gatewayUrl},{header:Ye(),cell:e=>e.displayName??`—`,sort:e=>e.displayName??null},{header:dt(),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)(B,{variant:r(e.agentId)?`default`:`outline`,title:r(e.agentId)?O():void 0,children:[e.emoji?`${e.emoji} `:``,e.displayName??e.agentId]},e.agentId))})}}],rowActions:e=>[{label:Je(),onSelect:()=>{S(e._id),d(Ft(e)),c(!0)}},{label:Ce(),onSelect:()=>m(e.name)},{label:me(),onSelect:()=>b(e)},{label:Te(),onSelect:()=>g(e)},{label:P(),variant:`destructive`,onSelect:()=>void r({instanceId:e._id})}],bulkActions:[{label:P(),variant:`destructive`,onSelect:e=>e.forEach(e=>void r({instanceId:e}))}]}),(0,Z.jsx)(Ct,{open:s,onOpenChange:c,title:x?st():nt(),description:i(),canSubmit:!!(l.name&&l.gatewayUrl),onSubmit:w,submitLabel:oe(),children:(0,Z.jsxs)(`div`,{className:`oc-form`,children:[(0,Z.jsxs)($,{label:Se(),children:[(0,Z.jsx)(q,{value:l.name,disabled:x!==null,onChange:e=>d({...l,name:e.target.value})}),x?(0,Z.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:Ne()}):null]}),(0,Z.jsx)($,{label:ve(),children:(0,Z.jsxs)(Ot,{value:l.kind,onValueChange:e=>d({...l,kind:e}),children:[(0,Z.jsx)(U,{size:`sm`,className:`w-40`,children:(0,Z.jsx)(V,{})}),(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:be(),children:(0,Z.jsx)(q,{value:l.gatewayUrl,onChange:e=>d({...l,gatewayUrl:e.target.value})})}),(0,Z.jsx)($,{label:C(),children:(0,Z.jsx)(q,{value:l.bridgeUrl,placeholder:tt(),onChange:e=>d({...l,bridgeUrl:e.target.value})})}),(0,Z.jsx)($,{label:T(),children:(0,Z.jsx)(q,{value:l.displayName,onChange:e=>d({...l,displayName:e.target.value})})}),(0,Z.jsxs)($,{label:A(),children:[(0,Z.jsxs)(Ot,{value:l.streamTransport,onValueChange:e=>d({...l,streamTransport:e}),children:[(0,Z.jsx)(U,{size:`sm`,className:`w-40`,children:(0,Z.jsx)(V,{})}),(0,Z.jsx)(K,{children:vt.map(e=>(0,Z.jsx)(J,{value:e,children:e},e))})]}),(0,Z.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:u()})]}),(0,Z.jsx)($,{label:_(),children:(0,Z.jsx)(q,{value:l.gatewayVersion,placeholder:ge(),onChange:e=>d({...l,gatewayVersion:e.target.value})})}),(0,Z.jsx)($,{label:fe(),children:(0,Z.jsx)(q,{value:l.gatewayHttpUrl,placeholder:y(),onChange:e=>d({...l,gatewayHttpUrl:e.target.value})})})]})}),(0,Z.jsx)(Kt,{instanceName:p,open:p!==null,onOpenChange:e=>{e||m(null)}}),h?(0,Z.jsx)(At,{instance:h,onClose:()=>g(null)},h._id):null,v?(0,Z.jsx)(Lt,{instance:v,onClose:()=>b(null)},v._id):null]})}function Lt({instance:e,onClose:t}){let n=I(f.instanceSecrets.listInstanceSecretStatus,{}),r=Pt[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)(Dt,{open:!0,onOpenChange:e=>!e&&t(),children:(0,Z.jsxs)(wt,{onOpenAutoFocus:e=>e.preventDefault(),children:[(0,Z.jsxs)(G,{children:[(0,Z.jsx)(Tt,{children:c({instance:e.displayName??e.name})}),(0,Z.jsx)(Et,{children:gt()})]}),(0,Z.jsx)(`div`,{className:`oc-form`,children:r.map(t=>(0,Z.jsx)(Bt,{instanceId:e._id,field:t,updatedAt:i[t]??null},t))}),(0,Z.jsx)(`div`,{className:`oc-bridgesecret`,children:(0,Z.jsx)(zt,{instance:e})}),(0,Z.jsx)(Rt,{instance:e})]})})}function Rt({instance:e}){let t=k(f.instanceSync.forceInstanceSync),n=H(),[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(mt());break;case`no_agents`:n.success(we());break;case`no_bridge_url`:n.error(Re());break;case`deploy_misconfigured`:n.error(Be());break;case`unauthorized`:n.error($e());break;case`not_served`:n.error(Ie());break;default:n.error(qe());break}}catch(e){n.error(ft(),e)}finally{i(!1)}}}return(0,Z.jsxs)(`div`,{className:`oc-form`,children:[(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:Me()}),(0,Z.jsx)(`div`,{className:`flex items-center gap-2`,children:(0,Z.jsx)(z,{size:`sm`,variant:`outline`,onClick:()=>void a(),disabled:r,children:r?De():pt()})})]})}function zt({instance:e}){let t=I(f.bridgeAuth.listBridgeAuthStatus,{}),n=k(f.bridgeAuth.mintBridgeSecret),r=a(f.bridgeAuth.revokeBridgeSecret),i=H(),[o,s]=(0,Y.useState)(!1),[c,l]=(0,Y.useState)(null),[u,d]=(0,Y.useState)(!1),p=(t??[]).find(t=>t.instanceId===e._id),m=p!==void 0;async function g(){if(!o){s(!0);try{l((await n({instanceId:e._id})).plaintext),d(!1)}catch(e){i.error(F(),e)}finally{s(!1)}}}async function _(){if(!o){s(!0);try{await r({instanceId:e._id}),l(null),i.success(Ee())}catch(e){i.error(F(),e)}finally{s(!1)}}}async function v(){if(c)try{await navigator.clipboard.writeText(c),d(!0)}catch{}}return(0,Z.jsxs)($,{label:ut(),children:[(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:Ge()}),(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Z.jsx)(B,{variant:m?`outline`:`secondary`,children:m?`${h()} · ${p.prefix}…${p.lastFour}`:j()}),(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(z,{size:`sm`,onClick:()=>void g(),disabled:o,children:m?ot():Ae()}),m?(0,Z.jsx)(z,{size:`sm`,variant:`destructive`,onClick:()=>void _(),disabled:o,children:Ze()}):null]})]}),c?(0,Z.jsxs)(`div`,{className:`oc-bridgesecret__reveal`,children:[(0,Z.jsx)(`p`,{className:`oc-sa__minted-warning`,children:rt()}),(0,Z.jsxs)(`div`,{className:`oc-sa__minted-box`,children:[(0,Z.jsx)(`code`,{className:`oc-sa__minted-plain`,children:c}),(0,Z.jsx)(z,{variant:`outline`,size:`sm`,onClick:()=>void v(),children:u?M():N()})]}),(0,Z.jsx)(z,{size:`sm`,variant:`ghost`,onClick:()=>{l(null),d(!1)},children:L()})]}):null]})}function Bt({instanceId:e,field:t,updatedAt:n}){let r=k(f.instanceSecrets.setInstanceSecret),i=a(f.instanceSecrets.clearInstanceSecret),s=k(f.deviceIdentity.generateDeviceIdentity),c=H(),[u,m]=(0,Y.useState)(``),[g,_]=(0,Y.useState)(!1),[v,y]=(0,Y.useState)(null),[b,S]=(0,Y.useState)(!1),C=n!==null,w=t===`deviceIdentity`,T=t===`token`?ce():t===`deviceIdentity`?ee():x();async function E(){if(!(!u.trim()||g)){_(!0);try{await r({instanceId:e,field:t,plaintext:u}),m(``),y(null),S(!1),c.success(He())}catch(e){c.error(re(),e)}finally{_(!1)}}}async function D(){if(!g){_(!0);try{await i({instanceId:e,field:t}),y(null),S(!1),c.success(d())}catch(e){c.error(re(),e)}finally{_(!1)}}}async function O(){if(!g){_(!0);try{y(await s({instanceId:e})),S(!1),c.success(R())}catch(e){c.error(le(),e)}finally{_(!1)}}}let A=v?`openclaw devices approve ${v.id}`:``;async function ie(){if(A)try{await navigator.clipboard.writeText(A),S(!0)}catch{}}return(0,Z.jsxs)($,{label:T,children:[w?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:ue()}):null,(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Z.jsx)(B,{variant:C?`outline`:`secondary`,children:C?h():j()}),(0,Z.jsx)(q,{type:`password`,autoComplete:`off`,className:`flex-1 min-w-32`,value:u,placeholder:C?te():ne(),onChange:e=>m(e.target.value)}),(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(z,{size:`sm`,onClick:()=>void E(),disabled:g||u.trim().length===0,children:Ve()}),w?(0,Z.jsx)(z,{size:`sm`,variant:`outline`,onClick:()=>void O(),disabled:g,children:p()}):null,C?(0,Z.jsx)(z,{size:`sm`,variant:`destructive`,onClick:()=>void D(),disabled:g,children:o()}):null]})]}),v?(0,Z.jsxs)(`div`,{className:`oc-bridgesecret__reveal`,children:[(0,Z.jsx)(`p`,{className:`text-sm font-medium`,children:R()}),(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:l()}),(0,Z.jsxs)(`div`,{className:`oc-sa__minted-box`,children:[(0,Z.jsx)(`code`,{className:`oc-sa__minted-plain`,children:A}),(0,Z.jsx)(z,{variant:`outline`,size:`sm`,onClick:()=>void ie(),children:b?M():N()})]}),(0,Z.jsx)(z,{size:`sm`,variant:`ghost`,onClick:()=>{y(null),S(!1)},children:L()})]}):null]})}var Vt={conversational:S,documentary:w,summarizer:We,curator:at},Ht={conversational:et,documentary:g,summarizer:ke,curator:Xe},Ut=e=>(Vt[e]??(()=>e))(),Wt=e=>(Ht[e]??(()=>``))();function Gt({agentId:e,types:t,onToggle:n}){return(0,Z.jsxs)(`div`,{className:`oc-agentcard__types`,children:[(0,Z.jsx)(`span`,{className:`oc-agentcard__types-label`,children:ae()}),t.map(e=>(0,Z.jsx)(B,{variant:`secondary`,className:`oc-agenttype__chip`,title:Wt(e),children:Ut(e)},e)),(0,Z.jsxs)(St,{children:[(0,Z.jsx)(bt,{asChild:!0,children:(0,Z.jsx)(z,{type:`button`,variant:`outline`,size:`sm`,className:`h-7`,children:xe()})}),(0,Z.jsxs)(yt,{align:`start`,className:`oc-agenttypes-pop`,children:[(0,Z.jsx)(`p`,{className:`oc-agenttypes-pop__title`,children:_e()}),(0,Z.jsx)(`p`,{className:`oc-agenttypes-pop__hint`,children:ye()}),(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)(W,{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:Ut(r)}),(0,Z.jsx)(`span`,{className:`oc-agenttypes-pop__desc`,children:Wt(r)})]})]},r)})})]})]})]})}function Kt({instanceName:e,open:t,onOpenChange:n}){let i=I(f.agents.listAgentsForInstance,t&&e?{instanceName:e}:`skip`),o=a(f.agents.setAgentEnabled).withOptimisticUpdate((e,{instanceName:t,agentId:n,enabled:r})=>{let i=e.getQuery(f.agents.listAgentsForInstance,{instanceName:t});i&&e.setQuery(f.agents.listAgentsForInstance,{instanceName:t},{...i,agents:i.agents.map(e=>e.agentId===n?{...e,enabled:r}:e)})}),c=a(f.agents.setInstanceDefaultAgent).withOptimisticUpdate((e,{instanceName:t,agentId:n})=>{let r=e.getQuery(f.agents.listAgentsForInstance,{instanceName:t});r&&e.setQuery(f.agents.listAgentsForInstance,{instanceName:t},{...r,defaultAgentId:n})}),l=a(f.agents.setAgentTypes).withOptimisticUpdate((e,{instanceName:t,agentId:n,types:r})=>{let i=e.getQuery(f.agents.listAgentsForInstance,{instanceName:t});if(!i)return;let a=Nt(r);e.setQuery(f.agents.listAgentsForInstance,{instanceName:t},{...i,agents:i.agents.map(e=>e.agentId===n?{...e,types:a}:e)})}),u=a(f.agents.removeInstanceAgent),d=xt(),p=H();async function h(t,n){if(e)try{await o({instanceName:e,agentId:t,enabled:n})}catch(e){p.error(r(),e)}}async function g(t){if(e)try{await c({instanceName:e,agentId:t})}catch(e){p.error(r(),e)}}async function _(t,n,i){if(!e)return;let a=i.includes(n)?i.filter(e=>e!==n):[...i,n];try{await l({instanceName:e,agentId:t,types:a})}catch(e){p.error(r(),e)}}async function y(t,n){if(e&&await d({title:v({name:n}),description:pe(),confirmLabel:s(),destructive:!0}))try{await u({instanceName:e,agentId:t}),p.success(ht())}catch(e){p.error(r(),e)}}return(0,Z.jsx)(Dt,{open:t,onOpenChange:n,children:(0,Z.jsxs)(wt,{className:`oc-access`,children:[(0,Z.jsxs)(G,{children:[(0,Z.jsx)(Tt,{children:ct({name:e??``})}),(0,Z.jsx)(Et,{children:Pe()})]}),i===void 0?(0,Z.jsx)(`p`,{className:`oc-access__hint`,children:se()}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`div`,{className:`oc-access__poll`,children:i.discovery===null?E():i.discovery.lastPollOk?b():m({error:i.discovery.error??`?`})}),i.agents.length===0?(0,Z.jsx)(`p`,{className:`oc-access__hint`,children:ie()}):(0,Z.jsx)(`div`,{className:`oc-access__list`,children:i.agents.map(e=>{let t=e.presentInLastOk===!1,n=i.defaultAgentId===e.agentId,r=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)(W,{checked:e.enabled,disabled:t,"aria-label":r,onCheckedChange:t=>void h(e.agentId,t===!0)}),(0,Z.jsxs)(`span`,{className:`oc-agentcard__name`,title:r,children:[e.emoji?`${e.emoji} `:``,r]}),e.model?(0,Z.jsx)(`span`,{className:`oc-access__model`,children:e.model}):null,t?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(B,{variant:`outline`,className:`oc-access__gone`,children:D()}),(0,Z.jsx)(z,{size:`sm`,variant:`ghost`,className:`h-7 text-destructive`,onClick:()=>void y(e.agentId,r),children:de()})]}):n?(0,Z.jsx)(B,{variant:`default`,children:O()}):(0,Z.jsx)(z,{size:`sm`,variant:`outline`,className:`h-7`,disabled:!e.enabled,onClick:()=>void g(e.agentId),children:he()})]}),e.enabled?(0,Z.jsx)(Gt,{agentId:e.agentId,types:a,onToggle:t=>void _(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{It as InstancesTab};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$x as r,AA as i,AS as a,Ai as o,BS as s,CS as c,Ci as l,DS as u,Di as d,E as f,ES as p,Ei as m,FS as h,IS as g,Jx as ee,LS as _,MS as te,NS as v,OA as y,OS as ne,Oi as b,PS as x,Qx as re,RS as ie,SS as ae,Si as oe,TS as se,Ti as ce,Xx as le,Yx as S,Zx as C,_S as w,aS as T,bS as E,cS as D,dS as O,eS as k,fS as A,gS as j,hS as M,iS as N,jA as P,jS as F,kS as I,ki as L,lS as R,mS as z,nS as B,oS as V,pS as H,rS as U,sS as W,tS as ue,uS as de,vS as fe,wS as pe,wi as me,xS as he,yS as ge,zS as _e}from"./dist-DLKTmLXq.js";import{t as G}from"./button-BgI9tkZX.js";import{$ as K,C as ve,S as ye,_ as be,b as xe,et as q,k as Se,x as Ce,y as we}from"./index-D6NQyqlV.js";import{t as Te}from"./DataTableShell-nb7UG6xl.js";var J=t(e(),1),Y=n();function Ee(){let e=P(f.integrations.status.status,{}),t=i(f.admin.setIntegrationConfig),[n,l]=(0,J.useState)(null);if((0,J.useEffect)(()=>{e&&n===null&&l(e.config)},[e,n]),!e||!n)return(0,Y.jsx)(`p`,{className:`oc-admin__hint`,children:s()});let d=n,m=(e,t,n)=>l({...d,[e]:{...d[e],[t]:n}}),y=(e,n)=>void t({[e]:n});return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(`p`,{className:`oc-admin__hint`,children:[_e(),` `,(0,Y.jsx)(`strong`,{children:ie()}),` `,_()]}),(0,Y.jsxs)(X,{title:`Langfuse`,status:e.langfuse.configured?e.langfuse.enabled?(0,Y.jsx)(K,{variant:`secondary`,children:g()}):(0,Y.jsx)(K,{variant:`outline`,children:h()}):(0,Y.jsx)(K,{variant:`outline`,children:x()}),note:te(),children:[(0,Y.jsx)(Z,{label:a(),children:(0,Y.jsx)(q,{value:d.langfuse.host??``,placeholder:e.langfuse.effectiveHost,onChange:e=>m(`langfuse`,`host`,e.target.value),onBlur:()=>y(`langfuse`,{host:d.langfuse.host??``})})}),(0,Y.jsx)(Q,{label:p(),checked:d.langfuse.enabled??!0,onChange:e=>{m(`langfuse`,`enabled`,e),y(`langfuse`,{enabled:e})}})]}),(0,Y.jsxs)(X,{title:`Opik`,status:e.opik.configured?e.opik.enabled?(0,Y.jsx)(K,{variant:`secondary`,children:g()}):(0,Y.jsx)(K,{variant:`outline`,children:h()}):(0,Y.jsx)(K,{variant:`outline`,children:x()}),note:F(),children:[(0,Y.jsx)(Z,{label:I(),children:(0,Y.jsx)(q,{value:d.opik.baseUrl??``,placeholder:e.opik.effectiveBaseUrl,onChange:e=>m(`opik`,`baseUrl`,e.target.value),onBlur:()=>y(`opik`,{baseUrl:d.opik.baseUrl??``})})}),(0,Y.jsx)(Z,{label:ne(),children:(0,Y.jsx)(q,{value:d.opik.workspace??``,placeholder:e.opik.effectiveWorkspace||u(),onChange:e=>m(`opik`,`workspace`,e.target.value),onBlur:()=>y(`opik`,{workspace:d.opik.workspace??``})})}),(0,Y.jsx)(Q,{label:p(),checked:d.opik.enabled??!0,onChange:e=>{m(`opik`,`enabled`,e),y(`opik`,{enabled:e})}})]}),(0,Y.jsxs)(X,{title:`OpenTelemetry (OTLP)`,status:e.otlp.configured?e.otlp.enabled?(0,Y.jsx)(K,{variant:`secondary`,children:g()}):(0,Y.jsx)(K,{variant:`outline`,children:h()}):(0,Y.jsx)(K,{variant:`outline`,children:o()}),note:L(),children:[(0,Y.jsx)(Z,{label:b(),children:(0,Y.jsx)(q,{value:d.otlp.endpoint??``,placeholder:e.otlp.effectiveEndpoint||`https://otlp.example.com/v1/traces`,onChange:e=>m(`otlp`,`endpoint`,e.target.value),onBlur:()=>y(`otlp`,{endpoint:d.otlp.endpoint??``})})}),(0,Y.jsx)(De,{headersSet:e.otlp.headersSet}),(0,Y.jsx)(Q,{label:p(),checked:d.otlp.enabled??!0,onChange:e=>{m(`otlp`,`enabled`,e),y(`otlp`,{enabled:e})}})]}),(0,Y.jsxs)(X,{title:se(),status:(0,Y.jsx)(K,{variant:`outline`,children:v()}),note:pe(),children:[(0,Y.jsx)(Z,{label:c(),children:(0,Y.jsx)($,{value:d.tts.auto??`off`,options:[[`off`,ae()],[`always`,he()],[`inbound`,E()],[`tagged`,ge()]],onChange:e=>{m(`tts`,`auto`,e),y(`tts`,{auto:e})}})}),(0,Y.jsx)(Z,{label:fe(),children:(0,Y.jsx)($,{value:d.tts.provider??`openai`,options:[[`openai`,`OpenAI`],[`elevenlabs`,`ElevenLabs`],[`microsoft`,w()],[`azure`,`Azure Speech`],[`google`,`Google Gemini`]],onChange:e=>{m(`tts`,`provider`,e),y(`tts`,{provider:e})}})}),(0,Y.jsx)(Z,{label:j(),children:(0,Y.jsx)(q,{value:d.tts.model??``,placeholder:`eleven_multilingual_v2`,onChange:e=>m(`tts`,`model`,e.target.value),onBlur:()=>y(`tts`,{model:d.tts.model??``})})}),(0,Y.jsx)(Z,{label:M(),children:(0,Y.jsx)(q,{value:d.tts.voice??``,placeholder:z(),onChange:e=>m(`tts`,`voice`,e.target.value),onBlur:()=>y(`tts`,{voice:d.tts.voice??``})})})]}),(0,Y.jsxs)(X,{title:H(),status:(0,Y.jsx)(K,{variant:`outline`,children:v()}),note:e.secrets.openai?A():O(),children:[(0,Y.jsx)(Q,{label:de(),checked:d.talk.enabled??!1,onChange:e=>{m(`talk`,`enabled`,e),y(`talk`,{enabled:e})}}),(0,Y.jsx)(Z,{label:R(),children:(0,Y.jsx)($,{value:d.talk.realtimeProvider??`openai`,options:[[`openai`,`OpenAI (gpt-realtime)`],[`google`,`Google`]],onChange:e=>{m(`talk`,`realtimeProvider`,e),y(`talk`,{realtimeProvider:e})}})}),(0,Y.jsx)(Z,{label:D(),children:(0,Y.jsx)(q,{value:d.talk.realtimeModel??``,placeholder:`gpt-realtime-2`,onChange:e=>m(`talk`,`realtimeModel`,e.target.value),onBlur:()=>y(`talk`,{realtimeModel:d.talk.realtimeModel??``})})}),(0,Y.jsx)(Z,{label:M(),children:(0,Y.jsx)(q,{value:d.talk.voice??``,placeholder:`cedar / marin`,onChange:e=>m(`talk`,`voice`,e.target.value),onBlur:()=>y(`talk`,{voice:d.talk.voice??``})})}),(0,Y.jsx)(Z,{label:W(),children:(0,Y.jsx)($,{value:d.talk.transport??`webrtc`,options:[[`webrtc`,V()],[`provider-websocket`,`Provider WebSocket`],[`gateway-relay`,`Gateway relay`]],onChange:e=>{m(`talk`,`transport`,e),y(`talk`,{transport:e})}})}),(0,Y.jsx)(Z,{label:T(),children:(0,Y.jsx)(q,{value:d.talk.speechLocale??``,placeholder:`fr-CA`,onChange:e=>m(`talk`,`speechLocale`,e.target.value),onBlur:()=>y(`talk`,{speechLocale:d.talk.speechLocale??``})})}),(0,Y.jsx)(Q,{label:N(),checked:d.talk.interruptOnSpeech??!0,onChange:e=>{m(`talk`,`interruptOnSpeech`,e),y(`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:U()}),(0,Y.jsx)(K,{variant:`outline`,children:B()})]}),(0,Y.jsxs)(`p`,{className:`oc-uipa__note`,children:[ue(),(0,Y.jsx)(`code`,{children:` voicewake.get/set`}),`.`]})]}),(0,Y.jsx)(Te,{title:k(),rows:e.cursors.map(e=>({...e,_id:e.vendor})),emptyHint:r(),columns:[{header:re(),cell:e=>(0,Y.jsx)(K,{variant:`secondary`,children:e.vendor}),sort:e=>e.vendor},{header:C(),cell:e=>e.lastAt>0?Se(e.lastAt):`—`,sort:e=>e.lastAt>0?e.lastAt:null},{header:le(),cell:e=>String(e.failureCount),sort:e=>e.failureCount},{header:S(),cell:e=>e.lastErrorStatus??`—`,sort:e=>e.lastErrorStatus??null},{header:ee(),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)(we,{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)(Ce,{value:e,children:t},e))})]})}function De({headersSet:e}){let t=y(f.integrations.otlpSecret.setOtlpHeaders),n=i(f.integrations.otlpSecret.clearOtlpHeaders),[r,a]=(0,J.useState)(``),[o,s]=(0,J.useState)(null),[c,u]=(0,J.useState)(!1),p=async()=>{u(!0),s(null);try{await t({headersJson:r}),a(``)}catch(e){s(e instanceof Error?e.message:String(e))}finally{u(!1)}};return(0,Y.jsxs)(Z,{label:d(),children:[(0,Y.jsx)(q,{value:r,placeholder:e?m():ce(),onChange:e=>a(e.target.value)}),(0,Y.jsxs)(`div`,{className:`oc-int__otlp-headers-actions`,children:[(0,Y.jsx)(G,{size:`sm`,disabled:c||r.trim().length===0,onClick:()=>void p(),children:me()}),e?(0,Y.jsx)(G,{variant:`ghost`,size:`sm`,disabled:c,onClick:()=>void n({}),children:l()}):null]}),o?(0,Y.jsx)(`p`,{className:`oc-int__otlp-headers-error`,children:o}):null,(0,Y.jsx)(`p`,{className:`oc-uipa__note`,children:oe()})]})}export{Ee as IntegrationsTab};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Bf as r,CC as i,E as a,Gf as o,Hf as s,If as c,Jf as l,Kf as u,Lf as d,Rf as f,SC as p,TC as m,Uf as h,Vf as g,Wf as ee,XC as _,Yf as v,hC as y,jA as b,mC as x,qf as S,wC as C,zf as w}from"./dist-DLKTmLXq.js";import{Ft as T,Pt as E,a as D,lt as te,n as ne,r as re}from"./index-D6NQyqlV.js";import{a as O,n as k,o as A,r as j,t as M}from"./card-C0nw-MW3.js";import{n as N,t as P}from"./TimeRangePicker-CD2-qOqD.js";var F=t(e(),1),I=n(),L=15,R=e=>String(Math.round(e));function z(){let e=b(a.me.getMe,{host:te})?.permissions?.includes(`traces.read`)??!1,t=b(a.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:_()}),(0,I.jsxs)(M,{children:[(0,I.jsxs)(O,{children:[(0,I.jsx)(A,{children:m()}),(0,I.jsx)(j,{children:i()})]}),(0,I.jsx)(k,{children:n.length<2?(0,I.jsx)(`p`,{className:`oc-admin__hint`,children:p()}):(0,I.jsx)(B,{series:n})})]})]})}function B({series:e}){let t=e.map(e=>e.cP50),n=e.map(e=>e.aP50),r=Math.max(1,...t,...n),i=t=>6+t*468/(e.length-1),a=e=>74-e*68/r,o=e=>e.map((e,t)=>`${t===0?`M`:`L`}${i(t).toFixed(1)},${a(e).toFixed(1)}`).join(` `),s=e[e.length-1];return(0,I.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,I.jsxs)(`div`,{className:`flex gap-3 text-xs text-muted-foreground`,children:[(0,I.jsxs)(`span`,{style:{color:`var(--primary)`},children:[x(),` p50 `,R(s.cP50),` `,C()]}),(0,I.jsxs)(`span`,{children:[y(),` p50 `,R(s.aP50),` `,C()]})]}),(0,I.jsxs)(`svg`,{viewBox:`0 0 480 80`,className:`h-20 w-full`,preserveAspectRatio:`none`,role:`img`,"aria-label":m(),children:[(0,I.jsx)(`path`,{d:o(n),fill:`none`,style:{stroke:`var(--muted-foreground)`},strokeWidth:1.5}),(0,I.jsx)(`path`,{d:o(t),fill:`none`,style:{stroke:`var(--primary)`},strokeWidth:1.5})]})]})}var V=[{metric:`api.calls`,label:v(),unit:`/h`,group:`API`,isError:!1},{metric:`api.errors`,label:l(),unit:`/h`,group:`API`,isError:!0},{metric:`api.latency.avg_ms`,label:S(),unit:`ms`,group:`API`,isError:!1},{metric:`openclaw.ingest`,label:u(),unit:`/h`,group:`OpenClaw`,isError:!1},{metric:`chat.send`,label:o(),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=T({from:`/settings/kpi`}),t=E({from:`/settings/kpi`}),n=re(e.from,e.to,ne,`now`),i=e=>void t({search:t=>({...t,...D(e)})}),{from:o,to:c}=N(n),{rowLimit:l,buckets:u}=K(o,c),d=b(a.kpi.listKpis,{limit:l,filter:{from:o,to:c}}),f=(0,F.useMemo)(()=>{let e=new Map;for(let t of d??[]){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>u&&e.set(t,n.slice(n.length-u));return e},[d,u]),p=(0,I.jsxs)(I.Fragment,{children:[(0,I.jsxs)(`p`,{className:`oc-admin__hint`,children:[h(),` `,(0,I.jsx)(`span`,{className:`oc-filter__window`,children:s()})]}),(0,I.jsx)(J,{value:n,onChange:i})]});return d===void 0?(0,I.jsxs)(I.Fragment,{children:[p,(0,I.jsx)(z,{}),(0,I.jsx)(`p`,{className:`oc-admin__hint`,children:g()})]}):d.length===0?(0,I.jsxs)(I.Fragment,{children:[p,(0,I.jsx)(z,{}),(0,I.jsx)(`p`,{className:`oc-admin__hint`,children:r()})]}):(0,I.jsxs)(I.Fragment,{children:[p,(0,I.jsx)(z,{}),U.map(e=>{let t=V.filter(t=>t.group===e);return t.some(e=>(f.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:f.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:w({value:$(n.bucket)})}):(0,I.jsx)(`span`,{className:`oc-kpi__muted`,children:f()}),(0,I.jsx)(`span`,{className:`oc-kpi__muted`,children:d({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":c({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{AA as r,AD as i,BD as a,CD as o,DD as s,E as c,ED as l,FD as u,GD as d,HD as f,ID as p,JD as m,KD as h,LD as g,MD as _,ND as ee,OD as te,PD as ne,Qy as re,RD as ie,SA as ae,SD as oe,TD as se,UD as ce,VD as le,WD as ue,XD as de,YD as v,_A as y,_D as b,aA as x,bD as S,cA as C,dA as w,fA as T,iA as E,jA as D,jD as O,kD as k,lA as A,mA as j,oA as M,pA as N,qD as P,sA as F,uA as I,vD as L,wD as R,xD as z,yD as B,zD as V}from"./dist-DLKTmLXq.js";import{t as H}from"./button-BgI9tkZX.js";import{C as fe,N as pe,S as me,_ as U,b as he,et as W,j as ge,lt as G,x as K,y as _e}from"./index-D6NQyqlV.js";import{t as ve}from"./localePickerView-C2RmOS86.js";var q=t(e(),1),J=[{id:`messages`,label:()=>de()},{id:`composer`,label:()=>v()},{id:`sidebar`,label:()=>m()},{id:`other`,label:()=>P()}],Y={showSource:{category:`messages`,label:()=>h(),help:()=>d()},showReport:{category:`messages`,label:()=>ue(),help:()=>ce()},copyAssistant:{category:`messages`,label:()=>f()},copyUser:{category:`messages`,label:()=>le()},showDelete:{category:`messages`,label:()=>a()},showTools:{category:`messages`,label:()=>V(),help:()=>ie()},voiceInput:{category:`composer`,label:()=>g(),help:()=>p()},showChatAge:{category:`sidebar`,label:()=>u(),help:()=>ne()},showChatProvider:{category:`sidebar`,label:()=>ee(),help:()=>_()}};function X(e){return e.toLowerCase().normalize(`NFD`).replace(/\p{Diacritic}/gu,``)}function ye(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 be=[`showSource`,`showReport`,`copyAssistant`,`copyUser`,`showDelete`,`showTools`,`voiceInput`,`showChatAge`,`showChatProvider`],xe={voiceInput:`voiceInput`};function Se(e){return be.includes(e)}function Z(e){return e===`admin`}function Ce(e){return e===!0?`on`:e===!1?`off`:`inherit`}function we(e){return e===`on`?!0:e===`off`?!1:null}function Q(e){return Se(e)?xe[e]:void 0}var $=n(),Te={voiceInput:()=>z()};function Ee({prefKey:e,ui:t}){let n=r(c.admin.setUiPrefDefault),i=r(c.admin.setFeatureEnabled),a=Q(e),o=a?Te[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:se()}),(0,$.jsxs)(_e,{value:Ce(t.defaults[e]),onValueChange:t=>void n({key:e,value:we(t)}),children:[(0,$.jsx)(me,{size:`sm`,className:`w-36`,children:(0,$.jsx)(fe,{})}),(0,$.jsxs)(he,{children:[(0,$.jsx)(K,{value:`on`,children:B()}),(0,$.jsx)(K,{value:`off`,children:L()}),(0,$.jsx)(K,{value:`inherit`,children:b()})]})]}),a?(0,$.jsxs)(`span`,{className:`oc-prefs__gov-gate`,children:[(0,$.jsx)(U,{checked:t.featuresEnabled[a]===!0,onCheckedChange:e=>void i({key:a,enabled:e===!0}),"aria-label":R()}),R()]}):null]}),o?(0,$.jsx)(`span`,{className:`oc-prefs__gov-help`,children:o}):null]})}function De(){let[e,t]=(0,q.useState)(``),[n,a]=(0,q.useState)(!1),u=D(c.me.getMe,{host:G}),d=u?.ui,f=Z(u?.role)&&n,p=r(c.me.setUiPref).withOptimisticUpdate(ge),m=(0,q.useMemo)(()=>d?ye(Object.keys(d.effective),e):[],[d,e]);return d?(0,$.jsxs)(`div`,{className:`oc-prefs-panel`,children:[Z(u?.role)?(0,$.jsxs)(`label`,{className:`oc-prefs__gov-toggle`,children:[(0,$.jsx)(U,{checked:n,onCheckedChange:e=>a(e===!0),"aria-label":l()}),l()]}):null,f?(0,$.jsxs)(`div`,{className:`oc-prefs__gov-head`,children:[(0,$.jsx)(`p`,{children:o()}),(0,$.jsx)(`p`,{children:oe()}),(0,$.jsx)(`p`,{children:S()})]}):null,(0,$.jsx)(W,{value:e,onChange:e=>t(e.target.value),placeholder:O(),"aria-label":O(),className:`mb-2`}),m.length===0?(0,$.jsx)(`div`,{className:`oc-prefs__empty`,children:i()}):(0,$.jsx)(`div`,{className:`oc-prefs`,children:m.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=d.locked[e],a=d.effective[e],o=d.userOverrides[e]!==void 0;return(0,$.jsxs)(`div`,{className:`oc-prefs__row${i?` is-locked`:``}${o&&!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:k()}):o?null:(0,$.jsx)(`span`,{className:`oc-prefs__def`,children:te()})]}),r?(0,$.jsx)(`span`,{className:`oc-prefs__help`,children:r}):null]}),(0,$.jsxs)(`div`,{className:`oc-prefs__ctl`,children:[!i&&o?(0,$.jsx)(`button`,{type:`button`,className:`oc-prefs__reset`,onClick:()=>void p({key:e,value:null}),children:s()}):null,(0,$.jsx)(U,{checked:a,disabled:i,onCheckedChange:t=>void p({key:e,value:t===!0}),"aria-label":n})]}),f?(0,$.jsx)(Ee,{prefKey:e,ui:d}):null]},e)})]},e.id))})]}):(0,$.jsx)(`div`,{className:`oc-prefs__empty`,children:ae()})}function Oe(){let e=D(c.me.getMe,{host:G}),t=r(c.me.setLocale),n=r(c.me.setMyName),i=pe(),a=e?.locale??`default`,o=e?.name??``,[s,l]=(0,q.useState)(null),u=s??o,d=u.trim()!==o.trim();async function f(){try{await n({name:u}),l(null),i.success(I())}catch(e){i.error(A(),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:j()}),(0,$.jsx)(`p`,{className:`oc-show__desc`,children:N()})]}),(0,$.jsxs)(`div`,{className:`oc-show__row`,children:[(0,$.jsx)(W,{className:`max-w-xs`,value:u,maxLength:120,placeholder:T(),onChange:e=>l(e.target.value),onKeyDown:e=>{e.key===`Enter`&&d&&(e.preventDefault(),f())}}),(0,$.jsx)(H,{size:`sm`,disabled:!d,onClick:()=>void f(),children:re()})]}),(0,$.jsx)(`p`,{className:`oc-show__desc`,children:w()})]}),(0,$.jsxs)(`section`,{className:`oc-show__section`,children:[(0,$.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,$.jsx)(`h2`,{className:`oc-show__title`,children:C()}),(0,$.jsx)(`p`,{className:`oc-show__desc`,children:F()})]}),(0,$.jsxs)(`div`,{className:`oc-show__row`,children:[ve().map(e=>(0,$.jsx)(H,{variant:a===e.value?`default`:`outline`,size:`sm`,onClick:()=>void t({locale:e.value}),children:e.label},e.value)),(0,$.jsx)(H,{variant:a==="default"?`default`:`outline`,size:`sm`,onClick:()=>void t({locale:null}),children:y()})]}),(0,$.jsx)(`p`,{className:`oc-show__desc`,children:M()})]}),(0,$.jsxs)(`section`,{className:`oc-show__section`,children:[(0,$.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,$.jsx)(`h2`,{className:`oc-show__title`,children:x()}),(0,$.jsx)(`p`,{className:`oc-show__desc`,children:E()})]}),(0,$.jsx)(De,{})]})]})}export{Oe as PreferencesTab};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{A as r,AA as i,At as a,Cm as o,E as s,Mm as c,Mt as l,Nt as u,O as d,Ot as f,Sm as p,_m as m,am as h,bm as g,cm as _,dm as v,dr as y,fm as b,fr as x,gm as S,hm as C,jA as w,jm as T,jt as E,k as D,kt as O,lm as ee,mm as te,mr as ne,om as re,pm as ie,pr as ae,sm as oe,um as k,ur as A,vm as j,wm as M,xm as N,ym as P}from"./dist-DLKTmLXq.js";import{d as F,f as I,i as L,l as R,n as z,r as B,t as V,u as H}from"./FieldLabel-DrAMRvzk.js";import{t as U}from"./button-BgI9tkZX.js";import{C as W,N as se,S as G,_ as K,b as q,lt as ce,x as J,y as Y}from"./index-D6NQyqlV.js";import{r as X,t as Z}from"./locales-CPjguROj.js";import{t as le}from"./localePickerView-C2RmOS86.js";/* empty css */var Q=t(e(),1),$=n(),ue={media_delivery:{label:P,help:j},documentary_fetch:{label:m,help:S},inbound_files:{label:C,help:te},history_summary:{label:ne,help:ae},file_curation:{label:u,help:l}},de={outboundDir:`/home/node/.openclaw/media/outbound`,references:`- gdrive/1a2b3c4d5e6f7890abcd
|
|
2
|
+
- gdrive/0f9e8d7c6b5a4321dcba`,files:`- /home/node/.openclaw/media/inbound/rapport.pdf (124800 o, application/pdf)`,previous_summary:`Projet Alpha : budget 40 000 EUR ; choix du serveur en cours.`,new_messages:`Utilisateur : Compare OVH et Scaleway.
|
|
3
|
+
Assistant : Comparaison en cours.`,max_chars:`6000`,file_name:`MEMORY.md`,budget_chars:`20000`,feedback:`Trop de suppressions dans la section des liens, garde-les.`,content:`# Memory index
|
|
4
|
+
- [Fait 1](fait-1.md) - note du projet`},fe={outboundDir:oe,references:re,files:h,previous_summary:x,new_messages:y,max_chars:A,file_name:E,budget_chars:a,feedback:O,content:f};function pe(){let e=w(s.admin.listInstances,{}),[t,n]=(0,Q.useState)(null);if(e===void 0)return(0,$.jsx)(`div`,{className:`oc-settings__tab-loading`,"aria-busy":`true`});if(e.length===0)return(0,$.jsx)(`div`,{className:`oc-injtab`,children:(0,$.jsx)(`p`,{className:`oc-admin__hint`,children:b()})});let r=e.find(e=>e._id===t)??e[0];return(0,$.jsxs)(`div`,{className:`oc-injtab`,children:[(0,$.jsxs)(`div`,{className:`oc-injtab__head`,children:[(0,$.jsx)(z,{label:M(),help:o()}),(0,$.jsxs)(`label`,{className:`oc-injtab__picker`,children:[(0,$.jsx)(`span`,{children:ie()}),(0,$.jsxs)(Y,{value:r._id,onValueChange:e=>n(e),children:[(0,$.jsx)(G,{size:`sm`,className:`min-w-44`,children:(0,$.jsx)(W,{})}),(0,$.jsx)(q,{children:e.map(e=>(0,$.jsx)(J,{value:e._id,children:e.displayName??e.name},e._id))})]})]})]}),(0,$.jsx)(me,{instance:r},r._id)]})}function me({instance:e}){let t=i(s.admin.upsertInstanceConfig),n=se(),a=w(s.me.getMe,{host:ce}),o=e.config??{},l=X(e.config?.contentLocale,a?.defaultLocale??void 0),[u,f]=(0,Q.useState)(()=>L(o,l));(0,Q.useEffect)(()=>{f(L(o,l))},[l,e._id]);let[p,m]=(0,Q.useState)(!1),h=u.promptInjections,g=(e,t)=>f({...u,promptInjections:{...h,[e]:{...h[e],...t}}});async function _(){m(!0);try{await t({instanceId:e._id,config:B(u,o,l)})}catch(e){n.error(T(),e)}finally{m(!1)}}async function v(r){let i={...e.config??{}};r==="default"?delete i.contentLocale:i.contentLocale=r;try{await t({instanceId:e._id,config:i})}catch(e){n.error(T(),e)}}let y=e.config?.contentLocale??`default`,b=Z[X(void 0,a?.defaultLocale??void 0)];return(0,$.jsxs)(`div`,{className:`oc-injtab__body`,children:[(0,$.jsxs)(`div`,{className:`oc-injtab__content-locale`,children:[(0,$.jsx)(`span`,{children:r()}),(0,$.jsxs)(Y,{value:y,onValueChange:e=>void v(e),children:[(0,$.jsx)(G,{size:`sm`,className:`min-w-44`,children:(0,$.jsx)(W,{})}),(0,$.jsxs)(q,{children:[(0,$.jsx)(J,{value:`default`,children:d({locale:b})}),le().map(e=>(0,$.jsx)(J,{value:e.value,children:e.label},e.value))]})]}),(0,$.jsx)(`p`,{className:`oc-admin__hint`,children:D()})]}),H.map(e=>(0,$.jsx)(he,{injKey:e,def:R[e],i18n:ue[e],row:h[e]??{enabled:!0,template:R[e].defaultTemplate[l]},contentLocale:l,onChange:t=>g(e,t)},e)),(0,$.jsx)(`div`,{className:`oc-injtab__actions`,children:(0,$.jsx)(U,{size:`sm`,onClick:()=>void _(),disabled:p,children:c()})})]})}function he({injKey:e,def:t,i18n:n,row:r,contentLocale:i,onChange:a}){let[o,s]=(0,Q.useState)(!1),c=r.template.trim()!==t.defaultTemplate[i],l=t.togglable&&!r.enabled,u=Object.fromEntries(t.placeholders.map(e=>[e,de[e]??`{${e}}`])),d=F(e,r,i),f=d?I(d,u):``;return(0,$.jsxs)(`section`,{className:`oc-injcard`,children:[(0,$.jsxs)(`div`,{className:`oc-injcard__head`,children:[t.togglable?(0,$.jsxs)(`label`,{className:`oc-field--row`,children:[(0,$.jsx)(K,{checked:r.enabled,onCheckedChange:e=>a({enabled:e===!0})}),(0,$.jsx)(z,{label:n.label(),help:n.help()})]}):(0,$.jsx)(z,{label:n.label(),help:n.help()}),c&&(0,$.jsx)(`span`,{className:`oc-injection__badge`,children:N()})]}),(0,$.jsx)(`textarea`,{className:`oc-injcard__text`,value:r.template,disabled:l,rows:8,spellCheck:!1,onChange:e=>a({template:e.target.value})}),(0,$.jsxs)(`div`,{className:`oc-injection__foot`,children:[(0,$.jsxs)(`div`,{className:`oc-injcard__phs`,children:[(0,$.jsx)(`span`,{className:`oc-injection__ph`,children:g()}),t.placeholders.map(e=>(0,$.jsxs)(`span`,{className:`oc-injcard__ph-chip`,children:[(0,$.jsx)(`code`,{children:`{${e}}`}),(0,$.jsx)(V,{text:(fe[e]??(()=>e))()})]},e))]}),(0,$.jsxs)(`div`,{className:`oc-injcard__btns`,children:[(0,$.jsx)(U,{variant:`ghost`,size:`sm`,onClick:()=>s(e=>!e),children:o?k():v()}),c&&(0,$.jsx)(U,{variant:`ghost`,size:`sm`,onClick:()=>a({template:t.defaultTemplate[i]}),children:p()})]})]}),o&&(0,$.jsx)(`div`,{className:`oc-injcard__preview`,children:f?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`pre`,{className:`oc-injcard__previewtext`,children:f}),(0,$.jsx)(`span`,{className:`oc-injection__ph`,children:ee()})]}):(0,$.jsx)(`span`,{className:`oc-injection__ph`,children:_()})})]})}export{pe as PromptInjectionsTab};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$_ as r,AA as i,A_ as a,D_ as ee,E as o,F_ as te,G_ as s,H_ as c,J_ as l,K_ as u,M_ as d,N_ as f,O_ as p,P_ as ne,Q_ as re,U_ as ie,V_ as ae,W_ as m,X_ as h,Y_ as g,Z_ as _,av as v,cv as y,dv as b,ev as x,fv as S,gv as C,hv as w,iv as T,jA as E,j_ as D,k_ as O,lv as k,mv as A,nv as j,ov as M,pv as N,q_ as P,rn as F,rv as I,sv as L,tv as R,uv as z}from"./dist-DLKTmLXq.js";import{t as B}from"./button-BgI9tkZX.js";import{$ as V,N as H,P as U,_ as W,et as G,m as K,wt as q}from"./index-D6NQyqlV.js";import{t as J}from"./roleDescriptions-DtK7AfJm.js";var Y=t(e(),1),X=n(),Z=[{group:()=>C(),keys:[{key:`traces.read`,label:()=>b()},{key:`traces.read.content`,label:()=>z(),phi:!0},{key:`traces.write`,label:()=>k()}]},{group:()=>w(),keys:[{key:`kpi.read`,label:()=>b()},{key:`kpi.write`,label:()=>k()}]},{group:()=>A(),keys:[{key:`openclaw.query`,label:()=>y()},{key:`anomalies.read`,label:()=>L()},{key:`anomalies.report`,label:()=>M()}]},{group:()=>N(),keys:[{key:`chats.read`,label:()=>b()},{key:`selfheal`,label:()=>T()},{key:`feedback.respond`,label:()=>F()}]},{group:()=>S(),keys:[{key:`admin.manage`,label:()=>v()}]}],oe=Z.flatMap(e=>e.keys.map(e=>e.key));function Q(e){return e.includes(`*`)}var $={key:``,name:``,description:``};function se(){let e=E(o.apiKeys.listRoles,{}),t=i(o.apiKeys.createRole),n=i(o.apiKeys.ensureRolesSeeded),v=i(o.apiKeys.updateRolePermissions).withOptimisticUpdate((e,{roleId:t,permissions:n})=>{let r=e.getQuery(o.apiKeys.listRoles,{});r&&e.setQuery(o.apiKeys.listRoles,{},r.map(e=>e._id===t?{...e,permissions:n}:e))}),y=U(),b=H(),[S,C]=(0,Y.useState)(!1),[w,T]=(0,Y.useState)($),[k,A]=(0,Y.useState)(new Set);(0,Y.useEffect)(()=>{n({}).catch(e=>{b.error(j(),e)})},[n,b]);let M=e??[];async function N(e,t){if(Q(e.permissions)||k.has(e._id))return;let n=e.permissions.includes(t)?e.permissions.filter(e=>e!==t):[...e.permissions,t];if(!(e.builtin&&!await y({title:R({name:e.name}),description:x(),confirmLabel:r()}))){A(t=>new Set(t).add(e._id));try{await v({roleId:e._id,permissions:n})}catch(e){b.error(re(),e)}finally{A(t=>{let n=new Set(t);return n.delete(e._id),n})}}}async function F(){try{await t({key:w.key,name:w.name,description:w.description||void 0,permissions:[]}),T($),C(!1)}catch(e){b.error(_(),e)}}let L=e===void 0,z=!L&&M.length===0;return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`p`,{className:`oc-admin__hint`,children:[h(),` `,(0,X.jsx)(`code`,{children:`admin`}),` `,g(),` `,(0,X.jsx)(`code`,{children:`traces.read.content`}),` `,l()]}),(0,X.jsxs)(`div`,{className:`oc-dt`,children:[(0,X.jsxs)(`div`,{className:`oc-dt__bar`,children:[(0,X.jsx)(`h2`,{className:`oc-dt__title`,children:P()}),(0,X.jsx)(`div`,{className:`oc-dt__bar-actions`,children:(0,X.jsx)(B,{size:`sm`,onClick:()=>{T($),C(!0)},children:u()})})]}),L?(0,X.jsx)(`p`,{className:`oc-admin__hint`,children:s()}):z?(0,X.jsx)(`p`,{className:`oc-admin__hint`,children:m()}):(0,X.jsx)(`div`,{className:`oc-matrix__scroll`,children:(0,X.jsxs)(`table`,{className:`oc-matrix`,children:[(0,X.jsxs)(`thead`,{children:[(0,X.jsxs)(`tr`,{children:[(0,X.jsx)(`th`,{className:`oc-matrix__corner`,rowSpan:2,children:ie()}),Z.map(e=>(0,X.jsx)(`th`,{className:`oc-matrix__group`,colSpan:e.keys.length,children:e.group()},e.group()))]}),(0,X.jsx)(`tr`,{children:Z.flatMap(e=>e.keys.map(e=>(0,X.jsxs)(`th`,{className:`oc-matrix__perm`,title:e.phi?I({key:e.key}):e.key,children:[e.label(),e.phi?(0,X.jsx)(`span`,{className:`oc-matrix__phi`,children:` ⚠`}):null]},e.key)))})]}),(0,X.jsx)(`tbody`,{children:M.map(e=>{let t=Q(e.permissions),n=k.has(e._id);return(0,X.jsxs)(`tr`,{children:[(0,X.jsxs)(`th`,{className:`oc-matrix__rolecell`,children:[(0,X.jsxs)(`div`,{className:`oc-matrix__rolename`,children:[(0,X.jsx)(`span`,{children:e.name}),(0,X.jsx)(`code`,{className:`oc-matrix__rolekey`,children:e.key}),e.builtin?(0,X.jsxs)(V,{variant:`outline`,className:`gap-1`,children:[(0,X.jsx)(q,{}),` `,c()]}):(0,X.jsx)(V,{variant:`secondary`,children:ae()})]}),J(e)?(0,X.jsx)(`p`,{className:`oc-matrix__roledesc`,children:J(e)}):null]}),oe.map(r=>(0,X.jsx)(`td`,{className:`oc-matrix__cell`,children:(0,X.jsx)(W,{checked:t||e.permissions.includes(r),disabled:t||n,"aria-label":`${e.key} · ${r}`,title:t?te():n?ne():r,onCheckedChange:()=>void N(e,r)})},r))]},e.key)})})]})})]}),(0,X.jsx)(K,{open:S,onOpenChange:C,title:f(),description:d(),canSubmit:!!(w.key&&w.name),onSubmit:F,submitLabel:D(),children:(0,X.jsxs)(`div`,{className:`oc-form`,children:[(0,X.jsxs)(`label`,{className:`oc-field`,children:[(0,X.jsx)(`span`,{className:`oc-field__label`,children:a()}),(0,X.jsx)(G,{value:w.key,placeholder:O(),onChange:e=>T({...w,key:e.target.value})})]}),(0,X.jsxs)(`label`,{className:`oc-field`,children:[(0,X.jsx)(`span`,{className:`oc-field__label`,children:p()}),(0,X.jsx)(G,{value:w.name,onChange:e=>T({...w,name:e.target.value})})]}),(0,X.jsxs)(`label`,{className:`oc-field`,children:[(0,X.jsx)(`span`,{className:`oc-field__label`,children:ee()}),(0,X.jsx)(G,{value:w.description,onChange:e=>T({...w,description:e.target.value})})]})]})})]})}export{se as RolesTab};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$E as r,$T as i,AA as a,AE as ee,BE as te,CE as ne,DE as re,E as o,EE as ie,FE as ae,GE as oe,HE as se,IE as ce,JE as le,KE as ue,LE as de,ME as fe,NE as pe,OA as me,OE as he,PE as ge,QE as _e,QT as s,RE as ve,SE as ye,TE as be,UE as xe,VE as Se,WE as Ce,XE as we,XT as c,YE as Te,ZE as Ee,ZT as De,_E as Oe,aD as ke,aE as Ae,bE as je,cD as Me,cE as l,dD as u,dE as d,eD as Ne,eE as f,fD as Pe,fE as p,gD as Fe,gE as m,hD as Ie,hE as h,iD as Le,iE as g,jA as _,jE as Re,kE as ze,lD as Be,lE as v,mD as Ve,mE as y,nD as He,nE as b,oD as Ue,oE as x,pD as We,pE as S,qE as Ge,rD as Ke,rE as C,sD as qe,sE as w,tD as Je,tE as T,uD as E,uE as D,vE as O,wE as Ye,xE as Xe,yE as k,zE as Ze}from"./dist-DLKTmLXq.js";import{n as A}from"./dist-DTUs9qnE.js";import{i as Qe}from"./dist-CNjYZaW-.js";import{t as j}from"./button-BgI9tkZX.js";import{$ as M,At as N,C as P,Ft as $e,N as et,Nt as tt,O as F,P as nt,Pt as rt,S as I,at as L,b as R,et as z,it as B,k as V,m as it,nt as H,ot as at,rt as ot,tt as U,x as W,y as G}from"./index-D6NQyqlV.js";import{t as st}from"./FilterBar-CDYmDUw2.js";import{t as ct}from"./DataTableShell-nb7UG6xl.js";import{t as lt}from"./roleDescriptions-DtK7AfJm.js";var K=t(e(),1),q=n(),J=[{value:`never`,label:()=>b(),days:null},{value:`30`,label:()=>T(),days:30},{value:`90`,label:()=>f(),days:90}],Y=720*60*60*1e3,X=`__all__`,Z={name:``,roleKey:``,description:``};function Q(){let e=$e({from:`/settings/serviceAccounts`}),t=rt({from:`/settings/serviceAccounts`}),n=e.q??``,i=e.status??X,[s,c]=(0,K.useState)(X),De=e=>void t({search:t=>({...t,q:e||void 0}),replace:!0}),Oe=e=>void t({search:t=>({...t,status:e===X?void 0:e})}),Ae=_(o.apiKeys.listServiceAccounts,{filter:{q:n||void 0,role:s===X?void 0:s,disabled:i===X?void 0:i===`disabled`}}),l=_(o.apiKeys.listKeys,{}),d=_(o.apiKeys.listRoles,{}),f=a(o.apiKeys.createServiceAccount),p=a(o.apiKeys.updateServiceAccount),m=a(o.apiKeys.deleteServiceAccount),h=me(o.apiKeys.mintApiKey),g=a(o.apiKeys.revokeApiKey),v=nt(),y=et(),b=n!==``||s!==X||i!==X;function x(){c(X),t({search:{},replace:!0})}let[S,C]=(0,K.useState)(!1),[w,T]=(0,K.useState)(Z),[D,O]=(0,K.useState)(null),[k,A]=(0,K.useState)(new Set),[N,F]=(0,K.useState)(null),L=(0,K.useRef)(!1),[B,V]=(0,K.useState)(new Set),[H,at]=(0,K.useState)({}),[ot,U]=(0,K.useState)(null),Y=(0,K.useMemo)(()=>{let e=new Map;for(let t of l??[]){let n=e.get(t.serviceAccountId)??[];n.push(t),e.set(t.serviceAccountId,n)}return e},[l]);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 p({serviceAccountId:D,name:w.name,roleKey:w.roleKey,description:w.description}),y.success(ge())):await f({name:w.name,roleKey:w.roleKey,description:w.description||void 0}),T(Z),O(null),C(!1)}catch(e){y.error(D?ae():ce(),e)}}function pt(e){T({name:e.name,roleKey:e.roleKey,description:e.description??``}),O(e._id),C(!0)}async function mt(e){if(L.current)return;L.current=!0;let t=H[e._id]??`never`,n=J.find(e=>e.value===t)?.days??null,r=n?Date.now()+n*24*60*60*1e3:void 0;F(e._id);try{let t=await h({serviceAccountId:e._id,expiresAt:r});U({accountName:e.name,plaintext:t.plaintext,prefix:t.prefix,lastFour:t.lastFour})}catch(e){y.error(pe(),e)}finally{L.current=!1,F(null)}}async function $(e){if(await v({title:fe(),description:(0,q.jsxs)(q.Fragment,{children:[Re(),` `,(0,q.jsx)(`span`,{className:`font-mono`,children:e.name}),` `,ee(),` `,(0,q.jsx)(`strong`,{children:ze()}),` `,he()]}),confirmWord:e.name,confirmLabel:re(),destructive:!0}))try{await m({serviceAccountId:e._id}),y.success(ie(),e.name)}catch(e){y.error(be(),e)}}async function ht(e){if(await v({title:Ye(),description:(0,q.jsxs)(q.Fragment,{children:[ne(),` `,(0,q.jsxs)(`span`,{className:`font-mono`,children:[e.prefix,`…`,e.lastFour]}),` `,ye()]}),confirmLabel:Xe(),destructive:!0})&&!B.has(e._id)){V(t=>new Set(t).add(e._id));try{await g({keyId:e._id})}catch(e){y.error(je(),e)}finally{V(t=>{let n=new Set(t);return n.delete(e._id),n})}}}return(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(`p`,{className:`oc-admin__hint`,children:Fe()}),(0,q.jsxs)(st,{q:n,onQChange:De,searchPlaceholder:Ie(),onReset:x,canReset:b,children:[(0,q.jsxs)(G,{value:s,onValueChange:c,children:[(0,q.jsx)(I,{size:`sm`,className:`w-40`,children:(0,q.jsx)(P,{placeholder:Ve()})}),(0,q.jsxs)(R,{children:[(0,q.jsx)(W,{value:X,children:We()}),(d??[]).map(e=>(0,q.jsx)(W,{value:e.key,children:e.key},e._id))]})]}),(0,q.jsxs)(G,{value:i,onValueChange:Oe,children:[(0,q.jsx)(I,{size:`sm`,className:`w-36`,children:(0,q.jsx)(P,{})}),(0,q.jsxs)(R,{children:[(0,q.jsx)(W,{value:X,children:Pe()}),(0,q.jsx)(W,{value:`active`,children:u()}),(0,q.jsx)(W,{value:`disabled`,children:E()})]})]})]}),(0,q.jsx)(ct,{title:Be(),rows:Ae,addLabel:Me(),onAdd:()=>{T(Z),O(null),C(!0)},emptyHint:qe(),isExpanded:e=>k.has(e._id),renderExpanded:e=>(0,q.jsx)(ut,{account:e,keys:Y.get(e._id)??[],onRevoke:ht,revoking:B}),rowActions:e=>[{label:Ke(),onSelect:()=>pt(e)},{label:Ue(),onSelect:()=>void mt(e)},{label:k.has(e._id)?ke():Le(),onSelect:()=>Q(e._id)},{label:He(),variant:`destructive`,onSelect:()=>void $(e)}],columns:[{header:``,className:`w-8`,cell:e=>(0,q.jsx)(j,{variant:`ghost`,size:`icon-sm`,"aria-label":k.has(e._id)?Je():Ne(),onClick:()=>Q(e._id),children:k.has(e._id)?(0,q.jsx)(Qe,{}):(0,q.jsx)(tt,{})})},{header:r(),sort:e=>e.name,cell:e=>(0,q.jsxs)(`div`,{className:`flex flex-col`,children:[(0,q.jsx)(`span`,{children:e.name}),e.description?(0,q.jsx)(`span`,{className:`text-muted-foreground text-xs`,children:e.description}):null]})},{header:_e(),sort:e=>e.roleKey,cell:e=>(0,q.jsx)(M,{variant:`secondary`,children:e.roleKey})},{header:Ee(),sort:e=>+!!e.disabled,cell:e=>e.disabled?(0,q.jsx)(M,{variant:`destructive`,children:E()}):(0,q.jsx)(M,{variant:`outline`,children:u()})},{header:we(),cell:e=>(0,q.jsxs)(G,{value:H[e._id]??`never`,onValueChange:t=>at(n=>({...n,[e._id]:t})),children:[(0,q.jsx)(I,{size:`sm`,className:`w-32`,children:(0,q.jsx)(P,{})}),(0,q.jsx)(R,{children:J.map(e=>(0,q.jsx)(W,{value:e.value,children:e.label()},e.value))})]})},{header:Te(),sort:e=>(Y.get(e._id)??[]).filter(e=>!e.disabled).length,cell:e=>{let t=(Y.get(e._id)??[]).filter(e=>!e.disabled).length;return(0,q.jsx)(`span`,{className:`oc-sa__keycount`,children:N===e._id?le():Ge({count:t})})}}]}),(0,q.jsx)(it,{open:S,onOpenChange:e=>{C(e),e||O(null)},title:D?ue():xe(),description:D?oe():se(),canSubmit:!!(w.name&&w.roleKey),onSubmit:ft,submitLabel:D?Ce():Se(),children:(0,q.jsxs)(`div`,{className:`oc-form`,children:[(0,q.jsxs)(`label`,{className:`oc-field`,children:[(0,q.jsx)(`span`,{className:`oc-field__label`,children:te()}),(0,q.jsx)(z,{value:w.name,onChange:e=>T({...w,name:e.target.value})})]}),(0,q.jsxs)(`label`,{className:`oc-field`,children:[(0,q.jsx)(`span`,{className:`oc-field__label`,children:Ze()}),(0,q.jsxs)(G,{value:w.roleKey||void 0,onValueChange:e=>T({...w,roleKey:e}),children:[(0,q.jsx)(I,{className:`w-full`,children:(0,q.jsx)(P,{placeholder:ve()})}),(0,q.jsx)(R,{children:(d??[]).map(e=>(0,q.jsxs)(W,{value:e.key,children:[e.name,` (`,e.key,`)`]},e._id))})]}),(()=>{let e=(d??[]).find(e=>e.key===w.roleKey),t=e?lt(e):null;return t?(0,q.jsx)(`span`,{className:`text-muted-foreground text-xs`,children:t}):null})()]}),(0,q.jsxs)(`label`,{className:`oc-field`,children:[(0,q.jsx)(`span`,{className:`oc-field__label`,children:de()}),(0,q.jsx)(z,{value:w.description,onChange:e=>T({...w,description:e.target.value})})]})]})}),(0,q.jsx)(dt,{minted:ot,onClose:()=>U(null)})]})}function ut({account:e,keys:t,onRevoke:n,revoking:r}){return(0,q.jsxs)(`div`,{className:`oc-sa__keys`,children:[(0,q.jsxs)(`div`,{className:`oc-sa__keys-head`,children:[k(),` `,(0,q.jsx)(`span`,{className:`font-medium`,children:e.name})]}),t.length===0?(0,q.jsx)(`p`,{className:`oc-admin__hint`,children:O()}):(0,q.jsxs)(`table`,{className:`oc-sa__keytable`,children:[(0,q.jsx)(`thead`,{children:(0,q.jsxs)(`tr`,{children:[(0,q.jsx)(`th`,{children:Oe()}),(0,q.jsx)(`th`,{children:m()}),(0,q.jsx)(`th`,{children:h()}),(0,q.jsx)(`th`,{children:y()}),(0,q.jsx)(`th`,{children:S()}),(0,q.jsx)(`th`,{children:p()}),(0,q.jsx)(`th`,{})]})}),(0,q.jsx)(`tbody`,{children:t.map(t=>(0,q.jsxs)(`tr`,{children:[(0,q.jsx)(`td`,{children:(0,q.jsxs)(`code`,{className:`oc-sa__keyid`,children:[t.prefix,`…`,t.lastFour]})}),(0,q.jsx)(`td`,{children:(0,q.jsx)(M,{variant:`secondary`,children:e.roleKey})}),(0,q.jsx)(`td`,{children:V(t.createdAt)}),(0,q.jsx)(`td`,{className:ft(t.lastUsedAt)?`oc-sa__stale`:``,children:pt(t.lastUsedAt)}),(0,q.jsx)(`td`,{children:mt(t.expiresAt)}),(0,q.jsx)(`td`,{children:$(t)}),(0,q.jsx)(`td`,{className:`text-right`,children:t.disabled?null:(0,q.jsx)(j,{variant:`destructive`,size:`sm`,disabled:r.has(t._id),onClick:()=>n(t),children:r.has(t._id)?d():D()})})]},t._id))})]})]})}function dt({minted:e,onClose:t}){let[n,r]=(0,K.useState)(!1);async function i(){if(e)try{await navigator.clipboard.writeText(e.plaintext),r(!0),window.setTimeout(()=>r(!1),2e3)}catch{}}return(0,q.jsx)(U,{open:e!==null,onOpenChange:e=>{e||(r(!1),t())},children:e?(0,q.jsxs)(H,{className:`max-w-lg`,showCloseButton:!1,onInteractOutside:e=>e.preventDefault(),onEscapeKeyDown:e=>e.preventDefault(),children:[(0,q.jsxs)(L,{children:[(0,q.jsx)(at,{children:v()}),(0,q.jsx)(ot,{children:l({name:e.accountName})})]}),(0,q.jsx)(`div`,{className:`oc-sa__minted-warning`,children:w()}),(0,q.jsxs)(`div`,{className:`oc-sa__minted-box`,children:[(0,q.jsx)(`code`,{className:`oc-sa__minted-plain`,children:e.plaintext}),(0,q.jsxs)(j,{variant:`outline`,size:`sm`,onClick:()=>void i(),"aria-label":x(),children:[n?(0,q.jsx)(A,{}):(0,q.jsx)(N,{}),n?Ae():g()]})]}),(0,q.jsx)(B,{children:(0,q.jsx)(j,{onClick:()=>{r(!1),t()},children:C()})})]}):null})}function ft(e){return e===null?!1:Date.now()-e>Y}function pt(e){return e===null?i():V(e)}function mt(e){return e===null?`—`:F(e)}function $(e){return e.disabled?(0,q.jsx)(M,{variant:`destructive`,children:s()}):e.expiresAt!==null&&e.expiresAt<Date.now()?(0,q.jsx)(M,{variant:`outline`,children:De()}):(0,q.jsx)(M,{variant:`outline`,children:c()})}export{Q as ServiceAccountsTab};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$r as r,AA as i,Ar as a,Br as o,Cr as s,Dr as c,E as l,Er as u,Fr as d,Gr as f,Hr as p,Ir as m,Jr as h,Kr as g,Lr as _,Mr as v,Nr as y,Or as b,Pr as x,Qr as S,Rr as C,Sr as w,Tr as T,Ur as E,Vr as D,Wr as O,Xr as k,Yr as A,Zr as j,br as M,ei as N,jA as P,jr as F,kr as I,ni as L,qr as ee,ri as R,ti as z,wr as B,xr as V,yr as H,zr as U}from"./dist-DLKTmLXq.js";import{t as W}from"./button-BgI9tkZX.js";import{P as G,k as K}from"./index-D6NQyqlV.js";import{t as q}from"./DataTableShell-nb7UG6xl.js";var J=t(e(),1),Y=n(),X={hung:()=>o(),wrong_result:()=>U(),error:()=>C(),other:()=>_()},Z=e=>(e&&X[e]?.())??e??`—`;function Q(e){let t=e.slice(e.lastIndexOf(`:`)+1)||e;return t.length>12?`${t.slice(0,12)}…`:t}function $({data:e}){let t=e.snapshot,n=i(l.subAgentReports.respondToReport),[r,o]=(0,J.useState)(e.thread),[f,p]=(0,J.useState)(``),[h,g]=(0,J.useState)(!1);async function _(){let t=f.trim();if(!(!t||h)){g(!0);try{await n({reportId:e._id,text:t}),o(e=>[...e,{authorRole:`admin`,text:t,at:Date.now()}]),p(``)}finally{g(!1)}}}return(0,Y.jsxs)(`div`,{className:`oc-fbadmin__detail`,children:[(0,Y.jsx)(`div`,{className:`oc-fbadmin__row`,children:(0,Y.jsxs)(`span`,{className:`oc-fbadmin__meta`,children:[Z(e.category),` · `,m({failed:t.failedCount,total:t.totalCount}),t.openclawModel?` · ${t.openclawModel}`:``,t.openclawRuntime?` (${t.openclawRuntime})`:``]})}),e.comment?(0,Y.jsxs)(`section`,{children:[(0,Y.jsx)(`h4`,{className:`oc-fbadmin__h`,children:d()}),(0,Y.jsx)(`p`,{className:`oc-fbadmin__comment`,children:e.comment})]}):null,(0,Y.jsxs)(`section`,{children:[(0,Y.jsx)(`h4`,{className:`oc-fbadmin__h`,children:x()}),r.length>0?(0,Y.jsx)(`div`,{className:`oc-fbadmin__thread`,children:r.map((e,t)=>(0,Y.jsxs)(`div`,{className:`oc-notif__msg oc-notif__msg--${e.authorRole}`,children:[(0,Y.jsx)(`span`,{className:`oc-notif__msg-who`,children:e.authorRole===`admin`?y():v()}),(0,Y.jsx)(`span`,{className:`oc-notif__msg-text`,children:e.text})]},t))}):(0,Y.jsx)(`p`,{className:`oc-fbadmin__meta`,children:F()}),(0,Y.jsx)(`textarea`,{className:`oc-feedback__textarea`,placeholder:a(),value:f,maxLength:2e3,rows:3,onChange:e=>p(e.target.value.slice(0,2e3))}),(0,Y.jsx)(`div`,{className:`oc-fbadmin__row`,style:{justifyContent:`flex-end`},children:(0,Y.jsx)(W,{size:`sm`,onClick:()=>void _(),disabled:!f.trim()||h,children:h?b():I()})})]}),(0,Y.jsxs)(`section`,{children:[(0,Y.jsxs)(`h4`,{className:`oc-fbadmin__h`,children:[c({count:t.children.length}),t.childrenTruncated?` ${u()}`:``,t.textTruncated?` ${T()}`:``]}),(0,Y.jsx)(`div`,{className:`oc-fbadmin__ctx`,children:t.children.map((e,n)=>(0,Y.jsxs)(`div`,{className:`oc-fbadmin__ctx-turn`,children:[(0,Y.jsxs)(`span`,{className:`oc-fbadmin__ctx-role`,children:[(e.taskName?.trim()||Q(e.childSessionKey))+` · ${e.status}`,e.phase?` · ${e.phase}`:``,e.childSessionKey===t.flaggedChildSessionKey?` · ${B()}`:``]}),e.errorMessage?(0,Y.jsx)(`pre`,{className:`oc-msg__source-pre`,children:e.errorMessage}):null,e.resultText?(0,Y.jsx)(`pre`,{className:`oc-msg__source-pre`,children:e.resultText}):null]},n))})]}),t.parentText?(0,Y.jsxs)(`section`,{children:[(0,Y.jsx)(`h4`,{className:`oc-fbadmin__h`,children:s()}),(0,Y.jsx)(`pre`,{className:`oc-msg__source-pre`,children:t.parentText})]}):null,(0,Y.jsxs)(`section`,{children:[(0,Y.jsx)(`h4`,{className:`oc-fbadmin__h`,children:w()}),(0,Y.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 te(){let e=P(l.subAgentReports.listForAdmin,{}),t=i(l.subAgentReports.readReport),n=i(l.subAgentReports.deleteReport),a=G(),[o,s]=(0,J.useState)(null),[c,u]=(0,J.useState)({});async function d(e){if(o===e._id){s(null);return}if(!c[e._id]){let n=await t({reportId:e._id});u(t=>({...t,[e._id]:n}))}s(e._id)}async function m(e){await a({title:V(),description:M(),confirmLabel:H(),destructive:!0})&&(await n({reportId:e._id}),o===e._id&&s(null))}return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(`p`,{className:`oc-admin__hint`,children:[z(),` `,(0,Y.jsx)(`strong`,{children:N()}),` `,r()]}),(0,Y.jsx)(q,{title:R(),rows:e,emptyHint:L(),isExpanded:e=>o===e._id&&!!c[e._id],renderExpanded:e=>c[e._id]?(0,Y.jsx)($,{data:c[e._id]}):null,columns:[{header:S(),cell:e=>K(e.at),sort:e=>e.at},{header:j(),cell:e=>Z(e.category),sort:e=>Z(e.category)},{header:k(),cell:e=>`${e.failedCount}/${e.totalCount}`,sort:e=>e.failedCount},{header:A(),cell:e=>(e.reporterEmail||e.reporterName||`—`)+(e.impersonated&&e.realOperatorEmail?` ${g({operator:e.realOperatorEmail})}`:``),sort:e=>e.reporterEmail||e.reporterName||null},{header:h(),cell:e=>e.hasComment?`✎`:`—`,sort:e=>+!!e.hasComment},{header:ee(),cell:e=>e.answered?(0,Y.jsx)(`span`,{className:`oc-fbadmin__pill is-ok`,children:f()}):(0,Y.jsx)(`span`,{className:`oc-fbadmin__pill`,children:O()}),sort:e=>+!!e.answered}],rowActions:e=>[{label:o===e._id?p():E(),onSelect:()=>void d(e)},{label:D(),onSelect:()=>void m(e),variant:`destructive`}]})]})}export{te as SubAgentReportsTab};
|