@lacneu/atrium 0.97.0 → 0.98.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/{AccessTab-CHD9OGB2.js → AccessTab-CRwVD6bj.js} +1 -1
- package/dist/assets/{AdvancedFilter-DtBAnHBl.js → AdvancedFilter-Dnyuc-Bv.js} +1 -1
- package/dist/assets/AgentFilesTab-CPNOuN7W.js +3 -0
- package/dist/assets/AnomaliesTab-LNX-bDmU.js +1 -0
- package/dist/assets/AuditTab-Bo5FFLse.js +1 -0
- package/dist/assets/BridgeTab-5DckBVxB.js +1 -0
- package/dist/assets/ChatDefaultsTab-CI7bnli7.js +1 -0
- package/dist/assets/{DataTableShell-D-TTxNiz.js → DataTableShell-Dekyfrzb.js} +1 -1
- package/dist/assets/DeletedChatsTab-CBrccWUL.js +1 -0
- package/dist/assets/{DetailChips-BG1A-DBR.js → DetailChips-Kz4cbymu.js} +1 -1
- package/dist/assets/FeedbacksTab-nr2NGnOq.js +1 -0
- package/dist/assets/{FieldLabel-CYivkNb7.js → FieldLabel-Dug2NEx7.js} +1 -1
- package/dist/assets/FilesTab-DQI3Qs6I.js +1 -0
- package/dist/assets/{FilterBar-BcbgCjju.js → FilterBar-Ct8JGeev.js} +1 -1
- package/dist/assets/{GroupsTab-Bu6exndB.js → GroupsTab-FMHdOf15.js} +1 -1
- package/dist/assets/InstancesTab-1l_YlKBp.js +1 -0
- package/dist/assets/{IntegrationsTab-DkNTP0Rq.js → IntegrationsTab-qHBzXhyJ.js} +1 -1
- package/dist/assets/KpiTab-Pi-1zup5.js +1 -0
- package/dist/assets/PreferencesTab-DHQv8afQ.js +1 -0
- package/dist/assets/ProjectPage-B9VswV7G.js +1 -0
- package/dist/assets/PromptInjectionsTab-Bm9tmvcD.js +4 -0
- package/dist/assets/RolesTab-D0xnbubk.js +1 -0
- package/dist/assets/ScheduledTab-D0CdWK0x.js +1 -0
- package/dist/assets/ServiceAccountsTab-BLbO_-PK.js +1 -0
- package/dist/assets/{SubAgentReportsTab-f79L5P5H.js → SubAgentReportsTab-CeMPpWp2.js} +1 -1
- package/dist/assets/ThemeShowroom-BJf2qNsA.js +1 -0
- package/dist/assets/{TimeRangePicker-spgMK1lW.js → TimeRangePicker-1vrUmBZJ.js} +1 -1
- package/dist/assets/{TimezoneCombobox-A-0jP4K0.js → TimezoneCombobox-Bs8PmRcr.js} +1 -1
- package/dist/assets/TracesTab-CQNXeU8n.js +1 -0
- package/dist/assets/{TrashTab-DvQVUDCO.js → TrashTab-CanoobNv.js} +1 -1
- package/dist/assets/UsersTab-SU4FWI5C.js +1 -0
- package/dist/assets/{VoiceTab--hK27XzX.js → VoiceTab-C2JssfrM.js} +1 -1
- package/dist/assets/{api-B8SYK4Qy.js → api-BEXV-QDx.js} +5 -5
- package/dist/assets/{button-CXjFGJbj.js → button-BI4NYd7l.js} +1 -1
- package/dist/assets/{card-RKiqrSX4.js → card-CUy80Snk.js} +1 -1
- package/dist/assets/chevrons-up-down-BBnIDUVh.js +1 -0
- package/dist/assets/{compatView-DTsAloUX.js → compatView-C6vyLpqy.js} +1 -1
- package/dist/assets/{dispatchErrorInfo-CPqs6Yse.js → dispatchErrorInfo-U1f-h1hb.js} +1 -1
- package/dist/assets/{dist-Bt7EMDhU.js → dist-BgUgjwlI.js} +1 -1
- package/dist/assets/{dist-CtzGb_ur.js → dist-Yi0k4JhM.js} +1 -1
- package/dist/assets/{dist-7qJAgXuT.js → dist-ibS6mHJS.js} +1 -1
- package/dist/assets/{dist-DV2cg11u.js → dist-xED7lptS.js} +1 -1
- package/dist/assets/{highlighted-body-OFNGDK62-D7hrEPuh.js → highlighted-body-OFNGDK62-DKzMKZqC.js} +1 -1
- package/dist/assets/index-04n15OUt.css +1 -0
- package/dist/assets/index-CND0zLpO.js +448 -0
- package/dist/assets/{list-77P9EclZ.js → list-CMpIlPcq.js} +1 -1
- package/dist/assets/mermaid-GHXKKRXX-U8_Ynrg_.js +1 -0
- package/dist/assets/{pdf-d0093JRQ.js → pdf-B2fugRCF.js} +1 -1
- package/dist/assets/roleDescriptions-BUL4ira1.js +1 -0
- package/dist/assets/{table-BpXDMEP0.js → table-CvUcBPgp.js} +1 -1
- package/dist/assets/trashPage-CtRjTgEJ.js +1 -0
- package/dist/assets/{use_paginated_query-DXjegJvG.js → use_paginated_query-CWrNoLih.js} +1 -1
- package/dist/assets/x-ijoBrBAS.js +1 -0
- package/dist/index.html +9 -9
- package/package.json +1 -1
- package/dist/assets/AgentFilesTab-Dv3deQ0j.js +0 -3
- package/dist/assets/AnomaliesTab-DhbNorRL.js +0 -1
- package/dist/assets/AuditTab-CyAOp6ce.js +0 -1
- package/dist/assets/BridgeTab-BUWF4UrP.js +0 -1
- package/dist/assets/ChatDefaultsTab-DiPPZqHr.js +0 -1
- package/dist/assets/DeletedChatsTab-BdBsLuP7.js +0 -1
- package/dist/assets/FeedbacksTab-Dgzk0NDh.js +0 -1
- package/dist/assets/FilesTab-B0bwkp5L.js +0 -1
- package/dist/assets/InstancesTab-DG5eRqcF.js +0 -1
- package/dist/assets/KpiTab-DxUA3rWG.js +0 -1
- package/dist/assets/PreferencesTab-CvrFdw7V.js +0 -1
- package/dist/assets/ProjectPage-IHPI3vtI.js +0 -1
- package/dist/assets/PromptInjectionsTab-WqUP6pCA.js +0 -4
- package/dist/assets/RolesTab-CW-SViZn.js +0 -1
- package/dist/assets/ScheduledTab-xhuLTCC1.js +0 -1
- package/dist/assets/ServiceAccountsTab-CPgJugHH.js +0 -1
- package/dist/assets/ThemeShowroom-DCvO9d1X.js +0 -1
- package/dist/assets/TracesTab-LLYV5o4G.js +0 -1
- package/dist/assets/UsersTab-jG9dMte6.js +0 -1
- package/dist/assets/chevrons-up-down-C5nDK8w5.js +0 -1
- package/dist/assets/index-CJlTinIx.css +0 -1
- package/dist/assets/index-DDEtFVdr.js +0 -448
- package/dist/assets/mermaid-GHXKKRXX-CaN0vriA.js +0 -1
- package/dist/assets/roleDescriptions-Cr2PVmkf.js +0 -1
- package/dist/assets/trashPage-LA_ooyZZ.js +0 -1
- package/dist/assets/x-Cqa-YMkZ.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$b as r,Qb as i,Zb as a,ax as o,cx as s,dx as c,
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$b as r,Qb as i,Zb as a,ax as o,cx as s,dx as c,ex as l,ix as u,lx as d,nx as f,ox as p,pX as m,rX as h,rx as g,sx as _,t as v,tx as y,ux as b}from"./api-BEXV-QDx.js";import{Jt as x,St as S,bt as C,vt as w,xt as T,yt as E}from"./index-CND0zLpO.js";var D=t(e(),1);function O(e){return e===`user`?y():e===`all`?l():r({group:e.group})}function k(e){return e===`common`?i():e===`owner`?a():r({group:e.group})}var A=n();function j(e){return e.name||e.email||e.userId.slice(0,8)}function M(){let e=m(v.admin.listUsers,{}),[t,n]=(0,D.useState)(``),r=m(v.introspect.introspectUser,t?{userId:t}:`skip`);return(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:c()}),(0,A.jsxs)(w,{value:t,onValueChange:n,children:[(0,A.jsx)(T,{size:`sm`,"aria-label":b(),children:(0,A.jsx)(S,{placeholder:b()})}),(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:d()}):r===void 0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:h()}):(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:r.user.label}),(0,A.jsx)(x,{variant:`secondary`,children:r.role})]})]}),(0,A.jsxs)(`section`,{className:`oc-introspect__section`,children:[(0,A.jsx)(`h3`,{className:`oc-introspect__title`,children:_()}),r.groups.length===0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:g()}):(0,A.jsx)(`div`,{className:`oc-introspect__chips`,children:r.groups.map(e=>(0,A.jsx)(x,{variant:`secondary`,children:e.name},e.groupId))})]}),(0,A.jsxs)(`section`,{className:`oc-introspect__section`,children:[(0,A.jsx)(`h3`,{className:`oc-introspect__title`,children:p()}),r.agents.length===0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:g()}):(0,A.jsx)(`ul`,{className:`oc-introspect__list`,children:r.agents.map(e=>(0,A.jsxs)(`li`,{className:`oc-introspect__row`,children:[(0,A.jsx)(`span`,{className:`oc-introspect__name`,children:e.displayName||e.agentId}),e.isDefault?(0,A.jsx)(x,{variant:`default`,children:f()}):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:o()}),r.charts.length===0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:g()}):(0,A.jsx)(`ul`,{className:`oc-introspect__list`,children:r.charts.map(e=>(0,A.jsxs)(`li`,{className:`oc-introspect__row`,children:[(0,A.jsx)(`span`,{className:`oc-introspect__name`,children:e.name}),(0,A.jsx)(x,{variant:`outline`,children:k(e.via)})]},e.key))})]}),(0,A.jsxs)(`section`,{className:`oc-introspect__section`,children:[(0,A.jsx)(`h3`,{className:`oc-introspect__title`,children:u()}),r.permissions.length===0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:g()}):(0,A.jsx)(`div`,{className:`oc-introspect__chips`,children:r.permissions.map(e=>(0,A.jsx)(x,{variant:`secondary`,children:e},e))})]})]})]})}export{M as AccessTab};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{AC as r,FC as i,IC as a,MC as o,NC as s,PC as c,jC as l}from"./api-
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{AC as r,FC as i,IC as a,MC as o,NC as s,PC as c,jC as l}from"./api-BEXV-QDx.js";import{r as u}from"./dist-ibS6mHJS.js";import{t as d}from"./x-ijoBrBAS.js";import{t as f}from"./button-BI4NYd7l.js";import{$t as p,Ln as m,St as h,bt as g,vt as _,xt as v,yt as y}from"./index-CND0zLpO.js";import{r as b}from"./TimeRangePicker-1vrUmBZJ.js";var x=t(e(),1),S=n(),C=[{value:`eq`,label:`=`},{value:`neq`,label:`≠`},{value:`contains`,label:a()},{value:`gt`,label:`>`},{value:`gte`,label:`≥`},{value:`lt`,label:`<`},{value:`lte`,label:`≤`}],w=1;function T(){return{id:w++,field:``,op:`eq`,value:``}}function E(e){return e.map(e=>({id:w++,field:e.field,op:e.op,value:String(e.value)}))}function D({fields:e,seed:t,onChange:n}){let a=(0,x.useRef)(t),w=!!(a.current&&a.current.length>0),[D,O]=(0,x.useState)(w),[k,A]=(0,x.useState)(()=>w?E(a.current):[]);function j(e){n(e.filter(e=>e.field!==``&&e.value!==``).map(e=>({field:e.field,op:e.op,value: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}),i(),F>0?(0,S.jsx)(`span`,{className:`oc-advfilter__count`,children:F}):null]}),D?(0,S.jsxs)(`div`,{className:`oc-advfilter__body`,children:[k.length===0?(0,S.jsx)(`p`,{className:`oc-admin__hint`,children:c()}):(0,S.jsx)(`ul`,{className:`oc-advfilter__rows`,children:k.map(t=>(0,S.jsxs)(`li`,{className:`oc-advfilter__row`,children:[(0,S.jsxs)(_,{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:s()})}),(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:o()}),(0,S.jsx)(f,{variant:`ghost`,size:`icon-sm`,"aria-label":l(),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,{}),r()]})]}):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{$d as r,A_ as i,Ad as a,C_ as o,D_ as s,E_ as c,F_ as l,Fd as u,I_ as d,M_ as ee,Md as f,N_ as p,Nd as m,O_ as h,P_ as g,Pd as _,Qd as v,S_ as y,Sv as b,T_ as x,Zd as S,__ as C,_f as w,aX as te,af as T,b_ as ne,bv as re,c_ as E,cf as D,d_ as O,df as k,ef as A,fX as j,f_ as M,ff as N,g_ as P,gf as F,h_ as I,hf as L,if as R,j_ as ie,jd as z,k_ as ae,kd as oe,l_ as se,lf as B,mV as V,m_ as ce,mf as le,nf as ue,of as de,pX as H,p_ as fe,pf as pe,rX as U,rf as me,s_ as he,sf as ge,ss as _e,t as W,tf as ve,uX as G,u_ as ye,uf as be,v_ as xe,w_ as Se,x_ as Ce,y_ as we}from"./api-BEXV-QDx.js";import{t as K}from"./button-BI4NYd7l.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-CND0zLpO.js";import{n as Ke,t as qe}from"./curation-CQksaIbm.js";import{a as Je}from"./compatView-C6vyLpqy.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=H(W.me.getMe,{host:ze}),t=e?.role===`admin`,n=(e?.permissions??[]).includes(`bridge.read`),r=H(W.admin.listInstances,e!==void 0&&t?{}:`skip`),[a,o]=(0,Y.useState)(null);(0,Y.useEffect)(()=>{!t||!r||r.length===0||(!a||!r.some(e=>e.name===a))&&o(r[0].name)},[t,r,a]);let u=H(W.agents.listAgentsForInstance,t&&a?{instanceName:a}:`skip`),f=H(W.agents.listMyAgents,e!==void 0&&!t?{}:`skip`),m=(0,Y.useMemo)(()=>{if(e!==void 0){if(t)return a===null||u===void 0?r!==void 0&&r.length===0?[]:void 0:u.agents.map(e=>({instanceName:a,agentId:e.agentId,label:`${e.emoji?`${e.emoji} `:``}${e.displayName??e.agentId}`}));if(f!==void 0)return f.map(e=>({instanceName:e.instanceName,agentId:e.agentId,label:`${e.emoji?`${e.emoji} `:``}${e.displayName??e.agentId}`}))}},[e,t,a,u,r,f]),[_,v]=(0,Y.useState)(null);(0,Y.useEffect)(()=>{!m||m.length===0||(!_||!m.some(e=>$(e)===_))&&v($(m[0]))},[m,_]);let y=m?.find(e=>$(e)===_)??null,b=G(W.agentFiles.listAgentFiles),[S,C]=(0,Y.useState)({status:`idle`}),w=y?.instanceName??null,T=y?.agentId??null,ne=H(W.compat.forInstance,n&&w!==null?{instanceName:w}:`skip`),E=n&&w!==null?Be(ne,`agentFiles`):null,D=E===null?!1:E===`loading`?null:E.blocked,O=(0,Y.useCallback)(async()=>{if(!(w===null||T===null)){C({status:`loading`});try{C({status:`done`,files:(await b({instanceName:w,agentId:T})).files})}catch(e){C({status:`error`,dashboardAbsent:tt(e)})}}},[b,w,T]);(0,Y.useEffect)(()=>{D===!1&&O()},[O,D]);let[k,A]=(0,Y.useState)(null),j=H(W.agentFileCuration.listCurations,t&&w!==null&&T!==null?{instanceName:w,agentId:T}:`skip`),M=H(W.agentFileCuration.curationSettings,t&&w!==null?{instanceName:w}:`skip`),P=G(W.agentFileCuration.requestCuration),[F,I]=(0,Y.useState)(null),[L,R]=(0,Y.useState)(null),{toast:z}=q(),oe=(0,Y.useMemo)(()=>{let e=new Map;for(let t of j??[])e.has(t.name)||e.set(t.name,t);return e},[j]),se=(0,Y.useCallback)(async e=>{if(!(w===null||T===null)){I(e);try{let t=await P({instanceName:w,agentId:T,name:e,trigger:`manual`});t.ok?z({title:le(),variant:`success`}):z({title:pe({reason:t.reason??`unknown`}),variant:`error`})}catch{z({title:N(),variant:`error`})}finally{I(null)}}},[P,w,T,z]),B=te(),V=(0,Y.useMemo)(()=>new Intl.NumberFormat(B,{maximumFractionDigits:0}),[B]);return e===void 0||m===void 0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:U()}):(0,Q.jsxs)(`div`,{className:`oc-afiles`,children:[(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:d()}),(0,Q.jsxs)(`div`,{className:`oc-afiles__picker`,children:[t&&(r?.length??0)>1?(0,Q.jsxs)(He,{value:a??``,onValueChange:e=>o(e),children:[(0,Q.jsx)(We,{size:`sm`,"aria-label":l(),children:(0,Q.jsx)(Ne,{})}),(0,Q.jsx)(Ge,{children:(r??[]).map(e=>(0,Q.jsx)(Re,{value:e.name,children:e.name},e.name))})]}):null,m.length>0?(0,Q.jsxs)(He,{value:_??``,onValueChange:e=>v(e),children:[(0,Q.jsx)(We,{size:`sm`,"aria-label":g(),children:(0,Q.jsx)(Ne,{})}),(0,Q.jsx)(Ge,{children:m.map(e=>(0,Q.jsx)(Re,{value:$(e),children:e.label},$(e)))})]}):(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:p()})]}),y===null?null:E===`loading`?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:U()}):E!==null&&E.blocked?(0,Q.jsxs)(`p`,{className:`oc-compat__blocked`,role:`status`,children:[(0,Q.jsx)(J,{size:14,"aria-hidden":!0}),` `,Je(E.gatewayVersion,E.provider)]}):S.status===`loading`||S.status===`idle`?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:U()}):S.status===`error`?(0,Q.jsxs)(`p`,{className:`oc-afiles__error`,role:`alert`,children:[S.dashboardAbsent?_e():ie(),` `,!S.dashboardAbsent&&(0,Q.jsx)(K,{variant:`outline`,size:`sm`,onClick:()=>void O(),children:re()})]}):S.files.length===0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:ee()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`div`,{className:`oc-afiles__list`,children:S.files.map(e=>{let n=Xe(e.size),r=n>=80;return(0,Q.jsxs)(`div`,{className:`oc-afiles__row`,children:[(0,Q.jsx)(`span`,{className:`oc-afiles__name`,title:e.name,children:e.name}),e.missing?(0,Q.jsx)(Ae,{variant:`outline`,children:i()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`span`,{className:`oc-afiles__size`,children:ae({size:Z(e.size,B)})}),(0,Q.jsx)(`span`,{className:`oc-afiles__gauge${r?` is-warn`:``}`,"aria-hidden":!0,children:(0,Q.jsx)(`span`,{className:`oc-afiles__gauge-fill`,style:{width:`${Math.min(n,100)}%`}})}),(0,Q.jsx)(`span`,{className:`oc-afiles__pct`,children:h({pct:V.format(n)})}),r?(0,Q.jsx)(J,{size:14,className:`oc-afiles__warn`,"aria-label":s()}):(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:()=>A(e),children:t?x():Se()}),t&&!e.missing?(0,Q.jsx)(it,{curatable:qe.includes(e.name),size:e.size??0,budget:M?.budgetChars??null,enabled:M?.enabled??!1,curation:oe.get(e.name)??null,inFlight:F===e.name,onCurate:()=>void se(e.name),onReview:e=>R(e)}):null]},e.name)})}),(0,Q.jsx)(`p`,{className:`oc-afiles__budget`,children:c({used:Z(Qe(S.files),B),total:Z(Ye,B),pct:V.format(Ze(Qe(S.files)))})})]}),k&&y?(0,Q.jsx)(at,{instanceName:y.instanceName,agentId:y.agentId,name:k.name,isAdmin:t,onClose:()=>A(null),onSaved:()=>void O()}):null,L?(0,Q.jsx)(ot,{curationId:L,onClose:()=>R(null),onApplied:()=>{R(null),O()}}):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:F()}):a||i?.status===`dispatched`||i?.status===`applying`?(0,Q.jsx)(Ae,{variant:`outline`,className:`oc-afiles__curate-status`,children:L()}):e&&r&&n!==null&&Ke(t,n)?(0,Q.jsx)(K,{variant:`outline`,size:`sm`,className:`oc-afiles__curate`,onClick:o,children:w()}):null}function at({instanceName:e,agentId:t,name:n,isAdmin:r,onClose:i,onSaved:a}){let s=G(W.agentFiles.getAgentFile),c=G(W.agentFiles.setAgentFile),l=q(),[u,d]=(0,Y.useState)(null),[ee,f]=(0,Y.useState)(!1),[p,m]=(0,Y.useState)(``),[h,g]=(0,Y.useState)(!1),[_,v]=(0,Y.useState)(!1),[x,S]=(0,Y.useState)(!1),[w,T]=(0,Y.useState)(!1),D=(0,Y.useCallback)(async r=>{f(!1);try{let i=await s({instanceName:e,agentId:t,name:n});d({content:i.content,updatedAtMs:i.updatedAtMs}),r||m(i.content),S(!1)}catch{f(!0)}},[s,e,t,n]);(0,Y.useEffect)(()=>{D(!1)},[D]);async function k(){if(u!==null){v(!0),T(!1);try{await c({instanceName:e,agentId:t,name:n,content:p,baseUpdatedAtMs:u.updatedAtMs??void 0}),l.success(C({name:n})),a(),await D(!1)}catch(e){nt(e)?S(!0):T(!0)}finally{v(!1)}}}let A=u!==null&&p!==u.content,j=(0,Y.useMemo)(()=>u===null?null:et(u.content,p),[u,p]),N=p.length>X,F=te(),L=(0,Y.useMemo)(()=>new Intl.NumberFormat(F),[F]);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:o({name:n})}),(0,Q.jsxs)(Pe,{children:[y({agent:t,instance:e}),r?null:(0,Q.jsxs)(Q.Fragment,{children:[` · `,Ce()]})]})]}),ee?(0,Q.jsxs)(`p`,{className:`oc-afiles__error`,role:`alert`,children:[I(),` `,(0,Q.jsx)(K,{variant:`outline`,size:`sm`,onClick:()=>void D(!1),children:re()})]}):u===null?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:U()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`textarea`,{className:`oc-afiles__source`,value:p,readOnly:!r,spellCheck:!1,onChange:e=>m(e.target.value),"aria-label":o({name:n})}),(0,Q.jsx)(`p`,{className:`oc-afiles__hint`,children:ne()}),x?(0,Q.jsxs)(`p`,{className:`oc-afiles__error`,role:`alert`,children:[ce(),` `,(0,Q.jsx)(K,{variant:`outline`,size:`sm`,onClick:()=>void D(!0),children:fe()})]}):null,w?(0,Q.jsx)(`p`,{className:`oc-afiles__error`,role:`alert`,children:P()}):null,(0,Q.jsxs)(`div`,{className:`oc-afiles__editor-foot`,children:[(0,Q.jsx)(`span`,{className:`oc-afiles__count${N?` is-over`:``}`,children:we({count:L.format(p.length),max:L.format(X)})}),r?(0,Q.jsx)(K,{size:`sm`,disabled:!A||_||x,onClick:()=>g(!0),children:_?b():xe()}):null]})]}),(0,Q.jsx)(Te,{open:h,onOpenChange:g,children:(0,Q.jsxs)(Fe,{children:[(0,Q.jsxs)(je,{children:[(0,Q.jsx)(Ve,{children:M({name:n})}),(0,Q.jsx)(Le,{children:O({agent:t})})]}),j?(0,Q.jsxs)(`div`,{className:`oc-afiles__diff`,children:[(0,Q.jsx)(`p`,{className:`oc-afiles__diff-counts`,children:ye({added:j.added,removed:j.removed})}),j.sampleAdded.length>0?(0,Q.jsxs)(`div`,{className:`oc-afiles__diff-block`,children:[(0,Q.jsx)(`span`,{className:`oc-afiles__diff-label`,children:se()}),j.sampleAdded.map((e,t)=>(0,Q.jsx)(`code`,{className:`oc-afiles__diff-line is-add`,children:e||` `},t))]}):null,j.sampleRemoved.length>0?(0,Q.jsxs)(`div`,{className:`oc-afiles__diff-block`,children:[(0,Q.jsx)(`span`,{className:`oc-afiles__diff-label`,children:E()}),j.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:V()}),(0,Q.jsx)(Ie,{onClick:()=>void k(),children:he()})]})]})})]})})}function ot({curationId:e,onClose:t,onApplied:n}){let i=H(W.agentFileCuration.getProposal,{curationId:e}),o=G(W.agentFileCuration.approveCuration),s=j(W.agentFileCuration.rejectCuration),{toast:c}=q(),[l,d]=(0,Y.useState)(null),[ee,p]=(0,Y.useState)(!1),[h,g]=(0,Y.useState)(``),y=te(),x=(0,Y.useMemo)(()=>i?et(i.beforeContent,i.proposedContent):null,[i]);async function C(){d(`approve`);try{let t=await o({curationId:e});t.ok?(c({title:k(),variant:`success`}),n()):c({title:t.reason===`conflict`?B():D({reason:t.reason??`unknown`}),variant:`error`})}catch{c({title:N(),variant:`error`})}finally{d(null)}}async function w(n){d(`reject`);try{let r=h.trim();(await s({curationId:e,...r?{comment:r}:{},relaunch:n})).ok?c({title:n?a():be(),variant:`success`}):c({title:T(),variant:`error`}),t()}catch{c({title:N(),variant:`error`})}finally{d(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:i?ge({name:i.name}):U()}),(0,Q.jsx)(Pe,{children:de()})]}),i===void 0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:U()}):i===null?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:T()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`p`,{className:`oc-afiles__review-sizes`,children:[R({before:Z(i.beforeSize,y),after:Z(i.proposedSize,y)}),i.overBudget?(0,Q.jsxs)(Q.Fragment,{children:[` `,(0,Q.jsx)(J,{size:13,"aria-hidden":!0}),` `,me()]}):null]}),x?(0,Q.jsx)(`p`,{className:`oc-afiles__review-diff`,children:ue({added:x.added,removed:x.removed})}):null,i.feedback?(0,Q.jsx)(`p`,{className:`oc-afiles__review-feedback`,children:oe({feedback:i.feedback})}):null,x&&x.sampleRemoved.length>0?(0,Q.jsxs)(`div`,{className:`oc-afiles__review-removed`,children:[(0,Q.jsx)(`p`,{className:`oc-afiles__review-label`,children:S()}),(0,Q.jsx)(`ul`,{children:x.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:v()}),(0,Q.jsx)(`pre`,{className:`oc-afiles__review-pre`,children:i.beforeContent})]}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`p`,{className:`oc-afiles__review-label`,children:ve()}),(0,Q.jsx)(`pre`,{className:`oc-afiles__review-pre`,children:i.proposedContent})]})]})]}),ee?(0,Q.jsxs)(`div`,{className:`oc-afiles__reject-form`,children:[(0,Q.jsx)(`label`,{className:`oc-afiles__review-label`,htmlFor:`curation-reject-comment`,children:u()}),(0,Q.jsx)(`textarea`,{id:`curation-reject-comment`,className:`oc-afiles__reject-textarea`,rows:3,placeholder:_(),value:h,onChange:e=>g(e.target.value)}),(0,Q.jsxs)(`div`,{className:`oc-afiles__review-actions`,children:[(0,Q.jsx)(K,{variant:`ghost`,onClick:()=>p(!1),disabled:l!==null,children:m()}),(0,Q.jsx)(K,{variant:`outline`,onClick:()=>void w(!1),disabled:l!==null,children:l===`reject`?b():f()}),(0,Q.jsx)(K,{variant:`default`,onClick:()=>void w(!0),disabled:l!==null,children:l===`reject`?b():z()})]})]}):(0,Q.jsxs)(`div`,{className:`oc-afiles__review-actions`,children:[(0,Q.jsx)(K,{variant:`outline`,onClick:()=>p(!0),disabled:l!==null||i==null,children:A()}),(0,Q.jsx)(K,{variant:`default`,onClick:()=>void C(),disabled:l!==null||i==null,children:l===`approve`?b():r()})]})]})})}export{rt as AgentFilesTab};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$j as r,AM as i,BM as a,CM as ee,DM as te,EM as ne,FM as o,GM as s,HM as c,IM as l,KM as u,LM as re,MM as ie,NM as ae,OM as oe,PM as se,Qj as d,RM as ce,SM as le,TM as ue,UM as de,VM as fe,WM as pe,_M as f,aM as p,bM as me,cM as m,dM as h,eM as g,fM as _,fX as he,gM as ge,hM as _e,iM as v,jM as ve,kM as ye,lM as be,mM as xe,nM as y,oM as Se,pM as Ce,pX as b,qM as x,rM as S,sM as C,t as w,tM as T,uM as E,vM as D,wM as O,xM as k,yM as A,zM as we}from"./api-BEXV-QDx.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 z,o as ke,vt as B,wt as V,xt as H,yt as U}from"./index-CND0zLpO.js";import{n as Ae}from"./TimeRangePicker-1vrUmBZJ.js";import{t as je}from"./FilterBar-Ct8JGeev.js";import{t as Me}from"./DataTableShell-Dekyfrzb.js";import{t as W}from"./dispatchErrorInfo-U1f-h1hb.js";var G=t(e(),1),K=new Set([`openclaw.dispatch_failures`,`assistant.announce_errors`]),q=new Set([`assistant.cause.provider_auth_revoked`,`assistant.cause.provider_permission_denied`,`assistant.cause.provider_auth_failed`]);function J(e){let t=q.has(e.kind);if(!K.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 Y=n(),X=`__all__`,Ne=[{value:`open`},{value:`acknowledged`},{value:`resolved`}];function Pe(e){return e===`open`?x():e===`acknowledged`?u():s()}var Fe=[`info`,`warn`,`critical`],Ie=[`detector`,`agent`,`user`],Le={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??``,r=e.status===Z?X:e.status,s=e.severity??X,u=e.kind??X,[d,p]=(0,G.useState)(X),g=z(e.from,e.to),{from:v,to:y}=Ae(g),x=e=>void t({search:t=>({...t,q:e||void 0}),replace:!0}),S=e=>void t({search:t=>({...t,status:e===X?Z:e})}),T=e=>void t({search:t=>({...t,severity:e===X?void 0:e})}),M=e=>void t({search:t=>({...t,kind:e===X?void 0:e})}),N=e=>void t({search:t=>({...t,...ke(e)})}),F=Ee(),V=Te(),W=he(w.anomalies.resolveAnomaly),K=(b(w.me.getMe,{host:Oe})?.permissions??[]).includes(`admin.manage`),q=b(w.anomalies.listAnomalies,{limit:Re,filter:{q:n||void 0,from:v,to:y,anomalyStatus:r===X?void 0:r,severity:s===X?void 0:s,source:d===X?void 0:d,kind:u===X?void 0:u}}),J=(0,G.useMemo)(()=>{let e=new Set;for(let t of q??[])e.add(t.kind);return[...e].sort()},[q]),Q=n!==``||r!==`open`||s!==X||d!==X||u!==X||g.kind!==`relative`||g.from!==Le.from;function $(){p(X),t({search:{status:`open`},replace:!0})}async function We(e){if(await F({title:pe(),description:(0,Y.jsxs)(Y.Fragment,{children:[de(),` `,(0,Y.jsx)(`span`,{className:`font-mono`,children:e.kind}),` `,c(),` `,(0,Y.jsx)(`strong`,{children:fe()}),`.`,` `,a()]}),confirmLabel:we()}))try{await W({anomalyId:e._id,status:`resolved`}),V.success(ce(),e.kind)}catch(e){V.error(re(),e)}}async function Ge(e){try{await W({anomalyId:e._id,status:`acknowledged`}),V.success(l(),e.kind)}catch(e){V.error(o(),e)}}return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(`p`,{className:`oc-admin__hint`,children:[se(),` `,(0,Y.jsx)(`strong`,{children:ae()}),` `,ie(),` `,(0,Y.jsx)(`strong`,{children:ve()}),` `,i(),` `,(0,Y.jsx)(`strong`,{children:ye()}),` `,oe(),` `,(0,Y.jsx)(`span`,{className:`oc-filter__window`,children:te()})]}),(0,Y.jsxs)(je,{q:n,onQChange:x,searchPlaceholder:ne(),timeRange:g,onTimeRangeChange:N,onReset:$,canReset:Q,children:[(0,Y.jsxs)(B,{value:r,onValueChange:S,children:[(0,Y.jsx)(H,{size:`sm`,className:`w-36`,children:(0,Y.jsx)(I,{})}),(0,Y.jsxs)(U,{children:[(0,Y.jsx)(L,{value:X,children:ue()}),Ne.map(e=>(0,Y.jsx)(L,{value:e.value,children:Pe(e.value)},e.value))]})]}),(0,Y.jsxs)(B,{value:s,onValueChange:T,children:[(0,Y.jsx)(H,{size:`sm`,className:`w-36`,children:(0,Y.jsx)(I,{placeholder:O()})}),(0,Y.jsxs)(U,{children:[(0,Y.jsx)(L,{value:X,children:me()}),Fe.map(e=>(0,Y.jsx)(L,{value:e,children:e},e))]})]}),(0,Y.jsxs)(B,{value:d,onValueChange:p,children:[(0,Y.jsx)(H,{size:`sm`,className:`w-32`,children:(0,Y.jsx)(I,{placeholder:A()})}),(0,Y.jsxs)(U,{children:[(0,Y.jsx)(L,{value:X,children:D()}),Ie.map(e=>(0,Y.jsx)(L,{value:e,children:e},e))]})]}),(0,Y.jsxs)(B,{value:u,onValueChange:M,children:[(0,Y.jsx)(H,{size:`sm`,className:`w-36`,children:(0,Y.jsx)(I,{placeholder:f()})}),(0,Y.jsxs)(U,{children:[(0,Y.jsx)(L,{value:X,children:ge()}),J.map(e=>(0,Y.jsx)(L,{value:e,children:e},e))]})]})]}),(0,Y.jsx)(Me,{title:_e(),rows:q,emptyHint:r===`open`?xe():Ce(),rowActions:e=>K&&e.status===`open`?[{label:_(),onSelect:()=>void We(e)},{label:h(),onSelect:()=>void Ge(e)}]:[],columns:[{header:E(),cell:e=>(0,Y.jsx)(`span`,{className:`oc-traces__time`,children:j(e.at)}),sort:e=>e.at},{header:f(),cell:e=>(0,Y.jsx)(`code`,{className:`oc-traces__mono`,children:e.kind}),sort:e=>e.kind},{header:ee(),cell:e=>e.occurrenceCount!==null&&e.occurrenceCount>1?(0,Y.jsx)(`span`,{className:`oc-traces__time`,title:e.firstAt===null?void 0:k({when:j(e.firstAt)}),children:le({count:String(e.occurrenceCount)})}):(0,Y.jsx)(`span`,{className:`oc-traces__time`,children:`—`}),sort:e=>e.occurrenceCount??0},{header:O(),cell:e=>(0,Y.jsx)(Ve,{severity:e.severity}),sort:e=>e.severity===`critical`?2:+(e.severity===`warn`)},{header:be(),cell:e=>(0,Y.jsx)(He,{status:e.status}),sort:e=>e.status===`resolved`?2:+(e.status===`acknowledged`)},{header:A(),cell:e=>(0,Y.jsx)(P,{variant:`outline`,children:e.source}),sort:e=>e.source},{header:m(),cell:e=>(0,Y.jsxs)(`div`,{className:`oc-anomaly__msgcell`,children:[(0,Y.jsx)(`span`,{className:`oc-anomaly__msg`,children:e.message}),(0,Y.jsx)(Be,{row:e})]}),sort:e=>e.message},{header:C(),cell:e=>(0,Y.jsx)(ze,{row:e}),sort:e=>e.evidence??null},{header:Se(),cell:e=>e.correlationId?(0,Y.jsx)(`code`,{className:`oc-traces__mono`,children:Ue(e.correlationId)}):(0,Y.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,Y.jsxs)(`div`,{className:`oc-anomaly__cause`,children:[(0,Y.jsx)(`div`,{className:`oc-anomaly__cause-head`,children:[...new Set(n.errorCategories??[])].map(e=>(0,Y.jsx)(`code`,{className:`oc-traces__mono`,children:e},e))}),e.correlationId?(0,Y.jsxs)(`button`,{type:`button`,className:`oc-anomaly__drill`,onClick:()=>void t({to:`/settings/traces`,search:{q:e.correlationId,limit:100}}),children:[`↗ `,p()]}):null]})}let n=J(e);if(!n.dominantCode){let e=n.sampleCorrelationId;return e?(0,Y.jsx)(`div`,{className:`oc-anomaly__cause`,children:(0,Y.jsxs)(`button`,{type:`button`,className:`oc-anomaly__drill`,onClick:()=>void t({to:`/settings/traces`,search:{correlationId:e,limit:100}}),children:[`↗ `,p()]})}):(0,Y.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})}let r=W(n.dominantCode,n.context),i=n.sampleCorrelationId;return(0,Y.jsxs)(`div`,{className:`oc-anomaly__cause`,children:[(0,Y.jsxs)(`div`,{className:`oc-anomaly__cause-head`,children:[(0,Y.jsx)(`span`,{className:`oc-anomaly__cause-label`,children:r.label}),(0,Y.jsx)(`code`,{className:`oc-traces__mono`,children:n.dominantCode})]}),(0,Y.jsx)(`p`,{className:`oc-anomaly__cause-hint`,children:r.hint}),i?(0,Y.jsxs)(`button`,{type:`button`,className:`oc-anomaly__drill`,onClick:()=>void t({to:`/settings/traces`,search:{correlationId:i,limit:100}}),children:[`↗ `,p()]}):null]})}function Be({row:e}){let[t,n]=(0,G.useState)(!1),r=b(w.anomalies.getAnomalyAttachments,t?{anomalyId:e._id}:`skip`);return!e.attachments||e.attachments.length===0?null:(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(`button`,{type:`button`,className:`oc-anomaly__drill`,onClick:()=>n(!0),children:[v(),e.attachments.length>1?` (${e.attachments.length})`:``]}),(0,Y.jsx)(M,{open:t,onOpenChange:n,children:(0,Y.jsxs)(V,{className:`oc-anomaly__attachments-dialog`,children:[(0,Y.jsx)(N,{children:(0,Y.jsx)(F,{children:S()})}),r===void 0?(0,Y.jsx)(`p`,{className:`oc-traces__muted`,children:y()}):r.length===0?(0,Y.jsx)(`p`,{className:`oc-traces__muted`,children:T()}):(0,Y.jsx)(`div`,{className:`oc-anomaly__attachments`,children:r.map(e=>(0,Y.jsxs)(`section`,{className:`oc-anomaly__attachment`,children:[(0,Y.jsx)(`h4`,{className:`oc-anomaly__attachment-name`,children:(0,Y.jsx)(`code`,{className:`oc-traces__mono`,children:e.name})}),(0,Y.jsx)(`pre`,{className:`oc-anomaly__attachment-content`,children:e.content})]},e.name))})]})})]})}function Ve({severity:e}){return(0,Y.jsx)(`span`,{className:`oc-anomaly__sev oc-anomaly__sev--${e}`,children:e})}function He({status:e}){return e===`open`?(0,Y.jsx)(P,{variant:`destructive`,children:g()}):e===`acknowledged`?(0,Y.jsx)(P,{variant:`secondary`,children:r()}):(0,Y.jsx)(P,{variant:`outline`,children:d()})}function Ue(e){return e.length>8?e.slice(0,8):e}export{Q as AnomaliesTab};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$N as r,Au as i,BN as a,Du as o,Eu as s,GN as c,HN as l,JN as u,KN as d,Ou as f,QN as p,UN as m,VN as h,WN as g,XN as _,YN as v,ZN as y,ju as b,ku as x,pX as S,qN as C,t as w,zN as T}from"./api-BEXV-QDx.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-CND0zLpO.js";import{n as ee}from"./TimeRangePicker-1vrUmBZJ.js";import{t as z}from"./FilterBar-Ct8JGeev.js";import{t as B}from"./AdvancedFilter-Dnyuc-Bv.js";import{t as V}from"./DataTableShell-Dekyfrzb.js";var H=t(e(),1),U=n(),W={kind:`relative`,from:N,to:`now`},G=`__all__`,K=[{value:`action`,label:b()},{value:`realLabel`,label:i()},{value:`targetLabel`,label:x()},{value:`impersonated`,label:f()},{value:`resource`,label:o()},{value:`resourceId`,label:s()}];function q(){let e=j({from:`/settings/audit`}),t=A({from:`/settings/audit`}),n=e.q??``,i=e.action??G,o=e.impersonated??G,s=e.resource??G,f=M(e.from,e.to),b=(0,H.useMemo)(()=>F(e.adv),[e.adv]),{from:x,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}),$=S(w.admin.listAudit,{filter:{q:n||void 0,from:x,to:N,action:i===G?void 0:i,resource:s===G?void 0:s,impersonated:o===G?void 0:o===`yes`,advanced:b.length>0?b: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!==``||i!==G||o!==G||s!==G||b.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:[r(),` `,(0,U.jsx)(`span`,{className:`oc-filter__window`,children:p()})]}),(0,U.jsxs)(z,{q:n,onQChange:q,searchPlaceholder:y(),timeRange:f,onTimeRangeChange:Z,onReset:ie,canReset:re,children:[(0,U.jsxs)(I,{value:i,onValueChange:J,children:[(0,U.jsx)(L,{size:`sm`,className:`w-40`,children:(0,U.jsx)(D,{placeholder:_()})}),(0,U.jsxs)(R,{children:[(0,U.jsx)(k,{value:G,children:v()}),te.map(e=>(0,U.jsx)(k,{value:e,children:e},e))]})]}),(0,U.jsxs)(I,{value:o,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:u()}),(0,U.jsx)(k,{value:`yes`,children:C()}),(0,U.jsx)(k,{value:`no`,children:d()})]})]}),(0,U.jsxs)(I,{value:s,onValueChange:X,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:g()}),ne.map(e=>(0,U.jsx)(k,{value:e,children:e},e))]})]})]}),(0,U.jsx)(B,{fields:K,seed:b,onChange:Q}),(0,U.jsx)(V,{title:m(),rows:$,emptyHint:l(),columns:[{header:h(),cell:e=>E(e.at),sort:e=>e.at},{header:_(),cell:e=>e.action,sort:e=>e.action},{header:a(),cell:e=>e.realLabel,sort:e=>e.realLabel},{header:T(),cell:e=>e.targetLabel??`—`,sort:e=>e.targetLabel??null},{header:c(),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,AO as i,BO as a,Bg as o,Bk as s,CO as c,DO as l,E as u,EO as d,FO as f,Fk as p,GO as m,Gg as h,Gk as ee,HO as g,Hg as _,Hk as te,IO as v,Ik as ne,JO as y,Jg as re,Jk as ie,Jl as ae,KO as oe,Kg as se,Kk as ce,LO as le,MO as ue,Mg as de,NO as fe,OO as pe,PO as me,QO as he,RO as ge,Rg as _e,SO as ve,TO as ye,UO as be,Ug as xe,Uk as Se,VO as Ce,Va as we,Vg as Te,Vk as Ee,WO as b,Wg as De,Wk as Oe,XO as ke,Xg as Ae,Xl as je,YO as Me,Yg as Ne,Yk as Pe,Yl as Fe,ZO as Ie,Zl as Le,_O as x,ak as Re,bO as ze,ck as Be,cs as Ve,dk as He,ek as Ue,eu as We,fX as Ge,fk as Ke,gO as qe,hO as S,ik as Je,jO as Ye,kO as C,lk as Xe,nk as Ze,ok as Qe,pX as w,pk as $e,qO as et,qg as tt,ql as nt,rk as rt,sk as it,t as T,tk as at,uX as ot,uk as st,vO as ct,wO as lt,xO as ut,yO as dt,zO as ft,zg as pt,zk as mt}from"./api-BEXV-QDx.js";import{r as E}from"./dist-ibS6mHJS.js";import{t as ht}from"./chevrons-up-down-BBnIDUVh.js";import{i as gt,n as D,o as _t,r as vt,s as yt}from"./FieldLabel-Dug2NEx7.js";import{t as O}from"./button-BI4NYd7l.js";import{$t as k,At as bt,Ct as xt,Dt as St,Jn as Ct,Jt as A,L as wt,Mt as Tt,Ot as Et,Pn as Dt,St as j,Tt as Ot,Yt as kt,ar as M,at as At,bt as N,cn as jt,dr as P,fr as Mt,ft as Nt,it as Pt,jt as F,kn as I,on as Ft,or as It,ot as Lt,sn as Rt,sr as L,st as zt,vt as R,wt as Bt,xt as z,yt as B}from"./index-CND0zLpO.js";import{r as Vt}from"./locales-CPjguROj.js";import{a as Ht,i as V,n as Ut,o as H,r as U,t as Wt}from"./table-CvUcBPgp.js";import{t as Gt}from"./FilterBar-Ct8JGeev.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-C6vyLpqy.js";import{t as W}from"./dispatchErrorInfo-U1f-h1hb.js";var $t=u(`refresh-cw`,[[`path`,{d:`M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8`,key:`v9h5vc`}],[`path`,{d:`M21 3v5h-5`,key:`1q7to0`}],[`path`,{d:`M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16`,key:`3uifl3`}],[`path`,{d:`M8 16H3v5`,key:`1cv678`}]]),en=u(`wifi-off`,[[`path`,{d:`M12 20h.01`,key:`zekei9`}],[`path`,{d:`M8.5 16.429a5 5 0 0 1 7 0`,key:`1bycff`}],[`path`,{d:`M5 12.859a10 10 0 0 1 5.17-2.69`,key:`1dl1wf`}],[`path`,{d:`M19 12.859a10 10 0 0 0-2.007-1.523`,key:`4k23kn`}],[`path`,{d:`M2 8.82a15 15 0 0 1 4.177-2.643`,key:`1grhjp`}],[`path`,{d:`M22 8.82a15 15 0 0 0-11.288-3.764`,key:`z3jwby`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}]]),G=t(e(),1);function K(e){return e.filter(e=>e.state===`error`)}function tn(e){return e.reachable&&K(e.targets).length===0}function nn(e){return tn(e)?(e.unreachableInstances??[]).length>0?`gateways_unreachable`:`ok`:`error`}function rn(e){return e.state===`error`&&e.lastErrorCode!==null}function an(e){return!!e.lastDownstreamRejectCode}function on(e){return!!e.lastLocalRefusalCode}function sn(e){return rn(e)||an(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,r]=(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]),u=(0,G.useMemo)(()=>gn(s),[s]),f=(0,G.useMemo)(()=>_n(s),[s]),p=(0,G.useMemo)(()=>vn(s),[s]),m=(0,G.useMemo)(()=>hn(fn(s,n),a),[s,n,a]);function h(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:fe()}):(0,Q.jsxs)(`div`,{className:`oc-conn`,children:[(0,Q.jsxs)(Gt,{q:n.q,onQChange:e=>r(t=>({...t,q:e})),searchPlaceholder:i(),onReset:()=>r(un),canReset:dn(n),children:[(0,Q.jsxs)(R,{value:n.state,onValueChange:e=>r(t=>({...t,state:e})),children:[(0,Q.jsx)(z,{size:`sm`,className:`w-36`,children:(0,Q.jsx)(j,{placeholder:pe()})}),(0,Q.jsxs)(B,{children:[(0,Q.jsx)(N,{value:Y,children:C()}),u.map(e=>(0,Q.jsx)(N,{value:e,children:xn(e)},e))]})]}),(0,Q.jsxs)(R,{value:n.instance,onValueChange:e=>r(t=>({...t,instance:e})),children:[(0,Q.jsx)(z,{size:`sm`,className:`w-40`,children:(0,Q.jsx)(j,{placeholder:l()})}),(0,Q.jsxs)(B,{children:[(0,Q.jsx)(N,{value:Y,children:C()}),f.map(e=>(0,Q.jsx)(N,{value:e.name,children:e.label},e.name))]})]}),(0,Q.jsxs)(R,{value:n.version,onValueChange:e=>r(t=>({...t,version:e})),children:[(0,Q.jsx)(z,{size:`sm`,className:`w-36`,children:(0,Q.jsx)(j,{placeholder:d()})}),(0,Q.jsxs)(B,{children:[(0,Q.jsx)(N,{value:Y,children:C()}),p.map(e=>(0,Q.jsx)(N,{value:e,children:e},e))]})]})]}),m.length===0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:ye()}):(0,Q.jsxs)(Wt,{className:`oc-conn__table`,children:[(0,Q.jsx)(Ht,{children:(0,Q.jsxs)(H,{children:[(0,Q.jsx)($,{label:lt(),sortKey:`target`,sort:a,onSort:h}),(0,Q.jsx)($,{label:c(),sortKey:`state`,sort:a,onSort:h}),(0,Q.jsx)($,{label:ve(),sortKey:`instance`,sort:a,onSort:h}),(0,Q.jsx)($,{label:ut(),sortKey:`host`,sort:a,onSort:h}),(0,Q.jsx)($,{label:ze(),sortKey:`version`,sort:a,onSort:h}),(0,Q.jsx)(V,{children:dt()}),(0,Q.jsx)($,{label:ct(),sortKey:`lastOk`,sort:a,onSort:h})]})}),(0,Q.jsx)(Ut,{children:m.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)(V,{"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)(It,{size:13,"aria-hidden":!0}):(0,Q.jsx)(E,{size:13,"aria-hidden":!0}):(0,Q.jsx)(ht,{size:13,"aria-hidden":!0,className:`oc-conn__sort-idle`})]})})}function bn({r:e}){let t=rn(e)?W(e.lastErrorCode):null,n=an(e)?W(e.lastDownstreamRejectCode):null,r=on(e)?W(e.lastLocalRefusalCode):null;return(0,Q.jsxs)(G.Fragment,{children:[(0,Q.jsxs)(H,{className:`oc-conn__row oc-conn__row--${e.state}`,children:[(0,Q.jsx)(U,{children:(0,Q.jsx)(`code`,{className:`oc-traces__mono`,children:e.targetLabel})}),(0,Q.jsx)(U,{children:(0,Q.jsx)(Sn,{state:e.state})}),(0,Q.jsx)(U,{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)(U,{children:(0,Q.jsx)(`span`,{className:`oc-bridge-target__host`,children:e.gatewayHost})}),(0,Q.jsx)(U,{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)(U,{children:(0,Q.jsx)(`span`,{className:`oc-conn__stats`,children:ue({ok:e.okCount,errors:e.errorCount,attempts:e.attempts})})}),(0,Q.jsx)(U,{children:e.lastOkAt?(0,Q.jsx)(`span`,{className:`oc-traces__mono`,children:F(e.lastOkAt)}):(0,Q.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})})]}),sn(e)?(0,Q.jsx)(H,{className:`oc-conn__detail-row`,children:(0,Q.jsxs)(U,{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?` · ${F(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:[we({label:r.label}),` `,(0,Q.jsx)(`code`,{className:`oc-traces__mono`,children:e.lastLocalRefusalCode}),e.lastLocalRefusalAt?` · ${F(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:[Ye({label:n.label}),` `,(0,Q.jsx)(`code`,{className:`oc-traces__mono`,children:e.lastDownstreamRejectCode}),e.lastDownstreamRejectAt?` · ${F(e.lastDownstreamRejectAt)}`:``]}):null]})}):null]})}function xn(e){return e===`connected`?x():e===`error`?qe():S()}function Sn({state:e}){return e===`connected`?(0,Q.jsx)(A,{variant:`secondary`,children:x()}):e===`error`?(0,Q.jsx)(A,{variant:`destructive`,children:qe()}):(0,Q.jsx)(A,{variant:`outline`,children:S()})}function Cn(){return w(T.bridgeHealth.getBridgeHealth,{})}function wn(){let e=Cn(),t=w(T.compat.getBridgeCompat,{}),n=w(T.me.getMe,{host:Nt})?.role===`admin`,i=w(T.admin.listInstances,n?{}:`skip`),a=w(T.agents.usageForInstances,n?{}:`skip`),o=P(),s=()=>void o({to:`/settings/anomalies`,search:{status:`open`}}),c=ln(e?e.targets:[],t?t.targets:[],i??[]),{section:l}=Mt({from:`/settings/bridge`}),u=P({from:`/settings/bridge`}),d=t?.compat??null,f=t===void 0?`loading`:t===null?`nodata`:`ready`,p=d!==null&&Xt(d,`hermes`)&&!c.some(e=>e.key===`hermes`);return(0,Q.jsxs)(`div`,{className:`oc-bridge`,children:[(0,Q.jsx)(Tn,{health:e,compat:t,onSeeAnomalies:s}),(0,Q.jsx)(`p`,{className:`oc-admin__hint oc-bridge__caption`,children:r()}),a&&a.length>0?(0,Q.jsxs)(`section`,{className:`oc-bridge__usage`,children:[(0,Q.jsx)(`h3`,{className:`oc-bridge__usage-title`,children:he()}),(0,Q.jsxs)(Wt,{children:[(0,Q.jsx)(Ht,{children:(0,Q.jsxs)(H,{children:[(0,Q.jsx)(V,{children:Le()}),(0,Q.jsx)(V,{children:je()}),(0,Q.jsx)(V,{children:Fe()}),(0,Q.jsx)(V,{children:ae()}),(0,Q.jsx)(V,{children:nt()})]})}),(0,Q.jsx)(Ut,{children:a.flatMap(e=>{let t=wt(e.usage,Date.now());return t?t.windows.map((t,n)=>(0,Q.jsxs)(H,{children:[(0,Q.jsx)(U,{className:`font-medium`,children:n===0?e.instanceName:``}),(0,Q.jsx)(U,{children:t.provider}),(0,Q.jsx)(U,{children:t.label}),(0,Q.jsx)(U,{children:(0,Q.jsxs)(A,{variant:t.percentLeft<=10?`destructive`:t.percentLeft<=25?`outline`:`secondary`,children:[t.percentLeft,`%`]})}),(0,Q.jsx)(U,{className:`text-muted-foreground`,children:t.resetText??`—`})]},`${e.instanceName}:${t.provider}:${t.label}`)):[]})})]})]}):null,c.length>0?(0,Q.jsxs)(Pt,{value:c.some(e=>e.key===l)?l:c[0]?.key??`openclaw`,onValueChange:e=>void u({search:{section:e},replace:!0}),children:[(0,Q.jsx)(Lt,{className:`w-full`,children:c.map(e=>(0,Q.jsxs)(zt,{value:e.key,className:`flex-1 gap-1.5`,children:[(0,Q.jsx)(Dt,{size:13,"aria-hidden":!0}),J(e.key)]},e.key))}),c.map(e=>(0,Q.jsx)(At,{value:e.key,children:(0,Q.jsx)(En,{providerKey:e.key,connections:e.connections,instances:e.instances,manifest:d,compatStatus:f,compatReachable:t?.reachable??!0,protocol:e.key===`openclaw`?t?.protocol??null:null})},e.key))]}):null,p?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:de()}):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,o=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:re(),children:[`(`,i,`)`]})]}):null,r?(0,Q.jsxs)(`strong`,{className:`oc-bridge-card__mismatch`,children:[` `,tt({build:t.buildVersion??`?`})]}):null,` · `,se(),` `,(0,Q.jsx)(`code`,{className:`oc-traces__mono`,children:t.protocolVersion===null?h():String(t.protocolVersion)})]}):null;if(e===void 0)return(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:b()});if(e===null)return(0,Q.jsx)(`div`,{className:`oc-bridge-card oc-bridge-card--idle`,children:be()});let s=K(e.targets),c=!e.reachable,l=nn(e),u=e.unreachableInstances??[],d=l===`ok`?`ok`:l===`gateways_unreachable`?`warn`:`error`,p=bt(e.checkedAt),m=e.startedAt==null?null:bt(e.startedAt);return(0,Q.jsxs)(`div`,{className:`oc-bridge-card oc-bridge-card--${d}`,children:[(0,Q.jsx)(`div`,{className:`oc-bridge-card__icon`,"aria-hidden":!0,children:l===`ok`?(0,Q.jsx)(M,{size:22}):c||l===`gateways_unreachable`?(0,Q.jsx)(en,{size:22}):(0,Q.jsx)(I,{size:22})}),(0,Q.jsxs)(`div`,{className:`oc-bridge-card__body`,children:[(0,Q.jsx)(`div`,{className:`oc-bridge-card__title`,children:l===`ok`?g():l===`gateways_unreachable`?ge({count:u.length}):c?Ce():a({count:s.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}),` `,ft({time:p})]}),m?(0,Q.jsx)(`span`,{children:v({time:m})}):null,o]}),l===`gateways_unreachable`?(0,Q.jsx)(`p`,{className:`oc-bridge-card__hint`,children:le({names:u.join(`, `)})}):null,c?(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:f()})]})}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)(Dt,{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)(A,{variant:d===`beyond`||d===`defective`||d===`unsupported`?`destructive`:`secondary`,children:qt(d)}):null]}),(0,Q.jsx)(`h4`,{className:`oc-bridge-provider__sub`,children:Ae()}),(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)(E,{size:13,"aria-hidden":!0}):(0,Q.jsx)(L,{size:13,"aria-hidden":!0}),me({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??[],a=(e.driftOverflow??0)+(e.driftTruncated??0);return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`h4`,{className:`oc-bridge-provider__sub`,children:[Ie(),i.length>0?(0,Q.jsx)(A,{variant:`destructive`,children:Me({count:i.length})}):a>0?(0,Q.jsx)(A,{variant:`destructive`,children:y()}):(0,Q.jsx)(A,{variant:`secondary`,children:ke()})]}),(0,Q.jsxs)(`p`,{className:`oc-admin__hint`,children:[et({version:e.vendoredVersion}),r?` · `+oe({handled:r.handled,ignored:r.ignored,gaps:r.gaps}):null]}),a>0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:Ve({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)(E,{size:13,"aria-hidden":!0}):(0,Q.jsx)(L,{size:13,"aria-hidden":!0}),m({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:b()}):t===`nodata`?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:Ne()}):(0,Q.jsxs)(`div`,{className:`oc-compat`,children:[n?null:(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:De()}),r===null?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:xe()}):(0,Q.jsxs)(`div`,{className:`oc-compat__support`,children:[(0,Q.jsx)(`span`,{className:`oc-compat__label`,children:We({provider:a})}),e&&e.range!==null?(0,Q.jsx)(`span`,{children:_({min:e.range.min,max:e.range.maxValidated})}):(0,Q.jsx)(`span`,{children:h()}),e?(0,Q.jsx)(Mn,{versions:e.validatedVersions}):null]}),i.length===0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:_e()}):(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)(A,{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)(xt,{open:!0,onOpenChange:e=>!e&&t(),children:(0,Q.jsxs)(Bt,{className:`oc-bridge-config-dialog`,onOpenAutoFocus:e=>e.preventDefault(),children:[(0,Q.jsxs)(St,{children:[(0,Q.jsx)(Et,{children:Pe({instance:e.displayName??e.name})}),(0,Q.jsx)(Ot,{children:ie()})]}),(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)(M,{"aria-hidden":!0}):(0,Q.jsx)(I,{"aria-hidden":!0}),(0,Q.jsxs)(`span`,{children:[e,` — `,t.ok?rt():t.detail]})]}):(0,Q.jsxs)(`p`,{className:`oc-bridge-config__check-row oc-bridge-config__check-row--skip`,children:[e,` — `,Ze()]}):null}function jn({instance:e,onClose:t}){let n=Ge(T.admin.upsertInstanceConfig),r=ot(T.bridge.validateMediaPaths),i=kt(),a=Vt(e.config?.contentLocale,void 0),[o,c]=(0,G.useState)(()=>gt(e.config??{},a)),[l,u]=(0,G.useState)(!1),[d,f]=(0,G.useState)(!1),[m,h]=(0,G.useState)(null),g=o.inboundMediaMode===`shared-fs`,_=o.mediaMode===`shared-fs`,v=g||_;async function y(){f(!0),h(null);try{h(await r({instanceName:e.name,inboundMediaMode:o.inboundMediaMode,mediaMode:o.mediaMode}))}catch(e){i.error(it(),e)}finally{f(!1)}}async function re(){u(!0);try{let r=e.config??{};await n({instanceId:e._id,config:vt(o,r,a)}),t()}catch(e){i.error(Ee(),e)}finally{u(!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)(D,{label:ce(),help:s()}),(0,Q.jsxs)(R,{value:o.mediaMode,onValueChange:e=>c({...o,mediaMode:e}),children:[(0,Q.jsx)(z,{size:`sm`,className:`w-full`,children:(0,Q.jsx)(j,{})}),(0,Q.jsx)(B,{children:yt.map(e=>(0,Q.jsx)(N,{value:e,children:e},e))})]})]}),(0,Q.jsxs)(`label`,{className:`oc-field`,children:[(0,Q.jsx)(D,{label:ee(),help:mt()}),(0,Q.jsxs)(R,{value:o.inboundMediaMode,onValueChange:e=>c({...o,inboundMediaMode:e}),children:[(0,Q.jsx)(z,{size:`sm`,className:`w-full`,children:(0,Q.jsx)(j,{})}),(0,Q.jsx)(B,{children:_t.map(e=>(0,Q.jsx)(N,{value:e,children:e},e))})]})]}),(0,Q.jsxs)(`label`,{className:`oc-field`,children:[(0,Q.jsx)(D,{label:Oe(),help:ne()}),(0,Q.jsx)(k,{type:`number`,min:1,max:4096,className:`w-full`,value:o.mediaMaxMb,onChange:e=>c({...o,mediaMaxMb:Math.trunc(Number(e.target.value)||0)})})]})]}),v&&(0,Q.jsxs)(`div`,{className:`oc-bridge-config__grid`,children:[g&&(0,Q.jsxs)(`label`,{className:`oc-field`,children:[(0,Q.jsx)(D,{label:$e(),help:Ke()}),(0,Q.jsx)(k,{className:`w-full`,spellCheck:!1,value:o.inboundAgentMount,onChange:e=>c({...o,inboundAgentMount:e.target.value})})]}),_&&(0,Q.jsxs)(`label`,{className:`oc-field`,children:[(0,Q.jsx)(D,{label:He(),help:st()}),(0,Q.jsx)(k,{className:`w-full`,spellCheck:!1,value:o.outboundAgentMount,onChange:e=>c({...o,outboundAgentMount:e.target.value})})]})]}),(0,Q.jsxs)(`label`,{className:`oc-field--row`,children:[(0,Q.jsx)(Tt,{checked:o.rehydration,onCheckedChange:e=>c({...o,rehydration:e===!0})}),(0,Q.jsx)(D,{label:Se(),help:p()})]}),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)(I,{"aria-hidden":!0}),Ue({reason:m.reason??`?`})]}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(An,{label:Re(),result:m.inbound}),(0,Q.jsx)(An,{label:Je(),result:m.outbound}),(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:Qe()})]}):(0,Q.jsxs)(`p`,{className:`oc-bridge-config__check-row oc-bridge-config__check-row--err`,children:[(0,Q.jsx)(I,{"aria-hidden":!0}),at()]})}),(0,Q.jsxs)(`div`,{className:`oc-bridge-config__actions`,children:[v&&(0,Q.jsxs)(O,{variant:`outline`,size:`sm`,onClick:()=>void y(),disabled:d,children:[d?(0,Q.jsx)(Ct,{className:`size-4 animate-spin`,"aria-hidden":!0}):null,d?Be():Xe()]}),(0,Q.jsx)(O,{size:`sm`,onClick:()=>void re(),disabled:l,children:te()})]})]})})}function Mn({versions:e}){if(e.length===0)return null;let t=[...e].reverse();return(0,Q.jsxs)(Ft,{children:[(0,Q.jsx)(jt,{asChild:!0,children:(0,Q.jsxs)(`button`,{type:`button`,className:`oc-compat__versions-btn`,children:[e.length===1?Te():o({count:e.length}),(0,Q.jsx)(E,{size:13,"aria-hidden":!0})]})}),(0,Q.jsxs)(Rt,{className:`oc-compat__versions-pop`,align:`start`,children:[(0,Q.jsx)(`p`,{className:`oc-compat__versions-title`,children:pt()}),(0,Q.jsx)(`div`,{className:`oc-compat__versions-list`,children:t.map(e=>(0,Q.jsx)(A,{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{$g as r,$l as i,Ct as a,F_ as o,Qg as s,St as c,Sv as l,Tt as u,Zg as d,_p as f,_t as p,a_ as m,at as h,bt as g,bv as _,ct as v,dp as y,dt as b,e_ as x,et as ee,fX as S,fp as C,ft as te,gp as w,gt as ne,gv as re,hp as ie,ht as T,hv as ae,i_ as E,it as D,lt as oe,mp as O,mt as k,n_ as A,nt as se,ot as ce,pX as j,pp as le,pt as ue,qk as de,rX as M,r_ as N,rt as fe,st as pe,t as P,t_ as me,tt as he,uX as F,up as ge,ut as _e,vp as I,vt as ve,wt as ye,xt as be,yp as xe,yt as Se}from"./api-BEXV-QDx.js";import{t as Ce}from"./use_paginated_query-CWrNoLih.js";import{t as L}from"./button-BI4NYd7l.js";import{$t as R,Mt as z,St as B,bt as V,kn as we,nt as Te,rt as Ee,tt as H,vt as U,xt as W,yt as G}from"./index-CND0zLpO.js";import{a as De}from"./compatView-C6vyLpqy.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 c();case`hybrid`:return be();case`tool`:return g();default:return Se()}}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`?k():Me(e)?D():null:T(),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:p()}}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`?k():e.code===`stale_default`?ue():e.code===`write_unknown`||e.code===`not_confirmed`?_e():e.code===`not_applied`?oe():e.code===`default_too_large`?se():e.code===`allowlist_too_large`?fe():e.code===`plugin_too_old`?D():e.code===`source_not_allowed`?h():e.code===`plugin_config_lag`?ce():e.code===`knowledge_unavailable`&&e.reason===`plugin_absent`?ne():te({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 i=F(P.knowledge.setAgentKnowledgeDefault),[o,c]=(0,K.useState)(t),[u,d]=(0,K.useState)(()=>X(t)),[f,p]=(0,K.useState)(`idle`),[m,h]=(0,K.useState)(null),[g,_]=(0,K.useState)(!1),v=e=>{c(e),d(X(e)),h(null)},y=Pe(o,t);(0,K.useEffect)(()=>{g&&y&&(_(!1),v(t))},[g,y]);let x=je(o,u,n),S=x.readOnlyReason===null;async function C(){p(`saving`),h(null);try{let n=Q(await i({instanceName:e,agentId:t.agentId,injection:u.injection,sources:u.sources,expected:J(o)}));h(n),p(n===null?`done`:`idle`),n===null&&_(!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:u.injection,onValueChange:e=>{Y(e)&&d({...u,injection:e})},disabled:!S,children:[(0,$.jsx)(W,{className:`oc-cdefaults__select`,"aria-label":a(),children:(0,$.jsx)(B,{})}),(0,$.jsx)(G,{children:q.map(e=>(0,$.jsx)(V,{value:e,children:Ae(e)},e))})]})}),(0,$.jsx)(`span`,{className:`oc-cdefaults__label`,children:ve()}),t.sources.map(e=>(0,$.jsxs)(`label`,{className:`oc-cdefaults__inline`,style:{cursor:S?`pointer`:`default`},title:e.description||void 0,children:[(0,$.jsx)(z,{checked:u.sources.includes(e.id),onCheckedChange:()=>d(Ne(t,u,e.id)),disabled:!S,"aria-label":e.label,"data-knowledge-default-source":e.id}),(0,$.jsx)(`span`,{children:e.label})]},e.id)),y&&!g?(0,$.jsxs)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:[he(),` `,(0,$.jsx)(L,{variant:`outline`,size:`sm`,onClick:()=>v(t),children:ee()})]}):null,t.overridesAllowed?null:(0,$.jsx)(`p`,{className:`oc-cdefaults__help`,children:b()}),S?(0,$.jsx)(`div`,{className:`oc-cdefaults__inline`,children:(0,$.jsx)(L,{size:`sm`,disabled:!x.dirty||!x.valid||f===`saving`,onClick:()=>void C(),children:f===`saving`?l():r()})}):(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:s()}):null,m===null?null:(0,$.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:m})]})]})}function Ie({instanceName:e}){let t=j(P.knowledge.knowledgeAdminInstance,{instanceName:e}),{results:n,status:r,loadMore:i}=Ce(P.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":u(),children:[(0,$.jsx)(`span`,{className:`oc-cdefaults__label`,children:u()}),(0,$.jsx)(`p`,{className:`oc-admin__hint`,children:ye()}),t.supported?null:(0,$.jsx)(`p`,{className:`oc-cdefaults__note`,children:T()}),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:v({shown:n.length})}),(0,$.jsx)(L,{variant:`outline`,size:`sm`,disabled:r===`LoadingMore`,onClick:()=>i(50),"data-knowledge-load-more":!0,children:pe()})]}):null]})}function Le({instance:e}){let t=S(P.admin.upsertInstanceConfig),n=j(P.agents.listAgentsForInstance,{instanceName:e.name}),i=typeof e.config?.converterAgentId==`string`?e.config.converterAgentId:``,[a,o]=(0,K.useState)(i),[c,u]=(0,K.useState)(`idle`);(0,K.useEffect)(()=>{o(i),u(`idle`)},[e._id,i]);let f=`__none__`,p=a!==i;async function m(){u(`saving`);try{let n={...e.config??{}};a===``||a===f?delete n.converterAgentId:n.converterAgentId=a,await t({instanceId:e._id,config:n}),u(`done`)}catch{u(`error`)}}let h=n?.agents??[];return(0,$.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,$.jsx)(`span`,{className:`oc-cdefaults__label`,children:w()}),(0,$.jsx)(`p`,{className:`oc-admin__hint`,children:ie()}),(0,$.jsxs)(`div`,{className:`oc-cdefaults__inline`,children:[(0,$.jsxs)(U,{value:a===``?f:a,onValueChange:e=>o(e===f?``:e),children:[(0,$.jsx)(W,{className:`oc-cdefaults__select`,"aria-label":w(),children:(0,$.jsx)(B,{placeholder:O()})}),(0,$.jsxs)(G,{children:[(0,$.jsx)(V,{value:f,children:O()}),h.map(e=>(0,$.jsx)(V,{value:e.agentId,children:e.displayName?`${e.displayName} (${e.agentId})`:e.agentId},e.agentId))]})]}),(0,$.jsx)(L,{size:`sm`,disabled:!p||c===`saving`,onClick:()=>void m(),children:c===`saving`?l():r()})]}),c===`done`?(0,$.jsx)(`p`,{className:`oc-admin__hint`,role:`status`,children:s()}):null,c===`error`?(0,$.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:d()}):null]})}function Re({instance:e}){let t=S(P.admin.upsertInstanceConfig),n=e.config?.curationEnabled===!0,i=typeof e.config?.curationBudgetChars==`number`?e.config.curationBudgetChars:null,[a,o]=(0,K.useState)(n),[c,u]=(0,K.useState)(i===null?``:String(i)),[p,m]=(0,K.useState)(`idle`);(0,K.useEffect)(()=>{o(n),u(i===null?``:String(i)),m(`idle`)},[e._id,n,i]);let h=c.trim(),g=h===``?null:/^\d+$/.test(h)?Number.parseInt(h,10):NaN,_=!a||g===null||Number.isInteger(g)&&g>=4e3&&g<=6e4,v=a!==n||(g??null)!==i;async function b(){m(`saving`);try{let n={...e.config??{}};n.curationEnabled=a,!a||g===null||Number.isNaN(g)?delete n.curationBudgetChars:n.curationBudgetChars=g,await t({instanceId:e._id,config:n}),m(`done`)}catch{m(`error`)}}return(0,$.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,$.jsxs)(`label`,{className:`oc-cdefaults__inline`,style:{cursor:`pointer`},children:[(0,$.jsx)(z,{checked:a,onCheckedChange:e=>o(e===!0),"aria-label":f()}),(0,$.jsx)(`span`,{className:`oc-cdefaults__label`,children:f()})]}),(0,$.jsxs)(`div`,{className:`oc-cdefaults__inline`,children:[(0,$.jsx)(R,{type:`number`,min:4e3,max:6e4,step:1e3,placeholder:`20000`,value:c,onChange:e=>u(e.target.value),className:`oc-cdefaults__number`,"aria-invalid":!_,"aria-label":le(),disabled:!a}),(0,$.jsx)(L,{size:`sm`,disabled:!v||!_||p===`saving`,onClick:()=>void b(),children:p===`saving`?l():r()})]}),_?null:(0,$.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:C()}),p===`done`?(0,$.jsx)(`p`,{className:`oc-admin__hint`,role:`status`,children:s()}):null,p===`error`?(0,$.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:d()}):null,(0,$.jsx)(`p`,{className:`oc-cdefaults__help`,children:y()})]})}function ze({instance:e}){let t=S(P.admin.upsertInstanceConfig),n=typeof e.config?.summarizeThresholdChars==`number`?e.config.summarizeThresholdChars:null,[i,a]=(0,K.useState)(n===null?``:String(n)),[o,c]=(0,K.useState)(`idle`);(0,K.useEffect)(()=>{a(n===null?``:String(n)),c(`idle`)},[e._id,n]);let u=i.trim(),f=u===``?null:/^\d+$/.test(u)?Number.parseInt(u,10):NaN,p=f===null||Number.isInteger(f)&&f>=1e3&&f<=2e5,m=(f??null)!==n;async function h(){c(`saving`);try{let n={...e.config??{}};f===null?delete n.summarizeThresholdChars:n.summarizeThresholdChars=f,await t({instanceId:e._id,config:n}),c(`done`)}catch{c(`error`)}}return(0,$.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,$.jsx)(`span`,{className:`oc-cdefaults__label`,children:xe()}),(0,$.jsxs)(`div`,{className:`oc-cdefaults__inline`,children:[(0,$.jsx)(R,{type:`number`,min:1e3,max:2e5,step:1e3,placeholder:`8000`,value:i,onChange:e=>a(e.target.value),className:`oc-cdefaults__number`,"aria-invalid":!p}),(0,$.jsx)(L,{size:`sm`,disabled:!m||!p||o===`saving`,onClick:()=>void h(),children:o===`saving`?l():r()})]}),p?null:(0,$.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:ge()}),o===`done`?(0,$.jsx)(`p`,{className:`oc-admin__hint`,role:`status`,children:s()}):null,o===`error`?(0,$.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:d()}):null,(0,$.jsx)(`p`,{className:`oc-cdefaults__help`,children:I()})]})}function Be(){let e=F(P.agentFiles.getChatDefaults),[t,n]=(0,K.useState)({status:`loading`}),r=j(P.admin.listInstances,{}),[a,s]=(0,K.useState)(null);(0,K.useEffect)(()=>{!r||r.length===0||(!a||!r.some(e=>e.name===a))&&s(r[0].name)},[r,a]);let c=(r?.length??0)>1,l=r!==void 0&&r.length===0,u=j(P.compat.forInstance,a?{instanceName:a}:`skip`),d=a?Te(u,`configDefaults`):`loading`,f=d===`loading`?null:d.blocked,p=(0,K.useMemo)(()=>c&&a?{instanceName:a}:{},[c,a]),h=(0,K.useRef)(0),g=(0,K.useCallback)(async()=>{let t=++h.current;n({status:`loading`});try{let r=ke(await e(p));if(h.current!==t)return;n({status:`done`,current:r})}catch{if(h.current!==t)return;n({status:`error`})}},[e,p]);(0,K.useEffect)(()=>{f===!1&&(c&&!a||g())},[g,f,c,a]);let v=t.status===`done`?t.current:null,y=(0,K.useMemo)(()=>Oe.map(e=>({id:e,label:Ee(e)})),[]),b=(0,K.useMemo)(()=>[{id:`fast`,label:re()},{id:`standard`,label:ae()}],[]);return(0,$.jsxs)(`div`,{className:`oc-cdefaults`,children:[(0,$.jsx)(`p`,{className:`oc-admin__hint`,children:m()}),c&&a?(0,$.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,$.jsx)(`span`,{className:`oc-cdefaults__label`,children:o()}),(0,$.jsxs)(U,{value:a,onValueChange:e=>s(e),children:[(0,$.jsx)(W,{size:`sm`,"aria-label":o(),children:(0,$.jsx)(B,{})}),(0,$.jsx)(G,{children:(r??[]).map(e=>(0,$.jsx)(V,{value:e.name,children:e.name},e.name))})]})]}):null,l?(0,$.jsx)(`p`,{className:`oc-admin__hint`,role:`status`,children:de()}):d===`loading`?(0,$.jsx)(`p`,{className:`oc-admin__hint`,children:M()}):d.blocked?(0,$.jsxs)(`p`,{className:`oc-compat__blocked`,role:`status`,children:[(0,$.jsx)(we,{size:14,"aria-hidden":!0}),` `,De(d.gatewayVersion,d.provider)]}):t.status===`loading`?(0,$.jsx)(`p`,{className:`oc-admin__hint`,children:M()}):t.status===`error`?(0,$.jsxs)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:[x(),` `,(0,$.jsx)(L,{variant:`outline`,size:`sm`,onClick:()=>void g(),children:_()})]}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,$.jsx)(`span`,{className:`oc-cdefaults__label`,children:E()}),(0,$.jsx)(H,{field:`thinkingLevel`,options:y,value:v?.thinkingDefault??null,onChange:()=>{},disabled:!0,ariaLabel:E()}),(0,$.jsx)(`p`,{className:`oc-cdefaults__help`,children:N()})]}),(0,$.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,$.jsx)(`span`,{className:`oc-cdefaults__label`,children:A()}),(0,$.jsx)(H,{field:`fastMode`,options:b,value:v===null||v.fastModeDefault===null?null:v.fastModeDefault?`fast`:`standard`,onChange:()=>{},disabled:!0,ariaLabel:A()}),(0,$.jsx)(`p`,{className:`oc-cdefaults__help`,children:me()})]}),(0,$.jsx)(`p`,{className:`oc-cdefaults__note`,children:i()})]}),(()=>{let e=r?.find(e=>e.name===(a??r[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{GS as r,HS as i,JS as a,KS as o,US as s,WS as c,qS as l}from"./api-
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{GS as r,HS as i,JS as a,KS as o,US as s,WS as c,qS as l}from"./api-BEXV-QDx.js";import{r as u}from"./dist-ibS6mHJS.js";import{t as d}from"./chevrons-up-down-BBnIDUVh.js";import{t as f}from"./button-BI4NYd7l.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-CND0zLpO.js";import{a as C,i as w,n as T,o as E,r as D,t as O}from"./table-CvUcBPgp.js";var k=t(e(),1);function A(e,t){return typeof e==`number`&&typeof t==`number`?e-t:typeof e==`boolean`&&typeof t==`boolean`?!!e-+!!t:String(e).localeCompare(String(t),void 0,{numeric:!0,sensitivity:`base`})}function j(e,t,n){return[...e].sort((e,r)=>{let i=t(e),a=t(r),o=i==null,s=a==null;if(o||s)return o&&s?0:o?1:-1;let c=A(i,a);return n===`asc`?c:-c})}var M=n();function N({title:e,rows:t,columns:n,rowActions:A,onAdd:N,addLabel:P=a(),bulkActions:F,emptyHint:I=l(),isExpanded:L,renderExpanded:R}){let[z,B]=(0,k.useState)(new Set),[V,H]=(0,k.useState)(null),U=t??[],W=V?n[V.index]:void 0,G=V&&W?.sort?j(U,W.sort,V.dir):U;function K(e){H(t=>!t||t.index!==e?{index:e,dir:`asc`}:t.dir===`asc`?{index:e,dir:`desc`}:null)}let q=+!!F+n.length+ +!!A,J=U.length>0&&z.size===U.length,Y=z.size>0&&!J;function X(){B(J?new Set:new Set(U.map(e=>e._id)))}function Z(e){B(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})}return(0,M.jsxs)(`div`,{className:`oc-dt`,children:[(0,M.jsxs)(`div`,{className:`oc-dt__bar`,children:[(0,M.jsx)(`h2`,{className:`oc-dt__title`,children:e}),(0,M.jsxs)(`div`,{className:`oc-dt__bar-actions`,children:[z.size>0&&F?F.map(e=>(0,M.jsxs)(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:o()}):U.length===0?(0,M.jsx)(`p`,{className:`oc-admin__hint`,children:I}):(0,M.jsxs)(O,{children:[(0,M.jsx)(C,{children:(0,M.jsxs)(E,{children:[F?(0,M.jsx)(w,{className:`w-8`,children:(0,M.jsx)(h,{"aria-label":r(),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":i({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":c(),checked:z.has(e._id),onCheckedChange:()=>Z(e._id)})}):null,n.map(t=>(0,M.jsx)(D,{className:t.className,children:t.cell(e)},t.header)),A?(0,M.jsx)(D,{children:t.length>0?(0,M.jsxs)(_,{children:[(0,M.jsx)(g,{asChild:!0,children:(0,M.jsx)(f,{variant:`ghost`,size:`icon-sm`,"aria-label":s(),className:`opacity-0 transition-opacity group-hover/row:opacity-100 group-focus-within/row:opacity-100 aria-expanded:opacity-100`,children:(0,M.jsx)(S,{})})}),(0,M.jsx)(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{BA as t,aE as n,fX as r,iE as i,mE as a,oE as o,pE as s,t as c}from"./api-BEXV-QDx.js";import{t as l}from"./use_paginated_query-CWrNoLih.js";import{t as u}from"./button-BI4NYd7l.js";import{ct as d,h as f}from"./index-CND0zLpO.js";import{n as p,t as m}from"./trashPage-CtRjTgEJ.js";var h=e();function g(){let{results:e,status:g,loadMore:_}=l(c.trash.listMyTrash,{},{initialNumItems:50}),v=f(),y=r(c.trash.restoreChat),b=r(c.trash.purgeChat),x=r(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:a({days:v})}),e.length>0?(0,h.jsx)(u,{variant:`destructive`,size:`sm`,onClick:async()=>{await S({title:n(),description:i(),confirmLabel:o(),destructive:!0})&&await x({})},children:o()}):null]}),g===`LoadingFirstPage`?(0,h.jsx)(`p`,{className:`oc-trash__hint`,children:t()}):e.length===0?(0,h.jsx)(`p`,{className:`oc-trash__empty`,children:s()}):(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-CND0zLpO.js";var n=e();function r({icon:e,total:r,items:i}){if(r===0)return(0,n.jsxs)(t,{variant:`outline`,className:`oc-group-chip oc-group-chip--empty gap-1`,children:[e,`0`]});let a=r-i.length;return(0,n.jsxs)(`div`,{className:`oc-group-detail`,children:[i.map((e,r)=>(0,n.jsxs)(t,{variant:e.highlight?`secondary`:`outline`,className:`oc-group-chip gap-1`,title:e.label,children:[e.marker,(0,n.jsx)(`span`,{className:`oc-group-chip__txt`,children:e.label})]},r)),a>0?(0,n.jsxs)(t,{variant:`outline`,className:`oc-group-chip`,children:[`+`,a]}):null]})}export{r as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$I as r,AI as i,BI as a,CI as o,CL as s,Cf as c,DI as l,EI as u,FI as d,GI as f,HI as p,II as m,JI as ee,KI as te,LI as ne,MI as h,NI as g,OI as _,PI as re,QI as v,RI as ie,SL as y,TI as ae,TL as b,UI as x,VI as S,WI as C,XI as w,YI as T,ZI as E,_L as D,aL as O,bL as k,cL as A,dL as j,eL as M,fL as N,fX as P,gL as F,hL as I,iL as L,jI as R,kI as z,lL as B,mL as V,nL as H,oL as U,pL as W,pX as oe,qI as G,rL as K,sL as q,t as J,tL as se,uL as ce,vL as le,wI as ue,wL as de,xL as fe,xf as pe,yL as me,zI as he}from"./api-BEXV-QDx.js";import{t as ge}from"./button-BI4NYd7l.js";import{At as _e,ct as Y}from"./index-CND0zLpO.js";import{t as ve}from"./DataTableShell-Dekyfrzb.js";var X=t(e(),1),Z=n(),ye={altered_words:()=>b(),incorrect:()=>de(),incoherence:()=>s(),formatting:()=>y(),latency:()=>fe(),api_error:()=>k(),other:()=>me()},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:F()}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill`,children:`—`}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill`,children:le()})}function be({data:e,reference:t,closeReason:n}){let i=e.snapshot,a=P(J.feedback.respondToFeedback),[o,s]=(0,X.useState)(e.thread),[l,u]=(0,X.useState)(``),[d,f]=(0,X.useState)(!1);async function p(){let t=l.trim();if(!(!t||d)){f(!0);try{await a({feedbackId:e._id,text:t}),s(e=>[...e,{authorRole:`admin`,text:t,at:Date.now()}]),u(``)}finally{f(!1)}}}let m=[];try{m=i.contextJson?JSON.parse(i.contextJson):[]}catch{m=[]}return(0,Z.jsxs)(`div`,{className:`oc-fbadmin__detail`,children:[(0,Z.jsxs)(`div`,{className:`oc-fbadmin__row`,children:[(0,Z.jsx)($,{matches:i.displayedMatchesStored,sourceWasOpen:i.clientInfo?.sourceWasOpen??!1}),(0,Z.jsxs)(`span`,{className:`oc-fbadmin__meta`,children:[Q(e.category),` · `,i.messageRole,i.isRegeneration?` · ${I()}`:``,i.openclawModel?` · ${i.openclawModel}`:``,i.openclawRuntime?` (${i.openclawRuntime})`:``]}),t?(0,Z.jsx)(`code`,{className:`oc-fbadmin__ref`,style:{userSelect:`all`,marginLeft:`auto`},title:x(),children:t}):null]}),e.comment?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:V()}),(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:z()}),(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:W()}),o.length>0?(0,Z.jsx)(`div`,{className:`oc-fbadmin__thread`,children:o.map((e,t)=>(0,Z.jsxs)(`div`,{className:`oc-notif__msg oc-notif__msg--${e.authorRole}`,children:[(0,Z.jsx)(`span`,{className:`oc-notif__msg-who`,children:e.authorRole===`admin`?N():e.authorRole===`agent`?e.authorLabel??c():j()}),(0,Z.jsx)(`span`,{className:`oc-notif__msg-text`,children:e.text})]},t))}):(0,Z.jsx)(`p`,{className:`oc-fbadmin__meta`,children:ce()}),(0,Z.jsx)(`textarea`,{className:`oc-feedback__textarea`,placeholder:B(),value:l,maxLength:2e3,rows:3,onChange:e=>u(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 p(),disabled:!l.trim()||d,children:d?A():q()})})]}),(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:U()}),(0,Z.jsx)(`pre`,{className:`oc-msg__source-pre`,children:i.messageText||O()})]}),i.clientInfo?.sourceWasOpen&&i.displayedText!==void 0?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:L()}),(0,Z.jsx)(`pre`,{className:`oc-msg__source-pre`,children:i.displayedText||O()})]}):null,i.promptText?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:K()}),(0,Z.jsx)(`pre`,{className:`oc-msg__source-pre`,children:i.promptText})]}):null,m.length>0?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:H({count:i.contextCount??m.length,truncated:i.contextTruncated?se():``})}),(0,Z.jsx)(`div`,{className:`oc-fbadmin__ctx`,children:m.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,i.outboxAvailable?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:M()}),(0,Z.jsxs)(`pre`,{className:`oc-msg__source-pre`,children:[i.outboxText??``,i.outboxStatus?`\n[status: ${i.outboxStatus}]`:``]})]}):null,i.clientInfo?.extensionsDetected&&i.clientInfo.extensionsDetected.length>0?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:r()}),(0,Z.jsx)(`div`,{className:`oc-fbadmin__row`,children:i.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:v()}),(0,Z.jsxs)(`p`,{className:`oc-fbadmin__env`,children:[[i.clientInfo?.language,i.clientInfo?.timezone,i.clientInfo?.theme?E({theme:i.clientInfo.theme}):null,i.runId?`run ${i.runId.slice(0,12)}…`:null].filter(Boolean).join(` · `)||`—`,i.clientInfo?.plugins&&i.clientInfo.plugins.length>0?(0,Z.jsxs)(`span`,{className:`oc-fbadmin__plugins`,children:[w(),` `,i.clientInfo.plugins.join(`, `),(0,Z.jsxs)(`span`,{className:`oc-fbadmin__note`,children:[` `,T()]})]}):null,i.clientInfo?.userAgent?(0,Z.jsx)(`span`,{className:`oc-fbadmin__ua`,children:i.clientInfo.userAgent}):null]})]})]})}function xe(){let e=oe(J.feedback.listForAdmin,{}),t=P(J.feedback.readSnapshot),n=P(J.feedback.deleteFeedback),r=Y(),[s,c]=(0,X.useState)(null),[v,y]=(0,X.useState)({});async function b(e){if(s===e._id){c(null);return}if(!v[e._id]){let n=await t({feedbackId:e._id});y(t=>({...t,[e._id]:n}))}c(e._id)}async function x(e){await r({title:ae(),description:ue(),confirmLabel:o(),destructive:!0})&&(await n({feedbackId:e._id}),s===e._id&&c(null))}return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`p`,{className:`oc-admin__hint`,children:[ee(),` `,(0,Z.jsx)(`strong`,{children:G()}),` `,te()]}),(0,Z.jsx)(ve,{title:f(),rows:e,emptyHint:C(),isExpanded:e=>s===e._id&&!!v[e._id],renderExpanded:e=>v[e._id]?(0,Z.jsx)(be,{data:v[e._id],reference:e.reference,closeReason:e.userCloseReason}):null,columns:[{header:p(),cell:e=>_e(e.at),sort:e=>e.at},{header:S(),cell:e=>Q(e.category),sort:e=>Q(e.category)},{header:a(),cell:e=>e.messageRole===`user`?he():ie(),sort:e=>e.messageRole},{header:ne(),cell:e=>(e.reporterEmail||e.reporterName||`—`)+(e.impersonated&&e.realOperatorEmail?` ${m({operator:e.realOperatorEmail})}`:``),sort:e=>e.reporterEmail||e.reporterName||null},{header:d(),cell:e=>(0,Z.jsx)($,{matches:e.displayedMatchesStored,sourceWasOpen:e.sourceWasOpen}),sort:e=>e.displayedMatchesStored===!1?0:e.displayedMatchesStored===!0?1:2},{header:re(),cell:e=>e.hasComment?`✎`:`—`,sort:e=>+!!e.hasComment},{header:g(),cell:e=>e.userClosedAt==null?e.resolvedAt==null?e.answered?(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-ok`,children:h()}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill`,children:R()}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-ok`,title:e.resolvedBy??void 0,children:pe()}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-closed`,children:i()}),sort:e=>e.userClosedAt==null?e.resolvedAt==null?+!!e.answered:2:3}],rowActions:e=>[{label:s===e._id?_():l(),onSelect:()=>void b(e)},{label:u(),onSelect:()=>void x(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,bX as n}from"./api-BEXV-QDx.js";import{B as r,R as i,V as a,mn as o,pn as s,z as c}from"./index-CND0zLpO.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{$J as ee,CY as r,Df as i,Ef as te,GJ as ne,JJ as re,KJ as ie,QJ as ae,SY as oe,UJ as a,WJ as o,XJ as s,YJ as c,ZJ as l,_Y as u,aX as se,aY as ce,bY as d,cY as f,dY as p,eY as le,fX as ue,fY as m,gY as de,hY as fe,iY as pe,lY as h,mV as me,mY as he,nY as ge,oY as _e,pX as ve,pY as g,qJ as ye,rX as be,rY as xe,sY as _,t as v,tY as y,uY as b,vY as x,wY as S,xY as C,yY as w}from"./api-BEXV-QDx.js";import{t as T}from"./button-BI4NYd7l.js";import{An as E,Bt as D,Gt as O,Ht as k,In as A,Jt as j,Kt as M,Mt as Se,St as N,Ut as Ce,Vt as we,Wt as Te,Yt as Ee,an as De,bt as P,en as Oe,nn as F,nr as I,qt as ke,tn as Ae,tr as je,vt as L,xt as R,yt as z}from"./index-CND0zLpO.js";import{a as Me,i as B,n as Ne,o as V,r as H,t as Pe}from"./table-CvUcBPgp.js";var U=t(e(),1),W=n(),G=`all`;function K(e){switch(e){case`image`:return g();case`audio`:return m();case`video`:return p();case`pdf`:return b();case`document`:return h();case`archive`:return f();default:return _()}}function q(){let[e,t]=(0,U.useState)(G),[n,f]=(0,U.useState)(G),[p,m]=(0,U.useState)(G),[h,g]=(0,U.useState)(G),[_,b]=(0,U.useState)(!1),[q,J]=(0,U.useState)(null),Fe=ue(v.files.softDelete),Y=Ee();function Ie(){t(G),f(G),m(G),g(G)}async function Le(){let e=q;if(J(null),e)try{await Fe({fileId:e.id}),Y.success(s())}catch(e){Y.error(c(),e)}}let X=ve(v.files.listMine,{direction:e===G?void 0:e,chatId:n===G?void 0:n,instanceName:p===G?void 0:p,category:h===G?void 0:h,includeAutoGenerated:_||void 0}),Re=(0,U.useMemo)(()=>new Intl.DateTimeFormat(se(),{dateStyle:`medium`,timeStyle:`short`}),[]);if(X===void 0)return(0,W.jsx)(`p`,{className:`oc-admin__hint`,children:be()});let{files:Z,facets:Q,truncated:ze,cap:Be}=X,$=e!==G||n!==G||p!==G||h!==G;return(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`p`,{className:`oc-admin__hint`,children:S()}),(0,W.jsxs)(`div`,{className:`oc-files__filters`,style:{display:`flex`,flexWrap:`wrap`,gap:8,margin:`12px 0`},children:[(0,W.jsxs)(L,{value:e,onValueChange:t,children:[(0,W.jsx)(R,{size:`sm`,"aria-label":r(),children:(0,W.jsx)(N,{})}),(0,W.jsxs)(z,{children:[(0,W.jsx)(P,{value:G,children:oe()}),(0,W.jsx)(P,{value:`inbound`,children:C()}),(0,W.jsx)(P,{value:`outbound`,children:d()})]})]}),(0,W.jsxs)(L,{value:n,onValueChange:f,children:[(0,W.jsx)(R,{size:`sm`,"aria-label":w(),children:(0,W.jsx)(N,{})}),(0,W.jsxs)(z,{children:[(0,W.jsx)(P,{value:G,children:x()}),Q.chats.map(e=>(0,W.jsx)(P,{value:e.id,children:e.title},e.id))]})]}),Q.multiProvider?(0,W.jsxs)(L,{value:p,onValueChange:m,children:[(0,W.jsx)(R,{size:`sm`,"aria-label":u(),children:(0,W.jsx)(N,{})}),(0,W.jsxs)(z,{children:[(0,W.jsx)(P,{value:G,children:de()}),Q.instances.map(e=>(0,W.jsx)(P,{value:e,children:e},e))]})]}):null,(0,W.jsxs)(L,{value:h,onValueChange:g,children:[(0,W.jsx)(R,{size:`sm`,"aria-label":fe(),children:(0,W.jsx)(N,{})}),(0,W.jsxs)(z,{children:[(0,W.jsx)(P,{value:G,children:he()}),Q.categories.map(e=>(0,W.jsx)(P,{value:e,children:K(e)},e))]})]}),(0,W.jsxs)(`label`,{className:`oc-files__autogen`,children:[(0,W.jsx)(Se,{checked:_,onCheckedChange:e=>b(e===!0),"aria-label":i()}),(0,W.jsx)(`span`,{children:i()})]}),$?(0,W.jsxs)(T,{variant:`ghost`,size:`sm`,onClick:Ie,style:{display:`inline-flex`,alignItems:`center`,gap:4,marginLeft:`auto`},children:[(0,W.jsx)(A,{size:14,"aria-hidden":!0}),ee()]}):null]}),Z.length===0?(0,W.jsx)(`p`,{className:`oc-admin__hint`,children:$?o():ne()}):(0,W.jsxs)(W.Fragment,{children:[(0,W.jsxs)(Pe,{children:[(0,W.jsx)(Me,{children:(0,W.jsxs)(V,{children:[(0,W.jsx)(B,{children:_e()}),(0,W.jsx)(B,{children:ce()}),(0,W.jsx)(B,{children:pe()}),(0,W.jsx)(B,{children:xe()}),(0,W.jsx)(B,{children:ge()}),(0,W.jsx)(B,{className:`text-right`,children:y()})]})}),(0,W.jsx)(Ne,{children:Z.map(e=>(0,W.jsxs)(V,{children:[(0,W.jsxs)(H,{className:`font-medium`,style:{maxWidth:280,overflow:`hidden`,textOverflow:`ellipsis`},title:e.filename,children:[e.filename,e.origin===`pasted`?(0,W.jsx)(j,{variant:`outline`,style:{marginLeft:6},children:te()}):null]}),(0,W.jsx)(H,{title:e.mimeType,children:K(e.category)}),(0,W.jsx)(H,{children:(0,W.jsx)(j,{variant:`secondary`,children:e.direction===`inbound`?C():d()})}),(0,W.jsx)(H,{style:{maxWidth:220,overflow:`hidden`,textOverflow:`ellipsis`},title:e.chatTitle,children:e.chatTitle}),(0,W.jsx)(H,{className:`whitespace-nowrap text-muted-foreground`,children:Re.format(e.createdAt)}),(0,W.jsx)(H,{className:`text-right`,children:(0,W.jsxs)(Oe,{children:[(0,W.jsx)(De,{asChild:!0,children:(0,W.jsx)(T,{variant:`ghost`,size:`icon`,"aria-label":ae(),children:(0,W.jsx)(je,{size:16})})}),(0,W.jsxs)(Ae,{align:`end`,children:[e.url?(0,W.jsx)(F,{asChild:!0,children:(0,W.jsxs)(`a`,{href:e.url,download:e.filename,target:`_blank`,rel:`noopener noreferrer`,children:[(0,W.jsx)(I,{size:14}),le()]})}):(0,W.jsxs)(F,{disabled:!0,children:[(0,W.jsx)(I,{size:14}),ie()]}),(0,W.jsxs)(F,{variant:`destructive`,onSelect:()=>J({id:e._id,filename:e.filename}),children:[(0,W.jsx)(E,{size:14}),l()]})]})]})})]},e._id))})]}),ze?(0,W.jsx)(`p`,{className:`oc-admin__hint`,style:{marginTop:8},children:a({cap:Be})}):null]}),(0,W.jsx)(D,{open:q!==null,onOpenChange:e=>!e&&J(null),children:(0,W.jsxs)(Ce,{children:[(0,W.jsxs)(M,{children:[(0,W.jsx)(ke,{children:re()}),(0,W.jsx)(Te,{children:ye()})]}),(0,W.jsxs)(O,{children:[(0,W.jsx)(k,{children:me()}),(0,W.jsx)(we,{onClick:()=>void Le(),children:l()})]})]})})]})}export{q as FilesTab};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{XS as r,YS as i}from"./api-
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{XS as r,YS as i}from"./api-BEXV-QDx.js";import{t as a}from"./button-BI4NYd7l.js";import{$t as o,Fn as s,In as c}from"./index-CND0zLpO.js";import{t as l}from"./TimeRangePicker-1vrUmBZJ.js";var u=t(e(),1),d=n(),f=250;function p({q:e,onQChange:t,searchPlaceholder:n=r(),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,{}),i()]})]})}export{p as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$v as r,$y as i,Ab as a,Bb as o,Bv as s,By as c,Cb as l,Cy as u,Db as d,Dy as f,E as p,Eb as m,Ey as h,Fb as g,Fy as _,Gb as v,Gy as y,Hb as b,Hy as x,Ib as S,Iy as C,Jb as w,Jv as T,Jy as E,Kb as D,Kv as O,Ky as k,Lb as A,Lv as j,Ly as ee,Mb as te,Nb as ne,Ny as re,Ob as ie,Oy as M,Pb as ae,Py as oe,Qv as N,Qy as P,Rb as F,Rv as se,Ry as ce,Sb as le,Sy as ue,Tb as de,Ty as fe,Ub as pe,Uy as me,Vb as he,Vy as ge,Wb as _e,Wy as ve,Xb as ye,Xv as be,Xy as xe,Yb as Se,Yv as Ce,Yy as we,Zv as Te,Zy as Ee,_y as De,ab as Oe,ay as ke,bb as Ae,by as je,cb as Me,cy as Ne,db as Pe,dy as Fe,eb as Ie,ey as Le,fb as I,fy as Re,gy as ze,hy as Be,ib as Ve,iy as He,jb as Ue,kb as We,ky as L,lX as R,lb as Ge,ly as Ke,mb as qe,my as Je,nb as Ye,ny as Xe,ob as Ze,oy as Qe,pb as $e,py as et,qb as tt,qv as nt,qy as rt,rb as it,ry as at,sb as ot,sy as st,t as z,tb as ct,ty as lt,uX as B,ub as ut,uy as dt,vb as ft,vy as pt,wb as mt,wy as ht,xb as V,xy as gt,yb as _t,yy as vt,zb as yt,zv as bt,zy as xt}from"./api-B8SYK4Qy.js";import{t as St}from"./x-Cqa-YMkZ.js";import{t as H}from"./button-CXjFGJbj.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-DDEtFVdr.js";import{t as nn}from"./FilterBar-BcbgCjju.js";import{t as rn}from"./DataTableShell-D-TTxNiz.js";import{t as X}from"./DetailChips-BG1A-DBR.js";var an=p(`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(z.groups.listGroups,{}),t=B(z.me.getMe,{host:Kt})?.role===`admin`,n=R(z.groups.createGroup),r=R(z.groups.updateGroup),i=R(z.groups.deleteGroup),s=Wt(),c=J(),[l,u]=(0,Z.useState)(!1),[d,f]=(0,Z.useState)(null),[p,m]=(0,Z.useState)(on),[h,_]=(0,Z.useState)(null),[x,C]=(0,Z.useState)(``),T=(0,Z.useMemo)(()=>{if(!e)return e;let t=x.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,x]);function E(){f(null),m(on),u(!0)}function O(e){f(e),m({name:e.name,description:e.description??``}),u(!0)}async function k(){try{d?await r({groupId:d._id,name:p.name,description:p.description}):await n({name:p.name,description:p.description||void 0}),m(on),f(null),u(!1)}catch(e){c.error(y(),e)}}async function j(e){if(await s({title:Ue({name:e.name}),description:a(),confirmWord:e.name,confirmLabel:We(),cancelLabel:A(),destructive:!0}))try{await i({groupId:e._id})}catch(e){c.error(ve(),e)}}return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:Se()}),t?(0,Q.jsx)(pn,{}):null,(0,Q.jsx)(nn,{q:x,onQChange:C,onReset:()=>C(``),canReset:x!==``,searchPlaceholder:b()}),(0,Q.jsx)(rn,{title:ye(),rows:T,addLabel:w(),onAdd:t?E:void 0,emptyHint:tt(),columns:[{header:D(),cell:e=>e.name,sort:e=>e.name},{header:v(),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:re({count:String(e.pendingInviteCount)})}):null]}),sort:e=>e.memberCount},{header:_e(),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:pe(),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:he(),onSelect:()=>_({groupId:e._id,name:e.name})},...t?[{label:o(),onSelect:()=>O(e)},{label:yt(),variant:`destructive`,onSelect:()=>void j(e)}]:[]]}),(0,Q.jsx)(Vt,{open:l,onOpenChange:u,title:d?g():S(),description:ae(),canSubmit:!!p.name.trim(),onSubmit:k,submitLabel:F(),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:ne()}),(0,Q.jsx)(U,{value:p.name,onChange:e=>m({...p,name:e.target.value})})]}),(0,Q.jsxs)(`label`,{className:`oc-field`,children:[(0,Q.jsx)(`span`,{className:`oc-field__label`,children:te()}),(0,Q.jsx)(U,{value:p.description,onChange:e=>m({...p,description:e.target.value})})]})]})}),(0,Q.jsx)(ln,{groupId:h?.groupId??null,groupName:h?.name??``,open:h!==null,onOpenChange:e=>{e||_(null)}})]})}var $=8;function cn({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}),Ae()]}),(0,Q.jsxs)(`span`,{className:`oc-access__pageinfo`,"aria-label":ft({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:[_t(),(0,Q.jsx)(Xt,{size:14,"aria-hidden":!0})]})]})}function ln({groupId:e,groupName:t,open:n,onOpenChange:r}){let i=B(z.groups.getGroup,n&&e?{groupId:e}:`skip`),a=i?.viewerIsAdmin===!0,o=B(z.groups.listAssignableInstances,n&&e?{groupId:e}:`skip`),s=B(z.groups.listAssignableUsers,n&&a?{}:`skip`),c=R(z.groups.addMember),f=R(z.groups.removeMember),p=R(z.groups.bulkSetMembers),h=R(z.groups.setGroupManager),g=J(),[_,v]=(0,Z.useState)(``),[y,b]=(0,Z.useState)(``),[x,S]=(0,Z.useState)(`members`),[C,w]=(0,Z.useState)(1),[T,D]=(0,Z.useState)(null),[O,k]=(0,Z.useState)(new Set),A=(0,Z.useRef)(null),j=(0,Z.useMemo)(()=>new Set((i?.members??[]).map(e=>e.userId)),[i]),ee=(0,Z.useMemo)(()=>new Set((i?.members??[]).filter(e=>e.manager).map(e=>e.userId)),[i]),te=(0,Z.useMemo)(()=>new Set((i?.members??[]).filter(e=>e.restricted).map(e=>e.userId)),[i]),ne=(0,Z.useMemo)(()=>new Set((i?.agents??[]).map(e=>q(e.instanceName,e.agentId))),[i]),re=(0,Z.useMemo)(()=>{let e=(i?.agents??[]).find(e=>e.isDefault);return e?q(e.instanceName,e.agentId):null},[i]);(0,Z.useEffect)(()=>{v(``),b(``),S(`members`),w(1),D(null),A.current=null},[n,e]),(0,Z.useEffect)(()=>{w(1)},[_]),(0,Z.useEffect)(()=>{n&&i&&e&&A.current!==e&&(A.current=e,k(new Set((i.members??[]).map(e=>e.userId))))},[n,i,e]);let M=(0,Z.useMemo)(()=>s?Yt(s,_,O):[],[s,_,O]);async function ae(t,n){if(e)try{n?await f({groupId:e,userId:t}):await c({groupId:e,userId:t})}catch(e){g.error(me(),W(e))}}async function oe(t,n){if(e)try{await h({groupId:e,userId:t,manager:!n})}catch(e){g.error(rt(),e)}}let N=Ct(M,e=>j.has(e.userId)),P=M.filter(e=>j.has(e.userId)).length,F=zt(M,C,$);async function se(){if(!e||M.length===0)return;let t=M.map(e=>e.userId);try{await p({groupId:e,userIds:t,member:N!==`all`})}catch(e){g.error(me(),W(e))}}let ce=(e,t)=>(0,Q.jsxs)(H,{type:`button`,variant:`ghost`,size:`sm`,className:`h-7`,"aria-label":ht({user:t}),title:ht({user:t}),onClick:()=>D({userId:e,label:t}),children:[(0,Q.jsx)(At,{size:13,"aria-hidden":!0}),fe()]});return(0,Q.jsx)(wt,{open:n,onOpenChange:r,children:(0,Q.jsxs)($t,{className:`oc-access`,children:[(0,Q.jsxs)(Et,{children:[(0,Q.jsx)(Mt,{children:ie({name:t})}),(0,Q.jsx)(It,{children:i&&!a?ge():d()})]}),(0,Q.jsxs)(qt,{value:x,onValueChange:S,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}),m(),i?(0,Q.jsx)(G,{variant:`secondary`,className:`oc-access__tabcount`,children:j.size}):null]}),(0,Q.jsxs)(Zt,{value:`agents`,className:`flex-1 gap-1.5`,children:[(0,Q.jsx)(Nt,{size:13,"aria-hidden":!0}),mt(),i?(0,Q.jsx)(G,{variant:`secondary`,className:`oc-access__tabcount`,children:ne.size}):null]}),(0,Q.jsxs)(Zt,{value:`charts`,className:`flex-1 gap-1.5`,children:[(0,Q.jsx)(an,{size:13,"aria-hidden":!0}),Ve(),i?(0,Q.jsx)(G,{variant:`secondary`,className:`oc-access__tabcount`,children:i.chartCount}):null]})]}),(0,Q.jsx)(Bt,{value:`members`,children:i===void 0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:I()}):a?s===void 0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:I()}):s.length===0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:ut()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(U,{value:_,onChange:e=>v(e.target.value),placeholder:de(),className:`oc-access__search`}),M.length===0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:le()}):(0,Q.jsxs)(Q.Fragment,{children:[M.length>1?(0,Q.jsxs)(`div`,{className:`oc-access__row oc-access__selectall`,children:[(0,Q.jsx)(K,{checked:N===`all`?!0:N===`some`?`indeterminate`:!1,onCheckedChange:()=>void se(),"aria-label":V()}),(0,Q.jsx)(`span`,{className:`oc-access__label`,children:V()}),(0,Q.jsxs)(G,{variant:`outline`,className:`oc-access__count`,children:[P,` / `,M.length]})]}):null,(0,Q.jsx)(`div`,{className:`oc-access__list`,children:F.pageItems.map(e=>{let t=j.has(e.userId),n=Gt(e),r=ee.has(e.userId);return(0,Q.jsxs)(`div`,{className:`oc-access__row`,children:[(0,Q.jsx)(K,{checked:t,onCheckedChange:()=>void ae(e.userId,t),"aria-label":qe({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&&te.has(e.userId)?(0,Q.jsx)(G,{variant:`outline`,className:`oc-access__role`,children:u()}):null,(0,Q.jsx)(G,{variant:`outline`,className:`oc-access__role`,children:Pt(e.role)}),t?ce(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?E():we(),title:r?E():we(),onClick:()=>void oe(e.userId,r),children:(0,Q.jsx)(jt,{size:15,"aria-hidden":!0})}):null})]},e._id)})}),(0,Q.jsx)(cn,{page:F.page,pageCount:F.pageCount,onPage:w})]})]}):e?(0,Q.jsx)(un,{groupId:e,members:i.members,agentsButton:ce}):null}),(0,Q.jsxs)(Bt,{value:`agents`,children:[i&&!a?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:Je()}):null,o===void 0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:I()}):o.length===0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:Ge()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(U,{value:y,onChange:e=>b(e.target.value),placeholder:l(),className:`oc-access__search`}),(0,Q.jsx)(`div`,{className:`oc-access__list`,children:o.map(t=>(0,Q.jsx)(fn,{groupId:e,instanceName:t.name,kind:t.kind??`openclaw`,assigned:ne,defaultKey:re,viewerIsAdmin:a,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:T,onOpenChange:e=>{e||D(null)}})]})})}function un({groupId:e,members:t,agentsButton:n}){let r=B(z.groupInvites.listGroupInviteRequests,{groupId:e}),i=R(z.groupInvites.requestGroupInvite),a=R(z.groups.removeMember),o=Wt(),s=J(),[l,d]=(0,Z.useState)(``),[p,m]=(0,Z.useState)(1),g=zt(t,p,$);async function v(t){t.preventDefault();let n=l.trim();if(n)try{await i({groupId:e,email:n}),d(``),s.success(C())}catch(e){s.error(_(),e)}}async function y(t,n){if(await o({title:L({user:n}),description:f({user:n}),confirmLabel:h(),cancelLabel:A(),destructive:!0}))try{await a({groupId:e,userId:t})}catch(e){s.error(me(),W(e))}}return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`form`,{className:`oc-access__invite`,onSubmit:e=>void v(e),children:[(0,Q.jsx)(U,{type:`email`,value:l,onChange:e=>d(e.target.value),placeholder:ce(),"aria-label":c()}),(0,Q.jsxs)(H,{type:`submit`,size:`sm`,disabled:!l.trim(),children:[(0,Q.jsx)(Tt,{size:14,"aria-hidden":!0}),ee()]})]}),(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:xt()}),t.length===0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:ue()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`div`,{className:`oc-access__list`,children:g.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:u()}):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":xe(),title:xe(),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":L({user:e.label}),title:e.manager?M():e.lastGroup?O():L({user:e.label}),onClick:()=>void y(e.userId,e.label),children:(0,Q.jsx)(St,{size:14,"aria-hidden":!0})})]},e.userId))}),(0,Q.jsx)(cn,{page:g.page,pageCount:g.pageCount,onPage:m})]}),r!==void 0&&r.length>0?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`p`,{className:`oc-access__subhead`,children:oe()}),(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 i=B(z.groups.getMemberAgentSettings,e&&t?{groupId:e,userId:t.userId}:`skip`),a=R(z.groups.setMemberAgents),o=R(z.groups.setMemberDefaultAgent),c=J();async function l(e){try{await e()}catch(e){c.error(nt(),e)}}let u=i?.agents??[],d=new Map(u.map(e=>[q(e.instanceName,e.agentId),e])),f=[...d.keys()],p=new Set(u.filter(e=>e.allowed).map(e=>q(e.instanceName,e.agentId)));function m(n){if(!e||!t||!i)return;let r=Lt(f,p,i.restricted,n).map(e=>{let t=d.get(e);return{instanceName:t.instanceName,agentId:t.agentId}});l(()=>a({groupId:e,userId:t.userId,agents:r}))}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:Xe({user:t?.label??``})}),(0,Q.jsx)(It,{children:lt()})]}),i===void 0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:I()}):i===null||u.length===0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:T()}):(0,Q.jsxs)(Q.Fragment,{children:[i.settable?null:(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:j()}),i.adminNarrowed?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:s()}):null,i.restrictedByAdmin&&!i.viewerIsAdmin?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:se()}):null,(0,Q.jsxs)(`div`,{className:`oc-access__row oc-access__selectall`,children:[(0,Q.jsx)(`span`,{className:`oc-access__label`,children:i.restricted?r():Le()}),i.restricted?(0,Q.jsx)(H,{type:`button`,size:`sm`,variant:`outline`,disabled:!i.settable||i.restrictedByAdmin&&!i.viewerIsAdmin,onClick:()=>e&&t?void l(()=>a({groupId:e,userId:t.userId,agents:null})):void 0,children:N()}):null]}),(0,Q.jsx)(`div`,{className:`oc-access__list`,children:u.map(n=>{let r=q(n.instanceName,n.agentId),a=n.displayName??n.agentId;return(0,Q.jsxs)(`div`,{className:`oc-access__row`,children:[(0,Q.jsx)(K,{checked:n.allowed,disabled:!i.settable||i.restrictedByAdmin&&!i.viewerIsAdmin&&!n.allowed,onCheckedChange:()=>m(r),"aria-label":Te({name:a})}),(0,Q.jsx)(`span`,{className:`oc-access__label`,title:a,children:a}),n.limitedByAdmin?(0,Q.jsx)(G,{variant:`outline`,className:`oc-access__role`,children:bt()}):null,n.state===`deleted`?(0,Q.jsx)(G,{variant:`outline`,className:`oc-access__gone`,children:Oe()}):null,n.allowed?n.isMemberDefault?(0,Q.jsx)(H,{type:`button`,size:`icon-sm`,variant:`ghost`,className:`oc-access__fav`,disabled:!i.settable,"aria-label":be(),title:be(),onClick:()=>e&&t?void l(()=>o({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:!i.settable,"aria-label":Ce(),title:Ce(),onClick:()=>e&&t?void l(()=>o({groupId:e,userId:t.userId,agent:{instanceName:n.instanceName,agentId:n.agentId}})):void 0,children:(0,Q.jsx)(Y,{size:14})}):null]},r)})})]})]})})}function fn({groupId:e,instanceName:t,kind:n,assigned:r,defaultKey:i,viewerIsAdmin:a,query:o}){let s=B(z.groups.listAssignableAgents,e?{instanceName:t,groupId:e}:`skip`),c=R(z.groups.assignAgentToGroup),l=R(z.groups.removeAgentFromGroup),u=R(z.groups.bulkSetGroupAgents),d=R(z.groups.claimAgentForGroup),f=R(z.groups.setGroupDefaultAgent),p=J(),[m,h]=(0,Z.useState)(1);if((0,Z.useEffect)(()=>{h(1)},[o]),!e)return null;let g=kt(s?.agents??[],o),_=s?.discovery&&!s.discovery.lastPollOk,v=e=>Ot({assigned:r.has(q(t,e.agentId)),claimable:e.claimable,reservedForGroup:e.reservedForGroup,enabled:e.enabled,present:e.presentInLastOk!==!1},a),y=g.filter(e=>v(e)!==`claim`),b=g.filter(e=>v(e)===`claim`);if(o.trim()&&g.length===0)return null;let S=y.filter(e=>v(e)===`toggle`&&e.presentInLastOk!==!1&&e.enabled!==!1),C=Ct(S,e=>r.has(q(t,e.agentId))),w=zt(y,m,$);async function T(n,r){try{r?await l({groupId:e,instanceName:t,agentId:n}):await c({groupId:e,instanceName:t,agentId:n})}catch(e){p.error(x(),W(e))}}async function E(){if(S.length===0)return;let n=S.map(e=>e.agentId);try{await u({groupId:e,instanceName:t,agentIds:n,assigned:C!==`all`})}catch(e){p.error(x(),W(e))}}async function D(n){try{await d({groupId:e,instanceName:t,agentId:n})}catch(e){p.error(Ke(),e)}}async function O(n){try{await f({groupId:e,agent:n===null?null:{instanceName:t,agentId:n}})}catch(e){p.error(at(),e)}}let k=e=>e.reservedForGroup?(0,Q.jsx)(G,{variant:`outline`,className:`oc-access__role`,children:Ne()}):e.reserved?(0,Q.jsx)(G,{variant:`outline`,className:`oc-access__role`,children:e.reservedGroupName===null?Qe():st({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}),_?(0,Q.jsx)(G,{variant:`outline`,className:`oc-access__stale`,children:Ze()}):null]}),s===void 0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:Pe()}):g.length===0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:_?ot():Me()}):(0,Q.jsxs)(Q.Fragment,{children:[S.length>1?(0,Q.jsxs)(`div`,{className:`oc-access__row oc-access__selectall`,children:[(0,Q.jsx)(K,{checked:C===`all`?!0:C===`some`?`indeterminate`:!1,onCheckedChange:()=>void E(),"aria-label":V()}),(0,Q.jsx)(`span`,{className:`oc-access__label`,children:V()})]}):null,w.pageItems.map(e=>{let n=q(t,e.agentId),a=r.has(n),o=e.presentInLastOk===!1,s=v(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 T(e.agentId,a),"aria-label":$e({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,k(e),o?(0,Q.jsx)(G,{variant:`outline`,className:`oc-access__gone`,children:Oe()}):null,a?i===n?(0,Q.jsx)(H,{type:`button`,size:`icon-sm`,variant:`ghost`,className:`oc-access__fav`,"aria-label":ke(),title:ke(),onClick:()=>void O(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":He(),title:He(),onClick:()=>void O(e.agentId),children:(0,Q.jsx)(Y,{size:14})}):null]},e.agentId)}),(0,Q.jsx)(cn,{page:w.page,pageCount:w.pageCount,onPage:h}),b.length>0?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`p`,{className:`oc-access__subhead`,children:et()}),(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:Re()}),b.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":dt({name:t}),onClick:()=>void D(e.agentId),children:Fe()})]},e.agentId)})]}):null]})]})}function pn(){let e=B(z.groupInvites.listPendingInviteRequests,{}),t=R(z.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(Be(),e)}}return(0,Q.jsxs)(`section`,{className:`oc-invites`,"aria-label":gt(),children:[(0,Q.jsxs)(`h3`,{className:`oc-invites__title`,children:[(0,Q.jsx)(Tt,{size:14,"aria-hidden":!0}),gt(),(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??`?`,` ·`,` `,je({by:e.requestedBy})]})]}),e.account===`ready`?null:(0,Q.jsx)(G,{variant:`outline`,className:`oc-access__role`,children:e.account===`none`?De():ze()}),(0,Q.jsx)(H,{type:`button`,size:`sm`,variant:`outline`,className:`h-7`,disabled:e.account!==`ready`,onClick:()=>void r(e._id,!0),children:vt()}),(0,Q.jsx)(H,{type:`button`,size:`sm`,variant:`ghost`,className:`h-7`,onClick:()=>void r(e._id,!1),children:pt()})]},e._id))})]})}function mn({groupId:e}){let t=B(z.charts.listGroupChartSelection,e?{groupId:e}:`skip`),n=R(z.charts.assignChartToGroup),r=R(z.charts.removeChartFromGroup),a=R(z.charts.setGroupDefaultChart),o=R(z.charts.addChartToGroupPool),s=R(z.charts.removeChartFromGroupPool),c=J();if(!e)return null;if(t===void 0)return(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:I()});let{pool:l,addable:u,canManagePool:d}=t;if(l.length===0&&!d)return(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:it()});async function f(t,i){try{i?await r({groupId:e,chartKey:t}):await n({groupId:e,chartKey:t})}catch(e){c.error(k(),e)}}async function p(t){try{await a({groupId:e,chartKey:t})}catch(e){c.error(k(),e)}}async function m(t){try{await o({groupId:e,chartKey:t})}catch(e){c.error(k(),e)}}async function h(t){try{await s({groupId:e,chartKey:t})}catch(e){c.error(k(),e)}}return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`div`,{className:`oc-access__list`,children:l.map(e=>(0,Q.jsxs)(`div`,{className:`oc-access__row`,children:[(0,Q.jsx)(K,{checked:e.selected,onCheckedChange:()=>void f(e.chartKey,e.selected),"aria-label":i({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":P(),title:P(),children:(0,Q.jsx)(Y,{size:14,fill:`currentColor`})}):(0,Q.jsx)(H,{type:`button`,variant:`ghost`,size:`sm`,onClick:()=>void p(e.chartKey),children:Ee()}):null,d?(0,Q.jsx)(H,{type:`button`,variant:`ghost`,size:`sm`,"aria-label":Ie({name:e.name}),title:Ie({name:e.name}),onClick:()=>void h(e.chartKey),children:(0,Q.jsx)(St,{size:14,"aria-hidden":!0})}):null]},e.chartKey))}),d?u.length>0?(0,Q.jsxs)(Qt,{value:``,onValueChange:e=>void m(e),children:[(0,Q.jsx)(en,{size:`sm`,className:`oc-access__search`,children:(0,Q.jsx)(Ft,{placeholder:ct()})}),(0,Q.jsx)(tn,{children:u.map(e=>(0,Q.jsx)(Ht,{value:e.chartKey,children:e.name},e.chartKey))})]}):l.length===0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:Ye()}):null:null]})}export{sn as GroupsTab};
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$v as r,$y as i,Ab as a,Bb as o,Bv as s,By as c,Cb as l,Cy as u,Db as d,Dy as f,E as p,Eb as m,Ey as h,Fb as g,Fy as _,Gb as v,Gy as y,Hb as b,Hy as x,Ib as S,Iy as C,Jb as w,Jv as T,Jy as E,Kb as D,Kv as O,Ky as k,Lb as A,Lv as j,Ly as ee,Mb as te,Nb as ne,Ny as re,Ob as ie,Oy as M,Pb as ae,Py as oe,Qv as N,Qy as P,Rb as F,Rv as se,Ry as ce,Sb as le,Sy as ue,Tb as de,Ty as fe,Ub as pe,Uy as me,Vb as he,Vy as ge,Wb as _e,Wy as ve,Xb as ye,Xv as be,Xy as xe,Yb as Se,Yv as Ce,Yy as we,Zv as Te,Zy as Ee,_y as De,ab as Oe,ay as ke,bb as Ae,by as je,cb as Me,cy as Ne,db as Pe,dy as Fe,eb as Ie,ey as Le,fX as I,fb as L,fy as Re,gy as ze,hy as Be,ib as Ve,iy as He,jb as Ue,kb as We,ky as R,lb as Ge,ly as Ke,mb as qe,my as Je,nb as Ye,ny as Xe,ob as Ze,oy as Qe,pX as z,pb as $e,py as et,qb as tt,qv as nt,qy as rt,rb as it,ry as at,sb as ot,sy as st,t as B,tb as ct,ty as lt,ub as ut,uy as dt,vb as ft,vy as pt,wb as mt,wy as ht,xb as V,xy as gt,yb as _t,yy as vt,zb as yt,zv as bt,zy as xt}from"./api-BEXV-QDx.js";import{t as St}from"./x-ijoBrBAS.js";import{t as H}from"./button-BI4NYd7l.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-CND0zLpO.js";import{t as nn}from"./FilterBar-Ct8JGeev.js";import{t as rn}from"./DataTableShell-Dekyfrzb.js";import{t as X}from"./DetailChips-Kz4cbymu.js";var an=p(`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=z(B.groups.listGroups,{}),t=z(B.me.getMe,{host:Kt})?.role===`admin`,n=I(B.groups.createGroup),r=I(B.groups.updateGroup),i=I(B.groups.deleteGroup),s=Wt(),c=J(),[l,u]=(0,Z.useState)(!1),[d,f]=(0,Z.useState)(null),[p,m]=(0,Z.useState)(on),[h,_]=(0,Z.useState)(null),[x,C]=(0,Z.useState)(``),T=(0,Z.useMemo)(()=>{if(!e)return e;let t=x.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,x]);function E(){f(null),m(on),u(!0)}function O(e){f(e),m({name:e.name,description:e.description??``}),u(!0)}async function k(){try{d?await r({groupId:d._id,name:p.name,description:p.description}):await n({name:p.name,description:p.description||void 0}),m(on),f(null),u(!1)}catch(e){c.error(y(),e)}}async function j(e){if(await s({title:Ue({name:e.name}),description:a(),confirmWord:e.name,confirmLabel:We(),cancelLabel:A(),destructive:!0}))try{await i({groupId:e._id})}catch(e){c.error(ve(),e)}}return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:Se()}),t?(0,Q.jsx)(pn,{}):null,(0,Q.jsx)(nn,{q:x,onQChange:C,onReset:()=>C(``),canReset:x!==``,searchPlaceholder:b()}),(0,Q.jsx)(rn,{title:ye(),rows:T,addLabel:w(),onAdd:t?E:void 0,emptyHint:tt(),columns:[{header:D(),cell:e=>e.name,sort:e=>e.name},{header:v(),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:re({count:String(e.pendingInviteCount)})}):null]}),sort:e=>e.memberCount},{header:_e(),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:pe(),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:he(),onSelect:()=>_({groupId:e._id,name:e.name})},...t?[{label:o(),onSelect:()=>O(e)},{label:yt(),variant:`destructive`,onSelect:()=>void j(e)}]:[]]}),(0,Q.jsx)(Vt,{open:l,onOpenChange:u,title:d?g():S(),description:ae(),canSubmit:!!p.name.trim(),onSubmit:k,submitLabel:F(),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:ne()}),(0,Q.jsx)(U,{value:p.name,onChange:e=>m({...p,name:e.target.value})})]}),(0,Q.jsxs)(`label`,{className:`oc-field`,children:[(0,Q.jsx)(`span`,{className:`oc-field__label`,children:te()}),(0,Q.jsx)(U,{value:p.description,onChange:e=>m({...p,description:e.target.value})})]})]})}),(0,Q.jsx)(ln,{groupId:h?.groupId??null,groupName:h?.name??``,open:h!==null,onOpenChange:e=>{e||_(null)}})]})}var $=8;function cn({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}),Ae()]}),(0,Q.jsxs)(`span`,{className:`oc-access__pageinfo`,"aria-label":ft({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:[_t(),(0,Q.jsx)(Xt,{size:14,"aria-hidden":!0})]})]})}function ln({groupId:e,groupName:t,open:n,onOpenChange:r}){let i=z(B.groups.getGroup,n&&e?{groupId:e}:`skip`),a=i?.viewerIsAdmin===!0,o=z(B.groups.listAssignableInstances,n&&e?{groupId:e}:`skip`),s=z(B.groups.listAssignableUsers,n&&a?{}:`skip`),c=I(B.groups.addMember),f=I(B.groups.removeMember),p=I(B.groups.bulkSetMembers),h=I(B.groups.setGroupManager),g=J(),[_,v]=(0,Z.useState)(``),[y,b]=(0,Z.useState)(``),[x,S]=(0,Z.useState)(`members`),[C,w]=(0,Z.useState)(1),[T,D]=(0,Z.useState)(null),[O,k]=(0,Z.useState)(new Set),A=(0,Z.useRef)(null),j=(0,Z.useMemo)(()=>new Set((i?.members??[]).map(e=>e.userId)),[i]),ee=(0,Z.useMemo)(()=>new Set((i?.members??[]).filter(e=>e.manager).map(e=>e.userId)),[i]),te=(0,Z.useMemo)(()=>new Set((i?.members??[]).filter(e=>e.restricted).map(e=>e.userId)),[i]),ne=(0,Z.useMemo)(()=>new Set((i?.agents??[]).map(e=>q(e.instanceName,e.agentId))),[i]),re=(0,Z.useMemo)(()=>{let e=(i?.agents??[]).find(e=>e.isDefault);return e?q(e.instanceName,e.agentId):null},[i]);(0,Z.useEffect)(()=>{v(``),b(``),S(`members`),w(1),D(null),A.current=null},[n,e]),(0,Z.useEffect)(()=>{w(1)},[_]),(0,Z.useEffect)(()=>{n&&i&&e&&A.current!==e&&(A.current=e,k(new Set((i.members??[]).map(e=>e.userId))))},[n,i,e]);let M=(0,Z.useMemo)(()=>s?Yt(s,_,O):[],[s,_,O]);async function ae(t,n){if(e)try{n?await f({groupId:e,userId:t}):await c({groupId:e,userId:t})}catch(e){g.error(me(),W(e))}}async function oe(t,n){if(e)try{await h({groupId:e,userId:t,manager:!n})}catch(e){g.error(rt(),e)}}let N=Ct(M,e=>j.has(e.userId)),P=M.filter(e=>j.has(e.userId)).length,F=zt(M,C,$);async function se(){if(!e||M.length===0)return;let t=M.map(e=>e.userId);try{await p({groupId:e,userIds:t,member:N!==`all`})}catch(e){g.error(me(),W(e))}}let ce=(e,t)=>(0,Q.jsxs)(H,{type:`button`,variant:`ghost`,size:`sm`,className:`h-7`,"aria-label":ht({user:t}),title:ht({user:t}),onClick:()=>D({userId:e,label:t}),children:[(0,Q.jsx)(At,{size:13,"aria-hidden":!0}),fe()]});return(0,Q.jsx)(wt,{open:n,onOpenChange:r,children:(0,Q.jsxs)($t,{className:`oc-access`,children:[(0,Q.jsxs)(Et,{children:[(0,Q.jsx)(Mt,{children:ie({name:t})}),(0,Q.jsx)(It,{children:i&&!a?ge():d()})]}),(0,Q.jsxs)(qt,{value:x,onValueChange:S,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}),m(),i?(0,Q.jsx)(G,{variant:`secondary`,className:`oc-access__tabcount`,children:j.size}):null]}),(0,Q.jsxs)(Zt,{value:`agents`,className:`flex-1 gap-1.5`,children:[(0,Q.jsx)(Nt,{size:13,"aria-hidden":!0}),mt(),i?(0,Q.jsx)(G,{variant:`secondary`,className:`oc-access__tabcount`,children:ne.size}):null]}),(0,Q.jsxs)(Zt,{value:`charts`,className:`flex-1 gap-1.5`,children:[(0,Q.jsx)(an,{size:13,"aria-hidden":!0}),Ve(),i?(0,Q.jsx)(G,{variant:`secondary`,className:`oc-access__tabcount`,children:i.chartCount}):null]})]}),(0,Q.jsx)(Bt,{value:`members`,children:i===void 0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:L()}):a?s===void 0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:L()}):s.length===0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:ut()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(U,{value:_,onChange:e=>v(e.target.value),placeholder:de(),className:`oc-access__search`}),M.length===0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:le()}):(0,Q.jsxs)(Q.Fragment,{children:[M.length>1?(0,Q.jsxs)(`div`,{className:`oc-access__row oc-access__selectall`,children:[(0,Q.jsx)(K,{checked:N===`all`?!0:N===`some`?`indeterminate`:!1,onCheckedChange:()=>void se(),"aria-label":V()}),(0,Q.jsx)(`span`,{className:`oc-access__label`,children:V()}),(0,Q.jsxs)(G,{variant:`outline`,className:`oc-access__count`,children:[P,` / `,M.length]})]}):null,(0,Q.jsx)(`div`,{className:`oc-access__list`,children:F.pageItems.map(e=>{let t=j.has(e.userId),n=Gt(e),r=ee.has(e.userId);return(0,Q.jsxs)(`div`,{className:`oc-access__row`,children:[(0,Q.jsx)(K,{checked:t,onCheckedChange:()=>void ae(e.userId,t),"aria-label":qe({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&&te.has(e.userId)?(0,Q.jsx)(G,{variant:`outline`,className:`oc-access__role`,children:u()}):null,(0,Q.jsx)(G,{variant:`outline`,className:`oc-access__role`,children:Pt(e.role)}),t?ce(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?E():we(),title:r?E():we(),onClick:()=>void oe(e.userId,r),children:(0,Q.jsx)(jt,{size:15,"aria-hidden":!0})}):null})]},e._id)})}),(0,Q.jsx)(cn,{page:F.page,pageCount:F.pageCount,onPage:w})]})]}):e?(0,Q.jsx)(un,{groupId:e,members:i.members,agentsButton:ce}):null}),(0,Q.jsxs)(Bt,{value:`agents`,children:[i&&!a?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:Je()}):null,o===void 0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:L()}):o.length===0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:Ge()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(U,{value:y,onChange:e=>b(e.target.value),placeholder:l(),className:`oc-access__search`}),(0,Q.jsx)(`div`,{className:`oc-access__list`,children:o.map(t=>(0,Q.jsx)(fn,{groupId:e,instanceName:t.name,kind:t.kind??`openclaw`,assigned:ne,defaultKey:re,viewerIsAdmin:a,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:T,onOpenChange:e=>{e||D(null)}})]})})}function un({groupId:e,members:t,agentsButton:n}){let r=z(B.groupInvites.listGroupInviteRequests,{groupId:e}),i=I(B.groupInvites.requestGroupInvite),a=I(B.groups.removeMember),o=Wt(),s=J(),[l,d]=(0,Z.useState)(``),[p,m]=(0,Z.useState)(1),g=zt(t,p,$);async function v(t){t.preventDefault();let n=l.trim();if(n)try{await i({groupId:e,email:n}),d(``),s.success(C())}catch(e){s.error(_(),e)}}async function y(t,n){if(await o({title:R({user:n}),description:f({user:n}),confirmLabel:h(),cancelLabel:A(),destructive:!0}))try{await a({groupId:e,userId:t})}catch(e){s.error(me(),W(e))}}return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`form`,{className:`oc-access__invite`,onSubmit:e=>void v(e),children:[(0,Q.jsx)(U,{type:`email`,value:l,onChange:e=>d(e.target.value),placeholder:ce(),"aria-label":c()}),(0,Q.jsxs)(H,{type:`submit`,size:`sm`,disabled:!l.trim(),children:[(0,Q.jsx)(Tt,{size:14,"aria-hidden":!0}),ee()]})]}),(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:xt()}),t.length===0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:ue()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`div`,{className:`oc-access__list`,children:g.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:u()}):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":xe(),title:xe(),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":R({user:e.label}),title:e.manager?M():e.lastGroup?O():R({user:e.label}),onClick:()=>void y(e.userId,e.label),children:(0,Q.jsx)(St,{size:14,"aria-hidden":!0})})]},e.userId))}),(0,Q.jsx)(cn,{page:g.page,pageCount:g.pageCount,onPage:m})]}),r!==void 0&&r.length>0?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`p`,{className:`oc-access__subhead`,children:oe()}),(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 i=z(B.groups.getMemberAgentSettings,e&&t?{groupId:e,userId:t.userId}:`skip`),a=I(B.groups.setMemberAgents),o=I(B.groups.setMemberDefaultAgent),c=J();async function l(e){try{await e()}catch(e){c.error(nt(),e)}}let u=i?.agents??[],d=new Map(u.map(e=>[q(e.instanceName,e.agentId),e])),f=[...d.keys()],p=new Set(u.filter(e=>e.allowed).map(e=>q(e.instanceName,e.agentId)));function m(n){if(!e||!t||!i)return;let r=Lt(f,p,i.restricted,n).map(e=>{let t=d.get(e);return{instanceName:t.instanceName,agentId:t.agentId}});l(()=>a({groupId:e,userId:t.userId,agents:r}))}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:Xe({user:t?.label??``})}),(0,Q.jsx)(It,{children:lt()})]}),i===void 0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:L()}):i===null||u.length===0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:T()}):(0,Q.jsxs)(Q.Fragment,{children:[i.settable?null:(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:j()}),i.adminNarrowed?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:s()}):null,i.restrictedByAdmin&&!i.viewerIsAdmin?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:se()}):null,(0,Q.jsxs)(`div`,{className:`oc-access__row oc-access__selectall`,children:[(0,Q.jsx)(`span`,{className:`oc-access__label`,children:i.restricted?r():Le()}),i.restricted?(0,Q.jsx)(H,{type:`button`,size:`sm`,variant:`outline`,disabled:!i.settable||i.restrictedByAdmin&&!i.viewerIsAdmin,onClick:()=>e&&t?void l(()=>a({groupId:e,userId:t.userId,agents:null})):void 0,children:N()}):null]}),(0,Q.jsx)(`div`,{className:`oc-access__list`,children:u.map(n=>{let r=q(n.instanceName,n.agentId),a=n.displayName??n.agentId;return(0,Q.jsxs)(`div`,{className:`oc-access__row`,children:[(0,Q.jsx)(K,{checked:n.allowed,disabled:!i.settable||i.restrictedByAdmin&&!i.viewerIsAdmin&&!n.allowed,onCheckedChange:()=>m(r),"aria-label":Te({name:a})}),(0,Q.jsx)(`span`,{className:`oc-access__label`,title:a,children:a}),n.limitedByAdmin?(0,Q.jsx)(G,{variant:`outline`,className:`oc-access__role`,children:bt()}):null,n.state===`deleted`?(0,Q.jsx)(G,{variant:`outline`,className:`oc-access__gone`,children:Oe()}):null,n.allowed?n.isMemberDefault?(0,Q.jsx)(H,{type:`button`,size:`icon-sm`,variant:`ghost`,className:`oc-access__fav`,disabled:!i.settable,"aria-label":be(),title:be(),onClick:()=>e&&t?void l(()=>o({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:!i.settable,"aria-label":Ce(),title:Ce(),onClick:()=>e&&t?void l(()=>o({groupId:e,userId:t.userId,agent:{instanceName:n.instanceName,agentId:n.agentId}})):void 0,children:(0,Q.jsx)(Y,{size:14})}):null]},r)})})]})]})})}function fn({groupId:e,instanceName:t,kind:n,assigned:r,defaultKey:i,viewerIsAdmin:a,query:o}){let s=z(B.groups.listAssignableAgents,e?{instanceName:t,groupId:e}:`skip`),c=I(B.groups.assignAgentToGroup),l=I(B.groups.removeAgentFromGroup),u=I(B.groups.bulkSetGroupAgents),d=I(B.groups.claimAgentForGroup),f=I(B.groups.setGroupDefaultAgent),p=J(),[m,h]=(0,Z.useState)(1);if((0,Z.useEffect)(()=>{h(1)},[o]),!e)return null;let g=kt(s?.agents??[],o),_=s?.discovery&&!s.discovery.lastPollOk,v=e=>Ot({assigned:r.has(q(t,e.agentId)),claimable:e.claimable,reservedForGroup:e.reservedForGroup,enabled:e.enabled,present:e.presentInLastOk!==!1},a),y=g.filter(e=>v(e)!==`claim`),b=g.filter(e=>v(e)===`claim`);if(o.trim()&&g.length===0)return null;let S=y.filter(e=>v(e)===`toggle`&&e.presentInLastOk!==!1&&e.enabled!==!1),C=Ct(S,e=>r.has(q(t,e.agentId))),w=zt(y,m,$);async function T(n,r){try{r?await l({groupId:e,instanceName:t,agentId:n}):await c({groupId:e,instanceName:t,agentId:n})}catch(e){p.error(x(),W(e))}}async function E(){if(S.length===0)return;let n=S.map(e=>e.agentId);try{await u({groupId:e,instanceName:t,agentIds:n,assigned:C!==`all`})}catch(e){p.error(x(),W(e))}}async function D(n){try{await d({groupId:e,instanceName:t,agentId:n})}catch(e){p.error(Ke(),e)}}async function O(n){try{await f({groupId:e,agent:n===null?null:{instanceName:t,agentId:n}})}catch(e){p.error(at(),e)}}let k=e=>e.reservedForGroup?(0,Q.jsx)(G,{variant:`outline`,className:`oc-access__role`,children:Ne()}):e.reserved?(0,Q.jsx)(G,{variant:`outline`,className:`oc-access__role`,children:e.reservedGroupName===null?Qe():st({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}),_?(0,Q.jsx)(G,{variant:`outline`,className:`oc-access__stale`,children:Ze()}):null]}),s===void 0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:Pe()}):g.length===0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:_?ot():Me()}):(0,Q.jsxs)(Q.Fragment,{children:[S.length>1?(0,Q.jsxs)(`div`,{className:`oc-access__row oc-access__selectall`,children:[(0,Q.jsx)(K,{checked:C===`all`?!0:C===`some`?`indeterminate`:!1,onCheckedChange:()=>void E(),"aria-label":V()}),(0,Q.jsx)(`span`,{className:`oc-access__label`,children:V()})]}):null,w.pageItems.map(e=>{let n=q(t,e.agentId),a=r.has(n),o=e.presentInLastOk===!1,s=v(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 T(e.agentId,a),"aria-label":$e({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,k(e),o?(0,Q.jsx)(G,{variant:`outline`,className:`oc-access__gone`,children:Oe()}):null,a?i===n?(0,Q.jsx)(H,{type:`button`,size:`icon-sm`,variant:`ghost`,className:`oc-access__fav`,"aria-label":ke(),title:ke(),onClick:()=>void O(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":He(),title:He(),onClick:()=>void O(e.agentId),children:(0,Q.jsx)(Y,{size:14})}):null]},e.agentId)}),(0,Q.jsx)(cn,{page:w.page,pageCount:w.pageCount,onPage:h}),b.length>0?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`p`,{className:`oc-access__subhead`,children:et()}),(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:Re()}),b.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":dt({name:t}),onClick:()=>void D(e.agentId),children:Fe()})]},e.agentId)})]}):null]})]})}function pn(){let e=z(B.groupInvites.listPendingInviteRequests,{}),t=I(B.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(Be(),e)}}return(0,Q.jsxs)(`section`,{className:`oc-invites`,"aria-label":gt(),children:[(0,Q.jsxs)(`h3`,{className:`oc-invites__title`,children:[(0,Q.jsx)(Tt,{size:14,"aria-hidden":!0}),gt(),(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??`?`,` ·`,` `,je({by:e.requestedBy})]})]}),e.account===`ready`?null:(0,Q.jsx)(G,{variant:`outline`,className:`oc-access__role`,children:e.account===`none`?De():ze()}),(0,Q.jsx)(H,{type:`button`,size:`sm`,variant:`outline`,className:`h-7`,disabled:e.account!==`ready`,onClick:()=>void r(e._id,!0),children:vt()}),(0,Q.jsx)(H,{type:`button`,size:`sm`,variant:`ghost`,className:`h-7`,onClick:()=>void r(e._id,!1),children:pt()})]},e._id))})]})}function mn({groupId:e}){let t=z(B.charts.listGroupChartSelection,e?{groupId:e}:`skip`),n=I(B.charts.assignChartToGroup),r=I(B.charts.removeChartFromGroup),a=I(B.charts.setGroupDefaultChart),o=I(B.charts.addChartToGroupPool),s=I(B.charts.removeChartFromGroupPool),c=J();if(!e)return null;if(t===void 0)return(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:L()});let{pool:l,addable:u,canManagePool:d}=t;if(l.length===0&&!d)return(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:it()});async function f(t,i){try{i?await r({groupId:e,chartKey:t}):await n({groupId:e,chartKey:t})}catch(e){c.error(k(),e)}}async function p(t){try{await a({groupId:e,chartKey:t})}catch(e){c.error(k(),e)}}async function m(t){try{await o({groupId:e,chartKey:t})}catch(e){c.error(k(),e)}}async function h(t){try{await s({groupId:e,chartKey:t})}catch(e){c.error(k(),e)}}return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`div`,{className:`oc-access__list`,children:l.map(e=>(0,Q.jsxs)(`div`,{className:`oc-access__row`,children:[(0,Q.jsx)(K,{checked:e.selected,onCheckedChange:()=>void f(e.chartKey,e.selected),"aria-label":i({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":P(),title:P(),children:(0,Q.jsx)(Y,{size:14,fill:`currentColor`})}):(0,Q.jsx)(H,{type:`button`,variant:`ghost`,size:`sm`,onClick:()=>void p(e.chartKey),children:Ee()}):null,d?(0,Q.jsx)(H,{type:`button`,variant:`ghost`,size:`sm`,"aria-label":Ie({name:e.name}),title:Ie({name:e.name}),onClick:()=>void h(e.chartKey),children:(0,Q.jsx)(St,{size:14,"aria-hidden":!0})}):null]},e.chartKey))}),d?u.length>0?(0,Q.jsxs)(Qt,{value:``,onValueChange:e=>void m(e),children:[(0,Q.jsx)(en,{size:`sm`,className:`oc-access__search`,children:(0,Q.jsx)(Ft,{placeholder:ct()})}),(0,Q.jsx)(tn,{children:u.map(e=>(0,Q.jsx)(Ht,{value:e.chartKey,children:e.name},e.chartKey))})]}):l.length===0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:Ye()}):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{$P as r,$a as i,A as a,AF as o,AP as s,BF as c,BP as l,CF as u,CP as d,D as f,DF as p,DP as m,EF as h,EP as g,F as _,FF as v,FP as y,Fp as b,Fv as x,GF as S,GP as C,HF as ee,HP as w,IF as te,IP as T,Ip as E,Iv as D,JF as ne,JP as O,KF as re,KP as ie,LF as ae,LP as oe,Lk as se,Lp as ce,M as le,MF as ue,MP as de,N as fe,NF as pe,NP as k,O as me,OF as he,OP as ge,P as _e,PF as ve,PP as ye,Pp as be,Pv as xe,QP as Se,Qa as Ce,RF as we,RP as Te,Rk as Ee,SF as De,SP as Oe,TF as ke,TP as Ae,UF as je,UP as Me,VF as Ne,VP as Pe,WF as Fe,WP as Ie,XP as Le,YF as Re,YP as ze,ZP as Be,Za as Ve,_F as He,_P as Ue,aF as A,aP as We,ao as Ge,bF as Ke,bP as qe,cF as Je,cP as Ye,cU as j,cn as Xe,co as Ze,dF as Qe,dP as $e,dn as et,do as tt,eF as nt,eP as rt,eo as it,fF as at,fP as ot,fX as M,fn as st,fo as ct,gF as lt,gP as ut,gn as dt,hF as ft,hP as pt,hn as mt,iF as ht,iP as gt,io as _t,iu as vt,j as yt,jF as bt,jP as xt,k as St,kF as Ct,lF as wt,lP as Tt,lU as Et,ln as Dt,lo as Ot,mF as kt,mP as At,mn as jt,nF as Mt,nP as Nt,no as Pt,nu as Ft,oF as It,oP as Lt,oo as Rt,pF as zt,pP as Bt,pX as N,pn as Vt,po as Ht,qF as Ut,qP as Wt,rF as Gt,rP as Kt,ro as qt,ru as Jt,sF as Yt,sP as P,sn as Xt,so as Zt,t as F,tF as I,tP as Qt,to as $t,uF as en,uP as tn,uX as L,un as nn,uo as rn,vF as an,vP as on,wF as sn,wP as cn,xF as ln,xP as un,yF as dn,yP as fn,zF as pn,zP as mn}from"./api-BEXV-QDx.js";import{a as hn,c as gn}from"./FieldLabel-Dug2NEx7.js";import{t as R}from"./button-BI4NYd7l.js";import{$t as z,Ct as B,Dt as V,J as _n,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-CND0zLpO.js";import{t as Dn}from"./DataTableShell-Dekyfrzb.js";import{InstanceConfigDialog as On}from"./BridgeTab-5DckBVxB.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:hn,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=M(F.admin.upsertInstance),r=M(F.widgets.setInstanceWidgets),s=M(F.admin.deleteInstance),l=W(),[d,m]=(0,Y.useState)(!1),[g,y]=(0,Y.useState)(Q),[b,x]=(0,Y.useState)(null),[C,w]=(0,Y.useState)(null),[T,E]=(0,Y.useState)(null),[D,O]=(0,Y.useState)(null);async function ie(){try{let t=await n({instanceId:D??void 0,name:g.name,gatewayUrl:g.gatewayUrl,bridgeUrl:g.bridgeUrl||void 0,displayName:g.displayName||void 0,kind:g.kind,transport:g.kind===`hermes`?g.transport:void 0,gatewayVersion:g.gatewayVersion||void 0,gatewayHttpUrl:g.gatewayHttpUrl||void 0,...g.kind===`openclaw`?{authMode:g.authMode,personScopes:g.personScopes,identitySource:g.identitySource,participantIdentity:g.participantIdentity,managePermissionModes:g.managePermissionModes,systemIdentity:g.systemIdentity||void 0}:{},streamTransport:g.streamTransport}),i=D===null?null:e?.find(e=>e._id===D),a=i?.config?.widgetsEnabled!==!1,o=i?.config?.widgetPromptConfirm===!0;g.kind===`openclaw`&&(g.widgetsEnabled!==a||g.widgetPromptConfirm!==o)&&await r({instanceId:t,enabled:g.widgetsEnabled,promptConfirm:g.widgetPromptConfirm}),y(Q),O(null),m(!1)}catch(e){l.error(Ut(),e)}}return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`p`,{className:`oc-admin__hint`,children:[re(),(0,Z.jsx)(`strong`,{children:S()}),Fe()]}),(0,Z.jsx)(Dn,{title:je(),rows:e,addLabel:ee(),onAdd:()=>{O(null),y(Q),m(!0)},emptyHint:Ne(),columns:[{header:c(),cell:e=>e.name,sort:e=>e.name},{header:pn(),cell:e=>(0,Z.jsx)(H,{variant:`outline`,children:e.kind??`openclaw`}),sort:e=>e.kind??`openclaw`},{header:we(),cell:e=>e.gatewayUrl,sort:e=>e.gatewayUrl},{header:ae(),cell:e=>e.displayName??`—`,sort:e=>e.displayName??null},{header:Re(),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)?P():void 0,children:[e.emoji?`${e.emoji} `:``,e.displayName??e.agentId]},e.agentId))})}}],rowActions:e=>[{label:pe(),onSelect:()=>{O(e._id),y(Nn(e)),m(!0)}},{label:ne(),onSelect:()=>x(e.name)},{label:an(),onSelect:()=>E(e)},{label:te(),onSelect:()=>w(e)},{label:v(),variant:`destructive`,onSelect:()=>void s({instanceId:e._id})}],bulkActions:[{label:v(),variant:`destructive`,onSelect:e=>e.forEach(e=>void s({instanceId:e}))}]}),(0,Z.jsx)(xn,{open:d,onOpenChange:m,title:D?ue():ve(),description:o(),canSubmit:!!(g.name&&g.gatewayUrl),onSubmit:ie,submitLabel:Ct(),children:(0,Z.jsxs)(`div`,{className:`oc-form`,children:[(0,Z.jsxs)($,{label:he(),children:[(0,Z.jsx)(z,{value:g.name,disabled:D!==null,onChange:e=>y({...g,name:e.target.value})}),D?(0,Z.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:bt()}):null]}),(0,Z.jsx)($,{label:p(),children:(0,Z.jsxs)(K,{value:g.kind,onValueChange:e=>y({...g,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`})]})]})}),g.kind===`hermes`?(0,Z.jsx)($,{label:vt(),children:(0,Z.jsxs)(K,{value:g.transport,onValueChange:e=>y({...g,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:Jt()}),(0,Z.jsx)(G,{value:`rest`,children:Ft()})]})]})}):null,(0,Z.jsx)($,{label:h(),children:(0,Z.jsx)(z,{value:g.gatewayUrl,onChange:e=>y({...g,gatewayUrl:e.target.value})})}),(0,Z.jsx)($,{label:ke(),children:(0,Z.jsx)(z,{value:g.bridgeUrl,placeholder:sn(),onChange:e=>y({...g,bridgeUrl:e.target.value})})}),(0,Z.jsx)($,{label:u(),children:(0,Z.jsx)(z,{value:g.displayName,onChange:e=>y({...g,displayName:e.target.value})})}),(0,Z.jsxs)($,{label:Ee(),children:[(0,Z.jsxs)(K,{value:g.streamTransport,onValueChange:e=>y({...g,streamTransport:e}),children:[(0,Z.jsx)(q,{size:`sm`,className:`w-full`,children:(0,Z.jsx)(U,{})}),(0,Z.jsx)(J,{children:gn.map(e=>(0,Z.jsx)(G,{value:e,children:e},e))})]}),(0,Z.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:se()})]}),(0,Z.jsx)($,{label:De(),children:(0,Z.jsx)(z,{value:g.gatewayVersion,placeholder:ln(),onChange:e=>y({...g,gatewayVersion:e.target.value})})}),g.kind===`openclaw`?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)($,{label:qt(),children:[(0,Z.jsxs)(K,{value:g.authMode,onValueChange:e=>y({...g,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:Pt()}),(0,Z.jsx)(G,{value:`trusted-proxy`,children:$t()})]})]}),(0,Z.jsx)(`p`,{className:`oc-field__hint`,children:g.authMode===`trusted-proxy`?i():it()})]}),g.authMode===`trusted-proxy`?(0,Z.jsxs)($,{label:Ht(),children:[(0,Z.jsxs)(K,{value:g.personScopes,onValueChange:e=>y({...g,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:ct()}),(0,Z.jsx)(G,{value:`full`,children:tt()})]})]}),(0,Z.jsx)(`p`,{className:`oc-field__hint`,children:g.personScopes===`full`?Ot():rn()})]}):null,g.authMode===`trusted-proxy`?(0,Z.jsxs)($,{label:Ze(),children:[(0,Z.jsxs)(K,{value:g.identitySource,onValueChange:e=>y({...g,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:Zt()}),(0,Z.jsx)(G,{value:`email`,children:Rt()})]})]}),(0,Z.jsx)(`p`,{className:`oc-field__hint`,children:g.identitySource===`email`?_t():Ge()})]}):null,g.authMode===`trusted-proxy`?(0,Z.jsxs)($,{label:dt(),children:[(0,Z.jsxs)(K,{value:g.participantIdentity,onValueChange:e=>y({...g,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:mt()}),(0,Z.jsx)(G,{value:`self`,children:jt()})]})]}),(0,Z.jsx)(`p`,{className:`oc-field__hint`,children:g.participantIdentity===`self`?Xt():Vt()})]}):null,g.kind===`openclaw`?(0,Z.jsxs)($,{label:st(),children:[(0,Z.jsxs)(K,{value:g.managePermissionModes?`on`:`off`,onValueChange:e=>y({...g,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:et()}),(0,Z.jsx)(G,{value:`on`,children:nn()})]})]}),(0,Z.jsx)(`p`,{className:`oc-field__hint`,children:g.managePermissionModes?Xe():Dt()})]}):null,g.kind===`openclaw`?(0,Z.jsxs)($,{label:_(),children:[(0,Z.jsxs)(K,{value:g.widgetsEnabled?`on`:`off`,onValueChange:e=>y({...g,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:_e()}),(0,Z.jsx)(G,{value:`off`,children:fe()})]})]}),(0,Z.jsx)(`p`,{className:`oc-field__hint`,children:g.widgetsEnabled?le():yt()})]}):null,g.kind===`openclaw`&&g.widgetsEnabled?(0,Z.jsxs)($,{label:a(),children:[(0,Z.jsxs)(K,{value:g.widgetPromptConfirm?`on`:`off`,onValueChange:e=>y({...g,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:St()}),(0,Z.jsx)(G,{value:`on`,children:me()})]})]}),(0,Z.jsx)(`p`,{className:`oc-field__hint`,children:f()})]}):null,g.authMode===`trusted-proxy`?(0,Z.jsx)($,{label:Ce(),children:(0,Z.jsx)(z,{value:g.systemIdentity,placeholder:Ve(),onChange:e=>y({...g,systemIdentity:e.target.value})})}):null]}):null,(0,Z.jsx)($,{label:Ke(),children:(0,Z.jsx)(z,{value:g.gatewayHttpUrl,placeholder:dn(),onChange:e=>y({...g,gatewayHttpUrl:e.target.value})})})]})}),(0,Z.jsx)(Wn,{instanceName:b,open:b!==null,onOpenChange:e=>{e||x(null)}}),C?(0,Z.jsx)(On,{instance:C,onClose:()=>w(null)},C._id):null,T?(0,Z.jsx)(Fn,{instance:T,onClose:()=>E(null)},T._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)(B,{open:!0,onOpenChange:e=>!e&&t(),children:(0,Z.jsxs)(En,{onOpenAutoFocus:e=>e.preventDefault(),children:[(0,Z.jsxs)(V,{children:[(0,Z.jsx)(yn,{children:He({instance:e.displayName??e.name})}),(0,Z.jsx)(bn,{children:lt()})]}),(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=L(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(Le());break;case`no_agents`:n.success(O());break;case`no_bridge_url`:n.error(Wt());break;case`deploy_misconfigured`:n.error(ie());break;case`unauthorized`:n.error(Ie());break;case`not_served`:n.error(Me());break;default:n.error(C());break}}catch(e){n.error(ze(),e)}finally{i(!1)}}}return(0,Z.jsxs)(`div`,{className:`oc-form`,children:[(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:w()}),(0,Z.jsx)(`div`,{className:`flex items-center gap-2`,children:(0,Z.jsx)(R,{size:`sm`,variant:`outline`,onClick:()=>void a(),disabled:r,children:r?Be():Se()})})]})}function Ln({instance:e}){let t=N(F.bridgeAuth.listBridgeAuthStatus,{}),n=L(F.bridgeAuth.mintBridgeSecret),r=M(F.bridgeAuth.revokeBridgeSecret),i=W(),[a,o]=(0,Y.useState)(!1),[s,c]=(0,Y.useState)(null),[u,d]=(0,Y.useState)(!1),f=(t??[]).find(t=>t.instanceId===e._id),p=f!==void 0;async function m(){if(!a){o(!0);try{c((await n({instanceId:e._id})).plaintext),d(!1)}catch(e){i.error(y(),e)}finally{o(!1)}}}async function h(){if(!a){o(!0);try{await r({instanceId:e._id}),c(null),i.success(T())}catch(e){i.error(y(),e)}finally{o(!1)}}}async function g(){if(s)try{await navigator.clipboard.writeText(s),d(!0)}catch{}}return(0,Z.jsxs)($,{label:Pe(),children:[(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:l()}),(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Z.jsx)(H,{variant:p?`outline`:`secondary`,children:p?`${at()} · ${f.prefix}…${f.lastFour}`:Qe()}),(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(R,{size:`sm`,onClick:()=>void m(),disabled:a,children:p?Te():mn()}),p?(0,Z.jsx)(R,{size:`sm`,variant:`destructive`,onClick:()=>void h(),disabled:a,children:oe()}):null]})]}),s?(0,Z.jsxs)(`div`,{className:`oc-bridgesecret__reveal`,children:[(0,Z.jsx)(`p`,{className:`oc-sa__minted-warning`,children:ye()}),(0,Z.jsxs)(`div`,{className:`oc-sa__minted-box`,children:[(0,Z.jsx)(`code`,{className:`oc-sa__minted-plain`,children:s}),(0,Z.jsx)(R,{variant:`outline`,size:`sm`,onClick:()=>void g(),children:u?Et():j()})]}),(0,Z.jsx)(R,{size:`sm`,variant:`ghost`,onClick:()=>{c(null),d(!1)},children:k()})]}):null]})}function Rn({instanceId:e,field:t,updatedAt:n}){let i=L(F.instanceSecrets.setInstanceSecret),a=M(F.instanceSecrets.clearInstanceSecret),o=L(F.deviceIdentity.generateDeviceIdentity),s=W(),[c,l]=(0,Y.useState)(``),[u,d]=(0,Y.useState)(!1),[f,p]=(0,Y.useState)(null),[m,h]=(0,Y.useState)(!1),g=n!==null,_=t===`deviceIdentity`,v=t===`token`?ft():t===`deviceIdentity`?kt():zt();async function y(){if(!(!c.trim()||u)){d(!0);try{await i({instanceId:e,field:t,plaintext:c}),l(``),p(null),h(!1),s.success(It())}catch(e){s.error(A(),e)}finally{d(!1)}}}async function b(){if(!u){d(!0);try{await a({instanceId:e,field:t}),p(null),h(!1),s.success(ht())}catch(e){s.error(A(),e)}finally{d(!1)}}}async function x(){if(!u){d(!0);try{p(await o({instanceId:e})),h(!1),s.success(I())}catch(e){s.error(r(),e)}finally{d(!1)}}}let S=f?`openclaw devices approve ${f.id}`:``;async function C(){if(S)try{await navigator.clipboard.writeText(S),h(!0)}catch{}}return(0,Z.jsxs)($,{label:v,children:[_?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:Mt()}):null,(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Z.jsx)(H,{variant:g?`outline`:`secondary`,children:g?at():Qe()}),(0,Z.jsx)(z,{type:`password`,autoComplete:`off`,className:`flex-1 min-w-32`,value:c,placeholder:g?wt():en(),onChange:e=>l(e.target.value)}),(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(R,{size:`sm`,onClick:()=>void y(),disabled:u||c.trim().length===0,children:Je()}),_?(0,Z.jsx)(R,{size:`sm`,variant:`outline`,onClick:()=>void x(),disabled:u,children:Gt()}):null,g?(0,Z.jsx)(R,{size:`sm`,variant:`destructive`,onClick:()=>void b(),disabled:u,children:Yt()}):null]})]}),f?(0,Z.jsxs)(`div`,{className:`oc-bridgesecret__reveal`,children:[(0,Z.jsx)(`p`,{className:`text-sm font-medium`,children:I()}),(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:nt()}),(0,Z.jsxs)(`div`,{className:`oc-sa__minted-box`,children:[(0,Z.jsx)(`code`,{className:`oc-sa__minted-plain`,children:S}),(0,Z.jsx)(R,{variant:`outline`,size:`sm`,onClick:()=>void C(),children:m?Et():j()})]}),(0,Z.jsx)(R,{size:`sm`,variant:`ghost`,onClick:()=>{p(null),h(!1)},children:k()})]}):null]})}var zn={conversational:Oe,documentary:qe,summarizer:ce,curator:b},Bn={conversational:un,documentary:fn,summarizer:E,curator:be},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:g()}),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)(R,{type:`button`,variant:`outline`,size:`sm`,className:`h-7`,children:Ae()})}),(0,Z.jsxs)(Tn,{align:`start`,className:`oc-agenttypes-pop`,children:[(0,Z.jsx)(`p`,{className:`oc-agenttypes-pop__title`,children:cn()}),(0,Z.jsx)(`p`,{className:`oc-agenttypes-pop__hint`,children:d()}),(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=M(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=M(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=M(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=M(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=M(F.agents.removeInstanceAgent),u=M(F.agents.setAgentReservation),d=N(F.groups.listGroupLabels,t?{}:`skip`),f=Cn(),p=W();async function m(t,n){if(e&&await f({title:Kt({name:n}),description:Nt(),confirmLabel:gt()}))try{await u({instanceName:e,agentId:t,groupId:null})}catch(e){p.error(s(),_n(e))}}async function h(t,n,r){if(!e)return;let i=(d??[]).find(e=>e._id===r)?.name??`?`;if(await f({title:D({name:n,group:i}),description:x({group:i}),confirmLabel:xe()}))try{await u({instanceName:e,agentId:t,groupId:r})}catch(e){p.error(s(),_n(e))}}async function g(t,n){if(e)try{await i({instanceName:e,agentId:t,enabled:n})}catch(e){p.error(s(),e)}}async function _(t){if(e)try{await a({instanceName:e,agentId:t})}catch(e){p.error(s(),e)}}async function v(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){p.error(s(),e)}}async function y(t,n){if(e&&await f({title:ut({name:n}),description:pt(),confirmLabel:At(),destructive:!0}))try{await l({instanceName:e,agentId:t}),p.success(Bt())}catch(e){p.error(s(),e)}}return(0,Z.jsx)(B,{open:t,onOpenChange:n,children:(0,Z.jsxs)(En,{className:`oc-access`,children:[(0,Z.jsxs)(V,{children:[(0,Z.jsx)(yn,{children:de({name:e??``})}),(0,Z.jsx)(bn,{children:xt()})]}),r===void 0?(0,Z.jsx)(`p`,{className:`oc-access__hint`,children:ot()}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`div`,{className:`oc-access__poll`,children:r.discovery===null?$e():r.discovery.lastPollOk?tn():Tt({error:r.discovery.error??`?`})}),r.agents.length===0?(0,Z.jsx)(`p`,{className:`oc-access__hint`,children:Ye()}):(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 g(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?We():Lt({group:t.reserved.groupName})}):null,n?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(H,{variant:`outline`,className:`oc-access__gone`,children:rt()}),(0,Z.jsx)(R,{size:`sm`,variant:`ghost`,className:`h-7 text-destructive`,onClick:()=>void y(t.agentId,a),children:Ue()})]}):i?(0,Z.jsx)(H,{variant:`default`,children:P()}):(0,Z.jsx)(R,{size:`sm`,variant:`outline`,className:`h-7`,disabled:!t.enabled||t.reserved!==null,onClick:()=>void _(t.agentId),children:on()})]}),t.reserved?(0,Z.jsxs)(`div`,{className:`oc-agentcard__head`,children:[(0,Z.jsx)(R,{size:`sm`,variant:`outline`,className:`h-7`,onClick:()=>void m(t.agentId,a),children:gt()}),(0,Z.jsxs)(K,{value:``,onValueChange:e=>void h(t.agentId,a,e),children:[(0,Z.jsx)(q,{size:`sm`,className:`h-7`,children:(0,Z.jsx)(U,{placeholder:Qt()})}),(0,Z.jsx)(J,{children:(d??[]).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 v(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){p.error(s(),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)(z,{className:`oc-agentcard__desc`,value:n,maxLength:280,placeholder:ge(),"aria-label":m(),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};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$m as r,AL as i,
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$m as r,AL as i,BL as a,DL as o,FL as s,IL as c,LL as l,ML as u,NL as d,OL as f,PL as p,Qm as m,RL as h,Xm as g,Zm as _,eh as v,fX as y,ih as b,jL as x,kL as S,nh as C,pX as w,rh as T,t as E,th as D,uX as O,zL as k}from"./api-BEXV-QDx.js";import{t as A}from"./button-BI4NYd7l.js";import{$t as j,Jt as M,Mt as N}from"./index-CND0zLpO.js";var P=t(e(),1),F=n();function I(){let e=w(E.integrations.status.status,{}),t=y(E.admin.setIntegrationConfig),[n,r]=(0,P.useState)(null);if((0,P.useEffect)(()=>{e&&n===null&&r(e.config)},[e,n]),!e||!n)return(0,F.jsx)(`p`,{className:`oc-admin__hint`,children:a()});let m=n,g=(e,t,n)=>r({...m,[e]:{...m[e],[t]:n}}),_=(e,n)=>void t({[e]:n});return(0,F.jsxs)(F.Fragment,{children:[(0,F.jsxs)(`p`,{className:`oc-admin__hint`,children:[k(),` `,(0,F.jsx)(`strong`,{children:h()}),` `,l()]}),(0,F.jsxs)(L,{title:`Langfuse`,status:e.langfuse.configured?e.langfuse.enabled?(0,F.jsx)(M,{variant:`secondary`,children:c()}):(0,F.jsx)(M,{variant:`outline`,children:s()}):(0,F.jsx)(M,{variant:`outline`,children:p()}),note:d(),children:[(0,F.jsx)(R,{label:x(),children:(0,F.jsx)(j,{value:m.langfuse.host??``,placeholder:e.langfuse.effectiveHost,onChange:e=>g(`langfuse`,`host`,e.target.value),onBlur:()=>_(`langfuse`,{host:m.langfuse.host??``})})}),(0,F.jsx)(z,{label:o(),checked:m.langfuse.enabled??!0,onChange:e=>{g(`langfuse`,`enabled`,e),_(`langfuse`,{enabled:e})}})]}),(0,F.jsxs)(L,{title:`Opik`,status:e.opik.configured?e.opik.enabled?(0,F.jsx)(M,{variant:`secondary`,children:c()}):(0,F.jsx)(M,{variant:`outline`,children:s()}):(0,F.jsx)(M,{variant:`outline`,children:p()}),note:u(),children:[(0,F.jsx)(R,{label:i(),children:(0,F.jsx)(j,{value:m.opik.baseUrl??``,placeholder:e.opik.effectiveBaseUrl,onChange:e=>g(`opik`,`baseUrl`,e.target.value),onBlur:()=>_(`opik`,{baseUrl:m.opik.baseUrl??``})})}),(0,F.jsx)(R,{label:S(),children:(0,F.jsx)(j,{value:m.opik.workspace??``,placeholder:e.opik.effectiveWorkspace||f(),onChange:e=>g(`opik`,`workspace`,e.target.value),onBlur:()=>_(`opik`,{workspace:m.opik.workspace??``})})}),(0,F.jsx)(z,{label:o(),checked:m.opik.enabled??!0,onChange:e=>{g(`opik`,`enabled`,e),_(`opik`,{enabled:e})}})]}),(0,F.jsxs)(L,{title:`OpenTelemetry (OTLP)`,status:e.otlp.configured?e.otlp.enabled?(0,F.jsx)(M,{variant:`secondary`,children:c()}):(0,F.jsx)(M,{variant:`outline`,children:s()}):(0,F.jsx)(M,{variant:`outline`,children:b()}),note:T(),children:[(0,F.jsx)(R,{label:C(),children:(0,F.jsx)(j,{value:m.otlp.endpoint??``,placeholder:e.otlp.effectiveEndpoint||`https://otlp.example.com/v1/traces`,onChange:e=>g(`otlp`,`endpoint`,e.target.value),onBlur:()=>_(`otlp`,{endpoint:m.otlp.endpoint??``})})}),(0,F.jsx)(B,{headersSet:e.otlp.headersSet}),(0,F.jsx)(z,{label:o(),checked:m.otlp.enabled??!0,onChange:e=>{g(`otlp`,`enabled`,e),_(`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=O(E.integrations.otlpSecret.setOtlpHeaders),n=y(E.integrations.otlpSecret.clearOtlpHeaders),[i,a]=(0,P.useState)(``),[o,s]=(0,P.useState)(null),[c,l]=(0,P.useState)(!1),u=async()=>{l(!0),s(null);try{await t({headersJson:i}),a(``)}catch(e){s(e instanceof Error?e.message:String(e))}finally{l(!1)}};return(0,F.jsxs)(R,{label:D(),children:[(0,F.jsx)(j,{value:i,placeholder:e?v():r(),onChange:e=>a(e.target.value)}),(0,F.jsxs)(`div`,{className:`oc-int__otlp-headers-actions`,children:[(0,F.jsx)(A,{size:`sm`,disabled:c||i.trim().length===0,onClick:()=>void u(),children:m()}),e?(0,F.jsx)(A,{variant:`ghost`,size:`sm`,disabled:c,onClick:()=>void n({}),children:_()}):null]}),o?(0,F.jsx)(`p`,{className:`oc-int__otlp-headers-error`,children:o}):null,(0,F.jsx)(`p`,{className:`oc-uipa__note`,children:g()})]})}export{I as IntegrationsTab};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$D as r,BR as i,GD as a,HD as o,HR as s,JD as c,KD as l,MR as u,NR as d,QD as f,UD as p,UR as m,VD as h,VR as g,WD as _,XD as v,YD as ee,ZD as te,eO as y,mz as b,pX as x,qD as ne,t as S,tO as C}from"./api-BEXV-QDx.js";import{dr as w,fr as T,ft as E,i as D,o as O,r as re}from"./index-CND0zLpO.js";import{a as k,n as A,o as j,r as M,t as N}from"./card-CUy80Snk.js";import{n as P,t as F}from"./TimeRangePicker-1vrUmBZJ.js";var I=t(e(),1),L={API_CALLS:`api.calls`,API_ERRORS:`api.errors`,API_LATENCY_AVG_MS:`api.latency.avg_ms`,OPENCLAW_INGEST:`openclaw.ingest`,CHAT_SEND:`chat.send`,ASSISTANT_STREAM_ERRORS:`assistant.stream.errors`,ASSISTANT_ANNOUNCE_ERRORS:`assistant.announce.errors`,CONVEX_PROBE_LATENCY_AVG_MS:`convex.probe.latency.avg_ms`},R=Object.keys(L).length,z=n(),B=15,V=e=>String(Math.round(e));function H(){let e=x(S.me.getMe,{host:E})?.permissions?.includes(`traces.read`)??!1,t=x(S.deliveryTiming.listDeliverySessions,e?{}:`skip`),n=(0,I.useMemo)(()=>t?t.filter(e=>!e.active&&e.rollup!==null&&e.rollup.cP50!==null&&e.rollup.aP50!==null).slice(0,B).reverse().map(e=>({startedAt:e.startedAt,cP50:e.rollup?.cP50,aP50:e.rollup?.aP50})):[],[t]);return t===void 0?null:(0,z.jsxs)(`section`,{className:`oc-kpi__group`,children:[(0,z.jsx)(`h2`,{className:`oc-kpi__group-title`,children:b()}),(0,z.jsxs)(N,{children:[(0,z.jsxs)(k,{children:[(0,z.jsx)(j,{children:m()}),(0,z.jsx)(M,{children:g()})]}),(0,z.jsx)(A,{children:n.length<2?(0,z.jsx)(`p`,{className:`oc-admin__hint`,children:i()}):(0,z.jsx)(U,{series:n})})]})]})}function U({series:e}){let t=e.map(e=>e.cP50),n=e.map(e=>e.aP50),r=Math.max(1,...t,...n),i=t=>6+t*468/(e.length-1),a=e=>74-e*68/r,o=e=>e.map((e,t)=>`${t===0?`M`:`L`}${i(t).toFixed(1)},${a(e).toFixed(1)}`).join(` `),c=e[e.length-1];return(0,z.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,z.jsxs)(`div`,{className:`flex gap-3 text-xs text-muted-foreground`,children:[(0,z.jsxs)(`span`,{style:{color:`var(--primary)`},children:[u(),` p50 `,V(c.cP50),` `,s()]}),(0,z.jsxs)(`span`,{children:[d(),` p50 `,V(c.aP50),` `,s()]})]}),(0,z.jsxs)(`svg`,{viewBox:`0 0 480 80`,className:`h-20 w-full`,preserveAspectRatio:`none`,role:`img`,"aria-label":m(),children:[(0,z.jsx)(`path`,{d:o(n),fill:`none`,style:{stroke:`var(--muted-foreground)`},strokeWidth:1.5}),(0,z.jsx)(`path`,{d:o(t),fill:`none`,style:{stroke:`var(--primary)`},strokeWidth:1.5})]})]})}var W=[{metric:`api.calls`,label:C(),unit:`/h`,group:`API`,isError:!1},{metric:`api.errors`,label:y(),unit:`/h`,group:`API`,isError:!0},{metric:`api.latency.avg_ms`,label:r(),unit:`ms`,group:`API`,isError:!1},{metric:`openclaw.ingest`,label:f(),unit:`/h`,group:`OpenClaw`,isError:!1},{metric:`chat.send`,label:te(),unit:`/h`,group:`Chat`,isError:!1},{metric:L.ASSISTANT_STREAM_ERRORS,label:v(),unit:`/h`,group:`Assistant`,isError:!0},{metric:L.ASSISTANT_ANNOUNCE_ERRORS,label:ee(),unit:`/h`,group:`Assistant`,isError:!0}],G=R,K=[`API`,`OpenClaw`,`Chat`,`Assistant`],q=1e3,J=36e5;function Y(e,t){let n=Math.max(1,Math.ceil((t-e)/J)),r=Math.min(n*G,q);return{rowLimit:r,buckets:Math.max(1,Math.floor(r/G))}}function ie(){let e=T({from:`/settings/kpi`}),t=w({from:`/settings/kpi`}),n=D(e.from,e.to,re,`now`),r=e=>void t({search:t=>({...t,...O(e)})}),{from:i,to:o}=P(n),{rowLimit:s,buckets:u}=Y(i,o),d=x(S.kpi.listKpis,{limit:s,filter:{from:i,to:o}}),f=(0,I.useMemo)(()=>{let e=new Map;for(let t of d??[]){let n=e.get(t.metric)??[];n.push({bucket:t.bucket,value:t.value}),e.set(t.metric,n)}for(let[t,n]of e)n.sort((e,t)=>e.bucket<t.bucket?-1:+(e.bucket>t.bucket)),n.length>u&&e.set(t,n.slice(n.length-u));return e},[d,u]),p=(0,z.jsxs)(z.Fragment,{children:[(0,z.jsxs)(`p`,{className:`oc-admin__hint`,children:[c(),` `,(0,z.jsx)(`span`,{className:`oc-filter__window`,children:ne()})]}),(0,z.jsx)(ae,{value:n,onChange:r})]});return d===void 0?(0,z.jsxs)(z.Fragment,{children:[p,(0,z.jsx)(H,{}),(0,z.jsx)(`p`,{className:`oc-admin__hint`,children:l()})]}):d.length===0?(0,z.jsxs)(z.Fragment,{children:[p,(0,z.jsx)(H,{}),(0,z.jsx)(`p`,{className:`oc-admin__hint`,children:a()})]}):(0,z.jsxs)(z.Fragment,{children:[p,(0,z.jsx)(H,{}),K.map(e=>{let t=W.filter(t=>t.group===e);return t.some(e=>(f.get(e.metric)??[]).length>0)?(0,z.jsxs)(`section`,{className:`oc-kpi__group`,children:[(0,z.jsx)(`h2`,{className:`oc-kpi__group-title`,children:e}),(0,z.jsx)(`div`,{className:`oc-kpi__grid`,children:t.map(e=>(0,z.jsx)(oe,{config:e,series:f.get(e.metric)??[]},e.metric))})]},e):null})]})}function ae({value:e,onChange:t}){return(0,z.jsx)(`div`,{className:`oc-kpi__toolbar`,children:(0,z.jsx)(F,{value:e,onChange:t})})}function oe({config:e,series:t}){let n=t.length>0?t[t.length-1]:null,r=n?n.value:0;return(0,z.jsxs)(N,{size:`sm`,className:`oc-kpi__card`,children:[(0,z.jsxs)(k,{children:[(0,z.jsx)(j,{className:`oc-kpi__card-title`,children:e.label}),(0,z.jsx)(M,{className:`oc-kpi__card-metric`,children:(0,z.jsx)(`code`,{children:e.metric})})]}),(0,z.jsxs)(A,{className:`oc-kpi__card-body`,children:[(0,z.jsxs)(`div`,{className:`oc-kpi__value-row`,children:[(0,z.jsx)(`span`,{className:`oc-kpi__value`+(e.isError&&r>0?` oc-kpi__value--error`:``),children:Q(r)}),(0,z.jsx)(`span`,{className:`oc-kpi__unit`,children:e.unit})]}),(0,z.jsx)(ce,{series:t,isError:e.isError,unit:e.unit}),(0,z.jsxs)(`div`,{className:`oc-kpi__axis`,children:[n?(0,z.jsx)(`span`,{className:`oc-kpi__axis-latest`,children:_({value:$(n.bucket)})}):(0,z.jsx)(`span`,{className:`oc-kpi__muted`,children:p()}),(0,z.jsx)(`span`,{className:`oc-kpi__muted`,children:o({count:t.length})})]})]})]})}var X=240,Z=48,se=1;function ce({series:e,isError:t,unit:n}){if(e.length===0)return(0,z.jsx)(`div`,{className:`oc-kpi__chart oc-kpi__chart--empty`,"aria-hidden":!0});let r=e.reduce((e,t)=>t.value>e?t.value:e,0),i=X/e.length,a=Math.max(i-se,1);return(0,z.jsx)(`svg`,{className:`oc-kpi__chart`,viewBox:`0 0 ${X} ${Z}`,preserveAspectRatio:`none`,role:`img`,"aria-label":h({max:Q(r),unit:n}),children:e.map((e,o)=>{let s=r>0?e.value/r*(Z-1):0,c=o*i,l=Z-s;return(0,z.jsx)(`rect`,{className:`oc-kpi__bar`+(t&&e.value>0?` oc-kpi__bar--error`:``),x:c,y:l,width:a,height:s,children:(0,z.jsxs)(`title`,{children:[$(e.bucket),` · `,Q(e.value),` `,n]})},e.bucket)})})}function Q(e){return Number.isFinite(e)?Math.abs(e)>=1e3?(e/1e3).toFixed(e%1e3==0?0:1)+`k`:String(e):`0`}function $(e){let t=new Date(`${e}:00:00Z`);return Number.isNaN(t.getTime())?e:`${String(t.getUTCDate()).padStart(2,`0`)}/${String(t.getUTCMonth()+1).padStart(2,`0`)} ${String(t.getUTCHours()).padStart(2,`0`)}h`}export{ie as KpiTab};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$W as r,$s as i,AW as a,AY as o,BW as s,BY as c,CW as l,DW as u,DY as ee,EW as d,EY as te,FW as f,FY as p,GW as m,GY as ne,HW as re,HY as ie,IW as ae,IY as oe,JW as se,JY as ce,KW as le,KY as ue,LW as de,LY as fe,MW as pe,MY as me,NW as he,NY as ge,OW as h,OY as _e,PW as g,PY as _,QW as v,QY as y,Qs as b,RW as x,RY as S,SW as C,TW as w,UW as T,UY as E,VW as D,VY as O,WW as k,WY as A,XW as j,YW as M,YY as N,ZW as P,Zs as F,_c as I,aG as ve,eG as ye,ec as be,fX as L,fc as xe,iG as Se,ic as Ce,jW as we,jY as Te,kF as Ee,kW as De,kY as Oe,nG as ke,nc as Ae,oG as je,pX as R,qW as Me,qY as Ne,r as z,rG as Pe,rX as Fe,rc as Ie,t as B,tG as Le,tc as Re,vc as ze,wW as Be,xW as Ve,zW as He,zY as Ue}from"./api-BEXV-QDx.js";import{t as V}from"./button-BI4NYd7l.js";import{$t as H,H as We,Jt as U,Mt as W,Qt as Ge,St as Ke,Xt as qe,Yt as Je,Zt as Ye,bt as G,ft as K,t as Xe,vt as Ze,xt as Qe,yt as $e}from"./index-CND0zLpO.js";import{t as et}from"./localePickerView-C2RmOS86.js";import{t as tt}from"./TimezoneCombobox-Bs8PmRcr.js";var q=t(e(),1),J=n();function nt({className:e,checked:t,onCheckedChange:n,disabled:r,...i}){return(0,J.jsx)(`button`,{type:`button`,role:`switch`,"aria-checked":t,"data-state":t?`checked`:`unchecked`,disabled:r,onClick:()=>n(!t),className:z(`peer inline-flex h-5 w-9 shrink-0 items-center rounded-full border border-transparent transition-colors outline-none`,`focus-visible:ring-2 focus-visible:ring-ring/50`,`disabled:cursor-not-allowed disabled:opacity-50`,t?`bg-primary`:`bg-input`,e),...i,children:(0,J.jsx)(`span`,{className:z(`pointer-events-none block size-4 rounded-full bg-background shadow transition-transform`,t?`translate-x-[18px]`:`translate-x-[2px]`)})})}var Y=[{id:`messages`,label:()=>je()},{id:`composer`,label:()=>ve()},{id:`sidebar`,label:()=>Se()},{id:`notifications`,label:()=>D()},{id:`other`,label:()=>Pe()}],X={showSource:{category:`messages`,label:()=>ke(),help:()=>Le()},showReport:{category:`messages`,label:()=>ye(),help:()=>r()},copyAssistant:{category:`messages`,label:()=>v()},copyUser:{category:`messages`,label:()=>P()},showDelete:{category:`messages`,label:()=>j()},showTools:{category:`messages`,label:()=>M(),help:()=>se()},voiceInput:{category:`composer`,label:()=>Me(),help:()=>le()},showUsage:{category:`composer`,label:()=>m(),help:()=>k()},autoReadAloud:{category:`composer`,label:()=>ze(),help:()=>I()},showChatAge:{category:`sidebar`,label:()=>T(),help:()=>re()},notifSound:{category:`notifications`,label:()=>s(),help:()=>He()},notifSystem:{category:`notifications`,label:()=>x(),help:()=>de()},replySound:{category:`notifications`,label:()=>ae(),help:()=>f()}};function Z(e){return e.toLowerCase().normalize(`NFD`).replace(/\p{Diacritic}/gu,``)}function Q(e,t){let n=Z(t.trim()),r=new Map(Y.map(e=>[e.id,e.label()])),i=new Map(Y.map(e=>[e.id,[]]));for(let t of e){let e=X[t],a=e?.category??`other`;n&&!Z(`${e?e.label():t} ${e?.help?e.help():``} ${t} ${r.get(a)??``}`).includes(n)||i.get(a).push(t)}return Y.map(e=>({id:e.id,label:r.get(e.id),keys:i.get(e.id)})).filter(e=>e.keys.length>0)}var rt=[`showSource`,`showReport`,`copyAssistant`,`copyUser`,`showDelete`,`showTools`,`voiceInput`,`showChatAge`,`showUsage`,`autoReadAloud`,`notifSound`,`notifSystem`,`replySound`],it={voiceInput:`voiceInput`};function at(e){return rt.includes(e)}function $(e){return e===`admin`}function ot(e){return e===!0?`on`:e===!1?`off`:`inherit`}function st(e){return e===`on`?!0:e===`off`?!1:null}function ct(e){return at(e)?it[e]:void 0}var lt={voiceInput:()=>w()};function ut({prefKey:e,ui:t}){let n=L(B.admin.setUiPrefDefault),r=L(B.admin.setFeatureEnabled),i=ct(e),a=i?lt[e]?.():void 0;return(0,J.jsxs)(`div`,{className:`oc-prefs__gov`,children:[(0,J.jsxs)(`div`,{className:`oc-prefs__gov-row`,children:[(0,J.jsx)(`span`,{className:`oc-prefs__gov-label`,children:De()}),(0,J.jsxs)(Ze,{value:ot(t.defaults[e]),onValueChange:t=>void n({key:e,value:st(t)}),children:[(0,J.jsx)(Qe,{size:`sm`,className:`w-36`,children:(0,J.jsx)(Ke,{})}),(0,J.jsxs)($e,{children:[(0,J.jsx)(G,{value:`on`,children:l()}),(0,J.jsx)(G,{value:`off`,children:C()}),(0,J.jsx)(G,{value:`inherit`,children:Ve()})]})]}),i?(0,J.jsxs)(`span`,{className:`oc-prefs__gov-gate`,children:[(0,J.jsx)(W,{checked:t.featuresEnabled[i]===!0,onCheckedChange:e=>void r({key:i,enabled:e===!0}),"aria-label":h()}),h()]}):null]}),a?(0,J.jsx)(`span`,{className:`oc-prefs__gov-help`,children:a}):null]})}function dt({current:e,enabled:t}){let n=L(B.me.setDictationShortcut),[r,a]=(0,q.useState)(!1),[o,s]=(0,q.useState)(!1);return(0,q.useEffect)(()=>{if(!r)return;let e=e=>{if(e.preventDefault(),e.stopPropagation(),e.key===`Escape`){a(!1);return}let t=Ye(e);if(t===null){[`Shift`,`Control`,`Meta`,`Alt`].includes(e.key)||(s(!0),window.setTimeout(()=>s(!1),1800));return}a(!1),n({shortcut:t})};return window.addEventListener(`keydown`,e,!0),()=>window.removeEventListener(`keydown`,e,!0)},[r,n]),(0,J.jsxs)(`div`,{className:`oc-prefs__row${t?``:` is-locked`}`,children:[(0,J.jsxs)(`div`,{className:`oc-prefs__info`,children:[(0,J.jsxs)(`span`,{className:`oc-prefs__label`,children:[Ce(),e?(0,J.jsx)(U,{variant:`secondary`,children:Ge(e,qe())}):null]}),(0,J.jsx)(`span`,{className:`oc-prefs__help`,children:o?Re():r?Ae():Ie()})]}),(0,J.jsxs)(`div`,{className:`oc-prefs__ctl`,children:[e&&!r?(0,J.jsx)(`button`,{type:`button`,className:`oc-prefs__reset`,onClick:()=>void n({shortcut:null}),children:F()}):null,(0,J.jsx)(`button`,{type:`button`,className:`oc-prefs__reset`,disabled:!t,"aria-pressed":r,onClick:()=>a(e=>!e),children:r?b():e?i():be()})]})]})}function ft(){let[e,t]=(0,q.useState)(``),[n,r]=(0,q.useState)(!1),i=R(B.me.getMe,{host:K}),o=i?.ui,s=$(i?.role)&&n,c=L(B.me.setUiPref).withOptimisticUpdate(We),l=(0,q.useMemo)(()=>o?Q(Object.keys(o.effective),e):[],[o,e]);return o?(0,J.jsxs)(`div`,{className:`oc-prefs-panel`,children:[$(i?.role)?(0,J.jsxs)(`label`,{className:`oc-prefs__gov-toggle`,children:[(0,J.jsx)(W,{checked:n,onCheckedChange:e=>r(e===!0),"aria-label":a()}),a()]}):null,s?(0,J.jsxs)(`div`,{className:`oc-prefs__gov-head`,children:[(0,J.jsx)(`p`,{children:u()}),(0,J.jsx)(`p`,{children:d()}),(0,J.jsx)(`p`,{children:Be()})]}):null,(0,J.jsx)(H,{value:e,onChange:e=>t(e.target.value),placeholder:g(),"aria-label":g(),className:`mb-2`}),l.length===0?(0,J.jsx)(`div`,{className:`oc-prefs__empty`,children:he()}):(0,J.jsx)(`div`,{className:`oc-prefs`,children:l.map(e=>(0,J.jsxs)(`section`,{className:`oc-prefs__card`,children:[(0,J.jsx)(`h4`,{className:`oc-prefs__cat`,children:e.label}),e.keys.map(e=>{let t=X[e],n=t?t.label():e,r=t?.help?.(),i=o.locked[e],a=o.effective[e],l=o.userOverrides[e]!==void 0;return(0,J.jsxs)(`div`,{className:`oc-prefs__row${i?` is-locked`:``}`,children:[(0,J.jsxs)(`div`,{className:`oc-prefs__info`,children:[(0,J.jsxs)(`span`,{className:`oc-prefs__label`,children:[n,i?(0,J.jsx)(U,{variant:`outline`,children:pe()}):l?(0,J.jsx)(U,{variant:`secondary`,children:xe()}):null]}),r?(0,J.jsx)(`span`,{className:`oc-prefs__help`,children:r}):null]}),(0,J.jsxs)(`div`,{className:`oc-prefs__ctl`,children:[!i&&l?(0,J.jsx)(`button`,{type:`button`,className:`oc-prefs__reset`,onClick:()=>void c({key:e,value:null}),children:we()}):null,(0,J.jsx)(nt,{checked:a,disabled:i,onCheckedChange:t=>{e===`notifSystem`&&t&&typeof Notification<`u`&&Notification.permission==="default"&&Notification.requestPermission(),c({key:e,value:t})},"aria-label":n})]}),s?(0,J.jsx)(ut,{prefKey:e,ui:o}):null]},e)})]},e.id))}),(0,J.jsx)(dt,{current:i?.dictationShortcut??null,enabled:o.effective.voiceInput===!0})]}):(0,J.jsx)(`div`,{className:`oc-prefs__empty`,children:Fe()})}var pt={sm:()=>fe(),md:()=>oe(),lg:()=>p(),xl:()=>_(),"2xl":()=>ge(),"3xl":()=>me()};function mt(){let e=R(B.me.getMe,{host:K}),t=L(B.me.setLocale),n=L(B.me.setTimezone),r=L(B.me.setFontScale).withOptimisticUpdate((e,{scale:t})=>{let n=e.getQuery(B.me.getMe,{host:K});n&&e.setQuery(B.me.getMe,{host:K},{...n,fontScale:t,resolvedFontScale:t??`md`})}),i=L(B.me.setMyName),a=Je(),s=e?.locale??`default`,l=e?.name??``,[u,d]=(0,q.useState)(null),f=u??l,p=f.trim()!==l.trim();async function m(){try{await i({name:f}),d(null),a.success(ne())}catch(e){a.error(A(),e)}}return(0,J.jsxs)(`div`,{className:`oc-appearance`,children:[(0,J.jsxs)(`section`,{className:`oc-show__section`,children:[(0,J.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,J.jsx)(`h2`,{className:`oc-show__title`,children:N()}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:ce()})]}),(0,J.jsxs)(`div`,{className:`oc-show__row`,children:[(0,J.jsx)(H,{className:`max-w-xs`,value:f,maxLength:120,placeholder:Ne(),onChange:e=>d(e.target.value),onKeyDown:e=>{e.key===`Enter`&&p&&(e.preventDefault(),m())}}),(0,J.jsx)(V,{size:`sm`,disabled:!p,onClick:()=>void m(),children:Ee()})]}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:ue()})]}),(0,J.jsxs)(`section`,{className:`oc-show__section`,children:[(0,J.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,J.jsx)(`h2`,{className:`oc-show__title`,children:E()}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:ie()})]}),(0,J.jsxs)(`div`,{className:`oc-show__row`,children:[et().map(e=>(0,J.jsx)(V,{variant:s===e.value?`default`:`outline`,size:`sm`,onClick:()=>void t({locale:e.value}),children:e.label},e.value)),(0,J.jsx)(V,{variant:s==="default"?`default`:`outline`,size:`sm`,onClick:()=>void t({locale:null}),children:y()})]}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:O()})]}),(0,J.jsxs)(`section`,{className:`oc-show__section`,children:[(0,J.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,J.jsx)(`h2`,{className:`oc-show__title`,children:Te()}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:o()})]}),(0,J.jsxs)(`div`,{className:`oc-show__row`,children:[(0,J.jsx)(tt,{value:e?.timezone??``,onChange:e=>void n({timezone:e})}),(0,J.jsx)(V,{variant:e?.timezone===null||e?.timezone===void 0?`default`:`outline`,size:`sm`,onClick:()=>void n({timezone:null}),children:Oe()})]}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:_e()})]}),(0,J.jsxs)(`section`,{className:`oc-show__section`,children:[(0,J.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,J.jsx)(`h2`,{className:`oc-show__title`,children:c()}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:Ue()})]}),(0,J.jsx)(`div`,{className:`oc-show__row`,children:Xe.map(t=>(0,J.jsx)(V,{variant:(e?.fontScale??`md`)===t?`default`:`outline`,size:`sm`,onClick:()=>void r({scale:t}),children:pt[t]()},t))}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:S()})]}),(0,J.jsxs)(`section`,{className:`oc-show__section`,children:[(0,J.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,J.jsx)(`h2`,{className:`oc-show__title`,children:ee()}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:te()})]}),(0,J.jsx)(ft,{})]})]})}export{mt as PreferencesTab};
|