@lacneu/atrium 0.101.2 → 0.101.3
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-CgoSHwRq.js → AccessTab-DwQXs7Qd.js} +1 -1
- package/dist/assets/{AdvancedFilter-05ypZDMe.js → AdvancedFilter-BmALfXnB.js} +1 -1
- package/dist/assets/AgentFilesTab-BXBJmeSc.js +3 -0
- package/dist/assets/{AnomaliesTab-QCxh3MK3.js → AnomaliesTab-CofoaMkF.js} +1 -1
- package/dist/assets/{AuditTab-ZSJKAmT-.js → AuditTab-XWQHKIp_.js} +1 -1
- package/dist/assets/BridgeTab-BUFvmr2d.js +1 -0
- package/dist/assets/ChatDefaultsTab-Dmd6QOKm.js +1 -0
- package/dist/assets/{DataTableShell-BUYroEsA.js → DataTableShell-BYSvf6VZ.js} +1 -1
- package/dist/assets/DeletedChatsTab-C_hfpRhG.js +1 -0
- package/dist/assets/{DetailChips-Zknkp3Iu.js → DetailChips-DUlvwews.js} +1 -1
- package/dist/assets/{FeedbacksTab-DVZNIYyH.js → FeedbacksTab-DXelU8Ru.js} +1 -1
- package/dist/assets/{FieldLabel-BP6EBGVI.js → FieldLabel-CcWGFs5F.js} +1 -1
- package/dist/assets/FilesTab-DkcqLbSs.js +1 -0
- package/dist/assets/{FilterBar-BrdWP0oO.js → FilterBar-BgVXfm-6.js} +1 -1
- package/dist/assets/{GroupsTab-Bq7pFctp.js → GroupsTab-I7HSSXyG.js} +1 -1
- package/dist/assets/InstancesTab-CQwASkfp.js +1 -0
- package/dist/assets/IntegrationsTab-C2ZW4PH-.js +1 -0
- package/dist/assets/{KpiTab-CgNFLZ4K.js → KpiTab-LgHgVxRb.js} +1 -1
- package/dist/assets/PreferencesTab-BH7-p_lT.js +1 -0
- package/dist/assets/ProjectPage-Bl8fhfx1.js +1 -0
- package/dist/assets/PromptInjectionsTab-BIURoP_R.js +4 -0
- package/dist/assets/{RolesTab-yEfSrKGO.js → RolesTab-Baw2YHq3.js} +1 -1
- package/dist/assets/ScheduledTab-DORhocyn.js +1 -0
- package/dist/assets/ServiceAccountsTab-UmjjOrwp.js +1 -0
- package/dist/assets/{SubAgentReportsTab-CBEyyvZD.js → SubAgentReportsTab-cm_UrpNl.js} +1 -1
- package/dist/assets/ThemeShowroom-CFTzDqq9.js +1 -0
- package/dist/assets/{TimeRangePicker-BcvPW9JK.js → TimeRangePicker-CSLm7VwE.js} +1 -1
- package/dist/assets/{TimezoneCombobox-Djj8VaFK.js → TimezoneCombobox-ObUCuHhu.js} +1 -1
- package/dist/assets/TracesTab-BhR-6Ixe.js +1 -0
- package/dist/assets/{TrashTab-NsT89bEO.js → TrashTab-BZUmrLBK.js} +1 -1
- package/dist/assets/{UsersTab-Dyf8X1a7.js → UsersTab-Cxo_mjSa.js} +1 -1
- package/dist/assets/VoiceTab-BP_6mdHw.js +1 -0
- package/dist/assets/api--rqKQo-l.js +44 -0
- package/dist/assets/{button-BbEZKLza.js → button-HksxbiUF.js} +1 -1
- package/dist/assets/{card-Du7JykLJ.js → card-BS-Ukkxw.js} +1 -1
- package/dist/assets/chevrons-up-down-4c0Fo5uU.js +1 -0
- package/dist/assets/{compatView-BDU79WFh.js → compatView-BmFG4Q3R.js} +1 -1
- package/dist/assets/{dispatchErrorInfo-CoXI4U8X.js → dispatchErrorInfo-CW3gRHkP.js} +1 -1
- package/dist/assets/{dist-DkeZNw3H.js → dist-BDjijy9l.js} +1 -1
- package/dist/assets/{dist-l5bFdBkH.js → dist-DjxjpzgS.js} +1 -1
- package/dist/assets/{dist-DuDAYkx5.js → dist-e05Gnyj5.js} +1 -1
- package/dist/assets/{dist-Bfmsr8JO.js → dist-lcVkVTM0.js} +1 -1
- package/dist/assets/{highlighted-body-OFNGDK62-B8sH7UMy.js → highlighted-body-OFNGDK62-DAKnlLPW.js} +1 -1
- package/dist/assets/index-l7elBM2O.js +447 -0
- package/dist/assets/{list-Bhy47ogH.js → list-DnhyuzZ4.js} +1 -1
- package/dist/assets/mermaid-GHXKKRXX-CvLURkTf.js +1 -0
- package/dist/assets/{pdf-Dxeqzi2x.js → pdf-CgxfnVev.js} +1 -1
- package/dist/assets/roleDescriptions-Csn1bSUI.js +1 -0
- package/dist/assets/{table-BrECCZpB.js → table-CwhkOFwK.js} +1 -1
- package/dist/assets/{trashPage-svjv-CK6.js → trashPage-DgXB4jOM.js} +1 -1
- package/dist/assets/{use_paginated_query-C842MAhU.js → use_paginated_query-BKOSBoa7.js} +1 -1
- package/dist/assets/x-C5eyKPkE.js +1 -0
- package/dist/index.html +8 -8
- package/package.json +1 -1
- package/dist/assets/AgentFilesTab-DHL8Lt63.js +0 -3
- package/dist/assets/BridgeTab-BJEkCzek.js +0 -1
- package/dist/assets/ChatDefaultsTab-CMbP2VpD.js +0 -1
- package/dist/assets/DeletedChatsTab-DP3F_9Es.js +0 -1
- package/dist/assets/FilesTab-COkrJcj5.js +0 -1
- package/dist/assets/InstancesTab-DMYsJ9Eh.js +0 -1
- package/dist/assets/IntegrationsTab-BTLLarPk.js +0 -1
- package/dist/assets/PreferencesTab-BnBhz2n4.js +0 -1
- package/dist/assets/ProjectPage-CUsvZaGD.js +0 -1
- package/dist/assets/PromptInjectionsTab-B5AV0diL.js +0 -4
- package/dist/assets/ScheduledTab-Bfsl1JLw.js +0 -1
- package/dist/assets/ServiceAccountsTab-c3kMpEBz.js +0 -1
- package/dist/assets/ThemeShowroom-D_KOxmeA.js +0 -1
- package/dist/assets/TracesTab-BBUTNwmq.js +0 -1
- package/dist/assets/VoiceTab-CakW8mBV.js +0 -1
- package/dist/assets/api-Ca1H8N44.js +0 -44
- package/dist/assets/chevrons-up-down-DCwhEy5H.js +0 -1
- package/dist/assets/index-Wii4FZxb.js +0 -447
- package/dist/assets/mermaid-GHXKKRXX-qTTPfzhk.js +0 -1
- package/dist/assets/roleDescriptions-DUp1v5cq.js +0 -1
- package/dist/assets/x-BvlIg0Y4.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Ax as r,Dx as i,Ex as a,Fx as o,
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Ax as r,Dx as i,Ex as a,Fx as o,Ix as s,Lx as c,Mx as l,NX as u,Nx as d,Ox as f,Px as p,Rx as m,Tx as h,UX as g,jx as _,kx as v,t as y,zx as b}from"./api--rqKQo-l.js";import{Jt as x,St as S,bt as C,vt as w,xt as T,yt as E}from"./index-l7elBM2O.js";var D=t(e(),1);function O(e){return e===`user`?v():e===`all`?f():i({group:e.group})}function k(e){return e===`common`?a():e===`owner`?h():i({group:e.group})}var A=n();function j(e){return e.name||e.email||e.userId.slice(0,8)}function M(){let e=g(y.admin.listUsers,{}),[t,n]=(0,D.useState)(``),i=g(y.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)(w,{value:t,onValueChange:n,children:[(0,A.jsx)(T,{size:`sm`,"aria-label":m(),children:(0,A.jsx)(S,{placeholder:m()})}),(0,A.jsx)(E,{children:(e??[]).map(e=>(0,A.jsx)(C,{value:e.userId,children:j(e)},e._id))})]}),t===``?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:c()}):i===void 0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:u()}):(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:s()}),(0,A.jsxs)(`div`,{className:`oc-introspect__id`,children:[(0,A.jsx)(`strong`,{children:i.user.label}),(0,A.jsx)(x,{variant:`secondary`,children:i.role})]})]}),(0,A.jsxs)(`section`,{className:`oc-introspect__section`,children:[(0,A.jsx)(`h3`,{className:`oc-introspect__title`,children:o()}),i.groups.length===0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:_()}):(0,A.jsx)(`div`,{className:`oc-introspect__chips`,children:i.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:p()}),i.agents.length===0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:_()}):(0,A.jsx)(`ul`,{className:`oc-introspect__list`,children:i.agents.map(e=>(0,A.jsxs)(`li`,{className:`oc-introspect__row`,children:[(0,A.jsx)(`span`,{className:`oc-introspect__name`,children:e.displayName||e.agentId}),e.isDefault?(0,A.jsx)(x,{variant:`default`,children:r()}):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:d()}),i.charts.length===0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:_()}):(0,A.jsx)(`ul`,{className:`oc-introspect__list`,children:i.charts.map(e=>(0,A.jsxs)(`li`,{className:`oc-introspect__row`,children:[(0,A.jsx)(`span`,{className:`oc-introspect__name`,children:e.name}),(0,A.jsx)(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()}),i.permissions.length===0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:_()}):(0,A.jsx)(`div`,{className:`oc-introspect__chips`,children:i.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{aw as r,cw as i,iw as a,lw as o,ow as s,sw as c,uw as l}from"./api-
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{aw as r,cw as i,iw as a,lw as o,ow as s,sw as c,uw as l}from"./api--rqKQo-l.js";import{r as u}from"./dist-lcVkVTM0.js";import{t as d}from"./x-C5eyKPkE.js";import{t as f}from"./button-HksxbiUF.js";import{$t as p,Ln as m,St as h,bt as g,vt as _,xt as v,yt as y}from"./index-l7elBM2O.js";import{r as b}from"./TimeRangePicker-CSLm7VwE.js";var x=t(e(),1),S=n(),C=[{value:`eq`,label:`=`},{value:`neq`,label:`≠`},{value:`contains`,label:l()},{value:`gt`,label:`>`},{value:`gte`,label:`≥`},{value:`lt`,label:`<`},{value:`lte`,label:`≤`}],w=1;function T(){return{id:w++,field:``,op:`eq`,value:``}}function E(e){return e.map(e=>({id:w++,field:e.field,op:e.op,value:String(e.value)}))}function D({fields:e,seed:t,onChange:n}){let l=(0,x.useRef)(t),w=!!(l.current&&l.current.length>0),[D,O]=(0,x.useState)(w),[k,A]=(0,x.useState)(()=>w?E(l.current):[]);function j(e){n(e.filter(e=>e.field!==``&&e.value!==``).map(e=>({field:e.field,op:e.op,value:b(e.value)})))}function M(e,t){let n=k.map(n=>n.id===e?{...n,...t}:n);A(n),j(n)}function N(){A(e=>[...e,T()])}function P(e){let t=k.filter(t=>t.id!==e);A(t),j(t)}let F=k.filter(e=>e.field!==``&&e.value!==``).length;return(0,S.jsxs)(`div`,{className:`oc-advfilter`,children:[(0,S.jsxs)(`button`,{type:`button`,className:`oc-advfilter__toggle`,"aria-expanded":D,onClick:()=>O(e=>!e),children:[(0,S.jsx)(u,{className:`oc-advfilter__chevron`+(D?` is-open`:``),"aria-hidden":!0}),o(),F>0?(0,S.jsx)(`span`,{className:`oc-advfilter__count`,children:F}):null]}),D?(0,S.jsxs)(`div`,{className:`oc-advfilter__body`,children:[k.length===0?(0,S.jsx)(`p`,{className:`oc-admin__hint`,children:i()}):(0,S.jsx)(`ul`,{className:`oc-advfilter__rows`,children:k.map(t=>(0,S.jsxs)(`li`,{className:`oc-advfilter__row`,children:[(0,S.jsxs)(_,{value:t.field||void 0,onValueChange:e=>M(t.id,{field:e}),children:[(0,S.jsx)(v,{size:`sm`,className:`w-40`,children:(0,S.jsx)(h,{placeholder:c()})}),(0,S.jsx)(y,{children:e.map(e=>(0,S.jsx)(g,{value:e.value,children:e.label},e.value))})]}),(0,S.jsxs)(_,{value:t.op,onValueChange:e=>M(t.id,{op:e}),children:[(0,S.jsx)(v,{size:`sm`,className:`w-28`,children:(0,S.jsx)(h,{})}),(0,S.jsx)(y,{children:C.map(e=>(0,S.jsx)(g,{value:e.value,children:e.label},e.value))})]}),(0,S.jsx)(p,{className:`oc-advfilter__value`,value:t.value,onChange:e=>M(t.id,{value:e.target.value}),placeholder:s()}),(0,S.jsx)(f,{variant:`ghost`,size:`icon-sm`,"aria-label":r(),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,{}),a()]})]}):null]})}export{D as t};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$_ as r,Af as i,BX as a,B_ as o,Bf as s,Df as c,Ef as l,FX as u,F_ as d,Ff as f,G_ as p,Gf as m,HX as h,H_ as g,Hf as _,I_ as v,If as y,J_ as b,Jv as ee,K_ as x,L_ as S,Lf as C,Mf as w,NX as T,Nf as E,Of as D,Pf as O,Q_ as k,R_ as A,Rf as j,Tf as M,UX as N,U_ as te,Uf as P,V_ as F,Vf as I,WV as L,W_ as R,Wf as z,X_ as ne,Xv as B,Y_ as V,Z_ as re,af as ie,av as H,cf as ae,cv as U,ev as W,if as oe,iv as se,jf as ce,kf as le,ks as ue,lf as de,lv as fe,nv as pe,of as me,ov as he,q_ as ge,rf as _e,rv as ve,sf as ye,sv as be,t as G,tv as xe,uv as Se,z_ as Ce,zf as we}from"./api--rqKQo-l.js";import{t as K}from"./button-HksxbiUF.js";import{Bt as Te,Ct as Ee,Dt as De,Gt as Oe,Ht as ke,Jt as Ae,Kt as je,Ot as Me,St as Ne,Tt as Pe,Ut as Fe,Vt as Ie,Wt as Le,Yt as q,bt as Re,ft as ze,kn as J,nt as Be,qt as Ve,vt as He,wt as Ue,xt as We,yt as Ge}from"./index-l7elBM2O.js";import{n as Ke,t as qe}from"./curation-CQksaIbm.js";import{a as Je}from"./compatView-BmFG4Q3R.js";/* empty css */var Y=t(e(),1),X=2e4,Ye=6e4;function Xe(e){return typeof e!=`number`||e<=0?0:Math.round(e/X*100)}function Ze(e){return e<=0?0:Math.round(e/Ye*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 Qe(e){return e.reduce((e,t)=>e+(typeof t.size==`number`&&t.size>0?t.size:0),0)}var $e=3;function et(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<$e&&a.push(e)):t>0&&(i+=t,o.length<$e&&o.push(e));return{added:r,removed:i,sampleAdded:a,sampleRemoved:o}}function tt(e){return(e instanceof Error?e.message:String(e)).includes(`DASHBOARD_NOT_DEPLOYED`)}function nt(e){return e instanceof Error?e.message.includes(`conflict:`):String(e).includes(`conflict:`)}var Q=n(),$=e=>`${e.instanceName}::${e.agentId}`;function rt(){let e=N(G.me.getMe,{host:ze}),t=e?.role===`admin`,n=(e?.permissions??[]).includes(`bridge.read`),i=N(G.admin.listInstances,e!==void 0&&t?{}:`skip`),[o,c]=(0,Y.useState)(null);(0,Y.useEffect)(()=>{!t||!i||i.length===0||(!o||!i.some(e=>e.name===o))&&c(i[0].name)},[t,i,o]);let l=N(G.agents.listAgentsForInstance,t&&o?{instanceName:o}:`skip`),d=N(G.agents.listMyAgents,e!==void 0&&!t?{}:`skip`),f=(0,Y.useMemo)(()=>{if(e!==void 0){if(t)return o===null||l===void 0?i!==void 0&&i.length===0?[]:void 0:l.agents.map(e=>({instanceName:o,agentId:e.agentId,label:`${e.emoji?`${e.emoji} `:``}${e.displayName??e.agentId}`}));if(d!==void 0)return d.map(e=>({instanceName:e.instanceName,agentId:e.agentId,label:`${e.emoji?`${e.emoji} `:``}${e.displayName??e.agentId}`}))}},[e,t,o,l,i,d]),[p,m]=(0,Y.useState)(null);(0,Y.useEffect)(()=>{!f||f.length===0||(!p||!f.some(e=>$(e)===p))&&m($(f[0]))},[f,p]);let h=f?.find(e=>$(e)===p)??null,g=a(G.agentFiles.listAgentFiles),[v,y]=(0,Y.useState)({status:`idle`}),b=h?.instanceName??null,x=h?.agentId??null,S=N(G.compat.forInstance,n&&b!==null?{instanceName:b}:`skip`),C=n&&b!==null?Be(S,`agentFiles`):null,w=C===null?!1:C===`loading`?null:C.blocked,E=(0,Y.useCallback)(async()=>{if(!(b===null||x===null)){y({status:`loading`});try{y({status:`done`,files:(await g({instanceName:b,agentId:x})).files})}catch(e){y({status:`error`,dashboardAbsent:tt(e)})}}},[g,b,x]);(0,Y.useEffect)(()=>{w===!1&&E()},[E,w]);let[D,O]=(0,Y.useState)(null),A=N(G.agentFileCuration.listCurations,t&&b!==null&&x!==null?{instanceName:b,agentId:x}:`skip`),j=N(G.agentFileCuration.curationSettings,t&&b!==null?{instanceName:b}:`skip`),M=a(G.agentFileCuration.requestCuration),[te,P]=(0,Y.useState)(null),[F,L]=(0,Y.useState)(null),{toast:R}=q(),z=(0,Y.useMemo)(()=>{let e=new Map;for(let t of A??[])e.has(t.name)||e.set(t.name,t);return e},[A]),ne=(0,Y.useCallback)(async e=>{if(!(b===null||x===null)){P(e);try{let t=await M({instanceName:b,agentId:x,name:e,trigger:`manual`});t.ok?R({title:_(),variant:`success`}):R({title:I({reason:t.reason??`unknown`}),variant:`error`})}catch{R({title:s(),variant:`error`})}finally{P(null)}}},[M,b,x,R]),B=u(),V=(0,Y.useMemo)(()=>new Intl.NumberFormat(B,{maximumFractionDigits:0}),[B]);return e===void 0||f===void 0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:T()}):(0,Q.jsxs)(`div`,{className:`oc-afiles`,children:[(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:Se()}),(0,Q.jsxs)(`div`,{className:`oc-afiles__picker`,children:[t&&(i?.length??0)>1?(0,Q.jsxs)(He,{value:o??``,onValueChange:e=>c(e),children:[(0,Q.jsx)(We,{size:`sm`,"aria-label":fe(),children:(0,Q.jsx)(Ne,{})}),(0,Q.jsx)(Ge,{children:(i??[]).map(e=>(0,Q.jsx)(Re,{value:e.name,children:e.name},e.name))})]}):null,f.length>0?(0,Q.jsxs)(He,{value:p??``,onValueChange:e=>m(e),children:[(0,Q.jsx)(We,{size:`sm`,"aria-label":U(),children:(0,Q.jsx)(Ne,{})}),(0,Q.jsx)(Ge,{children:f.map(e=>(0,Q.jsx)(Re,{value:$(e),children:e.label},$(e)))})]}):(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:be()})]}),h===null?null:C===`loading`?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:T()}):C!==null&&C.blocked?(0,Q.jsxs)(`p`,{className:`oc-compat__blocked`,role:`status`,children:[(0,Q.jsx)(J,{size:14,"aria-hidden":!0}),` `,Je(C.gatewayVersion,C.provider)]}):v.status===`loading`||v.status===`idle`?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:T()}):v.status===`error`?(0,Q.jsxs)(`p`,{className:`oc-afiles__error`,role:`alert`,children:[v.dashboardAbsent?ue():H(),` `,!v.dashboardAbsent&&(0,Q.jsx)(K,{variant:`outline`,size:`sm`,onClick:()=>void E(),children:ee()})]}):v.files.length===0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:he()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`div`,{className:`oc-afiles__list`,children:v.files.map(e=>{let n=Xe(e.size),i=n>=80;return(0,Q.jsxs)(`div`,{className:`oc-afiles__row`,children:[(0,Q.jsx)(`span`,{className:`oc-afiles__name`,title:e.name,children:e.name}),e.missing?(0,Q.jsx)(Ae,{variant:`outline`,children:se()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`span`,{className:`oc-afiles__size`,children:ve({size:Z(e.size,B)})}),(0,Q.jsx)(`span`,{className:`oc-afiles__gauge${i?` is-warn`:``}`,"aria-hidden":!0,children:(0,Q.jsx)(`span`,{className:`oc-afiles__gauge-fill`,style:{width:`${Math.min(n,100)}%`}})}),(0,Q.jsx)(`span`,{className:`oc-afiles__pct`,children:pe({pct:V.format(n)})}),i?(0,Q.jsx)(J,{size:14,className:`oc-afiles__warn`,"aria-label":xe()}):(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:()=>O(e),children:t?r():k()}),t&&!e.missing?(0,Q.jsx)(it,{curatable:qe.includes(e.name),size:e.size??0,budget:j?.budgetChars??null,enabled:j?.enabled??!1,curation:z.get(e.name)??null,inFlight:te===e.name,onCurate:()=>void ne(e.name),onReview:e=>L(e)}):null]},e.name)})}),(0,Q.jsx)(`p`,{className:`oc-afiles__budget`,children:W({used:Z(Qe(v.files),B),total:Z(Ye,B),pct:V.format(Ze(Qe(v.files)))})})]}),D&&h?(0,Q.jsx)(at,{instanceName:h.instanceName,agentId:h.agentId,name:D.name,isAdmin:t,onClose:()=>O(null),onSaved:()=>void E()}):null,F?(0,Q.jsx)(ot,{curationId:F,onClose:()=>L(null),onApplied:()=>{L(null),E()}}):null]})}function it({curatable:e,size:t,budget:n,enabled:r,curation:i,inFlight:a,onCurate:o,onReview:s}){return i?.status===`proposed`?(0,Q.jsx)(K,{variant:`default`,size:`sm`,className:`oc-afiles__curate`,onClick:()=>s(i._id),children:z()}):a||i?.status===`dispatched`||i?.status===`applying`?(0,Q.jsx)(Ae,{variant:`outline`,className:`oc-afiles__curate-status`,children:P()}):e&&r&&n!==null&&Ke(t,n)?(0,Q.jsx)(K,{variant:`outline`,size:`sm`,className:`oc-afiles__curate`,onClick:o,children:m()}):null}function at({instanceName:e,agentId:t,name:n,isAdmin:r,onClose:i,onSaved:s}){let c=a(G.agentFiles.getAgentFile),l=a(G.agentFiles.setAgentFile),f=q(),[m,h]=(0,Y.useState)(null),[_,y]=(0,Y.useState)(!1),[C,w]=(0,Y.useState)(``),[E,D]=(0,Y.useState)(!1),[O,k]=(0,Y.useState)(!1),[j,M]=(0,Y.useState)(!1),[N,P]=(0,Y.useState)(!1),I=(0,Y.useCallback)(async r=>{y(!1);try{let i=await c({instanceName:e,agentId:t,name:n});h({content:i.content,updatedAtMs:i.updatedAtMs}),r||w(i.content),M(!1)}catch{y(!0)}},[c,e,t,n]);(0,Y.useEffect)(()=>{I(!1)},[I]);async function z(){if(m!==null){k(!0),P(!1);try{await l({instanceName:e,agentId:t,name:n,content:C,baseUpdatedAtMs:m.updatedAtMs??void 0}),f.success(p({name:n})),s(),await I(!1)}catch(e){nt(e)?M(!0):P(!0)}finally{k(!1)}}}let ie=m!==null&&C!==m.content,H=(0,Y.useMemo)(()=>m===null?null:et(m.content,C),[m,C]),ae=C.length>X,U=u(),W=(0,Y.useMemo)(()=>new Intl.NumberFormat(U),[U]);return(0,Q.jsx)(Ee,{open:!0,onOpenChange:e=>!e&&i(),children:(0,Q.jsxs)(Ue,{className:`oc-afiles__editor`,children:[(0,Q.jsxs)(De,{children:[(0,Q.jsx)(Me,{children:re({name:n})}),(0,Q.jsxs)(Pe,{children:[ne({agent:t,instance:e}),r?null:(0,Q.jsxs)(Q.Fragment,{children:[` · `,V()]})]})]}),_?(0,Q.jsxs)(`p`,{className:`oc-afiles__error`,role:`alert`,children:[te(),` `,(0,Q.jsx)(K,{variant:`outline`,size:`sm`,onClick:()=>void I(!1),children:ee()})]}):m===null?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:T()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`textarea`,{className:`oc-afiles__source`,value:C,readOnly:!r,spellCheck:!1,onChange:e=>w(e.target.value),"aria-label":re({name:n})}),(0,Q.jsx)(`p`,{className:`oc-afiles__hint`,children:b()}),j?(0,Q.jsxs)(`p`,{className:`oc-afiles__error`,role:`alert`,children:[g(),` `,(0,Q.jsx)(K,{variant:`outline`,size:`sm`,onClick:()=>void I(!0),children:F()})]}):null,N?(0,Q.jsx)(`p`,{className:`oc-afiles__error`,role:`alert`,children:R()}):null,(0,Q.jsxs)(`div`,{className:`oc-afiles__editor-foot`,children:[(0,Q.jsx)(`span`,{className:`oc-afiles__count${ae?` is-over`:``}`,children:ge({count:W.format(C.length),max:W.format(X)})}),r?(0,Q.jsx)(K,{size:`sm`,disabled:!ie||O||j,onClick:()=>D(!0),children:O?B():x()}):null]})]}),(0,Q.jsx)(Te,{open:E,onOpenChange:D,children:(0,Q.jsxs)(Fe,{children:[(0,Q.jsxs)(je,{children:[(0,Q.jsx)(Ve,{children:o({name:n})}),(0,Q.jsx)(Le,{children:Ce({agent:t})})]}),H?(0,Q.jsxs)(`div`,{className:`oc-afiles__diff`,children:[(0,Q.jsx)(`p`,{className:`oc-afiles__diff-counts`,children:A({added:H.added,removed:H.removed})}),H.sampleAdded.length>0?(0,Q.jsxs)(`div`,{className:`oc-afiles__diff-block`,children:[(0,Q.jsx)(`span`,{className:`oc-afiles__diff-label`,children:S()}),H.sampleAdded.map((e,t)=>(0,Q.jsx)(`code`,{className:`oc-afiles__diff-line is-add`,children:e||` `},t))]}):null,H.sampleRemoved.length>0?(0,Q.jsxs)(`div`,{className:`oc-afiles__diff-block`,children:[(0,Q.jsx)(`span`,{className:`oc-afiles__diff-label`,children:v()}),H.sampleRemoved.map((e,t)=>(0,Q.jsx)(`code`,{className:`oc-afiles__diff-line is-del`,children:e||` `},t))]}):null]}):null,(0,Q.jsxs)(Oe,{children:[(0,Q.jsx)(ke,{children:L()}),(0,Q.jsx)(Ie,{onClick:()=>void z(),children:d()})]})]})})]})})}function ot({curationId:e,onClose:t,onApplied:n}){let r=N(G.agentFileCuration.getProposal,{curationId:e}),o=a(G.agentFileCuration.approveCuration),d=h(G.agentFileCuration.rejectCuration),{toast:p}=q(),[m,g]=(0,Y.useState)(null),[_,v]=(0,Y.useState)(!1),[b,ee]=(0,Y.useState)(``),x=u(),S=(0,Y.useMemo)(()=>r?et(r.beforeContent,r.proposedContent):null,[r]);async function k(){g(`approve`);try{let t=await o({curationId:e});t.ok?(p({title:we(),variant:`success`}),n()):p({title:t.reason===`conflict`?C():y({reason:t.reason??`unknown`}),variant:`error`})}catch{p({title:s(),variant:`error`})}finally{g(null)}}async function A(n){g(`reject`);try{let r=b.trim();(await d({curationId:e,...r?{comment:r}:{},relaunch:n})).ok?p({title:n?oe():j(),variant:`success`}):p({title:E(),variant:`error`}),t()}catch{p({title:s(),variant:`error`})}finally{g(null)}}return(0,Q.jsx)(Ee,{open:!0,onOpenChange:e=>e?void 0:t(),children:(0,Q.jsxs)(Ue,{className:`oc-afiles__review`,children:[(0,Q.jsxs)(De,{children:[(0,Q.jsx)(Me,{children:r?f({name:r.name}):T()}),(0,Q.jsx)(Pe,{children:O()})]}),r===void 0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:T()}):r===null?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:E()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`p`,{className:`oc-afiles__review-sizes`,children:[w({before:Z(r.beforeSize,x),after:Z(r.proposedSize,x)}),r.overBudget?(0,Q.jsxs)(Q.Fragment,{children:[` `,(0,Q.jsx)(J,{size:13,"aria-hidden":!0}),` `,ce()]}):null]}),S?(0,Q.jsx)(`p`,{className:`oc-afiles__review-diff`,children:i({added:S.added,removed:S.removed})}):null,r.feedback?(0,Q.jsx)(`p`,{className:`oc-afiles__review-feedback`,children:_e({feedback:r.feedback})}):null,S&&S.sampleRemoved.length>0?(0,Q.jsxs)(`div`,{className:`oc-afiles__review-removed`,children:[(0,Q.jsx)(`p`,{className:`oc-afiles__review-label`,children:M()}),(0,Q.jsx)(`ul`,{children:S.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:l()}),(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:le()}),(0,Q.jsx)(`pre`,{className:`oc-afiles__review-pre`,children:r.proposedContent})]})]})]}),_?(0,Q.jsxs)(`div`,{className:`oc-afiles__reject-form`,children:[(0,Q.jsx)(`label`,{className:`oc-afiles__review-label`,htmlFor:`curation-reject-comment`,children:de()}),(0,Q.jsx)(`textarea`,{id:`curation-reject-comment`,className:`oc-afiles__reject-textarea`,rows:3,placeholder:ae(),value:b,onChange:e=>ee(e.target.value)}),(0,Q.jsxs)(`div`,{className:`oc-afiles__review-actions`,children:[(0,Q.jsx)(K,{variant:`ghost`,onClick:()=>v(!1),disabled:m!==null,children:ye()}),(0,Q.jsx)(K,{variant:`outline`,onClick:()=>void A(!1),disabled:m!==null,children:m===`reject`?B():me()}),(0,Q.jsx)(K,{variant:`default`,onClick:()=>void A(!0),disabled:m!==null,children:m===`reject`?B():ie()})]})]}):(0,Q.jsxs)(`div`,{className:`oc-afiles__review-actions`,children:[(0,Q.jsx)(K,{variant:`outline`,onClick:()=>v(!0),disabled:m!==null||r==null,children:D()}),(0,Q.jsx)(K,{variant:`default`,onClick:()=>void k(),disabled:m!==null||r==null,children:m===`approve`?B():c()})]})]})})}export{rt as AgentFilesTab};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$M as r,AM as i,BM as a,DM as o,EM as s,FM as c,GM as l,HM as u,HX as
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$M as r,AM as i,BM as a,DM as o,EM as s,FM as c,GM as l,HM as u,HX as ee,IM as te,JM as ne,KM as re,LM as ie,MM as d,NM as f,OM as p,PM as m,QM as h,RM as ae,UM as oe,UX as g,VM as se,WM as ce,XM as le,YM as ue,ZM as de,_N as fe,aN as pe,bN as _,cN as me,dN as he,eN as ge,fN as _e,gN as ve,hN as ye,iN as be,jM as v,kM as y,lN as xe,mN as Se,nN as Ce,oN as b,pN as x,qM as S,rN as C,sN as w,t as T,tN as E,uN as D,vN as O,xN as k,yN as A,zM as we}from"./api--rqKQo-l.js";import{At as j,Ct as M,Dt as N,Jt as P,Ot as F,St as I,Yt as Te,bt as L,ct as Ee,dr as R,fr as De,ft as Oe,i as ke,o as Ae,vt as z,wt as B,xt as V,yt as H}from"./index-l7elBM2O.js";import{n as je}from"./TimeRangePicker-CSLm7VwE.js";import{t as Me}from"./FilterBar-BgVXfm-6.js";import{t as Ne}from"./DataTableShell-BYSvf6VZ.js";import{t as U}from"./dispatchErrorInfo-CW3gRHkP.js";var W=t(e(),1),G=new Set([`openclaw.dispatch_failures`,`assistant.announce_errors`]),K=new Set([`assistant.cause.provider_auth_revoked`,`assistant.cause.provider_permission_denied`,`assistant.cause.provider_auth_failed`]);function q(e){let t=K.has(e.kind);if(!G.has(e.kind)&&!t||!e.evidence)return{};try{let n=JSON.parse(e.evidence);if(t){let e=Array.isArray(n.agents)?n.agents.filter(e=>typeof e==`string`):[],t=Array.isArray(n.providers)?n.providers.filter(e=>typeof e==`string`):[],r=e.length===1?e[0]:void 0;return{dominantCode:n.cause,sampleCorrelationId:n.sampleCorrelationId,context:{...r===void 0?{}:{agentId:r.slice(r.lastIndexOf(`/`)+1)},...t.length===1?{provider:t[0]}:{}}}}return{dominantCode:n.dominantCode,sampleCorrelationId:n.sampleCorrelationId}}catch{return{}}}var J=n(),Y=`__all__`,Pe=[{value:`open`},{value:`acknowledged`},{value:`resolved`}];function Fe(e){return e===`open`?k():e===`acknowledged`?_():A()}var Ie=[`info`,`warn`,`critical`],Le=[`detector`,`agent`,`user`],X={kind:`relative`,from:`now-30d`,to:`now`},Re=200,Z=`all`;function Q(){let e=De({from:`/settings/anomalies`}),t=R({from:`/settings/anomalies`}),n=e.q??``,i=e.status===Z?Y:e.status,o=e.severity??Y,s=e.kind??Y,[d,f]=(0,W.useState)(Y),p=ke(e.from,e.to),{from:_,to:v}=je(p),y=e=>void t({search:t=>({...t,q:e||void 0}),replace:!0}),k=e=>void t({search:t=>({...t,status:e===Y?Z:e})}),A=e=>void t({search:t=>({...t,severity:e===Y?void 0:e})}),M=e=>void t({search:t=>({...t,kind:e===Y?void 0:e})}),N=e=>void t({search:t=>({...t,...Ae(e)})}),F=Ee(),B=Te(),U=ee(T.anomalies.resolveAnomaly),G=(g(T.me.getMe,{host:Oe})?.permissions??[]).includes(`admin.manage`),K=g(T.anomalies.listAnomalies,{limit:Re,filter:{q:n||void 0,from:_,to:v,anomalyStatus:i===Y?void 0:i,severity:o===Y?void 0:o,source:d===Y?void 0:d,kind:s===Y?void 0:s}}),q=(0,W.useMemo)(()=>{let e=new Set;for(let t of K??[])e.add(t.kind);return[...e].sort()},[K]),Q=n!==``||i!==`open`||o!==Y||d!==Y||s!==Y||p.kind!==`relative`||p.from!==X.from;function $(){f(Y),t({search:{status:`open`},replace:!0})}async function We(e){if(await F({title:O(),description:(0,J.jsxs)(J.Fragment,{children:[fe(),` `,(0,J.jsx)(`span`,{className:`font-mono`,children:e.kind}),` `,ve(),` `,(0,J.jsx)(`strong`,{children:ye()}),`.`,` `,Se()]}),confirmLabel:x()}))try{await U({anomalyId:e._id,status:`resolved`}),B.success(_e(),e.kind)}catch(e){B.error(he(),e)}}async function Ge(e){try{await U({anomalyId:e._id,status:`acknowledged`}),B.success(D(),e.kind)}catch(e){B.error(xe(),e)}}return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(`p`,{className:`oc-admin__hint`,children:[me(),` `,(0,J.jsx)(`strong`,{children:w()}),` `,b(),` `,(0,J.jsx)(`strong`,{children:pe()}),` `,be(),` `,(0,J.jsx)(`strong`,{children:C()}),` `,Ce(),` `,(0,J.jsx)(`span`,{className:`oc-filter__window`,children:E()})]}),(0,J.jsxs)(Me,{q:n,onQChange:y,searchPlaceholder:ge(),timeRange:p,onTimeRangeChange:N,onReset:$,canReset:Q,children:[(0,J.jsxs)(z,{value:i,onValueChange:k,children:[(0,J.jsx)(V,{size:`sm`,className:`w-36`,children:(0,J.jsx)(I,{})}),(0,J.jsxs)(H,{children:[(0,J.jsx)(L,{value:Y,children:r()}),Pe.map(e=>(0,J.jsx)(L,{value:e.value,children:Fe(e.value)},e.value))]})]}),(0,J.jsxs)(z,{value:o,onValueChange:A,children:[(0,J.jsx)(V,{size:`sm`,className:`w-36`,children:(0,J.jsx)(I,{placeholder:h()})}),(0,J.jsxs)(H,{children:[(0,J.jsx)(L,{value:Y,children:ne()}),Ie.map(e=>(0,J.jsx)(L,{value:e,children:e},e))]})]}),(0,J.jsxs)(z,{value:d,onValueChange:f,children:[(0,J.jsx)(V,{size:`sm`,className:`w-32`,children:(0,J.jsx)(I,{placeholder:S()})}),(0,J.jsxs)(H,{children:[(0,J.jsx)(L,{value:Y,children:re()}),Le.map(e=>(0,J.jsx)(L,{value:e,children:e},e))]})]}),(0,J.jsxs)(z,{value:s,onValueChange:M,children:[(0,J.jsx)(V,{size:`sm`,className:`w-36`,children:(0,J.jsx)(I,{placeholder:l()})}),(0,J.jsxs)(H,{children:[(0,J.jsx)(L,{value:Y,children:ce()}),q.map(e=>(0,J.jsx)(L,{value:e,children:e},e))]})]})]}),(0,J.jsx)(Ne,{title:oe(),rows:K,emptyHint:i===`open`?u():se(),rowActions:e=>G&&e.status===`open`?[{label:a(),onSelect:()=>void We(e)},{label:we(),onSelect:()=>void Ge(e)}]:[],columns:[{header:ae(),cell:e=>(0,J.jsx)(`span`,{className:`oc-traces__time`,children:j(e.at)}),sort:e=>e.at},{header:l(),cell:e=>(0,J.jsx)(`code`,{className:`oc-traces__mono`,children:e.kind}),sort:e=>e.kind},{header:de(),cell:e=>e.occurrenceCount!==null&&e.occurrenceCount>1?(0,J.jsx)(`span`,{className:`oc-traces__time`,title:e.firstAt===null?void 0:ue({when:j(e.firstAt)}),children:le({count:String(e.occurrenceCount)})}):(0,J.jsx)(`span`,{className:`oc-traces__time`,children:`—`}),sort:e=>e.occurrenceCount??0},{header:h(),cell:e=>(0,J.jsx)(Ve,{severity:e.severity}),sort:e=>e.severity===`critical`?2:+(e.severity===`warn`)},{header:ie(),cell:e=>(0,J.jsx)(He,{status:e.status}),sort:e=>e.status===`resolved`?2:+(e.status===`acknowledged`)},{header:S(),cell:e=>(0,J.jsx)(P,{variant:`outline`,children:e.source}),sort:e=>e.source},{header:te(),cell:e=>(0,J.jsxs)(`div`,{className:`oc-anomaly__msgcell`,children:[(0,J.jsx)(`span`,{className:`oc-anomaly__msg`,children:e.message}),(0,J.jsx)(Be,{row:e})]}),sort:e=>e.message},{header:c(),cell:e=>(0,J.jsx)(ze,{row:e}),sort:e=>e.evidence??null},{header:m(),cell:e=>e.correlationId?(0,J.jsx)(`code`,{className:`oc-traces__mono`,children:Ue(e.correlationId)}):(0,J.jsx)(`span`,{className:`oc-traces__muted`,children:`—`}),sort:e=>e.correlationId}]})]})}function $(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 ze({row:e}){let t=R();if(e.kind===`subagent.failure`){let n=$(e);return(0,J.jsxs)(`div`,{className:`oc-anomaly__cause`,children:[(0,J.jsx)(`div`,{className:`oc-anomaly__cause-head`,children:[...new Set(n.errorCategories??[])].map(e=>(0,J.jsx)(`code`,{className:`oc-traces__mono`,children:e},e))}),e.correlationId?(0,J.jsxs)(`button`,{type:`button`,className:`oc-anomaly__drill`,onClick:()=>void t({to:`/settings/traces`,search:{q:e.correlationId,limit:100}}),children:[`↗ `,f()]}):null]})}let n=q(e);if(!n.dominantCode){let e=n.sampleCorrelationId;return e?(0,J.jsx)(`div`,{className:`oc-anomaly__cause`,children:(0,J.jsxs)(`button`,{type:`button`,className:`oc-anomaly__drill`,onClick:()=>void t({to:`/settings/traces`,search:{correlationId:e,limit:100}}),children:[`↗ `,f()]})}):(0,J.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})}let r=U(n.dominantCode,n.context),i=n.sampleCorrelationId;return(0,J.jsxs)(`div`,{className:`oc-anomaly__cause`,children:[(0,J.jsxs)(`div`,{className:`oc-anomaly__cause-head`,children:[(0,J.jsx)(`span`,{className:`oc-anomaly__cause-label`,children:r.label}),(0,J.jsx)(`code`,{className:`oc-traces__mono`,children:n.dominantCode})]}),(0,J.jsx)(`p`,{className:`oc-anomaly__cause-hint`,children:r.hint}),i?(0,J.jsxs)(`button`,{type:`button`,className:`oc-anomaly__drill`,onClick:()=>void t({to:`/settings/traces`,search:{correlationId:i,limit:100}}),children:[`↗ `,f()]}):null]})}function Be({row:e}){let[t,n]=(0,W.useState)(!1),r=g(T.anomalies.getAnomalyAttachments,t?{anomalyId:e._id}:`skip`);return!e.attachments||e.attachments.length===0?null:(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(`button`,{type:`button`,className:`oc-anomaly__drill`,onClick:()=>n(!0),children:[d(),e.attachments.length>1?` (${e.attachments.length})`:``]}),(0,J.jsx)(M,{open:t,onOpenChange:n,children:(0,J.jsxs)(B,{className:`oc-anomaly__attachments-dialog`,children:[(0,J.jsx)(N,{children:(0,J.jsx)(F,{children:v()})}),r===void 0?(0,J.jsx)(`p`,{className:`oc-traces__muted`,children:i()}):r.length===0?(0,J.jsx)(`p`,{className:`oc-traces__muted`,children:y()}):(0,J.jsx)(`div`,{className:`oc-anomaly__attachments`,children:r.map(e=>(0,J.jsxs)(`section`,{className:`oc-anomaly__attachment`,children:[(0,J.jsx)(`h4`,{className:`oc-anomaly__attachment-name`,children:(0,J.jsx)(`code`,{className:`oc-traces__mono`,children:e.name})}),(0,J.jsx)(`pre`,{className:`oc-anomaly__attachment-content`,children:e.content})]},e.name))})]})})]})}function Ve({severity:e}){return(0,J.jsx)(`span`,{className:`oc-anomaly__sev oc-anomaly__sev--${e}`,children:e})}function He({status:e}){return e===`open`?(0,J.jsx)(P,{variant:`destructive`,children:p()}):e===`acknowledged`?(0,J.jsx)(P,{variant:`secondary`,children:o()}):(0,J.jsx)(P,{variant:`outline`,children:s()})}function Ue(e){return e.length>8?e.slice(0,8):e}export{Q as AnomaliesTab};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$u as r,CP as i,DP as a,EP as o,
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$u as r,CP as i,DP as a,EP as o,Ju as s,Qu as c,SP as l,TP as u,UX as d,Xu as f,Yu as p,Zu as m,_P as h,bP as g,gP as _,hP as v,mP as y,pP as b,t as x,vP as S,wP as C,xP as w,yP as T}from"./api--rqKQo-l.js";import{At as E,St as D,a as O,bt as k,dr as A,fr as j,i as M,n as N,o as P,s as F,vt as I,xt as L,yt as R}from"./index-l7elBM2O.js";import{n as ee}from"./TimeRangePicker-CSLm7VwE.js";import{t as z}from"./FilterBar-BgVXfm-6.js";import{t as B}from"./AdvancedFilter-BmALfXnB.js";import{t as V}from"./DataTableShell-BYSvf6VZ.js";var H=t(e(),1),U=n(),W={kind:`relative`,from:N,to:`now`},G=`__all__`,K=[{value:`action`,label:r()},{value:`realLabel`,label:c()},{value:`targetLabel`,label:m()},{value:`impersonated`,label:f()},{value:`resource`,label:p()},{value:`resourceId`,label:s()}];function q(){let e=j({from:`/settings/audit`}),t=A({from:`/settings/audit`}),n=e.q??``,r=e.action??G,s=e.impersonated??G,c=e.resource??G,f=M(e.from,e.to),p=(0,H.useMemo)(()=>F(e.adv),[e.adv]),{from:m,to:N}=ee(f),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,...P(e)})}),Q=e=>void t({search:t=>({...t,adv:O(e)}),replace:!0}),$=d(x.admin.listAudit,{filter:{q:n||void 0,from:m,to:N,action:r===G?void 0:r,resource:c===G?void 0:c,impersonated:s===G?void 0:s===`yes`,advanced:p.length>0?p: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||s!==G||c!==G||p.length>0||f.kind!==`relative`||f.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:[a(),` `,(0,U.jsx)(`span`,{className:`oc-filter__window`,children:o()})]}),(0,U.jsxs)(z,{q:n,onQChange:q,searchPlaceholder:u(),timeRange:f,onTimeRangeChange:Z,onReset:ie,canReset:re,children:[(0,U.jsxs)(I,{value:r,onValueChange:J,children:[(0,U.jsx)(L,{size:`sm`,className:`w-40`,children:(0,U.jsx)(D,{placeholder:C()})}),(0,U.jsxs)(R,{children:[(0,U.jsx)(k,{value:G,children:i()}),te.map(e=>(0,U.jsx)(k,{value:e,children:e},e))]})]}),(0,U.jsxs)(I,{value:s,onValueChange:Y,children:[(0,U.jsx)(L,{size:`sm`,className:`w-40`,children:(0,U.jsx)(D,{})}),(0,U.jsxs)(R,{children:[(0,U.jsx)(k,{value:G,children:l()}),(0,U.jsx)(k,{value:`yes`,children:w()}),(0,U.jsx)(k,{value:`no`,children:g()})]})]}),(0,U.jsxs)(I,{value:c,onValueChange:X,children:[(0,U.jsx)(L,{size:`sm`,className:`w-40`,children:(0,U.jsx)(D,{placeholder:T()})}),(0,U.jsxs)(R,{children:[(0,U.jsx)(k,{value:G,children:S()}),ne.map(e=>(0,U.jsx)(k,{value:e,children:e},e))]})]})]}),(0,U.jsx)(B,{fields:K,seed:p,onChange:Q}),(0,U.jsx)(V,{title:h(),rows:$,emptyHint:_(),columns:[{header:v(),cell:e=>E(e.at),sort:e=>e.at},{header:C(),cell:e=>e.action,sort:e=>e.action},{header:y(),cell:e=>e.realLabel,sort:e=>e.realLabel},{header:b(),cell:e=>e.targetLabel??`—`,sort:e=>e.targetLabel??null},{header:T(),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{$O as r,Ak as i,As as a,BX as o,Bk as s,CA as c,C_ as l,Ck as u,Dk as d,E as f,Ek as p,Fk as ee,GO as m,HX as te,Ik as ne,JO as h,KO as g,Lk as re,Mk as ie,Nk as ae,Ok as oe,Pk as se,QO as _,Rk as ce,SA as v,S_ as le,Sk as ue,Su as de,Tk as fe,UO as pe,UX as y,Vk as me,WO as b,XO as he,YO as ge,ZO as _e,_A as ve,__ as ye,_k as be,_u as xe,ak as Se,bA as Ce,b_ as we,bk as Te,ck as Ee,dk as De,ek as Oe,f_ as ke,fk as Ae,gA as je,g_ as Me,gk as Ne,gu as Pe,hA as Fe,h_ as Ie,hk as Le,hu as Re,ik as ze,jk as Be,kk as Ve,lA as He,lk as Ue,mA as We,m_ as Ge,mk as Ke,nk as qe,o_ as Je,ok as Ye,oo as Xe,pA as Ze,p_ as Qe,pk as $e,qO as et,rk as x,sk as tt,t as S,tk as nt,uA as rt,uk as it,vA as at,v_ as ot,vk as st,vu as ct,w_ as lt,wk as ut,x_ as dt,xk as ft,yA as pt,y_ as C,yk as mt,yu as ht,zk as gt}from"./api--rqKQo-l.js";import{r as w}from"./dist-lcVkVTM0.js";import{t as _t}from"./chevrons-up-down-4c0Fo5uU.js";import{i as vt,n as T,o as yt,r as bt,s as xt}from"./FieldLabel-CcWGFs5F.js";import{t as St}from"./button-HksxbiUF.js";import{$t as E,At as D,Ct,Dt as wt,Jn as Tt,Jt as O,L as Et,Mt as Dt,Ot,Pn as k,St as A,Tt as kt,Yt as At,ar as jt,at as Mt,bt as j,cn as Nt,dr as Pt,fr as Ft,ft as It,it as Lt,jt as M,kn as N,on as Rt,or as zt,ot as Bt,sn as Vt,sr as P,st as Ht,vt as F,wt as Ut,xt as I,yt as L}from"./index-l7elBM2O.js";import{r as Wt}from"./locales-CPjguROj.js";import{a as R,i as z,n as B,o as V,r as H,t as U}from"./table-CwhkOFwK.js";import{t as Gt}from"./FilterBar-BgVXfm-6.js";import{c as Kt,i as qt,n as Jt,o as Yt,r as Xt,s as Zt,t as Qt}from"./compatView-BmFG4Q3R.js";import{t as W}from"./dispatchErrorInfo-CW3gRHkP.js";var $t=f(`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`}]]),en=f(`wifi-off`,[[`path`,{d:`M12 20h.01`,key:`zekei9`}],[`path`,{d:`M8.5 16.429a5 5 0 0 1 7 0`,key:`1bycff`}],[`path`,{d:`M5 12.859a10 10 0 0 1 5.17-2.69`,key:`1dl1wf`}],[`path`,{d:`M19 12.859a10 10 0 0 0-2.007-1.523`,key:`4k23kn`}],[`path`,{d:`M2 8.82a15 15 0 0 1 4.177-2.643`,key:`1grhjp`}],[`path`,{d:`M22 8.82a15 15 0 0 0-11.288-3.764`,key:`z3jwby`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}]]),G=t(e(),1);function tn(e){return e.filter(e=>e.state===`error`)}function nn(e){return e.reachable&&tn(e.targets).length===0}function rn(e){return nn(e)?(e.unreachableInstances??[]).length>0?`gateways_unreachable`:`ok`:`error`}function an(e){return e.state===`error`&&e.lastErrorCode!==null}function K(e){return!!e.lastDownstreamRejectCode}function on(e){return!!e.lastLocalRefusalCode}function sn(e){return an(e)||K(e)||on(e)}function q(e){return e.kind??`openclaw`}function cn(e){return[...e].sort((e,t)=>e===`openclaw`?-1:t===`openclaw`?1:e.localeCompare(t))}function ln(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 cn(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 J(e){return e===`openclaw`?`OpenClaw`:e===`hermes`?`Hermes`:e.charAt(0).toUpperCase()+e.slice(1)}var Y=`__all__`,un={q:``,state:Y,instance:Y,version:Y},X={connected:0,error:1,idle:2};function dn(e){return e.q.trim()!==``||e.state!==`__all__`||e.instance!==`__all__`||e.version!==`__all__`}function fn(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 Z(e,t){return e.localeCompare(t,void 0,{numeric:!0,sensitivity:`base`})}function pn(e,t){return e===`version`?t.gatewayVersion===null:e===`lastOk`?t.lastOkAt===null:!1}function mn(e,t,n){switch(e){case`state`:return(X[t.state]??99)-(X[n.state]??99);case`instance`:return Z(t.instanceLabel??t.instanceName??``,n.instanceLabel??n.instanceName??``);case`host`:return Z(t.gatewayHost,n.gatewayHost);case`version`:{let e=t.gatewayVersion,r=n.gatewayVersion;return Zt(e,r)??Z(e,r)}case`lastOk`:return t.lastOkAt-n.lastOkAt;default:return Z(t.targetLabel,n.targetLabel)}}function hn(e,t){if(!t)return e;let n=t.dir===`asc`?1:-1;return[...e].sort((e,r)=>{let i=pn(t.key,e),a=pn(t.key,r);return i&&a?0:i?1:a?-1:n*mn(t.key,e,r)})}function gn(e){let t=new Set;for(let n of e)t.add(n.state);return[...t].sort((e,t)=>(X[e]??99)-(X[t]??99))}function _n(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)=>Z(e.label,t.label))}function vn(e){let t=new Set;for(let n of e)n.gatewayVersion!==null&&t.add(n.gatewayVersion);return[...t].sort((e,t)=>Zt(e,t)??Z(e,t))}var Q=n();function yn({connections:e,displayByInstance:t}){let[n,i]=(0,G.useState)(un),[a,o]=(0,G.useState)(null),s=(0,G.useMemo)(()=>e.map((e,n)=>({_id:`${e.key}:${e.canonical}/${e.agentId}:${n}`,targetLabel:`${e.canonical}/${e.agentId}`,state:e.state,instanceName:e.instanceName??null,instanceLabel:e.instanceName?t.get(e.instanceName)??e.instanceName:null,gatewayHost:e.gatewayHost,gatewayVersion:e.gatewayVersion??null,okCount:e.okCount,errorCount:e.errorCount+(e.downstreamRejectCount??0)+(e.localRefusalCount??0),attempts:e.attempts,lastOkAt:e.lastOkAt??null,lastErrorCode:e.lastErrorCode??null,lastErrorAt:e.lastErrorAt??null,lastDownstreamRejectCode:e.lastDownstreamRejectCode??null,lastDownstreamRejectAt:e.lastDownstreamRejectAt??null,lastLocalRefusalCode:e.lastLocalRefusalCode??null,lastLocalRefusalAt:e.lastLocalRefusalAt??null})),[e,t]),c=(0,G.useMemo)(()=>gn(s),[s]),l=(0,G.useMemo)(()=>_n(s),[s]),u=(0,G.useMemo)(()=>vn(s),[s]),d=(0,G.useMemo)(()=>hn(fn(s,n),a),[s,n,a]);function f(e){o(t=>t?.key===e?t.dir===`asc`?{key:e,dir:`desc`}:null:{key:e,dir:`asc`})}return e.length===0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:tt()}):(0,Q.jsxs)(`div`,{className:`oc-conn`,children:[(0,Q.jsxs)(Gt,{q:n.q,onQChange:e=>i(t=>({...t,q:e})),searchPlaceholder:ze(),onReset:()=>i(un),canReset:dn(n),children:[(0,Q.jsxs)(F,{value:n.state,onValueChange:e=>i(t=>({...t,state:e})),children:[(0,Q.jsx)(I,{size:`sm`,className:`w-36`,children:(0,Q.jsx)(A,{placeholder:qe()})}),(0,Q.jsxs)(L,{children:[(0,Q.jsx)(j,{value:Y,children:x()}),c.map(e=>(0,Q.jsx)(j,{value:e,children:xn(e)},e))]})]}),(0,Q.jsxs)(F,{value:n.instance,onValueChange:e=>i(t=>({...t,instance:e})),children:[(0,Q.jsx)(I,{size:`sm`,className:`w-40`,children:(0,Q.jsx)(A,{placeholder:nt()})}),(0,Q.jsxs)(L,{children:[(0,Q.jsx)(j,{value:Y,children:x()}),l.map(e=>(0,Q.jsx)(j,{value:e.name,children:e.label},e.name))]})]}),(0,Q.jsxs)(F,{value:n.version,onValueChange:e=>i(t=>({...t,version:e})),children:[(0,Q.jsx)(I,{size:`sm`,className:`w-36`,children:(0,Q.jsx)(A,{placeholder:Oe()})}),(0,Q.jsxs)(L,{children:[(0,Q.jsx)(j,{value:Y,children:x()}),u.map(e=>(0,Q.jsx)(j,{value:e,children:e},e))]})]})]}),d.length===0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:r()}):(0,Q.jsxs)(U,{className:`oc-conn__table`,children:[(0,Q.jsx)(R,{children:(0,Q.jsxs)(V,{children:[(0,Q.jsx)($,{label:_(),sortKey:`target`,sort:a,onSort:f}),(0,Q.jsx)($,{label:_e(),sortKey:`state`,sort:a,onSort:f}),(0,Q.jsx)($,{label:he(),sortKey:`instance`,sort:a,onSort:f}),(0,Q.jsx)($,{label:ge(),sortKey:`host`,sort:a,onSort:f}),(0,Q.jsx)($,{label:h(),sortKey:`version`,sort:a,onSort:f}),(0,Q.jsx)(z,{children:et()}),(0,Q.jsx)($,{label:g(),sortKey:`lastOk`,sort:a,onSort:f})]})}),(0,Q.jsx)(B,{children:d.map(e=>(0,Q.jsx)(bn,{r:e},e._id))})]})]})}function $({label:e,sortKey:t,sort:n,onSort:r}){let i=n?.key===t,a=i?n.dir:null;return(0,Q.jsx)(z,{"aria-sort":i?a===`asc`?`ascending`:`descending`:`none`,children:(0,Q.jsxs)(`button`,{type:`button`,className:`oc-conn__sort`,onClick:()=>r(t),children:[e,i?a===`asc`?(0,Q.jsx)(zt,{size:13,"aria-hidden":!0}):(0,Q.jsx)(w,{size:13,"aria-hidden":!0}):(0,Q.jsx)(_t,{size:13,"aria-hidden":!0,className:`oc-conn__sort-idle`})]})})}function bn({r:e}){let t=an(e)?W(e.lastErrorCode):null,n=K(e)?W(e.lastDownstreamRejectCode):null,r=on(e)?W(e.lastLocalRefusalCode):null;return(0,Q.jsxs)(G.Fragment,{children:[(0,Q.jsxs)(V,{className:`oc-conn__row oc-conn__row--${e.state}`,children:[(0,Q.jsx)(H,{children:(0,Q.jsx)(`code`,{className:`oc-traces__mono`,children:e.targetLabel})}),(0,Q.jsx)(H,{children:(0,Q.jsx)(Sn,{state:e.state})}),(0,Q.jsx)(H,{children:e.instanceLabel?(0,Q.jsx)(`span`,{className:`oc-bridge-target__instance`,children:e.instanceLabel}):(0,Q.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})}),(0,Q.jsx)(H,{children:(0,Q.jsx)(`span`,{className:`oc-bridge-target__host`,children:e.gatewayHost})}),(0,Q.jsx)(H,{children:e.gatewayVersion?(0,Q.jsx)(`span`,{className:`oc-bridge-target__version`,children:e.gatewayVersion}):(0,Q.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})}),(0,Q.jsx)(H,{children:(0,Q.jsx)(`span`,{className:`oc-conn__stats`,children:Ye({ok:e.okCount,errors:e.errorCount,attempts:e.attempts})})}),(0,Q.jsx)(H,{children:e.lastOkAt?(0,Q.jsx)(`span`,{className:`oc-traces__mono`,children:M(e.lastOkAt)}):(0,Q.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})})]}),sn(e)?(0,Q.jsx)(V,{className:`oc-conn__detail-row`,children:(0,Q.jsxs)(H,{colSpan:7,className:`oc-conn__detail-cell`,children:[t?(0,Q.jsxs)(`div`,{className:`oc-bridge-target__error`,children:[(0,Q.jsx)(`strong`,{children:t.label}),` `,(0,Q.jsx)(`code`,{className:`oc-traces__mono`,children:e.lastErrorCode}),e.lastErrorAt?` · ${M(e.lastErrorAt)}`:``,(0,Q.jsx)(`p`,{className:`oc-bridge-card__hint`,children:t.hint})]}):null,r?(0,Q.jsxs)(`div`,{className:`oc-bridge-target__downstream`,children:[Xe({label:r.label}),` `,(0,Q.jsx)(`code`,{className:`oc-traces__mono`,children:e.lastLocalRefusalCode}),e.lastLocalRefusalAt?` · ${M(e.lastLocalRefusalAt)}`:``,(0,Q.jsx)(`p`,{className:`oc-bridge-card__hint`,children:r.hint})]}):null,n?(0,Q.jsxs)(`div`,{className:`oc-bridge-target__downstream`,children:[Se({label:n.label}),` `,(0,Q.jsx)(`code`,{className:`oc-traces__mono`,children:e.lastDownstreamRejectCode}),e.lastDownstreamRejectAt?` · ${M(e.lastDownstreamRejectAt)}`:``]}):null]})}):null]})}function xn(e){return e===`connected`?m():e===`error`?b():pe()}function Sn({state:e}){return e===`connected`?(0,Q.jsx)(O,{variant:`secondary`,children:m()}):e===`error`?(0,Q.jsx)(O,{variant:`destructive`,children:b()}):(0,Q.jsx)(O,{variant:`outline`,children:pe()})}function Cn(){return y(S.bridgeHealth.getBridgeHealth,{})}function wn(){let e=Cn(),t=y(S.compat.getBridgeCompat,{}),n=y(S.me.getMe,{host:It})?.role===`admin`,r=y(S.admin.listInstances,n?{}:`skip`),i=y(S.agents.usageForInstances,n?{}:`skip`),a=Pt(),o=()=>void a({to:`/settings/anomalies`,search:{status:`open`}}),s=ln(e?e.targets:[],t?t.targets:[],r??[]),{section:c}=Ft({from:`/settings/bridge`}),l=Pt({from:`/settings/bridge`}),u=t?.compat??null,f=t===void 0?`loading`:t===null?`nodata`:`ready`,ee=u!==null&&Xt(u,`hermes`)&&!s.some(e=>e.key===`hermes`);return(0,Q.jsxs)(`div`,{className:`oc-bridge`,children:[(0,Q.jsx)(Tn,{health:e,compat:t,onSeeAnomalies:o}),(0,Q.jsx)(`p`,{className:`oc-admin__hint oc-bridge__caption`,children:d()}),i&&i.length>0?(0,Q.jsxs)(`section`,{className:`oc-bridge__usage`,children:[(0,Q.jsx)(`h3`,{className:`oc-bridge__usage-title`,children:p()}),(0,Q.jsxs)(U,{children:[(0,Q.jsx)(R,{children:(0,Q.jsxs)(V,{children:[(0,Q.jsx)(z,{children:ht()}),(0,Q.jsx)(z,{children:ct()}),(0,Q.jsx)(z,{children:xe()}),(0,Q.jsx)(z,{children:Pe()}),(0,Q.jsx)(z,{children:Re()})]})}),(0,Q.jsx)(B,{children:i.flatMap(e=>{let t=Et(e.usage,Date.now());return t?t.windows.map((t,n)=>(0,Q.jsxs)(V,{children:[(0,Q.jsx)(H,{className:`font-medium`,children:n===0?e.instanceName:``}),(0,Q.jsx)(H,{children:t.provider}),(0,Q.jsx)(H,{children:t.label}),(0,Q.jsx)(H,{children:(0,Q.jsxs)(O,{variant:t.percentLeft<=10?`destructive`:t.percentLeft<=25?`outline`:`secondary`,children:[t.percentLeft,`%`]})}),(0,Q.jsx)(H,{className:`text-muted-foreground`,children:t.resetText??`—`})]},`${e.instanceName}:${t.provider}:${t.label}`)):[]})})]})]}):null,s.length>0?(0,Q.jsxs)(Lt,{value:s.some(e=>e.key===c)?c:s[0]?.key??`openclaw`,onValueChange:e=>void l({search:{section:e},replace:!0}),children:[(0,Q.jsx)(Bt,{className:`w-full`,children:s.map(e=>(0,Q.jsxs)(Ht,{value:e.key,className:`flex-1 gap-1.5`,children:[(0,Q.jsx)(k,{size:13,"aria-hidden":!0}),J(e.key)]},e.key))}),s.map(e=>(0,Q.jsx)(Mt,{value:e.key,children:(0,Q.jsx)(En,{providerKey:e.key,connections:e.connections,instances:e.instances,manifest:u,compatStatus:f,compatReachable:t?.reachable??!0,protocol:e.key===`openclaw`?t?.protocol??null:null})},e.key))]}):null,ee?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:Je()}):null]})}function Tn({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,Q.jsxs)(`span`,{className:`oc-bridge-card__ver`,children:[(0,Q.jsx)(`code`,{className:`oc-traces__mono`,children:Yt(t.bridgeVersion)}),i?(0,Q.jsxs)(Q.Fragment,{children:[` `,(0,Q.jsxs)(`code`,{className:`oc-traces__mono`,title:le(),children:[`(`,i,`)`]})]}):null,r?(0,Q.jsxs)(`strong`,{className:`oc-bridge-card__mismatch`,children:[` `,dt({build:t.buildVersion??`?`})]}):null,` · `,we(),` `,(0,Q.jsx)(`code`,{className:`oc-traces__mono`,children:t.protocolVersion===null?C():String(t.protocolVersion)})]}):null;if(e===void 0)return(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:st()});if(e===null)return(0,Q.jsx)(`div`,{className:`oc-bridge-card oc-bridge-card--idle`,children:be()});let o=tn(e.targets),s=!e.reachable,c=rn(e),l=e.unreachableInstances??[],u=c===`ok`?`ok`:c===`gateways_unreachable`?`warn`:`error`,d=D(e.checkedAt),f=e.startedAt==null?null:D(e.startedAt);return(0,Q.jsxs)(`div`,{className:`oc-bridge-card oc-bridge-card--${u}`,children:[(0,Q.jsx)(`div`,{className:`oc-bridge-card__icon`,"aria-hidden":!0,children:c===`ok`?(0,Q.jsx)(jt,{size:22}):s||c===`gateways_unreachable`?(0,Q.jsx)(en,{size:22}):(0,Q.jsx)(N,{size:22})}),(0,Q.jsxs)(`div`,{className:`oc-bridge-card__body`,children:[(0,Q.jsx)(`div`,{className:`oc-bridge-card__title`,children:c===`ok`?Ne():c===`gateways_unreachable`?Ae({count:l.length}):s?Le():Ke({count:o.length})}),(0,Q.jsxs)(`div`,{className:`oc-bridge-card__meta`,children:[(0,Q.jsxs)(`span`,{children:[(0,Q.jsx)($t,{size:12,"aria-hidden":!0}),` `,$e({time:d})]}),f?(0,Q.jsx)(`span`,{children:it({time:f})}):null,a]}),c===`gateways_unreachable`?(0,Q.jsx)(`p`,{className:`oc-bridge-card__hint`,children:De({names:l.join(`, `)})}):null,s?(0,Q.jsx)(`p`,{className:`oc-bridge-card__hint`,children:W(e.lastError===`not_configured`?`NOT_CONFIGURED`:`BRIDGE_UNREACHABLE`).hint}):null]}),(0,Q.jsx)(`button`,{type:`button`,className:`oc-bridgebar__drill`,onClick:n,children:Ue()})]})}function En({providerKey:e,connections:t,instances:n,manifest:r,compatStatus:i,compatReachable:a,protocol:o}){let s=r?Kt(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:Jt(t,e,r)})}let d=Qt(l.map(e=>e.state)),[f,p]=(0,G.useState)(!1);return(0,Q.jsxs)(`section`,{className:`oc-bridge-provider`,children:[(0,Q.jsxs)(`header`,{className:`oc-bridge-provider__head`,children:[(0,Q.jsx)(k,{size:15,"aria-hidden":!0,className:`oc-bridge-provider__icon`}),(0,Q.jsx)(`span`,{className:`oc-bridge-provider__name`,children:J(e)}),d?(0,Q.jsx)(O,{variant:d===`beyond`||d===`defective`||d===`unsupported`?`destructive`:`secondary`,children:qt(d)}):null]}),(0,Q.jsx)(`h4`,{className:`oc-bridge-provider__sub`,children:lt()}),(0,Q.jsx)(On,{providerName:J(e),support:s,compatStatus:i,compatReachable:a,manifest:r,instanceRows:l}),o?(0,Q.jsx)(Dn,{protocol:o}):null,(0,Q.jsxs)(`button`,{type:`button`,className:`oc-bridge-provider__sub oc-bridge-provider__sub--toggle`,"aria-expanded":f,onClick:()=>p(e=>!e),children:[f?(0,Q.jsx)(w,{size:13,"aria-hidden":!0}):(0,Q.jsx)(P,{size:13,"aria-hidden":!0}),Ee({count:t.length})]}),f?(0,Q.jsx)(yn,{connections:t,displayByInstance:c}):null]})}function Dn({protocol:e}){let[t,n]=(0,G.useState)(!1),r=e.coverage,i=e.drift??[],o=(e.driftOverflow??0)+(e.driftTruncated??0);return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`h4`,{className:`oc-bridge-provider__sub`,children:[fe(),i.length>0?(0,Q.jsx)(O,{variant:`destructive`,children:u({count:i.length})}):o>0?(0,Q.jsx)(O,{variant:`destructive`,children:ue()}):(0,Q.jsx)(O,{variant:`secondary`,children:ut()})]}),(0,Q.jsxs)(`p`,{className:`oc-admin__hint`,children:[ft({version:e.vendoredVersion}),r?` · `+Te({handled:r.handled,ignored:r.ignored,gaps:r.gaps}):null]}),o>0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:a({overflow:e.driftOverflow??0,truncated:e.driftTruncated??0})}):null,i.length>0?(0,Q.jsx)(`ul`,{className:`oc-bridge-protocol__list`,role:`list`,children:i.map(e=>(0,Q.jsxs)(`li`,{children:[(0,Q.jsx)(`code`,{className:`oc-traces__mono`,children:e.shape}),` × `,e.count]},e.shape))}):null,r&&r.gapList.length>0?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`button`,{type:`button`,className:`oc-bridge-provider__sub oc-bridge-provider__sub--toggle`,"aria-expanded":t,onClick:()=>n(e=>!e),children:[t?(0,Q.jsx)(w,{size:13,"aria-hidden":!0}):(0,Q.jsx)(P,{size:13,"aria-hidden":!0}),mt({count:r.gapList.length})]}),t?(0,Q.jsx)(`ul`,{className:`oc-bridge-protocol__list`,role:`list`,children:r.gapList.map(e=>(0,Q.jsx)(`li`,{children:(0,Q.jsx)(`code`,{className:`oc-traces__mono`,children:e})},e))}):null]}):null]})}function On({support:e,compatStatus:t,compatReachable:n,manifest:r,instanceRows:i,providerName:a}){return t===`loading`?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:st()}):t===`nodata`?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:l()}):(0,Q.jsxs)(`div`,{className:`oc-compat`,children:[n?null:(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:ot()}),r===null?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:ye()}):(0,Q.jsxs)(`div`,{className:`oc-compat__support`,children:[(0,Q.jsx)(`span`,{className:`oc-compat__label`,children:de({provider:a})}),e&&e.range!==null?(0,Q.jsx)(`span`,{children:Me({min:e.range.min,max:e.range.maxValidated})}):(0,Q.jsx)(`span`,{children:C()}),e?(0,Q.jsx)(Mn,{versions:e.validatedVersions}):null]}),i.length===0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:ke()}):(0,Q.jsx)(`div`,{className:`oc-compat__targets`,children:i.map(e=>(0,Q.jsxs)(`div`,{className:`oc-compat__target`,children:[(0,Q.jsx)(`span`,{className:`oc-compat__instance`,children:e.displayName}),(0,Q.jsx)(`code`,{className:`oc-traces__mono`,children:Yt(e.version)}),(0,Q.jsx)(O,{variant:e.state===`supported`?`secondary`:e.state===`beyond`||e.state===`defective`||e.state===`unsupported`?`destructive`:`outline`,children:qt(e.state)})]},e.instanceName))})]})}function kn({instance:e,onClose:t}){return(0,Q.jsx)(Ct,{open:!0,onOpenChange:e=>!e&&t(),children:(0,Q.jsxs)(Ut,{className:`oc-bridge-config-dialog`,onOpenAutoFocus:e=>e.preventDefault(),children:[(0,Q.jsxs)(wt,{children:[(0,Q.jsx)(Ot,{children:c({instance:e.displayName??e.name})}),(0,Q.jsx)(kt,{children:v()})]}),(0,Q.jsx)(jn,{instance:e,onClose:t})]})})}function An({label:e,result:t}){return t?t.checked?(0,Q.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,Q.jsx)(jt,{"aria-hidden":!0}):(0,Q.jsx)(N,{"aria-hidden":!0}),(0,Q.jsxs)(`span`,{children:[e,` — `,t.ok?Be():t.detail]})]}):(0,Q.jsxs)(`p`,{className:`oc-bridge-config__check-row oc-bridge-config__check-row--skip`,children:[e,` — `,i()]}):null}function jn({instance:e,onClose:t}){let n=te(S.admin.upsertInstanceConfig),r=o(S.bridge.validateMediaPaths),i=At(),a=Wt(e.config?.contentLocale,void 0),[c,l]=(0,G.useState)(()=>vt(e.config??{},a)),[u,d]=(0,G.useState)(!1),[f,p]=(0,G.useState)(!1),[m,h]=(0,G.useState)(null),g=c.inboundMediaMode===`shared-fs`,_=c.mediaMode===`shared-fs`,v=g||_;async function le(){p(!0),h(null);try{h(await r({instanceName:e.name,inboundMediaMode:c.inboundMediaMode,mediaMode:c.mediaMode}))}catch(e){i.error(ee(),e)}finally{p(!1)}}async function ue(){d(!0);try{let r=e.config??{};await n({instanceId:e._id,config:bt(c,r,a)}),t()}catch(e){i.error(Fe(),e)}finally{d(!1)}}return(0,Q.jsx)(`div`,{className:`oc-bridge-config`,children:(0,Q.jsxs)(`div`,{className:`oc-bridge-config__form`,children:[(0,Q.jsxs)(`div`,{className:`oc-bridge-config__grid`,children:[(0,Q.jsxs)(`label`,{className:`oc-field`,children:[(0,Q.jsx)(T,{label:Ce(),help:We()}),(0,Q.jsxs)(F,{value:c.mediaMode,onValueChange:e=>l({...c,mediaMode:e}),children:[(0,Q.jsx)(I,{size:`sm`,className:`w-full`,children:(0,Q.jsx)(A,{})}),(0,Q.jsx)(L,{children:xt.map(e=>(0,Q.jsx)(j,{value:e,children:e},e))})]})]}),(0,Q.jsxs)(`label`,{className:`oc-field`,children:[(0,Q.jsx)(T,{label:pt(),help:Ze()}),(0,Q.jsxs)(F,{value:c.inboundMediaMode,onValueChange:e=>l({...c,inboundMediaMode:e}),children:[(0,Q.jsx)(I,{size:`sm`,className:`w-full`,children:(0,Q.jsx)(A,{})}),(0,Q.jsx)(L,{children:yt.map(e=>(0,Q.jsx)(j,{value:e,children:e},e))})]})]}),(0,Q.jsxs)(`label`,{className:`oc-field`,children:[(0,Q.jsx)(T,{label:at(),help:rt()}),(0,Q.jsx)(E,{type:`number`,min:1,max:4096,className:`w-full`,value:c.mediaMaxMb,onChange:e=>l({...c,mediaMaxMb:Math.trunc(Number(e.target.value)||0)})})]})]}),v&&(0,Q.jsxs)(`div`,{className:`oc-bridge-config__grid`,children:[g&&(0,Q.jsxs)(`label`,{className:`oc-field`,children:[(0,Q.jsx)(T,{label:me(),help:s()}),(0,Q.jsx)(E,{className:`w-full`,spellCheck:!1,value:c.inboundAgentMount,onChange:e=>l({...c,inboundAgentMount:e.target.value})})]}),_&&(0,Q.jsxs)(`label`,{className:`oc-field`,children:[(0,Q.jsx)(T,{label:gt(),help:ce()}),(0,Q.jsx)(E,{className:`w-full`,spellCheck:!1,value:c.outboundAgentMount,onChange:e=>l({...c,outboundAgentMount:e.target.value})})]})]}),(0,Q.jsxs)(`label`,{className:`oc-field--row`,children:[(0,Q.jsx)(Dt,{checked:c.rehydration,onCheckedChange:e=>l({...c,rehydration:e===!0})}),(0,Q.jsx)(T,{label:ve(),help:He()})]}),v&&m!==null&&(0,Q.jsx)(`div`,{className:`oc-bridge-config__check`,children:m.reachable?!m.inbound&&!m.outbound?(0,Q.jsxs)(`p`,{className:`oc-bridge-config__check-row oc-bridge-config__check-row--err`,children:[(0,Q.jsx)(N,{"aria-hidden":!0}),oe({reason:m.reason??`?`})]}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(An,{label:ae(),result:m.inbound}),(0,Q.jsx)(An,{label:ie(),result:m.outbound}),(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:se()})]}):(0,Q.jsxs)(`p`,{className:`oc-bridge-config__check-row oc-bridge-config__check-row--err`,children:[(0,Q.jsx)(N,{"aria-hidden":!0}),Ve()]})}),(0,Q.jsxs)(`div`,{className:`oc-bridge-config__actions`,children:[v&&(0,Q.jsxs)(St,{variant:`outline`,size:`sm`,onClick:()=>void le(),disabled:f,children:[f?(0,Q.jsx)(Tt,{className:`size-4 animate-spin`,"aria-hidden":!0}):null,f?ne():re()]}),(0,Q.jsx)(St,{size:`sm`,onClick:()=>void ue(),disabled:u,children:je()})]})]})})}function Mn({versions:e}){if(e.length===0)return null;let t=[...e].reverse();return(0,Q.jsxs)(Rt,{children:[(0,Q.jsx)(Nt,{asChild:!0,children:(0,Q.jsxs)(`button`,{type:`button`,className:`oc-compat__versions-btn`,children:[e.length===1?Ie():Ge({count:e.length}),(0,Q.jsx)(w,{size:13,"aria-hidden":!0})]})}),(0,Q.jsxs)(Vt,{className:`oc-compat__versions-pop`,align:`start`,children:[(0,Q.jsx)(`p`,{className:`oc-compat__versions-title`,children:Qe()}),(0,Q.jsx)(`div`,{className:`oc-compat__versions-list`,children:t.map(e=>(0,Q.jsx)(O,{variant:`secondary`,children:e},e))})]})]})}export{wn as BridgeTab,kn as InstanceConfigDialog};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{A_ as r,At as i,BX as a,Bp as o,Bt as s,Ct as c,D_ as l,Dt as u,E_ as d,Et as f,Ft as p,Gp as m,HX as h,Hp as g,Ht as _,It as v,Jv as y,Kp as b,Lt as ee,M_ as x,Mt as S,NX as C,N_ as te,Nt as w,O_ as T,Ot as ne,Pt as E,Rp as re,Rt as ie,St as ae,T_ as D,Tt as oe,UX as O,Up as se,Ut as ce,Uv as le,Vp as ue,Vt as de,Wp as k,Wt as A,Wv as fe,Xv as j,bt as pe,j_ as me,jt as he,k_ as ge,kt as _e,lv as M,qp as ve,t as N,wt as P,xA as F,xt as ye,xu as be,yt as xe,zp as Se,zt as Ce}from"./api--rqKQo-l.js";import{t as we}from"./use_paginated_query-BKOSBoa7.js";import{t as I}from"./button-HksxbiUF.js";import{$t as L,Mt as R,St as z,bt as B,kn as Te,nt as V,rt as Ee,tt as H,vt as U,xt as W,yt as G}from"./index-l7elBM2O.js";import{a as De}from"./compatView-BmFG4Q3R.js";/* empty css */var K=t(e(),1),Oe=[`off`,`minimal`,`low`,`medium`,`high`,`xhigh`];function ke(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 q=[`auto`,`hybrid`,`tool`,`off`];function Ae(e){switch(e){case`auto`:return de();case`hybrid`:return s();case`tool`:return Ce();default:return ie()}}function J(e){return{injection:e.injection??`auto`,defaultSources:e.defaultSources,...e.config?{config:e.config}:{}}}function Y(e){return typeof e==`string`&&q.includes(e)}function X(e){return{injection:Y(e.injection)?e.injection:`auto`,sources:e.defaultSources.filter(t=>e.sources.some(e=>e.id===t))}}function Z(e,t){let n=new Set(e);return n.size===new Set(t).size&&t.every(e=>n.has(e))}function je(e,t,n){let r=n?e.defaultWriteRefused===`scope_refused`?w():Me(e)?c():null:E(),i=X(e),a=t.injection!==i.injection||!Z(t.sources,i.sources),o=new Set(e.sources.map(e=>e.id)),s=t.sources.length>0&&t.sources.length<=16&&t.sources.every(e=>o.has(e));return{readOnlyReason:r,dirty:a,valid:s,invalidReason:s?null:v()}}function Me(e){return(e.contract??1)<2&&e.ownAllowlist===!1}function Ne(e,t,n){let r=t.sources.includes(n)?t.sources.filter(e=>e!==n):[...t.sources,n];return{...t,sources:e.sources.map(e=>e.id).filter(e=>r.includes(e))}}function Q(e){return e.ok?null:e.code===`scope_refused`?w():e.code===`stale_default`?S():e.code===`write_unknown`||e.code===`not_confirmed`?_e():e.code===`not_applied`?ne():e.code===`default_too_large`?ye():e.code===`allowlist_too_large`?ae():e.code===`plugin_too_old`?c():e.code===`source_not_allowed`?P():e.code===`plugin_config_lag`?oe():e.code===`knowledge_unavailable`&&e.reason===`plugin_absent`?p():he({code:e.code})}function Pe(e,t){let n=J(e),r=J(t);if(n.injection!==r.injection||!Z(n.defaultSources,r.defaultSources))return!0;let i=n.config,a=r.config;return i===void 0||a===void 0?i!==a:i.injection!==a.injection||!((e,t)=>e===null||t===null?e===t:e.length===t.length&&e.every((e,n)=>e===t[n]))(i.sources,a.sources)}var $=n();function Fe({instanceName:e,row:t,supported:n}){let r=a(N.knowledge.setAgentKnowledgeDefault),[o,s]=(0,K.useState)(t),[c,u]=(0,K.useState)(()=>X(t)),[f,p]=(0,K.useState)(`idle`),[m,h]=(0,K.useState)(null),[g,v]=(0,K.useState)(!1),y=e=>{s(e),u(X(e)),h(null)},b=Pe(o,t);(0,K.useEffect)(()=>{g&&b&&(v(!1),y(t))},[g,b]);let x=je(o,c,n),S=x.readOnlyReason===null;async function C(){p(`saving`),h(null);try{let n=Q(await r({instanceName:e,agentId:t.agentId,injection:c.injection,sources:c.sources,expected:J(o)}));h(n),p(n===null?`done`:`idle`),n===null&&v(!0)}catch(e){h(Q({ok:!1,code:String(e?.message??`error`).slice(0,60)})),p(`idle`)}}return(0,$.jsxs)(`div`,{className:`oc-cdefaults__row`,"data-knowledge-agent":t.agentId,children:[(0,$.jsx)(`span`,{className:`oc-cdefaults__label`,children:t.agentId}),(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`div`,{className:`oc-cdefaults__inline`,children:(0,$.jsxs)(U,{value:c.injection,onValueChange:e=>{Y(e)&&u({...c,injection:e})},disabled:!S,children:[(0,$.jsx)(W,{className:`oc-cdefaults__select`,"aria-label":_(),children:(0,$.jsx)(z,{})}),(0,$.jsx)(G,{children:q.map(e=>(0,$.jsx)(B,{value:e,children:Ae(e)},e))})]})}),(0,$.jsx)(`span`,{className:`oc-cdefaults__label`,children:ee()}),t.sources.map(e=>(0,$.jsxs)(`label`,{className:`oc-cdefaults__inline`,style:{cursor:S?`pointer`:`default`},title:e.description||void 0,children:[(0,$.jsx)(R,{checked:c.sources.includes(e.id),onCheckedChange:()=>u(Ne(t,c,e.id)),disabled:!S,"aria-label":e.label,"data-knowledge-default-source":e.id}),(0,$.jsx)(`span`,{children:e.label})]},e.id)),b&&!g?(0,$.jsxs)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:[pe(),` `,(0,$.jsx)(I,{variant:`outline`,size:`sm`,onClick:()=>y(t),children:xe()})]}):null,t.overridesAllowed?null:(0,$.jsx)(`p`,{className:`oc-cdefaults__help`,children:i()}),S?(0,$.jsx)(`div`,{className:`oc-cdefaults__inline`,children:(0,$.jsx)(I,{size:`sm`,disabled:!x.dirty||!x.valid||f===`saving`,onClick:()=>void C(),children:f===`saving`?j():l()})}):(0,$.jsx)(`p`,{className:`oc-cdefaults__note`,children:x.readOnlyReason}),S&&x.dirty&&x.invalidReason!==null?(0,$.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:x.invalidReason}):null,f===`done`&&m===null?(0,$.jsx)(`p`,{className:`oc-admin__hint`,role:`status`,children:d()}):null,m===null?null:(0,$.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:m})]})]})}function Ie({instanceName:e}){let t=O(N.knowledge.knowledgeAdminInstance,{instanceName:e}),{results:n,status:r,loadMore:i}=we(N.knowledge.agentKnowledgePage,{instanceName:e},{initialNumItems:50});return t===void 0||t.provider!==`openclaw`||n.length===0&&r!==`CanLoadMore`?null:(0,$.jsxs)(`section`,{className:`oc-cdefaults__row`,"aria-label":A(),children:[(0,$.jsx)(`span`,{className:`oc-cdefaults__label`,children:A()}),(0,$.jsx)(`p`,{className:`oc-admin__hint`,children:ce()}),t.supported?null:(0,$.jsx)(`p`,{className:`oc-cdefaults__note`,children:E()}),n.map(n=>(0,$.jsx)(Fe,{instanceName:e,row:n,supported:t.supported},n.agentId)),r===`CanLoadMore`||r===`LoadingMore`?(0,$.jsxs)(`div`,{className:`oc-cdefaults__inline`,children:[(0,$.jsx)(`p`,{className:`oc-admin__hint`,children:u({shown:n.length})}),(0,$.jsx)(I,{variant:`outline`,size:`sm`,disabled:r===`LoadingMore`,onClick:()=>i(50),"data-knowledge-load-more":!0,children:f()})]}):null]})}function Le({instance:e}){let t=h(N.admin.upsertInstanceConfig),n=O(N.agents.listAgentsForInstance,{instanceName:e.name}),r=typeof e.config?.converterAgentId==`string`?e.config.converterAgentId:``,[i,a]=(0,K.useState)(r),[o,s]=(0,K.useState)(`idle`);(0,K.useEffect)(()=>{a(r),s(`idle`)},[e._id,r]);let c=`__none__`,u=i!==r;async function f(){s(`saving`);try{let n={...e.config??{}};i===``||i===c?delete n.converterAgentId:n.converterAgentId=i,await t({instanceId:e._id,config:n}),s(`done`)}catch{s(`error`)}}let p=n?.agents??[];return(0,$.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,$.jsx)(`span`,{className:`oc-cdefaults__label`,children:k()}),(0,$.jsx)(`p`,{className:`oc-admin__hint`,children:se()}),(0,$.jsxs)(`div`,{className:`oc-cdefaults__inline`,children:[(0,$.jsxs)(U,{value:i===``?c:i,onValueChange:e=>a(e===c?``:e),children:[(0,$.jsx)(W,{className:`oc-cdefaults__select`,"aria-label":k(),children:(0,$.jsx)(z,{placeholder:g()})}),(0,$.jsxs)(G,{children:[(0,$.jsx)(B,{value:c,children:g()}),p.map(e=>(0,$.jsx)(B,{value:e.agentId,children:e.displayName?`${e.displayName} (${e.agentId})`:e.agentId},e.agentId))]})]}),(0,$.jsx)(I,{size:`sm`,disabled:!u||o===`saving`,onClick:()=>void f(),children:o===`saving`?j():l()})]}),o===`done`?(0,$.jsx)(`p`,{className:`oc-admin__hint`,role:`status`,children:d()}):null,o===`error`?(0,$.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:D()}):null]})}function Re({instance:e}){let t=h(N.admin.upsertInstanceConfig),n=e.config?.curationEnabled===!0,r=typeof e.config?.curationBudgetChars==`number`?e.config.curationBudgetChars:null,[i,a]=(0,K.useState)(n),[s,c]=(0,K.useState)(r===null?``:String(r)),[u,f]=(0,K.useState)(`idle`);(0,K.useEffect)(()=>{a(n),c(r===null?``:String(r)),f(`idle`)},[e._id,n,r]);let p=s.trim(),g=p===``?null:/^\d+$/.test(p)?Number.parseInt(p,10):NaN,_=!i||g===null||Number.isInteger(g)&&g>=4e3&&g<=6e4,v=i!==n||(g??null)!==r;async function y(){f(`saving`);try{let n={...e.config??{}};n.curationEnabled=i,!i||g===null||Number.isNaN(g)?delete n.curationBudgetChars:n.curationBudgetChars=g,await t({instanceId:e._id,config:n}),f(`done`)}catch{f(`error`)}}return(0,$.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,$.jsxs)(`label`,{className:`oc-cdefaults__inline`,style:{cursor:`pointer`},children:[(0,$.jsx)(R,{checked:i,onCheckedChange:e=>a(e===!0),"aria-label":m()}),(0,$.jsx)(`span`,{className:`oc-cdefaults__label`,children:m()})]}),(0,$.jsxs)(`div`,{className:`oc-cdefaults__inline`,children:[(0,$.jsx)(L,{type:`number`,min:4e3,max:6e4,step:1e3,placeholder:`20000`,value:s,onChange:e=>c(e.target.value),className:`oc-cdefaults__number`,"aria-invalid":!_,"aria-label":ue(),disabled:!i}),(0,$.jsx)(I,{size:`sm`,disabled:!v||!_||u===`saving`,onClick:()=>void y(),children:u===`saving`?j():l()})]}),_?null:(0,$.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:o()}),u===`done`?(0,$.jsx)(`p`,{className:`oc-admin__hint`,role:`status`,children:d()}):null,u===`error`?(0,$.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:D()}):null,(0,$.jsx)(`p`,{className:`oc-cdefaults__help`,children:Se()})]})}function ze({instance:e}){let t=h(N.admin.upsertInstanceConfig),n=typeof e.config?.summarizeThresholdChars==`number`?e.config.summarizeThresholdChars:null,[r,i]=(0,K.useState)(n===null?``:String(n)),[a,o]=(0,K.useState)(`idle`);(0,K.useEffect)(()=>{i(n===null?``:String(n)),o(`idle`)},[e._id,n]);let s=r.trim(),c=s===``?null:/^\d+$/.test(s)?Number.parseInt(s,10):NaN,u=c===null||Number.isInteger(c)&&c>=1e3&&c<=2e5,f=(c??null)!==n;async function p(){o(`saving`);try{let n={...e.config??{}};c===null?delete n.summarizeThresholdChars:n.summarizeThresholdChars=c,await t({instanceId:e._id,config:n}),o(`done`)}catch{o(`error`)}}return(0,$.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,$.jsx)(`span`,{className:`oc-cdefaults__label`,children:ve()}),(0,$.jsxs)(`div`,{className:`oc-cdefaults__inline`,children:[(0,$.jsx)(L,{type:`number`,min:1e3,max:2e5,step:1e3,placeholder:`8000`,value:r,onChange:e=>i(e.target.value),className:`oc-cdefaults__number`,"aria-invalid":!u}),(0,$.jsx)(I,{size:`sm`,disabled:!f||!u||a===`saving`,onClick:()=>void p(),children:a===`saving`?j():l()})]}),u?null:(0,$.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:re()}),a===`done`?(0,$.jsx)(`p`,{className:`oc-admin__hint`,role:`status`,children:d()}):null,a===`error`?(0,$.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:D()}):null,(0,$.jsx)(`p`,{className:`oc-cdefaults__help`,children:b()})]})}function Be(){let e=a(N.agentFiles.getChatDefaults),[t,n]=(0,K.useState)({status:`loading`}),i=O(N.admin.listInstances,{}),[o,s]=(0,K.useState)(null);(0,K.useEffect)(()=>{!i||i.length===0||(!o||!i.some(e=>e.name===o))&&s(i[0].name)},[i,o]);let c=(i?.length??0)>1,l=i!==void 0&&i.length===0,u=O(N.compat.forInstance,o?{instanceName:o}:`skip`),d=o?V(u,`configDefaults`):`loading`,f=d===`loading`?null:d.blocked,p=(0,K.useMemo)(()=>c&&o?{instanceName:o}:{},[c,o]),m=(0,K.useRef)(0),h=(0,K.useCallback)(async()=>{let t=++m.current;n({status:`loading`});try{let r=ke(await e(p));if(m.current!==t)return;n({status:`done`,current:r})}catch{if(m.current!==t)return;n({status:`error`})}},[e,p]);(0,K.useEffect)(()=>{f===!1&&(c&&!o||h())},[h,f,c,o]);let g=t.status===`done`?t.current:null,_=(0,K.useMemo)(()=>Oe.map(e=>({id:e,label:Ee(e)})),[]),v=(0,K.useMemo)(()=>[{id:`fast`,label:fe()},{id:`standard`,label:le()}],[]);return(0,$.jsxs)(`div`,{className:`oc-cdefaults`,children:[(0,$.jsx)(`p`,{className:`oc-admin__hint`,children:te()}),c&&o?(0,$.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,$.jsx)(`span`,{className:`oc-cdefaults__label`,children:M()}),(0,$.jsxs)(U,{value:o,onValueChange:e=>s(e),children:[(0,$.jsx)(W,{size:`sm`,"aria-label":M(),children:(0,$.jsx)(z,{})}),(0,$.jsx)(G,{children:(i??[]).map(e=>(0,$.jsx)(B,{value:e.name,children:e.name},e.name))})]})]}):null,l?(0,$.jsx)(`p`,{className:`oc-admin__hint`,role:`status`,children:F()}):d===`loading`?(0,$.jsx)(`p`,{className:`oc-admin__hint`,children:C()}):d.blocked?(0,$.jsxs)(`p`,{className:`oc-compat__blocked`,role:`status`,children:[(0,$.jsx)(Te,{size:14,"aria-hidden":!0}),` `,De(d.gatewayVersion,d.provider)]}):t.status===`loading`?(0,$.jsx)(`p`,{className:`oc-admin__hint`,children:C()}):t.status===`error`?(0,$.jsxs)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:[T(),` `,(0,$.jsx)(I,{variant:`outline`,size:`sm`,onClick:()=>void h(),children:y()})]}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,$.jsx)(`span`,{className:`oc-cdefaults__label`,children:x()}),(0,$.jsx)(H,{field:`thinkingLevel`,options:_,value:g?.thinkingDefault??null,onChange:()=>{},disabled:!0,ariaLabel:x()}),(0,$.jsx)(`p`,{className:`oc-cdefaults__help`,children:me()})]}),(0,$.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,$.jsx)(`span`,{className:`oc-cdefaults__label`,children:r()}),(0,$.jsx)(H,{field:`fastMode`,options:v,value:g===null||g.fastModeDefault===null?null:g.fastModeDefault?`fast`:`standard`,onChange:()=>{},disabled:!0,ariaLabel:r()}),(0,$.jsx)(`p`,{className:`oc-cdefaults__help`,children:ge()})]}),(0,$.jsx)(`p`,{className:`oc-cdefaults__note`,children:be()})]}),(()=>{let e=i?.find(e=>e.name===(o??i[0]?.name));return e?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(ze,{instance:e}),(0,$.jsx)(Re,{instance:e}),(0,$.jsx)(Le,{instance:e}),(0,$.jsx)(Ie,{instanceName:e.name})]}):null})()]})}export{Be as ChatDefaultsTab};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{SC as r,_C as i,bC as a,gC as o,vC as s,xC as c,yC as l}from"./api-
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{SC as r,_C as i,bC as a,gC as o,vC as s,xC as c,yC as l}from"./api--rqKQo-l.js";import{r as u}from"./dist-lcVkVTM0.js";import{t as d}from"./chevrons-up-down-4c0Fo5uU.js";import{t as f}from"./button-HksxbiUF.js";import{An as p,Ln as m,Mt as h,an as g,en as _,in as v,nn as y,or as b,tn as x,tr as S}from"./index-l7elBM2O.js";import{a as C,i as w,n as T,o as E,r as D,t as O}from"./table-CwhkOFwK.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=r(),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)(f,{size:`sm`,variant:e.variant===`destructive`?`destructive`:`outline`,onClick:()=>{e.onSelect([...z]),B(new Set)},children:[e.variant===`destructive`?(0,M.jsx)(p,{}):null,e.label,` (`,z.size,`)`]},e.label)):null,N?(0,M.jsxs)(f,{size:`sm`,onClick:N,children:[(0,M.jsx)(m,{}),` `,P]}):null]})]}),t===void 0?(0,M.jsx)(`p`,{className:`oc-admin__hint`,children:a()}):U.length===0?(0,M.jsx)(`p`,{className:`oc-admin__hint`,children:I}):(0,M.jsxs)(O,{children:[(0,M.jsx)(C,{children:(0,M.jsxs)(E,{children:[F?(0,M.jsx)(w,{className:`w-8`,children:(0,M.jsx)(h,{"aria-label":l(),checked:J?!0:Y?`indeterminate`:!1,onCheckedChange:X})}):null,n.map((e,t)=>{let n=V?.index===t;return e.sort?(0,M.jsx)(w,{className:e.className,"aria-sort":n?V.dir===`asc`?`ascending`:`descending`:`none`,children:(0,M.jsxs)(`button`,{type:`button`,className:`oc-dt__sort`,onClick:()=>K(t),"aria-label":o({column:e.header}),children:[e.header,n?V.dir===`asc`?(0,M.jsx)(b,{className:`oc-dt__sort-icon`,"aria-hidden":!0}):(0,M.jsx)(u,{className:`oc-dt__sort-icon`,"aria-hidden":!0}):(0,M.jsx)(d,{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)(h,{"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)(_,{children:[(0,M.jsx)(g,{asChild:!0,children:(0,M.jsx)(f,{variant:`ghost`,size:`icon-sm`,"aria-label":i(),className:`opacity-0 transition-opacity group-hover/row:opacity-100 group-focus-within/row:opacity-100 aria-expanded:opacity-100`,children:(0,M.jsx)(S,{})})}),(0,M.jsx)(x,{align:`end`,children:t.map((t,n)=>(0,M.jsxs)(`div`,{children:[t.variant===`destructive`&&n>0?(0,M.jsx)(v,{}):null,(0,M.jsx)(y,{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};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as e}from"./bundle-mjs-C73ZY4La.js";import{HE as t,HX as n,ME as r,NE as i,PE as a,VE as o,mj as s,t as c}from"./api--rqKQo-l.js";import{t as l}from"./use_paginated_query-BKOSBoa7.js";import{t as u}from"./button-HksxbiUF.js";import{ct as d,h as f}from"./index-l7elBM2O.js";import{n as p,t as m}from"./trashPage-DgXB4jOM.js";var h=e();function g(){let{results:e,status:g,loadMore:_}=l(c.trash.listMyTrash,{},{initialNumItems:50}),v=f(),y=n(c.trash.restoreChat),b=n(c.trash.purgeChat),x=n(c.trash.emptyTrash),S=d();return(0,h.jsxs)(`div`,{className:`oc-trash__body`,children:[(0,h.jsxs)(`div`,{className:`oc-trash__head`,children:[(0,h.jsx)(`p`,{className:`oc-trash__hint`,children:t({days:v})}),e.length>0?(0,h.jsx)(u,{variant:`destructive`,size:`sm`,onClick:async()=>{await S({title:i(),description:r(),confirmLabel:a(),destructive:!0})&&await x({})},children:a()}):null]}),g===`LoadingFirstPage`?(0,h.jsx)(`p`,{className:`oc-trash__hint`,children:s()}):e.length===0?(0,h.jsx)(`p`,{className:`oc-trash__empty`,children:o()}):(0,h.jsx)(m,{items:e,onRestore:e=>y({chatId:e}),onPurge:e=>b({chatId:e})}),(0,h.jsx)(p,{status:g,loadMore:_})]})}export{g as DeletedChatsTab};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./bundle-mjs-C73ZY4La.js";import{Jt as t}from"./index-
|
|
1
|
+
import{r as e}from"./bundle-mjs-C73ZY4La.js";import{Jt as t}from"./index-l7elBM2O.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};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$I as r,$L as i,AL as a,BL as o,CL as s,DL as c,EL as l,FL as u,GL as d,HL as f,HX as p,IL as ee,JL as m,KL as h,LL as te,ML as ne,NL as g,OL as _,PL as re,QI as v,QL as y,RL as ie,SL as b,TL as ae,UL as x,
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$I as r,$L as i,AL as a,BL as o,CL as s,DL as c,EL as l,FL as u,GL as d,HL as f,HX as p,IL as ee,JL as m,KL as h,LL as te,ML as ne,NL as g,OL as _,PL as re,QI as v,QL as y,RL as ie,SL as b,TL as ae,UL as x,UX as S,VL as C,WL as w,XL as T,YL as E,Yf as D,ZI as O,ZL as k,Zf as A,_L as j,aL as M,bL as N,cL as P,dL as F,eL as I,fL as L,gL as R,hL as z,iL as B,jL as V,kL as H,lL as U,mL as W,nL as oe,oL as G,pL as K,qL as q,rL as se,sL as ce,t as J,tL as le,uL as ue,vL as de,wL as fe,xL as pe,yL as me,zL as he}from"./api--rqKQo-l.js";import{t as ge}from"./button-HksxbiUF.js";import{At as _e,ct as Y}from"./index-l7elBM2O.js";import{t as ve}from"./DataTableShell-BYSvf6VZ.js";var X=t(e(),1),Z=n(),ye={altered_words:()=>i(),incorrect:()=>y(),incoherence:()=>k(),formatting:()=>T(),latency:()=>E(),api_error:()=>m(),other:()=>q()},Q=e=>ye[e]?.()??e;function $({matches:e,sourceWasOpen:t}){return t?e===!0?(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-ok`,children:d()}):e===!1?(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-warn`,children:w()}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill`,children:`—`}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill`,children:h()})}function be({data:e,reference:t,closeReason:n}){let r=e.snapshot,i=p(J.feedback.respondToFeedback),[d,m]=(0,X.useState)(e.thread),[h,v]=(0,X.useState)(``),[y,b]=(0,X.useState)(!1);async function S(){let t=h.trim();if(!(!t||y)){b(!0);try{await i({feedbackId:e._id,text:t}),m(e=>[...e,{authorRole:`admin`,text:t,at:Date.now()}]),v(``)}finally{b(!1)}}}let w=[];try{w=r.contextJson?JSON.parse(r.contextJson):[]}catch{w=[]}return(0,Z.jsxs)(`div`,{className:`oc-fbadmin__detail`,children:[(0,Z.jsxs)(`div`,{className:`oc-fbadmin__row`,children:[(0,Z.jsx)($,{matches:r.displayedMatchesStored,sourceWasOpen:r.clientInfo?.sourceWasOpen??!1}),(0,Z.jsxs)(`span`,{className:`oc-fbadmin__meta`,children:[Q(e.category),` · `,r.messageRole,r.isRegeneration?` · ${x()}`:``,r.openclawModel?` · ${r.openclawModel}`:``,r.openclawRuntime?` (${r.openclawRuntime})`:``]}),t?(0,Z.jsx)(`code`,{className:`oc-fbadmin__ref`,style:{userSelect:`all`,marginLeft:`auto`},title:j(),children:t}):null]}),e.comment?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:f()}),(0,Z.jsx)(`p`,{className:`oc-fbadmin__comment`,children:e.comment})]}):null,n?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:se()}),(0,Z.jsx)(`p`,{className:`oc-fbadmin__comment`,children:n})]}):null,(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:C()}),d.length>0?(0,Z.jsx)(`div`,{className:`oc-fbadmin__thread`,children:d.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`?o():e.authorRole===`agent`?e.authorLabel??A():he()}),(0,Z.jsx)(`span`,{className:`oc-notif__msg-text`,children:e.text})]},t))}):(0,Z.jsx)(`p`,{className:`oc-fbadmin__meta`,children:ie()}),(0,Z.jsx)(`textarea`,{className:`oc-feedback__textarea`,placeholder:te(),value:h,maxLength:2e3,rows:3,onChange:e=>v(e.target.value.slice(0,2e3))}),(0,Z.jsx)(`div`,{className:`oc-fbadmin__row`,style:{justifyContent:`flex-end`},children:(0,Z.jsx)(ge,{size:`sm`,onClick:()=>void S(),disabled:!h.trim()||y,children:y?ee():u()})})]}),(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:re()}),(0,Z.jsx)(`pre`,{className:`oc-msg__source-pre`,children:r.messageText||g()})]}),r.clientInfo?.sourceWasOpen&&r.displayedText!==void 0?(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:r.displayedText||g()})]}):null,r.promptText?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:V()}),(0,Z.jsx)(`pre`,{className:`oc-msg__source-pre`,children:r.promptText})]}):null,w.length>0?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:a({count:r.contextCount??w.length,truncated:r.contextTruncated?H():``})}),(0,Z.jsx)(`div`,{className:`oc-fbadmin__ctx`,children:w.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,r.outboxAvailable?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:_()}),(0,Z.jsxs)(`pre`,{className:`oc-msg__source-pre`,children:[r.outboxText??``,r.outboxStatus?`\n[status: ${r.outboxStatus}]`:``]})]}):null,r.clientInfo?.extensionsDetected&&r.clientInfo.extensionsDetected.length>0?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:c()}),(0,Z.jsx)(`div`,{className:`oc-fbadmin__row`,children:r.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:l()}),(0,Z.jsxs)(`p`,{className:`oc-fbadmin__env`,children:[[r.clientInfo?.language,r.clientInfo?.timezone,r.clientInfo?.theme?ae({theme:r.clientInfo.theme}):null,r.runId?`run ${r.runId.slice(0,12)}…`:null].filter(Boolean).join(` · `)||`—`,r.clientInfo?.plugins&&r.clientInfo.plugins.length>0?(0,Z.jsxs)(`span`,{className:`oc-fbadmin__plugins`,children:[fe(),` `,r.clientInfo.plugins.join(`, `),(0,Z.jsxs)(`span`,{className:`oc-fbadmin__note`,children:[` `,s()]})]}):null,r.clientInfo?.userAgent?(0,Z.jsx)(`span`,{className:`oc-fbadmin__ua`,children:r.clientInfo.userAgent}):null]})]})]})}function xe(){let e=S(J.feedback.listForAdmin,{}),t=p(J.feedback.readSnapshot),n=p(J.feedback.deleteFeedback),i=Y(),[a,o]=(0,X.useState)(null),[s,c]=(0,X.useState)({});async function l(e){if(a===e._id){o(null);return}if(!s[e._id]){let n=await t({feedbackId:e._id});c(t=>({...t,[e._id]:n}))}o(e._id)}async function u(e){await i({title:r(),description:v(),confirmLabel:O(),destructive:!0})&&(await n({feedbackId:e._id}),a===e._id&&o(null))}return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`p`,{className:`oc-admin__hint`,children:[b(),` `,(0,Z.jsx)(`strong`,{children:pe()}),` `,N()]}),(0,Z.jsx)(ve,{title:me(),rows:e,emptyHint:de(),isExpanded:e=>a===e._id&&!!s[e._id],renderExpanded:e=>s[e._id]?(0,Z.jsx)(be,{data:s[e._id],reference:e.reference,closeReason:e.userCloseReason}):null,columns:[{header:R(),cell:e=>_e(e.at),sort:e=>e.at},{header:z(),cell:e=>Q(e.category),sort:e=>Q(e.category)},{header:W(),cell:e=>e.messageRole===`user`?K():L(),sort:e=>e.messageRole},{header:F(),cell:e=>(e.reporterEmail||e.reporterName||`—`)+(e.impersonated&&e.realOperatorEmail?` ${ue({operator:e.realOperatorEmail})}`:``),sort:e=>e.reporterEmail||e.reporterName||null},{header:U(),cell:e=>(0,Z.jsx)($,{matches:e.displayedMatchesStored,sourceWasOpen:e.sourceWasOpen}),sort:e=>e.displayedMatchesStored===!1?0:e.displayedMatchesStored===!0?1:2},{header:P(),cell:e=>e.hasComment?`✎`:`—`,sort:e=>+!!e.hasComment},{header:ce(),cell:e=>e.userClosedAt==null?e.resolvedAt==null?e.answered?(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-ok`,children:G()}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill`,children:M()}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-ok`,title:e.resolvedBy??void 0,children:D()}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-closed`,children:B()}),sort:e=>e.userClosedAt==null?e.resolvedAt==null?+!!e.answered:2:3}],rowActions:e=>[{label:a===e._id?oe():le(),onSelect:()=>void l(e)},{label:I(),onSelect:()=>void u(e),variant:`destructive`}]})]})}export{xe as FeedbacksTab};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./bundle-mjs-C73ZY4La.js";import{E as t,
|
|
1
|
+
import{r as e}from"./bundle-mjs-C73ZY4La.js";import{E as t,XX as n}from"./api--rqKQo-l.js";import{B as r,R as i,V as a,mn as o,pn as s,z as c}from"./index-l7elBM2O.js";import"./locales-CPjguROj.js";import"./curation-CQksaIbm.js";var l=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`}]]),u=[`gateway-http`,`shared-fs`,`off`],d=[`inline`,`shared-fs`],f=[`reactive`,`sse`],p=`reactive`;n.object({mediaMode:n.optional(n.union(n.literal(`gateway-http`),n.literal(`shared-fs`),n.literal(`off`))),inboundMediaMode:n.optional(n.union(n.literal(`inline`),n.literal(`shared-fs`))),rehydration:n.optional(n.boolean()),mediaMaxMb:n.optional(n.number()),attachmentFixAttested:n.optional(n.boolean()),summarizeThresholdChars:n.optional(n.number()),curationEnabled:n.optional(n.boolean()),curationBudgetChars:n.optional(n.number()),converterAgentId:n.optional(n.string()),voiceEnabled:n.optional(n.boolean()),talkEnabled:n.optional(n.boolean()),widgetsEnabled:n.optional(n.boolean()),widgetPromptConfirm:n.optional(n.boolean()),voiceEngine:n.optional(n.union(n.literal(`browser`),n.literal(`gateway`))),voiceLang:n.optional(n.string()),voiceRate:n.optional(n.number()),voiceAutoRead:n.optional(n.boolean()),contentLocale:n.optional(n.string()),inboundAgentMount:n.optional(n.string()),outboundAgentMount:n.optional(n.string()),transcriptProjection:n.optional(n.union(n.literal(`off`),n.literal(`shadow`),n.literal(`on`))),promptInjections:n.optional(n.record(n.string(),n.object({enabled:n.optional(n.boolean()),template:n.optional(n.string())})))});var m={mediaMode:`gateway-http`,inboundMediaMode:`inline`,rehydration:!0,mediaMaxMb:1024,inboundAgentMount:`/home/node/.openclaw/media/inbound`,outboundAgentMount:`/home/node/.openclaw/media/outbound`};function h(e,t){let n={};for(let r of o){let i=e?.[r];n[r]={enabled:i?.enabled??!0,template:typeof i?.template==`string`&&i.template.length>0?i.template:s[r].defaultTemplate[t]}}return n}function g(e,t){let n={};for(let r of o){let i=s[r],a=e[r];if(!a)continue;let o={};i.togglable&&a.enabled===!1&&(o.enabled=!1);let c=a.template.trim();c.length>0&&c!==i.defaultTemplate[t]&&(o.template=c),(o.enabled!==void 0||o.template!==void 0)&&(n[r]=o)}return n}function _(e,t){return{mediaMode:e.mediaMode??m.mediaMode,inboundMediaMode:e.inboundMediaMode??m.inboundMediaMode,rehydration:e.rehydration??m.rehydration,mediaMaxMb:e.mediaMaxMb??m.mediaMaxMb,inboundAgentMount:e.inboundAgentMount??m.inboundAgentMount,outboundAgentMount:e.outboundAgentMount??m.outboundAgentMount,promptInjections:h(e.promptInjections,t)}}var v=[`attachmentFixAttested`,`summarizeThresholdChars`,`curationEnabled`,`curationBudgetChars`,`contentLocale`,`converterAgentId`,`voiceEnabled`,`talkEnabled`,`voiceEngine`,`voiceLang`,`voiceRate`,`voiceAutoRead`,`widgetsEnabled`,`widgetPromptConfirm`,`transcriptProjection`];function y(e,t,n){let r={},i=n=>{(e[n]!==m[n]||t[n]!==void 0)&&(r[n]=e[n])};i(`mediaMode`),i(`inboundMediaMode`),i(`rehydration`),i(`mediaMaxMb`),i(`inboundAgentMount`),i(`outboundAgentMount`);let a=g(e.promptInjections,n);Object.keys(a).length>0&&(r.promptInjections=a);let o=t;for(let e of v){let t=o[e];(typeof t==`number`||typeof t==`boolean`||typeof t==`string`)&&(r[e]=t)}return r}var b=e();function x({text:e}){return(0,b.jsx)(r,{delayDuration:150,children:(0,b.jsxs)(i,{children:[(0,b.jsx)(a,{asChild:!0,children:(0,b.jsx)(`button`,{type:`button`,className:`oc-field__help`,"aria-label":e,onClick:e=>e.preventDefault(),children:(0,b.jsx)(l,{"aria-hidden":!0})})}),(0,b.jsx)(c,{className:`max-w-xs text-pretty`,children:e})]})})}function S({label:e,help:t}){return(0,b.jsxs)(`span`,{className:`oc-field__label`,children:[e,(0,b.jsx)(x,{text:t})]})}export{p as a,f as c,_ as i,S as n,d as o,y as r,u as s,x as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$Y as r,AY as ee,BY as i,CY as te,DY as a,EY as ne,FX as re,FY as ie,GY as ae,HX as o,HY as s,IY as c,JY as l,KY as u,LY as d,MY as oe,NX as se,NY as ce,OY as le,PY as ue,QY as de,RY as f,SY as fe,TY as pe,UX as me,UY as p,VY as m,WV as he,WY as ge,XY as h,YY as _e,ZY as g,bY as ve,eX as ye,ep as be,jY as xe,kY as Se,qY as _,t as v,tp as y,wY as b,xY as x,yY as S,zY as C}from"./api--rqKQo-l.js";import{t as w}from"./button-HksxbiUF.js";import{An as T,Bt as E,Gt as D,Ht as O,In as k,Jt as A,Kt as j,Mt as Ce,St as M,Ut as we,Vt as Te,Wt as Ee,Yt as De,an as Oe,bt as N,en as ke,nn as P,nr as F,qt as Ae,tn as je,tr as Me,vt as I,xt as L,yt as R}from"./index-l7elBM2O.js";import{a as Ne,i as z,n as Pe,o as B,r as V,t as Fe}from"./table-CwhkOFwK.js";var H=t(e(),1),U=n(),W=`all`;function G(e){switch(e){case`image`:return p();case`audio`:return s();case`video`:return m();case`pdf`:return i();case`document`:return C();case`archive`:return f();default:return d()}}function K(){let[e,t]=(0,H.useState)(W),[n,i]=(0,H.useState)(W),[s,d]=(0,H.useState)(W),[f,p]=(0,H.useState)(W),[m,C]=(0,H.useState)(!1),[K,q]=(0,H.useState)(null),J=o(v.files.softDelete),Y=De();function Ie(){t(W),i(W),d(W),p(W)}async function Le(){let e=K;if(q(null),e)try{await J({fileId:e.id}),Y.success(ne())}catch(e){Y.error(pe(),e)}}let X=me(v.files.listMine,{direction:e===W?void 0:e,chatId:n===W?void 0:n,instanceName:s===W?void 0:s,category:f===W?void 0:f,includeAutoGenerated:m||void 0}),Re=(0,H.useMemo)(()=>new Intl.DateTimeFormat(re(),{dateStyle:`medium`,timeStyle:`short`}),[]);if(X===void 0)return(0,U.jsx)(`p`,{className:`oc-admin__hint`,children:se()});let{files:Z,facets:Q,truncated:ze,cap:Be}=X,$=e!==W||n!==W||s!==W||f!==W;return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`p`,{className:`oc-admin__hint`,children:ye()}),(0,U.jsxs)(`div`,{className:`oc-files__filters`,style:{display:`flex`,flexWrap:`wrap`,gap:8,margin:`12px 0`},children:[(0,U.jsxs)(I,{value:e,onValueChange:t,children:[(0,U.jsx)(L,{size:`sm`,"aria-label":r(),children:(0,U.jsx)(M,{})}),(0,U.jsxs)(R,{children:[(0,U.jsx)(N,{value:W,children:de()}),(0,U.jsx)(N,{value:`inbound`,children:g()}),(0,U.jsx)(N,{value:`outbound`,children:h()})]})]}),(0,U.jsxs)(I,{value:n,onValueChange:i,children:[(0,U.jsx)(L,{size:`sm`,"aria-label":_e(),children:(0,U.jsx)(M,{})}),(0,U.jsxs)(R,{children:[(0,U.jsx)(N,{value:W,children:l()}),Q.chats.map(e=>(0,U.jsx)(N,{value:e.id,children:e.title},e.id))]})]}),Q.multiProvider?(0,U.jsxs)(I,{value:s,onValueChange:d,children:[(0,U.jsx)(L,{size:`sm`,"aria-label":_(),children:(0,U.jsx)(M,{})}),(0,U.jsxs)(R,{children:[(0,U.jsx)(N,{value:W,children:u()}),Q.instances.map(e=>(0,U.jsx)(N,{value:e,children:e},e))]})]}):null,(0,U.jsxs)(I,{value:f,onValueChange:p,children:[(0,U.jsx)(L,{size:`sm`,"aria-label":ae(),children:(0,U.jsx)(M,{})}),(0,U.jsxs)(R,{children:[(0,U.jsx)(N,{value:W,children:ge()}),Q.categories.map(e=>(0,U.jsx)(N,{value:e,children:G(e)},e))]})]}),(0,U.jsxs)(`label`,{className:`oc-files__autogen`,children:[(0,U.jsx)(Ce,{checked:m,onCheckedChange:e=>C(e===!0),"aria-label":y()}),(0,U.jsx)(`span`,{children:y()})]}),$?(0,U.jsxs)(w,{variant:`ghost`,size:`sm`,onClick:Ie,style:{display:`inline-flex`,alignItems:`center`,gap:4,marginLeft:`auto`},children:[(0,U.jsx)(k,{size:14,"aria-hidden":!0}),Se()]}):null]}),Z.length===0?(0,U.jsx)(`p`,{className:`oc-admin__hint`,children:$?ve():x()}):(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(Fe,{children:[(0,U.jsx)(Ne,{children:(0,U.jsxs)(B,{children:[(0,U.jsx)(z,{children:c()}),(0,U.jsx)(z,{children:ie()}),(0,U.jsx)(z,{children:ue()}),(0,U.jsx)(z,{children:ce()}),(0,U.jsx)(z,{children:oe()}),(0,U.jsx)(z,{className:`text-right`,children:xe()})]})}),(0,U.jsx)(Pe,{children:Z.map(e=>(0,U.jsxs)(B,{children:[(0,U.jsxs)(V,{className:`font-medium`,style:{maxWidth:280,overflow:`hidden`,textOverflow:`ellipsis`},title:e.filename,children:[e.filename,e.origin===`pasted`?(0,U.jsx)(A,{variant:`outline`,style:{marginLeft:6},children:be()}):null]}),(0,U.jsx)(V,{title:e.mimeType,children:G(e.category)}),(0,U.jsx)(V,{children:(0,U.jsx)(A,{variant:`secondary`,children:e.direction===`inbound`?g():h()})}),(0,U.jsx)(V,{style:{maxWidth:220,overflow:`hidden`,textOverflow:`ellipsis`},title:e.chatTitle,children:e.chatTitle}),(0,U.jsx)(V,{className:`whitespace-nowrap text-muted-foreground`,children:Re.format(e.createdAt)}),(0,U.jsx)(V,{className:`text-right`,children:(0,U.jsxs)(ke,{children:[(0,U.jsx)(Oe,{asChild:!0,children:(0,U.jsx)(w,{variant:`ghost`,size:`icon`,"aria-label":le(),children:(0,U.jsx)(Me,{size:16})})}),(0,U.jsxs)(je,{align:`end`,children:[e.url?(0,U.jsx)(P,{asChild:!0,children:(0,U.jsxs)(`a`,{href:e.url,download:e.filename,target:`_blank`,rel:`noopener noreferrer`,children:[(0,U.jsx)(F,{size:14}),ee()]})}):(0,U.jsxs)(P,{disabled:!0,children:[(0,U.jsx)(F,{size:14}),fe()]}),(0,U.jsxs)(P,{variant:`destructive`,onSelect:()=>q({id:e._id,filename:e.filename}),children:[(0,U.jsx)(T,{size:14}),a()]})]})]})})]},e._id))})]}),ze?(0,U.jsx)(`p`,{className:`oc-admin__hint`,style:{marginTop:8},children:S({cap:Be})}):null]}),(0,U.jsx)(E,{open:K!==null,onOpenChange:e=>!e&&q(null),children:(0,U.jsxs)(we,{children:[(0,U.jsxs)(j,{children:[(0,U.jsx)(Ae,{children:b()}),(0,U.jsx)(Ee,{children:te()})]}),(0,U.jsxs)(D,{children:[(0,U.jsx)(O,{children:he()}),(0,U.jsx)(Te,{onClick:()=>void Le(),children:a()})]})]})})]})}export{K as FilesTab};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{CC as r,wC as i}from"./api-
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{CC as r,wC as i}from"./api--rqKQo-l.js";import{t as a}from"./button-HksxbiUF.js";import{$t as o,Fn as s,In as c}from"./index-l7elBM2O.js";import{t as l}from"./TimeRangePicker-CSLm7VwE.js";var u=t(e(),1),d=n(),f=250;function p({q:e,onQChange:t,searchPlaceholder:n=i(),children:p,timeRange:m,onTimeRangeChange:h,onReset:g,canReset:_=!0}){let[v,y]=(0,u.useState)(e);(0,u.useEffect)(()=>{y(e)},[e]);let b=(0,u.useRef)(null);function x(e){y(e),b.current!==null&&window.clearTimeout(b.current),b.current=window.setTimeout(()=>t(e),f)}(0,u.useEffect)(()=>()=>{b.current!==null&&window.clearTimeout(b.current)},[]);function S(){b.current!==null&&window.clearTimeout(b.current),g()}return(0,d.jsxs)(`div`,{className:`oc-filterbar`,children:[(0,d.jsxs)(`div`,{className:`oc-filterbar__search`,children:[(0,d.jsx)(s,{className:`oc-filterbar__search-icon`,"aria-hidden":!0}),(0,d.jsx)(o,{value:v,onChange:e=>x(e.target.value),placeholder:n,"aria-label":n})]}),p?(0,d.jsx)(`div`,{className:`oc-filterbar__quick`,children:p}):null,m&&h?(0,d.jsx)(l,{value:m,onChange:h}):null,(0,d.jsxs)(a,{variant:`ghost`,size:`sm`,className:`oc-filterbar__reset`,onClick:S,disabled:!_,children:[(0,d.jsx)(c,{}),r()]})]})}export{p as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$b as r,$y as i,Ab as a,Ay as o,Bb as s,By as c,Cb as l,Cx as u,Cy as d,Db as f,Dy as p,E as m,Eb as h,Ey as g,Fb as _,Fy as v,Gy as y,HX as b,Hb as x,Hy as S,Ib as C,Iy as ee,Jb as w,Jy as T,Kb as E,Ky as D,Lb as O,Ly as k,Mb as te,My as A,Nb as ne,Ny as j,Ob as M,Oy as re,Pb as ie,Py as N,Qb as ae,Qy as oe,Rb as se,Ry as ce,Sb as le,Sx as P,Sy as ue,Tb as de,Ty as F,Uy as fe,VX as I,Vb as L,Vy as pe,Wy as me,Xb as he,Xy as ge,Yb as R,Yy as _e,Zb as ve,Zy as ye,_b as z,_x as be,ax as xe,bb as B,bx as Se,by as Ce,cb as we,cx as Te,db as Ee,dx as De,dy as Oe,eb as ke,ex as Ae,fb as je,fx as Me,fy as Ne,gb as Pe,gx as Fe,hb as Ie,hx as Le,ix as Re,jb as ze,jy as Be,kb as Ve,ky as He,lb as Ue,lx as We,mb as Ge,mx as Ke,my as qe,nb as Je,nx as Ye,ox as Xe,pb as Ze,px as Qe,py as $e,qb as et,qy as tt,rb as nt,rx as rt,sb as it,sx as at,t as V,tb as ot,tx as st,ub as ct,ux as lt,vb as ut,vx as dt,wb as ft,wx as pt,wy as mt,xb as ht,xx as gt,xy as _t,yb as vt,yx as yt,zb as bt,zy as xt}from"./api-Ca1H8N44.js";import{t as St}from"./x-BvlIg0Y4.js";import{t as H}from"./button-BbEZKLza.js";import{$ as Ct,$t as U,Ct as wt,Dn as Tt,Dt as Et,En as Dt,G as Ot,J as W,Jt as G,K as kt,Mn as At,Mt as K,Nn as jt,Ot as Mt,Pn as Nt,Q as Pt,St as Ft,Tt as It,W as q,X as Lt,Y as Rt,Yt as J,Z as zt,at as Bt,b as Vt,bt as Ht,cr as Ut,ct as Wt,et as Gt,ft as Kt,it as qt,jn as Y,ot as Jt,q as Yt,sr as Xt,st as Zt,vt as Qt,wt as $t,xt as en,yt as tn}from"./index-Wii4FZxb.js";import{t as nn}from"./FilterBar-BrdWP0oO.js";import{t as rn}from"./DataTableShell-BUYroEsA.js";import{t as X}from"./DetailChips-Zknkp3Iu.js";var an=m(`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=t(e(),1),Q=n(),on={name:``,description:``};function sn(){let e=b(V.groups.listGroups,{}),t=b(V.me.getMe,{host:Kt})?.role===`admin`,n=I(V.groups.createGroup),r=I(V.groups.updateGroup),i=I(V.groups.deleteGroup),a=Wt(),o=J(),[s,c]=(0,Z.useState)(!1),[l,d]=(0,Z.useState)(null),[f,p]=(0,Z.useState)(on),[m,h]=(0,Z.useState)(null),[g,_]=(0,Z.useState)(``),v=(0,Z.useMemo)(()=>{if(!e)return e;let t=g.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,g]);function y(){d(null),p(on),c(!0)}function x(e){d(e),p({name:e.name,description:e.description??``}),c(!0)}async function S(){try{l?await r({groupId:l._id,name:f.name,description:f.description}):await n({name:f.name,description:f.description||void 0}),p(on),d(null),c(!1)}catch(e){o.error(vt(),e)}}async function C(e){if(await a({title:xe({name:e.name}),description:Re(),confirmWord:e.name,confirmLabel:rt(),cancelLabel:De(),destructive:!0}))try{await i({groupId:e._id})}catch(e){o.error(ut(),e)}}return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:u()}),t?(0,Q.jsx)(pn,{}):null,(0,Q.jsx)(nn,{q:g,onQChange:_,onReset:()=>_(``),canReset:g!==``,searchPlaceholder:Fe()}),(0,Q.jsx)(rn,{title:pt(),rows:v,addLabel:P(),onAdd:t?y:void 0,emptyHint:gt(),columns:[{header:Se(),cell:e=>e.name,sort:e=>e.name},{header:yt(),cell:e=>(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(X,{icon:(0,Q.jsx)(Dt,{size:12,"aria-hidden":!0}),total:e.memberCount,items:e.members.map(e=>({label:e.label,marker:e.manager?(0,Q.jsx)(jt,{size:11,"aria-hidden":!0}):null,highlight:e.manager}))}),e.pendingInviteCount>0?(0,Q.jsx)(G,{variant:`secondary`,children:it({count:String(e.pendingInviteCount)})}):null]}),sort:e=>e.memberCount},{header:dt(),cell:e=>(0,Q.jsx)(X,{icon:(0,Q.jsx)(Nt,{size:12,"aria-hidden":!0}),total:e.agentCount,items:e.agents.map(e=>({label:e}))}),sort:e=>e.agentCount},{header:be(),cell:e=>(0,Q.jsx)(X,{icon:(0,Q.jsx)(an,{size:12,"aria-hidden":!0}),total:e.chartCount,items:e.charts.map(e=>({label:e.name,marker:e.isDefault?(0,Q.jsx)(Y,{size:11,fill:`currentColor`,"aria-hidden":!0}):null,highlight:e.isDefault}))}),sort:e=>e.chartCount}],rowActions:e=>[{label:Le(),onSelect:()=>h({groupId:e._id,name:e.name})},...t?[{label:Ke(),onSelect:()=>x(e)},{label:Qe(),variant:`destructive`,onSelect:()=>void C(e)}]:[]]}),(0,Q.jsx)(Vt,{open:s,onOpenChange:c,title:l?We():lt(),description:Te(),canSubmit:!!f.name.trim(),onSubmit:S,submitLabel:Me(),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:at()}),(0,Q.jsx)(U,{value:f.name,onChange:e=>p({...f,name:e.target.value})})]}),(0,Q.jsxs)(`label`,{className:`oc-field`,children:[(0,Q.jsx)(`span`,{className:`oc-field__label`,children:Xe()}),(0,Q.jsx)(U,{value:f.description,onChange:e=>p({...f,description:e.target.value})})]})]})}),(0,Q.jsx)(ln,{groupId:m?.groupId??null,groupName:m?.name??``,open:m!==null,onOpenChange:e=>{e||h(null)}})]})}var cn=8;function $({page:e,pageCount:t,onPage:n}){return t<=1?null:(0,Q.jsxs)(`div`,{className:`oc-access__pager`,children:[(0,Q.jsxs)(H,{type:`button`,variant:`ghost`,size:`sm`,disabled:e<=1,onClick:()=>n(e-1),children:[(0,Q.jsx)(Ut,{size:14,"aria-hidden":!0}),w()]}),(0,Q.jsxs)(`span`,{className:`oc-access__pageinfo`,"aria-label":E({page:e,pages:t}),children:[e,` / `,t]}),(0,Q.jsxs)(H,{type:`button`,variant:`ghost`,size:`sm`,disabled:e>=t,onClick:()=>n(e+1),children:[et(),(0,Q.jsx)(Xt,{size:14,"aria-hidden":!0})]})]})}function ln({groupId:e,groupName:t,open:n,onOpenChange:a}){let o=b(V.groups.getGroup,n&&e?{groupId:e}:`skip`),c=o?.viewerIsAdmin===!0,u=b(V.groups.listAssignableInstances,n&&e?{groupId:e}:`skip`),d=b(V.groups.listAssignableUsers,n&&c?{}:`skip`),f=I(V.groups.addMember),p=I(V.groups.removeMember),m=I(V.groups.bulkSetMembers),h=I(V.groups.setGroupManager),g=J(),[_,v]=(0,Z.useState)(``),[y,C]=(0,Z.useState)(``),[ee,w]=(0,Z.useState)(`members`),[T,E]=(0,Z.useState)(1),[D,k]=(0,Z.useState)(null),[A,ne]=(0,Z.useState)(new Set),j=(0,Z.useRef)(null),M=(0,Z.useMemo)(()=>new Set((o?.members??[]).map(e=>e.userId)),[o]),re=(0,Z.useMemo)(()=>new Set((o?.members??[]).filter(e=>e.manager).map(e=>e.userId)),[o]),ie=(0,Z.useMemo)(()=>new Set((o?.members??[]).filter(e=>e.restricted).map(e=>e.userId)),[o]),N=(0,Z.useMemo)(()=>new Set((o?.agents??[]).map(e=>q(e.instanceName,e.agentId))),[o]),ce=(0,Z.useMemo)(()=>{let e=(o?.agents??[]).find(e=>e.isDefault);return e?q(e.instanceName,e.agentId):null},[o]);(0,Z.useEffect)(()=>{v(``),C(``),w(`members`),E(1),k(null),j.current=null},[n,e]),(0,Z.useEffect)(()=>{E(1)},[_]),(0,Z.useEffect)(()=>{n&&o&&e&&j.current!==e&&(j.current=e,ne(new Set((o.members??[]).map(e=>e.userId))))},[n,o,e]);let P=(0,Z.useMemo)(()=>d?Yt(d,_,A):[],[d,_,A]);async function ue(t,n){if(e)try{n?await p({groupId:e,userId:t}):await f({groupId:e,userId:t})}catch(e){g.error(z(),W(e))}}async function de(t,n){if(e)try{await h({groupId:e,userId:t,manager:!n})}catch(e){g.error(ht(),e)}}let F=Ct(P,e=>M.has(e.userId)),fe=P.filter(e=>M.has(e.userId)).length,L=zt(P,T,cn);async function pe(){if(!e||P.length===0)return;let t=P.map(e=>e.userId);try{await m({groupId:e,userIds:t,member:F!==`all`})}catch(e){g.error(z(),W(e))}}let me=(e,t)=>(0,Q.jsxs)(H,{type:`button`,variant:`ghost`,size:`sm`,className:`h-7`,"aria-label":oe({user:t}),title:oe({user:t}),onClick:()=>k({userId:e,label:t}),children:[(0,Q.jsx)(At,{size:13,"aria-hidden":!0}),i()]});return(0,Q.jsx)(wt,{open:n,onOpenChange:a,children:(0,Q.jsxs)($t,{className:`oc-access`,children:[(0,Q.jsxs)(Et,{children:[(0,Q.jsx)(Mt,{children:Ye({name:t})}),(0,Q.jsx)(It,{children:o&&!c?Ie():st()})]}),(0,Q.jsxs)(qt,{value:ee,onValueChange:w,className:`oc-access__tabs`,children:[(0,Q.jsxs)(Jt,{className:`w-full`,children:[(0,Q.jsxs)(Zt,{value:`members`,className:`flex-1 gap-1.5`,children:[(0,Q.jsx)(Dt,{size:13,"aria-hidden":!0}),Ae(),o?(0,Q.jsx)(G,{variant:`secondary`,className:`oc-access__tabcount`,children:M.size}):null]}),(0,Q.jsxs)(Zt,{value:`agents`,className:`flex-1 gap-1.5`,children:[(0,Q.jsx)(Nt,{size:13,"aria-hidden":!0}),ae(),o?(0,Q.jsx)(G,{variant:`secondary`,className:`oc-access__tabcount`,children:N.size}):null]}),(0,Q.jsxs)(Zt,{value:`charts`,className:`flex-1 gap-1.5`,children:[(0,Q.jsx)(an,{size:13,"aria-hidden":!0}),te(),o?(0,Q.jsx)(G,{variant:`secondary`,className:`oc-access__tabcount`,children:o.chartCount}):null]})]}),(0,Q.jsx)(Bt,{value:`members`,children:o===void 0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:s()}):c?d===void 0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:s()}):d.length===0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:se()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(U,{value:_,onChange:e=>v(e.target.value),placeholder:r(),className:`oc-access__search`}),P.length===0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:he()}):(0,Q.jsxs)(Q.Fragment,{children:[P.length>1?(0,Q.jsxs)(`div`,{className:`oc-access__row oc-access__selectall`,children:[(0,Q.jsx)(K,{checked:F===`all`?!0:F===`some`?`indeterminate`:!1,onCheckedChange:()=>void pe(),"aria-label":R()}),(0,Q.jsx)(`span`,{className:`oc-access__label`,children:R()}),(0,Q.jsxs)(G,{variant:`outline`,className:`oc-access__count`,children:[fe,` / `,P.length]})]}):null,(0,Q.jsx)(`div`,{className:`oc-access__list`,children:L.pageItems.map(e=>{let t=M.has(e.userId),n=Gt(e),r=re.has(e.userId);return(0,Q.jsxs)(`div`,{className:`oc-access__row`,children:[(0,Q.jsx)(K,{checked:t,onCheckedChange:()=>void ue(e.userId,t),"aria-label":x({user:n.primary})}),(0,Q.jsxs)(`span`,{className:`oc-access__who`,children:[(0,Q.jsx)(`span`,{className:`oc-access__label`,title:n.primary,children:n.primary}),n.secondary?(0,Q.jsx)(`span`,{className:`oc-access__sub`,title:n.secondary,children:n.secondary}):null]}),t&&ie.has(e.userId)?(0,Q.jsx)(G,{variant:`outline`,className:`oc-access__role`,children:ye()}):null,(0,Q.jsx)(G,{variant:`outline`,className:`oc-access__role`,children:Pt(e.role)}),t?me(e.userId,n.primary):null,(0,Q.jsx)(`span`,{className:`oc-access__mgrslot`,children:t?(0,Q.jsx)(H,{type:`button`,variant:`ghost`,size:`icon`,className:`shrink-0 oc-access__mgr${r?` oc-access__mgr--on`:``}`,"aria-pressed":r,"aria-label":r?le():l(),title:r?le():l(),onClick:()=>void de(e.userId,r),children:(0,Q.jsx)(jt,{size:15,"aria-hidden":!0})}):null})]},e._id)})}),(0,Q.jsx)($,{page:L.page,pageCount:L.pageCount,onPage:E})]})]}):e?(0,Q.jsx)(un,{groupId:e,members:o.members,agentsButton:me}):null}),(0,Q.jsxs)(Bt,{value:`agents`,children:[o&&!c?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:S()}):null,u===void 0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:s()}):u.length===0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:O()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(U,{value:y,onChange:e=>C(e.target.value),placeholder:ve(),className:`oc-access__search`}),(0,Q.jsx)(`div`,{className:`oc-access__list`,children:u.map(t=>(0,Q.jsx)(fn,{groupId:e,instanceName:t.name,kind:t.kind??`openclaw`,assigned:N,defaultKey:ce,viewerIsAdmin:c,query:y},`${e}-${t._id}`))})]})]}),(0,Q.jsx)(Bt,{value:`charts`,children:(0,Q.jsx)(mn,{groupId:e})})]}),(0,Q.jsx)(dn,{groupId:e,member:D,onOpenChange:e=>{e||k(null)}})]})})}function un({groupId:e,members:t,agentsButton:n}){let r=b(V.groupInvites.listGroupInviteRequests,{groupId:e}),i=I(V.groupInvites.requestGroupInvite),a=I(V.groups.removeMember),o=Wt(),s=J(),[c,l]=(0,Z.useState)(``),[u,d]=(0,Z.useState)(1),f=zt(t,u,cn);async function p(t){t.preventDefault();let n=c.trim();if(n)try{await i({groupId:e,email:n}),l(``),s.success(ct())}catch(e){s.error(Ue(),e)}}async function m(t,n){if(await o({title:nt({user:n}),description:ot({user:n}),confirmLabel:ke(),cancelLabel:De(),destructive:!0}))try{await a({groupId:e,userId:t})}catch(e){s.error(z(),W(e))}}return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`form`,{className:`oc-access__invite`,onSubmit:e=>void p(e),children:[(0,Q.jsx)(U,{type:`email`,value:c,onChange:e=>l(e.target.value),placeholder:je(),"aria-label":Ge()}),(0,Q.jsxs)(H,{type:`submit`,size:`sm`,disabled:!c.trim(),children:[(0,Q.jsx)(Tt,{size:14,"aria-hidden":!0}),Ee()]})]}),(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:Ze()}),t.length===0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:ge()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`div`,{className:`oc-access__list`,children:f.pageItems.map(e=>(0,Q.jsxs)(`div`,{className:`oc-access__row`,children:[(0,Q.jsx)(`span`,{className:`oc-access__label`,title:e.label,children:e.label}),e.restricted?(0,Q.jsx)(G,{variant:`outline`,className:`oc-access__role`,children:ye()}):null,n(e.userId,e.label),(0,Q.jsx)(`span`,{className:`oc-access__mgrslot`,children:e.manager?(0,Q.jsx)(`span`,{className:`oc-access__mgr oc-access__mgr--on`,role:`img`,"aria-label":ft(),title:ft(),children:(0,Q.jsx)(jt,{size:15,"aria-hidden":!0})}):null}),(0,Q.jsx)(H,{type:`button`,variant:`ghost`,size:`icon-sm`,disabled:e.manager||e.lastGroup,"aria-label":nt({user:e.label}),title:e.manager?Je():e.lastGroup?Ce():nt({user:e.label}),onClick:()=>void m(e.userId,e.label),children:(0,Q.jsx)(St,{size:14,"aria-hidden":!0})})]},e.userId))}),(0,Q.jsx)($,{page:f.page,pageCount:f.pageCount,onPage:d})]}),r!==void 0&&r.length>0?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`p`,{className:`oc-access__subhead`,children:we()}),(0,Q.jsx)(`div`,{className:`oc-access__list`,children:r.map(e=>(0,Q.jsxs)(`div`,{className:`oc-access__row`,children:[(0,Q.jsx)(`span`,{className:`oc-access__label`,title:e.email,children:e.email}),(0,Q.jsx)(G,{variant:e.status===`pending`?`secondary`:`outline`,className:`oc-access__role`,children:Rt(e.status)})]},e._id))})]}):null]})}function dn({groupId:e,member:t,onOpenChange:n}){let r=b(V.groups.getMemberAgentSettings,e&&t?{groupId:e,userId:t.userId}:`skip`),i=I(V.groups.setMemberAgents),a=I(V.groups.setMemberDefaultAgent),c=J();async function l(e){try{await e()}catch(e){c.error(_t(),e)}}let u=r?.agents??[],f=new Map(u.map(e=>[q(e.instanceName,e.agentId),e])),m=[...f.keys()],h=new Set(u.filter(e=>e.allowed).map(e=>q(e.instanceName,e.agentId)));function _(n){if(!e||!t||!r)return;let a=Lt(m,h,r.restricted,n).map(e=>{let t=f.get(e);return{instanceName:t.instanceName,agentId:t.agentId}});l(()=>i({groupId:e,userId:t.userId,agents:a}))}return(0,Q.jsx)(wt,{open:t!==null,onOpenChange:n,children:(0,Q.jsxs)($t,{className:`oc-access`,children:[(0,Q.jsxs)(Et,{children:[(0,Q.jsx)(Mt,{children:o({user:t?.label??``})}),(0,Q.jsx)(It,{children:He()})]}),r===void 0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:s()}):r===null||u.length===0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:ue()}):(0,Q.jsxs)(Q.Fragment,{children:[r.settable?null:(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:Oe()}),r.adminNarrowed?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:qe()}):null,r.restrictedByAdmin&&!r.viewerIsAdmin?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:Ne()}):null,(0,Q.jsxs)(`div`,{className:`oc-access__row oc-access__selectall`,children:[(0,Q.jsx)(`span`,{className:`oc-access__label`,children:r.restricted?p():re()}),r.restricted?(0,Q.jsx)(H,{type:`button`,size:`sm`,variant:`outline`,disabled:!r.settable||r.restrictedByAdmin&&!r.viewerIsAdmin,onClick:()=>e&&t?void l(()=>i({groupId:e,userId:t.userId,agents:null})):void 0,children:g()}):null]}),(0,Q.jsx)(`div`,{className:`oc-access__list`,children:u.map(n=>{let i=q(n.instanceName,n.agentId),o=n.displayName??n.agentId;return(0,Q.jsxs)(`div`,{className:`oc-access__row`,children:[(0,Q.jsx)(K,{checked:n.allowed,disabled:!r.settable||r.restrictedByAdmin&&!r.viewerIsAdmin&&!n.allowed,onCheckedChange:()=>_(i),"aria-label":F({name:o})}),(0,Q.jsx)(`span`,{className:`oc-access__label`,title:o,children:o}),n.limitedByAdmin?(0,Q.jsx)(G,{variant:`outline`,className:`oc-access__role`,children:$e()}):null,n.state===`deleted`?(0,Q.jsx)(G,{variant:`outline`,className:`oc-access__gone`,children:ne()}):null,n.allowed?n.isMemberDefault?(0,Q.jsx)(H,{type:`button`,size:`icon-sm`,variant:`ghost`,className:`oc-access__fav`,disabled:!r.settable,"aria-label":mt(),title:mt(),onClick:()=>e&&t?void l(()=>a({groupId:e,userId:t.userId,agent:null})):void 0,children:(0,Q.jsx)(Y,{size:14,fill:`currentColor`})}):(0,Q.jsx)(H,{type:`button`,size:`icon-sm`,variant:`ghost`,className:`oc-access__setdefault`,disabled:!r.settable,"aria-label":d(),title:d(),onClick:()=>e&&t?void l(()=>a({groupId:e,userId:t.userId,agent:{instanceName:n.instanceName,agentId:n.agentId}})):void 0,children:(0,Q.jsx)(Y,{size:14})}):null]},i)})})]})]})})}function fn({groupId:e,instanceName:t,kind:n,assigned:r,defaultKey:i,viewerIsAdmin:a,query:o}){let s=b(V.groups.listAssignableAgents,e?{instanceName:t,groupId:e}:`skip`),l=I(V.groups.assignAgentToGroup),u=I(V.groups.removeAgentFromGroup),d=I(V.groups.bulkSetGroupAgents),f=I(V.groups.claimAgentForGroup),p=I(V.groups.setGroupDefaultAgent),m=J(),[h,g]=(0,Z.useState)(1);if((0,Z.useEffect)(()=>{g(1)},[o]),!e)return null;let y=kt(s?.agents??[],o),x=s?.discovery&&!s.discovery.lastPollOk,S=e=>Ot({assigned:r.has(q(t,e.agentId)),claimable:e.claimable,reservedForGroup:e.reservedForGroup,enabled:e.enabled,present:e.presentInLastOk!==!1},a),w=y.filter(e=>S(e)!==`claim`),T=y.filter(e=>S(e)===`claim`);if(o.trim()&&y.length===0)return null;let E=w.filter(e=>S(e)===`toggle`&&e.presentInLastOk!==!1&&e.enabled!==!1),D=Ct(E,e=>r.has(q(t,e.agentId))),O=zt(w,h,cn);async function te(n,r){try{r?await u({groupId:e,instanceName:t,agentId:n}):await l({groupId:e,instanceName:t,agentId:n})}catch(e){m.error(Pe(),W(e))}}async function M(){if(E.length===0)return;let n=E.map(e=>e.agentId);try{await d({groupId:e,instanceName:t,agentIds:n,assigned:D!==`all`})}catch(e){m.error(Pe(),W(e))}}async function re(n){try{await f({groupId:e,instanceName:t,agentId:n})}catch(e){m.error(k(),e)}}async function ae(n){try{await p({groupId:e,agent:n===null?null:{instanceName:t,agentId:n}})}catch(e){m.error(Be(),e)}}let oe=e=>e.reservedForGroup?(0,Q.jsx)(G,{variant:`outline`,className:`oc-access__role`,children:ee()}):e.reserved?(0,Q.jsx)(G,{variant:`outline`,className:`oc-access__role`,children:e.reservedGroupName===null?N():v({group:e.reservedGroupName})}):null;return(0,Q.jsxs)(`div`,{className:`oc-access__group`,children:[(0,Q.jsxs)(`div`,{className:`oc-access__instance`,children:[(0,Q.jsx)(Nt,{size:13,"aria-hidden":!0}),(0,Q.jsx)(`span`,{children:t}),(0,Q.jsx)(G,{variant:`outline`,className:`oc-access__kind`,children:n}),x?(0,Q.jsx)(G,{variant:`outline`,className:`oc-access__stale`,children:ie()}):null]}),s===void 0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:bt()}):y.length===0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:x?_():C()}):(0,Q.jsxs)(Q.Fragment,{children:[E.length>1?(0,Q.jsxs)(`div`,{className:`oc-access__row oc-access__selectall`,children:[(0,Q.jsx)(K,{checked:D===`all`?!0:D===`some`?`indeterminate`:!1,onCheckedChange:()=>void M(),"aria-label":R()}),(0,Q.jsx)(`span`,{className:`oc-access__label`,children:R()})]}):null,O.pageItems.map(e=>{let n=q(t,e.agentId),a=r.has(n),o=e.presentInLastOk===!1,s=S(e)===`locked`;return(0,Q.jsxs)(`div`,{className:`oc-access__row${s?` is-disabled`:``}`,children:[(0,Q.jsx)(K,{checked:a,disabled:s&&!a,onCheckedChange:()=>void te(e.agentId,a),"aria-label":L({name:e.displayName??e.agentId})}),(0,Q.jsxs)(`span`,{className:`oc-access__label`,title:e.displayName??e.agentId,children:[e.emoji?`${e.emoji} `:``,e.displayName??e.agentId]}),e.model?(0,Q.jsx)(`span`,{className:`oc-access__model`,children:e.model}):null,oe(e),o?(0,Q.jsx)(G,{variant:`outline`,className:`oc-access__gone`,children:ne()}):null,a?i===n?(0,Q.jsx)(H,{type:`button`,size:`icon-sm`,variant:`ghost`,className:`oc-access__fav`,"aria-label":j(),title:j(),onClick:()=>void ae(null),children:(0,Q.jsx)(Y,{size:14,fill:`currentColor`})}):(0,Q.jsx)(H,{type:`button`,size:`icon-sm`,variant:`ghost`,className:`oc-access__setdefault`,"aria-label":A(),title:A(),onClick:()=>void ae(e.agentId),children:(0,Q.jsx)(Y,{size:14})}):null]},e.agentId)}),(0,Q.jsx)($,{page:O.page,pageCount:O.pageCount,onPage:g}),T.length>0?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`p`,{className:`oc-access__subhead`,children:pe()}),(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:c()}),T.map(e=>{let t=e.displayName??e.agentId;return(0,Q.jsxs)(`div`,{className:`oc-access__row`,children:[(0,Q.jsxs)(`span`,{className:`oc-access__label`,title:t,children:[e.emoji?`${e.emoji} `:``,t]}),e.model?(0,Q.jsx)(`span`,{className:`oc-access__model`,children:e.model}):null,(0,Q.jsx)(H,{type:`button`,size:`sm`,variant:`outline`,className:`h-7`,"aria-label":ce({name:t}),onClick:()=>void re(e.agentId),children:xt()})]},e.agentId)})]}):null]})]})}function pn(){let e=b(V.groupInvites.listPendingInviteRequests,{}),t=I(V.groupInvites.decideGroupInvite),n=J();if(e===void 0||e.length===0)return null;async function r(e,r){try{await t({requestId:e,approve:r})}catch(e){n.error(fe(),e)}}return(0,Q.jsxs)(`section`,{className:`oc-invites`,"aria-label":_e(),children:[(0,Q.jsxs)(`h3`,{className:`oc-invites__title`,children:[(0,Q.jsx)(Tt,{size:14,"aria-hidden":!0}),_e(),(0,Q.jsx)(G,{variant:`secondary`,children:e.length})]}),(0,Q.jsx)(`div`,{className:`oc-access__list`,children:e.map(e=>(0,Q.jsxs)(`div`,{className:`oc-access__row`,children:[(0,Q.jsxs)(`span`,{className:`oc-access__who`,children:[(0,Q.jsx)(`span`,{className:`oc-access__label`,title:e.email,children:e.email}),(0,Q.jsxs)(`span`,{className:`oc-access__sub`,children:[e.groupName??`?`,` ·`,` `,T({by:e.requestedBy})]})]}),e.account===`ready`?null:(0,Q.jsx)(G,{variant:`outline`,className:`oc-access__role`,children:e.account===`none`?y():me()}),(0,Q.jsx)(H,{type:`button`,size:`sm`,variant:`outline`,className:`h-7`,disabled:e.account!==`ready`,onClick:()=>void r(e._id,!0),children:tt()}),(0,Q.jsx)(H,{type:`button`,size:`sm`,variant:`ghost`,className:`h-7`,onClick:()=>void r(e._id,!1),children:D()})]},e._id))})]})}function mn({groupId:e}){let t=b(V.charts.listGroupChartSelection,e?{groupId:e}:`skip`),n=I(V.charts.assignChartToGroup),r=I(V.charts.removeChartFromGroup),i=I(V.charts.setGroupDefaultChart),o=I(V.charts.addChartToGroupPool),c=I(V.charts.removeChartFromGroupPool),l=J();if(!e)return null;if(t===void 0)return(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:s()});let{pool:u,addable:d,canManagePool:p}=t;if(u.length===0&&!p)return(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:ze()});async function m(t,i){try{i?await r({groupId:e,chartKey:t}):await n({groupId:e,chartKey:t})}catch(e){l.error(B(),e)}}async function g(t){try{await i({groupId:e,chartKey:t})}catch(e){l.error(B(),e)}}async function _(t){try{await o({groupId:e,chartKey:t})}catch(e){l.error(B(),e)}}async function v(t){try{await c({groupId:e,chartKey:t})}catch(e){l.error(B(),e)}}return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`div`,{className:`oc-access__list`,children:u.map(e=>(0,Q.jsxs)(`div`,{className:`oc-access__row`,children:[(0,Q.jsx)(K,{checked:e.selected,onCheckedChange:()=>void m(e.chartKey,e.selected),"aria-label":f({name:e.name})}),(0,Q.jsx)(`span`,{className:`oc-access__label`,title:e.name,children:e.name}),e.selected?e.isDefault?(0,Q.jsx)(`span`,{className:`oc-access__fav`,role:`img`,"aria-label":h(),title:h(),children:(0,Q.jsx)(Y,{size:14,fill:`currentColor`})}):(0,Q.jsx)(H,{type:`button`,variant:`ghost`,size:`sm`,onClick:()=>void g(e.chartKey),children:de()}):null,p?(0,Q.jsx)(H,{type:`button`,variant:`ghost`,size:`sm`,"aria-label":M({name:e.name}),title:M({name:e.name}),onClick:()=>void v(e.chartKey),children:(0,Q.jsx)(St,{size:14,"aria-hidden":!0})}):null]},e.chartKey))}),p?d.length>0?(0,Q.jsxs)(Qt,{value:``,onValueChange:e=>void _(e),children:[(0,Q.jsx)(en,{size:`sm`,className:`oc-access__search`,children:(0,Q.jsx)(Ft,{placeholder:Ve()})}),(0,Q.jsx)(tn,{children:d.map(e=>(0,Q.jsx)(Ht,{value:e.chartKey,children:e.name},e.chartKey))})]}):u.length===0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:a()}):null:null]})}export{sn as GroupsTab};
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$b as r,$y as i,Ab as a,Ay as o,Bb as s,By as c,Cb as l,Cx as u,Cy as d,Db as f,Dy as p,E as m,Eb as h,Ey as g,Fb as _,Fy as v,Gy as y,HX as b,Hb as x,Hy as S,Ib as C,Iy as ee,Jb as w,Jy as T,Kb as E,Ky as D,Lb as O,Ly as k,Mb as te,My as A,Nb as ne,Ny as j,Ob as M,Oy as re,Pb as ie,Py as N,Qb as ae,Qy as oe,Rb as se,Ry as ce,Sb as le,Sx as P,Sy as ue,Tb as de,Ty as F,UX as I,Uy as fe,Vb as L,Vy as pe,Wy as me,Xb as he,Xy as ge,Yb as R,Yy as _e,Zb as ve,Zy as ye,_b as z,_x as be,ax as xe,bb as B,bx as Se,by as Ce,cb as we,cx as Te,db as Ee,dx as De,dy as Oe,eb as ke,ex as Ae,fb as je,fx as Me,fy as Ne,gb as Pe,gx as Fe,hb as Ie,hx as Le,ix as Re,jb as ze,jy as Be,kb as Ve,ky as He,lb as Ue,lx as We,mb as Ge,mx as Ke,my as qe,nb as Je,nx as Ye,ox as Xe,pb as Ze,px as Qe,py as $e,qb as et,qy as tt,rb as nt,rx as rt,sb as it,sx as at,t as V,tb as ot,tx as st,ub as ct,ux as lt,vb as ut,vx as dt,wb as ft,wx as pt,wy as mt,xb as ht,xx as gt,xy as _t,yb as vt,yx as yt,zb as bt,zy as xt}from"./api--rqKQo-l.js";import{t as St}from"./x-C5eyKPkE.js";import{t as H}from"./button-HksxbiUF.js";import{$ as Ct,$t as U,Ct as wt,Dn as Tt,Dt as Et,En as Dt,G as Ot,J as W,Jt as G,K as kt,Mn as At,Mt as K,Nn as jt,Ot as Mt,Pn as Nt,Q as Pt,St as Ft,Tt as It,W as q,X as Lt,Y as Rt,Yt as J,Z as zt,at as Bt,b as Vt,bt as Ht,cr as Ut,ct as Wt,et as Gt,ft as Kt,it as qt,jn as Y,ot as Jt,q as Yt,sr as Xt,st as Zt,vt as Qt,wt as $t,xt as en,yt as tn}from"./index-l7elBM2O.js";import{t as nn}from"./FilterBar-BgVXfm-6.js";import{t as rn}from"./DataTableShell-BYSvf6VZ.js";import{t as X}from"./DetailChips-DUlvwews.js";var an=m(`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=t(e(),1),Q=n(),on={name:``,description:``};function sn(){let e=I(V.groups.listGroups,{}),t=I(V.me.getMe,{host:Kt})?.role===`admin`,n=b(V.groups.createGroup),r=b(V.groups.updateGroup),i=b(V.groups.deleteGroup),a=Wt(),o=J(),[s,c]=(0,Z.useState)(!1),[l,d]=(0,Z.useState)(null),[f,p]=(0,Z.useState)(on),[m,h]=(0,Z.useState)(null),[g,_]=(0,Z.useState)(``),v=(0,Z.useMemo)(()=>{if(!e)return e;let t=g.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,g]);function y(){d(null),p(on),c(!0)}function x(e){d(e),p({name:e.name,description:e.description??``}),c(!0)}async function S(){try{l?await r({groupId:l._id,name:f.name,description:f.description}):await n({name:f.name,description:f.description||void 0}),p(on),d(null),c(!1)}catch(e){o.error(vt(),e)}}async function C(e){if(await a({title:xe({name:e.name}),description:Re(),confirmWord:e.name,confirmLabel:rt(),cancelLabel:De(),destructive:!0}))try{await i({groupId:e._id})}catch(e){o.error(ut(),e)}}return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:u()}),t?(0,Q.jsx)(pn,{}):null,(0,Q.jsx)(nn,{q:g,onQChange:_,onReset:()=>_(``),canReset:g!==``,searchPlaceholder:Fe()}),(0,Q.jsx)(rn,{title:pt(),rows:v,addLabel:P(),onAdd:t?y:void 0,emptyHint:gt(),columns:[{header:Se(),cell:e=>e.name,sort:e=>e.name},{header:yt(),cell:e=>(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(X,{icon:(0,Q.jsx)(Dt,{size:12,"aria-hidden":!0}),total:e.memberCount,items:e.members.map(e=>({label:e.label,marker:e.manager?(0,Q.jsx)(jt,{size:11,"aria-hidden":!0}):null,highlight:e.manager}))}),e.pendingInviteCount>0?(0,Q.jsx)(G,{variant:`secondary`,children:it({count:String(e.pendingInviteCount)})}):null]}),sort:e=>e.memberCount},{header:dt(),cell:e=>(0,Q.jsx)(X,{icon:(0,Q.jsx)(Nt,{size:12,"aria-hidden":!0}),total:e.agentCount,items:e.agents.map(e=>({label:e}))}),sort:e=>e.agentCount},{header:be(),cell:e=>(0,Q.jsx)(X,{icon:(0,Q.jsx)(an,{size:12,"aria-hidden":!0}),total:e.chartCount,items:e.charts.map(e=>({label:e.name,marker:e.isDefault?(0,Q.jsx)(Y,{size:11,fill:`currentColor`,"aria-hidden":!0}):null,highlight:e.isDefault}))}),sort:e=>e.chartCount}],rowActions:e=>[{label:Le(),onSelect:()=>h({groupId:e._id,name:e.name})},...t?[{label:Ke(),onSelect:()=>x(e)},{label:Qe(),variant:`destructive`,onSelect:()=>void C(e)}]:[]]}),(0,Q.jsx)(Vt,{open:s,onOpenChange:c,title:l?We():lt(),description:Te(),canSubmit:!!f.name.trim(),onSubmit:S,submitLabel:Me(),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:at()}),(0,Q.jsx)(U,{value:f.name,onChange:e=>p({...f,name:e.target.value})})]}),(0,Q.jsxs)(`label`,{className:`oc-field`,children:[(0,Q.jsx)(`span`,{className:`oc-field__label`,children:Xe()}),(0,Q.jsx)(U,{value:f.description,onChange:e=>p({...f,description:e.target.value})})]})]})}),(0,Q.jsx)(ln,{groupId:m?.groupId??null,groupName:m?.name??``,open:m!==null,onOpenChange:e=>{e||h(null)}})]})}var cn=8;function $({page:e,pageCount:t,onPage:n}){return t<=1?null:(0,Q.jsxs)(`div`,{className:`oc-access__pager`,children:[(0,Q.jsxs)(H,{type:`button`,variant:`ghost`,size:`sm`,disabled:e<=1,onClick:()=>n(e-1),children:[(0,Q.jsx)(Ut,{size:14,"aria-hidden":!0}),w()]}),(0,Q.jsxs)(`span`,{className:`oc-access__pageinfo`,"aria-label":E({page:e,pages:t}),children:[e,` / `,t]}),(0,Q.jsxs)(H,{type:`button`,variant:`ghost`,size:`sm`,disabled:e>=t,onClick:()=>n(e+1),children:[et(),(0,Q.jsx)(Xt,{size:14,"aria-hidden":!0})]})]})}function ln({groupId:e,groupName:t,open:n,onOpenChange:a}){let o=I(V.groups.getGroup,n&&e?{groupId:e}:`skip`),c=o?.viewerIsAdmin===!0,u=I(V.groups.listAssignableInstances,n&&e?{groupId:e}:`skip`),d=I(V.groups.listAssignableUsers,n&&c?{}:`skip`),f=b(V.groups.addMember),p=b(V.groups.removeMember),m=b(V.groups.bulkSetMembers),h=b(V.groups.setGroupManager),g=J(),[_,v]=(0,Z.useState)(``),[y,C]=(0,Z.useState)(``),[ee,w]=(0,Z.useState)(`members`),[T,E]=(0,Z.useState)(1),[D,k]=(0,Z.useState)(null),[A,ne]=(0,Z.useState)(new Set),j=(0,Z.useRef)(null),M=(0,Z.useMemo)(()=>new Set((o?.members??[]).map(e=>e.userId)),[o]),re=(0,Z.useMemo)(()=>new Set((o?.members??[]).filter(e=>e.manager).map(e=>e.userId)),[o]),ie=(0,Z.useMemo)(()=>new Set((o?.members??[]).filter(e=>e.restricted).map(e=>e.userId)),[o]),N=(0,Z.useMemo)(()=>new Set((o?.agents??[]).map(e=>q(e.instanceName,e.agentId))),[o]),ce=(0,Z.useMemo)(()=>{let e=(o?.agents??[]).find(e=>e.isDefault);return e?q(e.instanceName,e.agentId):null},[o]);(0,Z.useEffect)(()=>{v(``),C(``),w(`members`),E(1),k(null),j.current=null},[n,e]),(0,Z.useEffect)(()=>{E(1)},[_]),(0,Z.useEffect)(()=>{n&&o&&e&&j.current!==e&&(j.current=e,ne(new Set((o.members??[]).map(e=>e.userId))))},[n,o,e]);let P=(0,Z.useMemo)(()=>d?Yt(d,_,A):[],[d,_,A]);async function ue(t,n){if(e)try{n?await p({groupId:e,userId:t}):await f({groupId:e,userId:t})}catch(e){g.error(z(),W(e))}}async function de(t,n){if(e)try{await h({groupId:e,userId:t,manager:!n})}catch(e){g.error(ht(),e)}}let F=Ct(P,e=>M.has(e.userId)),fe=P.filter(e=>M.has(e.userId)).length,L=zt(P,T,cn);async function pe(){if(!e||P.length===0)return;let t=P.map(e=>e.userId);try{await m({groupId:e,userIds:t,member:F!==`all`})}catch(e){g.error(z(),W(e))}}let me=(e,t)=>(0,Q.jsxs)(H,{type:`button`,variant:`ghost`,size:`sm`,className:`h-7`,"aria-label":oe({user:t}),title:oe({user:t}),onClick:()=>k({userId:e,label:t}),children:[(0,Q.jsx)(At,{size:13,"aria-hidden":!0}),i()]});return(0,Q.jsx)(wt,{open:n,onOpenChange:a,children:(0,Q.jsxs)($t,{className:`oc-access`,children:[(0,Q.jsxs)(Et,{children:[(0,Q.jsx)(Mt,{children:Ye({name:t})}),(0,Q.jsx)(It,{children:o&&!c?Ie():st()})]}),(0,Q.jsxs)(qt,{value:ee,onValueChange:w,className:`oc-access__tabs`,children:[(0,Q.jsxs)(Jt,{className:`w-full`,children:[(0,Q.jsxs)(Zt,{value:`members`,className:`flex-1 gap-1.5`,children:[(0,Q.jsx)(Dt,{size:13,"aria-hidden":!0}),Ae(),o?(0,Q.jsx)(G,{variant:`secondary`,className:`oc-access__tabcount`,children:M.size}):null]}),(0,Q.jsxs)(Zt,{value:`agents`,className:`flex-1 gap-1.5`,children:[(0,Q.jsx)(Nt,{size:13,"aria-hidden":!0}),ae(),o?(0,Q.jsx)(G,{variant:`secondary`,className:`oc-access__tabcount`,children:N.size}):null]}),(0,Q.jsxs)(Zt,{value:`charts`,className:`flex-1 gap-1.5`,children:[(0,Q.jsx)(an,{size:13,"aria-hidden":!0}),te(),o?(0,Q.jsx)(G,{variant:`secondary`,className:`oc-access__tabcount`,children:o.chartCount}):null]})]}),(0,Q.jsx)(Bt,{value:`members`,children:o===void 0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:s()}):c?d===void 0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:s()}):d.length===0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:se()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(U,{value:_,onChange:e=>v(e.target.value),placeholder:r(),className:`oc-access__search`}),P.length===0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:he()}):(0,Q.jsxs)(Q.Fragment,{children:[P.length>1?(0,Q.jsxs)(`div`,{className:`oc-access__row oc-access__selectall`,children:[(0,Q.jsx)(K,{checked:F===`all`?!0:F===`some`?`indeterminate`:!1,onCheckedChange:()=>void pe(),"aria-label":R()}),(0,Q.jsx)(`span`,{className:`oc-access__label`,children:R()}),(0,Q.jsxs)(G,{variant:`outline`,className:`oc-access__count`,children:[fe,` / `,P.length]})]}):null,(0,Q.jsx)(`div`,{className:`oc-access__list`,children:L.pageItems.map(e=>{let t=M.has(e.userId),n=Gt(e),r=re.has(e.userId);return(0,Q.jsxs)(`div`,{className:`oc-access__row`,children:[(0,Q.jsx)(K,{checked:t,onCheckedChange:()=>void ue(e.userId,t),"aria-label":x({user:n.primary})}),(0,Q.jsxs)(`span`,{className:`oc-access__who`,children:[(0,Q.jsx)(`span`,{className:`oc-access__label`,title:n.primary,children:n.primary}),n.secondary?(0,Q.jsx)(`span`,{className:`oc-access__sub`,title:n.secondary,children:n.secondary}):null]}),t&&ie.has(e.userId)?(0,Q.jsx)(G,{variant:`outline`,className:`oc-access__role`,children:ye()}):null,(0,Q.jsx)(G,{variant:`outline`,className:`oc-access__role`,children:Pt(e.role)}),t?me(e.userId,n.primary):null,(0,Q.jsx)(`span`,{className:`oc-access__mgrslot`,children:t?(0,Q.jsx)(H,{type:`button`,variant:`ghost`,size:`icon`,className:`shrink-0 oc-access__mgr${r?` oc-access__mgr--on`:``}`,"aria-pressed":r,"aria-label":r?le():l(),title:r?le():l(),onClick:()=>void de(e.userId,r),children:(0,Q.jsx)(jt,{size:15,"aria-hidden":!0})}):null})]},e._id)})}),(0,Q.jsx)($,{page:L.page,pageCount:L.pageCount,onPage:E})]})]}):e?(0,Q.jsx)(un,{groupId:e,members:o.members,agentsButton:me}):null}),(0,Q.jsxs)(Bt,{value:`agents`,children:[o&&!c?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:S()}):null,u===void 0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:s()}):u.length===0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:O()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(U,{value:y,onChange:e=>C(e.target.value),placeholder:ve(),className:`oc-access__search`}),(0,Q.jsx)(`div`,{className:`oc-access__list`,children:u.map(t=>(0,Q.jsx)(fn,{groupId:e,instanceName:t.name,kind:t.kind??`openclaw`,assigned:N,defaultKey:ce,viewerIsAdmin:c,query:y},`${e}-${t._id}`))})]})]}),(0,Q.jsx)(Bt,{value:`charts`,children:(0,Q.jsx)(mn,{groupId:e})})]}),(0,Q.jsx)(dn,{groupId:e,member:D,onOpenChange:e=>{e||k(null)}})]})})}function un({groupId:e,members:t,agentsButton:n}){let r=I(V.groupInvites.listGroupInviteRequests,{groupId:e}),i=b(V.groupInvites.requestGroupInvite),a=b(V.groups.removeMember),o=Wt(),s=J(),[c,l]=(0,Z.useState)(``),[u,d]=(0,Z.useState)(1),f=zt(t,u,cn);async function p(t){t.preventDefault();let n=c.trim();if(n)try{await i({groupId:e,email:n}),l(``),s.success(ct())}catch(e){s.error(Ue(),e)}}async function m(t,n){if(await o({title:nt({user:n}),description:ot({user:n}),confirmLabel:ke(),cancelLabel:De(),destructive:!0}))try{await a({groupId:e,userId:t})}catch(e){s.error(z(),W(e))}}return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`form`,{className:`oc-access__invite`,onSubmit:e=>void p(e),children:[(0,Q.jsx)(U,{type:`email`,value:c,onChange:e=>l(e.target.value),placeholder:je(),"aria-label":Ge()}),(0,Q.jsxs)(H,{type:`submit`,size:`sm`,disabled:!c.trim(),children:[(0,Q.jsx)(Tt,{size:14,"aria-hidden":!0}),Ee()]})]}),(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:Ze()}),t.length===0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:ge()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`div`,{className:`oc-access__list`,children:f.pageItems.map(e=>(0,Q.jsxs)(`div`,{className:`oc-access__row`,children:[(0,Q.jsx)(`span`,{className:`oc-access__label`,title:e.label,children:e.label}),e.restricted?(0,Q.jsx)(G,{variant:`outline`,className:`oc-access__role`,children:ye()}):null,n(e.userId,e.label),(0,Q.jsx)(`span`,{className:`oc-access__mgrslot`,children:e.manager?(0,Q.jsx)(`span`,{className:`oc-access__mgr oc-access__mgr--on`,role:`img`,"aria-label":ft(),title:ft(),children:(0,Q.jsx)(jt,{size:15,"aria-hidden":!0})}):null}),(0,Q.jsx)(H,{type:`button`,variant:`ghost`,size:`icon-sm`,disabled:e.manager||e.lastGroup,"aria-label":nt({user:e.label}),title:e.manager?Je():e.lastGroup?Ce():nt({user:e.label}),onClick:()=>void m(e.userId,e.label),children:(0,Q.jsx)(St,{size:14,"aria-hidden":!0})})]},e.userId))}),(0,Q.jsx)($,{page:f.page,pageCount:f.pageCount,onPage:d})]}),r!==void 0&&r.length>0?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`p`,{className:`oc-access__subhead`,children:we()}),(0,Q.jsx)(`div`,{className:`oc-access__list`,children:r.map(e=>(0,Q.jsxs)(`div`,{className:`oc-access__row`,children:[(0,Q.jsx)(`span`,{className:`oc-access__label`,title:e.email,children:e.email}),(0,Q.jsx)(G,{variant:e.status===`pending`?`secondary`:`outline`,className:`oc-access__role`,children:Rt(e.status)})]},e._id))})]}):null]})}function dn({groupId:e,member:t,onOpenChange:n}){let r=I(V.groups.getMemberAgentSettings,e&&t?{groupId:e,userId:t.userId}:`skip`),i=b(V.groups.setMemberAgents),a=b(V.groups.setMemberDefaultAgent),c=J();async function l(e){try{await e()}catch(e){c.error(_t(),e)}}let u=r?.agents??[],f=new Map(u.map(e=>[q(e.instanceName,e.agentId),e])),m=[...f.keys()],h=new Set(u.filter(e=>e.allowed).map(e=>q(e.instanceName,e.agentId)));function _(n){if(!e||!t||!r)return;let a=Lt(m,h,r.restricted,n).map(e=>{let t=f.get(e);return{instanceName:t.instanceName,agentId:t.agentId}});l(()=>i({groupId:e,userId:t.userId,agents:a}))}return(0,Q.jsx)(wt,{open:t!==null,onOpenChange:n,children:(0,Q.jsxs)($t,{className:`oc-access`,children:[(0,Q.jsxs)(Et,{children:[(0,Q.jsx)(Mt,{children:o({user:t?.label??``})}),(0,Q.jsx)(It,{children:He()})]}),r===void 0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:s()}):r===null||u.length===0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:ue()}):(0,Q.jsxs)(Q.Fragment,{children:[r.settable?null:(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:Oe()}),r.adminNarrowed?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:qe()}):null,r.restrictedByAdmin&&!r.viewerIsAdmin?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:Ne()}):null,(0,Q.jsxs)(`div`,{className:`oc-access__row oc-access__selectall`,children:[(0,Q.jsx)(`span`,{className:`oc-access__label`,children:r.restricted?p():re()}),r.restricted?(0,Q.jsx)(H,{type:`button`,size:`sm`,variant:`outline`,disabled:!r.settable||r.restrictedByAdmin&&!r.viewerIsAdmin,onClick:()=>e&&t?void l(()=>i({groupId:e,userId:t.userId,agents:null})):void 0,children:g()}):null]}),(0,Q.jsx)(`div`,{className:`oc-access__list`,children:u.map(n=>{let i=q(n.instanceName,n.agentId),o=n.displayName??n.agentId;return(0,Q.jsxs)(`div`,{className:`oc-access__row`,children:[(0,Q.jsx)(K,{checked:n.allowed,disabled:!r.settable||r.restrictedByAdmin&&!r.viewerIsAdmin&&!n.allowed,onCheckedChange:()=>_(i),"aria-label":F({name:o})}),(0,Q.jsx)(`span`,{className:`oc-access__label`,title:o,children:o}),n.limitedByAdmin?(0,Q.jsx)(G,{variant:`outline`,className:`oc-access__role`,children:$e()}):null,n.state===`deleted`?(0,Q.jsx)(G,{variant:`outline`,className:`oc-access__gone`,children:ne()}):null,n.allowed?n.isMemberDefault?(0,Q.jsx)(H,{type:`button`,size:`icon-sm`,variant:`ghost`,className:`oc-access__fav`,disabled:!r.settable,"aria-label":mt(),title:mt(),onClick:()=>e&&t?void l(()=>a({groupId:e,userId:t.userId,agent:null})):void 0,children:(0,Q.jsx)(Y,{size:14,fill:`currentColor`})}):(0,Q.jsx)(H,{type:`button`,size:`icon-sm`,variant:`ghost`,className:`oc-access__setdefault`,disabled:!r.settable,"aria-label":d(),title:d(),onClick:()=>e&&t?void l(()=>a({groupId:e,userId:t.userId,agent:{instanceName:n.instanceName,agentId:n.agentId}})):void 0,children:(0,Q.jsx)(Y,{size:14})}):null]},i)})})]})]})})}function fn({groupId:e,instanceName:t,kind:n,assigned:r,defaultKey:i,viewerIsAdmin:a,query:o}){let s=I(V.groups.listAssignableAgents,e?{instanceName:t,groupId:e}:`skip`),l=b(V.groups.assignAgentToGroup),u=b(V.groups.removeAgentFromGroup),d=b(V.groups.bulkSetGroupAgents),f=b(V.groups.claimAgentForGroup),p=b(V.groups.setGroupDefaultAgent),m=J(),[h,g]=(0,Z.useState)(1);if((0,Z.useEffect)(()=>{g(1)},[o]),!e)return null;let y=kt(s?.agents??[],o),x=s?.discovery&&!s.discovery.lastPollOk,S=e=>Ot({assigned:r.has(q(t,e.agentId)),claimable:e.claimable,reservedForGroup:e.reservedForGroup,enabled:e.enabled,present:e.presentInLastOk!==!1},a),w=y.filter(e=>S(e)!==`claim`),T=y.filter(e=>S(e)===`claim`);if(o.trim()&&y.length===0)return null;let E=w.filter(e=>S(e)===`toggle`&&e.presentInLastOk!==!1&&e.enabled!==!1),D=Ct(E,e=>r.has(q(t,e.agentId))),O=zt(w,h,cn);async function te(n,r){try{r?await u({groupId:e,instanceName:t,agentId:n}):await l({groupId:e,instanceName:t,agentId:n})}catch(e){m.error(Pe(),W(e))}}async function M(){if(E.length===0)return;let n=E.map(e=>e.agentId);try{await d({groupId:e,instanceName:t,agentIds:n,assigned:D!==`all`})}catch(e){m.error(Pe(),W(e))}}async function re(n){try{await f({groupId:e,instanceName:t,agentId:n})}catch(e){m.error(k(),e)}}async function ae(n){try{await p({groupId:e,agent:n===null?null:{instanceName:t,agentId:n}})}catch(e){m.error(Be(),e)}}let oe=e=>e.reservedForGroup?(0,Q.jsx)(G,{variant:`outline`,className:`oc-access__role`,children:ee()}):e.reserved?(0,Q.jsx)(G,{variant:`outline`,className:`oc-access__role`,children:e.reservedGroupName===null?N():v({group:e.reservedGroupName})}):null;return(0,Q.jsxs)(`div`,{className:`oc-access__group`,children:[(0,Q.jsxs)(`div`,{className:`oc-access__instance`,children:[(0,Q.jsx)(Nt,{size:13,"aria-hidden":!0}),(0,Q.jsx)(`span`,{children:t}),(0,Q.jsx)(G,{variant:`outline`,className:`oc-access__kind`,children:n}),x?(0,Q.jsx)(G,{variant:`outline`,className:`oc-access__stale`,children:ie()}):null]}),s===void 0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:bt()}):y.length===0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:x?_():C()}):(0,Q.jsxs)(Q.Fragment,{children:[E.length>1?(0,Q.jsxs)(`div`,{className:`oc-access__row oc-access__selectall`,children:[(0,Q.jsx)(K,{checked:D===`all`?!0:D===`some`?`indeterminate`:!1,onCheckedChange:()=>void M(),"aria-label":R()}),(0,Q.jsx)(`span`,{className:`oc-access__label`,children:R()})]}):null,O.pageItems.map(e=>{let n=q(t,e.agentId),a=r.has(n),o=e.presentInLastOk===!1,s=S(e)===`locked`;return(0,Q.jsxs)(`div`,{className:`oc-access__row${s?` is-disabled`:``}`,children:[(0,Q.jsx)(K,{checked:a,disabled:s&&!a,onCheckedChange:()=>void te(e.agentId,a),"aria-label":L({name:e.displayName??e.agentId})}),(0,Q.jsxs)(`span`,{className:`oc-access__label`,title:e.displayName??e.agentId,children:[e.emoji?`${e.emoji} `:``,e.displayName??e.agentId]}),e.model?(0,Q.jsx)(`span`,{className:`oc-access__model`,children:e.model}):null,oe(e),o?(0,Q.jsx)(G,{variant:`outline`,className:`oc-access__gone`,children:ne()}):null,a?i===n?(0,Q.jsx)(H,{type:`button`,size:`icon-sm`,variant:`ghost`,className:`oc-access__fav`,"aria-label":j(),title:j(),onClick:()=>void ae(null),children:(0,Q.jsx)(Y,{size:14,fill:`currentColor`})}):(0,Q.jsx)(H,{type:`button`,size:`icon-sm`,variant:`ghost`,className:`oc-access__setdefault`,"aria-label":A(),title:A(),onClick:()=>void ae(e.agentId),children:(0,Q.jsx)(Y,{size:14})}):null]},e.agentId)}),(0,Q.jsx)($,{page:O.page,pageCount:O.pageCount,onPage:g}),T.length>0?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`p`,{className:`oc-access__subhead`,children:pe()}),(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:c()}),T.map(e=>{let t=e.displayName??e.agentId;return(0,Q.jsxs)(`div`,{className:`oc-access__row`,children:[(0,Q.jsxs)(`span`,{className:`oc-access__label`,title:t,children:[e.emoji?`${e.emoji} `:``,t]}),e.model?(0,Q.jsx)(`span`,{className:`oc-access__model`,children:e.model}):null,(0,Q.jsx)(H,{type:`button`,size:`sm`,variant:`outline`,className:`h-7`,"aria-label":ce({name:t}),onClick:()=>void re(e.agentId),children:xt()})]},e.agentId)})]}):null]})]})}function pn(){let e=I(V.groupInvites.listPendingInviteRequests,{}),t=b(V.groupInvites.decideGroupInvite),n=J();if(e===void 0||e.length===0)return null;async function r(e,r){try{await t({requestId:e,approve:r})}catch(e){n.error(fe(),e)}}return(0,Q.jsxs)(`section`,{className:`oc-invites`,"aria-label":_e(),children:[(0,Q.jsxs)(`h3`,{className:`oc-invites__title`,children:[(0,Q.jsx)(Tt,{size:14,"aria-hidden":!0}),_e(),(0,Q.jsx)(G,{variant:`secondary`,children:e.length})]}),(0,Q.jsx)(`div`,{className:`oc-access__list`,children:e.map(e=>(0,Q.jsxs)(`div`,{className:`oc-access__row`,children:[(0,Q.jsxs)(`span`,{className:`oc-access__who`,children:[(0,Q.jsx)(`span`,{className:`oc-access__label`,title:e.email,children:e.email}),(0,Q.jsxs)(`span`,{className:`oc-access__sub`,children:[e.groupName??`?`,` ·`,` `,T({by:e.requestedBy})]})]}),e.account===`ready`?null:(0,Q.jsx)(G,{variant:`outline`,className:`oc-access__role`,children:e.account===`none`?y():me()}),(0,Q.jsx)(H,{type:`button`,size:`sm`,variant:`outline`,className:`h-7`,disabled:e.account!==`ready`,onClick:()=>void r(e._id,!0),children:tt()}),(0,Q.jsx)(H,{type:`button`,size:`sm`,variant:`ghost`,className:`h-7`,onClick:()=>void r(e._id,!1),children:D()})]},e._id))})]})}function mn({groupId:e}){let t=I(V.charts.listGroupChartSelection,e?{groupId:e}:`skip`),n=b(V.charts.assignChartToGroup),r=b(V.charts.removeChartFromGroup),i=b(V.charts.setGroupDefaultChart),o=b(V.charts.addChartToGroupPool),c=b(V.charts.removeChartFromGroupPool),l=J();if(!e)return null;if(t===void 0)return(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:s()});let{pool:u,addable:d,canManagePool:p}=t;if(u.length===0&&!p)return(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:ze()});async function m(t,i){try{i?await r({groupId:e,chartKey:t}):await n({groupId:e,chartKey:t})}catch(e){l.error(B(),e)}}async function g(t){try{await i({groupId:e,chartKey:t})}catch(e){l.error(B(),e)}}async function _(t){try{await o({groupId:e,chartKey:t})}catch(e){l.error(B(),e)}}async function v(t){try{await c({groupId:e,chartKey:t})}catch(e){l.error(B(),e)}}return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`div`,{className:`oc-access__list`,children:u.map(e=>(0,Q.jsxs)(`div`,{className:`oc-access__row`,children:[(0,Q.jsx)(K,{checked:e.selected,onCheckedChange:()=>void m(e.chartKey,e.selected),"aria-label":f({name:e.name})}),(0,Q.jsx)(`span`,{className:`oc-access__label`,title:e.name,children:e.name}),e.selected?e.isDefault?(0,Q.jsx)(`span`,{className:`oc-access__fav`,role:`img`,"aria-label":h(),title:h(),children:(0,Q.jsx)(Y,{size:14,fill:`currentColor`})}):(0,Q.jsx)(H,{type:`button`,variant:`ghost`,size:`sm`,onClick:()=>void g(e.chartKey),children:de()}):null,p?(0,Q.jsx)(H,{type:`button`,variant:`ghost`,size:`sm`,"aria-label":M({name:e.name}),title:M({name:e.name}),onClick:()=>void v(e.chartKey),children:(0,Q.jsx)(St,{size:14,"aria-hidden":!0})}):null]},e.chartKey))}),p?d.length>0?(0,Q.jsxs)(Qt,{value:``,onValueChange:e=>void _(e),children:[(0,Q.jsx)(en,{size:`sm`,className:`oc-access__search`,children:(0,Q.jsx)(Ft,{placeholder:Ve()})}),(0,Q.jsx)(tn,{children:d.map(e=>(0,Q.jsx)(Ht,{value:e.chartKey,children:e.name},e.chartKey))})]}):u.length===0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:a()}):null:null]})}export{sn as GroupsTab};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$ as r,$F as i,$P as a,AF as o,AP as s,An as c,Ao as l,BF as u,BP as d,BX as f,CF as p,CI as m,Co as h,DF as g,Dn as _,Do as v,EF as y,En as b,Eo as ee,Eu as x,FF as S,FP as C,Fn as te,Fo as w,GF as T,GP as E,HF as D,HP as O,HX as k,IF as A,IP as ne,J as re,JF as ie,JP as ae,K as oe,KF as se,KP as ce,LF as le,LP as ue,MF as de,MP as fe,Mn as pe,Mo as me,NF as j,NP as he,Nn as ge,No as _e,OF as ve,OP as ye,On as be,Oo as xe,PF as Se,PP as Ce,Pn as we,Po as Te,Q as Ee,QF as De,QP as Oe,RF as ke,RP as Ae,RU as M,SF as je,SI as Me,So as Ne,TF as Pe,To as Fe,Tu as Ie,UF as Le,UP as Re,UX as N,VF as ze,VP as Be,WF as Ve,WP as He,X as Ue,XF as We,XP as Ge,Y as Ke,YF as qe,YP as Je,Z as Ye,ZF as Xe,ZP as Ze,_F as Qe,_I as $e,aF as et,aI as tt,bF as nt,bI as rt,bo as it,cF as at,cI as ot,cm as st,cy as ct,dA as lt,dF as ut,dI as dt,dm as ft,eF as pt,eI as mt,et as ht,fA as gt,fF as _t,fI as vt,gF as yt,gI as bt,hF as xt,hI as St,iF as P,iI as Ct,jF as wt,jP as Tt,jn as Et,jo as Dt,kF as Ot,kP as kt,kn as At,ko as jt,lF as Mt,lI as Nt,lm as Pt,ly as Ft,mF as It,mI as Lt,nF as Rt,nI as zt,oF as Bt,oI as Vt,pF as Ht,pI as Ut,q as Wt,qF as Gt,qP as Kt,rI as qt,sF as Jt,sI as Yt,t as F,tF as Xt,tI as Zt,uF as Qt,uI as $t,um as en,uy as tn,vF as nn,vI as rn,wF as an,wo as on,wu as sn,xF as cn,xI as ln,xo as un,yF as dn,yI as fn,yo as pn,zF as mn,zP as hn,zU as I}from"./api--rqKQo-l.js";import{a as gn,c as _n}from"./FieldLabel-CcWGFs5F.js";import{t as L}from"./button-HksxbiUF.js";import{$t as R,Ct as z,Dt as B,J as V,Jt as H,Mt as vn,Ot as yn,St as U,Tt as bn,Yt as W,b as xn,bt as G,cn as Sn,ct as Cn,on as wn,sn as Tn,vt as K,wt as En,xt as q,yt as J}from"./index-l7elBM2O.js";import{t as Dn}from"./DataTableShell-BYSvf6VZ.js";import{InstanceConfigDialog as On}from"./BridgeTab-BUFvmr2d.js";var Y=t(e(),1),X=[`conversational`,`documentary`,`summarizer`,`curator`],kn=new Set(X),An=`conversational`;function jn(e){let t=new Set((e??[]).filter(e=>kn.has(e)));return t.size===0?[An]:X.filter(e=>t.has(e))}var Z=n(),Q={name:``,gatewayUrl:``,bridgeUrl:``,displayName:``,kind:`openclaw`,transport:`ws`,gatewayVersion:``,gatewayHttpUrl:``,authMode:`token`,personScopes:`capped`,identitySource:`canonical`,participantIdentity:`owner`,managePermissionModes:!1,systemIdentity:``,streamTransport:gn,widgetsEnabled:!0,widgetPromptConfirm:!1},Mn={openclaw:[`token`,`deviceIdentity`],hermes:[`apiKey`]};function Nn(e){return{name:e.name,gatewayUrl:e.gatewayUrl,bridgeUrl:e.bridgeUrl??``,displayName:e.displayName??``,kind:e.kind??`openclaw`,transport:e.transport??`ws`,gatewayVersion:e.gatewayVersion??``,gatewayHttpUrl:e.gatewayHttpUrl??``,authMode:e.authMode??`token`,personScopes:e.personScopes??`capped`,identitySource:e.identitySource??`canonical`,participantIdentity:e.participantIdentity??`owner`,managePermissionModes:e.managePermissionModes===!0,systemIdentity:e.systemIdentity??``,streamTransport:e.streamTransport??`reactive`,widgetsEnabled:e.config?.widgetsEnabled!==!1,widgetPromptConfirm:e.config?.widgetPromptConfirm===!0}}function Pn(){let e=N(F.admin.listInstances,{}),t=N(F.agents.listAllInstanceAgents,{}),n=k(F.admin.upsertInstance),a=k(F.widgets.setInstanceWidgets),o=k(F.admin.deleteInstance),s=W(),[u,d]=(0,Y.useState)(!1),[f,p]=(0,Y.useState)(Q),[g,y]=(0,Y.useState)(null),[S,T]=(0,Y.useState)(null),[E,D]=(0,Y.useState)(null),[O,A]=(0,Y.useState)(null);async function ne(){try{let t=await n({instanceId:O??void 0,name:f.name,gatewayUrl:f.gatewayUrl,bridgeUrl:f.bridgeUrl||void 0,displayName:f.displayName||void 0,kind:f.kind,transport:f.kind===`hermes`?f.transport:void 0,gatewayVersion:f.gatewayVersion||void 0,gatewayHttpUrl:f.gatewayHttpUrl||void 0,...f.kind===`openclaw`?{authMode:f.authMode,personScopes:f.personScopes,identitySource:f.identitySource,participantIdentity:f.participantIdentity,managePermissionModes:f.managePermissionModes,systemIdentity:f.systemIdentity||void 0}:{},streamTransport:f.streamTransport}),r=O===null?null:e?.find(e=>e._id===O),i=r?.config?.widgetsEnabled!==!1,o=r?.config?.widgetPromptConfirm===!0;f.kind===`openclaw`&&(f.widgetsEnabled!==i||f.widgetPromptConfirm!==o)&&await a({instanceId:t,enabled:f.widgetsEnabled,promptConfirm:f.widgetPromptConfirm}),p(Q),A(null),d(!1)}catch(e){s.error(ln(),e)}}return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`p`,{className:`oc-admin__hint`,children:[rt(),(0,Z.jsx)(`strong`,{children:fn()}),rn()]}),(0,Z.jsx)(Dn,{title:$e(),rows:e,addLabel:bt(),onAdd:()=>{A(null),p(Q),d(!0)},emptyHint:St(),columns:[{header:Lt(),cell:e=>e.name,sort:e=>e.name},{header:Ut(),cell:e=>(0,Z.jsx)(H,{variant:`outline`,children:e.kind??`openclaw`}),sort:e=>e.kind??`openclaw`},{header:vt(),cell:e=>e.gatewayUrl,sort:e=>e.gatewayUrl},{header:dt(),cell:e=>e.displayName??`—`,sort:e=>e.displayName??null},{header:m(),cell:e=>{let n=(t?.[e.name]??[]).filter(e=>e.presentInLastOk!==!1&&e.enabled);if(n.length===0)return(0,Z.jsx)(`span`,{className:`text-muted-foreground`,children:`—`});let r=t=>e.defaultAgentId===t;return(0,Z.jsx)(`div`,{className:`flex flex-wrap gap-1`,children:[...n].sort((e,t)=>Number(r(t.agentId))-Number(r(e.agentId))).map(e=>(0,Z.jsxs)(H,{variant:r(e.agentId)?`default`:`outline`,title:r(e.agentId)?C():void 0,children:[e.emoji?`${e.emoji} `:``,e.displayName??e.agentId]},e.agentId))})}}],rowActions:e=>[{label:Yt(),onSelect:()=>{A(e._id),p(Nn(e)),d(!0)}},{label:Me(),onSelect:()=>y(e.name)},{label:se(),onSelect:()=>D(e)},{label:$t(),onSelect:()=>T(e)},{label:Nt(),variant:`destructive`,onSelect:()=>void o({instanceId:e._id})}],bulkActions:[{label:Nt(),variant:`destructive`,onSelect:e=>e.forEach(e=>void o({instanceId:e}))}]}),(0,Z.jsx)(xn,{open:u,onOpenChange:d,title:O?Vt():ot(),description:Ct(),canSubmit:!!(f.name&&f.gatewayUrl),onSubmit:ne,submitLabel:qt(),children:(0,Z.jsxs)(`div`,{className:`oc-form`,children:[(0,Z.jsxs)($,{label:zt(),children:[(0,Z.jsx)(R,{value:f.name,disabled:O!==null,onChange:e=>p({...f,name:e.target.value})}),O?(0,Z.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:tt()}):null]}),(0,Z.jsx)($,{label:Zt(),children:(0,Z.jsxs)(K,{value:f.kind,onValueChange:e=>p({...f,kind:e}),children:[(0,Z.jsx)(q,{size:`sm`,className:`w-full`,children:(0,Z.jsx)(U,{})}),(0,Z.jsxs)(J,{children:[(0,Z.jsx)(G,{value:`openclaw`,children:`OpenClaw`}),(0,Z.jsx)(G,{value:`hermes`,children:`Hermes`})]})]})}),f.kind===`hermes`?(0,Z.jsx)($,{label:x(),children:(0,Z.jsxs)(K,{value:f.transport,onValueChange:e=>p({...f,transport:e}),children:[(0,Z.jsx)(q,{size:`sm`,className:`w-full`,children:(0,Z.jsx)(U,{})}),(0,Z.jsxs)(J,{children:[(0,Z.jsx)(G,{value:`ws`,children:Ie()}),(0,Z.jsx)(G,{value:`rest`,children:sn()})]})]})}):null,(0,Z.jsx)($,{label:mt(),children:(0,Z.jsx)(R,{value:f.gatewayUrl,onChange:e=>p({...f,gatewayUrl:e.target.value})})}),(0,Z.jsx)($,{label:i(),children:(0,Z.jsx)(R,{value:f.bridgeUrl,placeholder:De(),onChange:e=>p({...f,bridgeUrl:e.target.value})})}),(0,Z.jsx)($,{label:Xe(),children:(0,Z.jsx)(R,{value:f.displayName,onChange:e=>p({...f,displayName:e.target.value})})}),(0,Z.jsxs)($,{label:gt(),children:[(0,Z.jsxs)(K,{value:f.streamTransport,onValueChange:e=>p({...f,streamTransport:e}),children:[(0,Z.jsx)(q,{size:`sm`,className:`w-full`,children:(0,Z.jsx)(U,{})}),(0,Z.jsx)(J,{children:_n.map(e=>(0,Z.jsx)(G,{value:e,children:e},e))})]}),(0,Z.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:lt()})]}),(0,Z.jsx)($,{label:We(),children:(0,Z.jsx)(R,{value:f.gatewayVersion,placeholder:qe(),onChange:e=>p({...f,gatewayVersion:e.target.value})})}),f.kind===`openclaw`?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)($,{label:Fe(),children:[(0,Z.jsxs)(K,{value:f.authMode,onValueChange:e=>p({...f,authMode:e}),children:[(0,Z.jsx)(q,{size:`sm`,className:`w-full`,children:(0,Z.jsx)(U,{})}),(0,Z.jsxs)(J,{children:[(0,Z.jsx)(G,{value:`token`,children:on()}),(0,Z.jsx)(G,{value:`trusted-proxy`,children:h()})]})]}),(0,Z.jsx)(`p`,{className:`oc-field__hint`,children:f.authMode===`trusted-proxy`?un():Ne()})]}),f.authMode===`trusted-proxy`?(0,Z.jsxs)($,{label:w(),children:[(0,Z.jsxs)(K,{value:f.personScopes,onValueChange:e=>p({...f,personScopes:e}),children:[(0,Z.jsx)(q,{size:`sm`,className:`w-full`,children:(0,Z.jsx)(U,{})}),(0,Z.jsxs)(J,{children:[(0,Z.jsx)(G,{value:`capped`,children:Te()}),(0,Z.jsx)(G,{value:`full`,children:_e()})]})]}),(0,Z.jsx)(`p`,{className:`oc-field__hint`,children:f.personScopes===`full`?Dt():me()})]}):null,f.authMode===`trusted-proxy`?(0,Z.jsxs)($,{label:l(),children:[(0,Z.jsxs)(K,{value:f.identitySource,onValueChange:e=>p({...f,identitySource:e}),children:[(0,Z.jsx)(q,{size:`sm`,className:`w-full`,children:(0,Z.jsx)(U,{})}),(0,Z.jsxs)(J,{children:[(0,Z.jsx)(G,{value:`canonical`,children:jt()}),(0,Z.jsx)(G,{value:`email`,children:xe()})]})]}),(0,Z.jsx)(`p`,{className:`oc-field__hint`,children:f.identitySource===`email`?ee():v()})]}):null,f.authMode===`trusted-proxy`?(0,Z.jsxs)($,{label:te(),children:[(0,Z.jsxs)(K,{value:f.participantIdentity,onValueChange:e=>p({...f,participantIdentity:e}),children:[(0,Z.jsx)(q,{size:`sm`,className:`w-full`,children:(0,Z.jsx)(U,{})}),(0,Z.jsxs)(J,{children:[(0,Z.jsx)(G,{value:`owner`,children:we()}),(0,Z.jsx)(G,{value:`self`,children:ge()})]})]}),(0,Z.jsx)(`p`,{className:`oc-field__hint`,children:f.participantIdentity===`self`?b():pe()})]}):null,f.kind===`openclaw`?(0,Z.jsxs)($,{label:Et(),children:[(0,Z.jsxs)(K,{value:f.managePermissionModes?`on`:`off`,onValueChange:e=>p({...f,managePermissionModes:e===`on`}),children:[(0,Z.jsx)(q,{size:`sm`,className:`w-full`,children:(0,Z.jsx)(U,{})}),(0,Z.jsxs)(J,{children:[(0,Z.jsx)(G,{value:`off`,children:c()}),(0,Z.jsx)(G,{value:`on`,children:At()})]})]}),(0,Z.jsx)(`p`,{className:`oc-field__hint`,children:f.managePermissionModes?_():be()})]}):null,f.kind===`openclaw`?(0,Z.jsxs)($,{label:ht(),children:[(0,Z.jsxs)(K,{value:f.widgetsEnabled?`on`:`off`,onValueChange:e=>p({...f,widgetsEnabled:e===`on`}),children:[(0,Z.jsx)(q,{size:`sm`,className:`w-full`,children:(0,Z.jsx)(U,{})}),(0,Z.jsxs)(J,{children:[(0,Z.jsx)(G,{value:`on`,children:r()}),(0,Z.jsx)(G,{value:`off`,children:Ee()})]})]}),(0,Z.jsx)(`p`,{className:`oc-field__hint`,children:f.widgetsEnabled?Ye():Ue()})]}):null,f.kind===`openclaw`&&f.widgetsEnabled?(0,Z.jsxs)($,{label:Ke(),children:[(0,Z.jsxs)(K,{value:f.widgetPromptConfirm?`on`:`off`,onValueChange:e=>p({...f,widgetPromptConfirm:e===`on`}),children:[(0,Z.jsx)(q,{size:`sm`,className:`w-full`,children:(0,Z.jsx)(U,{})}),(0,Z.jsxs)(J,{children:[(0,Z.jsx)(G,{value:`off`,children:re()}),(0,Z.jsx)(G,{value:`on`,children:Wt()})]})]}),(0,Z.jsx)(`p`,{className:`oc-field__hint`,children:oe()})]}):null,f.authMode===`trusted-proxy`?(0,Z.jsx)($,{label:it(),children:(0,Z.jsx)(R,{value:f.systemIdentity,placeholder:pn(),onChange:e=>p({...f,systemIdentity:e.target.value})})}):null]}):null,(0,Z.jsx)($,{label:ie(),children:(0,Z.jsx)(R,{value:f.gatewayHttpUrl,placeholder:Gt(),onChange:e=>p({...f,gatewayHttpUrl:e.target.value})})})]})}),(0,Z.jsx)(Wn,{instanceName:g,open:g!==null,onOpenChange:e=>{e||y(null)}}),S?(0,Z.jsx)(On,{instance:S,onClose:()=>T(null)},S._id):null,E?(0,Z.jsx)(Fn,{instance:E,onClose:()=>D(null)},E._id):null]})}function Fn({instance:e,onClose:t}){let n=N(F.instanceSecrets.listInstanceSecretStatus,{}),r=Mn[e.kind??`openclaw`],i=(0,Y.useMemo)(()=>{let t={};for(let r of n??[])r.instanceId===e._id&&(t[r.field]=r.updatedAt);return t},[n,e._id]);return(0,Z.jsx)(z,{open:!0,onOpenChange:e=>!e&&t(),children:(0,Z.jsxs)(En,{onOpenAutoFocus:e=>e.preventDefault(),children:[(0,Z.jsxs)(B,{children:[(0,Z.jsx)(yn,{children:T({instance:e.displayName??e.name})}),(0,Z.jsx)(bn,{children:Ve()})]}),(0,Z.jsx)(`div`,{className:`oc-form`,children:r.map(t=>(0,Z.jsx)(Rn,{instanceId:e._id,field:t,updatedAt:i[t]??null},t))}),(0,Z.jsx)(`div`,{className:`oc-bridgesecret`,children:(0,Z.jsx)(Ln,{instance:e})}),(0,Z.jsx)(In,{instance:e})]})})}function In({instance:e}){let t=f(F.instanceSync.forceInstanceSync),n=W(),[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(an());break;case`no_agents`:n.success(je());break;case`no_bridge_url`:n.error(cn());break;case`deploy_misconfigured`:n.error(nt());break;case`unauthorized`:n.error(nn());break;case`not_served`:n.error(Qe());break;default:n.error(dn());break}}catch(e){n.error(p(),e)}finally{i(!1)}}}return(0,Z.jsxs)(`div`,{className:`oc-form`,children:[(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:yt()}),(0,Z.jsx)(`div`,{className:`flex items-center gap-2`,children:(0,Z.jsx)(L,{size:`sm`,variant:`outline`,onClick:()=>void a(),disabled:r,children:r?Pe():y()})})]})}function Ln({instance:e}){let t=N(F.bridgeAuth.listBridgeAuthStatus,{}),n=f(F.bridgeAuth.mintBridgeSecret),r=k(F.bridgeAuth.revokeBridgeSecret),i=W(),[a,o]=(0,Y.useState)(!1),[s,c]=(0,Y.useState)(null),[l,d]=(0,Y.useState)(!1),p=(t??[]).find(t=>t.instanceId===e._id),m=p!==void 0;async function h(){if(!a){o(!0);try{c((await n({instanceId:e._id})).plaintext),d(!1)}catch(e){i.error(Mt(),e)}finally{o(!1)}}}async function g(){if(!a){o(!0);try{await r({instanceId:e._id}),c(null),i.success(Qt())}catch(e){i.error(Mt(),e)}finally{o(!1)}}}async function _(){if(s)try{await navigator.clipboard.writeText(s),d(!0)}catch{}}return(0,Z.jsxs)($,{label:xt(),children:[(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:It()}),(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Z.jsx)(H,{variant:m?`outline`:`secondary`,children:m?`${u()} · ${p.prefix}…${p.lastFour}`:mn()}),(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(L,{size:`sm`,onClick:()=>void h(),disabled:a,children:m?_t():Ht()}),m?(0,Z.jsx)(L,{size:`sm`,variant:`destructive`,onClick:()=>void g(),disabled:a,children:ut()}):null]})]}),s?(0,Z.jsxs)(`div`,{className:`oc-bridgesecret__reveal`,children:[(0,Z.jsx)(`p`,{className:`oc-sa__minted-warning`,children:at()}),(0,Z.jsxs)(`div`,{className:`oc-sa__minted-box`,children:[(0,Z.jsx)(`code`,{className:`oc-sa__minted-plain`,children:s}),(0,Z.jsx)(L,{variant:`outline`,size:`sm`,onClick:()=>void _(),children:l?I():M()})]}),(0,Z.jsx)(L,{size:`sm`,variant:`ghost`,onClick:()=>{c(null),d(!1)},children:Jt()})]}):null]})}function Rn({instanceId:e,field:t,updatedAt:n}){let r=f(F.instanceSecrets.setInstanceSecret),i=k(F.instanceSecrets.clearInstanceSecret),a=f(F.deviceIdentity.generateDeviceIdentity),s=W(),[c,l]=(0,Y.useState)(``),[d,p]=(0,Y.useState)(!1),[m,h]=(0,Y.useState)(null),[_,v]=(0,Y.useState)(!1),y=n!==null,b=t===`deviceIdentity`,ee=t===`token`?Le():t===`deviceIdentity`?D():ze();async function x(){if(!(!c.trim()||d)){p(!0);try{await r({instanceId:e,field:t,plaintext:c}),l(``),h(null),v(!1),s.success(Se())}catch(e){s.error(j(),e)}finally{p(!1)}}}async function C(){if(!d){p(!0);try{await i({instanceId:e,field:t}),h(null),v(!1),s.success(de())}catch(e){s.error(j(),e)}finally{p(!1)}}}async function te(){if(!d){p(!0);try{h(await a({instanceId:e})),v(!1),s.success(Ot())}catch(e){s.error(g(),e)}finally{p(!1)}}}let w=m?`openclaw devices approve ${m.id}`:``;async function T(){if(w)try{await navigator.clipboard.writeText(w),v(!0)}catch{}}return(0,Z.jsxs)($,{label:ee,children:[b?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:o()}):null,(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Z.jsx)(H,{variant:y?`outline`:`secondary`,children:y?u():mn()}),(0,Z.jsx)(R,{type:`password`,autoComplete:`off`,className:`flex-1 min-w-32`,value:c,placeholder:y?le():ke(),onChange:e=>l(e.target.value)}),(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(L,{size:`sm`,onClick:()=>void x(),disabled:d||c.trim().length===0,children:A()}),b?(0,Z.jsx)(L,{size:`sm`,variant:`outline`,onClick:()=>void te(),disabled:d,children:wt()}):null,y?(0,Z.jsx)(L,{size:`sm`,variant:`destructive`,onClick:()=>void C(),disabled:d,children:S()}):null]})]}),m?(0,Z.jsxs)(`div`,{className:`oc-bridgesecret__reveal`,children:[(0,Z.jsx)(`p`,{className:`text-sm font-medium`,children:Ot()}),(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:ve()}),(0,Z.jsxs)(`div`,{className:`oc-sa__minted-box`,children:[(0,Z.jsx)(`code`,{className:`oc-sa__minted-plain`,children:w}),(0,Z.jsx)(L,{variant:`outline`,size:`sm`,onClick:()=>void T(),children:_?I():M()})]}),(0,Z.jsx)(L,{size:`sm`,variant:`ghost`,onClick:()=>{h(null),v(!1)},children:Jt()})]}):null]})}var zn={conversational:Ge,documentary:ae,summarizer:ft,curator:Pt},Bn={conversational:Je,documentary:Kt,summarizer:en,curator:st},Vn=e=>(zn[e]??(()=>e))(),Hn=e=>(Bn[e]??(()=>``))();function Un({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:pt()}),t.map(e=>(0,Z.jsx)(H,{variant:`secondary`,className:`oc-agenttype__chip`,title:Hn(e),children:Vn(e)},e)),(0,Z.jsxs)(wn,{children:[(0,Z.jsx)(Sn,{asChild:!0,children:(0,Z.jsx)(L,{type:`button`,variant:`outline`,size:`sm`,className:`h-7`,children:a()})}),(0,Z.jsxs)(Tn,{align:`start`,className:`oc-agenttypes-pop`,children:[(0,Z.jsx)(`p`,{className:`oc-agenttypes-pop__title`,children:Oe()}),(0,Z.jsx)(`p`,{className:`oc-agenttypes-pop__hint`,children:Ze()}),(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)(vn,{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:Vn(r)}),(0,Z.jsx)(`span`,{className:`oc-agenttypes-pop__desc`,children:Hn(r)})]})]},r)})})]})]})]})}function Wn({instanceName:e,open:t,onOpenChange:n}){let r=N(F.agents.listAgentsForInstance,t&&e?{instanceName:e}:`skip`),i=k(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)})}),a=k(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})}),o=k(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=jn(r);e.setQuery(F.agents.listAgentsForInstance,{instanceName:t},{...i,agents:i.agents.map(e=>e.agentId===n?{...e,types:a}:e)})}),c=k(F.agents.setAgentDescription).withOptimisticUpdate((e,{instanceName:t,agentId:n,description:r})=>{let i=e.getQuery(F.agents.listAgentsForInstance,{instanceName:t});if(!i)return;let a=r.trim();e.setQuery(F.agents.listAgentsForInstance,{instanceName:t},{...i,agents:i.agents.map(e=>e.agentId===n?{...e,description:a.length===0?null:a}:e)})}),l=k(F.agents.removeInstanceAgent),u=k(F.agents.setAgentReservation),f=N(F.groups.listGroupLabels,t?{}:`skip`),p=Cn(),m=W();async function h(t,n){if(e&&await p({title:Tt({name:n}),description:s(),confirmLabel:fe()}))try{await u({instanceName:e,agentId:t,groupId:null})}catch(e){m.error(P(),V(e))}}async function g(t,n,r){if(!e)return;let i=(f??[]).find(e=>e._id===r)?.name??`?`;if(await p({title:tn({name:n,group:i}),description:Ft({group:i}),confirmLabel:ct()}))try{await u({instanceName:e,agentId:t,groupId:r})}catch(e){m.error(P(),V(e))}}async function _(t,n){if(e)try{await i({instanceName:e,agentId:t,enabled:n})}catch(e){m.error(P(),e)}}async function v(t){if(e)try{await a({instanceName:e,agentId:t})}catch(e){m.error(P(),e)}}async function y(t,n,r){if(!e)return;let i=r.includes(n)?r.filter(e=>e!==n):[...r,n];try{await o({instanceName:e,agentId:t,types:i})}catch(e){m.error(P(),e)}}async function b(t,n){if(e&&await p({title:He({name:n}),description:Re(),confirmLabel:O(),destructive:!0}))try{await l({instanceName:e,agentId:t}),m.success(Be())}catch(e){m.error(P(),e)}}return(0,Z.jsx)(z,{open:t,onOpenChange:n,children:(0,Z.jsxs)(En,{className:`oc-access`,children:[(0,Z.jsxs)(B,{children:[(0,Z.jsx)(yn,{children:Bt({name:e??``})}),(0,Z.jsx)(bn,{children:et()})]}),r===void 0?(0,Z.jsx)(`p`,{className:`oc-access__hint`,children:d()}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`div`,{className:`oc-access__poll`,children:r.discovery===null?hn():r.discovery.lastPollOk?Ae():ue({error:r.discovery.error??`?`})}),r.agents.length===0?(0,Z.jsx)(`p`,{className:`oc-access__hint`,children:ne()}):(0,Z.jsx)(`div`,{className:`oc-access__list`,children:r.agents.map(t=>{let n=t.presentInLastOk===!1,i=r.defaultAgentId===t.agentId,a=t.displayName??t.agentId,o=t.types??[];return(0,Z.jsxs)(`div`,{className:`oc-agentcard`+(t.enabled?``:` oc-agentcard--off`),children:[(0,Z.jsxs)(`div`,{className:`oc-agentcard__head`,children:[(0,Z.jsx)(vn,{checked:t.enabled,disabled:n,"aria-label":a,onCheckedChange:e=>void _(t.agentId,e===!0)}),(0,Z.jsxs)(`span`,{className:`oc-agentcard__name`,title:a,children:[t.emoji?`${t.emoji} `:``,a]}),t.model?(0,Z.jsx)(`span`,{className:`oc-access__model`,children:t.model}):null,t.reserved?(0,Z.jsx)(H,{variant:`outline`,children:t.reserved.groupName===null?he():Ce({group:t.reserved.groupName})}):null,n?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(H,{variant:`outline`,className:`oc-access__gone`,children:ye()}),(0,Z.jsx)(L,{size:`sm`,variant:`ghost`,className:`h-7 text-destructive`,onClick:()=>void b(t.agentId,a),children:E()})]}):i?(0,Z.jsx)(H,{variant:`default`,children:C()}):(0,Z.jsx)(L,{size:`sm`,variant:`outline`,className:`h-7`,disabled:!t.enabled||t.reserved!==null,onClick:()=>void v(t.agentId),children:ce()})]}),t.reserved?(0,Z.jsxs)(`div`,{className:`oc-agentcard__head`,children:[(0,Z.jsx)(L,{size:`sm`,variant:`outline`,className:`h-7`,onClick:()=>void h(t.agentId,a),children:fe()}),(0,Z.jsxs)(K,{value:``,onValueChange:e=>void g(t.agentId,a,e),children:[(0,Z.jsx)(q,{size:`sm`,className:`h-7`,children:(0,Z.jsx)(U,{placeholder:kt()})}),(0,Z.jsx)(J,{children:(f??[]).filter(e=>e._id!==t.reserved?.groupId).map(e=>(0,Z.jsx)(G,{value:e._id,children:e.name},e._id))})]})]}):null,t.enabled?(0,Z.jsx)(Un,{agentId:t.agentId,types:o,onToggle:e=>void y(t.agentId,e,o)}):null,t.enabled?(0,Z.jsx)(Gn,{value:t.description??``,onSave:async n=>{if(e)try{await c({instanceName:e,agentId:t.agentId,description:n})}catch(e){m.error(P(),e)}}}):null]},t.agentId)})})]})]})})}function Gn({value:e,onSave:t}){let[n,r]=(0,Y.useState)(e);(0,Y.useEffect)(()=>{r(e)},[e]);let i=()=>{n.trim()!==e.trim()&&t(n)};return(0,Z.jsx)(R,{className:`oc-agentcard__desc`,value:n,maxLength:280,placeholder:Rt(),"aria-label":Xt(),onChange:e=>r(e.target.value),onBlur:i,onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),i())}})}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{Pn as InstancesTab};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Ah as r,BX as i,Dh as a,Eh as o,HX as s,Mh as c,Oh as l,Th as u,UX as d,aR as f,cR as p,dR as m,fR as h,iR as g,jh as _,kh as v,lR as y,mR as b,nR as x,oR as S,pR as C,rR as w,sR as T,t as E,tR as D,uR as O,wh as k}from"./api--rqKQo-l.js";import{t as A}from"./button-HksxbiUF.js";import{$t as j,Jt as M,Mt as N}from"./index-l7elBM2O.js";var P=t(e(),1),F=n();function I(){let e=d(E.integrations.status.status,{}),t=s(E.admin.setIntegrationConfig),[n,i]=(0,P.useState)(null);if((0,P.useEffect)(()=>{e&&n===null&&i(e.config)},[e,n]),!e||!n)return(0,F.jsx)(`p`,{className:`oc-admin__hint`,children:b()});let a=n,o=(e,t,n)=>i({...a,[e]:{...a[e],[t]:n}}),l=(e,n)=>void t({[e]:n});return(0,F.jsxs)(F.Fragment,{children:[(0,F.jsxs)(`p`,{className:`oc-admin__hint`,children:[C(),` `,(0,F.jsx)(`strong`,{children:h()}),` `,m()]}),(0,F.jsxs)(L,{title:`Langfuse`,status:e.langfuse.configured?e.langfuse.enabled?(0,F.jsx)(M,{variant:`secondary`,children:O()}):(0,F.jsx)(M,{variant:`outline`,children:y()}):(0,F.jsx)(M,{variant:`outline`,children:p()}),note:T(),children:[(0,F.jsx)(R,{label:f(),children:(0,F.jsx)(j,{value:a.langfuse.host??``,placeholder:e.langfuse.effectiveHost,onChange:e=>o(`langfuse`,`host`,e.target.value),onBlur:()=>l(`langfuse`,{host:a.langfuse.host??``})})}),(0,F.jsx)(z,{label:D(),checked:a.langfuse.enabled??!0,onChange:e=>{o(`langfuse`,`enabled`,e),l(`langfuse`,{enabled:e})}})]}),(0,F.jsxs)(L,{title:`Opik`,status:e.opik.configured?e.opik.enabled?(0,F.jsx)(M,{variant:`secondary`,children:O()}):(0,F.jsx)(M,{variant:`outline`,children:y()}):(0,F.jsx)(M,{variant:`outline`,children:p()}),note:S(),children:[(0,F.jsx)(R,{label:g(),children:(0,F.jsx)(j,{value:a.opik.baseUrl??``,placeholder:e.opik.effectiveBaseUrl,onChange:e=>o(`opik`,`baseUrl`,e.target.value),onBlur:()=>l(`opik`,{baseUrl:a.opik.baseUrl??``})})}),(0,F.jsx)(R,{label:w(),children:(0,F.jsx)(j,{value:a.opik.workspace??``,placeholder:e.opik.effectiveWorkspace||x(),onChange:e=>o(`opik`,`workspace`,e.target.value),onBlur:()=>l(`opik`,{workspace:a.opik.workspace??``})})}),(0,F.jsx)(z,{label:D(),checked:a.opik.enabled??!0,onChange:e=>{o(`opik`,`enabled`,e),l(`opik`,{enabled:e})}})]}),(0,F.jsxs)(L,{title:`OpenTelemetry (OTLP)`,status:e.otlp.configured?e.otlp.enabled?(0,F.jsx)(M,{variant:`secondary`,children:O()}):(0,F.jsx)(M,{variant:`outline`,children:y()}):(0,F.jsx)(M,{variant:`outline`,children:c()}),note:_(),children:[(0,F.jsx)(R,{label:r(),children:(0,F.jsx)(j,{value:a.otlp.endpoint??``,placeholder:e.otlp.effectiveEndpoint||`https://otlp.example.com/v1/traces`,onChange:e=>o(`otlp`,`endpoint`,e.target.value),onBlur:()=>l(`otlp`,{endpoint:a.otlp.endpoint??``})})}),(0,F.jsx)(B,{headersSet:e.otlp.headersSet}),(0,F.jsx)(z,{label:D(),checked:a.otlp.enabled??!0,onChange:e=>{o(`otlp`,`enabled`,e),l(`otlp`,{enabled:e})}})]})]})}function L({title:e,status:t,note:n,children:r}){return(0,F.jsxs)(`section`,{className:`oc-int__section`,children:[(0,F.jsxs)(`div`,{className:`oc-int__section-head`,children:[(0,F.jsx)(`h3`,{className:`oc-uipa__h`,children:e}),t]}),n?(0,F.jsx)(`p`,{className:`oc-uipa__note`,children:n}):null,(0,F.jsx)(`div`,{className:`oc-int__fields`,children:r})]})}function R({label:e,children:t}){return(0,F.jsxs)(`label`,{className:`oc-int__field`,children:[(0,F.jsx)(`span`,{className:`oc-int__field-label`,children:e}),t]})}function z({label:e,checked:t,onChange:n}){return(0,F.jsxs)(`label`,{className:`oc-int__toggle`,children:[(0,F.jsx)(N,{checked:t,onCheckedChange:e=>n(e===!0)}),(0,F.jsx)(`span`,{children:e})]})}function B({headersSet:e}){let t=i(E.integrations.otlpSecret.setOtlpHeaders),n=s(E.integrations.otlpSecret.clearOtlpHeaders),[r,c]=(0,P.useState)(``),[d,f]=(0,P.useState)(null),[p,m]=(0,P.useState)(!1),h=async()=>{m(!0),f(null);try{await t({headersJson:r}),c(``)}catch(e){f(e instanceof Error?e.message:String(e))}finally{m(!1)}};return(0,F.jsxs)(R,{label:v(),children:[(0,F.jsx)(j,{value:r,placeholder:e?l():a(),onChange:e=>c(e.target.value)}),(0,F.jsxs)(`div`,{className:`oc-int__otlp-headers-actions`,children:[(0,F.jsx)(A,{size:`sm`,disabled:p||r.trim().length===0,onClick:()=>void h(),children:o()}),e?(0,F.jsx)(A,{variant:`ghost`,size:`sm`,disabled:p,onClick:()=>void n({}),children:u()}):null]}),d?(0,F.jsx)(`p`,{className:`oc-int__otlp-headers-error`,children:d}):null,(0,F.jsx)(`p`,{className:`oc-uipa__note`,children:k()})]})}export{I as IntegrationsTab};
|