@lacneu/atrium 0.51.0 → 0.53.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/{AccessTab-BTTUfIwc.js → AccessTab-Cn6aTLCf.js} +1 -1
- package/dist/assets/{AdvancedFilter-BQlL-4N9.js → AdvancedFilter-DZQYmNs4.js} +1 -1
- package/dist/assets/AgentFilesTab-wMbDFxg-.js +3 -0
- package/dist/assets/{AnomaliesTab-Cs6vlfDv.js → AnomaliesTab-9duGclN8.js} +1 -1
- package/dist/assets/{AuditTab-BOu6pgTB.js → AuditTab-DQ3CPLd8.js} +1 -1
- package/dist/assets/BridgeTab-CHJ9g4oG.js +1 -0
- package/dist/assets/{ChatDefaultsTab-DkHZTknY.js → ChatDefaultsTab-DmEqCE-W.js} +1 -1
- package/dist/assets/{DataTableShell-KGrtOG5M.js → DataTableShell-CuO0YQq6.js} +1 -1
- package/dist/assets/{DetailChips-C2LFFpNg.js → DetailChips-Dej1ecl_.js} +1 -1
- package/dist/assets/FeedbacksTab-DC_eAajb.js +1 -0
- package/dist/assets/{FieldLabel-CKVYl95W.js → FieldLabel-u_jnizyn.js} +1 -1
- package/dist/assets/FilesTab-Bn3BRWTR.js +1 -0
- package/dist/assets/{FilterBar-BVVVO1_O.js → FilterBar-DEFwQ8Ux.js} +1 -1
- package/dist/assets/GroupsTab-BRowxUjZ.js +1 -0
- package/dist/assets/InstancesTab-DG51Ue86.js +1 -0
- package/dist/assets/IntegrationsTab-BJ2UqtrD.js +1 -0
- package/dist/assets/KpiTab-CAmPWeiR.js +1 -0
- package/dist/assets/PreferencesTab-nCP24hEr.js +1 -0
- package/dist/assets/{PromptInjectionsTab-CgAFhOn5.js → PromptInjectionsTab-DEsbiQR6.js} +2 -2
- package/dist/assets/RolesTab-OzghlhMZ.js +1 -0
- package/dist/assets/ServiceAccountsTab-BLIGxxHB.js +1 -0
- package/dist/assets/{SubAgentReportsTab-G_s4_aPf.js → SubAgentReportsTab-CIXPhq-N.js} +1 -1
- package/dist/assets/ThemeShowroom-CPXMV1GL.js +1 -0
- package/dist/assets/{TimeRangePicker-NSOkx3C0.js → TimeRangePicker-CcvYUnNz.js} +1 -1
- package/dist/assets/TracesTab-BdT3C7zi.js +1 -0
- package/dist/assets/UsersTab-DdhLaysX.js +1 -0
- package/dist/assets/VoiceTab-Dc6VJT9k.js +1 -0
- package/dist/assets/{button-b04wLuGq.js → button-BC70Om4X.js} +1 -1
- package/dist/assets/{card-DdBF2ct9.js → card-BOwxTL3L.js} +1 -1
- package/dist/assets/chevrons-up-down-BvfCZOnB.js +1 -0
- package/dist/assets/compatView-CrOWHm6W.js +1 -0
- package/dist/assets/{dispatchErrorInfo-Cs8_1qCQ.js → dispatchErrorInfo-DsOn5G3U.js} +1 -1
- package/dist/assets/{dist-6oi7FQ0i.js → dist-B0WeNmZI.js} +1 -1
- package/dist/assets/dist-CHawRMT8.js +44 -0
- package/dist/assets/{dist-CtUr3P8h.js → dist-DhsERHU0.js} +1 -1
- package/dist/assets/{dist-DBet7oNc.js → dist-bebyRR79.js} +1 -1
- package/dist/assets/{highlighted-body-OFNGDK62-BOjjbbd6.js → highlighted-body-OFNGDK62-C9Z0pQXP.js} +1 -1
- package/dist/assets/index-C4W6RiZP.js +238 -0
- package/dist/assets/{index-CBZrw7d-.css → index-Civ1kInZ.css} +1 -1
- package/dist/assets/mermaid-GHXKKRXX-BMxCoLiw.js +1 -0
- package/dist/assets/{pdf-D7AA0FY6.js → pdf-BIF30kt5.js} +1 -1
- package/dist/assets/roleDescriptions-CSRZrtA-.js +1 -0
- package/dist/assets/{table-CtNwimV_.js → table-poMaV2RU.js} +1 -1
- package/dist/assets/{tabs-BJyz65LR.js → tabs-CYZIFsUm.js} +1 -1
- package/dist/assets/x-B5cgu3rn.js +1 -0
- package/dist/index.html +8 -8
- package/package.json +1 -1
- package/dist/assets/AgentFilesTab-By3Jzopm.js +0 -3
- package/dist/assets/BridgeTab-DFpunFsv.js +0 -1
- package/dist/assets/FeedbacksTab-D34MEu6C.js +0 -1
- package/dist/assets/FilesTab-ByKXXey8.js +0 -1
- package/dist/assets/GroupsTab-CJUI6gQ9.js +0 -1
- package/dist/assets/InstancesTab-Cb_2msXj.js +0 -1
- package/dist/assets/IntegrationsTab-B9Nkc7-l.js +0 -1
- package/dist/assets/KpiTab-B6SqslSj.js +0 -1
- package/dist/assets/PreferencesTab-BdvOFp2E.js +0 -1
- package/dist/assets/RolesTab-CtV113pW.js +0 -1
- package/dist/assets/ServiceAccountsTab-Bu_j0kUL.js +0 -1
- package/dist/assets/ThemeShowroom-CbU-xJra.js +0 -1
- package/dist/assets/TracesTab-Wo-rxO1v.js +0 -1
- package/dist/assets/UsersTab-DO7Wa8iJ.js +0 -1
- package/dist/assets/VoiceTab-ilUT53Ds.js +0 -1
- package/dist/assets/chevrons-up-down-Kyw8BbOf.js +0 -1
- package/dist/assets/compatView-S4X8HKXY.js +0 -1
- package/dist/assets/dist-HBBi9Y25.js +0 -44
- package/dist/assets/index-DBQ43N4_.js +0 -238
- package/dist/assets/mermaid-GHXKKRXX-CXCdU_oF.js +0 -1
- package/dist/assets/roleDescriptions-onSlZ7A3.js +0 -1
- package/dist/assets/x-DBKGK4o_.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{E as r,
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{E as r,SM as i,_d as a,ad as o,cd as s,dd as c,fd as l,gd as u,hd as d,id as f,jM as p,ld as m,md as h,od as g,pd as _,rd as v,sd as y,ud as b}from"./dist-CHawRMT8.js";import{C as x,S,b as C,ct as w,w as T,x as E}from"./index-C4W6RiZP.js";var D=t(e(),1);function O(e){return e===`user`?y():e===`all`?g():o({group:e.group})}function k(e){return e===`common`?f():e===`owner`?v():o({group:e.group})}var A=n();function j(e){return e.name||e.email||e.userId.slice(0,8)}function M(){let e=p(r.admin.listUsers,{}),[t,n]=(0,D.useState)(``),o=p(r.introspect.introspectUser,t?{userId:t}:`skip`);return(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:a()}),(0,A.jsxs)(C,{value:t,onValueChange:n,children:[(0,A.jsx)(x,{size:`sm`,"aria-label":u(),children:(0,A.jsx)(T,{placeholder:u()})}),(0,A.jsx)(E,{children:(e??[]).map(e=>(0,A.jsx)(S,{value:e.userId,children:j(e)},e._id))})]}),t===``?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:d()}):o===void 0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:i()}):(0,A.jsxs)(`div`,{className:`oc-introspect`,children:[(0,A.jsxs)(`section`,{className:`oc-introspect__section`,children:[(0,A.jsx)(`h3`,{className:`oc-introspect__title`,children:h()}),(0,A.jsxs)(`div`,{className:`oc-introspect__id`,children:[(0,A.jsx)(`strong`,{children:o.user.label}),(0,A.jsx)(w,{variant:`secondary`,children:o.role})]})]}),(0,A.jsxs)(`section`,{className:`oc-introspect__section`,children:[(0,A.jsx)(`h3`,{className:`oc-introspect__title`,children:_()}),o.groups.length===0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:m()}):(0,A.jsx)(`div`,{className:`oc-introspect__chips`,children:o.groups.map(e=>(0,A.jsx)(w,{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:l()}),o.agents.length===0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:m()}):(0,A.jsx)(`ul`,{className:`oc-introspect__list`,children:o.agents.map(e=>(0,A.jsxs)(`li`,{className:`oc-introspect__row`,children:[(0,A.jsx)(`span`,{className:`oc-introspect__name`,children:e.displayName||e.agentId}),e.isDefault?(0,A.jsx)(w,{variant:`default`,children:s()}):null,(0,A.jsx)(w,{variant:`outline`,children:O(e.via)}),(0,A.jsx)(w,{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:c()}),o.charts.length===0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:m()}):(0,A.jsx)(`ul`,{className:`oc-introspect__list`,children:o.charts.map(e=>(0,A.jsxs)(`li`,{className:`oc-introspect__row`,children:[(0,A.jsx)(`span`,{className:`oc-introspect__name`,children:e.name}),(0,A.jsx)(w,{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:b()}),o.permissions.length===0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:m()}):(0,A.jsx)(`div`,{className:`oc-introspect__chips`,children:o.permissions.map(e=>(0,A.jsx)(w,{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{Ap as r,Dp as i,Ep as a,Op as o,Tp as s,kp as c,wp as l}from"./dist-
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Ap as r,Dp as i,Ep as a,Op as o,Tp as s,kp as c,wp as l}from"./dist-CHawRMT8.js";import{i as u}from"./dist-bebyRR79.js";import{t as d}from"./x-B5cgu3rn.js";import{t as f}from"./button-BC70Om4X.js";import{C as p,It as m,S as h,b as g,lt as _,w as v,x as y}from"./index-C4W6RiZP.js";import{r as b}from"./TimeRangePicker-CcvYUnNz.js";var x=t(e(),1),S=n(),C=[{value:`eq`,label:`=`},{value:`neq`,label:`≠`},{value:`contains`,label:r()},{value:`gt`,label:`>`},{value:`gte`,label:`≥`},{value:`lt`,label:`<`},{value:`lte`,label:`≤`}],w=1;function T(){return{id:w++,field:``,op:`eq`,value:``}}function E(e){return e.map(e=>({id:w++,field:e.field,op:e.op,value:String(e.value)}))}function D({fields:e,seed:t,onChange:n}){let r=(0,x.useRef)(t),w=!!(r.current&&r.current.length>0),[D,O]=(0,x.useState)(w),[k,A]=(0,x.useState)(()=>w?E(r.current):[]);function j(e){n(e.filter(e=>e.field!==``&&e.value!==``).map(e=>({field:e.field,op:e.op,value:b(e.value)})))}function M(e,t){let n=k.map(n=>n.id===e?{...n,...t}:n);A(n),j(n)}function N(){A(e=>[...e,T()])}function P(e){let t=k.filter(t=>t.id!==e);A(t),j(t)}let F=k.filter(e=>e.field!==``&&e.value!==``).length;return(0,S.jsxs)(`div`,{className:`oc-advfilter`,children:[(0,S.jsxs)(`button`,{type:`button`,className:`oc-advfilter__toggle`,"aria-expanded":D,onClick:()=>O(e=>!e),children:[(0,S.jsx)(u,{className:`oc-advfilter__chevron`+(D?` is-open`:``),"aria-hidden":!0}),c(),F>0?(0,S.jsx)(`span`,{className:`oc-advfilter__count`,children:F}):null]}),D?(0,S.jsxs)(`div`,{className:`oc-advfilter__body`,children:[k.length===0?(0,S.jsx)(`p`,{className:`oc-admin__hint`,children:o()}):(0,S.jsx)(`ul`,{className:`oc-advfilter__rows`,children:k.map(t=>(0,S.jsxs)(`li`,{className:`oc-advfilter__row`,children:[(0,S.jsxs)(g,{value:t.field||void 0,onValueChange:e=>M(t.id,{field:e}),children:[(0,S.jsx)(p,{size:`sm`,className:`w-40`,children:(0,S.jsx)(v,{placeholder:i()})}),(0,S.jsx)(y,{children:e.map(e=>(0,S.jsx)(h,{value:e.value,children:e.label},e.value))})]}),(0,S.jsxs)(g,{value:t.op,onValueChange:e=>M(t.id,{op:e}),children:[(0,S.jsx)(p,{size:`sm`,className:`w-28`,children:(0,S.jsx)(v,{})}),(0,S.jsx)(y,{children:C.map(e=>(0,S.jsx)(h,{value:e.value,children:e.label},e.value))})]}),(0,S.jsx)(_,{className:`oc-advfilter__value`,value:t.value,onChange:e=>M(t.id,{value:e.target.value}),placeholder:a()}),(0,S.jsx)(f,{variant:`ghost`,size:`icon-sm`,"aria-label":s(),onClick:()=>P(t.id),children:(0,S.jsx)(d,{})})]},t.id))}),(0,S.jsxs)(f,{variant:`outline`,size:`sm`,className:`oc-advfilter__add`,onClick:N,children:[(0,S.jsx)(m,{}),l()]})]}):null]})}export{D as t};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$r as r,AM as i,Ac as a,Bc as o,Br as s,Cc as c,Cr as l,Dc as u,E as d,Ec as f,Er as p,Fc as m,Fl as h,Fr as g,Gc as _,Gr as v,Hc as y,Hr as b,Ic as x,Ir as S,Jc as C,Jr as w,Kc as T,Kr as E,Lc as D,Lr as O,Mc as k,Nc as A,Nl as ee,Nr as j,OM as M,Oc as N,Pc as te,Pr as P,Qc as F,Qr as I,Rc as L,Rr as R,SM as z,Sr as B,Tc as ne,Tr as V,Uc as re,Ur as H,Vc as U,Vr as ie,Wc as ae,Wr as oe,Xc as se,Xr as ce,Yc as le,Yr as ue,Zc as de,Zr as fe,br as pe,iD as me,jM as W,jc as he,kc as ge,qc as _e,qr as ve,wM as G,wc as ye,wr as be,xr as xe,zc as Se,zr as Ce}from"./dist-CHawRMT8.js";import{t as K}from"./button-BC70Om4X.js";import{At as q,C as we,G as Te,H as Ee,J as De,K as Oe,S as ke,U as Ae,W as je,Y as Me,b as Ne,ct as Pe,dt as Fe,ft as Ie,ht as Le,mt as Re,q as ze,ut as Be,w as Ve,x as He,xt as Ue,y as We,z as J}from"./index-C4W6RiZP.js";import{n as Ge,t as Ke}from"./curation-CQksaIbm.js";import{i as qe}from"./compatView-CrOWHm6W.js";/* empty css */var Y=t(e(),1),X=2e4,Je=6e4;function Ye(e){return typeof e!=`number`||e<=0?0:Math.round(e/X*100)}function Xe(e){return e<=0?0:Math.round(e/Je*100)}function Z(e,t){let n=(typeof e==`number`&&e>0?e:0)/1e3;return new Intl.NumberFormat(t,{minimumFractionDigits:1,maximumFractionDigits:1}).format(n)}function Ze(e){return e.reduce((e,t)=>e+(typeof t.size==`number`&&t.size>0?t.size:0),0)}var Qe=3;function $e(e,t){let n=new Map;for(let t of e.split(`
|
|
2
|
+
`))n.set(t,(n.get(t)??0)+1);for(let e of t.split(`
|
|
3
|
+
`))n.set(e,(n.get(e)??0)-1);let r=0,i=0,a=[],o=[];for(let[e,t]of n)t<0?(r+=-t,a.length<Qe&&a.push(e)):t>0&&(i+=t,o.length<Qe&&o.push(e));return{added:r,removed:i,sampleAdded:a,sampleRemoved:o}}function et(e){return e instanceof Error?e.message.includes(`conflict:`):String(e).includes(`conflict:`)}var Q=n(),$=e=>`${e.instanceName}::${e.agentId}`;function tt(){let e=W(d.me.getMe,{host:Ue}),t=e?.role===`admin`,n=(e?.permissions??[]).includes(`bridge.read`),r=W(d.admin.listInstances,e!==void 0&&t?{}:`skip`),[i,a]=(0,Y.useState)(null);(0,Y.useEffect)(()=>{!t||!r||r.length===0||(!i||!r.some(e=>e.name===i))&&a(r[0].name)},[t,r,i]);let s=W(d.agents.listAgentsForInstance,t&&i?{instanceName:i}:`skip`),c=W(d.agents.listMyAgents,e!==void 0&&!t?{}:`skip`),l=(0,Y.useMemo)(()=>{if(e!==void 0){if(t)return i===null||s===void 0?r!==void 0&&r.length===0?[]:void 0:s.agents.map(e=>({instanceName:i,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,i,s,r,c]),[u,f]=(0,Y.useState)(null);(0,Y.useEffect)(()=>{!l||l.length===0||(!u||!l.some(e=>$(e)===u))&&f($(l[0]))},[l,u]);let p=l?.find(e=>$(e)===u)??null,m=M(d.agentFiles.listAgentFiles),[h,g]=(0,Y.useState)({status:`idle`}),v=p?.instanceName??null,b=p?.agentId??null,x=W(d.compat.forInstance,n&&v!==null?{instanceName:v}:`skip`),S=n&&v!==null?We(x,`agentFiles`):null,E=S===null?!1:S===`loading`?null:S.blocked,D=(0,Y.useCallback)(async()=>{if(!(v===null||b===null)){g({status:`loading`});try{g({status:`done`,files:(await m({instanceName:v,agentId:b})).files})}catch{g({status:`error`})}}},[m,v,b]);(0,Y.useEffect)(()=>{E===!1&&D()},[D,E]);let[O,k]=(0,Y.useState)(null),A=W(d.agentFileCuration.listCurations,t&&v!==null&&b!==null?{instanceName:v,agentId:b}:`skip`),j=W(d.agentFileCuration.curationSettings,t&&v!==null?{instanceName:v}:`skip`),N=M(d.agentFileCuration.requestCuration),[te,P]=(0,Y.useState)(null),[I,L]=(0,Y.useState)(null),{toast:R}=J(),B=(0,Y.useMemo)(()=>{let e=new Map;for(let t of A??[])e.has(t.name)||e.set(t.name,t);return e},[A]),ne=(0,Y.useCallback)(async e=>{if(!(v===null||b===null)){P(e);try{let t=await N({instanceName:v,agentId:b,name:e,trigger:`manual`});t.ok?R({title:ce(),variant:`success`}):R({title:ue({reason:t.reason??`unknown`}),variant:`error`})}catch{R({title:w(),variant:`error`})}finally{P(null)}}},[N,v,b,R]),V=G(),H=(0,Y.useMemo)(()=>new Intl.NumberFormat(V,{maximumFractionDigits:0}),[V]);return e===void 0||l===void 0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:z()}):(0,Q.jsxs)(`div`,{className:`oc-afiles`,children:[(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:F()}),(0,Q.jsxs)(`div`,{className:`oc-afiles__picker`,children:[t&&(r?.length??0)>1?(0,Q.jsxs)(Ne,{value:i??``,onValueChange:e=>a(e),children:[(0,Q.jsx)(we,{size:`sm`,"aria-label":de(),children:(0,Q.jsx)(Ve,{})}),(0,Q.jsx)(He,{children:(r??[]).map(e=>(0,Q.jsx)(ke,{value:e.name,children:e.name},e.name))})]}):null,l.length>0?(0,Q.jsxs)(Ne,{value:u??``,onValueChange:e=>f(e),children:[(0,Q.jsx)(we,{size:`sm`,"aria-label":se(),children:(0,Q.jsx)(Ve,{})}),(0,Q.jsx)(He,{children:l.map(e=>(0,Q.jsx)(ke,{value:$(e),children:e.label},$(e)))})]}):(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:le()})]}),p===null?null:S===`loading`?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:z()}):S!==null&&S.blocked?(0,Q.jsxs)(`p`,{className:`oc-compat__blocked`,role:`status`,children:[(0,Q.jsx)(q,{size:14,"aria-hidden":!0}),` `,qe(S.gatewayVersion,S.provider)]}):h.status===`loading`||h.status===`idle`?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:z()}):h.status===`error`?(0,Q.jsxs)(`p`,{className:`oc-afiles__error`,role:`alert`,children:[_e(),` `,(0,Q.jsx)(K,{variant:`outline`,size:`sm`,onClick:()=>void D(),children:ee()})]}):h.files.length===0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:C()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`div`,{className:`oc-afiles__list`,children:h.files.map(e=>{let n=Ye(e.size),r=n>=80;return(0,Q.jsxs)(`div`,{className:`oc-afiles__row`,children:[(0,Q.jsx)(`span`,{className:`oc-afiles__name`,title:e.name,children:e.name}),e.missing?(0,Q.jsx)(Pe,{variant:`outline`,children:T()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`span`,{className:`oc-afiles__size`,children:_({size:Z(e.size,V)})}),(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:ae({pct:H.format(n)})}),r?(0,Q.jsx)(q,{size:14,className:`oc-afiles__warn`,"aria-label":re()}):(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?U():o()}),t&&!e.missing?(0,Q.jsx)(nt,{curatable:Ke.includes(e.name),size:e.size??0,budget:j?.budgetChars??null,enabled:j?.enabled??!1,curation:B.get(e.name)??null,inFlight:te===e.name,onCurate:()=>void ne(e.name),onReview:e=>L(e)}):null]},e.name)})}),(0,Q.jsx)(`p`,{className:`oc-afiles__budget`,children:y({used:Z(Ze(h.files),V),total:Z(Je,V),pct:H.format(Xe(Ze(h.files)))})})]}),O&&p?(0,Q.jsx)(rt,{instanceName:p.instanceName,agentId:p.agentId,name:O.name,isAdmin:t,onClose:()=>k(null),onSaved:()=>void D()}):null,I?(0,Q.jsx)(it,{curationId:I,onClose:()=>L(null),onApplied:()=>{L(null),D()}}):null]})}function nt({curatable:e,size:t,budget:n,enabled:i,curation:a,inFlight:o,onCurate:s,onReview:c}){return a?.status===`proposed`?(0,Q.jsx)(K,{variant:`default`,size:`sm`,className:`oc-afiles__curate`,onClick:()=>c(a._id),children:I()}):o||a?.status===`dispatched`||a?.status===`applying`?(0,Q.jsx)(Pe,{variant:`outline`,className:`oc-afiles__curate-status`,children:fe()}):e&&i&&n!==null&&Ge(t,n)?(0,Q.jsx)(K,{variant:`outline`,size:`sm`,className:`oc-afiles__curate`,onClick:s,children:r()}):null}function rt({instanceName:e,agentId:t,name:n,isAdmin:r,onClose:i,onSaved:o}){let s=M(d.agentFiles.getAgentFile),l=M(d.agentFiles.setAgentFile),p=J(),[g,_]=(0,Y.useState)(null),[v,y]=(0,Y.useState)(!1),[b,S]=(0,Y.useState)(``),[C,w]=(0,Y.useState)(!1),[T,E]=(0,Y.useState)(!1),[O,j]=(0,Y.useState)(!1),[P,F]=(0,Y.useState)(!1),I=(0,Y.useCallback)(async r=>{y(!1);try{let i=await s({instanceName:e,agentId:t,name:n});_({content:i.content,updatedAtMs:i.updatedAtMs}),r||S(i.content),j(!1)}catch{y(!0)}},[s,e,t,n]);(0,Y.useEffect)(()=>{I(!1)},[I]);async function R(){if(g!==null){E(!0),F(!1);try{await l({instanceName:e,agentId:t,name:n,content:b,baseUpdatedAtMs:g.updatedAtMs??void 0}),p.success(A({name:n})),o(),await I(!1)}catch(e){et(e)?j(!0):F(!0)}finally{E(!1)}}}let B=g!==null&&b!==g.content,V=(0,Y.useMemo)(()=>g===null?null:$e(g.content,b),[g,b]),re=b.length>X,H=G(),U=(0,Y.useMemo)(()=>new Intl.NumberFormat(H),[H]);return(0,Q.jsx)(Be,{open:!0,onOpenChange:e=>!e&&i(),children:(0,Q.jsxs)(Fe,{className:`oc-afiles__editor`,children:[(0,Q.jsxs)(Re,{children:[(0,Q.jsx)(Le,{children:Se({name:n})}),(0,Q.jsxs)(Ie,{children:[L({agent:t,instance:e}),r?null:(0,Q.jsxs)(Q.Fragment,{children:[` · `,D()]})]})]}),v?(0,Q.jsxs)(`p`,{className:`oc-afiles__error`,role:`alert`,children:[he(),` `,(0,Q.jsx)(K,{variant:`outline`,size:`sm`,onClick:()=>void I(!1),children:ee()})]}):g===null?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:z()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`textarea`,{className:`oc-afiles__source`,value:b,readOnly:!r,spellCheck:!1,onChange:e=>S(e.target.value),"aria-label":Se({name:n})}),(0,Q.jsx)(`p`,{className:`oc-afiles__hint`,children:x()}),O?(0,Q.jsxs)(`p`,{className:`oc-afiles__error`,role:`alert`,children:[a(),` `,(0,Q.jsx)(K,{variant:`outline`,size:`sm`,onClick:()=>void I(!0),children:ge()})]}):null,P?(0,Q.jsx)(`p`,{className:`oc-afiles__error`,role:`alert`,children:k()}):null,(0,Q.jsxs)(`div`,{className:`oc-afiles__editor-foot`,children:[(0,Q.jsx)(`span`,{className:`oc-afiles__count${re?` is-over`:``}`,children:m({count:U.format(b.length),max:U.format(X)})}),r?(0,Q.jsx)(K,{size:`sm`,disabled:!B||T||O,onClick:()=>w(!0),children:T?h():te()}):null]})]}),(0,Q.jsx)(Ee,{open:C,onOpenChange:w,children:(0,Q.jsxs)(Te,{children:[(0,Q.jsxs)(De,{children:[(0,Q.jsx)(Me,{children:N({name:n})}),(0,Q.jsx)(Oe,{children:u({agent:t})})]}),V?(0,Q.jsxs)(`div`,{className:`oc-afiles__diff`,children:[(0,Q.jsx)(`p`,{className:`oc-afiles__diff-counts`,children:f({added:V.added,removed:V.removed})}),V.sampleAdded.length>0?(0,Q.jsxs)(`div`,{className:`oc-afiles__diff-block`,children:[(0,Q.jsx)(`span`,{className:`oc-afiles__diff-label`,children:ne()}),V.sampleAdded.map((e,t)=>(0,Q.jsx)(`code`,{className:`oc-afiles__diff-line is-add`,children:e||` `},t))]}):null,V.sampleRemoved.length>0?(0,Q.jsxs)(`div`,{className:`oc-afiles__diff-block`,children:[(0,Q.jsx)(`span`,{className:`oc-afiles__diff-label`,children:ye()}),V.sampleRemoved.map((e,t)=>(0,Q.jsx)(`code`,{className:`oc-afiles__diff-line is-del`,children:e||` `},t))]}):null]}):null,(0,Q.jsxs)(ze,{children:[(0,Q.jsx)(je,{children:me()}),(0,Q.jsx)(Ae,{onClick:()=>void R(),children:c()})]})]})})]})})}function it({curationId:e,onClose:t,onApplied:n}){let r=W(d.agentFileCuration.getProposal,{curationId:e}),a=M(d.agentFileCuration.approveCuration),o=i(d.agentFileCuration.rejectCuration),{toast:c}=J(),[u,f]=(0,Y.useState)(null),[m,_]=(0,Y.useState)(!1),[y,x]=(0,Y.useState)(``),C=G(),T=(0,Y.useMemo)(()=>r?$e(r.beforeContent,r.proposedContent):null,[r]);async function D(){f(`approve`);try{let t=await a({curationId:e});t.ok?(c({title:ve(),variant:`success`}),n()):c({title:t.reason===`conflict`?v():oe({reason:t.reason??`unknown`}),variant:`error`})}catch{c({title:w(),variant:`error`})}finally{f(null)}}async function k(n){f(`reject`);try{let r=y.trim();(await o({curationId:e,...r?{comment:r}:{},relaunch:n})).ok?c({title:n?xe():E(),variant:`success`}):c({title:ie(),variant:`error`}),t()}catch{c({title:w(),variant:`error`})}finally{f(null)}}return(0,Q.jsx)(Be,{open:!0,onOpenChange:e=>e?void 0:t(),children:(0,Q.jsxs)(Fe,{className:`oc-afiles__review`,children:[(0,Q.jsxs)(Re,{children:[(0,Q.jsx)(Le,{children:r?H({name:r.name}):z()}),(0,Q.jsx)(Ie,{children:b()})]}),r===void 0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:z()}):r===null?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:ie()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`p`,{className:`oc-afiles__review-sizes`,children:[s({before:Z(r.beforeSize,C),after:Z(r.proposedSize,C)}),r.overBudget?(0,Q.jsxs)(Q.Fragment,{children:[` `,(0,Q.jsx)(q,{size:13,"aria-hidden":!0}),` `,Ce()]}):null]}),T?(0,Q.jsx)(`p`,{className:`oc-afiles__review-diff`,children:R({added:T.added,removed:T.removed})}):null,r.feedback?(0,Q.jsx)(`p`,{className:`oc-afiles__review-feedback`,children:pe({feedback:r.feedback})}):null,T&&T.sampleRemoved.length>0?(0,Q.jsxs)(`div`,{className:`oc-afiles__review-removed`,children:[(0,Q.jsx)(`p`,{className:`oc-afiles__review-label`,children:j()}),(0,Q.jsx)(`ul`,{children:T.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:P()}),(0,Q.jsx)(`pre`,{className:`oc-afiles__review-pre`,children:r.beforeContent})]}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`p`,{className:`oc-afiles__review-label`,children:O()}),(0,Q.jsx)(`pre`,{className:`oc-afiles__review-pre`,children:r.proposedContent})]})]})]}),m?(0,Q.jsxs)(`div`,{className:`oc-afiles__reject-form`,children:[(0,Q.jsx)(`label`,{className:`oc-afiles__review-label`,htmlFor:`curation-reject-comment`,children:p()}),(0,Q.jsx)(`textarea`,{id:`curation-reject-comment`,className:`oc-afiles__reject-textarea`,rows:3,placeholder:V(),value:y,onChange:e=>x(e.target.value)}),(0,Q.jsxs)(`div`,{className:`oc-afiles__review-actions`,children:[(0,Q.jsx)(K,{variant:`ghost`,onClick:()=>_(!1),disabled:u!==null,children:be()}),(0,Q.jsx)(K,{variant:`outline`,onClick:()=>void k(!1),disabled:u!==null,children:u===`reject`?h():l()}),(0,Q.jsx)(K,{variant:`default`,onClick:()=>void k(!0),disabled:u!==null,children:u===`reject`?h():B()})]})]}):(0,Q.jsxs)(`div`,{className:`oc-afiles__review-actions`,children:[(0,Q.jsx)(K,{variant:`outline`,onClick:()=>_(!0),disabled:u!==null||r==null,children:S()}),(0,Q.jsx)(K,{variant:`default`,onClick:()=>void D(),disabled:u!==null||r==null,children:u===`approve`?h():g()})]})]})})}export{tt as AgentFilesTab};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$v as r,
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$v as r,AM as i,Ay as ee,Cy as a,Dy as te,E as o,Ey as ne,Fy as s,Gv as c,Jv as l,Kv as u,My as d,Ny as f,Oy as re,Py as p,Qv as ie,Sy as m,Ty as ae,Uv as h,Wv as g,Xv as _,Yv as v,Zv as oe,_y as se,ay as ce,by as le,cy as y,dy as ue,ey as b,fy as x,gy as de,hy as fe,iy as pe,jM as S,jy as me,ky as he,ly as ge,my as _e,ny as ve,oy as C,py as w,qv as T,ry as E,sy as D,ty as O,uy as k,vy as A,wy as j,xy as M,yy as N}from"./dist-CHawRMT8.js";import{B as P,C as F,S as I,Xt as ye,Yt as L,a as be,b as R,ct as z,dt as B,et as xe,ht as V,mt as H,r as Se,ut as U,w as W,x as G,xt as Ce,z as we}from"./index-C4W6RiZP.js";import{n as Te}from"./TimeRangePicker-CcvYUnNz.js";import{t as Ee}from"./FilterBar-DEFwQ8Ux.js";import{t as De}from"./DataTableShell-CuO0YQq6.js";import{t as K}from"./dispatchErrorInfo-DsOn5G3U.js";var q=t(e(),1),J=n(),Y=`__all__`,Oe=[{value:`open`},{value:`acknowledged`},{value:`resolved`}];function ke(e){return e===`open`?s():e===`acknowledged`?p():f()}var Ae=[`info`,`warn`,`critical`],je=[`detector`,`agent`,`user`],Me={kind:`relative`,from:`now-30d`,to:`now`},Ne=200,X=`all`;function Z(){let e=ye({from:`/settings/anomalies`}),t=L({from:`/settings/anomalies`}),n=e.q??``,s=e.status===X?Y:e.status,c=e.severity??Y,l=e.kind??Y,[u,f]=(0,q.useState)(Y),p=Se(e.from,e.to),{from:h,to:g}=Te(p),_=e=>void t({search:t=>({...t,q:e||void 0}),replace:!0}),v=e=>void t({search:t=>({...t,status:e===Y?X:e})}),T=e=>void t({search:t=>({...t,severity:e===Y?void 0:e})}),B=e=>void t({search:t=>({...t,kind:e===Y?void 0:e})}),V=e=>void t({search:t=>({...t,...be(e)})}),H=P(),U=we(),K=i(o.anomalies.resolveAnomaly),Z=(S(o.me.getMe,{host:Ce})?.permissions??[]).includes(`admin.manage`),Q=S(o.anomalies.listAnomalies,{limit:Ne,filter:{q:n||void 0,from:h,to:g,anomalyStatus:s===Y?void 0:s,severity:c===Y?void 0:c,source:u===Y?void 0:u,kind:l===Y?void 0:l}}),$=(0,q.useMemo)(()=>{let e=new Set;for(let t of Q??[])e.add(t.kind);return[...e].sort()},[Q]),ze=n!==``||s!==`open`||c!==Y||u!==Y||l!==Y||p.kind!==`relative`||p.from!==Me.from;function Be(){f(Y),t({search:{status:`open`},replace:!0})}async function Ve(e){if(await H({title:d(),description:(0,J.jsxs)(J.Fragment,{children:[me(),` `,(0,J.jsx)(`span`,{className:`font-mono`,children:e.kind}),` `,ee(),` `,(0,J.jsx)(`strong`,{children:he()}),`.`,` `,re()]}),confirmLabel:te()}))try{await K({anomalyId:e._id,status:`resolved`}),U.success(ne(),e.kind)}catch(e){U.error(ae(),e)}}async function He(e){try{await K({anomalyId:e._id,status:`acknowledged`}),U.success(j(),e.kind)}catch(e){U.error(a(),e)}}return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(`p`,{className:`oc-admin__hint`,children:[m(),` `,(0,J.jsx)(`strong`,{children:M()}),` `,le(),` `,(0,J.jsx)(`strong`,{children:N()}),` `,A(),` `,(0,J.jsx)(`strong`,{children:se()}),` `,de(),` `,(0,J.jsx)(`span`,{className:`oc-filter__window`,children:fe()})]}),(0,J.jsxs)(Ee,{q:n,onQChange:_,searchPlaceholder:_e(),timeRange:p,onTimeRangeChange:V,onReset:Be,canReset:ze,children:[(0,J.jsxs)(R,{value:s,onValueChange:v,children:[(0,J.jsx)(F,{size:`sm`,className:`w-36`,children:(0,J.jsx)(W,{})}),(0,J.jsxs)(G,{children:[(0,J.jsx)(I,{value:Y,children:w()}),Oe.map(e=>(0,J.jsx)(I,{value:e.value,children:ke(e.value)},e.value))]})]}),(0,J.jsxs)(R,{value:c,onValueChange:T,children:[(0,J.jsx)(F,{size:`sm`,className:`w-36`,children:(0,J.jsx)(W,{placeholder:x()})}),(0,J.jsxs)(G,{children:[(0,J.jsx)(I,{value:Y,children:ue()}),Ae.map(e=>(0,J.jsx)(I,{value:e,children:e},e))]})]}),(0,J.jsxs)(R,{value:u,onValueChange:f,children:[(0,J.jsx)(F,{size:`sm`,className:`w-32`,children:(0,J.jsx)(W,{placeholder:k()})}),(0,J.jsxs)(G,{children:[(0,J.jsx)(I,{value:Y,children:ge()}),je.map(e=>(0,J.jsx)(I,{value:e,children:e},e))]})]}),(0,J.jsxs)(R,{value:l,onValueChange:B,children:[(0,J.jsx)(F,{size:`sm`,className:`w-36`,children:(0,J.jsx)(W,{placeholder:y()})}),(0,J.jsxs)(G,{children:[(0,J.jsx)(I,{value:Y,children:D()}),$.map(e=>(0,J.jsx)(I,{value:e,children:e},e))]})]})]}),(0,J.jsx)(De,{title:C(),rows:Q,emptyHint:s===`open`?ce():pe(),rowActions:e=>Z&&e.status===`open`?[{label:E(),onSelect:()=>void Ve(e)},{label:ve(),onSelect:()=>void He(e)}]:[],columns:[{header:O(),cell:e=>(0,J.jsx)(`span`,{className:`oc-traces__time`,children:xe(e.at)}),sort:e=>e.at},{header:y(),cell:e=>(0,J.jsx)(`code`,{className:`oc-traces__mono`,children:e.kind}),sort:e=>e.kind},{header:x(),cell:e=>(0,J.jsx)(Ie,{severity:e.severity}),sort:e=>e.severity===`critical`?2:+(e.severity===`warn`)},{header:b(),cell:e=>(0,J.jsx)(Le,{status:e.status}),sort:e=>e.status===`resolved`?2:+(e.status===`acknowledged`)},{header:k(),cell:e=>(0,J.jsx)(z,{variant:`outline`,children:e.source}),sort:e=>e.source},{header:r(),cell:e=>(0,J.jsxs)(`div`,{className:`oc-anomaly__msgcell`,children:[(0,J.jsx)(`span`,{className:`oc-anomaly__msg`,children:e.message}),(0,J.jsx)(Fe,{row:e})]}),sort:e=>e.message},{header:ie(),cell:e=>(0,J.jsx)(Pe,{row:e}),sort:e=>e.evidence??null},{header:oe(),cell:e=>e.correlationId?(0,J.jsx)(`code`,{className:`oc-traces__mono`,children:Re(e.correlationId)}):(0,J.jsx)(`span`,{className:`oc-traces__muted`,children:`—`}),sort:e=>e.correlationId}]})]})}function Q(e){if(e.kind!==`openclaw.dispatch_failures`||!e.evidence)return{};try{let t=JSON.parse(e.evidence);return{dominantCode:t.dominantCode,sampleCorrelationId:t.sampleCorrelationId}}catch{return{}}}function $(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 Pe({row:e}){let t=L();if(e.kind===`subagent.failure`){let n=$(e);return(0,J.jsxs)(`div`,{className:`oc-anomaly__cause`,children:[(0,J.jsx)(`div`,{className:`oc-anomaly__cause-head`,children:[...new Set(n.errorCategories??[])].map(e=>(0,J.jsx)(`code`,{className:`oc-traces__mono`,children:e},e))}),e.correlationId?(0,J.jsxs)(`button`,{type:`button`,className:`oc-anomaly__drill`,onClick:()=>void t({to:`/settings/traces`,search:{q:e.correlationId,limit:100}}),children:[`↗ `,_()]}):null]})}let n=Q(e);if(!n.dominantCode)return(0,J.jsx)(`span`,{className:`oc-traces__muted`,children:`—`});let r=K(n.dominantCode),i=n.sampleCorrelationId;return(0,J.jsxs)(`div`,{className:`oc-anomaly__cause`,children:[(0,J.jsxs)(`div`,{className:`oc-anomaly__cause-head`,children:[(0,J.jsx)(`span`,{className:`oc-anomaly__cause-label`,children:r.label}),(0,J.jsx)(`code`,{className:`oc-traces__mono`,children:n.dominantCode})]}),(0,J.jsx)(`p`,{className:`oc-anomaly__cause-hint`,children:r.hint}),i?(0,J.jsxs)(`button`,{type:`button`,className:`oc-anomaly__drill`,onClick:()=>void t({to:`/settings/traces`,search:{q:i,limit:100}}),children:[`↗ `,_()]}):null]})}function Fe({row:e}){let[t,n]=(0,q.useState)(!1),r=S(o.anomalies.getAnomalyAttachments,t?{anomalyId:e._id}:`skip`);return!e.attachments||e.attachments.length===0?null:(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(`button`,{type:`button`,className:`oc-anomaly__drill`,onClick:()=>n(!0),children:[v(),e.attachments.length>1?` (${e.attachments.length})`:``]}),(0,J.jsx)(U,{open:t,onOpenChange:n,children:(0,J.jsxs)(B,{className:`oc-anomaly__attachments-dialog`,children:[(0,J.jsx)(H,{children:(0,J.jsx)(V,{children:l()})}),r===void 0?(0,J.jsx)(`p`,{className:`oc-traces__muted`,children:T()}):r.length===0?(0,J.jsx)(`p`,{className:`oc-traces__muted`,children:u()}):(0,J.jsx)(`div`,{className:`oc-anomaly__attachments`,children:r.map(e=>(0,J.jsxs)(`section`,{className:`oc-anomaly__attachment`,children:[(0,J.jsx)(`h4`,{className:`oc-anomaly__attachment-name`,children:(0,J.jsx)(`code`,{className:`oc-traces__mono`,children:e.name})}),(0,J.jsx)(`pre`,{className:`oc-anomaly__attachment-content`,children:e.content})]},e.name))})]})})]})}function Ie({severity:e}){return(0,J.jsx)(`span`,{className:`oc-anomaly__sev oc-anomaly__sev--${e}`,children:e})}function Le({status:e}){return e===`open`?(0,J.jsx)(z,{variant:`destructive`,children:c()}):e===`acknowledged`?(0,J.jsx)(z,{variant:`secondary`,children:g()}):(0,J.jsx)(z,{variant:`outline`,children:h()})}function Re(e){return e.length>8?e.slice(0,8):e}export{Z as AnomaliesTab};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Ab as r,Bb as i,Db as a,E as o,Eb as s,Fb as c,Ib as l,Lb as u,Mb as d,Nb as f,
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Ab as r,Bb as i,Db as a,E as o,Eb as s,Fb as c,Ib as l,Lb as u,Mb as d,Nb as f,Ob as p,Pb as m,Rb as h,Sn as g,_n as _,bn as v,jM as y,jb as b,kb as x,vn as S,xn as C,yn as w,zb as T}from"./dist-CHawRMT8.js";import{C as E,S as D,Xt as O,Yt as k,a as A,b as j,et as M,i as N,o as P,r as F,t as I,w as L,x as R}from"./index-C4W6RiZP.js";import{n as ee}from"./TimeRangePicker-CcvYUnNz.js";import{t as z}from"./FilterBar-DEFwQ8Ux.js";import{t as B}from"./AdvancedFilter-DZQYmNs4.js";import{t as V}from"./DataTableShell-CuO0YQq6.js";var H=t(e(),1),U=n(),W={kind:`relative`,from:I,to:`now`},G=`__all__`,K=[{value:`action`,label:g()},{value:`realLabel`,label:C()},{value:`targetLabel`,label:v()},{value:`impersonated`,label:w()},{value:`resource`,label:S()},{value:`resourceId`,label:_()}];function q(){let e=O({from:`/settings/audit`}),t=k({from:`/settings/audit`}),n=e.q??``,g=e.action??G,_=e.impersonated??G,v=e.resource??G,S=F(e.from,e.to),C=(0,H.useMemo)(()=>P(e.adv),[e.adv]),{from:w,to:I}=ee(S),q=e=>void t({search:t=>({...t,q:e||void 0}),replace:!0}),J=e=>void t({search:t=>({...t,action:e===G?void 0:e})}),Y=e=>void t({search:t=>({...t,impersonated:e===G?void 0:e})}),X=e=>void t({search:t=>({...t,resource:e===G?void 0:e})}),Z=e=>void t({search:t=>({...t,...A(e)})}),Q=e=>void t({search:t=>({...t,adv:N(e)}),replace:!0}),$=y(o.admin.listAudit,{filter:{q:n||void 0,from:w,to:I,action:g===G?void 0:g,resource:v===G?void 0:v,impersonated:_===G?void 0:_===`yes`,advanced:C.length>0?C: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!==``||g!==G||_!==G||v!==G||C.length>0||S.kind!==`relative`||S.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:[i(),` `,(0,U.jsx)(`span`,{className:`oc-filter__window`,children:T()})]}),(0,U.jsxs)(z,{q:n,onQChange:q,searchPlaceholder:h(),timeRange:S,onTimeRangeChange:Z,onReset:ie,canReset:re,children:[(0,U.jsxs)(j,{value:g,onValueChange:J,children:[(0,U.jsx)(E,{size:`sm`,className:`w-40`,children:(0,U.jsx)(L,{placeholder:u()})}),(0,U.jsxs)(R,{children:[(0,U.jsx)(D,{value:G,children:l()}),te.map(e=>(0,U.jsx)(D,{value:e,children:e},e))]})]}),(0,U.jsxs)(j,{value:_,onValueChange:Y,children:[(0,U.jsx)(E,{size:`sm`,className:`w-40`,children:(0,U.jsx)(L,{})}),(0,U.jsxs)(R,{children:[(0,U.jsx)(D,{value:G,children:c()}),(0,U.jsx)(D,{value:`yes`,children:m()}),(0,U.jsx)(D,{value:`no`,children:f()})]})]}),(0,U.jsxs)(j,{value:v,onValueChange:X,children:[(0,U.jsx)(E,{size:`sm`,className:`w-40`,children:(0,U.jsx)(L,{placeholder:d()})}),(0,U.jsxs)(R,{children:[(0,U.jsx)(D,{value:G,children:b()}),ne.map(e=>(0,U.jsx)(D,{value:e,children:e},e))]})]})]}),(0,U.jsx)(B,{fields:K,seed:C,onChange:Q}),(0,U.jsx)(V,{title:r(),rows:$,emptyHint:x(),columns:[{header:p(),cell:e=>M(e.at),sort:e=>e.at},{header:u(),cell:e=>e.action,sort:e=>e.action},{header:a(),cell:e=>e.realLabel,sort:e=>e.realLabel},{header:s(),cell:e=>e.targetLabel??`—`,sort:e=>e.targetLabel??null},{header:d(),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{$h as r,AM as i,Ag as a,Ah as o,Bg as s,Bh as c,Bt as l,Ch as u,D as d,Dh as f,E as p,Eh as m,Fg as h,Fh as g,Gh as _,Hh as v,Ht as y,Ig as ee,Ih as b,Jh as x,Kh as S,Kt as te,Lg as ne,Lh as re,Mh as ie,Nh as ae,OM as oe,Oh as se,Pg as ce,Ph as le,Qh as ue,Rg as de,Rh as fe,Sh as pe,Th as C,Ug as me,Uh as he,Ut as ge,Vg as _e,Vh as ve,Vt as ye,Wg as be,Wh as xe,Xh as Se,Xs as Ce,Yh as we,Zh as Te,_h as Ee,ac as De,ag as Oe,bh as ke,cc as Ae,cg as je,dc as Me,dh as Ne,ec as Pe,eg as Fe,fc as Ie,fh as w,gh as Le,hh as Re,ic as ze,ig as Be,jM as T,jg as Ve,jh as He,kh as Ue,lc as We,mh as Ge,nc as Ke,ng as qe,oc as Je,og as Ye,ph as Xe,qh as Ze,rc as Qe,rg as $e,sc as E,sg as et,tc as tt,tg as nt,uc as rt,vh as it,wh as at,xh as ot,yh as st,zg as ct,zh as lt,zt as ut}from"./dist-CHawRMT8.js";import{i as D,r as dt}from"./dist-bebyRR79.js";import{t as ft}from"./chevrons-up-down-BvfCZOnB.js";import{i as pt,n as O,o as mt,r as ht,s as gt}from"./FieldLabel-u_jnizyn.js";import{i as _t,n as vt,r as yt,t as bt}from"./tabs-CYZIFsUm.js";import{t as k}from"./button-BC70Om4X.js";import{At as A,C as j,Kt as xt,Nt as St,Q as Ct,S as M,X as wt,Xt as Tt,Yt as Et,Z as Dt,b as N,ct as P,dt as Ot,et as F,ft as kt,ht as At,lt as I,m as jt,mt as Mt,p as Nt,qt as L,tt as R,ut as Pt,w as z,x as B,xt as Ft,z as It,zt as Lt}from"./index-C4W6RiZP.js";import{r as Rt}from"./locales-CPjguROj.js";import{a as zt,i as V,n as Bt,o as H,r as U,t as Vt}from"./table-poMaV2RU.js";import{t as Ht}from"./FilterBar-DEFwQ8Ux.js";import{a as Ut,n as Wt,o as W,r as Gt,s as Kt,t as qt}from"./compatView-CrOWHm6W.js";import{t as G}from"./dispatchErrorInfo-DsOn5G3U.js";var Jt=d(`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`}]]),Yt=d(`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 Xt(e){return e.filter(e=>e.state===`error`)}function Zt(e){return e.reachable&&Xt(e.targets).length===0}function Qt(e){return Zt(e)?(e.unreachableInstances??[]).length>0?`gateways_unreachable`:`ok`:`error`}function $t(e){return e.state===`error`&&e.lastErrorCode!==null}function en(e){return!!e.lastDownstreamRejectCode}function q(e){return e.kind??`openclaw`}function tn(e){return[...e].sort((e,t)=>e===`openclaw`?-1:t===`openclaw`?1:e.localeCompare(t))}function nn(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 tn(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__`,rn={q:``,state:Y,instance:Y,version:Y},X={connected:0,error:1,idle:2};function an(e){return e.q.trim()!==``||e.state!==`__all__`||e.instance!==`__all__`||e.version!==`__all__`}function on(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 sn(e,t){return e===`version`?t.gatewayVersion===null:e===`lastOk`?t.lastOkAt===null:!1}function cn(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 W(e,r)??Z(e,r)}case`lastOk`:return t.lastOkAt-n.lastOkAt;default:return Z(t.targetLabel,n.targetLabel)}}function ln(e,t){if(!t)return e;let n=t.dir===`asc`?1:-1;return[...e].sort((e,r)=>{let i=sn(t.key,e),a=sn(t.key,r);return i&&a?0:i?1:a?-1:n*cn(t.key,e,r)})}function un(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 dn(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 fn(e){let t=new Set;for(let n of e)n.gatewayVersion!==null&&t.add(n.gatewayVersion);return[...t].sort((e,t)=>W(e,t)??Z(e,t))}var Q=n();function pn({connections:e,displayByInstance:t}){let[n,r]=(0,K.useState)(rn),[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),attempts:e.attempts,lastOkAt:e.lastOkAt??null,lastErrorCode:e.lastErrorCode??null,lastErrorAt:e.lastErrorAt??null,lastDownstreamRejectCode:e.lastDownstreamRejectCode??null,lastDownstreamRejectAt:e.lastDownstreamRejectAt??null})),[e,t]),s=(0,K.useMemo)(()=>un(o),[o]),c=(0,K.useMemo)(()=>dn(o),[o]),l=(0,K.useMemo)(()=>fn(o),[o]),d=(0,K.useMemo)(()=>ln(on(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:Ue()}):(0,Q.jsxs)(`div`,{className:`oc-conn`,children:[(0,Q.jsxs)(Ht,{q:n.q,onQChange:e=>r(t=>({...t,q:e})),searchPlaceholder:m(),onReset:()=>r(rn),canReset:an(n),children:[(0,Q.jsxs)(N,{value:n.state,onValueChange:e=>r(t=>({...t,state:e})),children:[(0,Q.jsx)(j,{size:`sm`,className:`w-36`,children:(0,Q.jsx)(z,{placeholder:at()})}),(0,Q.jsxs)(B,{children:[(0,Q.jsx)(M,{value:Y,children:C()}),s.map(e=>(0,Q.jsx)(M,{value:e,children:hn(e)},e))]})]}),(0,Q.jsxs)(N,{value:n.instance,onValueChange:e=>r(t=>({...t,instance:e})),children:[(0,Q.jsx)(j,{size:`sm`,className:`w-40`,children:(0,Q.jsx)(z,{placeholder:u()})}),(0,Q.jsxs)(B,{children:[(0,Q.jsx)(M,{value:Y,children:C()}),c.map(e=>(0,Q.jsx)(M,{value:e.name,children:e.label},e.name))]})]}),(0,Q.jsxs)(N,{value:n.version,onValueChange:e=>r(t=>({...t,version:e})),children:[(0,Q.jsx)(j,{size:`sm`,className:`w-36`,children:(0,Q.jsx)(z,{placeholder:pe()})}),(0,Q.jsxs)(B,{children:[(0,Q.jsx)(M,{value:Y,children:C()}),l.map(e=>(0,Q.jsx)(M,{value:e,children:e},e))]})]})]}),d.length===0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:ot()}):(0,Q.jsxs)(Vt,{className:`oc-conn__table`,children:[(0,Q.jsx)(zt,{children:(0,Q.jsxs)(H,{children:[(0,Q.jsx)($,{label:ke(),sortKey:`target`,sort:i,onSort:f}),(0,Q.jsx)($,{label:st(),sortKey:`state`,sort:i,onSort:f}),(0,Q.jsx)($,{label:it(),sortKey:`instance`,sort:i,onSort:f}),(0,Q.jsx)($,{label:Ee(),sortKey:`host`,sort:i,onSort:f}),(0,Q.jsx)($,{label:Le(),sortKey:`version`,sort:i,onSort:f}),(0,Q.jsx)(V,{children:Re()}),(0,Q.jsx)($,{label:Ge(),sortKey:`lastOk`,sort:i,onSort:f})]})}),(0,Q.jsx)(Bt,{children:d.map(e=>(0,Q.jsx)(mn,{r:e},e._id))})]})]})}function $({label:e,sortKey:t,sort:n,onSort:r}){let i=n?.key===t,a=i?n.dir:null;return(0,Q.jsx)(V,{"aria-sort":i?a===`asc`?`ascending`:`descending`:`none`,children:(0,Q.jsxs)(`button`,{type:`button`,className:`oc-conn__sort`,onClick:()=>r(t),children:[e,i?a===`asc`?(0,Q.jsx)(dt,{size:13,"aria-hidden":!0}):(0,Q.jsx)(D,{size:13,"aria-hidden":!0}):(0,Q.jsx)(ft,{size:13,"aria-hidden":!0,className:`oc-conn__sort-idle`})]})})}function mn({r:e}){let t=$t(e)?G(e.lastErrorCode):null,n=en(e)?G(e.lastDownstreamRejectCode):null;return(0,Q.jsxs)(K.Fragment,{children:[(0,Q.jsxs)(H,{className:`oc-conn__row oc-conn__row--${e.state}`,children:[(0,Q.jsx)(U,{children:(0,Q.jsx)(`code`,{className:`oc-traces__mono`,children:e.targetLabel})}),(0,Q.jsx)(U,{children:(0,Q.jsx)(gn,{state:e.state})}),(0,Q.jsx)(U,{children:e.instanceLabel?(0,Q.jsx)(`span`,{className:`oc-bridge-target__instance`,children:e.instanceLabel}):(0,Q.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})}),(0,Q.jsx)(U,{children:(0,Q.jsx)(`span`,{className:`oc-bridge-target__host`,children:e.gatewayHost})}),(0,Q.jsx)(U,{children:e.gatewayVersion?(0,Q.jsx)(`span`,{className:`oc-bridge-target__version`,children:e.gatewayVersion}):(0,Q.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})}),(0,Q.jsx)(U,{children:(0,Q.jsx)(`span`,{className:`oc-conn__stats`,children:se({ok:e.okCount,errors:e.errorCount,attempts:e.attempts})})}),(0,Q.jsx)(U,{children:e.lastOkAt?(0,Q.jsx)(`span`,{className:`oc-traces__mono`,children:R(e.lastOkAt)}):(0,Q.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})})]}),t||n?(0,Q.jsx)(H,{className:`oc-conn__detail-row`,children:(0,Q.jsxs)(U,{colSpan:7,className:`oc-conn__detail-cell`,children:[t?(0,Q.jsxs)(`div`,{className:`oc-bridge-target__error`,children:[(0,Q.jsx)(`strong`,{children:t.label}),` `,(0,Q.jsx)(`code`,{className:`oc-traces__mono`,children:e.lastErrorCode}),e.lastErrorAt?` · ${R(e.lastErrorAt)}`:``,(0,Q.jsx)(`p`,{className:`oc-bridge-card__hint`,children:t.hint})]}):null,n?(0,Q.jsxs)(`div`,{className:`oc-bridge-target__downstream`,children:[f({label:n.label}),` `,(0,Q.jsx)(`code`,{className:`oc-traces__mono`,children:e.lastDownstreamRejectCode}),e.lastDownstreamRejectAt?` · ${R(e.lastDownstreamRejectAt)}`:``]}):null]})}):null]})}function hn(e){return e===`connected`?Xe():e===`error`?w():Ne()}function gn({state:e}){return e===`connected`?(0,Q.jsx)(P,{variant:`secondary`,children:Xe()}):e===`error`?(0,Q.jsx)(P,{variant:`destructive`,children:w()}):(0,Q.jsx)(P,{variant:`outline`,children:Ne()})}function _n(){return T(p.bridgeHealth.getBridgeHealth,{})}function vn(){let e=_n(),t=T(p.compat.getBridgeCompat,{}),n=T(p.me.getMe,{host:Ft})?.role===`admin`,r=T(p.admin.listInstances,n?{}:`skip`),i=T(p.agents.usageForInstances,n?{}:`skip`),a=Et(),o=()=>void a({to:`/settings/anomalies`,search:{status:`open`}}),s=nn(e?e.targets:[],t?t.targets:[],r??[]),{section:c}=Tt({from:`/settings/bridge`}),u=Et({from:`/settings/bridge`}),d=t?.compat??null,f=t===void 0?`loading`:t===null?`nodata`:`ready`,m=d!==null&&Wt(d,`hermes`)&&!s.some(e=>e.key===`hermes`);return(0,Q.jsxs)(`div`,{className:`oc-bridge`,children:[(0,Q.jsx)(yn,{health:e,compat:t,onSeeAnomalies:o}),(0,Q.jsx)(`p`,{className:`oc-admin__hint oc-bridge__caption`,children:x()}),i&&i.length>0?(0,Q.jsxs)(`section`,{className:`oc-bridge__usage`,children:[(0,Q.jsx)(`h3`,{className:`oc-bridge__usage-title`,children:Ze()}),(0,Q.jsxs)(Vt,{children:[(0,Q.jsx)(zt,{children:(0,Q.jsxs)(H,{children:[(0,Q.jsx)(V,{children:ge()}),(0,Q.jsx)(V,{children:y()}),(0,Q.jsx)(V,{children:ye()}),(0,Q.jsx)(V,{children:l()}),(0,Q.jsx)(V,{children:ut()})]})}),(0,Q.jsx)(Bt,{children:i.flatMap(e=>{let t=jt(e.usage,Date.now());return t?t.windows.map((t,n)=>(0,Q.jsxs)(H,{children:[(0,Q.jsx)(U,{className:`font-medium`,children:n===0?e.instanceName:``}),(0,Q.jsx)(U,{children:t.provider}),(0,Q.jsx)(U,{children:t.label}),(0,Q.jsx)(U,{children:(0,Q.jsxs)(P,{variant:t.percentLeft<=10?`destructive`:t.percentLeft<=25?`outline`:`secondary`,children:[t.percentLeft,`%`]})}),(0,Q.jsx)(U,{className:`text-muted-foreground`,children:t.resetText??`—`})]},`${e.instanceName}:${t.provider}:${t.label}`)):[]})})]})]}):null,s.length>0?(0,Q.jsxs)(bt,{value:s.some(e=>e.key===c)?c:s[0]?.key??`openclaw`,onValueChange:e=>void u({search:{section:e},replace:!0}),children:[(0,Q.jsx)(yt,{className:`w-full`,children:s.map(e=>(0,Q.jsxs)(_t,{value:e.key,className:`flex-1 gap-1.5`,children:[(0,Q.jsx)(St,{size:13,"aria-hidden":!0}),J(e.key)]},e.key))}),s.map(e=>(0,Q.jsx)(vt,{value:e.key,children:(0,Q.jsx)(bn,{providerKey:e.key,connections:e.connections,instances:e.instances,manifest:d,compatStatus:f,compatReachable:t?.reachable??!0,protocol:e.key===`openclaw`?t?.protocol??null:null})},e.key))]}):null,m?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:Ce()}):null]})}function yn({health:e,compat:t,onSeeAnomalies:n}){let r=t!=null&&t.buildVersion!=null&&t.bridgeVersion!=null&&t.buildVersion!==t.bridgeVersion,i=t?.buildRevision&&t.buildRevision!==`unknown`?t.buildRevision.slice(0,7):null,a=t&&t!==null?(0,Q.jsxs)(`span`,{className:`oc-bridge-card__ver`,children:[(0,Q.jsx)(`code`,{className:`oc-traces__mono`,children:Ut(t.bridgeVersion)}),i?(0,Q.jsxs)(Q.Fragment,{children:[` `,(0,Q.jsxs)(`code`,{className:`oc-traces__mono`,title:rt(),children:[`(`,i,`)`]})]}):null,r?(0,Q.jsxs)(`strong`,{className:`oc-bridge-card__mismatch`,children:[` `,We({build:t.buildVersion??`?`})]}):null,` · `,Ae(),` `,(0,Q.jsx)(`code`,{className:`oc-traces__mono`,children:t.protocolVersion===null?E():String(t.protocolVersion)})]}):null;if(e===void 0)return(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:c()});if(e===null)return(0,Q.jsx)(`div`,{className:`oc-bridge-card oc-bridge-card--idle`,children:lt()});let o=Xt(e.targets),s=!e.reachable,l=Qt(e),u=e.unreachableInstances??[],d=l===`ok`?`ok`:l===`gateways_unreachable`?`warn`:`error`,f=F(e.checkedAt),p=e.startedAt==null?null:F(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)(xt,{size:22}):s||l===`gateways_unreachable`?(0,Q.jsx)(Yt,{size:22}):(0,Q.jsx)(A,{size:22})}),(0,Q.jsxs)(`div`,{className:`oc-bridge-card__body`,children:[(0,Q.jsx)(`div`,{className:`oc-bridge-card__title`,children:l===`ok`?fe():l===`gateways_unreachable`?le({count:u.length}):s?re():b({count:o.length})}),(0,Q.jsxs)(`div`,{className:`oc-bridge-card__meta`,children:[(0,Q.jsxs)(`span`,{children:[(0,Q.jsx)(Jt,{size:12,"aria-hidden":!0}),` `,g({time:f})]}),p?(0,Q.jsx)(`span`,{children:ie({time:p})}):null,a]}),l===`gateways_unreachable`?(0,Q.jsx)(`p`,{className:`oc-bridge-card__hint`,children:ae({names:u.join(`, `)})}):null,s?(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:He()})]})}function bn({providerKey:e,connections:t,instances:n,manifest:r,compatStatus:i,compatReachable:a,protocol:s}){let c=r?Kt(r,e):null,l=new Map;for(let e of n)l.set(e.name,e.displayName??e.name);let u=[],d=new Set;for(let n of t){if(!n.instanceName||d.has(n.instanceName))continue;d.add(n.instanceName);let t=n.gatewayVersion??null;u.push({instanceName:n.instanceName,displayName:l.get(n.instanceName)??n.instanceName,version:t,state:qt(t,e,r)})}let f=u.map(e=>e.state),p=f.includes(`beyond`)?`beyond`:f.length>0&&f.every(e=>e===`supported`)?`supported`:null,[m,h]=(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)(St,{size:15,"aria-hidden":!0,className:`oc-bridge-provider__icon`}),(0,Q.jsx)(`span`,{className:`oc-bridge-provider__name`,children:J(e)}),p?(0,Q.jsx)(P,{variant:p===`beyond`?`destructive`:`secondary`,children:Gt(p)}):null]}),(0,Q.jsx)(`h4`,{className:`oc-bridge-provider__sub`,children:Ie()}),(0,Q.jsx)(Sn,{providerName:J(e),support:c,compatStatus:i,compatReachable:a,manifest:r,instanceRows:u}),s?(0,Q.jsx)(xn,{protocol:s}):null,(0,Q.jsxs)(`button`,{type:`button`,className:`oc-bridge-provider__sub oc-bridge-provider__sub--toggle`,"aria-expanded":m,onClick:()=>h(e=>!e),children:[m?(0,Q.jsx)(D,{size:13,"aria-hidden":!0}):(0,Q.jsx)(L,{size:13,"aria-hidden":!0}),o({count:t.length})]}),m?(0,Q.jsx)(pn,{connections:t,displayByInstance:l}):null]})}function xn({protocol:e}){let[t,n]=(0,K.useState)(!1),r=e.coverage,i=e.drift??[];return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`h4`,{className:`oc-bridge-provider__sub`,children:[S(),i.length>0?(0,Q.jsx)(P,{variant:`destructive`,children:xe({count:i.length})}):(0,Q.jsx)(P,{variant:`secondary`,children:_()})]}),(0,Q.jsxs)(`p`,{className:`oc-admin__hint`,children:[he({version:e.vendoredVersion}),r?` · `+v({handled:r.handled,ignored:r.ignored,gaps:r.gaps}):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)(D,{size:13,"aria-hidden":!0}):(0,Q.jsx)(L,{size:13,"aria-hidden":!0}),ve({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 Sn({support:e,compatStatus:t,compatReachable:n,manifest:r,instanceRows:i,providerName:a}){return t===`loading`?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:c()}):t===`nodata`?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:Me()}):(0,Q.jsxs)(`div`,{className:`oc-compat`,children:[n?null:(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:Je()}),r===null?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:De()}):(0,Q.jsxs)(`div`,{className:`oc-compat__support`,children:[(0,Q.jsx)(`span`,{className:`oc-compat__label`,children:te({provider:a})}),e&&e.range!==null?(0,Q.jsx)(`span`,{children:ze({min:e.range.min,max:e.range.maxValidated})}):(0,Q.jsx)(`span`,{children:E()}),e?(0,Q.jsx)(En,{versions:e.validatedVersions}):null]}),i.length===0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:Pe()}):(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:Ut(e.version)}),(0,Q.jsx)(P,{variant:e.state===`supported`?`secondary`:e.state===`beyond`?`destructive`:`outline`,children:Gt(e.state)})]},e.instanceName))})]})}function Cn({instance:e,onClose:t}){return(0,Q.jsx)(Pt,{open:!0,onOpenChange:e=>!e&&t(),children:(0,Q.jsxs)(Ot,{className:`oc-bridge-config-dialog`,onOpenAutoFocus:e=>e.preventDefault(),children:[(0,Q.jsxs)(Mt,{children:[(0,Q.jsx)(At,{children:be({instance:e.displayName??e.name})}),(0,Q.jsx)(kt,{children:me()})]}),(0,Q.jsx)(Tn,{instance:e,onClose:t})]})})}function wn({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)(xt,{"aria-hidden":!0}):(0,Q.jsx)(A,{"aria-hidden":!0}),(0,Q.jsxs)(`span`,{children:[e,` — `,t.ok?ue():t.detail]})]}):(0,Q.jsxs)(`p`,{className:`oc-bridge-config__check-row oc-bridge-config__check-row--skip`,children:[e,` — `,Te()]}):null}function Tn({instance:e,onClose:t}){let n=i(p.admin.upsertInstanceConfig),o=oe(p.bridge.validateMediaPaths),c=It(),l=Rt(e.config?.contentLocale,void 0),[u,d]=(0,K.useState)(()=>pt(e.config??{},l)),[f,m]=(0,K.useState)(!1),[g,_]=(0,K.useState)(!1),[v,y]=(0,K.useState)(null),b=u.inboundMediaMode===`shared-fs`,x=u.mediaMode===`shared-fs`,S=b||x;async function te(){_(!0),y(null);try{y(await o({instanceName:e.name,inboundMediaMode:u.inboundMediaMode,mediaMode:u.mediaMode}))}catch(e){c.error(qe(),e)}finally{_(!1)}}async function re(){m(!0);try{let r=e.config??{};await n({instanceId:e._id,config:ht(u,r,l)}),t()}catch(e){c.error(ee(),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)(O,{label:_e(),help:h()}),(0,Q.jsxs)(N,{value:u.mediaMode,onValueChange:e=>d({...u,mediaMode:e}),children:[(0,Q.jsx)(j,{size:`sm`,className:`w-full`,children:(0,Q.jsx)(z,{})}),(0,Q.jsx)(B,{children:gt.map(e=>(0,Q.jsx)(M,{value:e,children:e},e))})]})]}),(0,Q.jsxs)(`label`,{className:`oc-field`,children:[(0,Q.jsx)(O,{label:s(),help:ce()}),(0,Q.jsxs)(N,{value:u.inboundMediaMode,onValueChange:e=>d({...u,inboundMediaMode:e}),children:[(0,Q.jsx)(j,{size:`sm`,className:`w-full`,children:(0,Q.jsx)(z,{})}),(0,Q.jsx)(B,{children:mt.map(e=>(0,Q.jsx)(M,{value:e,children:e},e))})]})]}),(0,Q.jsxs)(`label`,{className:`oc-field`,children:[(0,Q.jsx)(O,{label:ct(),help:Ve()}),(0,Q.jsx)(I,{type:`number`,min:1,max:4096,className:`w-full`,value:u.mediaMaxMb,onChange:e=>d({...u,mediaMaxMb:Math.trunc(Number(e.target.value)||0)})})]})]}),S&&(0,Q.jsxs)(`div`,{className:`oc-bridge-config__grid`,children:[b&&(0,Q.jsxs)(`label`,{className:`oc-field`,children:[(0,Q.jsx)(O,{label:je(),help:et()}),(0,Q.jsx)(I,{className:`w-full`,spellCheck:!1,value:u.inboundAgentMount,onChange:e=>d({...u,inboundAgentMount:e.target.value})})]}),x&&(0,Q.jsxs)(`label`,{className:`oc-field`,children:[(0,Q.jsx)(O,{label:Ye(),help:Oe()}),(0,Q.jsx)(I,{className:`w-full`,spellCheck:!1,value:u.outboundAgentMount,onChange:e=>d({...u,outboundAgentMount:e.target.value})})]})]}),(0,Q.jsxs)(`label`,{className:`oc-field--row`,children:[(0,Q.jsx)(Nt,{checked:u.rehydration,onCheckedChange:e=>d({...u,rehydration:e===!0})}),(0,Q.jsx)(O,{label:de(),help:a()})]}),S&&v!==null&&(0,Q.jsx)(`div`,{className:`oc-bridge-config__check`,children:v.reachable?!v.inbound&&!v.outbound?(0,Q.jsxs)(`p`,{className:`oc-bridge-config__check-row oc-bridge-config__check-row--err`,children:[(0,Q.jsx)(A,{"aria-hidden":!0}),we({reason:v.reason??`?`})]}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(wn,{label:Fe(),result:v.inbound}),(0,Q.jsx)(wn,{label:r(),result:v.outbound}),(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:nt()})]}):(0,Q.jsxs)(`p`,{className:`oc-bridge-config__check-row oc-bridge-config__check-row--err`,children:[(0,Q.jsx)(A,{"aria-hidden":!0}),Se()]})}),(0,Q.jsxs)(`div`,{className:`oc-bridge-config__actions`,children:[S&&(0,Q.jsxs)(k,{variant:`outline`,size:`sm`,onClick:()=>void te(),disabled:g,children:[g?(0,Q.jsx)(Lt,{className:`size-4 animate-spin`,"aria-hidden":!0}):null,g?$e():Be()]}),(0,Q.jsx)(k,{size:`sm`,onClick:()=>void re(),disabled:f,children:ne()})]})]})})}function En({versions:e}){if(e.length===0)return null;let t=[...e].reverse();return(0,Q.jsxs)(wt,{children:[(0,Q.jsx)(Ct,{asChild:!0,children:(0,Q.jsxs)(`button`,{type:`button`,className:`oc-compat__versions-btn`,children:[e.length===1?Qe():Ke({count:e.length}),(0,Q.jsx)(D,{size:13,"aria-hidden":!0})]})}),(0,Q.jsxs)(Dt,{className:`oc-compat__versions-pop`,align:`start`,children:[(0,Q.jsx)(`p`,{className:`oc-compat__versions-title`,children:tt()}),(0,Q.jsx)(`div`,{className:`oc-compat__versions-list`,children:t.map(e=>(0,Q.jsx)(P,{variant:`secondary`,children:e},e))})]})]})}export{vn as BridgeTab,Cn as InstanceConfigDialog};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{AM as r,Bi as i,E as a,Fl as o,Gi as s,Gt as c,Hg as l,Hi as u,Ki as d,Nl as f,OM as p,Ol as m,Ri as h,SM as g,Ui as _,Vi as v,Wi as y,Zc as b,_c as x,bc as S,gc as C,hc as w,jM as T,kl as E,mc as D,pc as O,qi as k,vc as A,xc as j,yc as M,zi as N}from"./dist-CHawRMT8.js";import{t as P}from"./button-BC70Om4X.js";import{At as F,C as I,S as L,b as R,d as z,f as B,lt as V,p as H,w as U,x as W,y as G}from"./index-C4W6RiZP.js";import{i as K}from"./compatView-CrOWHm6W.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=r(a.admin.upsertInstanceConfig),n=T(a.agents.listAgentsForInstance,{instanceName:e.name}),i=typeof e.config?.converterAgentId==`string`?e.config.converterAgentId:``,[s,c]=(0,q.useState)(i),[l,d]=(0,q.useState)(`idle`);(0,q.useEffect)(()=>{c(i),d(`idle`)},[e._id,i]);let f=`__none__`,p=s!==i;async function m(){d(`saving`);try{let n={...e.config??{}};s===``||s===f?delete n.converterAgentId:n.converterAgentId=s,await t({instanceId:e._id,config:n}),d(`done`)}catch{d(`error`)}}let h=n?.agents??[];return(0,X.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,X.jsx)(`span`,{className:`oc-cdefaults__label`,children:y()}),(0,X.jsx)(`p`,{className:`oc-admin__hint`,children:_()}),(0,X.jsxs)(`div`,{className:`oc-cdefaults__inline`,children:[(0,X.jsxs)(R,{value:s===``?f:s,onValueChange:e=>c(e===f?``:e),children:[(0,X.jsx)(I,{className:`oc-cdefaults__select`,"aria-label":y(),children:(0,X.jsx)(U,{placeholder:u()})}),(0,X.jsxs)(W,{children:[(0,X.jsx)(L,{value:f,children:u()}),h.map(e=>(0,X.jsx)(L,{value:e.agentId,children:e.displayName?`${e.displayName} (${e.agentId})`:e.agentId},e.agentId))]})]}),(0,X.jsx)(P,{size:`sm`,disabled:!p||l===`saving`,onClick:()=>void m(),children:l===`saving`?o():w()})]}),l===`done`?(0,X.jsx)(`p`,{className:`oc-admin__hint`,role:`status`,children:D()}):null,l===`error`?(0,X.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:O()}):null]})}function Q({instance:e}){let t=r(a.admin.upsertInstanceConfig),n=e.config?.curationEnabled===!0,c=typeof e.config?.curationBudgetChars==`number`?e.config.curationBudgetChars:null,[l,u]=(0,q.useState)(n),[d,f]=(0,q.useState)(c===null?``:String(c)),[p,m]=(0,q.useState)(`idle`);(0,q.useEffect)(()=>{u(n),f(c===null?``:String(c)),m(`idle`)},[e._id,n,c]);let h=d.trim(),g=h===``?null:/^\d+$/.test(h)?Number.parseInt(h,10):NaN,_=!l||g===null||Number.isInteger(g)&&g>=4e3&&g<=6e4,y=l!==n||(g??null)!==c;async function b(){m(`saving`);try{let n={...e.config??{}};n.curationEnabled=l,!l||g===null||Number.isNaN(g)?delete n.curationBudgetChars:n.curationBudgetChars=g,await t({instanceId:e._id,config:n}),m(`done`)}catch{m(`error`)}}return(0,X.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,X.jsxs)(`label`,{className:`oc-cdefaults__inline`,style:{cursor:`pointer`},children:[(0,X.jsx)(H,{checked:l,onCheckedChange:e=>u(e===!0),"aria-label":s()}),(0,X.jsx)(`span`,{className:`oc-cdefaults__label`,children:s()})]}),(0,X.jsxs)(`div`,{className:`oc-cdefaults__inline`,children:[(0,X.jsx)(V,{type:`number`,min:4e3,max:6e4,step:1e3,placeholder:`20000`,value:d,onChange:e=>f(e.target.value),className:`oc-cdefaults__number`,"aria-invalid":!_,"aria-label":v(),disabled:!l}),(0,X.jsx)(P,{size:`sm`,disabled:!y||!_||p===`saving`,onClick:()=>void b(),children:p===`saving`?o():w()})]}),_?null:(0,X.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:i()}),p===`done`?(0,X.jsx)(`p`,{className:`oc-admin__hint`,role:`status`,children:D()}):null,p===`error`?(0,X.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:O()}):null,(0,X.jsx)(`p`,{className:`oc-cdefaults__help`,children:N()})]})}function $({instance:e}){let t=r(a.admin.upsertInstanceConfig),n=typeof e.config?.summarizeThresholdChars==`number`?e.config.summarizeThresholdChars:null,[i,s]=(0,q.useState)(n===null?``:String(n)),[c,l]=(0,q.useState)(`idle`);(0,q.useEffect)(()=>{s(n===null?``:String(n)),l(`idle`)},[e._id,n]);let u=i.trim(),f=u===``?null:/^\d+$/.test(u)?Number.parseInt(u,10):NaN,p=f===null||Number.isInteger(f)&&f>=1e3&&f<=2e5,m=(f??null)!==n;async function g(){l(`saving`);try{let n={...e.config??{}};f===null?delete n.summarizeThresholdChars:n.summarizeThresholdChars=f,await t({instanceId:e._id,config:n}),l(`done`)}catch{l(`error`)}}return(0,X.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,X.jsx)(`span`,{className:`oc-cdefaults__label`,children:k()}),(0,X.jsxs)(`div`,{className:`oc-cdefaults__inline`,children:[(0,X.jsx)(V,{type:`number`,min:1e3,max:2e5,step:1e3,placeholder:`8000`,value:i,onChange:e=>s(e.target.value),className:`oc-cdefaults__number`,"aria-invalid":!p}),(0,X.jsx)(P,{size:`sm`,disabled:!m||!p||c===`saving`,onClick:()=>void g(),children:c===`saving`?o():w()})]}),p?null:(0,X.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:h()}),c===`done`?(0,X.jsx)(`p`,{className:`oc-admin__hint`,role:`status`,children:D()}):null,c===`error`?(0,X.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:O()}):null,(0,X.jsx)(`p`,{className:`oc-cdefaults__help`,children:d()})]})}function ee(){let e=p(a.agentFiles.getChatDefaults),[t,n]=(0,q.useState)({status:`loading`}),r=T(a.admin.listInstances,{}),[i,o]=(0,q.useState)(null);(0,q.useEffect)(()=>{!r||r.length===0||(!i||!r.some(e=>e.name===i))&&o(r[0].name)},[r,i]);let s=(r?.length??0)>1,u=r!==void 0&&r.length===0,d=T(a.compat.forInstance,i?{instanceName:i}:`skip`),h=i?G(d,`configDefaults`):`loading`,_=h===`loading`?null:h.blocked,v=(0,q.useMemo)(()=>s&&i?{instanceName:i}:{},[s,i]),y=(0,q.useRef)(0),w=(0,q.useCallback)(async()=>{let t=++y.current;n({status:`loading`});try{let r=Y(await e(v));if(y.current!==t)return;n({status:`done`,current:r})}catch{if(y.current!==t)return;n({status:`error`})}},[e,v]);(0,q.useEffect)(()=>{_===!1&&(s&&!i||w())},[w,_,s,i]);let D=t.status===`done`?t.current:null,O=(0,q.useMemo)(()=>J.map(e=>({id:e,label:B(e)})),[]),k=(0,q.useMemo)(()=>[{id:`fast`,label:E()},{id:`standard`,label:m()}],[]);return(0,X.jsxs)(`div`,{className:`oc-cdefaults`,children:[(0,X.jsx)(`p`,{className:`oc-admin__hint`,children:j()}),s&&i?(0,X.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,X.jsx)(`span`,{className:`oc-cdefaults__label`,children:b()}),(0,X.jsxs)(R,{value:i,onValueChange:e=>o(e),children:[(0,X.jsx)(I,{size:`sm`,"aria-label":b(),children:(0,X.jsx)(U,{})}),(0,X.jsx)(W,{children:(r??[]).map(e=>(0,X.jsx)(L,{value:e.name,children:e.name},e.name))})]})]}):null,u?(0,X.jsx)(`p`,{className:`oc-admin__hint`,role:`status`,children:l()}):h===`loading`?(0,X.jsx)(`p`,{className:`oc-admin__hint`,children:g()}):h.blocked?(0,X.jsxs)(`p`,{className:`oc-compat__blocked`,role:`status`,children:[(0,X.jsx)(F,{size:14,"aria-hidden":!0}),` `,K(h.gatewayVersion,h.provider)]}):t.status===`loading`?(0,X.jsx)(`p`,{className:`oc-admin__hint`,children:g()}):t.status===`error`?(0,X.jsxs)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:[C(),` `,(0,X.jsx)(P,{variant:`outline`,size:`sm`,onClick:()=>void w(),children:f()})]}):(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,X.jsx)(`span`,{className:`oc-cdefaults__label`,children:S()}),(0,X.jsx)(z,{options:O,value:D?.thinkingDefault??null,onChange:()=>{},disabled:!0}),(0,X.jsx)(`p`,{className:`oc-cdefaults__help`,children:M()})]}),(0,X.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,X.jsx)(`span`,{className:`oc-cdefaults__label`,children:A()}),(0,X.jsx)(z,{options:k,value:D===null||D.fastModeDefault===null?null:D.fastModeDefault?`fast`:`standard`,onChange:()=>{},disabled:!0}),(0,X.jsx)(`p`,{className:`oc-cdefaults__help`,children:x()})]}),(0,X.jsx)(`p`,{className:`oc-cdefaults__note`,children:c()})]}),(()=>{let e=r?.find(e=>e.name===(i??r[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{Bf as r,Hf as i,If as a,Lf as o,Rf as s,Vf as c,zf as l}from"./dist-
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Bf as r,Hf as i,If as a,Lf as o,Rf as s,Vf as c,zf as l}from"./dist-CHawRMT8.js";import{i as u,r as d}from"./dist-bebyRR79.js";import{t as f}from"./chevrons-up-down-BvfCZOnB.js";import{t as p}from"./button-BC70Om4X.js";import{Ht as m,It as h,it as g,jt as _,nt as v,ot as y,p as b,rt as x,st as S}from"./index-C4W6RiZP.js";import{a as C,i as w,n as T,o as E,r as D,t as O}from"./table-poMaV2RU.js";var k=t(e(),1);function A(e,t){return typeof e==`number`&&typeof t==`number`?e-t:typeof e==`boolean`&&typeof t==`boolean`?!!e-+!!t:String(e).localeCompare(String(t),void 0,{numeric:!0,sensitivity:`base`})}function j(e,t,n){return[...e].sort((e,r)=>{let i=t(e),a=t(r),o=i==null,s=a==null;if(o||s)return o&&s?0:o?1:-1;let c=A(i,a);return n===`asc`?c:-c})}var M=n();function N({title:e,rows:t,columns:n,rowActions:A,onAdd:N,addLabel:P=i(),bulkActions:F,emptyHint:I=c(),isExpanded:L,renderExpanded:R}){let[z,B]=(0,k.useState)(new Set),[V,H]=(0,k.useState)(null),U=t??[],W=V?n[V.index]:void 0,G=V&&W?.sort?j(U,W.sort,V.dir):U;function K(e){H(t=>!t||t.index!==e?{index:e,dir:`asc`}:t.dir===`asc`?{index:e,dir:`desc`}:null)}let q=+!!F+n.length+ +!!A,J=U.length>0&&z.size===U.length,Y=z.size>0&&!J;function X(){B(J?new Set:new Set(U.map(e=>e._id)))}function Z(e){B(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})}return(0,M.jsxs)(`div`,{className:`oc-dt`,children:[(0,M.jsxs)(`div`,{className:`oc-dt__bar`,children:[(0,M.jsx)(`h2`,{className:`oc-dt__title`,children:e}),(0,M.jsxs)(`div`,{className:`oc-dt__bar-actions`,children:[z.size>0&&F?F.map(e=>(0,M.jsxs)(p,{size:`sm`,variant:e.variant===`destructive`?`destructive`:`outline`,onClick:()=>{e.onSelect([...z]),B(new Set)},children:[e.variant===`destructive`?(0,M.jsx)(_,{}):null,e.label,` (`,z.size,`)`]},e.label)):null,N?(0,M.jsxs)(p,{size:`sm`,onClick:N,children:[(0,M.jsx)(h,{}),` `,P]}):null]})]}),t===void 0?(0,M.jsx)(`p`,{className:`oc-admin__hint`,children:r()}):U.length===0?(0,M.jsx)(`p`,{className:`oc-admin__hint`,children:I}):(0,M.jsxs)(O,{children:[(0,M.jsx)(C,{children:(0,M.jsxs)(E,{children:[F?(0,M.jsx)(w,{className:`w-8`,children:(0,M.jsx)(b,{"aria-label":l(),checked:J?!0:Y?`indeterminate`:!1,onCheckedChange:X})}):null,n.map((e,t)=>{let n=V?.index===t;return e.sort?(0,M.jsx)(w,{className:e.className,"aria-sort":n?V.dir===`asc`?`ascending`:`descending`:`none`,children:(0,M.jsxs)(`button`,{type:`button`,className:`oc-dt__sort`,onClick:()=>K(t),"aria-label":a({column:e.header}),children:[e.header,n?V.dir===`asc`?(0,M.jsx)(d,{className:`oc-dt__sort-icon`,"aria-hidden":!0}):(0,M.jsx)(u,{className:`oc-dt__sort-icon`,"aria-hidden":!0}):(0,M.jsx)(f,{className:`oc-dt__sort-icon oc-dt__sort-icon--idle`,"aria-hidden":!0})]})},e.header):(0,M.jsx)(w,{className:e.className,children:e.header},e.header)}),A?(0,M.jsx)(w,{className:`w-8`}):null]})}),(0,M.jsx)(T,{children:G.map(e=>{let t=A?.(e)??[],r=L?.(e)??!1;return(0,M.jsxs)(k.Fragment,{children:[(0,M.jsxs)(E,{className:`group/row`,children:[F?(0,M.jsx)(D,{children:(0,M.jsx)(b,{"aria-label":s(),checked:z.has(e._id),onCheckedChange:()=>Z(e._id)})}):null,n.map(t=>(0,M.jsx)(D,{className:t.className,children:t.cell(e)},t.header)),A?(0,M.jsx)(D,{children:t.length>0?(0,M.jsxs)(v,{children:[(0,M.jsx)(S,{asChild:!0,children:(0,M.jsx)(p,{variant:`ghost`,size:`icon-sm`,"aria-label":o(),className:`opacity-0 transition-opacity group-hover/row:opacity-100 group-focus-within/row:opacity-100 aria-expanded:opacity-100`,children:(0,M.jsx)(m,{})})}),(0,M.jsx)(x,{align:`end`,children:t.map((t,n)=>(0,M.jsxs)(`div`,{children:[t.variant===`destructive`&&n>0?(0,M.jsx)(y,{}):null,(0,M.jsx)(g,{variant:t.variant,onSelect:()=>t.onSelect(e),children:t.label})]},t.label))})]}):null}):null]}),r&&R?(0,M.jsx)(E,{className:`oc-dt__expansion`,children:(0,M.jsx)(D,{colSpan:q,className:`oc-dt__expansion-cell`,children:R(e)})}):null]},e._id)})})]})]})}export{N as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./bundle-mjs-C73ZY4La.js";import{ct as t}from"./index-
|
|
1
|
+
import{r as e}from"./bundle-mjs-C73ZY4La.js";import{ct as t}from"./index-C4W6RiZP.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{$C as r,AC as i,AM as a,BC as o,CC as s,DC as c,E as l,EC as u,FC as d,GC as f,HC as p,IC as m,JC as ee,KC as te,LC as ne,MC as re,NC as h,OC as g,PC as ie,QC as _,RC as ae,SC as v,TC as y,UC as b,VC as x,WC as S,XC as C,YC as w,ZC as T,_C as E,aC as D,ai as O,aw as k,bC as A,cC as j,dC as M,ew as N,fC as P,gC as F,hC as I,iC as L,iw as R,jC as z,jM as B,kC as V,lC as H,mC as U,nw as oe,oC as W,pC as G,qC as K,ri as q,rw as se,sC as ce,tw as le,uC as ue,vC as de,wC as fe,xC as pe,yC as me,zC as J}from"./dist-CHawRMT8.js";import{t as he}from"./button-BC70Om4X.js";import{B as ge,et as _e}from"./index-C4W6RiZP.js";import{t as ve}from"./DataTableShell-CuO0YQq6.js";var Y=t(e(),1),X=n(),Z={altered_words:()=>k(),incorrect:()=>R(),incoherence:()=>se(),formatting:()=>oe(),latency:()=>le(),api_error:()=>N(),other:()=>r()},Q=e=>Z[e]?.()??e;function $({matches:e,sourceWasOpen:t}){return t?e===!0?(0,X.jsx)(`span`,{className:`oc-fbadmin__pill is-ok`,children:T()}):e===!1?(0,X.jsx)(`span`,{className:`oc-fbadmin__pill is-warn`,children:C()}):(0,X.jsx)(`span`,{className:`oc-fbadmin__pill`,children:`—`}):(0,X.jsx)(`span`,{className:`oc-fbadmin__pill`,children:_()})}function ye({data:e,closeReason:t}){let n=e.snapshot,r=a(l.feedback.respondToFeedback),[s,c]=(0,Y.useState)(e.thread),[u,g]=(0,Y.useState)(``),[_,v]=(0,Y.useState)(!1);async function y(){let t=u.trim();if(!(!t||_)){v(!0);try{await r({feedbackId:e._id,text:t}),c(e=>[...e,{authorRole:`admin`,text:t,at:Date.now()}]),g(``)}finally{v(!1)}}}let C=[];try{C=n.contextJson?JSON.parse(n.contextJson):[]}catch{C=[]}return(0,X.jsxs)(`div`,{className:`oc-fbadmin__detail`,children:[(0,X.jsxs)(`div`,{className:`oc-fbadmin__row`,children:[(0,X.jsx)($,{matches:n.displayedMatchesStored,sourceWasOpen:n.clientInfo?.sourceWasOpen??!1}),(0,X.jsxs)(`span`,{className:`oc-fbadmin__meta`,children:[Q(e.category),` · `,n.messageRole,n.isRegeneration?` · ${w()}`:``,n.openclawModel?` · ${n.openclawModel}`:``,n.openclawRuntime?` (${n.openclawRuntime})`:``]})]}),e.comment?(0,X.jsxs)(`section`,{children:[(0,X.jsx)(`h4`,{className:`oc-fbadmin__h`,children:ee()}),(0,X.jsx)(`p`,{className:`oc-fbadmin__comment`,children:e.comment})]}):null,t?(0,X.jsxs)(`section`,{children:[(0,X.jsx)(`h4`,{className:`oc-fbadmin__h`,children:ue()}),(0,X.jsx)(`p`,{className:`oc-fbadmin__comment`,children:t})]}):null,(0,X.jsxs)(`section`,{children:[(0,X.jsx)(`h4`,{className:`oc-fbadmin__h`,children:K()}),s.length>0?(0,X.jsx)(`div`,{className:`oc-fbadmin__thread`,children:s.map((e,t)=>(0,X.jsxs)(`div`,{className:`oc-notif__msg oc-notif__msg--${e.authorRole}`,children:[(0,X.jsx)(`span`,{className:`oc-notif__msg-who`,children:e.authorRole===`admin`?te():e.authorRole===`agent`?e.authorLabel??O():f()}),(0,X.jsx)(`span`,{className:`oc-notif__msg-text`,children:e.text})]},t))}):(0,X.jsx)(`p`,{className:`oc-fbadmin__meta`,children:S()}),(0,X.jsx)(`textarea`,{className:`oc-feedback__textarea`,placeholder:b(),value:u,maxLength:2e3,rows:3,onChange:e=>g(e.target.value.slice(0,2e3))}),(0,X.jsx)(`div`,{className:`oc-fbadmin__row`,style:{justifyContent:`flex-end`},children:(0,X.jsx)(he,{size:`sm`,onClick:()=>void y(),disabled:!u.trim()||_,children:_?p():x()})})]}),(0,X.jsxs)(`section`,{children:[(0,X.jsx)(`h4`,{className:`oc-fbadmin__h`,children:o()}),(0,X.jsx)(`pre`,{className:`oc-msg__source-pre`,children:n.messageText||J()})]}),n.clientInfo?.sourceWasOpen&&n.displayedText!==void 0?(0,X.jsxs)(`section`,{children:[(0,X.jsx)(`h4`,{className:`oc-fbadmin__h`,children:ae()}),(0,X.jsx)(`pre`,{className:`oc-msg__source-pre`,children:n.displayedText||J()})]}):null,n.promptText?(0,X.jsxs)(`section`,{children:[(0,X.jsx)(`h4`,{className:`oc-fbadmin__h`,children:ne()}),(0,X.jsx)(`pre`,{className:`oc-msg__source-pre`,children:n.promptText})]}):null,C.length>0?(0,X.jsxs)(`section`,{children:[(0,X.jsx)(`h4`,{className:`oc-fbadmin__h`,children:m({count:n.contextCount??C.length,truncated:n.contextTruncated?d():``})}),(0,X.jsx)(`div`,{className:`oc-fbadmin__ctx`,children:C.map((e,t)=>(0,X.jsxs)(`div`,{className:`oc-fbadmin__ctx-turn`,children:[(0,X.jsx)(`span`,{className:`oc-fbadmin__ctx-role`,children:e.role}),(0,X.jsx)(`span`,{className:`oc-fbadmin__ctx-text`,children:e.text})]},t))})]}):null,n.outboxAvailable?(0,X.jsxs)(`section`,{children:[(0,X.jsx)(`h4`,{className:`oc-fbadmin__h`,children:ie()}),(0,X.jsxs)(`pre`,{className:`oc-msg__source-pre`,children:[n.outboxText??``,n.outboxStatus?`\n[status: ${n.outboxStatus}]`:``]})]}):null,n.clientInfo?.extensionsDetected&&n.clientInfo.extensionsDetected.length>0?(0,X.jsxs)(`section`,{children:[(0,X.jsx)(`h4`,{className:`oc-fbadmin__h`,children:h()}),(0,X.jsx)(`div`,{className:`oc-fbadmin__row`,children:n.clientInfo.extensionsDetected.map(e=>(0,X.jsx)(`span`,{className:`oc-fbadmin__pill is-warn`,children:e},e))})]}):null,(0,X.jsxs)(`section`,{children:[(0,X.jsx)(`h4`,{className:`oc-fbadmin__h`,children:re()}),(0,X.jsxs)(`p`,{className:`oc-fbadmin__env`,children:[[n.clientInfo?.language,n.clientInfo?.timezone,n.clientInfo?.theme?z({theme:n.clientInfo.theme}):null,n.runId?`run ${n.runId.slice(0,12)}…`:null].filter(Boolean).join(` · `)||`—`,n.clientInfo?.plugins&&n.clientInfo.plugins.length>0?(0,X.jsxs)(`span`,{className:`oc-fbadmin__plugins`,children:[i(),` `,n.clientInfo.plugins.join(`, `),(0,X.jsxs)(`span`,{className:`oc-fbadmin__note`,children:[` `,V()]})]}):null,n.clientInfo?.userAgent?(0,X.jsx)(`span`,{className:`oc-fbadmin__ua`,children:n.clientInfo.userAgent}):null]})]})]})}function be(){let e=B(l.feedback.listForAdmin,{}),t=a(l.feedback.readSnapshot),n=a(l.feedback.deleteFeedback),r=ge(),[i,o]=(0,Y.useState)(null),[d,f]=(0,Y.useState)({});async function p(e){if(i===e._id){o(null);return}if(!d[e._id]){let n=await t({feedbackId:e._id});f(t=>({...t,[e._id]:n}))}o(e._id)}async function m(e){await r({title:W(),description:D(),confirmLabel:L(),destructive:!0})&&(await n({feedbackId:e._id}),i===e._id&&o(null))}return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`p`,{className:`oc-admin__hint`,children:[g(),` `,(0,X.jsx)(`strong`,{children:c()}),` `,u()]}),(0,X.jsx)(ve,{title:y(),rows:e,emptyHint:fe(),isExpanded:e=>i===e._id&&!!d[e._id],renderExpanded:e=>d[e._id]?(0,X.jsx)(ye,{data:d[e._id],closeReason:e.userCloseReason}):null,columns:[{header:s(),cell:e=>_e(e.at),sort:e=>e.at},{header:v(),cell:e=>Q(e.category),sort:e=>Q(e.category)},{header:pe(),cell:e=>e.messageRole===`user`?A():me(),sort:e=>e.messageRole},{header:de(),cell:e=>(e.reporterEmail||e.reporterName||`—`)+(e.impersonated&&e.realOperatorEmail?` ${E({operator:e.realOperatorEmail})}`:``),sort:e=>e.reporterEmail||e.reporterName||null},{header:F(),cell:e=>(0,X.jsx)($,{matches:e.displayedMatchesStored,sourceWasOpen:e.sourceWasOpen}),sort:e=>e.displayedMatchesStored===!1?0:e.displayedMatchesStored===!0?1:2},{header:I(),cell:e=>e.hasComment?`✎`:`—`,sort:e=>+!!e.hasComment},{header:U(),cell:e=>e.userClosedAt==null?e.resolvedAt==null?e.answered?(0,X.jsx)(`span`,{className:`oc-fbadmin__pill is-ok`,children:G()}):(0,X.jsx)(`span`,{className:`oc-fbadmin__pill`,children:P()}):(0,X.jsx)(`span`,{className:`oc-fbadmin__pill is-ok`,title:e.resolvedBy??void 0,children:q()}):(0,X.jsx)(`span`,{className:`oc-fbadmin__pill is-closed`,children:M()}),sort:e=>e.userClosedAt==null?e.resolvedAt==null?+!!e.answered:2:3}],rowActions:e=>[{label:i===e._id?H():j(),onSelect:()=>void p(e)},{label:ce(),onSelect:()=>void m(e),variant:`destructive`}]})]})}export{be as FeedbacksTab};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{r as e}from"./bundle-mjs-C73ZY4La.js";import{D as t,
|
|
1
|
+
import{r as e}from"./bundle-mjs-C73ZY4La.js";import{D as t,RM as n}from"./dist-CHawRMT8.js";import{_ as r,g as i,h as a,v as o}from"./index-C4W6RiZP.js";import"./locales-CPjguROj.js";import"./curation-CQksaIbm.js";var s=t(`circle-question-mark`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3`,key:`1u773s`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]]),c={media_delivery:{key:`media_delivery`,appliedIn:`bridge`,togglable:!0,placeholders:[`outboundDir`],defaultTemplate:{fr:`[LIVRAISON]
|
|
2
2
|
Pour qu'un fichier que tu génères soit téléchargeable par l'utilisateur dans ce webchat : écris-le sous {outboundDir}/ puis ajoute, dans ta réponse finale, une ligne dédiée EXACTEMENT au format MEDIA:<chemin absolu du fichier>. N'utilise PAS de lien markdown vers un chemin local — il ne serait pas cliquable.`,en:`[DELIVERY]
|
|
3
3
|
To make a file you generate downloadable by the user in this webchat: write it under {outboundDir}/ then add, in your final reply, a dedicated line EXACTLY in the format MEDIA:<absolute file path>. Do NOT use a markdown link to a local path — it would not be clickable.`}},documentary_fetch:{key:`documentary_fetch`,appliedIn:`convex`,togglable:!0,placeholders:[`references`],defaultTemplate:{fr:`Fournis les fichiers source téléchargeables correspondant EXACTEMENT à ces références de documents (un fichier par référence, nommé d'après la référence). Réponds uniquement avec les fichiers, sans commentaire :
|
|
4
4
|
{references}`,en:`Provide the downloadable source files matching EXACTLY these document references (one file per reference, named after the reference). Reply only with the files, no commentary:
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$j as r,AM as ee,Aj as te,Bj as i,Cj as ne,Dj as re,E as a,Ej as ie,Fj as ae,Gj as o,Hj as s,Ij as c,Jj as l,Kj as u,Lj as d,Mj as oe,Nj as se,Oj as ce,Pj as le,Qj as f,Rj as ue,SM as de,Sj as fe,Tj as pe,Uj as p,Vj as m,Wj as h,Xj as me,Yj as he,Zj as ge,ci as _e,eM as ve,iD as ye,jM as be,jj as xe,kj as g,li as _,nM as v,qj as y,tM as b,wM as x,wj as S,xj as C,zj as w}from"./dist-CHawRMT8.js";import{t as T}from"./button-BC70Om4X.js";import{C as E,Ft as D,G as O,H as k,Ht as A,J as j,K as M,S as N,U as Se,Ut as P,W as Ce,Y as we,b as F,ct as I,it as L,jt as Te,nt as Ee,p as De,q as Oe,rt as ke,st as Ae,w as R,x as z,z as je}from"./index-C4W6RiZP.js";import{a as Me,i as B,n as Ne,o as V,r as H,t as Pe}from"./table-poMaV2RU.js";var U=t(e(),1),W=n(),G=`all`;function K(e){switch(e){case`image`:return o();case`audio`:return h();case`video`:return p();case`pdf`:return s();case`document`:return m();case`archive`:return i();default:return w()}}function q(){let[e,t]=(0,U.useState)(G),[n,i]=(0,U.useState)(G),[o,s]=(0,U.useState)(G),[p,m]=(0,U.useState)(G),[h,w]=(0,U.useState)(!1),[q,J]=(0,U.useState)(null),Fe=ee(a.files.softDelete),Y=je();function Ie(){t(G),i(G),s(G),m(G)}async function Le(){let e=q;if(J(null),e)try{await Fe({fileId:e.id}),Y.success(ce())}catch(e){Y.error(re(),e)}}let X=be(a.files.listMine,{direction:e===G?void 0:e,chatId:n===G?void 0:n,instanceName:o===G?void 0:o,category:p===G?void 0:p,includeAutoGenerated:h||void 0}),Re=(0,U.useMemo)(()=>new Intl.DateTimeFormat(x(),{dateStyle:`medium`,timeStyle:`short`}),[]);if(X===void 0)return(0,W.jsx)(`p`,{className:`oc-admin__hint`,children:de()});let{files:Z,facets:Q,truncated:ze,cap:Be}=X,$=e!==G||n!==G||o!==G||p!==G;return(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`p`,{className:`oc-admin__hint`,children:v()}),(0,W.jsxs)(`div`,{className:`oc-files__filters`,style:{display:`flex`,flexWrap:`wrap`,gap:8,margin:`12px 0`},children:[(0,W.jsxs)(F,{value:e,onValueChange:t,children:[(0,W.jsx)(E,{size:`sm`,"aria-label":b(),children:(0,W.jsx)(R,{})}),(0,W.jsxs)(z,{children:[(0,W.jsx)(N,{value:G,children:ve()}),(0,W.jsx)(N,{value:`inbound`,children:r()}),(0,W.jsx)(N,{value:`outbound`,children:f()})]})]}),(0,W.jsxs)(F,{value:n,onValueChange:i,children:[(0,W.jsx)(E,{size:`sm`,"aria-label":ge(),children:(0,W.jsx)(R,{})}),(0,W.jsxs)(z,{children:[(0,W.jsx)(N,{value:G,children:me()}),Q.chats.map(e=>(0,W.jsx)(N,{value:e.id,children:e.title},e.id))]})]}),Q.multiProvider?(0,W.jsxs)(F,{value:o,onValueChange:s,children:[(0,W.jsx)(E,{size:`sm`,"aria-label":he(),children:(0,W.jsx)(R,{})}),(0,W.jsxs)(z,{children:[(0,W.jsx)(N,{value:G,children:l()}),Q.instances.map(e=>(0,W.jsx)(N,{value:e,children:e},e))]})]}):null,(0,W.jsxs)(F,{value:p,onValueChange:m,children:[(0,W.jsx)(E,{size:`sm`,"aria-label":y(),children:(0,W.jsx)(R,{})}),(0,W.jsxs)(z,{children:[(0,W.jsx)(N,{value:G,children:u()}),Q.categories.map(e=>(0,W.jsx)(N,{value:e,children:K(e)},e))]})]}),(0,W.jsxs)(`label`,{className:`oc-files__autogen`,children:[(0,W.jsx)(De,{checked:h,onCheckedChange:e=>w(e===!0),"aria-label":_()}),(0,W.jsx)(`span`,{children:_()})]}),$?(0,W.jsxs)(T,{variant:`ghost`,size:`sm`,onClick:Ie,style:{display:`inline-flex`,alignItems:`center`,gap:4,marginLeft:`auto`},children:[(0,W.jsx)(D,{size:14,"aria-hidden":!0}),xe()]}):null]}),Z.length===0?(0,W.jsx)(`p`,{className:`oc-admin__hint`,children:$?fe():ne()}):(0,W.jsxs)(W.Fragment,{children:[(0,W.jsxs)(Pe,{children:[(0,W.jsx)(Me,{children:(0,W.jsxs)(V,{children:[(0,W.jsx)(B,{children:ue()}),(0,W.jsx)(B,{children:d()}),(0,W.jsx)(B,{children:c()}),(0,W.jsx)(B,{children:ae()}),(0,W.jsx)(B,{children:le()}),(0,W.jsx)(B,{className:`text-right`,children:se()})]})}),(0,W.jsx)(Ne,{children:Z.map(e=>(0,W.jsxs)(V,{children:[(0,W.jsxs)(H,{className:`font-medium`,style:{maxWidth:280,overflow:`hidden`,textOverflow:`ellipsis`},title:e.filename,children:[e.filename,e.origin===`pasted`?(0,W.jsx)(I,{variant:`outline`,style:{marginLeft:6},children:_e()}):null]}),(0,W.jsx)(H,{title:e.mimeType,children:K(e.category)}),(0,W.jsx)(H,{children:(0,W.jsx)(I,{variant:`secondary`,children:e.direction===`inbound`?r():f()})}),(0,W.jsx)(H,{style:{maxWidth:220,overflow:`hidden`,textOverflow:`ellipsis`},title:e.chatTitle,children:e.chatTitle}),(0,W.jsx)(H,{className:`whitespace-nowrap text-muted-foreground`,children:Re.format(e.createdAt)}),(0,W.jsx)(H,{className:`text-right`,children:(0,W.jsxs)(Ee,{children:[(0,W.jsx)(Ae,{asChild:!0,children:(0,W.jsx)(T,{variant:`ghost`,size:`icon`,"aria-label":te(),children:(0,W.jsx)(A,{size:16})})}),(0,W.jsxs)(ke,{align:`end`,children:[e.url?(0,W.jsx)(L,{asChild:!0,children:(0,W.jsxs)(`a`,{href:e.url,download:e.filename,target:`_blank`,rel:`noopener noreferrer`,children:[(0,W.jsx)(P,{size:14}),oe()]})}):(0,W.jsxs)(L,{disabled:!0,children:[(0,W.jsx)(P,{size:14}),S()]}),(0,W.jsxs)(L,{variant:`destructive`,onSelect:()=>J({id:e._id,filename:e.filename}),children:[(0,W.jsx)(Te,{size:14}),g()]})]})]})})]},e._id))})]}),ze?(0,W.jsx)(`p`,{className:`oc-admin__hint`,style:{marginTop:8},children:C({cap:Be})}):null]}),(0,W.jsx)(k,{open:q!==null,onOpenChange:e=>!e&&J(null),children:(0,W.jsxs)(O,{children:[(0,W.jsxs)(j,{children:[(0,W.jsx)(we,{children:ie()}),(0,W.jsx)(M,{children:pe()})]}),(0,W.jsxs)(Oe,{children:[(0,W.jsx)(Ce,{children:ye()}),(0,W.jsx)(Se,{onClick:()=>void Le(),children:g()})]})]})})]})}export{q as FilesTab};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Uf as r,Wf as i}from"./dist-
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Uf as r,Wf as i}from"./dist-CHawRMT8.js";import{t as a}from"./button-BC70Om4X.js";import{Ft as o,Pt as s,lt as c}from"./index-C4W6RiZP.js";import{t as l}from"./TimeRangePicker-CcvYUnNz.js";var u=t(e(),1),d=n(),f=250;function p({q:e,onQChange:t,searchPlaceholder:n=i(),children:p,timeRange:m,onTimeRangeChange:h,onReset:g,canReset:_=!0}){let[v,y]=(0,u.useState)(e);(0,u.useEffect)(()=>{y(e)},[e]);let b=(0,u.useRef)(null);function x(e){y(e),b.current!==null&&window.clearTimeout(b.current),b.current=window.setTimeout(()=>t(e),f)}(0,u.useEffect)(()=>()=>{b.current!==null&&window.clearTimeout(b.current)},[]);function S(){b.current!==null&&window.clearTimeout(b.current),g()}return(0,d.jsxs)(`div`,{className:`oc-filterbar`,children:[(0,d.jsxs)(`div`,{className:`oc-filterbar__search`,children:[(0,d.jsx)(s,{className:`oc-filterbar__search-icon`,"aria-hidden":!0}),(0,d.jsx)(c,{value:v,onChange:e=>x(e.target.value),placeholder:n,"aria-label":n})]}),p?(0,d.jsx)(`div`,{className:`oc-filterbar__quick`,children:p}):null,m&&h?(0,d.jsx)(l,{value:m,onChange:h}):null,(0,d.jsxs)(a,{variant:`ghost`,size:`sm`,className:`oc-filterbar__reset`,onClick:S,disabled:!_,children:[(0,d.jsx)(o,{}),r()]})]})}export{p as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$l as r,$u as i,AM as a,Au as o,Bu as s,Cu as c,D as l,Du as u,E as d,Eu as f,Fu as p,Gu as m,Hu as h,Iu as g,Jl as _,Ju as v,Ku as y,Lu as b,Mu as x,Nu as S,Ou as C,Pu as w,Ql as T,Qu as E,Ru as ee,Su as D,Tu as O,Uu as k,Vu as A,Wu as te,Xl as j,Xu as M,Yl as ne,Yu as re,Zl as N,Zu as P,_u as F,au as I,bu as ie,cu as L,du as ae,ed as R,eu as oe,fu as se,gu as ce,hu as le,iu as ue,jM as z,ju as de,ku as fe,lu as pe,mu as me,nd as he,nu as ge,ou as _e,pu as ve,ql as ye,qu as be,ru as xe,su as Se,td as Ce,tu as we,uu as Te,vu as B,wu as Ee,xu as De,yu as Oe,zu as ke}from"./dist-CHawRMT8.js";import{t as Ae}from"./x-B5cgu3rn.js";import{i as V,n as H,r as je,t as Me}from"./tabs-CYZIFsUm.js";import{t as U}from"./button-BC70Om4X.js";import{B as Ne,C as Pe,Jt as Fe,Mt as W,Nt as G,S as Ie,b as Le,ct as K,dt as Re,ft as ze,ht as Be,lt as q,mt as Ve,p as J,qt as He,u as Ue,ut as We,w as Ge,x as Ke,xt as qe,z as Y}from"./index-C4W6RiZP.js";import{t as Je}from"./FilterBar-DEFwQ8Ux.js";import{t as Ye}from"./DataTableShell-CuO0YQq6.js";import{t as X}from"./DetailChips-Dej1ecl_.js";var Xe=l(`palette`,[[`path`,{d:`M12 22a1 1 0 0 1 0-20 10 9 0 0 1 10 9 5 5 0 0 1-5 5h-2.25a1.75 1.75 0 0 0-1.4 2.8l.3.4a1.75 1.75 0 0 1-1.4 2.8z`,key:`e79jfc`}],[`circle`,{cx:`13.5`,cy:`6.5`,r:`.5`,fill:`currentColor`,key:`1okk4w`}],[`circle`,{cx:`17.5`,cy:`10.5`,r:`.5`,fill:`currentColor`,key:`f64h9f`}],[`circle`,{cx:`6.5`,cy:`12.5`,r:`.5`,fill:`currentColor`,key:`qy21gx`}],[`circle`,{cx:`8.5`,cy:`7.5`,r:`.5`,fill:`currentColor`,key:`fotxhn`}]]),Ze=l(`shield-check`,[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`,key:`oel41y`}],[`path`,{d:`m9 12 2 2 4-4`,key:`dzmm74`}]]),Qe=l(`users`,[[`path`,{d:`M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2`,key:`1yyitq`}],[`path`,{d:`M16 3.128a4 4 0 0 1 0 7.744`,key:`16gr8j`}],[`path`,{d:`M22 21v-2a4 4 0 0 0-3-3.87`,key:`kshegd`}],[`circle`,{cx:`9`,cy:`7`,r:`4`,key:`nufk8`}]]),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 c();case`user`:return D();case`pending`:return De();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=z(d.groups.listGroups,{}),t=z(d.me.getMe,{host:qe})?.role===`admin`,n=a(d.groups.createGroup),r=a(d.groups.updateGroup),o=a(d.groups.deleteGroup),c=Ne(),l=Y(),[u,f]=(0,Z.useState)(!1),[_,x]=(0,Z.useState)(null),[S,C]=(0,Z.useState)($),[w,T]=(0,Z.useState)(null),[D,O]=(0,Z.useState)(``),N=(0,Z.useMemo)(()=>{if(!e)return e;let t=D.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,D]);function F(){x(null),C($),f(!0)}function I(e){x(e),C({name:e.name,description:e.description??``}),f(!0)}async function ie(){try{_?await r({groupId:_._id,name:S.name,description:S.description}):await n({name:S.name,description:S.description||void 0}),C($),x(null),f(!1)}catch(e){l.error(j(),e)}}async function L(e){if(await c({title:b({name:e.name}),description:g(),confirmWord:e.name,confirmLabel:p(),cancelLabel:k(),destructive:!0}))try{await o({groupId:e._id})}catch(e){l.error(ne(),e)}}return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:Ce()}),(0,Q.jsx)(Je,{q:D,onQChange:O,onReset:()=>O(``),canReset:D!==``,searchPlaceholder:v()}),(0,Q.jsx)(Ye,{title:he(),rows:N,addLabel:R(),onAdd:t?F:void 0,emptyHint:i(),columns:[{header:E(),cell:e=>e.name,sort:e=>e.name},{header:P(),cell:e=>(0,Q.jsx)(X,{icon:(0,Q.jsx)(Qe,{size:12,"aria-hidden":!0}),total:e.memberCount,items:e.members.map(e=>({label:e.label,marker:e.manager?(0,Q.jsx)(Ze,{size:11,"aria-hidden":!0}):null,highlight:e.manager}))}),sort:e=>e.memberCount},{header:M(),cell:e=>(0,Q.jsx)(X,{icon:(0,Q.jsx)(G,{size:12,"aria-hidden":!0}),total:e.agentCount,items:e.agents.map(e=>({label:e}))}),sort:e=>e.agentCount},{header:re(),cell:e=>(0,Q.jsx)(X,{icon:(0,Q.jsx)(Xe,{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:be(),onSelect:()=>T({groupId:e._id,name:e.name})},...t?[{label:y(),onSelect:()=>I(e)},{label:m(),variant:`destructive`,onSelect:()=>void L(e)}]:[]]}),(0,Q.jsx)(Ue,{open:u,onOpenChange:f,title:_?A():h(),description:s(),canSubmit:!!S.name.trim(),onSubmit:ie,submitLabel:te(),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:ke()}),(0,Q.jsx)(q,{value:S.name,onChange:e=>C({...S,name:e.target.value})})]}),(0,Q.jsxs)(`label`,{className:`oc-field`,children:[(0,Q.jsx)(`span`,{className:`oc-field__label`,children:ee()}),(0,Q.jsx)(q,{value:S.description,onChange:e=>C({...S,description:e.target.value})})]})]})}),(0,Q.jsx)(ct,{groupId:w?.groupId??null,groupName:w?.name??``,open:w!==null,onOpenChange:e=>{e||T(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)(U,{type:`button`,variant:`ghost`,size:`sm`,disabled:e<=1,onClick:()=>n(e-1),children:[(0,Q.jsx)(Fe,{size:14,"aria-hidden":!0}),f()]}),(0,Q.jsxs)(`span`,{className:`oc-access__pageinfo`,"aria-label":Ee({page:e,pages:t}),children:[e,` / `,t]}),(0,Q.jsxs)(U,{type:`button`,variant:`ghost`,size:`sm`,disabled:e>=t,onClick:()=>n(e+1),children:[O(),(0,Q.jsx)(He,{size:14,"aria-hidden":!0})]})]})}function ct({groupId:e,groupName:t,open:n,onOpenChange:i}){let s=z(d.groups.getGroup,n&&e?{groupId:e}:`skip`),c=z(d.groups.listAssignableInstances,n?{}:`skip`),l=z(d.groups.listAssignableUsers,n?{}:`skip`),f=a(d.groups.addMember),p=a(d.groups.removeMember),m=a(d.groups.bulkSetMembers),h=a(d.groups.setGroupManager),g=Y(),[v,y]=(0,Z.useState)(``),[b,E]=(0,Z.useState)(``),[ee,D]=(0,Z.useState)(`members`),[O,k]=(0,Z.useState)(1),[A,te]=(0,Z.useState)(new Set),j=(0,Z.useRef)(null),M=(0,Z.useMemo)(()=>new Set((s?.members??[]).map(e=>e.userId)),[s]),ne=(0,Z.useMemo)(()=>new Set((s?.members??[]).filter(e=>e.manager).map(e=>e.userId)),[s]),re=s?.viewerIsAdmin===!0,N=(0,Z.useMemo)(()=>new Set((s?.agents??[]).map(e=>`${e.instanceName}/${e.agentId}`)),[s]);(0,Z.useEffect)(()=>{y(``),E(``),D(`members`),k(1),j.current=null},[n,e]),(0,Z.useEffect)(()=>{k(1)},[v]),(0,Z.useEffect)(()=>{n&&s&&e&&j.current!==e&&(j.current=e,te(new Set((s.members??[]).map(e=>e.userId))))},[n,s,e]);let P=(0,Z.useMemo)(()=>l?$e(l,v,A):[],[l,v,A]);async function F(t,n){if(e)try{n?await p({groupId:e,userId:t}):await f({groupId:e,userId:t})}catch(e){g.error(_(),e)}}async function I(t,n){if(e)try{await h({groupId:e,userId:t,manager:!n})}catch(e){g.error(T(),e)}}let L=rt(P,e=>M.has(e.userId)),ae=P.filter(e=>M.has(e.userId)).length,R=it(P,O,ot);async function se(){if(!e||P.length===0)return;let t=P.map(e=>e.userId);try{await m({groupId:e,userIds:t,member:L!==`all`})}catch(e){g.error(_(),e)}}return(0,Q.jsx)(We,{open:n,onOpenChange:i,children:(0,Q.jsxs)(Re,{className:`oc-access`,children:[(0,Q.jsxs)(Ve,{children:[(0,Q.jsx)(Be,{children:w({name:t})}),(0,Q.jsx)(ze,{children:S()})]}),(0,Q.jsxs)(Me,{value:ee,onValueChange:D,className:`oc-access__tabs`,children:[(0,Q.jsxs)(je,{className:`w-full`,children:[(0,Q.jsxs)(V,{value:`members`,className:`flex-1 gap-1.5`,children:[(0,Q.jsx)(Qe,{size:13,"aria-hidden":!0}),x(),s?(0,Q.jsx)(K,{variant:`secondary`,className:`oc-access__tabcount`,children:M.size}):null]}),(0,Q.jsxs)(V,{value:`agents`,className:`flex-1 gap-1.5`,children:[(0,Q.jsx)(G,{size:13,"aria-hidden":!0}),o(),s?(0,Q.jsx)(K,{variant:`secondary`,className:`oc-access__tabcount`,children:N.size}):null]}),(0,Q.jsxs)(V,{value:`charts`,className:`flex-1 gap-1.5`,children:[(0,Q.jsx)(Xe,{size:13,"aria-hidden":!0}),pe(),s?(0,Q.jsx)(K,{variant:`secondary`,className:`oc-access__tabcount`,children:s.chartCount}):null]})]}),(0,Q.jsx)(H,{value:`members`,children:l===void 0||s===void 0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:B()}):l.length===0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:ce()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(q,{value:v,onChange:e=>y(e.target.value),placeholder:de(),className:`oc-access__search`}),P.length===0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:C()}):(0,Q.jsxs)(Q.Fragment,{children:[P.length>1?(0,Q.jsxs)(`div`,{className:`oc-access__row oc-access__selectall`,children:[(0,Q.jsx)(J,{checked:L===`all`?!0:L===`some`?`indeterminate`:!1,onCheckedChange:()=>void se(),"aria-label":u()}),(0,Q.jsx)(`span`,{className:`oc-access__label`,children:u()}),(0,Q.jsxs)(K,{variant:`outline`,className:`oc-access__count`,children:[ae,` / `,P.length]})]}):null,(0,Q.jsx)(`div`,{className:`oc-access__list`,children:R.pageItems.map(e=>{let t=M.has(e.userId),n=tt(e),i=ne.has(e.userId);return(0,Q.jsxs)(`div`,{className:`oc-access__row`,children:[(0,Q.jsx)(J,{checked:t,onCheckedChange:()=>void F(e.userId,t),"aria-label":ie({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)(K,{variant:`outline`,className:`oc-access__role`,children:nt(e.role)}),(0,Q.jsx)(`span`,{className:`oc-access__mgrslot`,children:t&&re?(0,Q.jsx)(U,{type:`button`,variant:`ghost`,size:`icon`,className:`shrink-0 oc-access__mgr${i?` oc-access__mgr--on`:``}`,"aria-pressed":i,"aria-label":i?r():oe(),title:i?r():oe(),onClick:()=>void I(e.userId,i),children:(0,Q.jsx)(Ze,{size:15,"aria-hidden":!0})}):t&&i?(0,Q.jsx)(`span`,{className:`oc-access__mgr oc-access__mgr--on`,role:`img`,"aria-label":we(),title:we(),children:(0,Q.jsx)(Ze,{size:15,"aria-hidden":!0})}):null})]},e._id)})}),(0,Q.jsx)(st,{page:R.page,pageCount:R.pageCount,onPage:k})]})]})}),(0,Q.jsx)(H,{value:`agents`,children:c===void 0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:B()}):c.length===0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:le()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(q,{value:b,onChange:e=>E(e.target.value),placeholder:fe(),className:`oc-access__search`}),(0,Q.jsx)(`div`,{className:`oc-access__list`,children:c.map(t=>(0,Q.jsx)(lt,{groupId:e,instanceName:t.name,kind:t.kind??`openclaw`,assigned:N,query:b},`${e}-${t._id}`))})]})}),(0,Q.jsx)(H,{value:`charts`,children:(0,Q.jsx)(ut,{groupId:e})})]})]})})}function lt({groupId:e,instanceName:t,kind:n,assigned:r,query:i}){let o=z(d.groups.listAssignableAgents,{instanceName:t}),s=a(d.groups.assignAgentToGroup),c=a(d.groups.removeAgentFromGroup),l=a(d.groups.bulkSetGroupAgents),f=Y(),[p,m]=(0,Z.useState)(1);if((0,Z.useEffect)(()=>{m(1)},[i]),!e)return null;let h=et(o?.agents??[],i),g=o?.discovery&&!o.discovery.lastPollOk;if(i.trim()&&h.length===0)return null;let _=h.filter(e=>e.presentInLastOk!==!1&&e.enabled!==!1),v=rt(_,e=>r.has(`${t}/${e.agentId}`)),y=it(h,p,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){f.error(ye(),e)}}async function x(){if(_.length===0)return;let n=_.map(e=>e.agentId);try{await l({groupId:e,instanceName:t,agentIds:n,assigned:v!==`all`})}catch(e){f.error(ye(),e)}}return(0,Q.jsxs)(`div`,{className:`oc-access__group`,children:[(0,Q.jsxs)(`div`,{className:`oc-access__instance`,children:[(0,Q.jsx)(G,{size:13,"aria-hidden":!0}),(0,Q.jsx)(`span`,{children:t}),(0,Q.jsx)(K,{variant:`outline`,className:`oc-access__kind`,children:n}),g?(0,Q.jsx)(K,{variant:`outline`,className:`oc-access__stale`,children:se()}):null]}),o===void 0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:F()}):h.length===0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:g?ve():me()}):(0,Q.jsxs)(Q.Fragment,{children:[_.length>1?(0,Q.jsxs)(`div`,{className:`oc-access__row oc-access__selectall`,children:[(0,Q.jsx)(J,{checked:v===`all`?!0:v===`some`?`indeterminate`:!1,onCheckedChange:()=>void x(),"aria-label":u()}),(0,Q.jsx)(`span`,{className:`oc-access__label`,children:u()})]}):null,y.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)(J,{checked:i,disabled:(a||o)&&!i,onCheckedChange:()=>void b(e.agentId,i),"aria-label":Oe({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":Te(),title:Te(),children:(0,Q.jsx)(W,{size:14,fill:`currentColor`})}):null,a?(0,Q.jsx)(K,{variant:`outline`,className:`oc-access__gone`,children:ae()}):null]},e.agentId)}),(0,Q.jsx)(st,{page:y.page,pageCount:y.pageCount,onPage:m})]})]})}function ut({groupId:e}){let t=z(d.charts.listGroupChartSelection,e?{groupId:e}:`skip`),n=a(d.charts.assignChartToGroup),r=a(d.charts.removeChartFromGroup),i=a(d.charts.setGroupDefaultChart),o=a(d.charts.addChartToGroupPool),s=a(d.charts.removeChartFromGroupPool),c=Y();if(!e)return null;if(t===void 0)return(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:B()});let{pool:l,addable:u,canManagePool:f}=t;if(l.length===0&&!f)return(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:L()});async function p(t,i){try{i?await r({groupId:e,chartKey:t}):await n({groupId:e,chartKey:t})}catch(e){c.error(N(),e)}}async function m(t){try{await i({groupId:e,chartKey:t})}catch(e){c.error(N(),e)}}async function h(t){try{await o({groupId:e,chartKey:t})}catch(e){c.error(N(),e)}}async function g(t){try{await s({groupId:e,chartKey:t})}catch(e){c.error(N(),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)(J,{checked:e.selected,onCheckedChange:()=>void p(e.chartKey,e.selected),"aria-label":ue({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":xe(),title:xe(),children:(0,Q.jsx)(W,{size:14,fill:`currentColor`})}):(0,Q.jsx)(U,{type:`button`,variant:`ghost`,size:`sm`,onClick:()=>void m(e.chartKey),children:ge()}):null,f?(0,Q.jsx)(U,{type:`button`,variant:`ghost`,size:`sm`,"aria-label":I({name:e.name}),title:I({name:e.name}),onClick:()=>void g(e.chartKey),children:(0,Q.jsx)(Ae,{size:14,"aria-hidden":!0})}):null]},e.chartKey))}),f?u.length>0?(0,Q.jsxs)(Le,{value:``,onValueChange:e=>void h(e),children:[(0,Q.jsx)(Pe,{size:`sm`,className:`oc-access__search`,children:(0,Q.jsx)(Ge,{placeholder:_e()})}),(0,Q.jsx)(Ke,{children:u.map(e=>(0,Q.jsx)(Ie,{value:e.chartKey,children:e.name},e.chartKey))})]}):l.length===0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:Se()}):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{$b as r,$x as i,AM as a,AS as o,Ax as s,Bx as c,CS as l,Cx as u,DS as d,Dx as f,E as p,ES as m,Ex as h,Fx as g,Gb as _,Gx as v,Hb as y,Hx as b,Ix as x,Jb as S,Jt as C,Jx as w,Kb as T,Kx as E,Lx as ee,Mg as D,Mx as te,Ng as ne,Nx as O,OM as k,OS as re,Ox as ie,Px as ae,Qb as oe,Qx as se,Rx as ce,SS as le,Sx as ue,TS as de,Tx as fe,Ub as pe,Ux as me,Vb as he,Vx as ge,Wb as _e,Wx as ve,XD as ye,Xb as be,Xt as xe,Xx as Se,Yb as Ce,Yt as we,Yx as Te,ZD as Ee,Zb as De,Zx as Oe,_S as ke,_x as Ae,aS as je,ax as Me,bS as Ne,bx as Pe,cS as Fe,ca as Ie,cx as Le,dS as Re,da as ze,dx as A,eS as Be,ex as Ve,fS as He,fx as Ue,gS as j,gx as M,hS as We,hx as Ge,iS as Ke,ix as qe,jM as N,jx as Je,kS as Ye,kx as Xe,lS as Ze,la as Qe,lx as $e,mS as et,mx as P,nS as tt,nx as nt,oS as rt,ox as it,pS as at,px as ot,qb as st,qx as ct,rS as lt,rx as ut,sS as dt,sx as ft,tS as pt,tx as mt,uS as ht,ua as gt,vS as _t,vx as vt,wS as yt,wx as bt,xS as xt,xx as St,yS as Ct,yx as wt,zx as Tt}from"./dist-CHawRMT8.js";import{a as Et,c as Dt}from"./FieldLabel-u_jnizyn.js";import{t as F}from"./button-BC70Om4X.js";import{B as Ot,C as I,Q as kt,S as L,X as At,Z as jt,b as R,ct as z,dt as Mt,ft as B,ht as V,lt as H,mt as U,p as W,u as Nt,ut as G,w as K,x as q,z as J}from"./index-C4W6RiZP.js";import{t as Pt}from"./DataTableShell-CuO0YQq6.js";import{InstanceConfigDialog as Ft}from"./BridgeTab-CHJ9g4oG.js";var Y=t(e(),1),X=[`conversational`,`documentary`,`summarizer`,`curator`],It=new Set(X),Lt=`conversational`;function Rt(e){let t=new Set((e??[]).filter(e=>It.has(e)));return t.size===0?[Lt]:X.filter(e=>t.has(e))}var Z=n(),Q={name:``,gatewayUrl:``,bridgeUrl:``,displayName:``,kind:`openclaw`,transport:`ws`,gatewayVersion:``,gatewayHttpUrl:``,streamTransport:Et},zt={openclaw:[`token`,`deviceIdentity`],hermes:[`apiKey`]};function Bt(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??``,streamTransport:e.streamTransport??`reactive`}}function Vt(){let e=N(p.admin.listInstances,{}),t=N(p.agents.listAllInstanceAgents,{}),n=a(p.admin.upsertInstance),r=a(p.admin.deleteInstance),s=J(),[c,u]=(0,Y.useState)(!1),[f,h]=(0,Y.useState)(Q),[g,_]=(0,Y.useState)(null),[v,b]=(0,Y.useState)(null),[x,S]=(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,streamTransport:f.streamTransport}),h(Q),T(null),u(!1)}catch(e){s.error(re(),e)}}return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`p`,{className:`oc-admin__hint`,children:[d(),(0,Z.jsx)(`strong`,{children:m()}),de()]}),(0,Z.jsx)(Pt,{title:yt(),rows:e,addLabel:l(),onAdd:()=>{T(null),h(Q),u(!0)},emptyHint:le(),columns:[{header:xt(),cell:e=>e.name,sort:e=>e.name},{header:Ne(),cell:e=>(0,Z.jsx)(z,{variant:`outline`,children:e.kind??`openclaw`}),sort:e=>e.kind??`openclaw`},{header:Ct(),cell:e=>e.gatewayUrl,sort:e=>e.gatewayUrl},{header:_t(),cell:e=>e.displayName??`—`,sort:e=>e.displayName??null},{header:o(),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)?y():void 0,children:[e.emoji?`${e.emoji} `:``,e.displayName??e.agentId]},e.agentId))})}}],rowActions:e=>[{label:et(),onSelect:()=>{T(e._id),h(Bt(e)),u(!0)}},{label:Ye(),onSelect:()=>_(e.name)},{label:i(),onSelect:()=>S(e)},{label:ke(),onSelect:()=>b(e)},{label:j(),variant:`destructive`,onSelect:()=>void r({instanceId:e._id})}],bulkActions:[{label:j(),variant:`destructive`,onSelect:e=>e.forEach(e=>void r({instanceId:e}))}]}),(0,Z.jsx)(Nt,{open:c,onOpenChange:u,title:w?at():We(),description:Re(),canSubmit:!!(f.name&&f.gatewayUrl),onSubmit:E,submitLabel:ht(),children:(0,Z.jsxs)(`div`,{className:`oc-form`,children:[(0,Z.jsxs)($,{label:Ze(),children:[(0,Z.jsx)(H,{value:f.name,disabled:w!==null,onChange:e=>h({...f,name:e.target.value})}),w?(0,Z.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:He()}):null]}),(0,Z.jsx)($,{label:Fe(),children:(0,Z.jsxs)(R,{value:f.kind,onValueChange:e=>h({...f,kind:e}),children:[(0,Z.jsx)(I,{size:`sm`,className:`w-40`,children:(0,Z.jsx)(K,{})}),(0,Z.jsxs)(q,{children:[(0,Z.jsx)(L,{value:`openclaw`,children:`OpenClaw`}),(0,Z.jsx)(L,{value:`hermes`,children:`Hermes`})]})]})}),f.kind===`hermes`?(0,Z.jsx)($,{label:xe(),children:(0,Z.jsxs)(R,{value:f.transport,onValueChange:e=>h({...f,transport:e}),children:[(0,Z.jsx)(I,{size:`sm`,className:`w-56`,children:(0,Z.jsx)(K,{})}),(0,Z.jsxs)(q,{children:[(0,Z.jsx)(L,{value:`ws`,children:we()}),(0,Z.jsx)(L,{value:`rest`,children:C()})]})]})}):null,(0,Z.jsx)($,{label:dt(),children:(0,Z.jsx)(H,{value:f.gatewayUrl,onChange:e=>h({...f,gatewayUrl:e.target.value})})}),(0,Z.jsx)($,{label:rt(),children:(0,Z.jsx)(H,{value:f.bridgeUrl,placeholder:je(),onChange:e=>h({...f,bridgeUrl:e.target.value})})}),(0,Z.jsx)($,{label:Ke(),children:(0,Z.jsx)(H,{value:f.displayName,onChange:e=>h({...f,displayName:e.target.value})})}),(0,Z.jsxs)($,{label:ne(),children:[(0,Z.jsxs)(R,{value:f.streamTransport,onValueChange:e=>h({...f,streamTransport:e}),children:[(0,Z.jsx)(I,{size:`sm`,className:`w-40`,children:(0,Z.jsx)(K,{})}),(0,Z.jsx)(q,{children:Dt.map(e=>(0,Z.jsx)(L,{value:e,children:e},e))})]}),(0,Z.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:D()})]}),(0,Z.jsx)($,{label:lt(),children:(0,Z.jsx)(H,{value:f.gatewayVersion,placeholder:tt(),onChange:e=>h({...f,gatewayVersion:e.target.value})})}),(0,Z.jsx)($,{label:pt(),children:(0,Z.jsx)(H,{value:f.gatewayHttpUrl,placeholder:Be(),onChange:e=>h({...f,gatewayHttpUrl:e.target.value})})})]})}),(0,Z.jsx)(Zt,{instanceName:g,open:g!==null,onOpenChange:e=>{e||_(null)}}),v?(0,Z.jsx)(Ft,{instance:v,onClose:()=>b(null)},v._id):null,x?(0,Z.jsx)(Ht,{instance:x,onClose:()=>S(null)},x._id):null]})}function Ht({instance:e,onClose:t}){let n=N(p.instanceSecrets.listInstanceSecretStatus,{}),r=zt[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)(G,{open:!0,onOpenChange:e=>!e&&t(),children:(0,Z.jsxs)(Mt,{onOpenAutoFocus:e=>e.preventDefault(),children:[(0,Z.jsxs)(U,{children:[(0,Z.jsx)(V,{children:se({instance:e.displayName??e.name})}),(0,Z.jsx)(B,{children:Oe()})]}),(0,Z.jsx)(`div`,{className:`oc-form`,children:r.map(t=>(0,Z.jsx)(Gt,{instanceId:e._id,field:t,updatedAt:i[t]??null},t))}),(0,Z.jsx)(`div`,{className:`oc-bridgesecret`,children:(0,Z.jsx)(Wt,{instance:e})}),(0,Z.jsx)(Ut,{instance:e})]})})}function Ut({instance:e}){let t=k(p.instanceSync.forceInstanceSync),n=J(),[r,i]=(0,Y.useState)(!1);async function a(){if(!r){i(!0);try{switch((await t({instanceId:e._id})).status){case`synced`:n.success(Je());break;case`no_agents`:n.success(Xe());break;case`no_bridge_url`:n.error(ie());break;case`deploy_misconfigured`:n.error(f());break;case`unauthorized`:n.error(fe());break;case`not_served`:n.error(bt());break;default:n.error(h());break}}catch(e){n.error(s(),e)}finally{i(!1)}}}return(0,Z.jsxs)(`div`,{className:`oc-form`,children:[(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:u()}),(0,Z.jsx)(`div`,{className:`flex items-center gap-2`,children:(0,Z.jsx)(F,{size:`sm`,variant:`outline`,onClick:()=>void a(),disabled:r,children:r?te():O()})})]})}function Wt({instance:e}){let t=N(p.bridgeAuth.listBridgeAuthStatus,{}),n=k(p.bridgeAuth.mintBridgeSecret),r=a(p.bridgeAuth.revokeBridgeSecret),i=J(),[o,s]=(0,Y.useState)(!1),[c,l]=(0,Y.useState)(null),[u,d]=(0,Y.useState)(!1),f=(t??[]).find(t=>t.instanceId===e._id),m=f!==void 0;async function h(){if(!o){s(!0);try{l((await n({instanceId:e._id})).plaintext),d(!1)}catch(e){i.error(M(),e)}finally{s(!1)}}}async function g(){if(!o){s(!0);try{await r({instanceId:e._id}),l(null),i.success(Ae())}catch(e){i.error(M(),e)}finally{s(!1)}}}async function _(){if(c)try{await navigator.clipboard.writeText(c),d(!0)}catch{}}return(0,Z.jsxs)($,{label:ue(),children:[(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:St()}),(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Z.jsx)(z,{variant:m?`outline`:`secondary`,children:m?`${ct()} · ${f.prefix}…${f.lastFour}`:E()}),(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(F,{size:`sm`,onClick:()=>void h(),disabled:o,children:m?wt():Pe()}),m?(0,Z.jsx)(F,{size:`sm`,variant:`destructive`,onClick:()=>void g(),disabled:o,children:vt()}):null]})]}),c?(0,Z.jsxs)(`div`,{className:`oc-bridgesecret__reveal`,children:[(0,Z.jsx)(`p`,{className:`oc-sa__minted-warning`,children:Ge()}),(0,Z.jsxs)(`div`,{className:`oc-sa__minted-box`,children:[(0,Z.jsx)(`code`,{className:`oc-sa__minted-plain`,children:c}),(0,Z.jsx)(F,{variant:`outline`,size:`sm`,onClick:()=>void _(),children:u?Ee():ye()})]}),(0,Z.jsx)(F,{size:`sm`,variant:`ghost`,onClick:()=>{l(null),d(!1)},children:P()})]}):null]})}function Gt({instanceId:e,field:t,updatedAt:n}){let r=k(p.instanceSecrets.setInstanceSecret),i=a(p.instanceSecrets.clearInstanceSecret),o=k(p.deviceIdentity.generateDeviceIdentity),s=J(),[l,u]=(0,Y.useState)(``),[d,f]=(0,Y.useState)(!1),[m,h]=(0,Y.useState)(null),[_,y]=(0,Y.useState)(!1),S=n!==null,C=t===`deviceIdentity`,T=t===`token`?Se():t===`deviceIdentity`?Te():w();async function D(){if(!(!l.trim()||d)){f(!0);try{await r({instanceId:e,field:t,plaintext:l}),u(``),h(null),y(!1),s.success(ge())}catch(e){s.error(c(),e)}finally{f(!1)}}}async function te(){if(!d){f(!0);try{await i({instanceId:e,field:t}),h(null),y(!1),s.success(Tt())}catch(e){s.error(c(),e)}finally{f(!1)}}}async function ne(){if(!d){f(!0);try{h(await o({instanceId:e})),y(!1),s.success(x())}catch(e){s.error(ae(),e)}finally{f(!1)}}}let O=m?`openclaw devices approve ${m.id}`:``;async function re(){if(O)try{await navigator.clipboard.writeText(O),y(!0)}catch{}}return(0,Z.jsxs)($,{label:T,children:[C?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:ee()}):null,(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Z.jsx)(z,{variant:S?`outline`:`secondary`,children:S?ct():E()}),(0,Z.jsx)(H,{type:`password`,autoComplete:`off`,className:`flex-1 min-w-32`,value:l,placeholder:S?ve():v(),onChange:e=>u(e.target.value)}),(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(F,{size:`sm`,onClick:()=>void D(),disabled:d||l.trim().length===0,children:me()}),C?(0,Z.jsx)(F,{size:`sm`,variant:`outline`,onClick:()=>void ne(),disabled:d,children:ce()}):null,S?(0,Z.jsx)(F,{size:`sm`,variant:`destructive`,onClick:()=>void te(),disabled:d,children:b()}):null]})]}),m?(0,Z.jsxs)(`div`,{className:`oc-bridgesecret__reveal`,children:[(0,Z.jsx)(`p`,{className:`text-sm font-medium`,children:x()}),(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:g()}),(0,Z.jsxs)(`div`,{className:`oc-sa__minted-box`,children:[(0,Z.jsx)(`code`,{className:`oc-sa__minted-plain`,children:O}),(0,Z.jsx)(F,{variant:`outline`,size:`sm`,onClick:()=>void re(),children:_?Ee():ye()})]}),(0,Z.jsx)(F,{size:`sm`,variant:`ghost`,onClick:()=>{h(null),y(!1)},children:P()})]}):null]})}var Kt={conversational:ut,documentary:mt,summarizer:ze,curator:Qe},qt={conversational:nt,documentary:Ve,summarizer:gt,curator:Ie},Jt=e=>(Kt[e]??(()=>e))(),Yt=e=>(qt[e]??(()=>``))();function Xt({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:ft()}),t.map(e=>(0,Z.jsx)(z,{variant:`secondary`,className:`oc-agenttype__chip`,title:Yt(e),children:Jt(e)},e)),(0,Z.jsxs)(At,{children:[(0,Z.jsx)(kt,{asChild:!0,children:(0,Z.jsx)(F,{type:`button`,variant:`outline`,size:`sm`,className:`h-7`,children:it()})}),(0,Z.jsxs)(jt,{align:`start`,className:`oc-agenttypes-pop`,children:[(0,Z.jsx)(`p`,{className:`oc-agenttypes-pop__title`,children:Me()}),(0,Z.jsx)(`p`,{className:`oc-agenttypes-pop__hint`,children:qe()}),(0,Z.jsx)(`div`,{className:`oc-agenttypes-pop__list`,children:X.map(r=>{let i=`agtype-${e}-${r}`;return(0,Z.jsxs)(`div`,{className:`oc-agenttypes-pop__item`,children:[(0,Z.jsx)(W,{id:i,checked:t.includes(r),onCheckedChange:()=>n(r)}),(0,Z.jsxs)(`label`,{htmlFor:i,className:`oc-agenttypes-pop__text`,children:[(0,Z.jsx)(`span`,{className:`oc-agenttypes-pop__name`,children:Jt(r)}),(0,Z.jsx)(`span`,{className:`oc-agenttypes-pop__desc`,children:Yt(r)})]})]},r)})})]})]})]})}function Zt({instanceName:e,open:t,onOpenChange:n}){let i=N(p.agents.listAgentsForInstance,t&&e?{instanceName:e}:`skip`),o=a(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)})}),s=a(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})}),c=a(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=Rt(r);e.setQuery(p.agents.listAgentsForInstance,{instanceName:t},{...i,agents:i.agents.map(e=>e.agentId===n?{...e,types:a}:e)})}),l=a(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)})}),u=a(p.agents.removeInstanceAgent),d=Ot(),f=J();async function m(t,n){if(e)try{await o({instanceName:e,agentId:t,enabled:n})}catch(e){f.error(A(),e)}}async function h(t){if(e)try{await s({instanceName:e,agentId:t})}catch(e){f.error(A(),e)}}async function g(t,n,r){if(!e)return;let i=r.includes(n)?r.filter(e=>e!==n):[...r,n];try{await c({instanceName:e,agentId:t,types:i})}catch(e){f.error(A(),e)}}async function v(t,n){if(e&&await d({title:De({name:n}),description:be(),confirmLabel:Ce(),destructive:!0}))try{await u({instanceName:e,agentId:t}),f.success(S())}catch(e){f.error(A(),e)}}return(0,Z.jsx)(G,{open:t,onOpenChange:n,children:(0,Z.jsxs)(Mt,{className:`oc-access`,children:[(0,Z.jsxs)(U,{children:[(0,Z.jsx)(V,{children:ot({name:e??``})}),(0,Z.jsx)(B,{children:Ue()})]}),i===void 0?(0,Z.jsx)(`p`,{className:`oc-access__hint`,children:st()}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`div`,{className:`oc-access__poll`,children:i.discovery===null?T():i.discovery.lastPollOk?_():_e({error:i.discovery.error??`?`})}),i.agents.length===0?(0,Z.jsx)(`p`,{className:`oc-access__hint`,children:pe()}):(0,Z.jsx)(`div`,{className:`oc-access__list`,children:i.agents.map(t=>{let n=t.presentInLastOk===!1,a=i.defaultAgentId===t.agentId,o=t.displayName??t.agentId,s=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)(W,{checked:t.enabled,disabled:n,"aria-label":o,onCheckedChange:e=>void m(t.agentId,e===!0)}),(0,Z.jsxs)(`span`,{className:`oc-agentcard__name`,title:o,children:[t.emoji?`${t.emoji} `:``,o]}),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:he()}),(0,Z.jsx)(F,{size:`sm`,variant:`ghost`,className:`h-7 text-destructive`,onClick:()=>void v(t.agentId,o),children:oe()})]}):a?(0,Z.jsx)(z,{variant:`default`,children:y()}):(0,Z.jsx)(F,{size:`sm`,variant:`outline`,className:`h-7`,disabled:!t.enabled,onClick:()=>void h(t.agentId),children:r()})]}),t.enabled?(0,Z.jsx)(Xt,{agentId:t.agentId,types:s,onToggle:e=>void g(t.agentId,e,s)}):null,t.enabled?(0,Z.jsx)(Qt,{value:t.description??``,onSave:async n=>{if(e)try{await l({instanceName:e,agentId:t.agentId,description:n})}catch(e){f.error(A(),e)}}}):null]},t.agentId)})})]})]})})}function Qt({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)(H,{className:`oc-agentcard__desc`,value:n,maxLength:280,placeholder:$e(),"aria-label":Le(),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{Vt as InstancesTab};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{AM as r,Ao as i,Do as a,E as o,Eo as s,Mo as c,OM as l,Oo as u,To as d,_w as f,cw as p,dw as m,fw as h,gw as g,hw as _,jM as v,jo as y,ko as b,lw as x,mw as S,ow as C,pw as w,sw as T,uw as E,vw as D,wo as O,yw as k}from"./dist-CHawRMT8.js";import{t as A}from"./button-BC70Om4X.js";import{ct as j,lt as M,p as N}from"./index-C4W6RiZP.js";var P=t(e(),1),F=n();function I(){let e=v(o.integrations.status.status,{}),t=r(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:k()});let s=n,l=(e,t,n)=>a({...s,[e]:{...s[e],[t]:n}}),u=(e,n)=>void t({[e]:n});return(0,F.jsxs)(F.Fragment,{children:[(0,F.jsxs)(`p`,{className:`oc-admin__hint`,children:[D(),` `,(0,F.jsx)(`strong`,{children:f()}),` `,g()]}),(0,F.jsxs)(L,{title:`Langfuse`,status:e.langfuse.configured?e.langfuse.enabled?(0,F.jsx)(j,{variant:`secondary`,children:_()}):(0,F.jsx)(j,{variant:`outline`,children:S()}):(0,F.jsx)(j,{variant:`outline`,children:w()}),note:h(),children:[(0,F.jsx)(R,{label:E(),children:(0,F.jsx)(M,{value:s.langfuse.host??``,placeholder:e.langfuse.effectiveHost,onChange:e=>l(`langfuse`,`host`,e.target.value),onBlur:()=>u(`langfuse`,{host:s.langfuse.host??``})})}),(0,F.jsx)(z,{label:C(),checked:s.langfuse.enabled??!0,onChange:e=>{l(`langfuse`,`enabled`,e),u(`langfuse`,{enabled:e})}})]}),(0,F.jsxs)(L,{title:`Opik`,status:e.opik.configured?e.opik.enabled?(0,F.jsx)(j,{variant:`secondary`,children:_()}):(0,F.jsx)(j,{variant:`outline`,children:S()}):(0,F.jsx)(j,{variant:`outline`,children:w()}),note:m(),children:[(0,F.jsx)(R,{label:x(),children:(0,F.jsx)(M,{value:s.opik.baseUrl??``,placeholder:e.opik.effectiveBaseUrl,onChange:e=>l(`opik`,`baseUrl`,e.target.value),onBlur:()=>u(`opik`,{baseUrl:s.opik.baseUrl??``})})}),(0,F.jsx)(R,{label:p(),children:(0,F.jsx)(M,{value:s.opik.workspace??``,placeholder:e.opik.effectiveWorkspace||T(),onChange:e=>l(`opik`,`workspace`,e.target.value),onBlur:()=>u(`opik`,{workspace:s.opik.workspace??``})})}),(0,F.jsx)(z,{label:C(),checked:s.opik.enabled??!0,onChange:e=>{l(`opik`,`enabled`,e),u(`opik`,{enabled:e})}})]}),(0,F.jsxs)(L,{title:`OpenTelemetry (OTLP)`,status:e.otlp.configured?e.otlp.enabled?(0,F.jsx)(j,{variant:`secondary`,children:_()}):(0,F.jsx)(j,{variant:`outline`,children:S()}):(0,F.jsx)(j,{variant:`outline`,children:c()}),note:y(),children:[(0,F.jsx)(R,{label:i(),children:(0,F.jsx)(M,{value:s.otlp.endpoint??``,placeholder:e.otlp.effectiveEndpoint||`https://otlp.example.com/v1/traces`,onChange:e=>l(`otlp`,`endpoint`,e.target.value),onBlur:()=>u(`otlp`,{endpoint:s.otlp.endpoint??``})})}),(0,F.jsx)(B,{headersSet:e.otlp.headersSet}),(0,F.jsx)(z,{label:C(),checked:s.otlp.enabled??!0,onChange:e=>{l(`otlp`,`enabled`,e),u(`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=l(o.integrations.otlpSecret.setOtlpHeaders),n=r(o.integrations.otlpSecret.clearOtlpHeaders),[i,c]=(0,P.useState)(``),[f,p]=(0,P.useState)(null),[m,h]=(0,P.useState)(!1),g=async()=>{h(!0),p(null);try{await t({headersJson:i}),c(``)}catch(e){p(e instanceof Error?e.message:String(e))}finally{h(!1)}};return(0,F.jsxs)(R,{label:b(),children:[(0,F.jsx)(M,{value:i,placeholder:e?u():a(),onChange:e=>c(e.target.value)}),(0,F.jsxs)(`div`,{className:`oc-int__otlp-headers-actions`,children:[(0,F.jsx)(A,{size:`sm`,disabled:m||i.trim().length===0,onClick:()=>void g(),children:s()}),e?(0,F.jsx)(A,{variant:`ghost`,size:`sm`,disabled:m,onClick:()=>void n({}),children:d()}):null]}),f?(0,F.jsx)(`p`,{className:`oc-int__otlp-headers-error`,children:f}):null,(0,F.jsx)(`p`,{className:`oc-uipa__note`,children:O()})]})}export{I as IntegrationsTab};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$w as r,Bm as i,DT as a,E as o,Gm as s,Gw as c,Hm as l,Jm as u,Km as d,Kw as f,Rm as p,Um as m,Vm as h,Wm as g,Xm as ee,Ym as _,Zm as v,eT as y,jM as b,nT as x,qm as S,tT as C,zm as w}from"./dist-CHawRMT8.js";import{Xt as T,Yt as E,a as D,n as te,r as ne,xt as re}from"./index-C4W6RiZP.js";import{a as O,n as k,o as A,r as j,t as M}from"./card-BOwxTL3L.js";import{n as N,t as P}from"./TimeRangePicker-CcvYUnNz.js";var F=t(e(),1),I=n(),L=15,R=e=>String(Math.round(e));function z(){let e=b(o.me.getMe,{host:re})?.permissions?.includes(`traces.read`)??!1,t=b(o.deliveryTiming.listDeliverySessions,e?{}:`skip`),n=(0,F.useMemo)(()=>t?t.filter(e=>!e.active&&e.rollup!==null&&e.rollup.cP50!==null&&e.rollup.aP50!==null).slice(0,L).reverse().map(e=>({startedAt:e.startedAt,cP50:e.rollup?.cP50,aP50:e.rollup?.aP50})):[],[t]);return t===void 0?null:(0,I.jsxs)(`section`,{className:`oc-kpi__group`,children:[(0,I.jsx)(`h2`,{className:`oc-kpi__group-title`,children:a()}),(0,I.jsxs)(M,{children:[(0,I.jsxs)(O,{children:[(0,I.jsx)(A,{children:x()}),(0,I.jsx)(j,{children:y()})]}),(0,I.jsx)(k,{children:n.length<2?(0,I.jsx)(`p`,{className:`oc-admin__hint`,children:r()}):(0,I.jsx)(B,{series:n})})]})]})}function B({series:e}){let t=e.map(e=>e.cP50),n=e.map(e=>e.aP50),r=Math.max(1,...t,...n),i=t=>6+t*468/(e.length-1),a=e=>74-e*68/r,o=e=>e.map((e,t)=>`${t===0?`M`:`L`}${i(t).toFixed(1)},${a(e).toFixed(1)}`).join(` `),s=e[e.length-1];return(0,I.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,I.jsxs)(`div`,{className:`flex gap-3 text-xs text-muted-foreground`,children:[(0,I.jsxs)(`span`,{style:{color:`var(--primary)`},children:[c(),` p50 `,R(s.cP50),` `,C()]}),(0,I.jsxs)(`span`,{children:[f(),` p50 `,R(s.aP50),` `,C()]})]}),(0,I.jsxs)(`svg`,{viewBox:`0 0 480 80`,className:`h-20 w-full`,preserveAspectRatio:`none`,role:`img`,"aria-label":x(),children:[(0,I.jsx)(`path`,{d:o(n),fill:`none`,style:{stroke:`var(--muted-foreground)`},strokeWidth:1.5}),(0,I.jsx)(`path`,{d:o(t),fill:`none`,style:{stroke:`var(--primary)`},strokeWidth:1.5})]})]})}var V=[{metric:`api.calls`,label:v(),unit:`/h`,group:`API`,isError:!1},{metric:`api.errors`,label:ee(),unit:`/h`,group:`API`,isError:!0},{metric:`api.latency.avg_ms`,label:_(),unit:`ms`,group:`API`,isError:!1},{metric:`openclaw.ingest`,label:u(),unit:`/h`,group:`OpenClaw`,isError:!1},{metric:`chat.send`,label:S(),unit:`/h`,group:`Chat`,isError:!1},{metric:`assistant.stream.errors`,label:d(),unit:`/h`,group:`Assistant`,isError:!0}],H=V.length,U=[`API`,`OpenClaw`,`Chat`,`Assistant`],W=1e3,G=36e5;function K(e,t){let n=Math.max(1,Math.ceil((t-e)/G)),r=Math.min(n*H,W);return{rowLimit:r,buckets:Math.max(1,Math.floor(r/H))}}function q(){let e=T({from:`/settings/kpi`}),t=E({from:`/settings/kpi`}),n=ne(e.from,e.to,te,`now`),r=e=>void t({search:t=>({...t,...D(e)})}),{from:i,to:a}=N(n),{rowLimit:c,buckets:u}=K(i,a),d=b(o.kpi.listKpis,{limit:c,filter:{from:i,to:a}}),f=(0,F.useMemo)(()=>{let e=new Map;for(let t of d??[]){let n=e.get(t.metric)??[];n.push({bucket:t.bucket,value:t.value}),e.set(t.metric,n)}for(let[t,n]of e)n.sort((e,t)=>e.bucket<t.bucket?-1:+(e.bucket>t.bucket)),n.length>u&&e.set(t,n.slice(n.length-u));return e},[d,u]),p=(0,I.jsxs)(I.Fragment,{children:[(0,I.jsxs)(`p`,{className:`oc-admin__hint`,children:[s(),` `,(0,I.jsx)(`span`,{className:`oc-filter__window`,children:g()})]}),(0,I.jsx)(J,{value:n,onChange:r})]});return d===void 0?(0,I.jsxs)(I.Fragment,{children:[p,(0,I.jsx)(z,{}),(0,I.jsx)(`p`,{className:`oc-admin__hint`,children:m()})]}):d.length===0?(0,I.jsxs)(I.Fragment,{children:[p,(0,I.jsx)(z,{}),(0,I.jsx)(`p`,{className:`oc-admin__hint`,children:l()})]}):(0,I.jsxs)(I.Fragment,{children:[p,(0,I.jsx)(z,{}),U.map(e=>{let t=V.filter(t=>t.group===e);return t.some(e=>(f.get(e.metric)??[]).length>0)?(0,I.jsxs)(`section`,{className:`oc-kpi__group`,children:[(0,I.jsx)(`h2`,{className:`oc-kpi__group-title`,children:e}),(0,I.jsx)(`div`,{className:`oc-kpi__grid`,children:t.map(e=>(0,I.jsx)(Y,{config:e,series:f.get(e.metric)??[]},e.metric))})]},e):null})]})}function J({value:e,onChange:t}){return(0,I.jsx)(`div`,{className:`oc-kpi__toolbar`,children:(0,I.jsx)(P,{value:e,onChange:t})})}function Y({config:e,series:t}){let n=t.length>0?t[t.length-1]:null,r=n?n.value:0;return(0,I.jsxs)(M,{size:`sm`,className:`oc-kpi__card`,children:[(0,I.jsxs)(O,{children:[(0,I.jsx)(A,{className:`oc-kpi__card-title`,children:e.label}),(0,I.jsx)(j,{className:`oc-kpi__card-metric`,children:(0,I.jsx)(`code`,{children:e.metric})})]}),(0,I.jsxs)(k,{className:`oc-kpi__card-body`,children:[(0,I.jsxs)(`div`,{className:`oc-kpi__value-row`,children:[(0,I.jsx)(`span`,{className:`oc-kpi__value`+(e.isError&&r>0?` oc-kpi__value--error`:``),children:Q(r)}),(0,I.jsx)(`span`,{className:`oc-kpi__unit`,children:e.unit})]}),(0,I.jsx)(ae,{series:t,isError:e.isError,unit:e.unit}),(0,I.jsxs)(`div`,{className:`oc-kpi__axis`,children:[n?(0,I.jsx)(`span`,{className:`oc-kpi__axis-latest`,children:h({value:$(n.bucket)})}):(0,I.jsx)(`span`,{className:`oc-kpi__muted`,children:i()}),(0,I.jsx)(`span`,{className:`oc-kpi__muted`,children:w({count:t.length})})]})]})]})}var X=240,Z=48,ie=1;function ae({series:e,isError:t,unit:n}){if(e.length===0)return(0,I.jsx)(`div`,{className:`oc-kpi__chart oc-kpi__chart--empty`,"aria-hidden":!0});let r=e.reduce((e,t)=>t.value>e?t.value:e,0),i=X/e.length,a=Math.max(i-ie,1);return(0,I.jsx)(`svg`,{className:`oc-kpi__chart`,viewBox:`0 0 ${X} ${Z}`,preserveAspectRatio:`none`,role:`img`,"aria-label":p({max:Q(r),unit:n}),children:e.map((e,o)=>{let s=r>0?e.value/r*(Z-1):0,c=o*i,l=Z-s;return(0,I.jsx)(`rect`,{className:`oc-kpi__bar`+(t&&e.value>0?` oc-kpi__bar--error`:``),x:c,y:l,width:a,height:s,children:(0,I.jsxs)(`title`,{children:[$(e.bucket),` · `,Q(e.value),` `,n]})},e.bucket)})})}function Q(e){return Number.isFinite(e)?Math.abs(e)>=1e3?(e/1e3).toFixed(e%1e3==0?0:1)+`k`:String(e):`0`}function $(e){let t=new Date(`${e}:00:00Z`);return Number.isNaN(t.getTime())?e:`${String(t.getUTCDate()).padStart(2,`0`)}/${String(t.getUTCMonth()+1).padStart(2,`0`)} ${String(t.getUTCHours()).padStart(2,`0`)}h`}export{q as KpiTab};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{A as r,AM as i,Ak as a,Bk as o,Ck as s,Dk as c,E as l,Ek as u,F as d,Fk as f,G as ee,Gk as te,Hk as ne,I as re,Ik as ie,Jk as ae,Kk as oe,L as se,Lk as ce,M as le,Mk as p,N as m,Nk as ue,Ok as de,P as fe,Pk as pe,Rk as me,SM as he,Sk as h,Tk as g,Uk as _,Vk as v,Wk as y,X as b,Xk as x,Yk as S,Z as C,_M as w,_k as T,aM as E,bk as D,cM as O,dM as k,dk as A,fM as j,fk as M,gk as N,hk as P,iM as F,j as I,jM as L,jk as R,kk as ge,lM as _e,lk as ve,mM as ye,mk as be,n as z,oM as xe,pM as Se,pk as Ce,qk as we,sM as Te,uM as Ee,uS as De,uk as B,vk as V,wk as Oe,xk as ke,yk as Ae,zk as je}from"./dist-CHawRMT8.js";import{t as H}from"./button-BC70Om4X.js";import{A as Me,C as Ne,S as U,b as Pe,bt as Fe,ct as W,lt as G,p as K,vt as Ie,w as Le,x as Re,xt as q,yt as ze,z as Be}from"./index-C4W6RiZP.js";import{t as Ve}from"./localePickerView-C2RmOS86.js";var J=t(e(),1),Y=n();function He({className:e,checked:t,onCheckedChange:n,disabled:r,...i}){return(0,Y.jsx)(`button`,{type:`button`,role:`switch`,"aria-checked":t,"data-state":t?`checked`:`unchecked`,disabled:r,onClick:()=>n(!t),className:z(`peer inline-flex h-5 w-9 shrink-0 items-center rounded-full border border-transparent transition-colors outline-none`,`focus-visible:ring-2 focus-visible:ring-ring/50`,`disabled:cursor-not-allowed disabled:opacity-50`,t?`bg-primary`:`bg-input`,e),...i,children:(0,Y.jsx)(`span`,{className:z(`pointer-events-none block size-4 rounded-full bg-background shadow transition-transform`,t?`translate-x-[18px]`:`translate-x-[2px]`)})})}var X=[{id:`messages`,label:()=>x()},{id:`composer`,label:()=>S()},{id:`sidebar`,label:()=>ae()},{id:`notifications`,label:()=>ge()},{id:`other`,label:()=>we()}],Z={showSource:{category:`messages`,label:()=>oe(),help:()=>te()},showReport:{category:`messages`,label:()=>y(),help:()=>_()},copyAssistant:{category:`messages`,label:()=>ne()},copyUser:{category:`messages`,label:()=>v()},showDelete:{category:`messages`,label:()=>o()},showTools:{category:`messages`,label:()=>je(),help:()=>me()},voiceInput:{category:`composer`,label:()=>ce(),help:()=>ie()},showUsage:{category:`composer`,label:()=>f(),help:()=>pe()},autoReadAloud:{category:`composer`,label:()=>C(),help:()=>b()},showChatAge:{category:`sidebar`,label:()=>ue(),help:()=>p()},showChatProvider:{category:`sidebar`,label:()=>R(),help:()=>a()},notifSound:{category:`notifications`,label:()=>de(),help:()=>c()},notifSystem:{category:`notifications`,label:()=>u(),help:()=>g()},replySound:{category:`notifications`,label:()=>Oe(),help:()=>s()}};function Q(e){return e.toLowerCase().normalize(`NFD`).replace(/\p{Diacritic}/gu,``)}function Ue(e,t){let n=Q(t.trim()),r=new Map(X.map(e=>[e.id,e.label()])),i=new Map(X.map(e=>[e.id,[]]));for(let t of e){let e=Z[t],a=e?.category??`other`;n&&!Q(`${e?e.label():t} ${e?.help?e.help():``} ${t} ${r.get(a)??``}`).includes(n)||i.get(a).push(t)}return X.map(e=>({id:e.id,label:r.get(e.id),keys:i.get(e.id)})).filter(e=>e.keys.length>0)}var We=[`showSource`,`showReport`,`copyAssistant`,`copyUser`,`showDelete`,`showTools`,`voiceInput`,`showChatAge`,`showChatProvider`,`showUsage`,`autoReadAloud`,`notifSound`,`notifSystem`,`replySound`],Ge={voiceInput:`voiceInput`};function Ke(e){return We.includes(e)}function $(e){return e===`admin`}function qe(e){return e===!0?`on`:e===!1?`off`:`inherit`}function Je(e){return e===`on`?!0:e===`off`?!1:null}function Ye(e){return Ke(e)?Ge[e]:void 0}var Xe={voiceInput:()=>Ce()};function Ze({prefKey:e,ui:t}){let n=i(l.admin.setUiPrefDefault),r=i(l.admin.setFeatureEnabled),a=Ye(e),o=a?Xe[e]?.():void 0;return(0,Y.jsxs)(`div`,{className:`oc-prefs__gov`,children:[(0,Y.jsxs)(`div`,{className:`oc-prefs__gov-row`,children:[(0,Y.jsx)(`span`,{className:`oc-prefs__gov-label`,children:T()}),(0,Y.jsxs)(Pe,{value:qe(t.defaults[e]),onValueChange:t=>void n({key:e,value:Je(t)}),children:[(0,Y.jsx)(Ne,{size:`sm`,className:`w-36`,children:(0,Y.jsx)(Le,{})}),(0,Y.jsxs)(Re,{children:[(0,Y.jsx)(U,{value:`on`,children:A()}),(0,Y.jsx)(U,{value:`off`,children:B()}),(0,Y.jsx)(U,{value:`inherit`,children:ve()})]})]}),a?(0,Y.jsxs)(`span`,{className:`oc-prefs__gov-gate`,children:[(0,Y.jsx)(K,{checked:t.featuresEnabled[a]===!0,onCheckedChange:e=>void r({key:a,enabled:e===!0}),"aria-label":N()}),N()]}):null]}),o?(0,Y.jsx)(`span`,{className:`oc-prefs__gov-help`,children:o}):null]})}function Qe({current:e,enabled:t}){let n=i(l.me.setDictationShortcut),[a,o]=(0,J.useState)(!1),[s,c]=(0,J.useState)(!1);return(0,J.useEffect)(()=>{if(!a)return;let e=e=>{if(e.preventDefault(),e.stopPropagation(),e.key===`Escape`){o(!1);return}let t=ze(e);if(t===null){[`Shift`,`Control`,`Meta`,`Alt`].includes(e.key)||(c(!0),window.setTimeout(()=>c(!1),1800));return}o(!1),n({shortcut:t})};return window.addEventListener(`keydown`,e,!0),()=>window.removeEventListener(`keydown`,e,!0)},[a,n]),(0,Y.jsxs)(`div`,{className:`oc-prefs__row${t?``:` is-locked`}`,children:[(0,Y.jsxs)(`div`,{className:`oc-prefs__info`,children:[(0,Y.jsxs)(`span`,{className:`oc-prefs__label`,children:[se(),e?(0,Y.jsx)(W,{variant:`secondary`,children:Fe(e,Ie())}):null]}),(0,Y.jsx)(`span`,{className:`oc-prefs__help`,children:s?fe():a?d():re()})]}),(0,Y.jsxs)(`div`,{className:`oc-prefs__ctl`,children:[e&&!a?(0,Y.jsx)(`button`,{type:`button`,className:`oc-prefs__reset`,onClick:()=>void n({shortcut:null}),children:r()}):null,(0,Y.jsx)(`button`,{type:`button`,className:`oc-prefs__reset`,disabled:!t,"aria-pressed":a,onClick:()=>o(e=>!e),children:a?I():e?le():m()})]})]})}function $e(){let[e,t]=(0,J.useState)(``),[n,r]=(0,J.useState)(!1),a=L(l.me.getMe,{host:q}),o=a?.ui,s=$(a?.role)&&n,c=i(l.me.setUiPref).withOptimisticUpdate(Me),u=(0,J.useMemo)(()=>o?Ue(Object.keys(o.effective),e):[],[o,e]);return o?(0,Y.jsxs)(`div`,{className:`oc-prefs-panel`,children:[$(a?.role)?(0,Y.jsxs)(`label`,{className:`oc-prefs__gov-toggle`,children:[(0,Y.jsx)(K,{checked:n,onCheckedChange:e=>r(e===!0),"aria-label":V()}),V()]}):null,s?(0,Y.jsxs)(`div`,{className:`oc-prefs__gov-head`,children:[(0,Y.jsx)(`p`,{children:P()}),(0,Y.jsx)(`p`,{children:be()}),(0,Y.jsx)(`p`,{children:M()})]}):null,(0,Y.jsx)(G,{value:e,onChange:e=>t(e.target.value),placeholder:h(),"aria-label":h(),className:`mb-2`}),u.length===0?(0,Y.jsx)(`div`,{className:`oc-prefs__empty`,children:ke()}):(0,Y.jsx)(`div`,{className:`oc-prefs`,children:u.map(e=>(0,Y.jsxs)(`section`,{className:`oc-prefs__card`,children:[(0,Y.jsx)(`h4`,{className:`oc-prefs__cat`,children:e.label}),e.keys.map(e=>{let t=Z[e],n=t?t.label():e,r=t?.help?.(),i=o.locked[e],a=o.effective[e],l=o.userOverrides[e]!==void 0;return(0,Y.jsxs)(`div`,{className:`oc-prefs__row${i?` is-locked`:``}`,children:[(0,Y.jsxs)(`div`,{className:`oc-prefs__info`,children:[(0,Y.jsxs)(`span`,{className:`oc-prefs__label`,children:[n,i?(0,Y.jsx)(W,{variant:`outline`,children:D()}):l?(0,Y.jsx)(W,{variant:`secondary`,children:ee()}):null]}),r?(0,Y.jsx)(`span`,{className:`oc-prefs__help`,children:r}):null]}),(0,Y.jsxs)(`div`,{className:`oc-prefs__ctl`,children:[!i&&l?(0,Y.jsx)(`button`,{type:`button`,className:`oc-prefs__reset`,onClick:()=>void c({key:e,value:null}),children:Ae()}):null,(0,Y.jsx)(He,{checked:a,disabled:i,onCheckedChange:t=>{e===`notifSystem`&&t&&typeof Notification<`u`&&Notification.permission==="default"&&Notification.requestPermission(),c({key:e,value:t})},"aria-label":n})]}),s?(0,Y.jsx)(Ze,{prefKey:e,ui:o}):null]},e)})]},e.id))}),(0,Y.jsx)(Qe,{current:a?.dictationShortcut??null,enabled:o.effective.voiceInput===!0})]}):(0,Y.jsx)(`div`,{className:`oc-prefs__empty`,children:he()})}function et(){let e=L(l.me.getMe,{host:q}),t=i(l.me.setLocale),n=i(l.me.setMyName),r=Be(),a=e?.locale??`default`,o=e?.name??``,[s,c]=(0,J.useState)(null),u=s??o,d=u.trim()!==o.trim();async function f(){try{await n({name:u}),c(null),r.success(Ee())}catch(e){r.error(_e(),e)}}return(0,Y.jsxs)(`div`,{className:`oc-appearance`,children:[(0,Y.jsxs)(`section`,{className:`oc-show__section`,children:[(0,Y.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,Y.jsx)(`h2`,{className:`oc-show__title`,children:ye()}),(0,Y.jsx)(`p`,{className:`oc-show__desc`,children:Se()})]}),(0,Y.jsxs)(`div`,{className:`oc-show__row`,children:[(0,Y.jsx)(G,{className:`max-w-xs`,value:u,maxLength:120,placeholder:j(),onChange:e=>c(e.target.value),onKeyDown:e=>{e.key===`Enter`&&d&&(e.preventDefault(),f())}}),(0,Y.jsx)(H,{size:`sm`,disabled:!d,onClick:()=>void f(),children:De()})]}),(0,Y.jsx)(`p`,{className:`oc-show__desc`,children:k()})]}),(0,Y.jsxs)(`section`,{className:`oc-show__section`,children:[(0,Y.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,Y.jsx)(`h2`,{className:`oc-show__title`,children:O()}),(0,Y.jsx)(`p`,{className:`oc-show__desc`,children:Te()})]}),(0,Y.jsxs)(`div`,{className:`oc-show__row`,children:[Ve().map(e=>(0,Y.jsx)(H,{variant:a===e.value?`default`:`outline`,size:`sm`,onClick:()=>void t({locale:e.value}),children:e.label},e.value)),(0,Y.jsx)(H,{variant:a==="default"?`default`:`outline`,size:`sm`,onClick:()=>void t({locale:null}),children:w()})]}),(0,Y.jsx)(`p`,{className:`oc-show__desc`,children:xe()})]}),(0,Y.jsxs)(`section`,{className:`oc-show__section`,children:[(0,Y.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,Y.jsx)(`h2`,{className:`oc-show__title`,children:E()}),(0,Y.jsx)(`p`,{className:`oc-show__desc`,children:F()})]}),(0,Y.jsx)($e,{})]})]})}export{et as PreferencesTab};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$t as r,
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$t as r,AM as i,Ar as a,Cg as o,Dg as s,Dr as c,E as l,Eg as u,Ig as d,Lg as f,Mr as p,Og as m,Or as h,Qt as g,Sg as _,Tg as v,Zt as ee,_g as y,bg as b,dg as x,fa as S,fg as C,ga as w,gg as T,ha as te,hg as E,jM as D,jr as ne,kg as re,kr as ie,ma as ae,mg as O,pa as k,pg as A,ug as j,vg as M,wg as N,xg as P,yg as F}from"./dist-CHawRMT8.js";import{d as I,f as L,i as R,l as z,n as B,r as V,t as H,u as U}from"./FieldLabel-u_jnizyn.js";import{t as W}from"./button-BC70Om4X.js";import{C as G,S as K,b as q,p as J,w as Y,x as X,xt as oe,z as se}from"./index-C4W6RiZP.js";import{r as Z,t as ce}from"./locales-CPjguROj.js";import{t as le}from"./localePickerView-C2RmOS86.js";/* empty css */var Q=t(e(),1),$=n(),ue={media_delivery:{label:N,help:o},documentary_fetch:{label:_,help:P},inbound_files:{label:b,help:F},history_summary:{label:w,help:te},file_curation:{label:p,help:ne}},de={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`},fe={outboundDir:
|
|
4
|
+
- [Fait 1](fait-1.md) - note du projet`},fe={outboundDir:C,references:x,files:j,previous_summary:ae,new_messages:k,max_chars:S,file_name:a,budget_chars:ie,feedback:h,content:c};function pe(){let e=D(l.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:y()})});let r=e.find(e=>e._id===t)??e[0];return(0,$.jsxs)(`div`,{className:`oc-injtab`,children:[(0,$.jsxs)(`div`,{className:`oc-injtab__head`,children:[(0,$.jsx)(B,{label:re(),help:m()}),(0,$.jsxs)(`label`,{className:`oc-injtab__picker`,children:[(0,$.jsx)(`span`,{children:M()}),(0,$.jsxs)(q,{value:r._id,onValueChange:e=>n(e),children:[(0,$.jsx)(G,{size:`sm`,className:`min-w-44`,children:(0,$.jsx)(Y,{})}),(0,$.jsx)(X,{children:e.map(e=>(0,$.jsx)(K,{value:e._id,children:e.displayName??e.name},e._id))})]})]})]}),(0,$.jsx)(me,{instance:r},r._id)]})}function me({instance:e}){let t=i(l.admin.upsertInstanceConfig),n=se(),a=D(l.me.getMe,{host:oe}),o=e.config??{},s=Z(e.config?.contentLocale,a?.defaultLocale??void 0),[c,u]=(0,Q.useState)(()=>R(o,s));(0,Q.useEffect)(()=>{u(R(o,s))},[s,e._id]);let[p,m]=(0,Q.useState)(!1),h=c.promptInjections,_=(e,t)=>u({...c,promptInjections:{...h,[e]:{...h[e],...t}}});async function v(){m(!0);try{await t({instanceId:e._id,config:V(c,o,s)})}catch(e){n.error(d(),e)}finally{m(!1)}}async function y(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(d(),e)}}let b=e.config?.contentLocale??`default`,x=ce[Z(void 0,a?.defaultLocale??void 0)];return(0,$.jsxs)(`div`,{className:`oc-injtab__body`,children:[(0,$.jsxs)(`div`,{className:`oc-injtab__content-locale`,children:[(0,$.jsx)(`span`,{children:r()}),(0,$.jsxs)(q,{value:b,onValueChange:e=>void y(e),children:[(0,$.jsx)(G,{size:`sm`,className:`min-w-44`,children:(0,$.jsx)(Y,{})}),(0,$.jsxs)(X,{children:[(0,$.jsx)(K,{value:`default`,children:ee({locale:x})}),le().map(e=>(0,$.jsx)(K,{value:e.value,children:e.label},e.value))]})]}),(0,$.jsx)(`p`,{className:`oc-admin__hint`,children:g()})]}),U.map(e=>(0,$.jsx)(he,{injKey:e,def:z[e],i18n:ue[e],row:h[e]??{enabled:!0,template:z[e].defaultTemplate[s]},contentLocale:s,onChange:t=>_(e,t)},e)),(0,$.jsx)(`div`,{className:`oc-injtab__actions`,children:(0,$.jsx)(W,{size:`sm`,onClick:()=>void v(),disabled:p,children:f()})})]})}function he({injKey:e,def:t,i18n:n,row:r,contentLocale:i,onChange:a}){let[o,c]=(0,Q.useState)(!1),l=r.template.trim()!==t.defaultTemplate[i],d=t.togglable&&!r.enabled,f=Object.fromEntries(t.placeholders.map(e=>[e,de[e]??`{${e}}`])),p=I(e,r,i),m=p?L(p,f):``;return(0,$.jsxs)(`section`,{className:`oc-injcard`,children:[(0,$.jsxs)(`div`,{className:`oc-injcard__head`,children:[t.togglable?(0,$.jsxs)(`label`,{className:`oc-field--row`,children:[(0,$.jsx)(J,{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()}),l&&(0,$.jsx)(`span`,{className:`oc-injection__badge`,children:u()})]}),(0,$.jsx)(`textarea`,{className:`oc-injcard__text`,value:r.template,disabled:d,rows:8,spellCheck:!1,onChange:e=>a({template:e.target.value})}),(0,$.jsxs)(`div`,{className:`oc-injection__foot`,children:[(0,$.jsxs)(`div`,{className:`oc-injcard__phs`,children:[(0,$.jsx)(`span`,{className:`oc-injection__ph`,children:v()}),t.placeholders.map(e=>(0,$.jsxs)(`span`,{className:`oc-injcard__ph-chip`,children:[(0,$.jsx)(`code`,{children:`{${e}}`}),(0,$.jsx)(H,{text:(fe[e]??(()=>e))()})]},e))]}),(0,$.jsxs)(`div`,{className:`oc-injcard__btns`,children:[(0,$.jsx)(W,{variant:`ghost`,size:`sm`,onClick:()=>c(e=>!e),children:o?E():T()}),l&&(0,$.jsx)(W,{variant:`ghost`,size:`sm`,onClick:()=>a({template:t.defaultTemplate[i]}),children:s()})]})]}),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:O()})]}):(0,$.jsx)(`span`,{className:`oc-injection__ph`,children:A()})})]})}export{pe as PromptInjectionsTab};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$y as r,AM as i,By as ee,Cb as a,E as o,Hy as s,Iy as c,Ly as l,Qy as te,Ry as u,Sb as d,Tb as f,Uy as p,Vy as m,Wy as h,Xy as g,Zy as ne,_b as _,ab as re,bb as v,cb as y,db as b,eb as x,fb as S,gb as C,hb as w,ib as ie,jM as T,lb as E,mb as D,nb as O,ni as k,ob as A,pb as j,rb as M,sb as N,tb as P,ub as F,vb as I,wb as L,xb as R,yb as z,zy as ae}from"./dist-CHawRMT8.js";import{t as B}from"./button-BC70Om4X.js";import{B as V,Rt as H,ct as U,lt as W,p as G,u as K,z as q}from"./index-C4W6RiZP.js";import{t as J}from"./roleDescriptions-CSRZrtA-.js";var Y=t(e(),1),X=n(),Z=[{group:()=>f(),keys:[{key:`traces.read`,label:()=>v()},{key:`traces.read.content`,label:()=>z(),phi:!0},{key:`traces.write`,label:()=>I()}]},{group:()=>L(),keys:[{key:`kpi.read`,label:()=>v()},{key:`kpi.write`,label:()=>I()}]},{group:()=>a(),keys:[{key:`openclaw.query`,label:()=>_()},{key:`anomalies.read`,label:()=>C()},{key:`anomalies.report`,label:()=>w()}]},{group:()=>d(),keys:[{key:`chats.read`,label:()=>v()},{key:`selfheal`,label:()=>j()},{key:`feedback.respond`,label:()=>k()}]},{group:()=>R(),keys:[{key:`admin.manage`,label:()=>D()}]}],oe=Z.flatMap(e=>e.keys.map(e=>e.key));function Q(e){return e.includes(`*`)}var $={key:``,name:``,description:``};function se(){let e=T(o.apiKeys.listRoles,{}),t=i(o.apiKeys.createRole),n=i(o.apiKeys.ensureRolesSeeded),a=i(o.apiKeys.updateRolePermissions).withOptimisticUpdate((e,{roleId:t,permissions:n})=>{let r=e.getQuery(o.apiKeys.listRoles,{});r&&e.setQuery(o.apiKeys.listRoles,{},r.map(e=>e._id===t?{...e,permissions:n}:e))}),d=V(),f=q(),[_,v]=(0,Y.useState)(!1),[C,w]=(0,Y.useState)($),[D,k]=(0,Y.useState)(new Set);(0,Y.useEffect)(()=>{n({}).catch(e=>{f.error(b(),e)})},[n,f]);let j=e??[];async function I(e,t){if(Q(e.permissions)||D.has(e._id))return;let n=e.permissions.includes(t)?e.permissions.filter(e=>e!==t):[...e.permissions,t];if(!(e.builtin&&!await d({title:F({name:e.name}),description:E(),confirmLabel:y()}))){k(t=>new Set(t).add(e._id));try{await a({roleId:e._id,permissions:n})}catch(e){f.error(N(),e)}finally{k(t=>{let n=new Set(t);return n.delete(e._id),n})}}}async function L(){try{await t({key:C.key,name:C.name,description:C.description||void 0,permissions:[]}),w($),v(!1)}catch(e){f.error(A(),e)}}let R=e===void 0,z=!R&&j.length===0;return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`p`,{className:`oc-admin__hint`,children:[re(),` `,(0,X.jsx)(`code`,{children:`admin`}),` `,ie(),` `,(0,X.jsx)(`code`,{children:`traces.read.content`}),` `,M()]}),(0,X.jsxs)(`div`,{className:`oc-dt`,children:[(0,X.jsxs)(`div`,{className:`oc-dt__bar`,children:[(0,X.jsx)(`h2`,{className:`oc-dt__title`,children:O()}),(0,X.jsx)(`div`,{className:`oc-dt__bar-actions`,children:(0,X.jsx)(B,{size:`sm`,onClick:()=>{w($),v(!0)},children:P()})})]}),R?(0,X.jsx)(`p`,{className:`oc-admin__hint`,children:x()}):z?(0,X.jsx)(`p`,{className:`oc-admin__hint`,children:r()}):(0,X.jsx)(`div`,{className:`oc-matrix__scroll`,children:(0,X.jsxs)(`table`,{className:`oc-matrix`,children:[(0,X.jsxs)(`thead`,{children:[(0,X.jsxs)(`tr`,{children:[(0,X.jsx)(`th`,{className:`oc-matrix__corner`,rowSpan:2,children:te()}),Z.map(e=>(0,X.jsx)(`th`,{className:`oc-matrix__group`,colSpan:e.keys.length,children:e.group()},e.group()))]}),(0,X.jsx)(`tr`,{children:Z.flatMap(e=>e.keys.map(e=>(0,X.jsxs)(`th`,{className:`oc-matrix__perm`,title:e.phi?S({key:e.key}):e.key,children:[e.label(),e.phi?(0,X.jsx)(`span`,{className:`oc-matrix__phi`,children:` ⚠`}):null]},e.key)))})]}),(0,X.jsx)(`tbody`,{children:j.map(e=>{let t=Q(e.permissions),n=D.has(e._id);return(0,X.jsxs)(`tr`,{children:[(0,X.jsxs)(`th`,{className:`oc-matrix__rolecell`,children:[(0,X.jsxs)(`div`,{className:`oc-matrix__rolename`,children:[(0,X.jsx)(`span`,{children:e.name}),(0,X.jsx)(`code`,{className:`oc-matrix__rolekey`,children:e.key}),e.builtin?(0,X.jsxs)(U,{variant:`outline`,className:`gap-1`,children:[(0,X.jsx)(H,{}),` `,ne()]}):(0,X.jsx)(U,{variant:`secondary`,children:g()})]}),J(e)?(0,X.jsx)(`p`,{className:`oc-matrix__roledesc`,children:J(e)}):null]}),oe.map(r=>(0,X.jsx)(`td`,{className:`oc-matrix__cell`,children:(0,X.jsx)(G,{checked:t||e.permissions.includes(r),disabled:t||n,"aria-label":`${e.key} · ${r}`,title:t?h():n?p():r,onCheckedChange:()=>void I(e,r)})},r))]},e.key)})})]})})]}),(0,X.jsx)(K,{open:_,onOpenChange:v,title:s(),description:m(),canSubmit:!!(C.key&&C.name),onSubmit:L,submitLabel:ee(),children:(0,X.jsxs)(`div`,{className:`oc-form`,children:[(0,X.jsxs)(`label`,{className:`oc-field`,children:[(0,X.jsx)(`span`,{className:`oc-field__label`,children:ae()}),(0,X.jsx)(W,{value:C.key,placeholder:u(),onChange:e=>w({...C,key:e.target.value})})]}),(0,X.jsxs)(`label`,{className:`oc-field`,children:[(0,X.jsx)(`span`,{className:`oc-field__label`,children:l()}),(0,X.jsx)(W,{value:C.name,onChange:e=>w({...C,name:e.target.value})})]}),(0,X.jsxs)(`label`,{className:`oc-field`,children:[(0,X.jsx)(`span`,{className:`oc-field__label`,children:c()}),(0,X.jsx)(W,{value:C.description,onChange:e=>w({...C,description:e.target.value})})]})]})})]})}export{se as RolesTab};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$D as r,$O as i,AM as a,AO as ee,BO as te,CO as ne,DO as re,E as o,EO as ie,FO as ae,GD as s,GO as oe,HD as c,HO as se,IO as ce,JD as l,JO as le,KD as u,KO as ue,LO as de,MO as fe,NO as pe,OM as me,OO as he,PO as ge,QD as _e,QO as ve,RO as ye,SO as be,TO as xe,UD as d,UO as Se,VO as Ce,WD as f,WO as we,XD as Te,XO as Ee,YD as p,YO as De,ZD as m,ZO as Oe,_O as ke,aO as h,ak as Ae,bO as je,cO as g,ck as Me,dO as _,eO as v,ek as Ne,fO as Pe,gO as Fe,hO as Ie,iO as y,ik as Le,jM as b,jO as Re,kO as ze,lO as x,mO as Be,nO as S,nk as C,oO as w,ok as Ve,pO as He,qD as T,qO as Ue,rO as E,rk as D,sO as O,sk as We,tO as k,tk as Ge,uO as A,vO as Ke,wO as qe,xO as Je,yO as Ye,zO as Xe}from"./dist-CHawRMT8.js";import{n as j}from"./dist-B0WeNmZI.js";import{i as Ze}from"./dist-bebyRR79.js";import{t as M}from"./button-BC70Om4X.js";import{$ as N,B as Qe,C as P,S as F,Wt as I,Xt as $e,Yt as et,b as L,ct as R,dt as z,et as B,ft as V,ht as H,lt as tt,mt as nt,pt as rt,qt as it,u as at,ut as U,w as W,x as G,z as ot}from"./index-C4W6RiZP.js";import{t as st}from"./FilterBar-DEFwQ8Ux.js";import{t as ct}from"./DataTableShell-CuO0YQq6.js";import{t as lt}from"./roleDescriptions-CSRZrtA-.js";var K=t(e(),1),q=n(),J=[{value:`never`,label:()=>l(),days:null},{value:`30`,label:()=>T(),days:30},{value:`90`,label:()=>u(),days:90}],Y=720*60*60*1e3,X=`__all__`,Z={name:``,roleKey:``,description:``};function Q(){let e=$e({from:`/settings/serviceAccounts`}),t=et({from:`/settings/serviceAccounts`}),n=e.q??``,r=e.status??X,[s,c]=(0,K.useState)(X),l=e=>void t({search:t=>({...t,q:e||void 0}),replace:!0}),u=e=>void t({search:t=>({...t,status:e===X?void 0:e})}),_e=b(o.apiKeys.listServiceAccounts,{filter:{q:n||void 0,role:s===X?void 0:s,disabled:r===X?void 0:r===`disabled`}}),d=b(o.apiKeys.listKeys,{}),f=b(o.apiKeys.listRoles,{}),Te=a(o.apiKeys.createServiceAccount),p=a(o.apiKeys.updateServiceAccount),m=a(o.apiKeys.deleteServiceAccount),h=me(o.apiKeys.mintApiKey),g=a(o.apiKeys.revokeApiKey),_=Qe(),v=ot(),y=n!==``||s!==X||r!==X;function x(){c(X),t({search:{},replace:!0})}let[S,w]=(0,K.useState)(!1),[T,E]=(0,K.useState)(Z),[O,k]=(0,K.useState)(null),[A,j]=(0,K.useState)(new Set),[N,I]=(0,K.useState)(null),z=(0,K.useRef)(!1),[B,V]=(0,K.useState)(new Set),[H,nt]=(0,K.useState)({}),[rt,U]=(0,K.useState)(null),Y=(0,K.useMemo)(()=>{let e=new Map;for(let t of d??[]){let n=e.get(t.serviceAccountId)??[];n.push(t),e.set(t.serviceAccountId,n)}return e},[d]);function Q(e){j(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})}async function ft(){try{O?(await p({serviceAccountId:O,name:T.name,roleKey:T.roleKey,description:T.description}),v.success(ie())):await Te({name:T.name,roleKey:T.roleKey,description:T.description||void 0}),E(Z),k(null),w(!1)}catch(e){v.error(O?re():he(),e)}}function pt(e){E({name:e.name,roleKey:e.roleKey,description:e.description??``}),k(e._id),w(!0)}async function mt(e){if(z.current)return;z.current=!0;let t=H[e._id]??`never`,n=J.find(e=>e.value===t)?.days??null,r=n?Date.now()+n*24*60*60*1e3:void 0;I(e._id);try{let t=await h({serviceAccountId:e._id,expiresAt:r});U({accountName:e.name,plaintext:t.plaintext,prefix:t.prefix,lastFour:t.lastFour})}catch(e){v.error(xe(),e)}finally{z.current=!1,I(null)}}async function $(e){if(await _({title:qe(),description:(0,q.jsxs)(q.Fragment,{children:[ne(),` `,(0,q.jsx)(`span`,{className:`font-mono`,children:e.name}),` `,be(),` `,(0,q.jsx)(`strong`,{children:Je()}),` `,je()]}),confirmWord:e.name,confirmLabel:Ye(),destructive:!0}))try{await m({serviceAccountId:e._id}),v.success(Ke(),e.name)}catch(e){v.error(ke(),e)}}async function ht(e){if(await _({title:Fe(),description:(0,q.jsxs)(q.Fragment,{children:[Ie(),` `,(0,q.jsxs)(`span`,{className:`font-mono`,children:[e.prefix,`…`,e.lastFour]}),` `,Be()]}),confirmLabel:He(),destructive:!0})&&!B.has(e._id)){V(t=>new Set(t).add(e._id));try{await g({keyId:e._id})}catch(e){v.error(Pe(),e)}finally{V(t=>{let n=new Set(t);return n.delete(e._id),n})}}}return(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(`p`,{className:`oc-admin__hint`,children:Me()}),(0,q.jsxs)(st,{q:n,onQChange:l,searchPlaceholder:We(),onReset:x,canReset:y,children:[(0,q.jsxs)(L,{value:s,onValueChange:c,children:[(0,q.jsx)(P,{size:`sm`,className:`w-40`,children:(0,q.jsx)(W,{placeholder:Ve()})}),(0,q.jsxs)(G,{children:[(0,q.jsx)(F,{value:X,children:Ae()}),(f??[]).map(e=>(0,q.jsx)(F,{value:e.key,children:e.key},e._id))]})]}),(0,q.jsxs)(L,{value:r,onValueChange:u,children:[(0,q.jsx)(P,{size:`sm`,className:`w-36`,children:(0,q.jsx)(W,{})}),(0,q.jsxs)(G,{children:[(0,q.jsx)(F,{value:X,children:Le()}),(0,q.jsx)(F,{value:`active`,children:D()}),(0,q.jsx)(F,{value:`disabled`,children:C()})]})]})]}),(0,q.jsx)(ct,{title:Ge(),rows:_e,addLabel:Ne(),onAdd:()=>{E(Z),k(null),w(!0)},emptyHint:i(),isExpanded:e=>A.has(e._id),renderExpanded:e=>(0,q.jsx)(ut,{account:e,keys:Y.get(e._id)??[],onRevoke:ht,revoking:B}),rowActions:e=>[{label:De(),onSelect:()=>pt(e)},{label:ve(),onSelect:()=>void mt(e)},{label:A.has(e._id)?Oe():Ee(),onSelect:()=>Q(e._id)},{label:le(),variant:`destructive`,onSelect:()=>void $(e)}],columns:[{header:``,className:`w-8`,cell:e=>(0,q.jsx)(M,{variant:`ghost`,size:`icon-sm`,"aria-label":A.has(e._id)?Ue():ue(),onClick:()=>Q(e._id),children:A.has(e._id)?(0,q.jsx)(Ze,{}):(0,q.jsx)(it,{})})},{header:oe(),sort:e=>e.name,cell:e=>(0,q.jsxs)(`div`,{className:`flex flex-col`,children:[(0,q.jsx)(`span`,{children:e.name}),e.description?(0,q.jsx)(`span`,{className:`text-muted-foreground text-xs`,children:e.description}):null]})},{header:we(),sort:e=>e.roleKey,cell:e=>(0,q.jsx)(R,{variant:`secondary`,children:e.roleKey})},{header:Se(),sort:e=>+!!e.disabled,cell:e=>e.disabled?(0,q.jsx)(R,{variant:`destructive`,children:C()}):(0,q.jsx)(R,{variant:`outline`,children:D()})},{header:se(),cell:e=>(0,q.jsxs)(L,{value:H[e._id]??`never`,onValueChange:t=>nt(n=>({...n,[e._id]:t})),children:[(0,q.jsx)(P,{size:`sm`,className:`w-32`,children:(0,q.jsx)(W,{})}),(0,q.jsx)(G,{children:J.map(e=>(0,q.jsx)(F,{value:e.value,children:e.label()},e.value))})]})},{header:Ce(),sort:e=>(Y.get(e._id)??[]).filter(e=>!e.disabled).length,cell:e=>{let t=(Y.get(e._id)??[]).filter(e=>!e.disabled).length;return(0,q.jsx)(`span`,{className:`oc-sa__keycount`,children:N===e._id?te():Xe({count:t})})}}]}),(0,q.jsx)(at,{open:S,onOpenChange:e=>{w(e),e||k(null)},title:O?ye():ae(),description:O?de():ge(),canSubmit:!!(T.name&&T.roleKey),onSubmit:ft,submitLabel:O?ce():pe(),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:fe()}),(0,q.jsx)(tt,{value:T.name,onChange:e=>E({...T,name:e.target.value})})]}),(0,q.jsxs)(`label`,{className:`oc-field`,children:[(0,q.jsx)(`span`,{className:`oc-field__label`,children:Re()}),(0,q.jsxs)(L,{value:T.roleKey||void 0,onValueChange:e=>E({...T,roleKey:e}),children:[(0,q.jsx)(P,{className:`w-full`,children:(0,q.jsx)(W,{placeholder:ee()})}),(0,q.jsx)(G,{children:(f??[]).map(e=>(0,q.jsxs)(F,{value:e.key,children:[e.name,` (`,e.key,`)`]},e._id))})]}),(()=>{let e=(f??[]).find(e=>e.key===T.roleKey),t=e?lt(e):null;return t?(0,q.jsx)(`span`,{className:`text-muted-foreground text-xs`,children:t}):null})()]}),(0,q.jsxs)(`label`,{className:`oc-field`,children:[(0,q.jsx)(`span`,{className:`oc-field__label`,children:ze()}),(0,q.jsx)(tt,{value:T.description,onChange:e=>E({...T,description:e.target.value})})]})]})}),(0,q.jsx)(dt,{minted:rt,onClose:()=>U(null)})]})}function ut({account:e,keys:t,onRevoke:n,revoking:r}){return(0,q.jsxs)(`div`,{className:`oc-sa__keys`,children:[(0,q.jsxs)(`div`,{className:`oc-sa__keys-head`,children:[_(),` `,(0,q.jsx)(`span`,{className:`font-medium`,children:e.name})]}),t.length===0?(0,q.jsx)(`p`,{className:`oc-admin__hint`,children:A()}):(0,q.jsxs)(`table`,{className:`oc-sa__keytable`,children:[(0,q.jsx)(`thead`,{children:(0,q.jsxs)(`tr`,{children:[(0,q.jsx)(`th`,{children:x()}),(0,q.jsx)(`th`,{children:g()}),(0,q.jsx)(`th`,{children:O()}),(0,q.jsx)(`th`,{children:w()}),(0,q.jsx)(`th`,{children:h()}),(0,q.jsx)(`th`,{children:y()}),(0,q.jsx)(`th`,{})]})}),(0,q.jsx)(`tbody`,{children:t.map(t=>(0,q.jsxs)(`tr`,{children:[(0,q.jsx)(`td`,{children:(0,q.jsxs)(`code`,{className:`oc-sa__keyid`,children:[t.prefix,`…`,t.lastFour]})}),(0,q.jsx)(`td`,{children:(0,q.jsx)(R,{variant:`secondary`,children:e.roleKey})}),(0,q.jsx)(`td`,{children:B(t.createdAt)}),(0,q.jsx)(`td`,{className:ft(t.lastUsedAt)?`oc-sa__stale`:``,children:pt(t.lastUsedAt)}),(0,q.jsx)(`td`,{children:mt(t.expiresAt)}),(0,q.jsx)(`td`,{children:$(t)}),(0,q.jsx)(`td`,{className:`text-right`,children:t.disabled?null:(0,q.jsx)(M,{variant:`destructive`,size:`sm`,disabled:r.has(t._id),onClick:()=>n(t),children:r.has(t._id)?E():S()})})]},t._id))})]})]})}function dt({minted:e,onClose:t}){let[n,i]=(0,K.useState)(!1);async function a(){if(e)try{await navigator.clipboard.writeText(e.plaintext),i(!0),window.setTimeout(()=>i(!1),2e3)}catch{}}return(0,q.jsx)(U,{open:e!==null,onOpenChange:e=>{e||(i(!1),t())},children:e?(0,q.jsxs)(z,{className:`max-w-lg`,showCloseButton:!1,onInteractOutside:e=>e.preventDefault(),onEscapeKeyDown:e=>e.preventDefault(),children:[(0,q.jsxs)(nt,{children:[(0,q.jsx)(H,{children:k()}),(0,q.jsx)(V,{children:v({name:e.accountName})})]}),(0,q.jsx)(`div`,{className:`oc-sa__minted-warning`,children:r()}),(0,q.jsxs)(`div`,{className:`oc-sa__minted-box`,children:[(0,q.jsx)(`code`,{className:`oc-sa__minted-plain`,children:e.plaintext}),(0,q.jsxs)(M,{variant:`outline`,size:`sm`,onClick:()=>void a(),"aria-label":_e(),children:[n?(0,q.jsx)(j,{}):(0,q.jsx)(I,{}),n?m():Te()]})]}),(0,q.jsx)(rt,{children:(0,q.jsx)(M,{onClick:()=>{i(!1),t()},children:p()})})]}):null})}function ft(e){return e===null?!1:Date.now()-e>Y}function pt(e){return e===null?s():B(e)}function mt(e){return e===null?`—`:N(e)}function $(e){return e.disabled?(0,q.jsx)(R,{variant:`destructive`,children:f()}):e.expiresAt!==null&&e.expiresAt<Date.now()?(0,q.jsx)(R,{variant:`outline`,children:d()}):(0,q.jsx)(R,{variant:`outline`,children:c()})}export{Q as ServiceAccountsTab};
|