@lacneu/atrium 0.98.1 → 0.100.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-xEptIbOW.js +1 -0
- package/dist/assets/{AdvancedFilter-DuAvb6_v.js → AdvancedFilter-bgzdOb0t.js} +1 -1
- package/dist/assets/AgentFilesTab-DaQy7pSK.js +3 -0
- package/dist/assets/AnomaliesTab-kh1sKpdf.js +1 -0
- package/dist/assets/AuditTab-D5e84pvG.js +1 -0
- package/dist/assets/BridgeTab-DFyIKDyv.js +1 -0
- package/dist/assets/ChatDefaultsTab-boUvWCTK.js +1 -0
- package/dist/assets/{DataTableShell-CZIWIEsI.js → DataTableShell-CeVf9eD_.js} +1 -1
- package/dist/assets/DeletedChatsTab-CPJHm-dY.js +1 -0
- package/dist/assets/{DetailChips-Bv8rGcLM.js → DetailChips-tXOC1zN0.js} +1 -1
- package/dist/assets/FeedbacksTab-BmIkSmB4.js +1 -0
- package/dist/assets/{FieldLabel-BO1-yXaX.js → FieldLabel-BBpaaMpJ.js} +1 -1
- package/dist/assets/FilesTab-D12g4ly7.js +1 -0
- package/dist/assets/{FilterBar-D1f8IVOZ.js → FilterBar-CdYSlKIB.js} +1 -1
- package/dist/assets/GroupsTab-dKfpCkYX.js +1 -0
- package/dist/assets/InstancesTab-Bx1bHqXx.js +1 -0
- package/dist/assets/IntegrationsTab-BGtmJfZJ.js +1 -0
- package/dist/assets/KpiTab-C6h_0kgd.js +1 -0
- package/dist/assets/PreferencesTab-DMX9Hooo.js +1 -0
- package/dist/assets/ProjectPage-Q1yeQWDA.js +1 -0
- package/dist/assets/PromptInjectionsTab-x69hhi90.js +4 -0
- package/dist/assets/RolesTab-B3Znx3m2.js +1 -0
- package/dist/assets/ScheduledTab-CdV-14gv.js +1 -0
- package/dist/assets/ServiceAccountsTab-DUy0hvoO.js +1 -0
- package/dist/assets/SubAgentReportsTab-CEswYxX3.js +1 -0
- package/dist/assets/ThemeShowroom-CBhqWNEv.js +1 -0
- package/dist/assets/{TimeRangePicker-BMeAmmsC.js → TimeRangePicker-CMNe-waP.js} +1 -1
- package/dist/assets/{TimezoneCombobox-JvLcqMC7.js → TimezoneCombobox-BR5ScfJS.js} +1 -1
- package/dist/assets/TracesTab-By3aJj5o.js +1 -0
- package/dist/assets/{TrashTab-C34S9sxA.js → TrashTab-CUNsA_at.js} +1 -1
- package/dist/assets/UsersTab-DqJ1H1in.js +1 -0
- package/dist/assets/VoiceTab-Dj72iKiP.js +1 -0
- package/dist/assets/{api-BEXV-QDx.js → api-uQUQB4xy.js} +5 -5
- package/dist/assets/{button-BI4NYd7l.js → button-Biq40Zpc.js} +1 -1
- package/dist/assets/{card-CUy80Snk.js → card-AFUQEzoT.js} +1 -1
- package/dist/assets/chevrons-up-down-HreDTesh.js +1 -0
- package/dist/assets/{compatView-C6vyLpqy.js → compatView-Di1KVtbg.js} +1 -1
- package/dist/assets/dispatchErrorInfo-DaVpBFg-.js +1 -0
- package/dist/assets/{dist-ibS6mHJS.js → dist-BV5tiwQ7.js} +1 -1
- package/dist/assets/{dist-Yi0k4JhM.js → dist-Bta1CYcq.js} +1 -1
- package/dist/assets/{dist-xED7lptS.js → dist-CwmWIp2d.js} +1 -1
- package/dist/assets/{dist-BgUgjwlI.js → dist-trlbpTaE.js} +1 -1
- package/dist/assets/{highlighted-body-OFNGDK62-DaG1VFZL.js → highlighted-body-OFNGDK62-BA-hTZck.js} +1 -1
- package/dist/assets/index-Bw4ypNNp.js +448 -0
- package/dist/assets/{list-CMpIlPcq.js → list-C1mXgOwS.js} +1 -1
- package/dist/assets/mermaid-GHXKKRXX-D0Y-yjBm.js +1 -0
- package/dist/assets/{pdf-D3L6KL-o.js → pdf-Uq7gSb2p.js} +1 -1
- package/dist/assets/roleDescriptions-CbaJtUsv.js +1 -0
- package/dist/assets/{table-CvUcBPgp.js → table-DH8u2aW2.js} +1 -1
- package/dist/assets/{trashPage-B36nmIyS.js → trashPage-BIm71gVQ.js} +1 -1
- package/dist/assets/{use_paginated_query-CWrNoLih.js → use_paginated_query-Ce4kc6WY.js} +1 -1
- package/dist/assets/x-CfpsHFMp.js +1 -0
- package/dist/index.html +8 -8
- package/package.json +1 -1
- package/dist/assets/AccessTab-Bsu_pBw1.js +0 -1
- package/dist/assets/AgentFilesTab-CajvKiFH.js +0 -3
- package/dist/assets/AnomaliesTab-DQLh8Yyx.js +0 -1
- package/dist/assets/AuditTab-PwLy5ZSV.js +0 -1
- package/dist/assets/BridgeTab-60WDe9Oh.js +0 -1
- package/dist/assets/ChatDefaultsTab-DhtiaDDk.js +0 -1
- package/dist/assets/DeletedChatsTab-bjOae5ku.js +0 -1
- package/dist/assets/FeedbacksTab-BqOxEjoz.js +0 -1
- package/dist/assets/FilesTab-CTieLSvW.js +0 -1
- package/dist/assets/GroupsTab-CJdGd3CX.js +0 -1
- package/dist/assets/InstancesTab-DSvIWt7d.js +0 -1
- package/dist/assets/IntegrationsTab-DGyO4LdP.js +0 -1
- package/dist/assets/KpiTab-DKy1FYxU.js +0 -1
- package/dist/assets/PreferencesTab-BtQQuvK8.js +0 -1
- package/dist/assets/ProjectPage-V-mFGtPc.js +0 -1
- package/dist/assets/PromptInjectionsTab-M0j0v8Zw.js +0 -4
- package/dist/assets/RolesTab-BEy1GjmZ.js +0 -1
- package/dist/assets/ScheduledTab-nN388CYz.js +0 -1
- package/dist/assets/ServiceAccountsTab-C4duhDDt.js +0 -1
- package/dist/assets/SubAgentReportsTab-Cq86t53b.js +0 -1
- package/dist/assets/ThemeShowroom-BiL-NcBn.js +0 -1
- package/dist/assets/TracesTab-DAR8-pmx.js +0 -1
- package/dist/assets/UsersTab-Mu9Duc2n.js +0 -1
- package/dist/assets/VoiceTab-3yLkRehJ.js +0 -1
- package/dist/assets/chevrons-up-down-BBnIDUVh.js +0 -1
- package/dist/assets/dispatchErrorInfo-U1f-h1hb.js +0 -1
- package/dist/assets/index-DQx8LX7A.js +0 -448
- package/dist/assets/mermaid-GHXKKRXX-DWPlOIbJ.js +0 -1
- package/dist/assets/roleDescriptions-BUL4ira1.js +0 -1
- package/dist/assets/x-ijoBrBAS.js +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{ax as r,cx as i,dx as a,ex as o,fx as s,gX as c,ix as l,lx as u,mx as d,nx as f,oX as p,ox as m,px as h,rx as g,sx as _,t as v,tx as y,ux as b}from"./api-uQUQB4xy.js";import{Jt as x,St as S,bt as C,vt as w,xt as T,yt as E}from"./index-Bw4ypNNp.js";var D=t(e(),1);function O(e){return e===`user`?l():e===`all`?g():f({group:e.group})}function k(e){return e===`common`?y():e===`owner`?o():f({group:e.group})}var A=n();function j(e){return e.name||e.email||e.userId.slice(0,8)}function M(){let e=c(v.admin.listUsers,{}),[t,n]=(0,D.useState)(``),o=c(v.introspect.introspectUser,t?{userId:t}:`skip`);return(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:d()}),(0,A.jsxs)(w,{value:t,onValueChange:n,children:[(0,A.jsx)(T,{size:`sm`,"aria-label":h(),children:(0,A.jsx)(S,{placeholder:h()})}),(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:s()}):o===void 0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:p()}):(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:a()}),(0,A.jsxs)(`div`,{className:`oc-introspect__id`,children:[(0,A.jsx)(`strong`,{children:o.user.label}),(0,A.jsx)(x,{variant:`secondary`,children:o.role})]})]}),(0,A.jsxs)(`section`,{className:`oc-introspect__section`,children:[(0,A.jsx)(`h3`,{className:`oc-introspect__title`,children:b()}),o.groups.length===0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:m()}):(0,A.jsx)(`div`,{className:`oc-introspect__chips`,children:o.groups.map(e=>(0,A.jsx)(x,{variant:`secondary`,children:e.name},e.groupId))})]}),(0,A.jsxs)(`section`,{className:`oc-introspect__section`,children:[(0,A.jsx)(`h3`,{className:`oc-introspect__title`,children:u()}),o.agents.length===0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:m()}):(0,A.jsx)(`ul`,{className:`oc-introspect__list`,children:o.agents.map(e=>(0,A.jsxs)(`li`,{className:`oc-introspect__row`,children:[(0,A.jsx)(`span`,{className:`oc-introspect__name`,children:e.displayName||e.agentId}),e.isDefault?(0,A.jsx)(x,{variant:`default`,children:r()}):null,(0,A.jsx)(x,{variant:`outline`,children:O(e.via)}),(0,A.jsx)(x,{variant:`secondary`,children:e.state})]},`${e.instanceName} ${e.agentId}`))})]}),(0,A.jsxs)(`section`,{className:`oc-introspect__section`,children:[(0,A.jsx)(`h3`,{className:`oc-introspect__title`,children:i()}),o.charts.length===0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:m()}):(0,A.jsx)(`ul`,{className:`oc-introspect__list`,children:o.charts.map(e=>(0,A.jsxs)(`li`,{className:`oc-introspect__row`,children:[(0,A.jsx)(`span`,{className:`oc-introspect__name`,children:e.name}),(0,A.jsx)(x,{variant:`outline`,children:k(e.via)})]},e.key))})]}),(0,A.jsxs)(`section`,{className:`oc-introspect__section`,children:[(0,A.jsx)(`h3`,{className:`oc-introspect__title`,children:_()}),o.permissions.length===0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:m()}):(0,A.jsx)(`div`,{className:`oc-introspect__chips`,children:o.permissions.map(e=>(0,A.jsx)(x,{variant:`secondary`,children:e},e))})]})]})]})}export{M as AccessTab};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{FC as r,IC as i,LC as a,NC as o,PC as s,RC as c,zC as l}from"./api-uQUQB4xy.js";import{r as u}from"./dist-BV5tiwQ7.js";import{t as d}from"./x-CfpsHFMp.js";import{t as f}from"./button-Biq40Zpc.js";import{$t as p,Ln as m,St as h,bt as g,vt as _,xt as v,yt as y}from"./index-Bw4ypNNp.js";import{r as b}from"./TimeRangePicker-CMNe-waP.js";var x=t(e(),1),S=n(),C=[{value:`eq`,label:`=`},{value:`neq`,label:`≠`},{value:`contains`,label:l()},{value:`gt`,label:`>`},{value:`gte`,label:`≥`},{value:`lt`,label:`<`},{value:`lte`,label:`≤`}],w=1;function T(){return{id:w++,field:``,op:`eq`,value:``}}function E(e){return e.map(e=>({id:w++,field:e.field,op:e.op,value:String(e.value)}))}function D({fields:e,seed:t,onChange:n}){let l=(0,x.useRef)(t),w=!!(l.current&&l.current.length>0),[D,O]=(0,x.useState)(w),[k,A]=(0,x.useState)(()=>w?E(l.current):[]);function j(e){n(e.filter(e=>e.field!==``&&e.value!==``).map(e=>({field:e.field,op:e.op,value:b(e.value)})))}function M(e,t){let n=k.map(n=>n.id===e?{...n,...t}:n);A(n),j(n)}function N(){A(e=>[...e,T()])}function P(e){let t=k.filter(t=>t.id!==e);A(t),j(t)}let F=k.filter(e=>e.field!==``&&e.value!==``).length;return(0,S.jsxs)(`div`,{className:`oc-advfilter`,children:[(0,S.jsxs)(`button`,{type:`button`,className:`oc-advfilter__toggle`,"aria-expanded":D,onClick:()=>O(e=>!e),children:[(0,S.jsx)(u,{className:`oc-advfilter__chevron`+(D?` is-open`:``),"aria-hidden":!0}),c(),F>0?(0,S.jsx)(`span`,{className:`oc-advfilter__count`,children:F}):null]}),D?(0,S.jsxs)(`div`,{className:`oc-advfilter__body`,children:[k.length===0?(0,S.jsx)(`p`,{className:`oc-admin__hint`,children:a()}):(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:i()})}),(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:r()}),(0,S.jsx)(f,{variant:`ghost`,size:`icon-sm`,"aria-label":s(),onClick:()=>P(t.id),children:(0,S.jsx)(d,{})})]},t.id))}),(0,S.jsxs)(f,{variant:`outline`,size:`sm`,className:`oc-advfilter__add`,onClick:N,children:[(0,S.jsx)(m,{}),o()]})]}):null]})}export{D as t};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{A_ as r,C_ as i,Cv as a,D_ as o,E_ as s,F_ as c,Fd as l,I_ as ee,Id as u,L_ as d,Ld as f,M_ as p,Md as m,N_ as h,Nd as g,O_ as _,P_ as v,Pd as y,R_ as b,Rd as x,S_ as S,T_ as C,Tv as w,_V as T,__ as E,_f as te,af as D,b_ as O,bf as k,cX as ne,cf as A,d_ as j,df as M,ef as N,f_ as re,ff as P,gX as F,g_ as ie,gf as I,hX as L,h_ as R,hf as z,if as B,j_ as ae,k_ as oe,lf as V,m_ as se,mf as ce,nf as H,oX as U,of as W,pX as G,p_ as le,pf as ue,rf as de,sf as fe,t as K,tf as pe,u_ as me,uf as he,us as ge,v_ as _e,vf as ve,w_ as ye,x_ as be,y_ as xe,yf as Se,z_ as Ce}from"./api-uQUQB4xy.js";import{t as q}from"./button-Biq40Zpc.js";import{Bt as we,Ct as Te,Dt as Ee,Gt as De,Ht as Oe,Jt as ke,Kt as Ae,Ot as je,St as Me,Tt as Ne,Ut as Pe,Vt as Fe,Wt as Ie,Yt as J,bt as Le,ft as Re,kn as Y,nt as ze,qt as Be,vt as Ve,wt as He,xt as Ue,yt as We}from"./index-Bw4ypNNp.js";import{n as Ge,t as Ke}from"./curation-CQksaIbm.js";import{a as qe}from"./compatView-Di1KVtbg.js";/* empty css */var X=t(e(),1),Je=2e4,Ye=6e4;function Xe(e){return typeof e!=`number`||e<=0?0:Math.round(e/Je*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=F(K.me.getMe,{host:Re}),t=e?.role===`admin`,n=(e?.permissions??[]).includes(`bridge.read`),i=F(K.admin.listInstances,e!==void 0&&t?{}:`skip`),[s,l]=(0,X.useState)(null);(0,X.useEffect)(()=>{!t||!i||i.length===0||(!s||!i.some(e=>e.name===s))&&l(i[0].name)},[t,i,s]);let u=F(K.agents.listAgentsForInstance,t&&s?{instanceName:s}:`skip`),f=F(K.agents.listMyAgents,e!==void 0&&!t?{}:`skip`),m=(0,X.useMemo)(()=>{if(e!==void 0){if(t)return s===null||u===void 0?i!==void 0&&i.length===0?[]:void 0:u.agents.map(e=>({instanceName:s,agentId:e.agentId,label:`${e.emoji?`${e.emoji} `:``}${e.displayName??e.agentId}`}));if(f!==void 0)return f.map(e=>({instanceName:e.instanceName,agentId:e.agentId,label:`${e.emoji?`${e.emoji} `:``}${e.displayName??e.agentId}`}))}},[e,t,s,u,i,f]),[g,y]=(0,X.useState)(null);(0,X.useEffect)(()=>{!m||m.length===0||(!g||!m.some(e=>$(e)===g))&&y($(m[0]))},[m,g]);let x=m?.find(e=>$(e)===g)??null,S=G(K.agentFiles.listAgentFiles),[C,w]=(0,X.useState)({status:`idle`}),T=x?.instanceName??null,E=x?.agentId??null,D=F(K.compat.forInstance,n&&T!==null?{instanceName:T}:`skip`),O=n&&T!==null?ze(D,`agentFiles`):null,k=O===null?!1:O===`loading`?null:O.blocked,A=(0,X.useCallback)(async()=>{if(!(T===null||E===null)){w({status:`loading`});try{w({status:`done`,files:(await S({instanceName:T,agentId:E})).files})}catch(e){w({status:`error`,dashboardAbsent:tt(e)})}}},[S,T,E]);(0,X.useEffect)(()=>{k===!1&&A()},[A,k]);let[j,M]=(0,X.useState)(null),N=F(K.agentFileCuration.listCurations,t&&T!==null&&E!==null?{instanceName:T,agentId:E}:`skip`),re=F(K.agentFileCuration.curationSettings,t&&T!==null?{instanceName:T}:`skip`),P=G(K.agentFileCuration.requestCuration),[ie,L]=(0,X.useState)(null),[R,B]=(0,X.useState)(null),{toast:V}=J(),se=(0,X.useMemo)(()=>{let e=new Map;for(let t of N??[])e.has(t.name)||e.set(t.name,t);return e},[N]),ce=(0,X.useCallback)(async e=>{if(!(T===null||E===null)){L(e);try{let t=await P({instanceName:T,agentId:E,name:e,trigger:`manual`});t.ok?V({title:te(),variant:`success`}):V({title:I({reason:t.reason??`unknown`}),variant:`error`})}catch{V({title:z(),variant:`error`})}finally{L(null)}}},[P,T,E,V]),H=ne(),W=(0,X.useMemo)(()=>new Intl.NumberFormat(H,{maximumFractionDigits:0}),[H]);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:Ce()}),(0,Q.jsxs)(`div`,{className:`oc-afiles__picker`,children:[t&&(i?.length??0)>1?(0,Q.jsxs)(Ve,{value:s??``,onValueChange:e=>l(e),children:[(0,Q.jsx)(Ue,{size:`sm`,"aria-label":b(),children:(0,Q.jsx)(Me,{})}),(0,Q.jsx)(We,{children:(i??[]).map(e=>(0,Q.jsx)(Le,{value:e.name,children:e.name},e.name))})]}):null,m.length>0?(0,Q.jsxs)(Ve,{value:g??``,onValueChange:e=>y(e),children:[(0,Q.jsx)(Ue,{size:`sm`,"aria-label":d(),children:(0,Q.jsx)(Me,{})}),(0,Q.jsx)(We,{children:m.map(e=>(0,Q.jsx)(Le,{value:$(e),children:e.label},$(e)))})]}):(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:ee()})]}),x===null?null:O===`loading`?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:U()}):O!==null&&O.blocked?(0,Q.jsxs)(`p`,{className:`oc-compat__blocked`,role:`status`,children:[(0,Q.jsx)(Y,{size:14,"aria-hidden":!0}),` `,qe(O.gatewayVersion,O.provider)]}):C.status===`loading`||C.status===`idle`?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:U()}):C.status===`error`?(0,Q.jsxs)(`p`,{className:`oc-afiles__error`,role:`alert`,children:[C.dashboardAbsent?ge():v(),` `,!C.dashboardAbsent&&(0,Q.jsx)(q,{variant:`outline`,size:`sm`,onClick:()=>void A(),children:a()})]}):C.files.length===0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:c()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`div`,{className:`oc-afiles__list`,children:C.files.map(e=>{let n=Xe(e.size),i=n>=80;return(0,Q.jsxs)(`div`,{className:`oc-afiles__row`,children:[(0,Q.jsx)(`span`,{className:`oc-afiles__name`,title:e.name,children:e.name}),e.missing?(0,Q.jsx)(ke,{variant:`outline`,children:h()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`span`,{className:`oc-afiles__size`,children:p({size:Z(e.size,H)})}),(0,Q.jsx)(`span`,{className:`oc-afiles__gauge${i?` is-warn`:``}`,"aria-hidden":!0,children:(0,Q.jsx)(`span`,{className:`oc-afiles__gauge-fill`,style:{width:`${Math.min(n,100)}%`}})}),(0,Q.jsx)(`span`,{className:`oc-afiles__pct`,children:ae({pct:W.format(n)})}),i?(0,Q.jsx)(Y,{size:14,className:`oc-afiles__warn`,"aria-label":r()}):(0,Q.jsx)(`span`,{className:`oc-afiles__warn-slot`,"aria-hidden":!0})]}),(0,Q.jsx)(q,{variant:`outline`,size:`sm`,className:`oc-afiles__open`,onClick:()=>M(e),children:t?_():o()}),t&&!e.missing?(0,Q.jsx)(it,{curatable:Ke.includes(e.name),size:e.size??0,budget:re?.budgetChars??null,enabled:re?.enabled??!1,curation:se.get(e.name)??null,inFlight:ie===e.name,onCurate:()=>void ce(e.name),onReview:e=>B(e)}):null]},e.name)})}),(0,Q.jsx)(`p`,{className:`oc-afiles__budget`,children:oe({used:Z(Qe(C.files),H),total:Z(Ye,H),pct:W.format(Ze(Qe(C.files)))})})]}),j&&x?(0,Q.jsx)(at,{instanceName:x.instanceName,agentId:x.agentId,name:j.name,isAdmin:t,onClose:()=>M(null),onSaved:()=>void A()}):null,R?(0,Q.jsx)(ot,{curationId:R,onClose:()=>B(null),onApplied:()=>{B(null),A()}}):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)(q,{variant:`default`,size:`sm`,className:`oc-afiles__curate`,onClick:()=>s(i._id),children:Se()}):a||i?.status===`dispatched`||i?.status===`applying`?(0,Q.jsx)(ke,{variant:`outline`,className:`oc-afiles__curate-status`,children:ve()}):e&&r&&n!==null&&Ge(t,n)?(0,Q.jsx)(q,{variant:`outline`,size:`sm`,className:`oc-afiles__curate`,onClick:o,children:k()}):null}function at({instanceName:e,agentId:t,name:n,isAdmin:r,onClose:o,onSaved:c}){let l=G(K.agentFiles.getAgentFile),ee=G(K.agentFiles.setAgentFile),u=J(),[d,f]=(0,X.useState)(null),[p,m]=(0,X.useState)(!1),[h,g]=(0,X.useState)(``),[_,v]=(0,X.useState)(!1),[y,b]=(0,X.useState)(!1),[x,te]=(0,X.useState)(!1),[D,k]=(0,X.useState)(!1),A=(0,X.useCallback)(async r=>{m(!1);try{let i=await l({instanceName:e,agentId:t,name:n});f({content:i.content,updatedAtMs:i.updatedAtMs}),r||g(i.content),te(!1)}catch{m(!0)}},[l,e,t,n]);(0,X.useEffect)(()=>{A(!1)},[A]);async function M(){if(d!==null){b(!0),k(!1);try{await ee({instanceName:e,agentId:t,name:n,content:h,baseUpdatedAtMs:d.updatedAtMs??void 0}),u.success(O({name:n})),c(),await A(!1)}catch(e){nt(e)?te(!0):k(!0)}finally{b(!1)}}}let N=d!==null&&h!==d.content,P=(0,X.useMemo)(()=>d===null?null:et(d.content,h),[d,h]),F=h.length>Je,I=ne(),L=(0,X.useMemo)(()=>new Intl.NumberFormat(I),[I]);return(0,Q.jsx)(Te,{open:!0,onOpenChange:e=>!e&&o(),children:(0,Q.jsxs)(He,{className:`oc-afiles__editor`,children:[(0,Q.jsxs)(Ee,{children:[(0,Q.jsx)(je,{children:s({name:n})}),(0,Q.jsxs)(Ne,{children:[C({agent:t,instance:e}),r?null:(0,Q.jsxs)(Q.Fragment,{children:[` · `,ye()]})]})]}),p?(0,Q.jsxs)(`p`,{className:`oc-afiles__error`,role:`alert`,children:[_e(),` `,(0,Q.jsx)(q,{variant:`outline`,size:`sm`,onClick:()=>void A(!1),children:a()})]}):d===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:h,readOnly:!r,spellCheck:!1,onChange:e=>g(e.target.value),"aria-label":s({name:n})}),(0,Q.jsx)(`p`,{className:`oc-afiles__hint`,children:i()}),x?(0,Q.jsxs)(`p`,{className:`oc-afiles__error`,role:`alert`,children:[E(),` `,(0,Q.jsx)(q,{variant:`outline`,size:`sm`,onClick:()=>void A(!0),children:ie()})]}):null,D?(0,Q.jsx)(`p`,{className:`oc-afiles__error`,role:`alert`,children:xe()}):null,(0,Q.jsxs)(`div`,{className:`oc-afiles__editor-foot`,children:[(0,Q.jsx)(`span`,{className:`oc-afiles__count${F?` is-over`:``}`,children:S({count:L.format(h.length),max:L.format(Je)})}),r?(0,Q.jsx)(q,{size:`sm`,disabled:!N||y||x,onClick:()=>v(!0),children:y?w():be()}):null]})]}),(0,Q.jsx)(we,{open:_,onOpenChange:v,children:(0,Q.jsxs)(Pe,{children:[(0,Q.jsxs)(Ae,{children:[(0,Q.jsx)(Be,{children:R({name:n})}),(0,Q.jsx)(Ie,{children:se({agent:t})})]}),P?(0,Q.jsxs)(`div`,{className:`oc-afiles__diff`,children:[(0,Q.jsx)(`p`,{className:`oc-afiles__diff-counts`,children:le({added:P.added,removed:P.removed})}),P.sampleAdded.length>0?(0,Q.jsxs)(`div`,{className:`oc-afiles__diff-block`,children:[(0,Q.jsx)(`span`,{className:`oc-afiles__diff-label`,children:re()}),P.sampleAdded.map((e,t)=>(0,Q.jsx)(`code`,{className:`oc-afiles__diff-line is-add`,children:e||` `},t))]}):null,P.sampleRemoved.length>0?(0,Q.jsxs)(`div`,{className:`oc-afiles__diff-block`,children:[(0,Q.jsx)(`span`,{className:`oc-afiles__diff-label`,children:j()}),P.sampleRemoved.map((e,t)=>(0,Q.jsx)(`code`,{className:`oc-afiles__diff-line is-del`,children:e||` `},t))]}):null]}):null,(0,Q.jsxs)(De,{children:[(0,Q.jsx)(Oe,{children:T()}),(0,Q.jsx)(Fe,{onClick:()=>void M(),children:me()})]})]})})]})})}function ot({curationId:e,onClose:t,onApplied:n}){let r=F(K.agentFileCuration.getProposal,{curationId:e}),i=G(K.agentFileCuration.approveCuration),a=L(K.agentFileCuration.rejectCuration),{toast:o}=J(),[s,c]=(0,X.useState)(null),[ee,d]=(0,X.useState)(!1),[p,h]=(0,X.useState)(``),_=ne(),v=(0,X.useMemo)(()=>r?et(r.beforeContent,r.proposedContent):null,[r]);async function b(){c(`approve`);try{let t=await i({curationId:e});t.ok?(o({title:ce(),variant:`success`}),n()):o({title:t.reason===`conflict`?P():M({reason:t.reason??`unknown`}),variant:`error`})}catch{o({title:z(),variant:`error`})}finally{c(null)}}async function S(n){c(`reject`);try{let r=p.trim();(await a({curationId:e,...r?{comment:r}:{},relaunch:n})).ok?o({title:n?g():ue(),variant:`success`}):o({title:A(),variant:`error`}),t()}catch{o({title:z(),variant:`error`})}finally{c(null)}}return(0,Q.jsx)(Te,{open:!0,onOpenChange:e=>e?void 0:t(),children:(0,Q.jsxs)(He,{className:`oc-afiles__review`,children:[(0,Q.jsxs)(Ee,{children:[(0,Q.jsx)(je,{children:r?he({name:r.name}):U()}),(0,Q.jsx)(Ne,{children:V()})]}),r===void 0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:U()}):r===null?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:A()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`p`,{className:`oc-afiles__review-sizes`,children:[fe({before:Z(r.beforeSize,_),after:Z(r.proposedSize,_)}),r.overBudget?(0,Q.jsxs)(Q.Fragment,{children:[` `,(0,Q.jsx)(Y,{size:13,"aria-hidden":!0}),` `,W()]}):null]}),v?(0,Q.jsx)(`p`,{className:`oc-afiles__review-diff`,children:D({added:v.added,removed:v.removed})}):null,r.feedback?(0,Q.jsx)(`p`,{className:`oc-afiles__review-feedback`,children:m({feedback:r.feedback})}):null,v&&v.sampleRemoved.length>0?(0,Q.jsxs)(`div`,{className:`oc-afiles__review-removed`,children:[(0,Q.jsx)(`p`,{className:`oc-afiles__review-label`,children:N()}),(0,Q.jsx)(`ul`,{children:v.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:pe()}),(0,Q.jsx)(`pre`,{className:`oc-afiles__review-pre`,children:r.beforeContent})]}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`p`,{className:`oc-afiles__review-label`,children:B()}),(0,Q.jsx)(`pre`,{className:`oc-afiles__review-pre`,children:r.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:x()}),(0,Q.jsx)(`textarea`,{id:`curation-reject-comment`,className:`oc-afiles__reject-textarea`,rows:3,placeholder:f(),value:p,onChange:e=>h(e.target.value)}),(0,Q.jsxs)(`div`,{className:`oc-afiles__review-actions`,children:[(0,Q.jsx)(q,{variant:`ghost`,onClick:()=>d(!1),disabled:s!==null,children:u()}),(0,Q.jsx)(q,{variant:`outline`,onClick:()=>void S(!1),disabled:s!==null,children:s===`reject`?w():l()}),(0,Q.jsx)(q,{variant:`default`,onClick:()=>void S(!0),disabled:s!==null,children:s===`reject`?w():y()})]})]}):(0,Q.jsxs)(`div`,{className:`oc-afiles__review-actions`,children:[(0,Q.jsx)(q,{variant:`outline`,onClick:()=>d(!0),disabled:s!==null||r==null,children:de()}),(0,Q.jsx)(q,{variant:`default`,onClick:()=>void b(),disabled:s!==null||r==null,children:s===`approve`?w():H()})]})]})})}export{rt as AgentFilesTab};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{AM as r,BM as i,CM as ee,DM as a,EM as o,FM as te,GM as ne,HM as re,IM as ie,JM as s,KM as ae,LM as oe,MM as se,NM as ce,OM as c,PM as l,RM as u,SM as d,TM as le,UM as ue,VM as de,WM as fe,XM as f,YM as p,_M as pe,aM as m,bM as h,cM as g,dM as me,fM as he,gM as ge,gX as _,hM as _e,hX as ve,iM as v,jM as ye,kM as be,lM as xe,mM as Se,nM as y,oM as b,pM as Ce,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-uQUQB4xy.js";import{At as j,Ct as M,Dt as N,Jt as P,Ot as F,St as I,Yt as Te,bt as L,ct as Ee,dr as R,fr as De,ft as Oe,i as ke,o as Ae,vt as z,wt as B,xt as V,yt as H}from"./index-Bw4ypNNp.js";import{n as je}from"./TimeRangePicker-CMNe-waP.js";import{t as Me}from"./FilterBar-CdYSlKIB.js";import{t as Ne}from"./DataTableShell-CeVf9eD_.js";import{t as U}from"./dispatchErrorInfo-DaVpBFg-.js";var W=t(e(),1),G=new Set([`openclaw.dispatch_failures`,`assistant.announce_errors`]),K=new Set([`assistant.cause.provider_auth_revoked`,`assistant.cause.provider_permission_denied`,`assistant.cause.provider_auth_failed`]);function q(e){let t=K.has(e.kind);if(!G.has(e.kind)&&!t||!e.evidence)return{};try{let n=JSON.parse(e.evidence);if(t){let e=Array.isArray(n.agents)?n.agents.filter(e=>typeof e==`string`):[],t=Array.isArray(n.providers)?n.providers.filter(e=>typeof e==`string`):[],r=e.length===1?e[0]:void 0;return{dominantCode:n.cause,sampleCorrelationId:n.sampleCorrelationId,context:{...r===void 0?{}:{agentId:r.slice(r.lastIndexOf(`/`)+1)},...t.length===1?{provider:t[0]}:{}}}}return{dominantCode:n.dominantCode,sampleCorrelationId:n.sampleCorrelationId}}catch{return{}}}var J=n(),Y=`__all__`,Pe=[{value:`open`},{value:`acknowledged`},{value:`resolved`}];function Fe(e){return e===`open`?f():e===`acknowledged`?p():s()}var Ie=[`info`,`warn`,`critical`],Le=[`detector`,`agent`,`user`],X={kind:`relative`,from:`now-30d`,to:`now`},Re=200,Z=`all`;function Q(){let e=De({from:`/settings/anomalies`}),t=R({from:`/settings/anomalies`}),n=e.q??``,s=e.status===Z?Y:e.status,f=e.severity??Y,p=e.kind??Y,[m,g]=(0,W.useState)(Y),v=ke(e.from,e.to),{from:y,to:b}=je(v),S=e=>void t({search:t=>({...t,q:e||void 0}),replace:!0}),C=e=>void t({search:t=>({...t,status:e===Y?Z:e})}),T=e=>void t({search:t=>({...t,severity:e===Y?void 0:e})}),M=e=>void t({search:t=>({...t,kind:e===Y?void 0:e})}),N=e=>void t({search:t=>({...t,...Ae(e)})}),F=Ee(),B=Te(),U=ve(w.anomalies.resolveAnomaly),G=(_(w.me.getMe,{host:Oe})?.permissions??[]).includes(`admin.manage`),K=_(w.anomalies.listAnomalies,{limit:Re,filter:{q:n||void 0,from:y,to:b,anomalyStatus:s===Y?void 0:s,severity:f===Y?void 0:f,source:m===Y?void 0:m,kind:p===Y?void 0:p}}),q=(0,W.useMemo)(()=>{let e=new Set;for(let t of K??[])e.add(t.kind);return[...e].sort()},[K]),Q=n!==``||s!==`open`||f!==Y||m!==Y||p!==Y||v.kind!==`relative`||v.from!==X.from;function $(){g(Y),t({search:{status:`open`},replace:!0})}async function We(e){if(await F({title:x(),description:(0,J.jsxs)(J.Fragment,{children:[ae(),` `,(0,J.jsx)(`span`,{className:`font-mono`,children:e.kind}),` `,ne(),` `,(0,J.jsx)(`strong`,{children:fe()}),`.`,` `,ue()]}),confirmLabel:re()}))try{await U({anomalyId:e._id,status:`resolved`}),B.success(de(),e.kind)}catch(e){B.error(i(),e)}}async function Ge(e){try{await U({anomalyId:e._id,status:`acknowledged`}),B.success(we(),e.kind)}catch(e){B.error(u(),e)}}return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(`p`,{className:`oc-admin__hint`,children:[oe(),` `,(0,J.jsx)(`strong`,{children:ie()}),` `,te(),` `,(0,J.jsx)(`strong`,{children:l()}),` `,ce(),` `,(0,J.jsx)(`strong`,{children:se()}),` `,ye(),` `,(0,J.jsx)(`span`,{className:`oc-filter__window`,children:r()})]}),(0,J.jsxs)(Me,{q:n,onQChange:S,searchPlaceholder:be(),timeRange:v,onTimeRangeChange:N,onReset:$,canReset:Q,children:[(0,J.jsxs)(z,{value:s,onValueChange:C,children:[(0,J.jsx)(V,{size:`sm`,className:`w-36`,children:(0,J.jsx)(I,{})}),(0,J.jsxs)(H,{children:[(0,J.jsx)(L,{value:Y,children:c()}),Pe.map(e=>(0,J.jsx)(L,{value:e.value,children:Fe(e.value)},e.value))]})]}),(0,J.jsxs)(z,{value:f,onValueChange:T,children:[(0,J.jsx)(V,{size:`sm`,className:`w-36`,children:(0,J.jsx)(I,{placeholder:a()})}),(0,J.jsxs)(H,{children:[(0,J.jsx)(L,{value:Y,children:ee()}),Ie.map(e=>(0,J.jsx)(L,{value:e,children:e},e))]})]}),(0,J.jsxs)(z,{value:m,onValueChange:g,children:[(0,J.jsx)(V,{size:`sm`,className:`w-32`,children:(0,J.jsx)(I,{placeholder:d()})}),(0,J.jsxs)(H,{children:[(0,J.jsx)(L,{value:Y,children:k()}),Le.map(e=>(0,J.jsx)(L,{value:e,children:e},e))]})]}),(0,J.jsxs)(z,{value:p,onValueChange:M,children:[(0,J.jsx)(V,{size:`sm`,className:`w-36`,children:(0,J.jsx)(I,{placeholder:h()})}),(0,J.jsxs)(H,{children:[(0,J.jsx)(L,{value:Y,children:A()}),q.map(e=>(0,J.jsx)(L,{value:e,children:e},e))]})]})]}),(0,J.jsx)(Ne,{title:D(),rows:K,emptyHint:s===`open`?pe():ge(),rowActions:e=>G&&e.status===`open`?[{label:_e(),onSelect:()=>void We(e)},{label:Se(),onSelect:()=>void Ge(e)}]:[],columns:[{header:Ce(),cell:e=>(0,J.jsx)(`span`,{className:`oc-traces__time`,children:j(e.at)}),sort:e=>e.at},{header:h(),cell:e=>(0,J.jsx)(`code`,{className:`oc-traces__mono`,children:e.kind}),sort:e=>e.kind},{header:o(),cell:e=>e.occurrenceCount!==null&&e.occurrenceCount>1?(0,J.jsx)(`span`,{className:`oc-traces__time`,title:e.firstAt===null?void 0:O({when:j(e.firstAt)}),children:le({count:String(e.occurrenceCount)})}):(0,J.jsx)(`span`,{className:`oc-traces__time`,children:`—`}),sort:e=>e.occurrenceCount??0},{header:a(),cell:e=>(0,J.jsx)(Ve,{severity:e.severity}),sort:e=>e.severity===`critical`?2:+(e.severity===`warn`)},{header:he(),cell:e=>(0,J.jsx)(He,{status:e.status}),sort:e=>e.status===`resolved`?2:+(e.status===`acknowledged`)},{header:d(),cell:e=>(0,J.jsx)(P,{variant:`outline`,children:e.source}),sort:e=>e.source},{header:me(),cell:e=>(0,J.jsxs)(`div`,{className:`oc-anomaly__msgcell`,children:[(0,J.jsx)(`span`,{className:`oc-anomaly__msg`,children:e.message}),(0,J.jsx)(Be,{row:e})]}),sort:e=>e.message},{header:E(),cell:e=>(0,J.jsx)(ze,{row:e}),sort:e=>e.evidence??null},{header:xe(),cell:e=>e.correlationId?(0,J.jsx)(`code`,{className:`oc-traces__mono`,children:Ue(e.correlationId)}):(0,J.jsx)(`span`,{className:`oc-traces__muted`,children:`—`}),sort:e=>e.correlationId}]})]})}function $(e){if(e.kind!==`subagent.failure`||!e.evidence)return{};try{let t=JSON.parse(e.evidence);return{failedCount:t.failedCount,totalCount:t.totalCount,errorCategories:t.errorCategories}}catch{return{}}}function ze({row:e}){let t=R();if(e.kind===`subagent.failure`){let n=$(e);return(0,J.jsxs)(`div`,{className:`oc-anomaly__cause`,children:[(0,J.jsx)(`div`,{className:`oc-anomaly__cause-head`,children:[...new Set(n.errorCategories??[])].map(e=>(0,J.jsx)(`code`,{className:`oc-traces__mono`,children:e},e))}),e.correlationId?(0,J.jsxs)(`button`,{type:`button`,className:`oc-anomaly__drill`,onClick:()=>void t({to:`/settings/traces`,search:{q:e.correlationId,limit:100}}),children:[`↗ `,g()]}):null]})}let n=q(e);if(!n.dominantCode){let e=n.sampleCorrelationId;return e?(0,J.jsx)(`div`,{className:`oc-anomaly__cause`,children:(0,J.jsxs)(`button`,{type:`button`,className:`oc-anomaly__drill`,onClick:()=>void t({to:`/settings/traces`,search:{correlationId:e,limit:100}}),children:[`↗ `,g()]})}):(0,J.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})}let r=U(n.dominantCode,n.context),i=n.sampleCorrelationId;return(0,J.jsxs)(`div`,{className:`oc-anomaly__cause`,children:[(0,J.jsxs)(`div`,{className:`oc-anomaly__cause-head`,children:[(0,J.jsx)(`span`,{className:`oc-anomaly__cause-label`,children:r.label}),(0,J.jsx)(`code`,{className:`oc-traces__mono`,children:n.dominantCode})]}),(0,J.jsx)(`p`,{className:`oc-anomaly__cause-hint`,children:r.hint}),i?(0,J.jsxs)(`button`,{type:`button`,className:`oc-anomaly__drill`,onClick:()=>void t({to:`/settings/traces`,search:{correlationId:i,limit:100}}),children:[`↗ `,g()]}):null]})}function Be({row:e}){let[t,n]=(0,W.useState)(!1),r=_(w.anomalies.getAnomalyAttachments,t?{anomalyId:e._id}:`skip`);return!e.attachments||e.attachments.length===0?null:(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(`button`,{type:`button`,className:`oc-anomaly__drill`,onClick:()=>n(!0),children:[C(),e.attachments.length>1?` (${e.attachments.length})`:``]}),(0,J.jsx)(M,{open:t,onOpenChange:n,children:(0,J.jsxs)(B,{className:`oc-anomaly__attachments-dialog`,children:[(0,J.jsx)(N,{children:(0,J.jsx)(F,{children:b()})}),r===void 0?(0,J.jsx)(`p`,{className:`oc-traces__muted`,children:m()}):r.length===0?(0,J.jsx)(`p`,{className:`oc-traces__muted`,children:v()}):(0,J.jsx)(`div`,{className:`oc-anomaly__attachments`,children:r.map(e=>(0,J.jsxs)(`section`,{className:`oc-anomaly__attachment`,children:[(0,J.jsx)(`h4`,{className:`oc-anomaly__attachment-name`,children:(0,J.jsx)(`code`,{className:`oc-traces__mono`,children:e.name})}),(0,J.jsx)(`pre`,{className:`oc-anomaly__attachment-content`,children:e.content})]},e.name))})]})})]})}function Ve({severity:e}){return(0,J.jsx)(`span`,{className:`oc-anomaly__sev oc-anomaly__sev--${e}`,children:e})}function He({status:e}){return e===`open`?(0,J.jsx)(P,{variant:`destructive`,children:S()}):e===`acknowledged`?(0,J.jsx)(P,{variant:`secondary`,children:y()}):(0,J.jsx)(P,{variant:`outline`,children:T()})}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,GN as a,HN as o,JN as s,KN as c,Mu as l,Nu as u,Pu as d,QN as f,UN as p,WN as m,XN as h,YN as g,ZN as _,eP as v,gX as y,ju as b,ku as x,nP as S,qN as C,t as w,tP as T}from"./api-uQUQB4xy.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-Bw4ypNNp.js";import{n as ee}from"./TimeRangePicker-CMNe-waP.js";import{t as z}from"./FilterBar-CdYSlKIB.js";import{t as B}from"./AdvancedFilter-bgzdOb0t.js";import{t as V}from"./DataTableShell-CeVf9eD_.js";var H=t(e(),1),U=n(),W={kind:`relative`,from:N,to:`now`},G=`__all__`,K=[{value:`action`,label:d()},{value:`realLabel`,label:u()},{value:`targetLabel`,label:l()},{value:`impersonated`,label:b()},{value:`resource`,label:i()},{value:`resourceId`,label:x()}];function q(){let e=j({from:`/settings/audit`}),t=A({from:`/settings/audit`}),n=e.q??``,i=e.action??G,l=e.impersonated??G,u=e.resource??G,d=M(e.from,e.to),b=(0,H.useMemo)(()=>F(e.adv),[e.adv]),{from:x,to:N}=ee(d),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}),$=y(w.admin.listAudit,{filter:{q:n||void 0,from:x,to:N,action:i===G?void 0:i,resource:u===G?void 0:u,impersonated:l===G?void 0:l===`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||l!==G||u!==G||b.length>0||d.kind!==`relative`||d.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:[S(),` `,(0,U.jsx)(`span`,{className:`oc-filter__window`,children:T()})]}),(0,U.jsxs)(z,{q:n,onQChange:q,searchPlaceholder:v(),timeRange:d,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:r()})}),(0,U.jsxs)(R,{children:[(0,U.jsx)(k,{value:G,children:f()}),te.map(e=>(0,U.jsx)(k,{value:e,children:e},e))]})]}),(0,U.jsxs)(I,{value:l,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:_()}),(0,U.jsx)(k,{value:`yes`,children:h()}),(0,U.jsx)(k,{value:`no`,children:g()})]})]}),(0,U.jsxs)(I,{value:u,onValueChange:X,children:[(0,U.jsx)(L,{size:`sm`,className:`w-40`,children:(0,U.jsx)(D,{placeholder:s()})}),(0,U.jsxs)(R,{children:[(0,U.jsx)(k,{value:G,children:C()}),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:c(),rows:$,emptyHint:a(),columns:[{header:m(),cell:e=>E(e.at),sort:e=>e.at},{header:r(),cell:e=>e.action,sort:e=>e.action},{header:p(),cell:e=>e.realLabel,sort:e=>e.realLabel},{header:o(),cell:e=>e.targetLabel??`—`,sort:e=>e.targetLabel??null},{header:s(),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,$g as i,$l as a,AO as o,BO as s,CO as c,DO as l,E as u,EO as d,FO as f,Fg as p,GO as m,Gg as h,Gk as ee,HO as g,Hg as te,Hk as ne,IO as _,JO as re,Jg as v,Jk as ie,KO as ae,Kg as oe,Kk as se,LO as ce,MO as y,NO as le,OO as ue,PO as de,QO as fe,Qg as pe,Qk as me,Ql as he,RO as ge,Rk 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,WO as Ee,Wg as De,Wk as Oe,XO as ke,Xg as Ae,Xl as je,YO as Me,Yg as Ne,Yk as Pe,ZO as Fe,Zg as Ie,Zk as Le,Zl as Re,ak as ze,bO as b,ck as Be,dk as Ve,ds as He,ek as Ue,eu as We,fk as Ge,gX as x,gk as Ke,hX as qe,hk as Je,ik as Ye,jO as Xe,kO as Ze,lk as Qe,mk as $e,nk as et,ok as tt,pX as nt,pk as rt,qO as S,qg as it,qk as at,rk as ot,ru as st,sk as ct,t as C,tk as lt,uk as ut,vO as dt,wO as ft,xO as pt,yO as w,zO as mt,zk as ht}from"./api-uQUQB4xy.js";import{r as T}from"./dist-BV5tiwQ7.js";import{t as gt}from"./chevrons-up-down-HreDTesh.js";import{i as _t,n as E,o as vt,r as yt,s as bt}from"./FieldLabel-BBpaaMpJ.js";import{t as xt}from"./button-Biq40Zpc.js";import{$t as D,At as St,Ct,Dt as wt,Jn as Tt,Jt as O,L as Et,Mt as Dt,Ot,Pn as k,St as A,Tt as kt,Yt as At,ar as j,at as jt,bt as M,cn as Mt,dr as N,fr as Nt,ft as Pt,it as Ft,jt as P,kn as F,on as It,or as Lt,ot as Rt,sn as zt,sr as I,st as Bt,vt as L,wt as Vt,xt as R,yt as z}from"./index-Bw4ypNNp.js";import{r as Ht}from"./locales-CPjguROj.js";import{a as B,i as V,n as Ut,o as H,r as U,t as Wt}from"./table-DH8u2aW2.js";import{t as Gt}from"./FilterBar-CdYSlKIB.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-Di1KVtbg.js";import{t as W}from"./dispatchErrorInfo-DaVpBFg-.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 tn(e){return e.filter(e=>e.state===`error`)}function nn(e){return e.reachable&&tn(e.targets).length===0}function rn(e){return nn(e)?(e.unreachableInstances??[]).length>0?`gateways_unreachable`:`ok`:`error`}function K(e){return e.state===`error`&&e.lastErrorCode!==null}function an(e){return!!e.lastDownstreamRejectCode}function on(e){return!!e.lastLocalRefusalCode}function sn(e){return K(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),[i,a]=(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),i),[s,n,i]);function h(e){a(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:_()}):(0,Q.jsxs)(`div`,{className:`oc-conn`,children:[(0,Q.jsxs)(Gt,{q:n.q,onQChange:e=>r(t=>({...t,q:e})),searchPlaceholder:le(),onReset:()=>r(un),canReset:dn(n),children:[(0,Q.jsxs)(L,{value:n.state,onValueChange:e=>r(t=>({...t,state:e})),children:[(0,Q.jsx)(R,{size:`sm`,className:`w-36`,children:(0,Q.jsx)(A,{placeholder:Xe()})}),(0,Q.jsxs)(z,{children:[(0,Q.jsx)(M,{value:Y,children:y()}),u.map(e=>(0,Q.jsx)(M,{value:e,children:xn(e)},e))]})]}),(0,Q.jsxs)(L,{value:n.instance,onValueChange:e=>r(t=>({...t,instance:e})),children:[(0,Q.jsx)(R,{size:`sm`,className:`w-40`,children:(0,Q.jsx)(A,{placeholder:o()})}),(0,Q.jsxs)(z,{children:[(0,Q.jsx)(M,{value:Y,children:y()}),f.map(e=>(0,Q.jsx)(M,{value:e.name,children:e.label},e.name))]})]}),(0,Q.jsxs)(L,{value:n.version,onValueChange:e=>r(t=>({...t,version:e})),children:[(0,Q.jsx)(R,{size:`sm`,className:`w-36`,children:(0,Q.jsx)(A,{placeholder:Ze()})}),(0,Q.jsxs)(z,{children:[(0,Q.jsx)(M,{value:Y,children:y()}),p.map(e=>(0,Q.jsx)(M,{value:e,children:e},e))]})]})]}),m.length===0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:ue()}):(0,Q.jsxs)(Wt,{className:`oc-conn__table`,children:[(0,Q.jsx)(B,{children:(0,Q.jsxs)(H,{children:[(0,Q.jsx)($,{label:l(),sortKey:`target`,sort:i,onSort:h}),(0,Q.jsx)($,{label:d(),sortKey:`state`,sort:i,onSort:h}),(0,Q.jsx)($,{label:ye(),sortKey:`instance`,sort:i,onSort:h}),(0,Q.jsx)($,{label:ft(),sortKey:`host`,sort:i,onSort:h}),(0,Q.jsx)($,{label:c(),sortKey:`version`,sort:i,onSort:h}),(0,Q.jsx)(V,{children:ve()}),(0,Q.jsx)($,{label:pt(),sortKey:`lastOk`,sort:i,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)(Lt,{size:13,"aria-hidden":!0}):(0,Q.jsx)(T,{size:13,"aria-hidden":!0}):(0,Q.jsx)(gt,{size:13,"aria-hidden":!0,className:`oc-conn__sort-idle`})]})})}function bn({r:e}){let t=K(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:f({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:P(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?` · ${P(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?` · ${P(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:[de({label:n.label}),` `,(0,Q.jsx)(`code`,{className:`oc-traces__mono`,children:e.lastDownstreamRejectCode}),e.lastDownstreamRejectAt?` · ${P(e.lastDownstreamRejectAt)}`:``]}):null]})}):null]})}function xn(e){return e===`connected`?b():e===`error`?w():dt()}function Sn({state:e}){return e===`connected`?(0,Q.jsx)(O,{variant:`secondary`,children:b()}):e===`error`?(0,Q.jsx)(O,{variant:`destructive`,children:w()}):(0,Q.jsx)(O,{variant:`outline`,children:dt()})}function Cn(){return x(C.bridgeHealth.getBridgeHealth,{})}function wn(){let e=Cn(),t=x(C.compat.getBridgeCompat,{}),n=x(C.me.getMe,{host:Pt})?.role===`admin`,r=x(C.admin.listInstances,n?{}:`skip`),i=x(C.agents.usageForInstances,n?{}:`skip`),o=N(),s=()=>void o({to:`/settings/anomalies`,search:{status:`open`}}),c=ln(e?e.targets:[],t?t.targets:[],r??[]),{section:l}=Nt({from:`/settings/bridge`}),u=N({from:`/settings/bridge`}),d=t?.compat??null,f=t===void 0?`loading`:t===null?`nodata`:`ready`,m=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:et()}),i&&i.length>0?(0,Q.jsxs)(`section`,{className:`oc-bridge__usage`,children:[(0,Q.jsx)(`h3`,{className:`oc-bridge__usage-title`,children:lt()}),(0,Q.jsxs)(Wt,{children:[(0,Q.jsx)(B,{children:(0,Q.jsxs)(H,{children:[(0,Q.jsx)(V,{children:We()}),(0,Q.jsx)(V,{children:a()}),(0,Q.jsx)(V,{children:he()}),(0,Q.jsx)(V,{children:Re()}),(0,Q.jsx)(V,{children:je()})]})}),(0,Q.jsx)(Ut,{children:i.flatMap(e=>{let t=Et(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)(O,{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)(Ft,{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)(Rt,{className:`w-full`,children:c.map(e=>(0,Q.jsxs)(Bt,{value:e.key,className:`flex-1 gap-1.5`,children:[(0,Q.jsx)(k,{size:13,"aria-hidden":!0}),J(e.key)]},e.key))}),c.map(e=>(0,Q.jsx)(jt,{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,m?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:p()}):null]})}function Tn({health:e,compat:t,onSeeAnomalies:n}){let r=t!=null&&t.buildVersion!=null&&t.bridgeVersion!=null&&t.buildVersion!==t.bridgeVersion,i=t?.buildRevision&&t.buildRevision!==`unknown`?t.buildRevision.slice(0,7):null,a=t&&t!==null?(0,Q.jsxs)(`span`,{className:`oc-bridge-card__ver`,children:[(0,Q.jsx)(`code`,{className:`oc-traces__mono`,children:Yt(t.bridgeVersion)}),i?(0,Q.jsxs)(Q.Fragment,{children:[` `,(0,Q.jsxs)(`code`,{className:`oc-traces__mono`,title:Ie(),children:[`(`,i,`)`]})]}):null,r?(0,Q.jsxs)(`strong`,{className:`oc-bridge-card__mismatch`,children:[` `,Ae({build:t.buildVersion??`?`})]}):null,` · `,Ne(),` `,(0,Q.jsx)(`code`,{className:`oc-traces__mono`,children:t.protocolVersion===null?v():String(t.protocolVersion)})]}):null;if(e===void 0)return(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:S()});if(e===null)return(0,Q.jsx)(`div`,{className:`oc-bridge-card oc-bridge-card--idle`,children:ae()});let o=tn(e.targets),c=!e.reachable,l=rn(e),u=e.unreachableInstances??[],d=l===`ok`?`ok`:l===`gateways_unreachable`?`warn`:`error`,f=St(e.checkedAt),p=e.startedAt==null?null:St(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)(j,{size:22}):c||l===`gateways_unreachable`?(0,Q.jsx)(en,{size:22}):(0,Q.jsx)(F,{size:22})}),(0,Q.jsxs)(`div`,{className:`oc-bridge-card__body`,children:[(0,Q.jsx)(`div`,{className:`oc-bridge-card__title`,children:l===`ok`?m():l===`gateways_unreachable`?Ce({count:u.length}):c?Ee():be({count:o.length})}),(0,Q.jsxs)(`div`,{className:`oc-bridge-card__meta`,children:[(0,Q.jsxs)(`span`,{children:[(0,Q.jsx)($t,{size:12,"aria-hidden":!0}),` `,g({time:f})]}),p?(0,Q.jsx)(`span`,{children:mt({time:p})}):null,a]}),l===`gateways_unreachable`?(0,Q.jsx)(`p`,{className:`oc-bridge-card__hint`,children:s({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:ge()})]})}function En({providerKey:e,connections:t,instances:n,manifest:r,compatStatus:a,compatReachable:o,protocol:s}){let c=r?Kt(r,e):null,l=new Map;for(let e of n)l.set(e.name,e.displayName??e.name);let u=[],d=new Set;for(let n of t){if(!n.instanceName||d.has(n.instanceName))continue;d.add(n.instanceName);let t=n.gatewayVersion??null;u.push({instanceName:n.instanceName,displayName:l.get(n.instanceName)??n.instanceName,version:t,state:Jt(t,e,r)})}let f=Qt(u.map(e=>e.state)),[p,m]=(0,G.useState)(!1);return(0,Q.jsxs)(`section`,{className:`oc-bridge-provider`,children:[(0,Q.jsxs)(`header`,{className:`oc-bridge-provider__head`,children:[(0,Q.jsx)(k,{size:15,"aria-hidden":!0,className:`oc-bridge-provider__icon`}),(0,Q.jsx)(`span`,{className:`oc-bridge-provider__name`,children:J(e)}),f?(0,Q.jsx)(O,{variant:f===`beyond`||f===`defective`||f===`unsupported`?`destructive`:`secondary`,children:qt(f)}):null]}),(0,Q.jsx)(`h4`,{className:`oc-bridge-provider__sub`,children:i()}),(0,Q.jsx)(On,{providerName:J(e),support:c,compatStatus:a,compatReachable:o,manifest:r,instanceRows:u}),s?(0,Q.jsx)(Dn,{protocol:s}):null,(0,Q.jsxs)(`button`,{type:`button`,className:`oc-bridge-provider__sub oc-bridge-provider__sub--toggle`,"aria-expanded":p,onClick:()=>m(e=>!e),children:[p?(0,Q.jsx)(T,{size:13,"aria-hidden":!0}):(0,Q.jsx)(I,{size:13,"aria-hidden":!0}),ce({count:t.length})]}),p?(0,Q.jsx)(yn,{connections:t,displayByInstance:l}):null]})}function Dn({protocol:e}){let[t,n]=(0,G.useState)(!1),i=e.coverage,a=e.drift??[],o=(e.driftOverflow??0)+(e.driftTruncated??0);return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`h4`,{className:`oc-bridge-provider__sub`,children:[Ue(),a.length>0?(0,Q.jsx)(O,{variant:`destructive`,children:fe({count:a.length})}):o>0?(0,Q.jsx)(O,{variant:`destructive`,children:Fe()}):(0,Q.jsx)(O,{variant:`secondary`,children:r()})]}),(0,Q.jsxs)(`p`,{className:`oc-admin__hint`,children:[ke({version:e.vendoredVersion}),i?` · `+Me({handled:i.handled,ignored:i.ignored,gaps:i.gaps}):null]}),o>0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:He({overflow:e.driftOverflow??0,truncated:e.driftTruncated??0})}):null,a.length>0?(0,Q.jsx)(`ul`,{className:`oc-bridge-protocol__list`,role:`list`,children:a.map(e=>(0,Q.jsxs)(`li`,{children:[(0,Q.jsx)(`code`,{className:`oc-traces__mono`,children:e.shape}),` × `,e.count]},e.shape))}):null,i&&i.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)(T,{size:13,"aria-hidden":!0}):(0,Q.jsx)(I,{size:13,"aria-hidden":!0}),re({count:i.gapList.length})]}),t?(0,Q.jsx)(`ul`,{className:`oc-bridge-protocol__list`,role:`list`,children:i.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:S()}):t===`nodata`?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:pe()}):(0,Q.jsxs)(`div`,{className:`oc-compat`,children:[n?null:(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:it()}),r===null?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:oe()}):(0,Q.jsxs)(`div`,{className:`oc-compat__support`,children:[(0,Q.jsx)(`span`,{className:`oc-compat__label`,children:st({provider:a})}),e&&e.range!==null?(0,Q.jsx)(`span`,{children:h({min:e.range.min,max:e.range.maxValidated})}):(0,Q.jsx)(`span`,{children:v()}),e?(0,Q.jsx)(Mn,{versions:e.validatedVersions}):null]}),i.length===0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:Te()}):(0,Q.jsx)(`div`,{className:`oc-compat__targets`,children:i.map(e=>(0,Q.jsxs)(`div`,{className:`oc-compat__target`,children:[(0,Q.jsx)(`span`,{className:`oc-compat__instance`,children:e.displayName}),(0,Q.jsx)(`code`,{className:`oc-traces__mono`,children:Yt(e.version)}),(0,Q.jsx)(O,{variant:e.state===`supported`?`secondary`:e.state===`beyond`||e.state===`defective`||e.state===`unsupported`?`destructive`:`outline`,children:qt(e.state)})]},e.instanceName))})]})}function kn({instance:e,onClose:t}){return(0,Q.jsx)(Ct,{open:!0,onOpenChange:e=>!e&&t(),children:(0,Q.jsxs)(Vt,{className:`oc-bridge-config-dialog`,onOpenAutoFocus:e=>e.preventDefault(),children:[(0,Q.jsxs)(wt,{children:[(0,Q.jsx)(Ot,{children:me({instance:e.displayName??e.name})}),(0,Q.jsx)(kt,{children:Le()})]}),(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)(j,{"aria-hidden":!0}):(0,Q.jsx)(F,{"aria-hidden":!0}),(0,Q.jsxs)(`span`,{children:[e,` — `,t.ok?tt():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=qe(C.admin.upsertInstanceConfig),r=nt(C.bridge.validateMediaPaths),i=At(),a=Ht(e.config?.contentLocale,void 0),[o,s]=(0,G.useState)(()=>_t(e.config??{},a)),[c,l]=(0,G.useState)(!1),[u,d]=(0,G.useState)(!1),[f,p]=(0,G.useState)(null),m=o.inboundMediaMode===`shared-fs`,h=o.mediaMode===`shared-fs`,g=m||h;async function te(){d(!0),p(null);try{p(await r({instanceName:e.name,inboundMediaMode:o.inboundMediaMode,mediaMode:o.mediaMode}))}catch(e){i.error(ut(),e)}finally{d(!1)}}async function _(){l(!0);try{let r=e.config??{};await n({instanceId:e._id,config:yt(o,r,a)}),t()}catch(e){i.error(Oe(),e)}finally{l(!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)(E,{label:Pe(),help:Se()}),(0,Q.jsxs)(L,{value:o.mediaMode,onValueChange:e=>s({...o,mediaMode:e}),children:[(0,Q.jsx)(R,{size:`sm`,className:`w-full`,children:(0,Q.jsx)(A,{})}),(0,Q.jsx)(z,{children:bt.map(e=>(0,Q.jsx)(M,{value:e,children:e},e))})]})]}),(0,Q.jsxs)(`label`,{className:`oc-field`,children:[(0,Q.jsx)(E,{label:ie(),help:ne()}),(0,Q.jsxs)(L,{value:o.inboundMediaMode,onValueChange:e=>s({...o,inboundMediaMode:e}),children:[(0,Q.jsx)(R,{size:`sm`,className:`w-full`,children:(0,Q.jsx)(A,{})}),(0,Q.jsx)(z,{children:vt.map(e=>(0,Q.jsx)(M,{value:e,children:e},e))})]})]}),(0,Q.jsxs)(`label`,{className:`oc-field`,children:[(0,Q.jsx)(E,{label:at(),help:ht()}),(0,Q.jsx)(D,{type:`number`,min:1,max:4096,className:`w-full`,value:o.mediaMaxMb,onChange:e=>s({...o,mediaMaxMb:Math.trunc(Number(e.target.value)||0)})})]})]}),g&&(0,Q.jsxs)(`div`,{className:`oc-bridge-config__grid`,children:[m&&(0,Q.jsxs)(`label`,{className:`oc-field`,children:[(0,Q.jsx)(E,{label:Ke(),help:Je()}),(0,Q.jsx)(D,{className:`w-full`,spellCheck:!1,value:o.inboundAgentMount,onChange:e=>s({...o,inboundAgentMount:e.target.value})})]}),h&&(0,Q.jsxs)(`label`,{className:`oc-field`,children:[(0,Q.jsx)(E,{label:$e(),help:rt()}),(0,Q.jsx)(D,{className:`w-full`,spellCheck:!1,value:o.outboundAgentMount,onChange:e=>s({...o,outboundAgentMount:e.target.value})})]})]}),(0,Q.jsxs)(`label`,{className:`oc-field--row`,children:[(0,Q.jsx)(Dt,{checked:o.rehydration,onCheckedChange:e=>s({...o,rehydration:e===!0})}),(0,Q.jsx)(E,{label:se(),help:_e()})]}),g&&f!==null&&(0,Q.jsx)(`div`,{className:`oc-bridge-config__check`,children:f.reachable?!f.inbound&&!f.outbound?(0,Q.jsxs)(`p`,{className:`oc-bridge-config__check-row oc-bridge-config__check-row--err`,children:[(0,Q.jsx)(F,{"aria-hidden":!0}),ot({reason:f.reason??`?`})]}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(An,{label:Be(),result:f.inbound}),(0,Q.jsx)(An,{label:ct(),result:f.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)(F,{"aria-hidden":!0}),Ye()]})}),(0,Q.jsxs)(`div`,{className:`oc-bridge-config__actions`,children:[g&&(0,Q.jsxs)(xt,{variant:`outline`,size:`sm`,onClick:()=>void te(),disabled:u,children:[u?(0,Q.jsx)(Tt,{className:`size-4 animate-spin`,"aria-hidden":!0}):null,u?Ve():Ge()]}),(0,Q.jsx)(xt,{size:`sm`,onClick:()=>void _(),disabled:c,children:ee()})]})]})})}function Mn({versions:e}){if(e.length===0)return null;let t=[...e].reverse();return(0,Q.jsxs)(It,{children:[(0,Q.jsx)(Mt,{asChild:!0,children:(0,Q.jsxs)(`button`,{type:`button`,className:`oc-compat__versions-btn`,children:[e.length===1?De():xe({count:e.length}),(0,Q.jsx)(T,{size:13,"aria-hidden":!0})]})}),(0,Q.jsxs)(zt,{className:`oc-compat__versions-pop`,align:`start`,children:[(0,Q.jsx)(`p`,{className:`oc-compat__versions-title`,children:te()}),(0,Q.jsx)(`div`,{className:`oc-compat__versions-list`,children:t.map(e=>(0,Q.jsx)(O,{variant:`secondary`,children:e},e))})]})]})}export{wn as BridgeTab,kn as InstanceConfigDialog};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Ct as r,Cv as i,R_ as a,Sp as o,St as s,Tt as c,Tv as l,Xk as u,_p as d,_t as f,a_ as p,at as m,bp as h,bt as g,c_ as _,ct as v,dt as y,e_ as b,et as x,ft as S,gX as C,gp as ee,gt as te,hX as w,hp as ne,ht as T,i_ as re,it as E,lt as D,mp as ie,mt as O,n_ as k,nt as ae,nu as oe,oX as A,o_ as se,ot as ce,pX as j,pp as le,pt as ue,r_ as de,rt as fe,s_ as M,st as pe,t as N,t_ as P,tt as me,ut as he,vp as ge,vt as _e,vv as ve,wt as F,xp as ye,xt as be,yp as I,yt as xe,yv as Se}from"./api-uQUQB4xy.js";import{t as Ce}from"./use_paginated_query-Ce4kc6WY.js";import{t as L}from"./button-Biq40Zpc.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-Bw4ypNNp.js";import{a as De}from"./compatView-Di1KVtbg.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 s();case`hybrid`:return be();case`tool`:return g();default:return xe()}}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`?O():Me(e)?E():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:f()}}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`?O():e.code===`stale_default`?ue():e.code===`write_unknown`||e.code===`not_confirmed`?he():e.code===`not_applied`?D():e.code===`default_too_large`?ae():e.code===`allowlist_too_large`?fe():e.code===`plugin_too_old`?E():e.code===`source_not_allowed`?m():e.code===`plugin_config_lag`?ce():e.code===`knowledge_unavailable`&&e.reason===`plugin_absent`?te():S({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=j(N.knowledge.setAgentKnowledgeDefault),[a,o]=(0,K.useState)(t),[s,c]=(0,K.useState)(()=>X(t)),[u,d]=(0,K.useState)(`idle`),[f,p]=(0,K.useState)(null),[m,h]=(0,K.useState)(!1),g=e=>{o(e),c(X(e)),p(null)},_=Pe(a,t);(0,K.useEffect)(()=>{m&&_&&(h(!1),g(t))},[m,_]);let v=je(a,s,n),b=v.readOnlyReason===null;async function S(){d(`saving`),p(null);try{let n=Q(await i({instanceName:e,agentId:t.agentId,injection:s.injection,sources:s.sources,expected:J(a)}));p(n),d(n===null?`done`:`idle`),n===null&&h(!0)}catch(e){p(Q({ok:!1,code:String(e?.message??`error`).slice(0,60)})),d(`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:s.injection,onValueChange:e=>{Y(e)&&c({...s,injection:e})},disabled:!b,children:[(0,$.jsx)(W,{className:`oc-cdefaults__select`,"aria-label":r(),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:_e()}),t.sources.map(e=>(0,$.jsxs)(`label`,{className:`oc-cdefaults__inline`,style:{cursor:b?`pointer`:`default`},title:e.description||void 0,children:[(0,$.jsx)(z,{checked:s.sources.includes(e.id),onCheckedChange:()=>c(Ne(t,s,e.id)),disabled:!b,"aria-label":e.label,"data-knowledge-default-source":e.id}),(0,$.jsx)(`span`,{children:e.label})]},e.id)),_&&!m?(0,$.jsxs)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:[me(),` `,(0,$.jsx)(L,{variant:`outline`,size:`sm`,onClick:()=>g(t),children:x()})]}):null,t.overridesAllowed?null:(0,$.jsx)(`p`,{className:`oc-cdefaults__help`,children:y()}),b?(0,$.jsx)(`div`,{className:`oc-cdefaults__inline`,children:(0,$.jsx)(L,{size:`sm`,disabled:!v.dirty||!v.valid||u===`saving`,onClick:()=>void S(),children:u===`saving`?l():k()})}):(0,$.jsx)(`p`,{className:`oc-cdefaults__note`,children:v.readOnlyReason}),b&&v.dirty&&v.invalidReason!==null?(0,$.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:v.invalidReason}):null,u===`done`&&f===null?(0,$.jsx)(`p`,{className:`oc-admin__hint`,role:`status`,children:P()}):null,f===null?null:(0,$.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:f})]})]})}function Ie({instanceName:e}){let t=C(N.knowledge.knowledgeAdminInstance,{instanceName:e}),{results:n,status:r,loadMore:i}=Ce(N.knowledge.agentKnowledgePage,{instanceName:e},{initialNumItems:50});return t===void 0||t.provider!==`openclaw`||n.length===0&&r!==`CanLoadMore`?null:(0,$.jsxs)(`section`,{className:`oc-cdefaults__row`,"aria-label":c(),children:[(0,$.jsx)(`span`,{className:`oc-cdefaults__label`,children:c()}),(0,$.jsx)(`p`,{className:`oc-admin__hint`,children:F()}),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=w(N.admin.upsertInstanceConfig),n=C(N.agents.listAgentsForInstance,{instanceName:e.name}),r=typeof e.config?.converterAgentId==`string`?e.config.converterAgentId:``,[i,a]=(0,K.useState)(r),[o,s]=(0,K.useState)(`idle`);(0,K.useEffect)(()=>{a(r),s(`idle`)},[e._id,r]);let c=`__none__`,u=i!==r;async function f(){s(`saving`);try{let n={...e.config??{}};i===``||i===c?delete n.converterAgentId:n.converterAgentId=i,await t({instanceId:e._id,config:n}),s(`done`)}catch{s(`error`)}}let p=n?.agents??[];return(0,$.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,$.jsx)(`span`,{className:`oc-cdefaults__label`,children:I()}),(0,$.jsx)(`p`,{className:`oc-admin__hint`,children:ge()}),(0,$.jsxs)(`div`,{className:`oc-cdefaults__inline`,children:[(0,$.jsxs)(U,{value:i===``?c:i,onValueChange:e=>a(e===c?``:e),children:[(0,$.jsx)(W,{className:`oc-cdefaults__select`,"aria-label":I(),children:(0,$.jsx)(B,{placeholder:d()})}),(0,$.jsxs)(G,{children:[(0,$.jsx)(V,{value:c,children:d()}),p.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:!u||o===`saving`,onClick:()=>void f(),children:o===`saving`?l():k()})]}),o===`done`?(0,$.jsx)(`p`,{className:`oc-admin__hint`,role:`status`,children:P()}):null,o===`error`?(0,$.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:b()}):null]})}function Re({instance:e}){let t=w(N.admin.upsertInstanceConfig),n=e.config?.curationEnabled===!0,r=typeof e.config?.curationBudgetChars==`number`?e.config.curationBudgetChars:null,[i,a]=(0,K.useState)(n),[o,s]=(0,K.useState)(r===null?``:String(r)),[c,u]=(0,K.useState)(`idle`);(0,K.useEffect)(()=>{a(n),s(r===null?``:String(r)),u(`idle`)},[e._id,n,r]);let d=o.trim(),f=d===``?null:/^\d+$/.test(d)?Number.parseInt(d,10):NaN,p=!i||f===null||Number.isInteger(f)&&f>=4e3&&f<=6e4,m=i!==n||(f??null)!==r;async function g(){u(`saving`);try{let n={...e.config??{}};n.curationEnabled=i,!i||f===null||Number.isNaN(f)?delete n.curationBudgetChars:n.curationBudgetChars=f,await t({instanceId:e._id,config:n}),u(`done`)}catch{u(`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:i,onCheckedChange:e=>a(e===!0),"aria-label":h()}),(0,$.jsx)(`span`,{className:`oc-cdefaults__label`,children:h()})]}),(0,$.jsxs)(`div`,{className:`oc-cdefaults__inline`,children:[(0,$.jsx)(R,{type:`number`,min:4e3,max:6e4,step:1e3,placeholder:`20000`,value:o,onChange:e=>s(e.target.value),className:`oc-cdefaults__number`,"aria-invalid":!p,"aria-label":ee(),disabled:!i}),(0,$.jsx)(L,{size:`sm`,disabled:!m||!p||c===`saving`,onClick:()=>void g(),children:c===`saving`?l():k()})]}),p?null:(0,$.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:ne()}),c===`done`?(0,$.jsx)(`p`,{className:`oc-admin__hint`,role:`status`,children:P()}):null,c===`error`?(0,$.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:b()}):null,(0,$.jsx)(`p`,{className:`oc-cdefaults__help`,children:ie()})]})}function ze({instance:e}){let t=w(N.admin.upsertInstanceConfig),n=typeof e.config?.summarizeThresholdChars==`number`?e.config.summarizeThresholdChars:null,[r,i]=(0,K.useState)(n===null?``:String(n)),[a,s]=(0,K.useState)(`idle`);(0,K.useEffect)(()=>{i(n===null?``:String(n)),s(`idle`)},[e._id,n]);let c=r.trim(),u=c===``?null:/^\d+$/.test(c)?Number.parseInt(c,10):NaN,d=u===null||Number.isInteger(u)&&u>=1e3&&u<=2e5,f=(u??null)!==n;async function p(){s(`saving`);try{let n={...e.config??{}};u===null?delete n.summarizeThresholdChars:n.summarizeThresholdChars=u,await t({instanceId:e._id,config:n}),s(`done`)}catch{s(`error`)}}return(0,$.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,$.jsx)(`span`,{className:`oc-cdefaults__label`,children:o()}),(0,$.jsxs)(`div`,{className:`oc-cdefaults__inline`,children:[(0,$.jsx)(R,{type:`number`,min:1e3,max:2e5,step:1e3,placeholder:`8000`,value:r,onChange:e=>i(e.target.value),className:`oc-cdefaults__number`,"aria-invalid":!d}),(0,$.jsx)(L,{size:`sm`,disabled:!f||!d||a===`saving`,onClick:()=>void p(),children:a===`saving`?l():k()})]}),d?null:(0,$.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:le()}),a===`done`?(0,$.jsx)(`p`,{className:`oc-admin__hint`,role:`status`,children:P()}):null,a===`error`?(0,$.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:b()}):null,(0,$.jsx)(`p`,{className:`oc-cdefaults__help`,children:ye()})]})}function Be(){let e=j(N.agentFiles.getChatDefaults),[t,n]=(0,K.useState)({status:`loading`}),r=C(N.admin.listInstances,{}),[o,s]=(0,K.useState)(null);(0,K.useEffect)(()=>{!r||r.length===0||(!o||!r.some(e=>e.name===o))&&s(r[0].name)},[r,o]);let c=(r?.length??0)>1,l=r!==void 0&&r.length===0,d=C(N.compat.forInstance,o?{instanceName:o}:`skip`),f=o?Te(d,`configDefaults`):`loading`,m=f===`loading`?null:f.blocked,h=(0,K.useMemo)(()=>c&&o?{instanceName:o}:{},[c,o]),g=(0,K.useRef)(0),v=(0,K.useCallback)(async()=>{let t=++g.current;n({status:`loading`});try{let r=ke(await e(h));if(g.current!==t)return;n({status:`done`,current:r})}catch{if(g.current!==t)return;n({status:`error`})}},[e,h]);(0,K.useEffect)(()=>{m===!1&&(c&&!o||v())},[v,m,c,o]);let y=t.status===`done`?t.current:null,b=(0,K.useMemo)(()=>Oe.map(e=>({id:e,label:Ee(e)})),[]),x=(0,K.useMemo)(()=>[{id:`fast`,label:Se()},{id:`standard`,label:ve()}],[]);return(0,$.jsxs)(`div`,{className:`oc-cdefaults`,children:[(0,$.jsx)(`p`,{className:`oc-admin__hint`,children:_()}),c&&o?(0,$.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,$.jsx)(`span`,{className:`oc-cdefaults__label`,children:a()}),(0,$.jsxs)(U,{value:o,onValueChange:e=>s(e),children:[(0,$.jsx)(W,{size:`sm`,"aria-label":a(),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:u()}):f===`loading`?(0,$.jsx)(`p`,{className:`oc-admin__hint`,children:A()}):f.blocked?(0,$.jsxs)(`p`,{className:`oc-compat__blocked`,role:`status`,children:[(0,$.jsx)(we,{size:14,"aria-hidden":!0}),` `,De(f.gatewayVersion,f.provider)]}):t.status===`loading`?(0,$.jsx)(`p`,{className:`oc-admin__hint`,children:A()}):t.status===`error`?(0,$.jsxs)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:[de(),` `,(0,$.jsx)(L,{variant:`outline`,size:`sm`,onClick:()=>void v(),children:i()})]}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,$.jsx)(`span`,{className:`oc-cdefaults__label`,children:M()}),(0,$.jsx)(H,{field:`thinkingLevel`,options:b,value:y?.thinkingDefault??null,onChange:()=>{},disabled:!0,ariaLabel:M()}),(0,$.jsx)(`p`,{className:`oc-cdefaults__help`,children:se()})]}),(0,$.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,$.jsx)(`span`,{className:`oc-cdefaults__label`,children:p()}),(0,$.jsx)(H,{field:`fastMode`,options:x,value:y===null||y.fastModeDefault===null?null:y.fastModeDefault?`fast`:`standard`,onChange:()=>{},disabled:!0,ariaLabel:p()}),(0,$.jsx)(`p`,{className:`oc-cdefaults__help`,children:re()})]}),(0,$.jsx)(`p`,{className:`oc-cdefaults__note`,children:oe()})]}),(()=>{let e=r?.find(e=>e.name===(o??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,
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{GS as r,JS as i,KS as a,XS as o,YS as s,ZS as c,qS as l}from"./api-uQUQB4xy.js";import{r as u}from"./dist-BV5tiwQ7.js";import{t as d}from"./chevrons-up-down-HreDTesh.js";import{t as f}from"./button-Biq40Zpc.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-Bw4ypNNp.js";import{a as C,i as w,n as T,o as E,r as D,t as O}from"./table-DH8u2aW2.js";var k=t(e(),1);function A(e,t){return typeof e==`number`&&typeof t==`number`?e-t:typeof e==`boolean`&&typeof t==`boolean`?!!e-+!!t:String(e).localeCompare(String(t),void 0,{numeric:!0,sensitivity:`base`})}function j(e,t,n){return[...e].sort((e,r)=>{let i=t(e),a=t(r),o=i==null,s=a==null;if(o||s)return o&&s?0:o?1:-1;let c=A(i,a);return n===`asc`?c:-c})}var M=n();function N({title:e,rows:t,columns:n,rowActions:A,onAdd:N,addLabel:P=c(),bulkActions:F,emptyHint:I=o(),isExpanded:L,renderExpanded:R}){let[z,B]=(0,k.useState)(new Set),[V,H]=(0,k.useState)(null),U=t??[],W=V?n[V.index]:void 0,G=V&&W?.sort?j(U,W.sort,V.dir):U;function K(e){H(t=>!t||t.index!==e?{index:e,dir:`asc`}:t.dir===`asc`?{index:e,dir:`desc`}:null)}let q=+!!F+n.length+ +!!A,J=U.length>0&&z.size===U.length,Y=z.size>0&&!J;function X(){B(J?new Set:new Set(U.map(e=>e._id)))}function Z(e){B(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})}return(0,M.jsxs)(`div`,{className:`oc-dt`,children:[(0,M.jsxs)(`div`,{className:`oc-dt__bar`,children:[(0,M.jsx)(`h2`,{className:`oc-dt__title`,children:e}),(0,M.jsxs)(`div`,{className:`oc-dt__bar-actions`,children:[z.size>0&&F?F.map(e=>(0,M.jsxs)(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:s()}):U.length===0?(0,M.jsx)(`p`,{className:`oc-admin__hint`,children:I}):(0,M.jsxs)(O,{children:[(0,M.jsx)(C,{children:(0,M.jsxs)(E,{children:[F?(0,M.jsx)(w,{className:`w-8`,children:(0,M.jsx)(h,{"aria-label":i(),checked:J?!0:Y?`indeterminate`:!1,onCheckedChange:X})}):null,n.map((e,t)=>{let n=V?.index===t;return e.sort?(0,M.jsx)(w,{className:e.className,"aria-sort":n?V.dir===`asc`?`ascending`:`descending`:`none`,children:(0,M.jsxs)(`button`,{type:`button`,className:`oc-dt__sort`,onClick:()=>K(t),"aria-label":r({column:e.header}),children:[e.header,n?V.dir===`asc`?(0,M.jsx)(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":l(),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":a(),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{UA as t,_E as n,cE as r,gE as i,hX as a,lE as o,sE as s,t as c}from"./api-uQUQB4xy.js";import{t as l}from"./use_paginated_query-Ce4kc6WY.js";import{t as u}from"./button-Biq40Zpc.js";import{ct as d,h as f}from"./index-Bw4ypNNp.js";import{n as p,t as m}from"./trashPage-BIm71gVQ.js";var h=e();function g(){let{results:e,status:g,loadMore:_}=l(c.trash.listMyTrash,{},{initialNumItems:50}),v=f(),y=a(c.trash.restoreChat),b=a(c.trash.purgeChat),x=a(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:n({days:v})}),e.length>0?(0,h.jsx)(u,{variant:`destructive`,size:`sm`,onClick:async()=>{await S({title:r(),description:s(),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:i()}):(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-Bw4ypNNp.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,CL as o,DI as s,DL as c,EI as l,EL as u,Ef as d,FI as f,GI as p,HI as m,II as h,JI as ee,KI as g,LI as _,MI as v,NI as te,OI as ne,OL as re,PI as ie,QI as ae,RI as y,SL as b,TL as x,UI as S,VI as C,WI as w,XI as T,YI as E,ZI as D,_L as O,aL as k,bL as A,cL as j,dL as M,eL as N,fL as P,gL as F,gX as I,hL as L,hX as R,iL as z,jI as B,kI as V,lL as H,mL as oe,nL as U,oL as W,pL as G,qI as K,rL as q,sL as se,t as J,tL as ce,uL as le,vL as ue,wL as de,wf as fe,xL as pe,yL as me,zI as he}from"./api-uQUQB4xy.js";import{t as ge}from"./button-Biq40Zpc.js";import{At as _e,ct as Y}from"./index-Bw4ypNNp.js";import{t as ve}from"./DataTableShell-CeVf9eD_.js";var X=t(e(),1),Z=n(),ye={altered_words:()=>re(),incorrect:()=>c(),incoherence:()=>u(),formatting:()=>x(),latency:()=>de(),api_error:()=>o(),other:()=>b()},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:A()}):e===!1?(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-warn`,children:me()}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill`,children:`—`}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill`,children:pe()})}function be({data:e,reference:t,closeReason:n}){let i=e.snapshot,a=R(J.feedback.respondToFeedback),[o,s]=(0,X.useState)(e.thread),[c,l]=(0,X.useState)(``),[u,f]=(0,X.useState)(!1);async function p(){let t=c.trim();if(!(!t||u)){f(!0);try{await a({feedbackId:e._id,text:t}),s(e=>[...e,{authorRole:`admin`,text:t,at:Date.now()}]),l(``)}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?` · ${ue()}`:``,i.openclawModel?` · ${i.openclawModel}`:``,i.openclawRuntime?` (${i.openclawRuntime})`:``]}),t?(0,Z.jsx)(`code`,{className:`oc-fbadmin__ref`,style:{userSelect:`all`,marginLeft:`auto`},title:g(),children:t}):null]}),e.comment?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:O()}),(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:v()}),(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:F()}),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`?L():e.authorRole===`agent`?e.authorLabel??d():oe()}),(0,Z.jsx)(`span`,{className:`oc-notif__msg-text`,children:e.text})]},t))}):(0,Z.jsx)(`p`,{className:`oc-fbadmin__meta`,children:G()}),(0,Z.jsx)(`textarea`,{className:`oc-feedback__textarea`,placeholder:P(),value:c,maxLength:2e3,rows:3,onChange:e=>l(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:!c.trim()||u,children:u?M():le()})})]}),(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:H()}),(0,Z.jsx)(`pre`,{className:`oc-msg__source-pre`,children:i.messageText||j()})]}),i.clientInfo?.sourceWasOpen&&i.displayedText!==void 0?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:se()}),(0,Z.jsx)(`pre`,{className:`oc-msg__source-pre`,children:i.displayedText||j()})]}):null,i.promptText?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:W()}),(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:k({count:i.contextCount??m.length,truncated:i.contextTruncated?z():``})}),(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:q()}),(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:U()}),(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:ce()}),(0,Z.jsxs)(`p`,{className:`oc-fbadmin__env`,children:[[i.clientInfo?.language,i.clientInfo?.timezone,i.clientInfo?.theme?N({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:[r(),` `,i.clientInfo.plugins.join(`, `),(0,Z.jsxs)(`span`,{className:`oc-fbadmin__note`,children:[` `,ae()]})]}):null,i.clientInfo?.userAgent?(0,Z.jsx)(`span`,{className:`oc-fbadmin__ua`,children:i.clientInfo.userAgent}):null]})]})]})}function xe(){let e=I(J.feedback.listForAdmin,{}),t=R(J.feedback.readSnapshot),n=R(J.feedback.deleteFeedback),r=Y(),[o,c]=(0,X.useState)(null),[u,d]=(0,X.useState)({});async function g(e){if(o===e._id){c(null);return}if(!u[e._id]){let n=await t({feedbackId:e._id});d(t=>({...t,[e._id]:n}))}c(e._id)}async function v(e){await r({title:ne(),description:s(),confirmLabel:l(),destructive:!0})&&(await n({feedbackId:e._id}),o===e._id&&c(null))}return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`p`,{className:`oc-admin__hint`,children:[D(),` `,(0,Z.jsx)(`strong`,{children:T()}),` `,E()]}),(0,Z.jsx)(ve,{title:ee(),rows:e,emptyHint:K(),isExpanded:e=>o===e._id&&!!u[e._id],renderExpanded:e=>u[e._id]?(0,Z.jsx)(be,{data:u[e._id],reference:e.reference,closeReason:e.userCloseReason}):null,columns:[{header:p(),cell:e=>_e(e.at),sort:e=>e.at},{header:w(),cell:e=>Q(e.category),sort:e=>Q(e.category)},{header:S(),cell:e=>e.messageRole===`user`?m():C(),sort:e=>e.messageRole},{header:a(),cell:e=>(e.reporterEmail||e.reporterName||`—`)+(e.impersonated&&e.realOperatorEmail?` ${he({operator:e.realOperatorEmail})}`:``),sort:e=>e.reporterEmail||e.reporterName||null},{header:y(),cell:e=>(0,Z.jsx)($,{matches:e.displayedMatchesStored,sourceWasOpen:e.sourceWasOpen}),sort:e=>e.displayedMatchesStored===!1?0:e.displayedMatchesStored===!0?1:2},{header:_(),cell:e=>e.hasComment?`✎`:`—`,sort:e=>+!!e.hasComment},{header:h(),cell:e=>e.userClosedAt==null?e.resolvedAt==null?e.answered?(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-ok`,children:f()}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill`,children:ie()}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-ok`,title:e.resolvedBy??void 0,children:fe()}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-closed`,children:te()}),sort:e=>e.userClosedAt==null?e.resolvedAt==null?+!!e.answered:2:3}],rowActions:e=>[{label:o===e._id?B():i(),onSelect:()=>void g(e)},{label:V(),onSelect:()=>void v(e),variant:`destructive`}]})]})}export{xe as FeedbacksTab};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./bundle-mjs-C73ZY4La.js";import{
|
|
1
|
+
import{r as e}from"./bundle-mjs-C73ZY4La.js";import{CX as t,E as n}from"./api-uQUQB4xy.js";import{B as r,R as i,V as a,mn as o,pn as s,z as c}from"./index-Bw4ypNNp.js";import"./locales-CPjguROj.js";import"./curation-CQksaIbm.js";var l=n(`circle-question-mark`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3`,key:`1u773s`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]]),u=[`gateway-http`,`shared-fs`,`off`],d=[`inline`,`shared-fs`],f=[`reactive`,`sse`],p=`reactive`;t.object({mediaMode:t.optional(t.union(t.literal(`gateway-http`),t.literal(`shared-fs`),t.literal(`off`))),inboundMediaMode:t.optional(t.union(t.literal(`inline`),t.literal(`shared-fs`))),rehydration:t.optional(t.boolean()),mediaMaxMb:t.optional(t.number()),attachmentFixAttested:t.optional(t.boolean()),summarizeThresholdChars:t.optional(t.number()),curationEnabled:t.optional(t.boolean()),curationBudgetChars:t.optional(t.number()),converterAgentId:t.optional(t.string()),voiceEnabled:t.optional(t.boolean()),talkEnabled:t.optional(t.boolean()),widgetsEnabled:t.optional(t.boolean()),widgetPromptConfirm:t.optional(t.boolean()),voiceEngine:t.optional(t.union(t.literal(`browser`),t.literal(`gateway`))),voiceLang:t.optional(t.string()),voiceRate:t.optional(t.number()),voiceAutoRead:t.optional(t.boolean()),contentLocale:t.optional(t.string()),inboundAgentMount:t.optional(t.string()),outboundAgentMount:t.optional(t.string()),transcriptProjection:t.optional(t.union(t.literal(`off`),t.literal(`shadow`),t.literal(`on`))),promptInjections:t.optional(t.record(t.string(),t.object({enabled:t.optional(t.boolean()),template:t.optional(t.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,Af as r,CY as i,DY as te,EY as ne,JJ as re,KJ as ie,QJ as ae,SY as oe,TY as a,XJ as o,YJ as s,ZJ as c,_V as l,_Y as se,aY as ce,bY as le,cX as ue,cY as de,dY as u,eY as d,fY as f,gX as fe,gY as p,hX as pe,hY as m,iY as me,kf as he,lY as ge,mY as h,nY as _e,oX as ve,oY as ye,pY as g,qJ as be,rY as xe,sY as Se,t as _,tY as v,uY as y,vY as b,wY as x,xY as S,yY as C}from"./api-uQUQB4xy.js";import{t as w}from"./button-Biq40Zpc.js";import{An as T,Bt as E,Gt as D,Ht as O,In as k,Jt as A,Kt as j,Mt as Ce,St as M,Ut as we,Vt as Te,Wt as Ee,Yt as De,an as Oe,bt as N,en as ke,nn as P,nr as F,qt as Ae,tn as je,tr as Me,vt as I,xt as L,yt as R}from"./index-Bw4ypNNp.js";import{a as Ne,i as z,n as Pe,o as B,r as V,t as Fe}from"./table-DH8u2aW2.js";var H=t(e(),1),U=n(),W=`all`;function G(e){switch(e){case`image`:return p();case`audio`:return m();case`video`:return h();case`pdf`:return g();case`document`:return f();case`archive`:return u();default:return y()}}function K(){let[e,t]=(0,H.useState)(W),[n,u]=(0,H.useState)(W),[f,p]=(0,H.useState)(W),[m,h]=(0,H.useState)(W),[g,y]=(0,H.useState)(!1),[K,q]=(0,H.useState)(null),J=pe(_.files.softDelete),Y=De();function Ie(){t(W),u(W),p(W),h(W)}async function Le(){let e=K;if(q(null),e)try{await J({fileId:e.id}),Y.success(ee())}catch(e){Y.error(ae(),e)}}let X=fe(_.files.listMine,{direction:e===W?void 0:e,chatId:n===W?void 0:n,instanceName:f===W?void 0:f,category:m===W?void 0:m,includeAutoGenerated:g||void 0}),Re=(0,H.useMemo)(()=>new Intl.DateTimeFormat(ue(),{dateStyle:`medium`,timeStyle:`short`}),[]);if(X===void 0)return(0,U.jsx)(`p`,{className:`oc-admin__hint`,children:ve()});let{files:Z,facets:Q,truncated:ze,cap:Be}=X,$=e!==W||n!==W||f!==W||m!==W;return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`p`,{className:`oc-admin__hint`,children:te()}),(0,U.jsxs)(`div`,{className:`oc-files__filters`,style:{display:`flex`,flexWrap:`wrap`,gap:8,margin:`12px 0`},children:[(0,U.jsxs)(I,{value:e,onValueChange:t,children:[(0,U.jsx)(L,{size:`sm`,"aria-label":ne(),children:(0,U.jsx)(M,{})}),(0,U.jsxs)(R,{children:[(0,U.jsx)(N,{value:W,children:a()}),(0,U.jsx)(N,{value:`inbound`,children:x()}),(0,U.jsx)(N,{value:`outbound`,children:i()})]})]}),(0,U.jsxs)(I,{value:n,onValueChange:u,children:[(0,U.jsx)(L,{size:`sm`,"aria-label":oe(),children:(0,U.jsx)(M,{})}),(0,U.jsxs)(R,{children:[(0,U.jsx)(N,{value:W,children:S()}),Q.chats.map(e=>(0,U.jsx)(N,{value:e.id,children:e.title},e.id))]})]}),Q.multiProvider?(0,U.jsxs)(I,{value:f,onValueChange:p,children:[(0,U.jsx)(L,{size:`sm`,"aria-label":le(),children:(0,U.jsx)(M,{})}),(0,U.jsxs)(R,{children:[(0,U.jsx)(N,{value:W,children:C()}),Q.instances.map(e=>(0,U.jsx)(N,{value:e,children:e},e))]})]}):null,(0,U.jsxs)(I,{value:m,onValueChange:h,children:[(0,U.jsx)(L,{size:`sm`,"aria-label":b(),children:(0,U.jsx)(M,{})}),(0,U.jsxs)(R,{children:[(0,U.jsx)(N,{value:W,children:se()}),Q.categories.map(e=>(0,U.jsx)(N,{value:e,children:G(e)},e))]})]}),(0,U.jsxs)(`label`,{className:`oc-files__autogen`,children:[(0,U.jsx)(Ce,{checked:g,onCheckedChange:e=>y(e===!0),"aria-label":r()}),(0,U.jsx)(`span`,{children:r()})]}),$?(0,U.jsxs)(w,{variant:`ghost`,size:`sm`,onClick:Ie,style:{display:`inline-flex`,alignItems:`center`,gap:4,marginLeft:`auto`},children:[(0,U.jsx)(k,{size:14,"aria-hidden":!0}),_e()]}):null]}),Z.length===0?(0,U.jsx)(`p`,{className:`oc-admin__hint`,children:$?be():re()}):(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(Fe,{children:[(0,U.jsx)(Ne,{children:(0,U.jsxs)(B,{children:[(0,U.jsx)(z,{children:ge()}),(0,U.jsx)(z,{children:de()}),(0,U.jsx)(z,{children:Se()}),(0,U.jsx)(z,{children:ye()}),(0,U.jsx)(z,{children:ce()}),(0,U.jsx)(z,{className:`text-right`,children:me()})]})}),(0,U.jsx)(Pe,{children:Z.map(e=>(0,U.jsxs)(B,{children:[(0,U.jsxs)(V,{className:`font-medium`,style:{maxWidth:280,overflow:`hidden`,textOverflow:`ellipsis`},title:e.filename,children:[e.filename,e.origin===`pasted`?(0,U.jsx)(A,{variant:`outline`,style:{marginLeft:6},children:he()}):null]}),(0,U.jsx)(V,{title:e.mimeType,children:G(e.category)}),(0,U.jsx)(V,{children:(0,U.jsx)(A,{variant:`secondary`,children:e.direction===`inbound`?x():i()})}),(0,U.jsx)(V,{style:{maxWidth:220,overflow:`hidden`,textOverflow:`ellipsis`},title:e.chatTitle,children:e.chatTitle}),(0,U.jsx)(V,{className:`whitespace-nowrap text-muted-foreground`,children:Re.format(e.createdAt)}),(0,U.jsx)(V,{className:`text-right`,children:(0,U.jsxs)(ke,{children:[(0,U.jsx)(Oe,{asChild:!0,children:(0,U.jsx)(w,{variant:`ghost`,size:`icon`,"aria-label":v(),children:(0,U.jsx)(Me,{size:16})})}),(0,U.jsxs)(je,{align:`end`,children:[e.url?(0,U.jsx)(P,{asChild:!0,children:(0,U.jsxs)(`a`,{href:e.url,download:e.filename,target:`_blank`,rel:`noopener noreferrer`,children:[(0,U.jsx)(F,{size:14}),xe()]})}):(0,U.jsxs)(P,{disabled:!0,children:[(0,U.jsx)(F,{size:14}),s()]}),(0,U.jsxs)(P,{variant:`destructive`,onSelect:()=>q({id:e._id,filename:e.filename}),children:[(0,U.jsx)(T,{size:14}),d()]})]})]})})]},e._id))})]}),ze?(0,U.jsx)(`p`,{className:`oc-admin__hint`,style:{marginTop:8},children:ie({cap:Be})}):null]}),(0,U.jsx)(E,{open:K!==null,onOpenChange:e=>!e&&q(null),children:(0,U.jsxs)(we,{children:[(0,U.jsxs)(j,{children:[(0,U.jsx)(Ae,{children:c()}),(0,U.jsx)(Ee,{children:o()})]}),(0,U.jsxs)(D,{children:[(0,U.jsx)(O,{children:l()}),(0,U.jsx)(Te,{onClick:()=>void Le(),children:d()})]})]})})]})}export{K as FilesTab};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$S as r,QS as i}from"./api-uQUQB4xy.js";import{t as a}from"./button-Biq40Zpc.js";import{$t as o,Fn as s,In as c}from"./index-Bw4ypNNp.js";import{t as l}from"./TimeRangePicker-CMNe-waP.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};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$b as r,$v as i,$y as a,Ab as o,Ay as s,Bb as c,Bv as l,By as u,Cb as d,Cy as f,Db as p,Dy as m,E as h,Eb as g,Ey as _,Fb as v,Gb as y,Gy as b,Hb as x,Hv as S,Hy as C,Ib as w,Iy as T,Jb as ee,Jy as E,Kb as D,Ky as O,Lb as te,Ly as k,Mb as A,My as j,Nb as ne,Ob as re,Oy as ie,Pb as M,Qb as ae,Qv as N,Qy as oe,Rb as se,Ry as ce,Sb as P,Sy as le,Tb as ue,Ty as F,Ub as de,Uv as fe,Uy as pe,Vb as me,Vv 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 I,Zb as we,Zv as Te,Zy as Ee,_b as De,_y as Oe,ab as ke,ay 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 Re,fy as ze,gX as L,gb as Be,gy as Ve,hX as R,hb as z,hy as He,ib as Ue,iy as We,jb as Ge,jy as Ke,kb as qe,ky as Je,lb as Ye,ly as Xe,mb as Ze,my as Qe,nb as $e,ny as et,ob as tt,oy as nt,pb as rt,py as it,qb as at,qy as ot,rb as st,ry as ct,sb as lt,sy as ut,t as B,tb as dt,ty as ft,ub as pt,uy as mt,vy as ht,wb as V,wy as gt,xb as _t,xy as vt,yy as yt,zb as bt,zy as xt}from"./api-uQUQB4xy.js";import{t as St}from"./x-CfpsHFMp.js";import{t as H}from"./button-Biq40Zpc.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-Bw4ypNNp.js";import{t as nn}from"./FilterBar-CdYSlKIB.js";import{t as rn}from"./DataTableShell-CeVf9eD_.js";import{t as X}from"./DetailChips-tXOC1zN0.js";var an=h(`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=L(B.groups.listGroups,{}),t=L(B.me.getMe,{host:Kt})?.role===`admin`,n=R(B.groups.createGroup),i=R(B.groups.updateGroup),a=R(B.groups.deleteGroup),o=Wt(),s=J(),[l,u]=(0,Z.useState)(!1),[d,f]=(0,Z.useState)(null),[p,m]=(0,Z.useState)(on),[h,g]=(0,Z.useState)(null),[_,b]=(0,Z.useState)(``),S=(0,Z.useMemo)(()=>{if(!e)return e;let t=_.trim().toLowerCase();return t?e.filter(e=>e.name.toLowerCase().includes(t)||(e.description??``).toLowerCase().includes(t)||e.members.some(e=>e.label.toLowerCase().includes(t))||e.agents.some(e=>e.toLowerCase().includes(t))||e.charts.some(e=>e.name.toLowerCase().includes(t))):e},[e,_]);function C(){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 i({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){s.error(E(),e)}}async function j(e){if(await o({title:M({name:e.name}),description:ne(),confirmWord:e.name,confirmLabel:A(),cancelLabel:c(),destructive:!0}))try{await a({groupId:e._id})}catch(e){s.error(ot(),e)}}return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:ae()}),t?(0,Q.jsx)(pn,{}):null,(0,Q.jsx)(nn,{q:_,onQChange:b,onReset:()=>b(``),canReset:_!==``,searchPlaceholder:y()}),(0,Q.jsx)(rn,{title:r(),rows:S,addLabel:we(),onAdd:t?C:void 0,emptyHint:ye(),columns:[{header:Se(),cell:e=>e.name,sort:e=>e.name},{header:ee(),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:T({count:String(e.pendingInviteCount)})}):null]}),sort:e=>e.memberCount},{header:at(),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:D(),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:_e(),onSelect:()=>g({groupId:e._id,name:e.name})},...t?[{label:de(),onSelect:()=>O(e)},{label:x(),variant:`destructive`,onSelect:()=>void j(e)}]:[]]}),(0,Q.jsx)(Vt,{open:l,onOpenChange:u,title:d?se():bt(),description:te(),canSubmit:!!p.name.trim(),onSubmit:k,submitLabel:me(),children:(0,Q.jsxs)(`div`,{className:`oc-form`,children:[(0,Q.jsxs)(`label`,{className:`oc-field`,children:[(0,Q.jsx)(`span`,{className:`oc-field__label`,children:w()}),(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:v()}),(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||g(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}),d()]}),(0,Q.jsxs)(`span`,{className:`oc-access__pageinfo`,"aria-label":_t({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:[P(),(0,Q.jsx)(Xt,{size:14,"aria-hidden":!0})]})]})}function ln({groupId:e,groupName:t,open:n,onOpenChange:r}){let i=L(B.groups.getGroup,n&&e?{groupId:e}:`skip`),a=i?.viewerIsAdmin===!0,s=L(B.groups.listAssignableInstances,n&&e?{groupId:e}:`skip`),c=L(B.groups.listAssignableUsers,n&&a?{}:`skip`),l=R(B.groups.addMember),u=R(B.groups.removeMember),d=R(B.groups.bulkSetMembers),f=R(B.groups.setGroupManager),h=J(),[v,y]=(0,Z.useState)(``),[b,x]=(0,Z.useState)(``),[S,C]=(0,Z.useState)(`members`),[w,T]=(0,Z.useState)(1),[ee,E]=(0,Z.useState)(null),[D,te]=(0,Z.useState)(new Set),k=(0,Z.useRef)(null),A=(0,Z.useMemo)(()=>new Set((i?.members??[]).map(e=>e.userId)),[i]),j=(0,Z.useMemo)(()=>new Set((i?.members??[]).filter(e=>e.manager).map(e=>e.userId)),[i]),ne=(0,Z.useMemo)(()=>new Set((i?.members??[]).filter(e=>e.restricted).map(e=>e.userId)),[i]),M=(0,Z.useMemo)(()=>new Set((i?.agents??[]).map(e=>q(e.instanceName,e.agentId))),[i]),ae=(0,Z.useMemo)(()=>{let e=(i?.agents??[]).find(e=>e.isDefault);return e?q(e.instanceName,e.agentId):null},[i]);(0,Z.useEffect)(()=>{y(``),x(``),C(`members`),T(1),E(null),k.current=null},[n,e]),(0,Z.useEffect)(()=>{T(1)},[v]),(0,Z.useEffect)(()=>{n&&i&&e&&k.current!==e&&(k.current=e,te(new Set((i.members??[]).map(e=>e.userId))))},[n,i,e]);let N=(0,Z.useMemo)(()=>c?Yt(c,v,D):[],[c,v,D]);async function se(t,n){if(e)try{n?await u({groupId:e,userId:t}):await l({groupId:e,userId:t})}catch(e){h.error(O(),W(e))}}async function ce(t,n){if(e)try{await f({groupId:e,userId:t,manager:!n})}catch(e){h.error(xe(),e)}}let P=Ct(N,e=>A.has(e.userId)),le=N.filter(e=>A.has(e.userId)).length,F=zt(N,w,$);async function de(){if(!e||N.length===0)return;let t=N.map(e=>e.userId);try{await d({groupId:e,userIds:t,member:P!==`all`})}catch(e){h.error(O(),W(e))}}let fe=(e,t)=>(0,Q.jsxs)(H,{type:`button`,variant:`ghost`,size:`sm`,className:`h-7`,"aria-label":m({user:t}),title:m({user:t}),onClick:()=>E({userId:e,label:t}),children:[(0,Q.jsx)(At,{size:13,"aria-hidden":!0}),ie()]});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:Ge({name:t})}),(0,Q.jsx)(It,{children:i&&!a?ve():o()})]}),(0,Q.jsxs)(qt,{value:S,onValueChange:C,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}),qe(),i?(0,Q.jsx)(G,{variant:`secondary`,className:`oc-access__tabcount`,children:A.size}):null]}),(0,Q.jsxs)(Zt,{value:`agents`,className:`flex-1 gap-1.5`,children:[(0,Q.jsx)(Nt,{size:13,"aria-hidden":!0}),p(),i?(0,Q.jsx)(G,{variant:`secondary`,className:`oc-access__tabcount`,children:M.size}):null]}),(0,Q.jsxs)(Zt,{value:`charts`,className:`flex-1 gap-1.5`,children:[(0,Q.jsx)(an,{size:13,"aria-hidden":!0}),lt(),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:z()}):a?c===void 0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:z()}):c.length===0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:rt()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(U,{value:v,onChange:e=>y(e.target.value),placeholder:re(),className:`oc-access__search`}),N.length===0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:ue()}):(0,Q.jsxs)(Q.Fragment,{children:[N.length>1?(0,Q.jsxs)(`div`,{className:`oc-access__row oc-access__selectall`,children:[(0,Q.jsx)(K,{checked:P===`all`?!0:P===`some`?`indeterminate`:!1,onCheckedChange:()=>void de(),"aria-label":V()}),(0,Q.jsx)(`span`,{className:`oc-access__label`,children:V()}),(0,Q.jsxs)(G,{variant:`outline`,className:`oc-access__count`,children:[le,` / `,N.length]})]}):null,(0,Q.jsx)(`div`,{className:`oc-access__list`,children:F.pageItems.map(e=>{let t=A.has(e.userId),n=Gt(e),r=j.has(e.userId);return(0,Q.jsxs)(`div`,{className:`oc-access__row`,children:[(0,Q.jsx)(K,{checked:t,onCheckedChange:()=>void se(e.userId,t),"aria-label":De({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&&ne.has(e.userId)?(0,Q.jsx)(G,{variant:`outline`,className:`oc-access__role`,children:_()}):null,(0,Q.jsx)(G,{variant:`outline`,className:`oc-access__role`,children:Pt(e.role)}),t?fe(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?Ee():oe(),title:r?Ee():oe(),onClick:()=>void ce(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:T})]})]}):e?(0,Q.jsx)(un,{groupId:e,members:i.members,agentsButton:fe}):null}),(0,Q.jsxs)(Bt,{value:`agents`,children:[i&&!a?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:Oe()}):null,s===void 0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:z()}):s.length===0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:Re()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(U,{value:b,onChange:e=>x(e.target.value),placeholder:g(),className:`oc-access__search`}),(0,Q.jsx)(`div`,{className:`oc-access__list`,children:s.map(t=>(0,Q.jsx)(fn,{groupId:e,instanceName:t.name,kind:t.kind??`openclaw`,assigned:M,defaultKey:ae,viewerIsAdmin:a,query:b},`${e}-${t._id}`))})]})]}),(0,Q.jsx)(Bt,{value:`charts`,children:(0,Q.jsx)(mn,{groupId:e})})]}),(0,Q.jsx)(dn,{groupId:e,member:ee,onOpenChange:e=>{e||E(null)}})]})})}function un({groupId:e,members:t,agentsButton:n}){let r=L(B.groupInvites.listGroupInviteRequests,{groupId:e}),i=R(B.groupInvites.requestGroupInvite),o=R(B.groups.removeMember),l=Wt(),d=J(),[f,p]=(0,Z.useState)(``),[m,h]=(0,Z.useState)(1),g=zt(t,m,$);async function v(t){t.preventDefault();let n=f.trim();if(n)try{await i({groupId:e,email:n}),p(``),d.success(xt())}catch(e){d.error(ce(),e)}}async function y(t,n){if(await l({title:j({user:n}),description:s({user:n}),confirmLabel:Je(),cancelLabel:c(),destructive:!0}))try{await o({groupId:e,userId:t})}catch(e){d.error(O(),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:f,onChange:e=>p(e.target.value),placeholder:ge(),"aria-label":pe()}),(0,Q.jsxs)(H,{type:`submit`,size:`sm`,disabled:!f.trim(),children:[(0,Q.jsx)(Tt,{size:14,"aria-hidden":!0}),u()]})]}),(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:C()}),t.length===0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:F()}):(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:_()}):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":a(),title:a(),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":j({user:e.label}),title:e.manager?Ke():e.lastGroup?Ce():j({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:h})]}),r!==void 0&&r.length>0?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`p`,{className:`oc-access__subhead`,children:k()}),(0,Q.jsx)(`div`,{className:`oc-access__list`,children:r.map(e=>(0,Q.jsxs)(`div`,{className:`oc-access__row`,children:[(0,Q.jsx)(`span`,{className:`oc-access__label`,title:e.email,children:e.email}),(0,Q.jsx)(G,{variant:e.status===`pending`?`secondary`:`outline`,className:`oc-access__role`,children:Rt(e.status)})]},e._id))})]}):null]})}function dn({groupId:e,member:t,onOpenChange:n}){let r=L(B.groups.getMemberAgentSettings,e&&t?{groupId:e,userId:t.userId}:`skip`),a=R(B.groups.setMemberAgents),o=R(B.groups.setMemberDefaultAgent),s=J();async function c(e){try{await e()}catch(e){s.error(be(),e)}}let u=r?.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||!r)return;let i=Lt(f,p,r.restricted,n).map(e=>{let t=d.get(e);return{instanceName:t.instanceName,agentId:t.agentId}});c(()=>a({groupId:e,userId:t.userId,agents:i}))}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:Ae({user:t?.label??``})}),(0,Q.jsx)(It,{children:We()})]}),r===void 0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:z()}):r===null||u.length===0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:Te()}):(0,Q.jsxs)(Q.Fragment,{children:[r.settable?null:(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:l()}),r.adminNarrowed?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:fe()}):null,r.restrictedByAdmin&&!r.viewerIsAdmin?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:he()}):null,(0,Q.jsxs)(`div`,{className:`oc-access__row oc-access__selectall`,children:[(0,Q.jsx)(`span`,{className:`oc-access__label`,children:r.restricted?et():ct()}),r.restricted?(0,Q.jsx)(H,{type:`button`,size:`sm`,variant:`outline`,disabled:!r.settable||r.restrictedByAdmin&&!r.viewerIsAdmin,onClick:()=>e&&t?void c(()=>a({groupId:e,userId:t.userId,agents:null})):void 0,children:ft()}):null]}),(0,Q.jsx)(`div`,{className:`oc-access__list`,children:u.map(n=>{let a=q(n.instanceName,n.agentId),s=n.displayName??n.agentId;return(0,Q.jsxs)(`div`,{className:`oc-access__row`,children:[(0,Q.jsx)(K,{checked:n.allowed,disabled:!r.settable||r.restrictedByAdmin&&!r.viewerIsAdmin&&!n.allowed,onCheckedChange:()=>m(a),"aria-label":Le({name:s})}),(0,Q.jsx)(`span`,{className:`oc-access__label`,title:s,children:s}),n.limitedByAdmin?(0,Q.jsx)(G,{variant:`outline`,className:`oc-access__role`,children:S()}):null,n.state===`deleted`?(0,Q.jsx)(G,{variant:`outline`,className:`oc-access__gone`,children:Me()}):null,n.allowed?n.isMemberDefault?(0,Q.jsx)(H,{type:`button`,size:`icon-sm`,variant:`ghost`,className:`oc-access__fav`,disabled:!r.settable,"aria-label":i(),title:i(),onClick:()=>e&&t?void c(()=>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:!r.settable,"aria-label":N(),title:N(),onClick:()=>e&&t?void c(()=>o({groupId:e,userId:t.userId,agent:{instanceName:n.instanceName,agentId:n.agentId}})):void 0,children:(0,Q.jsx)(Y,{size:14})}):null]},a)})})]})]})})}function fn({groupId:e,instanceName:t,kind:n,assigned:r,defaultKey:i,viewerIsAdmin:a,query:o}){let s=L(B.groups.listAssignableAgents,e?{instanceName:t,groupId:e}:`skip`),c=R(B.groups.assignAgentToGroup),l=R(B.groups.removeAgentFromGroup),u=R(B.groups.bulkSetGroupAgents),d=R(B.groups.claimAgentForGroup),f=R(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`),x=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(b(),W(e))}}async function ee(){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(b(),W(e))}}async function E(n){try{await d({groupId:e,instanceName:t,agentId:n})}catch(e){p.error(ze(),e)}}async function D(n){try{await f({groupId:e,agent:n===null?null:{instanceName:t,agentId:n}})}catch(e){p.error(nt(),e)}}let O=e=>e.reservedForGroup?(0,Q.jsx)(G,{variant:`outline`,className:`oc-access__role`,children:Fe()}):e.reserved?(0,Q.jsx)(G,{variant:`outline`,className:`oc-access__role`,children:e.reservedGroupName===null?Xe():mt({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:Ye()}):null]}),s===void 0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:Ze()}):g.length===0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:_?pt():Pe()}):(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 ee(),"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":Be({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,O(e),o?(0,Q.jsx)(G,{variant:`outline`,className:`oc-access__gone`,children:Me()}):null,a?i===n?(0,Q.jsx)(H,{type:`button`,size:`icon-sm`,variant:`ghost`,className:`oc-access__fav`,"aria-label":Ne(),title:Ne(),onClick:()=>void D(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":ut(),title:ut(),onClick:()=>void D(e.agentId),children:(0,Q.jsx)(Y,{size:14})}):null]},e.agentId)}),(0,Q.jsx)(cn,{page:w.page,pageCount:w.pageCount,onPage:h}),x.length>0?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`p`,{className:`oc-access__subhead`,children:Ve()}),(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:He()}),x.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":it({name:t}),onClick:()=>void E(e.agentId),children:Qe()})]},e.agentId)})]}):null]})]})}function pn(){let e=L(B.groupInvites.listPendingInviteRequests,{}),t=R(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(ht(),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??`?`,` ·`,` `,f({by:e.requestedBy})]})]}),e.account===`ready`?null:(0,Q.jsx)(G,{variant:`outline`,className:`oc-access__role`,children:e.account===`none`?je():yt()}),(0,Q.jsx)(H,{type:`button`,size:`sm`,variant:`outline`,className:`h-7`,disabled:e.account!==`ready`,onClick:()=>void r(e._id,!0),children:le()}),(0,Q.jsx)(H,{type:`button`,size:`sm`,variant:`ghost`,className:`h-7`,onClick:()=>void r(e._id,!1),children:vt()})]},e._id))})]})}function mn({groupId:e}){let t=L(B.charts.listGroupChartSelection,e?{groupId:e}:`skip`),n=R(B.charts.assignChartToGroup),r=R(B.charts.removeChartFromGroup),i=R(B.charts.setGroupDefaultChart),a=R(B.charts.addChartToGroupPool),o=R(B.charts.removeChartFromGroupPool),s=J();if(!e)return null;if(t===void 0)return(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:z()});let{pool:c,addable:l,canManagePool:u}=t;if(c.length===0&&!u)return(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:tt()});async function d(t,i){try{i?await r({groupId:e,chartKey:t}):await n({groupId:e,chartKey:t})}catch(e){s.error(I(),e)}}async function f(t){try{await i({groupId:e,chartKey:t})}catch(e){s.error(I(),e)}}async function p(t){try{await a({groupId:e,chartKey:t})}catch(e){s.error(I(),e)}}async function m(t){try{await o({groupId:e,chartKey:t})}catch(e){s.error(I(),e)}}return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`div`,{className:`oc-access__list`,children:c.map(e=>(0,Q.jsxs)(`div`,{className:`oc-access__row`,children:[(0,Q.jsx)(K,{checked:e.selected,onCheckedChange:()=>void d(e.chartKey,e.selected),"aria-label":$e({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":dt(),title:dt(),children:(0,Q.jsx)(Y,{size:14,fill:`currentColor`})}):(0,Q.jsx)(H,{type:`button`,variant:`ghost`,size:`sm`,onClick:()=>void f(e.chartKey),children:Ie()}):null,u?(0,Q.jsx)(H,{type:`button`,variant:`ghost`,size:`sm`,"aria-label":st({name:e.name}),title:st({name:e.name}),onClick:()=>void m(e.chartKey),children:(0,Q.jsx)(St,{size:14,"aria-hidden":!0})}):null]},e.chartKey))}),u?l.length>0?(0,Q.jsxs)(Qt,{value:``,onValueChange:e=>void p(e),children:[(0,Q.jsx)(en,{size:`sm`,className:`oc-access__search`,children:(0,Q.jsx)(Ft,{placeholder:Ue()})}),(0,Q.jsx)(tn,{children:l.map(e=>(0,Q.jsx)(Ht,{value:e.chartKey,children:e.name},e.chartKey))})]}):c.length===0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:ke()}):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,AF as a,AP as o,BF as s,BP as c,Bk as l,Bp as u,CF as d,CP as f,D as p,DF as m,DP as h,EF as g,EP as _,F as v,FF as ee,FP as y,GF as b,GP as x,HF as te,HP as S,IF as ne,IP as C,JF as re,JP as w,KF as ie,KP as T,LF as ae,LP as E,Lp as D,Lv as O,M as oe,MF as se,N as ce,NF as le,NP as k,O as ue,OF as de,OP as fe,P as pe,PF as me,PP as he,QF as ge,QP as _e,RF as ve,RP as ye,Rp as be,Rv as xe,SF as Se,SP as Ce,TF as we,TP as Te,UF as Ee,UP as De,VF as Oe,VP as ke,Vk as Ae,WF as je,WP as Me,XF as Ne,XP as Pe,YF as Fe,YP as Ie,ZF as Le,ZP as Re,_F as ze,_P as Be,aF as Ve,aP as He,ao as Ue,au as We,bF as Ge,bP as Ke,cF as qe,cP as Je,cn as Ye,co as Xe,dF as Ze,dP as Qe,dU as $e,dn as et,do as tt,eF as nt,eo as rt,fF as it,fP as at,fU as A,fn as ot,fo as st,gF as ct,gP as lt,gX as j,gn as ut,go as dt,hF as ft,hP as pt,hX as M,hn as mt,ho as ht,iF as gt,iP as _t,io as vt,j as yt,jF as bt,jP as xt,k as St,kF as Ct,kP as wt,lF as Tt,lP as Et,ln as Dt,lo as Ot,mF as kt,mP as At,mn as jt,mo as Mt,nF as Nt,no as Pt,oF as Ft,oP as It,oo as Lt,ou 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,sF as Jt,sP as Yt,sn as Xt,so as Zt,su as Qt,t as P,tF as $t,to as en,uF as tn,uP as nn,un as rn,uo as an,vF as on,vP as sn,wF as cn,wP as ln,xF as un,xP as dn,yF as fn,yP as pn,zF as mn,zP as hn,zp as gn,zv as _n}from"./api-uQUQB4xy.js";import{a as vn,c as yn}from"./FieldLabel-BBpaaMpJ.js";import{t as F}from"./button-Biq40Zpc.js";import{$t as I,Ct as bn,Dt as xn,J as L,Jt as R,Mt as z,Ot as B,St as V,Tt as H,Yt as U,b as Sn,bt as W,cn as Cn,ct as wn,on as Tn,sn as En,vt as G,wt as K,xt as q,yt as J}from"./index-Bw4ypNNp.js";import{t as Dn}from"./DataTableShell-CeVf9eD_.js";import{InstanceConfigDialog as On}from"./BridgeTab-DFyIKDyv.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:vn,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=j(P.admin.listInstances,{}),t=j(P.agents.listAllInstanceAgents,{}),n=M(P.admin.upsertInstance),r=M(P.widgets.setInstanceWidgets),o=M(P.admin.deleteInstance),c=U(),[u,f]=(0,Y.useState)(!1),[h,_]=(0,Y.useState)(Q),[y,x]=(0,Y.useState)(null),[S,C]=(0,Y.useState)(null),[w,T]=(0,Y.useState)(null),[E,D]=(0,Y.useState)(null);async function O(){try{let t=await n({instanceId:E??void 0,name:h.name,gatewayUrl:h.gatewayUrl,bridgeUrl:h.bridgeUrl||void 0,displayName:h.displayName||void 0,kind:h.kind,transport:h.kind===`hermes`?h.transport:void 0,gatewayVersion:h.gatewayVersion||void 0,gatewayHttpUrl:h.gatewayHttpUrl||void 0,...h.kind===`openclaw`?{authMode:h.authMode,personScopes:h.personScopes,identitySource:h.identitySource,participantIdentity:h.participantIdentity,managePermissionModes:h.managePermissionModes,systemIdentity:h.systemIdentity||void 0}:{},streamTransport:h.streamTransport}),i=E===null?null:e?.find(e=>e._id===E),a=i?.config?.widgetsEnabled!==!1,o=i?.config?.widgetPromptConfirm===!0;h.kind===`openclaw`&&(h.widgetsEnabled!==a||h.widgetPromptConfirm!==o)&&await r({instanceId:t,enabled:h.widgetsEnabled,promptConfirm:h.widgetPromptConfirm}),_(Q),D(null),f(!1)}catch(e){c.error(Ne(),e)}}return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`p`,{className:`oc-admin__hint`,children:[Fe(),(0,Z.jsx)(`strong`,{children:re()}),Ut()]}),(0,Z.jsx)(Dn,{title:ie(),rows:e,addLabel:b(),onAdd:()=>{D(null),_(Q),f(!0)},emptyHint:je(),columns:[{header:Ee(),cell:e=>e.name,sort:e=>e.name},{header:te(),cell:e=>(0,Z.jsx)(R,{variant:`outline`,children:e.kind??`openclaw`}),sort:e=>e.kind??`openclaw`},{header:Oe(),cell:e=>e.gatewayUrl,sort:e=>e.gatewayUrl},{header:s(),cell:e=>e.displayName??`—`,sort:e=>e.displayName??null},{header:ge(),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)(R,{variant:r(e.agentId)?`default`:`outline`,title:r(e.agentId)?nn():void 0,children:[e.emoji?`${e.emoji} `:``,e.displayName??e.agentId]},e.agentId))})}}],rowActions:e=>[{label:ne(),onSelect:()=>{D(e._id),_(Nn(e)),f(!0)}},{label:Le(),onSelect:()=>x(e.name)},{label:un(),onSelect:()=>T(e)},{label:mn(),onSelect:()=>C(e)},{label:ve(),variant:`destructive`,onSelect:()=>void o({instanceId:e._id})}],bulkActions:[{label:ve(),variant:`destructive`,onSelect:e=>e.forEach(e=>void o({instanceId:e}))}]}),(0,Z.jsx)(Sn,{open:u,onOpenChange:f,title:E?ee():ae(),description:le(),canSubmit:!!(h.name&&h.gatewayUrl),onSubmit:O,submitLabel:se(),children:(0,Z.jsxs)(`div`,{className:`oc-form`,children:[(0,Z.jsxs)($,{label:bt(),children:[(0,Z.jsx)(I,{value:h.name,disabled:E!==null,onChange:e=>_({...h,name:e.target.value})}),E?(0,Z.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:me()}):null]}),(0,Z.jsx)($,{label:a(),children:(0,Z.jsxs)(G,{value:h.kind,onValueChange:e=>_({...h,kind:e}),children:[(0,Z.jsx)(q,{size:`sm`,className:`w-full`,children:(0,Z.jsx)(V,{})}),(0,Z.jsxs)(J,{children:[(0,Z.jsx)(W,{value:`openclaw`,children:`OpenClaw`}),(0,Z.jsx)(W,{value:`hermes`,children:`Hermes`})]})]})}),h.kind===`hermes`?(0,Z.jsx)($,{label:Qt(),children:(0,Z.jsxs)(G,{value:h.transport,onValueChange:e=>_({...h,transport:e}),children:[(0,Z.jsx)(q,{size:`sm`,className:`w-full`,children:(0,Z.jsx)(V,{})}),(0,Z.jsxs)(J,{children:[(0,Z.jsx)(W,{value:`ws`,children:Rt()}),(0,Z.jsx)(W,{value:`rest`,children:We()})]})]})}):null,(0,Z.jsx)($,{label:Ct(),children:(0,Z.jsx)(I,{value:h.gatewayUrl,onChange:e=>_({...h,gatewayUrl:e.target.value})})}),(0,Z.jsx)($,{label:de(),children:(0,Z.jsx)(I,{value:h.bridgeUrl,placeholder:m(),onChange:e=>_({...h,bridgeUrl:e.target.value})})}),(0,Z.jsx)($,{label:g(),children:(0,Z.jsx)(I,{value:h.displayName,onChange:e=>_({...h,displayName:e.target.value})})}),(0,Z.jsxs)($,{label:Ae(),children:[(0,Z.jsxs)(G,{value:h.streamTransport,onValueChange:e=>_({...h,streamTransport:e}),children:[(0,Z.jsx)(q,{size:`sm`,className:`w-full`,children:(0,Z.jsx)(V,{})}),(0,Z.jsx)(J,{children:yn.map(e=>(0,Z.jsx)(W,{value:e,children:e},e))})]}),(0,Z.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:l()})]}),(0,Z.jsx)($,{label:we(),children:(0,Z.jsx)(I,{value:h.gatewayVersion,placeholder:cn(),onChange:e=>_({...h,gatewayVersion:e.target.value})})}),h.kind===`openclaw`?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)($,{label:Lt(),children:[(0,Z.jsxs)(G,{value:h.authMode,onValueChange:e=>_({...h,authMode:e}),children:[(0,Z.jsx)(q,{size:`sm`,className:`w-full`,children:(0,Z.jsx)(V,{})}),(0,Z.jsxs)(J,{children:[(0,Z.jsx)(W,{value:`token`,children:Ue()}),(0,Z.jsx)(W,{value:`trusted-proxy`,children:vt()})]})]}),(0,Z.jsx)(`p`,{className:`oc-field__hint`,children:h.authMode===`trusted-proxy`?Pt():qt()})]}),h.authMode===`trusted-proxy`?(0,Z.jsxs)($,{label:dt(),children:[(0,Z.jsxs)(G,{value:h.personScopes,onValueChange:e=>_({...h,personScopes:e}),children:[(0,Z.jsx)(q,{size:`sm`,className:`w-full`,children:(0,Z.jsx)(V,{})}),(0,Z.jsxs)(J,{children:[(0,Z.jsx)(W,{value:`capped`,children:ht()}),(0,Z.jsx)(W,{value:`full`,children:Mt()})]})]}),(0,Z.jsx)(`p`,{className:`oc-field__hint`,children:h.personScopes===`full`?st():Ht()})]}):null,h.authMode===`trusted-proxy`?(0,Z.jsxs)($,{label:tt(),children:[(0,Z.jsxs)(G,{value:h.identitySource,onValueChange:e=>_({...h,identitySource:e}),children:[(0,Z.jsx)(q,{size:`sm`,className:`w-full`,children:(0,Z.jsx)(V,{})}),(0,Z.jsxs)(J,{children:[(0,Z.jsx)(W,{value:`canonical`,children:an()}),(0,Z.jsx)(W,{value:`email`,children:Ot()})]})]}),(0,Z.jsx)(`p`,{className:`oc-field__hint`,children:h.identitySource===`email`?Zt():Xe()})]}):null,h.authMode===`trusted-proxy`?(0,Z.jsxs)($,{label:ut(),children:[(0,Z.jsxs)(G,{value:h.participantIdentity,onValueChange:e=>_({...h,participantIdentity:e}),children:[(0,Z.jsx)(q,{size:`sm`,className:`w-full`,children:(0,Z.jsx)(V,{})}),(0,Z.jsxs)(J,{children:[(0,Z.jsx)(W,{value:`owner`,children:mt()}),(0,Z.jsx)(W,{value:`self`,children:jt()})]})]}),(0,Z.jsx)(`p`,{className:`oc-field__hint`,children:h.participantIdentity===`self`?Xt():Vt()})]}):null,h.kind===`openclaw`?(0,Z.jsxs)($,{label:ot(),children:[(0,Z.jsxs)(G,{value:h.managePermissionModes?`on`:`off`,onValueChange:e=>_({...h,managePermissionModes:e===`on`}),children:[(0,Z.jsx)(q,{size:`sm`,className:`w-full`,children:(0,Z.jsx)(V,{})}),(0,Z.jsxs)(J,{children:[(0,Z.jsx)(W,{value:`off`,children:et()}),(0,Z.jsx)(W,{value:`on`,children:rn()})]})]}),(0,Z.jsx)(`p`,{className:`oc-field__hint`,children:h.managePermissionModes?Ye():Dt()})]}):null,h.kind===`openclaw`?(0,Z.jsxs)($,{label:v(),children:[(0,Z.jsxs)(G,{value:h.widgetsEnabled?`on`:`off`,onValueChange:e=>_({...h,widgetsEnabled:e===`on`}),children:[(0,Z.jsx)(q,{size:`sm`,className:`w-full`,children:(0,Z.jsx)(V,{})}),(0,Z.jsxs)(J,{children:[(0,Z.jsx)(W,{value:`on`,children:pe()}),(0,Z.jsx)(W,{value:`off`,children:ce()})]})]}),(0,Z.jsx)(`p`,{className:`oc-field__hint`,children:h.widgetsEnabled?oe():yt()})]}):null,h.kind===`openclaw`&&h.widgetsEnabled?(0,Z.jsxs)($,{label:i(),children:[(0,Z.jsxs)(G,{value:h.widgetPromptConfirm?`on`:`off`,onValueChange:e=>_({...h,widgetPromptConfirm:e===`on`}),children:[(0,Z.jsx)(q,{size:`sm`,className:`w-full`,children:(0,Z.jsx)(V,{})}),(0,Z.jsxs)(J,{children:[(0,Z.jsx)(W,{value:`off`,children:St()}),(0,Z.jsx)(W,{value:`on`,children:ue()})]})]}),(0,Z.jsx)(`p`,{className:`oc-field__hint`,children:p()})]}):null,h.authMode===`trusted-proxy`?(0,Z.jsx)($,{label:en(),children:(0,Z.jsx)(I,{value:h.systemIdentity,placeholder:rt(),onChange:e=>_({...h,systemIdentity:e.target.value})})}):null]}):null,(0,Z.jsx)($,{label:d(),children:(0,Z.jsx)(I,{value:h.gatewayHttpUrl,placeholder:Se(),onChange:e=>_({...h,gatewayHttpUrl:e.target.value})})})]})}),(0,Z.jsx)(Wn,{instanceName:y,open:y!==null,onOpenChange:e=>{e||x(null)}}),S?(0,Z.jsx)(On,{instance:S,onClose:()=>C(null)},S._id):null,w?(0,Z.jsx)(Fn,{instance:w,onClose:()=>T(null)},w._id):null]})}function Fn({instance:e,onClose:t}){let n=j(P.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)(bn,{open:!0,onOpenChange:e=>!e&&t(),children:(0,Z.jsxs)(K,{onOpenAutoFocus:e=>e.preventDefault(),children:[(0,Z.jsxs)(xn,{children:[(0,Z.jsx)(B,{children:Ge({instance:e.displayName??e.name})}),(0,Z.jsx)(H,{children:fn()})]}),(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=N(P.instanceSync.forceInstanceSync),n=U(),[i,a]=(0,Y.useState)(!1);async function o(){if(!i){a(!0);try{switch((await t({instanceId:e._id})).status){case`synced`:n.success(r());break;case`no_agents`:n.success(Re());break;case`no_bridge_url`:n.error(Pe());break;case`deploy_misconfigured`:n.error(Ie());break;case`unauthorized`:n.error(Wt());break;case`not_served`:n.error(T());break;default:n.error(w());break}}catch(e){n.error(_e(),e)}finally{a(!1)}}}return(0,Z.jsxs)(`div`,{className:`oc-form`,children:[(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:x()}),(0,Z.jsx)(`div`,{className:`flex items-center gap-2`,children:(0,Z.jsx)(F,{size:`sm`,variant:`outline`,onClick:()=>void o(),disabled:i,children:i?nt():$t()})})]})}function Ln({instance:e}){let t=j(P.bridgeAuth.listBridgeAuthStatus,{}),n=N(P.bridgeAuth.mintBridgeSecret),r=M(P.bridgeAuth.revokeBridgeSecret),i=U(),[a,o]=(0,Y.useState)(!1),[s,l]=(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{l((await n({instanceId:e._id})).plaintext),d(!1)}catch(e){i.error(ye(),e)}finally{o(!1)}}}async function h(){if(!a){o(!0);try{await r({instanceId:e._id}),l(null),i.success(hn())}catch(e){i.error(ye(),e)}finally{o(!1)}}}async function g(){if(s)try{await navigator.clipboard.writeText(s),d(!0)}catch{}}return(0,Z.jsxs)($,{label:Me(),children:[(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:De()}),(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Z.jsx)(R,{variant:p?`outline`:`secondary`,children:p?`${ft()} · ${f.prefix}…${f.lastFour}`:kt()}),(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(F,{size:`sm`,onClick:()=>void m(),disabled:a,children:p?ke():S()}),p?(0,Z.jsx)(F,{size:`sm`,variant:`destructive`,onClick:()=>void h(),disabled:a,children:c()}):null]})]}),s?(0,Z.jsxs)(`div`,{className:`oc-bridgesecret__reveal`,children:[(0,Z.jsx)(`p`,{className:`oc-sa__minted-warning`,children:E()}),(0,Z.jsxs)(`div`,{className:`oc-sa__minted-box`,children:[(0,Z.jsx)(`code`,{className:`oc-sa__minted-plain`,children:s}),(0,Z.jsx)(F,{variant:`outline`,size:`sm`,onClick:()=>void g(),children:u?A():$e()})]}),(0,Z.jsx)(F,{size:`sm`,variant:`ghost`,onClick:()=>{l(null),d(!1)},children:C()})]}):null]})}function Rn({instanceId:e,field:t,updatedAt:n}){let r=N(P.instanceSecrets.setInstanceSecret),i=M(P.instanceSecrets.clearInstanceSecret),a=N(P.deviceIdentity.generateDeviceIdentity),o=U(),[s,c]=(0,Y.useState)(``),[l,u]=(0,Y.useState)(!1),[d,f]=(0,Y.useState)(null),[p,m]=(0,Y.useState)(!1),h=n!==null,g=t===`deviceIdentity`,_=t===`token`?on():t===`deviceIdentity`?ze():ct();async function v(){if(!(!s.trim()||l)){u(!0);try{await r({instanceId:e,field:t,plaintext:s}),c(``),f(null),m(!1),o.success(Tt())}catch(e){o.error(qe(),e)}finally{u(!1)}}}async function ee(){if(!l){u(!0);try{await i({instanceId:e,field:t}),f(null),m(!1),o.success(Jt())}catch(e){o.error(qe(),e)}finally{u(!1)}}}async function y(){if(!l){u(!0);try{f(await a({instanceId:e})),m(!1),o.success(gt())}catch(e){o.error(Nt(),e)}finally{u(!1)}}}let b=d?`openclaw devices approve ${d.id}`:``;async function x(){if(b)try{await navigator.clipboard.writeText(b),m(!0)}catch{}}return(0,Z.jsxs)($,{label:_,children:[g?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:Ve()}):null,(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Z.jsx)(R,{variant:h?`outline`:`secondary`,children:h?ft():kt()}),(0,Z.jsx)(I,{type:`password`,autoComplete:`off`,className:`flex-1 min-w-32`,value:s,placeholder:h?it():zt(),onChange:e=>c(e.target.value)}),(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(F,{size:`sm`,onClick:()=>void v(),disabled:l||s.trim().length===0,children:Ze()}),g?(0,Z.jsx)(F,{size:`sm`,variant:`outline`,onClick:()=>void y(),disabled:l,children:Ft()}):null,h?(0,Z.jsx)(F,{size:`sm`,variant:`destructive`,onClick:()=>void ee(),disabled:l,children:tn()}):null]})]}),d?(0,Z.jsxs)(`div`,{className:`oc-bridgesecret__reveal`,children:[(0,Z.jsx)(`p`,{className:`text-sm font-medium`,children:gt()}),(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:Gt()}),(0,Z.jsxs)(`div`,{className:`oc-sa__minted-box`,children:[(0,Z.jsx)(`code`,{className:`oc-sa__minted-plain`,children:b}),(0,Z.jsx)(F,{variant:`outline`,size:`sm`,onClick:()=>void x(),children:p?A():$e()})]}),(0,Z.jsx)(F,{size:`sm`,variant:`ghost`,onClick:()=>{f(null),m(!1)},children:C()})]}):null]})}var zn={conversational:Te,documentary:f,summarizer:u,curator:be},Bn={conversational:ln,documentary:Ce,summarizer:gn,curator:D},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:wt()}),t.map(e=>(0,Z.jsx)(R,{variant:`secondary`,className:`oc-agenttype__chip`,title:Hn(e),children:Vn(e)},e)),(0,Z.jsxs)(Tn,{children:[(0,Z.jsx)(Cn,{asChild:!0,children:(0,Z.jsx)(F,{type:`button`,variant:`outline`,size:`sm`,className:`h-7`,children:fe()})}),(0,Z.jsxs)(En,{align:`start`,className:`oc-agenttypes-pop`,children:[(0,Z.jsx)(`p`,{className:`oc-agenttypes-pop__title`,children:h()}),(0,Z.jsx)(`p`,{className:`oc-agenttypes-pop__hint`,children:_()}),(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)(z,{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=j(P.agents.listAgentsForInstance,t&&e?{instanceName:e}:`skip`),i=M(P.agents.setAgentEnabled).withOptimisticUpdate((e,{instanceName:t,agentId:n,enabled:r})=>{let i=e.getQuery(P.agents.listAgentsForInstance,{instanceName:t});i&&e.setQuery(P.agents.listAgentsForInstance,{instanceName:t},{...i,agents:i.agents.map(e=>e.agentId===n?{...e,enabled:r}:e)})}),a=M(P.agents.setInstanceDefaultAgent).withOptimisticUpdate((e,{instanceName:t,agentId:n})=>{let r=e.getQuery(P.agents.listAgentsForInstance,{instanceName:t});r&&e.setQuery(P.agents.listAgentsForInstance,{instanceName:t},{...r,defaultAgentId:n})}),o=M(P.agents.setAgentTypes).withOptimisticUpdate((e,{instanceName:t,agentId:n,types:r})=>{let i=e.getQuery(P.agents.listAgentsForInstance,{instanceName:t});if(!i)return;let a=jn(r);e.setQuery(P.agents.listAgentsForInstance,{instanceName:t},{...i,agents:i.agents.map(e=>e.agentId===n?{...e,types:a}:e)})}),s=M(P.agents.setAgentDescription).withOptimisticUpdate((e,{instanceName:t,agentId:n,description:r})=>{let i=e.getQuery(P.agents.listAgentsForInstance,{instanceName:t});if(!i)return;let a=r.trim();e.setQuery(P.agents.listAgentsForInstance,{instanceName:t},{...i,agents:i.agents.map(e=>e.agentId===n?{...e,description:a.length===0?null:a}:e)})}),c=M(P.agents.removeInstanceAgent),l=M(P.agents.setAgentReservation),u=j(P.groups.listGroupLabels,t?{}:`skip`),d=wn(),f=U();async function p(t,n){if(e&&await d({title:It({name:n}),description:He(),confirmLabel:Yt()}))try{await l({instanceName:e,agentId:t,groupId:null})}catch(e){f.error(k(),L(e))}}async function m(t,n,r){if(!e)return;let i=(u??[]).find(e=>e._id===r)?.name??`?`;if(await d({title:_n({name:n,group:i}),description:xe({group:i}),confirmLabel:O()}))try{await l({instanceName:e,agentId:t,groupId:r})}catch(e){f.error(k(),L(e))}}async function h(t,n){if(e)try{await i({instanceName:e,agentId:t,enabled:n})}catch(e){f.error(k(),e)}}async function g(t){if(e)try{await a({instanceName:e,agentId:t})}catch(e){f.error(k(),e)}}async function _(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){f.error(k(),e)}}async function v(t,n){if(e&&await d({title:pn({name:n}),description:sn(),confirmLabel:Be(),destructive:!0}))try{await c({instanceName:e,agentId:t}),f.success(lt())}catch(e){f.error(k(),e)}}return(0,Z.jsx)(bn,{open:t,onOpenChange:n,children:(0,Z.jsxs)(K,{className:`oc-access`,children:[(0,Z.jsxs)(xn,{children:[(0,Z.jsx)(B,{children:y({name:e??``})}),(0,Z.jsx)(H,{children:he()})]}),r===void 0?(0,Z.jsx)(`p`,{className:`oc-access__hint`,children:pt()}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`div`,{className:`oc-access__poll`,children:r.discovery===null?At():r.discovery.lastPollOk?Bt():at({error:r.discovery.error??`?`})}),r.agents.length===0?(0,Z.jsx)(`p`,{className:`oc-access__hint`,children:Qe()}):(0,Z.jsx)(`div`,{className:`oc-access__list`,children:r.agents.map(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)(z,{checked:t.enabled,disabled:n,"aria-label":a,onCheckedChange:e=>void h(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)(R,{variant:`outline`,children:t.reserved.groupName===null?Je():Et({group:t.reserved.groupName})}):null,n?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(R,{variant:`outline`,className:`oc-access__gone`,children:Kt()}),(0,Z.jsx)(F,{size:`sm`,variant:`ghost`,className:`h-7 text-destructive`,onClick:()=>void v(t.agentId,a),children:Ke()})]}):i?(0,Z.jsx)(R,{variant:`default`,children:nn()}):(0,Z.jsx)(F,{size:`sm`,variant:`outline`,className:`h-7`,disabled:!t.enabled||t.reserved!==null,onClick:()=>void g(t.agentId),children:dn()})]}),t.reserved?(0,Z.jsxs)(`div`,{className:`oc-agentcard__head`,children:[(0,Z.jsx)(F,{size:`sm`,variant:`outline`,className:`h-7`,onClick:()=>void p(t.agentId,a),children:Yt()}),(0,Z.jsxs)(G,{value:``,onValueChange:e=>void m(t.agentId,a,e),children:[(0,Z.jsx)(q,{size:`sm`,className:`h-7`,children:(0,Z.jsx)(V,{placeholder:_t()})}),(0,Z.jsx)(J,{children:(u??[]).filter(e=>e._id!==t.reserved?.groupId).map(e=>(0,Z.jsx)(W,{value:e._id,children:e.name},e._id))})]})]}):null,t.enabled?(0,Z.jsx)(Un,{agentId:t.agentId,types:o,onToggle:e=>void _(t.agentId,e,o)}):null,t.enabled?(0,Z.jsx)(Gn,{value:t.description??``,onSave:async n=>{if(e)try{await s({instanceName:e,agentId:t.agentId,description:n})}catch(e){f.error(k(),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)(I,{className:`oc-agentcard__desc`,value:n,maxLength:280,placeholder:xt(),"aria-label":o(),onChange:e=>r(e.target.value),onBlur:i,onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),i())}})}function $({label:e,children:t}){return(0,Z.jsxs)(`label`,{className:`oc-field`,children:[(0,Z.jsx)(`span`,{className:`oc-field__label`,children:e}),t]})}export{Pn as InstancesTab};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$m as r,AL as i,BL as a,FL as o,HL as s,IL as c,LL as l,ML as u,NL as d,PL as f,RL as p,UL as m,VL as h,ah as g,eh as _,gX as v,hX as y,ih as b,jL as x,nh as S,oh as C,pX as w,rh as T,sh as E,t as D,th as O,zL as k}from"./api-uQUQB4xy.js";import{t as A}from"./button-Biq40Zpc.js";import{$t as j,Jt as M,Mt as N}from"./index-Bw4ypNNp.js";var P=t(e(),1),F=n();function I(){let e=v(D.integrations.status.status,{}),t=y(D.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:m()});let _=n,b=(e,t,n)=>r({..._,[e]:{..._[e],[t]:n}}),S=(e,n)=>void t({[e]:n});return(0,F.jsxs)(F.Fragment,{children:[(0,F.jsxs)(`p`,{className:`oc-admin__hint`,children:[s(),` `,(0,F.jsx)(`strong`,{children:h()}),` `,a()]}),(0,F.jsxs)(L,{title:`Langfuse`,status:e.langfuse.configured?e.langfuse.enabled?(0,F.jsx)(M,{variant:`secondary`,children:k()}):(0,F.jsx)(M,{variant:`outline`,children:p()}):(0,F.jsx)(M,{variant:`outline`,children:l()}),note:c(),children:[(0,F.jsx)(R,{label:f(),children:(0,F.jsx)(j,{value:_.langfuse.host??``,placeholder:e.langfuse.effectiveHost,onChange:e=>b(`langfuse`,`host`,e.target.value),onBlur:()=>S(`langfuse`,{host:_.langfuse.host??``})})}),(0,F.jsx)(z,{label:i(),checked:_.langfuse.enabled??!0,onChange:e=>{b(`langfuse`,`enabled`,e),S(`langfuse`,{enabled:e})}})]}),(0,F.jsxs)(L,{title:`Opik`,status:e.opik.configured?e.opik.enabled?(0,F.jsx)(M,{variant:`secondary`,children:k()}):(0,F.jsx)(M,{variant:`outline`,children:p()}):(0,F.jsx)(M,{variant:`outline`,children:l()}),note:o(),children:[(0,F.jsx)(R,{label:d(),children:(0,F.jsx)(j,{value:_.opik.baseUrl??``,placeholder:e.opik.effectiveBaseUrl,onChange:e=>b(`opik`,`baseUrl`,e.target.value),onBlur:()=>S(`opik`,{baseUrl:_.opik.baseUrl??``})})}),(0,F.jsx)(R,{label:u(),children:(0,F.jsx)(j,{value:_.opik.workspace??``,placeholder:e.opik.effectiveWorkspace||x(),onChange:e=>b(`opik`,`workspace`,e.target.value),onBlur:()=>S(`opik`,{workspace:_.opik.workspace??``})})}),(0,F.jsx)(z,{label:i(),checked:_.opik.enabled??!0,onChange:e=>{b(`opik`,`enabled`,e),S(`opik`,{enabled:e})}})]}),(0,F.jsxs)(L,{title:`OpenTelemetry (OTLP)`,status:e.otlp.configured?e.otlp.enabled?(0,F.jsx)(M,{variant:`secondary`,children:k()}):(0,F.jsx)(M,{variant:`outline`,children:p()}):(0,F.jsx)(M,{variant:`outline`,children:E()}),note:C(),children:[(0,F.jsx)(R,{label:g(),children:(0,F.jsx)(j,{value:_.otlp.endpoint??``,placeholder:e.otlp.effectiveEndpoint||`https://otlp.example.com/v1/traces`,onChange:e=>b(`otlp`,`endpoint`,e.target.value),onBlur:()=>S(`otlp`,{endpoint:_.otlp.endpoint??``})})}),(0,F.jsx)(B,{headersSet:e.otlp.headersSet}),(0,F.jsx)(z,{label:i(),checked:_.otlp.enabled??!0,onChange:e=>{b(`otlp`,`enabled`,e),S(`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=w(D.integrations.otlpSecret.setOtlpHeaders),n=y(D.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:b(),children:[(0,F.jsx)(j,{value:i,placeholder:e?T():S(),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:O()}),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:r()})]})}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,FR as i,GD as a,GR as o,IR as s,JD as c,KD as l,KR as u,QD as d,UR as ee,WD as f,WR as p,XD as m,YD as te,ZD as h,_z as ne,eO as re,gX as g,iO as _,nO as v,qD as y,rO as b,t as x,tO as S}from"./api-uQUQB4xy.js";import{dr as C,fr as w,ft as ie,i as ae,o as T,r as E}from"./index-Bw4ypNNp.js";import{a as D,n as O,o as k,r as A,t as j}from"./card-AFUQEzoT.js";import{n as M,t as N}from"./TimeRangePicker-CMNe-waP.js";var P=t(e(),1),F={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`},I=Object.keys(F).length,L=n(),R=15,z=e=>String(Math.round(e));function B(){let e=g(x.me.getMe,{host:ie})?.permissions?.includes(`traces.read`)??!1,t=g(x.deliveryTiming.listDeliverySessions,e?{}:`skip`),n=(0,P.useMemo)(()=>t?t.filter(e=>!e.active&&e.rollup!==null&&e.rollup.cP50!==null&&e.rollup.aP50!==null).slice(0,R).reverse().map(e=>({startedAt:e.startedAt,cP50:e.rollup?.cP50,aP50:e.rollup?.aP50})):[],[t]);return t===void 0?null:(0,L.jsxs)(`section`,{className:`oc-kpi__group`,children:[(0,L.jsx)(`h2`,{className:`oc-kpi__group-title`,children:ne()}),(0,L.jsxs)(j,{children:[(0,L.jsxs)(D,{children:[(0,L.jsx)(k,{children:u()}),(0,L.jsx)(A,{children:p()})]}),(0,L.jsx)(O,{children:n.length<2?(0,L.jsx)(`p`,{className:`oc-admin__hint`,children:ee()}):(0,L.jsx)(V,{series:n})})]})]})}function V({series:e}){let t=e.map(e=>e.cP50),n=e.map(e=>e.aP50),r=Math.max(1,...t,...n),a=t=>6+t*468/(e.length-1),c=e=>74-e*68/r,l=e=>e.map((e,t)=>`${t===0?`M`:`L`}${a(t).toFixed(1)},${c(e).toFixed(1)}`).join(` `),d=e[e.length-1];return(0,L.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,L.jsxs)(`div`,{className:`flex gap-3 text-xs text-muted-foreground`,children:[(0,L.jsxs)(`span`,{style:{color:`var(--primary)`},children:[i(),` p50 `,z(d.cP50),` `,o()]}),(0,L.jsxs)(`span`,{children:[s(),` p50 `,z(d.aP50),` `,o()]})]}),(0,L.jsxs)(`svg`,{viewBox:`0 0 480 80`,className:`h-20 w-full`,preserveAspectRatio:`none`,role:`img`,"aria-label":u(),children:[(0,L.jsx)(`path`,{d:l(n),fill:`none`,style:{stroke:`var(--muted-foreground)`},strokeWidth:1.5}),(0,L.jsx)(`path`,{d:l(t),fill:`none`,style:{stroke:`var(--primary)`},strokeWidth:1.5})]})]})}var H=[{metric:`api.calls`,label:_(),unit:`/h`,group:`API`,isError:!1},{metric:`api.errors`,label:b(),unit:`/h`,group:`API`,isError:!0},{metric:`api.latency.avg_ms`,label:v(),unit:`ms`,group:`API`,isError:!1},{metric:`openclaw.ingest`,label:S(),unit:`/h`,group:`OpenClaw`,isError:!1},{metric:`chat.send`,label:re(),unit:`/h`,group:`Chat`,isError:!1},{metric:F.ASSISTANT_STREAM_ERRORS,label:r(),unit:`/h`,group:`Assistant`,isError:!0},{metric:F.ASSISTANT_ANNOUNCE_ERRORS,label:d(),unit:`/h`,group:`Assistant`,isError:!0}],U=I,W=[`API`,`OpenClaw`,`Chat`,`Assistant`],G=1e3,K=36e5;function q(e,t){let n=Math.max(1,Math.ceil((t-e)/K)),r=Math.min(n*U,G);return{rowLimit:r,buckets:Math.max(1,Math.floor(r/U))}}function J(){let e=w({from:`/settings/kpi`}),t=C({from:`/settings/kpi`}),n=ae(e.from,e.to,E,`now`),r=e=>void t({search:t=>({...t,...T(e)})}),{from:i,to:a}=M(n),{rowLimit:o,buckets:s}=q(i,a),l=g(x.kpi.listKpis,{limit:o,filter:{from:i,to:a}}),u=(0,P.useMemo)(()=>{let e=new Map;for(let t of l??[]){let n=e.get(t.metric)??[];n.push({bucket:t.bucket,value:t.value}),e.set(t.metric,n)}for(let[t,n]of e)n.sort((e,t)=>e.bucket<t.bucket?-1:+(e.bucket>t.bucket)),n.length>s&&e.set(t,n.slice(n.length-s));return e},[l,s]),d=(0,L.jsxs)(L.Fragment,{children:[(0,L.jsxs)(`p`,{className:`oc-admin__hint`,children:[h(),` `,(0,L.jsx)(`span`,{className:`oc-filter__window`,children:m()})]}),(0,L.jsx)(Y,{value:n,onChange:r})]});return l===void 0?(0,L.jsxs)(L.Fragment,{children:[d,(0,L.jsx)(B,{}),(0,L.jsx)(`p`,{className:`oc-admin__hint`,children:te()})]}):l.length===0?(0,L.jsxs)(L.Fragment,{children:[d,(0,L.jsx)(B,{}),(0,L.jsx)(`p`,{className:`oc-admin__hint`,children:c()})]}):(0,L.jsxs)(L.Fragment,{children:[d,(0,L.jsx)(B,{}),W.map(e=>{let t=H.filter(t=>t.group===e);return t.some(e=>(u.get(e.metric)??[]).length>0)?(0,L.jsxs)(`section`,{className:`oc-kpi__group`,children:[(0,L.jsx)(`h2`,{className:`oc-kpi__group-title`,children:e}),(0,L.jsx)(`div`,{className:`oc-kpi__grid`,children:t.map(e=>(0,L.jsx)(oe,{config:e,series:u.get(e.metric)??[]},e.metric))})]},e):null})]})}function Y({value:e,onChange:t}){return(0,L.jsx)(`div`,{className:`oc-kpi__toolbar`,children:(0,L.jsx)(N,{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,L.jsxs)(j,{size:`sm`,className:`oc-kpi__card`,children:[(0,L.jsxs)(D,{children:[(0,L.jsx)(k,{className:`oc-kpi__card-title`,children:e.label}),(0,L.jsx)(A,{className:`oc-kpi__card-metric`,children:(0,L.jsx)(`code`,{children:e.metric})})]}),(0,L.jsxs)(O,{className:`oc-kpi__card-body`,children:[(0,L.jsxs)(`div`,{className:`oc-kpi__value-row`,children:[(0,L.jsx)(`span`,{className:`oc-kpi__value`+(e.isError&&r>0?` oc-kpi__value--error`:``),children:Q(r)}),(0,L.jsx)(`span`,{className:`oc-kpi__unit`,children:e.unit})]}),(0,L.jsx)(ce,{series:t,isError:e.isError,unit:e.unit}),(0,L.jsxs)(`div`,{className:`oc-kpi__axis`,children:[n?(0,L.jsx)(`span`,{className:`oc-kpi__axis-latest`,children:y({value:$(n.bucket)})}):(0,L.jsx)(`span`,{className:`oc-kpi__muted`,children:l()}),(0,L.jsx)(`span`,{className:`oc-kpi__muted`,children:a({count:t.length})})]})]})]})}var X=240,Z=48,se=1;function ce({series:e,isError:t,unit:n}){if(e.length===0)return(0,L.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,L.jsx)(`svg`,{className:`oc-kpi__chart`,viewBox:`0 0 ${X} ${Z}`,preserveAspectRatio:`none`,role:`img`,"aria-label":f({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,L.jsx)(`rect`,{className:`oc-kpi__bar`+(t&&e.value>0?` oc-kpi__bar--error`:``),x:c,y:l,width:a,height:s,children:(0,L.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{J 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,AW as i,AY as a,BW as o,BY as s,DW as c,EW as l,FW as u,FY as d,GW as f,GY as ee,HW as p,HY as te,IW as ne,IY as re,JW as ie,JY as ae,KW as oe,KY as se,LW as m,LY as ce,MF as le,MW as ue,MY as de,NW as h,NY as fe,OW as pe,PW as me,PY as he,QW as ge,QY as _e,RW as ve,RY as g,TW as _,UW as v,UY as y,VW as b,VY as x,WW as S,WY as C,XW as w,XY as T,YW as E,YY as D,ZW as O,ZY as k,aG as A,ac as j,bc as M,cG as N,eG as P,ec as F,gX as I,hX as L,hc as ye,iG as be,ic as xe,jW as R,jY as Se,kW as Ce,kY as we,lG as Te,nG as Ee,nc as De,oG as Oe,oX as ke,oc as Ae,qW as je,qY as Me,r as z,rG as Ne,rc as Pe,sG as Fe,sc as Ie,t as B,tG as Le,tX as Re,tc as ze,wW as Be,xc as Ve,zW as He,zY as Ue}from"./api-uQUQB4xy.js";import{t as V}from"./button-Biq40Zpc.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-Bw4ypNNp.js";import{t as et}from"./localePickerView-C2RmOS86.js";import{t as tt}from"./TimezoneCombobox-BR5ScfJS.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:()=>Te()},{id:`composer`,label:()=>N()},{id:`sidebar`,label:()=>Fe()},{id:`notifications`,label:()=>S()},{id:`other`,label:()=>Oe()}],X={showSource:{category:`messages`,label:()=>A(),help:()=>be()},showReport:{category:`messages`,label:()=>Ne(),help:()=>Ee()},copyAssistant:{category:`messages`,label:()=>Le()},copyUser:{category:`messages`,label:()=>P()},showDelete:{category:`messages`,label:()=>r()},showTools:{category:`messages`,label:()=>ge(),help:()=>O()},voiceInput:{category:`composer`,label:()=>w(),help:()=>E()},showUsage:{category:`composer`,label:()=>ie(),help:()=>je()},autoReadAloud:{category:`composer`,label:()=>Ve(),help:()=>M()},showChatAge:{category:`sidebar`,label:()=>oe(),help:()=>f()},notifSound:{category:`notifications`,label:()=>v(),help:()=>p()},notifSystem:{category:`notifications`,label:()=>b(),help:()=>o()},replySound:{category:`notifications`,label:()=>He(),help:()=>ve()}};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:()=>pe()};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:ue()}),(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:_()}),(0,J.jsx)(G,{value:`inherit`,children:Be()})]})]}),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":R()}),R()]}):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,i]=(0,q.useState)(!1),[a,o]=(0,q.useState)(!1);return(0,q.useEffect)(()=>{if(!r)return;let e=e=>{if(e.preventDefault(),e.stopPropagation(),e.key===`Escape`){i(!1);return}let t=Ye(e);if(t===null){[`Shift`,`Control`,`Meta`,`Alt`].includes(e.key)||(o(!0),window.setTimeout(()=>o(!1),1800));return}i(!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:[Ie(),e?(0,J.jsx)(U,{variant:`secondary`,children:Ge(e,qe())}):null]}),(0,J.jsx)(`span`,{className:`oc-prefs__help`,children:a?xe():r?j():Ae()})]}),(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:()=>i(e=>!e),children:r?ze():e?De():Pe()})]})]})}function ft(){let[e,t]=(0,q.useState)(``),[n,r]=(0,q.useState)(!1),a=I(B.me.getMe,{host:K}),o=a?.ui,s=$(a?.role)&&n,l=L(B.me.setUiPref).withOptimisticUpdate(We),d=(0,q.useMemo)(()=>o?Q(Object.keys(o.effective),e):[],[o,e]);return o?(0,J.jsxs)(`div`,{className:`oc-prefs-panel`,children:[$(a?.role)?(0,J.jsxs)(`label`,{className:`oc-prefs__gov-toggle`,children:[(0,J.jsx)(W,{checked:n,onCheckedChange:e=>r(e===!0),"aria-label":h()}),h()]}):null,s?(0,J.jsxs)(`div`,{className:`oc-prefs__gov-head`,children:[(0,J.jsx)(`p`,{children:i()}),(0,J.jsx)(`p`,{children:Ce()}),(0,J.jsx)(`p`,{children:c()})]}):null,(0,J.jsx)(H,{value:e,onChange:e=>t(e.target.value),placeholder:m(),"aria-label":m(),className:`mb-2`}),d.length===0?(0,J.jsx)(`div`,{className:`oc-prefs__empty`,children:ne()}):(0,J.jsx)(`div`,{className:`oc-prefs`,children:d.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],c=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:u()}):c?(0,J.jsx)(U,{variant:`secondary`,children:ye()}):null]}),r?(0,J.jsx)(`span`,{className:`oc-prefs__help`,children:r}):null]}),(0,J.jsxs)(`div`,{className:`oc-prefs__ctl`,children:[!i&&c?(0,J.jsx)(`button`,{type:`button`,className:`oc-prefs__reset`,onClick:()=>void l({key:e,value:null}),children:me()}):null,(0,J.jsx)(nt,{checked:a,disabled:i,onCheckedChange:t=>{e===`notifSystem`&&t&&typeof Notification<`u`&&Notification.permission==="default"&&Notification.requestPermission(),l({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:a?.dictationShortcut??null,enabled:o.effective.voiceInput===!0})]}):(0,J.jsx)(`div`,{className:`oc-prefs__empty`,children:ke()})}var pt={sm:()=>s(),md:()=>Ue(),lg:()=>g(),xl:()=>ce(),"2xl":()=>re(),"3xl":()=>d()};function mt(){let e=I(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),o=Je(),s=e?.locale??`default`,c=e?.name??``,[l,u]=(0,q.useState)(null),d=l??c,f=d.trim()!==c.trim();async function p(){try{await i({name:d}),u(null),o.success(ae())}catch(e){o.error(Me(),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:_e()}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:k()})]}),(0,J.jsxs)(`div`,{className:`oc-show__row`,children:[(0,J.jsx)(H,{className:`max-w-xs`,value:d,maxLength:120,placeholder:T(),onChange:e=>u(e.target.value),onKeyDown:e=>{e.key===`Enter`&&f&&(e.preventDefault(),p())}}),(0,J.jsx)(V,{size:`sm`,disabled:!f,onClick:()=>void p(),children:le()})]}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:D()})]}),(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:se()}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:ee()})]}),(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:Re()})]}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:C()})]}),(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:he()}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:fe()})]}),(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:de()})]}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:Se()})]}),(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:y()}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:te()})]}),(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:x()})]}),(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:a()}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:we()})]}),(0,J.jsx)(ft,{})]})]})}export{mt as PreferencesTab};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$E as r,BE as i,CE as a,DD as o,DE as s,Do as c,E as l,ED as u,FE as d,GE as ee,HE as f,IE as te,JE as p,KE as m,NE as h,Oo as g,PE as ne,QE as re,RE as ie,RT as _,SE as ae,TD as oe,TE as v,UE as se,VE as ce,WE as le,XE as ue,YE as de,ZE as fe,_D as pe,aD as y,bD as b,bE as me,cD as he,dD as ge,eD as _e,fD as ve,gX as x,hX as S,iD as ye,kE as be,mC as xe,mD as C,nD as Se,oD as w,oX as T,qE as E,rD as Ce,t as D,vD as we,vE as O,wE as k,xD as Te,xE as Ee,yE as De,zE as A}from"./api-uQUQB4xy.js";import{r as Oe}from"./dist-BV5tiwQ7.js";import{t as ke}from"./list-C1mXgOwS.js";import{t as j}from"./button-Biq40Zpc.js";import{$n as Ae,$t as M,A as N,An as je,Bn as P,C as F,D as Me,E as Ne,Gn as Pe,I as Fe,Kn as Ie,M as Le,N as Re,O as ze,P as I,Qn as Be,S as Ve,T as He,Un as L,Vn as Ue,Xn as R,Yt as We,Zn as Ge,_ as Ke,_t as qe,an as Je,b as Ye,ct as Xe,d as Ze,dr as z,en as Qe,er as $e,f as et,fr as tt,g as nt,gt as B,h as rt,ht as V,in as it,j as H,k as at,lt as ot,mt as st,nn as U,p as ct,pr as W,pt as lt,rn as ut,sr as dt,tn as ft,tr as pt,v as G,w as K,x as q,y as mt,zn as ht}from"./index-Bw4ypNNp.js";var gt=l(`columns-3`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M9 3v18`,key:`fh3hqa`}],[`path`,{d:`M15 3v18`,key:`14nvp0`}]]),_t=l(`folder-input`,[[`path`,{d:`M2 9V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2v-1`,key:`fm4g5t`}],[`path`,{d:`M2 13h10`,key:`pgb2dq`}],[`path`,{d:`m9 16 3-3-3-3`,key:`6m91ic`}]]),vt=l(`layout-grid`,[[`rect`,{width:`7`,height:`7`,x:`3`,y:`3`,rx:`1`,key:`1g98yp`}],[`rect`,{width:`7`,height:`7`,x:`14`,y:`3`,rx:`1`,key:`6d4xhi`}],[`rect`,{width:`7`,height:`7`,x:`14`,y:`14`,rx:`1`,key:`nxv5o0`}],[`rect`,{width:`7`,height:`7`,x:`3`,y:`14`,rx:`1`,key:`1bb6yr`}]]),J=l(`panel-left`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M9 3v18`,key:`fh3hqa`}]]),Y=t(e(),1),X=n();function yt({className:e}){return(0,X.jsx)(Je,{asChild:!0,children:(0,X.jsx)(j,{variant:`ghost`,size:`icon-xs`,"aria-label":v(),className:e,onClick:e=>e.stopPropagation(),onMouseDown:e=>e.stopPropagation(),onTouchStart:e=>e.stopPropagation(),onPointerDown:e=>e.stopPropagation(),children:(0,X.jsx)(pt,{})})})}function Z({folderId:e,name:t,color:n,currentParentId:i,className:a,onOpen:c}){let l=S(D.projects.renameProject),ee=S(D.projects.setProjectColor),f=S(D.projects.moveProject),te=S(D.projects.deleteProject),p=S(D.projects.createProject),m=Xe(),g=rt(),ne=ot(),[re,ie]=(0,Y.useState)(!1),[_,ae]=(0,Y.useState)(t),[v,se]=(0,Y.useState)(!1),[ce,le]=(0,Y.useState)(!1),ue=x(D.projects.projectTreeCount,ce?{projectId:e}:`skip`);return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(Qe,{onOpenChange:e=>e&&le(!0),children:[(0,X.jsx)(yt,{className:a}),(0,X.jsxs)(ft,{align:`end`,className:`w-48`,onClick:e=>e.stopPropagation(),children:[(0,X.jsxs)(U,{onSelect:()=>c(),children:[(0,X.jsx)(Be,{}),` `,he()]}),(0,X.jsxs)(U,{onSelect:()=>{ae(t),ie(!0)},children:[(0,X.jsx)(Ue,{}),` `,k()]}),(0,X.jsxs)(U,{onSelect:()=>{requestAnimationFrame(async()=>{let t=await ne({title:r(),label:o(),placeholder:u(),confirmLabel:oe()});t&&await p({name:t,parentId:e})})},children:[(0,X.jsx)(Ge,{}),` `,r()]}),(0,X.jsxs)(U,{onSelect:()=>se(!0),children:[(0,X.jsx)(_t,{}),` `,d()]}),(0,X.jsx)(ut,{children:Ee()}),(0,X.jsxs)(`div`,{className:`oc-colorgrid`,onClick:e=>e.stopPropagation(),children:[(0,X.jsx)(`button`,{className:`oc-colorgrid__none`,onClick:()=>void ee({projectId:e,color:null}),"aria-label":me(),children:`✕`}),Ke.map(t=>(0,X.jsx)(`button`,{className:`oc-colorgrid__dot`+(n===t.value?` is-selected`:``),style:{background:t.hue},"aria-label":t.value,onClick:()=>void ee({projectId:e,color:t.value})},t.value))]}),(0,X.jsx)(it,{}),(0,X.jsxs)(U,{variant:`destructive`,onSelect:()=>{requestAnimationFrame(async()=>{let n=ue?.folders??0,r=ue?.chats??0;await m({title:ge({name:t}),description:ct({folders:n,chats:r,days:g}),confirmWord:s(),confirmLabel:ve(),destructive:!0})&&await te({projectId:e})})},children:[(0,X.jsx)(je,{}),` `,s()]})]})]}),(0,X.jsx)(Ye,{open:re,onOpenChange:ie,title:pe(),canSubmit:_.trim().length>0,onSubmit:async()=>{await l({projectId:e,name:_.trim()}),ie(!1)},submitLabel:k(),children:(0,X.jsx)(M,{value:_,onChange:e=>ae(e.target.value),autoFocus:!0})}),v?(0,X.jsx)(nt,{open:v,onOpenChange:se,title:h(),movingFolderId:e,currentId:i,onPick:t=>void f({projectId:e,parentId:t})}):null]})}function bt({chat:e,currentFolderId:t,className:n}){let r=S(D.chats.pinChat),i=S(D.chats.deleteChat),o=S(D.chats.renameChat),c=S(D.chats.setChatSidebar),l=S(D.chats.moveChatToProject),u=Xe(),d=rt(),[ee,f]=(0,Y.useState)(!1),[p,m]=(0,Y.useState)(e.title??``),[h,g]=(0,Y.useState)(!1);return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(Qe,{children:[(0,X.jsx)(yt,{className:n}),(0,X.jsxs)(ft,{align:`end`,className:`w-52`,onClick:e=>e.stopPropagation(),children:[(0,X.jsxs)(U,{onSelect:()=>{m(e.title??``),f(!0)},children:[(0,X.jsx)(Ue,{}),` `,k()]}),(0,X.jsxs)(U,{onSelect:()=>void r({chatId:e._id,pinned:!e.pinned}),children:[e.pinned?(0,X.jsx)(ht,{}):(0,X.jsx)(P,{}),e.pinned?a():ae()]}),(0,X.jsxs)(U,{onSelect:()=>g(!0),children:[(0,X.jsx)(_t,{}),` `,te()]}),e.pinned&&e.inSidebar?null:(0,X.jsxs)(U,{onSelect:()=>void c({chatId:e._id,hidden:e.inSidebar}),children:[e.inSidebar?(0,X.jsx)(L,{}):(0,X.jsx)(J,{}),e.inSidebar?y():w()]}),(0,X.jsx)(it,{}),(0,X.jsxs)(U,{variant:`destructive`,onSelect:()=>{requestAnimationFrame(async()=>{await u({title:De(),description:O({days:d}),confirmLabel:s(),destructive:!0})&&await i({chatId:e._id})})},children:[(0,X.jsx)(je,{}),` `,s()]})]})]}),(0,X.jsx)(Ye,{open:ee,onOpenChange:f,title:_(),canSubmit:p.trim().length>0,onSubmit:async()=>{await o({chatId:e._id,title:p.trim()}),f(!1)},submitLabel:k(),children:(0,X.jsx)(M,{value:p,onChange:e=>m(e.target.value),autoFocus:!0})}),h?(0,X.jsx)(nt,{open:h,onOpenChange:g,title:ne(),currentId:t,onPick:t=>void l({chatId:e._id,projectId:t})}):null]})}function xt(e,t){let n=t.trim().toLowerCase();return n===``?e:e.filter(e=>(e.title??``).toLowerCase().includes(n))}function St(e,t,n,r,i){let a=e.map(t),o=a.indexOf(i);if(o<0)return null;let s=a.indexOf(r);if(s>=0){let t=[...e],[r]=t.splice(s,1);t.splice(o,0,r);let i=t[o-1],a=t[o+1];return{prevKey:i===void 0?null:n(i),nextKey:a===void 0?null:n(a)}}let c=e[o-1];return{prevKey:c===void 0?null:n(c),nextKey:n(e[o])}}function Ct(e,t){let n=new Map(t.map(e=>[e.chatId,e.lastSeenAt])),r=new Set;for(let t of e){let e=n.get(t._id);e!==void 0&&t.lastAssistantAt!==null&&t.lastAssistantAt>e&&r.add(t._id)}return r}var wt=`oc.projpage.view`;function Tt(){let e=localStorage.getItem(wt);return e===`cards`||e===`list`?e:`columns`}var Q=e=>`into:${e}`,Et=e=>`col:${e??`null`}`,Dt=e=>`crumb:${e}`;function Ot(e){if(e.startsWith(`into:`))return e.slice(5);if(e.startsWith(`crumb:`))return e.slice(6);if(e.startsWith(`col:`)){let t=e.slice(4);return t===`null`?null:t}}function kt(){let{projectId:e}=W({from:`/project/$projectId`}),t=z(),n=x(D.projects.projectPage,{projectId:e});return(0,X.jsx)(`div`,{className:`oc-projpage`,children:n===void 0?(0,X.jsx)(`p`,{className:`oc-projpage__hint`,children:T()}):n===null?(0,X.jsxs)(`div`,{className:`oc-projpage__notfound`,children:[(0,X.jsx)(`h2`,{children:ce()}),(0,X.jsx)(`p`,{className:`oc-projpage__hint`,children:i()}),(0,X.jsx)(j,{variant:`outline`,onClick:()=>void t({to:`/`}),children:A()})]}):(0,X.jsx)(At,{page:n})})}function At({page:e}){let t=z(),n=Xe(),i=rt(),a=ot(),l=We(),te=S(D.projects.renameProject),m=S(D.projects.setProjectColor),ne=S(D.projects.deleteProject),re=S(D.projects.createProject),_=S(D.projects.moveProject),ae=S(D.projects.setProjectSidebar),v=S(D.chats.moveChatToProject),ce=S(D.chats.reorderChat),fe=S(D.projects.reorderProject),y=x(D.projects.projectTreeCount,{projectId:e.project._id}),[b,he]=(0,Y.useState)(Tt),C=e=>{localStorage.setItem(wt,e),he(e)},w=x(D.projects.folderColumns,b===`columns`?{projectId:e.project._id}:`skip`),T=x(D.projects.projectTreeList,b===`list`?{projectId:e.project._id}:`skip`),{c:E}=tt({from:`/project/$projectId`}),O=x(D.projects.listProjects,{}),De=x(D.chatReads.myBusyChats,{}),A=(0,Y.useMemo)(()=>new Set(De??[]),[De]),{byChat:Oe}=qe(De??null),P=x(D.chatReads.myChatReads,{}),F=(0,Y.useMemo)(()=>Ct(e.chats,P??[]),[e.chats,P]),{startNewChat:I,picker:Be}=Ze(e=>void t({to:`/chat/$chatId`,params:{chatId:e}})),[L,et]=(0,Y.useState)(``),[B,H]=(0,Y.useState)(!1),[W,dt]=(0,Y.useState)(e.project.name),[G,ht]=(0,Y.useState)(!1),[J,yt]=(0,Y.useState)(``);(0,Y.useEffect)(()=>{let e=setTimeout(()=>yt(L.trim()),180);return()=>clearTimeout(e)},[L]);let Z=x(D.search.searchConversations,J.length>=2?{query:J,projectId:e.project._id}:`skip`),bt=Re(Le(Me,{activationConstraint:{distance:4}}),Le(ze,{activationConstraint:{delay:250,tolerance:8}})),Q=(0,Y.useRef)(!1),Et=()=>{Q.current=!0,setTimeout(()=>{Q.current=!1},0)},[Dt,kt]=(0,Y.useState)(null),At=t=>{if(t.startsWith(`chat:`)){let n=t.slice(5),r=e.chats.find(e=>e._id===n),i=w?.columns.flatMap(e=>e.chats).find(e=>e._id===n);return{kind:`chat`,label:(r??i)?.title||Te()}}if(t.startsWith(`folder:`)){let e=t.slice(7);return{kind:`folder`,label:(O??[]).find(t=>t._id===e)?.name??``}}return null},Nt=e=>kt(At(String(e.active.id))),$=(0,Y.useCallback)(e=>{let t=String(e.active.id).startsWith(`folder:`),n=t=>({...e,droppableContainers:e.droppableContainers.filter(e=>String(e.id).startsWith(t))}),r=N(n(`into:`));if(r.length>0){if(!t)return r;let n=r[0],i=e.droppableRects.get(n.id),a=e.pointerCoordinates?.y;if(i&&a!=null){let e=i.height*.3;if(a>i.top+e&&a<i.top+i.height-e)return r}}let i=N(n(t?`folder:`:`chat:`));if(i.length>0)return i;let a=N(n(`crumb:`));if(a.length>0)return a;let o=N(n(`col:`));return o.length>0?o:at(n(t?`folder:`:`chat:`))},[]),It=t=>{if(b===`columns`){for(let e of w?.columns??[])if(e.chats.some(e=>e._id===t))return{list:e.chats,folderId:e.folderId};return null}if(b===`list`){let e=T?.chats.find(e=>e._id===t);return e?{list:T.chats.filter(t=>t.folderId===e.folderId),folderId:e.folderId}:null}return e.chats.some(e=>e._id===t)?{list:e.chats,folderId:e.project._id}:null},Lt=t=>{if(b===`columns`){for(let e of w?.columns??[])if(e.folders.some(e=>e._id===t))return{list:e.folders,parentId:e.folderId};return null}if(b===`list`){let e=T?.folders.find(e=>e._id===t);if(!e||!T)return null;let n=e.parentId??T.rootId;return{list:st(T.folders,e.parentId),parentId:n}}return e.children.some(e=>e._id===t)?{list:e.children,parentId:e.project._id}:null},zt=async e=>{kt(null),Et();let{active:t,over:n}=e;if(!n)return;let r=String(n.id),i=String(t.id),a=i.startsWith(`chat:`);try{let e=Ot(r);if(e!==void 0){if(a)await v({chatId:i.slice(5),projectId:e});else{let t=i.slice(7);if(t===e)return;if(!lt(O??[],t,e)){l.error(_e());return}await _({projectId:t,parentId:e})}return}if(a&&r.startsWith(`chat:`)){let e=i.slice(5),t=r.slice(5);if(e===t)return;let n=It(t);if(!n)return;n.list.some(t=>t._id===e)||await v({chatId:e,projectId:n.folderId});let a=St(n.list,e=>e._id,e=>e.sortKey,e,t);a&&await ce({chatId:e,...a});return}if(!a&&r.startsWith(`folder:`)){let e=i.slice(7),t=r.slice(7);if(e===t)return;let n=Lt(t);if(!n)return;if(!n.list.some(t=>t._id===e)){if(!lt(O??[],e,n.parentId)){l.error(_e());return}await _({projectId:e,parentId:n.parentId})}let a=St(n.list,e=>e._id,e=>e.sortKey,e,t);a&&await fe({projectId:e,...a});return}}catch{l.error(_e())}},[,Bt]=(0,Y.useState)(0);(0,Y.useEffect)(()=>{let e=window.setInterval(()=>Bt(e=>e+1),6e4);return()=>window.clearInterval(e)},[]);let Vt=Date.now(),Ht=mt(e.project),Ut=xt(e.chats,L),Wt=e.breadcrumb.slice(0,-1),Gt=e=>()=>{Q.current||e()};return(0,X.jsx)(V.Provider,{value:Oe,children:(0,X.jsxs)(He,{sensors:bt,collisionDetection:$,onDragStart:Nt,onDragEnd:zt,children:[(0,X.jsxs)(`div`,{className:`oc-projpage__body`,style:{"--proj-hue":Ht},children:[(0,X.jsxs)(`nav`,{className:`oc-projpage__crumbs`,"aria-label":ie(),children:[Wt.map(e=>(0,X.jsxs)(`span`,{className:`oc-projpage__crumb`,children:[(0,X.jsx)(jt,{folderId:e._id,children:(0,X.jsx)(`button`,{type:`button`,className:`oc-projpage__crumblink`,onClick:Gt(()=>void t({to:`/project/$projectId`,params:{projectId:e._id}})),children:e.name})}),(0,X.jsx)(`span`,{className:`oc-projpage__crumbsep`,"aria-hidden":!0,children:`›`})]},e._id)),(0,X.jsx)(`span`,{className:`oc-projpage__crumbcur`,children:e.project.name})]}),(0,X.jsxs)(`header`,{className:`oc-projpage__head`,children:[(0,X.jsx)(`span`,{className:`oc-projpage__dot`,"aria-hidden":!0}),(0,X.jsx)(`h1`,{className:`oc-projpage__title`,children:e.project.name}),e.project.sidebarHidden?(0,X.jsxs)(j,{variant:`ghost`,size:`sm`,className:`oc-projpage__hiddenbadge`,title:g(),onClick:()=>{ae({projectId:e.project._id,hidden:!1})},children:[(0,X.jsx)($e,{"aria-hidden":!0}),(0,X.jsx)(`span`,{children:c()}),(0,X.jsx)(Ae,{"aria-hidden":!0})]}):null,(0,X.jsxs)(`div`,{className:`oc-projpage__actions`,children:[(0,X.jsxs)(`div`,{className:`oc-projpage__viewtoggle`,role:`group`,"aria-label":ye(),children:[(0,X.jsx)(j,{variant:b===`cards`?`secondary`:`ghost`,size:`icon-sm`,"aria-label":ye(),title:ye(),"aria-pressed":b===`cards`,onClick:()=>C(`cards`),children:(0,X.jsx)(vt,{})}),(0,X.jsx)(j,{variant:b===`columns`?`secondary`:`ghost`,size:`icon-sm`,"aria-label":Ce(),title:Ce(),"aria-pressed":b===`columns`,onClick:()=>C(`columns`),children:(0,X.jsx)(gt,{})}),(0,X.jsx)(j,{variant:b===`list`?`secondary`:`ghost`,size:`icon-sm`,"aria-label":Se(),title:Se(),"aria-pressed":b===`list`,onClick:()=>C(`list`),children:(0,X.jsx)(ke,{})})]}),(0,X.jsxs)(j,{variant:`outline`,size:`sm`,onClick:()=>void I({projectId:e.project._id}),children:[(0,X.jsx)(Ie,{}),p()]}),(0,X.jsxs)(j,{variant:`outline`,size:`sm`,onClick:async()=>{let t=await a({title:r(),label:o(),placeholder:u(),confirmLabel:oe()});t&&await re({name:t,parentId:e.project._id})},children:[(0,X.jsx)(Ge,{}),r()]}),(0,X.jsxs)(Qe,{children:[(0,X.jsx)(Je,{asChild:!0,children:(0,X.jsx)(j,{variant:`ghost`,size:`icon-sm`,"aria-label":we(),children:(0,X.jsx)(pt,{})})}),(0,X.jsxs)(ft,{align:`end`,className:`w-48`,children:[(0,X.jsxs)(U,{onSelect:()=>{dt(e.project.name),H(!0)},children:[(0,X.jsx)(Ue,{}),` `,k()]}),(0,X.jsxs)(U,{onSelect:()=>ht(!0),children:[(0,X.jsx)(_t,{}),` `,d()]}),(0,X.jsx)(ut,{children:Ee()}),(0,X.jsxs)(`div`,{className:`oc-colorgrid`,children:[(0,X.jsx)(`button`,{className:`oc-colorgrid__none`,onClick:()=>void m({projectId:e.project._id,color:null}),"aria-label":me(),children:`✕`}),Ke.map(t=>(0,X.jsx)(`button`,{className:`oc-colorgrid__dot`+(e.project.color===t.value?` is-selected`:``),style:{background:t.hue},"aria-label":t.value,onClick:()=>void m({projectId:e.project._id,color:t.value})},t.value))]}),(0,X.jsx)(it,{}),(0,X.jsxs)(U,{variant:`destructive`,onSelect:()=>{let r=e.project.parentId;requestAnimationFrame(async()=>{let a=y?.folders??0,o=y?.chats??0;await n({title:ge({name:e.project.name}),description:ct({folders:a,chats:o,days:i}),confirmWord:s(),confirmLabel:ve(),destructive:!0})&&(await ne({projectId:e.project._id}),t(r===null?{to:`/`}:{to:`/project/$projectId`,params:{projectId:r}}))})},children:[(0,X.jsx)(je,{}),` `,s()]})]})]})]})]}),b===`columns`?(0,X.jsx)(Rt,{data:w,currentId:e.project._id,busyIds:A,suppressClick:Q,locateChatId:E??null}):b===`list`?(0,X.jsx)(Ft,{data:T,busyIds:A,suppressClick:Q,locateChatId:E??null}):(0,X.jsxs)(X.Fragment,{children:[e.children.length>0?(0,X.jsxs)(`section`,{className:`oc-projpage__section`,children:[(0,X.jsx)(`h2`,{className:`oc-projpage__subtitle`,children:ue()}),(0,X.jsx)(`div`,{className:`oc-projpage__cards`,children:(0,X.jsx)(q,{items:e.children.map(e=>`folder:${e._id}`),strategy:Ve,children:e.children.map(t=>(0,X.jsx)(Mt,{child:t,parentId:e.project._id,now:Vt,suppressClick:Q},t._id))})})]}):null,(0,X.jsxs)(`section`,{className:`oc-projpage__section`,children:[(0,X.jsxs)(`div`,{className:`oc-projpage__convhead`,children:[(0,X.jsx)(`h2`,{className:`oc-projpage__subtitle`,children:de()}),e.chats.length>0?(0,X.jsx)(M,{value:L,onChange:e=>et(e.target.value),placeholder:ee(),className:`oc-projpage__filter`}):null]}),e.chats.length===0?(0,X.jsx)(`p`,{className:`oc-projpage__hint`,children:e.children.length===0?se():f()}):Ut.length===0&&(Z??[]).length===0?(0,X.jsx)(`p`,{className:`oc-projpage__hint`,children:le({term:L.trim()})}):(0,X.jsx)(`ul`,{className:`oc-projpage__chats`,children:(0,X.jsx)(q,{items:Ut.map(e=>`chat:${e._id}`),strategy:K,children:Ut.map(t=>(0,X.jsx)(Pt,{chat:t,currentFolderId:e.project._id,now:Vt,busy:A.has(t._id),unread:F.has(t._id),locate:t._id===E,suppressClick:Q},t._id))})})]}),J.length>=2&&Z!==void 0?(0,X.jsxs)(`section`,{className:`oc-projpage__section`,children:[(0,X.jsx)(`h2`,{className:`oc-projpage__subtitle`,children:be()}),Z.length===0?(0,X.jsx)(`p`,{className:`oc-projpage__hint`,children:le({term:J})}):(0,X.jsx)(`ul`,{className:`oc-projpage__chats`,children:Z.map(e=>(0,X.jsx)(`li`,{className:`oc-projpage__chatrow`,children:(0,X.jsxs)(`button`,{type:`button`,className:`oc-projpage__chatbtn`,onClick:()=>{e.messageId&&J&&Fe(e.messageId,J),t({to:`/chat/$chatId`,params:{chatId:e.chatId},...e.messageId?{search:{m:e.messageId}}:{}})},children:[(0,X.jsx)(Pe,{size:13,"aria-hidden":!0,className:`oc-projpage__hitico`}),(0,X.jsxs)(`span`,{className:`oc-projpage__hitbody`,children:[(0,X.jsx)(`span`,{className:`oc-projpage__chattitle`,children:e.title||xe()}),e.projectPath&&e.projectPath.length>1?(0,X.jsx)(`span`,{className:`oc-projpage__hitpath`,children:e.projectPath.join(` › `)}):null,e.snippet?(0,X.jsx)(`span`,{className:`oc-projpage__hitsnippet`,children:e.snippet}):null]})]})},`${e.chatId}:${e.messageId??`t`}`))})]}):null]}),(0,X.jsx)(Ye,{open:B,onOpenChange:H,title:pe(),canSubmit:W.trim().length>0,onSubmit:async()=>{await te({projectId:e.project._id,name:W.trim()}),H(!1)},submitLabel:k(),children:(0,X.jsx)(M,{value:W,onChange:e=>dt(e.target.value),autoFocus:!0})}),G?(0,X.jsx)(nt,{open:G,onOpenChange:ht,title:h(),movingFolderId:e.project._id,currentId:e.project.parentId,onPick:t=>void _({projectId:e.project._id,parentId:t})}):null,Be]}),(0,X.jsx)(Ne,{children:Dt?(0,X.jsxs)(`div`,{className:`oc-projpage__dragghost`,children:[Dt.kind===`folder`?(0,X.jsx)(R,{size:13,"aria-hidden":!0}):(0,X.jsx)(Pe,{size:13,"aria-hidden":!0}),(0,X.jsx)(`span`,{children:Dt.label})]}):null})]})})}function jt({folderId:e,children:t}){let{setNodeRef:n,isOver:r}=H({id:Dt(e)});return(0,X.jsx)(`span`,{ref:n,className:r?`oc-projpage__cdrop is-over`:`oc-projpage__cdrop`,children:t})}function Mt({child:e,parentId:t,now:n,suppressClick:r}){let i=z(),a=F({id:`folder:${e._id}`}),o=H({id:Q(e._id)});return(0,X.jsxs)(`div`,{ref:e=>{a.setNodeRef(e),o.setNodeRef(e)},className:`oc-projpage__card`+(o.isOver?` is-over`:``)+(a.isDragging?` is-dragging`:``),style:{"--proj-hue":mt(e),transform:I.Transform.toString(a.transform),transition:a.transition},onClick:()=>{r.current||i({to:`/project/$projectId`,params:{projectId:e._id}})},onKeyDown:t=>{t.key===`Enter`&&i({to:`/project/$projectId`,params:{projectId:e._id}})},...a.listeners,...a.attributes,role:`link`,tabIndex:0,children:[(0,X.jsxs)(`span`,{className:`oc-projpage__cardhead`,children:[(0,X.jsx)(R,{size:15,"aria-hidden":!0,className:`oc-projpage__cardico`}),(0,X.jsx)(`span`,{className:`oc-projpage__cardname`,children:e.name}),(0,X.jsx)(Z,{folderId:e._id,name:e.name,color:e.color,currentParentId:t,className:`oc-projpage__cardmenu`,onOpen:()=>void i({to:`/project/$projectId`,params:{projectId:e._id}})})]}),(0,X.jsxs)(`span`,{className:`oc-projpage__cardmeta`,children:[e.folderCount>0?E({count:e.folderCount})+` · `:``,m({count:e.recursiveChatCount})]}),e.lastActivityAt===null?null:(0,X.jsx)(`span`,{className:`oc-projpage__cardage`,children:et(e.lastActivityAt,n)})]})}function Nt({chat:e}){let t=S(D.chats.setChatSidebar),n=e.inSidebar?y():w();return(0,X.jsx)(j,{variant:`ghost`,size:`icon-xs`,"aria-label":n,title:n,className:`oc-projpage__barbtn`+(e.inSidebar?` is-on`:``),disabled:e.pinned&&e.inSidebar,onClick:n=>{n.stopPropagation(),t({chatId:e._id,hidden:e.inSidebar})},children:e.inSidebar?(0,X.jsx)(L,{}):(0,X.jsx)(J,{})})}function Pt({chat:e,currentFolderId:t,now:n,busy:r,unread:i,locate:a,suppressClick:o}){let s=(0,Y.useContext)(V).get(e._id),c=z(),l=G(e.color),u=F({id:`chat:${e._id}`}),d=$(a);return(0,X.jsxs)(`li`,{ref:e=>{u.setNodeRef(e),d.current=e},className:`oc-projpage__chatrow`+(u.isDragging?` is-dragging`:``)+(a?` is-locate`:``),style:{transform:I.Transform.toString(u.transform),transition:u.transition},children:[(0,X.jsxs)(`button`,{type:`button`,className:`oc-projpage__chatbtn`,onClick:()=>{o.current||c({to:`/chat/$chatId`,params:{chatId:e._id}})},...u.listeners,...u.attributes,children:[l?(0,X.jsx)(`span`,{className:`oc-chatitem__dot`,style:{background:l}}):(0,X.jsx)(`span`,{className:`oc-chatitem__dot oc-chatitem__dot--empty`}),(0,X.jsx)(`span`,{className:`oc-projpage__chattitle`,children:e.title||Te()}),e.pinned?(0,X.jsx)(P,{size:12,"aria-hidden":!0,className:`oc-projpage__chatpin`}):null,(0,X.jsx)(`span`,{className:`oc-projpage__chatage`,children:et(e.updatedAt,n)}),r?(0,X.jsx)(`span`,{className:B(s,b()).className,title:B(s,b()).label,"aria-label":B(s,b()).label}):null,i&&!r?(0,X.jsx)(`span`,{className:`oc-chatitem__unread`,title:C(),"aria-label":C()}):null]}),(0,X.jsx)(Nt,{chat:e}),(0,X.jsx)(bt,{chat:e,currentFolderId:t,className:`oc-projpage__chatmenu`})]})}function $(e){let t=(0,Y.useRef)(null);return(0,Y.useEffect)(()=>{e&&t.current&&t.current.scrollIntoView({block:`center`})},[e]),t}function Ft({data:e,busyIds:t,suppressClick:n,locateChatId:r}){let[i,a]=(0,Y.useState)(new Set),o=(0,Y.useMemo)(()=>{let t=new Map;for(let n of e?.chats??[]){let e=t.get(n.folderId);e===void 0?t.set(n.folderId,[n]):e.push(n)}return t},[e]);if(e===void 0)return(0,X.jsx)(`p`,{className:`oc-projpage__hint`,children:T()});if(e===null)return null;let s=e=>a(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n}),c=(a,l)=>{let u=o.get(a??e.rootId)??[],d=st(e.folders,a);return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(q,{items:u.map(e=>`chat:${e._id}`),strategy:K,children:u.map(e=>(0,X.jsx)(Lt,{chat:e,depth:l,busy:t.has(e._id),locate:e._id===r,suppressClick:n},e._id))}),(0,X.jsx)(q,{items:d.map(e=>`folder:${e._id}`),strategy:K,children:d.map(t=>(0,X.jsx)(It,{folder:t,parentId:a??e.rootId,depth:l,folded:i.has(t._id),onToggle:()=>s(t._id),suppressClick:n,children:i.has(t._id)?null:c(t._id,l+1)},t._id))})]})};return(0,X.jsx)(`div`,{className:`oc-projpage__tree`,children:(o.get(e.rootId)??[]).length===0&&st(e.folders,null).length===0?(0,X.jsx)(`p`,{className:`oc-projpage__hint`,children:se()}):c(null,0)})}function It({folder:e,parentId:t,depth:n,folded:r,onToggle:i,suppressClick:a,children:o}){let s=z(),c=F({id:`folder:${e._id}`}),l=H({id:Q(e._id)});return(0,X.jsxs)(`div`,{className:`oc-projpage__treegroup`,children:[(0,X.jsxs)(`div`,{ref:e=>{c.setNodeRef(e),l.setNodeRef(e)},className:`oc-projpage__treerow oc-projpage__treerow--folder`+(l.isOver?` is-over`:``)+(c.isDragging?` is-dragging`:``),style:{"--tree-depth":n,"--proj-hue":mt(e),transform:I.Transform.toString(c.transform),transition:c.transition},...c.listeners,...c.attributes,role:`button`,tabIndex:0,onClick:()=>{a.current||s({to:`/project/$projectId`,params:{projectId:e._id}})},onKeyDown:t=>{t.key===`Enter`&&s({to:`/project/$projectId`,params:{projectId:e._id}})},children:[(0,X.jsx)(`button`,{type:`button`,className:`oc-projpage__treechev`,"aria-label":r?re():fe(),"aria-expanded":!r,onClick:e=>{e.stopPropagation(),!a.current&&i()},onMouseDown:e=>e.stopPropagation(),onTouchStart:e=>e.stopPropagation(),children:r?(0,X.jsx)(dt,{size:13}):(0,X.jsx)(Oe,{size:13})}),(0,X.jsx)(R,{size:13,"aria-hidden":!0,className:`oc-projpage__colico`}),(0,X.jsx)(`span`,{className:`oc-projpage__colname`,children:e.name}),(0,X.jsx)(Z,{folderId:e._id,name:e.name,color:e.color,currentParentId:t,className:`oc-projpage__treemenu`,onOpen:()=>void s({to:`/project/$projectId`,params:{projectId:e._id}})})]}),o]})}function Lt({chat:e,depth:t,busy:n,locate:r,suppressClick:i}){let a=(0,Y.useContext)(V).get(e._id),o=z(),s=F({id:`chat:${e._id}`}),c=$(r),l=G(e.color);return(0,X.jsxs)(`div`,{ref:e=>{s.setNodeRef(e),c.current=e},className:`oc-projpage__treerow oc-projpage__treerow--chat`+(s.isDragging?` is-dragging`:``)+(r?` is-locate`:``),style:{"--tree-depth":t,transform:I.Transform.toString(s.transform),transition:s.transition},children:[(0,X.jsxs)(`button`,{type:`button`,className:`oc-projpage__colchatbtn`,onClick:()=>{i.current||o({to:`/chat/$chatId`,params:{chatId:e._id}})},...s.listeners,...s.attributes,children:[l?(0,X.jsx)(`span`,{className:`oc-chatitem__dot`,style:{background:l}}):(0,X.jsx)(`span`,{className:`oc-chatitem__dot oc-chatitem__dot--empty`}),(0,X.jsx)(`span`,{className:`oc-projpage__colname`,children:e.title||Te()}),n?(0,X.jsx)(`span`,{className:B(a,``).className,"aria-hidden":!0}):null]}),(0,X.jsx)(bt,{chat:e,currentFolderId:e.folderId,className:`oc-projpage__treemenu`}),(0,X.jsx)(Nt,{chat:e})]})}function Rt({data:e,currentId:t,busyIds:n,suppressClick:r,locateChatId:i}){let a=(0,Y.useRef)(null);return(0,Y.useEffect)(()=>{let e=a.current;e&&(e.scrollLeft=e.scrollWidth)},[e?.columns.length??0,t]),e===void 0?(0,X.jsx)(`p`,{className:`oc-projpage__hint`,children:T()}):(0,X.jsx)(`div`,{className:`oc-projpage__cols`,ref:a,children:e.columns.map((a,o)=>(0,X.jsx)(zt,{col:a,isLast:o===e.columns.length-1,currentId:t,busyIds:n,suppressClick:r,locateChatId:i},a.folderId??`root`))})}function zt({col:e,isLast:t,currentId:n,busyIds:r,suppressClick:i,locateChatId:a}){let o=z(),s=H({id:Et(e.folderId)});return(0,X.jsxs)(`div`,{ref:s.setNodeRef,className:`oc-projpage__col`+(s.isOver?` is-over`:``)+(t?` is-last`:``),children:[(0,X.jsx)(q,{items:e.folders.map(e=>`folder:${e._id}`),strategy:K,children:e.folders.map(t=>(0,X.jsx)(Bt,{folder:t,parentId:e.folderId,isCurrent:t._id===n,suppressClick:i,onOpen:()=>void o({to:`/project/$projectId`,params:{projectId:t._id}})},t._id))}),(0,X.jsx)(q,{items:e.chats.map(e=>`chat:${e._id}`),strategy:K,children:e.chats.map(t=>(0,X.jsx)(Vt,{chat:t,folderId:e.folderId,busy:r.has(t._id),locate:t._id===a,suppressClick:i,onOpen:()=>void o({to:`/chat/$chatId`,params:{chatId:t._id}})},t._id))}),e.folders.length===0&&e.chats.length===0?(0,X.jsx)(`p`,{className:`oc-projpage__colempty`,children:f()}):null]})}function Bt({folder:e,parentId:t,isCurrent:n,suppressClick:r,onOpen:i}){let a=F({id:`folder:${e._id}`}),o=H({id:Q(e._id)});return(0,X.jsxs)(`div`,{ref:e=>{a.setNodeRef(e),o.setNodeRef(e)},className:`oc-projpage__colentry oc-projpage__colentry--folder`+(e.selected||n?` is-selected`:``)+(o.isOver?` is-over`:``)+(a.isDragging?` is-dragging`:``),style:{"--proj-hue":mt(e),transform:I.Transform.toString(a.transform),transition:a.transition},onClick:()=>{r.current||i()},onKeyDown:e=>{e.key===`Enter`&&e.target===e.currentTarget&&i()},...a.listeners,...a.attributes,role:`button`,tabIndex:0,children:[(0,X.jsx)(R,{size:13,"aria-hidden":!0,className:`oc-projpage__colico`}),(0,X.jsx)(`span`,{className:`oc-projpage__colname`,children:e.name}),(0,X.jsx)(`span`,{className:`oc-projpage__colchev`,"aria-hidden":!0,children:`›`}),(0,X.jsx)(Z,{folderId:e._id,name:e.name,color:e.color,currentParentId:t,className:`oc-projpage__colmenu`,onOpen:i})]})}function Vt({chat:e,folderId:t,busy:n,locate:r,suppressClick:i,onOpen:a}){let o=(0,Y.useContext)(V).get(e._id),s=F({id:`chat:${e._id}`}),c=$(r),l=G(e.color);return(0,X.jsxs)(`div`,{ref:e=>{s.setNodeRef(e),c.current=e},className:`oc-projpage__colentry oc-projpage__colentry--chat`+(s.isDragging?` is-dragging`:``)+(r?` is-locate`:``),style:{transform:I.Transform.toString(s.transform),transition:s.transition},children:[(0,X.jsxs)(`button`,{type:`button`,className:`oc-projpage__colchatbtn`,onClick:()=>{i.current||a()},...s.listeners,...s.attributes,children:[l?(0,X.jsx)(`span`,{className:`oc-chatitem__dot`,style:{background:l}}):(0,X.jsx)(`span`,{className:`oc-chatitem__dot oc-chatitem__dot--empty`}),(0,X.jsx)(`span`,{className:`oc-projpage__colname`,children:e.title||Te()}),n?(0,X.jsx)(`span`,{className:B(o,``).className,"aria-hidden":!0}):null]}),(0,X.jsx)(bt,{chat:e,currentFolderId:t,className:`oc-projpage__colmenu oc-projpage__colmenu--chat`}),(0,X.jsx)(Nt,{chat:e})]})}export{kt as ProjectPage};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$d as r,Ak as i,Bd as a,Ck as o,Dk as s,Ek as c,Fk as l,Gk as u,Gp as d,Hd as f,Hp as p,Ik as m,Lk as h,Mk as g,Nk as _,Ok as v,Pk as ee,Qd as te,Sk as ne,Tk as re,Ud as y,Up as b,Vd as ie,Vp as x,Wk as S,Wp as C,Xd as w,Zd as ae,bk as oe,cu as se,gX as T,hX as E,jk as D,kk as O,lu as k,t as A,uu as j,vk as M,wk as N,wo as P,xk as F,yk as I,zd as L}from"./api-uQUQB4xy.js";import{i as R,n as z,r as B,t as V}from"./FieldLabel-BBpaaMpJ.js";import{t as H}from"./button-Biq40Zpc.js";import{Mt as U,St as W,Yt as ce,bt as G,ft as le,gn as ue,hn as de,mn as fe,pn as K,vt as q,xt as J,yt as Y}from"./index-Bw4ypNNp.js";import{r as X,t as Z}from"./locales-CPjguROj.js";import{t as pe}from"./localePickerView-C2RmOS86.js";/* empty css */var Q=t(e(),1),$=n(),me={media_delivery:{label:g,help:D},documentary_fetch:{label:i,help:O},inbound_files:{label:v,help:s},history_summary:{label:d,help:C},file_curation:{label:r,help:y},quote_reply:{label:te,help:ae}},he={outboundDir:`/home/node/.openclaw/media/outbound`,references:`- gdrive/1a2b3c4d5e6f7890abcd
|
|
2
|
+
- gdrive/0f9e8d7c6b5a4321dcba`,files:`- /home/node/.openclaw/media/inbound/rapport.pdf (124800 o, application/pdf)`,previous_summary:`Projet Alpha : budget 40 000 EUR ; choix du serveur en cours.`,new_messages:`Utilisateur : Compare OVH et Scaleway.
|
|
3
|
+
Assistant : Comparaison en cours.`,max_chars:`6000`,file_name:`MEMORY.md`,budget_chars:`20000`,feedback:`Trop de suppressions dans la section des liens, garde-les.`,content:`# Memory index
|
|
4
|
+
- [Fait 1](fait-1.md) - note du projet`,excerpt:`Le classement propose trois dossiers : Clients, Fournisseurs, Interne.`},ge={outboundDir:oe,references:I,files:M,previous_summary:b,new_messages:p,max_chars:x,file_name:f,budget_chars:ie,feedback:a,content:L,excerpt:w};function _e(){let e=T(A.admin.listInstances,{}),[t,n]=(0,Q.useState)(null);if(e===void 0)return(0,$.jsx)(`div`,{className:`oc-settings__tab-loading`,"aria-busy":`true`});if(e.length===0)return(0,$.jsx)(`div`,{className:`oc-injtab`,children:(0,$.jsx)(`p`,{className:`oc-admin__hint`,children:re()})});let r=e.find(e=>e._id===t)??e[0];return(0,$.jsxs)(`div`,{className:`oc-injtab`,children:[(0,$.jsxs)(`div`,{className:`oc-injtab__head`,children:[(0,$.jsx)(z,{label:h(),help:m()}),(0,$.jsxs)(`label`,{className:`oc-injtab__picker`,children:[(0,$.jsx)(`span`,{children:c()}),(0,$.jsxs)(q,{value:r._id,onValueChange:e=>n(e),children:[(0,$.jsx)(J,{size:`sm`,className:`min-w-44`,children:(0,$.jsx)(W,{})}),(0,$.jsx)(Y,{children:e.map(e=>(0,$.jsx)(G,{value:e._id,children:e.displayName??e.name},e._id))})]})]})]}),(0,$.jsx)(ve,{instance:r},r._id)]})}function ve({instance:e}){let t=E(A.admin.upsertInstanceConfig),n=ce(),r=T(A.me.getMe,{host:le}),i=e.config??{},a=X(e.config?.contentLocale,r?.defaultLocale??void 0),[o,s]=(0,Q.useState)(()=>R(i,a));(0,Q.useEffect)(()=>{s(R(i,a))},[a,e._id]);let[c,l]=(0,Q.useState)(!1),d=o.promptInjections,f=(e,t)=>s({...o,promptInjections:{...d,[e]:{...d[e],...t}}});async function p(){l(!0);try{await t({instanceId:e._id,config:B(o,i,a)})}catch(e){n.error(S(),e)}finally{l(!1)}}async function m(r){let i={...e.config??{}};r==="default"?delete i.contentLocale:i.contentLocale=r;try{await t({instanceId:e._id,config:i})}catch(e){n.error(S(),e)}}let h=e.config?.contentLocale??`default`,g=Z[X(void 0,r?.defaultLocale??void 0)];return(0,$.jsxs)(`div`,{className:`oc-injtab__body`,children:[(0,$.jsxs)(`div`,{className:`oc-injtab__content-locale`,children:[(0,$.jsx)(`span`,{children:j()}),(0,$.jsxs)(q,{value:h,onValueChange:e=>void m(e),children:[(0,$.jsx)(J,{size:`sm`,className:`min-w-44`,children:(0,$.jsx)(W,{})}),(0,$.jsxs)(Y,{children:[(0,$.jsx)(G,{value:`default`,children:se({locale:g})}),pe().map(e=>(0,$.jsx)(G,{value:e.value,children:e.label},e.value))]})]}),(0,$.jsx)(`p`,{className:`oc-admin__hint`,children:k()})]}),fe.map(e=>(0,$.jsx)(ye,{injKey:e,def:K[e],i18n:me[e],row:d[e]??{enabled:!0,template:K[e].defaultTemplate[a]},contentLocale:a,onChange:t=>f(e,t)},e)),(0,$.jsx)(`div`,{className:`oc-injtab__actions`,children:(0,$.jsx)(H,{size:`sm`,onClick:()=>void p(),disabled:c,children:u()})})]})}function ye({injKey:e,def:t,i18n:n,row:r,contentLocale:i,onChange:a}){let[s,c]=(0,Q.useState)(!1),u=r.template.trim()!==t.defaultTemplate[i],d=t.togglable&&!r.enabled,f=Object.fromEntries(t.placeholders.map(e=>[e,he[e]??`{${e}}`])),p=de(e,r,i),m=p?ue(p,f):``;return(0,$.jsxs)(`section`,{className:`oc-injcard`,children:[(0,$.jsxs)(`div`,{className:`oc-injcard__head`,children:[t.togglable?(0,$.jsxs)(`label`,{className:`oc-field--row`,children:[(0,$.jsx)(U,{checked:r.enabled,onCheckedChange:e=>a({enabled:e===!0})}),(0,$.jsx)(z,{label:n.label(),help:n.help()})]}):(0,$.jsx)(z,{label:n.label(),help:n.help()}),u&&(0,$.jsx)(`span`,{className:`oc-injection__badge`,children:ee()})]}),(0,$.jsx)(`textarea`,{className:`oc-injcard__text`,value:r.template,disabled:d,rows:8,spellCheck:!1,onChange:e=>a({template:e.target.value})}),(0,$.jsxs)(`div`,{className:`oc-injection__foot`,children:[(0,$.jsxs)(`div`,{className:`oc-injcard__phs`,children:[(0,$.jsx)(`span`,{className:`oc-injection__ph`,children:_()}),t.placeholders.map(e=>(0,$.jsxs)(`span`,{className:`oc-injcard__ph-chip`,children:[(0,$.jsx)(`code`,{children:`{${e}}`}),(0,$.jsx)(V,{text:(ge[e]??(()=>e))()})]},e))]}),(0,$.jsxs)(`div`,{className:`oc-injcard__btns`,children:[(0,$.jsx)(H,{variant:`ghost`,size:`sm`,onClick:()=>c(e=>!e),children:s?o():N()}),u&&(0,$.jsx)(H,{variant:`ghost`,size:`sm`,onClick:()=>a({template:t.defaultTemplate[i]}),children:l()})]})]}),s&&(0,$.jsx)(`div`,{className:`oc-injcard__preview`,children:m?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`pre`,{className:`oc-injcard__previewtext`,children:m}),(0,$.jsx)(`span`,{className:`oc-injection__ph`,children:ne()}),t.pluralDefaultTemplate!==void 0&&!d?(0,$.jsx)(`span`,{className:`oc-injection__ph`,children:P()}):null]}):(0,$.jsx)(`span`,{className:`oc-injection__ph`,children:F()})})]})}export{_e as PromptInjectionsTab};
|