@lacneu/atrium 0.84.18 → 0.84.20
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-CoFRPa-e.js +1 -0
- package/dist/assets/{AdvancedFilter-DzABuYe4.js → AdvancedFilter-CZnbykZe.js} +1 -1
- package/dist/assets/AgentFilesTab-Bcz9V6fH.js +3 -0
- package/dist/assets/AnomaliesTab-YUjA4XnE.js +1 -0
- package/dist/assets/AuditTab-Jes9HRNk.js +1 -0
- package/dist/assets/BridgeTab-CWbabhHl.js +1 -0
- package/dist/assets/ChatDefaultsTab-DT3gBozQ.js +1 -0
- package/dist/assets/{DataTableShell-DGGSIwCx.js → DataTableShell-CDmo0isC.js} +1 -1
- package/dist/assets/{DetailChips-DTzXBtIX.js → DetailChips-Csi8ao-5.js} +1 -1
- package/dist/assets/FeedbacksTab-9go4R--0.js +1 -0
- package/dist/assets/{FieldLabel-CEa671vG.js → FieldLabel-4AzJbj-7.js} +1 -1
- package/dist/assets/FilesTab-CRGP9jbn.js +1 -0
- package/dist/assets/{FilterBar-D_6ObXjr.js → FilterBar-CK5Wsnof.js} +1 -1
- package/dist/assets/{GroupsTab-FU1hfvWY.js → GroupsTab-HBoCEQWy.js} +1 -1
- package/dist/assets/InstancesTab-CMEb9hT6.js +1 -0
- package/dist/assets/IntegrationsTab-hlpMleFu.js +1 -0
- package/dist/assets/KpiTab-Dqb9g4zO.js +1 -0
- package/dist/assets/PreferencesTab-Bdlwezal.js +1 -0
- package/dist/assets/ProjectPage-DWMUaSn7.js +1 -0
- package/dist/assets/{PromptInjectionsTab-X6VRyQUy.js → PromptInjectionsTab-DAajt_Z1.js} +2 -2
- package/dist/assets/RolesTab-DHifxhw3.js +1 -0
- package/dist/assets/ScheduledTab-CeVs9uJe.js +1 -0
- package/dist/assets/ServiceAccountsTab-Bl7nm8Ph.js +1 -0
- package/dist/assets/{SubAgentReportsTab-C0O27eOL.js → SubAgentReportsTab-O1q9pZe2.js} +1 -1
- package/dist/assets/{ThemeShowroom-CbWueTmW.js → ThemeShowroom-BSjPrQxB.js} +1 -1
- package/dist/assets/{TimeRangePicker-DVMsYipt.js → TimeRangePicker-DOkbYJPt.js} +1 -1
- package/dist/assets/{TimezoneCombobox-D1Wotasq.js → TimezoneCombobox-DeJ3e50i.js} +1 -1
- package/dist/assets/TracesTab-M7MbrfPE.js +1 -0
- package/dist/assets/UsersTab-DW6GasiH.js +1 -0
- package/dist/assets/VoiceTab-CLMSu_Kx.js +1 -0
- package/dist/assets/{api-Dawxt_aS.js → api-B1lq0pb-.js} +5 -5
- package/dist/assets/{button-alklyZ2M.js → button-Ds98Pj53.js} +1 -1
- package/dist/assets/{card-CDvn9R5v.js → card-C2GdBOIp.js} +1 -1
- package/dist/assets/chevrons-up-down-Du-SfIms.js +1 -0
- package/dist/assets/{compatView-C9_KgDNH.js → compatView-Dxc5HuRO.js} +1 -1
- package/dist/assets/{dispatchErrorInfo-d7ehNfS4.js → dispatchErrorInfo-BGvs3mZA.js} +1 -1
- package/dist/assets/{dist-C3BrQPF_.js → dist-DaQlSKRt.js} +1 -1
- package/dist/assets/{dist-DlDq3K4D.js → dist-rn-1MvzJ.js} +1 -1
- package/dist/assets/{highlighted-body-OFNGDK62-BytsI_cI.js → highlighted-body-OFNGDK62-CYEBDkYv.js} +1 -1
- package/dist/assets/index-DMM3fags.js +324 -0
- package/dist/assets/{list-Bs_wfimY.js → list-DhABairq.js} +1 -1
- package/dist/assets/mermaid-GHXKKRXX-DDdByclK.js +1 -0
- package/dist/assets/{pdf-DRZjZEuv.js → pdf-CNbyQJnG.js} +1 -1
- package/dist/assets/roleDescriptions-BV5RwGCx.js +1 -0
- package/dist/assets/{table-CJ3_5RvQ.js → table-B15ESmxP.js} +1 -1
- package/dist/assets/{tabs-D-3HavQe.js → tabs-vdU2pkw5.js} +1 -1
- package/dist/assets/x-CHx4ismM.js +1 -0
- package/dist/index.html +6 -6
- package/package.json +1 -1
- package/dist/assets/AccessTab-C4qktb9N.js +0 -1
- package/dist/assets/AgentFilesTab-tv2KHmyO.js +0 -3
- package/dist/assets/AnomaliesTab-POfetzRk.js +0 -1
- package/dist/assets/AuditTab-DNtJSFCG.js +0 -1
- package/dist/assets/BridgeTab-CzyyKpM3.js +0 -1
- package/dist/assets/ChatDefaultsTab-B0YNJjM5.js +0 -1
- package/dist/assets/FeedbacksTab-BJvVbEdR.js +0 -1
- package/dist/assets/FilesTab-B79u5xo1.js +0 -1
- package/dist/assets/InstancesTab-D0YmHvV-.js +0 -1
- package/dist/assets/IntegrationsTab-BEVGWeVW.js +0 -1
- package/dist/assets/KpiTab-BLkA1s66.js +0 -1
- package/dist/assets/PreferencesTab-D56grf46.js +0 -1
- package/dist/assets/ProjectPage-C9wOIZOD.js +0 -1
- package/dist/assets/RolesTab-Dunonnsb.js +0 -1
- package/dist/assets/ScheduledTab-DCpRYvbc.js +0 -1
- package/dist/assets/ServiceAccountsTab-D2TjT-Y0.js +0 -1
- package/dist/assets/TracesTab-CHxsnBQk.js +0 -1
- package/dist/assets/UsersTab-OinNV3dC.js +0 -1
- package/dist/assets/VoiceTab-C-4Z4mUZ.js +0 -1
- package/dist/assets/chevrons-up-down-CFK9IaHn.js +0 -1
- package/dist/assets/index-C-ySA5Hs.js +0 -324
- package/dist/assets/mermaid-GHXKKRXX-CBJEr4Xn.js +0 -1
- package/dist/assets/roleDescriptions-C21oVyp7.js +0 -1
- package/dist/assets/x-BSVAMcNy.js +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$B as r,Am as i,Bm as a,Fm as o,Hm as s,Im as c,Lm as l,Mm as u,Nm as d,Pm as f,Rm as p,Um as m,Vm as h,Wm as g,cV as _,jm as v,t as y,zm as b}from"./api-B1lq0pb-.js";import{$ as x,Et as S,Q as C,X as w,Z as T,et as E}from"./index-DMM3fags.js";var D=t(e(),1);function O(e){return e===`user`?f():e===`all`?d():u({group:e.group})}function k(e){return e===`common`?v():e===`owner`?i():u({group:e.group})}var A=n();function j(e){return e.name||e.email||e.userId.slice(0,8)}function M(){let e=_(y.admin.listUsers,{}),[t,n]=(0,D.useState)(``),i=_(y.introspect.introspectUser,t?{userId:t}:`skip`);return(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:g()}),(0,A.jsxs)(w,{value:t,onValueChange:n,children:[(0,A.jsx)(x,{size:`sm`,"aria-label":m(),children:(0,A.jsx)(E,{placeholder:m()})}),(0,A.jsx)(T,{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()}):i===void 0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:r()}):(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:h()}),(0,A.jsxs)(`div`,{className:`oc-introspect__id`,children:[(0,A.jsx)(`strong`,{children:i.user.label}),(0,A.jsx)(S,{variant:`secondary`,children:i.role})]})]}),(0,A.jsxs)(`section`,{className:`oc-introspect__section`,children:[(0,A.jsx)(`h3`,{className:`oc-introspect__title`,children:a()}),i.groups.length===0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:c()}):(0,A.jsx)(`div`,{className:`oc-introspect__chips`,children:i.groups.map(e=>(0,A.jsx)(S,{variant:`secondary`,children:e.name},e.groupId))})]}),(0,A.jsxs)(`section`,{className:`oc-introspect__section`,children:[(0,A.jsx)(`h3`,{className:`oc-introspect__title`,children:b()}),i.agents.length===0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:c()}):(0,A.jsx)(`ul`,{className:`oc-introspect__list`,children:i.agents.map(e=>(0,A.jsxs)(`li`,{className:`oc-introspect__row`,children:[(0,A.jsx)(`span`,{className:`oc-introspect__name`,children:e.displayName||e.agentId}),e.isDefault?(0,A.jsx)(S,{variant:`default`,children:o()}):null,(0,A.jsx)(S,{variant:`outline`,children:O(e.via)}),(0,A.jsx)(S,{variant:`secondary`,children:e.state})]},`${e.instanceName} ${e.agentId}`))})]}),(0,A.jsxs)(`section`,{className:`oc-introspect__section`,children:[(0,A.jsx)(`h3`,{className:`oc-introspect__title`,children:p()}),i.charts.length===0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:c()}):(0,A.jsx)(`ul`,{className:`oc-introspect__list`,children:i.charts.map(e=>(0,A.jsxs)(`li`,{className:`oc-introspect__row`,children:[(0,A.jsx)(`span`,{className:`oc-introspect__name`,children:e.name}),(0,A.jsx)(S,{variant:`outline`,children:k(e.via)})]},e.key))})]}),(0,A.jsxs)(`section`,{className:`oc-introspect__section`,children:[(0,A.jsx)(`h3`,{className:`oc-introspect__title`,children:l()}),i.permissions.length===0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:c()}):(0,A.jsx)(`div`,{className:`oc-introspect__chips`,children:i.permissions.map(e=>(0,A.jsx)(S,{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{a_ as r,c_ as i,i_ as a,l_ as o,o_ as s,r_ as c,s_ as l}from"./api-
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{a_ as r,c_ as i,i_ as a,l_ as o,o_ as s,r_ as c,s_ as l}from"./api-B1lq0pb-.js";import{t as u}from"./x-CHx4ismM.js";import{t as d}from"./button-Ds98Pj53.js";import{$ as f,Hn as p,Q as m,X as h,Z as g,et as _,gn as v,jt as y}from"./index-DMM3fags.js";import{r as b}from"./TimeRangePicker-DOkbYJPt.js";var x=t(e(),1),S=n(),C=[{value:`eq`,label:`=`},{value:`neq`,label:`≠`},{value:`contains`,label:o()},{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 o=(0,x.useRef)(t),w=!!(o.current&&o.current.length>0),[D,O]=(0,x.useState)(w),[k,A]=(0,x.useState)(()=>w?E(o.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)(p,{className:`oc-advfilter__chevron`+(D?` is-open`:``),"aria-hidden":!0}),i(),F>0?(0,S.jsx)(`span`,{className:`oc-advfilter__count`,children:F}):null]}),D?(0,S.jsxs)(`div`,{className:`oc-advfilter__body`,children:[k.length===0?(0,S.jsx)(`p`,{className:`oc-admin__hint`,children:l()}):(0,S.jsx)(`ul`,{className:`oc-advfilter__rows`,children:k.map(t=>(0,S.jsxs)(`li`,{className:`oc-advfilter__row`,children:[(0,S.jsxs)(h,{value:t.field||void 0,onValueChange:e=>M(t.id,{field:e}),children:[(0,S.jsx)(f,{size:`sm`,className:`w-40`,children:(0,S.jsx)(_,{placeholder:s()})}),(0,S.jsx)(g,{children:e.map(e=>(0,S.jsx)(m,{value:e.value,children:e.label},e.value))})]}),(0,S.jsxs)(h,{value:t.op,onValueChange:e=>M(t.id,{op:e}),children:[(0,S.jsx)(f,{size:`sm`,className:`w-28`,children:(0,S.jsx)(_,{})}),(0,S.jsx)(g,{children:C.map(e=>(0,S.jsx)(m,{value:e.value,children:e.label},e.value))})]}),(0,S.jsx)(y,{className:`oc-advfilter__value`,value:t.value,onChange:e=>M(t.id,{value:e.target.value}),placeholder:r()}),(0,S.jsx)(d,{variant:`ghost`,size:`icon-sm`,"aria-label":a(),onClick:()=>P(t.id),children:(0,S.jsx)(u,{})})]},t.id))}),(0,S.jsxs)(d,{variant:`outline`,size:`sm`,className:`oc-advfilter__add`,onClick:N,children:[(0,S.jsx)(v,{}),c()]})]}):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{$B as r,$d as i,$o as a,Ao as o,Do as s,Eo as c,Jd as l,Jo as u,Oo as d,Qd as f,Qo as p,Sf as m,To as h,Xd as g,Xo as _,Yd as v,Yo as y,Zd as b,Zo as x,_f as S,aV as C,af as w,an as T,as as E,bf as D,cV as O,cf as k,cp as A,cs as j,df as M,ds as N,ef as P,es as F,ff as ee,fs as I,gf as L,hf as te,if as R,is as z,jo as B,ko as ne,lf as V,ls as re,mf as ie,nN as H,nf as U,ns as ae,of as oe,op as se,os as ce,pf as le,ps as ue,qd as de,qo as fe,rf as pe,rs as me,sV as he,sf as ge,ss as _e,t as W,tV as G,tf as ve,ts as ye,uf as be,us as xe,vf as Se,xf as Ce,yf as we}from"./api-B1lq0pb-.js";import{t as K}from"./button-Ds98Pj53.js";import{$ as Te,B as Ee,Ct as De,Dt as q,Et as Oe,Q as ke,St as Ae,Tt as je,X as Me,Z as Ne,at as Pe,bt as Fe,et as Ie,nt as Le,ot as Re,q as ze,rt as Be,tt as Ve,un as J,vt as He,wt as Ue,xt as We,yt as Ge}from"./index-DMM3fags.js";import{n as Ke,t as qe}from"./curation-CQksaIbm.js";import{a as Je}from"./compatView-Dxc5HuRO.js";/* empty css */var Y=t(e(),1),X=2e4,Ye=6e4;function Xe(e){return typeof e!=`number`||e<=0?0:Math.round(e/X*100)}function Ze(e){return e<=0?0:Math.round(e/Ye*100)}function Z(e,t){let n=(typeof e==`number`&&e>0?e:0)/1e3;return new Intl.NumberFormat(t,{minimumFractionDigits:1,maximumFractionDigits:1}).format(n)}function Qe(e){return e.reduce((e,t)=>e+(typeof t.size==`number`&&t.size>0?t.size:0),0)}var $e=3;function et(e,t){let n=new Map;for(let t of e.split(`
|
|
2
|
+
`))n.set(t,(n.get(t)??0)+1);for(let e of t.split(`
|
|
3
|
+
`))n.set(e,(n.get(e)??0)-1);let r=0,i=0,a=[],o=[];for(let[e,t]of n)t<0?(r+=-t,a.length<$e&&a.push(e)):t>0&&(i+=t,o.length<$e&&o.push(e));return{added:r,removed:i,sampleAdded:a,sampleRemoved:o}}function tt(e){return(e instanceof Error?e.message:String(e)).includes(`DASHBOARD_NOT_DEPLOYED`)}function nt(e){return e instanceof Error?e.message.includes(`conflict:`):String(e).includes(`conflict:`)}var Q=n(),$=e=>`${e.instanceName}::${e.agentId}`;function rt(){let e=O(W.me.getMe,{host:ze}),t=e?.role===`admin`,n=(e?.permissions??[]).includes(`bridge.read`),i=O(W.admin.listInstances,e!==void 0&&t?{}:`skip`),[a,o]=(0,Y.useState)(null);(0,Y.useEffect)(()=>{!t||!i||i.length===0||(!a||!i.some(e=>e.name===a))&&o(i[0].name)},[t,i,a]);let s=O(W.agents.listAgentsForInstance,t&&a?{instanceName:a}:`skip`),c=O(W.agents.listMyAgents,e!==void 0&&!t?{}:`skip`),l=(0,Y.useMemo)(()=>{if(e!==void 0){if(t)return a===null||s===void 0?i!==void 0&&i.length===0?[]:void 0:s.agents.map(e=>({instanceName:a,agentId:e.agentId,label:`${e.emoji?`${e.emoji} `:``}${e.displayName??e.agentId}`}));if(c!==void 0)return c.map(e=>({instanceName:e.instanceName,agentId:e.agentId,label:`${e.emoji?`${e.emoji} `:``}${e.displayName??e.agentId}`}))}},[e,t,a,s,i,c]),[u,d]=(0,Y.useState)(null);(0,Y.useEffect)(()=>{!l||l.length===0||(!u||!l.some(e=>$(e)===u))&&d($(l[0]))},[l,u]);let f=l?.find(e=>$(e)===u)??null,p=C(W.agentFiles.listAgentFiles),[h,g]=(0,Y.useState)({status:`idle`}),_=f?.instanceName??null,v=f?.agentId??null,y=O(W.compat.forInstance,n&&_!==null?{instanceName:_}:`skip`),b=n&&_!==null?Ee(y,`agentFiles`):null,x=b===null?!1:b===`loading`?null:b.blocked,w=(0,Y.useCallback)(async()=>{if(!(_===null||v===null)){g({status:`loading`});try{g({status:`done`,files:(await p({instanceName:_,agentId:v})).files})}catch(e){g({status:`error`,dashboardAbsent:tt(e)})}}},[p,_,v]);(0,Y.useEffect)(()=>{x===!1&&w()},[w,x]);let[E,k]=(0,Y.useState)(null),A=O(W.agentFileCuration.listCurations,t&&_!==null&&v!==null?{instanceName:_,agentId:v}:`skip`),N=O(W.agentFileCuration.curationSettings,t&&_!==null?{instanceName:_}:`skip`),P=C(W.agentFileCuration.requestCuration),[F,I]=(0,Y.useState)(null),[R,z]=(0,Y.useState)(null),{toast:B}=q(),ne=(0,Y.useMemo)(()=>{let e=new Map;for(let t of A??[])e.has(t.name)||e.set(t.name,t);return e},[A]),V=(0,Y.useCallback)(async e=>{if(!(_===null||v===null)){I(e);try{let t=await P({instanceName:_,agentId:v,name:e,trigger:`manual`});t.ok?B({title:xe(),variant:`success`}):B({title:re({reason:t.reason??`unknown`}),variant:`error`})}catch{B({title:j(),variant:`error`})}finally{I(null)}}},[P,_,v,B]),H=G(),U=(0,Y.useMemo)(()=>new Intl.NumberFormat(H,{maximumFractionDigits:0}),[H]);return e===void 0||l===void 0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:r()}):(0,Q.jsxs)(`div`,{className:`oc-afiles`,children:[(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:m()}),(0,Q.jsxs)(`div`,{className:`oc-afiles__picker`,children:[t&&(i?.length??0)>1?(0,Q.jsxs)(Me,{value:a??``,onValueChange:e=>o(e),children:[(0,Q.jsx)(Te,{size:`sm`,"aria-label":Ce(),children:(0,Q.jsx)(Ie,{})}),(0,Q.jsx)(Ne,{children:(i??[]).map(e=>(0,Q.jsx)(ke,{value:e.name,children:e.name},e.name))})]}):null,l.length>0?(0,Q.jsxs)(Me,{value:u??``,onValueChange:e=>d(e),children:[(0,Q.jsx)(Te,{size:`sm`,"aria-label":D(),children:(0,Q.jsx)(Ie,{})}),(0,Q.jsx)(Ne,{children:l.map(e=>(0,Q.jsx)(ke,{value:$(e),children:e.label},$(e)))})]}):(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:we()})]}),f===null?null:b===`loading`?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:r()}):b!==null&&b.blocked?(0,Q.jsxs)(`p`,{className:`oc-compat__blocked`,role:`status`,children:[(0,Q.jsx)(J,{size:14,"aria-hidden":!0}),` `,Je(b.gatewayVersion,b.provider)]}):h.status===`loading`||h.status===`idle`?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:r()}):h.status===`error`?(0,Q.jsxs)(`p`,{className:`oc-afiles__error`,role:`alert`,children:[h.dashboardAbsent?T():S(),` `,!h.dashboardAbsent&&(0,Q.jsx)(K,{variant:`outline`,size:`sm`,onClick:()=>void w(),children:se()})]}):h.files.length===0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:Se()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`div`,{className:`oc-afiles__list`,children:h.files.map(e=>{let n=Xe(e.size),r=n>=80;return(0,Q.jsxs)(`div`,{className:`oc-afiles__row`,children:[(0,Q.jsx)(`span`,{className:`oc-afiles__name`,title:e.name,children:e.name}),e.missing?(0,Q.jsx)(Oe,{variant:`outline`,children:L()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`span`,{className:`oc-afiles__size`,children:te({size:Z(e.size,H)})}),(0,Q.jsx)(`span`,{className:`oc-afiles__gauge${r?` is-warn`:``}`,"aria-hidden":!0,children:(0,Q.jsx)(`span`,{className:`oc-afiles__gauge-fill`,style:{width:`${Math.min(n,100)}%`}})}),(0,Q.jsx)(`span`,{className:`oc-afiles__pct`,children:ie({pct:U.format(n)})}),r?(0,Q.jsx)(J,{size:14,className:`oc-afiles__warn`,"aria-label":le()}):(0,Q.jsx)(`span`,{className:`oc-afiles__warn-slot`,"aria-hidden":!0})]}),(0,Q.jsx)(K,{variant:`outline`,size:`sm`,className:`oc-afiles__open`,onClick:()=>k(e),children:t?M():be()}),t&&!e.missing?(0,Q.jsx)(it,{curatable:qe.includes(e.name),size:e.size??0,budget:N?.budgetChars??null,enabled:N?.enabled??!1,curation:ne.get(e.name)??null,inFlight:F===e.name,onCurate:()=>void V(e.name),onReview:e=>z(e)}):null]},e.name)})}),(0,Q.jsx)(`p`,{className:`oc-afiles__budget`,children:ee({used:Z(Qe(h.files),H),total:Z(Ye,H),pct:U.format(Ze(Qe(h.files)))})})]}),E&&f?(0,Q.jsx)(at,{instanceName:f.instanceName,agentId:f.agentId,name:E.name,isAdmin:t,onClose:()=>k(null),onSaved:()=>void w()}):null,R?(0,Q.jsx)(ot,{curationId:R,onClose:()=>z(null),onApplied:()=>{z(null),w()}}):null]})}function it({curatable:e,size:t,budget:n,enabled:r,curation:i,inFlight:a,onCurate:o,onReview:s}){return i?.status===`proposed`?(0,Q.jsx)(K,{variant:`default`,size:`sm`,className:`oc-afiles__curate`,onClick:()=>s(i._id),children:I()}):a||i?.status===`dispatched`||i?.status===`applying`?(0,Q.jsx)(Oe,{variant:`outline`,className:`oc-afiles__curate-status`,children:N()}):e&&r&&n!==null&&Ke(t,n)?(0,Q.jsx)(K,{variant:`outline`,size:`sm`,className:`oc-afiles__curate`,onClick:o,children:ue()}):null}function at({instanceName:e,agentId:t,name:n,isAdmin:a,onClose:o,onSaved:s}){let c=C(W.agentFiles.getAgentFile),u=C(W.agentFiles.setAgentFile),d=q(),[p,m]=(0,Y.useState)(null),[h,_]=(0,Y.useState)(!1),[y,x]=(0,Y.useState)(``),[S,T]=(0,Y.useState)(!1),[E,D]=(0,Y.useState)(!1),[O,j]=(0,Y.useState)(!1),[M,N]=(0,Y.useState)(!1),F=(0,Y.useCallback)(async r=>{_(!1);try{let i=await c({instanceName:e,agentId:t,name:n});m({content:i.content,updatedAtMs:i.updatedAtMs}),r||x(i.content),j(!1)}catch{_(!0)}},[c,e,t,n]);(0,Y.useEffect)(()=>{F(!1)},[F]);async function ee(){if(p!==null){D(!0),N(!1);try{await u({instanceName:e,agentId:t,name:n,content:y,baseUpdatedAtMs:p.updatedAtMs??void 0}),d.success(pe({name:n})),s(),await F(!1)}catch(e){nt(e)?j(!0):N(!0)}finally{D(!1)}}}let I=p!==null&&y!==p.content,L=(0,Y.useMemo)(()=>p===null?null:et(p.content,y),[p,y]),te=y.length>X,z=G(),B=(0,Y.useMemo)(()=>new Intl.NumberFormat(z),[z]);return(0,Q.jsx)(Ve,{open:!0,onOpenChange:e=>!e&&o(),children:(0,Q.jsxs)(Le,{className:`oc-afiles__editor`,children:[(0,Q.jsxs)(Pe,{children:[(0,Q.jsx)(Re,{children:V({name:n})}),(0,Q.jsxs)(Be,{children:[k({agent:t,instance:e}),a?null:(0,Q.jsxs)(Q.Fragment,{children:[` · `,ge()]})]})]}),h?(0,Q.jsxs)(`p`,{className:`oc-afiles__error`,role:`alert`,children:[ve(),` `,(0,Q.jsx)(K,{variant:`outline`,size:`sm`,onClick:()=>void F(!1),children:se()})]}):p===null?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:r()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`textarea`,{className:`oc-afiles__source`,value:y,readOnly:!a,spellCheck:!1,onChange:e=>x(e.target.value),"aria-label":V({name:n})}),(0,Q.jsx)(`p`,{className:`oc-afiles__hint`,children:oe()}),O?(0,Q.jsxs)(`p`,{className:`oc-afiles__error`,role:`alert`,children:[P(),` `,(0,Q.jsx)(K,{variant:`outline`,size:`sm`,onClick:()=>void F(!0),children:i()})]}):null,M?(0,Q.jsx)(`p`,{className:`oc-afiles__error`,role:`alert`,children:U()}):null,(0,Q.jsxs)(`div`,{className:`oc-afiles__editor-foot`,children:[(0,Q.jsx)(`span`,{className:`oc-afiles__count${te?` is-over`:``}`,children:w({count:B.format(y.length),max:B.format(X)})}),a?(0,Q.jsx)(K,{size:`sm`,disabled:!I||E||O,onClick:()=>T(!0),children:E?A():R()}):null]})]}),(0,Q.jsx)(He,{open:S,onOpenChange:T,children:(0,Q.jsxs)(We,{children:[(0,Q.jsxs)(Ue,{children:[(0,Q.jsx)(je,{children:f({name:n})}),(0,Q.jsx)(Ae,{children:b({agent:t})})]}),L?(0,Q.jsxs)(`div`,{className:`oc-afiles__diff`,children:[(0,Q.jsx)(`p`,{className:`oc-afiles__diff-counts`,children:g({added:L.added,removed:L.removed})}),L.sampleAdded.length>0?(0,Q.jsxs)(`div`,{className:`oc-afiles__diff-block`,children:[(0,Q.jsx)(`span`,{className:`oc-afiles__diff-label`,children:v()}),L.sampleAdded.map((e,t)=>(0,Q.jsx)(`code`,{className:`oc-afiles__diff-line is-add`,children:e||` `},t))]}):null,L.sampleRemoved.length>0?(0,Q.jsxs)(`div`,{className:`oc-afiles__diff-block`,children:[(0,Q.jsx)(`span`,{className:`oc-afiles__diff-label`,children:l()}),L.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)(Fe,{children:H()}),(0,Q.jsx)(Ge,{onClick:()=>void ee(),children:de()})]})]})})]})})}function ot({curationId:e,onClose:t,onApplied:n}){let i=O(W.agentFileCuration.getProposal,{curationId:e}),l=C(W.agentFileCuration.approveCuration),f=he(W.agentFileCuration.rejectCuration),{toast:m}=q(),[g,v]=(0,Y.useState)(null),[b,S]=(0,Y.useState)(!1),[w,T]=(0,Y.useState)(``),D=G(),k=(0,Y.useMemo)(()=>i?et(i.beforeContent,i.proposedContent):null,[i]);async function M(){v(`approve`);try{let t=await l({curationId:e});t.ok?(m({title:_e(),variant:`success`}),n()):m({title:t.reason===`conflict`?E():z({reason:t.reason??`unknown`}),variant:`error`})}catch{m({title:j(),variant:`error`})}finally{v(null)}}async function N(n){v(`reject`);try{let r=w.trim();(await f({curationId:e,...r?{comment:r}:{},relaunch:n})).ok?m({title:n?c():ce(),variant:`success`}):m({title:ye(),variant:`error`}),t()}catch{m({title:j(),variant:`error`})}finally{v(null)}}return(0,Q.jsx)(Ve,{open:!0,onOpenChange:e=>e?void 0:t(),children:(0,Q.jsxs)(Le,{className:`oc-afiles__review`,children:[(0,Q.jsxs)(Pe,{children:[(0,Q.jsx)(Re,{children:i?me({name:i.name}):r()}),(0,Q.jsx)(Be,{children:ae()})]}),i===void 0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:r()}):i===null?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:ye()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`p`,{className:`oc-afiles__review-sizes`,children:[F({before:Z(i.beforeSize,D),after:Z(i.proposedSize,D)}),i.overBudget?(0,Q.jsxs)(Q.Fragment,{children:[` `,(0,Q.jsx)(J,{size:13,"aria-hidden":!0}),` `,a()]}):null]}),k?(0,Q.jsx)(`p`,{className:`oc-afiles__review-diff`,children:p({added:k.added,removed:k.removed})}):null,i.feedback?(0,Q.jsx)(`p`,{className:`oc-afiles__review-feedback`,children:h({feedback:i.feedback})}):null,k&&k.sampleRemoved.length>0?(0,Q.jsxs)(`div`,{className:`oc-afiles__review-removed`,children:[(0,Q.jsx)(`p`,{className:`oc-afiles__review-label`,children:fe()}),(0,Q.jsx)(`ul`,{children:k.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:u()}),(0,Q.jsx)(`pre`,{className:`oc-afiles__review-pre`,children:i.beforeContent})]}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`p`,{className:`oc-afiles__review-label`,children:x()}),(0,Q.jsx)(`pre`,{className:`oc-afiles__review-pre`,children:i.proposedContent})]})]})]}),b?(0,Q.jsxs)(`div`,{className:`oc-afiles__reject-form`,children:[(0,Q.jsx)(`label`,{className:`oc-afiles__review-label`,htmlFor:`curation-reject-comment`,children:B()}),(0,Q.jsx)(`textarea`,{id:`curation-reject-comment`,className:`oc-afiles__reject-textarea`,rows:3,placeholder:o(),value:w,onChange:e=>T(e.target.value)}),(0,Q.jsxs)(`div`,{className:`oc-afiles__review-actions`,children:[(0,Q.jsx)(K,{variant:`ghost`,onClick:()=>S(!1),disabled:g!==null,children:ne()}),(0,Q.jsx)(K,{variant:`outline`,onClick:()=>void N(!1),disabled:g!==null,children:g===`reject`?A():d()}),(0,Q.jsx)(K,{variant:`default`,onClick:()=>void N(!0),disabled:g!==null,children:g===`reject`?A():s()})]})]}):(0,Q.jsxs)(`div`,{className:`oc-afiles__review-actions`,children:[(0,Q.jsx)(K,{variant:`outline`,onClick:()=>S(!0),disabled:g!==null||i==null,children:_()}),(0,Q.jsx)(K,{variant:`default`,onClick:()=>void M(),disabled:g!==null||i==null,children:g===`approve`?A():y()})]})]})})}export{rt as AgentFilesTab};
|
|
@@ -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,Bw as a,Cw as o,Dw as ee,Ew as te,Fw as ne,Gw as re,Hw as ie,Iw as s,Jw as ae,Kw as oe,Lw as se,Mw as c,Nw as ce,Ow as le,Pw as l,Qw as ue,Rw as de,Sw as fe,Tw as pe,Uw as me,Vw as he,Ww as ge,Xw as _e,Yw as ve,Zw as u,_w as d,aT as f,bw as p,cT as m,cV as h,eT as ye,gw as g,hw as _,iT as be,jw as xe,kw as Se,mw as v,nT as Ce,oT as y,pw as b,qw as x,rT as S,sT as C,sV as w,t as T,tT as E,vw as D,ww as O,xw as k,yw as A,zw as j}from"./api-B1lq0pb-.js";import{$ as M,Dt as we,Et as N,Gn as P,Kn as Te,Q as F,U as Ee,X as I,Z as L,at as R,ct as z,et as B,i as De,nt as V,o as Oe,ot as H,q as ke,tt as U}from"./index-DMM3fags.js";import{n as Ae}from"./TimeRangePicker-DOkbYJPt.js";import{t as je}from"./FilterBar-CK5Wsnof.js";import{t as Me}from"./DataTableShell-CDmo0isC.js";import{t as W}from"./dispatchErrorInfo-BGvs3mZA.js";var G=t(e(),1),K=n(),q=`__all__`,Ne=[{value:`open`},{value:`acknowledged`},{value:`resolved`}];function Pe(e){return e===`open`?m():e===`acknowledged`?C():y()}var Fe=[`info`,`warn`,`critical`],Ie=[`detector`,`agent`,`user`],Le={kind:`relative`,from:`now-30d`,to:`now`},Re=200,J=`all`;function Y(){let e=Te({from:`/settings/anomalies`}),t=P({from:`/settings/anomalies`}),n=e.q??``,d=e.status===J?q:e.status,p=e.severity??q,m=e.kind??q,[g,_]=(0,G.useState)(q),v=De(e.from,e.to),{from:y,to:b}=Ae(v),C=e=>void t({search:t=>({...t,q:e||void 0}),replace:!0}),D=e=>void t({search:t=>({...t,status:e===q?J:e})}),A=e=>void t({search:t=>({...t,severity:e===q?void 0:e})}),R=e=>void t({search:t=>({...t,kind:e===q?void 0:e})}),V=e=>void t({search:t=>({...t,...Oe(e)})}),H=Ee(),U=we(),W=w(T.anomalies.resolveAnomaly),Y=(h(T.me.getMe,{host:ke})?.permissions??[]).includes(`admin.manage`),X=h(T.anomalies.listAnomalies,{limit:Re,filter:{q:n||void 0,from:y,to:b,anomalyStatus:d===q?void 0:d,severity:p===q?void 0:p,source:g===q?void 0:g,kind:m===q?void 0:m}}),Z=(0,G.useMemo)(()=>{let e=new Set;for(let t of X??[])e.add(t.kind);return[...e].sort()},[X]),Q=n!==``||d!==`open`||p!==q||g!==q||m!==q||v.kind!==`relative`||v.from!==Le.from;function Ue(){_(q),t({search:{status:`open`},replace:!0})}async function We(e){if(await H({title:f(),description:(0,K.jsxs)(K.Fragment,{children:[be(),` `,(0,K.jsx)(`span`,{className:`font-mono`,children:e.kind}),` `,S(),` `,(0,K.jsx)(`strong`,{children:Ce()}),`.`,` `,E()]}),confirmLabel:ye()}))try{await W({anomalyId:e._id,status:`resolved`}),U.success(r(),e.kind)}catch(e){U.error(ue(),e)}}async function Ge(e){try{await W({anomalyId:e._id,status:`acknowledged`}),U.success(u(),e.kind)}catch(e){U.error(_e(),e)}}return(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)(`p`,{className:`oc-admin__hint`,children:[ve(),` `,(0,K.jsx)(`strong`,{children:ae()}),` `,x(),` `,(0,K.jsx)(`strong`,{children:oe()}),` `,re(),` `,(0,K.jsx)(`strong`,{children:ge()}),` `,me(),` `,(0,K.jsx)(`span`,{className:`oc-filter__window`,children:ie()})]}),(0,K.jsxs)(je,{q:n,onQChange:C,searchPlaceholder:he(),timeRange:v,onTimeRangeChange:V,onReset:Ue,canReset:Q,children:[(0,K.jsxs)(I,{value:d,onValueChange:D,children:[(0,K.jsx)(M,{size:`sm`,className:`w-36`,children:(0,K.jsx)(B,{})}),(0,K.jsxs)(L,{children:[(0,K.jsx)(F,{value:q,children:a()}),Ne.map(e=>(0,K.jsx)(F,{value:e.value,children:Pe(e.value)},e.value))]})]}),(0,K.jsxs)(I,{value:p,onValueChange:A,children:[(0,K.jsx)(M,{size:`sm`,className:`w-36`,children:(0,K.jsx)(B,{placeholder:j()})}),(0,K.jsxs)(L,{children:[(0,K.jsx)(F,{value:q,children:ne()}),Fe.map(e=>(0,K.jsx)(F,{value:e,children:e},e))]})]}),(0,K.jsxs)(I,{value:g,onValueChange:_,children:[(0,K.jsx)(M,{size:`sm`,className:`w-32`,children:(0,K.jsx)(B,{placeholder:l()})}),(0,K.jsxs)(L,{children:[(0,K.jsx)(F,{value:q,children:ce()}),Ie.map(e=>(0,K.jsx)(F,{value:e,children:e},e))]})]}),(0,K.jsxs)(I,{value:m,onValueChange:R,children:[(0,K.jsx)(M,{size:`sm`,className:`w-36`,children:(0,K.jsx)(B,{placeholder:c()})}),(0,K.jsxs)(L,{children:[(0,K.jsx)(F,{value:q,children:xe()}),Z.map(e=>(0,K.jsx)(F,{value:e,children:e},e))]})]})]}),(0,K.jsx)(Me,{title:i(),rows:X,emptyHint:d===`open`?Se():le(),rowActions:e=>Y&&e.status===`open`?[{label:ee(),onSelect:()=>void We(e)},{label:te(),onSelect:()=>void Ge(e)}]:[],columns:[{header:pe(),cell:e=>(0,K.jsx)(`span`,{className:`oc-traces__time`,children:z(e.at)}),sort:e=>e.at},{header:c(),cell:e=>(0,K.jsx)(`code`,{className:`oc-traces__mono`,children:e.kind}),sort:e=>e.kind},{header:de(),cell:e=>e.occurrenceCount!==null&&e.occurrenceCount>1?(0,K.jsx)(`span`,{className:`oc-traces__time`,title:e.firstAt===null?void 0:s({when:z(e.firstAt)}),children:se({count:String(e.occurrenceCount)})}):(0,K.jsx)(`span`,{className:`oc-traces__time`,children:`—`}),sort:e=>e.occurrenceCount??0},{header:j(),cell:e=>(0,K.jsx)(Be,{severity:e.severity}),sort:e=>e.severity===`critical`?2:+(e.severity===`warn`)},{header:O(),cell:e=>(0,K.jsx)(Ve,{status:e.status}),sort:e=>e.status===`resolved`?2:+(e.status===`acknowledged`)},{header:l(),cell:e=>(0,K.jsx)(N,{variant:`outline`,children:e.source}),sort:e=>e.source},{header:o(),cell:e=>(0,K.jsxs)(`div`,{className:`oc-anomaly__msgcell`,children:[(0,K.jsx)(`span`,{className:`oc-anomaly__msg`,children:e.message}),(0,K.jsx)($,{row:e})]}),sort:e=>e.message},{header:fe(),cell:e=>(0,K.jsx)(ze,{row:e}),sort:e=>e.evidence??null},{header:k(),cell:e=>e.correlationId?(0,K.jsx)(`code`,{className:`oc-traces__mono`,children:He(e.correlationId)}):(0,K.jsx)(`span`,{className:`oc-traces__muted`,children:`—`}),sort:e=>e.correlationId}]})]})}var X=new Set([`openclaw.dispatch_failures`,`assistant.announce_errors`]);function Z(e){if(!X.has(e.kind)||!e.evidence)return{};try{let t=JSON.parse(e.evidence);return{dominantCode:t.dominantCode,sampleCorrelationId:t.sampleCorrelationId}}catch{return{}}}function Q(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=P();if(e.kind===`subagent.failure`){let n=Q(e);return(0,K.jsxs)(`div`,{className:`oc-anomaly__cause`,children:[(0,K.jsx)(`div`,{className:`oc-anomaly__cause-head`,children:[...new Set(n.errorCategories??[])].map(e=>(0,K.jsx)(`code`,{className:`oc-traces__mono`,children:e},e))}),e.correlationId?(0,K.jsxs)(`button`,{type:`button`,className:`oc-anomaly__drill`,onClick:()=>void t({to:`/settings/traces`,search:{q:e.correlationId,limit:100}}),children:[`↗ `,p()]}):null]})}let n=Z(e);if(!n.dominantCode){let e=n.sampleCorrelationId;return e?(0,K.jsx)(`div`,{className:`oc-anomaly__cause`,children:(0,K.jsxs)(`button`,{type:`button`,className:`oc-anomaly__drill`,onClick:()=>void t({to:`/settings/traces`,search:{correlationId:e,limit:100}}),children:[`↗ `,p()]})}):(0,K.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})}let r=W(n.dominantCode),i=n.sampleCorrelationId;return(0,K.jsxs)(`div`,{className:`oc-anomaly__cause`,children:[(0,K.jsxs)(`div`,{className:`oc-anomaly__cause-head`,children:[(0,K.jsx)(`span`,{className:`oc-anomaly__cause-label`,children:r.label}),(0,K.jsx)(`code`,{className:`oc-traces__mono`,children:n.dominantCode})]}),(0,K.jsx)(`p`,{className:`oc-anomaly__cause-hint`,children:r.hint}),i?(0,K.jsxs)(`button`,{type:`button`,className:`oc-anomaly__drill`,onClick:()=>void t({to:`/settings/traces`,search:{correlationId:i,limit:100}}),children:[`↗ `,p()]}):null]})}function $({row:e}){let[t,n]=(0,G.useState)(!1),r=h(T.anomalies.getAnomalyAttachments,t?{anomalyId:e._id}:`skip`);return!e.attachments||e.attachments.length===0?null:(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)(`button`,{type:`button`,className:`oc-anomaly__drill`,onClick:()=>n(!0),children:[A(),e.attachments.length>1?` (${e.attachments.length})`:``]}),(0,K.jsx)(U,{open:t,onOpenChange:n,children:(0,K.jsxs)(V,{className:`oc-anomaly__attachments-dialog`,children:[(0,K.jsx)(R,{children:(0,K.jsx)(H,{children:D()})}),r===void 0?(0,K.jsx)(`p`,{className:`oc-traces__muted`,children:d()}):r.length===0?(0,K.jsx)(`p`,{className:`oc-traces__muted`,children:g()}):(0,K.jsx)(`div`,{className:`oc-anomaly__attachments`,children:r.map(e=>(0,K.jsxs)(`section`,{className:`oc-anomaly__attachment`,children:[(0,K.jsx)(`h4`,{className:`oc-anomaly__attachment-name`,children:(0,K.jsx)(`code`,{className:`oc-traces__mono`,children:e.name})}),(0,K.jsx)(`pre`,{className:`oc-anomaly__attachment-content`,children:e.content})]},e.name))})]})})]})}function Be({severity:e}){return(0,K.jsx)(`span`,{className:`oc-anomaly__sev oc-anomaly__sev--${e}`,children:e})}function Ve({status:e}){return e===`open`?(0,K.jsx)(N,{variant:`destructive`,children:_()}):e===`acknowledged`?(0,K.jsx)(N,{variant:`secondary`,children:v()}):(0,K.jsx)(N,{variant:`outline`,children:b()})}function He(e){return e.length>8?e.slice(0,8):e}export{Y as AnomaliesTab};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Ca as r,Da as i,Ea as a,Sa as o,Ta as s,aE as c,cE as l,cV as u,dE as d,eE as f,fE as p,iE as m,lE as h,mE as g,nE as _,oE as v,pE as y,rE as b,sE as x,t as S,tE as C,uE as w,wa as T}from"./api-B1lq0pb-.js";import{$ as E,Gn as D,Kn as O,Q as k,X as A,Z as j,a as M,ct as N,et as P,i as F,n as I,o as L,s as R}from"./index-DMM3fags.js";import{n as ee}from"./TimeRangePicker-DOkbYJPt.js";import{t as z}from"./FilterBar-CK5Wsnof.js";import{t as B}from"./AdvancedFilter-CZnbykZe.js";import{t as V}from"./DataTableShell-CDmo0isC.js";var H=t(e(),1),U=n(),W={kind:`relative`,from:I,to:`now`},G=`__all__`,K=[{value:`action`,label:i()},{value:`realLabel`,label:a()},{value:`targetLabel`,label:s()},{value:`impersonated`,label:T()},{value:`resource`,label:r()},{value:`resourceId`,label:o()}];function q(){let e=O({from:`/settings/audit`}),t=D({from:`/settings/audit`}),n=e.q??``,r=e.action??G,i=e.impersonated??G,a=e.resource??G,o=F(e.from,e.to),s=(0,H.useMemo)(()=>R(e.adv),[e.adv]),{from:T,to:I}=ee(o),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,...L(e)})}),Q=e=>void t({search:t=>({...t,adv:M(e)}),replace:!0}),$=u(S.admin.listAudit,{filter:{q:n||void 0,from:T,to:I,action:r===G?void 0:r,resource:a===G?void 0:a,impersonated:i===G?void 0:i===`yes`,advanced:s.length>0?s:void 0}}),te=(0,H.useMemo)(()=>{let e=new Set;for(let t of $??[])e.add(t.action);return[...e].sort()},[$]),ne=(0,H.useMemo)(()=>{let e=new Set;for(let t of $??[])t.resource&&e.add(t.resource);return[...e].sort()},[$]),re=n!==``||r!==G||i!==G||a!==G||s.length>0||o.kind!==`relative`||o.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:[g(),` `,(0,U.jsx)(`span`,{className:`oc-filter__window`,children:y()})]}),(0,U.jsxs)(z,{q:n,onQChange:q,searchPlaceholder:p(),timeRange:o,onTimeRangeChange:Z,onReset:ie,canReset:re,children:[(0,U.jsxs)(A,{value:r,onValueChange:J,children:[(0,U.jsx)(E,{size:`sm`,className:`w-40`,children:(0,U.jsx)(P,{placeholder:d()})}),(0,U.jsxs)(j,{children:[(0,U.jsx)(k,{value:G,children:w()}),te.map(e=>(0,U.jsx)(k,{value:e,children:e},e))]})]}),(0,U.jsxs)(A,{value:i,onValueChange:Y,children:[(0,U.jsx)(E,{size:`sm`,className:`w-40`,children:(0,U.jsx)(P,{})}),(0,U.jsxs)(j,{children:[(0,U.jsx)(k,{value:G,children:h()}),(0,U.jsx)(k,{value:`yes`,children:l()}),(0,U.jsx)(k,{value:`no`,children:x()})]})]}),(0,U.jsxs)(A,{value:a,onValueChange:X,children:[(0,U.jsx)(E,{size:`sm`,className:`w-40`,children:(0,U.jsx)(P,{placeholder:v()})}),(0,U.jsxs)(j,{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:s,onChange:Q}),(0,U.jsx)(V,{title:m(),rows:$,emptyHint:b(),columns:[{header:_(),cell:e=>N(e.at),sort:e=>e.at},{header:d(),cell:e=>e.action,sort:e=>e.action},{header:C(),cell:e=>e.realLabel,sort:e=>e.realLabel},{header:f(),cell:e=>e.targetLabel??`—`,sort:e=>e.targetLabel??null},{header:v(),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{$b as r,$x as i,Ad as a,Ax as o,Bb as s,Cx as c,D as l,Dd as u,Dx as d,Ed as f,Ex as p,Fb as m,Fd as h,Gb as g,Gi as _,Hb as v,Ib as y,Id as b,Jb as x,Ji as S,Kb as ee,Ki as te,Lb as ne,Md as re,Nb as ie,Nd as ae,Od as oe,Ox as se,Pb as ce,Pd as le,Qb as ue,Rb as de,Sx as fe,Td as pe,Tx as me,Ub as he,Vb as ge,Wb as _e,Wi as ve,Xb as ye,Yb as be,Zb as xe,Zi as Se,_x as Ce,aS as we,aV as Te,ax as Ee,bx as De,cS as Oe,cV as C,cx as w,dx as ke,eS as Ae,ex as je,fS as Me,fx as Ne,gx as Pe,hx as Fe,iS as Ie,ix as Le,j as Re,jd as ze,jx as Be,kd as Ve,kx as He,lS as Ue,lx as We,mx as Ge,nx as Ke,oS as qe,on as Je,ox as Ye,pS as Xe,px as Ze,qb as T,qi as Qe,rS as $e,rx as et,sS as tt,sV as nt,sx as rt,t as E,tx as it,uS as at,ux as ot,vx as st,wd as ct,wx as lt,xx as ut,yd as dt,yx as ft,zb as pt}from"./api-B1lq0pb-.js";import{t as mt}from"./chevrons-up-down-Du-SfIms.js";import{i as ht,n as D,o as gt,r as _t,s as vt}from"./FieldLabel-4AzJbj-7.js";import{i as yt,n as bt,r as xt,t as St}from"./tabs-vdU2pkw5.js";import{t as Ct}from"./button-Ds98Pj53.js";import{$ as O,Bn as k,Bt as wt,Dn as Tt,Dt as Et,Et as A,F as Dt,Gn as j,Hn as M,Kn as Ot,Q as N,Rn as P,Rt as kt,X as F,Z as I,at as At,ct as L,et as R,jt as z,lt as B,nt as jt,ot as Mt,pn as Nt,q as Pt,rt as Ft,tt as It,un as V,ut as Lt,zn as Rt,zt}from"./index-DMM3fags.js";import{r as Bt}from"./locales-CPjguROj.js";import{a as Vt,i as H,n as Ht,o as U,r as W,t as Ut}from"./table-B15ESmxP.js";import{t as Wt}from"./FilterBar-CK5Wsnof.js";import{c as Gt,i as Kt,n as qt,o as Jt,r as Yt,s as Xt,t as Zt}from"./compatView-Dxc5HuRO.js";import{t as G}from"./dispatchErrorInfo-BGvs3mZA.js";var Qt=l(`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`}]]),$t=l(`wifi-off`,[[`path`,{d:`M12 20h.01`,key:`zekei9`}],[`path`,{d:`M8.5 16.429a5 5 0 0 1 7 0`,key:`1bycff`}],[`path`,{d:`M5 12.859a10 10 0 0 1 5.17-2.69`,key:`1dl1wf`}],[`path`,{d:`M19 12.859a10 10 0 0 0-2.007-1.523`,key:`4k23kn`}],[`path`,{d:`M2 8.82a15 15 0 0 1 4.177-2.643`,key:`1grhjp`}],[`path`,{d:`M22 8.82a15 15 0 0 0-11.288-3.764`,key:`z3jwby`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}]]),K=t(e(),1);function en(e){return e.filter(e=>e.state===`error`)}function tn(e){return e.reachable&&en(e.targets).length===0}function nn(e){return tn(e)?(e.unreachableInstances??[]).length>0?`gateways_unreachable`:`ok`:`error`}function rn(e){return e.state===`error`&&e.lastErrorCode!==null}function an(e){return!!e.lastDownstreamRejectCode}function on(e){return!!e.lastLocalRefusalCode}function sn(e){return rn(e)||an(e)||on(e)}function q(e){return e.kind??`openclaw`}function cn(e){return[...e].sort((e,t)=>e===`openclaw`?-1:t===`openclaw`?1:e.localeCompare(t))}function ln(e,t,n){let r=new Map;for(let e of t)e.instanceName&&r.set(e.instanceName,e.provider);for(let e of n)r.set(e.name,q(e));let i=e=>(e.instanceName?r.get(e.instanceName):void 0)??`openclaw`,a=new Set;for(let e of n)a.add(q(e));for(let e of t)a.add(e.provider);for(let t of e)a.add(i(t));return cn(a).map(r=>({key:r,connections:e.filter(e=>i(e)===r),compatTargets:t.filter(e=>e.provider===r),instances:n.filter(e=>q(e)===r)}))}function J(e){return e===`openclaw`?`OpenClaw`:e===`hermes`?`Hermes`:e.charAt(0).toUpperCase()+e.slice(1)}var Y=`__all__`,un={q:``,state:Y,instance:Y,version:Y},X={connected:0,error:1,idle:2};function dn(e){return e.q.trim()!==``||e.state!==`__all__`||e.instance!==`__all__`||e.version!==`__all__`}function fn(e,t){let n=t.q.trim().toLowerCase();return e.filter(e=>!(n&&!`${e.targetLabel} ${e.gatewayHost}`.toLowerCase().includes(n)||t.state!==`__all__`&&e.state!==t.state||t.instance!==`__all__`&&(e.instanceName??``)!==t.instance||t.version!==`__all__`&&(e.gatewayVersion??``)!==t.version))}function Z(e,t){return e.localeCompare(t,void 0,{numeric:!0,sensitivity:`base`})}function pn(e,t){return e===`version`?t.gatewayVersion===null:e===`lastOk`?t.lastOkAt===null:!1}function mn(e,t,n){switch(e){case`state`:return(X[t.state]??99)-(X[n.state]??99);case`instance`:return Z(t.instanceLabel??t.instanceName??``,n.instanceLabel??n.instanceName??``);case`host`:return Z(t.gatewayHost,n.gatewayHost);case`version`:{let e=t.gatewayVersion,r=n.gatewayVersion;return Xt(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)=>Xt(e,t)??Z(e,t))}var Q=n();function yn({connections:e,displayByInstance:t}){let[n,r]=(0,K.useState)(un),[i,a]=(0,K.useState)(null),o=(0,K.useMemo)(()=>e.map((e,n)=>({_id:`${e.key}:${e.canonical}/${e.agentId}:${n}`,targetLabel:`${e.canonical}/${e.agentId}`,state:e.state,instanceName:e.instanceName??null,instanceLabel:e.instanceName?t.get(e.instanceName)??e.instanceName:null,gatewayHost:e.gatewayHost,gatewayVersion:e.gatewayVersion??null,okCount:e.okCount,errorCount:e.errorCount+(e.downstreamRejectCount??0)+(e.localRefusalCount??0),attempts:e.attempts,lastOkAt:e.lastOkAt??null,lastErrorCode:e.lastErrorCode??null,lastErrorAt:e.lastErrorAt??null,lastDownstreamRejectCode:e.lastDownstreamRejectCode??null,lastDownstreamRejectAt:e.lastDownstreamRejectAt??null,lastLocalRefusalCode:e.lastLocalRefusalCode??null,lastLocalRefusalAt:e.lastLocalRefusalAt??null})),[e,t]),c=(0,K.useMemo)(()=>gn(o),[o]),l=(0,K.useMemo)(()=>_n(o),[o]),u=(0,K.useMemo)(()=>vn(o),[o]),d=(0,K.useMemo)(()=>hn(fn(o,n),i),[o,n,i]);function f(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:xe()}):(0,Q.jsxs)(`div`,{className:`oc-conn`,children:[(0,Q.jsxs)(Wt,{q:n.q,onQChange:e=>r(t=>({...t,q:e})),searchPlaceholder:x(),onReset:()=>r(un),canReset:dn(n),children:[(0,Q.jsxs)(F,{value:n.state,onValueChange:e=>r(t=>({...t,state:e})),children:[(0,Q.jsx)(O,{size:`sm`,className:`w-36`,children:(0,Q.jsx)(R,{placeholder:ee()})}),(0,Q.jsxs)(I,{children:[(0,Q.jsx)(N,{value:Y,children:T()}),c.map(e=>(0,Q.jsx)(N,{value:e,children:xn(e)},e))]})]}),(0,Q.jsxs)(F,{value:n.instance,onValueChange:e=>r(t=>({...t,instance:e})),children:[(0,Q.jsx)(O,{size:`sm`,className:`w-40`,children:(0,Q.jsx)(R,{placeholder:g()})}),(0,Q.jsxs)(I,{children:[(0,Q.jsx)(N,{value:Y,children:T()}),l.map(e=>(0,Q.jsx)(N,{value:e.name,children:e.label},e.name))]})]}),(0,Q.jsxs)(F,{value:n.version,onValueChange:e=>r(t=>({...t,version:e})),children:[(0,Q.jsx)(O,{size:`sm`,className:`w-36`,children:(0,Q.jsx)(R,{placeholder:_e()})}),(0,Q.jsxs)(I,{children:[(0,Q.jsx)(N,{value:Y,children:T()}),u.map(e=>(0,Q.jsx)(N,{value:e,children:e},e))]})]})]}),d.length===0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:he()}):(0,Q.jsxs)(Ut,{className:`oc-conn__table`,children:[(0,Q.jsx)(Vt,{children:(0,Q.jsxs)(U,{children:[(0,Q.jsx)($,{label:v(),sortKey:`target`,sort:i,onSort:f}),(0,Q.jsx)($,{label:ge(),sortKey:`state`,sort:i,onSort:f}),(0,Q.jsx)($,{label:s(),sortKey:`instance`,sort:i,onSort:f}),(0,Q.jsx)($,{label:pt(),sortKey:`host`,sort:i,onSort:f}),(0,Q.jsx)($,{label:de(),sortKey:`version`,sort:i,onSort:f}),(0,Q.jsx)(H,{children:ne()}),(0,Q.jsx)($,{label:y(),sortKey:`lastOk`,sort:i,onSort:f})]})}),(0,Q.jsx)(Ht,{children:d.map(e=>(0,Q.jsx)(bn,{r:e},e._id))})]})]})}function $({label:e,sortKey:t,sort:n,onSort:r}){let i=n?.key===t,a=i?n.dir:null;return(0,Q.jsx)(H,{"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)(Rt,{size:13,"aria-hidden":!0}):(0,Q.jsx)(M,{size:13,"aria-hidden":!0}):(0,Q.jsx)(mt,{size:13,"aria-hidden":!0,className:`oc-conn__sort-idle`})]})})}function bn({r:e}){let t=rn(e)?G(e.lastErrorCode):null,n=an(e)?G(e.lastDownstreamRejectCode):null,r=on(e)?G(e.lastLocalRefusalCode):null;return(0,Q.jsxs)(K.Fragment,{children:[(0,Q.jsxs)(U,{className:`oc-conn__row oc-conn__row--${e.state}`,children:[(0,Q.jsx)(W,{children:(0,Q.jsx)(`code`,{className:`oc-traces__mono`,children:e.targetLabel})}),(0,Q.jsx)(W,{children:(0,Q.jsx)(Sn,{state:e.state})}),(0,Q.jsx)(W,{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)(W,{children:(0,Q.jsx)(`span`,{className:`oc-bridge-target__host`,children:e.gatewayHost})}),(0,Q.jsx)(W,{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)(W,{children:(0,Q.jsx)(`span`,{className:`oc-conn__stats`,children:ye({ok:e.okCount,errors:e.errorCount,attempts:e.attempts})})}),(0,Q.jsx)(W,{children:e.lastOkAt?(0,Q.jsx)(`span`,{className:`oc-traces__mono`,children:B(e.lastOkAt)}):(0,Q.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})})]}),sn(e)?(0,Q.jsx)(U,{className:`oc-conn__detail-row`,children:(0,Q.jsxs)(W,{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?` · ${B(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:[Re({label:r.label}),` `,(0,Q.jsx)(`code`,{className:`oc-traces__mono`,children:e.lastLocalRefusalCode}),e.lastLocalRefusalAt?` · ${B(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:[be({label:n.label}),` `,(0,Q.jsx)(`code`,{className:`oc-traces__mono`,children:e.lastDownstreamRejectCode}),e.lastDownstreamRejectAt?` · ${B(e.lastDownstreamRejectAt)}`:``]}):null]})}):null]})}function xn(e){return e===`connected`?m():e===`error`?ce():ie()}function Sn({state:e}){return e===`connected`?(0,Q.jsx)(A,{variant:`secondary`,children:m()}):e===`error`?(0,Q.jsx)(A,{variant:`destructive`,children:ce()}):(0,Q.jsx)(A,{variant:`outline`,children:ie()})}function Cn(){return C(E.bridgeHealth.getBridgeHealth,{})}function wn(){let e=Cn(),t=C(E.compat.getBridgeCompat,{}),n=C(E.me.getMe,{host:Pt})?.role===`admin`,r=C(E.admin.listInstances,n?{}:`skip`),i=C(E.agents.usageForInstances,n?{}:`skip`),a=j(),o=()=>void a({to:`/settings/anomalies`,search:{status:`open`}}),s=ln(e?e.targets:[],t?t.targets:[],r??[]),{section:c}=Ot({from:`/settings/bridge`}),l=j({from:`/settings/bridge`}),u=t?.compat??null,d=t===void 0?`loading`:t===null?`nodata`:`ready`,f=u!==null&&Yt(u,`hermes`)&&!s.some(e=>e.key===`hermes`);return(0,Q.jsxs)(`div`,{className:`oc-bridge`,children:[(0,Q.jsx)(Tn,{health:e,compat:t,onSeeAnomalies:o}),(0,Q.jsx)(`p`,{className:`oc-admin__hint oc-bridge__caption`,children:Ce()}),i&&i.length>0?(0,Q.jsxs)(`section`,{className:`oc-bridge__usage`,children:[(0,Q.jsx)(`h3`,{className:`oc-bridge__usage-title`,children:Pe()}),(0,Q.jsxs)(Ut,{children:[(0,Q.jsx)(Vt,{children:(0,Q.jsxs)(U,{children:[(0,Q.jsx)(H,{children:S()}),(0,Q.jsx)(H,{children:Qe()}),(0,Q.jsx)(H,{children:te()}),(0,Q.jsx)(H,{children:_()}),(0,Q.jsx)(H,{children:ve()})]})}),(0,Q.jsx)(Ht,{children:i.flatMap(e=>{let t=Dt(e.usage,Date.now());return t?t.windows.map((t,n)=>(0,Q.jsxs)(U,{children:[(0,Q.jsx)(W,{className:`font-medium`,children:n===0?e.instanceName:``}),(0,Q.jsx)(W,{children:t.provider}),(0,Q.jsx)(W,{children:t.label}),(0,Q.jsx)(W,{children:(0,Q.jsxs)(A,{variant:t.percentLeft<=10?`destructive`:t.percentLeft<=25?`outline`:`secondary`,children:[t.percentLeft,`%`]})}),(0,Q.jsx)(W,{className:`text-muted-foreground`,children:t.resetText??`—`})]},`${e.instanceName}:${t.provider}:${t.label}`)):[]})})]})]}):null,s.length>0?(0,Q.jsxs)(St,{value:s.some(e=>e.key===c)?c:s[0]?.key??`openclaw`,onValueChange:e=>void l({search:{section:e},replace:!0}),children:[(0,Q.jsx)(xt,{className:`w-full`,children:s.map(e=>(0,Q.jsxs)(yt,{value:e.key,className:`flex-1 gap-1.5`,children:[(0,Q.jsx)(Nt,{size:13,"aria-hidden":!0}),J(e.key)]},e.key))}),s.map(e=>(0,Q.jsx)(bt,{value:e.key,children:(0,Q.jsx)(En,{providerKey:e.key,connections:e.connections,instances:e.instances,manifest:u,compatStatus:d,compatReachable:t?.reachable??!0,protocol:e.key===`openclaw`?t?.protocol??null:null})},e.key))]}):null,f?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:dt()}):null]})}function Tn({health:e,compat:t,onSeeAnomalies:n}){let i=t!=null&&t.buildVersion!=null&&t.bridgeVersion!=null&&t.buildVersion!==t.bridgeVersion,a=t?.buildRevision&&t.buildRevision!==`unknown`?t.buildRevision.slice(0,7):null,o=t&&t!==null?(0,Q.jsxs)(`span`,{className:`oc-bridge-card__ver`,children:[(0,Q.jsx)(`code`,{className:`oc-traces__mono`,children:Jt(t.bridgeVersion)}),a?(0,Q.jsxs)(Q.Fragment,{children:[` `,(0,Q.jsxs)(`code`,{className:`oc-traces__mono`,title:le(),children:[`(`,a,`)`]})]}):null,i?(0,Q.jsxs)(`strong`,{className:`oc-bridge-card__mismatch`,children:[` `,ae({build:t.buildVersion??`?`})]}):null,` · `,re(),` `,(0,Q.jsx)(`code`,{className:`oc-traces__mono`,children:t.protocolVersion===null?ze():String(t.protocolVersion)})]}):null;if(e===void 0)return(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:w()});if(e===null)return(0,Q.jsx)(`div`,{className:`oc-bridge-card oc-bridge-card--idle`,children:rt()});let s=en(e.targets),c=!e.reachable,l=nn(e),u=e.unreachableInstances??[],d=l===`ok`?`ok`:l===`gateways_unreachable`?`warn`:`error`,f=L(e.checkedAt),p=e.startedAt==null?null:L(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)(P,{size:22}):c||l===`gateways_unreachable`?(0,Q.jsx)($t,{size:22}):(0,Q.jsx)(V,{size:22})}),(0,Q.jsxs)(`div`,{className:`oc-bridge-card__body`,children:[(0,Q.jsx)(`div`,{className:`oc-bridge-card__title`,children:l===`ok`?Ye():l===`gateways_unreachable`?Ke({count:u.length}):c?Ee():Le({count:s.length})}),(0,Q.jsxs)(`div`,{className:`oc-bridge-card__meta`,children:[(0,Q.jsxs)(`span`,{children:[(0,Q.jsx)(Qt,{size:12,"aria-hidden":!0}),` `,et({time:f})]}),p?(0,Q.jsx)(`span`,{children:je({time:p})}):null,o]}),l===`gateways_unreachable`?(0,Q.jsx)(`p`,{className:`oc-bridge-card__hint`,children:it({names:u.join(`, `)})}):null,c?(0,Q.jsx)(`p`,{className:`oc-bridge-card__hint`,children:G(e.lastError===`not_configured`?`NOT_CONFIGURED`:`BRIDGE_UNREACHABLE`).hint}):null]}),(0,Q.jsx)(`button`,{type:`button`,className:`oc-bridgebar__drill`,onClick:n,children:r()})]})}function En({providerKey:e,connections:t,instances:n,manifest:r,compatStatus:i,compatReachable:a,protocol:o}){let s=r?Gt(r,e):null,c=new Map;for(let e of n)c.set(e.name,e.displayName??e.name);let l=[],u=new Set;for(let n of t){if(!n.instanceName||u.has(n.instanceName))continue;u.add(n.instanceName);let t=n.gatewayVersion??null;l.push({instanceName:n.instanceName,displayName:c.get(n.instanceName)??n.instanceName,version:t,state:qt(t,e,r)})}let d=Zt(l.map(e=>e.state)),[f,p]=(0,K.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)(Nt,{size:15,"aria-hidden":!0,className:`oc-bridge-provider__icon`}),(0,Q.jsx)(`span`,{className:`oc-bridge-provider__name`,children:J(e)}),d?(0,Q.jsx)(A,{variant:d===`beyond`||d===`defective`?`destructive`:`secondary`,children:Kt(d)}):null]}),(0,Q.jsx)(`h4`,{className:`oc-bridge-provider__sub`,children:b()}),(0,Q.jsx)(On,{providerName:J(e),support:s,compatStatus:i,compatReachable:a,manifest:r,instanceRows:l}),o?(0,Q.jsx)(Dn,{protocol:o}):null,(0,Q.jsxs)(`button`,{type:`button`,className:`oc-bridge-provider__sub oc-bridge-provider__sub--toggle`,"aria-expanded":f,onClick:()=>p(e=>!e),children:[f?(0,Q.jsx)(M,{size:13,"aria-hidden":!0}):(0,Q.jsx)(k,{size:13,"aria-hidden":!0}),ue({count:t.length})]}),f?(0,Q.jsx)(yn,{connections:t,displayByInstance:c}):null]})}function Dn({protocol:e}){let[t,n]=(0,K.useState)(!1),r=e.coverage,i=e.drift??[],a=(e.driftOverflow??0)+(e.driftTruncated??0);return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`h4`,{className:`oc-bridge-provider__sub`,children:[Fe(),i.length>0?(0,Q.jsx)(A,{variant:`destructive`,children:Ze({count:i.length})}):a>0?(0,Q.jsx)(A,{variant:`destructive`,children:Ne()}):(0,Q.jsx)(A,{variant:`secondary`,children:Ge()})]}),(0,Q.jsxs)(`p`,{className:`oc-admin__hint`,children:[ke({version:e.vendoredVersion}),r?` · `+ot({handled:r.handled,ignored:r.ignored,gaps:r.gaps}):null]}),a>0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:Je({overflow:e.driftOverflow??0,truncated:e.driftTruncated??0})}):null,i.length>0?(0,Q.jsx)(`ul`,{className:`oc-bridge-protocol__list`,role:`list`,children:i.map(e=>(0,Q.jsxs)(`li`,{children:[(0,Q.jsx)(`code`,{className:`oc-traces__mono`,children:e.shape}),` × `,e.count]},e.shape))}):null,r&&r.gapList.length>0?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`button`,{type:`button`,className:`oc-bridge-provider__sub oc-bridge-provider__sub--toggle`,"aria-expanded":t,onClick:()=>n(e=>!e),children:[t?(0,Q.jsx)(M,{size:13,"aria-hidden":!0}):(0,Q.jsx)(k,{size:13,"aria-hidden":!0}),We({count:r.gapList.length})]}),t?(0,Q.jsx)(`ul`,{className:`oc-bridge-protocol__list`,role:`list`,children:r.gapList.map(e=>(0,Q.jsx)(`li`,{children:(0,Q.jsx)(`code`,{className:`oc-traces__mono`,children:e})},e))}):null]}):null]})}function On({support:e,compatStatus:t,compatReachable:n,manifest:r,instanceRows:i,providerName:o}){return t===`loading`?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:w()}):t===`nodata`?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:h()}):(0,Q.jsxs)(`div`,{className:`oc-compat`,children:[n?null:(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:a()}),r===null?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:Ve()}):(0,Q.jsxs)(`div`,{className:`oc-compat__support`,children:[(0,Q.jsx)(`span`,{className:`oc-compat__label`,children:Se({provider:o})}),e&&e.range!==null?(0,Q.jsx)(`span`,{children:oe({min:e.range.min,max:e.range.maxValidated})}):(0,Q.jsx)(`span`,{children:ze()}),e?(0,Q.jsx)(Mn,{versions:e.validatedVersions}):null]}),i.length===0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:ct()}):(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:Jt(e.version)}),(0,Q.jsx)(A,{variant:e.state===`supported`?`secondary`:e.state===`beyond`||e.state===`defective`?`destructive`:`outline`,children:Kt(e.state)})]},e.instanceName))})]})}function kn({instance:e,onClose:t}){return(0,Q.jsx)(It,{open:!0,onOpenChange:e=>!e&&t(),children:(0,Q.jsxs)(jt,{className:`oc-bridge-config-dialog`,onOpenAutoFocus:e=>e.preventDefault(),children:[(0,Q.jsxs)(At,{children:[(0,Q.jsx)(Mt,{children:Xe({instance:e.displayName??e.name})}),(0,Q.jsx)(Ft,{children:Me()})]}),(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)(P,{"aria-hidden":!0}):(0,Q.jsx)(V,{"aria-hidden":!0}),(0,Q.jsxs)(`span`,{children:[e,` — `,t.ok?ut():t.detail]})]}):(0,Q.jsxs)(`p`,{className:`oc-bridge-config__check-row oc-bridge-config__check-row--skip`,children:[e,` — `,De()]}):null}function jn({instance:e,onClose:t}){let n=nt(E.admin.upsertInstanceConfig),r=Te(E.bridge.validateMediaPaths),a=Et(),s=Bt(e.config?.contentLocale,void 0),[l,u]=(0,K.useState)(()=>ht(e.config??{},s)),[f,m]=(0,K.useState)(!1),[h,g]=(0,K.useState)(!1),[_,v]=(0,K.useState)(null),y=l.inboundMediaMode===`shared-fs`,b=l.mediaMode===`shared-fs`,x=y||b;async function S(){g(!0),v(null);try{v(await r({instanceName:e.name,inboundMediaMode:l.inboundMediaMode,mediaMode:l.mediaMode}))}catch(e){a.error(me(),e)}finally{g(!1)}}async function ee(){m(!0);try{let r=e.config??{};await n({instanceId:e._id,config:_t(l,r,s)}),t()}catch(e){a.error(we(),e)}finally{m(!1)}}return(0,Q.jsx)(`div`,{className:`oc-bridge-config`,children:(0,Q.jsxs)(`div`,{className:`oc-bridge-config__form`,children:[(0,Q.jsxs)(`div`,{className:`oc-bridge-config__grid`,children:[(0,Q.jsxs)(`label`,{className:`oc-field`,children:[(0,Q.jsx)(D,{label:at(),help:Ie()}),(0,Q.jsxs)(F,{value:l.mediaMode,onValueChange:e=>u({...l,mediaMode:e}),children:[(0,Q.jsx)(O,{size:`sm`,className:`w-full`,children:(0,Q.jsx)(R,{})}),(0,Q.jsx)(I,{children:vt.map(e=>(0,Q.jsx)(N,{value:e,children:e},e))})]})]}),(0,Q.jsxs)(`label`,{className:`oc-field`,children:[(0,Q.jsx)(D,{label:Ue(),help:$e()}),(0,Q.jsxs)(F,{value:l.inboundMediaMode,onValueChange:e=>u({...l,inboundMediaMode:e}),children:[(0,Q.jsx)(O,{size:`sm`,className:`w-full`,children:(0,Q.jsx)(R,{})}),(0,Q.jsx)(I,{children:gt.map(e=>(0,Q.jsx)(N,{value:e,children:e},e))})]})]}),(0,Q.jsxs)(`label`,{className:`oc-field`,children:[(0,Q.jsx)(D,{label:Oe(),help:Ae()}),(0,Q.jsx)(z,{type:`number`,min:1,max:4096,className:`w-full`,value:l.mediaMaxMb,onChange:e=>u({...l,mediaMaxMb:Math.trunc(Number(e.target.value)||0)})})]})]}),x&&(0,Q.jsxs)(`div`,{className:`oc-bridge-config__grid`,children:[y&&(0,Q.jsxs)(`label`,{className:`oc-field`,children:[(0,Q.jsx)(D,{label:Be(),help:o()}),(0,Q.jsx)(z,{className:`w-full`,spellCheck:!1,value:l.inboundAgentMount,onChange:e=>u({...l,inboundAgentMount:e.target.value})})]}),b&&(0,Q.jsxs)(`label`,{className:`oc-field`,children:[(0,Q.jsx)(D,{label:He(),help:se()}),(0,Q.jsx)(z,{className:`w-full`,spellCheck:!1,value:l.outboundAgentMount,onChange:e=>u({...l,outboundAgentMount:e.target.value})})]})]}),(0,Q.jsxs)(`label`,{className:`oc-field--row`,children:[(0,Q.jsx)(Lt,{checked:l.rehydration,onCheckedChange:e=>u({...l,rehydration:e===!0})}),(0,Q.jsx)(D,{label:tt(),help:i()})]}),x&&_!==null&&(0,Q.jsx)(`div`,{className:`oc-bridge-config__check`,children:_.reachable?!_.inbound&&!_.outbound?(0,Q.jsxs)(`p`,{className:`oc-bridge-config__check-row oc-bridge-config__check-row--err`,children:[(0,Q.jsx)(V,{"aria-hidden":!0}),st({reason:_.reason??`?`})]}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(An,{label:c(),result:_.inbound}),(0,Q.jsx)(An,{label:fe(),result:_.outbound}),(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:lt()})]}):(0,Q.jsxs)(`p`,{className:`oc-bridge-config__check-row oc-bridge-config__check-row--err`,children:[(0,Q.jsx)(V,{"aria-hidden":!0}),ft()]})}),(0,Q.jsxs)(`div`,{className:`oc-bridge-config__actions`,children:[x&&(0,Q.jsxs)(Ct,{variant:`outline`,size:`sm`,onClick:()=>void S(),disabled:h,children:[h?(0,Q.jsx)(Tt,{className:`size-4 animate-spin`,"aria-hidden":!0}):null,h?p():d()]}),(0,Q.jsx)(Ct,{size:`sm`,onClick:()=>void ee(),disabled:f,children:qe()})]})]})})}function Mn({versions:e}){if(e.length===0)return null;let t=[...e].reverse();return(0,Q.jsxs)(kt,{children:[(0,Q.jsx)(wt,{asChild:!0,children:(0,Q.jsxs)(`button`,{type:`button`,className:`oc-compat__versions-btn`,children:[e.length===1?u():f({count:e.length}),(0,Q.jsx)(M,{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:pe()}),(0,Q.jsx)(`div`,{className:`oc-compat__versions-list`,children:t.map(e=>(0,Q.jsx)(A,{variant:`secondary`,children:e},e))})]})]})}export{wn as BridgeTab,kn as InstanceConfigDialog};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$B as r,Bd as i,Gd as a,Hd as o,Ld as s,Rd as c,Ud as l,Vd as u,Wd as d,Xi as f,aV as p,ac as m,cV as h,cc as g,cp as _,dS as v,dc as y,fc as b,ic as x,lc as S,np as C,oc as w,op as T,pc as E,sV as D,sc as O,t as k,tp as A,uc as j,xf as M,zd as N}from"./api-B1lq0pb-.js";import{t as P}from"./button-Ds98Pj53.js";import{$ as F,B as I,M as L,N as R,Q as z,X as B,Z as V,et as H,jt as U,un as W,ut as G}from"./index-DMM3fags.js";import{a as K}from"./compatView-Dxc5HuRO.js";/* empty css */var q=t(e(),1),J=[`off`,`minimal`,`low`,`medium`,`high`,`xhigh`];function Y(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 X=n();function Z({instance:e}){let t=D(k.admin.upsertInstanceConfig),n=h(k.agents.listAgentsForInstance,{instanceName:e.name}),r=typeof e.config?.converterAgentId==`string`?e.config.converterAgentId:``,[i,a]=(0,q.useState)(r),[o,l]=(0,q.useState)(`idle`);(0,q.useEffect)(()=>{a(r),l(`idle`)},[e._id,r]);let u=`__none__`,d=i!==r;async function f(){l(`saving`);try{let n={...e.config??{}};i===``||i===u?delete n.converterAgentId:n.converterAgentId=i,await t({instanceId:e._id,config:n}),l(`done`)}catch{l(`error`)}}let p=n?.agents??[];return(0,X.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,X.jsx)(`span`,{className:`oc-cdefaults__label`,children:j()}),(0,X.jsx)(`p`,{className:`oc-admin__hint`,children:S()}),(0,X.jsxs)(`div`,{className:`oc-cdefaults__inline`,children:[(0,X.jsxs)(B,{value:i===``?u:i,onValueChange:e=>a(e===u?``:e),children:[(0,X.jsx)(F,{className:`oc-cdefaults__select`,"aria-label":j(),children:(0,X.jsx)(H,{placeholder:g()})}),(0,X.jsxs)(V,{children:[(0,X.jsx)(z,{value:u,children:g()}),p.map(e=>(0,X.jsx)(z,{value:e.agentId,children:e.displayName?`${e.displayName} (${e.agentId})`:e.agentId},e.agentId))]})]}),(0,X.jsx)(P,{size:`sm`,disabled:!d||o===`saving`,onClick:()=>void f(),children:o===`saving`?_():N()})]}),o===`done`?(0,X.jsx)(`p`,{className:`oc-admin__hint`,role:`status`,children:c()}):null,o===`error`?(0,X.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:s()}):null]})}function Q({instance:e}){let t=D(k.admin.upsertInstanceConfig),n=e.config?.curationEnabled===!0,r=typeof e.config?.curationBudgetChars==`number`?e.config.curationBudgetChars:null,[i,a]=(0,q.useState)(n),[o,l]=(0,q.useState)(r===null?``:String(r)),[u,d]=(0,q.useState)(`idle`);(0,q.useEffect)(()=>{a(n),l(r===null?``:String(r)),d(`idle`)},[e._id,n,r]);let f=o.trim(),p=f===``?null:/^\d+$/.test(f)?Number.parseInt(f,10):NaN,h=!i||p===null||Number.isInteger(p)&&p>=4e3&&p<=6e4,g=i!==n||(p??null)!==r;async function v(){d(`saving`);try{let n={...e.config??{}};n.curationEnabled=i,!i||p===null||Number.isNaN(p)?delete n.curationBudgetChars:n.curationBudgetChars=p,await t({instanceId:e._id,config:n}),d(`done`)}catch{d(`error`)}}return(0,X.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,X.jsxs)(`label`,{className:`oc-cdefaults__inline`,style:{cursor:`pointer`},children:[(0,X.jsx)(G,{checked:i,onCheckedChange:e=>a(e===!0),"aria-label":y()}),(0,X.jsx)(`span`,{className:`oc-cdefaults__label`,children:y()})]}),(0,X.jsxs)(`div`,{className:`oc-cdefaults__inline`,children:[(0,X.jsx)(U,{type:`number`,min:4e3,max:6e4,step:1e3,placeholder:`20000`,value:o,onChange:e=>l(e.target.value),className:`oc-cdefaults__number`,"aria-invalid":!h,"aria-label":O(),disabled:!i}),(0,X.jsx)(P,{size:`sm`,disabled:!g||!h||u===`saving`,onClick:()=>void v(),children:u===`saving`?_():N()})]}),h?null:(0,X.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:w()}),u===`done`?(0,X.jsx)(`p`,{className:`oc-admin__hint`,role:`status`,children:c()}):null,u===`error`?(0,X.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:s()}):null,(0,X.jsx)(`p`,{className:`oc-cdefaults__help`,children:m()})]})}function $({instance:e}){let t=D(k.admin.upsertInstanceConfig),n=typeof e.config?.summarizeThresholdChars==`number`?e.config.summarizeThresholdChars:null,[r,i]=(0,q.useState)(n===null?``:String(n)),[a,o]=(0,q.useState)(`idle`);(0,q.useEffect)(()=>{i(n===null?``:String(n)),o(`idle`)},[e._id,n]);let l=r.trim(),u=l===``?null:/^\d+$/.test(l)?Number.parseInt(l,10):NaN,d=u===null||Number.isInteger(u)&&u>=1e3&&u<=2e5,f=(u??null)!==n;async function p(){o(`saving`);try{let n={...e.config??{}};u===null?delete n.summarizeThresholdChars:n.summarizeThresholdChars=u,await t({instanceId:e._id,config:n}),o(`done`)}catch{o(`error`)}}return(0,X.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,X.jsx)(`span`,{className:`oc-cdefaults__label`,children:E()}),(0,X.jsxs)(`div`,{className:`oc-cdefaults__inline`,children:[(0,X.jsx)(U,{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,X.jsx)(P,{size:`sm`,disabled:!f||!d||a===`saving`,onClick:()=>void p(),children:a===`saving`?_():N()})]}),d?null:(0,X.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:x()}),a===`done`?(0,X.jsx)(`p`,{className:`oc-admin__hint`,role:`status`,children:c()}):null,a===`error`?(0,X.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:s()}):null,(0,X.jsx)(`p`,{className:`oc-cdefaults__help`,children:b()})]})}function ee(){let e=p(k.agentFiles.getChatDefaults),[t,n]=(0,q.useState)({status:`loading`}),s=h(k.admin.listInstances,{}),[c,m]=(0,q.useState)(null);(0,q.useEffect)(()=>{!s||s.length===0||(!c||!s.some(e=>e.name===c))&&m(s[0].name)},[s,c]);let g=(s?.length??0)>1,_=s!==void 0&&s.length===0,y=h(k.compat.forInstance,c?{instanceName:c}:`skip`),b=c?I(y,`configDefaults`):`loading`,x=b===`loading`?null:b.blocked,S=(0,q.useMemo)(()=>g&&c?{instanceName:c}:{},[g,c]),w=(0,q.useRef)(0),E=(0,q.useCallback)(async()=>{let t=++w.current;n({status:`loading`});try{let r=Y(await e(S));if(w.current!==t)return;n({status:`done`,current:r})}catch{if(w.current!==t)return;n({status:`error`})}},[e,S]);(0,q.useEffect)(()=>{x===!1&&(g&&!c||E())},[E,x,g,c]);let D=t.status===`done`?t.current:null,O=(0,q.useMemo)(()=>J.map(e=>({id:e,label:R(e)})),[]),j=(0,q.useMemo)(()=>[{id:`fast`,label:C()},{id:`standard`,label:A()}],[]);return(0,X.jsxs)(`div`,{className:`oc-cdefaults`,children:[(0,X.jsx)(`p`,{className:`oc-admin__hint`,children:a()}),g&&c?(0,X.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,X.jsx)(`span`,{className:`oc-cdefaults__label`,children:M()}),(0,X.jsxs)(B,{value:c,onValueChange:e=>m(e),children:[(0,X.jsx)(F,{size:`sm`,"aria-label":M(),children:(0,X.jsx)(H,{})}),(0,X.jsx)(V,{children:(s??[]).map(e=>(0,X.jsx)(z,{value:e.name,children:e.name},e.name))})]})]}):null,_?(0,X.jsx)(`p`,{className:`oc-admin__hint`,role:`status`,children:v()}):b===`loading`?(0,X.jsx)(`p`,{className:`oc-admin__hint`,children:r()}):b.blocked?(0,X.jsxs)(`p`,{className:`oc-compat__blocked`,role:`status`,children:[(0,X.jsx)(W,{size:14,"aria-hidden":!0}),` `,K(b.gatewayVersion,b.provider)]}):t.status===`loading`?(0,X.jsx)(`p`,{className:`oc-admin__hint`,children:r()}):t.status===`error`?(0,X.jsxs)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:[i(),` `,(0,X.jsx)(P,{variant:`outline`,size:`sm`,onClick:()=>void E(),children:T()})]}):(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,X.jsx)(`span`,{className:`oc-cdefaults__label`,children:d()}),(0,X.jsx)(L,{field:`thinkingLevel`,options:O,value:D?.thinkingDefault??null,onChange:()=>{},disabled:!0,ariaLabel:d()}),(0,X.jsx)(`p`,{className:`oc-cdefaults__help`,children:l()})]}),(0,X.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,X.jsx)(`span`,{className:`oc-cdefaults__label`,children:o()}),(0,X.jsx)(L,{field:`fastMode`,options:j,value:D===null||D.fastModeDefault===null?null:D.fastModeDefault?`fast`:`standard`,onChange:()=>{},disabled:!0,ariaLabel:o()}),(0,X.jsx)(`p`,{className:`oc-cdefaults__help`,children:u()})]}),(0,X.jsx)(`p`,{className:`oc-cdefaults__note`,children:f()})]}),(()=>{let e=s?.find(e=>e.name===(c??s[0]?.name));return e?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)($,{instance:e}),(0,X.jsx)(Q,{instance:e}),(0,X.jsx)(Z,{instance:e})]}):null})()]})}export{ee as ChatDefaultsTab};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{_g as r,bg as i,gg as a,hg as o,vg as s,xg as c,yg as l}from"./api-
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{_g as r,bg as i,gg as a,hg as o,vg as s,xg as c,yg as l}from"./api-B1lq0pb-.js";import{t as u}from"./chevrons-up-down-Du-SfIms.js";import{t as d}from"./button-Ds98Pj53.js";import{Hn as f,It as p,Lt as m,Mt as h,Nt as g,Pn as _,Pt as v,dn as y,gn as b,ut as x,zn as S}from"./index-DMM3fags.js";import{a as C,i as w,n as T,o as E,r as D,t as O}from"./table-B15ESmxP.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=i(),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)(d,{size:`sm`,variant:e.variant===`destructive`?`destructive`:`outline`,onClick:()=>{e.onSelect([...z]),B(new Set)},children:[e.variant===`destructive`?(0,M.jsx)(y,{}):null,e.label,` (`,z.size,`)`]},e.label)):null,N?(0,M.jsxs)(d,{size:`sm`,onClick:N,children:[(0,M.jsx)(b,{}),` `,P]}):null]})]}),t===void 0?(0,M.jsx)(`p`,{className:`oc-admin__hint`,children:l()}):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)(x,{"aria-label":s(),checked:J?!0:Y?`indeterminate`:!1,onCheckedChange:X})}):null,n.map((e,t)=>{let n=V?.index===t;return e.sort?(0,M.jsx)(w,{className:e.className,"aria-sort":n?V.dir===`asc`?`ascending`:`descending`:`none`,children:(0,M.jsxs)(`button`,{type:`button`,className:`oc-dt__sort`,onClick:()=>K(t),"aria-label":o({column:e.header}),children:[e.header,n?V.dir===`asc`?(0,M.jsx)(S,{className:`oc-dt__sort-icon`,"aria-hidden":!0}):(0,M.jsx)(f,{className:`oc-dt__sort-icon`,"aria-hidden":!0}):(0,M.jsx)(u,{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)??[],i=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)(x,{"aria-label":r(),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)(h,{children:[(0,M.jsx)(m,{asChild:!0,children:(0,M.jsx)(d,{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)(_,{})})}),(0,M.jsx)(g,{align:`end`,children:t.map((t,n)=>(0,M.jsxs)(`div`,{children:[t.variant===`destructive`&&n>0?(0,M.jsx)(p,{}):null,(0,M.jsx)(v,{variant:t.variant,onSelect:()=>t.onSelect(e),children:t.label})]},t.label))})]}):null}):null]}),i&&R?(0,M.jsx)(E,{className:`oc-dt__expansion`,children:(0,M.jsx)(D,{colSpan:q,className:`oc-dt__expansion-cell`,children:R(e)})}):null]},e._id)})})]})]})}export{N as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./bundle-mjs-C73ZY4La.js";import{Et as t}from"./index-
|
|
1
|
+
import{r as e}from"./bundle-mjs-C73ZY4La.js";import{Et as t}from"./index-DMM3fags.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{$O as r,Ak as i,BO as a,Ck as o,Dk as s,Ek as c,FO as l,GO as u,HO as d,IO as f,JO as p,KO as m,LO as ee,MO as te,Mk as h,NO as g,Nk as _,Ok as v,PO as ne,Pk as re,QO as ie,RO as ae,Sk as y,Tk as b,UO as x,VO as S,WO as C,XO as w,YO as T,ZO as E,_k as D,_s as O,ak as k,bk as A,cV as j,ck as M,dk as N,ek as P,fk as F,gk as I,hk as L,ik as R,jk as z,kk as B,lk as V,mk as H,nk as oe,ok as U,pk as W,qO as G,rk as K,sV as q,sk as se,t as J,tk as ce,uk as le,vk as ue,wk as de,xk as fe,yk as pe,ys as me,zO as he}from"./api-B1lq0pb-.js";import{t as ge}from"./button-Ds98Pj53.js";import{U as _e,ct as Y}from"./index-DMM3fags.js";import{t as ve}from"./DataTableShell-CDmo0isC.js";var X=t(e(),1),Z=n(),ye={altered_words:()=>re(),incorrect:()=>_(),incoherence:()=>h(),formatting:()=>z(),latency:()=>i(),api_error:()=>B(),other:()=>v()},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:c()}):e===!1?(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-warn`,children:b()}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill`,children:`—`}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill`,children:s()})}function be({data:e,reference:t,closeReason:n}){let r=e.snapshot,i=q(J.feedback.respondToFeedback),[a,s]=(0,X.useState)(e.thread),[c,l]=(0,X.useState)(``),[u,d]=(0,X.useState)(!1);async function f(){let t=c.trim();if(!(!t||u)){d(!0);try{await i({feedbackId:e._id,text:t}),s(e=>[...e,{authorRole:`admin`,text:t,at:Date.now()}]),l(``)}finally{d(!1)}}}let p=[];try{p=r.contextJson?JSON.parse(r.contextJson):[]}catch{p=[]}return(0,Z.jsxs)(`div`,{className:`oc-fbadmin__detail`,children:[(0,Z.jsxs)(`div`,{className:`oc-fbadmin__row`,children:[(0,Z.jsx)($,{matches:r.displayedMatchesStored,sourceWasOpen:r.clientInfo?.sourceWasOpen??!1}),(0,Z.jsxs)(`span`,{className:`oc-fbadmin__meta`,children:[Q(e.category),` · `,r.messageRole,r.isRegeneration?` · ${de()}`:``,r.openclawModel?` · ${r.openclawModel}`:``,r.openclawRuntime?` (${r.openclawRuntime})`:``]}),t?(0,Z.jsx)(`code`,{className:`oc-fbadmin__ref`,style:{userSelect:`all`,marginLeft:`auto`},title:ie(),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:ae()}),(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:y()}),a.length>0?(0,Z.jsx)(`div`,{className:`oc-fbadmin__thread`,children:a.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`?fe():e.authorRole===`agent`?e.authorLabel??me():A()}),(0,Z.jsx)(`span`,{className:`oc-notif__msg-text`,children:e.text})]},t))}):(0,Z.jsx)(`p`,{className:`oc-fbadmin__meta`,children:pe()}),(0,Z.jsx)(`textarea`,{className:`oc-feedback__textarea`,placeholder:ue(),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 f(),disabled:!c.trim()||u,children:u?D():I()})})]}),(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:L()}),(0,Z.jsx)(`pre`,{className:`oc-msg__source-pre`,children:r.messageText||H()})]}),r.clientInfo?.sourceWasOpen&&r.displayedText!==void 0?(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:r.displayedText||H()})]}):null,r.promptText?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:F()}),(0,Z.jsx)(`pre`,{className:`oc-msg__source-pre`,children:r.promptText})]}):null,p.length>0?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:N({count:r.contextCount??p.length,truncated:r.contextTruncated?le():``})}),(0,Z.jsx)(`div`,{className:`oc-fbadmin__ctx`,children:p.map((e,t)=>(0,Z.jsxs)(`div`,{className:`oc-fbadmin__ctx-turn`,children:[(0,Z.jsx)(`span`,{className:`oc-fbadmin__ctx-role`,children:e.role}),(0,Z.jsx)(`span`,{className:`oc-fbadmin__ctx-text`,children:e.text})]},t))})]}):null,r.outboxAvailable?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:V()}),(0,Z.jsxs)(`pre`,{className:`oc-msg__source-pre`,children:[r.outboxText??``,r.outboxStatus?`\n[status: ${r.outboxStatus}]`:``]})]}):null,r.clientInfo?.extensionsDetected&&r.clientInfo.extensionsDetected.length>0?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:M()}),(0,Z.jsx)(`div`,{className:`oc-fbadmin__row`,children:r.clientInfo.extensionsDetected.map(e=>(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-warn`,children:e},e))})]}):null,(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:se()}),(0,Z.jsxs)(`p`,{className:`oc-fbadmin__env`,children:[[r.clientInfo?.language,r.clientInfo?.timezone,r.clientInfo?.theme?U({theme:r.clientInfo.theme}):null,r.runId?`run ${r.runId.slice(0,12)}…`:null].filter(Boolean).join(` · `)||`—`,r.clientInfo?.plugins&&r.clientInfo.plugins.length>0?(0,Z.jsxs)(`span`,{className:`oc-fbadmin__plugins`,children:[k(),` `,r.clientInfo.plugins.join(`, `),(0,Z.jsxs)(`span`,{className:`oc-fbadmin__note`,children:[` `,R()]})]}):null,r.clientInfo?.userAgent?(0,Z.jsx)(`span`,{className:`oc-fbadmin__ua`,children:r.clientInfo.userAgent}):null]})]})]})}function xe(){let e=j(J.feedback.listForAdmin,{}),t=q(J.feedback.readSnapshot),n=q(J.feedback.deleteFeedback),i=_e(),[o,s]=(0,X.useState)(null),[c,h]=(0,X.useState)({});async function _(e){if(o===e._id){s(null);return}if(!c[e._id]){let n=await t({feedbackId:e._id});h(t=>({...t,[e._id]:n}))}s(e._id)}async function v(e){await i({title:ne(),description:g(),confirmLabel:te(),destructive:!0})&&(await n({feedbackId:e._id}),o===e._id&&s(null))}return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`p`,{className:`oc-admin__hint`,children:[K(),` `,(0,Z.jsx)(`strong`,{children:oe()}),` `,ce()]}),(0,Z.jsx)(ve,{title:P(),rows:e,emptyHint:r(),isExpanded:e=>o===e._id&&!!c[e._id],renderExpanded:e=>c[e._id]?(0,Z.jsx)(be,{data:c[e._id],reference:e.reference,closeReason:e.userCloseReason}):null,columns:[{header:E(),cell:e=>Y(e.at),sort:e=>e.at},{header:w(),cell:e=>Q(e.category),sort:e=>Q(e.category)},{header:T(),cell:e=>e.messageRole===`user`?p():G(),sort:e=>e.messageRole},{header:m(),cell:e=>(e.reporterEmail||e.reporterName||`—`)+(e.impersonated&&e.realOperatorEmail?` ${u({operator:e.realOperatorEmail})}`:``),sort:e=>e.reporterEmail||e.reporterName||null},{header:C(),cell:e=>(0,Z.jsx)($,{matches:e.displayedMatchesStored,sourceWasOpen:e.sourceWasOpen}),sort:e=>e.displayedMatchesStored===!1?0:e.displayedMatchesStored===!0?1:2},{header:x(),cell:e=>e.hasComment?`✎`:`—`,sort:e=>+!!e.hasComment},{header:d(),cell:e=>e.userClosedAt==null?e.resolvedAt==null?e.answered?(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-ok`,children:S()}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill`,children:a()}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-ok`,title:e.resolvedBy??void 0,children:O()}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-closed`,children:he()}),sort:e=>e.userClosedAt==null?e.resolvedAt==null?+!!e.answered:2:3}],rowActions:e=>[{label:o===e._id?ee():f(),onSelect:()=>void _(e)},{label:l(),onSelect:()=>void v(e),variant:`destructive`}]})]})}export{xe as FeedbacksTab};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./bundle-mjs-C73ZY4La.js";import{D as t,
|
|
1
|
+
import{r as e}from"./bundle-mjs-C73ZY4La.js";import{D as t,hV as n}from"./api-B1lq0pb-.js";import{I as r,L as i,R as a,Xt as o,Yt as s,z as c}from"./index-DMM3fags.js";import"./locales-CPjguROj.js";import"./curation-CQksaIbm.js";var l=t(`circle-question-mark`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3`,key:`1u773s`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]]),u=[`gateway-http`,`shared-fs`,`off`],d=[`inline`,`shared-fs`],f=[`reactive`,`sse`],p=`reactive`;n.object({mediaMode:n.optional(n.union(n.literal(`gateway-http`),n.literal(`shared-fs`),n.literal(`off`))),inboundMediaMode:n.optional(n.union(n.literal(`inline`),n.literal(`shared-fs`))),rehydration:n.optional(n.boolean()),mediaMaxMb:n.optional(n.number()),attachmentFixAttested:n.optional(n.boolean()),summarizeThresholdChars:n.optional(n.number()),curationEnabled:n.optional(n.boolean()),curationBudgetChars:n.optional(n.number()),converterAgentId:n.optional(n.string()),voiceEnabled:n.optional(n.boolean()),talkEnabled:n.optional(n.boolean()),voiceEngine:n.optional(n.union(n.literal(`browser`),n.literal(`gateway`))),voiceLang:n.optional(n.string()),voiceRate:n.optional(n.number()),voiceAutoRead:n.optional(n.boolean()),contentLocale:n.optional(n.string()),inboundAgentMount:n.optional(n.string()),outboundAgentMount:n.optional(n.string()),promptInjections:n.optional(n.record(n.string(),n.object({enabled:n.optional(n.boolean()),template:n.optional(n.string())})))});var m={mediaMode:`gateway-http`,inboundMediaMode:`inline`,rehydration:!0,mediaMaxMb:1024,inboundAgentMount:`/home/node/.openclaw/media/inbound`,outboundAgentMount:`/home/node/.openclaw/media/outbound`};function h(e,t){let n={};for(let r of o){let i=e?.[r];n[r]={enabled:i?.enabled??!0,template:typeof i?.template==`string`&&i.template.length>0?i.template:s[r].defaultTemplate[t]}}return n}function g(e,t){let n={};for(let r of o){let i=s[r],a=e[r];if(!a)continue;let o={};i.togglable&&a.enabled===!1&&(o.enabled=!1);let c=a.template.trim();c.length>0&&c!==i.defaultTemplate[t]&&(o.template=c),(o.enabled!==void 0||o.template!==void 0)&&(n[r]=o)}return n}function _(e,t){return{mediaMode:e.mediaMode??m.mediaMode,inboundMediaMode:e.inboundMediaMode??m.inboundMediaMode,rehydration:e.rehydration??m.rehydration,mediaMaxMb:e.mediaMaxMb??m.mediaMaxMb,inboundAgentMount:e.inboundAgentMount??m.inboundAgentMount,outboundAgentMount:e.outboundAgentMount??m.outboundAgentMount,promptInjections:h(e.promptInjections,t)}}var v=[`attachmentFixAttested`,`summarizeThresholdChars`,`curationEnabled`,`curationBudgetChars`,`contentLocale`,`converterAgentId`];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)(a,{delayDuration:150,children:(0,b.jsxs)(r,{children:[(0,b.jsx)(c,{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)(i,{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{$B as ee,$z as te,Bz as ne,Cs as r,Gz as re,Hz as ie,Jz as ae,Kz as oe,Qz as se,Ss as ce,Uz as le,Vz as i,Wz as a,Xz as o,Yz as s,Zz as c,_B as l,aB as u,bB as ue,cB as d,cV as de,dB as fe,eB as pe,fB as me,gB as f,hB as he,iB as p,lB as m,mB as ge,nB as _e,nN as ve,oB as h,pB as ye,qz as g,rB as _,sB as v,sV as be,t as y,tB as b,tV as x,uB as S,vB as C,yB as w,zz as T}from"./api-B1lq0pb-.js";import{t as E}from"./button-Ds98Pj53.js";import{$ as D,Ct as O,Dt as k,Et as A,Fn as j,Lt as M,Mt as N,Nt as xe,Pn as Se,Pt as P,Q as F,St as Ce,Tt as we,X as I,Z as L,bt as Te,dn as Ee,et as R,hn as De,ut as Oe,vt as ke,wt as Ae,xt as je,yt as Me}from"./index-DMM3fags.js";import{a as Ne,i as z,n as Pe,o as B,r as V,t as Fe}from"./table-B15ESmxP.js";var H=t(e(),1),U=n(),W=`all`;function G(e){switch(e){case`image`:return m();case`audio`:return d();case`video`:return v();case`pdf`:return h();case`document`:return u();case`archive`:return p();default:return _()}}function K(){let[e,t]=(0,H.useState)(W),[n,u]=(0,H.useState)(W),[d,p]=(0,H.useState)(W),[m,h]=(0,H.useState)(W),[_,v]=(0,H.useState)(!1),[K,q]=(0,H.useState)(null),J=be(y.files.softDelete),Y=k();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(oe())}catch(e){Y.error(re(),e)}}let X=de(y.files.listMine,{direction:e===W?void 0:e,chatId:n===W?void 0:n,instanceName:d===W?void 0:d,category:m===W?void 0:m,includeAutoGenerated:_||void 0}),Re=(0,H.useMemo)(()=>new Intl.DateTimeFormat(x(),{dateStyle:`medium`,timeStyle:`short`}),[]);if(X===void 0)return(0,U.jsx)(`p`,{className:`oc-admin__hint`,children:ee()});let{files:Z,facets:Q,truncated:ze,cap:Be}=X,$=e!==W||n!==W||d!==W||m!==W;return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`p`,{className:`oc-admin__hint`,children:ue()}),(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)(D,{size:`sm`,"aria-label":w(),children:(0,U.jsx)(R,{})}),(0,U.jsxs)(L,{children:[(0,U.jsx)(F,{value:W,children:C()}),(0,U.jsx)(F,{value:`inbound`,children:l()}),(0,U.jsx)(F,{value:`outbound`,children:f()})]})]}),(0,U.jsxs)(I,{value:n,onValueChange:u,children:[(0,U.jsx)(D,{size:`sm`,"aria-label":he(),children:(0,U.jsx)(R,{})}),(0,U.jsxs)(L,{children:[(0,U.jsx)(F,{value:W,children:ge()}),Q.chats.map(e=>(0,U.jsx)(F,{value:e.id,children:e.title},e.id))]})]}),Q.multiProvider?(0,U.jsxs)(I,{value:d,onValueChange:p,children:[(0,U.jsx)(D,{size:`sm`,"aria-label":ye(),children:(0,U.jsx)(R,{})}),(0,U.jsxs)(L,{children:[(0,U.jsx)(F,{value:W,children:me()}),Q.instances.map(e=>(0,U.jsx)(F,{value:e,children:e},e))]})]}):null,(0,U.jsxs)(I,{value:m,onValueChange:h,children:[(0,U.jsx)(D,{size:`sm`,"aria-label":fe(),children:(0,U.jsx)(R,{})}),(0,U.jsxs)(L,{children:[(0,U.jsx)(F,{value:W,children:S()}),Q.categories.map(e=>(0,U.jsx)(F,{value:e,children:G(e)},e))]})]}),(0,U.jsxs)(`label`,{className:`oc-files__autogen`,children:[(0,U.jsx)(Oe,{checked:_,onCheckedChange:e=>v(e===!0),"aria-label":r()}),(0,U.jsx)(`span`,{children:r()})]}),$?(0,U.jsxs)(E,{variant:`ghost`,size:`sm`,onClick:Ie,style:{display:`inline-flex`,alignItems:`center`,gap:4,marginLeft:`auto`},children:[(0,U.jsx)(De,{size:14,"aria-hidden":!0}),s()]}):null]}),Z.length===0?(0,U.jsx)(`p`,{className:`oc-admin__hint`,children:$?ne():i()}):(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:_e()}),(0,U.jsx)(z,{children:b()}),(0,U.jsx)(z,{children:pe()}),(0,U.jsx)(z,{children:te()}),(0,U.jsx)(z,{children:se()}),(0,U.jsx)(z,{className:`text-right`,children:c()})]})}),(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:ce()}):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`?l():f()})}),(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)(N,{children:[(0,U.jsx)(M,{asChild:!0,children:(0,U.jsx)(E,{variant:`ghost`,size:`icon`,"aria-label":ae(),children:(0,U.jsx)(Se,{size:16})})}),(0,U.jsxs)(xe,{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)(j,{size:14}),o()]})}):(0,U.jsxs)(P,{disabled:!0,children:[(0,U.jsx)(j,{size:14}),ie()]}),(0,U.jsxs)(P,{variant:`destructive`,onSelect:()=>q({id:e._id,filename:e.filename}),children:[(0,U.jsx)(Ee,{size:14}),g()]})]})]})})]},e._id))})]}),ze?(0,U.jsx)(`p`,{className:`oc-admin__hint`,style:{marginTop:8},children:T({cap:Be})}):null]}),(0,U.jsx)(ke,{open:K!==null,onOpenChange:e=>!e&&q(null),children:(0,U.jsxs)(je,{children:[(0,U.jsxs)(Ae,{children:[(0,U.jsx)(we,{children:a()}),(0,U.jsx)(Ce,{children:le()})]}),(0,U.jsxs)(O,{children:[(0,U.jsx)(Te,{children:ve()}),(0,U.jsx)(Me,{onClick:()=>void Le(),children:g()})]})]})})]})}export{K as FilesTab};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Cg as r,Sg as i}from"./api-
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Cg as r,Sg as i}from"./api-B1lq0pb-.js";import{t as a}from"./button-Ds98Pj53.js";import{hn as o,jt as s,mn as c}from"./index-DMM3fags.js";import{t as l}from"./TimeRangePicker-DOkbYJPt.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)(c,{className:`oc-filterbar__search-icon`,"aria-hidden":!0}),(0,d.jsx)(s,{value:v,onChange:e=>x(e.target.value),placeholder:n,"aria-label":n})]}),p?(0,d.jsx)(`div`,{className:`oc-filterbar__quick`,children:p}):null,m&&h?(0,d.jsx)(l,{value:m,onChange:h}):null,(0,d.jsxs)(a,{variant:`ghost`,size:`sm`,className:`oc-filterbar__reset`,onClick:S,disabled:!_,children:[(0,d.jsx)(o,{}),i()]})]})}export{p as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$p as r,Ap as i,Bp as a,Cm as o,Cp as s,D as c,Dm as l,Dp as u,Em as d,Ep as f,Fp as p,Gp as m,Hp as h,Ip as g,Jp as _,Kp as v,Lp as y,Mp as b,Np as x,Om as S,Op as C,Pp as w,Qp as T,Rp as E,Sm as ee,Sp as D,Tm as O,Tp as te,Up as ne,Vp as re,Wp as ie,Xp as k,Yp as A,Zp as ae,_m as oe,am as se,bm as j,bp as M,cm as N,dm as ce,em as P,fm as le,gm as ue,hm as de,im as fe,jp as pe,km as me,kp as he,lm as ge,mm as _e,nm as ve,oV as F,om as ye,pm as be,qp as xe,rm as Se,sV as I,sm as Ce,t as L,tm as we,um as Te,vm as Ee,wm as De,wp as R,xm as Oe,xp as ke,ym as Ae,zp as je}from"./api-Dawxt_aS.js";import{t as Me}from"./x-BSVAMcNy.js";import{i as z,n as B,r as Ne,t as Pe}from"./tabs-D-3HavQe.js";import{t as V}from"./button-alklyZ2M.js";import{$ as Fe,Bn as Ie,Dt as H,Et as U,Q as Le,U as Re,Vn as ze,X as Be,Z as Ve,_ as He,at as Ue,cn as We,et as Ge,fn as W,jt as G,nt as Ke,ot as qe,pn as K,q as Je,rt as Ye,tt as Xe,ut as q}from"./index-C-ySA5Hs.js";import{t as Ze}from"./FilterBar-D_6ObXjr.js";import{t as Qe}from"./DataTableShell-DGGSIwCx.js";import{t as J}from"./DetailChips-DTzXBtIX.js";var Y=c(`palette`,[[`path`,{d:`M12 22a1 1 0 0 1 0-20 10 9 0 0 1 10 9 5 5 0 0 1-5 5h-2.25a1.75 1.75 0 0 0-1.4 2.8l.3.4a1.75 1.75 0 0 1-1.4 2.8z`,key:`e79jfc`}],[`circle`,{cx:`13.5`,cy:`6.5`,r:`.5`,fill:`currentColor`,key:`1okk4w`}],[`circle`,{cx:`17.5`,cy:`10.5`,r:`.5`,fill:`currentColor`,key:`f64h9f`}],[`circle`,{cx:`6.5`,cy:`12.5`,r:`.5`,fill:`currentColor`,key:`qy21gx`}],[`circle`,{cx:`8.5`,cy:`7.5`,r:`.5`,fill:`currentColor`,key:`fotxhn`}]]),X=c(`shield-check`,[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`,key:`oel41y`}],[`path`,{d:`m9 12 2 2 4-4`,key:`dzmm74`}]]),Z=t(e(),1);function $e(e,t,n){let r=t.trim().toLowerCase();return[...r?e.filter(e=>[e.email,e.name,e.canonical].some(e=>e!=null&&e.toLowerCase().includes(r))):e.slice()].sort((e,t)=>!n.has(e.userId)-+!n.has(t.userId))}function et(e,t){let n=e.filter(e=>e.source===`discovered`),r=t.trim().toLowerCase();return r?n.filter(e=>(e.displayName??e.agentId).toLowerCase().includes(r)||e.agentId.toLowerCase().includes(r)):n}function tt(e){let t=e.name?.trim()??``,n=e.email?.trim()??``,r=e.canonical?.trim()||`u-${e.userId.slice(0,8)}`;return t?{primary:t,secondary:n||`@${r}`}:n?{primary:n,secondary:null}:{primary:`@${r}`,secondary:null}}function nt(e){switch(e){case`admin`:return k();case`user`:return A();case`pending`:return _();default:return e}}function rt(e,t){if(e.length===0)return`none`;let n=0;for(let r of e)t(r)&&n++;return n===0?`none`:n===e.length?`all`:`some`}function it(e,t,n){let r=Math.max(1,Math.ceil(e.length/n)),i=Math.min(Math.max(1,Math.floor(t)),r),a=(i-1)*n;return{pageItems:e.slice(a,a+n),page:i,pageCount:r}}var Q=n(),$={name:``,description:``};function at(){let e=I(L.groups.listGroups,{}),t=I(L.me.getMe,{host:Je})?.role===`admin`,n=F(L.groups.createGroup),r=F(L.groups.updateGroup),i=F(L.groups.deleteGroup),a=Re(),c=H(),[u,f]=(0,Z.useState)(!1),[p,m]=(0,Z.useState)(null),[h,g]=(0,Z.useState)($),[_,v]=(0,Z.useState)(null),[y,b]=(0,Z.useState)(``),x=(0,Z.useMemo)(()=>{if(!e)return e;let t=y.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,y]);function C(){m(null),g($),f(!0)}function w(e){m(e),g({name:e.name,description:e.description??``}),f(!0)}async function T(){try{p?await r({groupId:p._id,name:h.name,description:h.description}):await n({name:h.name,description:h.description||void 0}),g($),m(null),f(!1)}catch(e){c.error(s(),e)}}async function E(e){if(await a({title:Te({name:e.name}),description:ge(),confirmWord:e.name,confirmLabel:N(),cancelLabel:ue(),destructive:!0}))try{await i({groupId:e._id})}catch(e){c.error(D(),e)}}return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:S()}),(0,Q.jsx)(Ze,{q:y,onQChange:b,onReset:()=>b(``),canReset:y!==``,searchPlaceholder:Oe()}),(0,Q.jsx)(Qe,{title:me(),rows:x,addLabel:l(),onAdd:t?C:void 0,emptyHint:d(),columns:[{header:O(),cell:e=>e.name,sort:e=>e.name},{header:De(),cell:e=>(0,Q.jsx)(J,{icon:(0,Q.jsx)(We,{size:12,"aria-hidden":!0}),total:e.memberCount,items:e.members.map(e=>({label:e.label,marker:e.manager?(0,Q.jsx)(X,{size:11,"aria-hidden":!0}):null,highlight:e.manager}))}),sort:e=>e.memberCount},{header:o(),cell:e=>(0,Q.jsx)(J,{icon:(0,Q.jsx)(K,{size:12,"aria-hidden":!0}),total:e.agentCount,items:e.agents.map(e=>({label:e}))}),sort:e=>e.agentCount},{header:ee(),cell:e=>(0,Q.jsx)(J,{icon:(0,Q.jsx)(Y,{size:12,"aria-hidden":!0}),total:e.chartCount,items:e.charts.map(e=>({label:e.name,marker:e.isDefault?(0,Q.jsx)(W,{size:11,fill:`currentColor`,"aria-hidden":!0}):null,highlight:e.isDefault}))}),sort:e=>e.chartCount}],rowActions:e=>[{label:j(),onSelect:()=>v({groupId:e._id,name:e.name})},...t?[{label:Ae(),onSelect:()=>w(e)},{label:Ee(),variant:`destructive`,onSelect:()=>void E(e)}]:[]]}),(0,Q.jsx)(He,{open:u,onOpenChange:f,title:p?_e():de(),description:be(),canSubmit:!!h.name.trim(),onSubmit:T,submitLabel:oe(),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:le()}),(0,Q.jsx)(G,{value:h.name,onChange:e=>g({...h,name:e.target.value})})]}),(0,Q.jsxs)(`label`,{className:`oc-field`,children:[(0,Q.jsx)(`span`,{className:`oc-field__label`,children:ce()}),(0,Q.jsx)(G,{value:h.description,onChange:e=>g({...h,description:e.target.value})})]})]})}),(0,Q.jsx)(ct,{groupId:_?.groupId??null,groupName:_?.name??``,open:_!==null,onOpenChange:e=>{e||v(null)}})]})}var ot=8;function st({page:e,pageCount:t,onPage:n}){return t<=1?null:(0,Q.jsxs)(`div`,{className:`oc-access__pager`,children:[(0,Q.jsxs)(V,{type:`button`,variant:`ghost`,size:`sm`,disabled:e<=1,onClick:()=>n(e-1),children:[(0,Q.jsx)(ze,{size:14,"aria-hidden":!0}),r()]}),(0,Q.jsxs)(`span`,{className:`oc-access__pageinfo`,"aria-label":ae({page:e,pages:t}),children:[e,` / `,t]}),(0,Q.jsxs)(V,{type:`button`,variant:`ghost`,size:`sm`,disabled:e>=t,onClick:()=>n(e+1),children:[T(),(0,Q.jsx)(Ie,{size:14,"aria-hidden":!0})]})]})}function ct({groupId:e,groupName:t,open:n,onOpenChange:r}){let i=I(L.groups.getGroup,n&&e?{groupId:e}:`skip`),a=I(L.groups.listAssignableInstances,n?{}:`skip`),o=I(L.groups.listAssignableUsers,n?{}:`skip`),s=F(L.groups.addMember),c=F(L.groups.removeMember),l=F(L.groups.bulkSetMembers),d=F(L.groups.setGroupManager),p=H(),[_,v]=(0,Z.useState)(``),[y,b]=(0,Z.useState)(``),[x,S]=(0,Z.useState)(`members`),[w,T]=(0,Z.useState)(1),[E,ee]=(0,Z.useState)(new Set),D=(0,Z.useRef)(null),O=(0,Z.useMemo)(()=>new Set((i?.members??[]).map(e=>e.userId)),[i]),re=(0,Z.useMemo)(()=>new Set((i?.members??[]).filter(e=>e.manager).map(e=>e.userId)),[i]),ie=i?.viewerIsAdmin===!0,k=(0,Z.useMemo)(()=>new Set((i?.agents??[]).map(e=>`${e.instanceName}/${e.agentId}`)),[i]);(0,Z.useEffect)(()=>{v(``),b(``),S(`members`),T(1),D.current=null},[n,e]),(0,Z.useEffect)(()=>{T(1)},[_]),(0,Z.useEffect)(()=>{n&&i&&e&&D.current!==e&&(D.current=e,ee(new Set((i.members??[]).map(e=>e.userId))))},[n,i,e]);let A=(0,Z.useMemo)(()=>o?$e(o,_,E):[],[o,_,E]);async function ae(t,n){if(e)try{n?await c({groupId:e,userId:t}):await s({groupId:e,userId:t})}catch(e){p.error(ke(),e)}}async function oe(t,n){if(e)try{await d({groupId:e,userId:t,manager:!n})}catch(e){p.error(te(),e)}}let j=rt(A,e=>O.has(e.userId)),M=A.filter(e=>O.has(e.userId)).length,N=it(A,w,ot);async function ce(){if(!e||A.length===0)return;let t=A.map(e=>e.userId);try{await l({groupId:e,userIds:t,member:j!==`all`})}catch(e){p.error(ke(),e)}}return(0,Q.jsx)(Xe,{open:n,onOpenChange:r,children:(0,Q.jsxs)(Ke,{className:`oc-access`,children:[(0,Q.jsxs)(Ue,{children:[(0,Q.jsx)(qe,{children:Ce({name:t})}),(0,Q.jsx)(Ye,{children:ye()})]}),(0,Q.jsxs)(Pe,{value:x,onValueChange:S,className:`oc-access__tabs`,children:[(0,Q.jsxs)(Ne,{className:`w-full`,children:[(0,Q.jsxs)(z,{value:`members`,className:`flex-1 gap-1.5`,children:[(0,Q.jsx)(We,{size:13,"aria-hidden":!0}),se(),i?(0,Q.jsx)(U,{variant:`secondary`,className:`oc-access__tabcount`,children:O.size}):null]}),(0,Q.jsxs)(z,{value:`agents`,className:`flex-1 gap-1.5`,children:[(0,Q.jsx)(K,{size:13,"aria-hidden":!0}),Se(),i?(0,Q.jsx)(U,{variant:`secondary`,className:`oc-access__tabcount`,children:k.size}):null]}),(0,Q.jsxs)(z,{value:`charts`,className:`flex-1 gap-1.5`,children:[(0,Q.jsx)(Y,{size:13,"aria-hidden":!0}),g(),i?(0,Q.jsx)(U,{variant:`secondary`,className:`oc-access__tabcount`,children:i.chartCount}):null]})]}),(0,Q.jsx)(B,{value:`members`,children:o===void 0||i===void 0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:m()}):o.length===0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:ne()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(G,{value:_,onChange:e=>v(e.target.value),placeholder:fe(),className:`oc-access__search`}),A.length===0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:we()}):(0,Q.jsxs)(Q.Fragment,{children:[A.length>1?(0,Q.jsxs)(`div`,{className:`oc-access__row oc-access__selectall`,children:[(0,Q.jsx)(q,{checked:j===`all`?!0:j===`some`?`indeterminate`:!1,onCheckedChange:()=>void ce(),"aria-label":P()}),(0,Q.jsx)(`span`,{className:`oc-access__label`,children:P()}),(0,Q.jsxs)(U,{variant:`outline`,className:`oc-access__count`,children:[M,` / `,A.length]})]}):null,(0,Q.jsx)(`div`,{className:`oc-access__list`,children:N.pageItems.map(e=>{let t=O.has(e.userId),n=tt(e),r=re.has(e.userId);return(0,Q.jsxs)(`div`,{className:`oc-access__row`,children:[(0,Q.jsx)(q,{checked:t,onCheckedChange:()=>void ae(e.userId,t),"aria-label":xe({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]}),(0,Q.jsx)(U,{variant:`outline`,className:`oc-access__role`,children:nt(e.role)}),(0,Q.jsx)(`span`,{className:`oc-access__mgrslot`,children:t&&ie?(0,Q.jsx)(V,{type:`button`,variant:`ghost`,size:`icon`,className:`shrink-0 oc-access__mgr${r?` oc-access__mgr--on`:``}`,"aria-pressed":r,"aria-label":r?f():u(),title:r?f():u(),onClick:()=>void oe(e.userId,r),children:(0,Q.jsx)(X,{size:15,"aria-hidden":!0})}):t&&r?(0,Q.jsx)(`span`,{className:`oc-access__mgr oc-access__mgr--on`,role:`img`,"aria-label":C(),title:C(),children:(0,Q.jsx)(X,{size:15,"aria-hidden":!0})}):null})]},e._id)})}),(0,Q.jsx)(st,{page:N.page,pageCount:N.pageCount,onPage:T})]})]})}),(0,Q.jsx)(B,{value:`agents`,children:a===void 0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:m()}):a.length===0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:h()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(G,{value:y,onChange:e=>b(e.target.value),placeholder:ve(),className:`oc-access__search`}),(0,Q.jsx)(`div`,{className:`oc-access__list`,children:a.map(t=>(0,Q.jsx)(lt,{groupId:e,instanceName:t.name,kind:t.kind??`openclaw`,assigned:k,query:y},`${e}-${t._id}`))})]})}),(0,Q.jsx)(B,{value:`charts`,children:(0,Q.jsx)(ut,{groupId:e})})]})]})})}function lt({groupId:e,instanceName:t,kind:n,assigned:r,query:i}){let o=I(L.groups.listAssignableAgents,{instanceName:t}),s=F(L.groups.assignAgentToGroup),c=F(L.groups.removeAgentFromGroup),l=F(L.groups.bulkSetGroupAgents),u=H(),[d,f]=(0,Z.useState)(1);if((0,Z.useEffect)(()=>{f(1)},[i]),!e)return null;let p=et(o?.agents??[],i),m=o?.discovery&&!o.discovery.lastPollOk;if(i.trim()&&p.length===0)return null;let h=p.filter(e=>e.presentInLastOk!==!1&&e.enabled!==!1),g=rt(h,e=>r.has(`${t}/${e.agentId}`)),_=it(p,d,ot);async function b(n,r){try{r?await c({groupId:e,instanceName:t,agentId:n}):await s({groupId:e,instanceName:t,agentId:n})}catch(e){u.error(M(),e)}}async function x(){if(h.length===0)return;let n=h.map(e=>e.agentId);try{await l({groupId:e,instanceName:t,agentIds:n,assigned:g!==`all`})}catch(e){u.error(M(),e)}}return(0,Q.jsxs)(`div`,{className:`oc-access__group`,children:[(0,Q.jsxs)(`div`,{className:`oc-access__instance`,children:[(0,Q.jsx)(K,{size:13,"aria-hidden":!0}),(0,Q.jsx)(`span`,{children:t}),(0,Q.jsx)(U,{variant:`outline`,className:`oc-access__kind`,children:n}),m?(0,Q.jsx)(U,{variant:`outline`,className:`oc-access__stale`,children:je()}):null]}),o===void 0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:ie()}):p.length===0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:m?a():re()}):(0,Q.jsxs)(Q.Fragment,{children:[h.length>1?(0,Q.jsxs)(`div`,{className:`oc-access__row oc-access__selectall`,children:[(0,Q.jsx)(q,{checked:g===`all`?!0:g===`some`?`indeterminate`:!1,onCheckedChange:()=>void x(),"aria-label":P()}),(0,Q.jsx)(`span`,{className:`oc-access__label`,children:P()})]}):null,_.pageItems.map(e=>{let n=`${t}/${e.agentId}`,i=r.has(n),a=e.presentInLastOk===!1,o=!e.enabled;return(0,Q.jsxs)(`div`,{className:`oc-access__row${o?` is-disabled`:``}`,children:[(0,Q.jsx)(q,{checked:i,disabled:(a||o)&&!i,onCheckedChange:()=>void b(e.agentId,i),"aria-label":v({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,e.isDefaultOnInstance?(0,Q.jsx)(`span`,{className:`oc-access__fav`,role:`img`,"aria-label":y(),title:y(),children:(0,Q.jsx)(W,{size:14,fill:`currentColor`})}):null,a?(0,Q.jsx)(U,{variant:`outline`,className:`oc-access__gone`,children:E()}):null]},e.agentId)}),(0,Q.jsx)(st,{page:_.page,pageCount:_.pageCount,onPage:f})]})]})}function ut({groupId:e}){let t=I(L.charts.listGroupChartSelection,e?{groupId:e}:`skip`),n=F(L.charts.assignChartToGroup),r=F(L.charts.removeChartFromGroup),a=F(L.charts.setGroupDefaultChart),o=F(L.charts.addChartToGroupPool),s=F(L.charts.removeChartFromGroupPool),c=H();if(!e)return null;if(t===void 0)return(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:m()});let{pool:l,addable:u,canManagePool:d}=t;if(l.length===0&&!d)return(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:p()});async function f(t,i){try{i?await r({groupId:e,chartKey:t}):await n({groupId:e,chartKey:t})}catch(e){c.error(R(),e)}}async function h(t){try{await a({groupId:e,chartKey:t})}catch(e){c.error(R(),e)}}async function g(t){try{await o({groupId:e,chartKey:t})}catch(e){c.error(R(),e)}}async function _(t){try{await s({groupId:e,chartKey:t})}catch(e){c.error(R(),e)}}return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`div`,{className:`oc-access__list`,children:l.map(e=>(0,Q.jsxs)(`div`,{className:`oc-access__row`,children:[(0,Q.jsx)(q,{checked:e.selected,onCheckedChange:()=>void f(e.chartKey,e.selected),"aria-label":pe({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":i(),title:i(),children:(0,Q.jsx)(W,{size:14,fill:`currentColor`})}):(0,Q.jsx)(V,{type:`button`,variant:`ghost`,size:`sm`,onClick:()=>void h(e.chartKey),children:he()}):null,d?(0,Q.jsx)(V,{type:`button`,variant:`ghost`,size:`sm`,"aria-label":b({name:e.name}),title:b({name:e.name}),onClick:()=>void _(e.chartKey),children:(0,Q.jsx)(Me,{size:14,"aria-hidden":!0})}):null]},e.chartKey))}),d?u.length>0?(0,Q.jsxs)(Be,{value:``,onValueChange:e=>void g(e),children:[(0,Q.jsx)(Fe,{size:`sm`,className:`oc-access__search`,children:(0,Q.jsx)(Ge,{placeholder:x()})}),(0,Q.jsx)(Ve,{children:u.map(e=>(0,Q.jsx)(Le,{value:e.chartKey,children:e.name},e.chartKey))})]}):l.length===0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:w()}):null:null]})}export{at as GroupsTab};
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$p as r,Ap as i,Bp as a,Cm as o,Cp as s,D as c,Dm as l,Dp as u,Em as d,Ep as f,Fp as p,Gp as m,Hp as h,Ip as g,Jp as _,Kp as v,Lp as y,Mp as b,Np as x,Om as S,Op as C,Pp as w,Qp as T,Rp as E,Sm as ee,Sp as D,Tm as O,Tp as te,Up as ne,Vp as re,Wp as ie,Xp as k,Yp as A,Zp as ae,_m as oe,am as se,bm as j,bp as M,cV as N,cm as P,dm as ce,em as F,fm as le,gm as ue,hm as de,im as fe,jp as pe,km as me,kp as he,lm as ge,mm as _e,nm as ve,om as ye,pm as be,qp as xe,rm as Se,sV as I,sm as Ce,t as L,tm as we,um as Te,vm as Ee,wm as De,wp as R,xm as Oe,xp as ke,ym as Ae,zp as je}from"./api-B1lq0pb-.js";import{t as Me}from"./x-CHx4ismM.js";import{i as z,n as B,r as Ne,t as Pe}from"./tabs-vdU2pkw5.js";import{t as V}from"./button-Ds98Pj53.js";import{$ as Fe,Bn as Ie,Dt as H,Et as U,Q as Le,U as Re,Vn as ze,X as Be,Z as Ve,_ as He,at as Ue,cn as We,et as Ge,fn as W,jt as G,nt as Ke,ot as qe,pn as K,q as Je,rt as Ye,tt as Xe,ut as q}from"./index-DMM3fags.js";import{t as Ze}from"./FilterBar-CK5Wsnof.js";import{t as Qe}from"./DataTableShell-CDmo0isC.js";import{t as J}from"./DetailChips-Csi8ao-5.js";var Y=c(`palette`,[[`path`,{d:`M12 22a1 1 0 0 1 0-20 10 9 0 0 1 10 9 5 5 0 0 1-5 5h-2.25a1.75 1.75 0 0 0-1.4 2.8l.3.4a1.75 1.75 0 0 1-1.4 2.8z`,key:`e79jfc`}],[`circle`,{cx:`13.5`,cy:`6.5`,r:`.5`,fill:`currentColor`,key:`1okk4w`}],[`circle`,{cx:`17.5`,cy:`10.5`,r:`.5`,fill:`currentColor`,key:`f64h9f`}],[`circle`,{cx:`6.5`,cy:`12.5`,r:`.5`,fill:`currentColor`,key:`qy21gx`}],[`circle`,{cx:`8.5`,cy:`7.5`,r:`.5`,fill:`currentColor`,key:`fotxhn`}]]),X=c(`shield-check`,[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`,key:`oel41y`}],[`path`,{d:`m9 12 2 2 4-4`,key:`dzmm74`}]]),Z=t(e(),1);function $e(e,t,n){let r=t.trim().toLowerCase();return[...r?e.filter(e=>[e.email,e.name,e.canonical].some(e=>e!=null&&e.toLowerCase().includes(r))):e.slice()].sort((e,t)=>!n.has(e.userId)-+!n.has(t.userId))}function et(e,t){let n=e.filter(e=>e.source===`discovered`),r=t.trim().toLowerCase();return r?n.filter(e=>(e.displayName??e.agentId).toLowerCase().includes(r)||e.agentId.toLowerCase().includes(r)):n}function tt(e){let t=e.name?.trim()??``,n=e.email?.trim()??``,r=e.canonical?.trim()||`u-${e.userId.slice(0,8)}`;return t?{primary:t,secondary:n||`@${r}`}:n?{primary:n,secondary:null}:{primary:`@${r}`,secondary:null}}function nt(e){switch(e){case`admin`:return k();case`user`:return A();case`pending`:return _();default:return e}}function rt(e,t){if(e.length===0)return`none`;let n=0;for(let r of e)t(r)&&n++;return n===0?`none`:n===e.length?`all`:`some`}function it(e,t,n){let r=Math.max(1,Math.ceil(e.length/n)),i=Math.min(Math.max(1,Math.floor(t)),r),a=(i-1)*n;return{pageItems:e.slice(a,a+n),page:i,pageCount:r}}var Q=n(),$={name:``,description:``};function at(){let e=N(L.groups.listGroups,{}),t=N(L.me.getMe,{host:Je})?.role===`admin`,n=I(L.groups.createGroup),r=I(L.groups.updateGroup),i=I(L.groups.deleteGroup),a=Re(),c=H(),[u,f]=(0,Z.useState)(!1),[p,m]=(0,Z.useState)(null),[h,g]=(0,Z.useState)($),[_,v]=(0,Z.useState)(null),[y,b]=(0,Z.useState)(``),x=(0,Z.useMemo)(()=>{if(!e)return e;let t=y.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,y]);function C(){m(null),g($),f(!0)}function w(e){m(e),g({name:e.name,description:e.description??``}),f(!0)}async function T(){try{p?await r({groupId:p._id,name:h.name,description:h.description}):await n({name:h.name,description:h.description||void 0}),g($),m(null),f(!1)}catch(e){c.error(s(),e)}}async function E(e){if(await a({title:Te({name:e.name}),description:ge(),confirmWord:e.name,confirmLabel:P(),cancelLabel:ue(),destructive:!0}))try{await i({groupId:e._id})}catch(e){c.error(D(),e)}}return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:S()}),(0,Q.jsx)(Ze,{q:y,onQChange:b,onReset:()=>b(``),canReset:y!==``,searchPlaceholder:Oe()}),(0,Q.jsx)(Qe,{title:me(),rows:x,addLabel:l(),onAdd:t?C:void 0,emptyHint:d(),columns:[{header:O(),cell:e=>e.name,sort:e=>e.name},{header:De(),cell:e=>(0,Q.jsx)(J,{icon:(0,Q.jsx)(We,{size:12,"aria-hidden":!0}),total:e.memberCount,items:e.members.map(e=>({label:e.label,marker:e.manager?(0,Q.jsx)(X,{size:11,"aria-hidden":!0}):null,highlight:e.manager}))}),sort:e=>e.memberCount},{header:o(),cell:e=>(0,Q.jsx)(J,{icon:(0,Q.jsx)(K,{size:12,"aria-hidden":!0}),total:e.agentCount,items:e.agents.map(e=>({label:e}))}),sort:e=>e.agentCount},{header:ee(),cell:e=>(0,Q.jsx)(J,{icon:(0,Q.jsx)(Y,{size:12,"aria-hidden":!0}),total:e.chartCount,items:e.charts.map(e=>({label:e.name,marker:e.isDefault?(0,Q.jsx)(W,{size:11,fill:`currentColor`,"aria-hidden":!0}):null,highlight:e.isDefault}))}),sort:e=>e.chartCount}],rowActions:e=>[{label:j(),onSelect:()=>v({groupId:e._id,name:e.name})},...t?[{label:Ae(),onSelect:()=>w(e)},{label:Ee(),variant:`destructive`,onSelect:()=>void E(e)}]:[]]}),(0,Q.jsx)(He,{open:u,onOpenChange:f,title:p?_e():de(),description:be(),canSubmit:!!h.name.trim(),onSubmit:T,submitLabel:oe(),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:le()}),(0,Q.jsx)(G,{value:h.name,onChange:e=>g({...h,name:e.target.value})})]}),(0,Q.jsxs)(`label`,{className:`oc-field`,children:[(0,Q.jsx)(`span`,{className:`oc-field__label`,children:ce()}),(0,Q.jsx)(G,{value:h.description,onChange:e=>g({...h,description:e.target.value})})]})]})}),(0,Q.jsx)(ct,{groupId:_?.groupId??null,groupName:_?.name??``,open:_!==null,onOpenChange:e=>{e||v(null)}})]})}var ot=8;function st({page:e,pageCount:t,onPage:n}){return t<=1?null:(0,Q.jsxs)(`div`,{className:`oc-access__pager`,children:[(0,Q.jsxs)(V,{type:`button`,variant:`ghost`,size:`sm`,disabled:e<=1,onClick:()=>n(e-1),children:[(0,Q.jsx)(ze,{size:14,"aria-hidden":!0}),r()]}),(0,Q.jsxs)(`span`,{className:`oc-access__pageinfo`,"aria-label":ae({page:e,pages:t}),children:[e,` / `,t]}),(0,Q.jsxs)(V,{type:`button`,variant:`ghost`,size:`sm`,disabled:e>=t,onClick:()=>n(e+1),children:[T(),(0,Q.jsx)(Ie,{size:14,"aria-hidden":!0})]})]})}function ct({groupId:e,groupName:t,open:n,onOpenChange:r}){let i=N(L.groups.getGroup,n&&e?{groupId:e}:`skip`),a=N(L.groups.listAssignableInstances,n?{}:`skip`),o=N(L.groups.listAssignableUsers,n?{}:`skip`),s=I(L.groups.addMember),c=I(L.groups.removeMember),l=I(L.groups.bulkSetMembers),d=I(L.groups.setGroupManager),p=H(),[_,v]=(0,Z.useState)(``),[y,b]=(0,Z.useState)(``),[x,S]=(0,Z.useState)(`members`),[w,T]=(0,Z.useState)(1),[E,ee]=(0,Z.useState)(new Set),D=(0,Z.useRef)(null),O=(0,Z.useMemo)(()=>new Set((i?.members??[]).map(e=>e.userId)),[i]),re=(0,Z.useMemo)(()=>new Set((i?.members??[]).filter(e=>e.manager).map(e=>e.userId)),[i]),ie=i?.viewerIsAdmin===!0,k=(0,Z.useMemo)(()=>new Set((i?.agents??[]).map(e=>`${e.instanceName}/${e.agentId}`)),[i]);(0,Z.useEffect)(()=>{v(``),b(``),S(`members`),T(1),D.current=null},[n,e]),(0,Z.useEffect)(()=>{T(1)},[_]),(0,Z.useEffect)(()=>{n&&i&&e&&D.current!==e&&(D.current=e,ee(new Set((i.members??[]).map(e=>e.userId))))},[n,i,e]);let A=(0,Z.useMemo)(()=>o?$e(o,_,E):[],[o,_,E]);async function ae(t,n){if(e)try{n?await c({groupId:e,userId:t}):await s({groupId:e,userId:t})}catch(e){p.error(ke(),e)}}async function oe(t,n){if(e)try{await d({groupId:e,userId:t,manager:!n})}catch(e){p.error(te(),e)}}let j=rt(A,e=>O.has(e.userId)),M=A.filter(e=>O.has(e.userId)).length,P=it(A,w,ot);async function ce(){if(!e||A.length===0)return;let t=A.map(e=>e.userId);try{await l({groupId:e,userIds:t,member:j!==`all`})}catch(e){p.error(ke(),e)}}return(0,Q.jsx)(Xe,{open:n,onOpenChange:r,children:(0,Q.jsxs)(Ke,{className:`oc-access`,children:[(0,Q.jsxs)(Ue,{children:[(0,Q.jsx)(qe,{children:Ce({name:t})}),(0,Q.jsx)(Ye,{children:ye()})]}),(0,Q.jsxs)(Pe,{value:x,onValueChange:S,className:`oc-access__tabs`,children:[(0,Q.jsxs)(Ne,{className:`w-full`,children:[(0,Q.jsxs)(z,{value:`members`,className:`flex-1 gap-1.5`,children:[(0,Q.jsx)(We,{size:13,"aria-hidden":!0}),se(),i?(0,Q.jsx)(U,{variant:`secondary`,className:`oc-access__tabcount`,children:O.size}):null]}),(0,Q.jsxs)(z,{value:`agents`,className:`flex-1 gap-1.5`,children:[(0,Q.jsx)(K,{size:13,"aria-hidden":!0}),Se(),i?(0,Q.jsx)(U,{variant:`secondary`,className:`oc-access__tabcount`,children:k.size}):null]}),(0,Q.jsxs)(z,{value:`charts`,className:`flex-1 gap-1.5`,children:[(0,Q.jsx)(Y,{size:13,"aria-hidden":!0}),g(),i?(0,Q.jsx)(U,{variant:`secondary`,className:`oc-access__tabcount`,children:i.chartCount}):null]})]}),(0,Q.jsx)(B,{value:`members`,children:o===void 0||i===void 0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:m()}):o.length===0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:ne()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(G,{value:_,onChange:e=>v(e.target.value),placeholder:fe(),className:`oc-access__search`}),A.length===0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:we()}):(0,Q.jsxs)(Q.Fragment,{children:[A.length>1?(0,Q.jsxs)(`div`,{className:`oc-access__row oc-access__selectall`,children:[(0,Q.jsx)(q,{checked:j===`all`?!0:j===`some`?`indeterminate`:!1,onCheckedChange:()=>void ce(),"aria-label":F()}),(0,Q.jsx)(`span`,{className:`oc-access__label`,children:F()}),(0,Q.jsxs)(U,{variant:`outline`,className:`oc-access__count`,children:[M,` / `,A.length]})]}):null,(0,Q.jsx)(`div`,{className:`oc-access__list`,children:P.pageItems.map(e=>{let t=O.has(e.userId),n=tt(e),r=re.has(e.userId);return(0,Q.jsxs)(`div`,{className:`oc-access__row`,children:[(0,Q.jsx)(q,{checked:t,onCheckedChange:()=>void ae(e.userId,t),"aria-label":xe({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]}),(0,Q.jsx)(U,{variant:`outline`,className:`oc-access__role`,children:nt(e.role)}),(0,Q.jsx)(`span`,{className:`oc-access__mgrslot`,children:t&&ie?(0,Q.jsx)(V,{type:`button`,variant:`ghost`,size:`icon`,className:`shrink-0 oc-access__mgr${r?` oc-access__mgr--on`:``}`,"aria-pressed":r,"aria-label":r?f():u(),title:r?f():u(),onClick:()=>void oe(e.userId,r),children:(0,Q.jsx)(X,{size:15,"aria-hidden":!0})}):t&&r?(0,Q.jsx)(`span`,{className:`oc-access__mgr oc-access__mgr--on`,role:`img`,"aria-label":C(),title:C(),children:(0,Q.jsx)(X,{size:15,"aria-hidden":!0})}):null})]},e._id)})}),(0,Q.jsx)(st,{page:P.page,pageCount:P.pageCount,onPage:T})]})]})}),(0,Q.jsx)(B,{value:`agents`,children:a===void 0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:m()}):a.length===0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:h()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(G,{value:y,onChange:e=>b(e.target.value),placeholder:ve(),className:`oc-access__search`}),(0,Q.jsx)(`div`,{className:`oc-access__list`,children:a.map(t=>(0,Q.jsx)(lt,{groupId:e,instanceName:t.name,kind:t.kind??`openclaw`,assigned:k,query:y},`${e}-${t._id}`))})]})}),(0,Q.jsx)(B,{value:`charts`,children:(0,Q.jsx)(ut,{groupId:e})})]})]})})}function lt({groupId:e,instanceName:t,kind:n,assigned:r,query:i}){let o=N(L.groups.listAssignableAgents,{instanceName:t}),s=I(L.groups.assignAgentToGroup),c=I(L.groups.removeAgentFromGroup),l=I(L.groups.bulkSetGroupAgents),u=H(),[d,f]=(0,Z.useState)(1);if((0,Z.useEffect)(()=>{f(1)},[i]),!e)return null;let p=et(o?.agents??[],i),m=o?.discovery&&!o.discovery.lastPollOk;if(i.trim()&&p.length===0)return null;let h=p.filter(e=>e.presentInLastOk!==!1&&e.enabled!==!1),g=rt(h,e=>r.has(`${t}/${e.agentId}`)),_=it(p,d,ot);async function b(n,r){try{r?await c({groupId:e,instanceName:t,agentId:n}):await s({groupId:e,instanceName:t,agentId:n})}catch(e){u.error(M(),e)}}async function x(){if(h.length===0)return;let n=h.map(e=>e.agentId);try{await l({groupId:e,instanceName:t,agentIds:n,assigned:g!==`all`})}catch(e){u.error(M(),e)}}return(0,Q.jsxs)(`div`,{className:`oc-access__group`,children:[(0,Q.jsxs)(`div`,{className:`oc-access__instance`,children:[(0,Q.jsx)(K,{size:13,"aria-hidden":!0}),(0,Q.jsx)(`span`,{children:t}),(0,Q.jsx)(U,{variant:`outline`,className:`oc-access__kind`,children:n}),m?(0,Q.jsx)(U,{variant:`outline`,className:`oc-access__stale`,children:je()}):null]}),o===void 0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:ie()}):p.length===0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:m?a():re()}):(0,Q.jsxs)(Q.Fragment,{children:[h.length>1?(0,Q.jsxs)(`div`,{className:`oc-access__row oc-access__selectall`,children:[(0,Q.jsx)(q,{checked:g===`all`?!0:g===`some`?`indeterminate`:!1,onCheckedChange:()=>void x(),"aria-label":F()}),(0,Q.jsx)(`span`,{className:`oc-access__label`,children:F()})]}):null,_.pageItems.map(e=>{let n=`${t}/${e.agentId}`,i=r.has(n),a=e.presentInLastOk===!1,o=!e.enabled;return(0,Q.jsxs)(`div`,{className:`oc-access__row${o?` is-disabled`:``}`,children:[(0,Q.jsx)(q,{checked:i,disabled:(a||o)&&!i,onCheckedChange:()=>void b(e.agentId,i),"aria-label":v({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,e.isDefaultOnInstance?(0,Q.jsx)(`span`,{className:`oc-access__fav`,role:`img`,"aria-label":y(),title:y(),children:(0,Q.jsx)(W,{size:14,fill:`currentColor`})}):null,a?(0,Q.jsx)(U,{variant:`outline`,className:`oc-access__gone`,children:E()}):null]},e.agentId)}),(0,Q.jsx)(st,{page:_.page,pageCount:_.pageCount,onPage:f})]})]})}function ut({groupId:e}){let t=N(L.charts.listGroupChartSelection,e?{groupId:e}:`skip`),n=I(L.charts.assignChartToGroup),r=I(L.charts.removeChartFromGroup),a=I(L.charts.setGroupDefaultChart),o=I(L.charts.addChartToGroupPool),s=I(L.charts.removeChartFromGroupPool),c=H();if(!e)return null;if(t===void 0)return(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:m()});let{pool:l,addable:u,canManagePool:d}=t;if(l.length===0&&!d)return(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:p()});async function f(t,i){try{i?await r({groupId:e,chartKey:t}):await n({groupId:e,chartKey:t})}catch(e){c.error(R(),e)}}async function h(t){try{await a({groupId:e,chartKey:t})}catch(e){c.error(R(),e)}}async function g(t){try{await o({groupId:e,chartKey:t})}catch(e){c.error(R(),e)}}async function _(t){try{await s({groupId:e,chartKey:t})}catch(e){c.error(R(),e)}}return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`div`,{className:`oc-access__list`,children:l.map(e=>(0,Q.jsxs)(`div`,{className:`oc-access__row`,children:[(0,Q.jsx)(q,{checked:e.selected,onCheckedChange:()=>void f(e.chartKey,e.selected),"aria-label":pe({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":i(),title:i(),children:(0,Q.jsx)(W,{size:14,fill:`currentColor`})}):(0,Q.jsx)(V,{type:`button`,variant:`ghost`,size:`sm`,onClick:()=>void h(e.chartKey),children:he()}):null,d?(0,Q.jsx)(V,{type:`button`,variant:`ghost`,size:`sm`,"aria-label":b({name:e.name}),title:b({name:e.name}),onClick:()=>void _(e.chartKey),children:(0,Q.jsx)(Me,{size:14,"aria-hidden":!0})}):null]},e.chartKey))}),d?u.length>0?(0,Q.jsxs)(Be,{value:``,onValueChange:e=>void g(e),children:[(0,Q.jsx)(Fe,{size:`sm`,className:`oc-access__search`,children:(0,Q.jsx)(Ge,{placeholder:x()})}),(0,Q.jsx)(Ve,{children:u.map(e=>(0,Q.jsx)(Le,{value:e.chartKey,children:e.name},e.chartKey))})]}):l.length===0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:w()}):null:null]})}export{at as GroupsTab};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$ as r,$D as i,$E as a,$i as o,AD as s,AE as c,Ac as l,BD as u,BE as d,CD as f,CE as p,DD as m,DE as h,ED as g,EE as _,FD as v,FE as y,G as b,GD as ee,GE as x,H as S,HD as te,HE as C,ID as ne,IE as w,J as re,JD as ie,JE as T,K as ae,KD as oe,KE as E,LD as se,LE as ce,MD as le,ME as ue,ND as de,NE as fe,OD as pe,OE as me,Oc as he,PD as ge,PE as _e,Q as ve,QD as ye,QE as be,RD as xe,SD as Se,SE as Ce,TD as we,TE as Te,U as Ee,UD as De,UE as Oe,VD as ke,VE as Ae,W as je,WD as Me,WE as Ne,X as Pe,XD as Fe,XE as Ie,Y as Le,YD as Re,YE as ze,Z as Be,ZD as Ve,ZE as He,_D as Ue,_E as We,aD as Ge,aP as Ke,aV as D,bD as O,bE as qe,cD as Je,cV as k,dD as Ye,eD as Xe,eO as Ze,ea as Qe,et as $e,fD as et,gD as tt,gE as A,hD as nt,hE as rt,iD as it,iO as at,iP as j,it as ot,jD as st,jE as ct,jc as lt,kD as ut,kE as dt,kc as ft,lD as pt,mD as M,nD as mt,nO as ht,nS as gt,nt as _t,oD as vt,pD as yt,q as bt,qD as xt,qE as St,rD as Ct,rO as wt,rt as Tt,sD as Et,sV as N,t as P,tD as Dt,tO as Ot,tS as kt,ta as At,tt as jt,uD as Mt,vD as Nt,vE as Pt,wD as Ft,wE as It,xD as Lt,xE as Rt,yD as zt,yE as Bt,zD as Vt,zE as F}from"./api-B1lq0pb-.js";import{a as Ht,c as Ut}from"./FieldLabel-4AzJbj-7.js";import{t as I}from"./button-Ds98Pj53.js";import{$ as L,Bt as Wt,Dt as R,Et as z,Q as B,Rt as Gt,U as Kt,X as V,Z as H,_ as qt,at as U,et as W,jt as G,nt as K,ot as q,rt as J,tt as Jt,ut as Yt,zt as Xt}from"./index-DMM3fags.js";import{t as Zt}from"./DataTableShell-CDmo0isC.js";import{InstanceConfigDialog as Qt}from"./BridgeTab-CWbabhHl.js";var Y=t(e(),1),X=[`conversational`,`documentary`,`summarizer`,`curator`],$t=new Set(X),en=`conversational`;function tn(e){let t=new Set((e??[]).filter(e=>$t.has(e)));return t.size===0?[en]: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`,systemIdentity:``,streamTransport:Ht},nn={openclaw:[`token`,`deviceIdentity`],hermes:[`apiKey`]};function rn(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`,systemIdentity:e.systemIdentity??``,streamTransport:e.streamTransport??`reactive`}}function an(){let e=k(P.admin.listInstances,{}),t=k(P.agents.listAllInstanceAgents,{}),n=N(P.admin.upsertInstance),a=N(P.admin.deleteInstance),c=R(),[l,d]=(0,Y.useState)(!1),[f,p]=(0,Y.useState)(Q),[h,g]=(0,Y.useState)(null),[_,y]=(0,Y.useState)(null),[x,C]=(0,Y.useState)(null),[w,T]=(0,Y.useState)(null);async function E(){try{await n({instanceId:w??void 0,name:f.name,gatewayUrl:f.gatewayUrl,bridgeUrl:f.bridgeUrl||void 0,displayName:f.displayName||void 0,kind:f.kind,transport:f.kind===`hermes`?f.transport:void 0,gatewayVersion:f.gatewayVersion||void 0,gatewayHttpUrl:f.gatewayHttpUrl||void 0,...f.kind===`openclaw`?{authMode:f.authMode,personScopes:f.personScopes,identitySource:f.identitySource,systemIdentity:f.systemIdentity||void 0}:{},streamTransport:f.streamTransport}),p(Q),T(null),d(!1)}catch(e){c.error(ht(),e)}}return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`p`,{className:`oc-admin__hint`,children:[Ot(),(0,Z.jsx)(`strong`,{children:Ze()}),i()]}),(0,Z.jsx)(Zt,{title:ye(),rows:e,addLabel:Ve(),onAdd:()=>{T(null),p(Q),d(!0)},emptyHint:Fe(),columns:[{header:Re(),cell:e=>e.name,sort:e=>e.name},{header:ie(),cell:e=>(0,Z.jsx)(z,{variant:`outline`,children:e.kind??`openclaw`}),sort:e=>e.kind??`openclaw`},{header:xt(),cell:e=>e.gatewayUrl,sort:e=>e.gatewayUrl},{header:oe(),cell:e=>e.displayName??`—`,sort:e=>e.displayName??null},{header:at(),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)(z,{variant:r(e.agentId)?`default`:`outline`,title:r(e.agentId)?A():void 0,children:[e.emoji?`${e.emoji} `:``,e.displayName??e.agentId]},e.agentId))})}}],rowActions:e=>[{label:te(),onSelect:()=>{T(e._id),p(rn(e)),d(!0)}},{label:wt(),onSelect:()=>g(e.name)},{label:m(),onSelect:()=>C(e)},{label:ee(),onSelect:()=>y(e)},{label:Me(),variant:`destructive`,onSelect:()=>void a({instanceId:e._id})}],bulkActions:[{label:Me(),variant:`destructive`,onSelect:e=>e.forEach(e=>void a({instanceId:e}))}]}),(0,Z.jsx)(qt,{open:l,onOpenChange:d,title:w?ke():De(),description:Vt(),canSubmit:!!(f.name&&f.gatewayUrl),onSubmit:E,submitLabel:xe(),children:(0,Z.jsxs)(`div`,{className:`oc-form`,children:[(0,Z.jsxs)($,{label:se(),children:[(0,Z.jsx)(G,{value:f.name,disabled:w!==null,onChange:e=>p({...f,name:e.target.value})}),w?(0,Z.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:u()}):null]}),(0,Z.jsx)($,{label:ne(),children:(0,Z.jsxs)(V,{value:f.kind,onValueChange:e=>p({...f,kind:e}),children:[(0,Z.jsx)(L,{size:`sm`,className:`w-full`,children:(0,Z.jsx)(W,{})}),(0,Z.jsxs)(H,{children:[(0,Z.jsx)(B,{value:`openclaw`,children:`OpenClaw`}),(0,Z.jsx)(B,{value:`hermes`,children:`Hermes`})]})]})}),f.kind===`hermes`?(0,Z.jsx)($,{label:At(),children:(0,Z.jsxs)(V,{value:f.transport,onValueChange:e=>p({...f,transport:e}),children:[(0,Z.jsx)(L,{size:`sm`,className:`w-full`,children:(0,Z.jsx)(W,{})}),(0,Z.jsxs)(H,{children:[(0,Z.jsx)(B,{value:`ws`,children:Qe()}),(0,Z.jsx)(B,{value:`rest`,children:o()})]})]})}):null,(0,Z.jsx)($,{label:v(),children:(0,Z.jsx)(G,{value:f.gatewayUrl,onChange:e=>p({...f,gatewayUrl:e.target.value})})}),(0,Z.jsx)($,{label:ge(),children:(0,Z.jsx)(G,{value:f.bridgeUrl,placeholder:de(),onChange:e=>p({...f,bridgeUrl:e.target.value})})}),(0,Z.jsx)($,{label:le(),children:(0,Z.jsx)(G,{value:f.displayName,onChange:e=>p({...f,displayName:e.target.value})})}),(0,Z.jsxs)($,{label:gt(),children:[(0,Z.jsxs)(V,{value:f.streamTransport,onValueChange:e=>p({...f,streamTransport:e}),children:[(0,Z.jsx)(L,{size:`sm`,className:`w-full`,children:(0,Z.jsx)(W,{})}),(0,Z.jsx)(H,{children:Ut.map(e=>(0,Z.jsx)(B,{value:e,children:e},e))})]}),(0,Z.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:kt()})]}),(0,Z.jsx)($,{label:st(),children:(0,Z.jsx)(G,{value:f.gatewayVersion,placeholder:s(),onChange:e=>p({...f,gatewayVersion:e.target.value})})}),f.kind===`openclaw`?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)($,{label:re(),children:[(0,Z.jsxs)(V,{value:f.authMode,onValueChange:e=>p({...f,authMode:e}),children:[(0,Z.jsx)(L,{size:`sm`,className:`w-full`,children:(0,Z.jsx)(W,{})}),(0,Z.jsxs)(H,{children:[(0,Z.jsx)(B,{value:`token`,children:bt()}),(0,Z.jsx)(B,{value:`trusted-proxy`,children:ae()})]})]}),(0,Z.jsx)(`p`,{className:`oc-field__hint`,children:f.authMode===`trusted-proxy`?je():b()})]}),f.authMode===`trusted-proxy`?(0,Z.jsxs)($,{label:ot(),children:[(0,Z.jsxs)(V,{value:f.personScopes,onValueChange:e=>p({...f,personScopes:e}),children:[(0,Z.jsx)(L,{size:`sm`,className:`w-full`,children:(0,Z.jsx)(W,{})}),(0,Z.jsxs)(H,{children:[(0,Z.jsx)(B,{value:`capped`,children:Tt()}),(0,Z.jsx)(B,{value:`full`,children:_t()})]})]}),(0,Z.jsx)(`p`,{className:`oc-field__hint`,children:f.personScopes===`full`?$e():jt()})]}):null,f.authMode===`trusted-proxy`?(0,Z.jsxs)($,{label:r(),children:[(0,Z.jsxs)(V,{value:f.identitySource,onValueChange:e=>p({...f,identitySource:e}),children:[(0,Z.jsx)(L,{size:`sm`,className:`w-full`,children:(0,Z.jsx)(W,{})}),(0,Z.jsxs)(H,{children:[(0,Z.jsx)(B,{value:`canonical`,children:ve()}),(0,Z.jsx)(B,{value:`email`,children:Be()})]})]}),(0,Z.jsx)(`p`,{className:`oc-field__hint`,children:f.identitySource===`email`?Le():Pe()})]}):null,f.authMode===`trusted-proxy`?(0,Z.jsx)($,{label:Ee(),children:(0,Z.jsx)(G,{value:f.systemIdentity,placeholder:S(),onChange:e=>p({...f,systemIdentity:e.target.value})})}):null]}):null,(0,Z.jsx)($,{label:ut(),children:(0,Z.jsx)(G,{value:f.gatewayHttpUrl,placeholder:pe(),onChange:e=>p({...f,gatewayHttpUrl:e.target.value})})})]})}),(0,Z.jsx)(hn,{instanceName:h,open:h!==null,onOpenChange:e=>{e||g(null)}}),_?(0,Z.jsx)(Qt,{instance:_,onClose:()=>y(null)},_._id):null,x?(0,Z.jsx)(on,{instance:x,onClose:()=>C(null)},x._id):null]})}function on({instance:e,onClose:t}){let n=k(P.instanceSecrets.listInstanceSecretStatus,{}),r=nn[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)(Jt,{open:!0,onOpenChange:e=>!e&&t(),children:(0,Z.jsxs)(K,{onOpenAutoFocus:e=>e.preventDefault(),children:[(0,Z.jsxs)(U,{children:[(0,Z.jsx)(q,{children:g({instance:e.displayName??e.name})}),(0,Z.jsx)(J,{children:we()})]}),(0,Z.jsx)(`div`,{className:`oc-form`,children:r.map(t=>(0,Z.jsx)(ln,{instanceId:e._id,field:t,updatedAt:i[t]??null},t))}),(0,Z.jsx)(`div`,{className:`oc-bridgesecret`,children:(0,Z.jsx)(cn,{instance:e})}),(0,Z.jsx)(sn,{instance:e})]})})}function sn({instance:e}){let t=D(P.instanceSync.forceInstanceSync),n=R(),[r,i]=(0,Y.useState)(!1);async function o(){if(!r){i(!0);try{switch((await t({instanceId:e._id})).status){case`synced`:n.success(Ge());break;case`no_agents`:n.success(Ct());break;case`no_bridge_url`:n.error(mt());break;case`deploy_misconfigured`:n.error(Dt());break;case`unauthorized`:n.error(a());break;case`not_served`:n.error(be());break;default:n.error(Xe());break}}catch(e){n.error(it(),e)}finally{i(!1)}}}return(0,Z.jsxs)(`div`,{className:`oc-form`,children:[(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:He()}),(0,Z.jsx)(`div`,{className:`flex items-center gap-2`,children:(0,Z.jsx)(I,{size:`sm`,variant:`outline`,onClick:()=>void o(),disabled:r,children:r?vt():Et()})})]})}function cn({instance:e}){let t=k(P.bridgeAuth.listBridgeAuthStatus,{}),n=D(P.bridgeAuth.mintBridgeSecret),r=N(P.bridgeAuth.revokeBridgeSecret),i=R(),[a,o]=(0,Y.useState)(!1),[s,c]=(0,Y.useState)(null),[l,u]=(0,Y.useState)(!1),d=(t??[]).find(t=>t.instanceId===e._id),f=d!==void 0;async function p(){if(!a){o(!0);try{c((await n({instanceId:e._id})).plaintext),u(!1)}catch(e){i.error(Ne(),e)}finally{o(!1)}}}async function m(){if(!a){o(!0);try{await r({instanceId:e._id}),c(null),i.success(x())}catch(e){i.error(Ne(),e)}finally{o(!1)}}}async function h(){if(s)try{await navigator.clipboard.writeText(s),u(!0)}catch{}}return(0,Z.jsxs)($,{label:Ie(),children:[(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:ze()}),(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Z.jsx)(z,{variant:f?`outline`:`secondary`,children:f?`${Lt()} · ${d.prefix}…${d.lastFour}`:O()}),(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(I,{size:`sm`,onClick:()=>void p(),disabled:a,children:f?St():T()}),f?(0,Z.jsx)(I,{size:`sm`,variant:`destructive`,onClick:()=>void m(),disabled:a,children:E()}):null]})]}),s?(0,Z.jsxs)(`div`,{className:`oc-bridgesecret__reveal`,children:[(0,Z.jsx)(`p`,{className:`oc-sa__minted-warning`,children:Oe()}),(0,Z.jsxs)(`div`,{className:`oc-sa__minted-box`,children:[(0,Z.jsx)(`code`,{className:`oc-sa__minted-plain`,children:s}),(0,Z.jsx)(I,{variant:`outline`,size:`sm`,onClick:()=>void h(),children:l?Ke():j()})]}),(0,Z.jsx)(I,{size:`sm`,variant:`ghost`,onClick:()=>{c(null),u(!1)},children:C()})]}):null]})}function ln({instanceId:e,field:t,updatedAt:n}){let r=D(P.instanceSecrets.setInstanceSecret),i=N(P.instanceSecrets.clearInstanceSecret),a=D(P.deviceIdentity.generateDeviceIdentity),o=R(),[s,c]=(0,Y.useState)(``),[l,u]=(0,Y.useState)(!1),[d,p]=(0,Y.useState)(null),[m,h]=(0,Y.useState)(!1),g=n!==null,_=t===`deviceIdentity`,v=t===`token`?Ft():t===`deviceIdentity`?f():Se();async function y(){if(!(!s.trim()||l)){u(!0);try{await r({instanceId:e,field:t,plaintext:s}),c(``),p(null),h(!1),o.success(nt())}catch(e){o.error(M(),e)}finally{u(!1)}}}async function b(){if(!l){u(!0);try{await i({instanceId:e,field:t}),p(null),h(!1),o.success(yt())}catch(e){o.error(M(),e)}finally{u(!1)}}}async function ee(){if(!l){u(!0);try{p(await a({instanceId:e})),h(!1),o.success(Mt())}catch(e){o.error(Je(),e)}finally{u(!1)}}}let x=d?`openclaw devices approve ${d.id}`:``;async function S(){if(x)try{await navigator.clipboard.writeText(x),h(!0)}catch{}}return(0,Z.jsxs)($,{label:v,children:[_?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:Ye()}):null,(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Z.jsx)(z,{variant:g?`outline`:`secondary`,children:g?Lt():O()}),(0,Z.jsx)(G,{type:`password`,autoComplete:`off`,className:`flex-1 min-w-32`,value:s,placeholder:g?Nt():zt(),onChange:e=>c(e.target.value)}),(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(I,{size:`sm`,onClick:()=>void y(),disabled:l||s.trim().length===0,children:Ue()}),_?(0,Z.jsx)(I,{size:`sm`,variant:`outline`,onClick:()=>void ee(),disabled:l,children:et()}):null,g?(0,Z.jsx)(I,{size:`sm`,variant:`destructive`,onClick:()=>void b(),disabled:l,children:tt()}):null]})]}),d?(0,Z.jsxs)(`div`,{className:`oc-bridgesecret__reveal`,children:[(0,Z.jsx)(`p`,{className:`text-sm font-medium`,children:Mt()}),(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:pt()}),(0,Z.jsxs)(`div`,{className:`oc-sa__minted-box`,children:[(0,Z.jsx)(`code`,{className:`oc-sa__minted-plain`,children:x}),(0,Z.jsx)(I,{variant:`outline`,size:`sm`,onClick:()=>void S(),children:m?Ke():j()})]}),(0,Z.jsx)(I,{size:`sm`,variant:`ghost`,onClick:()=>{p(null),h(!1)},children:C()})]}):null]})}var un={conversational:ct,documentary:dt,summarizer:lt,curator:ft},dn={conversational:c,documentary:me,summarizer:l,curator:he},fn=e=>(un[e]??(()=>e))(),pn=e=>(dn[e]??(()=>``))();function mn({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:y()}),t.map(e=>(0,Z.jsx)(z,{variant:`secondary`,className:`oc-agenttype__chip`,title:pn(e),children:fn(e)},e)),(0,Z.jsxs)(Gt,{children:[(0,Z.jsx)(Wt,{asChild:!0,children:(0,Z.jsx)(I,{type:`button`,variant:`outline`,size:`sm`,className:`h-7`,children:_e()})}),(0,Z.jsxs)(Xt,{align:`start`,className:`oc-agenttypes-pop`,children:[(0,Z.jsx)(`p`,{className:`oc-agenttypes-pop__title`,children:fe()}),(0,Z.jsx)(`p`,{className:`oc-agenttypes-pop__hint`,children:ue()}),(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)(Yt,{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:fn(r)}),(0,Z.jsx)(`span`,{className:`oc-agenttypes-pop__desc`,children:pn(r)})]})]},r)})})]})]})]})}function hn({instanceName:e,open:t,onOpenChange:n}){let r=k(P.agents.listAgentsForInstance,t&&e?{instanceName:e}:`skip`),i=N(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=N(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=N(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=tn(r);e.setQuery(P.agents.listAgentsForInstance,{instanceName:t},{...i,agents:i.agents.map(e=>e.agentId===n?{...e,types:a}:e)})}),s=N(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=N(P.agents.removeInstanceAgent),l=Kt(),u=R();async function f(t,n){if(e)try{await i({instanceName:e,agentId:t,enabled:n})}catch(e){u.error(F(),e)}}async function m(t){if(e)try{await a({instanceName:e,agentId:t})}catch(e){u.error(F(),e)}}async function g(t,n,r){if(!e)return;let i=r.includes(n)?r.filter(e=>e!==n):[...r,n];try{await o({instanceName:e,agentId:t,types:i})}catch(e){u.error(F(),e)}}async function v(t,n){if(e&&await l({title:Te({name:n}),description:It(),confirmLabel:p(),destructive:!0}))try{await c({instanceName:e,agentId:t}),u.success(Ce())}catch(e){u.error(F(),e)}}return(0,Z.jsx)(Jt,{open:t,onOpenChange:n,children:(0,Z.jsxs)(K,{className:`oc-access`,children:[(0,Z.jsxs)(U,{children:[(0,Z.jsx)(q,{children:Ae({name:e??``})}),(0,Z.jsx)(J,{children:d()})]}),r===void 0?(0,Z.jsx)(`p`,{className:`oc-access__hint`,children:Rt()}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`div`,{className:`oc-access__poll`,children:r.discovery===null?qe():r.discovery.lastPollOk?Bt():Pt({error:r.discovery.error??`?`})}),r.agents.length===0?(0,Z.jsx)(`p`,{className:`oc-access__hint`,children:We()}):(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)(Yt,{checked:t.enabled,disabled:n,"aria-label":a,onCheckedChange:e=>void f(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,n?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(z,{variant:`outline`,className:`oc-access__gone`,children:rt()}),(0,Z.jsx)(I,{size:`sm`,variant:`ghost`,className:`h-7 text-destructive`,onClick:()=>void v(t.agentId,a),children:_()})]}):i?(0,Z.jsx)(z,{variant:`default`,children:A()}):(0,Z.jsx)(I,{size:`sm`,variant:`outline`,className:`h-7`,disabled:!t.enabled,onClick:()=>void m(t.agentId),children:h()})]}),t.enabled?(0,Z.jsx)(mn,{agentId:t.agentId,types:o,onToggle:e=>void g(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){u.error(F(),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)(G,{className:`oc-agentcard__desc`,value:n,maxLength:280,placeholder:ce(),"aria-label":w(),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{an as InstancesTab};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Bk as r,Gk as i,Gl as a,Hk as o,Ik as s,Jk as c,Jl as l,Kk as u,Kl as d,Lk as f,Ql as p,Rk as m,Uk as h,Vk as g,Wk as _,Wl as v,Xl as y,Yk as b,Yl as x,Zl as S,aV as C,cV as w,qk as T,ql as E,sV as D,t as O,zk as k}from"./api-B1lq0pb-.js";import{t as A}from"./button-Ds98Pj53.js";import{Et as j,jt as M,ut as N}from"./index-DMM3fags.js";var P=t(e(),1),F=n();function I(){let e=w(O.integrations.status.status,{}),t=D(O.admin.setIntegrationConfig),[n,a]=(0,P.useState)(null);if((0,P.useEffect)(()=>{e&&n===null&&a(e.config)},[e,n]),!e||!n)return(0,F.jsx)(`p`,{className:`oc-admin__hint`,children:b()});let l=n,d=(e,t,n)=>a({...l,[e]:{...l[e],[t]:n}}),v=(e,n)=>void t({[e]:n});return(0,F.jsxs)(F.Fragment,{children:[(0,F.jsxs)(`p`,{className:`oc-admin__hint`,children:[c(),` `,(0,F.jsx)(`strong`,{children:T()}),` `,u()]}),(0,F.jsxs)(L,{title:`Langfuse`,status:e.langfuse.configured?e.langfuse.enabled?(0,F.jsx)(j,{variant:`secondary`,children:i()}):(0,F.jsx)(j,{variant:`outline`,children:_()}):(0,F.jsx)(j,{variant:`outline`,children:h()}),note:o(),children:[(0,F.jsx)(R,{label:r(),children:(0,F.jsx)(M,{value:l.langfuse.host??``,placeholder:e.langfuse.effectiveHost,onChange:e=>d(`langfuse`,`host`,e.target.value),onBlur:()=>v(`langfuse`,{host:l.langfuse.host??``})})}),(0,F.jsx)(z,{label:s(),checked:l.langfuse.enabled??!0,onChange:e=>{d(`langfuse`,`enabled`,e),v(`langfuse`,{enabled:e})}})]}),(0,F.jsxs)(L,{title:`Opik`,status:e.opik.configured?e.opik.enabled?(0,F.jsx)(j,{variant:`secondary`,children:i()}):(0,F.jsx)(j,{variant:`outline`,children:_()}):(0,F.jsx)(j,{variant:`outline`,children:h()}),note:g(),children:[(0,F.jsx)(R,{label:k(),children:(0,F.jsx)(M,{value:l.opik.baseUrl??``,placeholder:e.opik.effectiveBaseUrl,onChange:e=>d(`opik`,`baseUrl`,e.target.value),onBlur:()=>v(`opik`,{baseUrl:l.opik.baseUrl??``})})}),(0,F.jsx)(R,{label:m(),children:(0,F.jsx)(M,{value:l.opik.workspace??``,placeholder:e.opik.effectiveWorkspace||f(),onChange:e=>d(`opik`,`workspace`,e.target.value),onBlur:()=>v(`opik`,{workspace:l.opik.workspace??``})})}),(0,F.jsx)(z,{label:s(),checked:l.opik.enabled??!0,onChange:e=>{d(`opik`,`enabled`,e),v(`opik`,{enabled:e})}})]}),(0,F.jsxs)(L,{title:`OpenTelemetry (OTLP)`,status:e.otlp.configured?e.otlp.enabled?(0,F.jsx)(j,{variant:`secondary`,children:i()}):(0,F.jsx)(j,{variant:`outline`,children:_()}):(0,F.jsx)(j,{variant:`outline`,children:p()}),note:S(),children:[(0,F.jsx)(R,{label:y(),children:(0,F.jsx)(M,{value:l.otlp.endpoint??``,placeholder:e.otlp.effectiveEndpoint||`https://otlp.example.com/v1/traces`,onChange:e=>d(`otlp`,`endpoint`,e.target.value),onBlur:()=>v(`otlp`,{endpoint:l.otlp.endpoint??``})})}),(0,F.jsx)(B,{headersSet:e.otlp.headersSet}),(0,F.jsx)(z,{label:s(),checked:l.otlp.enabled??!0,onChange:e=>{d(`otlp`,`enabled`,e),v(`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=C(O.integrations.otlpSecret.setOtlpHeaders),n=D(O.integrations.otlpSecret.clearOtlpHeaders),[r,i]=(0,P.useState)(``),[o,s]=(0,P.useState)(null),[c,u]=(0,P.useState)(!1),f=async()=>{u(!0),s(null);try{await t({headersJson:r}),i(``)}catch(e){s(e instanceof Error?e.message:String(e))}finally{u(!1)}};return(0,F.jsxs)(R,{label:x(),children:[(0,F.jsx)(M,{value:r,placeholder:e?l():E(),onChange:e=>i(e.target.value)}),(0,F.jsxs)(`div`,{className:`oc-int__otlp-headers-actions`,children:[(0,F.jsx)(A,{size:`sm`,disabled:c||r.trim().length===0,onClick:()=>void f(),children:d()}),e?(0,F.jsx)(A,{variant:`ghost`,size:`sm`,disabled:c,onClick:()=>void n({}),children:a()}):null]}),o?(0,F.jsx)(`p`,{className:`oc-int__otlp-headers-error`,children:o}):null,(0,F.jsx)(`p`,{className:`oc-uipa__note`,children:v()})]})}export{I as IntegrationsTab};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{AA as r,CA as i,MA as a,NA as o,SA as s,_b as c,ab as l,cV as u,cb as d,db as f,fb as p,gb as m,hb as h,ij as g,jA as ee,lb as te,mb as _,ob as v,pb as y,sb as b,t as x,ub as S,vb as C,yb as w}from"./api-B1lq0pb-.js";import{Gn as ne,Kn as re,i as ie,o as T,q as E,r as D}from"./index-DMM3fags.js";import{a as O,n as k,o as A,r as j,t as M}from"./card-C2GdBOIp.js";import{n as N,t as P}from"./TimeRangePicker-DOkbYJPt.js";var F=t(e(),1),I={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`},L=Object.keys(I).length,R=n(),z=15,B=e=>String(Math.round(e));function V(){let e=u(x.me.getMe,{host:E})?.permissions?.includes(`traces.read`)??!1,t=u(x.deliveryTiming.listDeliverySessions,e?{}:`skip`),n=(0,F.useMemo)(()=>t?t.filter(e=>!e.active&&e.rollup!==null&&e.rollup.cP50!==null&&e.rollup.aP50!==null).slice(0,z).reverse().map(e=>({startedAt:e.startedAt,cP50:e.rollup?.cP50,aP50:e.rollup?.aP50})):[],[t]);return t===void 0?null:(0,R.jsxs)(`section`,{className:`oc-kpi__group`,children:[(0,R.jsx)(`h2`,{className:`oc-kpi__group-title`,children:g()}),(0,R.jsxs)(M,{children:[(0,R.jsxs)(O,{children:[(0,R.jsx)(A,{children:o()}),(0,R.jsx)(j,{children:ee()})]}),(0,R.jsx)(k,{children:n.length<2?(0,R.jsx)(`p`,{className:`oc-admin__hint`,children:r()}):(0,R.jsx)(H,{series:n})})]})]})}function H({series:e}){let t=e.map(e=>e.cP50),n=e.map(e=>e.aP50),r=Math.max(1,...t,...n),c=t=>6+t*468/(e.length-1),l=e=>74-e*68/r,u=e=>e.map((e,t)=>`${t===0?`M`:`L`}${c(t).toFixed(1)},${l(e).toFixed(1)}`).join(` `),d=e[e.length-1];return(0,R.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,R.jsxs)(`div`,{className:`flex gap-3 text-xs text-muted-foreground`,children:[(0,R.jsxs)(`span`,{style:{color:`var(--primary)`},children:[s(),` p50 `,B(d.cP50),` `,a()]}),(0,R.jsxs)(`span`,{children:[i(),` p50 `,B(d.aP50),` `,a()]})]}),(0,R.jsxs)(`svg`,{viewBox:`0 0 480 80`,className:`h-20 w-full`,preserveAspectRatio:`none`,role:`img`,"aria-label":o(),children:[(0,R.jsx)(`path`,{d:u(n),fill:`none`,style:{stroke:`var(--muted-foreground)`},strokeWidth:1.5}),(0,R.jsx)(`path`,{d:u(t),fill:`none`,style:{stroke:`var(--primary)`},strokeWidth:1.5})]})]})}var U=[{metric:`api.calls`,label:w(),unit:`/h`,group:`API`,isError:!1},{metric:`api.errors`,label:C(),unit:`/h`,group:`API`,isError:!0},{metric:`api.latency.avg_ms`,label:c(),unit:`ms`,group:`API`,isError:!1},{metric:`openclaw.ingest`,label:m(),unit:`/h`,group:`OpenClaw`,isError:!1},{metric:`chat.send`,label:h(),unit:`/h`,group:`Chat`,isError:!1},{metric:I.ASSISTANT_STREAM_ERRORS,label:_(),unit:`/h`,group:`Assistant`,isError:!0},{metric:I.ASSISTANT_ANNOUNCE_ERRORS,label:y(),unit:`/h`,group:`Assistant`,isError:!0}],W=L,G=[`API`,`OpenClaw`,`Chat`,`Assistant`],K=1e3,q=36e5;function J(e,t){let n=Math.max(1,Math.ceil((t-e)/q)),r=Math.min(n*W,K);return{rowLimit:r,buckets:Math.max(1,Math.floor(r/W))}}function Y(){let e=re({from:`/settings/kpi`}),t=ne({from:`/settings/kpi`}),n=ie(e.from,e.to,D,`now`),r=e=>void t({search:t=>({...t,...T(e)})}),{from:i,to:a}=N(n),{rowLimit:o,buckets:s}=J(i,a),c=u(x.kpi.listKpis,{limit:o,filter:{from:i,to:a}}),l=(0,F.useMemo)(()=>{let e=new Map;for(let t of c??[]){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},[c,s]),d=(0,R.jsxs)(R.Fragment,{children:[(0,R.jsxs)(`p`,{className:`oc-admin__hint`,children:[p(),` `,(0,R.jsx)(`span`,{className:`oc-filter__window`,children:f()})]}),(0,R.jsx)(ae,{value:n,onChange:r})]});return c===void 0?(0,R.jsxs)(R.Fragment,{children:[d,(0,R.jsx)(V,{}),(0,R.jsx)(`p`,{className:`oc-admin__hint`,children:S()})]}):c.length===0?(0,R.jsxs)(R.Fragment,{children:[d,(0,R.jsx)(V,{}),(0,R.jsx)(`p`,{className:`oc-admin__hint`,children:te()})]}):(0,R.jsxs)(R.Fragment,{children:[d,(0,R.jsx)(V,{}),G.map(e=>{let t=U.filter(t=>t.group===e);return t.some(e=>(l.get(e.metric)??[]).length>0)?(0,R.jsxs)(`section`,{className:`oc-kpi__group`,children:[(0,R.jsx)(`h2`,{className:`oc-kpi__group-title`,children:e}),(0,R.jsx)(`div`,{className:`oc-kpi__grid`,children:t.map(e=>(0,R.jsx)(oe,{config:e,series:l.get(e.metric)??[]},e.metric))})]},e):null})]})}function ae({value:e,onChange:t}){return(0,R.jsx)(`div`,{className:`oc-kpi__toolbar`,children:(0,R.jsx)(P,{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,R.jsxs)(M,{size:`sm`,className:`oc-kpi__card`,children:[(0,R.jsxs)(O,{children:[(0,R.jsx)(A,{className:`oc-kpi__card-title`,children:e.label}),(0,R.jsx)(j,{className:`oc-kpi__card-metric`,children:(0,R.jsx)(`code`,{children:e.metric})})]}),(0,R.jsxs)(k,{className:`oc-kpi__card-body`,children:[(0,R.jsxs)(`div`,{className:`oc-kpi__value-row`,children:[(0,R.jsx)(`span`,{className:`oc-kpi__value`+(e.isError&&r>0?` oc-kpi__value--error`:``),children:Q(r)}),(0,R.jsx)(`span`,{className:`oc-kpi__unit`,children:e.unit})]}),(0,R.jsx)(ce,{series:t,isError:e.isError,unit:e.unit}),(0,R.jsxs)(`div`,{className:`oc-kpi__axis`,children:[n?(0,R.jsx)(`span`,{className:`oc-kpi__axis-latest`,children:d({value:$(n.bucket)})}):(0,R.jsx)(`span`,{className:`oc-kpi__muted`,children:b()}),(0,R.jsx)(`span`,{className:`oc-kpi__muted`,children:v({count:t.length})})]})]})]})}var X=240,Z=48,se=1;function ce({series:e,isError:t,unit:n}){if(e.length===0)return(0,R.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,R.jsx)(`svg`,{className:`oc-kpi__chart`,viewBox:`0 0 ${X} ${Z}`,preserveAspectRatio:`none`,role:`img`,"aria-label":l({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,R.jsx)(`rect`,{className:`oc-kpi__bar`+(t&&e.value>0?` oc-kpi__bar--error`:``),x:c,y:l,width:a,height:s,children:(0,R.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{Y as KpiTab};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$B as r,$F as i,$n as a,AB as o,AF as s,BB as c,BF as l,CB as u,CF as d,DB as ee,DF as f,EB as te,EF as p,FB as ne,FF as m,GB as re,GF as ie,HB as ae,HF as oe,IB as se,IF as ce,JB as le,JF as ue,Jn as de,KF as fe,LB as pe,LF as me,MB as he,MF as ge,NB as _e,NF as ve,OB as h,OF as g,PB as _,PF as v,QF as y,Qn as b,RB as x,RD as S,RF as C,SB as w,SF as T,TB as E,TF as D,UB as O,UF as k,VB as A,VF as j,WB as M,WF as N,XF as P,Xn as F,YF as ye,Yn as be,ZF as xe,Zn as Se,_F as Ce,bF as we,cV as I,eI as Te,er as Ee,hr as De,jB as Oe,jF as ke,kB as Ae,kF as je,lr as Me,mr as Ne,nI as Pe,qF as Fe,r as L,sV as R,t as z,tI as Ie,tr as Le,vF as Re,wB as ze,wF as B,xF as Be,yF as Ve,zB as He,zF as Ue}from"./api-B1lq0pb-.js";import{t as V}from"./button-Ds98Pj53.js";import{$ as We,At as Ge,Dt as Ke,Et as H,Ot as qe,Q as U,V as Je,X as Ye,Z as Xe,et as Ze,jt as W,kt as Qe,q as G,t as $e,ut as K}from"./index-DMM3fags.js";import{t as et}from"./localePickerView-C2RmOS86.js";import{t as tt}from"./TimezoneCombobox-DeJ3e50i.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:L(`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:L(`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:()=>Pe()},{id:`composer`,label:()=>Ie()},{id:`sidebar`,label:()=>Te()},{id:`notifications`,label:()=>me()},{id:`other`,label:()=>i()}],X={showSource:{category:`messages`,label:()=>y(),help:()=>xe()},showReport:{category:`messages`,label:()=>P(),help:()=>ye()},copyAssistant:{category:`messages`,label:()=>ue()},copyUser:{category:`messages`,label:()=>Fe()},showDelete:{category:`messages`,label:()=>fe()},showTools:{category:`messages`,label:()=>ie(),help:()=>N()},voiceInput:{category:`composer`,label:()=>k(),help:()=>oe()},showUsage:{category:`composer`,label:()=>j(),help:()=>l()},autoReadAloud:{category:`composer`,label:()=>De(),help:()=>Ne()},showChatAge:{category:`sidebar`,label:()=>Ue(),help:()=>C()},notifSound:{category:`notifications`,label:()=>ce(),help:()=>m()},notifSystem:{category:`notifications`,label:()=>v(),help:()=>ve()},replySound:{category:`notifications`,label:()=>ge(),help:()=>ke()}};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:()=>Be()};function ut({prefKey:e,ui:t}){let n=R(z.admin.setUiPrefDefault),r=R(z.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:D()}),(0,J.jsxs)(Ye,{value:ot(t.defaults[e]),onValueChange:t=>void n({key:e,value:st(t)}),children:[(0,J.jsx)(We,{size:`sm`,className:`w-36`,children:(0,J.jsx)(Ze,{})}),(0,J.jsxs)(Xe,{children:[(0,J.jsx)(U,{value:`on`,children:Ve()}),(0,J.jsx)(U,{value:`off`,children:Re()}),(0,J.jsx)(U,{value:`inherit`,children:Ce()})]})]}),i?(0,J.jsxs)(`span`,{className:`oc-prefs__gov-gate`,children:[(0,J.jsx)(K,{checked:t.featuresEnabled[i]===!0,onCheckedChange:e=>void r({key:i,enabled:e===!0}),"aria-label":B()}),B()]}):null]}),a?(0,J.jsx)(`span`,{className:`oc-prefs__gov-help`,children:a}):null]})}function dt({current:e,enabled:t}){let n=R(z.me.setDictationShortcut),[r,i]=(0,q.useState)(!1),[o,s]=(0,q.useState)(!1);return(0,q.useEffect)(()=>{if(!r)return;let e=e=>{if(e.preventDefault(),e.stopPropagation(),e.key===`Escape`){i(!1);return}let t=Qe(e);if(t===null){[`Shift`,`Control`,`Meta`,`Alt`].includes(e.key)||(s(!0),window.setTimeout(()=>s(!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:[Le(),e?(0,J.jsx)(H,{variant:`secondary`,children:Ge(e,qe())}):null]}),(0,J.jsx)(`span`,{className:`oc-prefs__help`,children:o?b():r?a():Ee()})]}),(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:de()}):null,(0,J.jsx)(`button`,{type:`button`,className:`oc-prefs__reset`,disabled:!t,"aria-pressed":r,onClick:()=>i(e=>!e),children:r?be():e?F():Se()})]})]})}function ft(){let[e,t]=(0,q.useState)(``),[n,i]=(0,q.useState)(!1),a=I(z.me.getMe,{host:G}),o=a?.ui,c=$(a?.role)&&n,l=R(z.me.setUiPref).withOptimisticUpdate(Je),u=(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)(K,{checked:n,onCheckedChange:e=>i(e===!0),"aria-label":p()}),p()]}):null,c?(0,J.jsxs)(`div`,{className:`oc-prefs__gov-head`,children:[(0,J.jsx)(`p`,{children:d()}),(0,J.jsx)(`p`,{children:T()}),(0,J.jsx)(`p`,{children:we()})]}):null,(0,J.jsx)(W,{value:e,onChange:e=>t(e.target.value),placeholder:s(),"aria-label":s(),className:`mb-2`}),u.length===0?(0,J.jsx)(`div`,{className:`oc-prefs__empty`,children:je()}):(0,J.jsx)(`div`,{className:`oc-prefs`,children:u.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],s=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)(H,{variant:`outline`,children:g()}):s?(0,J.jsx)(H,{variant:`secondary`,children:Me()}):null]}),r?(0,J.jsx)(`span`,{className:`oc-prefs__help`,children:r}):null]}),(0,J.jsxs)(`div`,{className:`oc-prefs__ctl`,children:[!i&&s?(0,J.jsx)(`button`,{type:`button`,className:`oc-prefs__reset`,onClick:()=>void l({key:e,value:null}),children:f()}):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})]}),c?(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:r()})}var pt={sm:()=>_e(),md:()=>he(),lg:()=>Oe(),xl:()=>o(),"2xl":()=>Ae(),"3xl":()=>h()};function mt(){let e=I(z.me.getMe,{host:G}),t=R(z.me.setLocale),n=R(z.me.setTimezone),r=R(z.me.setFontScale).withOptimisticUpdate((e,{scale:t})=>{let n=e.getQuery(z.me.getMe,{host:G});n&&e.setQuery(z.me.getMe,{host:G},{...n,fontScale:t,resolvedFontScale:t??`md`})}),i=R(z.me.setMyName),a=Ke(),o=e?.locale??`default`,s=e?.name??``,[l,d]=(0,q.useState)(null),f=l??s,p=f.trim()!==s.trim();async function m(){try{await i({name:f}),d(null),a.success(A())}catch(e){a.error(c(),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:re()}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:M()})]}),(0,J.jsxs)(`div`,{className:`oc-show__row`,children:[(0,J.jsx)(W,{className:`max-w-xs`,value:f,maxLength:120,placeholder:O(),onChange:e=>d(e.target.value),onKeyDown:e=>{e.key===`Enter`&&p&&(e.preventDefault(),m())}}),(0,J.jsx)(V,{size:`sm`,disabled:!p,onClick:()=>void m(),children:S()})]}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:ae()})]}),(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:x()})]}),(0,J.jsxs)(`div`,{className:`oc-show__row`,children:[et().map(e=>(0,J.jsx)(V,{variant:o===e.value?`default`:`outline`,size:`sm`,onClick:()=>void t({locale:e.value}),children:e.label},e.value)),(0,J.jsx)(V,{variant:o==="default"?`default`:`outline`,size:`sm`,onClick:()=>void t({locale:null}),children:le()})]}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:pe()})]}),(0,J.jsxs)(`section`,{className:`oc-show__section`,children:[(0,J.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,J.jsx)(`h2`,{className:`oc-show__title`,children:ee()}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:te()})]}),(0,J.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:E()})]}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:ze()})]}),(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:ne()})]}),(0,J.jsx)(`div`,{className:`oc-show__row`,children:$e.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:_()})]}),(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:u()}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:w()})]}),(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{$B as r,$v as i,Bv as a,By as o,Ct as s,Cy as c,D as l,Dy as u,Ey as d,Fv as f,Fy as p,Hv as m,Hy as h,Iv as ee,Iy as g,Jv as te,Lv as ne,Mv as _,My as re,Ny as ie,Pv as ae,Rg as v,Rv as y,St as oe,Ty as se,Uv as ce,Vy as le,Wv as ue,Xv as de,Yv as fe,Zv as pe,_y as me,ay as b,by as x,cV as S,cy as C,dy as he,ey as ge,fy as w,hy as _e,iy as ve,ky as T,ly as ye,my as E,ny as D,oy as be,py as O,ry as xe,sV as k,sy as A,t as j,ty as Se,uy as Ce,vy as we,wy as Te,xy as M,yy as Ee,zv as N}from"./api-B1lq0pb-.js";import{t as De}from"./list-DhABairq.js";import{t as P}from"./button-Ds98Pj53.js";import{A as Oe,An as ke,Bn as Ae,C as je,D as F,Dt as Me,E as Ne,Ft as Pe,Gn as I,Hn as Fe,It as Ie,J as Le,Kn as Re,Lt as ze,Mn as Be,Mt as Ve,Nn as He,Nt as Ue,O as L,P as We,Pn as Ge,Pt as R,S as Ke,Sn as qe,T as Je,Tn as Ye,U as Xe,W as Ze,Y as Qe,_ as $e,b as z,bn as et,d as tt,dn as nt,f as rt,g as B,h as V,j as H,jn as U,jt as W,k as it,kn as G,m as at,p as ot,qn as st,v as K,vn as ct,w as lt,wn as ut,x as q,y as dt,yn as J}from"./index-DMM3fags.js";var ft=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`}]]),pt=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`}]]),mt=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`}]]),Y=l(`panel-left`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M9 3v18`,key:`fh3hqa`}]]),X=t(e(),1),Z=n();function ht({className:e}){return(0,Z.jsx)(ze,{asChild:!0,children:(0,Z.jsx)(P,{variant:`ghost`,size:`icon-xs`,"aria-label":a(),className:e,onClick:e=>e.stopPropagation(),onMouseDown:e=>e.stopPropagation(),onTouchStart:e=>e.stopPropagation(),onPointerDown:e=>e.stopPropagation(),children:(0,Z.jsx)(Ge,{})})})}function Q({folderId:e,name:t,color:n,currentParentId:r,className:i,onOpen:a}){let s=k(j.projects.renameProject),l=k(j.projects.setProjectColor),p=k(j.projects.moveProject),g=k(j.projects.deleteProject),ne=k(j.projects.createProject),_=Xe(),ie=Ze(),[ae,v]=(0,X.useState)(!1),[y,oe]=(0,X.useState)(t),[ue,fe]=(0,X.useState)(!1),[pe,me]=(0,X.useState)(!1),b=S(j.projects.projectTreeCount,pe?{projectId:e}:`skip`);return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(Ve,{onOpenChange:e=>e&&me(!0),children:[(0,Z.jsx)(ht,{className:i}),(0,Z.jsxs)(Ue,{align:`end`,className:`w-48`,onClick:e=>e.stopPropagation(),children:[(0,Z.jsxs)(R,{onSelect:()=>a(),children:[(0,Z.jsx)(U,{}),` `,c()]}),(0,Z.jsxs)(R,{onSelect:()=>{oe(t),v(!0)},children:[(0,Z.jsx)(et,{}),` `,N()]}),(0,Z.jsxs)(R,{onSelect:()=>{requestAnimationFrame(async()=>{let t=await ie({title:E(),label:h(),placeholder:le(),confirmLabel:o()});t&&await ne({name:t,parentId:e})})},children:[(0,Z.jsx)(ke,{}),` `,E()]}),(0,Z.jsxs)(R,{onSelect:()=>fe(!0),children:[(0,Z.jsx)(pt,{}),` `,de()]}),(0,Z.jsx)(Pe,{children:ee()}),(0,Z.jsxs)(`div`,{className:`oc-colorgrid`,onClick:e=>e.stopPropagation(),children:[(0,Z.jsx)(`button`,{className:`oc-colorgrid__none`,onClick:()=>void l({projectId:e,color:null}),"aria-label":f(),children:`✕`}),at.map(t=>(0,Z.jsx)(`button`,{className:`oc-colorgrid__dot`+(n===t.value?` is-selected`:``),style:{background:t.hue},"aria-label":t.value,onClick:()=>void l({projectId:e,color:t.value})},t.value))]}),(0,Z.jsx)(Ie,{}),(0,Z.jsxs)(R,{variant:`destructive`,onSelect:()=>{requestAnimationFrame(async()=>{let n=b?.folders??0,r=b?.chats??0;await _({title:d({name:t}),description:n>0?Te({folders:n,chats:r}):r>0?se({count:r}):ce(),confirmWord:m(),confirmLabel:u(),destructive:!0})&&await g({projectId:e})})},children:[(0,Z.jsx)(nt,{}),` `,m()]})]})]}),(0,Z.jsx)($e,{open:ae,onOpenChange:v,title:re(),canSubmit:y.trim().length>0,onSubmit:async()=>{await s({projectId:e,name:y.trim()}),v(!1)},submitLabel:N(),children:(0,Z.jsx)(W,{value:y,onChange:e=>oe(e.target.value),autoFocus:!0})}),ue?(0,Z.jsx)(ot,{open:ue,onOpenChange:fe,title:te(),movingFolderId:e,currentId:r,onPick:t=>void p({projectId:e,parentId:t})}):null]})}function gt({chat:e,currentFolderId:t,className:n}){let r=k(j.chats.pinChat),i=k(j.chats.deleteChat),a=k(j.chats.renameChat),o=k(j.chats.setChatSidebar),s=k(j.chats.moveChatToProject),c=Xe(),[l,u]=(0,X.useState)(!1),[d,f]=(0,X.useState)(e.title??``),[p,h]=(0,X.useState)(!1);return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(Ve,{children:[(0,Z.jsx)(ht,{className:n}),(0,Z.jsxs)(Ue,{align:`end`,className:`w-52`,onClick:e=>e.stopPropagation(),children:[(0,Z.jsxs)(R,{onSelect:()=>{f(e.title??``),u(!0)},children:[(0,Z.jsx)(et,{}),` `,N()]}),(0,Z.jsxs)(R,{onSelect:()=>void r({chatId:e._id,pinned:!e.pinned}),children:[e.pinned?(0,Z.jsx)(ct,{}):(0,Z.jsx)(J,{}),e.pinned?y():ne()]}),(0,Z.jsxs)(R,{onSelect:()=>h(!0),children:[(0,Z.jsx)(pt,{}),` `,pe()]}),e.pinned&&e.inSidebar?null:(0,Z.jsxs)(R,{onSelect:()=>void o({chatId:e._id,hidden:e.inSidebar}),children:[e.inSidebar?(0,Z.jsx)(qe,{}):(0,Z.jsx)(Y,{}),e.inSidebar?x():M()]}),(0,Z.jsx)(Ie,{}),(0,Z.jsxs)(R,{variant:`destructive`,onSelect:()=>{requestAnimationFrame(async()=>{await c({title:ae(),description:ce(),confirmLabel:m(),destructive:!0})&&await i({chatId:e._id})})},children:[(0,Z.jsx)(nt,{}),` `,m()]})]})]}),(0,Z.jsx)($e,{open:l,onOpenChange:u,title:_(),canSubmit:d.trim().length>0,onSubmit:async()=>{await a({chatId:e._id,title:d.trim()}),u(!1)},submitLabel:N(),children:(0,Z.jsx)(W,{value:d,onChange:e=>f(e.target.value),autoFocus:!0})}),p?(0,Z.jsx)(ot,{open:p,onOpenChange:h,title:fe(),currentId:t,onPick:t=>void s({chatId:e._id,projectId:t})}):null]})}function _t(e,t){let n=t.trim().toLowerCase();return n===``?e:e.filter(e=>(e.title??``).toLowerCase().includes(n))}function vt(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 yt(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 bt=`oc.projpage.view`;function xt(){let e=localStorage.getItem(bt);return e===`cards`||e===`list`?e:`columns`}var $=e=>`into:${e}`,St=e=>`col:${e??`null`}`,Ct=e=>`crumb:${e}`;function wt(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 Tt(){let{projectId:e}=st({from:`/project/$projectId`}),t=I(),n=S(j.projects.projectPage,{projectId:e});return(0,Z.jsx)(`div`,{className:`oc-projpage`,children:n===void 0?(0,Z.jsx)(`p`,{className:`oc-projpage__hint`,children:r()}):n===null?(0,Z.jsxs)(`div`,{className:`oc-projpage__notfound`,children:[(0,Z.jsx)(`h2`,{children:D()}),(0,Z.jsx)(`p`,{className:`oc-projpage__hint`,children:Se()}),(0,Z.jsx)(P,{variant:`outline`,onClick:()=>void t({to:`/`}),children:ge()})]}):(0,Z.jsx)(Et,{page:n})})}function Et({page:e}){let t=I(),n=Xe(),r=Ze(),a=Me(),c=k(j.projects.renameProject),l=k(j.projects.setProjectColor),p=k(j.projects.deleteProject),ne=k(j.projects.createProject),_=k(j.projects.moveProject),ae=k(j.projects.setProjectSidebar),y=k(j.chats.moveChatToProject),fe=k(j.chats.reorderChat),pe=k(j.projects.reorderProject),x=S(j.projects.projectTreeCount,{projectId:e.project._id}),[C,ge]=(0,X.useState)(xt),w=e=>{localStorage.setItem(bt,e),ge(e)},T=S(j.projects.folderColumns,C===`columns`?{projectId:e.project._id}:`skip`),D=S(j.projects.projectTreeList,C===`list`?{projectId:e.project._id}:`skip`),{c:O}=Re({from:`/project/$projectId`}),A=S(j.projects.listProjects,{}),Se=S(j.chatReads.myBusyChats,{}),M=(0,X.useMemo)(()=>new Set(Se??[]),[Se]),Ae=S(j.chatReads.myChatReads,{}),Fe=(0,X.useMemo)(()=>yt(e.chats,Ae??[]),[e.chats,Ae]),{startNewChat:L,picker:qe}=tt(e=>void t({to:`/chat/$chatId`,params:{chatId:e}})),[z,rt]=(0,X.useState)(``),[V,H]=(0,X.useState)(!1),[U,st]=(0,X.useState)(e.project.name),[ct,J]=(0,X.useState)(!1),[Y,ht]=(0,X.useState)(``);(0,X.useEffect)(()=>{let e=setTimeout(()=>ht(z.trim()),180);return()=>clearTimeout(e)},[z]);let Q=S(j.search.searchConversations,Y.length>=2?{query:Y,projectId:e.project._id}:`skip`),gt=Oe(it(lt,{activationConstraint:{distance:4}}),it(Je,{activationConstraint:{delay:250,tolerance:8}})),$=(0,X.useRef)(!1),St=()=>{$.current=!0,setTimeout(()=>{$.current=!1},0)},[Ct,Tt]=(0,X.useState)(null),Et=t=>{if(t.startsWith(`chat:`)){let n=t.slice(5),r=e.chats.find(e=>e._id===n),i=T?.columns.flatMap(e=>e.chats).find(e=>e._id===n);return{kind:`chat`,label:(r??i)?.title||g()}}if(t.startsWith(`folder:`)){let e=t.slice(7);return{kind:`folder`,label:(A??[]).find(t=>t._id===e)?.name??``}}return null},kt=e=>Tt(Et(String(e.active.id))),jt=(0,X.useCallback)(e=>{let t=String(e.active.id).startsWith(`folder:`),n=t=>({...e,droppableContainers:e.droppableContainers.filter(e=>String(e.id).startsWith(t))}),r=F(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=F(n(t?`folder:`:`chat:`));if(i.length>0)return i;let a=F(n(`crumb:`));if(a.length>0)return a;let o=F(n(`col:`));return o.length>0?o:Ne(n(t?`folder:`:`chat:`))},[]),Nt=t=>{if(C===`columns`){for(let e of T?.columns??[])if(e.chats.some(e=>e._id===t))return{list:e.chats,folderId:e.folderId};return null}if(C===`list`){let e=D?.chats.find(e=>e._id===t);return e?{list:D.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},Pt=t=>{if(C===`columns`){for(let e of T?.columns??[])if(e.folders.some(e=>e._id===t))return{list:e.folders,parentId:e.folderId};return null}if(C===`list`){let e=D?.folders.find(e=>e._id===t);if(!e||!D)return null;let n=e.parentId??D.rootId;return{list:Qe(D.folders,e.parentId),parentId:n}}return e.children.some(e=>e._id===t)?{list:e.children,parentId:e.project._id}:null},It=async e=>{Tt(null),St();let{active:t,over:n}=e;if(!n)return;let r=String(n.id),i=String(t.id),o=i.startsWith(`chat:`);try{let e=wt(r);if(e!==void 0){if(o)await y({chatId:i.slice(5),projectId:e});else{let t=i.slice(7);if(t===e)return;if(!Le(A??[],t,e)){a.error(_e());return}await _({projectId:t,parentId:e})}return}if(o&&r.startsWith(`chat:`)){let e=i.slice(5),t=r.slice(5);if(e===t)return;let n=Nt(t);if(!n)return;n.list.some(t=>t._id===e)||await y({chatId:e,projectId:n.folderId});let a=vt(n.list,e=>e._id,e=>e.sortKey,e,t);a&&await fe({chatId:e,...a});return}if(!o&&r.startsWith(`folder:`)){let e=i.slice(7),t=r.slice(7);if(e===t)return;let n=Pt(t);if(!n)return;if(!n.list.some(t=>t._id===e)){if(!Le(A??[],e,n.parentId)){a.error(_e());return}await _({projectId:e,parentId:n.parentId})}let o=vt(n.list,e=>e._id,e=>e.sortKey,e,t);o&&await pe({projectId:e,...o});return}}catch{a.error(_e())}},[,Lt]=(0,X.useState)(0);(0,X.useEffect)(()=>{let e=window.setInterval(()=>Lt(e=>e+1),6e4);return()=>window.clearInterval(e)},[]);let Rt=Date.now(),zt=B(e.project),Bt=_t(e.chats,z),Vt=e.breadcrumb.slice(0,-1),Ht=e=>()=>{$.current||e()};return(0,Z.jsxs)(Ke,{sensors:gt,collisionDetection:jt,onDragStart:kt,onDragEnd:It,children:[(0,Z.jsxs)(`div`,{className:`oc-projpage__body`,style:{"--proj-hue":zt},children:[(0,Z.jsxs)(`nav`,{className:`oc-projpage__crumbs`,"aria-label":i(),children:[Vt.map(e=>(0,Z.jsxs)(`span`,{className:`oc-projpage__crumb`,children:[(0,Z.jsx)(Dt,{folderId:e._id,children:(0,Z.jsx)(`button`,{type:`button`,className:`oc-projpage__crumblink`,onClick:Ht(()=>void t({to:`/project/$projectId`,params:{projectId:e._id}})),children:e.name})}),(0,Z.jsx)(`span`,{className:`oc-projpage__crumbsep`,"aria-hidden":!0,children:`›`})]},e._id)),(0,Z.jsx)(`span`,{className:`oc-projpage__crumbcur`,children:e.project.name})]}),(0,Z.jsxs)(`header`,{className:`oc-projpage__head`,children:[(0,Z.jsx)(`span`,{className:`oc-projpage__dot`,"aria-hidden":!0}),(0,Z.jsx)(`h1`,{className:`oc-projpage__title`,children:e.project.name}),e.project.sidebarHidden?(0,Z.jsxs)(P,{variant:`ghost`,size:`sm`,className:`oc-projpage__hiddenbadge`,title:s(),onClick:()=>{ae({projectId:e.project._id,hidden:!1})},children:[(0,Z.jsx)(He,{"aria-hidden":!0}),(0,Z.jsx)(`span`,{children:oe()}),(0,Z.jsx)(Be,{"aria-hidden":!0})]}):null,(0,Z.jsxs)(`div`,{className:`oc-projpage__actions`,children:[(0,Z.jsxs)(`div`,{className:`oc-projpage__viewtoggle`,role:`group`,"aria-label":Ee(),children:[(0,Z.jsx)(P,{variant:C===`cards`?`secondary`:`ghost`,size:`icon-sm`,"aria-label":Ee(),title:Ee(),"aria-pressed":C===`cards`,onClick:()=>w(`cards`),children:(0,Z.jsx)(mt,{})}),(0,Z.jsx)(P,{variant:C===`columns`?`secondary`:`ghost`,size:`icon-sm`,"aria-label":we(),title:we(),"aria-pressed":C===`columns`,onClick:()=>w(`columns`),children:(0,Z.jsx)(ft,{})}),(0,Z.jsx)(P,{variant:C===`list`?`secondary`:`ghost`,size:`icon-sm`,"aria-label":me(),title:me(),"aria-pressed":C===`list`,onClick:()=>w(`list`),children:(0,Z.jsx)(De,{})})]}),(0,Z.jsxs)(P,{variant:`outline`,size:`sm`,onClick:()=>void L({projectId:e.project._id}),children:[(0,Z.jsx)(Ye,{}),ye()]}),(0,Z.jsxs)(P,{variant:`outline`,size:`sm`,onClick:async()=>{let t=await r({title:E(),label:h(),placeholder:le(),confirmLabel:o()});t&&await ne({name:t,parentId:e.project._id})},children:[(0,Z.jsx)(ke,{}),E()]}),(0,Z.jsxs)(Ve,{children:[(0,Z.jsx)(ze,{asChild:!0,children:(0,Z.jsx)(P,{variant:`ghost`,size:`icon-sm`,"aria-label":ie(),children:(0,Z.jsx)(Ge,{})})}),(0,Z.jsxs)(Ue,{align:`end`,className:`w-48`,children:[(0,Z.jsxs)(R,{onSelect:()=>{st(e.project.name),H(!0)},children:[(0,Z.jsx)(et,{}),` `,N()]}),(0,Z.jsxs)(R,{onSelect:()=>J(!0),children:[(0,Z.jsx)(pt,{}),` `,de()]}),(0,Z.jsx)(Pe,{children:ee()}),(0,Z.jsxs)(`div`,{className:`oc-colorgrid`,children:[(0,Z.jsx)(`button`,{className:`oc-colorgrid__none`,onClick:()=>void l({projectId:e.project._id,color:null}),"aria-label":f(),children:`✕`}),at.map(t=>(0,Z.jsx)(`button`,{className:`oc-colorgrid__dot`+(e.project.color===t.value?` is-selected`:``),style:{background:t.hue},"aria-label":t.value,onClick:()=>void l({projectId:e.project._id,color:t.value})},t.value))]}),(0,Z.jsx)(Ie,{}),(0,Z.jsxs)(R,{variant:`destructive`,onSelect:()=>{let r=e.project.parentId;requestAnimationFrame(async()=>{let i=x?.folders??0,a=x?.chats??0;await n({title:d({name:e.project.name}),description:i>0?Te({folders:i,chats:a}):a>0?se({count:a}):ce(),confirmWord:m(),confirmLabel:u(),destructive:!0})&&(await p({projectId:e.project._id}),t(r===null?{to:`/`}:{to:`/project/$projectId`,params:{projectId:r}}))})},children:[(0,Z.jsx)(nt,{}),` `,m()]})]})]})]})]}),C===`columns`?(0,Z.jsx)(Ft,{data:T,currentId:e.project._id,busyIds:M,suppressClick:$,locateChatId:O??null}):C===`list`?(0,Z.jsx)(Mt,{data:D,busyIds:M,suppressClick:$,locateChatId:O??null}):(0,Z.jsxs)(Z.Fragment,{children:[e.children.length>0?(0,Z.jsxs)(`section`,{className:`oc-projpage__section`,children:[(0,Z.jsx)(`h2`,{className:`oc-projpage__subtitle`,children:he()}),(0,Z.jsx)(`div`,{className:`oc-projpage__cards`,children:(0,Z.jsx)(K,{items:e.children.map(e=>`folder:${e._id}`),strategy:dt,children:e.children.map(t=>(0,Z.jsx)(Ot,{child:t,parentId:e.project._id,now:Rt,suppressClick:$},t._id))})})]}):null,(0,Z.jsxs)(`section`,{className:`oc-projpage__section`,children:[(0,Z.jsxs)(`div`,{className:`oc-projpage__convhead`,children:[(0,Z.jsx)(`h2`,{className:`oc-projpage__subtitle`,children:Ce()}),e.chats.length>0?(0,Z.jsx)(W,{value:z,onChange:e=>rt(e.target.value),placeholder:be(),className:`oc-projpage__filter`}):null]}),e.chats.length===0?(0,Z.jsx)(`p`,{className:`oc-projpage__hint`,children:e.children.length===0?ve():xe()}):Bt.length===0&&(Q??[]).length===0?(0,Z.jsx)(`p`,{className:`oc-projpage__hint`,children:b({term:z.trim()})}):(0,Z.jsx)(`ul`,{className:`oc-projpage__chats`,children:(0,Z.jsx)(K,{items:Bt.map(e=>`chat:${e._id}`),strategy:q,children:Bt.map(t=>(0,Z.jsx)(At,{chat:t,currentFolderId:e.project._id,now:Rt,busy:M.has(t._id),unread:Fe.has(t._id),locate:t._id===O,suppressClick:$},t._id))})})]}),Y.length>=2&&Q!==void 0?(0,Z.jsxs)(`section`,{className:`oc-projpage__section`,children:[(0,Z.jsx)(`h2`,{className:`oc-projpage__subtitle`,children:ue()}),Q.length===0?(0,Z.jsx)(`p`,{className:`oc-projpage__hint`,children:b({term:Y})}):(0,Z.jsx)(`ul`,{className:`oc-projpage__chats`,children:Q.map(e=>(0,Z.jsx)(`li`,{className:`oc-projpage__chatrow`,children:(0,Z.jsxs)(`button`,{type:`button`,className:`oc-projpage__chatbtn`,onClick:()=>{e.messageId&&Y&&We(e.messageId,Y),t({to:`/chat/$chatId`,params:{chatId:e.chatId},...e.messageId?{search:{m:e.messageId}}:{}})},children:[(0,Z.jsx)(ut,{size:13,"aria-hidden":!0,className:`oc-projpage__hitico`}),(0,Z.jsxs)(`span`,{className:`oc-projpage__hitbody`,children:[(0,Z.jsx)(`span`,{className:`oc-projpage__chattitle`,children:e.title||v()}),e.projectPath&&e.projectPath.length>1?(0,Z.jsx)(`span`,{className:`oc-projpage__hitpath`,children:e.projectPath.join(` › `)}):null,e.snippet?(0,Z.jsx)(`span`,{className:`oc-projpage__hitsnippet`,children:e.snippet}):null]})]})},`${e.chatId}:${e.messageId??`t`}`))})]}):null]}),(0,Z.jsx)($e,{open:V,onOpenChange:H,title:re(),canSubmit:U.trim().length>0,onSubmit:async()=>{await c({projectId:e.project._id,name:U.trim()}),H(!1)},submitLabel:N(),children:(0,Z.jsx)(W,{value:U,onChange:e=>st(e.target.value),autoFocus:!0})}),ct?(0,Z.jsx)(ot,{open:ct,onOpenChange:J,title:te(),movingFolderId:e.project._id,currentId:e.project.parentId,onPick:t=>void _({projectId:e.project._id,parentId:t})}):null,qe]}),(0,Z.jsx)(je,{children:Ct?(0,Z.jsxs)(`div`,{className:`oc-projpage__dragghost`,children:[Ct.kind===`folder`?(0,Z.jsx)(G,{size:13,"aria-hidden":!0}):(0,Z.jsx)(ut,{size:13,"aria-hidden":!0}),(0,Z.jsx)(`span`,{children:Ct.label})]}):null})]})}function Dt({folderId:e,children:t}){let{setNodeRef:n,isOver:r}=L({id:Ct(e)});return(0,Z.jsx)(`span`,{ref:n,className:r?`oc-projpage__cdrop is-over`:`oc-projpage__cdrop`,children:t})}function Ot({child:e,parentId:t,now:n,suppressClick:r}){let i=I(),a=z({id:`folder:${e._id}`}),o=L({id:$(e._id)});return(0,Z.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":B(e),transform:H.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,Z.jsxs)(`span`,{className:`oc-projpage__cardhead`,children:[(0,Z.jsx)(G,{size:15,"aria-hidden":!0,className:`oc-projpage__cardico`}),(0,Z.jsx)(`span`,{className:`oc-projpage__cardname`,children:e.name}),(0,Z.jsx)(Q,{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,Z.jsxs)(`span`,{className:`oc-projpage__cardmeta`,children:[e.folderCount>0?C({count:e.folderCount})+` · `:``,A({count:e.recursiveChatCount})]}),e.lastActivityAt===null?null:(0,Z.jsx)(`span`,{className:`oc-projpage__cardage`,children:rt(e.lastActivityAt,n)})]})}function kt({chat:e}){let t=k(j.chats.setChatSidebar),n=e.inSidebar?x():M();return(0,Z.jsx)(P,{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,Z.jsx)(qe,{}):(0,Z.jsx)(Y,{})})}function At({chat:e,currentFolderId:t,now:n,busy:r,unread:i,locate:a,suppressClick:o}){let s=I(),c=V(e.color),l=z({id:`chat:${e._id}`}),u=jt(a);return(0,Z.jsxs)(`li`,{ref:e=>{l.setNodeRef(e),u.current=e},className:`oc-projpage__chatrow`+(l.isDragging?` is-dragging`:``)+(a?` is-locate`:``),style:{transform:H.Transform.toString(l.transform),transition:l.transition},children:[(0,Z.jsxs)(`button`,{type:`button`,className:`oc-projpage__chatbtn`,onClick:()=>{o.current||s({to:`/chat/$chatId`,params:{chatId:e._id}})},...l.listeners,...l.attributes,children:[c?(0,Z.jsx)(`span`,{className:`oc-chatitem__dot`,style:{background:c}}):(0,Z.jsx)(`span`,{className:`oc-chatitem__dot oc-chatitem__dot--empty`}),(0,Z.jsx)(`span`,{className:`oc-projpage__chattitle`,children:e.title||g()}),e.pinned?(0,Z.jsx)(J,{size:12,"aria-hidden":!0,className:`oc-projpage__chatpin`}):null,(0,Z.jsx)(`span`,{className:`oc-projpage__chatage`,children:rt(e.updatedAt,n)}),r?(0,Z.jsx)(`span`,{className:`oc-chatitem__busy`,title:p(),"aria-label":p()}):null,i&&!r?(0,Z.jsx)(`span`,{className:`oc-chatitem__unread`,title:T(),"aria-label":T()}):null]}),(0,Z.jsx)(kt,{chat:e}),(0,Z.jsx)(gt,{chat:e,currentFolderId:t,className:`oc-projpage__chatmenu`})]})}function jt(e){let t=(0,X.useRef)(null);return(0,X.useEffect)(()=>{e&&t.current&&t.current.scrollIntoView({block:`center`})},[e]),t}function Mt({data:e,busyIds:t,suppressClick:n,locateChatId:i}){let[a,o]=(0,X.useState)(new Set),s=(0,X.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,Z.jsx)(`p`,{className:`oc-projpage__hint`,children:r()});if(e===null)return null;let c=e=>o(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n}),l=(r,o)=>{let u=s.get(r??e.rootId)??[],d=Qe(e.folders,r);return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(K,{items:u.map(e=>`chat:${e._id}`),strategy:q,children:u.map(e=>(0,Z.jsx)(Pt,{chat:e,depth:o,busy:t.has(e._id),locate:e._id===i,suppressClick:n},e._id))}),(0,Z.jsx)(K,{items:d.map(e=>`folder:${e._id}`),strategy:q,children:d.map(t=>(0,Z.jsx)(Nt,{folder:t,parentId:r??e.rootId,depth:o,folded:a.has(t._id),onToggle:()=>c(t._id),suppressClick:n,children:a.has(t._id)?null:l(t._id,o+1)},t._id))})]})};return(0,Z.jsx)(`div`,{className:`oc-projpage__tree`,children:(s.get(e.rootId)??[]).length===0&&Qe(e.folders,null).length===0?(0,Z.jsx)(`p`,{className:`oc-projpage__hint`,children:ve()}):l(null,0)})}function Nt({folder:e,parentId:t,depth:n,folded:r,onToggle:i,suppressClick:a,children:o}){let s=I(),c=z({id:`folder:${e._id}`}),l=L({id:$(e._id)});return(0,Z.jsxs)(`div`,{className:`oc-projpage__treegroup`,children:[(0,Z.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":B(e),transform:H.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,Z.jsx)(`button`,{type:`button`,className:`oc-projpage__treechev`,"aria-label":r?O():w(),"aria-expanded":!r,onClick:e=>{e.stopPropagation(),!a.current&&i()},onMouseDown:e=>e.stopPropagation(),onTouchStart:e=>e.stopPropagation(),children:r?(0,Z.jsx)(Ae,{size:13}):(0,Z.jsx)(Fe,{size:13})}),(0,Z.jsx)(G,{size:13,"aria-hidden":!0,className:`oc-projpage__colico`}),(0,Z.jsx)(`span`,{className:`oc-projpage__colname`,children:e.name}),(0,Z.jsx)(Q,{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 Pt({chat:e,depth:t,busy:n,locate:r,suppressClick:i}){let a=I(),o=z({id:`chat:${e._id}`}),s=jt(r),c=V(e.color);return(0,Z.jsxs)(`div`,{ref:e=>{o.setNodeRef(e),s.current=e},className:`oc-projpage__treerow oc-projpage__treerow--chat`+(o.isDragging?` is-dragging`:``)+(r?` is-locate`:``),style:{"--tree-depth":t,transform:H.Transform.toString(o.transform),transition:o.transition},children:[(0,Z.jsxs)(`button`,{type:`button`,className:`oc-projpage__colchatbtn`,onClick:()=>{i.current||a({to:`/chat/$chatId`,params:{chatId:e._id}})},...o.listeners,...o.attributes,children:[c?(0,Z.jsx)(`span`,{className:`oc-chatitem__dot`,style:{background:c}}):(0,Z.jsx)(`span`,{className:`oc-chatitem__dot oc-chatitem__dot--empty`}),(0,Z.jsx)(`span`,{className:`oc-projpage__colname`,children:e.title||g()}),n?(0,Z.jsx)(`span`,{className:`oc-chatitem__busy`,"aria-hidden":!0}):null]}),(0,Z.jsx)(gt,{chat:e,currentFolderId:e.folderId,className:`oc-projpage__treemenu`}),(0,Z.jsx)(kt,{chat:e})]})}function Ft({data:e,currentId:t,busyIds:n,suppressClick:i,locateChatId:a}){let o=(0,X.useRef)(null);return(0,X.useEffect)(()=>{let e=o.current;e&&(e.scrollLeft=e.scrollWidth)},[e?.columns.length??0,t]),e===void 0?(0,Z.jsx)(`p`,{className:`oc-projpage__hint`,children:r()}):(0,Z.jsx)(`div`,{className:`oc-projpage__cols`,ref:o,children:e.columns.map((r,o)=>(0,Z.jsx)(It,{col:r,isLast:o===e.columns.length-1,currentId:t,busyIds:n,suppressClick:i,locateChatId:a},r.folderId??`root`))})}function It({col:e,isLast:t,currentId:n,busyIds:r,suppressClick:i,locateChatId:a}){let o=I(),s=L({id:St(e.folderId)});return(0,Z.jsxs)(`div`,{ref:s.setNodeRef,className:`oc-projpage__col`+(s.isOver?` is-over`:``)+(t?` is-last`:``),children:[(0,Z.jsx)(K,{items:e.folders.map(e=>`folder:${e._id}`),strategy:q,children:e.folders.map(t=>(0,Z.jsx)(Lt,{folder:t,parentId:e.folderId,isCurrent:t._id===n,suppressClick:i,onOpen:()=>void o({to:`/project/$projectId`,params:{projectId:t._id}})},t._id))}),(0,Z.jsx)(K,{items:e.chats.map(e=>`chat:${e._id}`),strategy:q,children:e.chats.map(t=>(0,Z.jsx)(Rt,{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,Z.jsx)(`p`,{className:`oc-projpage__colempty`,children:xe()}):null]})}function Lt({folder:e,parentId:t,isCurrent:n,suppressClick:r,onOpen:i}){let a=z({id:`folder:${e._id}`}),o=L({id:$(e._id)});return(0,Z.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":B(e),transform:H.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,Z.jsx)(G,{size:13,"aria-hidden":!0,className:`oc-projpage__colico`}),(0,Z.jsx)(`span`,{className:`oc-projpage__colname`,children:e.name}),(0,Z.jsx)(`span`,{className:`oc-projpage__colchev`,"aria-hidden":!0,children:`›`}),(0,Z.jsx)(Q,{folderId:e._id,name:e.name,color:e.color,currentParentId:t,className:`oc-projpage__colmenu`,onOpen:i})]})}function Rt({chat:e,folderId:t,busy:n,locate:r,suppressClick:i,onOpen:a}){let o=z({id:`chat:${e._id}`}),s=jt(r),c=V(e.color);return(0,Z.jsxs)(`div`,{ref:e=>{o.setNodeRef(e),s.current=e},className:`oc-projpage__colentry oc-projpage__colentry--chat`+(o.isDragging?` is-dragging`:``)+(r?` is-locate`:``),style:{transform:H.Transform.toString(o.transform),transition:o.transition},children:[(0,Z.jsxs)(`button`,{type:`button`,className:`oc-projpage__colchatbtn`,onClick:()=>{i.current||a()},...o.listeners,...o.attributes,children:[c?(0,Z.jsx)(`span`,{className:`oc-chatitem__dot`,style:{background:c}}):(0,Z.jsx)(`span`,{className:`oc-chatitem__dot oc-chatitem__dot--empty`}),(0,Z.jsx)(`span`,{className:`oc-projpage__colname`,children:e.title||g()}),n?(0,Z.jsx)(`span`,{className:`oc-chatitem__busy`,"aria-hidden":!0}):null]}),(0,Z.jsx)(gt,{chat:e,currentFolderId:t,className:`oc-projpage__colmenu oc-projpage__colmenu--chat`}),(0,Z.jsx)(kt,{chat:e})]})}export{Tt as ProjectPage};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Bx as r,Fc as i,Fo as a,Fx as o,Go as s,Gx as c,Hx as l,Ic as u,Io as d,Ix as f,Jx as p,Ko as m,Kx as h,Lx as g,Mc as
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Bx as r,Fc as i,Fo as a,Fx as o,Go as s,Gx as c,Hx as l,Ic as u,Io as d,Ix as f,Jx as p,Ko as m,Kx as h,Lx as g,Mc as ee,Mo as te,Nc as ne,No as _,Nx as v,Pc as y,Po as b,Px as x,Qx as S,Rx as C,Uo as w,Ux as T,Vx as re,Wo as ie,Wx as ae,Xx as oe,Yx as E,Zx as D,aS as O,cV as k,ia as A,na as j,oS as M,qx as N,ra as P,sV as F,t as I,yt as L,zx as R}from"./api-B1lq0pb-.js";import{i as z,n as B,r as V,t as H}from"./FieldLabel-4AzJbj-7.js";import{t as U}from"./button-Ds98Pj53.js";import{$ as W,Dt as se,Q as G,Qt as K,X as q,Xt as ce,Yt as J,Z as Y,Zt as le,et as X,q as ue,ut as de}from"./index-DMM3fags.js";import{r as Z,t as fe}from"./locales-CPjguROj.js";import{t as pe}from"./localePickerView-C2RmOS86.js";/* empty css */var Q=t(e(),1),$=n(),me={media_delivery:{label:N,help:h},documentary_fetch:{label:c,help:ae},inbound_files:{label:T,help:l},history_summary:{label:u,help:i},file_curation:{label:m,help:d},quote_reply:{label:s,help:ie}},he={outboundDir:`/home/node/.openclaw/media/outbound`,references:`- gdrive/1a2b3c4d5e6f7890abcd
|
|
2
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
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:
|
|
4
|
+
- [Fait 1](fait-1.md) - note du projet`,excerpt:`Le classement propose trois dossiers : Clients, Fournisseurs, Interne.`},ge={outboundDir:o,references:x,files:v,previous_summary:y,new_messages:ne,max_chars:ee,file_name:a,budget_chars:b,feedback:_,content:te,excerpt:w};function _e(){let e=k(I.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:r()})});let i=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)(B,{label:S(),help:D()}),(0,$.jsxs)(`label`,{className:`oc-injtab__picker`,children:[(0,$.jsx)(`span`,{children:re()}),(0,$.jsxs)(q,{value:i._id,onValueChange:e=>n(e),children:[(0,$.jsx)(W,{size:`sm`,className:`min-w-44`,children:(0,$.jsx)(X,{})}),(0,$.jsx)(Y,{children:e.map(e=>(0,$.jsx)(G,{value:e._id,children:e.displayName??e.name},e._id))})]})]})]}),(0,$.jsx)(ve,{instance:i},i._id)]})}function ve({instance:e}){let t=F(I.admin.upsertInstanceConfig),n=se(),r=k(I.me.getMe,{host:ue}),i=e.config??{},a=Z(e.config?.contentLocale,r?.defaultLocale??void 0),[o,s]=(0,Q.useState)(()=>z(i,a));(0,Q.useEffect)(()=>{s(z(i,a))},[a,e._id]);let[c,l]=(0,Q.useState)(!1),u=o.promptInjections,d=(e,t)=>s({...o,promptInjections:{...u,[e]:{...u[e],...t}}});async function f(){l(!0);try{await t({instanceId:e._id,config:V(o,i,a)})}catch(e){n.error(O(),e)}finally{l(!1)}}async function p(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(O(),e)}}let m=e.config?.contentLocale??`default`,h=fe[Z(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:A()}),(0,$.jsxs)(q,{value:m,onValueChange:e=>void p(e),children:[(0,$.jsx)(W,{size:`sm`,className:`min-w-44`,children:(0,$.jsx)(X,{})}),(0,$.jsxs)(Y,{children:[(0,$.jsx)(G,{value:`default`,children:j({locale:h})}),pe().map(e=>(0,$.jsx)(G,{value:e.value,children:e.label},e.value))]})]}),(0,$.jsx)(`p`,{className:`oc-admin__hint`,children:P()})]}),ce.map(e=>(0,$.jsx)(ye,{injKey:e,def:J[e],i18n:me[e],row:u[e]??{enabled:!0,template:J[e].defaultTemplate[a]},contentLocale:a,onChange:t=>d(e,t)},e)),(0,$.jsx)(`div`,{className:`oc-injtab__actions`,children:(0,$.jsx)(U,{size:`sm`,onClick:()=>void f(),disabled:c,children:M()})})]})}function ye({injKey:e,def:t,i18n:n,row:r,contentLocale:i,onChange:a}){let[o,s]=(0,Q.useState)(!1),c=r.template.trim()!==t.defaultTemplate[i],l=t.togglable&&!r.enabled,u=Object.fromEntries(t.placeholders.map(e=>[e,he[e]??`{${e}}`])),d=le(e,r,i),m=d?K(d,u):``;return(0,$.jsxs)(`section`,{className:`oc-injcard`,children:[(0,$.jsxs)(`div`,{className:`oc-injcard__head`,children:[t.togglable?(0,$.jsxs)(`label`,{className:`oc-field--row`,children:[(0,$.jsx)(de,{checked:r.enabled,onCheckedChange:e=>a({enabled:e===!0})}),(0,$.jsx)(B,{label:n.label(),help:n.help()})]}):(0,$.jsx)(B,{label:n.label(),help:n.help()}),c&&(0,$.jsx)(`span`,{className:`oc-injection__badge`,children:E()})]}),(0,$.jsx)(`textarea`,{className:`oc-injcard__text`,value:r.template,disabled:l,rows:8,spellCheck:!1,onChange:e=>a({template:e.target.value})}),(0,$.jsxs)(`div`,{className:`oc-injection__foot`,children:[(0,$.jsxs)(`div`,{className:`oc-injcard__phs`,children:[(0,$.jsx)(`span`,{className:`oc-injection__ph`,children:p()}),t.placeholders.map(e=>(0,$.jsxs)(`span`,{className:`oc-injcard__ph-chip`,children:[(0,$.jsx)(`code`,{children:`{${e}}`}),(0,$.jsx)(H,{text:(ge[e]??(()=>e))()})]},e))]}),(0,$.jsxs)(`div`,{className:`oc-injcard__btns`,children:[(0,$.jsx)(U,{variant:`ghost`,size:`sm`,onClick:()=>s(e=>!e),children:o?C():R()}),c&&(0,$.jsx)(U,{variant:`ghost`,size:`sm`,onClick:()=>a({template:t.defaultTemplate[i]}),children:oe()})]})]}),o&&(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:g()}),t.pluralDefaultTemplate!==void 0&&!l?(0,$.jsx)(`span`,{className:`oc-injection__ph`,children:L()}):null]}):(0,$.jsx)(`span`,{className:`oc-injection__ph`,children:f()})})]})}export{_e as PromptInjectionsTab};
|