@lacneu/atrium 0.22.0 → 0.23.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-CJcKd-bd.js → AccessTab-D0FPRjwL.js} +1 -1
- package/dist/assets/{AdvancedFilter-BL2m0s1O.js → AdvancedFilter-CtaYuy-W.js} +1 -1
- package/dist/assets/AgentFilesTab-BnrDFGg2.js +3 -0
- package/dist/assets/AnomaliesTab-DbJTYrA3.js +1 -0
- package/dist/assets/{AuditTab-rp3o9ni_.js → AuditTab-CeHLEJ6L.js} +1 -1
- package/dist/assets/{BridgeTab-D9M2Jvdh.js → BridgeTab-DNaXjHu5.js} +1 -1
- package/dist/assets/ChatDefaultsTab-BhhumrcM.js +1 -0
- package/dist/assets/{DataTableShell-ezCmCHde.js → DataTableShell-VIRQvS8e.js} +1 -1
- package/dist/assets/{DetailChips-DZl7SJAQ.js → DetailChips-YKc12Z-i.js} +1 -1
- package/dist/assets/FeedbacksTab-BLyfs_L4.js +1 -0
- package/dist/assets/{FieldLabel-P7nCb2ED.js → FieldLabel-BYZOkwDx.js} +1 -1
- package/dist/assets/FilesTab-DYGvOehC.js +1 -0
- package/dist/assets/{FilterBar-NyP0u16q.js → FilterBar-DWv8wqqC.js} +1 -1
- package/dist/assets/GroupsTab-BOkc2jks.js +1 -0
- package/dist/assets/InstancesTab-WCkAX_gl.js +1 -0
- package/dist/assets/IntegrationsTab-Bwd59JJJ.js +1 -0
- package/dist/assets/KpiTab-flOR56nE.js +1 -0
- package/dist/assets/PreferencesTab-Ddm8m8BL.js +1 -0
- package/dist/assets/{PromptInjectionsTab-Ca3Wtw06.js → PromptInjectionsTab-CuooI8Zy.js} +2 -2
- package/dist/assets/RolesTab-BnF_qq0d.js +1 -0
- package/dist/assets/ServiceAccountsTab-DAeKxzUx.js +1 -0
- package/dist/assets/{SubAgentReportsTab-Dx2BdaRA.js → SubAgentReportsTab-24-Vy2sZ.js} +1 -1
- package/dist/assets/ThemeShowroom-CaoO1IiG.js +1 -0
- package/dist/assets/{TimeRangePicker-JtLvHr3a.js → TimeRangePicker-CPM9eoXo.js} +1 -1
- package/dist/assets/TracesTab-C9cfYiBZ.js +1 -0
- package/dist/assets/{UsersTab-CJboXvTd.js → UsersTab-CtD0iELd.js} +1 -1
- package/dist/assets/{button-Chsl3hJr.js → button-9c1aLUeO.js} +1 -1
- package/dist/assets/{card-BUOYrB8s.js → card-DNbBWwxH.js} +1 -1
- package/dist/assets/chevrons-up-down-D_kGoxSO.js +1 -0
- package/dist/assets/{compatView-B-SErG8a.js → compatView-DI9WOWM-.js} +1 -1
- package/dist/assets/{dispatchErrorInfo-DY4Xsf5c.js → dispatchErrorInfo-DO5jqFw-.js} +1 -1
- package/dist/assets/{dist-ClJFgNZb.js → dist-BMI7wyIc.js} +1 -1
- package/dist/assets/{dist-CEWcFkOy.js → dist-DM5LkQcA.js} +1 -1
- package/dist/assets/dist-DsBcH2-2.js +44 -0
- package/dist/assets/dist-bcnGL3nu.js +5 -0
- package/dist/assets/{highlighted-body-OFNGDK62-DzEhHpM8.js → highlighted-body-OFNGDK62-BVpyilpM.js} +1 -1
- package/dist/assets/{index-f9NGvYte.css → index-CZJySt8-.css} +1 -1
- package/dist/assets/index-DsOZBPOX.js +227 -0
- package/dist/assets/mermaid-GHXKKRXX-Bf3eJ2-p.js +1 -0
- package/dist/assets/roleDescriptions-eZmrq1l0.js +1 -0
- package/dist/assets/{table-CKAkPBqh.js → table-C2kpo1_K.js} +1 -1
- package/dist/assets/{tabs-0mZb1m9H.js → tabs-D7vYdFs6.js} +1 -1
- package/dist/assets/x-CyUGhZ48.js +1 -0
- package/dist/index.html +8 -8
- package/package.json +1 -1
- package/dist/assets/AgentFilesTab-CD068nL5.js +0 -3
- package/dist/assets/AnomaliesTab-Bc7-utkr.js +0 -1
- package/dist/assets/ChatDefaultsTab-TAcdFRwg.js +0 -1
- package/dist/assets/FeedbacksTab-DlqnH300.js +0 -1
- package/dist/assets/FilesTab-BRjvjI3H.js +0 -1
- package/dist/assets/GroupsTab-By5diDc0.js +0 -1
- package/dist/assets/InstancesTab-GL7a4Nh0.js +0 -1
- package/dist/assets/IntegrationsTab-HG2z67bd.js +0 -1
- package/dist/assets/KpiTab-eRc73EfH.js +0 -1
- package/dist/assets/PreferencesTab-CzxxuXHQ.js +0 -1
- package/dist/assets/RolesTab-ZtdhQkki.js +0 -1
- package/dist/assets/ServiceAccountsTab-BmBwTFtH.js +0 -1
- package/dist/assets/ThemeShowroom-ljIrzkNU.js +0 -1
- package/dist/assets/TracesTab-Bi8G8ogN.js +0 -1
- package/dist/assets/chevrons-up-down-BxjTVcP-.js +0 -1
- package/dist/assets/dist-CcSJxYOw.js +0 -44
- package/dist/assets/dist-CnMhrvCU.js +0 -5
- package/dist/assets/index-Dld_NfaR.js +0 -227
- package/dist/assets/mermaid-GHXKKRXX-D5fTxsHz.js +0 -1
- package/dist/assets/roleDescriptions-s8ifW_os.js +0 -1
- package/dist/assets/x-CfhV2nwo.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Bo as r,
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Bo as r,Fo as i,Go as a,Ho as o,Io as s,Jo as c,Ko as l,Lo as u,Po as d,Ro as f,Uo as p,Vo as m,Wo as h,fO as g,qo as _,yO as v,zD as y,zo as b}from"./dist-DsBcH2-2.js";import{C as x,S,X as C,b as w,x as T,y as E}from"./index-DsOZBPOX.js";var D=t(e(),1);function O(e){return e===`user`?f():e===`all`?u():s({group:e.group})}function k(e){return e===`common`?i():e===`owner`?d():s({group:e.group})}var A=n();function j(e){return e.name||e.email||e.userId.slice(0,8)}function M(){let e=v(g.admin.listUsers,{}),[t,n]=(0,D.useState)(``),i=v(g.introspect.introspectUser,t?{userId:t}:`skip`);return(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:c()}),(0,A.jsxs)(E,{value:t,onValueChange:n,children:[(0,A.jsx)(S,{size:`sm`,"aria-label":_(),children:(0,A.jsx)(x,{placeholder:_()})}),(0,A.jsx)(w,{children:(e??[]).map(e=>(0,A.jsx)(T,{value:e.userId,children:j(e)},e._id))})]}),t===``?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:l()}):i===void 0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:y()}):(0,A.jsxs)(`div`,{className:`oc-introspect`,children:[(0,A.jsxs)(`section`,{className:`oc-introspect__section`,children:[(0,A.jsx)(`h3`,{className:`oc-introspect__title`,children:a()}),(0,A.jsxs)(`div`,{className:`oc-introspect__id`,children:[(0,A.jsx)(`strong`,{children:i.user.label}),(0,A.jsx)(C,{variant:`secondary`,children:i.role})]})]}),(0,A.jsxs)(`section`,{className:`oc-introspect__section`,children:[(0,A.jsx)(`h3`,{className:`oc-introspect__title`,children:h()}),i.groups.length===0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:r()}):(0,A.jsx)(`div`,{className:`oc-introspect__chips`,children:i.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:p()}),i.agents.length===0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:r()}):(0,A.jsx)(`ul`,{className:`oc-introspect__list`,children:i.agents.map(e=>(0,A.jsxs)(`li`,{className:`oc-introspect__row`,children:[(0,A.jsx)(`span`,{className:`oc-introspect__name`,children:e.displayName||e.agentId}),e.isDefault?(0,A.jsx)(C,{variant:`default`,children:b()}):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:o()}),i.charts.length===0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:r()}):(0,A.jsx)(`ul`,{className:`oc-introspect__list`,children:i.charts.map(e=>(0,A.jsxs)(`li`,{className:`oc-introspect__row`,children:[(0,A.jsx)(`span`,{className:`oc-introspect__name`,children:e.name}),(0,A.jsx)(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:m()}),i.permissions.length===0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:r()}):(0,A.jsx)(`div`,{className:`oc-introspect__chips`,children:i.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{$c as r,al as i,el as a,il as o,nl as s,rl as c,tl as l}from"./dist-
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$c as r,al as i,el as a,il as o,nl as s,rl as c,tl as l}from"./dist-DsBcH2-2.js";import{i as u}from"./dist-BMI7wyIc.js";import{t as d}from"./x-CyUGhZ48.js";import{t as f}from"./button-9c1aLUeO.js";import{C as p,S as m,Z as h,b as g,bt as _,x as v,y}from"./index-DsOZBPOX.js";import{r as b}from"./TimeRangePicker-CPM9eoXo.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)(y,{value:t.field||void 0,onValueChange:e=>M(t.id,{field:e}),children:[(0,S.jsx)(m,{size:`sm`,className:`w-40`,children:(0,S.jsx)(p,{placeholder:s()})}),(0,S.jsx)(g,{children:e.map(e=>(0,S.jsx)(v,{value:e.value,children:e.label},e.value))})]}),(0,S.jsxs)(y,{value:t.op,onValueChange:e=>M(t.id,{op:e}),children:[(0,S.jsx)(m,{size:`sm`,className:`w-28`,children:(0,S.jsx)(p,{})}),(0,S.jsx)(g,{children:C.map(e=>(0,S.jsx)(v,{value:e.value,children:e.label},e.value))})]}),(0,S.jsx)(h,{className:`oc-advfilter__value`,value:t.value,onChange:e=>M(t.id,{value:e.target.value}),placeholder:l()}),(0,S.jsx)(f,{variant:`ghost`,size:`icon-sm`,"aria-label":a(),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)(_,{}),r()]})]}):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{AS as r,Ci as i,Di as a,Ei as o,Oi as s,Si as ee,Ti as te,VD as ne,_i as c,ai as l,bi as re,ci as u,di as d,ei as f,fO as p,fa as m,fi as h,gO as g,gi as _,hi as v,ii as y,ki as ie,li as b,mi as x,ni as S,oi as C,pi as ae,ri as w,si as T,ti as E,ua as oe,ui as se,vi as ce,wi as D,xi as O,yO as k,yi as A,zD as j}from"./dist-DsBcH2-2.js";import{t as M}from"./button-9c1aLUeO.js";import{$ as N,A as P,B as F,C as I,F as le,I as ue,L as de,N as fe,P as pe,Q as me,R as he,S as L,X as R,b as z,et as ge,mt as B,nt as _e,ot as V,rt as ve,v as H,x as U,y as W,z as ye}from"./index-DsOZBPOX.js";import{i as G}from"./compatView-DI9WOWM-.js";/* empty css */var K=t(e(),1),q=2e4,J=6e4;function Y(e){return typeof e!=`number`||e<=0?0:Math.round(e/q*100)}function X(e){return e<=0?0:Math.round(e/J*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 be(e){return e.reduce((e,t)=>e+(typeof t.size==`number`&&t.size>0?t.size:0),0)}var xe=3;function Se(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<xe&&a.push(e)):t>0&&(i+=t,o.length<xe&&o.push(e));return{added:r,removed:i,sampleAdded:a,sampleRemoved:o}}function Ce(e){return e instanceof Error?e.message.includes(`conflict:`):String(e).includes(`conflict:`)}var Q=n(),$=e=>`${e.instanceName}::${e.agentId}`;function we(){let e=k(p.me.getMe,{host:V}),t=e?.role===`admin`,n=(e?.permissions??[]).includes(`bridge.read`),r=k(p.admin.listInstances,e!==void 0&&t?{}:`skip`),[l,u]=(0,K.useState)(null);(0,K.useEffect)(()=>{!t||!r||r.length===0||(!l||!r.some(e=>e.name===l))&&u(r[0].name)},[t,r,l]);let d=k(p.agents.listAgentsForInstance,t&&l?{instanceName:l}:`skip`),f=k(p.agents.listMyAgents,e!==void 0&&!t?{}:`skip`),m=(0,K.useMemo)(()=>{if(e!==void 0){if(t)return l===null||d===void 0?r!==void 0&&r.length===0?[]:void 0:d.agents.map(e=>({instanceName:l,agentId:e.agentId,label:`${e.emoji?`${e.emoji} `:``}${e.displayName??e.agentId}`}));if(f!==void 0)return f.map(e=>({instanceName:e.instanceName,agentId:e.agentId,label:`${e.emoji?`${e.emoji} `:``}${e.displayName??e.agentId}`}))}},[e,t,l,d,r,f]),[h,_]=(0,K.useState)(null);(0,K.useEffect)(()=>{!m||m.length===0||(!h||!m.some(e=>$(e)===h))&&_($(m[0]))},[m,h]);let v=m?.find(e=>$(e)===h)??null,y=g(p.agentFiles.listAgentFiles),[b,x]=(0,K.useState)({status:`idle`}),S=v?.instanceName??null,C=v?.agentId??null,ae=k(p.compat.forInstance,n&&S!==null?{instanceName:S}:`skip`),w=n&&S!==null?H(ae,`agentFiles`):null,T=w===null?!1:w===`loading`?null:w.blocked,E=(0,K.useCallback)(async()=>{if(!(S===null||C===null)){x({status:`loading`});try{x({status:`done`,files:(await y({instanceName:S,agentId:C})).files})}catch{x({status:`error`})}}},[y,S,C]);(0,K.useEffect)(()=>{T===!1&&E()},[E,T]);let[se,N]=(0,K.useState)(null),P=ne(),F=(0,K.useMemo)(()=>new Intl.NumberFormat(P,{maximumFractionDigits:0}),[P]);return e===void 0||m===void 0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:j()}):(0,Q.jsxs)(`div`,{className:`oc-afiles`,children:[(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:ie()}),(0,Q.jsxs)(`div`,{className:`oc-afiles__picker`,children:[t&&(r?.length??0)>1?(0,Q.jsxs)(W,{value:l??``,onValueChange:e=>u(e),children:[(0,Q.jsx)(L,{size:`sm`,"aria-label":s(),children:(0,Q.jsx)(I,{})}),(0,Q.jsx)(z,{children:(r??[]).map(e=>(0,Q.jsx)(U,{value:e.name,children:e.name},e.name))})]}):null,m.length>0?(0,Q.jsxs)(W,{value:h??``,onValueChange:e=>_(e),children:[(0,Q.jsx)(L,{size:`sm`,"aria-label":a(),children:(0,Q.jsx)(I,{})}),(0,Q.jsx)(z,{children:m.map(e=>(0,Q.jsx)(U,{value:$(e),children:e.label},$(e)))})]}):(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:o()})]}),v===null?null:w===`loading`?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:j()}):w!==null&&w.blocked?(0,Q.jsxs)(`p`,{className:`oc-compat__blocked`,role:`status`,children:[(0,Q.jsx)(B,{size:14,"aria-hidden":!0}),` `,G(w.gatewayVersion)]}):b.status===`loading`||b.status===`idle`?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:j()}):b.status===`error`?(0,Q.jsxs)(`p`,{className:`oc-afiles__error`,role:`alert`,children:[D(),` `,(0,Q.jsx)(M,{variant:`outline`,size:`sm`,onClick:()=>void E(),children:oe()})]}):b.files.length===0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:te()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`div`,{className:`oc-afiles__list`,children:b.files.map(e=>{let n=Y(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)(R,{variant:`outline`,children:i()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`span`,{className:`oc-afiles__size`,children:ee({size:Z(e.size,P)})}),(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:O({pct:F.format(n)})}),r?(0,Q.jsx)(B,{size:14,className:`oc-afiles__warn`,"aria-label":re()}):(0,Q.jsx)(`span`,{className:`oc-afiles__warn-slot`,"aria-hidden":!0})]}),(0,Q.jsx)(M,{variant:`outline`,size:`sm`,className:`oc-afiles__open`,onClick:()=>N(e),children:t?ce():c()})]},e.name)})}),(0,Q.jsx)(`p`,{className:`oc-afiles__budget`,children:A({used:Z(be(b.files),P),total:Z(J,P),pct:F.format(X(be(b.files)))})})]}),se&&v?(0,Q.jsx)(Te,{instanceName:v.instanceName,agentId:v.agentId,name:se.name,isAdmin:t,onClose:()=>N(null),onSaved:()=>void E()}):null]})}function Te({instanceName:e,agentId:t,name:n,isAdmin:i,onClose:a,onSaved:o}){let s=g(p.agentFiles.getAgentFile),ee=g(p.agentFiles.setAgentFile),te=P(),[c,re]=(0,K.useState)(null),[ie,ce]=(0,K.useState)(!1),[D,O]=(0,K.useState)(``),[k,A]=(0,K.useState)(!1),[I,L]=(0,K.useState)(!1),[R,z]=(0,K.useState)(!1),[B,V]=(0,K.useState)(!1),H=(0,K.useCallback)(async r=>{ce(!1);try{let i=await s({instanceName:e,agentId:t,name:n});re({content:i.content,updatedAtMs:i.updatedAtMs}),r||O(i.content),z(!1)}catch{ce(!0)}},[s,e,t,n]);(0,K.useEffect)(()=>{H(!1)},[H]);async function U(){if(c!==null){L(!0),V(!1);try{await ee({instanceName:e,agentId:t,name:n,content:D,baseUpdatedAtMs:c.updatedAtMs??void 0}),te.success(se({name:n})),o(),await H(!1)}catch(e){Ce(e)?z(!0):V(!0)}finally{L(!1)}}}let W=c!==null&&D!==c.content,G=(0,K.useMemo)(()=>c===null?null:Se(c.content,D),[c,D]),J=D.length>q,Y=ne(),X=(0,K.useMemo)(()=>new Intl.NumberFormat(Y),[Y]);return(0,Q.jsx)(me,{open:!0,onOpenChange:e=>!e&&a(),children:(0,Q.jsxs)(N,{className:`oc-afiles__editor`,children:[(0,Q.jsxs)(_e,{children:[(0,Q.jsx)(ve,{children:_({name:n})}),(0,Q.jsxs)(ge,{children:[v({agent:t,instance:e}),i?null:(0,Q.jsxs)(Q.Fragment,{children:[` · `,x()]})]})]}),ie?(0,Q.jsxs)(`p`,{className:`oc-afiles__error`,role:`alert`,children:[u(),` `,(0,Q.jsx)(M,{variant:`outline`,size:`sm`,onClick:()=>void H(!1),children:oe()})]}):c===null?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:j()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`textarea`,{className:`oc-afiles__source`,value:D,readOnly:!i,spellCheck:!1,onChange:e=>O(e.target.value),"aria-label":_({name:n})}),(0,Q.jsx)(`p`,{className:`oc-afiles__hint`,children:ae()}),R?(0,Q.jsxs)(`p`,{className:`oc-afiles__error`,role:`alert`,children:[T(),` `,(0,Q.jsx)(M,{variant:`outline`,size:`sm`,onClick:()=>void H(!0),children:C()})]}):null,B?(0,Q.jsx)(`p`,{className:`oc-afiles__error`,role:`alert`,children:b()}):null,(0,Q.jsxs)(`div`,{className:`oc-afiles__editor-foot`,children:[(0,Q.jsx)(`span`,{className:`oc-afiles__count${J?` is-over`:``}`,children:h({count:X.format(D.length),max:X.format(q)})}),i?(0,Q.jsx)(M,{size:`sm`,disabled:!W||I||R,onClick:()=>A(!0),children:I?m():d()}):null]})]}),(0,Q.jsx)(fe,{open:k,onOpenChange:A,children:(0,Q.jsxs)(ue,{children:[(0,Q.jsxs)(ye,{children:[(0,Q.jsx)(F,{children:l({name:n})}),(0,Q.jsx)(de,{children:y({agent:t})})]}),G?(0,Q.jsxs)(`div`,{className:`oc-afiles__diff`,children:[(0,Q.jsx)(`p`,{className:`oc-afiles__diff-counts`,children:w({added:G.added,removed:G.removed})}),G.sampleAdded.length>0?(0,Q.jsxs)(`div`,{className:`oc-afiles__diff-block`,children:[(0,Q.jsx)(`span`,{className:`oc-afiles__diff-label`,children:S()}),G.sampleAdded.map((e,t)=>(0,Q.jsx)(`code`,{className:`oc-afiles__diff-line is-add`,children:e||` `},t))]}):null,G.sampleRemoved.length>0?(0,Q.jsxs)(`div`,{className:`oc-afiles__diff-block`,children:[(0,Q.jsx)(`span`,{className:`oc-afiles__diff-label`,children:E()}),G.sampleRemoved.map((e,t)=>(0,Q.jsx)(`code`,{className:`oc-afiles__diff-line is-del`,children:e||` `},t))]}):null]}):null,(0,Q.jsxs)(he,{children:[(0,Q.jsx)(le,{children:r()}),(0,Q.jsx)(pe,{onClick:()=>void U(),children:f()})]})]})})]})})}export{we as AgentFilesTab};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$p as r,Am as i,Bm as a,Cm as ee,Dm as te,Em as ne,Fm as re,Im as ie,Lm as ae,Mm as o,Nm as s,Om as c,Pm as l,Rm as u,Sm as d,Tm as f,Vm as p,_m as oe,am as se,bm as ce,cm as le,dm as ue,em as m,fO as h,fm as de,gm as g,hm as fe,im as pe,jm as me,km as he,lm as ge,mm as _,nm as v,om as y,pm as b,rm as x,sm as S,tm as C,um as w,vO as T,vm as E,wm as D,xm as O,yO as k,ym as A,zm as j}from"./dist-DsBcH2-2.js";import{A as M,C as N,Mt as P,S as F,X as I,a as L,b as R,j as _e,jt as z,ot as ve,r as ye,x as B,y as V}from"./index-DsOZBPOX.js";import{n as be}from"./TimeRangePicker-CPM9eoXo.js";import{t as xe}from"./FilterBar-DWv8wqqC.js";import{t as Se}from"./DataTableShell-VIRQvS8e.js";import{t as H}from"./dispatchErrorInfo-DO5jqFw-.js";var U=t(e(),1),W=n(),G=`__all__`,Ce=[{value:`open`},{value:`acknowledged`},{value:`resolved`}];function we(e){return e===`open`?p():e===`acknowledged`?a():j()}var Te=[`info`,`warn`,`critical`],Ee=[`detector`,`agent`,`user`],De={kind:`relative`,from:`now-30d`,to:`now`},Oe=200,K=`all`;function q(){let e=P({from:`/settings/anomalies`}),t=z({from:`/settings/anomalies`}),n=e.q??``,r=e.status===K?G:e.status,a=e.severity??G,p=e.kind??G,[m,v]=(0,U.useState)(G),C=ye(e.from,e.to),{from:j,to:H}=be(C),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})}),Ne=e=>void t({search:t=>({...t,kind:e===G?void 0:e})}),X=e=>void t({search:t=>({...t,...L(e)})}),Pe=_e(),Z=M(),Q=T(h.anomalies.resolveAnomaly),Fe=(k(h.me.getMe,{host:ve})?.permissions??[]).includes(`admin.manage`),$=k(h.anomalies.listAnomalies,{limit:Oe,filter:{q:n||void 0,from:j,to:H,anomalyStatus:r===G?void 0:r,severity:a===G?void 0:a,source:m===G?void 0:m,kind:p===G?void 0:p}}),Ie=(0,U.useMemo)(()=>{let e=new Set;for(let t of $??[])e.add(t.kind);return[...e].sort()},[$]),Le=n!==``||r!==`open`||a!==G||m!==G||p!==G||C.kind!==`relative`||C.from!==De.from;function Re(){v(G),t({search:{status:`open`},replace:!0})}async function ze(e){if(await Pe({title:u(),description:(0,W.jsxs)(W.Fragment,{children:[ae(),` `,(0,W.jsx)(`span`,{className:`font-mono`,children:e.kind}),` `,ie(),` `,(0,W.jsx)(`strong`,{children:re()}),`.`,` `,l()]}),confirmLabel:s()}))try{await Q({anomalyId:e._id,status:`resolved`}),Z.success(o(),e.kind)}catch(e){Z.error(me(),e)}}async function Be(e){try{await Q({anomalyId:e._id,status:`acknowledged`}),Z.success(i(),e.kind)}catch(e){Z.error(he(),e)}}return(0,W.jsxs)(W.Fragment,{children:[(0,W.jsxs)(`p`,{className:`oc-admin__hint`,children:[c(),` `,(0,W.jsx)(`strong`,{children:te()}),` `,ne(),` `,(0,W.jsx)(`strong`,{children:f()}),` `,D(),` `,(0,W.jsx)(`strong`,{children:ee()}),` `,d(),` `,(0,W.jsx)(`span`,{className:`oc-filter__window`,children:O()})]}),(0,W.jsxs)(xe,{q:n,onQChange:q,searchPlaceholder:ce(),timeRange:C,onTimeRangeChange:X,onReset:Re,canReset:Le,children:[(0,W.jsxs)(V,{value:r,onValueChange:J,children:[(0,W.jsx)(F,{size:`sm`,className:`w-36`,children:(0,W.jsx)(N,{})}),(0,W.jsxs)(R,{children:[(0,W.jsx)(B,{value:G,children:A()}),Ce.map(e=>(0,W.jsx)(B,{value:e.value,children:we(e.value)},e.value))]})]}),(0,W.jsxs)(V,{value:a,onValueChange:Y,children:[(0,W.jsx)(F,{size:`sm`,className:`w-36`,children:(0,W.jsx)(N,{placeholder:E()})}),(0,W.jsxs)(R,{children:[(0,W.jsx)(B,{value:G,children:oe()}),Te.map(e=>(0,W.jsx)(B,{value:e,children:e},e))]})]}),(0,W.jsxs)(V,{value:m,onValueChange:v,children:[(0,W.jsx)(F,{size:`sm`,className:`w-32`,children:(0,W.jsx)(N,{placeholder:g()})}),(0,W.jsxs)(R,{children:[(0,W.jsx)(B,{value:G,children:fe()}),Ee.map(e=>(0,W.jsx)(B,{value:e,children:e},e))]})]}),(0,W.jsxs)(V,{value:p,onValueChange:Ne,children:[(0,W.jsx)(F,{size:`sm`,className:`w-36`,children:(0,W.jsx)(N,{placeholder:_()})}),(0,W.jsxs)(R,{children:[(0,W.jsx)(B,{value:G,children:b()}),Ie.map(e=>(0,W.jsx)(B,{value:e,children:e},e))]})]})]}),(0,W.jsx)(Se,{title:de(),rows:$,emptyHint:r===`open`?ue():w(),rowActions:e=>Fe&&e.status===`open`?[{label:ge(),onSelect:()=>void ze(e)},{label:le(),onSelect:()=>void Be(e)}]:[],columns:[{header:S(),cell:e=>(0,W.jsx)(`span`,{className:`oc-traces__time`,children:new Date(e.at).toLocaleString(`fr-FR`)}),sort:e=>e.at},{header:_(),cell:e=>(0,W.jsx)(`code`,{className:`oc-traces__mono`,children:e.kind}),sort:e=>e.kind},{header:E(),cell:e=>(0,W.jsx)(Ae,{severity:e.severity}),sort:e=>e.severity===`critical`?2:+(e.severity===`warn`)},{header:y(),cell:e=>(0,W.jsx)(je,{status:e.status}),sort:e=>e.status===`resolved`?2:+(e.status===`acknowledged`)},{header:g(),cell:e=>(0,W.jsx)(I,{variant:`outline`,children:e.source}),sort:e=>e.source},{header:se(),cell:e=>(0,W.jsx)(`span`,{className:`oc-anomaly__msg`,children:e.message}),sort:e=>e.message},{header:pe(),cell:e=>(0,W.jsx)(ke,{row:e}),sort:e=>e.evidence??null},{header:x(),cell:e=>e.correlationId?(0,W.jsx)(`code`,{className:`oc-traces__mono`,children:Me(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 ke({row:e}){let t=z();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:[`↗ `,v()]}):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:[`↗ `,v()]}):null]})}function Ae({severity:e}){return(0,W.jsx)(`span`,{className:`oc-anomaly__sev oc-anomaly__sev--${e}`,children:e})}function je({status:e}){return e===`open`?(0,W.jsx)(I,{variant:`destructive`,children:C()}):e===`acknowledged`?(0,W.jsx)(I,{variant:`secondary`,children:m()}):(0,W.jsx)(I,{variant:`outline`,children:r()})}function Me(e){return e.length>8?e.slice(0,8):e}export{q as AnomaliesTab};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Bh as r,Fh as i,Gh as a,Hh as o,Ih as s,Kh as c,Lh as l,Mh as u,Nh as ee,Ph as d,Rh as f,Uh as p,Vh as m,Wh as h,
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Bh as r,Fh as i,Gh as a,Hh as o,Ih as s,Kh as c,Lh as l,Mh as u,Nh as ee,Ph as d,Rh as f,Uh as p,Vh as m,Wh as h,fO as g,yO as _,zh as v}from"./dist-DsBcH2-2.js";import{C as y,Mt as b,S as x,a as S,b as C,i as w,jt as T,o as E,r as D,t as O,x as k,y as A}from"./index-DsOZBPOX.js";import{n as j}from"./TimeRangePicker-CPM9eoXo.js";import{t as M}from"./FilterBar-DWv8wqqC.js";import{t as N}from"./AdvancedFilter-CtaYuy-W.js";import{t as P}from"./DataTableShell-VIRQvS8e.js";var F=t(e(),1),I=n(),L={kind:`relative`,from:O,to:`now`},R=`__all__`,z=[{value:`action`,label:`action`},{value:`realLabel`,label:`acteur réel`},{value:`targetLabel`,label:`au nom de`},{value:`impersonated`,label:`usurpation`},{value:`resource`,label:`ressource`},{value:`resourceId`,label:`id ressource`}];function B(){let e=b({from:`/settings/audit`}),t=T({from:`/settings/audit`}),n=e.q??``,O=e.action??R,B=e.impersonated??R,V=e.resource??R,H=D(e.from,e.to),U=(0,F.useMemo)(()=>E(e.adv),[e.adv]),{from:W,to:G}=j(H),K=e=>void t({search:t=>({...t,q:e||void 0}),replace:!0}),q=e=>void t({search:t=>({...t,action:e===R?void 0:e})}),J=e=>void t({search:t=>({...t,impersonated:e===R?void 0:e})}),Y=e=>void t({search:t=>({...t,resource:e===R?void 0:e})}),X=e=>void t({search:t=>({...t,...S(e)})}),Z=e=>void t({search:t=>({...t,adv:w(e)}),replace:!0}),Q=_(g.admin.listAudit,{filter:{q:n||void 0,from:W,to:G,action:O===R?void 0:O,resource:V===R?void 0:V,impersonated:B===R?void 0:B===`yes`,advanced:U.length>0?U:void 0}}),$=(0,F.useMemo)(()=>{let e=new Set;for(let t of Q??[])e.add(t.action);return[...e].sort()},[Q]),te=(0,F.useMemo)(()=>{let e=new Set;for(let t of Q??[])t.resource&&e.add(t.resource);return[...e].sort()},[Q]),ne=n!==``||O!==R||B!==R||V!==R||U.length>0||H.kind!==`relative`||H.from!==L.from;function re(){t({search:{},replace:!0})}return(0,I.jsxs)(I.Fragment,{children:[(0,I.jsxs)(`p`,{className:`oc-admin__hint`,children:[c(),` `,(0,I.jsx)(`span`,{className:`oc-filter__window`,children:a()})]}),(0,I.jsxs)(M,{q:n,onQChange:K,searchPlaceholder:h(),timeRange:H,onTimeRangeChange:X,onReset:re,canReset:ne,children:[(0,I.jsxs)(A,{value:O,onValueChange:q,children:[(0,I.jsx)(x,{size:`sm`,className:`w-40`,children:(0,I.jsx)(y,{placeholder:p()})}),(0,I.jsxs)(C,{children:[(0,I.jsx)(k,{value:R,children:o()}),$.map(e=>(0,I.jsx)(k,{value:e,children:e},e))]})]}),(0,I.jsxs)(A,{value:B,onValueChange:J,children:[(0,I.jsx)(x,{size:`sm`,className:`w-40`,children:(0,I.jsx)(y,{})}),(0,I.jsxs)(C,{children:[(0,I.jsx)(k,{value:R,children:m()}),(0,I.jsx)(k,{value:`yes`,children:r()}),(0,I.jsx)(k,{value:`no`,children:v()})]})]}),(0,I.jsxs)(A,{value:V,onValueChange:Y,children:[(0,I.jsx)(x,{size:`sm`,className:`w-40`,children:(0,I.jsx)(y,{placeholder:f()})}),(0,I.jsxs)(C,{children:[(0,I.jsx)(k,{value:R,children:l()}),te.map(e=>(0,I.jsx)(k,{value:e,children:e},e))]})]})]}),(0,I.jsx)(N,{fields:z,seed:U,onChange:Z}),(0,I.jsx)(P,{title:s(),rows:Q,emptyHint:i(),columns:[{header:d(),cell:e=>new Date(e.at).toLocaleString(`fr-FR`),sort:e=>e.at},{header:p(),cell:e=>e.action,sort:e=>e.action},{header:ee(),cell:e=>e.realLabel,sort:e=>e.realLabel},{header:u(),cell:e=>e.targetLabel??`—`,sort:e=>e.targetLabel??null},{header:f(),cell:e=>e.resource?e.resource+(e.resourceId?` · ${e.resourceId.slice(0,8)}`:``):`—`,sort:e=>e.resource??null}]})]})}export{B as AuditTab};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$d as r,$u as i,Ar as a,Au as o,Bd as s,Bu as c,Dr as l,Er as u,Fr as d,Fu as f,Gd as p,Gu as m,Hu as h,Ir as g,Iu as _,Jd as ee,Ju as te,Kd as ne,Ku as re,Lr as ie,Lu as ae,Mr as oe,Mu as v,Nr as se,Nu as ce,Or as le,Pr as y,Pu as ue,Qu as de,Rr as fe,Ru as pe,Sr as me,Uu as he,Vd as ge,Vu as _e,Wd as ve,Wu as b,Xd as ye,Xu as be,Yd as xe,Yu as Se,Zd as Ce,Zu as we,_d as Te,ad as Ee,cO as x,cd as De,dd as Oe,ed as ke,ef as Ae,fO as je,fd as Me,gd as Ne,hO as S,hd as Pe,id as Fe,jr as Ie,ju as C,kr as Le,lO as w,ld as Re,mO as ze,md as Be,nd as Ve,od as He,pd as Ue,qd as We,qu as Ge,rd as T,sd as Ke,td as qe,ud as Je,vd as Ye,zr as Xe,zu as Ze}from"./dist-CcSJxYOw.js";import{i as E,r as Qe}from"./dist-ClJFgNZb.js";import{t as $e}from"./chevrons-up-down-BxjTVcP-.js";import{i as et,n as D,o as tt,r as nt,s as rt}from"./FieldLabel-P7nCb2ED.js";import{t as O}from"./button-Chsl3hJr.js";import{$ as it,A as at,At as ot,C as k,H as st,Q as ct,S as A,St as lt,U as ut,V as dt,X as j,Z as M,_ as ft,_t as pt,b as N,et as mt,jt as ht,kt as P,mt as F,nt as gt,ot as _t,rt as vt,x as I,y as L}from"./index-Dld_NfaR.js";import{a as yt,i as R,n as bt,o as z,r as B,t as xt}from"./table-CKAkPBqh.js";import{t as St}from"./FilterBar-NyP0u16q.js";import{a as Ct,n as wt,o as V,r as H,s as Tt,t as Et}from"./compatView-B-SErG8a.js";import{t as U}from"./dispatchErrorInfo-DY4Xsf5c.js";var Dt=w(`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`}]]),Ot=w(`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`}]]),W=t(e(),1);function G(e){return e.filter(e=>e.state===`error`)}function kt(e){return e.reachable&&G(e.targets).length===0}function At(e){return e.state===`error`&&e.lastErrorCode!==null}function jt(e){return!!e.lastDownstreamRejectCode}function K(e){return e.kind??`openclaw`}function Mt(e){return[...e].sort((e,t)=>e===`openclaw`?-1:t===`openclaw`?1:e.localeCompare(t))}function Nt(e,t,n){let r=new Map;for(let e of t)e.instanceName&&r.set(e.instanceName,e.provider);for(let e of n)r.set(e.name,K(e));let i=e=>(e.instanceName?r.get(e.instanceName):void 0)??`openclaw`,a=new Set;for(let e of n)a.add(K(e));for(let e of t)a.add(e.provider);for(let t of e)a.add(i(t));return Mt(a).map(r=>({key:r,connections:e.filter(e=>i(e)===r),compatTargets:t.filter(e=>e.provider===r),instances:n.filter(e=>K(e)===r)}))}function Pt(e){return e===`openclaw`?`OpenClaw`:e===`hermes`?`Hermes`:e.charAt(0).toUpperCase()+e.slice(1)}var q=`__all__`,J={q:``,state:q,instance:q,version:q},Y={connected:0,error:1,idle:2};function Ft(e){return e.q.trim()!==``||e.state!==`__all__`||e.instance!==`__all__`||e.version!==`__all__`}function It(e,t){let n=t.q.trim().toLowerCase();return e.filter(e=>!(n&&!`${e.targetLabel} ${e.gatewayHost}`.toLowerCase().includes(n)||t.state!==`__all__`&&e.state!==t.state||t.instance!==`__all__`&&(e.instanceName??``)!==t.instance||t.version!==`__all__`&&(e.gatewayVersion??``)!==t.version))}function X(e,t){return e.localeCompare(t,void 0,{numeric:!0,sensitivity:`base`})}function Z(e,t){return e===`version`?t.gatewayVersion===null:e===`lastOk`?t.lastOkAt===null:!1}function Lt(e,t,n){switch(e){case`state`:return(Y[t.state]??99)-(Y[n.state]??99);case`instance`:return X(t.instanceLabel??t.instanceName??``,n.instanceLabel??n.instanceName??``);case`host`:return X(t.gatewayHost,n.gatewayHost);case`version`:{let e=t.gatewayVersion,r=n.gatewayVersion;return V(e,r)??X(e,r)}case`lastOk`:return t.lastOkAt-n.lastOkAt;default:return X(t.targetLabel,n.targetLabel)}}function Rt(e,t){if(!t)return e;let n=t.dir===`asc`?1:-1;return[...e].sort((e,r)=>{let i=Z(t.key,e),a=Z(t.key,r);return i&&a?0:i?1:a?-1:n*Lt(t.key,e,r)})}function zt(e){let t=new Set;for(let n of e)t.add(n.state);return[...t].sort((e,t)=>(Y[e]??99)-(Y[t]??99))}function Bt(e){let t=new Map;for(let n of e)n.instanceName!==null&&(t.has(n.instanceName)||t.set(n.instanceName,n.instanceLabel??n.instanceName));return[...t.entries()].map(([e,t])=>({name:e,label:t})).sort((e,t)=>X(e.label,t.label))}function Vt(e){let t=new Set;for(let n of e)n.gatewayVersion!==null&&t.add(n.gatewayVersion);return[...t].sort((e,t)=>V(e,t)??X(e,t))}var Q=n();function Ht({connections:e,displayByInstance:t}){let[n,r]=(0,W.useState)(J),[i,a]=(0,W.useState)(null),o=(0,W.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,W.useMemo)(()=>zt(o),[o]),l=(0,W.useMemo)(()=>Bt(o),[o]),u=(0,W.useMemo)(()=>Vt(o),[o]),d=(0,W.useMemo)(()=>Rt(It(o,n),i),[o,n,i]);function p(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:te()}):(0,Q.jsxs)(`div`,{className:`oc-conn`,children:[(0,Q.jsxs)(St,{q:n.q,onQChange:e=>r(t=>({...t,q:e})),searchPlaceholder:m(),onReset:()=>r(J),canReset:Ft(n),children:[(0,Q.jsxs)(L,{value:n.state,onValueChange:e=>r(t=>({...t,state:e})),children:[(0,Q.jsx)(A,{size:`sm`,className:`w-36`,children:(0,Q.jsx)(k,{placeholder:he()})}),(0,Q.jsxs)(N,{children:[(0,Q.jsx)(I,{value:q,children:b()}),s.map(e=>(0,Q.jsx)(I,{value:e,children:Wt(e)},e))]})]}),(0,Q.jsxs)(L,{value:n.instance,onValueChange:e=>r(t=>({...t,instance:e})),children:[(0,Q.jsx)(A,{size:`sm`,className:`w-40`,children:(0,Q.jsx)(k,{placeholder:h()})}),(0,Q.jsxs)(N,{children:[(0,Q.jsx)(I,{value:q,children:b()}),l.map(e=>(0,Q.jsx)(I,{value:e.name,children:e.label},e.name))]})]}),(0,Q.jsxs)(L,{value:n.version,onValueChange:e=>r(t=>({...t,version:e})),children:[(0,Q.jsx)(A,{size:`sm`,className:`w-36`,children:(0,Q.jsx)(k,{placeholder:_e()})}),(0,Q.jsxs)(N,{children:[(0,Q.jsx)(I,{value:q,children:b()}),u.map(e=>(0,Q.jsx)(I,{value:e,children:e},e))]})]})]}),d.length===0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:c()}):(0,Q.jsxs)(xt,{className:`oc-conn__table`,children:[(0,Q.jsx)(yt,{children:(0,Q.jsxs)(z,{children:[(0,Q.jsx)($,{label:Ze(),sortKey:`target`,sort:i,onSort:p}),(0,Q.jsx)($,{label:pe(),sortKey:`state`,sort:i,onSort:p}),(0,Q.jsx)($,{label:ae(),sortKey:`instance`,sort:i,onSort:p}),(0,Q.jsx)($,{label:_(),sortKey:`host`,sort:i,onSort:p}),(0,Q.jsx)($,{label:f(),sortKey:`version`,sort:i,onSort:p}),(0,Q.jsx)(R,{children:ue()}),(0,Q.jsx)($,{label:ce(),sortKey:`lastOk`,sort:i,onSort:p})]})}),(0,Q.jsx)(bt,{children:d.map(e=>(0,Q.jsx)(Ut,{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)(R,{"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)(Qe,{size:13,"aria-hidden":!0}):(0,Q.jsx)(E,{size:13,"aria-hidden":!0}):(0,Q.jsx)($e,{size:13,"aria-hidden":!0,className:`oc-conn__sort-idle`})]})})}function Ut({r:e}){let t=At(e)?U(e.lastErrorCode):null,n=jt(e)?U(e.lastDownstreamRejectCode):null;return(0,Q.jsxs)(W.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)(Gt,{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:new Date(e.lastOkAt).toLocaleTimeString(`fr-FR`)}):(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?` · ${new Date(e.lastErrorAt).toLocaleTimeString(`fr-FR`)}`:``,(0,Q.jsx)(`p`,{className:`oc-bridge-card__hint`,children:t.hint})]}):null,n?(0,Q.jsxs)(`div`,{className:`oc-bridge-target__downstream`,children:[re({label:n.label}),` `,(0,Q.jsx)(`code`,{className:`oc-traces__mono`,children:e.lastDownstreamRejectCode}),e.lastDownstreamRejectAt?` · ${new Date(e.lastDownstreamRejectAt).toLocaleTimeString(`fr-FR`)}`:``]}):null]})}):null]})}function Wt(e){return e===`connected`?v():e===`error`?C():o()}function Gt({state:e}){return e===`connected`?(0,Q.jsx)(j,{variant:`secondary`,children:v()}):e===`error`?(0,Q.jsx)(j,{variant:`destructive`,children:C()}):(0,Q.jsx)(j,{variant:`outline`,children:o()})}function Kt(){return S(x.bridgeHealth.getBridgeHealth,{})}function qt(){let e=Kt(),t=S(x.compat.getBridgeCompat,{}),n=S(x.me.getMe,{host:_t})?.role===`admin`,r=S(x.admin.listInstances,n?{}:`skip`),i=ht(),a=()=>void i({to:`/settings/anomalies`,search:{status:`open`}}),o=Nt(e?e.targets:[],t?t.targets:[],r??[]),s=t?.compat??null,c=t===void 0?`loading`:t===null?`nodata`:`ready`,l=s!==null&&wt(s,`hermes`)&&!o.some(e=>e.key===`hermes`);return(0,Q.jsxs)(`div`,{className:`oc-bridge`,children:[(0,Q.jsx)(Jt,{health:e,compat:t,onSeeAnomalies:a}),(0,Q.jsx)(`p`,{className:`oc-admin__hint oc-bridge__caption`,children:Fe()}),o.map(e=>(0,Q.jsx)(Yt,{providerKey:e.key,connections:e.connections,instances:e.instances,manifest:s,compatStatus:c,compatReachable:t?.reachable??!0},e.key)),l?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:me()}):null]})}function Jt({health:e,compat:t,onSeeAnomalies:n}){let r=t!=null&&t.buildVersion!=null&&t.bridgeVersion!=null&&t.buildVersion!==t.bridgeVersion,a=t?.buildRevision&&t.buildRevision!==`unknown`?t.buildRevision.slice(0,7):null,o=t&&t!==null?(0,Q.jsxs)(`span`,{className:`oc-bridge-card__ver`,children:[(0,Q.jsx)(`code`,{className:`oc-traces__mono`,children:Ct(t.bridgeVersion)}),a?(0,Q.jsxs)(Q.Fragment,{children:[` `,(0,Q.jsxs)(`code`,{className:`oc-traces__mono`,title:ie(),children:[`(`,a,`)`]})]}):null,r?(0,Q.jsxs)(`strong`,{className:`oc-bridge-card__mismatch`,children:[` `,g({build:t.buildVersion??`?`})]}):null,` · `,d(),` `,(0,Q.jsx)(`code`,{className:`oc-traces__mono`,children:t.protocolVersion===null?y():String(t.protocolVersion)})]}):null;if(e===void 0)return(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:T()});if(e===null)return(0,Q.jsx)(`div`,{className:`oc-bridge-card oc-bridge-card--idle`,children:Ve()});let s=G(e.targets),c=!e.reachable,l=kt(e),u=l?`ok`:`error`,f=new Date(e.checkedAt).toLocaleString(`fr-FR`),p=e.startedAt==null?null:new Date(e.startedAt).toLocaleString(`fr-FR`);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)(P,{size:22}):c?(0,Q.jsx)(Ot,{size:22}):(0,Q.jsx)(F,{size:22})}),(0,Q.jsxs)(`div`,{className:`oc-bridge-card__body`,children:[(0,Q.jsx)(`div`,{className:`oc-bridge-card__title`,children:l?qe():c?ke():i({count:s.length})}),(0,Q.jsxs)(`div`,{className:`oc-bridge-card__meta`,children:[(0,Q.jsxs)(`span`,{children:[(0,Q.jsx)(Dt,{size:12,"aria-hidden":!0}),` `,de({time:f})]}),p?(0,Q.jsx)(`span`,{children:we({time:p})}):null,o]}),c?(0,Q.jsx)(`p`,{className:`oc-bridge-card__hint`,children:U(e.lastError===`not_configured`?`NOT_CONFIGURED`:`BRIDGE_UNREACHABLE`).hint}):null]}),(0,Q.jsx)(`button`,{type:`button`,className:`oc-bridgebar__drill`,onClick:n,children:be()})]})}function Yt({providerKey:e,connections:t,instances:n,manifest:r,compatStatus:i,compatReachable:a}){let o=r?Tt(r,e):null,s=new Map;for(let e of n)s.set(e.name,e.displayName??e.name);let c=[],l=new Set;for(let n of t){if(!n.instanceName||l.has(n.instanceName))continue;l.add(n.instanceName);let t=n.gatewayVersion??null;c.push({instanceName:n.instanceName,displayName:s.get(n.instanceName)??n.instanceName,version:t,state:Et(t,e,r)})}let u=c.map(e=>e.state),d=u.includes(`beyond`)?`beyond`:u.length>0&&u.every(e=>e===`supported`)?`supported`:null,[f,p]=(0,W.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)(pt,{size:15,"aria-hidden":!0,className:`oc-bridge-provider__icon`}),(0,Q.jsx)(`span`,{className:`oc-bridge-provider__name`,children:Pt(e)}),d?(0,Q.jsx)(j,{variant:d===`beyond`?`destructive`:`secondary`,children:H(d)}):null]}),(0,Q.jsx)(`h4`,{className:`oc-bridge-provider__sub`,children:Xe()}),(0,Q.jsx)(Xt,{support:o,compatStatus:i,compatReachable:a,manifest:r,instanceRows:c}),(0,Q.jsxs)(`button`,{type:`button`,className:`oc-bridge-provider__sub oc-bridge-provider__sub--toggle`,"aria-expanded":f,onClick:()=>p(e=>!e),children:[f?(0,Q.jsx)(E,{size:13,"aria-hidden":!0}):(0,Q.jsx)(ot,{size:13,"aria-hidden":!0}),Se({count:t.length})]}),f?(0,Q.jsx)(Ht,{connections:t,displayByInstance:s}):null]})}function Xt({support:e,compatStatus:t,compatReachable:n,manifest:r,instanceRows:i}){return t===`loading`?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:T()}):t===`nodata`?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:fe()}):(0,Q.jsxs)(`div`,{className:`oc-compat`,children:[n?null:(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:se()}),r===null?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:oe()}):(0,Q.jsxs)(`div`,{className:`oc-compat__support`,children:[(0,Q.jsx)(`span`,{className:`oc-compat__label`,children:Ie()}),e&&e.range!==null?(0,Q.jsx)(`span`,{children:a({min:e.range.min,max:e.range.maxValidated})}):(0,Q.jsx)(`span`,{children:y()}),e?(0,Q.jsx)(en,{versions:e.validatedVersions}):null]}),i.length===0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:u()}):(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:Ct(e.version)}),(0,Q.jsx)(j,{variant:e.state===`supported`?`secondary`:e.state===`beyond`?`destructive`:`outline`,children:H(e.state)})]},e.instanceName))})]})}function Zt({instance:e,onClose:t}){return(0,Q.jsx)(ct,{open:!0,onOpenChange:e=>!e&&t(),children:(0,Q.jsxs)(it,{className:`oc-bridge-config-dialog`,onOpenAutoFocus:e=>e.preventDefault(),children:[(0,Q.jsxs)(gt,{children:[(0,Q.jsx)(vt,{children:Ae({instance:e.displayName??e.name})}),(0,Q.jsx)(mt,{children:r()})]}),(0,Q.jsx)($t,{instance:e,onClose:t})]})})}function Qt({label:e,result:t}){return t?t.checked?(0,Q.jsxs)(`p`,{className:`oc-bridge-config__check-row `+(t.ok?`oc-bridge-config__check-row--ok`:`oc-bridge-config__check-row--err`),children:[t.ok?(0,Q.jsx)(P,{"aria-hidden":!0}):(0,Q.jsx)(F,{"aria-hidden":!0}),(0,Q.jsxs)(`span`,{children:[e,` — `,t.ok?De():t.detail]})]}):(0,Q.jsxs)(`p`,{className:`oc-bridge-config__check-row oc-bridge-config__check-row--skip`,children:[e,` — `,Ke()]}):null}function $t({instance:e,onClose:t}){let n=ze(x.admin.upsertInstanceConfig),r=je(x.bridge.validateMediaPaths),i=at(),[a,o]=(0,W.useState)(()=>et(e.config??{})),[c,l]=(0,W.useState)(!1),[u,d]=(0,W.useState)(!1),[f,m]=(0,W.useState)(null),h=a.inboundMediaMode===`shared-fs`,g=a.mediaMode===`shared-fs`,_=h||g;async function te(){d(!0),m(null);try{m(await r({instanceName:e.name,inboundMediaMode:a.inboundMediaMode,mediaMode:a.mediaMode}))}catch(e){i.error(Me(),e)}finally{d(!1)}}async function re(){l(!0);try{let r=e.config??{};await n({instanceId:e._id,config:nt(a,r)}),t()}catch(e){i.error(ne(),e)}finally{l(!1)}}return(0,Q.jsx)(`div`,{className:`oc-bridge-config`,children:(0,Q.jsxs)(`div`,{className:`oc-bridge-config__form`,children:[(0,Q.jsxs)(`div`,{className:`oc-bridge-config__grid`,children:[(0,Q.jsxs)(`label`,{className:`oc-field`,children:[(0,Q.jsx)(D,{label:Ce(),help:p()}),(0,Q.jsxs)(L,{value:a.mediaMode,onValueChange:e=>o({...a,mediaMode:e}),children:[(0,Q.jsx)(A,{size:`sm`,className:`w-full`,children:(0,Q.jsx)(k,{})}),(0,Q.jsx)(N,{children:rt.map(e=>(0,Q.jsx)(I,{value:e,children:e},e))})]})]}),(0,Q.jsxs)(`label`,{className:`oc-field`,children:[(0,Q.jsx)(D,{label:ye(),help:ve()}),(0,Q.jsxs)(L,{value:a.inboundMediaMode,onValueChange:e=>o({...a,inboundMediaMode:e}),children:[(0,Q.jsx)(A,{size:`sm`,className:`w-full`,children:(0,Q.jsx)(k,{})}),(0,Q.jsx)(N,{children:tt.map(e=>(0,Q.jsx)(I,{value:e,children:e},e))})]})]}),(0,Q.jsxs)(`label`,{className:`oc-field`,children:[(0,Q.jsx)(D,{label:xe(),help:ge()}),(0,Q.jsx)(M,{type:`number`,min:1,max:4096,className:`w-full`,value:a.mediaMaxMb,onChange:e=>o({...a,mediaMaxMb:Math.trunc(Number(e.target.value)||0)})})]})]}),_&&(0,Q.jsxs)(`div`,{className:`oc-bridge-config__grid`,children:[h&&(0,Q.jsxs)(`label`,{className:`oc-field`,children:[(0,Q.jsx)(D,{label:Ye(),help:Te()}),(0,Q.jsx)(M,{className:`w-full`,spellCheck:!1,value:a.inboundAgentMount,onChange:e=>o({...a,inboundAgentMount:e.target.value})})]}),g&&(0,Q.jsxs)(`label`,{className:`oc-field`,children:[(0,Q.jsx)(D,{label:Ne(),help:Pe()}),(0,Q.jsx)(M,{className:`w-full`,spellCheck:!1,value:a.outboundAgentMount,onChange:e=>o({...a,outboundAgentMount:e.target.value})})]})]}),(0,Q.jsxs)(`label`,{className:`oc-field--row`,children:[(0,Q.jsx)(ft,{checked:a.rehydration,onCheckedChange:e=>o({...a,rehydration:e===!0})}),(0,Q.jsx)(D,{label:ee(),help:s()})]}),_&&f!==null&&(0,Q.jsx)(`div`,{className:`oc-bridge-config__check`,children:f.reachable?!f.inbound&&!f.outbound?(0,Q.jsxs)(`p`,{className:`oc-bridge-config__check-row oc-bridge-config__check-row--err`,children:[(0,Q.jsx)(F,{"aria-hidden":!0}),Ee({reason:f.reason??`?`})]}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(Qt,{label:Je(),result:f.inbound}),(0,Q.jsx)(Qt,{label:Re(),result:f.outbound}),(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:Oe()})]}):(0,Q.jsxs)(`p`,{className:`oc-bridge-config__check-row oc-bridge-config__check-row--err`,children:[(0,Q.jsx)(F,{"aria-hidden":!0}),He()]})}),(0,Q.jsxs)(`div`,{className:`oc-bridge-config__actions`,children:[_&&(0,Q.jsxs)(O,{variant:`outline`,size:`sm`,onClick:()=>void te(),disabled:u,children:[u?(0,Q.jsx)(lt,{className:`size-4 animate-spin`,"aria-hidden":!0}):null,u?Ue():Be()]}),(0,Q.jsx)(O,{size:`sm`,onClick:()=>void re(),disabled:c,children:We()})]})]})})}function en({versions:e}){if(e.length===0)return null;let t=[...e].reverse();return(0,Q.jsxs)(dt,{children:[(0,Q.jsx)(ut,{asChild:!0,children:(0,Q.jsxs)(`button`,{type:`button`,className:`oc-compat__versions-btn`,children:[e.length===1?Le():le({count:e.length}),(0,Q.jsx)(E,{size:13,"aria-hidden":!0})]})}),(0,Q.jsxs)(st,{className:`oc-compat__versions-pop`,align:`start`,children:[(0,Q.jsx)(`p`,{className:`oc-compat__versions-title`,children:l()}),(0,Q.jsx)(`div`,{className:`oc-compat__versions-list`,children:t.map(e=>(0,Q.jsx)(j,{variant:`secondary`,children:e},e))})]})]})}export{qt as BridgeTab,Zt as InstanceConfigDialog};
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$d as r,$u as i,Ar as a,Au as o,Bd as s,Bu as c,Dr as l,Er as u,Fr as d,Fu as f,Gd as p,Gu as m,Hu as h,Ir as g,Iu as _,Jd as ee,Ju as te,Kd as ne,Ku as re,Lr as ie,Lu as ae,Mr as oe,Mu as v,Nr as se,Nu as ce,Or as le,Pr as y,Pu as ue,Qu as de,Rr as fe,Ru as pe,Sr as me,Uu as he,Vd as ge,Vu as _e,Wd as ve,Wu as b,Xd as ye,Xu as be,Yd as xe,Yu as Se,Zd as Ce,Zu as we,_d as Te,ad as Ee,cd as De,dd as Oe,ed as ke,ef as Ae,fO as x,fd as je,gO as Me,gd as Ne,hd as Pe,id as Fe,jr as Ie,ju as S,kr as Le,ld as Re,md as ze,nd as Be,od as Ve,pO as C,pd as He,qd as Ue,qu as We,rd as w,sd as Ge,td as Ke,ud as qe,vO as Je,vd as Ye,yO as T,zr as Xe,zu as Ze}from"./dist-DsBcH2-2.js";import{i as E,r as Qe}from"./dist-BMI7wyIc.js";import{t as $e}from"./chevrons-up-down-D_kGoxSO.js";import{i as et,n as D,o as tt,r as nt,s as rt}from"./FieldLabel-BYZOkwDx.js";import{t as O}from"./button-9c1aLUeO.js";import{$ as it,A as at,At as ot,C as k,H as st,Q as ct,S as A,St as lt,U as ut,V as dt,X as j,Z as M,_ as ft,_t as pt,b as N,et as mt,jt as ht,kt as P,mt as F,nt as gt,ot as _t,rt as vt,x as I,y as L}from"./index-DsOZBPOX.js";import{a as yt,i as R,n as bt,o as z,r as B,t as xt}from"./table-C2kpo1_K.js";import{t as St}from"./FilterBar-DWv8wqqC.js";import{a as Ct,n as wt,o as V,r as H,s as Tt,t as Et}from"./compatView-DI9WOWM-.js";import{t as U}from"./dispatchErrorInfo-DO5jqFw-.js";var Dt=C(`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`}]]),Ot=C(`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`}]]),W=t(e(),1);function G(e){return e.filter(e=>e.state===`error`)}function kt(e){return e.reachable&&G(e.targets).length===0}function At(e){return e.state===`error`&&e.lastErrorCode!==null}function jt(e){return!!e.lastDownstreamRejectCode}function K(e){return e.kind??`openclaw`}function Mt(e){return[...e].sort((e,t)=>e===`openclaw`?-1:t===`openclaw`?1:e.localeCompare(t))}function Nt(e,t,n){let r=new Map;for(let e of t)e.instanceName&&r.set(e.instanceName,e.provider);for(let e of n)r.set(e.name,K(e));let i=e=>(e.instanceName?r.get(e.instanceName):void 0)??`openclaw`,a=new Set;for(let e of n)a.add(K(e));for(let e of t)a.add(e.provider);for(let t of e)a.add(i(t));return Mt(a).map(r=>({key:r,connections:e.filter(e=>i(e)===r),compatTargets:t.filter(e=>e.provider===r),instances:n.filter(e=>K(e)===r)}))}function Pt(e){return e===`openclaw`?`OpenClaw`:e===`hermes`?`Hermes`:e.charAt(0).toUpperCase()+e.slice(1)}var q=`__all__`,J={q:``,state:q,instance:q,version:q},Y={connected:0,error:1,idle:2};function Ft(e){return e.q.trim()!==``||e.state!==`__all__`||e.instance!==`__all__`||e.version!==`__all__`}function It(e,t){let n=t.q.trim().toLowerCase();return e.filter(e=>!(n&&!`${e.targetLabel} ${e.gatewayHost}`.toLowerCase().includes(n)||t.state!==`__all__`&&e.state!==t.state||t.instance!==`__all__`&&(e.instanceName??``)!==t.instance||t.version!==`__all__`&&(e.gatewayVersion??``)!==t.version))}function X(e,t){return e.localeCompare(t,void 0,{numeric:!0,sensitivity:`base`})}function Z(e,t){return e===`version`?t.gatewayVersion===null:e===`lastOk`?t.lastOkAt===null:!1}function Lt(e,t,n){switch(e){case`state`:return(Y[t.state]??99)-(Y[n.state]??99);case`instance`:return X(t.instanceLabel??t.instanceName??``,n.instanceLabel??n.instanceName??``);case`host`:return X(t.gatewayHost,n.gatewayHost);case`version`:{let e=t.gatewayVersion,r=n.gatewayVersion;return V(e,r)??X(e,r)}case`lastOk`:return t.lastOkAt-n.lastOkAt;default:return X(t.targetLabel,n.targetLabel)}}function Rt(e,t){if(!t)return e;let n=t.dir===`asc`?1:-1;return[...e].sort((e,r)=>{let i=Z(t.key,e),a=Z(t.key,r);return i&&a?0:i?1:a?-1:n*Lt(t.key,e,r)})}function zt(e){let t=new Set;for(let n of e)t.add(n.state);return[...t].sort((e,t)=>(Y[e]??99)-(Y[t]??99))}function Bt(e){let t=new Map;for(let n of e)n.instanceName!==null&&(t.has(n.instanceName)||t.set(n.instanceName,n.instanceLabel??n.instanceName));return[...t.entries()].map(([e,t])=>({name:e,label:t})).sort((e,t)=>X(e.label,t.label))}function Vt(e){let t=new Set;for(let n of e)n.gatewayVersion!==null&&t.add(n.gatewayVersion);return[...t].sort((e,t)=>V(e,t)??X(e,t))}var Q=n();function Ht({connections:e,displayByInstance:t}){let[n,r]=(0,W.useState)(J),[i,a]=(0,W.useState)(null),o=(0,W.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,W.useMemo)(()=>zt(o),[o]),l=(0,W.useMemo)(()=>Bt(o),[o]),u=(0,W.useMemo)(()=>Vt(o),[o]),d=(0,W.useMemo)(()=>Rt(It(o,n),i),[o,n,i]);function p(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:te()}):(0,Q.jsxs)(`div`,{className:`oc-conn`,children:[(0,Q.jsxs)(St,{q:n.q,onQChange:e=>r(t=>({...t,q:e})),searchPlaceholder:m(),onReset:()=>r(J),canReset:Ft(n),children:[(0,Q.jsxs)(L,{value:n.state,onValueChange:e=>r(t=>({...t,state:e})),children:[(0,Q.jsx)(A,{size:`sm`,className:`w-36`,children:(0,Q.jsx)(k,{placeholder:he()})}),(0,Q.jsxs)(N,{children:[(0,Q.jsx)(I,{value:q,children:b()}),s.map(e=>(0,Q.jsx)(I,{value:e,children:Wt(e)},e))]})]}),(0,Q.jsxs)(L,{value:n.instance,onValueChange:e=>r(t=>({...t,instance:e})),children:[(0,Q.jsx)(A,{size:`sm`,className:`w-40`,children:(0,Q.jsx)(k,{placeholder:h()})}),(0,Q.jsxs)(N,{children:[(0,Q.jsx)(I,{value:q,children:b()}),l.map(e=>(0,Q.jsx)(I,{value:e.name,children:e.label},e.name))]})]}),(0,Q.jsxs)(L,{value:n.version,onValueChange:e=>r(t=>({...t,version:e})),children:[(0,Q.jsx)(A,{size:`sm`,className:`w-36`,children:(0,Q.jsx)(k,{placeholder:_e()})}),(0,Q.jsxs)(N,{children:[(0,Q.jsx)(I,{value:q,children:b()}),u.map(e=>(0,Q.jsx)(I,{value:e,children:e},e))]})]})]}),d.length===0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:c()}):(0,Q.jsxs)(xt,{className:`oc-conn__table`,children:[(0,Q.jsx)(yt,{children:(0,Q.jsxs)(z,{children:[(0,Q.jsx)($,{label:Ze(),sortKey:`target`,sort:i,onSort:p}),(0,Q.jsx)($,{label:pe(),sortKey:`state`,sort:i,onSort:p}),(0,Q.jsx)($,{label:ae(),sortKey:`instance`,sort:i,onSort:p}),(0,Q.jsx)($,{label:_(),sortKey:`host`,sort:i,onSort:p}),(0,Q.jsx)($,{label:f(),sortKey:`version`,sort:i,onSort:p}),(0,Q.jsx)(R,{children:ue()}),(0,Q.jsx)($,{label:ce(),sortKey:`lastOk`,sort:i,onSort:p})]})}),(0,Q.jsx)(bt,{children:d.map(e=>(0,Q.jsx)(Ut,{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)(R,{"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)(Qe,{size:13,"aria-hidden":!0}):(0,Q.jsx)(E,{size:13,"aria-hidden":!0}):(0,Q.jsx)($e,{size:13,"aria-hidden":!0,className:`oc-conn__sort-idle`})]})})}function Ut({r:e}){let t=At(e)?U(e.lastErrorCode):null,n=jt(e)?U(e.lastDownstreamRejectCode):null;return(0,Q.jsxs)(W.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)(Gt,{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:We({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:new Date(e.lastOkAt).toLocaleTimeString(`fr-FR`)}):(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?` · ${new Date(e.lastErrorAt).toLocaleTimeString(`fr-FR`)}`:``,(0,Q.jsx)(`p`,{className:`oc-bridge-card__hint`,children:t.hint})]}):null,n?(0,Q.jsxs)(`div`,{className:`oc-bridge-target__downstream`,children:[re({label:n.label}),` `,(0,Q.jsx)(`code`,{className:`oc-traces__mono`,children:e.lastDownstreamRejectCode}),e.lastDownstreamRejectAt?` · ${new Date(e.lastDownstreamRejectAt).toLocaleTimeString(`fr-FR`)}`:``]}):null]})}):null]})}function Wt(e){return e===`connected`?v():e===`error`?S():o()}function Gt({state:e}){return e===`connected`?(0,Q.jsx)(j,{variant:`secondary`,children:v()}):e===`error`?(0,Q.jsx)(j,{variant:`destructive`,children:S()}):(0,Q.jsx)(j,{variant:`outline`,children:o()})}function Kt(){return T(x.bridgeHealth.getBridgeHealth,{})}function qt(){let e=Kt(),t=T(x.compat.getBridgeCompat,{}),n=T(x.me.getMe,{host:_t})?.role===`admin`,r=T(x.admin.listInstances,n?{}:`skip`),i=ht(),a=()=>void i({to:`/settings/anomalies`,search:{status:`open`}}),o=Nt(e?e.targets:[],t?t.targets:[],r??[]),s=t?.compat??null,c=t===void 0?`loading`:t===null?`nodata`:`ready`,l=s!==null&&wt(s,`hermes`)&&!o.some(e=>e.key===`hermes`);return(0,Q.jsxs)(`div`,{className:`oc-bridge`,children:[(0,Q.jsx)(Jt,{health:e,compat:t,onSeeAnomalies:a}),(0,Q.jsx)(`p`,{className:`oc-admin__hint oc-bridge__caption`,children:Fe()}),o.map(e=>(0,Q.jsx)(Yt,{providerKey:e.key,connections:e.connections,instances:e.instances,manifest:s,compatStatus:c,compatReachable:t?.reachable??!0},e.key)),l?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:me()}):null]})}function Jt({health:e,compat:t,onSeeAnomalies:n}){let r=t!=null&&t.buildVersion!=null&&t.bridgeVersion!=null&&t.buildVersion!==t.bridgeVersion,a=t?.buildRevision&&t.buildRevision!==`unknown`?t.buildRevision.slice(0,7):null,o=t&&t!==null?(0,Q.jsxs)(`span`,{className:`oc-bridge-card__ver`,children:[(0,Q.jsx)(`code`,{className:`oc-traces__mono`,children:Ct(t.bridgeVersion)}),a?(0,Q.jsxs)(Q.Fragment,{children:[` `,(0,Q.jsxs)(`code`,{className:`oc-traces__mono`,title:ie(),children:[`(`,a,`)`]})]}):null,r?(0,Q.jsxs)(`strong`,{className:`oc-bridge-card__mismatch`,children:[` `,g({build:t.buildVersion??`?`})]}):null,` · `,d(),` `,(0,Q.jsx)(`code`,{className:`oc-traces__mono`,children:t.protocolVersion===null?y():String(t.protocolVersion)})]}):null;if(e===void 0)return(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:w()});if(e===null)return(0,Q.jsx)(`div`,{className:`oc-bridge-card oc-bridge-card--idle`,children:Be()});let s=G(e.targets),c=!e.reachable,l=kt(e),u=l?`ok`:`error`,f=new Date(e.checkedAt).toLocaleString(`fr-FR`),p=e.startedAt==null?null:new Date(e.startedAt).toLocaleString(`fr-FR`);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)(P,{size:22}):c?(0,Q.jsx)(Ot,{size:22}):(0,Q.jsx)(F,{size:22})}),(0,Q.jsxs)(`div`,{className:`oc-bridge-card__body`,children:[(0,Q.jsx)(`div`,{className:`oc-bridge-card__title`,children:l?Ke():c?ke():i({count:s.length})}),(0,Q.jsxs)(`div`,{className:`oc-bridge-card__meta`,children:[(0,Q.jsxs)(`span`,{children:[(0,Q.jsx)(Dt,{size:12,"aria-hidden":!0}),` `,de({time:f})]}),p?(0,Q.jsx)(`span`,{children:we({time:p})}):null,o]}),c?(0,Q.jsx)(`p`,{className:`oc-bridge-card__hint`,children:U(e.lastError===`not_configured`?`NOT_CONFIGURED`:`BRIDGE_UNREACHABLE`).hint}):null]}),(0,Q.jsx)(`button`,{type:`button`,className:`oc-bridgebar__drill`,onClick:n,children:be()})]})}function Yt({providerKey:e,connections:t,instances:n,manifest:r,compatStatus:i,compatReachable:a}){let o=r?Tt(r,e):null,s=new Map;for(let e of n)s.set(e.name,e.displayName??e.name);let c=[],l=new Set;for(let n of t){if(!n.instanceName||l.has(n.instanceName))continue;l.add(n.instanceName);let t=n.gatewayVersion??null;c.push({instanceName:n.instanceName,displayName:s.get(n.instanceName)??n.instanceName,version:t,state:Et(t,e,r)})}let u=c.map(e=>e.state),d=u.includes(`beyond`)?`beyond`:u.length>0&&u.every(e=>e===`supported`)?`supported`:null,[f,p]=(0,W.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)(pt,{size:15,"aria-hidden":!0,className:`oc-bridge-provider__icon`}),(0,Q.jsx)(`span`,{className:`oc-bridge-provider__name`,children:Pt(e)}),d?(0,Q.jsx)(j,{variant:d===`beyond`?`destructive`:`secondary`,children:H(d)}):null]}),(0,Q.jsx)(`h4`,{className:`oc-bridge-provider__sub`,children:Xe()}),(0,Q.jsx)(Xt,{support:o,compatStatus:i,compatReachable:a,manifest:r,instanceRows:c}),(0,Q.jsxs)(`button`,{type:`button`,className:`oc-bridge-provider__sub oc-bridge-provider__sub--toggle`,"aria-expanded":f,onClick:()=>p(e=>!e),children:[f?(0,Q.jsx)(E,{size:13,"aria-hidden":!0}):(0,Q.jsx)(ot,{size:13,"aria-hidden":!0}),Se({count:t.length})]}),f?(0,Q.jsx)(Ht,{connections:t,displayByInstance:s}):null]})}function Xt({support:e,compatStatus:t,compatReachable:n,manifest:r,instanceRows:i}){return t===`loading`?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:w()}):t===`nodata`?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:fe()}):(0,Q.jsxs)(`div`,{className:`oc-compat`,children:[n?null:(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:se()}),r===null?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:oe()}):(0,Q.jsxs)(`div`,{className:`oc-compat__support`,children:[(0,Q.jsx)(`span`,{className:`oc-compat__label`,children:Ie()}),e&&e.range!==null?(0,Q.jsx)(`span`,{children:a({min:e.range.min,max:e.range.maxValidated})}):(0,Q.jsx)(`span`,{children:y()}),e?(0,Q.jsx)(en,{versions:e.validatedVersions}):null]}),i.length===0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:u()}):(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:Ct(e.version)}),(0,Q.jsx)(j,{variant:e.state===`supported`?`secondary`:e.state===`beyond`?`destructive`:`outline`,children:H(e.state)})]},e.instanceName))})]})}function Zt({instance:e,onClose:t}){return(0,Q.jsx)(ct,{open:!0,onOpenChange:e=>!e&&t(),children:(0,Q.jsxs)(it,{className:`oc-bridge-config-dialog`,onOpenAutoFocus:e=>e.preventDefault(),children:[(0,Q.jsxs)(gt,{children:[(0,Q.jsx)(vt,{children:Ae({instance:e.displayName??e.name})}),(0,Q.jsx)(mt,{children:r()})]}),(0,Q.jsx)($t,{instance:e,onClose:t})]})})}function Qt({label:e,result:t}){return t?t.checked?(0,Q.jsxs)(`p`,{className:`oc-bridge-config__check-row `+(t.ok?`oc-bridge-config__check-row--ok`:`oc-bridge-config__check-row--err`),children:[t.ok?(0,Q.jsx)(P,{"aria-hidden":!0}):(0,Q.jsx)(F,{"aria-hidden":!0}),(0,Q.jsxs)(`span`,{children:[e,` — `,t.ok?De():t.detail]})]}):(0,Q.jsxs)(`p`,{className:`oc-bridge-config__check-row oc-bridge-config__check-row--skip`,children:[e,` — `,Ge()]}):null}function $t({instance:e,onClose:t}){let n=Je(x.admin.upsertInstanceConfig),r=Me(x.bridge.validateMediaPaths),i=at(),[a,o]=(0,W.useState)(()=>et(e.config??{})),[c,l]=(0,W.useState)(!1),[u,d]=(0,W.useState)(!1),[f,m]=(0,W.useState)(null),h=a.inboundMediaMode===`shared-fs`,g=a.mediaMode===`shared-fs`,_=h||g;async function te(){d(!0),m(null);try{m(await r({instanceName:e.name,inboundMediaMode:a.inboundMediaMode,mediaMode:a.mediaMode}))}catch(e){i.error(je(),e)}finally{d(!1)}}async function re(){l(!0);try{let r=e.config??{};await n({instanceId:e._id,config:nt(a,r)}),t()}catch(e){i.error(ne(),e)}finally{l(!1)}}return(0,Q.jsx)(`div`,{className:`oc-bridge-config`,children:(0,Q.jsxs)(`div`,{className:`oc-bridge-config__form`,children:[(0,Q.jsxs)(`div`,{className:`oc-bridge-config__grid`,children:[(0,Q.jsxs)(`label`,{className:`oc-field`,children:[(0,Q.jsx)(D,{label:Ce(),help:p()}),(0,Q.jsxs)(L,{value:a.mediaMode,onValueChange:e=>o({...a,mediaMode:e}),children:[(0,Q.jsx)(A,{size:`sm`,className:`w-full`,children:(0,Q.jsx)(k,{})}),(0,Q.jsx)(N,{children:rt.map(e=>(0,Q.jsx)(I,{value:e,children:e},e))})]})]}),(0,Q.jsxs)(`label`,{className:`oc-field`,children:[(0,Q.jsx)(D,{label:ye(),help:ve()}),(0,Q.jsxs)(L,{value:a.inboundMediaMode,onValueChange:e=>o({...a,inboundMediaMode:e}),children:[(0,Q.jsx)(A,{size:`sm`,className:`w-full`,children:(0,Q.jsx)(k,{})}),(0,Q.jsx)(N,{children:tt.map(e=>(0,Q.jsx)(I,{value:e,children:e},e))})]})]}),(0,Q.jsxs)(`label`,{className:`oc-field`,children:[(0,Q.jsx)(D,{label:xe(),help:ge()}),(0,Q.jsx)(M,{type:`number`,min:1,max:4096,className:`w-full`,value:a.mediaMaxMb,onChange:e=>o({...a,mediaMaxMb:Math.trunc(Number(e.target.value)||0)})})]})]}),_&&(0,Q.jsxs)(`div`,{className:`oc-bridge-config__grid`,children:[h&&(0,Q.jsxs)(`label`,{className:`oc-field`,children:[(0,Q.jsx)(D,{label:Ye(),help:Te()}),(0,Q.jsx)(M,{className:`w-full`,spellCheck:!1,value:a.inboundAgentMount,onChange:e=>o({...a,inboundAgentMount:e.target.value})})]}),g&&(0,Q.jsxs)(`label`,{className:`oc-field`,children:[(0,Q.jsx)(D,{label:Ne(),help:Pe()}),(0,Q.jsx)(M,{className:`w-full`,spellCheck:!1,value:a.outboundAgentMount,onChange:e=>o({...a,outboundAgentMount:e.target.value})})]})]}),(0,Q.jsxs)(`label`,{className:`oc-field--row`,children:[(0,Q.jsx)(ft,{checked:a.rehydration,onCheckedChange:e=>o({...a,rehydration:e===!0})}),(0,Q.jsx)(D,{label:ee(),help:s()})]}),_&&f!==null&&(0,Q.jsx)(`div`,{className:`oc-bridge-config__check`,children:f.reachable?!f.inbound&&!f.outbound?(0,Q.jsxs)(`p`,{className:`oc-bridge-config__check-row oc-bridge-config__check-row--err`,children:[(0,Q.jsx)(F,{"aria-hidden":!0}),Ee({reason:f.reason??`?`})]}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(Qt,{label:qe(),result:f.inbound}),(0,Q.jsx)(Qt,{label:Re(),result:f.outbound}),(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:Oe()})]}):(0,Q.jsxs)(`p`,{className:`oc-bridge-config__check-row oc-bridge-config__check-row--err`,children:[(0,Q.jsx)(F,{"aria-hidden":!0}),Ve()]})}),(0,Q.jsxs)(`div`,{className:`oc-bridge-config__actions`,children:[_&&(0,Q.jsxs)(O,{variant:`outline`,size:`sm`,onClick:()=>void te(),disabled:u,children:[u?(0,Q.jsx)(lt,{className:`size-4 animate-spin`,"aria-hidden":!0}):null,u?He():ze()]}),(0,Q.jsx)(O,{size:`sm`,onClick:()=>void re(),disabled:c,children:Ue()})]})]})})}function en({versions:e}){if(e.length===0)return null;let t=[...e].reverse();return(0,Q.jsxs)(dt,{children:[(0,Q.jsx)(ut,{asChild:!0,children:(0,Q.jsxs)(`button`,{type:`button`,className:`oc-compat__versions-btn`,children:[e.length===1?Le():le({count:e.length}),(0,Q.jsx)(E,{size:13,"aria-hidden":!0})]})}),(0,Q.jsxs)(st,{className:`oc-compat__versions-pop`,align:`start`,children:[(0,Q.jsx)(`p`,{className:`oc-compat__versions-title`,children:l()}),(0,Q.jsx)(`div`,{className:`oc-compat__versions-list`,children:t.map(e=>(0,Q.jsx)(j,{variant:`secondary`,children:e},e))})]})]})}export{qt as BridgeTab,Zt as InstanceConfigDialog};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{AS as r,Br as i,Gr as a,Hr as o,Jr as s,Kr as c,Oi as l,Qd as u,Qr as d,S as f,Ur as p,Vr as m,Wr as h,Xr as ee,Yr as te,Zr as ne,aa as re,b as g,fO as _,fa as v,gO as y,oa as ie,qr as ae,ua as b,vO as x,x as S,yO as C,zD as w}from"./dist-DsBcH2-2.js";import{t as T}from"./button-9c1aLUeO.js";import{A as oe,B as se,C as E,F as ce,I as le,L as ue,N as de,P as fe,R as pe,S as me,Z as D,b as he,g as ge,h as O,mt as k,v as A,x as j,y as M,z as N}from"./index-DsOZBPOX.js";import{i as P}from"./compatView-DI9WOWM-.js";/* empty css */var F=t(e(),1),I=[`off`,`minimal`,`low`,`medium`,`high`,`xhigh`];function L(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 R=n();function _e({instance:e}){let t=x(_.admin.upsertInstanceConfig),n=typeof e.config?.summarizeThresholdChars==`number`?e.config.summarizeThresholdChars:null,[r,i]=(0,F.useState)(n===null?``:String(n)),[o,s]=(0,F.useState)(`idle`);(0,F.useEffect)(()=>{i(n===null?``:String(n)),s(`idle`)},[e._id,n]);let l=r.trim(),u=l===``?null:/^\d+$/.test(l)?Number.parseInt(l,10):NaN,d=u===null||Number.isInteger(u)&&u>=1e3&&u<=2e5,p=(u??null)!==n;async function m(){s(`saving`);try{let n={...e.config??{}};u===null?delete n.summarizeThresholdChars:n.summarizeThresholdChars=u,await t({instanceId:e._id,config:n}),s(`done`)}catch{s(`error`)}}return(0,R.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,R.jsx)(`span`,{className:`oc-cdefaults__label`,children:f()}),(0,R.jsxs)(`div`,{className:`oc-cdefaults__inline`,children:[(0,R.jsx)(D,{type:`number`,min:1e3,max:2e5,step:1e3,placeholder:`8000`,value:r,onChange:e=>i(e.target.value),className:`oc-cdefaults__number`,"aria-invalid":!d}),(0,R.jsx)(T,{size:`sm`,disabled:!p||!d||o===`saving`,onClick:()=>void m(),children:o===`saving`?v():c()})]}),d?null:(0,R.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:g()}),o===`done`?(0,R.jsx)(`p`,{className:`oc-admin__hint`,role:`status`,children:a()}):null,o===`error`?(0,R.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:h()}):null,(0,R.jsx)(`p`,{className:`oc-cdefaults__help`,children:S()})]})}function z(){let e=y(_.agentFiles.getChatDefaults),t=y(_.agentFiles.setChatDefaults),n=oe(),[f,g]=(0,F.useState)({status:`loading`}),[x,S]=(0,F.useState)({thinkingDefault:null,fastModeDefault:null}),[D,z]=(0,F.useState)(!1),[B,V]=(0,F.useState)(!1),H=C(_.admin.listInstances,{}),[U,W]=(0,F.useState)(null);(0,F.useEffect)(()=>{!H||H.length===0||(!U||!H.some(e=>e.name===U))&&W(H[0].name)},[H,U]);let G=(H?.length??0)>1,ve=H!==void 0&&H.length===0,ye=C(_.compat.forInstance,U?{instanceName:U}:`skip`),K=U?A(ye,`configDefaults`):`loading`,q=K===`loading`?null:K.blocked,J=(0,F.useMemo)(()=>G&&U?{instanceName:U}:{},[G,U]),Y=(0,F.useRef)(0),X=(0,F.useCallback)(async()=>{let t=++Y.current;g({status:`loading`});try{let n=L(await e(J));if(Y.current!==t)return;g({status:`done`,current:n}),S(n)}catch{if(Y.current!==t)return;g({status:`error`})}},[e,J]);(0,F.useEffect)(()=>{q===!1&&(G&&!U||X())},[X,q,G,U]);let Z=f.status===`done`?f.current:null,Q=Z!==null&&x.thinkingDefault!==null&&x.thinkingDefault!==Z.thinkingDefault,$=Z!==null&&x.fastModeDefault!==null&&x.fastModeDefault!==Z.fastModeDefault,be=Q||$;async function xe(){V(!0);try{await t({...J,...Q?{thinkingDefault:x.thinkingDefault}:{},...$?{fastModeDefault:x.fastModeDefault}:{}}),n.success(a()),await X()}catch(e){n.error(h(),e)}finally{V(!1)}}let Se=(0,F.useMemo)(()=>I.map(e=>({id:e,label:ge(e)})),[]),Ce=(0,F.useMemo)(()=>[{id:`fast`,label:ie()},{id:`standard`,label:re()}],[]);return(0,R.jsxs)(`div`,{className:`oc-cdefaults`,children:[(0,R.jsx)(`p`,{className:`oc-admin__hint`,children:d()}),G&&U?(0,R.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,R.jsx)(`span`,{className:`oc-cdefaults__label`,children:l()}),(0,R.jsxs)(M,{value:U,onValueChange:e=>W(e),disabled:B,children:[(0,R.jsx)(me,{size:`sm`,"aria-label":l(),children:(0,R.jsx)(E,{})}),(0,R.jsx)(he,{children:(H??[]).map(e=>(0,R.jsx)(j,{value:e.name,children:e.name},e.name))})]})]}):null,ve?(0,R.jsx)(`p`,{className:`oc-admin__hint`,role:`status`,children:u()}):K===`loading`?(0,R.jsx)(`p`,{className:`oc-admin__hint`,children:w()}):K.blocked?(0,R.jsxs)(`p`,{className:`oc-compat__blocked`,role:`status`,children:[(0,R.jsx)(k,{size:14,"aria-hidden":!0}),` `,P(K.gatewayVersion)]}):f.status===`loading`?(0,R.jsx)(`p`,{className:`oc-admin__hint`,children:w()}):f.status===`error`?(0,R.jsxs)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:[ae(),` `,(0,R.jsx)(T,{variant:`outline`,size:`sm`,onClick:()=>void X(),children:b()})]}):(0,R.jsxs)(R.Fragment,{children:[(0,R.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,R.jsx)(`span`,{className:`oc-cdefaults__label`,children:ne()}),(0,R.jsx)(O,{options:Se,value:x.thinkingDefault,onChange:e=>S({...x,thinkingDefault:e}),disabled:B}),(0,R.jsx)(`p`,{className:`oc-cdefaults__help`,children:ee()})]}),(0,R.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,R.jsx)(`span`,{className:`oc-cdefaults__label`,children:te()}),(0,R.jsx)(O,{options:Ce,value:x.fastModeDefault===null?null:x.fastModeDefault?`fast`:`standard`,onChange:e=>S({...x,fastModeDefault:e===`fast`}),disabled:B}),(0,R.jsx)(`p`,{className:`oc-cdefaults__help`,children:s()})]}),(0,R.jsx)(`div`,{className:`oc-cdefaults__actions`,children:(0,R.jsx)(T,{size:`sm`,disabled:!be||B,onClick:()=>z(!0),children:B?v():c()})}),(0,R.jsx)(`p`,{className:`oc-cdefaults__note`,children:p()})]}),(()=>{let e=H?.find(e=>e.name===(U??H[0]?.name));return e?(0,R.jsx)(_e,{instance:e}):null})(),(0,R.jsx)(de,{open:D,onOpenChange:z,children:(0,R.jsxs)(le,{children:[(0,R.jsxs)(N,{children:[(0,R.jsx)(se,{children:o()}),(0,R.jsx)(ue,{children:m()})]}),(0,R.jsxs)(pe,{children:[(0,R.jsx)(ce,{children:r()}),(0,R.jsx)(fe,{onClick:()=>void xe(),children:i()})]})]})})]})}export{z as ChatDefaultsTab};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{_c as r,dc as i,fc as a,gc as o,hc as s,mc as c,pc as l}from"./dist-
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{_c as r,dc as i,fc as a,gc as o,hc as s,mc as c,pc as l}from"./dist-DsBcH2-2.js";import{i as u,r as d}from"./dist-BMI7wyIc.js";import{t as f}from"./chevrons-up-down-D_kGoxSO.js";import{t as p}from"./button-9c1aLUeO.js";import{G as m,J as h,K as g,Tt as _,W as v,Y as y,_ as b,bt as x,ht as S}from"./index-DsOZBPOX.js";import{a as C,i as w,n as T,o as E,r as D,t as O}from"./table-C2kpo1_K.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=r(),bulkActions:F,emptyHint:I=o(),isExpanded:L,renderExpanded:R}){let[z,B]=(0,k.useState)(new Set),[V,H]=(0,k.useState)(null),U=t??[],W=V?n[V.index]:void 0,G=V&&W?.sort?j(U,W.sort,V.dir):U;function K(e){H(t=>!t||t.index!==e?{index:e,dir:`asc`}:t.dir===`asc`?{index:e,dir:`desc`}:null)}let q=+!!F+n.length+ +!!A,J=U.length>0&&z.size===U.length,Y=z.size>0&&!J;function X(){B(J?new Set:new Set(U.map(e=>e._id)))}function Z(e){B(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})}return(0,M.jsxs)(`div`,{className:`oc-dt`,children:[(0,M.jsxs)(`div`,{className:`oc-dt__bar`,children:[(0,M.jsx)(`h2`,{className:`oc-dt__title`,children:e}),(0,M.jsxs)(`div`,{className:`oc-dt__bar-actions`,children:[z.size>0&&F?F.map(e=>(0,M.jsxs)(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)(x,{}),` `,P]}):null]})]}),t===void 0?(0,M.jsx)(`p`,{className:`oc-admin__hint`,children:s()}):U.length===0?(0,M.jsx)(`p`,{className:`oc-admin__hint`,children:I}):(0,M.jsxs)(O,{children:[(0,M.jsx)(C,{children:(0,M.jsxs)(E,{children:[F?(0,M.jsx)(w,{className:`w-8`,children:(0,M.jsx)(b,{"aria-label":c(),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":i({column:e.header}),children:[e.header,n?V.dir===`asc`?(0,M.jsx)(d,{className:`oc-dt__sort-icon`,"aria-hidden":!0}):(0,M.jsx)(u,{className:`oc-dt__sort-icon`,"aria-hidden":!0}):(0,M.jsx)(f,{className:`oc-dt__sort-icon oc-dt__sort-icon--idle`,"aria-hidden":!0})]})},e.header):(0,M.jsx)(w,{className:e.className,children:e.header},e.header)}),A?(0,M.jsx)(w,{className:`w-8`}):null]})}),(0,M.jsx)(T,{children:G.map(e=>{let t=A?.(e)??[],r=L?.(e)??!1;return(0,M.jsxs)(k.Fragment,{children:[(0,M.jsxs)(E,{className:`group/row`,children:[F?(0,M.jsx)(D,{children:(0,M.jsx)(b,{"aria-label":l(),checked:z.has(e._id),onCheckedChange:()=>Z(e._id)})}):null,n.map(t=>(0,M.jsx)(D,{className:t.className,children:t.cell(e)},t.header)),A?(0,M.jsx)(D,{children:t.length>0?(0,M.jsxs)(v,{children:[(0,M.jsx)(y,{asChild:!0,children:(0,M.jsx)(p,{variant:`ghost`,size:`icon-sm`,"aria-label":a(),className:`opacity-0 transition-opacity group-hover/row:opacity-100 group-focus-within/row:opacity-100 aria-expanded:opacity-100`,children:(0,M.jsx)(_,{})})}),(0,M.jsx)(m,{align:`end`,children:t.map((t,n)=>(0,M.jsxs)(`div`,{children:[t.variant===`destructive`&&n>0?(0,M.jsx)(h,{}):null,(0,M.jsx)(g,{variant:t.variant,onSelect:()=>t.onSelect(e),children:t.label})]},t.label))})]}):null}):null]}),r&&R?(0,M.jsx)(E,{className:`oc-dt__expansion`,children:(0,M.jsx)(D,{colSpan:q,className:`oc-dt__expansion-cell`,children:R(e)})}):null]},e._id)})})]})]})}export{N as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./bundle-mjs-C73ZY4La.js";import{X as t}from"./index-
|
|
1
|
+
import{r as e}from"./bundle-mjs-C73ZY4La.js";import{X as t}from"./index-DsOZBPOX.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{$v as r,Av as i,Bv as a,Cv as o,Dv as s,Ev as c,Fv as l,Gv as u,Hv as d,Iv as f,Jv as p,Kv as m,Lv as ee,Mv as te,Nv as h,Ov as g,Pv as ne,Qv as re,Rv as ie,Sv as _,Tv as v,Uv as ae,Vv as y,Wv as b,Xv as x,Yv as S,Zv as C,_v as w,ay as T,bv as E,cv as D,cy as O,dv as k,ey as A,fO as j,fv as M,gv as N,hv as P,iy as F,jv as I,kv as L,lv as R,mv as oe,ny as z,oy as B,pv as V,qv as H,ry as U,sv as W,sy as G,ty as K,uv as q,vO as J,vv as se,wv as ce,xv as le,yO as ue,yv as de,zv as fe}from"./dist-DsBcH2-2.js";import{t as pe}from"./button-9c1aLUeO.js";import{j as me}from"./index-DsOZBPOX.js";import{t as he}from"./DataTableShell-VIRQvS8e.js";var Y=t(e(),1),X=n(),Z={altered_words:()=>O(),incorrect:()=>G(),incoherence:()=>B(),formatting:()=>T(),latency:()=>F(),api_error:()=>U(),other:()=>z()},Q=e=>Z[e]?.()??e;function $({matches:e,sourceWasOpen:t}){return t?e===!0?(0,X.jsx)(`span`,{className:`oc-fbadmin__pill is-ok`,children:A()}):e===!1?(0,X.jsx)(`span`,{className:`oc-fbadmin__pill is-warn`,children:r()}):(0,X.jsx)(`span`,{className:`oc-fbadmin__pill`,children:`—`}):(0,X.jsx)(`span`,{className:`oc-fbadmin__pill`,children:K()})}function ge({data:e,closeReason:t}){let n=e.snapshot,r=J(j.feedback.respondToFeedback),[i,o]=(0,Y.useState)(e.thread),[s,c]=(0,Y.useState)(``),[g,_]=(0,Y.useState)(!1);async function v(){let t=s.trim();if(!(!t||g)){_(!0);try{await r({feedbackId:e._id,text:t}),o(e=>[...e,{authorRole:`admin`,text:t,at:Date.now()}]),c(``)}finally{_(!1)}}}let w=[];try{w=n.contextJson?JSON.parse(n.contextJson):[]}catch{w=[]}return(0,X.jsxs)(`div`,{className:`oc-fbadmin__detail`,children:[(0,X.jsxs)(`div`,{className:`oc-fbadmin__row`,children:[(0,X.jsx)($,{matches:n.displayedMatchesStored,sourceWasOpen:n.clientInfo?.sourceWasOpen??!1}),(0,X.jsxs)(`span`,{className:`oc-fbadmin__meta`,children:[Q(e.category),` · `,n.messageRole,n.isRegeneration?` · ${re()}`:``,n.openclawModel?` · ${n.openclawModel}`:``,n.openclawRuntime?` (${n.openclawRuntime})`:``]})]}),e.comment?(0,X.jsxs)(`section`,{children:[(0,X.jsx)(`h4`,{className:`oc-fbadmin__h`,children:C()}),(0,X.jsx)(`p`,{className:`oc-fbadmin__comment`,children:e.comment})]}):null,t?(0,X.jsxs)(`section`,{children:[(0,X.jsx)(`h4`,{className:`oc-fbadmin__h`,children:V()}),(0,X.jsx)(`p`,{className:`oc-fbadmin__comment`,children:t})]}):null,(0,X.jsxs)(`section`,{children:[(0,X.jsx)(`h4`,{className:`oc-fbadmin__h`,children:x()}),i.length>0?(0,X.jsx)(`div`,{className:`oc-fbadmin__thread`,children:i.map((e,t)=>(0,X.jsxs)(`div`,{className:`oc-notif__msg oc-notif__msg--${e.authorRole}`,children:[(0,X.jsx)(`span`,{className:`oc-notif__msg-who`,children:e.authorRole===`admin`?S():p()}),(0,X.jsx)(`span`,{className:`oc-notif__msg-text`,children:e.text})]},t))}):(0,X.jsx)(`p`,{className:`oc-fbadmin__meta`,children:H()}),(0,X.jsx)(`textarea`,{className:`oc-feedback__textarea`,placeholder:m(),value:s,maxLength:2e3,rows:3,onChange:e=>c(e.target.value.slice(0,2e3))}),(0,X.jsx)(`div`,{className:`oc-fbadmin__row`,style:{justifyContent:`flex-end`},children:(0,X.jsx)(pe,{size:`sm`,onClick:()=>void v(),disabled:!s.trim()||g,children:g?u():b()})})]}),(0,X.jsxs)(`section`,{children:[(0,X.jsx)(`h4`,{className:`oc-fbadmin__h`,children:ae()}),(0,X.jsx)(`pre`,{className:`oc-msg__source-pre`,children:n.messageText||d()})]}),n.clientInfo?.sourceWasOpen&&n.displayedText!==void 0?(0,X.jsxs)(`section`,{children:[(0,X.jsx)(`h4`,{className:`oc-fbadmin__h`,children:y()}),(0,X.jsx)(`pre`,{className:`oc-msg__source-pre`,children:n.displayedText||d()})]}):null,n.promptText?(0,X.jsxs)(`section`,{children:[(0,X.jsx)(`h4`,{className:`oc-fbadmin__h`,children:a()}),(0,X.jsx)(`pre`,{className:`oc-msg__source-pre`,children:n.promptText})]}):null,w.length>0?(0,X.jsxs)(`section`,{children:[(0,X.jsx)(`h4`,{className:`oc-fbadmin__h`,children:fe({count:n.contextCount??w.length,truncated:n.contextTruncated?ie():``})}),(0,X.jsx)(`div`,{className:`oc-fbadmin__ctx`,children:w.map((e,t)=>(0,X.jsxs)(`div`,{className:`oc-fbadmin__ctx-turn`,children:[(0,X.jsx)(`span`,{className:`oc-fbadmin__ctx-role`,children:e.role}),(0,X.jsx)(`span`,{className:`oc-fbadmin__ctx-text`,children:e.text})]},t))})]}):null,n.outboxAvailable?(0,X.jsxs)(`section`,{children:[(0,X.jsx)(`h4`,{className:`oc-fbadmin__h`,children:ee()}),(0,X.jsxs)(`pre`,{className:`oc-msg__source-pre`,children:[n.outboxText??``,n.outboxStatus?`\n[status: ${n.outboxStatus}]`:``]})]}):null,n.clientInfo?.extensionsDetected&&n.clientInfo.extensionsDetected.length>0?(0,X.jsxs)(`section`,{children:[(0,X.jsx)(`h4`,{className:`oc-fbadmin__h`,children:f()}),(0,X.jsx)(`div`,{className:`oc-fbadmin__row`,children:n.clientInfo.extensionsDetected.map(e=>(0,X.jsx)(`span`,{className:`oc-fbadmin__pill is-warn`,children:e},e))})]}):null,(0,X.jsxs)(`section`,{children:[(0,X.jsx)(`h4`,{className:`oc-fbadmin__h`,children:l()}),(0,X.jsxs)(`p`,{className:`oc-fbadmin__env`,children:[[n.clientInfo?.language,n.clientInfo?.timezone,n.clientInfo?.theme?ne({theme:n.clientInfo.theme}):null,n.runId?`run ${n.runId.slice(0,12)}…`:null].filter(Boolean).join(` · `)||`—`,n.clientInfo?.plugins&&n.clientInfo.plugins.length>0?(0,X.jsxs)(`span`,{className:`oc-fbadmin__plugins`,children:[h(),` `,n.clientInfo.plugins.join(`, `),(0,X.jsxs)(`span`,{className:`oc-fbadmin__note`,children:[` `,te()]})]}):null,n.clientInfo?.userAgent?(0,X.jsx)(`span`,{className:`oc-fbadmin__ua`,children:n.clientInfo.userAgent}):null]})]})]})}function _e(){let e=ue(j.feedback.listForAdmin,{}),t=J(j.feedback.readSnapshot),n=J(j.feedback.deleteFeedback),r=me(),[a,l]=(0,Y.useState)(null),[u,d]=(0,Y.useState)({});async function f(e){if(a===e._id){l(null);return}if(!u[e._id]){let n=await t({feedbackId:e._id});d(t=>({...t,[e._id]:n}))}l(e._id)}async function p(e){await r({title:R(),description:D(),confirmLabel:W(),destructive:!0})&&(await n({feedbackId:e._id}),a===e._id&&l(null))}return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`p`,{className:`oc-admin__hint`,children:[I(),` `,(0,X.jsx)(`strong`,{children:i()}),` `,L()]}),(0,X.jsx)(he,{title:g(),rows:e,emptyHint:s(),isExpanded:e=>a===e._id&&!!u[e._id],renderExpanded:e=>u[e._id]?(0,X.jsx)(ge,{data:u[e._id],closeReason:e.userCloseReason}):null,columns:[{header:c(),cell:e=>new Date(e.at).toLocaleString(`fr-FR`),sort:e=>e.at},{header:v(),cell:e=>Q(e.category),sort:e=>Q(e.category)},{header:ce(),cell:e=>e.messageRole===`user`?o():_(),sort:e=>e.messageRole},{header:le(),cell:e=>(e.reporterEmail||e.reporterName||`—`)+(e.impersonated&&e.realOperatorEmail?` ${E({operator:e.realOperatorEmail})}`:``),sort:e=>e.reporterEmail||e.reporterName||null},{header:de(),cell:e=>(0,X.jsx)($,{matches:e.displayedMatchesStored,sourceWasOpen:e.sourceWasOpen}),sort:e=>e.displayedMatchesStored===!1?0:e.displayedMatchesStored===!0?1:2},{header:se(),cell:e=>e.hasComment?`✎`:`—`,sort:e=>+!!e.hasComment},{header:w(),cell:e=>e.userClosedAt==null?e.answered?(0,X.jsx)(`span`,{className:`oc-fbadmin__pill is-ok`,children:N()}):(0,X.jsx)(`span`,{className:`oc-fbadmin__pill`,children:P()}):(0,X.jsx)(`span`,{className:`oc-fbadmin__pill is-closed`,children:oe()}),sort:e=>e.userClosedAt==null?+!!e.answered:2}],rowActions:e=>[{label:a===e._id?M():k(),onSelect:()=>void f(e)},{label:q(),onSelect:()=>void p(e),variant:`destructive`}]})]})}export{_e as FeedbacksTab};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{r as e}from"./bundle-mjs-C73ZY4La.js";import{
|
|
1
|
+
import{r as e}from"./bundle-mjs-C73ZY4La.js";import{EO as t,pO as n}from"./dist-DsBcH2-2.js";import{c as r,l as i,s as a,u as o}from"./index-DsOZBPOX.js";var s=n(`circle-question-mark`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3`,key:`1u773s`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]]),c={media_delivery:{key:`media_delivery`,appliedIn:`bridge`,togglable:!0,placeholders:[`outboundDir`],defaultTemplate:`[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.`},documentary_fetch:{key:`documentary_fetch`,appliedIn:`convex`,togglable:!0,placeholders:[`references`],defaultTemplate:`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 :
|
|
3
3
|
{references}`,disabledTemplate:`{references}`},inbound_files:{key:`inbound_files`,appliedIn:`bridge`,togglable:!0,placeholders:[`files`],defaultTemplate:`[FICHIERS REÇUS]
|
|
4
4
|
{files}`},history_summary:{key:`history_summary`,appliedIn:`convex`,togglable:!0,placeholders:[`previous_summary`,`new_messages`,`max_chars`],defaultTemplate:`[SYNTHÈSE DE CONVERSATION]
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$E as r,AS as ee,BE as te,GE as ne,HE as re,IE as ie,JE as ae,KE as oe,LE as se,QE as i,RE as a,UE as o,VD as s,VE as c,WE as l,XE as u,YE as ce,ZE as le,_D as ue,aD as d,cD as de,dD as fe,eD as f,fD as pe,fO as p,gD as me,hD as he,iD as m,lD as ge,mD as h,nD as g,oD as _,pD as v,qE as _e,rD as y,sD as b,tD as x,uD as S,vO as C,yO as w,zD as T,zE as E}from"./dist-DsBcH2-2.js";import{t as D}from"./button-9c1aLUeO.js";import{A as O,B as k,C as A,Et as j,F as M,G as N,I as P,K as F,L as I,N as ve,P as ye,R as be,S as L,Tt as xe,W as Se,X as Ce,Y as we,b as R,ht as Te,x as z,y as B,yt as Ee,z as De}from"./index-DsOZBPOX.js";import{a as Oe,i as V,n as ke,o as H,r as U,t as Ae}from"./table-C2kpo1_K.js";var W=t(e(),1),G=n(),K=`all`;function q(e){switch(e){case`image`:return _();case`audio`:return d();case`video`:return m();case`pdf`:return y();case`document`:return g();case`archive`:return x();default:return f()}}function J(){let[e,t]=(0,W.useState)(K),[n,d]=(0,W.useState)(K),[f,m]=(0,W.useState)(K),[g,_]=(0,W.useState)(K),[y,x]=(0,W.useState)(null),J=C(p.files.softDelete),Y=O();function je(){t(K),d(K),m(K),_(K)}async function Me(){let e=y;if(x(null),e)try{await J({fileId:e.id}),Y.success(o())}catch(e){Y.error(re(),e)}}let X=w(p.files.listMine,{direction:e===K?void 0:e,chatId:n===K?void 0:n,instanceName:f===K?void 0:f,category:g===K?void 0:g}),Ne=(0,W.useMemo)(()=>new Intl.DateTimeFormat(s(),{dateStyle:`medium`,timeStyle:`short`}),[]);if(X===void 0)return(0,G.jsx)(`p`,{className:`oc-admin__hint`,children:T()});let{files:Z,facets:Q,truncated:Pe,cap:Fe}=X,$=e!==K||n!==K||f!==K||g!==K;return(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`p`,{className:`oc-admin__hint`,children:ue()}),(0,G.jsxs)(`div`,{className:`oc-files__filters`,style:{display:`flex`,flexWrap:`wrap`,gap:8,margin:`12px 0`},children:[(0,G.jsxs)(B,{value:e,onValueChange:t,children:[(0,G.jsx)(L,{size:`sm`,"aria-label":me(),children:(0,G.jsx)(A,{})}),(0,G.jsxs)(R,{children:[(0,G.jsx)(z,{value:K,children:he()}),(0,G.jsx)(z,{value:`inbound`,children:h()}),(0,G.jsx)(z,{value:`outbound`,children:v()})]})]}),(0,G.jsxs)(B,{value:n,onValueChange:d,children:[(0,G.jsx)(L,{size:`sm`,"aria-label":pe(),children:(0,G.jsx)(A,{})}),(0,G.jsxs)(R,{children:[(0,G.jsx)(z,{value:K,children:fe()}),Q.chats.map(e=>(0,G.jsx)(z,{value:e.id,children:e.title},e.id))]})]}),Q.multiProvider?(0,G.jsxs)(B,{value:f,onValueChange:m,children:[(0,G.jsx)(L,{size:`sm`,"aria-label":S(),children:(0,G.jsx)(A,{})}),(0,G.jsxs)(R,{children:[(0,G.jsx)(z,{value:K,children:ge()}),Q.instances.map(e=>(0,G.jsx)(z,{value:e,children:e},e))]})]}):null,(0,G.jsxs)(B,{value:g,onValueChange:_,children:[(0,G.jsx)(L,{size:`sm`,"aria-label":de(),children:(0,G.jsx)(A,{})}),(0,G.jsxs)(R,{children:[(0,G.jsx)(z,{value:K,children:b()}),Q.categories.map(e=>(0,G.jsx)(z,{value:e,children:q(e)},e))]})]}),$?(0,G.jsxs)(D,{variant:`ghost`,size:`sm`,onClick:je,style:{display:`inline-flex`,alignItems:`center`,gap:4,marginLeft:`auto`},children:[(0,G.jsx)(Ee,{size:14,"aria-hidden":!0}),oe()]}):null]}),Z.length===0?(0,G.jsx)(`p`,{className:`oc-admin__hint`,children:$?se():a()}):(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(Ae,{children:[(0,G.jsx)(Oe,{children:(0,G.jsxs)(H,{children:[(0,G.jsx)(V,{children:r()}),(0,G.jsx)(V,{children:i()}),(0,G.jsx)(V,{children:le()}),(0,G.jsx)(V,{children:u()}),(0,G.jsx)(V,{children:ce()}),(0,G.jsx)(V,{className:`text-right`,children:ae()})]})}),(0,G.jsx)(ke,{children:Z.map(e=>(0,G.jsxs)(H,{children:[(0,G.jsx)(U,{className:`font-medium`,style:{maxWidth:280,overflow:`hidden`,textOverflow:`ellipsis`},title:e.filename,children:e.filename}),(0,G.jsx)(U,{title:e.mimeType,children:q(e.category)}),(0,G.jsx)(U,{children:(0,G.jsx)(Ce,{variant:`secondary`,children:e.direction===`inbound`?h():v()})}),(0,G.jsx)(U,{style:{maxWidth:220,overflow:`hidden`,textOverflow:`ellipsis`},title:e.chatTitle,children:e.chatTitle}),(0,G.jsx)(U,{className:`whitespace-nowrap text-muted-foreground`,children:Ne.format(e.createdAt)}),(0,G.jsx)(U,{className:`text-right`,children:(0,G.jsxs)(Se,{children:[(0,G.jsx)(we,{asChild:!0,children:(0,G.jsx)(D,{variant:`ghost`,size:`icon`,"aria-label":ne(),children:(0,G.jsx)(xe,{size:16})})}),(0,G.jsxs)(N,{align:`end`,children:[e.url?(0,G.jsx)(F,{asChild:!0,children:(0,G.jsxs)(`a`,{href:e.url,download:e.filename,target:`_blank`,rel:`noopener noreferrer`,children:[(0,G.jsx)(j,{size:14}),_e()]})}):(0,G.jsxs)(F,{disabled:!0,children:[(0,G.jsx)(j,{size:14}),E()]}),(0,G.jsxs)(F,{variant:`destructive`,onSelect:()=>x({id:e._id,filename:e.filename}),children:[(0,G.jsx)(Te,{size:14}),l()]})]})]})})]},e._id))})]}),Pe?(0,G.jsx)(`p`,{className:`oc-admin__hint`,style:{marginTop:8},children:ie({cap:Fe})}):null]}),(0,G.jsx)(ve,{open:y!==null,onOpenChange:e=>!e&&x(null),children:(0,G.jsxs)(P,{children:[(0,G.jsxs)(De,{children:[(0,G.jsx)(k,{children:c()}),(0,G.jsx)(I,{children:te()})]}),(0,G.jsxs)(be,{children:[(0,G.jsx)(M,{children:ee()}),(0,G.jsx)(ye,{onClick:()=>void Me(),children:l()})]})]})})]})}export{J as FilesTab};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{vc as r,yc as i}from"./dist-
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{vc as r,yc as i}from"./dist-DsBcH2-2.js";import{t as a}from"./button-9c1aLUeO.js";import{Z as o,vt as s,yt as c}from"./index-DsOZBPOX.js";import{t as l}from"./TimeRangePicker-CPM9eoXo.js";var u=t(e(),1),d=n(),f=250;function p({q:e,onQChange:t,searchPlaceholder:n=i(),children:p,timeRange:m,onTimeRangeChange:h,onReset:g,canReset:_=!0}){let[v,y]=(0,u.useState)(e);(0,u.useEffect)(()=>{y(e)},[e]);let b=(0,u.useRef)(null);function x(e){y(e),b.current!==null&&window.clearTimeout(b.current),b.current=window.setTimeout(()=>t(e),f)}(0,u.useEffect)(()=>()=>{b.current!==null&&window.clearTimeout(b.current)},[]);function S(){b.current!==null&&window.clearTimeout(b.current),g()}return(0,d.jsxs)(`div`,{className:`oc-filterbar`,children:[(0,d.jsxs)(`div`,{className:`oc-filterbar__search`,children:[(0,d.jsx)(s,{className:`oc-filterbar__search-icon`,"aria-hidden":!0}),(0,d.jsx)(o,{value:v,onChange:e=>x(e.target.value),placeholder:n,"aria-label":n})]}),p?(0,d.jsx)(`div`,{className:`oc-filterbar__quick`,children:p}):null,m&&h?(0,d.jsx)(l,{value:m,onChange:h}):null,(0,d.jsxs)(a,{variant:`ghost`,size:`sm`,className:`oc-filterbar__reset`,onClick:S,disabled:!_,children:[(0,d.jsx)(c,{}),r()]})]})}export{p as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$a as r,Aa as i,Ao as a,Ba as o,Co as s,Da as c,Do as l,Ea as u,Eo as d,Fa as f,Ga as p,Ha as m,Ia as h,Ja as g,Ka as _,La as v,Ma as y,Mo as b,Na as x,No as ee,Oa as S,Oo as C,Pa as w,Qa as T,Ra as E,So as D,Ta as O,To as te,Ua as k,Va as A,Wa as ne,Xa as re,Ya as j,Za as ie,_o as M,ao as ae,bo as oe,co as se,do as ce,eo as N,fO as P,fo as le,go as ue,ho as de,io as F,ja as fe,jo as pe,ka as me,ko as he,lo as ge,mo as _e,no as ve,oo as ye,pO as I,po as be,qa as xe,ro as Se,so as Ce,to as we,uo as Te,vO as L,vo as Ee,wa as De,wo as Oe,xo as ke,yO as R,yo as Ae,za as je}from"./dist-DsBcH2-2.js";import{t as Me}from"./x-CyUGhZ48.js";import{i as z,n as B,r as Ne,t as Pe}from"./tabs-D7vYdFs6.js";import{t as V}from"./button-9c1aLUeO.js";import{$ as Fe,A as H,At as Ie,C as Le,Q as Re,S as ze,X as U,Z as W,_ as G,_t as K,b as Be,et as Ve,gt as q,j as He,m as Ue,nt as We,ot as Ge,rt as Ke,x as qe,y as Je}from"./index-DsOZBPOX.js";import{t as Ye}from"./FilterBar-DWv8wqqC.js";import{t as Xe}from"./DataTableShell-VIRQvS8e.js";import{t as J}from"./DetailChips-YKc12Z-i.js";var Ze=I(`chevron-left`,[[`path`,{d:`m15 18-6-6 6-6`,key:`1wnfg3`}]]),Qe=I(`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`}]]),Y=I(`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`}]]),$e=I(`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`}]]),X=t(e(),1);function et(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 tt(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 nt(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 rt(e){switch(e){case`admin`:return N();case`user`:return r();case`pending`:return T();default:return e}}function it(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 Z(e,t,n){let r=Math.max(1,Math.ceil(e.length/n)),i=Math.min(Math.max(1,Math.floor(t)),r),a=(i-1)*n;return{pageItems:e.slice(a,a+n),page:i,pageCount:r}}var Q=n(),$={name:``,description:``};function at(){let e=R(P.groups.listGroups,{}),t=R(P.me.getMe,{host:Ge})?.role===`admin`,n=L(P.groups.createGroup),r=L(P.groups.updateGroup),i=L(P.groups.deleteGroup),o=He(),f=H(),[p,m]=(0,X.useState)(!1),[h,g]=(0,X.useState)(null),[_,v]=(0,X.useState)($),[y,x]=(0,X.useState)(null),[S,w]=(0,X.useState)(``),T=(0,X.useMemo)(()=>{if(!e)return e;let t=S.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,S]);function E(){g(null),v($),m(!0)}function O(e){g(e),v({name:e.name,description:e.description??``}),m(!0)}async function k(){try{h?await r({groupId:h._id,name:_.name,description:_.description}):await n({name:_.name,description:_.description||void 0}),v($),g(null),m(!1)}catch(e){f.error(c(),e)}}async function A(e){if(await o({title:_e({name:e.name}),description:be(),confirmWord:e.name,confirmLabel:le(),cancelLabel:oe(),destructive:!0}))try{await i({groupId:e._id})}catch(e){f.error(u(),e)}}return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:b()}),(0,Q.jsx)(Ye,{q:S,onQChange:w,onReset:()=>w(``),canReset:S!==``,searchPlaceholder:te()}),(0,Q.jsx)(Xe,{title:ee(),rows:T,addLabel:pe(),onAdd:t?E:void 0,emptyHint:a(),columns:[{header:he(),cell:e=>e.name,sort:e=>e.name},{header:C(),cell:e=>(0,Q.jsx)(J,{icon:(0,Q.jsx)($e,{size:12,"aria-hidden":!0}),total:e.memberCount,items:e.members.map(e=>({label:e.label,marker:e.manager?(0,Q.jsx)(Y,{size:11,"aria-hidden":!0}):null,highlight:e.manager}))}),sort:e=>e.memberCount},{header:l(),cell:e=>(0,Q.jsx)(J,{icon:(0,Q.jsx)(K,{size:12,"aria-hidden":!0}),total:e.agentCount,items:e.agents.map(e=>({label:e}))}),sort:e=>e.agentCount},{header:d(),cell:e=>(0,Q.jsx)(J,{icon:(0,Q.jsx)(Qe,{size:12,"aria-hidden":!0}),total:e.chartCount,items:e.charts.map(e=>({label:e.name,marker:e.isDefault?(0,Q.jsx)(q,{size:11,fill:`currentColor`,"aria-hidden":!0}):null,highlight:e.isDefault}))}),sort:e=>e.chartCount}],rowActions:e=>[{label:Oe(),onSelect:()=>x({groupId:e._id,name:e.name})},...t?[{label:s(),onSelect:()=>O(e)},{label:D(),variant:`destructive`,onSelect:()=>void A(e)}]:[]]}),(0,Q.jsx)(Ue,{open:p,onOpenChange:m,title:h?Ee():Ae(),description:M(),canSubmit:!!_.name.trim(),onSubmit:k,submitLabel:ke(),children:(0,Q.jsxs)(`div`,{className:`oc-form`,children:[(0,Q.jsxs)(`label`,{className:`oc-field`,children:[(0,Q.jsx)(`span`,{className:`oc-field__label`,children:ue()}),(0,Q.jsx)(W,{value:_.name,onChange:e=>v({..._,name:e.target.value})})]}),(0,Q.jsxs)(`label`,{className:`oc-field`,children:[(0,Q.jsx)(`span`,{className:`oc-field__label`,children:de()}),(0,Q.jsx)(W,{value:_.description,onChange:e=>v({..._,description:e.target.value})})]})]})}),(0,Q.jsx)(ct,{groupId:y?.groupId??null,groupName:y?.name??``,open:y!==null,onOpenChange:e=>{e||x(null)}})]})}var ot=8;function st({page:e,pageCount:t,onPage:n}){return t<=1?null:(0,Q.jsxs)(`div`,{className:`oc-access__pager`,children:[(0,Q.jsxs)(V,{type:`button`,variant:`ghost`,size:`sm`,disabled:e<=1,onClick:()=>n(e-1),children:[(0,Q.jsx)(Ze,{size:14,"aria-hidden":!0}),Se()]}),(0,Q.jsxs)(`span`,{className:`oc-access__pageinfo`,"aria-label":we({page:e,pages:t}),children:[e,` / `,t]}),(0,Q.jsxs)(V,{type:`button`,variant:`ghost`,size:`sm`,disabled:e>=t,onClick:()=>n(e+1),children:[ve(),(0,Q.jsx)(Ie,{size:14,"aria-hidden":!0})]})]})}function ct({groupId:e,groupName:t,open:n,onOpenChange:r}){let a=R(P.groups.getGroup,n&&e?{groupId:e}:`skip`),s=R(P.groups.listAssignableInstances,n?{}:`skip`),c=R(P.groups.listAssignableUsers,n?{}:`skip`),l=L(P.groups.addMember),u=L(P.groups.removeMember),d=L(P.groups.bulkSetMembers),f=L(P.groups.setGroupManager),p=H(),[m,h]=(0,X.useState)(``),[g,v]=(0,X.useState)(``),[b,x]=(0,X.useState)(`members`),[ee,S]=(0,X.useState)(1),[C,w]=(0,X.useState)(new Set),T=(0,X.useRef)(null),E=(0,X.useMemo)(()=>new Set((a?.members??[]).map(e=>e.userId)),[a]),D=(0,X.useMemo)(()=>new Set((a?.members??[]).filter(e=>e.manager).map(e=>e.userId)),[a]),te=a?.viewerIsAdmin===!0,k=(0,X.useMemo)(()=>new Set((a?.agents??[]).map(e=>`${e.instanceName}/${e.agentId}`)),[a]);(0,X.useEffect)(()=>{h(``),v(``),x(`members`),S(1),T.current=null},[n,e]),(0,X.useEffect)(()=>{S(1)},[m]),(0,X.useEffect)(()=>{n&&a&&e&&T.current!==e&&(T.current=e,w(new Set((a.members??[]).map(e=>e.userId))))},[n,a,e]);let A=(0,X.useMemo)(()=>c?et(c,m,C):[],[c,m,C]);async function ne(t,n){if(e)try{n?await u({groupId:e,userId:t}):await l({groupId:e,userId:t})}catch(e){p.error(O(),e)}}async function re(t,n){if(e)try{await f({groupId:e,userId:t,manager:!n})}catch(e){p.error(me(),e)}}let M=it(A,e=>E.has(e.userId)),oe=A.filter(e=>E.has(e.userId)).length,N=Z(A,ee,ot);async function le(){if(!e||A.length===0)return;let t=A.map(e=>e.userId);try{await d({groupId:e,userIds:t,member:M!==`all`})}catch(e){p.error(O(),e)}}return(0,Q.jsx)(Re,{open:n,onOpenChange:r,children:(0,Q.jsxs)(Fe,{className:`oc-access`,children:[(0,Q.jsxs)(We,{children:[(0,Q.jsx)(Ke,{children:ce({name:t})}),(0,Q.jsx)(Ve,{children:Te()})]}),(0,Q.jsxs)(Pe,{value:b,onValueChange:x,className:`oc-access__tabs`,children:[(0,Q.jsxs)(Ne,{className:`w-full`,children:[(0,Q.jsxs)(z,{value:`members`,className:`flex-1 gap-1.5`,children:[(0,Q.jsx)($e,{size:13,"aria-hidden":!0}),ge(),a?(0,Q.jsx)(U,{variant:`secondary`,className:`oc-access__tabcount`,children:E.size}):null]}),(0,Q.jsxs)(z,{value:`agents`,className:`flex-1 gap-1.5`,children:[(0,Q.jsx)(K,{size:13,"aria-hidden":!0}),Ce(),a?(0,Q.jsx)(U,{variant:`secondary`,className:`oc-access__tabcount`,children:k.size}):null]}),(0,Q.jsxs)(z,{value:`charts`,className:`flex-1 gap-1.5`,children:[(0,Q.jsx)(Qe,{size:13,"aria-hidden":!0}),o(),a?(0,Q.jsx)(U,{variant:`secondary`,className:`oc-access__tabcount`,children:a.chartCount}):null]})]}),(0,Q.jsx)(B,{value:`members`,children:c===void 0||a===void 0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:j()}):c.length===0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:xe()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(W,{value:m,onChange:e=>h(e.target.value),placeholder:se(),className:`oc-access__search`}),A.length===0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:ae()}):(0,Q.jsxs)(Q.Fragment,{children:[A.length>1?(0,Q.jsxs)(`div`,{className:`oc-access__row oc-access__selectall`,children:[(0,Q.jsx)(G,{checked:M===`all`?!0:M===`some`?`indeterminate`:!1,onCheckedChange:()=>void le(),"aria-label":F()}),(0,Q.jsx)(`span`,{className:`oc-access__label`,children:F()}),(0,Q.jsxs)(U,{variant:`outline`,className:`oc-access__count`,children:[oe,` / `,A.length]})]}):null,(0,Q.jsx)(`div`,{className:`oc-access__list`,children:N.pageItems.map(e=>{let t=E.has(e.userId),n=nt(e),r=D.has(e.userId);return(0,Q.jsxs)(`div`,{className:`oc-access__row`,children:[(0,Q.jsx)(G,{checked:t,onCheckedChange:()=>void ne(e.userId,t),"aria-label":ie({user:n.primary})}),(0,Q.jsxs)(`span`,{className:`oc-access__who`,children:[(0,Q.jsx)(`span`,{className:`oc-access__label`,title:n.primary,children:n.primary}),n.secondary?(0,Q.jsx)(`span`,{className:`oc-access__sub`,title:n.secondary,children:n.secondary}):null]}),(0,Q.jsx)(U,{variant:`outline`,className:`oc-access__role`,children:rt(e.role)}),(0,Q.jsx)(`span`,{className:`oc-access__mgrslot`,children:t&&te?(0,Q.jsx)(V,{type:`button`,variant:`ghost`,size:`icon`,className:`shrink-0 oc-access__mgr${r?` oc-access__mgr--on`:``}`,"aria-pressed":r,"aria-label":r?i():fe(),title:r?i():fe(),onClick:()=>void re(e.userId,r),children:(0,Q.jsx)(Y,{size:15,"aria-hidden":!0})}):t&&r?(0,Q.jsx)(`span`,{className:`oc-access__mgr oc-access__mgr--on`,role:`img`,"aria-label":y(),title:y(),children:(0,Q.jsx)(Y,{size:15,"aria-hidden":!0})}):null})]},e._id)})}),(0,Q.jsx)(st,{page:N.page,pageCount:N.pageCount,onPage:S})]})]})}),(0,Q.jsx)(B,{value:`agents`,children:s===void 0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:j()}):s.length===0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:_()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(W,{value:g,onChange:e=>v(e.target.value),placeholder:ye(),className:`oc-access__search`}),(0,Q.jsx)(`div`,{className:`oc-access__list`,children:s.map(t=>(0,Q.jsx)(lt,{groupId:e,instanceName:t.name,kind:t.kind??`openclaw`,assigned:k,query:g},`${e}-${t._id}`))})]})}),(0,Q.jsx)(B,{value:`charts`,children:(0,Q.jsx)(ut,{groupId:e})})]})]})})}function lt({groupId:e,instanceName:t,kind:n,assigned:r,query:i}){let a=R(P.groups.listAssignableAgents,{instanceName:t}),o=L(P.groups.assignAgentToGroup),s=L(P.groups.removeAgentFromGroup),c=L(P.groups.bulkSetGroupAgents),l=H(),[u,d]=(0,X.useState)(1);if((0,X.useEffect)(()=>{d(1)},[i]),!e)return null;let f=tt(a?.agents??[],i),h=a?.discovery&&!a.discovery.lastPollOk;if(i.trim()&&f.length===0)return null;let _=f.filter(e=>e.presentInLastOk!==!1),v=it(_,e=>r.has(`${t}/${e.agentId}`)),y=Z(f,u,ot);async function b(n,r){try{r?await s({groupId:e,instanceName:t,agentId:n}):await o({groupId:e,instanceName:t,agentId:n})}catch(e){l.error(De(),e)}}async function x(){if(_.length===0)return;let n=_.map(e=>e.agentId);try{await c({groupId:e,instanceName:t,agentIds:n,assigned:v!==`all`})}catch(e){l.error(De(),e)}}return(0,Q.jsxs)(`div`,{className:`oc-access__group`,children:[(0,Q.jsxs)(`div`,{className:`oc-access__instance`,children:[(0,Q.jsx)(K,{size:13,"aria-hidden":!0}),(0,Q.jsx)(`span`,{children:t}),(0,Q.jsx)(U,{variant:`outline`,className:`oc-access__kind`,children:n}),h?(0,Q.jsx)(U,{variant:`outline`,className:`oc-access__stale`,children:k()}):null]}),a===void 0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:g()}):f.length===0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:h?ne():p()}):(0,Q.jsxs)(Q.Fragment,{children:[_.length>1?(0,Q.jsxs)(`div`,{className:`oc-access__row oc-access__selectall`,children:[(0,Q.jsx)(G,{checked:v===`all`?!0:v===`some`?`indeterminate`:!1,onCheckedChange:()=>void x(),"aria-label":F()}),(0,Q.jsx)(`span`,{className:`oc-access__label`,children:F()})]}):null,y.pageItems.map(e=>{let n=`${t}/${e.agentId}`,i=r.has(n),a=e.presentInLastOk===!1;return(0,Q.jsxs)(`div`,{className:`oc-access__row`,children:[(0,Q.jsx)(G,{checked:i,disabled:a&&!i,onCheckedChange:()=>void b(e.agentId,i),"aria-label":re({name:e.displayName??e.agentId})}),(0,Q.jsxs)(`span`,{className:`oc-access__label`,title:e.displayName??e.agentId,children:[e.emoji?`${e.emoji} `:``,e.displayName??e.agentId]}),e.model?(0,Q.jsx)(`span`,{className:`oc-access__model`,children:e.model}):null,e.isDefaultOnInstance?(0,Q.jsx)(`span`,{className:`oc-access__fav`,role:`img`,"aria-label":A(),title:A(),children:(0,Q.jsx)(q,{size:14,fill:`currentColor`})}):null,a?(0,Q.jsx)(U,{variant:`outline`,className:`oc-access__gone`,children:m()}):null]},e.agentId)}),(0,Q.jsx)(st,{page:y.page,pageCount:y.pageCount,onPage:d})]})]})}function ut({groupId:e}){let t=R(P.charts.listGroupChartSelection,e?{groupId:e}:`skip`),n=L(P.charts.assignChartToGroup),r=L(P.charts.removeChartFromGroup),i=L(P.charts.setGroupDefaultChart),a=L(P.charts.addChartToGroupPool),o=L(P.charts.removeChartFromGroupPool),s=H();if(!e)return null;if(t===void 0)return(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:j()});let{pool:c,addable:l,canManagePool:u}=t;if(c.length===0&&!u)return(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:je()});async function d(t,i){try{i?await r({groupId:e,chartKey:t}):await n({groupId:e,chartKey:t})}catch(e){s.error(S(),e)}}async function p(t){try{await i({groupId:e,chartKey:t})}catch(e){s.error(S(),e)}}async function m(t){try{await a({groupId:e,chartKey:t})}catch(e){s.error(S(),e)}}async function g(t){try{await o({groupId:e,chartKey:t})}catch(e){s.error(S(),e)}}return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`div`,{className:`oc-access__list`,children:c.map(e=>(0,Q.jsxs)(`div`,{className:`oc-access__row`,children:[(0,Q.jsx)(G,{checked:e.selected,onCheckedChange:()=>void d(e.chartKey,e.selected),"aria-label":f({name:e.name})}),(0,Q.jsx)(`span`,{className:`oc-access__label`,title:e.name,children:e.name}),e.selected?e.isDefault?(0,Q.jsx)(`span`,{className:`oc-access__fav`,role:`img`,"aria-label":w(),title:w(),children:(0,Q.jsx)(q,{size:14,fill:`currentColor`})}):(0,Q.jsx)(V,{type:`button`,variant:`ghost`,size:`sm`,onClick:()=>void p(e.chartKey),children:x()}):null,u?(0,Q.jsx)(V,{type:`button`,variant:`ghost`,size:`sm`,"aria-label":h({name:e.name}),title:h({name:e.name}),onClick:()=>void g(e.chartKey),children:(0,Q.jsx)(Me,{size:14,"aria-hidden":!0})}):null]},e.chartKey))}),u?l.length>0?(0,Q.jsxs)(Je,{value:``,onValueChange:e=>void m(e),children:[(0,Q.jsx)(ze,{size:`sm`,className:`oc-access__search`,children:(0,Q.jsx)(Le,{placeholder:v()})}),(0,Q.jsx)(Be,{children:l.map(e=>(0,Q.jsx)(qe,{value:e.chartKey,children:e.name},e.chartKey))})]}):c.length===0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:E()}):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{$g as r,$h as i,A_ as a,Ag as o,Bg as s,C_ as c,Cg as l,D_ as u,Dg as d,E_ as f,Eg as p,Fg as m,Gg as h,Hd as g,Hg as _,Ig as v,Jg as y,Jh as b,Kg as x,L as S,Lg as ee,M_ as C,Mg as w,N_ as T,Ng as E,O_ as D,Og as te,Pg as ne,Qg as re,Qh as ie,R as ae,Rg as oe,S_ as se,Sg as ce,T_ as le,Tg as ue,Ud as de,Ug as fe,Vg as pe,Wg as me,Xg as he,Xh as ge,Yg as O,Yh as _e,Zg as ve,Zh as ye,__ as be,_g as k,a_ as xe,ag as Se,bC as Ce,b_ as we,bg as Te,c_ as Ee,cg as De,d_ as Oe,dg as ke,e_ as Ae,eg as je,fO as A,f_ as Me,fg as Ne,gO as j,g_ as Pe,gg as Fe,h_ as Ie,hg as Le,i_ as Re,ig as ze,j_ as Be,jg as Ve,k_ as He,kg as Ue,l_ as We,lg as Ge,m_ as Ke,mg as M,n_ as qe,ng as Je,o_ as Ye,og as Xe,p_ as Ze,pg as Qe,qg as $e,qh as et,r_ as tt,rg as nt,s_ as rt,sg as it,t_ as at,tg as ot,u_ as st,ug as ct,vO as N,v_ as lt,vg as ut,w_ as dt,wg as ft,x_ as pt,xg as mt,yC as ht,yO as P,y_ as gt,yg as F,zg as I}from"./dist-DsBcH2-2.js";import{a as _t,c as vt}from"./FieldLabel-BYZOkwDx.js";import{t as L}from"./button-9c1aLUeO.js";import{$ as R,A as z,C as B,H as yt,Q as V,S as H,U as bt,V as xt,X as U,Z as W,_ as G,b as K,et as q,j as St,m as Ct,nt as wt,rt as Tt,x as J,y as Et}from"./index-DsOZBPOX.js";import{t as Dt}from"./DataTableShell-VIRQvS8e.js";import{InstanceConfigDialog as Ot}from"./BridgeTab-DNaXjHu5.js";var Y=t(e(),1),X=[`conversational`,`documentary`,`summarizer`],kt=new Set(X),At=`conversational`;function jt(e){let t=new Set((e??[]).filter(e=>kt.has(e)));return t.size===0?[At]:X.filter(e=>t.has(e))}var Z=n(),Q={name:``,gatewayUrl:``,bridgeUrl:``,displayName:``,kind:`openclaw`,gatewayVersion:``,gatewayHttpUrl:``,streamTransport:_t},Mt={openclaw:[`token`,`deviceIdentity`],hermes:[`apiKey`]};function Nt(e){return{name:e.name,gatewayUrl:e.gatewayUrl,bridgeUrl:e.bridgeUrl??``,displayName:e.displayName??``,kind:e.kind??`openclaw`,gatewayVersion:e.gatewayVersion??``,gatewayHttpUrl:e.gatewayHttpUrl??``,streamTransport:e.streamTransport??`reactive`}}function Pt(){let e=P(A.admin.listInstances,{}),t=P(A.agents.listAllInstanceAgents,{}),n=N(A.admin.upsertInstance),r=N(A.admin.deleteInstance),i=z(),[o,s]=(0,Y.useState)(!1),[l,d]=(0,Y.useState)(Q),[p,m]=(0,Y.useState)(null),[h,_]=(0,Y.useState)(null),[v,y]=(0,Y.useState)(null),[x,S]=(0,Y.useState)(null);async function ee(){try{await n({instanceId:x??void 0,name:l.name,gatewayUrl:l.gatewayUrl,bridgeUrl:l.bridgeUrl||void 0,displayName:l.displayName||void 0,kind:l.kind,gatewayVersion:l.gatewayVersion||void 0,gatewayHttpUrl:l.gatewayHttpUrl||void 0,streamTransport:l.streamTransport}),d(Q),S(null),s(!1)}catch(e){i.error(Be(),e)}}return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`p`,{className:`oc-admin__hint`,children:[a(),(0,Z.jsx)(`strong`,{children:He()}),D()]}),(0,Z.jsx)(Dt,{title:u(),rows:e,addLabel:f(),onAdd:()=>{S(null),d(Q),s(!0)},emptyHint:le(),columns:[{header:dt(),cell:e=>e.name,sort:e=>e.name},{header:c(),cell:e=>(0,Z.jsx)(U,{variant:`outline`,children:e.kind??`openclaw`}),sort:e=>e.kind??`openclaw`},{header:se(),cell:e=>e.gatewayUrl,sort:e=>e.gatewayUrl},{header:pt(),cell:e=>e.displayName??`—`,sort:e=>e.displayName??null},{header:T(),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)(U,{variant:r(e.agentId)?`default`:`outline`,title:r(e.agentId)?b():void 0,children:[e.emoji?`${e.emoji} `:``,e.displayName??e.agentId]},e.agentId))})}}],rowActions:e=>[{label:be(),onSelect:()=>{S(e._id),d(Nt(e)),s(!0)}},{label:C(),onSelect:()=>m(e.name)},{label:qe(),onSelect:()=>y(e)},{label:we(),onSelect:()=>_(e)},{label:gt(),variant:`destructive`,onSelect:()=>void r({instanceId:e._id})}],bulkActions:[{label:gt(),variant:`destructive`,onSelect:e=>e.forEach(e=>void r({instanceId:e}))}]}),(0,Z.jsx)(Ct,{open:o,onOpenChange:s,title:x?Pe():lt(),description:Ke(),canSubmit:!!(l.name&&l.gatewayUrl),onSubmit:ee,submitLabel:Ze(),children:(0,Z.jsxs)(`div`,{className:`oc-form`,children:[(0,Z.jsxs)($,{label:Me(),children:[(0,Z.jsx)(W,{value:l.name,disabled:x!==null,onChange:e=>d({...l,name:e.target.value})}),x?(0,Z.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:Ie()}):null]}),(0,Z.jsx)($,{label:Oe(),children:(0,Z.jsxs)(Et,{value:l.kind,onValueChange:e=>d({...l,kind:e}),children:[(0,Z.jsx)(H,{size:`sm`,className:`w-40`,children:(0,Z.jsx)(B,{})}),(0,Z.jsxs)(K,{children:[(0,Z.jsx)(J,{value:`openclaw`,children:`OpenClaw`}),(0,Z.jsx)(J,{value:`hermes`,children:`Hermes`})]})]})}),(0,Z.jsx)($,{label:st(),children:(0,Z.jsx)(W,{value:l.gatewayUrl,onChange:e=>d({...l,gatewayUrl:e.target.value})})}),(0,Z.jsx)($,{label:We(),children:(0,Z.jsx)(W,{value:l.bridgeUrl,placeholder:Ee(),onChange:e=>d({...l,bridgeUrl:e.target.value})})}),(0,Z.jsx)($,{label:rt(),children:(0,Z.jsx)(W,{value:l.displayName,onChange:e=>d({...l,displayName:e.target.value})})}),(0,Z.jsxs)($,{label:de(),children:[(0,Z.jsxs)(Et,{value:l.streamTransport,onValueChange:e=>d({...l,streamTransport:e}),children:[(0,Z.jsx)(H,{size:`sm`,className:`w-40`,children:(0,Z.jsx)(B,{})}),(0,Z.jsx)(K,{children:vt.map(e=>(0,Z.jsx)(J,{value:e,children:e},e))})]}),(0,Z.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:g()})]}),(0,Z.jsx)($,{label:Ye(),children:(0,Z.jsx)(W,{value:l.gatewayVersion,placeholder:xe(),onChange:e=>d({...l,gatewayVersion:e.target.value})})}),(0,Z.jsx)($,{label:Re(),children:(0,Z.jsx)(W,{value:l.gatewayHttpUrl,placeholder:tt(),onChange:e=>d({...l,gatewayHttpUrl:e.target.value})})})]})}),(0,Z.jsx)(Wt,{instanceName:p,open:p!==null,onOpenChange:e=>{e||m(null)}}),h?(0,Z.jsx)(Ot,{instance:h,onClose:()=>_(null)},h._id):null,v?(0,Z.jsx)(Ft,{instance:v,onClose:()=>y(null)},v._id):null]})}function Ft({instance:e,onClose:t}){let n=P(A.instanceSecrets.listInstanceSecretStatus,{}),r=Mt[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)(V,{open:!0,onOpenChange:e=>!e&&t(),children:(0,Z.jsxs)(R,{onOpenAutoFocus:e=>e.preventDefault(),children:[(0,Z.jsxs)(wt,{children:[(0,Z.jsx)(Tt,{children:at({instance:e.displayName??e.name})}),(0,Z.jsx)(q,{children:Ae()})]}),(0,Z.jsx)(`div`,{className:`oc-form`,children:r.map(t=>(0,Z.jsx)(Rt,{instanceId:e._id,field:t,updatedAt:i[t]??null},t))}),(0,Z.jsx)(`div`,{className:`oc-bridgesecret`,children:(0,Z.jsx)(Lt,{instance:e})}),(0,Z.jsx)(It,{instance:e})]})})}function It({instance:e}){let t=j(A.instanceSync.forceInstanceSync),n=z(),[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(ne());break;case`no_agents`:n.success(w());break;case`no_bridge_url`:n.error(Ve());break;case`deploy_misconfigured`:n.error(o());break;case`unauthorized`:n.error(te());break;case`not_served`:n.error(d());break;default:n.error(Ue());break}}catch(e){n.error(E(),e)}finally{i(!1)}}}return(0,Z.jsxs)(`div`,{className:`oc-form`,children:[(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:p()}),(0,Z.jsx)(`div`,{className:`flex items-center gap-2`,children:(0,Z.jsx)(L,{size:`sm`,variant:`outline`,onClick:()=>void a(),disabled:r,children:r?m():v()})})]})}function Lt({instance:e}){let t=P(A.bridgeAuth.listBridgeAuthStatus,{}),n=j(A.bridgeAuth.mintBridgeSecret),r=N(A.bridgeAuth.revokeBridgeSecret),i=z(),[a,o]=(0,Y.useState)(!1),[s,c]=(0,Y.useState)(null),[u,d]=(0,Y.useState)(!1),f=(t??[]).find(t=>t.instanceId===e._id),p=f!==void 0;async function m(){if(!a){o(!0);try{c((await n({instanceId:e._id})).plaintext),d(!1)}catch(e){i.error(F(),e)}finally{o(!1)}}}async function h(){if(!a){o(!0);try{await r({instanceId:e._id}),c(null),i.success(Te())}catch(e){i.error(F(),e)}finally{o(!1)}}}async function g(){if(s)try{await navigator.clipboard.writeText(s),d(!0)}catch{}}return(0,Z.jsxs)($,{label:ue(),children:[(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:ft()}),(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Z.jsx)(U,{variant:p?`outline`:`secondary`,children:p?`${he()} · ${f.prefix}…${f.lastFour}`:O()}),(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(L,{size:`sm`,onClick:()=>void m(),disabled:a,children:p?ce():l()}),p?(0,Z.jsx)(L,{size:`sm`,variant:`destructive`,onClick:()=>void h(),disabled:a,children:mt()}):null]})]}),s?(0,Z.jsxs)(`div`,{className:`oc-bridgesecret__reveal`,children:[(0,Z.jsx)(`p`,{className:`oc-sa__minted-warning`,children:ut()}),(0,Z.jsxs)(`div`,{className:`oc-sa__minted-box`,children:[(0,Z.jsx)(`code`,{className:`oc-sa__minted-plain`,children:s}),(0,Z.jsx)(L,{variant:`outline`,size:`sm`,onClick:()=>void g(),children:u?Ce():ht()})]}),(0,Z.jsx)(L,{size:`sm`,variant:`ghost`,onClick:()=>{c(null),d(!1)},children:k()})]}):null]})}function Rt({instanceId:e,field:t,updatedAt:n}){let i=j(A.instanceSecrets.setInstanceSecret),a=N(A.instanceSecrets.clearInstanceSecret),o=j(A.deviceIdentity.generateDeviceIdentity),c=z(),[l,u]=(0,Y.useState)(``),[d,f]=(0,Y.useState)(!1),[p,m]=(0,Y.useState)(null),[g,v]=(0,Y.useState)(!1),b=n!==null,S=t===`deviceIdentity`,C=t===`token`?r():t===`deviceIdentity`?re():ve();async function w(){if(!(!l.trim()||d)){f(!0);try{await i({instanceId:e,field:t,plaintext:l}),u(``),m(null),v(!1),c.success(me())}catch(e){c.error(fe(),e)}finally{f(!1)}}}async function T(){if(!d){f(!0);try{await a({instanceId:e,field:t}),m(null),v(!1),c.success(_())}catch(e){c.error(fe(),e)}finally{f(!1)}}}async function E(){if(!d){f(!0);try{m(await o({instanceId:e})),v(!1),c.success(I())}catch(e){c.error(ee(),e)}finally{f(!1)}}}let D=p?`openclaw devices approve ${p.id}`:``;async function te(){if(D)try{await navigator.clipboard.writeText(D),v(!0)}catch{}}return(0,Z.jsxs)($,{label:C,children:[S?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:s()}):null,(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Z.jsx)(U,{variant:b?`outline`:`secondary`,children:b?he():O()}),(0,Z.jsx)(W,{type:`password`,autoComplete:`off`,className:`flex-1 min-w-32`,value:l,placeholder:b?$e():y(),onChange:e=>u(e.target.value)}),(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(L,{size:`sm`,onClick:()=>void w(),disabled:d||l.trim().length===0,children:x()}),S?(0,Z.jsx)(L,{size:`sm`,variant:`outline`,onClick:()=>void E(),disabled:d,children:pe()}):null,b?(0,Z.jsx)(L,{size:`sm`,variant:`destructive`,onClick:()=>void T(),disabled:d,children:h()}):null]})]}),p?(0,Z.jsxs)(`div`,{className:`oc-bridgesecret__reveal`,children:[(0,Z.jsx)(`p`,{className:`text-sm font-medium`,children:I()}),(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:oe()}),(0,Z.jsxs)(`div`,{className:`oc-sa__minted-box`,children:[(0,Z.jsx)(`code`,{className:`oc-sa__minted-plain`,children:D}),(0,Z.jsx)(L,{variant:`outline`,size:`sm`,onClick:()=>void te(),children:g?Ce():ht()})]}),(0,Z.jsx)(L,{size:`sm`,variant:`ghost`,onClick:()=>{m(null),v(!1)},children:k()})]}):null]})}var zt={conversational:Ge,documentary:it,summarizer:ae},Bt={conversational:De,documentary:Xe,summarizer:S},Vt=e=>(zt[e]??(()=>e))(),Ht=e=>(Bt[e]??(()=>``))();function Ut({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:Qe()}),t.map(e=>(0,Z.jsx)(U,{variant:`secondary`,className:`oc-agenttype__chip`,title:Ht(e),children:Vt(e)},e)),(0,Z.jsxs)(xt,{children:[(0,Z.jsx)(bt,{asChild:!0,children:(0,Z.jsx)(L,{type:`button`,variant:`outline`,size:`sm`,className:`h-7`,children:Ne()})}),(0,Z.jsxs)(yt,{align:`start`,className:`oc-agenttypes-pop`,children:[(0,Z.jsx)(`p`,{className:`oc-agenttypes-pop__title`,children:ke()}),(0,Z.jsx)(`p`,{className:`oc-agenttypes-pop__hint`,children:ct()}),(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)(G,{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:Vt(r)}),(0,Z.jsx)(`span`,{className:`oc-agenttypes-pop__desc`,children:Ht(r)})]})]},r)})})]})]})]})}function Wt({instanceName:e,open:t,onOpenChange:n}){let r=P(A.agents.listAgentsForInstance,t&&e?{instanceName:e}:`skip`),a=N(A.agents.setAgentEnabled).withOptimisticUpdate((e,{instanceName:t,agentId:n,enabled:r})=>{let i=e.getQuery(A.agents.listAgentsForInstance,{instanceName:t});i&&e.setQuery(A.agents.listAgentsForInstance,{instanceName:t},{...i,agents:i.agents.map(e=>e.agentId===n?{...e,enabled:r}:e)})}),o=N(A.agents.setInstanceDefaultAgent).withOptimisticUpdate((e,{instanceName:t,agentId:n})=>{let r=e.getQuery(A.agents.listAgentsForInstance,{instanceName:t});r&&e.setQuery(A.agents.listAgentsForInstance,{instanceName:t},{...r,defaultAgentId:n})}),s=N(A.agents.setAgentTypes).withOptimisticUpdate((e,{instanceName:t,agentId:n,types:r})=>{let i=e.getQuery(A.agents.listAgentsForInstance,{instanceName:t});if(!i)return;let a=jt(r);e.setQuery(A.agents.listAgentsForInstance,{instanceName:t},{...i,agents:i.agents.map(e=>e.agentId===n?{...e,types:a}:e)})}),c=N(A.agents.removeInstanceAgent),l=St(),u=z();async function d(t,n){if(e)try{await a({instanceName:e,agentId:t,enabled:n})}catch(e){u.error(M(),e)}}async function f(t){if(e)try{await o({instanceName:e,agentId:t})}catch(e){u.error(M(),e)}}async function p(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){u.error(M(),e)}}async function m(t,n){if(e&&await l({title:nt({name:n}),description:Je(),confirmLabel:ot(),destructive:!0}))try{await c({instanceName:e,agentId:t}),u.success(je())}catch(e){u.error(M(),e)}}return(0,Z.jsx)(V,{open:t,onOpenChange:n,children:(0,Z.jsxs)(R,{className:`oc-access`,children:[(0,Z.jsxs)(wt,{children:[(0,Z.jsx)(Tt,{children:Fe({name:e??``})}),(0,Z.jsx)(q,{children:Le()})]}),r===void 0?(0,Z.jsx)(`p`,{className:`oc-access__hint`,children:i()}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`div`,{className:`oc-access__poll`,children:r.discovery===null?ie():r.discovery.lastPollOk?ye():ge({error:r.discovery.error??`?`})}),r.agents.length===0?(0,Z.jsx)(`p`,{className:`oc-access__hint`,children:_e()}):(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)(G,{checked:e.enabled,disabled:t,"aria-label":i,onCheckedChange:t=>void d(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)(U,{variant:`outline`,className:`oc-access__gone`,children:et()}),(0,Z.jsx)(L,{size:`sm`,variant:`ghost`,className:`h-7 text-destructive`,onClick:()=>void m(e.agentId,i),children:ze()})]}):n?(0,Z.jsx)(U,{variant:`default`,children:b()}):(0,Z.jsx)(L,{size:`sm`,variant:`outline`,className:`h-7`,disabled:!e.enabled,onClick:()=>void f(e.agentId),children:Se()})]}),e.enabled?(0,Z.jsx)(Ut,{agentId:e.agentId,types:a,onToggle:t=>void p(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{Pt as InstancesTab};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$t as r,$y as i,Ay as a,By as o,Cy as s,Dy as c,Ey as l,Fy as u,Gy as ee,Hy as d,Iy as te,Jy as f,Ky as ne,Ly as p,My as re,Ny as ie,Oy as ae,Py as oe,Qt as m,Qy as h,Ry as g,Sy as se,Ty as ce,Uy as le,Vy as _,Wy as ue,Xy as v,Yy as y,Zt as b,Zy as x,_y as S,an as C,by as w,dy as T,eb as E,en as D,fO as O,fy as k,gO as A,gy as j,hy as M,in as N,jy as P,ky as F,ly as I,my as L,nn as R,py as z,qy as B,rn as V,tb as H,tn as U,uy as de,vO as W,vy as fe,wy as pe,xy as me,yO as he,yy as ge,zy as _e}from"./dist-DsBcH2-2.js";import{t as G}from"./button-9c1aLUeO.js";import{C as ve,S as ye,X as K,Z as q,_ as be,b as xe,x as Se,y as Ce}from"./index-DsOZBPOX.js";import{t as we}from"./DataTableShell-VIRQvS8e.js";var J=t(e(),1),Y=n();function Te(){let e=he(O.integrations.status.status,{}),t=W(O.admin.setIntegrationConfig),[n,r]=(0,J.useState)(null);if((0,J.useEffect)(()=>{e&&n===null&&r(e.config)},[e,n]),!e||!n)return(0,Y.jsx)(`p`,{className:`oc-admin__hint`,children:H()});let m=n,b=(e,t,n)=>r({...m,[e]:{...m[e],[t]:n}}),D=(e,n)=>void t({[e]:n});return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(`p`,{className:`oc-admin__hint`,children:[E(),` `,(0,Y.jsx)(`strong`,{children:i()}),` `,h()]}),(0,Y.jsxs)(X,{title:`Langfuse`,status:e.langfuse.configured?e.langfuse.enabled?(0,Y.jsx)(K,{variant:`secondary`,children:x()}):(0,Y.jsx)(K,{variant:`outline`,children:v()}):(0,Y.jsx)(K,{variant:`outline`,children:y()}),note:B(),children:[(0,Y.jsx)(Z,{label:ee(),children:(0,Y.jsx)(q,{value:m.langfuse.host??``,placeholder:e.langfuse.effectiveHost,onChange:e=>b(`langfuse`,`host`,e.target.value),onBlur:()=>D(`langfuse`,{host:m.langfuse.host??``})})}),(0,Y.jsx)(Q,{label:_(),checked:m.langfuse.enabled??!0,onChange:e=>{b(`langfuse`,`enabled`,e),D(`langfuse`,{enabled:e})}})]}),(0,Y.jsxs)(X,{title:`Opik`,status:e.opik.configured?e.opik.enabled?(0,Y.jsx)(K,{variant:`secondary`,children:x()}):(0,Y.jsx)(K,{variant:`outline`,children:v()}):(0,Y.jsx)(K,{variant:`outline`,children:y()}),note:ne(),children:[(0,Y.jsx)(Z,{label:ue(),children:(0,Y.jsx)(q,{value:m.opik.baseUrl??``,placeholder:e.opik.effectiveBaseUrl,onChange:e=>b(`opik`,`baseUrl`,e.target.value),onBlur:()=>D(`opik`,{baseUrl:m.opik.baseUrl??``})})}),(0,Y.jsx)(Z,{label:le(),children:(0,Y.jsx)(q,{value:m.opik.workspace??``,placeholder:e.opik.effectiveWorkspace||d(),onChange:e=>b(`opik`,`workspace`,e.target.value),onBlur:()=>D(`opik`,{workspace:m.opik.workspace??``})})}),(0,Y.jsx)(Q,{label:_(),checked:m.opik.enabled??!0,onChange:e=>{b(`opik`,`enabled`,e),D(`opik`,{enabled:e})}})]}),(0,Y.jsxs)(X,{title:`OpenTelemetry (OTLP)`,status:e.otlp.configured?e.otlp.enabled?(0,Y.jsx)(K,{variant:`secondary`,children:x()}):(0,Y.jsx)(K,{variant:`outline`,children:v()}):(0,Y.jsx)(K,{variant:`outline`,children:C()}),note:N(),children:[(0,Y.jsx)(Z,{label:V(),children:(0,Y.jsx)(q,{value:m.otlp.endpoint??``,placeholder:e.otlp.effectiveEndpoint||`https://otlp.example.com/v1/traces`,onChange:e=>b(`otlp`,`endpoint`,e.target.value),onBlur:()=>D(`otlp`,{endpoint:m.otlp.endpoint??``})})}),(0,Y.jsx)(Ee,{headersSet:e.otlp.headersSet}),(0,Y.jsx)(Q,{label:_(),checked:m.otlp.enabled??!0,onChange:e=>{b(`otlp`,`enabled`,e),D(`otlp`,{enabled:e})}})]}),(0,Y.jsxs)(X,{title:o(),status:(0,Y.jsx)(K,{variant:`outline`,children:f()}),note:_e(),children:[(0,Y.jsx)(Z,{label:g(),children:(0,Y.jsx)($,{value:m.tts.auto??`off`,options:[[`off`,p()],[`always`,te()],[`inbound`,u()],[`tagged`,oe()]],onChange:e=>{b(`tts`,`auto`,e),D(`tts`,{auto:e})}})}),(0,Y.jsx)(Z,{label:ie(),children:(0,Y.jsx)($,{value:m.tts.provider??`openai`,options:[[`openai`,`OpenAI`],[`elevenlabs`,`ElevenLabs`],[`microsoft`,re()],[`azure`,`Azure Speech`],[`google`,`Google Gemini`]],onChange:e=>{b(`tts`,`provider`,e),D(`tts`,{provider:e})}})}),(0,Y.jsx)(Z,{label:P(),children:(0,Y.jsx)(q,{value:m.tts.model??``,placeholder:`eleven_multilingual_v2`,onChange:e=>b(`tts`,`model`,e.target.value),onBlur:()=>D(`tts`,{model:m.tts.model??``})})}),(0,Y.jsx)(Z,{label:a(),children:(0,Y.jsx)(q,{value:m.tts.voice??``,placeholder:F(),onChange:e=>b(`tts`,`voice`,e.target.value),onBlur:()=>D(`tts`,{voice:m.tts.voice??``})})})]}),(0,Y.jsxs)(X,{title:ae(),status:(0,Y.jsx)(K,{variant:`outline`,children:f()}),note:e.secrets.openai?c():l(),children:[(0,Y.jsx)(Q,{label:ce(),checked:m.talk.enabled??!1,onChange:e=>{b(`talk`,`enabled`,e),D(`talk`,{enabled:e})}}),(0,Y.jsx)(Z,{label:pe(),children:(0,Y.jsx)($,{value:m.talk.realtimeProvider??`openai`,options:[[`openai`,`OpenAI (gpt-realtime)`],[`google`,`Google`]],onChange:e=>{b(`talk`,`realtimeProvider`,e),D(`talk`,{realtimeProvider:e})}})}),(0,Y.jsx)(Z,{label:s(),children:(0,Y.jsx)(q,{value:m.talk.realtimeModel??``,placeholder:`gpt-realtime-2`,onChange:e=>b(`talk`,`realtimeModel`,e.target.value),onBlur:()=>D(`talk`,{realtimeModel:m.talk.realtimeModel??``})})}),(0,Y.jsx)(Z,{label:a(),children:(0,Y.jsx)(q,{value:m.talk.voice??``,placeholder:`cedar / marin`,onChange:e=>b(`talk`,`voice`,e.target.value),onBlur:()=>D(`talk`,{voice:m.talk.voice??``})})}),(0,Y.jsx)(Z,{label:se(),children:(0,Y.jsx)($,{value:m.talk.transport??`webrtc`,options:[[`webrtc`,me()],[`provider-websocket`,`Provider WebSocket`],[`gateway-relay`,`Gateway relay`]],onChange:e=>{b(`talk`,`transport`,e),D(`talk`,{transport:e})}})}),(0,Y.jsx)(Z,{label:w(),children:(0,Y.jsx)(q,{value:m.talk.speechLocale??``,placeholder:`fr-CA`,onChange:e=>b(`talk`,`speechLocale`,e.target.value),onBlur:()=>D(`talk`,{speechLocale:m.talk.speechLocale??``})})}),(0,Y.jsx)(Q,{label:ge(),checked:m.talk.interruptOnSpeech??!0,onChange:e=>{b(`talk`,`interruptOnSpeech`,e),D(`talk`,{interruptOnSpeech:e})}})]}),(0,Y.jsxs)(`section`,{className:`oc-int__section`,children:[(0,Y.jsxs)(`div`,{className:`oc-int__section-head`,children:[(0,Y.jsx)(`h3`,{className:`oc-uipa__h`,children:fe()}),(0,Y.jsx)(K,{variant:`outline`,children:S()})]}),(0,Y.jsxs)(`p`,{className:`oc-uipa__note`,children:[j(),(0,Y.jsx)(`code`,{children:` voicewake.get/set`}),`.`]})]}),(0,Y.jsx)(we,{title:M(),rows:e.cursors.map(e=>({...e,_id:e.vendor})),emptyHint:L(),columns:[{header:z(),cell:e=>(0,Y.jsx)(K,{variant:`secondary`,children:e.vendor}),sort:e=>e.vendor},{header:k(),cell:e=>e.lastAt>0?new Date(e.lastAt).toLocaleString(`fr-FR`):`—`,sort:e=>e.lastAt>0?e.lastAt:null},{header:T(),cell:e=>String(e.failureCount),sort:e=>e.failureCount},{header:de(),cell:e=>e.lastErrorStatus??`—`,sort:e=>e.lastErrorStatus??null},{header:I(),cell:e=>e.lastError??`—`,sort:e=>e.lastError??null}]})]})}function X({title:e,status:t,note:n,children:r}){return(0,Y.jsxs)(`section`,{className:`oc-int__section`,children:[(0,Y.jsxs)(`div`,{className:`oc-int__section-head`,children:[(0,Y.jsx)(`h3`,{className:`oc-uipa__h`,children:e}),t]}),n?(0,Y.jsx)(`p`,{className:`oc-uipa__note`,children:n}):null,(0,Y.jsx)(`div`,{className:`oc-int__fields`,children:r})]})}function Z({label:e,children:t}){return(0,Y.jsxs)(`label`,{className:`oc-int__field`,children:[(0,Y.jsx)(`span`,{className:`oc-int__field-label`,children:e}),t]})}function Q({label:e,checked:t,onChange:n}){return(0,Y.jsxs)(`label`,{className:`oc-int__toggle`,children:[(0,Y.jsx)(be,{checked:t,onCheckedChange:e=>n(e===!0)}),(0,Y.jsx)(`span`,{children:e})]})}function $({value:e,options:t,onChange:n}){return(0,Y.jsxs)(Ce,{value:e,onValueChange:n,children:[(0,Y.jsx)(ye,{size:`sm`,className:`w-full`,children:(0,Y.jsx)(ve,{})}),(0,Y.jsx)(xe,{children:t.map(([e,t])=>(0,Y.jsx)(Se,{value:e,children:t},e))})]})}function Ee({headersSet:e}){let t=A(O.integrations.otlpSecret.setOtlpHeaders),n=W(O.integrations.otlpSecret.clearOtlpHeaders),[i,a]=(0,J.useState)(``),[o,s]=(0,J.useState)(null),[c,l]=(0,J.useState)(!1),u=async()=>{l(!0),s(null);try{await t({headersJson:i}),a(``)}catch(e){s(e instanceof Error?e.message:String(e))}finally{l(!1)}};return(0,Y.jsxs)(Z,{label:R(),children:[(0,Y.jsx)(q,{value:i,placeholder:e?U():D(),onChange:e=>a(e.target.value)}),(0,Y.jsxs)(`div`,{className:`oc-int__otlp-headers-actions`,children:[(0,Y.jsx)(G,{size:`sm`,disabled:c||i.trim().length===0,onClick:()=>void u(),children:r()}),e?(0,Y.jsx)(G,{variant:`ghost`,size:`sm`,disabled:c,onClick:()=>void n({}),children:m()}):null]}),o?(0,Y.jsx)(`p`,{className:`oc-int__otlp-headers-error`,children:o}):null,(0,Y.jsx)(`p`,{className:`oc-uipa__note`,children:b()})]})}export{Te as IntegrationsTab};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Ab as r,Bb as i,Lb as a,Rb as o,au as s,cu as c,du as l,dx as u,fO as d,fu as f,gu as p,hu as m,iu as h,kb as g,lu as _,mu as v,ou as y,pu as b,ru as x,su as S,uu as C,yO as w,zb as T}from"./dist-DsBcH2-2.js";import{Mt as E,a as ee,jt as te,n as ne,ot as re,r as D}from"./index-DsOZBPOX.js";import{a as O,n as k,o as A,r as j,t as M}from"./card-DNbBWwxH.js";import{n as N,t as P}from"./TimeRangePicker-CPM9eoXo.js";var F=t(e(),1),I=n(),L=15,R=e=>String(Math.round(e));function z(){let e=w(d.me.getMe,{host:re})?.permissions?.includes(`traces.read`)??!1,t=w(d.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:u()}),(0,I.jsxs)(M,{children:[(0,I.jsxs)(O,{children:[(0,I.jsx)(A,{children:i()}),(0,I.jsx)(j,{children:o()})]}),(0,I.jsx)(k,{children:n.length<2?(0,I.jsx)(`p`,{className:`oc-admin__hint`,children:a()}):(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:[g(),` p50 `,R(l.cP50),` `,T()]}),(0,I.jsxs)(`span`,{children:[r(),` p50 `,R(l.aP50),` `,T()]})]}),(0,I.jsxs)(`svg`,{viewBox:`0 0 480 80`,className:`h-20 w-full`,preserveAspectRatio:`none`,role:`img`,"aria-label":i(),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:p(),unit:`/h`,group:`API`,isError:!1},{metric:`api.errors`,label:m(),unit:`/h`,group:`API`,isError:!0},{metric:`api.latency.avg_ms`,label:v(),unit:`ms`,group:`API`,isError:!1},{metric:`openclaw.ingest`,label:b(),unit:`/h`,group:`OpenClaw`,isError:!1},{metric:`chat.send`,label:f(),unit:`/h`,group:`Chat`,isError:!1},{metric:`assistant.stream.errors`,label:l(),unit:`/h`,group:`Assistant`,isError:!0}],H=V.length,U=[`API`,`OpenClaw`,`Chat`,`Assistant`],W=1e3,G=36e5;function K(e,t){let n=Math.max(1,Math.ceil((t-e)/G)),r=Math.min(n*H,W);return{rowLimit:r,buckets:Math.max(1,Math.floor(r/H))}}function q(){let e=E({from:`/settings/kpi`}),t=te({from:`/settings/kpi`}),n=D(e.from,e.to,ne,`now`),r=e=>void t({search:t=>({...t,...ee(e)})}),{from:i,to:a}=N(n),{rowLimit:o,buckets:s}=K(i,a),l=w(d.kpi.listKpis,{limit:o,filter:{from:i,to:a}}),u=(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>s&&e.set(t,n.slice(n.length-s));return e},[l,s]),f=(0,I.jsxs)(I.Fragment,{children:[(0,I.jsxs)(`p`,{className:`oc-admin__hint`,children:[C(),` `,(0,I.jsx)(`span`,{className:`oc-filter__window`,children:_()})]}),(0,I.jsx)(J,{value:n,onChange:r})]});return l===void 0?(0,I.jsxs)(I.Fragment,{children:[f,(0,I.jsx)(z,{}),(0,I.jsx)(`p`,{className:`oc-admin__hint`,children:c()})]}):l.length===0?(0,I.jsxs)(I.Fragment,{children:[f,(0,I.jsx)(z,{}),(0,I.jsx)(`p`,{className:`oc-admin__hint`,children:S()})]}):(0,I.jsxs)(I.Fragment,{children:[f,(0,I.jsx)(z,{}),U.map(e=>{let t=V.filter(t=>t.group===e);return t.some(e=>(u.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:u.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:y({value:$(n.bucket)})}):(0,I.jsx)(`span`,{className:`oc-kpi__muted`,children:s()}),(0,I.jsx)(`span`,{className:`oc-kpi__muted`,children:h({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":x({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{$w as r,AD as i,Bw as a,CD as o,DD as s,ED as c,Fw as l,Gw as u,Hw as d,Iw as f,Jw as p,Kw as m,Lw as ee,Mw as h,Nw as g,OD as _,PD as te,Pw as ne,Qw as re,Rw as ie,SD as ae,TD as oe,Uw as se,Vw as v,Ww as ce,Xw as le,Yw as ue,Zw as de,aT as fe,bD as pe,cT as y,dT as b,eT as x,fO as S,iT as C,jD as w,kD as T,lT as E,nT as D,oT as O,p_ as k,qw as A,rT as j,sT as M,tT as N,uT as P,vO as F,wD as I,xD as L,yD as R,yO as z,zD as B,zw as V}from"./dist-DsBcH2-2.js";import{t as H}from"./button-9c1aLUeO.js";import{A as me,C as he,O as ge,S as _e,Z as U,_ as W,b as ve,ot as G,x as K,y as ye}from"./index-DsOZBPOX.js";var q=t(e(),1),J=[{id:`messages`,label:()=>b()},{id:`composer`,label:()=>P()},{id:`sidebar`,label:()=>E()},{id:`other`,label:()=>y()}],Y={showSource:{category:`messages`,label:()=>M(),help:()=>O()},showReport:{category:`messages`,label:()=>fe(),help:()=>C()},copyAssistant:{category:`messages`,label:()=>j()},copyUser:{category:`messages`,label:()=>D()},showDelete:{category:`messages`,label:()=>N()},showTools:{category:`messages`,label:()=>x(),help:()=>r()},voiceInput:{category:`composer`,label:()=>re(),help:()=>de()},showChatAge:{category:`sidebar`,label:()=>le(),help:()=>ue()},showChatProvider:{category:`sidebar`,label:()=>p(),help:()=>A()}};function X(e){return e.toLowerCase().normalize(`NFD`).replace(/\p{Diacritic}/gu,``)}function be(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 xe=[`showSource`,`showReport`,`copyAssistant`,`copyUser`,`showDelete`,`showTools`,`voiceInput`,`showChatAge`,`showChatProvider`],Se={voiceInput:`voiceInput`};function Ce(e){return xe.includes(e)}function Z(e){return e===`admin`}function we(e){return e===!0?`on`:e===!1?`off`:`inherit`}function Q(e){return e===`on`?!0:e===`off`?!1:null}function Te(e){return Ce(e)?Se[e]:void 0}var $=n(),Ee={voiceInput:()=>f()};function De({prefKey:e,ui:t}){let n=F(S.admin.setUiPrefDefault),r=F(S.admin.setFeatureEnabled),i=Te(e),o=i?Ee[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:a()}),(0,$.jsxs)(ye,{value:we(t.defaults[e]),onValueChange:t=>void n({key:e,value:Q(t)}),children:[(0,$.jsx)(_e,{size:`sm`,className:`w-36`,children:(0,$.jsx)(he,{})}),(0,$.jsxs)(ve,{children:[(0,$.jsx)(K,{value:`on`,children:ne()}),(0,$.jsx)(K,{value:`off`,children:g()}),(0,$.jsx)(K,{value:`inherit`,children:h()})]})]}),i?(0,$.jsxs)(`span`,{className:`oc-prefs__gov-gate`,children:[(0,$.jsx)(W,{checked:t.featuresEnabled[i]===!0,onCheckedChange:e=>void r({key:i,enabled:e===!0}),"aria-label":V()}),V()]}):null]}),o?(0,$.jsx)(`span`,{className:`oc-prefs__gov-help`,children:o}):null]})}function Oe(){let[e,t]=(0,q.useState)(``),[n,r]=(0,q.useState)(!1),i=z(S.me.getMe,{host:G}),a=i?.ui,o=Z(i?.role)&&n,s=F(S.me.setUiPref).withOptimisticUpdate(ge),c=(0,q.useMemo)(()=>a?be(Object.keys(a.effective),e):[],[a,e]);return a?(0,$.jsxs)(`div`,{className:`oc-prefs-panel`,children:[Z(i?.role)?(0,$.jsxs)(`label`,{className:`oc-prefs__gov-toggle`,children:[(0,$.jsx)(W,{checked:n,onCheckedChange:e=>r(e===!0),"aria-label":v()}),v()]}):null,o?(0,$.jsxs)(`div`,{className:`oc-prefs__gov-head`,children:[(0,$.jsx)(`p`,{children:ie()}),(0,$.jsx)(`p`,{children:ee()}),(0,$.jsx)(`p`,{children:l()})]}):null,(0,$.jsx)(U,{value:e,onChange:e=>t(e.target.value),placeholder:m(),"aria-label":m(),className:`mb-2`}),c.length===0?(0,$.jsx)(`div`,{className:`oc-prefs__empty`,children:u()}):(0,$.jsx)(`div`,{className:`oc-prefs`,children:c.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=a.locked[e],c=a.effective[e],l=a.userOverrides[e]!==void 0;return(0,$.jsxs)(`div`,{className:`oc-prefs__row${i?` is-locked`:``}${l&&!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:ce()}):l?null:(0,$.jsx)(`span`,{className:`oc-prefs__def`,children:se()})]}),r?(0,$.jsx)(`span`,{className:`oc-prefs__help`,children:r}):null]}),(0,$.jsxs)(`div`,{className:`oc-prefs__ctl`,children:[!i&&l?(0,$.jsx)(`button`,{type:`button`,className:`oc-prefs__reset`,onClick:()=>void s({key:e,value:null}),children:d()}):null,(0,$.jsx)(W,{checked:c,disabled:i,onCheckedChange:t=>void s({key:e,value:t===!0}),"aria-label":n})]}),o?(0,$.jsx)(De,{prefKey:e,ui:a}):null]},e)})]},e.id))})]}):(0,$.jsx)(`div`,{className:`oc-prefs__empty`,children:B()})}function ke(){let e=z(S.me.getMe,{host:G}),t=F(S.me.setLocale),n=F(S.me.setMyName),r=me(),a=e?.locale??`default`,l=e?.name??``,[u,d]=(0,q.useState)(null),f=u??l,p=f.trim()!==l.trim();async function m(){try{await n({name:f}),d(null),r.success(s())}catch(e){r.error(c(),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:w()}),(0,$.jsx)(`p`,{className:`oc-show__desc`,children:i()})]}),(0,$.jsxs)(`div`,{className:`oc-show__row`,children:[(0,$.jsx)(U,{className:`max-w-xs`,value:f,maxLength:120,placeholder:T(),onChange:e=>d(e.target.value),onKeyDown:e=>{e.key===`Enter`&&p&&(e.preventDefault(),m())}}),(0,$.jsx)(H,{size:`sm`,disabled:!p,onClick:()=>void m(),children:k()})]}),(0,$.jsx)(`p`,{className:`oc-show__desc`,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:oe()}),(0,$.jsx)(`p`,{className:`oc-show__desc`,children:I()})]}),(0,$.jsx)(`div`,{className:`oc-show__row`,children:[`fr`,`en`,`default`].map(e=>(0,$.jsx)(H,{variant:a===e?`default`:`outline`,size:`sm`,onClick:()=>void t({locale:e==="default"?null:e}),children:e===`fr`?pe():e===`en`?R():te()},e))}),(0,$.jsx)(`p`,{className:`oc-show__desc`,children:o()})]}),(0,$.jsxs)(`section`,{className:`oc-show__section`,children:[(0,$.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,$.jsx)(`h2`,{className:`oc-show__title`,children:ae()}),(0,$.jsx)(`p`,{className:`oc-show__desc`,children:L()})]}),(0,$.jsx)(Oe,{})]})]})}export{ke as PreferencesTab};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Ad as r,B as i,Cd as a,Dd as o,Ed as s,Fd as c,H as l,Id as u,Kd as d,Ld as f,Md as p,Nd as m,Od as h,Pd as g,Rd as _,Sd as v,Td as y,U as b,V as x,bd as S,
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Ad as r,B as i,Cd as a,Dd as o,Ed as s,Fd as c,H as l,Id as u,Kd as d,Ld as f,Md as p,Nd as m,Od as h,Pd as g,Rd as _,Sd as v,Td as y,U as b,V as x,bd as S,fO as C,jd as w,kd as T,qd as E,vO as D,wd as O,xd as k,yO as A,z as j,zd as M}from"./dist-DsBcH2-2.js";import{d as N,f as P,i as F,l as I,n as L,r as R,t as ee,u as z}from"./FieldLabel-BYZOkwDx.js";import{t as B}from"./button-9c1aLUeO.js";import{A as V,C as H,S as U,_ as W,b as G,x as K,y as q}from"./index-DsOZBPOX.js";/* empty css */var J=t(e(),1),Y=n(),X={media_delivery:{label:g,help:m},documentary_fetch:{label:p,help:w},inbound_files:{label:r,help:T},history_summary:{label:b,help:l}},Z={outboundDir:`/home/node/.openclaw/media/outbound`,references:`- gdrive/1a2b3c4d5e6f7890abcd
|
|
2
2
|
- gdrive/0f9e8d7c6b5a4321dcba`,files:`- /home/node/.openclaw/media/inbound/rapport.pdf (124800 o, application/pdf)`,previous_summary:`Projet Alpha : budget 40 000 EUR ; choix du serveur en cours.`,new_messages:`Utilisateur : Compare OVH et Scaleway.
|
|
3
|
-
Assistant : Comparaison en cours.`,max_chars:`6000`},Q={outboundDir:v,references:
|
|
3
|
+
Assistant : Comparaison en cours.`,max_chars:`6000`},Q={outboundDir:v,references:k,files:S,previous_summary:x,new_messages:i,max_chars:j};function $(){let e=A(C.admin.listInstances,{}),[t,n]=(0,J.useState)(null);if(e===void 0)return(0,Y.jsx)(`div`,{className:`oc-settings__tab-loading`,"aria-busy":`true`});if(e.length===0)return(0,Y.jsx)(`div`,{className:`oc-injtab`,children:(0,Y.jsx)(`p`,{className:`oc-admin__hint`,children:o()})});let r=e.find(e=>e._id===t)??e[0];return(0,Y.jsxs)(`div`,{className:`oc-injtab`,children:[(0,Y.jsxs)(`div`,{className:`oc-injtab__head`,children:[(0,Y.jsx)(L,{label:M(),help:_()}),(0,Y.jsxs)(`label`,{className:`oc-injtab__picker`,children:[(0,Y.jsx)(`span`,{children:h()}),(0,Y.jsxs)(q,{value:r._id,onValueChange:e=>n(e),children:[(0,Y.jsx)(U,{size:`sm`,className:`min-w-44`,children:(0,Y.jsx)(H,{})}),(0,Y.jsx)(G,{children:e.map(e=>(0,Y.jsx)(K,{value:e._id,children:e.displayName??e.name},e._id))})]})]})]}),(0,Y.jsx)(te,{instance:r},r._id)]})}function te({instance:e}){let t=D(C.admin.upsertInstanceConfig),n=V(),r=e.config??{},[i,a]=(0,J.useState)(()=>F(r)),[o,s]=(0,J.useState)(!1),c=i.promptInjections,l=(e,t)=>a({...i,promptInjections:{...c,[e]:{...c[e],...t}}});async function u(){s(!0);try{await t({instanceId:e._id,config:R(i,r)})}catch(e){n.error(d(),e)}finally{s(!1)}}return(0,Y.jsxs)(`div`,{className:`oc-injtab__body`,children:[z.map(e=>(0,Y.jsx)(ne,{injKey:e,def:I[e],i18n:X[e],row:c[e]??{enabled:!0,template:I[e].defaultTemplate},onChange:t=>l(e,t)},e)),(0,Y.jsx)(`div`,{className:`oc-injtab__actions`,children:(0,Y.jsx)(B,{size:`sm`,onClick:()=>void u(),disabled:o,children:E()})})]})}function ne({injKey:e,def:t,i18n:n,row:r,onChange:i}){let[o,l]=(0,J.useState)(!1),d=r.template.trim()!==t.defaultTemplate,p=t.togglable&&!r.enabled,m=Object.fromEntries(t.placeholders.map(e=>[e,Z[e]??`{${e}}`])),h=N(e,r),g=h?P(h,m):``;return(0,Y.jsxs)(`section`,{className:`oc-injcard`,children:[(0,Y.jsxs)(`div`,{className:`oc-injcard__head`,children:[t.togglable?(0,Y.jsxs)(`label`,{className:`oc-field--row`,children:[(0,Y.jsx)(W,{checked:r.enabled,onCheckedChange:e=>i({enabled:e===!0})}),(0,Y.jsx)(L,{label:n.label(),help:n.help()})]}):(0,Y.jsx)(L,{label:n.label(),help:n.help()}),d&&(0,Y.jsx)(`span`,{className:`oc-injection__badge`,children:u()})]}),(0,Y.jsx)(`textarea`,{className:`oc-injcard__text`,value:r.template,disabled:p,rows:8,spellCheck:!1,onChange:e=>i({template:e.target.value})}),(0,Y.jsxs)(`div`,{className:`oc-injection__foot`,children:[(0,Y.jsxs)(`div`,{className:`oc-injcard__phs`,children:[(0,Y.jsx)(`span`,{className:`oc-injection__ph`,children:c()}),t.placeholders.map(e=>(0,Y.jsxs)(`span`,{className:`oc-injcard__ph-chip`,children:[(0,Y.jsx)(`code`,{children:`{${e}}`}),(0,Y.jsx)(ee,{text:(Q[e]??(()=>e))()})]},e))]}),(0,Y.jsxs)(`div`,{className:`oc-injcard__btns`,children:[(0,Y.jsx)(B,{variant:`ghost`,size:`sm`,onClick:()=>l(e=>!e),children:o?y():s()}),d&&(0,Y.jsx)(B,{variant:`ghost`,size:`sm`,onClick:()=>i({template:t.defaultTemplate}),children:f()})]})]}),o&&(0,Y.jsx)(`div`,{className:`oc-injcard__preview`,children:g?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`pre`,{className:`oc-injcard__previewtext`,children:g}),(0,Y.jsx)(`span`,{className:`oc-injection__ph`,children:O()})]}):(0,Y.jsx)(`span`,{className:`oc-injection__ph`,children:a()})})]})}export{$ as PromptInjectionsTab};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Ah as r,Ch as i,Dh as a,Eh as o,Gm as ee,Hm as s,Jm as c,Km as te,Oh as l,Sh as u,Th as d,Um as f,Wm as ne,Xm as p,Ym as m,_h as h,ah as g,bh as _,ch as v,dh as y,fO as b,fh as x,gh as re,hh as ie,ih as ae,jh as S,kh as C,lh as w,mh as T,nh as E,oh as D,ph as O,qm as k,rh as A,sh as j,uh as M,vO as N,vh as P,wh as F,xh as I,yO as L,yh as R}from"./dist-DsBcH2-2.js";import{t as z}from"./button-9c1aLUeO.js";import{A as B,X as V,Z as H,_ as U,j as W,m as G,xt as K}from"./index-DsOZBPOX.js";import{t as q}from"./roleDescriptions-eZmrq1l0.js";var J=t(e(),1),Y=n(),X=[{group:()=>S(),keys:[{key:`traces.read`,label:()=>o()},{key:`traces.read.content`,label:()=>d(),phi:!0},{key:`traces.write`,label:()=>F()}]},{group:()=>r(),keys:[{key:`kpi.read`,label:()=>o()},{key:`kpi.write`,label:()=>F()}]},{group:()=>C(),keys:[{key:`openclaw.query`,label:()=>i()},{key:`anomalies.read`,label:()=>u()},{key:`anomalies.report`,label:()=>I()}]},{group:()=>l(),keys:[{key:`chats.read`,label:()=>o()},{key:`selfheal`,label:()=>R()}]},{group:()=>a(),keys:[{key:`admin.manage`,label:()=>_()}]}],oe=X.flatMap(e=>e.keys.map(e=>e.key));function Z(e){return e.includes(`*`)}var Q={key:``,name:``,description:``};function $(){let e=L(b.apiKeys.listRoles,{}),t=N(b.apiKeys.createRole),n=N(b.apiKeys.ensureRolesSeeded),r=N(b.apiKeys.updateRolePermissions).withOptimisticUpdate((e,{roleId:t,permissions:n})=>{let r=e.getQuery(b.apiKeys.listRoles,{});r&&e.setQuery(b.apiKeys.listRoles,{},r.map(e=>e._id===t?{...e,permissions:n}:e))}),i=W(),a=B(),[o,l]=(0,J.useState)(!1),[u,d]=(0,J.useState)(Q),[_,S]=(0,J.useState)(new Set);(0,J.useEffect)(()=>{n({}).catch(e=>{a.error(h(),e)})},[n,a]);let C=e??[];async function F(e,t){if(Z(e.permissions)||_.has(e._id))return;let n=e.permissions.includes(t)?e.permissions.filter(e=>e!==t):[...e.permissions,t];if(!(e.builtin&&!await i({title:re({name:e.name}),description:ie(),confirmLabel:T()}))){S(t=>new Set(t).add(e._id));try{await r({roleId:e._id,permissions:n})}catch(e){a.error(O(),e)}finally{S(t=>{let n=new Set(t);return n.delete(e._id),n})}}}async function I(){try{await t({key:u.key,name:u.name,description:u.description||void 0,permissions:[]}),d(Q),l(!1)}catch(e){a.error(x(),e)}}let R=e===void 0,$=!R&&C.length===0;return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(`p`,{className:`oc-admin__hint`,children:[y(),` `,(0,Y.jsx)(`code`,{children:`admin`}),` `,M(),` `,(0,Y.jsx)(`code`,{children:`traces.read.content`}),` `,w()]}),(0,Y.jsxs)(`div`,{className:`oc-dt`,children:[(0,Y.jsxs)(`div`,{className:`oc-dt__bar`,children:[(0,Y.jsx)(`h2`,{className:`oc-dt__title`,children:v()}),(0,Y.jsx)(`div`,{className:`oc-dt__bar-actions`,children:(0,Y.jsx)(z,{size:`sm`,onClick:()=>{d(Q),l(!0)},children:j()})})]}),R?(0,Y.jsx)(`p`,{className:`oc-admin__hint`,children:D()}):$?(0,Y.jsx)(`p`,{className:`oc-admin__hint`,children:g()}):(0,Y.jsx)(`div`,{className:`oc-matrix__scroll`,children:(0,Y.jsxs)(`table`,{className:`oc-matrix`,children:[(0,Y.jsxs)(`thead`,{children:[(0,Y.jsxs)(`tr`,{children:[(0,Y.jsx)(`th`,{className:`oc-matrix__corner`,rowSpan:2,children:ae()}),X.map(e=>(0,Y.jsx)(`th`,{className:`oc-matrix__group`,colSpan:e.keys.length,children:e.group()},e.group()))]}),(0,Y.jsx)(`tr`,{children:X.flatMap(e=>e.keys.map(e=>(0,Y.jsxs)(`th`,{className:`oc-matrix__perm`,title:e.phi?P({key:e.key}):e.key,children:[e.label(),e.phi?(0,Y.jsx)(`span`,{className:`oc-matrix__phi`,children:` ⚠`}):null]},e.key)))})]}),(0,Y.jsx)(`tbody`,{children:C.map(e=>{let t=Z(e.permissions),n=_.has(e._id);return(0,Y.jsxs)(`tr`,{children:[(0,Y.jsxs)(`th`,{className:`oc-matrix__rolecell`,children:[(0,Y.jsxs)(`div`,{className:`oc-matrix__rolename`,children:[(0,Y.jsx)(`span`,{children:e.name}),(0,Y.jsx)(`code`,{className:`oc-matrix__rolekey`,children:e.key}),e.builtin?(0,Y.jsxs)(V,{variant:`outline`,className:`gap-1`,children:[(0,Y.jsx)(K,{}),` `,A()]}):(0,Y.jsx)(V,{variant:`secondary`,children:E()})]}),q(e)?(0,Y.jsx)(`p`,{className:`oc-matrix__roledesc`,children:q(e)}):null]}),oe.map(r=>(0,Y.jsx)(`td`,{className:`oc-matrix__cell`,children:(0,Y.jsx)(U,{checked:t||e.permissions.includes(r),disabled:t||n,"aria-label":`${e.key} · ${r}`,title:t?p():n?m():r,onCheckedChange:()=>void F(e,r)})},r))]},e.key)})})]})})]}),(0,Y.jsx)(G,{open:o,onOpenChange:l,title:c(),description:k(),canSubmit:!!(u.key&&u.name),onSubmit:I,submitLabel:te(),children:(0,Y.jsxs)(`div`,{className:`oc-form`,children:[(0,Y.jsxs)(`label`,{className:`oc-field`,children:[(0,Y.jsx)(`span`,{className:`oc-field__label`,children:ee()}),(0,Y.jsx)(H,{value:u.key,placeholder:ne(),onChange:e=>d({...u,key:e.target.value})})]}),(0,Y.jsxs)(`label`,{className:`oc-field`,children:[(0,Y.jsx)(`span`,{className:`oc-field__label`,children:f()}),(0,Y.jsx)(H,{value:u.name,onChange:e=>d({...u,name:e.target.value})})]}),(0,Y.jsxs)(`label`,{className:`oc-field`,children:[(0,Y.jsx)(`span`,{className:`oc-field__label`,children:s()}),(0,Y.jsx)(H,{value:u.description,onChange:e=>d({...u,description:e.target.value})})]})]})})]})}export{$ as RolesTab};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$C as r,AC as i,Aw as ee,BC as te,CC as a,Cw as ne,DC as o,Dw as re,EC as s,Ew as c,FC as ie,GC as ae,HC as oe,IC as se,JC as ce,KC as le,LC as ue,MC as l,NC as u,OC as d,Ow as de,PC as f,QC as fe,RC as pe,SC as p,Sw as me,TC as m,Tw as h,UC as he,VC as ge,WC as _e,XC as ve,YC as ye,ZC as be,_C as g,_w as xe,aw as Se,bC as _,bw as Ce,cw as we,dC as v,dw as Te,ew as Ee,fC as y,fO as b,fw as De,gC as x,gO as Oe,gw as ke,hC as Ae,hw as je,iw as Me,jC as Ne,jw as Pe,kC as S,kw as Fe,lw as Ie,mC as C,mw as Le,nw as Re,ow as ze,pC as w,pw as Be,qC as Ve,rw as He,sw as Ue,tw as We,uw as Ge,vC as T,vO as E,vw as Ke,wC as D,ww as qe,xC as O,xw as Je,yC as k,yO as A,yw as Ye,zC as Xe}from"./dist-DsBcH2-2.js";import{n as Ze}from"./dist-DM5LkQcA.js";import{i as Qe}from"./dist-BMI7wyIc.js";import{t as j}from"./button-9c1aLUeO.js";import{$ as $e,A as et,At as tt,C as M,Dt as N,Mt as nt,Q as P,S as F,X as I,Z as L,b as R,et as z,j as rt,jt as it,m as at,nt as B,rt as V,tt as H,x as U,y as W}from"./index-DsOZBPOX.js";import{t as ot}from"./FilterBar-DWv8wqqC.js";import{t as st}from"./DataTableShell-VIRQvS8e.js";import{t as ct}from"./roleDescriptions-eZmrq1l0.js";var G=t(e(),1),K=n(),q=[{value:`never`,label:()=>g(),days:null},{value:`30`,label:()=>x(),days:30},{value:`90`,label:()=>Ae(),days:90}],lt=720*60*60*1e3,J=`__all__`,Y={name:``,roleKey:``,description:``};function X(){let e=nt({from:`/settings/serviceAccounts`}),t=it({from:`/settings/serviceAccounts`}),n=e.q??``,i=e.status??J,[a,o]=(0,G.useState)(J),s=e=>void t({search:t=>({...t,q:e||void 0}),replace:!0}),l=e=>void t({search:t=>({...t,status:e===J?void 0:e})}),u=A(b.apiKeys.listServiceAccounts,{filter:{q:n||void 0,role:a===J?void 0:a,disabled:i===J?void 0:i===`disabled`}}),d=A(b.apiKeys.listKeys,{}),f=A(b.apiKeys.listRoles,{}),p=E(b.apiKeys.createServiceAccount),m=E(b.apiKeys.updateServiceAccount),g=E(b.apiKeys.deleteServiceAccount),_=Oe(b.apiKeys.mintApiKey),v=E(b.apiKeys.revokeApiKey),y=rt(),x=et(),Ae=n!==``||a!==J||i!==J;function Ne(){o(J),t({search:{},replace:!0})}let[S,C]=(0,G.useState)(!1),[w,T]=(0,G.useState)(Y),[D,O]=(0,G.useState)(null),[k,Ze]=(0,G.useState)(new Set),[$e,N]=(0,G.useState)(null),P=(0,G.useRef)(!1),[z,B]=(0,G.useState)(new Set),[V,H]=(0,G.useState)({}),[lt,X]=(0,G.useState)(null),Z=(0,G.useMemo)(()=>{let e=new Map;for(let t of d??[]){let n=e.get(t.serviceAccountId)??[];n.push(t),e.set(t.serviceAccountId,n)}return e},[d]);function Q(e){Ze(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})}async function ft(){try{D?(await m({serviceAccountId:D,name:w.name,roleKey:w.roleKey,description:w.description}),x.success(ye())):await p({name:w.name,roleKey:w.roleKey,description:w.description||void 0}),T(Y),O(null),C(!1)}catch(e){x.error(D?ve():be(),e)}}function pt(e){T({name:e.name,roleKey:e.roleKey,description:e.description??``}),O(e._id),C(!0)}async function $(e){if(P.current)return;P.current=!0;let t=V[e._id]??`never`,n=q.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});X({accountName:e.name,plaintext:t.plaintext,prefix:t.prefix,lastFour:t.lastFour})}catch(e){x.error(ce(),e)}finally{P.current=!1,N(null)}}async function mt(e){if(await y({title:Ve(),description:(0,K.jsxs)(K.Fragment,{children:[le(),` `,(0,K.jsx)(`span`,{className:`font-mono`,children:e.name}),` `,ae(),` `,(0,K.jsx)(`strong`,{children:_e()}),` `,he()]}),confirmWord:e.name,confirmLabel:oe(),destructive:!0}))try{await g({serviceAccountId:e._id}),x.success(ge(),e.name)}catch(e){x.error(te(),e)}}async function ht(e){if(await y({title:Xe(),description:(0,K.jsxs)(K.Fragment,{children:[pe(),` `,(0,K.jsxs)(`span`,{className:`font-mono`,children:[e.prefix,`…`,e.lastFour]}),` `,ue()]}),confirmLabel:se(),destructive:!0})&&!z.has(e._id)){B(t=>new Set(t).add(e._id));try{await v({keyId:e._id})}catch(e){x.error(ie(),e)}finally{B(t=>{let n=new Set(t);return n.delete(e._id),n})}}}return(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`p`,{className:`oc-admin__hint`,children:Pe()}),(0,K.jsxs)(ot,{q:n,onQChange:s,searchPlaceholder:ee(),onReset:Ne,canReset:Ae,children:[(0,K.jsxs)(W,{value:a,onValueChange:o,children:[(0,K.jsx)(F,{size:`sm`,className:`w-40`,children:(0,K.jsx)(M,{placeholder:Fe()})}),(0,K.jsxs)(R,{children:[(0,K.jsx)(U,{value:J,children:de()}),(f??[]).map(e=>(0,K.jsx)(U,{value:e.key,children:e.key},e._id))]})]}),(0,K.jsxs)(W,{value:i,onValueChange:l,children:[(0,K.jsx)(F,{size:`sm`,className:`w-36`,children:(0,K.jsx)(M,{})}),(0,K.jsxs)(R,{children:[(0,K.jsx)(U,{value:J,children:re()}),(0,K.jsx)(U,{value:`active`,children:c()}),(0,K.jsx)(U,{value:`disabled`,children:h()})]})]})]}),(0,K.jsx)(st,{title:qe(),rows:u,addLabel:ne(),onAdd:()=>{T(Y),O(null),C(!0)},emptyHint:me(),isExpanded:e=>k.has(e._id),renderExpanded:e=>(0,K.jsx)(ut,{account:e,keys:Z.get(e._id)??[],onRevoke:ht,revoking:z}),rowActions:e=>[{label:Ke(),onSelect:()=>pt(e)},{label:Je(),onSelect:()=>void $(e)},{label:k.has(e._id)?Ce():Ye(),onSelect:()=>Q(e._id)},{label:xe(),variant:`destructive`,onSelect:()=>void mt(e)}],columns:[{header:``,className:`w-8`,cell:e=>(0,K.jsx)(j,{variant:`ghost`,size:`icon-sm`,"aria-label":k.has(e._id)?ke():je(),onClick:()=>Q(e._id),children:k.has(e._id)?(0,K.jsx)(Qe,{}):(0,K.jsx)(tt,{})})},{header:Le(),sort:e=>e.name,cell:e=>(0,K.jsxs)(`div`,{className:`flex flex-col`,children:[(0,K.jsx)(`span`,{children:e.name}),e.description?(0,K.jsx)(`span`,{className:`text-muted-foreground text-xs`,children:e.description}):null]})},{header:Be(),sort:e=>e.roleKey,cell:e=>(0,K.jsx)(I,{variant:`secondary`,children:e.roleKey})},{header:De(),sort:e=>+!!e.disabled,cell:e=>e.disabled?(0,K.jsx)(I,{variant:`destructive`,children:h()}):(0,K.jsx)(I,{variant:`outline`,children:c()})},{header:Te(),cell:e=>(0,K.jsxs)(W,{value:V[e._id]??`never`,onValueChange:t=>H(n=>({...n,[e._id]:t})),children:[(0,K.jsx)(F,{size:`sm`,className:`w-32`,children:(0,K.jsx)(M,{})}),(0,K.jsx)(R,{children:q.map(e=>(0,K.jsx)(U,{value:e.value,children:e.label()},e.value))})]})},{header:Ge(),sort:e=>(Z.get(e._id)??[]).filter(e=>!e.disabled).length,cell:e=>{let t=(Z.get(e._id)??[]).filter(e=>!e.disabled).length;return(0,K.jsx)(`span`,{className:`oc-sa__keycount`,children:$e===e._id?Ie():we({count:t})})}}]}),(0,K.jsx)(at,{open:S,onOpenChange:e=>{C(e),e||O(null)},title:D?Ue():Me(),description:D?ze():He(),canSubmit:!!(w.name&&w.roleKey),onSubmit:ft,submitLabel:D?Se():Re(),children:(0,K.jsxs)(`div`,{className:`oc-form`,children:[(0,K.jsxs)(`label`,{className:`oc-field`,children:[(0,K.jsx)(`span`,{className:`oc-field__label`,children:We()}),(0,K.jsx)(L,{value:w.name,onChange:e=>T({...w,name:e.target.value})})]}),(0,K.jsxs)(`label`,{className:`oc-field`,children:[(0,K.jsx)(`span`,{className:`oc-field__label`,children:Ee()}),(0,K.jsxs)(W,{value:w.roleKey||void 0,onValueChange:e=>T({...w,roleKey:e}),children:[(0,K.jsx)(F,{className:`w-full`,children:(0,K.jsx)(M,{placeholder:r()})}),(0,K.jsx)(R,{children:(f??[]).map(e=>(0,K.jsxs)(U,{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,K.jsx)(`span`,{className:`text-muted-foreground text-xs`,children:t}):null})()]}),(0,K.jsxs)(`label`,{className:`oc-field`,children:[(0,K.jsx)(`span`,{className:`oc-field__label`,children:fe()}),(0,K.jsx)(L,{value:w.description,onChange:e=>T({...w,description:e.target.value})})]})]})}),(0,K.jsx)(dt,{minted:lt,onClose:()=>X(null)})]})}function ut({account:e,keys:t,onRevoke:n,revoking:r}){return(0,K.jsxs)(`div`,{className:`oc-sa__keys`,children:[(0,K.jsxs)(`div`,{className:`oc-sa__keys-head`,children:[f(),` `,(0,K.jsx)(`span`,{className:`font-medium`,children:e.name})]}),t.length===0?(0,K.jsx)(`p`,{className:`oc-admin__hint`,children:u()}):(0,K.jsxs)(`table`,{className:`oc-sa__keytable`,children:[(0,K.jsx)(`thead`,{children:(0,K.jsxs)(`tr`,{children:[(0,K.jsx)(`th`,{children:l()}),(0,K.jsx)(`th`,{children:Ne()}),(0,K.jsx)(`th`,{children:i()}),(0,K.jsx)(`th`,{children:S()}),(0,K.jsx)(`th`,{children:d()}),(0,K.jsx)(`th`,{children:o()}),(0,K.jsx)(`th`,{})]})}),(0,K.jsx)(`tbody`,{children:t.map(t=>(0,K.jsxs)(`tr`,{children:[(0,K.jsx)(`td`,{children:(0,K.jsxs)(`code`,{className:`oc-sa__keyid`,children:[t.prefix,`…`,t.lastFour]})}),(0,K.jsx)(`td`,{children:(0,K.jsx)(I,{variant:`secondary`,children:e.roleKey})}),(0,K.jsx)(`td`,{children:Z(t.createdAt)}),(0,K.jsx)(`td`,{className:Q(t.lastUsedAt)?`oc-sa__stale`:``,children:ft(t.lastUsedAt)}),(0,K.jsx)(`td`,{children:pt(t.expiresAt)}),(0,K.jsx)(`td`,{children:$(t)}),(0,K.jsx)(`td`,{className:`text-right`,children:t.disabled?null:(0,K.jsx)(j,{variant:`destructive`,size:`sm`,disabled:r.has(t._id),onClick:()=>n(t),children:r.has(t._id)?s():m()})})]},t._id))})]})]})}function dt({minted:e,onClose:t}){let[n,r]=(0,G.useState)(!1);async function i(){if(e)try{await navigator.clipboard.writeText(e.plaintext),r(!0),window.setTimeout(()=>r(!1),2e3)}catch{}}return(0,K.jsx)(P,{open:e!==null,onOpenChange:e=>{e||(r(!1),t())},children:e?(0,K.jsxs)($e,{className:`max-w-lg`,showCloseButton:!1,onInteractOutside:e=>e.preventDefault(),onEscapeKeyDown:e=>e.preventDefault(),children:[(0,K.jsxs)(B,{children:[(0,K.jsx)(V,{children:D()}),(0,K.jsx)(z,{children:a({name:e.accountName})})]}),(0,K.jsx)(`div`,{className:`oc-sa__minted-warning`,children:p()}),(0,K.jsxs)(`div`,{className:`oc-sa__minted-box`,children:[(0,K.jsx)(`code`,{className:`oc-sa__minted-plain`,children:e.plaintext}),(0,K.jsxs)(j,{variant:`outline`,size:`sm`,onClick:()=>void i(),"aria-label":O(),children:[n?(0,K.jsx)(Ze,{}):(0,K.jsx)(N,{}),n?_():k()]})]}),(0,K.jsx)(H,{children:(0,K.jsx)(j,{onClick:()=>{r(!1),t()},children:T()})})]}):null})}function Z(e){return new Date(e).toLocaleString(`fr-FR`)}function Q(e){return e===null?!1:Date.now()-e>lt}function ft(e){return e===null?C():new Date(e).toLocaleString(`fr-FR`)}function pt(e){return e===null?`—`:new Date(e).toLocaleDateString(`fr-FR`)}function $(e){return e.disabled?(0,K.jsx)(I,{variant:`destructive`,children:w()}):e.expiresAt!==null&&e.expiresAt<Date.now()?(0,K.jsx)(I,{variant:`outline`,children:y()}):(0,K.jsx)(I,{variant:`outline`,children:v()})}export{X as ServiceAccountsTab};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$ as r,At as i,Ct as a,Dt as o,Et as s,J as c,Mt as l,Ot as u,Q as d,St as f,Tt as p,X as m,Y as h,Z as g,_t as _,at as v,bt as y,
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$ as r,At as i,Ct as a,Dt as o,Et as s,J as c,Mt as l,Ot as u,Q as d,St as f,Tt as p,X as m,Y as h,Z as g,_t as _,at as v,bt as y,ct as b,dt as x,et as S,fO as C,ft as w,gt as T,ht as E,it as D,jt as O,kt as k,lt as A,mt as j,nt as M,ot as N,pt as P,rt as F,st as I,tt as L,ut as R,vO as z,vt as B,wt as V,xt as H,yO as U,yt as W}from"./dist-DsBcH2-2.js";import{t as G}from"./button-9c1aLUeO.js";import{j as K}from"./index-DsOZBPOX.js";import{t as q}from"./DataTableShell-VIRQvS8e.js";var J=t(e(),1),Y=n(),X={hung:()=>E(),wrong_result:()=>j(),error:()=>P(),other:()=>w()},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=z(C.subAgentReports.respondToReport),[i,a]=(0,J.useState)(e.thread),[o,s]=(0,J.useState)(``),[c,l]=(0,J.useState)(!1);async function u(){let t=o.trim();if(!(!t||c)){l(!0);try{await n({reportId:e._id,text:t}),a(e=>[...e,{authorRole:`admin`,text:t,at:Date.now()}]),s(``)}finally{l(!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),` · `,x({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:R()}),(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:A()}),i.length>0?(0,Y.jsx)(`div`,{className:`oc-fbadmin__thread`,children:i.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():I()}),(0,Y.jsx)(`span`,{className:`oc-notif__msg-text`,children:e.text})]},t))}):(0,Y.jsx)(`p`,{className:`oc-fbadmin__meta`,children:N()}),(0,Y.jsx)(`textarea`,{className:`oc-feedback__textarea`,placeholder:v(),value:o,maxLength:2e3,rows:3,onChange:e=>s(e.target.value.slice(0,2e3))}),(0,Y.jsx)(`div`,{className:`oc-fbadmin__row`,style:{justifyContent:`flex-end`},children:(0,Y.jsx)(G,{size:`sm`,onClick:()=>void u(),disabled:!o.trim()||c,children:c?F():D()})})]}),(0,Y.jsxs)(`section`,{children:[(0,Y.jsxs)(`h4`,{className:`oc-fbadmin__h`,children:[M({count:t.children.length}),t.childrenTruncated?` ${L()}`:``,t.textTruncated?` ${S()}`:``]}),(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?` · ${r()}`:``]}),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:d()}),(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:g()}),(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 ee(){let e=U(C.subAgentReports.listForAdmin,{}),t=z(C.subAgentReports.readReport),n=z(C.subAgentReports.deleteReport),r=K(),[d,g]=(0,J.useState)(null),[v,b]=(0,J.useState)({});async function x(e){if(d===e._id){g(null);return}if(!v[e._id]){let n=await t({reportId:e._id});b(t=>({...t,[e._id]:n}))}g(e._id)}async function S(e){await r({title:m(),description:h(),confirmLabel:c(),destructive:!0})&&(await n({reportId:e._id}),d===e._id&&g(null))}return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(`p`,{className:`oc-admin__hint`,children:[i(),` `,(0,Y.jsx)(`strong`,{children:k()}),` `,u()]}),(0,Y.jsx)(q,{title:l(),rows:e,emptyHint:O(),isExpanded:e=>d===e._id&&!!v[e._id],renderExpanded:e=>v[e._id]?(0,Y.jsx)($,{data:v[e._id]}):null,columns:[{header:o(),cell:e=>new Date(e.at).toLocaleString(`fr-FR`),sort:e=>e.at},{header:s(),cell:e=>Z(e.category),sort:e=>Z(e.category)},{header:p(),cell:e=>`${e.failedCount}/${e.totalCount}`,sort:e=>e.failedCount},{header:V(),cell:e=>(e.reporterEmail||e.reporterName||`—`)+(e.impersonated&&e.realOperatorEmail?` ${H({operator:e.realOperatorEmail})}`:``),sort:e=>e.reporterEmail||e.reporterName||null},{header:a(),cell:e=>e.hasComment?`✎`:`—`,sort:e=>+!!e.hasComment},{header:f(),cell:e=>e.answered?(0,Y.jsx)(`span`,{className:`oc-fbadmin__pill is-ok`,children:y()}):(0,Y.jsx)(`span`,{className:`oc-fbadmin__pill`,children:W()}),sort:e=>+!!e.answered}],rowActions:e=>[{label:d===e._id?_():B(),onSelect:()=>void x(e)},{label:T(),onSelect:()=>void S(e),variant:`destructive`}]})]})}export{ee as SubAgentReportsTab};
|