@lacneu/atrium 0.50.0 → 0.51.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 +1 -0
- package/dist/assets/{AdvancedFilter-Bw_6N4Fp.js → AdvancedFilter-BQlL-4N9.js} +1 -1
- package/dist/assets/AgentFilesTab-By3Jzopm.js +3 -0
- package/dist/assets/AnomaliesTab-Cs6vlfDv.js +1 -0
- package/dist/assets/AuditTab-BOu6pgTB.js +1 -0
- package/dist/assets/BridgeTab-DFpunFsv.js +1 -0
- package/dist/assets/ChatDefaultsTab-DkHZTknY.js +1 -0
- package/dist/assets/{DataTableShell-HZGBUlvm.js → DataTableShell-KGrtOG5M.js} +1 -1
- package/dist/assets/{DetailChips-gFOfqX_a.js → DetailChips-C2LFFpNg.js} +1 -1
- package/dist/assets/FeedbacksTab-D34MEu6C.js +1 -0
- package/dist/assets/{FieldLabel-pNGSpfk-.js → FieldLabel-CKVYl95W.js} +1 -1
- package/dist/assets/FilesTab-ByKXXey8.js +1 -0
- package/dist/assets/{FilterBar-DlPympG5.js → FilterBar-BVVVO1_O.js} +1 -1
- package/dist/assets/GroupsTab-CJUI6gQ9.js +1 -0
- package/dist/assets/InstancesTab-Cb_2msXj.js +1 -0
- package/dist/assets/IntegrationsTab-B9Nkc7-l.js +1 -0
- package/dist/assets/KpiTab-B6SqslSj.js +1 -0
- package/dist/assets/PreferencesTab-BdvOFp2E.js +1 -0
- package/dist/assets/PromptInjectionsTab-CgAFhOn5.js +4 -0
- package/dist/assets/RolesTab-CtV113pW.js +1 -0
- package/dist/assets/ServiceAccountsTab-Bu_j0kUL.js +1 -0
- package/dist/assets/SubAgentReportsTab-G_s4_aPf.js +1 -0
- package/dist/assets/ThemeShowroom-CbU-xJra.js +1 -0
- package/dist/assets/{TimeRangePicker-Cm5l2vkz.js → TimeRangePicker-NSOkx3C0.js} +1 -1
- package/dist/assets/TracesTab-Wo-rxO1v.js +1 -0
- package/dist/assets/UsersTab-DO7Wa8iJ.js +1 -0
- package/dist/assets/VoiceTab-ilUT53Ds.js +1 -0
- package/dist/assets/{button-B4Nos6AU.js → button-b04wLuGq.js} +1 -1
- package/dist/assets/{card-DhM6Y5He.js → card-DdBF2ct9.js} +1 -1
- package/dist/assets/chevrons-up-down-Kyw8BbOf.js +1 -0
- package/dist/assets/{compatView-DwEzKEAD.js → compatView-S4X8HKXY.js} +1 -1
- package/dist/assets/dispatchErrorInfo-Cs8_1qCQ.js +1 -0
- package/dist/assets/{dist-BzsC63K9.js → dist-6oi7FQ0i.js} +1 -1
- package/dist/assets/{dist-qfxevi2g.js → dist-CtUr3P8h.js} +1 -1
- package/dist/assets/{dist-BwHHVs_B.js → dist-DBet7oNc.js} +1 -1
- package/dist/assets/{dist-BTpttlbH.js → dist-HBBi9Y25.js} +5 -5
- package/dist/assets/{highlighted-body-OFNGDK62-DUhXym2u.js → highlighted-body-OFNGDK62-BOjjbbd6.js} +1 -1
- package/dist/assets/{index-CnCsAZYf.css → index-CBZrw7d-.css} +1 -1
- package/dist/assets/index-DBQ43N4_.js +238 -0
- package/dist/assets/mermaid-GHXKKRXX-CXCdU_oF.js +1 -0
- package/dist/assets/{pdf-BjDyP8tM.js → pdf-D7AA0FY6.js} +1 -1
- package/dist/assets/roleDescriptions-onSlZ7A3.js +1 -0
- package/dist/assets/{table-BBE4oFvW.js → table-CtNwimV_.js} +1 -1
- package/dist/assets/{tabs-DlXyYN7h.js → tabs-BJyz65LR.js} +1 -1
- package/dist/assets/x-DBKGK4o_.js +1 -0
- package/dist/index.html +8 -8
- package/package.json +1 -1
- package/dist/assets/AccessTab-YfxJ8TyH.js +0 -1
- package/dist/assets/AgentFilesTab-BGjK8vy-.js +0 -3
- package/dist/assets/AnomaliesTab-ClY_uTZu.js +0 -1
- package/dist/assets/AuditTab-DNV2Z66C.js +0 -1
- package/dist/assets/BridgeTab-BDp1JcI8.js +0 -1
- package/dist/assets/ChatDefaultsTab-Cuma5jME.js +0 -1
- package/dist/assets/FeedbacksTab-BaSoBVK5.js +0 -1
- package/dist/assets/FilesTab-BxjNQ6IX.js +0 -1
- package/dist/assets/GroupsTab-CUch1a_C.js +0 -1
- package/dist/assets/InstancesTab-DRWZsjZC.js +0 -1
- package/dist/assets/IntegrationsTab-C7KPWF6x.js +0 -1
- package/dist/assets/KpiTab-6QaTYyCv.js +0 -1
- package/dist/assets/PreferencesTab-CLEVHQTj.js +0 -1
- package/dist/assets/PromptInjectionsTab-CnlX7r8C.js +0 -4
- package/dist/assets/RolesTab-orl-1HS-.js +0 -1
- package/dist/assets/ServiceAccountsTab-CtwpNIDj.js +0 -1
- package/dist/assets/SubAgentReportsTab-MRixaruJ.js +0 -1
- package/dist/assets/ThemeShowroom-BCYOO2fm.js +0 -1
- package/dist/assets/TracesTab-BATP4Ee5.js +0 -1
- package/dist/assets/UsersTab-CN9dGPvE.js +0 -1
- package/dist/assets/VoiceTab-DJyEAu0o.js +0 -1
- package/dist/assets/chevrons-up-down-Du6glRFD.js +0 -1
- package/dist/assets/dispatchErrorInfo-C27wKMfE.js +0 -1
- package/dist/assets/index-GIhUlE6M.js +0 -233
- package/dist/assets/mermaid-GHXKKRXX-D_CGWBHm.js +0 -1
- package/dist/assets/roleDescriptions-8ML7Rdme.js +0 -1
- package/dist/assets/x-BLHWZzIt.js +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{E as r,OM 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,ld as p,md as m,od as h,pd as g,rd as _,sd as v,ud as y,yM as b}from"./dist-HBBi9Y25.js";import{C as x,S,b as C,ct as w,w as T,x as E}from"./index-DBQ43N4_.js";var D=t(e(),1);function O(e){return e===`user`?v():e===`all`?h():o({group:e.group})}function k(e){return e===`common`?f():e===`owner`?_():o({group:e.group})}var A=n();function j(e){return e.name||e.email||e.userId.slice(0,8)}function M(){let e=i(r.admin.listUsers,{}),[t,n]=(0,D.useState)(``),o=i(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:b()}):(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:m()}),(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:g()}),o.groups.length===0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:p()}):(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:p()}):(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:p()}):(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:y()}),o.permissions.length===0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:p()}):(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{
|
|
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-HBBi9Y25.js";import{i as u}from"./dist-DBet7oNc.js";import{t as d}from"./x-DBKGK4o_.js";import{t as f}from"./button-b04wLuGq.js";import{C as p,It as m,S as h,b as g,lt as _,w as v,x as y}from"./index-DBQ43N4_.js";import{r as b}from"./TimeRangePicker-NSOkx3C0.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,Ac as i,Bc as a,Br as o,Cc as s,Cr as c,DM 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,Sr as z,TM as B,Tc as ne,Tr as V,Uc as H,Ur as U,Vc as re,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,jc as me,kc as he,qc as ge,qr as _e,tD as ve,wc as ye,wr as be,xM as W,xr as xe,yM as G,zc as Se,zr as Ce}from"./dist-HBBi9Y25.js";import{t as K}from"./button-b04wLuGq.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-DBQ43N4_.js";import{n as Ge,t as Ke}from"./curation-CQksaIbm.js";import{i as qe}from"./compatView-S4X8HKXY.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=M(d.me.getMe,{host:Ue}),t=e?.role===`admin`,n=(e?.permissions??[]).includes(`bridge.read`),r=M(d.admin.listInstances,e!==void 0&&t?{}:`skip`),[i,o]=(0,Y.useState)(null);(0,Y.useEffect)(()=>{!t||!r||r.length===0||(!i||!r.some(e=>e.name===i))&&o(r[0].name)},[t,r,i]);let s=M(d.agents.listAgentsForInstance,t&&i?{instanceName:i}:`skip`),c=M(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=B(d.agentFiles.listAgentFiles),[h,g]=(0,Y.useState)({status:`idle`}),v=p?.instanceName??null,b=p?.agentId??null,x=M(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=M(d.agentFileCuration.listCurations,t&&v!==null&&b!==null?{instanceName:v,agentId:b}:`skip`),j=M(d.agentFileCuration.curationSettings,t&&v!==null?{instanceName:v}:`skip`),N=B(d.agentFileCuration.requestCuration),[te,P]=(0,Y.useState)(null),[I,L]=(0,Y.useState)(null),{toast:R}=J(),z=(0,Y.useMemo)(()=>{let e=new Map;for(let t of A??[])e.has(t.name)||e.set(t.name,t);return e},[A]),ne=(0,Y.useCallback)(async e=>{if(!(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=W(),U=(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:G()}):(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=>o(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:G()}):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:G()}):h.status===`error`?(0,Q.jsxs)(`p`,{className:`oc-afiles__error`,role:`alert`,children:[ge(),` `,(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:U.format(n)})}),r?(0,Q.jsx)(q,{size:14,className:`oc-afiles__warn`,"aria-label":H()}):(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?re():a()}),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:z.get(e.name)??null,inFlight:te===e.name,onCurate:()=>void ne(e.name),onReview:e=>L(e)}):null]},e.name)})}),(0,Q.jsx)(`p`,{className:`oc-afiles__budget`,children:y({used:Z(Ze(h.files),V),total:Z(Je,V),pct:U.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:a,onSaved:o}){let c=B(d.agentFiles.getAgentFile),l=B(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),[M,P]=(0,Y.useState)(!1),F=(0,Y.useCallback)(async r=>{y(!1);try{let i=await c({instanceName:e,agentId:t,name:n});_({content:i.content,updatedAtMs:i.updatedAtMs}),r||S(i.content),j(!1)}catch{y(!0)}},[c,e,t,n]);(0,Y.useEffect)(()=>{F(!1)},[F]);async function I(){if(g!==null){E(!0),P(!1);try{await l({instanceName:e,agentId:t,name:n,content:b,baseUpdatedAtMs:g.updatedAtMs??void 0}),p.success(A({name:n})),o(),await F(!1)}catch(e){et(e)?j(!0):P(!0)}finally{E(!1)}}}let R=g!==null&&b!==g.content,z=(0,Y.useMemo)(()=>g===null?null:$e(g.content,b),[g,b]),V=b.length>X,H=W(),U=(0,Y.useMemo)(()=>new Intl.NumberFormat(H),[H]);return(0,Q.jsx)(Be,{open:!0,onOpenChange:e=>!e&&a(),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:[me(),` `,(0,Q.jsx)(K,{variant:`outline`,size:`sm`,onClick:()=>void F(!1),children:ee()})]}):g===null?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:G()}):(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:[i(),` `,(0,Q.jsx)(K,{variant:`outline`,size:`sm`,onClick:()=>void F(!0),children:he()})]}):null,M?(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${V?` is-over`:``}`,children:m({count:U.format(b.length),max:U.format(X)})}),r?(0,Q.jsx)(K,{size:`sm`,disabled:!R||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})})]}),z?(0,Q.jsxs)(`div`,{className:`oc-afiles__diff`,children:[(0,Q.jsx)(`p`,{className:`oc-afiles__diff-counts`,children:f({added:z.added,removed:z.removed})}),z.sampleAdded.length>0?(0,Q.jsxs)(`div`,{className:`oc-afiles__diff-block`,children:[(0,Q.jsx)(`span`,{className:`oc-afiles__diff-label`,children:ne()}),z.sampleAdded.map((e,t)=>(0,Q.jsx)(`code`,{className:`oc-afiles__diff-line is-add`,children:e||` `},t))]}):null,z.sampleRemoved.length>0?(0,Q.jsxs)(`div`,{className:`oc-afiles__diff-block`,children:[(0,Q.jsx)(`span`,{className:`oc-afiles__diff-label`,children:ye()}),z.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:ve()}),(0,Q.jsx)(Ae,{onClick:()=>void I(),children:s()})]})]})})]})})}function it({curationId:e,onClose:t,onApplied:n}){let r=M(d.agentFileCuration.getProposal,{curationId:e}),i=B(d.agentFileCuration.approveCuration),a=l(d.agentFileCuration.rejectCuration),{toast:s}=J(),[u,f]=(0,Y.useState)(null),[m,_]=(0,Y.useState)(!1),[y,x]=(0,Y.useState)(``),C=W(),T=(0,Y.useMemo)(()=>r?$e(r.beforeContent,r.proposedContent):null,[r]);async function D(){f(`approve`);try{let t=await i({curationId:e});t.ok?(s({title:_e(),variant:`success`}),n()):s({title:t.reason===`conflict`?v():oe({reason:t.reason??`unknown`}),variant:`error`})}catch{s({title:w(),variant:`error`})}finally{f(null)}}async function k(n){f(`reject`);try{let r=y.trim();(await a({curationId:e,...r?{comment:r}:{},relaunch:n})).ok?s({title:n?xe():E(),variant:`success`}):s({title:ie(),variant:`error`}),t()}catch{s({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?U({name:r.name}):G()}),(0,Q.jsx)(Ie,{children:b()})]}),r===void 0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:G()}):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:[o({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():c()}),(0,Q.jsx)(K,{variant:`default`,onClick:()=>void k(!0),disabled:u!==null,children:u===`reject`?h():z()})]})]}):(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};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$v as r,Ay as i,Cy as ee,DM 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,OM as p,Oy as re,Py as m,Qv as h,Sy as ie,Ty as ae,Uv as g,Wv as _,Xv as v,Yv as y,Zv as oe,_y as se,ay as ce,by as le,cy as b,dy as x,ey as ue,fy as S,gy as de,hy as fe,iy as pe,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-HBBi9Y25.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-DBQ43N4_.js";import{n as Te}from"./TimeRangePicker-NSOkx3C0.js";import{t as Ee}from"./FilterBar-BVVVO1_O.js";import{t as De}from"./DataTableShell-KGrtOG5M.js";import{t as K}from"./dispatchErrorInfo-Cs8_1qCQ.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`?m():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),m=Se(e.from,e.to),{from:g,to:_}=Te(m),v=e=>void t({search:t=>({...t,q:e||void 0}),replace:!0}),y=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=a(o.anomalies.resolveAnomaly),Z=(p(o.me.getMe,{host:Ce})?.permissions??[]).includes(`admin.manage`),Q=p(o.anomalies.listAnomalies,{limit:Ne,filter:{q:n||void 0,from:g,to:_,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||m.kind!==`relative`||m.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}),` `,i(),` `,(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(ee(),e)}}return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(`p`,{className:`oc-admin__hint`,children:[ie(),` `,(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:v,searchPlaceholder:_e(),timeRange:m,onTimeRangeChange:V,onReset:Be,canReset:ze,children:[(0,J.jsxs)(R,{value:s,onValueChange:y,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:S()})}),(0,J.jsxs)(G,{children:[(0,J.jsx)(I,{value:Y,children:x()}),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:b()})}),(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:b(),cell:e=>(0,J.jsx)(`code`,{className:`oc-traces__mono`,children:e.kind}),sort:e=>e.kind},{header:S(),cell:e=>(0,J.jsx)(Ie,{severity:e.severity}),sort:e=>e.severity===`critical`?2:+(e.severity===`warn`)},{header:ue(),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:h(),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:[`↗ `,v()]}):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:[`↗ `,v()]}):null]})}function Fe({row:e}){let[t,n]=(0,q.useState)(!1),r=p(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:[y(),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:_()}):(0,J.jsx)(z,{variant:`outline`,children:g()})}function Re(e){return e.length>8?e.slice(0,8):e}export{Z as AnomaliesTab};
|
|
@@ -0,0 +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,OM as p,Ob as m,Pb as h,Rb as g,Sn as _,_n as v,bn as y,jb as b,kb as x,vn as S,xn as C,yn as w,zb as T}from"./dist-HBBi9Y25.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-DBQ43N4_.js";import{n as ee}from"./TimeRangePicker-NSOkx3C0.js";import{t as z}from"./FilterBar-BVVVO1_O.js";import{t as B}from"./AdvancedFilter-BQlL-4N9.js";import{t as V}from"./DataTableShell-KGrtOG5M.js";var H=t(e(),1),U=n(),W={kind:`relative`,from:I,to:`now`},G=`__all__`,K=[{value:`action`,label:_()},{value:`realLabel`,label:C()},{value:`targetLabel`,label:y()},{value:`impersonated`,label:w()},{value:`resource`,label:S()},{value:`resourceId`,label:v()}];function q(){let e=O({from:`/settings/audit`}),t=k({from:`/settings/audit`}),n=e.q??``,_=e.action??G,v=e.impersonated??G,y=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}),$=p(o.admin.listAudit,{filter:{q:n||void 0,from:w,to:I,action:_===G?void 0:_,resource:y===G?void 0:y,impersonated:v===G?void 0:v===`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||v!==G||y!==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:g(),timeRange:S,onTimeRangeChange:Z,onReset:ie,canReset:re,children:[(0,U.jsxs)(j,{value:_,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:v,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:h()}),(0,U.jsx)(D,{value:`no`,children:f()})]})]}),(0,U.jsxs)(j,{value:y,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:m(),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,Ag as i,Ah as a,Bg as o,Bh as s,Bt as c,Ch as l,D as u,DM 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 C,Oh as oe,Pg as se,Ph as ce,Qh as le,Rg as ue,Rh as de,Sh as fe,TM as pe,Th as w,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 T,ec as Ne,eg as Pe,fc as Fe,fh as E,gh as Ie,hh as Le,ic as Re,ig as ze,jg as Be,jh as Ve,kh as He,lc as Ue,mh as We,nc as Ge,ng as Ke,oc as qe,og as Je,ph as Ye,qh as Xe,rc as Ze,rg as Qe,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-HBBi9Y25.js";import{i as D,r as dt}from"./dist-DBet7oNc.js";import{t as ft}from"./chevrons-up-down-Kyw8BbOf.js";import{i as pt,n as O,o as mt,r as ht,s as gt}from"./FieldLabel-CKVYl95W.js";import{i as _t,n as vt,r as yt,t as bt}from"./tabs-BJyz65LR.js";import{t as k}from"./button-b04wLuGq.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-DBQ43N4_.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-CtNwimV_.js";import{t as Ht}from"./FilterBar-BVVVO1_O.js";import{a as Ut,n as Wt,o as Gt,r as Kt,s as qt,t as Jt}from"./compatView-S4X8HKXY.js";import{t as W}from"./dispatchErrorInfo-Cs8_1qCQ.js";var Yt=u(`refresh-cw`,[[`path`,{d:`M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8`,key:`v9h5vc`}],[`path`,{d:`M21 3v5h-5`,key:`1q7to0`}],[`path`,{d:`M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16`,key:`3uifl3`}],[`path`,{d:`M8 16H3v5`,key:`1cv678`}]]),Xt=u(`wifi-off`,[[`path`,{d:`M12 20h.01`,key:`zekei9`}],[`path`,{d:`M8.5 16.429a5 5 0 0 1 7 0`,key:`1bycff`}],[`path`,{d:`M5 12.859a10 10 0 0 1 5.17-2.69`,key:`1dl1wf`}],[`path`,{d:`M19 12.859a10 10 0 0 0-2.007-1.523`,key:`4k23kn`}],[`path`,{d:`M2 8.82a15 15 0 0 1 4.177-2.643`,key:`1grhjp`}],[`path`,{d:`M22 8.82a15 15 0 0 0-11.288-3.764`,key:`z3jwby`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}]]),G=t(e(),1);function Zt(e){return e.filter(e=>e.state===`error`)}function Qt(e){return e.reachable&&Zt(e.targets).length===0}function $t(e){return Qt(e)?(e.unreachableInstances??[]).length>0?`gateways_unreachable`:`ok`:`error`}function en(e){return e.state===`error`&&e.lastErrorCode!==null}function tn(e){return!!e.lastDownstreamRejectCode}function K(e){return e.kind??`openclaw`}function nn(e){return[...e].sort((e,t)=>e===`openclaw`?-1:t===`openclaw`?1:e.localeCompare(t))}function rn(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,K(e));let i=e=>(e.instanceName?r.get(e.instanceName):void 0)??`openclaw`,a=new Set;for(let e of n)a.add(K(e));for(let e of t)a.add(e.provider);for(let t of e)a.add(i(t));return nn(a).map(r=>({key:r,connections:e.filter(e=>i(e)===r),compatTargets:t.filter(e=>e.provider===r),instances:n.filter(e=>K(e)===r)}))}function q(e){return e===`openclaw`?`OpenClaw`:e===`hermes`?`Hermes`:e.charAt(0).toUpperCase()+e.slice(1)}var J=`__all__`,an={q:``,state:J,instance:J,version:J},Y={connected:0,error:1,idle:2};function on(e){return e.q.trim()!==``||e.state!==`__all__`||e.instance!==`__all__`||e.version!==`__all__`}function sn(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 X(e,t){return e.localeCompare(t,void 0,{numeric:!0,sensitivity:`base`})}function cn(e,t){return e===`version`?t.gatewayVersion===null:e===`lastOk`?t.lastOkAt===null:!1}function ln(e,t,n){switch(e){case`state`:return(Y[t.state]??99)-(Y[n.state]??99);case`instance`:return X(t.instanceLabel??t.instanceName??``,n.instanceLabel??n.instanceName??``);case`host`:return X(t.gatewayHost,n.gatewayHost);case`version`:{let e=t.gatewayVersion,r=n.gatewayVersion;return Gt(e,r)??X(e,r)}case`lastOk`:return t.lastOkAt-n.lastOkAt;default:return X(t.targetLabel,n.targetLabel)}}function un(e,t){if(!t)return e;let n=t.dir===`asc`?1:-1;return[...e].sort((e,r)=>{let i=cn(t.key,e),a=cn(t.key,r);return i&&a?0:i?1:a?-1:n*ln(t.key,e,r)})}function dn(e){let t=new Set;for(let n of e)t.add(n.state);return[...t].sort((e,t)=>(Y[e]??99)-(Y[t]??99))}function fn(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)=>X(e.label,t.label))}function pn(e){let t=new Set;for(let n of e)n.gatewayVersion!==null&&t.add(n.gatewayVersion);return[...t].sort((e,t)=>Gt(e,t)??X(e,t))}var Z=n();function mn({connections:e,displayByInstance:t}){let[n,r]=(0,G.useState)(an),[i,a]=(0,G.useState)(null),o=(0,G.useMemo)(()=>e.map((e,n)=>({_id:`${e.key}:${e.canonical}/${e.agentId}:${n}`,targetLabel:`${e.canonical}/${e.agentId}`,state:e.state,instanceName:e.instanceName??null,instanceLabel:e.instanceName?t.get(e.instanceName)??e.instanceName:null,gatewayHost:e.gatewayHost,gatewayVersion:e.gatewayVersion??null,okCount:e.okCount,errorCount:e.errorCount+(e.downstreamRejectCount??0),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,G.useMemo)(()=>dn(o),[o]),c=(0,G.useMemo)(()=>fn(o),[o]),u=(0,G.useMemo)(()=>pn(o),[o]),d=(0,G.useMemo)(()=>un(sn(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,Z.jsx)(`p`,{className:`oc-admin__hint`,children:He()}):(0,Z.jsxs)(`div`,{className:`oc-conn`,children:[(0,Z.jsxs)(Ht,{q:n.q,onQChange:e=>r(t=>({...t,q:e})),searchPlaceholder:m(),onReset:()=>r(an),canReset:on(n),children:[(0,Z.jsxs)(N,{value:n.state,onValueChange:e=>r(t=>({...t,state:e})),children:[(0,Z.jsx)(j,{size:`sm`,className:`w-36`,children:(0,Z.jsx)(z,{placeholder:at()})}),(0,Z.jsxs)(B,{children:[(0,Z.jsx)(M,{value:J,children:w()}),s.map(e=>(0,Z.jsx)(M,{value:e,children:gn(e)},e))]})]}),(0,Z.jsxs)(N,{value:n.instance,onValueChange:e=>r(t=>({...t,instance:e})),children:[(0,Z.jsx)(j,{size:`sm`,className:`w-40`,children:(0,Z.jsx)(z,{placeholder:l()})}),(0,Z.jsxs)(B,{children:[(0,Z.jsx)(M,{value:J,children:w()}),c.map(e=>(0,Z.jsx)(M,{value:e.name,children:e.label},e.name))]})]}),(0,Z.jsxs)(N,{value:n.version,onValueChange:e=>r(t=>({...t,version:e})),children:[(0,Z.jsx)(j,{size:`sm`,className:`w-36`,children:(0,Z.jsx)(z,{placeholder:fe()})}),(0,Z.jsxs)(B,{children:[(0,Z.jsx)(M,{value:J,children:w()}),u.map(e=>(0,Z.jsx)(M,{value:e,children:e},e))]})]})]}),d.length===0?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:ot()}):(0,Z.jsxs)(Vt,{className:`oc-conn__table`,children:[(0,Z.jsx)(zt,{children:(0,Z.jsxs)(H,{children:[(0,Z.jsx)(Q,{label:ke(),sortKey:`target`,sort:i,onSort:f}),(0,Z.jsx)(Q,{label:st(),sortKey:`state`,sort:i,onSort:f}),(0,Z.jsx)(Q,{label:it(),sortKey:`instance`,sort:i,onSort:f}),(0,Z.jsx)(Q,{label:Ee(),sortKey:`host`,sort:i,onSort:f}),(0,Z.jsx)(Q,{label:Ie(),sortKey:`version`,sort:i,onSort:f}),(0,Z.jsx)(V,{children:Le()}),(0,Z.jsx)(Q,{label:We(),sortKey:`lastOk`,sort:i,onSort:f})]})}),(0,Z.jsx)(Bt,{children:d.map(e=>(0,Z.jsx)(hn,{r:e},e._id))})]})]})}function Q({label:e,sortKey:t,sort:n,onSort:r}){let i=n?.key===t,a=i?n.dir:null;return(0,Z.jsx)(V,{"aria-sort":i?a===`asc`?`ascending`:`descending`:`none`,children:(0,Z.jsxs)(`button`,{type:`button`,className:`oc-conn__sort`,onClick:()=>r(t),children:[e,i?a===`asc`?(0,Z.jsx)(dt,{size:13,"aria-hidden":!0}):(0,Z.jsx)(D,{size:13,"aria-hidden":!0}):(0,Z.jsx)(ft,{size:13,"aria-hidden":!0,className:`oc-conn__sort-idle`})]})})}function hn({r:e}){let t=en(e)?W(e.lastErrorCode):null,n=tn(e)?W(e.lastDownstreamRejectCode):null;return(0,Z.jsxs)(G.Fragment,{children:[(0,Z.jsxs)(H,{className:`oc-conn__row oc-conn__row--${e.state}`,children:[(0,Z.jsx)(U,{children:(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:e.targetLabel})}),(0,Z.jsx)(U,{children:(0,Z.jsx)(_n,{state:e.state})}),(0,Z.jsx)(U,{children:e.instanceLabel?(0,Z.jsx)(`span`,{className:`oc-bridge-target__instance`,children:e.instanceLabel}):(0,Z.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})}),(0,Z.jsx)(U,{children:(0,Z.jsx)(`span`,{className:`oc-bridge-target__host`,children:e.gatewayHost})}),(0,Z.jsx)(U,{children:e.gatewayVersion?(0,Z.jsx)(`span`,{className:`oc-bridge-target__version`,children:e.gatewayVersion}):(0,Z.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})}),(0,Z.jsx)(U,{children:(0,Z.jsx)(`span`,{className:`oc-conn__stats`,children:oe({ok:e.okCount,errors:e.errorCount,attempts:e.attempts})})}),(0,Z.jsx)(U,{children:e.lastOkAt?(0,Z.jsx)(`span`,{className:`oc-traces__mono`,children:R(e.lastOkAt)}):(0,Z.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})})]}),t||n?(0,Z.jsx)(H,{className:`oc-conn__detail-row`,children:(0,Z.jsxs)(U,{colSpan:7,className:`oc-conn__detail-cell`,children:[t?(0,Z.jsxs)(`div`,{className:`oc-bridge-target__error`,children:[(0,Z.jsx)(`strong`,{children:t.label}),` `,(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:e.lastErrorCode}),e.lastErrorAt?` · ${R(e.lastErrorAt)}`:``,(0,Z.jsx)(`p`,{className:`oc-bridge-card__hint`,children:t.hint})]}):null,n?(0,Z.jsxs)(`div`,{className:`oc-bridge-target__downstream`,children:[f({label:n.label}),` `,(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:e.lastDownstreamRejectCode}),e.lastDownstreamRejectAt?` · ${R(e.lastDownstreamRejectAt)}`:``]}):null]})}):null]})}function gn(e){return e===`connected`?Ye():e===`error`?E():T()}function _n({state:e}){return e===`connected`?(0,Z.jsx)(P,{variant:`secondary`,children:Ye()}):e===`error`?(0,Z.jsx)(P,{variant:`destructive`,children:E()}):(0,Z.jsx)(P,{variant:`outline`,children:T()})}function vn(){return C(p.bridgeHealth.getBridgeHealth,{})}function yn(){let e=vn(),t=C(p.compat.getBridgeCompat,{}),n=C(p.me.getMe,{host:Ft})?.role===`admin`,r=C(p.admin.listInstances,n?{}:`skip`),i=C(p.agents.usageForInstances,n?{}:`skip`),a=Et(),o=()=>void a({to:`/settings/anomalies`,search:{status:`open`}}),s=rn(e?e.targets:[],t?t.targets:[],r??[]),{section:l}=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,Z.jsxs)(`div`,{className:`oc-bridge`,children:[(0,Z.jsx)(bn,{health:e,compat:t,onSeeAnomalies:o}),(0,Z.jsx)(`p`,{className:`oc-admin__hint oc-bridge__caption`,children:x()}),i&&i.length>0?(0,Z.jsxs)(`section`,{className:`oc-bridge__usage`,children:[(0,Z.jsx)(`h3`,{className:`oc-bridge__usage-title`,children:Xe()}),(0,Z.jsxs)(Vt,{children:[(0,Z.jsx)(zt,{children:(0,Z.jsxs)(H,{children:[(0,Z.jsx)(V,{children:ge()}),(0,Z.jsx)(V,{children:y()}),(0,Z.jsx)(V,{children:ye()}),(0,Z.jsx)(V,{children:c()}),(0,Z.jsx)(V,{children:ut()})]})}),(0,Z.jsx)(Bt,{children:i.flatMap(e=>{let t=jt(e.usage,Date.now());return t?t.windows.map((t,n)=>(0,Z.jsxs)(H,{children:[(0,Z.jsx)(U,{className:`font-medium`,children:n===0?e.instanceName:``}),(0,Z.jsx)(U,{children:t.provider}),(0,Z.jsx)(U,{children:t.label}),(0,Z.jsx)(U,{children:(0,Z.jsxs)(P,{variant:t.percentLeft<=10?`destructive`:t.percentLeft<=25?`outline`:`secondary`,children:[t.percentLeft,`%`]})}),(0,Z.jsx)(U,{className:`text-muted-foreground`,children:t.resetText??`—`})]},`${e.instanceName}:${t.provider}:${t.label}`)):[]})})]})]}):null,s.length>0?(0,Z.jsxs)(bt,{value:s.some(e=>e.key===l)?l:s[0]?.key??`openclaw`,onValueChange:e=>void u({search:{section:e},replace:!0}),children:[(0,Z.jsx)(yt,{className:`w-full`,children:s.map(e=>(0,Z.jsxs)(_t,{value:e.key,className:`flex-1 gap-1.5`,children:[(0,Z.jsx)(St,{size:13,"aria-hidden":!0}),q(e.key)]},e.key))}),s.map(e=>(0,Z.jsx)(vt,{value:e.key,children:(0,Z.jsx)(xn,{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,Z.jsx)(`p`,{className:`oc-admin__hint`,children:Ce()}):null]})}function bn({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,Z.jsxs)(`span`,{className:`oc-bridge-card__ver`,children:[(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:Ut(t.bridgeVersion)}),i?(0,Z.jsxs)(Z.Fragment,{children:[` `,(0,Z.jsxs)(`code`,{className:`oc-traces__mono`,title:rt(),children:[`(`,i,`)`]})]}):null,r?(0,Z.jsxs)(`strong`,{className:`oc-bridge-card__mismatch`,children:[` `,Ue({build:t.buildVersion??`?`})]}):null,` · `,Ae(),` `,(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:t.protocolVersion===null?$e():String(t.protocolVersion)})]}):null;if(e===void 0)return(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:s()});if(e===null)return(0,Z.jsx)(`div`,{className:`oc-bridge-card oc-bridge-card--idle`,children:lt()});let o=Zt(e.targets),c=!e.reachable,l=$t(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,Z.jsxs)(`div`,{className:`oc-bridge-card oc-bridge-card--${d}`,children:[(0,Z.jsx)(`div`,{className:`oc-bridge-card__icon`,"aria-hidden":!0,children:l===`ok`?(0,Z.jsx)(xt,{size:22}):c||l===`gateways_unreachable`?(0,Z.jsx)(Xt,{size:22}):(0,Z.jsx)(A,{size:22})}),(0,Z.jsxs)(`div`,{className:`oc-bridge-card__body`,children:[(0,Z.jsx)(`div`,{className:`oc-bridge-card__title`,children:l===`ok`?de():l===`gateways_unreachable`?ce({count:u.length}):c?re():b({count:o.length})}),(0,Z.jsxs)(`div`,{className:`oc-bridge-card__meta`,children:[(0,Z.jsxs)(`span`,{children:[(0,Z.jsx)(Yt,{size:12,"aria-hidden":!0}),` `,g({time:f})]}),p?(0,Z.jsx)(`span`,{children:ie({time:p})}):null,a]}),l===`gateways_unreachable`?(0,Z.jsx)(`p`,{className:`oc-bridge-card__hint`,children:ae({names:u.join(`, `)})}):null,c?(0,Z.jsx)(`p`,{className:`oc-bridge-card__hint`,children:W(e.lastError===`not_configured`?`NOT_CONFIGURED`:`BRIDGE_UNREACHABLE`).hint}):null]}),(0,Z.jsx)(`button`,{type:`button`,className:`oc-bridgebar__drill`,onClick:n,children:Ve()})]})}function xn({providerKey:e,connections:t,instances:n,manifest:r,compatStatus:i,compatReachable:o,protocol:s}){let c=r?qt(r,e):null,l=new Map;for(let e of n)l.set(e.name,e.displayName??e.name);let u=[],d=new Set;for(let n of t){if(!n.instanceName||d.has(n.instanceName))continue;d.add(n.instanceName);let t=n.gatewayVersion??null;u.push({instanceName:n.instanceName,displayName:l.get(n.instanceName)??n.instanceName,version:t,state:Jt(t,e,r)})}let f=u.map(e=>e.state),p=f.includes(`beyond`)?`beyond`:f.length>0&&f.every(e=>e===`supported`)?`supported`:null,[m,h]=(0,G.useState)(!1);return(0,Z.jsxs)(`section`,{className:`oc-bridge-provider`,children:[(0,Z.jsxs)(`header`,{className:`oc-bridge-provider__head`,children:[(0,Z.jsx)(St,{size:15,"aria-hidden":!0,className:`oc-bridge-provider__icon`}),(0,Z.jsx)(`span`,{className:`oc-bridge-provider__name`,children:q(e)}),p?(0,Z.jsx)(P,{variant:p===`beyond`?`destructive`:`secondary`,children:Kt(p)}):null]}),(0,Z.jsx)(`h4`,{className:`oc-bridge-provider__sub`,children:Fe()}),(0,Z.jsx)(Cn,{providerName:q(e),support:c,compatStatus:i,compatReachable:o,manifest:r,instanceRows:u}),s?(0,Z.jsx)(Sn,{protocol:s}):null,(0,Z.jsxs)(`button`,{type:`button`,className:`oc-bridge-provider__sub oc-bridge-provider__sub--toggle`,"aria-expanded":m,onClick:()=>h(e=>!e),children:[m?(0,Z.jsx)(D,{size:13,"aria-hidden":!0}):(0,Z.jsx)(L,{size:13,"aria-hidden":!0}),a({count:t.length})]}),m?(0,Z.jsx)(mn,{connections:t,displayByInstance:l}):null]})}function Sn({protocol:e}){let[t,n]=(0,G.useState)(!1),r=e.coverage,i=e.drift??[];return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`h4`,{className:`oc-bridge-provider__sub`,children:[S(),i.length>0?(0,Z.jsx)(P,{variant:`destructive`,children:xe({count:i.length})}):(0,Z.jsx)(P,{variant:`secondary`,children:_()})]}),(0,Z.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,Z.jsx)(`ul`,{className:`oc-bridge-protocol__list`,role:`list`,children:i.map(e=>(0,Z.jsxs)(`li`,{children:[(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:e.shape}),` × `,e.count]},e.shape))}):null,r&&r.gapList.length>0?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`button`,{type:`button`,className:`oc-bridge-provider__sub oc-bridge-provider__sub--toggle`,"aria-expanded":t,onClick:()=>n(e=>!e),children:[t?(0,Z.jsx)(D,{size:13,"aria-hidden":!0}):(0,Z.jsx)(L,{size:13,"aria-hidden":!0}),ve({count:r.gapList.length})]}),t?(0,Z.jsx)(`ul`,{className:`oc-bridge-protocol__list`,role:`list`,children:r.gapList.map(e=>(0,Z.jsx)(`li`,{children:(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:e})},e))}):null]}):null]})}function Cn({support:e,compatStatus:t,compatReachable:n,manifest:r,instanceRows:i,providerName:a}){return t===`loading`?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:s()}):t===`nodata`?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:Me()}):(0,Z.jsxs)(`div`,{className:`oc-compat`,children:[n?null:(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:qe()}),r===null?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:De()}):(0,Z.jsxs)(`div`,{className:`oc-compat__support`,children:[(0,Z.jsx)(`span`,{className:`oc-compat__label`,children:te({provider:a})}),e&&e.range!==null?(0,Z.jsx)(`span`,{children:Re({min:e.range.min,max:e.range.maxValidated})}):(0,Z.jsx)(`span`,{children:$e()}),e?(0,Z.jsx)(En,{versions:e.validatedVersions}):null]}),i.length===0?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:Ne()}):(0,Z.jsx)(`div`,{className:`oc-compat__targets`,children:i.map(e=>(0,Z.jsxs)(`div`,{className:`oc-compat__target`,children:[(0,Z.jsx)(`span`,{className:`oc-compat__instance`,children:e.displayName}),(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:Ut(e.version)}),(0,Z.jsx)(P,{variant:e.state===`supported`?`secondary`:e.state===`beyond`?`destructive`:`outline`,children:Kt(e.state)})]},e.instanceName))})]})}function wn({instance:e,onClose:t}){return(0,Z.jsx)(Pt,{open:!0,onOpenChange:e=>!e&&t(),children:(0,Z.jsxs)(Ot,{className:`oc-bridge-config-dialog`,onOpenAutoFocus:e=>e.preventDefault(),children:[(0,Z.jsxs)(Mt,{children:[(0,Z.jsx)(At,{children:be({instance:e.displayName??e.name})}),(0,Z.jsx)(kt,{children:me()})]}),(0,Z.jsx)(Tn,{instance:e,onClose:t})]})})}function $({label:e,result:t}){return t?t.checked?(0,Z.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,Z.jsx)(xt,{"aria-hidden":!0}):(0,Z.jsx)(A,{"aria-hidden":!0}),(0,Z.jsxs)(`span`,{children:[e,` — `,t.ok?le():t.detail]})]}):(0,Z.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=d(p.admin.upsertInstanceConfig),a=pe(p.bridge.validateMediaPaths),s=It(),c=Rt(e.config?.contentLocale,void 0),[l,u]=(0,G.useState)(()=>pt(e.config??{},c)),[f,m]=(0,G.useState)(!1),[g,_]=(0,G.useState)(!1),[v,y]=(0,G.useState)(null),b=l.inboundMediaMode===`shared-fs`,x=l.mediaMode===`shared-fs`,S=b||x;async function te(){_(!0),y(null);try{y(await a({instanceName:e.name,inboundMediaMode:l.inboundMediaMode,mediaMode:l.mediaMode}))}catch(e){s.error(Ke(),e)}finally{_(!1)}}async function re(){m(!0);try{let r=e.config??{};await n({instanceId:e._id,config:ht(l,r,c)}),t()}catch(e){s.error(ee(),e)}finally{m(!1)}}return(0,Z.jsx)(`div`,{className:`oc-bridge-config`,children:(0,Z.jsxs)(`div`,{className:`oc-bridge-config__form`,children:[(0,Z.jsxs)(`div`,{className:`oc-bridge-config__grid`,children:[(0,Z.jsxs)(`label`,{className:`oc-field`,children:[(0,Z.jsx)(O,{label:_e(),help:h()}),(0,Z.jsxs)(N,{value:l.mediaMode,onValueChange:e=>u({...l,mediaMode:e}),children:[(0,Z.jsx)(j,{size:`sm`,className:`w-full`,children:(0,Z.jsx)(z,{})}),(0,Z.jsx)(B,{children:gt.map(e=>(0,Z.jsx)(M,{value:e,children:e},e))})]})]}),(0,Z.jsxs)(`label`,{className:`oc-field`,children:[(0,Z.jsx)(O,{label:o(),help:se()}),(0,Z.jsxs)(N,{value:l.inboundMediaMode,onValueChange:e=>u({...l,inboundMediaMode:e}),children:[(0,Z.jsx)(j,{size:`sm`,className:`w-full`,children:(0,Z.jsx)(z,{})}),(0,Z.jsx)(B,{children:mt.map(e=>(0,Z.jsx)(M,{value:e,children:e},e))})]})]}),(0,Z.jsxs)(`label`,{className:`oc-field`,children:[(0,Z.jsx)(O,{label:ct(),help:Be()}),(0,Z.jsx)(I,{type:`number`,min:1,max:4096,className:`w-full`,value:l.mediaMaxMb,onChange:e=>u({...l,mediaMaxMb:Math.trunc(Number(e.target.value)||0)})})]})]}),S&&(0,Z.jsxs)(`div`,{className:`oc-bridge-config__grid`,children:[b&&(0,Z.jsxs)(`label`,{className:`oc-field`,children:[(0,Z.jsx)(O,{label:je(),help:et()}),(0,Z.jsx)(I,{className:`w-full`,spellCheck:!1,value:l.inboundAgentMount,onChange:e=>u({...l,inboundAgentMount:e.target.value})})]}),x&&(0,Z.jsxs)(`label`,{className:`oc-field`,children:[(0,Z.jsx)(O,{label:Je(),help:Oe()}),(0,Z.jsx)(I,{className:`w-full`,spellCheck:!1,value:l.outboundAgentMount,onChange:e=>u({...l,outboundAgentMount:e.target.value})})]})]}),(0,Z.jsxs)(`label`,{className:`oc-field--row`,children:[(0,Z.jsx)(Nt,{checked:l.rehydration,onCheckedChange:e=>u({...l,rehydration:e===!0})}),(0,Z.jsx)(O,{label:ue(),help:i()})]}),S&&v!==null&&(0,Z.jsx)(`div`,{className:`oc-bridge-config__check`,children:v.reachable?!v.inbound&&!v.outbound?(0,Z.jsxs)(`p`,{className:`oc-bridge-config__check-row oc-bridge-config__check-row--err`,children:[(0,Z.jsx)(A,{"aria-hidden":!0}),we({reason:v.reason??`?`})]}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)($,{label:Pe(),result:v.inbound}),(0,Z.jsx)($,{label:r(),result:v.outbound}),(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:nt()})]}):(0,Z.jsxs)(`p`,{className:`oc-bridge-config__check-row oc-bridge-config__check-row--err`,children:[(0,Z.jsx)(A,{"aria-hidden":!0}),Se()]})}),(0,Z.jsxs)(`div`,{className:`oc-bridge-config__actions`,children:[S&&(0,Z.jsxs)(k,{variant:`outline`,size:`sm`,onClick:()=>void te(),disabled:g,children:[g?(0,Z.jsx)(Lt,{className:`size-4 animate-spin`,"aria-hidden":!0}):null,g?Qe():ze()]}),(0,Z.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,Z.jsxs)(wt,{children:[(0,Z.jsx)(Ct,{asChild:!0,children:(0,Z.jsxs)(`button`,{type:`button`,className:`oc-compat__versions-btn`,children:[e.length===1?Ze():Ge({count:e.length}),(0,Z.jsx)(D,{size:13,"aria-hidden":!0})]})}),(0,Z.jsxs)(Dt,{className:`oc-compat__versions-pop`,align:`start`,children:[(0,Z.jsx)(`p`,{className:`oc-compat__versions-title`,children:tt()}),(0,Z.jsx)(`div`,{className:`oc-compat__versions-list`,children:t.map(e=>(0,Z.jsx)(P,{variant:`secondary`,children:e},e))})]})]})}export{yn as BridgeTab,wn as InstanceConfigDialog};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Bi as r,DM 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,TM 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,kl as T,mc as E,pc as D,qi as O,vc as k,xc as A,yM as j,yc as M,zi as N}from"./dist-HBBi9Y25.js";import{t as P}from"./button-b04wLuGq.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-DBQ43N4_.js";import{i as K}from"./compatView-S4X8HKXY.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=i(a.admin.upsertInstanceConfig),n=p(a.agents.listAgentsForInstance,{instanceName:e.name}),r=typeof e.config?.converterAgentId==`string`?e.config.converterAgentId:``,[s,c]=(0,q.useState)(r),[l,d]=(0,q.useState)(`idle`);(0,q.useEffect)(()=>{c(r),d(`idle`)},[e._id,r]);let f=`__none__`,m=s!==r;async function h(){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 g=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()}),g.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:!m||l===`saving`,onClick:()=>void h(),children:l===`saving`?o():w()})]}),l===`done`?(0,X.jsx)(`p`,{className:`oc-admin__hint`,role:`status`,children:E()}):null,l===`error`?(0,X.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:D()}):null]})}function Q({instance:e}){let t=i(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:r()}),p===`done`?(0,X.jsx)(`p`,{className:`oc-admin__hint`,role:`status`,children:E()}):null,p===`error`?(0,X.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:D()}):null,(0,X.jsx)(`p`,{className:`oc-cdefaults__help`,children:N()})]})}function $({instance:e}){let t=i(a.admin.upsertInstanceConfig),n=typeof e.config?.summarizeThresholdChars==`number`?e.config.summarizeThresholdChars:null,[r,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=r.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:O()}),(0,X.jsxs)(`div`,{className:`oc-cdefaults__inline`,children:[(0,X.jsx)(V,{type:`number`,min:1e3,max:2e5,step:1e3,placeholder:`8000`,value:r,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:E()}):null,c===`error`?(0,X.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:D()}):null,(0,X.jsx)(`p`,{className:`oc-cdefaults__help`,children:d()})]})}function ee(){let e=g(a.agentFiles.getChatDefaults),[t,n]=(0,q.useState)({status:`loading`}),r=p(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=p(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 E=t.status===`done`?t.current:null,D=(0,q.useMemo)(()=>J.map(e=>({id:e,label:B(e)})),[]),O=(0,q.useMemo)(()=>[{id:`fast`,label:T()},{id:`standard`,label:m()}],[]);return(0,X.jsxs)(`div`,{className:`oc-cdefaults`,children:[(0,X.jsx)(`p`,{className:`oc-admin__hint`,children:A()}),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:j()}):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:j()}):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:D,value:E?.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:k()}),(0,X.jsx)(z,{options:O,value:E===null||E.fastModeDefault===null?null:E.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{
|
|
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-HBBi9Y25.js";import{i as u,r as d}from"./dist-DBet7oNc.js";import{t as f}from"./chevrons-up-down-Kyw8BbOf.js";import{t as p}from"./button-b04wLuGq.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-DBQ43N4_.js";import{a as C,i as w,n as T,o as E,r as D,t as O}from"./table-CtNwimV_.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-DBQ43N4_.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,BC as a,CC as o,DC as s,DM as c,E as l,EC as u,FC as d,GC as f,HC as ee,IC as p,JC as m,KC as te,LC as ne,MC as h,NC as g,OC as _,OM as v,PC as re,QC as y,RC as ie,SC as b,TC as x,UC as S,VC as C,WC as w,XC as T,YC as E,ZC as D,_C as O,aC as k,ai as A,bC as j,cC as M,dC as N,ew as P,fC as F,gC as I,hC as L,iC as R,jC as z,kC as B,lC as V,mC as H,nC as U,nw as W,oC as ae,pC as G,qC as K,rC as q,ri as J,sC as oe,tC as se,tw as ce,uC as le,vC as ue,wC as de,xC as fe,yC as pe,zC as me}from"./dist-HBBi9Y25.js";import{t as he}from"./button-b04wLuGq.js";import{B as ge,et as _e}from"./index-DBQ43N4_.js";import{t as Y}from"./DataTableShell-KGrtOG5M.js";var X=t(e(),1),Z=n(),ve={altered_words:()=>W(),incorrect:()=>ce(),incoherence:()=>P(),formatting:()=>r(),latency:()=>y(),api_error:()=>D(),other:()=>T()},Q=e=>ve[e]?.()??e;function $({matches:e,sourceWasOpen:t}){return t?e===!0?(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-ok`,children:m()}):e===!1?(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-warn`,children:K()}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill`,children:`—`}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill`,children:E()})}function ye({data:e,closeReason:t}){let n=e.snapshot,r=c(l.feedback.respondToFeedback),[o,m]=(0,X.useState)(e.thread),[v,y]=(0,X.useState)(``),[b,x]=(0,X.useState)(!1);async function T(){let t=v.trim();if(!(!t||b)){x(!0);try{await r({feedbackId:e._id,text:t}),m(e=>[...e,{authorRole:`admin`,text:t,at:Date.now()}]),y(``)}finally{x(!1)}}}let E=[];try{E=n.contextJson?JSON.parse(n.contextJson):[]}catch{E=[]}return(0,Z.jsxs)(`div`,{className:`oc-fbadmin__detail`,children:[(0,Z.jsxs)(`div`,{className:`oc-fbadmin__row`,children:[(0,Z.jsx)($,{matches:n.displayedMatchesStored,sourceWasOpen:n.clientInfo?.sourceWasOpen??!1}),(0,Z.jsxs)(`span`,{className:`oc-fbadmin__meta`,children:[Q(e.category),` · `,n.messageRole,n.isRegeneration?` · ${te()}`:``,n.openclawModel?` · ${n.openclawModel}`:``,n.openclawRuntime?` (${n.openclawRuntime})`:``]})]}),e.comment?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:f()}),(0,Z.jsx)(`p`,{className:`oc-fbadmin__comment`,children:e.comment})]}):null,t?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:oe()}),(0,Z.jsx)(`p`,{className:`oc-fbadmin__comment`,children:t})]}):null,(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:w()}),o.length>0?(0,Z.jsx)(`div`,{className:`oc-fbadmin__thread`,children:o.map((e,t)=>(0,Z.jsxs)(`div`,{className:`oc-notif__msg oc-notif__msg--${e.authorRole}`,children:[(0,Z.jsx)(`span`,{className:`oc-notif__msg-who`,children:e.authorRole===`admin`?S():e.authorRole===`agent`?e.authorLabel??A():ee()}),(0,Z.jsx)(`span`,{className:`oc-notif__msg-text`,children:e.text})]},t))}):(0,Z.jsx)(`p`,{className:`oc-fbadmin__meta`,children:C()}),(0,Z.jsx)(`textarea`,{className:`oc-feedback__textarea`,placeholder:a(),value:v,maxLength:2e3,rows:3,onChange:e=>y(e.target.value.slice(0,2e3))}),(0,Z.jsx)(`div`,{className:`oc-fbadmin__row`,style:{justifyContent:`flex-end`},children:(0,Z.jsx)(he,{size:`sm`,onClick:()=>void T(),disabled:!v.trim()||b,children:b?me():ie()})})]}),(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:ne()}),(0,Z.jsx)(`pre`,{className:`oc-msg__source-pre`,children:n.messageText||p()})]}),n.clientInfo?.sourceWasOpen&&n.displayedText!==void 0?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:d()}),(0,Z.jsx)(`pre`,{className:`oc-msg__source-pre`,children:n.displayedText||p()})]}):null,n.promptText?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:re()}),(0,Z.jsx)(`pre`,{className:`oc-msg__source-pre`,children:n.promptText})]}):null,E.length>0?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:g({count:n.contextCount??E.length,truncated:n.contextTruncated?h():``})}),(0,Z.jsx)(`div`,{className:`oc-fbadmin__ctx`,children:E.map((e,t)=>(0,Z.jsxs)(`div`,{className:`oc-fbadmin__ctx-turn`,children:[(0,Z.jsx)(`span`,{className:`oc-fbadmin__ctx-role`,children:e.role}),(0,Z.jsx)(`span`,{className:`oc-fbadmin__ctx-text`,children:e.text})]},t))})]}):null,n.outboxAvailable?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:z()}),(0,Z.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,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:i()}),(0,Z.jsx)(`div`,{className:`oc-fbadmin__row`,children:n.clientInfo.extensionsDetected.map(e=>(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-warn`,children:e},e))})]}):null,(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:B()}),(0,Z.jsxs)(`p`,{className:`oc-fbadmin__env`,children:[[n.clientInfo?.language,n.clientInfo?.timezone,n.clientInfo?.theme?_({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,Z.jsxs)(`span`,{className:`oc-fbadmin__plugins`,children:[s(),` `,n.clientInfo.plugins.join(`, `),(0,Z.jsxs)(`span`,{className:`oc-fbadmin__note`,children:[` `,u()]})]}):null,n.clientInfo?.userAgent?(0,Z.jsx)(`span`,{className:`oc-fbadmin__ua`,children:n.clientInfo.userAgent}):null]})]})]})}function be(){let e=v(l.feedback.listForAdmin,{}),t=c(l.feedback.readSnapshot),n=c(l.feedback.deleteFeedback),r=ge(),[i,a]=(0,X.useState)(null),[s,u]=(0,X.useState)({});async function d(e){if(i===e._id){a(null);return}if(!s[e._id]){let n=await t({feedbackId:e._id});u(t=>({...t,[e._id]:n}))}a(e._id)}async function f(e){await r({title:q(),description:U(),confirmLabel:se(),destructive:!0})&&(await n({feedbackId:e._id}),i===e._id&&a(null))}return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`p`,{className:`oc-admin__hint`,children:[x(),` `,(0,Z.jsx)(`strong`,{children:de()}),` `,o()]}),(0,Z.jsx)(Y,{title:b(),rows:e,emptyHint:fe(),isExpanded:e=>i===e._id&&!!s[e._id],renderExpanded:e=>s[e._id]?(0,Z.jsx)(ye,{data:s[e._id],closeReason:e.userCloseReason}):null,columns:[{header:j(),cell:e=>_e(e.at),sort:e=>e.at},{header:pe(),cell:e=>Q(e.category),sort:e=>Q(e.category)},{header:ue(),cell:e=>e.messageRole===`user`?O():I(),sort:e=>e.messageRole},{header:L(),cell:e=>(e.reporterEmail||e.reporterName||`—`)+(e.impersonated&&e.realOperatorEmail?` ${H({operator:e.realOperatorEmail})}`:``),sort:e=>e.reporterEmail||e.reporterName||null},{header:G(),cell:e=>(0,Z.jsx)($,{matches:e.displayedMatchesStored,sourceWasOpen:e.sourceWasOpen}),sort:e=>e.displayedMatchesStored===!1?0:e.displayedMatchesStored===!0?1:2},{header:F(),cell:e=>e.hasComment?`✎`:`—`,sort:e=>+!!e.hasComment},{header:N(),cell:e=>e.userClosedAt==null?e.resolvedAt==null?e.answered?(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-ok`,children:le()}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill`,children:V()}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-ok`,title:e.resolvedBy??void 0,children:J()}):(0,Z.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?ae():k(),onSelect:()=>void d(e)},{label:R(),onSelect:()=>void f(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,FM as n}from"./dist-HBBi9Y25.js";import{_ as r,g as i,h as a,v as o}from"./index-DBQ43N4_.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 ee,Aj as te,Bj as r,Cj as ne,DM as i,Dj as a,E as o,Ej as s,Fj as re,Gj as ie,Hj as c,Ij as l,Jj as u,Kj as d,Lj as f,Mj as ae,Nj as oe,OM as se,Oj as ce,Pj as le,Qj as ue,Rj as p,Sj as de,Tj as fe,Uj as pe,Vj as m,Wj as me,Xj as h,Yj as g,Zj as he,bj as ge,ci as _e,jj as ve,kj as ye,li as _,qj as be,tD as xe,vj as v,wj as y,xM as b,xj as x,yM as S,yj as C,zj as w}from"./dist-HBBi9Y25.js";import{t as T}from"./button-b04wLuGq.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-DBQ43N4_.js";import{a as Me,i as B,n as Ne,o as V,r as H,t as Pe}from"./table-CtNwimV_.js";var U=t(e(),1),W=n(),G=`all`;function K(e){switch(e){case`image`:return c();case`audio`:return m();case`video`:return r();case`pdf`:return w();case`document`:return p();case`archive`:return f();default:return l()}}function q(){let[e,t]=(0,U.useState)(G),[n,r]=(0,U.useState)(G),[c,l]=(0,U.useState)(G),[f,p]=(0,U.useState)(G),[m,w]=(0,U.useState)(!1),[q,J]=(0,U.useState)(null),Fe=i(o.files.softDelete),Y=je();function Ie(){t(G),r(G),l(G),p(G)}async function Le(){let e=q;if(J(null),e)try{await Fe({fileId:e.id}),Y.success(fe())}catch(e){Y.error(y(),e)}}let X=se(o.files.listMine,{direction:e===G?void 0:e,chatId:n===G?void 0:n,instanceName:c===G?void 0:c,category:f===G?void 0:f,includeAutoGenerated:m||void 0}),Re=(0,U.useMemo)(()=>new Intl.DateTimeFormat(b(),{dateStyle:`medium`,timeStyle:`short`}),[]);if(X===void 0)return(0,W.jsx)(`p`,{className:`oc-admin__hint`,children:S()});let{files:Z,facets:Q,truncated:ze,cap:Be}=X,$=e!==G||n!==G||c!==G||f!==G;return(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`p`,{className:`oc-admin__hint`,children:ee()}),(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":ue(),children:(0,W.jsx)(R,{})}),(0,W.jsxs)(z,{children:[(0,W.jsx)(N,{value:G,children:he()}),(0,W.jsx)(N,{value:`inbound`,children:h()}),(0,W.jsx)(N,{value:`outbound`,children:g()})]})]}),(0,W.jsxs)(F,{value:n,onValueChange:r,children:[(0,W.jsx)(E,{size:`sm`,"aria-label":u(),children:(0,W.jsx)(R,{})}),(0,W.jsxs)(z,{children:[(0,W.jsx)(N,{value:G,children:be()}),Q.chats.map(e=>(0,W.jsx)(N,{value:e.id,children:e.title},e.id))]})]}),Q.multiProvider?(0,W.jsxs)(F,{value:c,onValueChange:l,children:[(0,W.jsx)(E,{size:`sm`,"aria-label":d(),children:(0,W.jsx)(R,{})}),(0,W.jsxs)(z,{children:[(0,W.jsx)(N,{value:G,children:ie()}),Q.instances.map(e=>(0,W.jsx)(N,{value:e,children:e},e))]})]}):null,(0,W.jsxs)(F,{value:f,onValueChange:p,children:[(0,W.jsx)(E,{size:`sm`,"aria-label":me(),children:(0,W.jsx)(R,{})}),(0,W.jsxs)(z,{children:[(0,W.jsx)(N,{value:G,children:pe()}),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:m,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}),ce()]}):null]}),Z.length===0?(0,W.jsx)(`p`,{className:`oc-admin__hint`,children:$?C():ge()}):(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:re()}),(0,W.jsx)(B,{children:le()}),(0,W.jsx)(B,{children:oe()}),(0,W.jsx)(B,{children:ae()}),(0,W.jsx)(B,{children:ve()}),(0,W.jsx)(B,{className:`text-right`,children:te()})]})}),(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`?h():g()})}),(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":a(),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}),ye()]})}):(0,W.jsxs)(L,{disabled:!0,children:[(0,W.jsx)(P,{size:14}),x()]}),(0,W.jsxs)(L,{variant:`destructive`,onSelect:()=>J({id:e._id,filename:e.filename}),children:[(0,W.jsx)(Te,{size:14}),s()]})]})]})})]},e._id))})]}),ze?(0,W.jsx)(`p`,{className:`oc-admin__hint`,style:{marginTop:8},children:v({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:ne()}),(0,W.jsx)(M,{children:de()})]}),(0,W.jsxs)(Oe,{children:[(0,W.jsx)(Ce,{children:xe()}),(0,W.jsx)(Se,{onClick:()=>void Le(),children:s()})]})]})})]})}export{q as FilesTab};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Uf as r,Wf as i}from"./dist-HBBi9Y25.js";import{t as a}from"./button-b04wLuGq.js";import{Ft as o,Pt as s,lt as c}from"./index-DBQ43N4_.js";import{t as l}from"./TimeRangePicker-NSOkx3C0.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,Au as a,Bu as o,Cu as s,D as c,DM 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,OM as C,Ou as w,Pu as T,Ql as E,Qu as D,Ru as ee,Su as O,Tu as k,Uu as A,Vu as j,Wu as te,Xl as M,Xu as N,Yl as ne,Yu as re,Zl as P,Zu as F,_u as I,au as L,bu as ie,cu as R,du as ae,ed as z,eu as oe,fu as se,gu as ce,hu as le,iu as ue,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-HBBi9Y25.js";import{t as Ae}from"./x-DBKGK4o_.js";import{i as V,n as H,r as je,t as Me}from"./tabs-BJyz65LR.js";import{t as U}from"./button-b04wLuGq.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-DBQ43N4_.js";import{t as Je}from"./FilterBar-BVVVO1_O.js";import{t as Ye}from"./DataTableShell-KGrtOG5M.js";import{t as X}from"./DetailChips-C2LFFpNg.js";var Xe=c(`palette`,[[`path`,{d:`M12 22a1 1 0 0 1 0-20 10 9 0 0 1 10 9 5 5 0 0 1-5 5h-2.25a1.75 1.75 0 0 0-1.4 2.8l.3.4a1.75 1.75 0 0 1-1.4 2.8z`,key:`e79jfc`}],[`circle`,{cx:`13.5`,cy:`6.5`,r:`.5`,fill:`currentColor`,key:`1okk4w`}],[`circle`,{cx:`17.5`,cy:`10.5`,r:`.5`,fill:`currentColor`,key:`f64h9f`}],[`circle`,{cx:`6.5`,cy:`12.5`,r:`.5`,fill:`currentColor`,key:`qy21gx`}],[`circle`,{cx:`8.5`,cy:`7.5`,r:`.5`,fill:`currentColor`,key:`fotxhn`}]]),Z=c(`shield-check`,[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`,key:`oel41y`}],[`path`,{d:`m9 12 2 2 4-4`,key:`dzmm74`}]]),Ze=c(`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`}]]),Q=t(e(),1);function Qe(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 $e(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 et(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 tt(e){switch(e){case`admin`:return s();case`user`:return O();case`pending`:return De();default:return e}}function nt(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 rt(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 $=n(),it={name:``,description:``};function at(){let e=C(d.groups.listGroups,{}),t=C(d.me.getMe,{host:qe})?.role===`admin`,n=l(d.groups.createGroup),r=l(d.groups.updateGroup),a=l(d.groups.deleteGroup),s=Ne(),c=Y(),[u,f]=(0,Q.useState)(!1),[_,x]=(0,Q.useState)(null),[S,w]=(0,Q.useState)(it),[T,E]=(0,Q.useState)(null),[O,k]=(0,Q.useState)(``),P=(0,Q.useMemo)(()=>{if(!e)return e;let t=O.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,O]);function I(){x(null),w(it),f(!0)}function L(e){x(e),w({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}),w(it),x(null),f(!1)}catch(e){c.error(M(),e)}}async function R(e){if(await s({title:b({name:e.name}),description:g(),confirmWord:e.name,confirmLabel:p(),cancelLabel:A(),destructive:!0}))try{await a({groupId:e._id})}catch(e){c.error(ne(),e)}}return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`p`,{className:`oc-admin__hint`,children:Ce()}),(0,$.jsx)(Je,{q:O,onQChange:k,onReset:()=>k(``),canReset:O!==``,searchPlaceholder:v()}),(0,$.jsx)(Ye,{title:he(),rows:P,addLabel:z(),onAdd:t?I:void 0,emptyHint:i(),columns:[{header:D(),cell:e=>e.name,sort:e=>e.name},{header:F(),cell:e=>(0,$.jsx)(X,{icon:(0,$.jsx)(Ze,{size:12,"aria-hidden":!0}),total:e.memberCount,items:e.members.map(e=>({label:e.label,marker:e.manager?(0,$.jsx)(Z,{size:11,"aria-hidden":!0}):null,highlight:e.manager}))}),sort:e=>e.memberCount},{header:N(),cell:e=>(0,$.jsx)(X,{icon:(0,$.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,$.jsx)(X,{icon:(0,$.jsx)(Xe,{size:12,"aria-hidden":!0}),total:e.chartCount,items:e.charts.map(e=>({label:e.name,marker:e.isDefault?(0,$.jsx)(W,{size:11,fill:`currentColor`,"aria-hidden":!0}):null,highlight:e.isDefault}))}),sort:e=>e.chartCount}],rowActions:e=>[{label:be(),onSelect:()=>E({groupId:e._id,name:e.name})},...t?[{label:y(),onSelect:()=>L(e)},{label:m(),variant:`destructive`,onSelect:()=>void R(e)}]:[]]}),(0,$.jsx)(Ue,{open:u,onOpenChange:f,title:_?j():h(),description:o(),canSubmit:!!S.name.trim(),onSubmit:ie,submitLabel:te(),children:(0,$.jsxs)(`div`,{className:`oc-form`,children:[(0,$.jsxs)(`label`,{className:`oc-field`,children:[(0,$.jsx)(`span`,{className:`oc-field__label`,children:ke()}),(0,$.jsx)(q,{value:S.name,onChange:e=>w({...S,name:e.target.value})})]}),(0,$.jsxs)(`label`,{className:`oc-field`,children:[(0,$.jsx)(`span`,{className:`oc-field__label`,children:ee()}),(0,$.jsx)(q,{value:S.description,onChange:e=>w({...S,description:e.target.value})})]})]})}),(0,$.jsx)(ct,{groupId:T?.groupId??null,groupName:T?.name??``,open:T!==null,onOpenChange:e=>{e||E(null)}})]})}var ot=8;function st({page:e,pageCount:t,onPage:n}){return t<=1?null:(0,$.jsxs)(`div`,{className:`oc-access__pager`,children:[(0,$.jsxs)(U,{type:`button`,variant:`ghost`,size:`sm`,disabled:e<=1,onClick:()=>n(e-1),children:[(0,$.jsx)(Fe,{size:14,"aria-hidden":!0}),f()]}),(0,$.jsxs)(`span`,{className:`oc-access__pageinfo`,"aria-label":Ee({page:e,pages:t}),children:[e,` / `,t]}),(0,$.jsxs)(U,{type:`button`,variant:`ghost`,size:`sm`,disabled:e>=t,onClick:()=>n(e+1),children:[k(),(0,$.jsx)(He,{size:14,"aria-hidden":!0})]})]})}function ct({groupId:e,groupName:t,open:n,onOpenChange:i}){let o=C(d.groups.getGroup,n&&e?{groupId:e}:`skip`),s=C(d.groups.listAssignableInstances,n?{}:`skip`),c=C(d.groups.listAssignableUsers,n?{}:`skip`),f=l(d.groups.addMember),p=l(d.groups.removeMember),m=l(d.groups.bulkSetMembers),h=l(d.groups.setGroupManager),g=Y(),[v,y]=(0,Q.useState)(``),[b,D]=(0,Q.useState)(``),[ee,O]=(0,Q.useState)(`members`),[k,A]=(0,Q.useState)(1),[j,te]=(0,Q.useState)(new Set),M=(0,Q.useRef)(null),N=(0,Q.useMemo)(()=>new Set((o?.members??[]).map(e=>e.userId)),[o]),ne=(0,Q.useMemo)(()=>new Set((o?.members??[]).filter(e=>e.manager).map(e=>e.userId)),[o]),re=o?.viewerIsAdmin===!0,P=(0,Q.useMemo)(()=>new Set((o?.agents??[]).map(e=>`${e.instanceName}/${e.agentId}`)),[o]);(0,Q.useEffect)(()=>{y(``),D(``),O(`members`),A(1),M.current=null},[n,e]),(0,Q.useEffect)(()=>{A(1)},[v]),(0,Q.useEffect)(()=>{n&&o&&e&&M.current!==e&&(M.current=e,te(new Set((o.members??[]).map(e=>e.userId))))},[n,o,e]);let F=(0,Q.useMemo)(()=>c?Qe(c,v,j):[],[c,v,j]);async function I(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 L(t,n){if(e)try{await h({groupId:e,userId:t,manager:!n})}catch(e){g.error(E(),e)}}let R=nt(F,e=>N.has(e.userId)),ae=F.filter(e=>N.has(e.userId)).length,z=rt(F,k,ot);async function se(){if(!e||F.length===0)return;let t=F.map(e=>e.userId);try{await m({groupId:e,userIds:t,member:R!==`all`})}catch(e){g.error(_(),e)}}return(0,$.jsx)(We,{open:n,onOpenChange:i,children:(0,$.jsxs)(Re,{className:`oc-access`,children:[(0,$.jsxs)(Ve,{children:[(0,$.jsx)(Be,{children:T({name:t})}),(0,$.jsx)(ze,{children:S()})]}),(0,$.jsxs)(Me,{value:ee,onValueChange:O,className:`oc-access__tabs`,children:[(0,$.jsxs)(je,{className:`w-full`,children:[(0,$.jsxs)(V,{value:`members`,className:`flex-1 gap-1.5`,children:[(0,$.jsx)(Ze,{size:13,"aria-hidden":!0}),x(),o?(0,$.jsx)(K,{variant:`secondary`,className:`oc-access__tabcount`,children:N.size}):null]}),(0,$.jsxs)(V,{value:`agents`,className:`flex-1 gap-1.5`,children:[(0,$.jsx)(G,{size:13,"aria-hidden":!0}),a(),o?(0,$.jsx)(K,{variant:`secondary`,className:`oc-access__tabcount`,children:P.size}):null]}),(0,$.jsxs)(V,{value:`charts`,className:`flex-1 gap-1.5`,children:[(0,$.jsx)(Xe,{size:13,"aria-hidden":!0}),pe(),o?(0,$.jsx)(K,{variant:`secondary`,className:`oc-access__tabcount`,children:o.chartCount}):null]})]}),(0,$.jsx)(H,{value:`members`,children:c===void 0||o===void 0?(0,$.jsx)(`p`,{className:`oc-access__hint`,children:B()}):c.length===0?(0,$.jsx)(`p`,{className:`oc-access__hint`,children:ce()}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(q,{value:v,onChange:e=>y(e.target.value),placeholder:de(),className:`oc-access__search`}),F.length===0?(0,$.jsx)(`p`,{className:`oc-access__hint`,children:w()}):(0,$.jsxs)($.Fragment,{children:[F.length>1?(0,$.jsxs)(`div`,{className:`oc-access__row oc-access__selectall`,children:[(0,$.jsx)(J,{checked:R===`all`?!0:R===`some`?`indeterminate`:!1,onCheckedChange:()=>void se(),"aria-label":u()}),(0,$.jsx)(`span`,{className:`oc-access__label`,children:u()}),(0,$.jsxs)(K,{variant:`outline`,className:`oc-access__count`,children:[ae,` / `,F.length]})]}):null,(0,$.jsx)(`div`,{className:`oc-access__list`,children:z.pageItems.map(e=>{let t=N.has(e.userId),n=et(e),i=ne.has(e.userId);return(0,$.jsxs)(`div`,{className:`oc-access__row`,children:[(0,$.jsx)(J,{checked:t,onCheckedChange:()=>void I(e.userId,t),"aria-label":ie({user:n.primary})}),(0,$.jsxs)(`span`,{className:`oc-access__who`,children:[(0,$.jsx)(`span`,{className:`oc-access__label`,title:n.primary,children:n.primary}),n.secondary?(0,$.jsx)(`span`,{className:`oc-access__sub`,title:n.secondary,children:n.secondary}):null]}),(0,$.jsx)(K,{variant:`outline`,className:`oc-access__role`,children:tt(e.role)}),(0,$.jsx)(`span`,{className:`oc-access__mgrslot`,children:t&&re?(0,$.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 L(e.userId,i),children:(0,$.jsx)(Z,{size:15,"aria-hidden":!0})}):t&&i?(0,$.jsx)(`span`,{className:`oc-access__mgr oc-access__mgr--on`,role:`img`,"aria-label":we(),title:we(),children:(0,$.jsx)(Z,{size:15,"aria-hidden":!0})}):null})]},e._id)})}),(0,$.jsx)(st,{page:z.page,pageCount:z.pageCount,onPage:A})]})]})}),(0,$.jsx)(H,{value:`agents`,children:s===void 0?(0,$.jsx)(`p`,{className:`oc-access__hint`,children:B()}):s.length===0?(0,$.jsx)(`p`,{className:`oc-access__hint`,children:le()}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(q,{value:b,onChange:e=>D(e.target.value),placeholder:fe(),className:`oc-access__search`}),(0,$.jsx)(`div`,{className:`oc-access__list`,children:s.map(t=>(0,$.jsx)(lt,{groupId:e,instanceName:t.name,kind:t.kind??`openclaw`,assigned:P,query:b},`${e}-${t._id}`))})]})}),(0,$.jsx)(H,{value:`charts`,children:(0,$.jsx)(ut,{groupId:e})})]})]})})}function lt({groupId:e,instanceName:t,kind:n,assigned:r,query:i}){let a=C(d.groups.listAssignableAgents,{instanceName:t}),o=l(d.groups.assignAgentToGroup),s=l(d.groups.removeAgentFromGroup),c=l(d.groups.bulkSetGroupAgents),f=Y(),[p,m]=(0,Q.useState)(1);if((0,Q.useEffect)(()=>{m(1)},[i]),!e)return null;let h=$e(a?.agents??[],i),g=a?.discovery&&!a.discovery.lastPollOk;if(i.trim()&&h.length===0)return null;let _=h.filter(e=>e.presentInLastOk!==!1&&e.enabled!==!1),v=nt(_,e=>r.has(`${t}/${e.agentId}`)),y=rt(h,p,ot);async function b(n,r){try{r?await s({groupId:e,instanceName:t,agentId:n}):await o({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 c({groupId:e,instanceName:t,agentIds:n,assigned:v!==`all`})}catch(e){f.error(ye(),e)}}return(0,$.jsxs)(`div`,{className:`oc-access__group`,children:[(0,$.jsxs)(`div`,{className:`oc-access__instance`,children:[(0,$.jsx)(G,{size:13,"aria-hidden":!0}),(0,$.jsx)(`span`,{children:t}),(0,$.jsx)(K,{variant:`outline`,className:`oc-access__kind`,children:n}),g?(0,$.jsx)(K,{variant:`outline`,className:`oc-access__stale`,children:se()}):null]}),a===void 0?(0,$.jsx)(`p`,{className:`oc-access__hint`,children:I()}):h.length===0?(0,$.jsx)(`p`,{className:`oc-access__hint`,children:g?ve():me()}):(0,$.jsxs)($.Fragment,{children:[_.length>1?(0,$.jsxs)(`div`,{className:`oc-access__row oc-access__selectall`,children:[(0,$.jsx)(J,{checked:v===`all`?!0:v===`some`?`indeterminate`:!1,onCheckedChange:()=>void x(),"aria-label":u()}),(0,$.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,$.jsxs)(`div`,{className:`oc-access__row${o?` is-disabled`:``}`,children:[(0,$.jsx)(J,{checked:i,disabled:(a||o)&&!i,onCheckedChange:()=>void b(e.agentId,i),"aria-label":Oe({name:e.displayName??e.agentId})}),(0,$.jsxs)(`span`,{className:`oc-access__label`,title:e.displayName??e.agentId,children:[e.emoji?`${e.emoji} `:``,e.displayName??e.agentId]}),e.model?(0,$.jsx)(`span`,{className:`oc-access__model`,children:e.model}):null,e.isDefaultOnInstance?(0,$.jsx)(`span`,{className:`oc-access__fav`,role:`img`,"aria-label":Te(),title:Te(),children:(0,$.jsx)(W,{size:14,fill:`currentColor`})}):null,a?(0,$.jsx)(K,{variant:`outline`,className:`oc-access__gone`,children:ae()}):null]},e.agentId)}),(0,$.jsx)(st,{page:y.page,pageCount:y.pageCount,onPage:m})]})]})}function ut({groupId:e}){let t=C(d.charts.listGroupChartSelection,e?{groupId:e}:`skip`),n=l(d.charts.assignChartToGroup),r=l(d.charts.removeChartFromGroup),i=l(d.charts.setGroupDefaultChart),a=l(d.charts.addChartToGroupPool),o=l(d.charts.removeChartFromGroupPool),s=Y();if(!e)return null;if(t===void 0)return(0,$.jsx)(`p`,{className:`oc-access__hint`,children:B()});let{pool:c,addable:u,canManagePool:f}=t;if(c.length===0&&!f)return(0,$.jsx)(`p`,{className:`oc-access__hint`,children:R()});async function p(t,i){try{i?await r({groupId:e,chartKey:t}):await n({groupId:e,chartKey:t})}catch(e){s.error(P(),e)}}async function m(t){try{await i({groupId:e,chartKey:t})}catch(e){s.error(P(),e)}}async function h(t){try{await a({groupId:e,chartKey:t})}catch(e){s.error(P(),e)}}async function g(t){try{await o({groupId:e,chartKey:t})}catch(e){s.error(P(),e)}}return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`div`,{className:`oc-access__list`,children:c.map(e=>(0,$.jsxs)(`div`,{className:`oc-access__row`,children:[(0,$.jsx)(J,{checked:e.selected,onCheckedChange:()=>void p(e.chartKey,e.selected),"aria-label":ue({name:e.name})}),(0,$.jsx)(`span`,{className:`oc-access__label`,title:e.name,children:e.name}),e.selected?e.isDefault?(0,$.jsx)(`span`,{className:`oc-access__fav`,role:`img`,"aria-label":xe(),title:xe(),children:(0,$.jsx)(W,{size:14,fill:`currentColor`})}):(0,$.jsx)(U,{type:`button`,variant:`ghost`,size:`sm`,onClick:()=>void m(e.chartKey),children:ge()}):null,f?(0,$.jsx)(U,{type:`button`,variant:`ghost`,size:`sm`,"aria-label":L({name:e.name}),title:L({name:e.name}),onClick:()=>void g(e.chartKey),children:(0,$.jsx)(Ae,{size:14,"aria-hidden":!0})}):null]},e.chartKey))}),f?u.length>0?(0,$.jsxs)(Le,{value:``,onValueChange:e=>void h(e),children:[(0,$.jsx)(Pe,{size:`sm`,className:`oc-access__search`,children:(0,$.jsx)(Ge,{placeholder:_e()})}),(0,$.jsx)(Ke,{children:u.map(e=>(0,$.jsx)(Ie,{value:e.chartKey,children:e.name},e.chartKey))})]}):c.length===0?(0,$.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,Ax as a,Bx as o,CS as s,Cx as c,DM as l,DS as u,Dx as d,E as f,ES as p,Ex as m,Fx as h,Gb as g,Gx as _,Hb as v,Hx as y,Ix as b,JD as x,Jb as S,Jt as C,Jx as w,Kb as T,Kx as ee,Lx as te,Mg as ne,Mx as re,Ng as ie,Nx as E,OM as D,Ox as O,Px as ae,Qb as oe,Qx as se,Rx as ce,SS as le,Sx as ue,TM as k,TS as de,Tx as fe,Ub as pe,Ux as me,Vb as he,Vx as ge,Wb as _e,Wx as A,Xb as ve,Xt as ye,Xx as be,Yb as xe,Yt as Se,Yx as Ce,Zb as we,Zx as Te,_S as Ee,_x as De,aS as Oe,ax as ke,bS as Ae,bx as je,cS as Me,ca as Ne,cx as j,dS as Pe,da as Fe,dx as M,eS as Ie,ex as Le,fS as Re,fx as ze,gS as Be,gx as Ve,hS as He,hx as Ue,iS as We,ix as Ge,jx as Ke,kx as qe,lS as Je,la as Ye,lx as Xe,mS as Ze,mx as Qe,nS as $e,nx as et,oS as tt,ox as nt,pS as N,px as rt,qD as it,qb as at,qx as ot,rS as st,rx as ct,sS as lt,sx as ut,tS as dt,tx as ft,uS as pt,ua as mt,ux as ht,vS as gt,vx as _t,wS as vt,wx as yt,xS as bt,xx as xt,yS as St,yx as Ct,zx as wt}from"./dist-HBBi9Y25.js";import{a as Tt,c as Et}from"./FieldLabel-CKVYl95W.js";import{t as P}from"./button-b04wLuGq.js";import{B as Dt,C as F,Q as Ot,S as I,X as kt,Z as At,b as L,ct as R,dt as z,ft as B,ht as V,lt as H,mt as U,p as W,u as jt,ut as G,w as K,x as q,z as J}from"./index-DBQ43N4_.js";import{t as Mt}from"./DataTableShell-KGrtOG5M.js";import{InstanceConfigDialog as Nt}from"./BridgeTab-DFpunFsv.js";var Y=t(e(),1),X=[`conversational`,`documentary`,`summarizer`,`curator`],Pt=new Set(X),Ft=`conversational`;function It(e){let t=new Set((e??[]).filter(e=>Pt.has(e)));return t.size===0?[Ft]:X.filter(e=>t.has(e))}var Z=n(),Q={name:``,gatewayUrl:``,bridgeUrl:``,displayName:``,kind:`openclaw`,transport:`ws`,gatewayVersion:``,gatewayHttpUrl:``,streamTransport:Tt},Lt={openclaw:[`token`,`deviceIdentity`],hermes:[`apiKey`]};function Rt(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 zt(){let e=D(f.admin.listInstances,{}),t=D(f.agents.listAllInstanceAgents,{}),n=l(f.admin.upsertInstance),r=l(f.admin.deleteInstance),a=J(),[o,c]=(0,Y.useState)(!1),[d,m]=(0,Y.useState)(Q),[h,g]=(0,Y.useState)(null),[_,y]=(0,Y.useState)(null),[b,x]=(0,Y.useState)(null),[S,w]=(0,Y.useState)(null);async function T(){try{await n({instanceId:S??void 0,name:d.name,gatewayUrl:d.gatewayUrl,bridgeUrl:d.bridgeUrl||void 0,displayName:d.displayName||void 0,kind:d.kind,transport:d.kind===`hermes`?d.transport:void 0,gatewayVersion:d.gatewayVersion||void 0,gatewayHttpUrl:d.gatewayHttpUrl||void 0,streamTransport:d.streamTransport}),m(Q),w(null),c(!1)}catch(e){a.error(de(),e)}}return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`p`,{className:`oc-admin__hint`,children:[vt(),(0,Z.jsx)(`strong`,{children:s()}),le()]}),(0,Z.jsx)(Mt,{title:bt(),rows:e,addLabel:Ae(),onAdd:()=>{w(null),m(Q),c(!0)},emptyHint:St(),columns:[{header:gt(),cell:e=>e.name,sort:e=>e.name},{header:Ee(),cell:e=>(0,Z.jsx)(R,{variant:`outline`,children:e.kind??`openclaw`}),sort:e=>e.kind??`openclaw`},{header:Be(),cell:e=>e.gatewayUrl,sort:e=>e.gatewayUrl},{header:He(),cell:e=>e.displayName??`—`,sort:e=>e.displayName??null},{header:u(),cell:e=>{let n=(t?.[e.name]??[]).filter(e=>e.presentInLastOk!==!1&&e.enabled);if(n.length===0)return(0,Z.jsx)(`span`,{className:`text-muted-foreground`,children:`—`});let r=t=>e.defaultAgentId===t;return(0,Z.jsx)(`div`,{className:`flex flex-wrap gap-1`,children:[...n].sort((e,t)=>Number(r(t.agentId))-Number(r(e.agentId))).map(e=>(0,Z.jsxs)(R,{variant:r(e.agentId)?`default`:`outline`,title:r(e.agentId)?v():void 0,children:[e.emoji?`${e.emoji} `:``,e.displayName??e.agentId]},e.agentId))})}}],rowActions:e=>[{label:Pe(),onSelect:()=>{w(e._id),m(Rt(e)),c(!0)}},{label:p(),onSelect:()=>g(e.name)},{label:be(),onSelect:()=>x(e)},{label:Ze(),onSelect:()=>y(e)},{label:N(),variant:`destructive`,onSelect:()=>void r({instanceId:e._id})}],bulkActions:[{label:N(),variant:`destructive`,onSelect:e=>e.forEach(e=>void r({instanceId:e}))}]}),(0,Z.jsx)(jt,{open:o,onOpenChange:c,title:S?pt():Re(),description:Me(),canSubmit:!!(d.name&&d.gatewayUrl),onSubmit:T,submitLabel:lt(),children:(0,Z.jsxs)(`div`,{className:`oc-form`,children:[(0,Z.jsxs)($,{label:tt(),children:[(0,Z.jsx)(H,{value:d.name,disabled:S!==null,onChange:e=>m({...d,name:e.target.value})}),S?(0,Z.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:Je()}):null]}),(0,Z.jsx)($,{label:Oe(),children:(0,Z.jsxs)(L,{value:d.kind,onValueChange:e=>m({...d,kind:e}),children:[(0,Z.jsx)(F,{size:`sm`,className:`w-40`,children:(0,Z.jsx)(K,{})}),(0,Z.jsxs)(q,{children:[(0,Z.jsx)(I,{value:`openclaw`,children:`OpenClaw`}),(0,Z.jsx)(I,{value:`hermes`,children:`Hermes`})]})]})}),d.kind===`hermes`?(0,Z.jsx)($,{label:ye(),children:(0,Z.jsxs)(L,{value:d.transport,onValueChange:e=>m({...d,transport:e}),children:[(0,Z.jsx)(F,{size:`sm`,className:`w-56`,children:(0,Z.jsx)(K,{})}),(0,Z.jsxs)(q,{children:[(0,Z.jsx)(I,{value:`ws`,children:Se()}),(0,Z.jsx)(I,{value:`rest`,children:C()})]})]})}):null,(0,Z.jsx)($,{label:We(),children:(0,Z.jsx)(H,{value:d.gatewayUrl,onChange:e=>m({...d,gatewayUrl:e.target.value})})}),(0,Z.jsx)($,{label:st(),children:(0,Z.jsx)(H,{value:d.bridgeUrl,placeholder:$e(),onChange:e=>m({...d,bridgeUrl:e.target.value})})}),(0,Z.jsx)($,{label:dt(),children:(0,Z.jsx)(H,{value:d.displayName,onChange:e=>m({...d,displayName:e.target.value})})}),(0,Z.jsxs)($,{label:ie(),children:[(0,Z.jsxs)(L,{value:d.streamTransport,onValueChange:e=>m({...d,streamTransport:e}),children:[(0,Z.jsx)(F,{size:`sm`,className:`w-40`,children:(0,Z.jsx)(K,{})}),(0,Z.jsx)(q,{children:Et.map(e=>(0,Z.jsx)(I,{value:e,children:e},e))})]}),(0,Z.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:ne()})]}),(0,Z.jsx)($,{label:Ie(),children:(0,Z.jsx)(H,{value:d.gatewayVersion,placeholder:i(),onChange:e=>m({...d,gatewayVersion:e.target.value})})}),(0,Z.jsx)($,{label:se(),children:(0,Z.jsx)(H,{value:d.gatewayHttpUrl,placeholder:Te(),onChange:e=>m({...d,gatewayHttpUrl:e.target.value})})})]})}),(0,Z.jsx)(Yt,{instanceName:h,open:h!==null,onOpenChange:e=>{e||g(null)}}),_?(0,Z.jsx)(Nt,{instance:_,onClose:()=>y(null)},_._id):null,b?(0,Z.jsx)(Bt,{instance:b,onClose:()=>x(null)},b._id):null]})}function Bt({instance:e,onClose:t}){let n=D(f.instanceSecrets.listInstanceSecretStatus,{}),r=Lt[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)(z,{onOpenAutoFocus:e=>e.preventDefault(),children:[(0,Z.jsxs)(U,{children:[(0,Z.jsx)(V,{children:Ce({instance:e.displayName??e.name})}),(0,Z.jsx)(B,{children:w()})]}),(0,Z.jsx)(`div`,{className:`oc-form`,children:r.map(t=>(0,Z.jsx)(Ut,{instanceId:e._id,field:t,updatedAt:i[t]??null},t))}),(0,Z.jsx)(`div`,{className:`oc-bridgesecret`,children:(0,Z.jsx)(Ht,{instance:e})}),(0,Z.jsx)(Vt,{instance:e})]})})}function Vt({instance:e}){let t=k(f.instanceSync.forceInstanceSync),n=J(),[r,i]=(0,Y.useState)(!1);async function o(){if(!r){i(!0);try{switch((await t({instanceId:e._id})).status){case`synced`:n.success(O());break;case`no_agents`:n.success(m());break;case`no_bridge_url`:n.error(fe());break;case`deploy_misconfigured`:n.error(yt());break;case`unauthorized`:n.error(ue());break;case`not_served`:n.error(xt());break;default:n.error(c());break}}catch(e){n.error(d(),e)}finally{i(!1)}}}return(0,Z.jsxs)(`div`,{className:`oc-form`,children:[(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:je()}),(0,Z.jsx)(`div`,{className:`flex items-center gap-2`,children:(0,Z.jsx)(P,{size:`sm`,variant:`outline`,onClick:()=>void o(),disabled:r,children:r?qe():a()})})]})}function Ht({instance:e}){let t=D(f.bridgeAuth.listBridgeAuthStatus,{}),n=k(f.bridgeAuth.mintBridgeSecret),r=l(f.bridgeAuth.revokeBridgeSecret),i=J(),[a,o]=(0,Y.useState)(!1),[s,c]=(0,Y.useState)(null),[u,d]=(0,Y.useState)(!1),p=(t??[]).find(t=>t.instanceId===e._id),m=p!==void 0;async function h(){if(!a){o(!0);try{c((await n({instanceId:e._id})).plaintext),d(!1)}catch(e){i.error(rt(),e)}finally{o(!1)}}}async function g(){if(!a){o(!0);try{await r({instanceId:e._id}),c(null),i.success(Qe())}catch(e){i.error(rt(),e)}finally{o(!1)}}}async function _(){if(s)try{await navigator.clipboard.writeText(s),d(!0)}catch{}}return(0,Z.jsxs)($,{label:Ct(),children:[(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:_t()}),(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Z.jsx)(R,{variant:m?`outline`:`secondary`,children:m?`${A()} · ${p.prefix}…${p.lastFour}`:me()}),(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(P,{size:`sm`,onClick:()=>void h(),disabled:a,children:m?Ve():De()}),m?(0,Z.jsx)(P,{size:`sm`,variant:`destructive`,onClick:()=>void g(),disabled:a,children:Ue()}):null]})]}),s?(0,Z.jsxs)(`div`,{className:`oc-bridgesecret__reveal`,children:[(0,Z.jsx)(`p`,{className:`oc-sa__minted-warning`,children:ze()}),(0,Z.jsxs)(`div`,{className:`oc-sa__minted-box`,children:[(0,Z.jsx)(`code`,{className:`oc-sa__minted-plain`,children:s}),(0,Z.jsx)(P,{variant:`outline`,size:`sm`,onClick:()=>void _(),children:u?x():it()})]}),(0,Z.jsx)(P,{size:`sm`,variant:`ghost`,onClick:()=>{c(null),d(!1)},children:M()})]}):null]})}function Ut({instanceId:e,field:t,updatedAt:n}){let r=k(f.instanceSecrets.setInstanceSecret),i=l(f.instanceSecrets.clearInstanceSecret),a=k(f.deviceIdentity.generateDeviceIdentity),s=J(),[c,u]=(0,Y.useState)(``),[d,p]=(0,Y.useState)(!1),[m,g]=(0,Y.useState)(null),[v,S]=(0,Y.useState)(!1),C=n!==null,w=t===`deviceIdentity`,T=t===`token`?ot():t===`deviceIdentity`?ee():_();async function ne(){if(!(!c.trim()||d)){p(!0);try{await r({instanceId:e,field:t,plaintext:c}),u(``),g(null),S(!1),s.success(ce())}catch(e){s.error(te(),e)}finally{p(!1)}}}async function ie(){if(!d){p(!0);try{await i({instanceId:e,field:t}),g(null),S(!1),s.success(b())}catch(e){s.error(te(),e)}finally{p(!1)}}}async function D(){if(!d){p(!0);try{g(await a({instanceId:e})),S(!1),s.success(E())}catch(e){s.error(Ke(),e)}finally{p(!1)}}}let O=m?`openclaw devices approve ${m.id}`:``;async function oe(){if(O)try{await navigator.clipboard.writeText(O),S(!0)}catch{}}return(0,Z.jsxs)($,{label:T,children:[w?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:ae()}):null,(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Z.jsx)(R,{variant:C?`outline`:`secondary`,children:C?A():me()}),(0,Z.jsx)(H,{type:`password`,autoComplete:`off`,className:`flex-1 min-w-32`,value:c,placeholder:C?ge():y(),onChange:e=>u(e.target.value)}),(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(P,{size:`sm`,onClick:()=>void ne(),disabled:d||c.trim().length===0,children:o()}),w?(0,Z.jsx)(P,{size:`sm`,variant:`outline`,onClick:()=>void D(),disabled:d,children:h()}):null,C?(0,Z.jsx)(P,{size:`sm`,variant:`destructive`,onClick:()=>void ie(),disabled:d,children:wt()}):null]})]}),m?(0,Z.jsxs)(`div`,{className:`oc-bridgesecret__reveal`,children:[(0,Z.jsx)(`p`,{className:`text-sm font-medium`,children:E()}),(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:re()}),(0,Z.jsxs)(`div`,{className:`oc-sa__minted-box`,children:[(0,Z.jsx)(`code`,{className:`oc-sa__minted-plain`,children:O}),(0,Z.jsx)(P,{variant:`outline`,size:`sm`,onClick:()=>void oe(),children:v?x():it()})]}),(0,Z.jsx)(P,{size:`sm`,variant:`ghost`,onClick:()=>{g(null),S(!1)},children:M()})]}):null]})}var Wt={conversational:ct,documentary:ft,summarizer:Fe,curator:Ye},Gt={conversational:et,documentary:Le,summarizer:mt,curator:Ne},Kt=e=>(Wt[e]??(()=>e))(),qt=e=>(Gt[e]??(()=>``))();function Jt({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:ut()}),t.map(e=>(0,Z.jsx)(R,{variant:`secondary`,className:`oc-agenttype__chip`,title:qt(e),children:Kt(e)},e)),(0,Z.jsxs)(kt,{children:[(0,Z.jsx)(Ot,{asChild:!0,children:(0,Z.jsx)(P,{type:`button`,variant:`outline`,size:`sm`,className:`h-7`,children:nt()})}),(0,Z.jsxs)(At,{align:`start`,className:`oc-agenttypes-pop`,children:[(0,Z.jsx)(`p`,{className:`oc-agenttypes-pop__title`,children:ke()}),(0,Z.jsx)(`p`,{className:`oc-agenttypes-pop__hint`,children:Ge()}),(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:Kt(r)}),(0,Z.jsx)(`span`,{className:`oc-agenttypes-pop__desc`,children:qt(r)})]})]},r)})})]})]})]})}function Yt({instanceName:e,open:t,onOpenChange:n}){let i=D(f.agents.listAgentsForInstance,t&&e?{instanceName:e}:`skip`),a=l(f.agents.setAgentEnabled).withOptimisticUpdate((e,{instanceName:t,agentId:n,enabled:r})=>{let i=e.getQuery(f.agents.listAgentsForInstance,{instanceName:t});i&&e.setQuery(f.agents.listAgentsForInstance,{instanceName:t},{...i,agents:i.agents.map(e=>e.agentId===n?{...e,enabled:r}:e)})}),o=l(f.agents.setInstanceDefaultAgent).withOptimisticUpdate((e,{instanceName:t,agentId:n})=>{let r=e.getQuery(f.agents.listAgentsForInstance,{instanceName:t});r&&e.setQuery(f.agents.listAgentsForInstance,{instanceName:t},{...r,defaultAgentId:n})}),s=l(f.agents.setAgentTypes).withOptimisticUpdate((e,{instanceName:t,agentId:n,types:r})=>{let i=e.getQuery(f.agents.listAgentsForInstance,{instanceName:t});if(!i)return;let a=It(r);e.setQuery(f.agents.listAgentsForInstance,{instanceName:t},{...i,agents:i.agents.map(e=>e.agentId===n?{...e,types:a}:e)})}),c=l(f.agents.removeInstanceAgent),u=Dt(),d=J();async function p(t,n){if(e)try{await a({instanceName:e,agentId:t,enabled:n})}catch(e){d.error(j(),e)}}async function m(t){if(e)try{await o({instanceName:e,agentId:t})}catch(e){d.error(j(),e)}}async function h(t,n,r){if(!e)return;let i=r.includes(n)?r.filter(e=>e!==n):[...r,n];try{await s({instanceName:e,agentId:t,types:i})}catch(e){d.error(j(),e)}}async function _(t,n){if(e&&await u({title:we({name:n}),description:ve(),confirmLabel:xe(),destructive:!0}))try{await c({instanceName:e,agentId:t}),d.success(S())}catch(e){d.error(j(),e)}}return(0,Z.jsx)(G,{open:t,onOpenChange:n,children:(0,Z.jsxs)(z,{className:`oc-access`,children:[(0,Z.jsxs)(U,{children:[(0,Z.jsx)(V,{children:ht({name:e??``})}),(0,Z.jsx)(B,{children:Xe()})]}),i===void 0?(0,Z.jsx)(`p`,{className:`oc-access__hint`,children:at()}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`div`,{className:`oc-access__poll`,children:i.discovery===null?T():i.discovery.lastPollOk?g():_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(e=>{let t=e.presentInLastOk===!1,n=i.defaultAgentId===e.agentId,a=e.displayName??e.agentId,o=e.types??[];return(0,Z.jsxs)(`div`,{className:`oc-agentcard`+(e.enabled?``:` oc-agentcard--off`),children:[(0,Z.jsxs)(`div`,{className:`oc-agentcard__head`,children:[(0,Z.jsx)(W,{checked:e.enabled,disabled:t,"aria-label":a,onCheckedChange:t=>void p(e.agentId,t===!0)}),(0,Z.jsxs)(`span`,{className:`oc-agentcard__name`,title:a,children:[e.emoji?`${e.emoji} `:``,a]}),e.model?(0,Z.jsx)(`span`,{className:`oc-access__model`,children:e.model}):null,t?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(R,{variant:`outline`,className:`oc-access__gone`,children:he()}),(0,Z.jsx)(P,{size:`sm`,variant:`ghost`,className:`h-7 text-destructive`,onClick:()=>void _(e.agentId,a),children:oe()})]}):n?(0,Z.jsx)(R,{variant:`default`,children:v()}):(0,Z.jsx)(P,{size:`sm`,variant:`outline`,className:`h-7`,disabled:!e.enabled,onClick:()=>void m(e.agentId),children:r()})]}),e.enabled?(0,Z.jsx)(Jt,{agentId:e.agentId,types:o,onToggle:t=>void h(e.agentId,t,o)}):null]},e.agentId)})})]})]})})}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{zt as InstancesTab};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Ao as r,DM as i,Do as a,E as o,Eo as s,Mo as c,OM as l,Oo as u,TM as d,To as f,aw as p,cw as m,dw as h,fw as g,gw as _,hw as v,iw as y,jo as b,ko as x,lw as S,mw as C,ow as w,pw as T,rw as E,sw as D,uw as O,wo as k}from"./dist-HBBi9Y25.js";import{t as A}from"./button-b04wLuGq.js";import{ct as j,lt as M,p as N}from"./index-DBQ43N4_.js";var P=t(e(),1),F=n();function I(){let e=l(o.integrations.status.status,{}),t=i(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:_()});let s=n,u=(e,t,n)=>a({...s,[e]:{...s[e],[t]:n}}),d=(e,n)=>void t({[e]:n});return(0,F.jsxs)(F.Fragment,{children:[(0,F.jsxs)(`p`,{className:`oc-admin__hint`,children:[v(),` `,(0,F.jsx)(`strong`,{children:C()}),` `,T()]}),(0,F.jsxs)(L,{title:`Langfuse`,status:e.langfuse.configured?e.langfuse.enabled?(0,F.jsx)(j,{variant:`secondary`,children:g()}):(0,F.jsx)(j,{variant:`outline`,children:h()}):(0,F.jsx)(j,{variant:`outline`,children:O()}),note:S(),children:[(0,F.jsx)(R,{label:D(),children:(0,F.jsx)(M,{value:s.langfuse.host??``,placeholder:e.langfuse.effectiveHost,onChange:e=>u(`langfuse`,`host`,e.target.value),onBlur:()=>d(`langfuse`,{host:s.langfuse.host??``})})}),(0,F.jsx)(z,{label:E(),checked:s.langfuse.enabled??!0,onChange:e=>{u(`langfuse`,`enabled`,e),d(`langfuse`,{enabled:e})}})]}),(0,F.jsxs)(L,{title:`Opik`,status:e.opik.configured?e.opik.enabled?(0,F.jsx)(j,{variant:`secondary`,children:g()}):(0,F.jsx)(j,{variant:`outline`,children:h()}):(0,F.jsx)(j,{variant:`outline`,children:O()}),note:m(),children:[(0,F.jsx)(R,{label:w(),children:(0,F.jsx)(M,{value:s.opik.baseUrl??``,placeholder:e.opik.effectiveBaseUrl,onChange:e=>u(`opik`,`baseUrl`,e.target.value),onBlur:()=>d(`opik`,{baseUrl:s.opik.baseUrl??``})})}),(0,F.jsx)(R,{label:p(),children:(0,F.jsx)(M,{value:s.opik.workspace??``,placeholder:e.opik.effectiveWorkspace||y(),onChange:e=>u(`opik`,`workspace`,e.target.value),onBlur:()=>d(`opik`,{workspace:s.opik.workspace??``})})}),(0,F.jsx)(z,{label:E(),checked:s.opik.enabled??!0,onChange:e=>{u(`opik`,`enabled`,e),d(`opik`,{enabled:e})}})]}),(0,F.jsxs)(L,{title:`OpenTelemetry (OTLP)`,status:e.otlp.configured?e.otlp.enabled?(0,F.jsx)(j,{variant:`secondary`,children:g()}):(0,F.jsx)(j,{variant:`outline`,children:h()}):(0,F.jsx)(j,{variant:`outline`,children:c()}),note:b(),children:[(0,F.jsx)(R,{label:r(),children:(0,F.jsx)(M,{value:s.otlp.endpoint??``,placeholder:e.otlp.effectiveEndpoint||`https://otlp.example.com/v1/traces`,onChange:e=>u(`otlp`,`endpoint`,e.target.value),onBlur:()=>d(`otlp`,{endpoint:s.otlp.endpoint??``})})}),(0,F.jsx)(B,{headersSet:e.otlp.headersSet}),(0,F.jsx)(z,{label:E(),checked:s.otlp.enabled??!0,onChange:e=>{u(`otlp`,`enabled`,e),d(`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=d(o.integrations.otlpSecret.setOtlpHeaders),n=i(o.integrations.otlpSecret.clearOtlpHeaders),[r,c]=(0,P.useState)(``),[l,p]=(0,P.useState)(null),[m,h]=(0,P.useState)(!1),g=async()=>{h(!0),p(null);try{await t({headersJson:r}),c(``)}catch(e){p(e instanceof Error?e.message:String(e))}finally{h(!1)}};return(0,F.jsxs)(R,{label:x(),children:[(0,F.jsx)(M,{value:r,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||r.trim().length===0,onClick:()=>void g(),children:s()}),e?(0,F.jsx)(A,{variant:`ghost`,size:`sm`,disabled:m,onClick:()=>void n({}),children:f()}):null]}),l?(0,F.jsx)(`p`,{className:`oc-int__otlp-headers-error`,children:l}):null,(0,F.jsx)(`p`,{className:`oc-uipa__note`,children:k()})]})}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,E as a,Gm as o,Hm as s,Hw as c,Jm as l,Km as u,OM as d,Qw as f,Rm as p,Um as m,Uw as h,Vm as g,Wm as _,Xm as v,Xw as y,Ym as b,Zm as x,Zw as S,qm as C,wT as w,zm as T}from"./dist-HBBi9Y25.js";import{Xt as E,Yt as ee,a as te,n as ne,r as re,xt as D}from"./index-DBQ43N4_.js";import{a as O,n as k,o as A,r as j,t as M}from"./card-DdBF2ct9.js";import{n as N,t as P}from"./TimeRangePicker-NSOkx3C0.js";var F=t(e(),1),I=n(),L=15,R=e=>String(Math.round(e));function z(){let e=d(a.me.getMe,{host:D})?.permissions?.includes(`traces.read`)??!1,t=d(a.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:w()}),(0,I.jsxs)(M,{children:[(0,I.jsxs)(O,{children:[(0,I.jsx)(A,{children:r()}),(0,I.jsx)(j,{children:S()})]}),(0,I.jsx)(k,{children:n.length<2?(0,I.jsx)(`p`,{className:`oc-admin__hint`,children:y()}):(0,I.jsx)(B,{series:n})})]})]})}function B({series:e}){let t=e.map(e=>e.cP50),n=e.map(e=>e.aP50),i=Math.max(1,...t,...n),a=t=>6+t*468/(e.length-1),o=e=>74-e*68/i,s=e=>e.map((e,t)=>`${t===0?`M`:`L`}${a(t).toFixed(1)},${o(e).toFixed(1)}`).join(` `),l=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(l.cP50),` `,f()]}),(0,I.jsxs)(`span`,{children:[h(),` p50 `,R(l.aP50),` `,f()]})]}),(0,I.jsxs)(`svg`,{viewBox:`0 0 480 80`,className:`h-20 w-full`,preserveAspectRatio:`none`,role:`img`,"aria-label":r(),children:[(0,I.jsx)(`path`,{d:s(n),fill:`none`,style:{stroke:`var(--muted-foreground)`},strokeWidth:1.5}),(0,I.jsx)(`path`,{d:s(t),fill:`none`,style:{stroke:`var(--primary)`},strokeWidth:1.5})]})]})}var V=[{metric:`api.calls`,label:x(),unit:`/h`,group:`API`,isError:!1},{metric:`api.errors`,label:v(),unit:`/h`,group:`API`,isError:!0},{metric:`api.latency.avg_ms`,label:b(),unit:`ms`,group:`API`,isError:!1},{metric:`openclaw.ingest`,label:l(),unit:`/h`,group:`OpenClaw`,isError:!1},{metric:`chat.send`,label:C(),unit:`/h`,group:`Chat`,isError:!1},{metric:`assistant.stream.errors`,label:u(),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=E({from:`/settings/kpi`}),t=ee({from:`/settings/kpi`}),n=re(e.from,e.to,ne,`now`),r=e=>void t({search:t=>({...t,...te(e)})}),{from:i,to:c}=N(n),{rowLimit:l,buckets:u}=K(i,c),f=d(a.kpi.listKpis,{limit:l,filter:{from:i,to:c}}),p=(0,F.useMemo)(()=>{let e=new Map;for(let t of f??[]){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},[f,u]),h=(0,I.jsxs)(I.Fragment,{children:[(0,I.jsxs)(`p`,{className:`oc-admin__hint`,children:[o(),` `,(0,I.jsx)(`span`,{className:`oc-filter__window`,children:_()})]}),(0,I.jsx)(J,{value:n,onChange:r})]});return f===void 0?(0,I.jsxs)(I.Fragment,{children:[h,(0,I.jsx)(z,{}),(0,I.jsx)(`p`,{className:`oc-admin__hint`,children:m()})]}):f.length===0?(0,I.jsxs)(I.Fragment,{children:[h,(0,I.jsx)(z,{}),(0,I.jsx)(`p`,{className:`oc-admin__hint`,children:s()})]}):(0,I.jsxs)(I.Fragment,{children:[h,(0,I.jsx)(z,{}),U.map(e=>{let t=V.filter(t=>t.group===e);return t.some(e=>(p.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:p.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:g({value:$(n.bucket)})}):(0,I.jsx)(`span`,{className:`oc-kpi__muted`,children:i()}),(0,I.jsx)(`span`,{className:`oc-kpi__muted`,children:T({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,Ak as i,Bk as a,Ck as o,DM 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,Kk as ae,L as oe,Lk as se,M as ce,Mk as le,N as p,Nk as ue,OM as m,Ok as de,P as fe,Pk as pe,Rk as me,Sk as he,Tk as ge,Uk as h,Vk as g,Wk as _,X as v,Z as y,_k as b,aM as x,bk as S,cM as C,ck as w,dM as T,dk as E,fk as D,gk as O,hk as k,iM as A,j,jk as M,kk as N,lM as P,lk as F,mM as I,mk as L,n as R,nM as _e,oM as ve,ok as ye,pk as z,qk as be,rM as xe,sM as Se,sS as Ce,sk as we,tM as Te,uM as Ee,uk as De,vk as B,wk as Oe,xk as ke,yM as Ae,yk as V,zk as je}from"./dist-HBBi9Y25.js";import{t as H}from"./button-b04wLuGq.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-DBQ43N4_.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:R(`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:R(`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:()=>be()},{id:`composer`,label:()=>ae()},{id:`sidebar`,label:()=>te()},{id:`notifications`,label:()=>u()},{id:`other`,label:()=>_()}],Z={showSource:{category:`messages`,label:()=>h(),help:()=>ne()},showReport:{category:`messages`,label:()=>g(),help:()=>a()},copyAssistant:{category:`messages`,label:()=>je()},copyUser:{category:`messages`,label:()=>me()},showDelete:{category:`messages`,label:()=>se()},showTools:{category:`messages`,label:()=>ie(),help:()=>f()},voiceInput:{category:`composer`,label:()=>pe(),help:()=>ue()},showUsage:{category:`composer`,label:()=>le(),help:()=>M()},autoReadAloud:{category:`composer`,label:()=>y(),help:()=>v()},showChatAge:{category:`sidebar`,label:()=>i(),help:()=>N()},showChatProvider:{category:`sidebar`,label:()=>de(),help:()=>c()},notifSound:{category:`notifications`,label:()=>ge(),help:()=>Oe()},notifSystem:{category:`notifications`,label:()=>o(),help:()=>he()},replySound:{category:`notifications`,label:()=>ke(),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:()=>De()};function Ze({prefKey:e,ui:t}){let n=s(l.admin.setUiPrefDefault),r=s(l.admin.setFeatureEnabled),i=Ye(e),a=i?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:L()}),(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:w()}),(0,Y.jsx)(U,{value:`off`,children:we()}),(0,Y.jsx)(U,{value:`inherit`,children:ye()})]})]}),i?(0,Y.jsxs)(`span`,{className:`oc-prefs__gov-gate`,children:[(0,Y.jsx)(K,{checked:t.featuresEnabled[i]===!0,onCheckedChange:e=>void r({key:i,enabled:e===!0}),"aria-label":z()}),z()]}):null]}),a?(0,Y.jsx)(`span`,{className:`oc-prefs__gov-help`,children:a}):null]})}function Qe({current:e,enabled:t}){let n=s(l.me.setDictationShortcut),[i,a]=(0,J.useState)(!1),[o,c]=(0,J.useState)(!1);return(0,J.useEffect)(()=>{if(!i)return;let e=e=>{if(e.preventDefault(),e.stopPropagation(),e.key===`Escape`){a(!1);return}let t=ze(e);if(t===null){[`Shift`,`Control`,`Meta`,`Alt`].includes(e.key)||(c(!0),window.setTimeout(()=>c(!1),1800));return}a(!1),n({shortcut:t})};return window.addEventListener(`keydown`,e,!0),()=>window.removeEventListener(`keydown`,e,!0)},[i,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:[oe(),e?(0,Y.jsx)(W,{variant:`secondary`,children:Fe(e,Ie())}):null]}),(0,Y.jsx)(`span`,{className:`oc-prefs__help`,children:o?fe():i?d():re()})]}),(0,Y.jsxs)(`div`,{className:`oc-prefs__ctl`,children:[e&&!i?(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":i,onClick:()=>a(e=>!e),children:i?j():e?ce():p()})]})]})}function $e(){let[e,t]=(0,J.useState)(``),[n,r]=(0,J.useState)(!1),i=m(l.me.getMe,{host:q}),a=i?.ui,o=$(i?.role)&&n,c=s(l.me.setUiPref).withOptimisticUpdate(Me),u=(0,J.useMemo)(()=>a?Ue(Object.keys(a.effective),e):[],[a,e]);return a?(0,Y.jsxs)(`div`,{className:`oc-prefs-panel`,children:[$(i?.role)?(0,Y.jsxs)(`label`,{className:`oc-prefs__gov-toggle`,children:[(0,Y.jsx)(K,{checked:n,onCheckedChange:e=>r(e===!0),"aria-label":k()}),k()]}):null,o?(0,Y.jsxs)(`div`,{className:`oc-prefs__gov-head`,children:[(0,Y.jsx)(`p`,{children:D()}),(0,Y.jsx)(`p`,{children:E()}),(0,Y.jsx)(`p`,{children:F()})]}):null,(0,Y.jsx)(G,{value:e,onChange:e=>t(e.target.value),placeholder:V(),"aria-label":V(),className:`mb-2`}),u.length===0?(0,Y.jsx)(`div`,{className:`oc-prefs__empty`,children:B()}):(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=a.locked[e],s=a.effective[e],l=a.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:b()}):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:O()}):null,(0,Y.jsx)(He,{checked:s,disabled:i,onCheckedChange:t=>{e===`notifSystem`&&t&&typeof Notification<`u`&&Notification.permission==="default"&&Notification.requestPermission(),c({key:e,value:t})},"aria-label":n})]}),o?(0,Y.jsx)(Ze,{prefKey:e,ui:a}):null]},e)})]},e.id))}),(0,Y.jsx)(Qe,{current:i?.dictationShortcut??null,enabled:a.effective.voiceInput===!0})]}):(0,Y.jsx)(`div`,{className:`oc-prefs__empty`,children:Ae()})}function et(){let e=m(l.me.getMe,{host:q}),t=s(l.me.setLocale),n=s(l.me.setMyName),r=Be(),i=e?.locale??`default`,a=e?.name??``,[o,c]=(0,J.useState)(null),u=o??a,d=u.trim()!==a.trim();async function f(){try{await n({name:u}),c(null),r.success(Se())}catch(e){r.error(ve(),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:T()}),(0,Y.jsx)(`p`,{className:`oc-show__desc`,children:Ee()})]}),(0,Y.jsxs)(`div`,{className:`oc-show__row`,children:[(0,Y.jsx)(G,{className:`max-w-xs`,value:u,maxLength:120,placeholder:P(),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:Ce()})]}),(0,Y.jsx)(`p`,{className:`oc-show__desc`,children:C()})]}),(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:x()}),(0,Y.jsx)(`p`,{className:`oc-show__desc`,children:A()})]}),(0,Y.jsxs)(`div`,{className:`oc-show__row`,children:[Ve().map(e=>(0,Y.jsx)(H,{variant:i===e.value?`default`:`outline`,size:`sm`,onClick:()=>void t({locale:e.value}),children:e.label},e.value)),(0,Y.jsx)(H,{variant:i==="default"?`default`:`outline`,size:`sm`,onClick:()=>void t({locale:null}),children:I()})]}),(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:Te()})]}),(0,Y.jsx)($e,{})]})]})}export{et as PreferencesTab};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$t as r,Ar as i,Cg as a,DM as o,Dg as s,Dr as c,E as l,Eg as u,Ig as d,Lg as f,Mr as p,OM as m,Og as h,Or as g,Qt as _,Sg as v,Tg as y,Zt as ee,_g as b,bg as x,dg as S,fa as C,fg as w,ga as T,gg as te,ha as E,hg 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-HBBi9Y25.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-CKVYl95W.js";import{t as W}from"./button-b04wLuGq.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-DBQ43N4_.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:a},documentary_fetch:{label:v,help:P},inbound_files:{label:x,help:F},history_summary:{label:T,help:E},file_curation:{label:p,help:ne}},de={outboundDir:`/home/node/.openclaw/media/outbound`,references:`- gdrive/1a2b3c4d5e6f7890abcd
|
|
2
|
+
- gdrive/0f9e8d7c6b5a4321dcba`,files:`- /home/node/.openclaw/media/inbound/rapport.pdf (124800 o, application/pdf)`,previous_summary:`Projet Alpha : budget 40 000 EUR ; choix du serveur en cours.`,new_messages:`Utilisateur : Compare OVH et Scaleway.
|
|
3
|
+
Assistant : Comparaison en cours.`,max_chars:`6000`,file_name:`MEMORY.md`,budget_chars:`20000`,feedback:`Trop de suppressions dans la section des liens, garde-les.`,content:`# Memory index
|
|
4
|
+
- [Fait 1](fait-1.md) - note du projet`},fe={outboundDir:w,references:S,files:j,previous_summary:ae,new_messages:k,max_chars:C,file_name:i,budget_chars:ie,feedback:g,content:c};function pe(){let e=m(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:b()})});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:h()}),(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=o(l.admin.upsertInstanceConfig),n=se(),i=m(l.me.getMe,{host:oe}),a=e.config??{},s=Z(e.config?.contentLocale,i?.defaultLocale??void 0),[c,u]=(0,Q.useState)(()=>R(a,s));(0,Q.useEffect)(()=>{u(R(a,s))},[s,e._id]);let[p,h]=(0,Q.useState)(!1),g=c.promptInjections,v=(e,t)=>u({...c,promptInjections:{...g,[e]:{...g[e],...t}}});async function y(){h(!0);try{await t({instanceId:e._id,config:V(c,a,s)})}catch(e){n.error(d(),e)}finally{h(!1)}}async function b(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 x=e.config?.contentLocale??`default`,S=ce[Z(void 0,i?.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:x,onValueChange:e=>void b(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:S})}),le().map(e=>(0,$.jsx)(K,{value:e.value,children:e.label},e.value))]})]}),(0,$.jsx)(`p`,{className:`oc-admin__hint`,children:_()})]}),U.map(e=>(0,$.jsx)(he,{injKey:e,def:z[e],i18n:ue[e],row:g[e]??{enabled:!0,template:z[e].defaultTemplate[s]},contentLocale:s,onChange:t=>v(e,t)},e)),(0,$.jsx)(`div`,{className:`oc-injtab__actions`,children:(0,$.jsx)(W,{size:`sm`,onClick:()=>void y(),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:y()}),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?D():te()}),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,By as i,Cb as a,DM as o,E as s,Hy as c,Iy as l,Ly as u,OM as d,Qy as ee,Ry as te,Sb as f,Tb as p,Uy as m,Vy as h,Wy as g,Xy as _,Zy as v,_b as y,ab as b,bb as x,cb as S,db as ne,eb as re,fb as ie,gb as C,hb as w,ib 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-HBBi9Y25.js";import{t as B}from"./button-b04wLuGq.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-DBQ43N4_.js";import{t as J}from"./roleDescriptions-onSlZ7A3.js";var Y=t(e(),1),X=n(),Z=[{group:()=>p(),keys:[{key:`traces.read`,label:()=>x()},{key:`traces.read.content`,label:()=>z(),phi:!0},{key:`traces.write`,label:()=>I()}]},{group:()=>L(),keys:[{key:`kpi.read`,label:()=>x()},{key:`kpi.write`,label:()=>I()}]},{group:()=>a(),keys:[{key:`openclaw.query`,label:()=>y()},{key:`anomalies.read`,label:()=>C()},{key:`anomalies.report`,label:()=>w()}]},{group:()=>f(),keys:[{key:`chats.read`,label:()=>x()},{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=d(s.apiKeys.listRoles,{}),t=o(s.apiKeys.createRole),n=o(s.apiKeys.ensureRolesSeeded),a=o(s.apiKeys.updateRolePermissions).withOptimisticUpdate((e,{roleId:t,permissions:n})=>{let r=e.getQuery(s.apiKeys.listRoles,{});r&&e.setQuery(s.apiKeys.listRoles,{},r.map(e=>e._id===t?{...e,permissions:n}:e))}),f=V(),p=q(),[y,x]=(0,Y.useState)(!1),[C,w]=(0,Y.useState)($),[D,k]=(0,Y.useState)(new Set);(0,Y.useEffect)(()=>{n({}).catch(e=>{p.error(ne(),e)})},[n,p]);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 f({title:F({name:e.name}),description:E(),confirmLabel:S()}))){k(t=>new Set(t).add(e._id));try{await a({roleId:e._id,permissions:n})}catch(e){p.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($),x(!1)}catch(e){p.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:[b(),` `,(0,X.jsx)(`code`,{children:`admin`}),` `,T(),` `,(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($),x(!0)},children:P()})})]}),R?(0,X.jsx)(`p`,{className:`oc-admin__hint`,children:re()}):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:ee()}),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?ie({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,{}),` `,v()]}):(0,X.jsx)(U,{variant:`secondary`,children:_()})]}),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?g():n?m():r,onCheckedChange:()=>void I(e,r)})},r))]},e.key)})})]})})]}),(0,X.jsx)(K,{open:y,onOpenChange:x,title:c(),description:h(),canSubmit:!!(C.key&&C.name),onSubmit:L,submitLabel:i(),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:te(),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:u()}),(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:l()}),(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,AO as ee,BD as a,BO as te,CO as ne,DM as o,DO as re,E as s,EO as ie,FO as ae,GD as c,GO as oe,HD as l,HO as se,IO as ce,JD as u,JO as le,KD as d,KO as ue,LO as de,MO as fe,NO as pe,OM as f,OO as me,PO as he,QD as p,QO as ge,RO as _e,SO as ve,TM as ye,TO as be,UD as m,UO as xe,VD as Se,VO as Ce,WD as we,WO as Te,XD as h,XO as Ee,YD as g,YO as De,ZD as _,ZO as Oe,_O as ke,aO as v,ak as Ae,bO as je,cO as y,dO as Me,eO as b,ek as x,fO as Ne,gO as Pe,hO as Fe,iO as S,ik as Ie,jO as Le,kO as Re,lO as ze,mO as Be,nO as C,nk as Ve,oO as w,pO as He,qD as T,qO as Ue,rO as E,rk as We,sO as D,tO as O,tk as Ge,uO as Ke,vO as qe,wO as Je,xO as Ye,yO as Xe,zD as k,zO as Ze}from"./dist-HBBi9Y25.js";import{n as A}from"./dist-6oi7FQ0i.js";import{i as Qe}from"./dist-DBet7oNc.js";import{t as j}from"./button-b04wLuGq.js";import{$ as M,B as $e,C as N,S as P,Wt as F,Xt as et,Yt as tt,b as I,ct as L,dt as R,et as z,ft as B,ht as V,lt as H,mt as U,pt as nt,qt as rt,u as it,ut as W,w as G,x as K,z as at}from"./index-DBQ43N4_.js";import{t as ot}from"./FilterBar-BVVVO1_O.js";import{t as st}from"./DataTableShell-KGrtOG5M.js";import{t as ct}from"./roleDescriptions-onSlZ7A3.js";var q=t(e(),1),J=n(),Y=[{value:`never`,label:()=>c(),days:null},{value:`30`,label:()=>we(),days:30},{value:`90`,label:()=>m(),days:90}],X=720*60*60*1e3,Z=`__all__`,Q={name:``,roleKey:``,description:``};function $(){let e=et({from:`/settings/serviceAccounts`}),t=tt({from:`/settings/serviceAccounts`}),n=e.q??``,r=e.status??Z,[a,c]=(0,q.useState)(Z),l=e=>void t({search:t=>({...t,q:e||void 0}),replace:!0}),u=e=>void t({search:t=>({...t,status:e===Z?void 0:e})}),d=f(s.apiKeys.listServiceAccounts,{filter:{q:n||void 0,role:a===Z?void 0:a,disabled:r===Z?void 0:r===`disabled`}}),p=f(s.apiKeys.listKeys,{}),m=f(s.apiKeys.listRoles,{}),Se=o(s.apiKeys.createServiceAccount),we=o(s.apiKeys.updateServiceAccount),h=o(s.apiKeys.deleteServiceAccount),g=ye(s.apiKeys.mintApiKey),_=o(s.apiKeys.revokeApiKey),v=$e(),y=at(),b=n!==``||a!==Z||r!==Z;function S(){c(Z),t({search:{},replace:!0})}let[C,w]=(0,q.useState)(!1),[T,E]=(0,q.useState)(Q),[D,O]=(0,q.useState)(null),[k,A]=(0,q.useState)(new Set),[M,F]=(0,q.useState)(null),R=(0,q.useRef)(!1),[z,B]=(0,q.useState)(new Set),[V,U]=(0,q.useState)({}),[nt,W]=(0,q.useState)(null),X=(0,q.useMemo)(()=>{let e=new Map;for(let t of p??[]){let n=e.get(t.serviceAccountId)??[];n.push(t),e.set(t.serviceAccountId,n)}return e},[p]);function $(e){A(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})}async function dt(){try{D?(await we({serviceAccountId:D,name:T.name,roleKey:T.roleKey,description:T.description}),y.success(ne())):await Se({name:T.name,roleKey:T.roleKey,description:T.description||void 0}),E(Q),O(null),w(!1)}catch(e){y.error(D?Je():be(),e)}}function ft(e){E({name:e.name,roleKey:e.roleKey,description:e.description??``}),O(e._id),w(!0)}async function pt(e){if(R.current)return;R.current=!0;let t=V[e._id]??`never`,n=Y.find(e=>e.value===t)?.days??null,r=n?Date.now()+n*24*60*60*1e3:void 0;F(e._id);try{let t=await g({serviceAccountId:e._id,expiresAt:r});W({accountName:e.name,plaintext:t.plaintext,prefix:t.prefix,lastFour:t.lastFour})}catch(e){y.error(ve(),e)}finally{R.current=!1,F(null)}}async function mt(e){if(await v({title:Ye(),description:(0,J.jsxs)(J.Fragment,{children:[je(),` `,(0,J.jsx)(`span`,{className:`font-mono`,children:e.name}),` `,Xe(),` `,(0,J.jsx)(`strong`,{children:qe()}),` `,ke()]}),confirmWord:e.name,confirmLabel:Pe(),destructive:!0}))try{await h({serviceAccountId:e._id}),y.success(Fe(),e.name)}catch(e){y.error(Be(),e)}}async function ht(e){if(await v({title:He(),description:(0,J.jsxs)(J.Fragment,{children:[Ne(),` `,(0,J.jsxs)(`span`,{className:`font-mono`,children:[e.prefix,`…`,e.lastFour]}),` `,Me()]}),confirmLabel:Ke(),destructive:!0})&&!z.has(e._id)){B(t=>new Set(t).add(e._id));try{await _({keyId:e._id})}catch(e){y.error(ze(),e)}finally{B(t=>{let n=new Set(t);return n.delete(e._id),n})}}}return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(`p`,{className:`oc-admin__hint`,children:Ae()}),(0,J.jsxs)(ot,{q:n,onQChange:l,searchPlaceholder:Ie(),onReset:S,canReset:b,children:[(0,J.jsxs)(I,{value:a,onValueChange:c,children:[(0,J.jsx)(N,{size:`sm`,className:`w-40`,children:(0,J.jsx)(G,{placeholder:We()})}),(0,J.jsxs)(K,{children:[(0,J.jsx)(P,{value:Z,children:Ve()}),(m??[]).map(e=>(0,J.jsx)(P,{value:e.key,children:e.key},e._id))]})]}),(0,J.jsxs)(I,{value:r,onValueChange:u,children:[(0,J.jsx)(N,{size:`sm`,className:`w-36`,children:(0,J.jsx)(G,{})}),(0,J.jsxs)(K,{children:[(0,J.jsx)(P,{value:Z,children:Ge()}),(0,J.jsx)(P,{value:`active`,children:x()}),(0,J.jsx)(P,{value:`disabled`,children:i()})]})]})]}),(0,J.jsx)(st,{title:ge(),rows:d,addLabel:Oe(),onAdd:()=>{E(Q),O(null),w(!0)},emptyHint:Ee(),isExpanded:e=>k.has(e._id),renderExpanded:e=>(0,J.jsx)(lt,{account:e,keys:X.get(e._id)??[],onRevoke:ht,revoking:z}),rowActions:e=>[{label:ue(),onSelect:()=>ft(e)},{label:De(),onSelect:()=>void pt(e)},{label:k.has(e._id)?le():Ue(),onSelect:()=>$(e._id)},{label:oe(),variant:`destructive`,onSelect:()=>void mt(e)}],columns:[{header:``,className:`w-8`,cell:e=>(0,J.jsx)(j,{variant:`ghost`,size:`icon-sm`,"aria-label":k.has(e._id)?Te():xe(),onClick:()=>$(e._id),children:k.has(e._id)?(0,J.jsx)(Qe,{}):(0,J.jsx)(rt,{})})},{header:se(),sort:e=>e.name,cell:e=>(0,J.jsxs)(`div`,{className:`flex flex-col`,children:[(0,J.jsx)(`span`,{children:e.name}),e.description?(0,J.jsx)(`span`,{className:`text-muted-foreground text-xs`,children:e.description}):null]})},{header:Ce(),sort:e=>e.roleKey,cell:e=>(0,J.jsx)(L,{variant:`secondary`,children:e.roleKey})},{header:te(),sort:e=>+!!e.disabled,cell:e=>e.disabled?(0,J.jsx)(L,{variant:`destructive`,children:i()}):(0,J.jsx)(L,{variant:`outline`,children:x()})},{header:Ze(),cell:e=>(0,J.jsxs)(I,{value:V[e._id]??`never`,onValueChange:t=>U(n=>({...n,[e._id]:t})),children:[(0,J.jsx)(N,{size:`sm`,className:`w-32`,children:(0,J.jsx)(G,{})}),(0,J.jsx)(K,{children:Y.map(e=>(0,J.jsx)(P,{value:e.value,children:e.label()},e.value))})]})},{header:_e(),sort:e=>(X.get(e._id)??[]).filter(e=>!e.disabled).length,cell:e=>{let t=(X.get(e._id)??[]).filter(e=>!e.disabled).length;return(0,J.jsx)(`span`,{className:`oc-sa__keycount`,children:M===e._id?de():ce({count:t})})}}]}),(0,J.jsx)(it,{open:C,onOpenChange:e=>{w(e),e||O(null)},title:D?ae():fe(),description:D?he():Le(),canSubmit:!!(T.name&&T.roleKey),onSubmit:dt,submitLabel:D?pe():ee(),children:(0,J.jsxs)(`div`,{className:`oc-form`,children:[(0,J.jsxs)(`label`,{className:`oc-field`,children:[(0,J.jsx)(`span`,{className:`oc-field__label`,children:Re()}),(0,J.jsx)(H,{value:T.name,onChange:e=>E({...T,name:e.target.value})})]}),(0,J.jsxs)(`label`,{className:`oc-field`,children:[(0,J.jsx)(`span`,{className:`oc-field__label`,children:me()}),(0,J.jsxs)(I,{value:T.roleKey||void 0,onValueChange:e=>E({...T,roleKey:e}),children:[(0,J.jsx)(N,{className:`w-full`,children:(0,J.jsx)(G,{placeholder:re()})}),(0,J.jsx)(K,{children:(m??[]).map(e=>(0,J.jsxs)(P,{value:e.key,children:[e.name,` (`,e.key,`)`]},e._id))})]}),(()=>{let e=(m??[]).find(e=>e.key===T.roleKey),t=e?ct(e):null;return t?(0,J.jsx)(`span`,{className:`text-muted-foreground text-xs`,children:t}):null})()]}),(0,J.jsxs)(`label`,{className:`oc-field`,children:[(0,J.jsx)(`span`,{className:`oc-field__label`,children:ie()}),(0,J.jsx)(H,{value:T.description,onChange:e=>E({...T,description:e.target.value})})]})]})}),(0,J.jsx)(ut,{minted:nt,onClose:()=>W(null)})]})}function lt({account:e,keys:t,onRevoke:n,revoking:i}){return(0,J.jsxs)(`div`,{className:`oc-sa__keys`,children:[(0,J.jsxs)(`div`,{className:`oc-sa__keys-head`,children:[y(),` `,(0,J.jsx)(`span`,{className:`font-medium`,children:e.name})]}),t.length===0?(0,J.jsx)(`p`,{className:`oc-admin__hint`,children:D()}):(0,J.jsxs)(`table`,{className:`oc-sa__keytable`,children:[(0,J.jsx)(`thead`,{children:(0,J.jsxs)(`tr`,{children:[(0,J.jsx)(`th`,{children:w()}),(0,J.jsx)(`th`,{children:v()}),(0,J.jsx)(`th`,{children:S()}),(0,J.jsx)(`th`,{children:E()}),(0,J.jsx)(`th`,{children:C()}),(0,J.jsx)(`th`,{children:O()}),(0,J.jsx)(`th`,{})]})}),(0,J.jsx)(`tbody`,{children:t.map(t=>(0,J.jsxs)(`tr`,{children:[(0,J.jsx)(`td`,{children:(0,J.jsxs)(`code`,{className:`oc-sa__keyid`,children:[t.prefix,`…`,t.lastFour]})}),(0,J.jsx)(`td`,{children:(0,J.jsx)(L,{variant:`secondary`,children:e.roleKey})}),(0,J.jsx)(`td`,{children:z(t.createdAt)}),(0,J.jsx)(`td`,{className:dt(t.lastUsedAt)?`oc-sa__stale`:``,children:ft(t.lastUsedAt)}),(0,J.jsx)(`td`,{children:pt(t.expiresAt)}),(0,J.jsx)(`td`,{children:mt(t)}),(0,J.jsx)(`td`,{className:`text-right`,children:t.disabled?null:(0,J.jsx)(j,{variant:`destructive`,size:`sm`,disabled:i.has(t._id),onClick:()=>n(t),children:i.has(t._id)?b():r()})})]},t._id))})]})]})}function ut({minted:e,onClose:t}){let[n,r]=(0,q.useState)(!1);async function i(){if(e)try{await navigator.clipboard.writeText(e.plaintext),r(!0),window.setTimeout(()=>r(!1),2e3)}catch{}}return(0,J.jsx)(W,{open:e!==null,onOpenChange:e=>{e||(r(!1),t())},children:e?(0,J.jsxs)(R,{className:`max-w-lg`,showCloseButton:!1,onInteractOutside:e=>e.preventDefault(),onEscapeKeyDown:e=>e.preventDefault(),children:[(0,J.jsxs)(U,{children:[(0,J.jsx)(V,{children:p()}),(0,J.jsx)(B,{children:_({name:e.accountName})})]}),(0,J.jsx)(`div`,{className:`oc-sa__minted-warning`,children:h()}),(0,J.jsxs)(`div`,{className:`oc-sa__minted-box`,children:[(0,J.jsx)(`code`,{className:`oc-sa__minted-plain`,children:e.plaintext}),(0,J.jsxs)(j,{variant:`outline`,size:`sm`,onClick:()=>void i(),"aria-label":g(),children:[n?(0,J.jsx)(A,{}):(0,J.jsx)(F,{}),n?u():T()]})]}),(0,J.jsx)(nt,{children:(0,J.jsx)(j,{onClick:()=>{r(!1),t()},children:d()})})]}):null})}function dt(e){return e===null?!1:Date.now()-e>X}function ft(e){return e===null?l():z(e)}function pt(e){return e===null?`—`:M(e)}function mt(e){return e.disabled?(0,J.jsx)(L,{variant:`destructive`,children:Se()}):e.expiresAt!==null&&e.expiresAt<Date.now()?(0,J.jsx)(L,{variant:`outline`,children:a()}):(0,J.jsx)(L,{variant:`outline`,children:k()})}export{$ as ServiceAccountsTab};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$a as r,Aa as i,Ba as a,Ca as o,DM as s,Da as c,E as l,Ea as u,Fa as d,Ga as f,Ha as p,Ia as m,Ja as h,Ka as g,La as _,Ma as v,Na as y,OM as b,Oa as x,Pa as S,Qa as C,Ra as w,Sa as T,Ta as E,Ua as D,Va as O,Wa as k,Xa as A,Ya as j,Za as M,ao as N,eo as P,io as F,ja as I,ka as ee,no as L,qa as R,ro as z,to as B,wa as V,xa as H,za as U}from"./dist-HBBi9Y25.js";import{t as W}from"./button-b04wLuGq.js";import{B as G,et as K}from"./index-DBQ43N4_.js";import{t as q}from"./DataTableShell-KGrtOG5M.js";var J=t(e(),1),Y=n(),X={hung:()=>p(),wrong_result:()=>O(),error:()=>a(),other:()=>U()},Z=e=>(e&&X[e]?.())??e??`—`;function Q(e){let t=e.slice(e.lastIndexOf(`:`)+1)||e;return t.length>12?`${t.slice(0,12)}…`:t}function $({data:e}){let t=e.snapshot,n=s(l.subAgentReports.respondToReport),[r,a]=(0,J.useState)(e.thread),[o,f]=(0,J.useState)(``),[p,h]=(0,J.useState)(!1);async function g(){let t=o.trim();if(!(!t||p)){h(!0);try{await n({reportId:e._id,text:t}),a(e=>[...e,{authorRole:`admin`,text:t,at:Date.now()}]),f(``)}finally{h(!1)}}}return(0,Y.jsxs)(`div`,{className:`oc-fbadmin__detail`,children:[(0,Y.jsx)(`div`,{className:`oc-fbadmin__row`,children:(0,Y.jsxs)(`span`,{className:`oc-fbadmin__meta`,children:[Z(e.category),` · `,w({failed:t.failedCount,total:t.totalCount}),t.openclawModel?` · ${t.openclawModel}`:``,t.openclawRuntime?` (${t.openclawRuntime})`:``]})}),e.comment?(0,Y.jsxs)(`section`,{children:[(0,Y.jsx)(`h4`,{className:`oc-fbadmin__h`,children:_()}),(0,Y.jsx)(`p`,{className:`oc-fbadmin__comment`,children:e.comment})]}):null,(0,Y.jsxs)(`section`,{children:[(0,Y.jsx)(`h4`,{className:`oc-fbadmin__h`,children:m()}),r.length>0?(0,Y.jsx)(`div`,{className:`oc-fbadmin__thread`,children:r.map((e,t)=>(0,Y.jsxs)(`div`,{className:`oc-notif__msg oc-notif__msg--${e.authorRole}`,children:[(0,Y.jsx)(`span`,{className:`oc-notif__msg-who`,children:e.authorRole===`admin`?d():S()}),(0,Y.jsx)(`span`,{className:`oc-notif__msg-text`,children:e.text})]},t))}):(0,Y.jsx)(`p`,{className:`oc-fbadmin__meta`,children:y()}),(0,Y.jsx)(`textarea`,{className:`oc-feedback__textarea`,placeholder:v(),value:o,maxLength:2e3,rows:3,onChange:e=>f(e.target.value.slice(0,2e3))}),(0,Y.jsx)(`div`,{className:`oc-fbadmin__row`,style:{justifyContent:`flex-end`},children:(0,Y.jsx)(W,{size:`sm`,onClick:()=>void g(),disabled:!o.trim()||p,children:p?i():I()})})]}),(0,Y.jsxs)(`section`,{children:[(0,Y.jsxs)(`h4`,{className:`oc-fbadmin__h`,children:[ee({count:t.children.length}),t.childrenTruncated?` ${x()}`:``,t.textTruncated?` ${c()}`:``]}),(0,Y.jsx)(`div`,{className:`oc-fbadmin__ctx`,children:t.children.map((e,n)=>(0,Y.jsxs)(`div`,{className:`oc-fbadmin__ctx-turn`,children:[(0,Y.jsxs)(`span`,{className:`oc-fbadmin__ctx-role`,children:[(e.taskName?.trim()||Q(e.childSessionKey))+` · ${e.status}`,e.phase?` · ${e.phase}`:``,e.childSessionKey===t.flaggedChildSessionKey?` · ${u()}`:``]}),e.errorMessage?(0,Y.jsx)(`pre`,{className:`oc-msg__source-pre`,children:e.errorMessage}):null,e.resultText?(0,Y.jsx)(`pre`,{className:`oc-msg__source-pre`,children:e.resultText}):null]},n))})]}),t.parentText?(0,Y.jsxs)(`section`,{children:[(0,Y.jsx)(`h4`,{className:`oc-fbadmin__h`,children:E()}),(0,Y.jsx)(`pre`,{className:`oc-msg__source-pre`,children:t.parentText})]}):null,(0,Y.jsxs)(`section`,{children:[(0,Y.jsx)(`h4`,{className:`oc-fbadmin__h`,children:V()}),(0,Y.jsx)(`p`,{className:`oc-fbadmin__env`,children:[t.parentStatus?`status: ${t.parentStatus}`:null,t.parentErrorCode?`code: ${t.parentErrorCode}`:null,t.parentRunId?`run ${t.parentRunId.slice(0,12)}…`:null,e.correlationId?`corr ${e.correlationId.slice(0,16)}…`:null,t.openclawProvider].filter(Boolean).join(` · `)||`—`})]})]})}function te(){let e=b(l.subAgentReports.listForAdmin,{}),t=s(l.subAgentReports.readReport),n=s(l.subAgentReports.deleteReport),i=G(),[a,c]=(0,J.useState)(null),[u,d]=(0,J.useState)({});async function p(e){if(a===e._id){c(null);return}if(!u[e._id]){let n=await t({reportId:e._id});d(t=>({...t,[e._id]:n}))}c(e._id)}async function m(e){await i({title:o(),description:T(),confirmLabel:H(),destructive:!0})&&(await n({reportId:e._id}),a===e._id&&c(null))}return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(`p`,{className:`oc-admin__hint`,children:[z(),` `,(0,Y.jsx)(`strong`,{children:L()}),` `,B()]}),(0,Y.jsx)(q,{title:N(),rows:e,emptyHint:F(),isExpanded:e=>a===e._id&&!!u[e._id],renderExpanded:e=>u[e._id]?(0,Y.jsx)($,{data:u[e._id]}):null,columns:[{header:P(),cell:e=>K(e.at),sort:e=>e.at},{header:r(),cell:e=>Z(e.category),sort:e=>Z(e.category)},{header:C(),cell:e=>`${e.failedCount}/${e.totalCount}`,sort:e=>e.failedCount},{header:M(),cell:e=>(e.reporterEmail||e.reporterName||`—`)+(e.impersonated&&e.realOperatorEmail?` ${h({operator:e.realOperatorEmail})}`:``),sort:e=>e.reporterEmail||e.reporterName||null},{header:A(),cell:e=>e.hasComment?`✎`:`—`,sort:e=>+!!e.hasComment},{header:j(),cell:e=>e.answered?(0,Y.jsx)(`span`,{className:`oc-fbadmin__pill is-ok`,children:R()}):(0,Y.jsx)(`span`,{className:`oc-fbadmin__pill`,children:g()}),sort:e=>+!!e.answered}],rowActions:e=>[{label:a===e._id?k():f(),onSelect:()=>void p(e)},{label:D(),onSelect:()=>void m(e),variant:`destructive`}]})]})}export{te as SubAgentReportsTab};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$A as r,$k as i,AA as a,BA as o,CA as s,D as c,DA as l,DM as u,E as d,EA as f,FA as p,GA as m,HA as h,IA as g,JA as _,Jk as v,KA as y,LA as b,MA as x,NA as S,OA as ee,OM as C,PA as te,QA as ne,Qk as w,RA as re,SA as ie,TA as ae,TM as oe,UA as se,VA as ce,WA as le,XA as ue,Xk as de,YA as fe,Yk as pe,ZA as me,Zk as he,_A as ge,_M as _e,_a as ve,aA as ye,aj as be,bA as xe,ba as T,cA as Se,cj as Ce,dA as we,dj as Te,eA as Ee,ej as De,fA as Oe,fj as ke,gA as Ae,gM as je,gj as Me,hA as Ne,hM as Pe,hj as Fe,iA as Ie,ij as Le,jA as Re,kA as ze,lA as Be,lj as Ve,mA as E,mj as He,n as Ue,nA as We,nj as Ge,oA as Ke,oj as qe,pA as Je,pj as Ye,qA as Xe,rA as Ze,rj as Qe,sA as $e,sj as et,tA as tt,tj as nt,uA as rt,uj as it,vA as at,va as ot,wA as st,xA as ct,yA as lt,ya as D,zA as ut}from"./dist-HBBi9Y25.js";import{n as O}from"./dist-6oi7FQ0i.js";import{t as k}from"./x-DBKGK4o_.js";import{t as A}from"./button-b04wLuGq.js";import{C as j,Ht as M,S as N,Ut as dt,_t as ft,at as pt,b as P,ct as F,gt as mt,it as I,lt as L,nt as ht,ot as R,p as z,rt as gt,st as _t,w as B,x as V,xt as H}from"./index-DBQ43N4_.js";import{t as vt}from"./localePickerView-C2RmOS86.js";import{a as yt,i as bt,n as xt,o as St,r as Ct,t as wt}from"./card-DdBF2ct9.js";import{a as Tt,i as U,n as Et,o as W,r as G,t as Dt}from"./table-CtNwimV_.js";import{t as Ot}from"./TimeRangePicker-NSOkx3C0.js";import{t as kt}from"./FilterBar-BVVVO1_O.js";import{t as At}from"./AdvancedFilter-BQlL-4N9.js";var K=c(`upload`,[[`path`,{d:`M12 3v12`,key:`1x0j5s`}],[`path`,{d:`m17 8-5-5-5 5`,key:`7q97r8`}],[`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`,key:`ih7n3h`}]]),q=t(e(),1),jt=.1,Mt=[248,248,248],Nt=[24,24,24];function Pt(e,t,n){let r=t,i=n,a=-1,o=-1;for(let s=0;s<n;s++)for(let n=0;n<t;n++)e[(s*t+n)*4+3]>8&&(n<r&&(r=n),n>a&&(a=n),s<i&&(i=s),s>o&&(o=s));return a<0?null:{x:r,y:i,width:a-r+1,height:o-i+1}}function Ft(e,t,n){let r=t*n;if(r===0)return 0;let i=0;for(let t=3;t<e.length;t+=4)e[t]<=8&&i++;return i/r}function J(e,t,n){return Ft(e,t,n)>=jt}function It(e,t){for(let n=0;n<e.length;n+=4)e[n]=t[0],e[n+1]=t[1],e[n+2]=t[2]}function Lt(e){for(let t=0;t<e.length;t+=4)e[t]=255-e[t],e[t+1]=255-e[t+1],e[t+2]=255-e[t+2]}var Rt=12*1024*1024,zt=480,Bt=160,Vt=.92;async function Ht(e,t={}){if(!e.type.startsWith(`image/`))throw Error(ge());if(e.size>Rt)throw Error(Ae());let{source:n,width:r,height:i,cleanup:a}=await Ut(e);try{let a=e.type===`image/svg+xml`,o=Math.min(zt/r,Bt/i,a?1/0:1),s=Math.max(1,Math.round(r*o)),c=Math.max(1,Math.round(i*o)),l=document.createElement(`canvas`);l.width=s,l.height=c;let u=l.getContext(`2d`);if(!u)throw Error(E());u.imageSmoothingEnabled=!0,u.imageSmoothingQuality=`high`,u.drawImage(n,0,0,s,c);let d=Pt(u.getImageData(0,0,s,c).data,s,c)??{x:0,y:0,width:s,height:c},f=document.createElement(`canvas`);f.width=d.width,f.height=d.height;let p=f.getContext(`2d`);if(!p)throw Error(E());if(p.drawImage(l,d.x,d.y,d.width,d.height,0,0,d.width,d.height),t.variantFor){let e=p.getImageData(0,0,d.width,d.height);J(e.data,d.width,d.height)?It(e.data,t.variantFor===`dark`?Mt:Nt):Lt(e.data),p.putImageData(e,0,0)}let m=J(p.getImageData(0,0,d.width,d.height).data,d.width,d.height),h=await X(f,`image/webp`,Vt)??await X(f,`image/png`);if(!h)throw Error(Je());return{blob:h,hasAlpha:m}}finally{a()}}async function Ut(e){if(e.type===`image/svg+xml`)return Y(e);if(typeof createImageBitmap==`function`)try{let t=await createImageBitmap(e);return{source:t,width:t.width,height:t.height,cleanup:()=>t.close()}}catch{}return Y(e)}async function Y(e){let t=URL.createObjectURL(e);try{let e=new Image;return e.decoding=`async`,await new Promise((n,r)=>{e.onload=()=>n(),e.onerror=()=>r(Error(Ne())),e.src=t}),{source:e,width:e.naturalWidth||300,height:e.naturalHeight||150,cleanup:()=>URL.revokeObjectURL(t)}}catch(e){throw URL.revokeObjectURL(t),e}}function X(e,t,n){return new Promise(r=>e.toBlob(e=>r(e),t,n))}var Z=n();function Wt(e,t){let n=e.trim().replace(/[^A-Za-z0-9_.-]+/g,`-`).replace(/^-+|-+$/g,``)||`chart`,r=new Blob([JSON.stringify(t,null,2)],{type:`application/json`}),i=URL.createObjectURL(r),a=document.createElement(`a`);a.href=i,a.download=`${n}.chart.json`,document.body.appendChild(a),a.click(),a.remove(),URL.revokeObjectURL(i)}var Q=`__all__`,Gt={kind:`relative`,from:`now-24h`,to:`now`},Kt=[{value:`status`,label:`Statut`},{value:`latencyMs`,label:`Latence (ms)`},{value:`route`,label:`Route`},{value:`roleKey`,label:`Rôle`},{value:`correlationId`,label:`Corrélation`}];function $({title:e,description:t,children:n}){return(0,Z.jsxs)(`section`,{className:`oc-show__section`,children:[(0,Z.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,Z.jsx)(`h2`,{className:`oc-show__title`,children:e}),t?(0,Z.jsx)(`p`,{className:`oc-show__desc`,children:t}):null]}),(0,Z.jsx)(`div`,{className:`oc-show__demo`,children:n})]})}function qt(e){return e===`light`?_e():e===`dark`?je():Pe()}var Jt=[`primary`,`secondary`,`accent`,`muted`,`chart-1`,`chart-2`];function Yt({tokens:e,mode:t}){let n=e.colors[t];return(0,Z.jsx)(`div`,{className:`oc-chart-swatches`,"aria-hidden":!0,children:Jt.map(e=>{let t=n[e];return(0,Z.jsx)(`span`,{className:`oc-chart-swatch`,style:t?{background:t}:void 0},e)})})}function Xt({selected:e,title:t,subtitle:n,tokens:r,mode:i,onSelect:a,onExport:o}){return(0,Z.jsxs)(`div`,{className:`oc-chart-card-wrap`,children:[(0,Z.jsxs)(`button`,{type:`button`,className:Ue(`oc-chart-card`,e&&`oc-chart-card--selected`),"aria-pressed":e,onClick:a,children:[(0,Z.jsxs)(`div`,{className:`oc-chart-card__head`,children:[(0,Z.jsx)(`span`,{className:`oc-chart-card__title`,children:t}),e?(0,Z.jsx)(O,{className:`size-4 text-primary`,"aria-hidden":!0}):null]}),r?(0,Z.jsx)(Yt,{tokens:r,mode:i}):(0,Z.jsx)(`div`,{className:`oc-chart-swatches oc-chart-swatches--native`,"aria-hidden":!0}),(0,Z.jsx)(`div`,{className:`oc-chart-card__meta`,children:(0,Z.jsx)(`span`,{className:`oc-chart-card__subtitle`,children:n})})]}),o?(0,Z.jsx)(A,{type:`button`,variant:`ghost`,size:`icon`,className:`oc-chart-card__export`,onClick:o,"aria-label":T(),title:T(),children:(0,Z.jsx)(dt,{className:`size-4`})}):null]})}function Zt({selectedKey:e,resolvedMode:t}){let n=C(d.charts.listMyCharts),r=u(d.charts.setMyChart);async function i(e){try{await r({name:e})}catch{}}return(0,Z.jsxs)(`section`,{className:`oc-show__section`,children:[(0,Z.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,Z.jsx)(`h2`,{className:`oc-show__title`,children:Ce()}),(0,Z.jsx)(`p`,{className:`oc-show__desc`,children:et()})]}),(0,Z.jsxs)(`div`,{className:`oc-chart-grid`,children:[(0,Z.jsx)(Xt,{selected:e===null,title:qe(),subtitle:be(),tokens:null,mode:t,onSelect:()=>void i(null)}),(n??[]).map(n=>{let r=n.via===`common`?Le():n.via===`owner`?Qe():Ge({group:n.via.group});return(0,Z.jsx)(Xt,{selected:e===n.key,title:n.name,subtitle:r,tokens:n.tokens,mode:t,onSelect:()=>void i(n.key),onExport:()=>Wt(n.name,n.tokens)},n.key)})]}),n!==void 0&&n.length===0?(0,Z.jsx)(`p`,{className:`oc-show__desc`,children:nt()}):null]})}function Qt(){let e=u(d.charts.importChart),[t,n]=(0,q.useState)(``),[r,i]=(0,q.useState)(``),[a,s]=(0,q.useState)(null),[c,l]=(0,q.useState)(!1),[f,m]=(0,q.useState)(!1);async function h(e){let t=e.target.files?.[0];if(e.target.value=``,t){s(null),l(!1);try{i(await t.text())}catch{s(S())}}}async function _(){if(s(null),l(!1),t.trim()===``){s(Re());return}let a;try{a=JSON.parse(r)}catch{s(S());return}m(!0);try{await e({name:t.trim(),tokens:a}),l(!0),n(``),i(``)}catch(e){s(e instanceof Error?e.message:String(e))}finally{m(!1)}}return(0,Z.jsxs)(`section`,{className:`oc-show__section`,children:[(0,Z.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,Z.jsx)(`h2`,{className:`oc-show__title`,children:ce()}),(0,Z.jsx)(`p`,{className:`oc-show__desc`,children:o()})]}),(0,Z.jsxs)(`div`,{className:`oc-chart-import`,children:[(0,Z.jsxs)(`label`,{className:`oc-chart-import__field`,children:[(0,Z.jsx)(`span`,{className:`oc-chart-import__label`,children:ut()}),(0,Z.jsx)(L,{value:t,onChange:e=>n(e.target.value),placeholder:re(),maxLength:60})]}),(0,Z.jsxs)(`label`,{className:`oc-chart-import__field`,children:[(0,Z.jsx)(`span`,{className:`oc-chart-import__label`,children:b()}),(0,Z.jsx)(`textarea`,{className:`oc-chart-import__textarea`,value:r,onChange:e=>i(e.target.value),placeholder:g(),rows:8,spellCheck:!1})]}),(0,Z.jsxs)(`div`,{className:`oc-show__row`,children:[(0,Z.jsx)(A,{variant:`outline`,size:`sm`,asChild:!0,children:(0,Z.jsxs)(`label`,{className:`oc-chart-import__file`,children:[(0,Z.jsx)(K,{className:`size-4`}),p(),(0,Z.jsx)(`input`,{type:`file`,accept:`application/json,.json`,className:`oc-chart-import__file-input`,onChange:e=>void h(e)})]})}),(0,Z.jsx)(A,{size:`sm`,disabled:f,onClick:()=>void _(),children:te()})]}),a?(0,Z.jsx)(`p`,{className:`oc-chart-import__error`,children:a}):null,c?(0,Z.jsx)(`p`,{className:`oc-chart-import__ok`,children:x()}):null]})]})}function $t({chart:e}){let t=oe(d.charts.setChartLogo),n=u(d.charts.removeChartLogo),[r,i]=(0,q.useState)(!1),[a,o]=(0,q.useState)(null),c=t=>t===`light`?e.logoLightUrl:e.logoDarkUrl;async function l(n,r,a){if(e.chartId!==void 0){o(null),i(!0);try{let{blob:i,hasAlpha:o}=await Ht(r,a?{variantFor:a}:{}),s=await i.arrayBuffer();await t({chartId:e.chartId,bytes:s,mode:n,hasAlpha:o})}catch(e){o(e instanceof Error?e.message:String(e))}finally{i(!1)}}}async function f(e,t){let n=t.target.files?.[0];t.target.value=``,n&&await l(e,n)}async function p(t){if(e.chartId!==void 0){o(null),i(!0);try{await n({chartId:e.chartId,mode:t})}catch(e){o(e instanceof Error?e.message:String(e))}finally{i(!1)}}}async function m(e){let t=c(e===`light`?`dark`:`light`);if(t){o(null),i(!0);try{await l(e,await(await fetch(t)).blob(),e)}catch(e){o(e instanceof Error?e.message:String(e))}finally{i(!1)}}}function h({mode:e}){let t=c(e),n=c(e===`light`?`dark`:`light`);return(0,Z.jsxs)(`div`,{className:`oc-chart-mine__logo-slot`,children:[(0,Z.jsx)(`span`,{className:`oc-chart-mine__logo-mode`,children:e===`light`?st():s()}),(0,Z.jsx)(`span`,{className:`oc-chart-mine__logo-preview`,"data-mode":e,"data-empty":t?void 0:`1`,children:t?(0,Z.jsx)(`img`,{src:t,alt:``}):null}),(0,Z.jsx)(A,{variant:`outline`,size:`sm`,asChild:!0,children:(0,Z.jsxs)(`label`,{className:`oc-chart-import__file`,children:[(0,Z.jsx)(K,{className:`size-4`}),t?ct():ie(),(0,Z.jsx)(`input`,{type:`file`,accept:`image/*`,className:`oc-chart-import__file-input`,onChange:t=>void f(e,t)})]})}),!t&&n?(0,Z.jsx)(A,{variant:`ghost`,size:`sm`,disabled:r,onClick:()=>void m(e),children:lt()}):null,t?(0,Z.jsx)(A,{variant:`ghost`,size:`sm`,disabled:r,onClick:()=>void p(e),children:xe()}):null]})}return(0,Z.jsxs)(`div`,{className:`oc-chart-mine__logo`,children:[(0,Z.jsx)(`span`,{className:`oc-chart-mine__groups-label`,children:ae()}),(0,Z.jsxs)(`div`,{className:`oc-chart-mine__logo-slots`,children:[(0,Z.jsx)(h,{mode:`light`}),(0,Z.jsx)(h,{mode:`dark`})]}),r?(0,Z.jsx)(`span`,{className:`oc-show__desc`,children:at()}):null,a?(0,Z.jsx)(`p`,{className:`oc-chart-import__error`,children:a}):null]})}function en({chart:e}){let t=C(d.me.getMe,{host:H}),n=u(d.charts.addChartDomain),r=u(d.charts.removeChartDomain),[i,a]=(0,q.useState)(``),[o,s]=(0,q.useState)(null),[c,l]=(0,q.useState)(!1);if(t?.role!==`admin`)return null;let f=e.domains??[];async function p(){let t=i.trim();if(t!==``){s(null),l(!0);try{await n({chartKey:e.key,domain:t}),a(``)}catch(e){s(e instanceof Error?e.message:String(e))}finally{l(!1)}}}async function m(t){s(null);try{await r({chartKey:e.key,domain:t})}catch{}}return(0,Z.jsxs)(`div`,{className:`oc-chart-mine__domains`,children:[(0,Z.jsx)(`span`,{className:`oc-chart-mine__groups-label`,children:Oe()}),(0,Z.jsxs)(`div`,{className:`oc-chart-mine__domains-body`,children:[(0,Z.jsx)(`div`,{className:`oc-chart-avail__groups`,children:f.length===0?(0,Z.jsx)(`span`,{className:`oc-show__desc`,children:Se()}):f.map(e=>(0,Z.jsxs)(F,{variant:`secondary`,className:`oc-chart-avail__chip`,children:[e,(0,Z.jsx)(`button`,{type:`button`,className:`oc-chart-avail__chip-x`,"aria-label":$e({domain:e}),onClick:()=>void m(e),children:(0,Z.jsx)(k,{className:`size-3`})})]},e))}),(0,Z.jsxs)(`div`,{className:`oc-show__row`,children:[(0,Z.jsx)(L,{value:i,onChange:e=>a(e.target.value),placeholder:rt(),className:`oc-chart-mine__domains-input`,onKeyDown:e=>{e.key===`Enter`&&p()}}),(0,Z.jsx)(A,{variant:`outline`,size:`sm`,disabled:c,onClick:()=>void p(),children:Be()})]}),(0,Z.jsx)(`span`,{className:`oc-show__desc`,children:we()}),o?(0,Z.jsx)(`p`,{className:`oc-chart-import__error`,children:o}):null]})]})}function tn(e){let t={...e};return delete t.bpm,JSON.stringify(t,null,2)}function nn({chart:e}){let t=u(d.charts.updateChart),n=u(d.charts.deleteChart),[r,i]=(0,q.useState)(!1),[a,o]=(0,q.useState)(e.name),[s,c]=(0,q.useState)(()=>tn(e.tokens)),[p,m]=(0,q.useState)(e.tokens.bpm??0),[h,g]=(0,q.useState)(null),[_,v]=(0,q.useState)(!1);function y(){o(e.name),c(tn(e.tokens)),m(e.tokens.bpm??0),g(null),i(!0)}async function b(){if(e.chartId===void 0)return;g(null);let n;try{n=JSON.parse(s)}catch{g(S());return}if(n&&typeof n==`object`&&!Array.isArray(n)){let e=n;p>0?e.bpm=p:delete e.bpm}v(!0);try{await t({chartId:e.chartId,name:a.trim(),tokens:n}),i(!1)}catch(e){g(e instanceof Error?e.message:String(e))}finally{v(!1)}}async function x(){if(e.chartId!==void 0&&window.confirm(We()))try{await n({chartId:e.chartId})}catch{}}return(0,Z.jsxs)(`div`,{className:`oc-chart-mine__row`,children:[(0,Z.jsxs)(`div`,{className:`oc-chart-mine__head`,children:[(0,Z.jsx)(`span`,{className:`oc-chart-mine__name`,children:e.name}),(0,Z.jsx)(`div`,{className:`oc-show__row`,children:r?null:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(A,{variant:`outline`,size:`sm`,onClick:y,children:l()}),(0,Z.jsx)(A,{variant:`ghost`,size:`sm`,onClick:()=>void x(),children:f()})]})})]}),r?(0,Z.jsxs)(`div`,{className:`oc-chart-mine__editor`,children:[(0,Z.jsxs)(`label`,{className:`oc-chart-import__field`,children:[(0,Z.jsx)(`span`,{className:`oc-chart-import__label`,children:Ie()}),(0,Z.jsx)(L,{value:a,onChange:e=>o(e.target.value),maxLength:60})]}),(0,Z.jsxs)(`div`,{className:`oc-chart-import__field`,children:[(0,Z.jsx)(`span`,{className:`oc-chart-import__label`,children:D()}),(0,Z.jsxs)(`div`,{className:`oc-chart-bpm`,children:[(0,Z.jsx)(`input`,{type:`range`,className:`oc-chart-bpm__slider`,min:0,max:90,step:5,value:p,onChange:e=>m(Number(e.target.value)),"aria-label":D()}),(0,Z.jsx)(`span`,{className:`oc-chart-bpm__value`,children:p===0?ot():`${p} BPM`})]}),(0,Z.jsx)(`span`,{className:`oc-show__desc`,children:ve()})]}),(0,Z.jsxs)(`label`,{className:`oc-chart-import__field`,children:[(0,Z.jsx)(`span`,{className:`oc-chart-import__label`,children:Ze()}),(0,Z.jsx)(`textarea`,{className:`oc-chart-import__textarea`,value:s,onChange:e=>c(e.target.value),rows:10,spellCheck:!1})]}),h?(0,Z.jsx)(`p`,{className:`oc-chart-import__error`,children:h}):null,(0,Z.jsxs)(`div`,{className:`oc-show__row`,children:[(0,Z.jsx)(A,{size:`sm`,disabled:_,onClick:()=>void b(),children:Ke()}),(0,Z.jsx)(A,{variant:`ghost`,size:`sm`,onClick:()=>i(!1),children:ye()})]})]}):null,(0,Z.jsx)($t,{chart:e}),(0,Z.jsx)(en,{chart:e})]})}function rn(){let e=C(d.charts.listMyCharts),t=(e??[]).filter(e=>e.via===`owner`);return(0,Z.jsxs)(`section`,{className:`oc-show__section`,children:[(0,Z.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,Z.jsx)(`h2`,{className:`oc-show__title`,children:a()}),(0,Z.jsx)(`p`,{className:`oc-show__desc`,children:ze()})]}),e!==void 0&&t.length===0?(0,Z.jsx)(`p`,{className:`oc-show__desc`,children:ee()}):(0,Z.jsx)(`div`,{className:`oc-chart-mine-list`,children:t.map(e=>(0,Z.jsx)(nn,{chart:e},e.key))})]})}function an({chart:e,groups:t}){let n=u(d.charts.addChartToGroupPool),r=u(d.charts.removeChartFromGroupPool),i=e.restrictedToGroups,a=e.poolGroups,o=new Set((a??[]).map(e=>e.groupId)),s=t.filter(e=>!o.has(e._id));async function c(t){try{await n({groupId:t,chartKey:e.key})}catch{}}async function l(t){try{await r({groupId:t,chartKey:e.key})}catch{}}return(0,Z.jsxs)(`div`,{className:`oc-chart-avail`,children:[(0,Z.jsxs)(`div`,{className:`oc-chart-avail__head`,children:[(0,Z.jsx)(`span`,{className:`oc-chart-avail__name`,children:e.name}),(0,Z.jsx)(F,{variant:i?`secondary`:`outline`,className:`oc-chart-avail__state`,children:i?Xe():e.kind===`custom`&&e.scope===`personal`?w():_()}),e.isGlobalDefault?(0,Z.jsx)(F,{variant:`default`,children:y()}):null]}),(0,Z.jsxs)(`div`,{className:`oc-chart-avail__groups`,children:[(0,Z.jsx)(`span`,{className:`oc-chart-mine__groups-label`,children:le()}),(a??[]).map(e=>(0,Z.jsxs)(F,{variant:`secondary`,className:`oc-chart-avail__chip`,children:[e.name,(0,Z.jsx)(`button`,{type:`button`,className:`oc-chart-avail__chip-x`,"aria-label":h({group:e.name}),onClick:()=>void l(e.groupId),children:(0,Z.jsx)(k,{className:`size-3`})})]},e.groupId)),s.length>0?(0,Z.jsxs)(P,{value:``,onValueChange:e=>void c(e),children:[(0,Z.jsx)(j,{size:`sm`,className:`w-56`,children:(0,Z.jsx)(B,{placeholder:se()})}),(0,Z.jsx)(V,{children:s.map(e=>(0,Z.jsx)(N,{value:e._id,children:e.name},e._id))})]}):t.length===0?(0,Z.jsx)(`span`,{className:`oc-show__desc`,children:m()}):null]})]})}function on({chart:e}){let t=u(d.charts.promoteChartToCommon),n=u(d.charts.deleteChart);async function r(){if(e.chartId!==void 0)try{await t({chartId:e.chartId})}catch{}}async function a(){if(e.chartId!==void 0&&window.confirm(We()))try{await n({chartId:e.chartId})}catch{}}return(0,Z.jsxs)(`div`,{className:`oc-chart-avail`,children:[(0,Z.jsxs)(`div`,{className:`oc-chart-avail__head`,children:[(0,Z.jsx)(`span`,{className:`oc-chart-avail__name`,children:e.name}),(0,Z.jsx)(F,{variant:e.scope===`common`?`outline`:`secondary`,children:e.scope===`common`?he():w()}),e.ownerLabel?(0,Z.jsx)(`span`,{className:`oc-show__desc`,children:i({owner:e.ownerLabel})}):null]}),(0,Z.jsxs)(`div`,{className:`oc-show__row`,children:[e.scope===`personal`?(0,Z.jsx)(A,{variant:`outline`,size:`sm`,onClick:()=>void r(),children:de()}):null,(0,Z.jsx)(A,{variant:`ghost`,size:`sm`,onClick:()=>void a(),children:pe()})]})]})}function sn({defaultThemeMode:e,defaultLocale:t,defaultChartKey:n}){let i=u(d.admin.setDefaultThemeMode),a=u(d.admin.setDefaultLocale),o=u(d.charts.setDefaultChart),s=C(d.charts.listChartsAdmin),c=C(d.groups.listGroups,{}),l=e??`system`,f=t??`fr`;return(0,Z.jsxs)(`div`,{className:`oc-appearance-admin`,children:[(0,Z.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,Z.jsx)(`h2`,{className:`oc-show__title`,children:it()}),(0,Z.jsx)(`p`,{className:`oc-show__desc`,children:Ve()})]}),(0,Z.jsxs)(`section`,{className:`oc-show__section`,children:[(0,Z.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,Z.jsx)(`h3`,{className:`oc-show__title`,children:De()}),(0,Z.jsx)(`p`,{className:`oc-show__desc`,children:r()})]}),(0,Z.jsxs)(`div`,{className:`oc-show__row`,children:[(0,Z.jsx)(A,{variant:n===null?`default`:`outline`,size:`sm`,onClick:()=>void o({name:null}),children:qe()}),ft.map(e=>(0,Z.jsx)(A,{variant:n===e.key?`default`:`outline`,size:`sm`,onClick:()=>void o({name:e.key}),children:e.name},e.key)),(s??[]).filter(e=>e.kind===`custom`&&e.scope===`common`).map(e=>(0,Z.jsx)(A,{variant:n===e.key?`default`:`outline`,size:`sm`,onClick:()=>void o({name:e.key}),children:e.name},e.key))]})]}),(0,Z.jsxs)(`section`,{className:`oc-show__section`,children:[(0,Z.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,Z.jsx)(`h3`,{className:`oc-show__title`,children:ne()}),(0,Z.jsx)(`p`,{className:`oc-show__desc`,children:me()})]}),(0,Z.jsx)(`div`,{className:`oc-chart-avail-list`,children:(s??[]).filter(e=>!(e.kind===`custom`&&e.scope===`common`)).map(e=>(0,Z.jsx)(an,{chart:e,groups:c??[]},e.key))})]}),(0,Z.jsxs)(`section`,{className:`oc-show__section`,children:[(0,Z.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,Z.jsx)(`h3`,{className:`oc-show__title`,children:ue()}),(0,Z.jsx)(`p`,{className:`oc-show__desc`,children:fe()})]}),(0,Z.jsx)(`div`,{className:`oc-chart-avail-list`,children:(s??[]).filter(e=>e.kind===`builtin`||e.scope===`common`).map(e=>(0,Z.jsxs)(`div`,{className:`oc-chart-avail`,children:[(0,Z.jsx)(`div`,{className:`oc-chart-avail__head`,children:(0,Z.jsx)(`span`,{className:`oc-chart-avail__name`,children:e.name})}),(0,Z.jsx)(en,{chart:e})]},e.key))})]}),(0,Z.jsxs)(`section`,{className:`oc-show__section`,children:[(0,Z.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,Z.jsx)(`h3`,{className:`oc-show__title`,children:tt()}),(0,Z.jsx)(`p`,{className:`oc-show__desc`,children:Ee()})]}),(()=>{let e=(s??[]).filter(e=>e.kind===`custom`);return e.length===0?(0,Z.jsx)(`p`,{className:`oc-show__desc`,children:v()}):(0,Z.jsx)(`div`,{className:`oc-chart-avail-list`,children:e.map(e=>(0,Z.jsx)(on,{chart:e},e.key))})})()]}),(0,Z.jsxs)(`section`,{className:`oc-show__section`,children:[(0,Z.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,Z.jsx)(`h3`,{className:`oc-show__title`,children:Me()}),(0,Z.jsx)(`p`,{className:`oc-show__desc`,children:Fe()})]}),(0,Z.jsx)(`div`,{className:`oc-show__row`,children:[`light`,`dark`,`system`].map(e=>(0,Z.jsx)(A,{variant:l===e?`default`:`outline`,size:`sm`,onClick:()=>void i({mode:e}),children:qt(e)},e))})]}),(0,Z.jsxs)(`section`,{className:`oc-show__section`,children:[(0,Z.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,Z.jsx)(`h3`,{className:`oc-show__title`,children:He()}),(0,Z.jsx)(`p`,{className:`oc-show__desc`,children:Ye()})]}),(0,Z.jsx)(`div`,{className:`oc-show__row`,children:vt().map(e=>(0,Z.jsx)(A,{variant:f===e.value?`default`:`outline`,size:`sm`,onClick:()=>void a({locale:e.value}),children:e.label},e.value))}),(0,Z.jsx)(`p`,{className:`oc-show__desc`,children:ke()})]})]})}function cn(){let e=C(d.me.getMe,{host:H}),t=mt(e?.resolvedThemeMode);return(0,Z.jsxs)(`div`,{className:`oc-appearance`,children:[(0,Z.jsx)(Zt,{selectedKey:e?.chartKey??null,resolvedMode:t}),(0,Z.jsx)(Qt,{}),(0,Z.jsx)(rn,{}),e?.role===`admin`?(0,Z.jsx)(sn,{defaultThemeMode:e.defaultThemeMode,defaultLocale:e.defaultLocale,defaultChartKey:e.defaultChartKey}):null]})}function ln(){let[e,t]=(0,q.useState)(!0),[n,r]=(0,q.useState)(`per-user`),[i,a]=(0,q.useState)(``),[o,s]=(0,q.useState)(Q),[c,l]=(0,q.useState)(Q),[u,d]=(0,q.useState)(Gt),f=i!==``||o!==Q||c!==Q;function p(){a(``),s(Q),l(Q),d(Gt)}return(0,Z.jsxs)(`div`,{className:`oc-show`,children:[(0,Z.jsx)(cn,{}),(0,Z.jsxs)(`details`,{className:`oc-show__ref`,children:[(0,Z.jsx)(`summary`,{className:`oc-show__title`,children:Te()}),(0,Z.jsxs)($,{title:`Buttons`,description:`Variants`,children:[(0,Z.jsxs)(`div`,{className:`oc-show__row`,children:[(0,Z.jsx)(A,{children:`Default`}),(0,Z.jsx)(A,{variant:`secondary`,children:`Secondary`}),(0,Z.jsx)(A,{variant:`outline`,children:`Outline`}),(0,Z.jsx)(A,{variant:`ghost`,children:`Ghost`}),(0,Z.jsx)(A,{variant:`destructive`,children:`Destructive`}),(0,Z.jsx)(A,{variant:`link`,children:`Link`})]}),(0,Z.jsxs)(`div`,{className:`oc-show__row`,children:[(0,Z.jsx)(A,{size:`sm`,children:`Small`}),(0,Z.jsx)(A,{children:`Default`}),(0,Z.jsx)(A,{size:`lg`,children:`Large`}),(0,Z.jsx)(A,{size:`icon`,"aria-label":`more`,children:(0,Z.jsx)(M,{})}),(0,Z.jsx)(A,{disabled:!0,children:`Disabled`})]})]}),(0,Z.jsx)($,{title:`Badges`,children:(0,Z.jsxs)(`div`,{className:`oc-show__row`,children:[(0,Z.jsx)(F,{children:`Default`}),(0,Z.jsx)(F,{variant:`secondary`,children:`Secondary`}),(0,Z.jsx)(F,{variant:`outline`,children:`Outline`}),(0,Z.jsx)(F,{variant:`destructive`,children:`Destructive`})]})}),(0,Z.jsx)($,{title:`Inputs & selection`,children:(0,Z.jsxs)(`div`,{className:`oc-show__row oc-show__row--col`,children:[(0,Z.jsx)(L,{placeholder:`Text input…`}),(0,Z.jsxs)(`div`,{className:`oc-show__row`,children:[(0,Z.jsxs)(P,{value:n,onValueChange:r,children:[(0,Z.jsx)(j,{className:`w-56`,children:(0,Z.jsx)(B,{placeholder:`Select…`})}),(0,Z.jsxs)(V,{children:[(0,Z.jsx)(N,{value:`per-user`,children:`per-user (chacun son agent)`}),(0,Z.jsx)(N,{value:`shared`,children:`shared (agent commun)`})]})]}),(0,Z.jsxs)(`label`,{className:`oc-show__check`,children:[(0,Z.jsx)(z,{checked:e,onCheckedChange:e=>t(!!e)}),`Checkbox`]})]})]})}),(0,Z.jsx)($,{title:`Filtres & plage temporelle`,description:`Barre réutilisable (recherche debouncée + selects rapides à largeur auto + plage façon Grafana) et constructeur de filtre avancé. Câblée dans Users, Groups, Comptes de service, Traces, Anomalies, Audit et KPI.`,children:(0,Z.jsxs)(`div`,{className:`oc-show__row oc-show__row--col`,children:[(0,Z.jsxs)(kt,{q:i,onQChange:a,searchPlaceholder:`Rechercher (kind, principal, rôle, route…)`,timeRange:u,onTimeRangeChange:d,onReset:p,canReset:f,children:[(0,Z.jsxs)(P,{value:o,onValueChange:s,children:[(0,Z.jsx)(j,{size:`sm`,children:(0,Z.jsx)(B,{})}),(0,Z.jsxs)(V,{children:[(0,Z.jsx)(N,{value:Q,children:`Toutes directions`}),(0,Z.jsx)(N,{value:`inbound`,children:`inbound`}),(0,Z.jsx)(N,{value:`outbound`,children:`outbound`}),(0,Z.jsx)(N,{value:`internal`,children:`internal`})]})]}),(0,Z.jsxs)(P,{value:c,onValueChange:l,children:[(0,Z.jsx)(j,{size:`sm`,children:(0,Z.jsx)(B,{})}),(0,Z.jsxs)(V,{children:[(0,Z.jsx)(N,{value:Q,children:`Toutes sévérités`}),(0,Z.jsx)(N,{value:`info`,children:`info`}),(0,Z.jsx)(N,{value:`warn`,children:`warn`}),(0,Z.jsx)(N,{value:`critical`,children:`critical`})]})]})]}),(0,Z.jsx)(At,{fields:Kt,onChange:()=>{}}),(0,Z.jsxs)(`div`,{className:`oc-show__row`,children:[(0,Z.jsx)(`span`,{className:`oc-show__desc`,children:`Sélecteur de plage seul :`}),(0,Z.jsx)(Ot,{value:u,onChange:d})]})]})}),(0,Z.jsx)($,{title:`Dropdown menu`,description:`Row actions / kebab`,children:(0,Z.jsxs)(ht,{children:[(0,Z.jsx)(_t,{asChild:!0,children:(0,Z.jsx)(A,{variant:`outline`,size:`icon`,"aria-label":`Open menu`,children:(0,Z.jsx)(M,{})})}),(0,Z.jsxs)(gt,{align:`start`,children:[(0,Z.jsx)(pt,{children:`Actions`}),(0,Z.jsx)(R,{}),(0,Z.jsx)(I,{children:`Edit`}),(0,Z.jsx)(I,{children:`Duplicate`}),(0,Z.jsx)(R,{}),(0,Z.jsx)(I,{variant:`destructive`,children:`Delete`})]})]})}),(0,Z.jsx)($,{title:`Card`,children:(0,Z.jsxs)(wt,{className:`w-80`,children:[(0,Z.jsxs)(yt,{children:[(0,Z.jsx)(St,{children:`Instance`}),(0,Z.jsx)(Ct,{children:`Non-secret metadata only.`})]}),(0,Z.jsx)(xt,{className:`text-sm text-muted-foreground`,children:`ws://gateway.example.org:18789`}),(0,Z.jsxs)(bt,{className:`gap-2`,children:[(0,Z.jsx)(A,{size:`sm`,children:`Save`}),(0,Z.jsx)(A,{size:`sm`,variant:`ghost`,children:`Cancel`})]})]})}),(0,Z.jsx)($,{title:`Table`,children:(0,Z.jsxs)(Dt,{children:[(0,Z.jsx)(Tt,{children:(0,Z.jsxs)(W,{children:[(0,Z.jsx)(U,{className:`w-8`,children:(0,Z.jsx)(z,{"aria-label":`select all`})}),(0,Z.jsx)(U,{children:`Name`}),(0,Z.jsx)(U,{children:`Mode`}),(0,Z.jsx)(U,{className:`text-right`,children:`Status`}),(0,Z.jsx)(U,{className:`w-8`})]})}),(0,Z.jsx)(Et,{children:[{n:`admins`,m:`per-user`,s:`active`},{n:`family`,m:`shared`,s:`active`}].map(e=>(0,Z.jsxs)(W,{children:[(0,Z.jsx)(G,{children:(0,Z.jsx)(z,{"aria-label":`select ${e.n}`})}),(0,Z.jsx)(G,{className:`font-medium`,children:e.n}),(0,Z.jsx)(G,{children:(0,Z.jsx)(F,{variant:`secondary`,children:e.m})}),(0,Z.jsx)(G,{className:`text-right`,children:(0,Z.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-muted-foreground`,children:[(0,Z.jsx)(O,{className:`size-3.5`}),` `,e.s]})}),(0,Z.jsx)(G,{children:(0,Z.jsx)(A,{variant:`ghost`,size:`icon`,"aria-label":`row actions`,children:(0,Z.jsx)(M,{})})})]},e.n))})]})}),(0,Z.jsx)($,{title:`App fragments`,description:`Chat-specific components`,children:(0,Z.jsxs)(`div`,{className:`oc-show__row oc-show__row--col`,children:[(0,Z.jsx)(`div`,{className:`oc-msg oc-msg--assistant`,children:(0,Z.jsx)(`div`,{className:`oc-msg__body`,children:`Assistant message bubble.`})}),(0,Z.jsx)(`div`,{className:`oc-tool oc-tool--completed`,children:(0,Z.jsxs)(`div`,{className:`oc-tool__header`,children:[(0,Z.jsx)(`span`,{className:`oc-tool__icon`,children:`✓`}),(0,Z.jsx)(`span`,{className:`oc-tool__name`,children:`write-file`}),(0,Z.jsx)(`span`,{className:`oc-tool__phase`,children:`completed`})]})}),(0,Z.jsxs)(`div`,{className:`oc-run-status oc-run-status--streaming`,children:[(0,Z.jsx)(`span`,{className:`oc-run-status__dot`}),(0,Z.jsx)(`span`,{className:`oc-run-status__label`,children:`Running`})]})]})})]})]})}export{ln as ThemeShowroom};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$m as r,
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$m as r,Qm as i,_r as a,ah as o,ch as s,eh as c,gr as l,hr as u,ih as d,lh as f,mr as p,nh as m,oh as h,pr as g,rh as _,sh as v,th as y,uh as b,vr as x,yr as S}from"./dist-HBBi9Y25.js";import{t as C}from"./button-b04wLuGq.js";import{Ct as w,Gt as T,Pt as E,St as D,Tt as O,et as k,lt as A,wt as j}from"./index-DBQ43N4_.js";var M=t(e(),1),N={s:1e3,m:6e4,h:36e5,d:864e5,w:6048e5};function P(e,t){let n=e.trim();if(n===`now`)return t;let r=/^now-(\d+)([smhdw])$/.exec(n);if(r===null)return null;let i=Number(r[1]),a=N[r[2]];return!Number.isFinite(i)||a===void 0?null:t-i*a}function F(e,t=Date.now()){return e.kind===`absolute`?{from:e.from,to:e.to}:{from:P(e.from,t)??t-N.h,to:P(e.to,t)??t}}var I=[{label:b(),from:`now-5m`},{label:f(),from:`now-15m`},{label:s(),from:`now-30m`},{label:v(),from:`now-1h`},{label:h(),from:`now-3h`},{label:o(),from:`now-6h`},{label:d(),from:`now-12h`},{label:_(),from:`now-24h`},{label:m(),from:`now-2d`},{label:y(),from:`now-7d`},{label:c(),from:`now-30d`},{label:r(),from:`now-90d`},{label:i(),from:`now-520w`}];function L(e){return k(e,{day:`2-digit`,month:`2-digit`,hour:`2-digit`,minute:`2-digit`})}function R(e){if(e.kind===`relative`){let t=I.find(t=>t.from===e.from&&e.to===`now`);return t?t.label:`${e.from} → ${e.to}`}return`${L(e.from)} → ${L(e.to)}`}function z(e){let t=new Date(e),n=e=>String(e).padStart(2,`0`);return`${t.getFullYear()}-${n(t.getMonth()+1)}-${n(t.getDate())}T${n(t.getHours())}:${n(t.getMinutes())}`}function B(e){if(e===``)return null;let t=new Date(e).getTime();return Number.isNaN(t)?null:t}function V(e){let t=e.trim();return t===`true`?!0:t===`false`?!1:t!==``&&Number.isFinite(Number(t))?Number(t):e}var H=n();function U(e){let[t,n]=(0,M.useState)(0);return(0,M.useEffect)(()=>{if(e.kind!==`relative`)return;let t=window.setInterval(()=>n(e=>e+1),3e4);return()=>window.clearInterval(t)},[e.kind]),(0,M.useMemo)(()=>{let{from:t,to:n}=F(e);return e.kind===`absolute`?{from:t,to:n}:{from:W(t),to:W(n)}},[e,t])}function W(e){return Math.floor(e/6e4)*6e4}function G({value:e,onChange:t}){let[n,r]=(0,M.useState)(!1),[i,o]=(0,M.useState)(``),s=F(e),[c,d]=(0,M.useState)(()=>z(s.from)),[f,m]=(0,M.useState)(()=>z(s.to));function h(t){if(t){let t=F(e);d(z(t.from)),m(z(t.to)),o(``)}r(t)}function _(e){t({kind:`relative`,from:e,to:`now`}),r(!1)}function v(){let e=B(c),n=B(f);e===null||n===null||(t({kind:`absolute`,from:e,to:n}),r(!1))}let y=(0,M.useMemo)(()=>{let e=i.trim().toLowerCase();return e===``?I:I.filter(t=>t.label.toLowerCase().includes(e)||t.from.toLowerCase().includes(e))},[i]),b=B(c)!==null&&B(f)!==null;return(0,H.jsxs)(j,{open:n,onOpenChange:h,children:[(0,H.jsx)(O,{asChild:!0,children:(0,H.jsxs)(C,{variant:`outline`,size:`sm`,className:`oc-timerange__trigger`,children:[(0,H.jsx)(T,{}),R(e)]})}),(0,H.jsx)(w,{children:(0,H.jsx)(D,{align:`end`,sideOffset:6,className:`oc-timerange__panel z-50 rounded-lg border border-border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95`,children:(0,H.jsxs)(`div`,{className:`oc-timerange__cols`,children:[(0,H.jsxs)(`div`,{className:`oc-timerange__absolute`,children:[(0,H.jsx)(`div`,{className:`oc-timerange__section-title`,children:S()}),(0,H.jsxs)(`label`,{className:`oc-field`,children:[(0,H.jsx)(`span`,{className:`oc-field__label`,children:x()}),(0,H.jsx)(A,{type:`datetime-local`,value:c,onChange:e=>d(e.target.value)})]}),(0,H.jsxs)(`label`,{className:`oc-field`,children:[(0,H.jsx)(`span`,{className:`oc-field__label`,children:a()}),(0,H.jsx)(A,{type:`datetime-local`,value:f,onChange:e=>m(e.target.value)})]}),(0,H.jsx)(C,{size:`sm`,className:`oc-timerange__apply`,disabled:!b,onClick:v,children:l()})]}),(0,H.jsxs)(`div`,{className:`oc-timerange__relative`,children:[(0,H.jsxs)(`div`,{className:`oc-timerange__search`,children:[(0,H.jsx)(E,{className:`oc-timerange__search-icon`,"aria-hidden":!0}),(0,H.jsx)(A,{value:i,onChange:e=>o(e.target.value),placeholder:u(),"aria-label":p()})]}),(0,H.jsx)(`ul`,{className:`oc-timerange__list`,children:y.length===0?(0,H.jsx)(`li`,{className:`oc-timerange__empty`,children:g()}):y.map(t=>(0,H.jsx)(`li`,{children:(0,H.jsx)(`button`,{type:`button`,className:`oc-timerange__option`+(e.kind===`relative`&&e.from===t.from&&e.to===`now`?` is-active`:``),onClick:()=>_(t.from),children:t.label})},t.from))})]})]})})})]})}export{U as n,V as r,G as t};
|