@lacneu/atrium 0.40.0 → 0.41.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-Dxz0E_KE.js +1 -0
- package/dist/assets/{AdvancedFilter-C0THAQ2E.js → AdvancedFilter-B31lk9q3.js} +1 -1
- package/dist/assets/AgentFilesTab-DeCWC1w-.js +3 -0
- package/dist/assets/AnomaliesTab-CrtrCVM2.js +1 -0
- package/dist/assets/AuditTab-BBsxqs3y.js +1 -0
- package/dist/assets/BridgeTab-BVZtXJSI.js +1 -0
- package/dist/assets/ChatDefaultsTab-DLvh7i7g.js +1 -0
- package/dist/assets/DataTableShell-2dt7qzK1.js +1 -0
- package/dist/assets/{DetailChips-jl8VAars.js → DetailChips-PeX_dqPr.js} +1 -1
- package/dist/assets/FeedbacksTab-CWlAV3go.js +1 -0
- package/dist/assets/{FieldLabel-B8G-MYNo.js → FieldLabel-DLQqitFA.js} +2 -2
- package/dist/assets/FilesTab-BKNZcTjL.js +1 -0
- package/dist/assets/{FilterBar-DRUEEKsU.js → FilterBar-C4F1dTQ_.js} +1 -1
- package/dist/assets/GroupsTab-B8NcjrCa.js +1 -0
- package/dist/assets/InstancesTab-0dB_8WYK.js +1 -0
- package/dist/assets/IntegrationsTab-DxwU-vz4.js +1 -0
- package/dist/assets/KpiTab-I_L7bxeO.js +1 -0
- package/dist/assets/PreferencesTab-Civ5ZM-T.js +1 -0
- package/dist/assets/PromptInjectionsTab-Se2h3t86.js +4 -0
- package/dist/assets/RolesTab-DzHzo0im.js +1 -0
- package/dist/assets/ServiceAccountsTab-BI3REx76.js +1 -0
- package/dist/assets/SubAgentReportsTab-CdEDescp.js +1 -0
- package/dist/assets/ThemeShowroom-_GVi_9TD.js +1 -0
- package/dist/assets/{TimeRangePicker-D48D83Oh.js → TimeRangePicker-BCP5a7nZ.js} +1 -1
- package/dist/assets/TracesTab-Vf93xOCT.js +1 -0
- package/dist/assets/UsersTab-BTN0I3fC.js +1 -0
- package/dist/assets/VoiceTab-CBjiLYeR.js +1 -0
- package/dist/assets/{button-CckfHMbj.js → button-CW3POj4v.js} +1 -1
- package/dist/assets/{card-DypYZQqW.js → card-DejnuKjD.js} +1 -1
- package/dist/assets/chevrons-up-down-CTpaTY5v.js +1 -0
- package/dist/assets/compatView-C2GqOCte.js +1 -0
- package/dist/assets/{confTabs-O2Cp4dmA.css → confTabs-C35Io1ep.css} +1 -1
- package/dist/assets/dispatchErrorInfo-DO-P1x_v.js +1 -0
- package/dist/assets/dist-0NlyORTv.js +44 -0
- package/dist/assets/{dist-B9DB48K7.js → dist-D34PU2vz.js} +1 -1
- package/dist/assets/{dist-CM845ILS.js → dist-PBgCwwDJ.js} +1 -1
- package/dist/assets/{dist-4hLW9pCQ.js → dist-cyUFYUNU.js} +1 -1
- package/dist/assets/{highlighted-body-OFNGDK62-DNPEG4ak.js → highlighted-body-OFNGDK62-DK7X_glc.js} +1 -1
- package/dist/assets/{index-BXEqld-9.css → index-B0GLWnUI.css} +1 -1
- package/dist/assets/index-Oefe3uVe.js +233 -0
- package/dist/assets/mermaid-GHXKKRXX-Ck3CTZBR.js +1 -0
- package/dist/assets/roleDescriptions-C_V0jprM.js +1 -0
- package/dist/assets/{table-CnKDuavw.js → table-BytigxuJ.js} +1 -1
- package/dist/assets/{tabs-DqVkAM7O.js → tabs-j7vaNyRB.js} +1 -1
- package/dist/assets/x-C93RBiVN.js +1 -0
- package/dist/index.html +8 -8
- package/package.json +1 -1
- package/dist/assets/AccessTab-BUu-z3sx.js +0 -1
- package/dist/assets/AgentFilesTab-CofVyQgk.js +0 -3
- package/dist/assets/AnomaliesTab-Bq3RmQHz.js +0 -1
- package/dist/assets/AuditTab-BS5US2vo.js +0 -1
- package/dist/assets/BridgeTab-BRhL8-C3.js +0 -1
- package/dist/assets/ChatDefaultsTab-DaSmKDML.js +0 -1
- package/dist/assets/DataTableShell-u1nLRhQM.js +0 -1
- package/dist/assets/FeedbacksTab-B7hyTj7i.js +0 -1
- package/dist/assets/FilesTab-CsZJjp3v.js +0 -1
- package/dist/assets/GroupsTab-Dash5os_.js +0 -1
- package/dist/assets/InstancesTab-M-1_F4WA.js +0 -1
- package/dist/assets/IntegrationsTab-DPL5iBqB.js +0 -1
- package/dist/assets/KpiTab-BXsIWGMh.js +0 -1
- package/dist/assets/PreferencesTab-BX3y939D.js +0 -1
- package/dist/assets/PromptInjectionsTab-Cnu3mata.js +0 -4
- package/dist/assets/RolesTab-BR7F3TsM.js +0 -1
- package/dist/assets/ServiceAccountsTab-Do8ADcys.js +0 -1
- package/dist/assets/SubAgentReportsTab-638o4lZF.js +0 -1
- package/dist/assets/ThemeShowroom-BZIH2Ja8.js +0 -1
- package/dist/assets/TracesTab-DrJDpSUE.js +0 -1
- package/dist/assets/UsersTab-BhMKwkaB.js +0 -1
- package/dist/assets/chevrons-up-down-DGKOAhJM.js +0 -1
- package/dist/assets/compatView-ZCfRu3f5.js +0 -1
- package/dist/assets/dispatchErrorInfo-DioyF49L.js +0 -1
- package/dist/assets/dist-0orl0RkM.js +0 -44
- package/dist/assets/index-CFTFwlx0.js +0 -231
- package/dist/assets/mermaid-GHXKKRXX-DmskwXIX.js +0 -1
- package/dist/assets/roleDescriptions-DHFs-TkY.js +0 -1
- package/dist/assets/x-DBdlW6Pd.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,KA as i,au as a,cu as o,du as s,fu as c,hu as l,iu as u,lu as d,mu as f,nu as p,ou as m,pu as h,ru as g,su as _,tj as v,tu as y,uu as b}from"./dist-0NlyORTv.js";import{C as x,S,at as C,b as w,w as T,x as E}from"./index-Oefe3uVe.js";var D=t(e(),1);function O(e){return e===`user`?a():e===`all`?u():g({group:e.group})}function k(e){return e===`common`?p():e===`owner`?y():g({group:e.group})}var A=n();function j(e){return e.name||e.email||e.userId.slice(0,8)}function M(){let e=v(r.admin.listUsers,{}),[t,n]=(0,D.useState)(``),a=v(r.introspect.introspectUser,t?{userId:t}:`skip`);return(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:l()}),(0,A.jsxs)(w,{value:t,onValueChange:n,children:[(0,A.jsx)(x,{size:`sm`,"aria-label":f(),children:(0,A.jsx)(T,{placeholder:f()})}),(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:h()}):a===void 0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:i()}):(0,A.jsxs)(`div`,{className:`oc-introspect`,children:[(0,A.jsxs)(`section`,{className:`oc-introspect__section`,children:[(0,A.jsx)(`h3`,{className:`oc-introspect__title`,children:c()}),(0,A.jsxs)(`div`,{className:`oc-introspect__id`,children:[(0,A.jsx)(`strong`,{children:a.user.label}),(0,A.jsx)(C,{variant:`secondary`,children:a.role})]})]}),(0,A.jsxs)(`section`,{className:`oc-introspect__section`,children:[(0,A.jsx)(`h3`,{className:`oc-introspect__title`,children:s()}),a.groups.length===0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:_()}):(0,A.jsx)(`div`,{className:`oc-introspect__chips`,children:a.groups.map(e=>(0,A.jsx)(C,{variant:`secondary`,children:e.name},e.groupId))})]}),(0,A.jsxs)(`section`,{className:`oc-introspect__section`,children:[(0,A.jsx)(`h3`,{className:`oc-introspect__title`,children:b()}),a.agents.length===0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:_()}):(0,A.jsx)(`ul`,{className:`oc-introspect__list`,children:a.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)(C,{variant:`default`,children:m()}):null,(0,A.jsx)(C,{variant:`outline`,children:O(e.via)}),(0,A.jsx)(C,{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:d()}),a.charts.length===0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:_()}):(0,A.jsx)(`ul`,{className:`oc-introspect__list`,children:a.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)(C,{variant:`outline`,children:k(e.via)})]},e.key))})]}),(0,A.jsxs)(`section`,{className:`oc-introspect__section`,children:[(0,A.jsx)(`h3`,{className:`oc-introspect__title`,children:o()}),a.permissions.length===0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:_()}):(0,A.jsx)(`div`,{className:`oc-introspect__chips`,children:a.permissions.map(e=>(0,A.jsx)(C,{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{Cf as r,Ef as i,Sf as a,Tf as o,bf as s,wf as c,xf as l}from"./dist-0NlyORTv.js";import{i as u}from"./dist-PBgCwwDJ.js";import{t as d}from"./x-C93RBiVN.js";import{t as f}from"./button-CW3POj4v.js";import{C as p,S as m,b as h,kt as g,ot as _,w as v,x as y}from"./index-Oefe3uVe.js";import{r as b}from"./TimeRangePicker-BCP5a7nZ.js";var x=t(e(),1),S=n(),C=[{value:`eq`,label:`=`},{value:`neq`,label:`≠`},{value:`contains`,label:i()},{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 i=(0,x.useRef)(t),w=!!(i.current&&i.current.length>0),[D,O]=(0,x.useState)(w),[k,A]=(0,x.useState)(()=>w?E(i.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}),o(),F>0?(0,S.jsx)(`span`,{className:`oc-advfilter__count`,children:F}):null]}),D?(0,S.jsxs)(`div`,{className:`oc-advfilter__body`,children:[k.length===0?(0,S.jsx)(`p`,{className:`oc-admin__hint`,children:c()}):(0,S.jsx)(`ul`,{className:`oc-advfilter__rows`,children:k.map(t=>(0,S.jsxs)(`li`,{className:`oc-advfilter__row`,children:[(0,S.jsxs)(h,{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:r()})}),(0,S.jsx)(y,{children:e.map(e=>(0,S.jsx)(m,{value:e.value,children:e.label},e.value))})]}),(0,S.jsxs)(h,{value:t.op,onValueChange:e=>M(t.id,{op:e}),children:[(0,S.jsx)(p,{size:`sm`,className:`w-28`,children:(0,S.jsx)(v,{})}),(0,S.jsx)(y,{children:C.map(e=>(0,S.jsx)(m,{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":l(),onClick:()=>P(t.id),children:(0,S.jsx)(d,{})})]},t.id))}),(0,S.jsxs)(f,{variant:`outline`,size:`sm`,className:`oc-advfilter__add`,onClick:N,children:[(0,S.jsx)(g,{}),s()]})]}):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{$n as r,As as i,Bn as a,Bs as o,Cn as s,Cs as c,Dn as l,Ds as u,E as d,En as f,Es as p,Fn as m,Fs as h,Gn as g,Gs as _,Hn as v,Hs as y,In as b,Is as x,JA as S,Jn as C,Js as w,KA as T,Kn as E,Ks as D,Ln as O,Ls as k,Ms as A,Nc as j,Ns as M,On as N,Os as ee,PT as P,Ps as F,QA as I,Qn as te,Rn as L,Rs as R,Sn as z,Ss as ne,Tn as re,Ts as B,Un as V,Us as ie,Vn as H,Vs as U,Wn as ae,Ws as oe,Xn as W,Xs as se,Yn as ce,Ys as le,Zn as ue,ej as de,er as fe,jc as pe,js as me,ks as he,qn as ge,qs as _e,tj as G,tr as ve,wn as ye,ws as be,xs as xe,zn as Se,zs as Ce}from"./dist-0NlyORTv.js";import{t as K}from"./button-CW3POj4v.js";import{C as we,Ct as q,G as Te,H as Ee,J as De,K as Oe,S as ke,U as Ae,W as je,Y as Me,at as Ne,b as Pe,ct as Fe,dt as Ie,ft as Le,ht as Re,lt as ze,q as Be,st as Ve,w as He,x as Ue,y as We,z as J}from"./index-Oefe3uVe.js";import{n as Ge,t as Ke}from"./curation-CQksaIbm.js";import{i as qe}from"./compatView-C2GqOCte.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=G(d.me.getMe,{host:Re}),t=e?.role===`admin`,n=(e?.permissions??[]).includes(`bridge.read`),r=G(d.admin.listInstances,e!==void 0&&t?{}:`skip`),[i,a]=(0,Y.useState)(null);(0,Y.useEffect)(()=>{!t||!r||r.length===0||(!i||!r.some(e=>e.name===i))&&a(r[0].name)},[t,r,i]);let s=G(d.agents.listAgentsForInstance,t&&i?{instanceName:i}:`skip`),c=G(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=I(d.agentFiles.listAgentFiles),[h,g]=(0,Y.useState)({status:`idle`}),v=p?.instanceName??null,b=p?.agentId??null,x=G(d.compat.forInstance,n&&v!==null?{instanceName:v}:`skip`),C=n&&v!==null?We(x,`agentFiles`):null,E=C===null?!1:C===`loading`?null:C.blocked,O=(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&&O()},[O,E]);let[k,A]=(0,Y.useState)(null),j=G(d.agentFileCuration.listCurations,t&&v!==null&&b!==null?{instanceName:v,agentId:b}:`skip`),M=G(d.agentFileCuration.curationSettings,t&&v!==null?{instanceName:v}:`skip`),N=I(d.agentFileCuration.requestCuration),[ee,P]=(0,Y.useState)(null),[F,L]=(0,Y.useState)(null),{toast:z}=J(),ne=(0,Y.useMemo)(()=>{let e=new Map;for(let t of j??[])e.has(t.name)||e.set(t.name,t);return e},[j]),re=(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?z({title:te(),variant:`success`}):z({title:ue({reason:t.reason??`unknown`}),variant:`error`})}catch{z({title:W(),variant:`error`})}finally{P(null)}}},[N,v,b,z]),B=S(),V=(0,Y.useMemo)(()=>new Intl.NumberFormat(B,{maximumFractionDigits:0}),[B]);return e===void 0||l===void 0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:T()}):(0,Q.jsxs)(`div`,{className:`oc-afiles`,children:[(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:se()}),(0,Q.jsxs)(`div`,{className:`oc-afiles__picker`,children:[t&&(r?.length??0)>1?(0,Q.jsxs)(Pe,{value:i??``,onValueChange:e=>a(e),children:[(0,Q.jsx)(we,{size:`sm`,"aria-label":le(),children:(0,Q.jsx)(He,{})}),(0,Q.jsx)(Ue,{children:(r??[]).map(e=>(0,Q.jsx)(ke,{value:e.name,children:e.name},e.name))})]}):null,l.length>0?(0,Q.jsxs)(Pe,{value:u??``,onValueChange:e=>f(e),children:[(0,Q.jsx)(we,{size:`sm`,"aria-label":w(),children:(0,Q.jsx)(He,{})}),(0,Q.jsx)(Ue,{children:l.map(e=>(0,Q.jsx)(ke,{value:$(e),children:e.label},$(e)))})]}):(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:_e()})]}),p===null?null:C===`loading`?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:T()}):C!==null&&C.blocked?(0,Q.jsxs)(`p`,{className:`oc-compat__blocked`,role:`status`,children:[(0,Q.jsx)(q,{size:14,"aria-hidden":!0}),` `,qe(C.gatewayVersion,C.provider)]}):h.status===`loading`||h.status===`idle`?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:T()}):h.status===`error`?(0,Q.jsxs)(`p`,{className:`oc-afiles__error`,role:`alert`,children:[_(),` `,(0,Q.jsx)(K,{variant:`outline`,size:`sm`,onClick:()=>void O(),children:pe()})]}):h.files.length===0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:D()}):(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)(Ne,{variant:`outline`,children:oe()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`span`,{className:`oc-afiles__size`,children:ie({size:Z(e.size,B)})}),(0,Q.jsx)(`span`,{className:`oc-afiles__gauge${r?` is-warn`:``}`,"aria-hidden":!0,children:(0,Q.jsx)(`span`,{className:`oc-afiles__gauge-fill`,style:{width:`${Math.min(n,100)}%`}})}),(0,Q.jsx)(`span`,{className:`oc-afiles__pct`,children:y({pct:V.format(n)})}),r?(0,Q.jsx)(q,{size:14,className:`oc-afiles__warn`,"aria-label":U()}):(0,Q.jsx)(`span`,{className:`oc-afiles__warn-slot`,"aria-hidden":!0})]}),(0,Q.jsx)(K,{variant:`outline`,size:`sm`,className:`oc-afiles__open`,onClick:()=>A(e),children:t?Ce():R()}),t&&!e.missing?(0,Q.jsx)(nt,{curatable:Ke.includes(e.name),size:e.size??0,budget:M?.budgetChars??null,enabled:M?.enabled??!1,curation:ne.get(e.name)??null,inFlight:ee===e.name,onCurate:()=>void re(e.name),onReview:e=>L(e)}):null]},e.name)})}),(0,Q.jsx)(`p`,{className:`oc-afiles__budget`,children:o({used:Z(Ze(h.files),B),total:Z(Je,B),pct:V.format(Xe(Ze(h.files)))})})]}),k&&p?(0,Q.jsx)(rt,{instanceName:p.instanceName,agentId:p.agentId,name:k.name,isAdmin:t,onClose:()=>A(null),onSaved:()=>void O()}):null,F?(0,Q.jsx)(it,{curationId:F,onClose:()=>L(null),onApplied:()=>{L(null),O()}}):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:fe()}):o||a?.status===`dispatched`||a?.status===`applying`?(0,Q.jsx)(Ne,{variant:`outline`,className:`oc-afiles__curate-status`,children:r()}):e&&i&&n!==null&&Ge(t,n)?(0,Q.jsx)(K,{variant:`outline`,size:`sm`,className:`oc-afiles__curate`,onClick:s,children:ve()}):null}function rt({instanceName:e,agentId:t,name:n,isAdmin:r,onClose:a,onSaved:o}){let s=I(d.agentFiles.getAgentFile),l=I(d.agentFiles.setAgentFile),f=J(),[m,g]=(0,Y.useState)(null),[_,v]=(0,Y.useState)(!1),[y,b]=(0,Y.useState)(``),[C,w]=(0,Y.useState)(!1),[E,D]=(0,Y.useState)(!1),[O,N]=(0,Y.useState)(!1),[te,L]=(0,Y.useState)(!1),R=(0,Y.useCallback)(async r=>{v(!1);try{let i=await s({instanceName:e,agentId:t,name:n});g({content:i.content,updatedAtMs:i.updatedAtMs}),r||b(i.content),N(!1)}catch{v(!0)}},[s,e,t,n]);(0,Y.useEffect)(()=>{R(!1)},[R]);async function z(){if(m!==null){D(!0),L(!1);try{await l({instanceName:e,agentId:t,name:n,content:y,baseUpdatedAtMs:m.updatedAtMs??void 0}),f.success(me({name:n})),o(),await R(!1)}catch(e){et(e)?N(!0):L(!0)}finally{D(!1)}}}let re=m!==null&&y!==m.content,V=(0,Y.useMemo)(()=>m===null?null:$e(m.content,y),[m,y]),ie=y.length>X,H=S(),U=(0,Y.useMemo)(()=>new Intl.NumberFormat(H),[H]);return(0,Q.jsx)(Ve,{open:!0,onOpenChange:e=>!e&&a(),children:(0,Q.jsxs)(Fe,{className:`oc-afiles__editor`,children:[(0,Q.jsxs)(Ie,{children:[(0,Q.jsx)(Le,{children:k({name:n})}),(0,Q.jsxs)(ze,{children:[x({agent:t,instance:e}),r?null:(0,Q.jsxs)(Q.Fragment,{children:[` · `,h()]})]})]}),_?(0,Q.jsxs)(`p`,{className:`oc-afiles__error`,role:`alert`,children:[he(),` `,(0,Q.jsx)(K,{variant:`outline`,size:`sm`,onClick:()=>void R(!1),children:pe()})]}):m===null?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:T()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`textarea`,{className:`oc-afiles__source`,value:y,readOnly:!r,spellCheck:!1,onChange:e=>b(e.target.value),"aria-label":k({name:n})}),(0,Q.jsx)(`p`,{className:`oc-afiles__hint`,children:F()}),O?(0,Q.jsxs)(`p`,{className:`oc-afiles__error`,role:`alert`,children:[ee(),` `,(0,Q.jsx)(K,{variant:`outline`,size:`sm`,onClick:()=>void R(!0),children:u()})]}):null,te?(0,Q.jsx)(`p`,{className:`oc-afiles__error`,role:`alert`,children:i()}):null,(0,Q.jsxs)(`div`,{className:`oc-afiles__editor-foot`,children:[(0,Q.jsx)(`span`,{className:`oc-afiles__count${ie?` is-over`:``}`,children:M({count:U.format(y.length),max:U.format(X)})}),r?(0,Q.jsx)(K,{size:`sm`,disabled:!re||E||O,onClick:()=>w(!0),children:E?j():A()}):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:p({name:n})}),(0,Q.jsx)(Oe,{children:B({agent:t})})]}),V?(0,Q.jsxs)(`div`,{className:`oc-afiles__diff`,children:[(0,Q.jsx)(`p`,{className:`oc-afiles__diff-counts`,children:be({added:V.added,removed:V.removed})}),V.sampleAdded.length>0?(0,Q.jsxs)(`div`,{className:`oc-afiles__diff-block`,children:[(0,Q.jsx)(`span`,{className:`oc-afiles__diff-label`,children:c()}),V.sampleAdded.map((e,t)=>(0,Q.jsx)(`code`,{className:`oc-afiles__diff-line is-add`,children:e||` `},t))]}):null,V.sampleRemoved.length>0?(0,Q.jsxs)(`div`,{className:`oc-afiles__diff-block`,children:[(0,Q.jsx)(`span`,{className:`oc-afiles__diff-label`,children:ne()}),V.sampleRemoved.map((e,t)=>(0,Q.jsx)(`code`,{className:`oc-afiles__diff-line is-del`,children:e||` `},t))]}):null]}):null,(0,Q.jsxs)(Be,{children:[(0,Q.jsx)(je,{children:P()}),(0,Q.jsx)(Ae,{onClick:()=>void z(),children:xe()})]})]})})]})})}function it({curationId:e,onClose:t,onApplied:n}){let r=G(d.agentFileCuration.getProposal,{curationId:e}),i=I(d.agentFileCuration.approveCuration),o=de(d.agentFileCuration.rejectCuration),{toast:c}=J(),[u,p]=(0,Y.useState)(null),[h,_]=(0,Y.useState)(!1),[y,x]=(0,Y.useState)(``),w=S(),D=(0,Y.useMemo)(()=>r?$e(r.beforeContent,r.proposedContent):null,[r]);async function k(){p(`approve`);try{let t=await i({curationId:e});t.ok?(c({title:ce(),variant:`success`}),n()):c({title:t.reason===`conflict`?ge():E({reason:t.reason??`unknown`}),variant:`error`})}catch{c({title:W(),variant:`error`})}finally{p(null)}}async function A(n){p(`reject`);try{let r=y.trim();(await o({curationId:e,...r?{comment:r}:{},relaunch:n})).ok?c({title:n?s():C(),variant:`success`}):c({title:V(),variant:`error`}),t()}catch{c({title:W(),variant:`error`})}finally{p(null)}}return(0,Q.jsx)(Ve,{open:!0,onOpenChange:e=>e?void 0:t(),children:(0,Q.jsxs)(Fe,{className:`oc-afiles__review`,children:[(0,Q.jsxs)(Ie,{children:[(0,Q.jsx)(Le,{children:r?g({name:r.name}):T()}),(0,Q.jsx)(ze,{children:ae()})]}),r===void 0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:T()}):r===null?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:V()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`p`,{className:`oc-afiles__review-sizes`,children:[v({before:Z(r.beforeSize,w),after:Z(r.proposedSize,w)}),r.overBudget?(0,Q.jsxs)(Q.Fragment,{children:[` `,(0,Q.jsx)(q,{size:13,"aria-hidden":!0}),` `,H()]}):null]}),D?(0,Q.jsx)(`p`,{className:`oc-afiles__review-diff`,children:a({added:D.added,removed:D.removed})}):null,r.feedback?(0,Q.jsx)(`p`,{className:`oc-afiles__review-feedback`,children:z({feedback:r.feedback})}):null,D&&D.sampleRemoved.length>0?(0,Q.jsxs)(`div`,{className:`oc-afiles__review-removed`,children:[(0,Q.jsx)(`p`,{className:`oc-afiles__review-label`,children:m()}),(0,Q.jsx)(`ul`,{children:D.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:b()}),(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:Se()}),(0,Q.jsx)(`pre`,{className:`oc-afiles__review-pre`,children:r.proposedContent})]})]})]}),h?(0,Q.jsxs)(`div`,{className:`oc-afiles__reject-form`,children:[(0,Q.jsx)(`label`,{className:`oc-afiles__review-label`,htmlFor:`curation-reject-comment`,children:N()}),(0,Q.jsx)(`textarea`,{id:`curation-reject-comment`,className:`oc-afiles__reject-textarea`,rows:3,placeholder:l(),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:f()}),(0,Q.jsx)(K,{variant:`outline`,onClick:()=>void A(!1),disabled:u!==null,children:u===`reject`?j():re()}),(0,Q.jsx)(K,{variant:`default`,onClick:()=>void A(!0),disabled:u!==null,children:u===`reject`?j():ye()})]})]}):(0,Q.jsxs)(`div`,{className:`oc-afiles__review-actions`,children:[(0,Q.jsx)(K,{variant:`outline`,onClick:()=>_(!0),disabled:u!==null||r==null,children:L()}),(0,Q.jsx)(K,{variant:`default`,onClick:()=>void k(),disabled:u!==null||r==null,children:u===`approve`?j():O()})]})]})})}export{tt as AgentFilesTab};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$_ as r,B_ as i,Cv as a,E as o,F_ as s,G_ as ee,H_ as te,I_ as c,J_ as l,K_ as u,L_ as d,Q_ as f,R_ as p,Sv as m,U_ as h,V_ as g,W_ as _,X_ as v,Y_ as ne,Z_ as re,_v as ie,av as ae,bv as oe,cv as se,dv as ce,ej as le,ev as y,fv as ue,gv as de,hv as fe,iv as pe,lv as me,mv as he,nv as ge,ov as b,pv as x,q_ as S,rv as C,sv as w,tj as T,tv as E,uv as D,vv as O,xv as k,yv as A,z_ as j}from"./dist-0NlyORTv.js";import{A as M,B as N,Bt as P,C as F,S as I,Vt as L,a as _e,at as R,b as z,ht as ve,r as ye,w as B,x as V,z as be}from"./index-Oefe3uVe.js";import{n as xe}from"./TimeRangePicker-BCP5a7nZ.js";import{t as Se}from"./FilterBar-C4F1dTQ_.js";import{t as Ce}from"./DataTableShell-2dt7qzK1.js";import{t as H}from"./dispatchErrorInfo-DO-P1x_v.js";var U=t(e(),1),W=n(),G=`__all__`,we=[{value:`open`},{value:`acknowledged`},{value:`resolved`}];function Te(e){return e===`open`?a():e===`acknowledged`?m():k()}var Ee=[`info`,`warn`,`critical`],De=[`detector`,`agent`,`user`],Oe={kind:`relative`,from:`now-30d`,to:`now`},ke=200,K=`all`;function q(){let e=L({from:`/settings/anomalies`}),t=P({from:`/settings/anomalies`}),n=e.q??``,a=e.status===K?G:e.status,s=e.severity??G,c=e.kind??G,[d,p]=(0,U.useState)(G),m=ye(e.from,e.to),{from:k,to:H}=xe(m),q=e=>void t({search:t=>({...t,q:e||void 0}),replace:!0}),J=e=>void t({search:t=>({...t,status:e===G?K:e})}),Y=e=>void t({search:t=>({...t,severity:e===G?void 0:e})}),Pe=e=>void t({search:t=>({...t,kind:e===G?void 0:e})}),Fe=e=>void t({search:t=>({...t,..._e(e)})}),Ie=N(),X=be(),Z=le(o.anomalies.resolveAnomaly),Le=(T(o.me.getMe,{host:ve})?.permissions??[]).includes(`admin.manage`),Q=T(o.anomalies.listAnomalies,{limit:ke,filter:{q:n||void 0,from:k,to:H,anomalyStatus:a===G?void 0:a,severity:s===G?void 0:s,source:d===G?void 0:d,kind:c===G?void 0:c}}),$=(0,U.useMemo)(()=>{let e=new Set;for(let t of Q??[])e.add(t.kind);return[...e].sort()},[Q]),Re=n!==``||a!==`open`||s!==G||d!==G||c!==G||m.kind!==`relative`||m.from!==Oe.from;function ze(){p(G),t({search:{status:`open`},replace:!0})}async function Be(e){if(await Ie({title:oe(),description:(0,W.jsxs)(W.Fragment,{children:[A(),` `,(0,W.jsx)(`span`,{className:`font-mono`,children:e.kind}),` `,O(),` `,(0,W.jsx)(`strong`,{children:ie()}),`.`,` `,de()]}),confirmLabel:fe()}))try{await Z({anomalyId:e._id,status:`resolved`}),X.success(he(),e.kind)}catch(e){X.error(x(),e)}}async function Ve(e){try{await Z({anomalyId:e._id,status:`acknowledged`}),X.success(ue(),e.kind)}catch(e){X.error(ce(),e)}}return(0,W.jsxs)(W.Fragment,{children:[(0,W.jsxs)(`p`,{className:`oc-admin__hint`,children:[D(),` `,(0,W.jsx)(`strong`,{children:me()}),` `,se(),` `,(0,W.jsx)(`strong`,{children:w()}),` `,b(),` `,(0,W.jsx)(`strong`,{children:ae()}),` `,pe(),` `,(0,W.jsx)(`span`,{className:`oc-filter__window`,children:C()})]}),(0,W.jsxs)(Se,{q:n,onQChange:q,searchPlaceholder:ge(),timeRange:m,onTimeRangeChange:Fe,onReset:ze,canReset:Re,children:[(0,W.jsxs)(z,{value:a,onValueChange:J,children:[(0,W.jsx)(F,{size:`sm`,className:`w-36`,children:(0,W.jsx)(B,{})}),(0,W.jsxs)(V,{children:[(0,W.jsx)(I,{value:G,children:E()}),we.map(e=>(0,W.jsx)(I,{value:e.value,children:Te(e.value)},e.value))]})]}),(0,W.jsxs)(z,{value:s,onValueChange:Y,children:[(0,W.jsx)(F,{size:`sm`,className:`w-36`,children:(0,W.jsx)(B,{placeholder:y()})}),(0,W.jsxs)(V,{children:[(0,W.jsx)(I,{value:G,children:r()}),Ee.map(e=>(0,W.jsx)(I,{value:e,children:e},e))]})]}),(0,W.jsxs)(z,{value:d,onValueChange:p,children:[(0,W.jsx)(F,{size:`sm`,className:`w-32`,children:(0,W.jsx)(B,{placeholder:f()})}),(0,W.jsxs)(V,{children:[(0,W.jsx)(I,{value:G,children:re()}),De.map(e=>(0,W.jsx)(I,{value:e,children:e},e))]})]}),(0,W.jsxs)(z,{value:c,onValueChange:Pe,children:[(0,W.jsx)(F,{size:`sm`,className:`w-36`,children:(0,W.jsx)(B,{placeholder:v()})}),(0,W.jsxs)(V,{children:[(0,W.jsx)(I,{value:G,children:ne()}),$.map(e=>(0,W.jsx)(I,{value:e,children:e},e))]})]})]}),(0,W.jsx)(Ce,{title:l(),rows:Q,emptyHint:a===`open`?S():u(),rowActions:e=>Le&&e.status===`open`?[{label:ee(),onSelect:()=>void Be(e)},{label:_(),onSelect:()=>void Ve(e)}]:[],columns:[{header:h(),cell:e=>(0,W.jsx)(`span`,{className:`oc-traces__time`,children:M(e.at)}),sort:e=>e.at},{header:v(),cell:e=>(0,W.jsx)(`code`,{className:`oc-traces__mono`,children:e.kind}),sort:e=>e.kind},{header:y(),cell:e=>(0,W.jsx)(je,{severity:e.severity}),sort:e=>e.severity===`critical`?2:+(e.severity===`warn`)},{header:te(),cell:e=>(0,W.jsx)(Me,{status:e.status}),sort:e=>e.status===`resolved`?2:+(e.status===`acknowledged`)},{header:f(),cell:e=>(0,W.jsx)(R,{variant:`outline`,children:e.source}),sort:e=>e.source},{header:g(),cell:e=>(0,W.jsx)(`span`,{className:`oc-anomaly__msg`,children:e.message}),sort:e=>e.message},{header:i(),cell:e=>(0,W.jsx)(Ae,{row:e}),sort:e=>e.evidence??null},{header:j(),cell:e=>e.correlationId?(0,W.jsx)(`code`,{className:`oc-traces__mono`,children:Ne(e.correlationId)}):(0,W.jsx)(`span`,{className:`oc-traces__muted`,children:`—`}),sort:e=>e.correlationId}]})]})}function J(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 Y(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 Ae({row:e}){let t=P();if(e.kind===`subagent.failure`){let n=Y(e);return(0,W.jsxs)(`div`,{className:`oc-anomaly__cause`,children:[(0,W.jsx)(`div`,{className:`oc-anomaly__cause-head`,children:[...new Set(n.errorCategories??[])].map(e=>(0,W.jsx)(`code`,{className:`oc-traces__mono`,children:e},e))}),e.correlationId?(0,W.jsxs)(`button`,{type:`button`,className:`oc-anomaly__drill`,onClick:()=>void t({to:`/settings/traces`,search:{q:e.correlationId,limit:100}}),children:[`↗ `,p()]}):null]})}let n=J(e);if(!n.dominantCode)return(0,W.jsx)(`span`,{className:`oc-traces__muted`,children:`—`});let r=H(n.dominantCode),i=n.sampleCorrelationId;return(0,W.jsxs)(`div`,{className:`oc-anomaly__cause`,children:[(0,W.jsxs)(`div`,{className:`oc-anomaly__cause-head`,children:[(0,W.jsx)(`span`,{className:`oc-anomaly__cause-label`,children:r.label}),(0,W.jsx)(`code`,{className:`oc-traces__mono`,children:n.dominantCode})]}),(0,W.jsx)(`p`,{className:`oc-anomaly__cause-hint`,children:r.hint}),i?(0,W.jsxs)(`button`,{type:`button`,className:`oc-anomaly__drill`,onClick:()=>void t({to:`/settings/traces`,search:{q:i,limit:100}}),children:[`↗ `,p()]}):null]})}function je({severity:e}){return(0,W.jsx)(`span`,{className:`oc-anomaly__sev oc-anomaly__sev--${e}`,children:e})}function Me({status:e}){return e===`open`?(0,W.jsx)(R,{variant:`destructive`,children:d()}):e===`acknowledged`?(0,W.jsx)(R,{variant:`secondary`,children:c()}):(0,W.jsx)(R,{variant:`outline`,children:s()})}function Ne(e){return e.length>8?e.slice(0,8):e}export{q as AnomaliesTab};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$t as r,Cy as i,Dy as a,E as o,Ey as s,Oy as c,Qt as l,Sy as u,Ty as d,Xt as f,Yt as p,Zt as m,_y as h,by as g,en as _,gy as v,hy as y,my as b,tj as x,vy as S,wy as C,xy as w,yy as T}from"./dist-0NlyORTv.js";import{A as E,Bt as D,C as O,S as k,Vt as A,a as j,b as M,i as N,o as P,r as F,t as I,w as L,x as R}from"./index-Oefe3uVe.js";import{n as ee}from"./TimeRangePicker-BCP5a7nZ.js";import{t as z}from"./FilterBar-C4F1dTQ_.js";import{t as B}from"./AdvancedFilter-B31lk9q3.js";import{t as V}from"./DataTableShell-2dt7qzK1.js";var H=t(e(),1),U=n(),W={kind:`relative`,from:I,to:`now`},G=`__all__`,K=[{value:`action`,label:_()},{value:`realLabel`,label:r()},{value:`targetLabel`,label:l()},{value:`impersonated`,label:m()},{value:`resource`,label:f()},{value:`resourceId`,label:p()}];function q(){let e=A({from:`/settings/audit`}),t=D({from:`/settings/audit`}),n=e.q??``,r=e.action??G,l=e.impersonated??G,f=e.resource??G,p=F(e.from,e.to),m=(0,H.useMemo)(()=>P(e.adv),[e.adv]),{from:_,to:I}=ee(p),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,...j(e)})}),Q=e=>void t({search:t=>({...t,adv:N(e)}),replace:!0}),$=x(o.admin.listAudit,{filter:{q:n||void 0,from:_,to:I,action:r===G?void 0:r,resource:f===G?void 0:f,impersonated:l===G?void 0:l===`yes`,advanced:m.length>0?m:void 0}}),te=(0,H.useMemo)(()=>{let e=new Set;for(let t of $??[])e.add(t.action);return[...e].sort()},[$]),ne=(0,H.useMemo)(()=>{let e=new Set;for(let t of $??[])t.resource&&e.add(t.resource);return[...e].sort()},[$]),re=n!==``||r!==G||l!==G||f!==G||m.length>0||p.kind!==`relative`||p.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:[c(),` `,(0,U.jsx)(`span`,{className:`oc-filter__window`,children:a()})]}),(0,U.jsxs)(z,{q:n,onQChange:q,searchPlaceholder:s(),timeRange:p,onTimeRangeChange:Z,onReset:ie,canReset:re,children:[(0,U.jsxs)(M,{value:r,onValueChange:J,children:[(0,U.jsx)(O,{size:`sm`,className:`w-40`,children:(0,U.jsx)(L,{placeholder:d()})}),(0,U.jsxs)(R,{children:[(0,U.jsx)(k,{value:G,children:C()}),te.map(e=>(0,U.jsx)(k,{value:e,children:e},e))]})]}),(0,U.jsxs)(M,{value:l,onValueChange:Y,children:[(0,U.jsx)(O,{size:`sm`,className:`w-40`,children:(0,U.jsx)(L,{})}),(0,U.jsxs)(R,{children:[(0,U.jsx)(k,{value:G,children:i()}),(0,U.jsx)(k,{value:`yes`,children:u()}),(0,U.jsx)(k,{value:`no`,children:w()})]})]}),(0,U.jsxs)(M,{value:f,onValueChange:X,children:[(0,U.jsx)(O,{size:`sm`,className:`w-40`,children:(0,U.jsx)(L,{placeholder:g()})}),(0,U.jsxs)(R,{children:[(0,U.jsx)(k,{value:G,children:T()}),ne.map(e=>(0,U.jsx)(k,{value:e,children:e},e))]})]})]}),(0,U.jsx)(B,{fields:K,seed:m,onChange:Q}),(0,U.jsx)(V,{title:S(),rows:$,emptyHint:h(),columns:[{header:v(),cell:e=>E(e.at),sort:e=>e.at},{header:d(),cell:e=>e.action,sort:e=>e.action},{header:y(),cell:e=>e.realLabel,sort:e=>e.realLabel},{header:b(),cell:e=>e.targetLabel??`—`,sort:e=>e.targetLabel??null},{header:g(),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{$m as r,$o as i,Ah as a,Am as o,Bm as s,Ch as c,Cm as l,D as u,Dh as d,Dm as f,E as p,Eh as ee,Em as m,Fh as h,Fm as g,Gm as te,Hm as ne,Ih as _,Im as v,Jm as re,Jo as y,Km as ie,Lm as b,Mh as ae,Mm as x,Nh as oe,Nm as se,Oh as ce,Om as le,Pm as ue,QA as de,Qm as fe,Qo as pe,Rm as me,Sh as he,Sm as ge,Tm as _e,Um as ve,Vm as ye,Wm as be,Xm as xe,Ym as Se,Zm as Ce,_m as we,_t as Te,am as Ee,as as De,bm as Oe,bt as ke,cm as Ae,cs as je,dm as Me,eh as Ne,ej as Pe,es as Fe,fm as Ie,gm as Le,hm as Re,is as ze,jh as Be,jm as Ve,kh as He,km as Ue,lm as We,ls as Ge,mm as Ke,ns as qe,om as S,os as Je,pm as Ye,qm as Xe,rs as Ze,sm as Qe,ss as $e,tj as C,ts as et,um as tt,us as nt,vm as rt,vt as it,wm as at,wt as ot,xm as st,xt as ct,ym as w,yt as lt,zm as ut}from"./dist-0NlyORTv.js";import{i as T,r as dt}from"./dist-PBgCwwDJ.js";import{t as ft}from"./chevrons-up-down-CTpaTY5v.js";import{i as pt,n as E,o as mt,r as ht,s as gt}from"./FieldLabel-DLQqitFA.js";import{t as _t}from"./button-CW3POj4v.js";import{A as vt,Bt as yt,C as D,Ct as O,Et as bt,Q as xt,Rt as k,S as A,X as St,Z as Ct,at as j,b as M,ct as wt,dt as Tt,ft as Et,ht as Dt,j as N,jt as Ot,lt as kt,m as At,ot as P,p as jt,st as Mt,w as F,x as I,z as Nt,zt as Pt}from"./index-Oefe3uVe.js";import{r as Ft}from"./locales-CPjguROj.js";import{a as It,i as L,n as R,o as z,r as B,t as V}from"./table-BytigxuJ.js";import{t as Lt}from"./FilterBar-C4F1dTQ_.js";import{a as H,n as Rt,o as U,r as W,s as zt,t as Bt}from"./compatView-C2GqOCte.js";import{t as G}from"./dispatchErrorInfo-DO-P1x_v.js";var Vt=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`}]]),Ht=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`}]]),K=t(e(),1);function Ut(e){return e.filter(e=>e.state===`error`)}function Wt(e){return e.reachable&&Ut(e.targets).length===0}function Gt(e){return e.state===`error`&&e.lastErrorCode!==null}function Kt(e){return!!e.lastDownstreamRejectCode}function q(e){return e.kind??`openclaw`}function qt(e){return[...e].sort((e,t)=>e===`openclaw`?-1:t===`openclaw`?1:e.localeCompare(t))}function Jt(e,t,n){let r=new Map;for(let e of t)e.instanceName&&r.set(e.instanceName,e.provider);for(let e of n)r.set(e.name,q(e));let i=e=>(e.instanceName?r.get(e.instanceName):void 0)??`openclaw`,a=new Set;for(let e of n)a.add(q(e));for(let e of t)a.add(e.provider);for(let t of e)a.add(i(t));return qt(a).map(r=>({key:r,connections:e.filter(e=>i(e)===r),compatTargets:t.filter(e=>e.provider===r),instances:n.filter(e=>q(e)===r)}))}function Yt(e){return e===`openclaw`?`OpenClaw`:e===`hermes`?`Hermes`:e.charAt(0).toUpperCase()+e.slice(1)}var J=`__all__`,Y={q:``,state:J,instance:J,version:J},X={connected:0,error:1,idle:2};function Xt(e){return e.q.trim()!==``||e.state!==`__all__`||e.instance!==`__all__`||e.version!==`__all__`}function Zt(e,t){let n=t.q.trim().toLowerCase();return e.filter(e=>!(n&&!`${e.targetLabel} ${e.gatewayHost}`.toLowerCase().includes(n)||t.state!==`__all__`&&e.state!==t.state||t.instance!==`__all__`&&(e.instanceName??``)!==t.instance||t.version!==`__all__`&&(e.gatewayVersion??``)!==t.version))}function Z(e,t){return e.localeCompare(t,void 0,{numeric:!0,sensitivity:`base`})}function Qt(e,t){return e===`version`?t.gatewayVersion===null:e===`lastOk`?t.lastOkAt===null:!1}function $t(e,t,n){switch(e){case`state`:return(X[t.state]??99)-(X[n.state]??99);case`instance`:return Z(t.instanceLabel??t.instanceName??``,n.instanceLabel??n.instanceName??``);case`host`:return Z(t.gatewayHost,n.gatewayHost);case`version`:{let e=t.gatewayVersion,r=n.gatewayVersion;return U(e,r)??Z(e,r)}case`lastOk`:return t.lastOkAt-n.lastOkAt;default:return Z(t.targetLabel,n.targetLabel)}}function en(e,t){if(!t)return e;let n=t.dir===`asc`?1:-1;return[...e].sort((e,r)=>{let i=Qt(t.key,e),a=Qt(t.key,r);return i&&a?0:i?1:a?-1:n*$t(t.key,e,r)})}function tn(e){let t=new Set;for(let n of e)t.add(n.state);return[...t].sort((e,t)=>(X[e]??99)-(X[t]??99))}function nn(e){let t=new Map;for(let n of e)n.instanceName!==null&&(t.has(n.instanceName)||t.set(n.instanceName,n.instanceLabel??n.instanceName));return[...t.entries()].map(([e,t])=>({name:e,label:t})).sort((e,t)=>Z(e.label,t.label))}function rn(e){let t=new Set;for(let n of e)n.gatewayVersion!==null&&t.add(n.gatewayVersion);return[...t].sort((e,t)=>U(e,t)??Z(e,t))}var Q=n();function an({connections:e,displayByInstance:t}){let[n,r]=(0,K.useState)(Y),[i,a]=(0,K.useState)(null),o=(0,K.useMemo)(()=>e.map((e,n)=>({_id:`${e.key}:${e.canonical}/${e.agentId}:${n}`,targetLabel:`${e.canonical}/${e.agentId}`,state:e.state,instanceName:e.instanceName??null,instanceLabel:e.instanceName?t.get(e.instanceName)??e.instanceName:null,gatewayHost:e.gatewayHost,gatewayVersion:e.gatewayVersion??null,okCount:e.okCount,errorCount:e.errorCount,attempts:e.attempts,lastOkAt:e.lastOkAt??null,lastErrorCode:e.lastErrorCode??null,lastErrorAt:e.lastErrorAt??null,lastDownstreamRejectCode:e.lastDownstreamRejectCode??null,lastDownstreamRejectAt:e.lastDownstreamRejectAt??null})),[e,t]),s=(0,K.useMemo)(()=>tn(o),[o]),c=(0,K.useMemo)(()=>nn(o),[o]),u=(0,K.useMemo)(()=>rn(o),[o]),d=(0,K.useMemo)(()=>en(Zt(o,n),i),[o,n,i]);function f(e){a(t=>t?.key===e?t.dir===`asc`?{key:e,dir:`desc`}:null:{key:e,dir:`asc`})}return e.length===0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:l()}):(0,Q.jsxs)(`div`,{className:`oc-conn`,children:[(0,Q.jsxs)(Lt,{q:n.q,onQChange:e=>r(t=>({...t,q:e})),searchPlaceholder:Oe(),onReset:()=>r(Y),canReset:Xt(n),children:[(0,Q.jsxs)(M,{value:n.state,onValueChange:e=>r(t=>({...t,state:e})),children:[(0,Q.jsx)(D,{size:`sm`,className:`w-36`,children:(0,Q.jsx)(F,{placeholder:rt()})}),(0,Q.jsxs)(I,{children:[(0,Q.jsx)(A,{value:J,children:w()}),s.map(e=>(0,Q.jsx)(A,{value:e,children:sn(e)},e))]})]}),(0,Q.jsxs)(M,{value:n.instance,onValueChange:e=>r(t=>({...t,instance:e})),children:[(0,Q.jsx)(D,{size:`sm`,className:`w-40`,children:(0,Q.jsx)(F,{placeholder:we()})}),(0,Q.jsxs)(I,{children:[(0,Q.jsx)(A,{value:J,children:w()}),c.map(e=>(0,Q.jsx)(A,{value:e.name,children:e.label},e.name))]})]}),(0,Q.jsxs)(M,{value:n.version,onValueChange:e=>r(t=>({...t,version:e})),children:[(0,Q.jsx)(D,{size:`sm`,className:`w-36`,children:(0,Q.jsx)(F,{placeholder:Le()})}),(0,Q.jsxs)(I,{children:[(0,Q.jsx)(A,{value:J,children:w()}),u.map(e=>(0,Q.jsx)(A,{value:e,children:e},e))]})]})]}),d.length===0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:Re()}):(0,Q.jsxs)(V,{className:`oc-conn__table`,children:[(0,Q.jsx)(It,{children:(0,Q.jsxs)(z,{children:[(0,Q.jsx)($,{label:Ke(),sortKey:`target`,sort:i,onSort:f}),(0,Q.jsx)($,{label:Ye(),sortKey:`state`,sort:i,onSort:f}),(0,Q.jsx)($,{label:Ie(),sortKey:`instance`,sort:i,onSort:f}),(0,Q.jsx)($,{label:Me(),sortKey:`host`,sort:i,onSort:f}),(0,Q.jsx)($,{label:tt(),sortKey:`version`,sort:i,onSort:f}),(0,Q.jsx)(L,{children:We()}),(0,Q.jsx)($,{label:Ae(),sortKey:`lastOk`,sort:i,onSort:f})]})}),(0,Q.jsx)(R,{children:d.map(e=>(0,Q.jsx)(on,{r:e},e._id))})]})]})}function $({label:e,sortKey:t,sort:n,onSort:r}){let i=n?.key===t,a=i?n.dir:null;return(0,Q.jsx)(L,{"aria-sort":i?a===`asc`?`ascending`:`descending`:`none`,children:(0,Q.jsxs)(`button`,{type:`button`,className:`oc-conn__sort`,onClick:()=>r(t),children:[e,i?a===`asc`?(0,Q.jsx)(dt,{size:13,"aria-hidden":!0}):(0,Q.jsx)(T,{size:13,"aria-hidden":!0}):(0,Q.jsx)(ft,{size:13,"aria-hidden":!0,className:`oc-conn__sort-idle`})]})})}function on({r:e}){let t=Gt(e)?G(e.lastErrorCode):null,n=Kt(e)?G(e.lastDownstreamRejectCode):null;return(0,Q.jsxs)(K.Fragment,{children:[(0,Q.jsxs)(z,{className:`oc-conn__row oc-conn__row--${e.state}`,children:[(0,Q.jsx)(B,{children:(0,Q.jsx)(`code`,{className:`oc-traces__mono`,children:e.targetLabel})}),(0,Q.jsx)(B,{children:(0,Q.jsx)(cn,{state:e.state})}),(0,Q.jsx)(B,{children:e.instanceLabel?(0,Q.jsx)(`span`,{className:`oc-bridge-target__instance`,children:e.instanceLabel}):(0,Q.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})}),(0,Q.jsx)(B,{children:(0,Q.jsx)(`span`,{className:`oc-bridge-target__host`,children:e.gatewayHost})}),(0,Q.jsx)(B,{children:e.gatewayVersion?(0,Q.jsx)(`span`,{className:`oc-bridge-target__version`,children:e.gatewayVersion}):(0,Q.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})}),(0,Q.jsx)(B,{children:(0,Q.jsx)(`span`,{className:`oc-conn__stats`,children:ge({ok:e.okCount,errors:e.errorCount,attempts:e.attempts})})}),(0,Q.jsx)(B,{children:e.lastOkAt?(0,Q.jsx)(`span`,{className:`oc-traces__mono`,children:N(e.lastOkAt)}):(0,Q.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})})]}),t||n?(0,Q.jsx)(z,{className:`oc-conn__detail-row`,children:(0,Q.jsxs)(B,{colSpan:7,className:`oc-conn__detail-cell`,children:[t?(0,Q.jsxs)(`div`,{className:`oc-bridge-target__error`,children:[(0,Q.jsx)(`strong`,{children:t.label}),` `,(0,Q.jsx)(`code`,{className:`oc-traces__mono`,children:e.lastErrorCode}),e.lastErrorAt?` · ${N(e.lastErrorAt)}`:``,(0,Q.jsx)(`p`,{className:`oc-bridge-card__hint`,children:t.hint})]}):null,n?(0,Q.jsxs)(`div`,{className:`oc-bridge-target__downstream`,children:[st({label:n.label}),` `,(0,Q.jsx)(`code`,{className:`oc-traces__mono`,children:e.lastDownstreamRejectCode}),e.lastDownstreamRejectAt?` · ${N(e.lastDownstreamRejectAt)}`:``]}):null]})}):null]})}function sn(e){return e===`connected`?Qe():e===`error`?S():Ee()}function cn({state:e}){return e===`connected`?(0,Q.jsx)(j,{variant:`secondary`,children:Qe()}):e===`error`?(0,Q.jsx)(j,{variant:`destructive`,children:S()}):(0,Q.jsx)(j,{variant:`outline`,children:Ee()})}function ln(){return C(p.bridgeHealth.getBridgeHealth,{})}function un(){let e=ln(),t=C(p.compat.getBridgeCompat,{}),n=C(p.me.getMe,{host:Dt})?.role===`admin`,r=C(p.admin.listInstances,n?{}:`skip`),i=C(p.agents.usageForInstances,n?{}:`skip`),a=yt(),o=()=>void a({to:`/settings/anomalies`,search:{status:`open`}}),c=Jt(e?e.targets:[],t?t.targets:[],r??[]),l=t?.compat??null,u=t===void 0?`loading`:t===null?`nodata`:`ready`,d=l!==null&&Rt(l,`hermes`)&&!c.some(e=>e.key===`hermes`);return(0,Q.jsxs)(`div`,{className:`oc-bridge`,children:[(0,Q.jsx)(dn,{health:e,compat:t,onSeeAnomalies:o}),(0,Q.jsx)(`p`,{className:`oc-admin__hint oc-bridge__caption`,children:s()}),i&&i.length>0?(0,Q.jsxs)(`section`,{className:`oc-bridge__usage`,children:[(0,Q.jsx)(`h3`,{className:`oc-bridge__usage-title`,children:ut()}),(0,Q.jsxs)(V,{children:[(0,Q.jsx)(It,{children:(0,Q.jsxs)(z,{children:[(0,Q.jsx)(L,{children:ct()}),(0,Q.jsx)(L,{children:ke()}),(0,Q.jsx)(L,{children:lt()}),(0,Q.jsx)(L,{children:it()}),(0,Q.jsx)(L,{children:Te()})]})}),(0,Q.jsx)(R,{children:i.flatMap(e=>{let t=At(e.usage,Date.now());return t?t.windows.map((t,n)=>(0,Q.jsxs)(z,{children:[(0,Q.jsx)(B,{className:`font-medium`,children:n===0?e.instanceName:``}),(0,Q.jsx)(B,{children:t.provider}),(0,Q.jsx)(B,{children:t.label}),(0,Q.jsx)(B,{children:(0,Q.jsxs)(j,{variant:t.percentLeft<=10?`destructive`:t.percentLeft<=25?`outline`:`secondary`,children:[t.percentLeft,`%`]})}),(0,Q.jsx)(B,{className:`text-muted-foreground`,children:t.resetText??`—`})]},`${e.instanceName}:${t.provider}:${t.label}`)):[]})})]})]}):null,c.map(e=>(0,Q.jsx)(fn,{providerKey:e.key,connections:e.connections,instances:e.instances,manifest:l,compatStatus:u,compatReachable:t?.reachable??!0,protocol:e.key===`openclaw`?t?.protocol??null:null},e.key)),d?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:y()}):null]})}function dn({health:e,compat:t,onSeeAnomalies:n}){let r=t!=null&&t.buildVersion!=null&&t.bridgeVersion!=null&&t.buildVersion!==t.bridgeVersion,i=t?.buildRevision&&t.buildRevision!==`unknown`?t.buildRevision.slice(0,7):null,a=t&&t!==null?(0,Q.jsxs)(`span`,{className:`oc-bridge-card__ver`,children:[(0,Q.jsx)(`code`,{className:`oc-traces__mono`,children:H(t.bridgeVersion)}),i?(0,Q.jsxs)(Q.Fragment,{children:[` `,(0,Q.jsxs)(`code`,{className:`oc-traces__mono`,title:je(),children:[`(`,i,`)`]})]}):null,r?(0,Q.jsxs)(`strong`,{className:`oc-bridge-card__mismatch`,children:[` `,$e({build:t.buildVersion??`?`})]}):null,` · `,Je(),` `,(0,Q.jsx)(`code`,{className:`oc-traces__mono`,children:t.protocolVersion===null?De():String(t.protocolVersion)})]}):null;if(e===void 0)return(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:x()});if(e===null)return(0,Q.jsx)(`div`,{className:`oc-bridge-card oc-bridge-card--idle`,children:Ve()});let s=Ut(e.targets),c=!e.reachable,l=Wt(e),u=l?`ok`:`error`,d=vt(e.checkedAt),p=e.startedAt==null?null:vt(e.startedAt);return(0,Q.jsxs)(`div`,{className:`oc-bridge-card oc-bridge-card--${u}`,children:[(0,Q.jsx)(`div`,{className:`oc-bridge-card__icon`,"aria-hidden":!0,children:l?(0,Q.jsx)(k,{size:22}):c?(0,Q.jsx)(Ht,{size:22}):(0,Q.jsx)(O,{size:22})}),(0,Q.jsxs)(`div`,{className:`oc-bridge-card__body`,children:[(0,Q.jsx)(`div`,{className:`oc-bridge-card__title`,children:l?o():c?Ue():le({count:s.length})}),(0,Q.jsxs)(`div`,{className:`oc-bridge-card__meta`,children:[(0,Q.jsxs)(`span`,{children:[(0,Q.jsx)(Vt,{size:12,"aria-hidden":!0}),` `,f({time:d})]}),p?(0,Q.jsx)(`span`,{children:m({time:p})}):null,a]}),c?(0,Q.jsx)(`p`,{className:`oc-bridge-card__hint`,children:G(e.lastError===`not_configured`?`NOT_CONFIGURED`:`BRIDGE_UNREACHABLE`).hint}):null]}),(0,Q.jsx)(`button`,{type:`button`,className:`oc-bridgebar__drill`,onClick:n,children:_e()})]})}function fn({providerKey:e,connections:t,instances:n,manifest:r,compatStatus:i,compatReachable:a,protocol:o}){let s=r?zt(r,e):null,c=new Map;for(let e of n)c.set(e.name,e.displayName??e.name);let l=[],u=new Set;for(let n of t){if(!n.instanceName||u.has(n.instanceName))continue;u.add(n.instanceName);let t=n.gatewayVersion??null;l.push({instanceName:n.instanceName,displayName:c.get(n.instanceName)??n.instanceName,version:t,state:Bt(t,e,r)})}let d=l.map(e=>e.state),f=d.includes(`beyond`)?`beyond`:d.length>0&&d.every(e=>e===`supported`)?`supported`:null,[p,ee]=(0,K.useState)(!1);return(0,Q.jsxs)(`section`,{className:`oc-bridge-provider`,children:[(0,Q.jsxs)(`header`,{className:`oc-bridge-provider__head`,children:[(0,Q.jsx)(bt,{size:15,"aria-hidden":!0,className:`oc-bridge-provider__icon`}),(0,Q.jsx)(`span`,{className:`oc-bridge-provider__name`,children:Yt(e)}),f?(0,Q.jsx)(j,{variant:f===`beyond`?`destructive`:`secondary`,children:W(f)}):null]}),(0,Q.jsx)(`h4`,{className:`oc-bridge-provider__sub`,children:nt()}),(0,Q.jsx)(mn,{providerName:Yt(e),support:s,compatStatus:i,compatReachable:a,manifest:r,instanceRows:l}),o?(0,Q.jsx)(pn,{protocol:o}):null,(0,Q.jsxs)(`button`,{type:`button`,className:`oc-bridge-provider__sub oc-bridge-provider__sub--toggle`,"aria-expanded":p,onClick:()=>ee(e=>!e),children:[p?(0,Q.jsx)(T,{size:13,"aria-hidden":!0}):(0,Q.jsx)(Pt,{size:13,"aria-hidden":!0}),at({count:t.length})]}),p?(0,Q.jsx)(an,{connections:t,displayByInstance:c}):null]})}function pn({protocol:e}){let[t,n]=(0,K.useState)(!1),r=e.coverage,i=e.drift??[];return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`h4`,{className:`oc-bridge-provider__sub`,children:[me(),i.length>0?(0,Q.jsx)(j,{variant:`destructive`,children:v({count:i.length})}):(0,Q.jsx)(j,{variant:`secondary`,children:b()})]}),(0,Q.jsxs)(`p`,{className:`oc-admin__hint`,children:[g({version:e.vendoredVersion}),r?` · `+ue({handled:r.handled,ignored:r.ignored,gaps:r.gaps}):null]}),i.length>0?(0,Q.jsx)(`ul`,{className:`oc-bridge-protocol__list`,role:`list`,children:i.map(e=>(0,Q.jsxs)(`li`,{children:[(0,Q.jsx)(`code`,{className:`oc-traces__mono`,children:e.shape}),` × `,e.count]},e.shape))}):null,r&&r.gapList.length>0?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`button`,{type:`button`,className:`oc-bridge-provider__sub oc-bridge-provider__sub--toggle`,"aria-expanded":t,onClick:()=>n(e=>!e),children:[t?(0,Q.jsx)(T,{size:13,"aria-hidden":!0}):(0,Q.jsx)(Pt,{size:13,"aria-hidden":!0}),se({count:r.gapList.length})]}),t?(0,Q.jsx)(`ul`,{className:`oc-bridge-protocol__list`,role:`list`,children:r.gapList.map(e=>(0,Q.jsx)(`li`,{children:(0,Q.jsx)(`code`,{className:`oc-traces__mono`,children:e})},e))}):null]}):null]})}function mn({support:e,compatStatus:t,compatReachable:n,manifest:r,instanceRows:i,providerName:a}){return t===`loading`?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:x()}):t===`nodata`?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:Ge()}):(0,Q.jsxs)(`div`,{className:`oc-compat`,children:[n?null:(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:ze()}),r===null?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:Ze()}):(0,Q.jsxs)(`div`,{className:`oc-compat__support`,children:[(0,Q.jsx)(`span`,{className:`oc-compat__label`,children:ot({provider:a})}),e&&e.range!==null?(0,Q.jsx)(`span`,{children:qe({min:e.range.min,max:e.range.maxValidated})}):(0,Q.jsx)(`span`,{children:De()}),e?(0,Q.jsx)(vn,{versions:e.validatedVersions}):null]}),i.length===0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:pe()}):(0,Q.jsx)(`div`,{className:`oc-compat__targets`,children:i.map(e=>(0,Q.jsxs)(`div`,{className:`oc-compat__target`,children:[(0,Q.jsx)(`span`,{className:`oc-compat__instance`,children:e.displayName}),(0,Q.jsx)(`code`,{className:`oc-traces__mono`,children:H(e.version)}),(0,Q.jsx)(j,{variant:e.state===`supported`?`secondary`:e.state===`beyond`?`destructive`:`outline`,children:W(e.state)})]},e.instanceName))})]})}function hn({instance:e,onClose:t}){return(0,Q.jsx)(Mt,{open:!0,onOpenChange:e=>!e&&t(),children:(0,Q.jsxs)(wt,{className:`oc-bridge-config-dialog`,onOpenAutoFocus:e=>e.preventDefault(),children:[(0,Q.jsxs)(Tt,{children:[(0,Q.jsx)(Et,{children:_({instance:e.displayName??e.name})}),(0,Q.jsx)(kt,{children:h()})]}),(0,Q.jsx)(_n,{instance:e,onClose:t})]})})}function gn({label:e,result:t}){return t?t.checked?(0,Q.jsxs)(`p`,{className:`oc-bridge-config__check-row `+(t.ok?`oc-bridge-config__check-row--ok`:`oc-bridge-config__check-row--err`),children:[t.ok?(0,Q.jsx)(k,{"aria-hidden":!0}):(0,Q.jsx)(O,{"aria-hidden":!0}),(0,Q.jsxs)(`span`,{children:[e,` — `,t.ok?be():t.detail]})]}):(0,Q.jsxs)(`p`,{className:`oc-bridge-config__check-row oc-bridge-config__check-row--skip`,children:[e,` — `,ve()]}):null}function _n({instance:e,onClose:t}){let n=Pe(p.admin.upsertInstanceConfig),i=de(p.bridge.validateMediaPaths),o=Nt(),s=Ft(e.config?.contentLocale,void 0),[l,u]=(0,K.useState)(()=>pt(e.config??{},s)),[f,m]=(0,K.useState)(!1),[h,g]=(0,K.useState)(!1),[_,v]=(0,K.useState)(null),y=l.inboundMediaMode===`shared-fs`,b=l.mediaMode===`shared-fs`,x=y||b;async function se(){g(!0),v(null);try{v(await i({instanceName:e.name,inboundMediaMode:l.inboundMediaMode,mediaMode:l.mediaMode}))}catch(e){o.error(re(),e)}finally{g(!1)}}async function le(){m(!0);try{let r=e.config??{};await n({instanceId:e._id,config:ht(l,r,s)}),t()}catch(e){o.error(ce(),e)}finally{m(!1)}}return(0,Q.jsx)(`div`,{className:`oc-bridge-config`,children:(0,Q.jsxs)(`div`,{className:`oc-bridge-config__form`,children:[(0,Q.jsxs)(`div`,{className:`oc-bridge-config__grid`,children:[(0,Q.jsxs)(`label`,{className:`oc-field`,children:[(0,Q.jsx)(E,{label:oe(),help:d()}),(0,Q.jsxs)(M,{value:l.mediaMode,onValueChange:e=>u({...l,mediaMode:e}),children:[(0,Q.jsx)(D,{size:`sm`,className:`w-full`,children:(0,Q.jsx)(F,{})}),(0,Q.jsx)(I,{children:gt.map(e=>(0,Q.jsx)(A,{value:e,children:e},e))})]})]}),(0,Q.jsxs)(`label`,{className:`oc-field`,children:[(0,Q.jsx)(E,{label:ae(),help:ee()}),(0,Q.jsxs)(M,{value:l.inboundMediaMode,onValueChange:e=>u({...l,inboundMediaMode:e}),children:[(0,Q.jsx)(D,{size:`sm`,className:`w-full`,children:(0,Q.jsx)(F,{})}),(0,Q.jsx)(I,{children:mt.map(e=>(0,Q.jsx)(A,{value:e,children:e},e))})]})]}),(0,Q.jsxs)(`label`,{className:`oc-field`,children:[(0,Q.jsx)(E,{label:Be(),help:c()}),(0,Q.jsx)(P,{type:`number`,min:1,max:4096,className:`w-full`,value:l.mediaMaxMb,onChange:e=>u({...l,mediaMaxMb:Math.trunc(Number(e.target.value)||0)})})]})]}),x&&(0,Q.jsxs)(`div`,{className:`oc-bridge-config__grid`,children:[y&&(0,Q.jsxs)(`label`,{className:`oc-field`,children:[(0,Q.jsx)(E,{label:Ne(),help:r()}),(0,Q.jsx)(P,{className:`w-full`,spellCheck:!1,value:l.inboundAgentMount,onChange:e=>u({...l,inboundAgentMount:e.target.value})})]}),b&&(0,Q.jsxs)(`label`,{className:`oc-field`,children:[(0,Q.jsx)(E,{label:fe(),help:Ce()}),(0,Q.jsx)(P,{className:`w-full`,spellCheck:!1,value:l.outboundAgentMount,onChange:e=>u({...l,outboundAgentMount:e.target.value})})]})]}),(0,Q.jsxs)(`label`,{className:`oc-field--row`,children:[(0,Q.jsx)(jt,{checked:l.rehydration,onCheckedChange:e=>u({...l,rehydration:e===!0})}),(0,Q.jsx)(E,{label:a(),help:he()})]}),x&&_!==null&&(0,Q.jsx)(`div`,{className:`oc-bridge-config__check`,children:_.reachable?!_.inbound&&!_.outbound?(0,Q.jsxs)(`p`,{className:`oc-bridge-config__check-row oc-bridge-config__check-row--err`,children:[(0,Q.jsx)(O,{"aria-hidden":!0}),ye({reason:_.reason??`?`})]}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(gn,{label:ie(),result:_.inbound}),(0,Q.jsx)(gn,{label:te(),result:_.outbound}),(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:Xe()})]}):(0,Q.jsxs)(`p`,{className:`oc-bridge-config__check-row oc-bridge-config__check-row--err`,children:[(0,Q.jsx)(O,{"aria-hidden":!0}),ne()]})}),(0,Q.jsxs)(`div`,{className:`oc-bridge-config__actions`,children:[x&&(0,Q.jsxs)(_t,{variant:`outline`,size:`sm`,onClick:()=>void se(),disabled:h,children:[h?(0,Q.jsx)(Ot,{className:`size-4 animate-spin`,"aria-hidden":!0}):null,h?Se():xe()]}),(0,Q.jsx)(_t,{size:`sm`,onClick:()=>void le(),disabled:f,children:He()})]})]})})}function vn({versions:e}){if(e.length===0)return null;let t=[...e].reverse();return(0,Q.jsxs)(St,{children:[(0,Q.jsx)(xt,{asChild:!0,children:(0,Q.jsxs)(`button`,{type:`button`,className:`oc-compat__versions-btn`,children:[e.length===1?et():Fe({count:e.length}),(0,Q.jsx)(T,{size:13,"aria-hidden":!0})]})}),(0,Q.jsxs)(Ct,{className:`oc-compat__versions-pop`,align:`start`,children:[(0,Q.jsx)(`p`,{className:`oc-compat__versions-title`,children:i()}),(0,Q.jsx)(`div`,{className:`oc-compat__versions-list`,children:t.map(e=>(0,Q.jsx)(j,{variant:`secondary`,children:e},e))})]})]})}export{un as BridgeTab,hn as InstanceConfigDialog};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Br as r,Ct as i,Dc as a,E as o,Ec as s,Gr as c,Hr as l,KA as u,Kr as d,Nc as f,Ph as p,QA as m,Ur as h,Vr as g,Wr as _,Ys as v,_s as y,ds as b,ej as x,fs as S,gs as C,hs as w,jc as T,ms as E,ps as D,tj as O,vs as k,ys as A}from"./dist-0NlyORTv.js";import{t as j}from"./button-CW3POj4v.js";import{C as M,Ct as N,S as P,b as F,d as I,f as L,ot as R,p as z,w as B,x as V,y as H}from"./index-Oefe3uVe.js";import{i as U}from"./compatView-C2GqOCte.js";/* empty css */var W=t(e(),1),G=[`off`,`minimal`,`low`,`medium`,`high`,`xhigh`];function K(e){let t=typeof e==`object`&&e?e:{},n=t.defaults!==null&&typeof t.defaults==`object`?t.defaults:{},r=n.thinkingDefault??t.thinkingDefault,i=n.fastModeDefault??t.fastModeDefault;return{thinkingDefault:typeof r==`string`?r:null,fastModeDefault:typeof i==`boolean`?i:null}}var q=n();function J({instance:e}){let t=x(o.admin.upsertInstanceConfig),n=e.config?.curationEnabled===!0,r=typeof e.config?.curationBudgetChars==`number`?e.config.curationBudgetChars:null,[i,a]=(0,W.useState)(n),[s,c]=(0,W.useState)(r===null?``:String(r)),[u,d]=(0,W.useState)(`idle`);(0,W.useEffect)(()=>{a(n),c(r===null?``:String(r)),d(`idle`)},[e._id,n,r]);let p=s.trim(),m=p===``?null:/^\d+$/.test(p)?Number.parseInt(p,10):NaN,v=!i||m===null||Number.isInteger(m)&&m>=4e3&&m<=6e4,y=i!==n||(m??null)!==r;async function C(){d(`saving`);try{let n={...e.config??{}};n.curationEnabled=i,!i||m===null||Number.isNaN(m)?delete n.curationBudgetChars:n.curationBudgetChars=m,await t({instanceId:e._id,config:n}),d(`done`)}catch{d(`error`)}}return(0,q.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,q.jsxs)(`label`,{className:`oc-cdefaults__inline`,style:{cursor:`pointer`},children:[(0,q.jsx)(z,{checked:i,onCheckedChange:e=>a(e===!0),"aria-label":_()}),(0,q.jsx)(`span`,{className:`oc-cdefaults__label`,children:_()})]}),(0,q.jsxs)(`div`,{className:`oc-cdefaults__inline`,children:[(0,q.jsx)(R,{type:`number`,min:4e3,max:6e4,step:1e3,placeholder:`20000`,value:s,onChange:e=>c(e.target.value),className:`oc-cdefaults__number`,"aria-invalid":!v,"aria-label":h(),disabled:!i}),(0,q.jsx)(j,{size:`sm`,disabled:!y||!v||u===`saving`,onClick:()=>void C(),children:u===`saving`?f():D()})]}),v?null:(0,q.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:l()}),u===`done`?(0,q.jsx)(`p`,{className:`oc-admin__hint`,role:`status`,children:S()}):null,u===`error`?(0,q.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:b()}):null,(0,q.jsx)(`p`,{className:`oc-cdefaults__help`,children:g()})]})}function Y({instance:e}){let t=x(o.admin.upsertInstanceConfig),n=typeof e.config?.summarizeThresholdChars==`number`?e.config.summarizeThresholdChars:null,[i,a]=(0,W.useState)(n===null?``:String(n)),[s,l]=(0,W.useState)(`idle`);(0,W.useEffect)(()=>{a(n===null?``:String(n)),l(`idle`)},[e._id,n]);let u=i.trim(),p=u===``?null:/^\d+$/.test(u)?Number.parseInt(u,10):NaN,m=p===null||Number.isInteger(p)&&p>=1e3&&p<=2e5,h=(p??null)!==n;async function g(){l(`saving`);try{let n={...e.config??{}};p===null?delete n.summarizeThresholdChars:n.summarizeThresholdChars=p,await t({instanceId:e._id,config:n}),l(`done`)}catch{l(`error`)}}return(0,q.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,q.jsx)(`span`,{className:`oc-cdefaults__label`,children:d()}),(0,q.jsxs)(`div`,{className:`oc-cdefaults__inline`,children:[(0,q.jsx)(R,{type:`number`,min:1e3,max:2e5,step:1e3,placeholder:`8000`,value:i,onChange:e=>a(e.target.value),className:`oc-cdefaults__number`,"aria-invalid":!m}),(0,q.jsx)(j,{size:`sm`,disabled:!h||!m||s===`saving`,onClick:()=>void g(),children:s===`saving`?f():D()})]}),m?null:(0,q.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:r()}),s===`done`?(0,q.jsx)(`p`,{className:`oc-admin__hint`,role:`status`,children:S()}):null,s===`error`?(0,q.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:b()}):null,(0,q.jsx)(`p`,{className:`oc-cdefaults__help`,children:c()})]})}function X(){let e=m(o.agentFiles.getChatDefaults),[t,n]=(0,W.useState)({status:`loading`}),r=O(o.admin.listInstances,{}),[c,l]=(0,W.useState)(null);(0,W.useEffect)(()=>{!r||r.length===0||(!c||!r.some(e=>e.name===c))&&l(r[0].name)},[r,c]);let d=(r?.length??0)>1,f=r!==void 0&&r.length===0,h=O(o.compat.forInstance,c?{instanceName:c}:`skip`),g=c?H(h,`configDefaults`):`loading`,_=g===`loading`?null:g.blocked,b=(0,W.useMemo)(()=>d&&c?{instanceName:c}:{},[d,c]),x=(0,W.useRef)(0),S=(0,W.useCallback)(async()=>{let t=++x.current;n({status:`loading`});try{let r=K(await e(b));if(x.current!==t)return;n({status:`done`,current:r})}catch{if(x.current!==t)return;n({status:`error`})}},[e,b]);(0,W.useEffect)(()=>{_===!1&&(d&&!c||S())},[S,_,d,c]);let D=t.status===`done`?t.current:null,R=(0,W.useMemo)(()=>G.map(e=>({id:e,label:L(e)})),[]),z=(0,W.useMemo)(()=>[{id:`fast`,label:a()},{id:`standard`,label:s()}],[]);return(0,q.jsxs)(`div`,{className:`oc-cdefaults`,children:[(0,q.jsx)(`p`,{className:`oc-admin__hint`,children:A()}),d&&c?(0,q.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,q.jsx)(`span`,{className:`oc-cdefaults__label`,children:v()}),(0,q.jsxs)(F,{value:c,onValueChange:e=>l(e),children:[(0,q.jsx)(M,{size:`sm`,"aria-label":v(),children:(0,q.jsx)(B,{})}),(0,q.jsx)(V,{children:(r??[]).map(e=>(0,q.jsx)(P,{value:e.name,children:e.name},e.name))})]})]}):null,f?(0,q.jsx)(`p`,{className:`oc-admin__hint`,role:`status`,children:p()}):g===`loading`?(0,q.jsx)(`p`,{className:`oc-admin__hint`,children:u()}):g.blocked?(0,q.jsxs)(`p`,{className:`oc-compat__blocked`,role:`status`,children:[(0,q.jsx)(N,{size:14,"aria-hidden":!0}),` `,U(g.gatewayVersion,g.provider)]}):t.status===`loading`?(0,q.jsx)(`p`,{className:`oc-admin__hint`,children:u()}):t.status===`error`?(0,q.jsxs)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:[E(),` `,(0,q.jsx)(j,{variant:`outline`,size:`sm`,onClick:()=>void S(),children:T()})]}):(0,q.jsxs)(q.Fragment,{children:[(0,q.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,q.jsx)(`span`,{className:`oc-cdefaults__label`,children:k()}),(0,q.jsx)(I,{options:R,value:D?.thinkingDefault??null,onChange:()=>{},disabled:!0}),(0,q.jsx)(`p`,{className:`oc-cdefaults__help`,children:y()})]}),(0,q.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,q.jsx)(`span`,{className:`oc-cdefaults__label`,children:C()}),(0,q.jsx)(I,{options:z,value:D===null||D.fastModeDefault===null?null:D.fastModeDefault?`fast`:`standard`,onChange:()=>{},disabled:!0}),(0,q.jsx)(`p`,{className:`oc-cdefaults__help`,children:w()})]}),(0,q.jsx)(`p`,{className:`oc-cdefaults__note`,children:i()})]}),(()=>{let e=r?.find(e=>e.name===(c??r[0]?.name));return e?(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(Y,{instance:e}),(0,q.jsx)(J,{instance:e})]}):null})()]})}export{X as ChatDefaultsTab};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Fd as r,Id as i,Ld as a,Md as o,Nd as s,Pd as c,Rd as l}from"./dist-0NlyORTv.js";import{i as u,r as d}from"./dist-PBgCwwDJ.js";import{t as f}from"./chevrons-up-down-CTpaTY5v.js";import{t as p}from"./button-CW3POj4v.js";import{$ as m,Pt as h,et as g,it as _,kt as v,p as y,rt as b,tt as x,wt as S}from"./index-Oefe3uVe.js";import{a as C,i as w,n as T,o as E,r as D,t as O}from"./table-BytigxuJ.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=l(),bulkActions:F,emptyHint:I=a(),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)(S,{}):null,e.label,` (`,z.size,`)`]},e.label)):null,N?(0,M.jsxs)(p,{size:`sm`,onClick:N,children:[(0,M.jsx)(v,{}),` `,P]}):null]})]}),t===void 0?(0,M.jsx)(`p`,{className:`oc-admin__hint`,children:i()}):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)(y,{"aria-label":r(),checked:J?!0:Y?`indeterminate`:!1,onCheckedChange:X})}):null,n.map((e,t)=>{let n=V?.index===t;return e.sort?(0,M.jsx)(w,{className:e.className,"aria-sort":n?V.dir===`asc`?`ascending`:`descending`:`none`,children:(0,M.jsxs)(`button`,{type:`button`,className:`oc-dt__sort`,onClick:()=>K(t),"aria-label":o({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)(y,{"aria-label":c(),checked:z.has(e._id),onCheckedChange:()=>Z(e._id)})}):null,n.map(t=>(0,M.jsx)(D,{className:t.className,children:t.cell(e)},t.header)),A?(0,M.jsx)(D,{children:t.length>0?(0,M.jsxs)(m,{children:[(0,M.jsx)(_,{asChild:!0,children:(0,M.jsx)(p,{variant:`ghost`,size:`icon-sm`,"aria-label":s(),className:`opacity-0 transition-opacity group-hover/row:opacity-100 group-focus-within/row:opacity-100 aria-expanded:opacity-100`,children:(0,M.jsx)(h,{})})}),(0,M.jsx)(g,{align:`end`,children:t.map((t,n)=>(0,M.jsxs)(`div`,{children:[t.variant===`destructive`&&n>0?(0,M.jsx)(b,{}):null,(0,M.jsx)(x,{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{
|
|
1
|
+
import{r as e}from"./bundle-mjs-C73ZY4La.js";import{at as t}from"./index-Oefe3uVe.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{$x as r,AS as i,BS as a,CS as o,DS as s,E as c,ES as l,FS as u,Gx as d,HS as f,IS as p,Jx as m,Kx as h,LS as g,MS as _,NS as ee,OS as te,PS as ne,Qx as re,RS as ie,SS as ae,TS as v,US as y,Ux as b,VS as x,WS as S,Wx as C,Xx as w,Yx as T,Zx as E,_S as D,aS as O,ar as k,bS as A,cS as j,dS as M,eS as N,ej as P,fS as F,gS as I,hS as L,iS as R,jS as z,kS as B,lS as V,mS as oe,nS as H,oS as U,pS as W,qx as G,rS as K,sS as q,sr as se,tS as ce,tj as le,uS as ue,vS as de,wS as J,xS as fe,yS as pe,zS as me}from"./dist-0NlyORTv.js";import{t as he}from"./button-CW3POj4v.js";import{A as ge,B as _e}from"./index-Oefe3uVe.js";import{t as Y}from"./DataTableShell-2dt7qzK1.js";var X=t(e(),1),Z=n(),ve={altered_words:()=>S(),incorrect:()=>y(),incoherence:()=>f(),formatting:()=>x(),latency:()=>a(),api_error:()=>me(),other:()=>ie()},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:p()}):e===!1?(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-warn`,children:u()}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill`,children:`—`}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill`,children:g()})}function ye({data:e,closeReason:t}){let n=e.snapshot,r=P(c.feedback.respondToFeedback),[a,u]=(0,X.useState)(e.thread),[d,f]=(0,X.useState)(``),[p,m]=(0,X.useState)(!1);async function h(){let t=d.trim();if(!(!t||p)){m(!0);try{await r({feedbackId:e._id,text:t}),u(e=>[...e,{authorRole:`admin`,text:t,at:Date.now()}]),f(``)}finally{m(!1)}}}let g=[];try{g=n.contextJson?JSON.parse(n.contextJson):[]}catch{g=[]}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?` · ${ne()}`:``,n.openclawModel?` · ${n.openclawModel}`:``,n.openclawRuntime?` (${n.openclawRuntime})`:``]})]}),e.comment?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:ee()}),(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:T()}),(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:_()}),a.length>0?(0,Z.jsx)(`div`,{className:`oc-fbadmin__thread`,children:a.map((e,t)=>(0,Z.jsxs)(`div`,{className:`oc-notif__msg oc-notif__msg--${e.authorRole}`,children:[(0,Z.jsx)(`span`,{className:`oc-notif__msg-who`,children:e.authorRole===`admin`?z():e.authorRole===`agent`?e.authorLabel??se():i()}),(0,Z.jsx)(`span`,{className:`oc-notif__msg-text`,children:e.text})]},t))}):(0,Z.jsx)(`p`,{className:`oc-fbadmin__meta`,children:B()}),(0,Z.jsx)(`textarea`,{className:`oc-feedback__textarea`,placeholder:te(),value:d,maxLength:2e3,rows:3,onChange:e=>f(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 h(),disabled:!d.trim()||p,children:p?s():l()})})]}),(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:v()}),(0,Z.jsx)(`pre`,{className:`oc-msg__source-pre`,children:n.messageText||J()})]}),n.clientInfo?.sourceWasOpen&&n.displayedText!==void 0?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:o()}),(0,Z.jsx)(`pre`,{className:`oc-msg__source-pre`,children:n.displayedText||J()})]}):null,n.promptText?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:ae()}),(0,Z.jsx)(`pre`,{className:`oc-msg__source-pre`,children:n.promptText})]}):null,g.length>0?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:fe({count:n.contextCount??g.length,truncated:n.contextTruncated?A():``})}),(0,Z.jsx)(`div`,{className:`oc-fbadmin__ctx`,children:g.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:pe()}),(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:de()}),(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:D()}),(0,Z.jsxs)(`p`,{className:`oc-fbadmin__env`,children:[[n.clientInfo?.language,n.clientInfo?.timezone,n.clientInfo?.theme?I({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:[L(),` `,n.clientInfo.plugins.join(`, `),(0,Z.jsxs)(`span`,{className:`oc-fbadmin__note`,children:[` `,oe()]})]}):null,n.clientInfo?.userAgent?(0,Z.jsx)(`span`,{className:`oc-fbadmin__ua`,children:n.clientInfo.userAgent}):null]})]})]})}function be(){let e=le(c.feedback.listForAdmin,{}),t=P(c.feedback.readSnapshot),n=P(c.feedback.deleteFeedback),i=_e(),[a,o]=(0,X.useState)(null),[s,l]=(0,X.useState)({});async function u(e){if(a===e._id){o(null);return}if(!s[e._id]){let n=await t({feedbackId:e._id});l(t=>({...t,[e._id]:n}))}o(e._id)}async function f(e){await i({title:d(),description:C(),confirmLabel:b(),destructive:!0})&&(await n({feedbackId:e._id}),a===e._id&&o(null))}return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`p`,{className:`oc-admin__hint`,children:[W(),` `,(0,Z.jsx)(`strong`,{children:F()}),` `,M()]}),(0,Z.jsx)(Y,{title:ue(),rows:e,emptyHint:V(),isExpanded:e=>a===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=>ge(e.at),sort:e=>e.at},{header:q(),cell:e=>Q(e.category),sort:e=>Q(e.category)},{header:U(),cell:e=>e.messageRole===`user`?O():R(),sort:e=>e.messageRole},{header:K(),cell:e=>(e.reporterEmail||e.reporterName||`—`)+(e.impersonated&&e.realOperatorEmail?` ${H({operator:e.realOperatorEmail})}`:``),sort:e=>e.reporterEmail||e.reporterName||null},{header:ce(),cell:e=>(0,Z.jsx)($,{matches:e.displayedMatchesStored,sourceWasOpen:e.sourceWasOpen}),sort:e=>e.displayedMatchesStored===!1?0:e.displayedMatchesStored===!0?1:2},{header:N(),cell:e=>e.hasComment?`✎`:`—`,sort:e=>+!!e.hasComment},{header:r(),cell:e=>e.userClosedAt==null?e.resolvedAt==null?e.answered?(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-ok`,children:re()}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill`,children:E()}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-ok`,title:e.resolvedBy??void 0,children:k()}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-closed`,children:w()}),sort:e=>e.userClosedAt==null?e.resolvedAt==null?+!!e.answered:2:3}],rowActions:e=>[{label:a===e._id?m():G(),onSelect:()=>void u(e)},{label:h(),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,cj as n}from"./dist-0NlyORTv.js";import{_ as r,g as i,h as a,v as o}from"./index-Oefe3uVe.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:
|
|
@@ -72,4 +72,4 @@ STRICT OUTPUT RULES:
|
|
|
72
72
|
[ADMIN FEEDBACK]
|
|
73
73
|
{feedback}
|
|
74
74
|
|
|
75
|
-
{content}`}}},l=Object.keys(c);function u(e,t,n){return t.enabled?t.template:c[e].disabledTemplate?.[n]??``}function d(e,t){return e.replace(/\{(\w+)\}/g,(e,n)=>{let r=t[n];return r===void 0?e:r})}var f=[`gateway-http`,`shared-fs`,`off`],p=[`inline`,`shared-fs`],m=[`reactive`,`sse`],h=`reactive`;n.object({mediaMode:n.optional(n.union(n.literal(`gateway-http`),n.literal(`shared-fs`),n.literal(`off`))),inboundMediaMode:n.optional(n.union(n.literal(`inline`),n.literal(`shared-fs`))),rehydration:n.optional(n.boolean()),mediaMaxMb:n.optional(n.number()),summarizeThresholdChars:n.optional(n.number()),curationEnabled:n.optional(n.boolean()),curationBudgetChars:n.optional(n.number()),contentLocale:n.optional(n.string()),inboundAgentMount:n.optional(n.string()),outboundAgentMount:n.optional(n.string()),promptInjections:n.optional(n.record(n.string(),n.object({enabled:n.optional(n.boolean()),template:n.optional(n.string())})))});var g={mediaMode:`gateway-http`,inboundMediaMode:`inline`,rehydration:!0,mediaMaxMb:1024,inboundAgentMount:`/home/node/.openclaw/media/inbound`,outboundAgentMount:`/home/node/.openclaw/media/outbound`};function _(e,t){let n={};for(let r of l){let i=e?.[r];n[r]={enabled:i?.enabled??!0,template:typeof i?.template==`string`&&i.template.length>0?i.template:c[r].defaultTemplate[t]}}return n}function v(e,t){let n={};for(let r of l){let i=c[r],a=e[r];if(!a)continue;let o={};i.togglable&&a.enabled===!1&&(o.enabled=!1);let s=a.template.trim();s.length>0&&s!==i.defaultTemplate[t]&&(o.template=s),(o.enabled!==void 0||o.template!==void 0)&&(n[r]=o)}return n}function y(e,t){return{mediaMode:e.mediaMode??g.mediaMode,inboundMediaMode:e.inboundMediaMode??g.inboundMediaMode,rehydration:e.rehydration??g.rehydration,mediaMaxMb:e.mediaMaxMb??g.mediaMaxMb,inboundAgentMount:e.inboundAgentMount??g.inboundAgentMount,outboundAgentMount:e.outboundAgentMount??g.outboundAgentMount,promptInjections:_(e.promptInjections,t)}}var b=[`summarizeThresholdChars`,`curationEnabled`,`curationBudgetChars`,`contentLocale`];function x(e,t,n){let r={},i=n=>{(e[n]!==g[n]||t[n]!==void 0)&&(r[n]=e[n])};i(`mediaMode`),i(`inboundMediaMode`),i(`rehydration`),i(`mediaMaxMb`),i(`inboundAgentMount`),i(`outboundAgentMount`);let a=v(e.promptInjections,n);Object.keys(a).length>0&&(r.promptInjections=a);let o=t;for(let e of b){let t=o[e];(typeof t==`number`||typeof t==`boolean`||typeof t==`string`)&&(r[e]=t)}return r}var S=e();function C({text:e}){return(0,S.jsx)(r,{delayDuration:150,children:(0,S.jsxs)(a,{children:[(0,S.jsx)(o,{asChild:!0,children:(0,S.jsx)(`button`,{type:`button`,className:`oc-field__help`,"aria-label":e,onClick:e=>e.preventDefault(),children:(0,S.jsx)(s,{"aria-hidden":!0})})}),(0,S.jsx)(i,{className:`max-w-xs text-pretty`,children:e})]})})}function w({label:e,help:t}){return(0,S.jsxs)(`span`,{className:`oc-field__label`,children:[e,(0,S.jsx)(C,{text:t})]})}export{h as a,m as c,u as d,d as f,y as i,c as l,w as n,p as o,x as r,f as s,C as t,l as u};
|
|
75
|
+
{content}`}}},l=Object.keys(c);function u(e,t,n){return t.enabled?t.template:c[e].disabledTemplate?.[n]??``}function d(e,t){return e.replace(/\{(\w+)\}/g,(e,n)=>{let r=t[n];return r===void 0?e:r})}var f=[`gateway-http`,`shared-fs`,`off`],p=[`inline`,`shared-fs`],m=[`reactive`,`sse`],h=`reactive`;n.object({mediaMode:n.optional(n.union(n.literal(`gateway-http`),n.literal(`shared-fs`),n.literal(`off`))),inboundMediaMode:n.optional(n.union(n.literal(`inline`),n.literal(`shared-fs`))),rehydration:n.optional(n.boolean()),mediaMaxMb:n.optional(n.number()),summarizeThresholdChars:n.optional(n.number()),curationEnabled:n.optional(n.boolean()),curationBudgetChars:n.optional(n.number()),voiceEnabled:n.optional(n.boolean()),voiceLang:n.optional(n.string()),voiceRate:n.optional(n.number()),voiceAutoRead:n.optional(n.boolean()),contentLocale:n.optional(n.string()),inboundAgentMount:n.optional(n.string()),outboundAgentMount:n.optional(n.string()),promptInjections:n.optional(n.record(n.string(),n.object({enabled:n.optional(n.boolean()),template:n.optional(n.string())})))});var g={mediaMode:`gateway-http`,inboundMediaMode:`inline`,rehydration:!0,mediaMaxMb:1024,inboundAgentMount:`/home/node/.openclaw/media/inbound`,outboundAgentMount:`/home/node/.openclaw/media/outbound`};function _(e,t){let n={};for(let r of l){let i=e?.[r];n[r]={enabled:i?.enabled??!0,template:typeof i?.template==`string`&&i.template.length>0?i.template:c[r].defaultTemplate[t]}}return n}function v(e,t){let n={};for(let r of l){let i=c[r],a=e[r];if(!a)continue;let o={};i.togglable&&a.enabled===!1&&(o.enabled=!1);let s=a.template.trim();s.length>0&&s!==i.defaultTemplate[t]&&(o.template=s),(o.enabled!==void 0||o.template!==void 0)&&(n[r]=o)}return n}function y(e,t){return{mediaMode:e.mediaMode??g.mediaMode,inboundMediaMode:e.inboundMediaMode??g.inboundMediaMode,rehydration:e.rehydration??g.rehydration,mediaMaxMb:e.mediaMaxMb??g.mediaMaxMb,inboundAgentMount:e.inboundAgentMount??g.inboundAgentMount,outboundAgentMount:e.outboundAgentMount??g.outboundAgentMount,promptInjections:_(e.promptInjections,t)}}var b=[`summarizeThresholdChars`,`curationEnabled`,`curationBudgetChars`,`contentLocale`];function x(e,t,n){let r={},i=n=>{(e[n]!==g[n]||t[n]!==void 0)&&(r[n]=e[n])};i(`mediaMode`),i(`inboundMediaMode`),i(`rehydration`),i(`mediaMaxMb`),i(`inboundAgentMount`),i(`outboundAgentMount`);let a=v(e.promptInjections,n);Object.keys(a).length>0&&(r.promptInjections=a);let o=t;for(let e of b){let t=o[e];(typeof t==`number`||typeof t==`boolean`||typeof t==`string`)&&(r[e]=t)}return r}var S=e();function C({text:e}){return(0,S.jsx)(r,{delayDuration:150,children:(0,S.jsxs)(a,{children:[(0,S.jsx)(o,{asChild:!0,children:(0,S.jsx)(`button`,{type:`button`,className:`oc-field__help`,"aria-label":e,onClick:e=>e.preventDefault(),children:(0,S.jsx)(s,{"aria-hidden":!0})})}),(0,S.jsx)(i,{className:`max-w-xs text-pretty`,children:e})]})})}function w({label:e,help:t}){return(0,S.jsxs)(`span`,{className:`oc-field__label`,children:[e,(0,S.jsx)(C,{text:t})]})}export{h as a,m as c,u as d,d as f,y as i,c as l,w as n,p as o,x as r,f as s,C as t,l as u};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$k as r,CA as i,E as a,EA as o,Gk as ee,JA as te,Jk as ne,KA as re,Kk as ie,PT as ae,Qk as oe,SA as s,TA as c,Xk as l,Yk as u,Zk as se,_A as ce,aA as le,bA as ue,cA as de,dA as d,dr as f,eA as fe,ej as pe,fA as p,gA as me,hA as m,iA as he,lA as h,mA as g,nA as ge,oA as _e,pA as _,qk as ve,rA as ye,sA as be,tA as xe,tj as v,uA as y,ur as b,vA as x,wA as S,xA as C,yA as w}from"./dist-0NlyORTv.js";import{t as T}from"./button-CW3POj4v.js";import{$ as E,C as D,Ft as O,G as k,H as A,J as j,K as M,Ot as Se,Pt as Ce,S as N,U as we,W as Te,Y as Ee,at as P,b as F,et as De,it as Oe,p as ke,q as Ae,tt as I,w as L,wt as je,x as R,z as Me}from"./index-Oefe3uVe.js";import{a as Ne,i as z,n as Pe,o as B,r as V,t as Fe}from"./table-BytigxuJ.js";var H=t(e(),1),U=n(),W=`all`;function G(e){switch(e){case`image`:return m();case`audio`:return g();case`video`:return _();case`pdf`:return p();case`document`:return d();case`archive`:return y();default:return h()}}function K(){let[e,t]=(0,H.useState)(W),[n,d]=(0,H.useState)(W),[p,m]=(0,H.useState)(W),[h,g]=(0,H.useState)(W),[_,y]=(0,H.useState)(!1),[K,q]=(0,H.useState)(null),J=pe(a.files.softDelete),Y=Me();function Ie(){t(W),d(W),m(W),g(W)}async function Le(){let e=K;if(q(null),e)try{await J({fileId:e.id}),Y.success(oe())}catch(e){Y.error(se(),e)}}let X=v(a.files.listMine,{direction:e===W?void 0:e,chatId:n===W?void 0:n,instanceName:p===W?void 0:p,category:h===W?void 0:h,includeAutoGenerated:_||void 0}),Re=(0,H.useMemo)(()=>new Intl.DateTimeFormat(te(),{dateStyle:`medium`,timeStyle:`short`}),[]);if(X===void 0)return(0,U.jsx)(`p`,{className:`oc-admin__hint`,children:re()});let{files:Z,facets:Q,truncated:ze,cap:Be}=X,$=e!==W||n!==W||p!==W||h!==W;return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`p`,{className:`oc-admin__hint`,children:o()}),(0,U.jsxs)(`div`,{className:`oc-files__filters`,style:{display:`flex`,flexWrap:`wrap`,gap:8,margin:`12px 0`},children:[(0,U.jsxs)(F,{value:e,onValueChange:t,children:[(0,U.jsx)(D,{size:`sm`,"aria-label":c(),children:(0,U.jsx)(L,{})}),(0,U.jsxs)(R,{children:[(0,U.jsx)(N,{value:W,children:S()}),(0,U.jsx)(N,{value:`inbound`,children:i()}),(0,U.jsx)(N,{value:`outbound`,children:s()})]})]}),(0,U.jsxs)(F,{value:n,onValueChange:d,children:[(0,U.jsx)(D,{size:`sm`,"aria-label":C(),children:(0,U.jsx)(L,{})}),(0,U.jsxs)(R,{children:[(0,U.jsx)(N,{value:W,children:ue()}),Q.chats.map(e=>(0,U.jsx)(N,{value:e.id,children:e.title},e.id))]})]}),Q.multiProvider?(0,U.jsxs)(F,{value:p,onValueChange:m,children:[(0,U.jsx)(D,{size:`sm`,"aria-label":w(),children:(0,U.jsx)(L,{})}),(0,U.jsxs)(R,{children:[(0,U.jsx)(N,{value:W,children:x()}),Q.instances.map(e=>(0,U.jsx)(N,{value:e,children:e},e))]})]}):null,(0,U.jsxs)(F,{value:h,onValueChange:g,children:[(0,U.jsx)(D,{size:`sm`,"aria-label":ce(),children:(0,U.jsx)(L,{})}),(0,U.jsxs)(R,{children:[(0,U.jsx)(N,{value:W,children:me()}),Q.categories.map(e=>(0,U.jsx)(N,{value:e,children:G(e)},e))]})]}),(0,U.jsxs)(`label`,{className:`oc-files__autogen`,children:[(0,U.jsx)(ke,{checked:_,onCheckedChange:e=>y(e===!0),"aria-label":f()}),(0,U.jsx)(`span`,{children:f()})]}),$?(0,U.jsxs)(T,{variant:`ghost`,size:`sm`,onClick:Ie,style:{display:`inline-flex`,alignItems:`center`,gap:4,marginLeft:`auto`},children:[(0,U.jsx)(Se,{size:14,"aria-hidden":!0}),xe()]}):null]}),Z.length===0?(0,U.jsx)(`p`,{className:`oc-admin__hint`,children:$?ie():ve()}):(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(Fe,{children:[(0,U.jsx)(Ne,{children:(0,U.jsxs)(B,{children:[(0,U.jsx)(z,{children:de()}),(0,U.jsx)(z,{children:be()}),(0,U.jsx)(z,{children:_e()}),(0,U.jsx)(z,{children:le()}),(0,U.jsx)(z,{children:he()}),(0,U.jsx)(z,{className:`text-right`,children:ye()})]})}),(0,U.jsx)(Pe,{children:Z.map(e=>(0,U.jsxs)(B,{children:[(0,U.jsxs)(V,{className:`font-medium`,style:{maxWidth:280,overflow:`hidden`,textOverflow:`ellipsis`},title:e.filename,children:[e.filename,e.origin===`pasted`?(0,U.jsx)(P,{variant:`outline`,style:{marginLeft:6},children:b()}):null]}),(0,U.jsx)(V,{title:e.mimeType,children:G(e.category)}),(0,U.jsx)(V,{children:(0,U.jsx)(P,{variant:`secondary`,children:e.direction===`inbound`?i():s()})}),(0,U.jsx)(V,{style:{maxWidth:220,overflow:`hidden`,textOverflow:`ellipsis`},title:e.chatTitle,children:e.chatTitle}),(0,U.jsx)(V,{className:`whitespace-nowrap text-muted-foreground`,children:Re.format(e.createdAt)}),(0,U.jsx)(V,{className:`text-right`,children:(0,U.jsxs)(E,{children:[(0,U.jsx)(Oe,{asChild:!0,children:(0,U.jsx)(T,{variant:`ghost`,size:`icon`,"aria-label":fe(),children:(0,U.jsx)(Ce,{size:16})})}),(0,U.jsxs)(De,{align:`end`,children:[e.url?(0,U.jsx)(I,{asChild:!0,children:(0,U.jsxs)(`a`,{href:e.url,download:e.filename,target:`_blank`,rel:`noopener noreferrer`,children:[(0,U.jsx)(O,{size:14}),ge()]})}):(0,U.jsxs)(I,{disabled:!0,children:[(0,U.jsx)(O,{size:14}),ne()]}),(0,U.jsxs)(I,{variant:`destructive`,onSelect:()=>q({id:e._id,filename:e.filename}),children:[(0,U.jsx)(je,{size:14}),r()]})]})]})})]},e._id))})]}),ze?(0,U.jsx)(`p`,{className:`oc-admin__hint`,style:{marginTop:8},children:ee({cap:Be})}):null]}),(0,U.jsx)(A,{open:K!==null,onOpenChange:e=>!e&&q(null),children:(0,U.jsxs)(k,{children:[(0,U.jsxs)(j,{children:[(0,U.jsx)(Ee,{children:l()}),(0,U.jsx)(M,{children:u()})]}),(0,U.jsxs)(Ae,{children:[(0,U.jsx)(Te,{children:ae()}),(0,U.jsx)(we,{onClick:()=>void Le(),children:r()})]})]})})]})}export{K as FilesTab};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Bd as r,zd as i}from"./dist-0NlyORTv.js";import{t as a}from"./button-CW3POj4v.js";import{Dt as o,Ot as s,ot as c}from"./index-Oefe3uVe.js";import{t as l}from"./TimeRangePicker-BCP5a7nZ.js";var u=t(e(),1),d=n(),f=250;function p({q:e,onQChange:t,searchPlaceholder:n=r(),children:p,timeRange:m,onTimeRangeChange:h,onReset:g,canReset:_=!0}){let[v,y]=(0,u.useState)(e);(0,u.useEffect)(()=>{y(e)},[e]);let b=(0,u.useRef)(null);function x(e){y(e),b.current!==null&&window.clearTimeout(b.current),b.current=window.setTimeout(()=>t(e),f)}(0,u.useEffect)(()=>()=>{b.current!==null&&window.clearTimeout(b.current)},[]);function S(){b.current!==null&&window.clearTimeout(b.current),g()}return(0,d.jsxs)(`div`,{className:`oc-filterbar`,children:[(0,d.jsxs)(`div`,{className:`oc-filterbar__search`,children:[(0,d.jsx)(o,{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)(s,{}),i()]})]})}export{p as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$c as r,$l as i,Al as a,Bl as o,Cl as s,D as c,Dl as l,E as u,El as d,Fl as f,Gc as p,Gl as m,Hl as h,Il as g,Jc as _,Jl as v,Kc as y,Kl as b,Ll as x,Ml as S,Nl as ee,Ol as C,Pl as w,Qc as T,Ql as te,Rl as E,Sl as D,Tl as O,Ul as ne,Vl as k,Wl as A,Xc as j,Xl as re,Yc as M,Yl as ie,Zc as N,Zl as P,_l as F,al as ae,bl as I,cl as L,dl as R,ej as z,el as oe,eu as se,fl as ce,gl as B,hl as le,il as ue,jl as de,kl as fe,ll as pe,ml as me,nl as he,ol as ge,pl as _e,qc as ve,ql as ye,rl as be,sl as xe,tj as V,tl as Se,ul as Ce,vl as we,wl as Te,xl as Ee,yl as De,zl as Oe}from"./dist-0NlyORTv.js";import{t as ke}from"./x-C93RBiVN.js";import{i as H,n as U,r as Ae,t as je}from"./tabs-j7vaNyRB.js";import{t as W}from"./button-CW3POj4v.js";import{B as Me,C as Ne,Et as G,S as Pe,Tt as K,at as q,b as Fe,ct as Ie,dt as Le,ft as Re,ht as ze,lt as Be,ot as J,p as Y,st as Ve,u as He,w as Ue,x as We,z as X,zt as Ge}from"./index-Oefe3uVe.js";import{t as Ke}from"./FilterBar-C4F1dTQ_.js";import{t as qe}from"./DataTableShell-2dt7qzK1.js";import{t as Z}from"./DetailChips-PeX_dqPr.js";var Je=c(`chevron-left`,[[`path`,{d:`m15 18-6-6 6-6`,key:`1wnfg3`}]]),Ye=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`}]]),Xe=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 Ee();case`user`:return I();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=V(u.groups.listGroups,{}),t=V(u.me.getMe,{host:ze})?.role===`admin`,n=z(u.groups.createGroup),r=z(u.groups.updateGroup),a=z(u.groups.deleteGroup),s=Me(),c=X(),[l,d]=(0,Q.useState)(!1),[p,y]=(0,Q.useState)(null),[S,C]=(0,Q.useState)(it),[T,D]=(0,Q.useState)(null),[O,j]=(0,Q.useState)(``),M=(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 N(){y(null),C(it),d(!0)}function F(e){y(e),C({name:e.name,description:e.description??``}),d(!0)}async function ae(){try{p?await r({groupId:p._id,name:S.name,description:S.description}):await n({name:S.name,description:S.description||void 0}),C(it),y(null),d(!1)}catch(e){c.error(_(),e)}}async function I(e){if(await s({title:f({name:e.name}),description:w(),confirmWord:e.name,confirmLabel:ee(),cancelLabel:k(),destructive:!0}))try{await a({groupId:e._id})}catch(e){c.error(ve(),e)}}return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`p`,{className:`oc-admin__hint`,children:i()}),(0,$.jsx)(Ke,{q:O,onQChange:j,onReset:()=>j(``),canReset:O!==``,searchPlaceholder:b()}),(0,$.jsx)(qe,{title:se(),rows:M,addLabel:te(),onAdd:t?N:void 0,emptyHint:P(),columns:[{header:re(),cell:e=>e.name,sort:e=>e.name},{header:ie(),cell:e=>(0,$.jsx)(Z,{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)(Xe,{size:11,"aria-hidden":!0}):null,highlight:e.manager}))}),sort:e=>e.memberCount},{header:v(),cell:e=>(0,$.jsx)(Z,{icon:(0,$.jsx)(G,{size:12,"aria-hidden":!0}),total:e.agentCount,items:e.agents.map(e=>({label:e}))}),sort:e=>e.agentCount},{header:ye(),cell:e=>(0,$.jsx)(Z,{icon:(0,$.jsx)(Ye,{size:12,"aria-hidden":!0}),total:e.chartCount,items:e.charts.map(e=>({label:e.name,marker:e.isDefault?(0,$.jsx)(K,{size:11,fill:`currentColor`,"aria-hidden":!0}):null,highlight:e.isDefault}))}),sort:e=>e.chartCount}],rowActions:e=>[{label:m(),onSelect:()=>D({groupId:e._id,name:e.name})},...t?[{label:A(),onSelect:()=>F(e)},{label:ne(),variant:`destructive`,onSelect:()=>void I(e)}]:[]]}),(0,$.jsx)(He,{open:l,onOpenChange:d,title:p?Oe():o(),description:E(),canSubmit:!!S.name.trim(),onSubmit:ae,submitLabel:h(),children:(0,$.jsxs)(`div`,{className:`oc-form`,children:[(0,$.jsxs)(`label`,{className:`oc-field`,children:[(0,$.jsx)(`span`,{className:`oc-field__label`,children:x()}),(0,$.jsx)(J,{value:S.name,onChange:e=>C({...S,name:e.target.value})})]}),(0,$.jsxs)(`label`,{className:`oc-field`,children:[(0,$.jsx)(`span`,{className:`oc-field__label`,children:g()}),(0,$.jsx)(J,{value:S.description,onChange:e=>C({...S,description:e.target.value})})]})]})}),(0,$.jsx)(ct,{groupId:T?.groupId??null,groupName:T?.name??``,open:T!==null,onOpenChange:e=>{e||D(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)(W,{type:`button`,variant:`ghost`,size:`sm`,disabled:e<=1,onClick:()=>n(e-1),children:[(0,$.jsx)(Je,{size:14,"aria-hidden":!0}),Te()]}),(0,$.jsxs)(`span`,{className:`oc-access__pageinfo`,"aria-label":D({page:e,pages:t}),children:[e,` / `,t]}),(0,$.jsxs)(W,{type:`button`,variant:`ghost`,size:`sm`,disabled:e>=t,onClick:()=>n(e+1),children:[s(),(0,$.jsx)(Ge,{size:14,"aria-hidden":!0})]})]})}function ct({groupId:e,groupName:t,open:n,onOpenChange:i}){let o=V(u.groups.getGroup,n&&e?{groupId:e}:`skip`),s=V(u.groups.listAssignableInstances,n?{}:`skip`),c=V(u.groups.listAssignableUsers,n?{}:`skip`),f=z(u.groups.addMember),p=z(u.groups.removeMember),m=z(u.groups.bulkSetMembers),h=z(u.groups.setGroupManager),g=X(),[_,v]=(0,Q.useState)(``),[b,x]=(0,Q.useState)(``),[ee,w]=(0,Q.useState)(`members`),[te,E]=(0,Q.useState)(1),[D,ne]=(0,Q.useState)(new Set),k=(0,Q.useRef)(null),A=(0,Q.useMemo)(()=>new Set((o?.members??[]).map(e=>e.userId)),[o]),re=(0,Q.useMemo)(()=>new Set((o?.members??[]).filter(e=>e.manager).map(e=>e.userId)),[o]),M=o?.viewerIsAdmin===!0,ie=(0,Q.useMemo)(()=>new Set((o?.agents??[]).map(e=>`${e.instanceName}/${e.agentId}`)),[o]);(0,Q.useEffect)(()=>{v(``),x(``),w(`members`),E(1),k.current=null},[n,e]),(0,Q.useEffect)(()=>{E(1)},[_]),(0,Q.useEffect)(()=>{n&&o&&e&&k.current!==e&&(k.current=e,ne(new Set((o.members??[]).map(e=>e.userId))))},[n,o,e]);let P=(0,Q.useMemo)(()=>c?Qe(c,_,D):[],[c,_,D]);async function F(t,n){if(e)try{n?await p({groupId:e,userId:t}):await f({groupId:e,userId:t})}catch(e){g.error(y(),e)}}async function ae(t,n){if(e)try{await h({groupId:e,userId:t,manager:!n})}catch(e){g.error(j(),e)}}let I=nt(P,e=>A.has(e.userId)),L=P.filter(e=>A.has(e.userId)).length,R=rt(P,te,ot);async function oe(){if(!e||P.length===0)return;let t=P.map(e=>e.userId);try{await m({groupId:e,userIds:t,member:I!==`all`})}catch(e){g.error(y(),e)}}return(0,$.jsx)(Ve,{open:n,onOpenChange:i,children:(0,$.jsxs)(Ie,{className:`oc-access`,children:[(0,$.jsxs)(Le,{children:[(0,$.jsx)(Re,{children:S({name:t})}),(0,$.jsx)(Be,{children:de()})]}),(0,$.jsxs)(je,{value:ee,onValueChange:w,className:`oc-access__tabs`,children:[(0,$.jsxs)(Ae,{className:`w-full`,children:[(0,$.jsxs)(H,{value:`members`,className:`flex-1 gap-1.5`,children:[(0,$.jsx)(Ze,{size:13,"aria-hidden":!0}),a(),o?(0,$.jsx)(q,{variant:`secondary`,className:`oc-access__tabcount`,children:A.size}):null]}),(0,$.jsxs)(H,{value:`agents`,className:`flex-1 gap-1.5`,children:[(0,$.jsx)(G,{size:13,"aria-hidden":!0}),C(),o?(0,$.jsx)(q,{variant:`secondary`,className:`oc-access__tabcount`,children:ie.size}):null]}),(0,$.jsxs)(H,{value:`charts`,className:`flex-1 gap-1.5`,children:[(0,$.jsx)(Ye,{size:13,"aria-hidden":!0}),xe(),o?(0,$.jsx)(q,{variant:`secondary`,className:`oc-access__tabcount`,children:o.chartCount}):null]})]}),(0,$.jsx)(U,{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:me()}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(J,{value:_,onChange:e=>v(e.target.value),placeholder:fe(),className:`oc-access__search`}),P.length===0?(0,$.jsx)(`p`,{className:`oc-access__hint`,children:d()}):(0,$.jsxs)($.Fragment,{children:[P.length>1?(0,$.jsxs)(`div`,{className:`oc-access__row oc-access__selectall`,children:[(0,$.jsx)(Y,{checked:I===`all`?!0:I===`some`?`indeterminate`:!1,onCheckedChange:()=>void oe(),"aria-label":O()}),(0,$.jsx)(`span`,{className:`oc-access__label`,children:O()}),(0,$.jsxs)(q,{variant:`outline`,className:`oc-access__count`,children:[L,` / `,P.length]})]}):null,(0,$.jsx)(`div`,{className:`oc-access__list`,children:R.pageItems.map(e=>{let t=A.has(e.userId),n=et(e),i=re.has(e.userId);return(0,$.jsxs)(`div`,{className:`oc-access__row`,children:[(0,$.jsx)(Y,{checked:t,onCheckedChange:()=>void F(e.userId,t),"aria-label":we({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)(q,{variant:`outline`,className:`oc-access__role`,children:tt(e.role)}),(0,$.jsx)(`span`,{className:`oc-access__mgrslot`,children:t&&M?(0,$.jsx)(W,{type:`button`,variant:`ghost`,size:`icon`,className:`shrink-0 oc-access__mgr${i?` oc-access__mgr--on`:``}`,"aria-pressed":i,"aria-label":i?N():T(),title:i?N():T(),onClick:()=>void ae(e.userId,i),children:(0,$.jsx)(Xe,{size:15,"aria-hidden":!0})}):t&&i?(0,$.jsx)(`span`,{className:`oc-access__mgr oc-access__mgr--on`,role:`img`,"aria-label":r(),title:r(),children:(0,$.jsx)(Xe,{size:15,"aria-hidden":!0})}):null})]},e._id)})}),(0,$.jsx)(st,{page:R.page,pageCount:R.pageCount,onPage:E})]})]})}),(0,$.jsx)(U,{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:_e()}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(J,{value:b,onChange:e=>x(e.target.value),placeholder:l(),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:ie,query:b},`${e}-${t._id}`))})]})}),(0,$.jsx)(U,{value:`charts`,children:(0,$.jsx)(ut,{groupId:e})})]})]})})}function lt({groupId:e,instanceName:t,kind:n,assigned:r,query:i}){let a=V(u.groups.listAssignableAgents,{instanceName:t}),o=z(u.groups.assignAgentToGroup),s=z(u.groups.removeAgentFromGroup),c=z(u.groups.bulkSetGroupAgents),l=X(),[d,f]=(0,Q.useState)(1);if((0,Q.useEffect)(()=>{f(1)},[i]),!e)return null;let m=$e(a?.agents??[],i),h=a?.discovery&&!a.discovery.lastPollOk;if(i.trim()&&m.length===0)return null;let g=m.filter(e=>e.presentInLastOk!==!1),_=nt(g,e=>r.has(`${t}/${e.agentId}`)),v=rt(m,d,ot);async function y(n,r){try{r?await s({groupId:e,instanceName:t,agentId:n}):await o({groupId:e,instanceName:t,agentId:n})}catch(e){l.error(p(),e)}}async function b(){if(g.length===0)return;let n=g.map(e=>e.agentId);try{await c({groupId:e,instanceName:t,agentIds:n,assigned:_!==`all`})}catch(e){l.error(p(),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)(q,{variant:`outline`,className:`oc-access__kind`,children:n}),h?(0,$.jsx)(q,{variant:`outline`,className:`oc-access__stale`,children:Ce()}):null]}),a===void 0?(0,$.jsx)(`p`,{className:`oc-access__hint`,children:le()}):m.length===0?(0,$.jsx)(`p`,{className:`oc-access__hint`,children:h?R():ce()}):(0,$.jsxs)($.Fragment,{children:[g.length>1?(0,$.jsxs)(`div`,{className:`oc-access__row oc-access__selectall`,children:[(0,$.jsx)(Y,{checked:_===`all`?!0:_===`some`?`indeterminate`:!1,onCheckedChange:()=>void b(),"aria-label":O()}),(0,$.jsx)(`span`,{className:`oc-access__label`,children:O()})]}):null,v.pageItems.map(e=>{let n=`${t}/${e.agentId}`,i=r.has(n),a=e.presentInLastOk===!1;return(0,$.jsxs)(`div`,{className:`oc-access__row`,children:[(0,$.jsx)(Y,{checked:i,disabled:a&&!i,onCheckedChange:()=>void y(e.agentId,i),"aria-label":F({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":L(),title:L(),children:(0,$.jsx)(K,{size:14,fill:`currentColor`})}):null,a?(0,$.jsx)(q,{variant:`outline`,className:`oc-access__gone`,children:pe()}):null]},e.agentId)}),(0,$.jsx)(st,{page:v.page,pageCount:v.pageCount,onPage:f})]})]})}function ut({groupId:e}){let t=V(u.charts.listGroupChartSelection,e?{groupId:e}:`skip`),n=z(u.charts.assignChartToGroup),r=z(u.charts.removeChartFromGroup),i=z(u.charts.setGroupDefaultChart),a=z(u.charts.addChartToGroupPool),o=z(u.charts.removeChartFromGroupPool),s=X();if(!e)return null;if(t===void 0)return(0,$.jsx)(`p`,{className:`oc-access__hint`,children:B()});let{pool:c,addable:l,canManagePool:d}=t;if(c.length===0&&!d)return(0,$.jsx)(`p`,{className:`oc-access__hint`,children:ge()});async function f(t,i){try{i?await r({groupId:e,chartKey:t}):await n({groupId:e,chartKey:t})}catch(e){s.error(M(),e)}}async function p(t){try{await i({groupId:e,chartKey:t})}catch(e){s.error(M(),e)}}async function m(t){try{await a({groupId:e,chartKey:t})}catch(e){s.error(M(),e)}}async function h(t){try{await o({groupId:e,chartKey:t})}catch(e){s.error(M(),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)(Y,{checked:e.selected,onCheckedChange:()=>void f(e.chartKey,e.selected),"aria-label":he({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":Se(),title:Se(),children:(0,$.jsx)(K,{size:14,fill:`currentColor`})}):(0,$.jsx)(W,{type:`button`,variant:`ghost`,size:`sm`,onClick:()=>void p(e.chartKey),children:oe()}):null,d?(0,$.jsx)(W,{type:`button`,variant:`ghost`,size:`sm`,"aria-label":be({name:e.name}),title:be({name:e.name}),onClick:()=>void h(e.chartKey),children:(0,$.jsx)(ke,{size:14,"aria-hidden":!0})}):null]},e.chartKey))}),d?l.length>0?(0,$.jsxs)(Fe,{value:``,onValueChange:e=>void m(e),children:[(0,$.jsx)(Ne,{size:`sm`,className:`oc-access__search`,children:(0,$.jsx)(Ue,{placeholder:ue()})}),(0,$.jsx)(We,{children:l.map(e=>(0,$.jsx)(Pe,{value:e.chartKey,children:e.name},e.chartKey))})]}):c.length===0?(0,$.jsx)(`p`,{className:`oc-access__hint`,children:ae()}):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,$y as i,Ab as a,Ay as o,Bb as s,By as c,Cb as l,DE as u,Db as d,Dt as f,E as p,EE as m,Eb as h,Et as g,Fb as _,Fy as v,Gb as y,Gy as b,Hb as x,Hy as S,Ib as C,Iy as w,Jb as T,Jy as E,Kb as ee,Ky as te,Lb as ne,Ly as D,Mb as O,My as k,Nb as re,Ny as ie,Ob as ae,Ot as oe,Pb as se,Py as ce,QA as A,Qb as le,Qy as ue,Rb as de,Ry as fe,Sb as pe,Tb as me,Th as he,Ub as ge,Uy as _e,Vb as ve,Vy as ye,Wb as be,Wy as xe,Xb as Se,Xy as j,Yb as Ce,Yy as we,Zb as Te,Zy as Ee,_b as De,ab as Oe,ax as ke,bb as Ae,cb as je,ci as Me,cx as Ne,db as Pe,dx as Fe,eb as Ie,ej as M,ex as Le,fb as Re,fx as ze,gb as Be,hb as Ve,hx as He,ib as Ue,ix as We,jb as Ge,jy as Ke,kb as qe,ky as Je,lb as Ye,li as Xe,lx as Ze,mb as Qe,mx as $e,nb as et,nx as tt,ob as nt,ox as rt,pb as it,px as at,qb as ot,qy as st,rb as ct,rx as lt,sb as ut,si as dt,sx as ft,tb as pt,tj as N,tx as P,ub as mt,ui as ht,ux as gt,vb as _t,wb as vt,wh as yt,xb as F,yb as bt,zb as xt,zy as St}from"./dist-0NlyORTv.js";import{a as Ct,c as wt}from"./FieldLabel-DLQqitFA.js";import{t as I}from"./button-CW3POj4v.js";import{B as Tt,C as L,Q as Et,S as R,X as Dt,Z as Ot,at as z,b as B,ct as V,dt as H,ft as U,lt as W,ot as G,p as kt,st as At,u as jt,w as K,x as q,z as J}from"./index-Oefe3uVe.js";import{t as Mt}from"./DataTableShell-2dt7qzK1.js";import{InstanceConfigDialog as Nt}from"./BridgeTab-BVZtXJSI.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:Ct},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=N(p.admin.listInstances,{}),t=N(p.agents.listAllInstanceAgents,{}),n=M(p.admin.upsertInstance),i=M(p.admin.deleteInstance),a=J(),[c,l]=(0,Y.useState)(!1),[u,d]=(0,Y.useState)(Q),[m,h]=(0,Y.useState)(null),[_,v]=(0,Y.useState)(null),[b,S]=(0,Y.useState)(null),[C,w]=(0,Y.useState)(null);async function E(){try{await n({instanceId:C??void 0,name:u.name,gatewayUrl:u.gatewayUrl,bridgeUrl:u.bridgeUrl||void 0,displayName:u.displayName||void 0,kind:u.kind,transport:u.kind===`hermes`?u.transport:void 0,gatewayVersion:u.gatewayVersion||void 0,gatewayHttpUrl:u.gatewayHttpUrl||void 0,streamTransport:u.streamTransport}),d(Q),w(null),l(!1)}catch(e){a.error(at(),e)}}return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`p`,{className:`oc-admin__hint`,children:[ze(),(0,Z.jsx)(`strong`,{children:Fe()}),gt()]}),(0,Z.jsx)(Mt,{title:Ze(),rows:e,addLabel:Ne(),onAdd:()=>{w(null),d(Q),l(!0)},emptyHint:ft(),columns:[{header:rt(),cell:e=>e.name,sort:e=>e.name},{header:ke(),cell:e=>(0,Z.jsx)(z,{variant:`outline`,children:e.kind??`openclaw`}),sort:e=>e.kind??`openclaw`},{header:We(),cell:e=>e.gatewayUrl,sort:e=>e.gatewayUrl},{header:lt(),cell:e=>e.displayName??`—`,sort:e=>e.displayName??null},{header:He(),cell:e=>{let n=(t?.[e.name]??[]).filter(e=>e.presentInLastOk!==!1&&e.enabled);if(n.length===0)return(0,Z.jsx)(`span`,{className:`text-muted-foreground`,children:`—`});let r=t=>e.defaultAgentId===t;return(0,Z.jsx)(`div`,{className:`flex flex-wrap gap-1`,children:[...n].sort((e,t)=>Number(r(t.agentId))-Number(r(e.agentId))).map(e=>(0,Z.jsxs)(z,{variant:r(e.agentId)?`default`:`outline`,title:r(e.agentId)?o():void 0,children:[e.emoji?`${e.emoji} `:``,e.displayName??e.agentId]},e.agentId))})}}],rowActions:e=>[{label:r(),onSelect:()=>{w(e._id),d(Rt(e)),l(!0)}},{label:$e(),onSelect:()=>h(e.name)},{label:de(),onSelect:()=>S(e)},{label:tt(),onSelect:()=>v(e)},{label:P(),variant:`destructive`,onSelect:()=>void i({instanceId:e._id})}],bulkActions:[{label:P(),variant:`destructive`,onSelect:e=>e.forEach(e=>void i({instanceId:e}))}]}),(0,Z.jsx)(jt,{open:c,onOpenChange:l,title:C?le():Le(),description:Se(),canSubmit:!!(u.name&&u.gatewayUrl),onSubmit:E,submitLabel:Ce(),children:(0,Z.jsxs)(`div`,{className:`oc-form`,children:[(0,Z.jsxs)($,{label:T(),children:[(0,Z.jsx)(G,{value:u.name,disabled:C!==null,onChange:e=>d({...u,name:e.target.value})}),C?(0,Z.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:Te()}):null]}),(0,Z.jsx)($,{label:ot(),children:(0,Z.jsxs)(B,{value:u.kind,onValueChange:e=>d({...u,kind:e}),children:[(0,Z.jsx)(L,{size:`sm`,className:`w-40`,children:(0,Z.jsx)(K,{})}),(0,Z.jsxs)(q,{children:[(0,Z.jsx)(R,{value:`openclaw`,children:`OpenClaw`}),(0,Z.jsx)(R,{value:`hermes`,children:`Hermes`})]})]})}),u.kind===`hermes`?(0,Z.jsx)($,{label:oe(),children:(0,Z.jsxs)(B,{value:u.transport,onValueChange:e=>d({...u,transport:e}),children:[(0,Z.jsx)(L,{size:`sm`,className:`w-56`,children:(0,Z.jsx)(K,{})}),(0,Z.jsxs)(q,{children:[(0,Z.jsx)(R,{value:`ws`,children:f()}),(0,Z.jsx)(R,{value:`rest`,children:g()})]})]})}):null,(0,Z.jsx)($,{label:ee(),children:(0,Z.jsx)(G,{value:u.gatewayUrl,onChange:e=>d({...u,gatewayUrl:e.target.value})})}),(0,Z.jsx)($,{label:y(),children:(0,Z.jsx)(G,{value:u.bridgeUrl,placeholder:be(),onChange:e=>d({...u,bridgeUrl:e.target.value})})}),(0,Z.jsx)($,{label:ge(),children:(0,Z.jsx)(G,{value:u.displayName,onChange:e=>d({...u,displayName:e.target.value})})}),(0,Z.jsxs)($,{label:he(),children:[(0,Z.jsxs)(B,{value:u.streamTransport,onValueChange:e=>d({...u,streamTransport:e}),children:[(0,Z.jsx)(L,{size:`sm`,className:`w-40`,children:(0,Z.jsx)(K,{})}),(0,Z.jsx)(q,{children:wt.map(e=>(0,Z.jsx)(R,{value:e,children:e},e))})]}),(0,Z.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:yt()})]}),(0,Z.jsx)($,{label:x(),children:(0,Z.jsx)(G,{value:u.gatewayVersion,placeholder:ve(),onChange:e=>d({...u,gatewayVersion:e.target.value})})}),(0,Z.jsx)($,{label:s(),children:(0,Z.jsx)(G,{value:u.gatewayHttpUrl,placeholder:xt(),onChange:e=>d({...u,gatewayHttpUrl:e.target.value})})})]})}),(0,Z.jsx)(Yt,{instanceName:m,open:m!==null,onOpenChange:e=>{e||h(null)}}),_?(0,Z.jsx)(Nt,{instance:_,onClose:()=>v(null)},_._id):null,b?(0,Z.jsx)(Bt,{instance:b,onClose:()=>S(null)},b._id):null]})}function Bt({instance:e,onClose:t}){let n=N(p.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)(At,{open:!0,onOpenChange:e=>!e&&t(),children:(0,Z.jsxs)(V,{onOpenAutoFocus:e=>e.preventDefault(),children:[(0,Z.jsxs)(H,{children:[(0,Z.jsx)(U,{children:ne({instance:e.displayName??e.name})}),(0,Z.jsx)(W,{children:C()})]}),(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=A(p.instanceSync.forceInstanceSync),n=J(),[r,i]=(0,Y.useState)(!1);async function a(){if(!r){i(!0);try{switch((await t({instanceId:e._id})).status){case`synced`:n.success(Be());break;case`no_agents`:n.success(Qe());break;case`no_bridge_url`:n.error(it());break;case`deploy_misconfigured`:n.error(Re());break;case`unauthorized`:n.error(mt());break;case`not_served`:n.error(Ye());break;default:n.error(Pe());break}}catch(e){n.error(Ve(),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)(I,{size:`sm`,variant:`outline`,onClick:()=>void a(),disabled:r,children:r?De():_t()})})]})}function Ht({instance:e}){let t=N(p.bridgeAuth.listBridgeAuthStatus,{}),n=A(p.bridgeAuth.mintBridgeSecret),r=M(p.bridgeAuth.revokeBridgeSecret),a=J(),[o,s]=(0,Y.useState)(!1),[c,l]=(0,Y.useState)(null),[d,f]=(0,Y.useState)(!1),h=(t??[]).find(t=>t.instanceId===e._id),g=h!==void 0;async function _(){if(!o){s(!0);try{l((await n({instanceId:e._id})).plaintext),f(!1)}catch(e){a.error(pt(),e)}finally{s(!1)}}}async function v(){if(!o){s(!0);try{await r({instanceId:e._id}),l(null),a.success(et())}catch(e){a.error(pt(),e)}finally{s(!1)}}}async function y(){if(c)try{await navigator.clipboard.writeText(c),f(!0)}catch{}}return(0,Z.jsxs)($,{label:ut(),children:[(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:nt()}),(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Z.jsx)(z,{variant:g?`outline`:`secondary`,children:g?`${O()} · ${h.prefix}…${h.lastFour}`:Ge()}),(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(I,{size:`sm`,onClick:()=>void _(),disabled:o,children:g?Ue():Oe()}),g?(0,Z.jsx)(I,{size:`sm`,variant:`destructive`,onClick:()=>void v(),disabled:o,children:ct()}):null]})]}),c?(0,Z.jsxs)(`div`,{className:`oc-bridgesecret__reveal`,children:[(0,Z.jsx)(`p`,{className:`oc-sa__minted-warning`,children:Ie()}),(0,Z.jsxs)(`div`,{className:`oc-sa__minted-box`,children:[(0,Z.jsx)(`code`,{className:`oc-sa__minted-plain`,children:c}),(0,Z.jsx)(I,{variant:`outline`,size:`sm`,onClick:()=>void y(),children:d?u():m()})]}),(0,Z.jsx)(I,{size:`sm`,variant:`ghost`,onClick:()=>{l(null),f(!1)},children:i()})]}):null]})}function Ut({instanceId:e,field:t,updatedAt:n}){let r=A(p.instanceSecrets.setInstanceSecret),o=M(p.instanceSecrets.clearInstanceSecret),s=A(p.deviceIdentity.generateDeviceIdentity),c=J(),[f,g]=(0,Y.useState)(``),[v,y]=(0,Y.useState)(!1),[b,x]=(0,Y.useState)(null),[S,C]=(0,Y.useState)(!1),w=n!==null,T=t===`deviceIdentity`,E=t===`token`?_():t===`deviceIdentity`?se():re();async function ee(){if(!(!f.trim()||v)){y(!0);try{await r({instanceId:e,field:t,plaintext:f}),g(``),x(null),C(!1),c.success(h())}catch(e){c.error(me(),e)}finally{y(!1)}}}async function te(){if(!v){y(!0);try{await o({instanceId:e,field:t}),x(null),C(!1),c.success(vt())}catch(e){c.error(me(),e)}finally{y(!1)}}}async function ne(){if(!v){y(!0);try{x(await s({instanceId:e})),C(!1),c.success(F())}catch(e){c.error(bt(),e)}finally{y(!1)}}}let D=b?`openclaw devices approve ${b.id}`:``;async function k(){if(D)try{await navigator.clipboard.writeText(D),C(!0)}catch{}}return(0,Z.jsxs)($,{label:E,children:[T?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:pe()}):null,(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Z.jsx)(z,{variant:w?`outline`:`secondary`,children:w?O():Ge()}),(0,Z.jsx)(G,{type:`password`,autoComplete:`off`,className:`flex-1 min-w-32`,value:f,placeholder:w?qe():a(),onChange:e=>g(e.target.value)}),(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(I,{size:`sm`,onClick:()=>void ee(),disabled:v||f.trim().length===0,children:ae()}),T?(0,Z.jsx)(I,{size:`sm`,variant:`outline`,onClick:()=>void ne(),disabled:v,children:l()}):null,w?(0,Z.jsx)(I,{size:`sm`,variant:`destructive`,onClick:()=>void te(),disabled:v,children:d()}):null]})]}),b?(0,Z.jsxs)(`div`,{className:`oc-bridgesecret__reveal`,children:[(0,Z.jsx)(`p`,{className:`text-sm font-medium`,children:F()}),(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:Ae()}),(0,Z.jsxs)(`div`,{className:`oc-sa__minted-box`,children:[(0,Z.jsx)(`code`,{className:`oc-sa__minted-plain`,children:D}),(0,Z.jsx)(I,{variant:`outline`,size:`sm`,onClick:()=>void k(),children:S?u():m()})]}),(0,Z.jsx)(I,{size:`sm`,variant:`ghost`,onClick:()=>{x(null),C(!1)},children:i()})]}):null]})}var Wt={conversational:b,documentary:_e,summarizer:ht,curator:Me},Gt={conversational:xe,documentary:S,summarizer:Xe,curator:dt},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:we()}),t.map(e=>(0,Z.jsx)(z,{variant:`secondary`,className:`oc-agenttype__chip`,title:qt(e),children:Kt(e)},e)),(0,Z.jsxs)(Dt,{children:[(0,Z.jsx)(Et,{asChild:!0,children:(0,Z.jsx)(I,{type:`button`,variant:`outline`,size:`sm`,className:`h-7`,children:E()})}),(0,Z.jsxs)(Ot,{align:`start`,className:`oc-agenttypes-pop`,children:[(0,Z.jsx)(`p`,{className:`oc-agenttypes-pop__title`,children:st()}),(0,Z.jsx)(`p`,{className:`oc-agenttypes-pop__hint`,children:te()}),(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)(kt,{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 r=N(p.agents.listAgentsForInstance,t&&e?{instanceName:e}:`skip`),i=M(p.agents.setAgentEnabled).withOptimisticUpdate((e,{instanceName:t,agentId:n,enabled:r})=>{let i=e.getQuery(p.agents.listAgentsForInstance,{instanceName:t});i&&e.setQuery(p.agents.listAgentsForInstance,{instanceName:t},{...i,agents:i.agents.map(e=>e.agentId===n?{...e,enabled:r}:e)})}),a=M(p.agents.setInstanceDefaultAgent).withOptimisticUpdate((e,{instanceName:t,agentId:n})=>{let r=e.getQuery(p.agents.listAgentsForInstance,{instanceName:t});r&&e.setQuery(p.agents.listAgentsForInstance,{instanceName:t},{...r,defaultAgentId:n})}),s=M(p.agents.setAgentTypes).withOptimisticUpdate((e,{instanceName:t,agentId:n,types:r})=>{let i=e.getQuery(p.agents.listAgentsForInstance,{instanceName:t});if(!i)return;let a=It(r);e.setQuery(p.agents.listAgentsForInstance,{instanceName:t},{...i,agents:i.agents.map(e=>e.agentId===n?{...e,types:a}:e)})}),l=M(p.agents.removeInstanceAgent),u=Tt(),d=J();async function f(t,n){if(e)try{await i({instanceName:e,agentId:t,enabled:n})}catch(e){d.error(j(),e)}}async function m(t){if(e)try{await a({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 g(t,n){if(e&&await u({title:St({name:n}),description:fe(),confirmLabel:D(),destructive:!0}))try{await l({instanceName:e,agentId:t}),d.success(w())}catch(e){d.error(j(),e)}}return(0,Z.jsx)(At,{open:t,onOpenChange:n,children:(0,Z.jsxs)(V,{className:`oc-access`,children:[(0,Z.jsxs)(H,{children:[(0,Z.jsx)(U,{children:ue({name:e??``})}),(0,Z.jsx)(W,{children:Ee()})]}),r===void 0?(0,Z.jsx)(`p`,{className:`oc-access__hint`,children:v()}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`div`,{className:`oc-access__poll`,children:r.discovery===null?ce():r.discovery.lastPollOk?ie():k({error:r.discovery.error??`?`})}),r.agents.length===0?(0,Z.jsx)(`p`,{className:`oc-access__hint`,children:Ke()}):(0,Z.jsx)(`div`,{className:`oc-access__list`,children:r.agents.map(e=>{let t=e.presentInLastOk===!1,n=r.defaultAgentId===e.agentId,i=e.displayName??e.agentId,a=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)(kt,{checked:e.enabled,disabled:t,"aria-label":i,onCheckedChange:t=>void f(e.agentId,t===!0)}),(0,Z.jsxs)(`span`,{className:`oc-agentcard__name`,title:i,children:[e.emoji?`${e.emoji} `:``,i]}),e.model?(0,Z.jsx)(`span`,{className:`oc-access__model`,children:e.model}):null,t?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(z,{variant:`outline`,className:`oc-access__gone`,children:Je()}),(0,Z.jsx)(I,{size:`sm`,variant:`ghost`,className:`h-7 text-destructive`,onClick:()=>void g(e.agentId,i),children:c()})]}):n?(0,Z.jsx)(z,{variant:`default`,children:o()}):(0,Z.jsx)(I,{size:`sm`,variant:`outline`,className:`h-7`,disabled:!e.enabled,onClick:()=>void m(e.agentId),children:ye()})]}),e.enabled?(0,Z.jsx)(Jt,{agentId:e.agentId,types:a,onToggle:t=>void h(e.agentId,t,a)}):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{$S as r,Aa as i,Ca as a,Da as o,E as s,Ea as c,GS as l,JS as u,KS as d,Oa as f,QA as p,QS as m,Ta as h,XS as g,YS as _,ZS as v,eC as y,ej as b,iC as x,ja as S,ka as C,nC as w,qS as T,rC as E,tC as D,tj as O,wa as k}from"./dist-0NlyORTv.js";import{t as A}from"./button-CW3POj4v.js";import{at as j,ot as M,p as N}from"./index-Oefe3uVe.js";var P=t(e(),1),F=n();function I(){let e=O(s.integrations.status.status,{}),t=b(s.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:x()});let o=n,c=(e,t,n)=>a({...o,[e]:{...o[e],[t]:n}}),f=(e,n)=>void t({[e]:n});return(0,F.jsxs)(F.Fragment,{children:[(0,F.jsxs)(`p`,{className:`oc-admin__hint`,children:[E(),` `,(0,F.jsx)(`strong`,{children:w()}),` `,D()]}),(0,F.jsxs)(L,{title:`Langfuse`,status:e.langfuse.configured?e.langfuse.enabled?(0,F.jsx)(j,{variant:`secondary`,children:y()}):(0,F.jsx)(j,{variant:`outline`,children:r()}):(0,F.jsx)(j,{variant:`outline`,children:m()}),note:v(),children:[(0,F.jsx)(R,{label:_(),children:(0,F.jsx)(M,{value:o.langfuse.host??``,placeholder:e.langfuse.effectiveHost,onChange:e=>c(`langfuse`,`host`,e.target.value),onBlur:()=>f(`langfuse`,{host:o.langfuse.host??``})})}),(0,F.jsx)(z,{label:l(),checked:o.langfuse.enabled??!0,onChange:e=>{c(`langfuse`,`enabled`,e),f(`langfuse`,{enabled:e})}})]}),(0,F.jsxs)(L,{title:`Opik`,status:e.opik.configured?e.opik.enabled?(0,F.jsx)(j,{variant:`secondary`,children:y()}):(0,F.jsx)(j,{variant:`outline`,children:r()}):(0,F.jsx)(j,{variant:`outline`,children:m()}),note:g(),children:[(0,F.jsx)(R,{label:u(),children:(0,F.jsx)(M,{value:o.opik.baseUrl??``,placeholder:e.opik.effectiveBaseUrl,onChange:e=>c(`opik`,`baseUrl`,e.target.value),onBlur:()=>f(`opik`,{baseUrl:o.opik.baseUrl??``})})}),(0,F.jsx)(R,{label:T(),children:(0,F.jsx)(M,{value:o.opik.workspace??``,placeholder:e.opik.effectiveWorkspace||d(),onChange:e=>c(`opik`,`workspace`,e.target.value),onBlur:()=>f(`opik`,{workspace:o.opik.workspace??``})})}),(0,F.jsx)(z,{label:l(),checked:o.opik.enabled??!0,onChange:e=>{c(`opik`,`enabled`,e),f(`opik`,{enabled:e})}})]}),(0,F.jsxs)(L,{title:`OpenTelemetry (OTLP)`,status:e.otlp.configured?e.otlp.enabled?(0,F.jsx)(j,{variant:`secondary`,children:y()}):(0,F.jsx)(j,{variant:`outline`,children:r()}):(0,F.jsx)(j,{variant:`outline`,children:S()}),note:i(),children:[(0,F.jsx)(R,{label:C(),children:(0,F.jsx)(M,{value:o.otlp.endpoint??``,placeholder:e.otlp.effectiveEndpoint||`https://otlp.example.com/v1/traces`,onChange:e=>c(`otlp`,`endpoint`,e.target.value),onBlur:()=>f(`otlp`,{endpoint:o.otlp.endpoint??``})})}),(0,F.jsx)(B,{headersSet:e.otlp.headersSet}),(0,F.jsx)(z,{label:l(),checked:o.otlp.enabled??!0,onChange:e=>{c(`otlp`,`enabled`,e),f(`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=p(s.integrations.otlpSecret.setOtlpHeaders),n=b(s.integrations.otlpSecret.clearOtlpHeaders),[r,i]=(0,P.useState)(``),[l,u]=(0,P.useState)(null),[d,m]=(0,P.useState)(!1),g=async()=>{m(!0),u(null);try{await t({headersJson:r}),i(``)}catch(e){u(e instanceof Error?e.message:String(e))}finally{m(!1)}};return(0,F.jsxs)(R,{label:f(),children:[(0,F.jsx)(M,{value:r,placeholder:e?o():c(),onChange:e=>i(e.target.value)}),(0,F.jsxs)(`div`,{className:`oc-int__otlp-headers-actions`,children:[(0,F.jsx)(A,{size:`sm`,disabled:d||r.trim().length===0,onClick:()=>void g(),children:h()}),e?(0,F.jsx)(A,{variant:`ghost`,size:`sm`,disabled:d,onClick:()=>void n({}),children:k()}):null]}),l?(0,F.jsx)(`p`,{className:`oc-int__otlp-headers-error`,children:l}):null,(0,F.jsx)(`p`,{className:`oc-uipa__note`,children:a()})]})}export{I as IntegrationsTab};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{AC as r,BC as i,Bp as a,E as o,Fp as s,Gp as c,Hp as l,Ip as u,Lp as d,Mp as f,Np as p,Pp as m,RC as h,Rp as g,Up as _,VC as v,Vp as y,Wp as b,fw as x,jC as S,tj as C,zC as w,zp as T}from"./dist-0NlyORTv.js";import{Bt as ee,Vt as te,a as ne,ht as re,n as E,r as D}from"./index-Oefe3uVe.js";import{a as O,n as k,o as A,r as j,t as M}from"./card-DejnuKjD.js";import{n as N,t as P}from"./TimeRangePicker-BCP5a7nZ.js";var F=t(e(),1),I=n(),L=15,R=e=>String(Math.round(e));function z(){let e=C(o.me.getMe,{host:re})?.permissions?.includes(`traces.read`)??!1,t=C(o.deliveryTiming.listDeliverySessions,e?{}:`skip`),n=(0,F.useMemo)(()=>t?t.filter(e=>!e.active&&e.rollup!==null&&e.rollup.cP50!==null&&e.rollup.aP50!==null).slice(0,L).reverse().map(e=>({startedAt:e.startedAt,cP50:e.rollup?.cP50,aP50:e.rollup?.aP50})):[],[t]);return t===void 0?null:(0,I.jsxs)(`section`,{className:`oc-kpi__group`,children:[(0,I.jsx)(`h2`,{className:`oc-kpi__group-title`,children:x()}),(0,I.jsxs)(M,{children:[(0,I.jsxs)(O,{children:[(0,I.jsx)(A,{children:v()}),(0,I.jsx)(j,{children:w()})]}),(0,I.jsx)(k,{children:n.length<2?(0,I.jsx)(`p`,{className:`oc-admin__hint`,children:h()}):(0,I.jsx)(B,{series:n})})]})]})}function B({series:e}){let t=e.map(e=>e.cP50),n=e.map(e=>e.aP50),a=Math.max(1,...t,...n),o=t=>6+t*468/(e.length-1),s=e=>74-e*68/a,c=e=>e.map((e,t)=>`${t===0?`M`:`L`}${o(t).toFixed(1)},${s(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:[r(),` p50 `,R(l.cP50),` `,i()]}),(0,I.jsxs)(`span`,{children:[S(),` p50 `,R(l.aP50),` `,i()]})]}),(0,I.jsxs)(`svg`,{viewBox:`0 0 480 80`,className:`h-20 w-full`,preserveAspectRatio:`none`,role:`img`,"aria-label":v(),children:[(0,I.jsx)(`path`,{d:c(n),fill:`none`,style:{stroke:`var(--muted-foreground)`},strokeWidth:1.5}),(0,I.jsx)(`path`,{d:c(t),fill:`none`,style:{stroke:`var(--primary)`},strokeWidth:1.5})]})]})}var V=[{metric:`api.calls`,label:c(),unit:`/h`,group:`API`,isError:!1},{metric:`api.errors`,label:b(),unit:`/h`,group:`API`,isError:!0},{metric:`api.latency.avg_ms`,label:_(),unit:`ms`,group:`API`,isError:!1},{metric:`openclaw.ingest`,label:l(),unit:`/h`,group:`OpenClaw`,isError:!1},{metric:`chat.send`,label:y(),unit:`/h`,group:`Chat`,isError:!1},{metric:`assistant.stream.errors`,label:a(),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=te({from:`/settings/kpi`}),t=ee({from:`/settings/kpi`}),n=D(e.from,e.to,E,`now`),r=e=>void t({search:t=>({...t,...ne(e)})}),{from:i,to:a}=N(n),{rowLimit:s,buckets:c}=K(i,a),l=C(o.kpi.listKpis,{limit:s,filter:{from:i,to:a}}),f=(0,F.useMemo)(()=>{let e=new Map;for(let t of l??[]){let n=e.get(t.metric)??[];n.push({bucket:t.bucket,value:t.value}),e.set(t.metric,n)}for(let[t,n]of e)n.sort((e,t)=>e.bucket<t.bucket?-1:+(e.bucket>t.bucket)),n.length>c&&e.set(t,n.slice(n.length-c));return e},[l,c]),p=(0,I.jsxs)(I.Fragment,{children:[(0,I.jsxs)(`p`,{className:`oc-admin__hint`,children:[T(),` `,(0,I.jsx)(`span`,{className:`oc-filter__window`,children:g()})]}),(0,I.jsx)(J,{value:n,onChange:r})]});return l===void 0?(0,I.jsxs)(I.Fragment,{children:[p,(0,I.jsx)(z,{}),(0,I.jsx)(`p`,{className:`oc-admin__hint`,children:d()})]}):l.length===0?(0,I.jsxs)(I.Fragment,{children:[p,(0,I.jsx)(z,{}),(0,I.jsx)(`p`,{className:`oc-admin__hint`,children:u()})]}):(0,I.jsxs)(I.Fragment,{children:[p,(0,I.jsx)(z,{}),U.map(e=>{let t=V.filter(t=>t.group===e);return t.some(e=>(f.get(e.metric)??[]).length>0)?(0,I.jsxs)(`section`,{className:`oc-kpi__group`,children:[(0,I.jsx)(`h2`,{className:`oc-kpi__group-title`,children:e}),(0,I.jsx)(`div`,{className:`oc-kpi__grid`,children:t.map(e=>(0,I.jsx)(Y,{config:e,series:f.get(e.metric)??[]},e.metric))})]},e):null})]})}function J({value:e,onChange:t}){return(0,I.jsx)(`div`,{className:`oc-kpi__toolbar`,children:(0,I.jsx)(P,{value:e,onChange:t})})}function Y({config:e,series:t}){let n=t.length>0?t[t.length-1]:null,r=n?n.value:0;return(0,I.jsxs)(M,{size:`sm`,className:`oc-kpi__card`,children:[(0,I.jsxs)(O,{children:[(0,I.jsx)(A,{className:`oc-kpi__card-title`,children:e.label}),(0,I.jsx)(j,{className:`oc-kpi__card-metric`,children:(0,I.jsx)(`code`,{children:e.metric})})]}),(0,I.jsxs)(k,{className:`oc-kpi__card-body`,children:[(0,I.jsxs)(`div`,{className:`oc-kpi__value-row`,children:[(0,I.jsx)(`span`,{className:`oc-kpi__value`+(e.isError&&r>0?` oc-kpi__value--error`:``),children:Q(r)}),(0,I.jsx)(`span`,{className:`oc-kpi__unit`,children:e.unit})]}),(0,I.jsx)(ae,{series:t,isError:e.isError,unit:e.unit}),(0,I.jsxs)(`div`,{className:`oc-kpi__axis`,children:[n?(0,I.jsx)(`span`,{className:`oc-kpi__axis-latest`,children:s({value:$(n.bucket)})}):(0,I.jsx)(`span`,{className:`oc-kpi__muted`,children:m()}),(0,I.jsx)(`span`,{className:`oc-kpi__muted`,children:p({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":f({max:Q(r),unit:n}),children:e.map((e,o)=>{let s=r>0?e.value/r*(Z-1):0,c=o*i,l=Z-s;return(0,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{$D as r,AA as i,BD as a,E as o,FA as s,GD as c,HD as l,IA as u,JD as d,KA as f,KD as p,LA as m,MA as h,NA as g,O as _,OA as ee,PA as te,QD as ne,RA as re,UD as ie,VA as ae,VD as oe,WD as se,XD as ce,YD as le,Yb as ue,ZD as de,_O as fe,aO as v,bO as y,cO as b,dO as x,eO as S,ej as C,fO as w,gO as T,hO as E,iO as D,jA as O,k,kA as A,lO as j,mO as M,nO as N,oO as P,pO as F,qD as I,rO as L,sO as R,tO as z,tj as B,uO as V,vO as pe,yO as me,zD as he}from"./dist-0NlyORTv.js";import{t as H}from"./button-CW3POj4v.js";import{C as ge,M as _e,S as U,b as ve,ht as W,ot as G,p as K,w as ye,x as be,z as xe}from"./index-Oefe3uVe.js";import{t as Se}from"./localePickerView-C2RmOS86.js";var q=t(e(),1),J=[{id:`messages`,label:()=>y()},{id:`composer`,label:()=>me()},{id:`sidebar`,label:()=>pe()},{id:`other`,label:()=>fe()}],Y={showSource:{category:`messages`,label:()=>T(),help:()=>E()},showReport:{category:`messages`,label:()=>M(),help:()=>F()},copyAssistant:{category:`messages`,label:()=>w()},copyUser:{category:`messages`,label:()=>x()},showDelete:{category:`messages`,label:()=>V()},showTools:{category:`messages`,label:()=>j(),help:()=>b()},voiceInput:{category:`composer`,label:()=>R(),help:()=>P()},showUsage:{category:`composer`,label:()=>v(),help:()=>D()},autoReadAloud:{category:`composer`,label:()=>k(),help:()=>_()},showChatAge:{category:`sidebar`,label:()=>L(),help:()=>N()},showChatProvider:{category:`sidebar`,label:()=>z(),help:()=>S()}};function X(e){return e.toLowerCase().normalize(`NFD`).replace(/\p{Diacritic}/gu,``)}function Ce(e,t){let n=X(t.trim()),r=new Map(J.map(e=>[e.id,e.label()])),i=new Map(J.map(e=>[e.id,[]]));for(let t of e){let e=Y[t],a=e?.category??`other`;n&&!X(`${e?e.label():t} ${e?.help?e.help():``} ${t} ${r.get(a)??``}`).includes(n)||i.get(a).push(t)}return J.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`],Te={voiceInput:`voiceInput`};function Z(e){return we.includes(e)}function Q(e){return e===`admin`}function Ee(e){return e===!0?`on`:e===!1?`off`:`inherit`}function De(e){return e===`on`?!0:e===`off`?!1:null}function Oe(e){return Z(e)?Te[e]:void 0}var $=n(),ke={voiceInput:()=>ie()};function Ae({prefKey:e,ui:t}){let n=C(o.admin.setUiPrefDefault),r=C(o.admin.setFeatureEnabled),i=Oe(e),s=i?ke[e]?.():void 0;return(0,$.jsxs)(`div`,{className:`oc-prefs__gov`,children:[(0,$.jsxs)(`div`,{className:`oc-prefs__gov-row`,children:[(0,$.jsx)(`span`,{className:`oc-prefs__gov-label`,children:I()}),(0,$.jsxs)(ve,{value:Ee(t.defaults[e]),onValueChange:t=>void n({key:e,value:De(t)}),children:[(0,$.jsx)(ge,{size:`sm`,className:`w-36`,children:(0,$.jsx)(ye,{})}),(0,$.jsxs)(be,{children:[(0,$.jsx)(U,{value:`on`,children:oe()}),(0,$.jsx)(U,{value:`off`,children:a()}),(0,$.jsx)(U,{value:`inherit`,children:he()})]})]}),i?(0,$.jsxs)(`span`,{className:`oc-prefs__gov-gate`,children:[(0,$.jsx)(K,{checked:t.featuresEnabled[i]===!0,onCheckedChange:e=>void r({key:i,enabled:e===!0}),"aria-label":p()}),p()]}):null]}),s?(0,$.jsx)(`span`,{className:`oc-prefs__gov-help`,children:s}):null]})}function je(){let[e,t]=(0,q.useState)(``),[n,i]=(0,q.useState)(!1),a=B(o.me.getMe,{host:W}),s=a?.ui,u=Q(a?.role)&&n,p=C(o.me.setUiPref).withOptimisticUpdate(_e),m=(0,q.useMemo)(()=>s?Ce(Object.keys(s.effective),e):[],[s,e]);return s?(0,$.jsxs)(`div`,{className:`oc-prefs-panel`,children:[Q(a?.role)?(0,$.jsxs)(`label`,{className:`oc-prefs__gov-toggle`,children:[(0,$.jsx)(K,{checked:n,onCheckedChange:e=>i(e===!0),"aria-label":d()}),d()]}):null,u?(0,$.jsxs)(`div`,{className:`oc-prefs__gov-head`,children:[(0,$.jsx)(`p`,{children:c()}),(0,$.jsx)(`p`,{children:se()}),(0,$.jsx)(`p`,{children:l()})]}):null,(0,$.jsx)(G,{value:e,onChange:e=>t(e.target.value),placeholder:r(),"aria-label":r(),className:`mb-2`}),m.length===0?(0,$.jsx)(`div`,{className:`oc-prefs__empty`,children:ne()}):(0,$.jsx)(`div`,{className:`oc-prefs`,children:m.map(e=>(0,$.jsxs)(`div`,{className:`oc-prefs__group`,children:[(0,$.jsx)(`h4`,{className:`oc-prefs__cat`,children:e.label}),e.keys.map(e=>{let t=Y[e],n=t?t.label():e,r=t?.help?.(),i=s.locked[e],a=s.effective[e],o=s.userOverrides[e]!==void 0;return(0,$.jsxs)(`div`,{className:`oc-prefs__row${i?` is-locked`:``}${o&&!i?` is-overridden`:``}`,children:[(0,$.jsxs)(`div`,{className:`oc-prefs__info`,children:[(0,$.jsxs)(`span`,{className:`oc-prefs__label`,children:[n,i?(0,$.jsx)(`span`,{className:`oc-prefs__lock`,children:de()}):o?null:(0,$.jsx)(`span`,{className:`oc-prefs__def`,children:ce()})]}),r?(0,$.jsx)(`span`,{className:`oc-prefs__help`,children:r}):null]}),(0,$.jsxs)(`div`,{className:`oc-prefs__ctl`,children:[!i&&o?(0,$.jsx)(`button`,{type:`button`,className:`oc-prefs__reset`,onClick:()=>void p({key:e,value:null}),children:le()}):null,(0,$.jsx)(K,{checked:a,disabled:i,onCheckedChange:t=>void p({key:e,value:t===!0}),"aria-label":n})]}),u?(0,$.jsx)(Ae,{prefKey:e,ui:s}):null]},e)})]},e.id))})]}):(0,$.jsx)(`div`,{className:`oc-prefs__empty`,children:f()})}function Me(){let e=B(o.me.getMe,{host:W}),t=C(o.me.setLocale),n=C(o.me.setMyName),r=xe(),a=e?.locale??`default`,c=e?.name??``,[l,d]=(0,q.useState)(null),f=l??c,p=f.trim()!==c.trim();async function _(){try{await n({name:f}),d(null),r.success(te())}catch(e){r.error(g(),e)}}return(0,$.jsxs)(`div`,{className:`oc-appearance`,children:[(0,$.jsxs)(`section`,{className:`oc-show__section`,children:[(0,$.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,$.jsx)(`h2`,{className:`oc-show__title`,children:re()}),(0,$.jsx)(`p`,{className:`oc-show__desc`,children:m()})]}),(0,$.jsxs)(`div`,{className:`oc-show__row`,children:[(0,$.jsx)(G,{className:`max-w-xs`,value:f,maxLength:120,placeholder:u(),onChange:e=>d(e.target.value),onKeyDown:e=>{e.key===`Enter`&&p&&(e.preventDefault(),_())}}),(0,$.jsx)(H,{size:`sm`,disabled:!p,onClick:()=>void _(),children:ue()})]}),(0,$.jsx)(`p`,{className:`oc-show__desc`,children:s()})]}),(0,$.jsxs)(`section`,{className:`oc-show__section`,children:[(0,$.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,$.jsx)(`h2`,{className:`oc-show__title`,children:h()}),(0,$.jsx)(`p`,{className:`oc-show__desc`,children:O()})]}),(0,$.jsxs)(`div`,{className:`oc-show__row`,children:[Se().map(e=>(0,$.jsx)(H,{variant:a===e.value?`default`:`outline`,size:`sm`,onClick:()=>void t({locale:e.value}),children:e.label},e.value)),(0,$.jsx)(H,{variant:a==="default"?`default`:`outline`,size:`sm`,onClick:()=>void t({locale:null}),children:ae()})]}),(0,$.jsx)(`p`,{className:`oc-show__desc`,children:i()})]}),(0,$.jsxs)(`section`,{className:`oc-show__section`,children:[(0,$.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,$.jsx)(`h2`,{className:`oc-show__title`,children:A()}),(0,$.jsx)(`p`,{className:`oc-show__desc`,children:ee()})]}),(0,$.jsx)(je,{})]})]})}export{Me as PreferencesTab};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{An as r,At as i,E as a,Mn as o,Nn as s,Oh as c,Pn as l,_h as u,ah as d,bh as f,ch as p,dh as m,di as h,ej as g,fh as _,fi as v,gh as y,hh as b,hi as ee,ih as x,jn as S,jt as C,kh as w,kn as T,kt as E,lh as D,mh as O,mi as te,nh as ne,oh as re,ph as ie,pi as k,rh as A,sh as j,tj as M,uh as N,vh as P,xh as F,yh as I}from"./dist-0NlyORTv.js";import{d as L,f as R,i as z,l as B,n as V,r as H,t as U,u as ae}from"./FieldLabel-DLQqitFA.js";import{t as W}from"./button-CW3POj4v.js";import{C as G,S as K,b as q,ht as J,p as oe,w as Y,x as X,z as se}from"./index-Oefe3uVe.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:y,help:b},documentary_fetch:{label:O,help:ie},inbound_files:{label:_,help:m},history_summary:{label:ee,help:te},file_curation:{label:l,help:s}},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:x,references:A,files:ne,previous_summary:k,new_messages:v,max_chars:h,file_name:o,budget_chars:S,feedback:r,content:T};function pe(){let e=M(a.admin.listInstances,{}),[t,n]=(0,Q.useState)(null);if(e===void 0)return(0,$.jsx)(`div`,{className:`oc-settings__tab-loading`,"aria-busy":`true`});if(e.length===0)return(0,$.jsx)(`div`,{className:`oc-injtab`,children:(0,$.jsx)(`p`,{className:`oc-admin__hint`,children:D()})});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)(V,{label:F(),help:f()}),(0,$.jsxs)(`label`,{className:`oc-injtab__picker`,children:[(0,$.jsx)(`span`,{children:N()}),(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=g(a.admin.upsertInstanceConfig),n=se(),r=M(a.me.getMe,{host:J}),o=e.config??{},s=Z(e.config?.contentLocale,r?.defaultLocale??void 0),[l,u]=(0,Q.useState)(()=>z(o,s));(0,Q.useEffect)(()=>{u(z(o,s))},[s,e._id]);let[d,f]=(0,Q.useState)(!1),p=l.promptInjections,m=(e,t)=>u({...l,promptInjections:{...p,[e]:{...p[e],...t}}});async function h(){f(!0);try{await t({instanceId:e._id,config:H(l,o,s)})}catch(e){n.error(c(),e)}finally{f(!1)}}async function _(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(c(),e)}}let v=e.config?.contentLocale??`default`,y=ce[Z(void 0,r?.defaultLocale??void 0)];return(0,$.jsxs)(`div`,{className:`oc-injtab__body`,children:[(0,$.jsxs)(`div`,{className:`oc-injtab__content-locale`,children:[(0,$.jsx)(`span`,{children:C()}),(0,$.jsxs)(q,{value:v,onValueChange:e=>void _(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:E({locale:y})}),le().map(e=>(0,$.jsx)(K,{value:e.value,children:e.label},e.value))]})]}),(0,$.jsx)(`p`,{className:`oc-admin__hint`,children:i()})]}),ae.map(e=>(0,$.jsx)(he,{injKey:e,def:B[e],i18n:ue[e],row:p[e]??{enabled:!0,template:B[e].defaultTemplate[s]},contentLocale:s,onChange:t=>m(e,t)},e)),(0,$.jsx)(`div`,{className:`oc-injtab__actions`,children:(0,$.jsx)(W,{size:`sm`,onClick:()=>void h(),disabled:d,children:w()})})]})}function he({injKey:e,def:t,i18n:n,row:r,contentLocale:i,onChange:a}){let[o,s]=(0,Q.useState)(!1),c=r.template.trim()!==t.defaultTemplate[i],l=t.togglable&&!r.enabled,f=Object.fromEntries(t.placeholders.map(e=>[e,de[e]??`{${e}}`])),m=L(e,r,i),h=m?R(m,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)(oe,{checked:r.enabled,onCheckedChange:e=>a({enabled:e===!0})}),(0,$.jsx)(V,{label:n.label(),help:n.help()})]}):(0,$.jsx)(V,{label:n.label(),help:n.help()}),c&&(0,$.jsx)(`span`,{className:`oc-injection__badge`,children:P()})]}),(0,$.jsx)(`textarea`,{className:`oc-injcard__text`,value:r.template,disabled:l,rows:8,spellCheck:!1,onChange:e=>a({template:e.target.value})}),(0,$.jsxs)(`div`,{className:`oc-injection__foot`,children:[(0,$.jsxs)(`div`,{className:`oc-injcard__phs`,children:[(0,$.jsx)(`span`,{className:`oc-injection__ph`,children:u()}),t.placeholders.map(e=>(0,$.jsxs)(`span`,{className:`oc-injcard__ph-chip`,children:[(0,$.jsx)(`code`,{children:`{${e}}`}),(0,$.jsx)(U,{text:(fe[e]??(()=>e))()})]},e))]}),(0,$.jsxs)(`div`,{className:`oc-injcard__btns`,children:[(0,$.jsx)(W,{variant:`ghost`,size:`sm`,onClick:()=>s(e=>!e),children:o?j():p()}),c&&(0,$.jsx)(W,{variant:`ghost`,size:`sm`,onClick:()=>a({template:t.defaultTemplate[i]}),children:I()})]})]}),o&&(0,$.jsx)(`div`,{className:`oc-injcard__preview`,children:h?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`pre`,{className:`oc-injcard__previewtext`,children:h}),(0,$.jsx)(`span`,{className:`oc-injection__ph`,children:re()})]}):(0,$.jsx)(`span`,{className:`oc-injection__ph`,children:d()})})]})}export{pe as PromptInjectionsTab};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$v as r,Av as i,Bv as a,Dv as o,E as s,Ev as c,Gv as l,Hv as u,Jv as d,Kv as f,Mv as p,Ov as m,Qv as h,Rv as g,Tv as ee,Uv as te,Vv as ne,Wv as re,Xv as _,Yv as v,Zv as ie,ay as y,cy as b,dy as x,ej as S,ey as C,fy as w,ir as T,iy as E,jv as D,kv as O,ly as k,ny as A,oy as j,py as M,qv as N,ry as P,sy as F,tj as I,ty as L,uy as R,wv as z,zv as ae}from"./dist-0NlyORTv.js";import{t as B}from"./button-CW3POj4v.js";import{At as V,B as H,at as U,ot as W,p as G,u as K,z as q}from"./index-Oefe3uVe.js";import{t as J}from"./roleDescriptions-C_V0jprM.js";var Y=t(e(),1),X=n(),Z=[{group:()=>M(),keys:[{key:`traces.read`,label:()=>b()},{key:`traces.read.content`,label:()=>F(),phi:!0},{key:`traces.write`,label:()=>j()}]},{group:()=>w(),keys:[{key:`kpi.read`,label:()=>b()},{key:`kpi.write`,label:()=>j()}]},{group:()=>x(),keys:[{key:`openclaw.query`,label:()=>y()},{key:`anomalies.read`,label:()=>E()},{key:`anomalies.report`,label:()=>P()}]},{group:()=>R(),keys:[{key:`chats.read`,label:()=>b()},{key:`selfheal`,label:()=>L()},{key:`feedback.respond`,label:()=>T()}]},{group:()=>k(),keys:[{key:`admin.manage`,label:()=>A()}]}],oe=Z.flatMap(e=>e.keys.map(e=>e.key));function Q(e){return e.includes(`*`)}var $={key:``,name:``,description:``};function se(){let e=I(s.apiKeys.listRoles,{}),t=S(s.apiKeys.createRole),n=S(s.apiKeys.ensureRolesSeeded),y=S(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))}),b=H(),x=q(),[w,T]=(0,Y.useState)(!1),[E,k]=(0,Y.useState)($),[A,j]=(0,Y.useState)(new Set);(0,Y.useEffect)(()=>{n({}).catch(e=>{x.error(r(),e)})},[n,x]);let M=e??[];async function P(e,t){if(Q(e.permissions)||A.has(e._id))return;let n=e.permissions.includes(t)?e.permissions.filter(e=>e!==t):[...e.permissions,t];if(!(e.builtin&&!await b({title:h({name:e.name}),description:ie(),confirmLabel:_()}))){j(t=>new Set(t).add(e._id));try{await y({roleId:e._id,permissions:n})}catch(e){x.error(v(),e)}finally{j(t=>{let n=new Set(t);return n.delete(e._id),n})}}}async function F(){try{await t({key:E.key,name:E.name,description:E.description||void 0,permissions:[]}),k($),T(!1)}catch(e){x.error(d(),e)}}let L=e===void 0,R=!L&&M.length===0;return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`p`,{className:`oc-admin__hint`,children:[N(),` `,(0,X.jsx)(`code`,{children:`admin`}),` `,f(),` `,(0,X.jsx)(`code`,{children:`traces.read.content`}),` `,l()]}),(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:re()}),(0,X.jsx)(`div`,{className:`oc-dt__bar-actions`,children:(0,X.jsx)(B,{size:`sm`,onClick:()=>{k($),T(!0)},children:te()})})]}),L?(0,X.jsx)(`p`,{className:`oc-admin__hint`,children:u()}):R?(0,X.jsx)(`p`,{className:`oc-admin__hint`,children:ne()}):(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:a()}),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?C({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:M.map(e=>{let t=Q(e.permissions),n=A.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)(V,{}),` `,ae()]}):(0,X.jsx)(U,{variant:`secondary`,children:g()})]}),J(e)?(0,X.jsx)(`p`,{className:`oc-matrix__roledesc`,children:J(e)}):null]}),oe.map(r=>(0,X.jsx)(`td`,{className:`oc-matrix__cell`,children:(0,X.jsx)(G,{checked:t||e.permissions.includes(r),disabled:t||n,"aria-label":`${e.key} · ${r}`,title:t?p():n?D():r,onCheckedChange:()=>void P(e,r)})},r))]},e.key)})})]})})]}),(0,X.jsx)(K,{open:w,onOpenChange:T,title:i(),description:O(),canSubmit:!!(E.key&&E.name),onSubmit:F,submitLabel:m(),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:o()}),(0,X.jsx)(W,{value:E.key,placeholder:c(),onChange:e=>k({...E,key:e.target.value})})]}),(0,X.jsxs)(`label`,{className:`oc-field`,children:[(0,X.jsx)(`span`,{className:`oc-field__label`,children:ee()}),(0,X.jsx)(W,{value:E.name,onChange:e=>k({...E,name:e.target.value})})]}),(0,X.jsxs)(`label`,{className:`oc-field`,children:[(0,X.jsx)(`span`,{className:`oc-field__label`,children:z()}),(0,X.jsx)(W,{value:E.description,onChange:e=>k({...E,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{$E as r,AD as i,AE as a,BE as o,CD as ee,CE as s,DD as te,DE as c,E as l,ED as ne,EE as re,FD as ie,FE as u,GE as ae,HE as oe,ID as se,IE as d,JE as ce,KE as le,LD as ue,LE as f,MD as de,ME as p,ND as m,NE as h,OD as fe,OE as g,PD as pe,PE as _,QA as me,QE as he,RD as ge,RE as v,SD as _e,SE as y,TD as ve,TE as b,UE as ye,VE as be,WE as xe,XE as Se,YE as Ce,ZE as we,_D as Te,aD as Ee,bD as De,bE as Oe,cD as ke,dD as Ae,eD as je,ej as x,fD as Me,gD as Ne,hD as Pe,iD as Fe,jD as Ie,jE as Le,kD as Re,kE as S,lD as ze,mD as Be,nD as Ve,oD as He,pD as Ue,qE as We,rD as Ge,sD as Ke,tD as qe,tj as C,uD as Je,vD as Ye,vE as w,wD as Xe,wE as T,xD as Ze,xE as E,yD as Qe,yE as D,zE as O}from"./dist-0NlyORTv.js";import{n as k}from"./dist-cyUFYUNU.js";import{i as $e}from"./dist-PBgCwwDJ.js";import{t as A}from"./button-CW3POj4v.js";import{A as j,B as et,Bt as tt,C as M,It as N,S as P,Vt as nt,at as F,b as I,ct as L,dt as R,ft as z,k as B,lt as V,ot as H,st as U,u as rt,ut as W,w as G,x as K,z as it,zt as at}from"./index-Oefe3uVe.js";import{t as ot}from"./FilterBar-C4F1dTQ_.js";import{t as st}from"./DataTableShell-2dt7qzK1.js";import{t as ct}from"./roleDescriptions-C_V0jprM.js";var q=t(e(),1),J=n(),Y=[{value:`never`,label:()=>T(),days:null},{value:`30`,label:()=>s(),days:30},{value:`90`,label:()=>y(),days:90}],X=720*60*60*1e3,Z=`__all__`,Q={name:``,roleKey:``,description:``};function $(){let e=nt({from:`/settings/serviceAccounts`}),t=tt({from:`/settings/serviceAccounts`}),n=e.q??``,a=e.status??Z,[o,s]=(0,q.useState)(Z),c=e=>void t({search:t=>({...t,q:e||void 0}),replace:!0}),re=e=>void t({search:t=>({...t,status:e===Z?void 0:e})}),u=C(l.apiKeys.listServiceAccounts,{filter:{q:n||void 0,role:o===Z?void 0:o,disabled:a===Z?void 0:a===`disabled`}}),d=C(l.apiKeys.listKeys,{}),f=C(l.apiKeys.listRoles,{}),p=x(l.apiKeys.createServiceAccount),h=x(l.apiKeys.updateServiceAccount),g=x(l.apiKeys.deleteServiceAccount),_=me(l.apiKeys.mintApiKey),v=x(l.apiKeys.revokeApiKey),y=et(),b=it(),be=n!==``||o!==Z||a!==Z;function Oe(){s(Z),t({search:{},replace:!0})}let[Le,S]=(0,q.useState)(!1),[w,T]=(0,q.useState)(Q),[E,D]=(0,q.useState)(null),[O,k]=(0,q.useState)(new Set),[j,N]=(0,q.useState)(null),L=(0,q.useRef)(!1),[R,z]=(0,q.useState)(new Set),[B,V]=(0,q.useState)({}),[U,W]=(0,q.useState)(null),X=(0,q.useMemo)(()=>{let e=new Map;for(let t of d??[]){let n=e.get(t.serviceAccountId)??[];n.push(t),e.set(t.serviceAccountId,n)}return e},[d]);function $(e){k(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})}async function dt(){try{E?(await h({serviceAccountId:E,name:w.name,roleKey:w.roleKey,description:w.description}),b.success(Ve())):await p({name:w.name,roleKey:w.roleKey,description:w.description||void 0}),T(Q),D(null),S(!1)}catch(e){b.error(E?Ge():Fe(),e)}}function ft(e){T({name:e.name,roleKey:e.roleKey,description:e.description??``}),D(e._id),S(!0)}async function pt(e){if(L.current)return;L.current=!0;let t=B[e._id]??`never`,n=Y.find(e=>e.value===t)?.days??null,r=n?Date.now()+n*24*60*60*1e3:void 0;N(e._id);try{let t=await _({serviceAccountId:e._id,expiresAt:r});W({accountName:e.name,plaintext:t.plaintext,prefix:t.prefix,lastFour:t.lastFour})}catch(e){b.error(qe(),e)}finally{L.current=!1,N(null)}}async function mt(e){if(await y({title:je(),description:(0,J.jsxs)(J.Fragment,{children:[r(),` `,(0,J.jsx)(`span`,{className:`font-mono`,children:e.name}),` `,he(),` `,(0,J.jsx)(`strong`,{children:we()}),` `,Se()]}),confirmWord:e.name,confirmLabel:Ce(),destructive:!0}))try{await g({serviceAccountId:e._id}),b.success(ce(),e.name)}catch(e){b.error(We(),e)}}async function ht(e){if(await y({title:le(),description:(0,J.jsxs)(J.Fragment,{children:[ae(),` `,(0,J.jsxs)(`span`,{className:`font-mono`,children:[e.prefix,`…`,e.lastFour]}),` `,xe()]}),confirmLabel:ye(),destructive:!0})&&!R.has(e._id)){z(t=>new Set(t).add(e._id));try{await v({keyId:e._id})}catch(e){b.error(oe(),e)}finally{z(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:ge()}),(0,J.jsxs)(ot,{q:n,onQChange:c,searchPlaceholder:ue(),onReset:Oe,canReset:be,children:[(0,J.jsxs)(I,{value:o,onValueChange:s,children:[(0,J.jsx)(M,{size:`sm`,className:`w-40`,children:(0,J.jsx)(G,{placeholder:se()})}),(0,J.jsxs)(K,{children:[(0,J.jsx)(P,{value:Z,children:ie()}),(f??[]).map(e=>(0,J.jsx)(P,{value:e.key,children:e.key},e._id))]})]}),(0,J.jsxs)(I,{value:a,onValueChange:re,children:[(0,J.jsx)(M,{size:`sm`,className:`w-36`,children:(0,J.jsx)(G,{})}),(0,J.jsxs)(K,{children:[(0,J.jsx)(P,{value:Z,children:pe()}),(0,J.jsx)(P,{value:`active`,children:m()}),(0,J.jsx)(P,{value:`disabled`,children:de()})]})]})]}),(0,J.jsx)(st,{title:Ie(),rows:u,addLabel:i(),onAdd:()=>{T(Q),D(null),S(!0)},emptyHint:Re(),isExpanded:e=>O.has(e._id),renderExpanded:e=>(0,J.jsx)(lt,{account:e,keys:X.get(e._id)??[],onRevoke:ht,revoking:R}),rowActions:e=>[{label:ve(),onSelect:()=>ft(e)},{label:fe(),onSelect:()=>void pt(e)},{label:O.has(e._id)?te():ne(),onSelect:()=>$(e._id)},{label:Xe(),variant:`destructive`,onSelect:()=>void mt(e)}],columns:[{header:``,className:`w-8`,cell:e=>(0,J.jsx)(A,{variant:`ghost`,size:`icon-sm`,"aria-label":O.has(e._id)?ee():_e(),onClick:()=>$(e._id),children:O.has(e._id)?(0,J.jsx)($e,{}):(0,J.jsx)(at,{})})},{header:Ze(),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:De(),sort:e=>e.roleKey,cell:e=>(0,J.jsx)(F,{variant:`secondary`,children:e.roleKey})},{header:Qe(),sort:e=>+!!e.disabled,cell:e=>e.disabled?(0,J.jsx)(F,{variant:`destructive`,children:de()}):(0,J.jsx)(F,{variant:`outline`,children:m()})},{header:Ye(),cell:e=>(0,J.jsxs)(I,{value:B[e._id]??`never`,onValueChange:t=>V(n=>({...n,[e._id]:t})),children:[(0,J.jsx)(M,{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:Te(),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:j===e._id?Ne():Pe({count:t})})}}]}),(0,J.jsx)(rt,{open:Le,onOpenChange:e=>{S(e),e||D(null)},title:E?Be():Ae(),description:E?Ue():Je(),canSubmit:!!(w.name&&w.roleKey),onSubmit:dt,submitLabel:E?Me():ze(),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:ke()}),(0,J.jsx)(H,{value:w.name,onChange:e=>T({...w,name:e.target.value})})]}),(0,J.jsxs)(`label`,{className:`oc-field`,children:[(0,J.jsx)(`span`,{className:`oc-field__label`,children:Ke()}),(0,J.jsxs)(I,{value:w.roleKey||void 0,onValueChange:e=>T({...w,roleKey:e}),children:[(0,J.jsx)(M,{className:`w-full`,children:(0,J.jsx)(G,{placeholder:He()})}),(0,J.jsx)(K,{children:(f??[]).map(e=>(0,J.jsxs)(P,{value:e.key,children:[e.name,` (`,e.key,`)`]},e._id))})]}),(()=>{let e=(f??[]).find(e=>e.key===w.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:Ee()}),(0,J.jsx)(H,{value:w.description,onChange:e=>T({...w,description:e.target.value})})]})]})}),(0,J.jsx)(ut,{minted:U,onClose:()=>W(null)})]})}function lt({account:e,keys:t,onRevoke:n,revoking:r}){return(0,J.jsxs)(`div`,{className:`oc-sa__keys`,children:[(0,J.jsxs)(`div`,{className:`oc-sa__keys-head`,children:[be(),` `,(0,J.jsx)(`span`,{className:`font-medium`,children:e.name})]}),t.length===0?(0,J.jsx)(`p`,{className:`oc-admin__hint`,children:o()}):(0,J.jsxs)(`table`,{className:`oc-sa__keytable`,children:[(0,J.jsx)(`thead`,{children:(0,J.jsxs)(`tr`,{children:[(0,J.jsx)(`th`,{children:O()}),(0,J.jsx)(`th`,{children:v()}),(0,J.jsx)(`th`,{children:f()}),(0,J.jsx)(`th`,{children:d()}),(0,J.jsx)(`th`,{children:u()}),(0,J.jsx)(`th`,{children:_()}),(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)(F,{variant:`secondary`,children:e.roleKey})}),(0,J.jsx)(`td`,{children:j(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)(A,{variant:`destructive`,size:`sm`,disabled:r.has(t._id),onClick:()=>n(t),children:r.has(t._id)?h():p()})})]},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)(U,{open:e!==null,onOpenChange:e=>{e||(r(!1),t())},children:e?(0,J.jsxs)(L,{className:`max-w-lg`,showCloseButton:!1,onInteractOutside:e=>e.preventDefault(),onEscapeKeyDown:e=>e.preventDefault(),children:[(0,J.jsxs)(R,{children:[(0,J.jsx)(z,{children:Le()}),(0,J.jsx)(V,{children:a({name:e.accountName})})]}),(0,J.jsx)(`div`,{className:`oc-sa__minted-warning`,children:S()}),(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)(A,{variant:`outline`,size:`sm`,onClick:()=>void i(),"aria-label":g(),children:[n?(0,J.jsx)(k,{}):(0,J.jsx)(N,{}),n?c():re()]})]}),(0,J.jsx)(W,{children:(0,J.jsx)(A,{onClick:()=>{r(!1),t()},children:b()})})]}):null})}function dt(e){return e===null?!1:Date.now()-e>X}function ft(e){return e===null?E():j(e)}function pt(e){return e===null?`—`:B(e)}function mt(e){return e.disabled?(0,J.jsx)(F,{variant:`destructive`,children:Oe()}):e.expiresAt!==null&&e.expiresAt<Date.now()?(0,J.jsx)(F,{variant:`outline`,children:D()}):(0,J.jsx)(F,{variant:`outline`,children:w()})}export{$ as ServiceAccountsTab};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$i as r,Ai as i,Bi as a,Ci as o,Di as s,E as c,Ei as l,Fi as u,Gi as d,Hi as f,Ii as p,Ji as m,Ki as h,Li as g,Mi as _,Ni as v,Oi as y,Pi as b,Qi as x,Ri as S,Si as C,Ti as w,Ui as T,Vi as E,Wi as D,Xi as O,Yi as k,Zi as A,bi as j,ea as M,ej as N,ia as P,ji as F,ki as I,na as L,qi as ee,ra as R,ta as z,tj as B,wi as V,xi as H,zi as U}from"./dist-0NlyORTv.js";import{t as W}from"./button-CW3POj4v.js";import{A as G,B as K}from"./index-Oefe3uVe.js";import{t as q}from"./DataTableShell-2dt7qzK1.js";var J=t(e(),1),Y=n(),X={hung:()=>E(),wrong_result:()=>a(),error:()=>U(),other:()=>S()},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=N(c.subAgentReports.respondToReport),[r,a]=(0,J.useState)(e.thread),[d,f]=(0,J.useState)(``),[m,h]=(0,J.useState)(!1);async function x(){let t=d.trim();if(!(!t||m)){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),` · `,g({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:p()}),(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:u()}),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`?b():v()}),(0,Y.jsx)(`span`,{className:`oc-notif__msg-text`,children:e.text})]},t))}):(0,Y.jsx)(`p`,{className:`oc-fbadmin__meta`,children:_()}),(0,Y.jsx)(`textarea`,{className:`oc-feedback__textarea`,placeholder:F(),value:d,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 x(),disabled:!d.trim()||m,children:m?I():i()})})]}),(0,Y.jsxs)(`section`,{children:[(0,Y.jsxs)(`h4`,{className:`oc-fbadmin__h`,children:[y({count:t.children.length}),t.childrenTruncated?` ${s()}`:``,t.textTruncated?` ${l()}`:``]}),(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?` · ${w()}`:``]}),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:V()}),(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:o()}),(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(c.subAgentReports.listForAdmin,{}),t=N(c.subAgentReports.readReport),n=N(c.subAgentReports.deleteReport),i=K(),[a,o]=(0,J.useState)(null),[s,l]=(0,J.useState)({});async function u(e){if(a===e._id){o(null);return}if(!s[e._id]){let n=await t({reportId:e._id});l(t=>({...t,[e._id]:n}))}o(e._id)}async function p(e){await i({title:C(),description:H(),confirmLabel:j(),destructive:!0})&&(await n({reportId:e._id}),a===e._id&&o(null))}return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(`p`,{className:`oc-admin__hint`,children:[L(),` `,(0,Y.jsx)(`strong`,{children:z()}),` `,M()]}),(0,Y.jsx)(q,{title:P(),rows:e,emptyHint:R(),isExpanded:e=>a===e._id&&!!s[e._id],renderExpanded:e=>s[e._id]?(0,Y.jsx)($,{data:s[e._id]}):null,columns:[{header:r(),cell:e=>G(e.at),sort:e=>e.at},{header:x(),cell:e=>Z(e.category),sort:e=>Z(e.category)},{header:A(),cell:e=>`${e.failedCount}/${e.totalCount}`,sort:e=>e.failedCount},{header:O(),cell:e=>(e.reporterEmail||e.reporterName||`—`)+(e.impersonated&&e.realOperatorEmail?` ${ee({operator:e.realOperatorEmail})}`:``),sort:e=>e.reporterEmail||e.reporterName||null},{header:k(),cell:e=>e.hasComment?`✎`:`—`,sort:e=>+!!e.hasComment},{header:m(),cell:e=>e.answered?(0,Y.jsx)(`span`,{className:`oc-fbadmin__pill is-ok`,children:h()}):(0,Y.jsx)(`span`,{className:`oc-fbadmin__pill`,children:d()}),sort:e=>+!!e.answered}],rowActions:e=>[{label:a===e._id?T():D(),onSelect:()=>void u(e)},{label:f(),onSelect:()=>void p(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{$O as r,AO as i,Ak as a,BO as o,Bk as s,CO as c,Ck as l,D as u,DO as d,Dk as f,E as p,EO as m,Ek as h,FO as g,Fk as _,GO as v,HA as y,HO as ee,Hk as te,IO as ne,Ik as re,JO as ie,KO as ae,LO as oe,Lk as se,MO as ce,Mk as le,NO as ue,Nk as b,OO as de,Ok as fe,PO as pe,Pk as me,QA as he,QO as ge,RO as _e,Rk as ve,SO as ye,Sk as be,TO as x,Tk as xe,UA as Se,UO as Ce,Uk as we,VO as S,Vk as Te,WA as Ee,WO as De,XO as Oe,YO as ke,ZO as Ae,_i as je,_k as Me,ak as Ne,bk as Pe,ck as Fe,dk as Ie,ej as C,ek as Le,fk as Re,gi as ze,gk as Be,hk as Ve,ik as He,jO as Ue,jk as We,kO as w,kk as Ge,lk as Ke,mk as qe,n as Je,nk as Ye,ok as T,pk as Xe,qO as Ze,rk as Qe,sk as $e,tj as E,tk as et,uk as tt,vi as D,vk as nt,wO as rt,wk as it,xO as at,xk as ot,yi as O,yk as st,zO as ct,zk as lt}from"./dist-0NlyORTv.js";import{n as k}from"./dist-cyUFYUNU.js";import{t as A}from"./x-C93RBiVN.js";import{t as j}from"./button-CW3POj4v.js";import{$ as ut,C as M,Ft as dt,Pt as N,S as P,at as F,b as I,et as ft,ht as pt,it as mt,mt as ht,nt as gt,ot as L,p as R,pt as _t,rt as z,tt as B,w as V,x as H}from"./index-Oefe3uVe.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-DejnuKjD.js";import{a as Tt,i as U,n as Et,o as W,r as G,t as Dt}from"./table-BytigxuJ.js";import{t as Ot}from"./TimeRangePicker-BCP5a7nZ.js";import{t as kt}from"./FilterBar-C4F1dTQ_.js";import{t as At}from"./AdvancedFilter-B31lk9q3.js";var K=u(`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(De());if(e.size>Rt)throw Error(Ce());let{source:n,width:r,height:i,cleanup:a}=await Ut(e);try{let a=e.type===`image/svg+xml`,s=Math.min(zt/r,Bt/i,a?1/0:1),c=Math.max(1,Math.round(r*s)),l=Math.max(1,Math.round(i*s)),u=document.createElement(`canvas`);u.width=c,u.height=l;let d=u.getContext(`2d`);if(!d)throw Error(S());d.imageSmoothingEnabled=!0,d.imageSmoothingQuality=`high`,d.drawImage(n,0,0,c,l);let f=Pt(d.getImageData(0,0,c,l).data,c,l)??{x:0,y:0,width:c,height:l},p=document.createElement(`canvas`);p.width=f.width,p.height=f.height;let m=p.getContext(`2d`);if(!m)throw Error(S());if(m.drawImage(u,f.x,f.y,f.width,f.height,0,0,f.width,f.height),t.variantFor){let e=m.getImageData(0,0,f.width,f.height);J(e.data,f.width,f.height)?It(e.data,t.variantFor===`dark`?Mt:Nt):Lt(e.data),m.putImageData(e,0,0)}let h=J(m.getImageData(0,0,f.width,f.height).data,f.width,f.height),g=await X(p,`image/webp`,Vt)??await X(p,`image/png`);if(!g)throw Error(o());return{blob:g,hasAlpha:h}}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(ee())),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`?Ee():e===`dark`?Se():y()}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:Je(`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)(k,{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)(j,{type:`button`,variant:`ghost`,size:`icon`,className:`oc-chart-card__export`,onClick:o,"aria-label":O(),title:O(),children:(0,Z.jsx)(dt,{className:`size-4`})}):null]})}function Zt({selectedKey:e,resolvedMode:t}){let n=E(p.charts.listMyCharts),r=C(p.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:_()}),(0,Z.jsx)(`p`,{className:`oc-show__desc`,children:me()})]}),(0,Z.jsxs)(`div`,{className:`oc-chart-grid`,children:[(0,Z.jsx)(Xt,{selected:e===null,title:b(),subtitle:le(),tokens:null,mode:t,onSelect:()=>void i(null)}),(n??[]).map(n=>{let r=n.via===`common`?We():n.via===`owner`?a():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:fe()}):null]})}function Qt(){let e=C(p.charts.importChart),[t,n]=(0,q.useState)(``),[r,i]=(0,q.useState)(``),[a,o]=(0,q.useState)(null),[s,c]=(0,q.useState)(!1),[l,u]=(0,q.useState)(!1);async function d(e){let t=e.target.files?.[0];if(e.target.value=``,t){o(null),c(!1);try{i(await t.text())}catch{o(T())}}}async function f(){if(o(null),c(!1),t.trim()===``){o(He());return}let a;try{a=JSON.parse(r)}catch{o(T());return}u(!0);try{await e({name:t.trim(),tokens:a}),c(!0),n(``),i(``)}catch(e){o(e instanceof Error?e.message:String(e))}finally{u(!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:qe()}),(0,Z.jsx)(`p`,{className:`oc-show__desc`,children:Xe()})]}),(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:Re()}),(0,Z.jsx)(L,{value:t,onChange:e=>n(e.target.value),placeholder:Ie(),maxLength:60})]}),(0,Z.jsxs)(`label`,{className:`oc-chart-import__field`,children:[(0,Z.jsx)(`span`,{className:`oc-chart-import__label`,children:tt()}),(0,Z.jsx)(`textarea`,{className:`oc-chart-import__textarea`,value:r,onChange:e=>i(e.target.value),placeholder:Ke(),rows:8,spellCheck:!1})]}),(0,Z.jsxs)(`div`,{className:`oc-show__row`,children:[(0,Z.jsx)(j,{variant:`outline`,size:`sm`,asChild:!0,children:(0,Z.jsxs)(`label`,{className:`oc-chart-import__file`,children:[(0,Z.jsx)(K,{className:`size-4`}),Fe(),(0,Z.jsx)(`input`,{type:`file`,accept:`application/json,.json`,className:`oc-chart-import__file-input`,onChange:e=>void d(e)})]})}),(0,Z.jsx)(j,{size:`sm`,disabled:l,onClick:()=>void f(),children:$e()})]}),a?(0,Z.jsx)(`p`,{className:`oc-chart-import__error`,children:a}):null,s?(0,Z.jsx)(`p`,{className:`oc-chart-import__ok`,children:Ne()}):null]})]})}function $t({chart:e}){let t=he(p.charts.setChartLogo),n=C(p.charts.removeChartLogo),[r,i]=(0,q.useState)(!1),[a,o]=(0,q.useState)(null),s=t=>t===`light`?e.logoLightUrl:e.logoDarkUrl;async function c(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 l(e,t){let n=t.target.files?.[0];t.target.value=``,n&&await c(e,n)}async function u(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 d(e){let t=s(e===`light`?`dark`:`light`);if(t){o(null),i(!0);try{await c(e,await(await fetch(t)).blob(),e)}catch(e){o(e instanceof Error?e.message:String(e))}finally{i(!1)}}}function f({mode:e}){let t=s(e),n=s(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`?Ae():Oe()}),(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)(j,{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?ie():ke(),(0,Z.jsx)(`input`,{type:`file`,accept:`image/*`,className:`oc-chart-import__file-input`,onChange:t=>void l(e,t)})]})}),!t&&n?(0,Z.jsx)(j,{variant:`ghost`,size:`sm`,disabled:r,onClick:()=>void d(e),children:ae()}):null,t?(0,Z.jsx)(j,{variant:`ghost`,size:`sm`,disabled:r,onClick:()=>void u(e),children:Ze()}):null]})}return(0,Z.jsxs)(`div`,{className:`oc-chart-mine__logo`,children:[(0,Z.jsx)(`span`,{className:`oc-chart-mine__groups-label`,children:ge()}),(0,Z.jsxs)(`div`,{className:`oc-chart-mine__logo-slots`,children:[(0,Z.jsx)(f,{mode:`light`}),(0,Z.jsx)(f,{mode:`dark`})]}),r?(0,Z.jsx)(`span`,{className:`oc-show__desc`,children:v()}):null,a?(0,Z.jsx)(`p`,{className:`oc-chart-import__error`,children:a}):null]})}function en({chart:e}){let t=E(p.me.getMe,{host:pt}),n=C(p.charts.addChartDomain),r=C(p.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 u=e.domains??[];async function d(){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 f(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:ct()}),(0,Z.jsxs)(`div`,{className:`oc-chart-mine__domains-body`,children:[(0,Z.jsx)(`div`,{className:`oc-chart-avail__groups`,children:u.length===0?(0,Z.jsx)(`span`,{className:`oc-show__desc`,children:g()}):u.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":pe({domain:e}),onClick:()=>void f(e),children:(0,Z.jsx)(A,{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:oe(),className:`oc-chart-mine__domains-input`,onKeyDown:e=>{e.key===`Enter`&&d()}}),(0,Z.jsx)(j,{variant:`outline`,size:`sm`,disabled:c,onClick:()=>void d(),children:ne()})]}),(0,Z.jsx)(`span`,{className:`oc-show__desc`,children:_e()}),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=C(p.charts.updateChart),n=C(p.charts.deleteChart),[a,o]=(0,q.useState)(!1),[s,c]=(0,q.useState)(e.name),[l,u]=(0,q.useState)(()=>tn(e.tokens)),[d,f]=(0,q.useState)(e.tokens.bpm??0),[m,h]=(0,q.useState)(null),[g,_]=(0,q.useState)(!1);function v(){c(e.name),u(tn(e.tokens)),f(e.tokens.bpm??0),h(null),o(!0)}async function y(){if(e.chartId===void 0)return;h(null);let n;try{n=JSON.parse(l)}catch{h(T());return}if(n&&typeof n==`object`&&!Array.isArray(n)){let e=n;d>0?e.bpm=d:delete e.bpm}_(!0);try{await t({chartId:e.chartId,name:s.trim(),tokens:n}),o(!1)}catch(e){h(e instanceof Error?e.message:String(e))}finally{_(!1)}}async function ee(){if(e.chartId!==void 0&&window.confirm(w()))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:a?null:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(j,{variant:`outline`,size:`sm`,onClick:v,children:Le()}),(0,Z.jsx)(j,{variant:`ghost`,size:`sm`,onClick:()=>void ee(),children:r()})]})})]}),a?(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:Ue()}),(0,Z.jsx)(L,{value:s,onChange:e=>c(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:d,onChange:e=>f(Number(e.target.value)),"aria-label":D()}),(0,Z.jsx)(`span`,{className:`oc-chart-bpm__value`,children:d===0?je():`${d} BPM`})]}),(0,Z.jsx)(`span`,{className:`oc-show__desc`,children:ze()})]}),(0,Z.jsxs)(`label`,{className:`oc-chart-import__field`,children:[(0,Z.jsx)(`span`,{className:`oc-chart-import__label`,children:i()}),(0,Z.jsx)(`textarea`,{className:`oc-chart-import__textarea`,value:l,onChange:e=>u(e.target.value),rows:10,spellCheck:!1})]}),m?(0,Z.jsx)(`p`,{className:`oc-chart-import__error`,children:m}):null,(0,Z.jsxs)(`div`,{className:`oc-show__row`,children:[(0,Z.jsx)(j,{size:`sm`,disabled:g,onClick:()=>void y(),children:ue()}),(0,Z.jsx)(j,{variant:`ghost`,size:`sm`,onClick:()=>o(!1),children:ce()})]})]}):null,(0,Z.jsx)($t,{chart:e}),(0,Z.jsx)(en,{chart:e})]})}function rn(){let e=E(p.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:Qe()}),(0,Z.jsx)(`p`,{className:`oc-show__desc`,children:Ye()})]}),e!==void 0&&t.length===0?(0,Z.jsx)(`p`,{className:`oc-show__desc`,children:et()}):(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=C(p.charts.addChartToGroupPool),r=C(p.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?Pe():e.kind===`custom`&&e.scope===`personal`?x():ot()}),e.isGlobalDefault?(0,Z.jsx)(F,{variant:`default`,children:st()}):null]}),(0,Z.jsxs)(`div`,{className:`oc-chart-avail__groups`,children:[(0,Z.jsx)(`span`,{className:`oc-chart-mine__groups-label`,children:Me()}),(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":Ve({group:e.name}),onClick:()=>void l(e.groupId),children:(0,Z.jsx)(A,{className:`size-3`})})]},e.groupId)),s.length>0?(0,Z.jsxs)(I,{value:``,onValueChange:e=>void c(e),children:[(0,Z.jsx)(M,{size:`sm`,className:`w-56`,children:(0,Z.jsx)(V,{placeholder:Be()})}),(0,Z.jsx)(H,{children:s.map(e=>(0,Z.jsx)(P,{value:e._id,children:e.name},e._id))})]}):t.length===0?(0,Z.jsx)(`span`,{className:`oc-show__desc`,children:nt()}):null]})]})}function on({chart:e}){let t=C(p.charts.promoteChartToCommon),n=C(p.charts.deleteChart);async function r(){if(e.chartId!==void 0)try{await t({chartId:e.chartId})}catch{}}async function i(){if(e.chartId!==void 0&&window.confirm(w()))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`?rt():x()}),e.ownerLabel?(0,Z.jsx)(`span`,{className:`oc-show__desc`,children:m({owner:e.ownerLabel})}):null]}),(0,Z.jsxs)(`div`,{className:`oc-show__row`,children:[e.scope===`personal`?(0,Z.jsx)(j,{variant:`outline`,size:`sm`,onClick:()=>void r(),children:c()}):null,(0,Z.jsx)(j,{variant:`ghost`,size:`sm`,onClick:()=>void i(),children:ye()})]})]})}function sn({defaultThemeMode:e,defaultLocale:t,defaultChartKey:n}){let r=C(p.admin.setDefaultThemeMode),i=C(p.admin.setDefaultLocale),a=C(p.charts.setDefaultChart),o=E(p.charts.listChartsAdmin),c=E(p.groups.listGroups,{}),u=e??`system`,m=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:se()}),(0,Z.jsx)(`p`,{className:`oc-show__desc`,children:re()})]}),(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:f()}),(0,Z.jsx)(`p`,{className:`oc-show__desc`,children:h()})]}),(0,Z.jsxs)(`div`,{className:`oc-show__row`,children:[(0,Z.jsx)(j,{variant:n===null?`default`:`outline`,size:`sm`,onClick:()=>void a({name:null}),children:b()}),ht.map(e=>(0,Z.jsx)(j,{variant:n===e.key?`default`:`outline`,size:`sm`,onClick:()=>void a({name:e.key}),children:e.name},e.key)),(o??[]).filter(e=>e.kind===`custom`&&e.scope===`common`).map(e=>(0,Z.jsx)(j,{variant:n===e.key?`default`:`outline`,size:`sm`,onClick:()=>void a({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:xe()}),(0,Z.jsx)(`p`,{className:`oc-show__desc`,children:it()})]}),(0,Z.jsx)(`div`,{className:`oc-chart-avail-list`,children:(o??[]).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:l()}),(0,Z.jsx)(`p`,{className:`oc-show__desc`,children:be()})]}),(0,Z.jsx)(`div`,{className:`oc-chart-avail-list`,children:(o??[]).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:de()}),(0,Z.jsx)(`p`,{className:`oc-show__desc`,children:d()})]}),(()=>{let e=(o??[]).filter(e=>e.kind===`custom`);return e.length===0?(0,Z.jsx)(`p`,{className:`oc-show__desc`,children:at()}):(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:we()}),(0,Z.jsx)(`p`,{className:`oc-show__desc`,children:te()})]}),(0,Z.jsx)(`div`,{className:`oc-show__row`,children:[`light`,`dark`,`system`].map(e=>(0,Z.jsx)(j,{variant:u===e?`default`:`outline`,size:`sm`,onClick:()=>void r({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:Te()}),(0,Z.jsx)(`p`,{className:`oc-show__desc`,children:s()})]}),(0,Z.jsx)(`div`,{className:`oc-show__row`,children:vt().map(e=>(0,Z.jsx)(j,{variant:m===e.value?`default`:`outline`,size:`sm`,onClick:()=>void i({locale:e.value}),children:e.label},e.value))}),(0,Z.jsx)(`p`,{className:`oc-show__desc`,children:lt()})]})]})}function cn(){let e=E(p.me.getMe,{host:pt}),t=_t(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:ve()}),(0,Z.jsxs)($,{title:`Buttons`,description:`Variants`,children:[(0,Z.jsxs)(`div`,{className:`oc-show__row`,children:[(0,Z.jsx)(j,{children:`Default`}),(0,Z.jsx)(j,{variant:`secondary`,children:`Secondary`}),(0,Z.jsx)(j,{variant:`outline`,children:`Outline`}),(0,Z.jsx)(j,{variant:`ghost`,children:`Ghost`}),(0,Z.jsx)(j,{variant:`destructive`,children:`Destructive`}),(0,Z.jsx)(j,{variant:`link`,children:`Link`})]}),(0,Z.jsxs)(`div`,{className:`oc-show__row`,children:[(0,Z.jsx)(j,{size:`sm`,children:`Small`}),(0,Z.jsx)(j,{children:`Default`}),(0,Z.jsx)(j,{size:`lg`,children:`Large`}),(0,Z.jsx)(j,{size:`icon`,"aria-label":`more`,children:(0,Z.jsx)(N,{})}),(0,Z.jsx)(j,{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)(I,{value:n,onValueChange:r,children:[(0,Z.jsx)(M,{className:`w-56`,children:(0,Z.jsx)(V,{placeholder:`Select…`})}),(0,Z.jsxs)(H,{children:[(0,Z.jsx)(P,{value:`per-user`,children:`per-user (chacun son agent)`}),(0,Z.jsx)(P,{value:`shared`,children:`shared (agent commun)`})]})]}),(0,Z.jsxs)(`label`,{className:`oc-show__check`,children:[(0,Z.jsx)(R,{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)(I,{value:o,onValueChange:s,children:[(0,Z.jsx)(M,{size:`sm`,children:(0,Z.jsx)(V,{})}),(0,Z.jsxs)(H,{children:[(0,Z.jsx)(P,{value:Q,children:`Toutes directions`}),(0,Z.jsx)(P,{value:`inbound`,children:`inbound`}),(0,Z.jsx)(P,{value:`outbound`,children:`outbound`}),(0,Z.jsx)(P,{value:`internal`,children:`internal`})]})]}),(0,Z.jsxs)(I,{value:c,onValueChange:l,children:[(0,Z.jsx)(M,{size:`sm`,children:(0,Z.jsx)(V,{})}),(0,Z.jsxs)(H,{children:[(0,Z.jsx)(P,{value:Q,children:`Toutes sévérités`}),(0,Z.jsx)(P,{value:`info`,children:`info`}),(0,Z.jsx)(P,{value:`warn`,children:`warn`}),(0,Z.jsx)(P,{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)(ut,{children:[(0,Z.jsx)(mt,{asChild:!0,children:(0,Z.jsx)(j,{variant:`outline`,size:`icon`,"aria-label":`Open menu`,children:(0,Z.jsx)(N,{})})}),(0,Z.jsxs)(ft,{align:`start`,children:[(0,Z.jsx)(gt,{children:`Actions`}),(0,Z.jsx)(z,{}),(0,Z.jsx)(B,{children:`Edit`}),(0,Z.jsx)(B,{children:`Duplicate`}),(0,Z.jsx)(z,{}),(0,Z.jsx)(B,{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)(j,{size:`sm`,children:`Save`}),(0,Z.jsx)(j,{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)(R,{"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)(R,{"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)(k,{className:`size-3.5`}),` `,e.s]})}),(0,Z.jsx)(G,{children:(0,Z.jsx)(j,{variant:`ghost`,size:`icon`,"aria-label":`row actions`,children:(0,Z.jsx)(N,{})})})]},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{
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$p as r,Jp as i,Kp as a,Qp as o,Xp as s,Yp as c,Zp as l,_n as u,bn as d,em as f,gn as p,hn as m,im as h,nm as g,qp as _,rm as v,tm as y,vn as b,xn as x,yn as S}from"./dist-0NlyORTv.js";import{t as C}from"./button-CW3POj4v.js";import{A as w,Dt as T,Lt as E,_t as D,gt as O,ot as k,vt as A,yt as j}from"./index-Oefe3uVe.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:h(),from:`now-5m`},{label:v(),from:`now-15m`},{label:g(),from:`now-30m`},{label:y(),from:`now-1h`},{label:f(),from:`now-3h`},{label:r(),from:`now-6h`},{label:o(),from:`now-12h`},{label:l(),from:`now-24h`},{label:s(),from:`now-2d`},{label:c(),from:`now-7d`},{label:i(),from:`now-30d`},{label:_(),from:`now-90d`},{label:a(),from:`now-520w`}];function L(e){return w(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,a]=(0,M.useState)(``),o=F(e),[s,c]=(0,M.useState)(()=>z(o.from)),[l,f]=(0,M.useState)(()=>z(o.to));function h(t){if(t){let t=F(e);c(z(t.from)),f(z(t.to)),a(``)}r(t)}function g(e){t({kind:`relative`,from:e,to:`now`}),r(!1)}function _(){let e=B(s),n=B(l);e===null||n===null||(t({kind:`absolute`,from:e,to:n}),r(!1))}let v=(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]),y=B(s)!==null&&B(l)!==null;return(0,H.jsxs)(A,{open:n,onOpenChange:h,children:[(0,H.jsx)(j,{asChild:!0,children:(0,H.jsxs)(C,{variant:`outline`,size:`sm`,className:`oc-timerange__trigger`,children:[(0,H.jsx)(E,{}),R(e)]})}),(0,H.jsx)(D,{children:(0,H.jsx)(O,{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:x()}),(0,H.jsxs)(`label`,{className:`oc-field`,children:[(0,H.jsx)(`span`,{className:`oc-field__label`,children:d()}),(0,H.jsx)(k,{type:`datetime-local`,value:s,onChange:e=>c(e.target.value)})]}),(0,H.jsxs)(`label`,{className:`oc-field`,children:[(0,H.jsx)(`span`,{className:`oc-field__label`,children:S()}),(0,H.jsx)(k,{type:`datetime-local`,value:l,onChange:e=>f(e.target.value)})]}),(0,H.jsx)(C,{size:`sm`,className:`oc-timerange__apply`,disabled:!y,onClick:_,children:b()})]}),(0,H.jsxs)(`div`,{className:`oc-timerange__relative`,children:[(0,H.jsxs)(`div`,{className:`oc-timerange__search`,children:[(0,H.jsx)(T,{className:`oc-timerange__search-icon`,"aria-hidden":!0}),(0,H.jsx)(k,{value:i,onChange:e=>a(e.target.value),placeholder:u(),"aria-label":p()})]}),(0,H.jsx)(`ul`,{className:`oc-timerange__list`,children:v.length===0?(0,H.jsx)(`li`,{className:`oc-timerange__empty`,children:m()}):v.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:()=>g(t.from),children:t.label})},t.from))})]})]})})})]})}export{U as n,V as r,G as t};
|